From: support Date: Wed, 26 Oct 2022 04:43:33 +0000 (+0000) Subject: Built motion from commit b4a52afc.|2.6.20 X-Git-Url: http://repos.xcallymotion.com/?a=commitdiff_plain;h=e16be162b5099702a57c9d8af6dd561790cf0048;p=motion2.git Built motion from commit b4a52afc.|2.6.20 --- diff --git a/apidoc/api_project.js b/apidoc/api_project.js index be06e5c..9188002 100644 --- a/apidoc/api_project.js +++ b/apidoc/api_project.js @@ -1,6 +1,6 @@ define({ "name": "xCALLY Motion API", - "version": "2.6.19", + "version": "2.6.20", "description": "Thank you for choosing xCALLY MOTION, one of the first Omni Channel solution integrated with AsteriskTM and the most innovative real time solutions available on the market.", "title": "xCALLY MOTION API", "header": { @@ -17,7 +17,7 @@ define({ "apidoc": "0.3.0", "generator": { "name": "apidoc", - "time": "2022-10-20T06:31:00.055Z", + "time": "2022-10-26T04:35:14.451Z", "url": "http://apidocjs.com", "version": "0.24.0" } diff --git a/apidoc/api_project.json b/apidoc/api_project.json index 89e4214..cacf6e5 100644 --- a/apidoc/api_project.json +++ b/apidoc/api_project.json @@ -1,6 +1,6 @@ { "name": "xCALLY Motion API", - "version": "2.6.19", + "version": "2.6.20", "description": "Thank you for choosing xCALLY MOTION, one of the first Omni Channel solution integrated with AsteriskTM and the most innovative real time solutions available on the market.", "title": "xCALLY MOTION API", "header": { @@ -17,7 +17,7 @@ "apidoc": "0.3.0", "generator": { "name": "apidoc", - "time": "2022-10-20T06:31:00.055Z", + "time": "2022-10-26T04:35:14.451Z", "url": "http://apidocjs.com", "version": "0.24.0" } diff --git a/npm-shrinkwrap.json b/npm-shrinkwrap.json index 0549b25..1ceedbc 100644 --- a/npm-shrinkwrap.json +++ b/npm-shrinkwrap.json @@ -1,6 +1,6 @@ { "name": "motion", - "version": "2.6.19", + "version": "2.6.20", "dependencies": { "@babel/code-frame": { "version": "7.18.6", diff --git a/package.json b/package.json index f66562f..79e37a8 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "motion", - "version": "2.6.19", + "version": "2.6.20", "description": "xCALLY Motion is the new Realtime asynchronous solution for your multichannel contact center over Asterisk.", "main": "server/app.js", "engines": { diff --git a/server/api/action/action.attributes.js b/server/api/action/action.attributes.js index c1bbbdd..f0811cd 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 _0xe6be=['exports','getDataValue','action','STRING','integration','motionbar','urlForward','browser','script','Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script','contactManager[autoCreate(0=No,1=Yes)],\x20urlForward[URL],\x20script[type],\x20integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20browser[TemplateId,URL]','contactManager[searchFields],\x20script[script],\x20integration[ConfigurationId],\x20motionbar[NULL,eventVariables(0=No,1=Yes),WinAppArguments],\x20browser[NULL,eventVariables(0=No,1=Yes)]','browser[location(0=NewTab,1=NewWindow,2=MotionTab)],\x20contactManager[autoCreateField]','urlForward[timeout],\x20browser[windowWidth],\x20contactManager[ignoreDialerContactId]','urlForward[headers],\x20browser[wsindowHeight]','TEXT','sequelize'];(function(_0x45b100,_0x29a4b1){var _0x1b41f8=function(_0x5a48b4){while(--_0x5a48b4){_0x45b100['push'](_0x45b100['shift']());}};_0x1b41f8(++_0x29a4b1);}(_0xe6be,0x153));var _0xee6b=function(_0xf4a50c,_0x887ae0){_0xf4a50c=_0xf4a50c-0x0;var _0x301d21=_0xe6be[_0xf4a50c];return _0x301d21;};'use strict';var Sequelize=require(_0xee6b('0x0'));module[_0xee6b('0x1')]={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x3a851f){return this[_0xee6b('0x2')](_0xee6b('0x3'));}},'action':{'type':Sequelize[_0xee6b('0x4')],'allowNull':![],'validate':{'isIn':{'args':[['contactManager',_0xee6b('0x5'),_0xee6b('0x6'),'jscripty',_0xee6b('0x7'),_0xee6b('0x8'),'bot',_0xee6b('0x9')]],'msg':'Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script'}},'comment':_0xee6b('0xa')},'data1':{'type':Sequelize['STRING'](0x1000),'comment':'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)]'},'data2':{'type':Sequelize[_0xee6b('0x4')](0x1000),'comment':_0xee6b('0xb')},'data3':{'type':Sequelize[_0xee6b('0x4')](0x1000),'comment':_0xee6b('0xc')},'data4':{'type':Sequelize[_0xee6b('0x4')](0x1000),'comments':_0xee6b('0xd')},'data5':{'type':Sequelize['STRING'](0x1000),'comments':_0xee6b('0xe')},'data6':{'type':Sequelize[_0xee6b('0x4')],'comments':_0xee6b('0xf')},'data7':{'type':Sequelize[_0xee6b('0x10')],'comments':'urlForward[body]'}}; \ No newline at end of file +var _0x0e93=['Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script','STRING','contactManager[searchFields],\x20script[script],\x20integration[ConfigurationId],\x20motionbar[NULL,eventVariables(0=No,1=Yes),WinAppArguments],\x20browser[NULL,eventVariables(0=No,1=Yes)]','browser[location(0=NewTab,1=NewWindow,2=MotionTab)],\x20contactManager[autoCreateField]','urlForward[timeout],\x20browser[windowWidth],\x20contactManager[ignoreDialerContactId]','TEXT','exports','getDataValue','action','contactManager','integration','motionbar','jscripty','urlForward','browser','script'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0e93,0x1b6));var _0x30e9=function(_0x5c27f4,_0x502ce2){_0x5c27f4=_0x5c27f4-0x0;var _0x55698c=_0x0e93[_0x5c27f4];return _0x55698c;};'use strict';var Sequelize=require('sequelize');module[_0x30e9('0x0')]={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x501c36){return this[_0x30e9('0x1')](_0x30e9('0x2'));}},'action':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'isIn':{'args':[[_0x30e9('0x3'),_0x30e9('0x4'),_0x30e9('0x5'),_0x30e9('0x6'),_0x30e9('0x7'),_0x30e9('0x8'),'bot',_0x30e9('0x9')]],'msg':'Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script'}},'comment':_0x30e9('0xa')},'data1':{'type':Sequelize[_0x30e9('0xb')](0x1000),'comment':'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)]'},'data2':{'type':Sequelize['STRING'](0x1000),'comment':'contactManager[autoCreate(0=No,1=Yes)],\x20urlForward[URL],\x20script[type],\x20integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20browser[TemplateId,URL]'},'data3':{'type':Sequelize[_0x30e9('0xb')](0x1000),'comment':_0x30e9('0xc')},'data4':{'type':Sequelize[_0x30e9('0xb')](0x1000),'comments':_0x30e9('0xd')},'data5':{'type':Sequelize[_0x30e9('0xb')](0x1000),'comments':_0x30e9('0xe')},'data6':{'type':Sequelize[_0x30e9('0xb')],'comments':'urlForward[headers],\x20browser[wsindowHeight]'},'data7':{'type':Sequelize[_0x30e9('0xf')],'comments':'urlForward[body]'}}; \ No newline at end of file diff --git a/server/api/action/action.controller.js b/server/api/action/action.controller.js index df6daf9..7a29727 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 _0xc2dc=['path','ejs','fs-extra','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','then','destroy','error','stack','name','send','update','body','Action','find','params','catch','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util'];(function(_0x2575cb,_0x33a71f){var _0x54107a=function(_0x1da8c8){while(--_0x1da8c8){_0x2575cb['push'](_0x2575cb['shift']());}};_0x54107a(++_0x33a71f);}(_0xc2dc,0x1ed));var _0xcc2d=function(_0x249f8c,_0xfb3946){_0x249f8c=_0x249f8c-0x0;var _0x5e224a=_0xc2dc[_0x249f8c];return _0x5e224a;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xcc2d('0x0'));var zipdir=require(_0xcc2d('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xcc2d('0x2'));var moment=require(_0xcc2d('0x3'));var BPromise=require(_0xcc2d('0x4'));var Mustache=require(_0xcc2d('0x5'));var util=require(_0xcc2d('0x6'));var path=require(_0xcc2d('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xcc2d('0x8'));var fs=require('fs');var fs_extra=require(_0xcc2d('0x9'));var _=require(_0xcc2d('0xa'));var squel=require(_0xcc2d('0xb'));var crypto=require('crypto');var jsforce=require(_0xcc2d('0xc'));var deskjs=require(_0xcc2d('0xd'));var toCsv=require(_0xcc2d('0xe'));var querystring=require(_0xcc2d('0xf'));var Papa=require(_0xcc2d('0x10'));var Redis=require(_0xcc2d('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xcc2d('0x12'));var as=require(_0xcc2d('0x13'));var hardwareService=require(_0xcc2d('0x14'));var logger=require(_0xcc2d('0x15'))(_0xcc2d('0x16'));var utils=require(_0xcc2d('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xcc2d('0x18'));var db=require(_0xcc2d('0x19'))['db'];function respondWithStatusCode(_0x38d44e,_0x471d72){_0x471d72=_0x471d72||0xcc;return function(_0x2acd27){if(_0x2acd27){return _0x38d44e[_0xcc2d('0x1a')](_0x471d72);}return _0x38d44e[_0xcc2d('0x1b')](_0x471d72)[_0xcc2d('0x1c')]();};}function respondWithResult(_0x2c08fc,_0x51ee71){_0x51ee71=_0x51ee71||0xc8;return function(_0x5e7253){if(_0x5e7253){return _0x2c08fc[_0xcc2d('0x1b')](_0x51ee71)[_0xcc2d('0x1d')](_0x5e7253);}};}function respondWithFilteredResult(_0x2bc118,_0x699589){return function(_0x317bca){if(_0x317bca){var _0x24ecc8=typeof _0x699589[_0xcc2d('0x1e')]===_0xcc2d('0x1f')&&typeof _0x699589[_0xcc2d('0x20')]===_0xcc2d('0x1f');var _0x3a0071=_0x317bca[_0xcc2d('0x21')];var _0x28386d=_0x24ecc8?0x0:_0x699589[_0xcc2d('0x1e')];var _0xdfc9fb=_0x24ecc8?_0x317bca['count']:_0x699589[_0xcc2d('0x1e')]+_0x699589[_0xcc2d('0x20')];var _0x559077;if(_0xdfc9fb>=_0x3a0071){_0xdfc9fb=_0x3a0071;_0x559077=0xc8;}else{_0x559077=0xce;}_0x2bc118[_0xcc2d('0x1b')](_0x559077);return _0x2bc118[_0xcc2d('0x22')](_0xcc2d('0x23'),_0x28386d+'-'+_0xdfc9fb+'/'+_0x3a0071)['json'](_0x317bca);}return null;};}function patchUpdates(_0x1121d4){return function(_0x3a394a){try{jsonpatch[_0xcc2d('0x24')](_0x3a394a,_0x1121d4,!![]);}catch(_0xc3a269){return BPromise['reject'](_0xc3a269);}return _0x3a394a[_0xcc2d('0x25')]();};}function saveUpdates(_0x4fc52f,_0x4d14ef){return function(_0x4c4690){if(_0x4c4690){return _0x4c4690['update'](_0x4fc52f)[_0xcc2d('0x26')](function(_0x4db0ad){return _0x4db0ad;});}return null;};}function removeEntity(_0x40b7ef,_0xf14946){return function(_0x3a94f8){if(_0x3a94f8){return _0x3a94f8[_0xcc2d('0x27')]()[_0xcc2d('0x26')](function(){_0x40b7ef[_0xcc2d('0x1b')](0xcc)[_0xcc2d('0x1c')]();});}};}function handleEntityNotFound(_0x4483e5,_0x49567f){return function(_0xa456d4){if(!_0xa456d4){_0x4483e5[_0xcc2d('0x1a')](0x194);}return _0xa456d4;};}function handleError(_0x3de478,_0x337cf7){_0x337cf7=_0x337cf7||0x1f4;return function(_0x1f6660){logger[_0xcc2d('0x28')](_0x1f6660[_0xcc2d('0x29')]);if(_0x1f6660[_0xcc2d('0x2a')]){delete _0x1f6660[_0xcc2d('0x2a')];}_0x3de478['status'](_0x337cf7)[_0xcc2d('0x2b')](_0x1f6660);};}exports[_0xcc2d('0x2c')]=function(_0x2463d1,_0x43ea8f){if(_0x2463d1[_0xcc2d('0x2d')]['id']){delete _0x2463d1[_0xcc2d('0x2d')]['id'];}return db[_0xcc2d('0x2e')][_0xcc2d('0x2f')]({'where':{'id':_0x2463d1[_0xcc2d('0x30')]['id']}})[_0xcc2d('0x26')](handleEntityNotFound(_0x43ea8f,null))['then'](saveUpdates(_0x2463d1[_0xcc2d('0x2d')],null))['then'](respondWithResult(_0x43ea8f,null))[_0xcc2d('0x31')](handleError(_0x43ea8f,null));};exports[_0xcc2d('0x27')]=function(_0x16b347,_0x568032){return db[_0xcc2d('0x2e')][_0xcc2d('0x2f')]({'where':{'id':_0x16b347[_0xcc2d('0x30')]['id']}})['then'](handleEntityNotFound(_0x568032,null))['then'](removeEntity(_0x568032,null))[_0xcc2d('0x31')](handleError(_0x568032,null));}; \ No newline at end of file +var _0xf0e9=['catch','params','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','status','undefined','limit','offset','set','Content-Range','json','apply','reject','save','update','then','destroy','end','error','stack','name','body','Action','find'];(function(_0x23a79e,_0x235f89){var _0x3dab57=function(_0x346cf4){while(--_0x346cf4){_0x23a79e['push'](_0x23a79e['shift']());}};_0x3dab57(++_0x235f89);}(_0xf0e9,0x197));var _0x9f0e=function(_0x51dbe1,_0x18f331){_0x51dbe1=_0x51dbe1-0x0;var _0x99910e=_0xf0e9[_0x51dbe1];return _0x99910e;};'use strict';var emlformat=require(_0x9f0e('0x0'));var rimraf=require(_0x9f0e('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x9f0e('0x2'));var moment=require(_0x9f0e('0x3'));var BPromise=require(_0x9f0e('0x4'));var Mustache=require(_0x9f0e('0x5'));var util=require(_0x9f0e('0x6'));var path=require(_0x9f0e('0x7'));var sox=require(_0x9f0e('0x8'));var csv=require(_0x9f0e('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x9f0e('0xa'));var crypto=require(_0x9f0e('0xb'));var jsforce=require(_0x9f0e('0xc'));var deskjs=require(_0x9f0e('0xd'));var toCsv=require(_0x9f0e('0x9'));var querystring=require('querystring');var Papa=require(_0x9f0e('0xe'));var Redis=require(_0x9f0e('0xf'));var authService=require(_0x9f0e('0x10'));var qs=require(_0x9f0e('0x11'));var as=require(_0x9f0e('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x9f0e('0x13'));var utils=require(_0x9f0e('0x14'));var config=require(_0x9f0e('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x9f0e('0x16'))['db'];function respondWithStatusCode(_0x5e901a,_0x32d9ac){_0x32d9ac=_0x32d9ac||0xcc;return function(_0x48cac0){if(_0x48cac0){return _0x5e901a['sendStatus'](_0x32d9ac);}return _0x5e901a[_0x9f0e('0x17')](_0x32d9ac)['end']();};}function respondWithResult(_0x2c60a5,_0x5d393f){_0x5d393f=_0x5d393f||0xc8;return function(_0x42b47d){if(_0x42b47d){return _0x2c60a5[_0x9f0e('0x17')](_0x5d393f)['json'](_0x42b47d);}};}function respondWithFilteredResult(_0x15d79c,_0x9f5e87){return function(_0x28f464){if(_0x28f464){var _0x4d7520=typeof _0x9f5e87['offset']===_0x9f0e('0x18')&&typeof _0x9f5e87[_0x9f0e('0x19')]===_0x9f0e('0x18');var _0x41952f=_0x28f464['count'];var _0x41ac56=_0x4d7520?0x0:_0x9f5e87['offset'];var _0x178742=_0x4d7520?_0x28f464['count']:_0x9f5e87[_0x9f0e('0x1a')]+_0x9f5e87[_0x9f0e('0x19')];var _0x44edc5;if(_0x178742>=_0x41952f){_0x178742=_0x41952f;_0x44edc5=0xc8;}else{_0x44edc5=0xce;}_0x15d79c[_0x9f0e('0x17')](_0x44edc5);return _0x15d79c[_0x9f0e('0x1b')](_0x9f0e('0x1c'),_0x41ac56+'-'+_0x178742+'/'+_0x41952f)[_0x9f0e('0x1d')](_0x28f464);}return null;};}function patchUpdates(_0x3575b9){return function(_0x19008e){try{jsonpatch[_0x9f0e('0x1e')](_0x19008e,_0x3575b9,!![]);}catch(_0x505659){return BPromise[_0x9f0e('0x1f')](_0x505659);}return _0x19008e[_0x9f0e('0x20')]();};}function saveUpdates(_0x52c048,_0x50a5c7){return function(_0x965772){if(_0x965772){return _0x965772[_0x9f0e('0x21')](_0x52c048)[_0x9f0e('0x22')](function(_0xe78e6d){return _0xe78e6d;});}return null;};}function removeEntity(_0x2c9b51,_0xdf5433){return function(_0x1488b3){if(_0x1488b3){return _0x1488b3[_0x9f0e('0x23')]()[_0x9f0e('0x22')](function(){_0x2c9b51[_0x9f0e('0x17')](0xcc)[_0x9f0e('0x24')]();});}};}function handleEntityNotFound(_0x23ffd2,_0x42413b){return function(_0x318e4e){if(!_0x318e4e){_0x23ffd2['sendStatus'](0x194);}return _0x318e4e;};}function handleError(_0x50a1e5,_0x3cf944){_0x3cf944=_0x3cf944||0x1f4;return function(_0x445164){logger[_0x9f0e('0x25')](_0x445164[_0x9f0e('0x26')]);if(_0x445164[_0x9f0e('0x27')]){delete _0x445164[_0x9f0e('0x27')];}_0x50a1e5[_0x9f0e('0x17')](_0x3cf944)['send'](_0x445164);};}exports[_0x9f0e('0x21')]=function(_0x3db57e,_0x1a25b4){if(_0x3db57e[_0x9f0e('0x28')]['id']){delete _0x3db57e[_0x9f0e('0x28')]['id'];}return db[_0x9f0e('0x29')][_0x9f0e('0x2a')]({'where':{'id':_0x3db57e['params']['id']}})[_0x9f0e('0x22')](handleEntityNotFound(_0x1a25b4,null))[_0x9f0e('0x22')](saveUpdates(_0x3db57e[_0x9f0e('0x28')],null))[_0x9f0e('0x22')](respondWithResult(_0x1a25b4,null))[_0x9f0e('0x2b')](handleError(_0x1a25b4,null));};exports[_0x9f0e('0x23')]=function(_0x579486,_0x5a41cf){return db[_0x9f0e('0x29')][_0x9f0e('0x2a')]({'where':{'id':_0x579486[_0x9f0e('0x2c')]['id']}})[_0x9f0e('0x22')](handleEntityNotFound(_0x5a41cf,null))[_0x9f0e('0x22')](removeEntity(_0x5a41cf,null))[_0x9f0e('0x2b')](handleError(_0x5a41cf,null));}; \ No newline at end of file diff --git a/server/api/action/action.model.js b/server/api/action/action.model.js index 58b7d82..1a4b3b7 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 _0x2e54=['rimraf','../../config/environment','./action.attributes','exports','Action','tools_actions','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x2e54,0xc1));var _0x42e5=function(_0x1a3c64,_0x18f1fa){_0x1a3c64=_0x1a3c64-0x0;var _0x4da2c2=_0x2e54[_0x1a3c64];return _0x4da2c2;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x42e5('0x0'))(_0x42e5('0x1'));var moment=require(_0x42e5('0x2'));var BPromise=require(_0x42e5('0x3'));var rp=require(_0x42e5('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x42e5('0x5'));var config=require(_0x42e5('0x6'));var attributes=require(_0x42e5('0x7'));module[_0x42e5('0x8')]=function(_0x2b9dcb,_0x5f1ccb){return _0x2b9dcb['define'](_0x42e5('0x9'),attributes,{'tableName':_0x42e5('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3b91=['path','rimraf','../../config/environment','exports','define','Action','tools_actions','lodash','util','../../config/logger','bluebird','request-promise'];(function(_0xa76f70,_0x115a75){var _0x24459b=function(_0x425831){while(--_0x425831){_0xa76f70['push'](_0xa76f70['shift']());}};_0x24459b(++_0x115a75);}(_0x3b91,0x127));var _0x13b9=function(_0x909ba0,_0x48d8be){_0x909ba0=_0x909ba0-0x0;var _0x2673c5=_0x3b91[_0x909ba0];return _0x2673c5;};'use strict';var _=require(_0x13b9('0x0'));var util=require(_0x13b9('0x1'));var logger=require(_0x13b9('0x2'))('api');var moment=require('moment');var BPromise=require(_0x13b9('0x3'));var rp=require(_0x13b9('0x4'));var fs=require('fs');var path=require(_0x13b9('0x5'));var rimraf=require(_0x13b9('0x6'));var config=require(_0x13b9('0x7'));var attributes=require('./action.attributes');module[_0x13b9('0x8')]=function(_0x33bcd2,_0x4fe8dd){return _0x33bcd2[_0x13b9('0x9')](_0x13b9('0xa'),attributes,{'tableName':_0x13b9('0xb'),'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 820ea6c..c120798 100644 --- a/server/api/action/action.rpc.js +++ b/server/api/action/action.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1261=['then','info','Action,\x20%s,\x20%s','request\x20sent','Action,\x20%s,\x20%s,\x20%s','error','code','message','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request'];(function(_0xe3a075,_0x31ecfb){var _0x18d717=function(_0x4c4dec){while(--_0x4c4dec){_0xe3a075['push'](_0xe3a075['shift']());}};_0x18d717(++_0x31ecfb);}(_0x1261,0x144));var _0x1126=function(_0x391507,_0x564142){_0x391507=_0x391507-0x0;var _0x47fdc4=_0x1261[_0x391507];return _0x47fdc4;};'use strict';var _=require('lodash');var util=require(_0x1126('0x0'));var moment=require(_0x1126('0x1'));var BPromise=require(_0x1126('0x2'));var rs=require(_0x1126('0x3'));var fs=require('fs');var Redis=require(_0x1126('0x4'));var db=require(_0x1126('0x5'))['db'];var utils=require(_0x1126('0x6'));var logger=require(_0x1126('0x7'))(_0x1126('0x8'));var config=require(_0x1126('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x1126('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x907180,_0x4f239c,_0x17e5f0){return new BPromise(function(_0x28772d,_0x245be9){return client[_0x1126('0xb')](_0x907180,_0x17e5f0)[_0x1126('0xc')](function(_0x59cfa1){logger[_0x1126('0xd')](_0x1126('0xe'),_0x4f239c,_0x1126('0xf'));logger['debug'](_0x1126('0x10'),_0x4f239c,'request\x20sent',JSON['stringify'](_0x59cfa1));if(_0x59cfa1[_0x1126('0x11')]){if(_0x59cfa1['error'][_0x1126('0x12')]===0x1f4){logger[_0x1126('0x11')](_0x1126('0xe'),_0x4f239c,_0x59cfa1[_0x1126('0x11')][_0x1126('0x13')]);return _0x245be9(_0x59cfa1[_0x1126('0x11')][_0x1126('0x13')]);}logger[_0x1126('0x11')](_0x1126('0xe'),_0x4f239c,_0x59cfa1['error']['message']);return _0x28772d(_0x59cfa1[_0x1126('0x11')][_0x1126('0x13')]);}else{logger[_0x1126('0xd')]('Action,\x20%s,\x20%s',_0x4f239c,_0x1126('0xf'));_0x28772d(_0x59cfa1['result'][_0x1126('0x13')]);}})[_0x1126('0x14')](function(_0x257b5f){logger['error'](_0x1126('0xe'),_0x4f239c,_0x257b5f);_0x245be9(_0x257b5f);});});} \ No newline at end of file +var _0x4975=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','Action,\x20%s,\x20%s','request\x20sent','debug','Action,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','moment','bluebird','randomstring'];(function(_0x2d8fc2,_0x1c461d){var _0x3a9e53=function(_0x18941c){while(--_0x18941c){_0x2d8fc2['push'](_0x2d8fc2['shift']());}};_0x3a9e53(++_0x1c461d);}(_0x4975,0x86));var _0x5497=function(_0x14f63f,_0x24fb36){_0x14f63f=_0x14f63f-0x0;var _0x256758=_0x4975[_0x14f63f];return _0x256758;};'use strict';var _=require(_0x5497('0x0'));var util=require('util');var moment=require(_0x5497('0x1'));var BPromise=require(_0x5497('0x2'));var rs=require(_0x5497('0x3'));var fs=require('fs');var Redis=require(_0x5497('0x4'));var db=require(_0x5497('0x5'))['db'];var utils=require(_0x5497('0x6'));var logger=require(_0x5497('0x7'))(_0x5497('0x8'));var config=require(_0x5497('0x9'));var jayson=require(_0x5497('0xa'));var client=jayson['client'][_0x5497('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4f563d,_0x1d0019,_0x674a2a){return new BPromise(function(_0x368e8b,_0x57f930){return client[_0x5497('0xc')](_0x4f563d,_0x674a2a)['then'](function(_0x1f63d8){logger[_0x5497('0xd')](_0x5497('0xe'),_0x1d0019,_0x5497('0xf'));logger[_0x5497('0x10')](_0x5497('0x11'),_0x1d0019,_0x5497('0xf'),JSON[_0x5497('0x12')](_0x1f63d8));if(_0x1f63d8['error']){if(_0x1f63d8['error']['code']===0x1f4){logger[_0x5497('0x13')](_0x5497('0xe'),_0x1d0019,_0x1f63d8[_0x5497('0x13')][_0x5497('0x14')]);return _0x57f930(_0x1f63d8[_0x5497('0x13')][_0x5497('0x14')]);}logger[_0x5497('0x13')](_0x5497('0xe'),_0x1d0019,_0x1f63d8[_0x5497('0x13')][_0x5497('0x14')]);return _0x368e8b(_0x1f63d8['error'][_0x5497('0x14')]);}else{logger['info'](_0x5497('0xe'),_0x1d0019,_0x5497('0xf'));_0x368e8b(_0x1f63d8[_0x5497('0x15')][_0x5497('0x14')]);}})[_0x5497('0x16')](function(_0x4073e6){logger[_0x5497('0x13')]('Action,\x20%s,\x20%s',_0x1d0019,_0x4073e6);_0x57f930(_0x4073e6);});});} \ No newline at end of file diff --git a/server/api/action/index.js b/server/api/action/index.js index 4cf7f32..65d88f1 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 _0xb2de=['../../config/environment','./action.controller','put','isAuthenticated','delete','/:id','util','connect-timeout','Router','fs-extra','../../components/auth/service'];(function(_0x438cd3,_0x1342ff){var _0x35033f=function(_0x3672b4){while(--_0x3672b4){_0x438cd3['push'](_0x438cd3['shift']());}};_0x35033f(++_0x1342ff);}(_0xb2de,0x187));var _0xeb2d=function(_0x3fc3fa,_0x18ad3f){_0x3fc3fa=_0x3fc3fa-0x0;var _0x1ac459=_0xb2de[_0x3fc3fa];return _0x1ac459;};'use strict';var multer=require('multer');var util=require(_0xeb2d('0x0'));var path=require('path');var timeout=require(_0xeb2d('0x1'));var express=require('express');var router=express[_0xeb2d('0x2')]();var fs_extra=require(_0xeb2d('0x3'));var auth=require(_0xeb2d('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xeb2d('0x5'));var controller=require(_0xeb2d('0x6'));router[_0xeb2d('0x7')]('/:id',auth[_0xeb2d('0x8')](),controller['update']);router[_0xeb2d('0x9')](_0xeb2d('0xa'),auth[_0xeb2d('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x9ea3=['isAuthenticated','update','delete','exports','multer','util','connect-timeout','express','Router','fs-extra','../../config/environment','./action.controller','put'];(function(_0x28101b,_0x264a9b){var _0x1d562f=function(_0x35f53e){while(--_0x35f53e){_0x28101b['push'](_0x28101b['shift']());}};_0x1d562f(++_0x264a9b);}(_0x9ea3,0x170));var _0x39ea=function(_0x3358ba,_0x24c5fc){_0x3358ba=_0x3358ba-0x0;var _0x296e73=_0x9ea3[_0x3358ba];return _0x296e73;};'use strict';var multer=require(_0x39ea('0x0'));var util=require(_0x39ea('0x1'));var path=require('path');var timeout=require(_0x39ea('0x2'));var express=require(_0x39ea('0x3'));var router=express[_0x39ea('0x4')]();var fs_extra=require(_0x39ea('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x39ea('0x6'));var controller=require(_0x39ea('0x7'));router[_0x39ea('0x8')]('/:id',auth[_0x39ea('0x9')](),controller[_0x39ea('0xa')]);router[_0x39ea('0xb')]('/:id',auth[_0x39ea('0x9')](),controller['destroy']);module[_0x39ea('0xc')]=router; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.attributes.js b/server/api/analyticCustomReport/analyticCustomReport.attributes.js index 123d549..9e87710 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 _0xd8fb=['TEXT','sequelize','exports','STRING'];(function(_0x5f532d,_0x191edf){var _0x43ad50=function(_0x386fa9){while(--_0x386fa9){_0x5f532d['push'](_0x5f532d['shift']());}};_0x43ad50(++_0x191edf);}(_0xd8fb,0x99));var _0xbd8f=function(_0x1448be,_0x1e85dd){_0x1448be=_0x1448be-0x0;var _0x41abbe=_0xd8fb[_0x1448be];return _0x41abbe;};'use strict';var Sequelize=require(_0xbd8f('0x0'));module[_0xbd8f('0x1')]={'name':{'type':Sequelize[_0xbd8f('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xbd8f('0x2')]},'parent':{'type':Sequelize['STRING']},'table':{'type':Sequelize['STRING']},'conditions':{'type':Sequelize['TEXT']},'joins':{'type':Sequelize[_0xbd8f('0x3')]}}; \ No newline at end of file +var _0x5fd1=['STRING','TEXT','sequelize'];(function(_0x57cbfb,_0x2de760){var _0x4cb933=function(_0x33cf6a){while(--_0x33cf6a){_0x57cbfb['push'](_0x57cbfb['shift']());}};_0x4cb933(++_0x2de760);}(_0x5fd1,0x155));var _0x15fd=function(_0x12bd4a,_0x12b7a0){_0x12bd4a=_0x12bd4a-0x0;var _0x298112=_0x5fd1[_0x12bd4a];return _0x298112;};'use strict';var Sequelize=require(_0x15fd('0x0'));module['exports']={'name':{'type':Sequelize[_0x15fd('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x15fd('0x1')]},'parent':{'type':Sequelize[_0x15fd('0x1')]},'table':{'type':Sequelize['STRING']},'conditions':{'type':Sequelize['TEXT']},'joins':{'type':Sequelize[_0x15fd('0x2')]}}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.controller.js b/server/api/analyticCustomReport/analyticCustomReport.controller.js index 7967437..559ce66 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 _0xffe1=['sequelize','QueryTypes','SELECT','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','IS\x20EMPTY','operator','condition','value','keyBy','foreignKey','clone','output','web','%s-%s.%s','randomstring','generate','csv','custom','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','Run\x20Query:','../../components/export/','../../files/reports','savename','COUNT(*)','run','runReport','COUNT(%s)','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','dbH','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','save','update','destroy','then','get','UserProfileResource','error','stack','name','send','index','map','AnalyticCustomReport','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','options','findAll','show','params','includeAll','include','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Reports','UserProfileSection','find','autoAssociation','CustomReports','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','preview','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\x20ASC)','SEC_TO_TIME(%s)','DATE(%s)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20NOT\x20EMPTY','rules','group','getFields','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','select','from','table','MetricId','metric','field','function','format','replace','groupBy','orderBy','DESC','alias','joins','parentKey','foreignTable','%s.%s\x20=\x20%s.%s','conditions','parse','debug','Limited\x20Query:','toString'];(function(_0x19a49f,_0x444d74){var _0x5351ae=function(_0x58b1ed){while(--_0x58b1ed){_0x19a49f['push'](_0x19a49f['shift']());}};_0x5351ae(++_0x444d74);}(_0xffe1,0xcc));var _0x1ffe=function(_0xa4c391,_0x5b0eaa){_0xa4c391=_0xa4c391-0x0;var _0x5f0f3f=_0xffe1[_0xa4c391];return _0x5f0f3f;};'use strict';var emlformat=require(_0x1ffe('0x0'));var rimraf=require(_0x1ffe('0x1'));var zipdir=require(_0x1ffe('0x2'));var jsonpatch=require(_0x1ffe('0x3'));var rp=require(_0x1ffe('0x4'));var moment=require(_0x1ffe('0x5'));var BPromise=require(_0x1ffe('0x6'));var Mustache=require(_0x1ffe('0x7'));var util=require('util');var path=require(_0x1ffe('0x8'));var sox=require(_0x1ffe('0x9'));var csv=require(_0x1ffe('0xa'));var ejs=require(_0x1ffe('0xb'));var fs=require('fs');var fs_extra=require(_0x1ffe('0xc'));var _=require('lodash');var squel=require(_0x1ffe('0xd'));var crypto=require(_0x1ffe('0xe'));var jsforce=require(_0x1ffe('0xf'));var deskjs=require(_0x1ffe('0x10'));var toCsv=require(_0x1ffe('0xa'));var querystring=require(_0x1ffe('0x11'));var Papa=require(_0x1ffe('0x12'));var Redis=require(_0x1ffe('0x13'));var authService=require(_0x1ffe('0x14'));var qs=require(_0x1ffe('0x15'));var as=require(_0x1ffe('0x16'));var hardwareService=require(_0x1ffe('0x17'));var logger=require(_0x1ffe('0x18'))('api');var utils=require(_0x1ffe('0x19'));var config=require(_0x1ffe('0x1a'));var licenseUtil=require(_0x1ffe('0x1b'));var db=require(_0x1ffe('0x1c'))['db'];var dbH=require(_0x1ffe('0x1c'))[_0x1ffe('0x1d')];function respondWithStatusCode(_0x4ac7fc,_0x1c2a86){_0x1c2a86=_0x1c2a86||0xcc;return function(_0x286c26){if(_0x286c26){return _0x4ac7fc[_0x1ffe('0x1e')](_0x1c2a86);}return _0x4ac7fc[_0x1ffe('0x1f')](_0x1c2a86)[_0x1ffe('0x20')]();};}function respondWithResult(_0x7b3221,_0x11128d){_0x11128d=_0x11128d||0xc8;return function(_0x53da5d){if(_0x53da5d){return _0x7b3221[_0x1ffe('0x1f')](_0x11128d)[_0x1ffe('0x21')](_0x53da5d);}};}function respondWithFilteredResult(_0x28f61e,_0xffa0cb){return function(_0x522dbd){if(_0x522dbd){var _0x2b25e7=typeof _0xffa0cb['offset']===_0x1ffe('0x22')&&typeof _0xffa0cb[_0x1ffe('0x23')]===_0x1ffe('0x22');var _0x954cb4=_0x522dbd[_0x1ffe('0x24')];var _0x230939=_0x2b25e7?0x0:_0xffa0cb[_0x1ffe('0x25')];var _0x5ef533=_0x2b25e7?_0x522dbd[_0x1ffe('0x24')]:_0xffa0cb[_0x1ffe('0x25')]+_0xffa0cb[_0x1ffe('0x23')];var _0x191154;if(_0x5ef533>=_0x954cb4){_0x5ef533=_0x954cb4;_0x191154=0xc8;}else{_0x191154=0xce;}_0x28f61e[_0x1ffe('0x1f')](_0x191154);return _0x28f61e[_0x1ffe('0x26')](_0x1ffe('0x27'),_0x230939+'-'+_0x5ef533+'/'+_0x954cb4)[_0x1ffe('0x21')](_0x522dbd);}return null;};}function patchUpdates(_0x264e23){return function(_0x569ad1){try{jsonpatch[_0x1ffe('0x28')](_0x569ad1,_0x264e23,!![]);}catch(_0x59a20a){return BPromise['reject'](_0x59a20a);}return _0x569ad1[_0x1ffe('0x29')]();};}function saveUpdates(_0x4f329e,_0x2bf2da){return function(_0x8b553b){if(_0x8b553b){return _0x8b553b[_0x1ffe('0x2a')](_0x4f329e)['then'](function(_0x31f9d2){return _0x31f9d2;});}return null;};}function removeEntity(_0x4ed09e,_0x53cfa0){return function(_0x33ac17){if(_0x33ac17){return _0x33ac17[_0x1ffe('0x2b')]()[_0x1ffe('0x2c')](function(){var _0x24bec0=_0x33ac17[_0x1ffe('0x2d')]({'plain':!![]});var _0x25ed69='CustomReports';return db[_0x1ffe('0x2e')][_0x1ffe('0x2b')]({'where':{'type':_0x25ed69,'resourceId':_0x24bec0['id']}})['then'](function(){return _0x33ac17;});})['then'](function(){_0x4ed09e[_0x1ffe('0x1f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4be600,_0x4a213f){return function(_0x2273a2){if(!_0x2273a2){_0x4be600[_0x1ffe('0x1e')](0x194);}return _0x2273a2;};}function handleError(_0x51a90e,_0x30252a){_0x30252a=_0x30252a||0x1f4;return function(_0x53f419){logger[_0x1ffe('0x2f')](_0x53f419[_0x1ffe('0x30')]);if(_0x53f419[_0x1ffe('0x31')]){delete _0x53f419[_0x1ffe('0x31')];}_0x51a90e[_0x1ffe('0x1f')](_0x30252a)[_0x1ffe('0x32')](_0x53f419);};}exports[_0x1ffe('0x33')]=function(_0x3c124d,_0x4037b7){var _0x3d128b={},_0x2b92c2={},_0x42972c={'count':0x0,'rows':[]};var _0x552bba=_[_0x1ffe('0x34')](db[_0x1ffe('0x35')][_0x1ffe('0x36')],function(_0xbbbfa4){return{'name':_0xbbbfa4[_0x1ffe('0x37')],'type':_0xbbbfa4[_0x1ffe('0x38')][_0x1ffe('0x39')]};});_0x2b92c2[_0x1ffe('0x3a')]=_['map'](_0x552bba,_0x1ffe('0x31'));_0x2b92c2[_0x1ffe('0x3b')]=_['keys'](_0x3c124d[_0x1ffe('0x3b')]);_0x2b92c2[_0x1ffe('0x3c')]=_[_0x1ffe('0x3d')](_0x2b92c2[_0x1ffe('0x3a')],_0x2b92c2[_0x1ffe('0x3b')]);_0x3d128b[_0x1ffe('0x3e')]=_['intersection'](_0x2b92c2[_0x1ffe('0x3a')],qs[_0x1ffe('0x3f')](_0x3c124d[_0x1ffe('0x3b')][_0x1ffe('0x3f')]));_0x3d128b[_0x1ffe('0x3e')]=_0x3d128b[_0x1ffe('0x3e')][_0x1ffe('0x40')]?_0x3d128b['attributes']:_0x2b92c2['model'];if(!_0x3c124d[_0x1ffe('0x3b')][_0x1ffe('0x41')](_0x1ffe('0x42'))){_0x3d128b[_0x1ffe('0x23')]=qs[_0x1ffe('0x23')](_0x3c124d[_0x1ffe('0x3b')][_0x1ffe('0x23')]);_0x3d128b['offset']=qs[_0x1ffe('0x25')](_0x3c124d['query'][_0x1ffe('0x25')]);}_0x3d128b[_0x1ffe('0x43')]=qs[_0x1ffe('0x44')](_0x3c124d[_0x1ffe('0x3b')][_0x1ffe('0x44')]);_0x3d128b[_0x1ffe('0x45')]=qs['filters'](_[_0x1ffe('0x46')](_0x3c124d[_0x1ffe('0x3b')],_0x2b92c2[_0x1ffe('0x3c')]),_0x552bba);if(_0x3c124d[_0x1ffe('0x3b')]['filter']){_0x3d128b[_0x1ffe('0x45')]=_[_0x1ffe('0x47')](_0x3d128b[_0x1ffe('0x45')],{'$or':_[_0x1ffe('0x34')](_0x552bba,function(_0x4bec10){if(_0x4bec10['type']!==_0x1ffe('0x48')){var _0x339c00={};_0x339c00[_0x4bec10[_0x1ffe('0x31')]]={'$like':'%'+_0x3c124d[_0x1ffe('0x3b')]['filter']+'%'};return _0x339c00;}})});}_0x3d128b=_[_0x1ffe('0x47')]({},_0x3d128b,_0x3c124d[_0x1ffe('0x49')]);var _0x23fe4a={'where':_0x3d128b['where']};return db[_0x1ffe('0x35')]['count'](_0x23fe4a)['then'](function(_0x46c6bd){_0x42972c[_0x1ffe('0x24')]=_0x46c6bd;if(_0x3c124d[_0x1ffe('0x3b')]['includeAll']){_0x3d128b['include']=[{'all':!![]}];}return db[_0x1ffe('0x35')][_0x1ffe('0x4a')](_0x3d128b);})[_0x1ffe('0x2c')](function(_0x3fdf04){_0x42972c['rows']=_0x3fdf04;return _0x42972c;})['then'](respondWithFilteredResult(_0x4037b7,_0x3d128b))['catch'](handleError(_0x4037b7,null));};exports[_0x1ffe('0x4b')]=function(_0x45ab63,_0x438997){var _0x175d87={'raw':![],'where':{'id':_0x45ab63[_0x1ffe('0x4c')]['id']}},_0x1802a7={};_0x1802a7[_0x1ffe('0x3a')]=_['keys'](db[_0x1ffe('0x35')][_0x1ffe('0x36')]);_0x1802a7[_0x1ffe('0x3b')]=_['keys'](_0x45ab63[_0x1ffe('0x3b')]);_0x1802a7[_0x1ffe('0x3c')]=_[_0x1ffe('0x3d')](_0x1802a7[_0x1ffe('0x3a')],_0x1802a7[_0x1ffe('0x3b')]);_0x175d87[_0x1ffe('0x3e')]=_[_0x1ffe('0x3d')](_0x1802a7[_0x1ffe('0x3a')],qs[_0x1ffe('0x3f')](_0x45ab63[_0x1ffe('0x3b')][_0x1ffe('0x3f')]));_0x175d87['attributes']=_0x175d87[_0x1ffe('0x3e')][_0x1ffe('0x40')]?_0x175d87[_0x1ffe('0x3e')]:_0x1802a7[_0x1ffe('0x3a')];if(_0x45ab63[_0x1ffe('0x3b')][_0x1ffe('0x4d')]){_0x175d87[_0x1ffe('0x4e')]=[{'all':!![]}];}_0x175d87=_[_0x1ffe('0x47')]({},_0x175d87,_0x45ab63['options']);return db[_0x1ffe('0x35')]['find'](_0x175d87)[_0x1ffe('0x2c')](handleEntityNotFound(_0x438997,null))['then'](respondWithResult(_0x438997,null))[_0x1ffe('0x4f')](handleError(_0x438997,null));};exports[_0x1ffe('0x50')]=function(_0x3eee37,_0x18684f){return db[_0x1ffe('0x35')][_0x1ffe('0x50')](_0x3eee37[_0x1ffe('0x51')],{})[_0x1ffe('0x2c')](function(_0x50b9d9){var _0x4c9317=_0x3eee37[_0x1ffe('0x52')][_0x1ffe('0x2d')]({'plain':!![]});if(!_0x4c9317)throw new Error(_0x1ffe('0x53'));if(_0x4c9317[_0x1ffe('0x54')]===_0x1ffe('0x52')){var _0x2cc1ca=_0x50b9d9[_0x1ffe('0x2d')]({'plain':!![]});var _0x53acb1=_0x1ffe('0x55');return db[_0x1ffe('0x56')][_0x1ffe('0x57')]({'where':{'name':_0x53acb1,'userProfileId':_0x4c9317['userProfileId']},'raw':!![]})[_0x1ffe('0x2c')](function(_0x26f6a9){if(_0x26f6a9&&_0x26f6a9[_0x1ffe('0x58')]===0x0){return db[_0x1ffe('0x2e')]['create']({'name':_0x2cc1ca[_0x1ffe('0x31')],'resourceId':_0x2cc1ca['id'],'type':_0x1ffe('0x59'),'sectionId':_0x26f6a9['id']},{})['then'](function(){return _0x50b9d9;});}else{return _0x50b9d9;}})[_0x1ffe('0x4f')](function(_0x4e568c){logger[_0x1ffe('0x2f')](_0x1ffe('0x5a'),_0x4e568c);throw _0x4e568c;});}return _0x50b9d9;})['then'](respondWithResult(_0x18684f,0xc9))[_0x1ffe('0x4f')](handleError(_0x18684f,null));};exports['update']=function(_0x33e8e9,_0x46514d){if(_0x33e8e9[_0x1ffe('0x51')]['id']){delete _0x33e8e9['body']['id'];}return db[_0x1ffe('0x35')][_0x1ffe('0x57')]({'where':{'id':_0x33e8e9[_0x1ffe('0x4c')]['id']}})[_0x1ffe('0x2c')](handleEntityNotFound(_0x46514d,null))[_0x1ffe('0x2c')](saveUpdates(_0x33e8e9[_0x1ffe('0x51')],null))[_0x1ffe('0x2c')](respondWithResult(_0x46514d,null))[_0x1ffe('0x4f')](handleError(_0x46514d,null));};exports[_0x1ffe('0x2b')]=function(_0x3d03e8,_0x4b5832){return db[_0x1ffe('0x35')][_0x1ffe('0x57')]({'where':{'id':_0x3d03e8[_0x1ffe('0x4c')]['id']}})[_0x1ffe('0x2c')](handleEntityNotFound(_0x4b5832,null))['then'](removeEntity(_0x4b5832,null))[_0x1ffe('0x4f')](handleError(_0x4b5832,null));};exports[_0x1ffe('0x5b')]=function(_0xd94d8e,_0x199186){var _0x1cc86b=0xa;var _0x37ac85=[_0x1ffe('0x5c'),_0x1ffe('0x5d'),_0x1ffe('0x5e'),_0x1ffe('0x5f')];var _0xe592d5={'SUM':_0x1ffe('0x60'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0x1ffe('0x61'),'MAX':_0x1ffe('0x62'),'MIN':_0x1ffe('0x63'),'AVG':_0x1ffe('0x64'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0x1ffe('0x65'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x2493e1={'SEC_TO_TIME':_0x1ffe('0x66'),'DATE':_0x1ffe('0x67'),'HOUR':_0x1ffe('0x68'),'ROUND':_0x1ffe('0x69'),'UNIX_TIMESTAMP':_0x1ffe('0x6a')};var _0x5d2c65=function(_0xfd160d){return!_[_0x1ffe('0x6b')]([_0x1ffe('0x6c'),_0x1ffe('0x6d'),'IS\x20EMPTY',_0x1ffe('0x6e')],_0xfd160d);};var _0x364438=function(_0x5ed7fa){if(!_0x5ed7fa||!_0x5ed7fa[_0x1ffe('0x6f')]['length']){return'';}for(var _0x1eb099='(',_0x2519f9=0x0;_0x2519f9<_0x5ed7fa['rules'][_0x1ffe('0x40')];_0x2519f9+=0x1){_0x2519f9>0x0&&(_0x1eb099+='\x20'+_0x5ed7fa['operator']+'\x20');_0x1eb099+=_0x5ed7fa[_0x1ffe('0x6f')][_0x2519f9]['group']?_0x364438(_0x5ed7fa[_0x1ffe('0x6f')][_0x2519f9][_0x1ffe('0x70')]):_0x5ed7fa[_0x1ffe('0x6f')][_0x2519f9]['field']+'\x20'+_0x5ed7fa[_0x1ffe('0x6f')][_0x2519f9]['condition']+(_0x5d2c65(_0x5ed7fa[_0x1ffe('0x6f')][_0x2519f9]['condition'])?'\x20'+_0x5ed7fa[_0x1ffe('0x6f')][_0x2519f9]['value']:'');}return _0x1eb099+')';};var _0x3fbc67={'where':{'id':_0xd94d8e[_0x1ffe('0x4c')]['id']}},_0x1c1f96,_0x17bb5f,_0x31e5ac,_0x29b371,_0x135074;_0x3fbc67=_[_0x1ffe('0x47')]({},_0x3fbc67,_0xd94d8e[_0x1ffe('0x49')]);return db[_0x1ffe('0x35')]['find'](_0x3fbc67)[_0x1ffe('0x2c')](function(_0x415096){if(_0x415096){_0x1c1f96=_0x415096;return _0x415096[_0x1ffe('0x71')]();}return null;})['then'](function(_0xe76c2b){if(_0xe76c2b){if(!_0xe76c2b[_0x1ffe('0x40')]){throw new db[(_0x1ffe('0x72'))][(_0x1ffe('0x73'))](_0x1ffe('0x74'),0x193);}_0x17bb5f=_0xe76c2b;return db[_0x1ffe('0x75')][_0x1ffe('0x4a')]({'raw':!![]});}return null;})[_0x1ffe('0x2c')](function(_0x197e51){if(_0x197e51){_0x31e5ac=_['keyBy'](_0x197e51,'id');var _0x221ea9;var _0x26b9f7=squel[_0x1ffe('0x76')]();_0x26b9f7[_0x1ffe('0x77')](_0x1c1f96[_0x1ffe('0x78')]);for(var _0x44e4f3=0x0;_0x44e4f3<_0x17bb5f['length'];_0x44e4f3+=0x1){_0x221ea9=_0x17bb5f[_0x44e4f3]['MetricId']?_0x31e5ac[_0x17bb5f[_0x44e4f3][_0x1ffe('0x79')]][_0x1ffe('0x7a')]:_0x17bb5f[_0x44e4f3][_0x1ffe('0x7b')];_0x221ea9=_0x17bb5f[_0x44e4f3][_0x1ffe('0x7c')]?_['replace'](_0xe592d5[_0x17bb5f[_0x44e4f3]['function']],'%s',_0x221ea9):_0x221ea9;_0x221ea9=_0x17bb5f[_0x44e4f3][_0x1ffe('0x7d')]?_[_0x1ffe('0x7e')](_0x2493e1[_0x17bb5f[_0x44e4f3]['format']],'%s',_0x221ea9):_0x221ea9;if(_0x17bb5f[_0x44e4f3][_0x1ffe('0x7f')]){_0x26b9f7[_0x1ffe('0x70')](_0x221ea9);}_0x17bb5f[_0x44e4f3][_0x1ffe('0x80')]&&_0x26b9f7[_0x1ffe('0x43')](_0x221ea9,_0x17bb5f[_0x44e4f3]['orderBy']===_0x1ffe('0x81')?![]:!![]);_0x26b9f7[_0x1ffe('0x7b')](_0x221ea9,_0x17bb5f[_0x44e4f3][_0x1ffe('0x82')]||_0x221ea9);}if(_0x1c1f96[_0x1ffe('0x83')]){_0x1c1f96[_0x1ffe('0x83')]=JSON['parse'](_0x1c1f96[_0x1ffe('0x83')]);for(var _0x168b32=0x0;_0x168b32<_0x1c1f96[_0x1ffe('0x83')][_0x1ffe('0x40')];_0x168b32+=0x1){if(_0x1c1f96[_0x1ffe('0x83')][_0x168b32][_0x1ffe('0x38')]&&_[_0x1ffe('0x6b')](_0x37ac85,_0x1c1f96[_0x1ffe('0x83')][_0x168b32][_0x1ffe('0x38')])&&_0x1c1f96[_0x1ffe('0x83')][_0x168b32][_0x1ffe('0x84')]&&_0x1c1f96['joins'][_0x168b32][_0x1ffe('0x85')]&&_0x1c1f96[_0x1ffe('0x83')][_0x168b32]['foreignKey']){_0x26b9f7[_0x1c1f96[_0x1ffe('0x83')][_0x168b32][_0x1ffe('0x38')]](_0x1c1f96[_0x1ffe('0x83')][_0x168b32][_0x1ffe('0x85')],null,util[_0x1ffe('0x7d')](_0x1ffe('0x86'),_0x1c1f96[_0x1ffe('0x78')],_0x1c1f96['joins'][_0x168b32][_0x1ffe('0x84')],_0x1c1f96[_0x1ffe('0x83')][_0x168b32][_0x1ffe('0x85')],_0x1c1f96[_0x1ffe('0x83')][_0x168b32]['foreignKey']));}}}if(_0x1c1f96[_0x1ffe('0x87')]){_0x1c1f96[_0x1ffe('0x87')]=JSON[_0x1ffe('0x88')](_0x1c1f96[_0x1ffe('0x87')]);_0x26b9f7[_0x1ffe('0x45')](_0x364438(_0x1c1f96[_0x1ffe('0x87')]['group']));}_0x135074=_0x26b9f7['clone']();_0x26b9f7['limit'](_0x1cc86b);_0x26b9f7['offset'](0x0);logger[_0x1ffe('0x89')](_0x1ffe('0x8a'),_0x26b9f7[_0x1ffe('0x8b')]());return dbH[_0x1ffe('0x8c')][_0x1ffe('0x3b')](_0x26b9f7['toString'](),{'type':dbH[_0x1ffe('0x8c')][_0x1ffe('0x8d')][_0x1ffe('0x8e')]});}})['then'](respondWithResult(_0x199186,null))[_0x1ffe('0x4f')](handleError(_0x199186,null));};function runReport(_0x13e085,_0x4554f8,_0x3770bd){var _0x37bed9=_0x4554f8[_0x1ffe('0x31')];var _0x562d04=0xa;var _0x5e38f9=[_0x1ffe('0x5c'),_0x1ffe('0x5d'),_0x1ffe('0x5e'),_0x1ffe('0x5f')];var _0x2298ac={'SUM':_0x1ffe('0x60'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0x1ffe('0x61'),'MAX':_0x1ffe('0x62'),'MIN':_0x1ffe('0x63'),'AVG':_0x1ffe('0x64'),'GROUP_CONCAT':_0x1ffe('0x8f'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x1ffe('0x90')};var _0x5c4f45={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0x1ffe('0x67'),'HOUR':_0x1ffe('0x68'),'ROUND':_0x1ffe('0x69'),'UNIX_TIMESTAMP':_0x1ffe('0x6a')};var _0x4cc230=function(_0x5688d0){return!_[_0x1ffe('0x6b')]([_0x1ffe('0x6c'),_0x1ffe('0x6d'),_0x1ffe('0x91'),_0x1ffe('0x6e')],_0x5688d0);};var _0x1ef888=function(_0xbef0a0){if(!_0xbef0a0||!_0xbef0a0[_0x1ffe('0x6f')][_0x1ffe('0x40')]){return'';}for(var _0x7cf74d='(',_0x186184=0x0;_0x186184<_0xbef0a0['rules'][_0x1ffe('0x40')];_0x186184+=0x1){_0x186184>0x0&&(_0x7cf74d+='\x20'+_0xbef0a0[_0x1ffe('0x92')]+'\x20');_0x7cf74d+=_0xbef0a0[_0x1ffe('0x6f')][_0x186184]['group']?_0x1ef888(_0xbef0a0['rules'][_0x186184][_0x1ffe('0x70')]):_0xbef0a0[_0x1ffe('0x6f')][_0x186184][_0x1ffe('0x7b')]+'\x20'+_0xbef0a0['rules'][_0x186184][_0x1ffe('0x93')]+(_0x4cc230(_0xbef0a0[_0x1ffe('0x6f')][_0x186184][_0x1ffe('0x93')])?'\x20'+_0xbef0a0[_0x1ffe('0x6f')][_0x186184][_0x1ffe('0x94')]:'');}return _0x7cf74d+')';};var _0x3abe0a={'where':{'id':_0x13e085['id']}},_0x36e12c,_0xbc9a44,_0x52b5d0,_0x3cdcc1,_0x4f10f5;_0x3abe0a=_[_0x1ffe('0x47')]({},_0x3abe0a,_0x3770bd);return db['AnalyticCustomReport'][_0x1ffe('0x57')](_0x3abe0a)[_0x1ffe('0x2c')](function(_0x2bdcd1){if(_0x2bdcd1){_0x36e12c=_0x2bdcd1;return _0x2bdcd1['getFields']();}return null;})[_0x1ffe('0x2c')](function(_0x6691e4){if(_0x6691e4){if(!_0x6691e4['length']){throw new db[(_0x1ffe('0x72'))][(_0x1ffe('0x73'))](_0x1ffe('0x74'),0x193);}_0xbc9a44=_0x6691e4;return db[_0x1ffe('0x75')]['findAll']({'raw':!![]});}return null;})['then'](function(_0x3bf606){if(_0x3bf606){_0x52b5d0=_[_0x1ffe('0x95')](_0x3bf606,'id');var _0xcbca35;var _0x1538a0=squel['select']();_0x1538a0[_0x1ffe('0x77')](_0x36e12c[_0x1ffe('0x78')]);for(var _0x1522e6=0x0;_0x1522e6<_0xbc9a44[_0x1ffe('0x40')];_0x1522e6+=0x1){_0xcbca35=_0xbc9a44[_0x1522e6][_0x1ffe('0x79')]?_0x52b5d0[_0xbc9a44[_0x1522e6][_0x1ffe('0x79')]][_0x1ffe('0x7a')]:_0xbc9a44[_0x1522e6][_0x1ffe('0x7b')];_0xcbca35=_0xbc9a44[_0x1522e6][_0x1ffe('0x7c')]?_[_0x1ffe('0x7e')](_0x2298ac[_0xbc9a44[_0x1522e6]['function']],'%s',_0xcbca35):_0xcbca35;_0xcbca35=_0xbc9a44[_0x1522e6][_0x1ffe('0x7d')]?_['replace'](_0x5c4f45[_0xbc9a44[_0x1522e6][_0x1ffe('0x7d')]],'%s',_0xcbca35):_0xcbca35;if(_0xbc9a44[_0x1522e6][_0x1ffe('0x7f')]){_0x1538a0['group'](_0xcbca35);}_0xbc9a44[_0x1522e6][_0x1ffe('0x80')]&&_0x1538a0[_0x1ffe('0x43')](_0xcbca35,_0xbc9a44[_0x1522e6][_0x1ffe('0x80')]===_0x1ffe('0x81')?![]:!![]);_0x1538a0[_0x1ffe('0x7b')](_0xcbca35,_0xbc9a44[_0x1522e6][_0x1ffe('0x82')]||_0xcbca35);}if(_0x36e12c[_0x1ffe('0x83')]){_0x36e12c[_0x1ffe('0x83')]=JSON[_0x1ffe('0x88')](_0x36e12c[_0x1ffe('0x83')]);for(var _0x344aa9=0x0;_0x344aa9<_0x36e12c[_0x1ffe('0x83')]['length'];_0x344aa9+=0x1){if(_0x36e12c[_0x1ffe('0x83')][_0x344aa9]['type']&&_['includes'](_0x5e38f9,_0x36e12c[_0x1ffe('0x83')][_0x344aa9][_0x1ffe('0x38')])&&_0x36e12c[_0x1ffe('0x83')][_0x344aa9]['parentKey']&&_0x36e12c[_0x1ffe('0x83')][_0x344aa9][_0x1ffe('0x85')]&&_0x36e12c[_0x1ffe('0x83')][_0x344aa9][_0x1ffe('0x96')]){_0x1538a0[_0x36e12c[_0x1ffe('0x83')][_0x344aa9][_0x1ffe('0x38')]](_0x36e12c['joins'][_0x344aa9][_0x1ffe('0x85')],null,util[_0x1ffe('0x7d')](_0x1ffe('0x86'),_0x36e12c[_0x1ffe('0x78')],_0x36e12c['joins'][_0x344aa9][_0x1ffe('0x84')],_0x36e12c[_0x1ffe('0x83')][_0x344aa9][_0x1ffe('0x85')],_0x36e12c[_0x1ffe('0x83')][_0x344aa9]['foreignKey']));}}}if(_0x36e12c[_0x1ffe('0x87')]){_0x36e12c['conditions']=JSON[_0x1ffe('0x88')](_0x36e12c[_0x1ffe('0x87')]);_0x1538a0[_0x1ffe('0x45')](_0x1ef888(_0x36e12c[_0x1ffe('0x87')]['group']));}_0x4f10f5=_0x1538a0[_0x1ffe('0x97')]();_0x1538a0[_0x1ffe('0x23')](_0x562d04);_0x1538a0[_0x1ffe('0x25')](0x0);return;}})['then'](function(){if(_0x4554f8[_0x1ffe('0x98')]===_0x1ffe('0x99')){return null;}var _0x1adeca=_[_0x1ffe('0x47')](_0x4554f8,{'name':_0x4554f8['fullPath']||_0x4554f8[_0x1ffe('0x31')]||_0x36e12c['name'],'basename':_0x37bed9,'savename':util[_0x1ffe('0x7d')](_0x1ffe('0x9a'),_0x4554f8[_0x1ffe('0x31')]||_0x36e12c[_0x1ffe('0x31')],require(_0x1ffe('0x9b'))[_0x1ffe('0x9c')](0x4),_0x4554f8['output']||_0x1ffe('0x9d')),'reportId':_0x36e12c['id'],'reportType':_0x1ffe('0x9e')});return db['AnalyticExtractedReport']['create'](_0x1adeca,{'raw':!![]});})[_0x1ffe('0x2c')](function(_0x3c4395){if(_0x36e12c[_0x1ffe('0x78')]===_0x1ffe('0x9f')){_0x4f10f5[_0x1ffe('0x45')](_0x36e12c['table']+_0x1ffe('0xa0'),_0x4554f8[_0x1ffe('0xa1')],_0x4554f8[_0x1ffe('0xa2')]);}else{_0x4f10f5['where'](_0x36e12c[_0x1ffe('0x78')]+_0x1ffe('0xa3'),_0x4554f8[_0x1ffe('0xa1')],_0x4554f8['endDate']);}if(_0x3c4395){logger['info'](_0x1ffe('0xa4'),_0x4f10f5[_0x1ffe('0x8b')]());require('child_process')['fork'](path[_0x1ffe('0x5c')](__dirname,_0x1ffe('0xa5'),_0x3c4395['output']),[_0x3c4395['id'],_0x4f10f5[_0x1ffe('0x8b')](),path[_0x1ffe('0x5c')](__dirname,_0x1ffe('0xa6'),_0x3c4395[_0x1ffe('0xa7')]),_0x37bed9]);return _0x3c4395;}else{var _0x3feed6=squel[_0x1ffe('0x76')]();_0x3feed6[_0x1ffe('0x77')]('('+_0x4f10f5[_0x1ffe('0x8b')]()+')','countTable');_0x3feed6[_0x1ffe('0x7b')](_0x1ffe('0xa8'),_0x1ffe('0x24'));_0x4f10f5[_0x1ffe('0x23')](_0x4554f8[_0x1ffe('0x23')]||_0x562d04);_0x4f10f5[_0x1ffe('0x25')](_0x4554f8[_0x1ffe('0x25')]||0x0);return dbH[_0x1ffe('0x8c')][_0x1ffe('0x3b')](_0x3feed6[_0x1ffe('0x8b')](),{'type':dbH['sequelize'][_0x1ffe('0x8d')][_0x1ffe('0x8e')]})[_0x1ffe('0x2c')](function(_0x3d593c){if(!_0x3d593c[_0x1ffe('0x40')]){_0x3cdcc1=0x0;}else{_0x3cdcc1=_0x3d593c[0x0][_0x1ffe('0x24')]||0x0;}return dbH['sequelize']['query'](_0x4f10f5[_0x1ffe('0x8b')](),{'type':dbH['sequelize'][_0x1ffe('0x8d')][_0x1ffe('0x8e')]});})[_0x1ffe('0x2c')](function(_0x44a798){return{'rows':_0x44a798||[],'count':_0x3cdcc1};});}});}exports[_0x1ffe('0xa9')]=function(_0x595058,_0x25b36d){return runReport(_0x595058['params'],_0x595058[_0x1ffe('0x3b')],_0x595058[_0x1ffe('0x49')])[_0x1ffe('0x2c')](respondWithResult(_0x25b36d,null))['catch'](handleError(_0x25b36d,null));};exports[_0x1ffe('0xaa')]=runReport;exports[_0x1ffe('0x3b')]=function(_0x416f40,_0x1d1c11){var _0x2a2607=0xa;var _0x2b7ad7=[_0x1ffe('0x5c'),_0x1ffe('0x5d'),'right_join',_0x1ffe('0x5f')];var _0x237181={'SUM':_0x1ffe('0x60'),'COUNT':_0x1ffe('0xab'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0x1ffe('0x62'),'MIN':'MIN(%s)','AVG':_0x1ffe('0x64'),'GROUP_CONCAT':_0x1ffe('0x8f'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x1ffe('0x90')};var _0x5c1b02={'SEC_TO_TIME':_0x1ffe('0x66'),'DATE':_0x1ffe('0x67'),'HOUR':_0x1ffe('0x68'),'ROUND':_0x1ffe('0x69'),'UNIX_TIMESTAMP':_0x1ffe('0x6a')};var _0x36a561=function(_0x3ece75){return!_[_0x1ffe('0x6b')]([_0x1ffe('0x6c'),_0x1ffe('0x6d'),_0x1ffe('0x91'),_0x1ffe('0x6e')],_0x3ece75);};var _0x455cea=function(_0x40fe59){if(!_0x40fe59||!_0x40fe59[_0x1ffe('0x6f')]['length']){return'';}for(var _0x37719e='(',_0x2b813=0x0;_0x2b813<_0x40fe59['rules'][_0x1ffe('0x40')];_0x2b813+=0x1){_0x2b813>0x0&&(_0x37719e+='\x20'+_0x40fe59[_0x1ffe('0x92')]+'\x20');_0x37719e+=_0x40fe59[_0x1ffe('0x6f')][_0x2b813][_0x1ffe('0x70')]?_0x455cea(_0x40fe59['rules'][_0x2b813][_0x1ffe('0x70')]):_0x40fe59[_0x1ffe('0x6f')][_0x2b813][_0x1ffe('0x7b')]+'\x20'+_0x40fe59[_0x1ffe('0x6f')][_0x2b813][_0x1ffe('0x93')]+(_0x36a561(_0x40fe59[_0x1ffe('0x6f')][_0x2b813]['condition'])?'\x20'+_0x40fe59[_0x1ffe('0x6f')][_0x2b813][_0x1ffe('0x94')]:'');}return _0x37719e+')';};var _0x1401bd={'where':{'id':_0x416f40[_0x1ffe('0x4c')]['id']}},_0x4dda24,_0x44e4e7,_0x50ef12,_0xbf840e,_0x15b662;_0x1401bd=_[_0x1ffe('0x47')]({},_0x1401bd,_0x416f40[_0x1ffe('0x49')]);return db[_0x1ffe('0x35')][_0x1ffe('0x57')](_0x1401bd)['then'](function(_0x25a9ca){if(_0x25a9ca){_0x4dda24=_0x25a9ca;return _0x25a9ca[_0x1ffe('0x71')]();}return null;})[_0x1ffe('0x2c')](function(_0x54c035){if(_0x54c035){if(!_0x54c035[_0x1ffe('0x40')]){throw new db[(_0x1ffe('0x72'))][(_0x1ffe('0x73'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x44e4e7=_0x54c035;return db[_0x1ffe('0x75')][_0x1ffe('0x4a')]({'raw':!![]});}return null;})['then'](function(_0x1b02e9){if(_0x1b02e9){_0x50ef12=_[_0x1ffe('0x95')](_0x1b02e9,'id');var _0x54fe72;var _0x459237=squel[_0x1ffe('0x76')]();_0x459237['from'](_0x4dda24[_0x1ffe('0x78')]);for(var _0x1d6ffb=0x0;_0x1d6ffb<_0x44e4e7['length'];_0x1d6ffb+=0x1){_0x54fe72=_0x44e4e7[_0x1d6ffb][_0x1ffe('0x79')]?_0x50ef12[_0x44e4e7[_0x1d6ffb][_0x1ffe('0x79')]][_0x1ffe('0x7a')]:_0x44e4e7[_0x1d6ffb][_0x1ffe('0x7b')];_0x54fe72=_0x44e4e7[_0x1d6ffb][_0x1ffe('0x7c')]?_[_0x1ffe('0x7e')](_0x237181[_0x44e4e7[_0x1d6ffb]['function']],'%s',_0x54fe72):_0x54fe72;_0x54fe72=_0x44e4e7[_0x1d6ffb][_0x1ffe('0x7d')]?_['replace'](_0x5c1b02[_0x44e4e7[_0x1d6ffb][_0x1ffe('0x7d')]],'%s',_0x54fe72):_0x54fe72;if(_0x44e4e7[_0x1d6ffb][_0x1ffe('0x7f')]){_0x459237['group'](_0x54fe72);}_0x44e4e7[_0x1d6ffb][_0x1ffe('0x80')]&&_0x459237['order'](_0x54fe72,_0x44e4e7[_0x1d6ffb][_0x1ffe('0x80')]===_0x1ffe('0x81')?![]:!![]);_0x459237[_0x1ffe('0x7b')](_0x54fe72,_0x44e4e7[_0x1d6ffb][_0x1ffe('0x82')]||_0x54fe72);}if(_0x4dda24[_0x1ffe('0x83')]){_0x4dda24[_0x1ffe('0x83')]=JSON[_0x1ffe('0x88')](_0x4dda24[_0x1ffe('0x83')]);for(var _0x1fd3a8=0x0;_0x1fd3a8<_0x4dda24[_0x1ffe('0x83')][_0x1ffe('0x40')];_0x1fd3a8+=0x1){if(_0x4dda24[_0x1ffe('0x83')][_0x1fd3a8][_0x1ffe('0x38')]&&_[_0x1ffe('0x6b')](_0x2b7ad7,_0x4dda24[_0x1ffe('0x83')][_0x1fd3a8][_0x1ffe('0x38')])&&_0x4dda24[_0x1ffe('0x83')][_0x1fd3a8][_0x1ffe('0x84')]&&_0x4dda24[_0x1ffe('0x83')][_0x1fd3a8]['foreignTable']&&_0x4dda24[_0x1ffe('0x83')][_0x1fd3a8][_0x1ffe('0x96')]){_0x459237[_0x4dda24['joins'][_0x1fd3a8][_0x1ffe('0x38')]](_0x4dda24['joins'][_0x1fd3a8][_0x1ffe('0x85')],null,util[_0x1ffe('0x7d')](_0x1ffe('0x86'),_0x4dda24[_0x1ffe('0x78')],_0x4dda24[_0x1ffe('0x83')][_0x1fd3a8][_0x1ffe('0x84')],_0x4dda24[_0x1ffe('0x83')][_0x1fd3a8]['foreignTable'],_0x4dda24['joins'][_0x1fd3a8][_0x1ffe('0x96')]));}}}if(_0x4dda24[_0x1ffe('0x87')]){_0x4dda24['conditions']=JSON[_0x1ffe('0x88')](_0x4dda24['conditions']);_0x459237[_0x1ffe('0x45')](_0x455cea(_0x4dda24[_0x1ffe('0x87')][_0x1ffe('0x70')]));}_0x15b662=_0x459237[_0x1ffe('0x97')]();_0x459237[_0x1ffe('0x23')](_0x2a2607);_0x459237[_0x1ffe('0x25')](0x0);logger[_0x1ffe('0x89')](_0x1ffe('0x8a'),_0x459237[_0x1ffe('0x8b')]());return dbH[_0x1ffe('0x8c')][_0x1ffe('0x3b')](_0x459237[_0x1ffe('0x8b')](),{'type':dbH[_0x1ffe('0x8c')][_0x1ffe('0x8d')][_0x1ffe('0x8e')]});}})[_0x1ffe('0x2c')](function(){return{'sql':_0x15b662[_0x1ffe('0x8b')]()};})[_0x1ffe('0x2c')](respondWithResult(_0x1d1c11,null))[_0x1ffe('0x4f')](handleError(_0x1d1c11,null));}; \ No newline at end of file +var _0xdd73=['startDate','Run\x20Query:','child_process','../../files/reports','savename','countTable','COUNT(*)','run','cross_join','Sequelize','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','path','ejs','fs-extra','jsforce','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','dbH','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','get','CustomReports','UserProfileResource','destroy','error','stack','name','send','index','map','AnalyticCustomReport','rawAttributes','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','type','VIRTUAL','includeAll','findAll','rows','catch','show','params','include','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Reports','UserProfileSection','autoAssociation','preview','left_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)','SEC_TO_TIME(%s)','HOUR(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','rules','operator','group','field','condition','value','getFields','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','select','from','table','MetricId','metric','function','replace','groupBy','orderBy','DESC','alias','joins','parentKey','foreignTable','conditions','parse','clone','debug','Limited\x20Query:','toString','sequelize','QueryTypes','SELECT','join','MIN(%s)','ROUND(%s)','IS\x20EMPTY','IS\x20NOT\x20EMPTY','foreignKey','format','%s.%s\x20=\x20%s.%s','output','web','fullPath','%s-%s.%s','randomstring','generate','csv','custom','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','endDate'];(function(_0x3dba26,_0x32927e){var _0x1ad78c=function(_0x1fe9e5){while(--_0x1fe9e5){_0x3dba26['push'](_0x3dba26['shift']());}};_0x1ad78c(++_0x32927e);}(_0xdd73,0x156));var _0x3dd7=function(_0x9571f9,_0x5a7460){_0x9571f9=_0x9571f9-0x0;var _0x5cd19b=_0xdd73[_0x9571f9];return _0x5cd19b;};'use strict';var emlformat=require(_0x3dd7('0x0'));var rimraf=require(_0x3dd7('0x1'));var zipdir=require(_0x3dd7('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x3dd7('0x3'));var BPromise=require(_0x3dd7('0x4'));var Mustache=require(_0x3dd7('0x5'));var util=require(_0x3dd7('0x6'));var path=require(_0x3dd7('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x3dd7('0x8'));var fs=require('fs');var fs_extra=require(_0x3dd7('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x3dd7('0xa'));var deskjs=require('desk.js');var toCsv=require(_0x3dd7('0xb'));var querystring=require(_0x3dd7('0xc'));var Papa=require(_0x3dd7('0xd'));var Redis=require('ioredis');var authService=require(_0x3dd7('0xe'));var qs=require(_0x3dd7('0xf'));var as=require(_0x3dd7('0x10'));var hardwareService=require(_0x3dd7('0x11'));var logger=require(_0x3dd7('0x12'))(_0x3dd7('0x13'));var utils=require(_0x3dd7('0x14'));var config=require(_0x3dd7('0x15'));var licenseUtil=require(_0x3dd7('0x16'));var db=require(_0x3dd7('0x17'))['db'];var dbH=require('../../mysqldb')[_0x3dd7('0x18')];function respondWithStatusCode(_0x21acfc,_0x1c2586){_0x1c2586=_0x1c2586||0xcc;return function(_0x4dff40){if(_0x4dff40){return _0x21acfc[_0x3dd7('0x19')](_0x1c2586);}return _0x21acfc[_0x3dd7('0x1a')](_0x1c2586)[_0x3dd7('0x1b')]();};}function respondWithResult(_0x5dbc24,_0x1397aa){_0x1397aa=_0x1397aa||0xc8;return function(_0x4421fa){if(_0x4421fa){return _0x5dbc24['status'](_0x1397aa)['json'](_0x4421fa);}};}function respondWithFilteredResult(_0x586a3,_0x5cb42c){return function(_0x34f265){if(_0x34f265){var _0x345e24=typeof _0x5cb42c[_0x3dd7('0x1c')]===_0x3dd7('0x1d')&&typeof _0x5cb42c[_0x3dd7('0x1e')]==='undefined';var _0xaa09cd=_0x34f265[_0x3dd7('0x1f')];var _0x275bd1=_0x345e24?0x0:_0x5cb42c[_0x3dd7('0x1c')];var _0x258236=_0x345e24?_0x34f265[_0x3dd7('0x1f')]:_0x5cb42c[_0x3dd7('0x1c')]+_0x5cb42c[_0x3dd7('0x1e')];var _0x3d7a64;if(_0x258236>=_0xaa09cd){_0x258236=_0xaa09cd;_0x3d7a64=0xc8;}else{_0x3d7a64=0xce;}_0x586a3['status'](_0x3d7a64);return _0x586a3[_0x3dd7('0x20')](_0x3dd7('0x21'),_0x275bd1+'-'+_0x258236+'/'+_0xaa09cd)['json'](_0x34f265);}return null;};}function patchUpdates(_0xa23a78){return function(_0x5cbd1d){try{jsonpatch[_0x3dd7('0x22')](_0x5cbd1d,_0xa23a78,!![]);}catch(_0x4247dd){return BPromise['reject'](_0x4247dd);}return _0x5cbd1d[_0x3dd7('0x23')]();};}function saveUpdates(_0x44682b,_0x4d0e1a){return function(_0x48b6a9){if(_0x48b6a9){return _0x48b6a9[_0x3dd7('0x24')](_0x44682b)[_0x3dd7('0x25')](function(_0x5bc765){return _0x5bc765;});}return null;};}function removeEntity(_0x1f72f9,_0x20530a){return function(_0x1b822b){if(_0x1b822b){return _0x1b822b['destroy']()['then'](function(){var _0x4b675d=_0x1b822b[_0x3dd7('0x26')]({'plain':!![]});var _0x5eab9b=_0x3dd7('0x27');return db[_0x3dd7('0x28')][_0x3dd7('0x29')]({'where':{'type':_0x5eab9b,'resourceId':_0x4b675d['id']}})[_0x3dd7('0x25')](function(){return _0x1b822b;});})[_0x3dd7('0x25')](function(){_0x1f72f9[_0x3dd7('0x1a')](0xcc)[_0x3dd7('0x1b')]();});}};}function handleEntityNotFound(_0x302adb,_0x2342d1){return function(_0x402b38){if(!_0x402b38){_0x302adb[_0x3dd7('0x19')](0x194);}return _0x402b38;};}function handleError(_0x553848,_0x599ef5){_0x599ef5=_0x599ef5||0x1f4;return function(_0x356a11){logger[_0x3dd7('0x2a')](_0x356a11[_0x3dd7('0x2b')]);if(_0x356a11[_0x3dd7('0x2c')]){delete _0x356a11[_0x3dd7('0x2c')];}_0x553848[_0x3dd7('0x1a')](_0x599ef5)[_0x3dd7('0x2d')](_0x356a11);};}exports[_0x3dd7('0x2e')]=function(_0x236b89,_0x659681){var _0xb41b98={},_0x5ef5a4={},_0x1aaacc={'count':0x0,'rows':[]};var _0x4745b2=_[_0x3dd7('0x2f')](db[_0x3dd7('0x30')][_0x3dd7('0x31')],function(_0x40717e){return{'name':_0x40717e['fieldName'],'type':_0x40717e['type'][_0x3dd7('0x32')]};});_0x5ef5a4[_0x3dd7('0x33')]=_[_0x3dd7('0x2f')](_0x4745b2,_0x3dd7('0x2c'));_0x5ef5a4[_0x3dd7('0x34')]=_[_0x3dd7('0x35')](_0x236b89[_0x3dd7('0x34')]);_0x5ef5a4['filters']=_[_0x3dd7('0x36')](_0x5ef5a4[_0x3dd7('0x33')],_0x5ef5a4[_0x3dd7('0x34')]);_0xb41b98[_0x3dd7('0x37')]=_[_0x3dd7('0x36')](_0x5ef5a4[_0x3dd7('0x33')],qs['fields'](_0x236b89['query'][_0x3dd7('0x38')]));_0xb41b98[_0x3dd7('0x37')]=_0xb41b98[_0x3dd7('0x37')][_0x3dd7('0x39')]?_0xb41b98[_0x3dd7('0x37')]:_0x5ef5a4[_0x3dd7('0x33')];if(!_0x236b89[_0x3dd7('0x34')][_0x3dd7('0x3a')](_0x3dd7('0x3b'))){_0xb41b98['limit']=qs[_0x3dd7('0x1e')](_0x236b89[_0x3dd7('0x34')][_0x3dd7('0x1e')]);_0xb41b98[_0x3dd7('0x1c')]=qs[_0x3dd7('0x1c')](_0x236b89[_0x3dd7('0x34')][_0x3dd7('0x1c')]);}_0xb41b98[_0x3dd7('0x3c')]=qs[_0x3dd7('0x3d')](_0x236b89[_0x3dd7('0x34')]['sort']);_0xb41b98[_0x3dd7('0x3e')]=qs[_0x3dd7('0x3f')](_[_0x3dd7('0x40')](_0x236b89[_0x3dd7('0x34')],_0x5ef5a4[_0x3dd7('0x3f')]),_0x4745b2);if(_0x236b89[_0x3dd7('0x34')][_0x3dd7('0x41')]){_0xb41b98['where']=_[_0x3dd7('0x42')](_0xb41b98[_0x3dd7('0x3e')],{'$or':_[_0x3dd7('0x2f')](_0x4745b2,function(_0x210076){if(_0x210076[_0x3dd7('0x43')]!==_0x3dd7('0x44')){var _0xa9eae1={};_0xa9eae1[_0x210076[_0x3dd7('0x2c')]]={'$like':'%'+_0x236b89[_0x3dd7('0x34')][_0x3dd7('0x41')]+'%'};return _0xa9eae1;}})});}_0xb41b98=_[_0x3dd7('0x42')]({},_0xb41b98,_0x236b89['options']);var _0x59f0fe={'where':_0xb41b98[_0x3dd7('0x3e')]};return db[_0x3dd7('0x30')][_0x3dd7('0x1f')](_0x59f0fe)['then'](function(_0x3b7c6c){_0x1aaacc[_0x3dd7('0x1f')]=_0x3b7c6c;if(_0x236b89['query'][_0x3dd7('0x45')]){_0xb41b98['include']=[{'all':!![]}];}return db['AnalyticCustomReport'][_0x3dd7('0x46')](_0xb41b98);})['then'](function(_0x1922b8){_0x1aaacc[_0x3dd7('0x47')]=_0x1922b8;return _0x1aaacc;})[_0x3dd7('0x25')](respondWithFilteredResult(_0x659681,_0xb41b98))[_0x3dd7('0x48')](handleError(_0x659681,null));};exports[_0x3dd7('0x49')]=function(_0x512385,_0x212017){var _0x174cca={'raw':![],'where':{'id':_0x512385[_0x3dd7('0x4a')]['id']}},_0x11db02={};_0x11db02['model']=_[_0x3dd7('0x35')](db[_0x3dd7('0x30')][_0x3dd7('0x31')]);_0x11db02[_0x3dd7('0x34')]=_['keys'](_0x512385[_0x3dd7('0x34')]);_0x11db02[_0x3dd7('0x3f')]=_[_0x3dd7('0x36')](_0x11db02[_0x3dd7('0x33')],_0x11db02[_0x3dd7('0x34')]);_0x174cca['attributes']=_[_0x3dd7('0x36')](_0x11db02[_0x3dd7('0x33')],qs[_0x3dd7('0x38')](_0x512385[_0x3dd7('0x34')][_0x3dd7('0x38')]));_0x174cca['attributes']=_0x174cca[_0x3dd7('0x37')]['length']?_0x174cca['attributes']:_0x11db02[_0x3dd7('0x33')];if(_0x512385[_0x3dd7('0x34')][_0x3dd7('0x45')]){_0x174cca[_0x3dd7('0x4b')]=[{'all':!![]}];}_0x174cca=_[_0x3dd7('0x42')]({},_0x174cca,_0x512385[_0x3dd7('0x4c')]);return db['AnalyticCustomReport'][_0x3dd7('0x4d')](_0x174cca)[_0x3dd7('0x25')](handleEntityNotFound(_0x212017,null))[_0x3dd7('0x25')](respondWithResult(_0x212017,null))[_0x3dd7('0x48')](handleError(_0x212017,null));};exports['create']=function(_0x202768,_0x2cfa9e){return db[_0x3dd7('0x30')][_0x3dd7('0x4e')](_0x202768[_0x3dd7('0x4f')],{})[_0x3dd7('0x25')](function(_0x2b0e06){var _0x3eb418=_0x202768[_0x3dd7('0x50')][_0x3dd7('0x26')]({'plain':!![]});if(!_0x3eb418)throw new Error(_0x3dd7('0x51'));if(_0x3eb418[_0x3dd7('0x52')]===_0x3dd7('0x50')){var _0x3bace7=_0x2b0e06[_0x3dd7('0x26')]({'plain':!![]});var _0x12302e=_0x3dd7('0x53');return db[_0x3dd7('0x54')][_0x3dd7('0x4d')]({'where':{'name':_0x12302e,'userProfileId':_0x3eb418['userProfileId']},'raw':!![]})['then'](function(_0x25abf7){if(_0x25abf7&&_0x25abf7[_0x3dd7('0x55')]===0x0){return db['UserProfileResource'][_0x3dd7('0x4e')]({'name':_0x3bace7[_0x3dd7('0x2c')],'resourceId':_0x3bace7['id'],'type':_0x3dd7('0x27'),'sectionId':_0x25abf7['id']},{})['then'](function(){return _0x2b0e06;});}else{return _0x2b0e06;}})[_0x3dd7('0x48')](function(_0xc51c6f){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xc51c6f);throw _0xc51c6f;});}return _0x2b0e06;})[_0x3dd7('0x25')](respondWithResult(_0x2cfa9e,0xc9))[_0x3dd7('0x48')](handleError(_0x2cfa9e,null));};exports[_0x3dd7('0x24')]=function(_0x163be2,_0x37e0fe){if(_0x163be2['body']['id']){delete _0x163be2[_0x3dd7('0x4f')]['id'];}return db['AnalyticCustomReport']['find']({'where':{'id':_0x163be2[_0x3dd7('0x4a')]['id']}})[_0x3dd7('0x25')](handleEntityNotFound(_0x37e0fe,null))['then'](saveUpdates(_0x163be2[_0x3dd7('0x4f')],null))[_0x3dd7('0x25')](respondWithResult(_0x37e0fe,null))[_0x3dd7('0x48')](handleError(_0x37e0fe,null));};exports['destroy']=function(_0x1ac726,_0xfc940){return db[_0x3dd7('0x30')]['find']({'where':{'id':_0x1ac726[_0x3dd7('0x4a')]['id']}})[_0x3dd7('0x25')](handleEntityNotFound(_0xfc940,null))[_0x3dd7('0x25')](removeEntity(_0xfc940,null))[_0x3dd7('0x48')](handleError(_0xfc940,null));};exports[_0x3dd7('0x56')]=function(_0x255448,_0x3cd7bc){var _0x52fa58=0xa;var _0x28f017=['join',_0x3dd7('0x57'),'right_join','cross_join'];var _0x302e94={'SUM':_0x3dd7('0x58'),'COUNT':_0x3dd7('0x59'),'COUNT DISTINCT':_0x3dd7('0x5a'),'MAX':_0x3dd7('0x5b'),'MIN':'MIN(%s)','AVG':_0x3dd7('0x5c'),'GROUP_CONCAT':_0x3dd7('0x5d'),'GROUP_CONCAT ASC':_0x3dd7('0x5e'),'GROUP_CONCAT DESC':_0x3dd7('0x5f')};var _0x3cc273={'SEC_TO_TIME':_0x3dd7('0x60'),'DATE':'DATE(%s)','HOUR':_0x3dd7('0x61'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0x3dd7('0x62')};var _0x30d44d=function(_0x10e80c){return!_[_0x3dd7('0x63')]([_0x3dd7('0x64'),_0x3dd7('0x65'),'IS\x20EMPTY','IS\x20NOT\x20EMPTY'],_0x10e80c);};var _0x6c940d=function(_0x4255d5){if(!_0x4255d5||!_0x4255d5['rules'][_0x3dd7('0x39')]){return'';}for(var _0x1d4f6b='(',_0x72ffff=0x0;_0x72ffff<_0x4255d5[_0x3dd7('0x66')][_0x3dd7('0x39')];_0x72ffff+=0x1){_0x72ffff>0x0&&(_0x1d4f6b+='\x20'+_0x4255d5[_0x3dd7('0x67')]+'\x20');_0x1d4f6b+=_0x4255d5[_0x3dd7('0x66')][_0x72ffff][_0x3dd7('0x68')]?_0x6c940d(_0x4255d5[_0x3dd7('0x66')][_0x72ffff]['group']):_0x4255d5[_0x3dd7('0x66')][_0x72ffff][_0x3dd7('0x69')]+'\x20'+_0x4255d5[_0x3dd7('0x66')][_0x72ffff]['condition']+(_0x30d44d(_0x4255d5[_0x3dd7('0x66')][_0x72ffff][_0x3dd7('0x6a')])?'\x20'+_0x4255d5[_0x3dd7('0x66')][_0x72ffff][_0x3dd7('0x6b')]:'');}return _0x1d4f6b+')';};var _0x1fc654={'where':{'id':_0x255448['params']['id']}},_0x35cd83,_0x56e578,_0xe8ba3d,_0x39afd7,_0x3e635d;_0x1fc654=_['merge']({},_0x1fc654,_0x255448[_0x3dd7('0x4c')]);return db[_0x3dd7('0x30')][_0x3dd7('0x4d')](_0x1fc654)[_0x3dd7('0x25')](function(_0x1cd570){if(_0x1cd570){_0x35cd83=_0x1cd570;return _0x1cd570[_0x3dd7('0x6c')]();}return null;})[_0x3dd7('0x25')](function(_0x319886){if(_0x319886){if(!_0x319886[_0x3dd7('0x39')]){throw new db['Sequelize'][(_0x3dd7('0x6d'))](_0x3dd7('0x6e'),0x193);}_0x56e578=_0x319886;return db[_0x3dd7('0x6f')][_0x3dd7('0x46')]({'raw':!![]});}return null;})[_0x3dd7('0x25')](function(_0x3d3c0a){if(_0x3d3c0a){_0xe8ba3d=_[_0x3dd7('0x70')](_0x3d3c0a,'id');var _0xbec089;var _0x2fad32=squel[_0x3dd7('0x71')]();_0x2fad32[_0x3dd7('0x72')](_0x35cd83[_0x3dd7('0x73')]);for(var _0x45b605=0x0;_0x45b605<_0x56e578[_0x3dd7('0x39')];_0x45b605+=0x1){_0xbec089=_0x56e578[_0x45b605][_0x3dd7('0x74')]?_0xe8ba3d[_0x56e578[_0x45b605]['MetricId']][_0x3dd7('0x75')]:_0x56e578[_0x45b605]['field'];_0xbec089=_0x56e578[_0x45b605][_0x3dd7('0x76')]?_[_0x3dd7('0x77')](_0x302e94[_0x56e578[_0x45b605]['function']],'%s',_0xbec089):_0xbec089;_0xbec089=_0x56e578[_0x45b605]['format']?_[_0x3dd7('0x77')](_0x3cc273[_0x56e578[_0x45b605]['format']],'%s',_0xbec089):_0xbec089;if(_0x56e578[_0x45b605][_0x3dd7('0x78')]){_0x2fad32[_0x3dd7('0x68')](_0xbec089);}_0x56e578[_0x45b605][_0x3dd7('0x79')]&&_0x2fad32[_0x3dd7('0x3c')](_0xbec089,_0x56e578[_0x45b605][_0x3dd7('0x79')]===_0x3dd7('0x7a')?![]:!![]);_0x2fad32[_0x3dd7('0x69')](_0xbec089,_0x56e578[_0x45b605][_0x3dd7('0x7b')]||_0xbec089);}if(_0x35cd83[_0x3dd7('0x7c')]){_0x35cd83[_0x3dd7('0x7c')]=JSON['parse'](_0x35cd83[_0x3dd7('0x7c')]);for(var _0x4b214d=0x0;_0x4b214d<_0x35cd83[_0x3dd7('0x7c')]['length'];_0x4b214d+=0x1){if(_0x35cd83[_0x3dd7('0x7c')][_0x4b214d][_0x3dd7('0x43')]&&_[_0x3dd7('0x63')](_0x28f017,_0x35cd83['joins'][_0x4b214d][_0x3dd7('0x43')])&&_0x35cd83[_0x3dd7('0x7c')][_0x4b214d]['parentKey']&&_0x35cd83['joins'][_0x4b214d]['foreignTable']&&_0x35cd83[_0x3dd7('0x7c')][_0x4b214d]['foreignKey']){_0x2fad32[_0x35cd83[_0x3dd7('0x7c')][_0x4b214d][_0x3dd7('0x43')]](_0x35cd83[_0x3dd7('0x7c')][_0x4b214d]['foreignTable'],null,util['format']('%s.%s\x20=\x20%s.%s',_0x35cd83[_0x3dd7('0x73')],_0x35cd83['joins'][_0x4b214d][_0x3dd7('0x7d')],_0x35cd83[_0x3dd7('0x7c')][_0x4b214d][_0x3dd7('0x7e')],_0x35cd83[_0x3dd7('0x7c')][_0x4b214d]['foreignKey']));}}}if(_0x35cd83[_0x3dd7('0x7f')]){_0x35cd83['conditions']=JSON[_0x3dd7('0x80')](_0x35cd83[_0x3dd7('0x7f')]);_0x2fad32['where'](_0x6c940d(_0x35cd83['conditions'][_0x3dd7('0x68')]));}_0x3e635d=_0x2fad32[_0x3dd7('0x81')]();_0x2fad32[_0x3dd7('0x1e')](_0x52fa58);_0x2fad32[_0x3dd7('0x1c')](0x0);logger[_0x3dd7('0x82')](_0x3dd7('0x83'),_0x2fad32[_0x3dd7('0x84')]());return dbH[_0x3dd7('0x85')][_0x3dd7('0x34')](_0x2fad32[_0x3dd7('0x84')](),{'type':dbH[_0x3dd7('0x85')][_0x3dd7('0x86')][_0x3dd7('0x87')]});}})['then'](respondWithResult(_0x3cd7bc,null))['catch'](handleError(_0x3cd7bc,null));};function runReport(_0x5867b2,_0x512a73,_0x7aab8c){var _0x3da8ef=_0x512a73[_0x3dd7('0x2c')];var _0x4b2210=0xa;var _0x3e37c2=[_0x3dd7('0x88'),'left_join','right_join','cross_join'];var _0x3a867a={'SUM':'SUM(%s)','COUNT':_0x3dd7('0x59'),'COUNT DISTINCT':_0x3dd7('0x5a'),'MAX':_0x3dd7('0x5b'),'MIN':_0x3dd7('0x89'),'AVG':_0x3dd7('0x5c'),'GROUP_CONCAT':_0x3dd7('0x5d'),'GROUP_CONCAT ASC':_0x3dd7('0x5e'),'GROUP_CONCAT DESC':_0x3dd7('0x5f')};var _0x2d3c9e={'SEC_TO_TIME':_0x3dd7('0x60'),'DATE':'DATE(%s)','HOUR':_0x3dd7('0x61'),'ROUND':_0x3dd7('0x8a'),'UNIX_TIMESTAMP':_0x3dd7('0x62')};var _0x212cc9=function(_0xadf7c7){return!_[_0x3dd7('0x63')](['IS\x20NULL',_0x3dd7('0x65'),_0x3dd7('0x8b'),_0x3dd7('0x8c')],_0xadf7c7);};var _0x22ae12=function(_0x5521d0){if(!_0x5521d0||!_0x5521d0[_0x3dd7('0x66')]['length']){return'';}for(var _0x5028ec='(',_0x432293=0x0;_0x432293<_0x5521d0[_0x3dd7('0x66')]['length'];_0x432293+=0x1){_0x432293>0x0&&(_0x5028ec+='\x20'+_0x5521d0[_0x3dd7('0x67')]+'\x20');_0x5028ec+=_0x5521d0['rules'][_0x432293][_0x3dd7('0x68')]?_0x22ae12(_0x5521d0['rules'][_0x432293][_0x3dd7('0x68')]):_0x5521d0[_0x3dd7('0x66')][_0x432293]['field']+'\x20'+_0x5521d0['rules'][_0x432293][_0x3dd7('0x6a')]+(_0x212cc9(_0x5521d0[_0x3dd7('0x66')][_0x432293][_0x3dd7('0x6a')])?'\x20'+_0x5521d0[_0x3dd7('0x66')][_0x432293][_0x3dd7('0x6b')]:'');}return _0x5028ec+')';};var _0x31a9b7={'where':{'id':_0x5867b2['id']}},_0x95f6f0,_0x392990,_0x48dfa1,_0x5dbabd,_0x1deea7;_0x31a9b7=_[_0x3dd7('0x42')]({},_0x31a9b7,_0x7aab8c);return db['AnalyticCustomReport'][_0x3dd7('0x4d')](_0x31a9b7)['then'](function(_0x45def3){if(_0x45def3){_0x95f6f0=_0x45def3;return _0x45def3[_0x3dd7('0x6c')]();}return null;})['then'](function(_0x29646f){if(_0x29646f){if(!_0x29646f[_0x3dd7('0x39')]){throw new db['Sequelize']['ValidationErrorItem']('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x392990=_0x29646f;return db[_0x3dd7('0x6f')][_0x3dd7('0x46')]({'raw':!![]});}return null;})[_0x3dd7('0x25')](function(_0x3f04ca){if(_0x3f04ca){_0x48dfa1=_[_0x3dd7('0x70')](_0x3f04ca,'id');var _0x3e156f;var _0x466eb1=squel[_0x3dd7('0x71')]();_0x466eb1['from'](_0x95f6f0[_0x3dd7('0x73')]);for(var _0x2e99b9=0x0;_0x2e99b9<_0x392990[_0x3dd7('0x39')];_0x2e99b9+=0x1){_0x3e156f=_0x392990[_0x2e99b9]['MetricId']?_0x48dfa1[_0x392990[_0x2e99b9]['MetricId']][_0x3dd7('0x75')]:_0x392990[_0x2e99b9][_0x3dd7('0x69')];_0x3e156f=_0x392990[_0x2e99b9][_0x3dd7('0x76')]?_[_0x3dd7('0x77')](_0x3a867a[_0x392990[_0x2e99b9][_0x3dd7('0x76')]],'%s',_0x3e156f):_0x3e156f;_0x3e156f=_0x392990[_0x2e99b9]['format']?_[_0x3dd7('0x77')](_0x2d3c9e[_0x392990[_0x2e99b9]['format']],'%s',_0x3e156f):_0x3e156f;if(_0x392990[_0x2e99b9][_0x3dd7('0x78')]){_0x466eb1[_0x3dd7('0x68')](_0x3e156f);}_0x392990[_0x2e99b9]['orderBy']&&_0x466eb1[_0x3dd7('0x3c')](_0x3e156f,_0x392990[_0x2e99b9]['orderBy']==='DESC'?![]:!![]);_0x466eb1[_0x3dd7('0x69')](_0x3e156f,_0x392990[_0x2e99b9][_0x3dd7('0x7b')]||_0x3e156f);}if(_0x95f6f0[_0x3dd7('0x7c')]){_0x95f6f0[_0x3dd7('0x7c')]=JSON['parse'](_0x95f6f0['joins']);for(var _0x3787b8=0x0;_0x3787b8<_0x95f6f0[_0x3dd7('0x7c')][_0x3dd7('0x39')];_0x3787b8+=0x1){if(_0x95f6f0['joins'][_0x3787b8][_0x3dd7('0x43')]&&_[_0x3dd7('0x63')](_0x3e37c2,_0x95f6f0[_0x3dd7('0x7c')][_0x3787b8][_0x3dd7('0x43')])&&_0x95f6f0[_0x3dd7('0x7c')][_0x3787b8][_0x3dd7('0x7d')]&&_0x95f6f0[_0x3dd7('0x7c')][_0x3787b8][_0x3dd7('0x7e')]&&_0x95f6f0['joins'][_0x3787b8][_0x3dd7('0x8d')]){_0x466eb1[_0x95f6f0[_0x3dd7('0x7c')][_0x3787b8][_0x3dd7('0x43')]](_0x95f6f0['joins'][_0x3787b8][_0x3dd7('0x7e')],null,util[_0x3dd7('0x8e')](_0x3dd7('0x8f'),_0x95f6f0[_0x3dd7('0x73')],_0x95f6f0[_0x3dd7('0x7c')][_0x3787b8][_0x3dd7('0x7d')],_0x95f6f0['joins'][_0x3787b8]['foreignTable'],_0x95f6f0[_0x3dd7('0x7c')][_0x3787b8][_0x3dd7('0x8d')]));}}}if(_0x95f6f0[_0x3dd7('0x7f')]){_0x95f6f0['conditions']=JSON[_0x3dd7('0x80')](_0x95f6f0[_0x3dd7('0x7f')]);_0x466eb1['where'](_0x22ae12(_0x95f6f0['conditions'][_0x3dd7('0x68')]));}_0x1deea7=_0x466eb1[_0x3dd7('0x81')]();_0x466eb1[_0x3dd7('0x1e')](_0x4b2210);_0x466eb1['offset'](0x0);return;}})[_0x3dd7('0x25')](function(){if(_0x512a73[_0x3dd7('0x90')]===_0x3dd7('0x91')){return null;}var _0x1afaa5=_[_0x3dd7('0x42')](_0x512a73,{'name':_0x512a73[_0x3dd7('0x92')]||_0x512a73[_0x3dd7('0x2c')]||_0x95f6f0[_0x3dd7('0x2c')],'basename':_0x3da8ef,'savename':util[_0x3dd7('0x8e')](_0x3dd7('0x93'),_0x512a73[_0x3dd7('0x2c')]||_0x95f6f0[_0x3dd7('0x2c')],require(_0x3dd7('0x94'))[_0x3dd7('0x95')](0x4),_0x512a73[_0x3dd7('0x90')]||_0x3dd7('0x96')),'reportId':_0x95f6f0['id'],'reportType':_0x3dd7('0x97')});return db[_0x3dd7('0x98')][_0x3dd7('0x4e')](_0x1afaa5,{'raw':!![]});})[_0x3dd7('0x25')](function(_0x35345e){if(_0x95f6f0['table']===_0x3dd7('0x99')){_0x1deea7[_0x3dd7('0x3e')](_0x95f6f0[_0x3dd7('0x73')]+_0x3dd7('0x9a'),_0x512a73['startDate'],_0x512a73[_0x3dd7('0x9b')]);}else{_0x1deea7[_0x3dd7('0x3e')](_0x95f6f0['table']+'.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x512a73[_0x3dd7('0x9c')],_0x512a73[_0x3dd7('0x9b')]);}if(_0x35345e){logger['info'](_0x3dd7('0x9d'),_0x1deea7[_0x3dd7('0x84')]());require(_0x3dd7('0x9e'))['fork'](path[_0x3dd7('0x88')](__dirname,'../../components/export/',_0x35345e[_0x3dd7('0x90')]),[_0x35345e['id'],_0x1deea7[_0x3dd7('0x84')](),path['join'](__dirname,_0x3dd7('0x9f'),_0x35345e[_0x3dd7('0xa0')]),_0x3da8ef]);return _0x35345e;}else{var _0x2ec6f9=squel[_0x3dd7('0x71')]();_0x2ec6f9[_0x3dd7('0x72')]('('+_0x1deea7[_0x3dd7('0x84')]()+')',_0x3dd7('0xa1'));_0x2ec6f9[_0x3dd7('0x69')](_0x3dd7('0xa2'),_0x3dd7('0x1f'));_0x1deea7['limit'](_0x512a73[_0x3dd7('0x1e')]||_0x4b2210);_0x1deea7[_0x3dd7('0x1c')](_0x512a73[_0x3dd7('0x1c')]||0x0);return dbH[_0x3dd7('0x85')][_0x3dd7('0x34')](_0x2ec6f9[_0x3dd7('0x84')](),{'type':dbH[_0x3dd7('0x85')][_0x3dd7('0x86')][_0x3dd7('0x87')]})[_0x3dd7('0x25')](function(_0x392ef1){if(!_0x392ef1[_0x3dd7('0x39')]){_0x5dbabd=0x0;}else{_0x5dbabd=_0x392ef1[0x0]['count']||0x0;}return dbH[_0x3dd7('0x85')][_0x3dd7('0x34')](_0x1deea7['toString'](),{'type':dbH[_0x3dd7('0x85')][_0x3dd7('0x86')][_0x3dd7('0x87')]});})[_0x3dd7('0x25')](function(_0x183e57){return{'rows':_0x183e57||[],'count':_0x5dbabd};});}});}exports[_0x3dd7('0xa3')]=function(_0x2be557,_0x29ba6f){return runReport(_0x2be557[_0x3dd7('0x4a')],_0x2be557[_0x3dd7('0x34')],_0x2be557[_0x3dd7('0x4c')])[_0x3dd7('0x25')](respondWithResult(_0x29ba6f,null))[_0x3dd7('0x48')](handleError(_0x29ba6f,null));};exports['runReport']=runReport;exports['query']=function(_0x10c8e7,_0x3cf25e){var _0xa2732f=0xa;var _0x59acd7=[_0x3dd7('0x88'),'left_join','right_join',_0x3dd7('0xa4')];var _0x36d9da={'SUM':_0x3dd7('0x58'),'COUNT':_0x3dd7('0x59'),'COUNT DISTINCT':_0x3dd7('0x5a'),'MAX':_0x3dd7('0x5b'),'MIN':_0x3dd7('0x89'),'AVG':_0x3dd7('0x5c'),'GROUP_CONCAT':_0x3dd7('0x5d'),'GROUP_CONCAT ASC':_0x3dd7('0x5e'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x24f69d={'SEC_TO_TIME':_0x3dd7('0x60'),'DATE':'DATE(%s)','HOUR':_0x3dd7('0x61'),'ROUND':_0x3dd7('0x8a'),'UNIX_TIMESTAMP':_0x3dd7('0x62')};var _0x550432=function(_0x251466){return!_[_0x3dd7('0x63')](['IS\x20NULL',_0x3dd7('0x65'),_0x3dd7('0x8b'),_0x3dd7('0x8c')],_0x251466);};var _0x9b93e7=function(_0x26528c){if(!_0x26528c||!_0x26528c[_0x3dd7('0x66')][_0x3dd7('0x39')]){return'';}for(var _0x39eacd='(',_0x2bef10=0x0;_0x2bef10<_0x26528c[_0x3dd7('0x66')]['length'];_0x2bef10+=0x1){_0x2bef10>0x0&&(_0x39eacd+='\x20'+_0x26528c['operator']+'\x20');_0x39eacd+=_0x26528c['rules'][_0x2bef10][_0x3dd7('0x68')]?_0x9b93e7(_0x26528c[_0x3dd7('0x66')][_0x2bef10][_0x3dd7('0x68')]):_0x26528c['rules'][_0x2bef10][_0x3dd7('0x69')]+'\x20'+_0x26528c[_0x3dd7('0x66')][_0x2bef10][_0x3dd7('0x6a')]+(_0x550432(_0x26528c[_0x3dd7('0x66')][_0x2bef10][_0x3dd7('0x6a')])?'\x20'+_0x26528c[_0x3dd7('0x66')][_0x2bef10][_0x3dd7('0x6b')]:'');}return _0x39eacd+')';};var _0x2d116a={'where':{'id':_0x10c8e7['params']['id']}},_0x2aea66,_0x579318,_0x1207ca,_0x3236f9,_0x372e4d;_0x2d116a=_[_0x3dd7('0x42')]({},_0x2d116a,_0x10c8e7[_0x3dd7('0x4c')]);return db['AnalyticCustomReport'][_0x3dd7('0x4d')](_0x2d116a)[_0x3dd7('0x25')](function(_0x44b3b7){if(_0x44b3b7){_0x2aea66=_0x44b3b7;return _0x44b3b7[_0x3dd7('0x6c')]();}return null;})['then'](function(_0x5ce1d7){if(_0x5ce1d7){if(!_0x5ce1d7['length']){throw new db[(_0x3dd7('0xa5'))][(_0x3dd7('0x6d'))](_0x3dd7('0x6e'),0x193);}_0x579318=_0x5ce1d7;return db[_0x3dd7('0x6f')][_0x3dd7('0x46')]({'raw':!![]});}return null;})['then'](function(_0xa92e3c){if(_0xa92e3c){_0x1207ca=_[_0x3dd7('0x70')](_0xa92e3c,'id');var _0x3bd821;var _0x3a3758=squel[_0x3dd7('0x71')]();_0x3a3758['from'](_0x2aea66['table']);for(var _0x292649=0x0;_0x292649<_0x579318['length'];_0x292649+=0x1){_0x3bd821=_0x579318[_0x292649][_0x3dd7('0x74')]?_0x1207ca[_0x579318[_0x292649][_0x3dd7('0x74')]]['metric']:_0x579318[_0x292649][_0x3dd7('0x69')];_0x3bd821=_0x579318[_0x292649][_0x3dd7('0x76')]?_[_0x3dd7('0x77')](_0x36d9da[_0x579318[_0x292649][_0x3dd7('0x76')]],'%s',_0x3bd821):_0x3bd821;_0x3bd821=_0x579318[_0x292649][_0x3dd7('0x8e')]?_['replace'](_0x24f69d[_0x579318[_0x292649][_0x3dd7('0x8e')]],'%s',_0x3bd821):_0x3bd821;if(_0x579318[_0x292649]['groupBy']){_0x3a3758[_0x3dd7('0x68')](_0x3bd821);}_0x579318[_0x292649][_0x3dd7('0x79')]&&_0x3a3758[_0x3dd7('0x3c')](_0x3bd821,_0x579318[_0x292649][_0x3dd7('0x79')]===_0x3dd7('0x7a')?![]:!![]);_0x3a3758[_0x3dd7('0x69')](_0x3bd821,_0x579318[_0x292649][_0x3dd7('0x7b')]||_0x3bd821);}if(_0x2aea66[_0x3dd7('0x7c')]){_0x2aea66[_0x3dd7('0x7c')]=JSON[_0x3dd7('0x80')](_0x2aea66[_0x3dd7('0x7c')]);for(var _0x311e9e=0x0;_0x311e9e<_0x2aea66[_0x3dd7('0x7c')][_0x3dd7('0x39')];_0x311e9e+=0x1){if(_0x2aea66['joins'][_0x311e9e][_0x3dd7('0x43')]&&_['includes'](_0x59acd7,_0x2aea66[_0x3dd7('0x7c')][_0x311e9e][_0x3dd7('0x43')])&&_0x2aea66[_0x3dd7('0x7c')][_0x311e9e][_0x3dd7('0x7d')]&&_0x2aea66[_0x3dd7('0x7c')][_0x311e9e][_0x3dd7('0x7e')]&&_0x2aea66['joins'][_0x311e9e][_0x3dd7('0x8d')]){_0x3a3758[_0x2aea66[_0x3dd7('0x7c')][_0x311e9e][_0x3dd7('0x43')]](_0x2aea66[_0x3dd7('0x7c')][_0x311e9e]['foreignTable'],null,util[_0x3dd7('0x8e')](_0x3dd7('0x8f'),_0x2aea66[_0x3dd7('0x73')],_0x2aea66['joins'][_0x311e9e][_0x3dd7('0x7d')],_0x2aea66[_0x3dd7('0x7c')][_0x311e9e][_0x3dd7('0x7e')],_0x2aea66[_0x3dd7('0x7c')][_0x311e9e]['foreignKey']));}}}if(_0x2aea66[_0x3dd7('0x7f')]){_0x2aea66[_0x3dd7('0x7f')]=JSON['parse'](_0x2aea66[_0x3dd7('0x7f')]);_0x3a3758[_0x3dd7('0x3e')](_0x9b93e7(_0x2aea66[_0x3dd7('0x7f')]['group']));}_0x372e4d=_0x3a3758[_0x3dd7('0x81')]();_0x3a3758[_0x3dd7('0x1e')](_0xa2732f);_0x3a3758[_0x3dd7('0x1c')](0x0);logger[_0x3dd7('0x82')](_0x3dd7('0x83'),_0x3a3758['toString']());return dbH[_0x3dd7('0x85')]['query'](_0x3a3758[_0x3dd7('0x84')](),{'type':dbH[_0x3dd7('0x85')][_0x3dd7('0x86')][_0x3dd7('0x87')]});}})[_0x3dd7('0x25')](function(){return{'sql':_0x372e4d[_0x3dd7('0x84')]()};})[_0x3dd7('0x25')](respondWithResult(_0x3cf25e,null))[_0x3dd7('0x48')](handleError(_0x3cf25e,null));}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.model.js b/server/api/analyticCustomReport/analyticCustomReport.model.js index 9c393d2..d9ae339 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 _0x0094=['bluebird','request-promise','rimraf','../../config/environment','./analyticCustomReport.attributes','exports','define','AnalyticCustomReport','analytics_custom_reports','lodash','util','../../config/logger','api','moment'];(function(_0x4b1b2b,_0x320924){var _0x14bb0d=function(_0x1470f0){while(--_0x1470f0){_0x4b1b2b['push'](_0x4b1b2b['shift']());}};_0x14bb0d(++_0x320924);}(_0x0094,0x121));var _0x4009=function(_0x37208f,_0x1f291a){_0x37208f=_0x37208f-0x0;var _0x5d0179=_0x0094[_0x37208f];return _0x5d0179;};'use strict';var _=require(_0x4009('0x0'));var util=require(_0x4009('0x1'));var logger=require(_0x4009('0x2'))(_0x4009('0x3'));var moment=require(_0x4009('0x4'));var BPromise=require(_0x4009('0x5'));var rp=require(_0x4009('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4009('0x7'));var config=require(_0x4009('0x8'));var attributes=require(_0x4009('0x9'));module[_0x4009('0xa')]=function(_0x778840,_0x2049e9){return _0x778840[_0x4009('0xb')](_0x4009('0xc'),attributes,{'tableName':_0x4009('0xd'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2b26=['path','../../config/environment','./analyticCustomReport.attributes','exports','define','AnalyticCustomReport','analytics_custom_reports','lodash','util','../../config/logger','api','bluebird','request-promise'];(function(_0xf7c71f,_0x14fcf2){var _0x2d0564=function(_0x2c565d){while(--_0x2c565d){_0xf7c71f['push'](_0xf7c71f['shift']());}};_0x2d0564(++_0x14fcf2);}(_0x2b26,0xbd));var _0x62b2=function(_0x465a0c,_0x19d4d5){_0x465a0c=_0x465a0c-0x0;var _0x1e202e=_0x2b26[_0x465a0c];return _0x1e202e;};'use strict';var _=require(_0x62b2('0x0'));var util=require(_0x62b2('0x1'));var logger=require(_0x62b2('0x2'))(_0x62b2('0x3'));var moment=require('moment');var BPromise=require(_0x62b2('0x4'));var rp=require(_0x62b2('0x5'));var fs=require('fs');var path=require(_0x62b2('0x6'));var rimraf=require('rimraf');var config=require(_0x62b2('0x7'));var attributes=require(_0x62b2('0x8'));module[_0x62b2('0x9')]=function(_0x3c35f8,_0x16e9a0){return _0x3c35f8[_0x62b2('0xa')](_0x62b2('0xb'),attributes,{'tableName':_0x62b2('0xc'),'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 91cc9c4..648a2fc 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 _0x024b=['code','message','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','then','AnalyticCustomReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error'];(function(_0x21f6eb,_0x59beb0){var _0xb6c0ce=function(_0x1ff87a){while(--_0x1ff87a){_0x21f6eb['push'](_0x21f6eb['shift']());}};_0xb6c0ce(++_0x59beb0);}(_0x024b,0x1e5));var _0xb024=function(_0x13fd86,_0x43259f){_0x13fd86=_0x13fd86-0x0;var _0x7be38a=_0x024b[_0x13fd86];return _0x7be38a;};'use strict';var _=require(_0xb024('0x0'));var util=require(_0xb024('0x1'));var moment=require(_0xb024('0x2'));var BPromise=require(_0xb024('0x3'));var rs=require(_0xb024('0x4'));var fs=require('fs');var Redis=require(_0xb024('0x5'));var db=require(_0xb024('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xb024('0x7'));var config=require(_0xb024('0x8'));var jayson=require(_0xb024('0x9'));var client=jayson[_0xb024('0xa')][_0xb024('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3a32ca,_0x240f48,_0x5a06f3){return new BPromise(function(_0x14fad0,_0x1e94ad){return client[_0xb024('0xc')](_0x3a32ca,_0x5a06f3)[_0xb024('0xd')](function(_0x1c84b3){logger['info'](_0xb024('0xe'),_0x240f48,_0xb024('0xf'));logger[_0xb024('0x10')]('AnalyticCustomReport,\x20%s,\x20%s,\x20%s',_0x240f48,_0xb024('0xf'),JSON[_0xb024('0x11')](_0x1c84b3));if(_0x1c84b3[_0xb024('0x12')]){if(_0x1c84b3['error'][_0xb024('0x13')]===0x1f4){logger['error'](_0xb024('0xe'),_0x240f48,_0x1c84b3[_0xb024('0x12')][_0xb024('0x14')]);return _0x1e94ad(_0x1c84b3[_0xb024('0x12')][_0xb024('0x14')]);}logger[_0xb024('0x12')]('AnalyticCustomReport,\x20%s,\x20%s',_0x240f48,_0x1c84b3[_0xb024('0x12')]['message']);return _0x14fad0(_0x1c84b3[_0xb024('0x12')]['message']);}else{logger[_0xb024('0x15')](_0xb024('0xe'),_0x240f48,_0xb024('0xf'));_0x14fad0(_0x1c84b3[_0xb024('0x16')][_0xb024('0x14')]);}})[_0xb024('0x17')](function(_0x570980){logger[_0xb024('0x12')](_0xb024('0xe'),_0x240f48,_0x570980);_0x1e94ad(_0x570980);});});} \ No newline at end of file +var _0x9ecd=['request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','AnalyticCustomReport,\x20%s,\x20%s','debug'];(function(_0x5a26db,_0x2c5ccd){var _0x4619dd=function(_0x21e28f){while(--_0x21e28f){_0x5a26db['push'](_0x5a26db['shift']());}};_0x4619dd(++_0x2c5ccd);}(_0x9ecd,0x1cf));var _0xd9ec=function(_0x103841,_0x447d69){_0x103841=_0x103841-0x0;var _0x568b18=_0x9ecd[_0x103841];return _0x568b18;};'use strict';var _=require(_0xd9ec('0x0'));var util=require(_0xd9ec('0x1'));var moment=require(_0xd9ec('0x2'));var BPromise=require('bluebird');var rs=require(_0xd9ec('0x3'));var fs=require('fs');var Redis=require(_0xd9ec('0x4'));var db=require(_0xd9ec('0x5'))['db'];var utils=require(_0xd9ec('0x6'));var logger=require(_0xd9ec('0x7'))(_0xd9ec('0x8'));var config=require(_0xd9ec('0x9'));var jayson=require(_0xd9ec('0xa'));var client=jayson['client'][_0xd9ec('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1ca1f4,_0x123c26,_0x1e825e){return new BPromise(function(_0x304089,_0xc06a60){return client[_0xd9ec('0xc')](_0x1ca1f4,_0x1e825e)[_0xd9ec('0xd')](function(_0x44e9c0){logger[_0xd9ec('0xe')](_0xd9ec('0xf'),_0x123c26,'request\x20sent');logger[_0xd9ec('0x10')]('AnalyticCustomReport,\x20%s,\x20%s,\x20%s',_0x123c26,_0xd9ec('0x11'),JSON[_0xd9ec('0x12')](_0x44e9c0));if(_0x44e9c0[_0xd9ec('0x13')]){if(_0x44e9c0['error'][_0xd9ec('0x14')]===0x1f4){logger[_0xd9ec('0x13')]('AnalyticCustomReport,\x20%s,\x20%s',_0x123c26,_0x44e9c0[_0xd9ec('0x13')][_0xd9ec('0x15')]);return _0xc06a60(_0x44e9c0[_0xd9ec('0x13')][_0xd9ec('0x15')]);}logger[_0xd9ec('0x13')]('AnalyticCustomReport,\x20%s,\x20%s',_0x123c26,_0x44e9c0[_0xd9ec('0x13')][_0xd9ec('0x15')]);return _0x304089(_0x44e9c0[_0xd9ec('0x13')][_0xd9ec('0x15')]);}else{logger[_0xd9ec('0xe')](_0xd9ec('0xf'),_0x123c26,_0xd9ec('0x11'));_0x304089(_0x44e9c0[_0xd9ec('0x16')][_0xd9ec('0x15')]);}})[_0xd9ec('0x17')](function(_0x4a3d52){logger[_0xd9ec('0x13')](_0xd9ec('0xf'),_0x123c26,_0x4a3d52);_0xc06a60(_0x4a3d52);});});} \ No newline at end of file diff --git a/server/api/analyticCustomReport/index.js b/server/api/analyticCustomReport/index.js index 3bc3eb0..8dcd338 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 _0x9db0=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','preview','/:id/run','run','/:id/query','post','put','destroy'];(function(_0x4a0abb,_0x5185ea){var _0xd1b4b0=function(_0x360365){while(--_0x360365){_0x4a0abb['push'](_0x4a0abb['shift']());}};_0xd1b4b0(++_0x5185ea);}(_0x9db0,0x1e3));var _0x09db=function(_0x1e22f8,_0x44e3c4){_0x1e22f8=_0x1e22f8-0x0;var _0x55d812=_0x9db0[_0x1e22f8];return _0x55d812;};'use strict';var multer=require('multer');var util=require(_0x09db('0x0'));var path=require(_0x09db('0x1'));var timeout=require(_0x09db('0x2'));var express=require(_0x09db('0x3'));var router=express[_0x09db('0x4')]();var fs_extra=require(_0x09db('0x5'));var auth=require(_0x09db('0x6'));var interaction=require(_0x09db('0x7'));var config=require(_0x09db('0x8'));var controller=require('./analyticCustomReport.controller');router[_0x09db('0x9')]('/',auth[_0x09db('0xa')](),controller[_0x09db('0xb')]);router['get'](_0x09db('0xc'),auth[_0x09db('0xa')](),controller[_0x09db('0xd')]);router[_0x09db('0x9')]('/:id/preview',auth['isAuthenticated'](),controller[_0x09db('0xe')]);router[_0x09db('0x9')](_0x09db('0xf'),auth[_0x09db('0xa')](),controller[_0x09db('0x10')]);router[_0x09db('0x9')](_0x09db('0x11'),auth[_0x09db('0xa')](),controller['query']);router[_0x09db('0x12')]('/',auth[_0x09db('0xa')](),controller['create']);router[_0x09db('0x13')](_0x09db('0xc'),auth[_0x09db('0xa')](),controller['update']);router['delete']('/:id',auth[_0x09db('0xa')](),controller[_0x09db('0x14')]);module['exports']=router; \ No newline at end of file +var _0x9027=['isAuthenticated','index','/:id','show','get','/:id/preview','preview','run','/:id/query','post','create','update','delete','destroy','exports','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x268882,_0xb2de98){var _0x2d800d=function(_0x430b2d){while(--_0x430b2d){_0x268882['push'](_0x268882['shift']());}};_0x2d800d(++_0xb2de98);}(_0x9027,0x151));var _0x7902=function(_0x211783,_0x1437a4){_0x211783=_0x211783-0x0;var _0x5f29ed=_0x9027[_0x211783];return _0x5f29ed;};'use strict';var multer=require(_0x7902('0x0'));var util=require(_0x7902('0x1'));var path=require('path');var timeout=require(_0x7902('0x2'));var express=require('express');var router=express[_0x7902('0x3')]();var fs_extra=require(_0x7902('0x4'));var auth=require(_0x7902('0x5'));var interaction=require(_0x7902('0x6'));var config=require(_0x7902('0x7'));var controller=require('./analyticCustomReport.controller');router['get']('/',auth[_0x7902('0x8')](),controller[_0x7902('0x9')]);router['get'](_0x7902('0xa'),auth[_0x7902('0x8')](),controller[_0x7902('0xb')]);router[_0x7902('0xc')](_0x7902('0xd'),auth[_0x7902('0x8')](),controller[_0x7902('0xe')]);router['get']('/:id/run',auth[_0x7902('0x8')](),controller[_0x7902('0xf')]);router[_0x7902('0xc')](_0x7902('0x10'),auth[_0x7902('0x8')](),controller['query']);router[_0x7902('0x11')]('/',auth[_0x7902('0x8')](),controller[_0x7902('0x12')]);router['put']('/:id',auth[_0x7902('0x8')](),controller[_0x7902('0x13')]);router[_0x7902('0x14')]('/:id',auth[_0x7902('0x8')](),controller[_0x7902('0x15')]);module[_0x7902('0x16')]=router; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js b/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js index a1c2e68..ea02b39 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 _0x46ed=['sequelize','exports','STRING','TEXT'];(function(_0x11a55c,_0x4eced9){var _0x26c390=function(_0x5b0662){while(--_0x5b0662){_0x11a55c['push'](_0x11a55c['shift']());}};_0x26c390(++_0x4eced9);}(_0x46ed,0x168));var _0xd46e=function(_0x178e48,_0x3c9509){_0x178e48=_0x178e48-0x0;var _0x440d7e=_0x46ed[_0x178e48];return _0x440d7e;};'use strict';var Sequelize=require(_0xd46e('0x0'));module[_0xd46e('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0xd46e('0x2')]},'parent':{'type':Sequelize[_0xd46e('0x2')]},'table':{'type':Sequelize[_0xd46e('0x2')]},'conditions':{'type':Sequelize['TEXT']},'joins':{'type':Sequelize[_0xd46e('0x3')]}}; \ No newline at end of file +var _0xc4aa=['STRING','sequelize','exports'];(function(_0x57dde5,_0x45fe38){var _0x18d519=function(_0x1955bf){while(--_0x1955bf){_0x57dde5['push'](_0x57dde5['shift']());}};_0x18d519(++_0x45fe38);}(_0xc4aa,0x1b7));var _0xac4a=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0xc4aa[_0xfae23b];return _0x200640;};'use strict';var Sequelize=require(_0xac4a('0x0'));module[_0xac4a('0x1')]={'name':{'type':Sequelize[_0xac4a('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xac4a('0x2')]},'parent':{'type':Sequelize[_0xac4a('0x2')]},'table':{'type':Sequelize[_0xac4a('0x2')]},'conditions':{'type':Sequelize['TEXT']},'joins':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.controller.js b/server/api/analyticDefaultReport/analyticDefaultReport.controller.js index f51dd77..8180fca 100644 --- a/server/api/analyticDefaultReport/analyticDefaultReport.controller.js +++ b/server/api/analyticDefaultReport/analyticDefaultReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1cb9=['runReport','left_join','SEC_TO_TIME(%s)','IS\x20NULL','clone','debug','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','json','offset','limit','undefined','count','status','set','apply','reject','then','destroy','get','UserProfileResource','stack','name','send','map','AnalyticDefaultReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','length','attributes','hasOwnProperty','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','show','params','find','catch','body','user','role','autoAssociation','create','DefaultReports','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','preview','join','right_join','cross_join','SUM(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','DATE(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator','group','field','condition','getFields','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','select','from','table','MetricId','metric','function','replace','format','orderBy','order','DESC','joins','parentKey','foreignKey','foreignTable','%s.%s\x20=\x20%s.%s','conditions','parse','Limited\x20Query:','sequelize','toString','QueryTypes','SELECT','COUNT(%s)','GROUP_CONCAT(%s)','HOUR(%s)','value','groupBy','alias','output','fullPath','%s-%s.%s','randomstring','generate','csv','default','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','info','Run\x20Query:','child_process','fork','../../components/export/','../../files/reports','savename','countTable','COUNT(*)'];(function(_0x43ed31,_0x429e8a){var _0x49b36e=function(_0x16e3a3){while(--_0x16e3a3){_0x43ed31['push'](_0x43ed31['shift']());}};_0x49b36e(++_0x429e8a);}(_0x1cb9,0x14e));var _0x91cb=function(_0x454d3c,_0x19758d){_0x454d3c=_0x454d3c-0x0;var _0xd770c5=_0x1cb9[_0x454d3c];return _0xd770c5;};'use strict';var emlformat=require(_0x91cb('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x91cb('0x1'));var jsonpatch=require(_0x91cb('0x2'));var rp=require(_0x91cb('0x3'));var moment=require(_0x91cb('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x91cb('0x5'));var util=require(_0x91cb('0x6'));var path=require('path');var sox=require(_0x91cb('0x7'));var csv=require(_0x91cb('0x8'));var ejs=require(_0x91cb('0x9'));var fs=require('fs');var fs_extra=require(_0x91cb('0xa'));var _=require(_0x91cb('0xb'));var squel=require(_0x91cb('0xc'));var crypto=require('crypto');var jsforce=require(_0x91cb('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x91cb('0x8'));var querystring=require('querystring');var Papa=require(_0x91cb('0xe'));var Redis=require(_0x91cb('0xf'));var authService=require(_0x91cb('0x10'));var qs=require(_0x91cb('0x11'));var as=require(_0x91cb('0x12'));var hardwareService=require(_0x91cb('0x13'));var logger=require(_0x91cb('0x14'))(_0x91cb('0x15'));var utils=require(_0x91cb('0x16'));var config=require(_0x91cb('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x91cb('0x18'))['db'];var dbH=require(_0x91cb('0x18'))['dbH'];function respondWithStatusCode(_0x20e6e0,_0x3ea707){_0x3ea707=_0x3ea707||0xcc;return function(_0x44f2e9){if(_0x44f2e9){return _0x20e6e0[_0x91cb('0x19')](_0x3ea707);}return _0x20e6e0['status'](_0x3ea707)['end']();};}function respondWithResult(_0x4aae25,_0x3d22b7){_0x3d22b7=_0x3d22b7||0xc8;return function(_0x585470){if(_0x585470){return _0x4aae25['status'](_0x3d22b7)[_0x91cb('0x1a')](_0x585470);}};}function respondWithFilteredResult(_0xc3629e,_0x347980){return function(_0x5ea796){if(_0x5ea796){var _0x238f11=typeof _0x347980[_0x91cb('0x1b')]==='undefined'&&typeof _0x347980[_0x91cb('0x1c')]===_0x91cb('0x1d');var _0x1cd34b=_0x5ea796[_0x91cb('0x1e')];var _0x5cc1c3=_0x238f11?0x0:_0x347980[_0x91cb('0x1b')];var _0x7dcf60=_0x238f11?_0x5ea796['count']:_0x347980[_0x91cb('0x1b')]+_0x347980['limit'];var _0x55042a;if(_0x7dcf60>=_0x1cd34b){_0x7dcf60=_0x1cd34b;_0x55042a=0xc8;}else{_0x55042a=0xce;}_0xc3629e[_0x91cb('0x1f')](_0x55042a);return _0xc3629e[_0x91cb('0x20')]('Content-Range',_0x5cc1c3+'-'+_0x7dcf60+'/'+_0x1cd34b)['json'](_0x5ea796);}return null;};}function patchUpdates(_0x5b385a){return function(_0x438162){try{jsonpatch[_0x91cb('0x21')](_0x438162,_0x5b385a,!![]);}catch(_0x20aff5){return BPromise[_0x91cb('0x22')](_0x20aff5);}return _0x438162['save']();};}function saveUpdates(_0x45c4b3,_0x43881c){return function(_0x1fa837){if(_0x1fa837){return _0x1fa837['update'](_0x45c4b3)[_0x91cb('0x23')](function(_0x1a7a54){return _0x1a7a54;});}return null;};}function removeEntity(_0x2447e7,_0x422d14){return function(_0x3ca500){if(_0x3ca500){return _0x3ca500[_0x91cb('0x24')]()[_0x91cb('0x23')](function(){var _0x423c4f=_0x3ca500[_0x91cb('0x25')]({'plain':!![]});var _0x4c8438='DefaultReports';return db[_0x91cb('0x26')]['destroy']({'where':{'type':_0x4c8438,'resourceId':_0x423c4f['id']}})[_0x91cb('0x23')](function(){return _0x3ca500;});})[_0x91cb('0x23')](function(){_0x2447e7[_0x91cb('0x1f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x9b26a6,_0x4f5a7b){return function(_0x4572f6){if(!_0x4572f6){_0x9b26a6[_0x91cb('0x19')](0x194);}return _0x4572f6;};}function handleError(_0x3b3ee6,_0x2fb473){_0x2fb473=_0x2fb473||0x1f4;return function(_0x468908){logger['error'](_0x468908[_0x91cb('0x27')]);if(_0x468908['name']){delete _0x468908[_0x91cb('0x28')];}_0x3b3ee6[_0x91cb('0x1f')](_0x2fb473)[_0x91cb('0x29')](_0x468908);};}exports['index']=function(_0x775c25,_0x146e1f){var _0x25bbf9={},_0x361e4c={},_0xf296bc={'count':0x0,'rows':[]};var _0x3dab18=_[_0x91cb('0x2a')](db[_0x91cb('0x2b')][_0x91cb('0x2c')],function(_0x5e6ed3){return{'name':_0x5e6ed3[_0x91cb('0x2d')],'type':_0x5e6ed3[_0x91cb('0x2e')][_0x91cb('0x2f')]};});_0x361e4c[_0x91cb('0x30')]=_[_0x91cb('0x2a')](_0x3dab18,'name');_0x361e4c[_0x91cb('0x31')]=_[_0x91cb('0x32')](_0x775c25[_0x91cb('0x31')]);_0x361e4c[_0x91cb('0x33')]=_[_0x91cb('0x34')](_0x361e4c['model'],_0x361e4c[_0x91cb('0x31')]);_0x25bbf9['attributes']=_['intersection'](_0x361e4c['model'],qs[_0x91cb('0x35')](_0x775c25['query'][_0x91cb('0x35')]));_0x25bbf9['attributes']=_0x25bbf9['attributes'][_0x91cb('0x36')]?_0x25bbf9[_0x91cb('0x37')]:_0x361e4c[_0x91cb('0x30')];if(!_0x775c25[_0x91cb('0x31')][_0x91cb('0x38')]('nolimit')){_0x25bbf9[_0x91cb('0x1c')]=qs[_0x91cb('0x1c')](_0x775c25[_0x91cb('0x31')][_0x91cb('0x1c')]);_0x25bbf9['offset']=qs['offset'](_0x775c25[_0x91cb('0x31')][_0x91cb('0x1b')]);}_0x25bbf9['order']=qs[_0x91cb('0x39')](_0x775c25[_0x91cb('0x31')]['sort']);_0x25bbf9[_0x91cb('0x3a')]=qs[_0x91cb('0x33')](_['pick'](_0x775c25[_0x91cb('0x31')],_0x361e4c['filters']),_0x3dab18);if(_0x775c25[_0x91cb('0x31')][_0x91cb('0x3b')]){_0x25bbf9[_0x91cb('0x3a')]=_[_0x91cb('0x3c')](_0x25bbf9[_0x91cb('0x3a')],{'$or':_[_0x91cb('0x2a')](_0x3dab18,function(_0x5d0e37){if(_0x5d0e37[_0x91cb('0x2e')]!==_0x91cb('0x3d')){var _0x4e5b4b={};_0x4e5b4b[_0x5d0e37[_0x91cb('0x28')]]={'$like':'%'+_0x775c25['query'][_0x91cb('0x3b')]+'%'};return _0x4e5b4b;}})});}_0x25bbf9=_[_0x91cb('0x3c')]({},_0x25bbf9,_0x775c25[_0x91cb('0x3e')]);var _0x174794={'where':_0x25bbf9['where']};return db[_0x91cb('0x2b')][_0x91cb('0x1e')](_0x174794)[_0x91cb('0x23')](function(_0x37e777){_0xf296bc[_0x91cb('0x1e')]=_0x37e777;if(_0x775c25[_0x91cb('0x31')][_0x91cb('0x3f')]){_0x25bbf9[_0x91cb('0x40')]=[{'all':!![]}];}return db[_0x91cb('0x2b')][_0x91cb('0x41')](_0x25bbf9);})['then'](function(_0x16993f){_0xf296bc['rows']=_0x16993f;return _0xf296bc;})[_0x91cb('0x23')](respondWithFilteredResult(_0x146e1f,_0x25bbf9))['catch'](handleError(_0x146e1f,null));};exports[_0x91cb('0x42')]=function(_0x52e82c,_0x138f48){var _0x477131={'raw':!![],'where':{'id':_0x52e82c[_0x91cb('0x43')]['id']}},_0xba99ce={};_0xba99ce['model']=_[_0x91cb('0x32')](db[_0x91cb('0x2b')]['rawAttributes']);_0xba99ce[_0x91cb('0x31')]=_[_0x91cb('0x32')](_0x52e82c[_0x91cb('0x31')]);_0xba99ce[_0x91cb('0x33')]=_[_0x91cb('0x34')](_0xba99ce[_0x91cb('0x30')],_0xba99ce[_0x91cb('0x31')]);_0x477131[_0x91cb('0x37')]=_[_0x91cb('0x34')](_0xba99ce['model'],qs[_0x91cb('0x35')](_0x52e82c[_0x91cb('0x31')][_0x91cb('0x35')]));_0x477131[_0x91cb('0x37')]=_0x477131[_0x91cb('0x37')][_0x91cb('0x36')]?_0x477131[_0x91cb('0x37')]:_0xba99ce[_0x91cb('0x30')];if(_0x52e82c['query'][_0x91cb('0x3f')]){_0x477131[_0x91cb('0x40')]=[{'all':!![]}];}_0x477131=_[_0x91cb('0x3c')]({},_0x477131,_0x52e82c[_0x91cb('0x3e')]);return db['AnalyticDefaultReport'][_0x91cb('0x44')](_0x477131)[_0x91cb('0x23')](handleEntityNotFound(_0x138f48,null))['then'](respondWithResult(_0x138f48,null))[_0x91cb('0x45')](handleError(_0x138f48,null));};exports['create']=function(_0x2c419b,_0x4c0acd){return db['AnalyticDefaultReport']['create'](_0x2c419b[_0x91cb('0x46')],{})[_0x91cb('0x23')](function(_0x3d62c4){var _0x2f8384=_0x2c419b[_0x91cb('0x47')]['get']({'plain':!![]});if(!_0x2f8384)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2f8384[_0x91cb('0x48')]===_0x91cb('0x47')){var _0x140994=_0x3d62c4[_0x91cb('0x25')]({'plain':!![]});var _0x57adff='Reports';return db['UserProfileSection'][_0x91cb('0x44')]({'where':{'name':_0x57adff,'userProfileId':_0x2f8384['userProfileId']},'raw':!![]})[_0x91cb('0x23')](function(_0x4aa670){if(_0x4aa670&&_0x4aa670[_0x91cb('0x49')]===0x0){return db[_0x91cb('0x26')][_0x91cb('0x4a')]({'name':_0x140994[_0x91cb('0x28')],'resourceId':_0x140994['id'],'type':_0x91cb('0x4b'),'sectionId':_0x4aa670['id']},{})[_0x91cb('0x23')](function(){return _0x3d62c4;});}else{return _0x3d62c4;}})[_0x91cb('0x45')](function(_0x30fd4e){logger[_0x91cb('0x4c')](_0x91cb('0x4d'),_0x30fd4e);throw _0x30fd4e;});}return _0x3d62c4;})[_0x91cb('0x23')](respondWithResult(_0x4c0acd,0xc9))['catch'](handleError(_0x4c0acd,null));};exports[_0x91cb('0x4e')]=function(_0x1fa45a,_0x4d7a34){if(_0x1fa45a[_0x91cb('0x46')]['id']){delete _0x1fa45a[_0x91cb('0x46')]['id'];}return db['AnalyticDefaultReport'][_0x91cb('0x44')]({'where':{'id':_0x1fa45a[_0x91cb('0x43')]['id']}})[_0x91cb('0x23')](handleEntityNotFound(_0x4d7a34,null))[_0x91cb('0x23')](saveUpdates(_0x1fa45a[_0x91cb('0x46')],null))[_0x91cb('0x23')](respondWithResult(_0x4d7a34,null))[_0x91cb('0x45')](handleError(_0x4d7a34,null));};exports[_0x91cb('0x24')]=function(_0x3320bd,_0x93ef52){return db[_0x91cb('0x2b')]['find']({'where':{'id':_0x3320bd[_0x91cb('0x43')]['id']}})['then'](handleEntityNotFound(_0x93ef52,null))[_0x91cb('0x23')](removeEntity(_0x93ef52,null))['catch'](handleError(_0x93ef52,null));};exports[_0x91cb('0x4f')]=function(_0x1b2fec,_0x1986d7){var _0x47a6cd=0xa;var _0xe49d42=[_0x91cb('0x50'),'left_join',_0x91cb('0x51'),_0x91cb('0x52')];var _0x365afd={'SUM':_0x91cb('0x53'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0x91cb('0x54'),'MAX':_0x91cb('0x55'),'MIN':_0x91cb('0x56'),'AVG':_0x91cb('0x57'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0x91cb('0x58'),'GROUP_CONCAT DESC':_0x91cb('0x59')};var _0x5c2c01={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0x91cb('0x5a'),'HOUR':'HOUR(%s)','ROUND':_0x91cb('0x5b'),'UNIX_TIMESTAMP':_0x91cb('0x5c')};var _0x5ae0d2=function(_0x4f19c8){return!_[_0x91cb('0x5d')](['IS\x20NULL',_0x91cb('0x5e'),_0x91cb('0x5f'),_0x91cb('0x60')],_0x4f19c8);};var _0x551836=function(_0x22fea8){if(!_0x22fea8||!_0x22fea8['rules'][_0x91cb('0x36')]){return'';}for(var _0xe08233='(',_0xd7be15=0x0;_0xd7be15<_0x22fea8[_0x91cb('0x61')]['length'];_0xd7be15+=0x1){_0xd7be15>0x0&&(_0xe08233+='\x20'+_0x22fea8[_0x91cb('0x62')]+'\x20');_0xe08233+=_0x22fea8[_0x91cb('0x61')][_0xd7be15][_0x91cb('0x63')]?_0x551836(_0x22fea8[_0x91cb('0x61')][_0xd7be15][_0x91cb('0x63')]):_0x22fea8[_0x91cb('0x61')][_0xd7be15][_0x91cb('0x64')]+'\x20'+_0x22fea8[_0x91cb('0x61')][_0xd7be15][_0x91cb('0x65')]+(_0x5ae0d2(_0x22fea8[_0x91cb('0x61')][_0xd7be15][_0x91cb('0x65')])?'\x20'+_0x22fea8[_0x91cb('0x61')][_0xd7be15]['value']:'');}return _0xe08233+')';};var _0x2cf4d0={'where':{'id':_0x1b2fec[_0x91cb('0x43')]['id']}},_0x2e301a,_0x474682,_0x51ab8a,_0x21c890,_0xca33a2;_0x2cf4d0=_['merge']({},_0x2cf4d0,_0x1b2fec[_0x91cb('0x3e')]);return db['AnalyticDefaultReport'][_0x91cb('0x44')](_0x2cf4d0)[_0x91cb('0x23')](function(_0x80fcc6){if(_0x80fcc6){_0x2e301a=_0x80fcc6;return _0x80fcc6[_0x91cb('0x66')]();}return null;})['then'](function(_0x1c0b66){if(_0x1c0b66){if(!_0x1c0b66[_0x91cb('0x36')]){throw new db[(_0x91cb('0x67'))][(_0x91cb('0x68'))](_0x91cb('0x69'),0x193);}_0x474682=_0x1c0b66;return db[_0x91cb('0x6a')]['findAll']({'raw':!![]});}return null;})[_0x91cb('0x23')](function(_0x28bfe5){if(_0x28bfe5){_0x51ab8a=_[_0x91cb('0x6b')](_0x28bfe5,'id');var _0x1f0ba2;var _0x891569=squel[_0x91cb('0x6c')]();_0x891569[_0x91cb('0x6d')](_0x2e301a[_0x91cb('0x6e')]);for(var _0x43629b=0x0;_0x43629b<_0x474682[_0x91cb('0x36')];_0x43629b+=0x1){_0x1f0ba2=_0x474682[_0x43629b][_0x91cb('0x6f')]?_0x51ab8a[_0x474682[_0x43629b][_0x91cb('0x6f')]][_0x91cb('0x70')]:_0x474682[_0x43629b][_0x91cb('0x64')];_0x1f0ba2=_0x474682[_0x43629b][_0x91cb('0x71')]?_[_0x91cb('0x72')](_0x365afd[_0x474682[_0x43629b][_0x91cb('0x71')]],'%s',_0x1f0ba2):_0x1f0ba2;_0x1f0ba2=_0x474682[_0x43629b]['format']?_[_0x91cb('0x72')](_0x5c2c01[_0x474682[_0x43629b][_0x91cb('0x73')]],'%s',_0x1f0ba2):_0x1f0ba2;if(_0x474682[_0x43629b]['groupBy']){_0x891569[_0x91cb('0x63')](_0x1f0ba2);}_0x474682[_0x43629b][_0x91cb('0x74')]&&_0x891569[_0x91cb('0x75')](_0x1f0ba2,_0x474682[_0x43629b]['orderBy']===_0x91cb('0x76')?![]:!![]);_0x891569[_0x91cb('0x64')](_0x1f0ba2,_0x474682[_0x43629b]['alias']||_0x1f0ba2);}if(_0x2e301a['joins']){_0x2e301a[_0x91cb('0x77')]=JSON['parse'](_0x2e301a[_0x91cb('0x77')]);for(var _0x376f56=0x0;_0x376f56<_0x2e301a['joins'][_0x91cb('0x36')];_0x376f56+=0x1){if(_0x2e301a['joins'][_0x376f56][_0x91cb('0x2e')]&&_[_0x91cb('0x5d')](_0xe49d42,_0x2e301a['joins'][_0x376f56]['type'])&&_0x2e301a[_0x91cb('0x77')][_0x376f56][_0x91cb('0x78')]&&_0x2e301a[_0x91cb('0x77')][_0x376f56]['foreignTable']&&_0x2e301a[_0x91cb('0x77')][_0x376f56][_0x91cb('0x79')]){_0x891569[_0x2e301a[_0x91cb('0x77')][_0x376f56][_0x91cb('0x2e')]](_0x2e301a['joins'][_0x376f56][_0x91cb('0x7a')],null,util['format'](_0x91cb('0x7b'),_0x2e301a[_0x91cb('0x6e')],_0x2e301a[_0x91cb('0x77')][_0x376f56][_0x91cb('0x78')],_0x2e301a['joins'][_0x376f56]['foreignTable'],_0x2e301a[_0x91cb('0x77')][_0x376f56]['foreignKey']));}}}if(_0x2e301a[_0x91cb('0x7c')]){_0x2e301a[_0x91cb('0x7c')]=JSON[_0x91cb('0x7d')](_0x2e301a[_0x91cb('0x7c')]);_0x891569[_0x91cb('0x3a')](_0x551836(_0x2e301a[_0x91cb('0x7c')][_0x91cb('0x63')]));}_0xca33a2=_0x891569['clone']();_0x891569[_0x91cb('0x1c')](_0x47a6cd);_0x891569[_0x91cb('0x1b')](0x0);logger['debug'](_0x91cb('0x7e'),_0x891569['toString']());return dbH[_0x91cb('0x7f')][_0x91cb('0x31')](_0x891569[_0x91cb('0x80')](),{'type':dbH[_0x91cb('0x7f')][_0x91cb('0x81')][_0x91cb('0x82')]});}})[_0x91cb('0x23')](respondWithResult(_0x1986d7,null))[_0x91cb('0x45')](handleError(_0x1986d7,null));};function runReport(_0x23380a,_0x14cad8,_0x20a64f){var _0x11411d=_0x14cad8[_0x91cb('0x28')];var _0x14882d=0xa;var _0x22ba54=[_0x91cb('0x50'),'left_join',_0x91cb('0x51'),'cross_join'];var _0x1235c0={'SUM':_0x91cb('0x53'),'COUNT':_0x91cb('0x83'),'COUNT DISTINCT':_0x91cb('0x54'),'MAX':_0x91cb('0x55'),'MIN':_0x91cb('0x56'),'AVG':_0x91cb('0x57'),'GROUP_CONCAT':_0x91cb('0x84'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x91cb('0x59')};var _0xdee7f={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':'DATE(%s)','HOUR':_0x91cb('0x85'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x95f2de=function(_0x4d777a){return!_[_0x91cb('0x5d')](['IS\x20NULL',_0x91cb('0x5e'),_0x91cb('0x5f'),_0x91cb('0x60')],_0x4d777a);};var _0x443c01=function(_0x4e899c){if(!_0x4e899c||!_0x4e899c[_0x91cb('0x61')][_0x91cb('0x36')]){return'';}for(var _0x42d07b='(',_0x427afd=0x0;_0x427afd<_0x4e899c[_0x91cb('0x61')][_0x91cb('0x36')];_0x427afd+=0x1){_0x427afd>0x0&&(_0x42d07b+='\x20'+_0x4e899c[_0x91cb('0x62')]+'\x20');_0x42d07b+=_0x4e899c[_0x91cb('0x61')][_0x427afd][_0x91cb('0x63')]?_0x443c01(_0x4e899c[_0x91cb('0x61')][_0x427afd][_0x91cb('0x63')]):_0x4e899c[_0x91cb('0x61')][_0x427afd][_0x91cb('0x64')]+'\x20'+_0x4e899c[_0x91cb('0x61')][_0x427afd][_0x91cb('0x65')]+(_0x95f2de(_0x4e899c[_0x91cb('0x61')][_0x427afd][_0x91cb('0x65')])?'\x20'+_0x4e899c[_0x91cb('0x61')][_0x427afd][_0x91cb('0x86')]:'');}return _0x42d07b+')';};var _0x39b5bd={'where':{'id':_0x23380a['id']}},_0x315518,_0x3d944d,_0x43b96c,_0xe4d946,_0x32d426;_0x39b5bd=_['merge']({},_0x39b5bd,_0x20a64f);return db[_0x91cb('0x2b')][_0x91cb('0x44')](_0x39b5bd)[_0x91cb('0x23')](function(_0x1a654b){if(_0x1a654b){_0x315518=_0x1a654b;return _0x1a654b[_0x91cb('0x66')]();}return null;})[_0x91cb('0x23')](function(_0x404457){if(_0x404457){if(!_0x404457[_0x91cb('0x36')]){throw new db[(_0x91cb('0x67'))][(_0x91cb('0x68'))](_0x91cb('0x69'),0x193);}_0x3d944d=_0x404457;return db['AnalyticMetric'][_0x91cb('0x41')]({'raw':!![]});}return null;})['then'](function(_0x5689ea){if(_0x5689ea){_0x43b96c=_[_0x91cb('0x6b')](_0x5689ea,'id');var _0x265ffb;var _0x4f66f=squel[_0x91cb('0x6c')]();_0x4f66f[_0x91cb('0x6d')](_0x315518[_0x91cb('0x6e')]);for(var _0x210b46=0x0;_0x210b46<_0x3d944d[_0x91cb('0x36')];_0x210b46+=0x1){_0x265ffb=_0x3d944d[_0x210b46][_0x91cb('0x6f')]?_0x43b96c[_0x3d944d[_0x210b46][_0x91cb('0x6f')]]['metric']:_0x3d944d[_0x210b46][_0x91cb('0x64')];_0x265ffb=_0x3d944d[_0x210b46][_0x91cb('0x71')]?_['replace'](_0x1235c0[_0x3d944d[_0x210b46][_0x91cb('0x71')]],'%s',_0x265ffb):_0x265ffb;_0x265ffb=_0x3d944d[_0x210b46][_0x91cb('0x73')]?_['replace'](_0xdee7f[_0x3d944d[_0x210b46][_0x91cb('0x73')]],'%s',_0x265ffb):_0x265ffb;if(_0x3d944d[_0x210b46][_0x91cb('0x87')]){_0x4f66f[_0x91cb('0x63')](_0x265ffb);}_0x3d944d[_0x210b46][_0x91cb('0x74')]&&_0x4f66f[_0x91cb('0x75')](_0x265ffb,_0x3d944d[_0x210b46][_0x91cb('0x74')]===_0x91cb('0x76')?![]:!![]);_0x4f66f[_0x91cb('0x64')](_0x265ffb,_0x3d944d[_0x210b46][_0x91cb('0x88')]||_0x265ffb);}if(_0x315518[_0x91cb('0x77')]){_0x315518[_0x91cb('0x77')]=JSON[_0x91cb('0x7d')](_0x315518['joins']);for(var _0x5c0725=0x0;_0x5c0725<_0x315518[_0x91cb('0x77')][_0x91cb('0x36')];_0x5c0725+=0x1){if(_0x315518[_0x91cb('0x77')][_0x5c0725][_0x91cb('0x2e')]&&_[_0x91cb('0x5d')](_0x22ba54,_0x315518[_0x91cb('0x77')][_0x5c0725][_0x91cb('0x2e')])&&_0x315518['joins'][_0x5c0725][_0x91cb('0x78')]&&_0x315518['joins'][_0x5c0725][_0x91cb('0x7a')]&&_0x315518[_0x91cb('0x77')][_0x5c0725][_0x91cb('0x79')]){_0x4f66f[_0x315518[_0x91cb('0x77')][_0x5c0725][_0x91cb('0x2e')]](_0x315518['joins'][_0x5c0725][_0x91cb('0x7a')],null,util[_0x91cb('0x73')](_0x91cb('0x7b'),_0x315518[_0x91cb('0x6e')],_0x315518[_0x91cb('0x77')][_0x5c0725]['parentKey'],_0x315518[_0x91cb('0x77')][_0x5c0725][_0x91cb('0x7a')],_0x315518[_0x91cb('0x77')][_0x5c0725][_0x91cb('0x79')]));}}}if(_0x315518['conditions']){_0x315518['conditions']=JSON['parse'](_0x315518[_0x91cb('0x7c')]);_0x4f66f[_0x91cb('0x3a')](_0x443c01(_0x315518[_0x91cb('0x7c')][_0x91cb('0x63')]));}_0x32d426=_0x4f66f['clone']();_0x4f66f[_0x91cb('0x1c')](_0x14882d);_0x4f66f[_0x91cb('0x1b')](0x0);return;}})[_0x91cb('0x23')](function(){if(_0x14cad8[_0x91cb('0x89')]==='web'){return null;}var _0x4bf7c7=_[_0x91cb('0x3c')](_0x14cad8,{'name':_0x14cad8[_0x91cb('0x8a')]||_0x14cad8[_0x91cb('0x28')]||_0x315518[_0x91cb('0x28')],'basename':_0x11411d,'savename':util[_0x91cb('0x73')](_0x91cb('0x8b'),_0x14cad8[_0x91cb('0x28')]||_0x315518[_0x91cb('0x28')],require(_0x91cb('0x8c'))[_0x91cb('0x8d')](0x4),_0x14cad8[_0x91cb('0x89')]||_0x91cb('0x8e')),'reportId':_0x315518['id'],'reportType':_0x91cb('0x8f')});return db['AnalyticExtractedReport']['create'](_0x4bf7c7,{'raw':!![]});})[_0x91cb('0x23')](function(_0x48a910){if(_0x315518[_0x91cb('0x6e')]===_0x91cb('0x90')){_0x32d426[_0x91cb('0x3a')](_0x315518[_0x91cb('0x6e')]+_0x91cb('0x91'),_0x14cad8[_0x91cb('0x92')],_0x14cad8[_0x91cb('0x93')]);}else{_0x32d426[_0x91cb('0x3a')](_0x315518['table']+_0x91cb('0x94'),_0x14cad8[_0x91cb('0x92')],_0x14cad8[_0x91cb('0x93')]);}if(_0x48a910){logger[_0x91cb('0x95')](_0x91cb('0x96'),_0x32d426['toString']());require(_0x91cb('0x97'))[_0x91cb('0x98')](path[_0x91cb('0x50')](__dirname,_0x91cb('0x99'),_0x48a910[_0x91cb('0x89')]),[_0x48a910['id'],_0x32d426['toString'](),path[_0x91cb('0x50')](__dirname,_0x91cb('0x9a'),_0x48a910[_0x91cb('0x9b')]),_0x11411d]);return _0x48a910;}else{var _0x22b6d3=squel[_0x91cb('0x6c')]();_0x22b6d3[_0x91cb('0x6d')]('('+_0x32d426[_0x91cb('0x80')]()+')',_0x91cb('0x9c'));_0x22b6d3[_0x91cb('0x64')](_0x91cb('0x9d'),_0x91cb('0x1e'));_0x32d426[_0x91cb('0x1c')](_0x14cad8[_0x91cb('0x1c')]||_0x14882d);_0x32d426[_0x91cb('0x1b')](_0x14cad8[_0x91cb('0x1b')]||0x0);return dbH[_0x91cb('0x7f')][_0x91cb('0x31')](_0x22b6d3[_0x91cb('0x80')](),{'type':dbH[_0x91cb('0x7f')][_0x91cb('0x81')][_0x91cb('0x82')]})[_0x91cb('0x23')](function(_0x275c80){if(!_0x275c80[_0x91cb('0x36')]){_0xe4d946=0x0;}else{_0xe4d946=_0x275c80[0x0][_0x91cb('0x1e')]||0x0;}return dbH[_0x91cb('0x7f')]['query'](_0x32d426[_0x91cb('0x80')](),{'type':dbH[_0x91cb('0x7f')][_0x91cb('0x81')][_0x91cb('0x82')]});})[_0x91cb('0x23')](function(_0x5ca377){return{'rows':_0x5ca377||[],'count':_0xe4d946};});}});}exports['run']=function(_0x552490,_0x5174ac){return runReport(_0x552490['params'],_0x552490[_0x91cb('0x31')],_0x552490[_0x91cb('0x3e')])[_0x91cb('0x23')](respondWithResult(_0x5174ac,null))[_0x91cb('0x45')](handleError(_0x5174ac,null));};exports[_0x91cb('0x9e')]=runReport;exports[_0x91cb('0x31')]=function(_0x3462c5,_0x146346){var _0xe3d97f=0xa;var _0x3b93c3=['join',_0x91cb('0x9f'),_0x91cb('0x51'),'cross_join'];var _0x154e6a={'SUM':_0x91cb('0x53'),'COUNT':_0x91cb('0x83'),'COUNT DISTINCT':_0x91cb('0x54'),'MAX':_0x91cb('0x55'),'MIN':_0x91cb('0x56'),'AVG':_0x91cb('0x57'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0x91cb('0x58'),'GROUP_CONCAT DESC':_0x91cb('0x59')};var _0x2a05af={'SEC_TO_TIME':_0x91cb('0xa0'),'DATE':_0x91cb('0x5a'),'HOUR':_0x91cb('0x85'),'ROUND':_0x91cb('0x5b'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x34c1f2=function(_0x4d82b4){return!_[_0x91cb('0x5d')]([_0x91cb('0xa1'),_0x91cb('0x5e'),_0x91cb('0x5f'),_0x91cb('0x60')],_0x4d82b4);};var _0x432099=function(_0x344c95){if(!_0x344c95||!_0x344c95[_0x91cb('0x61')][_0x91cb('0x36')]){return'';}for(var _0x570cf0='(',_0xb3a6c4=0x0;_0xb3a6c4<_0x344c95[_0x91cb('0x61')][_0x91cb('0x36')];_0xb3a6c4+=0x1){_0xb3a6c4>0x0&&(_0x570cf0+='\x20'+_0x344c95[_0x91cb('0x62')]+'\x20');_0x570cf0+=_0x344c95[_0x91cb('0x61')][_0xb3a6c4][_0x91cb('0x63')]?_0x432099(_0x344c95[_0x91cb('0x61')][_0xb3a6c4][_0x91cb('0x63')]):_0x344c95[_0x91cb('0x61')][_0xb3a6c4][_0x91cb('0x64')]+'\x20'+_0x344c95[_0x91cb('0x61')][_0xb3a6c4][_0x91cb('0x65')]+(_0x34c1f2(_0x344c95[_0x91cb('0x61')][_0xb3a6c4]['condition'])?'\x20'+_0x344c95[_0x91cb('0x61')][_0xb3a6c4]['value']:'');}return _0x570cf0+')';};var _0x39ba62={'where':{'id':_0x3462c5[_0x91cb('0x43')]['id']}},_0x2ab5a3,_0x10a9f6,_0x43ad75,_0x1382ba,_0x12da14;_0x39ba62=_[_0x91cb('0x3c')]({},_0x39ba62,_0x3462c5['options']);return db[_0x91cb('0x2b')]['find'](_0x39ba62)[_0x91cb('0x23')](function(_0x2f7387){if(_0x2f7387){_0x2ab5a3=_0x2f7387;return _0x2f7387[_0x91cb('0x66')]();}return null;})['then'](function(_0x1f2ef8){if(_0x1f2ef8){if(!_0x1f2ef8[_0x91cb('0x36')]){throw new db[(_0x91cb('0x67'))]['ValidationErrorItem']('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x10a9f6=_0x1f2ef8;return db['AnalyticMetric'][_0x91cb('0x41')]({'raw':!![]});}return null;})[_0x91cb('0x23')](function(_0x3ac830){if(_0x3ac830){_0x43ad75=_['keyBy'](_0x3ac830,'id');var _0x469e62;var _0x1e9441=squel[_0x91cb('0x6c')]();_0x1e9441[_0x91cb('0x6d')](_0x2ab5a3[_0x91cb('0x6e')]);for(var _0x416390=0x0;_0x416390<_0x10a9f6[_0x91cb('0x36')];_0x416390+=0x1){_0x469e62=_0x10a9f6[_0x416390][_0x91cb('0x6f')]?_0x43ad75[_0x10a9f6[_0x416390]['MetricId']][_0x91cb('0x70')]:_0x10a9f6[_0x416390][_0x91cb('0x64')];_0x469e62=_0x10a9f6[_0x416390][_0x91cb('0x71')]?_[_0x91cb('0x72')](_0x154e6a[_0x10a9f6[_0x416390]['function']],'%s',_0x469e62):_0x469e62;_0x469e62=_0x10a9f6[_0x416390][_0x91cb('0x73')]?_['replace'](_0x2a05af[_0x10a9f6[_0x416390][_0x91cb('0x73')]],'%s',_0x469e62):_0x469e62;if(_0x10a9f6[_0x416390][_0x91cb('0x87')]){_0x1e9441[_0x91cb('0x63')](_0x469e62);}_0x10a9f6[_0x416390][_0x91cb('0x74')]&&_0x1e9441[_0x91cb('0x75')](_0x469e62,_0x10a9f6[_0x416390]['orderBy']===_0x91cb('0x76')?![]:!![]);_0x1e9441['field'](_0x469e62,_0x10a9f6[_0x416390]['alias']||_0x469e62);}if(_0x2ab5a3[_0x91cb('0x77')]){_0x2ab5a3[_0x91cb('0x77')]=JSON[_0x91cb('0x7d')](_0x2ab5a3[_0x91cb('0x77')]);for(var _0x286ed7=0x0;_0x286ed7<_0x2ab5a3[_0x91cb('0x77')][_0x91cb('0x36')];_0x286ed7+=0x1){if(_0x2ab5a3[_0x91cb('0x77')][_0x286ed7]['type']&&_[_0x91cb('0x5d')](_0x3b93c3,_0x2ab5a3[_0x91cb('0x77')][_0x286ed7][_0x91cb('0x2e')])&&_0x2ab5a3['joins'][_0x286ed7]['parentKey']&&_0x2ab5a3['joins'][_0x286ed7][_0x91cb('0x7a')]&&_0x2ab5a3[_0x91cb('0x77')][_0x286ed7][_0x91cb('0x79')]){_0x1e9441[_0x2ab5a3['joins'][_0x286ed7][_0x91cb('0x2e')]](_0x2ab5a3[_0x91cb('0x77')][_0x286ed7][_0x91cb('0x7a')],null,util[_0x91cb('0x73')]('%s.%s\x20=\x20%s.%s',_0x2ab5a3[_0x91cb('0x6e')],_0x2ab5a3[_0x91cb('0x77')][_0x286ed7][_0x91cb('0x78')],_0x2ab5a3[_0x91cb('0x77')][_0x286ed7][_0x91cb('0x7a')],_0x2ab5a3[_0x91cb('0x77')][_0x286ed7]['foreignKey']));}}}if(_0x2ab5a3[_0x91cb('0x7c')]){_0x2ab5a3[_0x91cb('0x7c')]=JSON[_0x91cb('0x7d')](_0x2ab5a3[_0x91cb('0x7c')]);_0x1e9441[_0x91cb('0x3a')](_0x432099(_0x2ab5a3['conditions'][_0x91cb('0x63')]));}_0x12da14=_0x1e9441[_0x91cb('0xa2')]();_0x1e9441[_0x91cb('0x1c')](_0xe3d97f);_0x1e9441[_0x91cb('0x1b')](0x0);logger[_0x91cb('0xa3')](_0x91cb('0x7e'),_0x1e9441['toString']());return dbH[_0x91cb('0x7f')][_0x91cb('0x31')](_0x1e9441[_0x91cb('0x80')](),{'type':dbH['sequelize'][_0x91cb('0x81')]['SELECT']});}})[_0x91cb('0x23')](function(){return{'sql':_0x12da14[_0x91cb('0x80')]()};})[_0x91cb('0x23')](respondWithResult(_0x146346,null))[_0x91cb('0x45')](handleError(_0x146346,null));}; \ No newline at end of file +var _0x1967=['conditions','clone','debug','Limited\x20Query:','toString','sequelize','QueryTypes','SELECT','SUM(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','IS\x20NOT\x20NULL','table','web','%s-%s.%s','randomstring','output','default','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','info','fork','../../components/export/','../../files/reports','savename','countTable','COUNT(*)','runReport','select','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','dbH','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','reject','update','then','destroy','get','stack','name','send','index','map','AnalyticDefaultReport','rawAttributes','fieldName','type','key','model','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','where','merge','VIRTUAL','filter','options','includeAll','findAll','rows','show','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Reports','UserProfileSection','find','userProfileId','autoAssociation','UserProfileResource','DefaultReports','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','join','left_join','right_join','cross_join','COUNT(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','DATE(%s)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator','group','field','condition','value','getFields','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','from','MetricId','metric','function','replace','format','groupBy','orderBy','DESC','alias','joins','parse','foreignTable','%s.%s\x20=\x20%s.%s','parentKey','foreignKey'];(function(_0x125d23,_0x1ab0c4){var _0x13c0b5=function(_0x560da6){while(--_0x560da6){_0x125d23['push'](_0x125d23['shift']());}};_0x13c0b5(++_0x1ab0c4);}(_0x1967,0x173));var _0x7196=function(_0x4fe049,_0x52bedb){_0x4fe049=_0x4fe049-0x0;var _0x1946b5=_0x1967[_0x4fe049];return _0x1946b5;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7196('0x0'));var zipdir=require(_0x7196('0x1'));var jsonpatch=require(_0x7196('0x2'));var rp=require(_0x7196('0x3'));var moment=require(_0x7196('0x4'));var BPromise=require(_0x7196('0x5'));var Mustache=require(_0x7196('0x6'));var util=require(_0x7196('0x7'));var path=require(_0x7196('0x8'));var sox=require(_0x7196('0x9'));var csv=require('to-csv');var ejs=require(_0x7196('0xa'));var fs=require('fs');var fs_extra=require(_0x7196('0xb'));var _=require(_0x7196('0xc'));var squel=require(_0x7196('0xd'));var crypto=require(_0x7196('0xe'));var jsforce=require(_0x7196('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x7196('0x10'));var querystring=require(_0x7196('0x11'));var Papa=require(_0x7196('0x12'));var Redis=require(_0x7196('0x13'));var authService=require(_0x7196('0x14'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7196('0x15'));var logger=require(_0x7196('0x16'))(_0x7196('0x17'));var utils=require(_0x7196('0x18'));var config=require(_0x7196('0x19'));var licenseUtil=require(_0x7196('0x1a'));var db=require(_0x7196('0x1b'))['db'];var dbH=require(_0x7196('0x1b'))[_0x7196('0x1c')];function respondWithStatusCode(_0xba707b,_0x154101){_0x154101=_0x154101||0xcc;return function(_0x4e8c4c){if(_0x4e8c4c){return _0xba707b[_0x7196('0x1d')](_0x154101);}return _0xba707b[_0x7196('0x1e')](_0x154101)[_0x7196('0x1f')]();};}function respondWithResult(_0xf098c1,_0x511aa1){_0x511aa1=_0x511aa1||0xc8;return function(_0x31c778){if(_0x31c778){return _0xf098c1['status'](_0x511aa1)[_0x7196('0x20')](_0x31c778);}};}function respondWithFilteredResult(_0x2590a6,_0xf7e97){return function(_0x3ed1ad){if(_0x3ed1ad){var _0x12dce7=typeof _0xf7e97[_0x7196('0x21')]===_0x7196('0x22')&&typeof _0xf7e97[_0x7196('0x23')]===_0x7196('0x22');var _0x32fe2b=_0x3ed1ad[_0x7196('0x24')];var _0x5b716a=_0x12dce7?0x0:_0xf7e97['offset'];var _0x448f13=_0x12dce7?_0x3ed1ad[_0x7196('0x24')]:_0xf7e97[_0x7196('0x21')]+_0xf7e97['limit'];var _0x39b944;if(_0x448f13>=_0x32fe2b){_0x448f13=_0x32fe2b;_0x39b944=0xc8;}else{_0x39b944=0xce;}_0x2590a6['status'](_0x39b944);return _0x2590a6['set'](_0x7196('0x25'),_0x5b716a+'-'+_0x448f13+'/'+_0x32fe2b)[_0x7196('0x20')](_0x3ed1ad);}return null;};}function patchUpdates(_0x8dee9d){return function(_0x4ddf78){try{jsonpatch['apply'](_0x4ddf78,_0x8dee9d,!![]);}catch(_0x38d291){return BPromise[_0x7196('0x26')](_0x38d291);}return _0x4ddf78['save']();};}function saveUpdates(_0x18649b,_0x27ff84){return function(_0x6e22e5){if(_0x6e22e5){return _0x6e22e5[_0x7196('0x27')](_0x18649b)[_0x7196('0x28')](function(_0x549f34){return _0x549f34;});}return null;};}function removeEntity(_0x3f8178,_0x520d01){return function(_0x3ce9a0){if(_0x3ce9a0){return _0x3ce9a0[_0x7196('0x29')]()[_0x7196('0x28')](function(){var _0xa69810=_0x3ce9a0[_0x7196('0x2a')]({'plain':!![]});var _0x43f6a2='DefaultReports';return db['UserProfileResource'][_0x7196('0x29')]({'where':{'type':_0x43f6a2,'resourceId':_0xa69810['id']}})[_0x7196('0x28')](function(){return _0x3ce9a0;});})[_0x7196('0x28')](function(){_0x3f8178['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x41cfd2,_0x162cfc){return function(_0x675e64){if(!_0x675e64){_0x41cfd2['sendStatus'](0x194);}return _0x675e64;};}function handleError(_0x35eef9,_0x4ecea1){_0x4ecea1=_0x4ecea1||0x1f4;return function(_0x4fd339){logger['error'](_0x4fd339[_0x7196('0x2b')]);if(_0x4fd339[_0x7196('0x2c')]){delete _0x4fd339[_0x7196('0x2c')];}_0x35eef9['status'](_0x4ecea1)[_0x7196('0x2d')](_0x4fd339);};}exports[_0x7196('0x2e')]=function(_0x2f9583,_0xf999e9){var _0x50c386={},_0x39710d={},_0x429160={'count':0x0,'rows':[]};var _0xd07f22=_[_0x7196('0x2f')](db[_0x7196('0x30')][_0x7196('0x31')],function(_0x15c5f0){return{'name':_0x15c5f0[_0x7196('0x32')],'type':_0x15c5f0[_0x7196('0x33')][_0x7196('0x34')]};});_0x39710d[_0x7196('0x35')]=_['map'](_0xd07f22,_0x7196('0x2c'));_0x39710d['query']=_[_0x7196('0x36')](_0x2f9583['query']);_0x39710d[_0x7196('0x37')]=_[_0x7196('0x38')](_0x39710d['model'],_0x39710d[_0x7196('0x39')]);_0x50c386[_0x7196('0x3a')]=_[_0x7196('0x38')](_0x39710d[_0x7196('0x35')],qs[_0x7196('0x3b')](_0x2f9583['query'][_0x7196('0x3b')]));_0x50c386[_0x7196('0x3a')]=_0x50c386[_0x7196('0x3a')][_0x7196('0x3c')]?_0x50c386[_0x7196('0x3a')]:_0x39710d[_0x7196('0x35')];if(!_0x2f9583['query'][_0x7196('0x3d')](_0x7196('0x3e'))){_0x50c386[_0x7196('0x23')]=qs['limit'](_0x2f9583[_0x7196('0x39')][_0x7196('0x23')]);_0x50c386[_0x7196('0x21')]=qs[_0x7196('0x21')](_0x2f9583[_0x7196('0x39')][_0x7196('0x21')]);}_0x50c386[_0x7196('0x3f')]=qs[_0x7196('0x40')](_0x2f9583[_0x7196('0x39')][_0x7196('0x40')]);_0x50c386['where']=qs[_0x7196('0x37')](_[_0x7196('0x41')](_0x2f9583['query'],_0x39710d[_0x7196('0x37')]),_0xd07f22);if(_0x2f9583['query']['filter']){_0x50c386[_0x7196('0x42')]=_[_0x7196('0x43')](_0x50c386['where'],{'$or':_['map'](_0xd07f22,function(_0x1bad95){if(_0x1bad95[_0x7196('0x33')]!==_0x7196('0x44')){var _0x4c2341={};_0x4c2341[_0x1bad95[_0x7196('0x2c')]]={'$like':'%'+_0x2f9583[_0x7196('0x39')][_0x7196('0x45')]+'%'};return _0x4c2341;}})});}_0x50c386=_[_0x7196('0x43')]({},_0x50c386,_0x2f9583[_0x7196('0x46')]);var _0x428d76={'where':_0x50c386[_0x7196('0x42')]};return db[_0x7196('0x30')]['count'](_0x428d76)[_0x7196('0x28')](function(_0xa852e1){_0x429160['count']=_0xa852e1;if(_0x2f9583[_0x7196('0x39')][_0x7196('0x47')]){_0x50c386['include']=[{'all':!![]}];}return db[_0x7196('0x30')][_0x7196('0x48')](_0x50c386);})[_0x7196('0x28')](function(_0x5749e2){_0x429160[_0x7196('0x49')]=_0x5749e2;return _0x429160;})[_0x7196('0x28')](respondWithFilteredResult(_0xf999e9,_0x50c386))['catch'](handleError(_0xf999e9,null));};exports[_0x7196('0x4a')]=function(_0x1a7052,_0x4f0c6c){var _0x335e6f={'raw':!![],'where':{'id':_0x1a7052['params']['id']}},_0x53a5e6={};_0x53a5e6['model']=_['keys'](db['AnalyticDefaultReport'][_0x7196('0x31')]);_0x53a5e6['query']=_[_0x7196('0x36')](_0x1a7052[_0x7196('0x39')]);_0x53a5e6[_0x7196('0x37')]=_[_0x7196('0x38')](_0x53a5e6['model'],_0x53a5e6[_0x7196('0x39')]);_0x335e6f['attributes']=_[_0x7196('0x38')](_0x53a5e6[_0x7196('0x35')],qs[_0x7196('0x3b')](_0x1a7052['query'][_0x7196('0x3b')]));_0x335e6f[_0x7196('0x3a')]=_0x335e6f[_0x7196('0x3a')]['length']?_0x335e6f['attributes']:_0x53a5e6[_0x7196('0x35')];if(_0x1a7052['query'][_0x7196('0x47')]){_0x335e6f['include']=[{'all':!![]}];}_0x335e6f=_['merge']({},_0x335e6f,_0x1a7052[_0x7196('0x46')]);return db['AnalyticDefaultReport']['find'](_0x335e6f)['then'](handleEntityNotFound(_0x4f0c6c,null))[_0x7196('0x28')](respondWithResult(_0x4f0c6c,null))['catch'](handleError(_0x4f0c6c,null));};exports['create']=function(_0x28591e,_0x182c8b){return db[_0x7196('0x30')][_0x7196('0x4b')](_0x28591e['body'],{})[_0x7196('0x28')](function(_0x564688){var _0x36844f=_0x28591e[_0x7196('0x4c')]['get']({'plain':!![]});if(!_0x36844f)throw new Error(_0x7196('0x4d'));if(_0x36844f[_0x7196('0x4e')]===_0x7196('0x4c')){var _0x4fa18f=_0x564688[_0x7196('0x2a')]({'plain':!![]});var _0x5d51aa=_0x7196('0x4f');return db[_0x7196('0x50')][_0x7196('0x51')]({'where':{'name':_0x5d51aa,'userProfileId':_0x36844f[_0x7196('0x52')]},'raw':!![]})[_0x7196('0x28')](function(_0x19733a){if(_0x19733a&&_0x19733a[_0x7196('0x53')]===0x0){return db[_0x7196('0x54')]['create']({'name':_0x4fa18f['name'],'resourceId':_0x4fa18f['id'],'type':_0x7196('0x55'),'sectionId':_0x19733a['id']},{})[_0x7196('0x28')](function(){return _0x564688;});}else{return _0x564688;}})[_0x7196('0x56')](function(_0xe4b032){logger['error'](_0x7196('0x57'),_0xe4b032);throw _0xe4b032;});}return _0x564688;})[_0x7196('0x28')](respondWithResult(_0x182c8b,0xc9))[_0x7196('0x56')](handleError(_0x182c8b,null));};exports[_0x7196('0x27')]=function(_0x9fcfd4,_0x3177c2){if(_0x9fcfd4[_0x7196('0x58')]['id']){delete _0x9fcfd4[_0x7196('0x58')]['id'];}return db[_0x7196('0x30')][_0x7196('0x51')]({'where':{'id':_0x9fcfd4[_0x7196('0x59')]['id']}})['then'](handleEntityNotFound(_0x3177c2,null))[_0x7196('0x28')](saveUpdates(_0x9fcfd4[_0x7196('0x58')],null))[_0x7196('0x28')](respondWithResult(_0x3177c2,null))['catch'](handleError(_0x3177c2,null));};exports[_0x7196('0x29')]=function(_0x5ca1ca,_0x34407d){return db[_0x7196('0x30')][_0x7196('0x51')]({'where':{'id':_0x5ca1ca[_0x7196('0x59')]['id']}})[_0x7196('0x28')](handleEntityNotFound(_0x34407d,null))['then'](removeEntity(_0x34407d,null))[_0x7196('0x56')](handleError(_0x34407d,null));};exports['preview']=function(_0x4be36d,_0x5b9824){var _0x1bc358=0xa;var _0x3be180=[_0x7196('0x5a'),_0x7196('0x5b'),_0x7196('0x5c'),_0x7196('0x5d')];var _0x2d8b3d={'SUM':'SUM(%s)','COUNT':_0x7196('0x5e'),'COUNT DISTINCT':_0x7196('0x5f'),'MAX':_0x7196('0x60'),'MIN':_0x7196('0x61'),'AVG':_0x7196('0x62'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x7196('0x63')};var _0x1c7eb2={'SEC_TO_TIME':_0x7196('0x64'),'DATE':_0x7196('0x65'),'HOUR':_0x7196('0x66'),'ROUND':_0x7196('0x67'),'UNIX_TIMESTAMP':_0x7196('0x68')};var _0x43ee13=function(_0x13e9d0){return!_[_0x7196('0x69')]([_0x7196('0x6a'),'IS\x20NOT\x20NULL',_0x7196('0x6b'),_0x7196('0x6c')],_0x13e9d0);};var _0x27d5d7=function(_0x33f43b){if(!_0x33f43b||!_0x33f43b['rules'][_0x7196('0x3c')]){return'';}for(var _0x204c3a='(',_0x1f3acc=0x0;_0x1f3acc<_0x33f43b[_0x7196('0x6d')][_0x7196('0x3c')];_0x1f3acc+=0x1){_0x1f3acc>0x0&&(_0x204c3a+='\x20'+_0x33f43b[_0x7196('0x6e')]+'\x20');_0x204c3a+=_0x33f43b[_0x7196('0x6d')][_0x1f3acc]['group']?_0x27d5d7(_0x33f43b[_0x7196('0x6d')][_0x1f3acc][_0x7196('0x6f')]):_0x33f43b[_0x7196('0x6d')][_0x1f3acc][_0x7196('0x70')]+'\x20'+_0x33f43b['rules'][_0x1f3acc][_0x7196('0x71')]+(_0x43ee13(_0x33f43b[_0x7196('0x6d')][_0x1f3acc][_0x7196('0x71')])?'\x20'+_0x33f43b[_0x7196('0x6d')][_0x1f3acc][_0x7196('0x72')]:'');}return _0x204c3a+')';};var _0x37c6be={'where':{'id':_0x4be36d['params']['id']}},_0x57065,_0x517dfb,_0x56b2eb,_0x56955e,_0x72f6f1;_0x37c6be=_[_0x7196('0x43')]({},_0x37c6be,_0x4be36d[_0x7196('0x46')]);return db[_0x7196('0x30')][_0x7196('0x51')](_0x37c6be)[_0x7196('0x28')](function(_0x30d44f){if(_0x30d44f){_0x57065=_0x30d44f;return _0x30d44f[_0x7196('0x73')]();}return null;})[_0x7196('0x28')](function(_0x3881a5){if(_0x3881a5){if(!_0x3881a5['length']){throw new db['Sequelize'][(_0x7196('0x74'))](_0x7196('0x75'),0x193);}_0x517dfb=_0x3881a5;return db[_0x7196('0x76')][_0x7196('0x48')]({'raw':!![]});}return null;})[_0x7196('0x28')](function(_0x45e21f){if(_0x45e21f){_0x56b2eb=_[_0x7196('0x77')](_0x45e21f,'id');var _0x2f36f8;var _0x4cc5e3=squel['select']();_0x4cc5e3[_0x7196('0x78')](_0x57065['table']);for(var _0x30d114=0x0;_0x30d114<_0x517dfb['length'];_0x30d114+=0x1){_0x2f36f8=_0x517dfb[_0x30d114][_0x7196('0x79')]?_0x56b2eb[_0x517dfb[_0x30d114][_0x7196('0x79')]][_0x7196('0x7a')]:_0x517dfb[_0x30d114][_0x7196('0x70')];_0x2f36f8=_0x517dfb[_0x30d114]['function']?_['replace'](_0x2d8b3d[_0x517dfb[_0x30d114][_0x7196('0x7b')]],'%s',_0x2f36f8):_0x2f36f8;_0x2f36f8=_0x517dfb[_0x30d114]['format']?_[_0x7196('0x7c')](_0x1c7eb2[_0x517dfb[_0x30d114][_0x7196('0x7d')]],'%s',_0x2f36f8):_0x2f36f8;if(_0x517dfb[_0x30d114][_0x7196('0x7e')]){_0x4cc5e3[_0x7196('0x6f')](_0x2f36f8);}_0x517dfb[_0x30d114][_0x7196('0x7f')]&&_0x4cc5e3[_0x7196('0x3f')](_0x2f36f8,_0x517dfb[_0x30d114]['orderBy']===_0x7196('0x80')?![]:!![]);_0x4cc5e3[_0x7196('0x70')](_0x2f36f8,_0x517dfb[_0x30d114][_0x7196('0x81')]||_0x2f36f8);}if(_0x57065[_0x7196('0x82')]){_0x57065[_0x7196('0x82')]=JSON[_0x7196('0x83')](_0x57065[_0x7196('0x82')]);for(var _0x473c0e=0x0;_0x473c0e<_0x57065[_0x7196('0x82')][_0x7196('0x3c')];_0x473c0e+=0x1){if(_0x57065[_0x7196('0x82')][_0x473c0e][_0x7196('0x33')]&&_['includes'](_0x3be180,_0x57065[_0x7196('0x82')][_0x473c0e][_0x7196('0x33')])&&_0x57065['joins'][_0x473c0e]['parentKey']&&_0x57065[_0x7196('0x82')][_0x473c0e][_0x7196('0x84')]&&_0x57065[_0x7196('0x82')][_0x473c0e]['foreignKey']){_0x4cc5e3[_0x57065[_0x7196('0x82')][_0x473c0e]['type']](_0x57065[_0x7196('0x82')][_0x473c0e][_0x7196('0x84')],null,util['format'](_0x7196('0x85'),_0x57065['table'],_0x57065['joins'][_0x473c0e][_0x7196('0x86')],_0x57065[_0x7196('0x82')][_0x473c0e][_0x7196('0x84')],_0x57065['joins'][_0x473c0e][_0x7196('0x87')]));}}}if(_0x57065['conditions']){_0x57065[_0x7196('0x88')]=JSON[_0x7196('0x83')](_0x57065[_0x7196('0x88')]);_0x4cc5e3[_0x7196('0x42')](_0x27d5d7(_0x57065[_0x7196('0x88')]['group']));}_0x72f6f1=_0x4cc5e3[_0x7196('0x89')]();_0x4cc5e3[_0x7196('0x23')](_0x1bc358);_0x4cc5e3[_0x7196('0x21')](0x0);logger[_0x7196('0x8a')](_0x7196('0x8b'),_0x4cc5e3[_0x7196('0x8c')]());return dbH[_0x7196('0x8d')][_0x7196('0x39')](_0x4cc5e3['toString'](),{'type':dbH[_0x7196('0x8d')][_0x7196('0x8e')][_0x7196('0x8f')]});}})[_0x7196('0x28')](respondWithResult(_0x5b9824,null))['catch'](handleError(_0x5b9824,null));};function runReport(_0x1364f5,_0x2cb53c,_0x4fe2cb){var _0x2e4807=_0x2cb53c['name'];var _0xd6d8cf=0xa;var _0x5318c1=[_0x7196('0x5a'),_0x7196('0x5b'),'right_join',_0x7196('0x5d')];var _0x2b52c0={'SUM':_0x7196('0x90'),'COUNT':'COUNT(%s)','COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0x7196('0x60'),'MIN':'MIN(%s)','AVG':'AVG(%s)','GROUP_CONCAT':_0x7196('0x91'),'GROUP_CONCAT ASC':_0x7196('0x92'),'GROUP_CONCAT DESC':_0x7196('0x63')};var _0x509c4a={'SEC_TO_TIME':_0x7196('0x64'),'DATE':_0x7196('0x65'),'HOUR':_0x7196('0x66'),'ROUND':_0x7196('0x67'),'UNIX_TIMESTAMP':_0x7196('0x68')};var _0x26048c=function(_0x1a4d17){return!_[_0x7196('0x69')]([_0x7196('0x6a'),_0x7196('0x93'),_0x7196('0x6b'),'IS\x20NOT\x20EMPTY'],_0x1a4d17);};var _0x5acff1=function(_0x32ab6c){if(!_0x32ab6c||!_0x32ab6c['rules']['length']){return'';}for(var _0x2bfdc4='(',_0x1604fa=0x0;_0x1604fa<_0x32ab6c[_0x7196('0x6d')][_0x7196('0x3c')];_0x1604fa+=0x1){_0x1604fa>0x0&&(_0x2bfdc4+='\x20'+_0x32ab6c['operator']+'\x20');_0x2bfdc4+=_0x32ab6c['rules'][_0x1604fa][_0x7196('0x6f')]?_0x5acff1(_0x32ab6c[_0x7196('0x6d')][_0x1604fa][_0x7196('0x6f')]):_0x32ab6c[_0x7196('0x6d')][_0x1604fa]['field']+'\x20'+_0x32ab6c[_0x7196('0x6d')][_0x1604fa]['condition']+(_0x26048c(_0x32ab6c['rules'][_0x1604fa][_0x7196('0x71')])?'\x20'+_0x32ab6c[_0x7196('0x6d')][_0x1604fa][_0x7196('0x72')]:'');}return _0x2bfdc4+')';};var _0x494418={'where':{'id':_0x1364f5['id']}},_0x400aa5,_0x40d4c3,_0x1824e2,_0x30c54b,_0x10712f;_0x494418=_[_0x7196('0x43')]({},_0x494418,_0x4fe2cb);return db[_0x7196('0x30')][_0x7196('0x51')](_0x494418)['then'](function(_0x9bd2ea){if(_0x9bd2ea){_0x400aa5=_0x9bd2ea;return _0x9bd2ea[_0x7196('0x73')]();}return null;})[_0x7196('0x28')](function(_0x408760){if(_0x408760){if(!_0x408760[_0x7196('0x3c')]){throw new db['Sequelize'][(_0x7196('0x74'))](_0x7196('0x75'),0x193);}_0x40d4c3=_0x408760;return db[_0x7196('0x76')]['findAll']({'raw':!![]});}return null;})[_0x7196('0x28')](function(_0x4b98de){if(_0x4b98de){_0x1824e2=_['keyBy'](_0x4b98de,'id');var _0x1dcf93;var _0x25d323=squel['select']();_0x25d323[_0x7196('0x78')](_0x400aa5[_0x7196('0x94')]);for(var _0x48ceda=0x0;_0x48ceda<_0x40d4c3[_0x7196('0x3c')];_0x48ceda+=0x1){_0x1dcf93=_0x40d4c3[_0x48ceda][_0x7196('0x79')]?_0x1824e2[_0x40d4c3[_0x48ceda][_0x7196('0x79')]][_0x7196('0x7a')]:_0x40d4c3[_0x48ceda][_0x7196('0x70')];_0x1dcf93=_0x40d4c3[_0x48ceda][_0x7196('0x7b')]?_['replace'](_0x2b52c0[_0x40d4c3[_0x48ceda][_0x7196('0x7b')]],'%s',_0x1dcf93):_0x1dcf93;_0x1dcf93=_0x40d4c3[_0x48ceda][_0x7196('0x7d')]?_[_0x7196('0x7c')](_0x509c4a[_0x40d4c3[_0x48ceda]['format']],'%s',_0x1dcf93):_0x1dcf93;if(_0x40d4c3[_0x48ceda]['groupBy']){_0x25d323['group'](_0x1dcf93);}_0x40d4c3[_0x48ceda][_0x7196('0x7f')]&&_0x25d323[_0x7196('0x3f')](_0x1dcf93,_0x40d4c3[_0x48ceda][_0x7196('0x7f')]==='DESC'?![]:!![]);_0x25d323[_0x7196('0x70')](_0x1dcf93,_0x40d4c3[_0x48ceda]['alias']||_0x1dcf93);}if(_0x400aa5[_0x7196('0x82')]){_0x400aa5['joins']=JSON[_0x7196('0x83')](_0x400aa5[_0x7196('0x82')]);for(var _0x33d5bf=0x0;_0x33d5bf<_0x400aa5[_0x7196('0x82')][_0x7196('0x3c')];_0x33d5bf+=0x1){if(_0x400aa5[_0x7196('0x82')][_0x33d5bf][_0x7196('0x33')]&&_['includes'](_0x5318c1,_0x400aa5[_0x7196('0x82')][_0x33d5bf]['type'])&&_0x400aa5['joins'][_0x33d5bf]['parentKey']&&_0x400aa5['joins'][_0x33d5bf]['foreignTable']&&_0x400aa5[_0x7196('0x82')][_0x33d5bf][_0x7196('0x87')]){_0x25d323[_0x400aa5[_0x7196('0x82')][_0x33d5bf]['type']](_0x400aa5[_0x7196('0x82')][_0x33d5bf]['foreignTable'],null,util['format']('%s.%s\x20=\x20%s.%s',_0x400aa5[_0x7196('0x94')],_0x400aa5['joins'][_0x33d5bf][_0x7196('0x86')],_0x400aa5[_0x7196('0x82')][_0x33d5bf][_0x7196('0x84')],_0x400aa5[_0x7196('0x82')][_0x33d5bf][_0x7196('0x87')]));}}}if(_0x400aa5[_0x7196('0x88')]){_0x400aa5[_0x7196('0x88')]=JSON[_0x7196('0x83')](_0x400aa5['conditions']);_0x25d323[_0x7196('0x42')](_0x5acff1(_0x400aa5[_0x7196('0x88')][_0x7196('0x6f')]));}_0x10712f=_0x25d323['clone']();_0x25d323[_0x7196('0x23')](_0xd6d8cf);_0x25d323[_0x7196('0x21')](0x0);return;}})[_0x7196('0x28')](function(){if(_0x2cb53c['output']===_0x7196('0x95')){return null;}var _0x46a563=_[_0x7196('0x43')](_0x2cb53c,{'name':_0x2cb53c['fullPath']||_0x2cb53c[_0x7196('0x2c')]||_0x400aa5[_0x7196('0x2c')],'basename':_0x2e4807,'savename':util['format'](_0x7196('0x96'),_0x2cb53c['name']||_0x400aa5[_0x7196('0x2c')],require(_0x7196('0x97'))['generate'](0x4),_0x2cb53c[_0x7196('0x98')]||'csv'),'reportId':_0x400aa5['id'],'reportType':_0x7196('0x99')});return db[_0x7196('0x9a')][_0x7196('0x4b')](_0x46a563,{'raw':!![]});})['then'](function(_0xd9619d){if(_0x400aa5[_0x7196('0x94')]===_0x7196('0x9b')){_0x10712f[_0x7196('0x42')](_0x400aa5['table']+_0x7196('0x9c'),_0x2cb53c[_0x7196('0x9d')],_0x2cb53c[_0x7196('0x9e')]);}else{_0x10712f['where'](_0x400aa5['table']+_0x7196('0x9f'),_0x2cb53c[_0x7196('0x9d')],_0x2cb53c[_0x7196('0x9e')]);}if(_0xd9619d){logger[_0x7196('0xa0')]('Run\x20Query:',_0x10712f[_0x7196('0x8c')]());require('child_process')[_0x7196('0xa1')](path['join'](__dirname,_0x7196('0xa2'),_0xd9619d[_0x7196('0x98')]),[_0xd9619d['id'],_0x10712f[_0x7196('0x8c')](),path[_0x7196('0x5a')](__dirname,_0x7196('0xa3'),_0xd9619d[_0x7196('0xa4')]),_0x2e4807]);return _0xd9619d;}else{var _0x342fb1=squel['select']();_0x342fb1[_0x7196('0x78')]('('+_0x10712f[_0x7196('0x8c')]()+')',_0x7196('0xa5'));_0x342fb1[_0x7196('0x70')](_0x7196('0xa6'),_0x7196('0x24'));_0x10712f[_0x7196('0x23')](_0x2cb53c[_0x7196('0x23')]||_0xd6d8cf);_0x10712f['offset'](_0x2cb53c[_0x7196('0x21')]||0x0);return dbH[_0x7196('0x8d')]['query'](_0x342fb1[_0x7196('0x8c')](),{'type':dbH[_0x7196('0x8d')]['QueryTypes'][_0x7196('0x8f')]})[_0x7196('0x28')](function(_0xdf1ede){if(!_0xdf1ede[_0x7196('0x3c')]){_0x30c54b=0x0;}else{_0x30c54b=_0xdf1ede[0x0]['count']||0x0;}return dbH['sequelize'][_0x7196('0x39')](_0x10712f['toString'](),{'type':dbH[_0x7196('0x8d')][_0x7196('0x8e')][_0x7196('0x8f')]});})[_0x7196('0x28')](function(_0x2df80a){return{'rows':_0x2df80a||[],'count':_0x30c54b};});}});}exports['run']=function(_0x392e74,_0x17ba6d){return runReport(_0x392e74[_0x7196('0x59')],_0x392e74[_0x7196('0x39')],_0x392e74[_0x7196('0x46')])[_0x7196('0x28')](respondWithResult(_0x17ba6d,null))[_0x7196('0x56')](handleError(_0x17ba6d,null));};exports[_0x7196('0xa7')]=runReport;exports[_0x7196('0x39')]=function(_0x5a3c87,_0x58fb86){var _0x51da79=0xa;var _0x144613=[_0x7196('0x5a'),_0x7196('0x5b'),_0x7196('0x5c'),_0x7196('0x5d')];var _0x9055af={'SUM':_0x7196('0x90'),'COUNT':_0x7196('0x5e'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':'MAX(%s)','MIN':'MIN(%s)','AVG':'AVG(%s)','GROUP_CONCAT':_0x7196('0x91'),'GROUP_CONCAT ASC':_0x7196('0x92'),'GROUP_CONCAT DESC':_0x7196('0x63')};var _0xab9595={'SEC_TO_TIME':_0x7196('0x64'),'DATE':_0x7196('0x65'),'HOUR':'HOUR(%s)','ROUND':_0x7196('0x67'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x5236a0=function(_0x520fe8){return!_['includes'](['IS\x20NULL',_0x7196('0x93'),'IS\x20EMPTY',_0x7196('0x6c')],_0x520fe8);};var _0x425a57=function(_0x302728){if(!_0x302728||!_0x302728[_0x7196('0x6d')][_0x7196('0x3c')]){return'';}for(var _0x14492e='(',_0x58df43=0x0;_0x58df43<_0x302728[_0x7196('0x6d')][_0x7196('0x3c')];_0x58df43+=0x1){_0x58df43>0x0&&(_0x14492e+='\x20'+_0x302728[_0x7196('0x6e')]+'\x20');_0x14492e+=_0x302728['rules'][_0x58df43][_0x7196('0x6f')]?_0x425a57(_0x302728[_0x7196('0x6d')][_0x58df43][_0x7196('0x6f')]):_0x302728['rules'][_0x58df43]['field']+'\x20'+_0x302728[_0x7196('0x6d')][_0x58df43][_0x7196('0x71')]+(_0x5236a0(_0x302728[_0x7196('0x6d')][_0x58df43][_0x7196('0x71')])?'\x20'+_0x302728[_0x7196('0x6d')][_0x58df43][_0x7196('0x72')]:'');}return _0x14492e+')';};var _0x1a8a5a={'where':{'id':_0x5a3c87[_0x7196('0x59')]['id']}},_0x2944e5,_0x3f9385,_0xbd94ef,_0x5d2a56,_0x2fb552;_0x1a8a5a=_['merge']({},_0x1a8a5a,_0x5a3c87[_0x7196('0x46')]);return db[_0x7196('0x30')]['find'](_0x1a8a5a)[_0x7196('0x28')](function(_0x386259){if(_0x386259){_0x2944e5=_0x386259;return _0x386259[_0x7196('0x73')]();}return null;})[_0x7196('0x28')](function(_0x1e7a64){if(_0x1e7a64){if(!_0x1e7a64[_0x7196('0x3c')]){throw new db['Sequelize']['ValidationErrorItem'](_0x7196('0x75'),0x193);}_0x3f9385=_0x1e7a64;return db['AnalyticMetric'][_0x7196('0x48')]({'raw':!![]});}return null;})[_0x7196('0x28')](function(_0x30db09){if(_0x30db09){_0xbd94ef=_['keyBy'](_0x30db09,'id');var _0x4729e1;var _0x66e1e6=squel[_0x7196('0xa8')]();_0x66e1e6[_0x7196('0x78')](_0x2944e5[_0x7196('0x94')]);for(var _0x1e2105=0x0;_0x1e2105<_0x3f9385[_0x7196('0x3c')];_0x1e2105+=0x1){_0x4729e1=_0x3f9385[_0x1e2105][_0x7196('0x79')]?_0xbd94ef[_0x3f9385[_0x1e2105][_0x7196('0x79')]]['metric']:_0x3f9385[_0x1e2105][_0x7196('0x70')];_0x4729e1=_0x3f9385[_0x1e2105][_0x7196('0x7b')]?_[_0x7196('0x7c')](_0x9055af[_0x3f9385[_0x1e2105][_0x7196('0x7b')]],'%s',_0x4729e1):_0x4729e1;_0x4729e1=_0x3f9385[_0x1e2105][_0x7196('0x7d')]?_[_0x7196('0x7c')](_0xab9595[_0x3f9385[_0x1e2105]['format']],'%s',_0x4729e1):_0x4729e1;if(_0x3f9385[_0x1e2105][_0x7196('0x7e')]){_0x66e1e6['group'](_0x4729e1);}_0x3f9385[_0x1e2105][_0x7196('0x7f')]&&_0x66e1e6[_0x7196('0x3f')](_0x4729e1,_0x3f9385[_0x1e2105][_0x7196('0x7f')]==='DESC'?![]:!![]);_0x66e1e6['field'](_0x4729e1,_0x3f9385[_0x1e2105][_0x7196('0x81')]||_0x4729e1);}if(_0x2944e5[_0x7196('0x82')]){_0x2944e5[_0x7196('0x82')]=JSON[_0x7196('0x83')](_0x2944e5[_0x7196('0x82')]);for(var _0x220315=0x0;_0x220315<_0x2944e5[_0x7196('0x82')][_0x7196('0x3c')];_0x220315+=0x1){if(_0x2944e5['joins'][_0x220315][_0x7196('0x33')]&&_[_0x7196('0x69')](_0x144613,_0x2944e5['joins'][_0x220315][_0x7196('0x33')])&&_0x2944e5[_0x7196('0x82')][_0x220315][_0x7196('0x86')]&&_0x2944e5['joins'][_0x220315][_0x7196('0x84')]&&_0x2944e5[_0x7196('0x82')][_0x220315][_0x7196('0x87')]){_0x66e1e6[_0x2944e5[_0x7196('0x82')][_0x220315][_0x7196('0x33')]](_0x2944e5['joins'][_0x220315]['foreignTable'],null,util[_0x7196('0x7d')](_0x7196('0x85'),_0x2944e5[_0x7196('0x94')],_0x2944e5[_0x7196('0x82')][_0x220315][_0x7196('0x86')],_0x2944e5[_0x7196('0x82')][_0x220315]['foreignTable'],_0x2944e5[_0x7196('0x82')][_0x220315][_0x7196('0x87')]));}}}if(_0x2944e5[_0x7196('0x88')]){_0x2944e5[_0x7196('0x88')]=JSON['parse'](_0x2944e5[_0x7196('0x88')]);_0x66e1e6[_0x7196('0x42')](_0x425a57(_0x2944e5[_0x7196('0x88')][_0x7196('0x6f')]));}_0x2fb552=_0x66e1e6[_0x7196('0x89')]();_0x66e1e6[_0x7196('0x23')](_0x51da79);_0x66e1e6[_0x7196('0x21')](0x0);logger[_0x7196('0x8a')](_0x7196('0x8b'),_0x66e1e6[_0x7196('0x8c')]());return dbH[_0x7196('0x8d')][_0x7196('0x39')](_0x66e1e6['toString'](),{'type':dbH[_0x7196('0x8d')]['QueryTypes'][_0x7196('0x8f')]});}})['then'](function(){return{'sql':_0x2fb552[_0x7196('0x8c')]()};})['then'](respondWithResult(_0x58fb86,null))[_0x7196('0x56')](handleError(_0x58fb86,null));}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.model.js b/server/api/analyticDefaultReport/analyticDefaultReport.model.js index 05f7f26..5e4e1c1 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 _0x32e0=['api','moment','rimraf','../../config/environment','./analyticDefaultReport.attributes','exports','define','lodash','../../config/logger'];(function(_0x4d05a0,_0x53aa7e){var _0x4c999c=function(_0x358867){while(--_0x358867){_0x4d05a0['push'](_0x4d05a0['shift']());}};_0x4c999c(++_0x53aa7e);}(_0x32e0,0x15d));var _0x032e=function(_0x4cb095,_0x58da07){_0x4cb095=_0x4cb095-0x0;var _0x2b565d=_0x32e0[_0x4cb095];return _0x2b565d;};'use strict';var _=require(_0x032e('0x0'));var util=require('util');var logger=require(_0x032e('0x1'))(_0x032e('0x2'));var moment=require(_0x032e('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x032e('0x4'));var config=require(_0x032e('0x5'));var attributes=require(_0x032e('0x6'));module[_0x032e('0x7')]=function(_0x2372d3,_0x2fb1e9){return _0x2372d3[_0x032e('0x8')]('AnalyticDefaultReport',attributes,{'tableName':'analytics_default_reports','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2441=['define','AnalyticDefaultReport','analytics_default_reports','util','../../config/logger','moment','request-promise','path','rimraf','../../config/environment','exports'];(function(_0x20d290,_0x40fc11){var _0x2bfa8f=function(_0x2498e0){while(--_0x2498e0){_0x20d290['push'](_0x20d290['shift']());}};_0x2bfa8f(++_0x40fc11);}(_0x2441,0x1dc));var _0x1244=function(_0x4173e8,_0x19a95f){_0x4173e8=_0x4173e8-0x0;var _0x44fd49=_0x2441[_0x4173e8];return _0x44fd49;};'use strict';var _=require('lodash');var util=require(_0x1244('0x0'));var logger=require(_0x1244('0x1'))('api');var moment=require(_0x1244('0x2'));var BPromise=require('bluebird');var rp=require(_0x1244('0x3'));var fs=require('fs');var path=require(_0x1244('0x4'));var rimraf=require(_0x1244('0x5'));var config=require(_0x1244('0x6'));var attributes=require('./analyticDefaultReport.attributes');module[_0x1244('0x7')]=function(_0x1c19a3,_0x46c71b){return _0x1c19a3[_0x1244('0x8')](_0x1244('0x9'),attributes,{'tableName':_0x1244('0xa'),'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 f4b9bee..b081245 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 _0x27b6=['../../mysqldb','../../config/utils','../../config/logger','rpc','http','request','AnalyticDefaultReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticDefaultReport,\x20%s,\x20%s,\x20%s','error','code','message','info','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x3a3f77,_0x400a0a){var _0x24e317=function(_0x2b4af6){while(--_0x2b4af6){_0x3a3f77['push'](_0x3a3f77['shift']());}};_0x24e317(++_0x400a0a);}(_0x27b6,0x14e));var _0x627b=function(_0xe2d561,_0x12ff21){_0xe2d561=_0xe2d561-0x0;var _0x26a70f=_0x27b6[_0xe2d561];return _0x26a70f;};'use strict';var _=require(_0x627b('0x0'));var util=require(_0x627b('0x1'));var moment=require(_0x627b('0x2'));var BPromise=require(_0x627b('0x3'));var rs=require(_0x627b('0x4'));var fs=require('fs');var Redis=require(_0x627b('0x5'));var db=require(_0x627b('0x6'))['db'];var utils=require(_0x627b('0x7'));var logger=require(_0x627b('0x8'))(_0x627b('0x9'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x627b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4b6039,_0x613927,_0x452473){return new BPromise(function(_0x30de20,_0x26e466){return client[_0x627b('0xb')](_0x4b6039,_0x452473)['then'](function(_0x240da8){logger['info'](_0x627b('0xc'),_0x613927,_0x627b('0xd'));logger[_0x627b('0xe')](_0x627b('0xf'),_0x613927,_0x627b('0xd'),JSON['stringify'](_0x240da8));if(_0x240da8[_0x627b('0x10')]){if(_0x240da8['error'][_0x627b('0x11')]===0x1f4){logger[_0x627b('0x10')](_0x627b('0xc'),_0x613927,_0x240da8[_0x627b('0x10')][_0x627b('0x12')]);return _0x26e466(_0x240da8[_0x627b('0x10')][_0x627b('0x12')]);}logger['error']('AnalyticDefaultReport,\x20%s,\x20%s',_0x613927,_0x240da8[_0x627b('0x10')]['message']);return _0x30de20(_0x240da8['error'][_0x627b('0x12')]);}else{logger[_0x627b('0x13')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x613927,'request\x20sent');_0x30de20(_0x240da8['result'][_0x627b('0x12')]);}})['catch'](function(_0x2d93f6){logger[_0x627b('0x10')](_0x627b('0xc'),_0x613927,_0x2d93f6);_0x26e466(_0x2d93f6);});});} \ No newline at end of file +var _0xa9f2=['code','message','AnalyticDefaultReport,\x20%s,\x20%s','result','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','debug','AnalyticDefaultReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x2e18a9,_0x2ae8c2){var _0x39d8d7=function(_0x4729ef){while(--_0x4729ef){_0x2e18a9['push'](_0x2e18a9['shift']());}};_0x39d8d7(++_0x2ae8c2);}(_0xa9f2,0x10c));var _0x2a9f=function(_0x5b2ae5,_0x1c24d9){_0x5b2ae5=_0x5b2ae5-0x0;var _0x5d5216=_0xa9f2[_0x5b2ae5];return _0x5d5216;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x2a9f('0x0'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2a9f('0x1'));var db=require(_0x2a9f('0x2'))['db'];var utils=require(_0x2a9f('0x3'));var logger=require(_0x2a9f('0x4'))(_0x2a9f('0x5'));var config=require(_0x2a9f('0x6'));var jayson=require(_0x2a9f('0x7'));var client=jayson[_0x2a9f('0x8')][_0x2a9f('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x24f399,_0xa555e3,_0x257602){return new BPromise(function(_0x518504,_0x5d1505){return client[_0x2a9f('0xa')](_0x24f399,_0x257602)[_0x2a9f('0xb')](function(_0x15253f){logger[_0x2a9f('0xc')]('AnalyticDefaultReport,\x20%s,\x20%s',_0xa555e3,'request\x20sent');logger[_0x2a9f('0xd')](_0x2a9f('0xe'),_0xa555e3,_0x2a9f('0xf'),JSON[_0x2a9f('0x10')](_0x15253f));if(_0x15253f['error']){if(_0x15253f[_0x2a9f('0x11')][_0x2a9f('0x12')]===0x1f4){logger[_0x2a9f('0x11')]('AnalyticDefaultReport,\x20%s,\x20%s',_0xa555e3,_0x15253f[_0x2a9f('0x11')][_0x2a9f('0x13')]);return _0x5d1505(_0x15253f[_0x2a9f('0x11')][_0x2a9f('0x13')]);}logger['error']('AnalyticDefaultReport,\x20%s,\x20%s',_0xa555e3,_0x15253f[_0x2a9f('0x11')][_0x2a9f('0x13')]);return _0x518504(_0x15253f['error']['message']);}else{logger[_0x2a9f('0xc')](_0x2a9f('0x14'),_0xa555e3,_0x2a9f('0xf'));_0x518504(_0x15253f[_0x2a9f('0x15')][_0x2a9f('0x13')]);}})['catch'](function(_0x29c10b){logger[_0x2a9f('0x11')](_0x2a9f('0x14'),_0xa555e3,_0x29c10b);_0x5d1505(_0x29c10b);});});} \ No newline at end of file diff --git a/server/api/analyticDefaultReport/index.js b/server/api/analyticDefaultReport/index.js index 3c0b618..a2124af 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 _0x708f=['../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/preview','preview','/:id/run','/:id/query','post','create','put','update','destroy','exports','connect-timeout','express'];(function(_0x2d3992,_0x1e6690){var _0x119bd7=function(_0x3065dd){while(--_0x3065dd){_0x2d3992['push'](_0x2d3992['shift']());}};_0x119bd7(++_0x1e6690);}(_0x708f,0x11b));var _0xf708=function(_0x100eb2,_0x283b3c){_0x100eb2=_0x100eb2-0x0;var _0xeff6c=_0x708f[_0x100eb2];return _0xeff6c;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0xf708('0x0'));var express=require(_0xf708('0x1'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xf708('0x2'));var config=require(_0xf708('0x3'));var controller=require('./analyticDefaultReport.controller');router[_0xf708('0x4')]('/',auth[_0xf708('0x5')](),controller[_0xf708('0x6')]);router[_0xf708('0x4')](_0xf708('0x7'),auth[_0xf708('0x5')](),controller[_0xf708('0x8')]);router[_0xf708('0x4')](_0xf708('0x9'),auth[_0xf708('0x5')](),controller[_0xf708('0xa')]);router[_0xf708('0x4')](_0xf708('0xb'),auth[_0xf708('0x5')](),controller['run']);router[_0xf708('0x4')](_0xf708('0xc'),auth[_0xf708('0x5')](),controller['query']);router[_0xf708('0xd')]('/',auth[_0xf708('0x5')](),controller[_0xf708('0xe')]);router[_0xf708('0xf')](_0xf708('0x7'),auth[_0xf708('0x5')](),controller[_0xf708('0x10')]);router['delete'](_0xf708('0x7'),auth[_0xf708('0x5')](),controller[_0xf708('0x11')]);module[_0xf708('0x12')]=router; \ No newline at end of file +var _0x5c7b=['create','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticDefaultReport.controller','get','isAuthenticated','/:id','show','preview','run','/:id/query','query','post'];(function(_0x4c34c6,_0x1240d6){var _0x2f0192=function(_0x1ea197){while(--_0x1ea197){_0x4c34c6['push'](_0x4c34c6['shift']());}};_0x2f0192(++_0x1240d6);}(_0x5c7b,0x9c));var _0xb5c7=function(_0x1d24eb,_0x12295b){_0x1d24eb=_0x1d24eb-0x0;var _0x1dc576=_0x5c7b[_0x1d24eb];return _0x1dc576;};'use strict';var multer=require('multer');var util=require(_0xb5c7('0x0'));var path=require(_0xb5c7('0x1'));var timeout=require(_0xb5c7('0x2'));var express=require(_0xb5c7('0x3'));var router=express[_0xb5c7('0x4')]();var fs_extra=require(_0xb5c7('0x5'));var auth=require(_0xb5c7('0x6'));var interaction=require(_0xb5c7('0x7'));var config=require(_0xb5c7('0x8'));var controller=require(_0xb5c7('0x9'));router[_0xb5c7('0xa')]('/',auth[_0xb5c7('0xb')](),controller['index']);router[_0xb5c7('0xa')](_0xb5c7('0xc'),auth['isAuthenticated'](),controller[_0xb5c7('0xd')]);router[_0xb5c7('0xa')]('/:id/preview',auth['isAuthenticated'](),controller[_0xb5c7('0xe')]);router[_0xb5c7('0xa')]('/:id/run',auth[_0xb5c7('0xb')](),controller[_0xb5c7('0xf')]);router[_0xb5c7('0xa')](_0xb5c7('0x10'),auth['isAuthenticated'](),controller[_0xb5c7('0x11')]);router[_0xb5c7('0x12')]('/',auth[_0xb5c7('0xb')](),controller[_0xb5c7('0x13')]);router[_0xb5c7('0x14')](_0xb5c7('0xc'),auth['isAuthenticated'](),controller[_0xb5c7('0x15')]);router[_0xb5c7('0x16')](_0xb5c7('0xc'),auth[_0xb5c7('0xb')](),controller[_0xb5c7('0x17')]);module[_0xb5c7('0x18')]=router; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js b/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js index 16620d2..71e8c57 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 _0x58d1=['ENUM','pdf','xlsx','DATE','Loading','scheduled','manual','INTEGER','sequelize','moment','exports','STRING'];(function(_0x541a67,_0x50728d){var _0x45da2a=function(_0x158929){while(--_0x158929){_0x541a67['push'](_0x541a67['shift']());}};_0x45da2a(++_0x50728d);}(_0x58d1,0xa4));var _0x158d=function(_0x2a2166,_0x3a077f){_0x2a2166=_0x2a2166-0x0;var _0x3bcf50=_0x58d1[_0x2a2166];return _0x3bcf50;};'use strict';var Sequelize=require(_0x158d('0x0'));var moment=require(_0x158d('0x1'));module[_0x158d('0x2')]={'name':{'type':Sequelize[_0x158d('0x3')],'allowNull':![]},'basename':{'type':Sequelize[_0x158d('0x3')],'allowNull':![]},'output':{'type':Sequelize[_0x158d('0x4')]('csv',_0x158d('0x5'),_0x158d('0x6')),'allowNull':![],'defaultValue':'csv'},'savename':{'type':Sequelize[_0x158d('0x3')],'allowNull':![]},'startDate':{'type':Sequelize['DATE']},'endDate':{'type':Sequelize[_0x158d('0x7')]},'status':{'type':Sequelize[_0x158d('0x3')],'defaultValue':_0x158d('0x8')},'type':{'type':Sequelize[_0x158d('0x4')]('manual',_0x158d('0x9')),'allowNull':![],'defaultValue':_0x158d('0xa')},'reportId':{'type':Sequelize[_0x158d('0xb')](0xb)['UNSIGNED']},'reportType':{'type':Sequelize[_0x158d('0x3')]}}; \ No newline at end of file +var _0x51d9=['xlsx','DATE','manual','scheduled','INTEGER','UNSIGNED','sequelize','exports','STRING','ENUM','csv'];(function(_0x531ba8,_0x54f49b){var _0x5e9a15=function(_0x22534c){while(--_0x22534c){_0x531ba8['push'](_0x531ba8['shift']());}};_0x5e9a15(++_0x54f49b);}(_0x51d9,0x145));var _0x951d=function(_0x4632ea,_0x10082c){_0x4632ea=_0x4632ea-0x0;var _0x368f3c=_0x51d9[_0x4632ea];return _0x368f3c;};'use strict';var Sequelize=require(_0x951d('0x0'));var moment=require('moment');module[_0x951d('0x1')]={'name':{'type':Sequelize[_0x951d('0x2')],'allowNull':![]},'basename':{'type':Sequelize[_0x951d('0x2')],'allowNull':![]},'output':{'type':Sequelize[_0x951d('0x3')](_0x951d('0x4'),'pdf',_0x951d('0x5')),'allowNull':![],'defaultValue':'csv'},'savename':{'type':Sequelize[_0x951d('0x2')],'allowNull':![]},'startDate':{'type':Sequelize[_0x951d('0x6')]},'endDate':{'type':Sequelize[_0x951d('0x6')]},'status':{'type':Sequelize[_0x951d('0x2')],'defaultValue':'Loading'},'type':{'type':Sequelize['ENUM'](_0x951d('0x7'),_0x951d('0x8')),'allowNull':![],'defaultValue':_0x951d('0x7')},'reportId':{'type':Sequelize[_0x951d('0x9')](0xb)[_0x951d('0xa')]},'reportType':{'type':Sequelize[_0x951d('0x2')]}}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.controller.js b/server/api/analyticExtractedReport/analyticExtractedReport.controller.js index 824c63e..e7a1d23 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 _0x5b14=['join','server/files/reports','Sequelize','ValidationError','Report\x20not\x20found\x20or\x20empty','exists','format','%s.%s','basename','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','undefined','offset','limit','apply','reject','update','then','destroy','get','ExtractedReports','UserProfileResource','error','name','send','index','map','AnalyticExtractedReport','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','count','includeAll','include','findAll','rows','catch','params','attributes','find','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','download','savename','output'];(function(_0x1a219d,_0x405933){var _0x5f133b=function(_0x3ccf2a){while(--_0x3ccf2a){_0x1a219d['push'](_0x1a219d['shift']());}};_0x5f133b(++_0x405933);}(_0x5b14,0x189));var _0x45b1=function(_0x1a36a5,_0x746928){_0x1a36a5=_0x1a36a5-0x0;var _0x746243=_0x5b14[_0x1a36a5];return _0x746243;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x45b1('0x0'));var zipdir=require(_0x45b1('0x1'));var jsonpatch=require(_0x45b1('0x2'));var rp=require(_0x45b1('0x3'));var moment=require(_0x45b1('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x45b1('0x5'));var util=require(_0x45b1('0x6'));var path=require('path');var sox=require(_0x45b1('0x7'));var csv=require(_0x45b1('0x8'));var ejs=require(_0x45b1('0x9'));var fs=require('fs');var fs_extra=require(_0x45b1('0xa'));var _=require(_0x45b1('0xb'));var squel=require(_0x45b1('0xc'));var crypto=require(_0x45b1('0xd'));var jsforce=require(_0x45b1('0xe'));var deskjs=require(_0x45b1('0xf'));var toCsv=require(_0x45b1('0x8'));var querystring=require(_0x45b1('0x10'));var Papa=require(_0x45b1('0x11'));var Redis=require('ioredis');var authService=require(_0x45b1('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x45b1('0x13'));var hardwareService=require(_0x45b1('0x14'));var logger=require(_0x45b1('0x15'))(_0x45b1('0x16'));var utils=require(_0x45b1('0x17'));var config=require(_0x45b1('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x45b1('0x19'))['db'];function respondWithStatusCode(_0x5114f4,_0x4e9071){_0x4e9071=_0x4e9071||0xcc;return function(_0xcd2bc3){if(_0xcd2bc3){return _0x5114f4[_0x45b1('0x1a')](_0x4e9071);}return _0x5114f4['status'](_0x4e9071)[_0x45b1('0x1b')]();};}function respondWithResult(_0x4d10be,_0x5e2f09){_0x5e2f09=_0x5e2f09||0xc8;return function(_0x43d45d){if(_0x43d45d){return _0x4d10be[_0x45b1('0x1c')](_0x5e2f09)[_0x45b1('0x1d')](_0x43d45d);}};}function respondWithFilteredResult(_0x2ab775,_0x31ba7a){return function(_0x2f4b59){if(_0x2f4b59){var _0x18e62d=typeof _0x31ba7a['offset']===_0x45b1('0x1e')&&typeof _0x31ba7a['limit']===_0x45b1('0x1e');var _0x340b7d=_0x2f4b59['count'];var _0x51c780=_0x18e62d?0x0:_0x31ba7a[_0x45b1('0x1f')];var _0x30ca39=_0x18e62d?_0x2f4b59['count']:_0x31ba7a[_0x45b1('0x1f')]+_0x31ba7a[_0x45b1('0x20')];var _0x42c926;if(_0x30ca39>=_0x340b7d){_0x30ca39=_0x340b7d;_0x42c926=0xc8;}else{_0x42c926=0xce;}_0x2ab775[_0x45b1('0x1c')](_0x42c926);return _0x2ab775['set']('Content-Range',_0x51c780+'-'+_0x30ca39+'/'+_0x340b7d)['json'](_0x2f4b59);}return null;};}function patchUpdates(_0x1b8026){return function(_0xadb006){try{jsonpatch[_0x45b1('0x21')](_0xadb006,_0x1b8026,!![]);}catch(_0x541211){return BPromise[_0x45b1('0x22')](_0x541211);}return _0xadb006['save']();};}function saveUpdates(_0x45d5b8,_0x44476b){return function(_0x108870){if(_0x108870){return _0x108870[_0x45b1('0x23')](_0x45d5b8)[_0x45b1('0x24')](function(_0x5929ab){return _0x5929ab;});}return null;};}function removeEntity(_0x4df9a5,_0x2a66d7){return function(_0x1b6024){if(_0x1b6024){return _0x1b6024[_0x45b1('0x25')]()[_0x45b1('0x24')](function(){var _0xee9ac1=_0x1b6024[_0x45b1('0x26')]({'plain':!![]});var _0x1891f7=_0x45b1('0x27');return db[_0x45b1('0x28')]['destroy']({'where':{'type':_0x1891f7,'resourceId':_0xee9ac1['id']}})[_0x45b1('0x24')](function(){return _0x1b6024;});})[_0x45b1('0x24')](function(){_0x4df9a5[_0x45b1('0x1c')](0xcc)[_0x45b1('0x1b')]();});}};}function handleEntityNotFound(_0x4e8183,_0x3ff469){return function(_0xe1cf5a){if(!_0xe1cf5a){_0x4e8183[_0x45b1('0x1a')](0x194);}return _0xe1cf5a;};}function handleError(_0x3245c2,_0x3492f8){_0x3492f8=_0x3492f8||0x1f4;return function(_0x352d76){logger[_0x45b1('0x29')](_0x352d76['stack']);if(_0x352d76[_0x45b1('0x2a')]){delete _0x352d76['name'];}_0x3245c2[_0x45b1('0x1c')](_0x3492f8)[_0x45b1('0x2b')](_0x352d76);};}exports[_0x45b1('0x2c')]=function(_0x125fe3,_0x2fb263){var _0xb4d4e1={},_0x51d721={},_0x56a5f5={'count':0x0,'rows':[]};var _0x5b0a55=_[_0x45b1('0x2d')](db[_0x45b1('0x2e')][_0x45b1('0x2f')],function(_0x3a8780){return{'name':_0x3a8780[_0x45b1('0x30')],'type':_0x3a8780[_0x45b1('0x31')][_0x45b1('0x32')]};});_0x51d721[_0x45b1('0x33')]=_[_0x45b1('0x2d')](_0x5b0a55,_0x45b1('0x2a'));_0x51d721['query']=_[_0x45b1('0x34')](_0x125fe3[_0x45b1('0x35')]);_0x51d721[_0x45b1('0x36')]=_[_0x45b1('0x37')](_0x51d721[_0x45b1('0x33')],_0x51d721[_0x45b1('0x35')]);_0xb4d4e1['attributes']=_[_0x45b1('0x37')](_0x51d721[_0x45b1('0x33')],qs['fields'](_0x125fe3['query'][_0x45b1('0x38')]));_0xb4d4e1['attributes']=_0xb4d4e1['attributes'][_0x45b1('0x39')]?_0xb4d4e1['attributes']:_0x51d721['model'];if(!_0x125fe3[_0x45b1('0x35')][_0x45b1('0x3a')](_0x45b1('0x3b'))){_0xb4d4e1['limit']=qs[_0x45b1('0x20')](_0x125fe3[_0x45b1('0x35')][_0x45b1('0x20')]);_0xb4d4e1[_0x45b1('0x1f')]=qs[_0x45b1('0x1f')](_0x125fe3['query'][_0x45b1('0x1f')]);}_0xb4d4e1[_0x45b1('0x3c')]=qs[_0x45b1('0x3d')](_0x125fe3['query'][_0x45b1('0x3d')]);_0xb4d4e1['where']=qs[_0x45b1('0x36')](_[_0x45b1('0x3e')](_0x125fe3[_0x45b1('0x35')],_0x51d721['filters']),_0x5b0a55);if(_0x125fe3[_0x45b1('0x35')][_0x45b1('0x3f')]){_0xb4d4e1[_0x45b1('0x40')]=_[_0x45b1('0x41')](_0xb4d4e1[_0x45b1('0x40')],{'$or':_[_0x45b1('0x2d')](_0x5b0a55,function(_0x118d38){if(_0x118d38[_0x45b1('0x31')]!==_0x45b1('0x42')){var _0x31bdba={};_0x31bdba[_0x118d38['name']]={'$like':'%'+_0x125fe3[_0x45b1('0x35')][_0x45b1('0x3f')]+'%'};return _0x31bdba;}})});}_0xb4d4e1=_[_0x45b1('0x41')]({},_0xb4d4e1,_0x125fe3[_0x45b1('0x43')]);var _0xdd507d={'where':_0xb4d4e1[_0x45b1('0x40')]};return db[_0x45b1('0x2e')]['count'](_0xdd507d)['then'](function(_0x3f8d1e){_0x56a5f5[_0x45b1('0x44')]=_0x3f8d1e;if(_0x125fe3[_0x45b1('0x35')][_0x45b1('0x45')]){_0xb4d4e1[_0x45b1('0x46')]=[{'all':!![]}];}return db['AnalyticExtractedReport'][_0x45b1('0x47')](_0xb4d4e1);})['then'](function(_0x4cd6aa){_0x56a5f5[_0x45b1('0x48')]=_0x4cd6aa;return _0x56a5f5;})['then'](respondWithFilteredResult(_0x2fb263,_0xb4d4e1))[_0x45b1('0x49')](handleError(_0x2fb263,null));};exports['show']=function(_0x57f16e,_0x331a46){var _0x50862c={'raw':!![],'where':{'id':_0x57f16e[_0x45b1('0x4a')]['id']}},_0x22017f={};_0x22017f['model']=_[_0x45b1('0x34')](db['AnalyticExtractedReport'][_0x45b1('0x2f')]);_0x22017f['query']=_['keys'](_0x57f16e[_0x45b1('0x35')]);_0x22017f['filters']=_[_0x45b1('0x37')](_0x22017f[_0x45b1('0x33')],_0x22017f['query']);_0x50862c[_0x45b1('0x4b')]=_[_0x45b1('0x37')](_0x22017f[_0x45b1('0x33')],qs[_0x45b1('0x38')](_0x57f16e[_0x45b1('0x35')][_0x45b1('0x38')]));_0x50862c[_0x45b1('0x4b')]=_0x50862c[_0x45b1('0x4b')][_0x45b1('0x39')]?_0x50862c[_0x45b1('0x4b')]:_0x22017f[_0x45b1('0x33')];if(_0x57f16e['query'][_0x45b1('0x45')]){_0x50862c[_0x45b1('0x46')]=[{'all':!![]}];}_0x50862c=_['merge']({},_0x50862c,_0x57f16e[_0x45b1('0x43')]);return db[_0x45b1('0x2e')][_0x45b1('0x4c')](_0x50862c)[_0x45b1('0x24')](handleEntityNotFound(_0x331a46,null))[_0x45b1('0x24')](respondWithResult(_0x331a46,null))[_0x45b1('0x49')](handleError(_0x331a46,null));};exports['create']=function(_0x3ad930,_0x2d4126){return db[_0x45b1('0x2e')]['create'](_0x3ad930[_0x45b1('0x4d')],{})[_0x45b1('0x24')](function(_0x17f37c){var _0x5cfbb4=_0x3ad930[_0x45b1('0x4e')][_0x45b1('0x26')]({'plain':!![]});if(!_0x5cfbb4)throw new Error(_0x45b1('0x4f'));if(_0x5cfbb4['role']===_0x45b1('0x4e')){var _0x59fbbe=_0x17f37c['get']({'plain':!![]});var _0x764ae6=_0x45b1('0x27');return db['UserProfileSection'][_0x45b1('0x4c')]({'where':{'name':_0x764ae6,'userProfileId':_0x5cfbb4[_0x45b1('0x50')]},'raw':!![]})[_0x45b1('0x24')](function(_0x464f22){if(_0x464f22&&_0x464f22[_0x45b1('0x51')]===0x0){return db[_0x45b1('0x28')][_0x45b1('0x52')]({'name':_0x59fbbe[_0x45b1('0x2a')],'resourceId':_0x59fbbe['id'],'type':_0x464f22[_0x45b1('0x2a')],'sectionId':_0x464f22['id']},{})[_0x45b1('0x24')](function(){return _0x17f37c;});}else{return _0x17f37c;}})[_0x45b1('0x49')](function(_0x3a182b){logger[_0x45b1('0x29')](_0x45b1('0x53'),_0x3a182b);throw _0x3a182b;});}return _0x17f37c;})['then'](respondWithResult(_0x2d4126,0xc9))[_0x45b1('0x49')](handleError(_0x2d4126,null));};exports['update']=function(_0x4b0ea7,_0x35a64f){if(_0x4b0ea7['body']['id']){delete _0x4b0ea7[_0x45b1('0x4d')]['id'];}return db['AnalyticExtractedReport'][_0x45b1('0x4c')]({'where':{'id':_0x4b0ea7[_0x45b1('0x4a')]['id']}})[_0x45b1('0x24')](handleEntityNotFound(_0x35a64f,null))[_0x45b1('0x24')](saveUpdates(_0x4b0ea7[_0x45b1('0x4d')],null))[_0x45b1('0x24')](respondWithResult(_0x35a64f,null))[_0x45b1('0x49')](handleError(_0x35a64f,null));};exports[_0x45b1('0x25')]=function(_0x2a51e7,_0x5c5285){return db[_0x45b1('0x2e')]['find']({'where':{'id':_0x2a51e7[_0x45b1('0x4a')]['id']}})[_0x45b1('0x24')](handleEntityNotFound(_0x5c5285,null))['then'](removeEntity(_0x5c5285,null))[_0x45b1('0x49')](handleError(_0x5c5285,null));};exports[_0x45b1('0x54')]=function(_0xc87e18,_0x5ea8f9,_0x5e0cb0){return db['AnalyticExtractedReport'][_0x45b1('0x4c')]({'where':{'id':_0xc87e18['params']['id']},'attributes':[_0x45b1('0x2a'),'basename',_0x45b1('0x55'),_0x45b1('0x56')],'raw':!![]})['then'](handleEntityNotFound(_0x5ea8f9,null))[_0x45b1('0x24')](function(_0x1a9f2d){if(_0x1a9f2d){if(!fs['existsSync'](path[_0x45b1('0x57')](config['root'],_0x45b1('0x58'),_0x1a9f2d[_0x45b1('0x55')]))){throw new db[(_0x45b1('0x59'))][(_0x45b1('0x5a'))](_0x45b1('0x5b'));}if(_0xc87e18[_0x45b1('0x35')][_0x45b1('0x5c')]){return _0x5ea8f9[_0x45b1('0x1a')](0xc8);}return _0x5ea8f9[_0x45b1('0x54')](path['join'](config['root'],'server/files/reports',_0x1a9f2d[_0x45b1('0x55')]),util[_0x45b1('0x5d')](_0x45b1('0x5e'),_0x1a9f2d[_0x45b1('0x5f')]||_0x1a9f2d[_0x45b1('0x2a')],_0x1a9f2d[_0x45b1('0x56')]['toLowerCase']()));}})[_0x45b1('0x49')](handleError(_0x5ea8f9,null));}; \ No newline at end of file +var _0xeba1=['role','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','download','basename','existsSync','join','server/files/reports','savename','Sequelize','Report\x20not\x20found\x20or\x20empty','exists','root','output','toLowerCase','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','sendStatus','end','status','offset','undefined','count','limit','set','Content-Range','json','apply','reject','save','then','destroy','ExtractedReports','UserProfileResource','error','stack','name','send','index','map','AnalyticExtractedReport','fieldName','type','key','model','query','filters','intersection','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','params','keys','rawAttributes','fields','length','find','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user'];(function(_0x167307,_0x5a60ae){var _0x550140=function(_0x5b5009){while(--_0x5b5009){_0x167307['push'](_0x167307['shift']());}};_0x550140(++_0x5a60ae);}(_0xeba1,0x13c));var _0x1eba=function(_0x192ec3,_0x1d17ef){_0x192ec3=_0x192ec3-0x0;var _0x852295=_0xeba1[_0x192ec3];return _0x852295;};'use strict';var emlformat=require(_0x1eba('0x0'));var rimraf=require(_0x1eba('0x1'));var zipdir=require(_0x1eba('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x1eba('0x3'));var moment=require(_0x1eba('0x4'));var BPromise=require(_0x1eba('0x5'));var Mustache=require('mustache');var util=require(_0x1eba('0x6'));var path=require(_0x1eba('0x7'));var sox=require(_0x1eba('0x8'));var csv=require(_0x1eba('0x9'));var ejs=require(_0x1eba('0xa'));var fs=require('fs');var fs_extra=require(_0x1eba('0xb'));var _=require('lodash');var squel=require(_0x1eba('0xc'));var crypto=require(_0x1eba('0xd'));var jsforce=require(_0x1eba('0xe'));var deskjs=require(_0x1eba('0xf'));var toCsv=require(_0x1eba('0x9'));var querystring=require(_0x1eba('0x10'));var Papa=require('papaparse');var Redis=require(_0x1eba('0x11'));var authService=require(_0x1eba('0x12'));var qs=require(_0x1eba('0x13'));var as=require(_0x1eba('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x1eba('0x15'))('api');var utils=require(_0x1eba('0x16'));var config=require(_0x1eba('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2934e9,_0x1437f2){_0x1437f2=_0x1437f2||0xcc;return function(_0x469216){if(_0x469216){return _0x2934e9[_0x1eba('0x18')](_0x1437f2);}return _0x2934e9['status'](_0x1437f2)[_0x1eba('0x19')]();};}function respondWithResult(_0x2bcd55,_0x5cedbe){_0x5cedbe=_0x5cedbe||0xc8;return function(_0x3af96c){if(_0x3af96c){return _0x2bcd55[_0x1eba('0x1a')](_0x5cedbe)['json'](_0x3af96c);}};}function respondWithFilteredResult(_0x31ab5b,_0x2200ae){return function(_0x13c100){if(_0x13c100){var _0x58252a=typeof _0x2200ae[_0x1eba('0x1b')]===_0x1eba('0x1c')&&typeof _0x2200ae['limit']===_0x1eba('0x1c');var _0x588525=_0x13c100[_0x1eba('0x1d')];var _0x45e6ce=_0x58252a?0x0:_0x2200ae[_0x1eba('0x1b')];var _0x41115c=_0x58252a?_0x13c100[_0x1eba('0x1d')]:_0x2200ae[_0x1eba('0x1b')]+_0x2200ae[_0x1eba('0x1e')];var _0x46b125;if(_0x41115c>=_0x588525){_0x41115c=_0x588525;_0x46b125=0xc8;}else{_0x46b125=0xce;}_0x31ab5b['status'](_0x46b125);return _0x31ab5b[_0x1eba('0x1f')](_0x1eba('0x20'),_0x45e6ce+'-'+_0x41115c+'/'+_0x588525)[_0x1eba('0x21')](_0x13c100);}return null;};}function patchUpdates(_0x463842){return function(_0x14132c){try{jsonpatch[_0x1eba('0x22')](_0x14132c,_0x463842,!![]);}catch(_0x4f5374){return BPromise[_0x1eba('0x23')](_0x4f5374);}return _0x14132c[_0x1eba('0x24')]();};}function saveUpdates(_0x544418,_0x3393d7){return function(_0x15ca86){if(_0x15ca86){return _0x15ca86['update'](_0x544418)[_0x1eba('0x25')](function(_0x157cce){return _0x157cce;});}return null;};}function removeEntity(_0x1a77d0,_0x132577){return function(_0x330bdf){if(_0x330bdf){return _0x330bdf[_0x1eba('0x26')]()['then'](function(){var _0x5d18bb=_0x330bdf['get']({'plain':!![]});var _0x1aaba1=_0x1eba('0x27');return db[_0x1eba('0x28')][_0x1eba('0x26')]({'where':{'type':_0x1aaba1,'resourceId':_0x5d18bb['id']}})[_0x1eba('0x25')](function(){return _0x330bdf;});})['then'](function(){_0x1a77d0['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x5ebc77,_0x12262b){return function(_0x1d393b){if(!_0x1d393b){_0x5ebc77[_0x1eba('0x18')](0x194);}return _0x1d393b;};}function handleError(_0x24459d,_0x27dfaa){_0x27dfaa=_0x27dfaa||0x1f4;return function(_0x2bd39f){logger[_0x1eba('0x29')](_0x2bd39f[_0x1eba('0x2a')]);if(_0x2bd39f[_0x1eba('0x2b')]){delete _0x2bd39f[_0x1eba('0x2b')];}_0x24459d[_0x1eba('0x1a')](_0x27dfaa)[_0x1eba('0x2c')](_0x2bd39f);};}exports[_0x1eba('0x2d')]=function(_0x3e452b,_0x3b9c9f){var _0x247aa2={},_0xdad81c={},_0x1a373d={'count':0x0,'rows':[]};var _0x43f06f=_[_0x1eba('0x2e')](db[_0x1eba('0x2f')]['rawAttributes'],function(_0x5b1608){return{'name':_0x5b1608[_0x1eba('0x30')],'type':_0x5b1608[_0x1eba('0x31')][_0x1eba('0x32')]};});_0xdad81c[_0x1eba('0x33')]=_[_0x1eba('0x2e')](_0x43f06f,_0x1eba('0x2b'));_0xdad81c[_0x1eba('0x34')]=_['keys'](_0x3e452b[_0x1eba('0x34')]);_0xdad81c[_0x1eba('0x35')]=_[_0x1eba('0x36')](_0xdad81c[_0x1eba('0x33')],_0xdad81c[_0x1eba('0x34')]);_0x247aa2['attributes']=_[_0x1eba('0x36')](_0xdad81c[_0x1eba('0x33')],qs['fields'](_0x3e452b[_0x1eba('0x34')]['fields']));_0x247aa2[_0x1eba('0x37')]=_0x247aa2['attributes']['length']?_0x247aa2[_0x1eba('0x37')]:_0xdad81c[_0x1eba('0x33')];if(!_0x3e452b['query'][_0x1eba('0x38')](_0x1eba('0x39'))){_0x247aa2['limit']=qs[_0x1eba('0x1e')](_0x3e452b[_0x1eba('0x34')][_0x1eba('0x1e')]);_0x247aa2[_0x1eba('0x1b')]=qs[_0x1eba('0x1b')](_0x3e452b[_0x1eba('0x34')]['offset']);}_0x247aa2[_0x1eba('0x3a')]=qs['sort'](_0x3e452b[_0x1eba('0x34')][_0x1eba('0x3b')]);_0x247aa2[_0x1eba('0x3c')]=qs[_0x1eba('0x35')](_[_0x1eba('0x3d')](_0x3e452b[_0x1eba('0x34')],_0xdad81c[_0x1eba('0x35')]),_0x43f06f);if(_0x3e452b['query'][_0x1eba('0x3e')]){_0x247aa2[_0x1eba('0x3c')]=_[_0x1eba('0x3f')](_0x247aa2[_0x1eba('0x3c')],{'$or':_[_0x1eba('0x2e')](_0x43f06f,function(_0x7d0860){if(_0x7d0860['type']!==_0x1eba('0x40')){var _0x1bf926={};_0x1bf926[_0x7d0860[_0x1eba('0x2b')]]={'$like':'%'+_0x3e452b[_0x1eba('0x34')][_0x1eba('0x3e')]+'%'};return _0x1bf926;}})});}_0x247aa2=_[_0x1eba('0x3f')]({},_0x247aa2,_0x3e452b[_0x1eba('0x41')]);var _0x11b32a={'where':_0x247aa2[_0x1eba('0x3c')]};return db[_0x1eba('0x2f')][_0x1eba('0x1d')](_0x11b32a)[_0x1eba('0x25')](function(_0x25c179){_0x1a373d[_0x1eba('0x1d')]=_0x25c179;if(_0x3e452b[_0x1eba('0x34')][_0x1eba('0x42')]){_0x247aa2[_0x1eba('0x43')]=[{'all':!![]}];}return db[_0x1eba('0x2f')][_0x1eba('0x44')](_0x247aa2);})[_0x1eba('0x25')](function(_0x1a35b2){_0x1a373d['rows']=_0x1a35b2;return _0x1a373d;})[_0x1eba('0x25')](respondWithFilteredResult(_0x3b9c9f,_0x247aa2))[_0x1eba('0x45')](handleError(_0x3b9c9f,null));};exports['show']=function(_0x1d8e05,_0x5abb60){var _0x284b0e={'raw':!![],'where':{'id':_0x1d8e05[_0x1eba('0x46')]['id']}},_0x2f1b75={};_0x2f1b75[_0x1eba('0x33')]=_[_0x1eba('0x47')](db[_0x1eba('0x2f')][_0x1eba('0x48')]);_0x2f1b75['query']=_['keys'](_0x1d8e05[_0x1eba('0x34')]);_0x2f1b75[_0x1eba('0x35')]=_['intersection'](_0x2f1b75[_0x1eba('0x33')],_0x2f1b75[_0x1eba('0x34')]);_0x284b0e['attributes']=_['intersection'](_0x2f1b75['model'],qs[_0x1eba('0x49')](_0x1d8e05['query']['fields']));_0x284b0e[_0x1eba('0x37')]=_0x284b0e['attributes'][_0x1eba('0x4a')]?_0x284b0e['attributes']:_0x2f1b75['model'];if(_0x1d8e05['query'][_0x1eba('0x42')]){_0x284b0e[_0x1eba('0x43')]=[{'all':!![]}];}_0x284b0e=_[_0x1eba('0x3f')]({},_0x284b0e,_0x1d8e05[_0x1eba('0x41')]);return db[_0x1eba('0x2f')][_0x1eba('0x4b')](_0x284b0e)[_0x1eba('0x25')](handleEntityNotFound(_0x5abb60,null))[_0x1eba('0x25')](respondWithResult(_0x5abb60,null))['catch'](handleError(_0x5abb60,null));};exports['create']=function(_0x53af7c,_0x429cb2){return db[_0x1eba('0x2f')][_0x1eba('0x4c')](_0x53af7c[_0x1eba('0x4d')],{})['then'](function(_0x35052c){var _0x1c461b=_0x53af7c['user'][_0x1eba('0x4e')]({'plain':!![]});if(!_0x1c461b)throw new Error(_0x1eba('0x4f'));if(_0x1c461b[_0x1eba('0x50')]===_0x1eba('0x51')){var _0x2de09a=_0x35052c[_0x1eba('0x4e')]({'plain':!![]});var _0x12ce50=_0x1eba('0x27');return db[_0x1eba('0x52')][_0x1eba('0x4b')]({'where':{'name':_0x12ce50,'userProfileId':_0x1c461b[_0x1eba('0x53')]},'raw':!![]})[_0x1eba('0x25')](function(_0x587917){if(_0x587917&&_0x587917[_0x1eba('0x54')]===0x0){return db[_0x1eba('0x28')][_0x1eba('0x4c')]({'name':_0x2de09a[_0x1eba('0x2b')],'resourceId':_0x2de09a['id'],'type':_0x587917['name'],'sectionId':_0x587917['id']},{})[_0x1eba('0x25')](function(){return _0x35052c;});}else{return _0x35052c;}})['catch'](function(_0x4ca822){logger[_0x1eba('0x29')](_0x1eba('0x55'),_0x4ca822);throw _0x4ca822;});}return _0x35052c;})[_0x1eba('0x25')](respondWithResult(_0x429cb2,0xc9))[_0x1eba('0x45')](handleError(_0x429cb2,null));};exports[_0x1eba('0x56')]=function(_0x5ccc7a,_0x5a6f70){if(_0x5ccc7a[_0x1eba('0x4d')]['id']){delete _0x5ccc7a[_0x1eba('0x4d')]['id'];}return db[_0x1eba('0x2f')][_0x1eba('0x4b')]({'where':{'id':_0x5ccc7a[_0x1eba('0x46')]['id']}})[_0x1eba('0x25')](handleEntityNotFound(_0x5a6f70,null))['then'](saveUpdates(_0x5ccc7a[_0x1eba('0x4d')],null))[_0x1eba('0x25')](respondWithResult(_0x5a6f70,null))[_0x1eba('0x45')](handleError(_0x5a6f70,null));};exports['destroy']=function(_0x3ecddd,_0x3d6d3d){return db[_0x1eba('0x2f')][_0x1eba('0x4b')]({'where':{'id':_0x3ecddd[_0x1eba('0x46')]['id']}})[_0x1eba('0x25')](handleEntityNotFound(_0x3d6d3d,null))[_0x1eba('0x25')](removeEntity(_0x3d6d3d,null))[_0x1eba('0x45')](handleError(_0x3d6d3d,null));};exports[_0x1eba('0x57')]=function(_0x3fca1b,_0x425ff1,_0x3b29b0){return db[_0x1eba('0x2f')][_0x1eba('0x4b')]({'where':{'id':_0x3fca1b[_0x1eba('0x46')]['id']},'attributes':[_0x1eba('0x2b'),_0x1eba('0x58'),'savename','output'],'raw':!![]})[_0x1eba('0x25')](handleEntityNotFound(_0x425ff1,null))[_0x1eba('0x25')](function(_0x45896d){if(_0x45896d){if(!fs[_0x1eba('0x59')](path[_0x1eba('0x5a')](config['root'],_0x1eba('0x5b'),_0x45896d[_0x1eba('0x5c')]))){throw new db[(_0x1eba('0x5d'))]['ValidationError'](_0x1eba('0x5e'));}if(_0x3fca1b[_0x1eba('0x34')][_0x1eba('0x5f')]){return _0x425ff1[_0x1eba('0x18')](0xc8);}return _0x425ff1[_0x1eba('0x57')](path['join'](config[_0x1eba('0x60')],_0x1eba('0x5b'),_0x45896d[_0x1eba('0x5c')]),util['format']('%s.%s',_0x45896d[_0x1eba('0x58')]||_0x45896d['name'],_0x45896d[_0x1eba('0x61')][_0x1eba('0x62')]()));}})[_0x1eba('0x45')](handleError(_0x425ff1,null));}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.model.js b/server/api/analyticExtractedReport/analyticExtractedReport.model.js index 86eee02..02ceccf 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 _0xb318=['moment','bluebird','rimraf','../../config/environment','./analyticExtractedReport.attributes','exports','define','AnalyticExtractedReport','lodash','util','../../config/logger','api'];(function(_0x5eb0d5,_0x5ce667){var _0x58a70d=function(_0x243309){while(--_0x243309){_0x5eb0d5['push'](_0x5eb0d5['shift']());}};_0x58a70d(++_0x5ce667);}(_0xb318,0x80));var _0x8b31=function(_0x5af383,_0x5e0919){_0x5af383=_0x5af383-0x0;var _0x514abf=_0xb318[_0x5af383];return _0x514abf;};'use strict';var _=require(_0x8b31('0x0'));var util=require(_0x8b31('0x1'));var logger=require(_0x8b31('0x2'))(_0x8b31('0x3'));var moment=require(_0x8b31('0x4'));var BPromise=require(_0x8b31('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x8b31('0x6'));var config=require(_0x8b31('0x7'));var attributes=require(_0x8b31('0x8'));module[_0x8b31('0x9')]=function(_0x4b5cff,_0x3637e5){return _0x4b5cff[_0x8b31('0xa')](_0x8b31('0xb'),attributes,{'tableName':'analytics_extracted_reports','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd049=['../../config/environment','./analyticExtractedReport.attributes','exports','define','AnalyticExtractedReport','analytics_extracted_reports','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x2789f0,_0x1bd4e9){var _0x58b8b2=function(_0x48cd16){while(--_0x48cd16){_0x2789f0['push'](_0x2789f0['shift']());}};_0x58b8b2(++_0x1bd4e9);}(_0xd049,0x172));var _0x9d04=function(_0x413feb,_0x10477f){_0x413feb=_0x413feb-0x0;var _0x40ee88=_0xd049[_0x413feb];return _0x40ee88;};'use strict';var _=require(_0x9d04('0x0'));var util=require(_0x9d04('0x1'));var logger=require(_0x9d04('0x2'))(_0x9d04('0x3'));var moment=require(_0x9d04('0x4'));var BPromise=require(_0x9d04('0x5'));var rp=require(_0x9d04('0x6'));var fs=require('fs');var path=require(_0x9d04('0x7'));var rimraf=require('rimraf');var config=require(_0x9d04('0x8'));var attributes=require(_0x9d04('0x9'));module[_0x9d04('0xa')]=function(_0x346d3d,_0x50b4bb){return _0x346d3d[_0x9d04('0xb')](_0x9d04('0xc'),attributes,{'tableName':_0x9d04('0xd'),'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 14af91c..4d56d21 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 _0xc642=['error','AnalyticExtractedReport,\x20%s,\x20%s','message','request\x20sent','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','request','then','info','debug','stringify'];(function(_0x4d8dc3,_0x585fd1){var _0x9b03d9=function(_0x7a31d5){while(--_0x7a31d5){_0x4d8dc3['push'](_0x4d8dc3['shift']());}};_0x9b03d9(++_0x585fd1);}(_0xc642,0x1a7));var _0x2c64=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0xc642[_0x6131cd];return _0x47e916;};'use strict';var _=require(_0x2c64('0x0'));var util=require(_0x2c64('0x1'));var moment=require(_0x2c64('0x2'));var BPromise=require('bluebird');var rs=require(_0x2c64('0x3'));var fs=require('fs');var Redis=require(_0x2c64('0x4'));var db=require(_0x2c64('0x5'))['db'];var utils=require(_0x2c64('0x6'));var logger=require(_0x2c64('0x7'))(_0x2c64('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2dddf7,_0x2f13a9,_0x2a5e6b){return new BPromise(function(_0x879cda,_0xc92e18){return client[_0x2c64('0x9')](_0x2dddf7,_0x2a5e6b)[_0x2c64('0xa')](function(_0x2119f0){logger[_0x2c64('0xb')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x2f13a9,'request\x20sent');logger[_0x2c64('0xc')]('AnalyticExtractedReport,\x20%s,\x20%s,\x20%s',_0x2f13a9,'request\x20sent',JSON[_0x2c64('0xd')](_0x2119f0));if(_0x2119f0['error']){if(_0x2119f0[_0x2c64('0xe')]['code']===0x1f4){logger['error'](_0x2c64('0xf'),_0x2f13a9,_0x2119f0[_0x2c64('0xe')][_0x2c64('0x10')]);return _0xc92e18(_0x2119f0[_0x2c64('0xe')][_0x2c64('0x10')]);}logger[_0x2c64('0xe')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x2f13a9,_0x2119f0['error'][_0x2c64('0x10')]);return _0x879cda(_0x2119f0['error']['message']);}else{logger['info'](_0x2c64('0xf'),_0x2f13a9,_0x2c64('0x11'));_0x879cda(_0x2119f0['result'][_0x2c64('0x10')]);}})[_0x2c64('0x12')](function(_0x566ab5){logger[_0x2c64('0xe')](_0x2c64('0xf'),_0x2f13a9,_0x566ab5);_0xc92e18(_0x566ab5);});});} \ No newline at end of file +var _0x4b39=['AnalyticExtractedReport,\x20%s,\x20%s','message','catch','lodash','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','then','info','request\x20sent','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x8a1634,_0x755249){var _0x51d741=function(_0x2d65eb){while(--_0x2d65eb){_0x8a1634['push'](_0x8a1634['shift']());}};_0x51d741(++_0x755249);}(_0x4b39,0x133));var _0x94b3=function(_0x4503f6,_0x3babaf){_0x4503f6=_0x4503f6-0x0;var _0x2277d1=_0x4b39[_0x4503f6];return _0x2277d1;};'use strict';var _=require(_0x94b3('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x94b3('0x1'));var rs=require(_0x94b3('0x2'));var fs=require('fs');var Redis=require(_0x94b3('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x94b3('0x4'));var logger=require(_0x94b3('0x5'))(_0x94b3('0x6'));var config=require(_0x94b3('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x94b3('0x8')][_0x94b3('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x25daa0,_0x547e4d,_0x19a221){return new BPromise(function(_0x538ad5,_0x363a67){return client['request'](_0x25daa0,_0x19a221)[_0x94b3('0xa')](function(_0x4e6307){logger[_0x94b3('0xb')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x547e4d,_0x94b3('0xc'));logger['debug'](_0x94b3('0xd'),_0x547e4d,_0x94b3('0xc'),JSON[_0x94b3('0xe')](_0x4e6307));if(_0x4e6307['error']){if(_0x4e6307[_0x94b3('0xf')]['code']===0x1f4){logger[_0x94b3('0xf')](_0x94b3('0x10'),_0x547e4d,_0x4e6307[_0x94b3('0xf')][_0x94b3('0x11')]);return _0x363a67(_0x4e6307['error']['message']);}logger[_0x94b3('0xf')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x547e4d,_0x4e6307[_0x94b3('0xf')]['message']);return _0x538ad5(_0x4e6307[_0x94b3('0xf')][_0x94b3('0x11')]);}else{logger['info'](_0x94b3('0x10'),_0x547e4d,_0x94b3('0xc'));_0x538ad5(_0x4e6307['result'][_0x94b3('0x11')]);}})[_0x94b3('0x12')](function(_0x1896ec){logger[_0x94b3('0xf')](_0x94b3('0x10'),_0x547e4d,_0x1896ec);_0x363a67(_0x1896ec);});});} \ No newline at end of file diff --git a/server/api/analyticExtractedReport/index.js b/server/api/analyticExtractedReport/index.js index 8b16819..ec4e2f4 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 _0x6afc=['./analyticExtractedReport.controller','get','isAuthenticated','index','/:id','show','/:id/download','post','create','update','destroy','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x6131cd,_0x4c26a1){var _0x47e916=function(_0x1f2bce){while(--_0x1f2bce){_0x6131cd['push'](_0x6131cd['shift']());}};_0x47e916(++_0x4c26a1);}(_0x6afc,0x1c4));var _0xc6af=function(_0x26e250,_0x12165f){_0x26e250=_0x26e250-0x0;var _0xefcbce=_0x6afc[_0x26e250];return _0xefcbce;};'use strict';var multer=require(_0xc6af('0x0'));var util=require('util');var path=require(_0xc6af('0x1'));var timeout=require(_0xc6af('0x2'));var express=require(_0xc6af('0x3'));var router=express['Router']();var fs_extra=require(_0xc6af('0x4'));var auth=require(_0xc6af('0x5'));var interaction=require(_0xc6af('0x6'));var config=require(_0xc6af('0x7'));var controller=require(_0xc6af('0x8'));router[_0xc6af('0x9')]('/',auth[_0xc6af('0xa')](),controller[_0xc6af('0xb')]);router[_0xc6af('0x9')](_0xc6af('0xc'),auth[_0xc6af('0xa')](),controller[_0xc6af('0xd')]);router['get'](_0xc6af('0xe'),auth[_0xc6af('0xa')](),controller['download']);router[_0xc6af('0xf')]('/',auth[_0xc6af('0xa')](),controller[_0xc6af('0x10')]);router['put'](_0xc6af('0xc'),auth[_0xc6af('0xa')](),controller[_0xc6af('0x11')]);router['delete'](_0xc6af('0xc'),auth[_0xc6af('0xa')](),controller[_0xc6af('0x12')]);module[_0xc6af('0x13')]=router; \ No newline at end of file +var _0x09d1=['get','isAuthenticated','index','/:id','/:id/download','post','create','put','update','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./analyticExtractedReport.controller'];(function(_0x57f743,_0x1f3944){var _0x29417d=function(_0x130711){while(--_0x130711){_0x57f743['push'](_0x57f743['shift']());}};_0x29417d(++_0x1f3944);}(_0x09d1,0x74));var _0x109d=function(_0x43e7c4,_0x2b0ef1){_0x43e7c4=_0x43e7c4-0x0;var _0x49ae54=_0x09d1[_0x43e7c4];return _0x49ae54;};'use strict';var multer=require(_0x109d('0x0'));var util=require(_0x109d('0x1'));var path=require(_0x109d('0x2'));var timeout=require(_0x109d('0x3'));var express=require(_0x109d('0x4'));var router=express[_0x109d('0x5')]();var fs_extra=require(_0x109d('0x6'));var auth=require(_0x109d('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x109d('0x8'));var controller=require(_0x109d('0x9'));router[_0x109d('0xa')]('/',auth[_0x109d('0xb')](),controller[_0x109d('0xc')]);router['get'](_0x109d('0xd'),auth[_0x109d('0xb')](),controller['show']);router[_0x109d('0xa')](_0x109d('0xe'),auth[_0x109d('0xb')](),controller['download']);router[_0x109d('0xf')]('/',auth[_0x109d('0xb')](),controller[_0x109d('0x10')]);router[_0x109d('0x11')]('/:id',auth['isAuthenticated'](),controller[_0x109d('0x12')]);router[_0x109d('0x13')]('/:id',auth['isAuthenticated'](),controller[_0x109d('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.attributes.js b/server/api/analyticFieldReport/analyticFieldReport.attributes.js index 16b4a14..c37fc7c 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 _0x26a0=['BOOLEAN','exports','TEXT','STRING'];(function(_0x173441,_0x26b0d9){var _0x2423a8=function(_0x4d96c2){while(--_0x4d96c2){_0x173441['push'](_0x173441['shift']());}};_0x2423a8(++_0x26b0d9);}(_0x26a0,0x85));var _0x026a=function(_0x3ec0f0,_0x53d847){_0x3ec0f0=_0x3ec0f0-0x0;var _0x4f0aea=_0x26a0[_0x3ec0f0];return _0x4f0aea;};'use strict';var Sequelize=require('sequelize');module[_0x026a('0x0')]={'field':{'type':Sequelize[_0x026a('0x1')]},'alias':{'type':Sequelize['STRING']},'function':{'type':Sequelize[_0x026a('0x2')]},'format':{'type':Sequelize[_0x026a('0x2')]},'groupBy':{'type':Sequelize[_0x026a('0x3')],'defaultValue':![]},'orderBy':{'type':Sequelize[_0x026a('0x2')]},'custom':{'type':Sequelize[_0x026a('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0x569c=['TEXT','STRING','sequelize','exports'];(function(_0x240575,_0x491964){var _0x2d139d=function(_0x3c6296){while(--_0x3c6296){_0x240575['push'](_0x240575['shift']());}};_0x2d139d(++_0x491964);}(_0x569c,0x13e));var _0xc569=function(_0x4ff8e1,_0x29b296){_0x4ff8e1=_0x4ff8e1-0x0;var _0x3ba8d4=_0x569c[_0x4ff8e1];return _0x3ba8d4;};'use strict';var Sequelize=require(_0xc569('0x0'));module[_0xc569('0x1')]={'field':{'type':Sequelize[_0xc569('0x2')]},'alias':{'type':Sequelize['STRING']},'function':{'type':Sequelize[_0xc569('0x3')]},'format':{'type':Sequelize[_0xc569('0x3')]},'groupBy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'orderBy':{'type':Sequelize[_0xc569('0x3')]},'custom':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.controller.js b/server/api/analyticFieldReport/analyticFieldReport.controller.js index db72e96..5d0b395 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 _0x2599=['hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','keys','find','create','body','bulkCreate','bulkDestroy','AnalyticCustomReport','findOne','sequelize','transaction','CustomReportId','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','limit','count','set','json','apply','reject','save','update','then','destroy','end','error','stack','name','send','index','map','AnalyticFieldReport','rawAttributes','type','model','query','filters','intersection','attributes','fields','length'];(function(_0x5d1e11,_0x1590a5){var _0x5b0718=function(_0x3e9ef3){while(--_0x3e9ef3){_0x5d1e11['push'](_0x5d1e11['shift']());}};_0x5b0718(++_0x1590a5);}(_0x2599,0x117));var _0x9259=function(_0x2a9c15,_0x43ae27){_0x2a9c15=_0x2a9c15-0x0;var _0x16ef80=_0x2599[_0x2a9c15];return _0x16ef80;};'use strict';var emlformat=require(_0x9259('0x0'));var rimraf=require(_0x9259('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x9259('0x2'));var rp=require(_0x9259('0x3'));var moment=require(_0x9259('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x9259('0x5'));var util=require(_0x9259('0x6'));var path=require(_0x9259('0x7'));var sox=require(_0x9259('0x8'));var csv=require(_0x9259('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9259('0xa'));var _=require('lodash');var squel=require(_0x9259('0xb'));var crypto=require('crypto');var jsforce=require(_0x9259('0xc'));var deskjs=require(_0x9259('0xd'));var toCsv=require('to-csv');var querystring=require(_0x9259('0xe'));var Papa=require(_0x9259('0xf'));var Redis=require(_0x9259('0x10'));var authService=require(_0x9259('0x11'));var qs=require(_0x9259('0x12'));var as=require(_0x9259('0x13'));var hardwareService=require(_0x9259('0x14'));var logger=require(_0x9259('0x15'))(_0x9259('0x16'));var utils=require('../../config/utils');var config=require(_0x9259('0x17'));var licenseUtil=require(_0x9259('0x18'));var db=require(_0x9259('0x19'))['db'];function respondWithStatusCode(_0x28cc53,_0x2d0fd5){_0x2d0fd5=_0x2d0fd5||0xcc;return function(_0x24316b){if(_0x24316b){return _0x28cc53[_0x9259('0x1a')](_0x2d0fd5);}return _0x28cc53[_0x9259('0x1b')](_0x2d0fd5)['end']();};}function respondWithResult(_0x398c6b,_0x44e7d1){_0x44e7d1=_0x44e7d1||0xc8;return function(_0x37adef){if(_0x37adef){return _0x398c6b[_0x9259('0x1b')](_0x44e7d1)['json'](_0x37adef);}};}function respondWithFilteredResult(_0x260809,_0x2665d8){return function(_0x5eee0a){if(_0x5eee0a){var _0xf1fa85=typeof _0x2665d8[_0x9259('0x1c')]===_0x9259('0x1d')&&typeof _0x2665d8[_0x9259('0x1e')]===_0x9259('0x1d');var _0x3c2bfe=_0x5eee0a[_0x9259('0x1f')];var _0x5ee642=_0xf1fa85?0x0:_0x2665d8[_0x9259('0x1c')];var _0x5025bd=_0xf1fa85?_0x5eee0a[_0x9259('0x1f')]:_0x2665d8['offset']+_0x2665d8[_0x9259('0x1e')];var _0x36c33c;if(_0x5025bd>=_0x3c2bfe){_0x5025bd=_0x3c2bfe;_0x36c33c=0xc8;}else{_0x36c33c=0xce;}_0x260809[_0x9259('0x1b')](_0x36c33c);return _0x260809[_0x9259('0x20')]('Content-Range',_0x5ee642+'-'+_0x5025bd+'/'+_0x3c2bfe)[_0x9259('0x21')](_0x5eee0a);}return null;};}function patchUpdates(_0x3bb529){return function(_0x27c900){try{jsonpatch[_0x9259('0x22')](_0x27c900,_0x3bb529,!![]);}catch(_0x4292b7){return BPromise[_0x9259('0x23')](_0x4292b7);}return _0x27c900[_0x9259('0x24')]();};}function saveUpdates(_0x352711,_0x8672f5){return function(_0x40af20){if(_0x40af20){return _0x40af20[_0x9259('0x25')](_0x352711)[_0x9259('0x26')](function(_0x31eb12){return _0x31eb12;});}return null;};}function removeEntity(_0x1b239d,_0x2b43bb){return function(_0x5427e6){if(_0x5427e6){return _0x5427e6[_0x9259('0x27')]()[_0x9259('0x26')](function(){_0x1b239d[_0x9259('0x1b')](0xcc)[_0x9259('0x28')]();});}};}function handleEntityNotFound(_0x115383,_0x58f733){return function(_0x90e5e3){if(!_0x90e5e3){_0x115383[_0x9259('0x1a')](0x194);}return _0x90e5e3;};}function handleError(_0x2c2ca3,_0xa0f9d5){_0xa0f9d5=_0xa0f9d5||0x1f4;return function(_0x5ced0b){logger[_0x9259('0x29')](_0x5ced0b[_0x9259('0x2a')]);if(_0x5ced0b[_0x9259('0x2b')]){delete _0x5ced0b[_0x9259('0x2b')];}_0x2c2ca3[_0x9259('0x1b')](_0xa0f9d5)[_0x9259('0x2c')](_0x5ced0b);};}exports[_0x9259('0x2d')]=function(_0x351645,_0x4f359a){var _0x42eaa1={},_0x2de092={},_0x4ac665={'count':0x0,'rows':[]};var _0x5c19ce=_[_0x9259('0x2e')](db[_0x9259('0x2f')][_0x9259('0x30')],function(_0x17a94c){return{'name':_0x17a94c['fieldName'],'type':_0x17a94c[_0x9259('0x31')]['key']};});_0x2de092[_0x9259('0x32')]=_['map'](_0x5c19ce,_0x9259('0x2b'));_0x2de092[_0x9259('0x33')]=_['keys'](_0x351645[_0x9259('0x33')]);_0x2de092[_0x9259('0x34')]=_[_0x9259('0x35')](_0x2de092['model'],_0x2de092[_0x9259('0x33')]);_0x42eaa1[_0x9259('0x36')]=_[_0x9259('0x35')](_0x2de092['model'],qs[_0x9259('0x37')](_0x351645[_0x9259('0x33')][_0x9259('0x37')]));_0x42eaa1[_0x9259('0x36')]=_0x42eaa1[_0x9259('0x36')][_0x9259('0x38')]?_0x42eaa1['attributes']:_0x2de092[_0x9259('0x32')];if(!_0x351645['query'][_0x9259('0x39')](_0x9259('0x3a'))){_0x42eaa1[_0x9259('0x1e')]=qs['limit'](_0x351645[_0x9259('0x33')][_0x9259('0x1e')]);_0x42eaa1[_0x9259('0x1c')]=qs[_0x9259('0x1c')](_0x351645[_0x9259('0x33')][_0x9259('0x1c')]);}_0x42eaa1[_0x9259('0x3b')]=qs[_0x9259('0x3c')](_0x351645[_0x9259('0x33')][_0x9259('0x3c')]);_0x42eaa1[_0x9259('0x3d')]=qs[_0x9259('0x34')](_[_0x9259('0x3e')](_0x351645[_0x9259('0x33')],_0x2de092[_0x9259('0x34')]),_0x5c19ce);if(_0x351645['query'][_0x9259('0x3f')]){_0x42eaa1[_0x9259('0x3d')]=_[_0x9259('0x40')](_0x42eaa1[_0x9259('0x3d')],{'$or':_[_0x9259('0x2e')](_0x5c19ce,function(_0x4d176f){if(_0x4d176f['type']!==_0x9259('0x41')){var _0x1a7486={};_0x1a7486[_0x4d176f[_0x9259('0x2b')]]={'$like':'%'+_0x351645[_0x9259('0x33')]['filter']+'%'};return _0x1a7486;}})});}_0x42eaa1=_[_0x9259('0x40')]({},_0x42eaa1,_0x351645[_0x9259('0x42')]);var _0x16cf96={'where':_0x42eaa1['where']};return db[_0x9259('0x2f')][_0x9259('0x1f')](_0x16cf96)[_0x9259('0x26')](function(_0x4db055){_0x4ac665[_0x9259('0x1f')]=_0x4db055;if(_0x351645[_0x9259('0x33')][_0x9259('0x43')]){_0x42eaa1[_0x9259('0x44')]=[{'all':!![]}];}return db[_0x9259('0x2f')][_0x9259('0x45')](_0x42eaa1);})[_0x9259('0x26')](function(_0x6214de){_0x4ac665[_0x9259('0x46')]=_0x6214de;return _0x4ac665;})['then'](respondWithFilteredResult(_0x4f359a,_0x42eaa1))[_0x9259('0x47')](handleError(_0x4f359a,null));};exports['show']=function(_0xa8179c,_0x5c3b0d){var _0x44febc={'raw':![],'where':{'id':_0xa8179c[_0x9259('0x48')]['id']}},_0x141273={};_0x141273[_0x9259('0x32')]=_[_0x9259('0x49')](db[_0x9259('0x2f')][_0x9259('0x30')]);_0x141273['query']=_['keys'](_0xa8179c[_0x9259('0x33')]);_0x141273[_0x9259('0x34')]=_['intersection'](_0x141273[_0x9259('0x32')],_0x141273['query']);_0x44febc[_0x9259('0x36')]=_[_0x9259('0x35')](_0x141273[_0x9259('0x32')],qs['fields'](_0xa8179c[_0x9259('0x33')]['fields']));_0x44febc[_0x9259('0x36')]=_0x44febc[_0x9259('0x36')][_0x9259('0x38')]?_0x44febc[_0x9259('0x36')]:_0x141273[_0x9259('0x32')];if(_0xa8179c[_0x9259('0x33')][_0x9259('0x43')]){_0x44febc[_0x9259('0x44')]=[{'all':!![]}];}_0x44febc=_[_0x9259('0x40')]({},_0x44febc,_0xa8179c[_0x9259('0x42')]);return db[_0x9259('0x2f')][_0x9259('0x4a')](_0x44febc)['then'](handleEntityNotFound(_0x5c3b0d,null))['then'](respondWithResult(_0x5c3b0d,null))[_0x9259('0x47')](handleError(_0x5c3b0d,null));};exports[_0x9259('0x4b')]=function(_0x5cae1c,_0x2f1a44){return db[_0x9259('0x2f')][_0x9259('0x4b')](_0x5cae1c[_0x9259('0x4c')],{})[_0x9259('0x26')](respondWithResult(_0x2f1a44,0xc9))[_0x9259('0x47')](handleError(_0x2f1a44,null));};exports['bulkCreate']=function(_0x378591,_0x124b8a){return db[_0x9259('0x2f')][_0x9259('0x4d')](_0x378591[_0x9259('0x4c')],{'raw':![],'individualHooks':!![]})[_0x9259('0x26')](respondWithResult(_0x124b8a,0xc9))['catch'](handleError(_0x124b8a,null));};exports[_0x9259('0x25')]=function(_0x2e7e4e,_0x3f1646){if(_0x2e7e4e[_0x9259('0x4c')]['id']){delete _0x2e7e4e[_0x9259('0x4c')]['id'];}return db[_0x9259('0x2f')][_0x9259('0x4a')]({'where':{'id':_0x2e7e4e[_0x9259('0x48')]['id']}})[_0x9259('0x26')](handleEntityNotFound(_0x3f1646,null))['then'](saveUpdates(_0x2e7e4e[_0x9259('0x4c')],null))[_0x9259('0x26')](respondWithResult(_0x3f1646,null))[_0x9259('0x47')](handleError(_0x3f1646,null));};exports[_0x9259('0x27')]=function(_0x16b63c,_0x4fbafc){return db['AnalyticFieldReport']['find']({'where':{'id':_0x16b63c[_0x9259('0x48')]['id']}})['then'](handleEntityNotFound(_0x4fbafc,null))[_0x9259('0x26')](removeEntity(_0x4fbafc,null))[_0x9259('0x47')](handleError(_0x4fbafc,null));};exports[_0x9259('0x4e')]=function(_0xd4e11f,_0x3311fc){return db['AnalyticFieldReport']['destroy']({'where':{'id':_0xd4e11f[_0x9259('0x33')]['ids']||[]},'raw':![],'individualHooks':!![]})['then'](respondWithResult(_0x3311fc,0xcc))[_0x9259('0x47')](handleError(_0x3311fc,null));};exports['addFields']=function(_0x108774,_0x2b978f,_0x52a52d){return db[_0x9259('0x4f')][_0x9259('0x50')]({'where':{'id':_0x108774[_0x9259('0x48')]['id']}})['then'](handleEntityNotFound(_0x2b978f,null))[_0x9259('0x26')](function(_0x296b00){if(_0x296b00){return db[_0x9259('0x51')][_0x9259('0x52')](function(_0x2b57b1){return db[_0x9259('0x2f')]['destroy']({'where':{'CustomReportId':_0x108774['params']['id']},'transaction':_0x2b57b1})['then'](function(_0x22fc1e){var _0x14447f=_[_0x9259('0x2e')](_0x108774[_0x9259('0x4c')],function(_0x593a1c){delete _0x593a1c['id'];_0x593a1c[_0x9259('0x53')]=_0x108774['params']['id'];return _0x593a1c;});return db['AnalyticFieldReport'][_0x9259('0x4d')](_0x14447f,{'transaction':_0x2b57b1});});})[_0x9259('0x26')](function(){return db['AnalyticFieldReport'][_0x9259('0x45')]({'where':{'CustomReportId':_0x108774['params']['id']}});});}})[_0x9259('0x26')](respondWithResult(_0x2b978f,null))['catch'](handleError(_0x2b978f,null));}; \ No newline at end of file +var _0x94a4=['hasOwnProperty','order','sort','where','pick','filter','merge','type','options','AnalyticFieldReport','includeAll','include','findAll','rows','show','params','rawAttributes','find','catch','create','body','bulkCreate','update','destroy','ids','AnalyticCustomReport','findOne','transaction','CustomReportId','eml-format','rimraf','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','count','limit','set','apply','reject','then','sendStatus','error','stack','name','send','map','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length'];(function(_0x3f19b3,_0x3f0849){var _0xd61898=function(_0x3ca685){while(--_0x3ca685){_0x3f19b3['push'](_0x3f19b3['shift']());}};_0xd61898(++_0x3f0849);}(_0x94a4,0x1a8));var _0x494a=function(_0x599f41,_0x4db732){_0x599f41=_0x599f41-0x0;var _0x2e4d58=_0x94a4[_0x599f41];return _0x2e4d58;};'use strict';var emlformat=require(_0x494a('0x0'));var rimraf=require(_0x494a('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x494a('0x2'));var Mustache=require(_0x494a('0x3'));var util=require('util');var path=require('path');var sox=require(_0x494a('0x4'));var csv=require(_0x494a('0x5'));var ejs=require(_0x494a('0x6'));var fs=require('fs');var fs_extra=require(_0x494a('0x7'));var _=require(_0x494a('0x8'));var squel=require(_0x494a('0x9'));var crypto=require(_0x494a('0xa'));var jsforce=require(_0x494a('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x494a('0xc'));var Papa=require(_0x494a('0xd'));var Redis=require(_0x494a('0xe'));var authService=require(_0x494a('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x494a('0x10'));var hardwareService=require(_0x494a('0x11'));var logger=require(_0x494a('0x12'))(_0x494a('0x13'));var utils=require(_0x494a('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x494a('0x15'));var db=require(_0x494a('0x16'))['db'];function respondWithStatusCode(_0x1696f7,_0x3c1c98){_0x3c1c98=_0x3c1c98||0xcc;return function(_0x37c6be){if(_0x37c6be){return _0x1696f7['sendStatus'](_0x3c1c98);}return _0x1696f7[_0x494a('0x17')](_0x3c1c98)[_0x494a('0x18')]();};}function respondWithResult(_0x57ddf1,_0x576ab8){_0x576ab8=_0x576ab8||0xc8;return function(_0x7b02f7){if(_0x7b02f7){return _0x57ddf1[_0x494a('0x17')](_0x576ab8)[_0x494a('0x19')](_0x7b02f7);}};}function respondWithFilteredResult(_0x2fc8da,_0x2377d1){return function(_0x27c5d1){if(_0x27c5d1){var _0x386671=typeof _0x2377d1[_0x494a('0x1a')]===_0x494a('0x1b')&&typeof _0x2377d1['limit']==='undefined';var _0x52118d=_0x27c5d1['count'];var _0x10749a=_0x386671?0x0:_0x2377d1[_0x494a('0x1a')];var _0x37b995=_0x386671?_0x27c5d1[_0x494a('0x1c')]:_0x2377d1['offset']+_0x2377d1[_0x494a('0x1d')];var _0x2fe50e;if(_0x37b995>=_0x52118d){_0x37b995=_0x52118d;_0x2fe50e=0xc8;}else{_0x2fe50e=0xce;}_0x2fc8da[_0x494a('0x17')](_0x2fe50e);return _0x2fc8da[_0x494a('0x1e')]('Content-Range',_0x10749a+'-'+_0x37b995+'/'+_0x52118d)[_0x494a('0x19')](_0x27c5d1);}return null;};}function patchUpdates(_0x553a10){return function(_0x56fa61){try{jsonpatch[_0x494a('0x1f')](_0x56fa61,_0x553a10,!![]);}catch(_0x43094b){return BPromise[_0x494a('0x20')](_0x43094b);}return _0x56fa61['save']();};}function saveUpdates(_0x57ffd5,_0x44428c){return function(_0x3675e4){if(_0x3675e4){return _0x3675e4['update'](_0x57ffd5)['then'](function(_0x3cd9d9){return _0x3cd9d9;});}return null;};}function removeEntity(_0x466f72,_0x376f21){return function(_0x24e7fb){if(_0x24e7fb){return _0x24e7fb['destroy']()[_0x494a('0x21')](function(){_0x466f72[_0x494a('0x17')](0xcc)[_0x494a('0x18')]();});}};}function handleEntityNotFound(_0x5064cd,_0x3e0ddd){return function(_0x52ec5b){if(!_0x52ec5b){_0x5064cd[_0x494a('0x22')](0x194);}return _0x52ec5b;};}function handleError(_0x399bcd,_0x31270f){_0x31270f=_0x31270f||0x1f4;return function(_0x593efc){logger[_0x494a('0x23')](_0x593efc[_0x494a('0x24')]);if(_0x593efc[_0x494a('0x25')]){delete _0x593efc['name'];}_0x399bcd[_0x494a('0x17')](_0x31270f)[_0x494a('0x26')](_0x593efc);};}exports['index']=function(_0x4cb6d9,_0x15cf3a){var _0x180707={},_0x612f84={},_0x3999b5={'count':0x0,'rows':[]};var _0x44b8a6=_[_0x494a('0x27')](db['AnalyticFieldReport']['rawAttributes'],function(_0x233219){return{'name':_0x233219[_0x494a('0x28')],'type':_0x233219['type'][_0x494a('0x29')]};});_0x612f84[_0x494a('0x2a')]=_[_0x494a('0x27')](_0x44b8a6,_0x494a('0x25'));_0x612f84[_0x494a('0x2b')]=_[_0x494a('0x2c')](_0x4cb6d9['query']);_0x612f84[_0x494a('0x2d')]=_[_0x494a('0x2e')](_0x612f84[_0x494a('0x2a')],_0x612f84[_0x494a('0x2b')]);_0x180707[_0x494a('0x2f')]=_['intersection'](_0x612f84[_0x494a('0x2a')],qs[_0x494a('0x30')](_0x4cb6d9[_0x494a('0x2b')][_0x494a('0x30')]));_0x180707[_0x494a('0x2f')]=_0x180707[_0x494a('0x2f')][_0x494a('0x31')]?_0x180707[_0x494a('0x2f')]:_0x612f84[_0x494a('0x2a')];if(!_0x4cb6d9[_0x494a('0x2b')][_0x494a('0x32')]('nolimit')){_0x180707[_0x494a('0x1d')]=qs[_0x494a('0x1d')](_0x4cb6d9[_0x494a('0x2b')][_0x494a('0x1d')]);_0x180707[_0x494a('0x1a')]=qs[_0x494a('0x1a')](_0x4cb6d9[_0x494a('0x2b')][_0x494a('0x1a')]);}_0x180707[_0x494a('0x33')]=qs[_0x494a('0x34')](_0x4cb6d9[_0x494a('0x2b')][_0x494a('0x34')]);_0x180707[_0x494a('0x35')]=qs[_0x494a('0x2d')](_[_0x494a('0x36')](_0x4cb6d9[_0x494a('0x2b')],_0x612f84['filters']),_0x44b8a6);if(_0x4cb6d9[_0x494a('0x2b')][_0x494a('0x37')]){_0x180707[_0x494a('0x35')]=_[_0x494a('0x38')](_0x180707[_0x494a('0x35')],{'$or':_[_0x494a('0x27')](_0x44b8a6,function(_0x55ab20){if(_0x55ab20[_0x494a('0x39')]!=='VIRTUAL'){var _0x222390={};_0x222390[_0x55ab20[_0x494a('0x25')]]={'$like':'%'+_0x4cb6d9[_0x494a('0x2b')][_0x494a('0x37')]+'%'};return _0x222390;}})});}_0x180707=_[_0x494a('0x38')]({},_0x180707,_0x4cb6d9[_0x494a('0x3a')]);var _0x3a13ed={'where':_0x180707[_0x494a('0x35')]};return db[_0x494a('0x3b')][_0x494a('0x1c')](_0x3a13ed)[_0x494a('0x21')](function(_0x59c216){_0x3999b5['count']=_0x59c216;if(_0x4cb6d9[_0x494a('0x2b')][_0x494a('0x3c')]){_0x180707[_0x494a('0x3d')]=[{'all':!![]}];}return db['AnalyticFieldReport'][_0x494a('0x3e')](_0x180707);})[_0x494a('0x21')](function(_0x881ba7){_0x3999b5[_0x494a('0x3f')]=_0x881ba7;return _0x3999b5;})[_0x494a('0x21')](respondWithFilteredResult(_0x15cf3a,_0x180707))['catch'](handleError(_0x15cf3a,null));};exports[_0x494a('0x40')]=function(_0x38354e,_0x355dbe){var _0x3b9c63={'raw':![],'where':{'id':_0x38354e[_0x494a('0x41')]['id']}},_0x4b8964={};_0x4b8964['model']=_[_0x494a('0x2c')](db['AnalyticFieldReport'][_0x494a('0x42')]);_0x4b8964[_0x494a('0x2b')]=_[_0x494a('0x2c')](_0x38354e['query']);_0x4b8964[_0x494a('0x2d')]=_['intersection'](_0x4b8964[_0x494a('0x2a')],_0x4b8964['query']);_0x3b9c63['attributes']=_[_0x494a('0x2e')](_0x4b8964[_0x494a('0x2a')],qs['fields'](_0x38354e[_0x494a('0x2b')][_0x494a('0x30')]));_0x3b9c63[_0x494a('0x2f')]=_0x3b9c63[_0x494a('0x2f')][_0x494a('0x31')]?_0x3b9c63[_0x494a('0x2f')]:_0x4b8964[_0x494a('0x2a')];if(_0x38354e[_0x494a('0x2b')][_0x494a('0x3c')]){_0x3b9c63['include']=[{'all':!![]}];}_0x3b9c63=_[_0x494a('0x38')]({},_0x3b9c63,_0x38354e[_0x494a('0x3a')]);return db['AnalyticFieldReport'][_0x494a('0x43')](_0x3b9c63)['then'](handleEntityNotFound(_0x355dbe,null))[_0x494a('0x21')](respondWithResult(_0x355dbe,null))[_0x494a('0x44')](handleError(_0x355dbe,null));};exports[_0x494a('0x45')]=function(_0x5d4fb6,_0x597e16){return db[_0x494a('0x3b')][_0x494a('0x45')](_0x5d4fb6[_0x494a('0x46')],{})[_0x494a('0x21')](respondWithResult(_0x597e16,0xc9))['catch'](handleError(_0x597e16,null));};exports['bulkCreate']=function(_0x4730f0,_0x53e936){return db['AnalyticFieldReport'][_0x494a('0x47')](_0x4730f0[_0x494a('0x46')],{'raw':![],'individualHooks':!![]})['then'](respondWithResult(_0x53e936,0xc9))[_0x494a('0x44')](handleError(_0x53e936,null));};exports[_0x494a('0x48')]=function(_0x4c3b4e,_0x1b8575){if(_0x4c3b4e[_0x494a('0x46')]['id']){delete _0x4c3b4e['body']['id'];}return db[_0x494a('0x3b')][_0x494a('0x43')]({'where':{'id':_0x4c3b4e[_0x494a('0x41')]['id']}})[_0x494a('0x21')](handleEntityNotFound(_0x1b8575,null))[_0x494a('0x21')](saveUpdates(_0x4c3b4e[_0x494a('0x46')],null))[_0x494a('0x21')](respondWithResult(_0x1b8575,null))[_0x494a('0x44')](handleError(_0x1b8575,null));};exports[_0x494a('0x49')]=function(_0x525427,_0x1aa262){return db[_0x494a('0x3b')][_0x494a('0x43')]({'where':{'id':_0x525427[_0x494a('0x41')]['id']}})[_0x494a('0x21')](handleEntityNotFound(_0x1aa262,null))[_0x494a('0x21')](removeEntity(_0x1aa262,null))[_0x494a('0x44')](handleError(_0x1aa262,null));};exports['bulkDestroy']=function(_0x2b53f6,_0x363c4f){return db[_0x494a('0x3b')]['destroy']({'where':{'id':_0x2b53f6[_0x494a('0x2b')][_0x494a('0x4a')]||[]},'raw':![],'individualHooks':!![]})[_0x494a('0x21')](respondWithResult(_0x363c4f,0xcc))[_0x494a('0x44')](handleError(_0x363c4f,null));};exports['addFields']=function(_0x290542,_0x868fcb,_0x2738b2){return db[_0x494a('0x4b')][_0x494a('0x4c')]({'where':{'id':_0x290542[_0x494a('0x41')]['id']}})[_0x494a('0x21')](handleEntityNotFound(_0x868fcb,null))['then'](function(_0x4fa0f5){if(_0x4fa0f5){return db['sequelize'][_0x494a('0x4d')](function(_0x54f423){return db[_0x494a('0x3b')][_0x494a('0x49')]({'where':{'CustomReportId':_0x290542[_0x494a('0x41')]['id']},'transaction':_0x54f423})[_0x494a('0x21')](function(_0x32370b){var _0x284b54=_[_0x494a('0x27')](_0x290542[_0x494a('0x46')],function(_0x4ded60){delete _0x4ded60['id'];_0x4ded60[_0x494a('0x4e')]=_0x290542[_0x494a('0x41')]['id'];return _0x4ded60;});return db[_0x494a('0x3b')][_0x494a('0x47')](_0x284b54,{'transaction':_0x54f423});});})['then'](function(){return db[_0x494a('0x3b')][_0x494a('0x3e')]({'where':{'CustomReportId':_0x290542['params']['id']}});});}})[_0x494a('0x21')](respondWithResult(_0x868fcb,null))[_0x494a('0x44')](handleError(_0x868fcb,null));}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.model.js b/server/api/analyticFieldReport/analyticFieldReport.model.js index 3b63b5c..3dfde1d 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 _0x05d6=['request-promise','rimraf','define','AnalyticFieldReport','analytics_report_fields','lodash','util','../../config/logger','bluebird'];(function(_0x155f98,_0x3ad2c3){var _0x1f3c41=function(_0x8147ed){while(--_0x8147ed){_0x155f98['push'](_0x155f98['shift']());}};_0x1f3c41(++_0x3ad2c3);}(_0x05d6,0xcb));var _0x605d=function(_0x2b3bc9,_0x310614){_0x2b3bc9=_0x2b3bc9-0x0;var _0x3d998c=_0x05d6[_0x2b3bc9];return _0x3d998c;};'use strict';var _=require(_0x605d('0x0'));var util=require(_0x605d('0x1'));var logger=require(_0x605d('0x2'))('api');var moment=require('moment');var BPromise=require(_0x605d('0x3'));var rp=require(_0x605d('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x605d('0x5'));var config=require('../../config/environment');var attributes=require('./analyticFieldReport.attributes');module['exports']=function(_0x387fcd,_0xa426c3){return _0x387fcd[_0x605d('0x6')](_0x605d('0x7'),attributes,{'tableName':_0x605d('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3045=['exports','define','AnalyticFieldReport','analytics_report_fields','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./analyticFieldReport.attributes'];(function(_0x580f59,_0x4ae4de){var _0x4095ba=function(_0x3ec1d3){while(--_0x3ec1d3){_0x580f59['push'](_0x580f59['shift']());}};_0x4095ba(++_0x4ae4de);}(_0x3045,0x1d2));var _0x5304=function(_0x56972f,_0x59e239){_0x56972f=_0x56972f-0x0;var _0x3c9258=_0x3045[_0x56972f];return _0x3c9258;};'use strict';var _=require(_0x5304('0x0'));var util=require(_0x5304('0x1'));var logger=require(_0x5304('0x2'))('api');var moment=require(_0x5304('0x3'));var BPromise=require(_0x5304('0x4'));var rp=require(_0x5304('0x5'));var fs=require('fs');var path=require(_0x5304('0x6'));var rimraf=require(_0x5304('0x7'));var config=require(_0x5304('0x8'));var attributes=require(_0x5304('0x9'));module[_0x5304('0xa')]=function(_0x31bea4,_0x1d3694){return _0x31bea4[_0x5304('0xb')](_0x5304('0xc'),attributes,{'tableName':_0x5304('0xd'),'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 ba2e52d..a28cfcb 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 _0xc12a=['then','info','AnalyticFieldReport,\x20%s,\x20%s','request\x20sent','AnalyticFieldReport,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request'];(function(_0x32d457,_0x1a39c9){var _0x338386=function(_0x199d7a){while(--_0x199d7a){_0x32d457['push'](_0x32d457['shift']());}};_0x338386(++_0x1a39c9);}(_0xc12a,0x1c1));var _0xac12=function(_0x486ace,_0x2acf99){_0x486ace=_0x486ace-0x0;var _0x236c9b=_0xc12a[_0x486ace];return _0x236c9b;};'use strict';var _=require(_0xac12('0x0'));var util=require(_0xac12('0x1'));var moment=require('moment');var BPromise=require(_0xac12('0x2'));var rs=require(_0xac12('0x3'));var fs=require('fs');var Redis=require(_0xac12('0x4'));var db=require(_0xac12('0x5'))['db'];var utils=require(_0xac12('0x6'));var logger=require(_0xac12('0x7'))(_0xac12('0x8'));var config=require('../../config/environment');var jayson=require(_0xac12('0x9'));var client=jayson[_0xac12('0xa')][_0xac12('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4dc4ab,_0x59110f,_0x2c6f8b){return new BPromise(function(_0x2d52eb,_0x5ba157){return client[_0xac12('0xc')](_0x4dc4ab,_0x2c6f8b)[_0xac12('0xd')](function(_0x4ef836){logger[_0xac12('0xe')](_0xac12('0xf'),_0x59110f,_0xac12('0x10'));logger['debug'](_0xac12('0x11'),_0x59110f,_0xac12('0x10'),JSON[_0xac12('0x12')](_0x4ef836));if(_0x4ef836[_0xac12('0x13')]){if(_0x4ef836['error']['code']===0x1f4){logger['error'](_0xac12('0xf'),_0x59110f,_0x4ef836[_0xac12('0x13')][_0xac12('0x14')]);return _0x5ba157(_0x4ef836['error'][_0xac12('0x14')]);}logger['error'](_0xac12('0xf'),_0x59110f,_0x4ef836[_0xac12('0x13')][_0xac12('0x14')]);return _0x2d52eb(_0x4ef836['error'][_0xac12('0x14')]);}else{logger[_0xac12('0xe')](_0xac12('0xf'),_0x59110f,_0xac12('0x10'));_0x2d52eb(_0x4ef836['result'][_0xac12('0x14')]);}})[_0xac12('0x15')](function(_0x4bf0ab){logger[_0xac12('0x13')](_0xac12('0xf'),_0x59110f,_0x4bf0ab);_0x5ba157(_0x4bf0ab);});});} \ No newline at end of file +var _0x34a4=['result','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','AnalyticFieldReport,\x20%s,\x20%s','debug','AnalyticFieldReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message'];(function(_0x32c8ed,_0x45fef2){var _0x580764=function(_0xeb440e){while(--_0xeb440e){_0x32c8ed['push'](_0x32c8ed['shift']());}};_0x580764(++_0x45fef2);}(_0x34a4,0x1ba));var _0x434a=function(_0x362ad7,_0x948800){_0x362ad7=_0x362ad7-0x0;var _0x54703b=_0x34a4[_0x362ad7];return _0x54703b;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x434a('0x0'));var BPromise=require(_0x434a('0x1'));var rs=require(_0x434a('0x2'));var fs=require('fs');var Redis=require(_0x434a('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x434a('0x4'));var logger=require(_0x434a('0x5'))('rpc');var config=require(_0x434a('0x6'));var jayson=require(_0x434a('0x7'));var client=jayson[_0x434a('0x8')][_0x434a('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x29fc6f,_0x505755,_0xd29c36){return new BPromise(function(_0x16d622,_0x12cace){return client['request'](_0x29fc6f,_0xd29c36)[_0x434a('0xa')](function(_0x1941a4){logger[_0x434a('0xb')](_0x434a('0xc'),_0x505755,'request\x20sent');logger[_0x434a('0xd')](_0x434a('0xe'),_0x505755,_0x434a('0xf'),JSON[_0x434a('0x10')](_0x1941a4));if(_0x1941a4[_0x434a('0x11')]){if(_0x1941a4[_0x434a('0x11')][_0x434a('0x12')]===0x1f4){logger[_0x434a('0x11')](_0x434a('0xc'),_0x505755,_0x1941a4[_0x434a('0x11')]['message']);return _0x12cace(_0x1941a4[_0x434a('0x11')][_0x434a('0x13')]);}logger[_0x434a('0x11')](_0x434a('0xc'),_0x505755,_0x1941a4[_0x434a('0x11')][_0x434a('0x13')]);return _0x16d622(_0x1941a4[_0x434a('0x11')]['message']);}else{logger[_0x434a('0xb')](_0x434a('0xc'),_0x505755,_0x434a('0xf'));_0x16d622(_0x1941a4[_0x434a('0x14')][_0x434a('0x13')]);}})['catch'](function(_0xa6e2bb){logger[_0x434a('0x11')](_0x434a('0xc'),_0x505755,_0xa6e2bb);_0x12cace(_0xa6e2bb);});});} \ No newline at end of file diff --git a/server/api/analyticFieldReport/index.js b/server/api/analyticFieldReport/index.js index 07b4b08..946ca3e 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(_0x2ff872,_0x13836d){var _0x40e5c4=function(_0x20c5ee){while(--_0x20c5ee){_0x2ff872['push'](_0x2ff872['shift']());}};_0x40e5c4(++_0x13836d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2b10c6,_0x185590){_0x2b10c6=_0x2b10c6-0x0;var _0x3789d2=_0xa9e0[_0x2b10c6];return _0x3789d2;};'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(_0x331604,_0x577eb3){var _0x45829d=function(_0x256517){while(--_0x256517){_0x331604['push'](_0x331604['shift']());}};_0x45829d(++_0x577eb3);}(_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('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 6ab5a05..447d1dd 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 _0x180f=['exports','name','STRING','sequelize'];(function(_0x321728,_0x1fbc48){var _0x211876=function(_0x5bf9fc){while(--_0x5bf9fc){_0x321728['push'](_0x321728['shift']());}};_0x211876(++_0x1fbc48);}(_0x180f,0xf3));var _0xf180=function(_0x3a19d4,_0x3f19a4){_0x3a19d4=_0x3a19d4-0x0;var _0x5b858b=_0x180f[_0x3a19d4];return _0x5b858b;};'use strict';var Sequelize=require(_0xf180('0x0'));module[_0xf180('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xf180('0x2')},'table':{'type':Sequelize[_0xf180('0x3')]},'metric':{'type':Sequelize['TEXT']},'description':{'type':Sequelize[_0xf180('0x3')]}}; \ No newline at end of file +var _0x23a3=['TEXT','STRING','name'];(function(_0x2f398d,_0x41c205){var _0x383fd5=function(_0x1cbc4b){while(--_0x1cbc4b){_0x2f398d['push'](_0x2f398d['shift']());}};_0x383fd5(++_0x41c205);}(_0x23a3,0x131));var _0x323a=function(_0x2fcaa3,_0x2ba904){_0x2fcaa3=_0x2fcaa3-0x0;var _0x8f4089=_0x23a3[_0x2fcaa3];return _0x8f4089;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x323a('0x0')},'table':{'type':Sequelize['STRING']},'metric':{'type':Sequelize[_0x323a('0x1')]},'description':{'type':Sequelize[_0x323a('0x2')]}}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.controller.js b/server/api/analyticMetric/analyticMetric.controller.js index c16798e..c8e18a2 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 _0x1cb9=['user','Unable\x20to\x20retrieve\x20the\x20current\x20user','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','undefined','limit','count','offset','Content-Range','json','reject','save','update','then','destroy','get','Metrics','error','stack','name','send','index','map','AnalyticMetric','rawAttributes','fieldName','key','model','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','merge','type','filter','options','includeAll','include','findAll','show','params','keys','length','find','catch'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1cb9,0x14e));var _0x91cb=function(_0x4f3168,_0xb57b40){_0x4f3168=_0x4f3168-0x0;var _0x1271c8=_0x1cb9[_0x4f3168];return _0x1271c8;};'use strict';var emlformat=require(_0x91cb('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x91cb('0x1'));var jsonpatch=require(_0x91cb('0x2'));var rp=require(_0x91cb('0x3'));var moment=require(_0x91cb('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x91cb('0x5'));var util=require(_0x91cb('0x6'));var path=require('path');var sox=require(_0x91cb('0x7'));var csv=require(_0x91cb('0x8'));var ejs=require(_0x91cb('0x9'));var fs=require('fs');var fs_extra=require(_0x91cb('0xa'));var _=require(_0x91cb('0xb'));var squel=require(_0x91cb('0xc'));var crypto=require('crypto');var jsforce=require(_0x91cb('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x91cb('0x8'));var querystring=require('querystring');var Papa=require(_0x91cb('0xe'));var Redis=require(_0x91cb('0xf'));var authService=require(_0x91cb('0x10'));var qs=require(_0x91cb('0x11'));var as=require(_0x91cb('0x12'));var hardwareService=require(_0x91cb('0x13'));var logger=require(_0x91cb('0x14'))(_0x91cb('0x15'));var utils=require(_0x91cb('0x16'));var config=require(_0x91cb('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x91cb('0x18'))['db'];function respondWithStatusCode(_0x366f09,_0x4ba2f2){_0x4ba2f2=_0x4ba2f2||0xcc;return function(_0x20e6e0){if(_0x20e6e0){return _0x366f09[_0x91cb('0x19')](_0x4ba2f2);}return _0x366f09[_0x91cb('0x1a')](_0x4ba2f2)[_0x91cb('0x1b')]();};}function respondWithResult(_0x4a7d45,_0x4cc6ef){_0x4cc6ef=_0x4cc6ef||0xc8;return function(_0x4aae25){if(_0x4aae25){return _0x4a7d45[_0x91cb('0x1a')](_0x4cc6ef)['json'](_0x4aae25);}};}function respondWithFilteredResult(_0x528f73,_0x576369){return function(_0xc3629e){if(_0xc3629e){var _0x347980=typeof _0x576369['offset']===_0x91cb('0x1c')&&typeof _0x576369[_0x91cb('0x1d')]==='undefined';var _0xc594e3=_0xc3629e[_0x91cb('0x1e')];var _0x1cd34b=_0x347980?0x0:_0x576369[_0x91cb('0x1f')];var _0x5cc1c3=_0x347980?_0xc3629e[_0x91cb('0x1e')]:_0x576369[_0x91cb('0x1f')]+_0x576369['limit'];var _0x123847;if(_0x5cc1c3>=_0xc594e3){_0x5cc1c3=_0xc594e3;_0x123847=0xc8;}else{_0x123847=0xce;}_0x528f73['status'](_0x123847);return _0x528f73['set'](_0x91cb('0x20'),_0x1cd34b+'-'+_0x5cc1c3+'/'+_0xc594e3)[_0x91cb('0x21')](_0xc3629e);}return null;};}function patchUpdates(_0x56e409){return function(_0x51a1d5){try{jsonpatch['apply'](_0x51a1d5,_0x56e409,!![]);}catch(_0x438162){return BPromise[_0x91cb('0x22')](_0x438162);}return _0x51a1d5[_0x91cb('0x23')]();};}function saveUpdates(_0x1dbee2,_0x5c6a15){return function(_0x45c4b3){if(_0x45c4b3){return _0x45c4b3[_0x91cb('0x24')](_0x1dbee2)[_0x91cb('0x25')](function(_0x55fa78){return _0x55fa78;});}return null;};}function removeEntity(_0x26f18f,_0x1a7a54){return function(_0x2447e7){if(_0x2447e7){return _0x2447e7[_0x91cb('0x26')]()[_0x91cb('0x25')](function(){var _0x7ad361=_0x2447e7[_0x91cb('0x27')]({'plain':!![]});var _0x423c4f=_0x91cb('0x28');return db['UserProfileResource']['destroy']({'where':{'type':_0x423c4f,'resourceId':_0x7ad361['id']}})[_0x91cb('0x25')](function(){return _0x2447e7;});})['then'](function(){_0x26f18f[_0x91cb('0x1a')](0xcc)[_0x91cb('0x1b')]();});}};}function handleEntityNotFound(_0x318031,_0x5595c5){return function(_0x9b26a6){if(!_0x9b26a6){_0x318031['sendStatus'](0x194);}return _0x9b26a6;};}function handleError(_0x4572f6,_0x308e8c){_0x308e8c=_0x308e8c||0x1f4;return function(_0x3b3ee6){logger[_0x91cb('0x29')](_0x3b3ee6[_0x91cb('0x2a')]);if(_0x3b3ee6['name']){delete _0x3b3ee6[_0x91cb('0x2b')];}_0x4572f6['status'](_0x308e8c)[_0x91cb('0x2c')](_0x3b3ee6);};}exports[_0x91cb('0x2d')]=function(_0x445fe1,_0x4944bd){var _0x775c25={},_0x146e1f={},_0x25bbf9={'count':0x0,'rows':[]};var _0x361e4c=_[_0x91cb('0x2e')](db[_0x91cb('0x2f')][_0x91cb('0x30')],function(_0x3bbde3){return{'name':_0x3bbde3[_0x91cb('0x31')],'type':_0x3bbde3['type'][_0x91cb('0x32')]};});_0x146e1f[_0x91cb('0x33')]=_[_0x91cb('0x2e')](_0x361e4c,_0x91cb('0x2b'));_0x146e1f[_0x91cb('0x34')]=_['keys'](_0x445fe1[_0x91cb('0x34')]);_0x146e1f[_0x91cb('0x35')]=_[_0x91cb('0x36')](_0x146e1f[_0x91cb('0x33')],_0x146e1f[_0x91cb('0x34')]);_0x775c25['attributes']=_[_0x91cb('0x36')](_0x146e1f['model'],qs['fields'](_0x445fe1['query'][_0x91cb('0x37')]));_0x775c25['attributes']=_0x775c25[_0x91cb('0x38')]['length']?_0x775c25['attributes']:_0x146e1f[_0x91cb('0x33')];if(!_0x445fe1[_0x91cb('0x34')][_0x91cb('0x39')](_0x91cb('0x3a'))){_0x775c25[_0x91cb('0x1d')]=qs['limit'](_0x445fe1[_0x91cb('0x34')][_0x91cb('0x1d')]);_0x775c25[_0x91cb('0x1f')]=qs[_0x91cb('0x1f')](_0x445fe1['query']['offset']);}_0x775c25[_0x91cb('0x3b')]=qs[_0x91cb('0x3c')](_0x445fe1['query'][_0x91cb('0x3c')]);_0x775c25[_0x91cb('0x3d')]=qs['filters'](_[_0x91cb('0x3e')](_0x445fe1[_0x91cb('0x34')],_0x146e1f['filters']),_0x361e4c);if(_0x445fe1[_0x91cb('0x34')]['filter']){_0x775c25[_0x91cb('0x3d')]=_[_0x91cb('0x3f')](_0x775c25[_0x91cb('0x3d')],{'$or':_[_0x91cb('0x2e')](_0x361e4c,function(_0x51d0ea){if(_0x51d0ea[_0x91cb('0x40')]!=='VIRTUAL'){var _0xa90111={};_0xa90111[_0x51d0ea[_0x91cb('0x2b')]]={'$like':'%'+_0x445fe1['query'][_0x91cb('0x41')]+'%'};return _0xa90111;}})});}_0x775c25=_['merge']({},_0x775c25,_0x445fe1[_0x91cb('0x42')]);var _0x2eac87={'where':_0x775c25[_0x91cb('0x3d')]};return db[_0x91cb('0x2f')]['count'](_0x2eac87)[_0x91cb('0x25')](function(_0x5af0e6){_0x25bbf9[_0x91cb('0x1e')]=_0x5af0e6;if(_0x445fe1[_0x91cb('0x34')][_0x91cb('0x43')]){_0x775c25[_0x91cb('0x44')]=[{'all':!![]}];}return db[_0x91cb('0x2f')][_0x91cb('0x45')](_0x775c25);})[_0x91cb('0x25')](function(_0x3cc4c1){_0x25bbf9['rows']=_0x3cc4c1;return _0x25bbf9;})[_0x91cb('0x25')](respondWithFilteredResult(_0x4944bd,_0x775c25))['catch'](handleError(_0x4944bd,null));};exports[_0x91cb('0x46')]=function(_0x5537a0,_0x335879){var _0x52e82c={'raw':!![],'where':{'id':_0x5537a0[_0x91cb('0x47')]['id']}},_0x138f48={};_0x138f48[_0x91cb('0x33')]=_[_0x91cb('0x48')](db['AnalyticMetric'][_0x91cb('0x30')]);_0x138f48[_0x91cb('0x34')]=_['keys'](_0x5537a0[_0x91cb('0x34')]);_0x138f48[_0x91cb('0x35')]=_[_0x91cb('0x36')](_0x138f48[_0x91cb('0x33')],_0x138f48[_0x91cb('0x34')]);_0x52e82c[_0x91cb('0x38')]=_[_0x91cb('0x36')](_0x138f48[_0x91cb('0x33')],qs[_0x91cb('0x37')](_0x5537a0['query'][_0x91cb('0x37')]));_0x52e82c[_0x91cb('0x38')]=_0x52e82c[_0x91cb('0x38')][_0x91cb('0x49')]?_0x52e82c[_0x91cb('0x38')]:_0x138f48[_0x91cb('0x33')];if(_0x5537a0[_0x91cb('0x34')][_0x91cb('0x43')]){_0x52e82c['include']=[{'all':!![]}];}_0x52e82c=_[_0x91cb('0x3f')]({},_0x52e82c,_0x5537a0[_0x91cb('0x42')]);return db[_0x91cb('0x2f')][_0x91cb('0x4a')](_0x52e82c)['then'](handleEntityNotFound(_0x335879,null))[_0x91cb('0x25')](respondWithResult(_0x335879,null))[_0x91cb('0x4b')](handleError(_0x335879,null));};exports['create']=function(_0x212473,_0x47cdb7){return db[_0x91cb('0x2f')]['create'](_0x212473['body'],{})['then'](function(_0x98245b){var _0xff3d11=_0x212473[_0x91cb('0x4c')][_0x91cb('0x27')]({'plain':!![]});if(!_0xff3d11)throw new Error(_0x91cb('0x4d'));if(_0xff3d11['role']==='user'){var _0x1d26b8=_0x98245b[_0x91cb('0x27')]({'plain':!![]});var _0x140994=_0x91cb('0x28');return db['UserProfileSection']['find']({'where':{'name':_0x140994,'userProfileId':_0xff3d11['userProfileId']},'raw':!![]})[_0x91cb('0x25')](function(_0x490417){if(_0x490417&&_0x490417[_0x91cb('0x4e')]===0x0){return db['UserProfileResource'][_0x91cb('0x4f')]({'name':_0x1d26b8[_0x91cb('0x2b')],'resourceId':_0x1d26b8['id'],'type':_0x490417[_0x91cb('0x2b')],'sectionId':_0x490417['id']},{})[_0x91cb('0x25')](function(){return _0x98245b;});}else{return _0x98245b;}})[_0x91cb('0x4b')](function(_0x362532){logger[_0x91cb('0x29')](_0x91cb('0x50'),_0x362532);throw _0x362532;});}return _0x98245b;})[_0x91cb('0x25')](respondWithResult(_0x47cdb7,0xc9))[_0x91cb('0x4b')](handleError(_0x47cdb7,null));};exports[_0x91cb('0x24')]=function(_0x5752ed,_0x1e445a){if(_0x5752ed[_0x91cb('0x51')]['id']){delete _0x5752ed['body']['id'];}return db[_0x91cb('0x2f')][_0x91cb('0x4a')]({'where':{'id':_0x5752ed['params']['id']}})[_0x91cb('0x25')](handleEntityNotFound(_0x1e445a,null))[_0x91cb('0x25')](saveUpdates(_0x5752ed[_0x91cb('0x51')],null))[_0x91cb('0x25')](respondWithResult(_0x1e445a,null))[_0x91cb('0x4b')](handleError(_0x1e445a,null));};exports[_0x91cb('0x26')]=function(_0x1d4b96,_0x274fff){return db[_0x91cb('0x2f')][_0x91cb('0x4a')]({'where':{'id':_0x1d4b96[_0x91cb('0x47')]['id']}})['then'](handleEntityNotFound(_0x274fff,null))[_0x91cb('0x25')](removeEntity(_0x274fff,null))['catch'](handleError(_0x274fff,null));}; \ No newline at end of file +var _0x7fbe=['util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','save','update','then','get','UserProfileResource','destroy','end','error','stack','name','send','index','AnalyticMetric','fieldName','type','key','map','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','rows','show','params','create','body','role','user','Metrics','find','autoAssociation','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache'];(function(_0x4f15ec,_0x5b25fd){var _0x1c1548=function(_0x580618){while(--_0x580618){_0x4f15ec['push'](_0x4f15ec['shift']());}};_0x1c1548(++_0x5b25fd);}(_0x7fbe,0x1ec));var _0xe7fb=function(_0x535963,_0x326515){_0x535963=_0x535963-0x0;var _0x3975f6=_0x7fbe[_0x535963];return _0x3975f6;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xe7fb('0x0'));var jsonpatch=require(_0xe7fb('0x1'));var rp=require(_0xe7fb('0x2'));var moment=require(_0xe7fb('0x3'));var BPromise=require(_0xe7fb('0x4'));var Mustache=require(_0xe7fb('0x5'));var util=require(_0xe7fb('0x6'));var path=require(_0xe7fb('0x7'));var sox=require(_0xe7fb('0x8'));var csv=require(_0xe7fb('0x9'));var ejs=require(_0xe7fb('0xa'));var fs=require('fs');var fs_extra=require(_0xe7fb('0xb'));var _=require(_0xe7fb('0xc'));var squel=require(_0xe7fb('0xd'));var crypto=require('crypto');var jsforce=require(_0xe7fb('0xe'));var deskjs=require(_0xe7fb('0xf'));var toCsv=require(_0xe7fb('0x9'));var querystring=require(_0xe7fb('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xe7fb('0x11'));var qs=require(_0xe7fb('0x12'));var as=require(_0xe7fb('0x13'));var hardwareService=require(_0xe7fb('0x14'));var logger=require(_0xe7fb('0x15'))(_0xe7fb('0x16'));var utils=require(_0xe7fb('0x17'));var config=require(_0xe7fb('0x18'));var licenseUtil=require(_0xe7fb('0x19'));var db=require(_0xe7fb('0x1a'))['db'];function respondWithStatusCode(_0x2437d4,_0x188e1d){_0x188e1d=_0x188e1d||0xcc;return function(_0xdf9760){if(_0xdf9760){return _0x2437d4[_0xe7fb('0x1b')](_0x188e1d);}return _0x2437d4[_0xe7fb('0x1c')](_0x188e1d)['end']();};}function respondWithResult(_0x278b75,_0x2225e5){_0x2225e5=_0x2225e5||0xc8;return function(_0x5573ab){if(_0x5573ab){return _0x278b75[_0xe7fb('0x1c')](_0x2225e5)[_0xe7fb('0x1d')](_0x5573ab);}};}function respondWithFilteredResult(_0x482f7d,_0xa76acf){return function(_0x559129){if(_0x559129){var _0x12fff6=typeof _0xa76acf[_0xe7fb('0x1e')]===_0xe7fb('0x1f')&&typeof _0xa76acf[_0xe7fb('0x20')]==='undefined';var _0x892b0f=_0x559129['count'];var _0x293a47=_0x12fff6?0x0:_0xa76acf['offset'];var _0x1e77fd=_0x12fff6?_0x559129[_0xe7fb('0x21')]:_0xa76acf[_0xe7fb('0x1e')]+_0xa76acf[_0xe7fb('0x20')];var _0x5df1a1;if(_0x1e77fd>=_0x892b0f){_0x1e77fd=_0x892b0f;_0x5df1a1=0xc8;}else{_0x5df1a1=0xce;}_0x482f7d[_0xe7fb('0x1c')](_0x5df1a1);return _0x482f7d['set'](_0xe7fb('0x22'),_0x293a47+'-'+_0x1e77fd+'/'+_0x892b0f)['json'](_0x559129);}return null;};}function patchUpdates(_0x15f7a4){return function(_0x4ea664){try{jsonpatch[_0xe7fb('0x23')](_0x4ea664,_0x15f7a4,!![]);}catch(_0x135624){return BPromise['reject'](_0x135624);}return _0x4ea664[_0xe7fb('0x24')]();};}function saveUpdates(_0x4742bd,_0x3ae8f1){return function(_0x4dcb4b){if(_0x4dcb4b){return _0x4dcb4b[_0xe7fb('0x25')](_0x4742bd)[_0xe7fb('0x26')](function(_0x5da3d9){return _0x5da3d9;});}return null;};}function removeEntity(_0x5bea27,_0x52f08b){return function(_0x35e4db){if(_0x35e4db){return _0x35e4db['destroy']()['then'](function(){var _0x4026b1=_0x35e4db[_0xe7fb('0x27')]({'plain':!![]});var _0x2996ae='Metrics';return db[_0xe7fb('0x28')][_0xe7fb('0x29')]({'where':{'type':_0x2996ae,'resourceId':_0x4026b1['id']}})[_0xe7fb('0x26')](function(){return _0x35e4db;});})[_0xe7fb('0x26')](function(){_0x5bea27[_0xe7fb('0x1c')](0xcc)[_0xe7fb('0x2a')]();});}};}function handleEntityNotFound(_0x380130,_0x59e015){return function(_0x5df9f2){if(!_0x5df9f2){_0x380130[_0xe7fb('0x1b')](0x194);}return _0x5df9f2;};}function handleError(_0x3bdee9,_0xead63){_0xead63=_0xead63||0x1f4;return function(_0x4fd290){logger[_0xe7fb('0x2b')](_0x4fd290[_0xe7fb('0x2c')]);if(_0x4fd290[_0xe7fb('0x2d')]){delete _0x4fd290[_0xe7fb('0x2d')];}_0x3bdee9[_0xe7fb('0x1c')](_0xead63)[_0xe7fb('0x2e')](_0x4fd290);};}exports[_0xe7fb('0x2f')]=function(_0x3dd0be,_0x4ce993){var _0x3d1fb5={},_0x1742f3={},_0x29d1ca={'count':0x0,'rows':[]};var _0x547a04=_['map'](db[_0xe7fb('0x30')]['rawAttributes'],function(_0xac56b4){return{'name':_0xac56b4[_0xe7fb('0x31')],'type':_0xac56b4[_0xe7fb('0x32')][_0xe7fb('0x33')]};});_0x1742f3['model']=_[_0xe7fb('0x34')](_0x547a04,_0xe7fb('0x2d'));_0x1742f3[_0xe7fb('0x35')]=_[_0xe7fb('0x36')](_0x3dd0be[_0xe7fb('0x35')]);_0x1742f3['filters']=_[_0xe7fb('0x37')](_0x1742f3[_0xe7fb('0x38')],_0x1742f3[_0xe7fb('0x35')]);_0x3d1fb5[_0xe7fb('0x39')]=_[_0xe7fb('0x37')](_0x1742f3[_0xe7fb('0x38')],qs[_0xe7fb('0x3a')](_0x3dd0be[_0xe7fb('0x35')][_0xe7fb('0x3a')]));_0x3d1fb5['attributes']=_0x3d1fb5[_0xe7fb('0x39')][_0xe7fb('0x3b')]?_0x3d1fb5[_0xe7fb('0x39')]:_0x1742f3['model'];if(!_0x3dd0be[_0xe7fb('0x35')][_0xe7fb('0x3c')](_0xe7fb('0x3d'))){_0x3d1fb5[_0xe7fb('0x20')]=qs[_0xe7fb('0x20')](_0x3dd0be[_0xe7fb('0x35')][_0xe7fb('0x20')]);_0x3d1fb5[_0xe7fb('0x1e')]=qs[_0xe7fb('0x1e')](_0x3dd0be[_0xe7fb('0x35')][_0xe7fb('0x1e')]);}_0x3d1fb5[_0xe7fb('0x3e')]=qs[_0xe7fb('0x3f')](_0x3dd0be[_0xe7fb('0x35')][_0xe7fb('0x3f')]);_0x3d1fb5[_0xe7fb('0x40')]=qs[_0xe7fb('0x41')](_[_0xe7fb('0x42')](_0x3dd0be[_0xe7fb('0x35')],_0x1742f3['filters']),_0x547a04);if(_0x3dd0be[_0xe7fb('0x35')][_0xe7fb('0x43')]){_0x3d1fb5[_0xe7fb('0x40')]=_[_0xe7fb('0x44')](_0x3d1fb5['where'],{'$or':_[_0xe7fb('0x34')](_0x547a04,function(_0x186418){if(_0x186418[_0xe7fb('0x32')]!==_0xe7fb('0x45')){var _0x49fe9d={};_0x49fe9d[_0x186418[_0xe7fb('0x2d')]]={'$like':'%'+_0x3dd0be[_0xe7fb('0x35')][_0xe7fb('0x43')]+'%'};return _0x49fe9d;}})});}_0x3d1fb5=_[_0xe7fb('0x44')]({},_0x3d1fb5,_0x3dd0be[_0xe7fb('0x46')]);var _0xb729fc={'where':_0x3d1fb5['where']};return db[_0xe7fb('0x30')][_0xe7fb('0x21')](_0xb729fc)[_0xe7fb('0x26')](function(_0x4b263d){_0x29d1ca[_0xe7fb('0x21')]=_0x4b263d;if(_0x3dd0be[_0xe7fb('0x35')]['includeAll']){_0x3d1fb5['include']=[{'all':!![]}];}return db['AnalyticMetric']['findAll'](_0x3d1fb5);})['then'](function(_0x900d67){_0x29d1ca[_0xe7fb('0x47')]=_0x900d67;return _0x29d1ca;})[_0xe7fb('0x26')](respondWithFilteredResult(_0x4ce993,_0x3d1fb5))['catch'](handleError(_0x4ce993,null));};exports[_0xe7fb('0x48')]=function(_0x58d743,_0x19277f){var _0x32cfa4={'raw':!![],'where':{'id':_0x58d743[_0xe7fb('0x49')]['id']}},_0x4d29d3={};_0x4d29d3[_0xe7fb('0x38')]=_[_0xe7fb('0x36')](db[_0xe7fb('0x30')]['rawAttributes']);_0x4d29d3[_0xe7fb('0x35')]=_[_0xe7fb('0x36')](_0x58d743[_0xe7fb('0x35')]);_0x4d29d3['filters']=_[_0xe7fb('0x37')](_0x4d29d3[_0xe7fb('0x38')],_0x4d29d3[_0xe7fb('0x35')]);_0x32cfa4[_0xe7fb('0x39')]=_[_0xe7fb('0x37')](_0x4d29d3['model'],qs[_0xe7fb('0x3a')](_0x58d743['query'][_0xe7fb('0x3a')]));_0x32cfa4[_0xe7fb('0x39')]=_0x32cfa4[_0xe7fb('0x39')][_0xe7fb('0x3b')]?_0x32cfa4[_0xe7fb('0x39')]:_0x4d29d3['model'];if(_0x58d743[_0xe7fb('0x35')]['includeAll']){_0x32cfa4['include']=[{'all':!![]}];}_0x32cfa4=_[_0xe7fb('0x44')]({},_0x32cfa4,_0x58d743[_0xe7fb('0x46')]);return db[_0xe7fb('0x30')]['find'](_0x32cfa4)[_0xe7fb('0x26')](handleEntityNotFound(_0x19277f,null))[_0xe7fb('0x26')](respondWithResult(_0x19277f,null))['catch'](handleError(_0x19277f,null));};exports['create']=function(_0x284bcb,_0x42270b){return db[_0xe7fb('0x30')][_0xe7fb('0x4a')](_0x284bcb[_0xe7fb('0x4b')],{})[_0xe7fb('0x26')](function(_0x18a590){var _0x347177=_0x284bcb['user'][_0xe7fb('0x27')]({'plain':!![]});if(!_0x347177)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x347177[_0xe7fb('0x4c')]===_0xe7fb('0x4d')){var _0x5cedfb=_0x18a590[_0xe7fb('0x27')]({'plain':!![]});var _0x5efd24=_0xe7fb('0x4e');return db['UserProfileSection'][_0xe7fb('0x4f')]({'where':{'name':_0x5efd24,'userProfileId':_0x347177['userProfileId']},'raw':!![]})[_0xe7fb('0x26')](function(_0x59158c){if(_0x59158c&&_0x59158c[_0xe7fb('0x50')]===0x0){return db[_0xe7fb('0x28')][_0xe7fb('0x4a')]({'name':_0x5cedfb[_0xe7fb('0x2d')],'resourceId':_0x5cedfb['id'],'type':_0x59158c[_0xe7fb('0x2d')],'sectionId':_0x59158c['id']},{})[_0xe7fb('0x26')](function(){return _0x18a590;});}else{return _0x18a590;}})[_0xe7fb('0x51')](function(_0x582a4a){logger['error'](_0xe7fb('0x52'),_0x582a4a);throw _0x582a4a;});}return _0x18a590;})['then'](respondWithResult(_0x42270b,0xc9))['catch'](handleError(_0x42270b,null));};exports['update']=function(_0x50b8df,_0x539252){if(_0x50b8df[_0xe7fb('0x4b')]['id']){delete _0x50b8df[_0xe7fb('0x4b')]['id'];}return db[_0xe7fb('0x30')][_0xe7fb('0x4f')]({'where':{'id':_0x50b8df['params']['id']}})[_0xe7fb('0x26')](handleEntityNotFound(_0x539252,null))[_0xe7fb('0x26')](saveUpdates(_0x50b8df[_0xe7fb('0x4b')],null))['then'](respondWithResult(_0x539252,null))['catch'](handleError(_0x539252,null));};exports[_0xe7fb('0x29')]=function(_0x377e5f,_0x300b8e){return db['AnalyticMetric'][_0xe7fb('0x4f')]({'where':{'id':_0x377e5f[_0xe7fb('0x49')]['id']}})[_0xe7fb('0x26')](handleEntityNotFound(_0x300b8e,null))[_0xe7fb('0x26')](removeEntity(_0x300b8e,null))['catch'](handleError(_0x300b8e,null));}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.model.js b/server/api/analyticMetric/analyticMetric.model.js index f900ccb..ca3ea5c 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 _0x13f5=['define','AnalyticMetric','analytics_metrics','lodash','util','../../config/logger','api','bluebird','rimraf','../../config/environment','./analyticMetric.attributes','exports'];(function(_0x1235a8,_0x2db48e){var _0x41a2cf=function(_0x2c30df){while(--_0x2c30df){_0x1235a8['push'](_0x1235a8['shift']());}};_0x41a2cf(++_0x2db48e);}(_0x13f5,0xc3));var _0x513f=function(_0x178e48,_0x3c9509){_0x178e48=_0x178e48-0x0;var _0x440d7e=_0x13f5[_0x178e48];return _0x440d7e;};'use strict';var _=require(_0x513f('0x0'));var util=require(_0x513f('0x1'));var logger=require(_0x513f('0x2'))(_0x513f('0x3'));var moment=require('moment');var BPromise=require(_0x513f('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x513f('0x5'));var config=require(_0x513f('0x6'));var attributes=require(_0x513f('0x7'));module[_0x513f('0x8')]=function(_0x8d019b,_0x579681){return _0x8d019b[_0x513f('0x9')](_0x513f('0xa'),attributes,{'tableName':_0x513f('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xea31=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./analyticMetric.attributes','exports','define','analytics_metrics','lodash'];(function(_0x4d9820,_0x2c08f6){var _0x491cc2=function(_0x3cba49){while(--_0x3cba49){_0x4d9820['push'](_0x4d9820['shift']());}};_0x491cc2(++_0x2c08f6);}(_0xea31,0x6b));var _0x1ea3=function(_0x1e7e0f,_0x4f355){_0x1e7e0f=_0x1e7e0f-0x0;var _0x3ee999=_0xea31[_0x1e7e0f];return _0x3ee999;};'use strict';var _=require(_0x1ea3('0x0'));var util=require('util');var logger=require(_0x1ea3('0x1'))(_0x1ea3('0x2'));var moment=require(_0x1ea3('0x3'));var BPromise=require(_0x1ea3('0x4'));var rp=require(_0x1ea3('0x5'));var fs=require('fs');var path=require(_0x1ea3('0x6'));var rimraf=require(_0x1ea3('0x7'));var config=require('../../config/environment');var attributes=require(_0x1ea3('0x8'));module[_0x1ea3('0x9')]=function(_0x6810da,_0x27c695){return _0x6810da[_0x1ea3('0xa')]('AnalyticMetric',attributes,{'tableName':_0x1ea3('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.rpc.js b/server/api/analyticMetric/analyticMetric.rpc.js index b4f3ab3..931db8c 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 _0x43f1=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','then','info','AnalyticMetric,\x20%s,\x20%s','request\x20sent','debug','AnalyticMetric,\x20%s,\x20%s,\x20%s','stringify','error','message','result','lodash','util','moment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x43f1,0x15d));var _0x143f=function(_0x1aeda2,_0x1217eb){_0x1aeda2=_0x1aeda2-0x0;var _0x32dc6d=_0x43f1[_0x1aeda2];return _0x32dc6d;};'use strict';var _=require(_0x143f('0x0'));var util=require(_0x143f('0x1'));var moment=require(_0x143f('0x2'));var BPromise=require(_0x143f('0x3'));var rs=require(_0x143f('0x4'));var fs=require('fs');var Redis=require(_0x143f('0x5'));var db=require(_0x143f('0x6'))['db'];var utils=require(_0x143f('0x7'));var logger=require('../../config/logger')(_0x143f('0x8'));var config=require('../../config/environment');var jayson=require(_0x143f('0x9'));var client=jayson[_0x143f('0xa')][_0x143f('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x24e9b2,_0x15bb41,_0x504377){return new BPromise(function(_0xa0f99c,_0x5c4003){return client['request'](_0x24e9b2,_0x504377)[_0x143f('0xc')](function(_0x30c2da){logger[_0x143f('0xd')](_0x143f('0xe'),_0x15bb41,_0x143f('0xf'));logger[_0x143f('0x10')](_0x143f('0x11'),_0x15bb41,_0x143f('0xf'),JSON[_0x143f('0x12')](_0x30c2da));if(_0x30c2da['error']){if(_0x30c2da[_0x143f('0x13')]['code']===0x1f4){logger['error'](_0x143f('0xe'),_0x15bb41,_0x30c2da[_0x143f('0x13')]['message']);return _0x5c4003(_0x30c2da[_0x143f('0x13')][_0x143f('0x14')]);}logger[_0x143f('0x13')](_0x143f('0xe'),_0x15bb41,_0x30c2da[_0x143f('0x13')][_0x143f('0x14')]);return _0xa0f99c(_0x30c2da[_0x143f('0x13')][_0x143f('0x14')]);}else{logger[_0x143f('0xd')](_0x143f('0xe'),_0x15bb41,_0x143f('0xf'));_0xa0f99c(_0x30c2da[_0x143f('0x15')][_0x143f('0x14')]);}})['catch'](function(_0x469d76){logger[_0x143f('0x13')](_0x143f('0xe'),_0x15bb41,_0x469d76);_0x5c4003(_0x469d76);});});} \ No newline at end of file +var _0x15af=['error','AnalyticMetric,\x20%s,\x20%s','message','result','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request','then','info','request\x20sent','AnalyticMetric,\x20%s,\x20%s,\x20%s'];(function(_0x1701e5,_0x7f9087){var _0x4ffbba=function(_0x40f73f){while(--_0x40f73f){_0x1701e5['push'](_0x1701e5['shift']());}};_0x4ffbba(++_0x7f9087);}(_0x15af,0xb9));var _0xf15a=function(_0x2d4661,_0x2da65c){_0x2d4661=_0x2d4661-0x0;var _0x42ed1e=_0x15af[_0x2d4661];return _0x42ed1e;};'use strict';var _=require('lodash');var util=require(_0xf15a('0x0'));var moment=require(_0xf15a('0x1'));var BPromise=require('bluebird');var rs=require(_0xf15a('0x2'));var fs=require('fs');var Redis=require(_0xf15a('0x3'));var db=require(_0xf15a('0x4'))['db'];var utils=require(_0xf15a('0x5'));var logger=require(_0xf15a('0x6'))('rpc');var config=require(_0xf15a('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xf15a('0x8')][_0xf15a('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x225fbe,_0x35777c,_0x38e403){return new BPromise(function(_0x138a68,_0x54ff2c){return client[_0xf15a('0xa')](_0x225fbe,_0x38e403)[_0xf15a('0xb')](function(_0x31ba28){logger[_0xf15a('0xc')]('AnalyticMetric,\x20%s,\x20%s',_0x35777c,_0xf15a('0xd'));logger['debug'](_0xf15a('0xe'),_0x35777c,_0xf15a('0xd'),JSON['stringify'](_0x31ba28));if(_0x31ba28[_0xf15a('0xf')]){if(_0x31ba28[_0xf15a('0xf')]['code']===0x1f4){logger[_0xf15a('0xf')](_0xf15a('0x10'),_0x35777c,_0x31ba28[_0xf15a('0xf')]['message']);return _0x54ff2c(_0x31ba28[_0xf15a('0xf')][_0xf15a('0x11')]);}logger[_0xf15a('0xf')](_0xf15a('0x10'),_0x35777c,_0x31ba28[_0xf15a('0xf')][_0xf15a('0x11')]);return _0x138a68(_0x31ba28[_0xf15a('0xf')][_0xf15a('0x11')]);}else{logger['info'](_0xf15a('0x10'),_0x35777c,_0xf15a('0xd'));_0x138a68(_0x31ba28[_0xf15a('0x12')][_0xf15a('0x11')]);}})[_0xf15a('0x13')](function(_0x2e200d){logger[_0xf15a('0xf')]('AnalyticMetric,\x20%s,\x20%s',_0x35777c,_0x2e200d);_0x54ff2c(_0x2e200d);});});} \ No newline at end of file diff --git a/server/api/analyticMetric/index.js b/server/api/analyticMetric/index.js index c29ea8e..0bc5310 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 _0x5e0c=['express','Router','fs-extra','../../components/interaction/service','../../config/environment','./analyticMetric.controller','get','isAuthenticated','/:id','show','post','create','update','delete','destroy','exports','util','path','connect-timeout'];(function(_0x7257ea,_0x415c82){var _0x5ac722=function(_0x12a4c0){while(--_0x12a4c0){_0x7257ea['push'](_0x7257ea['shift']());}};_0x5ac722(++_0x415c82);}(_0x5e0c,0x19f));var _0xc5e0=function(_0x21dc36,_0x54664b){_0x21dc36=_0x21dc36-0x0;var _0xcd8586=_0x5e0c[_0x21dc36];return _0xcd8586;};'use strict';var multer=require('multer');var util=require(_0xc5e0('0x0'));var path=require(_0xc5e0('0x1'));var timeout=require(_0xc5e0('0x2'));var express=require(_0xc5e0('0x3'));var router=express[_0xc5e0('0x4')]();var fs_extra=require(_0xc5e0('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xc5e0('0x6'));var config=require(_0xc5e0('0x7'));var controller=require(_0xc5e0('0x8'));router[_0xc5e0('0x9')]('/',auth[_0xc5e0('0xa')](),controller['index']);router['get'](_0xc5e0('0xb'),auth['isAuthenticated'](),controller[_0xc5e0('0xc')]);router[_0xc5e0('0xd')]('/',auth[_0xc5e0('0xa')](),controller[_0xc5e0('0xe')]);router['put'](_0xc5e0('0xb'),auth['isAuthenticated'](),controller[_0xc5e0('0xf')]);router[_0xc5e0('0x10')](_0xc5e0('0xb'),auth[_0xc5e0('0xa')](),controller[_0xc5e0('0x11')]);module[_0xc5e0('0x12')]=router; \ No newline at end of file +var _0xfd6e=['create','put','update','delete','destroy','exports','multer','path','express','Router','../../config/environment','isAuthenticated','index','get','/:id'];(function(_0x5a558e,_0x2c0473){var _0x44eb26=function(_0x1841b4){while(--_0x1841b4){_0x5a558e['push'](_0x5a558e['shift']());}};_0x44eb26(++_0x2c0473);}(_0xfd6e,0x16e));var _0xefd6=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0xfd6e[_0x3ab51d];return _0x29a04e;};'use strict';var multer=require(_0xefd6('0x0'));var util=require('util');var path=require(_0xefd6('0x1'));var timeout=require('connect-timeout');var express=require(_0xefd6('0x2'));var router=express[_0xefd6('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xefd6('0x4'));var controller=require('./analyticMetric.controller');router['get']('/',auth[_0xefd6('0x5')](),controller[_0xefd6('0x6')]);router[_0xefd6('0x7')](_0xefd6('0x8'),auth[_0xefd6('0x5')](),controller['show']);router['post']('/',auth[_0xefd6('0x5')](),controller[_0xefd6('0x9')]);router[_0xefd6('0xa')]('/:id',auth[_0xefd6('0x5')](),controller[_0xefd6('0xb')]);router[_0xefd6('0xc')](_0xefd6('0x8'),auth['isAuthenticated'](),controller[_0xefd6('0xd')]);module[_0xefd6('0xe')]=router; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.attributes.js b/server/api/analyticTreeReport/analyticTreeReport.attributes.js index 329219b..96f89d0 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 _0xb255=['TEXT','sequelize','exports'];(function(_0x372c3e,_0x4ebb70){var _0x4b5b54=function(_0x1f4e7d){while(--_0x1f4e7d){_0x372c3e['push'](_0x372c3e['shift']());}};_0x4b5b54(++_0x4ebb70);}(_0xb255,0x130));var _0x5b25=function(_0xd20f56,_0x4289bf){_0xd20f56=_0xd20f56-0x0;var _0x366917=_0xb255[_0xd20f56];return _0x366917;};'use strict';var Sequelize=require(_0x5b25('0x0'));module[_0x5b25('0x1')]={'tree':{'type':Sequelize[_0x5b25('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0xf318=['exports','sequelize'];(function(_0x209547,_0x34e21d){var _0x2050c1=function(_0x57b26e){while(--_0x57b26e){_0x209547['push'](_0x209547['shift']());}};_0x2050c1(++_0x34e21d);}(_0xf318,0x89));var _0x8f31=function(_0x30de0f,_0x4decdb){_0x30de0f=_0x30de0f-0x0;var _0x5b1808=_0xf318[_0x30de0f];return _0x5b1808;};'use strict';var Sequelize=require(_0x8f31('0x0'));module[_0x8f31('0x1')]={'tree':{'type':Sequelize['TEXT'],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.controller.js b/server/api/analyticTreeReport/analyticTreeReport.controller.js index b14e6ad..db72356 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 _0x9328=['then','destroy','end','error','stack','name','send','index','map','AnalyticTreeReport','rawAttributes','fieldName','key','keys','query','filters','intersection','model','fields','attributes','hasOwnProperty','order','where','pick','filter','merge','type','VIRTUAL','options','includeAll','findAll','rows','catch','show','length','include','find','create','body','params','eml-format','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','json','offset','limit','undefined','count','Content-Range','reject','save','update'];(function(_0x333fed,_0x3d2122){var _0x12cac2=function(_0x41d9af){while(--_0x41d9af){_0x333fed['push'](_0x333fed['shift']());}};_0x12cac2(++_0x3d2122);}(_0x9328,0x100));var _0x8932=function(_0x1e00ee,_0x4f48f5){_0x1e00ee=_0x1e00ee-0x0;var _0x4b4ea4=_0x9328[_0x1e00ee];return _0x4b4ea4;};'use strict';var emlformat=require(_0x8932('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x8932('0x1'));var rp=require(_0x8932('0x2'));var moment=require('moment');var BPromise=require(_0x8932('0x3'));var Mustache=require('mustache');var util=require(_0x8932('0x4'));var path=require(_0x8932('0x5'));var sox=require(_0x8932('0x6'));var csv=require(_0x8932('0x7'));var ejs=require(_0x8932('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x8932('0x9'));var squel=require(_0x8932('0xa'));var crypto=require('crypto');var jsforce=require(_0x8932('0xb'));var deskjs=require(_0x8932('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x8932('0xd'));var qs=require(_0x8932('0xe'));var as=require(_0x8932('0xf'));var hardwareService=require(_0x8932('0x10'));var logger=require(_0x8932('0x11'))(_0x8932('0x12'));var utils=require(_0x8932('0x13'));var config=require(_0x8932('0x14'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3f0eed,_0x13b64e){_0x13b64e=_0x13b64e||0xcc;return function(_0x91f250){if(_0x91f250){return _0x3f0eed[_0x8932('0x15')](_0x13b64e);}return _0x3f0eed[_0x8932('0x16')](_0x13b64e)['end']();};}function respondWithResult(_0x91b6fa,_0x519020){_0x519020=_0x519020||0xc8;return function(_0x3ce343){if(_0x3ce343){return _0x91b6fa[_0x8932('0x16')](_0x519020)[_0x8932('0x17')](_0x3ce343);}};}function respondWithFilteredResult(_0x108f71,_0x1744b3){return function(_0x4b3dbc){if(_0x4b3dbc){var _0x58e534=typeof _0x1744b3[_0x8932('0x18')]==='undefined'&&typeof _0x1744b3[_0x8932('0x19')]===_0x8932('0x1a');var _0x445090=_0x4b3dbc[_0x8932('0x1b')];var _0xceefe9=_0x58e534?0x0:_0x1744b3['offset'];var _0xdfedda=_0x58e534?_0x4b3dbc[_0x8932('0x1b')]:_0x1744b3['offset']+_0x1744b3[_0x8932('0x19')];var _0x319270;if(_0xdfedda>=_0x445090){_0xdfedda=_0x445090;_0x319270=0xc8;}else{_0x319270=0xce;}_0x108f71['status'](_0x319270);return _0x108f71['set'](_0x8932('0x1c'),_0xceefe9+'-'+_0xdfedda+'/'+_0x445090)[_0x8932('0x17')](_0x4b3dbc);}return null;};}function patchUpdates(_0x354051){return function(_0x2daded){try{jsonpatch['apply'](_0x2daded,_0x354051,!![]);}catch(_0x5c7642){return BPromise[_0x8932('0x1d')](_0x5c7642);}return _0x2daded[_0x8932('0x1e')]();};}function saveUpdates(_0x2e77e3,_0x370fb0){return function(_0x244564){if(_0x244564){return _0x244564[_0x8932('0x1f')](_0x2e77e3)[_0x8932('0x20')](function(_0x346d09){return _0x346d09;});}return null;};}function removeEntity(_0x2decd9,_0x20b25d){return function(_0xa46f85){if(_0xa46f85){return _0xa46f85[_0x8932('0x21')]()['then'](function(){_0x2decd9['status'](0xcc)[_0x8932('0x22')]();});}};}function handleEntityNotFound(_0x5ae6a7,_0x58f68b){return function(_0x40523e){if(!_0x40523e){_0x5ae6a7[_0x8932('0x15')](0x194);}return _0x40523e;};}function handleError(_0x4617e0,_0x1f8dbb){_0x1f8dbb=_0x1f8dbb||0x1f4;return function(_0x4e64a1){logger[_0x8932('0x23')](_0x4e64a1[_0x8932('0x24')]);if(_0x4e64a1[_0x8932('0x25')]){delete _0x4e64a1['name'];}_0x4617e0['status'](_0x1f8dbb)[_0x8932('0x26')](_0x4e64a1);};}exports[_0x8932('0x27')]=function(_0x54f8de,_0x346d9f){var _0x542738={},_0x55e7d5={},_0x3b058f={'count':0x0,'rows':[]};var _0x43d3ea=_[_0x8932('0x28')](db[_0x8932('0x29')][_0x8932('0x2a')],function(_0x56ab08){return{'name':_0x56ab08[_0x8932('0x2b')],'type':_0x56ab08['type'][_0x8932('0x2c')]};});_0x55e7d5['model']=_[_0x8932('0x28')](_0x43d3ea,'name');_0x55e7d5['query']=_[_0x8932('0x2d')](_0x54f8de[_0x8932('0x2e')]);_0x55e7d5[_0x8932('0x2f')]=_[_0x8932('0x30')](_0x55e7d5['model'],_0x55e7d5[_0x8932('0x2e')]);_0x542738['attributes']=_['intersection'](_0x55e7d5[_0x8932('0x31')],qs[_0x8932('0x32')](_0x54f8de[_0x8932('0x2e')][_0x8932('0x32')]));_0x542738[_0x8932('0x33')]=_0x542738[_0x8932('0x33')]['length']?_0x542738[_0x8932('0x33')]:_0x55e7d5['model'];if(!_0x54f8de[_0x8932('0x2e')][_0x8932('0x34')]('nolimit')){_0x542738['limit']=qs[_0x8932('0x19')](_0x54f8de[_0x8932('0x2e')][_0x8932('0x19')]);_0x542738[_0x8932('0x18')]=qs[_0x8932('0x18')](_0x54f8de[_0x8932('0x2e')][_0x8932('0x18')]);}_0x542738[_0x8932('0x35')]=qs['sort'](_0x54f8de[_0x8932('0x2e')]['sort']);_0x542738[_0x8932('0x36')]=qs[_0x8932('0x2f')](_[_0x8932('0x37')](_0x54f8de[_0x8932('0x2e')],_0x55e7d5[_0x8932('0x2f')]),_0x43d3ea);if(_0x54f8de[_0x8932('0x2e')][_0x8932('0x38')]){_0x542738[_0x8932('0x36')]=_[_0x8932('0x39')](_0x542738['where'],{'$or':_['map'](_0x43d3ea,function(_0xffe6a7){if(_0xffe6a7[_0x8932('0x3a')]!==_0x8932('0x3b')){var _0x51bf9e={};_0x51bf9e[_0xffe6a7['name']]={'$like':'%'+_0x54f8de[_0x8932('0x2e')][_0x8932('0x38')]+'%'};return _0x51bf9e;}})});}_0x542738=_[_0x8932('0x39')]({},_0x542738,_0x54f8de[_0x8932('0x3c')]);var _0x382fe3={'where':_0x542738[_0x8932('0x36')]};return db[_0x8932('0x29')][_0x8932('0x1b')](_0x382fe3)[_0x8932('0x20')](function(_0x2d580b){_0x3b058f['count']=_0x2d580b;if(_0x54f8de['query'][_0x8932('0x3d')]){_0x542738['include']=[{'all':!![]}];}return db[_0x8932('0x29')][_0x8932('0x3e')](_0x542738);})['then'](function(_0xf04ec){_0x3b058f[_0x8932('0x3f')]=_0xf04ec;return _0x3b058f;})[_0x8932('0x20')](respondWithFilteredResult(_0x346d9f,_0x542738))[_0x8932('0x40')](handleError(_0x346d9f,null));};exports[_0x8932('0x41')]=function(_0x9787ef,_0x4ae01b){var _0x19ad6b={'raw':!![],'where':{'id':_0x9787ef['params']['id']}},_0x6663d3={};_0x6663d3[_0x8932('0x31')]=_['keys'](db['AnalyticTreeReport'][_0x8932('0x2a')]);_0x6663d3[_0x8932('0x2e')]=_[_0x8932('0x2d')](_0x9787ef['query']);_0x6663d3[_0x8932('0x2f')]=_['intersection'](_0x6663d3[_0x8932('0x31')],_0x6663d3[_0x8932('0x2e')]);_0x19ad6b[_0x8932('0x33')]=_[_0x8932('0x30')](_0x6663d3['model'],qs['fields'](_0x9787ef[_0x8932('0x2e')][_0x8932('0x32')]));_0x19ad6b[_0x8932('0x33')]=_0x19ad6b[_0x8932('0x33')][_0x8932('0x42')]?_0x19ad6b['attributes']:_0x6663d3[_0x8932('0x31')];if(_0x9787ef[_0x8932('0x2e')][_0x8932('0x3d')]){_0x19ad6b[_0x8932('0x43')]=[{'all':!![]}];}_0x19ad6b=_[_0x8932('0x39')]({},_0x19ad6b,_0x9787ef['options']);return db[_0x8932('0x29')][_0x8932('0x44')](_0x19ad6b)[_0x8932('0x20')](handleEntityNotFound(_0x4ae01b,null))[_0x8932('0x20')](respondWithResult(_0x4ae01b,null))[_0x8932('0x40')](handleError(_0x4ae01b,null));};exports[_0x8932('0x45')]=function(_0x376a5f,_0x2b5206){return db[_0x8932('0x29')]['create'](_0x376a5f[_0x8932('0x46')],{})[_0x8932('0x20')](respondWithResult(_0x2b5206,0xc9))['catch'](handleError(_0x2b5206,null));};exports[_0x8932('0x1f')]=function(_0x467b38,_0xf190e7){if(_0x467b38[_0x8932('0x46')]['id']){delete _0x467b38[_0x8932('0x46')]['id'];}return db[_0x8932('0x29')][_0x8932('0x44')]({'where':{'id':_0x467b38[_0x8932('0x47')]['id']}})[_0x8932('0x20')](handleEntityNotFound(_0xf190e7,null))[_0x8932('0x20')](saveUpdates(_0x467b38[_0x8932('0x46')],null))['then'](respondWithResult(_0xf190e7,null))[_0x8932('0x40')](handleError(_0xf190e7,null));};exports[_0x8932('0x21')]=function(_0x5c1095,_0x48dda9){return db[_0x8932('0x29')]['find']({'where':{'id':_0x5c1095['params']['id']}})['then'](handleEntityNotFound(_0x48dda9,null))[_0x8932('0x20')](removeEntity(_0x48dda9,null))[_0x8932('0x40')](handleError(_0x48dda9,null));}; \ No newline at end of file +var _0xc0da=['save','update','then','error','stack','send','index','map','AnalyticTreeReport','rawAttributes','fieldName','type','model','name','query','keys','intersection','fields','attributes','length','nolimit','order','sort','filters','pick','filter','where','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','find','create','body','destroy','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','Content-Range','apply','reject'];(function(_0x4f129d,_0x326a68){var _0x11bf8e=function(_0x50af32){while(--_0x50af32){_0x4f129d['push'](_0x4f129d['shift']());}};_0x11bf8e(++_0x326a68);}(_0xc0da,0xc2));var _0xac0d=function(_0x2be66f,_0x3c4c29){_0x2be66f=_0x2be66f-0x0;var _0x403664=_0xc0da[_0x2be66f];return _0x403664;};'use strict';var emlformat=require(_0xac0d('0x0'));var rimraf=require(_0xac0d('0x1'));var zipdir=require(_0xac0d('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xac0d('0x3'));var moment=require(_0xac0d('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xac0d('0x5'));var util=require(_0xac0d('0x6'));var path=require(_0xac0d('0x7'));var sox=require(_0xac0d('0x8'));var csv=require(_0xac0d('0x9'));var ejs=require(_0xac0d('0xa'));var fs=require('fs');var fs_extra=require(_0xac0d('0xb'));var _=require(_0xac0d('0xc'));var squel=require(_0xac0d('0xd'));var crypto=require(_0xac0d('0xe'));var jsforce=require(_0xac0d('0xf'));var deskjs=require(_0xac0d('0x10'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xac0d('0x11'));var Redis=require(_0xac0d('0x12'));var authService=require(_0xac0d('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xac0d('0x14'));var logger=require(_0xac0d('0x15'))('api');var utils=require(_0xac0d('0x16'));var config=require(_0xac0d('0x17'));var licenseUtil=require(_0xac0d('0x18'));var db=require(_0xac0d('0x19'))['db'];function respondWithStatusCode(_0x2fe7c0,_0x4a7cb1){_0x4a7cb1=_0x4a7cb1||0xcc;return function(_0x211014){if(_0x211014){return _0x2fe7c0[_0xac0d('0x1a')](_0x4a7cb1);}return _0x2fe7c0[_0xac0d('0x1b')](_0x4a7cb1)[_0xac0d('0x1c')]();};}function respondWithResult(_0x2fa189,_0x58a18d){_0x58a18d=_0x58a18d||0xc8;return function(_0xf139b9){if(_0xf139b9){return _0x2fa189[_0xac0d('0x1b')](_0x58a18d)[_0xac0d('0x1d')](_0xf139b9);}};}function respondWithFilteredResult(_0xfe21ec,_0x1309d){return function(_0x75cccf){if(_0x75cccf){var _0x46feb7=typeof _0x1309d['offset']===_0xac0d('0x1e')&&typeof _0x1309d[_0xac0d('0x1f')]===_0xac0d('0x1e');var _0x232bdb=_0x75cccf[_0xac0d('0x20')];var _0x4167b6=_0x46feb7?0x0:_0x1309d[_0xac0d('0x21')];var _0x220a01=_0x46feb7?_0x75cccf['count']:_0x1309d[_0xac0d('0x21')]+_0x1309d['limit'];var _0x534ce5;if(_0x220a01>=_0x232bdb){_0x220a01=_0x232bdb;_0x534ce5=0xc8;}else{_0x534ce5=0xce;}_0xfe21ec[_0xac0d('0x1b')](_0x534ce5);return _0xfe21ec['set'](_0xac0d('0x22'),_0x4167b6+'-'+_0x220a01+'/'+_0x232bdb)[_0xac0d('0x1d')](_0x75cccf);}return null;};}function patchUpdates(_0x4ec3d3){return function(_0x3a74b1){try{jsonpatch[_0xac0d('0x23')](_0x3a74b1,_0x4ec3d3,!![]);}catch(_0x34f30c){return BPromise[_0xac0d('0x24')](_0x34f30c);}return _0x3a74b1[_0xac0d('0x25')]();};}function saveUpdates(_0x4af6bc,_0x4ea36c){return function(_0x533986){if(_0x533986){return _0x533986[_0xac0d('0x26')](_0x4af6bc)[_0xac0d('0x27')](function(_0x56e5ed){return _0x56e5ed;});}return null;};}function removeEntity(_0x423400,_0x319f78){return function(_0x54314e){if(_0x54314e){return _0x54314e['destroy']()[_0xac0d('0x27')](function(){_0x423400['status'](0xcc)[_0xac0d('0x1c')]();});}};}function handleEntityNotFound(_0x581cd0,_0x5d8a33){return function(_0x34e311){if(!_0x34e311){_0x581cd0[_0xac0d('0x1a')](0x194);}return _0x34e311;};}function handleError(_0x5a1bbd,_0x449146){_0x449146=_0x449146||0x1f4;return function(_0x427421){logger[_0xac0d('0x28')](_0x427421[_0xac0d('0x29')]);if(_0x427421['name']){delete _0x427421['name'];}_0x5a1bbd[_0xac0d('0x1b')](_0x449146)[_0xac0d('0x2a')](_0x427421);};}exports[_0xac0d('0x2b')]=function(_0x2ad332,_0x162284){var _0xcc6426={},_0x5f4202={},_0x56022f={'count':0x0,'rows':[]};var _0x2c77e9=_[_0xac0d('0x2c')](db[_0xac0d('0x2d')][_0xac0d('0x2e')],function(_0x44b219){return{'name':_0x44b219[_0xac0d('0x2f')],'type':_0x44b219[_0xac0d('0x30')]['key']};});_0x5f4202[_0xac0d('0x31')]=_['map'](_0x2c77e9,_0xac0d('0x32'));_0x5f4202[_0xac0d('0x33')]=_[_0xac0d('0x34')](_0x2ad332[_0xac0d('0x33')]);_0x5f4202['filters']=_[_0xac0d('0x35')](_0x5f4202[_0xac0d('0x31')],_0x5f4202[_0xac0d('0x33')]);_0xcc6426['attributes']=_[_0xac0d('0x35')](_0x5f4202['model'],qs['fields'](_0x2ad332[_0xac0d('0x33')][_0xac0d('0x36')]));_0xcc6426['attributes']=_0xcc6426[_0xac0d('0x37')][_0xac0d('0x38')]?_0xcc6426[_0xac0d('0x37')]:_0x5f4202['model'];if(!_0x2ad332[_0xac0d('0x33')]['hasOwnProperty'](_0xac0d('0x39'))){_0xcc6426[_0xac0d('0x1f')]=qs[_0xac0d('0x1f')](_0x2ad332[_0xac0d('0x33')][_0xac0d('0x1f')]);_0xcc6426[_0xac0d('0x21')]=qs[_0xac0d('0x21')](_0x2ad332[_0xac0d('0x33')][_0xac0d('0x21')]);}_0xcc6426[_0xac0d('0x3a')]=qs[_0xac0d('0x3b')](_0x2ad332['query'][_0xac0d('0x3b')]);_0xcc6426['where']=qs[_0xac0d('0x3c')](_[_0xac0d('0x3d')](_0x2ad332[_0xac0d('0x33')],_0x5f4202['filters']),_0x2c77e9);if(_0x2ad332[_0xac0d('0x33')][_0xac0d('0x3e')]){_0xcc6426[_0xac0d('0x3f')]=_[_0xac0d('0x40')](_0xcc6426[_0xac0d('0x3f')],{'$or':_[_0xac0d('0x2c')](_0x2c77e9,function(_0x5e4de5){if(_0x5e4de5[_0xac0d('0x30')]!==_0xac0d('0x41')){var _0x269e53={};_0x269e53[_0x5e4de5[_0xac0d('0x32')]]={'$like':'%'+_0x2ad332['query']['filter']+'%'};return _0x269e53;}})});}_0xcc6426=_[_0xac0d('0x40')]({},_0xcc6426,_0x2ad332[_0xac0d('0x42')]);var _0x2f2425={'where':_0xcc6426[_0xac0d('0x3f')]};return db[_0xac0d('0x2d')]['count'](_0x2f2425)[_0xac0d('0x27')](function(_0x960e7a){_0x56022f[_0xac0d('0x20')]=_0x960e7a;if(_0x2ad332['query']['includeAll']){_0xcc6426[_0xac0d('0x43')]=[{'all':!![]}];}return db[_0xac0d('0x2d')][_0xac0d('0x44')](_0xcc6426);})[_0xac0d('0x27')](function(_0xcd5a9b){_0x56022f[_0xac0d('0x45')]=_0xcd5a9b;return _0x56022f;})[_0xac0d('0x27')](respondWithFilteredResult(_0x162284,_0xcc6426))[_0xac0d('0x46')](handleError(_0x162284,null));};exports[_0xac0d('0x47')]=function(_0x1b1f0b,_0x534367){var _0x3bc74f={'raw':!![],'where':{'id':_0x1b1f0b[_0xac0d('0x48')]['id']}},_0x157198={};_0x157198['model']=_[_0xac0d('0x34')](db[_0xac0d('0x2d')][_0xac0d('0x2e')]);_0x157198[_0xac0d('0x33')]=_[_0xac0d('0x34')](_0x1b1f0b[_0xac0d('0x33')]);_0x157198[_0xac0d('0x3c')]=_[_0xac0d('0x35')](_0x157198[_0xac0d('0x31')],_0x157198[_0xac0d('0x33')]);_0x3bc74f[_0xac0d('0x37')]=_[_0xac0d('0x35')](_0x157198[_0xac0d('0x31')],qs[_0xac0d('0x36')](_0x1b1f0b[_0xac0d('0x33')][_0xac0d('0x36')]));_0x3bc74f[_0xac0d('0x37')]=_0x3bc74f[_0xac0d('0x37')][_0xac0d('0x38')]?_0x3bc74f[_0xac0d('0x37')]:_0x157198[_0xac0d('0x31')];if(_0x1b1f0b[_0xac0d('0x33')]['includeAll']){_0x3bc74f[_0xac0d('0x43')]=[{'all':!![]}];}_0x3bc74f=_[_0xac0d('0x40')]({},_0x3bc74f,_0x1b1f0b['options']);return db['AnalyticTreeReport'][_0xac0d('0x49')](_0x3bc74f)[_0xac0d('0x27')](handleEntityNotFound(_0x534367,null))['then'](respondWithResult(_0x534367,null))[_0xac0d('0x46')](handleError(_0x534367,null));};exports[_0xac0d('0x4a')]=function(_0x24a84e,_0x476cab){return db[_0xac0d('0x2d')]['create'](_0x24a84e[_0xac0d('0x4b')],{})[_0xac0d('0x27')](respondWithResult(_0x476cab,0xc9))['catch'](handleError(_0x476cab,null));};exports['update']=function(_0x43ec6e,_0x3b8e90){if(_0x43ec6e['body']['id']){delete _0x43ec6e[_0xac0d('0x4b')]['id'];}return db[_0xac0d('0x2d')][_0xac0d('0x49')]({'where':{'id':_0x43ec6e[_0xac0d('0x48')]['id']}})[_0xac0d('0x27')](handleEntityNotFound(_0x3b8e90,null))['then'](saveUpdates(_0x43ec6e['body'],null))[_0xac0d('0x27')](respondWithResult(_0x3b8e90,null))[_0xac0d('0x46')](handleError(_0x3b8e90,null));};exports[_0xac0d('0x4c')]=function(_0x56acf6,_0x42eb7b){return db[_0xac0d('0x2d')]['find']({'where':{'id':_0x56acf6[_0xac0d('0x48')]['id']}})['then'](handleEntityNotFound(_0x42eb7b,null))[_0xac0d('0x27')](removeEntity(_0x42eb7b,null))[_0xac0d('0x46')](handleError(_0x42eb7b,null));}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.model.js b/server/api/analyticTreeReport/analyticTreeReport.model.js index 23a6e86..f2e7da0 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 _0x3d3c=['analytics_report_trees','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./analyticTreeReport.attributes','exports','define'];(function(_0x75f869,_0x3690d6){var _0x10af8b=function(_0x22d3ff){while(--_0x22d3ff){_0x75f869['push'](_0x75f869['shift']());}};_0x10af8b(++_0x3690d6);}(_0x3d3c,0x1bb));var _0xc3d3=function(_0xa1e3e3,_0x29fe0e){_0xa1e3e3=_0xa1e3e3-0x0;var _0xc980e9=_0x3d3c[_0xa1e3e3];return _0xc980e9;};'use strict';var _=require(_0xc3d3('0x0'));var util=require(_0xc3d3('0x1'));var logger=require(_0xc3d3('0x2'))('api');var moment=require(_0xc3d3('0x3'));var BPromise=require(_0xc3d3('0x4'));var rp=require(_0xc3d3('0x5'));var fs=require('fs');var path=require(_0xc3d3('0x6'));var rimraf=require(_0xc3d3('0x7'));var config=require(_0xc3d3('0x8'));var attributes=require(_0xc3d3('0x9'));module[_0xc3d3('0xa')]=function(_0x369a0f,_0x5cc04e){return _0x369a0f[_0xc3d3('0xb')]('AnalyticTreeReport',attributes,{'tableName':_0xc3d3('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x022e=['AnalyticTreeReport','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./analyticTreeReport.attributes','exports','define'];(function(_0x470c7f,_0x27dd79){var _0x9c90e0=function(_0x1d6c18){while(--_0x1d6c18){_0x470c7f['push'](_0x470c7f['shift']());}};_0x9c90e0(++_0x27dd79);}(_0x022e,0x1d5));var _0xe022=function(_0x22f8ab,_0x15d8ff){_0x22f8ab=_0x22f8ab-0x0;var _0x2a70e5=_0x022e[_0x22f8ab];return _0x2a70e5;};'use strict';var _=require(_0xe022('0x0'));var util=require(_0xe022('0x1'));var logger=require(_0xe022('0x2'))('api');var moment=require(_0xe022('0x3'));var BPromise=require(_0xe022('0x4'));var rp=require(_0xe022('0x5'));var fs=require('fs');var path=require(_0xe022('0x6'));var rimraf=require(_0xe022('0x7'));var config=require(_0xe022('0x8'));var attributes=require(_0xe022('0x9'));module[_0xe022('0xa')]=function(_0x4762d5,_0x32d1b3){return _0x4762d5[_0xe022('0xb')](_0xe022('0xc'),attributes,{'tableName':'analytics_report_trees','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 1a439cc..4d80a06 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 _0xadb5=['error','code','message','result','catch','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','AnalyticTreeReport,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x946518,_0x22816f){var _0x909b69=function(_0x2fa5a4){while(--_0x2fa5a4){_0x946518['push'](_0x946518['shift']());}};_0x909b69(++_0x22816f);}(_0xadb5,0xad));var _0x5adb=function(_0xb07bd5,_0x2528af){_0xb07bd5=_0xb07bd5-0x0;var _0x8bd4e7=_0xadb5[_0xb07bd5];return _0x8bd4e7;};'use strict';var _=require('lodash');var util=require(_0x5adb('0x0'));var moment=require('moment');var BPromise=require(_0x5adb('0x1'));var rs=require(_0x5adb('0x2'));var fs=require('fs');var Redis=require(_0x5adb('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x5adb('0x4'));var logger=require(_0x5adb('0x5'))(_0x5adb('0x6'));var config=require('../../config/environment');var jayson=require(_0x5adb('0x7'));var client=jayson[_0x5adb('0x8')][_0x5adb('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3213e8,_0xdf3776,_0x353885){return new BPromise(function(_0x47228a,_0x6d1b45){return client[_0x5adb('0xa')](_0x3213e8,_0x353885)[_0x5adb('0xb')](function(_0x34f59d){logger[_0x5adb('0xc')](_0x5adb('0xd'),_0xdf3776,_0x5adb('0xe'));logger['debug']('AnalyticTreeReport,\x20%s,\x20%s,\x20%s',_0xdf3776,_0x5adb('0xe'),JSON[_0x5adb('0xf')](_0x34f59d));if(_0x34f59d[_0x5adb('0x10')]){if(_0x34f59d['error'][_0x5adb('0x11')]===0x1f4){logger['error'](_0x5adb('0xd'),_0xdf3776,_0x34f59d['error'][_0x5adb('0x12')]);return _0x6d1b45(_0x34f59d[_0x5adb('0x10')][_0x5adb('0x12')]);}logger['error'](_0x5adb('0xd'),_0xdf3776,_0x34f59d[_0x5adb('0x10')][_0x5adb('0x12')]);return _0x47228a(_0x34f59d['error'][_0x5adb('0x12')]);}else{logger['info'](_0x5adb('0xd'),_0xdf3776,_0x5adb('0xe'));_0x47228a(_0x34f59d[_0x5adb('0x13')][_0x5adb('0x12')]);}})[_0x5adb('0x14')](function(_0x39d24d){logger[_0x5adb('0x10')](_0x5adb('0xd'),_0xdf3776,_0x39d24d);_0x6d1b45(_0x39d24d);});});} \ No newline at end of file +var _0xadb5=['error','code','message','result','catch','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','AnalyticTreeReport,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x4fc476,_0xb7cdfd){var _0x2de7d8=function(_0x5c4f8f){while(--_0x5c4f8f){_0x4fc476['push'](_0x4fc476['shift']());}};_0x2de7d8(++_0xb7cdfd);}(_0xadb5,0xad));var _0x5adb=function(_0x4aafde,_0x5739f4){_0x4aafde=_0x4aafde-0x0;var _0x165fd2=_0xadb5[_0x4aafde];return _0x165fd2;};'use strict';var _=require('lodash');var util=require(_0x5adb('0x0'));var moment=require('moment');var BPromise=require(_0x5adb('0x1'));var rs=require(_0x5adb('0x2'));var fs=require('fs');var Redis=require(_0x5adb('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x5adb('0x4'));var logger=require(_0x5adb('0x5'))(_0x5adb('0x6'));var config=require('../../config/environment');var jayson=require(_0x5adb('0x7'));var client=jayson[_0x5adb('0x8')][_0x5adb('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3213e8,_0xdf3776,_0x353885){return new BPromise(function(_0x47228a,_0x6d1b45){return client[_0x5adb('0xa')](_0x3213e8,_0x353885)[_0x5adb('0xb')](function(_0x34f59d){logger[_0x5adb('0xc')](_0x5adb('0xd'),_0xdf3776,_0x5adb('0xe'));logger['debug']('AnalyticTreeReport,\x20%s,\x20%s,\x20%s',_0xdf3776,_0x5adb('0xe'),JSON[_0x5adb('0xf')](_0x34f59d));if(_0x34f59d[_0x5adb('0x10')]){if(_0x34f59d['error'][_0x5adb('0x11')]===0x1f4){logger['error'](_0x5adb('0xd'),_0xdf3776,_0x34f59d['error'][_0x5adb('0x12')]);return _0x6d1b45(_0x34f59d[_0x5adb('0x10')][_0x5adb('0x12')]);}logger['error'](_0x5adb('0xd'),_0xdf3776,_0x34f59d[_0x5adb('0x10')][_0x5adb('0x12')]);return _0x47228a(_0x34f59d['error'][_0x5adb('0x12')]);}else{logger['info'](_0x5adb('0xd'),_0xdf3776,_0x5adb('0xe'));_0x47228a(_0x34f59d[_0x5adb('0x13')][_0x5adb('0x12')]);}})[_0x5adb('0x14')](function(_0x39d24d){logger[_0x5adb('0x10')](_0x5adb('0xd'),_0xdf3776,_0x39d24d);_0x6d1b45(_0x39d24d);});});} \ No newline at end of file diff --git a/server/api/analyticTreeReport/index.js b/server/api/analyticTreeReport/index.js index 9606d25..5d28d7c 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 _0x212f=['fs-extra','../../components/interaction/service','../../config/environment','./analyticTreeReport.controller','get','index','/:id','isAuthenticated','show','post','create','update','delete','destroy','path','connect-timeout','Router'];(function(_0x22cc16,_0x1f4fa2){var _0x399b70=function(_0x34d464){while(--_0x34d464){_0x22cc16['push'](_0x22cc16['shift']());}};_0x399b70(++_0x1f4fa2);}(_0x212f,0x1ea));var _0xf212=function(_0xf6f769,_0x224e7e){_0xf6f769=_0xf6f769-0x0;var _0x1663e9=_0x212f[_0xf6f769];return _0x1663e9;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xf212('0x0'));var timeout=require(_0xf212('0x1'));var express=require('express');var router=express[_0xf212('0x2')]();var fs_extra=require(_0xf212('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xf212('0x4'));var config=require(_0xf212('0x5'));var controller=require(_0xf212('0x6'));router[_0xf212('0x7')]('/',auth['isAuthenticated'](),controller[_0xf212('0x8')]);router[_0xf212('0x7')](_0xf212('0x9'),auth[_0xf212('0xa')](),controller[_0xf212('0xb')]);router[_0xf212('0xc')]('/',auth[_0xf212('0xa')](),controller[_0xf212('0xd')]);router['put'](_0xf212('0x9'),auth[_0xf212('0xa')](),controller[_0xf212('0xe')]);router[_0xf212('0xf')](_0xf212('0x9'),auth['isAuthenticated'](),controller[_0xf212('0x10')]);module['exports']=router; \ No newline at end of file +var _0x109e=['multer','util','path','connect-timeout','express','Router','fs-extra','../../config/environment','get','isAuthenticated','post','create','/:id','destroy','exports'];(function(_0x57fe5e,_0xafce42){var _0x24ad53=function(_0x386892){while(--_0x386892){_0x57fe5e['push'](_0x57fe5e['shift']());}};_0x24ad53(++_0xafce42);}(_0x109e,0xc3));var _0xe109=function(_0x9eadf8,_0x5d2d9e){_0x9eadf8=_0x9eadf8-0x0;var _0x5ce5eb=_0x109e[_0x9eadf8];return _0x5ce5eb;};'use strict';var multer=require(_0xe109('0x0'));var util=require(_0xe109('0x1'));var path=require(_0xe109('0x2'));var timeout=require(_0xe109('0x3'));var express=require(_0xe109('0x4'));var router=express[_0xe109('0x5')]();var fs_extra=require(_0xe109('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xe109('0x7'));var controller=require('./analyticTreeReport.controller');router[_0xe109('0x8')]('/',auth[_0xe109('0x9')](),controller['index']);router[_0xe109('0x8')]('/:id',auth[_0xe109('0x9')](),controller['show']);router[_0xe109('0xa')]('/',auth[_0xe109('0x9')](),controller[_0xe109('0xb')]);router['put'](_0xe109('0xc'),auth['isAuthenticated'](),controller['update']);router['delete'](_0xe109('0xc'),auth[_0xe109('0x9')](),controller[_0xe109('0xd')]);module[_0xe109('0xe')]=router; \ No newline at end of file diff --git a/server/api/attachment/attachment.attributes.js b/server/api/attachment/attachment.attributes.js index aea2ecc..88ce3b9 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 _0x2e35=['exports','STRING','sequelize'];(function(_0x4b33d1,_0x2414e1){var _0x9e7221=function(_0x476ecc){while(--_0x476ecc){_0x4b33d1['push'](_0x4b33d1['shift']());}};_0x9e7221(++_0x2414e1);}(_0x2e35,0x1d0));var _0x52e3=function(_0x26cff4,_0x4258a0){_0x26cff4=_0x26cff4-0x0;var _0x2fd916=_0x2e35[_0x26cff4];return _0x2fd916;};'use strict';var Sequelize=require(_0x52e3('0x0'));module[_0x52e3('0x1')]={'name':{'type':Sequelize[_0x52e3('0x2')]},'basename':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x52e3('0x2')]}}; \ No newline at end of file +var _0xe198=['sequelize','exports','STRING'];(function(_0x350814,_0x4a1eb6){var _0x4679e7=function(_0x894990){while(--_0x894990){_0x350814['push'](_0x350814['shift']());}};_0x4679e7(++_0x4a1eb6);}(_0xe198,0x6f));var _0x8e19=function(_0x4b055c,_0x4b870b){_0x4b055c=_0x4b055c-0x0;var _0x4b62bb=_0xe198[_0x4b055c];return _0x4b62bb;};'use strict';var Sequelize=require(_0x8e19('0x0'));module[_0x8e19('0x1')]={'name':{'type':Sequelize['STRING']},'basename':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x8e19('0x2')]}}; \ No newline at end of file diff --git a/server/api/attachment/attachment.controller.js b/server/api/attachment/attachment.controller.js index bbec5a4..6364a14 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 _0xe5e9=['merge','type','VIRTUAL','options','includeAll','include','rows','show','params','length','find','catch','clone','get','omit','createdAt','updatedAt','body','create','file','originalname','basename','filename','mimetype','download','findOne','join','root','offline-chat/','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','sendStatus','status','undefined','limit','offset','count','set','Content-Range','json','apply','reject','save','update','then','destroy','end','error','name','send','index','Attachment','rawAttributes','key','map','keys','query','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter'];(function(_0x3e6fd2,_0x274abb){var _0x46b822=function(_0x10c90e){while(--_0x10c90e){_0x3e6fd2['push'](_0x3e6fd2['shift']());}};_0x46b822(++_0x274abb);}(_0xe5e9,0xd3));var _0x9e5e=function(_0x3a75a1,_0x18842d){_0x3a75a1=_0x3a75a1-0x0;var _0x1f9f87=_0xe5e9[_0x3a75a1];return _0x1f9f87;};'use strict';var emlformat=require(_0x9e5e('0x0'));var rimraf=require(_0x9e5e('0x1'));var zipdir=require(_0x9e5e('0x2'));var jsonpatch=require(_0x9e5e('0x3'));var rp=require(_0x9e5e('0x4'));var moment=require(_0x9e5e('0x5'));var BPromise=require(_0x9e5e('0x6'));var Mustache=require('mustache');var util=require(_0x9e5e('0x7'));var path=require(_0x9e5e('0x8'));var sox=require('sox');var csv=require(_0x9e5e('0x9'));var ejs=require(_0x9e5e('0xa'));var fs=require('fs');var fs_extra=require(_0x9e5e('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x9e5e('0xc'));var jsforce=require(_0x9e5e('0xd'));var deskjs=require(_0x9e5e('0xe'));var toCsv=require(_0x9e5e('0x9'));var querystring=require(_0x9e5e('0xf'));var Papa=require('papaparse');var Redis=require(_0x9e5e('0x10'));var authService=require(_0x9e5e('0x11'));var qs=require(_0x9e5e('0x12'));var as=require(_0x9e5e('0x13'));var hardwareService=require(_0x9e5e('0x14'));var logger=require(_0x9e5e('0x15'))('api');var utils=require('../../config/utils');var config=require(_0x9e5e('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x9e5e('0x17'))['db'];function respondWithStatusCode(_0x39e7c1,_0x2c36a0){_0x2c36a0=_0x2c36a0||0xcc;return function(_0x50b00a){if(_0x50b00a){return _0x39e7c1[_0x9e5e('0x18')](_0x2c36a0);}return _0x39e7c1[_0x9e5e('0x19')](_0x2c36a0)['end']();};}function respondWithResult(_0x254f3c,_0x3d56f5){_0x3d56f5=_0x3d56f5||0xc8;return function(_0x50e52e){if(_0x50e52e){return _0x254f3c[_0x9e5e('0x19')](_0x3d56f5)['json'](_0x50e52e);}};}function respondWithFilteredResult(_0x3993d4,_0x1ceb34){return function(_0x3bda52){if(_0x3bda52){var _0x4def19=typeof _0x1ceb34['offset']===_0x9e5e('0x1a')&&typeof _0x1ceb34[_0x9e5e('0x1b')]===_0x9e5e('0x1a');var _0x37b47b=_0x3bda52['count'];var _0x174cd5=_0x4def19?0x0:_0x1ceb34[_0x9e5e('0x1c')];var _0x5dc3de=_0x4def19?_0x3bda52[_0x9e5e('0x1d')]:_0x1ceb34[_0x9e5e('0x1c')]+_0x1ceb34[_0x9e5e('0x1b')];var _0x50b455;if(_0x5dc3de>=_0x37b47b){_0x5dc3de=_0x37b47b;_0x50b455=0xc8;}else{_0x50b455=0xce;}_0x3993d4[_0x9e5e('0x19')](_0x50b455);return _0x3993d4[_0x9e5e('0x1e')](_0x9e5e('0x1f'),_0x174cd5+'-'+_0x5dc3de+'/'+_0x37b47b)[_0x9e5e('0x20')](_0x3bda52);}return null;};}function patchUpdates(_0x6611d1){return function(_0x3c6152){try{jsonpatch[_0x9e5e('0x21')](_0x3c6152,_0x6611d1,!![]);}catch(_0x32ed61){return BPromise[_0x9e5e('0x22')](_0x32ed61);}return _0x3c6152[_0x9e5e('0x23')]();};}function saveUpdates(_0x2744b9,_0x1b2437){return function(_0x451715){if(_0x451715){return _0x451715[_0x9e5e('0x24')](_0x2744b9)[_0x9e5e('0x25')](function(_0x27fe5d){return _0x27fe5d;});}return null;};}function removeEntity(_0x2071cb,_0xa4f3f9){return function(_0x45f527){if(_0x45f527){return _0x45f527[_0x9e5e('0x26')]()[_0x9e5e('0x25')](function(){_0x2071cb[_0x9e5e('0x19')](0xcc)[_0x9e5e('0x27')]();});}};}function handleEntityNotFound(_0x583e3d,_0x6a78f3){return function(_0x10b6e7){if(!_0x10b6e7){_0x583e3d[_0x9e5e('0x18')](0x194);}return _0x10b6e7;};}function handleError(_0x5f1c1a,_0x6a39cc){_0x6a39cc=_0x6a39cc||0x1f4;return function(_0x210670){logger[_0x9e5e('0x28')](_0x210670['stack']);if(_0x210670['name']){delete _0x210670[_0x9e5e('0x29')];}_0x5f1c1a['status'](_0x6a39cc)[_0x9e5e('0x2a')](_0x210670);};}exports[_0x9e5e('0x2b')]=function(_0x362f63,_0x272710){var _0x48e20f={},_0x381980={},_0x3df0f8={'count':0x0,'rows':[]};var _0xe3107f=_['map'](db[_0x9e5e('0x2c')][_0x9e5e('0x2d')],function(_0x15509f){return{'name':_0x15509f['fieldName'],'type':_0x15509f['type'][_0x9e5e('0x2e')]};});_0x381980['model']=_[_0x9e5e('0x2f')](_0xe3107f,_0x9e5e('0x29'));_0x381980['query']=_[_0x9e5e('0x30')](_0x362f63[_0x9e5e('0x31')]);_0x381980[_0x9e5e('0x32')]=_[_0x9e5e('0x33')](_0x381980[_0x9e5e('0x34')],_0x381980[_0x9e5e('0x31')]);_0x48e20f[_0x9e5e('0x35')]=_[_0x9e5e('0x33')](_0x381980['model'],qs[_0x9e5e('0x36')](_0x362f63[_0x9e5e('0x31')][_0x9e5e('0x36')]));_0x48e20f[_0x9e5e('0x35')]=_0x48e20f['attributes']['length']?_0x48e20f[_0x9e5e('0x35')]:_0x381980[_0x9e5e('0x34')];if(!_0x362f63['query'][_0x9e5e('0x37')](_0x9e5e('0x38'))){_0x48e20f[_0x9e5e('0x1b')]=qs[_0x9e5e('0x1b')](_0x362f63[_0x9e5e('0x31')][_0x9e5e('0x1b')]);_0x48e20f['offset']=qs[_0x9e5e('0x1c')](_0x362f63[_0x9e5e('0x31')]['offset']);}_0x48e20f[_0x9e5e('0x39')]=qs['sort'](_0x362f63[_0x9e5e('0x31')][_0x9e5e('0x3a')]);_0x48e20f[_0x9e5e('0x3b')]=qs[_0x9e5e('0x32')](_[_0x9e5e('0x3c')](_0x362f63[_0x9e5e('0x31')],_0x381980[_0x9e5e('0x32')]),_0xe3107f);if(_0x362f63[_0x9e5e('0x31')][_0x9e5e('0x3d')]){_0x48e20f[_0x9e5e('0x3b')]=_[_0x9e5e('0x3e')](_0x48e20f[_0x9e5e('0x3b')],{'$or':_[_0x9e5e('0x2f')](_0xe3107f,function(_0x122d7a){if(_0x122d7a[_0x9e5e('0x3f')]!==_0x9e5e('0x40')){var _0x46ca50={};_0x46ca50[_0x122d7a[_0x9e5e('0x29')]]={'$like':'%'+_0x362f63[_0x9e5e('0x31')][_0x9e5e('0x3d')]+'%'};return _0x46ca50;}})});}_0x48e20f=_['merge']({},_0x48e20f,_0x362f63[_0x9e5e('0x41')]);var _0x4dfe94={'where':_0x48e20f[_0x9e5e('0x3b')]};return db[_0x9e5e('0x2c')]['count'](_0x4dfe94)[_0x9e5e('0x25')](function(_0x48d27){_0x3df0f8[_0x9e5e('0x1d')]=_0x48d27;if(_0x362f63['query'][_0x9e5e('0x42')]){_0x48e20f[_0x9e5e('0x43')]=[{'all':!![]}];}return db[_0x9e5e('0x2c')]['findAll'](_0x48e20f);})['then'](function(_0x5624ff){_0x3df0f8[_0x9e5e('0x44')]=_0x5624ff;return _0x3df0f8;})[_0x9e5e('0x25')](respondWithFilteredResult(_0x272710,_0x48e20f))['catch'](handleError(_0x272710,null));};exports[_0x9e5e('0x45')]=function(_0x33bd27,_0x40c8a3){var _0x399250={'raw':!![],'where':{'id':_0x33bd27[_0x9e5e('0x46')]['id']}},_0x4a3ace={};_0x4a3ace[_0x9e5e('0x34')]=_[_0x9e5e('0x30')](db[_0x9e5e('0x2c')][_0x9e5e('0x2d')]);_0x4a3ace[_0x9e5e('0x31')]=_['keys'](_0x33bd27[_0x9e5e('0x31')]);_0x4a3ace[_0x9e5e('0x32')]=_[_0x9e5e('0x33')](_0x4a3ace[_0x9e5e('0x34')],_0x4a3ace[_0x9e5e('0x31')]);_0x399250[_0x9e5e('0x35')]=_[_0x9e5e('0x33')](_0x4a3ace[_0x9e5e('0x34')],qs[_0x9e5e('0x36')](_0x33bd27[_0x9e5e('0x31')][_0x9e5e('0x36')]));_0x399250['attributes']=_0x399250['attributes'][_0x9e5e('0x47')]?_0x399250[_0x9e5e('0x35')]:_0x4a3ace[_0x9e5e('0x34')];if(_0x33bd27[_0x9e5e('0x31')][_0x9e5e('0x42')]){_0x399250[_0x9e5e('0x43')]=[{'all':!![]}];}_0x399250=_[_0x9e5e('0x3e')]({},_0x399250,_0x33bd27[_0x9e5e('0x41')]);return db[_0x9e5e('0x2c')][_0x9e5e('0x48')](_0x399250)['then'](handleEntityNotFound(_0x40c8a3,null))[_0x9e5e('0x25')](respondWithResult(_0x40c8a3,null))[_0x9e5e('0x49')](handleError(_0x40c8a3,null));};exports[_0x9e5e('0x4a')]=function(_0x425a42,_0xb6a4bf){var _0x2aee8a={'where':{'id':_0x425a42[_0x9e5e('0x46')]['id']}},_0x197b2d={};_0x197b2d['model']=_[_0x9e5e('0x30')](db[_0x9e5e('0x2c')][_0x9e5e('0x2d')]);_0x2aee8a['attributes']=_[_0x9e5e('0x33')](_0x197b2d[_0x9e5e('0x34')],qs['fields'](_0x425a42['query'][_0x9e5e('0x36')]));_0x2aee8a['attributes']=_0x2aee8a[_0x9e5e('0x35')][_0x9e5e('0x47')]?_0x2aee8a[_0x9e5e('0x35')]:_0x197b2d[_0x9e5e('0x34')];if(_0x425a42[_0x9e5e('0x31')]['includeAll']){_0x2aee8a[_0x9e5e('0x43')]=[{'all':!![]}];}_0x2aee8a=_[_0x9e5e('0x3e')]({},_0x2aee8a,_0x425a42[_0x9e5e('0x41')]);return db[_0x9e5e('0x2c')][_0x9e5e('0x48')](_0x2aee8a)[_0x9e5e('0x25')](handleEntityNotFound(_0xb6a4bf,null))[_0x9e5e('0x25')](function(_0x1fb914){if(_0x1fb914){var _0x3d3884=_0x1fb914[_0x9e5e('0x4b')]({'plain':!![]});_0x3d3884=qs[_0x9e5e('0x4c')](_0x3d3884,['id',_0x9e5e('0x4d'),_0x9e5e('0x4e')]);_0x425a42[_0x9e5e('0x4f')]=_[_0x9e5e('0x4c')](_0x425a42[_0x9e5e('0x4f')],['id',_0x9e5e('0x4d'),'updatedAt']);return db['Attachment'][_0x9e5e('0x50')](_[_0x9e5e('0x3e')](_0x3d3884,_0x425a42[_0x9e5e('0x4f')]),{'include':_0x425a42[_0x9e5e('0x31')][_0x9e5e('0x42')]?[{'all':!![]}]:undefined});}})[_0x9e5e('0x25')](respondWithResult(_0xb6a4bf,0xc9))['catch'](handleError(_0xb6a4bf,null));};exports[_0x9e5e('0x24')]=function(_0x515858,_0x3c93ac){if(_0x515858['body']['id']){delete _0x515858[_0x9e5e('0x4f')]['id'];}return db[_0x9e5e('0x2c')][_0x9e5e('0x48')]({'where':{'id':_0x515858[_0x9e5e('0x46')]['id']}})[_0x9e5e('0x25')](handleEntityNotFound(_0x3c93ac,null))[_0x9e5e('0x25')](saveUpdates(_0x515858[_0x9e5e('0x4f')],null))[_0x9e5e('0x25')](respondWithResult(_0x3c93ac,null))[_0x9e5e('0x49')](handleError(_0x3c93ac,null));};exports[_0x9e5e('0x26')]=function(_0x39d42a,_0x8ed10){return db[_0x9e5e('0x2c')][_0x9e5e('0x48')]({'where':{'id':_0x39d42a['params']['id']}})['then'](handleEntityNotFound(_0x8ed10,null))['then'](removeEntity(_0x8ed10,null))[_0x9e5e('0x49')](handleError(_0x8ed10,null));};exports[_0x9e5e('0x50')]=function(_0x2a9255,_0x1555d5,_0x1d1068){_0x2a9255[_0x9e5e('0x4f')][_0x9e5e('0x29')]=_0x2a9255[_0x9e5e('0x51')][_0x9e5e('0x52')];_0x2a9255[_0x9e5e('0x4f')][_0x9e5e('0x53')]=_0x2a9255[_0x9e5e('0x51')][_0x9e5e('0x54')];_0x2a9255['body'][_0x9e5e('0x3f')]=_0x2a9255[_0x9e5e('0x51')][_0x9e5e('0x55')];return db['Attachment'][_0x9e5e('0x50')](_0x2a9255['body'])[_0x9e5e('0x25')](respondWithResult(_0x1555d5,0xc9))[_0x9e5e('0x49')](handleError(_0x1555d5,null));};exports[_0x9e5e('0x56')]=function(_0x307c12,_0x347a0b,_0x273a6d){return db[_0x9e5e('0x2c')][_0x9e5e('0x57')]({'where':{'id':_0x307c12[_0x9e5e('0x46')]['id']},'raw':!![]})['then'](handleEntityNotFound(_0x347a0b,null))[_0x9e5e('0x25')](function(_0x393a5b){if(_0x393a5b){var _0xf569ea=_0x393a5b['ChatOfflineMessageId']!==null;var _0x1165a8=path[_0x9e5e('0x58')](config[_0x9e5e('0x59')],'server/files/attachments/');if(_0xf569ea){_0x1165a8=path[_0x9e5e('0x58')](_0x1165a8,_0x9e5e('0x5a'));}var _0x3771b5=path['join'](_0x1165a8,_0x393a5b[_0x9e5e('0x53')]);return _0x347a0b[_0x9e5e('0x56')](_0x3771b5);}})['catch'](handleError(_0x347a0b,null));}; \ No newline at end of file +var _0xc875=['create','originalname','basename','file','filename','mimetype','ChatOfflineMessageId','root','server/files/attachments/','join','offline-chat/','download','eml-format','rimraf','zip-dir','request-promise','bluebird','util','path','sox','ejs','fs-extra','lodash','squel','crypto','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','sendStatus','error','stack','name','index','Attachment','type','key','model','query','keys','filters','attributes','intersection','fields','order','sort','where','pick','filter','merge','map','options','includeAll','include','rows','catch','show','params','length','find','clone','omit','createdAt','body','updatedAt','update'];(function(_0xe30888,_0x12dcea){var _0x15dfaf=function(_0x39fb7f){while(--_0x39fb7f){_0xe30888['push'](_0xe30888['shift']());}};_0x15dfaf(++_0x12dcea);}(_0xc875,0x111));var _0x5c87=function(_0x5767a6,_0x3053cc){_0x5767a6=_0x5767a6-0x0;var _0x25edd8=_0xc875[_0x5767a6];return _0x25edd8;};'use strict';var emlformat=require(_0x5c87('0x0'));var rimraf=require(_0x5c87('0x1'));var zipdir=require(_0x5c87('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x5c87('0x3'));var moment=require('moment');var BPromise=require(_0x5c87('0x4'));var Mustache=require('mustache');var util=require(_0x5c87('0x5'));var path=require(_0x5c87('0x6'));var sox=require(_0x5c87('0x7'));var csv=require('to-csv');var ejs=require(_0x5c87('0x8'));var fs=require('fs');var fs_extra=require(_0x5c87('0x9'));var _=require(_0x5c87('0xa'));var squel=require(_0x5c87('0xb'));var crypto=require(_0x5c87('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x5c87('0xd'));var querystring=require(_0x5c87('0xe'));var Papa=require(_0x5c87('0xf'));var Redis=require('ioredis');var authService=require(_0x5c87('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x5c87('0x11'));var hardwareService=require(_0x5c87('0x12'));var logger=require(_0x5c87('0x13'))(_0x5c87('0x14'));var utils=require(_0x5c87('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x5c87('0x16'));var db=require(_0x5c87('0x17'))['db'];function respondWithStatusCode(_0x541e2c,_0x46d696){_0x46d696=_0x46d696||0xcc;return function(_0x1ec10b){if(_0x1ec10b){return _0x541e2c['sendStatus'](_0x46d696);}return _0x541e2c[_0x5c87('0x18')](_0x46d696)[_0x5c87('0x19')]();};}function respondWithResult(_0x2eb133,_0x5981ed){_0x5981ed=_0x5981ed||0xc8;return function(_0x2ad650){if(_0x2ad650){return _0x2eb133[_0x5c87('0x18')](_0x5981ed)[_0x5c87('0x1a')](_0x2ad650);}};}function respondWithFilteredResult(_0x58cda1,_0x498418){return function(_0x2f0782){if(_0x2f0782){var _0x4de004=typeof _0x498418[_0x5c87('0x1b')]===_0x5c87('0x1c')&&typeof _0x498418[_0x5c87('0x1d')]===_0x5c87('0x1c');var _0x419b1b=_0x2f0782[_0x5c87('0x1e')];var _0x2a2cee=_0x4de004?0x0:_0x498418[_0x5c87('0x1b')];var _0x4fcd85=_0x4de004?_0x2f0782[_0x5c87('0x1e')]:_0x498418[_0x5c87('0x1b')]+_0x498418[_0x5c87('0x1d')];var _0xf175f9;if(_0x4fcd85>=_0x419b1b){_0x4fcd85=_0x419b1b;_0xf175f9=0xc8;}else{_0xf175f9=0xce;}_0x58cda1[_0x5c87('0x18')](_0xf175f9);return _0x58cda1[_0x5c87('0x1f')](_0x5c87('0x20'),_0x2a2cee+'-'+_0x4fcd85+'/'+_0x419b1b)[_0x5c87('0x1a')](_0x2f0782);}return null;};}function patchUpdates(_0x3e6184){return function(_0xfc4ff0){try{jsonpatch[_0x5c87('0x21')](_0xfc4ff0,_0x3e6184,!![]);}catch(_0x2a72aa){return BPromise[_0x5c87('0x22')](_0x2a72aa);}return _0xfc4ff0[_0x5c87('0x23')]();};}function saveUpdates(_0x2bb028,_0x486a53){return function(_0x508eb4){if(_0x508eb4){return _0x508eb4['update'](_0x2bb028)[_0x5c87('0x24')](function(_0xec656){return _0xec656;});}return null;};}function removeEntity(_0x57892b,_0x2dcc76){return function(_0x5b40bf){if(_0x5b40bf){return _0x5b40bf[_0x5c87('0x25')]()[_0x5c87('0x24')](function(){_0x57892b[_0x5c87('0x18')](0xcc)[_0x5c87('0x19')]();});}};}function handleEntityNotFound(_0x133d2f,_0x56712e){return function(_0xa98e7e){if(!_0xa98e7e){_0x133d2f[_0x5c87('0x26')](0x194);}return _0xa98e7e;};}function handleError(_0x1b85f8,_0x38ea55){_0x38ea55=_0x38ea55||0x1f4;return function(_0x5338f9){logger[_0x5c87('0x27')](_0x5338f9[_0x5c87('0x28')]);if(_0x5338f9['name']){delete _0x5338f9[_0x5c87('0x29')];}_0x1b85f8[_0x5c87('0x18')](_0x38ea55)['send'](_0x5338f9);};}exports[_0x5c87('0x2a')]=function(_0x3f22b1,_0x303e6a){var _0x2efcf9={},_0x5acf1e={},_0x13dec4={'count':0x0,'rows':[]};var _0x19e3ed=_['map'](db[_0x5c87('0x2b')]['rawAttributes'],function(_0x4cbfb8){return{'name':_0x4cbfb8['fieldName'],'type':_0x4cbfb8[_0x5c87('0x2c')][_0x5c87('0x2d')]};});_0x5acf1e[_0x5c87('0x2e')]=_['map'](_0x19e3ed,'name');_0x5acf1e[_0x5c87('0x2f')]=_[_0x5c87('0x30')](_0x3f22b1[_0x5c87('0x2f')]);_0x5acf1e[_0x5c87('0x31')]=_['intersection'](_0x5acf1e['model'],_0x5acf1e[_0x5c87('0x2f')]);_0x2efcf9[_0x5c87('0x32')]=_[_0x5c87('0x33')](_0x5acf1e['model'],qs[_0x5c87('0x34')](_0x3f22b1[_0x5c87('0x2f')][_0x5c87('0x34')]));_0x2efcf9[_0x5c87('0x32')]=_0x2efcf9[_0x5c87('0x32')]['length']?_0x2efcf9[_0x5c87('0x32')]:_0x5acf1e[_0x5c87('0x2e')];if(!_0x3f22b1[_0x5c87('0x2f')]['hasOwnProperty']('nolimit')){_0x2efcf9['limit']=qs[_0x5c87('0x1d')](_0x3f22b1[_0x5c87('0x2f')]['limit']);_0x2efcf9['offset']=qs[_0x5c87('0x1b')](_0x3f22b1[_0x5c87('0x2f')][_0x5c87('0x1b')]);}_0x2efcf9[_0x5c87('0x35')]=qs[_0x5c87('0x36')](_0x3f22b1[_0x5c87('0x2f')][_0x5c87('0x36')]);_0x2efcf9[_0x5c87('0x37')]=qs[_0x5c87('0x31')](_[_0x5c87('0x38')](_0x3f22b1[_0x5c87('0x2f')],_0x5acf1e[_0x5c87('0x31')]),_0x19e3ed);if(_0x3f22b1[_0x5c87('0x2f')][_0x5c87('0x39')]){_0x2efcf9['where']=_[_0x5c87('0x3a')](_0x2efcf9['where'],{'$or':_[_0x5c87('0x3b')](_0x19e3ed,function(_0x3511ba){if(_0x3511ba[_0x5c87('0x2c')]!=='VIRTUAL'){var _0x26f0bd={};_0x26f0bd[_0x3511ba[_0x5c87('0x29')]]={'$like':'%'+_0x3f22b1[_0x5c87('0x2f')][_0x5c87('0x39')]+'%'};return _0x26f0bd;}})});}_0x2efcf9=_['merge']({},_0x2efcf9,_0x3f22b1[_0x5c87('0x3c')]);var _0xf09f7a={'where':_0x2efcf9[_0x5c87('0x37')]};return db[_0x5c87('0x2b')][_0x5c87('0x1e')](_0xf09f7a)['then'](function(_0x289f08){_0x13dec4['count']=_0x289f08;if(_0x3f22b1['query'][_0x5c87('0x3d')]){_0x2efcf9[_0x5c87('0x3e')]=[{'all':!![]}];}return db['Attachment']['findAll'](_0x2efcf9);})[_0x5c87('0x24')](function(_0x1711b1){_0x13dec4[_0x5c87('0x3f')]=_0x1711b1;return _0x13dec4;})[_0x5c87('0x24')](respondWithFilteredResult(_0x303e6a,_0x2efcf9))[_0x5c87('0x40')](handleError(_0x303e6a,null));};exports[_0x5c87('0x41')]=function(_0x2bdde8,_0xe75ab5){var _0x381a03={'raw':!![],'where':{'id':_0x2bdde8[_0x5c87('0x42')]['id']}},_0x54dd73={};_0x54dd73['model']=_[_0x5c87('0x30')](db[_0x5c87('0x2b')]['rawAttributes']);_0x54dd73[_0x5c87('0x2f')]=_[_0x5c87('0x30')](_0x2bdde8[_0x5c87('0x2f')]);_0x54dd73[_0x5c87('0x31')]=_['intersection'](_0x54dd73[_0x5c87('0x2e')],_0x54dd73[_0x5c87('0x2f')]);_0x381a03[_0x5c87('0x32')]=_[_0x5c87('0x33')](_0x54dd73[_0x5c87('0x2e')],qs[_0x5c87('0x34')](_0x2bdde8['query'][_0x5c87('0x34')]));_0x381a03['attributes']=_0x381a03[_0x5c87('0x32')][_0x5c87('0x43')]?_0x381a03[_0x5c87('0x32')]:_0x54dd73[_0x5c87('0x2e')];if(_0x2bdde8[_0x5c87('0x2f')]['includeAll']){_0x381a03[_0x5c87('0x3e')]=[{'all':!![]}];}_0x381a03=_[_0x5c87('0x3a')]({},_0x381a03,_0x2bdde8[_0x5c87('0x3c')]);return db[_0x5c87('0x2b')][_0x5c87('0x44')](_0x381a03)['then'](handleEntityNotFound(_0xe75ab5,null))[_0x5c87('0x24')](respondWithResult(_0xe75ab5,null))['catch'](handleError(_0xe75ab5,null));};exports[_0x5c87('0x45')]=function(_0x45a453,_0x2608cd){var _0x5944aa={'where':{'id':_0x45a453[_0x5c87('0x42')]['id']}},_0x2d3a18={};_0x2d3a18[_0x5c87('0x2e')]=_[_0x5c87('0x30')](db[_0x5c87('0x2b')]['rawAttributes']);_0x5944aa[_0x5c87('0x32')]=_[_0x5c87('0x33')](_0x2d3a18[_0x5c87('0x2e')],qs[_0x5c87('0x34')](_0x45a453[_0x5c87('0x2f')][_0x5c87('0x34')]));_0x5944aa[_0x5c87('0x32')]=_0x5944aa[_0x5c87('0x32')][_0x5c87('0x43')]?_0x5944aa['attributes']:_0x2d3a18[_0x5c87('0x2e')];if(_0x45a453[_0x5c87('0x2f')]['includeAll']){_0x5944aa['include']=[{'all':!![]}];}_0x5944aa=_['merge']({},_0x5944aa,_0x45a453[_0x5c87('0x3c')]);return db['Attachment'][_0x5c87('0x44')](_0x5944aa)['then'](handleEntityNotFound(_0x2608cd,null))[_0x5c87('0x24')](function(_0x423de5){if(_0x423de5){var _0x4d497e=_0x423de5['get']({'plain':!![]});_0x4d497e=qs[_0x5c87('0x46')](_0x4d497e,['id',_0x5c87('0x47'),'updatedAt']);_0x45a453[_0x5c87('0x48')]=_[_0x5c87('0x46')](_0x45a453[_0x5c87('0x48')],['id','createdAt',_0x5c87('0x49')]);return db['Attachment']['create'](_['merge'](_0x4d497e,_0x45a453[_0x5c87('0x48')]),{'include':_0x45a453[_0x5c87('0x2f')][_0x5c87('0x3d')]?[{'all':!![]}]:undefined});}})[_0x5c87('0x24')](respondWithResult(_0x2608cd,0xc9))['catch'](handleError(_0x2608cd,null));};exports[_0x5c87('0x4a')]=function(_0x5efd92,_0x5ee97d){if(_0x5efd92[_0x5c87('0x48')]['id']){delete _0x5efd92[_0x5c87('0x48')]['id'];}return db[_0x5c87('0x2b')][_0x5c87('0x44')]({'where':{'id':_0x5efd92[_0x5c87('0x42')]['id']}})[_0x5c87('0x24')](handleEntityNotFound(_0x5ee97d,null))[_0x5c87('0x24')](saveUpdates(_0x5efd92[_0x5c87('0x48')],null))[_0x5c87('0x24')](respondWithResult(_0x5ee97d,null))[_0x5c87('0x40')](handleError(_0x5ee97d,null));};exports[_0x5c87('0x25')]=function(_0x4d4336,_0x1d867f){return db[_0x5c87('0x2b')][_0x5c87('0x44')]({'where':{'id':_0x4d4336[_0x5c87('0x42')]['id']}})[_0x5c87('0x24')](handleEntityNotFound(_0x1d867f,null))[_0x5c87('0x24')](removeEntity(_0x1d867f,null))['catch'](handleError(_0x1d867f,null));};exports[_0x5c87('0x4b')]=function(_0x5d2556,_0x5bb663,_0x433bce){_0x5d2556['body'][_0x5c87('0x29')]=_0x5d2556['file'][_0x5c87('0x4c')];_0x5d2556[_0x5c87('0x48')][_0x5c87('0x4d')]=_0x5d2556[_0x5c87('0x4e')][_0x5c87('0x4f')];_0x5d2556['body'][_0x5c87('0x2c')]=_0x5d2556[_0x5c87('0x4e')][_0x5c87('0x50')];return db[_0x5c87('0x2b')][_0x5c87('0x4b')](_0x5d2556[_0x5c87('0x48')])[_0x5c87('0x24')](respondWithResult(_0x5bb663,0xc9))[_0x5c87('0x40')](handleError(_0x5bb663,null));};exports['download']=function(_0x546fce,_0x5e3b20,_0x12cb24){return db[_0x5c87('0x2b')]['findOne']({'where':{'id':_0x546fce['params']['id']},'raw':!![]})[_0x5c87('0x24')](handleEntityNotFound(_0x5e3b20,null))[_0x5c87('0x24')](function(_0x2351a5){if(_0x2351a5){var _0x2d57b6=_0x2351a5[_0x5c87('0x51')]!==null;var _0xec0d02=path['join'](config[_0x5c87('0x52')],_0x5c87('0x53'));if(_0x2d57b6){_0xec0d02=path[_0x5c87('0x54')](_0xec0d02,_0x5c87('0x55'));}var _0x24b763=path['join'](_0xec0d02,_0x2351a5[_0x5c87('0x4d')]);return _0x5e3b20[_0x5c87('0x56')](_0x24b763);}})['catch'](handleError(_0x5e3b20,null));}; \ No newline at end of file diff --git a/server/api/attachment/attachment.model.js b/server/api/attachment/attachment.model.js index 11e6fa9..9424116 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 _0x99ec=['exports','attachments','util','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','./attachment.attributes'];(function(_0x522f83,_0x576d61){var _0x5aac53=function(_0x5614aa){while(--_0x5614aa){_0x522f83['push'](_0x522f83['shift']());}};_0x5aac53(++_0x576d61);}(_0x99ec,0x66));var _0xc99e=function(_0x43f55a,_0x5e21fd){_0x43f55a=_0x43f55a-0x0;var _0x337f69=_0x99ec[_0x43f55a];return _0x337f69;};'use strict';var _=require('lodash');var util=require(_0xc99e('0x0'));var logger=require(_0xc99e('0x1'))('api');var moment=require('moment');var BPromise=require(_0xc99e('0x2'));var rp=require(_0xc99e('0x3'));var fs=require('fs');var path=require(_0xc99e('0x4'));var rimraf=require(_0xc99e('0x5'));var config=require(_0xc99e('0x6'));var attributes=require(_0xc99e('0x7'));module[_0xc99e('0x8')]=function(_0x3dc6c3,_0x5eb769){return _0x3dc6c3['define']('Attachment',attributes,{'tableName':_0xc99e('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0835=['api','bluebird','request-promise','rimraf','../../config/environment','./attachment.attributes','exports','define','Attachment','attachments','lodash','util','../../config/logger'];(function(_0x25b441,_0x2ee167){var _0x522f83=function(_0x586af2){while(--_0x586af2){_0x25b441['push'](_0x25b441['shift']());}};_0x522f83(++_0x2ee167);}(_0x0835,0x1eb));var _0x5083=function(_0x25da90,_0x2f9eef){_0x25da90=_0x25da90-0x0;var _0x278407=_0x0835[_0x25da90];return _0x278407;};'use strict';var _=require(_0x5083('0x0'));var util=require(_0x5083('0x1'));var logger=require(_0x5083('0x2'))(_0x5083('0x3'));var moment=require('moment');var BPromise=require(_0x5083('0x4'));var rp=require(_0x5083('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x5083('0x6'));var config=require(_0x5083('0x7'));var attributes=require(_0x5083('0x8'));module[_0x5083('0x9')]=function(_0x2389e3,_0x243393){return _0x2389e3[_0x5083('0xa')](_0x5083('0xb'),attributes,{'tableName':_0x5083('0xc'),'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 97b77c2..981b9f8 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 _0xd110=['Attachment,\x20%s,\x20%s,\x20%s','stringify','error','code','message','Attachment,\x20%s,\x20%s','CreateAttachment','create','body','options','raw','debug','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','request\x20sent'];(function(_0x4bbb86,_0x385744){var _0x2cf22b=function(_0x4b5494){while(--_0x4b5494){_0x4bbb86['push'](_0x4bbb86['shift']());}};_0x2cf22b(++_0x385744);}(_0xd110,0x1e8));var _0x0d11=function(_0x30312f,_0x95b630){_0x30312f=_0x30312f-0x0;var _0x2ed6c7=_0xd110[_0x30312f];return _0x2ed6c7;};'use strict';var _=require(_0x0d11('0x0'));var util=require(_0x0d11('0x1'));var moment=require(_0x0d11('0x2'));var BPromise=require('bluebird');var rs=require(_0x0d11('0x3'));var fs=require('fs');var Redis=require(_0x0d11('0x4'));var db=require(_0x0d11('0x5'))['db'];var utils=require(_0x0d11('0x6'));var logger=require(_0x0d11('0x7'))(_0x0d11('0x8'));var config=require(_0x0d11('0x9'));var jayson=require(_0x0d11('0xa'));var client=jayson['client'][_0x0d11('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5a889c,_0x33c46e,_0x4f3f3f){return new BPromise(function(_0x47a493,_0x3f9f5a){return client[_0x0d11('0xc')](_0x5a889c,_0x4f3f3f)[_0x0d11('0xd')](function(_0x4c6a59){logger[_0x0d11('0xe')]('Attachment,\x20%s,\x20%s',_0x33c46e,_0x0d11('0xf'));logger['debug'](_0x0d11('0x10'),_0x33c46e,_0x0d11('0xf'),JSON[_0x0d11('0x11')](_0x4c6a59));if(_0x4c6a59[_0x0d11('0x12')]){if(_0x4c6a59['error'][_0x0d11('0x13')]===0x1f4){logger[_0x0d11('0x12')]('Attachment,\x20%s,\x20%s',_0x33c46e,_0x4c6a59[_0x0d11('0x12')][_0x0d11('0x14')]);return _0x3f9f5a(_0x4c6a59[_0x0d11('0x12')]['message']);}logger[_0x0d11('0x12')](_0x0d11('0x15'),_0x33c46e,_0x4c6a59['error'][_0x0d11('0x14')]);return _0x47a493(_0x4c6a59[_0x0d11('0x12')][_0x0d11('0x14')]);}else{logger[_0x0d11('0xe')](_0x0d11('0x15'),_0x33c46e,'request\x20sent');_0x47a493(_0x4c6a59['result'][_0x0d11('0x14')]);}})['catch'](function(_0x46aa4f){logger[_0x0d11('0x12')]('Attachment,\x20%s,\x20%s',_0x33c46e,_0x46aa4f);_0x3f9f5a(_0x46aa4f);});});}exports[_0x0d11('0x16')]=function(_0x57df83){var _0x2e4c05=this;return new Promise(function(_0x2a29db,_0x5e3bd3){return db['Attachment'][_0x0d11('0x17')](_0x57df83[_0x0d11('0x18')],{'raw':_0x57df83[_0x0d11('0x19')]?_0x57df83[_0x0d11('0x19')][_0x0d11('0x1a')]===undefined?!![]:![]:!![]})[_0x0d11('0xd')](function(_0x575ea3){logger[_0x0d11('0xe')](_0x0d11('0x16'),_0x57df83);logger[_0x0d11('0x1b')](_0x0d11('0x16'),_0x57df83,JSON[_0x0d11('0x11')](_0x575ea3));_0x2a29db(_0x575ea3);})['catch'](function(_0x38955b){logger['error'](_0x0d11('0x16'),_0x38955b[_0x0d11('0x14')],_0x57df83);_0x5e3bd3(_0x2e4c05[_0x0d11('0x12')](0x1f4,_0x38955b['message']));});});}; \ No newline at end of file +var _0xff96=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','request\x20sent','debug','Attachment,\x20%s,\x20%s,\x20%s','stringify','error','code','message','Attachment,\x20%s,\x20%s','catch','body','options','raw','CreateAttachment'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xff96,0x179));var _0x6ff9=function(_0x5b360e,_0x494136){_0x5b360e=_0x5b360e-0x0;var _0x1bf752=_0xff96[_0x5b360e];return _0x1bf752;};'use strict';var _=require(_0x6ff9('0x0'));var util=require(_0x6ff9('0x1'));var moment=require(_0x6ff9('0x2'));var BPromise=require(_0x6ff9('0x3'));var rs=require(_0x6ff9('0x4'));var fs=require('fs');var Redis=require(_0x6ff9('0x5'));var db=require(_0x6ff9('0x6'))['db'];var utils=require(_0x6ff9('0x7'));var logger=require(_0x6ff9('0x8'))(_0x6ff9('0x9'));var config=require(_0x6ff9('0xa'));var jayson=require(_0x6ff9('0xb'));var client=jayson['client'][_0x6ff9('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x5509ee,_0x502cf2,_0x4f982b){return new BPromise(function(_0x5d56f4,_0x2b1b7d){return client[_0x6ff9('0xd')](_0x5509ee,_0x4f982b)[_0x6ff9('0xe')](function(_0x1ce5a3){logger[_0x6ff9('0xf')]('Attachment,\x20%s,\x20%s',_0x502cf2,_0x6ff9('0x10'));logger[_0x6ff9('0x11')](_0x6ff9('0x12'),_0x502cf2,_0x6ff9('0x10'),JSON[_0x6ff9('0x13')](_0x1ce5a3));if(_0x1ce5a3[_0x6ff9('0x14')]){if(_0x1ce5a3[_0x6ff9('0x14')][_0x6ff9('0x15')]===0x1f4){logger[_0x6ff9('0x14')]('Attachment,\x20%s,\x20%s',_0x502cf2,_0x1ce5a3['error'][_0x6ff9('0x16')]);return _0x2b1b7d(_0x1ce5a3['error'][_0x6ff9('0x16')]);}logger[_0x6ff9('0x14')](_0x6ff9('0x17'),_0x502cf2,_0x1ce5a3['error']['message']);return _0x5d56f4(_0x1ce5a3[_0x6ff9('0x14')][_0x6ff9('0x16')]);}else{logger[_0x6ff9('0xf')](_0x6ff9('0x17'),_0x502cf2,'request\x20sent');_0x5d56f4(_0x1ce5a3['result'][_0x6ff9('0x16')]);}})[_0x6ff9('0x18')](function(_0x3d4268){logger[_0x6ff9('0x14')](_0x6ff9('0x17'),_0x502cf2,_0x3d4268);_0x2b1b7d(_0x3d4268);});});}exports['CreateAttachment']=function(_0xc00da6){var _0x4756be=this;return new Promise(function(_0xc7724f,_0x5b0a94){return db['Attachment']['create'](_0xc00da6[_0x6ff9('0x19')],{'raw':_0xc00da6[_0x6ff9('0x1a')]?_0xc00da6[_0x6ff9('0x1a')][_0x6ff9('0x1b')]===undefined?!![]:![]:!![]})[_0x6ff9('0xe')](function(_0x4e926e){logger[_0x6ff9('0xf')](_0x6ff9('0x1c'),_0xc00da6);logger[_0x6ff9('0x11')](_0x6ff9('0x1c'),_0xc00da6,JSON[_0x6ff9('0x13')](_0x4e926e));_0xc7724f(_0x4e926e);})[_0x6ff9('0x18')](function(_0x50f207){logger[_0x6ff9('0x14')](_0x6ff9('0x1c'),_0x50f207['message'],_0xc00da6);_0x5b0a94(_0x4756be[_0x6ff9('0x14')](0x1f4,_0x50f207[_0x6ff9('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/attachment/index.js b/server/api/attachment/index.js index 7799e78..df50388 100644 --- a/server/api/attachment/index.js +++ b/server/api/attachment/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5f2f=['show','/:id/download','download','post','/:id/clone','clone','root','server/files/attachments/','format','now','originalname','replace','single','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./attachment.controller','get','isAuthenticated','index','/:id'];(function(_0x5ba396,_0x131a2c){var _0x517b87=function(_0x2f9ee1){while(--_0x2f9ee1){_0x5ba396['push'](_0x5ba396['shift']());}};_0x517b87(++_0x131a2c);}(_0x5f2f,0x73));var _0xf5f2=function(_0x254233,_0x45e922){_0x254233=_0x254233-0x0;var _0x24d660=_0x5f2f[_0x254233];return _0x24d660;};'use strict';var multer=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var path=require(_0xf5f2('0x2'));var timeout=require(_0xf5f2('0x3'));var express=require(_0xf5f2('0x4'));var router=express[_0xf5f2('0x5')]();var fs_extra=require(_0xf5f2('0x6'));var auth=require(_0xf5f2('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xf5f2('0x8'));router[_0xf5f2('0x9')]('/',auth[_0xf5f2('0xa')](),controller[_0xf5f2('0xb')]);router[_0xf5f2('0x9')](_0xf5f2('0xc'),auth['isAuthenticated'](),controller[_0xf5f2('0xd')]);router[_0xf5f2('0x9')](_0xf5f2('0xe'),auth['isAuthenticated'](),controller[_0xf5f2('0xf')]);router[_0xf5f2('0x10')](_0xf5f2('0x11'),auth['isAuthenticated'](),controller[_0xf5f2('0x12')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x53fb33,_0xa7e1a6,_0x151aba){_0x151aba(null,path['join'](config[_0xf5f2('0x13')],_0xf5f2('0x14')));},'filename':function(_0x331482,_0x3f2997,_0x59bb6c){_0x59bb6c(null,util[_0xf5f2('0x15')]('%s-%s',Date[_0xf5f2('0x16')](),_0x3f2997[_0xf5f2('0x17')][_0xf5f2('0x18')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0xf5f2('0x10')]('/',upload[_0xf5f2('0x19')]('file'),controller[_0xf5f2('0x1a')]);router[_0xf5f2('0x1b')](_0xf5f2('0xc'),auth[_0xf5f2('0xa')](),controller[_0xf5f2('0x1c')]);router[_0xf5f2('0x1d')](_0xf5f2('0xc'),auth[_0xf5f2('0xa')](),controller[_0xf5f2('0x1e')]);module[_0xf5f2('0x1f')]=router; \ No newline at end of file +var _0x2032=['./attachment.controller','get','isAuthenticated','index','/:id','show','download','/:id/clone','clone','root','server/files/attachments/','now','post','single','file','create','put','update','delete','destroy','exports','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment'];(function(_0x3d6a29,_0x37856f){var _0x10e16f=function(_0x4e05f2){while(--_0x4e05f2){_0x3d6a29['push'](_0x3d6a29['shift']());}};_0x10e16f(++_0x37856f);}(_0x2032,0xd9));var _0x2203=function(_0x411232,_0x338d2b){_0x411232=_0x411232-0x0;var _0x3bfcda=_0x2032[_0x411232];return _0x3bfcda;};'use strict';var multer=require('multer');var util=require(_0x2203('0x0'));var path=require(_0x2203('0x1'));var timeout=require(_0x2203('0x2'));var express=require('express');var router=express[_0x2203('0x3')]();var fs_extra=require(_0x2203('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x2203('0x5'));var config=require(_0x2203('0x6'));var controller=require(_0x2203('0x7'));router[_0x2203('0x8')]('/',auth[_0x2203('0x9')](),controller[_0x2203('0xa')]);router[_0x2203('0x8')](_0x2203('0xb'),auth[_0x2203('0x9')](),controller[_0x2203('0xc')]);router[_0x2203('0x8')]('/:id/download',auth['isAuthenticated'](),controller[_0x2203('0xd')]);router['post'](_0x2203('0xe'),auth[_0x2203('0x9')](),controller[_0x2203('0xf')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x849049,_0x4a6832,_0x3f690a){_0x3f690a(null,path['join'](config[_0x2203('0x10')],_0x2203('0x11')));},'filename':function(_0x4b9376,_0x583bc7,_0x585c76){_0x585c76(null,util['format']('%s-%s',Date[_0x2203('0x12')](),_0x583bc7['originalname']['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x2203('0x13')]('/',upload[_0x2203('0x14')](_0x2203('0x15')),controller[_0x2203('0x16')]);router[_0x2203('0x17')](_0x2203('0xb'),auth[_0x2203('0x9')](),controller[_0x2203('0x18')]);router[_0x2203('0x19')](_0x2203('0xb'),auth['isAuthenticated'](),controller[_0x2203('0x1a')]);module[_0x2203('0x1b')]=router; \ No newline at end of file diff --git a/server/api/authActiveDirectory/authActiveDirectory.controller.js b/server/api/authActiveDirectory/authActiveDirectory.controller.js index a2a46b1..df5cd05 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 _0xc293=['../../config/logger','activedirectory','baseDN','url','domain','authenticate','error','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','Error\x20authenticate\x20%s:\x20Wrong\x20credentials','Setting','findOne','adSsoEnabled','blockDuration','then','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20enabled','name','password','salt','disabled','blocked','blockedAt','user','agent','add','minutes','getLicense','catch','ad-login','Something\x20went\x20wrong,\x20please\x20try\x20again.','role','json','online','use','moment','activedirectory2','util','../../components/auth/service','../../config/utils','../../config/environment'];(function(_0x333065,_0xdf2be0){var _0x4d26c2=function(_0x3d8b58){while(--_0x3d8b58){_0x333065['push'](_0x333065['shift']());}};_0x4d26c2(++_0xdf2be0);}(_0xc293,0x132));var _0x3c29=function(_0x53a3d9,_0x581974){_0x53a3d9=_0x53a3d9-0x0;var _0x3b80bb=_0xc293[_0x53a3d9];return _0x3b80bb;};'use strict';var passport=require('passport');var LocalStrategy=require('passport-local')['Strategy'];var moment=require(_0x3c29('0x0'));var ActiveDirectory=require(_0x3c29('0x1'));var BPromise=require('bluebird');var util=require(_0x3c29('0x2'));var db=require('../../mysqldb')['db'];var authService=require(_0x3c29('0x3'));var utils=require(_0x3c29('0x4'));var config=require(_0x3c29('0x5'));var logger=require(_0x3c29('0x6'))('api');function isActiveDirectoryConfigured(_0x3babf9){var _0x3fa335=![];if(typeof _0x3babf9['activedirectory']!=='undefined'){_0x3fa335=_0x3babf9[_0x3c29('0x7')][_0x3c29('0x8')]&&_0x3babf9[_0x3c29('0x7')][_0x3c29('0x9')]&&_0x3babf9['activedirectory'][_0x3c29('0xa')];}return _0x3fa335;}function adAuthenticate(_0x4ef89e,_0x533123,_0x48f199){return new BPromise(function(_0x35eb37,_0x25e43e){try{var _0x5452ec=new ActiveDirectory(_0x4ef89e);_0x5452ec[_0x3c29('0xb')](_0x533123,_0x48f199,function(_0x45bc67,_0x56848e){if(_0x45bc67){logger[_0x3c29('0xc')]('Error\x20authenticate\x20%s:\x20%s',_0x533123,util['inspect'](_0x45bc67,{'showHidden':![],'depth':null}));_0x25e43e(_0x3c29('0xd'));}else if(!_0x56848e){logger[_0x3c29('0xc')](_0x3c29('0xe'),_0x533123);_0x25e43e(_0x3c29('0xd'));}else{_0x35eb37(_0x56848e);}});}catch(_0x3d3bfd){_0x25e43e(_0x3d3bfd);}});}function ActiveDirectoryAuthenticate(_0xcb5628,_0x4d1aa1,_0x56db2d,_0x270c9d){var _0x3b1201,_0x4f5221;if(!isActiveDirectoryConfigured(config)){logger['error']('Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20configured',_0x4d1aa1);return _0x270c9d(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}return db[_0x3c29('0xf')][_0x3c29('0x10')]({'where':{'id':0x1},'attributes':[_0x3c29('0x11'),_0x3c29('0x12')],'raw':!![]})[_0x3c29('0x13')](function(_0x5843e8){_0x3b1201=_0x5843e8;if(!_0x3b1201['adSsoEnabled']){logger[_0x3c29('0xc')](_0x3c29('0x14'),_0x4d1aa1);throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}return _0xcb5628['findOne']({'attributes':['id',_0x3c29('0x15'),_0x3c29('0x16'),_0x3c29('0x17'),'role',_0x3c29('0x18'),_0x3c29('0x19'),_0x3c29('0x1a'),'online'],'where':{'name':_0x4d1aa1,'role':{'$or':['admin',_0x3c29('0x1b'),_0x3c29('0x1c')]},'adSsoEnabled':!![]}});})['then'](function(_0x2604f0){if(!_0x2604f0||_0x2604f0&&_0x2604f0[_0x3c29('0x15')]!==_0x4d1aa1){throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}_0x4f5221=_0x2604f0;var _0x22af5b=_0x4f5221[_0x3c29('0x15')]+'@'+config[_0x3c29('0x7')][_0x3c29('0xa')];return adAuthenticate(config[_0x3c29('0x7')],_0x22af5b,_0x56db2d);})[_0x3c29('0x13')](function(_0x4624c3){if(_0x4f5221['disabled']){throw new Error(_0x3c29('0xd'));}if(_0x3b1201['blockDuration']>0x0){if(_0x4f5221[_0x3c29('0x19')]){if(moment(_0x4f5221[_0x3c29('0x1a')])[_0x3c29('0x1d')](_0x3b1201[_0x3c29('0x12')],_0x3c29('0x1e'))>moment()){throw new Error(_0x3c29('0xd'));}return utils['clearBlockUser'](_0x4f5221,0x0,![],null)[_0x3c29('0x13')](function(){return utils[_0x3c29('0x1f')](_0x4f5221);})[_0x3c29('0x13')](function(){return _0x270c9d(null,_0x4f5221);});}else{return utils['getLicense'](_0x4f5221)[_0x3c29('0x13')](function(){return _0x270c9d(null,_0x4f5221);});}}else{return utils[_0x3c29('0x1f')](_0x4f5221)['then'](function(){return _0x270c9d(null,_0x4f5221);});}})[_0x3c29('0x20')](function(_0xb9b6b2){return _0x270c9d(null,![],_0xb9b6b2);});}function handleError(_0x23f569,_0x395813,_0x4dac71){return _0x23f569['status'](_0x395813||0x1f4)['send']({'message':_0x4dac71?_0x4dac71['message']||_0x4dac71:''});}exports['login']=function(_0x31ea86,_0x56525f,_0x38a1b6){passport[_0x3c29('0xb')](_0x3c29('0x21'),function(_0x5568ad,_0x17e132,_0x243730){var _0x2fb2a8=_0x5568ad||_0x243730;if(_0x2fb2a8){return handleError(_0x56525f,0x191,_0x2fb2a8);}if(!_0x17e132){return handleError(_0x56525f,0x194,{'message':_0x3c29('0x22')});}else{var _0x1aa9d2={'payload':{'id':_0x17e132['id'],'role':_0x17e132[_0x3c29('0x23')]},'options':{'expiresIn':0x15180}};return authService['signToken'](_0x1aa9d2)[_0x3c29('0x13')](function(_0x5c35f9){_0x56525f[_0x3c29('0x24')]({'id':_0x17e132['id'],'token':_0x5c35f9,'statusCall':'','isAlreadyLogged':_0x17e132[_0x3c29('0x25')]});});}})(_0x31ea86,_0x56525f,_0x38a1b6);};passport[_0x3c29('0x26')](_0x3c29('0x21'),new LocalStrategy({'usernameField':'name','passwordField':_0x3c29('0x16')},function(_0x5b3fc6,_0x498dc5,_0x8effbf){return ActiveDirectoryAuthenticate(db['User'],_0x5b3fc6,_0x498dc5,_0x8effbf);})); \ No newline at end of file +var _0xc1ea=['catch','status','send','login','ad-login','Something\x20went\x20wrong,\x20please\x20try\x20again.','signToken','json','use','passport','passport-local','Strategy','moment','activedirectory2','../../components/auth/service','../../config/utils','../../config/environment','../../config/logger','undefined','activedirectory','baseDN','domain','authenticate','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','Setting','findOne','blockDuration','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20enabled','name','password','salt','role','disabled','blocked','blockedAt','online','admin','user','then','clearBlockUser','getLicense'];(function(_0xa1e3e3,_0x29fe0e){var _0xc980e9=function(_0x1f5adc){while(--_0x1f5adc){_0xa1e3e3['push'](_0xa1e3e3['shift']());}};_0xc980e9(++_0x29fe0e);}(_0xc1ea,0x13d));var _0xac1e=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0xc1ea[_0x19950b];return _0x3c6b41;};'use strict';var passport=require(_0xac1e('0x0'));var LocalStrategy=require(_0xac1e('0x1'))[_0xac1e('0x2')];var moment=require(_0xac1e('0x3'));var ActiveDirectory=require(_0xac1e('0x4'));var BPromise=require('bluebird');var util=require('util');var db=require('../../mysqldb')['db'];var authService=require(_0xac1e('0x5'));var utils=require(_0xac1e('0x6'));var config=require(_0xac1e('0x7'));var logger=require(_0xac1e('0x8'))('api');function isActiveDirectoryConfigured(_0x244ed6){var _0x46a341=![];if(typeof _0x244ed6['activedirectory']!==_0xac1e('0x9')){_0x46a341=_0x244ed6[_0xac1e('0xa')][_0xac1e('0xb')]&&_0x244ed6['activedirectory']['url']&&_0x244ed6['activedirectory'][_0xac1e('0xc')];}return _0x46a341;}function adAuthenticate(_0x333af4,_0x4ab670,_0x33b8bd){return new BPromise(function(_0x887bc4,_0x1176f2){try{var _0x3fc796=new ActiveDirectory(_0x333af4);_0x3fc796[_0xac1e('0xd')](_0x4ab670,_0x33b8bd,function(_0x187030,_0x2da492){if(_0x187030){logger[_0xac1e('0xe')](_0xac1e('0xf'),_0x4ab670,util['inspect'](_0x187030,{'showHidden':![],'depth':null}));_0x1176f2(_0xac1e('0x10'));}else if(!_0x2da492){logger[_0xac1e('0xe')](_0xac1e('0x11'),_0x4ab670);_0x1176f2(_0xac1e('0x10'));}else{_0x887bc4(_0x2da492);}});}catch(_0x3df19a){_0x1176f2(_0x3df19a);}});}function ActiveDirectoryAuthenticate(_0x354412,_0x103155,_0x1d41f7,_0x1ce20a){var _0x367782,_0x365a20;if(!isActiveDirectoryConfigured(config)){logger[_0xac1e('0xe')]('Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20configured',_0x103155);return _0x1ce20a(null,![],{'message':_0xac1e('0x10')});}return db[_0xac1e('0x12')][_0xac1e('0x13')]({'where':{'id':0x1},'attributes':['adSsoEnabled',_0xac1e('0x14')],'raw':!![]})['then'](function(_0x197a25){_0x367782=_0x197a25;if(!_0x367782['adSsoEnabled']){logger[_0xac1e('0xe')](_0xac1e('0x15'),_0x103155);throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}return _0x354412[_0xac1e('0x13')]({'attributes':['id',_0xac1e('0x16'),_0xac1e('0x17'),_0xac1e('0x18'),_0xac1e('0x19'),_0xac1e('0x1a'),_0xac1e('0x1b'),_0xac1e('0x1c'),_0xac1e('0x1d')],'where':{'name':_0x103155,'role':{'$or':[_0xac1e('0x1e'),_0xac1e('0x1f'),'agent']},'adSsoEnabled':!![]}});})[_0xac1e('0x20')](function(_0xf78f5c){if(!_0xf78f5c||_0xf78f5c&&_0xf78f5c[_0xac1e('0x16')]!==_0x103155){throw new Error(_0xac1e('0x10'));}_0x365a20=_0xf78f5c;var _0x20004a=_0x365a20[_0xac1e('0x16')]+'@'+config[_0xac1e('0xa')]['domain'];return adAuthenticate(config[_0xac1e('0xa')],_0x20004a,_0x1d41f7);})['then'](function(_0x24e478){if(_0x365a20[_0xac1e('0x1a')]){throw new Error(_0xac1e('0x10'));}if(_0x367782[_0xac1e('0x14')]>0x0){if(_0x365a20[_0xac1e('0x1b')]){if(moment(_0x365a20[_0xac1e('0x1c')])['add'](_0x367782['blockDuration'],'minutes')>moment()){throw new Error(_0xac1e('0x10'));}return utils[_0xac1e('0x21')](_0x365a20,0x0,![],null)[_0xac1e('0x20')](function(){return utils[_0xac1e('0x22')](_0x365a20);})[_0xac1e('0x20')](function(){return _0x1ce20a(null,_0x365a20);});}else{return utils[_0xac1e('0x22')](_0x365a20)[_0xac1e('0x20')](function(){return _0x1ce20a(null,_0x365a20);});}}else{return utils['getLicense'](_0x365a20)['then'](function(){return _0x1ce20a(null,_0x365a20);});}})[_0xac1e('0x23')](function(_0x4d48b3){return _0x1ce20a(null,![],_0x4d48b3);});}function handleError(_0x61c90e,_0x2adb7b,_0x15f529){return _0x61c90e[_0xac1e('0x24')](_0x2adb7b||0x1f4)[_0xac1e('0x25')]({'message':_0x15f529?_0x15f529['message']||_0x15f529:''});}exports[_0xac1e('0x26')]=function(_0x54026f,_0x247191,_0x470e28){passport[_0xac1e('0xd')](_0xac1e('0x27'),function(_0x1670a9,_0x395755,_0x523dda){var _0x2723d6=_0x1670a9||_0x523dda;if(_0x2723d6){return handleError(_0x247191,0x191,_0x2723d6);}if(!_0x395755){return handleError(_0x247191,0x194,{'message':_0xac1e('0x28')});}else{var _0x2b2433={'payload':{'id':_0x395755['id'],'role':_0x395755['role']},'options':{'expiresIn':0x15180}};return authService[_0xac1e('0x29')](_0x2b2433)[_0xac1e('0x20')](function(_0x1584a7){_0x247191[_0xac1e('0x2a')]({'id':_0x395755['id'],'token':_0x1584a7,'statusCall':'','isAlreadyLogged':_0x395755[_0xac1e('0x1d')]});});}})(_0x54026f,_0x247191,_0x470e28);};passport[_0xac1e('0x2b')](_0xac1e('0x27'),new LocalStrategy({'usernameField':'name','passwordField':_0xac1e('0x17')},function(_0x157d86,_0x155d15,_0x204ec2){return ActiveDirectoryAuthenticate(db['User'],_0x157d86,_0x155d15,_0x204ec2);})); \ No newline at end of file diff --git a/server/api/authActiveDirectory/index.js b/server/api/authActiveDirectory/index.js index 27ad7dd..0b3e35e 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 _0x0300=['login','exports','express','./authActiveDirectory.controller'];(function(_0x191dca,_0x58375a){var _0x4d3bc5=function(_0x438640){while(--_0x438640){_0x191dca['push'](_0x191dca['shift']());}};_0x4d3bc5(++_0x58375a);}(_0x0300,0x146));var _0x0030=function(_0x4b2962,_0x565501){_0x4b2962=_0x4b2962-0x0;var _0x496615=_0x0300[_0x4b2962];return _0x496615;};'use strict';var express=require(_0x0030('0x0'));var router=express['Router']();var controller=require(_0x0030('0x1'));router['post']('/',controller[_0x0030('0x2')]);module[_0x0030('0x3')]=router; \ No newline at end of file +var _0x6203=['Router','login','exports'];(function(_0x431d2c,_0x12dac6){var _0x2e86d2=function(_0x3f68a8){while(--_0x3f68a8){_0x431d2c['push'](_0x431d2c['shift']());}};_0x2e86d2(++_0x12dac6);}(_0x6203,0x12c));var _0x3620=function(_0x1ce554,_0x507b9b){_0x1ce554=_0x1ce554-0x0;var _0x4f062a=_0x6203[_0x1ce554];return _0x4f062a;};'use strict';var express=require('express');var router=express[_0x3620('0x0')]();var controller=require('./authActiveDirectory.controller');router['post']('/',controller[_0x3620('0x1')]);module[_0x3620('0x2')]=router; \ No newline at end of file diff --git a/server/api/authGoogle/authGoogle.controller.js b/server/api/authGoogle/authGoogle.controller.js index 985955a..0d5fe97 100644 --- a/server/api/authGoogle/authGoogle.controller.js +++ b/server/api/authGoogle/authGoogle.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['blockedAt','add','minutes','clearBlockUser','getLicense','catch','lodash','passport','passport-google-oauth20','moment','../../mysqldb','../../config/utils','login','authenticate','google','/login','email','use','secret','callbackURL','findOne','allowedLoginAttempts','blockDuration','then','User','find','map','value','admin','user','agent','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x7a54,0x106));var _0x47a5=function(_0x58bfa6,_0x719534){_0x58bfa6=_0x58bfa6-0x0;var _0xbefddc=_0x7a54[_0x58bfa6];return _0xbefddc;};'use strict';var _=require(_0x47a5('0x0'));var passport=require(_0x47a5('0x1'));var GoogleStrategy=require(_0x47a5('0x2'))['Strategy'];var moment=require(_0x47a5('0x3'));var db=require(_0x47a5('0x4'))['db'];var config=require('../../config/environment');var utils=require(_0x47a5('0x5'));exports[_0x47a5('0x6')]=passport[_0x47a5('0x7')](_0x47a5('0x8'),{'failureRedirect':_0x47a5('0x9'),'scope':['profile',_0x47a5('0xa')],'session':![]});exports['callback']=passport[_0x47a5('0x7')](_0x47a5('0x8'),{'failureRedirect':'/login','session':![]});passport[_0x47a5('0xb')](new GoogleStrategy({'clientID':config['google']?config['google']['clientID']:'id','clientSecret':config[_0x47a5('0x8')]?config[_0x47a5('0x8')]['clientSecret']:_0x47a5('0xc'),'callbackURL':config['google']?config['google'][_0x47a5('0xd')]:''},function(_0x69e4d4,_0x2f399b,_0x250fad,_0xd612dd){var _0xd308b8,_0x1eae59;return db['Setting'][_0x47a5('0xe')]({'where':{'id':0x1},'attributes':[_0x47a5('0xf'),_0x47a5('0x10')],'raw':!![]})[_0x47a5('0x11')](function(_0x139f25){_0xd308b8=_0x139f25;return db[_0x47a5('0x12')][_0x47a5('0x13')]({'where':{'email':_[_0x47a5('0x14')](_0x250fad['emails'],_0x47a5('0x15')),'role':{'$or':[_0x47a5('0x16'),_0x47a5('0x17'),_0x47a5('0x18')]}}});})[_0x47a5('0x11')](function(_0x574af6){_0x1eae59=_0x574af6;if(_0x1eae59){if(_0x1eae59['disabled']){return _0xd612dd(_0x47a5('0x19'));}else if(_0xd308b8['blockDuration']>0x0){if(_0x1eae59['blocked']){if(moment(_0x1eae59[_0x47a5('0x1a')])[_0x47a5('0x1b')](_0xd308b8[_0x47a5('0x10')],_0x47a5('0x1c'))>moment()){return _0xd612dd(_0x47a5('0x19'));}else{return utils[_0x47a5('0x1d')](_0x1eae59,0x0,![],null)[_0x47a5('0x11')](function(){return utils[_0x47a5('0x1e')](_0x1eae59);})[_0x47a5('0x11')](function(){return _0xd612dd(null,_0x1eae59);});}}else{return utils['getLicense'](_0x1eae59)[_0x47a5('0x11')](function(){return _0xd612dd(null,_0x1eae59);});}}else{return utils[_0x47a5('0x1e')](_0x1eae59)['then'](function(){return _0xd612dd(null,_0x1eae59);});}}return _0xd612dd(_0x47a5('0x19'));})[_0x47a5('0x1f')](function(_0x36874d){_0xd612dd(_0x36874d);});})); \ No newline at end of file +var _0x7a54=['blockedAt','add','minutes','clearBlockUser','getLicense','catch','lodash','passport','passport-google-oauth20','moment','../../mysqldb','../../config/utils','login','authenticate','google','/login','email','use','secret','callbackURL','findOne','allowedLoginAttempts','blockDuration','then','User','find','map','value','admin','user','agent','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'];(function(_0xefd519,_0xc62635){var _0x4bb882=function(_0x37e0a1){while(--_0x37e0a1){_0xefd519['push'](_0xefd519['shift']());}};_0x4bb882(++_0xc62635);}(_0x7a54,0x106));var _0x47a5=function(_0x116597,_0x1067a3){_0x116597=_0x116597-0x0;var _0x25522a=_0x7a54[_0x116597];return _0x25522a;};'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 ac13759..022e0f0 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 _0x0e5c=['Router','./authGoogle.controller','../user/user.controller.js','../../components/auth/service','login','get','/callback','callback','isMiddleware','setTokenCookie','exports','express'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x0e5c,0x1d3));var _0xc0e5=function(_0x1ca4c3,_0x554126){_0x1ca4c3=_0x1ca4c3-0x0;var _0x4426a6=_0x0e5c[_0x1ca4c3];return _0x4426a6;};'use strict';var express=require(_0xc0e5('0x0'));var passport=require('passport');var router=express[_0xc0e5('0x1')]();var controller=require(_0xc0e5('0x2'));var userController=require(_0xc0e5('0x3'));var authService=require(_0xc0e5('0x4'));router['get']('/',controller[_0xc0e5('0x5')]);router[_0xc0e5('0x6')](_0xc0e5('0x7'),controller[_0xc0e5('0x8')],authService[_0xc0e5('0x9')],userController['login'],authService[_0xc0e5('0xa')]);module[_0xc0e5('0xb')]=router; \ No newline at end of file +var _0xa7ff=['exports','express','Router','./authGoogle.controller','get','/callback','callback','isMiddleware','login','setTokenCookie'];(function(_0x1d17e1,_0x548a17){var _0x4353c6=function(_0x4b94aa){while(--_0x4b94aa){_0x1d17e1['push'](_0x1d17e1['shift']());}};_0x4353c6(++_0x548a17);}(_0xa7ff,0x169));var _0xfa7f=function(_0x580647,_0x43d2c3){_0x580647=_0x580647-0x0;var _0x5f0792=_0xa7ff[_0x580647];return _0x5f0792;};'use strict';var express=require(_0xfa7f('0x0'));var passport=require('passport');var router=express[_0xfa7f('0x1')]();var controller=require(_0xfa7f('0x2'));var userController=require('../user/user.controller.js');var authService=require('../../components/auth/service');router[_0xfa7f('0x3')]('/',controller['login']);router[_0xfa7f('0x3')](_0xfa7f('0x4'),controller[_0xfa7f('0x5')],authService[_0xfa7f('0x6')],userController[_0xfa7f('0x7')],authService[_0xfa7f('0x8')]);module[_0xfa7f('0x9')]=router; \ No newline at end of file diff --git a/server/api/authLocal/authLocal.controller.js b/server/api/authLocal/authLocal.controller.js index 1071aad..3c8a9f4 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 _0x1797=['error','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','stringify','status','send','local-login','Something\x20went\x20wrong,\x20please\x20try\x20again.','signToken','json','forgot','body','Email\x20parameter\x20is\x20missing','generate','trim','toLowerCase','User','This\x20email\x20is\x20not\x20registered.','The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.','The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.','resetPasswordToken','resetPasswordExpires','now','save','xCally\x20Motion\x20Password\x20Reset','Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a','https://','headers','host','Reset\x20Email\x20sent!','reset','token','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','securePassword','enforcePasswordHistory','passwordHistoryLimit','validatePasswordPattern','previousPasswords','validatePasswordHistory','use','util','passport','jayson/promise','lodash','randomstring','moment','../../mysqldb','../../components/auth/service','../../config/utils','client','http','Setting','findOne','allowedLoginAttempts','then','name','password','salt','role','disabled','blockedAt','admin','user','agent','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','authenticate','loginAttempts','blocked','blockDuration','add','minutes','clearBlockUser','getLicense','catch','MailAccount','find','email','Smtp','CloudProvider','format','\x22%s\x22\x20<%s>','request'];(function(_0x449082,_0x1f4485){var _0x21793a=function(_0x4c070a){while(--_0x4c070a){_0x449082['push'](_0x449082['shift']());}};_0x21793a(++_0x1f4485);}(_0x1797,0x78));var _0x7179=function(_0x1b828b,_0x344400){_0x1b828b=_0x1b828b-0x0;var _0x98da1a=_0x1797[_0x1b828b];return _0x98da1a;};'use strict';var util=require(_0x7179('0x0'));var passport=require(_0x7179('0x1'));var LocalStrategy=require('passport-local')['Strategy'];var jayson=require(_0x7179('0x2'));var _=require(_0x7179('0x3'));var rs=require(_0x7179('0x4'));var moment=require(_0x7179('0x5'));var db=require(_0x7179('0x6'))['db'];var authService=require(_0x7179('0x7'));var utils=require(_0x7179('0x8'));var client=jayson[_0x7179('0x9')][_0x7179('0xa')]({'port':0x232b});function localAuthenticate(_0x5bcc11,_0x1d6ec0,_0xdb8bae,_0x6f6e3c){var _0x433987,_0x247b4e;return db[_0x7179('0xb')][_0x7179('0xc')]({'where':{'id':0x1},'attributes':[_0x7179('0xd'),'blockDuration'],'raw':!![]})[_0x7179('0xe')](function(_0xb24c22){_0x433987=_0xb24c22;return _0x5bcc11[_0x7179('0xc')]({'attributes':['id',_0x7179('0xf'),_0x7179('0x10'),_0x7179('0x11'),_0x7179('0x12'),_0x7179('0x13'),'blocked',_0x7179('0x14'),'loginAttempts'],'where':{'name':_0x1d6ec0,'role':{'$or':[_0x7179('0x15'),_0x7179('0x16'),_0x7179('0x17')]}}});})['then'](function(_0x552be0){if(!_0x552be0||_0x552be0&&_0x552be0[_0x7179('0xf')]!==_0x1d6ec0){throw new Error(_0x7179('0x18'));}else{_0x247b4e=_0x552be0;return _0x247b4e;}})[_0x7179('0xe')](function(){_0x247b4e[_0x7179('0x19')](_0xdb8bae,function(_0x18681f,_0x1178fa){var _0x317942=_0x247b4e[_0x7179('0x1a')]+0x1;if(_0x18681f){return _0x6f6e3c(_0x18681f);}else if(!_0x1178fa){if(_0x247b4e[_0x7179('0x13')]){return _0x6f6e3c(null,![],{'message':_0x7179('0x18')});}else if(_0x433987[_0x7179('0xd')]>0x0){if(_0x247b4e[_0x7179('0x1b')]){if(_0x433987[_0x7179('0x1c')]>0x0){if(moment(_0x247b4e[_0x7179('0x14')])[_0x7179('0x1d')](_0x433987[_0x7179('0x1c')],_0x7179('0x1e'))>moment()){return _0x6f6e3c(null,![],{'message':_0x7179('0x18')});}else{return utils[_0x7179('0x1f')](_0x247b4e,_0x317942,![],null)[_0x7179('0xe')](function(){return _0x6f6e3c(null,![],{'message':_0x7179('0x18')});});}}else{return _0x6f6e3c(null,![],{'message':_0x7179('0x18')});}}else{if(_0x317942>=_0x433987['allowedLoginAttempts']){return utils[_0x7179('0x1f')](_0x247b4e,0x0,!![],moment())[_0x7179('0xe')](function(){return _0x6f6e3c(null,![],{'message':_0x7179('0x18')});});}else{return utils[_0x7179('0x1f')](_0x247b4e,_0x317942,![],null)[_0x7179('0xe')](function(){return _0x6f6e3c(null,![],{'message':_0x7179('0x18')});});}}}else{return _0x6f6e3c(null,![],{'message':_0x7179('0x18')});}}else{if(_0x247b4e['disabled']){return _0x6f6e3c(null,![],{'message':_0x7179('0x18')});}else if(_0x433987[_0x7179('0xd')]>0x0){if(_0x247b4e['blocked']){if(_0x433987[_0x7179('0x1c')]>0x0){if(moment(_0x247b4e[_0x7179('0x14')])[_0x7179('0x1d')](_0x433987[_0x7179('0x1c')],_0x7179('0x1e'))>moment()){return _0x6f6e3c(null,![],{'message':_0x7179('0x18')});}else{return utils[_0x7179('0x1f')](_0x247b4e,0x0,![],null)['then'](function(){return utils[_0x7179('0x20')](_0x247b4e);})[_0x7179('0xe')](function(){return _0x6f6e3c(null,_0x247b4e);});}}else{return _0x6f6e3c(null,![],{'message':_0x7179('0x18')});}}else{return utils[_0x7179('0x1f')](_0x247b4e,0x0,![],null)[_0x7179('0xe')](function(){return utils[_0x7179('0x20')](_0x247b4e);})[_0x7179('0xe')](function(){return _0x6f6e3c(null,_0x247b4e);})['catch'](function(_0x27dca3){return _0x6f6e3c(null,![],_0x27dca3);});}}else{if(_0x247b4e[_0x7179('0x1b')]){return _0x6f6e3c(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else{return utils[_0x7179('0x20')](_0x247b4e)[_0x7179('0xe')](function(){return _0x6f6e3c(null,_0x247b4e);});}}}});})[_0x7179('0x21')](function(_0xa6fcd9){return _0x6f6e3c(null,![],_0xa6fcd9);});}function sendServiceMail(_0x24d79d){return db[_0x7179('0x22')][_0x7179('0x23')]({'where':{'service':!![]},'attributes':['id',_0x7179('0xf'),_0x7179('0x24')],'include':[{'model':db['MailServerOut'],'as':_0x7179('0x25'),'include':[{'model':db[_0x7179('0x26')],'as':_0x7179('0x26')}]}]})[_0x7179('0xe')](function(_0x3b1512){if(!_0x3b1512){throw new Error('Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!');}var _0x3e7786=_0x3b1512['getSmtpOptions']();var _0x53b7aa={'account':_0x3e7786,'message':_['merge']({'from':util[_0x7179('0x27')](_0x7179('0x28'),_0x3b1512[_0x7179('0xf')],_0x3b1512[_0x7179('0x24')]||_0x3b1512[_0x7179('0x25')]['user'])},_0x24d79d)};return client[_0x7179('0x29')]('SendMail',_0x53b7aa);})[_0x7179('0xe')](function(_0x368d62){if(_0x368d62[_0x7179('0x2a')]){throw new Error(util[_0x7179('0x27')](_0x7179('0x2b'),_0x368d62[_0x7179('0x2a')]['message']||JSON[_0x7179('0x2c')](_0x368d62[_0x7179('0x2a')])));}return!![];});}function handleError(_0x5202e2,_0x11dd47,_0x5ee6c2){return _0x5202e2[_0x7179('0x2d')](_0x11dd47||0x1f4)[_0x7179('0x2e')]({'message':_0x5ee6c2?_0x5ee6c2['message']||_0x5ee6c2:''});}exports['login']=function(_0x7597e7,_0x4a7259,_0x5cfb71){passport[_0x7179('0x19')](_0x7179('0x2f'),function(_0x50d0b2,_0x44ad96,_0xc68f26){var _0x4fd0fe=_0x50d0b2||_0xc68f26;if(_0x4fd0fe){return handleError(_0x4a7259,0x191,_0x4fd0fe);}if(!_0x44ad96){return handleError(_0x4a7259,0x194,{'message':_0x7179('0x30')});}else{var _0x21c80f={'payload':{'id':_0x44ad96['id'],'role':_0x44ad96[_0x7179('0x12')]},'options':{'expiresIn':0x15180}};return authService[_0x7179('0x31')](_0x21c80f)['then'](function(_0x3f90fe){_0x4a7259[_0x7179('0x32')]({'id':_0x44ad96['id'],'token':_0x3f90fe,'statusCall':'','isAlreadyLogged':_0x44ad96['online']});});}})(_0x7597e7,_0x4a7259,_0x5cfb71);};exports[_0x7179('0x33')]=function(_0x25e6e9,_0x94c967){if(!_0x25e6e9[_0x7179('0x34')]['email']){return handleError(_0x94c967,0x1f4,{'message':_0x7179('0x35')});}var _0x4b2a45=rs[_0x7179('0x36')]();_0x25e6e9[_0x7179('0x34')][_0x7179('0x24')]=_0x25e6e9[_0x7179('0x34')][_0x7179('0x24')][_0x7179('0x37')]()[_0x7179('0x38')]();var _0x339e3f;return db[_0x7179('0xb')][_0x7179('0xc')]({'where':{'id':0x1},'attributes':[_0x7179('0xd'),_0x7179('0x1c')],'raw':!![]})[_0x7179('0xe')](function(_0x528cd4){_0x339e3f=_0x528cd4;return db[_0x7179('0x39')][_0x7179('0x23')]({'where':{'email':_0x25e6e9[_0x7179('0x34')][_0x7179('0x24')]}});})[_0x7179('0xe')](function(_0xfe536d){if(!_0xfe536d){throw new Error(_0x7179('0x3a'));}if(_0xfe536d[_0x7179('0x13')]){throw new Error(_0x7179('0x3b'));}if(_0xfe536d[_0x7179('0x1b')]){if(moment(_0xfe536d['blockedAt'])['add'](_0x339e3f[_0x7179('0x1c')],'minutes')>moment()){throw new Error(_0x7179('0x3c'));}else{_0xfe536d[_0x7179('0x1b')]=![];_0xfe536d[_0x7179('0x14')]=null;}}_0xfe536d[_0x7179('0x3d')]=_0x4b2a45;_0xfe536d[_0x7179('0x3e')]=Date[_0x7179('0x3f')]()+0x36ee80;return _0xfe536d[_0x7179('0x40')]();})['then'](function(){return sendServiceMail({'to':_0x25e6e9['body']['email'],'subject':_0x7179('0x41'),'text':'You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a'+_0x7179('0x42')+_0x7179('0x43')+_0x25e6e9[_0x7179('0x44')][_0x7179('0x45')]+'/reset/'+_0x4b2a45+'\x0a\x0a'+'If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a'});})['then'](function(){_0x94c967[_0x7179('0x2d')](0xc8)[_0x7179('0x2e')]({'message':_0x7179('0x46')});})[_0x7179('0x21')](function(_0x311766){return handleError(_0x94c967,0x1f4,_0x311766);});};exports[_0x7179('0x47')]=function(_0x4d7c1b,_0x3cfcbc){return db[_0x7179('0x39')][_0x7179('0x23')]({'where':{'resetPasswordToken':_0x4d7c1b['params'][_0x7179('0x48')],'resetPasswordExpires':{'$gt':Date[_0x7179('0x3f')]()}}})[_0x7179('0xe')](function(_0x2a2efc){if(!_0x2a2efc){throw new Error(_0x7179('0x49'));}return db[_0x7179('0xb')][_0x7179('0xc')]({'attributes':['id',_0x7179('0x4a'),_0x7179('0x4b'),_0x7179('0x4c')]})['then'](function(_0x47a34e){if(_0x47a34e[_0x7179('0x4a')])authService[_0x7179('0x4d')](_0x4d7c1b[_0x7179('0x34')][_0x7179('0x10')]);if(!_0x47a34e[_0x7179('0x4b')]||!_0x2a2efc[_0x7179('0x4e')])return _0x2a2efc;authService[_0x7179('0x4f')](_0x4d7c1b[_0x7179('0x34')][_0x7179('0x10')],_0x2a2efc['previousPasswords'],_0x47a34e[_0x7179('0x4c')]);return _0x2a2efc;})['then'](function(){_0x2a2efc[_0x7179('0x10')]=_0x4d7c1b[_0x7179('0x34')][_0x7179('0x10')];_0x2a2efc[_0x7179('0x3d')]=null;_0x2a2efc[_0x7179('0x3e')]=null;return _0x2a2efc[_0x7179('0x40')]();});})[_0x7179('0xe')](function(){_0x3cfcbc[_0x7179('0x2d')](0xc8)[_0x7179('0x2e')]({'message':'Password\x20reset!'});})[_0x7179('0x21')](function(_0x568d51){return handleError(_0x3cfcbc,0x1f4,_0x568d51);});};passport[_0x7179('0x50')](_0x7179('0x2f'),new LocalStrategy({'usernameField':_0x7179('0xf'),'passwordField':_0x7179('0x10')},function(_0x58f7f3,_0x25adbf,_0x3b1275){return localAuthenticate(db[_0x7179('0x39')],_0x58f7f3,_0x25adbf,_0x3b1275);})); \ No newline at end of file +var _0xde9f=['Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a','https://','headers','host','/reset/','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','Reset\x20Email\x20sent!','reset','User','params','token','now','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','enforcePasswordHistory','securePassword','validatePasswordPattern','previousPasswords','validatePasswordHistory','passwordHistoryLimit','save','Password\x20reset!','use','util','Strategy','jayson/promise','randomstring','moment','../../components/auth/service','../../config/utils','client','http','Setting','findOne','allowedLoginAttempts','blockDuration','then','name','password','salt','role','disabled','blocked','admin','user','agent','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','authenticate','loginAttempts','blockedAt','clearBlockUser','minutes','getLicense','catch','MailAccount','find','MailServerOut','Smtp','CloudProvider','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','merge','\x22%s\x22\x20<%s>','email','SendMail','format','error','stringify','status','send','message','login','local-login','Something\x20went\x20wrong,\x20please\x20try\x20again.','signToken','json','forgot','Email\x20parameter\x20is\x20missing','generate','body','toLowerCase','The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.','add','The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.','resetPasswordToken','resetPasswordExpires','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'];(function(_0x245de1,_0x35a17a){var _0xfdcc1d=function(_0x4297e8){while(--_0x4297e8){_0x245de1['push'](_0x245de1['shift']());}};_0xfdcc1d(++_0x35a17a);}(_0xde9f,0x118));var _0xfde9=function(_0xe73080,_0x24c56d){_0xe73080=_0xe73080-0x0;var _0x12cbc4=_0xde9f[_0xe73080];return _0x12cbc4;};'use strict';var util=require(_0xfde9('0x0'));var passport=require('passport');var LocalStrategy=require('passport-local')[_0xfde9('0x1')];var jayson=require(_0xfde9('0x2'));var _=require('lodash');var rs=require(_0xfde9('0x3'));var moment=require(_0xfde9('0x4'));var db=require('../../mysqldb')['db'];var authService=require(_0xfde9('0x5'));var utils=require(_0xfde9('0x6'));var client=jayson[_0xfde9('0x7')][_0xfde9('0x8')]({'port':0x232b});function localAuthenticate(_0x5e69c0,_0x4c3e01,_0x179ee0,_0x18a202){var _0x5569c2,_0x19a337;return db[_0xfde9('0x9')][_0xfde9('0xa')]({'where':{'id':0x1},'attributes':[_0xfde9('0xb'),_0xfde9('0xc')],'raw':!![]})[_0xfde9('0xd')](function(_0x3f29cd){_0x5569c2=_0x3f29cd;return _0x5e69c0[_0xfde9('0xa')]({'attributes':['id',_0xfde9('0xe'),_0xfde9('0xf'),_0xfde9('0x10'),_0xfde9('0x11'),_0xfde9('0x12'),_0xfde9('0x13'),'blockedAt','loginAttempts'],'where':{'name':_0x4c3e01,'role':{'$or':[_0xfde9('0x14'),_0xfde9('0x15'),_0xfde9('0x16')]}}});})[_0xfde9('0xd')](function(_0x52aacf){if(!_0x52aacf||_0x52aacf&&_0x52aacf['name']!==_0x4c3e01){throw new Error(_0xfde9('0x17'));}else{_0x19a337=_0x52aacf;return _0x19a337;}})[_0xfde9('0xd')](function(){_0x19a337[_0xfde9('0x18')](_0x179ee0,function(_0x5961ae,_0x29fa8a){var _0x489841=_0x19a337[_0xfde9('0x19')]+0x1;if(_0x5961ae){return _0x18a202(_0x5961ae);}else if(!_0x29fa8a){if(_0x19a337[_0xfde9('0x12')]){return _0x18a202(null,![],{'message':_0xfde9('0x17')});}else if(_0x5569c2['allowedLoginAttempts']>0x0){if(_0x19a337[_0xfde9('0x13')]){if(_0x5569c2[_0xfde9('0xc')]>0x0){if(moment(_0x19a337[_0xfde9('0x1a')])['add'](_0x5569c2['blockDuration'],'minutes')>moment()){return _0x18a202(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else{return utils[_0xfde9('0x1b')](_0x19a337,_0x489841,![],null)[_0xfde9('0xd')](function(){return _0x18a202(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}}else{return _0x18a202(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}}else{if(_0x489841>=_0x5569c2[_0xfde9('0xb')]){return utils[_0xfde9('0x1b')](_0x19a337,0x0,!![],moment())[_0xfde9('0xd')](function(){return _0x18a202(null,![],{'message':_0xfde9('0x17')});});}else{return utils[_0xfde9('0x1b')](_0x19a337,_0x489841,![],null)[_0xfde9('0xd')](function(){return _0x18a202(null,![],{'message':_0xfde9('0x17')});});}}}else{return _0x18a202(null,![],{'message':_0xfde9('0x17')});}}else{if(_0x19a337[_0xfde9('0x12')]){return _0x18a202(null,![],{'message':_0xfde9('0x17')});}else if(_0x5569c2[_0xfde9('0xb')]>0x0){if(_0x19a337[_0xfde9('0x13')]){if(_0x5569c2['blockDuration']>0x0){if(moment(_0x19a337[_0xfde9('0x1a')])['add'](_0x5569c2[_0xfde9('0xc')],_0xfde9('0x1c'))>moment()){return _0x18a202(null,![],{'message':_0xfde9('0x17')});}else{return utils['clearBlockUser'](_0x19a337,0x0,![],null)[_0xfde9('0xd')](function(){return utils[_0xfde9('0x1d')](_0x19a337);})['then'](function(){return _0x18a202(null,_0x19a337);});}}else{return _0x18a202(null,![],{'message':_0xfde9('0x17')});}}else{return utils[_0xfde9('0x1b')](_0x19a337,0x0,![],null)[_0xfde9('0xd')](function(){return utils[_0xfde9('0x1d')](_0x19a337);})[_0xfde9('0xd')](function(){return _0x18a202(null,_0x19a337);})[_0xfde9('0x1e')](function(_0x1f2e12){return _0x18a202(null,![],_0x1f2e12);});}}else{if(_0x19a337[_0xfde9('0x13')]){return _0x18a202(null,![],{'message':_0xfde9('0x17')});}else{return utils[_0xfde9('0x1d')](_0x19a337)[_0xfde9('0xd')](function(){return _0x18a202(null,_0x19a337);});}}}});})[_0xfde9('0x1e')](function(_0x457402){return _0x18a202(null,![],_0x457402);});}function sendServiceMail(_0x441bba){return db[_0xfde9('0x1f')][_0xfde9('0x20')]({'where':{'service':!![]},'attributes':['id','name','email'],'include':[{'model':db[_0xfde9('0x21')],'as':_0xfde9('0x22'),'include':[{'model':db['CloudProvider'],'as':_0xfde9('0x23')}]}]})[_0xfde9('0xd')](function(_0x1651e0){if(!_0x1651e0){throw new Error(_0xfde9('0x24'));}var _0x3c8c48=_0x1651e0['getSmtpOptions']();var _0x375b0d={'account':_0x3c8c48,'message':_[_0xfde9('0x25')]({'from':util['format'](_0xfde9('0x26'),_0x1651e0[_0xfde9('0xe')],_0x1651e0[_0xfde9('0x27')]||_0x1651e0[_0xfde9('0x22')][_0xfde9('0x15')])},_0x441bba)};return client['request'](_0xfde9('0x28'),_0x375b0d);})['then'](function(_0x35dfe5){if(_0x35dfe5['error']){throw new Error(util[_0xfde9('0x29')]('SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!',_0x35dfe5[_0xfde9('0x2a')]['message']||JSON[_0xfde9('0x2b')](_0x35dfe5[_0xfde9('0x2a')])));}return!![];});}function handleError(_0x3f5038,_0x27ad23,_0xdf5264){return _0x3f5038[_0xfde9('0x2c')](_0x27ad23||0x1f4)[_0xfde9('0x2d')]({'message':_0xdf5264?_0xdf5264[_0xfde9('0x2e')]||_0xdf5264:''});}exports[_0xfde9('0x2f')]=function(_0x91a8e9,_0x3f9c43,_0x5310cf){passport[_0xfde9('0x18')](_0xfde9('0x30'),function(_0x20c2a4,_0x304323,_0x4f6b6e){var _0x3cd49c=_0x20c2a4||_0x4f6b6e;if(_0x3cd49c){return handleError(_0x3f9c43,0x191,_0x3cd49c);}if(!_0x304323){return handleError(_0x3f9c43,0x194,{'message':_0xfde9('0x31')});}else{var _0x2cea35={'payload':{'id':_0x304323['id'],'role':_0x304323[_0xfde9('0x11')]},'options':{'expiresIn':0x15180}};return authService[_0xfde9('0x32')](_0x2cea35)[_0xfde9('0xd')](function(_0x481488){_0x3f9c43[_0xfde9('0x33')]({'id':_0x304323['id'],'token':_0x481488,'statusCall':'','isAlreadyLogged':_0x304323['online']});});}})(_0x91a8e9,_0x3f9c43,_0x5310cf);};exports[_0xfde9('0x34')]=function(_0x1c57df,_0xbd5dd8){if(!_0x1c57df['body'][_0xfde9('0x27')]){return handleError(_0xbd5dd8,0x1f4,{'message':_0xfde9('0x35')});}var _0x60efca=rs[_0xfde9('0x36')]();_0x1c57df[_0xfde9('0x37')][_0xfde9('0x27')]=_0x1c57df[_0xfde9('0x37')][_0xfde9('0x27')]['trim']()[_0xfde9('0x38')]();var _0x3496aa;return db[_0xfde9('0x9')][_0xfde9('0xa')]({'where':{'id':0x1},'attributes':[_0xfde9('0xb'),'blockDuration'],'raw':!![]})[_0xfde9('0xd')](function(_0x266d01){_0x3496aa=_0x266d01;return db['User'][_0xfde9('0x20')]({'where':{'email':_0x1c57df[_0xfde9('0x37')][_0xfde9('0x27')]}});})['then'](function(_0x510173){if(!_0x510173){throw new Error('This\x20email\x20is\x20not\x20registered.');}if(_0x510173[_0xfde9('0x12')]){throw new Error(_0xfde9('0x39'));}if(_0x510173[_0xfde9('0x13')]){if(moment(_0x510173[_0xfde9('0x1a')])[_0xfde9('0x3a')](_0x3496aa[_0xfde9('0xc')],_0xfde9('0x1c'))>moment()){throw new Error(_0xfde9('0x3b'));}else{_0x510173[_0xfde9('0x13')]=![];_0x510173[_0xfde9('0x1a')]=null;}}_0x510173[_0xfde9('0x3c')]=_0x60efca;_0x510173[_0xfde9('0x3d')]=Date['now']()+0x36ee80;return _0x510173['save']();})['then'](function(){return sendServiceMail({'to':_0x1c57df['body'][_0xfde9('0x27')],'subject':_0xfde9('0x3e'),'text':_0xfde9('0x3f')+_0xfde9('0x40')+_0xfde9('0x41')+_0x1c57df[_0xfde9('0x42')][_0xfde9('0x43')]+_0xfde9('0x44')+_0x60efca+'\x0a\x0a'+_0xfde9('0x45')});})[_0xfde9('0xd')](function(){_0xbd5dd8[_0xfde9('0x2c')](0xc8)[_0xfde9('0x2d')]({'message':_0xfde9('0x46')});})[_0xfde9('0x1e')](function(_0x43f664){return handleError(_0xbd5dd8,0x1f4,_0x43f664);});};exports[_0xfde9('0x47')]=function(_0x3d4ca7,_0xcf7c00){return db[_0xfde9('0x48')]['find']({'where':{'resetPasswordToken':_0x3d4ca7[_0xfde9('0x49')][_0xfde9('0x4a')],'resetPasswordExpires':{'$gt':Date[_0xfde9('0x4b')]()}}})[_0xfde9('0xd')](function(_0x72cf29){if(!_0x72cf29){throw new Error(_0xfde9('0x4c'));}return db['Setting'][_0xfde9('0xa')]({'attributes':['id','securePassword',_0xfde9('0x4d'),'passwordHistoryLimit']})[_0xfde9('0xd')](function(_0x30f12d){if(_0x30f12d[_0xfde9('0x4e')])authService[_0xfde9('0x4f')](_0x3d4ca7[_0xfde9('0x37')]['password']);if(!_0x30f12d[_0xfde9('0x4d')]||!_0x72cf29[_0xfde9('0x50')])return _0x72cf29;authService[_0xfde9('0x51')](_0x3d4ca7[_0xfde9('0x37')][_0xfde9('0xf')],_0x72cf29[_0xfde9('0x50')],_0x30f12d[_0xfde9('0x52')]);return _0x72cf29;})[_0xfde9('0xd')](function(){_0x72cf29[_0xfde9('0xf')]=_0x3d4ca7[_0xfde9('0x37')][_0xfde9('0xf')];_0x72cf29['resetPasswordToken']=null;_0x72cf29[_0xfde9('0x3d')]=null;return _0x72cf29[_0xfde9('0x53')]();});})[_0xfde9('0xd')](function(){_0xcf7c00[_0xfde9('0x2c')](0xc8)[_0xfde9('0x2d')]({'message':_0xfde9('0x54')});})[_0xfde9('0x1e')](function(_0x418fd2){return handleError(_0xcf7c00,0x1f4,_0x418fd2);});};passport[_0xfde9('0x55')](_0xfde9('0x30'),new LocalStrategy({'usernameField':_0xfde9('0xe'),'passwordField':_0xfde9('0xf')},function(_0x18006d,_0x4d8ab1,_0x3a512b){return localAuthenticate(db['User'],_0x18006d,_0x4d8ab1,_0x3a512b);})); \ No newline at end of file diff --git a/server/api/authLocal/index.js b/server/api/authLocal/index.js index d3ebe6e..b910df5 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 _0x4390=['reset','exports','express','Router','./authLocal.controller','post','login','/forgot','forgot'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4390,0xd1));var _0x0439=function(_0xb66cc,_0x49b95f){_0xb66cc=_0xb66cc-0x0;var _0x5da561=_0x4390[_0xb66cc];return _0x5da561;};'use strict';var express=require(_0x0439('0x0'));var router=express[_0x0439('0x1')]();var controller=require(_0x0439('0x2'));router[_0x0439('0x3')]('/',controller[_0x0439('0x4')]);router['post'](_0x0439('0x5'),controller[_0x0439('0x6')]);router[_0x0439('0x3')]('/reset/:token',controller[_0x0439('0x7')]);module[_0x0439('0x8')]=router; \ No newline at end of file +var _0x19a1=['/forgot','forgot','post','reset','exports','express','login'];(function(_0xd1d19a,_0x1933f0){var _0x52a79d=function(_0x5199e2){while(--_0x5199e2){_0xd1d19a['push'](_0xd1d19a['shift']());}};_0x52a79d(++_0x1933f0);}(_0x19a1,0xfa));var _0x119a=function(_0x5a5ffb,_0x3aaf44){_0x5a5ffb=_0x5a5ffb-0x0;var _0x12d821=_0x19a1[_0x5a5ffb];return _0x12d821;};'use strict';var express=require(_0x119a('0x0'));var router=express['Router']();var controller=require('./authLocal.controller');router['post']('/',controller[_0x119a('0x1')]);router['post'](_0x119a('0x2'),controller[_0x119a('0x3')]);router[_0x119a('0x4')]('/reset/:token',controller[_0x119a('0x5')]);module[_0x119a('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 aa5f6a2..35927e2 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 _0x3431=['STRING','INTEGER','exports'];(function(_0x2673a4,_0x4d0b8d){var _0x5e3a6a=function(_0x59e268){while(--_0x59e268){_0x2673a4['push'](_0x2673a4['shift']());}};_0x5e3a6a(++_0x4d0b8d);}(_0x3431,0x1e5));var _0x1343=function(_0x2d2c16,_0x4e88b6){_0x2d2c16=_0x2d2c16-0x0;var _0x53f2fb=_0x3431[_0x2d2c16];return _0x53f2fb;};'use strict';var Sequelize=require('sequelize');module[_0x1343('0x0')]={'name':{'type':Sequelize[_0x1343('0x1')],'allowNull':![]},'channel':{'type':Sequelize[_0x1343('0x1')]},'description':{'type':Sequelize['STRING']},'status':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'timeout':{'type':Sequelize[_0x1343('0x2')],'defaultValue':0xa}}; \ No newline at end of file +var _0xb1ea=['STRING','BOOLEAN','INTEGER','sequelize','exports'];(function(_0x5e04b9,_0x3a19f3){var _0x2b94e6=function(_0x5d8149){while(--_0x5d8149){_0x5e04b9['push'](_0x5e04b9['shift']());}};_0x2b94e6(++_0x3a19f3);}(_0xb1ea,0x1a2));var _0xab1e=function(_0x139a3c,_0x4fc883){_0x139a3c=_0x139a3c-0x0;var _0x2b375b=_0xb1ea[_0x139a3c];return _0x2b375b;};'use strict';var Sequelize=require(_0xab1e('0x0'));module[_0xab1e('0x1')]={'name':{'type':Sequelize[_0xab1e('0x2')],'allowNull':![]},'channel':{'type':Sequelize[_0xab1e('0x2')]},'description':{'type':Sequelize[_0xab1e('0x2')]},'status':{'type':Sequelize[_0xab1e('0x3')],'defaultValue':![]},'timeout':{'type':Sequelize[_0xab1e('0x4')],'defaultValue':0xa}}; \ No newline at end of file diff --git a/server/api/automation/automation.controller.js b/server/api/automation/automation.controller.js index cb76e5c..f41bc10 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 _0x377a=['to-csv','lodash','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','status','end','json','offset','limit','undefined','count','set','reject','save','update','destroy','then','stack','name','send','index','map','rawAttributes','fieldName','type','model','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','Automation','findAll','rows','catch','show','params','keys','filters','includeAll','include','options','find','create','body','addConditions','Condition','ids','omit','findOne','getConditions','addActions','getActions','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path'];(function(_0x4f05fe,_0x4ff8db){var _0x269abb=function(_0x4b192c){while(--_0x4b192c){_0x4f05fe['push'](_0x4f05fe['shift']());}};_0x269abb(++_0x4ff8db);}(_0x377a,0x134));var _0xa377=function(_0x4cebcc,_0x56253e){_0x4cebcc=_0x4cebcc-0x0;var _0x4d1669=_0x377a[_0x4cebcc];return _0x4d1669;};'use strict';var emlformat=require(_0xa377('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xa377('0x1'));var jsonpatch=require(_0xa377('0x2'));var rp=require(_0xa377('0x3'));var moment=require(_0xa377('0x4'));var BPromise=require(_0xa377('0x5'));var Mustache=require('mustache');var util=require(_0xa377('0x6'));var path=require(_0xa377('0x7'));var sox=require('sox');var csv=require(_0xa377('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xa377('0x9'));var squel=require('squel');var crypto=require(_0xa377('0xa'));var jsforce=require(_0xa377('0xb'));var deskjs=require(_0xa377('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xa377('0xd'));var Redis=require(_0xa377('0xe'));var authService=require(_0xa377('0xf'));var qs=require(_0xa377('0x10'));var as=require(_0xa377('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa377('0x12'))(_0xa377('0x13'));var utils=require(_0xa377('0x14'));var config=require(_0xa377('0x15'));var licenseUtil=require(_0xa377('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xfe799b,_0x1a826){_0x1a826=_0x1a826||0xcc;return function(_0x342408){if(_0x342408){return _0xfe799b['sendStatus'](_0x1a826);}return _0xfe799b[_0xa377('0x17')](_0x1a826)[_0xa377('0x18')]();};}function respondWithResult(_0x55576e,_0x6e68b0){_0x6e68b0=_0x6e68b0||0xc8;return function(_0x48fb61){if(_0x48fb61){return _0x55576e['status'](_0x6e68b0)[_0xa377('0x19')](_0x48fb61);}};}function respondWithFilteredResult(_0x2180f2,_0x854d5a){return function(_0x53e3fd){if(_0x53e3fd){var _0x9bd580=typeof _0x854d5a[_0xa377('0x1a')]==='undefined'&&typeof _0x854d5a[_0xa377('0x1b')]===_0xa377('0x1c');var _0x65356e=_0x53e3fd[_0xa377('0x1d')];var _0x23defe=_0x9bd580?0x0:_0x854d5a[_0xa377('0x1a')];var _0x139383=_0x9bd580?_0x53e3fd[_0xa377('0x1d')]:_0x854d5a[_0xa377('0x1a')]+_0x854d5a[_0xa377('0x1b')];var _0x4d2e44;if(_0x139383>=_0x65356e){_0x139383=_0x65356e;_0x4d2e44=0xc8;}else{_0x4d2e44=0xce;}_0x2180f2[_0xa377('0x17')](_0x4d2e44);return _0x2180f2[_0xa377('0x1e')]('Content-Range',_0x23defe+'-'+_0x139383+'/'+_0x65356e)[_0xa377('0x19')](_0x53e3fd);}return null;};}function patchUpdates(_0x3c3f8a){return function(_0x591b52){try{jsonpatch['apply'](_0x591b52,_0x3c3f8a,!![]);}catch(_0x35e658){return BPromise[_0xa377('0x1f')](_0x35e658);}return _0x591b52[_0xa377('0x20')]();};}function saveUpdates(_0x32bee8,_0x3648a7){return function(_0x4a7cf4){if(_0x4a7cf4){return _0x4a7cf4[_0xa377('0x21')](_0x32bee8)['then'](function(_0x22c3f7){return _0x22c3f7;});}return null;};}function removeEntity(_0x5b569c,_0x409178){return function(_0x3a74ba){if(_0x3a74ba){return _0x3a74ba[_0xa377('0x22')]()[_0xa377('0x23')](function(){_0x5b569c['status'](0xcc)[_0xa377('0x18')]();});}};}function handleEntityNotFound(_0x283309,_0xbb60cb){return function(_0x4d771c){if(!_0x4d771c){_0x283309['sendStatus'](0x194);}return _0x4d771c;};}function handleError(_0x427a8d,_0x170141){_0x170141=_0x170141||0x1f4;return function(_0x9a8cb4){logger['error'](_0x9a8cb4[_0xa377('0x24')]);if(_0x9a8cb4['name']){delete _0x9a8cb4[_0xa377('0x25')];}_0x427a8d[_0xa377('0x17')](_0x170141)[_0xa377('0x26')](_0x9a8cb4);};}exports[_0xa377('0x27')]=function(_0x2a105b,_0x22e6ba){var _0x27c3d6={},_0x38c75c={},_0x31dac7={'count':0x0,'rows':[]};var _0x3a91a0=_[_0xa377('0x28')](db['Automation'][_0xa377('0x29')],function(_0x5ddd06){return{'name':_0x5ddd06[_0xa377('0x2a')],'type':_0x5ddd06[_0xa377('0x2b')]['key']};});_0x38c75c[_0xa377('0x2c')]=_[_0xa377('0x28')](_0x3a91a0,_0xa377('0x25'));_0x38c75c['query']=_['keys'](_0x2a105b['query']);_0x38c75c['filters']=_['intersection'](_0x38c75c['model'],_0x38c75c[_0xa377('0x2d')]);_0x27c3d6['attributes']=_[_0xa377('0x2e')](_0x38c75c[_0xa377('0x2c')],qs[_0xa377('0x2f')](_0x2a105b[_0xa377('0x2d')][_0xa377('0x2f')]));_0x27c3d6[_0xa377('0x30')]=_0x27c3d6[_0xa377('0x30')][_0xa377('0x31')]?_0x27c3d6[_0xa377('0x30')]:_0x38c75c[_0xa377('0x2c')];if(!_0x2a105b[_0xa377('0x2d')][_0xa377('0x32')](_0xa377('0x33'))){_0x27c3d6[_0xa377('0x1b')]=qs[_0xa377('0x1b')](_0x2a105b[_0xa377('0x2d')][_0xa377('0x1b')]);_0x27c3d6[_0xa377('0x1a')]=qs[_0xa377('0x1a')](_0x2a105b[_0xa377('0x2d')][_0xa377('0x1a')]);}_0x27c3d6[_0xa377('0x34')]=qs[_0xa377('0x35')](_0x2a105b[_0xa377('0x2d')]['sort']);_0x27c3d6[_0xa377('0x36')]=qs['filters'](_['pick'](_0x2a105b[_0xa377('0x2d')],_0x38c75c['filters']),_0x3a91a0);if(_0x2a105b[_0xa377('0x2d')][_0xa377('0x37')]){_0x27c3d6['where']=_[_0xa377('0x38')](_0x27c3d6[_0xa377('0x36')],{'$or':_['map'](_0x3a91a0,function(_0x5806e9){if(_0x5806e9[_0xa377('0x2b')]!=='VIRTUAL'){var _0x492513={};_0x492513[_0x5806e9[_0xa377('0x25')]]={'$like':'%'+_0x2a105b['query'][_0xa377('0x37')]+'%'};return _0x492513;}})});}_0x27c3d6=_[_0xa377('0x38')]({},_0x27c3d6,_0x2a105b['options']);var _0x346c9e={'where':_0x27c3d6['where']};return db[_0xa377('0x39')][_0xa377('0x1d')](_0x346c9e)[_0xa377('0x23')](function(_0x247753){_0x31dac7[_0xa377('0x1d')]=_0x247753;if(_0x2a105b[_0xa377('0x2d')]['includeAll']){_0x27c3d6['include']=[{'all':!![]}];}return db[_0xa377('0x39')][_0xa377('0x3a')](_0x27c3d6);})[_0xa377('0x23')](function(_0x2261d2){_0x31dac7[_0xa377('0x3b')]=_0x2261d2;return _0x31dac7;})[_0xa377('0x23')](respondWithFilteredResult(_0x22e6ba,_0x27c3d6))[_0xa377('0x3c')](handleError(_0x22e6ba,null));};exports[_0xa377('0x3d')]=function(_0x43bd1e,_0x3785d4){var _0x56cb0b={'raw':![],'where':{'id':_0x43bd1e[_0xa377('0x3e')]['id']}},_0x244cff={};_0x244cff[_0xa377('0x2c')]=_['keys'](db[_0xa377('0x39')]['rawAttributes']);_0x244cff[_0xa377('0x2d')]=_[_0xa377('0x3f')](_0x43bd1e[_0xa377('0x2d')]);_0x244cff[_0xa377('0x40')]=_[_0xa377('0x2e')](_0x244cff[_0xa377('0x2c')],_0x244cff[_0xa377('0x2d')]);_0x56cb0b[_0xa377('0x30')]=_['intersection'](_0x244cff['model'],qs[_0xa377('0x2f')](_0x43bd1e[_0xa377('0x2d')][_0xa377('0x2f')]));_0x56cb0b[_0xa377('0x30')]=_0x56cb0b[_0xa377('0x30')][_0xa377('0x31')]?_0x56cb0b[_0xa377('0x30')]:_0x244cff[_0xa377('0x2c')];if(_0x43bd1e[_0xa377('0x2d')][_0xa377('0x41')]){_0x56cb0b[_0xa377('0x42')]=[{'all':!![]}];}_0x56cb0b=_[_0xa377('0x38')]({},_0x56cb0b,_0x43bd1e[_0xa377('0x43')]);return db[_0xa377('0x39')][_0xa377('0x44')](_0x56cb0b)[_0xa377('0x23')](handleEntityNotFound(_0x3785d4,null))[_0xa377('0x23')](respondWithResult(_0x3785d4,null))['catch'](handleError(_0x3785d4,null));};exports[_0xa377('0x45')]=function(_0x1fffbf,_0x4db9f8){return db[_0xa377('0x39')]['create'](_0x1fffbf[_0xa377('0x46')],{})[_0xa377('0x23')](respondWithResult(_0x4db9f8,0xc9))['catch'](handleError(_0x4db9f8,null));};exports[_0xa377('0x21')]=function(_0x443962,_0x3801e7){if(_0x443962[_0xa377('0x46')]['id']){delete _0x443962[_0xa377('0x46')]['id'];}return db['Automation']['find']({'where':{'id':_0x443962[_0xa377('0x3e')]['id']}})[_0xa377('0x23')](handleEntityNotFound(_0x3801e7,null))[_0xa377('0x23')](saveUpdates(_0x443962[_0xa377('0x46')],null))[_0xa377('0x23')](respondWithResult(_0x3801e7,null))[_0xa377('0x3c')](handleError(_0x3801e7,null));};exports['destroy']=function(_0x2655fb,_0xbaa63){return db[_0xa377('0x39')][_0xa377('0x44')]({'where':{'id':_0x2655fb[_0xa377('0x3e')]['id']}})[_0xa377('0x23')](handleEntityNotFound(_0xbaa63,null))[_0xa377('0x23')](removeEntity(_0xbaa63,null))[_0xa377('0x3c')](handleError(_0xbaa63,null));};exports[_0xa377('0x47')]=function(_0x5a8981,_0x2ae82b,_0x596bd8){return db[_0xa377('0x48')][_0xa377('0x44')]({'where':{'id':_0x5a8981['params']['id']}})[_0xa377('0x23')](handleEntityNotFound(_0x2ae82b,null))['then'](function(_0x5f5ebb){if(_0x5f5ebb){return _0x5f5ebb[_0xa377('0x47')](_0x5a8981[_0xa377('0x46')][_0xa377('0x49')],_[_0xa377('0x4a')](_0x5a8981['body'],['ids','id'])||{});}})[_0xa377('0x23')](respondWithResult(_0x2ae82b,null))[_0xa377('0x3c')](handleError(_0x2ae82b,null));};exports['getConditions']=function(_0x5553eb,_0x267ade,_0x19c970){var _0x5e4368={};var _0x29eb55={};var _0x1ee447;var _0x4fb217;return db[_0xa377('0x39')][_0xa377('0x4b')]({'where':{'id':_0x5553eb[_0xa377('0x3e')]['id']}})['then'](handleEntityNotFound(_0x267ade,null))['then'](function(_0x13f66d){if(_0x13f66d){_0x1ee447=_0x13f66d;_0x29eb55[_0xa377('0x2c')]=_['keys'](db[_0xa377('0x48')][_0xa377('0x29')]);_0x29eb55['query']=_['keys'](_0x5553eb[_0xa377('0x2d')]);_0x29eb55[_0xa377('0x40')]=_[_0xa377('0x2e')](_0x29eb55[_0xa377('0x2c')],_0x29eb55['query']);_0x5e4368[_0xa377('0x30')]=_[_0xa377('0x2e')](_0x29eb55[_0xa377('0x2c')],qs['fields'](_0x5553eb['query'][_0xa377('0x2f')]));_0x5e4368[_0xa377('0x30')]=_0x5e4368[_0xa377('0x30')][_0xa377('0x31')]?_0x5e4368[_0xa377('0x30')]:_0x29eb55[_0xa377('0x2c')];_0x5e4368[_0xa377('0x34')]=qs[_0xa377('0x35')](_0x5553eb['query'][_0xa377('0x35')]);_0x5e4368[_0xa377('0x36')]=qs[_0xa377('0x40')](_['pick'](_0x5553eb[_0xa377('0x2d')],_0x29eb55[_0xa377('0x40')]));if(_0x5553eb[_0xa377('0x2d')]['filter']){_0x5e4368[_0xa377('0x36')]=_[_0xa377('0x38')](_0x5e4368[_0xa377('0x36')],{'$or':_[_0xa377('0x28')](_0x5e4368['attributes'],function(_0x19a11d){var _0x1f161d={};_0x1f161d[_0x19a11d]={'$like':'%'+_0x5553eb[_0xa377('0x2d')][_0xa377('0x37')]+'%'};return _0x1f161d;})});}_0x5e4368=_[_0xa377('0x38')]({},_0x5e4368,_0x5553eb[_0xa377('0x43')]);return _0x1ee447[_0xa377('0x4c')](_0x5e4368);}})[_0xa377('0x23')](function(_0x54d303){if(_0x54d303){_0x4fb217=_0x54d303[_0xa377('0x31')];if(!_0x5553eb['query']['hasOwnProperty'](_0xa377('0x33'))){_0x5e4368[_0xa377('0x1b')]=qs[_0xa377('0x1b')](_0x5553eb[_0xa377('0x2d')][_0xa377('0x1b')]);_0x5e4368[_0xa377('0x1a')]=qs['offset'](_0x5553eb[_0xa377('0x2d')][_0xa377('0x1a')]);}return _0x1ee447[_0xa377('0x4c')](_0x5e4368);}})[_0xa377('0x23')](function(_0x2140ae){if(_0x2140ae){return _0x2140ae?{'count':_0x4fb217,'rows':_0x2140ae}:null;}})['then'](respondWithResult(_0x267ade,null))[_0xa377('0x3c')](handleError(_0x267ade,null));};exports[_0xa377('0x4d')]=function(_0x5087d9,_0x220d92,_0x356c1e){return db['Action'][_0xa377('0x44')]({'where':{'id':_0x5087d9[_0xa377('0x3e')]['id']}})[_0xa377('0x23')](handleEntityNotFound(_0x220d92,null))[_0xa377('0x23')](function(_0x51e618){if(_0x51e618){return _0x51e618['addActions'](_0x5087d9[_0xa377('0x46')]['ids'],_['omit'](_0x5087d9[_0xa377('0x46')],[_0xa377('0x49'),'id'])||{});}})['then'](respondWithResult(_0x220d92,null))['catch'](handleError(_0x220d92,null));};exports[_0xa377('0x4e')]=function(_0x1ea7c2,_0x1b532b,_0x240886){var _0x427beb={};var _0x491515={};var _0x48519e;var _0x36b257;return db['Automation'][_0xa377('0x4b')]({'where':{'id':_0x1ea7c2[_0xa377('0x3e')]['id']}})[_0xa377('0x23')](handleEntityNotFound(_0x1b532b,null))['then'](function(_0x3aa8be){if(_0x3aa8be){_0x48519e=_0x3aa8be;_0x491515['model']=_[_0xa377('0x3f')](db['Action']['rawAttributes']);_0x491515[_0xa377('0x2d')]=_[_0xa377('0x3f')](_0x1ea7c2[_0xa377('0x2d')]);_0x491515[_0xa377('0x40')]=_[_0xa377('0x2e')](_0x491515[_0xa377('0x2c')],_0x491515['query']);_0x427beb[_0xa377('0x30')]=_[_0xa377('0x2e')](_0x491515['model'],qs[_0xa377('0x2f')](_0x1ea7c2[_0xa377('0x2d')][_0xa377('0x2f')]));_0x427beb[_0xa377('0x30')]=_0x427beb[_0xa377('0x30')][_0xa377('0x31')]?_0x427beb[_0xa377('0x30')]:_0x491515[_0xa377('0x2c')];_0x427beb[_0xa377('0x34')]=qs['sort'](_0x1ea7c2[_0xa377('0x2d')]['sort']);_0x427beb[_0xa377('0x36')]=qs['filters'](_['pick'](_0x1ea7c2['query'],_0x491515['filters']));if(_0x1ea7c2[_0xa377('0x2d')][_0xa377('0x37')]){_0x427beb[_0xa377('0x36')]=_[_0xa377('0x38')](_0x427beb['where'],{'$or':_[_0xa377('0x28')](_0x427beb[_0xa377('0x30')],function(_0x66b7f5){var _0x101fd3={};_0x101fd3[_0x66b7f5]={'$like':'%'+_0x1ea7c2[_0xa377('0x2d')][_0xa377('0x37')]+'%'};return _0x101fd3;})});}_0x427beb=_[_0xa377('0x38')]({},_0x427beb,_0x1ea7c2['options']);return _0x48519e[_0xa377('0x4e')](_0x427beb);}})[_0xa377('0x23')](function(_0x3676cc){if(_0x3676cc){_0x36b257=_0x3676cc[_0xa377('0x31')];if(!_0x1ea7c2[_0xa377('0x2d')][_0xa377('0x32')](_0xa377('0x33'))){_0x427beb[_0xa377('0x1b')]=qs[_0xa377('0x1b')](_0x1ea7c2['query'][_0xa377('0x1b')]);_0x427beb['offset']=qs[_0xa377('0x1a')](_0x1ea7c2[_0xa377('0x2d')][_0xa377('0x1a')]);}return _0x48519e[_0xa377('0x4e')](_0x427beb);}})[_0xa377('0x23')](function(_0x123280){if(_0x123280){return _0x123280?{'count':_0x36b257,'rows':_0x123280}:null;}})['then'](respondWithResult(_0x1b532b,null))[_0xa377('0x3c')](handleError(_0x1b532b,null));}; \ No newline at end of file +var _0xe8dd=['include','findAll','rows','catch','params','find','create','body','destroy','addConditions','Condition','ids','omit','getConditions','findOne','addActions','getActions','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','error','name','send','index','map','Automation','rawAttributes','fieldName','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options'];(function(_0x230d24,_0x43b946){var _0x13e159=function(_0x550f26){while(--_0x550f26){_0x230d24['push'](_0x230d24['shift']());}};_0x13e159(++_0x43b946);}(_0xe8dd,0x15d));var _0xde8d=function(_0x31c685,_0x28fba8){_0x31c685=_0x31c685-0x0;var _0xebeefb=_0xe8dd[_0x31c685];return _0xebeefb;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xde8d('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xde8d('0x1'));var rp=require('request-promise');var moment=require(_0xde8d('0x2'));var BPromise=require(_0xde8d('0x3'));var Mustache=require(_0xde8d('0x4'));var util=require(_0xde8d('0x5'));var path=require(_0xde8d('0x6'));var sox=require(_0xde8d('0x7'));var csv=require(_0xde8d('0x8'));var ejs=require(_0xde8d('0x9'));var fs=require('fs');var fs_extra=require(_0xde8d('0xa'));var _=require(_0xde8d('0xb'));var squel=require(_0xde8d('0xc'));var crypto=require(_0xde8d('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xde8d('0xe'));var toCsv=require(_0xde8d('0x8'));var querystring=require(_0xde8d('0xf'));var Papa=require(_0xde8d('0x10'));var Redis=require(_0xde8d('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xde8d('0x12'));var hardwareService=require(_0xde8d('0x13'));var logger=require(_0xde8d('0x14'))('api');var utils=require(_0xde8d('0x15'));var config=require(_0xde8d('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xde8d('0x17'))['db'];function respondWithStatusCode(_0x9ddeda,_0x43eaf3){_0x43eaf3=_0x43eaf3||0xcc;return function(_0x2d1564){if(_0x2d1564){return _0x9ddeda[_0xde8d('0x18')](_0x43eaf3);}return _0x9ddeda[_0xde8d('0x19')](_0x43eaf3)[_0xde8d('0x1a')]();};}function respondWithResult(_0x2b65bc,_0x3c3b71){_0x3c3b71=_0x3c3b71||0xc8;return function(_0x600ac0){if(_0x600ac0){return _0x2b65bc[_0xde8d('0x19')](_0x3c3b71)[_0xde8d('0x1b')](_0x600ac0);}};}function respondWithFilteredResult(_0x3abad5,_0x126911){return function(_0x46d62a){if(_0x46d62a){var _0x49ff8d=typeof _0x126911[_0xde8d('0x1c')]===_0xde8d('0x1d')&&typeof _0x126911[_0xde8d('0x1e')]===_0xde8d('0x1d');var _0x2da832=_0x46d62a[_0xde8d('0x1f')];var _0x5527c2=_0x49ff8d?0x0:_0x126911[_0xde8d('0x1c')];var _0x1225d6=_0x49ff8d?_0x46d62a[_0xde8d('0x1f')]:_0x126911[_0xde8d('0x1c')]+_0x126911[_0xde8d('0x1e')];var _0x2402ae;if(_0x1225d6>=_0x2da832){_0x1225d6=_0x2da832;_0x2402ae=0xc8;}else{_0x2402ae=0xce;}_0x3abad5['status'](_0x2402ae);return _0x3abad5[_0xde8d('0x20')](_0xde8d('0x21'),_0x5527c2+'-'+_0x1225d6+'/'+_0x2da832)[_0xde8d('0x1b')](_0x46d62a);}return null;};}function patchUpdates(_0x31546d){return function(_0x5d6716){try{jsonpatch[_0xde8d('0x22')](_0x5d6716,_0x31546d,!![]);}catch(_0x99210e){return BPromise[_0xde8d('0x23')](_0x99210e);}return _0x5d6716[_0xde8d('0x24')]();};}function saveUpdates(_0x14aea3,_0x18b8f4){return function(_0x5aa85a){if(_0x5aa85a){return _0x5aa85a[_0xde8d('0x25')](_0x14aea3)[_0xde8d('0x26')](function(_0xf05460){return _0xf05460;});}return null;};}function removeEntity(_0x442d84,_0xf96c64){return function(_0x48bb8d){if(_0x48bb8d){return _0x48bb8d['destroy']()[_0xde8d('0x26')](function(){_0x442d84[_0xde8d('0x19')](0xcc)[_0xde8d('0x1a')]();});}};}function handleEntityNotFound(_0x1c39ab,_0x1cdb83){return function(_0x740863){if(!_0x740863){_0x1c39ab['sendStatus'](0x194);}return _0x740863;};}function handleError(_0x30573c,_0x9e5c3e){_0x9e5c3e=_0x9e5c3e||0x1f4;return function(_0x5702fb){logger[_0xde8d('0x27')](_0x5702fb['stack']);if(_0x5702fb[_0xde8d('0x28')]){delete _0x5702fb[_0xde8d('0x28')];}_0x30573c[_0xde8d('0x19')](_0x9e5c3e)[_0xde8d('0x29')](_0x5702fb);};}exports[_0xde8d('0x2a')]=function(_0x4f9910,_0x3e433d){var _0x28220b={},_0x512f39={},_0x346d26={'count':0x0,'rows':[]};var _0x52f23a=_[_0xde8d('0x2b')](db[_0xde8d('0x2c')][_0xde8d('0x2d')],function(_0x466730){return{'name':_0x466730[_0xde8d('0x2e')],'type':_0x466730['type']['key']};});_0x512f39['model']=_[_0xde8d('0x2b')](_0x52f23a,'name');_0x512f39[_0xde8d('0x2f')]=_[_0xde8d('0x30')](_0x4f9910[_0xde8d('0x2f')]);_0x512f39[_0xde8d('0x31')]=_[_0xde8d('0x32')](_0x512f39[_0xde8d('0x33')],_0x512f39[_0xde8d('0x2f')]);_0x28220b[_0xde8d('0x34')]=_[_0xde8d('0x32')](_0x512f39[_0xde8d('0x33')],qs[_0xde8d('0x35')](_0x4f9910[_0xde8d('0x2f')]['fields']));_0x28220b[_0xde8d('0x34')]=_0x28220b[_0xde8d('0x34')][_0xde8d('0x36')]?_0x28220b[_0xde8d('0x34')]:_0x512f39[_0xde8d('0x33')];if(!_0x4f9910[_0xde8d('0x2f')][_0xde8d('0x37')](_0xde8d('0x38'))){_0x28220b[_0xde8d('0x1e')]=qs[_0xde8d('0x1e')](_0x4f9910['query'][_0xde8d('0x1e')]);_0x28220b[_0xde8d('0x1c')]=qs[_0xde8d('0x1c')](_0x4f9910['query'][_0xde8d('0x1c')]);}_0x28220b[_0xde8d('0x39')]=qs[_0xde8d('0x3a')](_0x4f9910['query'][_0xde8d('0x3a')]);_0x28220b[_0xde8d('0x3b')]=qs[_0xde8d('0x31')](_[_0xde8d('0x3c')](_0x4f9910['query'],_0x512f39[_0xde8d('0x31')]),_0x52f23a);if(_0x4f9910['query'][_0xde8d('0x3d')]){_0x28220b[_0xde8d('0x3b')]=_[_0xde8d('0x3e')](_0x28220b[_0xde8d('0x3b')],{'$or':_[_0xde8d('0x2b')](_0x52f23a,function(_0x52d65f){if(_0x52d65f[_0xde8d('0x3f')]!==_0xde8d('0x40')){var _0x55a2ab={};_0x55a2ab[_0x52d65f[_0xde8d('0x28')]]={'$like':'%'+_0x4f9910['query'][_0xde8d('0x3d')]+'%'};return _0x55a2ab;}})});}_0x28220b=_[_0xde8d('0x3e')]({},_0x28220b,_0x4f9910[_0xde8d('0x41')]);var _0x540429={'where':_0x28220b['where']};return db['Automation'][_0xde8d('0x1f')](_0x540429)['then'](function(_0x1a9ef2){_0x346d26['count']=_0x1a9ef2;if(_0x4f9910[_0xde8d('0x2f')]['includeAll']){_0x28220b[_0xde8d('0x42')]=[{'all':!![]}];}return db[_0xde8d('0x2c')][_0xde8d('0x43')](_0x28220b);})['then'](function(_0x13b9f2){_0x346d26[_0xde8d('0x44')]=_0x13b9f2;return _0x346d26;})[_0xde8d('0x26')](respondWithFilteredResult(_0x3e433d,_0x28220b))[_0xde8d('0x45')](handleError(_0x3e433d,null));};exports['show']=function(_0xae52ef,_0x53451c){var _0x32dfdc={'raw':![],'where':{'id':_0xae52ef[_0xde8d('0x46')]['id']}},_0x26406a={};_0x26406a[_0xde8d('0x33')]=_[_0xde8d('0x30')](db[_0xde8d('0x2c')][_0xde8d('0x2d')]);_0x26406a[_0xde8d('0x2f')]=_[_0xde8d('0x30')](_0xae52ef[_0xde8d('0x2f')]);_0x26406a[_0xde8d('0x31')]=_[_0xde8d('0x32')](_0x26406a[_0xde8d('0x33')],_0x26406a[_0xde8d('0x2f')]);_0x32dfdc[_0xde8d('0x34')]=_[_0xde8d('0x32')](_0x26406a[_0xde8d('0x33')],qs[_0xde8d('0x35')](_0xae52ef[_0xde8d('0x2f')][_0xde8d('0x35')]));_0x32dfdc['attributes']=_0x32dfdc[_0xde8d('0x34')][_0xde8d('0x36')]?_0x32dfdc[_0xde8d('0x34')]:_0x26406a[_0xde8d('0x33')];if(_0xae52ef[_0xde8d('0x2f')]['includeAll']){_0x32dfdc['include']=[{'all':!![]}];}_0x32dfdc=_[_0xde8d('0x3e')]({},_0x32dfdc,_0xae52ef[_0xde8d('0x41')]);return db[_0xde8d('0x2c')][_0xde8d('0x47')](_0x32dfdc)[_0xde8d('0x26')](handleEntityNotFound(_0x53451c,null))[_0xde8d('0x26')](respondWithResult(_0x53451c,null))[_0xde8d('0x45')](handleError(_0x53451c,null));};exports['create']=function(_0x25ed0e,_0x4275c1){return db['Automation'][_0xde8d('0x48')](_0x25ed0e[_0xde8d('0x49')],{})[_0xde8d('0x26')](respondWithResult(_0x4275c1,0xc9))[_0xde8d('0x45')](handleError(_0x4275c1,null));};exports['update']=function(_0x24ac1f,_0x20bc0c){if(_0x24ac1f[_0xde8d('0x49')]['id']){delete _0x24ac1f['body']['id'];}return db['Automation']['find']({'where':{'id':_0x24ac1f['params']['id']}})[_0xde8d('0x26')](handleEntityNotFound(_0x20bc0c,null))[_0xde8d('0x26')](saveUpdates(_0x24ac1f[_0xde8d('0x49')],null))[_0xde8d('0x26')](respondWithResult(_0x20bc0c,null))['catch'](handleError(_0x20bc0c,null));};exports[_0xde8d('0x4a')]=function(_0x2021a5,_0xa70b61){return db[_0xde8d('0x2c')][_0xde8d('0x47')]({'where':{'id':_0x2021a5['params']['id']}})[_0xde8d('0x26')](handleEntityNotFound(_0xa70b61,null))['then'](removeEntity(_0xa70b61,null))['catch'](handleError(_0xa70b61,null));};exports[_0xde8d('0x4b')]=function(_0x5e0f9c,_0x37544a,_0x4e89d7){return db[_0xde8d('0x4c')][_0xde8d('0x47')]({'where':{'id':_0x5e0f9c['params']['id']}})[_0xde8d('0x26')](handleEntityNotFound(_0x37544a,null))[_0xde8d('0x26')](function(_0x16b7e6){if(_0x16b7e6){return _0x16b7e6[_0xde8d('0x4b')](_0x5e0f9c[_0xde8d('0x49')][_0xde8d('0x4d')],_[_0xde8d('0x4e')](_0x5e0f9c[_0xde8d('0x49')],[_0xde8d('0x4d'),'id'])||{});}})[_0xde8d('0x26')](respondWithResult(_0x37544a,null))[_0xde8d('0x45')](handleError(_0x37544a,null));};exports[_0xde8d('0x4f')]=function(_0x42109c,_0xc3de02,_0x1e3891){var _0x569895={};var _0x370cb1={};var _0x1fdc48;var _0x41c371;return db[_0xde8d('0x2c')][_0xde8d('0x50')]({'where':{'id':_0x42109c[_0xde8d('0x46')]['id']}})[_0xde8d('0x26')](handleEntityNotFound(_0xc3de02,null))[_0xde8d('0x26')](function(_0x4f356f){if(_0x4f356f){_0x1fdc48=_0x4f356f;_0x370cb1[_0xde8d('0x33')]=_['keys'](db[_0xde8d('0x4c')][_0xde8d('0x2d')]);_0x370cb1[_0xde8d('0x2f')]=_['keys'](_0x42109c[_0xde8d('0x2f')]);_0x370cb1[_0xde8d('0x31')]=_['intersection'](_0x370cb1['model'],_0x370cb1[_0xde8d('0x2f')]);_0x569895[_0xde8d('0x34')]=_[_0xde8d('0x32')](_0x370cb1[_0xde8d('0x33')],qs['fields'](_0x42109c[_0xde8d('0x2f')][_0xde8d('0x35')]));_0x569895[_0xde8d('0x34')]=_0x569895[_0xde8d('0x34')][_0xde8d('0x36')]?_0x569895[_0xde8d('0x34')]:_0x370cb1[_0xde8d('0x33')];_0x569895[_0xde8d('0x39')]=qs[_0xde8d('0x3a')](_0x42109c[_0xde8d('0x2f')][_0xde8d('0x3a')]);_0x569895[_0xde8d('0x3b')]=qs[_0xde8d('0x31')](_[_0xde8d('0x3c')](_0x42109c['query'],_0x370cb1[_0xde8d('0x31')]));if(_0x42109c['query']['filter']){_0x569895[_0xde8d('0x3b')]=_[_0xde8d('0x3e')](_0x569895[_0xde8d('0x3b')],{'$or':_[_0xde8d('0x2b')](_0x569895['attributes'],function(_0x144d53){var _0x3fdecd={};_0x3fdecd[_0x144d53]={'$like':'%'+_0x42109c[_0xde8d('0x2f')][_0xde8d('0x3d')]+'%'};return _0x3fdecd;})});}_0x569895=_[_0xde8d('0x3e')]({},_0x569895,_0x42109c[_0xde8d('0x41')]);return _0x1fdc48[_0xde8d('0x4f')](_0x569895);}})['then'](function(_0x9a95ae){if(_0x9a95ae){_0x41c371=_0x9a95ae[_0xde8d('0x36')];if(!_0x42109c['query'][_0xde8d('0x37')]('nolimit')){_0x569895['limit']=qs[_0xde8d('0x1e')](_0x42109c[_0xde8d('0x2f')]['limit']);_0x569895[_0xde8d('0x1c')]=qs['offset'](_0x42109c[_0xde8d('0x2f')]['offset']);}return _0x1fdc48[_0xde8d('0x4f')](_0x569895);}})[_0xde8d('0x26')](function(_0x554962){if(_0x554962){return _0x554962?{'count':_0x41c371,'rows':_0x554962}:null;}})[_0xde8d('0x26')](respondWithResult(_0xc3de02,null))[_0xde8d('0x45')](handleError(_0xc3de02,null));};exports[_0xde8d('0x51')]=function(_0x365762,_0x5afa5d,_0x2f0e87){return db['Action']['find']({'where':{'id':_0x365762[_0xde8d('0x46')]['id']}})[_0xde8d('0x26')](handleEntityNotFound(_0x5afa5d,null))[_0xde8d('0x26')](function(_0x5d2efa){if(_0x5d2efa){return _0x5d2efa['addActions'](_0x365762[_0xde8d('0x49')][_0xde8d('0x4d')],_[_0xde8d('0x4e')](_0x365762['body'],[_0xde8d('0x4d'),'id'])||{});}})[_0xde8d('0x26')](respondWithResult(_0x5afa5d,null))['catch'](handleError(_0x5afa5d,null));};exports[_0xde8d('0x52')]=function(_0x1b7368,_0x2ee78e,_0x29388e){var _0xaed2c7={};var _0x25db87={};var _0x1b54bc;var _0x27e115;return db['Automation'][_0xde8d('0x50')]({'where':{'id':_0x1b7368['params']['id']}})[_0xde8d('0x26')](handleEntityNotFound(_0x2ee78e,null))[_0xde8d('0x26')](function(_0x386044){if(_0x386044){_0x1b54bc=_0x386044;_0x25db87[_0xde8d('0x33')]=_['keys'](db['Action']['rawAttributes']);_0x25db87[_0xde8d('0x2f')]=_[_0xde8d('0x30')](_0x1b7368[_0xde8d('0x2f')]);_0x25db87[_0xde8d('0x31')]=_[_0xde8d('0x32')](_0x25db87[_0xde8d('0x33')],_0x25db87[_0xde8d('0x2f')]);_0xaed2c7['attributes']=_[_0xde8d('0x32')](_0x25db87[_0xde8d('0x33')],qs[_0xde8d('0x35')](_0x1b7368['query']['fields']));_0xaed2c7[_0xde8d('0x34')]=_0xaed2c7['attributes']['length']?_0xaed2c7['attributes']:_0x25db87[_0xde8d('0x33')];_0xaed2c7[_0xde8d('0x39')]=qs['sort'](_0x1b7368['query'][_0xde8d('0x3a')]);_0xaed2c7['where']=qs['filters'](_[_0xde8d('0x3c')](_0x1b7368[_0xde8d('0x2f')],_0x25db87[_0xde8d('0x31')]));if(_0x1b7368['query']['filter']){_0xaed2c7[_0xde8d('0x3b')]=_['merge'](_0xaed2c7['where'],{'$or':_[_0xde8d('0x2b')](_0xaed2c7[_0xde8d('0x34')],function(_0x4caf72){var _0x39dc36={};_0x39dc36[_0x4caf72]={'$like':'%'+_0x1b7368['query']['filter']+'%'};return _0x39dc36;})});}_0xaed2c7=_[_0xde8d('0x3e')]({},_0xaed2c7,_0x1b7368['options']);return _0x1b54bc[_0xde8d('0x52')](_0xaed2c7);}})['then'](function(_0x34f44c){if(_0x34f44c){_0x27e115=_0x34f44c[_0xde8d('0x36')];if(!_0x1b7368[_0xde8d('0x2f')][_0xde8d('0x37')](_0xde8d('0x38'))){_0xaed2c7[_0xde8d('0x1e')]=qs[_0xde8d('0x1e')](_0x1b7368[_0xde8d('0x2f')][_0xde8d('0x1e')]);_0xaed2c7[_0xde8d('0x1c')]=qs['offset'](_0x1b7368[_0xde8d('0x2f')][_0xde8d('0x1c')]);}return _0x1b54bc[_0xde8d('0x52')](_0xaed2c7);}})[_0xde8d('0x26')](function(_0x31e72e){if(_0x31e72e){return _0x31e72e?{'count':_0x27e115,'rows':_0x31e72e}:null;}})[_0xde8d('0x26')](respondWithResult(_0x2ee78e,null))['catch'](handleError(_0x2ee78e,null));}; \ No newline at end of file diff --git a/server/api/automation/automation.model.js b/server/api/automation/automation.model.js index a8f9f05..815a104 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 _0x3c7c=['../../config/environment','./automation.attributes','define','Automation','tools_automations','lodash','util','moment','request-promise','rimraf'];(function(_0x2ed395,_0x24323b){var _0x14a5eb=function(_0x12a09b){while(--_0x12a09b){_0x2ed395['push'](_0x2ed395['shift']());}};_0x14a5eb(++_0x24323b);}(_0x3c7c,0x1a9));var _0xc3c7=function(_0xf32c6d,_0x372704){_0xf32c6d=_0xf32c6d-0x0;var _0x156c11=_0x3c7c[_0xf32c6d];return _0x156c11;};'use strict';var _=require(_0xc3c7('0x0'));var util=require(_0xc3c7('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xc3c7('0x2'));var BPromise=require('bluebird');var rp=require(_0xc3c7('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc3c7('0x4'));var config=require(_0xc3c7('0x5'));var attributes=require(_0xc3c7('0x6'));module['exports']=function(_0x513f9b,_0x130cde){return _0x513f9b[_0xc3c7('0x7')](_0xc3c7('0x8'),attributes,{'tableName':_0xc3c7('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0763=['moment','bluebird','../../config/environment','exports','define','tools_automations','lodash','util','../../config/logger','api'];(function(_0x1913a5,_0x18c610){var _0x58b6af=function(_0xdb7927){while(--_0xdb7927){_0x1913a5['push'](_0x1913a5['shift']());}};_0x58b6af(++_0x18c610);}(_0x0763,0x15a));var _0x3076=function(_0x2ca2d0,_0x3ea8e4){_0x2ca2d0=_0x2ca2d0-0x0;var _0x521c23=_0x0763[_0x2ca2d0];return _0x521c23;};'use strict';var _=require(_0x3076('0x0'));var util=require(_0x3076('0x1'));var logger=require(_0x3076('0x2'))(_0x3076('0x3'));var moment=require(_0x3076('0x4'));var BPromise=require(_0x3076('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x3076('0x6'));var attributes=require('./automation.attributes');module[_0x3076('0x7')]=function(_0x54a25c,_0x136a1d){return _0x54a25c[_0x3076('0x8')]('Automation',attributes,{'tableName':_0x3076('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/automation/automation.rpc.js b/server/api/automation/automation.rpc.js index 0613941..761c3cf 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 _0xeda7=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','request\x20sent','debug','Automation,\x20%s,\x20%s,\x20%s','error','code','Automation,\x20%s,\x20%s','message','info','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x1b31e3,_0x3f291d){var _0x5b7c8e=function(_0x285cf7){while(--_0x285cf7){_0x1b31e3['push'](_0x1b31e3['shift']());}};_0x5b7c8e(++_0x3f291d);}(_0xeda7,0x196));var _0x7eda=function(_0x20589d,_0x55d5bf){_0x20589d=_0x20589d-0x0;var _0x422de9=_0xeda7[_0x20589d];return _0x422de9;};'use strict';var _=require(_0x7eda('0x0'));var util=require(_0x7eda('0x1'));var moment=require(_0x7eda('0x2'));var BPromise=require(_0x7eda('0x3'));var rs=require(_0x7eda('0x4'));var fs=require('fs');var Redis=require(_0x7eda('0x5'));var db=require(_0x7eda('0x6'))['db'];var utils=require(_0x7eda('0x7'));var logger=require(_0x7eda('0x8'))(_0x7eda('0x9'));var config=require(_0x7eda('0xa'));var jayson=require(_0x7eda('0xb'));var client=jayson[_0x7eda('0xc')][_0x7eda('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x314602,_0x839e38,_0x163427){return new BPromise(function(_0x2bc200,_0x11576a){return client[_0x7eda('0xe')](_0x314602,_0x163427)['then'](function(_0x29bce2){logger['info']('Automation,\x20%s,\x20%s',_0x839e38,_0x7eda('0xf'));logger[_0x7eda('0x10')](_0x7eda('0x11'),_0x839e38,_0x7eda('0xf'),JSON['stringify'](_0x29bce2));if(_0x29bce2['error']){if(_0x29bce2[_0x7eda('0x12')][_0x7eda('0x13')]===0x1f4){logger[_0x7eda('0x12')](_0x7eda('0x14'),_0x839e38,_0x29bce2['error'][_0x7eda('0x15')]);return _0x11576a(_0x29bce2['error'][_0x7eda('0x15')]);}logger[_0x7eda('0x12')](_0x7eda('0x14'),_0x839e38,_0x29bce2[_0x7eda('0x12')][_0x7eda('0x15')]);return _0x2bc200(_0x29bce2[_0x7eda('0x12')][_0x7eda('0x15')]);}else{logger[_0x7eda('0x16')](_0x7eda('0x14'),_0x839e38,'request\x20sent');_0x2bc200(_0x29bce2['result'][_0x7eda('0x15')]);}})['catch'](function(_0x597ce9){logger[_0x7eda('0x12')](_0x7eda('0x14'),_0x839e38,_0x597ce9);_0x11576a(_0x597ce9);});});} \ No newline at end of file +var _0xcb9c=['request\x20sent','debug','Automation,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','then','info','Automation,\x20%s,\x20%s'];(function(_0xd2d81,_0x8ffa71){var _0x226112=function(_0x1f250a){while(--_0x1f250a){_0xd2d81['push'](_0xd2d81['shift']());}};_0x226112(++_0x8ffa71);}(_0xcb9c,0x110));var _0xccb9=function(_0x95da03,_0x1b5bd4){_0x95da03=_0x95da03-0x0;var _0x331f15=_0xcb9c[_0x95da03];return _0x331f15;};'use strict';var _=require(_0xccb9('0x0'));var util=require(_0xccb9('0x1'));var moment=require(_0xccb9('0x2'));var BPromise=require(_0xccb9('0x3'));var rs=require(_0xccb9('0x4'));var fs=require('fs');var Redis=require(_0xccb9('0x5'));var db=require(_0xccb9('0x6'))['db'];var utils=require(_0xccb9('0x7'));var logger=require('../../config/logger')(_0xccb9('0x8'));var config=require(_0xccb9('0x9'));var jayson=require(_0xccb9('0xa'));var client=jayson['client'][_0xccb9('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x114fa3,_0x1d807e,_0x54e899){return new BPromise(function(_0x3dfe21,_0x378d39){return client[_0xccb9('0xc')](_0x114fa3,_0x54e899)[_0xccb9('0xd')](function(_0x47889f){logger[_0xccb9('0xe')](_0xccb9('0xf'),_0x1d807e,_0xccb9('0x10'));logger[_0xccb9('0x11')](_0xccb9('0x12'),_0x1d807e,'request\x20sent',JSON[_0xccb9('0x13')](_0x47889f));if(_0x47889f[_0xccb9('0x14')]){if(_0x47889f[_0xccb9('0x14')]['code']===0x1f4){logger[_0xccb9('0x14')](_0xccb9('0xf'),_0x1d807e,_0x47889f[_0xccb9('0x14')][_0xccb9('0x15')]);return _0x378d39(_0x47889f['error'][_0xccb9('0x15')]);}logger[_0xccb9('0x14')](_0xccb9('0xf'),_0x1d807e,_0x47889f[_0xccb9('0x14')][_0xccb9('0x15')]);return _0x3dfe21(_0x47889f[_0xccb9('0x14')][_0xccb9('0x15')]);}else{logger[_0xccb9('0xe')](_0xccb9('0xf'),_0x1d807e,'request\x20sent');_0x3dfe21(_0x47889f[_0xccb9('0x16')][_0xccb9('0x15')]);}})[_0xccb9('0x17')](function(_0x561ca6){logger['error'](_0xccb9('0xf'),_0x1d807e,_0x561ca6);_0x378d39(_0x561ca6);});});} \ No newline at end of file diff --git a/server/api/automation/index.js b/server/api/automation/index.js index d43a235..c4546a3 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 _0xe186=['exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','show','/:id/conditions','getConditions','/:id/actions','getActions','post','create','addActions','put','/:id','update','delete','destroy'];(function(_0x3d4860,_0x283ab0){var _0x443fe0=function(_0x2af6da){while(--_0x2af6da){_0x3d4860['push'](_0x3d4860['shift']());}};_0x443fe0(++_0x283ab0);}(_0xe186,0x146));var _0x6e18=function(_0x28ddc8,_0x1fdee0){_0x28ddc8=_0x28ddc8-0x0;var _0x1c4d21=_0xe186[_0x28ddc8];return _0x1c4d21;};'use strict';var multer=require(_0x6e18('0x0'));var util=require(_0x6e18('0x1'));var path=require('path');var timeout=require(_0x6e18('0x2'));var express=require(_0x6e18('0x3'));var router=express[_0x6e18('0x4')]();var fs_extra=require(_0x6e18('0x5'));var auth=require(_0x6e18('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x6e18('0x7'));var controller=require('./automation.controller');router[_0x6e18('0x8')]('/',auth[_0x6e18('0x9')](),controller[_0x6e18('0xa')]);router['get']('/:id',auth[_0x6e18('0x9')](),controller[_0x6e18('0xb')]);router[_0x6e18('0x8')](_0x6e18('0xc'),auth[_0x6e18('0x9')](),controller[_0x6e18('0xd')]);router[_0x6e18('0x8')](_0x6e18('0xe'),auth['isAuthenticated'](),controller[_0x6e18('0xf')]);router[_0x6e18('0x10')]('/',auth[_0x6e18('0x9')](),controller[_0x6e18('0x11')]);router[_0x6e18('0x10')]('/:id/conditions',auth[_0x6e18('0x9')](),controller['addConditions']);router[_0x6e18('0x10')](_0x6e18('0xe'),auth[_0x6e18('0x9')](),controller[_0x6e18('0x12')]);router[_0x6e18('0x13')](_0x6e18('0x14'),auth['isAuthenticated'](),controller[_0x6e18('0x15')]);router[_0x6e18('0x16')](_0x6e18('0x14'),auth['isAuthenticated'](),controller[_0x6e18('0x17')]);module[_0x6e18('0x18')]=router; \ No newline at end of file +var _0x10d8=['create','post','/:id/conditions','addConditions','put','update','delete','destroy','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/:id','show','/:id/actions','getActions'];(function(_0x3ff085,_0x27c92e){var _0x2b68c3=function(_0x37811e){while(--_0x37811e){_0x3ff085['push'](_0x3ff085['shift']());}};_0x2b68c3(++_0x27c92e);}(_0x10d8,0xee));var _0x810d=function(_0x282bc0,_0x15ea2a){_0x282bc0=_0x282bc0-0x0;var _0x154fec=_0x10d8[_0x282bc0];return _0x154fec;};'use strict';var multer=require(_0x810d('0x0'));var util=require(_0x810d('0x1'));var path=require(_0x810d('0x2'));var timeout=require('connect-timeout');var express=require(_0x810d('0x3'));var router=express[_0x810d('0x4')]();var fs_extra=require(_0x810d('0x5'));var auth=require(_0x810d('0x6'));var interaction=require(_0x810d('0x7'));var config=require('../../config/environment');var controller=require('./automation.controller');router[_0x810d('0x8')]('/',auth[_0x810d('0x9')](),controller[_0x810d('0xa')]);router[_0x810d('0x8')](_0x810d('0xb'),auth[_0x810d('0x9')](),controller[_0x810d('0xc')]);router['get']('/:id/conditions',auth['isAuthenticated'](),controller['getConditions']);router[_0x810d('0x8')](_0x810d('0xd'),auth[_0x810d('0x9')](),controller[_0x810d('0xe')]);router['post']('/',auth[_0x810d('0x9')](),controller[_0x810d('0xf')]);router[_0x810d('0x10')](_0x810d('0x11'),auth['isAuthenticated'](),controller[_0x810d('0x12')]);router['post']('/:id/actions',auth[_0x810d('0x9')](),controller['addActions']);router[_0x810d('0x13')](_0x810d('0xb'),auth['isAuthenticated'](),controller[_0x810d('0x14')]);router[_0x810d('0x15')](_0x810d('0xb'),auth[_0x810d('0x9')](),controller[_0x810d('0x16')]);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 adf9fb7..918f49f 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 _0x7ee0=['Cut\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Machine\x20Retry\x20(min:1,\x20max:999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','exports','name','ENUM','ivr','STRING','BOOLEAN','Active/Disactive\x20Campaign','Max\x20200\x20calls.','INTEGER','UNSIGNED','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','#Congestion\x20Retry\x20(min:1,\x20max:999)','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\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','always','onlyIfOpen','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Maximum\x20Word\x20Length','DESC','ASC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)'];(function(_0x32f8de,_0x42f773){var _0x4abd26=function(_0x5064cc){while(--_0x5064cc){_0x32f8de['push'](_0x32f8de['shift']());}};_0x4abd26(++_0x42f773);}(_0x7ee0,0x123));var _0x07ee=function(_0x3533ab,_0x2d84a0){_0x3533ab=_0x3533ab-0x0;var _0x54fb06=_0x7ee0[_0x3533ab];return _0x54fb06;};'use strict';var Sequelize=require('sequelize');module[_0x07ee('0x0')]={'name':{'type':Sequelize['STRING'],'unique':_0x07ee('0x1'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize[_0x07ee('0x2')](_0x07ee('0x3')),'allowNull':![],'defaultValue':_0x07ee('0x3')},'description':{'type':Sequelize[_0x07ee('0x4')]},'active':{'type':Sequelize[_0x07ee('0x5')],'defaultValue':0x0,'comment':_0x07ee('0x6')},'limitCalls':{'type':Sequelize['INTEGER'](0x4)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0x07ee('0x7')},'dialOriginateCallerIdName':{'type':Sequelize[_0x07ee('0x4')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x07ee('0x4')]},'dialOriginateTimeout':{'type':Sequelize[_0x07ee('0x8')](0x3)[_0x07ee('0x9')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x07ee('0xa')},'dialCongestionMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x07ee('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x07ee('0xb')},'dialCongestionRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x07ee('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x07ee('0xc')},'dialBusyMaxRetry':{'type':Sequelize[_0x07ee('0x8')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x07ee('0xd')},'dialBusyRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x07ee('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x07ee('0xe')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x07ee('0x8')](0x3)[_0x07ee('0x9')],'defaultValue':0x3,'comment':'#NoAnswer\x20Retry\x20(min:1,\x20max:999)'},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x07ee('0x8')](0x5)[_0x07ee('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x07ee('0xf')},'dialGlobalMaxRetry':{'type':Sequelize[_0x07ee('0x8')](0x3)['UNSIGNED'],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':'#Global\x20Max\x20Retry\x20(min:1,\x20max:999)'},'dialTimezone':{'type':Sequelize[_0x07ee('0x4')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x07ee('0x4')],'defaultValue':'07:00-22:00,*,*,*'},'dialCheckDuplicateType':{'type':Sequelize[_0x07ee('0x2')](_0x07ee('0x10'),'never',_0x07ee('0x11')),'defaultValue':_0x07ee('0x10')},'dialAMDActive':{'type':Sequelize[_0x07ee('0x5')],'defaultValue':0x0,'comment':'Active/Disactive\x20AMD'},'dialAMDInitialSilence':{'type':Sequelize[_0x07ee('0x8')](0x9)[_0x07ee('0x9')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x07ee('0x12')},'dialAMDGreeting':{'type':Sequelize[_0x07ee('0x8')](0x9)[_0x07ee('0x9')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x07ee('0x13')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x07ee('0x8')](0x9)['UNSIGNED'],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x07ee('0x14')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x07ee('0x8')](0x9)[_0x07ee('0x9')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x07ee('0x15')},'dialAMDMinWordLength':{'type':Sequelize[_0x07ee('0x8')](0x9)['UNSIGNED'],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x07ee('0x16')},'dialAMDBetweenWordsSilence':{'type':Sequelize['INTEGER'](0x9)[_0x07ee('0x9')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x07ee('0x17')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x07ee('0x8')](0x9)[_0x07ee('0x9')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x07ee('0x18')},'dialAMDSilenceThreshold':{'type':Sequelize[_0x07ee('0x8')](0x5)[_0x07ee('0x9')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':'#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)'},'dialAMDMaximumWordLength':{'type':Sequelize['INTEGER'](0x9)[_0x07ee('0x9')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x07ee('0x19')},'dialOrderByScheduledAt':{'type':Sequelize[_0x07ee('0x2')](_0x07ee('0x1a'),_0x07ee('0x1b')),'defaultValue':_0x07ee('0x1a')},'dialPrefix':{'type':Sequelize[_0x07ee('0x4')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize['INTEGER'](0x3)[_0x07ee('0x9')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x07ee('0x1c')},'dialCutDigit':{'type':Sequelize[_0x07ee('0x8')](0x3)[_0x07ee('0x9')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x07ee('0x1d')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x07ee('0x8')](0x3)[_0x07ee('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x07ee('0x1e')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x07ee('0x1f')},'dialDropMaxRetry':{'type':Sequelize[_0x07ee('0x8')](0x3)[_0x07ee('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x07ee('0x20')},'dialDropRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x07ee('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x07ee('0x21')},'dialAbandonedMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x07ee('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x07ee('0x22')},'dialAbandonedRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x07ee('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x07ee('0x23')},'dialMachineMaxRetry':{'type':Sequelize[_0x07ee('0x8')](0x3)[_0x07ee('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x07ee('0x24')},'dialMachineRetryFrequency':{'type':Sequelize[_0x07ee('0x8')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x07ee('0x25')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x07ee('0x8')](0x3)[_0x07ee('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x07ee('0x26')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x07ee('0x8')](0x5)[_0x07ee('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x07ee('0x27')}}; \ No newline at end of file +var _0xab64=['#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','DESC','ASC','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Machine\x20Retry\x20(min:1,\x20max:999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','sequelize','exports','STRING','name','ivr','Active/Disactive\x20Campaign','INTEGER','Max\x20200\x20calls.','UNSIGNED','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','ENUM','never','onlyIfOpen','BOOLEAN','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xab64,0xa0));var _0x4ab6=function(_0x417e85,_0x1bdf19){_0x417e85=_0x417e85-0x0;var _0x8f3539=_0xab64[_0x417e85];return _0x8f3539;};'use strict';var Sequelize=require(_0x4ab6('0x0'));module[_0x4ab6('0x1')]={'name':{'type':Sequelize[_0x4ab6('0x2')],'unique':_0x4ab6('0x3'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize['ENUM'](_0x4ab6('0x4')),'allowNull':![],'defaultValue':'ivr'},'description':{'type':Sequelize[_0x4ab6('0x2')]},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0x4ab6('0x5')},'limitCalls':{'type':Sequelize[_0x4ab6('0x6')](0x4)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0x4ab6('0x7')},'dialOriginateCallerIdName':{'type':Sequelize[_0x4ab6('0x2')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x4ab6('0x2')]},'dialOriginateTimeout':{'type':Sequelize['INTEGER'](0x3)[_0x4ab6('0x8')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x4ab6('0x9')},'dialCongestionMaxRetry':{'type':Sequelize[_0x4ab6('0x6')](0x3)[_0x4ab6('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x4ab6('0xa')},'dialCongestionRetryFrequency':{'type':Sequelize[_0x4ab6('0x6')](0x5)[_0x4ab6('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x4ab6('0xb')},'dialBusyMaxRetry':{'type':Sequelize[_0x4ab6('0x6')](0x3)[_0x4ab6('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Busy\x20Retry\x20(min:1,\x20max:999)'},'dialBusyRetryFrequency':{'type':Sequelize[_0x4ab6('0x6')](0x5)[_0x4ab6('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialNoAnswerMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x4ab6('0x8')],'defaultValue':0x3,'comment':'#NoAnswer\x20Retry\x20(min:1,\x20max:999)'},'dialNoAnswerRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x4ab6('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x4ab6('0xc')},'dialGlobalMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x4ab6('0x8')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x4ab6('0xd')},'dialTimezone':{'type':Sequelize[_0x4ab6('0x2')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize['STRING'],'defaultValue':_0x4ab6('0xe')},'dialCheckDuplicateType':{'type':Sequelize[_0x4ab6('0xf')]('always',_0x4ab6('0x10'),_0x4ab6('0x11')),'defaultValue':'always'},'dialAMDActive':{'type':Sequelize[_0x4ab6('0x12')],'defaultValue':0x0,'comment':_0x4ab6('0x13')},'dialAMDInitialSilence':{'type':Sequelize['INTEGER'](0x9)[_0x4ab6('0x8')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x4ab6('0x14')},'dialAMDGreeting':{'type':Sequelize[_0x4ab6('0x6')](0x9)[_0x4ab6('0x8')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':'#AMD\x20Greeting'},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x4ab6('0x6')](0x9)[_0x4ab6('0x8')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x4ab6('0x15')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x4ab6('0x6')](0x9)[_0x4ab6('0x8')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Total\x20Analysis\x20Time'},'dialAMDMinWordLength':{'type':Sequelize[_0x4ab6('0x6')](0x9)[_0x4ab6('0x8')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x4ab6('0x16')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x4ab6('0x6')](0x9)['UNSIGNED'],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x4ab6('0x17')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x4ab6('0x6')](0x9)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x4ab6('0x18')},'dialAMDSilenceThreshold':{'type':Sequelize[_0x4ab6('0x6')](0x5)[_0x4ab6('0x8')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x4ab6('0x19')},'dialAMDMaximumWordLength':{'type':Sequelize[_0x4ab6('0x6')](0x9)[_0x4ab6('0x8')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x4ab6('0x1a')},'dialOrderByScheduledAt':{'type':Sequelize['ENUM'](_0x4ab6('0x1b'),_0x4ab6('0x1c')),'defaultValue':'DESC'},'dialPrefix':{'type':Sequelize[_0x4ab6('0x2')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x4ab6('0x6')](0x3)[_0x4ab6('0x8')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Random\x20Last\x20Digit\x20(min:1,\x20max:15)'},'dialCutDigit':{'type':Sequelize[_0x4ab6('0x6')](0x3)[_0x4ab6('0x8')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Cut\x20Digit\x20(min:1,\x20max:15)'},'dialNoSuchNumberMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x4ab6('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x4ab6('0x1d')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x4ab6('0x6')](0x5)[_0x4ab6('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x4ab6('0x1e')},'dialDropMaxRetry':{'type':Sequelize[_0x4ab6('0x6')](0x3)[_0x4ab6('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x4ab6('0x1f')},'dialDropRetryFrequency':{'type':Sequelize[_0x4ab6('0x6')](0x5)[_0x4ab6('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAbandonedMaxRetry':{'type':Sequelize[_0x4ab6('0x6')](0x3)[_0x4ab6('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x4ab6('0x20')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x4ab6('0x6')](0x5)[_0x4ab6('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x4ab6('0x21')},'dialMachineMaxRetry':{'type':Sequelize[_0x4ab6('0x6')](0x3)[_0x4ab6('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x4ab6('0x22')},'dialMachineRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x4ab6('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x4ab6('0x23')},'dialAgentRejectMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x4ab6('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#AgentReject\x20Retry\x20(min:1,\x20max:999)'},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x4ab6('0x6')](0x5)[_0x4ab6('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x4ab6('0x24')}}; \ No newline at end of file diff --git a/server/api/campaign/campaign.controller.js b/server/api/campaign/campaign.controller.js index e05475c..43bbb5d 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 _0x2ed4=['keys','length','include','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','clone','omit','createdAt','updatedAt','getHoppers','findOne','CmHopper','rawAttributes','hasOwnProperty','CampaignId','findAll','getHopperHistories','CmHopperHistory','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','CmList','addLists','format','ids','dialCheckDuplicateType','always','insert','phone','scheduledAt','ContactId','ListId','select','field','CmListId','toString','from','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','phone\x20NOT\x20IN\x20(?)','COALESCE(phone,\x27\x27)','cm_hopper','CampaignId\x20=\x20?','onlyIfOpen','into','NOW()','phone\x20IS\x20NOT\x20NULL','cm_contacts','fromQuery','cmHopperId','OrderBy','h.id','ci.OrderBY','cm_contact_has_items','join','h.ContactId\x20=\x20ci.CmContactId','h.ListId\x20=\x20?','h.CampaignId=?','sequelize','push','all','removeLists','getBlackLists','YYYY-MM-DD\x20HH:mm:ss','addBlackLists','spread','removeBlackLists','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','ejs','lodash','jsforce','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','../../mysqldb','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','IvrCampaigns','destroy','end','sendStatus','error','stack','name','send','index','Campaign','fieldName','type','key','map','query','filters','intersection','model','fields','attributes','nolimit','order','sort','where','pick','filter','merge','options','includeAll','rows','catch','show','params'];(function(_0x237d67,_0x4ff2db){var _0x292dfb=function(_0x565a7d){while(--_0x565a7d){_0x237d67['push'](_0x237d67['shift']());}};_0x292dfb(++_0x4ff2db);}(_0x2ed4,0xe6));var _0x42ed=function(_0x2984d0,_0x1a7211){_0x2984d0=_0x2984d0-0x0;var _0x2885f2=_0x2ed4[_0x2984d0];return _0x2885f2;};'use strict';var emlformat=require(_0x42ed('0x0'));var rimraf=require(_0x42ed('0x1'));var zipdir=require(_0x42ed('0x2'));var jsonpatch=require(_0x42ed('0x3'));var rp=require(_0x42ed('0x4'));var moment=require(_0x42ed('0x5'));var BPromise=require(_0x42ed('0x6'));var Mustache=require('mustache');var util=require(_0x42ed('0x7'));var path=require(_0x42ed('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x42ed('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x42ed('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x42ed('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x42ed('0xc'));var querystring=require(_0x42ed('0xd'));var Papa=require(_0x42ed('0xe'));var Redis=require(_0x42ed('0xf'));var authService=require(_0x42ed('0x10'));var qs=require(_0x42ed('0x11'));var as=require(_0x42ed('0x12'));var hardwareService=require(_0x42ed('0x13'));var logger=require('../../config/logger')(_0x42ed('0x14'));var utils=require(_0x42ed('0x15'));var config=require(_0x42ed('0x16'));var licenseUtil=require(_0x42ed('0x17'));var db=require(_0x42ed('0x18'))['db'];function respondWithStatusCode(_0x1e1050,_0xc06898){_0xc06898=_0xc06898||0xcc;return function(_0x52e652){if(_0x52e652){return _0x1e1050['sendStatus'](_0xc06898);}return _0x1e1050[_0x42ed('0x19')](_0xc06898)['end']();};}function respondWithResult(_0x49b245,_0x3a65d5){_0x3a65d5=_0x3a65d5||0xc8;return function(_0x1019b0){if(_0x1019b0){return _0x49b245[_0x42ed('0x19')](_0x3a65d5)[_0x42ed('0x1a')](_0x1019b0);}};}function respondWithFilteredResult(_0x22cb6d,_0x11ccda){return function(_0x3adc7d){if(_0x3adc7d){var _0x12e40c=typeof _0x11ccda[_0x42ed('0x1b')]===_0x42ed('0x1c')&&typeof _0x11ccda[_0x42ed('0x1d')]===_0x42ed('0x1c');var _0x444bc2=_0x3adc7d[_0x42ed('0x1e')];var _0x436827=_0x12e40c?0x0:_0x11ccda[_0x42ed('0x1b')];var _0x465782=_0x12e40c?_0x3adc7d[_0x42ed('0x1e')]:_0x11ccda[_0x42ed('0x1b')]+_0x11ccda[_0x42ed('0x1d')];var _0x33336a;if(_0x465782>=_0x444bc2){_0x465782=_0x444bc2;_0x33336a=0xc8;}else{_0x33336a=0xce;}_0x22cb6d['status'](_0x33336a);return _0x22cb6d[_0x42ed('0x1f')](_0x42ed('0x20'),_0x436827+'-'+_0x465782+'/'+_0x444bc2)[_0x42ed('0x1a')](_0x3adc7d);}return null;};}function patchUpdates(_0x3ddd86){return function(_0x506193){try{jsonpatch[_0x42ed('0x21')](_0x506193,_0x3ddd86,!![]);}catch(_0x14d458){return BPromise['reject'](_0x14d458);}return _0x506193[_0x42ed('0x22')]();};}function saveUpdates(_0x4ab52b,_0x23c9f0){return function(_0x2f3268){if(_0x2f3268){return _0x2f3268[_0x42ed('0x23')](_0x4ab52b)[_0x42ed('0x24')](function(_0x444e9a){return _0x444e9a;});}return null;};}function removeEntity(_0xf0fc43,_0x501ddf){return function(_0x39a9d1){if(_0x39a9d1){return _0x39a9d1['destroy']()[_0x42ed('0x24')](function(){var _0x27ba89=_0x39a9d1['get']({'plain':!![]});var _0x2b9e30=_0x42ed('0x25');return db['UserProfileResource'][_0x42ed('0x26')]({'where':{'type':_0x2b9e30,'resourceId':_0x27ba89['id']}})['then'](function(){return _0x39a9d1;});})[_0x42ed('0x24')](function(){_0xf0fc43[_0x42ed('0x19')](0xcc)[_0x42ed('0x27')]();});}};}function handleEntityNotFound(_0x19b973,_0x10c99c){return function(_0x37b112){if(!_0x37b112){_0x19b973[_0x42ed('0x28')](0x194);}return _0x37b112;};}function handleError(_0x508a5c,_0x49fbb6){_0x49fbb6=_0x49fbb6||0x1f4;return function(_0x1b66ce){logger[_0x42ed('0x29')](_0x1b66ce[_0x42ed('0x2a')]);if(_0x1b66ce[_0x42ed('0x2b')]){delete _0x1b66ce[_0x42ed('0x2b')];}_0x508a5c['status'](_0x49fbb6)[_0x42ed('0x2c')](_0x1b66ce);};}exports[_0x42ed('0x2d')]=function(_0x1b00c0,_0x4ff735){var _0x4ed71a={},_0x2cef45={},_0x1baaee={'count':0x0,'rows':[]};var _0x2e59ac=_['map'](db[_0x42ed('0x2e')]['rawAttributes'],function(_0x2c6c23){return{'name':_0x2c6c23[_0x42ed('0x2f')],'type':_0x2c6c23[_0x42ed('0x30')][_0x42ed('0x31')]};});_0x2cef45['model']=_[_0x42ed('0x32')](_0x2e59ac,_0x42ed('0x2b'));_0x2cef45[_0x42ed('0x33')]=_['keys'](_0x1b00c0[_0x42ed('0x33')]);_0x2cef45[_0x42ed('0x34')]=_[_0x42ed('0x35')](_0x2cef45['model'],_0x2cef45[_0x42ed('0x33')]);_0x4ed71a['attributes']=_['intersection'](_0x2cef45[_0x42ed('0x36')],qs[_0x42ed('0x37')](_0x1b00c0['query']['fields']));_0x4ed71a['attributes']=_0x4ed71a[_0x42ed('0x38')]['length']?_0x4ed71a[_0x42ed('0x38')]:_0x2cef45[_0x42ed('0x36')];if(!_0x1b00c0[_0x42ed('0x33')]['hasOwnProperty'](_0x42ed('0x39'))){_0x4ed71a['limit']=qs[_0x42ed('0x1d')](_0x1b00c0['query']['limit']);_0x4ed71a[_0x42ed('0x1b')]=qs[_0x42ed('0x1b')](_0x1b00c0[_0x42ed('0x33')][_0x42ed('0x1b')]);}_0x4ed71a[_0x42ed('0x3a')]=qs[_0x42ed('0x3b')](_0x1b00c0[_0x42ed('0x33')][_0x42ed('0x3b')]);_0x4ed71a[_0x42ed('0x3c')]=qs[_0x42ed('0x34')](_[_0x42ed('0x3d')](_0x1b00c0['query'],_0x2cef45[_0x42ed('0x34')]),_0x2e59ac);if(_0x1b00c0[_0x42ed('0x33')][_0x42ed('0x3e')]){_0x4ed71a[_0x42ed('0x3c')]=_['merge'](_0x4ed71a[_0x42ed('0x3c')],{'$or':_['map'](_0x2e59ac,function(_0x5b4a15){if(_0x5b4a15[_0x42ed('0x30')]!=='VIRTUAL'){var _0x1037ab={};_0x1037ab[_0x5b4a15[_0x42ed('0x2b')]]={'$like':'%'+_0x1b00c0['query']['filter']+'%'};return _0x1037ab;}})});}_0x4ed71a=_[_0x42ed('0x3f')]({},_0x4ed71a,_0x1b00c0[_0x42ed('0x40')]);var _0x3e4cc5={'where':_0x4ed71a[_0x42ed('0x3c')]};return db['Campaign']['count'](_0x3e4cc5)['then'](function(_0x54d69f){_0x1baaee['count']=_0x54d69f;if(_0x1b00c0[_0x42ed('0x33')][_0x42ed('0x41')]){_0x4ed71a['include']=[{'all':!![]}];}return db[_0x42ed('0x2e')]['findAll'](_0x4ed71a);})[_0x42ed('0x24')](function(_0x2c5d69){_0x1baaee[_0x42ed('0x42')]=_0x2c5d69;return _0x1baaee;})['then'](respondWithFilteredResult(_0x4ff735,_0x4ed71a))[_0x42ed('0x43')](handleError(_0x4ff735,null));};exports[_0x42ed('0x44')]=function(_0x5afa1c,_0x201ff0){var _0x320658={'raw':![],'where':{'id':_0x5afa1c[_0x42ed('0x45')]['id']}},_0x4357d4={};_0x4357d4[_0x42ed('0x36')]=_[_0x42ed('0x46')](db[_0x42ed('0x2e')]['rawAttributes']);_0x4357d4[_0x42ed('0x33')]=_[_0x42ed('0x46')](_0x5afa1c[_0x42ed('0x33')]);_0x4357d4['filters']=_['intersection'](_0x4357d4[_0x42ed('0x36')],_0x4357d4[_0x42ed('0x33')]);_0x320658[_0x42ed('0x38')]=_[_0x42ed('0x35')](_0x4357d4[_0x42ed('0x36')],qs[_0x42ed('0x37')](_0x5afa1c[_0x42ed('0x33')][_0x42ed('0x37')]));_0x320658['attributes']=_0x320658['attributes'][_0x42ed('0x47')]?_0x320658[_0x42ed('0x38')]:_0x4357d4[_0x42ed('0x36')];if(_0x5afa1c[_0x42ed('0x33')][_0x42ed('0x41')]){_0x320658[_0x42ed('0x48')]=[{'all':!![]}];}_0x320658=_[_0x42ed('0x3f')]({},_0x320658,_0x5afa1c[_0x42ed('0x40')]);return db[_0x42ed('0x2e')][_0x42ed('0x49')](_0x320658)['then'](handleEntityNotFound(_0x201ff0,null))['then'](respondWithResult(_0x201ff0,null))[_0x42ed('0x43')](handleError(_0x201ff0,null));};exports[_0x42ed('0x4a')]=function(_0x2a54aa,_0x3dcad9){return db['Campaign'][_0x42ed('0x4a')](_0x2a54aa[_0x42ed('0x4b')],{})[_0x42ed('0x24')](function(_0x172836){var _0x3a690f=_0x2a54aa[_0x42ed('0x4c')][_0x42ed('0x4d')]({'plain':!![]});if(!_0x3a690f)throw new Error(_0x42ed('0x4e'));if(_0x3a690f[_0x42ed('0x4f')]===_0x42ed('0x4c')){var _0x543b68=_0x172836[_0x42ed('0x4d')]({'plain':!![]});var _0x15bef4=_0x42ed('0x25');return db[_0x42ed('0x50')][_0x42ed('0x49')]({'where':{'name':_0x15bef4,'userProfileId':_0x3a690f[_0x42ed('0x51')]},'raw':!![]})[_0x42ed('0x24')](function(_0x182d7d){if(_0x182d7d&&_0x182d7d[_0x42ed('0x52')]===0x0){return db[_0x42ed('0x53')][_0x42ed('0x4a')]({'name':_0x543b68[_0x42ed('0x2b')],'resourceId':_0x543b68['id'],'type':_0x182d7d[_0x42ed('0x2b')],'sectionId':_0x182d7d['id']},{})['then'](function(){return _0x172836;});}else{return _0x172836;}})['catch'](function(_0x5b71d9){logger['error'](_0x42ed('0x54'),_0x5b71d9);throw _0x5b71d9;});}return _0x172836;})[_0x42ed('0x24')](respondWithResult(_0x3dcad9,0xc9))[_0x42ed('0x43')](handleError(_0x3dcad9,null));};exports[_0x42ed('0x55')]=function(_0x169c59,_0x926be9){var _0x2e3966={'where':{'id':_0x169c59[_0x42ed('0x45')]['id']}},_0x36596a={};_0x36596a[_0x42ed('0x36')]=_[_0x42ed('0x46')](db[_0x42ed('0x2e')]['rawAttributes']);_0x2e3966[_0x42ed('0x38')]=_['intersection'](_0x36596a[_0x42ed('0x36')],qs[_0x42ed('0x37')](_0x169c59['query']['fields']));_0x2e3966[_0x42ed('0x38')]=_0x2e3966['attributes']['length']?_0x2e3966['attributes']:_0x36596a[_0x42ed('0x36')];if(_0x169c59[_0x42ed('0x33')]['includeAll']){_0x2e3966[_0x42ed('0x48')]=[{'all':!![]}];}_0x2e3966=_[_0x42ed('0x3f')]({},_0x2e3966,_0x169c59[_0x42ed('0x40')]);return db[_0x42ed('0x2e')][_0x42ed('0x49')](_0x2e3966)[_0x42ed('0x24')](handleEntityNotFound(_0x926be9,null))[_0x42ed('0x24')](function(_0x2ecb39){if(_0x2ecb39){var _0xeda830=_0x2ecb39[_0x42ed('0x4d')]({'plain':!![]});_0xeda830=qs[_0x42ed('0x56')](_0xeda830,['id',_0x42ed('0x57'),_0x42ed('0x58')]);_0x169c59[_0x42ed('0x4b')]=_[_0x42ed('0x56')](_0x169c59['body'],['id',_0x42ed('0x57'),_0x42ed('0x58')]);return db[_0x42ed('0x2e')][_0x42ed('0x4a')](_[_0x42ed('0x3f')](_0xeda830,_0x169c59[_0x42ed('0x4b')]),{'include':_0x169c59[_0x42ed('0x33')]['includeAll']?[{'all':!![]}]:undefined})['then'](function(_0x34b84e){var _0x1c1df0=_0x169c59[_0x42ed('0x4c')]['get']({'plain':!![]});if(!_0x1c1df0)throw new Error(_0x42ed('0x4e'));if(_0x1c1df0['role']===_0x42ed('0x4c')){var _0x107735=_0x34b84e[_0x42ed('0x4d')]({'plain':!![]});var _0x306358=_0x42ed('0x25');return db['UserProfileSection'][_0x42ed('0x49')]({'where':{'name':_0x306358,'userProfileId':_0x1c1df0[_0x42ed('0x51')]},'raw':!![]})[_0x42ed('0x24')](function(_0x5d29cb){if(_0x5d29cb&&_0x5d29cb[_0x42ed('0x52')]===0x0){return db[_0x42ed('0x53')]['create']({'name':_0x107735[_0x42ed('0x2b')],'resourceId':_0x107735['id'],'type':_0x5d29cb[_0x42ed('0x2b')],'sectionId':_0x5d29cb['id']},{})[_0x42ed('0x24')](function(){return _0x34b84e;});}else{return _0x34b84e;}})['catch'](function(_0x3abacb){logger[_0x42ed('0x29')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3abacb);throw _0x3abacb;});}return _0x34b84e;});}})[_0x42ed('0x24')](respondWithResult(_0x926be9,0xc9))[_0x42ed('0x43')](handleError(_0x926be9,null));};exports['update']=function(_0x2373cd,_0x2dbd7a){if(_0x2373cd['body']['id']){delete _0x2373cd['body']['id'];}return db[_0x42ed('0x2e')][_0x42ed('0x49')]({'where':{'id':_0x2373cd[_0x42ed('0x45')]['id']}})[_0x42ed('0x24')](handleEntityNotFound(_0x2dbd7a,null))[_0x42ed('0x24')](saveUpdates(_0x2373cd[_0x42ed('0x4b')],null))[_0x42ed('0x24')](respondWithResult(_0x2dbd7a,null))[_0x42ed('0x43')](handleError(_0x2dbd7a,null));};exports[_0x42ed('0x26')]=function(_0x3fe0c8,_0x4de0e5){return db[_0x42ed('0x2e')][_0x42ed('0x49')]({'where':{'id':_0x3fe0c8[_0x42ed('0x45')]['id']}})[_0x42ed('0x24')](handleEntityNotFound(_0x4de0e5,null))[_0x42ed('0x24')](removeEntity(_0x4de0e5,null))[_0x42ed('0x43')](handleError(_0x4de0e5,null));};exports[_0x42ed('0x59')]=function(_0x3c5edd,_0x29ccc5,_0x35b18d){var _0xd973f={'raw':!![],'where':{}};var _0x239738={};var _0x32d2fa={'count':0x0,'rows':[]};return db['Campaign'][_0x42ed('0x5a')]({'where':{'id':_0x3c5edd[_0x42ed('0x45')]['id']}})[_0x42ed('0x24')](handleEntityNotFound(_0x29ccc5,null))[_0x42ed('0x24')](function(_0xae3326){if(_0xae3326){_0x239738[_0x42ed('0x36')]=_[_0x42ed('0x46')](db[_0x42ed('0x5b')][_0x42ed('0x5c')]);_0x239738[_0x42ed('0x33')]=_['keys'](_0x3c5edd[_0x42ed('0x33')]);_0x239738[_0x42ed('0x34')]=_[_0x42ed('0x35')](_0x239738['model'],_0x239738['query']);_0xd973f['attributes']=_[_0x42ed('0x35')](_0x239738['model'],qs[_0x42ed('0x37')](_0x3c5edd[_0x42ed('0x33')][_0x42ed('0x37')]));_0xd973f['attributes']=_0xd973f[_0x42ed('0x38')][_0x42ed('0x47')]?_0xd973f[_0x42ed('0x38')]:_0x239738[_0x42ed('0x36')];if(!_0x3c5edd[_0x42ed('0x33')][_0x42ed('0x5d')](_0x42ed('0x39'))){_0xd973f[_0x42ed('0x1d')]=qs[_0x42ed('0x1d')](_0x3c5edd[_0x42ed('0x33')]['limit']);_0xd973f[_0x42ed('0x1b')]=qs[_0x42ed('0x1b')](_0x3c5edd[_0x42ed('0x33')][_0x42ed('0x1b')]);}_0xd973f['order']=qs[_0x42ed('0x3b')](_0x3c5edd['query'][_0x42ed('0x3b')]);_0xd973f[_0x42ed('0x3c')]=qs['filters'](_[_0x42ed('0x3d')](_0x3c5edd[_0x42ed('0x33')],_0x239738['filters']));_0xd973f['where'][_0x42ed('0x5e')]=_0xae3326['id'];if(_0x3c5edd[_0x42ed('0x33')][_0x42ed('0x3e')]){_0xd973f['where']=_['merge'](_0xd973f['where'],{'$or':_['map'](_0xd973f['attributes'],function(_0x32e578){var _0x4a8fd1={};_0x4a8fd1[_0x32e578]={'$like':'%'+_0x3c5edd[_0x42ed('0x33')]['filter']+'%'};return _0x4a8fd1;})});}_0xd973f=_[_0x42ed('0x3f')]({},_0xd973f,_0x3c5edd[_0x42ed('0x40')]);return db[_0x42ed('0x5b')]['count']({'where':_0xd973f[_0x42ed('0x3c')]})['then'](function(_0x567dff){_0x32d2fa[_0x42ed('0x1e')]=_0x567dff;if(_0x3c5edd[_0x42ed('0x33')]['includeAll']){_0xd973f['include']=[{'all':!![]}];}return db['CmHopper'][_0x42ed('0x5f')](_0xd973f);})['then'](function(_0x5d244a){_0x32d2fa[_0x42ed('0x42')]=_0x5d244a;return _0x32d2fa;});}})[_0x42ed('0x24')](respondWithFilteredResult(_0x29ccc5,_0xd973f))[_0x42ed('0x43')](handleError(_0x29ccc5,null));};exports[_0x42ed('0x60')]=function(_0x25ddfe,_0x54d1bf,_0x5df1e0){var _0x57636e={'raw':!![],'where':{}};var _0x525cec={};var _0x3c592e={'count':0x0,'rows':[]};return db[_0x42ed('0x2e')][_0x42ed('0x5a')]({'where':{'id':_0x25ddfe[_0x42ed('0x45')]['id']}})[_0x42ed('0x24')](handleEntityNotFound(_0x54d1bf,null))[_0x42ed('0x24')](function(_0x4fbc05){if(_0x4fbc05){_0x525cec[_0x42ed('0x36')]=_['keys'](db[_0x42ed('0x61')][_0x42ed('0x5c')]);_0x525cec['query']=_[_0x42ed('0x46')](_0x25ddfe[_0x42ed('0x33')]);_0x525cec[_0x42ed('0x34')]=_['intersection'](_0x525cec[_0x42ed('0x36')],_0x525cec[_0x42ed('0x33')]);_0x57636e[_0x42ed('0x38')]=_[_0x42ed('0x35')](_0x525cec[_0x42ed('0x36')],qs[_0x42ed('0x37')](_0x25ddfe[_0x42ed('0x33')]['fields']));_0x57636e[_0x42ed('0x38')]=_0x57636e['attributes']['length']?_0x57636e[_0x42ed('0x38')]:_0x525cec[_0x42ed('0x36')];if(!_0x25ddfe[_0x42ed('0x33')][_0x42ed('0x5d')](_0x42ed('0x39'))){_0x57636e['limit']=qs[_0x42ed('0x1d')](_0x25ddfe[_0x42ed('0x33')][_0x42ed('0x1d')]);_0x57636e[_0x42ed('0x1b')]=qs[_0x42ed('0x1b')](_0x25ddfe[_0x42ed('0x33')][_0x42ed('0x1b')]);}_0x57636e[_0x42ed('0x3a')]=qs['sort'](_0x25ddfe[_0x42ed('0x33')]['sort']);_0x57636e['where']=qs['filters'](_[_0x42ed('0x3d')](_0x25ddfe[_0x42ed('0x33')],_0x525cec[_0x42ed('0x34')]));_0x57636e[_0x42ed('0x3c')][_0x42ed('0x5e')]=_0x4fbc05['id'];if(_0x25ddfe['query'][_0x42ed('0x3e')]){_0x57636e[_0x42ed('0x3c')]=_['merge'](_0x57636e[_0x42ed('0x3c')],{'$or':_[_0x42ed('0x32')](_0x57636e[_0x42ed('0x38')],function(_0x1cf6d2){var _0xb2dd79={};_0xb2dd79[_0x1cf6d2]={'$like':'%'+_0x25ddfe[_0x42ed('0x33')][_0x42ed('0x3e')]+'%'};return _0xb2dd79;})});}_0x57636e=_[_0x42ed('0x3f')]({},_0x57636e,_0x25ddfe[_0x42ed('0x40')]);return db['CmHopperHistory'][_0x42ed('0x1e')]({'where':_0x57636e[_0x42ed('0x3c')]})[_0x42ed('0x24')](function(_0x24ed38){_0x3c592e[_0x42ed('0x1e')]=_0x24ed38;if(_0x25ddfe[_0x42ed('0x33')][_0x42ed('0x41')]){_0x57636e[_0x42ed('0x48')]=[{'all':!![]}];}return db[_0x42ed('0x61')]['findAll'](_0x57636e);})[_0x42ed('0x24')](function(_0x2d9c05){_0x3c592e['rows']=_0x2d9c05;return _0x3c592e;});}})[_0x42ed('0x24')](respondWithFilteredResult(_0x54d1bf,_0x57636e))[_0x42ed('0x43')](handleError(_0x54d1bf,null));};exports[_0x42ed('0x62')]=function(_0x2e2e43,_0xf9c9ac,_0x536a6a){var _0x1cee27={'raw':!![],'where':{}};var _0x57e4dc={};var _0x2d2301={'count':0x0,'rows':[]};return db[_0x42ed('0x2e')]['findOne']({'where':{'id':_0x2e2e43['params']['id']}})['then'](handleEntityNotFound(_0xf9c9ac,null))[_0x42ed('0x24')](function(_0x21fdb9){if(_0x21fdb9){_0x57e4dc[_0x42ed('0x36')]=_['keys'](db['CmHopperFinal']['rawAttributes']);_0x57e4dc[_0x42ed('0x33')]=_[_0x42ed('0x46')](_0x2e2e43[_0x42ed('0x33')]);_0x57e4dc[_0x42ed('0x34')]=_[_0x42ed('0x35')](_0x57e4dc[_0x42ed('0x36')],_0x57e4dc[_0x42ed('0x33')]);_0x1cee27['attributes']=_['intersection'](_0x57e4dc[_0x42ed('0x36')],qs[_0x42ed('0x37')](_0x2e2e43[_0x42ed('0x33')][_0x42ed('0x37')]));_0x1cee27['attributes']=_0x1cee27['attributes'][_0x42ed('0x47')]?_0x1cee27['attributes']:_0x57e4dc[_0x42ed('0x36')];if(!_0x2e2e43[_0x42ed('0x33')]['hasOwnProperty'](_0x42ed('0x39'))){_0x1cee27['limit']=qs['limit'](_0x2e2e43[_0x42ed('0x33')][_0x42ed('0x1d')]);_0x1cee27[_0x42ed('0x1b')]=qs[_0x42ed('0x1b')](_0x2e2e43['query'][_0x42ed('0x1b')]);}_0x1cee27[_0x42ed('0x3a')]=qs[_0x42ed('0x3b')](_0x2e2e43[_0x42ed('0x33')][_0x42ed('0x3b')]);_0x1cee27[_0x42ed('0x3c')]=qs[_0x42ed('0x34')](_[_0x42ed('0x3d')](_0x2e2e43[_0x42ed('0x33')],_0x57e4dc[_0x42ed('0x34')]));_0x1cee27[_0x42ed('0x3c')][_0x42ed('0x5e')]=_0x21fdb9['id'];if(_0x2e2e43[_0x42ed('0x33')][_0x42ed('0x3e')]){_0x1cee27['where']=_['merge'](_0x1cee27[_0x42ed('0x3c')],{'$or':_['map'](_0x1cee27['attributes'],function(_0x10c1ed){var _0x13c5af={};_0x13c5af[_0x10c1ed]={'$like':'%'+_0x2e2e43[_0x42ed('0x33')][_0x42ed('0x3e')]+'%'};return _0x13c5af;})});}_0x1cee27=_[_0x42ed('0x3f')]({},_0x1cee27,_0x2e2e43['options']);return db[_0x42ed('0x63')][_0x42ed('0x1e')]({'where':_0x1cee27[_0x42ed('0x3c')]})['then'](function(_0x3b376b){_0x2d2301[_0x42ed('0x1e')]=_0x3b376b;if(_0x2e2e43[_0x42ed('0x33')][_0x42ed('0x41')]){_0x1cee27[_0x42ed('0x48')]=[{'all':!![]}];}return db[_0x42ed('0x63')][_0x42ed('0x5f')](_0x1cee27);})[_0x42ed('0x24')](function(_0x30c29e){_0x2d2301[_0x42ed('0x42')]=_0x30c29e;return _0x2d2301;});}})['then'](respondWithFilteredResult(_0xf9c9ac,_0x1cee27))[_0x42ed('0x43')](handleError(_0xf9c9ac,null));};exports[_0x42ed('0x64')]=function(_0x1d372f,_0xf29020,_0x2c8343){var _0x596c04={'raw':!![],'where':{}};var _0x747ce5={};var _0x542ff8={'count':0x0,'rows':[]};return db[_0x42ed('0x2e')]['findOne']({'where':{'id':_0x1d372f[_0x42ed('0x45')]['id']}})[_0x42ed('0x24')](handleEntityNotFound(_0xf29020,null))[_0x42ed('0x24')](function(_0x478a89){if(_0x478a89){_0x747ce5['model']=_[_0x42ed('0x46')](db[_0x42ed('0x65')][_0x42ed('0x5c')]);_0x747ce5[_0x42ed('0x33')]=_['keys'](_0x1d372f[_0x42ed('0x33')]);_0x747ce5[_0x42ed('0x34')]=_[_0x42ed('0x35')](_0x747ce5[_0x42ed('0x36')],_0x747ce5[_0x42ed('0x33')]);_0x596c04[_0x42ed('0x38')]=_[_0x42ed('0x35')](_0x747ce5[_0x42ed('0x36')],qs[_0x42ed('0x37')](_0x1d372f[_0x42ed('0x33')][_0x42ed('0x37')]));_0x596c04[_0x42ed('0x38')]=_0x596c04[_0x42ed('0x38')][_0x42ed('0x47')]?_0x596c04[_0x42ed('0x38')]:_0x747ce5[_0x42ed('0x36')];if(!_0x1d372f[_0x42ed('0x33')][_0x42ed('0x5d')](_0x42ed('0x39'))){_0x596c04[_0x42ed('0x1d')]=qs[_0x42ed('0x1d')](_0x1d372f[_0x42ed('0x33')]['limit']);_0x596c04[_0x42ed('0x1b')]=qs['offset'](_0x1d372f['query']['offset']);}_0x596c04[_0x42ed('0x3a')]=qs[_0x42ed('0x3b')](_0x1d372f[_0x42ed('0x33')]['sort']);_0x596c04[_0x42ed('0x3c')]=qs[_0x42ed('0x34')](_[_0x42ed('0x3d')](_0x1d372f['query'],_0x747ce5[_0x42ed('0x34')]));_0x596c04[_0x42ed('0x3c')][_0x42ed('0x5e')]=_0x478a89['id'];if(_0x1d372f[_0x42ed('0x33')][_0x42ed('0x3e')]){_0x596c04['where']=_['merge'](_0x596c04[_0x42ed('0x3c')],{'$or':_['map'](_0x596c04[_0x42ed('0x38')],function(_0xb299cf){var _0x126bbb={};_0x126bbb[_0xb299cf]={'$like':'%'+_0x1d372f[_0x42ed('0x33')][_0x42ed('0x3e')]+'%'};return _0x126bbb;})});}_0x596c04=_[_0x42ed('0x3f')]({},_0x596c04,_0x1d372f[_0x42ed('0x40')]);return db[_0x42ed('0x65')][_0x42ed('0x1e')]({'where':_0x596c04[_0x42ed('0x3c')]})[_0x42ed('0x24')](function(_0x3faadd){_0x542ff8[_0x42ed('0x1e')]=_0x3faadd;if(_0x1d372f[_0x42ed('0x33')][_0x42ed('0x41')]){_0x596c04[_0x42ed('0x48')]=[{'all':!![]}];}return db[_0x42ed('0x65')][_0x42ed('0x5f')](_0x596c04);})[_0x42ed('0x24')](function(_0x2c4617){_0x542ff8[_0x42ed('0x42')]=_0x2c4617;return _0x542ff8;});}})[_0x42ed('0x24')](respondWithFilteredResult(_0xf29020,_0x596c04))[_0x42ed('0x43')](handleError(_0xf29020,null));};exports['getLists']=function(_0x5d48fa,_0x1955c6,_0x2f9c14){var _0x440016={};var _0x4bacba={};var _0x15650d;var _0x3793a1;return db[_0x42ed('0x2e')][_0x42ed('0x5a')]({'where':{'id':_0x5d48fa[_0x42ed('0x45')]['id']}})['then'](handleEntityNotFound(_0x1955c6,null))[_0x42ed('0x24')](function(_0x556bd6){if(_0x556bd6){_0x15650d=_0x556bd6;_0x4bacba['model']=_[_0x42ed('0x46')](db[_0x42ed('0x66')][_0x42ed('0x5c')]);_0x4bacba['query']=_[_0x42ed('0x46')](_0x5d48fa[_0x42ed('0x33')]);_0x4bacba[_0x42ed('0x34')]=_[_0x42ed('0x35')](_0x4bacba['model'],_0x4bacba[_0x42ed('0x33')]);_0x440016[_0x42ed('0x38')]=_[_0x42ed('0x35')](_0x4bacba[_0x42ed('0x36')],qs['fields'](_0x5d48fa[_0x42ed('0x33')]['fields']));_0x440016['attributes']=_0x440016[_0x42ed('0x38')][_0x42ed('0x47')]?_0x440016[_0x42ed('0x38')]:_0x4bacba[_0x42ed('0x36')];_0x440016[_0x42ed('0x3a')]=qs['sort'](_0x5d48fa[_0x42ed('0x33')]['sort']);_0x440016[_0x42ed('0x3c')]=qs[_0x42ed('0x34')](_[_0x42ed('0x3d')](_0x5d48fa['query'],_0x4bacba[_0x42ed('0x34')]));if(_0x5d48fa[_0x42ed('0x33')][_0x42ed('0x3e')]){_0x440016[_0x42ed('0x3c')]=_[_0x42ed('0x3f')](_0x440016['where'],{'$or':_['map'](_0x440016['attributes'],function(_0x1010ca){var _0x1d198a={};_0x1d198a[_0x1010ca]={'$like':'%'+_0x5d48fa['query'][_0x42ed('0x3e')]+'%'};return _0x1d198a;})});}_0x440016=_[_0x42ed('0x3f')]({},_0x440016,_0x5d48fa[_0x42ed('0x40')]);return _0x15650d['getLists'](_0x440016);}})[_0x42ed('0x24')](function(_0x35d35d){if(_0x35d35d){_0x3793a1=_0x35d35d['length'];if(!_0x5d48fa[_0x42ed('0x33')][_0x42ed('0x5d')]('nolimit')){_0x440016[_0x42ed('0x1d')]=qs[_0x42ed('0x1d')](_0x5d48fa[_0x42ed('0x33')][_0x42ed('0x1d')]);_0x440016[_0x42ed('0x1b')]=qs['offset'](_0x5d48fa['query'][_0x42ed('0x1b')]);}return _0x15650d['getLists'](_0x440016);}})[_0x42ed('0x24')](function(_0x5176b3){if(_0x5176b3){return _0x5176b3?{'count':_0x3793a1,'rows':_0x5176b3}:null;}})['then'](respondWithResult(_0x1955c6,null))[_0x42ed('0x43')](handleError(_0x1955c6,null));};exports[_0x42ed('0x67')]=function(_0x5db1b1,_0x4f59dc,_0x2d2d4f){var _0x42bac9,_0xabcf7a;var _0x4c82b5=[];var _0x4c8673=moment()[_0x42ed('0x68')]('YYYY-MM-DD\x20HH:mm:ss');return db[_0x42ed('0x2e')]['find']({'where':{'id':_0x5db1b1['params']['id']}})[_0x42ed('0x24')](handleEntityNotFound(_0x4f59dc,null))[_0x42ed('0x24')](function(_0x1ab760){if(_0x1ab760){_0xabcf7a=_0x1ab760;return _0x1ab760[_0x42ed('0x67')](_0x5db1b1[_0x42ed('0x4b')][_0x42ed('0x69')],_['omit'](_0x5db1b1['body'],[_0x42ed('0x69'),'id'])||{});}return null;})['spread'](function(_0x444d2d){var _0x193ffa;var _0x3f7611;_0x42bac9=_0x444d2d||[];var _0x4763a0=[];if(_0x444d2d){for(var _0x3e95ae=0x0;_0x3e95ae<_0x444d2d[_0x42ed('0x47')];_0x3e95ae+=0x1){var _0x36e1a7=_0x444d2d[_0x3e95ae][_0x42ed('0x4d')]({'plain':!![]});_0xabcf7a[_0x42ed('0x6a')]=_0x5db1b1[_0x42ed('0x4b')][_0x42ed('0x6a')]?_0x5db1b1[_0x42ed('0x4b')][_0x42ed('0x6a')]:_0xabcf7a[_0x42ed('0x6a')];switch(_0xabcf7a[_0x42ed('0x6a')]){case _0x42ed('0x6b'):_0x193ffa=squel[_0x42ed('0x6c')]()['into']('cm_hopper')['fromQuery']([_0x42ed('0x6d'),_0x42ed('0x6e'),_0x42ed('0x6f'),_0x42ed('0x70'),_0x42ed('0x5e'),_0x42ed('0x57'),_0x42ed('0x58')],squel[_0x42ed('0x71')]()[_0x42ed('0x72')](_0x42ed('0x6d'),'phone')[_0x42ed('0x72')]('NOW()',_0x42ed('0x6e'))[_0x42ed('0x72')]('id',_0x42ed('0x6f'))['field'](_0x36e1a7[_0x42ed('0x73')][_0x42ed('0x74')](),_0x42ed('0x70'))[_0x42ed('0x72')](_0x5db1b1[_0x42ed('0x45')]['id'][_0x42ed('0x74')](),_0x42ed('0x5e'))[_0x42ed('0x72')]('\x27'+_0x4c8673+'\x27',_0x42ed('0x57'))['field']('\x27'+_0x4c8673+'\x27',_0x42ed('0x58'))[_0x42ed('0x75')]('cm_contacts')[_0x42ed('0x3c')](_0x42ed('0x76'))['where'](_0x42ed('0x77'),_0x36e1a7[_0x42ed('0x73')][_0x42ed('0x74')]())[_0x42ed('0x3c')]('phone\x20IS\x20NOT\x20NULL')[_0x42ed('0x3c')]('phone\x20NOT\x20IN\x20(?)',squel[_0x42ed('0x71')]()[_0x42ed('0x72')](_0x42ed('0x78'))[_0x42ed('0x75')](_0x42ed('0x79'))[_0x42ed('0x3c')]('CampaignId\x20=\x20?',_0x5db1b1['params']['id'][_0x42ed('0x74')]()))[_0x42ed('0x3c')](_0x42ed('0x7a'),squel[_0x42ed('0x71')]()[_0x42ed('0x72')](_0x42ed('0x7b'))[_0x42ed('0x75')](_0x42ed('0x7c'))[_0x42ed('0x3c')](_0x42ed('0x7d'),_0x5db1b1[_0x42ed('0x45')]['id'][_0x42ed('0x74')]())))['toString']();break;case _0x42ed('0x7e'):_0x193ffa=squel[_0x42ed('0x6c')]()[_0x42ed('0x7f')](_0x42ed('0x7c'))['fromQuery'](['phone',_0x42ed('0x6e'),'ContactId',_0x42ed('0x70'),_0x42ed('0x5e'),_0x42ed('0x57'),_0x42ed('0x58')],squel[_0x42ed('0x71')]()[_0x42ed('0x72')](_0x42ed('0x6d'),_0x42ed('0x6d'))[_0x42ed('0x72')](_0x42ed('0x80'),_0x42ed('0x6e'))[_0x42ed('0x72')]('id',_0x42ed('0x6f'))[_0x42ed('0x72')](_0x36e1a7['CmListId'][_0x42ed('0x74')](),_0x42ed('0x70'))[_0x42ed('0x72')](_0x5db1b1[_0x42ed('0x45')]['id']['toString'](),'CampaignId')[_0x42ed('0x72')]('\x27'+_0x4c8673+'\x27','createdAt')['field']('\x27'+_0x4c8673+'\x27',_0x42ed('0x58'))[_0x42ed('0x75')]('cm_contacts')[_0x42ed('0x3c')](_0x42ed('0x76'))[_0x42ed('0x3c')]('ListId\x20=\x20?',_0x36e1a7[_0x42ed('0x73')][_0x42ed('0x74')]())[_0x42ed('0x3c')](_0x42ed('0x81'))[_0x42ed('0x3c')]('phone\x20NOT\x20IN\x20(?)',squel[_0x42ed('0x71')]()[_0x42ed('0x72')](_0x42ed('0x7b'))[_0x42ed('0x75')](_0x42ed('0x7c'))[_0x42ed('0x3c')](_0x42ed('0x7d'),_0x5db1b1['params']['id'][_0x42ed('0x74')]())))[_0x42ed('0x74')]();break;default:_0x193ffa=squel[_0x42ed('0x6c')]()['into']('cm_hopper')['fromQuery'](['phone',_0x42ed('0x6e'),_0x42ed('0x6f'),_0x42ed('0x70'),_0x42ed('0x5e'),_0x42ed('0x57'),'updatedAt'],squel[_0x42ed('0x71')]()[_0x42ed('0x72')](_0x42ed('0x6d'),_0x42ed('0x6d'))['field'](_0x42ed('0x80'),_0x42ed('0x6e'))['field']('id',_0x42ed('0x6f'))[_0x42ed('0x72')](_0x36e1a7['CmListId'][_0x42ed('0x74')](),_0x42ed('0x70'))['field'](_0x5db1b1[_0x42ed('0x45')]['id'][_0x42ed('0x74')](),_0x42ed('0x5e'))['field']('\x27'+_0x4c8673+'\x27',_0x42ed('0x57'))[_0x42ed('0x72')]('\x27'+_0x4c8673+'\x27',_0x42ed('0x58'))[_0x42ed('0x75')](_0x42ed('0x82'))[_0x42ed('0x3c')](_0x42ed('0x76'))[_0x42ed('0x3c')](_0x42ed('0x77'),_0x36e1a7[_0x42ed('0x73')][_0x42ed('0x74')]())[_0x42ed('0x3c')]('phone\x20IS\x20NOT\x20NULL'))['toString']();}_0x3f7611=squel['insert']()[_0x42ed('0x7f')]('cm_hopper_additional_phones')[_0x42ed('0x83')]([_0x42ed('0x84'),_0x42ed('0x6e'),'phone',_0x42ed('0x85'),'createdAt','updatedAt'],squel[_0x42ed('0x71')]()[_0x42ed('0x72')](_0x42ed('0x86'),'id')[_0x42ed('0x72')](_0x42ed('0x80'),'scheduledAt')[_0x42ed('0x72')]('ci.item','phone')['field'](_0x42ed('0x87'),'OrderBy')['field']('\x27'+_0x4c8673+'\x27','createdAt')[_0x42ed('0x72')]('\x27'+_0x4c8673+'\x27','updatedAt')['from'](_0x42ed('0x88'),'ci')[_0x42ed('0x89')](_0x42ed('0x7c'),'h',_0x42ed('0x8a'))[_0x42ed('0x3c')](_0x42ed('0x8b'),_0x36e1a7[_0x42ed('0x73')]['toString']())[_0x42ed('0x3c')](_0x42ed('0x8c'),_0x5db1b1[_0x42ed('0x45')]['id'][_0x42ed('0x74')]())[_0x42ed('0x3c')]('h.createdAt\x20=\x20?',_0x4c8673))[_0x42ed('0x74')]();_0x4763a0['push'](db[_0x42ed('0x8d')][_0x42ed('0x33')](_0x193ffa));_0x4c82b5[_0x42ed('0x8e')](db[_0x42ed('0x8d')][_0x42ed('0x33')](_0x3f7611));}return BPromise[_0x42ed('0x8f')](_0x4763a0);}})['then'](function(){return BPromise[_0x42ed('0x8f')](_0x4c82b5);})['then'](function(){return _0x42bac9;})[_0x42ed('0x24')](respondWithResult(_0x4f59dc,null))[_0x42ed('0x43')](handleError(_0x4f59dc,null));};exports[_0x42ed('0x90')]=function(_0x1fdad2,_0x497189,_0x33fe98){return db[_0x42ed('0x2e')][_0x42ed('0x49')]({'where':{'id':_0x1fdad2['params']['id']}})[_0x42ed('0x24')](handleEntityNotFound(_0x497189,null))[_0x42ed('0x24')](function(_0x87e4da){if(_0x87e4da){return _0x87e4da[_0x42ed('0x90')](_0x1fdad2[_0x42ed('0x33')][_0x42ed('0x69')]);}})[_0x42ed('0x24')](function(_0x588be8){if(_0x588be8){return db[_0x42ed('0x5b')][_0x42ed('0x26')]({'where':{'ListId':_0x1fdad2['query'][_0x42ed('0x69')],'CampaignId':_0x1fdad2[_0x42ed('0x45')]['id']}})['then'](function(){return _0x588be8;});}})[_0x42ed('0x24')](respondWithStatusCode(_0x497189,null))[_0x42ed('0x43')](handleError(_0x497189,null));};exports['getBlackLists']=function(_0x38585a,_0x5e666d,_0x2e76fe){var _0x2a7e65={};var _0x3e9aaa={};var _0x5ceb14;var _0x4e3395;return db['Campaign'][_0x42ed('0x5a')]({'where':{'id':_0x38585a[_0x42ed('0x45')]['id']}})[_0x42ed('0x24')](handleEntityNotFound(_0x5e666d,null))[_0x42ed('0x24')](function(_0x589eda){if(_0x589eda){_0x5ceb14=_0x589eda;_0x3e9aaa[_0x42ed('0x36')]=_[_0x42ed('0x46')](db[_0x42ed('0x66')]['rawAttributes']);_0x3e9aaa[_0x42ed('0x33')]=_['keys'](_0x38585a[_0x42ed('0x33')]);_0x3e9aaa[_0x42ed('0x34')]=_[_0x42ed('0x35')](_0x3e9aaa['model'],_0x3e9aaa[_0x42ed('0x33')]);_0x2a7e65[_0x42ed('0x38')]=_[_0x42ed('0x35')](_0x3e9aaa['model'],qs[_0x42ed('0x37')](_0x38585a[_0x42ed('0x33')][_0x42ed('0x37')]));_0x2a7e65[_0x42ed('0x38')]=_0x2a7e65[_0x42ed('0x38')][_0x42ed('0x47')]?_0x2a7e65[_0x42ed('0x38')]:_0x3e9aaa[_0x42ed('0x36')];_0x2a7e65[_0x42ed('0x3a')]=qs[_0x42ed('0x3b')](_0x38585a[_0x42ed('0x33')][_0x42ed('0x3b')]);_0x2a7e65['where']=qs[_0x42ed('0x34')](_['pick'](_0x38585a[_0x42ed('0x33')],_0x3e9aaa['filters']));if(_0x38585a['query'][_0x42ed('0x3e')]){_0x2a7e65[_0x42ed('0x3c')]=_[_0x42ed('0x3f')](_0x2a7e65[_0x42ed('0x3c')],{'$or':_[_0x42ed('0x32')](_0x2a7e65[_0x42ed('0x38')],function(_0x179d45){var _0x318b00={};_0x318b00[_0x179d45]={'$like':'%'+_0x38585a['query'][_0x42ed('0x3e')]+'%'};return _0x318b00;})});}_0x2a7e65=_[_0x42ed('0x3f')]({},_0x2a7e65,_0x38585a['options']);return _0x5ceb14[_0x42ed('0x91')](_0x2a7e65);}})['then'](function(_0x246fac){if(_0x246fac){_0x4e3395=_0x246fac['length'];if(!_0x38585a[_0x42ed('0x33')][_0x42ed('0x5d')](_0x42ed('0x39'))){_0x2a7e65[_0x42ed('0x1d')]=qs['limit'](_0x38585a[_0x42ed('0x33')][_0x42ed('0x1d')]);_0x2a7e65[_0x42ed('0x1b')]=qs[_0x42ed('0x1b')](_0x38585a['query'][_0x42ed('0x1b')]);}return _0x5ceb14[_0x42ed('0x91')](_0x2a7e65);}})[_0x42ed('0x24')](function(_0x11caa8){if(_0x11caa8){return _0x11caa8?{'count':_0x4e3395,'rows':_0x11caa8}:null;}})[_0x42ed('0x24')](respondWithResult(_0x5e666d,null))[_0x42ed('0x43')](handleError(_0x5e666d,null));};exports['addBlackLists']=function(_0x5a1939,_0x85bfad,_0x5eb30b){var _0x16439f,_0x425aa4;var _0x254191=[];var _0x3eb74d=moment()[_0x42ed('0x68')](_0x42ed('0x92'));return db[_0x42ed('0x2e')][_0x42ed('0x49')]({'where':{'id':_0x5a1939['params']['id']}})[_0x42ed('0x24')](handleEntityNotFound(_0x85bfad,null))[_0x42ed('0x24')](function(_0x3c8c37){if(_0x3c8c37){_0x425aa4=_0x3c8c37;return _0x3c8c37[_0x42ed('0x93')](_0x5a1939[_0x42ed('0x4b')][_0x42ed('0x69')],_[_0x42ed('0x56')](_0x5a1939[_0x42ed('0x4b')],['ids','id'])||{});}return null;})[_0x42ed('0x94')](function(_0x2ad77b){var _0x1f4b9b;var _0x12fb8f;_0x16439f=_0x2ad77b||[];var _0x3f3f56=[];if(_0x2ad77b){for(var _0x56596d=0x0;_0x56596d<_0x2ad77b[_0x42ed('0x47')];_0x56596d+=0x1){var _0x1eb4f5=_0x2ad77b[_0x56596d][_0x42ed('0x4d')]({'plain':!![]});_0x1f4b9b=squel['insert']()[_0x42ed('0x7f')]('cm_hopper_black')[_0x42ed('0x83')]([_0x42ed('0x6d'),_0x42ed('0x6f'),_0x42ed('0x70'),_0x42ed('0x5e'),_0x42ed('0x57'),_0x42ed('0x58')],squel[_0x42ed('0x71')]()[_0x42ed('0x72')](_0x42ed('0x6d'),_0x42ed('0x6d'))[_0x42ed('0x72')]('id',_0x42ed('0x6f'))[_0x42ed('0x72')](_0x1eb4f5['CmListId'][_0x42ed('0x74')](),_0x42ed('0x70'))['field'](_0x5a1939['params']['id'][_0x42ed('0x74')](),'CampaignId')[_0x42ed('0x72')](_0x42ed('0x80'),'createdAt')[_0x42ed('0x72')](_0x42ed('0x80'),'updatedAt')['from']('cm_contacts')[_0x42ed('0x3c')](_0x42ed('0x76'))[_0x42ed('0x3c')](_0x42ed('0x77'),_0x1eb4f5['CmListId'][_0x42ed('0x74')]())['where'](_0x42ed('0x81')))[_0x42ed('0x74')]();_0x3f3f56[_0x42ed('0x8e')](db[_0x42ed('0x8d')]['query'](_0x1f4b9b));}return BPromise[_0x42ed('0x8f')](_0x3f3f56);}})[_0x42ed('0x24')](function(){return _0x16439f;})[_0x42ed('0x24')](respondWithResult(_0x85bfad,null))['catch'](handleError(_0x85bfad,null));};exports['removeBlackLists']=function(_0x441bef,_0x391d62,_0x499064){return db['Campaign'][_0x42ed('0x49')]({'where':{'id':_0x441bef[_0x42ed('0x45')]['id']}})[_0x42ed('0x24')](handleEntityNotFound(_0x391d62,null))[_0x42ed('0x24')](function(_0x2e0ae8){if(_0x2e0ae8){return _0x2e0ae8[_0x42ed('0x95')](_0x441bef[_0x42ed('0x33')][_0x42ed('0x69')]);}})['then'](function(_0x2189f6){if(_0x2189f6){return db['CmHopperBlack'][_0x42ed('0x26')]({'where':{'ListId':_0x441bef[_0x42ed('0x33')][_0x42ed('0x69')],'CampaignId':_0x441bef[_0x42ed('0x45')]['id']}})[_0x42ed('0x24')](function(){return _0x2189f6;});}})[_0x42ed('0x24')](respondWithStatusCode(_0x391d62,null))['catch'](handleError(_0x391d62,null));}; \ No newline at end of file +var _0x20a3=['getHopperBlacks','CmHopperBlack','CmList','getLists','addLists','YYYY-MM-DD\x20HH:mm:ss','ids','dialCheckDuplicateType','always','insert','into','cm_hopper','fromQuery','phone','scheduledAt','ContactId','ListId','field','NOW()','CmListId','toString','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','from','cm_hopper_final','CampaignId\x20=\x20?','COALESCE(phone,\x27\x27)','onlyIfOpen','select','cm_contacts','cm_hopper_additional_phones','cmHopperId','ci.item','ci.OrderBY','OrderBy','cm_contact_has_items','h.ContactId\x20=\x20ci.CmContactId','h.ListId\x20=\x20?','h.CampaignId=?','push','sequelize','all','removeLists','getBlackLists','addBlackLists','format','cm_hopper_black','removeBlackLists','eml-format','zip-dir','fast-json-patch','request-promise','util','path','sox','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','destroy','then','get','UserProfileResource','status','error','stack','name','send','index','map','Campaign','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','nolimit','order','sort','where','filters','pick','filter','VIRTUAL','includeAll','include','catch','show','params','options','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','IvrCampaigns','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','merge','omit','createdAt','updatedAt','role','autoAssociation','getHoppers','findOne','CmHopper','hasOwnProperty','CmHopperHistory','CampaignId','findAll','rows','getHopperFinals','CmHopperFinal'];(function(_0x469b1a,_0x1b9cc3){var _0xbca5f5=function(_0x56f9b2){while(--_0x56f9b2){_0x469b1a['push'](_0x469b1a['shift']());}};_0xbca5f5(++_0x1b9cc3);}(_0x20a3,0x15b));var _0x320a=function(_0x3489af,_0x265469){_0x3489af=_0x3489af-0x0;var _0x3debc0=_0x20a3[_0x3489af];return _0x3debc0;};'use strict';var emlformat=require(_0x320a('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x320a('0x1'));var jsonpatch=require(_0x320a('0x2'));var rp=require(_0x320a('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x320a('0x4'));var path=require(_0x320a('0x5'));var sox=require(_0x320a('0x6'));var csv=require(_0x320a('0x7'));var ejs=require(_0x320a('0x8'));var fs=require('fs');var fs_extra=require(_0x320a('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x320a('0xa'));var jsforce=require(_0x320a('0xb'));var deskjs=require(_0x320a('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x320a('0xd'));var Redis=require('ioredis');var authService=require(_0x320a('0xe'));var qs=require(_0x320a('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x320a('0x10'));var logger=require(_0x320a('0x11'))('api');var utils=require(_0x320a('0x12'));var config=require(_0x320a('0x13'));var licenseUtil=require(_0x320a('0x14'));var db=require(_0x320a('0x15'))['db'];function respondWithStatusCode(_0x570693,_0x3a6cb0){_0x3a6cb0=_0x3a6cb0||0xcc;return function(_0x42b8dc){if(_0x42b8dc){return _0x570693[_0x320a('0x16')](_0x3a6cb0);}return _0x570693['status'](_0x3a6cb0)[_0x320a('0x17')]();};}function respondWithResult(_0x35ec33,_0x4d1ab9){_0x4d1ab9=_0x4d1ab9||0xc8;return function(_0x1cbd26){if(_0x1cbd26){return _0x35ec33['status'](_0x4d1ab9)[_0x320a('0x18')](_0x1cbd26);}};}function respondWithFilteredResult(_0x2e8124,_0xfe4b71){return function(_0x44a628){if(_0x44a628){var _0x501cd2=typeof _0xfe4b71[_0x320a('0x19')]==='undefined'&&typeof _0xfe4b71['limit']===_0x320a('0x1a');var _0x59733d=_0x44a628[_0x320a('0x1b')];var _0x3a1911=_0x501cd2?0x0:_0xfe4b71[_0x320a('0x19')];var _0x45bb6b=_0x501cd2?_0x44a628[_0x320a('0x1b')]:_0xfe4b71['offset']+_0xfe4b71[_0x320a('0x1c')];var _0x147c7f;if(_0x45bb6b>=_0x59733d){_0x45bb6b=_0x59733d;_0x147c7f=0xc8;}else{_0x147c7f=0xce;}_0x2e8124['status'](_0x147c7f);return _0x2e8124[_0x320a('0x1d')](_0x320a('0x1e'),_0x3a1911+'-'+_0x45bb6b+'/'+_0x59733d)[_0x320a('0x18')](_0x44a628);}return null;};}function patchUpdates(_0x37b0ae){return function(_0x18514b){try{jsonpatch[_0x320a('0x1f')](_0x18514b,_0x37b0ae,!![]);}catch(_0x1471aa){return BPromise[_0x320a('0x20')](_0x1471aa);}return _0x18514b[_0x320a('0x21')]();};}function saveUpdates(_0x4e5c99,_0x9001c0){return function(_0x20f59d){if(_0x20f59d){return _0x20f59d[_0x320a('0x22')](_0x4e5c99)['then'](function(_0x3974bd){return _0x3974bd;});}return null;};}function removeEntity(_0x207748,_0x3981d5){return function(_0x17fd84){if(_0x17fd84){return _0x17fd84[_0x320a('0x23')]()[_0x320a('0x24')](function(){var _0x40af50=_0x17fd84[_0x320a('0x25')]({'plain':!![]});var _0x8b4862='IvrCampaigns';return db[_0x320a('0x26')][_0x320a('0x23')]({'where':{'type':_0x8b4862,'resourceId':_0x40af50['id']}})[_0x320a('0x24')](function(){return _0x17fd84;});})[_0x320a('0x24')](function(){_0x207748[_0x320a('0x27')](0xcc)['end']();});}};}function handleEntityNotFound(_0x536f35,_0x560173){return function(_0x8457e3){if(!_0x8457e3){_0x536f35[_0x320a('0x16')](0x194);}return _0x8457e3;};}function handleError(_0x225f02,_0x64bbda){_0x64bbda=_0x64bbda||0x1f4;return function(_0x213b4e){logger[_0x320a('0x28')](_0x213b4e[_0x320a('0x29')]);if(_0x213b4e['name']){delete _0x213b4e[_0x320a('0x2a')];}_0x225f02[_0x320a('0x27')](_0x64bbda)[_0x320a('0x2b')](_0x213b4e);};}exports[_0x320a('0x2c')]=function(_0x5dbdca,_0x5cd3cc){var _0x43fe81={},_0x33e764={},_0x13565f={'count':0x0,'rows':[]};var _0x4bfd3a=_[_0x320a('0x2d')](db[_0x320a('0x2e')][_0x320a('0x2f')],function(_0x16d2f6){return{'name':_0x16d2f6[_0x320a('0x30')],'type':_0x16d2f6[_0x320a('0x31')][_0x320a('0x32')]};});_0x33e764[_0x320a('0x33')]=_['map'](_0x4bfd3a,'name');_0x33e764[_0x320a('0x34')]=_[_0x320a('0x35')](_0x5dbdca[_0x320a('0x34')]);_0x33e764['filters']=_[_0x320a('0x36')](_0x33e764[_0x320a('0x33')],_0x33e764[_0x320a('0x34')]);_0x43fe81[_0x320a('0x37')]=_[_0x320a('0x36')](_0x33e764['model'],qs['fields'](_0x5dbdca['query'][_0x320a('0x38')]));_0x43fe81[_0x320a('0x37')]=_0x43fe81[_0x320a('0x37')][_0x320a('0x39')]?_0x43fe81[_0x320a('0x37')]:_0x33e764[_0x320a('0x33')];if(!_0x5dbdca[_0x320a('0x34')]['hasOwnProperty'](_0x320a('0x3a'))){_0x43fe81['limit']=qs[_0x320a('0x1c')](_0x5dbdca[_0x320a('0x34')][_0x320a('0x1c')]);_0x43fe81[_0x320a('0x19')]=qs['offset'](_0x5dbdca[_0x320a('0x34')][_0x320a('0x19')]);}_0x43fe81[_0x320a('0x3b')]=qs['sort'](_0x5dbdca[_0x320a('0x34')][_0x320a('0x3c')]);_0x43fe81[_0x320a('0x3d')]=qs[_0x320a('0x3e')](_[_0x320a('0x3f')](_0x5dbdca[_0x320a('0x34')],_0x33e764[_0x320a('0x3e')]),_0x4bfd3a);if(_0x5dbdca[_0x320a('0x34')][_0x320a('0x40')]){_0x43fe81['where']=_['merge'](_0x43fe81['where'],{'$or':_['map'](_0x4bfd3a,function(_0x742cb3){if(_0x742cb3[_0x320a('0x31')]!==_0x320a('0x41')){var _0xe86caf={};_0xe86caf[_0x742cb3[_0x320a('0x2a')]]={'$like':'%'+_0x5dbdca[_0x320a('0x34')]['filter']+'%'};return _0xe86caf;}})});}_0x43fe81=_['merge']({},_0x43fe81,_0x5dbdca['options']);var _0x3e39af={'where':_0x43fe81[_0x320a('0x3d')]};return db[_0x320a('0x2e')][_0x320a('0x1b')](_0x3e39af)[_0x320a('0x24')](function(_0x1f9ce6){_0x13565f[_0x320a('0x1b')]=_0x1f9ce6;if(_0x5dbdca['query'][_0x320a('0x42')]){_0x43fe81[_0x320a('0x43')]=[{'all':!![]}];}return db[_0x320a('0x2e')]['findAll'](_0x43fe81);})[_0x320a('0x24')](function(_0x44dabf){_0x13565f['rows']=_0x44dabf;return _0x13565f;})['then'](respondWithFilteredResult(_0x5cd3cc,_0x43fe81))[_0x320a('0x44')](handleError(_0x5cd3cc,null));};exports[_0x320a('0x45')]=function(_0x25fb77,_0x581372){var _0x3a68de={'raw':![],'where':{'id':_0x25fb77[_0x320a('0x46')]['id']}},_0x139d4c={};_0x139d4c[_0x320a('0x33')]=_[_0x320a('0x35')](db[_0x320a('0x2e')][_0x320a('0x2f')]);_0x139d4c[_0x320a('0x34')]=_[_0x320a('0x35')](_0x25fb77[_0x320a('0x34')]);_0x139d4c[_0x320a('0x3e')]=_[_0x320a('0x36')](_0x139d4c[_0x320a('0x33')],_0x139d4c['query']);_0x3a68de[_0x320a('0x37')]=_[_0x320a('0x36')](_0x139d4c[_0x320a('0x33')],qs[_0x320a('0x38')](_0x25fb77[_0x320a('0x34')]['fields']));_0x3a68de[_0x320a('0x37')]=_0x3a68de[_0x320a('0x37')][_0x320a('0x39')]?_0x3a68de[_0x320a('0x37')]:_0x139d4c[_0x320a('0x33')];if(_0x25fb77['query'][_0x320a('0x42')]){_0x3a68de['include']=[{'all':!![]}];}_0x3a68de=_['merge']({},_0x3a68de,_0x25fb77[_0x320a('0x47')]);return db[_0x320a('0x2e')][_0x320a('0x48')](_0x3a68de)[_0x320a('0x24')](handleEntityNotFound(_0x581372,null))[_0x320a('0x24')](respondWithResult(_0x581372,null))[_0x320a('0x44')](handleError(_0x581372,null));};exports[_0x320a('0x49')]=function(_0x465d26,_0x236158){return db['Campaign'][_0x320a('0x49')](_0x465d26[_0x320a('0x4a')],{})[_0x320a('0x24')](function(_0x2010fc){var _0x4ed622=_0x465d26['user'][_0x320a('0x25')]({'plain':!![]});if(!_0x4ed622)throw new Error(_0x320a('0x4b'));if(_0x4ed622['role']===_0x320a('0x4c')){var _0x42afe0=_0x2010fc['get']({'plain':!![]});var _0x839c0d=_0x320a('0x4d');return db[_0x320a('0x4e')]['find']({'where':{'name':_0x839c0d,'userProfileId':_0x4ed622[_0x320a('0x4f')]},'raw':!![]})['then'](function(_0x2b927d){if(_0x2b927d&&_0x2b927d['autoAssociation']===0x0){return db[_0x320a('0x26')]['create']({'name':_0x42afe0['name'],'resourceId':_0x42afe0['id'],'type':_0x2b927d[_0x320a('0x2a')],'sectionId':_0x2b927d['id']},{})['then'](function(){return _0x2010fc;});}else{return _0x2010fc;}})[_0x320a('0x44')](function(_0x36c65e){logger[_0x320a('0x28')](_0x320a('0x50'),_0x36c65e);throw _0x36c65e;});}return _0x2010fc;})[_0x320a('0x24')](respondWithResult(_0x236158,0xc9))['catch'](handleError(_0x236158,null));};exports['clone']=function(_0x13cbca,_0x21d02f){var _0x4bb56b={'where':{'id':_0x13cbca['params']['id']}},_0x4deb6b={};_0x4deb6b['model']=_[_0x320a('0x35')](db[_0x320a('0x2e')][_0x320a('0x2f')]);_0x4bb56b[_0x320a('0x37')]=_[_0x320a('0x36')](_0x4deb6b[_0x320a('0x33')],qs[_0x320a('0x38')](_0x13cbca[_0x320a('0x34')][_0x320a('0x38')]));_0x4bb56b['attributes']=_0x4bb56b['attributes']['length']?_0x4bb56b[_0x320a('0x37')]:_0x4deb6b[_0x320a('0x33')];if(_0x13cbca['query'][_0x320a('0x42')]){_0x4bb56b[_0x320a('0x43')]=[{'all':!![]}];}_0x4bb56b=_[_0x320a('0x51')]({},_0x4bb56b,_0x13cbca[_0x320a('0x47')]);return db[_0x320a('0x2e')]['find'](_0x4bb56b)[_0x320a('0x24')](handleEntityNotFound(_0x21d02f,null))[_0x320a('0x24')](function(_0x208a56){if(_0x208a56){var _0x279227=_0x208a56[_0x320a('0x25')]({'plain':!![]});_0x279227=qs[_0x320a('0x52')](_0x279227,['id',_0x320a('0x53'),'updatedAt']);_0x13cbca[_0x320a('0x4a')]=_[_0x320a('0x52')](_0x13cbca['body'],['id',_0x320a('0x53'),_0x320a('0x54')]);return db[_0x320a('0x2e')][_0x320a('0x49')](_[_0x320a('0x51')](_0x279227,_0x13cbca[_0x320a('0x4a')]),{'include':_0x13cbca['query'][_0x320a('0x42')]?[{'all':!![]}]:undefined})[_0x320a('0x24')](function(_0x514b22){var _0x5cfbcd=_0x13cbca[_0x320a('0x4c')][_0x320a('0x25')]({'plain':!![]});if(!_0x5cfbcd)throw new Error(_0x320a('0x4b'));if(_0x5cfbcd[_0x320a('0x55')]==='user'){var _0x3e6119=_0x514b22[_0x320a('0x25')]({'plain':!![]});var _0x29b207=_0x320a('0x4d');return db['UserProfileSection'][_0x320a('0x48')]({'where':{'name':_0x29b207,'userProfileId':_0x5cfbcd[_0x320a('0x4f')]},'raw':!![]})['then'](function(_0x409961){if(_0x409961&&_0x409961[_0x320a('0x56')]===0x0){return db[_0x320a('0x26')]['create']({'name':_0x3e6119[_0x320a('0x2a')],'resourceId':_0x3e6119['id'],'type':_0x409961[_0x320a('0x2a')],'sectionId':_0x409961['id']},{})['then'](function(){return _0x514b22;});}else{return _0x514b22;}})[_0x320a('0x44')](function(_0x406e78){logger['error'](_0x320a('0x50'),_0x406e78);throw _0x406e78;});}return _0x514b22;});}})[_0x320a('0x24')](respondWithResult(_0x21d02f,0xc9))[_0x320a('0x44')](handleError(_0x21d02f,null));};exports[_0x320a('0x22')]=function(_0x30769c,_0x5c57da){if(_0x30769c[_0x320a('0x4a')]['id']){delete _0x30769c[_0x320a('0x4a')]['id'];}return db[_0x320a('0x2e')][_0x320a('0x48')]({'where':{'id':_0x30769c[_0x320a('0x46')]['id']}})['then'](handleEntityNotFound(_0x5c57da,null))[_0x320a('0x24')](saveUpdates(_0x30769c[_0x320a('0x4a')],null))[_0x320a('0x24')](respondWithResult(_0x5c57da,null))[_0x320a('0x44')](handleError(_0x5c57da,null));};exports[_0x320a('0x23')]=function(_0x16dd77,_0x37ba87){return db[_0x320a('0x2e')][_0x320a('0x48')]({'where':{'id':_0x16dd77[_0x320a('0x46')]['id']}})[_0x320a('0x24')](handleEntityNotFound(_0x37ba87,null))[_0x320a('0x24')](removeEntity(_0x37ba87,null))[_0x320a('0x44')](handleError(_0x37ba87,null));};exports[_0x320a('0x57')]=function(_0x261eb8,_0x42aa05,_0x2373e1){var _0x50a700={'raw':!![],'where':{}};var _0x5618f3={};var _0x265204={'count':0x0,'rows':[]};return db['Campaign'][_0x320a('0x58')]({'where':{'id':_0x261eb8[_0x320a('0x46')]['id']}})[_0x320a('0x24')](handleEntityNotFound(_0x42aa05,null))['then'](function(_0x51193d){if(_0x51193d){_0x5618f3[_0x320a('0x33')]=_['keys'](db[_0x320a('0x59')]['rawAttributes']);_0x5618f3[_0x320a('0x34')]=_[_0x320a('0x35')](_0x261eb8['query']);_0x5618f3[_0x320a('0x3e')]=_[_0x320a('0x36')](_0x5618f3[_0x320a('0x33')],_0x5618f3['query']);_0x50a700[_0x320a('0x37')]=_['intersection'](_0x5618f3[_0x320a('0x33')],qs[_0x320a('0x38')](_0x261eb8[_0x320a('0x34')]['fields']));_0x50a700['attributes']=_0x50a700[_0x320a('0x37')][_0x320a('0x39')]?_0x50a700['attributes']:_0x5618f3['model'];if(!_0x261eb8[_0x320a('0x34')][_0x320a('0x5a')](_0x320a('0x3a'))){_0x50a700[_0x320a('0x1c')]=qs[_0x320a('0x1c')](_0x261eb8[_0x320a('0x34')][_0x320a('0x1c')]);_0x50a700[_0x320a('0x19')]=qs[_0x320a('0x19')](_0x261eb8[_0x320a('0x34')][_0x320a('0x19')]);}_0x50a700[_0x320a('0x3b')]=qs['sort'](_0x261eb8[_0x320a('0x34')][_0x320a('0x3c')]);_0x50a700[_0x320a('0x3d')]=qs[_0x320a('0x3e')](_['pick'](_0x261eb8[_0x320a('0x34')],_0x5618f3['filters']));_0x50a700[_0x320a('0x3d')]['CampaignId']=_0x51193d['id'];if(_0x261eb8['query'][_0x320a('0x40')]){_0x50a700[_0x320a('0x3d')]=_[_0x320a('0x51')](_0x50a700[_0x320a('0x3d')],{'$or':_[_0x320a('0x2d')](_0x50a700[_0x320a('0x37')],function(_0xc30f24){var _0x2e1a4e={};_0x2e1a4e[_0xc30f24]={'$like':'%'+_0x261eb8[_0x320a('0x34')]['filter']+'%'};return _0x2e1a4e;})});}_0x50a700=_[_0x320a('0x51')]({},_0x50a700,_0x261eb8[_0x320a('0x47')]);return db['CmHopper']['count']({'where':_0x50a700[_0x320a('0x3d')]})[_0x320a('0x24')](function(_0x280235){_0x265204[_0x320a('0x1b')]=_0x280235;if(_0x261eb8[_0x320a('0x34')][_0x320a('0x42')]){_0x50a700['include']=[{'all':!![]}];}return db[_0x320a('0x59')]['findAll'](_0x50a700);})[_0x320a('0x24')](function(_0x120268){_0x265204['rows']=_0x120268;return _0x265204;});}})[_0x320a('0x24')](respondWithFilteredResult(_0x42aa05,_0x50a700))['catch'](handleError(_0x42aa05,null));};exports['getHopperHistories']=function(_0x1e4080,_0xdd2b5e,_0x155894){var _0x3b239d={'raw':!![],'where':{}};var _0x3f94={};var _0x19a2d6={'count':0x0,'rows':[]};return db[_0x320a('0x2e')][_0x320a('0x58')]({'where':{'id':_0x1e4080[_0x320a('0x46')]['id']}})[_0x320a('0x24')](handleEntityNotFound(_0xdd2b5e,null))[_0x320a('0x24')](function(_0x2b6471){if(_0x2b6471){_0x3f94[_0x320a('0x33')]=_[_0x320a('0x35')](db[_0x320a('0x5b')][_0x320a('0x2f')]);_0x3f94[_0x320a('0x34')]=_['keys'](_0x1e4080[_0x320a('0x34')]);_0x3f94['filters']=_['intersection'](_0x3f94['model'],_0x3f94[_0x320a('0x34')]);_0x3b239d[_0x320a('0x37')]=_['intersection'](_0x3f94['model'],qs['fields'](_0x1e4080[_0x320a('0x34')][_0x320a('0x38')]));_0x3b239d[_0x320a('0x37')]=_0x3b239d[_0x320a('0x37')][_0x320a('0x39')]?_0x3b239d[_0x320a('0x37')]:_0x3f94[_0x320a('0x33')];if(!_0x1e4080[_0x320a('0x34')][_0x320a('0x5a')](_0x320a('0x3a'))){_0x3b239d[_0x320a('0x1c')]=qs[_0x320a('0x1c')](_0x1e4080[_0x320a('0x34')][_0x320a('0x1c')]);_0x3b239d[_0x320a('0x19')]=qs[_0x320a('0x19')](_0x1e4080[_0x320a('0x34')][_0x320a('0x19')]);}_0x3b239d[_0x320a('0x3b')]=qs[_0x320a('0x3c')](_0x1e4080[_0x320a('0x34')][_0x320a('0x3c')]);_0x3b239d[_0x320a('0x3d')]=qs[_0x320a('0x3e')](_[_0x320a('0x3f')](_0x1e4080[_0x320a('0x34')],_0x3f94[_0x320a('0x3e')]));_0x3b239d[_0x320a('0x3d')][_0x320a('0x5c')]=_0x2b6471['id'];if(_0x1e4080[_0x320a('0x34')][_0x320a('0x40')]){_0x3b239d['where']=_[_0x320a('0x51')](_0x3b239d[_0x320a('0x3d')],{'$or':_[_0x320a('0x2d')](_0x3b239d[_0x320a('0x37')],function(_0x404c34){var _0x4383fb={};_0x4383fb[_0x404c34]={'$like':'%'+_0x1e4080[_0x320a('0x34')][_0x320a('0x40')]+'%'};return _0x4383fb;})});}_0x3b239d=_['merge']({},_0x3b239d,_0x1e4080[_0x320a('0x47')]);return db[_0x320a('0x5b')]['count']({'where':_0x3b239d[_0x320a('0x3d')]})[_0x320a('0x24')](function(_0x2bf93b){_0x19a2d6[_0x320a('0x1b')]=_0x2bf93b;if(_0x1e4080['query'][_0x320a('0x42')]){_0x3b239d[_0x320a('0x43')]=[{'all':!![]}];}return db[_0x320a('0x5b')][_0x320a('0x5d')](_0x3b239d);})[_0x320a('0x24')](function(_0x2635b9){_0x19a2d6[_0x320a('0x5e')]=_0x2635b9;return _0x19a2d6;});}})['then'](respondWithFilteredResult(_0xdd2b5e,_0x3b239d))[_0x320a('0x44')](handleError(_0xdd2b5e,null));};exports[_0x320a('0x5f')]=function(_0x4fcffc,_0x5237a0,_0x1cd5c1){var _0x4fdfe1={'raw':!![],'where':{}};var _0x2d1d00={};var _0x3506ed={'count':0x0,'rows':[]};return db[_0x320a('0x2e')]['findOne']({'where':{'id':_0x4fcffc[_0x320a('0x46')]['id']}})[_0x320a('0x24')](handleEntityNotFound(_0x5237a0,null))[_0x320a('0x24')](function(_0xed6b90){if(_0xed6b90){_0x2d1d00[_0x320a('0x33')]=_[_0x320a('0x35')](db[_0x320a('0x60')][_0x320a('0x2f')]);_0x2d1d00[_0x320a('0x34')]=_['keys'](_0x4fcffc[_0x320a('0x34')]);_0x2d1d00[_0x320a('0x3e')]=_[_0x320a('0x36')](_0x2d1d00[_0x320a('0x33')],_0x2d1d00[_0x320a('0x34')]);_0x4fdfe1[_0x320a('0x37')]=_[_0x320a('0x36')](_0x2d1d00[_0x320a('0x33')],qs[_0x320a('0x38')](_0x4fcffc[_0x320a('0x34')][_0x320a('0x38')]));_0x4fdfe1[_0x320a('0x37')]=_0x4fdfe1['attributes'][_0x320a('0x39')]?_0x4fdfe1[_0x320a('0x37')]:_0x2d1d00[_0x320a('0x33')];if(!_0x4fcffc[_0x320a('0x34')][_0x320a('0x5a')](_0x320a('0x3a'))){_0x4fdfe1[_0x320a('0x1c')]=qs[_0x320a('0x1c')](_0x4fcffc[_0x320a('0x34')]['limit']);_0x4fdfe1['offset']=qs['offset'](_0x4fcffc['query']['offset']);}_0x4fdfe1[_0x320a('0x3b')]=qs[_0x320a('0x3c')](_0x4fcffc[_0x320a('0x34')][_0x320a('0x3c')]);_0x4fdfe1[_0x320a('0x3d')]=qs['filters'](_[_0x320a('0x3f')](_0x4fcffc['query'],_0x2d1d00[_0x320a('0x3e')]));_0x4fdfe1[_0x320a('0x3d')]['CampaignId']=_0xed6b90['id'];if(_0x4fcffc['query'][_0x320a('0x40')]){_0x4fdfe1[_0x320a('0x3d')]=_[_0x320a('0x51')](_0x4fdfe1[_0x320a('0x3d')],{'$or':_['map'](_0x4fdfe1[_0x320a('0x37')],function(_0x11bbf4){var _0x48fe4b={};_0x48fe4b[_0x11bbf4]={'$like':'%'+_0x4fcffc['query']['filter']+'%'};return _0x48fe4b;})});}_0x4fdfe1=_[_0x320a('0x51')]({},_0x4fdfe1,_0x4fcffc['options']);return db[_0x320a('0x60')][_0x320a('0x1b')]({'where':_0x4fdfe1[_0x320a('0x3d')]})[_0x320a('0x24')](function(_0x3e9574){_0x3506ed[_0x320a('0x1b')]=_0x3e9574;if(_0x4fcffc[_0x320a('0x34')][_0x320a('0x42')]){_0x4fdfe1[_0x320a('0x43')]=[{'all':!![]}];}return db[_0x320a('0x60')][_0x320a('0x5d')](_0x4fdfe1);})[_0x320a('0x24')](function(_0x3ebf0b){_0x3506ed['rows']=_0x3ebf0b;return _0x3506ed;});}})[_0x320a('0x24')](respondWithFilteredResult(_0x5237a0,_0x4fdfe1))[_0x320a('0x44')](handleError(_0x5237a0,null));};exports[_0x320a('0x61')]=function(_0x46be5a,_0x843a79,_0x503d22){var _0x257af5={'raw':!![],'where':{}};var _0x1e046b={};var _0x46e8d5={'count':0x0,'rows':[]};return db['Campaign']['findOne']({'where':{'id':_0x46be5a[_0x320a('0x46')]['id']}})['then'](handleEntityNotFound(_0x843a79,null))[_0x320a('0x24')](function(_0x2f67db){if(_0x2f67db){_0x1e046b[_0x320a('0x33')]=_['keys'](db[_0x320a('0x62')]['rawAttributes']);_0x1e046b[_0x320a('0x34')]=_[_0x320a('0x35')](_0x46be5a['query']);_0x1e046b[_0x320a('0x3e')]=_[_0x320a('0x36')](_0x1e046b[_0x320a('0x33')],_0x1e046b['query']);_0x257af5[_0x320a('0x37')]=_['intersection'](_0x1e046b[_0x320a('0x33')],qs['fields'](_0x46be5a[_0x320a('0x34')][_0x320a('0x38')]));_0x257af5[_0x320a('0x37')]=_0x257af5[_0x320a('0x37')][_0x320a('0x39')]?_0x257af5[_0x320a('0x37')]:_0x1e046b[_0x320a('0x33')];if(!_0x46be5a[_0x320a('0x34')]['hasOwnProperty'](_0x320a('0x3a'))){_0x257af5[_0x320a('0x1c')]=qs[_0x320a('0x1c')](_0x46be5a[_0x320a('0x34')]['limit']);_0x257af5[_0x320a('0x19')]=qs[_0x320a('0x19')](_0x46be5a['query']['offset']);}_0x257af5[_0x320a('0x3b')]=qs[_0x320a('0x3c')](_0x46be5a['query']['sort']);_0x257af5['where']=qs[_0x320a('0x3e')](_[_0x320a('0x3f')](_0x46be5a[_0x320a('0x34')],_0x1e046b[_0x320a('0x3e')]));_0x257af5[_0x320a('0x3d')][_0x320a('0x5c')]=_0x2f67db['id'];if(_0x46be5a[_0x320a('0x34')][_0x320a('0x40')]){_0x257af5[_0x320a('0x3d')]=_[_0x320a('0x51')](_0x257af5[_0x320a('0x3d')],{'$or':_[_0x320a('0x2d')](_0x257af5[_0x320a('0x37')],function(_0x562138){var _0x4d5d46={};_0x4d5d46[_0x562138]={'$like':'%'+_0x46be5a['query']['filter']+'%'};return _0x4d5d46;})});}_0x257af5=_['merge']({},_0x257af5,_0x46be5a[_0x320a('0x47')]);return db['CmHopperBlack'][_0x320a('0x1b')]({'where':_0x257af5['where']})[_0x320a('0x24')](function(_0x466788){_0x46e8d5[_0x320a('0x1b')]=_0x466788;if(_0x46be5a[_0x320a('0x34')][_0x320a('0x42')]){_0x257af5[_0x320a('0x43')]=[{'all':!![]}];}return db[_0x320a('0x62')]['findAll'](_0x257af5);})['then'](function(_0x8a0ca6){_0x46e8d5[_0x320a('0x5e')]=_0x8a0ca6;return _0x46e8d5;});}})[_0x320a('0x24')](respondWithFilteredResult(_0x843a79,_0x257af5))[_0x320a('0x44')](handleError(_0x843a79,null));};exports['getLists']=function(_0x4b6c7a,_0xcc8225,_0x5cab1f){var _0x1c2293={};var _0x5b9f0e={};var _0x25a0e3;var _0x50e7e9;return db[_0x320a('0x2e')][_0x320a('0x58')]({'where':{'id':_0x4b6c7a['params']['id']}})[_0x320a('0x24')](handleEntityNotFound(_0xcc8225,null))[_0x320a('0x24')](function(_0x40b992){if(_0x40b992){_0x25a0e3=_0x40b992;_0x5b9f0e[_0x320a('0x33')]=_[_0x320a('0x35')](db[_0x320a('0x63')][_0x320a('0x2f')]);_0x5b9f0e[_0x320a('0x34')]=_[_0x320a('0x35')](_0x4b6c7a[_0x320a('0x34')]);_0x5b9f0e[_0x320a('0x3e')]=_['intersection'](_0x5b9f0e[_0x320a('0x33')],_0x5b9f0e['query']);_0x1c2293[_0x320a('0x37')]=_[_0x320a('0x36')](_0x5b9f0e[_0x320a('0x33')],qs['fields'](_0x4b6c7a['query'][_0x320a('0x38')]));_0x1c2293[_0x320a('0x37')]=_0x1c2293[_0x320a('0x37')]['length']?_0x1c2293[_0x320a('0x37')]:_0x5b9f0e[_0x320a('0x33')];_0x1c2293['order']=qs[_0x320a('0x3c')](_0x4b6c7a['query'][_0x320a('0x3c')]);_0x1c2293[_0x320a('0x3d')]=qs[_0x320a('0x3e')](_[_0x320a('0x3f')](_0x4b6c7a[_0x320a('0x34')],_0x5b9f0e[_0x320a('0x3e')]));if(_0x4b6c7a['query'][_0x320a('0x40')]){_0x1c2293[_0x320a('0x3d')]=_[_0x320a('0x51')](_0x1c2293[_0x320a('0x3d')],{'$or':_[_0x320a('0x2d')](_0x1c2293['attributes'],function(_0x3bda28){var _0x36bf9f={};_0x36bf9f[_0x3bda28]={'$like':'%'+_0x4b6c7a['query'][_0x320a('0x40')]+'%'};return _0x36bf9f;})});}_0x1c2293=_[_0x320a('0x51')]({},_0x1c2293,_0x4b6c7a[_0x320a('0x47')]);return _0x25a0e3[_0x320a('0x64')](_0x1c2293);}})['then'](function(_0x242d3f){if(_0x242d3f){_0x50e7e9=_0x242d3f[_0x320a('0x39')];if(!_0x4b6c7a[_0x320a('0x34')][_0x320a('0x5a')](_0x320a('0x3a'))){_0x1c2293['limit']=qs['limit'](_0x4b6c7a[_0x320a('0x34')]['limit']);_0x1c2293[_0x320a('0x19')]=qs['offset'](_0x4b6c7a['query']['offset']);}return _0x25a0e3[_0x320a('0x64')](_0x1c2293);}})[_0x320a('0x24')](function(_0x20286e){if(_0x20286e){return _0x20286e?{'count':_0x50e7e9,'rows':_0x20286e}:null;}})[_0x320a('0x24')](respondWithResult(_0xcc8225,null))[_0x320a('0x44')](handleError(_0xcc8225,null));};exports[_0x320a('0x65')]=function(_0x6569a1,_0x511f17,_0x48f016){var _0x3ed4de,_0x23e70e;var _0x29b021=[];var _0x4f262f=moment()['format'](_0x320a('0x66'));return db[_0x320a('0x2e')][_0x320a('0x48')]({'where':{'id':_0x6569a1[_0x320a('0x46')]['id']}})[_0x320a('0x24')](handleEntityNotFound(_0x511f17,null))['then'](function(_0x431e4d){if(_0x431e4d){_0x23e70e=_0x431e4d;return _0x431e4d[_0x320a('0x65')](_0x6569a1[_0x320a('0x4a')]['ids'],_[_0x320a('0x52')](_0x6569a1['body'],[_0x320a('0x67'),'id'])||{});}return null;})['spread'](function(_0xf35daf){var _0x181627;var _0x218aa6;_0x3ed4de=_0xf35daf||[];var _0x1e8123=[];if(_0xf35daf){for(var _0x4ee444=0x0;_0x4ee444<_0xf35daf[_0x320a('0x39')];_0x4ee444+=0x1){var _0x3e2eba=_0xf35daf[_0x4ee444][_0x320a('0x25')]({'plain':!![]});_0x23e70e['dialCheckDuplicateType']=_0x6569a1['body'][_0x320a('0x68')]?_0x6569a1['body'][_0x320a('0x68')]:_0x23e70e[_0x320a('0x68')];switch(_0x23e70e['dialCheckDuplicateType']){case _0x320a('0x69'):_0x181627=squel[_0x320a('0x6a')]()[_0x320a('0x6b')](_0x320a('0x6c'))[_0x320a('0x6d')]([_0x320a('0x6e'),_0x320a('0x6f'),_0x320a('0x70'),_0x320a('0x71'),_0x320a('0x5c'),'createdAt','updatedAt'],squel['select']()[_0x320a('0x72')](_0x320a('0x6e'),'phone')[_0x320a('0x72')](_0x320a('0x73'),_0x320a('0x6f'))[_0x320a('0x72')]('id',_0x320a('0x70'))['field'](_0x3e2eba[_0x320a('0x74')]['toString'](),'ListId')[_0x320a('0x72')](_0x6569a1[_0x320a('0x46')]['id'][_0x320a('0x75')](),_0x320a('0x5c'))[_0x320a('0x72')]('\x27'+_0x4f262f+'\x27',_0x320a('0x53'))[_0x320a('0x72')]('\x27'+_0x4f262f+'\x27',_0x320a('0x54'))['from']('cm_contacts')['where'](_0x320a('0x76'))['where'](_0x320a('0x77'),_0x3e2eba[_0x320a('0x74')][_0x320a('0x75')]())[_0x320a('0x3d')](_0x320a('0x78'))[_0x320a('0x3d')](_0x320a('0x79'),squel['select']()[_0x320a('0x72')](_0x320a('0x7a'))[_0x320a('0x7b')](_0x320a('0x7c'))[_0x320a('0x3d')](_0x320a('0x7d'),_0x6569a1['params']['id']['toString']()))[_0x320a('0x3d')]('phone\x20NOT\x20IN\x20(?)',squel['select']()[_0x320a('0x72')](_0x320a('0x7e'))[_0x320a('0x7b')](_0x320a('0x6c'))['where'](_0x320a('0x7d'),_0x6569a1[_0x320a('0x46')]['id'][_0x320a('0x75')]())))[_0x320a('0x75')]();break;case _0x320a('0x7f'):_0x181627=squel[_0x320a('0x6a')]()[_0x320a('0x6b')](_0x320a('0x6c'))[_0x320a('0x6d')]([_0x320a('0x6e'),_0x320a('0x6f'),_0x320a('0x70'),_0x320a('0x71'),_0x320a('0x5c'),_0x320a('0x53'),'updatedAt'],squel[_0x320a('0x80')]()['field']('phone',_0x320a('0x6e'))['field']('NOW()',_0x320a('0x6f'))[_0x320a('0x72')]('id',_0x320a('0x70'))[_0x320a('0x72')](_0x3e2eba[_0x320a('0x74')]['toString'](),_0x320a('0x71'))[_0x320a('0x72')](_0x6569a1['params']['id'][_0x320a('0x75')](),_0x320a('0x5c'))[_0x320a('0x72')]('\x27'+_0x4f262f+'\x27','createdAt')[_0x320a('0x72')]('\x27'+_0x4f262f+'\x27',_0x320a('0x54'))['from']('cm_contacts')[_0x320a('0x3d')](_0x320a('0x76'))[_0x320a('0x3d')](_0x320a('0x77'),_0x3e2eba[_0x320a('0x74')]['toString']())[_0x320a('0x3d')](_0x320a('0x78'))['where'](_0x320a('0x79'),squel[_0x320a('0x80')]()[_0x320a('0x72')](_0x320a('0x7e'))['from'](_0x320a('0x6c'))[_0x320a('0x3d')](_0x320a('0x7d'),_0x6569a1[_0x320a('0x46')]['id'][_0x320a('0x75')]())))[_0x320a('0x75')]();break;default:_0x181627=squel[_0x320a('0x6a')]()[_0x320a('0x6b')](_0x320a('0x6c'))['fromQuery']([_0x320a('0x6e'),_0x320a('0x6f'),_0x320a('0x70'),_0x320a('0x71'),'CampaignId','createdAt',_0x320a('0x54')],squel['select']()[_0x320a('0x72')](_0x320a('0x6e'),_0x320a('0x6e'))['field']('NOW()','scheduledAt')[_0x320a('0x72')]('id',_0x320a('0x70'))['field'](_0x3e2eba[_0x320a('0x74')][_0x320a('0x75')](),_0x320a('0x71'))[_0x320a('0x72')](_0x6569a1['params']['id'][_0x320a('0x75')](),_0x320a('0x5c'))[_0x320a('0x72')]('\x27'+_0x4f262f+'\x27',_0x320a('0x53'))['field']('\x27'+_0x4f262f+'\x27',_0x320a('0x54'))['from'](_0x320a('0x81'))[_0x320a('0x3d')]('deletedAt\x20IS\x20NULL')[_0x320a('0x3d')](_0x320a('0x77'),_0x3e2eba[_0x320a('0x74')][_0x320a('0x75')]())['where']('phone\x20IS\x20NOT\x20NULL'))[_0x320a('0x75')]();}_0x218aa6=squel['insert']()['into'](_0x320a('0x82'))[_0x320a('0x6d')]([_0x320a('0x83'),_0x320a('0x6f'),'phone','OrderBy',_0x320a('0x53'),_0x320a('0x54')],squel[_0x320a('0x80')]()[_0x320a('0x72')]('h.id','id')['field'](_0x320a('0x73'),'scheduledAt')['field'](_0x320a('0x84'),_0x320a('0x6e'))[_0x320a('0x72')](_0x320a('0x85'),_0x320a('0x86'))[_0x320a('0x72')]('\x27'+_0x4f262f+'\x27',_0x320a('0x53'))['field']('\x27'+_0x4f262f+'\x27',_0x320a('0x54'))[_0x320a('0x7b')](_0x320a('0x87'),'ci')['join']('cm_hopper','h',_0x320a('0x88'))[_0x320a('0x3d')](_0x320a('0x89'),_0x3e2eba['CmListId'][_0x320a('0x75')]())[_0x320a('0x3d')](_0x320a('0x8a'),_0x6569a1[_0x320a('0x46')]['id'][_0x320a('0x75')]())['where']('h.createdAt\x20=\x20?',_0x4f262f))[_0x320a('0x75')]();_0x1e8123[_0x320a('0x8b')](db[_0x320a('0x8c')][_0x320a('0x34')](_0x181627));_0x29b021['push'](db[_0x320a('0x8c')]['query'](_0x218aa6));}return BPromise[_0x320a('0x8d')](_0x1e8123);}})[_0x320a('0x24')](function(){return BPromise[_0x320a('0x8d')](_0x29b021);})[_0x320a('0x24')](function(){return _0x3ed4de;})[_0x320a('0x24')](respondWithResult(_0x511f17,null))['catch'](handleError(_0x511f17,null));};exports[_0x320a('0x8e')]=function(_0x5d347e,_0x3c882c,_0x538b9f){return db[_0x320a('0x2e')]['find']({'where':{'id':_0x5d347e[_0x320a('0x46')]['id']}})[_0x320a('0x24')](handleEntityNotFound(_0x3c882c,null))[_0x320a('0x24')](function(_0x9052d7){if(_0x9052d7){return _0x9052d7[_0x320a('0x8e')](_0x5d347e[_0x320a('0x34')]['ids']);}})[_0x320a('0x24')](function(_0x47e688){if(_0x47e688){return db[_0x320a('0x59')][_0x320a('0x23')]({'where':{'ListId':_0x5d347e['query'][_0x320a('0x67')],'CampaignId':_0x5d347e[_0x320a('0x46')]['id']}})[_0x320a('0x24')](function(){return _0x47e688;});}})[_0x320a('0x24')](respondWithStatusCode(_0x3c882c,null))['catch'](handleError(_0x3c882c,null));};exports[_0x320a('0x8f')]=function(_0x5521e6,_0x1a88cf,_0x3d0132){var _0xfd9dd3={};var _0x31ab9c={};var _0x2ff6a4;var _0x477761;return db['Campaign'][_0x320a('0x58')]({'where':{'id':_0x5521e6['params']['id']}})[_0x320a('0x24')](handleEntityNotFound(_0x1a88cf,null))[_0x320a('0x24')](function(_0x33fb29){if(_0x33fb29){_0x2ff6a4=_0x33fb29;_0x31ab9c[_0x320a('0x33')]=_[_0x320a('0x35')](db[_0x320a('0x63')][_0x320a('0x2f')]);_0x31ab9c[_0x320a('0x34')]=_[_0x320a('0x35')](_0x5521e6[_0x320a('0x34')]);_0x31ab9c[_0x320a('0x3e')]=_[_0x320a('0x36')](_0x31ab9c[_0x320a('0x33')],_0x31ab9c[_0x320a('0x34')]);_0xfd9dd3[_0x320a('0x37')]=_['intersection'](_0x31ab9c[_0x320a('0x33')],qs[_0x320a('0x38')](_0x5521e6['query'][_0x320a('0x38')]));_0xfd9dd3[_0x320a('0x37')]=_0xfd9dd3[_0x320a('0x37')][_0x320a('0x39')]?_0xfd9dd3[_0x320a('0x37')]:_0x31ab9c[_0x320a('0x33')];_0xfd9dd3[_0x320a('0x3b')]=qs[_0x320a('0x3c')](_0x5521e6[_0x320a('0x34')][_0x320a('0x3c')]);_0xfd9dd3[_0x320a('0x3d')]=qs[_0x320a('0x3e')](_[_0x320a('0x3f')](_0x5521e6[_0x320a('0x34')],_0x31ab9c['filters']));if(_0x5521e6[_0x320a('0x34')][_0x320a('0x40')]){_0xfd9dd3[_0x320a('0x3d')]=_[_0x320a('0x51')](_0xfd9dd3[_0x320a('0x3d')],{'$or':_['map'](_0xfd9dd3['attributes'],function(_0x9bfa81){var _0x3b6af3={};_0x3b6af3[_0x9bfa81]={'$like':'%'+_0x5521e6['query'][_0x320a('0x40')]+'%'};return _0x3b6af3;})});}_0xfd9dd3=_[_0x320a('0x51')]({},_0xfd9dd3,_0x5521e6[_0x320a('0x47')]);return _0x2ff6a4[_0x320a('0x8f')](_0xfd9dd3);}})['then'](function(_0x365c1c){if(_0x365c1c){_0x477761=_0x365c1c[_0x320a('0x39')];if(!_0x5521e6[_0x320a('0x34')][_0x320a('0x5a')]('nolimit')){_0xfd9dd3[_0x320a('0x1c')]=qs['limit'](_0x5521e6[_0x320a('0x34')][_0x320a('0x1c')]);_0xfd9dd3['offset']=qs['offset'](_0x5521e6[_0x320a('0x34')]['offset']);}return _0x2ff6a4[_0x320a('0x8f')](_0xfd9dd3);}})[_0x320a('0x24')](function(_0x2c728c){if(_0x2c728c){return _0x2c728c?{'count':_0x477761,'rows':_0x2c728c}:null;}})[_0x320a('0x24')](respondWithResult(_0x1a88cf,null))[_0x320a('0x44')](handleError(_0x1a88cf,null));};exports[_0x320a('0x90')]=function(_0x10f737,_0x1c8ad2,_0xdc8083){var _0x3d8b57,_0x4122ba;var _0x1f7c92=[];var _0x16f2b1=moment()[_0x320a('0x91')](_0x320a('0x66'));return db[_0x320a('0x2e')][_0x320a('0x48')]({'where':{'id':_0x10f737['params']['id']}})[_0x320a('0x24')](handleEntityNotFound(_0x1c8ad2,null))[_0x320a('0x24')](function(_0xa645e5){if(_0xa645e5){_0x4122ba=_0xa645e5;return _0xa645e5[_0x320a('0x90')](_0x10f737[_0x320a('0x4a')][_0x320a('0x67')],_[_0x320a('0x52')](_0x10f737[_0x320a('0x4a')],[_0x320a('0x67'),'id'])||{});}return null;})['spread'](function(_0x68d8b0){var _0x858b7a;var _0x56d4d1;_0x3d8b57=_0x68d8b0||[];var _0x125c95=[];if(_0x68d8b0){for(var _0x19964b=0x0;_0x19964b<_0x68d8b0[_0x320a('0x39')];_0x19964b+=0x1){var _0x4bc12a=_0x68d8b0[_0x19964b]['get']({'plain':!![]});_0x858b7a=squel[_0x320a('0x6a')]()['into'](_0x320a('0x92'))[_0x320a('0x6d')]([_0x320a('0x6e'),_0x320a('0x70'),_0x320a('0x71'),_0x320a('0x5c'),_0x320a('0x53'),'updatedAt'],squel[_0x320a('0x80')]()[_0x320a('0x72')](_0x320a('0x6e'),_0x320a('0x6e'))['field']('id',_0x320a('0x70'))[_0x320a('0x72')](_0x4bc12a[_0x320a('0x74')][_0x320a('0x75')](),_0x320a('0x71'))[_0x320a('0x72')](_0x10f737[_0x320a('0x46')]['id'][_0x320a('0x75')](),_0x320a('0x5c'))['field'](_0x320a('0x73'),_0x320a('0x53'))[_0x320a('0x72')]('NOW()','updatedAt')[_0x320a('0x7b')](_0x320a('0x81'))['where'](_0x320a('0x76'))[_0x320a('0x3d')]('ListId\x20=\x20?',_0x4bc12a[_0x320a('0x74')][_0x320a('0x75')]())[_0x320a('0x3d')](_0x320a('0x78')))[_0x320a('0x75')]();_0x125c95[_0x320a('0x8b')](db[_0x320a('0x8c')][_0x320a('0x34')](_0x858b7a));}return BPromise[_0x320a('0x8d')](_0x125c95);}})[_0x320a('0x24')](function(){return _0x3d8b57;})[_0x320a('0x24')](respondWithResult(_0x1c8ad2,null))[_0x320a('0x44')](handleError(_0x1c8ad2,null));};exports[_0x320a('0x93')]=function(_0x4b90c8,_0xb47771,_0x3fbb42){return db[_0x320a('0x2e')][_0x320a('0x48')]({'where':{'id':_0x4b90c8[_0x320a('0x46')]['id']}})[_0x320a('0x24')](handleEntityNotFound(_0xb47771,null))[_0x320a('0x24')](function(_0xea3af5){if(_0xea3af5){return _0xea3af5['removeBlackLists'](_0x4b90c8[_0x320a('0x34')][_0x320a('0x67')]);}})['then'](function(_0xb1141a){if(_0xb1141a){return db[_0x320a('0x62')][_0x320a('0x23')]({'where':{'ListId':_0x4b90c8[_0x320a('0x34')]['ids'],'CampaignId':_0x4b90c8['params']['id']}})['then'](function(){return _0xb1141a;});}})[_0x320a('0x24')](respondWithStatusCode(_0xb47771,null))[_0x320a('0x44')](handleError(_0xb47771,null));}; \ No newline at end of file diff --git a/server/api/campaign/campaign.model.js b/server/api/campaign/campaign.model.js index 9d45f38..f503d92 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(_0x4db141,_0x74de9b){var _0x4e8b56=function(_0x2dc06f){while(--_0x2dc06f){_0x4db141['push'](_0x4db141['shift']());}};_0x4e8b56(++_0x74de9b);}(_0x7a54,0x106));var _0x47a5=function(_0x2b4202,_0x3cfca9){_0x2b4202=_0x2b4202-0x0;var _0x1cdf02=_0x7a54[_0x2b4202];return _0x1cdf02;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var logger=require(_0x47a5('0x2'))('api');var moment=require(_0x47a5('0x3'));var BPromise=require(_0x47a5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x47a5('0x5'));var rimraf=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var attributes=require(_0x47a5('0x8'));module[_0x47a5('0x9')]=function(_0x545a97,_0x3d5629){return _0x545a97['define'](_0x47a5('0xa'),attributes,{'tableName':_0x47a5('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9957=['exports','define','Campaign','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./campaign.attributes'];(function(_0x26f702,_0x3919bf){var _0x11417d=function(_0x1aa3e8){while(--_0x1aa3e8){_0x26f702['push'](_0x26f702['shift']());}};_0x11417d(++_0x3919bf);}(_0x9957,0x93));var _0x7995=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x9957[_0x6c993a];return _0x27f547;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var logger=require(_0x7995('0x2'))(_0x7995('0x3'));var moment=require('moment');var BPromise=require(_0x7995('0x4'));var rp=require(_0x7995('0x5'));var fs=require('fs');var path=require(_0x7995('0x6'));var rimraf=require(_0x7995('0x7'));var config=require('../../config/environment');var attributes=require(_0x7995('0x8'));module[_0x7995('0x9')]=function(_0x137b6b,_0x219534){return _0x137b6b[_0x7995('0xa')](_0x7995('0xb'),attributes,{'tableName':'campaigns','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/campaign/campaign.rpc.js b/server/api/campaign/campaign.rpc.js index 3056122..9b1e634 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 _0xc874=['request\x20sent','debug','stringify','error','code','message','result','GetCampaign','Campaign','findAll','options','raw','where','attributes','limit','include','map','model','then','catch','lodash','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','info','Campaign,\x20%s,\x20%s'];(function(_0x3bc697,_0xad172c){var _0x129871=function(_0x17563f){while(--_0x17563f){_0x3bc697['push'](_0x3bc697['shift']());}};_0x129871(++_0xad172c);}(_0xc874,0x154));var _0x4c87=function(_0x2c27ed,_0x5c50f0){_0x2c27ed=_0x2c27ed-0x0;var _0x597bd1=_0xc874[_0x2c27ed];return _0x597bd1;};'use strict';var _=require(_0x4c87('0x0'));var util=require('util');var moment=require(_0x4c87('0x1'));var BPromise=require(_0x4c87('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4c87('0x3'))['db'];var utils=require(_0x4c87('0x4'));var logger=require(_0x4c87('0x5'))('rpc');var config=require(_0x4c87('0x6'));var jayson=require(_0x4c87('0x7'));var client=jayson['client'][_0x4c87('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3dafe0,_0x30c939,_0xdc4a29){return new BPromise(function(_0x116649,_0x5b7720){return client[_0x4c87('0x9')](_0x3dafe0,_0xdc4a29)['then'](function(_0x384268){logger[_0x4c87('0xa')](_0x4c87('0xb'),_0x30c939,_0x4c87('0xc'));logger[_0x4c87('0xd')]('Campaign,\x20%s,\x20%s,\x20%s',_0x30c939,_0x4c87('0xc'),JSON[_0x4c87('0xe')](_0x384268));if(_0x384268['error']){if(_0x384268[_0x4c87('0xf')][_0x4c87('0x10')]===0x1f4){logger[_0x4c87('0xf')](_0x4c87('0xb'),_0x30c939,_0x384268[_0x4c87('0xf')]['message']);return _0x5b7720(_0x384268['error']['message']);}logger[_0x4c87('0xf')](_0x4c87('0xb'),_0x30c939,_0x384268[_0x4c87('0xf')][_0x4c87('0x11')]);return _0x116649(_0x384268[_0x4c87('0xf')][_0x4c87('0x11')]);}else{logger[_0x4c87('0xa')](_0x4c87('0xb'),_0x30c939,'request\x20sent');_0x116649(_0x384268[_0x4c87('0x12')][_0x4c87('0x11')]);}})['catch'](function(_0x575de5){logger[_0x4c87('0xf')](_0x4c87('0xb'),_0x30c939,_0x575de5);_0x5b7720(_0x575de5);});});}exports[_0x4c87('0x13')]=function(_0x547d92){var _0x428144=this;return new Promise(function(_0x561441,_0x9bc75f){return db[_0x4c87('0x14')][_0x4c87('0x15')]({'raw':_0x547d92[_0x4c87('0x16')]?_0x547d92['options'][_0x4c87('0x17')]===undefined?!![]:![]:!![],'where':_0x547d92[_0x4c87('0x16')]?_0x547d92[_0x4c87('0x16')][_0x4c87('0x18')]||null:null,'attributes':_0x547d92[_0x4c87('0x16')]?_0x547d92[_0x4c87('0x16')][_0x4c87('0x19')]||null:null,'limit':_0x547d92[_0x4c87('0x16')]?_0x547d92['options'][_0x4c87('0x1a')]||null:null,'include':_0x547d92[_0x4c87('0x16')]?_0x547d92['options'][_0x4c87('0x1b')]?_[_0x4c87('0x1c')](_0x547d92['options'][_0x4c87('0x1b')],function(_0x293754){return{'model':db[_0x293754[_0x4c87('0x1d')]],'as':_0x293754['as'],'attributes':_0x293754[_0x4c87('0x19')],'include':_0x293754['include']?_[_0x4c87('0x1c')](_0x293754[_0x4c87('0x1b')],function(_0x4525df){return{'model':db[_0x4525df[_0x4c87('0x1d')]],'as':_0x4525df['as'],'attributes':_0x4525df[_0x4c87('0x19')],'include':_0x4525df[_0x4c87('0x1b')]?_[_0x4c87('0x1c')](_0x4525df[_0x4c87('0x1b')],function(_0x4ca5fb){return{'model':db[_0x4ca5fb[_0x4c87('0x1d')]],'as':_0x4ca5fb['as'],'attributes':_0x4ca5fb['attributes']};}):[]};}):[]};}):[]:[]})[_0x4c87('0x1e')](function(_0x381af7){logger[_0x4c87('0xa')](_0x4c87('0x13'),_0x547d92);logger[_0x4c87('0xd')](_0x4c87('0x13'),_0x547d92,JSON['stringify'](_0x381af7));_0x561441(_0x381af7);})[_0x4c87('0x1f')](function(_0x23483e){logger[_0x4c87('0xf')](_0x4c87('0x13'),_0x23483e[_0x4c87('0x11')],_0x547d92);_0x9bc75f(_0x428144[_0x4c87('0xf')](0x1f4,_0x23483e[_0x4c87('0x11')]));});});}; \ No newline at end of file +var _0xb7fc=['include','map','model','lodash','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Campaign,\x20%s,\x20%s','debug','Campaign,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','GetCampaign','findAll','options','attributes','limit'];(function(_0x2aa0e7,_0x4e5145){var _0x1472c0=function(_0x4deaeb){while(--_0x4deaeb){_0x2aa0e7['push'](_0x2aa0e7['shift']());}};_0x1472c0(++_0x4e5145);}(_0xb7fc,0x1e3));var _0xcb7f=function(_0x1cbecb,_0x505e33){_0x1cbecb=_0x1cbecb-0x0;var _0x4112c4=_0xb7fc[_0x1cbecb];return _0x4112c4;};'use strict';var _=require(_0xcb7f('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xcb7f('0x1'));var rs=require(_0xcb7f('0x2'));var fs=require('fs');var Redis=require(_0xcb7f('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xcb7f('0x4'))(_0xcb7f('0x5'));var config=require(_0xcb7f('0x6'));var jayson=require(_0xcb7f('0x7'));var client=jayson[_0xcb7f('0x8')][_0xcb7f('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5059ca,_0x226ba8,_0x31de8e){return new BPromise(function(_0x1f8ba3,_0x4dde1f){return client[_0xcb7f('0xa')](_0x5059ca,_0x31de8e)[_0xcb7f('0xb')](function(_0x4d8d72){logger[_0xcb7f('0xc')](_0xcb7f('0xd'),_0x226ba8,'request\x20sent');logger[_0xcb7f('0xe')](_0xcb7f('0xf'),_0x226ba8,_0xcb7f('0x10'),JSON[_0xcb7f('0x11')](_0x4d8d72));if(_0x4d8d72[_0xcb7f('0x12')]){if(_0x4d8d72['error']['code']===0x1f4){logger[_0xcb7f('0x12')](_0xcb7f('0xd'),_0x226ba8,_0x4d8d72[_0xcb7f('0x12')][_0xcb7f('0x13')]);return _0x4dde1f(_0x4d8d72[_0xcb7f('0x12')][_0xcb7f('0x13')]);}logger[_0xcb7f('0x12')](_0xcb7f('0xd'),_0x226ba8,_0x4d8d72[_0xcb7f('0x12')][_0xcb7f('0x13')]);return _0x1f8ba3(_0x4d8d72[_0xcb7f('0x12')][_0xcb7f('0x13')]);}else{logger[_0xcb7f('0xc')](_0xcb7f('0xd'),_0x226ba8,_0xcb7f('0x10'));_0x1f8ba3(_0x4d8d72[_0xcb7f('0x14')][_0xcb7f('0x13')]);}})[_0xcb7f('0x15')](function(_0x2c2799){logger[_0xcb7f('0x12')](_0xcb7f('0xd'),_0x226ba8,_0x2c2799);_0x4dde1f(_0x2c2799);});});}exports[_0xcb7f('0x16')]=function(_0x5d43b6){var _0x2430b3=this;return new Promise(function(_0x1d1d4c,_0x57274b){return db['Campaign'][_0xcb7f('0x17')]({'raw':_0x5d43b6[_0xcb7f('0x18')]?_0x5d43b6[_0xcb7f('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x5d43b6['options']?_0x5d43b6[_0xcb7f('0x18')]['where']||null:null,'attributes':_0x5d43b6['options']?_0x5d43b6['options'][_0xcb7f('0x19')]||null:null,'limit':_0x5d43b6[_0xcb7f('0x18')]?_0x5d43b6['options'][_0xcb7f('0x1a')]||null:null,'include':_0x5d43b6[_0xcb7f('0x18')]?_0x5d43b6[_0xcb7f('0x18')][_0xcb7f('0x1b')]?_[_0xcb7f('0x1c')](_0x5d43b6[_0xcb7f('0x18')]['include'],function(_0x588a4b){return{'model':db[_0x588a4b[_0xcb7f('0x1d')]],'as':_0x588a4b['as'],'attributes':_0x588a4b[_0xcb7f('0x19')],'include':_0x588a4b[_0xcb7f('0x1b')]?_[_0xcb7f('0x1c')](_0x588a4b[_0xcb7f('0x1b')],function(_0x2a1a8c){return{'model':db[_0x2a1a8c['model']],'as':_0x2a1a8c['as'],'attributes':_0x2a1a8c[_0xcb7f('0x19')],'include':_0x2a1a8c[_0xcb7f('0x1b')]?_[_0xcb7f('0x1c')](_0x2a1a8c['include'],function(_0x30ecb7){return{'model':db[_0x30ecb7[_0xcb7f('0x1d')]],'as':_0x30ecb7['as'],'attributes':_0x30ecb7[_0xcb7f('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x8879a1){logger['info'](_0xcb7f('0x16'),_0x5d43b6);logger['debug'](_0xcb7f('0x16'),_0x5d43b6,JSON[_0xcb7f('0x11')](_0x8879a1));_0x1d1d4c(_0x8879a1);})['catch'](function(_0x597a82){logger['error'](_0xcb7f('0x16'),_0x597a82[_0xcb7f('0x13')],_0x5d43b6);_0x57274b(_0x2430b3['error'](0x1f4,_0x597a82[_0xcb7f('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/campaign/index.js b/server/api/campaign/index.js index ac59022..cad6504 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 _0x5640=['/:id/hoppers','getHoppers','/:id/hopper_histories','getHopperHistories','/:id/hopper_finals','getHopperBlacks','/:id/lists','getLists','getBlackLists','post','create','/:id/clone','clone','addLists','/:id/blacklists','put','update','delete','destroy','removeLists','removeBlackLists','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./campaign.controller','isAuthenticated','get','/:id','show'];(function(_0x618414,_0x1a7a60){var _0x21c19a=function(_0x507b17){while(--_0x507b17){_0x618414['push'](_0x618414['shift']());}};_0x21c19a(++_0x1a7a60);}(_0x5640,0x7f));var _0x0564=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x5640[_0x17d9e3];return _0x14192d;};'use strict';var multer=require(_0x0564('0x0'));var util=require(_0x0564('0x1'));var path=require(_0x0564('0x2'));var timeout=require(_0x0564('0x3'));var express=require(_0x0564('0x4'));var router=express[_0x0564('0x5')]();var fs_extra=require(_0x0564('0x6'));var auth=require(_0x0564('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x0564('0x8'));router['get']('/',auth[_0x0564('0x9')](),controller['index']);router[_0x0564('0xa')](_0x0564('0xb'),auth[_0x0564('0x9')](),controller[_0x0564('0xc')]);router[_0x0564('0xa')](_0x0564('0xd'),auth['isAuthenticated'](),controller[_0x0564('0xe')]);router[_0x0564('0xa')](_0x0564('0xf'),auth[_0x0564('0x9')](),controller[_0x0564('0x10')]);router['get'](_0x0564('0x11'),auth[_0x0564('0x9')](),controller['getHopperFinals']);router['get']('/:id/hopper_black',auth['isAuthenticated'](),controller[_0x0564('0x12')]);router[_0x0564('0xa')](_0x0564('0x13'),auth[_0x0564('0x9')](),controller[_0x0564('0x14')]);router[_0x0564('0xa')]('/:id/blacklists',auth[_0x0564('0x9')](),controller[_0x0564('0x15')]);router[_0x0564('0x16')]('/',auth[_0x0564('0x9')](),controller[_0x0564('0x17')]);router['post'](_0x0564('0x18'),auth[_0x0564('0x9')](),controller[_0x0564('0x19')]);router[_0x0564('0x16')](_0x0564('0x13'),auth[_0x0564('0x9')](),controller[_0x0564('0x1a')]);router['post'](_0x0564('0x1b'),auth[_0x0564('0x9')](),controller['addBlackLists']);router[_0x0564('0x1c')]('/:id',auth['isAuthenticated'](),controller[_0x0564('0x1d')]);router[_0x0564('0x1e')](_0x0564('0xb'),auth[_0x0564('0x9')](),controller[_0x0564('0x1f')]);router['delete'](_0x0564('0x13'),auth[_0x0564('0x9')](),controller[_0x0564('0x20')]);router[_0x0564('0x1e')](_0x0564('0x1b'),auth['isAuthenticated'](),controller[_0x0564('0x21')]);module[_0x0564('0x22')]=router; \ No newline at end of file +var _0x2c81=['removeLists','removeBlackLists','exports','multer','util','express','fs-extra','../../components/interaction/service','../../config/environment','./campaign.controller','isAuthenticated','index','get','/:id','show','/:id/hoppers','getHoppers','/:id/hopper_histories','/:id/hopper_finals','/:id/hopper_black','getHopperBlacks','/:id/lists','getLists','/:id/blacklists','getBlackLists','post','create','/:id/clone','addLists','addBlackLists','put','delete','destroy'];(function(_0x134c2e,_0x3573c4){var _0x2825db=function(_0x2a574d){while(--_0x2a574d){_0x134c2e['push'](_0x134c2e['shift']());}};_0x2825db(++_0x3573c4);}(_0x2c81,0x1d1));var _0x12c8=function(_0x39390d,_0x32eb2a){_0x39390d=_0x39390d-0x0;var _0x55a311=_0x2c81[_0x39390d];return _0x55a311;};'use strict';var multer=require(_0x12c8('0x0'));var util=require(_0x12c8('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x12c8('0x2'));var router=express['Router']();var fs_extra=require(_0x12c8('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x12c8('0x4'));var config=require(_0x12c8('0x5'));var controller=require(_0x12c8('0x6'));router['get']('/',auth[_0x12c8('0x7')](),controller[_0x12c8('0x8')]);router[_0x12c8('0x9')](_0x12c8('0xa'),auth[_0x12c8('0x7')](),controller[_0x12c8('0xb')]);router[_0x12c8('0x9')](_0x12c8('0xc'),auth[_0x12c8('0x7')](),controller[_0x12c8('0xd')]);router[_0x12c8('0x9')](_0x12c8('0xe'),auth['isAuthenticated'](),controller['getHopperHistories']);router[_0x12c8('0x9')](_0x12c8('0xf'),auth[_0x12c8('0x7')](),controller['getHopperFinals']);router[_0x12c8('0x9')](_0x12c8('0x10'),auth[_0x12c8('0x7')](),controller[_0x12c8('0x11')]);router['get'](_0x12c8('0x12'),auth[_0x12c8('0x7')](),controller[_0x12c8('0x13')]);router[_0x12c8('0x9')](_0x12c8('0x14'),auth[_0x12c8('0x7')](),controller[_0x12c8('0x15')]);router[_0x12c8('0x16')]('/',auth[_0x12c8('0x7')](),controller[_0x12c8('0x17')]);router[_0x12c8('0x16')](_0x12c8('0x18'),auth['isAuthenticated'](),controller['clone']);router[_0x12c8('0x16')]('/:id/lists',auth['isAuthenticated'](),controller[_0x12c8('0x19')]);router[_0x12c8('0x16')](_0x12c8('0x14'),auth[_0x12c8('0x7')](),controller[_0x12c8('0x1a')]);router[_0x12c8('0x1b')]('/:id',auth[_0x12c8('0x7')](),controller['update']);router[_0x12c8('0x1c')](_0x12c8('0xa'),auth[_0x12c8('0x7')](),controller[_0x12c8('0x1d')]);router[_0x12c8('0x1c')](_0x12c8('0x12'),auth[_0x12c8('0x7')](),controller[_0x12c8('0x1e')]);router[_0x12c8('0x1c')](_0x12c8('0x14'),auth[_0x12c8('0x7')](),controller[_0x12c8('0x1f')]);module[_0x12c8('0x20')]=router; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.attributes.js b/server/api/cannedAnswer/cannedAnswer.attributes.js index db1d627..ba2f04f 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 _0xa3fc=['sequelize','exports','STRING','TEXT','medium','VIRTUAL','getDataValue'];(function(_0x1f9d6c,_0x27aba7){var _0x911504=function(_0x1c5353){while(--_0x1c5353){_0x1f9d6c['push'](_0x1f9d6c['shift']());}};_0x911504(++_0x27aba7);}(_0xa3fc,0x1b2));var _0xca3f=function(_0xfe2e05,_0x21d317){_0xfe2e05=_0xfe2e05-0x0;var _0x322f62=_0xa3fc[_0xfe2e05];return _0x322f62;};'use strict';var Sequelize=require(_0xca3f('0x0'));module[_0xca3f('0x1')]={'key':{'type':Sequelize[_0xca3f('0x2')],'allowNull':![]},'value':{'type':Sequelize[_0xca3f('0x3')],'length':_0xca3f('0x4'),'allowNull':![]},'description':{'type':Sequelize['STRING']},'name':{'type':Sequelize[_0xca3f('0x5')],'get':function(){return this[_0xca3f('0x6')]('key');}}}; \ No newline at end of file +var _0x0a40=['exports','STRING','medium','VIRTUAL','key','sequelize'];(function(_0x3d6b07,_0x3054af){var _0x3657a1=function(_0x267a77){while(--_0x267a77){_0x3d6b07['push'](_0x3d6b07['shift']());}};_0x3657a1(++_0x3054af);}(_0x0a40,0x1e5));var _0x00a4=function(_0x224a21,_0x2a65e2){_0x224a21=_0x224a21-0x0;var _0xea2db1=_0x0a40[_0x224a21];return _0xea2db1;};'use strict';var Sequelize=require(_0x00a4('0x0'));module[_0x00a4('0x1')]={'key':{'type':Sequelize[_0x00a4('0x2')],'allowNull':![]},'value':{'type':Sequelize['TEXT'],'length':_0x00a4('0x3'),'allowNull':![]},'description':{'type':Sequelize['STRING']},'name':{'type':Sequelize[_0x00a4('0x4')],'get':function(){return this['getDataValue'](_0x00a4('0x5'));}}}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.controller.js b/server/api/cannedAnswer/cannedAnswer.controller.js index 7b408c2..c07726a 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 _0x2509=['util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../mysqldb','sendStatus','status','json','undefined','offset','count','limit','set','Content-Range','apply','reject','update','then','destroy','get','CannedAnswers','UserProfileResource','end','error','stack','name','send','map','CannedAnswer','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','pick','filter','merge','includeAll','rows','catch','params','length','options','find','body','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','Sequelize','ValidationError','The\x20inserted\x20key\x20already\x20exists.','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache'];(function(_0x283023,_0x3cf4dc){var _0x1a1e78=function(_0x267af3){while(--_0x267af3){_0x283023['push'](_0x283023['shift']());}};_0x1a1e78(++_0x3cf4dc);}(_0x2509,0xa8));var _0x9250=function(_0x497e9e,_0x36e053){_0x497e9e=_0x497e9e-0x0;var _0x2aaf55=_0x2509[_0x497e9e];return _0x2aaf55;};'use strict';var emlformat=require(_0x9250('0x0'));var rimraf=require(_0x9250('0x1'));var zipdir=require(_0x9250('0x2'));var jsonpatch=require(_0x9250('0x3'));var rp=require(_0x9250('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x9250('0x5'));var util=require(_0x9250('0x6'));var path=require(_0x9250('0x7'));var sox=require(_0x9250('0x8'));var csv=require(_0x9250('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9250('0xa'));var _=require(_0x9250('0xb'));var squel=require(_0x9250('0xc'));var crypto=require(_0x9250('0xd'));var jsforce=require(_0x9250('0xe'));var deskjs=require(_0x9250('0xf'));var toCsv=require(_0x9250('0x9'));var querystring=require('querystring');var Papa=require(_0x9250('0x10'));var Redis=require(_0x9250('0x11'));var authService=require(_0x9250('0x12'));var qs=require(_0x9250('0x13'));var as=require(_0x9250('0x14'));var hardwareService=require(_0x9250('0x15'));var logger=require('../../config/logger')(_0x9250('0x16'));var utils=require('../../config/utils');var config=require(_0x9250('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x9250('0x18'))['db'];function respondWithStatusCode(_0xf6ed3e,_0x283b7a){_0x283b7a=_0x283b7a||0xcc;return function(_0x4f0002){if(_0x4f0002){return _0xf6ed3e[_0x9250('0x19')](_0x283b7a);}return _0xf6ed3e['status'](_0x283b7a)['end']();};}function respondWithResult(_0x279607,_0x2084b0){_0x2084b0=_0x2084b0||0xc8;return function(_0x446520){if(_0x446520){return _0x279607[_0x9250('0x1a')](_0x2084b0)[_0x9250('0x1b')](_0x446520);}};}function respondWithFilteredResult(_0xad4788,_0x217a0a){return function(_0xf76576){if(_0xf76576){var _0x176f0e=typeof _0x217a0a['offset']===_0x9250('0x1c')&&typeof _0x217a0a['limit']===_0x9250('0x1c');var _0xb33677=_0xf76576['count'];var _0x3415a5=_0x176f0e?0x0:_0x217a0a[_0x9250('0x1d')];var _0x4acf86=_0x176f0e?_0xf76576[_0x9250('0x1e')]:_0x217a0a[_0x9250('0x1d')]+_0x217a0a[_0x9250('0x1f')];var _0x1bef41;if(_0x4acf86>=_0xb33677){_0x4acf86=_0xb33677;_0x1bef41=0xc8;}else{_0x1bef41=0xce;}_0xad4788[_0x9250('0x1a')](_0x1bef41);return _0xad4788[_0x9250('0x20')](_0x9250('0x21'),_0x3415a5+'-'+_0x4acf86+'/'+_0xb33677)[_0x9250('0x1b')](_0xf76576);}return null;};}function patchUpdates(_0x19a35f){return function(_0x32efa7){try{jsonpatch[_0x9250('0x22')](_0x32efa7,_0x19a35f,!![]);}catch(_0x2f05c1){return BPromise[_0x9250('0x23')](_0x2f05c1);}return _0x32efa7['save']();};}function saveUpdates(_0x3ff395,_0x4d93a4){return function(_0x32c339){if(_0x32c339){return _0x32c339[_0x9250('0x24')](_0x3ff395)[_0x9250('0x25')](function(_0x2f9805){return _0x2f9805;});}return null;};}function removeEntity(_0x5b21ee,_0xd62324){return function(_0x3e3d90){if(_0x3e3d90){return _0x3e3d90[_0x9250('0x26')]()[_0x9250('0x25')](function(){var _0x1f4c83=_0x3e3d90[_0x9250('0x27')]({'plain':!![]});var _0x403d6f=_0x9250('0x28');return db[_0x9250('0x29')][_0x9250('0x26')]({'where':{'type':_0x403d6f,'resourceId':_0x1f4c83['id']}})[_0x9250('0x25')](function(){return _0x3e3d90;});})[_0x9250('0x25')](function(){_0x5b21ee['status'](0xcc)[_0x9250('0x2a')]();});}};}function handleEntityNotFound(_0x28ccfd,_0x4fd07){return function(_0x413280){if(!_0x413280){_0x28ccfd['sendStatus'](0x194);}return _0x413280;};}function handleError(_0x55e97b,_0x44d094){_0x44d094=_0x44d094||0x1f4;return function(_0x50aa8b){logger[_0x9250('0x2b')](_0x50aa8b[_0x9250('0x2c')]);if(_0x50aa8b['name']){delete _0x50aa8b[_0x9250('0x2d')];}_0x55e97b[_0x9250('0x1a')](_0x44d094)[_0x9250('0x2e')](_0x50aa8b);};}exports['index']=function(_0x2cd131,_0x453b10){var _0x53b1c3={},_0x1b8892={},_0x4dc64f={'count':0x0,'rows':[]};var _0x394dce=_[_0x9250('0x2f')](db[_0x9250('0x30')][_0x9250('0x31')],function(_0x10fb2c){return{'name':_0x10fb2c['fieldName'],'type':_0x10fb2c[_0x9250('0x32')][_0x9250('0x33')]};});_0x1b8892[_0x9250('0x34')]=_[_0x9250('0x2f')](_0x394dce,_0x9250('0x2d'));_0x1b8892[_0x9250('0x35')]=_[_0x9250('0x36')](_0x2cd131[_0x9250('0x35')]);_0x1b8892[_0x9250('0x37')]=_[_0x9250('0x38')](_0x1b8892[_0x9250('0x34')],_0x1b8892[_0x9250('0x35')]);_0x53b1c3[_0x9250('0x39')]=_['intersection'](_0x1b8892[_0x9250('0x34')],qs[_0x9250('0x3a')](_0x2cd131['query']['fields']));_0x53b1c3[_0x9250('0x39')]=_0x53b1c3[_0x9250('0x39')]['length']?_0x53b1c3[_0x9250('0x39')]:_0x1b8892[_0x9250('0x34')];if(!_0x2cd131[_0x9250('0x35')][_0x9250('0x3b')]('nolimit')){_0x53b1c3[_0x9250('0x1f')]=qs['limit'](_0x2cd131[_0x9250('0x35')][_0x9250('0x1f')]);_0x53b1c3[_0x9250('0x1d')]=qs[_0x9250('0x1d')](_0x2cd131['query'][_0x9250('0x1d')]);}_0x53b1c3[_0x9250('0x3c')]=qs[_0x9250('0x3d')](_0x2cd131[_0x9250('0x35')][_0x9250('0x3d')]);_0x53b1c3[_0x9250('0x3e')]=qs[_0x9250('0x37')](_[_0x9250('0x3f')](_0x2cd131[_0x9250('0x35')],_0x1b8892['filters']),_0x394dce);if(_0x2cd131['query']['filter']){_0x53b1c3['where']=_['merge'](_0x53b1c3[_0x9250('0x3e')],{'$or':[{'key':{'$like':'%'+_0x2cd131[_0x9250('0x35')][_0x9250('0x40')]+'%'}},{'value':{'$like':'%'+_0x2cd131[_0x9250('0x35')]['filter']+'%'}}]});}_0x53b1c3=_[_0x9250('0x41')]({},_0x53b1c3,_0x2cd131['options']);var _0x24fbff={'where':_0x53b1c3[_0x9250('0x3e')]};return db[_0x9250('0x30')][_0x9250('0x1e')](_0x24fbff)[_0x9250('0x25')](function(_0x7f6c5d){_0x4dc64f[_0x9250('0x1e')]=_0x7f6c5d;if(_0x2cd131[_0x9250('0x35')][_0x9250('0x42')]){_0x53b1c3['include']=[{'all':!![]}];}return db['CannedAnswer']['findAll'](_0x53b1c3);})[_0x9250('0x25')](function(_0x23839d){_0x4dc64f[_0x9250('0x43')]=_0x23839d;return _0x4dc64f;})[_0x9250('0x25')](respondWithFilteredResult(_0x453b10,_0x53b1c3))[_0x9250('0x44')](handleError(_0x453b10,null));};exports['show']=function(_0x4d8e56,_0x35b123){var _0x1997e8={'raw':!![],'where':{'id':_0x4d8e56[_0x9250('0x45')]['id']}},_0x5c8493={};_0x5c8493['model']=_[_0x9250('0x36')](db[_0x9250('0x30')][_0x9250('0x31')]);_0x5c8493[_0x9250('0x35')]=_[_0x9250('0x36')](_0x4d8e56[_0x9250('0x35')]);_0x5c8493[_0x9250('0x37')]=_[_0x9250('0x38')](_0x5c8493[_0x9250('0x34')],_0x5c8493[_0x9250('0x35')]);_0x1997e8[_0x9250('0x39')]=_[_0x9250('0x38')](_0x5c8493[_0x9250('0x34')],qs[_0x9250('0x3a')](_0x4d8e56[_0x9250('0x35')][_0x9250('0x3a')]));_0x1997e8[_0x9250('0x39')]=_0x1997e8[_0x9250('0x39')][_0x9250('0x46')]?_0x1997e8[_0x9250('0x39')]:_0x5c8493[_0x9250('0x34')];if(_0x4d8e56['query'][_0x9250('0x42')]){_0x1997e8['include']=[{'all':!![]}];}_0x1997e8=_['merge']({},_0x1997e8,_0x4d8e56[_0x9250('0x47')]);return db[_0x9250('0x30')][_0x9250('0x48')](_0x1997e8)[_0x9250('0x25')](handleEntityNotFound(_0x35b123,null))[_0x9250('0x25')](respondWithResult(_0x35b123,null))[_0x9250('0x44')](handleError(_0x35b123,null));};exports[_0x9250('0x24')]=function(_0x315895,_0x2b3a0){if(_0x315895[_0x9250('0x49')]['id']){delete _0x315895[_0x9250('0x49')]['id'];}return db[_0x9250('0x30')]['find']({'where':{'id':_0x315895['params']['id']}})[_0x9250('0x25')](handleEntityNotFound(_0x2b3a0,null))[_0x9250('0x25')](saveUpdates(_0x315895[_0x9250('0x49')],null))['then'](respondWithResult(_0x2b3a0,null))[_0x9250('0x44')](handleError(_0x2b3a0,null));};exports[_0x9250('0x26')]=function(_0xc87e95,_0x3455aa){return db[_0x9250('0x30')][_0x9250('0x48')]({'where':{'id':_0xc87e95['params']['id']}})['then'](handleEntityNotFound(_0x3455aa,null))[_0x9250('0x25')](removeEntity(_0x3455aa,null))[_0x9250('0x44')](handleError(_0x3455aa,null));};exports['create']=function(_0x527a7b,_0x554ae9){var _0x16f5cc={'key':_0x527a7b[_0x9250('0x49')]['key']};if(_0x527a7b[_0x9250('0x49')][_0x9250('0x4a')]){_0x16f5cc[_0x9250('0x4a')]=_0x527a7b[_0x9250('0x49')]['MailAccountId'];}else if(_0x527a7b[_0x9250('0x49')][_0x9250('0x4b')]){_0x16f5cc[_0x9250('0x4b')]=_0x527a7b[_0x9250('0x49')][_0x9250('0x4b')];}else if(_0x527a7b[_0x9250('0x49')]['OpenchannelAccountId']){_0x16f5cc['OpenchannelAccountId']=_0x527a7b['body'][_0x9250('0x4c')];}else if(_0x527a7b['body']['ChatWebsiteId']){_0x16f5cc['ChatWebsiteId']=_0x527a7b['body'][_0x9250('0x4d')];}return db[_0x9250('0x30')][_0x9250('0x48')]({'where':_0x16f5cc})[_0x9250('0x25')](function(_0x343c61){if(_0x343c61){throw new db[(_0x9250('0x4e'))][(_0x9250('0x4f'))](_0x9250('0x50'));}return db[_0x9250('0x30')][_0x9250('0x51')](_0x527a7b['body']);})['then'](function(_0xcb5755){var _0x8224db=_0x527a7b[_0x9250('0x52')][_0x9250('0x27')]({'plain':!![]});if(!_0x8224db)throw new Error(_0x9250('0x53'));if(_0x8224db['role']===_0x9250('0x52')){var _0x51a8d4=_0xcb5755[_0x9250('0x27')]({'plain':!![]});return db[_0x9250('0x54')][_0x9250('0x48')]({'where':{'name':_0x9250('0x28'),'userProfileId':_0x8224db[_0x9250('0x55')]},'raw':!![]})[_0x9250('0x25')](function(_0xcbb50d){if(_0xcbb50d&&_0xcbb50d[_0x9250('0x56')]===0x0){return db[_0x9250('0x29')][_0x9250('0x51')]({'name':_0x51a8d4[_0x9250('0x2d')],'resourceId':_0x51a8d4['id'],'type':_0xcbb50d[_0x9250('0x2d')],'sectionId':_0xcbb50d['id']},{})['then'](function(){return _0xcb5755;});}else{return _0xcb5755;}})['catch'](function(_0x7b9ab0){logger[_0x9250('0x2b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x7b9ab0);throw _0x7b9ab0;});}return _0xcb5755;})[_0x9250('0x25')](respondWithResult(_0x554ae9,0xc9))[_0x9250('0x44')](handleError(_0x554ae9,null));}; \ No newline at end of file +var _0x8d42=['order','sort','filter','merge','where','includeAll','include','findAll','rows','catch','show','params','options','find','update','body','create','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','Sequelize','ValidationError','The\x20inserted\x20key\x20already\x20exists.','user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','fast-json-patch','moment','mustache','util','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','limit','undefined','count','offset','apply','reject','save','destroy','then','get','CannedAnswers','sendStatus','stack','name','send','CannedAnswer','rawAttributes','fieldName','type','key','map','keys','query','filters','intersection','attributes','model','fields','hasOwnProperty','nolimit'];(function(_0x40f378,_0x4d39ec){var _0x2e42f6=function(_0x3c0996){while(--_0x3c0996){_0x40f378['push'](_0x40f378['shift']());}};_0x2e42f6(++_0x4d39ec);}(_0x8d42,0x184));var _0x28d4=function(_0x3e112d,_0x2bb132){_0x3e112d=_0x3e112d-0x0;var _0x531c31=_0x8d42[_0x3e112d];return _0x531c31;};'use strict';var emlformat=require(_0x28d4('0x0'));var rimraf=require(_0x28d4('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x28d4('0x2'));var rp=require('request-promise');var moment=require(_0x28d4('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x28d4('0x4'));var util=require(_0x28d4('0x5'));var path=require('path');var sox=require(_0x28d4('0x6'));var csv=require(_0x28d4('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x28d4('0x8'));var _=require(_0x28d4('0x9'));var squel=require(_0x28d4('0xa'));var crypto=require(_0x28d4('0xb'));var jsforce=require(_0x28d4('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x28d4('0xd'));var Papa=require(_0x28d4('0xe'));var Redis=require(_0x28d4('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x28d4('0x10'));var as=require(_0x28d4('0x11'));var hardwareService=require(_0x28d4('0x12'));var logger=require('../../config/logger')(_0x28d4('0x13'));var utils=require(_0x28d4('0x14'));var config=require(_0x28d4('0x15'));var licenseUtil=require(_0x28d4('0x16'));var db=require(_0x28d4('0x17'))['db'];function respondWithStatusCode(_0x58e7fe,_0x54ae29){_0x54ae29=_0x54ae29||0xcc;return function(_0x1a708c){if(_0x1a708c){return _0x58e7fe['sendStatus'](_0x54ae29);}return _0x58e7fe[_0x28d4('0x18')](_0x54ae29)[_0x28d4('0x19')]();};}function respondWithResult(_0x41ec1c,_0x6395aa){_0x6395aa=_0x6395aa||0xc8;return function(_0x17f9fd){if(_0x17f9fd){return _0x41ec1c[_0x28d4('0x18')](_0x6395aa)[_0x28d4('0x1a')](_0x17f9fd);}};}function respondWithFilteredResult(_0x45b8e5,_0x3a738b){return function(_0x4f386c){if(_0x4f386c){var _0x438eb6=typeof _0x3a738b['offset']==='undefined'&&typeof _0x3a738b[_0x28d4('0x1b')]===_0x28d4('0x1c');var _0x68a363=_0x4f386c[_0x28d4('0x1d')];var _0xe86166=_0x438eb6?0x0:_0x3a738b['offset'];var _0x16acac=_0x438eb6?_0x4f386c['count']:_0x3a738b[_0x28d4('0x1e')]+_0x3a738b['limit'];var _0x5b8c5e;if(_0x16acac>=_0x68a363){_0x16acac=_0x68a363;_0x5b8c5e=0xc8;}else{_0x5b8c5e=0xce;}_0x45b8e5[_0x28d4('0x18')](_0x5b8c5e);return _0x45b8e5['set']('Content-Range',_0xe86166+'-'+_0x16acac+'/'+_0x68a363)['json'](_0x4f386c);}return null;};}function patchUpdates(_0xb19687){return function(_0x51f11a){try{jsonpatch[_0x28d4('0x1f')](_0x51f11a,_0xb19687,!![]);}catch(_0x2368dc){return BPromise[_0x28d4('0x20')](_0x2368dc);}return _0x51f11a[_0x28d4('0x21')]();};}function saveUpdates(_0x46dd90,_0x125110){return function(_0x514748){if(_0x514748){return _0x514748['update'](_0x46dd90)['then'](function(_0x4c334f){return _0x4c334f;});}return null;};}function removeEntity(_0x2f2cf3,_0x41bce9){return function(_0x3d2c59){if(_0x3d2c59){return _0x3d2c59[_0x28d4('0x22')]()[_0x28d4('0x23')](function(){var _0x5a15a1=_0x3d2c59[_0x28d4('0x24')]({'plain':!![]});var _0x209c62=_0x28d4('0x25');return db['UserProfileResource'][_0x28d4('0x22')]({'where':{'type':_0x209c62,'resourceId':_0x5a15a1['id']}})[_0x28d4('0x23')](function(){return _0x3d2c59;});})[_0x28d4('0x23')](function(){_0x2f2cf3[_0x28d4('0x18')](0xcc)[_0x28d4('0x19')]();});}};}function handleEntityNotFound(_0x17986d,_0x56bb0c){return function(_0x539b9a){if(!_0x539b9a){_0x17986d[_0x28d4('0x26')](0x194);}return _0x539b9a;};}function handleError(_0x3a4786,_0x17ec21){_0x17ec21=_0x17ec21||0x1f4;return function(_0xf212a3){logger['error'](_0xf212a3[_0x28d4('0x27')]);if(_0xf212a3['name']){delete _0xf212a3[_0x28d4('0x28')];}_0x3a4786[_0x28d4('0x18')](_0x17ec21)[_0x28d4('0x29')](_0xf212a3);};}exports['index']=function(_0x91646f,_0xe14d9e){var _0x435814={},_0x53d12d={},_0xcb68a3={'count':0x0,'rows':[]};var _0xc51348=_['map'](db[_0x28d4('0x2a')][_0x28d4('0x2b')],function(_0x151702){return{'name':_0x151702[_0x28d4('0x2c')],'type':_0x151702[_0x28d4('0x2d')][_0x28d4('0x2e')]};});_0x53d12d['model']=_[_0x28d4('0x2f')](_0xc51348,_0x28d4('0x28'));_0x53d12d['query']=_[_0x28d4('0x30')](_0x91646f[_0x28d4('0x31')]);_0x53d12d[_0x28d4('0x32')]=_[_0x28d4('0x33')](_0x53d12d['model'],_0x53d12d[_0x28d4('0x31')]);_0x435814[_0x28d4('0x34')]=_[_0x28d4('0x33')](_0x53d12d[_0x28d4('0x35')],qs[_0x28d4('0x36')](_0x91646f['query'][_0x28d4('0x36')]));_0x435814[_0x28d4('0x34')]=_0x435814[_0x28d4('0x34')]['length']?_0x435814[_0x28d4('0x34')]:_0x53d12d[_0x28d4('0x35')];if(!_0x91646f['query'][_0x28d4('0x37')](_0x28d4('0x38'))){_0x435814[_0x28d4('0x1b')]=qs[_0x28d4('0x1b')](_0x91646f[_0x28d4('0x31')][_0x28d4('0x1b')]);_0x435814[_0x28d4('0x1e')]=qs[_0x28d4('0x1e')](_0x91646f[_0x28d4('0x31')][_0x28d4('0x1e')]);}_0x435814[_0x28d4('0x39')]=qs[_0x28d4('0x3a')](_0x91646f[_0x28d4('0x31')][_0x28d4('0x3a')]);_0x435814['where']=qs[_0x28d4('0x32')](_['pick'](_0x91646f[_0x28d4('0x31')],_0x53d12d['filters']),_0xc51348);if(_0x91646f[_0x28d4('0x31')][_0x28d4('0x3b')]){_0x435814['where']=_[_0x28d4('0x3c')](_0x435814[_0x28d4('0x3d')],{'$or':[{'key':{'$like':'%'+_0x91646f[_0x28d4('0x31')]['filter']+'%'}},{'value':{'$like':'%'+_0x91646f[_0x28d4('0x31')]['filter']+'%'}}]});}_0x435814=_[_0x28d4('0x3c')]({},_0x435814,_0x91646f['options']);var _0x48f023={'where':_0x435814[_0x28d4('0x3d')]};return db[_0x28d4('0x2a')]['count'](_0x48f023)[_0x28d4('0x23')](function(_0x4785d4){_0xcb68a3['count']=_0x4785d4;if(_0x91646f[_0x28d4('0x31')][_0x28d4('0x3e')]){_0x435814[_0x28d4('0x3f')]=[{'all':!![]}];}return db['CannedAnswer'][_0x28d4('0x40')](_0x435814);})[_0x28d4('0x23')](function(_0x5bec9e){_0xcb68a3[_0x28d4('0x41')]=_0x5bec9e;return _0xcb68a3;})[_0x28d4('0x23')](respondWithFilteredResult(_0xe14d9e,_0x435814))[_0x28d4('0x42')](handleError(_0xe14d9e,null));};exports[_0x28d4('0x43')]=function(_0xe7b043,_0x48c34a){var _0x32ad5a={'raw':!![],'where':{'id':_0xe7b043[_0x28d4('0x44')]['id']}},_0xba3f19={};_0xba3f19['model']=_['keys'](db[_0x28d4('0x2a')][_0x28d4('0x2b')]);_0xba3f19['query']=_['keys'](_0xe7b043[_0x28d4('0x31')]);_0xba3f19[_0x28d4('0x32')]=_[_0x28d4('0x33')](_0xba3f19[_0x28d4('0x35')],_0xba3f19[_0x28d4('0x31')]);_0x32ad5a[_0x28d4('0x34')]=_[_0x28d4('0x33')](_0xba3f19['model'],qs[_0x28d4('0x36')](_0xe7b043['query'][_0x28d4('0x36')]));_0x32ad5a[_0x28d4('0x34')]=_0x32ad5a['attributes']['length']?_0x32ad5a[_0x28d4('0x34')]:_0xba3f19[_0x28d4('0x35')];if(_0xe7b043[_0x28d4('0x31')]['includeAll']){_0x32ad5a[_0x28d4('0x3f')]=[{'all':!![]}];}_0x32ad5a=_[_0x28d4('0x3c')]({},_0x32ad5a,_0xe7b043[_0x28d4('0x45')]);return db[_0x28d4('0x2a')][_0x28d4('0x46')](_0x32ad5a)[_0x28d4('0x23')](handleEntityNotFound(_0x48c34a,null))[_0x28d4('0x23')](respondWithResult(_0x48c34a,null))['catch'](handleError(_0x48c34a,null));};exports[_0x28d4('0x47')]=function(_0x55789d,_0x5ec8da){if(_0x55789d[_0x28d4('0x48')]['id']){delete _0x55789d[_0x28d4('0x48')]['id'];}return db[_0x28d4('0x2a')]['find']({'where':{'id':_0x55789d[_0x28d4('0x44')]['id']}})[_0x28d4('0x23')](handleEntityNotFound(_0x5ec8da,null))[_0x28d4('0x23')](saveUpdates(_0x55789d['body'],null))[_0x28d4('0x23')](respondWithResult(_0x5ec8da,null))['catch'](handleError(_0x5ec8da,null));};exports[_0x28d4('0x22')]=function(_0x243d1b,_0x4653c6){return db[_0x28d4('0x2a')]['find']({'where':{'id':_0x243d1b[_0x28d4('0x44')]['id']}})[_0x28d4('0x23')](handleEntityNotFound(_0x4653c6,null))['then'](removeEntity(_0x4653c6,null))[_0x28d4('0x42')](handleError(_0x4653c6,null));};exports[_0x28d4('0x49')]=function(_0x124a91,_0x5b293f){var _0x4df358={'key':_0x124a91['body']['key']};if(_0x124a91[_0x28d4('0x48')]['MailAccountId']){_0x4df358[_0x28d4('0x4a')]=_0x124a91[_0x28d4('0x48')][_0x28d4('0x4a')];}else if(_0x124a91['body'][_0x28d4('0x4b')]){_0x4df358[_0x28d4('0x4b')]=_0x124a91[_0x28d4('0x48')][_0x28d4('0x4b')];}else if(_0x124a91[_0x28d4('0x48')]['OpenchannelAccountId']){_0x4df358[_0x28d4('0x4c')]=_0x124a91[_0x28d4('0x48')][_0x28d4('0x4c')];}else if(_0x124a91[_0x28d4('0x48')][_0x28d4('0x4d')]){_0x4df358[_0x28d4('0x4d')]=_0x124a91[_0x28d4('0x48')]['ChatWebsiteId'];}return db[_0x28d4('0x2a')][_0x28d4('0x46')]({'where':_0x4df358})['then'](function(_0x47ba35){if(_0x47ba35){throw new db[(_0x28d4('0x4e'))][(_0x28d4('0x4f'))](_0x28d4('0x50'));}return db[_0x28d4('0x2a')][_0x28d4('0x49')](_0x124a91[_0x28d4('0x48')]);})[_0x28d4('0x23')](function(_0x4ccdb3){var _0x518837=_0x124a91[_0x28d4('0x51')][_0x28d4('0x24')]({'plain':!![]});if(!_0x518837)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x518837[_0x28d4('0x52')]===_0x28d4('0x51')){var _0x177239=_0x4ccdb3[_0x28d4('0x24')]({'plain':!![]});return db[_0x28d4('0x53')][_0x28d4('0x46')]({'where':{'name':_0x28d4('0x25'),'userProfileId':_0x518837[_0x28d4('0x54')]},'raw':!![]})[_0x28d4('0x23')](function(_0x25e439){if(_0x25e439&&_0x25e439[_0x28d4('0x55')]===0x0){return db[_0x28d4('0x56')]['create']({'name':_0x177239[_0x28d4('0x28')],'resourceId':_0x177239['id'],'type':_0x25e439['name'],'sectionId':_0x25e439['id']},{})[_0x28d4('0x23')](function(){return _0x4ccdb3;});}else{return _0x4ccdb3;}})[_0x28d4('0x42')](function(_0x139dff){logger[_0x28d4('0x57')](_0x28d4('0x58'),_0x139dff);throw _0x139dff;});}return _0x4ccdb3;})[_0x28d4('0x23')](respondWithResult(_0x5b293f,0xc9))[_0x28d4('0x42')](handleError(_0x5b293f,null));}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.model.js b/server/api/cannedAnswer/cannedAnswer.model.js index 43a8cbd..c3de25a 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 _0x7c87=['api','moment','request-promise','rimraf','../../config/environment','./cannedAnswer.attributes','exports','define','CannedAnswer','tools_canned_answers','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger'];(function(_0x1c1081,_0x3a900c){var _0x5d9010=function(_0x515a3c){while(--_0x515a3c){_0x1c1081['push'](_0x1c1081['shift']());}};_0x5d9010(++_0x3a900c);}(_0x7c87,0x1a1));var _0x77c8=function(_0x568699,_0x2257be){_0x568699=_0x568699-0x0;var _0x28ed4f=_0x7c87[_0x568699];return _0x28ed4f;};'use strict';var _=require(_0x77c8('0x0'));var util=require(_0x77c8('0x1'));var logger=require(_0x77c8('0x2'))(_0x77c8('0x3'));var moment=require(_0x77c8('0x4'));var BPromise=require('bluebird');var rp=require(_0x77c8('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x77c8('0x6'));var config=require(_0x77c8('0x7'));var attributes=require(_0x77c8('0x8'));module[_0x77c8('0x9')]=function(_0x51635f,_0x128c99){return _0x51635f[_0x77c8('0xa')](_0x77c8('0xb'),attributes,{'tableName':_0x77c8('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x77c8('0xd'),'collate':_0x77c8('0xe')});}; \ No newline at end of file +var _0x7653=['api','moment','request-promise','path','rimraf','./cannedAnswer.attributes','exports','define','CannedAnswer','tools_canned_answers','utf8mb4','lodash','util'];(function(_0xc8a931,_0x260690){var _0x28bd27=function(_0x591b9f){while(--_0x591b9f){_0xc8a931['push'](_0xc8a931['shift']());}};_0x28bd27(++_0x260690);}(_0x7653,0x102));var _0x3765=function(_0x539ce1,_0x4a65eb){_0x539ce1=_0x539ce1-0x0;var _0x20be8e=_0x7653[_0x539ce1];return _0x20be8e;};'use strict';var _=require(_0x3765('0x0'));var util=require(_0x3765('0x1'));var logger=require('../../config/logger')(_0x3765('0x2'));var moment=require(_0x3765('0x3'));var BPromise=require('bluebird');var rp=require(_0x3765('0x4'));var fs=require('fs');var path=require(_0x3765('0x5'));var rimraf=require(_0x3765('0x6'));var config=require('../../config/environment');var attributes=require(_0x3765('0x7'));module[_0x3765('0x8')]=function(_0x627087,_0x35ff41){return _0x627087[_0x3765('0x9')](_0x3765('0xa'),attributes,{'tableName':_0x3765('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x3765('0xc'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.rpc.js b/server/api/cannedAnswer/cannedAnswer.rpc.js index 7904b91..85855c0 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(_0xa0cb1b,_0x7c0fa6){var _0xd0667b=function(_0x5b09c0){while(--_0x5b09c0){_0xa0cb1b['push'](_0xa0cb1b['shift']());}};_0xd0667b(++_0x7c0fa6);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5447fd,_0x52a6b5){_0x5447fd=_0x5447fd-0x0;var _0x15b28a=_0xa9e0[_0x5447fd];return _0x15b28a;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});} \ No newline at end of file +var _0xa9e0=['http','info','CannedAnswer,\x20%s,\x20%s','request\x20sent','debug','CannedAnswer,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x1ac98e,_0x9466e1){var _0x4c074b=function(_0xc79b7){while(--_0xc79b7){_0x1ac98e['push'](_0x1ac98e['shift']());}};_0x4c074b(++_0x9466e1);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3899d1,_0x4aa04c){_0x3899d1=_0x3899d1-0x0;var _0xeb4a7d=_0xa9e0[_0x3899d1];return _0xeb4a7d;};'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 caf589a..121cce4 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 _0x84bb=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','/:id','post','put','update','delete','destroy','util','path','connect-timeout','express','Router'];(function(_0x364d12,_0x2c31cc){var _0x521308=function(_0x409da9){while(--_0x409da9){_0x364d12['push'](_0x364d12['shift']());}};_0x521308(++_0x2c31cc);}(_0x84bb,0x1d7));var _0xb84b=function(_0xfcc030,_0x3ec053){_0xfcc030=_0xfcc030-0x0;var _0x5caa66=_0x84bb[_0xfcc030];return _0x5caa66;};'use strict';var multer=require('multer');var util=require(_0xb84b('0x0'));var path=require(_0xb84b('0x1'));var timeout=require(_0xb84b('0x2'));var express=require(_0xb84b('0x3'));var router=express[_0xb84b('0x4')]();var fs_extra=require(_0xb84b('0x5'));var auth=require(_0xb84b('0x6'));var interaction=require(_0xb84b('0x7'));var config=require(_0xb84b('0x8'));var controller=require('./cannedAnswer.controller');router['get']('/',auth[_0xb84b('0x9')](),controller[_0xb84b('0xa')]);router['get'](_0xb84b('0xb'),auth[_0xb84b('0x9')](),controller['show']);router[_0xb84b('0xc')]('/',auth[_0xb84b('0x9')](),controller['create']);router[_0xb84b('0xd')]('/:id',auth[_0xb84b('0x9')](),controller[_0xb84b('0xe')]);router[_0xb84b('0xf')](_0xb84b('0xb'),auth[_0xb84b('0x9')](),controller[_0xb84b('0x10')]);module['exports']=router; \ No newline at end of file +var _0x4dbf=['put','update','delete','multer','path','connect-timeout','fs-extra','../../config/environment','get','index','/:id','show','post','isAuthenticated','create'];(function(_0x8d6c7a,_0x2d4c3c){var _0x2c305a=function(_0x388014){while(--_0x388014){_0x8d6c7a['push'](_0x8d6c7a['shift']());}};_0x2c305a(++_0x2d4c3c);}(_0x4dbf,0xc6));var _0xf4db=function(_0x33154d,_0x854047){_0x33154d=_0x33154d-0x0;var _0x3b2f03=_0x4dbf[_0x33154d];return _0x3b2f03;};'use strict';var multer=require(_0xf4db('0x0'));var util=require('util');var path=require(_0xf4db('0x1'));var timeout=require(_0xf4db('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xf4db('0x3'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xf4db('0x4'));var controller=require('./cannedAnswer.controller');router[_0xf4db('0x5')]('/',auth['isAuthenticated'](),controller[_0xf4db('0x6')]);router[_0xf4db('0x5')](_0xf4db('0x7'),auth['isAuthenticated'](),controller[_0xf4db('0x8')]);router[_0xf4db('0x9')]('/',auth[_0xf4db('0xa')](),controller[_0xf4db('0xb')]);router[_0xf4db('0xc')]('/:id',auth['isAuthenticated'](),controller[_0xf4db('0xd')]);router[_0xf4db('0xe')]('/:id',auth[_0xf4db('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/cdr/cdr.attributes.js b/server/api/cdr/cdr.attributes.js index f074cfc..55a33ce 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 _0x8482=['DATE','1970-01-01\x2000:00:01','STRING','INTEGER','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8482,0x14e));var _0x2848=function(_0x32a3bc,_0x1db8c6){_0x32a3bc=_0x32a3bc-0x0;var _0xbb43d=_0x8482[_0x32a3bc];return _0xbb43d;};'use strict';var Sequelize=require('sequelize');module[_0x2848('0x0')]={'calldate':{'type':Sequelize[_0x2848('0x1')],'allowNull':![],'defaultValue':_0x2848('0x2')},'clid':{'type':Sequelize[_0x2848('0x3')]},'src':{'type':Sequelize[_0x2848('0x3')]},'dst':{'type':Sequelize[_0x2848('0x3')]},'dcontext':{'type':Sequelize[_0x2848('0x3')]},'channel':{'type':Sequelize[_0x2848('0x3')]},'dstchannel':{'type':Sequelize[_0x2848('0x3')]},'lastapp':{'type':Sequelize[_0x2848('0x3')]},'lastdata':{'type':Sequelize['STRING']},'duration':{'type':Sequelize[_0x2848('0x4')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0x2848('0x4')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize['STRING']},'amaflags':{'type':Sequelize[_0x2848('0x4')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize['STRING']},'userfield':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x2848('0x3')]},'linkedid':{'type':Sequelize['STRING']},'sequence':{'type':Sequelize[_0x2848('0x3')]},'peeraccount':{'type':Sequelize['STRING']},'type':{'type':Sequelize['STRING']},'tag':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x6a00=['INTEGER','sequelize','exports','1970-01-01\x2000:00:01','STRING'];(function(_0x47583b,_0x422882){var _0x369034=function(_0x274f6f){while(--_0x274f6f){_0x47583b['push'](_0x47583b['shift']());}};_0x369034(++_0x422882);}(_0x6a00,0xc9));var _0x06a0=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x6a00[_0x2f5ac5];return _0x37c9a8;};'use strict';var Sequelize=require(_0x06a0('0x0'));module[_0x06a0('0x1')]={'calldate':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':_0x06a0('0x2')},'clid':{'type':Sequelize[_0x06a0('0x3')]},'src':{'type':Sequelize[_0x06a0('0x3')]},'dst':{'type':Sequelize[_0x06a0('0x3')]},'dcontext':{'type':Sequelize[_0x06a0('0x3')]},'channel':{'type':Sequelize['STRING']},'dstchannel':{'type':Sequelize['STRING']},'lastapp':{'type':Sequelize[_0x06a0('0x3')]},'lastdata':{'type':Sequelize[_0x06a0('0x3')]},'duration':{'type':Sequelize[_0x06a0('0x4')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0x06a0('0x4')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x06a0('0x3')]},'amaflags':{'type':Sequelize[_0x06a0('0x4')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize['STRING']},'userfield':{'type':Sequelize[_0x06a0('0x3')]},'uniqueid':{'type':Sequelize[_0x06a0('0x3')]},'linkedid':{'type':Sequelize[_0x06a0('0x3')]},'sequence':{'type':Sequelize[_0x06a0('0x3')]},'peeraccount':{'type':Sequelize[_0x06a0('0x3')]},'type':{'type':Sequelize[_0x06a0('0x3')]},'tag':{'type':Sequelize[_0x06a0('0x3')]}}; \ No newline at end of file diff --git a/server/api/cdr/cdr.controller.js b/server/api/cdr/cdr.controller.js index c009537..36f77f1 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 _0x8c46=['filter','VIRTUAL','merge','options','include','Cdr','rows','catch','includeAll','find','create','body','params','describe','eml-format','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','limit','undefined','count','offset','set','Content-Range','reject','save','update','destroy','then','error','stack','name','send','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','sort','where','pick'];(function(_0x2346b5,_0x1f178b){var _0x345117=function(_0x163c59){while(--_0x163c59){_0x2346b5['push'](_0x2346b5['shift']());}};_0x345117(++_0x1f178b);}(_0x8c46,0x171));var _0x68c4=function(_0x1ed8de,_0x32a52f){_0x1ed8de=_0x1ed8de-0x0;var _0x4acdae=_0x8c46[_0x1ed8de];return _0x4acdae;};'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'];function respondWithStatusCode(_0x48783b,_0x3a432a){_0x3a432a=_0x3a432a||0xcc;return function(_0x1f5f42){if(_0x1f5f42){return _0x48783b[_0x68c4('0x16')](_0x3a432a);}return _0x48783b['status'](_0x3a432a)[_0x68c4('0x17')]();};}function respondWithResult(_0x14919c,_0x5e1341){_0x5e1341=_0x5e1341||0xc8;return function(_0x52f031){if(_0x52f031){return _0x14919c[_0x68c4('0x18')](_0x5e1341)[_0x68c4('0x19')](_0x52f031);}};}function respondWithFilteredResult(_0x5be0de,_0xc25f7b){return function(_0x4ea2a4){if(_0x4ea2a4){var _0x1a7045=typeof _0xc25f7b['offset']==='undefined'&&typeof _0xc25f7b[_0x68c4('0x1a')]===_0x68c4('0x1b');var _0x4f4797=_0x4ea2a4[_0x68c4('0x1c')];var _0x1d757c=_0x1a7045?0x0:_0xc25f7b[_0x68c4('0x1d')];var _0x33c5c5=_0x1a7045?_0x4ea2a4[_0x68c4('0x1c')]:_0xc25f7b[_0x68c4('0x1d')]+_0xc25f7b[_0x68c4('0x1a')];var _0x415ef2;if(_0x33c5c5>=_0x4f4797){_0x33c5c5=_0x4f4797;_0x415ef2=0xc8;}else{_0x415ef2=0xce;}_0x5be0de[_0x68c4('0x18')](_0x415ef2);return _0x5be0de[_0x68c4('0x1e')](_0x68c4('0x1f'),_0x1d757c+'-'+_0x33c5c5+'/'+_0x4f4797)['json'](_0x4ea2a4);}return null;};}function patchUpdates(_0x398a71){return function(_0x4edf9f){try{jsonpatch['apply'](_0x4edf9f,_0x398a71,!![]);}catch(_0x34d3a6){return BPromise[_0x68c4('0x20')](_0x34d3a6);}return _0x4edf9f[_0x68c4('0x21')]();};}function saveUpdates(_0x42f0bc,_0x5b8135){return function(_0x35e865){if(_0x35e865){return _0x35e865[_0x68c4('0x22')](_0x42f0bc)['then'](function(_0x201742){return _0x201742;});}return null;};}function removeEntity(_0x392ccf,_0x45f9be){return function(_0x10278e){if(_0x10278e){return _0x10278e[_0x68c4('0x23')]()[_0x68c4('0x24')](function(){_0x392ccf[_0x68c4('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2ff4a5,_0x55355d){return function(_0xf16a78){if(!_0xf16a78){_0x2ff4a5[_0x68c4('0x16')](0x194);}return _0xf16a78;};}function handleError(_0x57f32,_0x4f9d32){_0x4f9d32=_0x4f9d32||0x1f4;return function(_0x1e14db){logger[_0x68c4('0x25')](_0x1e14db[_0x68c4('0x26')]);if(_0x1e14db[_0x68c4('0x27')]){delete _0x1e14db[_0x68c4('0x27')];}_0x57f32[_0x68c4('0x18')](_0x4f9d32)[_0x68c4('0x28')](_0x1e14db);};}exports['index']=function(_0x26d56b,_0x4b4634){var _0x3772b3={},_0x1442ba={},_0x56ed70={'count':0x0,'rows':[]};var _0x2847d1=_[_0x68c4('0x29')](db['Cdr'][_0x68c4('0x2a')],function(_0x3a1b69){return{'name':_0x3a1b69[_0x68c4('0x2b')],'type':_0x3a1b69[_0x68c4('0x2c')][_0x68c4('0x2d')]};});_0x1442ba[_0x68c4('0x2e')]=_[_0x68c4('0x29')](_0x2847d1,_0x68c4('0x27'));_0x1442ba[_0x68c4('0x2f')]=_[_0x68c4('0x30')](_0x26d56b[_0x68c4('0x2f')]);_0x1442ba[_0x68c4('0x31')]=_[_0x68c4('0x32')](_0x1442ba[_0x68c4('0x2e')],_0x1442ba[_0x68c4('0x2f')]);_0x3772b3[_0x68c4('0x33')]=_[_0x68c4('0x32')](_0x1442ba[_0x68c4('0x2e')],qs['fields'](_0x26d56b[_0x68c4('0x2f')][_0x68c4('0x34')]));_0x3772b3[_0x68c4('0x33')]=_0x3772b3[_0x68c4('0x33')][_0x68c4('0x35')]?_0x3772b3['attributes']:_0x1442ba[_0x68c4('0x2e')];if(!_0x26d56b['query']['hasOwnProperty']('nolimit')){_0x3772b3[_0x68c4('0x1a')]=qs[_0x68c4('0x1a')](_0x26d56b[_0x68c4('0x2f')][_0x68c4('0x1a')]);_0x3772b3['offset']=qs[_0x68c4('0x1d')](_0x26d56b[_0x68c4('0x2f')][_0x68c4('0x1d')]);}_0x3772b3['order']=qs[_0x68c4('0x36')](_0x26d56b[_0x68c4('0x2f')][_0x68c4('0x36')]);_0x3772b3[_0x68c4('0x37')]=qs[_0x68c4('0x31')](_[_0x68c4('0x38')](_0x26d56b[_0x68c4('0x2f')],_0x1442ba[_0x68c4('0x31')]),_0x2847d1);if(_0x26d56b[_0x68c4('0x2f')][_0x68c4('0x39')]){_0x3772b3['where']=_['merge'](_0x3772b3[_0x68c4('0x37')],{'$or':_[_0x68c4('0x29')](_0x2847d1,function(_0x460e11){if(_0x460e11[_0x68c4('0x2c')]!==_0x68c4('0x3a')){var _0x13386d={};_0x13386d[_0x460e11[_0x68c4('0x27')]]={'$like':'%'+_0x26d56b[_0x68c4('0x2f')][_0x68c4('0x39')]+'%'};return _0x13386d;}})});}_0x3772b3=_[_0x68c4('0x3b')]({},_0x3772b3,_0x26d56b[_0x68c4('0x3c')]);var _0x30a1cd={'where':_0x3772b3[_0x68c4('0x37')]};return db['Cdr']['count'](_0x30a1cd)[_0x68c4('0x24')](function(_0x2785b4){_0x56ed70[_0x68c4('0x1c')]=_0x2785b4;if(_0x26d56b[_0x68c4('0x2f')]['includeAll']){_0x3772b3[_0x68c4('0x3d')]=[{'all':!![]}];}return db[_0x68c4('0x3e')]['findAll'](_0x3772b3);})['then'](function(_0x4c564a){_0x56ed70[_0x68c4('0x3f')]=_0x4c564a;return _0x56ed70;})['then'](respondWithFilteredResult(_0x4b4634,_0x3772b3))[_0x68c4('0x40')](handleError(_0x4b4634,null));};exports['show']=function(_0x18da6f,_0x2406b1){var _0xbd848f={'raw':!![],'where':{'id':_0x18da6f['params']['id']}},_0xefe68d={};_0xefe68d[_0x68c4('0x2e')]=_[_0x68c4('0x30')](db[_0x68c4('0x3e')][_0x68c4('0x2a')]);_0xefe68d['query']=_[_0x68c4('0x30')](_0x18da6f[_0x68c4('0x2f')]);_0xefe68d[_0x68c4('0x31')]=_[_0x68c4('0x32')](_0xefe68d[_0x68c4('0x2e')],_0xefe68d['query']);_0xbd848f['attributes']=_['intersection'](_0xefe68d[_0x68c4('0x2e')],qs[_0x68c4('0x34')](_0x18da6f[_0x68c4('0x2f')][_0x68c4('0x34')]));_0xbd848f['attributes']=_0xbd848f[_0x68c4('0x33')][_0x68c4('0x35')]?_0xbd848f[_0x68c4('0x33')]:_0xefe68d[_0x68c4('0x2e')];if(_0x18da6f[_0x68c4('0x2f')][_0x68c4('0x41')]){_0xbd848f[_0x68c4('0x3d')]=[{'all':!![]}];}_0xbd848f=_[_0x68c4('0x3b')]({},_0xbd848f,_0x18da6f[_0x68c4('0x3c')]);return db[_0x68c4('0x3e')][_0x68c4('0x42')](_0xbd848f)['then'](handleEntityNotFound(_0x2406b1,null))[_0x68c4('0x24')](respondWithResult(_0x2406b1,null))['catch'](handleError(_0x2406b1,null));};exports[_0x68c4('0x43')]=function(_0x44e3c9,_0x463a6b){return db[_0x68c4('0x3e')]['create'](_0x44e3c9[_0x68c4('0x44')],{})['then'](respondWithResult(_0x463a6b,0xc9))[_0x68c4('0x40')](handleError(_0x463a6b,null));};exports[_0x68c4('0x22')]=function(_0x570e25,_0x250941){if(_0x570e25[_0x68c4('0x44')]['id']){delete _0x570e25[_0x68c4('0x44')]['id'];}return db[_0x68c4('0x3e')][_0x68c4('0x42')]({'where':{'id':_0x570e25[_0x68c4('0x45')]['id']}})['then'](handleEntityNotFound(_0x250941,null))[_0x68c4('0x24')](saveUpdates(_0x570e25[_0x68c4('0x44')],null))[_0x68c4('0x24')](respondWithResult(_0x250941,null))[_0x68c4('0x40')](handleError(_0x250941,null));};exports['destroy']=function(_0x40ecf6,_0x19aec2){return db[_0x68c4('0x3e')][_0x68c4('0x42')]({'where':{'id':_0x40ecf6[_0x68c4('0x45')]['id']}})[_0x68c4('0x24')](handleEntityNotFound(_0x19aec2,null))['then'](removeEntity(_0x19aec2,null))[_0x68c4('0x40')](handleError(_0x19aec2,null));};exports[_0x68c4('0x46')]=function(_0x3db854,_0x51db14){return db[_0x68c4('0x3e')][_0x68c4('0x46')]()['then'](respondWithResult(_0x51db14,null))['catch'](handleError(_0x51db14,null));}; \ No newline at end of file +var _0x8375=['attributes','intersection','fields','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','options','include','rows','catch','show','params','rawAttributes','length','includeAll','create','body','find','describe','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','count','limit','set','Content-Range','save','destroy','then','error','stack','name','send','map','Cdr','fieldName','type','model','query','keys'];(function(_0x46aaaa,_0x3af897){var _0x26d04e=function(_0x4373ba){while(--_0x4373ba){_0x46aaaa['push'](_0x46aaaa['shift']());}};_0x26d04e(++_0x3af897);}(_0x8375,0xa8));var _0x5837=function(_0x45a106,_0x40f99f){_0x45a106=_0x45a106-0x0;var _0x318090=_0x8375[_0x45a106];return _0x318090;};'use strict';var emlformat=require(_0x5837('0x0'));var rimraf=require(_0x5837('0x1'));var zipdir=require(_0x5837('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x5837('0x3'));var moment=require(_0x5837('0x4'));var BPromise=require(_0x5837('0x5'));var Mustache=require(_0x5837('0x6'));var util=require(_0x5837('0x7'));var path=require(_0x5837('0x8'));var sox=require('sox');var csv=require(_0x5837('0x9'));var ejs=require(_0x5837('0xa'));var fs=require('fs');var fs_extra=require(_0x5837('0xb'));var _=require(_0x5837('0xc'));var squel=require(_0x5837('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x5837('0xe'));var toCsv=require(_0x5837('0x9'));var querystring=require('querystring');var Papa=require(_0x5837('0xf'));var Redis=require('ioredis');var authService=require(_0x5837('0x10'));var qs=require(_0x5837('0x11'));var as=require(_0x5837('0x12'));var hardwareService=require(_0x5837('0x13'));var logger=require(_0x5837('0x14'))(_0x5837('0x15'));var utils=require('../../config/utils');var config=require(_0x5837('0x16'));var licenseUtil=require(_0x5837('0x17'));var db=require(_0x5837('0x18'))['db'];function respondWithStatusCode(_0x10c1a1,_0x143210){_0x143210=_0x143210||0xcc;return function(_0x485366){if(_0x485366){return _0x10c1a1['sendStatus'](_0x143210);}return _0x10c1a1['status'](_0x143210)[_0x5837('0x19')]();};}function respondWithResult(_0x111dbf,_0x469903){_0x469903=_0x469903||0xc8;return function(_0xa5718d){if(_0xa5718d){return _0x111dbf[_0x5837('0x1a')](_0x469903)[_0x5837('0x1b')](_0xa5718d);}};}function respondWithFilteredResult(_0x206f02,_0x754f39){return function(_0x10d882){if(_0x10d882){var _0x59a378=typeof _0x754f39[_0x5837('0x1c')]===_0x5837('0x1d')&&typeof _0x754f39['limit']===_0x5837('0x1d');var _0x2297b4=_0x10d882[_0x5837('0x1e')];var _0x49279d=_0x59a378?0x0:_0x754f39['offset'];var _0x4bee08=_0x59a378?_0x10d882[_0x5837('0x1e')]:_0x754f39[_0x5837('0x1c')]+_0x754f39[_0x5837('0x1f')];var _0x58e7f7;if(_0x4bee08>=_0x2297b4){_0x4bee08=_0x2297b4;_0x58e7f7=0xc8;}else{_0x58e7f7=0xce;}_0x206f02[_0x5837('0x1a')](_0x58e7f7);return _0x206f02[_0x5837('0x20')](_0x5837('0x21'),_0x49279d+'-'+_0x4bee08+'/'+_0x2297b4)[_0x5837('0x1b')](_0x10d882);}return null;};}function patchUpdates(_0x5881ff){return function(_0x4908c2){try{jsonpatch['apply'](_0x4908c2,_0x5881ff,!![]);}catch(_0x3d352f){return BPromise['reject'](_0x3d352f);}return _0x4908c2[_0x5837('0x22')]();};}function saveUpdates(_0x2bd103,_0x32733a){return function(_0x3a7efe){if(_0x3a7efe){return _0x3a7efe['update'](_0x2bd103)['then'](function(_0x1b80db){return _0x1b80db;});}return null;};}function removeEntity(_0x2262b9,_0x406506){return function(_0x5e8089){if(_0x5e8089){return _0x5e8089[_0x5837('0x23')]()[_0x5837('0x24')](function(){_0x2262b9[_0x5837('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x41f86a,_0x2646ed){return function(_0x39babd){if(!_0x39babd){_0x41f86a['sendStatus'](0x194);}return _0x39babd;};}function handleError(_0x57baed,_0x1d545c){_0x1d545c=_0x1d545c||0x1f4;return function(_0x15655e){logger[_0x5837('0x25')](_0x15655e[_0x5837('0x26')]);if(_0x15655e[_0x5837('0x27')]){delete _0x15655e[_0x5837('0x27')];}_0x57baed[_0x5837('0x1a')](_0x1d545c)[_0x5837('0x28')](_0x15655e);};}exports['index']=function(_0x2f0c8d,_0x13830f){var _0x3cbd3f={},_0x3918ee={},_0x1c9f32={'count':0x0,'rows':[]};var _0x228f1=_[_0x5837('0x29')](db[_0x5837('0x2a')]['rawAttributes'],function(_0x4f7502){return{'name':_0x4f7502[_0x5837('0x2b')],'type':_0x4f7502[_0x5837('0x2c')]['key']};});_0x3918ee[_0x5837('0x2d')]=_[_0x5837('0x29')](_0x228f1,'name');_0x3918ee[_0x5837('0x2e')]=_[_0x5837('0x2f')](_0x2f0c8d[_0x5837('0x2e')]);_0x3918ee['filters']=_['intersection'](_0x3918ee['model'],_0x3918ee[_0x5837('0x2e')]);_0x3cbd3f[_0x5837('0x30')]=_[_0x5837('0x31')](_0x3918ee[_0x5837('0x2d')],qs[_0x5837('0x32')](_0x2f0c8d['query']['fields']));_0x3cbd3f[_0x5837('0x30')]=_0x3cbd3f[_0x5837('0x30')]['length']?_0x3cbd3f['attributes']:_0x3918ee[_0x5837('0x2d')];if(!_0x2f0c8d['query']['hasOwnProperty'](_0x5837('0x33'))){_0x3cbd3f[_0x5837('0x1f')]=qs['limit'](_0x2f0c8d[_0x5837('0x2e')][_0x5837('0x1f')]);_0x3cbd3f[_0x5837('0x1c')]=qs['offset'](_0x2f0c8d[_0x5837('0x2e')][_0x5837('0x1c')]);}_0x3cbd3f[_0x5837('0x34')]=qs[_0x5837('0x35')](_0x2f0c8d[_0x5837('0x2e')]['sort']);_0x3cbd3f[_0x5837('0x36')]=qs['filters'](_['pick'](_0x2f0c8d[_0x5837('0x2e')],_0x3918ee[_0x5837('0x37')]),_0x228f1);if(_0x2f0c8d['query'][_0x5837('0x38')]){_0x3cbd3f[_0x5837('0x36')]=_[_0x5837('0x39')](_0x3cbd3f[_0x5837('0x36')],{'$or':_['map'](_0x228f1,function(_0x2ed688){if(_0x2ed688[_0x5837('0x2c')]!==_0x5837('0x3a')){var _0x5dcd18={};_0x5dcd18[_0x2ed688[_0x5837('0x27')]]={'$like':'%'+_0x2f0c8d[_0x5837('0x2e')][_0x5837('0x38')]+'%'};return _0x5dcd18;}})});}_0x3cbd3f=_[_0x5837('0x39')]({},_0x3cbd3f,_0x2f0c8d[_0x5837('0x3b')]);var _0x76f00d={'where':_0x3cbd3f[_0x5837('0x36')]};return db[_0x5837('0x2a')][_0x5837('0x1e')](_0x76f00d)[_0x5837('0x24')](function(_0x1a5e2d){_0x1c9f32[_0x5837('0x1e')]=_0x1a5e2d;if(_0x2f0c8d['query']['includeAll']){_0x3cbd3f[_0x5837('0x3c')]=[{'all':!![]}];}return db[_0x5837('0x2a')]['findAll'](_0x3cbd3f);})[_0x5837('0x24')](function(_0x1ae168){_0x1c9f32[_0x5837('0x3d')]=_0x1ae168;return _0x1c9f32;})['then'](respondWithFilteredResult(_0x13830f,_0x3cbd3f))[_0x5837('0x3e')](handleError(_0x13830f,null));};exports[_0x5837('0x3f')]=function(_0x1c81ed,_0x3acdf5){var _0x4643e3={'raw':!![],'where':{'id':_0x1c81ed[_0x5837('0x40')]['id']}},_0xd443be={};_0xd443be[_0x5837('0x2d')]=_[_0x5837('0x2f')](db['Cdr'][_0x5837('0x41')]);_0xd443be[_0x5837('0x2e')]=_[_0x5837('0x2f')](_0x1c81ed['query']);_0xd443be['filters']=_[_0x5837('0x31')](_0xd443be[_0x5837('0x2d')],_0xd443be[_0x5837('0x2e')]);_0x4643e3[_0x5837('0x30')]=_[_0x5837('0x31')](_0xd443be[_0x5837('0x2d')],qs[_0x5837('0x32')](_0x1c81ed[_0x5837('0x2e')][_0x5837('0x32')]));_0x4643e3[_0x5837('0x30')]=_0x4643e3[_0x5837('0x30')][_0x5837('0x42')]?_0x4643e3['attributes']:_0xd443be[_0x5837('0x2d')];if(_0x1c81ed['query'][_0x5837('0x43')]){_0x4643e3[_0x5837('0x3c')]=[{'all':!![]}];}_0x4643e3=_['merge']({},_0x4643e3,_0x1c81ed[_0x5837('0x3b')]);return db[_0x5837('0x2a')]['find'](_0x4643e3)[_0x5837('0x24')](handleEntityNotFound(_0x3acdf5,null))[_0x5837('0x24')](respondWithResult(_0x3acdf5,null))[_0x5837('0x3e')](handleError(_0x3acdf5,null));};exports[_0x5837('0x44')]=function(_0x54a23b,_0x55cf2b){return db[_0x5837('0x2a')][_0x5837('0x44')](_0x54a23b['body'],{})['then'](respondWithResult(_0x55cf2b,0xc9))['catch'](handleError(_0x55cf2b,null));};exports['update']=function(_0x38e987,_0x6423f2){if(_0x38e987[_0x5837('0x45')]['id']){delete _0x38e987['body']['id'];}return db['Cdr'][_0x5837('0x46')]({'where':{'id':_0x38e987[_0x5837('0x40')]['id']}})[_0x5837('0x24')](handleEntityNotFound(_0x6423f2,null))[_0x5837('0x24')](saveUpdates(_0x38e987[_0x5837('0x45')],null))[_0x5837('0x24')](respondWithResult(_0x6423f2,null))[_0x5837('0x3e')](handleError(_0x6423f2,null));};exports[_0x5837('0x23')]=function(_0x27f7b9,_0x38743a){return db['Cdr'][_0x5837('0x46')]({'where':{'id':_0x27f7b9[_0x5837('0x40')]['id']}})['then'](handleEntityNotFound(_0x38743a,null))[_0x5837('0x24')](removeEntity(_0x38743a,null))[_0x5837('0x3e')](handleError(_0x38743a,null));};exports[_0x5837('0x47')]=function(_0x397cd9,_0x38e75d){return db['Cdr'][_0x5837('0x47')]()[_0x5837('0x24')](respondWithResult(_0x38e75d,null))[_0x5837('0x3e')](handleError(_0x38e75d,null));}; \ No newline at end of file diff --git a/server/api/cdr/cdr.model.js b/server/api/cdr/cdr.model.js index d803dbb..8334c00 100644 --- a/server/api/cdr/cdr.model.js +++ b/server/api/cdr/cdr.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['dst','src','uniqueid','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./cdr.attributes','exports','define','Cdr','accountcode','calldate','disposition'];(function(_0x51d4e2,_0x1dfeaf){var _0x1eeab3=function(_0x10bb16){while(--_0x10bb16){_0x51d4e2['push'](_0x51d4e2['shift']());}};_0x1eeab3(++_0x1dfeaf);}(_0x9957,0x93));var _0x7995=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x9957[_0x5ddb1c];return _0x354adc;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var logger=require(_0x7995('0x2'))(_0x7995('0x3'));var moment=require('moment');var BPromise=require(_0x7995('0x4'));var rp=require(_0x7995('0x5'));var fs=require('fs');var path=require(_0x7995('0x6'));var rimraf=require(_0x7995('0x7'));var config=require('../../config/environment');var attributes=require(_0x7995('0x8'));module[_0x7995('0x9')]=function(_0x137b6b,_0x219534){return _0x137b6b[_0x7995('0xa')](_0x7995('0xb'),attributes,{'tableName':'cdr','paranoid':![],'indexes':[{'name':_0x7995('0xc'),'fields':[_0x7995('0xc')]},{'name':'calldate','fields':[_0x7995('0xd')]},{'name':_0x7995('0xe'),'fields':[_0x7995('0xe')]},{'name':_0x7995('0xf'),'fields':[_0x7995('0xf')]},{'name':_0x7995('0x10'),'fields':[_0x7995('0x10')]},{'name':'uniqueid','fields':[_0x7995('0x11')]}],'timestamps':![]});}; \ No newline at end of file +var _0x9957=['dst','src','uniqueid','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./cdr.attributes','exports','define','Cdr','accountcode','calldate','disposition'];(function(_0x22cd7c,_0x1d86fa){var _0x36096c=function(_0x1fbbcb){while(--_0x1fbbcb){_0x22cd7c['push'](_0x22cd7c['shift']());}};_0x36096c(++_0x1d86fa);}(_0x9957,0x93));var _0x7995=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x9957[_0x3b380d];return _0x54502b;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var logger=require(_0x7995('0x2'))(_0x7995('0x3'));var moment=require('moment');var BPromise=require(_0x7995('0x4'));var rp=require(_0x7995('0x5'));var fs=require('fs');var path=require(_0x7995('0x6'));var rimraf=require(_0x7995('0x7'));var config=require('../../config/environment');var attributes=require(_0x7995('0x8'));module[_0x7995('0x9')]=function(_0x137b6b,_0x219534){return _0x137b6b[_0x7995('0xa')](_0x7995('0xb'),attributes,{'tableName':'cdr','paranoid':![],'indexes':[{'name':_0x7995('0xc'),'fields':[_0x7995('0xc')]},{'name':'calldate','fields':[_0x7995('0xd')]},{'name':_0x7995('0xe'),'fields':[_0x7995('0xe')]},{'name':_0x7995('0xf'),'fields':[_0x7995('0xf')]},{'name':_0x7995('0x10'),'fields':[_0x7995('0x10')]},{'name':'uniqueid','fields':[_0x7995('0x11')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/cdr/cdr.rpc.js b/server/api/cdr/cdr.rpc.js index a430109..e7fac43 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 _0x8fe0=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','debug','Cdr,\x20%s,\x20%s,\x20%s','stringify','error','code','Cdr,\x20%s,\x20%s','message','result','catch','moment','bluebird'];(function(_0x3f8f62,_0x313077){var _0x44ae90=function(_0x22004b){while(--_0x22004b){_0x3f8f62['push'](_0x3f8f62['shift']());}};_0x44ae90(++_0x313077);}(_0x8fe0,0x112));var _0x08fe=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x8fe0[_0x19e35c];return _0x3e1fe8;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x08fe('0x0'));var BPromise=require(_0x08fe('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x08fe('0x2'));var db=require(_0x08fe('0x3'))['db'];var utils=require(_0x08fe('0x4'));var logger=require(_0x08fe('0x5'))(_0x08fe('0x6'));var config=require(_0x08fe('0x7'));var jayson=require(_0x08fe('0x8'));var client=jayson[_0x08fe('0x9')][_0x08fe('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x58c167,_0x10750f,_0x196919){return new BPromise(function(_0x112931,_0x505ce9){return client[_0x08fe('0xb')](_0x58c167,_0x196919)['then'](function(_0x52fdd1){logger[_0x08fe('0xc')]('Cdr,\x20%s,\x20%s',_0x10750f,_0x08fe('0xd'));logger[_0x08fe('0xe')](_0x08fe('0xf'),_0x10750f,_0x08fe('0xd'),JSON[_0x08fe('0x10')](_0x52fdd1));if(_0x52fdd1['error']){if(_0x52fdd1[_0x08fe('0x11')][_0x08fe('0x12')]===0x1f4){logger[_0x08fe('0x11')](_0x08fe('0x13'),_0x10750f,_0x52fdd1['error']['message']);return _0x505ce9(_0x52fdd1[_0x08fe('0x11')][_0x08fe('0x14')]);}logger['error'](_0x08fe('0x13'),_0x10750f,_0x52fdd1['error']['message']);return _0x112931(_0x52fdd1['error'][_0x08fe('0x14')]);}else{logger[_0x08fe('0xc')]('Cdr,\x20%s,\x20%s',_0x10750f,_0x08fe('0xd'));_0x112931(_0x52fdd1[_0x08fe('0x15')][_0x08fe('0x14')]);}})[_0x08fe('0x16')](function(_0x34f48c){logger[_0x08fe('0x11')](_0x08fe('0x13'),_0x10750f,_0x34f48c);_0x505ce9(_0x34f48c);});});} \ No newline at end of file +var _0x31f6=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','Cdr,\x20%s,\x20%s','request\x20sent','Cdr,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','util','bluebird'];(function(_0x2a9b81,_0x5ea35d){var _0xc5f927=function(_0x49b4bc){while(--_0x49b4bc){_0x2a9b81['push'](_0x2a9b81['shift']());}};_0xc5f927(++_0x5ea35d);}(_0x31f6,0x102));var _0x631f=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x31f6[_0x57b54c];return _0x59cc19;};'use strict';var _=require('lodash');var util=require(_0x631f('0x0'));var moment=require('moment');var BPromise=require(_0x631f('0x1'));var rs=require(_0x631f('0x2'));var fs=require('fs');var Redis=require(_0x631f('0x3'));var db=require(_0x631f('0x4'))['db'];var utils=require(_0x631f('0x5'));var logger=require(_0x631f('0x6'))(_0x631f('0x7'));var config=require(_0x631f('0x8'));var jayson=require(_0x631f('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x152a64,_0x3d812a,_0x1742a7){return new BPromise(function(_0x2cf71e,_0x188cdc){return client[_0x631f('0xa')](_0x152a64,_0x1742a7)[_0x631f('0xb')](function(_0xe3048c){logger['info'](_0x631f('0xc'),_0x3d812a,_0x631f('0xd'));logger['debug'](_0x631f('0xe'),_0x3d812a,_0x631f('0xd'),JSON[_0x631f('0xf')](_0xe3048c));if(_0xe3048c['error']){if(_0xe3048c[_0x631f('0x10')][_0x631f('0x11')]===0x1f4){logger[_0x631f('0x10')](_0x631f('0xc'),_0x3d812a,_0xe3048c[_0x631f('0x10')][_0x631f('0x12')]);return _0x188cdc(_0xe3048c['error'][_0x631f('0x12')]);}logger[_0x631f('0x10')]('Cdr,\x20%s,\x20%s',_0x3d812a,_0xe3048c[_0x631f('0x10')][_0x631f('0x12')]);return _0x2cf71e(_0xe3048c['error'][_0x631f('0x12')]);}else{logger['info'](_0x631f('0xc'),_0x3d812a,_0x631f('0xd'));_0x2cf71e(_0xe3048c['result']['message']);}})[_0x631f('0x13')](function(_0x446108){logger[_0x631f('0x10')](_0x631f('0xc'),_0x3d812a,_0x446108);_0x188cdc(_0x446108);});});} \ No newline at end of file diff --git a/server/api/cdr/index.js b/server/api/cdr/index.js index b5058ee..6e3fcfb 100644 --- a/server/api/cdr/index.js +++ b/server/api/cdr/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['../../components/interaction/service','../../config/environment','./cdr.controller','get','index','isAuthenticated','describe','/:id','show','post','update','destroy','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service'];(function(_0x399b7c,_0x2750b9){var _0x58312b=function(_0x5599db){while(--_0x5599db){_0x399b7c['push'](_0x399b7c['shift']());}};_0x58312b(++_0x2750b9);}(_0xb10b,0x12a));var _0xbb10=function(_0x41c66d,_0x512755){_0x41c66d=_0x41c66d-0x0;var _0x4b3302=_0xb10b[_0x41c66d];return _0x4b3302;};'use strict';var multer=require(_0xbb10('0x0'));var util=require('util');var path=require(_0xbb10('0x1'));var timeout=require(_0xbb10('0x2'));var express=require(_0xbb10('0x3'));var router=express['Router']();var fs_extra=require(_0xbb10('0x4'));var auth=require(_0xbb10('0x5'));var interaction=require(_0xbb10('0x6'));var config=require(_0xbb10('0x7'));var controller=require(_0xbb10('0x8'));router[_0xbb10('0x9')]('/',auth['isAuthenticated'](),controller[_0xbb10('0xa')]);router[_0xbb10('0x9')]('/describe',auth[_0xbb10('0xb')](),controller[_0xbb10('0xc')]);router[_0xbb10('0x9')](_0xbb10('0xd'),auth[_0xbb10('0xb')](),controller[_0xbb10('0xe')]);router[_0xbb10('0xf')]('/',auth[_0xbb10('0xb')](),controller['create']);router['put'](_0xbb10('0xd'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x10')]);router['delete'](_0xbb10('0xd'),auth['isAuthenticated'](),controller[_0xbb10('0x11')]);module[_0xbb10('0x12')]=router; \ No newline at end of file +var _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(_0x45bfbc,_0x1ff15e){var _0x407018=function(_0x22f0f0){while(--_0x22f0f0){_0x45bfbc['push'](_0x45bfbc['shift']());}};_0x407018(++_0x1ff15e);}(_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 diff --git a/server/api/chatApplication/chatApplication.attributes.js b/server/api/chatApplication/chatApplication.attributes.js index 25f241d..7048ae9 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 _0xbf35=['TEXT','*,*,*,*','sequelize','exports','INTEGER','STRING','noop'];(function(_0x372c3e,_0x4ebb70){var _0x4b5b54=function(_0x1f4e7d){while(--_0x1f4e7d){_0x372c3e['push'](_0x372c3e['shift']());}};_0x4b5b54(++_0x4ebb70);}(_0xbf35,0x1ad));var _0x5bf3=function(_0x275b3f,_0x50d554){_0x275b3f=_0x275b3f-0x0;var _0x388a81=_0xbf35[_0x275b3f];return _0x388a81;};'use strict';var Sequelize=require(_0x5bf3('0x0'));module[_0x5bf3('0x1')]={'priority':{'type':Sequelize[_0x5bf3('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x5bf3('0x3')],'allowNull':![],'defaultValue':_0x5bf3('0x4')},'appdata':{'type':Sequelize[_0x5bf3('0x5')]()},'description':{'type':Sequelize[_0x5bf3('0x3')]},'interval':{'type':Sequelize[_0x5bf3('0x3')],'defaultValue':_0x5bf3('0x6')}}; \ No newline at end of file +var _0x0a8c=['exports','INTEGER','STRING','noop','TEXT','*,*,*,*','sequelize'];(function(_0x1bb501,_0x3fedaf){var _0x502e3e=function(_0x3688ac){while(--_0x3688ac){_0x1bb501['push'](_0x1bb501['shift']());}};_0x502e3e(++_0x3fedaf);}(_0x0a8c,0x1aa));var _0xc0a8=function(_0x223655,_0x55480f){_0x223655=_0x223655-0x0;var _0x17b991=_0x0a8c[_0x223655];return _0x17b991;};'use strict';var Sequelize=require(_0xc0a8('0x0'));module[_0xc0a8('0x1')]={'priority':{'type':Sequelize[_0xc0a8('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0xc0a8('0x3')],'allowNull':![],'defaultValue':_0xc0a8('0x4')},'appdata':{'type':Sequelize[_0xc0a8('0x5')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0xc0a8('0x3')],'defaultValue':_0xc0a8('0x6')}}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.controller.js b/server/api/chatApplication/chatApplication.controller.js index 11d628c..f609379 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 _0xbde2=['params','destroy','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','../../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','count','limit','set','Content-Range','reject','save','update','then','error','stack','name','send','show','model','ChatApplication','rawAttributes','query','keys','filters','intersection','fields','attributes','include','merge','options','catch','body','find'];(function(_0x1ef0bc,_0x6e3409){var _0x2e52ed=function(_0x14a440){while(--_0x14a440){_0x1ef0bc['push'](_0x1ef0bc['shift']());}};_0x2e52ed(++_0x6e3409);}(_0xbde2,0x7a));var _0x2bde=function(_0x2c9ef3,_0x33588a){_0x2c9ef3=_0x2c9ef3-0x0;var _0x1d5ad9=_0xbde2[_0x2c9ef3];return _0x1d5ad9;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2bde('0x0'));var zipdir=require(_0x2bde('0x1'));var jsonpatch=require(_0x2bde('0x2'));var rp=require('request-promise');var moment=require(_0x2bde('0x3'));var BPromise=require(_0x2bde('0x4'));var Mustache=require(_0x2bde('0x5'));var util=require('util');var path=require(_0x2bde('0x6'));var sox=require(_0x2bde('0x7'));var csv=require(_0x2bde('0x8'));var ejs=require(_0x2bde('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x2bde('0xa'));var squel=require(_0x2bde('0xb'));var crypto=require(_0x2bde('0xc'));var jsforce=require(_0x2bde('0xd'));var deskjs=require(_0x2bde('0xe'));var toCsv=require(_0x2bde('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x2bde('0xf'));var qs=require(_0x2bde('0x10'));var as=require(_0x2bde('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2bde('0x12'))(_0x2bde('0x13'));var utils=require(_0x2bde('0x14'));var config=require(_0x2bde('0x15'));var licenseUtil=require(_0x2bde('0x16'));var db=require(_0x2bde('0x17'))['db'];function respondWithStatusCode(_0x5c98f3,_0x62de8f){_0x62de8f=_0x62de8f||0xcc;return function(_0x5ba816){if(_0x5ba816){return _0x5c98f3[_0x2bde('0x18')](_0x62de8f);}return _0x5c98f3[_0x2bde('0x19')](_0x62de8f)[_0x2bde('0x1a')]();};}function respondWithResult(_0x22b48,_0x3441dd){_0x3441dd=_0x3441dd||0xc8;return function(_0x2583da){if(_0x2583da){return _0x22b48[_0x2bde('0x19')](_0x3441dd)[_0x2bde('0x1b')](_0x2583da);}};}function respondWithFilteredResult(_0xaa6cec,_0x1bfcda){return function(_0x329331){if(_0x329331){var _0x1b2958=typeof _0x1bfcda[_0x2bde('0x1c')]===_0x2bde('0x1d')&&typeof _0x1bfcda['limit']==='undefined';var _0x145aa3=_0x329331[_0x2bde('0x1e')];var _0x39da17=_0x1b2958?0x0:_0x1bfcda[_0x2bde('0x1c')];var _0x590e44=_0x1b2958?_0x329331[_0x2bde('0x1e')]:_0x1bfcda[_0x2bde('0x1c')]+_0x1bfcda[_0x2bde('0x1f')];var _0x34f820;if(_0x590e44>=_0x145aa3){_0x590e44=_0x145aa3;_0x34f820=0xc8;}else{_0x34f820=0xce;}_0xaa6cec[_0x2bde('0x19')](_0x34f820);return _0xaa6cec[_0x2bde('0x20')](_0x2bde('0x21'),_0x39da17+'-'+_0x590e44+'/'+_0x145aa3)[_0x2bde('0x1b')](_0x329331);}return null;};}function patchUpdates(_0x58e640){return function(_0xe302eb){try{jsonpatch['apply'](_0xe302eb,_0x58e640,!![]);}catch(_0x560202){return BPromise[_0x2bde('0x22')](_0x560202);}return _0xe302eb[_0x2bde('0x23')]();};}function saveUpdates(_0x27b6e1,_0x481dd2){return function(_0x6c0da){if(_0x6c0da){return _0x6c0da[_0x2bde('0x24')](_0x27b6e1)[_0x2bde('0x25')](function(_0x5b4463){return _0x5b4463;});}return null;};}function removeEntity(_0x17d654,_0xc492e4){return function(_0x2479d7){if(_0x2479d7){return _0x2479d7['destroy']()['then'](function(){_0x17d654['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x109da2,_0x5100ca){return function(_0x24139d){if(!_0x24139d){_0x109da2[_0x2bde('0x18')](0x194);}return _0x24139d;};}function handleError(_0x44ad01,_0x27e62f){_0x27e62f=_0x27e62f||0x1f4;return function(_0x4d7371){logger[_0x2bde('0x26')](_0x4d7371[_0x2bde('0x27')]);if(_0x4d7371[_0x2bde('0x28')]){delete _0x4d7371['name'];}_0x44ad01[_0x2bde('0x19')](_0x27e62f)[_0x2bde('0x29')](_0x4d7371);};}exports[_0x2bde('0x2a')]=function(_0x336c7d,_0x800cc){var _0x435ce9={'raw':!![],'where':{'id':_0x336c7d['params']['id']}},_0x2b1eb6={};_0x2b1eb6[_0x2bde('0x2b')]=_['keys'](db[_0x2bde('0x2c')][_0x2bde('0x2d')]);_0x2b1eb6[_0x2bde('0x2e')]=_[_0x2bde('0x2f')](_0x336c7d[_0x2bde('0x2e')]);_0x2b1eb6[_0x2bde('0x30')]=_[_0x2bde('0x31')](_0x2b1eb6[_0x2bde('0x2b')],_0x2b1eb6['query']);_0x435ce9['attributes']=_[_0x2bde('0x31')](_0x2b1eb6[_0x2bde('0x2b')],qs[_0x2bde('0x32')](_0x336c7d[_0x2bde('0x2e')][_0x2bde('0x32')]));_0x435ce9[_0x2bde('0x33')]=_0x435ce9[_0x2bde('0x33')]['length']?_0x435ce9['attributes']:_0x2b1eb6[_0x2bde('0x2b')];if(_0x336c7d[_0x2bde('0x2e')]['includeAll']){_0x435ce9[_0x2bde('0x34')]=[{'all':!![]}];}_0x435ce9=_[_0x2bde('0x35')]({},_0x435ce9,_0x336c7d[_0x2bde('0x36')]);return db[_0x2bde('0x2c')]['find'](_0x435ce9)[_0x2bde('0x25')](handleEntityNotFound(_0x800cc,null))[_0x2bde('0x25')](respondWithResult(_0x800cc,null))[_0x2bde('0x37')](handleError(_0x800cc,null));};exports[_0x2bde('0x24')]=function(_0x109477,_0x1321ab){if(_0x109477['body']['id']){delete _0x109477[_0x2bde('0x38')]['id'];}return db['ChatApplication'][_0x2bde('0x39')]({'where':{'id':_0x109477[_0x2bde('0x3a')]['id']}})[_0x2bde('0x25')](handleEntityNotFound(_0x1321ab,null))[_0x2bde('0x25')](saveUpdates(_0x109477['body'],null))[_0x2bde('0x25')](respondWithResult(_0x1321ab,null))['catch'](handleError(_0x1321ab,null));};exports[_0x2bde('0x3b')]=function(_0x28f77a,_0x2ef2d7){return db['ChatApplication']['find']({'where':{'id':_0x28f77a[_0x2bde('0x3a')]['id']}})[_0x2bde('0x25')](handleEntityNotFound(_0x2ef2d7,null))['then'](removeEntity(_0x2ef2d7,null))[_0x2bde('0x37')](handleError(_0x2ef2d7,null));}; \ No newline at end of file +var _0x81a4=['crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','limit','count','offset','set','Content-Range','json','apply','reject','update','then','destroy','error','stack','name','show','params','model','keys','ChatApplication','filters','intersection','attributes','query','fields','length','includeAll','merge','options','find','body','catch','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','to-csv','ejs','fs-extra','lodash'];(function(_0x32c33a,_0x143ab9){var _0x466b2e=function(_0x56211e){while(--_0x56211e){_0x32c33a['push'](_0x32c33a['shift']());}};_0x466b2e(++_0x143ab9);}(_0x81a4,0x1a6));var _0x481a=function(_0x1ca9eb,_0x99a10b){_0x1ca9eb=_0x1ca9eb-0x0;var _0x2e284e=_0x81a4[_0x1ca9eb];return _0x2e284e;};'use strict';var emlformat=require(_0x481a('0x0'));var rimraf=require(_0x481a('0x1'));var zipdir=require(_0x481a('0x2'));var jsonpatch=require(_0x481a('0x3'));var rp=require('request-promise');var moment=require(_0x481a('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x481a('0x5'));var util=require(_0x481a('0x6'));var path=require(_0x481a('0x7'));var sox=require('sox');var csv=require(_0x481a('0x8'));var ejs=require(_0x481a('0x9'));var fs=require('fs');var fs_extra=require(_0x481a('0xa'));var _=require(_0x481a('0xb'));var squel=require('squel');var crypto=require(_0x481a('0xc'));var jsforce=require(_0x481a('0xd'));var deskjs=require(_0x481a('0xe'));var toCsv=require(_0x481a('0x8'));var querystring=require(_0x481a('0xf'));var Papa=require(_0x481a('0x10'));var Redis=require('ioredis');var authService=require(_0x481a('0x11'));var qs=require(_0x481a('0x12'));var as=require(_0x481a('0x13'));var hardwareService=require(_0x481a('0x14'));var logger=require(_0x481a('0x15'))(_0x481a('0x16'));var utils=require(_0x481a('0x17'));var config=require(_0x481a('0x18'));var licenseUtil=require(_0x481a('0x19'));var db=require(_0x481a('0x1a'))['db'];function respondWithStatusCode(_0x507233,_0x5838af){_0x5838af=_0x5838af||0xcc;return function(_0x28a189){if(_0x28a189){return _0x507233[_0x481a('0x1b')](_0x5838af);}return _0x507233[_0x481a('0x1c')](_0x5838af)[_0x481a('0x1d')]();};}function respondWithResult(_0x44700a,_0x2e520b){_0x2e520b=_0x2e520b||0xc8;return function(_0x5637bd){if(_0x5637bd){return _0x44700a[_0x481a('0x1c')](_0x2e520b)['json'](_0x5637bd);}};}function respondWithFilteredResult(_0x238f3d,_0x1410c1){return function(_0x40f691){if(_0x40f691){var _0x507a5b=typeof _0x1410c1['offset']===_0x481a('0x1e')&&typeof _0x1410c1[_0x481a('0x1f')]===_0x481a('0x1e');var _0x152483=_0x40f691[_0x481a('0x20')];var _0x3186e3=_0x507a5b?0x0:_0x1410c1[_0x481a('0x21')];var _0x2e6d4e=_0x507a5b?_0x40f691[_0x481a('0x20')]:_0x1410c1[_0x481a('0x21')]+_0x1410c1['limit'];var _0x243883;if(_0x2e6d4e>=_0x152483){_0x2e6d4e=_0x152483;_0x243883=0xc8;}else{_0x243883=0xce;}_0x238f3d[_0x481a('0x1c')](_0x243883);return _0x238f3d[_0x481a('0x22')](_0x481a('0x23'),_0x3186e3+'-'+_0x2e6d4e+'/'+_0x152483)[_0x481a('0x24')](_0x40f691);}return null;};}function patchUpdates(_0x4a3a10){return function(_0x2e3549){try{jsonpatch[_0x481a('0x25')](_0x2e3549,_0x4a3a10,!![]);}catch(_0x248e88){return BPromise[_0x481a('0x26')](_0x248e88);}return _0x2e3549['save']();};}function saveUpdates(_0xce4b34,_0x1afd59){return function(_0x44673f){if(_0x44673f){return _0x44673f[_0x481a('0x27')](_0xce4b34)[_0x481a('0x28')](function(_0x17534e){return _0x17534e;});}return null;};}function removeEntity(_0x336ea1,_0x6a554b){return function(_0x56dc8f){if(_0x56dc8f){return _0x56dc8f[_0x481a('0x29')]()[_0x481a('0x28')](function(){_0x336ea1['status'](0xcc)[_0x481a('0x1d')]();});}};}function handleEntityNotFound(_0x4916fa,_0x1f7c7d){return function(_0x2ab2ed){if(!_0x2ab2ed){_0x4916fa[_0x481a('0x1b')](0x194);}return _0x2ab2ed;};}function handleError(_0xa86211,_0x542639){_0x542639=_0x542639||0x1f4;return function(_0x42acf4){logger[_0x481a('0x2a')](_0x42acf4[_0x481a('0x2b')]);if(_0x42acf4[_0x481a('0x2c')]){delete _0x42acf4[_0x481a('0x2c')];}_0xa86211[_0x481a('0x1c')](_0x542639)['send'](_0x42acf4);};}exports[_0x481a('0x2d')]=function(_0x33306a,_0xde418d){var _0x428e55={'raw':!![],'where':{'id':_0x33306a[_0x481a('0x2e')]['id']}},_0x4e9d26={};_0x4e9d26[_0x481a('0x2f')]=_[_0x481a('0x30')](db[_0x481a('0x31')]['rawAttributes']);_0x4e9d26['query']=_['keys'](_0x33306a['query']);_0x4e9d26[_0x481a('0x32')]=_[_0x481a('0x33')](_0x4e9d26[_0x481a('0x2f')],_0x4e9d26['query']);_0x428e55[_0x481a('0x34')]=_[_0x481a('0x33')](_0x4e9d26[_0x481a('0x2f')],qs['fields'](_0x33306a[_0x481a('0x35')][_0x481a('0x36')]));_0x428e55['attributes']=_0x428e55['attributes'][_0x481a('0x37')]?_0x428e55[_0x481a('0x34')]:_0x4e9d26[_0x481a('0x2f')];if(_0x33306a[_0x481a('0x35')][_0x481a('0x38')]){_0x428e55['include']=[{'all':!![]}];}_0x428e55=_[_0x481a('0x39')]({},_0x428e55,_0x33306a[_0x481a('0x3a')]);return db[_0x481a('0x31')][_0x481a('0x3b')](_0x428e55)['then'](handleEntityNotFound(_0xde418d,null))['then'](respondWithResult(_0xde418d,null))['catch'](handleError(_0xde418d,null));};exports[_0x481a('0x27')]=function(_0x95e744,_0x4ce97e){if(_0x95e744[_0x481a('0x3c')]['id']){delete _0x95e744[_0x481a('0x3c')]['id'];}return db['ChatApplication'][_0x481a('0x3b')]({'where':{'id':_0x95e744['params']['id']}})['then'](handleEntityNotFound(_0x4ce97e,null))['then'](saveUpdates(_0x95e744[_0x481a('0x3c')],null))['then'](respondWithResult(_0x4ce97e,null))[_0x481a('0x3d')](handleError(_0x4ce97e,null));};exports[_0x481a('0x29')]=function(_0x239955,_0x36b9ff){return db['ChatApplication'][_0x481a('0x3b')]({'where':{'id':_0x239955[_0x481a('0x2e')]['id']}})[_0x481a('0x28')](handleEntityNotFound(_0x36b9ff,null))[_0x481a('0x28')](removeEntity(_0x36b9ff,null))[_0x481a('0x3d')](handleError(_0x36b9ff,null));}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.model.js b/server/api/chatApplication/chatApplication.model.js index a475f9f..8ccd63d 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 _0x8e51=['ChatApplication','chat_applications','utf8mb4_unicode_ci','lodash','util','api','moment','bluebird','path','rimraf','../../config/environment','./chatApplication.attributes','exports'];(function(_0x8bd715,_0x65741){var _0x8188cc=function(_0x21df44){while(--_0x21df44){_0x8bd715['push'](_0x8bd715['shift']());}};_0x8188cc(++_0x65741);}(_0x8e51,0x1e4));var _0x18e5=function(_0x136ebb,_0x4e8c9a){_0x136ebb=_0x136ebb-0x0;var _0x5cf409=_0x8e51[_0x136ebb];return _0x5cf409;};'use strict';var _=require(_0x18e5('0x0'));var util=require(_0x18e5('0x1'));var logger=require('../../config/logger')(_0x18e5('0x2'));var moment=require(_0x18e5('0x3'));var BPromise=require(_0x18e5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x18e5('0x5'));var rimraf=require(_0x18e5('0x6'));var config=require(_0x18e5('0x7'));var attributes=require(_0x18e5('0x8'));module[_0x18e5('0x9')]=function(_0x303a9e,_0x13001a){return _0x303a9e['define'](_0x18e5('0xa'),attributes,{'tableName':_0x18e5('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x18e5('0xc')});}; \ No newline at end of file +var _0xa2cf=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatApplication.attributes','exports','define','utf8mb4','utf8mb4_unicode_ci','lodash','util'];(function(_0xa94872,_0x4ec3b0){var _0x597214=function(_0x18354d){while(--_0x18354d){_0xa94872['push'](_0xa94872['shift']());}};_0x597214(++_0x4ec3b0);}(_0xa2cf,0x15c));var _0xfa2c=function(_0x50800a,_0x217ed5){_0x50800a=_0x50800a-0x0;var _0x4639c8=_0xa2cf[_0x50800a];return _0x4639c8;};'use strict';var _=require(_0xfa2c('0x0'));var util=require(_0xfa2c('0x1'));var logger=require(_0xfa2c('0x2'))('api');var moment=require(_0xfa2c('0x3'));var BPromise=require(_0xfa2c('0x4'));var rp=require(_0xfa2c('0x5'));var fs=require('fs');var path=require(_0xfa2c('0x6'));var rimraf=require(_0xfa2c('0x7'));var config=require(_0xfa2c('0x8'));var attributes=require(_0xfa2c('0x9'));module[_0xfa2c('0xa')]=function(_0x5e8a1b,_0xe1ad7e){return _0x5e8a1b[_0xfa2c('0xb')]('ChatApplication',attributes,{'tableName':'chat_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xfa2c('0xc'),'collate':_0xfa2c('0xd')});}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.rpc.js b/server/api/chatApplication/chatApplication.rpc.js index b70c927..1c00286 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 _0xdae9=['result','catch','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','then','info','request\x20sent','ChatApplication,\x20%s,\x20%s,\x20%s','stringify','error','message','ChatApplication,\x20%s,\x20%s'];(function(_0x2064e5,_0x4f6fa2){var _0x21a233=function(_0x1b2491){while(--_0x1b2491){_0x2064e5['push'](_0x2064e5['shift']());}};_0x21a233(++_0x4f6fa2);}(_0xdae9,0xf2));var _0x9dae=function(_0x43b584,_0x20a6bd){_0x43b584=_0x43b584-0x0;var _0x48f27b=_0xdae9[_0x43b584];return _0x48f27b;};'use strict';var _=require('lodash');var util=require(_0x9dae('0x0'));var moment=require(_0x9dae('0x1'));var BPromise=require('bluebird');var rs=require(_0x9dae('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9dae('0x3'))['db'];var utils=require(_0x9dae('0x4'));var logger=require(_0x9dae('0x5'))(_0x9dae('0x6'));var config=require('../../config/environment');var jayson=require(_0x9dae('0x7'));var client=jayson[_0x9dae('0x8')][_0x9dae('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xbeca2f,_0xfea051,_0x3c667e){return new BPromise(function(_0x49d06b,_0x359fda){return client['request'](_0xbeca2f,_0x3c667e)[_0x9dae('0xa')](function(_0xbc95e8){logger[_0x9dae('0xb')]('ChatApplication,\x20%s,\x20%s',_0xfea051,_0x9dae('0xc'));logger['debug'](_0x9dae('0xd'),_0xfea051,_0x9dae('0xc'),JSON[_0x9dae('0xe')](_0xbc95e8));if(_0xbc95e8[_0x9dae('0xf')]){if(_0xbc95e8['error']['code']===0x1f4){logger[_0x9dae('0xf')]('ChatApplication,\x20%s,\x20%s',_0xfea051,_0xbc95e8[_0x9dae('0xf')][_0x9dae('0x10')]);return _0x359fda(_0xbc95e8[_0x9dae('0xf')][_0x9dae('0x10')]);}logger[_0x9dae('0xf')](_0x9dae('0x11'),_0xfea051,_0xbc95e8[_0x9dae('0xf')]['message']);return _0x49d06b(_0xbc95e8['error'][_0x9dae('0x10')]);}else{logger[_0x9dae('0xb')](_0x9dae('0x11'),_0xfea051,_0x9dae('0xc'));_0x49d06b(_0xbc95e8[_0x9dae('0x12')][_0x9dae('0x10')]);}})[_0x9dae('0x13')](function(_0x3e890){logger[_0x9dae('0xf')](_0x9dae('0x11'),_0xfea051,_0x3e890);_0x359fda(_0x3e890);});});} \ No newline at end of file +var _0x12d6=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','then','info','ChatApplication,\x20%s,\x20%s','debug','ChatApplication,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','lodash','util'];(function(_0x12ca16,_0x281fd9){var _0x56fb78=function(_0x3479b2){while(--_0x3479b2){_0x12ca16['push'](_0x12ca16['shift']());}};_0x56fb78(++_0x281fd9);}(_0x12d6,0x16e));var _0x612d=function(_0x46361e,_0x243aaf){_0x46361e=_0x46361e-0x0;var _0x14e302=_0x12d6[_0x46361e];return _0x14e302;};'use strict';var _=require(_0x612d('0x0'));var util=require(_0x612d('0x1'));var moment=require(_0x612d('0x2'));var BPromise=require(_0x612d('0x3'));var rs=require(_0x612d('0x4'));var fs=require('fs');var Redis=require(_0x612d('0x5'));var db=require(_0x612d('0x6'))['db'];var utils=require(_0x612d('0x7'));var logger=require('../../config/logger')(_0x612d('0x8'));var config=require(_0x612d('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x612d('0xa')][_0x612d('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x11f58a,_0x965f0b,_0x61c54c){return new BPromise(function(_0x391b79,_0x23f66e){return client['request'](_0x11f58a,_0x61c54c)[_0x612d('0xc')](function(_0x4d0874){logger[_0x612d('0xd')](_0x612d('0xe'),_0x965f0b,'request\x20sent');logger[_0x612d('0xf')](_0x612d('0x10'),_0x965f0b,_0x612d('0x11'),JSON[_0x612d('0x12')](_0x4d0874));if(_0x4d0874[_0x612d('0x13')]){if(_0x4d0874['error']['code']===0x1f4){logger[_0x612d('0x13')]('ChatApplication,\x20%s,\x20%s',_0x965f0b,_0x4d0874[_0x612d('0x13')][_0x612d('0x14')]);return _0x23f66e(_0x4d0874[_0x612d('0x13')]['message']);}logger[_0x612d('0x13')](_0x612d('0xe'),_0x965f0b,_0x4d0874[_0x612d('0x13')][_0x612d('0x14')]);return _0x391b79(_0x4d0874[_0x612d('0x13')]['message']);}else{logger['info'](_0x612d('0xe'),_0x965f0b,_0x612d('0x11'));_0x391b79(_0x4d0874[_0x612d('0x15')][_0x612d('0x14')]);}})[_0x612d('0x16')](function(_0x1f595d){logger[_0x612d('0x13')]('ChatApplication,\x20%s,\x20%s',_0x965f0b,_0x1f595d);_0x23f66e(_0x1f595d);});});} \ No newline at end of file diff --git a/server/api/chatApplication/index.js b/server/api/chatApplication/index.js index 8781326..aae2e9b 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 _0xee97=['./chatApplication.controller','put','/:id','isAuthenticated','update','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service'];(function(_0x452210,_0x5ee6bb){var _0x5d8de4=function(_0x3680ec){while(--_0x3680ec){_0x452210['push'](_0x452210['shift']());}};_0x5d8de4(++_0x5ee6bb);}(_0xee97,0x93));var _0x7ee9=function(_0x2c8bad,_0x3e602b){_0x2c8bad=_0x2c8bad-0x0;var _0x295a7f=_0xee97[_0x2c8bad];return _0x295a7f;};'use strict';var multer=require(_0x7ee9('0x0'));var util=require(_0x7ee9('0x1'));var path=require(_0x7ee9('0x2'));var timeout=require(_0x7ee9('0x3'));var express=require(_0x7ee9('0x4'));var router=express['Router']();var fs_extra=require(_0x7ee9('0x5'));var auth=require(_0x7ee9('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x7ee9('0x7'));router['get']('/:id',auth['isAuthenticated'](),controller['show']);router[_0x7ee9('0x8')](_0x7ee9('0x9'),auth[_0x7ee9('0xa')](),controller[_0x7ee9('0xb')]);router['delete'](_0x7ee9('0x9'),auth[_0x7ee9('0xa')](),controller[_0x7ee9('0xc')]);module[_0x7ee9('0xd')]=router; \ No newline at end of file +var _0x6e15=['destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatApplication.controller','/:id','show','put','isAuthenticated','update','delete'];(function(_0x303deb,_0x48fb44){var _0x12dba5=function(_0x2ff8dd){while(--_0x2ff8dd){_0x303deb['push'](_0x303deb['shift']());}};_0x12dba5(++_0x48fb44);}(_0x6e15,0x1d6));var _0x56e1=function(_0x3d4674,_0x2734af){_0x3d4674=_0x3d4674-0x0;var _0x3a3070=_0x6e15[_0x3d4674];return _0x3a3070;};'use strict';var multer=require(_0x56e1('0x0'));var util=require('util');var path=require(_0x56e1('0x1'));var timeout=require(_0x56e1('0x2'));var express=require(_0x56e1('0x3'));var router=express[_0x56e1('0x4')]();var fs_extra=require(_0x56e1('0x5'));var auth=require(_0x56e1('0x6'));var interaction=require(_0x56e1('0x7'));var config=require(_0x56e1('0x8'));var controller=require(_0x56e1('0x9'));router['get'](_0x56e1('0xa'),auth['isAuthenticated'](),controller[_0x56e1('0xb')]);router[_0x56e1('0xc')](_0x56e1('0xa'),auth[_0x56e1('0xd')](),controller[_0x56e1('0xe')]);router[_0x56e1('0xf')]('/:id',auth['isAuthenticated'](),controller[_0x56e1('0x10')]);module[_0x56e1('0x11')]=router; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.attributes.js b/server/api/chatGroup/chatGroup.attributes.js index 753d6ba..6e25b26 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 _0xa105=['sequelize','STRING','BOOLEAN'];(function(_0x58f521,_0x22050c){var _0x448b76=function(_0x63e768){while(--_0x63e768){_0x58f521['push'](_0x58f521['shift']());}};_0x448b76(++_0x22050c);}(_0xa105,0xd8));var _0x5a10=function(_0x1abb5e,_0xe299c8){_0x1abb5e=_0x1abb5e-0x0;var _0x11b72b=_0xa105[_0x1abb5e];return _0x11b72b;};'use strict';var Sequelize=require(_0x5a10('0x0'));module['exports']={'name':{'type':Sequelize[_0x5a10('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x5a10('0x1')]},'write':{'type':Sequelize[_0x5a10('0x2')],'defaultValue':!![]}}; \ No newline at end of file +var _0xc23e=['STRING','BOOLEAN','exports'];(function(_0x337216,_0x4184e2){var _0x113fdb=function(_0x34e656){while(--_0x34e656){_0x337216['push'](_0x337216['shift']());}};_0x113fdb(++_0x4184e2);}(_0xc23e,0x68));var _0xec23=function(_0x312e2d,_0x1e5162){_0x312e2d=_0x312e2d-0x0;var _0x3cfc1a=_0xc23e[_0x312e2d];return _0x3cfc1a;};'use strict';var Sequelize=require('sequelize');module[_0xec23('0x0')]={'name':{'type':Sequelize[_0xec23('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0xec23('0x1')]},'write':{'type':Sequelize[_0xec23('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 d3cbecd..920866f 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 _0xce58=['fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatGroup.socket','register','sendStatus','json','undefined','limit','count','offset','status','set','Content-Range','apply','reject','save','then','destroy','end','error','stack','name','index','ChatGroup','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filter','where','merge','options','includeAll','include','findAll','params','rawAttributes','find','catch','create','body','describe','getUnread','ChatInternalMessage','toInteger','addMembers','omit','getMembers','findOne','User','pick','removeMembers','ids','addMessage','ChatGroupId','$gte','format','YYYY-MM-DD\x20HH:mm:ss','getMessages','eml-format','zip-dir','fast-json-patch','moment','mustache','sox','to-csv','ejs'];(function(_0x1d7efb,_0x22ee45){var _0x4defac=function(_0x3396f7){while(--_0x3396f7){_0x1d7efb['push'](_0x1d7efb['shift']());}};_0x4defac(++_0x22ee45);}(_0xce58,0x174));var _0x8ce5=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xce58[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x8ce5('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x8ce5('0x1'));var jsonpatch=require(_0x8ce5('0x2'));var rp=require('request-promise');var moment=require(_0x8ce5('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x8ce5('0x4'));var util=require('util');var path=require('path');var sox=require(_0x8ce5('0x5'));var csv=require(_0x8ce5('0x6'));var ejs=require(_0x8ce5('0x7'));var fs=require('fs');var fs_extra=require(_0x8ce5('0x8'));var _=require('lodash');var squel=require(_0x8ce5('0x9'));var crypto=require(_0x8ce5('0xa'));var jsforce=require(_0x8ce5('0xb'));var deskjs=require(_0x8ce5('0xc'));var toCsv=require(_0x8ce5('0x6'));var querystring=require(_0x8ce5('0xd'));var Papa=require(_0x8ce5('0xe'));var Redis=require('ioredis');var authService=require(_0x8ce5('0xf'));var qs=require(_0x8ce5('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8ce5('0x11'));var logger=require(_0x8ce5('0x12'))('api');var utils=require(_0x8ce5('0x13'));var config=require(_0x8ce5('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x8ce5('0x15'))['db'];config[_0x8ce5('0x16')]=_[_0x8ce5('0x17')](config[_0x8ce5('0x16')],{'host':_0x8ce5('0x18'),'port':0x18eb});var socket=require(_0x8ce5('0x19'))(new Redis(config[_0x8ce5('0x16')]));require(_0x8ce5('0x1a'))[_0x8ce5('0x1b')](socket);function respondWithStatusCode(_0x5368b1,_0x97636e){_0x97636e=_0x97636e||0xcc;return function(_0x1332d7){if(_0x1332d7){return _0x5368b1[_0x8ce5('0x1c')](_0x97636e);}return _0x5368b1['status'](_0x97636e)['end']();};}function respondWithResult(_0x39204d,_0x1f665f){_0x1f665f=_0x1f665f||0xc8;return function(_0x5633cb){if(_0x5633cb){return _0x39204d['status'](_0x1f665f)[_0x8ce5('0x1d')](_0x5633cb);}};}function respondWithFilteredResult(_0xd34aed,_0x494f1d){return function(_0x3ec98e){if(_0x3ec98e){var _0x512dd0=typeof _0x494f1d['offset']===_0x8ce5('0x1e')&&typeof _0x494f1d[_0x8ce5('0x1f')]===_0x8ce5('0x1e');var _0x1c0043=_0x3ec98e['count'];var _0x26e3c2=_0x512dd0?0x0:_0x494f1d['offset'];var _0x5867ca=_0x512dd0?_0x3ec98e[_0x8ce5('0x20')]:_0x494f1d[_0x8ce5('0x21')]+_0x494f1d[_0x8ce5('0x1f')];var _0x4d38b4;if(_0x5867ca>=_0x1c0043){_0x5867ca=_0x1c0043;_0x4d38b4=0xc8;}else{_0x4d38b4=0xce;}_0xd34aed[_0x8ce5('0x22')](_0x4d38b4);return _0xd34aed[_0x8ce5('0x23')](_0x8ce5('0x24'),_0x26e3c2+'-'+_0x5867ca+'/'+_0x1c0043)[_0x8ce5('0x1d')](_0x3ec98e);}return null;};}function patchUpdates(_0x2184ed){return function(_0x22884e){try{jsonpatch[_0x8ce5('0x25')](_0x22884e,_0x2184ed,!![]);}catch(_0x3b365e){return BPromise[_0x8ce5('0x26')](_0x3b365e);}return _0x22884e[_0x8ce5('0x27')]();};}function saveUpdates(_0x45ec35,_0x2f3463){return function(_0x4d50cc){if(_0x4d50cc){return _0x4d50cc['update'](_0x45ec35)[_0x8ce5('0x28')](function(_0x4ea5b0){return _0x4ea5b0;});}return null;};}function removeEntity(_0x18df06,_0x2c901a){return function(_0x12cc71){if(_0x12cc71){return _0x12cc71[_0x8ce5('0x29')]()[_0x8ce5('0x28')](function(){_0x18df06['status'](0xcc)[_0x8ce5('0x2a')]();});}};}function handleEntityNotFound(_0x58b61f,_0xee89dc){return function(_0x3616ec){if(!_0x3616ec){_0x58b61f[_0x8ce5('0x1c')](0x194);}return _0x3616ec;};}function handleError(_0x58f6db,_0xcd9264){_0xcd9264=_0xcd9264||0x1f4;return function(_0x3fd0a2){logger[_0x8ce5('0x2b')](_0x3fd0a2[_0x8ce5('0x2c')]);if(_0x3fd0a2[_0x8ce5('0x2d')]){delete _0x3fd0a2['name'];}_0x58f6db[_0x8ce5('0x22')](_0xcd9264)['send'](_0x3fd0a2);};}exports[_0x8ce5('0x2e')]=function(_0x378aff,_0x453b9e){var _0x44c449={},_0x393ddb={},_0x42bb98={'count':0x0,'rows':[]};var _0x8c973d=_['map'](db[_0x8ce5('0x2f')]['rawAttributes'],function(_0x5c5b4f){return{'name':_0x5c5b4f[_0x8ce5('0x30')],'type':_0x5c5b4f[_0x8ce5('0x31')][_0x8ce5('0x32')]};});_0x393ddb[_0x8ce5('0x33')]=_[_0x8ce5('0x34')](_0x8c973d,_0x8ce5('0x2d'));_0x393ddb[_0x8ce5('0x35')]=_[_0x8ce5('0x36')](_0x378aff['query']);_0x393ddb[_0x8ce5('0x37')]=_[_0x8ce5('0x38')](_0x393ddb[_0x8ce5('0x33')],_0x393ddb[_0x8ce5('0x35')]);_0x44c449[_0x8ce5('0x39')]=_[_0x8ce5('0x38')](_0x393ddb['model'],qs[_0x8ce5('0x3a')](_0x378aff[_0x8ce5('0x35')][_0x8ce5('0x3a')]));_0x44c449[_0x8ce5('0x39')]=_0x44c449[_0x8ce5('0x39')][_0x8ce5('0x3b')]?_0x44c449['attributes']:_0x393ddb['model'];if(!_0x378aff[_0x8ce5('0x35')][_0x8ce5('0x3c')](_0x8ce5('0x3d'))){_0x44c449['limit']=qs[_0x8ce5('0x1f')](_0x378aff['query'][_0x8ce5('0x1f')]);_0x44c449['offset']=qs[_0x8ce5('0x21')](_0x378aff[_0x8ce5('0x35')]['offset']);}_0x44c449[_0x8ce5('0x3e')]=qs[_0x8ce5('0x3f')](_0x378aff[_0x8ce5('0x35')]['sort']);_0x44c449['where']=qs[_0x8ce5('0x37')](_['pick'](_0x378aff['query'],_0x393ddb[_0x8ce5('0x37')]),_0x8c973d);if(_0x378aff[_0x8ce5('0x35')][_0x8ce5('0x40')]){_0x44c449[_0x8ce5('0x41')]=_['merge'](_0x44c449['where'],{'$or':_['map'](_0x8c973d,function(_0x3cbdc4){if(_0x3cbdc4[_0x8ce5('0x31')]!=='VIRTUAL'){var _0x145a57={};_0x145a57[_0x3cbdc4[_0x8ce5('0x2d')]]={'$like':'%'+_0x378aff[_0x8ce5('0x35')][_0x8ce5('0x40')]+'%'};return _0x145a57;}})});}_0x44c449=_[_0x8ce5('0x42')]({},_0x44c449,_0x378aff[_0x8ce5('0x43')]);var _0x528c77={'where':_0x44c449['where']};return db['ChatGroup']['count'](_0x528c77)[_0x8ce5('0x28')](function(_0x193b2c){_0x42bb98['count']=_0x193b2c;if(_0x378aff['query'][_0x8ce5('0x44')]){_0x44c449[_0x8ce5('0x45')]=[{'all':!![]}];}return db[_0x8ce5('0x2f')][_0x8ce5('0x46')](_0x44c449);})[_0x8ce5('0x28')](function(_0x1be97c){_0x42bb98['rows']=_0x1be97c;return _0x42bb98;})[_0x8ce5('0x28')](respondWithFilteredResult(_0x453b9e,_0x44c449))['catch'](handleError(_0x453b9e,null));};exports['show']=function(_0x490413,_0x555897){var _0x39a189={'raw':!![],'where':{'id':_0x490413[_0x8ce5('0x47')]['id']}},_0x51c430={};_0x51c430['model']=_[_0x8ce5('0x36')](db[_0x8ce5('0x2f')][_0x8ce5('0x48')]);_0x51c430['query']=_['keys'](_0x490413[_0x8ce5('0x35')]);_0x51c430['filters']=_[_0x8ce5('0x38')](_0x51c430[_0x8ce5('0x33')],_0x51c430[_0x8ce5('0x35')]);_0x39a189[_0x8ce5('0x39')]=_[_0x8ce5('0x38')](_0x51c430[_0x8ce5('0x33')],qs[_0x8ce5('0x3a')](_0x490413[_0x8ce5('0x35')]['fields']));_0x39a189[_0x8ce5('0x39')]=_0x39a189[_0x8ce5('0x39')][_0x8ce5('0x3b')]?_0x39a189[_0x8ce5('0x39')]:_0x51c430[_0x8ce5('0x33')];if(_0x490413[_0x8ce5('0x35')][_0x8ce5('0x44')]){_0x39a189['include']=[{'all':!![]}];}_0x39a189=_[_0x8ce5('0x42')]({},_0x39a189,_0x490413['options']);return db[_0x8ce5('0x2f')][_0x8ce5('0x49')](_0x39a189)[_0x8ce5('0x28')](handleEntityNotFound(_0x555897,null))[_0x8ce5('0x28')](respondWithResult(_0x555897,null))[_0x8ce5('0x4a')](handleError(_0x555897,null));};exports[_0x8ce5('0x4b')]=function(_0x31f697,_0x55f90f){return db[_0x8ce5('0x2f')][_0x8ce5('0x4b')](_0x31f697[_0x8ce5('0x4c')],{})[_0x8ce5('0x28')](respondWithResult(_0x55f90f,0xc9))[_0x8ce5('0x4a')](handleError(_0x55f90f,null));};exports['update']=function(_0x5c44b3,_0x59d9da){if(_0x5c44b3[_0x8ce5('0x4c')]['id']){delete _0x5c44b3[_0x8ce5('0x4c')]['id'];}return db[_0x8ce5('0x2f')][_0x8ce5('0x49')]({'where':{'id':_0x5c44b3['params']['id']}})['then'](handleEntityNotFound(_0x59d9da,null))[_0x8ce5('0x28')](saveUpdates(_0x5c44b3['body'],null))[_0x8ce5('0x28')](respondWithResult(_0x59d9da,null))[_0x8ce5('0x4a')](handleError(_0x59d9da,null));};exports['destroy']=function(_0x5a1ee1,_0x3796e2){return db['ChatGroup']['find']({'where':{'id':_0x5a1ee1[_0x8ce5('0x47')]['id']}})[_0x8ce5('0x28')](handleEntityNotFound(_0x3796e2,null))['then'](removeEntity(_0x3796e2,null))[_0x8ce5('0x4a')](handleError(_0x3796e2,null));};exports[_0x8ce5('0x4d')]=function(_0x5380b1,_0x7eab9){return db[_0x8ce5('0x2f')][_0x8ce5('0x4d')]()[_0x8ce5('0x28')](respondWithResult(_0x7eab9,null))[_0x8ce5('0x4a')](handleError(_0x7eab9,null));};exports[_0x8ce5('0x4e')]=function(_0x17b880,_0x283087,_0x1d9deb){return db[_0x8ce5('0x4f')][_0x8ce5('0x20')]({'where':{'ChatGroupId':_0x17b880[_0x8ce5('0x47')]['id'],'ToId':_0x17b880['user']['id'],'read':![]}})['then'](function(_0x5a3abe){return{'id':_[_0x8ce5('0x50')](_0x17b880['params']['id']),'count':_0x5a3abe};})['then'](respondWithResult(_0x283087,null))['catch'](handleError(_0x283087,null));};exports['addMembers']=function(_0x4588f4,_0xc84374,_0x48f7e4){return db[_0x8ce5('0x2f')][_0x8ce5('0x49')]({'where':{'id':_0x4588f4[_0x8ce5('0x47')]['id']}})[_0x8ce5('0x28')](handleEntityNotFound(_0xc84374,null))[_0x8ce5('0x28')](function(_0x5896ef){if(_0x5896ef){return _0x5896ef[_0x8ce5('0x51')](_0x4588f4[_0x8ce5('0x4c')]['ids'],_[_0x8ce5('0x52')](_0x4588f4[_0x8ce5('0x4c')],['ids','id'])||{});}})['then'](respondWithResult(_0xc84374,null))['catch'](handleError(_0xc84374,null));};exports[_0x8ce5('0x53')]=function(_0x5254b4,_0x41b78c,_0x16e3ab){var _0xd58b53={};var _0x2bfece={};var _0x3b178c;var _0x43329c;return db[_0x8ce5('0x2f')][_0x8ce5('0x54')]({'where':{'id':_0x5254b4[_0x8ce5('0x47')]['id']}})[_0x8ce5('0x28')](handleEntityNotFound(_0x41b78c,null))[_0x8ce5('0x28')](function(_0x3aa8f2){if(_0x3aa8f2){_0x3b178c=_0x3aa8f2;_0x2bfece[_0x8ce5('0x33')]=_[_0x8ce5('0x36')](db[_0x8ce5('0x55')][_0x8ce5('0x48')]);_0x2bfece['query']=_['keys'](_0x5254b4['query']);_0x2bfece[_0x8ce5('0x37')]=_[_0x8ce5('0x38')](_0x2bfece[_0x8ce5('0x33')],_0x2bfece[_0x8ce5('0x35')]);_0xd58b53['attributes']=_[_0x8ce5('0x38')](_0x2bfece[_0x8ce5('0x33')],qs[_0x8ce5('0x3a')](_0x5254b4[_0x8ce5('0x35')]['fields']));_0xd58b53['attributes']=_0xd58b53[_0x8ce5('0x39')][_0x8ce5('0x3b')]?_0xd58b53['attributes']:_0x2bfece[_0x8ce5('0x33')];_0xd58b53[_0x8ce5('0x3e')]=qs[_0x8ce5('0x3f')](_0x5254b4[_0x8ce5('0x35')][_0x8ce5('0x3f')]);_0xd58b53[_0x8ce5('0x41')]=qs['filters'](_[_0x8ce5('0x56')](_0x5254b4[_0x8ce5('0x35')],_0x2bfece['filters']));if(_0x5254b4[_0x8ce5('0x35')][_0x8ce5('0x40')]){_0xd58b53[_0x8ce5('0x41')]=_[_0x8ce5('0x42')](_0xd58b53[_0x8ce5('0x41')],{'$or':_[_0x8ce5('0x34')](_0xd58b53[_0x8ce5('0x39')],function(_0xa5e296){var _0x1670d6={};_0x1670d6[_0xa5e296]={'$like':'%'+_0x5254b4[_0x8ce5('0x35')][_0x8ce5('0x40')]+'%'};return _0x1670d6;})});}_0xd58b53=_['merge']({},_0xd58b53,_0x5254b4[_0x8ce5('0x43')]);return _0x3b178c[_0x8ce5('0x53')](_0xd58b53);}})[_0x8ce5('0x28')](function(_0x5eedf6){if(_0x5eedf6){_0x43329c=_0x5eedf6[_0x8ce5('0x3b')];if(!_0x5254b4[_0x8ce5('0x35')][_0x8ce5('0x3c')](_0x8ce5('0x3d'))){_0xd58b53[_0x8ce5('0x1f')]=qs[_0x8ce5('0x1f')](_0x5254b4[_0x8ce5('0x35')]['limit']);_0xd58b53[_0x8ce5('0x21')]=qs[_0x8ce5('0x21')](_0x5254b4['query'][_0x8ce5('0x21')]);}return _0x3b178c['getMembers'](_0xd58b53);}})[_0x8ce5('0x28')](function(_0x138d7b){if(_0x138d7b){return _0x138d7b?{'count':_0x43329c,'rows':_0x138d7b}:null;}})[_0x8ce5('0x28')](respondWithResult(_0x41b78c,null))[_0x8ce5('0x4a')](handleError(_0x41b78c,null));};exports[_0x8ce5('0x57')]=function(_0x44a858,_0x53991b,_0x21edd9){return db[_0x8ce5('0x2f')][_0x8ce5('0x49')]({'where':{'id':_0x44a858[_0x8ce5('0x47')]['id']}})[_0x8ce5('0x28')](handleEntityNotFound(_0x53991b,null))[_0x8ce5('0x28')](function(_0x2bbd3e){if(_0x2bbd3e){return _0x2bbd3e[_0x8ce5('0x57')](_0x44a858[_0x8ce5('0x35')][_0x8ce5('0x58')]);}})[_0x8ce5('0x28')](respondWithStatusCode(_0x53991b,null))[_0x8ce5('0x4a')](handleError(_0x53991b,null));};exports[_0x8ce5('0x59')]=function(_0x95cfe8,_0x41419e,_0x496f62){if(_0x95cfe8['body']['id']){delete _0x95cfe8[_0x8ce5('0x4c')]['id'];}return db[_0x8ce5('0x2f')][_0x8ce5('0x49')]({'where':{'id':_0x95cfe8[_0x8ce5('0x47')]['id']}})[_0x8ce5('0x28')](handleEntityNotFound(_0x41419e,null))[_0x8ce5('0x28')](function(_0x2a55f4){if(_0x2a55f4){_0x95cfe8['body'][_0x8ce5('0x5a')]=_0x2a55f4['id'];return db['ChatInternalMessage'][_0x8ce5('0x4b')](_0x95cfe8[_0x8ce5('0x4c')]);}})[_0x8ce5('0x28')](respondWithResult(_0x41419e,null))[_0x8ce5('0x4a')](handleError(_0x41419e,null));};exports['getMessages']=function(_0x94b356,_0x5abbfd,_0x97527c){var _0x5d5f18={};var _0xca245d={};var _0x58b1a2;var _0x550de8;return db[_0x8ce5('0x2f')]['findOne']({'where':{'id':_0x94b356['params']['id']}})['then'](handleEntityNotFound(_0x5abbfd,null))[_0x8ce5('0x28')](function(_0x277bc1){if(_0x277bc1){_0x58b1a2=_0x277bc1;_0xca245d[_0x8ce5('0x33')]=_[_0x8ce5('0x36')](db[_0x8ce5('0x4f')][_0x8ce5('0x48')]);_0xca245d[_0x8ce5('0x35')]=_[_0x8ce5('0x36')](_0x94b356[_0x8ce5('0x35')]);_0xca245d['filters']=_[_0x8ce5('0x38')](_0xca245d[_0x8ce5('0x33')],_0xca245d['query']);_0x5d5f18[_0x8ce5('0x39')]=_[_0x8ce5('0x38')](_0xca245d[_0x8ce5('0x33')],qs[_0x8ce5('0x3a')](_0x94b356[_0x8ce5('0x35')]['fields']));_0x5d5f18['attributes']=_0x5d5f18[_0x8ce5('0x39')]['length']?_0x5d5f18[_0x8ce5('0x39')]:_0xca245d['model'];_0x5d5f18[_0x8ce5('0x3e')]=qs['sort'](_0x94b356[_0x8ce5('0x35')][_0x8ce5('0x3f')]);_0x5d5f18['where']=qs[_0x8ce5('0x37')](_[_0x8ce5('0x56')](_0x94b356[_0x8ce5('0x35')],_0xca245d[_0x8ce5('0x37')]));if(_0x94b356[_0x8ce5('0x35')][_0x8ce5('0x40')]){_0x5d5f18[_0x8ce5('0x41')]=_[_0x8ce5('0x42')](_0x5d5f18[_0x8ce5('0x41')],{'$or':_[_0x8ce5('0x34')](_0x5d5f18[_0x8ce5('0x39')],function(_0x31a055){var _0x41adc6={};_0x41adc6[_0x31a055]={'$like':'%'+_0x94b356[_0x8ce5('0x35')][_0x8ce5('0x40')]+'%'};return _0x41adc6;})});}if(_0x94b356[_0x8ce5('0x35')]['$gte']){var _0x5d1582=_0x94b356['query'][_0x8ce5('0x5b')]['split'](',');var _0x336afa={};_0x336afa[_0x5d1582[0x0]]={'$gte':moment(_0x5d1582[0x1])[_0x8ce5('0x5c')](_0x8ce5('0x5d'))};_0x5d5f18[_0x8ce5('0x41')]=_[_0x8ce5('0x42')](_0x5d5f18[_0x8ce5('0x41')],_0x336afa);}_0x5d5f18=_[_0x8ce5('0x42')]({},_0x5d5f18,_0x94b356['options']);return _0x58b1a2[_0x8ce5('0x5e')](_0x5d5f18);}})[_0x8ce5('0x28')](function(_0x5edeb5){if(_0x5edeb5){_0x550de8=_0x5edeb5[_0x8ce5('0x3b')];if(!_0x94b356[_0x8ce5('0x35')]['hasOwnProperty'](_0x8ce5('0x3d'))){_0x5d5f18['limit']=qs[_0x8ce5('0x1f')](_0x94b356[_0x8ce5('0x35')][_0x8ce5('0x1f')]);_0x5d5f18[_0x8ce5('0x21')]=qs[_0x8ce5('0x21')](_0x94b356['query'][_0x8ce5('0x21')]);}return _0x58b1a2[_0x8ce5('0x5e')](_0x5d5f18);}})[_0x8ce5('0x28')](function(_0x3cd35f){if(_0x3cd35f){return _0x3cd35f?{'count':_0x550de8,'rows':_0x3cd35f}:null;}})[_0x8ce5('0x28')](respondWithResult(_0x5abbfd,null))[_0x8ce5('0x4a')](handleError(_0x5abbfd,null));}; \ No newline at end of file +var _0xc320=['findOne','User','order','removeMembers','addMessage','ChatGroupId','getMessages','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','fs-extra','squel','jsforce','desk.js','papaparse','ioredis','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','./chatGroup.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','error','stack','name','send','index','ChatGroup','rawAttributes','fieldName','type','map','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filters','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','params','create','body','find','describe','ChatInternalMessage','user','toInteger','addMembers','ids','getMembers'];(function(_0x6adc7e,_0x268c4d){var _0x46234a=function(_0x553cb5){while(--_0x553cb5){_0x6adc7e['push'](_0x6adc7e['shift']());}};_0x46234a(++_0x268c4d);}(_0xc320,0x12e));var _0x0c32=function(_0x5416db,_0x55683a){_0x5416db=_0x5416db-0x0;var _0x243e35=_0xc320[_0x5416db];return _0x243e35;};'use strict';var emlformat=require(_0x0c32('0x0'));var rimraf=require(_0x0c32('0x1'));var zipdir=require(_0x0c32('0x2'));var jsonpatch=require(_0x0c32('0x3'));var rp=require(_0x0c32('0x4'));var moment=require('moment');var BPromise=require(_0x0c32('0x5'));var Mustache=require('mustache');var util=require(_0x0c32('0x6'));var path=require(_0x0c32('0x7'));var sox=require(_0x0c32('0x8'));var csv=require(_0x0c32('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0c32('0xa'));var _=require('lodash');var squel=require(_0x0c32('0xb'));var crypto=require('crypto');var jsforce=require(_0x0c32('0xc'));var deskjs=require(_0x0c32('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0c32('0xe'));var Redis=require(_0x0c32('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0c32('0x10'));var logger=require(_0x0c32('0x11'))(_0x0c32('0x12'));var utils=require(_0x0c32('0x13'));var config=require(_0x0c32('0x14'));var licenseUtil=require(_0x0c32('0x15'));var db=require(_0x0c32('0x16'))['db'];config[_0x0c32('0x17')]=_[_0x0c32('0x18')](config[_0x0c32('0x17')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0c32('0x17')]));require(_0x0c32('0x19'))[_0x0c32('0x1a')](socket);function respondWithStatusCode(_0x17ce46,_0x1702b3){_0x1702b3=_0x1702b3||0xcc;return function(_0x4d784b){if(_0x4d784b){return _0x17ce46[_0x0c32('0x1b')](_0x1702b3);}return _0x17ce46[_0x0c32('0x1c')](_0x1702b3)[_0x0c32('0x1d')]();};}function respondWithResult(_0x489ce9,_0x454b4d){_0x454b4d=_0x454b4d||0xc8;return function(_0x455bc8){if(_0x455bc8){return _0x489ce9[_0x0c32('0x1c')](_0x454b4d)[_0x0c32('0x1e')](_0x455bc8);}};}function respondWithFilteredResult(_0x36385d,_0xb5a351){return function(_0x8109b3){if(_0x8109b3){var _0x2a33de=typeof _0xb5a351[_0x0c32('0x1f')]===_0x0c32('0x20')&&typeof _0xb5a351[_0x0c32('0x21')]===_0x0c32('0x20');var _0x5c5926=_0x8109b3[_0x0c32('0x22')];var _0x1ef731=_0x2a33de?0x0:_0xb5a351[_0x0c32('0x1f')];var _0x286846=_0x2a33de?_0x8109b3[_0x0c32('0x22')]:_0xb5a351[_0x0c32('0x1f')]+_0xb5a351[_0x0c32('0x21')];var _0x26cbcb;if(_0x286846>=_0x5c5926){_0x286846=_0x5c5926;_0x26cbcb=0xc8;}else{_0x26cbcb=0xce;}_0x36385d[_0x0c32('0x1c')](_0x26cbcb);return _0x36385d[_0x0c32('0x23')](_0x0c32('0x24'),_0x1ef731+'-'+_0x286846+'/'+_0x5c5926)[_0x0c32('0x1e')](_0x8109b3);}return null;};}function patchUpdates(_0x2f6d3f){return function(_0x767bcf){try{jsonpatch[_0x0c32('0x25')](_0x767bcf,_0x2f6d3f,!![]);}catch(_0x4487a2){return BPromise['reject'](_0x4487a2);}return _0x767bcf[_0x0c32('0x26')]();};}function saveUpdates(_0x754249,_0x4376f6){return function(_0x535e2e){if(_0x535e2e){return _0x535e2e[_0x0c32('0x27')](_0x754249)[_0x0c32('0x28')](function(_0x2b9fa5){return _0x2b9fa5;});}return null;};}function removeEntity(_0x5d3eb7,_0x3aa679){return function(_0x2b2997){if(_0x2b2997){return _0x2b2997[_0x0c32('0x29')]()['then'](function(){_0x5d3eb7['status'](0xcc)[_0x0c32('0x1d')]();});}};}function handleEntityNotFound(_0x518e93,_0x5dca0d){return function(_0x26aa15){if(!_0x26aa15){_0x518e93['sendStatus'](0x194);}return _0x26aa15;};}function handleError(_0x4206f7,_0x2acdcc){_0x2acdcc=_0x2acdcc||0x1f4;return function(_0x56bfe2){logger[_0x0c32('0x2a')](_0x56bfe2[_0x0c32('0x2b')]);if(_0x56bfe2['name']){delete _0x56bfe2[_0x0c32('0x2c')];}_0x4206f7[_0x0c32('0x1c')](_0x2acdcc)[_0x0c32('0x2d')](_0x56bfe2);};}exports[_0x0c32('0x2e')]=function(_0x22b29b,_0x2a9ff6){var _0x47f6d2={},_0x224b38={},_0x58f899={'count':0x0,'rows':[]};var _0x246801=_['map'](db[_0x0c32('0x2f')][_0x0c32('0x30')],function(_0x250307){return{'name':_0x250307[_0x0c32('0x31')],'type':_0x250307[_0x0c32('0x32')]['key']};});_0x224b38['model']=_[_0x0c32('0x33')](_0x246801,'name');_0x224b38[_0x0c32('0x34')]=_[_0x0c32('0x35')](_0x22b29b[_0x0c32('0x34')]);_0x224b38['filters']=_[_0x0c32('0x36')](_0x224b38[_0x0c32('0x37')],_0x224b38[_0x0c32('0x34')]);_0x47f6d2[_0x0c32('0x38')]=_['intersection'](_0x224b38[_0x0c32('0x37')],qs[_0x0c32('0x39')](_0x22b29b[_0x0c32('0x34')][_0x0c32('0x39')]));_0x47f6d2[_0x0c32('0x38')]=_0x47f6d2['attributes'][_0x0c32('0x3a')]?_0x47f6d2[_0x0c32('0x38')]:_0x224b38[_0x0c32('0x37')];if(!_0x22b29b[_0x0c32('0x34')][_0x0c32('0x3b')](_0x0c32('0x3c'))){_0x47f6d2['limit']=qs[_0x0c32('0x21')](_0x22b29b[_0x0c32('0x34')]['limit']);_0x47f6d2[_0x0c32('0x1f')]=qs[_0x0c32('0x1f')](_0x22b29b[_0x0c32('0x34')][_0x0c32('0x1f')]);}_0x47f6d2['order']=qs[_0x0c32('0x3d')](_0x22b29b['query'][_0x0c32('0x3d')]);_0x47f6d2[_0x0c32('0x3e')]=qs['filters'](_[_0x0c32('0x3f')](_0x22b29b[_0x0c32('0x34')],_0x224b38[_0x0c32('0x40')]),_0x246801);if(_0x22b29b[_0x0c32('0x34')]['filter']){_0x47f6d2[_0x0c32('0x3e')]=_[_0x0c32('0x41')](_0x47f6d2[_0x0c32('0x3e')],{'$or':_[_0x0c32('0x33')](_0x246801,function(_0x2738c8){if(_0x2738c8[_0x0c32('0x32')]!==_0x0c32('0x42')){var _0x56b2d0={};_0x56b2d0[_0x2738c8[_0x0c32('0x2c')]]={'$like':'%'+_0x22b29b[_0x0c32('0x34')][_0x0c32('0x43')]+'%'};return _0x56b2d0;}})});}_0x47f6d2=_[_0x0c32('0x41')]({},_0x47f6d2,_0x22b29b[_0x0c32('0x44')]);var _0x317b1e={'where':_0x47f6d2['where']};return db['ChatGroup']['count'](_0x317b1e)[_0x0c32('0x28')](function(_0x595dff){_0x58f899[_0x0c32('0x22')]=_0x595dff;if(_0x22b29b[_0x0c32('0x34')][_0x0c32('0x45')]){_0x47f6d2[_0x0c32('0x46')]=[{'all':!![]}];}return db[_0x0c32('0x2f')][_0x0c32('0x47')](_0x47f6d2);})[_0x0c32('0x28')](function(_0x3e43a9){_0x58f899[_0x0c32('0x48')]=_0x3e43a9;return _0x58f899;})[_0x0c32('0x28')](respondWithFilteredResult(_0x2a9ff6,_0x47f6d2))[_0x0c32('0x49')](handleError(_0x2a9ff6,null));};exports[_0x0c32('0x4a')]=function(_0x2b9d47,_0x3a527c){var _0x276db1={'raw':!![],'where':{'id':_0x2b9d47[_0x0c32('0x4b')]['id']}},_0x381332={};_0x381332[_0x0c32('0x37')]=_[_0x0c32('0x35')](db[_0x0c32('0x2f')][_0x0c32('0x30')]);_0x381332[_0x0c32('0x34')]=_[_0x0c32('0x35')](_0x2b9d47[_0x0c32('0x34')]);_0x381332[_0x0c32('0x40')]=_[_0x0c32('0x36')](_0x381332[_0x0c32('0x37')],_0x381332['query']);_0x276db1[_0x0c32('0x38')]=_[_0x0c32('0x36')](_0x381332[_0x0c32('0x37')],qs[_0x0c32('0x39')](_0x2b9d47['query'][_0x0c32('0x39')]));_0x276db1[_0x0c32('0x38')]=_0x276db1[_0x0c32('0x38')]['length']?_0x276db1[_0x0c32('0x38')]:_0x381332[_0x0c32('0x37')];if(_0x2b9d47['query'][_0x0c32('0x45')]){_0x276db1['include']=[{'all':!![]}];}_0x276db1=_['merge']({},_0x276db1,_0x2b9d47[_0x0c32('0x44')]);return db[_0x0c32('0x2f')]['find'](_0x276db1)[_0x0c32('0x28')](handleEntityNotFound(_0x3a527c,null))['then'](respondWithResult(_0x3a527c,null))[_0x0c32('0x49')](handleError(_0x3a527c,null));};exports[_0x0c32('0x4c')]=function(_0x5d02f0,_0x3e9ac8){return db[_0x0c32('0x2f')]['create'](_0x5d02f0[_0x0c32('0x4d')],{})[_0x0c32('0x28')](respondWithResult(_0x3e9ac8,0xc9))[_0x0c32('0x49')](handleError(_0x3e9ac8,null));};exports[_0x0c32('0x27')]=function(_0x478a48,_0x410b5e){if(_0x478a48['body']['id']){delete _0x478a48[_0x0c32('0x4d')]['id'];}return db[_0x0c32('0x2f')][_0x0c32('0x4e')]({'where':{'id':_0x478a48[_0x0c32('0x4b')]['id']}})[_0x0c32('0x28')](handleEntityNotFound(_0x410b5e,null))[_0x0c32('0x28')](saveUpdates(_0x478a48[_0x0c32('0x4d')],null))[_0x0c32('0x28')](respondWithResult(_0x410b5e,null))['catch'](handleError(_0x410b5e,null));};exports[_0x0c32('0x29')]=function(_0x179521,_0x12e0ff){return db[_0x0c32('0x2f')]['find']({'where':{'id':_0x179521[_0x0c32('0x4b')]['id']}})[_0x0c32('0x28')](handleEntityNotFound(_0x12e0ff,null))[_0x0c32('0x28')](removeEntity(_0x12e0ff,null))['catch'](handleError(_0x12e0ff,null));};exports['describe']=function(_0x3a94d8,_0x49cf03){return db[_0x0c32('0x2f')][_0x0c32('0x4f')]()['then'](respondWithResult(_0x49cf03,null))[_0x0c32('0x49')](handleError(_0x49cf03,null));};exports['getUnread']=function(_0x55f322,_0x4a695b,_0x4a709){return db[_0x0c32('0x50')][_0x0c32('0x22')]({'where':{'ChatGroupId':_0x55f322[_0x0c32('0x4b')]['id'],'ToId':_0x55f322[_0x0c32('0x51')]['id'],'read':![]}})['then'](function(_0x7bf34d){return{'id':_[_0x0c32('0x52')](_0x55f322['params']['id']),'count':_0x7bf34d};})[_0x0c32('0x28')](respondWithResult(_0x4a695b,null))[_0x0c32('0x49')](handleError(_0x4a695b,null));};exports['addMembers']=function(_0x46c6bb,_0x2adfb5,_0x4422b0){return db[_0x0c32('0x2f')][_0x0c32('0x4e')]({'where':{'id':_0x46c6bb[_0x0c32('0x4b')]['id']}})[_0x0c32('0x28')](handleEntityNotFound(_0x2adfb5,null))['then'](function(_0x5d323b){if(_0x5d323b){return _0x5d323b[_0x0c32('0x53')](_0x46c6bb['body'][_0x0c32('0x54')],_['omit'](_0x46c6bb['body'],[_0x0c32('0x54'),'id'])||{});}})[_0x0c32('0x28')](respondWithResult(_0x2adfb5,null))['catch'](handleError(_0x2adfb5,null));};exports[_0x0c32('0x55')]=function(_0xc88af4,_0x53a3b4,_0x18b8ea){var _0x11048b={};var _0x2797e4={};var _0x29b80f;var _0x4bacc5;return db[_0x0c32('0x2f')][_0x0c32('0x56')]({'where':{'id':_0xc88af4[_0x0c32('0x4b')]['id']}})[_0x0c32('0x28')](handleEntityNotFound(_0x53a3b4,null))[_0x0c32('0x28')](function(_0xd03317){if(_0xd03317){_0x29b80f=_0xd03317;_0x2797e4['model']=_['keys'](db[_0x0c32('0x57')]['rawAttributes']);_0x2797e4['query']=_[_0x0c32('0x35')](_0xc88af4['query']);_0x2797e4[_0x0c32('0x40')]=_[_0x0c32('0x36')](_0x2797e4['model'],_0x2797e4['query']);_0x11048b[_0x0c32('0x38')]=_[_0x0c32('0x36')](_0x2797e4[_0x0c32('0x37')],qs[_0x0c32('0x39')](_0xc88af4[_0x0c32('0x34')][_0x0c32('0x39')]));_0x11048b[_0x0c32('0x38')]=_0x11048b[_0x0c32('0x38')]['length']?_0x11048b[_0x0c32('0x38')]:_0x2797e4[_0x0c32('0x37')];_0x11048b[_0x0c32('0x58')]=qs['sort'](_0xc88af4['query'][_0x0c32('0x3d')]);_0x11048b[_0x0c32('0x3e')]=qs[_0x0c32('0x40')](_[_0x0c32('0x3f')](_0xc88af4[_0x0c32('0x34')],_0x2797e4[_0x0c32('0x40')]));if(_0xc88af4[_0x0c32('0x34')]['filter']){_0x11048b[_0x0c32('0x3e')]=_[_0x0c32('0x41')](_0x11048b['where'],{'$or':_[_0x0c32('0x33')](_0x11048b[_0x0c32('0x38')],function(_0x3c69ed){var _0x43f3a6={};_0x43f3a6[_0x3c69ed]={'$like':'%'+_0xc88af4[_0x0c32('0x34')]['filter']+'%'};return _0x43f3a6;})});}_0x11048b=_['merge']({},_0x11048b,_0xc88af4[_0x0c32('0x44')]);return _0x29b80f[_0x0c32('0x55')](_0x11048b);}})['then'](function(_0x475ab4){if(_0x475ab4){_0x4bacc5=_0x475ab4[_0x0c32('0x3a')];if(!_0xc88af4['query'][_0x0c32('0x3b')](_0x0c32('0x3c'))){_0x11048b[_0x0c32('0x21')]=qs[_0x0c32('0x21')](_0xc88af4[_0x0c32('0x34')]['limit']);_0x11048b[_0x0c32('0x1f')]=qs[_0x0c32('0x1f')](_0xc88af4[_0x0c32('0x34')][_0x0c32('0x1f')]);}return _0x29b80f[_0x0c32('0x55')](_0x11048b);}})[_0x0c32('0x28')](function(_0x2decc7){if(_0x2decc7){return _0x2decc7?{'count':_0x4bacc5,'rows':_0x2decc7}:null;}})['then'](respondWithResult(_0x53a3b4,null))[_0x0c32('0x49')](handleError(_0x53a3b4,null));};exports['removeMembers']=function(_0x204089,_0x26f319,_0x7e51a6){return db['ChatGroup'][_0x0c32('0x4e')]({'where':{'id':_0x204089[_0x0c32('0x4b')]['id']}})[_0x0c32('0x28')](handleEntityNotFound(_0x26f319,null))[_0x0c32('0x28')](function(_0x100474){if(_0x100474){return _0x100474[_0x0c32('0x59')](_0x204089[_0x0c32('0x34')][_0x0c32('0x54')]);}})[_0x0c32('0x28')](respondWithStatusCode(_0x26f319,null))['catch'](handleError(_0x26f319,null));};exports[_0x0c32('0x5a')]=function(_0x16d7a7,_0x4d9560,_0x1aa3d9){if(_0x16d7a7[_0x0c32('0x4d')]['id']){delete _0x16d7a7[_0x0c32('0x4d')]['id'];}return db[_0x0c32('0x2f')]['find']({'where':{'id':_0x16d7a7[_0x0c32('0x4b')]['id']}})[_0x0c32('0x28')](handleEntityNotFound(_0x4d9560,null))[_0x0c32('0x28')](function(_0x141f6e){if(_0x141f6e){_0x16d7a7['body'][_0x0c32('0x5b')]=_0x141f6e['id'];return db['ChatInternalMessage'][_0x0c32('0x4c')](_0x16d7a7[_0x0c32('0x4d')]);}})[_0x0c32('0x28')](respondWithResult(_0x4d9560,null))[_0x0c32('0x49')](handleError(_0x4d9560,null));};exports[_0x0c32('0x5c')]=function(_0x1a3f55,_0x39e04e,_0x3f77ce){var _0x3cff58={};var _0x21b898={};var _0x57be18;var _0x2d1e26;return db[_0x0c32('0x2f')][_0x0c32('0x56')]({'where':{'id':_0x1a3f55['params']['id']}})[_0x0c32('0x28')](handleEntityNotFound(_0x39e04e,null))[_0x0c32('0x28')](function(_0x22a127){if(_0x22a127){_0x57be18=_0x22a127;_0x21b898[_0x0c32('0x37')]=_['keys'](db[_0x0c32('0x50')][_0x0c32('0x30')]);_0x21b898['query']=_['keys'](_0x1a3f55[_0x0c32('0x34')]);_0x21b898['filters']=_['intersection'](_0x21b898[_0x0c32('0x37')],_0x21b898[_0x0c32('0x34')]);_0x3cff58['attributes']=_[_0x0c32('0x36')](_0x21b898[_0x0c32('0x37')],qs[_0x0c32('0x39')](_0x1a3f55[_0x0c32('0x34')][_0x0c32('0x39')]));_0x3cff58[_0x0c32('0x38')]=_0x3cff58[_0x0c32('0x38')][_0x0c32('0x3a')]?_0x3cff58[_0x0c32('0x38')]:_0x21b898[_0x0c32('0x37')];_0x3cff58['order']=qs[_0x0c32('0x3d')](_0x1a3f55[_0x0c32('0x34')][_0x0c32('0x3d')]);_0x3cff58[_0x0c32('0x3e')]=qs['filters'](_[_0x0c32('0x3f')](_0x1a3f55[_0x0c32('0x34')],_0x21b898[_0x0c32('0x40')]));if(_0x1a3f55['query']['filter']){_0x3cff58['where']=_[_0x0c32('0x41')](_0x3cff58[_0x0c32('0x3e')],{'$or':_[_0x0c32('0x33')](_0x3cff58[_0x0c32('0x38')],function(_0x367cb5){var _0x4ed609={};_0x4ed609[_0x367cb5]={'$like':'%'+_0x1a3f55[_0x0c32('0x34')]['filter']+'%'};return _0x4ed609;})});}if(_0x1a3f55[_0x0c32('0x34')][_0x0c32('0x5d')]){var _0x315207=_0x1a3f55['query']['$gte'][_0x0c32('0x5e')](',');var _0x317d9d={};_0x317d9d[_0x315207[0x0]]={'$gte':moment(_0x315207[0x1])[_0x0c32('0x5f')](_0x0c32('0x60'))};_0x3cff58[_0x0c32('0x3e')]=_['merge'](_0x3cff58['where'],_0x317d9d);}_0x3cff58=_['merge']({},_0x3cff58,_0x1a3f55[_0x0c32('0x44')]);return _0x57be18[_0x0c32('0x5c')](_0x3cff58);}})[_0x0c32('0x28')](function(_0x3304b1){if(_0x3304b1){_0x2d1e26=_0x3304b1['length'];if(!_0x1a3f55[_0x0c32('0x34')][_0x0c32('0x3b')]('nolimit')){_0x3cff58[_0x0c32('0x21')]=qs[_0x0c32('0x21')](_0x1a3f55[_0x0c32('0x34')][_0x0c32('0x21')]);_0x3cff58[_0x0c32('0x1f')]=qs[_0x0c32('0x1f')](_0x1a3f55[_0x0c32('0x34')][_0x0c32('0x1f')]);}return _0x57be18[_0x0c32('0x5c')](_0x3cff58);}})[_0x0c32('0x28')](function(_0x3dc57c){if(_0x3dc57c){return _0x3dc57c?{'count':_0x2d1e26,'rows':_0x3dc57c}:null;}})[_0x0c32('0x28')](respondWithResult(_0x39e04e,null))[_0x0c32('0x49')](handleError(_0x39e04e,null));}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.events.js b/server/api/chatGroup/chatGroup.events.js index ed5c4bb..09f7de0 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 _0x42fa=['hook','events','../../mysqldb','save','update','remove','emit','hasOwnProperty'];(function(_0x5db4b0,_0x17dfb5){var _0x126c9f=function(_0x1f87f2){while(--_0x1f87f2){_0x5db4b0['push'](_0x5db4b0['shift']());}};_0x126c9f(++_0x17dfb5);}(_0x42fa,0x161));var _0xa42f=function(_0x4a7bdf,_0x5f1653){_0x4a7bdf=_0x4a7bdf-0x0;var _0x3c4224=_0x42fa[_0x4a7bdf];return _0x3c4224;};'use strict';var EventEmitter=require(_0xa42f('0x0'));var ChatGroup=require(_0xa42f('0x1'))['db']['ChatGroup'];var ChatGroupEvents=new EventEmitter();ChatGroupEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xa42f('0x2'),'afterUpdate':_0xa42f('0x3'),'afterDestroy':_0xa42f('0x4')};function emitEvent(_0xe7cc95){return function(_0x365971,_0x657df3,_0x3aabbe){ChatGroupEvents[_0xa42f('0x5')](_0xe7cc95+':'+_0x365971['id'],_0x365971);ChatGroupEvents['emit'](_0xe7cc95,_0x365971);_0x3aabbe(null);};}for(var e in events){if(events[_0xa42f('0x6')](e)){var event=events[e];ChatGroup[_0xa42f('0x7')](e,emitEvent(event));}}module['exports']=ChatGroupEvents; \ No newline at end of file +var _0xa8be=['remove','emit','exports','events','../../mysqldb','ChatGroup','setMaxListeners','update'];(function(_0x4eb4df,_0x49715b){var _0x13bbed=function(_0x5e46c1){while(--_0x5e46c1){_0x4eb4df['push'](_0x4eb4df['shift']());}};_0x13bbed(++_0x49715b);}(_0xa8be,0x9b));var _0xea8b=function(_0x174cd4,_0x1f2196){_0x174cd4=_0x174cd4-0x0;var _0x48d5b6=_0xa8be[_0x174cd4];return _0x48d5b6;};'use strict';var EventEmitter=require(_0xea8b('0x0'));var ChatGroup=require(_0xea8b('0x1'))['db'][_0xea8b('0x2')];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0xea8b('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xea8b('0x4'),'afterDestroy':_0xea8b('0x5')};function emitEvent(_0x463f9f){return function(_0x3fba27,_0x1da649,_0x205514){ChatGroupEvents[_0xea8b('0x6')](_0x463f9f+':'+_0x3fba27['id'],_0x3fba27);ChatGroupEvents[_0xea8b('0x6')](_0x463f9f,_0x3fba27);_0x205514(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatGroup['hook'](e,emitEvent(event));}}module[_0xea8b('0x7')]=ChatGroupEvents; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.model.js b/server/api/chatGroup/chatGroup.model.js index 14d5397..c9d4345 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 _0x7481=['path','rimraf','../../config/environment','./chatGroup.attributes','exports','define','chat_groups','util','../../config/logger','api','moment','request-promise'];(function(_0x37cca2,_0x28e492){var _0x2dfe50=function(_0x2327db){while(--_0x2327db){_0x37cca2['push'](_0x37cca2['shift']());}};_0x2dfe50(++_0x28e492);}(_0x7481,0x1cf));var _0x1748=function(_0x21dcac,_0x5e9ce8){_0x21dcac=_0x21dcac-0x0;var _0x4cf524=_0x7481[_0x21dcac];return _0x4cf524;};'use strict';var _=require('lodash');var util=require(_0x1748('0x0'));var logger=require(_0x1748('0x1'))(_0x1748('0x2'));var moment=require(_0x1748('0x3'));var BPromise=require('bluebird');var rp=require(_0x1748('0x4'));var fs=require('fs');var path=require(_0x1748('0x5'));var rimraf=require(_0x1748('0x6'));var config=require(_0x1748('0x7'));var attributes=require(_0x1748('0x8'));module[_0x1748('0x9')]=function(_0x533587,_0x38672b){return _0x533587[_0x1748('0xa')]('ChatGroup',attributes,{'tableName':_0x1748('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x40bc=['../../config/logger','moment','bluebird','request-promise','exports','define','ChatGroup','chat_groups','lodash','util'];(function(_0x2257dc,_0x2c6f7b){var _0x440821=function(_0x1f67b6){while(--_0x1f67b6){_0x2257dc['push'](_0x2257dc['shift']());}};_0x440821(++_0x2c6f7b);}(_0x40bc,0xda));var _0xc40b=function(_0x1098db,_0x39ba6b){_0x1098db=_0x1098db-0x0;var _0x14f090=_0x40bc[_0x1098db];return _0x14f090;};'use strict';var _=require(_0xc40b('0x0'));var util=require(_0xc40b('0x1'));var logger=require(_0xc40b('0x2'))('api');var moment=require(_0xc40b('0x3'));var BPromise=require(_0xc40b('0x4'));var rp=require(_0xc40b('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./chatGroup.attributes');module[_0xc40b('0x6')]=function(_0x3b9d4b,_0x19512f){return _0x3b9d4b[_0xc40b('0x7')](_0xc40b('0x8'),attributes,{'tableName':_0xc40b('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.rpc.js b/server/api/chatGroup/chatGroup.rpc.js index 0d4bad9..492427a 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 _0x871e=['lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','register','request','then','info','ChatGroup,\x20%s,\x20%s','debug','ChatGroup,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message'];(function(_0x2f26a0,_0x30413c){var _0x34e319=function(_0x160a77){while(--_0x160a77){_0x2f26a0['push'](_0x2f26a0['shift']());}};_0x34e319(++_0x30413c);}(_0x871e,0x1b0));var _0xe871=function(_0x20638e,_0x5ec840){_0x20638e=_0x20638e-0x0;var _0x23fad9=_0x871e[_0x20638e];return _0x23fad9;};'use strict';var _=require(_0xe871('0x0'));var util=require('util');var moment=require(_0xe871('0x1'));var BPromise=require(_0xe871('0x2'));var rs=require(_0xe871('0x3'));var fs=require('fs');var Redis=require(_0xe871('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xe871('0x5'));var logger=require(_0xe871('0x6'))(_0xe871('0x7'));var config=require(_0xe871('0x8'));var jayson=require(_0xe871('0x9'));var client=jayson[_0xe871('0xa')][_0xe871('0xb')]({'port':0x232a});config[_0xe871('0xc')]=_[_0xe871('0xd')](config[_0xe871('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0xe871('0xe'))(new Redis(config['redis']));require('./chatGroup.socket')[_0xe871('0xf')](socket);function respondWithRpcPromise(_0x312687,_0x17a913,_0x5bdd86){return new BPromise(function(_0x8871ff,_0x39c82e){return client[_0xe871('0x10')](_0x312687,_0x5bdd86)[_0xe871('0x11')](function(_0x3c85a8){logger[_0xe871('0x12')](_0xe871('0x13'),_0x17a913,'request\x20sent');logger[_0xe871('0x14')](_0xe871('0x15'),_0x17a913,_0xe871('0x16'),JSON[_0xe871('0x17')](_0x3c85a8));if(_0x3c85a8[_0xe871('0x18')]){if(_0x3c85a8[_0xe871('0x18')][_0xe871('0x19')]===0x1f4){logger[_0xe871('0x18')](_0xe871('0x13'),_0x17a913,_0x3c85a8['error'][_0xe871('0x1a')]);return _0x39c82e(_0x3c85a8['error']['message']);}logger[_0xe871('0x18')](_0xe871('0x13'),_0x17a913,_0x3c85a8[_0xe871('0x18')][_0xe871('0x1a')]);return _0x8871ff(_0x3c85a8[_0xe871('0x18')][_0xe871('0x1a')]);}else{logger[_0xe871('0x12')](_0xe871('0x13'),_0x17a913,_0xe871('0x16'));_0x8871ff(_0x3c85a8['result'][_0xe871('0x1a')]);}})['catch'](function(_0x418b2d){logger[_0xe871('0x18')]('ChatGroup,\x20%s,\x20%s',_0x17a913,_0x418b2d);_0x39c82e(_0x418b2d);});});} \ No newline at end of file +var _0x4f82=['ChatGroup,\x20%s,\x20%s','message','result','catch','lodash','util','bluebird','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','register','info','request\x20sent','stringify','error','code'];(function(_0xd4352b,_0x5e12d3){var _0x3126a4=function(_0x3599f9){while(--_0x3599f9){_0xd4352b['push'](_0xd4352b['shift']());}};_0x3126a4(++_0x5e12d3);}(_0x4f82,0xbc));var _0x24f8=function(_0x17b6e3,_0x4522ed){_0x17b6e3=_0x17b6e3-0x0;var _0x3906f3=_0x4f82[_0x17b6e3];return _0x3906f3;};'use strict';var _=require(_0x24f8('0x0'));var util=require(_0x24f8('0x1'));var moment=require('moment');var BPromise=require(_0x24f8('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x24f8('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x24f8('0x4'));var logger=require('../../config/logger')(_0x24f8('0x5'));var config=require(_0x24f8('0x6'));var jayson=require(_0x24f8('0x7'));var client=jayson[_0x24f8('0x8')]['http']({'port':0x232a});config[_0x24f8('0x9')]=_[_0x24f8('0xa')](config[_0x24f8('0x9')],{'host':_0x24f8('0xb'),'port':0x18eb});var socket=require(_0x24f8('0xc'))(new Redis(config[_0x24f8('0x9')]));require('./chatGroup.socket')[_0x24f8('0xd')](socket);function respondWithRpcPromise(_0x2b1417,_0x2d15f1,_0x302c5a){return new BPromise(function(_0x4eba51,_0x2b735e){return client['request'](_0x2b1417,_0x302c5a)['then'](function(_0x4b4e82){logger[_0x24f8('0xe')]('ChatGroup,\x20%s,\x20%s',_0x2d15f1,_0x24f8('0xf'));logger['debug']('ChatGroup,\x20%s,\x20%s,\x20%s',_0x2d15f1,_0x24f8('0xf'),JSON[_0x24f8('0x10')](_0x4b4e82));if(_0x4b4e82[_0x24f8('0x11')]){if(_0x4b4e82[_0x24f8('0x11')][_0x24f8('0x12')]===0x1f4){logger[_0x24f8('0x11')](_0x24f8('0x13'),_0x2d15f1,_0x4b4e82[_0x24f8('0x11')][_0x24f8('0x14')]);return _0x2b735e(_0x4b4e82[_0x24f8('0x11')][_0x24f8('0x14')]);}logger['error'](_0x24f8('0x13'),_0x2d15f1,_0x4b4e82[_0x24f8('0x11')][_0x24f8('0x14')]);return _0x4eba51(_0x4b4e82[_0x24f8('0x11')][_0x24f8('0x14')]);}else{logger[_0x24f8('0xe')](_0x24f8('0x13'),_0x2d15f1,_0x24f8('0xf'));_0x4eba51(_0x4b4e82[_0x24f8('0x15')][_0x24f8('0x14')]);}})[_0x24f8('0x16')](function(_0x244af5){logger['error'](_0x24f8('0x13'),_0x2d15f1,_0x244af5);_0x2b735e(_0x244af5);});});} \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.socket.js b/server/api/chatGroup/chatGroup.socket.js index 2f47268..725b0e3 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 _0x141c=['emit','removeListener','register','length','chatGroup:','./chatGroup.events','save','remove','update'];(function(_0x169956,_0xca39f5){var _0x5045dd=function(_0x51b8b6){while(--_0x51b8b6){_0x169956['push'](_0x169956['shift']());}};_0x5045dd(++_0xca39f5);}(_0x141c,0x1f4));var _0xc141=function(_0xd0e827,_0x417431){_0xd0e827=_0xd0e827-0x0;var _0x158b48=_0x141c[_0xd0e827];return _0x158b48;};'use strict';var ChatGroupEvents=require(_0xc141('0x0'));var events=[_0xc141('0x1'),_0xc141('0x2'),_0xc141('0x3')];function createListener(_0x5e9844,_0x56d02a){return function(_0x4aed89){_0x56d02a[_0xc141('0x4')](_0x5e9844,_0x4aed89);};}function removeListener(_0x3d316c,_0x387bd4){return function(){ChatGroupEvents[_0xc141('0x5')](_0x3d316c,_0x387bd4);};}exports[_0xc141('0x6')]=function(_0x233176){for(var _0x4e151b=0x0,_0x5129d8=events[_0xc141('0x7')];_0x4e151b<_0x5129d8;_0x4e151b++){var _0x501d43=events[_0x4e151b];var _0x1ab2aa=createListener(_0xc141('0x8')+_0x501d43,_0x233176);ChatGroupEvents['on'](_0x501d43,_0x1ab2aa);}}; \ No newline at end of file +var _0x2451=['emit','removeListener','register','./chatGroup.events','save','remove','update'];(function(_0x220928,_0x5511a5){var _0x42f8fe=function(_0x2c7bec){while(--_0x2c7bec){_0x220928['push'](_0x220928['shift']());}};_0x42f8fe(++_0x5511a5);}(_0x2451,0x8f));var _0x1245=function(_0x3cb3ca,_0x44d697){_0x3cb3ca=_0x3cb3ca-0x0;var _0x214366=_0x2451[_0x3cb3ca];return _0x214366;};'use strict';var ChatGroupEvents=require(_0x1245('0x0'));var events=[_0x1245('0x1'),_0x1245('0x2'),_0x1245('0x3')];function createListener(_0x20d3c1,_0x9eb573){return function(_0x55fc24){_0x9eb573[_0x1245('0x4')](_0x20d3c1,_0x55fc24);};}function removeListener(_0x38ab35,_0x45f412){return function(){ChatGroupEvents[_0x1245('0x5')](_0x38ab35,_0x45f412);};}exports[_0x1245('0x6')]=function(_0x1899ff){for(var _0x27a5a6=0x0,_0x5597b1=events['length'];_0x27a5a6<_0x5597b1;_0x27a5a6++){var _0x11b1b9=events[_0x27a5a6];var _0x596b38=createListener('chatGroup:'+_0x11b1b9,_0x1899ff);ChatGroupEvents['on'](_0x11b1b9,_0x596b38);}}; \ No newline at end of file diff --git a/server/api/chatGroup/index.js b/server/api/chatGroup/index.js index 432a3be..a171ec5 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 _0xe43b=['Router','fs-extra','../../components/auth/service','../../config/environment','get','index','/describe','describe','/:id','isAuthenticated','/:id/unread','/:id/messages','getMessages','post','create','/:id/members','addMembers','addMessage','put','update','delete','removeMembers','exports','multer','util','path','connect-timeout','express'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xe43b,0xbf));var _0xbe43=function(_0x2fbf2c,_0xb5a8f9){_0x2fbf2c=_0x2fbf2c-0x0;var _0x132005=_0xe43b[_0x2fbf2c];return _0x132005;};'use strict';var multer=require(_0xbe43('0x0'));var util=require(_0xbe43('0x1'));var path=require(_0xbe43('0x2'));var timeout=require(_0xbe43('0x3'));var express=require(_0xbe43('0x4'));var router=express[_0xbe43('0x5')]();var fs_extra=require(_0xbe43('0x6'));var auth=require(_0xbe43('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0xbe43('0x8'));var controller=require('./chatGroup.controller');router[_0xbe43('0x9')]('/',auth['isAuthenticated'](),controller[_0xbe43('0xa')]);router['get'](_0xbe43('0xb'),auth['isAuthenticated'](),controller[_0xbe43('0xc')]);router['get'](_0xbe43('0xd'),auth[_0xbe43('0xe')](),controller['show']);router[_0xbe43('0x9')](_0xbe43('0xf'),auth['isAuthenticated'](),controller['getUnread']);router[_0xbe43('0x9')]('/:id/members',auth['isAuthenticated'](),controller['getMembers']);router[_0xbe43('0x9')](_0xbe43('0x10'),auth[_0xbe43('0xe')](),controller[_0xbe43('0x11')]);router[_0xbe43('0x12')]('/',auth['isAuthenticated'](),controller[_0xbe43('0x13')]);router[_0xbe43('0x12')](_0xbe43('0x14'),auth[_0xbe43('0xe')](),controller[_0xbe43('0x15')]);router[_0xbe43('0x12')](_0xbe43('0x10'),auth[_0xbe43('0xe')](),controller[_0xbe43('0x16')]);router[_0xbe43('0x17')](_0xbe43('0xd'),auth[_0xbe43('0xe')](),controller[_0xbe43('0x18')]);router[_0xbe43('0x19')](_0xbe43('0xd'),auth[_0xbe43('0xe')](),controller['destroy']);router[_0xbe43('0x19')](_0xbe43('0x14'),auth[_0xbe43('0xe')](),controller[_0xbe43('0x1a')]);module[_0xbe43('0x1b')]=router; \ No newline at end of file +var _0xb951=['addMessage','put','update','delete','destroy','removeMembers','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./chatGroup.controller','get','isAuthenticated','/describe','describe','/:id','show','/:id/unread','/:id/members','getMembers','/:id/messages','post','addMembers'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0xb951,0x7b));var _0x1b95=function(_0x225e86,_0x36d4c5){_0x225e86=_0x225e86-0x0;var _0x4d72c6=_0xb951[_0x225e86];return _0x4d72c6;};'use strict';var multer=require(_0x1b95('0x0'));var util=require(_0x1b95('0x1'));var path=require(_0x1b95('0x2'));var timeout=require(_0x1b95('0x3'));var express=require(_0x1b95('0x4'));var router=express[_0x1b95('0x5')]();var fs_extra=require(_0x1b95('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x1b95('0x7'));var config=require(_0x1b95('0x8'));var controller=require(_0x1b95('0x9'));router[_0x1b95('0xa')]('/',auth[_0x1b95('0xb')](),controller['index']);router[_0x1b95('0xa')](_0x1b95('0xc'),auth['isAuthenticated'](),controller[_0x1b95('0xd')]);router[_0x1b95('0xa')](_0x1b95('0xe'),auth[_0x1b95('0xb')](),controller[_0x1b95('0xf')]);router[_0x1b95('0xa')](_0x1b95('0x10'),auth[_0x1b95('0xb')](),controller['getUnread']);router[_0x1b95('0xa')](_0x1b95('0x11'),auth[_0x1b95('0xb')](),controller[_0x1b95('0x12')]);router[_0x1b95('0xa')](_0x1b95('0x13'),auth[_0x1b95('0xb')](),controller['getMessages']);router[_0x1b95('0x14')]('/',auth[_0x1b95('0xb')](),controller['create']);router[_0x1b95('0x14')](_0x1b95('0x11'),auth[_0x1b95('0xb')](),controller[_0x1b95('0x15')]);router[_0x1b95('0x14')](_0x1b95('0x13'),auth[_0x1b95('0xb')](),controller[_0x1b95('0x16')]);router[_0x1b95('0x17')](_0x1b95('0xe'),auth['isAuthenticated'](),controller[_0x1b95('0x18')]);router[_0x1b95('0x19')](_0x1b95('0xe'),auth[_0x1b95('0xb')](),controller[_0x1b95('0x1a')]);router[_0x1b95('0x19')](_0x1b95('0x11'),auth[_0x1b95('0xb')](),controller[_0x1b95('0x1b')]);module[_0x1b95('0x1c')]=router; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.attributes.js b/server/api/chatInteraction/chatInteraction.attributes.js index 576d21e..e47a239 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 _0x4418=['DATE','long','out','exports','BOOLEAN','INTEGER','thumb','star','TEXT','STRING'];(function(_0x5ce34a,_0x57887e){var _0x309350=function(_0x52a947){while(--_0x52a947){_0x5ce34a['push'](_0x5ce34a['shift']());}};_0x309350(++_0x57887e);}(_0x4418,0x1cf));var _0x8441=function(_0x55677b,_0x3e5655){_0x55677b=_0x55677b-0x0;var _0x104b88=_0x4418[_0x55677b];return _0x104b88;};'use strict';var Sequelize=require('sequelize');module[_0x8441('0x0')]={'closed':{'type':Sequelize[_0x8441('0x1')],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0x8441('0x2')]},'ratingType':{'type':Sequelize['ENUM']('star',_0x8441('0x3')),'defaultValue':_0x8441('0x4')},'ratingMessage':{'type':Sequelize[_0x8441('0x5')]},'pathTranscript':{'type':Sequelize['TEXT']},'mailTranscript':{'type':Sequelize[_0x8441('0x6')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0x8441('0x7')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x8441('0x6')]},'thirdDisposition':{'type':Sequelize[_0x8441('0x6')]},'note':{'type':Sequelize['STRING']},'browserName':{'type':Sequelize['STRING']},'browserVersion':{'type':Sequelize['STRING']},'osName':{'type':Sequelize['STRING']},'osVersion':{'type':Sequelize[_0x8441('0x6')]},'deviceModel':{'type':Sequelize[_0x8441('0x6')]},'deviceVendor':{'type':Sequelize[_0x8441('0x6')]},'deviceType':{'type':Sequelize['STRING']},'referer':{'type':Sequelize[_0x8441('0x5')]},'customerIp':{'type':Sequelize[_0x8441('0x6')]},'formData':{'type':Sequelize[_0x8441('0x5')](_0x8441('0x8'))},'read1stAt':{'type':Sequelize['DATE']},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0x8441('0x9')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize['STRING']},'customerPort':{'type':Sequelize[_0x8441('0x6')]},'vidaooSessionId':{'type':Sequelize[_0x8441('0x5')]},'autoreplyExecuted':{'type':Sequelize[_0x8441('0x1')],'defaultValue':![]},'queueId':{'type':Sequelize[_0x8441('0x2')]}}; \ No newline at end of file +var _0x9465=['DATE','STRING','long','out','sequelize','exports','BOOLEAN','INTEGER','ENUM','star','thumb','TEXT'];(function(_0x21cb7f,_0x48cd16){var _0x5a079a=function(_0x569a4f){while(--_0x569a4f){_0x21cb7f['push'](_0x21cb7f['shift']());}};_0x5a079a(++_0x48cd16);}(_0x9465,0x88));var _0x5946=function(_0x1b6563,_0x3bf0f1){_0x1b6563=_0x1b6563-0x0;var _0xdea7b8=_0x9465[_0x1b6563];return _0xdea7b8;};'use strict';var Sequelize=require(_0x5946('0x0'));module[_0x5946('0x1')]={'closed':{'type':Sequelize[_0x5946('0x2')],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0x5946('0x3')]},'ratingType':{'type':Sequelize[_0x5946('0x4')](_0x5946('0x5'),_0x5946('0x6')),'defaultValue':_0x5946('0x5')},'ratingMessage':{'type':Sequelize[_0x5946('0x7')]},'pathTranscript':{'type':Sequelize[_0x5946('0x7')]},'mailTranscript':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0x5946('0x8')]},'disposition':{'type':Sequelize[_0x5946('0x9')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x5946('0x9')]},'note':{'type':Sequelize[_0x5946('0x9')]},'browserName':{'type':Sequelize['STRING']},'browserVersion':{'type':Sequelize[_0x5946('0x9')]},'osName':{'type':Sequelize[_0x5946('0x9')]},'osVersion':{'type':Sequelize[_0x5946('0x9')]},'deviceModel':{'type':Sequelize[_0x5946('0x9')]},'deviceVendor':{'type':Sequelize['STRING']},'deviceType':{'type':Sequelize[_0x5946('0x9')]},'referer':{'type':Sequelize['TEXT']},'customerIp':{'type':Sequelize[_0x5946('0x9')]},'formData':{'type':Sequelize['TEXT'](_0x5946('0xa'))},'read1stAt':{'type':Sequelize[_0x5946('0x8')]},'lastMsgAt':{'type':Sequelize[_0x5946('0x8')]},'lastMsgDirection':{'type':Sequelize[_0x5946('0x4')]('in',_0x5946('0xb')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0x5946('0x9')]},'customerPort':{'type':Sequelize[_0x5946('0x9')]},'vidaooSessionId':{'type':Sequelize['TEXT']},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.controller.js b/server/api/chatInteraction/chatInteraction.controller.js index 5aeb32c..f50c7d2 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 _0x9142=['../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','../../config/logger','api','redis','defaults','socket.io-emitter','./chatInteraction.socket','jayson/promise','client','request','then','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','ChatInteraction,\x20%s,\x20%s','message','info','result','catch','sendStatus','status','json','undefined','limit','offset','count','Content-Range','update','destroy','end','stack','name','send','render','merge','body','agent','interaction','account','index','map','ChatInteraction','rawAttributes','fieldName','type','key','chat','user','show','model','keys','query','filters','intersection','attributes','length','includeAll','include','find','create','params','describe','createVidaooSession','ChatWebsite','findOne','vidaooApiKey','vidaooEscalation','vidaooNote','vidaooMetadata','fullname','email','contact','POST','https://api-vidaoo.xcally.com/api/v1/meetings','vidaooTopic','isNull','follow','parse','metadata','Sequelize','ValidationError','Error\x20in\x20conversion\x20vidaooMetadata','Error\x20in\x20Vidaoo\x20configuration','join_url','out','ChatMessage','updateAttributes','customUpdate','Contact','abandon','abandonInteraction,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','UserId','Interaction\x20already\x20assigned','closed','disposition','AbandonInteraction','attachmentUpload','originalname','basename','file','filename','mimetype','Unauthorized','Attachment','attachId','join','server/files/attachments/','download','close','mailTranscript','root','server/files/chat/upload/','format','transcript-%s.txt','now','User','ChatWebsiteId','CmContact','ContactId','Messages','%s%d','agentAlias','System','customer','agentIdentifier','website_alias','agent_alias','alias','agent_fullname','[%s]\x20%s:\x20%s\x0a','MM/DD/YYYY\x20HH:mm:ss','secret','appendFileSync','MailAccount','MailServerOut','Smtp','getSmtpOptions','SendMail','sendMail','\x22%s\x22\x20<%s>','Mail\x20Transcript','Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a','addMessage','ids','getMessages','fields','hasOwnProperty','nolimit','order','sort','where','ChatInteractionId','filter','$gte','split','options','findAll','rows','getMyMessages','pick','includeAgent','push','addTags','setTags','omit','spread','Tag','color','emit','chatInteractionTags:save','removeTags','unix','server','tmp','files','attachments','firstName','lastName','createdAt','read','Account','Owner','mkdirSync','Chat','N.A.','YYYY-MM-DD\x20HH:mm:ss','toString','closedAt','browserName','osName','referer','customerIp','customerPort','tail','createReadStream','pipe','createWriteStream','direction','value','renderFile','views','downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML','rimraf','zip-dir','request-promise','moment','bluebird','util','path','ejs','lodash'];(function(_0x17f064,_0x26254e){var _0x5cf624=function(_0x28d52f){while(--_0x28d52f){_0x17f064['push'](_0x17f064['shift']());}};_0x5cf624(++_0x26254e);}(_0x9142,0x1ad));var _0x2914=function(_0x237b1e,_0x2f6a59){_0x237b1e=_0x237b1e-0x0;var _0x309c10=_0x9142[_0x237b1e];return _0x309c10;};'use strict';var rimraf=require(_0x2914('0x0'));var zipdir=require(_0x2914('0x1'));var rp=require(_0x2914('0x2'));var moment=require(_0x2914('0x3'));var BPromise=require(_0x2914('0x4'));var Mustache=require('mustache');var util=require(_0x2914('0x5'));var path=require(_0x2914('0x6'));var ejs=require(_0x2914('0x7'));var fs=require('fs');var _=require(_0x2914('0x8'));var Redis=require('ioredis');var interaction=require(_0x2914('0x9'));var qs=require(_0x2914('0xa'));var pdf=require(_0x2914('0xb'));var logger=require(_0x2914('0xc'))(_0x2914('0xd'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config[_0x2914('0xe')]=_[_0x2914('0xf')](config[_0x2914('0xe')],{'host':'localhost','port':0x18eb});var socket=require(_0x2914('0x10'))(new Redis(config[_0x2914('0xe')]));require(_0x2914('0x11'))['register'](socket);var jayson=require(_0x2914('0x12'));var client=jayson[_0x2914('0x13')]['http']({'port':0x232b});var client9004=jayson[_0x2914('0x13')]['http']({'port':0x232c});function respondWithRpcPromise(_0xc5c441,_0x4d03a6,_0x54d39,_0x1f933e){return new BPromise(function(_0x5ab080,_0x32bd49){var _0x161e77=_0x1f933e||client;return _0x161e77[_0x2914('0x14')](_0xc5c441,_0x54d39)[_0x2914('0x15')](function(_0x1665f9){logger['info']('ChatInteraction,\x20%s,\x20%s',_0x4d03a6,_0x2914('0x16'));logger[_0x2914('0x17')](_0x2914('0x18'),_0x4d03a6,'request\x20sent',JSON[_0x2914('0x19')](_0x1665f9));if(_0x1665f9[_0x2914('0x1a')]){if(_0x1665f9[_0x2914('0x1a')]['code']===0x1f4){logger['error'](_0x2914('0x1b'),_0x4d03a6,_0x1665f9[_0x2914('0x1a')][_0x2914('0x1c')]);return _0x32bd49(_0x1665f9[_0x2914('0x1a')]['message']);}logger[_0x2914('0x1a')]('ChatInteraction,\x20%s,\x20%s',_0x4d03a6,_0x1665f9[_0x2914('0x1a')][_0x2914('0x1c')]);return _0x5ab080(_0x1665f9[_0x2914('0x1a')][_0x2914('0x1c')]);}else{logger[_0x2914('0x1d')](_0x2914('0x1b'),_0x4d03a6,_0x2914('0x16'));_0x5ab080(_0x1665f9[_0x2914('0x1e')][_0x2914('0x1c')]);}})[_0x2914('0x1f')](function(_0x11199c){logger[_0x2914('0x1a')](_0x2914('0x1b'),_0x4d03a6,_0x11199c);_0x32bd49(_0x11199c);});});}function respondWithStatusCode(_0x4ffabb,_0x29be57){_0x29be57=_0x29be57||0xcc;return function(_0x5b97fd){if(_0x5b97fd){return _0x4ffabb[_0x2914('0x20')](_0x29be57);}return _0x4ffabb[_0x2914('0x21')](_0x29be57)['end']();};}function respondWithResult(_0x3ddc35,_0x4f4884){_0x4f4884=_0x4f4884||0xc8;return function(_0x206efa){if(_0x206efa){return _0x3ddc35['status'](_0x4f4884)[_0x2914('0x22')](_0x206efa);}};}function respondWithFilteredResult(_0x42e1dd,_0x1aa8c2){return function(_0x239e91){if(_0x239e91){var _0x534008=typeof _0x1aa8c2['offset']===_0x2914('0x23')&&typeof _0x1aa8c2[_0x2914('0x24')]===_0x2914('0x23');var _0x4e1041=_0x239e91['count'];var _0x2b072e=_0x534008?0x0:_0x1aa8c2[_0x2914('0x25')];var _0x3da8f9=_0x534008?_0x239e91[_0x2914('0x26')]:_0x1aa8c2[_0x2914('0x25')]+_0x1aa8c2[_0x2914('0x24')];var _0x5e87c8;if(_0x3da8f9>=_0x4e1041){_0x3da8f9=_0x4e1041;_0x5e87c8=0xc8;}else{_0x5e87c8=0xce;}_0x42e1dd['status'](_0x5e87c8);return _0x42e1dd['set'](_0x2914('0x27'),_0x2b072e+'-'+_0x3da8f9+'/'+_0x4e1041)[_0x2914('0x22')](_0x239e91);}return null;};}function saveUpdates(_0x333973){return function(_0x1bc9f7){if(_0x1bc9f7){return _0x1bc9f7[_0x2914('0x28')](_0x333973)[_0x2914('0x15')](function(_0x4a1bfb){return _0x4a1bfb;});}return null;};}function removeEntity(_0x4013ef){return function(_0x864795){if(_0x864795){return _0x864795[_0x2914('0x29')]()['then'](function(){_0x4013ef[_0x2914('0x21')](0xcc)[_0x2914('0x2a')]();});}};}function handleEntityNotFound(_0x547501){return function(_0x1f3cc5){if(!_0x1f3cc5){_0x547501[_0x2914('0x20')](0x194);}return _0x1f3cc5;};}function handleError(_0x16f487,_0x458f7c){_0x458f7c=_0x458f7c||0x1f4;return function(_0x30845e){logger['error'](_0x30845e[_0x2914('0x2b')]);if(_0x30845e[_0x2914('0x2c')]){delete _0x30845e[_0x2914('0x2c')];}_0x16f487[_0x2914('0x21')](_0x458f7c)[_0x2914('0x2d')](_0x30845e);};}function getMustacheRender(_0x46e059,_0x31227a){return Mustache[_0x2914('0x2e')](_0x46e059,_[_0x2914('0x2f')](_0x31227a[_0x2914('0x30')],{'contact':_0x31227a['contact'],'message':_0x31227a[_0x2914('0x1c')],'agent':_0x31227a[_0x2914('0x31')],'interaction':_0x31227a[_0x2914('0x32')],'account':_0x31227a[_0x2914('0x33')]}))||'';}exports[_0x2914('0x34')]=function(_0x4d6912,_0xb04e1c){var _0x2593b8={};var _0x389a45=_[_0x2914('0x35')](db[_0x2914('0x36')][_0x2914('0x37')],function(_0x93f5e){return{'name':_0x93f5e[_0x2914('0x38')],'type':_0x93f5e[_0x2914('0x39')][_0x2914('0x3a')]};});_0x2593b8=qs['getOptions'](_0x389a45,_0x4d6912);return interaction['findAll'](_0x2914('0x3b'),_0x4d6912['query'],_0x4d6912[_0x2914('0x3c')],_0x2593b8,_0x389a45)[_0x2914('0x15')](respondWithFilteredResult(_0xb04e1c,_0x2593b8))[_0x2914('0x1f')](handleError(_0xb04e1c,null));};exports[_0x2914('0x3d')]=function(_0x22cd9f,_0x41c8af){var _0x3c9ce2={'raw':![],'where':{'id':_0x22cd9f['params']['id']}},_0xd6c0df={};_0xd6c0df[_0x2914('0x3e')]=_[_0x2914('0x3f')](db[_0x2914('0x36')][_0x2914('0x37')]);_0xd6c0df[_0x2914('0x40')]=_['keys'](_0x22cd9f[_0x2914('0x40')]);_0xd6c0df[_0x2914('0x41')]=_[_0x2914('0x42')](_0xd6c0df[_0x2914('0x3e')],_0xd6c0df[_0x2914('0x40')]);_0x3c9ce2[_0x2914('0x43')]=_[_0x2914('0x42')](_0xd6c0df[_0x2914('0x3e')],qs['fields'](_0x22cd9f['query']['fields']));_0x3c9ce2[_0x2914('0x43')]=_0x3c9ce2[_0x2914('0x43')][_0x2914('0x44')]?_0x3c9ce2[_0x2914('0x43')]:_0xd6c0df[_0x2914('0x3e')];if(_0x22cd9f[_0x2914('0x40')][_0x2914('0x45')]){_0x3c9ce2[_0x2914('0x46')]=[{'all':!![]}];}_0x3c9ce2=_[_0x2914('0x2f')]({},_0x3c9ce2,_0x22cd9f['options']);return db[_0x2914('0x36')][_0x2914('0x47')](_0x3c9ce2)[_0x2914('0x15')](handleEntityNotFound(_0x41c8af,null))[_0x2914('0x15')](respondWithResult(_0x41c8af,null))['catch'](handleError(_0x41c8af,null));};exports[_0x2914('0x48')]=function(_0x3e4105,_0x1dde03){return db[_0x2914('0x36')][_0x2914('0x48')](_0x3e4105[_0x2914('0x30')],{})[_0x2914('0x15')](respondWithResult(_0x1dde03,0xc9))[_0x2914('0x1f')](handleError(_0x1dde03,null));};exports[_0x2914('0x28')]=function(_0x7b65ee,_0x484b2c){if(_0x7b65ee[_0x2914('0x30')]['id']){delete _0x7b65ee['body']['id'];}return db[_0x2914('0x36')][_0x2914('0x47')]({'where':{'id':_0x7b65ee[_0x2914('0x49')]['id']}})['then'](handleEntityNotFound(_0x484b2c,null))[_0x2914('0x15')](saveUpdates(_0x7b65ee[_0x2914('0x30')],null))[_0x2914('0x15')](respondWithResult(_0x484b2c,null))[_0x2914('0x1f')](handleError(_0x484b2c,null));};exports[_0x2914('0x29')]=function(_0x534e1c,_0x3cdc50){return db[_0x2914('0x36')][_0x2914('0x47')]({'where':{'id':_0x534e1c[_0x2914('0x49')]['id']}})[_0x2914('0x15')](handleEntityNotFound(_0x3cdc50,null))[_0x2914('0x15')](removeEntity(_0x3cdc50,null))[_0x2914('0x1f')](handleError(_0x3cdc50,null));};exports[_0x2914('0x4a')]=function(_0x294ee3,_0x562c01){return db['ChatInteraction'][_0x2914('0x4a')]()[_0x2914('0x15')](respondWithResult(_0x562c01,null))[_0x2914('0x1f')](handleError(_0x562c01,null));};exports[_0x2914('0x4b')]=function(_0x4d38f2,_0x3000c7){var _0x4d8ce7=_0x4d38f2[_0x2914('0x49')]['id'];var _0x177a49;var _0xbc52b7;var _0x5a205e;return db['ChatInteraction']['findOne']({'where':{'id':_0x4d8ce7}})['then'](function(_0x27985e){_0x177a49=_0x27985e;return db[_0x2914('0x4c')][_0x2914('0x4d')]({'where':{'id':_0x27985e['ChatWebsiteId']},'attributes':['id',_0x2914('0x4e'),_0x2914('0x4f'),'vidaooTopic',_0x2914('0x50'),_0x2914('0x51')],'raw':!![]});})[_0x2914('0x15')](function(_0x274590){if(_0x274590&&_0x274590['vidaooApiKey']&&_0x274590[_0x2914('0x4f')]){_0xbc52b7=_0x274590;var _0xb05198={'interaction':{'id':_0x4d8ce7},'agent':{'id':_0x4d38f2[_0x2914('0x3c')]['id'],'name':_0x4d38f2[_0x2914('0x3c')][_0x2914('0x2c')],'fullname':_0x4d38f2[_0x2914('0x3c')][_0x2914('0x52')],'email':_0x4d38f2[_0x2914('0x3c')][_0x2914('0x53')]},'contact':_0x4d38f2[_0x2914('0x30')][_0x2914('0x54')],'account':_0x4d38f2[_0x2914('0x30')]['account']};var _0x506975={'rejectUnauthorized':![],'method':_0x2914('0x55'),'url':_0x2914('0x56'),'headers':{'X-APIKEY':_0x274590[_0x2914('0x4e')]},'body':{'duration':null,'scheduledAt':null,'participants':[_0x4d38f2['user'][_0x2914('0x53')]],'buttons':null,'topic':_0xbc52b7[_0x2914('0x57')],'note':_[_0x2914('0x58')](_0xbc52b7[_0x2914('0x50')])?null:getMustacheRender(_0xbc52b7[_0x2914('0x50')],_0xb05198),'metadata':null},'redirect':_0x2914('0x59'),'json':!![]};try{if(!_[_0x2914('0x58')](_0xbc52b7[_0x2914('0x51')])){var _0x1c6ee1=getMustacheRender(_0xbc52b7[_0x2914('0x51')],_0xb05198);var _0x5c472e=JSON[_0x2914('0x5a')](_0x1c6ee1);_0x506975[_0x2914('0x30')][_0x2914('0x5b')]=_0x5c472e;}}catch(_0x473ca2){throw new db[(_0x2914('0x5c'))][(_0x2914('0x5d'))](_0x2914('0x5e'));}return rp(_0x506975);}else{throw new db[(_0x2914('0x5c'))]['ValidationError'](_0x2914('0x5f'));}})[_0x2914('0x15')](function(_0x9e9489){_0x5a205e=_0x9e9489;if(_0x5a205e['id']){var _0x1d238e={'body':_0x5a205e[_0x2914('0x60')],'ChatWebsiteId':_0xbc52b7['id'],'ChatInteractionId':_0x177a49['id'],'direction':_0x2914('0x61'),'UserId':_0x4d38f2[_0x2914('0x3c')]['id']};return db[_0x2914('0x62')][_0x2914('0x48')](_0x1d238e,{});}else{throw new db[(_0x2914('0x5c'))][(_0x2914('0x5d'))]('Unable\x20to\x20create\x20Vidaoo\x20session');}})[_0x2914('0x15')](function(){return _0x177a49[_0x2914('0x63')]({'vidaooSessionId':_0x5a205e['id']});})[_0x2914('0x15')](respondWithResult(_0x3000c7,null))[_0x2914('0x1f')](handleError(_0x3000c7,null));};exports[_0x2914('0x64')]=function(_0x92a6e4,_0x4f7dc6){if(_0x92a6e4[_0x2914('0x30')]['id']){delete _0x92a6e4[_0x2914('0x30')]['id'];}return db[_0x2914('0x36')]['find']({'where':{'id':_0x92a6e4[_0x2914('0x49')]['id']},'include':[{'model':db['CmContact'],'as':_0x2914('0x65')}]})[_0x2914('0x15')](handleEntityNotFound(_0x4f7dc6,null))['then'](saveUpdates(_0x92a6e4[_0x2914('0x30')],null))[_0x2914('0x15')](respondWithResult(_0x4f7dc6,null))[_0x2914('0x1f')](handleError(_0x4f7dc6,null));};exports[_0x2914('0x66')]=function(_0x2bc177,_0x6361a2){if(_0x2bc177['body']['id']){delete _0x2bc177[_0x2914('0x30')]['id'];}return db[_0x2914('0x36')][_0x2914('0x47')]({'where':{'id':_0x2bc177[_0x2914('0x49')]['id']}})[_0x2914('0x15')](function(_0x1a85bd){if(!_0x1a85bd){logger[_0x2914('0x1a')](_0x2914('0x67'),_0x2914('0x66'),0x194,_0x2914('0x68'));_0x6361a2[_0x2914('0x20')](0x194);}else{if(_0x1a85bd[_0x2914('0x69')]){throw new db[(_0x2914('0x5c'))]['ValidationError'](_0x2914('0x6a'));}}return _0x1a85bd;})['then'](function(_0x11c33e){if(_0x11c33e){return _0x11c33e[_0x2914('0x28')]({'closed':_0x2bc177[_0x2914('0x30')][_0x2914('0x6b')],'disposition':_0x2bc177[_0x2914('0x30')][_0x2914('0x6c')]})[_0x2914('0x15')](function(_0xe9552d){return _0xe9552d;});}})['then'](function(){return respondWithRpcPromise(_0x2914('0x6d'),_0x2914('0x66'),_0x2bc177[_0x2914('0x30')],client9004);})[_0x2914('0x15')](respondWithResult(_0x6361a2,null))[_0x2914('0x1f')](handleError(_0x6361a2,null));};exports[_0x2914('0x6e')]=function(_0x310cdf,_0x287e03){_0x310cdf['body'][_0x2914('0x2c')]=_0x310cdf['file'][_0x2914('0x6f')];_0x310cdf[_0x2914('0x30')][_0x2914('0x70')]=_0x310cdf[_0x2914('0x71')][_0x2914('0x72')];_0x310cdf[_0x2914('0x30')]['type']=_0x310cdf['file'][_0x2914('0x73')];return db['Attachment']['create'](_0x310cdf[_0x2914('0x30')])[_0x2914('0x15')](respondWithResult(_0x287e03,0xc9))['catch'](handleError(_0x287e03,null));};exports['attachmentDownload']=function(_0x1c4e4f,_0x34e12a){return db[_0x2914('0x36')][_0x2914('0x4d')]({'where':{'id':_0x1c4e4f[_0x2914('0x49')]['id']},'raw':!![]})[_0x2914('0x15')](handleEntityNotFound(_0x34e12a,null))[_0x2914('0x15')](function(_0x191e97){if(_0x191e97){if(_0x191e97['closed']){return _0x34e12a[_0x2914('0x21')](0x193)[_0x2914('0x22')]({'status':0x193,'message':_0x2914('0x74')});}return db[_0x2914('0x75')][_0x2914('0x4d')]({'where':{'id':_0x1c4e4f['query'][_0x2914('0x76')]},'raw':!![]})[_0x2914('0x15')](handleEntityNotFound(_0x34e12a,null));}})[_0x2914('0x15')](function(_0x557b5f){if(_0x557b5f){var _0xe9ee00=_0x557b5f['ChatOfflineMessageId']!==null;var _0x1a4c4f=path[_0x2914('0x77')](config['root'],_0x2914('0x78'));if(_0xe9ee00){_0x1a4c4f=path[_0x2914('0x77')](_0x1a4c4f,'offline-chat/');}var _0x8ef8d6=path[_0x2914('0x77')](_0x1a4c4f,_0x557b5f[_0x2914('0x70')]);return _0x34e12a[_0x2914('0x79')](_0x8ef8d6);}})[_0x2914('0x1f')](handleError(_0x34e12a,null));};exports[_0x2914('0x7a')]=function(_0x452964,_0x2e4028){var _0xcd1eb4=null;var _0x4de9f0=null;var _0x51f918=null;if(_0x452964['body']['id']){delete _0x452964[_0x2914('0x30')]['id'];}if(_0x452964[_0x2914('0x30')][_0x2914('0x7b')]){_0x51f918=path[_0x2914('0x77')](config[_0x2914('0x7c')],_0x2914('0x7d'),util[_0x2914('0x7e')](_0x2914('0x7f'),Date[_0x2914('0x80')]()));_0x452964[_0x2914('0x30')]['pathTranscript']=_0x51f918;}return db['ChatInteraction'][_0x2914('0x47')]({'where':{'id':_0x452964[_0x2914('0x49')]['id']},'include':[{'model':db[_0x2914('0x62')],'as':'Messages','include':[{'model':db[_0x2914('0x81')],'as':_0x2914('0x81')}]}]})[_0x2914('0x15')](handleEntityNotFound(_0x2e4028,null))['then'](saveUpdates(_0x452964[_0x2914('0x30')],null))[_0x2914('0x15')](function(_0xa18838){if(_0xa18838){_0xcd1eb4=_0xa18838;return db['ChatWebsite'][_0x2914('0x47')]({'where':{'id':_0xcd1eb4[_0x2914('0x82')]}});}})['then'](function(_0x749286){if(_0x749286){_0x4de9f0=_0x749286;return db[_0x2914('0x83')][_0x2914('0x47')]({'where':{'id':_0xcd1eb4[_0x2914('0x84')]}});}})[_0x2914('0x15')](function(_0x3ee4d6){if(_0x3ee4d6){if(_0x51f918){var _0x3b9418=null;for(var _0x109559=0x1;_0x109559<_0xcd1eb4[_0x2914('0x85')][_0x2914('0x44')];++_0x109559){_0x3b9418=_0xcd1eb4[_0x2914('0x85')][_0x109559];var _0x16faed=_0x3b9418[_0x2914('0x69')]?util[_0x2914('0x7e')](_0x2914('0x86'),_0x4de9f0[_0x2914('0x87')],_0x3b9418[_0x2914('0x69')]):_0x2914('0x88');var _0x55d7a7=_0x452964['body'][_0x2914('0x89')]||util[_0x2914('0x7e')]('%s%d','Visitor',_0x3b9418[_0x2914('0x84')]);switch(_0x4de9f0[_0x2914('0x8a')]){case _0x2914('0x8b'):_0x16faed=_0x3b9418[_0x2914('0x69')]?util[_0x2914('0x7e')](_0x2914('0x86'),_0x4de9f0[_0x2914('0x87')],_0x3b9418['UserId']):_0x2914('0x88');break;case _0x2914('0x8c'):_0x16faed=_0x3b9418['UserId']?_0x3b9418[_0x2914('0x81')][_0x2914('0x8d')]||_0x3b9418[_0x2914('0x81')][_0x2914('0x52')]:'System';break;case _0x2914('0x8e'):_0x16faed=_0x3b9418['UserId']?_0x3b9418[_0x2914('0x81')][_0x2914('0x52')]:_0x2914('0x88');break;default:_0x16faed=_0x3b9418['UserId']?util['format'](_0x2914('0x86'),_0x4de9f0[_0x2914('0x87')],_0x3b9418[_0x2914('0x69')]):_0x2914('0x88');}var _0x5de42d=util[_0x2914('0x7e')](_0x2914('0x8f'),moment(_0x3b9418['createdAt'])[_0x2914('0x7e')](_0x2914('0x90')),_0x3b9418['direction']==='in'?_0x55d7a7:_0x16faed,_0x3b9418[_0x2914('0x30')]);if(!_0x3b9418[_0x2914('0x91')]){fs[_0x2914('0x92')](_0x51f918,_0x5de42d);}}return db[_0x2914('0x93')][_0x2914('0x4d')]({'where':{'service':!![]},'include':[{'model':db[_0x2914('0x94')],'as':_0x2914('0x95'),'raw':!![],'include':[{'model':db['CloudProvider'],'as':'CloudProvider','raw':!![]}]}]});}}})['then'](function(_0x4ec4aa){if(!_0x4ec4aa||!_0x4ec4aa[_0x2914('0x95')]||!_0x452964[_0x2914('0x30')])return _0xcd1eb4;var _0x1459d4=_0x4ec4aa[_0x2914('0x96')]();return respondWithRpcPromise(_0x2914('0x97'),_0x2914('0x98'),{'account':_0x1459d4,'message':{'from':util[_0x2914('0x7e')](_0x2914('0x99'),_0x4ec4aa[_0x2914('0x2c')],_0x4ec4aa['email']||_0x4ec4aa[_0x2914('0x95')][_0x2914('0x3c')]),'to':_0x452964[_0x2914('0x30')]['mailTranscript'],'subject':_0x2914('0x9a'),'text':util[_0x2914('0x7e')](_0x2914('0x9b'),_0x452964[_0x2914('0x30')][_0x2914('0x7b')]),'attachments':[{'path':_0x51f918}]}})['then'](function(){return _0xcd1eb4;})[_0x2914('0x1f')](function(_0x55369c){logger[_0x2914('0x1a')](_0x55369c);});})[_0x2914('0x15')](respondWithStatusCode(_0x2e4028,0xc8))['catch'](handleError(_0x2e4028,null));};exports[_0x2914('0x9c')]=function(_0x5cbf0f,_0x24e1c9){return db[_0x2914('0x62')][_0x2914('0x47')]({'where':{'id':_0x5cbf0f[_0x2914('0x49')]['id']}})[_0x2914('0x15')](handleEntityNotFound(_0x24e1c9,null))[_0x2914('0x15')](function(_0x427ffa){if(_0x427ffa){return _0x427ffa[_0x2914('0x9c')](_0x5cbf0f[_0x2914('0x30')][_0x2914('0x9d')],_['omit'](_0x5cbf0f[_0x2914('0x30')],[_0x2914('0x9d'),'id'])||{});}})[_0x2914('0x15')](respondWithResult(_0x24e1c9,null))[_0x2914('0x1f')](handleError(_0x24e1c9,null));};exports[_0x2914('0x9e')]=function(_0x27056c,_0x64374b){var _0x3701b9={'raw':![],'where':{}};var _0x30ac95={};var _0x431ed3={'count':0x0,'rows':[]};return db[_0x2914('0x36')][_0x2914('0x4d')]({'where':{'id':_0x27056c['params']['id']}})['then'](handleEntityNotFound(_0x64374b,null))['then'](function(_0x403a42){if(_0x403a42){_0x30ac95[_0x2914('0x3e')]=_['keys'](db[_0x2914('0x62')][_0x2914('0x37')]);_0x30ac95['query']=_[_0x2914('0x3f')](_0x27056c[_0x2914('0x40')]);_0x30ac95[_0x2914('0x41')]=_[_0x2914('0x42')](_0x30ac95['model'],_0x30ac95[_0x2914('0x40')]);_0x3701b9[_0x2914('0x43')]=_['intersection'](_0x30ac95['model'],qs['fields'](_0x27056c[_0x2914('0x40')][_0x2914('0x9f')]));_0x3701b9[_0x2914('0x43')]=_0x3701b9[_0x2914('0x43')][_0x2914('0x44')]?_0x3701b9[_0x2914('0x43')]:_0x30ac95[_0x2914('0x3e')];if(!_0x27056c['query'][_0x2914('0xa0')](_0x2914('0xa1'))){_0x3701b9[_0x2914('0x24')]=qs[_0x2914('0x24')](_0x27056c[_0x2914('0x40')][_0x2914('0x24')]);_0x3701b9[_0x2914('0x25')]=qs['offset'](_0x27056c[_0x2914('0x40')][_0x2914('0x25')]);}_0x3701b9[_0x2914('0xa2')]=qs[_0x2914('0xa3')](_0x27056c[_0x2914('0x40')][_0x2914('0xa3')]);_0x3701b9[_0x2914('0xa4')]=qs[_0x2914('0x41')](_['pick'](_0x27056c[_0x2914('0x40')],_0x30ac95[_0x2914('0x41')]));_0x3701b9[_0x2914('0xa4')][_0x2914('0xa5')]=_0x403a42['id'];if(_0x27056c[_0x2914('0x40')]['filter']){_0x3701b9[_0x2914('0xa4')]=_[_0x2914('0x2f')](_0x3701b9[_0x2914('0xa4')],{'$or':_[_0x2914('0x35')](_0x3701b9['attributes'],function(_0x55b1cf){var _0x3f2f15={};_0x3f2f15[_0x55b1cf]={'$like':'%'+_0x27056c[_0x2914('0x40')][_0x2914('0xa6')]+'%'};return _0x3f2f15;})});}if(_0x27056c['query'][_0x2914('0xa7')]){var _0x3fd64b=_0x27056c['query'][_0x2914('0xa7')][_0x2914('0xa8')](',');var _0x3f51ce={};_0x3f51ce[_0x3fd64b[0x0]]={'$gte':moment(_0x3fd64b[0x1])[_0x2914('0x7e')]('YYYY-MM-DD\x20HH:mm:ss')};_0x3701b9[_0x2914('0xa4')]=_[_0x2914('0x2f')](_0x3701b9[_0x2914('0xa4')],_0x3f51ce);}_0x3701b9=_[_0x2914('0x2f')]({},_0x3701b9,_0x27056c[_0x2914('0xa9')]);return db[_0x2914('0x62')][_0x2914('0x26')]({'where':_0x3701b9[_0x2914('0xa4')]})[_0x2914('0x15')](function(_0x367693){_0x431ed3['count']=_0x367693;if(_0x27056c[_0x2914('0x40')][_0x2914('0x45')]){_0x3701b9['include']=[{'all':!![]}];}return db[_0x2914('0x62')][_0x2914('0xaa')](_0x3701b9);})[_0x2914('0x15')](function(_0x3d0a71){_0x431ed3[_0x2914('0xab')]=_0x3d0a71;return _0x431ed3;});}})[_0x2914('0x15')](respondWithFilteredResult(_0x64374b,_0x3701b9))[_0x2914('0x1f')](handleError(_0x64374b,null));};exports[_0x2914('0xac')]=function(_0x4f77f4,_0x3163f8){var _0x54508d={'where':{}},_0x217220={},_0x15c21c={'count':0x0,'rows':[]};return db['ChatInteraction'][_0x2914('0x4d')]({'where':{'id':_0x4f77f4[_0x2914('0x49')]['id']}})[_0x2914('0x15')](handleEntityNotFound(_0x3163f8,null))[_0x2914('0x15')](function(_0x479248){if(_0x479248){_0x217220[_0x2914('0x3e')]=_['keys'](db[_0x2914('0x62')][_0x2914('0x37')]);_0x217220[_0x2914('0x40')]=_[_0x2914('0x3f')](_0x4f77f4[_0x2914('0x40')]);_0x217220[_0x2914('0x41')]=_[_0x2914('0x42')](_0x217220[_0x2914('0x3e')],_0x217220[_0x2914('0x40')]);_0x54508d[_0x2914('0x43')]=_[_0x2914('0x42')](_0x217220[_0x2914('0x3e')],qs[_0x2914('0x9f')](_0x4f77f4[_0x2914('0x40')]['fields']));_0x54508d[_0x2914('0x43')]=_0x54508d[_0x2914('0x43')]['length']?_0x54508d[_0x2914('0x43')]:_0x217220['model'];if(!_0x4f77f4['query']['hasOwnProperty'](_0x2914('0xa1'))){_0x54508d['limit']=qs['limit'](_0x4f77f4[_0x2914('0x40')]['limit']);_0x54508d[_0x2914('0x25')]=qs['offset'](_0x4f77f4[_0x2914('0x40')]['offset']);}_0x54508d[_0x2914('0xa2')]=qs[_0x2914('0xa3')](_0x4f77f4['query'][_0x2914('0xa3')]);_0x54508d[_0x2914('0xa4')]=qs[_0x2914('0x41')](_[_0x2914('0xad')](_0x4f77f4['query'],_0x217220[_0x2914('0x41')]));_0x54508d[_0x2914('0xa4')][_0x2914('0xa5')]=_0x479248['id'];if(_0x4f77f4[_0x2914('0x40')]['filter']){_0x54508d['where']=_[_0x2914('0x2f')](_0x54508d[_0x2914('0xa4')],{'$or':_[_0x2914('0x35')](_0x54508d[_0x2914('0x43')],function(_0x2ec6f4){var _0x9f2b00={};_0x9f2b00[_0x2ec6f4]={'$like':'%'+_0x4f77f4[_0x2914('0x40')]['filter']+'%'};return _0x9f2b00;})});}_0x54508d[_0x2914('0xa4')]['secret']=![];if(_0x4f77f4[_0x2914('0x40')]['id']){_0x54508d[_0x2914('0xa4')]['id']={'$gt':_0x4f77f4[_0x2914('0x40')]['id']};}_0x54508d=_[_0x2914('0x2f')]({},_0x54508d,_0x4f77f4['options']);return db[_0x2914('0x62')][_0x2914('0x26')]({'where':_0x54508d[_0x2914('0xa4')]})[_0x2914('0x15')](function(_0x391fad){_0x15c21c[_0x2914('0x26')]=_0x391fad;_0x54508d['include']=[];if(_0x4f77f4[_0x2914('0x40')][_0x2914('0xae')]){_0x54508d[_0x2914('0x46')][_0x2914('0xaf')]({'model':db['User'],'as':'User','attributes':['id',_0x2914('0x52'),_0x2914('0x8d')]});}if(_0x4f77f4['query'][_0x2914('0x45')]){_0x54508d[_0x2914('0x46')]=[{'all':!![]}];}return db[_0x2914('0x62')]['findAll'](_0x54508d);})['then'](function(_0x151f38){_0x15c21c['rows']=_0x151f38;return _0x15c21c;});}})[_0x2914('0x15')](respondWithFilteredResult(_0x3163f8,_0x54508d))[_0x2914('0x1f')](handleError(_0x3163f8,null));};exports[_0x2914('0xb0')]=function(_0x10bab4,_0x52bb43){return db[_0x2914('0x36')][_0x2914('0x47')]({'where':{'id':_0x10bab4[_0x2914('0x49')]['id']}})['then'](handleEntityNotFound(_0x52bb43,null))[_0x2914('0x15')](function(_0x4dc3b8){if(_0x4dc3b8){return _0x4dc3b8[_0x2914('0xb1')](_0x10bab4['body'][_0x2914('0x9d')],_[_0x2914('0xb2')](_0x10bab4[_0x2914('0x30')],[_0x2914('0x9d'),'id'])||{})[_0x2914('0xb3')](function(){return db[_0x2914('0xb4')]['findAll']({'attributes':['id','name',_0x2914('0xb5')],'where':{'id':_0x10bab4[_0x2914('0x30')][_0x2914('0x9d')]}});})[_0x2914('0x15')](function(_0x439382){socket[_0x2914('0xb6')](_0x2914('0xb7'),{'id':Number(_0x10bab4[_0x2914('0x49')]['id']),'tags':_0x439382||[]});return{'id':Number(_0x10bab4['params']['id']),'tags':_0x439382||[]};});}})[_0x2914('0x15')](respondWithResult(_0x52bb43,null))[_0x2914('0x1f')](handleError(_0x52bb43,null));};exports[_0x2914('0xb8')]=function(_0x3cf33f,_0x54083d){return db[_0x2914('0x36')]['find']({'where':{'id':_0x3cf33f[_0x2914('0x49')]['id']}})[_0x2914('0x15')](handleEntityNotFound(_0x54083d,null))[_0x2914('0x15')](function(_0x120c06){if(_0x120c06){return _0x120c06[_0x2914('0xb8')](_0x3cf33f[_0x2914('0x40')][_0x2914('0x9d')]);}})[_0x2914('0x15')](respondWithStatusCode(_0x54083d,null))[_0x2914('0x1f')](handleError(_0x54083d,null));};exports['download']=function(_0xd05568,_0x2b91ed){var _0x53df09=moment()[_0x2914('0xb9')]()['toString']();var _0x1d26d5=path[_0x2914('0x77')](config[_0x2914('0x7c')],_0x2914('0xba'),'files',_0x2914('0xbb'));var _0x4a1d34=path[_0x2914('0x77')](config[_0x2914('0x7c')],_0x2914('0xba'),_0x2914('0xbc'),_0x2914('0xbd'));var _0x4e86fb=path[_0x2914('0x77')](_0x1d26d5,_0x53df09);var _0x5bb3b4=util[_0x2914('0x7e')]('transcript-%d-%s.zip',_0xd05568[_0x2914('0x49')]['id'],_0x53df09);var _0x3906a2=path[_0x2914('0x77')](_0x1d26d5,_0x5bb3b4);var _0xe40f5d=[];_0xe40f5d[_0x2914('0xaf')]({'model':db[_0x2914('0x81')],'as':_0x2914('0x81'),'attributes':['id','fullname'],'raw':!![]});_0xe40f5d[_0x2914('0xaf')]({'model':db[_0x2914('0x83')],'as':'Contact','attributes':['id',_0x2914('0xbe'),_0x2914('0xbf')],'raw':!![]});if(_0xd05568[_0x2914('0x40')][_0x2914('0xbd')]){_0xe40f5d[_0x2914('0xaf')]({'model':db[_0x2914('0x75')],'as':'Attachment','raw':!![]});}var _0x2eaf79=[{'model':db[_0x2914('0x62')],'as':_0x2914('0x85'),'attributes':['id',_0x2914('0x30'),_0x2914('0xc0'),'direction',_0x2914('0x91'),_0x2914('0xc1')],'include':_0xe40f5d}];_0x2eaf79[_0x2914('0xaf')]({'model':db[_0x2914('0x4c')],'as':_0x2914('0xc2'),'attributes':['id','name']});_0x2eaf79[_0x2914('0xaf')]({'model':db['User'],'as':_0x2914('0xc3'),'attributes':['id','fullname']});return db[_0x2914('0x36')][_0x2914('0x47')]({'where':{'id':_0xd05568[_0x2914('0x49')]['id']},'include':_0x2eaf79})[_0x2914('0x15')](handleEntityNotFound(_0x2b91ed,null))['then'](function(_0xd1e2bc){if(_0xd1e2bc){var _0x28292c=_0xd1e2bc['get']({'plain':!![]});fs[_0x2914('0xc4')](_0x4e86fb);var _0x29d2be={'channel':_0x2914('0xc5'),'account':_0x28292c['Account']['name'],'agent':_0x28292c['Owner']?_0x28292c[_0x2914('0xc3')][_0x2914('0x52')]:_0x2914('0xc6'),'createdAt':moment(_0x28292c[_0x2914('0xc0')])[_0x2914('0x7e')](_0x2914('0xc7'))[_0x2914('0xc8')](),'closedAt':_0x28292c['closed']?moment(_0x28292c[_0x2914('0xc9')])[_0x2914('0x7e')]('YYYY-MM-DD\x20HH:mm:ss')[_0x2914('0xc8')]():'','disposition':_0x28292c['disposition'],'chatInfo':{'browser':_0x28292c[_0x2914('0xca')],'os':_0x28292c[_0x2914('0xcb')],'referer':_0x28292c[_0x2914('0xcc')],'customerIp':_0x28292c[_0x2914('0xcd')],'customerPort':_0x28292c[_0x2914('0xce')]?_0x28292c[_0x2914('0xce')]:_0x2914('0xc6')},'messages':_(_0x28292c[_0x2914('0x85')])[_0x2914('0xcf')]()[_0x2914('0xa6')]({'secret':![]})[_0x2914('0x35')](function(_0x1a771a){if(_0x1a771a[_0x2914('0x75')]){var _0x14259e=path[_0x2914('0x77')](_0x4a1d34,_0x1a771a[_0x2914('0x75')][_0x2914('0x70')]);if(fs['existsSync'](_0x14259e)){fs[_0x2914('0xd0')](_0x14259e)[_0x2914('0xd1')](fs[_0x2914('0xd2')](path[_0x2914('0x77')](_0x4e86fb,_0x1a771a['Attachment'][_0x2914('0x70')])));}}return{'date':moment(_0x1a771a['createdAt'])['format']('YYYY-MM-DD\x20HH:mm:ss')[_0x2914('0xc8')](),'sender':_0x1a771a[_0x2914('0xd3')]===_0x2914('0x61')?_0x1a771a[_0x2914('0x81')]?_0x1a771a[_0x2914('0x81')][_0x2914('0x52')]:_0x2914('0x88'):_0x1a771a[_0x2914('0x65')]['firstName']+(_0x1a771a[_0x2914('0x65')][_0x2914('0xbf')]?'\x20'+_0x1a771a[_0x2914('0x65')][_0x2914('0xbf')]:''),'body':_0x1a771a['Attachment']?_0x1a771a[_0x2914('0x75')][_0x2914('0x70')]:_0x1a771a[_0x2914('0x30')],'direction':_0x1a771a[_0x2914('0xd3')]===_0x2914('0x61')?'A':'C','secret':_0x1a771a[_0x2914('0x91')],'read':_0x1a771a[_0x2914('0xc1')],'attachment':_0x1a771a[_0x2914('0x75')]};})[_0x2914('0xd4')]()};return ejs[_0x2914('0xd5')](path['join'](config[_0x2914('0x7c')],_0x2914('0xba'),_0x2914('0xd6'),_0x2914('0xd7')),{'interaction':_0x29d2be})[_0x2914('0x15')](function(_0x5c1028){var _0x4a6b9a=path[_0x2914('0x77')](_0x4e86fb,_0x2914('0xd8')+_0x28292c['id']+'-'+_0x53df09+_0x2914('0xd9'));var _0x54b9ab={'path':_0x4a6b9a,'channel':_0x2914('0xc5'),'interactionId':_0x28292c['id']};return pdf[_0x2914('0xda')](_0x5c1028,_0x54b9ab);})[_0x2914('0x15')](function(){return new Promise(function(_0x34cf29,_0x3761dd){zipdir(_0x4e86fb,{'saveTo':_0x3906a2},function(_0x1f0efa,_0x15e8f4){if(_0x1f0efa)return _0x3761dd(_0x1f0efa);return _0x34cf29(_0x15e8f4);});})[_0x2914('0x15')](function(){return new BPromise(function(_0xeca6a0,_0x4d3bea){rimraf(_0x4e86fb,function(_0x316197){if(_0x316197)_0x4d3bea(_0x316197);return _0xeca6a0();});});})['then'](function(){return _0x2b91ed[_0x2914('0x79')](_0x3906a2,_0x5bb3b4,function(_0x2ad873){if(_0x2ad873){logger['error']('err',_0x2ad873);}else{fs['unlinkSync'](_0x3906a2);}});});});}else{return _0x2b91ed['sendStatus'](0xc8);}})[_0x2914('0x1f')](handleError(_0x2b91ed,null));}; \ No newline at end of file +var _0xe8ac=['update','destroy','end','stack','name','send','body','contact','agent','interaction','account','index','map','rawAttributes','key','getOptions','findAll','chat','query','user','show','params','model','keys','ChatInteraction','attributes','intersection','fields','length','includeAll','include','merge','options','find','catch','create','describe','createVidaooSession','findOne','ChatWebsite','vidaooApiKey','vidaooEscalation','vidaooTopic','vidaooNote','vidaooMetadata','POST','email','follow','isNull','metadata','Sequelize','ValidationError','Error\x20in\x20Vidaoo\x20configuration','join_url','out','ChatMessage','Unable\x20to\x20create\x20Vidaoo\x20session','updateAttributes','customUpdate','CmContact','abandon','abandonInteraction,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','sendStatus','UserId','Interaction\x20already\x20assigned','closed','AbandonInteraction','attachmentUpload','originalname','basename','file','filename','mimetype','Attachment','attachmentDownload','Unauthorized','ChatOfflineMessageId','join','root','server/files/attachments/','offline-chat/','download','close','mailTranscript','server/files/chat/upload/','transcript-%s.txt','now','pathTranscript','Messages','User','ChatWebsiteId','ContactId','format','agentIdentifier','website_alias','%s%d','agentAlias','agent_alias','fullname','System','direction','secret','appendFileSync','MailServerOut','Smtp','CloudProvider','getSmtpOptions','\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','filters','hasOwnProperty','nolimit','sort','where','pick','ChatInteractionId','filter','$gte','split','YYYY-MM-DD\x20HH:mm:ss','rows','getMyMessages','order','includeAgent','push','alias','setTags','Tag','color','chatInteractionTags:save','removeTags','unix','toString','server','files','tmp','attachments','transcript-%d-%s.zip','Contact','firstName','lastName','createdAt','Account','Owner','mkdirSync','Chat','N.A.','closedAt','disposition','browserName','osName','referer','customerIp','customerPort','tail','existsSync','createReadStream','createWriteStream','read','value','renderFile','views','downloadInteraction.ejs','.pdf','createPdfFromHTML','err','unlinkSync','rimraf','zip-dir','request-promise','moment','bluebird','util','path','ejs','../../components/interaction/service','../../components/export/pdf','../../config/logger','api','../../config/environment','../../mysqldb','redis','socket.io-emitter','./chatInteraction.socket','register','jayson/promise','client','http','request','then','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','status','json','undefined','limit','count','offset'];(function(_0x2fe81c,_0x47463a){var _0x120bf4=function(_0x2eb5f4){while(--_0x2eb5f4){_0x2fe81c['push'](_0x2fe81c['shift']());}};_0x120bf4(++_0x47463a);}(_0xe8ac,0x17f));var _0xce8a=function(_0x3dd8c7,_0x487c5c){_0x3dd8c7=_0x3dd8c7-0x0;var _0x4b7788=_0xe8ac[_0x3dd8c7];return _0x4b7788;};'use strict';var rimraf=require(_0xce8a('0x0'));var zipdir=require(_0xce8a('0x1'));var rp=require(_0xce8a('0x2'));var moment=require(_0xce8a('0x3'));var BPromise=require(_0xce8a('0x4'));var Mustache=require('mustache');var util=require(_0xce8a('0x5'));var path=require(_0xce8a('0x6'));var ejs=require(_0xce8a('0x7'));var fs=require('fs');var _=require('lodash');var Redis=require('ioredis');var interaction=require(_0xce8a('0x8'));var qs=require('../../components/parsers/qs');var pdf=require(_0xce8a('0x9'));var logger=require(_0xce8a('0xa'))(_0xce8a('0xb'));var config=require(_0xce8a('0xc'));var db=require(_0xce8a('0xd'))['db'];config[_0xce8a('0xe')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xce8a('0xf'))(new Redis(config['redis']));require(_0xce8a('0x10'))[_0xce8a('0x11')](socket);var jayson=require(_0xce8a('0x12'));var client=jayson[_0xce8a('0x13')][_0xce8a('0x14')]({'port':0x232b});var client9004=jayson[_0xce8a('0x13')][_0xce8a('0x14')]({'port':0x232c});function respondWithRpcPromise(_0xa26d3f,_0xbdfef3,_0x26af7a,_0x20592c){return new BPromise(function(_0x331ab0,_0x303f41){var _0x5ef494=_0x20592c||client;return _0x5ef494[_0xce8a('0x15')](_0xa26d3f,_0x26af7a)[_0xce8a('0x16')](function(_0x2f822e){logger[_0xce8a('0x17')](_0xce8a('0x18'),_0xbdfef3,_0xce8a('0x19'));logger[_0xce8a('0x1a')](_0xce8a('0x1b'),_0xbdfef3,_0xce8a('0x19'),JSON[_0xce8a('0x1c')](_0x2f822e));if(_0x2f822e[_0xce8a('0x1d')]){if(_0x2f822e['error'][_0xce8a('0x1e')]===0x1f4){logger[_0xce8a('0x1d')](_0xce8a('0x18'),_0xbdfef3,_0x2f822e[_0xce8a('0x1d')][_0xce8a('0x1f')]);return _0x303f41(_0x2f822e['error'][_0xce8a('0x1f')]);}logger[_0xce8a('0x1d')]('ChatInteraction,\x20%s,\x20%s',_0xbdfef3,_0x2f822e['error'][_0xce8a('0x1f')]);return _0x331ab0(_0x2f822e[_0xce8a('0x1d')]['message']);}else{logger[_0xce8a('0x17')](_0xce8a('0x18'),_0xbdfef3,'request\x20sent');_0x331ab0(_0x2f822e[_0xce8a('0x20')][_0xce8a('0x1f')]);}})['catch'](function(_0x18f0e8){logger[_0xce8a('0x1d')](_0xce8a('0x18'),_0xbdfef3,_0x18f0e8);_0x303f41(_0x18f0e8);});});}function respondWithStatusCode(_0x1ec911,_0x24d533){_0x24d533=_0x24d533||0xcc;return function(_0x548c4a){if(_0x548c4a){return _0x1ec911['sendStatus'](_0x24d533);}return _0x1ec911[_0xce8a('0x21')](_0x24d533)['end']();};}function respondWithResult(_0x4dc282,_0x23bf72){_0x23bf72=_0x23bf72||0xc8;return function(_0x2859cf){if(_0x2859cf){return _0x4dc282['status'](_0x23bf72)[_0xce8a('0x22')](_0x2859cf);}};}function respondWithFilteredResult(_0x1c2bc9,_0x35156e){return function(_0x1fca40){if(_0x1fca40){var _0x1eebe3=typeof _0x35156e['offset']===_0xce8a('0x23')&&typeof _0x35156e[_0xce8a('0x24')]===_0xce8a('0x23');var _0x2cf954=_0x1fca40[_0xce8a('0x25')];var _0x55f759=_0x1eebe3?0x0:_0x35156e[_0xce8a('0x26')];var _0x567b9b=_0x1eebe3?_0x1fca40[_0xce8a('0x25')]:_0x35156e[_0xce8a('0x26')]+_0x35156e[_0xce8a('0x24')];var _0x2d419c;if(_0x567b9b>=_0x2cf954){_0x567b9b=_0x2cf954;_0x2d419c=0xc8;}else{_0x2d419c=0xce;}_0x1c2bc9['status'](_0x2d419c);return _0x1c2bc9['set']('Content-Range',_0x55f759+'-'+_0x567b9b+'/'+_0x2cf954)[_0xce8a('0x22')](_0x1fca40);}return null;};}function saveUpdates(_0x22b237){return function(_0xf724ea){if(_0xf724ea){return _0xf724ea[_0xce8a('0x27')](_0x22b237)[_0xce8a('0x16')](function(_0x42c8d2){return _0x42c8d2;});}return null;};}function removeEntity(_0x980eb5){return function(_0x219078){if(_0x219078){return _0x219078[_0xce8a('0x28')]()[_0xce8a('0x16')](function(){_0x980eb5[_0xce8a('0x21')](0xcc)[_0xce8a('0x29')]();});}};}function handleEntityNotFound(_0x51ed9f){return function(_0x4f0cd3){if(!_0x4f0cd3){_0x51ed9f['sendStatus'](0x194);}return _0x4f0cd3;};}function handleError(_0x57738f,_0x5b7398){_0x5b7398=_0x5b7398||0x1f4;return function(_0x463ed9){logger[_0xce8a('0x1d')](_0x463ed9[_0xce8a('0x2a')]);if(_0x463ed9['name']){delete _0x463ed9[_0xce8a('0x2b')];}_0x57738f['status'](_0x5b7398)[_0xce8a('0x2c')](_0x463ed9);};}function getMustacheRender(_0x3a91d9,_0x428272){return Mustache['render'](_0x3a91d9,_['merge'](_0x428272[_0xce8a('0x2d')],{'contact':_0x428272[_0xce8a('0x2e')],'message':_0x428272[_0xce8a('0x1f')],'agent':_0x428272[_0xce8a('0x2f')],'interaction':_0x428272[_0xce8a('0x30')],'account':_0x428272[_0xce8a('0x31')]}))||'';}exports[_0xce8a('0x32')]=function(_0x2348fa,_0x2044ee){var _0x2b6725={};var _0x3095aa=_[_0xce8a('0x33')](db['ChatInteraction'][_0xce8a('0x34')],function(_0x1be212){return{'name':_0x1be212['fieldName'],'type':_0x1be212['type'][_0xce8a('0x35')]};});_0x2b6725=qs[_0xce8a('0x36')](_0x3095aa,_0x2348fa);return interaction[_0xce8a('0x37')](_0xce8a('0x38'),_0x2348fa[_0xce8a('0x39')],_0x2348fa[_0xce8a('0x3a')],_0x2b6725,_0x3095aa)['then'](respondWithFilteredResult(_0x2044ee,_0x2b6725))['catch'](handleError(_0x2044ee,null));};exports[_0xce8a('0x3b')]=function(_0x1a2dbf,_0x284d2e){var _0x920dd0={'raw':![],'where':{'id':_0x1a2dbf[_0xce8a('0x3c')]['id']}},_0x1b0d62={};_0x1b0d62[_0xce8a('0x3d')]=_[_0xce8a('0x3e')](db[_0xce8a('0x3f')][_0xce8a('0x34')]);_0x1b0d62['query']=_[_0xce8a('0x3e')](_0x1a2dbf[_0xce8a('0x39')]);_0x1b0d62['filters']=_['intersection'](_0x1b0d62['model'],_0x1b0d62[_0xce8a('0x39')]);_0x920dd0[_0xce8a('0x40')]=_[_0xce8a('0x41')](_0x1b0d62[_0xce8a('0x3d')],qs[_0xce8a('0x42')](_0x1a2dbf['query']['fields']));_0x920dd0[_0xce8a('0x40')]=_0x920dd0[_0xce8a('0x40')][_0xce8a('0x43')]?_0x920dd0[_0xce8a('0x40')]:_0x1b0d62[_0xce8a('0x3d')];if(_0x1a2dbf[_0xce8a('0x39')][_0xce8a('0x44')]){_0x920dd0[_0xce8a('0x45')]=[{'all':!![]}];}_0x920dd0=_[_0xce8a('0x46')]({},_0x920dd0,_0x1a2dbf[_0xce8a('0x47')]);return db[_0xce8a('0x3f')][_0xce8a('0x48')](_0x920dd0)[_0xce8a('0x16')](handleEntityNotFound(_0x284d2e,null))[_0xce8a('0x16')](respondWithResult(_0x284d2e,null))[_0xce8a('0x49')](handleError(_0x284d2e,null));};exports['create']=function(_0x5716fa,_0x5665de){return db[_0xce8a('0x3f')][_0xce8a('0x4a')](_0x5716fa[_0xce8a('0x2d')],{})[_0xce8a('0x16')](respondWithResult(_0x5665de,0xc9))['catch'](handleError(_0x5665de,null));};exports[_0xce8a('0x27')]=function(_0x47c6b5,_0x4843e7){if(_0x47c6b5[_0xce8a('0x2d')]['id']){delete _0x47c6b5[_0xce8a('0x2d')]['id'];}return db[_0xce8a('0x3f')]['find']({'where':{'id':_0x47c6b5[_0xce8a('0x3c')]['id']}})['then'](handleEntityNotFound(_0x4843e7,null))[_0xce8a('0x16')](saveUpdates(_0x47c6b5['body'],null))[_0xce8a('0x16')](respondWithResult(_0x4843e7,null))[_0xce8a('0x49')](handleError(_0x4843e7,null));};exports['destroy']=function(_0x5745e4,_0x2f799c){return db[_0xce8a('0x3f')][_0xce8a('0x48')]({'where':{'id':_0x5745e4[_0xce8a('0x3c')]['id']}})[_0xce8a('0x16')](handleEntityNotFound(_0x2f799c,null))['then'](removeEntity(_0x2f799c,null))[_0xce8a('0x49')](handleError(_0x2f799c,null));};exports[_0xce8a('0x4b')]=function(_0x24868b,_0x19a79c){return db['ChatInteraction'][_0xce8a('0x4b')]()[_0xce8a('0x16')](respondWithResult(_0x19a79c,null))[_0xce8a('0x49')](handleError(_0x19a79c,null));};exports[_0xce8a('0x4c')]=function(_0x51763f,_0x4f7eaf){var _0x448f68=_0x51763f[_0xce8a('0x3c')]['id'];var _0x30e6c3;var _0x5d0f18;var _0x2f585b;return db['ChatInteraction'][_0xce8a('0x4d')]({'where':{'id':_0x448f68}})[_0xce8a('0x16')](function(_0x29c341){_0x30e6c3=_0x29c341;return db[_0xce8a('0x4e')][_0xce8a('0x4d')]({'where':{'id':_0x29c341['ChatWebsiteId']},'attributes':['id',_0xce8a('0x4f'),_0xce8a('0x50'),_0xce8a('0x51'),_0xce8a('0x52'),_0xce8a('0x53')],'raw':!![]});})[_0xce8a('0x16')](function(_0x3f7dd6){if(_0x3f7dd6&&_0x3f7dd6[_0xce8a('0x4f')]&&_0x3f7dd6[_0xce8a('0x50')]){_0x5d0f18=_0x3f7dd6;var _0x32e63={'interaction':{'id':_0x448f68},'agent':{'id':_0x51763f[_0xce8a('0x3a')]['id'],'name':_0x51763f['user']['name'],'fullname':_0x51763f['user']['fullname'],'email':_0x51763f['user']['email']},'contact':_0x51763f['body'][_0xce8a('0x2e')],'account':_0x51763f[_0xce8a('0x2d')][_0xce8a('0x31')]};var _0x306d9b={'rejectUnauthorized':![],'method':_0xce8a('0x54'),'url':'https://api-vidaoo.xcally.com/api/v1/meetings','headers':{'X-APIKEY':_0x3f7dd6['vidaooApiKey']},'body':{'duration':null,'scheduledAt':null,'participants':[_0x51763f[_0xce8a('0x3a')][_0xce8a('0x55')]],'buttons':null,'topic':_0x5d0f18[_0xce8a('0x51')],'note':_['isNull'](_0x5d0f18[_0xce8a('0x52')])?null:getMustacheRender(_0x5d0f18['vidaooNote'],_0x32e63),'metadata':null},'redirect':_0xce8a('0x56'),'json':!![]};try{if(!_[_0xce8a('0x57')](_0x5d0f18['vidaooMetadata'])){var _0x144fbb=getMustacheRender(_0x5d0f18['vidaooMetadata'],_0x32e63);var _0x3d4053=JSON['parse'](_0x144fbb);_0x306d9b['body'][_0xce8a('0x58')]=_0x3d4053;}}catch(_0xb36072){throw new db[(_0xce8a('0x59'))][(_0xce8a('0x5a'))]('Error\x20in\x20conversion\x20vidaooMetadata');}return rp(_0x306d9b);}else{throw new db[(_0xce8a('0x59'))]['ValidationError'](_0xce8a('0x5b'));}})['then'](function(_0x171a38){_0x2f585b=_0x171a38;if(_0x2f585b['id']){var _0x345046={'body':_0x2f585b[_0xce8a('0x5c')],'ChatWebsiteId':_0x5d0f18['id'],'ChatInteractionId':_0x30e6c3['id'],'direction':_0xce8a('0x5d'),'UserId':_0x51763f['user']['id']};return db[_0xce8a('0x5e')][_0xce8a('0x4a')](_0x345046,{});}else{throw new db[(_0xce8a('0x59'))][(_0xce8a('0x5a'))](_0xce8a('0x5f'));}})[_0xce8a('0x16')](function(){return _0x30e6c3[_0xce8a('0x60')]({'vidaooSessionId':_0x2f585b['id']});})[_0xce8a('0x16')](respondWithResult(_0x4f7eaf,null))['catch'](handleError(_0x4f7eaf,null));};exports[_0xce8a('0x61')]=function(_0x28ce7f,_0x32071a){if(_0x28ce7f[_0xce8a('0x2d')]['id']){delete _0x28ce7f['body']['id'];}return db[_0xce8a('0x3f')][_0xce8a('0x48')]({'where':{'id':_0x28ce7f[_0xce8a('0x3c')]['id']},'include':[{'model':db[_0xce8a('0x62')],'as':'Contact'}]})[_0xce8a('0x16')](handleEntityNotFound(_0x32071a,null))['then'](saveUpdates(_0x28ce7f['body'],null))[_0xce8a('0x16')](respondWithResult(_0x32071a,null))['catch'](handleError(_0x32071a,null));};exports[_0xce8a('0x63')]=function(_0xdf54d3,_0x434a9b){if(_0xdf54d3[_0xce8a('0x2d')]['id']){delete _0xdf54d3[_0xce8a('0x2d')]['id'];}return db['ChatInteraction'][_0xce8a('0x48')]({'where':{'id':_0xdf54d3[_0xce8a('0x3c')]['id']}})[_0xce8a('0x16')](function(_0x2ef8ae){if(!_0x2ef8ae){logger[_0xce8a('0x1d')](_0xce8a('0x64'),'abandon',0x194,_0xce8a('0x65'));_0x434a9b[_0xce8a('0x66')](0x194);}else{if(_0x2ef8ae[_0xce8a('0x67')]){throw new db[(_0xce8a('0x59'))][(_0xce8a('0x5a'))](_0xce8a('0x68'));}}return _0x2ef8ae;})[_0xce8a('0x16')](function(_0x439d46){if(_0x439d46){return _0x439d46['update']({'closed':_0xdf54d3[_0xce8a('0x2d')][_0xce8a('0x69')],'disposition':_0xdf54d3['body']['disposition']})[_0xce8a('0x16')](function(_0x4b52aa){return _0x4b52aa;});}})['then'](function(){return respondWithRpcPromise(_0xce8a('0x6a'),_0xce8a('0x63'),_0xdf54d3[_0xce8a('0x2d')],client9004);})[_0xce8a('0x16')](respondWithResult(_0x434a9b,null))['catch'](handleError(_0x434a9b,null));};exports[_0xce8a('0x6b')]=function(_0x46eeae,_0x12945a){_0x46eeae[_0xce8a('0x2d')][_0xce8a('0x2b')]=_0x46eeae['file'][_0xce8a('0x6c')];_0x46eeae[_0xce8a('0x2d')][_0xce8a('0x6d')]=_0x46eeae[_0xce8a('0x6e')][_0xce8a('0x6f')];_0x46eeae[_0xce8a('0x2d')]['type']=_0x46eeae[_0xce8a('0x6e')][_0xce8a('0x70')];return db[_0xce8a('0x71')][_0xce8a('0x4a')](_0x46eeae[_0xce8a('0x2d')])['then'](respondWithResult(_0x12945a,0xc9))[_0xce8a('0x49')](handleError(_0x12945a,null));};exports[_0xce8a('0x72')]=function(_0x540ce9,_0x45c224){return db['ChatInteraction'][_0xce8a('0x4d')]({'where':{'id':_0x540ce9['params']['id']},'raw':!![]})[_0xce8a('0x16')](handleEntityNotFound(_0x45c224,null))[_0xce8a('0x16')](function(_0x53e056){if(_0x53e056){if(_0x53e056['closed']){return _0x45c224[_0xce8a('0x21')](0x193)['json']({'status':0x193,'message':_0xce8a('0x73')});}return db[_0xce8a('0x71')][_0xce8a('0x4d')]({'where':{'id':_0x540ce9[_0xce8a('0x39')]['attachId']},'raw':!![]})['then'](handleEntityNotFound(_0x45c224,null));}})[_0xce8a('0x16')](function(_0x476fe1){if(_0x476fe1){var _0x2647f0=_0x476fe1[_0xce8a('0x74')]!==null;var _0x303c4b=path[_0xce8a('0x75')](config[_0xce8a('0x76')],_0xce8a('0x77'));if(_0x2647f0){_0x303c4b=path[_0xce8a('0x75')](_0x303c4b,_0xce8a('0x78'));}var _0x2ed522=path[_0xce8a('0x75')](_0x303c4b,_0x476fe1[_0xce8a('0x6d')]);return _0x45c224[_0xce8a('0x79')](_0x2ed522);}})[_0xce8a('0x49')](handleError(_0x45c224,null));};exports[_0xce8a('0x7a')]=function(_0x49fead,_0x3cd97f){var _0x52e827=null;var _0x59fd95=null;var _0x182f87=null;if(_0x49fead[_0xce8a('0x2d')]['id']){delete _0x49fead[_0xce8a('0x2d')]['id'];}if(_0x49fead[_0xce8a('0x2d')][_0xce8a('0x7b')]){_0x182f87=path[_0xce8a('0x75')](config[_0xce8a('0x76')],_0xce8a('0x7c'),util['format'](_0xce8a('0x7d'),Date[_0xce8a('0x7e')]()));_0x49fead['body'][_0xce8a('0x7f')]=_0x182f87;}return db[_0xce8a('0x3f')][_0xce8a('0x48')]({'where':{'id':_0x49fead['params']['id']},'include':[{'model':db['ChatMessage'],'as':_0xce8a('0x80'),'include':[{'model':db[_0xce8a('0x81')],'as':_0xce8a('0x81')}]}]})['then'](handleEntityNotFound(_0x3cd97f,null))[_0xce8a('0x16')](saveUpdates(_0x49fead[_0xce8a('0x2d')],null))[_0xce8a('0x16')](function(_0x2bd406){if(_0x2bd406){_0x52e827=_0x2bd406;return db[_0xce8a('0x4e')][_0xce8a('0x48')]({'where':{'id':_0x52e827[_0xce8a('0x82')]}});}})['then'](function(_0x40b332){if(_0x40b332){_0x59fd95=_0x40b332;return db[_0xce8a('0x62')][_0xce8a('0x48')]({'where':{'id':_0x52e827[_0xce8a('0x83')]}});}})[_0xce8a('0x16')](function(_0x25aad1){if(_0x25aad1){if(_0x182f87){var _0x1f37e4=null;for(var _0x43de1e=0x1;_0x43de1e<_0x52e827[_0xce8a('0x80')][_0xce8a('0x43')];++_0x43de1e){_0x1f37e4=_0x52e827[_0xce8a('0x80')][_0x43de1e];var _0x21ee17=_0x1f37e4[_0xce8a('0x67')]?util[_0xce8a('0x84')]('%s%d',_0x59fd95['agentAlias'],_0x1f37e4[_0xce8a('0x67')]):'System';var _0x37cc54=_0x49fead[_0xce8a('0x2d')]['customer']||util[_0xce8a('0x84')]('%s%d','Visitor',_0x1f37e4[_0xce8a('0x83')]);switch(_0x59fd95[_0xce8a('0x85')]){case _0xce8a('0x86'):_0x21ee17=_0x1f37e4[_0xce8a('0x67')]?util['format'](_0xce8a('0x87'),_0x59fd95[_0xce8a('0x88')],_0x1f37e4[_0xce8a('0x67')]):'System';break;case _0xce8a('0x89'):_0x21ee17=_0x1f37e4[_0xce8a('0x67')]?_0x1f37e4['User']['alias']||_0x1f37e4[_0xce8a('0x81')][_0xce8a('0x8a')]:'System';break;case'agent_fullname':_0x21ee17=_0x1f37e4[_0xce8a('0x67')]?_0x1f37e4[_0xce8a('0x81')]['fullname']:'System';break;default:_0x21ee17=_0x1f37e4[_0xce8a('0x67')]?util[_0xce8a('0x84')](_0xce8a('0x87'),_0x59fd95[_0xce8a('0x88')],_0x1f37e4[_0xce8a('0x67')]):_0xce8a('0x8b');}var _0x1695d0=util[_0xce8a('0x84')]('[%s]\x20%s:\x20%s\x0a',moment(_0x1f37e4['createdAt'])['format']('MM/DD/YYYY\x20HH:mm:ss'),_0x1f37e4[_0xce8a('0x8c')]==='in'?_0x37cc54:_0x21ee17,_0x1f37e4[_0xce8a('0x2d')]);if(!_0x1f37e4[_0xce8a('0x8d')]){fs[_0xce8a('0x8e')](_0x182f87,_0x1695d0);}}return db['MailAccount'][_0xce8a('0x4d')]({'where':{'service':!![]},'include':[{'model':db[_0xce8a('0x8f')],'as':_0xce8a('0x90'),'raw':!![],'include':[{'model':db['CloudProvider'],'as':_0xce8a('0x91'),'raw':!![]}]}]});}}})[_0xce8a('0x16')](function(_0x283f52){if(!_0x283f52||!_0x283f52[_0xce8a('0x90')]||!_0x49fead[_0xce8a('0x2d')])return _0x52e827;var _0x4d097c=_0x283f52[_0xce8a('0x92')]();return respondWithRpcPromise('SendMail','sendMail',{'account':_0x4d097c,'message':{'from':util['format'](_0xce8a('0x93'),_0x283f52[_0xce8a('0x2b')],_0x283f52[_0xce8a('0x55')]||_0x283f52[_0xce8a('0x90')][_0xce8a('0x3a')]),'to':_0x49fead[_0xce8a('0x2d')][_0xce8a('0x7b')],'subject':'Mail\x20Transcript','text':util[_0xce8a('0x84')](_0xce8a('0x94'),_0x49fead[_0xce8a('0x2d')][_0xce8a('0x7b')]),'attachments':[{'path':_0x182f87}]}})[_0xce8a('0x16')](function(){return _0x52e827;})[_0xce8a('0x49')](function(_0x4c27ca){logger[_0xce8a('0x1d')](_0x4c27ca);});})['then'](respondWithStatusCode(_0x3cd97f,0xc8))['catch'](handleError(_0x3cd97f,null));};exports['addMessage']=function(_0x4a8b43,_0x14ad30){return db[_0xce8a('0x5e')][_0xce8a('0x48')]({'where':{'id':_0x4a8b43[_0xce8a('0x3c')]['id']}})[_0xce8a('0x16')](handleEntityNotFound(_0x14ad30,null))[_0xce8a('0x16')](function(_0x5367c1){if(_0x5367c1){return _0x5367c1[_0xce8a('0x95')](_0x4a8b43[_0xce8a('0x2d')][_0xce8a('0x96')],_[_0xce8a('0x97')](_0x4a8b43[_0xce8a('0x2d')],[_0xce8a('0x96'),'id'])||{});}})[_0xce8a('0x16')](respondWithResult(_0x14ad30,null))['catch'](handleError(_0x14ad30,null));};exports[_0xce8a('0x98')]=function(_0x59eb86,_0x341062){var _0x3463f7={'raw':![],'where':{}};var _0x891358={};var _0x35f290={'count':0x0,'rows':[]};return db['ChatInteraction'][_0xce8a('0x4d')]({'where':{'id':_0x59eb86[_0xce8a('0x3c')]['id']}})[_0xce8a('0x16')](handleEntityNotFound(_0x341062,null))[_0xce8a('0x16')](function(_0x5619a9){if(_0x5619a9){_0x891358[_0xce8a('0x3d')]=_[_0xce8a('0x3e')](db[_0xce8a('0x5e')][_0xce8a('0x34')]);_0x891358['query']=_['keys'](_0x59eb86[_0xce8a('0x39')]);_0x891358[_0xce8a('0x99')]=_[_0xce8a('0x41')](_0x891358[_0xce8a('0x3d')],_0x891358['query']);_0x3463f7[_0xce8a('0x40')]=_['intersection'](_0x891358[_0xce8a('0x3d')],qs[_0xce8a('0x42')](_0x59eb86[_0xce8a('0x39')]['fields']));_0x3463f7[_0xce8a('0x40')]=_0x3463f7[_0xce8a('0x40')][_0xce8a('0x43')]?_0x3463f7['attributes']:_0x891358[_0xce8a('0x3d')];if(!_0x59eb86['query'][_0xce8a('0x9a')](_0xce8a('0x9b'))){_0x3463f7['limit']=qs[_0xce8a('0x24')](_0x59eb86['query']['limit']);_0x3463f7['offset']=qs[_0xce8a('0x26')](_0x59eb86[_0xce8a('0x39')][_0xce8a('0x26')]);}_0x3463f7['order']=qs[_0xce8a('0x9c')](_0x59eb86[_0xce8a('0x39')]['sort']);_0x3463f7[_0xce8a('0x9d')]=qs[_0xce8a('0x99')](_[_0xce8a('0x9e')](_0x59eb86['query'],_0x891358[_0xce8a('0x99')]));_0x3463f7[_0xce8a('0x9d')][_0xce8a('0x9f')]=_0x5619a9['id'];if(_0x59eb86[_0xce8a('0x39')][_0xce8a('0xa0')]){_0x3463f7['where']=_[_0xce8a('0x46')](_0x3463f7['where'],{'$or':_['map'](_0x3463f7[_0xce8a('0x40')],function(_0x19d659){var _0x5ac5f4={};_0x5ac5f4[_0x19d659]={'$like':'%'+_0x59eb86['query'][_0xce8a('0xa0')]+'%'};return _0x5ac5f4;})});}if(_0x59eb86[_0xce8a('0x39')][_0xce8a('0xa1')]){var _0x57baaa=_0x59eb86[_0xce8a('0x39')][_0xce8a('0xa1')][_0xce8a('0xa2')](',');var _0x22752f={};_0x22752f[_0x57baaa[0x0]]={'$gte':moment(_0x57baaa[0x1])['format'](_0xce8a('0xa3'))};_0x3463f7[_0xce8a('0x9d')]=_[_0xce8a('0x46')](_0x3463f7[_0xce8a('0x9d')],_0x22752f);}_0x3463f7=_[_0xce8a('0x46')]({},_0x3463f7,_0x59eb86['options']);return db[_0xce8a('0x5e')][_0xce8a('0x25')]({'where':_0x3463f7[_0xce8a('0x9d')]})['then'](function(_0x11a96){_0x35f290[_0xce8a('0x25')]=_0x11a96;if(_0x59eb86[_0xce8a('0x39')][_0xce8a('0x44')]){_0x3463f7[_0xce8a('0x45')]=[{'all':!![]}];}return db['ChatMessage'][_0xce8a('0x37')](_0x3463f7);})[_0xce8a('0x16')](function(_0x1c3e74){_0x35f290[_0xce8a('0xa4')]=_0x1c3e74;return _0x35f290;});}})[_0xce8a('0x16')](respondWithFilteredResult(_0x341062,_0x3463f7))[_0xce8a('0x49')](handleError(_0x341062,null));};exports[_0xce8a('0xa5')]=function(_0x502111,_0x2c6b45){var _0x54597b={'where':{}},_0x11504f={},_0x5253e9={'count':0x0,'rows':[]};return db[_0xce8a('0x3f')][_0xce8a('0x4d')]({'where':{'id':_0x502111[_0xce8a('0x3c')]['id']}})[_0xce8a('0x16')](handleEntityNotFound(_0x2c6b45,null))['then'](function(_0x1bbc62){if(_0x1bbc62){_0x11504f[_0xce8a('0x3d')]=_[_0xce8a('0x3e')](db['ChatMessage'][_0xce8a('0x34')]);_0x11504f[_0xce8a('0x39')]=_['keys'](_0x502111[_0xce8a('0x39')]);_0x11504f[_0xce8a('0x99')]=_[_0xce8a('0x41')](_0x11504f[_0xce8a('0x3d')],_0x11504f['query']);_0x54597b[_0xce8a('0x40')]=_[_0xce8a('0x41')](_0x11504f[_0xce8a('0x3d')],qs[_0xce8a('0x42')](_0x502111[_0xce8a('0x39')][_0xce8a('0x42')]));_0x54597b['attributes']=_0x54597b['attributes'][_0xce8a('0x43')]?_0x54597b[_0xce8a('0x40')]:_0x11504f[_0xce8a('0x3d')];if(!_0x502111['query'][_0xce8a('0x9a')]('nolimit')){_0x54597b[_0xce8a('0x24')]=qs[_0xce8a('0x24')](_0x502111[_0xce8a('0x39')][_0xce8a('0x24')]);_0x54597b[_0xce8a('0x26')]=qs[_0xce8a('0x26')](_0x502111[_0xce8a('0x39')][_0xce8a('0x26')]);}_0x54597b[_0xce8a('0xa6')]=qs[_0xce8a('0x9c')](_0x502111[_0xce8a('0x39')][_0xce8a('0x9c')]);_0x54597b[_0xce8a('0x9d')]=qs[_0xce8a('0x99')](_['pick'](_0x502111[_0xce8a('0x39')],_0x11504f[_0xce8a('0x99')]));_0x54597b[_0xce8a('0x9d')]['ChatInteractionId']=_0x1bbc62['id'];if(_0x502111[_0xce8a('0x39')][_0xce8a('0xa0')]){_0x54597b[_0xce8a('0x9d')]=_[_0xce8a('0x46')](_0x54597b[_0xce8a('0x9d')],{'$or':_['map'](_0x54597b[_0xce8a('0x40')],function(_0x4dc83b){var _0x343cc4={};_0x343cc4[_0x4dc83b]={'$like':'%'+_0x502111[_0xce8a('0x39')][_0xce8a('0xa0')]+'%'};return _0x343cc4;})});}_0x54597b['where'][_0xce8a('0x8d')]=![];if(_0x502111[_0xce8a('0x39')]['id']){_0x54597b[_0xce8a('0x9d')]['id']={'$gt':_0x502111[_0xce8a('0x39')]['id']};}_0x54597b=_[_0xce8a('0x46')]({},_0x54597b,_0x502111[_0xce8a('0x47')]);return db[_0xce8a('0x5e')][_0xce8a('0x25')]({'where':_0x54597b[_0xce8a('0x9d')]})[_0xce8a('0x16')](function(_0x10f102){_0x5253e9[_0xce8a('0x25')]=_0x10f102;_0x54597b['include']=[];if(_0x502111[_0xce8a('0x39')][_0xce8a('0xa7')]){_0x54597b[_0xce8a('0x45')][_0xce8a('0xa8')]({'model':db[_0xce8a('0x81')],'as':'User','attributes':['id',_0xce8a('0x8a'),_0xce8a('0xa9')]});}if(_0x502111[_0xce8a('0x39')][_0xce8a('0x44')]){_0x54597b['include']=[{'all':!![]}];}return db[_0xce8a('0x5e')][_0xce8a('0x37')](_0x54597b);})[_0xce8a('0x16')](function(_0x2641d8){_0x5253e9['rows']=_0x2641d8;return _0x5253e9;});}})[_0xce8a('0x16')](respondWithFilteredResult(_0x2c6b45,_0x54597b))['catch'](handleError(_0x2c6b45,null));};exports['addTags']=function(_0x4900f5,_0x3976f7){return db[_0xce8a('0x3f')][_0xce8a('0x48')]({'where':{'id':_0x4900f5[_0xce8a('0x3c')]['id']}})[_0xce8a('0x16')](handleEntityNotFound(_0x3976f7,null))[_0xce8a('0x16')](function(_0x393b63){if(_0x393b63){return _0x393b63[_0xce8a('0xaa')](_0x4900f5[_0xce8a('0x2d')][_0xce8a('0x96')],_[_0xce8a('0x97')](_0x4900f5[_0xce8a('0x2d')],[_0xce8a('0x96'),'id'])||{})['spread'](function(){return db[_0xce8a('0xab')][_0xce8a('0x37')]({'attributes':['id',_0xce8a('0x2b'),_0xce8a('0xac')],'where':{'id':_0x4900f5[_0xce8a('0x2d')][_0xce8a('0x96')]}});})[_0xce8a('0x16')](function(_0x3e1021){socket['emit'](_0xce8a('0xad'),{'id':Number(_0x4900f5[_0xce8a('0x3c')]['id']),'tags':_0x3e1021||[]});return{'id':Number(_0x4900f5['params']['id']),'tags':_0x3e1021||[]};});}})[_0xce8a('0x16')](respondWithResult(_0x3976f7,null))['catch'](handleError(_0x3976f7,null));};exports['removeTags']=function(_0x3eceed,_0x95655c){return db[_0xce8a('0x3f')][_0xce8a('0x48')]({'where':{'id':_0x3eceed[_0xce8a('0x3c')]['id']}})[_0xce8a('0x16')](handleEntityNotFound(_0x95655c,null))[_0xce8a('0x16')](function(_0x155861){if(_0x155861){return _0x155861[_0xce8a('0xae')](_0x3eceed[_0xce8a('0x39')]['ids']);}})['then'](respondWithStatusCode(_0x95655c,null))['catch'](handleError(_0x95655c,null));};exports['download']=function(_0x4b7b6e,_0x58a171){var _0x41b9b1=moment()[_0xce8a('0xaf')]()[_0xce8a('0xb0')]();var _0x5e1d22=path[_0xce8a('0x75')](config['root'],_0xce8a('0xb1'),_0xce8a('0xb2'),_0xce8a('0xb3'));var _0x185db5=path['join'](config['root'],'server',_0xce8a('0xb2'),_0xce8a('0xb4'));var _0x7d74da=path[_0xce8a('0x75')](_0x5e1d22,_0x41b9b1);var _0x5bcd0a=util[_0xce8a('0x84')](_0xce8a('0xb5'),_0x4b7b6e[_0xce8a('0x3c')]['id'],_0x41b9b1);var _0x2ebec7=path[_0xce8a('0x75')](_0x5e1d22,_0x5bcd0a);var _0x3aefd9=[];_0x3aefd9['push']({'model':db[_0xce8a('0x81')],'as':_0xce8a('0x81'),'attributes':['id',_0xce8a('0x8a')],'raw':!![]});_0x3aefd9[_0xce8a('0xa8')]({'model':db['CmContact'],'as':_0xce8a('0xb6'),'attributes':['id',_0xce8a('0xb7'),_0xce8a('0xb8')],'raw':!![]});if(_0x4b7b6e[_0xce8a('0x39')][_0xce8a('0xb4')]){_0x3aefd9[_0xce8a('0xa8')]({'model':db['Attachment'],'as':_0xce8a('0x71'),'raw':!![]});}var _0x59770e=[{'model':db[_0xce8a('0x5e')],'as':_0xce8a('0x80'),'attributes':['id',_0xce8a('0x2d'),_0xce8a('0xb9'),_0xce8a('0x8c'),_0xce8a('0x8d'),'read'],'include':_0x3aefd9}];_0x59770e[_0xce8a('0xa8')]({'model':db[_0xce8a('0x4e')],'as':_0xce8a('0xba'),'attributes':['id',_0xce8a('0x2b')]});_0x59770e[_0xce8a('0xa8')]({'model':db[_0xce8a('0x81')],'as':_0xce8a('0xbb'),'attributes':['id',_0xce8a('0x8a')]});return db[_0xce8a('0x3f')]['find']({'where':{'id':_0x4b7b6e[_0xce8a('0x3c')]['id']},'include':_0x59770e})[_0xce8a('0x16')](handleEntityNotFound(_0x58a171,null))[_0xce8a('0x16')](function(_0x2209e8){if(_0x2209e8){var _0x4efe54=_0x2209e8['get']({'plain':!![]});fs[_0xce8a('0xbc')](_0x7d74da);var _0x2d9f22={'channel':_0xce8a('0xbd'),'account':_0x4efe54[_0xce8a('0xba')][_0xce8a('0x2b')],'agent':_0x4efe54[_0xce8a('0xbb')]?_0x4efe54[_0xce8a('0xbb')][_0xce8a('0x8a')]:_0xce8a('0xbe'),'createdAt':moment(_0x4efe54[_0xce8a('0xb9')])['format'](_0xce8a('0xa3'))['toString'](),'closedAt':_0x4efe54[_0xce8a('0x69')]?moment(_0x4efe54[_0xce8a('0xbf')])[_0xce8a('0x84')](_0xce8a('0xa3'))[_0xce8a('0xb0')]():'','disposition':_0x4efe54[_0xce8a('0xc0')],'chatInfo':{'browser':_0x4efe54[_0xce8a('0xc1')],'os':_0x4efe54[_0xce8a('0xc2')],'referer':_0x4efe54[_0xce8a('0xc3')],'customerIp':_0x4efe54[_0xce8a('0xc4')],'customerPort':_0x4efe54['customerPort']?_0x4efe54[_0xce8a('0xc5')]:_0xce8a('0xbe')},'messages':_(_0x4efe54[_0xce8a('0x80')])[_0xce8a('0xc6')]()[_0xce8a('0xa0')]({'secret':![]})[_0xce8a('0x33')](function(_0x2f4a9c){if(_0x2f4a9c[_0xce8a('0x71')]){var _0x161f7f=path[_0xce8a('0x75')](_0x185db5,_0x2f4a9c[_0xce8a('0x71')]['basename']);if(fs[_0xce8a('0xc7')](_0x161f7f)){fs[_0xce8a('0xc8')](_0x161f7f)['pipe'](fs[_0xce8a('0xc9')](path[_0xce8a('0x75')](_0x7d74da,_0x2f4a9c[_0xce8a('0x71')]['basename'])));}}return{'date':moment(_0x2f4a9c[_0xce8a('0xb9')])[_0xce8a('0x84')](_0xce8a('0xa3'))['toString'](),'sender':_0x2f4a9c[_0xce8a('0x8c')]===_0xce8a('0x5d')?_0x2f4a9c['User']?_0x2f4a9c[_0xce8a('0x81')][_0xce8a('0x8a')]:_0xce8a('0x8b'):_0x2f4a9c[_0xce8a('0xb6')][_0xce8a('0xb7')]+(_0x2f4a9c[_0xce8a('0xb6')]['lastName']?'\x20'+_0x2f4a9c[_0xce8a('0xb6')][_0xce8a('0xb8')]:''),'body':_0x2f4a9c[_0xce8a('0x71')]?_0x2f4a9c['Attachment'][_0xce8a('0x6d')]:_0x2f4a9c[_0xce8a('0x2d')],'direction':_0x2f4a9c['direction']===_0xce8a('0x5d')?'A':'C','secret':_0x2f4a9c['secret'],'read':_0x2f4a9c[_0xce8a('0xca')],'attachment':_0x2f4a9c[_0xce8a('0x71')]};})[_0xce8a('0xcb')]()};return ejs[_0xce8a('0xcc')](path[_0xce8a('0x75')](config['root'],_0xce8a('0xb1'),_0xce8a('0xcd'),_0xce8a('0xce')),{'interaction':_0x2d9f22})[_0xce8a('0x16')](function(_0x4d7b40){var _0x3c2038=path['join'](_0x7d74da,'transcript-'+_0x4efe54['id']+'-'+_0x41b9b1+_0xce8a('0xcf'));var _0x50223a={'path':_0x3c2038,'channel':_0xce8a('0xbd'),'interactionId':_0x4efe54['id']};return pdf[_0xce8a('0xd0')](_0x4d7b40,_0x50223a);})[_0xce8a('0x16')](function(){return new Promise(function(_0xfb8d42,_0x147e9e){zipdir(_0x7d74da,{'saveTo':_0x2ebec7},function(_0x31428e,_0x5e9026){if(_0x31428e)return _0x147e9e(_0x31428e);return _0xfb8d42(_0x5e9026);});})[_0xce8a('0x16')](function(){return new BPromise(function(_0x5b5ed9,_0x1b3376){rimraf(_0x7d74da,function(_0x1354e5){if(_0x1354e5)_0x1b3376(_0x1354e5);return _0x5b5ed9();});});})[_0xce8a('0x16')](function(){return _0x58a171[_0xce8a('0x79')](_0x2ebec7,_0x5bcd0a,function(_0x126675){if(_0x126675){logger[_0xce8a('0x1d')](_0xce8a('0xd1'),_0x126675);}else{fs[_0xce8a('0xd2')](_0x2ebec7);}});});});}else{return _0x58a171[_0xce8a('0x66')](0xc8);}})[_0xce8a('0x49')](handleError(_0x58a171,null));}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.events.js b/server/api/chatInteraction/chatInteraction.events.js index dc8e665..c785d1a 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 _0x17b8=['emit','catch','hasOwnProperty','hook','exports','ChatInteraction','setMaxListeners','save','getUsers','then','setDataValue','Users','map','findAll'];(function(_0x135fa5,_0x5068d7){var _0x40789f=function(_0x280a2d){while(--_0x280a2d){_0x135fa5['push'](_0x135fa5['shift']());}};_0x40789f(++_0x5068d7);}(_0x17b8,0x147));var _0x817b=function(_0x17b339,_0x57ebcf){_0x17b339=_0x17b339-0x0;var _0x1437c1=_0x17b8[_0x17b339];return _0x1437c1;};'use strict';var EventEmitter=require('events');var ChatInteraction=require('../../mysqldb')['db'][_0x817b('0x0')];var ChatMessage=require('../../mysqldb')['db']['ChatMessage'];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0x817b('0x1')](0x0);var events={'afterCreate':_0x817b('0x2'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x4857ee){return function(_0x2ec9ba,_0x43b5d6,_0x1f6466){_0x2ec9ba[_0x817b('0x3')]({'attributes':['id'],'raw':!![]})[_0x817b('0x4')](function(_0x4862f1){_0x2ec9ba[_0x817b('0x5')](_0x817b('0x6'),_0x4862f1[_0x817b('0x7')](function(_0x49e9bb){return{'id':_0x49e9bb['id']};}));return ChatMessage[_0x817b('0x8')]({'where':{'ChatInteractionId':_0x2ec9ba['id'],'direction':'in','read':![]},'raw':!![]});})[_0x817b('0x4')](function(_0x35439f){_0x2ec9ba[_0x817b('0x5')]('unreadMessages',_0x35439f['length']);ChatInteractionEvents[_0x817b('0x9')](_0x4857ee+':'+_0x2ec9ba['id'],_0x2ec9ba);ChatInteractionEvents[_0x817b('0x9')](_0x4857ee,_0x2ec9ba);_0x1f6466(null);})[_0x817b('0xa')](_0x1f6466(null));};}for(var e in events){if(events[_0x817b('0xb')](e)){var event=events[e];ChatInteraction[_0x817b('0xc')](e,emitEvent(event));}}module[_0x817b('0xd')]=ChatInteractionEvents; \ No newline at end of file +var _0x69db=['Users','map','findAll','unreadMessages','length','emit','catch','hasOwnProperty','exports','events','../../mysqldb','ChatInteraction','setMaxListeners','save','update','remove','getUsers','then','setDataValue'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x69db,0x185));var _0xb69d=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x69db[_0x1ac595];return _0x455fff;};'use strict';var EventEmitter=require(_0xb69d('0x0'));var ChatInteraction=require(_0xb69d('0x1'))['db'][_0xb69d('0x2')];var ChatMessage=require('../../mysqldb')['db']['ChatMessage'];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0xb69d('0x3')](0x0);var events={'afterCreate':_0xb69d('0x4'),'afterUpdate':_0xb69d('0x5'),'afterDestroy':_0xb69d('0x6')};function emitEvent(_0x1b1c22){return function(_0x5398b6,_0x280b4c,_0x9cd51b){_0x5398b6[_0xb69d('0x7')]({'attributes':['id'],'raw':!![]})[_0xb69d('0x8')](function(_0x486a07){_0x5398b6[_0xb69d('0x9')](_0xb69d('0xa'),_0x486a07[_0xb69d('0xb')](function(_0x1e70ac){return{'id':_0x1e70ac['id']};}));return ChatMessage[_0xb69d('0xc')]({'where':{'ChatInteractionId':_0x5398b6['id'],'direction':'in','read':![]},'raw':!![]});})[_0xb69d('0x8')](function(_0x2aad93){_0x5398b6[_0xb69d('0x9')](_0xb69d('0xd'),_0x2aad93[_0xb69d('0xe')]);ChatInteractionEvents[_0xb69d('0xf')](_0x1b1c22+':'+_0x5398b6['id'],_0x5398b6);ChatInteractionEvents[_0xb69d('0xf')](_0x1b1c22,_0x5398b6);_0x9cd51b(null);})[_0xb69d('0x10')](_0x9cd51b(null));};}for(var e in events){if(events[_0xb69d('0x11')](e)){var event=events[e];ChatInteraction['hook'](e,emitEvent(event));}}module[_0xb69d('0x12')]=ChatInteractionEvents; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.model.js b/server/api/chatInteraction/chatInteraction.model.js index 5449594..dbd2cf1 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 _0x76e2=['utf8mb4','utf8mb4_unicode_ci','lodash','moment','bluebird','request-promise','rimraf','../../config/environment','./chatInteraction.attributes','ChatInteraction','chat_interactions','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x76e2,0x110));var _0x276e=function(_0x434adb,_0x58959b){_0x434adb=_0x434adb-0x0;var _0x4b7483=_0x76e2[_0x434adb];return _0x4b7483;};'use strict';var _=require(_0x276e('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x276e('0x1'));var BPromise=require(_0x276e('0x2'));var rp=require(_0x276e('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x276e('0x4'));var config=require(_0x276e('0x5'));var attributes=require(_0x276e('0x6'));module['exports']=function(_0x127471,_0x1b7b6b){return _0x127471['define'](_0x276e('0x7'),attributes,{'tableName':_0x276e('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x25491f,_0x1b19ea,_0x16c553){if(_0x25491f['changed'](_0x276e('0x9'))){_0x25491f[_0x276e('0xa')]=moment()[_0x276e('0xb')](_0x276e('0xc'));}_0x16c553(null,_0x25491f);}},'charset':_0x276e('0xd'),'collate':_0x276e('0xe')});}; \ No newline at end of file +var _0xbeb7=['utf8mb4_unicode_ci','util','../../config/logger','moment','bluebird','../../config/environment','exports','ChatInteraction','chat_interactions','changed','closed','closedAt','format'];(function(_0x5376e2,_0x2d1ee2){var _0x117f76=function(_0x2bfb70){while(--_0x2bfb70){_0x5376e2['push'](_0x5376e2['shift']());}};_0x117f76(++_0x2d1ee2);}(_0xbeb7,0x153));var _0x7beb=function(_0x1adae4,_0x212915){_0x1adae4=_0x1adae4-0x0;var _0x163927=_0xbeb7[_0x1adae4];return _0x163927;};'use strict';var _=require('lodash');var util=require(_0x7beb('0x0'));var logger=require(_0x7beb('0x1'))('api');var moment=require(_0x7beb('0x2'));var BPromise=require(_0x7beb('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x7beb('0x4'));var attributes=require('./chatInteraction.attributes');module[_0x7beb('0x5')]=function(_0x21a955,_0x56efdc){return _0x21a955['define'](_0x7beb('0x6'),attributes,{'tableName':_0x7beb('0x7'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x419ce2,_0x4c3d04,_0x39c0cc){if(_0x419ce2[_0x7beb('0x8')](_0x7beb('0x9'))){_0x419ce2[_0x7beb('0xa')]=moment()[_0x7beb('0xb')]('YYYY-MM-DD\x20HH:mm:ss');}_0x39c0cc(null,_0x419ce2);}},'charset':'utf8mb4','collate':_0x7beb('0xc')});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.rpc.js b/server/api/chatInteraction/chatInteraction.rpc.js index 1b216e9..56f6bf2 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 _0x7ce1=['request\x20sent','debug','error','code','ChatInteraction,\x20%s,\x20%s','message','info','catch','UpdateChatInteraction','ChatInteraction','update','body','options','raw','where','attributes','limit','then','stringify','find','ids','omit','spread','AddTags','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./chatInteraction.socket','register','request'];(function(_0x16caba,_0x1d2d98){var _0x227f25=function(_0x529242){while(--_0x529242){_0x16caba['push'](_0x16caba['shift']());}};_0x227f25(++_0x1d2d98);}(_0x7ce1,0xea));var _0x17ce=function(_0x34eb31,_0x8f0f70){_0x34eb31=_0x34eb31-0x0;var _0x254994=_0x7ce1[_0x34eb31];return _0x254994;};'use strict';var _=require(_0x17ce('0x0'));var util=require(_0x17ce('0x1'));var moment=require(_0x17ce('0x2'));var BPromise=require(_0x17ce('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x17ce('0x4'));var db=require(_0x17ce('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x17ce('0x6'))('rpc');var config=require(_0x17ce('0x7'));var jayson=require(_0x17ce('0x8'));var client=jayson[_0x17ce('0x9')][_0x17ce('0xa')]({'port':0x232a});config['redis']=_[_0x17ce('0xb')](config[_0x17ce('0xc')],{'host':_0x17ce('0xd'),'port':0x18eb});var socket=require(_0x17ce('0xe'))(new Redis(config['redis']));require(_0x17ce('0xf'))[_0x17ce('0x10')](socket);function respondWithRpcPromise(_0x3bd3ac,_0x213d1e,_0x1444ef){return new BPromise(function(_0x1e2864,_0x2fdba5){return client[_0x17ce('0x11')](_0x3bd3ac,_0x1444ef)['then'](function(_0x42f5eb){logger['info']('ChatInteraction,\x20%s,\x20%s',_0x213d1e,_0x17ce('0x12'));logger[_0x17ce('0x13')]('ChatInteraction,\x20%s,\x20%s,\x20%s',_0x213d1e,_0x17ce('0x12'),JSON['stringify'](_0x42f5eb));if(_0x42f5eb[_0x17ce('0x14')]){if(_0x42f5eb[_0x17ce('0x14')][_0x17ce('0x15')]===0x1f4){logger[_0x17ce('0x14')](_0x17ce('0x16'),_0x213d1e,_0x42f5eb['error'][_0x17ce('0x17')]);return _0x2fdba5(_0x42f5eb['error'][_0x17ce('0x17')]);}logger[_0x17ce('0x14')]('ChatInteraction,\x20%s,\x20%s',_0x213d1e,_0x42f5eb[_0x17ce('0x14')][_0x17ce('0x17')]);return _0x1e2864(_0x42f5eb['error'][_0x17ce('0x17')]);}else{logger[_0x17ce('0x18')]('ChatInteraction,\x20%s,\x20%s',_0x213d1e,'request\x20sent');_0x1e2864(_0x42f5eb['result'][_0x17ce('0x17')]);}})[_0x17ce('0x19')](function(_0xff945){logger['error'](_0x17ce('0x16'),_0x213d1e,_0xff945);_0x2fdba5(_0xff945);});});}exports[_0x17ce('0x1a')]=function(_0x4590ad){var _0x5628b6=this;return new Promise(function(_0x50d76f,_0x3ce4d0){return db[_0x17ce('0x1b')][_0x17ce('0x1c')](_0x4590ad[_0x17ce('0x1d')],{'raw':_0x4590ad['options']?_0x4590ad[_0x17ce('0x1e')][_0x17ce('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4590ad['options']?_0x4590ad[_0x17ce('0x1e')][_0x17ce('0x20')]||null:null,'attributes':_0x4590ad[_0x17ce('0x1e')]?_0x4590ad[_0x17ce('0x1e')][_0x17ce('0x21')]||null:null,'limit':_0x4590ad[_0x17ce('0x1e')]?_0x4590ad['options'][_0x17ce('0x22')]||null:null})[_0x17ce('0x23')](function(_0x42ad05){logger['info'](_0x17ce('0x1a'),_0x4590ad);logger[_0x17ce('0x13')](_0x17ce('0x1a'),_0x4590ad,JSON[_0x17ce('0x24')](_0x42ad05));_0x50d76f(_0x42ad05);})['catch'](function(_0x13806){logger[_0x17ce('0x14')](_0x17ce('0x1a'),_0x13806[_0x17ce('0x17')],_0x4590ad);_0x3ce4d0(_0x5628b6[_0x17ce('0x14')](0x1f4,_0x13806[_0x17ce('0x17')]));});});};exports['AddTagsToChatInteraction']=function(_0xff66e3){return new Promise(function(_0xd6210e,_0x5b0fa2){return db[_0x17ce('0x1b')][_0x17ce('0x25')]({'where':_0xff66e3[_0x17ce('0x1e')]?_0xff66e3[_0x17ce('0x1e')][_0x17ce('0x20')]||null:null})[_0x17ce('0x23')](function(_0x3e88a8){if(_0x3e88a8){return _0x3e88a8['addTags'](_0xff66e3[_0x17ce('0x1d')][_0x17ce('0x26')],_[_0x17ce('0x27')](_0xff66e3[_0x17ce('0x1d')],[_0x17ce('0x26'),'id'])||{});}})[_0x17ce('0x28')](function(_0x53ae6c){logger[_0x17ce('0x18')](_0x17ce('0x29'),_0xff66e3);logger['debug'](_0x17ce('0x29'),_0xff66e3,JSON[_0x17ce('0x24')](_0x53ae6c));_0xd6210e(_0x53ae6c);})[_0x17ce('0x19')](function(_0x56052c){logger[_0x17ce('0x14')](_0x17ce('0x29'),_0x56052c[_0x17ce('0x17')],_0xff66e3);_0x5b0fa2(_this['error'](0x1f4,_0x56052c[_0x17ce('0x17')]));});});}; \ No newline at end of file +var _0x29d2=['register','request','then','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','UpdateChatInteraction','update','body','raw','options','where','attributes','limit','stringify','AddTagsToChatInteraction','find','addTags','ids','omit','spread','AddTags','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','defaults','redis','localhost','socket.io-emitter'];(function(_0x51318d,_0x61f162){var _0x47552d=function(_0x20ca74){while(--_0x20ca74){_0x51318d['push'](_0x51318d['shift']());}};_0x47552d(++_0x61f162);}(_0x29d2,0x17d));var _0x229d=function(_0x4d585d,_0x45fe07){_0x4d585d=_0x4d585d-0x0;var _0x371652=_0x29d2[_0x4d585d];return _0x371652;};'use strict';var _=require('lodash');var util=require(_0x229d('0x0'));var moment=require(_0x229d('0x1'));var BPromise=require('bluebird');var rs=require(_0x229d('0x2'));var fs=require('fs');var Redis=require(_0x229d('0x3'));var db=require(_0x229d('0x4'))['db'];var utils=require(_0x229d('0x5'));var logger=require(_0x229d('0x6'))(_0x229d('0x7'));var config=require(_0x229d('0x8'));var jayson=require(_0x229d('0x9'));var client=jayson[_0x229d('0xa')]['http']({'port':0x232a});config['redis']=_[_0x229d('0xb')](config[_0x229d('0xc')],{'host':_0x229d('0xd'),'port':0x18eb});var socket=require(_0x229d('0xe'))(new Redis(config[_0x229d('0xc')]));require('./chatInteraction.socket')[_0x229d('0xf')](socket);function respondWithRpcPromise(_0x444034,_0x594b58,_0x15dbba){return new BPromise(function(_0x1b3eb5,_0x41ba97){return client[_0x229d('0x10')](_0x444034,_0x15dbba)[_0x229d('0x11')](function(_0x358651){logger[_0x229d('0x12')](_0x229d('0x13'),_0x594b58,_0x229d('0x14'));logger[_0x229d('0x15')](_0x229d('0x16'),_0x594b58,_0x229d('0x14'),JSON['stringify'](_0x358651));if(_0x358651[_0x229d('0x17')]){if(_0x358651[_0x229d('0x17')][_0x229d('0x18')]===0x1f4){logger[_0x229d('0x17')](_0x229d('0x13'),_0x594b58,_0x358651[_0x229d('0x17')][_0x229d('0x19')]);return _0x41ba97(_0x358651['error'][_0x229d('0x19')]);}logger[_0x229d('0x17')](_0x229d('0x13'),_0x594b58,_0x358651[_0x229d('0x17')][_0x229d('0x19')]);return _0x1b3eb5(_0x358651[_0x229d('0x17')]['message']);}else{logger[_0x229d('0x12')](_0x229d('0x13'),_0x594b58,_0x229d('0x14'));_0x1b3eb5(_0x358651[_0x229d('0x1a')][_0x229d('0x19')]);}})[_0x229d('0x1b')](function(_0xf084e2){logger[_0x229d('0x17')]('ChatInteraction,\x20%s,\x20%s',_0x594b58,_0xf084e2);_0x41ba97(_0xf084e2);});});}exports[_0x229d('0x1c')]=function(_0x1ed8a9){var _0x11b29e=this;return new Promise(function(_0x2dc5bf,_0x4c90e1){return db['ChatInteraction'][_0x229d('0x1d')](_0x1ed8a9[_0x229d('0x1e')],{'raw':_0x1ed8a9['options']?_0x1ed8a9['options'][_0x229d('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1ed8a9[_0x229d('0x20')]?_0x1ed8a9[_0x229d('0x20')][_0x229d('0x21')]||null:null,'attributes':_0x1ed8a9[_0x229d('0x20')]?_0x1ed8a9[_0x229d('0x20')][_0x229d('0x22')]||null:null,'limit':_0x1ed8a9[_0x229d('0x20')]?_0x1ed8a9[_0x229d('0x20')][_0x229d('0x23')]||null:null})[_0x229d('0x11')](function(_0x3e7cd2){logger[_0x229d('0x12')](_0x229d('0x1c'),_0x1ed8a9);logger[_0x229d('0x15')]('UpdateChatInteraction',_0x1ed8a9,JSON[_0x229d('0x24')](_0x3e7cd2));_0x2dc5bf(_0x3e7cd2);})[_0x229d('0x1b')](function(_0x13f1b1){logger[_0x229d('0x17')]('UpdateChatInteraction',_0x13f1b1[_0x229d('0x19')],_0x1ed8a9);_0x4c90e1(_0x11b29e[_0x229d('0x17')](0x1f4,_0x13f1b1[_0x229d('0x19')]));});});};exports[_0x229d('0x25')]=function(_0x4cc219){return new Promise(function(_0x35c56c,_0x4c3f38){return db['ChatInteraction'][_0x229d('0x26')]({'where':_0x4cc219['options']?_0x4cc219['options']['where']||null:null})[_0x229d('0x11')](function(_0x4ba141){if(_0x4ba141){return _0x4ba141[_0x229d('0x27')](_0x4cc219[_0x229d('0x1e')][_0x229d('0x28')],_[_0x229d('0x29')](_0x4cc219[_0x229d('0x1e')],['ids','id'])||{});}})[_0x229d('0x2a')](function(_0x47abe3){logger[_0x229d('0x12')](_0x229d('0x2b'),_0x4cc219);logger[_0x229d('0x15')]('AddTags',_0x4cc219,JSON[_0x229d('0x24')](_0x47abe3));_0x35c56c(_0x47abe3);})[_0x229d('0x1b')](function(_0x1cc8bc){logger[_0x229d('0x17')](_0x229d('0x2b'),_0x1cc8bc[_0x229d('0x19')],_0x4cc219);_0x4c3f38(_this[_0x229d('0x17')](0x1f4,_0x1cc8bc[_0x229d('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.socket.js b/server/api/chatInteraction/chatInteraction.socket.js index 7f5fcd0..64b2c35 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 _0xebe7=['register','./chatInteraction.events','save','remove'];(function(_0x2acd6d,_0x2e1bb0){var _0x5a080d=function(_0xed4591){while(--_0xed4591){_0x2acd6d['push'](_0x2acd6d['shift']());}};_0x5a080d(++_0x2e1bb0);}(_0xebe7,0x165));var _0x7ebe=function(_0xb49647,_0x56be38){_0xb49647=_0xb49647-0x0;var _0x264204=_0xebe7[_0xb49647];return _0x264204;};'use strict';var ChatInteractionEvents=require(_0x7ebe('0x0'));var events=[_0x7ebe('0x1'),_0x7ebe('0x2'),'update'];function createListener(_0x16335e,_0xb941ac){return function(_0x4d4fc1){_0xb941ac['emit'](_0x16335e,_0x4d4fc1);};}function removeListener(_0xddb7b7,_0x4ae750){return function(){ChatInteractionEvents['removeListener'](_0xddb7b7,_0x4ae750);};}exports[_0x7ebe('0x3')]=function(_0x4c23ad){for(var _0xbd6236=0x0,_0x242475=events['length'];_0xbd6236<_0x242475;_0xbd6236++){var _0xb03664=events[_0xbd6236];var _0x107102=createListener('chatInteraction:'+_0xb03664,_0x4c23ad);ChatInteractionEvents['on'](_0xb03664,_0x107102);}}; \ No newline at end of file +var _0xe39c=['./chatInteraction.events','save','remove','update','emit','removeListener','register','chatInteraction:'];(function(_0x2d79b0,_0x29c6e9){var _0x323161=function(_0x170ae4){while(--_0x170ae4){_0x2d79b0['push'](_0x2d79b0['shift']());}};_0x323161(++_0x29c6e9);}(_0xe39c,0x98));var _0xce39=function(_0x3c582f,_0x223d44){_0x3c582f=_0x3c582f-0x0;var _0x37ba55=_0xe39c[_0x3c582f];return _0x37ba55;};'use strict';var ChatInteractionEvents=require(_0xce39('0x0'));var events=[_0xce39('0x1'),_0xce39('0x2'),_0xce39('0x3')];function createListener(_0x328df2,_0x3ad6da){return function(_0x47ecce){_0x3ad6da[_0xce39('0x4')](_0x328df2,_0x47ecce);};}function removeListener(_0x24b05e,_0x1870d2){return function(){ChatInteractionEvents[_0xce39('0x5')](_0x24b05e,_0x1870d2);};}exports[_0xce39('0x6')]=function(_0x11591c){for(var _0x577a4f=0x0,_0x55cf3c=events['length'];_0x577a4f<_0x55cf3c;_0x577a4f++){var _0xaf6c32=events[_0x577a4f];var _0x2a299d=createListener(_0xce39('0x7')+_0xaf6c32,_0x11591c);ChatInteractionEvents['on'](_0xaf6c32,_0x2a299d);}}; \ No newline at end of file diff --git a/server/api/chatInteraction/index.js b/server/api/chatInteraction/index.js index 641417d..40852a9 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 _0xa4d2=['%s-%s','now','replace','/:id/attachment_upload','file','attachmentUpload','addMessage','/:id/tags','tracked','chat','addTags','put','chatinteraction:update','customUpdate','/:id/abandon','/:id/close','delete','chatinteraction:destroy','removeTags','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','./chatInteraction.controller','get','isAuthenticated','index','describe','/:id','isChatInteractionAuthorized','show','/:id/attachment_download','attachmentDownload','/:id/messages','getMessages','/:id/my_messages','getMyMessages','/:id/download','download','post','create','/:id/vidaoo','diskStorage','join'];(function(_0x208c8f,_0x3e8ffb){var _0x5033d7=function(_0x20357a){while(--_0x20357a){_0x208c8f['push'](_0x208c8f['shift']());}};_0x5033d7(++_0x3e8ffb);}(_0xa4d2,0x1ba));var _0x2a4d=function(_0x14db9d,_0x7ec740){_0x14db9d=_0x14db9d-0x0;var _0x192d36=_0xa4d2[_0x14db9d];return _0x192d36;};'use strict';var multer=require(_0x2a4d('0x0'));var util=require(_0x2a4d('0x1'));var path=require(_0x2a4d('0x2'));var timeout=require('connect-timeout');var express=require(_0x2a4d('0x3'));var router=express[_0x2a4d('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x2a4d('0x5'));var interaction=require(_0x2a4d('0x6'));var config=require('../../config/environment');var controller=require(_0x2a4d('0x7'));router[_0x2a4d('0x8')]('/',auth[_0x2a4d('0x9')](),controller[_0x2a4d('0xa')]);router['get']('/describe',auth['isAuthenticated'](),controller[_0x2a4d('0xb')]);router[_0x2a4d('0x8')](_0x2a4d('0xc'),auth[_0x2a4d('0xd')](),controller[_0x2a4d('0xe')]);router[_0x2a4d('0x8')](_0x2a4d('0xf'),auth['isChatInteractionAuthorized'](),controller[_0x2a4d('0x10')]);router[_0x2a4d('0x8')](_0x2a4d('0x11'),auth[_0x2a4d('0x9')](),controller[_0x2a4d('0x12')]);router['get'](_0x2a4d('0x13'),auth[_0x2a4d('0xd')](),controller[_0x2a4d('0x14')]);router[_0x2a4d('0x8')](_0x2a4d('0x15'),auth[_0x2a4d('0x9')](),controller[_0x2a4d('0x16')]);router[_0x2a4d('0x17')]('/',auth[_0x2a4d('0x9')](),controller[_0x2a4d('0x18')]);router['post'](_0x2a4d('0x19'),auth['isAuthenticated'](),controller['createVidaooSession']);var upload=multer({'storage':multer[_0x2a4d('0x1a')]({'destination':function(_0x3768e8,_0x34a004,_0x533e87){_0x533e87(null,path[_0x2a4d('0x1b')](config['root'],'server/files/attachments/'));},'filename':function(_0x398eb0,_0x5a593b,_0x10e56f){_0x10e56f(null,util['format'](_0x2a4d('0x1c'),Date[_0x2a4d('0x1d')](),_0x5a593b['originalname'][_0x2a4d('0x1e')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x2a4d('0x17')](_0x2a4d('0x1f'),upload['single'](_0x2a4d('0x20')),controller[_0x2a4d('0x21')]);router[_0x2a4d('0x17')](_0x2a4d('0x11'),auth[_0x2a4d('0xd')](),controller[_0x2a4d('0x22')]);router[_0x2a4d('0x17')](_0x2a4d('0x23'),auth[_0x2a4d('0x9')](),interaction[_0x2a4d('0x24')](_0x2a4d('0x25'),'chatinteraction:addtags'),controller[_0x2a4d('0x26')]);router[_0x2a4d('0x27')](_0x2a4d('0xc'),auth[_0x2a4d('0x9')](),interaction['tracked'](_0x2a4d('0x25'),_0x2a4d('0x28')),controller['update']);router[_0x2a4d('0x27')]('/:id/custom_update',controller[_0x2a4d('0x29')]);router['put'](_0x2a4d('0x2a'),auth['isChatInteractionAuthorized'](),controller['abandon']);router[_0x2a4d('0x27')](_0x2a4d('0x2b'),controller['close']);router[_0x2a4d('0x2c')](_0x2a4d('0xc'),auth['isAuthenticated'](),interaction[_0x2a4d('0x24')](_0x2a4d('0x25'),_0x2a4d('0x2d')),controller['destroy']);router[_0x2a4d('0x2c')](_0x2a4d('0x23'),auth[_0x2a4d('0x9')](),controller[_0x2a4d('0x2e')]);module['exports']=router; \ No newline at end of file +var _0x4758=['chat','tracked','chatinteraction:update','update','put','/:id/custom_update','customUpdate','/:id/close','close','delete','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./chatInteraction.controller','get','isAuthenticated','index','/describe','describe','/:id','isChatInteractionAuthorized','show','/:id/attachment_download','attachmentDownload','/:id/messages','getMessages','getMyMessages','/:id/download','post','create','/:id/vidaoo','root','server/files/attachments/','%s-%s','now','originalname','replace','/:id/attachment_upload','single','file','attachmentUpload','/:id/tags'];(function(_0x38b7a5,_0x12ae0e){var _0x117680=function(_0x17e970){while(--_0x17e970){_0x38b7a5['push'](_0x38b7a5['shift']());}};_0x117680(++_0x12ae0e);}(_0x4758,0x12b));var _0x8475=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x4758[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x8475('0x0'));var util=require(_0x8475('0x1'));var path=require('path');var timeout=require(_0x8475('0x2'));var express=require(_0x8475('0x3'));var router=express[_0x8475('0x4')]();var fs_extra=require(_0x8475('0x5'));var auth=require(_0x8475('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x8475('0x7'));var controller=require(_0x8475('0x8'));router[_0x8475('0x9')]('/',auth[_0x8475('0xa')](),controller[_0x8475('0xb')]);router['get'](_0x8475('0xc'),auth[_0x8475('0xa')](),controller[_0x8475('0xd')]);router[_0x8475('0x9')](_0x8475('0xe'),auth[_0x8475('0xf')](),controller[_0x8475('0x10')]);router['get'](_0x8475('0x11'),auth[_0x8475('0xf')](),controller[_0x8475('0x12')]);router['get'](_0x8475('0x13'),auth['isAuthenticated'](),controller[_0x8475('0x14')]);router[_0x8475('0x9')]('/:id/my_messages',auth[_0x8475('0xf')](),controller[_0x8475('0x15')]);router[_0x8475('0x9')](_0x8475('0x16'),auth[_0x8475('0xa')](),controller['download']);router[_0x8475('0x17')]('/',auth[_0x8475('0xa')](),controller[_0x8475('0x18')]);router[_0x8475('0x17')](_0x8475('0x19'),auth['isAuthenticated'](),controller['createVidaooSession']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x14b721,_0x36fa0e,_0x1a36ed){_0x1a36ed(null,path['join'](config[_0x8475('0x1a')],_0x8475('0x1b')));},'filename':function(_0x5a38b6,_0x408b98,_0x25333f){_0x25333f(null,util['format'](_0x8475('0x1c'),Date[_0x8475('0x1d')](),_0x408b98[_0x8475('0x1e')][_0x8475('0x1f')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x8475('0x17')](_0x8475('0x20'),upload[_0x8475('0x21')](_0x8475('0x22')),controller[_0x8475('0x23')]);router['post'](_0x8475('0x13'),auth[_0x8475('0xf')](),controller['addMessage']);router[_0x8475('0x17')](_0x8475('0x24'),auth[_0x8475('0xa')](),interaction['tracked'](_0x8475('0x25'),'chatinteraction:addtags'),controller['addTags']);router['put'](_0x8475('0xe'),auth['isAuthenticated'](),interaction[_0x8475('0x26')](_0x8475('0x25'),_0x8475('0x27')),controller[_0x8475('0x28')]);router[_0x8475('0x29')](_0x8475('0x2a'),controller[_0x8475('0x2b')]);router[_0x8475('0x29')]('/:id/abandon',auth[_0x8475('0xf')](),controller['abandon']);router[_0x8475('0x29')](_0x8475('0x2c'),controller[_0x8475('0x2d')]);router[_0x8475('0x2e')](_0x8475('0xe'),auth[_0x8475('0xa')](),interaction['tracked'](_0x8475('0x25'),'chatinteraction:destroy'),controller['destroy']);router[_0x8475('0x2e')](_0x8475('0x24'),auth['isAuthenticated'](),controller['removeTags']);module[_0x8475('0x2f')]=router; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.attributes.js b/server/api/chatInternalMessage/chatInternalMessage.attributes.js index 6168499..842ac9c 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 _0xae93=['TEXT','medium','BOOLEAN','sequelize'];(function(_0x26c448,_0x4c4861){var _0x293e4a=function(_0x4af00e){while(--_0x4af00e){_0x26c448['push'](_0x26c448['shift']());}};_0x293e4a(++_0x4c4861);}(_0xae93,0xab));var _0x3ae9=function(_0x128607,_0x242e5f){_0x128607=_0x128607-0x0;var _0x4ba37b=_0xae93[_0x128607];return _0x4ba37b;};'use strict';var Sequelize=require(_0x3ae9('0x0'));module['exports']={'body':{'type':Sequelize[_0x3ae9('0x1')](_0x3ae9('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x3ae9('0x3')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x4968=['BOOLEAN','INTEGER','sequelize','exports'];(function(_0x19da4d,_0x260981){var _0xc71c77=function(_0x4edb82){while(--_0x4edb82){_0x19da4d['push'](_0x19da4d['shift']());}};_0xc71c77(++_0x260981);}(_0x4968,0xea));var _0x8496=function(_0x2a3316,_0xe22ce9){_0x2a3316=_0x2a3316-0x0;var _0xd2f9e4=_0x4968[_0x2a3316];return _0xd2f9e4;};'use strict';var Sequelize=require(_0x8496('0x0'));module[_0x8496('0x1')]={'body':{'type':Sequelize['TEXT']('medium'),'allowNull':![]},'read':{'type':Sequelize[_0x8496('0x2')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0x8496('0x3')]}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.controller.js b/server/api/chatInternalMessage/chatInternalMessage.controller.js index 1b17328..5994580 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 _0x4c6d=['offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','then','error','stack','ChatInternalMessage','fieldName','model','map','name','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','type','VIRTUAL','filter','includeAll','include','findAll','rows','show','params','options','find','catch','create','body','describe','get','lastMessageAt','createdAt','format','YYYY-MM-DD\x20HH:mm:ss','lastMessage','getUsers','User','agent','admin','user','fullname','userpic','internal','online','lastLoginAt','showWebBar','-online','VoiceQueue','VoiceQueues','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','Agents','userProfileId','autoAssociation','UserProfileResource','isEmpty','resourceId','push','messages','FromId','ToId','read','-createdAt','all','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','socket.io-emitter','./chatInternalMessage.socket','register','sendStatus','status','end','json'];(function(_0x9befec,_0x6c2980){var _0x4007a2=function(_0x2d7703){while(--_0x2d7703){_0x9befec['push'](_0x9befec['shift']());}};_0x4007a2(++_0x6c2980);}(_0x4c6d,0x13b));var _0xd4c6=function(_0x19fe01,_0x2242d6){_0x19fe01=_0x19fe01-0x0;var _0x16bf47=_0x4c6d[_0x19fe01];return _0x16bf47;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xd4c6('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd4c6('0x1'));var rp=require(_0xd4c6('0x2'));var moment=require(_0xd4c6('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xd4c6('0x4'));var util=require(_0xd4c6('0x5'));var path=require(_0xd4c6('0x6'));var sox=require(_0xd4c6('0x7'));var csv=require(_0xd4c6('0x8'));var ejs=require(_0xd4c6('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xd4c6('0xa'));var squel=require(_0xd4c6('0xb'));var crypto=require('crypto');var jsforce=require(_0xd4c6('0xc'));var deskjs=require(_0xd4c6('0xd'));var toCsv=require(_0xd4c6('0x8'));var querystring=require(_0xd4c6('0xe'));var Papa=require(_0xd4c6('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xd4c6('0x10'));var as=require(_0xd4c6('0x11'));var hardwareService=require(_0xd4c6('0x12'));var logger=require('../../config/logger')(_0xd4c6('0x13'));var utils=require(_0xd4c6('0x14'));var config=require(_0xd4c6('0x15'));var licenseUtil=require(_0xd4c6('0x16'));var db=require(_0xd4c6('0x17'))['db'];config['redis']=_[_0xd4c6('0x18')](config[_0xd4c6('0x19')],{'host':'localhost','port':0x18eb});var socket=require(_0xd4c6('0x1a'))(new Redis(config['redis']));require(_0xd4c6('0x1b'))[_0xd4c6('0x1c')](socket);function respondWithStatusCode(_0x1ce987,_0x201a58){_0x201a58=_0x201a58||0xcc;return function(_0x575415){if(_0x575415){return _0x1ce987[_0xd4c6('0x1d')](_0x201a58);}return _0x1ce987[_0xd4c6('0x1e')](_0x201a58)[_0xd4c6('0x1f')]();};}function respondWithResult(_0x42426c,_0x4cfa2a){_0x4cfa2a=_0x4cfa2a||0xc8;return function(_0x389f29){if(_0x389f29){return _0x42426c[_0xd4c6('0x1e')](_0x4cfa2a)[_0xd4c6('0x20')](_0x389f29);}};}function respondWithFilteredResult(_0x4b8c0e,_0x526d04){return function(_0x2ebf29){if(_0x2ebf29){var _0x1ec728=typeof _0x526d04[_0xd4c6('0x21')]===_0xd4c6('0x22')&&typeof _0x526d04[_0xd4c6('0x23')]===_0xd4c6('0x22');var _0x3d11d9=_0x2ebf29['count'];var _0xf8db8a=_0x1ec728?0x0:_0x526d04[_0xd4c6('0x21')];var _0x2eea38=_0x1ec728?_0x2ebf29[_0xd4c6('0x24')]:_0x526d04[_0xd4c6('0x21')]+_0x526d04[_0xd4c6('0x23')];var _0x53b241;if(_0x2eea38>=_0x3d11d9){_0x2eea38=_0x3d11d9;_0x53b241=0xc8;}else{_0x53b241=0xce;}_0x4b8c0e[_0xd4c6('0x1e')](_0x53b241);return _0x4b8c0e[_0xd4c6('0x25')](_0xd4c6('0x26'),_0xf8db8a+'-'+_0x2eea38+'/'+_0x3d11d9)[_0xd4c6('0x20')](_0x2ebf29);}return null;};}function patchUpdates(_0x329c96){return function(_0x266b7f){try{jsonpatch[_0xd4c6('0x27')](_0x266b7f,_0x329c96,!![]);}catch(_0x4dc3af){return BPromise[_0xd4c6('0x28')](_0x4dc3af);}return _0x266b7f[_0xd4c6('0x29')]();};}function saveUpdates(_0x57883c,_0x1712b8){return function(_0x21a5c7){if(_0x21a5c7){return _0x21a5c7[_0xd4c6('0x2a')](_0x57883c)['then'](function(_0x367ee3){return _0x367ee3;});}return null;};}function removeEntity(_0x26e737,_0x53a23c){return function(_0x1028e4){if(_0x1028e4){return _0x1028e4[_0xd4c6('0x2b')]()[_0xd4c6('0x2c')](function(){_0x26e737[_0xd4c6('0x1e')](0xcc)[_0xd4c6('0x1f')]();});}};}function handleEntityNotFound(_0xbd8423,_0x2d112d){return function(_0x5a53b0){if(!_0x5a53b0){_0xbd8423[_0xd4c6('0x1d')](0x194);}return _0x5a53b0;};}function handleError(_0x455e5d,_0x564040){_0x564040=_0x564040||0x1f4;return function(_0x300c9b){logger[_0xd4c6('0x2d')](_0x300c9b[_0xd4c6('0x2e')]);if(_0x300c9b['name']){delete _0x300c9b['name'];}_0x455e5d[_0xd4c6('0x1e')](_0x564040)['send'](_0x300c9b);};}exports['index']=function(_0x22cc63,_0x5e5ccd){var _0x1eb745={},_0xb8870b={},_0x94ccb4={'count':0x0,'rows':[]};var _0x38265e=_['map'](db[_0xd4c6('0x2f')]['rawAttributes'],function(_0x1932ef){return{'name':_0x1932ef[_0xd4c6('0x30')],'type':_0x1932ef['type']['key']};});_0xb8870b[_0xd4c6('0x31')]=_[_0xd4c6('0x32')](_0x38265e,_0xd4c6('0x33'));_0xb8870b['query']=_['keys'](_0x22cc63[_0xd4c6('0x34')]);_0xb8870b[_0xd4c6('0x35')]=_[_0xd4c6('0x36')](_0xb8870b[_0xd4c6('0x31')],_0xb8870b[_0xd4c6('0x34')]);_0x1eb745[_0xd4c6('0x37')]=_[_0xd4c6('0x36')](_0xb8870b[_0xd4c6('0x31')],qs[_0xd4c6('0x38')](_0x22cc63[_0xd4c6('0x34')]['fields']));_0x1eb745[_0xd4c6('0x37')]=_0x1eb745[_0xd4c6('0x37')][_0xd4c6('0x39')]?_0x1eb745[_0xd4c6('0x37')]:_0xb8870b[_0xd4c6('0x31')];if(!_0x22cc63['query'][_0xd4c6('0x3a')](_0xd4c6('0x3b'))){_0x1eb745['limit']=qs[_0xd4c6('0x23')](_0x22cc63['query'][_0xd4c6('0x23')]);_0x1eb745['offset']=qs[_0xd4c6('0x21')](_0x22cc63[_0xd4c6('0x34')]['offset']);}_0x1eb745[_0xd4c6('0x3c')]=qs[_0xd4c6('0x3d')](_0x22cc63[_0xd4c6('0x34')]['sort']);_0x1eb745[_0xd4c6('0x3e')]=qs['filters'](_[_0xd4c6('0x3f')](_0x22cc63[_0xd4c6('0x34')],_0xb8870b[_0xd4c6('0x35')]),_0x38265e);if(_0x22cc63[_0xd4c6('0x34')]['filter']){_0x1eb745['where']=_[_0xd4c6('0x40')](_0x1eb745[_0xd4c6('0x3e')],{'$or':_['map'](_0x38265e,function(_0x51fbd3){if(_0x51fbd3[_0xd4c6('0x41')]!==_0xd4c6('0x42')){var _0x50843a={};_0x50843a[_0x51fbd3[_0xd4c6('0x33')]]={'$like':'%'+_0x22cc63[_0xd4c6('0x34')][_0xd4c6('0x43')]+'%'};return _0x50843a;}})});}_0x1eb745=_[_0xd4c6('0x40')]({},_0x1eb745,_0x22cc63['options']);var _0x248eb8={'where':_0x1eb745[_0xd4c6('0x3e')]};return db['ChatInternalMessage'][_0xd4c6('0x24')](_0x248eb8)[_0xd4c6('0x2c')](function(_0x3f711f){_0x94ccb4[_0xd4c6('0x24')]=_0x3f711f;if(_0x22cc63[_0xd4c6('0x34')][_0xd4c6('0x44')]){_0x1eb745[_0xd4c6('0x45')]=[{'all':!![]}];}return db['ChatInternalMessage'][_0xd4c6('0x46')](_0x1eb745);})[_0xd4c6('0x2c')](function(_0x4ff848){_0x94ccb4[_0xd4c6('0x47')]=_0x4ff848;return _0x94ccb4;})[_0xd4c6('0x2c')](respondWithFilteredResult(_0x5e5ccd,_0x1eb745))['catch'](handleError(_0x5e5ccd,null));};exports[_0xd4c6('0x48')]=function(_0x2f19e3,_0x16f7b5){var _0x377392={'raw':!![],'where':{'id':_0x2f19e3[_0xd4c6('0x49')]['id']}},_0x153218={};_0x153218[_0xd4c6('0x31')]=_['keys'](db[_0xd4c6('0x2f')]['rawAttributes']);_0x153218[_0xd4c6('0x34')]=_['keys'](_0x2f19e3[_0xd4c6('0x34')]);_0x153218[_0xd4c6('0x35')]=_[_0xd4c6('0x36')](_0x153218[_0xd4c6('0x31')],_0x153218[_0xd4c6('0x34')]);_0x377392[_0xd4c6('0x37')]=_[_0xd4c6('0x36')](_0x153218[_0xd4c6('0x31')],qs['fields'](_0x2f19e3[_0xd4c6('0x34')][_0xd4c6('0x38')]));_0x377392[_0xd4c6('0x37')]=_0x377392[_0xd4c6('0x37')][_0xd4c6('0x39')]?_0x377392['attributes']:_0x153218[_0xd4c6('0x31')];if(_0x2f19e3[_0xd4c6('0x34')][_0xd4c6('0x44')]){_0x377392[_0xd4c6('0x45')]=[{'all':!![]}];}_0x377392=_[_0xd4c6('0x40')]({},_0x377392,_0x2f19e3[_0xd4c6('0x4a')]);return db[_0xd4c6('0x2f')][_0xd4c6('0x4b')](_0x377392)[_0xd4c6('0x2c')](handleEntityNotFound(_0x16f7b5,null))[_0xd4c6('0x2c')](respondWithResult(_0x16f7b5,null))[_0xd4c6('0x4c')](handleError(_0x16f7b5,null));};exports[_0xd4c6('0x4d')]=function(_0x59084c,_0x2a9343){return db[_0xd4c6('0x2f')][_0xd4c6('0x4d')](_0x59084c[_0xd4c6('0x4e')],{})[_0xd4c6('0x2c')](respondWithResult(_0x2a9343,0xc9))[_0xd4c6('0x4c')](handleError(_0x2a9343,null));};exports[_0xd4c6('0x2a')]=function(_0x4fc2ab,_0x37cd16){if(_0x4fc2ab[_0xd4c6('0x4e')]['id']){delete _0x4fc2ab[_0xd4c6('0x4e')]['id'];}return db[_0xd4c6('0x2f')][_0xd4c6('0x4b')]({'where':{'id':_0x4fc2ab[_0xd4c6('0x49')]['id']}})[_0xd4c6('0x2c')](handleEntityNotFound(_0x37cd16,null))[_0xd4c6('0x2c')](saveUpdates(_0x4fc2ab['body'],null))['then'](respondWithResult(_0x37cd16,null))[_0xd4c6('0x4c')](handleError(_0x37cd16,null));};exports[_0xd4c6('0x2b')]=function(_0x159c0b,_0x437f92){return db[_0xd4c6('0x2f')][_0xd4c6('0x4b')]({'where':{'id':_0x159c0b[_0xd4c6('0x49')]['id']}})['then'](handleEntityNotFound(_0x437f92,null))[_0xd4c6('0x2c')](removeEntity(_0x437f92,null))[_0xd4c6('0x4c')](handleError(_0x437f92,null));};exports[_0xd4c6('0x4f')]=function(_0x1a0df6,_0x42ddf5){return db[_0xd4c6('0x2f')][_0xd4c6('0x4f')]()[_0xd4c6('0x2c')](respondWithResult(_0x42ddf5,null))[_0xd4c6('0x4c')](handleError(_0x42ddf5,null));};function wrapUser(_0x1175a3){return function(_0x5734e4){var _0x399f4e=_0x1175a3[_0xd4c6('0x50')]({'plain':!![]});_0x399f4e['messages']=[];if(_0x5734e4){_0x399f4e[_0xd4c6('0x51')]=_0x5734e4[_0xd4c6('0x52')];_0x399f4e['lastMessage']=_0x5734e4;}else{_0x399f4e[_0xd4c6('0x51')]=moment(0x0)[_0xd4c6('0x53')](_0xd4c6('0x54'));_0x399f4e[_0xd4c6('0x55')]={};}return _0x399f4e;};}exports[_0xd4c6('0x56')]=function(_0x4a2ed3,_0xa1dafa,_0x15fb43){var _0xd500e1=[];return db[_0xd4c6('0x57')]['findAll']({'where':{'role':[_0xd4c6('0x58'),_0xd4c6('0x59'),_0xd4c6('0x5a')]},'attributes':['id',_0xd4c6('0x5b'),_0xd4c6('0x33'),'role',_0xd4c6('0x5c'),_0xd4c6('0x5d'),_0xd4c6('0x5e'),_0xd4c6('0x5f'),'allowmessenger',_0xd4c6('0x60')],'order':qs[_0xd4c6('0x3d')](_0xd4c6('0x61')),'include':[{'model':db[_0xd4c6('0x62')],'as':_0xd4c6('0x63'),'attributes':['id',_0xd4c6('0x33'),_0xd4c6('0x41')],'through':{'attributes':[]}}]})[_0xd4c6('0x2c')](function(_0x5e0b7e){if(_0x5e0b7e){var _0xd83478=_0x4a2ed3[_0xd4c6('0x5a')][_0xd4c6('0x50')]({'plain':!![]});if(!_0xd83478)throw new Error(_0xd4c6('0x64'));if(_0xd83478[_0xd4c6('0x65')]===_0xd4c6('0x5a')){return db[_0xd4c6('0x66')]['find']({'where':{'name':_0xd4c6('0x67'),'userProfileId':_0xd83478[_0xd4c6('0x68')]},'raw':!![]})[_0xd4c6('0x2c')](function(_0x504613){if(_0x504613){if(_0x504613[_0xd4c6('0x69')]===0x0){return db[_0xd4c6('0x6a')][_0xd4c6('0x46')]({'where':{'sectionId':_0x504613['id']},'raw':!![]})[_0xd4c6('0x2c')](function(_0x21a303){var _0x415143=[];if(_[_0xd4c6('0x6b')](_0x21a303)){_0x415143=_[_0xd4c6('0x43')](_0x5e0b7e,function(_0x5bae6e){if(_0x5bae6e[_0xd4c6('0x65')]!==_0xd4c6('0x58')){return _0x5bae6e;}});return _0x415143;}else{for(var _0x21b04a=0x0;_0x21b04a<_0x5e0b7e[_0xd4c6('0x39')];_0x21b04a++){var _0xc06fe9=_0x5e0b7e[_0x21b04a];if(_0xc06fe9['role']===_0xd4c6('0x58')){var _0x2a8968=_[_0xd4c6('0x4b')](_0x21a303,function(_0x1bf8fd){return _0x1bf8fd[_0xd4c6('0x6c')]===_0xc06fe9['id'];});if(_0x2a8968)_0x415143[_0xd4c6('0x6d')](_0xc06fe9);}else{_0x415143[_0xd4c6('0x6d')](_0xc06fe9);}}return _0x415143;}});}else{return _0x5e0b7e;}}else{var _0x150ba5=_[_0xd4c6('0x43')](_0x5e0b7e,function(_0x3216f4){if(_0x3216f4[_0xd4c6('0x65')]!==_0xd4c6('0x58')){return _0x3216f4;}});return _0x150ba5;}});}else{return _0x5e0b7e;}}})[_0xd4c6('0x2c')](function(_0x494f62){var _0x4f17af=[];if(_0x494f62){_0xd500e1=_0x494f62;for(var _0x220c09=0x0;_0x220c09<_0x494f62[_0xd4c6('0x39')];_0x220c09+=0x1){_0xd500e1[_0x220c09][_0xd4c6('0x6e')]=[];_0x4f17af[_0xd4c6('0x6d')](db[_0xd4c6('0x2f')][_0xd4c6('0x4b')]({'where':{'FromId':[_0x4a2ed3['user']['id'],_0x494f62[_0x220c09]['id']],'ToId':[_0x4a2ed3['user']['id'],_0x494f62[_0x220c09]['id']],'ChatGroupId':null},'attributes':['id','createdAt',_0xd4c6('0x6f'),_0xd4c6('0x70'),_0xd4c6('0x71'),_0xd4c6('0x4e')],'order':qs[_0xd4c6('0x3d')](_0xd4c6('0x72')),'limit':0x1,'offset':0x0,'raw':!![]})[_0xd4c6('0x2c')](wrapUser(_0x494f62[_0x220c09])));}return BPromise[_0xd4c6('0x73')](_0x4f17af);}return[];})[_0xd4c6('0x2c')](function(_0x74608d){return{'rows':_0x74608d,'count':_0x74608d[_0xd4c6('0x39')]};})[_0xd4c6('0x2c')](respondWithResult(_0xa1dafa,null))[_0xd4c6('0x4c')](handleError(_0xa1dafa,null));}; \ No newline at end of file +var _0x8ea6=['query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','merge','type','VIRTUAL','filter','includeAll','include','findAll','catch','params','rawAttributes','find','create','body','get','messages','lastMessageAt','createdAt','lastMessage','format','User','agent','admin','user','fullname','role','internal','online','lastLoginAt','allowmessenger','-online','VoiceQueue','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','Agents','userProfileId','UserProfileResource','isEmpty','resourceId','push','FromId','ToId','read','-createdAt','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./chatInternalMessage.socket','register','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','end','sendStatus','error','stack','send','index','ChatInternalMessage','fieldName','key','model','map','name'];(function(_0x1d1a11,_0x471250){var _0x122a3c=function(_0x31dee5){while(--_0x31dee5){_0x1d1a11['push'](_0x1d1a11['shift']());}};_0x122a3c(++_0x471250);}(_0x8ea6,0x11a));var _0x68ea=function(_0x2096aa,_0x5c595d){_0x2096aa=_0x2096aa-0x0;var _0x3fc62d=_0x8ea6[_0x2096aa];return _0x3fc62d;};'use strict';var emlformat=require(_0x68ea('0x0'));var rimraf=require(_0x68ea('0x1'));var zipdir=require(_0x68ea('0x2'));var jsonpatch=require(_0x68ea('0x3'));var rp=require(_0x68ea('0x4'));var moment=require(_0x68ea('0x5'));var BPromise=require(_0x68ea('0x6'));var Mustache=require(_0x68ea('0x7'));var util=require(_0x68ea('0x8'));var path=require('path');var sox=require(_0x68ea('0x9'));var csv=require(_0x68ea('0xa'));var ejs=require(_0x68ea('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x68ea('0xc'));var squel=require(_0x68ea('0xd'));var crypto=require(_0x68ea('0xe'));var jsforce=require(_0x68ea('0xf'));var deskjs=require(_0x68ea('0x10'));var toCsv=require(_0x68ea('0xa'));var querystring=require(_0x68ea('0x11'));var Papa=require(_0x68ea('0x12'));var Redis=require(_0x68ea('0x13'));var authService=require(_0x68ea('0x14'));var qs=require(_0x68ea('0x15'));var as=require(_0x68ea('0x16'));var hardwareService=require(_0x68ea('0x17'));var logger=require(_0x68ea('0x18'))(_0x68ea('0x19'));var utils=require(_0x68ea('0x1a'));var config=require(_0x68ea('0x1b'));var licenseUtil=require(_0x68ea('0x1c'));var db=require(_0x68ea('0x1d'))['db'];config['redis']=_['defaults'](config[_0x68ea('0x1e')],{'host':_0x68ea('0x1f'),'port':0x18eb});var socket=require(_0x68ea('0x20'))(new Redis(config[_0x68ea('0x1e')]));require(_0x68ea('0x21'))[_0x68ea('0x22')](socket);function respondWithStatusCode(_0x99e0c0,_0x3c41d1){_0x3c41d1=_0x3c41d1||0xcc;return function(_0x114533){if(_0x114533){return _0x99e0c0['sendStatus'](_0x3c41d1);}return _0x99e0c0[_0x68ea('0x23')](_0x3c41d1)['end']();};}function respondWithResult(_0xab966a,_0x343694){_0x343694=_0x343694||0xc8;return function(_0xdae5f8){if(_0xdae5f8){return _0xab966a[_0x68ea('0x23')](_0x343694)[_0x68ea('0x24')](_0xdae5f8);}};}function respondWithFilteredResult(_0x28819d,_0x251835){return function(_0x1c16a7){if(_0x1c16a7){var _0x4ad021=typeof _0x251835[_0x68ea('0x25')]===_0x68ea('0x26')&&typeof _0x251835['limit']===_0x68ea('0x26');var _0x2b66af=_0x1c16a7[_0x68ea('0x27')];var _0x2db301=_0x4ad021?0x0:_0x251835[_0x68ea('0x25')];var _0x2e54d3=_0x4ad021?_0x1c16a7['count']:_0x251835[_0x68ea('0x25')]+_0x251835[_0x68ea('0x28')];var _0x383c88;if(_0x2e54d3>=_0x2b66af){_0x2e54d3=_0x2b66af;_0x383c88=0xc8;}else{_0x383c88=0xce;}_0x28819d[_0x68ea('0x23')](_0x383c88);return _0x28819d[_0x68ea('0x29')](_0x68ea('0x2a'),_0x2db301+'-'+_0x2e54d3+'/'+_0x2b66af)['json'](_0x1c16a7);}return null;};}function patchUpdates(_0x2b9b86){return function(_0x364815){try{jsonpatch[_0x68ea('0x2b')](_0x364815,_0x2b9b86,!![]);}catch(_0x203c83){return BPromise[_0x68ea('0x2c')](_0x203c83);}return _0x364815[_0x68ea('0x2d')]();};}function saveUpdates(_0x2a8539,_0x25972a){return function(_0x5e76a8){if(_0x5e76a8){return _0x5e76a8[_0x68ea('0x2e')](_0x2a8539)[_0x68ea('0x2f')](function(_0x54f4b2){return _0x54f4b2;});}return null;};}function removeEntity(_0x228579,_0x505549){return function(_0x50e7f5){if(_0x50e7f5){return _0x50e7f5['destroy']()[_0x68ea('0x2f')](function(){_0x228579[_0x68ea('0x23')](0xcc)[_0x68ea('0x30')]();});}};}function handleEntityNotFound(_0x1af729,_0x53bcc8){return function(_0x2e778a){if(!_0x2e778a){_0x1af729[_0x68ea('0x31')](0x194);}return _0x2e778a;};}function handleError(_0x41f751,_0x45be7b){_0x45be7b=_0x45be7b||0x1f4;return function(_0x203ad4){logger[_0x68ea('0x32')](_0x203ad4[_0x68ea('0x33')]);if(_0x203ad4['name']){delete _0x203ad4['name'];}_0x41f751[_0x68ea('0x23')](_0x45be7b)[_0x68ea('0x34')](_0x203ad4);};}exports[_0x68ea('0x35')]=function(_0x2b58b7,_0x32b32f){var _0xb784b5={},_0xa97096={},_0x3207f1={'count':0x0,'rows':[]};var _0x554a62=_['map'](db[_0x68ea('0x36')]['rawAttributes'],function(_0x589d3d){return{'name':_0x589d3d[_0x68ea('0x37')],'type':_0x589d3d['type'][_0x68ea('0x38')]};});_0xa97096[_0x68ea('0x39')]=_[_0x68ea('0x3a')](_0x554a62,_0x68ea('0x3b'));_0xa97096[_0x68ea('0x3c')]=_[_0x68ea('0x3d')](_0x2b58b7[_0x68ea('0x3c')]);_0xa97096[_0x68ea('0x3e')]=_[_0x68ea('0x3f')](_0xa97096[_0x68ea('0x39')],_0xa97096[_0x68ea('0x3c')]);_0xb784b5[_0x68ea('0x40')]=_[_0x68ea('0x3f')](_0xa97096[_0x68ea('0x39')],qs[_0x68ea('0x41')](_0x2b58b7[_0x68ea('0x3c')]['fields']));_0xb784b5[_0x68ea('0x40')]=_0xb784b5[_0x68ea('0x40')][_0x68ea('0x42')]?_0xb784b5[_0x68ea('0x40')]:_0xa97096['model'];if(!_0x2b58b7['query']['hasOwnProperty'](_0x68ea('0x43'))){_0xb784b5[_0x68ea('0x28')]=qs[_0x68ea('0x28')](_0x2b58b7[_0x68ea('0x3c')]['limit']);_0xb784b5[_0x68ea('0x25')]=qs[_0x68ea('0x25')](_0x2b58b7[_0x68ea('0x3c')]['offset']);}_0xb784b5[_0x68ea('0x44')]=qs[_0x68ea('0x45')](_0x2b58b7['query'][_0x68ea('0x45')]);_0xb784b5[_0x68ea('0x46')]=qs[_0x68ea('0x3e')](_['pick'](_0x2b58b7[_0x68ea('0x3c')],_0xa97096['filters']),_0x554a62);if(_0x2b58b7[_0x68ea('0x3c')]['filter']){_0xb784b5[_0x68ea('0x46')]=_[_0x68ea('0x47')](_0xb784b5[_0x68ea('0x46')],{'$or':_['map'](_0x554a62,function(_0x3a4284){if(_0x3a4284[_0x68ea('0x48')]!==_0x68ea('0x49')){var _0x1b71f6={};_0x1b71f6[_0x3a4284['name']]={'$like':'%'+_0x2b58b7['query'][_0x68ea('0x4a')]+'%'};return _0x1b71f6;}})});}_0xb784b5=_[_0x68ea('0x47')]({},_0xb784b5,_0x2b58b7['options']);var _0x148b36={'where':_0xb784b5[_0x68ea('0x46')]};return db['ChatInternalMessage'][_0x68ea('0x27')](_0x148b36)['then'](function(_0x33de74){_0x3207f1[_0x68ea('0x27')]=_0x33de74;if(_0x2b58b7['query'][_0x68ea('0x4b')]){_0xb784b5[_0x68ea('0x4c')]=[{'all':!![]}];}return db[_0x68ea('0x36')][_0x68ea('0x4d')](_0xb784b5);})[_0x68ea('0x2f')](function(_0x25b266){_0x3207f1['rows']=_0x25b266;return _0x3207f1;})[_0x68ea('0x2f')](respondWithFilteredResult(_0x32b32f,_0xb784b5))[_0x68ea('0x4e')](handleError(_0x32b32f,null));};exports['show']=function(_0x1f8323,_0x17c32f){var _0xdd3bea={'raw':!![],'where':{'id':_0x1f8323[_0x68ea('0x4f')]['id']}},_0x17a7e3={};_0x17a7e3[_0x68ea('0x39')]=_[_0x68ea('0x3d')](db[_0x68ea('0x36')][_0x68ea('0x50')]);_0x17a7e3['query']=_[_0x68ea('0x3d')](_0x1f8323['query']);_0x17a7e3['filters']=_[_0x68ea('0x3f')](_0x17a7e3[_0x68ea('0x39')],_0x17a7e3['query']);_0xdd3bea[_0x68ea('0x40')]=_[_0x68ea('0x3f')](_0x17a7e3['model'],qs[_0x68ea('0x41')](_0x1f8323[_0x68ea('0x3c')][_0x68ea('0x41')]));_0xdd3bea[_0x68ea('0x40')]=_0xdd3bea[_0x68ea('0x40')][_0x68ea('0x42')]?_0xdd3bea[_0x68ea('0x40')]:_0x17a7e3['model'];if(_0x1f8323['query'][_0x68ea('0x4b')]){_0xdd3bea['include']=[{'all':!![]}];}_0xdd3bea=_['merge']({},_0xdd3bea,_0x1f8323['options']);return db[_0x68ea('0x36')][_0x68ea('0x51')](_0xdd3bea)[_0x68ea('0x2f')](handleEntityNotFound(_0x17c32f,null))[_0x68ea('0x2f')](respondWithResult(_0x17c32f,null))['catch'](handleError(_0x17c32f,null));};exports[_0x68ea('0x52')]=function(_0x84088a,_0x30d6da){return db[_0x68ea('0x36')]['create'](_0x84088a[_0x68ea('0x53')],{})['then'](respondWithResult(_0x30d6da,0xc9))[_0x68ea('0x4e')](handleError(_0x30d6da,null));};exports[_0x68ea('0x2e')]=function(_0x633241,_0x408daf){if(_0x633241['body']['id']){delete _0x633241[_0x68ea('0x53')]['id'];}return db['ChatInternalMessage'][_0x68ea('0x51')]({'where':{'id':_0x633241[_0x68ea('0x4f')]['id']}})[_0x68ea('0x2f')](handleEntityNotFound(_0x408daf,null))['then'](saveUpdates(_0x633241[_0x68ea('0x53')],null))['then'](respondWithResult(_0x408daf,null))[_0x68ea('0x4e')](handleError(_0x408daf,null));};exports['destroy']=function(_0x3f3123,_0x5eb16e){return db[_0x68ea('0x36')][_0x68ea('0x51')]({'where':{'id':_0x3f3123[_0x68ea('0x4f')]['id']}})[_0x68ea('0x2f')](handleEntityNotFound(_0x5eb16e,null))[_0x68ea('0x2f')](removeEntity(_0x5eb16e,null))['catch'](handleError(_0x5eb16e,null));};exports['describe']=function(_0x3312d4,_0x246ece){return db['ChatInternalMessage']['describe']()[_0x68ea('0x2f')](respondWithResult(_0x246ece,null))['catch'](handleError(_0x246ece,null));};function wrapUser(_0x5f4258){return function(_0x368da5){var _0xab1ca2=_0x5f4258[_0x68ea('0x54')]({'plain':!![]});_0xab1ca2[_0x68ea('0x55')]=[];if(_0x368da5){_0xab1ca2[_0x68ea('0x56')]=_0x368da5[_0x68ea('0x57')];_0xab1ca2[_0x68ea('0x58')]=_0x368da5;}else{_0xab1ca2[_0x68ea('0x56')]=moment(0x0)[_0x68ea('0x59')]('YYYY-MM-DD\x20HH:mm:ss');_0xab1ca2['lastMessage']={};}return _0xab1ca2;};}exports['getUsers']=function(_0xdb673a,_0x378d5b,_0x154032){var _0x59a648=[];return db[_0x68ea('0x5a')][_0x68ea('0x4d')]({'where':{'role':[_0x68ea('0x5b'),_0x68ea('0x5c'),_0x68ea('0x5d')]},'attributes':['id',_0x68ea('0x5e'),_0x68ea('0x3b'),_0x68ea('0x5f'),'userpic',_0x68ea('0x60'),_0x68ea('0x61'),_0x68ea('0x62'),_0x68ea('0x63'),'showWebBar'],'order':qs['sort'](_0x68ea('0x64')),'include':[{'model':db[_0x68ea('0x65')],'as':'VoiceQueues','attributes':['id','name',_0x68ea('0x48')],'through':{'attributes':[]}}]})[_0x68ea('0x2f')](function(_0x43d0ea){if(_0x43d0ea){var _0x4af248=_0xdb673a[_0x68ea('0x5d')][_0x68ea('0x54')]({'plain':!![]});if(!_0x4af248)throw new Error(_0x68ea('0x66'));if(_0x4af248[_0x68ea('0x5f')]===_0x68ea('0x5d')){return db[_0x68ea('0x67')]['find']({'where':{'name':_0x68ea('0x68'),'userProfileId':_0x4af248[_0x68ea('0x69')]},'raw':!![]})['then'](function(_0x167c1e){if(_0x167c1e){if(_0x167c1e['autoAssociation']===0x0){return db[_0x68ea('0x6a')][_0x68ea('0x4d')]({'where':{'sectionId':_0x167c1e['id']},'raw':!![]})[_0x68ea('0x2f')](function(_0x2fdea5){var _0x39375d=[];if(_[_0x68ea('0x6b')](_0x2fdea5)){_0x39375d=_['filter'](_0x43d0ea,function(_0x2a7fbd){if(_0x2a7fbd['role']!=='agent'){return _0x2a7fbd;}});return _0x39375d;}else{for(var _0x42aae8=0x0;_0x42aae8<_0x43d0ea['length'];_0x42aae8++){var _0x5d2e5a=_0x43d0ea[_0x42aae8];if(_0x5d2e5a[_0x68ea('0x5f')]==='agent'){var _0x5cad3b=_[_0x68ea('0x51')](_0x2fdea5,function(_0x42b072){return _0x42b072[_0x68ea('0x6c')]===_0x5d2e5a['id'];});if(_0x5cad3b)_0x39375d[_0x68ea('0x6d')](_0x5d2e5a);}else{_0x39375d[_0x68ea('0x6d')](_0x5d2e5a);}}return _0x39375d;}});}else{return _0x43d0ea;}}else{var _0x5286a2=_[_0x68ea('0x4a')](_0x43d0ea,function(_0x40e57b){if(_0x40e57b[_0x68ea('0x5f')]!==_0x68ea('0x5b')){return _0x40e57b;}});return _0x5286a2;}});}else{return _0x43d0ea;}}})[_0x68ea('0x2f')](function(_0x54de30){var _0x337d1b=[];if(_0x54de30){_0x59a648=_0x54de30;for(var _0x1b98d0=0x0;_0x1b98d0<_0x54de30[_0x68ea('0x42')];_0x1b98d0+=0x1){_0x59a648[_0x1b98d0][_0x68ea('0x55')]=[];_0x337d1b[_0x68ea('0x6d')](db[_0x68ea('0x36')][_0x68ea('0x51')]({'where':{'FromId':[_0xdb673a[_0x68ea('0x5d')]['id'],_0x54de30[_0x1b98d0]['id']],'ToId':[_0xdb673a[_0x68ea('0x5d')]['id'],_0x54de30[_0x1b98d0]['id']],'ChatGroupId':null},'attributes':['id',_0x68ea('0x57'),_0x68ea('0x6e'),_0x68ea('0x6f'),_0x68ea('0x70'),_0x68ea('0x53')],'order':qs[_0x68ea('0x45')](_0x68ea('0x71')),'limit':0x1,'offset':0x0,'raw':!![]})[_0x68ea('0x2f')](wrapUser(_0x54de30[_0x1b98d0])));}return BPromise['all'](_0x337d1b);}return[];})[_0x68ea('0x2f')](function(_0x2dac15){return{'rows':_0x2dac15,'count':_0x2dac15[_0x68ea('0x42')]};})[_0x68ea('0x2f')](respondWithResult(_0x378d5b,null))['catch'](handleError(_0x378d5b,null));}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.events.js b/server/api/chatInternalMessage/chatInternalMessage.events.js index 439278a..d2be053 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 _0x3117=['ChatInternalMessage','save','update','remove','emit','hasOwnProperty','hook','events'];(function(_0x5e1cb3,_0xb8804b){var _0x4aa975=function(_0x29d432){while(--_0x29d432){_0x5e1cb3['push'](_0x5e1cb3['shift']());}};_0x4aa975(++_0xb8804b);}(_0x3117,0x1af));var _0x7311=function(_0x31172e,_0xa59e5){_0x31172e=_0x31172e-0x0;var _0x414ada=_0x3117[_0x31172e];return _0x414ada;};'use strict';var EventEmitter=require(_0x7311('0x0'));var ChatInternalMessage=require('../../mysqldb')['db'][_0x7311('0x1')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x7311('0x2'),'afterUpdate':_0x7311('0x3'),'afterDestroy':_0x7311('0x4')};function emitEvent(_0x5ddfba){return function(_0x935bf8,_0x35dd60,_0x5edaed){ChatInternalMessageEvents[_0x7311('0x5')](_0x5ddfba+':'+_0x935bf8['id'],_0x935bf8);ChatInternalMessageEvents['emit'](_0x5ddfba,_0x935bf8);_0x5edaed(null);};}for(var e in events){if(events[_0x7311('0x6')](e)){var event=events[e];ChatInternalMessage[_0x7311('0x7')](e,emitEvent(event));}}module['exports']=ChatInternalMessageEvents; \ No newline at end of file +var _0xd876=['emit','hasOwnProperty','hook','events','ChatInternalMessage','setMaxListeners','remove'];(function(_0x84d9dd,_0x13db4b){var _0x58587b=function(_0x28937d){while(--_0x28937d){_0x84d9dd['push'](_0x84d9dd['shift']());}};_0x58587b(++_0x13db4b);}(_0xd876,0x11b));var _0x6d87=function(_0x235ea7,_0x58b6d7){_0x235ea7=_0x235ea7-0x0;var _0x367ab0=_0xd876[_0x235ea7];return _0x367ab0;};'use strict';var EventEmitter=require(_0x6d87('0x0'));var ChatInternalMessage=require('../../mysqldb')['db'][_0x6d87('0x1')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0x6d87('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x6d87('0x3')};function emitEvent(_0x103e0b){return function(_0x3d239a,_0x3e4359,_0x7df2e1){ChatInternalMessageEvents[_0x6d87('0x4')](_0x103e0b+':'+_0x3d239a['id'],_0x3d239a);ChatInternalMessageEvents[_0x6d87('0x4')](_0x103e0b,_0x3d239a);_0x7df2e1(null);};}for(var e in events){if(events[_0x6d87('0x5')](e)){var event=events[e];ChatInternalMessage[_0x6d87('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 d4cd7e9..d94d038 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 _0x1055=['api','request-promise','path','../../config/environment','./chatInternalMessage.attributes','exports','define','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger'];(function(_0x364b6b,_0x4a9f78){var _0x52760d=function(_0x5ac8c5){while(--_0x5ac8c5){_0x364b6b['push'](_0x364b6b['shift']());}};_0x52760d(++_0x4a9f78);}(_0x1055,0xda));var _0x5105=function(_0x1a4a0b,_0x5e8e4f){_0x1a4a0b=_0x1a4a0b-0x0;var _0x15d52a=_0x1055[_0x1a4a0b];return _0x15d52a;};'use strict';var _=require('lodash');var util=require(_0x5105('0x0'));var logger=require(_0x5105('0x1'))(_0x5105('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x5105('0x3'));var fs=require('fs');var path=require(_0x5105('0x4'));var rimraf=require('rimraf');var config=require(_0x5105('0x5'));var attributes=require(_0x5105('0x6'));module[_0x5105('0x7')]=function(_0x304f51,_0x2b94a8){return _0x304f51[_0x5105('0x8')]('ChatInternalMessage',attributes,{'tableName':'chat_internal_messages','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x5105('0x9'),'collate':_0x5105('0xa')});}; \ No newline at end of file +var _0xcc94=['lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','define','chat_internal_messages','utf8mb4_unicode_ci'];(function(_0x32d457,_0x1a39c9){var _0x338386=function(_0x199d7a){while(--_0x199d7a){_0x32d457['push'](_0x32d457['shift']());}};_0x338386(++_0x1a39c9);}(_0xcc94,0x84));var _0x4cc9=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xcc94[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x4cc9('0x0'));var util=require(_0x4cc9('0x1'));var logger=require(_0x4cc9('0x2'))('api');var moment=require(_0x4cc9('0x3'));var BPromise=require(_0x4cc9('0x4'));var rp=require(_0x4cc9('0x5'));var fs=require('fs');var path=require(_0x4cc9('0x6'));var rimraf=require(_0x4cc9('0x7'));var config=require('../../config/environment');var attributes=require('./chatInternalMessage.attributes');module['exports']=function(_0x5c6db2,_0x13cfa1){return _0x5c6db2[_0x4cc9('0x8')]('ChatInternalMessage',attributes,{'tableName':_0x4cc9('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x4cc9('0xa')});}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.rpc.js b/server/api/chatInternalMessage/chatInternalMessage.rpc.js index 23cfdd3..8eca7e8 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 _0xf6d1=['ChatInternalMessage,\x20%s,\x20%s','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./chatInternalMessage.socket','register','request','then','info','debug','ChatInternalMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code'];(function(_0x33c55c,_0x4ab195){var _0x61efca=function(_0x5b4072){while(--_0x5b4072){_0x33c55c['push'](_0x33c55c['shift']());}};_0x61efca(++_0x4ab195);}(_0xf6d1,0x99));var _0x1f6d=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0xf6d1[_0xbca1b1];return _0x4e1686;};'use strict';var _=require(_0x1f6d('0x0'));var util=require(_0x1f6d('0x1'));var moment=require(_0x1f6d('0x2'));var BPromise=require(_0x1f6d('0x3'));var rs=require(_0x1f6d('0x4'));var fs=require('fs');var Redis=require(_0x1f6d('0x5'));var db=require(_0x1f6d('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x1f6d('0x7'))('rpc');var config=require(_0x1f6d('0x8'));var jayson=require(_0x1f6d('0x9'));var client=jayson[_0x1f6d('0xa')][_0x1f6d('0xb')]({'port':0x232a});config[_0x1f6d('0xc')]=_[_0x1f6d('0xd')](config[_0x1f6d('0xc')],{'host':_0x1f6d('0xe'),'port':0x18eb});var socket=require(_0x1f6d('0xf'))(new Redis(config[_0x1f6d('0xc')]));require(_0x1f6d('0x10'))[_0x1f6d('0x11')](socket);function respondWithRpcPromise(_0x523958,_0x25ec55,_0x4f33bd){return new BPromise(function(_0x456882,_0x4aaba1){return client[_0x1f6d('0x12')](_0x523958,_0x4f33bd)[_0x1f6d('0x13')](function(_0x3d813c){logger[_0x1f6d('0x14')]('ChatInternalMessage,\x20%s,\x20%s',_0x25ec55,'request\x20sent');logger[_0x1f6d('0x15')](_0x1f6d('0x16'),_0x25ec55,_0x1f6d('0x17'),JSON[_0x1f6d('0x18')](_0x3d813c));if(_0x3d813c[_0x1f6d('0x19')]){if(_0x3d813c[_0x1f6d('0x19')][_0x1f6d('0x1a')]===0x1f4){logger[_0x1f6d('0x19')](_0x1f6d('0x1b'),_0x25ec55,_0x3d813c[_0x1f6d('0x19')]['message']);return _0x4aaba1(_0x3d813c[_0x1f6d('0x19')][_0x1f6d('0x1c')]);}logger[_0x1f6d('0x19')]('ChatInternalMessage,\x20%s,\x20%s',_0x25ec55,_0x3d813c[_0x1f6d('0x19')][_0x1f6d('0x1c')]);return _0x456882(_0x3d813c['error'][_0x1f6d('0x1c')]);}else{logger[_0x1f6d('0x14')](_0x1f6d('0x1b'),_0x25ec55,_0x1f6d('0x17'));_0x456882(_0x3d813c[_0x1f6d('0x1d')][_0x1f6d('0x1c')]);}})['catch'](function(_0x24c5b8){logger[_0x1f6d('0x19')](_0x1f6d('0x1b'),_0x25ec55,_0x24c5b8);_0x4aaba1(_0x24c5b8);});});} \ No newline at end of file +var _0x08bb=['randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','./chatInternalMessage.socket','register','then','info','request\x20sent','debug','ChatInternalMessage,\x20%s,\x20%s,\x20%s','error','code','ChatInternalMessage,\x20%s,\x20%s','message','result','catch','lodash','util','bluebird'];(function(_0x3acb89,_0x2ca05e){var _0x4d38f2=function(_0x4cb6a9){while(--_0x4cb6a9){_0x3acb89['push'](_0x3acb89['shift']());}};_0x4d38f2(++_0x2ca05e);}(_0x08bb,0x177));var _0xb08b=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x08bb[_0x3ab51d];return _0x29a04e;};'use strict';var _=require(_0xb08b('0x0'));var util=require(_0xb08b('0x1'));var moment=require('moment');var BPromise=require(_0xb08b('0x2'));var rs=require(_0xb08b('0x3'));var fs=require('fs');var Redis=require(_0xb08b('0x4'));var db=require(_0xb08b('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xb08b('0x6'))(_0xb08b('0x7'));var config=require(_0xb08b('0x8'));var jayson=require(_0xb08b('0x9'));var client=jayson[_0xb08b('0xa')][_0xb08b('0xb')]({'port':0x232a});config[_0xb08b('0xc')]=_['defaults'](config[_0xb08b('0xc')],{'host':_0xb08b('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xb08b('0xc')]));require(_0xb08b('0xe'))[_0xb08b('0xf')](socket);function respondWithRpcPromise(_0x4b7f9b,_0x4c3727,_0x3205f5){return new BPromise(function(_0x40b9cf,_0x5b41f2){return client['request'](_0x4b7f9b,_0x3205f5)[_0xb08b('0x10')](function(_0x53a4d2){logger[_0xb08b('0x11')]('ChatInternalMessage,\x20%s,\x20%s',_0x4c3727,_0xb08b('0x12'));logger[_0xb08b('0x13')](_0xb08b('0x14'),_0x4c3727,_0xb08b('0x12'),JSON['stringify'](_0x53a4d2));if(_0x53a4d2[_0xb08b('0x15')]){if(_0x53a4d2[_0xb08b('0x15')][_0xb08b('0x16')]===0x1f4){logger[_0xb08b('0x15')](_0xb08b('0x17'),_0x4c3727,_0x53a4d2[_0xb08b('0x15')][_0xb08b('0x18')]);return _0x5b41f2(_0x53a4d2[_0xb08b('0x15')][_0xb08b('0x18')]);}logger[_0xb08b('0x15')](_0xb08b('0x17'),_0x4c3727,_0x53a4d2[_0xb08b('0x15')][_0xb08b('0x18')]);return _0x40b9cf(_0x53a4d2['error'][_0xb08b('0x18')]);}else{logger[_0xb08b('0x11')](_0xb08b('0x17'),_0x4c3727,'request\x20sent');_0x40b9cf(_0x53a4d2[_0xb08b('0x19')][_0xb08b('0x18')]);}})[_0xb08b('0x1a')](function(_0x2f3625){logger['error'](_0xb08b('0x17'),_0x4c3727,_0x2f3625);_0x5b41f2(_0x2f3625);});});} \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.socket.js b/server/api/chatInternalMessage/chatInternalMessage.socket.js index 03270f9..4e419f1 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 _0x98e0=['save','update','emit','removeListener','register','length','chatInternalMessage:'];(function(_0x38e17e,_0x1f5199){var _0x4bffbd=function(_0x18637e){while(--_0x18637e){_0x38e17e['push'](_0x38e17e['shift']());}};_0x4bffbd(++_0x1f5199);}(_0x98e0,0x18f));var _0x098e=function(_0x5c427d,_0x86a80d){_0x5c427d=_0x5c427d-0x0;var _0x4c9c0f=_0x98e0[_0x5c427d];return _0x4c9c0f;};'use strict';var ChatInternalMessageEvents=require('./chatInternalMessage.events');var events=[_0x098e('0x0'),'remove',_0x098e('0x1')];function createListener(_0xe4415b,_0x23c482){return function(_0x5c57c7){_0x23c482[_0x098e('0x2')](_0xe4415b,_0x5c57c7);};}function removeListener(_0x149242,_0x2654ec){return function(){ChatInternalMessageEvents[_0x098e('0x3')](_0x149242,_0x2654ec);};}exports[_0x098e('0x4')]=function(_0x26fa91){for(var _0x42f0dc=0x0,_0x3c92dc=events[_0x098e('0x5')];_0x42f0dc<_0x3c92dc;_0x42f0dc++){var _0x23798a=events[_0x42f0dc];var _0x377ba8=createListener(_0x098e('0x6')+_0x23798a,_0x26fa91);ChatInternalMessageEvents['on'](_0x23798a,_0x377ba8);}}; \ No newline at end of file +var _0xba00=['chatInternalMessage:','./chatInternalMessage.events','save','emit','removeListener','register','length'];(function(_0x22909b,_0x4a8a54){var _0x16b258=function(_0xd96eae){while(--_0xd96eae){_0x22909b['push'](_0x22909b['shift']());}};_0x16b258(++_0x4a8a54);}(_0xba00,0x1eb));var _0x0ba0=function(_0x58fda8,_0x247b57){_0x58fda8=_0x58fda8-0x0;var _0x3a9b61=_0xba00[_0x58fda8];return _0x3a9b61;};'use strict';var ChatInternalMessageEvents=require(_0x0ba0('0x0'));var events=[_0x0ba0('0x1'),'remove','update'];function createListener(_0x428bba,_0x2e32a2){return function(_0x597ed9){_0x2e32a2[_0x0ba0('0x2')](_0x428bba,_0x597ed9);};}function removeListener(_0x566090,_0x2378f4){return function(){ChatInternalMessageEvents[_0x0ba0('0x3')](_0x566090,_0x2378f4);};}exports[_0x0ba0('0x4')]=function(_0x4bffbc){for(var _0x4783a7=0x0,_0x425e2e=events[_0x0ba0('0x5')];_0x4783a7<_0x425e2e;_0x4783a7++){var _0x21e32e=events[_0x4783a7];var _0x4441f2=createListener(_0x0ba0('0x6')+_0x21e32e,_0x4bffbc);ChatInternalMessageEvents['on'](_0x21e32e,_0x4441f2);}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/index.js b/server/api/chatInternalMessage/index.js index c46360a..d6aceb2 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 _0x29c0=['fs-extra','../../components/auth/service','../../config/environment','./chatInternalMessage.controller','isAuthenticated','index','get','/describe','describe','/users','/:id','post','create','put','update','destroy','multer','util','path','connect-timeout','express','Router'];(function(_0x49c4de,_0xac4172){var _0xdcc4d3=function(_0x1193bc){while(--_0x1193bc){_0x49c4de['push'](_0x49c4de['shift']());}};_0xdcc4d3(++_0xac4172);}(_0x29c0,0x68));var _0x029c=function(_0x13e741,_0x5d3c24){_0x13e741=_0x13e741-0x0;var _0x3f8bb3=_0x29c0[_0x13e741];return _0x3f8bb3;};'use strict';var multer=require(_0x029c('0x0'));var util=require(_0x029c('0x1'));var path=require(_0x029c('0x2'));var timeout=require(_0x029c('0x3'));var express=require(_0x029c('0x4'));var router=express[_0x029c('0x5')]();var fs_extra=require(_0x029c('0x6'));var auth=require(_0x029c('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x029c('0x8'));var controller=require(_0x029c('0x9'));router['get']('/',auth[_0x029c('0xa')](),controller[_0x029c('0xb')]);router[_0x029c('0xc')](_0x029c('0xd'),auth[_0x029c('0xa')](),controller[_0x029c('0xe')]);router[_0x029c('0xc')](_0x029c('0xf'),auth[_0x029c('0xa')](),controller['getUsers']);router[_0x029c('0xc')](_0x029c('0x10'),auth[_0x029c('0xa')](),controller['show']);router[_0x029c('0x11')]('/',auth['isAuthenticated'](),controller[_0x029c('0x12')]);router[_0x029c('0x13')](_0x029c('0x10'),controller[_0x029c('0x14')]);router['delete'](_0x029c('0x10'),auth['isAuthenticated'](),controller[_0x029c('0x15')]);module['exports']=router; \ No newline at end of file +var _0x4cbe=['put','/:id','update','delete','destroy','exports','multer','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','describe','/users','post','create'];(function(_0x56d3a2,_0x5f191b){var _0x2c14d0=function(_0xb776e2){while(--_0xb776e2){_0x56d3a2['push'](_0x56d3a2['shift']());}};_0x2c14d0(++_0x5f191b);}(_0x4cbe,0x16e));var _0xe4cb=function(_0x5f22de,_0x4cd696){_0x5f22de=_0x5f22de-0x0;var _0x5c54a0=_0x4cbe[_0x5f22de];return _0x5c54a0;};'use strict';var multer=require(_0xe4cb('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0xe4cb('0x1'));var router=express[_0xe4cb('0x2')]();var fs_extra=require(_0xe4cb('0x3'));var auth=require(_0xe4cb('0x4'));var interaction=require(_0xe4cb('0x5'));var config=require(_0xe4cb('0x6'));var controller=require('./chatInternalMessage.controller');router[_0xe4cb('0x7')]('/',auth[_0xe4cb('0x8')](),controller[_0xe4cb('0x9')]);router[_0xe4cb('0x7')]('/describe',auth['isAuthenticated'](),controller[_0xe4cb('0xa')]);router[_0xe4cb('0x7')](_0xe4cb('0xb'),auth[_0xe4cb('0x8')](),controller['getUsers']);router[_0xe4cb('0x7')]('/:id',auth[_0xe4cb('0x8')](),controller['show']);router[_0xe4cb('0xc')]('/',auth['isAuthenticated'](),controller[_0xe4cb('0xd')]);router[_0xe4cb('0xe')](_0xe4cb('0xf'),controller[_0xe4cb('0x10')]);router[_0xe4cb('0x11')](_0xe4cb('0xf'),auth[_0xe4cb('0x8')](),controller[_0xe4cb('0x12')]);module[_0xe4cb('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 3e1a5b9..087563a 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 _0x5454=['out','DATE','STRING','medium'];(function(_0x59db19,_0x30c1c6){var _0x5f0f09=function(_0x36e225){while(--_0x36e225){_0x59db19['push'](_0x59db19['shift']());}};_0x5f0f09(++_0x30c1c6);}(_0x5454,0x15b));var _0x4545=function(_0x1341e4,_0x43f065){_0x1341e4=_0x1341e4-0x0;var _0x17cf1b=_0x5454[_0x1341e4];return _0x17cf1b;};'use strict';var Sequelize=require('sequelize');module['exports']={'body':{'type':Sequelize['TEXT'](_0x4545('0x0')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0x4545('0x1')),'defaultValue':_0x4545('0x1'),'allowNull':![]},'readAt':{'type':Sequelize[_0x4545('0x2')]},'providerName':{'type':Sequelize[_0x4545('0x3')]},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0x80ed=['BOOLEAN','ENUM','out','DATE','sequelize','TEXT','medium'];(function(_0x1d489f,_0x4afab7){var _0x1d7643=function(_0x18b771){while(--_0x18b771){_0x1d489f['push'](_0x1d489f['shift']());}};_0x1d7643(++_0x4afab7);}(_0x80ed,0x11c));var _0xd80e=function(_0x28271b,_0x418cf3){_0x28271b=_0x28271b-0x0;var _0x3593bd=_0x80ed[_0x28271b];return _0x3593bd;};'use strict';var Sequelize=require(_0xd80e('0x0'));module['exports']={'body':{'type':Sequelize[_0xd80e('0x1')](_0xd80e('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0xd80e('0x3')],'defaultValue':![]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0xd80e('0x4')]('in',_0xd80e('0x5')),'defaultValue':_0xd80e('0x5'),'allowNull':![]},'readAt':{'type':Sequelize[_0xd80e('0x6')]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0xd80e('0x1')]}}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.controller.js b/server/api/chatMessage/chatMessage.controller.js index fa45eea..f3575b4 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 _0x416e=['fullname','email','internal','interface','SIP/%s','channel','motionChannel','accept','EventManager','acceptmessage','parse','formData','chat-interactions','reject','agent','ChatInteraction','RejectMessage','rejectMessage','ContactId','event','rejectmessage','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','fs-extra','lodash','squel','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','redis','defaults','localhost','./chatMessage.socket','jayson/promise','client','http','request','then','ChatMessage,\x20%s,\x20%s','debug','error','code','message','request\x20sent','catch','status','json','undefined','count','offset','limit','set','Content-Range','apply','update','destroy','end','sendStatus','stack','name','send','index','map','rawAttributes','type','keys','filters','intersection','attributes','model','fields','query','hasOwnProperty','order','sort','pick','where','merge','VIRTUAL','filter','options','include','findAll','params','ChatMessage','includeAll','find','create','body','describe','chat','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','user','UserId','get','ChatInteractionId','read1stAt','interaction','[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','stringify','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','Sequelize','SELECT','contact','User'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x416e,0x98));var _0xe416=function(_0x123b1f,_0x4adc11){_0x123b1f=_0x123b1f-0x0;var _0x35abee=_0x416e[_0x123b1f];return _0x35abee;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xe416('0x0'));var jsonpatch=require(_0xe416('0x1'));var rp=require(_0xe416('0x2'));var moment=require(_0xe416('0x3'));var BPromise=require(_0xe416('0x4'));var Mustache=require(_0xe416('0x5'));var util=require(_0xe416('0x6'));var path=require('path');var sox=require(_0xe416('0x7'));var csv=require('to-csv');var ejs=require(_0xe416('0x8'));var fs=require('fs');var fs_extra=require(_0xe416('0x9'));var _=require(_0xe416('0xa'));var squel=require(_0xe416('0xb'));var crypto=require('crypto');var jsforce=require(_0xe416('0xc'));var deskjs=require(_0xe416('0xd'));var toCsv=require(_0xe416('0xe'));var querystring=require(_0xe416('0xf'));var Papa=require(_0xe416('0x10'));var Redis=require(_0xe416('0x11'));var authService=require(_0xe416('0x12'));var qs=require(_0xe416('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe416('0x14'));var logger=require(_0xe416('0x15'))(_0xe416('0x16'));var utils=require(_0xe416('0x17'));var config=require(_0xe416('0x18'));var licenseUtil=require(_0xe416('0x19'));var db=require('../../mysqldb')['db'];config[_0xe416('0x1a')]=_[_0xe416('0x1b')](config[_0xe416('0x1a')],{'host':_0xe416('0x1c'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xe416('0x1a')]));require(_0xe416('0x1d'))['register'](socket);var jayson=require(_0xe416('0x1e'));var client=jayson[_0xe416('0x1f')]['http']({'port':0x232c});var client9002=jayson['client'][_0xe416('0x20')]({'port':0x232a});function respondWithRpcPromise(_0x1fe9e5,_0xbedc93,_0xd7e574,_0x5b6ee9){return new BPromise(function(_0x100434,_0x5d1cb4){var _0x3b173a=_0x5b6ee9||client;return _0x3b173a[_0xe416('0x21')](_0x1fe9e5,_0xd7e574)[_0xe416('0x22')](function(_0x596434){logger['info'](_0xe416('0x23'),_0xbedc93,'request\x20sent');logger[_0xe416('0x24')]('ChatMessage,\x20%s,\x20%s,\x20%s',_0xbedc93,'request\x20sent',JSON['stringify'](_0x596434));if(_0x596434[_0xe416('0x25')]){if(_0x596434[_0xe416('0x25')][_0xe416('0x26')]===0x1f4){logger['error']('ChatMessage,\x20%s,\x20%s',_0xbedc93,_0x596434['error'][_0xe416('0x27')]);return _0x5d1cb4(_0x596434[_0xe416('0x25')][_0xe416('0x27')]);}logger[_0xe416('0x25')](_0xe416('0x23'),_0xbedc93,_0x596434[_0xe416('0x25')][_0xe416('0x27')]);return _0x100434(_0x596434[_0xe416('0x25')][_0xe416('0x27')]);}else{logger['info']('ChatMessage,\x20%s,\x20%s',_0xbedc93,_0xe416('0x28'));_0x100434(_0x596434['result'][_0xe416('0x27')]);}})[_0xe416('0x29')](function(_0x346350){logger['error'](_0xe416('0x23'),_0xbedc93,_0x346350);_0x5d1cb4(_0x346350);});});}function respondWithStatusCode(_0x550a0c,_0x5e2876){_0x5e2876=_0x5e2876||0xcc;return function(_0x8f4ecb){if(_0x8f4ecb){return _0x550a0c['sendStatus'](_0x5e2876);}return _0x550a0c[_0xe416('0x2a')](_0x5e2876)['end']();};}function respondWithResult(_0x277577,_0x440471){_0x440471=_0x440471||0xc8;return function(_0x24cc03){if(_0x24cc03){return _0x277577[_0xe416('0x2a')](_0x440471)[_0xe416('0x2b')](_0x24cc03);}};}function respondWithFilteredResult(_0x5c128d,_0x5e4452){return function(_0x3387c5){if(_0x3387c5){var _0x28dea8=typeof _0x5e4452['offset']===_0xe416('0x2c')&&typeof _0x5e4452['limit']===_0xe416('0x2c');var _0x1901bf=_0x3387c5[_0xe416('0x2d')];var _0x1a8706=_0x28dea8?0x0:_0x5e4452['offset'];var _0x464a2f=_0x28dea8?_0x3387c5[_0xe416('0x2d')]:_0x5e4452[_0xe416('0x2e')]+_0x5e4452[_0xe416('0x2f')];var _0xa2415d;if(_0x464a2f>=_0x1901bf){_0x464a2f=_0x1901bf;_0xa2415d=0xc8;}else{_0xa2415d=0xce;}_0x5c128d[_0xe416('0x2a')](_0xa2415d);return _0x5c128d[_0xe416('0x30')](_0xe416('0x31'),_0x1a8706+'-'+_0x464a2f+'/'+_0x1901bf)[_0xe416('0x2b')](_0x3387c5);}return null;};}function patchUpdates(_0x597c7a){return function(_0x2e01b7){try{jsonpatch[_0xe416('0x32')](_0x2e01b7,_0x597c7a,!![]);}catch(_0x4de1fa){return BPromise['reject'](_0x4de1fa);}return _0x2e01b7['save']();};}function saveUpdates(_0x14ae71,_0x35a5e2){return function(_0x1d1760){if(_0x1d1760){return _0x1d1760[_0xe416('0x33')](_0x14ae71)['then'](function(_0x26fdfd){return _0x26fdfd;});}return null;};}function removeEntity(_0x3512a2,_0x235ca7){return function(_0x1c712f){if(_0x1c712f){return _0x1c712f[_0xe416('0x34')]()[_0xe416('0x22')](function(){_0x3512a2[_0xe416('0x2a')](0xcc)[_0xe416('0x35')]();});}};}function handleEntityNotFound(_0x389dd1,_0x162ff1){return function(_0x1eaf47){if(!_0x1eaf47){_0x389dd1[_0xe416('0x36')](0x194);}return _0x1eaf47;};}function handleError(_0x3749e1,_0x20080e){_0x20080e=_0x20080e||0x1f4;return function(_0x840621){logger[_0xe416('0x25')](_0x840621[_0xe416('0x37')]);if(_0x840621[_0xe416('0x38')]){delete _0x840621['name'];}_0x3749e1[_0xe416('0x2a')](_0x20080e)[_0xe416('0x39')](_0x840621);};}exports[_0xe416('0x3a')]=function(_0x4e7e4e,_0x35c893){var _0x484a37={},_0x32b197={},_0x41447d={'count':0x0,'rows':[]};var _0x1255c3=_[_0xe416('0x3b')](db['ChatMessage'][_0xe416('0x3c')],function(_0x255ef6){return{'name':_0x255ef6['fieldName'],'type':_0x255ef6[_0xe416('0x3d')]['key']};});_0x32b197['model']=_[_0xe416('0x3b')](_0x1255c3,'name');_0x32b197['query']=_[_0xe416('0x3e')](_0x4e7e4e['query']);_0x32b197[_0xe416('0x3f')]=_[_0xe416('0x40')](_0x32b197['model'],_0x32b197['query']);_0x484a37[_0xe416('0x41')]=_[_0xe416('0x40')](_0x32b197[_0xe416('0x42')],qs[_0xe416('0x43')](_0x4e7e4e[_0xe416('0x44')][_0xe416('0x43')]));_0x484a37[_0xe416('0x41')]=_0x484a37[_0xe416('0x41')]['length']?_0x484a37[_0xe416('0x41')]:_0x32b197[_0xe416('0x42')];if(!_0x4e7e4e['query'][_0xe416('0x45')]('nolimit')){_0x484a37[_0xe416('0x2f')]=qs['limit'](_0x4e7e4e['query'][_0xe416('0x2f')]);_0x484a37[_0xe416('0x2e')]=qs[_0xe416('0x2e')](_0x4e7e4e[_0xe416('0x44')][_0xe416('0x2e')]);}_0x484a37[_0xe416('0x46')]=qs[_0xe416('0x47')](_0x4e7e4e[_0xe416('0x44')]['sort']);_0x484a37['where']=qs[_0xe416('0x3f')](_[_0xe416('0x48')](_0x4e7e4e[_0xe416('0x44')],_0x32b197['filters']),_0x1255c3);if(_0x4e7e4e[_0xe416('0x44')]['filter']){_0x484a37[_0xe416('0x49')]=_[_0xe416('0x4a')](_0x484a37['where'],{'$or':_[_0xe416('0x3b')](_0x1255c3,function(_0x2622c7){if(_0x2622c7[_0xe416('0x3d')]!==_0xe416('0x4b')){var _0x289558={};_0x289558[_0x2622c7['name']]={'$like':'%'+_0x4e7e4e['query'][_0xe416('0x4c')]+'%'};return _0x289558;}})});}_0x484a37=_[_0xe416('0x4a')]({},_0x484a37,_0x4e7e4e[_0xe416('0x4d')]);var _0x5dc94a={'where':_0x484a37[_0xe416('0x49')]};return db['ChatMessage'][_0xe416('0x2d')](_0x5dc94a)[_0xe416('0x22')](function(_0xebd744){_0x41447d['count']=_0xebd744;if(_0x4e7e4e[_0xe416('0x44')]['includeAll']){_0x484a37[_0xe416('0x4e')]=[{'all':!![]}];}return db['ChatMessage'][_0xe416('0x4f')](_0x484a37);})[_0xe416('0x22')](function(_0x1a8250){_0x41447d['rows']=_0x1a8250;return _0x41447d;})[_0xe416('0x22')](respondWithFilteredResult(_0x35c893,_0x484a37))[_0xe416('0x29')](handleError(_0x35c893,null));};exports['show']=function(_0x4f3b7d,_0x50352f){var _0x17b4df={'raw':!![],'where':{'id':_0x4f3b7d[_0xe416('0x50')]['id']}},_0x430f59={};_0x430f59['model']=_[_0xe416('0x3e')](db[_0xe416('0x51')][_0xe416('0x3c')]);_0x430f59[_0xe416('0x44')]=_['keys'](_0x4f3b7d[_0xe416('0x44')]);_0x430f59[_0xe416('0x3f')]=_[_0xe416('0x40')](_0x430f59[_0xe416('0x42')],_0x430f59[_0xe416('0x44')]);_0x17b4df[_0xe416('0x41')]=_[_0xe416('0x40')](_0x430f59[_0xe416('0x42')],qs[_0xe416('0x43')](_0x4f3b7d['query'][_0xe416('0x43')]));_0x17b4df[_0xe416('0x41')]=_0x17b4df[_0xe416('0x41')]['length']?_0x17b4df['attributes']:_0x430f59[_0xe416('0x42')];if(_0x4f3b7d[_0xe416('0x44')][_0xe416('0x52')]){_0x17b4df[_0xe416('0x4e')]=[{'all':!![]}];}_0x17b4df=_[_0xe416('0x4a')]({},_0x17b4df,_0x4f3b7d[_0xe416('0x4d')]);return db[_0xe416('0x51')][_0xe416('0x53')](_0x17b4df)[_0xe416('0x22')](handleEntityNotFound(_0x50352f,null))[_0xe416('0x22')](respondWithResult(_0x50352f,null))['catch'](handleError(_0x50352f,null));};exports[_0xe416('0x54')]=function(_0x2bc36a,_0x1c9978){return db[_0xe416('0x51')][_0xe416('0x54')](_0x2bc36a[_0xe416('0x55')],{})['then'](respondWithResult(_0x1c9978,0xc9))['catch'](handleError(_0x1c9978,null));};exports[_0xe416('0x33')]=function(_0x5d5e28,_0x2a7d2d){if(_0x5d5e28[_0xe416('0x55')]['id']){delete _0x5d5e28[_0xe416('0x55')]['id'];}return db[_0xe416('0x51')][_0xe416('0x53')]({'where':{'id':_0x5d5e28['params']['id']}})[_0xe416('0x22')](handleEntityNotFound(_0x2a7d2d,null))[_0xe416('0x22')](saveUpdates(_0x5d5e28[_0xe416('0x55')],null))[_0xe416('0x22')](respondWithResult(_0x2a7d2d,null))[_0xe416('0x29')](handleError(_0x2a7d2d,null));};exports[_0xe416('0x34')]=function(_0x2502cb,_0x4c2423){return db[_0xe416('0x51')][_0xe416('0x53')]({'where':{'id':_0x2502cb[_0xe416('0x50')]['id']}})[_0xe416('0x22')](handleEntityNotFound(_0x4c2423,null))[_0xe416('0x22')](removeEntity(_0x4c2423,null))['catch'](handleError(_0x4c2423,null));};exports['describe']=function(_0x514e56,_0x39cb38){return db['ChatMessage'][_0xe416('0x56')]()[_0xe416('0x22')](respondWithResult(_0x39cb38,null))[_0xe416('0x29')](handleError(_0x39cb38,null));};var interaction_log=require('../../config/logger')('chat-interactions');exports['accept']=function(_0x42fea1,_0x2f8969,_0x43a92f){var _0x252c0f={'agent':{},'channel':_0xe416('0x57')};if(_0x42fea1[_0xe416('0x55')]['id']){delete _0x42fea1[_0xe416('0x55')]['id'];}_0x42fea1['body'][_0xe416('0x58')]=!![];_0x42fea1[_0xe416('0x55')][_0xe416('0x59')]=moment()[_0xe416('0x5a')](_0xe416('0x5b'));_0x42fea1[_0xe416('0x55')]['UserId']=_0x42fea1[_0xe416('0x55')]['UserId']||_0x42fea1[_0xe416('0x5c')]['id'];_0x252c0f['agent']['id']=_0x42fea1['body'][_0xe416('0x5d')];return db[_0xe416('0x51')][_0xe416('0x53')]({'where':{'id':_0x42fea1[_0xe416('0x50')]['id'],'UserId':null}})[_0xe416('0x22')](handleEntityNotFound(_0x2f8969,null))[_0xe416('0x22')](saveUpdates(_0x42fea1['body'],null))[_0xe416('0x22')](function(_0x20a6f9){if(_0x20a6f9){_0x252c0f[_0xe416('0x27')]=_0x20a6f9[_0xe416('0x5e')]({'plain':!![]});return db['ChatInteraction'][_0xe416('0x53')]({'where':{'id':_0x20a6f9[_0xe416('0x5f')]}});}return null;})['then'](handleEntityNotFound(_0x2f8969,null))[_0xe416('0x22')](function(_0x225a74){if(_0x225a74){return _0x225a74[_0xe416('0x33')]({'UserId':_0x42fea1[_0xe416('0x55')][_0xe416('0x5d')],'read1stAt':_['isNil'](_0x225a74[_0xe416('0x60')])?moment()[_0xe416('0x5a')](_0xe416('0x5b')):undefined});}return null;})[_0xe416('0x22')](function(_0x44c995){if(_0x44c995){_0x252c0f[_0xe416('0x61')]=_0x44c995[_0xe416('0x5e')]({'plain':!![]});interaction_log['info'](_0xe416('0x62'),_0x42fea1[_0xe416('0x5c')]['id'],_0x42fea1[_0xe416('0x5c')][_0xe416('0x38')],_0x42fea1['user'][_0xe416('0x63')],_0x252c0f['interaction']['id'],_0x42fea1[_0xe416('0x55')]?JSON[_0xe416('0x64')](_0x42fea1['body']):_0xe416('0x65'));return respondWithRpcPromise(_0xe416('0x66'),_0xe416('0x67'),_0x252c0f);}return null;})['then'](function(_0x4b599f){var _0x3280d6=_0xe416('0x68')+_0x4b599f['message']['ContactId'];return db[_0xe416('0x69')][_0xe416('0x44')](_0x3280d6,{'type':db[_0xe416('0x6a')]['QueryTypes'][_0xe416('0x6b')],'raw':!![]})[_0xe416('0x22')](function(_0x335fbe){return _0x335fbe;});})[_0xe416('0x22')](function(_0xf75465){if(_0xf75465){_0x252c0f[_0xe416('0x27')][_0xe416('0x6c')]=_0xf75465[0x0];if(!_0x42fea1[_0xe416('0x55')]['UserId'])return;return db[_0xe416('0x6d')][_0xe416('0x53')]({'where':{'id':_0x42fea1[_0xe416('0x55')]['UserId'],'role':'agent'},'attributes':['id',_0xe416('0x38'),_0xe416('0x6e'),_0xe416('0x6f'),_0xe416('0x70')],'raw':!![]});}return null;})['then'](function(_0x49a5d9){if(!_0x49a5d9)return null;_0x252c0f[_0xe416('0x27')]['agent']=_0x49a5d9;return _0x252c0f;})['then'](function(_0x2132d0){if(_0x2132d0){if(_0x42fea1[_0xe416('0x55')]['manual']){_0x252c0f['message'][_0xe416('0x71')]=util[_0xe416('0x5a')](_0xe416('0x72'),_0x42fea1[_0xe416('0x5c')]['name']);_0x252c0f[_0xe416('0x27')][_0xe416('0x73')]=_0x252c0f[_0xe416('0x73')];_0x252c0f[_0xe416('0x27')][_0xe416('0x74')]=_0x252c0f[_0xe416('0x73')];_0x252c0f[_0xe416('0x27')]['event']=_0xe416('0x75');return respondWithRpcPromise(_0xe416('0x76'),_0xe416('0x76'),{'event':_0xe416('0x77'),'message':_['merge'](_0x252c0f[_0xe416('0x27')],JSON[_0xe416('0x78')](_0x252c0f[_0xe416('0x61')][_0xe416('0x79')]))},client9002)[_0xe416('0x22')](function(){return _0x252c0f;});}return _0x252c0f;}return null;})[_0xe416('0x22')](respondWithResult(_0x2f8969,null))[_0xe416('0x29')](handleError(_0x2f8969,null));};var interaction_log=require(_0xe416('0x15'))(_0xe416('0x7a'));exports[_0xe416('0x7b')]=function(_0xd985f2,_0x2b32ac,_0x2166e1){var _0x31f982={'agent':{},'channel':_0xe416('0x57')};if(_0xd985f2[_0xe416('0x55')]['id']){delete _0xd985f2['body']['id'];}_0xd985f2[_0xe416('0x55')][_0xe416('0x5d')]=_0xd985f2[_0xe416('0x55')][_0xe416('0x5d')]||_0xd985f2['user']['id'];_0x31f982[_0xe416('0x7c')]['id']=_0xd985f2[_0xe416('0x55')]['UserId'];return db[_0xe416('0x51')][_0xe416('0x53')]({'where':{'id':_0xd985f2[_0xe416('0x50')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x2b32ac,null))[_0xe416('0x22')](function(_0x3b8dd9){if(_0x3b8dd9){_0x31f982[_0xe416('0x27')]=_0x3b8dd9[_0xe416('0x5e')]({'plain':!![]});return db[_0xe416('0x7d')]['find']({'where':{'id':_0x3b8dd9[_0xe416('0x5f')]}});}return null;})['then'](handleEntityNotFound(_0x2b32ac,null))[_0xe416('0x22')](function(_0x4cc75d){if(_0x4cc75d){_0x31f982['interaction']=_0x4cc75d['get']({'plain':!![]});interaction_log['info']('[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0xd985f2[_0xe416('0x5c')]['id'],_0xd985f2[_0xe416('0x5c')][_0xe416('0x38')],_0xd985f2['user'][_0xe416('0x63')],_0x31f982[_0xe416('0x61')]['id'],_0xd985f2['body']?JSON[_0xe416('0x64')](_0xd985f2[_0xe416('0x55')]):_0xe416('0x65'));return respondWithRpcPromise(_0xe416('0x7e'),_0xe416('0x7f'),_0x31f982);}return null;})['then'](function(_0x455035){var _0x265458='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x455035[_0xe416('0x27')][_0xe416('0x80')];return db[_0xe416('0x69')][_0xe416('0x44')](_0x265458,{'type':db[_0xe416('0x6a')]['QueryTypes'][_0xe416('0x6b')],'raw':!![]})['then'](function(_0x431f8c){return _0x431f8c;});})[_0xe416('0x22')](function(_0x6f8282){if(_0x6f8282){_0x31f982[_0xe416('0x27')][_0xe416('0x6c')]=_0x6f8282[0x0];if(!_0xd985f2[_0xe416('0x55')][_0xe416('0x5d')])return;return db['User'][_0xe416('0x53')]({'where':{'id':_0xd985f2[_0xe416('0x55')][_0xe416('0x5d')],'role':_0xe416('0x7c')},'attributes':['id',_0xe416('0x38'),'fullname','email','internal'],'raw':!![]});}return null;})[_0xe416('0x22')](function(_0xffb196){if(!_0xffb196)return null;_0x31f982[_0xe416('0x27')][_0xe416('0x7c')]=_0xffb196;return _0x31f982;})['then'](function(_0x5d1ecd){if(_0x5d1ecd){_0x5d1ecd[_0xe416('0x27')][_0xe416('0x71')]=util[_0xe416('0x5a')](_0xe416('0x72'),_0xd985f2[_0xe416('0x5c')]['name']);_0x5d1ecd[_0xe416('0x27')][_0xe416('0x73')]=_0x31f982[_0xe416('0x73')];_0x5d1ecd[_0xe416('0x27')][_0xe416('0x74')]=_0x31f982[_0xe416('0x73')];_0x5d1ecd[_0xe416('0x27')][_0xe416('0x81')]=_0xe416('0x7b');respondWithRpcPromise(_0xe416('0x76'),_0xe416('0x76'),{'event':_0xe416('0x82'),'message':_[_0xe416('0x4a')](_0x31f982[_0xe416('0x27')],JSON[_0xe416('0x78')](_0x31f982['interaction'][_0xe416('0x79')]))},client9002);return _0x31f982;}return null;})[_0xe416('0x22')](respondWithResult(_0x2b32ac,null))[_0xe416('0x29')](handleError(_0x2b32ac,null));}; \ No newline at end of file +var _0x7c0f=['index','ChatMessage','rawAttributes','fieldName','type','model','map','keys','query','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','catch','params','filters','find','create','body','describe','../../config/logger','accept','chat','read','readAt','format','UserId','user','agent','get','ChatInteractionId','isNil','YYYY-MM-DD\x20HH:mm:ss','[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','interaction','null','AcceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','SELECT','contact','User','internal','manual','interface','SIP/%s','channel','motionChannel','event','EventManager','acceptmessage','parse','chat-interactions','ChatInteraction','[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','fullname','email','rejectmessage','formData','rimraf','zip-dir','fast-json-patch','moment','mustache','util','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','socket.io-emitter','jayson/promise','client','http','request','info','ChatMessage,\x20%s,\x20%s','request\x20sent','error','code','message','result','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','name','send'];(function(_0x111bab,_0x271498){var _0x5999fa=function(_0x9512f4){while(--_0x9512f4){_0x111bab['push'](_0x111bab['shift']());}};_0x5999fa(++_0x271498);}(_0x7c0f,0x1d3));var _0xf7c0=function(_0x1fb86c,_0x1889de){_0x1fb86c=_0x1fb86c-0x0;var _0x43e97f=_0x7c0f[_0x1fb86c];return _0x43e97f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf7c0('0x0'));var zipdir=require(_0xf7c0('0x1'));var jsonpatch=require(_0xf7c0('0x2'));var rp=require('request-promise');var moment=require(_0xf7c0('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xf7c0('0x4'));var util=require(_0xf7c0('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0xf7c0('0x6'));var ejs=require(_0xf7c0('0x7'));var fs=require('fs');var fs_extra=require(_0xf7c0('0x8'));var _=require('lodash');var squel=require(_0xf7c0('0x9'));var crypto=require(_0xf7c0('0xa'));var jsforce=require(_0xf7c0('0xb'));var deskjs=require(_0xf7c0('0xc'));var toCsv=require(_0xf7c0('0x6'));var querystring=require(_0xf7c0('0xd'));var Papa=require(_0xf7c0('0xe'));var Redis=require(_0xf7c0('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xf7c0('0x10'));var hardwareService=require(_0xf7c0('0x11'));var logger=require('../../config/logger')(_0xf7c0('0x12'));var utils=require(_0xf7c0('0x13'));var config=require(_0xf7c0('0x14'));var licenseUtil=require(_0xf7c0('0x15'));var db=require('../../mysqldb')['db'];config[_0xf7c0('0x16')]=_[_0xf7c0('0x17')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xf7c0('0x18'))(new Redis(config[_0xf7c0('0x16')]));require('./chatMessage.socket')['register'](socket);var jayson=require(_0xf7c0('0x19'));var client=jayson[_0xf7c0('0x1a')][_0xf7c0('0x1b')]({'port':0x232c});var client9002=jayson[_0xf7c0('0x1a')]['http']({'port':0x232a});function respondWithRpcPromise(_0x34c681,_0x2f4577,_0x5c0c7b,_0x5e052b){return new BPromise(function(_0x10ff1e,_0x113555){var _0x45b790=_0x5e052b||client;return _0x45b790[_0xf7c0('0x1c')](_0x34c681,_0x5c0c7b)['then'](function(_0x1f8a45){logger[_0xf7c0('0x1d')](_0xf7c0('0x1e'),_0x2f4577,_0xf7c0('0x1f'));logger['debug']('ChatMessage,\x20%s,\x20%s,\x20%s',_0x2f4577,_0xf7c0('0x1f'),JSON['stringify'](_0x1f8a45));if(_0x1f8a45['error']){if(_0x1f8a45[_0xf7c0('0x20')][_0xf7c0('0x21')]===0x1f4){logger['error'](_0xf7c0('0x1e'),_0x2f4577,_0x1f8a45[_0xf7c0('0x20')][_0xf7c0('0x22')]);return _0x113555(_0x1f8a45[_0xf7c0('0x20')]['message']);}logger[_0xf7c0('0x20')](_0xf7c0('0x1e'),_0x2f4577,_0x1f8a45['error'][_0xf7c0('0x22')]);return _0x10ff1e(_0x1f8a45['error'][_0xf7c0('0x22')]);}else{logger[_0xf7c0('0x1d')](_0xf7c0('0x1e'),_0x2f4577,_0xf7c0('0x1f'));_0x10ff1e(_0x1f8a45[_0xf7c0('0x23')][_0xf7c0('0x22')]);}})['catch'](function(_0x32b8fe){logger[_0xf7c0('0x20')]('ChatMessage,\x20%s,\x20%s',_0x2f4577,_0x32b8fe);_0x113555(_0x32b8fe);});});}function respondWithStatusCode(_0xb9eb96,_0x56787c){_0x56787c=_0x56787c||0xcc;return function(_0xb460e5){if(_0xb460e5){return _0xb9eb96[_0xf7c0('0x24')](_0x56787c);}return _0xb9eb96[_0xf7c0('0x25')](_0x56787c)[_0xf7c0('0x26')]();};}function respondWithResult(_0x7099d9,_0x33d56c){_0x33d56c=_0x33d56c||0xc8;return function(_0x27ba6f){if(_0x27ba6f){return _0x7099d9['status'](_0x33d56c)[_0xf7c0('0x27')](_0x27ba6f);}};}function respondWithFilteredResult(_0x181422,_0x573eea){return function(_0x18e392){if(_0x18e392){var _0x3bf426=typeof _0x573eea[_0xf7c0('0x28')]===_0xf7c0('0x29')&&typeof _0x573eea[_0xf7c0('0x2a')]===_0xf7c0('0x29');var _0x48ade2=_0x18e392['count'];var _0x5388b7=_0x3bf426?0x0:_0x573eea[_0xf7c0('0x28')];var _0x237ec7=_0x3bf426?_0x18e392[_0xf7c0('0x2b')]:_0x573eea[_0xf7c0('0x28')]+_0x573eea['limit'];var _0x593ff6;if(_0x237ec7>=_0x48ade2){_0x237ec7=_0x48ade2;_0x593ff6=0xc8;}else{_0x593ff6=0xce;}_0x181422[_0xf7c0('0x25')](_0x593ff6);return _0x181422[_0xf7c0('0x2c')]('Content-Range',_0x5388b7+'-'+_0x237ec7+'/'+_0x48ade2)['json'](_0x18e392);}return null;};}function patchUpdates(_0xd4bcc7){return function(_0x4be604){try{jsonpatch[_0xf7c0('0x2d')](_0x4be604,_0xd4bcc7,!![]);}catch(_0x2ccb7b){return BPromise[_0xf7c0('0x2e')](_0x2ccb7b);}return _0x4be604[_0xf7c0('0x2f')]();};}function saveUpdates(_0x29c641,_0x4fabf1){return function(_0x2b8864){if(_0x2b8864){return _0x2b8864[_0xf7c0('0x30')](_0x29c641)[_0xf7c0('0x31')](function(_0x62a976){return _0x62a976;});}return null;};}function removeEntity(_0x35f014,_0xd97313){return function(_0x3406d3){if(_0x3406d3){return _0x3406d3[_0xf7c0('0x32')]()['then'](function(){_0x35f014[_0xf7c0('0x25')](0xcc)[_0xf7c0('0x26')]();});}};}function handleEntityNotFound(_0x385e9d,_0x2ea24a){return function(_0x4cd118){if(!_0x4cd118){_0x385e9d[_0xf7c0('0x24')](0x194);}return _0x4cd118;};}function handleError(_0x518b63,_0x134ff1){_0x134ff1=_0x134ff1||0x1f4;return function(_0x4496ab){logger['error'](_0x4496ab['stack']);if(_0x4496ab[_0xf7c0('0x33')]){delete _0x4496ab['name'];}_0x518b63['status'](_0x134ff1)[_0xf7c0('0x34')](_0x4496ab);};}exports[_0xf7c0('0x35')]=function(_0x468a3d,_0x349918){var _0x420865={},_0x166cdc={},_0x2c049a={'count':0x0,'rows':[]};var _0x5e64f1=_['map'](db[_0xf7c0('0x36')][_0xf7c0('0x37')],function(_0x3b1f7c){return{'name':_0x3b1f7c[_0xf7c0('0x38')],'type':_0x3b1f7c[_0xf7c0('0x39')]['key']};});_0x166cdc[_0xf7c0('0x3a')]=_[_0xf7c0('0x3b')](_0x5e64f1,'name');_0x166cdc['query']=_[_0xf7c0('0x3c')](_0x468a3d[_0xf7c0('0x3d')]);_0x166cdc['filters']=_[_0xf7c0('0x3e')](_0x166cdc[_0xf7c0('0x3a')],_0x166cdc['query']);_0x420865[_0xf7c0('0x3f')]=_[_0xf7c0('0x3e')](_0x166cdc[_0xf7c0('0x3a')],qs[_0xf7c0('0x40')](_0x468a3d[_0xf7c0('0x3d')]['fields']));_0x420865[_0xf7c0('0x3f')]=_0x420865[_0xf7c0('0x3f')][_0xf7c0('0x41')]?_0x420865[_0xf7c0('0x3f')]:_0x166cdc[_0xf7c0('0x3a')];if(!_0x468a3d[_0xf7c0('0x3d')][_0xf7c0('0x42')]('nolimit')){_0x420865[_0xf7c0('0x2a')]=qs[_0xf7c0('0x2a')](_0x468a3d[_0xf7c0('0x3d')][_0xf7c0('0x2a')]);_0x420865[_0xf7c0('0x28')]=qs[_0xf7c0('0x28')](_0x468a3d['query']['offset']);}_0x420865[_0xf7c0('0x43')]=qs[_0xf7c0('0x44')](_0x468a3d[_0xf7c0('0x3d')][_0xf7c0('0x44')]);_0x420865[_0xf7c0('0x45')]=qs['filters'](_[_0xf7c0('0x46')](_0x468a3d[_0xf7c0('0x3d')],_0x166cdc['filters']),_0x5e64f1);if(_0x468a3d[_0xf7c0('0x3d')][_0xf7c0('0x47')]){_0x420865[_0xf7c0('0x45')]=_[_0xf7c0('0x48')](_0x420865[_0xf7c0('0x45')],{'$or':_['map'](_0x5e64f1,function(_0xa1d2f7){if(_0xa1d2f7[_0xf7c0('0x39')]!==_0xf7c0('0x49')){var _0x2db270={};_0x2db270[_0xa1d2f7['name']]={'$like':'%'+_0x468a3d[_0xf7c0('0x3d')][_0xf7c0('0x47')]+'%'};return _0x2db270;}})});}_0x420865=_[_0xf7c0('0x48')]({},_0x420865,_0x468a3d[_0xf7c0('0x4a')]);var _0x2cbdd0={'where':_0x420865[_0xf7c0('0x45')]};return db['ChatMessage'][_0xf7c0('0x2b')](_0x2cbdd0)[_0xf7c0('0x31')](function(_0x159447){_0x2c049a['count']=_0x159447;if(_0x468a3d['query']['includeAll']){_0x420865[_0xf7c0('0x4b')]=[{'all':!![]}];}return db[_0xf7c0('0x36')][_0xf7c0('0x4c')](_0x420865);})[_0xf7c0('0x31')](function(_0x5d08bf){_0x2c049a[_0xf7c0('0x4d')]=_0x5d08bf;return _0x2c049a;})[_0xf7c0('0x31')](respondWithFilteredResult(_0x349918,_0x420865))[_0xf7c0('0x4e')](handleError(_0x349918,null));};exports['show']=function(_0xb918de,_0x1fd66f){var _0x27860b={'raw':!![],'where':{'id':_0xb918de[_0xf7c0('0x4f')]['id']}},_0x52a124={};_0x52a124['model']=_[_0xf7c0('0x3c')](db[_0xf7c0('0x36')]['rawAttributes']);_0x52a124['query']=_[_0xf7c0('0x3c')](_0xb918de[_0xf7c0('0x3d')]);_0x52a124[_0xf7c0('0x50')]=_[_0xf7c0('0x3e')](_0x52a124[_0xf7c0('0x3a')],_0x52a124[_0xf7c0('0x3d')]);_0x27860b[_0xf7c0('0x3f')]=_[_0xf7c0('0x3e')](_0x52a124['model'],qs['fields'](_0xb918de[_0xf7c0('0x3d')]['fields']));_0x27860b[_0xf7c0('0x3f')]=_0x27860b[_0xf7c0('0x3f')][_0xf7c0('0x41')]?_0x27860b[_0xf7c0('0x3f')]:_0x52a124['model'];if(_0xb918de[_0xf7c0('0x3d')]['includeAll']){_0x27860b[_0xf7c0('0x4b')]=[{'all':!![]}];}_0x27860b=_['merge']({},_0x27860b,_0xb918de[_0xf7c0('0x4a')]);return db['ChatMessage'][_0xf7c0('0x51')](_0x27860b)[_0xf7c0('0x31')](handleEntityNotFound(_0x1fd66f,null))[_0xf7c0('0x31')](respondWithResult(_0x1fd66f,null))[_0xf7c0('0x4e')](handleError(_0x1fd66f,null));};exports[_0xf7c0('0x52')]=function(_0x59e018,_0x3da340){return db[_0xf7c0('0x36')]['create'](_0x59e018[_0xf7c0('0x53')],{})[_0xf7c0('0x31')](respondWithResult(_0x3da340,0xc9))[_0xf7c0('0x4e')](handleError(_0x3da340,null));};exports[_0xf7c0('0x30')]=function(_0x411164,_0x2d46da){if(_0x411164[_0xf7c0('0x53')]['id']){delete _0x411164[_0xf7c0('0x53')]['id'];}return db['ChatMessage'][_0xf7c0('0x51')]({'where':{'id':_0x411164['params']['id']}})['then'](handleEntityNotFound(_0x2d46da,null))[_0xf7c0('0x31')](saveUpdates(_0x411164[_0xf7c0('0x53')],null))['then'](respondWithResult(_0x2d46da,null))[_0xf7c0('0x4e')](handleError(_0x2d46da,null));};exports[_0xf7c0('0x32')]=function(_0x43237d,_0x216666){return db[_0xf7c0('0x36')][_0xf7c0('0x51')]({'where':{'id':_0x43237d[_0xf7c0('0x4f')]['id']}})[_0xf7c0('0x31')](handleEntityNotFound(_0x216666,null))[_0xf7c0('0x31')](removeEntity(_0x216666,null))[_0xf7c0('0x4e')](handleError(_0x216666,null));};exports[_0xf7c0('0x54')]=function(_0x23dfa0,_0x41c0aa){return db['ChatMessage'][_0xf7c0('0x54')]()[_0xf7c0('0x31')](respondWithResult(_0x41c0aa,null))[_0xf7c0('0x4e')](handleError(_0x41c0aa,null));};var interaction_log=require(_0xf7c0('0x55'))('chat-interactions');exports[_0xf7c0('0x56')]=function(_0x5c8735,_0x928707,_0x159bcc){var _0x598805={'agent':{},'channel':_0xf7c0('0x57')};if(_0x5c8735['body']['id']){delete _0x5c8735[_0xf7c0('0x53')]['id'];}_0x5c8735['body'][_0xf7c0('0x58')]=!![];_0x5c8735['body'][_0xf7c0('0x59')]=moment()[_0xf7c0('0x5a')]('YYYY-MM-DD\x20HH:mm:ss');_0x5c8735['body'][_0xf7c0('0x5b')]=_0x5c8735[_0xf7c0('0x53')][_0xf7c0('0x5b')]||_0x5c8735[_0xf7c0('0x5c')]['id'];_0x598805[_0xf7c0('0x5d')]['id']=_0x5c8735['body'][_0xf7c0('0x5b')];return db[_0xf7c0('0x36')][_0xf7c0('0x51')]({'where':{'id':_0x5c8735['params']['id'],'UserId':null}})[_0xf7c0('0x31')](handleEntityNotFound(_0x928707,null))[_0xf7c0('0x31')](saveUpdates(_0x5c8735['body'],null))[_0xf7c0('0x31')](function(_0x1e72d6){if(_0x1e72d6){_0x598805['message']=_0x1e72d6[_0xf7c0('0x5e')]({'plain':!![]});return db['ChatInteraction'][_0xf7c0('0x51')]({'where':{'id':_0x1e72d6[_0xf7c0('0x5f')]}});}return null;})['then'](handleEntityNotFound(_0x928707,null))['then'](function(_0x542903){if(_0x542903){return _0x542903['update']({'UserId':_0x5c8735['body']['UserId'],'read1stAt':_[_0xf7c0('0x60')](_0x542903['read1stAt'])?moment()['format'](_0xf7c0('0x61')):undefined});}return null;})['then'](function(_0x494800){if(_0x494800){_0x598805['interaction']=_0x494800[_0xf7c0('0x5e')]({'plain':!![]});interaction_log[_0xf7c0('0x1d')](_0xf7c0('0x62'),_0x5c8735[_0xf7c0('0x5c')]['id'],_0x5c8735[_0xf7c0('0x5c')][_0xf7c0('0x33')],_0x5c8735[_0xf7c0('0x5c')][_0xf7c0('0x63')],_0x598805[_0xf7c0('0x64')]['id'],_0x5c8735[_0xf7c0('0x53')]?JSON['stringify'](_0x5c8735[_0xf7c0('0x53')]):_0xf7c0('0x65'));return respondWithRpcPromise(_0xf7c0('0x66'),'acceptMessage',_0x598805);}return null;})[_0xf7c0('0x31')](function(_0x1a0df7){var _0x44fb81=_0xf7c0('0x67')+_0x1a0df7[_0xf7c0('0x22')][_0xf7c0('0x68')];return db[_0xf7c0('0x69')][_0xf7c0('0x3d')](_0x44fb81,{'type':db[_0xf7c0('0x6a')][_0xf7c0('0x6b')][_0xf7c0('0x6c')],'raw':!![]})[_0xf7c0('0x31')](function(_0x20800e){return _0x20800e;});})[_0xf7c0('0x31')](function(_0x170174){if(_0x170174){_0x598805[_0xf7c0('0x22')][_0xf7c0('0x6d')]=_0x170174[0x0];if(!_0x5c8735[_0xf7c0('0x53')]['UserId'])return;return db[_0xf7c0('0x6e')][_0xf7c0('0x51')]({'where':{'id':_0x5c8735['body']['UserId'],'role':_0xf7c0('0x5d')},'attributes':['id',_0xf7c0('0x33'),'fullname','email',_0xf7c0('0x6f')],'raw':!![]});}return null;})['then'](function(_0x10645f){if(!_0x10645f)return null;_0x598805[_0xf7c0('0x22')][_0xf7c0('0x5d')]=_0x10645f;return _0x598805;})[_0xf7c0('0x31')](function(_0x4beb52){if(_0x4beb52){if(_0x5c8735['body'][_0xf7c0('0x70')]){_0x598805['message'][_0xf7c0('0x71')]=util[_0xf7c0('0x5a')](_0xf7c0('0x72'),_0x5c8735['user']['name']);_0x598805['message'][_0xf7c0('0x73')]=_0x598805['channel'];_0x598805[_0xf7c0('0x22')][_0xf7c0('0x74')]=_0x598805[_0xf7c0('0x73')];_0x598805[_0xf7c0('0x22')][_0xf7c0('0x75')]='accept';return respondWithRpcPromise(_0xf7c0('0x76'),_0xf7c0('0x76'),{'event':_0xf7c0('0x77'),'message':_[_0xf7c0('0x48')](_0x598805[_0xf7c0('0x22')],JSON[_0xf7c0('0x78')](_0x598805[_0xf7c0('0x64')]['formData']))},client9002)[_0xf7c0('0x31')](function(){return _0x598805;});}return _0x598805;}return null;})[_0xf7c0('0x31')](respondWithResult(_0x928707,null))[_0xf7c0('0x4e')](handleError(_0x928707,null));};var interaction_log=require(_0xf7c0('0x55'))(_0xf7c0('0x79'));exports[_0xf7c0('0x2e')]=function(_0x14cfac,_0x27655a,_0x32467a){var _0x4f4072={'agent':{},'channel':_0xf7c0('0x57')};if(_0x14cfac[_0xf7c0('0x53')]['id']){delete _0x14cfac['body']['id'];}_0x14cfac[_0xf7c0('0x53')]['UserId']=_0x14cfac[_0xf7c0('0x53')]['UserId']||_0x14cfac[_0xf7c0('0x5c')]['id'];_0x4f4072['agent']['id']=_0x14cfac[_0xf7c0('0x53')]['UserId'];return db['ChatMessage'][_0xf7c0('0x51')]({'where':{'id':_0x14cfac[_0xf7c0('0x4f')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x27655a,null))[_0xf7c0('0x31')](function(_0x36f230){if(_0x36f230){_0x4f4072[_0xf7c0('0x22')]=_0x36f230[_0xf7c0('0x5e')]({'plain':!![]});return db[_0xf7c0('0x7a')][_0xf7c0('0x51')]({'where':{'id':_0x36f230[_0xf7c0('0x5f')]}});}return null;})['then'](handleEntityNotFound(_0x27655a,null))[_0xf7c0('0x31')](function(_0x453588){if(_0x453588){_0x4f4072['interaction']=_0x453588[_0xf7c0('0x5e')]({'plain':!![]});interaction_log[_0xf7c0('0x1d')](_0xf7c0('0x7b'),_0x14cfac[_0xf7c0('0x5c')]['id'],_0x14cfac[_0xf7c0('0x5c')][_0xf7c0('0x33')],_0x14cfac[_0xf7c0('0x5c')][_0xf7c0('0x63')],_0x4f4072[_0xf7c0('0x64')]['id'],_0x14cfac[_0xf7c0('0x53')]?JSON['stringify'](_0x14cfac[_0xf7c0('0x53')]):_0xf7c0('0x65'));return respondWithRpcPromise(_0xf7c0('0x7c'),_0xf7c0('0x7d'),_0x4f4072);}return null;})[_0xf7c0('0x31')](function(_0x14bde2){var _0x3ec09d='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x14bde2[_0xf7c0('0x22')]['ContactId'];return db[_0xf7c0('0x69')]['query'](_0x3ec09d,{'type':db[_0xf7c0('0x6a')][_0xf7c0('0x6b')][_0xf7c0('0x6c')],'raw':!![]})[_0xf7c0('0x31')](function(_0x406cc3){return _0x406cc3;});})[_0xf7c0('0x31')](function(_0x2eac95){if(_0x2eac95){_0x4f4072[_0xf7c0('0x22')][_0xf7c0('0x6d')]=_0x2eac95[0x0];if(!_0x14cfac[_0xf7c0('0x53')]['UserId'])return;return db[_0xf7c0('0x6e')][_0xf7c0('0x51')]({'where':{'id':_0x14cfac['body'][_0xf7c0('0x5b')],'role':_0xf7c0('0x5d')},'attributes':['id',_0xf7c0('0x33'),_0xf7c0('0x7e'),_0xf7c0('0x7f'),'internal'],'raw':!![]});}return null;})['then'](function(_0x180dc4){if(!_0x180dc4)return null;_0x4f4072[_0xf7c0('0x22')][_0xf7c0('0x5d')]=_0x180dc4;return _0x4f4072;})['then'](function(_0x5d08d8){if(_0x5d08d8){_0x5d08d8[_0xf7c0('0x22')]['interface']=util[_0xf7c0('0x5a')](_0xf7c0('0x72'),_0x14cfac[_0xf7c0('0x5c')][_0xf7c0('0x33')]);_0x5d08d8[_0xf7c0('0x22')][_0xf7c0('0x73')]=_0x4f4072[_0xf7c0('0x73')];_0x5d08d8[_0xf7c0('0x22')][_0xf7c0('0x74')]=_0x4f4072['channel'];_0x5d08d8[_0xf7c0('0x22')][_0xf7c0('0x75')]=_0xf7c0('0x2e');respondWithRpcPromise(_0xf7c0('0x76'),_0xf7c0('0x76'),{'event':_0xf7c0('0x80'),'message':_[_0xf7c0('0x48')](_0x4f4072[_0xf7c0('0x22')],JSON[_0xf7c0('0x78')](_0x4f4072[_0xf7c0('0x64')][_0xf7c0('0x81')]))},client9002);return _0x4f4072;}return null;})[_0xf7c0('0x31')](respondWithResult(_0x27655a,null))[_0xf7c0('0x4e')](handleError(_0x27655a,null));}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.events.js b/server/api/chatMessage/chatMessage.events.js index f1a9f06..f1dfce9 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 _0x9951=['remove','emit','hasOwnProperty','hook','events','../../mysqldb','setMaxListeners','save','update'];(function(_0x377cd8,_0x3aaabf){var _0x2685e1=function(_0x33a342){while(--_0x33a342){_0x377cd8['push'](_0x377cd8['shift']());}};_0x2685e1(++_0x3aaabf);}(_0x9951,0x187));var _0x1995=function(_0x5eec1f,_0x5302aa){_0x5eec1f=_0x5eec1f-0x0;var _0x59282f=_0x9951[_0x5eec1f];return _0x59282f;};'use strict';var EventEmitter=require(_0x1995('0x0'));var ChatMessage=require(_0x1995('0x1'))['db']['ChatMessage'];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0x1995('0x2')](0x0);var events={'afterCreate':_0x1995('0x3'),'afterUpdate':_0x1995('0x4'),'afterDestroy':_0x1995('0x5')};function emitEvent(_0x1bc7b1){return function(_0x10f861,_0x485cda,_0x25e68){ChatMessageEvents[_0x1995('0x6')](_0x1bc7b1+':'+_0x10f861['id'],_0x10f861);ChatMessageEvents[_0x1995('0x6')](_0x1bc7b1,_0x10f861);_0x25e68(null);};}for(var e in events){if(events[_0x1995('0x7')](e)){var event=events[e];ChatMessage[_0x1995('0x8')](e,emitEvent(event));}}module['exports']=ChatMessageEvents; \ No newline at end of file +var _0xf5df=['save','remove','emit','hook','../../mysqldb','ChatMessage','setMaxListeners'];(function(_0x358d5b,_0x34d08a){var _0x30b7a0=function(_0x4f6865){while(--_0x4f6865){_0x358d5b['push'](_0x358d5b['shift']());}};_0x30b7a0(++_0x34d08a);}(_0xf5df,0x154));var _0xff5d=function(_0x3b5feb,_0x1b8b43){_0x3b5feb=_0x3b5feb-0x0;var _0x1fbbfd=_0xf5df[_0x3b5feb];return _0x1fbbfd;};'use strict';var EventEmitter=require('events');var ChatMessage=require(_0xff5d('0x0'))['db'][_0xff5d('0x1')];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0xff5d('0x2')](0x0);var events={'afterCreate':_0xff5d('0x3'),'afterUpdate':'update','afterDestroy':_0xff5d('0x4')};function emitEvent(_0x3f9113){return function(_0x4f6a7a,_0x2daf31,_0x3cd38f){ChatMessageEvents[_0xff5d('0x5')](_0x3f9113+':'+_0x4f6a7a['id'],_0x4f6a7a);ChatMessageEvents[_0xff5d('0x5')](_0x3f9113,_0x4f6a7a);_0x3cd38f(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatMessage[_0xff5d('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 bbe93cb..84ee3e1 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 _0x3870=['direction','out','isNil','UserId','findOne','ChatInteractionId','then','update','createdAt','error','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatMessage.attributes','exports','chat_messages','fti_chat_messages','FULLTEXT','get','toLowerCase'];(function(_0x584766,_0x43c53a){var _0x572bfe=function(_0x2392ec){while(--_0x2392ec){_0x584766['push'](_0x584766['shift']());}};_0x572bfe(++_0x43c53a);}(_0x3870,0x15b));var _0x0387=function(_0x1ae109,_0x22ff67){_0x1ae109=_0x1ae109-0x0;var _0xce95c3=_0x3870[_0x1ae109];return _0xce95c3;};'use strict';var _=require(_0x0387('0x0'));var util=require(_0x0387('0x1'));var logger=require(_0x0387('0x2'))(_0x0387('0x3'));var moment=require(_0x0387('0x4'));var BPromise=require(_0x0387('0x5'));var rp=require(_0x0387('0x6'));var fs=require('fs');var path=require(_0x0387('0x7'));var rimraf=require(_0x0387('0x8'));var config=require(_0x0387('0x9'));var attributes=require(_0x0387('0xa'));module[_0x0387('0xb')]=function(_0x2e1bf7,_0x363c4e){return _0x2e1bf7['define']('ChatMessage',attributes,{'tableName':_0x0387('0xc'),'paranoid':![],'indexes':[{'name':_0x0387('0xd'),'fields':['body'],'type':_0x0387('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0xd1e14b,_0x2d42eb,_0x1bb19b){var _0x9a15a0=_0x2e1bf7['models'];var _0x3f1fbf=_0xd1e14b[_0x0387('0xf')]({'plain':!![]});if(_0x3f1fbf['direction'][_0x0387('0x10')]()==='in'||_0x3f1fbf[_0x0387('0x11')]['toLowerCase']()===_0x0387('0x12')&&!_0x3f1fbf['secret']&&!_[_0x0387('0x13')](_0x3f1fbf[_0x0387('0x14')])){_0x9a15a0['ChatInteraction'][_0x0387('0x15')]({'where':{'id':_0x3f1fbf[_0x0387('0x16')]}})[_0x0387('0x17')](function(_0x237ba3){if(_0x237ba3){_0x237ba3[_0x0387('0x18')]({'lastMsgAt':_0x3f1fbf[_0x0387('0x19')],'lastMsgDirection':_0x3f1fbf[_0x0387('0x11')][_0x0387('0x10')]()});}})['catch'](function(_0x4f2d8a){console[_0x0387('0x1a')](_0x4f2d8a);});}_0x1bb19b();}},'charset':'utf8mb4','collate':_0x0387('0x1b')});}; \ No newline at end of file +var _0x9c70=['bluebird','request-promise','path','rimraf','../../config/environment','./chatMessage.attributes','ChatMessage','fti_chat_messages','body','FULLTEXT','models','get','direction','toLowerCase','out','secret','isNil','UserId','ChatInteraction','ChatInteractionId','createdAt','catch','error','lodash','util','../../config/logger','api'];(function(_0x3e2896,_0x1da662){var _0x4817fe=function(_0x5b12e2){while(--_0x5b12e2){_0x3e2896['push'](_0x3e2896['shift']());}};_0x4817fe(++_0x1da662);}(_0x9c70,0xd4));var _0x09c7=function(_0x5c9008,_0x4bb3a6){_0x5c9008=_0x5c9008-0x0;var _0x31a5e0=_0x9c70[_0x5c9008];return _0x31a5e0;};'use strict';var _=require(_0x09c7('0x0'));var util=require(_0x09c7('0x1'));var logger=require(_0x09c7('0x2'))(_0x09c7('0x3'));var moment=require('moment');var BPromise=require(_0x09c7('0x4'));var rp=require(_0x09c7('0x5'));var fs=require('fs');var path=require(_0x09c7('0x6'));var rimraf=require(_0x09c7('0x7'));var config=require(_0x09c7('0x8'));var attributes=require(_0x09c7('0x9'));module['exports']=function(_0x11fb6f,_0x57a7cc){return _0x11fb6f['define'](_0x09c7('0xa'),attributes,{'tableName':'chat_messages','paranoid':![],'indexes':[{'name':_0x09c7('0xb'),'fields':[_0x09c7('0xc')],'type':_0x09c7('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x366a03,_0x22c8a,_0x235407){var _0x206886=_0x11fb6f[_0x09c7('0xe')];var _0x499942=_0x366a03[_0x09c7('0xf')]({'plain':!![]});if(_0x499942[_0x09c7('0x10')][_0x09c7('0x11')]()==='in'||_0x499942[_0x09c7('0x10')][_0x09c7('0x11')]()===_0x09c7('0x12')&&!_0x499942[_0x09c7('0x13')]&&!_[_0x09c7('0x14')](_0x499942[_0x09c7('0x15')])){_0x206886[_0x09c7('0x16')]['findOne']({'where':{'id':_0x499942[_0x09c7('0x17')]}})['then'](function(_0x4742ea){if(_0x4742ea){_0x4742ea['update']({'lastMsgAt':_0x499942[_0x09c7('0x18')],'lastMsgDirection':_0x499942[_0x09c7('0x10')][_0x09c7('0x11')]()});}})[_0x09c7('0x19')](function(_0x99ea01){console[_0x09c7('0x1a')](_0x99ea01);});}_0x235407();}},'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.rpc.js b/server/api/chatMessage/chatMessage.rpc.js index 7902c7b..3b4810f 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 _0x76f2=['defaults','localhost','./chatMessage.socket','register','request','then','info','ChatMessage,\x20%s,\x20%s','request\x20sent','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','CreateChatMessage','ChatMessage','create','body','options','raw','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','redis'];(function(_0x37fcd0,_0x141d80){var _0x3869d4=function(_0x52c5a3){while(--_0x52c5a3){_0x37fcd0['push'](_0x37fcd0['shift']());}};_0x3869d4(++_0x141d80);}(_0x76f2,0x125));var _0x276f=function(_0x58d40f,_0x18f78d){_0x58d40f=_0x58d40f-0x0;var _0x56572c=_0x76f2[_0x58d40f];return _0x56572c;};'use strict';var _=require(_0x276f('0x0'));var util=require(_0x276f('0x1'));var moment=require(_0x276f('0x2'));var BPromise=require(_0x276f('0x3'));var rs=require(_0x276f('0x4'));var fs=require('fs');var Redis=require(_0x276f('0x5'));var db=require(_0x276f('0x6'))['db'];var utils=require(_0x276f('0x7'));var logger=require(_0x276f('0x8'))(_0x276f('0x9'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x276f('0xa')][_0x276f('0xb')]({'port':0x232a});config[_0x276f('0xc')]=_[_0x276f('0xd')](config[_0x276f('0xc')],{'host':_0x276f('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x276f('0xc')]));require(_0x276f('0xf'))[_0x276f('0x10')](socket);function respondWithRpcPromise(_0x1cf6dc,_0x178ddb,_0x48d337){return new BPromise(function(_0x43520c,_0x558c35){return client[_0x276f('0x11')](_0x1cf6dc,_0x48d337)[_0x276f('0x12')](function(_0x2f7e11){logger[_0x276f('0x13')](_0x276f('0x14'),_0x178ddb,_0x276f('0x15'));logger['debug'](_0x276f('0x16'),_0x178ddb,_0x276f('0x15'),JSON[_0x276f('0x17')](_0x2f7e11));if(_0x2f7e11[_0x276f('0x18')]){if(_0x2f7e11[_0x276f('0x18')][_0x276f('0x19')]===0x1f4){logger[_0x276f('0x18')](_0x276f('0x14'),_0x178ddb,_0x2f7e11[_0x276f('0x18')][_0x276f('0x1a')]);return _0x558c35(_0x2f7e11[_0x276f('0x18')][_0x276f('0x1a')]);}logger[_0x276f('0x18')]('ChatMessage,\x20%s,\x20%s',_0x178ddb,_0x2f7e11[_0x276f('0x18')][_0x276f('0x1a')]);return _0x43520c(_0x2f7e11[_0x276f('0x18')][_0x276f('0x1a')]);}else{logger['info'](_0x276f('0x14'),_0x178ddb,'request\x20sent');_0x43520c(_0x2f7e11['result']['message']);}})[_0x276f('0x1b')](function(_0x15ba3a){logger[_0x276f('0x18')](_0x276f('0x14'),_0x178ddb,_0x15ba3a);_0x558c35(_0x15ba3a);});});}exports[_0x276f('0x1c')]=function(_0x5afc36){var _0xd9a0c1=this;return new Promise(function(_0x27bb24,_0x4c7799){return db[_0x276f('0x1d')][_0x276f('0x1e')](_0x5afc36[_0x276f('0x1f')],{'raw':_0x5afc36[_0x276f('0x20')]?_0x5afc36[_0x276f('0x20')][_0x276f('0x21')]===undefined?!![]:![]:!![]})['then'](function(_0xaa6b1f){logger[_0x276f('0x13')](_0x276f('0x1c'),_0x5afc36);logger['debug'](_0x276f('0x1c'),_0x5afc36,JSON[_0x276f('0x17')](_0xaa6b1f));_0x27bb24(_0xaa6b1f);})[_0x276f('0x1b')](function(_0x46777e){logger[_0x276f('0x18')](_0x276f('0x1c'),_0x46777e[_0x276f('0x1a')],_0x5afc36);_0x4c7799(_0xd9a0c1[_0x276f('0x18')](0x1f4,_0x46777e['message']));});});}; \ No newline at end of file +var _0xfea2=['request','info','ChatMessage,\x20%s,\x20%s','ChatMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','CreateChatMessage','ChatMessage','body','options','raw','then','debug','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','defaults','redis','localhost','socket.io-emitter','./chatMessage.socket','register'];(function(_0xf26d40,_0x2f4f46){var _0x50b68c=function(_0x10aa58){while(--_0x10aa58){_0xf26d40['push'](_0xf26d40['shift']());}};_0x50b68c(++_0x2f4f46);}(_0xfea2,0x156));var _0x2fea=function(_0x2300c7,_0x255f74){_0x2300c7=_0x2300c7-0x0;var _0x23f720=_0xfea2[_0x2300c7];return _0x23f720;};'use strict';var _=require(_0x2fea('0x0'));var util=require(_0x2fea('0x1'));var moment=require(_0x2fea('0x2'));var BPromise=require('bluebird');var rs=require(_0x2fea('0x3'));var fs=require('fs');var Redis=require(_0x2fea('0x4'));var db=require(_0x2fea('0x5'))['db'];var utils=require(_0x2fea('0x6'));var logger=require(_0x2fea('0x7'))(_0x2fea('0x8'));var config=require(_0x2fea('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x2fea('0xa')][_0x2fea('0xb')]({'port':0x232a});config['redis']=_[_0x2fea('0xc')](config[_0x2fea('0xd')],{'host':_0x2fea('0xe'),'port':0x18eb});var socket=require(_0x2fea('0xf'))(new Redis(config[_0x2fea('0xd')]));require(_0x2fea('0x10'))[_0x2fea('0x11')](socket);function respondWithRpcPromise(_0x23a4db,_0x5d0200,_0x2a3fd9){return new BPromise(function(_0x33b252,_0x51a364){return client[_0x2fea('0x12')](_0x23a4db,_0x2a3fd9)['then'](function(_0x409ac7){logger[_0x2fea('0x13')](_0x2fea('0x14'),_0x5d0200,'request\x20sent');logger['debug'](_0x2fea('0x15'),_0x5d0200,_0x2fea('0x16'),JSON[_0x2fea('0x17')](_0x409ac7));if(_0x409ac7[_0x2fea('0x18')]){if(_0x409ac7[_0x2fea('0x18')][_0x2fea('0x19')]===0x1f4){logger['error'](_0x2fea('0x14'),_0x5d0200,_0x409ac7[_0x2fea('0x18')][_0x2fea('0x1a')]);return _0x51a364(_0x409ac7['error'][_0x2fea('0x1a')]);}logger[_0x2fea('0x18')](_0x2fea('0x14'),_0x5d0200,_0x409ac7[_0x2fea('0x18')][_0x2fea('0x1a')]);return _0x33b252(_0x409ac7[_0x2fea('0x18')][_0x2fea('0x1a')]);}else{logger[_0x2fea('0x13')](_0x2fea('0x14'),_0x5d0200,_0x2fea('0x16'));_0x33b252(_0x409ac7[_0x2fea('0x1b')][_0x2fea('0x1a')]);}})[_0x2fea('0x1c')](function(_0x215ce9){logger[_0x2fea('0x18')]('ChatMessage,\x20%s,\x20%s',_0x5d0200,_0x215ce9);_0x51a364(_0x215ce9);});});}exports[_0x2fea('0x1d')]=function(_0x5d48ee){var _0x59de1e=this;return new Promise(function(_0x534feb,_0x4fa5ce){return db[_0x2fea('0x1e')]['create'](_0x5d48ee[_0x2fea('0x1f')],{'raw':_0x5d48ee[_0x2fea('0x20')]?_0x5d48ee[_0x2fea('0x20')][_0x2fea('0x21')]===undefined?!![]:![]:!![]})[_0x2fea('0x22')](function(_0x245ec8){logger['info'](_0x2fea('0x1d'),_0x5d48ee);logger[_0x2fea('0x23')](_0x2fea('0x1d'),_0x5d48ee,JSON[_0x2fea('0x17')](_0x245ec8));_0x534feb(_0x245ec8);})[_0x2fea('0x1c')](function(_0x3cfe7b){logger[_0x2fea('0x18')](_0x2fea('0x1d'),_0x3cfe7b[_0x2fea('0x1a')],_0x5d48ee);_0x4fa5ce(_0x59de1e[_0x2fea('0x18')](0x1f4,_0x3cfe7b[_0x2fea('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.socket.js b/server/api/chatMessage/chatMessage.socket.js index 6caa2f2..e323497 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 _0x6379=['emit','removeListener','register','chatMessage:','./chatMessage.events','save','remove','update'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x6379,0x84));var _0x9637=function(_0x3ac064,_0x278b44){_0x3ac064=_0x3ac064-0x0;var _0x57a926=_0x6379[_0x3ac064];return _0x57a926;};'use strict';var ChatMessageEvents=require(_0x9637('0x0'));var events=[_0x9637('0x1'),_0x9637('0x2'),_0x9637('0x3')];function createListener(_0x19949a,_0x52d27e){return function(_0x44a9ae){_0x52d27e[_0x9637('0x4')](_0x19949a,_0x44a9ae);};}function removeListener(_0x5f1058,_0x5f50c5){return function(){ChatMessageEvents[_0x9637('0x5')](_0x5f1058,_0x5f50c5);};}exports[_0x9637('0x6')]=function(_0x19f7d0){for(var _0x25087c=0x0,_0xf0db9f=events['length'];_0x25087c<_0xf0db9f;_0x25087c++){var _0x515a84=events[_0x25087c];var _0x21d91b=createListener(_0x9637('0x7')+_0x515a84,_0x19f7d0);ChatMessageEvents['on'](_0x515a84,_0x21d91b);}}; \ No newline at end of file +var _0xe132=['remove','update','length','chatMessage:','./chatMessage.events'];(function(_0x1c07e4,_0x15188d){var _0x3b9942=function(_0x1a7dca){while(--_0x1a7dca){_0x1c07e4['push'](_0x1c07e4['shift']());}};_0x3b9942(++_0x15188d);}(_0xe132,0x162));var _0x2e13=function(_0x529364,_0xd4d4c7){_0x529364=_0x529364-0x0;var _0x1eefdf=_0xe132[_0x529364];return _0x1eefdf;};'use strict';var ChatMessageEvents=require(_0x2e13('0x0'));var events=['save',_0x2e13('0x1'),_0x2e13('0x2')];function createListener(_0x21dfef,_0x2c2bdd){return function(_0x2a5250){_0x2c2bdd['emit'](_0x21dfef,_0x2a5250);};}function removeListener(_0x1ae6a9,_0x3f01fe){return function(){ChatMessageEvents['removeListener'](_0x1ae6a9,_0x3f01fe);};}exports['register']=function(_0x260dc1){for(var _0x2f9d00=0x0,_0x1c670b=events[_0x2e13('0x3')];_0x2f9d00<_0x1c670b;_0x2f9d00++){var _0x3be5dc=events[_0x2f9d00];var _0x2d9487=createListener(_0x2e13('0x4')+_0x3be5dc,_0x260dc1);ChatMessageEvents['on'](_0x3be5dc,_0x2d9487);}}; \ No newline at end of file diff --git a/server/api/chatMessage/index.js b/server/api/chatMessage/index.js index 5110eed..6667439 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 _0x7d22=['../../components/auth/service','isAuthenticated','index','describe','/:id','show','post','tracked','chatmessage:create','create','put','update','accept','reject','delete','destroy','exports','util','path','express','Router','fs-extra'];(function(_0x2f4c8d,_0x43aa55){var _0x5c7f16=function(_0x5575e3){while(--_0x5575e3){_0x2f4c8d['push'](_0x2f4c8d['shift']());}};_0x5c7f16(++_0x43aa55);}(_0x7d22,0x7f));var _0x27d2=function(_0x1f3748,_0x473ebd){_0x1f3748=_0x1f3748-0x0;var _0x371fdd=_0x7d22[_0x1f3748];return _0x371fdd;};'use strict';var multer=require('multer');var util=require(_0x27d2('0x0'));var path=require(_0x27d2('0x1'));var timeout=require('connect-timeout');var express=require(_0x27d2('0x2'));var router=express[_0x27d2('0x3')]();var fs_extra=require(_0x27d2('0x4'));var auth=require(_0x27d2('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./chatMessage.controller');router['get']('/',auth[_0x27d2('0x6')](),controller[_0x27d2('0x7')]);router['get']('/describe',auth['isAuthenticated'](),controller[_0x27d2('0x8')]);router['get'](_0x27d2('0x9'),auth[_0x27d2('0x6')](),controller[_0x27d2('0xa')]);router[_0x27d2('0xb')]('/',auth[_0x27d2('0x6')](),interaction[_0x27d2('0xc')]('chat',_0x27d2('0xd')),controller[_0x27d2('0xe')]);router[_0x27d2('0xf')]('/:id',controller[_0x27d2('0x10')]);router['put']('/:id/accept',auth[_0x27d2('0x6')](),controller[_0x27d2('0x11')]);router[_0x27d2('0xf')]('/:id/reject',auth[_0x27d2('0x6')](),controller[_0x27d2('0x12')]);router[_0x27d2('0x13')](_0x27d2('0x9'),auth[_0x27d2('0x6')](),controller[_0x27d2('0x14')]);module[_0x27d2('0x15')]=router; \ No newline at end of file +var _0x380f=['create','put','update','/:id/accept','accept','reject','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/:id','show','tracked','chatmessage:create'];(function(_0x3005bb,_0xe9520d){var _0x2f866b=function(_0x10c253){while(--_0x10c253){_0x3005bb['push'](_0x3005bb['shift']());}};_0x2f866b(++_0xe9520d);}(_0x380f,0xae));var _0xf380=function(_0x26f975,_0x9473ed){_0x26f975=_0x26f975-0x0;var _0x3680e0=_0x380f[_0x26f975];return _0x3680e0;};'use strict';var multer=require(_0xf380('0x0'));var util=require('util');var path=require(_0xf380('0x1'));var timeout=require(_0xf380('0x2'));var express=require(_0xf380('0x3'));var router=express[_0xf380('0x4')]();var fs_extra=require(_0xf380('0x5'));var auth=require(_0xf380('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xf380('0x7'));var controller=require('./chatMessage.controller');router[_0xf380('0x8')]('/',auth[_0xf380('0x9')](),controller[_0xf380('0xa')]);router[_0xf380('0x8')]('/describe',auth['isAuthenticated'](),controller['describe']);router[_0xf380('0x8')](_0xf380('0xb'),auth[_0xf380('0x9')](),controller[_0xf380('0xc')]);router['post']('/',auth[_0xf380('0x9')](),interaction[_0xf380('0xd')]('chat',_0xf380('0xe')),controller[_0xf380('0xf')]);router[_0xf380('0x10')](_0xf380('0xb'),controller[_0xf380('0x11')]);router[_0xf380('0x10')](_0xf380('0x12'),auth[_0xf380('0x9')](),controller[_0xf380('0x13')]);router[_0xf380('0x10')]('/:id/reject',auth[_0xf380('0x9')](),controller[_0xf380('0x14')]);router['delete'](_0xf380('0xb'),auth[_0xf380('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js b/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js index df83286..4755c8c 100644 --- a/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js +++ b/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdb28=['TEXT','medium','sequelize','exports'];(function(_0x3524a7,_0x3e1d6a){var _0x74afd2=function(_0x34fd7a){while(--_0x34fd7a){_0x3524a7['push'](_0x3524a7['shift']());}};_0x74afd2(++_0x3e1d6a);}(_0xdb28,0x106));var _0x8db2=function(_0x2c4acc,_0x4ff068){_0x2c4acc=_0x2c4acc-0x0;var _0x295d8a=_0xdb28[_0x2c4acc];return _0x295d8a;};'use strict';var Sequelize=require(_0x8db2('0x0'));module[_0x8db2('0x1')]={'body':{'type':Sequelize[_0x8db2('0x2')](_0x8db2('0x3')),'allowNull':![]},'plainBody':{'type':Sequelize['TEXT'](_0x8db2('0x3')),'allowNull':![]}}; \ No newline at end of file +var _0xdb28=['TEXT','medium','sequelize','exports'];(function(_0x4d685a,_0x5422c2){var _0x4c80ea=function(_0x293780){while(--_0x293780){_0x4d685a['push'](_0x4d685a['shift']());}};_0x4c80ea(++_0x5422c2);}(_0xdb28,0x106));var _0x8db2=function(_0x287a33,_0x3d170d){_0x287a33=_0x287a33-0x0;var _0xa6e1cc=_0xdb28[_0x287a33];return _0xa6e1cc;};'use strict';var Sequelize=require(_0x8db2('0x0'));module[_0x8db2('0x1')]={'body':{'type':Sequelize[_0x8db2('0x2')](_0x8db2('0x3')),'allowNull':![]},'plainBody':{'type':Sequelize['TEXT'](_0x8db2('0x3')),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.controller.js b/server/api/chatOfflineMessage/chatOfflineMessage.controller.js index 051d21c..7e56e74 100644 --- a/server/api/chatOfflineMessage/chatOfflineMessage.controller.js +++ b/server/api/chatOfflineMessage/chatOfflineMessage.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['filter','VIRTUAL','includeAll','include','findAll','rows','show','params','length','merge','options','find','catch','body','Attachment','join','server','attachments','offline-chat','basename','remove','describe','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','index','ChatOfflineMessage','fieldName','type','model','map','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick'];(function(_0xd1d19a,_0x1933f0){var _0x52a79d=function(_0x5199e2){while(--_0x5199e2){_0xd1d19a['push'](_0xd1d19a['shift']());}};_0x52a79d(++_0x1933f0);}(_0x7a54,0x106));var _0x47a5=function(_0x5bbf9e,_0x3343f8){_0x5bbf9e=_0x5bbf9e-0x0;var _0x4419c5=_0x7a54[_0x5bbf9e];return _0x4419c5;};'use strict';var emlformat=require(_0x47a5('0x0'));var rimraf=require(_0x47a5('0x1'));var zipdir=require(_0x47a5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x47a5('0x3'));var moment=require(_0x47a5('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x47a5('0x5'));var util=require(_0x47a5('0x6'));var path=require(_0x47a5('0x7'));var sox=require(_0x47a5('0x8'));var csv=require(_0x47a5('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x47a5('0xa'));var _=require('lodash');var squel=require(_0x47a5('0xb'));var crypto=require(_0x47a5('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x47a5('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x47a5('0xe'));var authService=require(_0x47a5('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x47a5('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x47a5('0x11'));var utils=require(_0x47a5('0x12'));var config=require(_0x47a5('0x13'));var licenseUtil=require(_0x47a5('0x14'));var db=require(_0x47a5('0x15'))['db'];function respondWithStatusCode(_0xd308b8,_0x1eae59){_0x1eae59=_0x1eae59||0xcc;return function(_0x5beb89){if(_0x5beb89){return _0xd308b8[_0x47a5('0x16')](_0x1eae59);}return _0xd308b8[_0x47a5('0x17')](_0x1eae59)[_0x47a5('0x18')]();};}function respondWithResult(_0x711793,_0x139f25){_0x139f25=_0x139f25||0xc8;return function(_0x620ee9){if(_0x620ee9){return _0x711793[_0x47a5('0x17')](_0x139f25)[_0x47a5('0x19')](_0x620ee9);}};}function respondWithFilteredResult(_0x4e99a8,_0x362359){return function(_0x11faf5){if(_0x11faf5){var _0x3b001e=typeof _0x362359[_0x47a5('0x1a')]===_0x47a5('0x1b')&&typeof _0x362359['limit']==='undefined';var _0x138bc0=_0x11faf5['count'];var _0x5247fd=_0x3b001e?0x0:_0x362359[_0x47a5('0x1a')];var _0xaf70a6=_0x3b001e?_0x11faf5[_0x47a5('0x1c')]:_0x362359[_0x47a5('0x1a')]+_0x362359[_0x47a5('0x1d')];var _0x12b98e;if(_0xaf70a6>=_0x138bc0){_0xaf70a6=_0x138bc0;_0x12b98e=0xc8;}else{_0x12b98e=0xce;}_0x4e99a8[_0x47a5('0x17')](_0x12b98e);return _0x4e99a8[_0x47a5('0x1e')](_0x47a5('0x1f'),_0x5247fd+'-'+_0xaf70a6+'/'+_0x138bc0)['json'](_0x11faf5);}return null;};}function patchUpdates(_0x1570bc){return function(_0xf160ba){try{jsonpatch['apply'](_0xf160ba,_0x1570bc,!![]);}catch(_0x2b0360){return BPromise[_0x47a5('0x20')](_0x2b0360);}return _0xf160ba[_0x47a5('0x21')]();};}function saveUpdates(_0x4c5910,_0xb8ae6c){return function(_0x2f142b){if(_0x2f142b){return _0x2f142b[_0x47a5('0x22')](_0x4c5910)[_0x47a5('0x23')](function(_0x5ef1b1){return _0x5ef1b1;});}return null;};}function removeEntity(_0xe2dea9,_0x385687){return function(_0x513981){if(_0x513981){return _0x513981[_0x47a5('0x24')]()[_0x47a5('0x23')](function(){_0xe2dea9[_0x47a5('0x17')](0xcc)[_0x47a5('0x18')]();});}};}function handleEntityNotFound(_0x3abd6a,_0x50bf17){return function(_0x53078a){if(!_0x53078a){_0x3abd6a[_0x47a5('0x16')](0x194);}return _0x53078a;};}function handleError(_0x5686db,_0x1ea9c8){_0x1ea9c8=_0x1ea9c8||0x1f4;return function(_0x5b6c4e){logger[_0x47a5('0x25')](_0x5b6c4e[_0x47a5('0x26')]);if(_0x5b6c4e[_0x47a5('0x27')]){delete _0x5b6c4e[_0x47a5('0x27')];}_0x5686db[_0x47a5('0x17')](_0x1ea9c8)[_0x47a5('0x28')](_0x5b6c4e);};}exports[_0x47a5('0x29')]=function(_0x136b14,_0x16631f){var _0x361bfa={},_0x1127f8={},_0x11a4fa={'count':0x0,'rows':[]};var _0x3ad507=_['map'](db[_0x47a5('0x2a')]['rawAttributes'],function(_0x2ef875){return{'name':_0x2ef875[_0x47a5('0x2b')],'type':_0x2ef875[_0x47a5('0x2c')]['key']};});_0x1127f8[_0x47a5('0x2d')]=_[_0x47a5('0x2e')](_0x3ad507,_0x47a5('0x27'));_0x1127f8[_0x47a5('0x2f')]=_['keys'](_0x136b14['query']);_0x1127f8[_0x47a5('0x30')]=_[_0x47a5('0x31')](_0x1127f8['model'],_0x1127f8['query']);_0x361bfa[_0x47a5('0x32')]=_[_0x47a5('0x31')](_0x1127f8['model'],qs[_0x47a5('0x33')](_0x136b14['query'][_0x47a5('0x33')]));_0x361bfa[_0x47a5('0x32')]=_0x361bfa['attributes']['length']?_0x361bfa[_0x47a5('0x32')]:_0x1127f8['model'];if(!_0x136b14[_0x47a5('0x2f')][_0x47a5('0x34')](_0x47a5('0x35'))){_0x361bfa['limit']=qs[_0x47a5('0x1d')](_0x136b14['query']['limit']);_0x361bfa[_0x47a5('0x1a')]=qs['offset'](_0x136b14[_0x47a5('0x2f')]['offset']);}_0x361bfa[_0x47a5('0x36')]=qs[_0x47a5('0x37')](_0x136b14[_0x47a5('0x2f')][_0x47a5('0x37')]);_0x361bfa[_0x47a5('0x38')]=qs[_0x47a5('0x30')](_[_0x47a5('0x39')](_0x136b14[_0x47a5('0x2f')],_0x1127f8[_0x47a5('0x30')]),_0x3ad507);if(_0x136b14['query'][_0x47a5('0x3a')]){_0x361bfa[_0x47a5('0x38')]=_['merge'](_0x361bfa[_0x47a5('0x38')],{'$or':_[_0x47a5('0x2e')](_0x3ad507,function(_0x1d4348){if(_0x1d4348['type']!==_0x47a5('0x3b')){var _0x10f660={};_0x10f660[_0x1d4348['name']]={'$like':'%'+_0x136b14[_0x47a5('0x2f')][_0x47a5('0x3a')]+'%'};return _0x10f660;}})});}_0x361bfa=_['merge']({},_0x361bfa,_0x136b14['options']);var _0x5ebd8c={'where':_0x361bfa[_0x47a5('0x38')]};return db['ChatOfflineMessage'][_0x47a5('0x1c')](_0x5ebd8c)[_0x47a5('0x23')](function(_0x301a85){_0x11a4fa[_0x47a5('0x1c')]=_0x301a85;if(_0x136b14[_0x47a5('0x2f')][_0x47a5('0x3c')]){_0x361bfa[_0x47a5('0x3d')]=[{'all':!![]}];}return db[_0x47a5('0x2a')][_0x47a5('0x3e')](_0x361bfa);})[_0x47a5('0x23')](function(_0x280500){_0x11a4fa[_0x47a5('0x3f')]=_0x280500;return _0x11a4fa;})[_0x47a5('0x23')](respondWithFilteredResult(_0x16631f,_0x361bfa))['catch'](handleError(_0x16631f,null));};exports[_0x47a5('0x40')]=function(_0x1c36fa,_0x331474){var _0x23bd8d={'raw':!![],'where':{'id':_0x1c36fa[_0x47a5('0x41')]['id']}},_0x586f4f={};_0x586f4f['model']=_['keys'](db['ChatOfflineMessage']['rawAttributes']);_0x586f4f[_0x47a5('0x2f')]=_['keys'](_0x1c36fa[_0x47a5('0x2f')]);_0x586f4f[_0x47a5('0x30')]=_[_0x47a5('0x31')](_0x586f4f['model'],_0x586f4f[_0x47a5('0x2f')]);_0x23bd8d[_0x47a5('0x32')]=_['intersection'](_0x586f4f['model'],qs[_0x47a5('0x33')](_0x1c36fa['query'][_0x47a5('0x33')]));_0x23bd8d[_0x47a5('0x32')]=_0x23bd8d[_0x47a5('0x32')][_0x47a5('0x42')]?_0x23bd8d[_0x47a5('0x32')]:_0x586f4f[_0x47a5('0x2d')];if(_0x1c36fa[_0x47a5('0x2f')][_0x47a5('0x3c')]){_0x23bd8d[_0x47a5('0x3d')]=[{'all':!![]}];}_0x23bd8d=_[_0x47a5('0x43')]({},_0x23bd8d,_0x1c36fa[_0x47a5('0x44')]);return db[_0x47a5('0x2a')][_0x47a5('0x45')](_0x23bd8d)[_0x47a5('0x23')](handleEntityNotFound(_0x331474,null))[_0x47a5('0x23')](respondWithResult(_0x331474,null))[_0x47a5('0x46')](handleError(_0x331474,null));};exports['create']=function(_0x2d38de,_0x23bb04){return db['ChatOfflineMessage']['create'](_0x2d38de[_0x47a5('0x47')],{})['then'](respondWithResult(_0x23bb04,0xc9))[_0x47a5('0x46')](handleError(_0x23bb04,null));};exports[_0x47a5('0x22')]=function(_0x54c35f,_0x4f62d3){if(_0x54c35f[_0x47a5('0x47')]['id']){delete _0x54c35f['body']['id'];}return db[_0x47a5('0x2a')][_0x47a5('0x45')]({'where':{'id':_0x54c35f[_0x47a5('0x41')]['id']}})[_0x47a5('0x23')](handleEntityNotFound(_0x4f62d3,null))[_0x47a5('0x23')](saveUpdates(_0x54c35f[_0x47a5('0x47')],null))[_0x47a5('0x23')](respondWithResult(_0x4f62d3,null))['catch'](handleError(_0x4f62d3,null));};exports['destroy']=function(_0x2dd1db,_0x411230){return db[_0x47a5('0x48')][_0x47a5('0x3e')]({'where':{'ChatOfflineMessageId':_0x2dd1db[_0x47a5('0x41')]['id']},'raw':!![]})[_0x47a5('0x23')](function(_0x249de5){_0x249de5['forEach'](function(_0x45cca5){var _0x1c9a62=path[_0x47a5('0x49')](config['root'],_0x47a5('0x4a'),'files',_0x47a5('0x4b'),_0x47a5('0x4c'),_0x45cca5[_0x47a5('0x4d')]);var _0xf03bd5=fs['existsSync'](_0x1c9a62);if(_0xf03bd5)fs_extra[_0x47a5('0x4e')](_0x1c9a62);});})[_0x47a5('0x23')](function(){return db[_0x47a5('0x2a')][_0x47a5('0x45')]({'where':{'id':_0x2dd1db[_0x47a5('0x41')]['id']},'individualHooks':!![]});})[_0x47a5('0x23')](handleEntityNotFound(_0x411230,null))[_0x47a5('0x23')](removeEntity(_0x411230,null))['catch'](handleError(_0x411230,null));};exports[_0x47a5('0x4f')]=function(_0x43721b,_0x187d7e){return db[_0x47a5('0x2a')][_0x47a5('0x4f')]()[_0x47a5('0x23')](respondWithResult(_0x187d7e,null))['catch'](handleError(_0x187d7e,null));}; \ No newline at end of file +var _0x9957=['sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','reject','save','then','destroy','error','name','send','index','fieldName','type','key','model','map','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','options','ChatOfflineMessage','findAll','rows','show','rawAttributes','includeAll','include','find','create','catch','body','params','Attachment','forEach','join','root','server','files','attachments','basename','existsSync','remove','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb'];(function(_0x3facbf,_0xd5bd98){var _0x53ab80=function(_0x21572d){while(--_0x21572d){_0x3facbf['push'](_0x3facbf['shift']());}};_0x53ab80(++_0xd5bd98);}(_0x9957,0x93));var _0x7995=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x9957[_0x6c993a];return _0x27f547;};'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 3670278..ab28c0b 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 _0x4405=['save','events','../../mysqldb','ChatOfflineMessage','setMaxListeners'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x4405,0xce));var _0x5440=function(_0x3eb702,_0x54ae25){_0x3eb702=_0x3eb702-0x0;var _0x16ebd1=_0x4405[_0x3eb702];return _0x16ebd1;};'use strict';var EventEmitter=require(_0x5440('0x0'));var ChatOfflineMessage=require(_0x5440('0x1'))['db'][_0x5440('0x2')];var ChatOfflineMessageEvents=new EventEmitter();ChatOfflineMessageEvents[_0x5440('0x3')](0x0);var events={'afterCreate':_0x5440('0x4'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x4dd5fc){return function(_0x530c11,_0x1757eb,_0x334d7d){ChatOfflineMessageEvents['emit'](_0x4dd5fc+':'+_0x530c11['id'],_0x530c11);ChatOfflineMessageEvents['emit'](_0x4dd5fc,_0x530c11);_0x334d7d(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatOfflineMessage['hook'](e,emitEvent(event));}}module['exports']=ChatOfflineMessageEvents; \ No newline at end of file +var _0x34be=['exports','../../mysqldb','emit','hasOwnProperty'];(function(_0x4c8be7,_0x2d1f9f){var _0x13b337=function(_0x5e9292){while(--_0x5e9292){_0x4c8be7['push'](_0x4c8be7['shift']());}};_0x13b337(++_0x2d1f9f);}(_0x34be,0x139));var _0xe34b=function(_0x55daf2,_0x1b48de){_0x55daf2=_0x55daf2-0x0;var _0x1c8500=_0x34be[_0x55daf2];return _0x1c8500;};'use strict';var EventEmitter=require('events');var ChatOfflineMessage=require(_0xe34b('0x0'))['db']['ChatOfflineMessage'];var ChatOfflineMessageEvents=new EventEmitter();ChatOfflineMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x5359be){return function(_0x83c7c,_0x3e57f7,_0x4ce5f2){ChatOfflineMessageEvents[_0xe34b('0x1')](_0x5359be+':'+_0x83c7c['id'],_0x83c7c);ChatOfflineMessageEvents['emit'](_0x5359be,_0x83c7c);_0x4ce5f2(null);};}for(var e in events){if(events[_0xe34b('0x2')](e)){var event=events[e];ChatOfflineMessage['hook'](e,emitEvent(event));}}module[_0xe34b('0x3')]=ChatOfflineMessageEvents; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.model.js b/server/api/chatOfflineMessage/chatOfflineMessage.model.js index 7610200..d1f438d 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 _0xfaba=['exports','define','ChatOfflineMessage','utf8mb4','utf8mb4_unicode_ci','./chatOfflineMessage.attributes'];(function(_0x175a46,_0x467177){var _0x4050a7=function(_0x43d829){while(--_0x43d829){_0x175a46['push'](_0x175a46['shift']());}};_0x4050a7(++_0x467177);}(_0xfaba,0x1df));var _0xafab=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xfaba[_0x3dd15e];return _0x231fd0;};'use strict';var attributes=require(_0xafab('0x0'));module[_0xafab('0x1')]=function(_0x172d4d){return _0x172d4d[_0xafab('0x2')](_0xafab('0x3'),attributes,{'tableName':'chat_offline_messages','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xafab('0x4'),'collate':_0xafab('0x5')});}; \ No newline at end of file +var _0x4438=['./chatOfflineMessage.attributes','exports','define','ChatOfflineMessage','chat_offline_messages','utf8mb4','utf8mb4_unicode_ci'];(function(_0x2070da,_0x45e586){var _0x4f9fe1=function(_0x5b6f2a){while(--_0x5b6f2a){_0x2070da['push'](_0x2070da['shift']());}};_0x4f9fe1(++_0x45e586);}(_0x4438,0x9a));var _0x8443=function(_0x931e6b,_0x96f9a6){_0x931e6b=_0x931e6b-0x0;var _0x599365=_0x4438[_0x931e6b];return _0x599365;};'use strict';var attributes=require(_0x8443('0x0'));module[_0x8443('0x1')]=function(_0x400337){return _0x400337[_0x8443('0x2')](_0x8443('0x3'),attributes,{'tableName':_0x8443('0x4'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x8443('0x5'),'collate':_0x8443('0x6')});}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js b/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js index ddf3f2f..9c9a58e 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 _0xe4d9=['request','then','info','ChatOfflineMessage,\x20%s,\x20%s','request\x20sent','debug','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','randomstring','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http'];(function(_0x4394b6,_0x12357f){var _0x360244=function(_0x5689a1){while(--_0x5689a1){_0x4394b6['push'](_0x4394b6['shift']());}};_0x360244(++_0x12357f);}(_0xe4d9,0x141));var _0x9e4d=function(_0x17e4ee,_0x486725){_0x17e4ee=_0x17e4ee-0x0;var _0x46d765=_0xe4d9[_0x17e4ee];return _0x46d765;};'use strict';var _=require(_0x9e4d('0x0'));var util=require(_0x9e4d('0x1'));var moment=require(_0x9e4d('0x2'));var BPromise=require('bluebird');var rs=require(_0x9e4d('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x9e4d('0x4'));var logger=require(_0x9e4d('0x5'))('rpc');var config=require(_0x9e4d('0x6'));var jayson=require(_0x9e4d('0x7'));var client=jayson['client'][_0x9e4d('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x74b14,_0x5bfad3,_0x5af2a0){return new BPromise(function(_0x36ec30,_0x48d257){return client[_0x9e4d('0x9')](_0x74b14,_0x5af2a0)[_0x9e4d('0xa')](function(_0x4ea141){logger[_0x9e4d('0xb')](_0x9e4d('0xc'),_0x5bfad3,_0x9e4d('0xd'));logger[_0x9e4d('0xe')](_0x9e4d('0xf'),_0x5bfad3,_0x9e4d('0xd'),JSON[_0x9e4d('0x10')](_0x4ea141));if(_0x4ea141[_0x9e4d('0x11')]){if(_0x4ea141[_0x9e4d('0x11')][_0x9e4d('0x12')]===0x1f4){logger[_0x9e4d('0x11')](_0x9e4d('0xc'),_0x5bfad3,_0x4ea141[_0x9e4d('0x11')][_0x9e4d('0x13')]);return _0x48d257(_0x4ea141[_0x9e4d('0x11')]['message']);}logger[_0x9e4d('0x11')](_0x9e4d('0xc'),_0x5bfad3,_0x4ea141[_0x9e4d('0x11')][_0x9e4d('0x13')]);return _0x36ec30(_0x4ea141[_0x9e4d('0x11')][_0x9e4d('0x13')]);}else{logger['info'](_0x9e4d('0xc'),_0x5bfad3,_0x9e4d('0xd'));_0x36ec30(_0x4ea141[_0x9e4d('0x14')][_0x9e4d('0x13')]);}})[_0x9e4d('0x15')](function(_0x42674a){logger['error'](_0x9e4d('0xc'),_0x5bfad3,_0x42674a);_0x48d257(_0x42674a);});});} \ No newline at end of file +var _0x74d6=['../../config/environment','jayson/promise','request','then','info','ChatOfflineMessage,\x20%s,\x20%s','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','ioredis','../../config/utils','../../config/logger'];(function(_0x58fa2b,_0x3ab810){var _0x109ba0=function(_0x272205){while(--_0x272205){_0x58fa2b['push'](_0x58fa2b['shift']());}};_0x109ba0(++_0x3ab810);}(_0x74d6,0xeb));var _0x674d=function(_0x3d30a7,_0x27127d){_0x3d30a7=_0x3d30a7-0x0;var _0x4d433e=_0x74d6[_0x3d30a7];return _0x4d433e;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x674d('0x0'));var db=require('../../mysqldb')['db'];var utils=require(_0x674d('0x1'));var logger=require(_0x674d('0x2'))('rpc');var config=require(_0x674d('0x3'));var jayson=require(_0x674d('0x4'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x4b4ae0,_0x343348,_0x5061b7){return new BPromise(function(_0x4d37f7,_0x58c3ec){return client[_0x674d('0x5')](_0x4b4ae0,_0x5061b7)[_0x674d('0x6')](function(_0x175908){logger[_0x674d('0x7')](_0x674d('0x8'),_0x343348,'request\x20sent');logger['debug'](_0x674d('0x9'),_0x343348,'request\x20sent',JSON[_0x674d('0xa')](_0x175908));if(_0x175908['error']){if(_0x175908[_0x674d('0xb')][_0x674d('0xc')]===0x1f4){logger[_0x674d('0xb')](_0x674d('0x8'),_0x343348,_0x175908[_0x674d('0xb')][_0x674d('0xd')]);return _0x58c3ec(_0x175908[_0x674d('0xb')]['message']);}logger['error']('ChatOfflineMessage,\x20%s,\x20%s',_0x343348,_0x175908[_0x674d('0xb')][_0x674d('0xd')]);return _0x4d37f7(_0x175908['error'][_0x674d('0xd')]);}else{logger[_0x674d('0x7')]('ChatOfflineMessage,\x20%s,\x20%s',_0x343348,_0x674d('0xe'));_0x4d37f7(_0x175908[_0x674d('0xf')][_0x674d('0xd')]);}})[_0x674d('0x10')](function(_0x21a369){logger[_0x674d('0xb')](_0x674d('0x8'),_0x343348,_0x21a369);_0x58c3ec(_0x21a369);});});} \ No newline at end of file diff --git a/server/api/chatOfflineMessage/index.js b/server/api/chatOfflineMessage/index.js index d6e5972..179a28b 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 _0x80c6=['exports','multer','util','path','express','Router','fs-extra','../../config/environment','./chatOfflineMessage.controller','get','isAuthenticated','index','/describe','describe','show','post','create','put','/:id'];(function(_0x3c863a,_0x34ce85){var _0x2474d6=function(_0x298b4a){while(--_0x298b4a){_0x3c863a['push'](_0x3c863a['shift']());}};_0x2474d6(++_0x34ce85);}(_0x80c6,0x144));var _0x680c=function(_0xc42fc8,_0x2f856a){_0xc42fc8=_0xc42fc8-0x0;var _0x2fe13d=_0x80c6[_0xc42fc8];return _0x2fe13d;};'use strict';var multer=require(_0x680c('0x0'));var util=require(_0x680c('0x1'));var path=require(_0x680c('0x2'));var timeout=require('connect-timeout');var express=require(_0x680c('0x3'));var router=express[_0x680c('0x4')]();var fs_extra=require(_0x680c('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x680c('0x6'));var controller=require(_0x680c('0x7'));router[_0x680c('0x8')]('/',auth[_0x680c('0x9')](),controller[_0x680c('0xa')]);router['get'](_0x680c('0xb'),auth['isAuthenticated'](),controller[_0x680c('0xc')]);router[_0x680c('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x680c('0xd')]);router[_0x680c('0xe')]('/',auth[_0x680c('0x9')](),controller[_0x680c('0xf')]);router[_0x680c('0x10')](_0x680c('0x11'),auth[_0x680c('0x9')](),controller['update']);router['delete']('/:id',auth[_0x680c('0x9')](),controller['destroy']);module[_0x680c('0x12')]=router; \ No newline at end of file +var _0x6f21=['../../components/auth/service','../../components/interaction/service','get','isAuthenticated','describe','/:id','show','put','destroy','exports','util','connect-timeout'];(function(_0x22b06a,_0x50da1f){var _0x46e0ac=function(_0xcff734){while(--_0xcff734){_0x22b06a['push'](_0x22b06a['shift']());}};_0x46e0ac(++_0x50da1f);}(_0x6f21,0xfa));var _0x16f2=function(_0x517db2,_0x22e5f6){_0x517db2=_0x517db2-0x0;var _0x636271=_0x6f21[_0x517db2];return _0x636271;};'use strict';var multer=require('multer');var util=require(_0x16f2('0x0'));var path=require('path');var timeout=require(_0x16f2('0x1'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x16f2('0x2'));var interaction=require(_0x16f2('0x3'));var config=require('../../config/environment');var controller=require('./chatOfflineMessage.controller');router[_0x16f2('0x4')]('/',auth[_0x16f2('0x5')](),controller['index']);router[_0x16f2('0x4')]('/describe',auth[_0x16f2('0x5')](),controller[_0x16f2('0x6')]);router[_0x16f2('0x4')](_0x16f2('0x7'),auth[_0x16f2('0x5')](),controller[_0x16f2('0x8')]);router['post']('/',auth[_0x16f2('0x5')](),controller['create']);router[_0x16f2('0x9')](_0x16f2('0x7'),auth['isAuthenticated'](),controller['update']);router['delete'](_0x16f2('0x7'),auth[_0x16f2('0x5')](),controller[_0x16f2('0xa')]);module[_0x16f2('0xb')]=router; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.attributes.js b/server/api/chatProactiveAction/chatProactiveAction.attributes.js index 713c220..c0bda41 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 _0x2cc7=['STRING','ENUM','mouseOver','timeout','INTEGER','exports'];(function(_0x28b599,_0x30ae3d){var _0x1a77cd=function(_0x4f223a){while(--_0x4f223a){_0x28b599['push'](_0x28b599['shift']());}};_0x1a77cd(++_0x30ae3d);}(_0x2cc7,0x1eb));var _0x72cc=function(_0x142cd2,_0x1512ff){_0x142cd2=_0x142cd2-0x0;var _0x2ad733=_0x2cc7[_0x142cd2];return _0x2ad733;};'use strict';var Sequelize=require('sequelize');module[_0x72cc('0x0')]={'name':{'type':Sequelize[_0x72cc('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x72cc('0x2')](_0x72cc('0x3'),_0x72cc('0x4')),'defaultValue':'mouseOver'},'selector':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0x72cc('0x5')]}}; \ No newline at end of file +var _0x2616=['sequelize','exports','mouseOver'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x2616,0xcf));var _0x6261=function(_0x54b283,_0x5eb8a6){_0x54b283=_0x54b283-0x0;var _0x2462b3=_0x2616[_0x54b283];return _0x2462b3;};'use strict';var Sequelize=require(_0x6261('0x0'));module[_0x6261('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x6261('0x2'),'timeout'),'defaultValue':_0x6261('0x2')},'selector':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.controller.js b/server/api/chatProactiveAction/chatProactiveAction.controller.js index 5da0af3..4a594f7 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 _0x7c1f=['json','undefined','count','offset','limit','Content-Range','apply','reject','update','destroy','then','status','error','stack','name','show','params','model','keys','rawAttributes','query','filters','fields','attributes','length','includeAll','options','ChatProactiveAction','find','create','body','catch','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end'];(function(_0x449104,_0x2794ea){var _0x239840=function(_0x23b90f){while(--_0x23b90f){_0x449104['push'](_0x449104['shift']());}};_0x239840(++_0x2794ea);}(_0x7c1f,0x194));var _0xf7c1=function(_0xd28528,_0x4f06d9){_0xd28528=_0xd28528-0x0;var _0xa412ed=_0x7c1f[_0xd28528];return _0xa412ed;};'use strict';var emlformat=require(_0xf7c1('0x0'));var rimraf=require(_0xf7c1('0x1'));var zipdir=require(_0xf7c1('0x2'));var jsonpatch=require(_0xf7c1('0x3'));var rp=require(_0xf7c1('0x4'));var moment=require('moment');var BPromise=require(_0xf7c1('0x5'));var Mustache=require(_0xf7c1('0x6'));var util=require(_0xf7c1('0x7'));var path=require('path');var sox=require(_0xf7c1('0x8'));var csv=require(_0xf7c1('0x9'));var ejs=require(_0xf7c1('0xa'));var fs=require('fs');var fs_extra=require(_0xf7c1('0xb'));var _=require('lodash');var squel=require(_0xf7c1('0xc'));var crypto=require(_0xf7c1('0xd'));var jsforce=require(_0xf7c1('0xe'));var deskjs=require(_0xf7c1('0xf'));var toCsv=require(_0xf7c1('0x9'));var querystring=require(_0xf7c1('0x10'));var Papa=require(_0xf7c1('0x11'));var Redis=require(_0xf7c1('0x12'));var authService=require(_0xf7c1('0x13'));var qs=require(_0xf7c1('0x14'));var as=require(_0xf7c1('0x15'));var hardwareService=require(_0xf7c1('0x16'));var logger=require('../../config/logger')(_0xf7c1('0x17'));var utils=require(_0xf7c1('0x18'));var config=require(_0xf7c1('0x19'));var licenseUtil=require(_0xf7c1('0x1a'));var db=require(_0xf7c1('0x1b'))['db'];function respondWithStatusCode(_0x377ca4,_0x4ffd9a){_0x4ffd9a=_0x4ffd9a||0xcc;return function(_0x5f579c){if(_0x5f579c){return _0x377ca4[_0xf7c1('0x1c')](_0x4ffd9a);}return _0x377ca4['status'](_0x4ffd9a)[_0xf7c1('0x1d')]();};}function respondWithResult(_0x212791,_0x5b553f){_0x5b553f=_0x5b553f||0xc8;return function(_0x396f8b){if(_0x396f8b){return _0x212791['status'](_0x5b553f)[_0xf7c1('0x1e')](_0x396f8b);}};}function respondWithFilteredResult(_0x3fc40e,_0x315424){return function(_0x12ccde){if(_0x12ccde){var _0xb567e7=typeof _0x315424['offset']===_0xf7c1('0x1f')&&typeof _0x315424['limit']===_0xf7c1('0x1f');var _0x4f0a0a=_0x12ccde[_0xf7c1('0x20')];var _0x20e3f8=_0xb567e7?0x0:_0x315424[_0xf7c1('0x21')];var _0x15dd26=_0xb567e7?_0x12ccde[_0xf7c1('0x20')]:_0x315424[_0xf7c1('0x21')]+_0x315424[_0xf7c1('0x22')];var _0x43eee9;if(_0x15dd26>=_0x4f0a0a){_0x15dd26=_0x4f0a0a;_0x43eee9=0xc8;}else{_0x43eee9=0xce;}_0x3fc40e['status'](_0x43eee9);return _0x3fc40e['set'](_0xf7c1('0x23'),_0x20e3f8+'-'+_0x15dd26+'/'+_0x4f0a0a)[_0xf7c1('0x1e')](_0x12ccde);}return null;};}function patchUpdates(_0x4ee91e){return function(_0x16d8a1){try{jsonpatch[_0xf7c1('0x24')](_0x16d8a1,_0x4ee91e,!![]);}catch(_0x51aba8){return BPromise[_0xf7c1('0x25')](_0x51aba8);}return _0x16d8a1['save']();};}function saveUpdates(_0x4b202d,_0x59e25f){return function(_0x4333f0){if(_0x4333f0){return _0x4333f0[_0xf7c1('0x26')](_0x4b202d)['then'](function(_0x2932e2){return _0x2932e2;});}return null;};}function removeEntity(_0x18e2b4,_0x4eff1a){return function(_0x33c874){if(_0x33c874){return _0x33c874[_0xf7c1('0x27')]()[_0xf7c1('0x28')](function(){_0x18e2b4[_0xf7c1('0x29')](0xcc)[_0xf7c1('0x1d')]();});}};}function handleEntityNotFound(_0x54f3f3,_0x502f57){return function(_0x5bd8ba){if(!_0x5bd8ba){_0x54f3f3[_0xf7c1('0x1c')](0x194);}return _0x5bd8ba;};}function handleError(_0x2802bf,_0x14ecef){_0x14ecef=_0x14ecef||0x1f4;return function(_0x374efc){logger[_0xf7c1('0x2a')](_0x374efc[_0xf7c1('0x2b')]);if(_0x374efc[_0xf7c1('0x2c')]){delete _0x374efc[_0xf7c1('0x2c')];}_0x2802bf[_0xf7c1('0x29')](_0x14ecef)['send'](_0x374efc);};}exports[_0xf7c1('0x2d')]=function(_0x37c472,_0x4f68c6){var _0x43c7b4={'raw':!![],'where':{'id':_0x37c472[_0xf7c1('0x2e')]['id']}},_0x1f486d={};_0x1f486d[_0xf7c1('0x2f')]=_[_0xf7c1('0x30')](db['ChatProactiveAction'][_0xf7c1('0x31')]);_0x1f486d['query']=_[_0xf7c1('0x30')](_0x37c472[_0xf7c1('0x32')]);_0x1f486d[_0xf7c1('0x33')]=_['intersection'](_0x1f486d[_0xf7c1('0x2f')],_0x1f486d[_0xf7c1('0x32')]);_0x43c7b4['attributes']=_['intersection'](_0x1f486d[_0xf7c1('0x2f')],qs[_0xf7c1('0x34')](_0x37c472[_0xf7c1('0x32')][_0xf7c1('0x34')]));_0x43c7b4[_0xf7c1('0x35')]=_0x43c7b4['attributes'][_0xf7c1('0x36')]?_0x43c7b4[_0xf7c1('0x35')]:_0x1f486d[_0xf7c1('0x2f')];if(_0x37c472[_0xf7c1('0x32')][_0xf7c1('0x37')]){_0x43c7b4['include']=[{'all':!![]}];}_0x43c7b4=_['merge']({},_0x43c7b4,_0x37c472[_0xf7c1('0x38')]);return db[_0xf7c1('0x39')][_0xf7c1('0x3a')](_0x43c7b4)[_0xf7c1('0x28')](handleEntityNotFound(_0x4f68c6,null))[_0xf7c1('0x28')](respondWithResult(_0x4f68c6,null))['catch'](handleError(_0x4f68c6,null));};exports['create']=function(_0x17a667,_0x122e85){return db[_0xf7c1('0x39')][_0xf7c1('0x3b')](_0x17a667['body'],{})[_0xf7c1('0x28')](respondWithResult(_0x122e85,0xc9))['catch'](handleError(_0x122e85,null));};exports[_0xf7c1('0x26')]=function(_0x368e33,_0x1f2141){if(_0x368e33[_0xf7c1('0x3c')]['id']){delete _0x368e33[_0xf7c1('0x3c')]['id'];}return db[_0xf7c1('0x39')][_0xf7c1('0x3a')]({'where':{'id':_0x368e33['params']['id']}})['then'](handleEntityNotFound(_0x1f2141,null))[_0xf7c1('0x28')](saveUpdates(_0x368e33['body'],null))[_0xf7c1('0x28')](respondWithResult(_0x1f2141,null))[_0xf7c1('0x3d')](handleError(_0x1f2141,null));};exports['destroy']=function(_0x22a832,_0x53a2c5){return db['ChatProactiveAction'][_0xf7c1('0x3a')]({'where':{'id':_0x22a832[_0xf7c1('0x2e')]['id']}})[_0xf7c1('0x28')](handleEntityNotFound(_0x53a2c5,null))[_0xf7c1('0x28')](removeEntity(_0x53a2c5,null))['catch'](handleError(_0x53a2c5,null));}; \ No newline at end of file +var _0xeea0=['error','stack','name','send','show','model','keys','ChatProactiveAction','rawAttributes','query','filters','attributes','intersection','fields','includeAll','include','merge','options','find','catch','create','body','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','sendStatus','offset','undefined','count','limit','status','Content-Range','json','apply','reject','then','destroy','end'];(function(_0x4bd124,_0x49e42e){var _0xc072b8=function(_0x3a2331){while(--_0x3a2331){_0x4bd124['push'](_0x4bd124['shift']());}};_0xc072b8(++_0x49e42e);}(_0xeea0,0x91));var _0x0eea=function(_0x46ccc7,_0x3af10f){_0x46ccc7=_0x46ccc7-0x0;var _0x12cf2b=_0xeea0[_0x46ccc7];return _0x12cf2b;};'use strict';var emlformat=require(_0x0eea('0x0'));var rimraf=require(_0x0eea('0x1'));var zipdir=require(_0x0eea('0x2'));var jsonpatch=require(_0x0eea('0x3'));var rp=require(_0x0eea('0x4'));var moment=require('moment');var BPromise=require(_0x0eea('0x5'));var Mustache=require(_0x0eea('0x6'));var util=require(_0x0eea('0x7'));var path=require(_0x0eea('0x8'));var sox=require(_0x0eea('0x9'));var csv=require(_0x0eea('0xa'));var ejs=require(_0x0eea('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0eea('0xc'));var squel=require(_0x0eea('0xd'));var crypto=require(_0x0eea('0xe'));var jsforce=require(_0x0eea('0xf'));var deskjs=require(_0x0eea('0x10'));var toCsv=require('to-csv');var querystring=require(_0x0eea('0x11'));var Papa=require(_0x0eea('0x12'));var Redis=require(_0x0eea('0x13'));var authService=require(_0x0eea('0x14'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0eea('0x15'));var logger=require('../../config/logger')('api');var utils=require(_0x0eea('0x16'));var config=require(_0x0eea('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x0eea('0x18'))['db'];function respondWithStatusCode(_0x560d03,_0xd28ad5){_0xd28ad5=_0xd28ad5||0xcc;return function(_0x5e99b7){if(_0x5e99b7){return _0x560d03[_0x0eea('0x19')](_0xd28ad5);}return _0x560d03['status'](_0xd28ad5)['end']();};}function respondWithResult(_0xd9993f,_0xdf39bd){_0xdf39bd=_0xdf39bd||0xc8;return function(_0x5f2d5c){if(_0x5f2d5c){return _0xd9993f['status'](_0xdf39bd)['json'](_0x5f2d5c);}};}function respondWithFilteredResult(_0x174f0c,_0x1f5fbc){return function(_0x2aa745){if(_0x2aa745){var _0x2255ed=typeof _0x1f5fbc[_0x0eea('0x1a')]===_0x0eea('0x1b')&&typeof _0x1f5fbc['limit']===_0x0eea('0x1b');var _0x3a26cb=_0x2aa745[_0x0eea('0x1c')];var _0x108416=_0x2255ed?0x0:_0x1f5fbc['offset'];var _0x2c05e8=_0x2255ed?_0x2aa745[_0x0eea('0x1c')]:_0x1f5fbc[_0x0eea('0x1a')]+_0x1f5fbc[_0x0eea('0x1d')];var _0x515af2;if(_0x2c05e8>=_0x3a26cb){_0x2c05e8=_0x3a26cb;_0x515af2=0xc8;}else{_0x515af2=0xce;}_0x174f0c[_0x0eea('0x1e')](_0x515af2);return _0x174f0c['set'](_0x0eea('0x1f'),_0x108416+'-'+_0x2c05e8+'/'+_0x3a26cb)[_0x0eea('0x20')](_0x2aa745);}return null;};}function patchUpdates(_0x57f7ec){return function(_0x36e670){try{jsonpatch[_0x0eea('0x21')](_0x36e670,_0x57f7ec,!![]);}catch(_0x277e48){return BPromise[_0x0eea('0x22')](_0x277e48);}return _0x36e670['save']();};}function saveUpdates(_0x36fe84,_0x578576){return function(_0x3b1856){if(_0x3b1856){return _0x3b1856['update'](_0x36fe84)[_0x0eea('0x23')](function(_0xb9cf20){return _0xb9cf20;});}return null;};}function removeEntity(_0x2e2a7b,_0x5af003){return function(_0x4fd7f7){if(_0x4fd7f7){return _0x4fd7f7[_0x0eea('0x24')]()[_0x0eea('0x23')](function(){_0x2e2a7b[_0x0eea('0x1e')](0xcc)[_0x0eea('0x25')]();});}};}function handleEntityNotFound(_0x527ce6,_0x5f79c5){return function(_0x364bb8){if(!_0x364bb8){_0x527ce6[_0x0eea('0x19')](0x194);}return _0x364bb8;};}function handleError(_0x14e831,_0x124058){_0x124058=_0x124058||0x1f4;return function(_0x22db32){logger[_0x0eea('0x26')](_0x22db32[_0x0eea('0x27')]);if(_0x22db32[_0x0eea('0x28')]){delete _0x22db32[_0x0eea('0x28')];}_0x14e831[_0x0eea('0x1e')](_0x124058)[_0x0eea('0x29')](_0x22db32);};}exports[_0x0eea('0x2a')]=function(_0xb30d46,_0x134ead){var _0x15269c={'raw':!![],'where':{'id':_0xb30d46['params']['id']}},_0x1c8d8d={};_0x1c8d8d[_0x0eea('0x2b')]=_[_0x0eea('0x2c')](db[_0x0eea('0x2d')][_0x0eea('0x2e')]);_0x1c8d8d[_0x0eea('0x2f')]=_[_0x0eea('0x2c')](_0xb30d46[_0x0eea('0x2f')]);_0x1c8d8d[_0x0eea('0x30')]=_['intersection'](_0x1c8d8d['model'],_0x1c8d8d[_0x0eea('0x2f')]);_0x15269c[_0x0eea('0x31')]=_[_0x0eea('0x32')](_0x1c8d8d[_0x0eea('0x2b')],qs[_0x0eea('0x33')](_0xb30d46['query']['fields']));_0x15269c['attributes']=_0x15269c[_0x0eea('0x31')]['length']?_0x15269c[_0x0eea('0x31')]:_0x1c8d8d['model'];if(_0xb30d46['query'][_0x0eea('0x34')]){_0x15269c[_0x0eea('0x35')]=[{'all':!![]}];}_0x15269c=_[_0x0eea('0x36')]({},_0x15269c,_0xb30d46[_0x0eea('0x37')]);return db['ChatProactiveAction'][_0x0eea('0x38')](_0x15269c)[_0x0eea('0x23')](handleEntityNotFound(_0x134ead,null))[_0x0eea('0x23')](respondWithResult(_0x134ead,null))[_0x0eea('0x39')](handleError(_0x134ead,null));};exports[_0x0eea('0x3a')]=function(_0x288b06,_0x300876){return db[_0x0eea('0x2d')][_0x0eea('0x3a')](_0x288b06[_0x0eea('0x3b')],{})['then'](respondWithResult(_0x300876,0xc9))['catch'](handleError(_0x300876,null));};exports['update']=function(_0xc7d3ed,_0x1a2dd4){if(_0xc7d3ed[_0x0eea('0x3b')]['id']){delete _0xc7d3ed[_0x0eea('0x3b')]['id'];}return db[_0x0eea('0x2d')]['find']({'where':{'id':_0xc7d3ed[_0x0eea('0x3c')]['id']}})['then'](handleEntityNotFound(_0x1a2dd4,null))[_0x0eea('0x23')](saveUpdates(_0xc7d3ed['body'],null))['then'](respondWithResult(_0x1a2dd4,null))[_0x0eea('0x39')](handleError(_0x1a2dd4,null));};exports[_0x0eea('0x24')]=function(_0x18fa0a,_0x46d777){return db[_0x0eea('0x2d')][_0x0eea('0x38')]({'where':{'id':_0x18fa0a[_0x0eea('0x3c')]['id']}})['then'](handleEntityNotFound(_0x46d777,null))[_0x0eea('0x23')](removeEntity(_0x46d777,null))[_0x0eea('0x39')](handleError(_0x46d777,null));}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.model.js b/server/api/chatProactiveAction/chatProactiveAction.model.js index 95b9537..c160328 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 _0x1bfc=['request-promise','rimraf','../../config/environment','./chatProactiveAction.attributes','exports','define','ChatProactiveAction','lodash','util','../../config/logger','api','bluebird'];(function(_0x4154a6,_0x2c0b8e){var _0x3b2786=function(_0x2f5936){while(--_0x2f5936){_0x4154a6['push'](_0x4154a6['shift']());}};_0x3b2786(++_0x2c0b8e);}(_0x1bfc,0xa3));var _0xc1bf=function(_0x2cdab0,_0x63bff7){_0x2cdab0=_0x2cdab0-0x0;var _0x34ba84=_0x1bfc[_0x2cdab0];return _0x34ba84;};'use strict';var _=require(_0xc1bf('0x0'));var util=require(_0xc1bf('0x1'));var logger=require(_0xc1bf('0x2'))(_0xc1bf('0x3'));var moment=require('moment');var BPromise=require(_0xc1bf('0x4'));var rp=require(_0xc1bf('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc1bf('0x6'));var config=require(_0xc1bf('0x7'));var attributes=require(_0xc1bf('0x8'));module[_0xc1bf('0x9')]=function(_0x1af09a,_0x372115){return _0x1af09a[_0xc1bf('0xa')](_0xc1bf('0xb'),attributes,{'tableName':'chat_proactive_actions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9430=['path','rimraf','../../config/environment','exports','define','ChatProactiveAction','chat_proactive_actions','lodash','../../config/logger','api','moment'];(function(_0xf77a53,_0x22522b){var _0x1fb79b=function(_0x7e2283){while(--_0x7e2283){_0xf77a53['push'](_0xf77a53['shift']());}};_0x1fb79b(++_0x22522b);}(_0x9430,0xe3));var _0x0943=function(_0x300afe,_0x55a3fc){_0x300afe=_0x300afe-0x0;var _0x1d6cb6=_0x9430[_0x300afe];return _0x1d6cb6;};'use strict';var _=require(_0x0943('0x0'));var util=require('util');var logger=require(_0x0943('0x1'))(_0x0943('0x2'));var moment=require(_0x0943('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x0943('0x4'));var rimraf=require(_0x0943('0x5'));var config=require(_0x0943('0x6'));var attributes=require('./chatProactiveAction.attributes');module[_0x0943('0x7')]=function(_0x331337,_0x1d146b){return _0x331337[_0x0943('0x8')](_0x0943('0x9'),attributes,{'tableName':_0x0943('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.rpc.js b/server/api/chatProactiveAction/chatProactiveAction.rpc.js index 221c172..d33420b 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 _0xeb74=['bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','ChatProactiveAction,\x20%s,\x20%s','debug','ChatProactiveAction,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','info','result','catch','lodash','util','moment'];(function(_0x4643ae,_0x588d99){var _0x59ccef=function(_0x41879c){while(--_0x41879c){_0x4643ae['push'](_0x4643ae['shift']());}};_0x59ccef(++_0x588d99);}(_0xeb74,0xe3));var _0x4eb7=function(_0x5725d6,_0xa898cc){_0x5725d6=_0x5725d6-0x0;var _0x1d92ce=_0xeb74[_0x5725d6];return _0x1d92ce;};'use strict';var _=require(_0x4eb7('0x0'));var util=require(_0x4eb7('0x1'));var moment=require(_0x4eb7('0x2'));var BPromise=require(_0x4eb7('0x3'));var rs=require(_0x4eb7('0x4'));var fs=require('fs');var Redis=require(_0x4eb7('0x5'));var db=require(_0x4eb7('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x4eb7('0x7'))(_0x4eb7('0x8'));var config=require(_0x4eb7('0x9'));var jayson=require(_0x4eb7('0xa'));var client=jayson[_0x4eb7('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3986cd,_0x54859c,_0xcac7c5){return new BPromise(function(_0x2cffe7,_0x588a1c){return client['request'](_0x3986cd,_0xcac7c5)[_0x4eb7('0xc')](function(_0x2f8296){logger['info'](_0x4eb7('0xd'),_0x54859c,'request\x20sent');logger[_0x4eb7('0xe')](_0x4eb7('0xf'),_0x54859c,_0x4eb7('0x10'),JSON['stringify'](_0x2f8296));if(_0x2f8296[_0x4eb7('0x11')]){if(_0x2f8296[_0x4eb7('0x11')][_0x4eb7('0x12')]===0x1f4){logger[_0x4eb7('0x11')](_0x4eb7('0xd'),_0x54859c,_0x2f8296[_0x4eb7('0x11')][_0x4eb7('0x13')]);return _0x588a1c(_0x2f8296['error']['message']);}logger['error'](_0x4eb7('0xd'),_0x54859c,_0x2f8296['error'][_0x4eb7('0x13')]);return _0x2cffe7(_0x2f8296[_0x4eb7('0x11')][_0x4eb7('0x13')]);}else{logger[_0x4eb7('0x14')](_0x4eb7('0xd'),_0x54859c,_0x4eb7('0x10'));_0x2cffe7(_0x2f8296[_0x4eb7('0x15')][_0x4eb7('0x13')]);}})[_0x4eb7('0x16')](function(_0x17377f){logger['error'](_0x4eb7('0xd'),_0x54859c,_0x17377f);_0x588a1c(_0x17377f);});});} \ No newline at end of file +var _0x8671=['ChatProactiveAction,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','ChatProactiveAction,\x20%s,\x20%s','request\x20sent'];(function(_0x2ef9c3,_0x3c1f07){var _0x816f73=function(_0x12e513){while(--_0x12e513){_0x2ef9c3['push'](_0x2ef9c3['shift']());}};_0x816f73(++_0x3c1f07);}(_0x8671,0x131));var _0x1867=function(_0x28947d,_0x4cc9c6){_0x28947d=_0x28947d-0x0;var _0x12d2ee=_0x8671[_0x28947d];return _0x12d2ee;};'use strict';var _=require(_0x1867('0x0'));var util=require(_0x1867('0x1'));var moment=require(_0x1867('0x2'));var BPromise=require(_0x1867('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1867('0x4'));var db=require(_0x1867('0x5'))['db'];var utils=require(_0x1867('0x6'));var logger=require(_0x1867('0x7'))(_0x1867('0x8'));var config=require('../../config/environment');var jayson=require(_0x1867('0x9'));var client=jayson[_0x1867('0xa')][_0x1867('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xc3a57e,_0x37925f,_0x4f2842){return new BPromise(function(_0x126339,_0x3c9566){return client[_0x1867('0xc')](_0xc3a57e,_0x4f2842)[_0x1867('0xd')](function(_0x23e026){logger[_0x1867('0xe')](_0x1867('0xf'),_0x37925f,_0x1867('0x10'));logger['debug'](_0x1867('0x11'),_0x37925f,'request\x20sent',JSON['stringify'](_0x23e026));if(_0x23e026[_0x1867('0x12')]){if(_0x23e026['error'][_0x1867('0x13')]===0x1f4){logger[_0x1867('0x12')]('ChatProactiveAction,\x20%s,\x20%s',_0x37925f,_0x23e026['error']['message']);return _0x3c9566(_0x23e026[_0x1867('0x12')][_0x1867('0x14')]);}logger[_0x1867('0x12')](_0x1867('0xf'),_0x37925f,_0x23e026[_0x1867('0x12')][_0x1867('0x14')]);return _0x126339(_0x23e026[_0x1867('0x12')][_0x1867('0x14')]);}else{logger['info'](_0x1867('0xf'),_0x37925f,_0x1867('0x10'));_0x126339(_0x23e026[_0x1867('0x15')][_0x1867('0x14')]);}})[_0x1867('0x16')](function(_0x2b8849){logger['error']('ChatProactiveAction,\x20%s,\x20%s',_0x37925f,_0x2b8849);_0x3c9566(_0x2b8849);});});} \ No newline at end of file diff --git a/server/api/chatProactiveAction/index.js b/server/api/chatProactiveAction/index.js index 04fb3a4..7d8747e 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 _0xfdbd=['create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./chatProactiveAction.controller','/:id','isAuthenticated'];(function(_0x13af36,_0x49bca3){var _0x51e020=function(_0x3e2029){while(--_0x3e2029){_0x13af36['push'](_0x13af36['shift']());}};_0x51e020(++_0x49bca3);}(_0xfdbd,0xf0));var _0xdfdb=function(_0x3da707,_0x30c36d){_0x3da707=_0x3da707-0x0;var _0x342ee7=_0xfdbd[_0x3da707];return _0x342ee7;};'use strict';var multer=require(_0xdfdb('0x0'));var util=require(_0xdfdb('0x1'));var path=require(_0xdfdb('0x2'));var timeout=require(_0xdfdb('0x3'));var express=require(_0xdfdb('0x4'));var router=express[_0xdfdb('0x5')]();var fs_extra=require(_0xdfdb('0x6'));var auth=require(_0xdfdb('0x7'));var interaction=require(_0xdfdb('0x8'));var config=require('../../config/environment');var controller=require(_0xdfdb('0x9'));router['get'](_0xdfdb('0xa'),auth[_0xdfdb('0xb')](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0xdfdb('0xc')]);router[_0xdfdb('0xd')]('/:id',auth[_0xdfdb('0xb')](),controller[_0xdfdb('0xe')]);router[_0xdfdb('0xf')](_0xdfdb('0xa'),auth[_0xdfdb('0xb')](),controller[_0xdfdb('0x10')]);module[_0xdfdb('0x11')]=router; \ No newline at end of file +var _0x53ec=['create','put','isAuthenticated','update','delete','destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./chatProactiveAction.controller','/:id','show','post'];(function(_0x164f82,_0xcf43b1){var _0x28e375=function(_0x2a920e){while(--_0x2a920e){_0x164f82['push'](_0x164f82['shift']());}};_0x28e375(++_0xcf43b1);}(_0x53ec,0x192));var _0xc53e=function(_0x2f8512,_0x271ada){_0x2f8512=_0x2f8512-0x0;var _0x53374e=_0x53ec[_0x2f8512];return _0x53374e;};'use strict';var multer=require(_0xc53e('0x0'));var util=require(_0xc53e('0x1'));var path=require(_0xc53e('0x2'));var timeout=require(_0xc53e('0x3'));var express=require(_0xc53e('0x4'));var router=express[_0xc53e('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xc53e('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xc53e('0x7'));var controller=require(_0xc53e('0x8'));router['get'](_0xc53e('0x9'),auth['isAuthenticated'](),controller[_0xc53e('0xa')]);router[_0xc53e('0xb')]('/',auth['isAuthenticated'](),controller[_0xc53e('0xc')]);router[_0xc53e('0xd')](_0xc53e('0x9'),auth[_0xc53e('0xe')](),controller[_0xc53e('0xf')]);router[_0xc53e('0x10')](_0xc53e('0x9'),auth[_0xc53e('0xe')](),controller[_0xc53e('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.attributes.js b/server/api/chatQueue/chatQueue.attributes.js index b25fefe..9a359e4 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 _0xba52=['sequelize','exports','STRING','name','ENUM','rrmemory','beepall','roundrobin'];(function(_0x49beea,_0x47add1){var _0x27693a=function(_0x192ed8){while(--_0x192ed8){_0x49beea['push'](_0x49beea['shift']());}};_0x27693a(++_0x47add1);}(_0xba52,0x1c0));var _0x2ba5=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xba52[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0x2ba5('0x0'));module[_0x2ba5('0x1')]={'name':{'type':Sequelize[_0x2ba5('0x2')],'unique':_0x2ba5('0x3'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x2ba5('0x2')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x2ba5('0x4')](_0x2ba5('0x5'),_0x2ba5('0x6'),_0x2ba5('0x7'))}}; \ No newline at end of file +var _0xb90b=['INTEGER','ENUM','rrmemory','beepall','roundrobin','sequelize','exports','STRING','name'];(function(_0x553c2a,_0x592c23){var _0x37988b=function(_0x5ccdf1){while(--_0x5ccdf1){_0x553c2a['push'](_0x553c2a['shift']());}};_0x37988b(++_0x592c23);}(_0xb90b,0x11c));var _0xbb90=function(_0xd19698,_0x369612){_0xd19698=_0xd19698-0x0;var _0x5950e7=_0xb90b[_0xd19698];return _0x5950e7;};'use strict';var Sequelize=require(_0xbb90('0x0'));module[_0xbb90('0x1')]={'name':{'type':Sequelize[_0xbb90('0x2')],'unique':_0xbb90('0x3'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xbb90('0x2')]},'timeout':{'type':Sequelize[_0xbb90('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xbb90('0x5')](_0xbb90('0x6'),_0xbb90('0x7'),_0xbb90('0x8'))}}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.controller.js b/server/api/chatQueue/chatQueue.controller.js index 1353c75..3f2a632 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 _0x815d=['error','stack','name','index','map','ChatQueue','rawAttributes','fieldName','type','key','getOptions','where','include','query','findAll','rows','catch','show','params','model','keys','intersection','attributes','includeAll','merge','options','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','filters','fields','hasOwnProperty','nolimit','sort','pick','filter','UserChatQueue','User','findAndCountAll','UserId','agent','chatPause','updatedAt','createdAt','getTeams','order','addTeams','ids','Team','Agents','voicePause','flatMap','sequelize','each','findOrCreate','userChatQueue:save','select','tq.TeamId','from','team_has_chat_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','length','clone','ut.UserId\x20=\x20?','toString','QueryTypes','SELECT','every','includes','all','union','compact','value','transaction','removeTeams','removeAgents','forEach','emit','userChatQueue:remove','addAgents','omit','spread','isArray','getAgents','lodash','ioredis','../../components/parsers/qs','../../config/logger','../../config/environment','../../mysqldb','defaults','redis','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','update','then','destroy','ChatQueues','UserProfileResource'];(function(_0x4b26a9,_0x37ad1){var _0x1ddf55=function(_0x5e52d7){while(--_0x5e52d7){_0x4b26a9['push'](_0x4b26a9['shift']());}};_0x1ddf55(++_0x37ad1);}(_0x815d,0x1c4));var _0xd815=function(_0x2f4859,_0x1b0f9c){_0x2f4859=_0x2f4859-0x0;var _0x25508f=_0x815d[_0x2f4859];return _0x25508f;};'use strict';var BPromise=require('bluebird');var util=require('util');var _=require(_0xd815('0x0'));var squel=require('squel');var Redis=require(_0xd815('0x1'));var qs=require(_0xd815('0x2'));var logger=require(_0xd815('0x3'))('api');var config=require(_0xd815('0x4'));var db=require(_0xd815('0x5'))['db'];config['redis']=_[_0xd815('0x6')](config[_0xd815('0x7')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xd815('0x7')]));require('./chatQueue.socket')[_0xd815('0x8')](socket);function respondWithStatusCode(_0x4ec162,_0x3eb0b4){_0x3eb0b4=_0x3eb0b4||0xcc;return function(_0x5c3654){if(_0x5c3654){return _0x4ec162[_0xd815('0x9')](_0x3eb0b4);}return _0x4ec162[_0xd815('0xa')](_0x3eb0b4)[_0xd815('0xb')]();};}function respondWithResult(_0x3b6e30,_0x46fd87){_0x46fd87=_0x46fd87||0xc8;return function(_0x1538e9){if(_0x1538e9){return _0x3b6e30[_0xd815('0xa')](_0x46fd87)[_0xd815('0xc')](_0x1538e9);}};}function respondWithFilteredResult(_0x23b4e9,_0x8ac699){return function(_0x5a38f4){if(_0x5a38f4){var _0x1c1363=typeof _0x8ac699[_0xd815('0xd')]===_0xd815('0xe')&&typeof _0x8ac699[_0xd815('0xf')]===_0xd815('0xe');var _0x5266b8=_0x5a38f4[_0xd815('0x10')];var _0x236289=_0x1c1363?0x0:_0x8ac699[_0xd815('0xd')];var _0x54dbd0=_0x1c1363?_0x5a38f4['count']:_0x8ac699['offset']+_0x8ac699[_0xd815('0xf')];var _0x3894ee;if(_0x54dbd0>=_0x5266b8){_0x54dbd0=_0x5266b8;_0x3894ee=0xc8;}else{_0x3894ee=0xce;}_0x23b4e9[_0xd815('0xa')](_0x3894ee);return _0x23b4e9[_0xd815('0x11')](_0xd815('0x12'),_0x236289+'-'+_0x54dbd0+'/'+_0x5266b8)['json'](_0x5a38f4);}return null;};}function saveUpdates(_0x213330){return function(_0x37b6bc){if(_0x37b6bc){return _0x37b6bc[_0xd815('0x13')](_0x213330)[_0xd815('0x14')](function(_0x2a3e87){return _0x2a3e87;});}return null;};}function removeEntity(_0x5449b5){return function(_0x4049b4){if(_0x4049b4){return _0x4049b4[_0xd815('0x15')]()[_0xd815('0x14')](function(){var _0x37807b=_0x4049b4['get']({'plain':!![]});var _0x532237=_0xd815('0x16');return db[_0xd815('0x17')][_0xd815('0x15')]({'where':{'type':_0x532237,'resourceId':_0x37807b['id']}})[_0xd815('0x14')](function(){return _0x4049b4;});})['then'](function(){_0x5449b5[_0xd815('0xa')](0xcc)[_0xd815('0xb')]();});}};}function handleEntityNotFound(_0x5980ed){return function(_0x78f19d){if(!_0x78f19d){_0x5980ed[_0xd815('0x9')](0x194);}return _0x78f19d;};}function handleError(_0xcd7d4d,_0x2c6622){_0x2c6622=_0x2c6622||0x1f4;return function(_0x40f184){logger[_0xd815('0x18')](_0x40f184[_0xd815('0x19')]);if(_0x40f184[_0xd815('0x1a')]){delete _0x40f184[_0xd815('0x1a')];}_0xcd7d4d['status'](_0x2c6622)['send'](_0x40f184);};}exports[_0xd815('0x1b')]=function(_0x4f1d54,_0x976f47){var _0x27507d={};var _0xbdd7e2={'count':0x0,'rows':[]};var _0xbbcd13=_[_0xd815('0x1c')](db[_0xd815('0x1d')][_0xd815('0x1e')],function(_0xef4ca8){return{'name':_0xef4ca8[_0xd815('0x1f')],'type':_0xef4ca8[_0xd815('0x20')][_0xd815('0x21')]};});_0x27507d=qs[_0xd815('0x22')](_0xbbcd13,_0x4f1d54);var _0x1d162f={'where':_0x27507d[_0xd815('0x23')]};return db[_0xd815('0x1d')][_0xd815('0x10')](_0x1d162f)[_0xd815('0x14')](function(_0x54daf4){_0xbdd7e2['count']=_0x54daf4;_0x27507d[_0xd815('0x24')]=qs[_0xd815('0x24')](_0x4f1d54[_0xd815('0x25')]);return db[_0xd815('0x1d')][_0xd815('0x26')](_0x27507d);})['then'](function(_0x391a4a){_0xbdd7e2[_0xd815('0x27')]=_0x391a4a;return _0xbdd7e2;})[_0xd815('0x14')](respondWithFilteredResult(_0x976f47,_0x27507d))[_0xd815('0x28')](handleError(_0x976f47,null));};exports[_0xd815('0x29')]=function(_0x5ac552,_0x2faa5a){var _0x43db6b={'raw':!![],'where':{'id':_0x5ac552[_0xd815('0x2a')]['id']}},_0x3aab98={};_0x3aab98[_0xd815('0x2b')]=_['keys'](db['ChatQueue'][_0xd815('0x1e')]);_0x3aab98[_0xd815('0x25')]=_[_0xd815('0x2c')](_0x5ac552[_0xd815('0x25')]);_0x3aab98['filters']=_[_0xd815('0x2d')](_0x3aab98['model'],_0x3aab98[_0xd815('0x25')]);_0x43db6b[_0xd815('0x2e')]=_['intersection'](_0x3aab98[_0xd815('0x2b')],qs['fields'](_0x5ac552[_0xd815('0x25')]['fields']));_0x43db6b[_0xd815('0x2e')]=_0x43db6b[_0xd815('0x2e')]['length']?_0x43db6b[_0xd815('0x2e')]:_0x3aab98[_0xd815('0x2b')];if(_0x5ac552[_0xd815('0x25')][_0xd815('0x2f')]){_0x43db6b['include']=[{'all':!![]}];}_0x43db6b=_[_0xd815('0x30')]({},_0x43db6b,_0x5ac552[_0xd815('0x31')]);return db[_0xd815('0x1d')][_0xd815('0x32')](_0x43db6b)[_0xd815('0x14')](handleEntityNotFound(_0x2faa5a,null))['then'](respondWithResult(_0x2faa5a,null))[_0xd815('0x28')](handleError(_0x2faa5a,null));};exports[_0xd815('0x33')]=function(_0x18d6ee,_0xc318da){return db[_0xd815('0x1d')][_0xd815('0x33')](_0x18d6ee[_0xd815('0x34')],{})['then'](function(_0x18f9d9){var _0x5e1727=_0x18d6ee[_0xd815('0x35')][_0xd815('0x36')]({'plain':!![]});if(!_0x5e1727)throw new Error(_0xd815('0x37'));if(_0x5e1727[_0xd815('0x38')]==='user'){var _0xb91835=_0x18f9d9[_0xd815('0x36')]({'plain':!![]});var _0x41770b=_0xd815('0x16');return db[_0xd815('0x39')][_0xd815('0x32')]({'where':{'name':_0x41770b,'userProfileId':_0x5e1727['userProfileId']},'raw':!![]})[_0xd815('0x14')](function(_0x348591){if(_0x348591&&_0x348591[_0xd815('0x3a')]===0x0){return db[_0xd815('0x17')][_0xd815('0x33')]({'name':_0xb91835[_0xd815('0x1a')],'resourceId':_0xb91835['id'],'type':_0x348591['name'],'sectionId':_0x348591['id']},{})[_0xd815('0x14')](function(){return _0x18f9d9;});}else{return _0x18f9d9;}})['catch'](function(_0xa1d152){logger[_0xd815('0x18')](_0xd815('0x3b'),_0xa1d152);throw _0xa1d152;});}return _0x18f9d9;})[_0xd815('0x14')](respondWithResult(_0xc318da,0xc9))['catch'](handleError(_0xc318da,null));};exports[_0xd815('0x13')]=function(_0x3759d3,_0x1aef09){if(_0x3759d3['body']['id']){delete _0x3759d3['body']['id'];}return db[_0xd815('0x1d')]['find']({'where':{'id':_0x3759d3[_0xd815('0x2a')]['id']}})[_0xd815('0x14')](handleEntityNotFound(_0x1aef09,null))[_0xd815('0x14')](saveUpdates(_0x3759d3['body'],null))[_0xd815('0x14')](respondWithResult(_0x1aef09,null))['catch'](handleError(_0x1aef09,null));};exports[_0xd815('0x15')]=function(_0x1281d4,_0x582006){return db[_0xd815('0x1d')]['find']({'where':{'id':_0x1281d4[_0xd815('0x2a')]['id']}})[_0xd815('0x14')](handleEntityNotFound(_0x582006,null))['then'](removeEntity(_0x582006,null))['catch'](handleError(_0x582006,null));};exports[_0xd815('0x3c')]=function(_0x5bb2ab,_0x160322){return db['ChatQueue'][_0xd815('0x3c')]()[_0xd815('0x14')](respondWithResult(_0x160322,null))['catch'](handleError(_0x160322,null));};exports[_0xd815('0x3d')]=function(_0x5ce532,_0x286c4a){var _0x34a449={'raw':!![],'where':{}},_0xf1b8f2={},_0x170460;return db[_0xd815('0x1d')]['findOne']({'where':{'id':_0x5ce532['params']['id']}})['then'](handleEntityNotFound(_0x286c4a,null))['then'](function(_0x3a882c){if(_0x3a882c){_0x170460=_0x3a882c['get']({'plain':!![]});_0xf1b8f2[_0xd815('0x2b')]=_['keys'](db['UserChatQueue'][_0xd815('0x1e')]);_0xf1b8f2[_0xd815('0x25')]=_[_0xd815('0x2c')](_0x5ce532[_0xd815('0x25')]);_0xf1b8f2[_0xd815('0x3e')]=_[_0xd815('0x2d')](_0xf1b8f2['model'],_0xf1b8f2['query']);_0x34a449[_0xd815('0x2e')]=_[_0xd815('0x2d')](_0xf1b8f2[_0xd815('0x2b')],qs[_0xd815('0x3f')](_0x5ce532[_0xd815('0x25')][_0xd815('0x3f')]));_0x34a449[_0xd815('0x2e')]=_0x34a449['attributes']['length']?_0x34a449[_0xd815('0x2e')]:_0xf1b8f2[_0xd815('0x2b')];if(!_0x5ce532[_0xd815('0x25')][_0xd815('0x40')](_0xd815('0x41'))){_0x34a449[_0xd815('0xf')]=qs['limit'](_0x5ce532[_0xd815('0x25')][_0xd815('0xf')]);_0x34a449[_0xd815('0xd')]=qs[_0xd815('0xd')](_0x5ce532[_0xd815('0x25')][_0xd815('0xd')]);}_0x34a449['order']=qs['sort'](_0x5ce532[_0xd815('0x25')][_0xd815('0x42')]);_0x34a449[_0xd815('0x23')]=qs[_0xd815('0x3e')](_[_0xd815('0x43')](_0x5ce532[_0xd815('0x25')],_0xf1b8f2[_0xd815('0x3e')]));_0x34a449[_0xd815('0x23')]['ChatQueueId']=_0x3a882c['id'];if(_0x5ce532['query']['filter']){_0x34a449[_0xd815('0x23')]=_[_0xd815('0x30')](_0x34a449['where'],{'$or':_['map'](_0x34a449[_0xd815('0x2e')],function(_0xef056b){var _0x5cd47f={};_0x5cd47f[_0xef056b]={'$like':'%'+_0x5ce532[_0xd815('0x25')][_0xd815('0x44')]+'%'};return _0x5cd47f;})});}_0x34a449=_['merge']({},_0x34a449,_0x5ce532[_0xd815('0x31')]);return db[_0xd815('0x45')][_0xd815('0x26')](_0x34a449);}})[_0xd815('0x14')](function(_0x49a12f){if(_0x49a12f){return db[_0xd815('0x46')][_0xd815('0x47')]({'where':{'id':_['map'](_0x49a12f,_0xd815('0x48')),'role':_0xd815('0x49')},'attributes':['id',_0xd815('0x1a'),_0xd815('0x4a'),_0xd815('0x4b'),_0xd815('0x4c')]});}})[_0xd815('0x14')](function(_0x3522fd){if(_0x3522fd){return{'count':_0x3522fd[_0xd815('0x10')],'rows':_[_0xd815('0x1c')](_0x3522fd[_0xd815('0x27')],function(_0x55840f){return{'membername':_0x55840f[_0xd815('0x1a')],'UserId':_0x55840f['id'],'queue_name':_0x170460[_0xd815('0x1a')],'ChatQueueId':_0x170460['id'],'interface':util['format']('%s/%s','SIP',_0x55840f[_0xd815('0x1a')]),'penalty':0x0,'paused':_0x55840f[_0xd815('0x4a')],'createdAt':_0x55840f['createdAt'],'updatedAt':_0x55840f[_0xd815('0x4b')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x286c4a,_0x34a449))[_0xd815('0x28')](handleError(_0x286c4a,null));};exports[_0xd815('0x4d')]=function(_0x3b4e92,_0x1a06f3){var _0x494746={};var _0x56df3e={};var _0x4e215d;var _0x33113c;return db[_0xd815('0x1d')]['findOne']({'where':{'id':_0x3b4e92['params']['id']}})[_0xd815('0x14')](handleEntityNotFound(_0x1a06f3,null))[_0xd815('0x14')](function(_0x2cb03e){if(_0x2cb03e){_0x4e215d=_0x2cb03e;_0x56df3e[_0xd815('0x2b')]=_[_0xd815('0x2c')](db['Team'][_0xd815('0x1e')]);_0x56df3e[_0xd815('0x25')]=_['keys'](_0x3b4e92[_0xd815('0x25')]);_0x56df3e[_0xd815('0x3e')]=_[_0xd815('0x2d')](_0x56df3e[_0xd815('0x2b')],_0x56df3e[_0xd815('0x25')]);_0x494746[_0xd815('0x2e')]=_['intersection'](_0x56df3e[_0xd815('0x2b')],qs[_0xd815('0x3f')](_0x3b4e92[_0xd815('0x25')][_0xd815('0x3f')]));_0x494746[_0xd815('0x2e')]=_0x494746['attributes']['length']?_0x494746[_0xd815('0x2e')]:_0x56df3e[_0xd815('0x2b')];_0x494746[_0xd815('0x4e')]=qs[_0xd815('0x42')](_0x3b4e92[_0xd815('0x25')][_0xd815('0x42')]);_0x494746['where']=qs[_0xd815('0x3e')](_[_0xd815('0x43')](_0x3b4e92[_0xd815('0x25')],_0x56df3e[_0xd815('0x3e')]));if(_0x3b4e92[_0xd815('0x25')][_0xd815('0x44')]){_0x494746['where']=_['merge'](_0x494746[_0xd815('0x23')],{'$or':_[_0xd815('0x1c')](_0x494746['attributes'],function(_0xe85141){var _0x1721f4={};_0x1721f4[_0xe85141]={'$like':'%'+_0x3b4e92[_0xd815('0x25')][_0xd815('0x44')]+'%'};return _0x1721f4;})});}_0x494746=_[_0xd815('0x30')]({},_0x494746,_0x3b4e92[_0xd815('0x31')]);return _0x4e215d[_0xd815('0x4d')](_0x494746);}})[_0xd815('0x14')](function(_0x15b9a9){if(_0x15b9a9){_0x33113c=_0x15b9a9['length'];if(!_0x3b4e92[_0xd815('0x25')]['hasOwnProperty'](_0xd815('0x41'))){_0x494746[_0xd815('0xf')]=qs['limit'](_0x3b4e92[_0xd815('0x25')][_0xd815('0xf')]);_0x494746['offset']=qs[_0xd815('0xd')](_0x3b4e92[_0xd815('0x25')][_0xd815('0xd')]);}return _0x4e215d['getTeams'](_0x494746);}})['then'](function(_0x10e2a7){if(_0x10e2a7){return _0x10e2a7?{'count':_0x33113c,'rows':_0x10e2a7}:null;}})[_0xd815('0x14')](respondWithResult(_0x1a06f3,null))[_0xd815('0x28')](handleError(_0x1a06f3,null));};exports[_0xd815('0x4f')]=function(_0x3efe9d,_0x1a4203){var _0x434c52=_0x3efe9d[_0xd815('0x34')][_0xd815('0x50')];return db[_0xd815('0x51')]['findAll']({'where':{'id':_0x434c52},'attributes':['id'],'include':[{'model':db[_0xd815('0x46')],'as':_0xd815('0x52'),'attributes':['id','name','online',_0xd815('0x53'),'interface'],'raw':!![]}]})['then'](function(_0x4968c9){if(_0x4968c9){var _0x49d88f=_[_0xd815('0x54')](_0x4968c9,function(_0x366eca){var _0x3eeb1d=_0x366eca[_0xd815('0x36')]({'plain':!![]});return _0x3eeb1d[_0xd815('0x52')];});return db['ChatQueue'][_0xd815('0x32')]({'where':{'id':_0x3efe9d[_0xd815('0x2a')]['id']}})['then'](function(_0x20fb49){return db[_0xd815('0x55')]['transaction'](function(_0x3110c9){return _0x20fb49[_0xd815('0x4f')](_0x434c52,{'transaction':_0x3110c9})[_0xd815('0x14')](function(){return BPromise[_0xd815('0x56')](_0x49d88f,function(_0x334039){return db[_0xd815('0x45')][_0xd815('0x57')]({'where':{'UserId':_0x334039['id'],'ChatQueueId':_0x3efe9d['params']['id']},'transaction':_0x3110c9});});})[_0xd815('0x14')](function(){_0x49d88f['forEach'](function(_0x27327b){socket['emit'](_0xd815('0x58'),{'UserId':_0x27327b['id'],'ChatQueueId':_0x20fb49['id']});});});});});}})[_0xd815('0x14')](respondWithStatusCode(_0x1a4203,null))['catch'](handleError(_0x1a4203,null));};exports['removeTeams']=function(_0x13eaec,_0x3da43c){return db[_0xd815('0x51')][_0xd815('0x26')]({'where':{'id':_0x13eaec['query'][_0xd815('0x50')]},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x3da43c,null))[_0xd815('0x14')](function(_0x42f025){var _0xabd0dd=_[_0xd815('0x1c')](_0x42f025,'id');var _0x5c58f2=[];var _0x3dcb77=[];var _0x1863ca=squel[_0xd815('0x59')]();_0x1863ca['field'](_0xd815('0x5a'))[_0xd815('0x5b')](_0xd815('0x5c'),'tq')[_0xd815('0x5d')](_0xd815('0x5e'),'ut',_0xd815('0x5f'))[_0xd815('0x23')]('ChatQueueId\x20=\x20?',_0x13eaec[_0xd815('0x2a')]['id']);for(var _0x21f759=0x0;_0x21f759<_0x42f025[_0xd815('0x60')];_0x21f759+=0x1){let _0x2643f0=_0x42f025[_0x21f759];for(var _0x479a93=0x0;_0x479a93<_0x2643f0[_0xd815('0x52')][_0xd815('0x60')];_0x479a93+=0x1){let _0x1d222e=_0x2643f0[_0xd815('0x52')][_0x479a93];var _0x3c8922=_0x1863ca[_0xd815('0x61')]();_0x3c8922[_0xd815('0x23')](_0xd815('0x62'),_0x1d222e['id']);_0x3dcb77['push'](db[_0xd815('0x55')][_0xd815('0x25')](_0x3c8922[_0xd815('0x63')](),{'type':db[_0xd815('0x55')][_0xd815('0x64')][_0xd815('0x65')]})[_0xd815('0x14')](function(_0xd4abc9){if(_0xd4abc9['length']===0x1){return _0x1d222e['id'];}else{var _0x39b524=_[_0xd815('0x66')](_[_0xd815('0x1c')](_0xd4abc9,'TeamId'),function(_0x4b234e){return _[_0xd815('0x67')](_0xabd0dd,_0x4b234e);});if(_0x39b524){return _0x1d222e['id'];}}}));}}return BPromise[_0xd815('0x68')](_0x3dcb77)['then'](function(_0x36c733){_0x5c58f2=_(_0x5c58f2)[_0xd815('0x69')](_0x36c733)[_0xd815('0x6a')]()[_0xd815('0x6b')]();return db[_0xd815('0x1d')]['find']({'where':{'id':_0x13eaec[_0xd815('0x2a')]['id']}})[_0xd815('0x14')](function(_0x731fef){return db[_0xd815('0x55')][_0xd815('0x6c')](function(_0x75a143){return _0x731fef[_0xd815('0x6d')](_0x13eaec[_0xd815('0x25')][_0xd815('0x50')],{'transaction':_0x75a143})[_0xd815('0x14')](function(){if(!_['isEmpty'](_0x5c58f2)){return _0x731fef[_0xd815('0x6e')](_0x5c58f2,{'transaction':_0x75a143});}})[_0xd815('0x14')](function(){_0x5c58f2[_0xd815('0x6f')](function(_0x22a243){socket[_0xd815('0x70')](_0xd815('0x71'),{'UserId':_0x22a243,'ChatQueueId':_0x731fef['id']});});});});});});})[_0xd815('0x14')](respondWithStatusCode(_0x3da43c,null))['catch'](handleError(_0x3da43c,null));};exports['addAgents']=function(_0x163e0d,_0x8b436f){return db['ChatQueue'][_0xd815('0x32')]({'where':{'id':_0x163e0d[_0xd815('0x2a')]['id']}})[_0xd815('0x14')](handleEntityNotFound(_0x8b436f,null))[_0xd815('0x14')](function(_0x41db56){if(_0x41db56){return _0x41db56[_0xd815('0x72')](_0x163e0d[_0xd815('0x34')][_0xd815('0x50')],_[_0xd815('0x73')](_0x163e0d[_0xd815('0x34')],[_0xd815('0x50'),'id'])||{})[_0xd815('0x74')](function(_0x9a7c51){for(var _0x99678e=0x0;_0x99678e<_0x163e0d['body']['ids'][_0xd815('0x60')];_0x99678e+=0x1){socket['emit']('userChatQueue:save',{'UserId':Number(_0x163e0d[_0xd815('0x34')][_0xd815('0x50')][_0x99678e]),'ChatQueueId':Number(_0x163e0d[_0xd815('0x2a')]['id'])});}return _0x9a7c51;});}})['then'](respondWithResult(_0x8b436f,null))[_0xd815('0x28')](handleError(_0x8b436f,null));};exports[_0xd815('0x6e')]=function(_0x2cd9d7,_0x44653e){return db[_0xd815('0x1d')][_0xd815('0x32')]({'where':{'id':_0x2cd9d7[_0xd815('0x2a')]['id']}})[_0xd815('0x14')](handleEntityNotFound(_0x44653e,null))['then'](function(_0x475269){if(_0x475269){return _0x475269[_0xd815('0x6e')](_0x2cd9d7[_0xd815('0x25')][_0xd815('0x50')])[_0xd815('0x14')](function(){if(_[_0xd815('0x75')](_0x2cd9d7['query'][_0xd815('0x50')])){for(var _0x2da407=0x0;_0x2da407<_0x2cd9d7[_0xd815('0x25')]['ids']['length'];_0x2da407+=0x1){socket[_0xd815('0x70')]('userChatQueue:remove',{'UserId':Number(_0x2cd9d7[_0xd815('0x25')][_0xd815('0x50')][_0x2da407]),'ChatQueueId':Number(_0x2cd9d7[_0xd815('0x2a')]['id'])});}}else{socket[_0xd815('0x70')](_0xd815('0x71'),{'UserId':Number(_0x2cd9d7[_0xd815('0x25')]['ids']),'ChatQueueId':Number(_0x2cd9d7[_0xd815('0x2a')]['id'])});}});}})[_0xd815('0x14')](respondWithStatusCode(_0x44653e,null))[_0xd815('0x28')](handleError(_0x44653e,null));};exports[_0xd815('0x76')]=function(_0x448659,_0x5bab0d){var _0x4bba40={};var _0x4ed97e={};var _0x3dd7df;var _0xa7c2f8;return db[_0xd815('0x1d')]['findOne']({'where':{'id':_0x448659[_0xd815('0x2a')]['id']}})[_0xd815('0x14')](handleEntityNotFound(_0x5bab0d,null))['then'](function(_0x322f79){if(_0x322f79){_0x3dd7df=_0x322f79;_0x4ed97e[_0xd815('0x2b')]=_[_0xd815('0x2c')](db[_0xd815('0x46')][_0xd815('0x1e')]);_0x4ed97e[_0xd815('0x25')]=_[_0xd815('0x2c')](_0x448659[_0xd815('0x25')]);_0x4ed97e[_0xd815('0x3e')]=_['intersection'](_0x4ed97e[_0xd815('0x2b')],_0x4ed97e['query']);_0x4bba40['attributes']=_[_0xd815('0x2d')](_0x4ed97e[_0xd815('0x2b')],qs[_0xd815('0x3f')](_0x448659['query'][_0xd815('0x3f')]));_0x4bba40['attributes']=_0x4bba40[_0xd815('0x2e')]['length']?_0x4bba40[_0xd815('0x2e')]:_0x4ed97e[_0xd815('0x2b')];_0x4bba40[_0xd815('0x4e')]=qs['sort'](_0x448659[_0xd815('0x25')][_0xd815('0x42')]);_0x4bba40[_0xd815('0x23')]=qs[_0xd815('0x3e')](_['pick'](_0x448659[_0xd815('0x25')],_0x4ed97e[_0xd815('0x3e')]));if(_0x448659[_0xd815('0x25')][_0xd815('0x44')]){_0x4bba40[_0xd815('0x23')]=_[_0xd815('0x30')](_0x4bba40['where'],{'$or':_['map'](_0x4bba40[_0xd815('0x2e')],function(_0x1d4310){var _0xccdece={};_0xccdece[_0x1d4310]={'$like':'%'+_0x448659[_0xd815('0x25')][_0xd815('0x44')]+'%'};return _0xccdece;})});}_0x4bba40=_[_0xd815('0x30')]({},_0x4bba40,_0x448659['options']);return _0x3dd7df[_0xd815('0x76')](_0x4bba40);}})[_0xd815('0x14')](function(_0x2a9b26){if(_0x2a9b26){_0xa7c2f8=_0x2a9b26['length'];if(!_0x448659[_0xd815('0x25')]['hasOwnProperty'](_0xd815('0x41'))){_0x4bba40[_0xd815('0xf')]=qs['limit'](_0x448659[_0xd815('0x25')][_0xd815('0xf')]);_0x4bba40[_0xd815('0xd')]=qs[_0xd815('0xd')](_0x448659['query'][_0xd815('0xd')]);}return _0x3dd7df[_0xd815('0x76')](_0x4bba40);}})[_0xd815('0x14')](function(_0x5e2148){if(_0x5e2148){return _0x5e2148?{'count':_0xa7c2f8,'rows':_0x5e2148}:null;}})['then'](respondWithResult(_0x5bab0d,null))[_0xd815('0x28')](handleError(_0x5bab0d,null));}; \ No newline at end of file +var _0xadfa=['status','json','limit','undefined','count','offset','set','Content-Range','update','then','ChatQueues','UserProfileResource','destroy','sendStatus','stack','name','send','index','map','ChatQueue','rawAttributes','fieldName','type','key','getOptions','where','include','query','rows','params','model','keys','filters','intersection','attributes','fields','length','includeAll','merge','options','find','catch','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','error','describe','getMembers','UserChatQueue','order','sort','ChatQueueId','filter','findAll','User','findAndCountAll','agent','updatedAt','createdAt','SIP','chatPause','getTeams','Team','pick','hasOwnProperty','ids','Agents','online','voicePause','interface','flatMap','sequelize','transaction','addTeams','findOrCreate','emit','userChatQueue:save','removeTeams','select','tq.TeamId','from','team_has_chat_queues','join','ut.TeamId\x20=\x20tq.TeamId','ChatQueueId\x20=\x20?','ut.UserId\x20=\x20?','toString','QueryTypes','SELECT','all','union','compact','value','removeAgents','forEach','userChatQueue:remove','addAgents','omit','isArray','getAgents','findOne','nolimit','bluebird','lodash','ioredis','../../components/parsers/qs','../../config/logger','../../config/environment','../../mysqldb','defaults','socket.io-emitter','register','end'];(function(_0x483545,_0x37b37a){var _0xde7c23=function(_0x1fb7b0){while(--_0x1fb7b0){_0x483545['push'](_0x483545['shift']());}};_0xde7c23(++_0x37b37a);}(_0xadfa,0x1cd));var _0xaadf=function(_0x1bf303,_0x94963){_0x1bf303=_0x1bf303-0x0;var _0x41af3b=_0xadfa[_0x1bf303];return _0x41af3b;};'use strict';var BPromise=require(_0xaadf('0x0'));var util=require('util');var _=require(_0xaadf('0x1'));var squel=require('squel');var Redis=require(_0xaadf('0x2'));var qs=require(_0xaadf('0x3'));var logger=require(_0xaadf('0x4'))('api');var config=require(_0xaadf('0x5'));var db=require(_0xaadf('0x6'))['db'];config['redis']=_[_0xaadf('0x7')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xaadf('0x8'))(new Redis(config['redis']));require('./chatQueue.socket')[_0xaadf('0x9')](socket);function respondWithStatusCode(_0x404085,_0x4afddc){_0x4afddc=_0x4afddc||0xcc;return function(_0x6abf62){if(_0x6abf62){return _0x404085['sendStatus'](_0x4afddc);}return _0x404085['status'](_0x4afddc)[_0xaadf('0xa')]();};}function respondWithResult(_0x2eb09e,_0x1965a9){_0x1965a9=_0x1965a9||0xc8;return function(_0x5952e2){if(_0x5952e2){return _0x2eb09e[_0xaadf('0xb')](_0x1965a9)[_0xaadf('0xc')](_0x5952e2);}};}function respondWithFilteredResult(_0x325521,_0x5a2c3a){return function(_0x3ef6de){if(_0x3ef6de){var _0x66fd74=typeof _0x5a2c3a['offset']==='undefined'&&typeof _0x5a2c3a[_0xaadf('0xd')]===_0xaadf('0xe');var _0x4a6ee1=_0x3ef6de[_0xaadf('0xf')];var _0x2fd0cc=_0x66fd74?0x0:_0x5a2c3a[_0xaadf('0x10')];var _0x23c153=_0x66fd74?_0x3ef6de[_0xaadf('0xf')]:_0x5a2c3a[_0xaadf('0x10')]+_0x5a2c3a[_0xaadf('0xd')];var _0x55dbae;if(_0x23c153>=_0x4a6ee1){_0x23c153=_0x4a6ee1;_0x55dbae=0xc8;}else{_0x55dbae=0xce;}_0x325521[_0xaadf('0xb')](_0x55dbae);return _0x325521[_0xaadf('0x11')](_0xaadf('0x12'),_0x2fd0cc+'-'+_0x23c153+'/'+_0x4a6ee1)[_0xaadf('0xc')](_0x3ef6de);}return null;};}function saveUpdates(_0x5e9505){return function(_0xb3485d){if(_0xb3485d){return _0xb3485d[_0xaadf('0x13')](_0x5e9505)[_0xaadf('0x14')](function(_0x11ec48){return _0x11ec48;});}return null;};}function removeEntity(_0x22676d){return function(_0x26f3bb){if(_0x26f3bb){return _0x26f3bb['destroy']()[_0xaadf('0x14')](function(){var _0x5de3b9=_0x26f3bb['get']({'plain':!![]});var _0x492a99=_0xaadf('0x15');return db[_0xaadf('0x16')][_0xaadf('0x17')]({'where':{'type':_0x492a99,'resourceId':_0x5de3b9['id']}})[_0xaadf('0x14')](function(){return _0x26f3bb;});})['then'](function(){_0x22676d['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x325bc1){return function(_0x4532c3){if(!_0x4532c3){_0x325bc1[_0xaadf('0x18')](0x194);}return _0x4532c3;};}function handleError(_0x262e37,_0x198f94){_0x198f94=_0x198f94||0x1f4;return function(_0x1ab57a){logger['error'](_0x1ab57a[_0xaadf('0x19')]);if(_0x1ab57a[_0xaadf('0x1a')]){delete _0x1ab57a[_0xaadf('0x1a')];}_0x262e37[_0xaadf('0xb')](_0x198f94)[_0xaadf('0x1b')](_0x1ab57a);};}exports[_0xaadf('0x1c')]=function(_0x31f6dc,_0x5b712d){var _0xc83fc={};var _0xdede13={'count':0x0,'rows':[]};var _0x54a2bf=_[_0xaadf('0x1d')](db[_0xaadf('0x1e')][_0xaadf('0x1f')],function(_0x5df83a){return{'name':_0x5df83a[_0xaadf('0x20')],'type':_0x5df83a[_0xaadf('0x21')][_0xaadf('0x22')]};});_0xc83fc=qs[_0xaadf('0x23')](_0x54a2bf,_0x31f6dc);var _0x6aaf6e={'where':_0xc83fc[_0xaadf('0x24')]};return db[_0xaadf('0x1e')][_0xaadf('0xf')](_0x6aaf6e)[_0xaadf('0x14')](function(_0x25e594){_0xdede13[_0xaadf('0xf')]=_0x25e594;_0xc83fc[_0xaadf('0x25')]=qs['include'](_0x31f6dc[_0xaadf('0x26')]);return db[_0xaadf('0x1e')]['findAll'](_0xc83fc);})[_0xaadf('0x14')](function(_0x208b8d){_0xdede13[_0xaadf('0x27')]=_0x208b8d;return _0xdede13;})[_0xaadf('0x14')](respondWithFilteredResult(_0x5b712d,_0xc83fc))['catch'](handleError(_0x5b712d,null));};exports['show']=function(_0xa414c9,_0x52aa58){var _0x3f444e={'raw':!![],'where':{'id':_0xa414c9[_0xaadf('0x28')]['id']}},_0x4bbf60={};_0x4bbf60[_0xaadf('0x29')]=_['keys'](db['ChatQueue'][_0xaadf('0x1f')]);_0x4bbf60[_0xaadf('0x26')]=_[_0xaadf('0x2a')](_0xa414c9[_0xaadf('0x26')]);_0x4bbf60[_0xaadf('0x2b')]=_[_0xaadf('0x2c')](_0x4bbf60[_0xaadf('0x29')],_0x4bbf60['query']);_0x3f444e[_0xaadf('0x2d')]=_[_0xaadf('0x2c')](_0x4bbf60[_0xaadf('0x29')],qs[_0xaadf('0x2e')](_0xa414c9[_0xaadf('0x26')][_0xaadf('0x2e')]));_0x3f444e[_0xaadf('0x2d')]=_0x3f444e[_0xaadf('0x2d')][_0xaadf('0x2f')]?_0x3f444e[_0xaadf('0x2d')]:_0x4bbf60[_0xaadf('0x29')];if(_0xa414c9[_0xaadf('0x26')][_0xaadf('0x30')]){_0x3f444e[_0xaadf('0x25')]=[{'all':!![]}];}_0x3f444e=_[_0xaadf('0x31')]({},_0x3f444e,_0xa414c9[_0xaadf('0x32')]);return db['ChatQueue'][_0xaadf('0x33')](_0x3f444e)[_0xaadf('0x14')](handleEntityNotFound(_0x52aa58,null))[_0xaadf('0x14')](respondWithResult(_0x52aa58,null))[_0xaadf('0x34')](handleError(_0x52aa58,null));};exports[_0xaadf('0x35')]=function(_0x31b448,_0x19709e){return db[_0xaadf('0x1e')]['create'](_0x31b448[_0xaadf('0x36')],{})[_0xaadf('0x14')](function(_0x2b00da){var _0x40aa05=_0x31b448[_0xaadf('0x37')][_0xaadf('0x38')]({'plain':!![]});if(!_0x40aa05)throw new Error(_0xaadf('0x39'));if(_0x40aa05[_0xaadf('0x3a')]===_0xaadf('0x37')){var _0x5e0003=_0x2b00da['get']({'plain':!![]});var _0x3d1e84=_0xaadf('0x15');return db[_0xaadf('0x3b')][_0xaadf('0x33')]({'where':{'name':_0x3d1e84,'userProfileId':_0x40aa05[_0xaadf('0x3c')]},'raw':!![]})[_0xaadf('0x14')](function(_0x3fcd6a){if(_0x3fcd6a&&_0x3fcd6a['autoAssociation']===0x0){return db[_0xaadf('0x16')][_0xaadf('0x35')]({'name':_0x5e0003[_0xaadf('0x1a')],'resourceId':_0x5e0003['id'],'type':_0x3fcd6a[_0xaadf('0x1a')],'sectionId':_0x3fcd6a['id']},{})[_0xaadf('0x14')](function(){return _0x2b00da;});}else{return _0x2b00da;}})[_0xaadf('0x34')](function(_0x10585a){logger[_0xaadf('0x3d')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x10585a);throw _0x10585a;});}return _0x2b00da;})[_0xaadf('0x14')](respondWithResult(_0x19709e,0xc9))[_0xaadf('0x34')](handleError(_0x19709e,null));};exports[_0xaadf('0x13')]=function(_0x154c83,_0x201b22){if(_0x154c83[_0xaadf('0x36')]['id']){delete _0x154c83[_0xaadf('0x36')]['id'];}return db[_0xaadf('0x1e')][_0xaadf('0x33')]({'where':{'id':_0x154c83[_0xaadf('0x28')]['id']}})['then'](handleEntityNotFound(_0x201b22,null))[_0xaadf('0x14')](saveUpdates(_0x154c83[_0xaadf('0x36')],null))[_0xaadf('0x14')](respondWithResult(_0x201b22,null))[_0xaadf('0x34')](handleError(_0x201b22,null));};exports['destroy']=function(_0x138e68,_0x4f0b78){return db['ChatQueue']['find']({'where':{'id':_0x138e68[_0xaadf('0x28')]['id']}})[_0xaadf('0x14')](handleEntityNotFound(_0x4f0b78,null))['then'](removeEntity(_0x4f0b78,null))[_0xaadf('0x34')](handleError(_0x4f0b78,null));};exports[_0xaadf('0x3e')]=function(_0x2b0ae8,_0x2d672c){return db[_0xaadf('0x1e')][_0xaadf('0x3e')]()[_0xaadf('0x14')](respondWithResult(_0x2d672c,null))[_0xaadf('0x34')](handleError(_0x2d672c,null));};exports[_0xaadf('0x3f')]=function(_0x1a2419,_0x17219a){var _0x34811b={'raw':!![],'where':{}},_0x353e0f={},_0x49b5fe;return db[_0xaadf('0x1e')]['findOne']({'where':{'id':_0x1a2419[_0xaadf('0x28')]['id']}})['then'](handleEntityNotFound(_0x17219a,null))['then'](function(_0x2d970c){if(_0x2d970c){_0x49b5fe=_0x2d970c[_0xaadf('0x38')]({'plain':!![]});_0x353e0f[_0xaadf('0x29')]=_[_0xaadf('0x2a')](db[_0xaadf('0x40')][_0xaadf('0x1f')]);_0x353e0f[_0xaadf('0x26')]=_['keys'](_0x1a2419['query']);_0x353e0f[_0xaadf('0x2b')]=_[_0xaadf('0x2c')](_0x353e0f[_0xaadf('0x29')],_0x353e0f[_0xaadf('0x26')]);_0x34811b['attributes']=_[_0xaadf('0x2c')](_0x353e0f[_0xaadf('0x29')],qs['fields'](_0x1a2419[_0xaadf('0x26')][_0xaadf('0x2e')]));_0x34811b[_0xaadf('0x2d')]=_0x34811b[_0xaadf('0x2d')]['length']?_0x34811b[_0xaadf('0x2d')]:_0x353e0f[_0xaadf('0x29')];if(!_0x1a2419[_0xaadf('0x26')]['hasOwnProperty']('nolimit')){_0x34811b[_0xaadf('0xd')]=qs[_0xaadf('0xd')](_0x1a2419['query']['limit']);_0x34811b['offset']=qs[_0xaadf('0x10')](_0x1a2419[_0xaadf('0x26')]['offset']);}_0x34811b[_0xaadf('0x41')]=qs[_0xaadf('0x42')](_0x1a2419[_0xaadf('0x26')]['sort']);_0x34811b[_0xaadf('0x24')]=qs['filters'](_['pick'](_0x1a2419[_0xaadf('0x26')],_0x353e0f[_0xaadf('0x2b')]));_0x34811b['where'][_0xaadf('0x43')]=_0x2d970c['id'];if(_0x1a2419[_0xaadf('0x26')][_0xaadf('0x44')]){_0x34811b['where']=_[_0xaadf('0x31')](_0x34811b[_0xaadf('0x24')],{'$or':_[_0xaadf('0x1d')](_0x34811b['attributes'],function(_0x2d4cf0){var _0x5cd68a={};_0x5cd68a[_0x2d4cf0]={'$like':'%'+_0x1a2419[_0xaadf('0x26')]['filter']+'%'};return _0x5cd68a;})});}_0x34811b=_[_0xaadf('0x31')]({},_0x34811b,_0x1a2419[_0xaadf('0x32')]);return db['UserChatQueue'][_0xaadf('0x45')](_0x34811b);}})[_0xaadf('0x14')](function(_0x52e2d9){if(_0x52e2d9){return db[_0xaadf('0x46')][_0xaadf('0x47')]({'where':{'id':_[_0xaadf('0x1d')](_0x52e2d9,'UserId'),'role':_0xaadf('0x48')},'attributes':['id',_0xaadf('0x1a'),'chatPause',_0xaadf('0x49'),_0xaadf('0x4a')]});}})[_0xaadf('0x14')](function(_0x83f3db){if(_0x83f3db){return{'count':_0x83f3db[_0xaadf('0xf')],'rows':_[_0xaadf('0x1d')](_0x83f3db[_0xaadf('0x27')],function(_0x54afb0){return{'membername':_0x54afb0['name'],'UserId':_0x54afb0['id'],'queue_name':_0x49b5fe['name'],'ChatQueueId':_0x49b5fe['id'],'interface':util['format']('%s/%s',_0xaadf('0x4b'),_0x54afb0[_0xaadf('0x1a')]),'penalty':0x0,'paused':_0x54afb0[_0xaadf('0x4c')],'createdAt':_0x54afb0[_0xaadf('0x4a')],'updatedAt':_0x54afb0[_0xaadf('0x49')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x17219a,_0x34811b))['catch'](handleError(_0x17219a,null));};exports[_0xaadf('0x4d')]=function(_0x42f55c,_0x124db0){var _0x3814dc={};var _0x1da2a9={};var _0x53fd76;var _0x1d88ef;return db['ChatQueue']['findOne']({'where':{'id':_0x42f55c[_0xaadf('0x28')]['id']}})[_0xaadf('0x14')](handleEntityNotFound(_0x124db0,null))[_0xaadf('0x14')](function(_0x26184d){if(_0x26184d){_0x53fd76=_0x26184d;_0x1da2a9['model']=_[_0xaadf('0x2a')](db[_0xaadf('0x4e')][_0xaadf('0x1f')]);_0x1da2a9[_0xaadf('0x26')]=_[_0xaadf('0x2a')](_0x42f55c['query']);_0x1da2a9[_0xaadf('0x2b')]=_['intersection'](_0x1da2a9[_0xaadf('0x29')],_0x1da2a9[_0xaadf('0x26')]);_0x3814dc['attributes']=_[_0xaadf('0x2c')](_0x1da2a9['model'],qs[_0xaadf('0x2e')](_0x42f55c['query'][_0xaadf('0x2e')]));_0x3814dc[_0xaadf('0x2d')]=_0x3814dc[_0xaadf('0x2d')][_0xaadf('0x2f')]?_0x3814dc['attributes']:_0x1da2a9[_0xaadf('0x29')];_0x3814dc[_0xaadf('0x41')]=qs['sort'](_0x42f55c['query'][_0xaadf('0x42')]);_0x3814dc[_0xaadf('0x24')]=qs['filters'](_[_0xaadf('0x4f')](_0x42f55c[_0xaadf('0x26')],_0x1da2a9['filters']));if(_0x42f55c['query'][_0xaadf('0x44')]){_0x3814dc[_0xaadf('0x24')]=_[_0xaadf('0x31')](_0x3814dc['where'],{'$or':_[_0xaadf('0x1d')](_0x3814dc['attributes'],function(_0x58c24c){var _0x1e4107={};_0x1e4107[_0x58c24c]={'$like':'%'+_0x42f55c[_0xaadf('0x26')]['filter']+'%'};return _0x1e4107;})});}_0x3814dc=_['merge']({},_0x3814dc,_0x42f55c[_0xaadf('0x32')]);return _0x53fd76['getTeams'](_0x3814dc);}})['then'](function(_0x3f8b8f){if(_0x3f8b8f){_0x1d88ef=_0x3f8b8f[_0xaadf('0x2f')];if(!_0x42f55c[_0xaadf('0x26')][_0xaadf('0x50')]('nolimit')){_0x3814dc[_0xaadf('0xd')]=qs['limit'](_0x42f55c[_0xaadf('0x26')][_0xaadf('0xd')]);_0x3814dc['offset']=qs[_0xaadf('0x10')](_0x42f55c[_0xaadf('0x26')]['offset']);}return _0x53fd76[_0xaadf('0x4d')](_0x3814dc);}})['then'](function(_0xf13376){if(_0xf13376){return _0xf13376?{'count':_0x1d88ef,'rows':_0xf13376}:null;}})[_0xaadf('0x14')](respondWithResult(_0x124db0,null))[_0xaadf('0x34')](handleError(_0x124db0,null));};exports['addTeams']=function(_0x6c8976,_0x2d8b95){var _0x1c4970=_0x6c8976[_0xaadf('0x36')][_0xaadf('0x51')];return db[_0xaadf('0x4e')]['findAll']({'where':{'id':_0x1c4970},'attributes':['id'],'include':[{'model':db[_0xaadf('0x46')],'as':_0xaadf('0x52'),'attributes':['id',_0xaadf('0x1a'),_0xaadf('0x53'),_0xaadf('0x54'),_0xaadf('0x55')],'raw':!![]}]})['then'](function(_0x335ac5){if(_0x335ac5){var _0x5e343e=_[_0xaadf('0x56')](_0x335ac5,function(_0x321f89){var _0x29d138=_0x321f89[_0xaadf('0x38')]({'plain':!![]});return _0x29d138[_0xaadf('0x52')];});return db[_0xaadf('0x1e')][_0xaadf('0x33')]({'where':{'id':_0x6c8976[_0xaadf('0x28')]['id']}})[_0xaadf('0x14')](function(_0x1be2cd){return db[_0xaadf('0x57')][_0xaadf('0x58')](function(_0x37ee55){return _0x1be2cd[_0xaadf('0x59')](_0x1c4970,{'transaction':_0x37ee55})['then'](function(){return BPromise['each'](_0x5e343e,function(_0x2b26df){return db[_0xaadf('0x40')][_0xaadf('0x5a')]({'where':{'UserId':_0x2b26df['id'],'ChatQueueId':_0x6c8976[_0xaadf('0x28')]['id']},'transaction':_0x37ee55});});})[_0xaadf('0x14')](function(){_0x5e343e['forEach'](function(_0x5bed3b){socket[_0xaadf('0x5b')](_0xaadf('0x5c'),{'UserId':_0x5bed3b['id'],'ChatQueueId':_0x1be2cd['id']});});});});});}})[_0xaadf('0x14')](respondWithStatusCode(_0x2d8b95,null))[_0xaadf('0x34')](handleError(_0x2d8b95,null));};exports[_0xaadf('0x5d')]=function(_0x5a9fd4,_0x3ccbc4){return db[_0xaadf('0x4e')][_0xaadf('0x45')]({'where':{'id':_0x5a9fd4[_0xaadf('0x26')][_0xaadf('0x51')]},'attributes':['id'],'include':[{'model':db[_0xaadf('0x46')],'as':_0xaadf('0x52'),'attributes':['id'],'raw':!![]}]})[_0xaadf('0x14')](handleEntityNotFound(_0x3ccbc4,null))[_0xaadf('0x14')](function(_0x2a332a){var _0x59d95b=_[_0xaadf('0x1d')](_0x2a332a,'id');var _0xb28c2c=[];var _0xc321ec=[];var _0x1679c4=squel[_0xaadf('0x5e')]();_0x1679c4['field'](_0xaadf('0x5f'))[_0xaadf('0x60')](_0xaadf('0x61'),'tq')[_0xaadf('0x62')]('user_has_teams','ut',_0xaadf('0x63'))[_0xaadf('0x24')](_0xaadf('0x64'),_0x5a9fd4[_0xaadf('0x28')]['id']);for(var _0x25863b=0x0;_0x25863b<_0x2a332a[_0xaadf('0x2f')];_0x25863b+=0x1){let _0x48bbb6=_0x2a332a[_0x25863b];for(var _0x3be26e=0x0;_0x3be26e<_0x48bbb6[_0xaadf('0x52')][_0xaadf('0x2f')];_0x3be26e+=0x1){let _0x2809aa=_0x48bbb6[_0xaadf('0x52')][_0x3be26e];var _0x4dd86d=_0x1679c4['clone']();_0x4dd86d['where'](_0xaadf('0x65'),_0x2809aa['id']);_0xc321ec['push'](db[_0xaadf('0x57')][_0xaadf('0x26')](_0x4dd86d[_0xaadf('0x66')](),{'type':db[_0xaadf('0x57')][_0xaadf('0x67')][_0xaadf('0x68')]})[_0xaadf('0x14')](function(_0x1f1efb){if(_0x1f1efb['length']===0x1){return _0x2809aa['id'];}else{var _0x7bee47=_['every'](_['map'](_0x1f1efb,'TeamId'),function(_0x3087b9){return _['includes'](_0x59d95b,_0x3087b9);});if(_0x7bee47){return _0x2809aa['id'];}}}));}}return BPromise[_0xaadf('0x69')](_0xc321ec)['then'](function(_0x2b00e5){_0xb28c2c=_(_0xb28c2c)[_0xaadf('0x6a')](_0x2b00e5)[_0xaadf('0x6b')]()[_0xaadf('0x6c')]();return db[_0xaadf('0x1e')][_0xaadf('0x33')]({'where':{'id':_0x5a9fd4['params']['id']}})['then'](function(_0x18c545){return db[_0xaadf('0x57')]['transaction'](function(_0x381402){return _0x18c545['removeTeams'](_0x5a9fd4[_0xaadf('0x26')][_0xaadf('0x51')],{'transaction':_0x381402})[_0xaadf('0x14')](function(){if(!_['isEmpty'](_0xb28c2c)){return _0x18c545[_0xaadf('0x6d')](_0xb28c2c,{'transaction':_0x381402});}})['then'](function(){_0xb28c2c[_0xaadf('0x6e')](function(_0x49043e){socket[_0xaadf('0x5b')](_0xaadf('0x6f'),{'UserId':_0x49043e,'ChatQueueId':_0x18c545['id']});});});});});});})[_0xaadf('0x14')](respondWithStatusCode(_0x3ccbc4,null))['catch'](handleError(_0x3ccbc4,null));};exports[_0xaadf('0x70')]=function(_0xbaf086,_0x49b93c){return db[_0xaadf('0x1e')][_0xaadf('0x33')]({'where':{'id':_0xbaf086['params']['id']}})[_0xaadf('0x14')](handleEntityNotFound(_0x49b93c,null))[_0xaadf('0x14')](function(_0x4ced53){if(_0x4ced53){return _0x4ced53['addAgents'](_0xbaf086['body'][_0xaadf('0x51')],_[_0xaadf('0x71')](_0xbaf086[_0xaadf('0x36')],['ids','id'])||{})['spread'](function(_0xd418a3){for(var _0x43b93d=0x0;_0x43b93d<_0xbaf086[_0xaadf('0x36')][_0xaadf('0x51')]['length'];_0x43b93d+=0x1){socket[_0xaadf('0x5b')](_0xaadf('0x5c'),{'UserId':Number(_0xbaf086['body']['ids'][_0x43b93d]),'ChatQueueId':Number(_0xbaf086[_0xaadf('0x28')]['id'])});}return _0xd418a3;});}})[_0xaadf('0x14')](respondWithResult(_0x49b93c,null))[_0xaadf('0x34')](handleError(_0x49b93c,null));};exports['removeAgents']=function(_0x2c9c23,_0x26043c){return db['ChatQueue'][_0xaadf('0x33')]({'where':{'id':_0x2c9c23[_0xaadf('0x28')]['id']}})[_0xaadf('0x14')](handleEntityNotFound(_0x26043c,null))['then'](function(_0x5eeb76){if(_0x5eeb76){return _0x5eeb76[_0xaadf('0x6d')](_0x2c9c23['query'][_0xaadf('0x51')])['then'](function(){if(_[_0xaadf('0x72')](_0x2c9c23[_0xaadf('0x26')]['ids'])){for(var _0x455fd3=0x0;_0x455fd3<_0x2c9c23[_0xaadf('0x26')]['ids'][_0xaadf('0x2f')];_0x455fd3+=0x1){socket[_0xaadf('0x5b')]('userChatQueue:remove',{'UserId':Number(_0x2c9c23['query'][_0xaadf('0x51')][_0x455fd3]),'ChatQueueId':Number(_0x2c9c23[_0xaadf('0x28')]['id'])});}}else{socket[_0xaadf('0x5b')](_0xaadf('0x6f'),{'UserId':Number(_0x2c9c23['query']['ids']),'ChatQueueId':Number(_0x2c9c23[_0xaadf('0x28')]['id'])});}});}})[_0xaadf('0x14')](respondWithStatusCode(_0x26043c,null))['catch'](handleError(_0x26043c,null));};exports[_0xaadf('0x73')]=function(_0x3eba4a,_0xf4245c){var _0x4020e6={};var _0x46ae03={};var _0x1b16bc;var _0x4dcddb;return db[_0xaadf('0x1e')][_0xaadf('0x74')]({'where':{'id':_0x3eba4a[_0xaadf('0x28')]['id']}})[_0xaadf('0x14')](handleEntityNotFound(_0xf4245c,null))['then'](function(_0x17a49b){if(_0x17a49b){_0x1b16bc=_0x17a49b;_0x46ae03[_0xaadf('0x29')]=_[_0xaadf('0x2a')](db[_0xaadf('0x46')][_0xaadf('0x1f')]);_0x46ae03[_0xaadf('0x26')]=_[_0xaadf('0x2a')](_0x3eba4a[_0xaadf('0x26')]);_0x46ae03[_0xaadf('0x2b')]=_[_0xaadf('0x2c')](_0x46ae03[_0xaadf('0x29')],_0x46ae03['query']);_0x4020e6[_0xaadf('0x2d')]=_[_0xaadf('0x2c')](_0x46ae03[_0xaadf('0x29')],qs[_0xaadf('0x2e')](_0x3eba4a[_0xaadf('0x26')]['fields']));_0x4020e6[_0xaadf('0x2d')]=_0x4020e6[_0xaadf('0x2d')]['length']?_0x4020e6[_0xaadf('0x2d')]:_0x46ae03[_0xaadf('0x29')];_0x4020e6[_0xaadf('0x41')]=qs[_0xaadf('0x42')](_0x3eba4a[_0xaadf('0x26')][_0xaadf('0x42')]);_0x4020e6[_0xaadf('0x24')]=qs[_0xaadf('0x2b')](_[_0xaadf('0x4f')](_0x3eba4a[_0xaadf('0x26')],_0x46ae03[_0xaadf('0x2b')]));if(_0x3eba4a[_0xaadf('0x26')][_0xaadf('0x44')]){_0x4020e6[_0xaadf('0x24')]=_[_0xaadf('0x31')](_0x4020e6[_0xaadf('0x24')],{'$or':_['map'](_0x4020e6['attributes'],function(_0x5f2d02){var _0x20a5df={};_0x20a5df[_0x5f2d02]={'$like':'%'+_0x3eba4a[_0xaadf('0x26')][_0xaadf('0x44')]+'%'};return _0x20a5df;})});}_0x4020e6=_['merge']({},_0x4020e6,_0x3eba4a[_0xaadf('0x32')]);return _0x1b16bc[_0xaadf('0x73')](_0x4020e6);}})[_0xaadf('0x14')](function(_0x3b6512){if(_0x3b6512){_0x4dcddb=_0x3b6512[_0xaadf('0x2f')];if(!_0x3eba4a[_0xaadf('0x26')][_0xaadf('0x50')](_0xaadf('0x75'))){_0x4020e6[_0xaadf('0xd')]=qs[_0xaadf('0xd')](_0x3eba4a[_0xaadf('0x26')][_0xaadf('0xd')]);_0x4020e6[_0xaadf('0x10')]=qs[_0xaadf('0x10')](_0x3eba4a['query']['offset']);}return _0x1b16bc[_0xaadf('0x73')](_0x4020e6);}})[_0xaadf('0x14')](function(_0x490686){if(_0x490686){return _0x490686?{'count':_0x4dcddb,'rows':_0x490686}:null;}})[_0xaadf('0x14')](respondWithResult(_0xf4245c,null))[_0xaadf('0x34')](handleError(_0xf4245c,null));}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.events.js b/server/api/chatQueue/chatQueue.events.js index 1baa1bc..a34ace6 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 _0x198a=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','ChatQueue','setMaxListeners','save','update'];(function(_0x140288,_0x224892){var _0x1561c9=function(_0x3c2c0e){while(--_0x3c2c0e){_0x140288['push'](_0x140288['shift']());}};_0x1561c9(++_0x224892);}(_0x198a,0xf4));var _0xa198=function(_0x45e789,_0x240059){_0x45e789=_0x45e789-0x0;var _0x50107b=_0x198a[_0x45e789];return _0x50107b;};'use strict';var EventEmitter=require(_0xa198('0x0'));var ChatQueue=require(_0xa198('0x1'))['db'][_0xa198('0x2')];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0xa198('0x3')](0x0);var events={'afterCreate':_0xa198('0x4'),'afterUpdate':_0xa198('0x5'),'afterDestroy':'remove'};function emitEvent(_0x2f40fe){return function(_0x21b4e1,_0x541323,_0x43b3be){ChatQueueEvents[_0xa198('0x6')](_0x2f40fe+':'+_0x21b4e1['id'],_0x21b4e1);ChatQueueEvents['emit'](_0x2f40fe,_0x21b4e1);_0x43b3be(null);};}for(var e in events){if(events[_0xa198('0x7')](e)){var event=events[e];ChatQueue[_0xa198('0x8')](e,emitEvent(event));}}module[_0xa198('0x9')]=ChatQueueEvents; \ No newline at end of file +var _0x3ea0=['remove','emit','hasOwnProperty','hook','events','../../mysqldb','ChatQueue','setMaxListeners'];(function(_0x5d8ca7,_0x3cbe6c){var _0x24218a=function(_0x7e742c){while(--_0x7e742c){_0x5d8ca7['push'](_0x5d8ca7['shift']());}};_0x24218a(++_0x3cbe6c);}(_0x3ea0,0xf4));var _0x03ea=function(_0x3dc264,_0x209b9c){_0x3dc264=_0x3dc264-0x0;var _0x1b4bad=_0x3ea0[_0x3dc264];return _0x1b4bad;};'use strict';var EventEmitter=require(_0x03ea('0x0'));var ChatQueue=require(_0x03ea('0x1'))['db'][_0x03ea('0x2')];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0x03ea('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x03ea('0x4')};function emitEvent(_0x201c0f){return function(_0x55e26b,_0x2e2a75,_0x5db044){ChatQueueEvents[_0x03ea('0x5')](_0x201c0f+':'+_0x55e26b['id'],_0x55e26b);ChatQueueEvents['emit'](_0x201c0f,_0x55e26b);_0x5db044(null);};}for(var e in events){if(events[_0x03ea('0x6')](e)){var event=events[e];ChatQueue[_0x03ea('0x7')](e,emitEvent(event));}}module['exports']=ChatQueueEvents; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.model.js b/server/api/chatQueue/chatQueue.model.js index 5882de7..f13e85e 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 _0xa7ab=['bluebird','request-promise','path','./chatQueue.attributes','define','chat_queues','lodash','util','../../config/logger','api','moment'];(function(_0x1a61fe,_0x369759){var _0x39b1a5=function(_0x38ddcb){while(--_0x38ddcb){_0x1a61fe['push'](_0x1a61fe['shift']());}};_0x39b1a5(++_0x369759);}(_0xa7ab,0xcc));var _0xba7a=function(_0x484c54,_0x5a6ebf){_0x484c54=_0x484c54-0x0;var _0x1f3976=_0xa7ab[_0x484c54];return _0x1f3976;};'use strict';var _=require(_0xba7a('0x0'));var util=require(_0xba7a('0x1'));var logger=require(_0xba7a('0x2'))(_0xba7a('0x3'));var moment=require(_0xba7a('0x4'));var BPromise=require(_0xba7a('0x5'));var rp=require(_0xba7a('0x6'));var fs=require('fs');var path=require(_0xba7a('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xba7a('0x8'));module['exports']=function(_0x288932,_0x2c3c6f){return _0x288932[_0xba7a('0x9')]('ChatQueue',attributes,{'tableName':_0xba7a('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xaf73=['rimraf','../../config/environment','./chatQueue.attributes','exports','define','ChatQueue','chat_queues','lodash','util','api','moment','request-promise','path'];(function(_0xdf90c0,_0x16e899){var _0x52b20e=function(_0x320dec){while(--_0x320dec){_0xdf90c0['push'](_0xdf90c0['shift']());}};_0x52b20e(++_0x16e899);}(_0xaf73,0xa3));var _0x3af7=function(_0x454f96,_0x1801b5){_0x454f96=_0x454f96-0x0;var _0x21b928=_0xaf73[_0x454f96];return _0x21b928;};'use strict';var _=require(_0x3af7('0x0'));var util=require(_0x3af7('0x1'));var logger=require('../../config/logger')(_0x3af7('0x2'));var moment=require(_0x3af7('0x3'));var BPromise=require('bluebird');var rp=require(_0x3af7('0x4'));var fs=require('fs');var path=require(_0x3af7('0x5'));var rimraf=require(_0x3af7('0x6'));var config=require(_0x3af7('0x7'));var attributes=require(_0x3af7('0x8'));module[_0x3af7('0x9')]=function(_0x21423b,_0x148409){return _0x21423b[_0x3af7('0xa')](_0x3af7('0xb'),attributes,{'tableName':_0x3af7('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.rpc.js b/server/api/chatQueue/chatQueue.rpc.js index b7af3aa..4fe39b4 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 _0xd1d3=['moment','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','redis','localhost','register','request','request\x20sent','ChatQueue,\x20%s,\x20%s,\x20%s','error','code','ChatQueue,\x20%s,\x20%s','message','info','result','catch','GetChatQueue','ChatQueue','findAll','raw','options','where','include','model','map','attributes','then','debug','ShowChatQueue','stringify','util'];(function(_0xc5e8b2,_0x17c746){var _0x300a20=function(_0x39c489){while(--_0x39c489){_0xc5e8b2['push'](_0xc5e8b2['shift']());}};_0x300a20(++_0x17c746);}(_0xd1d3,0x68));var _0x3d1d=function(_0x37aeff,_0x38c70a){_0x37aeff=_0x37aeff-0x0;var _0x285409=_0xd1d3[_0x37aeff];return _0x285409;};'use strict';var _=require('lodash');var util=require(_0x3d1d('0x0'));var moment=require(_0x3d1d('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3d1d('0x2'))['db'];var utils=require(_0x3d1d('0x3'));var logger=require('../../config/logger')(_0x3d1d('0x4'));var config=require(_0x3d1d('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x3d1d('0x6')][_0x3d1d('0x7')]({'port':0x232a});config[_0x3d1d('0x8')]=_['defaults'](config[_0x3d1d('0x8')],{'host':_0x3d1d('0x9'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x3d1d('0x8')]));require('./chatQueue.socket')[_0x3d1d('0xa')](socket);function respondWithRpcPromise(_0x56154a,_0x1cb81e,_0x5d2e09){return new BPromise(function(_0x29f76e,_0x23b4a1){return client[_0x3d1d('0xb')](_0x56154a,_0x5d2e09)['then'](function(_0x553661){logger['info']('ChatQueue,\x20%s,\x20%s',_0x1cb81e,_0x3d1d('0xc'));logger['debug'](_0x3d1d('0xd'),_0x1cb81e,_0x3d1d('0xc'),JSON['stringify'](_0x553661));if(_0x553661[_0x3d1d('0xe')]){if(_0x553661[_0x3d1d('0xe')][_0x3d1d('0xf')]===0x1f4){logger[_0x3d1d('0xe')](_0x3d1d('0x10'),_0x1cb81e,_0x553661['error'][_0x3d1d('0x11')]);return _0x23b4a1(_0x553661[_0x3d1d('0xe')][_0x3d1d('0x11')]);}logger[_0x3d1d('0xe')](_0x3d1d('0x10'),_0x1cb81e,_0x553661[_0x3d1d('0xe')][_0x3d1d('0x11')]);return _0x29f76e(_0x553661['error'][_0x3d1d('0x11')]);}else{logger[_0x3d1d('0x12')](_0x3d1d('0x10'),_0x1cb81e,_0x3d1d('0xc'));_0x29f76e(_0x553661[_0x3d1d('0x13')][_0x3d1d('0x11')]);}})[_0x3d1d('0x14')](function(_0x39da0e){logger[_0x3d1d('0xe')]('ChatQueue,\x20%s,\x20%s',_0x1cb81e,_0x39da0e);_0x23b4a1(_0x39da0e);});});}exports[_0x3d1d('0x15')]=function(_0x220c7b){var _0x21f6f6=this;return new Promise(function(_0x15dc5f,_0xca4143){return db[_0x3d1d('0x16')][_0x3d1d('0x17')]({'raw':_0x220c7b['options']?_0x220c7b['options'][_0x3d1d('0x18')]===undefined?!![]:![]:!![],'where':_0x220c7b[_0x3d1d('0x19')]?_0x220c7b[_0x3d1d('0x19')][_0x3d1d('0x1a')]||null:null,'attributes':_0x220c7b[_0x3d1d('0x19')]?_0x220c7b[_0x3d1d('0x19')]['attributes']||null:null,'limit':_0x220c7b['options']?_0x220c7b[_0x3d1d('0x19')]['limit']||null:null,'include':_0x220c7b[_0x3d1d('0x19')]?_0x220c7b['options'][_0x3d1d('0x1b')]?_['map'](_0x220c7b['options'][_0x3d1d('0x1b')],function(_0x2210bf){return{'model':db[_0x2210bf[_0x3d1d('0x1c')]],'as':_0x2210bf['as'],'attributes':_0x2210bf['attributes'],'include':_0x2210bf[_0x3d1d('0x1b')]?_[_0x3d1d('0x1d')](_0x2210bf[_0x3d1d('0x1b')],function(_0x4cc223){return{'model':db[_0x4cc223['model']],'as':_0x4cc223['as'],'attributes':_0x4cc223[_0x3d1d('0x1e')],'include':_0x4cc223[_0x3d1d('0x1b')]?_[_0x3d1d('0x1d')](_0x4cc223[_0x3d1d('0x1b')],function(_0x3b399b){return{'model':db[_0x3b399b[_0x3d1d('0x1c')]],'as':_0x3b399b['as'],'attributes':_0x3b399b['attributes']};}):[]};}):[]};}):[]:[]})[_0x3d1d('0x1f')](function(_0x4ec8c7){logger['info']('GetChatQueue',_0x220c7b);logger[_0x3d1d('0x20')](_0x3d1d('0x15'),_0x220c7b,JSON['stringify'](_0x4ec8c7));_0x15dc5f(_0x4ec8c7);})[_0x3d1d('0x14')](function(_0x1029b6){logger[_0x3d1d('0xe')](_0x3d1d('0x15'),_0x1029b6[_0x3d1d('0x11')],_0x220c7b);_0xca4143(_0x21f6f6[_0x3d1d('0xe')](0x1f4,_0x1029b6[_0x3d1d('0x11')]));});});};exports['ShowChatQueue']=function(_0x240bc4){var _0x1d548a=this;return new Promise(function(_0x38d5cb,_0x1f30d3){return db[_0x3d1d('0x16')]['find']({'raw':_0x240bc4[_0x3d1d('0x19')]?_0x240bc4[_0x3d1d('0x19')][_0x3d1d('0x18')]===undefined?!![]:![]:!![],'where':_0x240bc4['options']?_0x240bc4[_0x3d1d('0x19')][_0x3d1d('0x1a')]||null:null,'attributes':_0x240bc4[_0x3d1d('0x19')]?_0x240bc4['options']['attributes']||null:null,'include':_0x240bc4['options']?_0x240bc4[_0x3d1d('0x19')]['include']?_[_0x3d1d('0x1d')](_0x240bc4[_0x3d1d('0x19')][_0x3d1d('0x1b')],function(_0x476ea5){return{'model':db[_0x476ea5['model']],'as':_0x476ea5['as'],'attributes':_0x476ea5[_0x3d1d('0x1e')],'include':_0x476ea5[_0x3d1d('0x1b')]?_[_0x3d1d('0x1d')](_0x476ea5[_0x3d1d('0x1b')],function(_0x3c938b){return{'model':db[_0x3c938b[_0x3d1d('0x1c')]],'as':_0x3c938b['as'],'attributes':_0x3c938b[_0x3d1d('0x1e')],'include':_0x3c938b[_0x3d1d('0x1b')]?_['map'](_0x3c938b['include'],function(_0x34f1e1){return{'model':db[_0x34f1e1[_0x3d1d('0x1c')]],'as':_0x34f1e1['as'],'attributes':_0x34f1e1['attributes']};}):[]};}):[]};}):[]:[]})[_0x3d1d('0x1f')](function(_0x152d3d){logger[_0x3d1d('0x12')](_0x3d1d('0x21'),_0x240bc4);logger[_0x3d1d('0x20')](_0x3d1d('0x21'),_0x240bc4,JSON[_0x3d1d('0x22')](_0x152d3d));_0x38d5cb(_0x152d3d);})[_0x3d1d('0x14')](function(_0x3885f0){logger[_0x3d1d('0xe')](_0x3d1d('0x21'),_0x3885f0['message'],_0x240bc4);_0x1f30d3(_0x1d548a[_0x3d1d('0xe')](0x1f4,_0x3885f0[_0x3d1d('0x11')]));});});}; \ No newline at end of file +var _0x49db=['where','attributes','limit','include','map','model','find','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http','redis','defaults','localhost','socket.io-emitter','./chatQueue.socket','register','request','then','info','ChatQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','catch','GetChatQueue','ChatQueue','findAll','options','raw'];(function(_0x2ecc84,_0x28111d){var _0x3afb11=function(_0x474064){while(--_0x474064){_0x2ecc84['push'](_0x2ecc84['shift']());}};_0x3afb11(++_0x28111d);}(_0x49db,0xc5));var _0xb49d=function(_0x556fa0,_0x4e4a90){_0x556fa0=_0x556fa0-0x0;var _0x4b2cf7=_0x49db[_0x556fa0];return _0x4b2cf7;};'use strict';var _=require(_0xb49d('0x0'));var util=require(_0xb49d('0x1'));var moment=require(_0xb49d('0x2'));var BPromise=require(_0xb49d('0x3'));var rs=require(_0xb49d('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb49d('0x5'))['db'];var utils=require(_0xb49d('0x6'));var logger=require(_0xb49d('0x7'))('rpc');var config=require(_0xb49d('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0xb49d('0x9')]({'port':0x232a});config[_0xb49d('0xa')]=_[_0xb49d('0xb')](config['redis'],{'host':_0xb49d('0xc'),'port':0x18eb});var socket=require(_0xb49d('0xd'))(new Redis(config[_0xb49d('0xa')]));require(_0xb49d('0xe'))[_0xb49d('0xf')](socket);function respondWithRpcPromise(_0x66c2be,_0x54f285,_0x5106c9){return new BPromise(function(_0x3f21e3,_0x3422e0){return client[_0xb49d('0x10')](_0x66c2be,_0x5106c9)[_0xb49d('0x11')](function(_0x2c9c16){logger[_0xb49d('0x12')](_0xb49d('0x13'),_0x54f285,_0xb49d('0x14'));logger[_0xb49d('0x15')]('ChatQueue,\x20%s,\x20%s,\x20%s',_0x54f285,_0xb49d('0x14'),JSON[_0xb49d('0x16')](_0x2c9c16));if(_0x2c9c16[_0xb49d('0x17')]){if(_0x2c9c16[_0xb49d('0x17')]['code']===0x1f4){logger[_0xb49d('0x17')](_0xb49d('0x13'),_0x54f285,_0x2c9c16['error'][_0xb49d('0x18')]);return _0x3422e0(_0x2c9c16[_0xb49d('0x17')][_0xb49d('0x18')]);}logger[_0xb49d('0x17')](_0xb49d('0x13'),_0x54f285,_0x2c9c16[_0xb49d('0x17')][_0xb49d('0x18')]);return _0x3f21e3(_0x2c9c16['error'][_0xb49d('0x18')]);}else{logger[_0xb49d('0x12')](_0xb49d('0x13'),_0x54f285,_0xb49d('0x14'));_0x3f21e3(_0x2c9c16['result']['message']);}})[_0xb49d('0x19')](function(_0xa65038){logger[_0xb49d('0x17')](_0xb49d('0x13'),_0x54f285,_0xa65038);_0x3422e0(_0xa65038);});});}exports[_0xb49d('0x1a')]=function(_0x510f22){var _0x18547b=this;return new Promise(function(_0x47626f,_0x3bf7a2){return db[_0xb49d('0x1b')][_0xb49d('0x1c')]({'raw':_0x510f22[_0xb49d('0x1d')]?_0x510f22[_0xb49d('0x1d')][_0xb49d('0x1e')]===undefined?!![]:![]:!![],'where':_0x510f22[_0xb49d('0x1d')]?_0x510f22[_0xb49d('0x1d')][_0xb49d('0x1f')]||null:null,'attributes':_0x510f22[_0xb49d('0x1d')]?_0x510f22[_0xb49d('0x1d')][_0xb49d('0x20')]||null:null,'limit':_0x510f22[_0xb49d('0x1d')]?_0x510f22[_0xb49d('0x1d')][_0xb49d('0x21')]||null:null,'include':_0x510f22[_0xb49d('0x1d')]?_0x510f22[_0xb49d('0x1d')][_0xb49d('0x22')]?_[_0xb49d('0x23')](_0x510f22[_0xb49d('0x1d')]['include'],function(_0x227305){return{'model':db[_0x227305['model']],'as':_0x227305['as'],'attributes':_0x227305[_0xb49d('0x20')],'include':_0x227305[_0xb49d('0x22')]?_['map'](_0x227305[_0xb49d('0x22')],function(_0x1cd841){return{'model':db[_0x1cd841[_0xb49d('0x24')]],'as':_0x1cd841['as'],'attributes':_0x1cd841[_0xb49d('0x20')],'include':_0x1cd841[_0xb49d('0x22')]?_[_0xb49d('0x23')](_0x1cd841['include'],function(_0x3930fe){return{'model':db[_0x3930fe[_0xb49d('0x24')]],'as':_0x3930fe['as'],'attributes':_0x3930fe[_0xb49d('0x20')]};}):[]};}):[]};}):[]:[]})[_0xb49d('0x11')](function(_0x420e63){logger[_0xb49d('0x12')](_0xb49d('0x1a'),_0x510f22);logger['debug'](_0xb49d('0x1a'),_0x510f22,JSON['stringify'](_0x420e63));_0x47626f(_0x420e63);})[_0xb49d('0x19')](function(_0x2fbcfa){logger[_0xb49d('0x17')](_0xb49d('0x1a'),_0x2fbcfa[_0xb49d('0x18')],_0x510f22);_0x3bf7a2(_0x18547b[_0xb49d('0x17')](0x1f4,_0x2fbcfa[_0xb49d('0x18')]));});});};exports['ShowChatQueue']=function(_0x3802c8){var _0x463852=this;return new Promise(function(_0xf0da2b,_0x5e0f70){return db['ChatQueue'][_0xb49d('0x25')]({'raw':_0x3802c8[_0xb49d('0x1d')]?_0x3802c8[_0xb49d('0x1d')][_0xb49d('0x1e')]===undefined?!![]:![]:!![],'where':_0x3802c8[_0xb49d('0x1d')]?_0x3802c8[_0xb49d('0x1d')][_0xb49d('0x1f')]||null:null,'attributes':_0x3802c8[_0xb49d('0x1d')]?_0x3802c8['options']['attributes']||null:null,'include':_0x3802c8[_0xb49d('0x1d')]?_0x3802c8['options']['include']?_['map'](_0x3802c8[_0xb49d('0x1d')][_0xb49d('0x22')],function(_0x3964ec){return{'model':db[_0x3964ec[_0xb49d('0x24')]],'as':_0x3964ec['as'],'attributes':_0x3964ec[_0xb49d('0x20')],'include':_0x3964ec[_0xb49d('0x22')]?_['map'](_0x3964ec[_0xb49d('0x22')],function(_0x15c53f){return{'model':db[_0x15c53f['model']],'as':_0x15c53f['as'],'attributes':_0x15c53f[_0xb49d('0x20')],'include':_0x15c53f[_0xb49d('0x22')]?_[_0xb49d('0x23')](_0x15c53f['include'],function(_0x47e9ec){return{'model':db[_0x47e9ec[_0xb49d('0x24')]],'as':_0x47e9ec['as'],'attributes':_0x47e9ec[_0xb49d('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x45f497){logger['info']('ShowChatQueue',_0x3802c8);logger['debug']('ShowChatQueue',_0x3802c8,JSON[_0xb49d('0x16')](_0x45f497));_0xf0da2b(_0x45f497);})[_0xb49d('0x19')](function(_0x47150a){logger[_0xb49d('0x17')]('ShowChatQueue',_0x47150a['message'],_0x3802c8);_0x5e0f70(_0x463852[_0xb49d('0x17')](0x1f4,_0x47150a[_0xb49d('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.socket.js b/server/api/chatQueue/chatQueue.socket.js index 6d5d5a4..6d305c2 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 _0x2d17=['update','emit','register','chatQueue:','./chatQueue.events','save'];(function(_0x324229,_0xc9d85f){var _0x2231c3=function(_0x4a22a7){while(--_0x4a22a7){_0x324229['push'](_0x324229['shift']());}};_0x2231c3(++_0xc9d85f);}(_0x2d17,0x17e));var _0x72d1=function(_0x5cdf85,_0x4f5610){_0x5cdf85=_0x5cdf85-0x0;var _0x109a19=_0x2d17[_0x5cdf85];return _0x109a19;};'use strict';var ChatQueueEvents=require(_0x72d1('0x0'));var events=[_0x72d1('0x1'),'remove',_0x72d1('0x2')];function createListener(_0x4727f9,_0x531f4e){return function(_0x3687bc){_0x531f4e[_0x72d1('0x3')](_0x4727f9,_0x3687bc);};}function removeListener(_0x55b722,_0x1dd6d8){return function(){ChatQueueEvents['removeListener'](_0x55b722,_0x1dd6d8);};}exports[_0x72d1('0x4')]=function(_0x50f551){for(var _0x139ba0=0x0,_0x239d1f=events['length'];_0x139ba0<_0x239d1f;_0x139ba0++){var _0x477264=events[_0x139ba0];var _0x422f5a=createListener(_0x72d1('0x5')+_0x477264,_0x50f551);ChatQueueEvents['on'](_0x477264,_0x422f5a);}}; \ No newline at end of file +var _0x668b=['./chatQueue.events','save','update','removeListener','length'];(function(_0x11a92b,_0x15b34c){var _0x1e82f1=function(_0xb2e02d){while(--_0xb2e02d){_0x11a92b['push'](_0x11a92b['shift']());}};_0x1e82f1(++_0x15b34c);}(_0x668b,0x140));var _0xb668=function(_0xa2b098,_0x461a08){_0xa2b098=_0xa2b098-0x0;var _0x29502e=_0x668b[_0xa2b098];return _0x29502e;};'use strict';var ChatQueueEvents=require(_0xb668('0x0'));var events=[_0xb668('0x1'),'remove',_0xb668('0x2')];function createListener(_0x2c30c1,_0x49a53b){return function(_0x336ba4){_0x49a53b['emit'](_0x2c30c1,_0x336ba4);};}function removeListener(_0x2fab11,_0x4092a6){return function(){ChatQueueEvents[_0xb668('0x3')](_0x2fab11,_0x4092a6);};}exports['register']=function(_0x9b99a8){for(var _0x296fa9=0x0,_0x3be92e=events[_0xb668('0x4')];_0x296fa9<_0x3be92e;_0x296fa9++){var _0x20b749=events[_0x296fa9];var _0x3f01bc=createListener('chatQueue:'+_0x20b749,_0x9b99a8);ChatQueueEvents['on'](_0x20b749,_0x3f01bc);}}; \ No newline at end of file diff --git a/server/api/chatQueue/index.js b/server/api/chatQueue/index.js index ec36df3..ca7f30c 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(_0x507ec4,_0x4c246c){var _0x3ac5f7=function(_0x42ab90){while(--_0x42ab90){_0x507ec4['push'](_0x507ec4['shift']());}};_0x3ac5f7(++_0x4c246c);}(_0xe14b,0x93));var _0xbe14=function(_0x1ee887,_0x4fb489){_0x1ee887=_0x1ee887-0x0;var _0x2fd82b=_0xe14b[_0x1ee887];return _0x2fd82b;};'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 _0x3e74=['../../config/environment','./chatQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','show','getMembers','/:id/teams','getTeams','getAgents','post','addTeams','addAgents','put','delete','removeTeams','/:id/users','removeAgents','exports','multer','path','connect-timeout','express','../../components/auth/service'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x3e74,0x175));var _0x43e7=function(_0x1a9443,_0x2284ef){_0x1a9443=_0x1a9443-0x0;var _0x10135b=_0x3e74[_0x1a9443];return _0x10135b;};'use strict';var multer=require(_0x43e7('0x0'));var util=require('util');var path=require(_0x43e7('0x1'));var timeout=require(_0x43e7('0x2'));var express=require(_0x43e7('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x43e7('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x43e7('0x5'));var controller=require(_0x43e7('0x6'));router[_0x43e7('0x7')]('/',auth[_0x43e7('0x8')](),controller[_0x43e7('0x9')]);router['get'](_0x43e7('0xa'),auth[_0x43e7('0x8')](),controller[_0x43e7('0xb')]);router[_0x43e7('0x7')](_0x43e7('0xc'),auth['isAuthenticated'](),controller[_0x43e7('0xd')]);router['get']('/:id/members',auth[_0x43e7('0x8')](),controller[_0x43e7('0xe')]);router['get'](_0x43e7('0xf'),auth['isAuthenticated'](),controller[_0x43e7('0x10')]);router[_0x43e7('0x7')]('/:id/users',auth[_0x43e7('0x8')](),controller[_0x43e7('0x11')]);router[_0x43e7('0x12')]('/',auth[_0x43e7('0x8')](),controller['create']);router['post'](_0x43e7('0xf'),auth[_0x43e7('0x8')](),controller[_0x43e7('0x13')]);router['post']('/:id/users',auth[_0x43e7('0x8')](),controller[_0x43e7('0x14')]);router[_0x43e7('0x15')](_0x43e7('0xc'),auth['isAuthenticated'](),controller['update']);router[_0x43e7('0x16')](_0x43e7('0xc'),auth[_0x43e7('0x8')](),controller['destroy']);router['delete'](_0x43e7('0xf'),auth[_0x43e7('0x8')](),controller[_0x43e7('0x17')]);router[_0x43e7('0x16')](_0x43e7('0x18'),auth[_0x43e7('0x8')](),controller[_0x43e7('0x19')]);module[_0x43e7('0x1a')]=router; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.attributes.js b/server/api/chatQueueReport/chatQueueReport.attributes.js index f617cb9..d6c9dfe 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 _0x16a5=['STRING','DATE'];(function(_0x4e93a9,_0x413f30){var _0x43013c=function(_0x3a0cf3){while(--_0x3a0cf3){_0x4e93a9['push'](_0x4e93a9['shift']());}};_0x43013c(++_0x413f30);}(_0x16a5,0x106));var _0x516a=function(_0x5c351c,_0x2046d8){_0x5c351c=_0x5c351c-0x0;var _0x26f3b3=_0x16a5[_0x5c351c];return _0x26f3b3;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize[_0x516a('0x0')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x516a('0x1')]},'leaveAt':{'type':Sequelize[_0x516a('0x1')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0x516a('0x0')]}}; \ No newline at end of file +var _0x7f90=['sequelize','STRING','DATE'];(function(_0x24ef90,_0x5d3d10){var _0x5cdded=function(_0x198fbf){while(--_0x198fbf){_0x24ef90['push'](_0x24ef90['shift']());}};_0x5cdded(++_0x5d3d10);}(_0x7f90,0x1c5));var _0x07f9=function(_0x7ed9e9,_0x35fb5d){_0x7ed9e9=_0x7ed9e9-0x0;var _0x383437=_0x7f90[_0x7ed9e9];return _0x383437;};'use strict';var moment=require('moment');var Sequelize=require(_0x07f9('0x0'));module['exports']={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0x07f9('0x1')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x07f9('0x2')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x07f9('0x2')]},'reason':{'type':Sequelize[_0x07f9('0x1')]}}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.controller.js b/server/api/chatQueueReport/chatQueueReport.controller.js index 1e05612..66dce1a 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 _0x79bf=['reject','save','update','destroy','then','stack','name','send','index','map','ChatQueueReport','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','where','pick','filters','merge','options','count','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find','body','describe','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','offset','set','Content-Range','json'];(function(_0x6b4dab,_0x1f1c9a){var _0x42e1e2=function(_0x5650c6){while(--_0x5650c6){_0x6b4dab['push'](_0x6b4dab['shift']());}};_0x42e1e2(++_0x1f1c9a);}(_0x79bf,0x1df));var _0xf79b=function(_0x49d21f,_0x6e7f5){_0x49d21f=_0x49d21f-0x0;var _0x1b93f2=_0x79bf[_0x49d21f];return _0x1b93f2;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf79b('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf79b('0x1'));var rp=require('request-promise');var moment=require(_0xf79b('0x2'));var BPromise=require(_0xf79b('0x3'));var Mustache=require(_0xf79b('0x4'));var util=require(_0xf79b('0x5'));var path=require(_0xf79b('0x6'));var sox=require(_0xf79b('0x7'));var csv=require(_0xf79b('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf79b('0x9'));var _=require(_0xf79b('0xa'));var squel=require(_0xf79b('0xb'));var crypto=require('crypto');var jsforce=require(_0xf79b('0xc'));var deskjs=require(_0xf79b('0xd'));var toCsv=require(_0xf79b('0x8'));var querystring=require(_0xf79b('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xf79b('0xf'));var qs=require(_0xf79b('0x10'));var as=require(_0xf79b('0x11'));var hardwareService=require(_0xf79b('0x12'));var logger=require(_0xf79b('0x13'))(_0xf79b('0x14'));var utils=require(_0xf79b('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xf79b('0x16'));var db=require(_0xf79b('0x17'))['db'];function respondWithStatusCode(_0x1e7c75,_0x1bf2bf){_0x1bf2bf=_0x1bf2bf||0xcc;return function(_0x38e886){if(_0x38e886){return _0x1e7c75[_0xf79b('0x18')](_0x1bf2bf);}return _0x1e7c75[_0xf79b('0x19')](_0x1bf2bf)[_0xf79b('0x1a')]();};}function respondWithResult(_0x1ac99c,_0xe046eb){_0xe046eb=_0xe046eb||0xc8;return function(_0x1bd011){if(_0x1bd011){return _0x1ac99c[_0xf79b('0x19')](_0xe046eb)['json'](_0x1bd011);}};}function respondWithFilteredResult(_0x487967,_0x1647c5){return function(_0x595790){if(_0x595790){var _0x3caf78=typeof _0x1647c5['offset']===_0xf79b('0x1b')&&typeof _0x1647c5['limit']==='undefined';var _0x14b21d=_0x595790['count'];var _0x387e4e=_0x3caf78?0x0:_0x1647c5[_0xf79b('0x1c')];var _0x202d01=_0x3caf78?_0x595790['count']:_0x1647c5[_0xf79b('0x1c')]+_0x1647c5['limit'];var _0x379ac0;if(_0x202d01>=_0x14b21d){_0x202d01=_0x14b21d;_0x379ac0=0xc8;}else{_0x379ac0=0xce;}_0x487967[_0xf79b('0x19')](_0x379ac0);return _0x487967[_0xf79b('0x1d')](_0xf79b('0x1e'),_0x387e4e+'-'+_0x202d01+'/'+_0x14b21d)[_0xf79b('0x1f')](_0x595790);}return null;};}function patchUpdates(_0x4c91a6){return function(_0x27f68b){try{jsonpatch['apply'](_0x27f68b,_0x4c91a6,!![]);}catch(_0x5d33fa){return BPromise[_0xf79b('0x20')](_0x5d33fa);}return _0x27f68b[_0xf79b('0x21')]();};}function saveUpdates(_0x20a975,_0x400cfd){return function(_0x20a503){if(_0x20a503){return _0x20a503[_0xf79b('0x22')](_0x20a975)['then'](function(_0x255c13){return _0x255c13;});}return null;};}function removeEntity(_0x471e42,_0x378db3){return function(_0x13a339){if(_0x13a339){return _0x13a339[_0xf79b('0x23')]()[_0xf79b('0x24')](function(){_0x471e42[_0xf79b('0x19')](0xcc)[_0xf79b('0x1a')]();});}};}function handleEntityNotFound(_0xf1480e,_0x31bd2a){return function(_0x5c9dfb){if(!_0x5c9dfb){_0xf1480e[_0xf79b('0x18')](0x194);}return _0x5c9dfb;};}function handleError(_0x5e7f72,_0x55740a){_0x55740a=_0x55740a||0x1f4;return function(_0x1a99e3){logger['error'](_0x1a99e3[_0xf79b('0x25')]);if(_0x1a99e3[_0xf79b('0x26')]){delete _0x1a99e3[_0xf79b('0x26')];}_0x5e7f72[_0xf79b('0x19')](_0x55740a)[_0xf79b('0x27')](_0x1a99e3);};}exports[_0xf79b('0x28')]=function(_0x3e6171,_0x479b41){var _0x1bd31c={},_0x470f5b={},_0x1a4a13={'count':0x0,'rows':[]};var _0x5751f9=_[_0xf79b('0x29')](db[_0xf79b('0x2a')]['rawAttributes'],function(_0x152b06){return{'name':_0x152b06['fieldName'],'type':_0x152b06[_0xf79b('0x2b')][_0xf79b('0x2c')]};});_0x470f5b[_0xf79b('0x2d')]=_[_0xf79b('0x29')](_0x5751f9,_0xf79b('0x26'));_0x470f5b[_0xf79b('0x2e')]=_[_0xf79b('0x2f')](_0x3e6171[_0xf79b('0x2e')]);_0x470f5b['filters']=_[_0xf79b('0x30')](_0x470f5b[_0xf79b('0x2d')],_0x470f5b[_0xf79b('0x2e')]);_0x1bd31c[_0xf79b('0x31')]=_[_0xf79b('0x30')](_0x470f5b['model'],qs['fields'](_0x3e6171[_0xf79b('0x2e')][_0xf79b('0x32')]));_0x1bd31c[_0xf79b('0x31')]=_0x1bd31c[_0xf79b('0x31')][_0xf79b('0x33')]?_0x1bd31c['attributes']:_0x470f5b['model'];if(!_0x3e6171[_0xf79b('0x2e')][_0xf79b('0x34')](_0xf79b('0x35'))){_0x1bd31c[_0xf79b('0x36')]=qs[_0xf79b('0x36')](_0x3e6171[_0xf79b('0x2e')]['limit']);_0x1bd31c[_0xf79b('0x1c')]=qs[_0xf79b('0x1c')](_0x3e6171[_0xf79b('0x2e')][_0xf79b('0x1c')]);}_0x1bd31c[_0xf79b('0x37')]=qs['sort'](_0x3e6171[_0xf79b('0x2e')]['sort']);_0x1bd31c[_0xf79b('0x38')]=qs['filters'](_[_0xf79b('0x39')](_0x3e6171[_0xf79b('0x2e')],_0x470f5b[_0xf79b('0x3a')]),_0x5751f9);if(_0x3e6171[_0xf79b('0x2e')]['filter']){_0x1bd31c['where']=_['merge'](_0x1bd31c[_0xf79b('0x38')],{'$or':_[_0xf79b('0x29')](_0x5751f9,function(_0x5d0953){if(_0x5d0953[_0xf79b('0x2b')]!=='VIRTUAL'){var _0x14501a={};_0x14501a[_0x5d0953[_0xf79b('0x26')]]={'$like':'%'+_0x3e6171[_0xf79b('0x2e')]['filter']+'%'};return _0x14501a;}})});}_0x1bd31c=_[_0xf79b('0x3b')]({},_0x1bd31c,_0x3e6171[_0xf79b('0x3c')]);var _0x4ae653={'where':_0x1bd31c[_0xf79b('0x38')]};return db['ChatQueueReport'][_0xf79b('0x3d')](_0x4ae653)[_0xf79b('0x24')](function(_0x17bf96){_0x1a4a13[_0xf79b('0x3d')]=_0x17bf96;if(_0x3e6171[_0xf79b('0x2e')][_0xf79b('0x3e')]){_0x1bd31c[_0xf79b('0x3f')]=[{'all':!![]}];}return db[_0xf79b('0x2a')][_0xf79b('0x40')](_0x1bd31c);})[_0xf79b('0x24')](function(_0x1cbb9a){_0x1a4a13[_0xf79b('0x41')]=_0x1cbb9a;return _0x1a4a13;})['then'](respondWithFilteredResult(_0x479b41,_0x1bd31c))[_0xf79b('0x42')](handleError(_0x479b41,null));};exports[_0xf79b('0x43')]=function(_0x4e495d,_0x4a1a04){var _0x12e8a1={'raw':!![],'where':{'id':_0x4e495d[_0xf79b('0x44')]['id']}},_0x3953c8={};_0x3953c8[_0xf79b('0x2d')]=_[_0xf79b('0x2f')](db['ChatQueueReport'][_0xf79b('0x45')]);_0x3953c8[_0xf79b('0x2e')]=_[_0xf79b('0x2f')](_0x4e495d[_0xf79b('0x2e')]);_0x3953c8[_0xf79b('0x3a')]=_[_0xf79b('0x30')](_0x3953c8[_0xf79b('0x2d')],_0x3953c8[_0xf79b('0x2e')]);_0x12e8a1[_0xf79b('0x31')]=_[_0xf79b('0x30')](_0x3953c8[_0xf79b('0x2d')],qs[_0xf79b('0x32')](_0x4e495d[_0xf79b('0x2e')][_0xf79b('0x32')]));_0x12e8a1[_0xf79b('0x31')]=_0x12e8a1[_0xf79b('0x31')]['length']?_0x12e8a1[_0xf79b('0x31')]:_0x3953c8['model'];if(_0x4e495d[_0xf79b('0x2e')][_0xf79b('0x3e')]){_0x12e8a1[_0xf79b('0x3f')]=[{'all':!![]}];}_0x12e8a1=_[_0xf79b('0x3b')]({},_0x12e8a1,_0x4e495d[_0xf79b('0x3c')]);return db[_0xf79b('0x2a')][_0xf79b('0x46')](_0x12e8a1)[_0xf79b('0x24')](handleEntityNotFound(_0x4a1a04,null))[_0xf79b('0x24')](respondWithResult(_0x4a1a04,null))['catch'](handleError(_0x4a1a04,null));};exports['create']=function(_0xba74c7,_0x58fade){return db['ChatQueueReport']['create'](_0xba74c7[_0xf79b('0x47')],{})[_0xf79b('0x24')](respondWithResult(_0x58fade,0xc9))[_0xf79b('0x42')](handleError(_0x58fade,null));};exports['update']=function(_0xe5b3e6,_0xc61317){if(_0xe5b3e6['body']['id']){delete _0xe5b3e6[_0xf79b('0x47')]['id'];}return db[_0xf79b('0x2a')]['find']({'where':{'id':_0xe5b3e6[_0xf79b('0x44')]['id']}})[_0xf79b('0x24')](handleEntityNotFound(_0xc61317,null))[_0xf79b('0x24')](saveUpdates(_0xe5b3e6[_0xf79b('0x47')],null))[_0xf79b('0x24')](respondWithResult(_0xc61317,null))[_0xf79b('0x42')](handleError(_0xc61317,null));};exports[_0xf79b('0x23')]=function(_0x1ca74a,_0x5ed363){return db[_0xf79b('0x2a')][_0xf79b('0x46')]({'where':{'id':_0x1ca74a[_0xf79b('0x44')]['id']}})[_0xf79b('0x24')](handleEntityNotFound(_0x5ed363,null))[_0xf79b('0x24')](removeEntity(_0x5ed363,null))[_0xf79b('0x42')](handleError(_0x5ed363,null));};exports['describe']=function(_0x2ab57a,_0x5ee2b6){return db[_0xf79b('0x2a')][_0xf79b('0x48')]()[_0xf79b('0x24')](respondWithResult(_0x5ee2b6,null))['catch'](handleError(_0x5ee2b6,null));}; \ No newline at end of file +var _0x9bd9=['ChatQueueReport','rawAttributes','fieldName','type','key','model','query','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','filters','pick','filter','merge','map','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','keys','find','create','body','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','Content-Range','apply','reject','then','error','name','index'];(function(_0x23ebcf,_0x732dee){var _0x1f3f3f=function(_0x1f7abf){while(--_0x1f7abf){_0x23ebcf['push'](_0x23ebcf['shift']());}};_0x1f3f3f(++_0x732dee);}(_0x9bd9,0x1a4));var _0x99bd=function(_0x4a2b3c,_0xc69f59){_0x4a2b3c=_0x4a2b3c-0x0;var _0x4b081b=_0x9bd9[_0x4a2b3c];return _0x4b081b;};'use strict';var emlformat=require(_0x99bd('0x0'));var rimraf=require(_0x99bd('0x1'));var zipdir=require(_0x99bd('0x2'));var jsonpatch=require(_0x99bd('0x3'));var rp=require(_0x99bd('0x4'));var moment=require(_0x99bd('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x99bd('0x6'));var util=require('util');var path=require(_0x99bd('0x7'));var sox=require(_0x99bd('0x8'));var csv=require('to-csv');var ejs=require(_0x99bd('0x9'));var fs=require('fs');var fs_extra=require(_0x99bd('0xa'));var _=require(_0x99bd('0xb'));var squel=require(_0x99bd('0xc'));var crypto=require(_0x99bd('0xd'));var jsforce=require(_0x99bd('0xe'));var deskjs=require(_0x99bd('0xf'));var toCsv=require(_0x99bd('0x10'));var querystring=require(_0x99bd('0x11'));var Papa=require(_0x99bd('0x12'));var Redis=require(_0x99bd('0x13'));var authService=require(_0x99bd('0x14'));var qs=require(_0x99bd('0x15'));var as=require(_0x99bd('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x99bd('0x17'))('api');var utils=require(_0x99bd('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x99bd('0x19'));var db=require(_0x99bd('0x1a'))['db'];function respondWithStatusCode(_0x4a8bd9,_0x22237c){_0x22237c=_0x22237c||0xcc;return function(_0x500cd2){if(_0x500cd2){return _0x4a8bd9[_0x99bd('0x1b')](_0x22237c);}return _0x4a8bd9['status'](_0x22237c)[_0x99bd('0x1c')]();};}function respondWithResult(_0x401299,_0x141159){_0x141159=_0x141159||0xc8;return function(_0x4a9770){if(_0x4a9770){return _0x401299[_0x99bd('0x1d')](_0x141159)[_0x99bd('0x1e')](_0x4a9770);}};}function respondWithFilteredResult(_0x2d918a,_0x42b619){return function(_0x65a2e5){if(_0x65a2e5){var _0x491d9=typeof _0x42b619[_0x99bd('0x1f')]===_0x99bd('0x20')&&typeof _0x42b619[_0x99bd('0x21')]==='undefined';var _0x378079=_0x65a2e5[_0x99bd('0x22')];var _0x2fe078=_0x491d9?0x0:_0x42b619['offset'];var _0x4b98fc=_0x491d9?_0x65a2e5[_0x99bd('0x22')]:_0x42b619[_0x99bd('0x1f')]+_0x42b619[_0x99bd('0x21')];var _0xfa6227;if(_0x4b98fc>=_0x378079){_0x4b98fc=_0x378079;_0xfa6227=0xc8;}else{_0xfa6227=0xce;}_0x2d918a[_0x99bd('0x1d')](_0xfa6227);return _0x2d918a['set'](_0x99bd('0x23'),_0x2fe078+'-'+_0x4b98fc+'/'+_0x378079)['json'](_0x65a2e5);}return null;};}function patchUpdates(_0x10f2fb){return function(_0x3085df){try{jsonpatch[_0x99bd('0x24')](_0x3085df,_0x10f2fb,!![]);}catch(_0x1d937b){return BPromise[_0x99bd('0x25')](_0x1d937b);}return _0x3085df['save']();};}function saveUpdates(_0x27c551,_0x229322){return function(_0x3e339c){if(_0x3e339c){return _0x3e339c['update'](_0x27c551)[_0x99bd('0x26')](function(_0x5e6081){return _0x5e6081;});}return null;};}function removeEntity(_0x4d3ebb,_0x1c5b82){return function(_0xfdc455){if(_0xfdc455){return _0xfdc455['destroy']()[_0x99bd('0x26')](function(){_0x4d3ebb[_0x99bd('0x1d')](0xcc)[_0x99bd('0x1c')]();});}};}function handleEntityNotFound(_0x3f7bf4,_0x51ff34){return function(_0x12daac){if(!_0x12daac){_0x3f7bf4['sendStatus'](0x194);}return _0x12daac;};}function handleError(_0x550b7f,_0x10d5cd){_0x10d5cd=_0x10d5cd||0x1f4;return function(_0x5ebeeb){logger[_0x99bd('0x27')](_0x5ebeeb['stack']);if(_0x5ebeeb[_0x99bd('0x28')]){delete _0x5ebeeb[_0x99bd('0x28')];}_0x550b7f['status'](_0x10d5cd)['send'](_0x5ebeeb);};}exports[_0x99bd('0x29')]=function(_0x1af1e6,_0x1eabb9){var _0x5903aa={},_0x957d48={},_0x1d0642={'count':0x0,'rows':[]};var _0x2250d8=_['map'](db[_0x99bd('0x2a')][_0x99bd('0x2b')],function(_0x4c5493){return{'name':_0x4c5493[_0x99bd('0x2c')],'type':_0x4c5493[_0x99bd('0x2d')][_0x99bd('0x2e')]};});_0x957d48[_0x99bd('0x2f')]=_['map'](_0x2250d8,_0x99bd('0x28'));_0x957d48[_0x99bd('0x30')]=_['keys'](_0x1af1e6[_0x99bd('0x30')]);_0x957d48['filters']=_['intersection'](_0x957d48['model'],_0x957d48[_0x99bd('0x30')]);_0x5903aa[_0x99bd('0x31')]=_[_0x99bd('0x32')](_0x957d48[_0x99bd('0x2f')],qs[_0x99bd('0x33')](_0x1af1e6[_0x99bd('0x30')][_0x99bd('0x33')]));_0x5903aa[_0x99bd('0x31')]=_0x5903aa[_0x99bd('0x31')][_0x99bd('0x34')]?_0x5903aa['attributes']:_0x957d48[_0x99bd('0x2f')];if(!_0x1af1e6['query'][_0x99bd('0x35')]('nolimit')){_0x5903aa['limit']=qs['limit'](_0x1af1e6[_0x99bd('0x30')][_0x99bd('0x21')]);_0x5903aa[_0x99bd('0x1f')]=qs[_0x99bd('0x1f')](_0x1af1e6['query'][_0x99bd('0x1f')]);}_0x5903aa[_0x99bd('0x36')]=qs[_0x99bd('0x37')](_0x1af1e6[_0x99bd('0x30')]['sort']);_0x5903aa[_0x99bd('0x38')]=qs[_0x99bd('0x39')](_[_0x99bd('0x3a')](_0x1af1e6[_0x99bd('0x30')],_0x957d48['filters']),_0x2250d8);if(_0x1af1e6[_0x99bd('0x30')][_0x99bd('0x3b')]){_0x5903aa[_0x99bd('0x38')]=_[_0x99bd('0x3c')](_0x5903aa['where'],{'$or':_[_0x99bd('0x3d')](_0x2250d8,function(_0x3d2b0f){if(_0x3d2b0f[_0x99bd('0x2d')]!==_0x99bd('0x3e')){var _0x7e29ec={};_0x7e29ec[_0x3d2b0f[_0x99bd('0x28')]]={'$like':'%'+_0x1af1e6[_0x99bd('0x30')][_0x99bd('0x3b')]+'%'};return _0x7e29ec;}})});}_0x5903aa=_[_0x99bd('0x3c')]({},_0x5903aa,_0x1af1e6[_0x99bd('0x3f')]);var _0x2fcf71={'where':_0x5903aa[_0x99bd('0x38')]};return db[_0x99bd('0x2a')]['count'](_0x2fcf71)[_0x99bd('0x26')](function(_0x1ecdd6){_0x1d0642[_0x99bd('0x22')]=_0x1ecdd6;if(_0x1af1e6[_0x99bd('0x30')][_0x99bd('0x40')]){_0x5903aa[_0x99bd('0x41')]=[{'all':!![]}];}return db[_0x99bd('0x2a')][_0x99bd('0x42')](_0x5903aa);})[_0x99bd('0x26')](function(_0x7e84b1){_0x1d0642[_0x99bd('0x43')]=_0x7e84b1;return _0x1d0642;})[_0x99bd('0x26')](respondWithFilteredResult(_0x1eabb9,_0x5903aa))[_0x99bd('0x44')](handleError(_0x1eabb9,null));};exports[_0x99bd('0x45')]=function(_0xb0ffe5,_0x2d91be){var _0x369fb5={'raw':!![],'where':{'id':_0xb0ffe5[_0x99bd('0x46')]['id']}},_0x5a4a96={};_0x5a4a96[_0x99bd('0x2f')]=_[_0x99bd('0x47')](db[_0x99bd('0x2a')][_0x99bd('0x2b')]);_0x5a4a96[_0x99bd('0x30')]=_[_0x99bd('0x47')](_0xb0ffe5[_0x99bd('0x30')]);_0x5a4a96['filters']=_[_0x99bd('0x32')](_0x5a4a96[_0x99bd('0x2f')],_0x5a4a96[_0x99bd('0x30')]);_0x369fb5['attributes']=_[_0x99bd('0x32')](_0x5a4a96[_0x99bd('0x2f')],qs[_0x99bd('0x33')](_0xb0ffe5['query'][_0x99bd('0x33')]));_0x369fb5['attributes']=_0x369fb5['attributes']['length']?_0x369fb5[_0x99bd('0x31')]:_0x5a4a96[_0x99bd('0x2f')];if(_0xb0ffe5[_0x99bd('0x30')]['includeAll']){_0x369fb5[_0x99bd('0x41')]=[{'all':!![]}];}_0x369fb5=_[_0x99bd('0x3c')]({},_0x369fb5,_0xb0ffe5[_0x99bd('0x3f')]);return db['ChatQueueReport'][_0x99bd('0x48')](_0x369fb5)[_0x99bd('0x26')](handleEntityNotFound(_0x2d91be,null))['then'](respondWithResult(_0x2d91be,null))['catch'](handleError(_0x2d91be,null));};exports[_0x99bd('0x49')]=function(_0x1d7ec0,_0x3487c6){return db['ChatQueueReport']['create'](_0x1d7ec0[_0x99bd('0x4a')],{})[_0x99bd('0x26')](respondWithResult(_0x3487c6,0xc9))[_0x99bd('0x44')](handleError(_0x3487c6,null));};exports['update']=function(_0x3fa8e1,_0x4e71b3){if(_0x3fa8e1[_0x99bd('0x4a')]['id']){delete _0x3fa8e1[_0x99bd('0x4a')]['id'];}return db[_0x99bd('0x2a')][_0x99bd('0x48')]({'where':{'id':_0x3fa8e1[_0x99bd('0x46')]['id']}})['then'](handleEntityNotFound(_0x4e71b3,null))[_0x99bd('0x26')](saveUpdates(_0x3fa8e1['body'],null))[_0x99bd('0x26')](respondWithResult(_0x4e71b3,null))[_0x99bd('0x44')](handleError(_0x4e71b3,null));};exports[_0x99bd('0x4b')]=function(_0x1912ac,_0x2100c7){return db[_0x99bd('0x2a')][_0x99bd('0x48')]({'where':{'id':_0x1912ac['params']['id']}})['then'](handleEntityNotFound(_0x2100c7,null))[_0x99bd('0x26')](removeEntity(_0x2100c7,null))[_0x99bd('0x44')](handleError(_0x2100c7,null));};exports[_0x99bd('0x4c')]=function(_0x2f0fb7,_0x25c67d){return db[_0x99bd('0x2a')][_0x99bd('0x4c')]()['then'](respondWithResult(_0x25c67d,null))['catch'](handleError(_0x25c67d,null));}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.model.js b/server/api/chatQueueReport/chatQueueReport.model.js index 2e8d576..98198dc 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(_0x2847ec,_0x40ce19){var _0x507988=function(_0x3545a1){while(--_0x3545a1){_0x2847ec['push'](_0x2847ec['shift']());}};_0x507988(++_0x40ce19);}(_0xe706,0xa3));var _0x6e70=function(_0x4b573a,_0x13828a){_0x4b573a=_0x4b573a-0x0;var _0x1ae343=_0xe706[_0x4b573a];return _0x1ae343;};'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 _0xe706=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatQueueReport.attributes','exports','define','ChatQueueReport','report_chat_queue','uniqueid','lodash','util'];(function(_0xc471d2,_0x26ab16){var _0x334c68=function(_0x2deae4){while(--_0x2deae4){_0xc471d2['push'](_0xc471d2['shift']());}};_0x334c68(++_0x26ab16);}(_0xe706,0xa3));var _0x6e70=function(_0x3747ae,_0x408e61){_0x3747ae=_0x3747ae-0x0;var _0x339035=_0xe706[_0x3747ae];return _0x339035;};'use strict';var _=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var logger=require(_0x6e70('0x2'))('api');var moment=require(_0x6e70('0x3'));var BPromise=require(_0x6e70('0x4'));var rp=require(_0x6e70('0x5'));var fs=require('fs');var path=require(_0x6e70('0x6'));var rimraf=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));var attributes=require(_0x6e70('0x9'));module[_0x6e70('0xa')]=function(_0x1b0389,_0x4381d1){return _0x1b0389[_0x6e70('0xb')](_0x6e70('0xc'),attributes,{'tableName':_0x6e70('0xd'),'paranoid':![],'indexes':[{'name':_0x6e70('0xe'),'fields':[_0x6e70('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.rpc.js b/server/api/chatQueueReport/chatQueueReport.rpc.js index d515435..68ed440 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 _0x7f5e=['error','code','message','info','result','catch','CreateChatQueueReport','ChatQueueReport','body','options','raw','stringify','UpdateChatQueueReport','where','attributes','limit','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','request','then','ChatQueueReport,\x20%s,\x20%s','request\x20sent','debug','ChatQueueReport,\x20%s,\x20%s,\x20%s'];(function(_0x350322,_0x445604){var _0x1d6fea=function(_0x3ae5cb){while(--_0x3ae5cb){_0x350322['push'](_0x350322['shift']());}};_0x1d6fea(++_0x445604);}(_0x7f5e,0x139));var _0xe7f5=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x7f5e[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xe7f5('0x0'));var util=require(_0xe7f5('0x1'));var moment=require('moment');var BPromise=require(_0xe7f5('0x2'));var rs=require(_0xe7f5('0x3'));var fs=require('fs');var Redis=require(_0xe7f5('0x4'));var db=require(_0xe7f5('0x5'))['db'];var utils=require(_0xe7f5('0x6'));var logger=require(_0xe7f5('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0xe7f5('0x8'));var client=jayson[_0xe7f5('0x9')][_0xe7f5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3d870f,_0x109d1c,_0x6caf0d){return new BPromise(function(_0x2b528b,_0x2b7095){return client[_0xe7f5('0xb')](_0x3d870f,_0x6caf0d)[_0xe7f5('0xc')](function(_0x304323){logger['info'](_0xe7f5('0xd'),_0x109d1c,_0xe7f5('0xe'));logger[_0xe7f5('0xf')](_0xe7f5('0x10'),_0x109d1c,_0xe7f5('0xe'),JSON['stringify'](_0x304323));if(_0x304323[_0xe7f5('0x11')]){if(_0x304323[_0xe7f5('0x11')][_0xe7f5('0x12')]===0x1f4){logger[_0xe7f5('0x11')]('ChatQueueReport,\x20%s,\x20%s',_0x109d1c,_0x304323[_0xe7f5('0x11')][_0xe7f5('0x13')]);return _0x2b7095(_0x304323[_0xe7f5('0x11')][_0xe7f5('0x13')]);}logger['error'](_0xe7f5('0xd'),_0x109d1c,_0x304323['error'][_0xe7f5('0x13')]);return _0x2b528b(_0x304323[_0xe7f5('0x11')][_0xe7f5('0x13')]);}else{logger[_0xe7f5('0x14')]('ChatQueueReport,\x20%s,\x20%s',_0x109d1c,_0xe7f5('0xe'));_0x2b528b(_0x304323[_0xe7f5('0x15')][_0xe7f5('0x13')]);}})[_0xe7f5('0x16')](function(_0x5671aa){logger['error'](_0xe7f5('0xd'),_0x109d1c,_0x5671aa);_0x2b7095(_0x5671aa);});});}exports[_0xe7f5('0x17')]=function(_0x214824){var _0x5ce8c7=this;return new Promise(function(_0x2bdaf8,_0x3141f2){return db[_0xe7f5('0x18')]['create'](_0x214824[_0xe7f5('0x19')],{'raw':_0x214824[_0xe7f5('0x1a')]?_0x214824[_0xe7f5('0x1a')][_0xe7f5('0x1b')]===undefined?!![]:![]:!![]})['then'](function(_0x2b7ef0){logger['info'](_0xe7f5('0x17'),_0x214824);logger[_0xe7f5('0xf')](_0xe7f5('0x17'),_0x214824,JSON[_0xe7f5('0x1c')](_0x2b7ef0));_0x2bdaf8(_0x2b7ef0);})[_0xe7f5('0x16')](function(_0x377233){logger[_0xe7f5('0x11')](_0xe7f5('0x17'),_0x377233['message'],_0x214824);_0x3141f2(_0x5ce8c7[_0xe7f5('0x11')](0x1f4,_0x377233[_0xe7f5('0x13')]));});});};exports[_0xe7f5('0x1d')]=function(_0x3aceca){var _0x3dcb99=this;return new Promise(function(_0x54aa75,_0x11d3df){return db[_0xe7f5('0x18')]['update'](_0x3aceca[_0xe7f5('0x19')],{'raw':_0x3aceca[_0xe7f5('0x1a')]?_0x3aceca[_0xe7f5('0x1a')][_0xe7f5('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3aceca['options']?_0x3aceca[_0xe7f5('0x1a')][_0xe7f5('0x1e')]||null:null,'attributes':_0x3aceca[_0xe7f5('0x1a')]?_0x3aceca['options'][_0xe7f5('0x1f')]||null:null,'limit':_0x3aceca[_0xe7f5('0x1a')]?_0x3aceca['options'][_0xe7f5('0x20')]||null:null})[_0xe7f5('0xc')](function(_0x30a03a){logger['info'](_0xe7f5('0x1d'),_0x3aceca);logger[_0xe7f5('0xf')](_0xe7f5('0x1d'),_0x3aceca,JSON[_0xe7f5('0x1c')](_0x30a03a));_0x54aa75(_0x30a03a);})[_0xe7f5('0x16')](function(_0x166bff){logger[_0xe7f5('0x11')](_0xe7f5('0x1d'),_0x166bff['message'],_0x3aceca);_0x11d3df(_0x3dcb99['error'](0x1f4,_0x166bff[_0xe7f5('0x13')]));});});}; \ No newline at end of file +var _0x502a=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','then','ChatQueueReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','catch','CreateChatQueueReport','ChatQueueReport','create','body','options','UpdateChatQueueReport','update','raw','where','limit','util'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x502a,0x1df));var _0xa502=function(_0xb0b376,_0x4bc0a3){_0xb0b376=_0xb0b376-0x0;var _0xe274=_0x502a[_0xb0b376];return _0xe274;};'use strict';var _=require('lodash');var util=require(_0xa502('0x0'));var moment=require(_0xa502('0x1'));var BPromise=require(_0xa502('0x2'));var rs=require(_0xa502('0x3'));var fs=require('fs');var Redis=require(_0xa502('0x4'));var db=require(_0xa502('0x5'))['db'];var utils=require(_0xa502('0x6'));var logger=require(_0xa502('0x7'))(_0xa502('0x8'));var config=require(_0xa502('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xa502('0xa')][_0xa502('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x39df41,_0x1e5600,_0x2e102b){return new BPromise(function(_0x5f463a,_0x2a70f3){return client['request'](_0x39df41,_0x2e102b)[_0xa502('0xc')](function(_0x305a4b){logger['info'](_0xa502('0xd'),_0x1e5600,_0xa502('0xe'));logger[_0xa502('0xf')]('ChatQueueReport,\x20%s,\x20%s,\x20%s',_0x1e5600,'request\x20sent',JSON[_0xa502('0x10')](_0x305a4b));if(_0x305a4b[_0xa502('0x11')]){if(_0x305a4b[_0xa502('0x11')][_0xa502('0x12')]===0x1f4){logger['error']('ChatQueueReport,\x20%s,\x20%s',_0x1e5600,_0x305a4b['error'][_0xa502('0x13')]);return _0x2a70f3(_0x305a4b[_0xa502('0x11')][_0xa502('0x13')]);}logger[_0xa502('0x11')](_0xa502('0xd'),_0x1e5600,_0x305a4b[_0xa502('0x11')]['message']);return _0x5f463a(_0x305a4b['error'][_0xa502('0x13')]);}else{logger[_0xa502('0x14')]('ChatQueueReport,\x20%s,\x20%s',_0x1e5600,_0xa502('0xe'));_0x5f463a(_0x305a4b['result'][_0xa502('0x13')]);}})[_0xa502('0x15')](function(_0x2e37f8){logger[_0xa502('0x11')](_0xa502('0xd'),_0x1e5600,_0x2e37f8);_0x2a70f3(_0x2e37f8);});});}exports[_0xa502('0x16')]=function(_0x69ac3b){var _0x3b7719=this;return new Promise(function(_0x377739,_0xe4fe73){return db[_0xa502('0x17')][_0xa502('0x18')](_0x69ac3b[_0xa502('0x19')],{'raw':_0x69ac3b[_0xa502('0x1a')]?_0x69ac3b['options']['raw']===undefined?!![]:![]:!![]})[_0xa502('0xc')](function(_0x2d9060){logger['info'](_0xa502('0x16'),_0x69ac3b);logger['debug'](_0xa502('0x16'),_0x69ac3b,JSON[_0xa502('0x10')](_0x2d9060));_0x377739(_0x2d9060);})[_0xa502('0x15')](function(_0x3459e4){logger[_0xa502('0x11')]('CreateChatQueueReport',_0x3459e4[_0xa502('0x13')],_0x69ac3b);_0xe4fe73(_0x3b7719['error'](0x1f4,_0x3459e4[_0xa502('0x13')]));});});};exports[_0xa502('0x1b')]=function(_0x3492c6){var _0x2819e1=this;return new Promise(function(_0x9c55fb,_0x405ae0){return db[_0xa502('0x17')][_0xa502('0x1c')](_0x3492c6[_0xa502('0x19')],{'raw':_0x3492c6['options']?_0x3492c6[_0xa502('0x1a')][_0xa502('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3492c6['options']?_0x3492c6[_0xa502('0x1a')][_0xa502('0x1e')]||null:null,'attributes':_0x3492c6['options']?_0x3492c6[_0xa502('0x1a')]['attributes']||null:null,'limit':_0x3492c6[_0xa502('0x1a')]?_0x3492c6[_0xa502('0x1a')][_0xa502('0x1f')]||null:null})['then'](function(_0x577861){logger['info']('UpdateChatQueueReport',_0x3492c6);logger['debug']('UpdateChatQueueReport',_0x3492c6,JSON['stringify'](_0x577861));_0x9c55fb(_0x577861);})[_0xa502('0x15')](function(_0x13c432){logger[_0xa502('0x11')](_0xa502('0x1b'),_0x13c432['message'],_0x3492c6);_0x405ae0(_0x2819e1[_0xa502('0x11')](0x1f4,_0x13c432[_0xa502('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/index.js b/server/api/chatQueueReport/index.js index 70cfaa8..20fbc9e 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 _0xd86d=['get','isAuthenticated','index','/describe','describe','/:id','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatQueueReport.controller'];(function(_0xdeab51,_0x5cb7ca){var _0x597a97=function(_0x53fe7e){while(--_0x53fe7e){_0xdeab51['push'](_0xdeab51['shift']());}};_0x597a97(++_0x5cb7ca);}(_0xd86d,0xd3));var _0xdd86=function(_0x5f2f74,_0x48e50a){_0x5f2f74=_0x5f2f74-0x0;var _0x2d4176=_0xd86d[_0x5f2f74];return _0x2d4176;};'use strict';var multer=require(_0xdd86('0x0'));var util=require(_0xdd86('0x1'));var path=require(_0xdd86('0x2'));var timeout=require(_0xdd86('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xdd86('0x4'));var auth=require(_0xdd86('0x5'));var interaction=require(_0xdd86('0x6'));var config=require(_0xdd86('0x7'));var controller=require(_0xdd86('0x8'));router[_0xdd86('0x9')]('/',auth[_0xdd86('0xa')](),controller[_0xdd86('0xb')]);router[_0xdd86('0x9')](_0xdd86('0xc'),auth[_0xdd86('0xa')](),controller[_0xdd86('0xd')]);router[_0xdd86('0x9')](_0xdd86('0xe'),auth[_0xdd86('0xa')](),controller['show']);router[_0xdd86('0xf')]('/',auth[_0xdd86('0xa')](),controller[_0xdd86('0x10')]);router[_0xdd86('0x11')](_0xdd86('0xe'),auth[_0xdd86('0xa')](),controller[_0xdd86('0x12')]);router[_0xdd86('0x13')](_0xdd86('0xe'),auth[_0xdd86('0xa')](),controller[_0xdd86('0x14')]);module[_0xdd86('0x15')]=router; \ No newline at end of file +var _0x735f=['../../components/interaction/service','../../config/environment','./chatQueueReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra'];(function(_0x556f1f,_0x2897d){var _0x3ade22=function(_0x1c8284){while(--_0x1c8284){_0x556f1f['push'](_0x556f1f['shift']());}};_0x3ade22(++_0x2897d);}(_0x735f,0x179));var _0xf735=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x735f[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xf735('0x0'));var util=require(_0xf735('0x1'));var path=require(_0xf735('0x2'));var timeout=require(_0xf735('0x3'));var express=require(_0xf735('0x4'));var router=express[_0xf735('0x5')]();var fs_extra=require(_0xf735('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xf735('0x7'));var config=require(_0xf735('0x8'));var controller=require(_0xf735('0x9'));router[_0xf735('0xa')]('/',auth[_0xf735('0xb')](),controller[_0xf735('0xc')]);router[_0xf735('0xa')](_0xf735('0xd'),auth[_0xf735('0xb')](),controller[_0xf735('0xe')]);router[_0xf735('0xa')](_0xf735('0xf'),auth[_0xf735('0xb')](),controller[_0xf735('0x10')]);router[_0xf735('0x11')]('/',auth[_0xf735('0xb')](),controller[_0xf735('0x12')]);router[_0xf735('0x13')](_0xf735('0xf'),auth[_0xf735('0xb')](),controller[_0xf735('0x14')]);router[_0xf735('0x15')](_0xf735('0xf'),auth['isAuthenticated'](),controller[_0xf735('0x16')]);module[_0xf735('0x17')]=router; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.attributes.js b/server/api/chatTransferReport/chatTransferReport.attributes.js index 21525de..6e8cb4f 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(_0x2c85c0,_0x1dac4f){var _0xf4d4c9=function(_0xcd61ab){while(--_0xcd61ab){_0x2c85c0['push'](_0x2c85c0['shift']());}};_0xf4d4c9(++_0x1dac4f);}(_0x54ef,0x112));var _0xf54e=function(_0x4a84ae,_0x2baa1f){_0x4a84ae=_0x4a84ae-0x0;var _0xdac11=_0x54ef[_0x4a84ae];return _0xdac11;};'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 _0x70e0=['NOW','moment','sequelize','exports','account','agent','queue'];(function(_0x2933d1,_0x34a4e5){var _0x45134e=function(_0x341d04){while(--_0x341d04){_0x2933d1['push'](_0x2933d1['shift']());}};_0x45134e(++_0x34a4e5);}(_0x70e0,0x17b));var _0x070e=function(_0xe5708b,_0x45df1c){_0xe5708b=_0xe5708b-0x0;var _0x41bad8=_0x70e0[_0xe5708b];return _0x41bad8;};'use strict';var moment=require(_0x070e('0x0'));var Sequelize=require(_0x070e('0x1'));module[_0x070e('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x070e('0x3'),_0x070e('0x4'),_0x070e('0x5')),'allowNull':![],'defaultValue':_0x070e('0x5')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x070e('0x6')]}}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.controller.js b/server/api/chatTransferReport/chatTransferReport.controller.js index c44ae26..a6df224 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 _0xe854=['ChatTransferReport','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','VIRTUAL','merge','options','includeAll','include','rows','show','params','create','body','find','catch','describe','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','apply','reject','save','update','then','destroy','error','stack','name','send','index','map'];(function(_0x1f6dd4,_0x20132f){var _0x398228=function(_0x26236d){while(--_0x26236d){_0x1f6dd4['push'](_0x1f6dd4['shift']());}};_0x398228(++_0x20132f);}(_0xe854,0xb6));var _0x4e85=function(_0x2af235,_0x45f664){_0x2af235=_0x2af235-0x0;var _0x593c0e=_0xe854[_0x2af235];return _0x593c0e;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x4e85('0x0'));var jsonpatch=require(_0x4e85('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x4e85('0x2'));var Mustache=require(_0x4e85('0x3'));var util=require(_0x4e85('0x4'));var path=require(_0x4e85('0x5'));var sox=require(_0x4e85('0x6'));var csv=require(_0x4e85('0x7'));var ejs=require(_0x4e85('0x8'));var fs=require('fs');var fs_extra=require(_0x4e85('0x9'));var _=require(_0x4e85('0xa'));var squel=require(_0x4e85('0xb'));var crypto=require(_0x4e85('0xc'));var jsforce=require(_0x4e85('0xd'));var deskjs=require(_0x4e85('0xe'));var toCsv=require(_0x4e85('0x7'));var querystring=require(_0x4e85('0xf'));var Papa=require('papaparse');var Redis=require(_0x4e85('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x4e85('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x4e85('0x12'))(_0x4e85('0x13'));var utils=require('../../config/utils');var config=require(_0x4e85('0x14'));var licenseUtil=require(_0x4e85('0x15'));var db=require(_0x4e85('0x16'))['db'];function respondWithStatusCode(_0x15f3ca,_0x57a5e7){_0x57a5e7=_0x57a5e7||0xcc;return function(_0x381b7b){if(_0x381b7b){return _0x15f3ca[_0x4e85('0x17')](_0x57a5e7);}return _0x15f3ca[_0x4e85('0x18')](_0x57a5e7)[_0x4e85('0x19')]();};}function respondWithResult(_0x94476,_0x49361c){_0x49361c=_0x49361c||0xc8;return function(_0x135903){if(_0x135903){return _0x94476[_0x4e85('0x18')](_0x49361c)[_0x4e85('0x1a')](_0x135903);}};}function respondWithFilteredResult(_0x5093ca,_0x2fcc32){return function(_0xa698bd){if(_0xa698bd){var _0x423562=typeof _0x2fcc32[_0x4e85('0x1b')]===_0x4e85('0x1c')&&typeof _0x2fcc32[_0x4e85('0x1d')]===_0x4e85('0x1c');var _0x23fee2=_0xa698bd[_0x4e85('0x1e')];var _0x891bdf=_0x423562?0x0:_0x2fcc32[_0x4e85('0x1b')];var _0x51f2a9=_0x423562?_0xa698bd['count']:_0x2fcc32[_0x4e85('0x1b')]+_0x2fcc32[_0x4e85('0x1d')];var _0x457d04;if(_0x51f2a9>=_0x23fee2){_0x51f2a9=_0x23fee2;_0x457d04=0xc8;}else{_0x457d04=0xce;}_0x5093ca['status'](_0x457d04);return _0x5093ca['set']('Content-Range',_0x891bdf+'-'+_0x51f2a9+'/'+_0x23fee2)['json'](_0xa698bd);}return null;};}function patchUpdates(_0x7375d7){return function(_0x11a6dc){try{jsonpatch[_0x4e85('0x1f')](_0x11a6dc,_0x7375d7,!![]);}catch(_0x282acd){return BPromise[_0x4e85('0x20')](_0x282acd);}return _0x11a6dc[_0x4e85('0x21')]();};}function saveUpdates(_0x2321eb,_0x683cd6){return function(_0x38f6d2){if(_0x38f6d2){return _0x38f6d2[_0x4e85('0x22')](_0x2321eb)[_0x4e85('0x23')](function(_0x10fa87){return _0x10fa87;});}return null;};}function removeEntity(_0x46fdec,_0x436778){return function(_0x5dad69){if(_0x5dad69){return _0x5dad69[_0x4e85('0x24')]()[_0x4e85('0x23')](function(){_0x46fdec['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x324028,_0x3e69bc){return function(_0x1a0000){if(!_0x1a0000){_0x324028['sendStatus'](0x194);}return _0x1a0000;};}function handleError(_0x4eb145,_0x203fc2){_0x203fc2=_0x203fc2||0x1f4;return function(_0x4baaf4){logger[_0x4e85('0x25')](_0x4baaf4[_0x4e85('0x26')]);if(_0x4baaf4[_0x4e85('0x27')]){delete _0x4baaf4['name'];}_0x4eb145[_0x4e85('0x18')](_0x203fc2)[_0x4e85('0x28')](_0x4baaf4);};}exports[_0x4e85('0x29')]=function(_0x3f98d1,_0x23cea5){var _0x5c5afe={},_0x40b1b3={},_0x41df7f={'count':0x0,'rows':[]};var _0x317cd1=_[_0x4e85('0x2a')](db[_0x4e85('0x2b')][_0x4e85('0x2c')],function(_0x5ac67f){return{'name':_0x5ac67f[_0x4e85('0x2d')],'type':_0x5ac67f[_0x4e85('0x2e')][_0x4e85('0x2f')]};});_0x40b1b3['model']=_[_0x4e85('0x2a')](_0x317cd1,'name');_0x40b1b3[_0x4e85('0x30')]=_[_0x4e85('0x31')](_0x3f98d1['query']);_0x40b1b3[_0x4e85('0x32')]=_[_0x4e85('0x33')](_0x40b1b3[_0x4e85('0x34')],_0x40b1b3['query']);_0x5c5afe[_0x4e85('0x35')]=_[_0x4e85('0x33')](_0x40b1b3[_0x4e85('0x34')],qs[_0x4e85('0x36')](_0x3f98d1['query']['fields']));_0x5c5afe[_0x4e85('0x35')]=_0x5c5afe['attributes'][_0x4e85('0x37')]?_0x5c5afe[_0x4e85('0x35')]:_0x40b1b3[_0x4e85('0x34')];if(!_0x3f98d1[_0x4e85('0x30')][_0x4e85('0x38')](_0x4e85('0x39'))){_0x5c5afe[_0x4e85('0x1d')]=qs[_0x4e85('0x1d')](_0x3f98d1[_0x4e85('0x30')][_0x4e85('0x1d')]);_0x5c5afe[_0x4e85('0x1b')]=qs['offset'](_0x3f98d1[_0x4e85('0x30')][_0x4e85('0x1b')]);}_0x5c5afe[_0x4e85('0x3a')]=qs[_0x4e85('0x3b')](_0x3f98d1['query']['sort']);_0x5c5afe[_0x4e85('0x3c')]=qs[_0x4e85('0x32')](_['pick'](_0x3f98d1['query'],_0x40b1b3[_0x4e85('0x32')]),_0x317cd1);if(_0x3f98d1['query'][_0x4e85('0x3d')]){_0x5c5afe[_0x4e85('0x3c')]=_['merge'](_0x5c5afe[_0x4e85('0x3c')],{'$or':_['map'](_0x317cd1,function(_0x3f3ca3){if(_0x3f3ca3[_0x4e85('0x2e')]!==_0x4e85('0x3e')){var _0x42076f={};_0x42076f[_0x3f3ca3[_0x4e85('0x27')]]={'$like':'%'+_0x3f98d1[_0x4e85('0x30')]['filter']+'%'};return _0x42076f;}})});}_0x5c5afe=_[_0x4e85('0x3f')]({},_0x5c5afe,_0x3f98d1[_0x4e85('0x40')]);var _0xd8c40b={'where':_0x5c5afe[_0x4e85('0x3c')]};return db[_0x4e85('0x2b')][_0x4e85('0x1e')](_0xd8c40b)[_0x4e85('0x23')](function(_0x387664){_0x41df7f[_0x4e85('0x1e')]=_0x387664;if(_0x3f98d1['query'][_0x4e85('0x41')]){_0x5c5afe[_0x4e85('0x42')]=[{'all':!![]}];}return db[_0x4e85('0x2b')]['findAll'](_0x5c5afe);})[_0x4e85('0x23')](function(_0x26d28d){_0x41df7f[_0x4e85('0x43')]=_0x26d28d;return _0x41df7f;})[_0x4e85('0x23')](respondWithFilteredResult(_0x23cea5,_0x5c5afe))['catch'](handleError(_0x23cea5,null));};exports[_0x4e85('0x44')]=function(_0x325059,_0x8bad44){var _0x445516={'raw':!![],'where':{'id':_0x325059[_0x4e85('0x45')]['id']}},_0x1539d9={};_0x1539d9[_0x4e85('0x34')]=_[_0x4e85('0x31')](db[_0x4e85('0x2b')]['rawAttributes']);_0x1539d9[_0x4e85('0x30')]=_[_0x4e85('0x31')](_0x325059[_0x4e85('0x30')]);_0x1539d9[_0x4e85('0x32')]=_[_0x4e85('0x33')](_0x1539d9[_0x4e85('0x34')],_0x1539d9[_0x4e85('0x30')]);_0x445516['attributes']=_[_0x4e85('0x33')](_0x1539d9[_0x4e85('0x34')],qs[_0x4e85('0x36')](_0x325059[_0x4e85('0x30')][_0x4e85('0x36')]));_0x445516[_0x4e85('0x35')]=_0x445516['attributes'][_0x4e85('0x37')]?_0x445516[_0x4e85('0x35')]:_0x1539d9['model'];if(_0x325059[_0x4e85('0x30')][_0x4e85('0x41')]){_0x445516['include']=[{'all':!![]}];}_0x445516=_[_0x4e85('0x3f')]({},_0x445516,_0x325059[_0x4e85('0x40')]);return db[_0x4e85('0x2b')]['find'](_0x445516)['then'](handleEntityNotFound(_0x8bad44,null))[_0x4e85('0x23')](respondWithResult(_0x8bad44,null))['catch'](handleError(_0x8bad44,null));};exports['create']=function(_0x247e14,_0x152558){return db[_0x4e85('0x2b')][_0x4e85('0x46')](_0x247e14[_0x4e85('0x47')],{})[_0x4e85('0x23')](respondWithResult(_0x152558,0xc9))['catch'](handleError(_0x152558,null));};exports[_0x4e85('0x22')]=function(_0x22f7b5,_0x1c77af){if(_0x22f7b5['body']['id']){delete _0x22f7b5[_0x4e85('0x47')]['id'];}return db[_0x4e85('0x2b')][_0x4e85('0x48')]({'where':{'id':_0x22f7b5[_0x4e85('0x45')]['id']}})[_0x4e85('0x23')](handleEntityNotFound(_0x1c77af,null))[_0x4e85('0x23')](saveUpdates(_0x22f7b5[_0x4e85('0x47')],null))['then'](respondWithResult(_0x1c77af,null))['catch'](handleError(_0x1c77af,null));};exports['destroy']=function(_0x3854e4,_0x51f128){return db[_0x4e85('0x2b')][_0x4e85('0x48')]({'where':{'id':_0x3854e4[_0x4e85('0x45')]['id']}})[_0x4e85('0x23')](handleEntityNotFound(_0x51f128,null))[_0x4e85('0x23')](removeEntity(_0x51f128,null))[_0x4e85('0x49')](handleError(_0x51f128,null));};exports['describe']=function(_0x1ef18e,_0x10d316){return db[_0x4e85('0x2b')][_0x4e85('0x4a')]()[_0x4e85('0x23')](respondWithResult(_0x10d316,null))['catch'](handleError(_0x10d316,null));}; \ No newline at end of file +var _0x6d38=['fs-extra','squel','crypto','desk.js','querystring','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','status','end','limit','count','offset','json','apply','reject','save','then','destroy','sendStatus','error','name','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','ChatTransferReport','rows','show','params','includeAll','include','find','catch','create','body','update','describe','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','ejs'];(function(_0x4f3f94,_0x386c38){var _0xbb95d5=function(_0x15cba5){while(--_0x15cba5){_0x4f3f94['push'](_0x4f3f94['shift']());}};_0xbb95d5(++_0x386c38);}(_0x6d38,0xc4));var _0x86d3=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0x6d38[_0x2b4411];return _0x8e41ef;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x86d3('0x0'));var rp=require('request-promise');var moment=require(_0x86d3('0x1'));var BPromise=require(_0x86d3('0x2'));var Mustache=require(_0x86d3('0x3'));var util=require('util');var path=require(_0x86d3('0x4'));var sox=require(_0x86d3('0x5'));var csv=require(_0x86d3('0x6'));var ejs=require(_0x86d3('0x7'));var fs=require('fs');var fs_extra=require(_0x86d3('0x8'));var _=require('lodash');var squel=require(_0x86d3('0x9'));var crypto=require(_0x86d3('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x86d3('0xb'));var toCsv=require('to-csv');var querystring=require(_0x86d3('0xc'));var Papa=require(_0x86d3('0xd'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x86d3('0xe'));var hardwareService=require(_0x86d3('0xf'));var logger=require('../../config/logger')(_0x86d3('0x10'));var utils=require(_0x86d3('0x11'));var config=require('../../config/environment');var licenseUtil=require(_0x86d3('0x12'));var db=require(_0x86d3('0x13'))['db'];function respondWithStatusCode(_0xbcf7b4,_0xc3c0a5){_0xc3c0a5=_0xc3c0a5||0xcc;return function(_0x1c37f1){if(_0x1c37f1){return _0xbcf7b4['sendStatus'](_0xc3c0a5);}return _0xbcf7b4[_0x86d3('0x14')](_0xc3c0a5)[_0x86d3('0x15')]();};}function respondWithResult(_0x563f0b,_0x2983e2){_0x2983e2=_0x2983e2||0xc8;return function(_0x20ee25){if(_0x20ee25){return _0x563f0b[_0x86d3('0x14')](_0x2983e2)['json'](_0x20ee25);}};}function respondWithFilteredResult(_0x488c57,_0x58f969){return function(_0x361ac8){if(_0x361ac8){var _0x47814a=typeof _0x58f969['offset']==='undefined'&&typeof _0x58f969[_0x86d3('0x16')]==='undefined';var _0x495cd6=_0x361ac8[_0x86d3('0x17')];var _0x1c75d=_0x47814a?0x0:_0x58f969[_0x86d3('0x18')];var _0x12e428=_0x47814a?_0x361ac8['count']:_0x58f969[_0x86d3('0x18')]+_0x58f969['limit'];var _0x1d622f;if(_0x12e428>=_0x495cd6){_0x12e428=_0x495cd6;_0x1d622f=0xc8;}else{_0x1d622f=0xce;}_0x488c57['status'](_0x1d622f);return _0x488c57['set']('Content-Range',_0x1c75d+'-'+_0x12e428+'/'+_0x495cd6)[_0x86d3('0x19')](_0x361ac8);}return null;};}function patchUpdates(_0x202497){return function(_0x3d18a6){try{jsonpatch[_0x86d3('0x1a')](_0x3d18a6,_0x202497,!![]);}catch(_0x525360){return BPromise[_0x86d3('0x1b')](_0x525360);}return _0x3d18a6[_0x86d3('0x1c')]();};}function saveUpdates(_0x268fff,_0x5f41af){return function(_0x1c68c9){if(_0x1c68c9){return _0x1c68c9['update'](_0x268fff)[_0x86d3('0x1d')](function(_0x12b7f2){return _0x12b7f2;});}return null;};}function removeEntity(_0x2988fd,_0x3fd4a6){return function(_0x3864c0){if(_0x3864c0){return _0x3864c0[_0x86d3('0x1e')]()[_0x86d3('0x1d')](function(){_0x2988fd[_0x86d3('0x14')](0xcc)['end']();});}};}function handleEntityNotFound(_0xb0a5d7,_0x17d02b){return function(_0x1a700d){if(!_0x1a700d){_0xb0a5d7[_0x86d3('0x1f')](0x194);}return _0x1a700d;};}function handleError(_0x42741c,_0x40c2b9){_0x40c2b9=_0x40c2b9||0x1f4;return function(_0x16d5aa){logger[_0x86d3('0x20')](_0x16d5aa['stack']);if(_0x16d5aa['name']){delete _0x16d5aa[_0x86d3('0x21')];}_0x42741c[_0x86d3('0x14')](_0x40c2b9)['send'](_0x16d5aa);};}exports[_0x86d3('0x22')]=function(_0x355dd1,_0x10e170){var _0xfd4e95={},_0x22c288={},_0xc2b227={'count':0x0,'rows':[]};var _0x22d52f=_[_0x86d3('0x23')](db['ChatTransferReport'][_0x86d3('0x24')],function(_0x5686db){return{'name':_0x5686db[_0x86d3('0x25')],'type':_0x5686db[_0x86d3('0x26')][_0x86d3('0x27')]};});_0x22c288[_0x86d3('0x28')]=_[_0x86d3('0x23')](_0x22d52f,_0x86d3('0x21'));_0x22c288[_0x86d3('0x29')]=_[_0x86d3('0x2a')](_0x355dd1['query']);_0x22c288[_0x86d3('0x2b')]=_[_0x86d3('0x2c')](_0x22c288[_0x86d3('0x28')],_0x22c288[_0x86d3('0x29')]);_0xfd4e95[_0x86d3('0x2d')]=_['intersection'](_0x22c288['model'],qs[_0x86d3('0x2e')](_0x355dd1['query']['fields']));_0xfd4e95[_0x86d3('0x2d')]=_0xfd4e95['attributes'][_0x86d3('0x2f')]?_0xfd4e95['attributes']:_0x22c288['model'];if(!_0x355dd1['query'][_0x86d3('0x30')](_0x86d3('0x31'))){_0xfd4e95[_0x86d3('0x16')]=qs[_0x86d3('0x16')](_0x355dd1[_0x86d3('0x29')][_0x86d3('0x16')]);_0xfd4e95['offset']=qs[_0x86d3('0x18')](_0x355dd1['query'][_0x86d3('0x18')]);}_0xfd4e95['order']=qs[_0x86d3('0x32')](_0x355dd1[_0x86d3('0x29')][_0x86d3('0x32')]);_0xfd4e95[_0x86d3('0x33')]=qs[_0x86d3('0x2b')](_[_0x86d3('0x34')](_0x355dd1['query'],_0x22c288[_0x86d3('0x2b')]),_0x22d52f);if(_0x355dd1[_0x86d3('0x29')][_0x86d3('0x35')]){_0xfd4e95['where']=_[_0x86d3('0x36')](_0xfd4e95[_0x86d3('0x33')],{'$or':_[_0x86d3('0x23')](_0x22d52f,function(_0x3f4365){if(_0x3f4365['type']!=='VIRTUAL'){var _0x43fff6={};_0x43fff6[_0x3f4365['name']]={'$like':'%'+_0x355dd1[_0x86d3('0x29')][_0x86d3('0x35')]+'%'};return _0x43fff6;}})});}_0xfd4e95=_[_0x86d3('0x36')]({},_0xfd4e95,_0x355dd1[_0x86d3('0x37')]);var _0x3db251={'where':_0xfd4e95[_0x86d3('0x33')]};return db[_0x86d3('0x38')][_0x86d3('0x17')](_0x3db251)[_0x86d3('0x1d')](function(_0x1baef4){_0xc2b227[_0x86d3('0x17')]=_0x1baef4;if(_0x355dd1[_0x86d3('0x29')]['includeAll']){_0xfd4e95['include']=[{'all':!![]}];}return db['ChatTransferReport']['findAll'](_0xfd4e95);})[_0x86d3('0x1d')](function(_0x4a148e){_0xc2b227[_0x86d3('0x39')]=_0x4a148e;return _0xc2b227;})[_0x86d3('0x1d')](respondWithFilteredResult(_0x10e170,_0xfd4e95))['catch'](handleError(_0x10e170,null));};exports[_0x86d3('0x3a')]=function(_0x20b48a,_0x46c557){var _0x32b7a0={'raw':!![],'where':{'id':_0x20b48a[_0x86d3('0x3b')]['id']}},_0x1993ab={};_0x1993ab[_0x86d3('0x28')]=_[_0x86d3('0x2a')](db[_0x86d3('0x38')][_0x86d3('0x24')]);_0x1993ab[_0x86d3('0x29')]=_[_0x86d3('0x2a')](_0x20b48a[_0x86d3('0x29')]);_0x1993ab[_0x86d3('0x2b')]=_['intersection'](_0x1993ab['model'],_0x1993ab[_0x86d3('0x29')]);_0x32b7a0[_0x86d3('0x2d')]=_[_0x86d3('0x2c')](_0x1993ab['model'],qs['fields'](_0x20b48a['query'][_0x86d3('0x2e')]));_0x32b7a0[_0x86d3('0x2d')]=_0x32b7a0[_0x86d3('0x2d')]['length']?_0x32b7a0['attributes']:_0x1993ab[_0x86d3('0x28')];if(_0x20b48a['query'][_0x86d3('0x3c')]){_0x32b7a0[_0x86d3('0x3d')]=[{'all':!![]}];}_0x32b7a0=_['merge']({},_0x32b7a0,_0x20b48a[_0x86d3('0x37')]);return db[_0x86d3('0x38')][_0x86d3('0x3e')](_0x32b7a0)[_0x86d3('0x1d')](handleEntityNotFound(_0x46c557,null))[_0x86d3('0x1d')](respondWithResult(_0x46c557,null))[_0x86d3('0x3f')](handleError(_0x46c557,null));};exports[_0x86d3('0x40')]=function(_0x231a46,_0x2ee6a6){return db[_0x86d3('0x38')][_0x86d3('0x40')](_0x231a46[_0x86d3('0x41')],{})['then'](respondWithResult(_0x2ee6a6,0xc9))[_0x86d3('0x3f')](handleError(_0x2ee6a6,null));};exports[_0x86d3('0x42')]=function(_0x50987d,_0x2d9b4d){if(_0x50987d[_0x86d3('0x41')]['id']){delete _0x50987d['body']['id'];}return db[_0x86d3('0x38')][_0x86d3('0x3e')]({'where':{'id':_0x50987d['params']['id']}})[_0x86d3('0x1d')](handleEntityNotFound(_0x2d9b4d,null))['then'](saveUpdates(_0x50987d[_0x86d3('0x41')],null))[_0x86d3('0x1d')](respondWithResult(_0x2d9b4d,null))[_0x86d3('0x3f')](handleError(_0x2d9b4d,null));};exports[_0x86d3('0x1e')]=function(_0x9c3996,_0x58864e){return db['ChatTransferReport']['find']({'where':{'id':_0x9c3996[_0x86d3('0x3b')]['id']}})[_0x86d3('0x1d')](handleEntityNotFound(_0x58864e,null))[_0x86d3('0x1d')](removeEntity(_0x58864e,null))['catch'](handleError(_0x58864e,null));};exports['describe']=function(_0x1b7f13,_0xdadb50){return db[_0x86d3('0x38')][_0x86d3('0x43')]()[_0x86d3('0x1d')](respondWithResult(_0xdadb50,null))['catch'](handleError(_0xdadb50,null));}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.model.js b/server/api/chatTransferReport/chatTransferReport.model.js index 447bf66..e843b7d 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 _0x59f5=['define','ChatTransferReport','report_chat_transfer','lodash','util','api','moment','request-promise','rimraf','../../config/environment','exports'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0x59f5,0xdf));var _0x559f=function(_0x16e1b4,_0x304ee7){_0x16e1b4=_0x16e1b4-0x0;var _0x551db1=_0x59f5[_0x16e1b4];return _0x551db1;};'use strict';var _=require(_0x559f('0x0'));var util=require(_0x559f('0x1'));var logger=require('../../config/logger')(_0x559f('0x2'));var moment=require(_0x559f('0x3'));var BPromise=require('bluebird');var rp=require(_0x559f('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x559f('0x5'));var config=require(_0x559f('0x6'));var attributes=require('./chatTransferReport.attributes');module[_0x559f('0x7')]=function(_0x3ddfe2,_0x36ee8e){return _0x3ddfe2[_0x559f('0x8')](_0x559f('0x9'),attributes,{'tableName':_0x559f('0xa'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x6ec1=['request-promise','path','../../config/environment','define','ChatTransferReport','uniqueid','../../config/logger','bluebird'];(function(_0x545e41,_0x55830d){var _0x20ee17=function(_0xac9b17){while(--_0xac9b17){_0x545e41['push'](_0x545e41['shift']());}};_0x20ee17(++_0x55830d);}(_0x6ec1,0xfe));var _0x16ec=function(_0x2570c2,_0x1ba88f){_0x2570c2=_0x2570c2-0x0;var _0x2629df=_0x6ec1[_0x2570c2];return _0x2629df;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x16ec('0x0'))('api');var moment=require('moment');var BPromise=require(_0x16ec('0x1'));var rp=require(_0x16ec('0x2'));var fs=require('fs');var path=require(_0x16ec('0x3'));var rimraf=require('rimraf');var config=require(_0x16ec('0x4'));var attributes=require('./chatTransferReport.attributes');module['exports']=function(_0x32deda,_0x23ed73){return _0x32deda[_0x16ec('0x5')](_0x16ec('0x6'),attributes,{'tableName':'report_chat_transfer','paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x16ec('0x7')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.rpc.js b/server/api/chatTransferReport/chatTransferReport.rpc.js index aa72429..e361fd0 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 _0xed78=['message','info','catch','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','request\x20sent','stringify','error','code','ChatTransferReport,\x20%s,\x20%s'];(function(_0x72aff0,_0x2cbe3f){var _0x452b01=function(_0x391f8f){while(--_0x391f8f){_0x72aff0['push'](_0x72aff0['shift']());}};_0x452b01(++_0x2cbe3f);}(_0xed78,0x13e));var _0x8ed7=function(_0x5bcf90,_0x8dea1b){_0x5bcf90=_0x5bcf90-0x0;var _0x59cd27=_0xed78[_0x5bcf90];return _0x59cd27;};'use strict';var _=require(_0x8ed7('0x0'));var util=require(_0x8ed7('0x1'));var moment=require('moment');var BPromise=require(_0x8ed7('0x2'));var rs=require(_0x8ed7('0x3'));var fs=require('fs');var Redis=require(_0x8ed7('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x8ed7('0x5'));var logger=require(_0x8ed7('0x6'))(_0x8ed7('0x7'));var config=require(_0x8ed7('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x8ed7('0x9')][_0x8ed7('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4148b7,_0x4add14,_0x39928a){return new BPromise(function(_0x2bf001,_0x1b4cd7){return client[_0x8ed7('0xb')](_0x4148b7,_0x39928a)[_0x8ed7('0xc')](function(_0x207d1b){logger['info']('ChatTransferReport,\x20%s,\x20%s',_0x4add14,'request\x20sent');logger['debug']('ChatTransferReport,\x20%s,\x20%s,\x20%s',_0x4add14,_0x8ed7('0xd'),JSON[_0x8ed7('0xe')](_0x207d1b));if(_0x207d1b[_0x8ed7('0xf')]){if(_0x207d1b[_0x8ed7('0xf')][_0x8ed7('0x10')]===0x1f4){logger[_0x8ed7('0xf')](_0x8ed7('0x11'),_0x4add14,_0x207d1b['error'][_0x8ed7('0x12')]);return _0x1b4cd7(_0x207d1b['error'][_0x8ed7('0x12')]);}logger[_0x8ed7('0xf')]('ChatTransferReport,\x20%s,\x20%s',_0x4add14,_0x207d1b[_0x8ed7('0xf')][_0x8ed7('0x12')]);return _0x2bf001(_0x207d1b[_0x8ed7('0xf')]['message']);}else{logger[_0x8ed7('0x13')](_0x8ed7('0x11'),_0x4add14,'request\x20sent');_0x2bf001(_0x207d1b['result'][_0x8ed7('0x12')]);}})[_0x8ed7('0x14')](function(_0x5ad9e8){logger['error'](_0x8ed7('0x11'),_0x4add14,_0x5ad9e8);_0x1b4cd7(_0x5ad9e8);});});} \ No newline at end of file +var _0x0e00=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','ChatTransferReport,\x20%s,\x20%s,\x20%s','error','code','ChatTransferReport,\x20%s,\x20%s','message','result','catch','lodash','util','moment','randomstring'];(function(_0x15e0eb,_0x114383){var _0x180016=function(_0x495281){while(--_0x495281){_0x15e0eb['push'](_0x15e0eb['shift']());}};_0x180016(++_0x114383);}(_0x0e00,0x104));var _0x00e0=function(_0x3b189d,_0x1c25e0){_0x3b189d=_0x3b189d-0x0;var _0x382792=_0x0e00[_0x3b189d];return _0x382792;};'use strict';var _=require(_0x00e0('0x0'));var util=require(_0x00e0('0x1'));var moment=require(_0x00e0('0x2'));var BPromise=require('bluebird');var rs=require(_0x00e0('0x3'));var fs=require('fs');var Redis=require(_0x00e0('0x4'));var db=require(_0x00e0('0x5'))['db'];var utils=require(_0x00e0('0x6'));var logger=require(_0x00e0('0x7'))(_0x00e0('0x8'));var config=require(_0x00e0('0x9'));var jayson=require(_0x00e0('0xa'));var client=jayson[_0x00e0('0xb')][_0x00e0('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x172c36,_0x1c5ff4,_0x245fe7){return new BPromise(function(_0x48edf6,_0x433c11){return client[_0x00e0('0xd')](_0x172c36,_0x245fe7)[_0x00e0('0xe')](function(_0x2de7cb){logger[_0x00e0('0xf')]('ChatTransferReport,\x20%s,\x20%s',_0x1c5ff4,_0x00e0('0x10'));logger['debug'](_0x00e0('0x11'),_0x1c5ff4,_0x00e0('0x10'),JSON['stringify'](_0x2de7cb));if(_0x2de7cb[_0x00e0('0x12')]){if(_0x2de7cb[_0x00e0('0x12')][_0x00e0('0x13')]===0x1f4){logger[_0x00e0('0x12')](_0x00e0('0x14'),_0x1c5ff4,_0x2de7cb[_0x00e0('0x12')][_0x00e0('0x15')]);return _0x433c11(_0x2de7cb[_0x00e0('0x12')][_0x00e0('0x15')]);}logger[_0x00e0('0x12')](_0x00e0('0x14'),_0x1c5ff4,_0x2de7cb['error']['message']);return _0x48edf6(_0x2de7cb[_0x00e0('0x12')]['message']);}else{logger[_0x00e0('0xf')]('ChatTransferReport,\x20%s,\x20%s',_0x1c5ff4,'request\x20sent');_0x48edf6(_0x2de7cb[_0x00e0('0x16')]['message']);}})[_0x00e0('0x17')](function(_0x255d49){logger[_0x00e0('0x12')](_0x00e0('0x14'),_0x1c5ff4,_0x255d49);_0x433c11(_0x255d49);});});} \ No newline at end of file diff --git a/server/api/chatTransferReport/index.js b/server/api/chatTransferReport/index.js index 1a47669..77260c4 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 _0x5de6=['isAuthenticated','show','post','put','update','delete','multer','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./chatTransferReport.controller','get','index','/describe','describe','/:id'];(function(_0x37208d,_0x72da3e){var _0x3f60c4=function(_0x441617){while(--_0x441617){_0x37208d['push'](_0x37208d['shift']());}};_0x3f60c4(++_0x72da3e);}(_0x5de6,0x126));var _0x65de=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x5de6[_0xfae23b];return _0x200640;};'use strict';var multer=require(_0x65de('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x65de('0x1'));var express=require(_0x65de('0x2'));var router=express['Router']();var fs_extra=require(_0x65de('0x3'));var auth=require(_0x65de('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x65de('0x5'));var controller=require(_0x65de('0x6'));router[_0x65de('0x7')]('/',auth['isAuthenticated'](),controller[_0x65de('0x8')]);router[_0x65de('0x7')](_0x65de('0x9'),auth['isAuthenticated'](),controller[_0x65de('0xa')]);router['get'](_0x65de('0xb'),auth[_0x65de('0xc')](),controller[_0x65de('0xd')]);router[_0x65de('0xe')]('/',auth[_0x65de('0xc')](),controller['create']);router[_0x65de('0xf')](_0x65de('0xb'),auth['isAuthenticated'](),controller[_0x65de('0x10')]);router[_0x65de('0x11')](_0x65de('0xb'),auth[_0x65de('0xc')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x7672=['get','isAuthenticated','index','/describe','describe','/:id','show','post','put','update','delete','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatTransferReport.controller'];(function(_0x5509a8,_0x1a8b93){var _0x5383b1=function(_0x14cde3){while(--_0x14cde3){_0x5509a8['push'](_0x5509a8['shift']());}};_0x5383b1(++_0x1a8b93);}(_0x7672,0x1d9));var _0x2767=function(_0x47fe76,_0x1f9f51){_0x47fe76=_0x47fe76-0x0;var _0x1ee838=_0x7672[_0x47fe76];return _0x1ee838;};'use strict';var multer=require(_0x2767('0x0'));var util=require(_0x2767('0x1'));var path=require(_0x2767('0x2'));var timeout=require(_0x2767('0x3'));var express=require(_0x2767('0x4'));var router=express[_0x2767('0x5')]();var fs_extra=require(_0x2767('0x6'));var auth=require(_0x2767('0x7'));var interaction=require(_0x2767('0x8'));var config=require(_0x2767('0x9'));var controller=require(_0x2767('0xa'));router[_0x2767('0xb')]('/',auth[_0x2767('0xc')](),controller[_0x2767('0xd')]);router[_0x2767('0xb')](_0x2767('0xe'),auth[_0x2767('0xc')](),controller[_0x2767('0xf')]);router[_0x2767('0xb')](_0x2767('0x10'),auth[_0x2767('0xc')](),controller[_0x2767('0x11')]);router[_0x2767('0x12')]('/',auth[_0x2767('0xc')](),controller['create']);router[_0x2767('0x13')](_0x2767('0x10'),auth[_0x2767('0xc')](),controller[_0x2767('0x14')]);router[_0x2767('0x15')](_0x2767('0x10'),auth[_0x2767('0xc')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.attributes.js b/server/api/chatWebsite/chatWebsite.attributes.js index 79e00d0..6c65806 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 _0x8051=['New\x20offline\x20message\x20from\x20websiteName','You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:','Your\x20request\x20has\x20not\x20been\x20processed.','Send','bottom_right','CHAT','alternate','#fafafa','System','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','mandatoryDispositionPauseId','mandatoryDisposition','Generated\x20by\x20XCALLY\x20Motion','sequelize','randomstring','exports','STRING','address','email','Agent','#011F6A','#ffffff','INTEGER','BOOLEAN','ENUM','rounded','squared','Chat','TEXT','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Form\x20properly\x20submitted','Form\x20submission\x20error','Note','Type\x20a\x20message','Thanks\x20you\x20for\x20your\x20time!','Skip','Feedback','star','stringify','input','name','getDataValue','onlineForm','setDataValue','textarea','Comments','offlineForm','parse','generate','Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.'];(function(_0x270016,_0x328f45){var _0x41906a=function(_0x35a677){while(--_0x35a677){_0x270016['push'](_0x270016['shift']());}};_0x41906a(++_0x328f45);}(_0x8051,0x107));var _0x1805=function(_0x50a149,_0x25bdc0){_0x50a149=_0x50a149-0x0;var _0x50ebdb=_0x8051[_0x50a149];return _0x50ebdb;};'use strict';var Sequelize=require(_0x1805('0x0'));var rs=require(_0x1805('0x1'));module[_0x1805('0x2')]={'name':{'type':Sequelize[_0x1805('0x3')],'allowNull':![]},'address':{'type':Sequelize[_0x1805('0x3')],'allowNull':![],'unique':_0x1805('0x4')},'description':{'type':Sequelize[_0x1805('0x3')]},'mapKey':{'type':Sequelize[_0x1805('0x3')],'defaultValue':_0x1805('0x5')},'mapKeyOffline':{'type':Sequelize[_0x1805('0x3')],'defaultValue':_0x1805('0x5')},'key':{'type':Sequelize[_0x1805('0x3')],'allowNull':![]},'agentAlias':{'type':Sequelize[_0x1805('0x3')],'defaultValue':_0x1805('0x6')},'customerAlias':{'type':Sequelize['STRING'],'defaultValue':'Me'},'color':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'#011F6A','validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0x1805('0x3')],'allowNull':![],'defaultValue':_0x1805('0x7'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0x1805('0x3')],'allowNull':![],'defaultValue':_0x1805('0x8'),'validate':{'notEmpty':!![]}},'textButtonColor':{'type':Sequelize[_0x1805('0x3')],'allowNull':![],'defaultValue':_0x1805('0x8'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0x1805('0x9')],'defaultValue':0xf},'remote':{'type':Sequelize[_0x1805('0x3')]},'animation':{'type':Sequelize[_0x1805('0xa')],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0x1805('0xb')](_0x1805('0xc'),_0x1805('0xd')),'defaultValue':_0x1805('0xc')},'header_online':{'type':Sequelize[_0x1805('0x3')],'defaultValue':'We\x20are\x20here!'},'start_chat_button':{'type':Sequelize[_0x1805('0x3')],'defaultValue':_0x1805('0xe')},'offline_chat_button':{'type':Sequelize['STRING'],'defaultValue':'Send'},'header_offline':{'type':Sequelize['STRING'],'defaultValue':'Contact\x20us'},'download_transcript':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'timeout':{'type':Sequelize[_0x1805('0x9')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0x1805('0x3')],'defaultValue':'Powered\x20by\x20xCALLY'},'defaultWhiteLabel':{'type':Sequelize[_0x1805('0xa')],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0x1805('0xf')]},'closingQuestion':{'type':Sequelize[_0x1805('0x3')],'defaultValue':_0x1805('0x10')},'formSubmitSuccessMessage':{'type':Sequelize['STRING'],'defaultValue':_0x1805('0x11')},'formSubmitFailureMessage':{'type':Sequelize[_0x1805('0x3')],'defaultValue':_0x1805('0x12')},'noteTitle':{'type':Sequelize[_0x1805('0x3')],'defaultValue':_0x1805('0x13')},'placeholderMessage':{'type':Sequelize[_0x1805('0x3')],'defaultValue':_0x1805('0x14')},'closingMessage':{'type':Sequelize[_0x1805('0x3')],'defaultValue':_0x1805('0x15')},'closingMessageButton':{'type':Sequelize[_0x1805('0x3')],'defaultValue':'Send'},'skipMessageButton':{'type':Sequelize[_0x1805('0x3')],'defaultValue':_0x1805('0x16')},'conditionAgreement':{'type':Sequelize[_0x1805('0xa')],'defaultValue':![]},'enableRating':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0x1805('0xa')],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0x1805('0xa')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize['STRING'],'defaultValue':_0x1805('0x17')},'ratingType':{'type':Sequelize[_0x1805('0xb')](_0x1805('0x18'),'thumb'),'defaultValue':_0x1805('0x18')},'ratingStarsNumber':{'type':Sequelize[_0x1805('0x9')],'defaultValue':0x5},'onlineForm':{'type':Sequelize['TEXT'],'defaultValue':function(){return JSON[_0x1805('0x19')]({'items':[{'type':_0x1805('0x1a'),'variable':null,'config':{'placeholder':_0x1805('0x1b'),'type':'text','required':!![]},'props':{'title':_0x1805('0x1b'),'helpText':''}},{'type':_0x1805('0x1a'),'props':{'title':'email','helpText':''},'config':{'required':!![],'placeholder':_0x1805('0x5'),'type':_0x1805('0x5')},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0x1805('0x1c')](_0x1805('0x1d'))?JSON['parse'](this['getDataValue']('onlineForm')):{};},'set':function(_0x4b2035){return this[_0x1805('0x1e')](_0x1805('0x1d'),JSON[_0x1805('0x19')](_0x4b2035));}},'offlineForm':{'type':Sequelize[_0x1805('0xf')],'defaultValue':function(){return JSON[_0x1805('0x19')]({'items':[{'type':_0x1805('0x1a'),'props':{'title':_0x1805('0x5'),'helpText':''},'config':{'required':!![],'placeholder':_0x1805('0x5'),'type':_0x1805('0x5')},'variable':null},{'type':_0x1805('0x1f'),'config':{'placeholder':'Comments'},'props':{'title':_0x1805('0x20'),'helpText':'Leave\x20your\x20comments'}}],'fromKey':0x0});},'get':function(){return this['getDataValue'](_0x1805('0x21'))?JSON[_0x1805('0x22')](this['getDataValue']('offlineForm')):{};},'set':function(_0x4665b1){return this[_0x1805('0x1e')]('offlineForm',JSON[_0x1805('0x19')](_0x4665b1));}},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0x1805('0x23')]();}},'autoclose':{'type':Sequelize[_0x1805('0xa')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0x1805('0xa')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0x1805('0xa')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0x1805('0x3')]},'forwardOffline':{'type':Sequelize[_0x1805('0xa')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize['STRING']},'waitingTitle':{'type':Sequelize['STRING'],'defaultValue':'All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.'},'waitingMessage':{'type':Sequelize['STRING'],'defaultValue':_0x1805('0x24')},'offlineMessageSubject':{'type':Sequelize[_0x1805('0x3')],'defaultValue':_0x1805('0x25')},'offlineMessageBody':{'type':Sequelize['STRING'],'defaultValue':_0x1805('0x26')},'enableUnmanagedNote':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize[_0x1805('0x3')],'defaultValue':_0x1805('0x27')},'skipUnmanaged':{'type':Sequelize['STRING'],'defaultValue':_0x1805('0x16')},'sendUnmanaged':{'type':Sequelize[_0x1805('0x3')],'defaultValue':_0x1805('0x28')},'enableCustomerAttachment':{'type':Sequelize[_0x1805('0xa')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0x1805('0xa')],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0x1805('0xf')]},'showAgentAvatar':{'type':Sequelize[_0x1805('0xa')],'defaultValue':![]},'timezone':{'type':Sequelize[_0x1805('0x3')]},'notificationTemplate':{'type':Sequelize[_0x1805('0xf')],'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[_0x1805('0xa')],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0x1805('0x3')],'defaultValue':'website_alias'},'waitForTheAssignedAgent':{'type':Sequelize[_0x1805('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x1805('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0x1805('0x3')],'defaultValue':_0x1805('0x29')},'verticalAlignment':{'type':Sequelize[_0x1805('0x9')],'defaultValue':0x1e},'labelText':{'type':Sequelize[_0x1805('0x3')],'defaultValue':_0x1805('0x2a')},'messagesAlignment':{'type':Sequelize[_0x1805('0x3')],'defaultValue':_0x1805('0x2b')},'defaultTitle':{'type':Sequelize['STRING']},'customerAvatar':{'type':Sequelize[_0x1805('0xf')]},'showCustomerAvatar':{'type':Sequelize[_0x1805('0xa')],'defaultValue':![]},'messageFontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xc},'backgroundColor':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x1805('0x2c'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x1805('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x1805('0xa')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x1805('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0x1805('0x3')],'defaultValue':_0x1805('0x2d')},'systemAvatar':{'type':Sequelize[_0x1805('0xf')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0x1805('0x9')],'comment':_0x1805('0x2e')},'mandatoryDisposition':{'type':Sequelize[_0x1805('0xa')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x7e1cf8){if(!_0x7e1cf8)this[_0x1805('0x1e')](_0x1805('0x2f'),null);this[_0x1805('0x1e')](_0x1805('0x30'),_0x7e1cf8);}},'vidaooEscalation':{'type':Sequelize[_0x1805('0xa')],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize['STRING']},'vidaooTopic':{'type':Sequelize[_0x1805('0x3')],'allowNull':![],'defaultValue':_0x1805('0x31')},'vidaooNote':{'type':Sequelize[_0x1805('0x3')],'defaultValue':function(){return'Meeting\x20generated\x20for\x20interaction\x20#{{interaction.id}}\x20by\x20{{agent.name}}';}},'vidaooMetadata':{'type':Sequelize['TEXT'],'defaultValue':null},'openNewInteraction':{'type':Sequelize[_0x1805('0xa')],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0x64d4=['Contact\x20us','Powered\x20by\x20xCALLY','TEXT','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Form\x20submission\x20error','Note','Type\x20a\x20message','Thanks\x20you\x20for\x20your\x20time!','Skip','Feedback','star','input','text','email','getDataValue','onlineForm','parse','setDataValue','stringify','Comments','Leave\x20your\x20comments','offlineForm','generate','All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.','Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.','New\x20offline\x20message\x20from\x20websiteName','You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','website_alias','CHAT','#fafafa','System','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','mandatoryDispositionPauseId','Generated\x20by\x20XCALLY\x20Motion','Meeting\x20generated\x20for\x20interaction\x20#{{interaction.id}}\x20by\x20{{agent.name}}','randomstring','exports','address','STRING','Agent','#011F6A','#ffffff','INTEGER','BOOLEAN','ENUM','rounded','squared','We\x20are\x20here!','Chat','Send'];(function(_0x2d982d,_0x121028){var _0x4f36b0=function(_0x11f3a9){while(--_0x11f3a9){_0x2d982d['push'](_0x2d982d['shift']());}};_0x4f36b0(++_0x121028);}(_0x64d4,0x156));var _0x464d=function(_0x1130a1,_0x3a0aea){_0x1130a1=_0x1130a1-0x0;var _0x167055=_0x64d4[_0x1130a1];return _0x167055;};'use strict';var Sequelize=require('sequelize');var rs=require(_0x464d('0x0'));module[_0x464d('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'address':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x464d('0x2')},'description':{'type':Sequelize[_0x464d('0x3')]},'mapKey':{'type':Sequelize['STRING'],'defaultValue':'email'},'mapKeyOffline':{'type':Sequelize[_0x464d('0x3')],'defaultValue':'email'},'key':{'type':Sequelize[_0x464d('0x3')],'allowNull':![]},'agentAlias':{'type':Sequelize[_0x464d('0x3')],'defaultValue':_0x464d('0x4')},'customerAlias':{'type':Sequelize[_0x464d('0x3')],'defaultValue':'Me'},'color':{'type':Sequelize[_0x464d('0x3')],'allowNull':![],'defaultValue':_0x464d('0x5'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0x464d('0x3')],'allowNull':![],'defaultValue':_0x464d('0x5'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0x464d('0x3')],'allowNull':![],'defaultValue':_0x464d('0x6'),'validate':{'notEmpty':!![]}},'textButtonColor':{'type':Sequelize[_0x464d('0x3')],'allowNull':![],'defaultValue':'#ffffff','validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0x464d('0x7')],'defaultValue':0xf},'remote':{'type':Sequelize['STRING']},'animation':{'type':Sequelize[_0x464d('0x8')],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0x464d('0x9')](_0x464d('0xa'),_0x464d('0xb')),'defaultValue':_0x464d('0xa')},'header_online':{'type':Sequelize[_0x464d('0x3')],'defaultValue':_0x464d('0xc')},'start_chat_button':{'type':Sequelize[_0x464d('0x3')],'defaultValue':_0x464d('0xd')},'offline_chat_button':{'type':Sequelize[_0x464d('0x3')],'defaultValue':_0x464d('0xe')},'header_offline':{'type':Sequelize[_0x464d('0x3')],'defaultValue':_0x464d('0xf')},'download_transcript':{'type':Sequelize[_0x464d('0x8')],'defaultValue':!![]},'timeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0x464d('0x3')],'defaultValue':_0x464d('0x10')},'defaultWhiteLabel':{'type':Sequelize[_0x464d('0x8')],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0x464d('0x11')]},'closingQuestion':{'type':Sequelize[_0x464d('0x3')],'defaultValue':_0x464d('0x12')},'formSubmitSuccessMessage':{'type':Sequelize['STRING'],'defaultValue':'Form\x20properly\x20submitted'},'formSubmitFailureMessage':{'type':Sequelize[_0x464d('0x3')],'defaultValue':_0x464d('0x13')},'noteTitle':{'type':Sequelize[_0x464d('0x3')],'defaultValue':_0x464d('0x14')},'placeholderMessage':{'type':Sequelize['STRING'],'defaultValue':_0x464d('0x15')},'closingMessage':{'type':Sequelize[_0x464d('0x3')],'defaultValue':_0x464d('0x16')},'closingMessageButton':{'type':Sequelize[_0x464d('0x3')],'defaultValue':_0x464d('0xe')},'skipMessageButton':{'type':Sequelize[_0x464d('0x3')],'defaultValue':_0x464d('0x17')},'conditionAgreement':{'type':Sequelize[_0x464d('0x8')],'defaultValue':![]},'enableRating':{'type':Sequelize[_0x464d('0x8')],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0x464d('0x8')],'defaultValue':![]},'enableSendButton':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0x464d('0x3')],'defaultValue':_0x464d('0x18')},'ratingType':{'type':Sequelize[_0x464d('0x9')]('star','thumb'),'defaultValue':_0x464d('0x19')},'ratingStarsNumber':{'type':Sequelize[_0x464d('0x7')],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0x464d('0x11')],'defaultValue':function(){return JSON['stringify']({'items':[{'type':_0x464d('0x1a'),'variable':null,'config':{'placeholder':'name','type':_0x464d('0x1b'),'required':!![]},'props':{'title':'name','helpText':''}},{'type':_0x464d('0x1a'),'props':{'title':'email','helpText':''},'config':{'required':!![],'placeholder':_0x464d('0x1c'),'type':_0x464d('0x1c')},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0x464d('0x1d')](_0x464d('0x1e'))?JSON[_0x464d('0x1f')](this['getDataValue'](_0x464d('0x1e'))):{};},'set':function(_0x548aac){return this[_0x464d('0x20')](_0x464d('0x1e'),JSON['stringify'](_0x548aac));}},'offlineForm':{'type':Sequelize[_0x464d('0x11')],'defaultValue':function(){return JSON[_0x464d('0x21')]({'items':[{'type':'input','props':{'title':_0x464d('0x1c'),'helpText':''},'config':{'required':!![],'placeholder':_0x464d('0x1c'),'type':'email'},'variable':null},{'type':'textarea','config':{'placeholder':_0x464d('0x22')},'props':{'title':_0x464d('0x22'),'helpText':_0x464d('0x23')}}],'fromKey':0x0});},'get':function(){return this['getDataValue'](_0x464d('0x24'))?JSON[_0x464d('0x1f')](this['getDataValue']('offlineForm')):{};},'set':function(_0x5642a2){return this[_0x464d('0x20')](_0x464d('0x24'),JSON['stringify'](_0x5642a2));}},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0x464d('0x25')]();}},'autoclose':{'type':Sequelize[_0x464d('0x8')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0x464d('0x8')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0x464d('0x8')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0x464d('0x3')]},'forwardOffline':{'type':Sequelize[_0x464d('0x8')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0x464d('0x3')]},'waitingTitle':{'type':Sequelize[_0x464d('0x3')],'defaultValue':_0x464d('0x26')},'waitingMessage':{'type':Sequelize[_0x464d('0x3')],'defaultValue':_0x464d('0x27')},'offlineMessageSubject':{'type':Sequelize['STRING'],'defaultValue':_0x464d('0x28')},'offlineMessageBody':{'type':Sequelize[_0x464d('0x3')],'defaultValue':_0x464d('0x29')},'enableUnmanagedNote':{'type':Sequelize[_0x464d('0x8')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize[_0x464d('0x3')],'defaultValue':'Your\x20request\x20has\x20not\x20been\x20processed.'},'skipUnmanaged':{'type':Sequelize['STRING'],'defaultValue':_0x464d('0x17')},'sendUnmanaged':{'type':Sequelize[_0x464d('0x3')],'defaultValue':_0x464d('0xe')},'enableCustomerAttachment':{'type':Sequelize[_0x464d('0x8')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0x464d('0x8')],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0x464d('0x11')]},'showAgentAvatar':{'type':Sequelize[_0x464d('0x8')],'defaultValue':![]},'timezone':{'type':Sequelize[_0x464d('0x3')]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0x464d('0x2a');}},'notificationSound':{'type':Sequelize[_0x464d('0x8')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0x464d('0x8')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0x464d('0x3')],'defaultValue':_0x464d('0x2b')},'waitForTheAssignedAgent':{'type':Sequelize[_0x464d('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x464d('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0x464d('0x3')],'defaultValue':'bottom_right'},'verticalAlignment':{'type':Sequelize[_0x464d('0x7')],'defaultValue':0x1e},'labelText':{'type':Sequelize['STRING'],'defaultValue':_0x464d('0x2c')},'messagesAlignment':{'type':Sequelize[_0x464d('0x3')],'defaultValue':'alternate'},'defaultTitle':{'type':Sequelize['STRING']},'customerAvatar':{'type':Sequelize[_0x464d('0x11')]},'showCustomerAvatar':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0x464d('0x7')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0x464d('0x3')],'allowNull':![],'defaultValue':_0x464d('0x2d'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x464d('0x8')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x464d('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0x464d('0x3')],'defaultValue':_0x464d('0x2e')},'systemAvatar':{'type':Sequelize[_0x464d('0x11')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0x464d('0x7')],'comment':_0x464d('0x2f')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x1f8807){if(!_0x1f8807)this[_0x464d('0x20')](_0x464d('0x30'),null);this[_0x464d('0x20')]('mandatoryDisposition',_0x1f8807);}},'vidaooEscalation':{'type':Sequelize[_0x464d('0x8')],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize[_0x464d('0x3')]},'vidaooTopic':{'type':Sequelize[_0x464d('0x3')],'allowNull':![],'defaultValue':_0x464d('0x31')},'vidaooNote':{'type':Sequelize[_0x464d('0x3')],'defaultValue':function(){return _0x464d('0x32');}},'vidaooMetadata':{'type':Sequelize[_0x464d('0x11')],'defaultValue':null},'openNewInteraction':{'type':Sequelize[_0x464d('0x8')],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize[_0x464d('0x11')]}}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.controller.js b/server/api/chatWebsite/chatWebsite.controller.js index 2f37e41..9f27535 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 _0xf23c=['attachments','offline-chat','openNewInteraction','transaction','bulkCreate','Smtp','CloudProvider','forwardOffline','SendMail','sendMail','\x22%s\x22\x20<%s>','email','offlineMessageSubject','originalname','toPairsIn','subjectOffline','Chat','MailAccountId','NotifyMailAccount','notifyMail','remove','Could\x20not\x20remove\x20attachment\x20file','addInteraction','omit','getInteractions','nolimit','Contact','Owner','fullname','internal','Tag','Tags','color','tag','findAll','virtual','custom','License','increment','server/files/chat/iframe.ejs','utf8','URL','address','origin','3.5.0','remote','connection','remoteAddress','replace','alignment','verticalAlignment','textColor','textButtonColor','color_button','backgroundColor','hideWhenOffline','IntervalId','addApplications','sequelize','Transaction','ISOLATION_LEVELS','findAndCountAll','priority','stack','getApplications','addProactiveActions','chatProactiveAction','getProactiveActions','ChatProactiveAction','getFields','online','false','offlineForm','onlineForm','items','fromKey','getOfflineMessages','Attachment','Attachments','addAgents','removeAgents','isArray','emit','userChatWebsite:remove','getAgents','util','ejs','fs-extra','querystring','html-to-text','ioredis','../../components/parsers/qs','api','../../errors/api','APIOutOfIntervalError','APINotFoundError','handleError','../../mysqldb','redis','localhost','register','http','client','request','then','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatWebsite,\x20%s,\x20%s','message','info','result','catch','status','offset','undefined','limit','count','set','Content-Range','json','update','destroy','ChatWebsites','UserProfileResource','end','sendStatus','name','send','Command','getSnippet','format','iftime\x20%s,%s','interval','indexOf','true','ONLINE','OFFLINE','timezone','No\x20timezone','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','inspect','get','all','some','user-agent-parser','setUA','first','x-forwarded-for','firstName','lastName','x-real-port','referer','browser','version','%s\x20%s','unknown','device','model','%s\x20%s\x20%s','vendor','type','index','mandatoryDispositionPause','ChatWebsite','fieldName','map','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','sort','where','pick','filter','merge','options','includeAll','include','rows','params','Pause','rawAttributes','create','body','role','user','UserProfileSection','find','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addDisposition','ChatWebsiteId','Disposition','getDispositions','findOne','order','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','addLogo','sitepic','file','filename','agentAvatar','addCustomerAvatar','customerAvatar','addSystemAvatar','systemAvatar','getLogo','join','root','server/files/images/logos/default_logo.svg','../../config/license/util','getLicense','isNil','existsSync','server/files/images/logos/','download','getAvatar','server/files/images/avatars/default_avatar.png','server/files/images/avatars/','getCustomerAvatar','server/files/images/avatars/customer_avatar.png','showCustomerAvatar','getSystemAvatar','notify','chat','CmContact','describe','ValidationError','no\x20available\x20attributes','updatedAt','difference','createdAt','CompanyId','ListId','Sequelize','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','List','Contacts','DESC','ChatApplication','Applications','Interval','Intervals','Chat\x20Website\x20with\x20id\x20%s\x20not\x20found','spread','account','list','defaults','from','contact','headers','threadId','ChatInteraction','externalUrl','interaction','messageId','created','autoclose','applications','push','close','*,*,*,*','AttachmentId','UserId','User','unshift','agent','waitForTheAssignedAgent','forcedOwnership','queueId','ChatQueue','queue','waitForTheAssignedQueue','Start','EventManager','files','mapKeyOffline','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','MailAccount','findOrCreate','readFileSync','server/files/templates/chatOfflineMessage.ejs','render','toPairs','offlineMessageBody','ChatOfflineMessage','fromString','mimetype'];(function(_0x57e4aa,_0x482b33){var _0x203e32=function(_0xf03c77){while(--_0xf03c77){_0x57e4aa['push'](_0x57e4aa['shift']());}};_0x203e32(++_0x482b33);}(_0xf23c,0x187));var _0xcf23=function(_0x546aaf,_0x1ed138){_0x546aaf=_0x546aaf-0x0;var _0x1cbf6d=_0xf23c[_0x546aaf];return _0x1cbf6d;};'use strict';var Mustache=require('mustache');var util=require(_0xcf23('0x0'));var path=require('path');var ejs=require(_0xcf23('0x1'));var fs=require('fs');var fs_extra=require(_0xcf23('0x2'));var _=require('lodash');var querystring=require(_0xcf23('0x3'));var htmlToText=require(_0xcf23('0x4'));var Redis=require(_0xcf23('0x5'));var jayson=require('jayson/promise');var url=require('url');var qs=require(_0xcf23('0x6'));var logger=require('../../config/logger')(_0xcf23('0x7'));var config=require('../../config/environment');var APIOutOfIntervalError=require(_0xcf23('0x8'))[_0xcf23('0x9')];var APINotFoundError=require(_0xcf23('0x8'))[_0xcf23('0xa')];var APIHandleError=require(_0xcf23('0x8'))[_0xcf23('0xb')];var db=require(_0xcf23('0xc'))['db'];config['redis']=_['defaults'](config[_0xcf23('0xd')],{'host':_0xcf23('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xcf23('0xd')]));require('./chatWebsite.socket')[_0xcf23('0xf')](socket);var client=jayson['client'][_0xcf23('0x10')]({'port':0x232c});var client9002=jayson[_0xcf23('0x11')]['http']({'port':0x232a});var client9003=jayson[_0xcf23('0x11')][_0xcf23('0x10')]({'port':0x232b});var client9001=jayson[_0xcf23('0x11')][_0xcf23('0x10')]({'port':0x2329});function respondWithRpcPromise(_0x30b99f,_0x240806,_0x15af06,_0x6febee){return new Promise(function(_0x4d79df,_0x351f28){var _0x281e63=_0x6febee||client;return _0x281e63[_0xcf23('0x12')](_0x30b99f,_0x15af06)[_0xcf23('0x13')](function(_0x489fd9){logger['info']('ChatWebsite,\x20%s,\x20%s',_0x240806,_0xcf23('0x14'));logger[_0xcf23('0x15')](_0xcf23('0x16'),_0x240806,_0xcf23('0x14'),JSON[_0xcf23('0x17')](_0x489fd9));if(_0x489fd9[_0xcf23('0x18')]){if(_0x489fd9['error'][_0xcf23('0x19')]===0x1f4){logger[_0xcf23('0x18')](_0xcf23('0x1a'),_0x240806,_0x489fd9[_0xcf23('0x18')]['message']);return _0x351f28(_0x489fd9[_0xcf23('0x18')][_0xcf23('0x1b')]);}logger[_0xcf23('0x18')](_0xcf23('0x1a'),_0x240806,_0x489fd9[_0xcf23('0x18')]['message']);return _0x4d79df(_0x489fd9[_0xcf23('0x18')][_0xcf23('0x1b')]);}else{logger[_0xcf23('0x1c')](_0xcf23('0x1a'),_0x240806,_0xcf23('0x14'));_0x4d79df(_0x489fd9[_0xcf23('0x1d')]['message']);}})[_0xcf23('0x1e')](function(_0x196ef5){logger[_0xcf23('0x18')]('ChatWebsite,\x20%s,\x20%s',_0x240806,_0x196ef5);_0x351f28(_0x196ef5);});});}function respondWithStatusCode(_0x33fac1,_0x501720){_0x501720=_0x501720||0xcc;return function(_0x4e01b8){if(_0x4e01b8){return _0x33fac1['sendStatus'](_0x501720);}return _0x33fac1[_0xcf23('0x1f')](_0x501720)['end']();};}function respondWithResult(_0x838cae,_0xed58e5){_0xed58e5=_0xed58e5||0xc8;return function(_0x458557){if(_0x458557){return _0x838cae[_0xcf23('0x1f')](_0xed58e5)['json'](_0x458557);}};}function respondWithFilteredResult(_0x2a2f49,_0x3a08d6){return function(_0x24d2c8){if(_0x24d2c8){var _0x3c288f=typeof _0x3a08d6[_0xcf23('0x20')]===_0xcf23('0x21')&&typeof _0x3a08d6[_0xcf23('0x22')]==='undefined';var _0x6eb6d7=_0x24d2c8[_0xcf23('0x23')];var _0x26b581=_0x3c288f?0x0:_0x3a08d6['offset'];var _0x3105c0=_0x3c288f?_0x24d2c8[_0xcf23('0x23')]:_0x3a08d6[_0xcf23('0x20')]+_0x3a08d6[_0xcf23('0x22')];var _0x3db040;if(_0x3105c0>=_0x6eb6d7){_0x3105c0=_0x6eb6d7;_0x3db040=0xc8;}else{_0x3db040=0xce;}_0x2a2f49[_0xcf23('0x1f')](_0x3db040);return _0x2a2f49[_0xcf23('0x24')](_0xcf23('0x25'),_0x26b581+'-'+_0x3105c0+'/'+_0x6eb6d7)[_0xcf23('0x26')](_0x24d2c8);}return null;};}function saveUpdates(_0x5010bb){return function(_0x591d5e){if(_0x591d5e){return _0x591d5e[_0xcf23('0x27')](_0x5010bb)['then'](function(_0x33a2f7){return _0x33a2f7;});}return null;};}function removeEntity(_0x283550){return function(_0x5d1697){if(_0x5d1697){return _0x5d1697[_0xcf23('0x28')]()[_0xcf23('0x13')](function(){var _0x37528e=_0x5d1697['get']({'plain':!![]});var _0x12fbae=_0xcf23('0x29');return db[_0xcf23('0x2a')]['destroy']({'where':{'type':_0x12fbae,'resourceId':_0x37528e['id']}})[_0xcf23('0x13')](function(){return _0x5d1697;});})[_0xcf23('0x13')](function(){_0x283550[_0xcf23('0x1f')](0xcc)[_0xcf23('0x2b')]();});}};}function handleEntityNotFound(_0x27677f){return function(_0x867e77){if(!_0x867e77){_0x27677f[_0xcf23('0x2c')](0x194);}return _0x867e77;};}function handleError(_0x5a8b63,_0x5dcb81){_0x5dcb81=_0x5dcb81||0x1f4;return function(_0x515f11){logger[_0xcf23('0x18')](_0x515f11['stack']);if(_0x515f11[_0xcf23('0x2d')]){delete _0x515f11['name'];}_0x5a8b63[_0xcf23('0x1f')](_0x5dcb81)[_0xcf23('0x2e')](_0x515f11);};}function iftimePromise(_0x2abab9,_0x5eaa19){return respondWithRpcPromise(_0xcf23('0x2f'),_0xcf23('0x30'),{'command':_0x5eaa19['timezone']?util[_0xcf23('0x31')](_0xcf23('0x32'),_0x2abab9[_0xcf23('0x33')],_0x5eaa19['timezone']):util[_0xcf23('0x31')]('iftime\x20%s',_0x2abab9[_0xcf23('0x33')])},client9002)[_0xcf23('0x13')](function(_0x69f535){var _0x5cfe01=_0x69f535&&_0x69f535[_0xcf23('0x34')](_0xcf23('0x35'))>=0x0?!![]:![];logger[_0xcf23('0x1c')]('[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)',_0x5eaa19['id'],_0x2abab9['id'],_0x2abab9['interval'],_0x5cfe01?_0xcf23('0x36'):_0xcf23('0x37'),_0x5eaa19[_0xcf23('0x38')]?_0x5eaa19[_0xcf23('0x38')]:_0xcf23('0x39'));return _0x5cfe01;})[_0xcf23('0x1e')](function(_0xd08f7){logger[_0xcf23('0x18')](_0xcf23('0x3a'),_0x5eaa19['id'],_0x2abab9['id'],_0x2abab9[_0xcf23('0x33')],util[_0xcf23('0x3b')](_0xd08f7,{'showHidden':![],'depth':null}),_0x5eaa19[_0xcf23('0x38')]?_0x5eaa19[_0xcf23('0x38')]:_0xcf23('0x39'));return![];});}function checkWebsiteIntervals(_0x2e3834){var _0x241936=_['map'](_0x2e3834['Interval']['Intervals'],function(_0x17505d){var _0x12ce56=_0x17505d[_0xcf23('0x3c')]({'plain':!![]});return iftimePromise(_0x12ce56,_0x2e3834);});return Promise[_0xcf23('0x3d')](_0x241936)[_0xcf23('0x13')](function(_0x2150f4){return _[_0xcf23('0x3e')](_0x2150f4);});}function createInteractionObject(_0x5885cf,_0x54da07,_0x44d6f5,_0x28dd72){var _0x10cf49=require(_0xcf23('0x3f'));var _0x45c435=new _0x10cf49();var _0x5dfcae=_0x45c435[_0xcf23('0x40')](_0x44d6f5['user-agent'])['getResult']();var _0x265afb=_0x54da07['customerIp'];if(_0x44d6f5['cf-connecting-ip']){_0x265afb=_0x44d6f5['cf-connecting-ip'];}else if(_0x44d6f5['x-forwarded-for']){_0x265afb=_[_0xcf23('0x41')](_0x44d6f5[_0xcf23('0x42')]['split'](','));}return{'ContactId':_0x28dd72['id'],'ChatWebsiteId':_0x5885cf,'from':(_0x28dd72[_0xcf23('0x43')]||'')+'\x20'+(_0x28dd72[_0xcf23('0x44')]||''),'customerIp':_0x265afb,'customerPort':_0x44d6f5[_0xcf23('0x45')]?_0x44d6f5[_0xcf23('0x45')]:null,'referer':_0x54da07[_0xcf23('0x46')],'browserName':_0x5dfcae[_0xcf23('0x47')][_0xcf23('0x2d')]&&_0x5dfcae[_0xcf23('0x47')][_0xcf23('0x48')]?util[_0xcf23('0x31')](_0xcf23('0x49'),_0x5dfcae['browser'][_0xcf23('0x2d')],_0x5dfcae[_0xcf23('0x47')][_0xcf23('0x48')]):_0xcf23('0x4a'),'browserVersion':_0x5dfcae[_0xcf23('0x47')][_0xcf23('0x48')]||_0xcf23('0x4a'),'osName':util[_0xcf23('0x31')](_0xcf23('0x49'),_0x5dfcae['os'][_0xcf23('0x2d')],_0x5dfcae['os']['version']),'osVersion':_0x5dfcae['os']['version'],'deviceModel':_0x5dfcae[_0xcf23('0x4b')][_0xcf23('0x4c')]&&_0x5dfcae[_0xcf23('0x4b')]['vendor']?util[_0xcf23('0x31')](_0xcf23('0x4d'),_0x5dfcae[_0xcf23('0x4b')][_0xcf23('0x4c')],_0x5dfcae[_0xcf23('0x4b')][_0xcf23('0x4e')],_0x5dfcae[_0xcf23('0x4b')][_0xcf23('0x4f')]):null,'deviceVendor':_0x5dfcae['device'][_0xcf23('0x4e')],'deviceType':_0x5dfcae['device']['type'],'formData':JSON[_0xcf23('0x17')](_0x54da07)};}exports[_0xcf23('0x50')]=function(_0x5150f0,_0x412180){var _0x382aca={'include':[{'model':db['Pause'],'as':_0xcf23('0x51')}]},_0x6f3901={},_0x274bcb={'count':0x0,'rows':[]};var _0x4ec794=_['map'](db[_0xcf23('0x52')]['rawAttributes'],function(_0x415f8e){return{'name':_0x415f8e[_0xcf23('0x53')],'type':_0x415f8e[_0xcf23('0x4f')]['key']};});_0x6f3901[_0xcf23('0x4c')]=_[_0xcf23('0x54')](_0x4ec794,_0xcf23('0x2d'));_0x6f3901['query']=_[_0xcf23('0x55')](_0x5150f0[_0xcf23('0x56')]);_0x6f3901[_0xcf23('0x57')]=_['intersection'](_0x6f3901['model'],_0x6f3901[_0xcf23('0x56')]);_0x382aca[_0xcf23('0x58')]=_[_0xcf23('0x59')](_0x6f3901[_0xcf23('0x4c')],qs[_0xcf23('0x5a')](_0x5150f0['query'][_0xcf23('0x5a')]));_0x382aca[_0xcf23('0x58')]=_0x382aca[_0xcf23('0x58')][_0xcf23('0x5b')]?_0x382aca[_0xcf23('0x58')]:_0x6f3901['model'];if(!_0x5150f0['query'][_0xcf23('0x5c')]('nolimit')){_0x382aca['limit']=qs['limit'](_0x5150f0[_0xcf23('0x56')][_0xcf23('0x22')]);_0x382aca[_0xcf23('0x20')]=qs['offset'](_0x5150f0['query'][_0xcf23('0x20')]);}_0x382aca['order']=qs['sort'](_0x5150f0['query'][_0xcf23('0x5d')]);_0x382aca[_0xcf23('0x5e')]=qs[_0xcf23('0x57')](_[_0xcf23('0x5f')](_0x5150f0[_0xcf23('0x56')],_0x6f3901[_0xcf23('0x57')]),_0x4ec794);if(_0x5150f0['query'][_0xcf23('0x60')]){_0x382aca[_0xcf23('0x5e')]=_[_0xcf23('0x61')](_0x382aca[_0xcf23('0x5e')],{'$or':_['map'](_0x4ec794,function(_0xabddf7){if(_0xabddf7[_0xcf23('0x4f')]!=='VIRTUAL'){var _0x26487b={};_0x26487b[_0xabddf7[_0xcf23('0x2d')]]={'$like':'%'+_0x5150f0['query'][_0xcf23('0x60')]+'%'};return _0x26487b;}})});}_0x382aca=_[_0xcf23('0x61')]({},_0x382aca,_0x5150f0[_0xcf23('0x62')]);var _0x3c3a4b={'where':_0x382aca[_0xcf23('0x5e')]};return db[_0xcf23('0x52')][_0xcf23('0x23')](_0x3c3a4b)['then'](function(_0x1b23c0){_0x274bcb['count']=_0x1b23c0;if(_0x5150f0['query'][_0xcf23('0x63')]){_0x382aca[_0xcf23('0x64')]=[{'all':!![]}];}return db['ChatWebsite']['findAll'](_0x382aca);})[_0xcf23('0x13')](function(_0x55d64e){_0x274bcb[_0xcf23('0x65')]=_0x55d64e;return _0x274bcb;})['then'](respondWithFilteredResult(_0x412180,_0x382aca))[_0xcf23('0x1e')](handleError(_0x412180,null));};exports['show']=function(_0x348e15,_0x14b8dd){var _0x5b602f={'raw':![],'where':{'id':_0x348e15[_0xcf23('0x66')]['id']},'include':[{'model':db[_0xcf23('0x67')],'as':_0xcf23('0x51')}]},_0xf27beb={};_0xf27beb[_0xcf23('0x4c')]=_[_0xcf23('0x55')](db[_0xcf23('0x52')][_0xcf23('0x68')]);_0xf27beb[_0xcf23('0x56')]=_['keys'](_0x348e15[_0xcf23('0x56')]);_0xf27beb[_0xcf23('0x57')]=_[_0xcf23('0x59')](_0xf27beb[_0xcf23('0x4c')],_0xf27beb[_0xcf23('0x56')]);_0x5b602f['attributes']=_['intersection'](_0xf27beb['model'],qs[_0xcf23('0x5a')](_0x348e15[_0xcf23('0x56')][_0xcf23('0x5a')]));_0x5b602f['attributes']=_0x5b602f['attributes'][_0xcf23('0x5b')]?_0x5b602f[_0xcf23('0x58')]:_0xf27beb[_0xcf23('0x4c')];if(_0x348e15[_0xcf23('0x56')][_0xcf23('0x63')]){_0x5b602f['include']=[{'all':!![]}];}_0x5b602f=_[_0xcf23('0x61')]({},_0x5b602f,_0x348e15['options']);return db['ChatWebsite']['find'](_0x5b602f)[_0xcf23('0x13')](handleEntityNotFound(_0x14b8dd,null))[_0xcf23('0x13')](respondWithResult(_0x14b8dd,null))[_0xcf23('0x1e')](handleError(_0x14b8dd,null));};exports[_0xcf23('0x69')]=function(_0x2f69db,_0x3168ed){return db[_0xcf23('0x52')][_0xcf23('0x69')](_0x2f69db[_0xcf23('0x6a')],{})[_0xcf23('0x13')](function(_0x1a5efa){var _0x9bc11d=_0x2f69db['user']['get']({'plain':!![]});if(!_0x9bc11d)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x9bc11d[_0xcf23('0x6b')]===_0xcf23('0x6c')){var _0x1b4d12=_0x1a5efa[_0xcf23('0x3c')]({'plain':!![]});var _0x5218d4=_0xcf23('0x29');return db[_0xcf23('0x6d')][_0xcf23('0x6e')]({'where':{'name':_0x5218d4,'userProfileId':_0x9bc11d['userProfileId']},'raw':!![]})['then'](function(_0x2e5882){if(_0x2e5882&&_0x2e5882['autoAssociation']===0x0){return db[_0xcf23('0x2a')]['create']({'name':_0x1b4d12['name'],'resourceId':_0x1b4d12['id'],'type':_0x2e5882[_0xcf23('0x2d')],'sectionId':_0x2e5882['id']},{})['then'](function(){return _0x1a5efa;});}else{return _0x1a5efa;}})[_0xcf23('0x1e')](function(_0x2595ac){logger[_0xcf23('0x18')](_0xcf23('0x6f'),_0x2595ac);throw _0x2595ac;});}return _0x1a5efa;})[_0xcf23('0x13')](respondWithResult(_0x3168ed,0xc9))[_0xcf23('0x1e')](handleError(_0x3168ed,null));};exports[_0xcf23('0x27')]=function(_0x580fb3,_0x225d96){if(_0x580fb3[_0xcf23('0x6a')]['id']){delete _0x580fb3[_0xcf23('0x6a')]['id'];}return db[_0xcf23('0x52')][_0xcf23('0x6e')]({'where':{'id':_0x580fb3['params']['id']},'include':[{'model':db[_0xcf23('0x67')],'as':_0xcf23('0x51')}]})[_0xcf23('0x13')](handleEntityNotFound(_0x225d96,null))[_0xcf23('0x13')](saveUpdates(_0x580fb3[_0xcf23('0x6a')],null))[_0xcf23('0x13')](respondWithResult(_0x225d96,null))[_0xcf23('0x1e')](handleError(_0x225d96,null));};exports[_0xcf23('0x28')]=function(_0x1a530f,_0x5c02ef){return db[_0xcf23('0x52')]['find']({'where':{'id':_0x1a530f[_0xcf23('0x66')]['id']}})[_0xcf23('0x13')](handleEntityNotFound(_0x5c02ef,null))[_0xcf23('0x13')](removeEntity(_0x5c02ef,null))[_0xcf23('0x1e')](handleError(_0x5c02ef,null));};exports['describe']=function(_0x3f9f76,_0x57fcf3){return db[_0xcf23('0x52')]['describe']()[_0xcf23('0x13')](respondWithResult(_0x57fcf3,null))[_0xcf23('0x1e')](handleError(_0x57fcf3,null));};exports[_0xcf23('0x70')]=function(_0x1fc6e1,_0xd7ab80){if(_0x1fc6e1[_0xcf23('0x6a')]['id']){delete _0x1fc6e1[_0xcf23('0x6a')]['id'];}return db[_0xcf23('0x52')][_0xcf23('0x6e')]({'where':{'id':_0x1fc6e1[_0xcf23('0x66')]['id']}})['then'](handleEntityNotFound(_0xd7ab80,null))[_0xcf23('0x13')](function(_0x2879f9){if(_0x2879f9){_0x1fc6e1[_0xcf23('0x6a')][_0xcf23('0x71')]=_0x2879f9['id'];return db[_0xcf23('0x72')][_0xcf23('0x69')](_0x1fc6e1['body']);}})['then'](respondWithResult(_0xd7ab80,null))[_0xcf23('0x1e')](handleError(_0xd7ab80,null));};exports[_0xcf23('0x73')]=function(_0x4ded20,_0x5acd00){var _0x170e2e={'raw':![],'where':{}};var _0x56f38f={};var _0x78c888={'count':0x0,'rows':[]};return db[_0xcf23('0x52')][_0xcf23('0x74')]({'where':{'id':_0x4ded20[_0xcf23('0x66')]['id']}})[_0xcf23('0x13')](handleEntityNotFound(_0x5acd00,null))[_0xcf23('0x13')](function(_0x6b7841){if(_0x6b7841){_0x56f38f['model']=_[_0xcf23('0x55')](db[_0xcf23('0x72')][_0xcf23('0x68')]);_0x56f38f['query']=_['keys'](_0x4ded20[_0xcf23('0x56')]);_0x56f38f['filters']=_[_0xcf23('0x59')](_0x56f38f[_0xcf23('0x4c')],_0x56f38f[_0xcf23('0x56')]);_0x170e2e[_0xcf23('0x58')]=_[_0xcf23('0x59')](_0x56f38f[_0xcf23('0x4c')],qs[_0xcf23('0x5a')](_0x4ded20[_0xcf23('0x56')][_0xcf23('0x5a')]));_0x170e2e['attributes']=_0x170e2e[_0xcf23('0x58')][_0xcf23('0x5b')]?_0x170e2e[_0xcf23('0x58')]:_0x56f38f[_0xcf23('0x4c')];if(!_0x4ded20[_0xcf23('0x56')][_0xcf23('0x5c')]('nolimit')){_0x170e2e[_0xcf23('0x22')]=qs['limit'](_0x4ded20[_0xcf23('0x56')][_0xcf23('0x22')]);_0x170e2e[_0xcf23('0x20')]=qs[_0xcf23('0x20')](_0x4ded20['query']['offset']);}_0x170e2e[_0xcf23('0x75')]=qs[_0xcf23('0x5d')](_0x4ded20[_0xcf23('0x56')][_0xcf23('0x5d')]);_0x170e2e[_0xcf23('0x5e')]=qs[_0xcf23('0x57')](_[_0xcf23('0x5f')](_0x4ded20[_0xcf23('0x56')],_0x56f38f[_0xcf23('0x57')]));_0x170e2e['where']['ChatWebsiteId']=_0x6b7841['id'];if(_0x4ded20['query']['filter']){_0x170e2e[_0xcf23('0x5e')]=_[_0xcf23('0x61')](_0x170e2e['where'],{'$or':_[_0xcf23('0x54')](_0x170e2e[_0xcf23('0x58')],function(_0x59bbaf){var _0x2cf0a9={};_0x2cf0a9[_0x59bbaf]={'$like':'%'+_0x4ded20[_0xcf23('0x56')][_0xcf23('0x60')]+'%'};return _0x2cf0a9;})});}_0x170e2e=_['merge']({},_0x170e2e,_0x4ded20[_0xcf23('0x62')]);return db[_0xcf23('0x72')][_0xcf23('0x23')]({'where':_0x170e2e[_0xcf23('0x5e')]})[_0xcf23('0x13')](function(_0x195463){_0x78c888[_0xcf23('0x23')]=_0x195463;if(_0x4ded20[_0xcf23('0x56')][_0xcf23('0x63')]){_0x170e2e[_0xcf23('0x64')]=[{'all':!![]}];}return db[_0xcf23('0x72')]['findAll'](_0x170e2e);})[_0xcf23('0x13')](function(_0x51d61b){_0x78c888['rows']=_0x51d61b;return _0x78c888;});}})['then'](respondWithFilteredResult(_0x5acd00,_0x170e2e))[_0xcf23('0x1e')](handleError(_0x5acd00,null));};exports[_0xcf23('0x76')]=function(_0x454f39,_0x5bc6cf){return db[_0xcf23('0x52')][_0xcf23('0x6e')]({'where':{'id':_0x454f39[_0xcf23('0x66')]['id']}})['then'](handleEntityNotFound(_0x5bc6cf,null))[_0xcf23('0x13')](function(_0xc45c7){if(_0xc45c7){return _0xc45c7[_0xcf23('0x76')](_0x454f39[_0xcf23('0x56')][_0xcf23('0x77')]);}})['then'](respondWithStatusCode(_0x5bc6cf,null))['catch'](handleError(_0x5bc6cf,null));};exports[_0xcf23('0x78')]=function(_0xfa7750,_0x2f12cb){if(_0xfa7750[_0xcf23('0x6a')]['id']){delete _0xfa7750[_0xcf23('0x6a')]['id'];}return db['ChatWebsite'][_0xcf23('0x6e')]({'where':{'id':_0xfa7750[_0xcf23('0x66')]['id']}})[_0xcf23('0x13')](handleEntityNotFound(_0x2f12cb,null))['then'](function(_0x48d58f){if(_0x48d58f){_0xfa7750['body'][_0xcf23('0x71')]=_0x48d58f['id'];return db[_0xcf23('0x79')][_0xcf23('0x69')](_0xfa7750[_0xcf23('0x6a')]);}})[_0xcf23('0x13')](respondWithResult(_0x2f12cb,null))[_0xcf23('0x1e')](handleError(_0x2f12cb,null));};exports[_0xcf23('0x7a')]=function(_0x3a45c0,_0x1d64d3){var _0x373138={'raw':![],'where':{}};var _0x4c7c79={};var _0x1e5fa7={'count':0x0,'rows':[]};return db[_0xcf23('0x52')][_0xcf23('0x74')]({'where':{'id':_0x3a45c0[_0xcf23('0x66')]['id']}})[_0xcf23('0x13')](handleEntityNotFound(_0x1d64d3,null))[_0xcf23('0x13')](function(_0x282805){if(_0x282805){_0x4c7c79['model']=_[_0xcf23('0x55')](db['CannedAnswer'][_0xcf23('0x68')]);_0x4c7c79[_0xcf23('0x56')]=_[_0xcf23('0x55')](_0x3a45c0[_0xcf23('0x56')]);_0x4c7c79['filters']=_[_0xcf23('0x59')](_0x4c7c79['model'],_0x4c7c79['query']);_0x373138[_0xcf23('0x58')]=_[_0xcf23('0x59')](_0x4c7c79[_0xcf23('0x4c')],qs[_0xcf23('0x5a')](_0x3a45c0[_0xcf23('0x56')][_0xcf23('0x5a')]));_0x373138[_0xcf23('0x58')]=_0x373138['attributes'][_0xcf23('0x5b')]?_0x373138['attributes']:_0x4c7c79[_0xcf23('0x4c')];if(!_0x3a45c0['query'][_0xcf23('0x5c')]('nolimit')){_0x373138[_0xcf23('0x22')]=qs[_0xcf23('0x22')](_0x3a45c0[_0xcf23('0x56')][_0xcf23('0x22')]);_0x373138['offset']=qs[_0xcf23('0x20')](_0x3a45c0[_0xcf23('0x56')][_0xcf23('0x20')]);}_0x373138[_0xcf23('0x75')]=qs[_0xcf23('0x5d')](_0x3a45c0['query'][_0xcf23('0x5d')]);_0x373138[_0xcf23('0x5e')]=qs[_0xcf23('0x57')](_[_0xcf23('0x5f')](_0x3a45c0[_0xcf23('0x56')],_0x4c7c79['filters']));_0x373138['where'][_0xcf23('0x71')]=_0x282805['id'];if(_0x3a45c0['query'][_0xcf23('0x60')]){_0x373138[_0xcf23('0x5e')]=_['merge'](_0x373138[_0xcf23('0x5e')],{'$or':_['map'](_0x373138[_0xcf23('0x58')],function(_0xa1cef8){var _0x1f434e={};_0x1f434e[_0xa1cef8]={'$like':'%'+_0x3a45c0['query']['filter']+'%'};return _0x1f434e;})});}_0x373138=_[_0xcf23('0x61')]({},_0x373138,_0x3a45c0[_0xcf23('0x62')]);return db[_0xcf23('0x79')][_0xcf23('0x23')]({'where':_0x373138[_0xcf23('0x5e')]})[_0xcf23('0x13')](function(_0x226c0f){_0x1e5fa7[_0xcf23('0x23')]=_0x226c0f;if(_0x3a45c0[_0xcf23('0x56')][_0xcf23('0x63')]){_0x373138[_0xcf23('0x64')]=[{'all':!![]}];}return db[_0xcf23('0x79')]['findAll'](_0x373138);})['then'](function(_0x58326e){_0x1e5fa7['rows']=_0x58326e;return _0x1e5fa7;});}})['then'](respondWithFilteredResult(_0x1d64d3,_0x373138))[_0xcf23('0x1e')](handleError(_0x1d64d3,null));};exports[_0xcf23('0x7b')]=function(_0x4b5694,_0x130861){return db[_0xcf23('0x52')][_0xcf23('0x6e')]({'where':{'id':_0x4b5694[_0xcf23('0x66')]['id']}})['then'](handleEntityNotFound(_0x130861,null))[_0xcf23('0x13')](function(_0x1b1a77){if(_0x1b1a77){return _0x1b1a77[_0xcf23('0x7b')](_0x4b5694['query'][_0xcf23('0x77')]);}})[_0xcf23('0x13')](respondWithStatusCode(_0x130861,null))[_0xcf23('0x1e')](handleError(_0x130861,null));};exports[_0xcf23('0x7c')]=function(_0x543b2f,_0x200737){_0x543b2f[_0xcf23('0x6a')][_0xcf23('0x7d')]=_0x543b2f[_0xcf23('0x7e')][_0xcf23('0x7f')];return db[_0xcf23('0x52')][_0xcf23('0x6e')]({'where':{'id':_0x543b2f[_0xcf23('0x66')]['id']}})[_0xcf23('0x13')](handleEntityNotFound(_0x200737,null))[_0xcf23('0x13')](saveUpdates(_0x543b2f[_0xcf23('0x6a')],null))['then'](respondWithResult(_0x200737,null))['catch'](handleError(_0x200737,null));};exports['addAvatar']=function(_0xf4313e,_0x58deaa){_0xf4313e[_0xcf23('0x6a')][_0xcf23('0x80')]=_0xf4313e[_0xcf23('0x7e')][_0xcf23('0x7f')];return db[_0xcf23('0x52')][_0xcf23('0x6e')]({'where':{'id':_0xf4313e[_0xcf23('0x66')]['id']}})['then'](handleEntityNotFound(_0x58deaa,null))['then'](saveUpdates(_0xf4313e['body'],null))[_0xcf23('0x13')](respondWithResult(_0x58deaa,null))['catch'](handleError(_0x58deaa,null));};exports[_0xcf23('0x81')]=function(_0x467c46,_0x4ff4d0){_0x467c46[_0xcf23('0x6a')][_0xcf23('0x82')]=_0x467c46['file'][_0xcf23('0x7f')];return db[_0xcf23('0x52')][_0xcf23('0x6e')]({'where':{'id':_0x467c46[_0xcf23('0x66')]['id']}})[_0xcf23('0x13')](handleEntityNotFound(_0x4ff4d0,null))[_0xcf23('0x13')](saveUpdates(_0x467c46[_0xcf23('0x6a')],null))[_0xcf23('0x13')](respondWithResult(_0x4ff4d0,null))['catch'](handleError(_0x4ff4d0,null));};exports[_0xcf23('0x83')]=function(_0x4954db,_0x1da6aa){_0x4954db[_0xcf23('0x6a')][_0xcf23('0x84')]=_0x4954db[_0xcf23('0x7e')]['filename'];return db[_0xcf23('0x52')]['find']({'where':{'id':_0x4954db['params']['id']}})[_0xcf23('0x13')](handleEntityNotFound(_0x1da6aa,null))[_0xcf23('0x13')](saveUpdates(_0x4954db[_0xcf23('0x6a')],null))[_0xcf23('0x13')](respondWithResult(_0x1da6aa,null))[_0xcf23('0x1e')](handleError(_0x1da6aa,null));};exports[_0xcf23('0x85')]=function(_0x22b0f6,_0xb7d523){var _0x3764fe=path[_0xcf23('0x86')](config[_0xcf23('0x87')],_0xcf23('0x88'));var _0x131ad3={'where':{'id':_0x22b0f6[_0xcf23('0x66')]['id']},'attributes':['id',_0xcf23('0x7d')],'raw':!![]};var _0xc49b03=![];return require(_0xcf23('0x89'))[_0xcf23('0x8a')]()['then'](function(_0x4944dc){if(_0x4944dc){_0xc49b03=_0x4944dc['custom'];}})[_0xcf23('0x13')](function(){return db['ChatWebsite'][_0xcf23('0x6e')](_0x131ad3);})['then'](handleEntityNotFound(_0xb7d523,null))['then'](function(_0x104fa2){if(_0x104fa2){if(!_[_0xcf23('0x8b')](_0x104fa2['sitepic'])){if(fs[_0xcf23('0x8c')](path[_0xcf23('0x86')](config[_0xcf23('0x87')],'server/files/images/logos/',_0x104fa2[_0xcf23('0x7d')]))&&_0xc49b03){_0x3764fe=path['join'](config[_0xcf23('0x87')],_0xcf23('0x8d'),_0x104fa2['sitepic']);}}return _0xb7d523[_0xcf23('0x8e')](_0x3764fe);}})[_0xcf23('0x1e')](handleError(_0xb7d523,null));};exports[_0xcf23('0x8f')]=function(_0x8f9cf9,_0x59801b){var _0x2b6730=path[_0xcf23('0x86')](config[_0xcf23('0x87')],_0xcf23('0x90'));var _0x3b9616={'where':{'id':_0x8f9cf9['params']['id']},'attributes':['id',_0xcf23('0x80')],'raw':!![]};return db[_0xcf23('0x52')][_0xcf23('0x6e')](_0x3b9616)[_0xcf23('0x13')](handleEntityNotFound(_0x59801b,null))['then'](function(_0x29d6dd){if(_0x29d6dd){if(!_['isNil'](_0x29d6dd[_0xcf23('0x80')])){if(fs['existsSync'](path[_0xcf23('0x86')](config[_0xcf23('0x87')],'server/files/images/avatars/',_0x29d6dd[_0xcf23('0x80')]))){_0x2b6730=path[_0xcf23('0x86')](config[_0xcf23('0x87')],_0xcf23('0x91'),_0x29d6dd[_0xcf23('0x80')]);}}return _0x59801b[_0xcf23('0x8e')](_0x2b6730);}})[_0xcf23('0x1e')](handleError(_0x59801b,null));};exports[_0xcf23('0x92')]=function(_0x23236a,_0x62a303){var _0xffb884=path['join'](config[_0xcf23('0x87')],_0xcf23('0x93'));var _0x3973e5={'where':{'id':_0x23236a[_0xcf23('0x66')]['id']},'attributes':['id',_0xcf23('0x82'),_0xcf23('0x94')],'raw':!![]};return db[_0xcf23('0x52')][_0xcf23('0x6e')](_0x3973e5)['then'](handleEntityNotFound(_0x62a303,null))[_0xcf23('0x13')](function(_0x256c38){if(_0x256c38){if(!_[_0xcf23('0x8b')](_0x256c38[_0xcf23('0x82')])){if(fs[_0xcf23('0x8c')](path[_0xcf23('0x86')](config[_0xcf23('0x87')],_0xcf23('0x91'),_0x256c38['customerAvatar']))&&_0x256c38[_0xcf23('0x94')]){_0xffb884=path['join'](config[_0xcf23('0x87')],_0xcf23('0x91'),_0x256c38[_0xcf23('0x82')]);}}return _0x62a303[_0xcf23('0x8e')](_0xffb884);}})[_0xcf23('0x1e')](handleError(_0x62a303,null));};exports[_0xcf23('0x95')]=function(_0x4fc89f,_0x475944){var _0x2f1d02=path[_0xcf23('0x86')](config['root'],'server/files/images/avatars/system_avatar.png');var _0x49d023={'where':{'id':_0x4fc89f['params']['id']},'attributes':['id',_0xcf23('0x84')],'raw':!![]};return db[_0xcf23('0x52')][_0xcf23('0x6e')](_0x49d023)['then'](handleEntityNotFound(_0x475944,null))[_0xcf23('0x13')](function(_0x598715){if(_0x598715){if(!_[_0xcf23('0x8b')](_0x598715['systemAvatar'])){if(fs[_0xcf23('0x8c')](path['join'](config[_0xcf23('0x87')],_0xcf23('0x91'),_0x598715[_0xcf23('0x84')]))){_0x2f1d02=path['join'](config['root'],_0xcf23('0x91'),_0x598715[_0xcf23('0x84')]);}}return _0x475944[_0xcf23('0x8e')](_0x2f1d02);}})[_0xcf23('0x1e')](handleError(_0x475944,null));};exports[_0xcf23('0x96')]=function(_0x29ff87,_0x4cdac1){var _0x1d879b={'body':_0x29ff87[_0xcf23('0x6a')],'channel':_0xcf23('0x97')};var _0x41739b=[];var _0x3a087e=[];var _0x1ac81c={};var _0x32044b=![];return db[_0xcf23('0x98')][_0xcf23('0x99')]()['then'](function(_0x5d7994){if(!_0x5d7994){throw new db['Sequelize'][(_0xcf23('0x9a'))](_0xcf23('0x9b'));}_0x41739b=_['difference'](_['keys'](_0x5d7994),['createdAt',_0xcf23('0x9c')]);_0x3a087e=_[_0xcf23('0x9d')](_[_0xcf23('0x55')](_0x5d7994),[_0xcf23('0x9e'),'updatedAt',_0xcf23('0x9f'),_0xcf23('0xa0')]);if(_0x29ff87[_0xcf23('0x6a')]['id']){delete _0x29ff87[_0xcf23('0x6a')]['id'];}if(_[_0xcf23('0x8b')](_0x29ff87[_0xcf23('0x6a')]['from'])){throw new db[(_0xcf23('0xa1'))][(_0xcf23('0x9a'))](_0xcf23('0xa2'));}if(_[_0xcf23('0x8b')](_0x29ff87[_0xcf23('0x6a')][_0xcf23('0x6a')])||_0x29ff87[_0xcf23('0x6a')][_0xcf23('0x6a')]===''){throw new db[(_0xcf23('0xa1'))][(_0xcf23('0x9a'))](_0xcf23('0xa3'));}if(_[_0xcf23('0x8b')](_0x29ff87['body']['mapKey'])){throw new db[(_0xcf23('0xa1'))][(_0xcf23('0x9a'))](_0xcf23('0xa4')+_0x3a087e);}if(!_[_0xcf23('0xa5')](_0x3a087e,_0x29ff87[_0xcf23('0x6a')][_0xcf23('0xa6')])){throw new db[(_0xcf23('0xa1'))][(_0xcf23('0x9a'))](_0xcf23('0xa7')+_0x3a087e);}_0x1ac81c[_0x29ff87['body'][_0xcf23('0xa6')]]=_0x29ff87[_0xcf23('0x6a')]['from'];})[_0xcf23('0x13')](function(){return db[_0xcf23('0x52')][_0xcf23('0x6e')]({'where':{'id':_0x29ff87[_0xcf23('0x66')]['id']},'include':[{'model':db[_0xcf23('0xa8')],'as':_0xcf23('0xa9'),'include':[{'model':db[_0xcf23('0x98')],'as':_0xcf23('0xaa'),'where':_0x1ac81c,'limit':0x1,'order':[[_0xcf23('0x9c'),_0xcf23('0xab')]]}]},{'model':db[_0xcf23('0xac')],'as':_0xcf23('0xad')},{'model':db[_0xcf23('0xae')],'as':_0xcf23('0xae'),'include':[{'model':db[_0xcf23('0xae')],'as':_0xcf23('0xaf'),'attributes':['id',_0xcf23('0x33')],'raw':!![]}]}]});})[_0xcf23('0x13')](function(_0x4621da){if(!_0x4621da)throw new APINotFoundError(util[_0xcf23('0x31')](_0xcf23('0xb0'),_0x29ff87['params']['id']));if(!_0x4621da[_0xcf23('0xae')]||!_0x4621da['Interval'][_0xcf23('0xaf')])return[_0x4621da,!![]];return[_0x4621da,checkWebsiteIntervals(_0x4621da)];})[_0xcf23('0xb1')](function(_0x329bba,_0x40ef57){if(!_0x40ef57)throw new APIOutOfIntervalError();if(!_0x329bba['List'])return;_0x1d879b[_0xcf23('0xb2')]=_0x329bba;_0x1d879b[_0xcf23('0xb3')]=_0x329bba[_0xcf23('0xa9')];_0x1d879b['applications']=_['orderBy'](_0x329bba[_0xcf23('0xad')],['priority'],['asc']);if(_0x1d879b[_0xcf23('0xb2')][_0xcf23('0xad')]){delete _0x1d879b['account'][_0xcf23('0xad')];}if(_0x1d879b[_0xcf23('0xb2')][_0xcf23('0xa9')]&&_0x1d879b['account']['List'][_0xcf23('0xaa')][_0xcf23('0x5b')]){return _0x1d879b[_0xcf23('0xb2')][_0xcf23('0xa9')][_0xcf23('0xaa')][0x0];}var _0x200758=_[_0xcf23('0xb4')](_0x29ff87[_0xcf23('0x6a')],{'firstName':_0x29ff87[_0xcf23('0x6a')][_0xcf23('0xb5')],'ListId':_0x329bba[_0xcf23('0xa0')]});_0x200758[_0x29ff87[_0xcf23('0x6a')]['mapKey']]=_0x29ff87[_0xcf23('0x6a')]['from'];return db[_0xcf23('0x98')]['create'](_0x200758,{'fields':_0x41739b,'raw':!![]});})['then'](function(_0x53993d){_0x1d879b[_0xcf23('0xb6')]=_0x53993d;var _0x180d42=createInteractionObject(_0x29ff87[_0xcf23('0x66')]['id'],_0x29ff87['body'],_0x29ff87[_0xcf23('0xb7')],_0x53993d);var _0x3fbfdf={'ChatWebsiteId':_0x29ff87['params']['id'],'closed':![]};if(_0x29ff87[_0xcf23('0x6a')][_0xcf23('0xb8')]){_0x3fbfdf[_0xcf23('0xb8')]=_0x29ff87[_0xcf23('0x6a')]['threadId'];return db[_0xcf23('0xb9')]['find']({'where':_0x3fbfdf})[_0xcf23('0x13')](function(_0x5389e7){if(_0x5389e7){_0x32044b=!![];return _0x5389e7;}_0x180d42['threadId']=_0x29ff87['body']['threadId'];_0x180d42[_0xcf23('0xba')]=_0x29ff87[_0xcf23('0x6a')][_0xcf23('0xba')];return db['ChatInteraction'][_0xcf23('0x69')](_0x180d42);});}_0x3fbfdf['ContactId']=_0x53993d['id'];if(_0x29ff87['body']['interaction']&&_0x29ff87[_0xcf23('0x6a')][_0xcf23('0xbb')]['id']){_0x3fbfdf['id']=_0x29ff87[_0xcf23('0x6a')]['interaction']['id'];return db[_0xcf23('0xb9')][_0xcf23('0x6e')]({'where':_0x3fbfdf})[_0xcf23('0x13')](function(_0x2d2c95){if(_0x2d2c95){_0x32044b=!![];return _0x2d2c95;}return db[_0xcf23('0xb9')]['create'](_0x180d42);});}return db[_0xcf23('0xb9')]['create'](_0x180d42);})[_0xcf23('0x13')](function(_0x25361a){if(!_0x32044b)return _0x25361a;var _0x149290={'from':(_0x1d879b['contact'][_0xcf23('0x43')]||'')+'\x20'+(_0x1d879b[_0xcf23('0xb6')][_0xcf23('0x44')]||'')};if(_0x29ff87[_0xcf23('0x6a')][_0xcf23('0xb8')]&&_0x29ff87[_0xcf23('0x6a')][_0xcf23('0xbc')]&&_0x29ff87['body'][_0xcf23('0xb8')]!=_0x29ff87[_0xcf23('0x6a')]['messageId']){_0x149290['threadId']=_0x29ff87[_0xcf23('0x6a')][_0xcf23('0xbc')];}return _0x25361a['update'](_0x149290);})[_0xcf23('0x13')](function(_0x3fb283){_0x1d879b[_0xcf23('0xbb')]=_0x3fb283[_0xcf23('0x3c')]({'plain':!![]});_0x1d879b[_0xcf23('0xbb')][_0xcf23('0xbd')]=!_0x32044b;if(_0x1d879b[_0xcf23('0xbb')][_0xcf23('0xbd')]){if(_0x1d879b[_0xcf23('0xb2')][_0xcf23('0xbe')]){_0x1d879b[_0xcf23('0xbf')][_0xcf23('0xc0')]({'id':0x0,'priority':_0x1d879b[_0xcf23('0xbf')][_0xcf23('0x5b')]+0x1,'app':_0xcf23('0xc1'),'appdata':'unmanaged','interval':_0xcf23('0xc2')});}}return db['ChatMessage'][_0xcf23('0x69')]({'body':_0x29ff87[_0xcf23('0x6a')][_0xcf23('0x6a')],'ChatWebsiteId':_0x29ff87[_0xcf23('0x66')]['id'],'ChatInteractionId':_0x3fb283['id'],'direction':'in','ContactId':_0x1d879b[_0xcf23('0xb6')]['id'],'AttachmentId':_0x29ff87[_0xcf23('0x6a')][_0xcf23('0xc3')]});})[_0xcf23('0x13')](function(_0x242ea5){_0x1d879b[_0xcf23('0x1b')]=_0x242ea5;if(!_0x1d879b[_0xcf23('0xbb')][_0xcf23('0xc4')]){return;}return db[_0xcf23('0xc5')][_0xcf23('0x6e')]({'attributes':['id','name'],'where':{'id':_0x1d879b['interaction'][_0xcf23('0xc4')]}});})['then'](function(_0x344f03){if(_0x344f03){_0x1d879b[_0xcf23('0xbf')][_0xcf23('0xc6')]({'id':0x0,'priority':0x0,'app':_0xcf23('0xc7'),'appdata':_0x344f03[_0xcf23('0x2d')]+','+(_0x1d879b[_0xcf23('0xb2')][_0xcf23('0xc8')]||0xa),'interval':'*,*,*,*'});_0x1d879b[_0xcf23('0xc9')]=!![];}if(!_0x1d879b[_0xcf23('0xbb')][_0xcf23('0xca')]){return;}return db[_0xcf23('0xcb')][_0xcf23('0x6e')]({'attributes':['id',_0xcf23('0x2d')],'where':{'id':_0x1d879b[_0xcf23('0xbb')][_0xcf23('0xca')]}});})[_0xcf23('0x13')](function(_0x210042){if(_0x210042){_0x1d879b[_0xcf23('0xbf')][_0xcf23('0xc6')]({'id':0x0,'priority':0x1,'app':_0xcf23('0xcc'),'appdata':_0x210042['name']+','+(_0x1d879b[_0xcf23('0xb2')][_0xcf23('0xcd')]||0x12c),'interval':_0xcf23('0xc2')});}return respondWithRpcPromise(_0xcf23('0xce'),'startRouting',_0x1d879b);})[_0xcf23('0x13')](function(_0x4db081){respondWithRpcPromise(_0xcf23('0xcf'),_0xcf23('0xcf'),{'event':_0xcf23('0x96'),'message':_0x4db081},client9002);return _0x4db081;})['then'](respondWithResult(_0x4cdac1,null))['catch'](APIHandleError(_0x4cdac1));};exports['offline']=function(_0x402c44,_0x1f7bb7){var _0x22ae8d,_0x3e01d5,_0x227a0d;var _0x5d52c3=[];var _0x13b233={};var _0x54830e=_0x402c44[_0xcf23('0xd0')]||[];var _0x27314e=[];var _0x4cb9ef;return db['CmContact'][_0xcf23('0x99')]()[_0xcf23('0x13')](function(_0x22e9d9){if(!_0x22e9d9){throw new db[(_0xcf23('0xa1'))][(_0xcf23('0x9a'))](_0xcf23('0x9b'));}_0x5d52c3=_['difference'](_[_0xcf23('0x55')](_0x22e9d9),[_0xcf23('0x9e'),_0xcf23('0x9c'),'CompanyId',_0xcf23('0xa0')]);if(_0x402c44[_0xcf23('0x6a')]['id']){delete _0x402c44[_0xcf23('0x6a')]['id'];}if(_[_0xcf23('0x8b')](_0x402c44[_0xcf23('0x6a')][_0xcf23('0xb5')])){throw _0x1f7bb7[_0xcf23('0x1f')](0x1f4)[_0xcf23('0x2e')](new db[(_0xcf23('0xa1'))][(_0xcf23('0x9a'))](_0xcf23('0xa2')));}if(_[_0xcf23('0x8b')](_0x402c44[_0xcf23('0x6a')]['body'])||_0x402c44[_0xcf23('0x6a')][_0xcf23('0x6a')]===''){throw _0x1f7bb7[_0xcf23('0x1f')](0x1f4)[_0xcf23('0x2e')](new db[(_0xcf23('0xa1'))][(_0xcf23('0x9a'))]('body\x20is\x20mandatory\x20and\x20not\x20empty'));}if(_[_0xcf23('0x8b')](_0x402c44['body'][_0xcf23('0xd1')])){throw _0x1f7bb7[_0xcf23('0x1f')](0x1f4)[_0xcf23('0x2e')](new db['Sequelize'][(_0xcf23('0x9a'))](_0xcf23('0xd2')+_0x5d52c3));}if(!_[_0xcf23('0xa5')](_0x5d52c3,_0x402c44[_0xcf23('0x6a')]['mapKeyOffline'])){throw _0x1f7bb7[_0xcf23('0x1f')](0x1f4)['send'](new db[(_0xcf23('0xa1'))]['ValidationError']('mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x5d52c3));}_0x13b233[_0x402c44[_0xcf23('0x6a')][_0xcf23('0xd1')]]=_0x402c44[_0xcf23('0x6a')][_0xcf23('0xb5')];})[_0xcf23('0x13')](function(){return db[_0xcf23('0x52')]['find']({'where':{'id':_0x402c44[_0xcf23('0x66')]['id']},'include':[{'model':db['CmList'],'as':'List'},{'model':db[_0xcf23('0xd3')],'as':_0xcf23('0xd3')}]});})[_0xcf23('0x13')](handleEntityNotFound(_0x1f7bb7,null))[_0xcf23('0x13')](function(_0x51ee19){if(_0x51ee19&&_0x51ee19['List']){_0x3e01d5=_0x51ee19;var _0x2c4cc9=_['defaults'](_0x402c44[_0xcf23('0x6a')],{'firstName':_0x402c44['body'][_0xcf23('0xb5')],'phone':_0x402c44[_0xcf23('0x6a')]['from'],'ListId':_0x51ee19[_0xcf23('0xa0')]});_0x2c4cc9[_0x402c44[_0xcf23('0x6a')][_0xcf23('0xd1')]]=_0x402c44[_0xcf23('0x6a')][_0xcf23('0xb5')];return db[_0xcf23('0x98')][_0xcf23('0xd4')]({'where':_0x13b233,'defaults':_0x2c4cc9});}})[_0xcf23('0xb1')](function(_0xad2536){if(_0xad2536){_0x227a0d=_0xad2536;var _0xf71cfb=fs[_0xcf23('0xd5')](path[_0xcf23('0x86')](config['root'],_0xcf23('0xd6')),'utf8');var _0x481f4f=ejs[_0xcf23('0xd7')](_0xf71cfb,{'body':_[_0xcf23('0xd8')](_0x402c44['body'][_0xcf23('0x6a')]),'bodyTitle':_0x3e01d5[_0xcf23('0xd9')]});return db[_0xcf23('0xda')][_0xcf23('0x69')]({'body':_0x481f4f,'plainBody':htmlToText[_0xcf23('0xdb')](_0x481f4f),'ContactId':_0xad2536['id'],'ChatWebsiteId':_0x3e01d5['id']});}})[_0xcf23('0x13')](function(_0x4f92e3){_0x4cb9ef=_0x4f92e3;if(_0x54830e[_0xcf23('0x5b')]){var _0x5895a4=_0x54830e['map'](function(_0x33ee07){return{'name':_0x33ee07['originalname'],'basename':_0x33ee07['filename'],'type':_0x33ee07[_0xcf23('0xdc')],'ChatOfflineMessageId':_0x4f92e3['id']};});_0x27314e=_0x5895a4[_0xcf23('0x54')](_0x47b33d=>{var _0x29e307={'filename':_0x47b33d['name'],'path':path['join'](config[_0xcf23('0x87')],'server',_0xcf23('0xd0'),_0xcf23('0xdd'),_0xcf23('0xde'),_0x47b33d['basename'])};return _0x29e307;});if(!_0x3e01d5[_0xcf23('0xdf')]){return db['sequelize'][_0xcf23('0xe0')](function(_0x99c971){return db['Attachment'][_0xcf23('0xe1')](_0x5895a4,{'transaction':_0x99c971});});}}})[_0xcf23('0x13')](function(){if(_0x4cb9ef){_0x22ae8d=_0x4cb9ef;return db[_0xcf23('0xd3')][_0xcf23('0x74')]({'where':{'service':!![]},'include':[{'model':db['MailServerOut'],'as':_0xcf23('0xe2'),'raw':!![],'include':[{'model':db[_0xcf23('0xe3')],'as':'CloudProvider','raw':!![]}]}]});}})[_0xcf23('0x13')](function(_0x44bb74){if(_0x44bb74&&_0x44bb74[_0xcf23('0xe2')]&&_0x3e01d5[_0xcf23('0xe4')]&&_0x3e01d5['forwardOfflineAddress']){var _0x1b2512=_0x44bb74['getSmtpOptions']();return respondWithRpcPromise(_0xcf23('0xe5'),_0xcf23('0xe6'),{'account':_0x1b2512,'message':{'from':util[_0xcf23('0x31')](_0xcf23('0xe7'),_0x44bb74[_0xcf23('0x2d')],_0x44bb74[_0xcf23('0xe8')]||_0x44bb74['Smtp'][_0xcf23('0x6c')]),'to':_0x3e01d5['forwardOfflineAddress'],'subject':_0x3e01d5[_0xcf23('0xe9')],'html':_0x22ae8d['body'],'attachments':_0x27314e}},client9003)[_0xcf23('0x13')](function(){return _0x22ae8d;})[_0xcf23('0x1e')](function(_0x927bf8){logger[_0xcf23('0x18')](_0x927bf8);});}})[_0xcf23('0x13')](function(){if(_0x3e01d5&&_0x3e01d5[_0xcf23('0xdf')]&&_0x3e01d5['MailAccountId']){var _0x3123fc=[];if(_0x54830e[_0xcf23('0x5b')]){_0x3123fc=_0x54830e['map'](function(_0xeedd1){return{'name':_0xeedd1[_0xcf23('0xea')],'basename':_0xeedd1[_0xcf23('0x7f')],'type':_0xeedd1[_0xcf23('0xdc')],'ChatOfflineMessageId':_0x4cb9ef['id']};});}var _0x4ac286;if(!_['isNil'](_0x3e01d5['subjectOffline'])){var _0x4433ab=_[_0xcf23('0x54')](_0x402c44['body'],function(_0x2bbe96){return _0x2bbe96;});var _0x34e430=_[_0xcf23('0xeb')](_0x4433ab)[0x0];var _0x4a8dd9=_['mapValues'](_0x34e430,function(_0x3c83a9){return _0x3c83a9;});_0x4ac286=_0x4a8dd9[0x1][_0x3e01d5[_0xcf23('0xec')]];}var _0x96e17c={'from':_0x227a0d[_0xcf23('0xe8')],'firstName':_0x227a0d[_0xcf23('0x43')],'lastName':_0x227a0d[_0xcf23('0x44')],'mapKey':_0xcf23('0xe8'),'message':{'from':_0x227a0d['email'],'to':_0x3e01d5[_0xcf23('0xd3')][_0xcf23('0xe8')],'cc':'','subject':_[_0xcf23('0x8b')](_0x4ac286)?_0x3e01d5[_0xcf23('0xe9')]:_0x4ac286,'messageId':'','sentAt':new Date(),'attach':_0x3123fc[_0xcf23('0x5b')],'attachments':_0x3123fc,'originChannel':_0xcf23('0xed'),'ChatWebsiteId':_0x3e01d5['id'],'ChatOfflineMessageId':_0x22ae8d['id'],'originTo':_0x3e01d5[_0xcf23('0xd3')][_0xcf23('0xe8')]},'body':_0x22ae8d['body']};var _0x54b706={'account':{'id':_0x3e01d5[_0xcf23('0xee')]},'body':_0x96e17c,'log':_0xcf23('0xef')};return respondWithRpcPromise('NotifyMailAccount',_0xcf23('0xf0'),_0x54b706,client9001)[_0xcf23('0x13')](function(){return _0x22ae8d;})['catch'](function(_0x47dfbb){logger[_0xcf23('0x18')](_0x47dfbb);});}return;})['then'](function(){if(_0x22ae8d){return _0x22ae8d;}})[_0xcf23('0x13')](respondWithResult(_0x1f7bb7,null))[_0xcf23('0x1e')](function(){for(var _0x4240ae of _0x54830e){var _0x536d3d=path[_0xcf23('0x86')](config[_0xcf23('0x87')],'server',_0xcf23('0xd0'),_0xcf23('0xdd'),_0xcf23('0xde'),_0x4240ae['filename']);fs_extra[_0xcf23('0xf1')](_0x536d3d)[_0xcf23('0x1e')](function(_0x547ed0){logger[_0xcf23('0x18')](_0xcf23('0xf2'),_0x536d3d,_0x547ed0);});}});};exports[_0xcf23('0xf3')]=function(_0x12e2fe,_0x372d5b){return db[_0xcf23('0xb9')][_0xcf23('0x6e')]({'where':{'id':_0x12e2fe[_0xcf23('0x66')]['id']}})['then'](handleEntityNotFound(_0x372d5b,null))[_0xcf23('0x13')](function(_0x2bb282){if(_0x2bb282){return _0x2bb282[_0xcf23('0xf3')](_0x12e2fe[_0xcf23('0x6a')][_0xcf23('0x77')],_[_0xcf23('0xf4')](_0x12e2fe[_0xcf23('0x6a')],[_0xcf23('0x77'),'id'])||{});}})[_0xcf23('0x13')](respondWithResult(_0x372d5b,null))[_0xcf23('0x1e')](handleError(_0x372d5b,null));};exports[_0xcf23('0xf5')]=function(_0x400e9b,_0x57e8d8){var _0x2a26ec={'raw':![],'where':{}};var _0x3df89f={};var _0x2cbb42={'count':0x0,'rows':[]};return db[_0xcf23('0x52')][_0xcf23('0x74')]({'where':{'id':_0x400e9b['params']['id']}})['then'](handleEntityNotFound(_0x57e8d8,null))[_0xcf23('0x13')](function(_0x414f01){if(_0x414f01){_0x3df89f['model']=_['keys'](db[_0xcf23('0xb9')][_0xcf23('0x68')]);_0x3df89f['query']=_['keys'](_0x400e9b[_0xcf23('0x56')]);_0x3df89f[_0xcf23('0x57')]=_[_0xcf23('0x59')](_0x3df89f[_0xcf23('0x4c')],_0x3df89f[_0xcf23('0x56')]);_0x2a26ec[_0xcf23('0x58')]=_[_0xcf23('0x59')](_0x3df89f[_0xcf23('0x4c')],qs['fields'](_0x400e9b[_0xcf23('0x56')][_0xcf23('0x5a')]));_0x2a26ec[_0xcf23('0x58')]=_0x2a26ec[_0xcf23('0x58')]['length']?_0x2a26ec[_0xcf23('0x58')]:_0x3df89f['model'];if(!_0x400e9b[_0xcf23('0x56')][_0xcf23('0x5c')](_0xcf23('0xf6'))){_0x2a26ec['limit']=qs[_0xcf23('0x22')](_0x400e9b[_0xcf23('0x56')][_0xcf23('0x22')]);_0x2a26ec['offset']=qs[_0xcf23('0x20')](_0x400e9b[_0xcf23('0x56')][_0xcf23('0x20')]);}_0x2a26ec['order']=qs[_0xcf23('0x5d')](_0x400e9b[_0xcf23('0x56')][_0xcf23('0x5d')]);_0x2a26ec[_0xcf23('0x5e')]=qs['filters'](_['pick'](_0x400e9b[_0xcf23('0x56')],_0x3df89f['filters']));_0x2a26ec[_0xcf23('0x5e')][_0xcf23('0x71')]=_0x414f01['id'];if(_0x400e9b['query'][_0xcf23('0x60')]){_0x2a26ec[_0xcf23('0x5e')]=_[_0xcf23('0x61')](_0x2a26ec['where'],{'$or':_['map'](_0x2a26ec[_0xcf23('0x58')],function(_0xc66ab8){var _0x3586c0={};_0x3586c0[_0xc66ab8]={'$like':'%'+_0x400e9b[_0xcf23('0x56')][_0xcf23('0x60')]+'%'};return _0x3586c0;})});}_0x2a26ec=_[_0xcf23('0x61')]({},_0x2a26ec,_0x400e9b[_0xcf23('0x62')]);return db[_0xcf23('0xb9')]['count']({'where':_0x2a26ec[_0xcf23('0x5e')]})[_0xcf23('0x13')](function(_0x4f210c){_0x2cbb42['count']=_0x4f210c;if(_0x400e9b[_0xcf23('0x56')][_0xcf23('0x63')]){_0x2a26ec[_0xcf23('0x64')]=[{'model':db[_0xcf23('0x98')],'as':_0xcf23('0xf7'),'required':![]},{'model':db[_0xcf23('0xc5')],'as':_0xcf23('0xf8'),'attributes':[_0xcf23('0x2d'),_0xcf23('0xf9'),_0xcf23('0xfa')],'required':![]},{'model':db[_0xcf23('0xfb')],'as':_0xcf23('0xfc'),'attributes':['id',_0xcf23('0x2d'),_0xcf23('0xfd')],'where':_0x400e9b['query'][_0xcf23('0xfe')]?{'id':_0x400e9b[_0xcf23('0x56')][_0xcf23('0xfe')]}:undefined,'required':_0x400e9b[_0xcf23('0x56')][_0xcf23('0xfe')]?!![]:![]}];}return db[_0xcf23('0xb9')][_0xcf23('0xff')](_0x2a26ec);})['then'](function(_0x440d11){_0x2cbb42['rows']=_0x440d11;return _0x2cbb42;});}})['then'](respondWithFilteredResult(_0x57e8d8,_0x2a26ec))['catch'](handleError(_0x57e8d8,null));};exports[_0xcf23('0x30')]=function(_0x5041c2,_0x124aae){var _0x1da0ac=0x0;var _0x4869b4=0x0;var _0x571702=![];var _0x5c90b5;var _0x338828;return db[_0xcf23('0x52')]['find']({'where':{'id':_0x5041c2[_0xcf23('0x66')]['id']},'include':[{'model':db[_0xcf23('0xae')],'as':_0xcf23('0xae'),'include':[{'model':db[_0xcf23('0xae')],'as':'Intervals','attributes':['id',_0xcf23('0x33')]}]}]})[_0xcf23('0x13')](handleEntityNotFound(_0x124aae,null))[_0xcf23('0x13')](function(_0x4eeff1){if(_0x4eeff1){_0x5c90b5=_0x4eeff1;return _0x4eeff1['getProactiveActions']({'raw':!![]});}})['then'](function(_0x3c4650){if(_0x5c90b5){if(_0x3c4650){_0x338828=_0x3c4650;}}return require(_0xcf23('0x89'))['getLicense']();})[_0xcf23('0x13')](function(_0x3550c3){if(_0x3550c3){_0x4869b4=_0x3550c3[_0xcf23('0x100')];_0x571702=_0x3550c3[_0xcf23('0x101')];}})[_0xcf23('0x13')](function(){return db[_0xcf23('0xb9')][_0xcf23('0x23')]({'where':{'closed':![]}});})[_0xcf23('0x13')](function(_0x3540cb){_0x1da0ac=_0x3540cb;if(_0x4869b4&&_0x3540cb>_0x4869b4){return db[_0xcf23('0x102')][_0xcf23('0x74')]({'where':{'id':0x1}})[_0xcf23('0x13')](function(_0x5e4db4){if(_0x5e4db4){_0x5e4db4[_0xcf23('0x103')]('chatLicenseExceeded');}});}})[_0xcf23('0x13')](function(){if(!_0x5c90b5[_0xcf23('0xae')]||!_0x5c90b5[_0xcf23('0xae')][_0xcf23('0xaf')])return!![];return checkWebsiteIntervals(_0x5c90b5);})['then'](function(_0x4cd9df){var _0xb5c5fb=fs[_0xcf23('0xd5')](path[_0xcf23('0x86')](config[_0xcf23('0x87')],_0xcf23('0x104')),_0xcf23('0x105'));var _0x597631=new url[(_0xcf23('0x106'))](_0x5c90b5[_0xcf23('0x107')])[_0xcf23('0x108')];var _0x8d2516=_0xcf23('0x109');var _0x1db326=![];var _0x3c019f={'chatVersion':_0x8d2516,'chatWebsiteAddressOrigin':_0x597631,'remote':_0x5c90b5[_0xcf23('0x10a')],'query':querystring[_0xcf23('0x17')](_[_0xcf23('0x61')](_0x5c90b5[_0xcf23('0x3c')]({'plain':!![]}),{'customerIp':_0x5041c2[_0xcf23('0xb7')][_0xcf23('0x42')]||_0x5041c2[_0xcf23('0xb7')]['x-real-ip']||_0x5041c2[_0xcf23('0x10b')][_0xcf23('0x10c')]||_0x5041c2['ip'],'referer':_0x5041c2['headers'][_0xcf23('0x46')],'openedInteractions':_0x1da0ac,'maxInteractions':_0x4869b4,'virtual':_0x571702[_0xcf23('0x100')],'online':_0x4cd9df,'custom':_0x571702}))[_0xcf23('0x10d')](/'/g,'\x5c\x27')};_0x124aae[_0xcf23('0x2e')](ejs[_0xcf23('0xd7')](Mustache[_0xcf23('0xd7')](_0xb5c5fb,_0x3c019f),{'proactiveActions':_0x338828,'alignment':_0x5c90b5[_0xcf23('0x10e')],'verticalAlignment':_0x5c90b5[_0xcf23('0x10f')],'div_color':_0x5c90b5[_0xcf23('0xfd')],'labelText':_0x5c90b5['labelText'],'text_color':_0x5c90b5[_0xcf23('0x110')],'text_button_color':_0x5c90b5[_0xcf23('0x111')],'button_color':_0x5c90b5[_0xcf23('0x112')],'background_color':_0x5c90b5[_0xcf23('0x113')],'hideWhenOffline':_0x5c90b5[_0xcf23('0x114')],'intervalId':_0x5c90b5[_0xcf23('0x115')],'isDevelopment':_0x1db326,'chatVersion':_0x8d2516}));})[_0xcf23('0x1e')](handleError(_0x124aae,null));};exports[_0xcf23('0x116')]=function(_0x1f33b3,_0x4ffa53){var _0xa14219=_0x1f33b3[_0xcf23('0x66')]['id'];var _0x2cd8cc=_0x1f33b3[_0xcf23('0x6a')];var _0x32342a=0xc8;var _0x585be1=null;return db[_0xcf23('0x117')]['transaction']({'isolationLevel':db[_0xcf23('0x117')][_0xcf23('0x118')][_0xcf23('0x119')]['READ_COMMITTED']},function(_0x186122){return db[_0xcf23('0x52')]['findOne']({'where':{'id':_0xa14219},'transaction':_0x186122})[_0xcf23('0x13')](function(_0x4ca1af){if(_0x4ca1af){return db[_0xcf23('0xac')]['destroy']({'where':{'ChatWebsiteId':_0xa14219},'transaction':_0x186122})[_0xcf23('0x13')](function(){var _0x855ad0=_[_0xcf23('0x54')](_0x2cd8cc,function(_0x111510){_0x111510[_0xcf23('0x71')]=_0xa14219;return _0x111510;});return db[_0xcf23('0xac')]['bulkCreate'](_0x855ad0,{'transaction':_0x186122});});}else{_0x32342a=0x194;_0x585be1=[];}});})[_0xcf23('0x13')](function(){if(_0x32342a!==0x194){return db['ChatApplication'][_0xcf23('0x11a')]({'where':{'ChatWebsiteId':_0xa14219},'order':_0xcf23('0x11b')})[_0xcf23('0x13')](function(_0x5c5a45){_0x585be1=_0x5c5a45;});}})[_0xcf23('0x1e')](function(_0x18687a){_0x32342a=0x1f4;logger[_0xcf23('0x18')](_0x18687a[_0xcf23('0x11c')]);if(_0x18687a[_0xcf23('0x2d')]){delete _0x18687a[_0xcf23('0x2d')];}_0x585be1=_0x18687a;})['finally'](function(){if(_0x585be1===null){_0x4ffa53[_0xcf23('0x2c')](_0x32342a);}else{if(_0x32342a===0x1f4){_0x4ffa53[_0xcf23('0x1f')](_0x32342a)['send'](_0x585be1);}else{_0x4ffa53[_0xcf23('0x1f')](_0x32342a)[_0xcf23('0x26')](_0x585be1);}}});};exports[_0xcf23('0x11d')]=function(_0x3dca5f,_0x15a6d0){var _0x46d26e={};var _0xa53f98={};var _0x3f028e;var _0x42b084;return db[_0xcf23('0x52')][_0xcf23('0x74')]({'where':{'id':_0x3dca5f['params']['id']}})[_0xcf23('0x13')](handleEntityNotFound(_0x15a6d0,null))[_0xcf23('0x13')](function(_0x255a3e){if(_0x255a3e){_0x3f028e=_0x255a3e;_0xa53f98[_0xcf23('0x4c')]=_[_0xcf23('0x55')](db[_0xcf23('0xac')]['rawAttributes']);_0xa53f98[_0xcf23('0x56')]=_[_0xcf23('0x55')](_0x3dca5f['query']);_0xa53f98[_0xcf23('0x57')]=_[_0xcf23('0x59')](_0xa53f98[_0xcf23('0x4c')],_0xa53f98[_0xcf23('0x56')]);_0x46d26e['attributes']=_[_0xcf23('0x59')](_0xa53f98[_0xcf23('0x4c')],qs[_0xcf23('0x5a')](_0x3dca5f[_0xcf23('0x56')]['fields']));_0x46d26e['attributes']=_0x46d26e['attributes'][_0xcf23('0x5b')]?_0x46d26e[_0xcf23('0x58')]:_0xa53f98[_0xcf23('0x4c')];_0x46d26e[_0xcf23('0x75')]=qs[_0xcf23('0x5d')](_0x3dca5f['query'][_0xcf23('0x5d')]);_0x46d26e[_0xcf23('0x5e')]=qs['filters'](_[_0xcf23('0x5f')](_0x3dca5f['query'],_0xa53f98['filters']));if(_0x3dca5f[_0xcf23('0x56')]['filter']){_0x46d26e['where']=_['merge'](_0x46d26e[_0xcf23('0x5e')],{'$or':_[_0xcf23('0x54')](_0x46d26e[_0xcf23('0x58')],function(_0x497451){var _0x3440a1={};_0x3440a1[_0x497451]={'$like':'%'+_0x3dca5f['query'][_0xcf23('0x60')]+'%'};return _0x3440a1;})});}_0x46d26e=_[_0xcf23('0x61')]({},_0x46d26e,_0x3dca5f[_0xcf23('0x62')]);return _0x3f028e[_0xcf23('0x11d')](_0x46d26e);}})['then'](function(_0x2f7bae){if(_0x2f7bae){_0x42b084=_0x2f7bae[_0xcf23('0x5b')];if(!_0x3dca5f['query'][_0xcf23('0x5c')]('nolimit')){_0x46d26e[_0xcf23('0x22')]=qs['limit'](_0x3dca5f[_0xcf23('0x56')]['limit']);_0x46d26e['offset']=qs[_0xcf23('0x20')](_0x3dca5f['query'][_0xcf23('0x20')]);}return _0x3f028e[_0xcf23('0x11d')](_0x46d26e);}})[_0xcf23('0x13')](function(_0x37ec32){if(_0x37ec32){return _0x37ec32?{'count':_0x42b084,'rows':_0x37ec32}:null;}})[_0xcf23('0x13')](respondWithResult(_0x15a6d0,null))[_0xcf23('0x1e')](handleError(_0x15a6d0,null));};exports[_0xcf23('0x11e')]=function(_0x392481,_0x38621f){return db[_0xcf23('0x11f')]['find']({'where':{'id':_0x392481[_0xcf23('0x66')]['id']}})[_0xcf23('0x13')](handleEntityNotFound(_0x38621f,null))[_0xcf23('0x13')](function(_0x2b1c71){if(_0x2b1c71){return _0x2b1c71[_0xcf23('0x11e')](_0x392481[_0xcf23('0x6a')][_0xcf23('0x77')],_[_0xcf23('0xf4')](_0x392481[_0xcf23('0x6a')],[_0xcf23('0x77'),'id'])||{});}})[_0xcf23('0x13')](respondWithResult(_0x38621f,null))['catch'](handleError(_0x38621f,null));};exports[_0xcf23('0x120')]=function(_0x490d32,_0x3b7089){var _0x1e6e77={};var _0x891da0={};var _0x1cf46e;var _0x301f7d;return db[_0xcf23('0x52')][_0xcf23('0x74')]({'where':{'id':_0x490d32[_0xcf23('0x66')]['id']}})[_0xcf23('0x13')](handleEntityNotFound(_0x3b7089,null))['then'](function(_0x24095e){if(_0x24095e){_0x1cf46e=_0x24095e;_0x891da0[_0xcf23('0x4c')]=_[_0xcf23('0x55')](db[_0xcf23('0x121')][_0xcf23('0x68')]);_0x891da0['query']=_[_0xcf23('0x55')](_0x490d32[_0xcf23('0x56')]);_0x891da0[_0xcf23('0x57')]=_['intersection'](_0x891da0[_0xcf23('0x4c')],_0x891da0[_0xcf23('0x56')]);_0x1e6e77[_0xcf23('0x58')]=_[_0xcf23('0x59')](_0x891da0[_0xcf23('0x4c')],qs['fields'](_0x490d32['query'][_0xcf23('0x5a')]));_0x1e6e77[_0xcf23('0x58')]=_0x1e6e77['attributes'][_0xcf23('0x5b')]?_0x1e6e77[_0xcf23('0x58')]:_0x891da0[_0xcf23('0x4c')];_0x1e6e77[_0xcf23('0x75')]=qs[_0xcf23('0x5d')](_0x490d32[_0xcf23('0x56')]['sort']);_0x1e6e77[_0xcf23('0x5e')]=qs[_0xcf23('0x57')](_['pick'](_0x490d32[_0xcf23('0x56')],_0x891da0[_0xcf23('0x57')]));if(_0x490d32[_0xcf23('0x56')][_0xcf23('0x60')]){_0x1e6e77[_0xcf23('0x5e')]=_[_0xcf23('0x61')](_0x1e6e77['where'],{'$or':_[_0xcf23('0x54')](_0x1e6e77[_0xcf23('0x58')],function(_0xbeed4){var _0x2b0cea={};_0x2b0cea[_0xbeed4]={'$like':'%'+_0x490d32[_0xcf23('0x56')]['filter']+'%'};return _0x2b0cea;})});}_0x1e6e77=_[_0xcf23('0x61')]({},_0x1e6e77,_0x490d32[_0xcf23('0x62')]);return _0x1cf46e[_0xcf23('0x120')](_0x1e6e77);}})[_0xcf23('0x13')](function(_0x24dbde){if(_0x24dbde){_0x301f7d=_0x24dbde[_0xcf23('0x5b')];if(!_0x490d32[_0xcf23('0x56')][_0xcf23('0x5c')]('nolimit')){_0x1e6e77[_0xcf23('0x22')]=qs[_0xcf23('0x22')](_0x490d32[_0xcf23('0x56')]['limit']);_0x1e6e77['offset']=qs[_0xcf23('0x20')](_0x490d32['query'][_0xcf23('0x20')]);}return _0x1cf46e[_0xcf23('0x120')](_0x1e6e77);}})['then'](function(_0x4e9492){if(_0x4e9492){return _0x4e9492?{'count':_0x301f7d,'rows':_0x4e9492}:null;}})['then'](respondWithResult(_0x3b7089,null))[_0xcf23('0x1e')](handleError(_0x3b7089,null));};exports[_0xcf23('0x122')]=function(_0x2e3c79,_0x53ea08){var _0x551d68=_0x2e3c79[_0xcf23('0x56')][_0xcf23('0x123')]===_0xcf23('0x124')?_0xcf23('0x125'):_0xcf23('0x126');return db[_0xcf23('0x52')][_0xcf23('0x6e')]({'attributes':['id',_0x551d68],'where':{'id':_0x2e3c79[_0xcf23('0x66')]['id']}})[_0xcf23('0x13')](handleEntityNotFound(_0x53ea08,null))[_0xcf23('0x13')](function(_0x4e5e1d){if(_0x4e5e1d){var _0x124848=_0x4e5e1d[_0x551d68];var _0x3fc799=_0x124848&&_0x124848[_0xcf23('0x127')]?_0x124848[_0xcf23('0x127')]:[];_0x53ea08[_0xcf23('0x2e')]({'fromKey':_[_0xcf23('0x8b')](_0x124848[_0xcf23('0x128')])?undefined:_0x124848[_0xcf23('0x128')],'count':_0x3fc799[_0xcf23('0x5b')],'rows':_0x3fc799});}})[_0xcf23('0x1e')](handleError(_0x53ea08,null));};exports[_0xcf23('0x129')]=function(_0x3a5988,_0x29f613){var _0x2e3b11={'raw':![],'where':{}};var _0x571a47={};var _0x4ab642={'count':0x0,'rows':[]};return db['ChatWebsite'][_0xcf23('0x74')]({'where':{'id':_0x3a5988[_0xcf23('0x66')]['id']}})[_0xcf23('0x13')](handleEntityNotFound(_0x29f613,null))[_0xcf23('0x13')](function(_0xf3c587){if(_0xf3c587){_0x571a47[_0xcf23('0x4c')]=_['keys'](db['ChatOfflineMessage']['rawAttributes']);_0x571a47[_0xcf23('0x56')]=_[_0xcf23('0x55')](_0x3a5988[_0xcf23('0x56')]);_0x571a47[_0xcf23('0x57')]=_[_0xcf23('0x59')](_0x571a47[_0xcf23('0x4c')],_0x571a47[_0xcf23('0x56')]);_0x2e3b11['attributes']=_[_0xcf23('0x59')](_0x571a47['model'],qs[_0xcf23('0x5a')](_0x3a5988['query'][_0xcf23('0x5a')]));_0x2e3b11[_0xcf23('0x58')]=_0x2e3b11[_0xcf23('0x58')][_0xcf23('0x5b')]?_0x2e3b11[_0xcf23('0x58')]:_0x571a47[_0xcf23('0x4c')];if(!_0x3a5988[_0xcf23('0x56')][_0xcf23('0x5c')]('nolimit')){_0x2e3b11[_0xcf23('0x22')]=qs[_0xcf23('0x22')](_0x3a5988[_0xcf23('0x56')]['limit']);_0x2e3b11['offset']=qs[_0xcf23('0x20')](_0x3a5988[_0xcf23('0x56')]['offset']);}_0x2e3b11[_0xcf23('0x75')]=qs[_0xcf23('0x5d')](_0x3a5988[_0xcf23('0x56')][_0xcf23('0x5d')]);_0x2e3b11['where']=qs[_0xcf23('0x57')](_[_0xcf23('0x5f')](_0x3a5988[_0xcf23('0x56')],_0x571a47[_0xcf23('0x57')]));_0x2e3b11['where'][_0xcf23('0x71')]=_0xf3c587['id'];if(_0x3a5988[_0xcf23('0x56')][_0xcf23('0x60')]){_0x2e3b11[_0xcf23('0x5e')]=_['merge'](_0x2e3b11[_0xcf23('0x5e')],{'$or':_[_0xcf23('0x54')](_0x2e3b11[_0xcf23('0x58')],function(_0x17dd33){var _0x299ee7={};_0x299ee7[_0x17dd33]={'$like':'%'+_0x3a5988[_0xcf23('0x56')][_0xcf23('0x60')]+'%'};return _0x299ee7;})});}_0x2e3b11=_[_0xcf23('0x61')]({},_0x2e3b11,_0x3a5988[_0xcf23('0x62')]);return db[_0xcf23('0xda')][_0xcf23('0x23')]({'where':_0x2e3b11[_0xcf23('0x5e')]})[_0xcf23('0x13')](function(_0x5ba2f3){_0x4ab642[_0xcf23('0x23')]=_0x5ba2f3;if(_0x3a5988[_0xcf23('0x56')]['includeAll']){_0x2e3b11[_0xcf23('0x64')]=[{'all':!![]}];}else{_0x2e3b11[_0xcf23('0x64')]=[{'model':db[_0xcf23('0x98')],'as':_0xcf23('0xf7'),'required':![]},{'model':db[_0xcf23('0x12a')],'as':_0xcf23('0x12b'),'required':![]}];}return db['ChatOfflineMessage']['findAll'](_0x2e3b11);})[_0xcf23('0x13')](function(_0x22ef27){_0x4ab642[_0xcf23('0x65')]=_0x22ef27;return _0x4ab642;});}})[_0xcf23('0x13')](respondWithFilteredResult(_0x29f613,_0x2e3b11))[_0xcf23('0x1e')](handleError(_0x29f613,null));};exports[_0xcf23('0x12c')]=function(_0x1d9a15,_0xc0a573){return db[_0xcf23('0x52')]['find']({'where':{'id':_0x1d9a15[_0xcf23('0x66')]['id']}})[_0xcf23('0x13')](handleEntityNotFound(_0xc0a573,null))['then'](function(_0x481370){if(_0x481370){return _0x481370[_0xcf23('0x12c')](_0x1d9a15['body'][_0xcf23('0x77')],_[_0xcf23('0xf4')](_0x1d9a15[_0xcf23('0x6a')],[_0xcf23('0x77'),'id'])||{})[_0xcf23('0xb1')](function(_0x2ff090){for(var _0x1238b6=0x0;_0x1238b6<_0x1d9a15['body']['ids'][_0xcf23('0x5b')];_0x1238b6+=0x1){socket['emit']('userChatWebsite:save',{'UserId':Number(_0x1d9a15[_0xcf23('0x6a')][_0xcf23('0x77')][_0x1238b6]),'ChatWebsiteId':Number(_0x1d9a15[_0xcf23('0x66')]['id'])});}return _0x2ff090;});}})[_0xcf23('0x13')](respondWithResult(_0xc0a573,null))[_0xcf23('0x1e')](handleError(_0xc0a573,null));};exports['removeAgents']=function(_0x59a725,_0x4b8a4a){return db[_0xcf23('0x52')][_0xcf23('0x6e')]({'where':{'id':_0x59a725[_0xcf23('0x66')]['id']}})[_0xcf23('0x13')](handleEntityNotFound(_0x4b8a4a,null))[_0xcf23('0x13')](function(_0x838eb2){if(_0x838eb2){return _0x838eb2[_0xcf23('0x12d')](_0x59a725[_0xcf23('0x56')]['ids'])[_0xcf23('0x13')](function(){if(_[_0xcf23('0x12e')](_0x59a725[_0xcf23('0x56')]['ids'])){for(var _0x2c4e67=0x0;_0x2c4e67<_0x59a725[_0xcf23('0x56')]['ids']['length'];_0x2c4e67+=0x1){socket[_0xcf23('0x12f')](_0xcf23('0x130'),{'UserId':Number(_0x59a725[_0xcf23('0x56')][_0xcf23('0x77')][_0x2c4e67]),'ChatWebsiteId':Number(_0x59a725[_0xcf23('0x66')]['id'])});}}else{socket['emit']('userChatWebsite:remove',{'UserId':Number(_0x59a725['query']['ids']),'ChatWebsiteId':Number(_0x59a725[_0xcf23('0x66')]['id'])});}});}})[_0xcf23('0x13')](respondWithStatusCode(_0x4b8a4a,null))[_0xcf23('0x1e')](handleError(_0x4b8a4a,null));};exports[_0xcf23('0x131')]=function(_0x533d43,_0x4e0084){var _0x1f541f={};var _0x1736ea={};var _0x481ee5;var _0xc8a820;return db['ChatWebsite'][_0xcf23('0x74')]({'where':{'id':_0x533d43[_0xcf23('0x66')]['id']}})[_0xcf23('0x13')](handleEntityNotFound(_0x4e0084,null))[_0xcf23('0x13')](function(_0x242401){if(_0x242401){_0x481ee5=_0x242401;_0x1736ea[_0xcf23('0x4c')]=_[_0xcf23('0x55')](db['User'][_0xcf23('0x68')]);_0x1736ea[_0xcf23('0x56')]=_[_0xcf23('0x55')](_0x533d43['query']);_0x1736ea[_0xcf23('0x57')]=_[_0xcf23('0x59')](_0x1736ea[_0xcf23('0x4c')],_0x1736ea[_0xcf23('0x56')]);_0x1f541f[_0xcf23('0x58')]=_[_0xcf23('0x59')](_0x1736ea['model'],qs['fields'](_0x533d43['query'][_0xcf23('0x5a')]));_0x1f541f[_0xcf23('0x58')]=_0x1f541f[_0xcf23('0x58')][_0xcf23('0x5b')]?_0x1f541f[_0xcf23('0x58')]:_0x1736ea[_0xcf23('0x4c')];_0x1f541f[_0xcf23('0x75')]=qs[_0xcf23('0x5d')](_0x533d43[_0xcf23('0x56')][_0xcf23('0x5d')]);_0x1f541f[_0xcf23('0x5e')]=qs[_0xcf23('0x57')](_[_0xcf23('0x5f')](_0x533d43[_0xcf23('0x56')],_0x1736ea[_0xcf23('0x57')]));if(_0x533d43[_0xcf23('0x56')][_0xcf23('0x60')]){_0x1f541f[_0xcf23('0x5e')]=_['merge'](_0x1f541f[_0xcf23('0x5e')],{'$or':_[_0xcf23('0x54')](_0x1f541f[_0xcf23('0x58')],function(_0x22bc85){var _0xd8f38b={};_0xd8f38b[_0x22bc85]={'$like':'%'+_0x533d43[_0xcf23('0x56')][_0xcf23('0x60')]+'%'};return _0xd8f38b;})});}_0x1f541f=_[_0xcf23('0x61')]({},_0x1f541f,_0x533d43[_0xcf23('0x62')]);return _0x481ee5[_0xcf23('0x131')](_0x1f541f);}})[_0xcf23('0x13')](function(_0x16b16f){if(_0x16b16f){_0xc8a820=_0x16b16f[_0xcf23('0x5b')];if(!_0x533d43[_0xcf23('0x56')][_0xcf23('0x5c')](_0xcf23('0xf6'))){_0x1f541f['limit']=qs['limit'](_0x533d43['query']['limit']);_0x1f541f['offset']=qs[_0xcf23('0x20')](_0x533d43[_0xcf23('0x56')]['offset']);}return _0x481ee5[_0xcf23('0x131')](_0x1f541f);}})['then'](function(_0x4fdaaf){if(_0x4fdaaf){return _0x4fdaaf?{'count':_0xc8a820,'rows':_0x4fdaaf}:null;}})[_0xcf23('0x13')](respondWithResult(_0x4e0084,null))['catch'](handleError(_0x4e0084,null));}; \ No newline at end of file +var _0x4a86=['json','limit','undefined','count','offset','set','Content-Range','update','get','UserProfileResource','destroy','stack','name','send','Command','getSnippet','timezone','format','interval','iftime\x20%s','indexOf','true','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','OFFLINE','No\x20timezone','inspect','Intervals','all','some','user-agent-parser','setUA','user-agent','customerIp','cf-connecting-ip','x-forwarded-for','first','split','firstName','x-real-port','browser','version','%s\x20%s','unknown','model','device','vendor','%s\x20%s\x20%s','type','index','Pause','map','ChatWebsite','rawAttributes','fieldName','key','keys','filters','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','VIRTUAL','merge','options','include','rows','show','params','mandatoryDispositionPause','includeAll','find','create','user','ChatWebsites','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','ChatWebsiteId','Disposition','findOne','findAll','removeDispositions','addAnswer','CannedAnswer','pick','removeAnswers','addLogo','sitepic','filename','addAvatar','agentAvatar','customerAvatar','file','addSystemAvatar','systemAvatar','getLogo','server/files/images/logos/default_logo.svg','getLicense','isNil','existsSync','join','root','server/files/images/logos/','download','getAvatar','server/files/images/avatars/default_avatar.png','server/files/images/avatars/','getCustomerAvatar','showCustomerAvatar','getSystemAvatar','notify','chat','CmContact','Sequelize','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','from','from\x20is\x20mandatory','ValidationError','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','List','Contacts','DESC','ChatApplication','Applications','Interval','spread','account','list','applications','orderBy','priority','asc','contact','headers','threadId','ChatInteraction','externalUrl','interaction','lastName','messageId','created','autoclose','close','unmanaged','*,*,*,*','ChatMessage','AttachmentId','UserId','User','agent','waitForTheAssignedAgent','forcedOwnership','queueId','ChatQueue','unshift','queue','waitForTheAssignedQueue','Start','startRouting','EventManager','offline','mapKeyOffline','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','MailAccount','readFileSync','server/files/templates/chatOfflineMessage.ejs','utf8','toPairs','offlineMessageBody','ChatOfflineMessage','fromString','mimetype','server','files','offline-chat','openNewInteraction','transaction','bulkCreate','Smtp','CloudProvider','forwardOffline','forwardOfflineAddress','SendMail','sendMail','\x22%s\x22\x20<%s>','email','offlineMessageSubject','MailAccountId','originalname','subjectOffline','mapValues','Chat','NotifyMailAccount','notifyMail','attachments','remove','Could\x20not\x20remove\x20attachment\x20file','addInteraction','ids','getInteractions','Contact','fullname','internal','color','tag','virtual','custom','License','increment','chatLicenseExceeded','server/files/chat/iframe.ejs','URL','address','origin','3.5.0','remote','x-real-ip','referer','replace','render','alignment','verticalAlignment','textColor','textButtonColor','backgroundColor','hideWhenOffline','IntervalId','addApplications','sequelize','ISOLATION_LEVELS','READ_COMMITTED','finally','getApplications','addProactiveActions','chatProactiveAction','ChatProactiveAction','getProactiveActions','getFields','online','false','offlineForm','items','fromKey','getOfflineMessages','Attachment','addAgents','emit','userChatWebsite:save','removeAgents','userChatWebsite:remove','getAgents','util','path','ejs','querystring','html-to-text','ioredis','jayson/promise','url','../../components/parsers/qs','../../config/environment','../../errors/api','handleError','redis','defaults','localhost','socket.io-emitter','./chatWebsite.socket','register','client','http','then','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','sendStatus','status','end'];(function(_0x53ccf2,_0x13cb67){var _0x5a2964=function(_0x3b0514){while(--_0x3b0514){_0x53ccf2['push'](_0x53ccf2['shift']());}};_0x5a2964(++_0x13cb67);}(_0x4a86,0x10f));var _0x64a8=function(_0x1f1db2,_0x230a06){_0x1f1db2=_0x1f1db2-0x0;var _0x1380ee=_0x4a86[_0x1f1db2];return _0x1380ee;};'use strict';var Mustache=require('mustache');var util=require(_0x64a8('0x0'));var path=require(_0x64a8('0x1'));var ejs=require(_0x64a8('0x2'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var querystring=require(_0x64a8('0x3'));var htmlToText=require(_0x64a8('0x4'));var Redis=require(_0x64a8('0x5'));var jayson=require(_0x64a8('0x6'));var url=require(_0x64a8('0x7'));var qs=require(_0x64a8('0x8'));var logger=require('../../config/logger')('api');var config=require(_0x64a8('0x9'));var APIOutOfIntervalError=require(_0x64a8('0xa'))['APIOutOfIntervalError'];var APINotFoundError=require('../../errors/api')['APINotFoundError'];var APIHandleError=require(_0x64a8('0xa'))[_0x64a8('0xb')];var db=require('../../mysqldb')['db'];config[_0x64a8('0xc')]=_[_0x64a8('0xd')](config[_0x64a8('0xc')],{'host':_0x64a8('0xe'),'port':0x18eb});var socket=require(_0x64a8('0xf'))(new Redis(config[_0x64a8('0xc')]));require(_0x64a8('0x10'))[_0x64a8('0x11')](socket);var client=jayson['client']['http']({'port':0x232c});var client9002=jayson[_0x64a8('0x12')][_0x64a8('0x13')]({'port':0x232a});var client9003=jayson[_0x64a8('0x12')][_0x64a8('0x13')]({'port':0x232b});var client9001=jayson['client'][_0x64a8('0x13')]({'port':0x2329});function respondWithRpcPromise(_0x3ab915,_0x41b76a,_0x1c67af,_0x192b87){return new Promise(function(_0xa98fc4,_0xf9638a){var _0x850efb=_0x192b87||client;return _0x850efb['request'](_0x3ab915,_0x1c67af)[_0x64a8('0x14')](function(_0x5cd03f){logger[_0x64a8('0x15')](_0x64a8('0x16'),_0x41b76a,_0x64a8('0x17'));logger[_0x64a8('0x18')]('ChatWebsite,\x20%s,\x20%s,\x20%s',_0x41b76a,_0x64a8('0x17'),JSON[_0x64a8('0x19')](_0x5cd03f));if(_0x5cd03f[_0x64a8('0x1a')]){if(_0x5cd03f[_0x64a8('0x1a')][_0x64a8('0x1b')]===0x1f4){logger[_0x64a8('0x1a')](_0x64a8('0x16'),_0x41b76a,_0x5cd03f[_0x64a8('0x1a')][_0x64a8('0x1c')]);return _0xf9638a(_0x5cd03f[_0x64a8('0x1a')][_0x64a8('0x1c')]);}logger['error'](_0x64a8('0x16'),_0x41b76a,_0x5cd03f[_0x64a8('0x1a')][_0x64a8('0x1c')]);return _0xa98fc4(_0x5cd03f[_0x64a8('0x1a')][_0x64a8('0x1c')]);}else{logger[_0x64a8('0x15')](_0x64a8('0x16'),_0x41b76a,_0x64a8('0x17'));_0xa98fc4(_0x5cd03f[_0x64a8('0x1d')]['message']);}})[_0x64a8('0x1e')](function(_0x36d669){logger[_0x64a8('0x1a')]('ChatWebsite,\x20%s,\x20%s',_0x41b76a,_0x36d669);_0xf9638a(_0x36d669);});});}function respondWithStatusCode(_0x47648d,_0x548789){_0x548789=_0x548789||0xcc;return function(_0x55ced0){if(_0x55ced0){return _0x47648d[_0x64a8('0x1f')](_0x548789);}return _0x47648d[_0x64a8('0x20')](_0x548789)[_0x64a8('0x21')]();};}function respondWithResult(_0x29d2dc,_0x5935ba){_0x5935ba=_0x5935ba||0xc8;return function(_0x19cffa){if(_0x19cffa){return _0x29d2dc[_0x64a8('0x20')](_0x5935ba)[_0x64a8('0x22')](_0x19cffa);}};}function respondWithFilteredResult(_0x4516ec,_0xe1cb89){return function(_0x38cac9){if(_0x38cac9){var _0x4ebe6d=typeof _0xe1cb89['offset']==='undefined'&&typeof _0xe1cb89[_0x64a8('0x23')]===_0x64a8('0x24');var _0x3dcc98=_0x38cac9[_0x64a8('0x25')];var _0x33aac5=_0x4ebe6d?0x0:_0xe1cb89[_0x64a8('0x26')];var _0x3fdefc=_0x4ebe6d?_0x38cac9['count']:_0xe1cb89[_0x64a8('0x26')]+_0xe1cb89[_0x64a8('0x23')];var _0x27c992;if(_0x3fdefc>=_0x3dcc98){_0x3fdefc=_0x3dcc98;_0x27c992=0xc8;}else{_0x27c992=0xce;}_0x4516ec[_0x64a8('0x20')](_0x27c992);return _0x4516ec[_0x64a8('0x27')](_0x64a8('0x28'),_0x33aac5+'-'+_0x3fdefc+'/'+_0x3dcc98)[_0x64a8('0x22')](_0x38cac9);}return null;};}function saveUpdates(_0x175462){return function(_0x253d4c){if(_0x253d4c){return _0x253d4c[_0x64a8('0x29')](_0x175462)[_0x64a8('0x14')](function(_0x565e28){return _0x565e28;});}return null;};}function removeEntity(_0x2ea0ff){return function(_0x351be7){if(_0x351be7){return _0x351be7['destroy']()[_0x64a8('0x14')](function(){var _0x4ecd6a=_0x351be7[_0x64a8('0x2a')]({'plain':!![]});var _0x36edb1='ChatWebsites';return db[_0x64a8('0x2b')][_0x64a8('0x2c')]({'where':{'type':_0x36edb1,'resourceId':_0x4ecd6a['id']}})['then'](function(){return _0x351be7;});})[_0x64a8('0x14')](function(){_0x2ea0ff[_0x64a8('0x20')](0xcc)['end']();});}};}function handleEntityNotFound(_0x41fe64){return function(_0x49efd5){if(!_0x49efd5){_0x41fe64[_0x64a8('0x1f')](0x194);}return _0x49efd5;};}function handleError(_0x325078,_0x561817){_0x561817=_0x561817||0x1f4;return function(_0x174773){logger[_0x64a8('0x1a')](_0x174773[_0x64a8('0x2d')]);if(_0x174773[_0x64a8('0x2e')]){delete _0x174773['name'];}_0x325078[_0x64a8('0x20')](_0x561817)[_0x64a8('0x2f')](_0x174773);};}function iftimePromise(_0xf5d27f,_0x362e41){return respondWithRpcPromise(_0x64a8('0x30'),_0x64a8('0x31'),{'command':_0x362e41[_0x64a8('0x32')]?util[_0x64a8('0x33')]('iftime\x20%s,%s',_0xf5d27f[_0x64a8('0x34')],_0x362e41['timezone']):util[_0x64a8('0x33')](_0x64a8('0x35'),_0xf5d27f[_0x64a8('0x34')])},client9002)[_0x64a8('0x14')](function(_0x1e05cb){var _0x58bdd0=_0x1e05cb&&_0x1e05cb[_0x64a8('0x36')](_0x64a8('0x37'))>=0x0?!![]:![];logger[_0x64a8('0x15')](_0x64a8('0x38'),_0x362e41['id'],_0xf5d27f['id'],_0xf5d27f[_0x64a8('0x34')],_0x58bdd0?'ONLINE':_0x64a8('0x39'),_0x362e41[_0x64a8('0x32')]?_0x362e41['timezone']:_0x64a8('0x3a'));return _0x58bdd0;})[_0x64a8('0x1e')](function(_0x2d7547){logger[_0x64a8('0x1a')]('[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)',_0x362e41['id'],_0xf5d27f['id'],_0xf5d27f[_0x64a8('0x34')],util[_0x64a8('0x3b')](_0x2d7547,{'showHidden':![],'depth':null}),_0x362e41[_0x64a8('0x32')]?_0x362e41['timezone']:'No\x20timezone');return![];});}function checkWebsiteIntervals(_0x4a147c){var _0x3a83fa=_['map'](_0x4a147c['Interval'][_0x64a8('0x3c')],function(_0x20a0bd){var _0x3a5fc3=_0x20a0bd[_0x64a8('0x2a')]({'plain':!![]});return iftimePromise(_0x3a5fc3,_0x4a147c);});return Promise[_0x64a8('0x3d')](_0x3a83fa)[_0x64a8('0x14')](function(_0x17fb3d){return _[_0x64a8('0x3e')](_0x17fb3d);});}function createInteractionObject(_0x10e028,_0x3d06b3,_0x53877b,_0x267a01){var _0x140734=require(_0x64a8('0x3f'));var _0x2699ee=new _0x140734();var _0x1c84a4=_0x2699ee[_0x64a8('0x40')](_0x53877b[_0x64a8('0x41')])['getResult']();var _0x1c964f=_0x3d06b3[_0x64a8('0x42')];if(_0x53877b[_0x64a8('0x43')]){_0x1c964f=_0x53877b[_0x64a8('0x43')];}else if(_0x53877b[_0x64a8('0x44')]){_0x1c964f=_[_0x64a8('0x45')](_0x53877b[_0x64a8('0x44')][_0x64a8('0x46')](','));}return{'ContactId':_0x267a01['id'],'ChatWebsiteId':_0x10e028,'from':(_0x267a01[_0x64a8('0x47')]||'')+'\x20'+(_0x267a01['lastName']||''),'customerIp':_0x1c964f,'customerPort':_0x53877b[_0x64a8('0x48')]?_0x53877b[_0x64a8('0x48')]:null,'referer':_0x3d06b3['referer'],'browserName':_0x1c84a4['browser']['name']&&_0x1c84a4[_0x64a8('0x49')][_0x64a8('0x4a')]?util['format'](_0x64a8('0x4b'),_0x1c84a4[_0x64a8('0x49')][_0x64a8('0x2e')],_0x1c84a4['browser'][_0x64a8('0x4a')]):_0x64a8('0x4c'),'browserVersion':_0x1c84a4[_0x64a8('0x49')][_0x64a8('0x4a')]||_0x64a8('0x4c'),'osName':util['format']('%s\x20%s',_0x1c84a4['os']['name'],_0x1c84a4['os'][_0x64a8('0x4a')]),'osVersion':_0x1c84a4['os'][_0x64a8('0x4a')],'deviceModel':_0x1c84a4['device'][_0x64a8('0x4d')]&&_0x1c84a4[_0x64a8('0x4e')][_0x64a8('0x4f')]?util[_0x64a8('0x33')](_0x64a8('0x50'),_0x1c84a4[_0x64a8('0x4e')][_0x64a8('0x4d')],_0x1c84a4['device']['vendor'],_0x1c84a4[_0x64a8('0x4e')][_0x64a8('0x51')]):null,'deviceVendor':_0x1c84a4['device'][_0x64a8('0x4f')],'deviceType':_0x1c84a4[_0x64a8('0x4e')][_0x64a8('0x51')],'formData':JSON[_0x64a8('0x19')](_0x3d06b3)};}exports[_0x64a8('0x52')]=function(_0x16d212,_0x2f8827){var _0x10e1ea={'include':[{'model':db[_0x64a8('0x53')],'as':'mandatoryDispositionPause'}]},_0x5e402c={},_0x4348cc={'count':0x0,'rows':[]};var _0x276ac5=_[_0x64a8('0x54')](db[_0x64a8('0x55')][_0x64a8('0x56')],function(_0x4e8c29){return{'name':_0x4e8c29[_0x64a8('0x57')],'type':_0x4e8c29['type'][_0x64a8('0x58')]};});_0x5e402c[_0x64a8('0x4d')]=_['map'](_0x276ac5,_0x64a8('0x2e'));_0x5e402c['query']=_[_0x64a8('0x59')](_0x16d212['query']);_0x5e402c[_0x64a8('0x5a')]=_['intersection'](_0x5e402c[_0x64a8('0x4d')],_0x5e402c[_0x64a8('0x5b')]);_0x10e1ea[_0x64a8('0x5c')]=_[_0x64a8('0x5d')](_0x5e402c[_0x64a8('0x4d')],qs[_0x64a8('0x5e')](_0x16d212[_0x64a8('0x5b')]['fields']));_0x10e1ea[_0x64a8('0x5c')]=_0x10e1ea[_0x64a8('0x5c')][_0x64a8('0x5f')]?_0x10e1ea['attributes']:_0x5e402c[_0x64a8('0x4d')];if(!_0x16d212[_0x64a8('0x5b')][_0x64a8('0x60')](_0x64a8('0x61'))){_0x10e1ea[_0x64a8('0x23')]=qs[_0x64a8('0x23')](_0x16d212[_0x64a8('0x5b')][_0x64a8('0x23')]);_0x10e1ea[_0x64a8('0x26')]=qs['offset'](_0x16d212[_0x64a8('0x5b')][_0x64a8('0x26')]);}_0x10e1ea[_0x64a8('0x62')]=qs[_0x64a8('0x63')](_0x16d212['query']['sort']);_0x10e1ea[_0x64a8('0x64')]=qs[_0x64a8('0x5a')](_['pick'](_0x16d212['query'],_0x5e402c['filters']),_0x276ac5);if(_0x16d212['query'][_0x64a8('0x65')]){_0x10e1ea[_0x64a8('0x64')]=_['merge'](_0x10e1ea[_0x64a8('0x64')],{'$or':_[_0x64a8('0x54')](_0x276ac5,function(_0x2cfd31){if(_0x2cfd31['type']!==_0x64a8('0x66')){var _0x4b7b50={};_0x4b7b50[_0x2cfd31[_0x64a8('0x2e')]]={'$like':'%'+_0x16d212['query'][_0x64a8('0x65')]+'%'};return _0x4b7b50;}})});}_0x10e1ea=_[_0x64a8('0x67')]({},_0x10e1ea,_0x16d212[_0x64a8('0x68')]);var _0x54c794={'where':_0x10e1ea[_0x64a8('0x64')]};return db['ChatWebsite'][_0x64a8('0x25')](_0x54c794)[_0x64a8('0x14')](function(_0x1149fa){_0x4348cc[_0x64a8('0x25')]=_0x1149fa;if(_0x16d212[_0x64a8('0x5b')]['includeAll']){_0x10e1ea[_0x64a8('0x69')]=[{'all':!![]}];}return db[_0x64a8('0x55')]['findAll'](_0x10e1ea);})[_0x64a8('0x14')](function(_0xc015ad){_0x4348cc[_0x64a8('0x6a')]=_0xc015ad;return _0x4348cc;})[_0x64a8('0x14')](respondWithFilteredResult(_0x2f8827,_0x10e1ea))[_0x64a8('0x1e')](handleError(_0x2f8827,null));};exports[_0x64a8('0x6b')]=function(_0x319a0c,_0x439932){var _0x50f8d5={'raw':![],'where':{'id':_0x319a0c[_0x64a8('0x6c')]['id']},'include':[{'model':db[_0x64a8('0x53')],'as':_0x64a8('0x6d')}]},_0x255381={};_0x255381['model']=_[_0x64a8('0x59')](db['ChatWebsite'][_0x64a8('0x56')]);_0x255381['query']=_[_0x64a8('0x59')](_0x319a0c[_0x64a8('0x5b')]);_0x255381[_0x64a8('0x5a')]=_['intersection'](_0x255381[_0x64a8('0x4d')],_0x255381[_0x64a8('0x5b')]);_0x50f8d5['attributes']=_[_0x64a8('0x5d')](_0x255381['model'],qs[_0x64a8('0x5e')](_0x319a0c['query']['fields']));_0x50f8d5[_0x64a8('0x5c')]=_0x50f8d5['attributes'][_0x64a8('0x5f')]?_0x50f8d5[_0x64a8('0x5c')]:_0x255381['model'];if(_0x319a0c[_0x64a8('0x5b')][_0x64a8('0x6e')]){_0x50f8d5[_0x64a8('0x69')]=[{'all':!![]}];}_0x50f8d5=_['merge']({},_0x50f8d5,_0x319a0c[_0x64a8('0x68')]);return db[_0x64a8('0x55')][_0x64a8('0x6f')](_0x50f8d5)['then'](handleEntityNotFound(_0x439932,null))[_0x64a8('0x14')](respondWithResult(_0x439932,null))[_0x64a8('0x1e')](handleError(_0x439932,null));};exports[_0x64a8('0x70')]=function(_0x5c8001,_0x256275){return db[_0x64a8('0x55')][_0x64a8('0x70')](_0x5c8001['body'],{})[_0x64a8('0x14')](function(_0x469161){var _0xe3c90a=_0x5c8001[_0x64a8('0x71')][_0x64a8('0x2a')]({'plain':!![]});if(!_0xe3c90a)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xe3c90a['role']===_0x64a8('0x71')){var _0x3f4ce7=_0x469161['get']({'plain':!![]});var _0x47679f=_0x64a8('0x72');return db[_0x64a8('0x73')][_0x64a8('0x6f')]({'where':{'name':_0x47679f,'userProfileId':_0xe3c90a[_0x64a8('0x74')]},'raw':!![]})[_0x64a8('0x14')](function(_0x8f9530){if(_0x8f9530&&_0x8f9530[_0x64a8('0x75')]===0x0){return db['UserProfileResource'][_0x64a8('0x70')]({'name':_0x3f4ce7[_0x64a8('0x2e')],'resourceId':_0x3f4ce7['id'],'type':_0x8f9530[_0x64a8('0x2e')],'sectionId':_0x8f9530['id']},{})[_0x64a8('0x14')](function(){return _0x469161;});}else{return _0x469161;}})['catch'](function(_0x28d660){logger[_0x64a8('0x1a')](_0x64a8('0x76'),_0x28d660);throw _0x28d660;});}return _0x469161;})[_0x64a8('0x14')](respondWithResult(_0x256275,0xc9))[_0x64a8('0x1e')](handleError(_0x256275,null));};exports[_0x64a8('0x29')]=function(_0x216e93,_0x94f2db){if(_0x216e93[_0x64a8('0x77')]['id']){delete _0x216e93['body']['id'];}return db[_0x64a8('0x55')][_0x64a8('0x6f')]({'where':{'id':_0x216e93[_0x64a8('0x6c')]['id']},'include':[{'model':db[_0x64a8('0x53')],'as':_0x64a8('0x6d')}]})[_0x64a8('0x14')](handleEntityNotFound(_0x94f2db,null))['then'](saveUpdates(_0x216e93[_0x64a8('0x77')],null))[_0x64a8('0x14')](respondWithResult(_0x94f2db,null))[_0x64a8('0x1e')](handleError(_0x94f2db,null));};exports['destroy']=function(_0x25f851,_0x3dc7c4){return db['ChatWebsite'][_0x64a8('0x6f')]({'where':{'id':_0x25f851[_0x64a8('0x6c')]['id']}})['then'](handleEntityNotFound(_0x3dc7c4,null))[_0x64a8('0x14')](removeEntity(_0x3dc7c4,null))[_0x64a8('0x1e')](handleError(_0x3dc7c4,null));};exports[_0x64a8('0x78')]=function(_0x302ee4,_0x2d5ba5){return db[_0x64a8('0x55')][_0x64a8('0x78')]()['then'](respondWithResult(_0x2d5ba5,null))[_0x64a8('0x1e')](handleError(_0x2d5ba5,null));};exports['addDisposition']=function(_0x161772,_0x2edffb){if(_0x161772['body']['id']){delete _0x161772[_0x64a8('0x77')]['id'];}return db['ChatWebsite'][_0x64a8('0x6f')]({'where':{'id':_0x161772['params']['id']}})[_0x64a8('0x14')](handleEntityNotFound(_0x2edffb,null))[_0x64a8('0x14')](function(_0x2e1bf5){if(_0x2e1bf5){_0x161772['body'][_0x64a8('0x79')]=_0x2e1bf5['id'];return db[_0x64a8('0x7a')][_0x64a8('0x70')](_0x161772[_0x64a8('0x77')]);}})[_0x64a8('0x14')](respondWithResult(_0x2edffb,null))['catch'](handleError(_0x2edffb,null));};exports['getDispositions']=function(_0x199085,_0x2f27c7){var _0x1f2038={'raw':![],'where':{}};var _0x1ff1f2={};var _0x11c16d={'count':0x0,'rows':[]};return db[_0x64a8('0x55')][_0x64a8('0x7b')]({'where':{'id':_0x199085[_0x64a8('0x6c')]['id']}})['then'](handleEntityNotFound(_0x2f27c7,null))[_0x64a8('0x14')](function(_0x2f623f){if(_0x2f623f){_0x1ff1f2[_0x64a8('0x4d')]=_[_0x64a8('0x59')](db[_0x64a8('0x7a')][_0x64a8('0x56')]);_0x1ff1f2[_0x64a8('0x5b')]=_[_0x64a8('0x59')](_0x199085[_0x64a8('0x5b')]);_0x1ff1f2[_0x64a8('0x5a')]=_[_0x64a8('0x5d')](_0x1ff1f2['model'],_0x1ff1f2['query']);_0x1f2038[_0x64a8('0x5c')]=_[_0x64a8('0x5d')](_0x1ff1f2[_0x64a8('0x4d')],qs[_0x64a8('0x5e')](_0x199085['query'][_0x64a8('0x5e')]));_0x1f2038[_0x64a8('0x5c')]=_0x1f2038['attributes'][_0x64a8('0x5f')]?_0x1f2038[_0x64a8('0x5c')]:_0x1ff1f2[_0x64a8('0x4d')];if(!_0x199085[_0x64a8('0x5b')][_0x64a8('0x60')](_0x64a8('0x61'))){_0x1f2038[_0x64a8('0x23')]=qs[_0x64a8('0x23')](_0x199085['query']['limit']);_0x1f2038['offset']=qs['offset'](_0x199085['query'][_0x64a8('0x26')]);}_0x1f2038[_0x64a8('0x62')]=qs[_0x64a8('0x63')](_0x199085[_0x64a8('0x5b')]['sort']);_0x1f2038[_0x64a8('0x64')]=qs[_0x64a8('0x5a')](_['pick'](_0x199085[_0x64a8('0x5b')],_0x1ff1f2[_0x64a8('0x5a')]));_0x1f2038[_0x64a8('0x64')][_0x64a8('0x79')]=_0x2f623f['id'];if(_0x199085[_0x64a8('0x5b')][_0x64a8('0x65')]){_0x1f2038[_0x64a8('0x64')]=_['merge'](_0x1f2038[_0x64a8('0x64')],{'$or':_[_0x64a8('0x54')](_0x1f2038['attributes'],function(_0x1174a2){var _0x55a823={};_0x55a823[_0x1174a2]={'$like':'%'+_0x199085[_0x64a8('0x5b')][_0x64a8('0x65')]+'%'};return _0x55a823;})});}_0x1f2038=_['merge']({},_0x1f2038,_0x199085[_0x64a8('0x68')]);return db['Disposition']['count']({'where':_0x1f2038['where']})[_0x64a8('0x14')](function(_0x56635c){_0x11c16d[_0x64a8('0x25')]=_0x56635c;if(_0x199085[_0x64a8('0x5b')]['includeAll']){_0x1f2038[_0x64a8('0x69')]=[{'all':!![]}];}return db['Disposition'][_0x64a8('0x7c')](_0x1f2038);})[_0x64a8('0x14')](function(_0x327638){_0x11c16d[_0x64a8('0x6a')]=_0x327638;return _0x11c16d;});}})[_0x64a8('0x14')](respondWithFilteredResult(_0x2f27c7,_0x1f2038))['catch'](handleError(_0x2f27c7,null));};exports[_0x64a8('0x7d')]=function(_0x1ae802,_0x2f6afb){return db[_0x64a8('0x55')][_0x64a8('0x6f')]({'where':{'id':_0x1ae802['params']['id']}})[_0x64a8('0x14')](handleEntityNotFound(_0x2f6afb,null))[_0x64a8('0x14')](function(_0x8abc27){if(_0x8abc27){return _0x8abc27[_0x64a8('0x7d')](_0x1ae802[_0x64a8('0x5b')]['ids']);}})[_0x64a8('0x14')](respondWithStatusCode(_0x2f6afb,null))[_0x64a8('0x1e')](handleError(_0x2f6afb,null));};exports[_0x64a8('0x7e')]=function(_0xf69de,_0x5565e4){if(_0xf69de[_0x64a8('0x77')]['id']){delete _0xf69de[_0x64a8('0x77')]['id'];}return db[_0x64a8('0x55')]['find']({'where':{'id':_0xf69de[_0x64a8('0x6c')]['id']}})['then'](handleEntityNotFound(_0x5565e4,null))[_0x64a8('0x14')](function(_0x2dd8ef){if(_0x2dd8ef){_0xf69de[_0x64a8('0x77')][_0x64a8('0x79')]=_0x2dd8ef['id'];return db[_0x64a8('0x7f')][_0x64a8('0x70')](_0xf69de['body']);}})[_0x64a8('0x14')](respondWithResult(_0x5565e4,null))['catch'](handleError(_0x5565e4,null));};exports['getAnswers']=function(_0x3efff5,_0x264b00){var _0x22e28c={'raw':![],'where':{}};var _0x34f957={};var _0x35d2f3={'count':0x0,'rows':[]};return db[_0x64a8('0x55')][_0x64a8('0x7b')]({'where':{'id':_0x3efff5[_0x64a8('0x6c')]['id']}})['then'](handleEntityNotFound(_0x264b00,null))['then'](function(_0x712ce6){if(_0x712ce6){_0x34f957[_0x64a8('0x4d')]=_[_0x64a8('0x59')](db[_0x64a8('0x7f')][_0x64a8('0x56')]);_0x34f957['query']=_['keys'](_0x3efff5[_0x64a8('0x5b')]);_0x34f957[_0x64a8('0x5a')]=_[_0x64a8('0x5d')](_0x34f957[_0x64a8('0x4d')],_0x34f957[_0x64a8('0x5b')]);_0x22e28c['attributes']=_['intersection'](_0x34f957[_0x64a8('0x4d')],qs[_0x64a8('0x5e')](_0x3efff5[_0x64a8('0x5b')][_0x64a8('0x5e')]));_0x22e28c[_0x64a8('0x5c')]=_0x22e28c[_0x64a8('0x5c')][_0x64a8('0x5f')]?_0x22e28c[_0x64a8('0x5c')]:_0x34f957[_0x64a8('0x4d')];if(!_0x3efff5[_0x64a8('0x5b')]['hasOwnProperty']('nolimit')){_0x22e28c[_0x64a8('0x23')]=qs[_0x64a8('0x23')](_0x3efff5[_0x64a8('0x5b')][_0x64a8('0x23')]);_0x22e28c[_0x64a8('0x26')]=qs['offset'](_0x3efff5[_0x64a8('0x5b')]['offset']);}_0x22e28c['order']=qs[_0x64a8('0x63')](_0x3efff5[_0x64a8('0x5b')][_0x64a8('0x63')]);_0x22e28c[_0x64a8('0x64')]=qs['filters'](_[_0x64a8('0x80')](_0x3efff5[_0x64a8('0x5b')],_0x34f957['filters']));_0x22e28c[_0x64a8('0x64')][_0x64a8('0x79')]=_0x712ce6['id'];if(_0x3efff5['query'][_0x64a8('0x65')]){_0x22e28c[_0x64a8('0x64')]=_[_0x64a8('0x67')](_0x22e28c['where'],{'$or':_['map'](_0x22e28c['attributes'],function(_0x250c12){var _0x2cfa77={};_0x2cfa77[_0x250c12]={'$like':'%'+_0x3efff5[_0x64a8('0x5b')]['filter']+'%'};return _0x2cfa77;})});}_0x22e28c=_[_0x64a8('0x67')]({},_0x22e28c,_0x3efff5[_0x64a8('0x68')]);return db['CannedAnswer'][_0x64a8('0x25')]({'where':_0x22e28c['where']})['then'](function(_0x5e4b7a){_0x35d2f3[_0x64a8('0x25')]=_0x5e4b7a;if(_0x3efff5[_0x64a8('0x5b')]['includeAll']){_0x22e28c[_0x64a8('0x69')]=[{'all':!![]}];}return db['CannedAnswer'][_0x64a8('0x7c')](_0x22e28c);})[_0x64a8('0x14')](function(_0x750e4){_0x35d2f3['rows']=_0x750e4;return _0x35d2f3;});}})[_0x64a8('0x14')](respondWithFilteredResult(_0x264b00,_0x22e28c))['catch'](handleError(_0x264b00,null));};exports[_0x64a8('0x81')]=function(_0x3eaf89,_0x588226){return db['ChatWebsite']['find']({'where':{'id':_0x3eaf89[_0x64a8('0x6c')]['id']}})[_0x64a8('0x14')](handleEntityNotFound(_0x588226,null))['then'](function(_0x589ec8){if(_0x589ec8){return _0x589ec8[_0x64a8('0x81')](_0x3eaf89['query']['ids']);}})['then'](respondWithStatusCode(_0x588226,null))['catch'](handleError(_0x588226,null));};exports[_0x64a8('0x82')]=function(_0x7122c8,_0x339320){_0x7122c8[_0x64a8('0x77')][_0x64a8('0x83')]=_0x7122c8['file'][_0x64a8('0x84')];return db[_0x64a8('0x55')][_0x64a8('0x6f')]({'where':{'id':_0x7122c8[_0x64a8('0x6c')]['id']}})[_0x64a8('0x14')](handleEntityNotFound(_0x339320,null))[_0x64a8('0x14')](saveUpdates(_0x7122c8[_0x64a8('0x77')],null))['then'](respondWithResult(_0x339320,null))[_0x64a8('0x1e')](handleError(_0x339320,null));};exports[_0x64a8('0x85')]=function(_0x58e4d8,_0x8b37b3){_0x58e4d8['body'][_0x64a8('0x86')]=_0x58e4d8['file']['filename'];return db[_0x64a8('0x55')][_0x64a8('0x6f')]({'where':{'id':_0x58e4d8[_0x64a8('0x6c')]['id']}})['then'](handleEntityNotFound(_0x8b37b3,null))[_0x64a8('0x14')](saveUpdates(_0x58e4d8[_0x64a8('0x77')],null))[_0x64a8('0x14')](respondWithResult(_0x8b37b3,null))[_0x64a8('0x1e')](handleError(_0x8b37b3,null));};exports['addCustomerAvatar']=function(_0x48b463,_0x714e16){_0x48b463[_0x64a8('0x77')][_0x64a8('0x87')]=_0x48b463[_0x64a8('0x88')]['filename'];return db[_0x64a8('0x55')]['find']({'where':{'id':_0x48b463[_0x64a8('0x6c')]['id']}})[_0x64a8('0x14')](handleEntityNotFound(_0x714e16,null))[_0x64a8('0x14')](saveUpdates(_0x48b463['body'],null))['then'](respondWithResult(_0x714e16,null))[_0x64a8('0x1e')](handleError(_0x714e16,null));};exports[_0x64a8('0x89')]=function(_0x593000,_0x2a3ee8){_0x593000['body'][_0x64a8('0x8a')]=_0x593000[_0x64a8('0x88')]['filename'];return db[_0x64a8('0x55')][_0x64a8('0x6f')]({'where':{'id':_0x593000['params']['id']}})['then'](handleEntityNotFound(_0x2a3ee8,null))[_0x64a8('0x14')](saveUpdates(_0x593000[_0x64a8('0x77')],null))[_0x64a8('0x14')](respondWithResult(_0x2a3ee8,null))[_0x64a8('0x1e')](handleError(_0x2a3ee8,null));};exports[_0x64a8('0x8b')]=function(_0x30fffc,_0x2cb94b){var _0x398e3a=path['join'](config['root'],_0x64a8('0x8c'));var _0x3ce0b9={'where':{'id':_0x30fffc['params']['id']},'attributes':['id',_0x64a8('0x83')],'raw':!![]};var _0x40c93c=![];return require('../../config/license/util')[_0x64a8('0x8d')]()[_0x64a8('0x14')](function(_0x225249){if(_0x225249){_0x40c93c=_0x225249['custom'];}})['then'](function(){return db[_0x64a8('0x55')]['find'](_0x3ce0b9);})[_0x64a8('0x14')](handleEntityNotFound(_0x2cb94b,null))['then'](function(_0xb3a810){if(_0xb3a810){if(!_[_0x64a8('0x8e')](_0xb3a810[_0x64a8('0x83')])){if(fs[_0x64a8('0x8f')](path[_0x64a8('0x90')](config[_0x64a8('0x91')],_0x64a8('0x92'),_0xb3a810['sitepic']))&&_0x40c93c){_0x398e3a=path[_0x64a8('0x90')](config[_0x64a8('0x91')],_0x64a8('0x92'),_0xb3a810['sitepic']);}}return _0x2cb94b[_0x64a8('0x93')](_0x398e3a);}})[_0x64a8('0x1e')](handleError(_0x2cb94b,null));};exports[_0x64a8('0x94')]=function(_0x36ed54,_0xc0b83e){var _0x57b53a=path[_0x64a8('0x90')](config['root'],_0x64a8('0x95'));var _0x505063={'where':{'id':_0x36ed54[_0x64a8('0x6c')]['id']},'attributes':['id',_0x64a8('0x86')],'raw':!![]};return db[_0x64a8('0x55')][_0x64a8('0x6f')](_0x505063)['then'](handleEntityNotFound(_0xc0b83e,null))['then'](function(_0x936fd8){if(_0x936fd8){if(!_['isNil'](_0x936fd8['agentAvatar'])){if(fs[_0x64a8('0x8f')](path[_0x64a8('0x90')](config['root'],_0x64a8('0x96'),_0x936fd8[_0x64a8('0x86')]))){_0x57b53a=path[_0x64a8('0x90')](config[_0x64a8('0x91')],_0x64a8('0x96'),_0x936fd8[_0x64a8('0x86')]);}}return _0xc0b83e[_0x64a8('0x93')](_0x57b53a);}})['catch'](handleError(_0xc0b83e,null));};exports[_0x64a8('0x97')]=function(_0x242391,_0x512abe){var _0x23c665=path[_0x64a8('0x90')](config[_0x64a8('0x91')],'server/files/images/avatars/customer_avatar.png');var _0x111b9a={'where':{'id':_0x242391[_0x64a8('0x6c')]['id']},'attributes':['id',_0x64a8('0x87'),_0x64a8('0x98')],'raw':!![]};return db[_0x64a8('0x55')][_0x64a8('0x6f')](_0x111b9a)['then'](handleEntityNotFound(_0x512abe,null))[_0x64a8('0x14')](function(_0x20f018){if(_0x20f018){if(!_[_0x64a8('0x8e')](_0x20f018[_0x64a8('0x87')])){if(fs[_0x64a8('0x8f')](path[_0x64a8('0x90')](config[_0x64a8('0x91')],'server/files/images/avatars/',_0x20f018[_0x64a8('0x87')]))&&_0x20f018[_0x64a8('0x98')]){_0x23c665=path[_0x64a8('0x90')](config[_0x64a8('0x91')],'server/files/images/avatars/',_0x20f018[_0x64a8('0x87')]);}}return _0x512abe[_0x64a8('0x93')](_0x23c665);}})[_0x64a8('0x1e')](handleError(_0x512abe,null));};exports[_0x64a8('0x99')]=function(_0x4be150,_0x1226d7){var _0x27244d=path[_0x64a8('0x90')](config[_0x64a8('0x91')],'server/files/images/avatars/system_avatar.png');var _0x2e9b65={'where':{'id':_0x4be150[_0x64a8('0x6c')]['id']},'attributes':['id',_0x64a8('0x8a')],'raw':!![]};return db[_0x64a8('0x55')][_0x64a8('0x6f')](_0x2e9b65)[_0x64a8('0x14')](handleEntityNotFound(_0x1226d7,null))['then'](function(_0x2a6180){if(_0x2a6180){if(!_[_0x64a8('0x8e')](_0x2a6180[_0x64a8('0x8a')])){if(fs[_0x64a8('0x8f')](path[_0x64a8('0x90')](config[_0x64a8('0x91')],_0x64a8('0x96'),_0x2a6180[_0x64a8('0x8a')]))){_0x27244d=path[_0x64a8('0x90')](config[_0x64a8('0x91')],_0x64a8('0x96'),_0x2a6180[_0x64a8('0x8a')]);}}return _0x1226d7['download'](_0x27244d);}})[_0x64a8('0x1e')](handleError(_0x1226d7,null));};exports[_0x64a8('0x9a')]=function(_0x1f0b97,_0x2a61d6){var _0x284a8f={'body':_0x1f0b97[_0x64a8('0x77')],'channel':_0x64a8('0x9b')};var _0x2e23d0=[];var _0x2d666f=[];var _0x13829={};var _0xcb177=![];return db[_0x64a8('0x9c')][_0x64a8('0x78')]()['then'](function(_0x37f0dc){if(!_0x37f0dc){throw new db[(_0x64a8('0x9d'))]['ValidationError'](_0x64a8('0x9e'));}_0x2e23d0=_[_0x64a8('0x9f')](_[_0x64a8('0x59')](_0x37f0dc),[_0x64a8('0xa0'),_0x64a8('0xa1')]);_0x2d666f=_[_0x64a8('0x9f')](_[_0x64a8('0x59')](_0x37f0dc),[_0x64a8('0xa0'),_0x64a8('0xa1'),_0x64a8('0xa2'),_0x64a8('0xa3')]);if(_0x1f0b97[_0x64a8('0x77')]['id']){delete _0x1f0b97[_0x64a8('0x77')]['id'];}if(_[_0x64a8('0x8e')](_0x1f0b97[_0x64a8('0x77')][_0x64a8('0xa4')])){throw new db[(_0x64a8('0x9d'))]['ValidationError'](_0x64a8('0xa5'));}if(_[_0x64a8('0x8e')](_0x1f0b97[_0x64a8('0x77')][_0x64a8('0x77')])||_0x1f0b97[_0x64a8('0x77')][_0x64a8('0x77')]===''){throw new db[(_0x64a8('0x9d'))][(_0x64a8('0xa6'))](_0x64a8('0xa7'));}if(_[_0x64a8('0x8e')](_0x1f0b97['body'][_0x64a8('0xa8')])){throw new db[(_0x64a8('0x9d'))][(_0x64a8('0xa6'))](_0x64a8('0xa9')+_0x2d666f);}if(!_[_0x64a8('0xaa')](_0x2d666f,_0x1f0b97[_0x64a8('0x77')]['mapKey'])){throw new db[(_0x64a8('0x9d'))][(_0x64a8('0xa6'))](_0x64a8('0xab')+_0x2d666f);}_0x13829[_0x1f0b97[_0x64a8('0x77')][_0x64a8('0xa8')]]=_0x1f0b97[_0x64a8('0x77')][_0x64a8('0xa4')];})[_0x64a8('0x14')](function(){return db[_0x64a8('0x55')][_0x64a8('0x6f')]({'where':{'id':_0x1f0b97[_0x64a8('0x6c')]['id']},'include':[{'model':db['CmList'],'as':_0x64a8('0xac'),'include':[{'model':db[_0x64a8('0x9c')],'as':_0x64a8('0xad'),'where':_0x13829,'limit':0x1,'order':[[_0x64a8('0xa1'),_0x64a8('0xae')]]}]},{'model':db[_0x64a8('0xaf')],'as':_0x64a8('0xb0')},{'model':db['Interval'],'as':_0x64a8('0xb1'),'include':[{'model':db[_0x64a8('0xb1')],'as':_0x64a8('0x3c'),'attributes':['id',_0x64a8('0x34')],'raw':!![]}]}]});})[_0x64a8('0x14')](function(_0x56a317){if(!_0x56a317)throw new APINotFoundError(util[_0x64a8('0x33')]('Chat\x20Website\x20with\x20id\x20%s\x20not\x20found',_0x1f0b97[_0x64a8('0x6c')]['id']));if(!_0x56a317[_0x64a8('0xb1')]||!_0x56a317[_0x64a8('0xb1')][_0x64a8('0x3c')])return[_0x56a317,!![]];return[_0x56a317,checkWebsiteIntervals(_0x56a317)];})[_0x64a8('0xb2')](function(_0xea996f,_0x18c3c0){if(!_0x18c3c0)throw new APIOutOfIntervalError();if(!_0xea996f[_0x64a8('0xac')])return;_0x284a8f[_0x64a8('0xb3')]=_0xea996f;_0x284a8f[_0x64a8('0xb4')]=_0xea996f[_0x64a8('0xac')];_0x284a8f[_0x64a8('0xb5')]=_[_0x64a8('0xb6')](_0xea996f[_0x64a8('0xb0')],[_0x64a8('0xb7')],[_0x64a8('0xb8')]);if(_0x284a8f['account'][_0x64a8('0xb0')]){delete _0x284a8f['account'][_0x64a8('0xb0')];}if(_0x284a8f['account'][_0x64a8('0xac')]&&_0x284a8f[_0x64a8('0xb3')][_0x64a8('0xac')]['Contacts']['length']){return _0x284a8f[_0x64a8('0xb3')][_0x64a8('0xac')][_0x64a8('0xad')][0x0];}var _0x2e2f77=_[_0x64a8('0xd')](_0x1f0b97['body'],{'firstName':_0x1f0b97[_0x64a8('0x77')][_0x64a8('0xa4')],'ListId':_0xea996f[_0x64a8('0xa3')]});_0x2e2f77[_0x1f0b97[_0x64a8('0x77')][_0x64a8('0xa8')]]=_0x1f0b97[_0x64a8('0x77')][_0x64a8('0xa4')];return db['CmContact']['create'](_0x2e2f77,{'fields':_0x2e23d0,'raw':!![]});})[_0x64a8('0x14')](function(_0x2a380e){_0x284a8f[_0x64a8('0xb9')]=_0x2a380e;var _0x1b3362=createInteractionObject(_0x1f0b97['params']['id'],_0x1f0b97['body'],_0x1f0b97[_0x64a8('0xba')],_0x2a380e);var _0x346a50={'ChatWebsiteId':_0x1f0b97['params']['id'],'closed':![]};if(_0x1f0b97[_0x64a8('0x77')][_0x64a8('0xbb')]){_0x346a50[_0x64a8('0xbb')]=_0x1f0b97[_0x64a8('0x77')][_0x64a8('0xbb')];return db[_0x64a8('0xbc')][_0x64a8('0x6f')]({'where':_0x346a50})[_0x64a8('0x14')](function(_0x10a507){if(_0x10a507){_0xcb177=!![];return _0x10a507;}_0x1b3362[_0x64a8('0xbb')]=_0x1f0b97['body'][_0x64a8('0xbb')];_0x1b3362[_0x64a8('0xbd')]=_0x1f0b97[_0x64a8('0x77')]['externalUrl'];return db[_0x64a8('0xbc')][_0x64a8('0x70')](_0x1b3362);});}_0x346a50['ContactId']=_0x2a380e['id'];if(_0x1f0b97['body'][_0x64a8('0xbe')]&&_0x1f0b97[_0x64a8('0x77')][_0x64a8('0xbe')]['id']){_0x346a50['id']=_0x1f0b97[_0x64a8('0x77')][_0x64a8('0xbe')]['id'];return db[_0x64a8('0xbc')][_0x64a8('0x6f')]({'where':_0x346a50})[_0x64a8('0x14')](function(_0x47bf79){if(_0x47bf79){_0xcb177=!![];return _0x47bf79;}return db[_0x64a8('0xbc')]['create'](_0x1b3362);});}return db['ChatInteraction'][_0x64a8('0x70')](_0x1b3362);})[_0x64a8('0x14')](function(_0x2a644e){if(!_0xcb177)return _0x2a644e;var _0x2a8d8b={'from':(_0x284a8f[_0x64a8('0xb9')][_0x64a8('0x47')]||'')+'\x20'+(_0x284a8f[_0x64a8('0xb9')][_0x64a8('0xbf')]||'')};if(_0x1f0b97[_0x64a8('0x77')]['threadId']&&_0x1f0b97['body'][_0x64a8('0xc0')]&&_0x1f0b97['body'][_0x64a8('0xbb')]!=_0x1f0b97[_0x64a8('0x77')]['messageId']){_0x2a8d8b['threadId']=_0x1f0b97[_0x64a8('0x77')][_0x64a8('0xc0')];}return _0x2a644e[_0x64a8('0x29')](_0x2a8d8b);})[_0x64a8('0x14')](function(_0x5965c8){_0x284a8f[_0x64a8('0xbe')]=_0x5965c8['get']({'plain':!![]});_0x284a8f[_0x64a8('0xbe')][_0x64a8('0xc1')]=!_0xcb177;if(_0x284a8f[_0x64a8('0xbe')][_0x64a8('0xc1')]){if(_0x284a8f[_0x64a8('0xb3')][_0x64a8('0xc2')]){_0x284a8f[_0x64a8('0xb5')]['push']({'id':0x0,'priority':_0x284a8f['applications'][_0x64a8('0x5f')]+0x1,'app':_0x64a8('0xc3'),'appdata':_0x64a8('0xc4'),'interval':_0x64a8('0xc5')});}}return db[_0x64a8('0xc6')][_0x64a8('0x70')]({'body':_0x1f0b97[_0x64a8('0x77')][_0x64a8('0x77')],'ChatWebsiteId':_0x1f0b97[_0x64a8('0x6c')]['id'],'ChatInteractionId':_0x5965c8['id'],'direction':'in','ContactId':_0x284a8f[_0x64a8('0xb9')]['id'],'AttachmentId':_0x1f0b97[_0x64a8('0x77')][_0x64a8('0xc7')]});})[_0x64a8('0x14')](function(_0x316a6e){_0x284a8f[_0x64a8('0x1c')]=_0x316a6e;if(!_0x284a8f['interaction'][_0x64a8('0xc8')]){return;}return db[_0x64a8('0xc9')][_0x64a8('0x6f')]({'attributes':['id',_0x64a8('0x2e')],'where':{'id':_0x284a8f[_0x64a8('0xbe')][_0x64a8('0xc8')]}});})[_0x64a8('0x14')](function(_0x4dc487){if(_0x4dc487){_0x284a8f[_0x64a8('0xb5')]['unshift']({'id':0x0,'priority':0x0,'app':_0x64a8('0xca'),'appdata':_0x4dc487[_0x64a8('0x2e')]+','+(_0x284a8f['account'][_0x64a8('0xcb')]||0xa),'interval':_0x64a8('0xc5')});_0x284a8f[_0x64a8('0xcc')]=!![];}if(!_0x284a8f[_0x64a8('0xbe')][_0x64a8('0xcd')]){return;}return db[_0x64a8('0xce')][_0x64a8('0x6f')]({'attributes':['id','name'],'where':{'id':_0x284a8f[_0x64a8('0xbe')][_0x64a8('0xcd')]}});})[_0x64a8('0x14')](function(_0x3e8b2e){if(_0x3e8b2e){_0x284a8f[_0x64a8('0xb5')][_0x64a8('0xcf')]({'id':0x0,'priority':0x1,'app':_0x64a8('0xd0'),'appdata':_0x3e8b2e[_0x64a8('0x2e')]+','+(_0x284a8f[_0x64a8('0xb3')][_0x64a8('0xd1')]||0x12c),'interval':_0x64a8('0xc5')});}return respondWithRpcPromise(_0x64a8('0xd2'),_0x64a8('0xd3'),_0x284a8f);})['then'](function(_0x430f6a){respondWithRpcPromise(_0x64a8('0xd4'),'EventManager',{'event':_0x64a8('0x9a'),'message':_0x430f6a},client9002);return _0x430f6a;})[_0x64a8('0x14')](respondWithResult(_0x2a61d6,null))[_0x64a8('0x1e')](APIHandleError(_0x2a61d6));};exports[_0x64a8('0xd5')]=function(_0xb783da,_0x18c24c){var _0x525331,_0x41f566,_0x4560df;var _0x5f2093=[];var _0x1a026c={};var _0xb41b65=_0xb783da['files']||[];var _0x4cc7a6=[];var _0xd3fb7a;return db[_0x64a8('0x9c')][_0x64a8('0x78')]()[_0x64a8('0x14')](function(_0x1e154b){if(!_0x1e154b){throw new db[(_0x64a8('0x9d'))][(_0x64a8('0xa6'))](_0x64a8('0x9e'));}_0x5f2093=_['difference'](_[_0x64a8('0x59')](_0x1e154b),[_0x64a8('0xa0'),'updatedAt',_0x64a8('0xa2'),_0x64a8('0xa3')]);if(_0xb783da[_0x64a8('0x77')]['id']){delete _0xb783da[_0x64a8('0x77')]['id'];}if(_['isNil'](_0xb783da[_0x64a8('0x77')][_0x64a8('0xa4')])){throw _0x18c24c['status'](0x1f4)[_0x64a8('0x2f')](new db['Sequelize'][(_0x64a8('0xa6'))](_0x64a8('0xa5')));}if(_[_0x64a8('0x8e')](_0xb783da[_0x64a8('0x77')][_0x64a8('0x77')])||_0xb783da['body'][_0x64a8('0x77')]===''){throw _0x18c24c['status'](0x1f4)[_0x64a8('0x2f')](new db['Sequelize']['ValidationError'](_0x64a8('0xa7')));}if(_[_0x64a8('0x8e')](_0xb783da[_0x64a8('0x77')][_0x64a8('0xd6')])){throw _0x18c24c[_0x64a8('0x20')](0x1f4)['send'](new db[(_0x64a8('0x9d'))][(_0x64a8('0xa6'))](_0x64a8('0xd7')+_0x5f2093));}if(!_[_0x64a8('0xaa')](_0x5f2093,_0xb783da[_0x64a8('0x77')][_0x64a8('0xd6')])){throw _0x18c24c[_0x64a8('0x20')](0x1f4)['send'](new db['Sequelize']['ValidationError']('mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x5f2093));}_0x1a026c[_0xb783da[_0x64a8('0x77')]['mapKeyOffline']]=_0xb783da['body'][_0x64a8('0xa4')];})['then'](function(){return db[_0x64a8('0x55')][_0x64a8('0x6f')]({'where':{'id':_0xb783da[_0x64a8('0x6c')]['id']},'include':[{'model':db[_0x64a8('0xd8')],'as':_0x64a8('0xac')},{'model':db[_0x64a8('0xd9')],'as':'MailAccount'}]});})['then'](handleEntityNotFound(_0x18c24c,null))[_0x64a8('0x14')](function(_0x3524cb){if(_0x3524cb&&_0x3524cb[_0x64a8('0xac')]){_0x41f566=_0x3524cb;var _0x49b9d8=_['defaults'](_0xb783da['body'],{'firstName':_0xb783da['body'][_0x64a8('0xa4')],'phone':_0xb783da[_0x64a8('0x77')][_0x64a8('0xa4')],'ListId':_0x3524cb['ListId']});_0x49b9d8[_0xb783da[_0x64a8('0x77')]['mapKeyOffline']]=_0xb783da[_0x64a8('0x77')][_0x64a8('0xa4')];return db[_0x64a8('0x9c')]['findOrCreate']({'where':_0x1a026c,'defaults':_0x49b9d8});}})[_0x64a8('0xb2')](function(_0x31cf3b){if(_0x31cf3b){_0x4560df=_0x31cf3b;var _0x43dc08=fs[_0x64a8('0xda')](path[_0x64a8('0x90')](config[_0x64a8('0x91')],_0x64a8('0xdb')),_0x64a8('0xdc'));var _0x31ad45=ejs['render'](_0x43dc08,{'body':_[_0x64a8('0xdd')](_0xb783da[_0x64a8('0x77')][_0x64a8('0x77')]),'bodyTitle':_0x41f566[_0x64a8('0xde')]});return db[_0x64a8('0xdf')][_0x64a8('0x70')]({'body':_0x31ad45,'plainBody':htmlToText[_0x64a8('0xe0')](_0x31ad45),'ContactId':_0x31cf3b['id'],'ChatWebsiteId':_0x41f566['id']});}})[_0x64a8('0x14')](function(_0x5504bd){_0xd3fb7a=_0x5504bd;if(_0xb41b65['length']){var _0x442e46=_0xb41b65[_0x64a8('0x54')](function(_0x14985b){return{'name':_0x14985b['originalname'],'basename':_0x14985b[_0x64a8('0x84')],'type':_0x14985b[_0x64a8('0xe1')],'ChatOfflineMessageId':_0x5504bd['id']};});_0x4cc7a6=_0x442e46[_0x64a8('0x54')](_0x1bd6e5=>{var _0x36bb2f={'filename':_0x1bd6e5[_0x64a8('0x2e')],'path':path[_0x64a8('0x90')](config[_0x64a8('0x91')],_0x64a8('0xe2'),_0x64a8('0xe3'),'attachments',_0x64a8('0xe4'),_0x1bd6e5['basename'])};return _0x36bb2f;});if(!_0x41f566[_0x64a8('0xe5')]){return db['sequelize'][_0x64a8('0xe6')](function(_0x2ec538){return db['Attachment'][_0x64a8('0xe7')](_0x442e46,{'transaction':_0x2ec538});});}}})[_0x64a8('0x14')](function(){if(_0xd3fb7a){_0x525331=_0xd3fb7a;return db[_0x64a8('0xd9')][_0x64a8('0x7b')]({'where':{'service':!![]},'include':[{'model':db['MailServerOut'],'as':_0x64a8('0xe8'),'raw':!![],'include':[{'model':db[_0x64a8('0xe9')],'as':'CloudProvider','raw':!![]}]}]});}})[_0x64a8('0x14')](function(_0x359b3b){if(_0x359b3b&&_0x359b3b[_0x64a8('0xe8')]&&_0x41f566[_0x64a8('0xea')]&&_0x41f566[_0x64a8('0xeb')]){var _0x56227e=_0x359b3b['getSmtpOptions']();return respondWithRpcPromise(_0x64a8('0xec'),_0x64a8('0xed'),{'account':_0x56227e,'message':{'from':util[_0x64a8('0x33')](_0x64a8('0xee'),_0x359b3b[_0x64a8('0x2e')],_0x359b3b[_0x64a8('0xef')]||_0x359b3b[_0x64a8('0xe8')]['user']),'to':_0x41f566[_0x64a8('0xeb')],'subject':_0x41f566[_0x64a8('0xf0')],'html':_0x525331['body'],'attachments':_0x4cc7a6}},client9003)['then'](function(){return _0x525331;})[_0x64a8('0x1e')](function(_0x4570ff){logger[_0x64a8('0x1a')](_0x4570ff);});}})[_0x64a8('0x14')](function(){if(_0x41f566&&_0x41f566[_0x64a8('0xe5')]&&_0x41f566[_0x64a8('0xf1')]){var _0x4549c0=[];if(_0xb41b65[_0x64a8('0x5f')]){_0x4549c0=_0xb41b65[_0x64a8('0x54')](function(_0x31bdfa){return{'name':_0x31bdfa[_0x64a8('0xf2')],'basename':_0x31bdfa[_0x64a8('0x84')],'type':_0x31bdfa[_0x64a8('0xe1')],'ChatOfflineMessageId':_0xd3fb7a['id']};});}var _0x25fc7b;if(!_[_0x64a8('0x8e')](_0x41f566[_0x64a8('0xf3')])){var _0x1bb522=_[_0x64a8('0x54')](_0xb783da['body'],function(_0x4ae209){return _0x4ae209;});var _0x3b454f=_['toPairsIn'](_0x1bb522)[0x0];var _0x535c14=_[_0x64a8('0xf4')](_0x3b454f,function(_0x4a837c){return _0x4a837c;});_0x25fc7b=_0x535c14[0x1][_0x41f566['subjectOffline']];}var _0x3bec3c={'from':_0x4560df[_0x64a8('0xef')],'firstName':_0x4560df['firstName'],'lastName':_0x4560df['lastName'],'mapKey':'email','message':{'from':_0x4560df[_0x64a8('0xef')],'to':_0x41f566[_0x64a8('0xd9')][_0x64a8('0xef')],'cc':'','subject':_[_0x64a8('0x8e')](_0x25fc7b)?_0x41f566[_0x64a8('0xf0')]:_0x25fc7b,'messageId':'','sentAt':new Date(),'attach':_0x4549c0[_0x64a8('0x5f')],'attachments':_0x4549c0,'originChannel':_0x64a8('0xf5'),'ChatWebsiteId':_0x41f566['id'],'ChatOfflineMessageId':_0x525331['id'],'originTo':_0x41f566[_0x64a8('0xd9')][_0x64a8('0xef')]},'body':_0x525331[_0x64a8('0x77')]};var _0xd87551={'account':{'id':_0x41f566['MailAccountId']},'body':_0x3bec3c,'log':'NotifyMailAccount'};return respondWithRpcPromise(_0x64a8('0xf6'),_0x64a8('0xf7'),_0xd87551,client9001)['then'](function(){return _0x525331;})['catch'](function(_0x4c8413){logger[_0x64a8('0x1a')](_0x4c8413);});}return;})[_0x64a8('0x14')](function(){if(_0x525331){return _0x525331;}})[_0x64a8('0x14')](respondWithResult(_0x18c24c,null))[_0x64a8('0x1e')](function(){for(var _0x267b76 of _0xb41b65){var _0x3a71f2=path[_0x64a8('0x90')](config['root'],_0x64a8('0xe2'),'files',_0x64a8('0xf8'),_0x64a8('0xe4'),_0x267b76[_0x64a8('0x84')]);fs_extra[_0x64a8('0xf9')](_0x3a71f2)[_0x64a8('0x1e')](function(_0x117dd4){logger[_0x64a8('0x1a')](_0x64a8('0xfa'),_0x3a71f2,_0x117dd4);});}});};exports['addInteraction']=function(_0x261d85,_0x6ee599){return db[_0x64a8('0xbc')][_0x64a8('0x6f')]({'where':{'id':_0x261d85[_0x64a8('0x6c')]['id']}})['then'](handleEntityNotFound(_0x6ee599,null))[_0x64a8('0x14')](function(_0x3301d0){if(_0x3301d0){return _0x3301d0[_0x64a8('0xfb')](_0x261d85[_0x64a8('0x77')][_0x64a8('0xfc')],_['omit'](_0x261d85[_0x64a8('0x77')],['ids','id'])||{});}})['then'](respondWithResult(_0x6ee599,null))[_0x64a8('0x1e')](handleError(_0x6ee599,null));};exports[_0x64a8('0xfd')]=function(_0x287600,_0x40b582){var _0x246745={'raw':![],'where':{}};var _0x1c778a={};var _0x20a0c2={'count':0x0,'rows':[]};return db[_0x64a8('0x55')]['findOne']({'where':{'id':_0x287600['params']['id']}})[_0x64a8('0x14')](handleEntityNotFound(_0x40b582,null))[_0x64a8('0x14')](function(_0x1237e8){if(_0x1237e8){_0x1c778a[_0x64a8('0x4d')]=_['keys'](db[_0x64a8('0xbc')][_0x64a8('0x56')]);_0x1c778a[_0x64a8('0x5b')]=_[_0x64a8('0x59')](_0x287600[_0x64a8('0x5b')]);_0x1c778a['filters']=_[_0x64a8('0x5d')](_0x1c778a[_0x64a8('0x4d')],_0x1c778a['query']);_0x246745['attributes']=_[_0x64a8('0x5d')](_0x1c778a[_0x64a8('0x4d')],qs[_0x64a8('0x5e')](_0x287600['query']['fields']));_0x246745[_0x64a8('0x5c')]=_0x246745[_0x64a8('0x5c')]['length']?_0x246745[_0x64a8('0x5c')]:_0x1c778a[_0x64a8('0x4d')];if(!_0x287600[_0x64a8('0x5b')][_0x64a8('0x60')]('nolimit')){_0x246745[_0x64a8('0x23')]=qs[_0x64a8('0x23')](_0x287600['query'][_0x64a8('0x23')]);_0x246745['offset']=qs['offset'](_0x287600['query'][_0x64a8('0x26')]);}_0x246745[_0x64a8('0x62')]=qs[_0x64a8('0x63')](_0x287600[_0x64a8('0x5b')][_0x64a8('0x63')]);_0x246745[_0x64a8('0x64')]=qs[_0x64a8('0x5a')](_[_0x64a8('0x80')](_0x287600[_0x64a8('0x5b')],_0x1c778a[_0x64a8('0x5a')]));_0x246745[_0x64a8('0x64')][_0x64a8('0x79')]=_0x1237e8['id'];if(_0x287600[_0x64a8('0x5b')][_0x64a8('0x65')]){_0x246745[_0x64a8('0x64')]=_[_0x64a8('0x67')](_0x246745['where'],{'$or':_[_0x64a8('0x54')](_0x246745[_0x64a8('0x5c')],function(_0x47ebaf){var _0x320e48={};_0x320e48[_0x47ebaf]={'$like':'%'+_0x287600[_0x64a8('0x5b')][_0x64a8('0x65')]+'%'};return _0x320e48;})});}_0x246745=_[_0x64a8('0x67')]({},_0x246745,_0x287600[_0x64a8('0x68')]);return db[_0x64a8('0xbc')][_0x64a8('0x25')]({'where':_0x246745['where']})['then'](function(_0x4a51dd){_0x20a0c2[_0x64a8('0x25')]=_0x4a51dd;if(_0x287600[_0x64a8('0x5b')][_0x64a8('0x6e')]){_0x246745[_0x64a8('0x69')]=[{'model':db[_0x64a8('0x9c')],'as':_0x64a8('0xfe'),'required':![]},{'model':db[_0x64a8('0xc9')],'as':'Owner','attributes':[_0x64a8('0x2e'),_0x64a8('0xff'),_0x64a8('0x100')],'required':![]},{'model':db['Tag'],'as':'Tags','attributes':['id',_0x64a8('0x2e'),_0x64a8('0x101')],'where':_0x287600['query'][_0x64a8('0x102')]?{'id':_0x287600[_0x64a8('0x5b')]['tag']}:undefined,'required':_0x287600[_0x64a8('0x5b')][_0x64a8('0x102')]?!![]:![]}];}return db[_0x64a8('0xbc')][_0x64a8('0x7c')](_0x246745);})[_0x64a8('0x14')](function(_0x1a4fa7){_0x20a0c2['rows']=_0x1a4fa7;return _0x20a0c2;});}})[_0x64a8('0x14')](respondWithFilteredResult(_0x40b582,_0x246745))[_0x64a8('0x1e')](handleError(_0x40b582,null));};exports[_0x64a8('0x31')]=function(_0x55fb35,_0x4e73f7){var _0x438e01=0x0;var _0x1b2866=0x0;var _0x2a7017=![];var _0x18bf0b;var _0x480af3;return db[_0x64a8('0x55')][_0x64a8('0x6f')]({'where':{'id':_0x55fb35['params']['id']},'include':[{'model':db['Interval'],'as':_0x64a8('0xb1'),'include':[{'model':db[_0x64a8('0xb1')],'as':'Intervals','attributes':['id',_0x64a8('0x34')]}]}]})[_0x64a8('0x14')](handleEntityNotFound(_0x4e73f7,null))[_0x64a8('0x14')](function(_0x55fac6){if(_0x55fac6){_0x18bf0b=_0x55fac6;return _0x55fac6['getProactiveActions']({'raw':!![]});}})[_0x64a8('0x14')](function(_0x3fa940){if(_0x18bf0b){if(_0x3fa940){_0x480af3=_0x3fa940;}}return require('../../config/license/util')[_0x64a8('0x8d')]();})[_0x64a8('0x14')](function(_0x621352){if(_0x621352){_0x1b2866=_0x621352[_0x64a8('0x103')];_0x2a7017=_0x621352[_0x64a8('0x104')];}})['then'](function(){return db[_0x64a8('0xbc')][_0x64a8('0x25')]({'where':{'closed':![]}});})[_0x64a8('0x14')](function(_0x217ad3){_0x438e01=_0x217ad3;if(_0x1b2866&&_0x217ad3>_0x1b2866){return db[_0x64a8('0x105')][_0x64a8('0x7b')]({'where':{'id':0x1}})[_0x64a8('0x14')](function(_0xe962db){if(_0xe962db){_0xe962db[_0x64a8('0x106')](_0x64a8('0x107'));}});}})[_0x64a8('0x14')](function(){if(!_0x18bf0b[_0x64a8('0xb1')]||!_0x18bf0b[_0x64a8('0xb1')][_0x64a8('0x3c')])return!![];return checkWebsiteIntervals(_0x18bf0b);})[_0x64a8('0x14')](function(_0x93dab){var _0x448829=fs[_0x64a8('0xda')](path[_0x64a8('0x90')](config[_0x64a8('0x91')],_0x64a8('0x108')),_0x64a8('0xdc'));var _0x37a6b2=new url[(_0x64a8('0x109'))](_0x18bf0b[_0x64a8('0x10a')])[_0x64a8('0x10b')];var _0x5754f9=_0x64a8('0x10c');var _0x556297=![];var _0xc20cb9={'chatVersion':_0x5754f9,'chatWebsiteAddressOrigin':_0x37a6b2,'remote':_0x18bf0b[_0x64a8('0x10d')],'query':querystring[_0x64a8('0x19')](_['merge'](_0x18bf0b[_0x64a8('0x2a')]({'plain':!![]}),{'customerIp':_0x55fb35[_0x64a8('0xba')][_0x64a8('0x44')]||_0x55fb35[_0x64a8('0xba')][_0x64a8('0x10e')]||_0x55fb35['connection']['remoteAddress']||_0x55fb35['ip'],'referer':_0x55fb35[_0x64a8('0xba')][_0x64a8('0x10f')],'openedInteractions':_0x438e01,'maxInteractions':_0x1b2866,'virtual':_0x2a7017[_0x64a8('0x103')],'online':_0x93dab,'custom':_0x2a7017}))[_0x64a8('0x110')](/'/g,'\x5c\x27')};_0x4e73f7[_0x64a8('0x2f')](ejs[_0x64a8('0x111')](Mustache[_0x64a8('0x111')](_0x448829,_0xc20cb9),{'proactiveActions':_0x480af3,'alignment':_0x18bf0b[_0x64a8('0x112')],'verticalAlignment':_0x18bf0b[_0x64a8('0x113')],'div_color':_0x18bf0b[_0x64a8('0x101')],'labelText':_0x18bf0b['labelText'],'text_color':_0x18bf0b[_0x64a8('0x114')],'text_button_color':_0x18bf0b[_0x64a8('0x115')],'button_color':_0x18bf0b['color_button'],'background_color':_0x18bf0b[_0x64a8('0x116')],'hideWhenOffline':_0x18bf0b[_0x64a8('0x117')],'intervalId':_0x18bf0b[_0x64a8('0x118')],'isDevelopment':_0x556297,'chatVersion':_0x5754f9}));})['catch'](handleError(_0x4e73f7,null));};exports[_0x64a8('0x119')]=function(_0x433170,_0x141c3a){var _0x2e90ca=_0x433170[_0x64a8('0x6c')]['id'];var _0x190cb5=_0x433170['body'];var _0x5239c9=0xc8;var _0x14c223=null;return db[_0x64a8('0x11a')][_0x64a8('0xe6')]({'isolationLevel':db[_0x64a8('0x11a')]['Transaction'][_0x64a8('0x11b')][_0x64a8('0x11c')]},function(_0x3c914d){return db[_0x64a8('0x55')][_0x64a8('0x7b')]({'where':{'id':_0x2e90ca},'transaction':_0x3c914d})['then'](function(_0x16d6b1){if(_0x16d6b1){return db[_0x64a8('0xaf')][_0x64a8('0x2c')]({'where':{'ChatWebsiteId':_0x2e90ca},'transaction':_0x3c914d})[_0x64a8('0x14')](function(){var _0x59520d=_[_0x64a8('0x54')](_0x190cb5,function(_0x8410c){_0x8410c[_0x64a8('0x79')]=_0x2e90ca;return _0x8410c;});return db[_0x64a8('0xaf')][_0x64a8('0xe7')](_0x59520d,{'transaction':_0x3c914d});});}else{_0x5239c9=0x194;_0x14c223=[];}});})[_0x64a8('0x14')](function(){if(_0x5239c9!==0x194){return db[_0x64a8('0xaf')]['findAndCountAll']({'where':{'ChatWebsiteId':_0x2e90ca},'order':_0x64a8('0xb7')})[_0x64a8('0x14')](function(_0x313236){_0x14c223=_0x313236;});}})[_0x64a8('0x1e')](function(_0x3197d8){_0x5239c9=0x1f4;logger[_0x64a8('0x1a')](_0x3197d8[_0x64a8('0x2d')]);if(_0x3197d8[_0x64a8('0x2e')]){delete _0x3197d8[_0x64a8('0x2e')];}_0x14c223=_0x3197d8;})[_0x64a8('0x11d')](function(){if(_0x14c223===null){_0x141c3a[_0x64a8('0x1f')](_0x5239c9);}else{if(_0x5239c9===0x1f4){_0x141c3a['status'](_0x5239c9)[_0x64a8('0x2f')](_0x14c223);}else{_0x141c3a['status'](_0x5239c9)['json'](_0x14c223);}}});};exports[_0x64a8('0x11e')]=function(_0x533cd9,_0x3820fa){var _0x1d1541={};var _0x3c21a5={};var _0x41a368;var _0x68b6c6;return db[_0x64a8('0x55')]['findOne']({'where':{'id':_0x533cd9['params']['id']}})[_0x64a8('0x14')](handleEntityNotFound(_0x3820fa,null))[_0x64a8('0x14')](function(_0x3984b7){if(_0x3984b7){_0x41a368=_0x3984b7;_0x3c21a5[_0x64a8('0x4d')]=_[_0x64a8('0x59')](db['ChatApplication'][_0x64a8('0x56')]);_0x3c21a5[_0x64a8('0x5b')]=_[_0x64a8('0x59')](_0x533cd9['query']);_0x3c21a5['filters']=_[_0x64a8('0x5d')](_0x3c21a5[_0x64a8('0x4d')],_0x3c21a5[_0x64a8('0x5b')]);_0x1d1541[_0x64a8('0x5c')]=_[_0x64a8('0x5d')](_0x3c21a5['model'],qs[_0x64a8('0x5e')](_0x533cd9[_0x64a8('0x5b')][_0x64a8('0x5e')]));_0x1d1541[_0x64a8('0x5c')]=_0x1d1541[_0x64a8('0x5c')][_0x64a8('0x5f')]?_0x1d1541[_0x64a8('0x5c')]:_0x3c21a5['model'];_0x1d1541[_0x64a8('0x62')]=qs[_0x64a8('0x63')](_0x533cd9[_0x64a8('0x5b')][_0x64a8('0x63')]);_0x1d1541[_0x64a8('0x64')]=qs[_0x64a8('0x5a')](_[_0x64a8('0x80')](_0x533cd9[_0x64a8('0x5b')],_0x3c21a5['filters']));if(_0x533cd9[_0x64a8('0x5b')][_0x64a8('0x65')]){_0x1d1541[_0x64a8('0x64')]=_['merge'](_0x1d1541[_0x64a8('0x64')],{'$or':_[_0x64a8('0x54')](_0x1d1541[_0x64a8('0x5c')],function(_0x575d26){var _0x4f9318={};_0x4f9318[_0x575d26]={'$like':'%'+_0x533cd9['query'][_0x64a8('0x65')]+'%'};return _0x4f9318;})});}_0x1d1541=_['merge']({},_0x1d1541,_0x533cd9['options']);return _0x41a368['getApplications'](_0x1d1541);}})['then'](function(_0x1e333e){if(_0x1e333e){_0x68b6c6=_0x1e333e[_0x64a8('0x5f')];if(!_0x533cd9[_0x64a8('0x5b')][_0x64a8('0x60')]('nolimit')){_0x1d1541[_0x64a8('0x23')]=qs[_0x64a8('0x23')](_0x533cd9['query'][_0x64a8('0x23')]);_0x1d1541[_0x64a8('0x26')]=qs[_0x64a8('0x26')](_0x533cd9[_0x64a8('0x5b')][_0x64a8('0x26')]);}return _0x41a368[_0x64a8('0x11e')](_0x1d1541);}})[_0x64a8('0x14')](function(_0x396a59){if(_0x396a59){return _0x396a59?{'count':_0x68b6c6,'rows':_0x396a59}:null;}})[_0x64a8('0x14')](respondWithResult(_0x3820fa,null))['catch'](handleError(_0x3820fa,null));};exports[_0x64a8('0x11f')]=function(_0x1c11a5,_0x13b667){return db[_0x64a8('0x120')][_0x64a8('0x6f')]({'where':{'id':_0x1c11a5['params']['id']}})[_0x64a8('0x14')](handleEntityNotFound(_0x13b667,null))['then'](function(_0xb4c885){if(_0xb4c885){return _0xb4c885[_0x64a8('0x11f')](_0x1c11a5['body'][_0x64a8('0xfc')],_['omit'](_0x1c11a5[_0x64a8('0x77')],['ids','id'])||{});}})['then'](respondWithResult(_0x13b667,null))[_0x64a8('0x1e')](handleError(_0x13b667,null));};exports['getProactiveActions']=function(_0x494779,_0x2641db){var _0x57f251={};var _0x1e5e91={};var _0x1b788f;var _0x17a7db;return db['ChatWebsite'][_0x64a8('0x7b')]({'where':{'id':_0x494779[_0x64a8('0x6c')]['id']}})['then'](handleEntityNotFound(_0x2641db,null))[_0x64a8('0x14')](function(_0x3581d5){if(_0x3581d5){_0x1b788f=_0x3581d5;_0x1e5e91[_0x64a8('0x4d')]=_[_0x64a8('0x59')](db[_0x64a8('0x121')]['rawAttributes']);_0x1e5e91[_0x64a8('0x5b')]=_['keys'](_0x494779[_0x64a8('0x5b')]);_0x1e5e91[_0x64a8('0x5a')]=_[_0x64a8('0x5d')](_0x1e5e91[_0x64a8('0x4d')],_0x1e5e91[_0x64a8('0x5b')]);_0x57f251[_0x64a8('0x5c')]=_['intersection'](_0x1e5e91[_0x64a8('0x4d')],qs[_0x64a8('0x5e')](_0x494779[_0x64a8('0x5b')][_0x64a8('0x5e')]));_0x57f251[_0x64a8('0x5c')]=_0x57f251[_0x64a8('0x5c')][_0x64a8('0x5f')]?_0x57f251['attributes']:_0x1e5e91['model'];_0x57f251[_0x64a8('0x62')]=qs[_0x64a8('0x63')](_0x494779[_0x64a8('0x5b')][_0x64a8('0x63')]);_0x57f251[_0x64a8('0x64')]=qs[_0x64a8('0x5a')](_[_0x64a8('0x80')](_0x494779[_0x64a8('0x5b')],_0x1e5e91[_0x64a8('0x5a')]));if(_0x494779[_0x64a8('0x5b')][_0x64a8('0x65')]){_0x57f251['where']=_[_0x64a8('0x67')](_0x57f251['where'],{'$or':_[_0x64a8('0x54')](_0x57f251['attributes'],function(_0x5d2c9a){var _0x122e7d={};_0x122e7d[_0x5d2c9a]={'$like':'%'+_0x494779['query'][_0x64a8('0x65')]+'%'};return _0x122e7d;})});}_0x57f251=_[_0x64a8('0x67')]({},_0x57f251,_0x494779[_0x64a8('0x68')]);return _0x1b788f[_0x64a8('0x122')](_0x57f251);}})[_0x64a8('0x14')](function(_0x22ec09){if(_0x22ec09){_0x17a7db=_0x22ec09[_0x64a8('0x5f')];if(!_0x494779[_0x64a8('0x5b')][_0x64a8('0x60')]('nolimit')){_0x57f251[_0x64a8('0x23')]=qs[_0x64a8('0x23')](_0x494779[_0x64a8('0x5b')][_0x64a8('0x23')]);_0x57f251[_0x64a8('0x26')]=qs[_0x64a8('0x26')](_0x494779['query'][_0x64a8('0x26')]);}return _0x1b788f[_0x64a8('0x122')](_0x57f251);}})['then'](function(_0x1e7630){if(_0x1e7630){return _0x1e7630?{'count':_0x17a7db,'rows':_0x1e7630}:null;}})['then'](respondWithResult(_0x2641db,null))['catch'](handleError(_0x2641db,null));};exports[_0x64a8('0x123')]=function(_0xcb46b0,_0x5f25b5){var _0x1019fd=_0xcb46b0[_0x64a8('0x5b')][_0x64a8('0x124')]===_0x64a8('0x125')?_0x64a8('0x126'):'onlineForm';return db[_0x64a8('0x55')]['find']({'attributes':['id',_0x1019fd],'where':{'id':_0xcb46b0[_0x64a8('0x6c')]['id']}})[_0x64a8('0x14')](handleEntityNotFound(_0x5f25b5,null))[_0x64a8('0x14')](function(_0x3fbed4){if(_0x3fbed4){var _0x2d92cb=_0x3fbed4[_0x1019fd];var _0x9b8a24=_0x2d92cb&&_0x2d92cb['items']?_0x2d92cb[_0x64a8('0x127')]:[];_0x5f25b5[_0x64a8('0x2f')]({'fromKey':_['isNil'](_0x2d92cb[_0x64a8('0x128')])?undefined:_0x2d92cb[_0x64a8('0x128')],'count':_0x9b8a24[_0x64a8('0x5f')],'rows':_0x9b8a24});}})['catch'](handleError(_0x5f25b5,null));};exports[_0x64a8('0x129')]=function(_0x445686,_0x35e000){var _0x3bcd8d={'raw':![],'where':{}};var _0x185296={};var _0x1ccb30={'count':0x0,'rows':[]};return db['ChatWebsite'][_0x64a8('0x7b')]({'where':{'id':_0x445686[_0x64a8('0x6c')]['id']}})['then'](handleEntityNotFound(_0x35e000,null))[_0x64a8('0x14')](function(_0x39639b){if(_0x39639b){_0x185296[_0x64a8('0x4d')]=_[_0x64a8('0x59')](db['ChatOfflineMessage'][_0x64a8('0x56')]);_0x185296[_0x64a8('0x5b')]=_['keys'](_0x445686[_0x64a8('0x5b')]);_0x185296[_0x64a8('0x5a')]=_[_0x64a8('0x5d')](_0x185296[_0x64a8('0x4d')],_0x185296[_0x64a8('0x5b')]);_0x3bcd8d[_0x64a8('0x5c')]=_[_0x64a8('0x5d')](_0x185296[_0x64a8('0x4d')],qs['fields'](_0x445686[_0x64a8('0x5b')][_0x64a8('0x5e')]));_0x3bcd8d[_0x64a8('0x5c')]=_0x3bcd8d[_0x64a8('0x5c')][_0x64a8('0x5f')]?_0x3bcd8d[_0x64a8('0x5c')]:_0x185296[_0x64a8('0x4d')];if(!_0x445686[_0x64a8('0x5b')]['hasOwnProperty'](_0x64a8('0x61'))){_0x3bcd8d[_0x64a8('0x23')]=qs[_0x64a8('0x23')](_0x445686[_0x64a8('0x5b')]['limit']);_0x3bcd8d[_0x64a8('0x26')]=qs[_0x64a8('0x26')](_0x445686['query'][_0x64a8('0x26')]);}_0x3bcd8d[_0x64a8('0x62')]=qs[_0x64a8('0x63')](_0x445686[_0x64a8('0x5b')][_0x64a8('0x63')]);_0x3bcd8d[_0x64a8('0x64')]=qs[_0x64a8('0x5a')](_['pick'](_0x445686[_0x64a8('0x5b')],_0x185296[_0x64a8('0x5a')]));_0x3bcd8d[_0x64a8('0x64')]['ChatWebsiteId']=_0x39639b['id'];if(_0x445686[_0x64a8('0x5b')][_0x64a8('0x65')]){_0x3bcd8d['where']=_[_0x64a8('0x67')](_0x3bcd8d['where'],{'$or':_['map'](_0x3bcd8d[_0x64a8('0x5c')],function(_0x324e39){var _0x52b2e5={};_0x52b2e5[_0x324e39]={'$like':'%'+_0x445686['query'][_0x64a8('0x65')]+'%'};return _0x52b2e5;})});}_0x3bcd8d=_[_0x64a8('0x67')]({},_0x3bcd8d,_0x445686['options']);return db['ChatOfflineMessage'][_0x64a8('0x25')]({'where':_0x3bcd8d[_0x64a8('0x64')]})[_0x64a8('0x14')](function(_0x6122c8){_0x1ccb30[_0x64a8('0x25')]=_0x6122c8;if(_0x445686[_0x64a8('0x5b')][_0x64a8('0x6e')]){_0x3bcd8d[_0x64a8('0x69')]=[{'all':!![]}];}else{_0x3bcd8d[_0x64a8('0x69')]=[{'model':db[_0x64a8('0x9c')],'as':'Contact','required':![]},{'model':db[_0x64a8('0x12a')],'as':'Attachments','required':![]}];}return db[_0x64a8('0xdf')]['findAll'](_0x3bcd8d);})[_0x64a8('0x14')](function(_0x2d4cba){_0x1ccb30[_0x64a8('0x6a')]=_0x2d4cba;return _0x1ccb30;});}})[_0x64a8('0x14')](respondWithFilteredResult(_0x35e000,_0x3bcd8d))['catch'](handleError(_0x35e000,null));};exports[_0x64a8('0x12b')]=function(_0x53722a,_0xe62f9c){return db[_0x64a8('0x55')]['find']({'where':{'id':_0x53722a[_0x64a8('0x6c')]['id']}})[_0x64a8('0x14')](handleEntityNotFound(_0xe62f9c,null))['then'](function(_0x355948){if(_0x355948){return _0x355948[_0x64a8('0x12b')](_0x53722a['body']['ids'],_['omit'](_0x53722a[_0x64a8('0x77')],[_0x64a8('0xfc'),'id'])||{})[_0x64a8('0xb2')](function(_0x5706a4){for(var _0x4e4c0c=0x0;_0x4e4c0c<_0x53722a[_0x64a8('0x77')][_0x64a8('0xfc')]['length'];_0x4e4c0c+=0x1){socket[_0x64a8('0x12c')](_0x64a8('0x12d'),{'UserId':Number(_0x53722a[_0x64a8('0x77')]['ids'][_0x4e4c0c]),'ChatWebsiteId':Number(_0x53722a[_0x64a8('0x6c')]['id'])});}return _0x5706a4;});}})['then'](respondWithResult(_0xe62f9c,null))['catch'](handleError(_0xe62f9c,null));};exports[_0x64a8('0x12e')]=function(_0x4e5897,_0x356b00){return db[_0x64a8('0x55')][_0x64a8('0x6f')]({'where':{'id':_0x4e5897['params']['id']}})[_0x64a8('0x14')](handleEntityNotFound(_0x356b00,null))[_0x64a8('0x14')](function(_0x5a2af3){if(_0x5a2af3){return _0x5a2af3[_0x64a8('0x12e')](_0x4e5897[_0x64a8('0x5b')][_0x64a8('0xfc')])[_0x64a8('0x14')](function(){if(_['isArray'](_0x4e5897[_0x64a8('0x5b')][_0x64a8('0xfc')])){for(var _0x51641=0x0;_0x51641<_0x4e5897[_0x64a8('0x5b')][_0x64a8('0xfc')]['length'];_0x51641+=0x1){socket[_0x64a8('0x12c')](_0x64a8('0x12f'),{'UserId':Number(_0x4e5897[_0x64a8('0x5b')][_0x64a8('0xfc')][_0x51641]),'ChatWebsiteId':Number(_0x4e5897[_0x64a8('0x6c')]['id'])});}}else{socket['emit'](_0x64a8('0x12f'),{'UserId':Number(_0x4e5897[_0x64a8('0x5b')]['ids']),'ChatWebsiteId':Number(_0x4e5897[_0x64a8('0x6c')]['id'])});}});}})[_0x64a8('0x14')](respondWithStatusCode(_0x356b00,null))[_0x64a8('0x1e')](handleError(_0x356b00,null));};exports[_0x64a8('0x130')]=function(_0x23d4dc,_0x3a9b78){var _0x4c957a={};var _0x255240={};var _0x5ade7c;var _0x10df4e;return db[_0x64a8('0x55')]['findOne']({'where':{'id':_0x23d4dc[_0x64a8('0x6c')]['id']}})['then'](handleEntityNotFound(_0x3a9b78,null))[_0x64a8('0x14')](function(_0x5d54c0){if(_0x5d54c0){_0x5ade7c=_0x5d54c0;_0x255240[_0x64a8('0x4d')]=_['keys'](db[_0x64a8('0xc9')][_0x64a8('0x56')]);_0x255240[_0x64a8('0x5b')]=_[_0x64a8('0x59')](_0x23d4dc[_0x64a8('0x5b')]);_0x255240[_0x64a8('0x5a')]=_[_0x64a8('0x5d')](_0x255240['model'],_0x255240[_0x64a8('0x5b')]);_0x4c957a[_0x64a8('0x5c')]=_['intersection'](_0x255240['model'],qs[_0x64a8('0x5e')](_0x23d4dc[_0x64a8('0x5b')][_0x64a8('0x5e')]));_0x4c957a[_0x64a8('0x5c')]=_0x4c957a[_0x64a8('0x5c')][_0x64a8('0x5f')]?_0x4c957a[_0x64a8('0x5c')]:_0x255240[_0x64a8('0x4d')];_0x4c957a[_0x64a8('0x62')]=qs['sort'](_0x23d4dc[_0x64a8('0x5b')][_0x64a8('0x63')]);_0x4c957a['where']=qs['filters'](_['pick'](_0x23d4dc['query'],_0x255240[_0x64a8('0x5a')]));if(_0x23d4dc[_0x64a8('0x5b')]['filter']){_0x4c957a['where']=_['merge'](_0x4c957a[_0x64a8('0x64')],{'$or':_[_0x64a8('0x54')](_0x4c957a[_0x64a8('0x5c')],function(_0x3c5d4d){var _0x10cb41={};_0x10cb41[_0x3c5d4d]={'$like':'%'+_0x23d4dc[_0x64a8('0x5b')][_0x64a8('0x65')]+'%'};return _0x10cb41;})});}_0x4c957a=_[_0x64a8('0x67')]({},_0x4c957a,_0x23d4dc[_0x64a8('0x68')]);return _0x5ade7c[_0x64a8('0x130')](_0x4c957a);}})[_0x64a8('0x14')](function(_0x580830){if(_0x580830){_0x10df4e=_0x580830['length'];if(!_0x23d4dc[_0x64a8('0x5b')]['hasOwnProperty'](_0x64a8('0x61'))){_0x4c957a[_0x64a8('0x23')]=qs[_0x64a8('0x23')](_0x23d4dc[_0x64a8('0x5b')]['limit']);_0x4c957a[_0x64a8('0x26')]=qs[_0x64a8('0x26')](_0x23d4dc[_0x64a8('0x5b')][_0x64a8('0x26')]);}return _0x5ade7c[_0x64a8('0x130')](_0x4c957a);}})[_0x64a8('0x14')](function(_0x4e5862){if(_0x4e5862){return _0x4e5862?{'count':_0x10df4e,'rows':_0x4e5862}:null;}})[_0x64a8('0x14')](respondWithResult(_0x3a9b78,null))[_0x64a8('0x1e')](handleError(_0x3a9b78,null));}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.events.js b/server/api/chatWebsite/chatWebsite.events.js index 88b541f..fbbc3c9 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 _0x5636=['hook','exports','events','../../mysqldb','update','remove','emit','hasOwnProperty'];(function(_0x3d6d80,_0x1689b7){var _0x30712a=function(_0x24c266){while(--_0x24c266){_0x3d6d80['push'](_0x3d6d80['shift']());}};_0x30712a(++_0x1689b7);}(_0x5636,0x102));var _0x6563=function(_0xc2588,_0x2ef0fc){_0xc2588=_0xc2588-0x0;var _0x126972=_0x5636[_0xc2588];return _0x126972;};'use strict';var EventEmitter=require(_0x6563('0x0'));var ChatWebsite=require(_0x6563('0x1'))['db']['ChatWebsite'];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x6563('0x2'),'afterDestroy':_0x6563('0x3')};function emitEvent(_0x115cc1){return function(_0x4ac653,_0x166a58,_0x12f62f){ChatWebsiteEvents[_0x6563('0x4')](_0x115cc1+':'+_0x4ac653['id'],_0x4ac653);ChatWebsiteEvents[_0x6563('0x4')](_0x115cc1,_0x4ac653);_0x12f62f(null);};}for(var e in events){if(events[_0x6563('0x5')](e)){var event=events[e];ChatWebsite[_0x6563('0x6')](e,emitEvent(event));}}module[_0x6563('0x7')]=ChatWebsiteEvents; \ No newline at end of file +var _0xb90d=['../../mysqldb','ChatWebsite','setMaxListeners','save','update','remove','hasOwnProperty','hook','exports'];(function(_0x1e4360,_0x930b9b){var _0x31e6b4=function(_0x49dd8e){while(--_0x49dd8e){_0x1e4360['push'](_0x1e4360['shift']());}};_0x31e6b4(++_0x930b9b);}(_0xb90d,0x17a));var _0xdb90=function(_0x27e86e,_0x49d030){_0x27e86e=_0x27e86e-0x0;var _0x57d83e=_0xb90d[_0x27e86e];return _0x57d83e;};'use strict';var EventEmitter=require('events');var ChatWebsite=require(_0xdb90('0x0'))['db'][_0xdb90('0x1')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0xdb90('0x2')](0x0);var events={'afterCreate':_0xdb90('0x3'),'afterUpdate':_0xdb90('0x4'),'afterDestroy':_0xdb90('0x5')};function emitEvent(_0x4a9a1f){return function(_0x3db22e,_0x12db41,_0x1b7d75){ChatWebsiteEvents['emit'](_0x4a9a1f+':'+_0x3db22e['id'],_0x3db22e);ChatWebsiteEvents['emit'](_0x4a9a1f,_0x3db22e);_0x1b7d75(null);};}for(var e in events){if(events[_0xdb90('0x6')](e)){var event=events[e];ChatWebsite[_0xdb90('0x7')](e,emitEvent(event));}}module[_0xdb90('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 964de83..bef4379 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 _0x9b26=['./chatWebsite.attributes','exports','define','chat_websites','lodash','../../config/logger','api','moment','bluebird','rimraf','../../config/environment'];(function(_0x2efd1d,_0x44f696){var _0x1ef3f6=function(_0x25da5f){while(--_0x25da5f){_0x2efd1d['push'](_0x2efd1d['shift']());}};_0x1ef3f6(++_0x44f696);}(_0x9b26,0x164));var _0x69b2=function(_0x27a729,_0x392de0){_0x27a729=_0x27a729-0x0;var _0x14f8c0=_0x9b26[_0x27a729];return _0x14f8c0;};'use strict';var _=require(_0x69b2('0x0'));var util=require('util');var logger=require(_0x69b2('0x1'))(_0x69b2('0x2'));var moment=require(_0x69b2('0x3'));var BPromise=require(_0x69b2('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x69b2('0x5'));var config=require(_0x69b2('0x6'));var attributes=require(_0x69b2('0x7'));module[_0x69b2('0x8')]=function(_0x2bdfa9,_0x18c865){return _0x2bdfa9[_0x69b2('0x9')]('ChatWebsite',attributes,{'tableName':_0x69b2('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x95bc=['path','./chatWebsite.attributes','exports','define','ChatWebsite','chat_websites','../../config/logger','api','bluebird','request-promise'];(function(_0x1fdd3e,_0x22735b){var _0x2da065=function(_0x45f972){while(--_0x45f972){_0x1fdd3e['push'](_0x1fdd3e['shift']());}};_0x2da065(++_0x22735b);}(_0x95bc,0x11e));var _0xc95b=function(_0x4276cc,_0x33756c){_0x4276cc=_0x4276cc-0x0;var _0x215fa9=_0x95bc[_0x4276cc];return _0x215fa9;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xc95b('0x0'))(_0xc95b('0x1'));var moment=require('moment');var BPromise=require(_0xc95b('0x2'));var rp=require(_0xc95b('0x3'));var fs=require('fs');var path=require(_0xc95b('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xc95b('0x5'));module[_0xc95b('0x6')]=function(_0x16b34b,_0x47de34){return _0x16b34b[_0xc95b('0x7')](_0xc95b('0x8'),attributes,{'tableName':_0xc95b('0x9'),'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 c3fbc83..4725f4a 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 _0x9ecf=['register','request','then','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./chatWebsite.socket'];(function(_0x314a8c,_0x1c2e8d){var _0x1d4607=function(_0x3df20c){while(--_0x3df20c){_0x314a8c['push'](_0x314a8c['shift']());}};_0x1d4607(++_0x1c2e8d);}(_0x9ecf,0xba));var _0xf9ec=function(_0x531b1e,_0x301978){_0x531b1e=_0x531b1e-0x0;var _0x1208b6=_0x9ecf[_0x531b1e];return _0x1208b6;};'use strict';var _=require(_0xf9ec('0x0'));var util=require(_0xf9ec('0x1'));var moment=require(_0xf9ec('0x2'));var BPromise=require(_0xf9ec('0x3'));var rs=require(_0xf9ec('0x4'));var fs=require('fs');var Redis=require(_0xf9ec('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xf9ec('0x6'));var logger=require(_0xf9ec('0x7'))(_0xf9ec('0x8'));var config=require(_0xf9ec('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xf9ec('0xa')][_0xf9ec('0xb')]({'port':0x232a});config[_0xf9ec('0xc')]=_[_0xf9ec('0xd')](config['redis'],{'host':_0xf9ec('0xe'),'port':0x18eb});var socket=require(_0xf9ec('0xf'))(new Redis(config[_0xf9ec('0xc')]));require(_0xf9ec('0x10'))[_0xf9ec('0x11')](socket);function respondWithRpcPromise(_0xa530bd,_0x4d91c0,_0x2a9ff){return new BPromise(function(_0x51b57b,_0x492b09){return client[_0xf9ec('0x12')](_0xa530bd,_0x2a9ff)[_0xf9ec('0x13')](function(_0x2bb375){logger['info'](_0xf9ec('0x14'),_0x4d91c0,_0xf9ec('0x15'));logger[_0xf9ec('0x16')](_0xf9ec('0x17'),_0x4d91c0,'request\x20sent',JSON['stringify'](_0x2bb375));if(_0x2bb375[_0xf9ec('0x18')]){if(_0x2bb375[_0xf9ec('0x18')][_0xf9ec('0x19')]===0x1f4){logger['error'](_0xf9ec('0x14'),_0x4d91c0,_0x2bb375[_0xf9ec('0x18')][_0xf9ec('0x1a')]);return _0x492b09(_0x2bb375[_0xf9ec('0x18')][_0xf9ec('0x1a')]);}logger['error'](_0xf9ec('0x14'),_0x4d91c0,_0x2bb375['error']['message']);return _0x51b57b(_0x2bb375['error'][_0xf9ec('0x1a')]);}else{logger['info']('ChatWebsite,\x20%s,\x20%s',_0x4d91c0,'request\x20sent');_0x51b57b(_0x2bb375[_0xf9ec('0x1b')][_0xf9ec('0x1a')]);}})[_0xf9ec('0x1c')](function(_0x432274){logger[_0xf9ec('0x18')](_0xf9ec('0x14'),_0x4d91c0,_0x432274);_0x492b09(_0x432274);});});} \ No newline at end of file +var _0x0e90=['../../config/environment','client','redis','localhost','socket.io-emitter','./chatWebsite.socket','register','request','info','request\x20sent','stringify','error','code','ChatWebsite,\x20%s,\x20%s','message','result','lodash','util','randomstring','ioredis','rpc'];(function(_0x260f28,_0x4e9b30){var _0x3aefcc=function(_0x223b18){while(--_0x223b18){_0x260f28['push'](_0x260f28['shift']());}};_0x3aefcc(++_0x4e9b30);}(_0x0e90,0x79));var _0x00e9=function(_0x3ea66c,_0x18b856){_0x3ea66c=_0x3ea66c-0x0;var _0x5b6f11=_0x0e90[_0x3ea66c];return _0x5b6f11;};'use strict';var _=require(_0x00e9('0x0'));var util=require(_0x00e9('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x00e9('0x2'));var fs=require('fs');var Redis=require(_0x00e9('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x00e9('0x4'));var config=require(_0x00e9('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x00e9('0x6')]['http']({'port':0x232a});config[_0x00e9('0x7')]=_['defaults'](config[_0x00e9('0x7')],{'host':_0x00e9('0x8'),'port':0x18eb});var socket=require(_0x00e9('0x9'))(new Redis(config[_0x00e9('0x7')]));require(_0x00e9('0xa'))[_0x00e9('0xb')](socket);function respondWithRpcPromise(_0x2ebfed,_0x16580f,_0xbd2a3b){return new BPromise(function(_0x521ff9,_0x38b403){return client[_0x00e9('0xc')](_0x2ebfed,_0xbd2a3b)['then'](function(_0x2f026c){logger[_0x00e9('0xd')]('ChatWebsite,\x20%s,\x20%s',_0x16580f,_0x00e9('0xe'));logger['debug']('ChatWebsite,\x20%s,\x20%s,\x20%s',_0x16580f,_0x00e9('0xe'),JSON[_0x00e9('0xf')](_0x2f026c));if(_0x2f026c['error']){if(_0x2f026c[_0x00e9('0x10')][_0x00e9('0x11')]===0x1f4){logger['error'](_0x00e9('0x12'),_0x16580f,_0x2f026c[_0x00e9('0x10')][_0x00e9('0x13')]);return _0x38b403(_0x2f026c[_0x00e9('0x10')][_0x00e9('0x13')]);}logger[_0x00e9('0x10')](_0x00e9('0x12'),_0x16580f,_0x2f026c[_0x00e9('0x10')]['message']);return _0x521ff9(_0x2f026c[_0x00e9('0x10')]['message']);}else{logger[_0x00e9('0xd')](_0x00e9('0x12'),_0x16580f,_0x00e9('0xe'));_0x521ff9(_0x2f026c[_0x00e9('0x14')]['message']);}})['catch'](function(_0x4911ab){logger[_0x00e9('0x10')](_0x00e9('0x12'),_0x16580f,_0x4911ab);_0x38b403(_0x4911ab);});});} \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.socket.js b/server/api/chatWebsite/chatWebsite.socket.js index c87b315..2da6c8b 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 _0x3e3d=['length','chatWebsite:','./chatWebsite.events','update','emit','removeListener'];(function(_0x4390e2,_0x123a88){var _0x198cfc=function(_0x4a29e5){while(--_0x4a29e5){_0x4390e2['push'](_0x4390e2['shift']());}};_0x198cfc(++_0x123a88);}(_0x3e3d,0x17c));var _0xd3e3=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x3e3d[_0x397e5f];return _0x5302b8;};'use strict';var ChatWebsiteEvents=require(_0xd3e3('0x0'));var events=['save','remove',_0xd3e3('0x1')];function createListener(_0xdf5d19,_0x5df2ac){return function(_0x25e845){_0x5df2ac[_0xd3e3('0x2')](_0xdf5d19,_0x25e845);};}function removeListener(_0x4e8124,_0x14355d){return function(){ChatWebsiteEvents[_0xd3e3('0x3')](_0x4e8124,_0x14355d);};}exports['register']=function(_0x35c649){for(var _0x5d9ab7=0x0,_0x3882b0=events[_0xd3e3('0x4')];_0x5d9ab7<_0x3882b0;_0x5d9ab7++){var _0x5b2da3=events[_0x5d9ab7];var _0x3e821c=createListener(_0xd3e3('0x5')+_0x5b2da3,_0x35c649);ChatWebsiteEvents['on'](_0x5b2da3,_0x3e821c);}}; \ No newline at end of file +var _0x4a40=['update','register','length','chatWebsite:','./chatWebsite.events','remove'];(function(_0x26da89,_0x264785){var _0xc95b7b=function(_0x230e5b){while(--_0x230e5b){_0x26da89['push'](_0x26da89['shift']());}};_0xc95b7b(++_0x264785);}(_0x4a40,0xc4));var _0x04a4=function(_0x51f09a,_0x21607f){_0x51f09a=_0x51f09a-0x0;var _0x23aabf=_0x4a40[_0x51f09a];return _0x23aabf;};'use strict';var ChatWebsiteEvents=require(_0x04a4('0x0'));var events=['save',_0x04a4('0x1'),_0x04a4('0x2')];function createListener(_0x2c51fc,_0x68934e){return function(_0x9e22a2){_0x68934e['emit'](_0x2c51fc,_0x9e22a2);};}function removeListener(_0x3966cf,_0x77c490){return function(){ChatWebsiteEvents['removeListener'](_0x3966cf,_0x77c490);};}exports[_0x04a4('0x3')]=function(_0x480027){for(var _0x4f93f2=0x0,_0x143112=events[_0x04a4('0x4')];_0x4f93f2<_0x143112;_0x4f93f2++){var _0x388062=events[_0x4f93f2];var _0x444866=createListener(_0x04a4('0x5')+_0x388062,_0x480027);ChatWebsiteEvents['on'](_0x388062,_0x444866);}}; \ No newline at end of file diff --git a/server/api/chatWebsite/index.js b/server/api/chatWebsite/index.js index 3af9107..f12314a 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 _0xd508=['offline','addInteraction','addApplications','/:id/proactive_actions','addProactiveActions','put','update','delete','/:id','destroy','removeDispositions','removeAnswers','exports','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','index','get','/describe','isAuthenticated','describe','show','getDispositions','/:id/canned_answers','getAnswers','/:id/logo','getLogo','getAvatar','/:id/customer_avatar','getCustomerAvatar','/:id/system_avatar','getSystemAvatar','/:id/interactions','/:id/snippet','getSnippet','/:id/applications','getProactiveActions','/:id/fields','getFields','/:id/offline_messages','getOfflineMessages','/:id/users','getAgents','post','create','/:id/dispositions','diskStorage','join','root','server/files/images/logos/','format','%s-%s','now','single','file','addLogo','/:id/avatar','server/files/images/avatars/','originalname','addCustomerAvatar','/:id/notify','notify','server/files','attachments','offline-chat','ensureDir','extname','replace','/:id/offline','any'];(function(_0x2e1878,_0x2a07ab){var _0x5adf07=function(_0x48e37d){while(--_0x48e37d){_0x2e1878['push'](_0x2e1878['shift']());}};_0x5adf07(++_0x2a07ab);}(_0xd508,0x1c9));var _0x8d50=function(_0x25599a,_0x4024a5){_0x25599a=_0x25599a-0x0;var _0x5b8d3d=_0xd508[_0x25599a];return _0x5b8d3d;};'use strict';var multer=require(_0x8d50('0x0'));var util=require('util');var path=require(_0x8d50('0x1'));var timeout=require('connect-timeout');var express=require(_0x8d50('0x2'));var router=express[_0x8d50('0x3')]();var fs_extra=require(_0x8d50('0x4'));var auth=require(_0x8d50('0x5'));var interaction=require(_0x8d50('0x6'));var config=require('../../config/environment');var controller=require('./chatWebsite.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x8d50('0x7')]);router[_0x8d50('0x8')](_0x8d50('0x9'),auth[_0x8d50('0xa')](),controller[_0x8d50('0xb')]);router[_0x8d50('0x8')]('/:id',auth[_0x8d50('0xa')](),controller[_0x8d50('0xc')]);router[_0x8d50('0x8')]('/:id/dispositions',auth[_0x8d50('0xa')](),controller[_0x8d50('0xd')]);router[_0x8d50('0x8')](_0x8d50('0xe'),auth[_0x8d50('0xa')](),controller[_0x8d50('0xf')]);router[_0x8d50('0x8')](_0x8d50('0x10'),controller[_0x8d50('0x11')]);router[_0x8d50('0x8')]('/:id/avatar',controller[_0x8d50('0x12')]);router['get'](_0x8d50('0x13'),controller[_0x8d50('0x14')]);router[_0x8d50('0x8')](_0x8d50('0x15'),controller[_0x8d50('0x16')]);router[_0x8d50('0x8')](_0x8d50('0x17'),auth['isAuthenticated'](),controller['getInteractions']);router[_0x8d50('0x8')](_0x8d50('0x18'),controller[_0x8d50('0x19')]);router[_0x8d50('0x8')](_0x8d50('0x1a'),auth[_0x8d50('0xa')](),controller['getApplications']);router['get']('/:id/proactive_actions',auth['isAuthenticated'](),controller[_0x8d50('0x1b')]);router['get'](_0x8d50('0x1c'),controller[_0x8d50('0x1d')]);router[_0x8d50('0x8')](_0x8d50('0x1e'),auth[_0x8d50('0xa')](),controller[_0x8d50('0x1f')]);router['get'](_0x8d50('0x20'),auth[_0x8d50('0xa')](),controller[_0x8d50('0x21')]);router[_0x8d50('0x22')]('/',auth[_0x8d50('0xa')](),controller[_0x8d50('0x23')]);router[_0x8d50('0x22')](_0x8d50('0x24'),auth['isAuthenticated'](),controller['addDisposition']);router['post']('/:id/canned_answers',auth[_0x8d50('0xa')](),controller['addAnswer']);var upload=multer({'storage':multer[_0x8d50('0x25')]({'destination':function(_0x2406a5,_0x1a5bc9,_0x3d41fb){_0x3d41fb(null,path[_0x8d50('0x26')](config[_0x8d50('0x27')],_0x8d50('0x28')));},'filename':function(_0x322965,_0x58ecd3,_0x247234){_0x247234(null,util[_0x8d50('0x29')](_0x8d50('0x2a'),Date[_0x8d50('0x2b')](),_0x58ecd3['originalname']));}})});router['post'](_0x8d50('0x10'),upload[_0x8d50('0x2c')](_0x8d50('0x2d')),controller[_0x8d50('0x2e')]);var upload=multer({'storage':multer[_0x8d50('0x25')]({'destination':function(_0x5c529f,_0x28c59d,_0x1a5420){_0x1a5420(null,path['join'](config[_0x8d50('0x27')],'server/files/images/avatars/'));},'filename':function(_0x1108b7,_0x23f82f,_0x57ff18){_0x57ff18(null,util[_0x8d50('0x29')](_0x8d50('0x2a'),Date[_0x8d50('0x2b')](),_0x23f82f['originalname']));}})});router[_0x8d50('0x22')](_0x8d50('0x2f'),upload[_0x8d50('0x2c')](_0x8d50('0x2d')),controller['addAvatar']);var upload=multer({'storage':multer[_0x8d50('0x25')]({'destination':function(_0x2c2311,_0x9a8f65,_0x440384){_0x440384(null,path[_0x8d50('0x26')](config[_0x8d50('0x27')],_0x8d50('0x30')));},'filename':function(_0x5781e6,_0x4a6467,_0x43ab50){_0x43ab50(null,util[_0x8d50('0x29')](_0x8d50('0x2a'),Date[_0x8d50('0x2b')](),_0x4a6467[_0x8d50('0x31')]));}})});router[_0x8d50('0x22')](_0x8d50('0x13'),upload[_0x8d50('0x2c')]('file'),controller[_0x8d50('0x32')]);var upload=multer({'storage':multer[_0x8d50('0x25')]({'destination':function(_0x9ed95e,_0xd7e3ad,_0x15cb4b){_0x15cb4b(null,path['join'](config['root'],_0x8d50('0x30')));},'filename':function(_0x4b8253,_0x42310b,_0xfd50f){_0xfd50f(null,util[_0x8d50('0x29')](_0x8d50('0x2a'),Date[_0x8d50('0x2b')](),_0x42310b[_0x8d50('0x31')]));}})});router[_0x8d50('0x22')](_0x8d50('0x15'),upload[_0x8d50('0x2c')]('file'),controller['addSystemAvatar']);router[_0x8d50('0x22')](_0x8d50('0x33'),controller[_0x8d50('0x34')]);const offlineUploadMulter=multer({'storage':multer['diskStorage']({'destination':function(_0x279a27,_0x37f8c3,_0xaf9661){const _0x32073d=path[_0x8d50('0x26')](config[_0x8d50('0x27')],_0x8d50('0x35'),_0x8d50('0x36'),_0x8d50('0x37'));fs_extra[_0x8d50('0x38')](_0x32073d,function(){_0xaf9661(null,_0x32073d);});},'filename':function(_0x5f8ffe,_0xbb47f1,_0x5f0e93){const _0x93846f=_0xbb47f1[_0x8d50('0x31')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x50a05c=path[_0x8d50('0x39')](_0x93846f);const _0x3a0492=Date['now']()+'-'+_0x93846f[_0x8d50('0x3a')](_0x50a05c,'')+_0x50a05c;_0x5f0e93(null,_0x3a0492);}})});router[_0x8d50('0x22')](_0x8d50('0x3b'),offlineUploadMulter[_0x8d50('0x3c')](),controller[_0x8d50('0x3d')]);router[_0x8d50('0x22')](_0x8d50('0x17'),auth[_0x8d50('0xa')](),controller[_0x8d50('0x3e')]);router[_0x8d50('0x22')](_0x8d50('0x1a'),auth[_0x8d50('0xa')](),controller[_0x8d50('0x3f')]);router[_0x8d50('0x22')](_0x8d50('0x40'),auth[_0x8d50('0xa')](),controller[_0x8d50('0x41')]);router[_0x8d50('0x22')]('/:id/users',auth['isAuthenticated'](),controller['addAgents']);router[_0x8d50('0x42')]('/:id',auth['isAuthenticated'](),controller[_0x8d50('0x43')]);router[_0x8d50('0x44')](_0x8d50('0x45'),auth['isAuthenticated'](),controller[_0x8d50('0x46')]);router['delete'](_0x8d50('0x24'),auth[_0x8d50('0xa')](),controller[_0x8d50('0x47')]);router[_0x8d50('0x44')](_0x8d50('0xe'),auth['isAuthenticated'](),controller[_0x8d50('0x48')]);router['delete'](_0x8d50('0x20'),auth[_0x8d50('0xa')](),controller['removeAgents']);module[_0x8d50('0x49')]=router; \ No newline at end of file +var _0xacc1=['diskStorage','join','root','%s-%s','originalname','file','addLogo','server/files/images/avatars/','format','single','addAvatar','now','addCustomerAvatar','addSystemAvatar','/:id/notify','server/files','attachments','offline-chat','replace','extname','/:id/interactions','addInteraction','addAgents','update','delete','/:id','destroy','removeDispositions','removeAnswers','removeAgents','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','isAuthenticated','index','get','/describe','describe','show','/:id/dispositions','getAnswers','getLogo','/:id/avatar','getAvatar','/:id/customer_avatar','getCustomerAvatar','/:id/system_avatar','getSystemAvatar','getInteractions','getSnippet','/:id/applications','getApplications','/:id/proactive_actions','getProactiveActions','/:id/fields','/:id/offline_messages','getOfflineMessages','/:id/users','getAgents','post','addDisposition','/:id/canned_answers'];(function(_0xc75e69,_0x19ac94){var _0x447f25=function(_0x25125c){while(--_0x25125c){_0xc75e69['push'](_0xc75e69['shift']());}};_0x447f25(++_0x19ac94);}(_0xacc1,0x1f4));var _0x1acc=function(_0x1e2e3b,_0x5d37c0){_0x1e2e3b=_0x1e2e3b-0x0;var _0x21bae3=_0xacc1[_0x1e2e3b];return _0x21bae3;};'use strict';var multer=require('multer');var util=require(_0x1acc('0x0'));var path=require(_0x1acc('0x1'));var timeout=require(_0x1acc('0x2'));var express=require(_0x1acc('0x3'));var router=express[_0x1acc('0x4')]();var fs_extra=require(_0x1acc('0x5'));var auth=require(_0x1acc('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./chatWebsite.controller');router['get']('/',auth[_0x1acc('0x7')](),controller[_0x1acc('0x8')]);router[_0x1acc('0x9')](_0x1acc('0xa'),auth[_0x1acc('0x7')](),controller[_0x1acc('0xb')]);router[_0x1acc('0x9')]('/:id',auth[_0x1acc('0x7')](),controller[_0x1acc('0xc')]);router[_0x1acc('0x9')](_0x1acc('0xd'),auth[_0x1acc('0x7')](),controller['getDispositions']);router['get']('/:id/canned_answers',auth['isAuthenticated'](),controller[_0x1acc('0xe')]);router[_0x1acc('0x9')]('/:id/logo',controller[_0x1acc('0xf')]);router['get'](_0x1acc('0x10'),controller[_0x1acc('0x11')]);router[_0x1acc('0x9')](_0x1acc('0x12'),controller[_0x1acc('0x13')]);router['get'](_0x1acc('0x14'),controller[_0x1acc('0x15')]);router[_0x1acc('0x9')]('/:id/interactions',auth[_0x1acc('0x7')](),controller[_0x1acc('0x16')]);router[_0x1acc('0x9')]('/:id/snippet',controller[_0x1acc('0x17')]);router[_0x1acc('0x9')](_0x1acc('0x18'),auth[_0x1acc('0x7')](),controller[_0x1acc('0x19')]);router[_0x1acc('0x9')](_0x1acc('0x1a'),auth[_0x1acc('0x7')](),controller[_0x1acc('0x1b')]);router['get'](_0x1acc('0x1c'),controller['getFields']);router['get'](_0x1acc('0x1d'),auth[_0x1acc('0x7')](),controller[_0x1acc('0x1e')]);router['get'](_0x1acc('0x1f'),auth[_0x1acc('0x7')](),controller[_0x1acc('0x20')]);router['post']('/',auth[_0x1acc('0x7')](),controller['create']);router[_0x1acc('0x21')](_0x1acc('0xd'),auth[_0x1acc('0x7')](),controller[_0x1acc('0x22')]);router[_0x1acc('0x21')](_0x1acc('0x23'),auth[_0x1acc('0x7')](),controller['addAnswer']);var upload=multer({'storage':multer[_0x1acc('0x24')]({'destination':function(_0x43a860,_0x5b8378,_0x626f1d){_0x626f1d(null,path[_0x1acc('0x25')](config[_0x1acc('0x26')],'server/files/images/logos/'));},'filename':function(_0x385efc,_0x40fcab,_0x6c4826){_0x6c4826(null,util['format'](_0x1acc('0x27'),Date['now'](),_0x40fcab[_0x1acc('0x28')]));}})});router[_0x1acc('0x21')]('/:id/logo',upload['single'](_0x1acc('0x29')),controller[_0x1acc('0x2a')]);var upload=multer({'storage':multer[_0x1acc('0x24')]({'destination':function(_0x5c4f03,_0x412efa,_0x16fb3f){_0x16fb3f(null,path[_0x1acc('0x25')](config['root'],_0x1acc('0x2b')));},'filename':function(_0x147e4a,_0x355609,_0x2aa899){_0x2aa899(null,util[_0x1acc('0x2c')](_0x1acc('0x27'),Date['now'](),_0x355609[_0x1acc('0x28')]));}})});router[_0x1acc('0x21')](_0x1acc('0x10'),upload[_0x1acc('0x2d')](_0x1acc('0x29')),controller[_0x1acc('0x2e')]);var upload=multer({'storage':multer[_0x1acc('0x24')]({'destination':function(_0x29b211,_0x18a6d8,_0x308b38){_0x308b38(null,path[_0x1acc('0x25')](config['root'],_0x1acc('0x2b')));},'filename':function(_0x500259,_0x588bc4,_0x3a1596){_0x3a1596(null,util[_0x1acc('0x2c')]('%s-%s',Date[_0x1acc('0x2f')](),_0x588bc4[_0x1acc('0x28')]));}})});router[_0x1acc('0x21')](_0x1acc('0x12'),upload['single'](_0x1acc('0x29')),controller[_0x1acc('0x30')]);var upload=multer({'storage':multer[_0x1acc('0x24')]({'destination':function(_0x252d97,_0xf82be6,_0x3ba9a8){_0x3ba9a8(null,path['join'](config['root'],_0x1acc('0x2b')));},'filename':function(_0x3c5902,_0x41e8b0,_0xa1c640){_0xa1c640(null,util[_0x1acc('0x2c')]('%s-%s',Date[_0x1acc('0x2f')](),_0x41e8b0['originalname']));}})});router[_0x1acc('0x21')]('/:id/system_avatar',upload['single']('file'),controller[_0x1acc('0x31')]);router[_0x1acc('0x21')](_0x1acc('0x32'),controller['notify']);const offlineUploadMulter=multer({'storage':multer[_0x1acc('0x24')]({'destination':function(_0x36e9fb,_0x2e0898,_0x3d4cdf){const _0x3aef3f=path[_0x1acc('0x25')](config[_0x1acc('0x26')],_0x1acc('0x33'),_0x1acc('0x34'),_0x1acc('0x35'));fs_extra['ensureDir'](_0x3aef3f,function(){_0x3d4cdf(null,_0x3aef3f);});},'filename':function(_0x525c5f,_0x2789a8,_0x16f204){const _0x1853f3=_0x2789a8[_0x1acc('0x28')][_0x1acc('0x36')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x31829b=path[_0x1acc('0x37')](_0x1853f3);const _0x566c28=Date['now']()+'-'+_0x1853f3[_0x1acc('0x36')](_0x31829b,'')+_0x31829b;_0x16f204(null,_0x566c28);}})});router[_0x1acc('0x21')]('/:id/offline',offlineUploadMulter['any'](),controller['offline']);router[_0x1acc('0x21')](_0x1acc('0x38'),auth[_0x1acc('0x7')](),controller[_0x1acc('0x39')]);router['post'](_0x1acc('0x18'),auth[_0x1acc('0x7')](),controller['addApplications']);router[_0x1acc('0x21')](_0x1acc('0x1a'),auth[_0x1acc('0x7')](),controller['addProactiveActions']);router[_0x1acc('0x21')](_0x1acc('0x1f'),auth[_0x1acc('0x7')](),controller[_0x1acc('0x3a')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0x1acc('0x3b')]);router[_0x1acc('0x3c')](_0x1acc('0x3d'),auth[_0x1acc('0x7')](),controller[_0x1acc('0x3e')]);router[_0x1acc('0x3c')](_0x1acc('0xd'),auth['isAuthenticated'](),controller[_0x1acc('0x3f')]);router[_0x1acc('0x3c')](_0x1acc('0x23'),auth[_0x1acc('0x7')](),controller[_0x1acc('0x40')]);router['delete'](_0x1acc('0x1f'),auth[_0x1acc('0x7')](),controller[_0x1acc('0x41')]);module[_0x1acc('0x42')]=router; \ No newline at end of file diff --git a/server/api/client-side-logs.js b/server/api/client-side-logs.js index 4f6d41d..fa53fab 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 _0x7488=['env','production','get','Client-Side\x20logger\x20not\x20found!','expressEndpoint','isAuthenticated','exports','beaver-logger/server','../components/auth/service','../config/environment','Router'];(function(_0x5b7788,_0x309ae5){var _0x573871=function(_0x5c79fd){while(--_0x5c79fd){_0x5b7788['push'](_0x5b7788['shift']());}};_0x573871(++_0x309ae5);}(_0x7488,0x75));var _0x8748=function(_0x348c6a,_0x328c73){_0x348c6a=_0x348c6a-0x0;var _0x2c53e7=_0x7488[_0x348c6a];return _0x2c53e7;};var beaverLogger=require(_0x8748('0x0'));var express=require('express');var auth=require(_0x8748('0x1'));var config=require(_0x8748('0x2'));var router=express[_0x8748('0x3')]();var isProduction=config[_0x8748('0x4')]===_0x8748('0x5')||![];function clientSideLogs(_0xd8c8d3,_0x43a572,_0x6f6c83){var _0x38a167=_0xd8c8d3['app'][_0x8748('0x6')]('client-side-logger');if(!_0x38a167){throw new Error(_0x8748('0x7'));}return beaverLogger[_0x8748('0x8')]({'uri':'/client-logs','logger':_0x38a167,'enableCors':!isProduction})(_0xd8c8d3,_0x43a572,_0x6f6c83);}router['use'](auth[_0x8748('0x9')](),clientSideLogs);module[_0x8748('0xa')]=router; \ No newline at end of file +var _0xbf44=['app','client-side-logger','Client-Side\x20logger\x20not\x20found!','expressEndpoint','exports','beaver-logger/server','express','../components/auth/service','Router','env'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0xbf44,0xd7));var _0x4bf4=function(_0x5ab39b,_0x346b1b){_0x5ab39b=_0x5ab39b-0x0;var _0x3150e2=_0xbf44[_0x5ab39b];return _0x3150e2;};var beaverLogger=require(_0x4bf4('0x0'));var express=require(_0x4bf4('0x1'));var auth=require(_0x4bf4('0x2'));var config=require('../config/environment');var router=express[_0x4bf4('0x3')]();var isProduction=config[_0x4bf4('0x4')]==='production'||![];function clientSideLogs(_0x135d2a,_0x19b229,_0x3c0d3f){var _0x4bd87d=_0x135d2a[_0x4bf4('0x5')]['get'](_0x4bf4('0x6'));if(!_0x4bd87d){throw new Error(_0x4bf4('0x7'));}return beaverLogger[_0x4bf4('0x8')]({'uri':'/client-logs','logger':_0x4bd87d,'enableCors':!isProduction})(_0x135d2a,_0x19b229,_0x3c0d3f);}router['use'](auth['isAuthenticated'](),clientSideLogs);module[_0x4bf4('0x9')]=router; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.attributes.js b/server/api/cloudProvider/cloudProvider.attributes.js index 6ce17dd..8387e7e 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 _0xfa1a=['MicrosoftAzure\x20=>\x20tenant','MicrosoftAzure\x20=>\x20client_secret','MicrosoftAzure\x20=>\x20redirect_uri','TEXT','MicrosoftAzure\x20=>\x20access_token','MicrosoftAzure\x20=>\x20Dynamics365\x20=>\x20remote_uri','sequelize','exports','ENUM','AmazonAWS','Google','Outlook365','Dynamics365','STRING'];(function(_0xa07d7b,_0x2933c8){var _0x307e67=function(_0x1cd091){while(--_0x1cd091){_0xa07d7b['push'](_0xa07d7b['shift']());}};_0x307e67(++_0x2933c8);}(_0xfa1a,0x1b8));var _0xafa1=function(_0x3815c2,_0x1f54e3){_0x3815c2=_0x3815c2-0x0;var _0x271f88=_0xfa1a[_0x3815c2];return _0x271f88;};'use strict';var Sequelize=require(_0xafa1('0x0'));module[_0xafa1('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0xafa1('0x2')](_0xafa1('0x3'),_0xafa1('0x4'),'MicrosoftAzure'),'allowNull':![],'validate':{'notEmpty':!![]}},'type':{'type':Sequelize['ENUM'](_0xafa1('0x5'),_0xafa1('0x6'))},'data1':{'type':Sequelize['STRING'],'comment':'MicrosoftAzure\x20=>\x20client_id'},'data2':{'type':Sequelize[_0xafa1('0x7')],'comment':_0xafa1('0x8')},'data3':{'type':Sequelize[_0xafa1('0x7')],'comment':_0xafa1('0x9')},'data4':{'type':Sequelize[_0xafa1('0x7')],'comment':_0xafa1('0xa')},'data5':{'type':Sequelize[_0xafa1('0xb')],'comment':_0xafa1('0xc')},'data6':{'type':Sequelize[_0xafa1('0xb')],'comment':'MicrosoftAzure\x20=>\x20refresh_token'},'data7':{'type':Sequelize[_0xafa1('0xb')],'comment':_0xafa1('0xd')}}; \ No newline at end of file +var _0x0dd8=['STRING','ENUM','AmazonAWS','Google','MicrosoftAzure','Outlook365','Dynamics365','MicrosoftAzure\x20=>\x20client_id','MicrosoftAzure\x20=>\x20client_secret','MicrosoftAzure\x20=>\x20redirect_uri','TEXT','MicrosoftAzure\x20=>\x20access_token','MicrosoftAzure\x20=>\x20refresh_token','MicrosoftAzure\x20=>\x20Dynamics365\x20=>\x20remote_uri','exports'];(function(_0x469c7c,_0x4a54c6){var _0x4b8ffa=function(_0x2bff74){while(--_0x2bff74){_0x469c7c['push'](_0x469c7c['shift']());}};_0x4b8ffa(++_0x4a54c6);}(_0x0dd8,0xef));var _0x80dd=function(_0x3c53fe,_0xad83fb){_0x3c53fe=_0x3c53fe-0x0;var _0x1bef0d=_0x0dd8[_0x3c53fe];return _0x1bef0d;};'use strict';var Sequelize=require('sequelize');module[_0x80dd('0x0')]={'name':{'type':Sequelize[_0x80dd('0x1')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0x80dd('0x2')](_0x80dd('0x3'),_0x80dd('0x4'),_0x80dd('0x5')),'allowNull':![],'validate':{'notEmpty':!![]}},'type':{'type':Sequelize['ENUM'](_0x80dd('0x6'),_0x80dd('0x7'))},'data1':{'type':Sequelize['STRING'],'comment':_0x80dd('0x8')},'data2':{'type':Sequelize[_0x80dd('0x1')],'comment':'MicrosoftAzure\x20=>\x20tenant'},'data3':{'type':Sequelize[_0x80dd('0x1')],'comment':_0x80dd('0x9')},'data4':{'type':Sequelize[_0x80dd('0x1')],'comment':_0x80dd('0xa')},'data5':{'type':Sequelize[_0x80dd('0xb')],'comment':_0x80dd('0xc')},'data6':{'type':Sequelize[_0x80dd('0xb')],'comment':_0x80dd('0xd')},'data7':{'type':Sequelize[_0x80dd('0xb')],'comment':_0x80dd('0xe')}}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.controller.js b/server/api/cloudProvider/cloudProvider.controller.js index 5d58035..f1a7689 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 _0xf5bc=['code','data5','data6','refresh_token','startRefreshInterval','microsoftAuthorization:success','microsoftAuthorization:error','Invalid\x20authentication\x20state\x20parameter','stringify','lodash','ioredis','../../components/encryptor','../../config/environment','../../config/logger','../../mysqldb','./cloudProvider.oauth','localhost','socket.io-emitter','redis','status','end','json','offset','limit','count','set','Content-Range','update','destroy','then','sendStatus','error','name','send','slice','index','map','CloudProvider','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','sort','where','pick','VIRTUAL','filter','merge','options','includeAll','include','findAll','service','MicrosoftAzure','decryptString','data3','catch','show','params','find','body','Name\x20parameter\x20not\x20specified','Service\x20parameter\x20not\x20specified','values','includes','Invalid\x20service\x20parameter.\x20Allowed\x20values:\x20','join','encryptString','create','oauth2MicrosoftAuthorize','findOne','generateMicrosoftAuthorizationUrl','user','oauth2MicrosoftCallback','get','state','Invalid\x20state\x20parameter','from','base64','toString','ascii','parse','isValidIdToken','id_token','oauth2Claims','Unable\x20to\x20validate\x20id_token','getOauth2MicrosoftAccessToken'];(function(_0x47646a,_0x5eda31){var _0x491280=function(_0x3132bf){while(--_0x3132bf){_0x47646a['push'](_0x47646a['shift']());}};_0x491280(++_0x5eda31);}(_0xf5bc,0x126));var _0xcf5b=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0xf5bc[_0x397e5f];return _0x5302b8;};'use strict';var _=require(_0xcf5b('0x0'));var Redis=require(_0xcf5b('0x1'));var qs=require('../../components/parsers/qs');var encryptor=require(_0xcf5b('0x2'));var config=require(_0xcf5b('0x3'));var logger=require(_0xcf5b('0x4'))('api');var db=require(_0xcf5b('0x5'))['db'];var oauth=require(_0xcf5b('0x6'));config['redis']=_['defaults'](config['redis'],{'host':_0xcf5b('0x7'),'port':0x18eb});var socket=require(_0xcf5b('0x8'))(new Redis(config[_0xcf5b('0x9')]));var redis=new Redis(config[_0xcf5b('0x9')]);function respondWithStatusCode(_0x29ccdd,_0x4f9c1d){_0x4f9c1d=_0x4f9c1d||0xcc;return function(_0x37019c){if(_0x37019c){return _0x29ccdd['sendStatus'](_0x4f9c1d);}return _0x29ccdd[_0xcf5b('0xa')](_0x4f9c1d)[_0xcf5b('0xb')]();};}function respondWithResult(_0x73607f,_0x20e8e2){_0x20e8e2=_0x20e8e2||0xc8;return function(_0x258126){if(_0x258126){return _0x73607f[_0xcf5b('0xa')](_0x20e8e2)[_0xcf5b('0xc')](_0x258126);}};}function respondWithFilteredResult(_0x3bd30c,_0x180c48){return function(_0x41bde6){if(_0x41bde6){var _0x2bc88b=typeof _0x180c48[_0xcf5b('0xd')]==='undefined'&&typeof _0x180c48[_0xcf5b('0xe')]==='undefined';var _0x1a483d=_0x41bde6[_0xcf5b('0xf')];var _0xe285aa=_0x2bc88b?0x0:_0x180c48[_0xcf5b('0xd')];var _0x568ac1=_0x2bc88b?_0x41bde6[_0xcf5b('0xf')]:_0x180c48[_0xcf5b('0xd')]+_0x180c48[_0xcf5b('0xe')];var _0x2bf234;if(_0x568ac1>=_0x1a483d){_0x568ac1=_0x1a483d;_0x2bf234=0xc8;}else{_0x2bf234=0xce;}_0x3bd30c['status'](_0x2bf234);return _0x3bd30c[_0xcf5b('0x10')](_0xcf5b('0x11'),_0xe285aa+'-'+_0x568ac1+'/'+_0x1a483d)[_0xcf5b('0xc')](_0x41bde6);}return null;};}function saveUpdates(_0x310943){return function(_0x1c2a57){if(_0x1c2a57){return _0x1c2a57[_0xcf5b('0x12')](_0x310943)['then'](function(_0x2b4a89){return _0x2b4a89;});}return null;};}function removeEntity(_0x4ab31e){return function(_0x2831b5){if(_0x2831b5){return _0x2831b5[_0xcf5b('0x13')]()[_0xcf5b('0x14')](function(){_0x4ab31e[_0xcf5b('0xa')](0xcc)[_0xcf5b('0xb')]();});}};}function handleEntityNotFound(_0x52fc62){return function(_0x58caf6){if(!_0x58caf6){_0x52fc62[_0xcf5b('0x15')](0x194);}return _0x58caf6;};}function handleError(_0x30103b,_0x51a716){_0x51a716=_0x51a716||0x1f4;return function(_0x12520e){logger[_0xcf5b('0x16')](_0x12520e['stack']);if(_0x12520e[_0xcf5b('0x17')]){delete _0x12520e[_0xcf5b('0x17')];}_0x30103b[_0xcf5b('0xa')](_0x51a716)[_0xcf5b('0x18')](_0x12520e);};}function maskClientSecret(_0x547630){return _['padEnd'](_0x547630[_0xcf5b('0x19')](0x0,0x3),0x14,'*');}exports[_0xcf5b('0x1a')]=function(_0xea656a,_0xcc0b2a){var _0x3d1efa={},_0x2b2168={},_0x34df38={'count':0x0,'rows':[]};var _0x4d33bd=_[_0xcf5b('0x1b')](db[_0xcf5b('0x1c')][_0xcf5b('0x1d')],function(_0x435a87){return{'name':_0x435a87[_0xcf5b('0x1e')],'type':_0x435a87[_0xcf5b('0x1f')][_0xcf5b('0x20')]};});_0x2b2168['model']=_[_0xcf5b('0x1b')](_0x4d33bd,_0xcf5b('0x17'));_0x2b2168[_0xcf5b('0x21')]=_[_0xcf5b('0x22')](_0xea656a[_0xcf5b('0x21')]);_0x2b2168[_0xcf5b('0x23')]=_[_0xcf5b('0x24')](_0x2b2168[_0xcf5b('0x25')],_0x2b2168['query']);_0x3d1efa[_0xcf5b('0x26')]=_[_0xcf5b('0x24')](_0x2b2168[_0xcf5b('0x25')],qs[_0xcf5b('0x27')](_0xea656a[_0xcf5b('0x21')][_0xcf5b('0x27')]));_0x3d1efa[_0xcf5b('0x26')]=_0x3d1efa[_0xcf5b('0x26')]['length']?_0x3d1efa[_0xcf5b('0x26')]:_0x2b2168[_0xcf5b('0x25')];if(!_0xea656a[_0xcf5b('0x21')][_0xcf5b('0x28')]('nolimit')){_0x3d1efa[_0xcf5b('0xe')]=qs[_0xcf5b('0xe')](_0xea656a[_0xcf5b('0x21')][_0xcf5b('0xe')]);_0x3d1efa['offset']=qs[_0xcf5b('0xd')](_0xea656a[_0xcf5b('0x21')][_0xcf5b('0xd')]);}_0x3d1efa['order']=qs[_0xcf5b('0x29')](_0xea656a['query'][_0xcf5b('0x29')]);_0x3d1efa[_0xcf5b('0x2a')]=qs['filters'](_[_0xcf5b('0x2b')](_0xea656a[_0xcf5b('0x21')],_0x2b2168[_0xcf5b('0x23')]),_0x4d33bd);if(_0xea656a[_0xcf5b('0x21')]['filter']){_0x3d1efa[_0xcf5b('0x2a')]=_['merge'](_0x3d1efa[_0xcf5b('0x2a')],{'$or':_[_0xcf5b('0x1b')](_0x4d33bd,function(_0x1da922){if(_0x1da922[_0xcf5b('0x1f')]!==_0xcf5b('0x2c')){var _0x148da0={};_0x148da0[_0x1da922[_0xcf5b('0x17')]]={'$like':'%'+_0xea656a[_0xcf5b('0x21')][_0xcf5b('0x2d')]+'%'};return _0x148da0;}})});}_0x3d1efa=_[_0xcf5b('0x2e')]({},_0x3d1efa,_0xea656a[_0xcf5b('0x2f')]);var _0x327f4a={'where':_0x3d1efa[_0xcf5b('0x2a')]};return db['CloudProvider']['count'](_0x327f4a)[_0xcf5b('0x14')](function(_0x505ed3){_0x34df38[_0xcf5b('0xf')]=_0x505ed3;if(_0xea656a[_0xcf5b('0x21')][_0xcf5b('0x30')]){_0x3d1efa[_0xcf5b('0x31')]=[{'all':!![]}];}return db[_0xcf5b('0x1c')][_0xcf5b('0x32')](_0x3d1efa);})['then'](function(_0x1f3bb6){_0x34df38['rows']=_[_0xcf5b('0x1b')](_0x1f3bb6,function(_0x223e14){if(_0x223e14[_0xcf5b('0x33')]===_0xcf5b('0x34')){var _0x5bbaa9=encryptor[_0xcf5b('0x35')](_0x223e14[_0xcf5b('0x36')]);_0x223e14[_0xcf5b('0x36')]=maskClientSecret(_0x5bbaa9);}return _0x223e14;});return _0x34df38;})['then'](respondWithFilteredResult(_0xcc0b2a,_0x3d1efa))[_0xcf5b('0x37')](handleError(_0xcc0b2a,null));};exports[_0xcf5b('0x38')]=function(_0x2bc098,_0x2fe792){var _0x4e084a={'raw':!![],'where':{'id':_0x2bc098[_0xcf5b('0x39')]['id']}},_0x5e2a08={};_0x5e2a08[_0xcf5b('0x25')]=_[_0xcf5b('0x22')](db[_0xcf5b('0x1c')][_0xcf5b('0x1d')]);_0x5e2a08[_0xcf5b('0x21')]=_[_0xcf5b('0x22')](_0x2bc098[_0xcf5b('0x21')]);_0x5e2a08[_0xcf5b('0x23')]=_[_0xcf5b('0x24')](_0x5e2a08[_0xcf5b('0x25')],_0x5e2a08[_0xcf5b('0x21')]);_0x4e084a['attributes']=_[_0xcf5b('0x24')](_0x5e2a08[_0xcf5b('0x25')],qs[_0xcf5b('0x27')](_0x2bc098['query']['fields']));_0x4e084a[_0xcf5b('0x26')]=_0x4e084a['attributes']['length']?_0x4e084a[_0xcf5b('0x26')]:_0x5e2a08['model'];if(_0x2bc098[_0xcf5b('0x21')][_0xcf5b('0x30')]){_0x4e084a[_0xcf5b('0x31')]=[{'all':!![]}];}_0x4e084a=_[_0xcf5b('0x2e')]({},_0x4e084a,_0x2bc098['options']);return db[_0xcf5b('0x1c')][_0xcf5b('0x3a')](_0x4e084a)[_0xcf5b('0x14')](handleEntityNotFound(_0x2fe792,null))[_0xcf5b('0x14')](function(_0x2f5a64){if(_0x2f5a64[_0xcf5b('0x33')]===_0xcf5b('0x34')){var _0x227553=encryptor[_0xcf5b('0x35')](_0x2f5a64[_0xcf5b('0x36')]);_0x2f5a64[_0xcf5b('0x36')]=maskClientSecret(_0x227553);}return _0x2f5a64;})['then'](respondWithResult(_0x2fe792,null))['catch'](handleError(_0x2fe792,null));};exports['create']=function(_0x107d34,_0x3085a6){if(!_0x107d34[_0xcf5b('0x3b')][_0xcf5b('0x17')])throw new Error(_0xcf5b('0x3c'));if(!_0x107d34[_0xcf5b('0x3b')][_0xcf5b('0x33')])throw new Error(_0xcf5b('0x3d'));var _0x1381bf=db[_0xcf5b('0x1c')][_0xcf5b('0x1d')][_0xcf5b('0x33')][_0xcf5b('0x3e')];if(!_0x1381bf[_0xcf5b('0x3f')](_0x107d34[_0xcf5b('0x3b')][_0xcf5b('0x33')]))throw new Error(_0xcf5b('0x40')+_0x1381bf[_0xcf5b('0x41')](',\x20'));if(_0x107d34[_0xcf5b('0x3b')]['service']===_0xcf5b('0x34')&&_0x107d34[_0xcf5b('0x3b')][_0xcf5b('0x36')]){_0x107d34[_0xcf5b('0x3b')][_0xcf5b('0x36')]=encryptor[_0xcf5b('0x42')](_0x107d34['body'][_0xcf5b('0x36')]);}return db[_0xcf5b('0x1c')][_0xcf5b('0x43')](_0x107d34[_0xcf5b('0x3b')],{})[_0xcf5b('0x14')](respondWithResult(_0x3085a6,0xc9))[_0xcf5b('0x37')](handleError(_0x3085a6,null));};exports[_0xcf5b('0x12')]=function(_0x53921e,_0x5531c1){if(_0x53921e[_0xcf5b('0x3b')]['id']){delete _0x53921e[_0xcf5b('0x3b')]['id'];}return db[_0xcf5b('0x1c')]['find']({'where':{'id':_0x53921e[_0xcf5b('0x39')]['id']}})[_0xcf5b('0x14')](handleEntityNotFound(_0x5531c1,null))[_0xcf5b('0x14')](function(_0x315923){if(_0x315923[_0xcf5b('0x33')]===_0xcf5b('0x34')&&_0x53921e[_0xcf5b('0x3b')][_0xcf5b('0x36')]){_0x53921e['body'][_0xcf5b('0x36')]=encryptor[_0xcf5b('0x42')](_0x53921e['body'][_0xcf5b('0x36')]);}return _0x315923;})['then'](saveUpdates(_0x53921e['body'],null))[_0xcf5b('0x14')](respondWithResult(_0x5531c1,null))[_0xcf5b('0x37')](handleError(_0x5531c1,null));};exports[_0xcf5b('0x13')]=function(_0x20c092,_0x1ac540){return db[_0xcf5b('0x1c')][_0xcf5b('0x3a')]({'where':{'id':_0x20c092[_0xcf5b('0x39')]['id']}})[_0xcf5b('0x14')](handleEntityNotFound(_0x1ac540,null))['then'](removeEntity(_0x1ac540,null))[_0xcf5b('0x37')](handleError(_0x1ac540,null));};exports[_0xcf5b('0x44')]=function(_0x3d0f70,_0x54921c){return db[_0xcf5b('0x1c')][_0xcf5b('0x45')]({'where':{'id':_0x3d0f70[_0xcf5b('0x39')]['id']},'raw':!![]})['then'](function(_0x4f2a2c){if(!_0x4f2a2c)return _0x54921c['sendStatus'](0x194);return{'url':oauth[_0xcf5b('0x46')](_0x4f2a2c,_0x3d0f70[_0xcf5b('0x47')]['id'])};})[_0xcf5b('0x14')](respondWithResult(_0x54921c,null))[_0xcf5b('0x37')](handleError(_0x54921c,null));};exports[_0xcf5b('0x48')]=function(_0x2f5fa3,_0x168c37){var _0x451fa4=_0x2f5fa3['body'];var _0x31410b;var _0x50bff7;if(_0x451fa4[_0xcf5b('0x16')])throw _0x451fa4;redis[_0xcf5b('0x49')](_0x451fa4[_0xcf5b('0x4a')])['then'](function(_0x303465){if(!_0x303465)throw new Error(_0xcf5b('0x4b'));_0x31410b=JSON['parse'](_0x303465);var _0x1823bb=Buffer[_0xcf5b('0x4c')](_0x451fa4['state'],_0xcf5b('0x4d'))[_0xcf5b('0x4e')](_0xcf5b('0x4f'));_0x50bff7=JSON[_0xcf5b('0x50')](_0x1823bb);if(!oauth[_0xcf5b('0x51')](_0x451fa4[_0xcf5b('0x52')],_0x31410b[_0xcf5b('0x53')]))throw new Error(_0xcf5b('0x54'));redis['del'](_0x451fa4[_0xcf5b('0x4a')]);return oauth[_0xcf5b('0x55')](_0x451fa4[_0xcf5b('0x56')],_0x31410b);})[_0xcf5b('0x14')](function(_0x5776ec){_0x31410b[_0xcf5b('0x57')]=_0x5776ec['access_token'];_0x31410b[_0xcf5b('0x58')]=_0x5776ec[_0xcf5b('0x59')];return db['CloudProvider'][_0xcf5b('0x12')]({'data5':_0x31410b[_0xcf5b('0x57')],'data6':_0x31410b['data6']},{'where':{'id':_0x31410b['id']}});})[_0xcf5b('0x14')](function(){oauth[_0xcf5b('0x5a')](_0x31410b);socket['emit'](_0xcf5b('0x5b'),{'id':_0x50bff7['id']});return;})[_0xcf5b('0x14')](respondWithStatusCode(_0x168c37,null))[_0xcf5b('0x37')](function(_0x53d9f2){if(_0x50bff7){socket['emit'](_0xcf5b('0x5c'),{'id':_0x50bff7['id']});}if(!_0x31410b){logger[_0xcf5b('0x16')](_0xcf5b('0x5d'),_0x53d9f2);return _0x168c37[_0xcf5b('0xa')](0x1f4)[_0xcf5b('0x18')](_0x53d9f2['message']);}logger['error']('Authentication\x20failed\x20for\x20cloud\x20provider\x20#%s,\x20err:%s',_0x31410b['id'],JSON[_0xcf5b('0x5e')](_0x53d9f2));});}; \ No newline at end of file +var _0x34f0=['Authentication\x20failed\x20for\x20cloud\x20provider\x20#%s,\x20err:%s','stringify','ioredis','../../config/environment','../../config/logger','api','../../mysqldb','./cloudProvider.oauth','redis','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','update','then','stack','name','send','padEnd','slice','index','map','CloudProvider','rawAttributes','fieldName','type','key','model','query','filters','attributes','intersection','fields','hasOwnProperty','order','sort','pick','merge','where','VIRTUAL','filter','includeAll','findAll','rows','MicrosoftAzure','decryptString','data3','catch','params','length','include','options','find','service','create','body','Name\x20parameter\x20not\x20specified','Service\x20parameter\x20not\x20specified','includes','Invalid\x20service\x20parameter.\x20Allowed\x20values:\x20','join','encryptString','destroy','oauth2MicrosoftAuthorize','findOne','generateMicrosoftAuthorizationUrl','user','error','get','parse','from','state','toString','ascii','isValidIdToken','id_token','oauth2Claims','Unable\x20to\x20validate\x20id_token','del','getOauth2MicrosoftAccessToken','code','data5','access_token','data6','refresh_token','emit','microsoftAuthorization:error','Invalid\x20authentication\x20state\x20parameter','message'];(function(_0x17df57,_0x3be05b){var _0x4b58d8=function(_0x2338cd){while(--_0x2338cd){_0x17df57['push'](_0x17df57['shift']());}};_0x4b58d8(++_0x3be05b);}(_0x34f0,0x11c));var _0x034f=function(_0x281a8a,_0x50c6e8){_0x281a8a=_0x281a8a-0x0;var _0xfc2be8=_0x34f0[_0x281a8a];return _0xfc2be8;};'use strict';var _=require('lodash');var Redis=require(_0x034f('0x0'));var qs=require('../../components/parsers/qs');var encryptor=require('../../components/encryptor');var config=require(_0x034f('0x1'));var logger=require(_0x034f('0x2'))(_0x034f('0x3'));var db=require(_0x034f('0x4'))['db'];var oauth=require(_0x034f('0x5'));config[_0x034f('0x6')]=_['defaults'](config[_0x034f('0x6')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x034f('0x6')]));var redis=new Redis(config['redis']);function respondWithStatusCode(_0x52c438,_0x3c32b9){_0x3c32b9=_0x3c32b9||0xcc;return function(_0x542476){if(_0x542476){return _0x52c438[_0x034f('0x7')](_0x3c32b9);}return _0x52c438[_0x034f('0x8')](_0x3c32b9)['end']();};}function respondWithResult(_0x2934ea,_0x868d41){_0x868d41=_0x868d41||0xc8;return function(_0x4eb486){if(_0x4eb486){return _0x2934ea[_0x034f('0x8')](_0x868d41)[_0x034f('0x9')](_0x4eb486);}};}function respondWithFilteredResult(_0x3a713a,_0x29d1b7){return function(_0x141531){if(_0x141531){var _0x1e2f9b=typeof _0x29d1b7[_0x034f('0xa')]===_0x034f('0xb')&&typeof _0x29d1b7[_0x034f('0xc')]===_0x034f('0xb');var _0x23fb5c=_0x141531[_0x034f('0xd')];var _0x9a577e=_0x1e2f9b?0x0:_0x29d1b7[_0x034f('0xa')];var _0x41e1b0=_0x1e2f9b?_0x141531[_0x034f('0xd')]:_0x29d1b7[_0x034f('0xa')]+_0x29d1b7[_0x034f('0xc')];var _0x33866f;if(_0x41e1b0>=_0x23fb5c){_0x41e1b0=_0x23fb5c;_0x33866f=0xc8;}else{_0x33866f=0xce;}_0x3a713a[_0x034f('0x8')](_0x33866f);return _0x3a713a[_0x034f('0xe')](_0x034f('0xf'),_0x9a577e+'-'+_0x41e1b0+'/'+_0x23fb5c)[_0x034f('0x9')](_0x141531);}return null;};}function saveUpdates(_0x50f5d6){return function(_0x4f40d1){if(_0x4f40d1){return _0x4f40d1[_0x034f('0x10')](_0x50f5d6)[_0x034f('0x11')](function(_0xfce2b7){return _0xfce2b7;});}return null;};}function removeEntity(_0x5c2087){return function(_0x112221){if(_0x112221){return _0x112221['destroy']()['then'](function(){_0x5c2087[_0x034f('0x8')](0xcc)['end']();});}};}function handleEntityNotFound(_0x45ebc4){return function(_0x137ccc){if(!_0x137ccc){_0x45ebc4['sendStatus'](0x194);}return _0x137ccc;};}function handleError(_0x1c995a,_0x5df401){_0x5df401=_0x5df401||0x1f4;return function(_0x20b951){logger['error'](_0x20b951[_0x034f('0x12')]);if(_0x20b951[_0x034f('0x13')]){delete _0x20b951[_0x034f('0x13')];}_0x1c995a[_0x034f('0x8')](_0x5df401)[_0x034f('0x14')](_0x20b951);};}function maskClientSecret(_0x528600){return _[_0x034f('0x15')](_0x528600[_0x034f('0x16')](0x0,0x3),0x14,'*');}exports[_0x034f('0x17')]=function(_0x55f24c,_0xc24eeb){var _0x5712db={},_0x52887a={},_0x86868={'count':0x0,'rows':[]};var _0x5e5c5b=_[_0x034f('0x18')](db[_0x034f('0x19')][_0x034f('0x1a')],function(_0x464aab){return{'name':_0x464aab[_0x034f('0x1b')],'type':_0x464aab[_0x034f('0x1c')][_0x034f('0x1d')]};});_0x52887a[_0x034f('0x1e')]=_['map'](_0x5e5c5b,_0x034f('0x13'));_0x52887a[_0x034f('0x1f')]=_['keys'](_0x55f24c[_0x034f('0x1f')]);_0x52887a[_0x034f('0x20')]=_['intersection'](_0x52887a[_0x034f('0x1e')],_0x52887a[_0x034f('0x1f')]);_0x5712db[_0x034f('0x21')]=_[_0x034f('0x22')](_0x52887a[_0x034f('0x1e')],qs[_0x034f('0x23')](_0x55f24c['query'][_0x034f('0x23')]));_0x5712db[_0x034f('0x21')]=_0x5712db[_0x034f('0x21')]['length']?_0x5712db[_0x034f('0x21')]:_0x52887a[_0x034f('0x1e')];if(!_0x55f24c[_0x034f('0x1f')][_0x034f('0x24')]('nolimit')){_0x5712db[_0x034f('0xc')]=qs['limit'](_0x55f24c['query'][_0x034f('0xc')]);_0x5712db[_0x034f('0xa')]=qs[_0x034f('0xa')](_0x55f24c[_0x034f('0x1f')][_0x034f('0xa')]);}_0x5712db[_0x034f('0x25')]=qs[_0x034f('0x26')](_0x55f24c['query'][_0x034f('0x26')]);_0x5712db['where']=qs['filters'](_[_0x034f('0x27')](_0x55f24c[_0x034f('0x1f')],_0x52887a['filters']),_0x5e5c5b);if(_0x55f24c[_0x034f('0x1f')]['filter']){_0x5712db['where']=_[_0x034f('0x28')](_0x5712db[_0x034f('0x29')],{'$or':_[_0x034f('0x18')](_0x5e5c5b,function(_0x207388){if(_0x207388[_0x034f('0x1c')]!==_0x034f('0x2a')){var _0x2a049d={};_0x2a049d[_0x207388[_0x034f('0x13')]]={'$like':'%'+_0x55f24c[_0x034f('0x1f')][_0x034f('0x2b')]+'%'};return _0x2a049d;}})});}_0x5712db=_[_0x034f('0x28')]({},_0x5712db,_0x55f24c['options']);var _0x43a66a={'where':_0x5712db[_0x034f('0x29')]};return db['CloudProvider'][_0x034f('0xd')](_0x43a66a)[_0x034f('0x11')](function(_0x53227c){_0x86868[_0x034f('0xd')]=_0x53227c;if(_0x55f24c[_0x034f('0x1f')][_0x034f('0x2c')]){_0x5712db['include']=[{'all':!![]}];}return db['CloudProvider'][_0x034f('0x2d')](_0x5712db);})['then'](function(_0x37a960){_0x86868[_0x034f('0x2e')]=_[_0x034f('0x18')](_0x37a960,function(_0x5d339c){if(_0x5d339c['service']===_0x034f('0x2f')){var _0xe2474e=encryptor[_0x034f('0x30')](_0x5d339c[_0x034f('0x31')]);_0x5d339c[_0x034f('0x31')]=maskClientSecret(_0xe2474e);}return _0x5d339c;});return _0x86868;})[_0x034f('0x11')](respondWithFilteredResult(_0xc24eeb,_0x5712db))[_0x034f('0x32')](handleError(_0xc24eeb,null));};exports['show']=function(_0x4a1278,_0x408fde){var _0x553ba6={'raw':!![],'where':{'id':_0x4a1278[_0x034f('0x33')]['id']}},_0x59c598={};_0x59c598[_0x034f('0x1e')]=_['keys'](db[_0x034f('0x19')][_0x034f('0x1a')]);_0x59c598[_0x034f('0x1f')]=_['keys'](_0x4a1278[_0x034f('0x1f')]);_0x59c598[_0x034f('0x20')]=_['intersection'](_0x59c598[_0x034f('0x1e')],_0x59c598[_0x034f('0x1f')]);_0x553ba6[_0x034f('0x21')]=_[_0x034f('0x22')](_0x59c598[_0x034f('0x1e')],qs['fields'](_0x4a1278[_0x034f('0x1f')][_0x034f('0x23')]));_0x553ba6['attributes']=_0x553ba6[_0x034f('0x21')][_0x034f('0x34')]?_0x553ba6[_0x034f('0x21')]:_0x59c598[_0x034f('0x1e')];if(_0x4a1278['query'][_0x034f('0x2c')]){_0x553ba6[_0x034f('0x35')]=[{'all':!![]}];}_0x553ba6=_['merge']({},_0x553ba6,_0x4a1278[_0x034f('0x36')]);return db[_0x034f('0x19')][_0x034f('0x37')](_0x553ba6)[_0x034f('0x11')](handleEntityNotFound(_0x408fde,null))[_0x034f('0x11')](function(_0xc5dac1){if(_0xc5dac1[_0x034f('0x38')]==='MicrosoftAzure'){var _0x298540=encryptor[_0x034f('0x30')](_0xc5dac1[_0x034f('0x31')]);_0xc5dac1['data3']=maskClientSecret(_0x298540);}return _0xc5dac1;})['then'](respondWithResult(_0x408fde,null))[_0x034f('0x32')](handleError(_0x408fde,null));};exports[_0x034f('0x39')]=function(_0x2203c5,_0x10f78a){if(!_0x2203c5[_0x034f('0x3a')][_0x034f('0x13')])throw new Error(_0x034f('0x3b'));if(!_0x2203c5['body'][_0x034f('0x38')])throw new Error(_0x034f('0x3c'));var _0x4a05f7=db[_0x034f('0x19')]['rawAttributes'][_0x034f('0x38')]['values'];if(!_0x4a05f7[_0x034f('0x3d')](_0x2203c5['body'][_0x034f('0x38')]))throw new Error(_0x034f('0x3e')+_0x4a05f7[_0x034f('0x3f')](',\x20'));if(_0x2203c5['body']['service']===_0x034f('0x2f')&&_0x2203c5[_0x034f('0x3a')][_0x034f('0x31')]){_0x2203c5[_0x034f('0x3a')][_0x034f('0x31')]=encryptor[_0x034f('0x40')](_0x2203c5[_0x034f('0x3a')]['data3']);}return db[_0x034f('0x19')][_0x034f('0x39')](_0x2203c5[_0x034f('0x3a')],{})[_0x034f('0x11')](respondWithResult(_0x10f78a,0xc9))['catch'](handleError(_0x10f78a,null));};exports[_0x034f('0x10')]=function(_0x1a3375,_0x3d31b6){if(_0x1a3375[_0x034f('0x3a')]['id']){delete _0x1a3375[_0x034f('0x3a')]['id'];}return db[_0x034f('0x19')][_0x034f('0x37')]({'where':{'id':_0x1a3375[_0x034f('0x33')]['id']}})[_0x034f('0x11')](handleEntityNotFound(_0x3d31b6,null))['then'](function(_0x4a4c76){if(_0x4a4c76[_0x034f('0x38')]===_0x034f('0x2f')&&_0x1a3375[_0x034f('0x3a')][_0x034f('0x31')]){_0x1a3375[_0x034f('0x3a')][_0x034f('0x31')]=encryptor['encryptString'](_0x1a3375[_0x034f('0x3a')]['data3']);}return _0x4a4c76;})['then'](saveUpdates(_0x1a3375[_0x034f('0x3a')],null))['then'](respondWithResult(_0x3d31b6,null))[_0x034f('0x32')](handleError(_0x3d31b6,null));};exports[_0x034f('0x41')]=function(_0x3b374b,_0x32ecd3){return db[_0x034f('0x19')]['find']({'where':{'id':_0x3b374b[_0x034f('0x33')]['id']}})[_0x034f('0x11')](handleEntityNotFound(_0x32ecd3,null))[_0x034f('0x11')](removeEntity(_0x32ecd3,null))[_0x034f('0x32')](handleError(_0x32ecd3,null));};exports[_0x034f('0x42')]=function(_0x119d6a,_0x2ad1c3){return db['CloudProvider'][_0x034f('0x43')]({'where':{'id':_0x119d6a[_0x034f('0x33')]['id']},'raw':!![]})['then'](function(_0x3c5beb){if(!_0x3c5beb)return _0x2ad1c3[_0x034f('0x7')](0x194);return{'url':oauth[_0x034f('0x44')](_0x3c5beb,_0x119d6a[_0x034f('0x45')]['id'])};})['then'](respondWithResult(_0x2ad1c3,null))[_0x034f('0x32')](handleError(_0x2ad1c3,null));};exports['oauth2MicrosoftCallback']=function(_0x392124,_0x42dcd7){var _0x118763=_0x392124[_0x034f('0x3a')];var _0x40edb8;var _0x3bd282;if(_0x118763[_0x034f('0x46')])throw _0x118763;redis[_0x034f('0x47')](_0x118763['state'])['then'](function(_0x209131){if(!_0x209131)throw new Error('Invalid\x20state\x20parameter');_0x40edb8=JSON[_0x034f('0x48')](_0x209131);var _0x5b5ef0=Buffer[_0x034f('0x49')](_0x118763[_0x034f('0x4a')],'base64')[_0x034f('0x4b')](_0x034f('0x4c'));_0x3bd282=JSON[_0x034f('0x48')](_0x5b5ef0);if(!oauth[_0x034f('0x4d')](_0x118763[_0x034f('0x4e')],_0x40edb8[_0x034f('0x4f')]))throw new Error(_0x034f('0x50'));redis[_0x034f('0x51')](_0x118763[_0x034f('0x4a')]);return oauth[_0x034f('0x52')](_0x118763[_0x034f('0x53')],_0x40edb8);})['then'](function(_0x292ddc){_0x40edb8[_0x034f('0x54')]=_0x292ddc[_0x034f('0x55')];_0x40edb8[_0x034f('0x56')]=_0x292ddc[_0x034f('0x57')];return db[_0x034f('0x19')]['update']({'data5':_0x40edb8[_0x034f('0x54')],'data6':_0x40edb8[_0x034f('0x56')]},{'where':{'id':_0x40edb8['id']}});})[_0x034f('0x11')](function(){oauth['startRefreshInterval'](_0x40edb8);socket[_0x034f('0x58')]('microsoftAuthorization:success',{'id':_0x3bd282['id']});return;})[_0x034f('0x11')](respondWithStatusCode(_0x42dcd7,null))[_0x034f('0x32')](function(_0x59549f){if(_0x3bd282){socket[_0x034f('0x58')](_0x034f('0x59'),{'id':_0x3bd282['id']});}if(!_0x40edb8){logger[_0x034f('0x46')](_0x034f('0x5a'),_0x59549f);return _0x42dcd7['status'](0x1f4)['send'](_0x59549f[_0x034f('0x5b')]);}logger[_0x034f('0x46')](_0x034f('0x5c'),_0x40edb8['id'],JSON[_0x034f('0x5d')](_0x59549f));});}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.model.js b/server/api/cloudProvider/cloudProvider.model.js index f6ec9cc..4b5628d 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 _0xe411=['bluebird','request-promise','path','rimraf','../../config/environment','./cloudProvider.attributes','exports','CloudProvider','cloud_providers','lodash','util','../../config/logger','api','moment'];(function(_0x5cf81d,_0x4093d2){var _0xdfb346=function(_0x4cf7c2){while(--_0x4cf7c2){_0x5cf81d['push'](_0x5cf81d['shift']());}};_0xdfb346(++_0x4093d2);}(_0xe411,0x121));var _0x1e41=function(_0x2074b2,_0x5a527a){_0x2074b2=_0x2074b2-0x0;var _0x1e6eb8=_0xe411[_0x2074b2];return _0x1e6eb8;};'use strict';var _=require(_0x1e41('0x0'));var util=require(_0x1e41('0x1'));var logger=require(_0x1e41('0x2'))(_0x1e41('0x3'));var moment=require(_0x1e41('0x4'));var BPromise=require(_0x1e41('0x5'));var rp=require(_0x1e41('0x6'));var fs=require('fs');var path=require(_0x1e41('0x7'));var rimraf=require(_0x1e41('0x8'));var config=require(_0x1e41('0x9'));var attributes=require(_0x1e41('0xa'));module[_0x1e41('0xb')]=function(_0x41ed1f,_0x2db0d7){return _0x41ed1f['define'](_0x1e41('0xc'),attributes,{'tableName':_0x1e41('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2cd9=['moment','request-promise','path','rimraf','../../config/environment','./cloudProvider.attributes','exports','lodash','util','../../config/logger','api'];(function(_0x5430e3,_0x2a5302){var _0x9b1f0c=function(_0x100a5a){while(--_0x100a5a){_0x5430e3['push'](_0x5430e3['shift']());}};_0x9b1f0c(++_0x2a5302);}(_0x2cd9,0xd8));var _0x92cd=function(_0x446f12,_0x259fb6){_0x446f12=_0x446f12-0x0;var _0xeb88bd=_0x2cd9[_0x446f12];return _0xeb88bd;};'use strict';var _=require(_0x92cd('0x0'));var util=require(_0x92cd('0x1'));var logger=require(_0x92cd('0x2'))(_0x92cd('0x3'));var moment=require(_0x92cd('0x4'));var BPromise=require('bluebird');var rp=require(_0x92cd('0x5'));var fs=require('fs');var path=require(_0x92cd('0x6'));var rimraf=require(_0x92cd('0x7'));var config=require(_0x92cd('0x8'));var attributes=require(_0x92cd('0x9'));module[_0x92cd('0xa')]=function(_0x45470a,_0x15b3c6){return _0x45470a['define']('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 2ce192e..213aa28 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 _0xf6bd=['set','iss','issuer','aud','isAfter','unix','exp','resolve','then','CloudProvider','findOne','refresh_token','data3','data6','catch','error','Failed\x20to\x20refresh\x20access\x20token\x20for\x20cloud\x20provider\x20#%s,\x20-\x20err:%s','authorization_code','decryptString','bind','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','api','../../config/schedule/cloud-provider','../../mysqldb','redis','defaults','localhost','https://login.microsoftonline.com/{TENANT_ID}/oauth2/v2.0','openid','email','offline_access','https://outlook.office365.com/IMAP.AccessAsUser.All','https://outlook.office.com/SMTP.Send','/authorize','/token','map','type','Dynamics365','push','data7','/.default','replace','{TENANT_ID}','data2','code','id_token','from','stringify','randomBytes','toString','client_id','data1','response_type','redirect_uri','data4','form_post','scope','state','nonce','login','value','join','oauth2/'];(function(_0x351ebe,_0x187f58){var _0xbe1706=function(_0x54a3cf){while(--_0x54a3cf){_0x351ebe['push'](_0x351ebe['shift']());}};_0xbe1706(++_0x187f58);}(_0xf6bd,0x1e2));var _0xdf6b=function(_0x578c0e,_0xff70fb){_0x578c0e=_0x578c0e-0x0;var _0x4db2c2=_0xf6bd[_0x578c0e];return _0x4db2c2;};'use strict';var _=require(_0xdf6b('0x0'));var crypto=require(_0xdf6b('0x1'));var jwt=require(_0xdf6b('0x2'));var moment=require(_0xdf6b('0x3'));var Redis=require(_0xdf6b('0x4'));var rp=require(_0xdf6b('0x5'));var util=require(_0xdf6b('0x6'));var encryptor=require(_0xdf6b('0x7'));var config=require('../../config/environment');var logger=require('../../config/logger')(_0xdf6b('0x8'));var schedule=require(_0xdf6b('0x9'));var db=require(_0xdf6b('0xa'))['db'];config[_0xdf6b('0xb')]=_[_0xdf6b('0xc')](config['redis'],{'host':_0xdf6b('0xd'),'port':0x18eb});var redis=new Redis(config[_0xdf6b('0xb')]);var MICROSOFT_AUTH_URL=_0xdf6b('0xe');var AZURE_AUTH_SCOPES={'Outlook365':[_0xdf6b('0xf'),'profile',_0xdf6b('0x10'),_0xdf6b('0x11'),_0xdf6b('0x12'),'https://outlook.office.com/POP.AccessAsUser.All',_0xdf6b('0x13')],'Dynamics365':['openid','offline_access']};var MICROSOFT_AUTH_ENDPOINT=_0xdf6b('0x14');var MICROSOFT_TOKEN_ENDPOINT=_0xdf6b('0x15');var OAUTH_REFRESH_INTERVAL=0xfa;function getAuthorizationScopes(_0x1de7d7){var _0x55091a=_[_0xdf6b('0x16')](AZURE_AUTH_SCOPES[_0x1de7d7[_0xdf6b('0x17')]]);if(_0x1de7d7[_0xdf6b('0x17')]===_0xdf6b('0x18'))_0x55091a[_0xdf6b('0x19')](_0x1de7d7[_0xdf6b('0x1a')]+_0xdf6b('0x1b'));return _0x55091a['join']('\x20');}function getAccessTokenScope(_0x4778c2){if(_0x4778c2[_0xdf6b('0x17')]==='Outlook365')return _0xdf6b('0x12');if(_0x4778c2[_0xdf6b('0x17')]===_0xdf6b('0x18'))return _0x4778c2['data7']+_0xdf6b('0x1b');}function generateMicrosoftAuthorizationUrl(_0x5c35d8,_0x3505d6){var _0x2be47c=MICROSOFT_AUTH_URL[_0xdf6b('0x1c')](_0xdf6b('0x1d'),_0x5c35d8[_0xdf6b('0x1e')]);var _0x2ba97a=[_0xdf6b('0x1f'),_0xdf6b('0x20')];var _0x874e8a=Buffer[_0xdf6b('0x21')](JSON[_0xdf6b('0x22')]({'id':_0x3505d6}))['toString']('base64');var _0x1b32b0=crypto[_0xdf6b('0x23')](0x10)[_0xdf6b('0x24')]('hex');var _0x189bd8=getAuthorizationScopes(_0x5c35d8);var _0x116f57=[{'key':_0xdf6b('0x25'),'value':_0x5c35d8[_0xdf6b('0x26')]},{'key':_0xdf6b('0x27'),'value':encodeURIComponent(_0x2ba97a['join']('\x20'))},{'key':_0xdf6b('0x28'),'value':_0x5c35d8[_0xdf6b('0x29')]},{'key':'response_mode','value':_0xdf6b('0x2a')},{'key':_0xdf6b('0x2b'),'value':encodeURIComponent(_0x189bd8)},{'key':_0xdf6b('0x2c'),'value':_0x874e8a},{'key':_0xdf6b('0x2d'),'value':_0x1b32b0},{'key':'prompt','value':_0xdf6b('0x2e')}];var _0x406cd4=_0x2be47c+MICROSOFT_AUTH_ENDPOINT+'?'+_[_0xdf6b('0x16')](_0x116f57,function(_0x4a0d37){return _0x4a0d37['key']+'='+_0x4a0d37[_0xdf6b('0x2f')];})[_0xdf6b('0x30')]('&');_0x5c35d8['oauth2Claims']={'issuer':_0x2be47c[_0xdf6b('0x1c')](_0xdf6b('0x31'),''),'audience':_0x5c35d8[_0xdf6b('0x26')],'state':_0x874e8a,'nonce':_0x1b32b0};redis[_0xdf6b('0x32')](_0x874e8a,JSON[_0xdf6b('0x22')](_0x5c35d8));return _0x406cd4;}function isValidIdToken(_0x38af50,_0x50992c){try{var _0x5a36e5=jwt['decode'](_0x38af50,{'complete':!![]});var _0x5f40bc=_0x5a36e5['payload'];if(_0x5f40bc[_0xdf6b('0x33')]!==_0x50992c[_0xdf6b('0x34')])return![];if(_0x5f40bc[_0xdf6b('0x35')]!==_0x50992c['audience'])return![];if(_0x5f40bc['nonce']!==_0x50992c['nonce'])return![];if(moment()[_0xdf6b('0x36')](moment[_0xdf6b('0x37')](_0x5f40bc[_0xdf6b('0x38')])))return![];return!![];}catch(_0x5f29b3){throw _0x5f29b3;}}function refreshOauth2MicrosoftAccessToken(_0x2e6fc8){return Promise[_0xdf6b('0x39')]()[_0xdf6b('0x3a')](function(){if(_0x2e6fc8['data3'])return _0x2e6fc8;return db[_0xdf6b('0x3b')][_0xdf6b('0x3c')]({'where':{'id':_0x2e6fc8['id']},'raw':!![]});})[_0xdf6b('0x3a')](function(_0x2f3bd4){var _0x1fede0={'grant_type':_0xdf6b('0x3d'),'refresh_token':_0x2f3bd4['data6'],'scope':getAccessTokenScope(_0x2f3bd4),'redirect_uri':_0x2f3bd4[_0xdf6b('0x29')],'client_id':_0x2f3bd4[_0xdf6b('0x26')],'client_secret':encryptor['decryptString'](_0x2f3bd4[_0xdf6b('0x3e')])};var _0x1bf2d5={'method':'POST','uri':MICROSOFT_AUTH_URL[_0xdf6b('0x1c')](_0xdf6b('0x1d'),_0x2f3bd4[_0xdf6b('0x1e')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x1fede0,'json':!![]};return rp(_0x1bf2d5);})['then'](function(_0x5a0671){_0x2e6fc8['data5']=_0x5a0671['access_token'];_0x2e6fc8[_0xdf6b('0x3f')]=_0x5a0671[_0xdf6b('0x3d')];return db[_0xdf6b('0x3b')]['update']({'data5':_0x2e6fc8['data5'],'data6':_0x2e6fc8[_0xdf6b('0x3f')]},{'where':{'id':_0x2e6fc8['id']}});})[_0xdf6b('0x3a')](function(){return _0x2e6fc8;})[_0xdf6b('0x40')](function(_0x124111){logger[_0xdf6b('0x41')](_0xdf6b('0x42'),_0x2e6fc8['id'],_0x124111);});}function getOauth2MicrosoftAccessToken(_0x465783,_0x62a94a){var _0x9d6758={'grant_type':_0xdf6b('0x43'),'code':_0x465783,'scope':getAccessTokenScope(_0x62a94a),'redirect_uri':_0x62a94a['data4'],'client_id':_0x62a94a[_0xdf6b('0x26')],'client_secret':encryptor[_0xdf6b('0x44')](_0x62a94a['data3'])};var _0x3730ab={'method':'POST','uri':MICROSOFT_AUTH_URL['replace'](_0xdf6b('0x1d'),_0x62a94a[_0xdf6b('0x1e')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x9d6758,'json':!![]};return rp(_0x3730ab);}function startRefreshInterval(_0x3c75b1){var _0x4f4a83=schedule['intervals'];if(_0x4f4a83[_0x3c75b1['id']])clearInterval(_0x4f4a83[_0x3c75b1['id']]);_0x4f4a83[_0x3c75b1['id']]=setInterval(refreshOauth2MicrosoftAccessToken[_0xdf6b('0x45')](this,{'id':_0x3c75b1['id']}),OAUTH_REFRESH_INTERVAL*0x3e8);schedule[_0xdf6b('0x46')]=_0x4f4a83;}function startAllRefreshIntervals(){return db[_0xdf6b('0x3b')][_0xdf6b('0x47')]({'where':{'data6':{'$ne':null}},'raw':!![]})['then'](function(_0x18ba62){var _0x222eb5=_0x18ba62[_0xdf6b('0x16')](function(_0x5731f6){return refreshOauth2MicrosoftAccessToken(_0x5731f6)[_0xdf6b('0x3a')](function(_0x1c5966){startRefreshInterval(_0x1c5966);});});return Promise[_0xdf6b('0x48')](_0x222eb5);})[_0xdf6b('0x40')](function(_0x18daeb){var _0x281acf=_0x18daeb?util[_0xdf6b('0x49')](_0x18daeb,{'showHidden':![],'depth':null}):'';logger[_0xdf6b('0x41')](_0xdf6b('0x4a'),_0x281acf);});}module[_0xdf6b('0x4b')]={'generateMicrosoftAuthorizationUrl':generateMicrosoftAuthorizationUrl,'getOauth2MicrosoftAccessToken':getOauth2MicrosoftAccessToken,'isValidIdToken':isValidIdToken,'startAllRefreshIntervals':startAllRefreshIntervals,'refreshOauth2MicrosoftAccessToken':refreshOauth2MicrosoftAccessToken,'startRefreshInterval':startRefreshInterval}; \ No newline at end of file +var _0x320f=['nonce','login','oauth2Claims','oauth2/','set','stringify','decode','payload','iss','issuer','audience','isAfter','unix','exp','resolve','then','data3','CloudProvider','findOne','data6','POST','{TENANT_ID}','access_token','refresh_token','update','data5','catch','Failed\x20to\x20refresh\x20access\x20token\x20for\x20cloud\x20provider\x20#%s,\x20-\x20err:%s','authorization_code','decryptString','intervals','bind','findAll','inspect','error','[CLOUD_PROVIDER]\x20Error\x20while\x20refreshing\x20the\x20tokens\x20after\x20service\x20restart\x20error:%s','exports','crypto','request-promise','util','../../config/logger','api','../../config/schedule/cloud-provider','../../mysqldb','redis','defaults','https://login.microsoftonline.com/{TENANT_ID}/oauth2/v2.0','openid','profile','email','offline_access','https://outlook.office.com/SMTP.Send','map','type','Dynamics365','push','data7','/.default','Outlook365','https://outlook.office365.com/IMAP.AccessAsUser.All','replace','data2','from','base64','randomBytes','toString','client_id','data1','response_type','redirect_uri','data4','response_mode','form_post','scope','state'];(function(_0x5d7b60,_0x22ba91){var _0x477343=function(_0x23382f){while(--_0x23382f){_0x5d7b60['push'](_0x5d7b60['shift']());}};_0x477343(++_0x22ba91);}(_0x320f,0xbb));var _0xf320=function(_0x23a0f4,_0x3b89d6){_0x23a0f4=_0x23a0f4-0x0;var _0x3c8691=_0x320f[_0x23a0f4];return _0x3c8691;};'use strict';var _=require('lodash');var crypto=require(_0xf320('0x0'));var jwt=require('jsonwebtoken');var moment=require('moment');var Redis=require('ioredis');var rp=require(_0xf320('0x1'));var util=require(_0xf320('0x2'));var encryptor=require('../../components/encryptor');var config=require('../../config/environment');var logger=require(_0xf320('0x3'))(_0xf320('0x4'));var schedule=require(_0xf320('0x5'));var db=require(_0xf320('0x6'))['db'];config[_0xf320('0x7')]=_[_0xf320('0x8')](config['redis'],{'host':'localhost','port':0x18eb});var redis=new Redis(config[_0xf320('0x7')]);var MICROSOFT_AUTH_URL=_0xf320('0x9');var AZURE_AUTH_SCOPES={'Outlook365':[_0xf320('0xa'),_0xf320('0xb'),_0xf320('0xc'),_0xf320('0xd'),'https://outlook.office365.com/IMAP.AccessAsUser.All','https://outlook.office.com/POP.AccessAsUser.All',_0xf320('0xe')],'Dynamics365':['openid','offline_access']};var MICROSOFT_AUTH_ENDPOINT='/authorize';var MICROSOFT_TOKEN_ENDPOINT='/token';var OAUTH_REFRESH_INTERVAL=0xfa;function getAuthorizationScopes(_0x5797c3){var _0x513eb4=_[_0xf320('0xf')](AZURE_AUTH_SCOPES[_0x5797c3[_0xf320('0x10')]]);if(_0x5797c3[_0xf320('0x10')]===_0xf320('0x11'))_0x513eb4[_0xf320('0x12')](_0x5797c3[_0xf320('0x13')]+_0xf320('0x14'));return _0x513eb4['join']('\x20');}function getAccessTokenScope(_0x3a9e19){if(_0x3a9e19[_0xf320('0x10')]===_0xf320('0x15'))return _0xf320('0x16');if(_0x3a9e19[_0xf320('0x10')]===_0xf320('0x11'))return _0x3a9e19['data7']+_0xf320('0x14');}function generateMicrosoftAuthorizationUrl(_0xb5753,_0x382c50){var _0x2a8db9=MICROSOFT_AUTH_URL[_0xf320('0x17')]('{TENANT_ID}',_0xb5753[_0xf320('0x18')]);var _0x1f4089=['code','id_token'];var _0x130063=Buffer[_0xf320('0x19')](JSON['stringify']({'id':_0x382c50}))['toString'](_0xf320('0x1a'));var _0x3118b1=crypto[_0xf320('0x1b')](0x10)[_0xf320('0x1c')]('hex');var _0x5b2813=getAuthorizationScopes(_0xb5753);var _0x526340=[{'key':_0xf320('0x1d'),'value':_0xb5753[_0xf320('0x1e')]},{'key':_0xf320('0x1f'),'value':encodeURIComponent(_0x1f4089['join']('\x20'))},{'key':_0xf320('0x20'),'value':_0xb5753[_0xf320('0x21')]},{'key':_0xf320('0x22'),'value':_0xf320('0x23')},{'key':_0xf320('0x24'),'value':encodeURIComponent(_0x5b2813)},{'key':_0xf320('0x25'),'value':_0x130063},{'key':_0xf320('0x26'),'value':_0x3118b1},{'key':'prompt','value':_0xf320('0x27')}];var _0x1e5dee=_0x2a8db9+MICROSOFT_AUTH_ENDPOINT+'?'+_[_0xf320('0xf')](_0x526340,function(_0x17cf00){return _0x17cf00['key']+'='+_0x17cf00['value'];})['join']('&');_0xb5753[_0xf320('0x28')]={'issuer':_0x2a8db9[_0xf320('0x17')](_0xf320('0x29'),''),'audience':_0xb5753[_0xf320('0x1e')],'state':_0x130063,'nonce':_0x3118b1};redis[_0xf320('0x2a')](_0x130063,JSON[_0xf320('0x2b')](_0xb5753));return _0x1e5dee;}function isValidIdToken(_0x5e56c5,_0xa9b966){try{var _0xd83955=jwt[_0xf320('0x2c')](_0x5e56c5,{'complete':!![]});var _0x513d41=_0xd83955[_0xf320('0x2d')];if(_0x513d41[_0xf320('0x2e')]!==_0xa9b966[_0xf320('0x2f')])return![];if(_0x513d41['aud']!==_0xa9b966[_0xf320('0x30')])return![];if(_0x513d41['nonce']!==_0xa9b966['nonce'])return![];if(moment()[_0xf320('0x31')](moment[_0xf320('0x32')](_0x513d41[_0xf320('0x33')])))return![];return!![];}catch(_0x51b8d5){throw _0x51b8d5;}}function refreshOauth2MicrosoftAccessToken(_0xf3360d){return Promise[_0xf320('0x34')]()[_0xf320('0x35')](function(){if(_0xf3360d[_0xf320('0x36')])return _0xf3360d;return db[_0xf320('0x37')][_0xf320('0x38')]({'where':{'id':_0xf3360d['id']},'raw':!![]});})[_0xf320('0x35')](function(_0xbf5a67){var _0x52a85b={'grant_type':'refresh_token','refresh_token':_0xbf5a67[_0xf320('0x39')],'scope':getAccessTokenScope(_0xbf5a67),'redirect_uri':_0xbf5a67['data4'],'client_id':_0xbf5a67['data1'],'client_secret':encryptor['decryptString'](_0xbf5a67[_0xf320('0x36')])};var _0x5efb35={'method':_0xf320('0x3a'),'uri':MICROSOFT_AUTH_URL[_0xf320('0x17')](_0xf320('0x3b'),_0xbf5a67[_0xf320('0x18')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x52a85b,'json':!![]};return rp(_0x5efb35);})[_0xf320('0x35')](function(_0xffb4fb){_0xf3360d['data5']=_0xffb4fb[_0xf320('0x3c')];_0xf3360d[_0xf320('0x39')]=_0xffb4fb[_0xf320('0x3d')];return db[_0xf320('0x37')][_0xf320('0x3e')]({'data5':_0xf3360d[_0xf320('0x3f')],'data6':_0xf3360d['data6']},{'where':{'id':_0xf3360d['id']}});})[_0xf320('0x35')](function(){return _0xf3360d;})[_0xf320('0x40')](function(_0x6bb002){logger['error'](_0xf320('0x41'),_0xf3360d['id'],_0x6bb002);});}function getOauth2MicrosoftAccessToken(_0x344cfc,_0x3d169f){var _0x3c58cd={'grant_type':_0xf320('0x42'),'code':_0x344cfc,'scope':getAccessTokenScope(_0x3d169f),'redirect_uri':_0x3d169f[_0xf320('0x21')],'client_id':_0x3d169f[_0xf320('0x1e')],'client_secret':encryptor[_0xf320('0x43')](_0x3d169f['data3'])};var _0x573519={'method':_0xf320('0x3a'),'uri':MICROSOFT_AUTH_URL[_0xf320('0x17')](_0xf320('0x3b'),_0x3d169f[_0xf320('0x18')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x3c58cd,'json':!![]};return rp(_0x573519);}function startRefreshInterval(_0x16b25c){var _0x5191bd=schedule[_0xf320('0x44')];if(_0x5191bd[_0x16b25c['id']])clearInterval(_0x5191bd[_0x16b25c['id']]);_0x5191bd[_0x16b25c['id']]=setInterval(refreshOauth2MicrosoftAccessToken[_0xf320('0x45')](this,{'id':_0x16b25c['id']}),OAUTH_REFRESH_INTERVAL*0x3e8);schedule[_0xf320('0x44')]=_0x5191bd;}function startAllRefreshIntervals(){return db[_0xf320('0x37')][_0xf320('0x46')]({'where':{'data6':{'$ne':null}},'raw':!![]})[_0xf320('0x35')](function(_0x244636){var _0x5c2b40=_0x244636[_0xf320('0xf')](function(_0x4052cc){return refreshOauth2MicrosoftAccessToken(_0x4052cc)[_0xf320('0x35')](function(_0x1720f6){startRefreshInterval(_0x1720f6);});});return Promise['all'](_0x5c2b40);})['catch'](function(_0x5a744c){var _0x28df0f=_0x5a744c?util[_0xf320('0x47')](_0x5a744c,{'showHidden':![],'depth':null}):'';logger[_0xf320('0x48')](_0xf320('0x49'),_0x28df0f);});}module[_0xf320('0x4a')]={'generateMicrosoftAuthorizationUrl':generateMicrosoftAuthorizationUrl,'getOauth2MicrosoftAccessToken':getOauth2MicrosoftAccessToken,'isValidIdToken':isValidIdToken,'startAllRefreshIntervals':startAllRefreshIntervals,'refreshOauth2MicrosoftAccessToken':refreshOauth2MicrosoftAccessToken,'startRefreshInterval':startRefreshInterval}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.rpc.js b/server/api/cloudProvider/cloudProvider.rpc.js index 30970b7..7ba21c2 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 _0xcbde=['http','request','then','CloudProvider,\x20%s,\x20%s','debug','stringify','error','code','message','info','request\x20sent','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','client'];(function(_0x2a18c3,_0x17c9ee){var _0xa9db85=function(_0x592284){while(--_0x592284){_0x2a18c3['push'](_0x2a18c3['shift']());}};_0xa9db85(++_0x17c9ee);}(_0xcbde,0x141));var _0xecbd=function(_0x3b91ca,_0x499085){_0x3b91ca=_0x3b91ca-0x0;var _0x3ab8e7=_0xcbde[_0x3b91ca];return _0x3ab8e7;};'use strict';var _=require(_0xecbd('0x0'));var util=require('util');var moment=require(_0xecbd('0x1'));var BPromise=require(_0xecbd('0x2'));var rs=require(_0xecbd('0x3'));var fs=require('fs');var Redis=require(_0xecbd('0x4'));var db=require(_0xecbd('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xecbd('0x6'));var config=require(_0xecbd('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xecbd('0x8')][_0xecbd('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x545ca6,_0x5d1ba5,_0x2947a0){return new BPromise(function(_0x3e9e7a,_0x2f3b03){return client[_0xecbd('0xa')](_0x545ca6,_0x2947a0)[_0xecbd('0xb')](function(_0x43a04e){logger['info'](_0xecbd('0xc'),_0x5d1ba5,'request\x20sent');logger[_0xecbd('0xd')]('CloudProvider,\x20%s,\x20%s,\x20%s',_0x5d1ba5,'request\x20sent',JSON[_0xecbd('0xe')](_0x43a04e));if(_0x43a04e['error']){if(_0x43a04e[_0xecbd('0xf')][_0xecbd('0x10')]===0x1f4){logger['error'](_0xecbd('0xc'),_0x5d1ba5,_0x43a04e[_0xecbd('0xf')][_0xecbd('0x11')]);return _0x2f3b03(_0x43a04e[_0xecbd('0xf')][_0xecbd('0x11')]);}logger[_0xecbd('0xf')](_0xecbd('0xc'),_0x5d1ba5,_0x43a04e[_0xecbd('0xf')][_0xecbd('0x11')]);return _0x3e9e7a(_0x43a04e['error'][_0xecbd('0x11')]);}else{logger[_0xecbd('0x12')](_0xecbd('0xc'),_0x5d1ba5,_0xecbd('0x13'));_0x3e9e7a(_0x43a04e[_0xecbd('0x14')][_0xecbd('0x11')]);}})[_0xecbd('0x15')](function(_0x1af064){logger[_0xecbd('0xf')](_0xecbd('0xc'),_0x5d1ba5,_0x1af064);_0x2f3b03(_0x1af064);});});} \ No newline at end of file +var _0x9e63=['../../config/environment','jayson/promise','http','then','CloudProvider,\x20%s,\x20%s','request\x20sent','debug','CloudProvider,\x20%s,\x20%s,\x20%s','error','code','message','info','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x3da832,_0x2133f1){var _0xe602f2=function(_0xb7b2f){while(--_0xb7b2f){_0x3da832['push'](_0x3da832['shift']());}};_0xe602f2(++_0x2133f1);}(_0x9e63,0x65));var _0x39e6=function(_0x5447fd,_0x52a6b5){_0x5447fd=_0x5447fd-0x0;var _0x15b28a=_0x9e63[_0x5447fd];return _0x15b28a;};'use strict';var _=require(_0x39e6('0x0'));var util=require(_0x39e6('0x1'));var moment=require(_0x39e6('0x2'));var BPromise=require('bluebird');var rs=require(_0x39e6('0x3'));var fs=require('fs');var Redis=require(_0x39e6('0x4'));var db=require(_0x39e6('0x5'))['db'];var utils=require(_0x39e6('0x6'));var logger=require(_0x39e6('0x7'))(_0x39e6('0x8'));var config=require(_0x39e6('0x9'));var jayson=require(_0x39e6('0xa'));var client=jayson['client'][_0x39e6('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3c2224,_0x3f2fa2,_0x554392){return new BPromise(function(_0x21938f,_0xddc291){return client['request'](_0x3c2224,_0x554392)[_0x39e6('0xc')](function(_0x4ee158){logger['info'](_0x39e6('0xd'),_0x3f2fa2,_0x39e6('0xe'));logger[_0x39e6('0xf')](_0x39e6('0x10'),_0x3f2fa2,_0x39e6('0xe'),JSON['stringify'](_0x4ee158));if(_0x4ee158['error']){if(_0x4ee158[_0x39e6('0x11')][_0x39e6('0x12')]===0x1f4){logger[_0x39e6('0x11')](_0x39e6('0xd'),_0x3f2fa2,_0x4ee158[_0x39e6('0x11')]['message']);return _0xddc291(_0x4ee158[_0x39e6('0x11')][_0x39e6('0x13')]);}logger[_0x39e6('0x11')](_0x39e6('0xd'),_0x3f2fa2,_0x4ee158['error']['message']);return _0x21938f(_0x4ee158[_0x39e6('0x11')][_0x39e6('0x13')]);}else{logger[_0x39e6('0x14')](_0x39e6('0xd'),_0x3f2fa2,_0x39e6('0xe'));_0x21938f(_0x4ee158['result'][_0x39e6('0x13')]);}})[_0x39e6('0x15')](function(_0x32ad13){logger[_0x39e6('0x11')](_0x39e6('0xd'),_0x3f2fa2,_0x32ad13);_0xddc291(_0x32ad13);});});} \ No newline at end of file diff --git a/server/api/cloudProvider/index.js b/server/api/cloudProvider/index.js index 2a91780..11bac21 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 _0x5f66=['index','post','/:id','update','delete','/:id/oauth2/microsoft/authorize/','oauth2MicrosoftAuthorize','oauth2MicrosoftCallback','Router','./cloudProvider.controller','get','isAuthenticated'];(function(_0x5d063b,_0x3e229a){var _0x342fe8=function(_0x575db6){while(--_0x575db6){_0x5d063b['push'](_0x5d063b['shift']());}};_0x342fe8(++_0x3e229a);}(_0x5f66,0x1a0));var _0x65f6=function(_0x173441,_0x26b0d9){_0x173441=_0x173441-0x0;var _0x2423a8=_0x5f66[_0x173441];return _0x2423a8;};'use strict';var express=require('express');var router=express[_0x65f6('0x0')]();var auth=require('../../components/auth/service');var controller=require(_0x65f6('0x1'));router[_0x65f6('0x2')]('/',auth[_0x65f6('0x3')](),controller[_0x65f6('0x4')]);router[_0x65f6('0x2')]('/:id',auth[_0x65f6('0x3')](),controller['show']);router[_0x65f6('0x5')]('/',auth[_0x65f6('0x3')](),controller['create']);router['put'](_0x65f6('0x6'),auth[_0x65f6('0x3')](),controller[_0x65f6('0x7')]);router[_0x65f6('0x8')](_0x65f6('0x6'),auth[_0x65f6('0x3')](),controller['destroy']);router['get'](_0x65f6('0x9'),auth[_0x65f6('0x3')](),controller[_0x65f6('0xa')]);router[_0x65f6('0x5')]('/oauth2/microsoft/callback',controller[_0x65f6('0xb')]);module['exports']=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(_0x427cb6,_0x55b1af){var _0x30472e=function(_0x411958){while(--_0x411958){_0x427cb6['push'](_0x427cb6['shift']());}};_0x30472e(++_0x55b1af);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x5a776b,_0x46f785){_0x5a776b=_0x5a776b-0x0;var _0xbbef59=_0xc4aa[_0x5a776b];return _0xbbef59;};'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 dd4f9cb..54afeb5 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 _0xbfd1=['name','STRING','exports'];(function(_0x4b1573,_0x746985){var _0x3ca77d=function(_0x53869d){while(--_0x53869d){_0x4b1573['push'](_0x4b1573['shift']());}};_0x3ca77d(++_0x746985);}(_0xbfd1,0x1b5));var _0x1bfd=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0xbfd1[_0x167cc1];return _0x10bc4b;};'use strict';var Sequelize=require('sequelize');module[_0x1bfd('0x0')]={'name':{'type':Sequelize['STRING'],'unique':_0x1bfd('0x1'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0x1bfd('0x2')]},'companyId':{'type':Sequelize['STRING']},'website':{'type':Sequelize[_0x1bfd('0x2')]},'phone':{'type':Sequelize[_0x1bfd('0x2')]},'fax':{'type':Sequelize[_0x1bfd('0x2')]},'type':{'type':Sequelize[_0x1bfd('0x2')]},'street':{'type':Sequelize[_0x1bfd('0x2')]},'postalCode':{'type':Sequelize['STRING']},'city':{'type':Sequelize[_0x1bfd('0x2')]},'country':{'type':Sequelize[_0x1bfd('0x2')]},'email':{'type':Sequelize[_0x1bfd('0x2')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0x1bfd('0x2')]},'sStreet':{'type':Sequelize['STRING']},'sPostalCode':{'type':Sequelize[_0x1bfd('0x2')]},'sCity':{'type':Sequelize[_0x1bfd('0x2')]},'sCountry':{'type':Sequelize[_0x1bfd('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xc2b0=['STRING','sequelize','name'];(function(_0x5822c6,_0x11d122){var _0x330d31=function(_0x223289){while(--_0x223289){_0x5822c6['push'](_0x5822c6['shift']());}};_0x330d31(++_0x11d122);}(_0xc2b0,0x13c));var _0x0c2b=function(_0x134192,_0x36adc5){_0x134192=_0x134192-0x0;var _0x3cd080=_0xc2b0[_0x134192];return _0x3cd080;};'use strict';var Sequelize=require(_0x0c2b('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0x0c2b('0x1'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0x0c2b('0x2')]},'companyId':{'type':Sequelize['STRING']},'website':{'type':Sequelize[_0x0c2b('0x2')]},'phone':{'type':Sequelize[_0x0c2b('0x2')]},'fax':{'type':Sequelize[_0x0c2b('0x2')]},'type':{'type':Sequelize[_0x0c2b('0x2')]},'street':{'type':Sequelize[_0x0c2b('0x2')]},'postalCode':{'type':Sequelize['STRING']},'city':{'type':Sequelize[_0x0c2b('0x2')]},'country':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0x0c2b('0x2')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize['STRING']},'sStreet':{'type':Sequelize[_0x0c2b('0x2')]},'sPostalCode':{'type':Sequelize[_0x0c2b('0x2')]},'sCity':{'type':Sequelize['STRING']},'sCountry':{'type':Sequelize[_0x0c2b('0x2')]},'description':{'type':Sequelize[_0x0c2b('0x2')]}}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.controller.js b/server/api/cmCompany/cmCompany.controller.js index f578923..04bb2fe 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 _0x9b4b=['findAll','rows','catch','show','rawAttributes','find','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','addContacts','CmContact','ids','getContacts','nolimit','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','status','json','limit','undefined','count','offset','set','apply','reject','save','update','then','get','Companies','UserProfileResource','destroy','end','sendStatus','error','stack','name','send','CmCompany','describe','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','sort','where','pick','filters','map','filter','merge','options'];(function(_0x501a13,_0x1bd9dc){var _0x567430=function(_0x3aad95){while(--_0x3aad95){_0x501a13['push'](_0x501a13['shift']());}};_0x567430(++_0x1bd9dc);}(_0x9b4b,0x154));var _0xb9b4=function(_0x10791d,_0x2562b6){_0x10791d=_0x10791d-0x0;var _0x1b4f9c=_0x9b4b[_0x10791d];return _0x1b4f9c;};'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('moment');var BPromise=require(_0xb9b4('0x0'));var Mustache=require(_0xb9b4('0x1'));var util=require(_0xb9b4('0x2'));var path=require(_0xb9b4('0x3'));var sox=require(_0xb9b4('0x4'));var csv=require(_0xb9b4('0x5'));var ejs=require(_0xb9b4('0x6'));var fs=require('fs');var fs_extra=require(_0xb9b4('0x7'));var _=require(_0xb9b4('0x8'));var squel=require(_0xb9b4('0x9'));var crypto=require(_0xb9b4('0xa'));var jsforce=require(_0xb9b4('0xb'));var deskjs=require(_0xb9b4('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xb9b4('0xd'));var Redis=require(_0xb9b4('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xb9b4('0xf'));var as=require(_0xb9b4('0x10'));var hardwareService=require(_0xb9b4('0x11'));var logger=require('../../config/logger')('api');var utils=require(_0xb9b4('0x12'));var config=require(_0xb9b4('0x13'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4e3de6,_0x536e1d){_0x536e1d=_0x536e1d||0xcc;return function(_0x32ec76){if(_0x32ec76){return _0x4e3de6['sendStatus'](_0x536e1d);}return _0x4e3de6[_0xb9b4('0x14')](_0x536e1d)['end']();};}function respondWithResult(_0xbcc604,_0x5a488e){_0x5a488e=_0x5a488e||0xc8;return function(_0x40c2b8){if(_0x40c2b8){return _0xbcc604['status'](_0x5a488e)[_0xb9b4('0x15')](_0x40c2b8);}};}function respondWithFilteredResult(_0x2773e2,_0x17774a){return function(_0x2ffc02){if(_0x2ffc02){var _0x47cf22=typeof _0x17774a['offset']==='undefined'&&typeof _0x17774a[_0xb9b4('0x16')]===_0xb9b4('0x17');var _0x5f0e62=_0x2ffc02[_0xb9b4('0x18')];var _0x2865c3=_0x47cf22?0x0:_0x17774a[_0xb9b4('0x19')];var _0x3234b9=_0x47cf22?_0x2ffc02[_0xb9b4('0x18')]:_0x17774a[_0xb9b4('0x19')]+_0x17774a[_0xb9b4('0x16')];var _0x2047dc;if(_0x3234b9>=_0x5f0e62){_0x3234b9=_0x5f0e62;_0x2047dc=0xc8;}else{_0x2047dc=0xce;}_0x2773e2['status'](_0x2047dc);return _0x2773e2[_0xb9b4('0x1a')]('Content-Range',_0x2865c3+'-'+_0x3234b9+'/'+_0x5f0e62)[_0xb9b4('0x15')](_0x2ffc02);}return null;};}function patchUpdates(_0x55f5d5){return function(_0x3d23a8){try{jsonpatch[_0xb9b4('0x1b')](_0x3d23a8,_0x55f5d5,!![]);}catch(_0x38b1a8){return BPromise[_0xb9b4('0x1c')](_0x38b1a8);}return _0x3d23a8[_0xb9b4('0x1d')]();};}function saveUpdates(_0x92d01e,_0x35354a){return function(_0x504d29){if(_0x504d29){return _0x504d29[_0xb9b4('0x1e')](_0x92d01e)[_0xb9b4('0x1f')](function(_0x52605e){return _0x52605e;});}return null;};}function removeEntity(_0x5451c6,_0x365da6){return function(_0x121505){if(_0x121505){return _0x121505['destroy']()['then'](function(){var _0x3c687d=_0x121505[_0xb9b4('0x20')]({'plain':!![]});var _0x487567=_0xb9b4('0x21');return db[_0xb9b4('0x22')][_0xb9b4('0x23')]({'where':{'type':_0x487567,'resourceId':_0x3c687d['id']}})[_0xb9b4('0x1f')](function(){return _0x121505;});})[_0xb9b4('0x1f')](function(){_0x5451c6['status'](0xcc)[_0xb9b4('0x24')]();});}};}function handleEntityNotFound(_0x238b53,_0x1d3307){return function(_0x1afc26){if(!_0x1afc26){_0x238b53[_0xb9b4('0x25')](0x194);}return _0x1afc26;};}function handleError(_0x1ffb5d,_0x1123de){_0x1123de=_0x1123de||0x1f4;return function(_0x4af896){logger[_0xb9b4('0x26')](_0x4af896[_0xb9b4('0x27')]);if(_0x4af896['name']){delete _0x4af896[_0xb9b4('0x28')];}_0x1ffb5d[_0xb9b4('0x14')](_0x1123de)[_0xb9b4('0x29')](_0x4af896);};}exports['index']=function(_0x36a045,_0x400279){var _0xe1b1a1={},_0x13ba16={},_0x189323={'count':0x0,'rows':[]};return db[_0xb9b4('0x2a')][_0xb9b4('0x2b')]()['then'](function(_0x5f1045){_0x13ba16[_0xb9b4('0x2c')]=_['keys'](_0x5f1045);_0x13ba16[_0xb9b4('0x2d')]=_[_0xb9b4('0x2e')](_0x36a045[_0xb9b4('0x2d')]);_0x13ba16['filters']=_['intersection'](_0x13ba16[_0xb9b4('0x2c')],_0x13ba16['query']);_0xe1b1a1['attributes']=_[_0xb9b4('0x2f')](_0x13ba16[_0xb9b4('0x2c')],qs['fields'](_0x36a045[_0xb9b4('0x2d')][_0xb9b4('0x30')]));_0xe1b1a1[_0xb9b4('0x31')]=_0xe1b1a1['attributes'][_0xb9b4('0x32')]?_0xe1b1a1[_0xb9b4('0x31')]:_0x13ba16[_0xb9b4('0x2c')];if(!_0x36a045[_0xb9b4('0x2d')][_0xb9b4('0x33')]('nolimit')){_0xe1b1a1[_0xb9b4('0x16')]=qs['limit'](_0x36a045['query'][_0xb9b4('0x16')]);_0xe1b1a1[_0xb9b4('0x19')]=qs[_0xb9b4('0x19')](_0x36a045[_0xb9b4('0x2d')][_0xb9b4('0x19')]);}_0xe1b1a1['order']=qs[_0xb9b4('0x34')](_0x36a045[_0xb9b4('0x2d')]['sort']);_0xe1b1a1[_0xb9b4('0x35')]=qs['filters'](_[_0xb9b4('0x36')](_0x36a045[_0xb9b4('0x2d')],_0x13ba16[_0xb9b4('0x37')]),_0x5f1045);if(_0x36a045[_0xb9b4('0x2d')]['filter']){_0xe1b1a1[_0xb9b4('0x35')]=_['merge'](_0xe1b1a1[_0xb9b4('0x35')],{'$or':_[_0xb9b4('0x38')](_0xe1b1a1[_0xb9b4('0x31')],function(_0x2a76e5){var _0x555cbf={};_0x555cbf[_0x2a76e5]={'$like':'%'+_0x36a045[_0xb9b4('0x2d')][_0xb9b4('0x39')]+'%'};return _0x555cbf;})});}_0xe1b1a1=_[_0xb9b4('0x3a')]({},_0xe1b1a1,_0x36a045[_0xb9b4('0x3b')]);var _0x2be7f0={'where':_0xe1b1a1[_0xb9b4('0x35')]};return db['CmCompany'][_0xb9b4('0x18')](_0x2be7f0)[_0xb9b4('0x1f')](function(_0x2d23cd){_0x189323[_0xb9b4('0x18')]=_0x2d23cd;if(_0x36a045[_0xb9b4('0x2d')]['includeAll']){_0xe1b1a1['include']=[{'all':!![]}];}return db[_0xb9b4('0x2a')][_0xb9b4('0x3c')](_0xe1b1a1);})['then'](function(_0x5089b1){_0x189323[_0xb9b4('0x3d')]=_0x5089b1;return _0x189323;})[_0xb9b4('0x1f')](respondWithFilteredResult(_0x400279,_0xe1b1a1))[_0xb9b4('0x3e')](handleError(_0x400279,null));})[_0xb9b4('0x3e')](handleError(_0x400279,null));};exports[_0xb9b4('0x3f')]=function(_0x224dd6,_0x4d9158){var _0x2b18d3={'raw':![],'where':{'id':_0x224dd6['params']['id']}},_0xf239db={};_0xf239db[_0xb9b4('0x2c')]=_['keys'](db[_0xb9b4('0x2a')][_0xb9b4('0x40')]);_0xf239db[_0xb9b4('0x2d')]=_[_0xb9b4('0x2e')](_0x224dd6['query']);_0xf239db['filters']=_[_0xb9b4('0x2f')](_0xf239db[_0xb9b4('0x2c')],_0xf239db[_0xb9b4('0x2d')]);_0x2b18d3['attributes']=_['intersection'](_0xf239db[_0xb9b4('0x2c')],qs['fields'](_0x224dd6['query'][_0xb9b4('0x30')]));_0x2b18d3[_0xb9b4('0x31')]=_0x2b18d3['attributes']['length']?_0x2b18d3['attributes']:_0xf239db[_0xb9b4('0x2c')];if(_0x224dd6[_0xb9b4('0x2d')]['includeAll']){_0x2b18d3['include']=[{'all':!![]}];}_0x2b18d3=_[_0xb9b4('0x3a')]({},_0x2b18d3,_0x224dd6[_0xb9b4('0x3b')]);return db[_0xb9b4('0x2a')][_0xb9b4('0x41')](_0x2b18d3)['then'](handleEntityNotFound(_0x4d9158,null))[_0xb9b4('0x1f')](respondWithResult(_0x4d9158,null))[_0xb9b4('0x3e')](handleError(_0x4d9158,null));};exports['create']=function(_0x24f1b1,_0x47591d){return db[_0xb9b4('0x2a')]['create'](_0x24f1b1['body'],{})[_0xb9b4('0x1f')](function(_0x515922){var _0x2db4aa=_0x24f1b1[_0xb9b4('0x42')][_0xb9b4('0x20')]({'plain':!![]});if(!_0x2db4aa)throw new Error(_0xb9b4('0x43'));if(_0x2db4aa[_0xb9b4('0x44')]===_0xb9b4('0x42')){var _0x218d1f=_0x515922[_0xb9b4('0x20')]({'plain':!![]});var _0x2194a4='Companies';return db[_0xb9b4('0x45')][_0xb9b4('0x41')]({'where':{'name':_0x2194a4,'userProfileId':_0x2db4aa[_0xb9b4('0x46')]},'raw':!![]})[_0xb9b4('0x1f')](function(_0x3b1dff){if(_0x3b1dff&&_0x3b1dff['autoAssociation']===0x0){return db[_0xb9b4('0x22')][_0xb9b4('0x47')]({'name':_0x218d1f[_0xb9b4('0x28')],'resourceId':_0x218d1f['id'],'type':_0x3b1dff[_0xb9b4('0x28')],'sectionId':_0x3b1dff['id']},{})['then'](function(){return _0x515922;});}else{return _0x515922;}})[_0xb9b4('0x3e')](function(_0x14d09d){logger['error'](_0xb9b4('0x48'),_0x14d09d);throw _0x14d09d;});}return _0x515922;})['then'](respondWithResult(_0x47591d,0xc9))[_0xb9b4('0x3e')](handleError(_0x47591d,null));};exports[_0xb9b4('0x1e')]=function(_0x224f0a,_0x499e54){if(_0x224f0a[_0xb9b4('0x49')]['id']){delete _0x224f0a[_0xb9b4('0x49')]['id'];}return db['CmCompany']['find']({'where':{'id':_0x224f0a['params']['id']}})['then'](handleEntityNotFound(_0x499e54,null))[_0xb9b4('0x1f')](saveUpdates(_0x224f0a[_0xb9b4('0x49')],null))[_0xb9b4('0x1f')](respondWithResult(_0x499e54,null))[_0xb9b4('0x3e')](handleError(_0x499e54,null));};exports[_0xb9b4('0x23')]=function(_0xf1d689,_0x3ca4d6){return db[_0xb9b4('0x2a')]['find']({'where':{'id':_0xf1d689[_0xb9b4('0x4a')]['id']}})[_0xb9b4('0x1f')](handleEntityNotFound(_0x3ca4d6,null))['then'](removeEntity(_0x3ca4d6,null))[_0xb9b4('0x3e')](handleError(_0x3ca4d6,null));};exports[_0xb9b4('0x2b')]=function(_0x1907f4,_0x349bc8){return db['CmCompany']['describe']()[_0xb9b4('0x1f')](respondWithResult(_0x349bc8,null))[_0xb9b4('0x3e')](handleError(_0x349bc8,null));};exports[_0xb9b4('0x4b')]=function(_0x45987e,_0x2ef6d7,_0x266644){return db[_0xb9b4('0x4c')][_0xb9b4('0x41')]({'where':{'id':_0x45987e[_0xb9b4('0x4a')]['id']}})[_0xb9b4('0x1f')](handleEntityNotFound(_0x2ef6d7,null))[_0xb9b4('0x1f')](function(_0x5d4a90){if(_0x5d4a90){return _0x5d4a90[_0xb9b4('0x4b')](_0x45987e[_0xb9b4('0x49')][_0xb9b4('0x4d')],_['omit'](_0x45987e['body'],[_0xb9b4('0x4d'),'id'])||{});}})['then'](respondWithResult(_0x2ef6d7,null))[_0xb9b4('0x3e')](handleError(_0x2ef6d7,null));};exports[_0xb9b4('0x4e')]=function(_0x4785c0,_0x40f912,_0xd73365){var _0x2fbc3c={};var _0x1f2230={};var _0x97557f;var _0x24a945;return db[_0xb9b4('0x2a')]['findOne']({'where':{'id':_0x4785c0['params']['id']}})[_0xb9b4('0x1f')](handleEntityNotFound(_0x40f912,null))[_0xb9b4('0x1f')](function(_0x4c64d5){if(_0x4c64d5){_0x97557f=_0x4c64d5;_0x1f2230[_0xb9b4('0x2c')]=_[_0xb9b4('0x2e')](db[_0xb9b4('0x4c')][_0xb9b4('0x40')]);_0x1f2230['query']=_[_0xb9b4('0x2e')](_0x4785c0['query']);_0x1f2230[_0xb9b4('0x37')]=_[_0xb9b4('0x2f')](_0x1f2230[_0xb9b4('0x2c')],_0x1f2230[_0xb9b4('0x2d')]);_0x2fbc3c[_0xb9b4('0x31')]=_[_0xb9b4('0x2f')](_0x1f2230[_0xb9b4('0x2c')],qs['fields'](_0x4785c0[_0xb9b4('0x2d')][_0xb9b4('0x30')]));_0x2fbc3c['attributes']=_0x2fbc3c[_0xb9b4('0x31')][_0xb9b4('0x32')]?_0x2fbc3c[_0xb9b4('0x31')]:_0x1f2230[_0xb9b4('0x2c')];_0x2fbc3c['order']=qs[_0xb9b4('0x34')](_0x4785c0[_0xb9b4('0x2d')]['sort']);_0x2fbc3c[_0xb9b4('0x35')]=qs[_0xb9b4('0x37')](_[_0xb9b4('0x36')](_0x4785c0['query'],_0x1f2230[_0xb9b4('0x37')]));if(_0x4785c0[_0xb9b4('0x2d')][_0xb9b4('0x39')]){_0x2fbc3c[_0xb9b4('0x35')]=_['merge'](_0x2fbc3c['where'],{'$or':_[_0xb9b4('0x38')](_0x2fbc3c[_0xb9b4('0x31')],function(_0x200fa6){var _0x584414={};_0x584414[_0x200fa6]={'$like':'%'+_0x4785c0[_0xb9b4('0x2d')]['filter']+'%'};return _0x584414;})});}_0x2fbc3c=_[_0xb9b4('0x3a')]({},_0x2fbc3c,_0x4785c0[_0xb9b4('0x3b')]);return _0x97557f[_0xb9b4('0x4e')](_0x2fbc3c);}})[_0xb9b4('0x1f')](function(_0x43915d){if(_0x43915d){_0x24a945=_0x43915d[_0xb9b4('0x32')];if(!_0x4785c0[_0xb9b4('0x2d')]['hasOwnProperty'](_0xb9b4('0x4f'))){_0x2fbc3c[_0xb9b4('0x16')]=qs['limit'](_0x4785c0[_0xb9b4('0x2d')][_0xb9b4('0x16')]);_0x2fbc3c[_0xb9b4('0x19')]=qs[_0xb9b4('0x19')](_0x4785c0[_0xb9b4('0x2d')][_0xb9b4('0x19')]);}return _0x97557f[_0xb9b4('0x4e')](_0x2fbc3c);}})[_0xb9b4('0x1f')](function(_0x171e9f){if(_0x171e9f){return _0x171e9f?{'count':_0x24a945,'rows':_0x171e9f}:null;}})[_0xb9b4('0x1f')](respondWithResult(_0x40f912,null))[_0xb9b4('0x3e')](handleError(_0x40f912,null));}; \ No newline at end of file +var _0x7ca0=['then','destroy','Companies','error','name','send','index','CmCompany','query','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','map','options','includeAll','include','rows','catch','show','params','keys','rawAttributes','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','UserProfileResource','describe','addContacts','CmContact','ids','omit','getContacts','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update'];(function(_0x258fb0,_0x5362dc){var _0x4d1afe=function(_0x1c8f24){while(--_0x1c8f24){_0x258fb0['push'](_0x258fb0['shift']());}};_0x4d1afe(++_0x5362dc);}(_0x7ca0,0x18d));var _0x07ca=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7ca0[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x07ca('0x0'));var zipdir=require(_0x07ca('0x1'));var jsonpatch=require(_0x07ca('0x2'));var rp=require(_0x07ca('0x3'));var moment=require(_0x07ca('0x4'));var BPromise=require(_0x07ca('0x5'));var Mustache=require('mustache');var util=require(_0x07ca('0x6'));var path=require(_0x07ca('0x7'));var sox=require(_0x07ca('0x8'));var csv=require(_0x07ca('0x9'));var ejs=require(_0x07ca('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x07ca('0xb'));var squel=require(_0x07ca('0xc'));var crypto=require(_0x07ca('0xd'));var jsforce=require(_0x07ca('0xe'));var deskjs=require(_0x07ca('0xf'));var toCsv=require('to-csv');var querystring=require(_0x07ca('0x10'));var Papa=require(_0x07ca('0x11'));var Redis=require(_0x07ca('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x07ca('0x13'));var as=require(_0x07ca('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x07ca('0x15'));var utils=require(_0x07ca('0x16'));var config=require(_0x07ca('0x17'));var licenseUtil=require(_0x07ca('0x18'));var db=require(_0x07ca('0x19'))['db'];function respondWithStatusCode(_0x1c8928,_0x328652){_0x328652=_0x328652||0xcc;return function(_0x571746){if(_0x571746){return _0x1c8928['sendStatus'](_0x328652);}return _0x1c8928['status'](_0x328652)[_0x07ca('0x1a')]();};}function respondWithResult(_0x5b4768,_0x5b607f){_0x5b607f=_0x5b607f||0xc8;return function(_0x1c2311){if(_0x1c2311){return _0x5b4768[_0x07ca('0x1b')](_0x5b607f)[_0x07ca('0x1c')](_0x1c2311);}};}function respondWithFilteredResult(_0x362486,_0x1a6149){return function(_0x5acb7b){if(_0x5acb7b){var _0x35d737=typeof _0x1a6149[_0x07ca('0x1d')]===_0x07ca('0x1e')&&typeof _0x1a6149[_0x07ca('0x1f')]===_0x07ca('0x1e');var _0x50e0fa=_0x5acb7b[_0x07ca('0x20')];var _0x57c9c3=_0x35d737?0x0:_0x1a6149['offset'];var _0x5bab6e=_0x35d737?_0x5acb7b[_0x07ca('0x20')]:_0x1a6149[_0x07ca('0x1d')]+_0x1a6149[_0x07ca('0x1f')];var _0x3afd5a;if(_0x5bab6e>=_0x50e0fa){_0x5bab6e=_0x50e0fa;_0x3afd5a=0xc8;}else{_0x3afd5a=0xce;}_0x362486['status'](_0x3afd5a);return _0x362486[_0x07ca('0x21')](_0x07ca('0x22'),_0x57c9c3+'-'+_0x5bab6e+'/'+_0x50e0fa)[_0x07ca('0x1c')](_0x5acb7b);}return null;};}function patchUpdates(_0x22a512){return function(_0x126203){try{jsonpatch[_0x07ca('0x23')](_0x126203,_0x22a512,!![]);}catch(_0x3acf56){return BPromise[_0x07ca('0x24')](_0x3acf56);}return _0x126203['save']();};}function saveUpdates(_0x5a84df,_0x54a48b){return function(_0x2a0013){if(_0x2a0013){return _0x2a0013[_0x07ca('0x25')](_0x5a84df)[_0x07ca('0x26')](function(_0x1e8330){return _0x1e8330;});}return null;};}function removeEntity(_0x3227bb,_0x498eba){return function(_0x3b1bf4){if(_0x3b1bf4){return _0x3b1bf4[_0x07ca('0x27')]()[_0x07ca('0x26')](function(){var _0x31a7cf=_0x3b1bf4['get']({'plain':!![]});var _0x288914=_0x07ca('0x28');return db['UserProfileResource'][_0x07ca('0x27')]({'where':{'type':_0x288914,'resourceId':_0x31a7cf['id']}})[_0x07ca('0x26')](function(){return _0x3b1bf4;});})[_0x07ca('0x26')](function(){_0x3227bb[_0x07ca('0x1b')](0xcc)[_0x07ca('0x1a')]();});}};}function handleEntityNotFound(_0x314ca4,_0xd31b6){return function(_0x44726a){if(!_0x44726a){_0x314ca4['sendStatus'](0x194);}return _0x44726a;};}function handleError(_0x3721f4,_0x5ef15b){_0x5ef15b=_0x5ef15b||0x1f4;return function(_0x395da3){logger[_0x07ca('0x29')](_0x395da3['stack']);if(_0x395da3['name']){delete _0x395da3[_0x07ca('0x2a')];}_0x3721f4[_0x07ca('0x1b')](_0x5ef15b)[_0x07ca('0x2b')](_0x395da3);};}exports[_0x07ca('0x2c')]=function(_0x4ca33c,_0xe47ced){var _0xe859b9={},_0x48f3f0={},_0x3caacd={'count':0x0,'rows':[]};return db[_0x07ca('0x2d')]['describe']()[_0x07ca('0x26')](function(_0xc94936){_0x48f3f0['model']=_['keys'](_0xc94936);_0x48f3f0[_0x07ca('0x2e')]=_['keys'](_0x4ca33c[_0x07ca('0x2e')]);_0x48f3f0[_0x07ca('0x2f')]=_['intersection'](_0x48f3f0[_0x07ca('0x30')],_0x48f3f0[_0x07ca('0x2e')]);_0xe859b9[_0x07ca('0x31')]=_[_0x07ca('0x32')](_0x48f3f0[_0x07ca('0x30')],qs['fields'](_0x4ca33c[_0x07ca('0x2e')][_0x07ca('0x33')]));_0xe859b9['attributes']=_0xe859b9['attributes'][_0x07ca('0x34')]?_0xe859b9[_0x07ca('0x31')]:_0x48f3f0[_0x07ca('0x30')];if(!_0x4ca33c[_0x07ca('0x2e')][_0x07ca('0x35')](_0x07ca('0x36'))){_0xe859b9[_0x07ca('0x1f')]=qs[_0x07ca('0x1f')](_0x4ca33c[_0x07ca('0x2e')][_0x07ca('0x1f')]);_0xe859b9[_0x07ca('0x1d')]=qs[_0x07ca('0x1d')](_0x4ca33c['query'][_0x07ca('0x1d')]);}_0xe859b9[_0x07ca('0x37')]=qs[_0x07ca('0x38')](_0x4ca33c[_0x07ca('0x2e')][_0x07ca('0x38')]);_0xe859b9[_0x07ca('0x39')]=qs[_0x07ca('0x2f')](_[_0x07ca('0x3a')](_0x4ca33c[_0x07ca('0x2e')],_0x48f3f0[_0x07ca('0x2f')]),_0xc94936);if(_0x4ca33c[_0x07ca('0x2e')][_0x07ca('0x3b')]){_0xe859b9[_0x07ca('0x39')]=_[_0x07ca('0x3c')](_0xe859b9[_0x07ca('0x39')],{'$or':_[_0x07ca('0x3d')](_0xe859b9[_0x07ca('0x31')],function(_0x43c922){var _0x2a0b5a={};_0x2a0b5a[_0x43c922]={'$like':'%'+_0x4ca33c[_0x07ca('0x2e')]['filter']+'%'};return _0x2a0b5a;})});}_0xe859b9=_[_0x07ca('0x3c')]({},_0xe859b9,_0x4ca33c[_0x07ca('0x3e')]);var _0x134331={'where':_0xe859b9['where']};return db[_0x07ca('0x2d')][_0x07ca('0x20')](_0x134331)[_0x07ca('0x26')](function(_0x254f63){_0x3caacd['count']=_0x254f63;if(_0x4ca33c[_0x07ca('0x2e')][_0x07ca('0x3f')]){_0xe859b9[_0x07ca('0x40')]=[{'all':!![]}];}return db['CmCompany']['findAll'](_0xe859b9);})[_0x07ca('0x26')](function(_0x5a5217){_0x3caacd[_0x07ca('0x41')]=_0x5a5217;return _0x3caacd;})[_0x07ca('0x26')](respondWithFilteredResult(_0xe47ced,_0xe859b9))[_0x07ca('0x42')](handleError(_0xe47ced,null));})[_0x07ca('0x42')](handleError(_0xe47ced,null));};exports[_0x07ca('0x43')]=function(_0x3e10f4,_0x191c29){var _0x2e90d6={'raw':![],'where':{'id':_0x3e10f4[_0x07ca('0x44')]['id']}},_0x3d7c34={};_0x3d7c34[_0x07ca('0x30')]=_[_0x07ca('0x45')](db['CmCompany'][_0x07ca('0x46')]);_0x3d7c34[_0x07ca('0x2e')]=_[_0x07ca('0x45')](_0x3e10f4[_0x07ca('0x2e')]);_0x3d7c34[_0x07ca('0x2f')]=_[_0x07ca('0x32')](_0x3d7c34[_0x07ca('0x30')],_0x3d7c34[_0x07ca('0x2e')]);_0x2e90d6['attributes']=_['intersection'](_0x3d7c34[_0x07ca('0x30')],qs[_0x07ca('0x33')](_0x3e10f4[_0x07ca('0x2e')][_0x07ca('0x33')]));_0x2e90d6[_0x07ca('0x31')]=_0x2e90d6['attributes'][_0x07ca('0x34')]?_0x2e90d6[_0x07ca('0x31')]:_0x3d7c34[_0x07ca('0x30')];if(_0x3e10f4['query']['includeAll']){_0x2e90d6[_0x07ca('0x40')]=[{'all':!![]}];}_0x2e90d6=_[_0x07ca('0x3c')]({},_0x2e90d6,_0x3e10f4[_0x07ca('0x3e')]);return db[_0x07ca('0x2d')][_0x07ca('0x47')](_0x2e90d6)[_0x07ca('0x26')](handleEntityNotFound(_0x191c29,null))[_0x07ca('0x26')](respondWithResult(_0x191c29,null))['catch'](handleError(_0x191c29,null));};exports[_0x07ca('0x48')]=function(_0x3f60d1,_0x1fccfa){return db[_0x07ca('0x2d')][_0x07ca('0x48')](_0x3f60d1[_0x07ca('0x49')],{})[_0x07ca('0x26')](function(_0x5de764){var _0x33b88c=_0x3f60d1[_0x07ca('0x4a')][_0x07ca('0x4b')]({'plain':!![]});if(!_0x33b88c)throw new Error(_0x07ca('0x4c'));if(_0x33b88c[_0x07ca('0x4d')]===_0x07ca('0x4a')){var _0xdb7cd0=_0x5de764[_0x07ca('0x4b')]({'plain':!![]});var _0xfc3128=_0x07ca('0x28');return db['UserProfileSection'][_0x07ca('0x47')]({'where':{'name':_0xfc3128,'userProfileId':_0x33b88c[_0x07ca('0x4e')]},'raw':!![]})[_0x07ca('0x26')](function(_0x5baecd){if(_0x5baecd&&_0x5baecd[_0x07ca('0x4f')]===0x0){return db[_0x07ca('0x50')][_0x07ca('0x48')]({'name':_0xdb7cd0['name'],'resourceId':_0xdb7cd0['id'],'type':_0x5baecd[_0x07ca('0x2a')],'sectionId':_0x5baecd['id']},{})['then'](function(){return _0x5de764;});}else{return _0x5de764;}})[_0x07ca('0x42')](function(_0x1a27f6){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1a27f6);throw _0x1a27f6;});}return _0x5de764;})['then'](respondWithResult(_0x1fccfa,0xc9))[_0x07ca('0x42')](handleError(_0x1fccfa,null));};exports['update']=function(_0x106942,_0x4b2900){if(_0x106942['body']['id']){delete _0x106942[_0x07ca('0x49')]['id'];}return db[_0x07ca('0x2d')][_0x07ca('0x47')]({'where':{'id':_0x106942[_0x07ca('0x44')]['id']}})[_0x07ca('0x26')](handleEntityNotFound(_0x4b2900,null))[_0x07ca('0x26')](saveUpdates(_0x106942[_0x07ca('0x49')],null))[_0x07ca('0x26')](respondWithResult(_0x4b2900,null))[_0x07ca('0x42')](handleError(_0x4b2900,null));};exports[_0x07ca('0x27')]=function(_0x52111f,_0x4bc1a9){return db[_0x07ca('0x2d')][_0x07ca('0x47')]({'where':{'id':_0x52111f['params']['id']}})[_0x07ca('0x26')](handleEntityNotFound(_0x4bc1a9,null))['then'](removeEntity(_0x4bc1a9,null))[_0x07ca('0x42')](handleError(_0x4bc1a9,null));};exports[_0x07ca('0x51')]=function(_0x1729f0,_0x161de3){return db[_0x07ca('0x2d')]['describe']()[_0x07ca('0x26')](respondWithResult(_0x161de3,null))[_0x07ca('0x42')](handleError(_0x161de3,null));};exports[_0x07ca('0x52')]=function(_0x341840,_0x42e33d,_0x128772){return db[_0x07ca('0x53')][_0x07ca('0x47')]({'where':{'id':_0x341840[_0x07ca('0x44')]['id']}})[_0x07ca('0x26')](handleEntityNotFound(_0x42e33d,null))['then'](function(_0x1d5dc6){if(_0x1d5dc6){return _0x1d5dc6[_0x07ca('0x52')](_0x341840['body'][_0x07ca('0x54')],_[_0x07ca('0x55')](_0x341840['body'],[_0x07ca('0x54'),'id'])||{});}})[_0x07ca('0x26')](respondWithResult(_0x42e33d,null))['catch'](handleError(_0x42e33d,null));};exports['getContacts']=function(_0x497520,_0x3a8808,_0x40a5fc){var _0x457d77={};var _0x484909={};var _0x13f980;var _0x4e6678;return db['CmCompany']['findOne']({'where':{'id':_0x497520[_0x07ca('0x44')]['id']}})[_0x07ca('0x26')](handleEntityNotFound(_0x3a8808,null))[_0x07ca('0x26')](function(_0x6496e5){if(_0x6496e5){_0x13f980=_0x6496e5;_0x484909['model']=_[_0x07ca('0x45')](db[_0x07ca('0x53')][_0x07ca('0x46')]);_0x484909['query']=_[_0x07ca('0x45')](_0x497520[_0x07ca('0x2e')]);_0x484909['filters']=_[_0x07ca('0x32')](_0x484909['model'],_0x484909[_0x07ca('0x2e')]);_0x457d77[_0x07ca('0x31')]=_[_0x07ca('0x32')](_0x484909[_0x07ca('0x30')],qs[_0x07ca('0x33')](_0x497520[_0x07ca('0x2e')][_0x07ca('0x33')]));_0x457d77[_0x07ca('0x31')]=_0x457d77['attributes'][_0x07ca('0x34')]?_0x457d77[_0x07ca('0x31')]:_0x484909[_0x07ca('0x30')];_0x457d77['order']=qs[_0x07ca('0x38')](_0x497520['query'][_0x07ca('0x38')]);_0x457d77[_0x07ca('0x39')]=qs[_0x07ca('0x2f')](_[_0x07ca('0x3a')](_0x497520[_0x07ca('0x2e')],_0x484909[_0x07ca('0x2f')]));if(_0x497520[_0x07ca('0x2e')][_0x07ca('0x3b')]){_0x457d77[_0x07ca('0x39')]=_[_0x07ca('0x3c')](_0x457d77[_0x07ca('0x39')],{'$or':_[_0x07ca('0x3d')](_0x457d77[_0x07ca('0x31')],function(_0x2ad9f9){var _0x1e53c1={};_0x1e53c1[_0x2ad9f9]={'$like':'%'+_0x497520[_0x07ca('0x2e')]['filter']+'%'};return _0x1e53c1;})});}_0x457d77=_[_0x07ca('0x3c')]({},_0x457d77,_0x497520[_0x07ca('0x3e')]);return _0x13f980[_0x07ca('0x56')](_0x457d77);}})['then'](function(_0x4948ff){if(_0x4948ff){_0x4e6678=_0x4948ff[_0x07ca('0x34')];if(!_0x497520['query'][_0x07ca('0x35')](_0x07ca('0x36'))){_0x457d77[_0x07ca('0x1f')]=qs['limit'](_0x497520[_0x07ca('0x2e')][_0x07ca('0x1f')]);_0x457d77[_0x07ca('0x1d')]=qs['offset'](_0x497520[_0x07ca('0x2e')]['offset']);}return _0x13f980[_0x07ca('0x56')](_0x457d77);}})[_0x07ca('0x26')](function(_0x59cbed){if(_0x59cbed){return _0x59cbed?{'count':_0x4e6678,'rows':_0x59cbed}:null;}})[_0x07ca('0x26')](respondWithResult(_0x3a8808,null))[_0x07ca('0x42')](handleError(_0x3a8808,null));}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.model.js b/server/api/cmCompany/cmCompany.model.js index 64fc461..05e05fa 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 _0x5890=['util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','CmCompany','cm_companies','lodash'];(function(_0x45f143,_0x42ba90){var _0x898312=function(_0xe86ac3){while(--_0xe86ac3){_0x45f143['push'](_0x45f143['shift']());}};_0x898312(++_0x42ba90);}(_0x5890,0x15b));var _0x0589=function(_0x3890c3,_0x3ea3ed){_0x3890c3=_0x3890c3-0x0;var _0x1a7d5d=_0x5890[_0x3890c3];return _0x1a7d5d;};'use strict';var _=require(_0x0589('0x0'));var util=require(_0x0589('0x1'));var logger=require(_0x0589('0x2'))('api');var moment=require(_0x0589('0x3'));var BPromise=require(_0x0589('0x4'));var rp=require(_0x0589('0x5'));var fs=require('fs');var path=require(_0x0589('0x6'));var rimraf=require(_0x0589('0x7'));var config=require(_0x0589('0x8'));var attributes=require('./cmCompany.attributes');module[_0x0589('0x9')]=function(_0x224a20,_0xca963c){return _0x224a20['define'](_0x0589('0xa'),attributes,{'tableName':_0x0589('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x883c=['util','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cmCompany.attributes','exports','cm_companies','lodash'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x883c,0x133));var _0xc883=function(_0x21c48a,_0x262750){_0x21c48a=_0x21c48a-0x0;var _0x7b019=_0x883c[_0x21c48a];return _0x7b019;};'use strict';var _=require(_0xc883('0x0'));var util=require(_0xc883('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xc883('0x2'));var BPromise=require(_0xc883('0x3'));var rp=require(_0xc883('0x4'));var fs=require('fs');var path=require(_0xc883('0x5'));var rimraf=require(_0xc883('0x6'));var config=require(_0xc883('0x7'));var attributes=require(_0xc883('0x8'));module[_0xc883('0x9')]=function(_0xa959e3,_0x8e327e){return _0xa959e3['define']('CmCompany',attributes,{'tableName':_0xc883('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.rpc.js b/server/api/cmCompany/cmCompany.rpc.js index e2766e1..43fe03e 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 _0x5533=['debug','CmCompany,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','then','info','CmCompany,\x20%s,\x20%s','request\x20sent'];(function(_0x6c993a,_0x5ea3ab){var _0x27f547=function(_0x22df20){while(--_0x22df20){_0x6c993a['push'](_0x6c993a['shift']());}};_0x27f547(++_0x5ea3ab);}(_0x5533,0x10b));var _0x3553=function(_0x44422c,_0x3916c5){_0x44422c=_0x44422c-0x0;var _0x3963c6=_0x5533[_0x44422c];return _0x3963c6;};'use strict';var _=require('lodash');var util=require(_0x3553('0x0'));var moment=require(_0x3553('0x1'));var BPromise=require(_0x3553('0x2'));var rs=require(_0x3553('0x3'));var fs=require('fs');var Redis=require(_0x3553('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x3553('0x5'));var logger=require(_0x3553('0x6'))(_0x3553('0x7'));var config=require(_0x3553('0x8'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x1c6112,_0x11e123,_0x11b6a8){return new BPromise(function(_0x544862,_0x1b6a8e){return client['request'](_0x1c6112,_0x11b6a8)[_0x3553('0x9')](function(_0x2ed1f0){logger[_0x3553('0xa')](_0x3553('0xb'),_0x11e123,_0x3553('0xc'));logger[_0x3553('0xd')](_0x3553('0xe'),_0x11e123,_0x3553('0xc'),JSON[_0x3553('0xf')](_0x2ed1f0));if(_0x2ed1f0[_0x3553('0x10')]){if(_0x2ed1f0[_0x3553('0x10')][_0x3553('0x11')]===0x1f4){logger[_0x3553('0x10')](_0x3553('0xb'),_0x11e123,_0x2ed1f0[_0x3553('0x10')][_0x3553('0x12')]);return _0x1b6a8e(_0x2ed1f0['error'][_0x3553('0x12')]);}logger[_0x3553('0x10')](_0x3553('0xb'),_0x11e123,_0x2ed1f0[_0x3553('0x10')][_0x3553('0x12')]);return _0x544862(_0x2ed1f0['error'][_0x3553('0x12')]);}else{logger[_0x3553('0xa')](_0x3553('0xb'),_0x11e123,'request\x20sent');_0x544862(_0x2ed1f0['result'][_0x3553('0x12')]);}})[_0x3553('0x13')](function(_0x315072){logger[_0x3553('0x10')](_0x3553('0xb'),_0x11e123,_0x315072);_0x1b6a8e(_0x315072);});});} \ No newline at end of file +var _0x9755=['debug','CmCompany,\x20%s,\x20%s,\x20%s','stringify','error','code','message','CmCompany,\x20%s,\x20%s','catch','lodash','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','client','http','request','then','info','request\x20sent'];(function(_0x586998,_0xc9fd34){var _0x1c882d=function(_0x48b3e8){while(--_0x48b3e8){_0x586998['push'](_0x586998['shift']());}};_0x1c882d(++_0xc9fd34);}(_0x9755,0x9b));var _0x5975=function(_0x7ad123,_0xeeeef3){_0x7ad123=_0x7ad123-0x0;var _0x37d073=_0x9755[_0x7ad123];return _0x37d073;};'use strict';var _=require(_0x5975('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x5975('0x1'));var rs=require(_0x5975('0x2'));var fs=require('fs');var Redis=require(_0x5975('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x5975('0x4'));var logger=require(_0x5975('0x5'))(_0x5975('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x5975('0x7')][_0x5975('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5e88ee,_0x56c167,_0x29695b){return new BPromise(function(_0x1d811a,_0x3e54b0){return client[_0x5975('0x9')](_0x5e88ee,_0x29695b)[_0x5975('0xa')](function(_0x1a580f){logger[_0x5975('0xb')]('CmCompany,\x20%s,\x20%s',_0x56c167,_0x5975('0xc'));logger[_0x5975('0xd')](_0x5975('0xe'),_0x56c167,_0x5975('0xc'),JSON[_0x5975('0xf')](_0x1a580f));if(_0x1a580f['error']){if(_0x1a580f[_0x5975('0x10')][_0x5975('0x11')]===0x1f4){logger[_0x5975('0x10')]('CmCompany,\x20%s,\x20%s',_0x56c167,_0x1a580f[_0x5975('0x10')][_0x5975('0x12')]);return _0x3e54b0(_0x1a580f[_0x5975('0x10')]['message']);}logger[_0x5975('0x10')](_0x5975('0x13'),_0x56c167,_0x1a580f[_0x5975('0x10')][_0x5975('0x12')]);return _0x1d811a(_0x1a580f['error'][_0x5975('0x12')]);}else{logger[_0x5975('0xb')](_0x5975('0x13'),_0x56c167,_0x5975('0xc'));_0x1d811a(_0x1a580f['result'][_0x5975('0x12')]);}})[_0x5975('0x14')](function(_0x31249f){logger[_0x5975('0x10')](_0x5975('0x13'),_0x56c167,_0x31249f);_0x3e54b0(_0x31249f);});});} \ No newline at end of file diff --git a/server/api/cmCompany/index.js b/server/api/cmCompany/index.js index 9b317f7..9fd249e 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 _0x51ac=['isAuthenticated','describe','show','/:id/contacts','getContacts','post','addContacts','put','update','/:id','exports','multer','util','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','index','/describe'];(function(_0x2340ab,_0x189b5d){var _0x4b0c47=function(_0x7e7f66){while(--_0x7e7f66){_0x2340ab['push'](_0x2340ab['shift']());}};_0x4b0c47(++_0x189b5d);}(_0x51ac,0xfd));var _0xc51a=function(_0x2f1221,_0x80349a){_0x2f1221=_0x2f1221-0x0;var _0x10d863=_0x51ac[_0x2f1221];return _0x10d863;};'use strict';var multer=require(_0xc51a('0x0'));var util=require(_0xc51a('0x1'));var path=require(_0xc51a('0x2'));var timeout=require('connect-timeout');var express=require(_0xc51a('0x3'));var router=express[_0xc51a('0x4')]();var fs_extra=require(_0xc51a('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xc51a('0x6'));var config=require(_0xc51a('0x7'));var controller=require('./cmCompany.controller');router[_0xc51a('0x8')]('/',auth['isAuthenticated'](),controller[_0xc51a('0x9')]);router[_0xc51a('0x8')](_0xc51a('0xa'),auth[_0xc51a('0xb')](),controller[_0xc51a('0xc')]);router[_0xc51a('0x8')]('/:id',auth[_0xc51a('0xb')](),controller[_0xc51a('0xd')]);router[_0xc51a('0x8')](_0xc51a('0xe'),auth[_0xc51a('0xb')](),controller[_0xc51a('0xf')]);router[_0xc51a('0x10')]('/',auth[_0xc51a('0xb')](),controller['create']);router[_0xc51a('0x10')](_0xc51a('0xe'),auth[_0xc51a('0xb')](),controller[_0xc51a('0x11')]);router[_0xc51a('0x12')]('/:id',auth[_0xc51a('0xb')](),controller[_0xc51a('0x13')]);router['delete'](_0xc51a('0x14'),auth['isAuthenticated'](),controller['destroy']);module[_0xc51a('0x15')]=router; \ No newline at end of file +var _0x5ab5=['../../config/environment','./cmCompany.controller','get','isAuthenticated','index','/describe','describe','/:id','show','getContacts','post','create','/:id/contacts','put','update','destroy','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x54feb1,_0x21d9ac){var _0x222316=function(_0x13cd81){while(--_0x13cd81){_0x54feb1['push'](_0x54feb1['shift']());}};_0x222316(++_0x21d9ac);}(_0x5ab5,0x186));var _0x55ab=function(_0x299cf8,_0x5c01ae){_0x299cf8=_0x299cf8-0x0;var _0x3042ef=_0x5ab5[_0x299cf8];return _0x3042ef;};'use strict';var multer=require(_0x55ab('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x55ab('0x1'));var express=require(_0x55ab('0x2'));var router=express[_0x55ab('0x3')]();var fs_extra=require(_0x55ab('0x4'));var auth=require(_0x55ab('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x55ab('0x6'));var controller=require(_0x55ab('0x7'));router[_0x55ab('0x8')]('/',auth[_0x55ab('0x9')](),controller[_0x55ab('0xa')]);router['get'](_0x55ab('0xb'),auth[_0x55ab('0x9')](),controller[_0x55ab('0xc')]);router[_0x55ab('0x8')](_0x55ab('0xd'),auth[_0x55ab('0x9')](),controller[_0x55ab('0xe')]);router[_0x55ab('0x8')]('/:id/contacts',auth['isAuthenticated'](),controller[_0x55ab('0xf')]);router[_0x55ab('0x10')]('/',auth[_0x55ab('0x9')](),controller[_0x55ab('0x11')]);router[_0x55ab('0x10')](_0x55ab('0x12'),auth[_0x55ab('0x9')](),controller['addContacts']);router[_0x55ab('0x13')](_0x55ab('0xd'),auth['isAuthenticated'](),controller[_0x55ab('0x14')]);router['delete'](_0x55ab('0xd'),auth[_0x55ab('0x9')](),controller[_0x55ab('0x15')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.attributes.js b/server/api/cmContact/cmContact.attributes.js index c4e314c..a66e907 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 _0xaff7=['STRING','INTEGER','DATE','NOW','lodash','sequelize'];(function(_0x3f250e,_0x313831){var _0x3aa24c=function(_0x51aeff){while(--_0x51aeff){_0x3f250e['push'](_0x3f250e['shift']());}};_0x3aa24c(++_0x313831);}(_0xaff7,0x18a));var _0x7aff=function(_0x5bd1a9,_0x313714){_0x5bd1a9=_0x5bd1a9-0x0;var _0x2ba345=_0xaff7[_0x5bd1a9];return _0x2ba345;};'use strict';var _=require(_0x7aff('0x0'));var Sequelize=require(_0x7aff('0x1'));module['exports']={'firstName':{'type':Sequelize[_0x7aff('0x2')],'allowNull':![]},'lastName':{'type':Sequelize['STRING']},'street':{'type':Sequelize['STRING']},'postalCode':{'type':Sequelize[_0x7aff('0x2')]},'city':{'type':Sequelize['STRING']},'country':{'type':Sequelize[_0x7aff('0x2')]},'dateOfBirth':{'type':Sequelize['STRING']},'description':{'type':Sequelize['TEXT']},'phone':{'type':Sequelize[_0x7aff('0x2')]},'mobile':{'type':Sequelize[_0x7aff('0x2')]},'fax':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0x7aff('0x2')]},'url':{'type':Sequelize[_0x7aff('0x2')]},'facebook':{'type':Sequelize[_0x7aff('0x2')]},'fb_data':{'type':Sequelize[_0x7aff('0x2')]},'twitter':{'type':Sequelize[_0x7aff('0x2')]},'skype':{'type':Sequelize[_0x7aff('0x2')]},'teams':{'type':Sequelize[_0x7aff('0x2')]},'viber':{'type':Sequelize['STRING']},'line':{'type':Sequelize[_0x7aff('0x2')]},'wechat':{'type':Sequelize[_0x7aff('0x2')]},'telegram':{'type':Sequelize['STRING']},'UserId':{'type':Sequelize[_0x7aff('0x3')]},'AdditionalPhones':{'type':Sequelize[_0x7aff('0x2')]},'priority':{'type':Sequelize['INTEGER'](0x2)['UNSIGNED'],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0x7aff('0x4')],'defaultValue':Sequelize[_0x7aff('0x5')]},'dialTimezone':{'type':Sequelize[_0x7aff('0x2')]},'utcOffset':{'type':Sequelize[_0x7aff('0x3')]}}; \ No newline at end of file +var _0x67ba=['DATE','NOW','sequelize','exports','STRING','INTEGER','UNSIGNED'];(function(_0x83e4d9,_0x3b9bb6){var _0x36a145=function(_0x2904e9){while(--_0x2904e9){_0x83e4d9['push'](_0x83e4d9['shift']());}};_0x36a145(++_0x3b9bb6);}(_0x67ba,0xfe));var _0xa67b=function(_0x307632,_0xb3ebd6){_0x307632=_0x307632-0x0;var _0x1cfa61=_0x67ba[_0x307632];return _0x1cfa61;};'use strict';var _=require('lodash');var Sequelize=require(_0xa67b('0x0'));module[_0xa67b('0x1')]={'firstName':{'type':Sequelize[_0xa67b('0x2')],'allowNull':![]},'lastName':{'type':Sequelize[_0xa67b('0x2')]},'street':{'type':Sequelize['STRING']},'postalCode':{'type':Sequelize['STRING']},'city':{'type':Sequelize[_0xa67b('0x2')]},'country':{'type':Sequelize[_0xa67b('0x2')]},'dateOfBirth':{'type':Sequelize[_0xa67b('0x2')]},'description':{'type':Sequelize['TEXT']},'phone':{'type':Sequelize[_0xa67b('0x2')]},'mobile':{'type':Sequelize[_0xa67b('0x2')]},'fax':{'type':Sequelize[_0xa67b('0x2')]},'email':{'type':Sequelize[_0xa67b('0x2')]},'url':{'type':Sequelize['STRING']},'facebook':{'type':Sequelize['STRING']},'fb_data':{'type':Sequelize['STRING']},'twitter':{'type':Sequelize['STRING']},'skype':{'type':Sequelize[_0xa67b('0x2')]},'teams':{'type':Sequelize['STRING']},'viber':{'type':Sequelize['STRING']},'line':{'type':Sequelize[_0xa67b('0x2')]},'wechat':{'type':Sequelize[_0xa67b('0x2')]},'telegram':{'type':Sequelize['STRING']},'UserId':{'type':Sequelize[_0xa67b('0x3')]},'AdditionalPhones':{'type':Sequelize[_0xa67b('0x2')]},'priority':{'type':Sequelize[_0xa67b('0x3')](0x2)[_0xa67b('0x4')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0xa67b('0x5')],'defaultValue':Sequelize[_0xa67b('0x6')]},'dialTimezone':{'type':Sequelize[_0xa67b('0x2')]},'utcOffset':{'type':Sequelize[_0xa67b('0x3')]}}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.controller.js b/server/api/cmContact/cmContact.controller.js index bf1246f..c858d33 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 _0xd90d=['findOne','rawAttributes','filters','intersection','model','attributes','fields','order','sort','pick','filter','options','nolimit','setTags','ids','setAdditionalPhones','OrderBy','items','item_types','ItemTypeId','description','PHONE','CmHopperAdditionalPhone','item','ItemType','`ItemType`.OrderBy','getAdditionalPhones','literal','duplicateAdditionalPhones','fromContactId','CmContactId','toContactId','rescheduleAdditionalPhones','hopperId','includeAll','include','rows','getHopperHistories','CmHopperHistory','merge','getJscriptySessions','JscriptySessionReport','ContactId','uploadCsv','No\x20ListId\x20specified','binding_keys','No\x20association\x20keys\x20specified!','binding_values','No\x20association\x20values\x20specified!','split','No\x20phone\x20column\x20specified','firstName','No\x20firstName\x20column\x20specified','root','server/files/tmp','file','filename','chmodSync','child_process','fork','../../components/import/cm/csv','CompanyId','socket_timestamp','File\x20uploaded\x20correctly!','pid','createReadStream','parse','import','User','agent','binding','Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed','../../components/import/cm/csv2','stringify','message','start\x20child\x20process\x20correctly!','error\x20child\x20process','../../components/import/cm/csvUpdates','exit','getJourney','chat','openchannel','whatsapp','voice','-createdAt','channel','includes','toLowerCase','Invalid\x20channel','range','isValid','Invalid\x20date\x20for\x20range\x20from\x20filter','Invalid\x20date\x20for\x20range\x20to\x20filter','Invalid\x20createdAt\x20filter','uniqueid','source','destination','callerid','starttime','endtime','duration','note','userDisposition','userSecondDisposition','UserId','fullname','alias','DESC','createdAt','startCase','closed','closedAt','disposition','secondDisposition','thirdDisposition','Account','key','browserName','customerIp','customerPort','deviceModel','ratingMessage','ratingType','ratingValue','referer','mail','subject','substatus','externalUrl','threadId','Interaction','findAndCountAll','Owner','flatten','sortBy','reverse','value','moment','bluebird','util','path','lodash','squel','ioredis','../../components/contacts','../../config/logger','api','../../config/environment','defaults','redis','socket.io-emitter','./cmContact.socket','register','status','json','offset','limit','undefined','count','set','Content-Range','update','destroy','end','error','stack','name','send','describe','then','findAll','query','user','catch','CmContact','find','params','tags','keys','length','startsWith','columnName','displayName','CmCustomField','cf_','custom','type','info','forEach','hasOwnProperty','body','from','get','mergeWith','isArray','join','[CmContact][merge]\x20to\x20%s\x20from\x20%s','CmHopper','[CmContact][merge][destroy][CmHopper],\x20%s','CmHopperBlack','[CmContact][merge][destroy][CmHopperBlack],\x20%s','create','ChatInteraction','ChatOfflineMessage','MailInteraction','MailMessage','SmsInteraction','SmsMessage','FaxInteraction','FaxMessage','CmContactHasItem','CmHopperFinal','ReportAgentPreview','VoiceCallReport','ChatQueueReport','FaxQueueReport','MailQueueReport','OpenchannelQueueReport','SmsQueueReport','WhatsappInteraction','WhatsappMessage','WhatsappQueueReport','isNil','dialTimezone','utcOffset','timezones','additionalPhones','bulkCreate','duplicates','where','$or','push','ListId','findOrCreate','spread','contact','all','Tag','Tags','color','Phones','ContactItemType','sequelize','Phones.OrderBy','format','$and','omit','pickBy','map','cf_%d','table','setFields','id\x20=\x20?','toParam','text','values','phone','getTags'];(function(_0x2ecc65,_0xd75c48){var _0x103cc3=function(_0x3f856b){while(--_0x3f856b){_0x2ecc65['push'](_0x2ecc65['shift']());}};_0x103cc3(++_0xd75c48);}(_0xd90d,0x18b));var _0xdd90=function(_0x543084,_0x4337f5){_0x543084=_0x543084-0x0;var _0x306a57=_0xd90d[_0x543084];return _0x306a57;};'use strict';var moment=require(_0xdd90('0x0'));var BPromise=require(_0xdd90('0x1'));var util=require(_0xdd90('0x2'));var path=require(_0xdd90('0x3'));var fs=require('fs');var _=require(_0xdd90('0x4'));var squel=require(_0xdd90('0x5'));var Papa=require('papaparse');var Redis=require(_0xdd90('0x6'));var contacts=require(_0xdd90('0x7'));var qs=require('../../components/parsers/qs');var logger=require(_0xdd90('0x8'))(_0xdd90('0x9'));var config=require(_0xdd90('0xa'));var shared=require('../../config/environment/shared');var db=require('../../mysqldb')['db'];config['redis']=_[_0xdd90('0xb')](config[_0xdd90('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0xdd90('0xd'))(new Redis(config[_0xdd90('0xc')]));require(_0xdd90('0xe'))[_0xdd90('0xf')](socket);function respondWithResult(_0x833fbb,_0x54960e){_0x54960e=_0x54960e||0xc8;return function(_0x269168){if(_0x269168){return _0x833fbb[_0xdd90('0x10')](_0x54960e)[_0xdd90('0x11')](_0x269168);}};}function respondWithFilteredResult(_0x3ff1b6,_0x94acdf){return function(_0x125c26){if(_0x125c26){var _0x5506dd=typeof _0x94acdf[_0xdd90('0x12')]==='undefined'&&typeof _0x94acdf[_0xdd90('0x13')]===_0xdd90('0x14');var _0x596733=_0x125c26['count'];var _0x5a7cd7=_0x5506dd?0x0:_0x94acdf[_0xdd90('0x12')];var _0x194c25=_0x5506dd?_0x125c26[_0xdd90('0x15')]:_0x94acdf[_0xdd90('0x12')]+_0x94acdf[_0xdd90('0x13')];var _0x21e8e3;if(_0x194c25>=_0x596733){_0x194c25=_0x596733;_0x21e8e3=0xc8;}else{_0x21e8e3=0xce;}_0x3ff1b6[_0xdd90('0x10')](_0x21e8e3);return _0x3ff1b6[_0xdd90('0x16')](_0xdd90('0x17'),_0x5a7cd7+'-'+_0x194c25+'/'+_0x596733)[_0xdd90('0x11')](_0x125c26);}return null;};}function saveUpdates(_0x2815d0){return function(_0x226283){if(_0x226283){return _0x226283[_0xdd90('0x18')](_0x2815d0)['then'](function(_0xb0e02e){return _0xb0e02e;});}return null;};}function removeEntity(_0x189125){return function(_0x38323a){if(_0x38323a){return _0x38323a[_0xdd90('0x19')]()['then'](function(){_0x189125[_0xdd90('0x10')](0xcc)[_0xdd90('0x1a')]();});}};}function handleEntityNotFound(_0x3e0138){return function(_0x3d9369){if(!_0x3d9369){_0x3e0138['sendStatus'](0x194);}return _0x3d9369;};}function handleError(_0x5d60b1,_0x475c01){_0x475c01=_0x475c01||0x1f4;return function(_0x56e67b){logger[_0xdd90('0x1b')](_0x56e67b[_0xdd90('0x1c')]);if(_0x56e67b[_0xdd90('0x1d')]){delete _0x56e67b[_0xdd90('0x1d')];}_0x5d60b1[_0xdd90('0x10')](_0x475c01)[_0xdd90('0x1e')](_0x56e67b);};}exports['index']=function(_0x1aff4f,_0x591e91){var _0x57c8ba={};return contacts[_0xdd90('0x1f')]()[_0xdd90('0x20')](function(_0x130b91){_0x57c8ba=qs['getOptions'](_0x130b91,_0x1aff4f);return contacts[_0xdd90('0x21')](_0x1aff4f[_0xdd90('0x22')],_0x1aff4f[_0xdd90('0x23')],_0x57c8ba,_0x130b91);})[_0xdd90('0x20')](respondWithFilteredResult(_0x591e91,_0x57c8ba))[_0xdd90('0x24')](handleError(_0x591e91,null));};exports[_0xdd90('0x19')]=function(_0x35ca74,_0x11ed6b){return db[_0xdd90('0x25')][_0xdd90('0x26')]({'where':{'id':_0x35ca74[_0xdd90('0x27')]['id']}})[_0xdd90('0x20')](handleEntityNotFound(_0x11ed6b,null))[_0xdd90('0x20')](removeEntity(_0x11ed6b,null))['catch'](handleError(_0x11ed6b,null));};exports[_0xdd90('0x1f')]=function(_0x499c1f,_0x5ddb85){return db[_0xdd90('0x25')][_0xdd90('0x1f')]()[_0xdd90('0x20')](function(_0x5518d5){delete _0x5518d5[_0xdd90('0x28')];for(var _0x138d77=0x0;_0x138d770x0){return new Promise(function(_0x2b4d4f){var _0xd73694=[];for(var _0x374e75=0x0;_0x374e75<_0x3868b6['length'];_0x374e75++){_0xd73694[_0xdd90('0x5e')](insertAdditionalPhones(_0x3868b6[_0x374e75][_0xdd90('0x62')],_0x3868b6[_0x374e75][_0xdd90('0x59')]));}Promise[_0xdd90('0x63')](_0xd73694)['then'](function(){_0x2b4d4f(0x1);});})[_0xdd90('0x20')](function(){return{'success':_0x509862,'failure':_0x525c77,'duplicates':_0x3ecb93};});}else{return{'success':_0x509862,'failure':_0x525c77,'duplicates':_0x3ecb93};}}})[_0xdd90('0x20')](respondWithResult(_0x5cc781,0xc9))[_0xdd90('0x24')](handleError(_0x5cc781,null));};exports['show']=function(_0x4c0b84,_0x55f013){var _0x40538a;return db[_0xdd90('0x25')]['describe']()['then'](function(_0xa32ea8){return db[_0xdd90('0x25')][_0xdd90('0x26')]({'where':{'id':_0x4c0b84[_0xdd90('0x27')]['id']},'include':[{'model':db[_0xdd90('0x64')],'as':_0xdd90('0x65'),'attributes':['id',_0xdd90('0x1d'),_0xdd90('0x66')],'required':_0x4c0b84[_0xdd90('0x22')]['tag']?!![]:![]},{'model':db[_0xdd90('0x49')],'as':_0xdd90('0x67'),'where':{'CmContactId':_0x4c0b84[_0xdd90('0x27')]['id']},'required':![],'include':[{'model':db[_0xdd90('0x68')],'as':'ItemType'}]}],'order':[db[_0xdd90('0x69')]['literal'](_0xdd90('0x6a'))],'attributes':_[_0xdd90('0x29')](_0xa32ea8)});})[_0xdd90('0x20')](function(_0x227816){if(!_['isNil'](_0x227816)){_0x40538a=_0x227816[_0xdd90('0x37')]({'plain':!![]});var _0x2dd3ce={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x227816&&_0x227816[_0xdd90('0x5f')]){if(_0x227816['ListId']){_0x2dd3ce[_0xdd90('0x5c')]['$and'][_0xdd90('0x5e')]({'ListId':{'$ne':_0x227816[_0xdd90('0x5f')]}});}}return db[_0xdd90('0x2e')]['findAll'](_0x2dd3ce);}})[_0xdd90('0x20')](function(_0x51a5bc){if(!_[_0xdd90('0x55')](_0x51a5bc)){return _['omit'](_0x40538a,_['map'](_0x51a5bc,function(_0x32b916){return util[_0xdd90('0x6b')]('cf_%d',_0x32b916['id']);}));}})['then'](handleEntityNotFound(_0x55f013,null))[_0xdd90('0x20')](respondWithResult(_0x55f013,null))[_0xdd90('0x24')](handleError(_0x55f013,null));};exports['update']=function(_0x975969,_0x34790c){var _0x43ac1e;if(_0x975969[_0xdd90('0x35')]['id']){delete _0x975969[_0xdd90('0x35')]['id'];}if(!_[_0xdd90('0x55')](_0x975969[_0xdd90('0x35')][_0xdd90('0x56')])){var _0x186928=_0x975969[_0xdd90('0x35')][_0xdd90('0x56')];if(!_[_0xdd90('0x55')](shared[_0xdd90('0x58')][_0x186928]))_0x975969[_0xdd90('0x35')][_0xdd90('0x57')]=shared[_0xdd90('0x58')][_0x186928]['utcOffset'];}return db[_0xdd90('0x25')][_0xdd90('0x26')]({'where':{'id':_0x975969[_0xdd90('0x27')]['id']}})[_0xdd90('0x20')](handleEntityNotFound(_0x34790c,null))[_0xdd90('0x20')](saveUpdates(_0x975969[_0xdd90('0x35')],null))[_0xdd90('0x20')](function(_0x36d8e1){_0x43ac1e=_0x36d8e1;var _0xe71da3={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x36d8e1&&_0x36d8e1['ListId']){if(_0x36d8e1['ListId']){_0xe71da3[_0xdd90('0x5c')][_0xdd90('0x6c')][_0xdd90('0x5e')]({'ListId':{'$ne':_0x36d8e1[_0xdd90('0x5f')]}});}}return db['CmCustomField']['findAll'](_0xe71da3);})[_0xdd90('0x20')](function(_0x1edfa9){if(_0x1edfa9){return _[_0xdd90('0x6d')](_[_0xdd90('0x6e')](_0x975969[_0xdd90('0x35')],function(_0x378a2c,_0x41d473){return _[_0xdd90('0x2b')](_0x41d473,_0xdd90('0x2f'));}),_[_0xdd90('0x6f')](_0x1edfa9,function(_0x4a9ad4){return util['format'](_0xdd90('0x70'),_0x4a9ad4['id']);}));}})[_0xdd90('0x20')](function(_0x4852ed){if(_0x4852ed&&!_['isEmpty'](_0x4852ed)){var _0x5e75c9=squel['update']()[_0xdd90('0x71')]('cm_contacts')[_0xdd90('0x72')](_0x4852ed)[_0xdd90('0x5c')](_0xdd90('0x73'),_0x975969[_0xdd90('0x27')]['id'])[_0xdd90('0x74')]();return db[_0xdd90('0x69')]['query'](_0x5e75c9[_0xdd90('0x75')],{'replacements':_0x5e75c9[_0xdd90('0x76')]});}})['then'](function(){if(_0x975969[_0xdd90('0x35')][_0xdd90('0x77')]&&_0x43ac1e){return db[_0xdd90('0x3c')]['update']({'phone':_0x975969['body']['phone'],'OrderBy':0x0},{'where':{'ContactId':_0x43ac1e['id']}});}})[_0xdd90('0x20')](function(){return _0x43ac1e;})[_0xdd90('0x20')](respondWithResult(_0x34790c,null))[_0xdd90('0x24')](handleError(_0x34790c,null));};exports[_0xdd90('0x78')]=function(_0x22699c,_0x4cec8e){var _0x2b2916={};var _0x21a961={};var _0x4c8d94;var _0x57ede0;return db[_0xdd90('0x25')][_0xdd90('0x79')]({'where':{'id':_0x22699c[_0xdd90('0x27')]['id']}})[_0xdd90('0x20')](handleEntityNotFound(_0x4cec8e,null))[_0xdd90('0x20')](function(_0x2c94ef){if(_0x2c94ef){_0x4c8d94=_0x2c94ef;_0x21a961['model']=_[_0xdd90('0x29')](db[_0xdd90('0x64')][_0xdd90('0x7a')]);_0x21a961[_0xdd90('0x22')]=_[_0xdd90('0x29')](_0x22699c[_0xdd90('0x22')]);_0x21a961[_0xdd90('0x7b')]=_[_0xdd90('0x7c')](_0x21a961[_0xdd90('0x7d')],_0x21a961[_0xdd90('0x22')]);_0x2b2916[_0xdd90('0x7e')]=_[_0xdd90('0x7c')](_0x21a961['model'],qs[_0xdd90('0x7f')](_0x22699c[_0xdd90('0x22')][_0xdd90('0x7f')]));_0x2b2916[_0xdd90('0x7e')]=_0x2b2916[_0xdd90('0x7e')][_0xdd90('0x2a')]?_0x2b2916['attributes']:_0x21a961[_0xdd90('0x7d')];_0x2b2916[_0xdd90('0x80')]=qs[_0xdd90('0x81')](_0x22699c[_0xdd90('0x22')][_0xdd90('0x81')]);_0x2b2916[_0xdd90('0x5c')]=qs['filters'](_[_0xdd90('0x82')](_0x22699c[_0xdd90('0x22')],_0x21a961['filters']));if(_0x22699c[_0xdd90('0x22')][_0xdd90('0x83')]){_0x2b2916['where']=_['merge'](_0x2b2916[_0xdd90('0x5c')],{'$or':_[_0xdd90('0x6f')](_0x2b2916[_0xdd90('0x7e')],function(_0x5afc91){var _0x4ca376={};_0x4ca376[_0x5afc91]={'$like':'%'+_0x22699c['query']['filter']+'%'};return _0x4ca376;})});}_0x2b2916=_['merge']({},_0x2b2916,_0x22699c[_0xdd90('0x84')]);return _0x4c8d94[_0xdd90('0x78')](_0x2b2916);}})[_0xdd90('0x20')](function(_0x107e88){if(_0x107e88){_0x57ede0=_0x107e88[_0xdd90('0x2a')];if(!_0x22699c[_0xdd90('0x22')]['hasOwnProperty'](_0xdd90('0x85'))){_0x2b2916[_0xdd90('0x13')]=qs[_0xdd90('0x13')](_0x22699c[_0xdd90('0x22')][_0xdd90('0x13')]);_0x2b2916['offset']=qs[_0xdd90('0x12')](_0x22699c[_0xdd90('0x22')][_0xdd90('0x12')]);}return _0x4c8d94[_0xdd90('0x78')](_0x2b2916);}})[_0xdd90('0x20')](function(_0x48e988){if(_0x48e988){return _0x48e988?{'count':_0x57ede0,'rows':_0x48e988}:null;}})['then'](respondWithResult(_0x4cec8e,null))[_0xdd90('0x24')](handleError(_0x4cec8e,null));};exports[_0xdd90('0x86')]=function(_0xbd0859,_0x10e40b){if(_0xbd0859[_0xdd90('0x35')]['id']){delete _0xbd0859[_0xdd90('0x35')]['id'];}return db[_0xdd90('0x25')][_0xdd90('0x79')]({'where':{'id':_0xbd0859[_0xdd90('0x27')]['id']}})[_0xdd90('0x20')](handleEntityNotFound(_0x10e40b,null))['then'](function(_0x22a95d){if(_0x22a95d){return _0x22a95d[_0xdd90('0x86')](_0xbd0859[_0xdd90('0x35')][_0xdd90('0x87')]||[]);}return null;})['then'](respondWithResult(_0x10e40b,null))[_0xdd90('0x24')](handleError(_0x10e40b,null));};exports[_0xdd90('0x88')]=function(_0x2819c7,_0x5a12d3){var _0x514563=[];_0x514563['push'](addAdditionalPhones(_0x2819c7['body']));Promise['all'](_0x514563)[_0xdd90('0x20')](function(){_0x514563=[];_0x514563[_0xdd90('0x5e')](deleteCmHopperPhones(_0x2819c7[_0xdd90('0x35')]['id']));_0x514563[_0xdd90('0x5e')](addCmHopperPhones(_0x2819c7[_0xdd90('0x35')]['id']));Promise[_0xdd90('0x63')](_0x514563)['then'](function(){return[0x1];})[_0xdd90('0x20')](respondWithResult(_0x5a12d3,null));});};function addAdditionalPhones(_0x106114){var _0x182960;return new Promise(function(_0x1d11d1){return db[_0xdd90('0x49')]['destroy']({'where':{'CmContactId':_0x106114['id']}})[_0xdd90('0x20')](function(){db[_0xdd90('0x68')][_0xdd90('0x21')]({'raw':!![],'attributes':['id',_0xdd90('0x89')]})[_0xdd90('0x20')](function(_0x1e03ca){var _0x1e10c5=[];for(var _0x18b4b8=0x0;_0x18b4b8<_0x106114[_0xdd90('0x8a')][_0xdd90('0x2a')];_0x18b4b8++){var _0x365cfe=_0x106114[_0xdd90('0x8b')]?_[_0xdd90('0x55')](_0x106114[_0xdd90('0x8b')][_0x18b4b8])?'':_0x106114['item_types'][_0x18b4b8]:_0x106114[_0xdd90('0x8a')][_0x18b4b8][_0xdd90('0x8c')]?_0x106114['items'][_0x18b4b8]['ItemTypeId']:'';var _0x409ee6=_[_0xdd90('0x55')](_0x106114['items'][_0x18b4b8]['description'])?'':_0x106114[_0xdd90('0x8a')][_0x18b4b8][_0xdd90('0x8d')];var _0x2486a5=_0x365cfe+':'+_0x106114[_0xdd90('0x8a')][_0x18b4b8]['phone']+'§'+_0x409ee6;if(_[_0xdd90('0x55')](_0x182960))_0x182960=_0x2486a5;else _0x182960+=';'+_0x2486a5;var _0x194b6c=null;var _0x4b57fe=null;if(_0x106114[_0xdd90('0x8b')]){if(!_[_0xdd90('0x55')](_0x106114['item_types'][_0x18b4b8])){_0x4b57fe=_[_0xdd90('0x26')](_0x1e03ca,function(_0x439ea3){return _0x439ea3['id']===_0x106114['item_types'][_0x18b4b8];});if(!_[_0xdd90('0x55')](_0x4b57fe)){_0x194b6c=_0x4b57fe[_0xdd90('0x89')];}}}else{if(!_[_0xdd90('0x55')](_0x106114[_0xdd90('0x8a')][_0x18b4b8])){_0x4b57fe=_[_0xdd90('0x26')](_0x1e03ca,function(_0x2e62){return _0x2e62['id']===_0x106114[_0xdd90('0x8a')][_0x18b4b8][_0xdd90('0x8c')];});if(!_['isNil'](_0x4b57fe)){_0x194b6c=_0x18b4b8;}}}if(_[_0xdd90('0x55')](_0x194b6c)){_0x194b6c=0x64;}_0x1e10c5[_0xdd90('0x5e')](addAdditionalPhone(_0x106114['id'],_0x106114[_0xdd90('0x8a')][_0x18b4b8][_0xdd90('0x77')],_0x106114[_0xdd90('0x8b')]?_[_0xdd90('0x55')](_0x106114[_0xdd90('0x8b')][_0x18b4b8])?null:_0x106114[_0xdd90('0x8b')][_0x18b4b8]:_0x106114['items'][_0x18b4b8][_0xdd90('0x8c')]?_0x106114[_0xdd90('0x8a')][_0x18b4b8][_0xdd90('0x8c')]:null,_0x194b6c,_0x409ee6));}Promise[_0xdd90('0x63')](_0x1e10c5)[_0xdd90('0x20')](function(){db[_0xdd90('0x25')][_0xdd90('0x18')]({'AdditionalPhones':_0x182960},{'where':{'id':_0x106114['id']}})[_0xdd90('0x20')](function(){_0x1d11d1(0x1);});});});});});}function addAdditionalPhone(_0x34bfc1,_0x5bcd99,_0x4f2f18,_0x1f5190,_0x3a9fec){return db[_0xdd90('0x49')][_0xdd90('0x26')]({'where':{'CmContactId':_0x34bfc1,'item':_0x5bcd99}})[_0xdd90('0x20')](function(_0x3f2bfe){if(_0x3f2bfe)logger['info']('contact\x20phone\x20exists',_0x3f2bfe);else{db['CmContactHasItem'][_0xdd90('0x40')]({'CmContactId':_0x34bfc1,'item':_0x5bcd99,'ItemTypeId':_0x4f2f18,'OrderBy':_0x1f5190,'ItemClass':_0xdd90('0x8e'),'description':_0x3a9fec});}});}function deleteCmHopperPhones(_0x190107){return new Promise(function(_0x2c493b){return db[_0xdd90('0x3c')][_0xdd90('0x21')]({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x190107}})['then'](function(_0x1025a9){db[_0xdd90('0x8f')][_0xdd90('0x19')]({'where':{'CmHopperId':{'$in':_[_0xdd90('0x6f')](_0x1025a9,'id')}}});})[_0xdd90('0x20')](function(){_0x2c493b(0x1);});});}function addCmHopperPhones(_0x4806b9){return new Promise(function(_0x3017b3){return db[_0xdd90('0x3c')][_0xdd90('0x21')]({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x4806b9}})[_0xdd90('0x20')](function(_0x93785d){var _0x553556=[];_['map'](_0x93785d,function(_0x366f82){_0x553556[_0xdd90('0x5e')](createCmHopperPhone(_0x4806b9,_0x366f82['id']));});Promise[_0xdd90('0x63')](_0x553556)[_0xdd90('0x20')](function(){_0x3017b3(0x1);});});});}function createCmHopperPhone(_0x3deee2,_0x14facd){return new Promise(function(_0x56082b){db[_0xdd90('0x49')][_0xdd90('0x21')]({'raw':!![],'attributes':[_0xdd90('0x90'),'OrderBy'],'where':{'CmContactId':_0x3deee2,'ItemClass':_0xdd90('0x8e')},'include':[{'model':db[_0xdd90('0x68')],'attributes':[_0xdd90('0x89')],'as':_0xdd90('0x91')}],'order':[_0xdd90('0x89'),db[_0xdd90('0x69')]['literal'](_0xdd90('0x92'))]})['then'](function(_0x2c5e25){var _0x3168e6=0x1;var _0x101df8=_['map'](_0x2c5e25,function(_0x46b15a){_0x46b15a['CmHopperId']=_0x14facd;_0x46b15a[_0xdd90('0x77')]=_0x46b15a[_0xdd90('0x90')];_0x46b15a['OrderBy']=_0x3168e6;delete _0x46b15a['ItemType.OrderBy'];_0x3168e6=_0x3168e6+0x1;return _0x46b15a;});return db['CmHopperAdditionalPhone'][_0xdd90('0x5a')](_0x101df8,{});})[_0xdd90('0x20')](function(){_0x56082b(0x1);});});}function insertAdditionalPhones(_0x7d5c6f,_0x2c3a5b){return new Promise(function(_0xafac87){var _0x375345=[];for(var _0x63ce09=0x0;_0x63ce09<_0x2c3a5b[_0xdd90('0x2a')];_0x63ce09++){var _0x3908cb=_0x2c3a5b[_0x63ce09];_0x375345[_0xdd90('0x5e')](parseContactItemType(_0x3908cb));}Promise['all'](_0x375345)[_0xdd90('0x20')](function(){var _0x367349={'id':_0x7d5c6f['id'],'items':_0x2c3a5b};return addAdditionalPhones(_0x367349)[_0xdd90('0x20')](function(){return addCmHopperPhones(_0x7d5c6f['id']);});})[_0xdd90('0x20')](function(){_0xafac87(_0x7d5c6f);});});}function parseContactItemType(_0x1c9175){return new Promise(function(_0x427253){if(_0x1c9175[_0xdd90('0x34')](_0xdd90('0x8c'))){_0x427253(_0x1c9175);}else{return db[_0xdd90('0x68')][_0xdd90('0x26')]({'where':{'name':_0x1c9175[_0xdd90('0x91')]}})[_0xdd90('0x20')](function(_0x22fa73){if(_[_0xdd90('0x55')](_0x22fa73))_0x1c9175[_0xdd90('0x8c')]=null;else _0x1c9175[_0xdd90('0x8c')]=_0x22fa73['id'];_0x427253(_0x1c9175);});}});}exports[_0xdd90('0x93')]=function(_0x5a021e,_0x2b03f2){return db[_0xdd90('0x49')][_0xdd90('0x21')]({'raw':!![],'where':{'CmContactId':_0x5a021e['params']['id'],'ItemClass':_0xdd90('0x8e')},'include':[{'model':db[_0xdd90('0x68')],'as':_0xdd90('0x91')}],'order':[['OrderBy'],[db[_0xdd90('0x69')][_0xdd90('0x94')](_0xdd90('0x92'))]]})[_0xdd90('0x20')](function(_0x2c5b16){return _0x2c5b16;})['then'](respondWithResult(_0x2b03f2,null))[_0xdd90('0x24')](handleError(_0x2b03f2,null));};exports[_0xdd90('0x95')]=function(_0x4572de,_0x20d8fe){return db['CmContactHasItem'][_0xdd90('0x21')]({'raw':!![],'where':{'CmContactId':_0x4572de[_0xdd90('0x35')][_0xdd90('0x96')]}})[_0xdd90('0x20')](function(_0xd835d2){var _0x24505e=_[_0xdd90('0x6f')](_0xd835d2,function(_0x2a3a2f){_0x2a3a2f[_0xdd90('0x97')]=_0x4572de[_0xdd90('0x35')]['toContactId'];return _0x2a3a2f;});return db[_0xdd90('0x49')][_0xdd90('0x5a')](_0x24505e,{});})['then'](function(){return addCmHopperPhones(_0x4572de[_0xdd90('0x35')][_0xdd90('0x98')]);})[_0xdd90('0x20')](function(){return['ok'];})[_0xdd90('0x20')](respondWithResult(_0x20d8fe,null))[_0xdd90('0x24')](handleError(_0x20d8fe,null));};exports[_0xdd90('0x99')]=function(_0x12053d,_0x1b3a0c){var _0x4f06ce=[];_0x4f06ce[_0xdd90('0x5e')](createCmHopperPhone(_0x12053d[_0xdd90('0x35')]['id'],_0x12053d[_0xdd90('0x35')][_0xdd90('0x9a')]));Promise[_0xdd90('0x63')](_0x4f06ce)[_0xdd90('0x20')](function(){return[0x1];})['then'](respondWithResult(_0x1b3a0c,null));};exports['getHoppers']=function(_0x11e833,_0x33e09e){var _0x58a264={'raw':![],'where':{}};var _0x5a95d1={};var _0x15796e={'count':0x0,'rows':[]};return db[_0xdd90('0x25')][_0xdd90('0x79')]({'where':{'id':_0x11e833['params']['id']}})[_0xdd90('0x20')](handleEntityNotFound(_0x33e09e,null))[_0xdd90('0x20')](function(_0x539aa5){if(_0x539aa5){_0x5a95d1[_0xdd90('0x7d')]=_[_0xdd90('0x29')](db[_0xdd90('0x3c')][_0xdd90('0x7a')]);_0x5a95d1[_0xdd90('0x22')]=_[_0xdd90('0x29')](_0x11e833[_0xdd90('0x22')]);_0x5a95d1['filters']=_[_0xdd90('0x7c')](_0x5a95d1[_0xdd90('0x7d')],_0x5a95d1[_0xdd90('0x22')]);_0x58a264['attributes']=_['intersection'](_0x5a95d1[_0xdd90('0x7d')],qs[_0xdd90('0x7f')](_0x11e833[_0xdd90('0x22')][_0xdd90('0x7f')]));_0x58a264[_0xdd90('0x7e')]=_0x58a264[_0xdd90('0x7e')][_0xdd90('0x2a')]?_0x58a264[_0xdd90('0x7e')]:_0x5a95d1[_0xdd90('0x7d')];if(!_0x11e833['query'][_0xdd90('0x34')](_0xdd90('0x85'))){_0x58a264[_0xdd90('0x13')]=qs[_0xdd90('0x13')](_0x11e833[_0xdd90('0x22')][_0xdd90('0x13')]);_0x58a264[_0xdd90('0x12')]=qs[_0xdd90('0x12')](_0x11e833[_0xdd90('0x22')][_0xdd90('0x12')]);}_0x58a264['order']=qs[_0xdd90('0x81')](_0x11e833[_0xdd90('0x22')][_0xdd90('0x81')]);_0x58a264['where']=qs[_0xdd90('0x7b')](_[_0xdd90('0x82')](_0x11e833[_0xdd90('0x22')],_0x5a95d1[_0xdd90('0x7b')]));_0x58a264[_0xdd90('0x5c')]['ContactId']=_0x539aa5['id'];if(_0x11e833['query'][_0xdd90('0x83')]){_0x58a264[_0xdd90('0x5c')]=_['merge'](_0x58a264[_0xdd90('0x5c')],{'$or':_[_0xdd90('0x6f')](_0x58a264[_0xdd90('0x7e')],function(_0x12d6a5){var _0x4fe550={};_0x4fe550[_0x12d6a5]={'$like':'%'+_0x11e833[_0xdd90('0x22')][_0xdd90('0x83')]+'%'};return _0x4fe550;})});}_0x58a264=_['merge']({},_0x58a264,_0x11e833[_0xdd90('0x84')]);return db[_0xdd90('0x3c')][_0xdd90('0x15')]({'where':_0x58a264['where']})[_0xdd90('0x20')](function(_0x3a2c71){_0x15796e[_0xdd90('0x15')]=_0x3a2c71;if(_0x11e833[_0xdd90('0x22')][_0xdd90('0x9b')]){_0x58a264[_0xdd90('0x9c')]=[{'all':!![]}];}return db['CmHopper'][_0xdd90('0x21')](_0x58a264);})[_0xdd90('0x20')](function(_0x215e3c){_0x15796e[_0xdd90('0x9d')]=_0x215e3c;return _0x15796e;});}})[_0xdd90('0x20')](respondWithFilteredResult(_0x33e09e,_0x58a264))[_0xdd90('0x24')](handleError(_0x33e09e,null));};exports[_0xdd90('0x9e')]=function(_0x29ad8a,_0x4a9e6d){var _0x49e5b3={'raw':!![],'where':{}};var _0x1fc25d={};var _0x9f6cb7={'count':0x0,'rows':[]};return db[_0xdd90('0x25')]['findOne']({'where':{'id':_0x29ad8a['params']['id']}})[_0xdd90('0x20')](handleEntityNotFound(_0x4a9e6d,null))['then'](function(_0xc65d54){if(_0xc65d54){_0x1fc25d[_0xdd90('0x7d')]=_[_0xdd90('0x29')](db[_0xdd90('0x9f')][_0xdd90('0x7a')]);_0x1fc25d[_0xdd90('0x22')]=_['keys'](_0x29ad8a[_0xdd90('0x22')]);_0x1fc25d[_0xdd90('0x7b')]=_['intersection'](_0x1fc25d[_0xdd90('0x7d')],_0x1fc25d[_0xdd90('0x22')]);_0x49e5b3[_0xdd90('0x7e')]=_[_0xdd90('0x7c')](_0x1fc25d['model'],qs[_0xdd90('0x7f')](_0x29ad8a[_0xdd90('0x22')][_0xdd90('0x7f')]));_0x49e5b3['attributes']=_0x49e5b3['attributes']['length']?_0x49e5b3[_0xdd90('0x7e')]:_0x1fc25d[_0xdd90('0x7d')];if(!_0x29ad8a['query'][_0xdd90('0x34')](_0xdd90('0x85'))){_0x49e5b3[_0xdd90('0x13')]=qs[_0xdd90('0x13')](_0x29ad8a[_0xdd90('0x22')][_0xdd90('0x13')]);_0x49e5b3[_0xdd90('0x12')]=qs[_0xdd90('0x12')](_0x29ad8a[_0xdd90('0x22')][_0xdd90('0x12')]);}_0x49e5b3[_0xdd90('0x80')]=qs[_0xdd90('0x81')](_0x29ad8a['query']['sort']);_0x49e5b3[_0xdd90('0x5c')]=qs['filters'](_[_0xdd90('0x82')](_0x29ad8a[_0xdd90('0x22')],_0x1fc25d[_0xdd90('0x7b')]));_0x49e5b3[_0xdd90('0x5c')]['ContactId']=_0xc65d54['id'];if(_0x29ad8a[_0xdd90('0x22')][_0xdd90('0x83')]){_0x49e5b3[_0xdd90('0x5c')]=_[_0xdd90('0xa0')](_0x49e5b3[_0xdd90('0x5c')],{'$or':_[_0xdd90('0x6f')](_0x49e5b3[_0xdd90('0x7e')],function(_0xc755f9){var _0x5c0651={};_0x5c0651[_0xc755f9]={'$like':'%'+_0x29ad8a[_0xdd90('0x22')][_0xdd90('0x83')]+'%'};return _0x5c0651;})});}_0x49e5b3=_[_0xdd90('0xa0')]({},_0x49e5b3,_0x29ad8a[_0xdd90('0x84')]);return db[_0xdd90('0x9f')][_0xdd90('0x15')]({'where':_0x49e5b3[_0xdd90('0x5c')]})[_0xdd90('0x20')](function(_0x5eeee9){_0x9f6cb7[_0xdd90('0x15')]=_0x5eeee9;if(_0x29ad8a[_0xdd90('0x22')]['includeAll']){_0x49e5b3[_0xdd90('0x9c')]=[{'all':!![]}];}return db[_0xdd90('0x9f')][_0xdd90('0x21')](_0x49e5b3);})[_0xdd90('0x20')](function(_0x1d4d70){_0x9f6cb7[_0xdd90('0x9d')]=_0x1d4d70;return _0x9f6cb7;});}})[_0xdd90('0x20')](respondWithFilteredResult(_0x4a9e6d,_0x49e5b3))[_0xdd90('0x24')](handleError(_0x4a9e6d,null));};exports['getHopperFinals']=function(_0x102d32,_0x5e3094){var _0x1d5ae7={'raw':!![],'where':{}};var _0x75f6cc={};var _0x332657={'count':0x0,'rows':[]};return db[_0xdd90('0x25')][_0xdd90('0x79')]({'where':{'id':_0x102d32['params']['id']}})[_0xdd90('0x20')](handleEntityNotFound(_0x5e3094,null))[_0xdd90('0x20')](function(_0x1c260a){if(_0x1c260a){_0x75f6cc[_0xdd90('0x7d')]=_[_0xdd90('0x29')](db[_0xdd90('0x4a')][_0xdd90('0x7a')]);_0x75f6cc['query']=_[_0xdd90('0x29')](_0x102d32[_0xdd90('0x22')]);_0x75f6cc[_0xdd90('0x7b')]=_[_0xdd90('0x7c')](_0x75f6cc[_0xdd90('0x7d')],_0x75f6cc[_0xdd90('0x22')]);_0x1d5ae7[_0xdd90('0x7e')]=_[_0xdd90('0x7c')](_0x75f6cc[_0xdd90('0x7d')],qs[_0xdd90('0x7f')](_0x102d32['query'][_0xdd90('0x7f')]));_0x1d5ae7['attributes']=_0x1d5ae7[_0xdd90('0x7e')]['length']?_0x1d5ae7[_0xdd90('0x7e')]:_0x75f6cc[_0xdd90('0x7d')];if(!_0x102d32['query']['hasOwnProperty'](_0xdd90('0x85'))){_0x1d5ae7['limit']=qs['limit'](_0x102d32[_0xdd90('0x22')][_0xdd90('0x13')]);_0x1d5ae7['offset']=qs[_0xdd90('0x12')](_0x102d32['query'][_0xdd90('0x12')]);}_0x1d5ae7[_0xdd90('0x80')]=qs[_0xdd90('0x81')](_0x102d32['query']['sort']);_0x1d5ae7[_0xdd90('0x5c')]=qs['filters'](_['pick'](_0x102d32[_0xdd90('0x22')],_0x75f6cc[_0xdd90('0x7b')]));_0x1d5ae7[_0xdd90('0x5c')]['ContactId']=_0x1c260a['id'];if(_0x102d32[_0xdd90('0x22')]['filter']){_0x1d5ae7[_0xdd90('0x5c')]=_['merge'](_0x1d5ae7[_0xdd90('0x5c')],{'$or':_[_0xdd90('0x6f')](_0x1d5ae7[_0xdd90('0x7e')],function(_0x84ff6f){var _0x2a0908={};_0x2a0908[_0x84ff6f]={'$like':'%'+_0x102d32[_0xdd90('0x22')][_0xdd90('0x83')]+'%'};return _0x2a0908;})});}_0x1d5ae7=_[_0xdd90('0xa0')]({},_0x1d5ae7,_0x102d32[_0xdd90('0x84')]);return db[_0xdd90('0x4a')]['count']({'where':_0x1d5ae7[_0xdd90('0x5c')]})[_0xdd90('0x20')](function(_0x1878ac){_0x332657[_0xdd90('0x15')]=_0x1878ac;if(_0x102d32[_0xdd90('0x22')][_0xdd90('0x9b')]){_0x1d5ae7[_0xdd90('0x9c')]=[{'all':!![]}];}return db[_0xdd90('0x4a')][_0xdd90('0x21')](_0x1d5ae7);})[_0xdd90('0x20')](function(_0x51593c){_0x332657[_0xdd90('0x9d')]=_0x51593c;return _0x332657;});}})[_0xdd90('0x20')](respondWithFilteredResult(_0x5e3094,_0x1d5ae7))[_0xdd90('0x24')](handleError(_0x5e3094,null));};exports[_0xdd90('0xa1')]=function(_0x7bc468,_0x4935be){var _0x20f519={'raw':!![],'where':{}};var _0x2a95d2={};var _0x4c022a={'count':0x0,'rows':[]};return db[_0xdd90('0x25')][_0xdd90('0x79')]({'where':{'id':_0x7bc468[_0xdd90('0x27')]['id']}})[_0xdd90('0x20')](handleEntityNotFound(_0x4935be,null))['then'](function(_0x1382e7){if(_0x1382e7){_0x2a95d2[_0xdd90('0x7d')]=_[_0xdd90('0x29')](db[_0xdd90('0xa2')]['rawAttributes']);_0x2a95d2['query']=_[_0xdd90('0x29')](_0x7bc468[_0xdd90('0x22')]);_0x2a95d2['filters']=_['intersection'](_0x2a95d2['model'],_0x2a95d2[_0xdd90('0x22')]);_0x20f519[_0xdd90('0x7e')]=_[_0xdd90('0x7c')](_0x2a95d2[_0xdd90('0x7d')],qs['fields'](_0x7bc468[_0xdd90('0x22')]['fields']));_0x20f519[_0xdd90('0x7e')]=_0x20f519[_0xdd90('0x7e')][_0xdd90('0x2a')]?_0x20f519[_0xdd90('0x7e')]:_0x2a95d2[_0xdd90('0x7d')];if(!_0x7bc468[_0xdd90('0x22')][_0xdd90('0x34')](_0xdd90('0x85'))){_0x20f519['limit']=qs[_0xdd90('0x13')](_0x7bc468[_0xdd90('0x22')]['limit']);_0x20f519[_0xdd90('0x12')]=qs[_0xdd90('0x12')](_0x7bc468[_0xdd90('0x22')][_0xdd90('0x12')]);}_0x20f519[_0xdd90('0x80')]=qs['sort'](_0x7bc468['query']['sort']);_0x20f519[_0xdd90('0x5c')]=qs[_0xdd90('0x7b')](_[_0xdd90('0x82')](_0x7bc468[_0xdd90('0x22')],_0x2a95d2[_0xdd90('0x7b')]));_0x20f519[_0xdd90('0x5c')][_0xdd90('0xa3')]=_0x1382e7['id'];if(_0x7bc468[_0xdd90('0x22')][_0xdd90('0x83')]){_0x20f519[_0xdd90('0x5c')]=_[_0xdd90('0xa0')](_0x20f519[_0xdd90('0x5c')],{'$or':_['map'](_0x20f519['attributes'],function(_0x59045b){var _0x4bb99a={};_0x4bb99a[_0x59045b]={'$like':'%'+_0x7bc468[_0xdd90('0x22')]['filter']+'%'};return _0x4bb99a;})});}_0x20f519=_[_0xdd90('0xa0')]({},_0x20f519,_0x7bc468[_0xdd90('0x84')]);return db[_0xdd90('0xa2')][_0xdd90('0x15')]({'where':_0x20f519[_0xdd90('0x5c')]})[_0xdd90('0x20')](function(_0x278ebb){_0x4c022a[_0xdd90('0x15')]=_0x278ebb;if(_0x7bc468['query'][_0xdd90('0x9b')]){_0x20f519[_0xdd90('0x9c')]=[{'all':!![]}];}return db[_0xdd90('0xa2')]['findAll'](_0x20f519);})[_0xdd90('0x20')](function(_0x5b591f){_0x4c022a['rows']=_0x5b591f;return _0x4c022a;});}})[_0xdd90('0x20')](respondWithFilteredResult(_0x4935be,_0x20f519))['catch'](handleError(_0x4935be,null));};exports[_0xdd90('0xa4')]=function(_0x329fd5,_0x245d85){try{if(!_0x329fd5['body'][_0xdd90('0x5f')]){throw new Error(_0xdd90('0xa5'));}if(!_0x329fd5['body'][_0xdd90('0xa6')]){throw new Error(_0xdd90('0xa7'));}if(!_0x329fd5[_0xdd90('0x35')][_0xdd90('0xa8')]){throw new Error(_0xdd90('0xa9'));}if(!_0x329fd5[_0xdd90('0x35')]['socket_timestamp']){throw new Error('Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed');}var _0x10dea6=_0x329fd5[_0xdd90('0x35')][_0xdd90('0xa6')][_0xdd90('0xaa')](',');var _0x47ca00=_0x329fd5[_0xdd90('0x35')][_0xdd90('0xa8')][_0xdd90('0xaa')](',');if(!_0x10dea6['length']||!_0x47ca00['length']||_0x10dea6['length']!==_0x47ca00[_0xdd90('0x2a')]){throw new Error('Incorrect\x20binding\x20parameters\x20passed!');}_0x329fd5['body'][_0xdd90('0x7f')]=_['zipObject'](_0x10dea6,_0x47ca00);if(!_0x329fd5[_0xdd90('0x35')][_0xdd90('0x7f')][_0xdd90('0x77')]){throw new Error(_0xdd90('0xab'));}if(!_0x329fd5[_0xdd90('0x35')][_0xdd90('0x7f')][_0xdd90('0xac')]){throw new Error(_0xdd90('0xad'));}var _0x4fe736=path['join'](config[_0xdd90('0xae')],_0xdd90('0xaf'),_0x329fd5[_0xdd90('0xb0')][_0xdd90('0xb1')]);fs[_0xdd90('0xb2')](_0x4fe736,parseInt('0777',0x8));var _0x228918=require(_0xdd90('0xb3'))[_0xdd90('0xb4')](path['join'](__dirname,_0xdd90('0xb5')),[_0x4fe736,_0x329fd5['body'][_0xdd90('0xa6')],_0x329fd5['body'][_0xdd90('0xa8')],_0x329fd5['body'][_0xdd90('0x5f')],_0x329fd5['body'][_0xdd90('0xb6')],_0x329fd5[_0xdd90('0x35')][_0xdd90('0x5b')],_0x329fd5[_0xdd90('0x35')][_0xdd90('0xb7')]]);return _0x245d85[_0xdd90('0x10')](0xc8)[_0xdd90('0x11')]({'message':_0xdd90('0xb8'),'pid':_0x228918[_0xdd90('0xb9')]});}catch(_0xa4ebaf){return _0x245d85[_0xdd90('0x10')](0x1f4)[_0xdd90('0x1e')](_0xa4ebaf);}};exports['upload']=function(_0x334de5,_0x50e222){var _0x2c2165=fs[_0xdd90('0xba')](_0x334de5[_0xdd90('0xb0')][_0xdd90('0x3')]);Papa[_0xdd90('0xbb')](_0x2c2165,{'header':!![],'skipEmptyLines':!![],'preview':0x1,'complete':function(_0x183283){return _0x50e222['status'](0xc8)[_0xdd90('0x11')]({'file':_0x334de5[_0xdd90('0xb0')],'fields':_0x183283['meta'][_0xdd90('0x7f')]});}});};exports[_0xdd90('0xbc')]=function(_0x59c4c8,_0x29bc70){return db[_0xdd90('0xbd')]['findAll']({'raw':!![],'attributes':['id'],'where':{'role':_0xdd90('0xbe')}})[_0xdd90('0x20')](function(_0x313690){var _0x2aa73f=![];if(!_0x59c4c8['body'][_0xdd90('0x5f')]){throw new Error(_0xdd90('0xa5'));}if(!_0x59c4c8['body'][_0xdd90('0xbf')]['phone']){throw new Error(_0xdd90('0xab'));}if(!_0x59c4c8[_0xdd90('0x35')][_0xdd90('0xbf')][_0xdd90('0xac')]){throw new Error(_0xdd90('0xad'));}if(!_0x59c4c8[_0xdd90('0x35')][_0xdd90('0xb7')]){throw new Error(_0xdd90('0xc0'));}var _0x1a4fa5=require(_0xdd90('0xb3'))['fork'](path[_0xdd90('0x3a')](__dirname,_0xdd90('0xc1')),[_0x59c4c8[_0xdd90('0x27')]['id'],JSON[_0xdd90('0xc2')](_0x59c4c8[_0xdd90('0x35')]),JSON['stringify'](_0x313690)]);_0x1a4fa5['on'](_0xdd90('0xc3'),function(){_0x2aa73f=!![];return _0x29bc70[_0xdd90('0x10')](0xc8)[_0xdd90('0x11')]({'message':_0xdd90('0xc4'),'pid':_0x1a4fa5[_0xdd90('0xb9')]});});_0x1a4fa5['on']('exit',function(_0x5b30cc){if(_0x5b30cc&&!_0x2aa73f){return _0x29bc70[_0xdd90('0x10')](0x1f4)[_0xdd90('0x11')]({'message':_0xdd90('0xc5'),'pid':_0x1a4fa5['pid']});}});})[_0xdd90('0x24')](handleError(_0x29bc70,null));};exports['importUpdates']=function(_0x4bc897,_0x25f638){return db['User'][_0xdd90('0x21')]({'raw':!![],'attributes':['id'],'where':{'role':_0xdd90('0xbe')}})[_0xdd90('0x20')](function(_0x4cb5f5){var _0x174e06=![];if(!_0x4bc897[_0xdd90('0x35')][_0xdd90('0x5f')]){throw new Error(_0xdd90('0xa5'));}if(!_0x4bc897['body'][_0xdd90('0xbf')][_0xdd90('0x77')]){throw new Error(_0xdd90('0xab'));}if(!_0x4bc897[_0xdd90('0x35')][_0xdd90('0xbf')]['firstName']){throw new Error(_0xdd90('0xad'));}if(!_0x4bc897[_0xdd90('0x35')][_0xdd90('0xb7')]){throw new Error('Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed');}var _0x611330=require('child_process')['fork'](path[_0xdd90('0x3a')](__dirname,_0xdd90('0xc6')),[_0x4bc897[_0xdd90('0x27')]['id'],JSON[_0xdd90('0xc2')](_0x4bc897[_0xdd90('0x35')]),JSON['stringify'](_0x4cb5f5)]);_0x611330['on'](_0xdd90('0xc3'),function(){_0x174e06=!![];return _0x25f638[_0xdd90('0x10')](0xc8)['json']({'message':'start\x20child\x20process\x20correctly!','pid':_0x611330[_0xdd90('0xb9')]});});_0x611330['on'](_0xdd90('0xc7'),function(_0x4bdbfe){if(_0x4bdbfe&&!_0x174e06){return _0x25f638[_0xdd90('0x10')](0x1f4)[_0xdd90('0x11')]({'message':_0xdd90('0xc5'),'pid':_0x611330[_0xdd90('0xb9')]});}});})[_0xdd90('0x24')](handleError(_0x25f638,null));};exports[_0xdd90('0xc8')]=function(_0xb76df0,_0x1bb466){var _0x31009e=['mail',_0xdd90('0xc9'),'sms',_0xdd90('0xca'),'fax',_0xdd90('0xcb'),_0xdd90('0xcc')];var _0x3358aa={'offset':0x0,'order':qs[_0xdd90('0x81')](_0xdd90('0xcd'))},_0x2cc85a={'count':0x0,'rows':[]};Promise['resolve']()[_0xdd90('0x20')](function(){if(_0xb76df0[_0xdd90('0x22')][_0xdd90('0xce')]){if(!_[_0xdd90('0xcf')](_0x31009e,_0xb76df0[_0xdd90('0x22')][_0xdd90('0xce')][_0xdd90('0xd0')]())){throw new Error(_0xdd90('0xd1'));}_0x31009e=[_0xb76df0[_0xdd90('0x22')][_0xdd90('0xce')][_0xdd90('0xd0')]()];}if(_0xb76df0[_0xdd90('0x22')][_0xdd90('0xd2')]){try{var _0x688e9d=JSON[_0xdd90('0xbb')](_0xb76df0[_0xdd90('0x22')][_0xdd90('0xd2')]);if(!moment(_0x688e9d[_0xdd90('0x36')])[_0xdd90('0xd3')]()){throw new Error(_0xdd90('0xd4'));}if(!moment(_0x688e9d['to'])[_0xdd90('0xd3')]()){throw new Error(_0xdd90('0xd5'));}}catch(_0x416f83){throw new Error(_0xdd90('0xd6'));}}if(!_0xb76df0['query'][_0xdd90('0x34')](_0xdd90('0x85'))){_0x3358aa[_0xdd90('0x13')]=qs[_0xdd90('0x13')](_0xb76df0[_0xdd90('0x22')][_0xdd90('0x13')]||0xa);_0x3358aa[_0xdd90('0x12')]=qs[_0xdd90('0x12')](_0xb76df0['query']['offset']);}var _0x43f975=_0x31009e[_0xdd90('0x6f')](function(_0x3f0e46){if(_0x3f0e46===_0xdd90('0xcc')){var _0x58f850={'attributes':['id',_0xdd90('0xd7'),_0xdd90('0x31'),_0xdd90('0xd8'),_0xdd90('0xd9'),_0xdd90('0xda'),_0xdd90('0xdb'),_0xdd90('0xdc'),_0xdd90('0xdd'),_0xdd90('0xde'),'createdAt',_0xdd90('0xdf'),_0xdd90('0xe0'),'userThirdDisposition',_0xdd90('0xe1')],'where':{'ContactId':_0xb76df0[_0xdd90('0x27')]['id']},'include':[{'model':db[_0xdd90('0xbd')],'as':_0xdd90('0xbd'),'attributes':['id','name',_0xdd90('0xe2'),_0xdd90('0xe3')]}],'order':[['createdAt',_0xdd90('0xe4')]]};if(_0xb76df0[_0xdd90('0x22')]['range']){_0x58f850[_0xdd90('0x5c')][_0xdd90('0xe5')]={'$gte':_0x688e9d['from'],'$lte':_0x688e9d['to']};}return db[_0xdd90('0x4c')]['findAndCountAll'](_0x58f850)[_0xdd90('0x20')](function(_0x1e4f38){_0x2cc85a[_0xdd90('0x15')]+=_0x1e4f38['count'];return _[_0xdd90('0x6f')](_0x1e4f38['rows'],function(_0x4c11d3){var _0x46125e=_0x4c11d3[_0xdd90('0x37')]({'plain':!![]});_0x46125e[_0xdd90('0xce')]=_0x3f0e46;if(_0x46125e['User']){_0x46125e['User']={'id':_0x46125e[_0xdd90('0xbd')]['id'],'name':_0x46125e['User'][_0xdd90('0x1d')],'fullname':_0x46125e[_0xdd90('0xbd')]['fullname'],'alias':_0x46125e[_0xdd90('0xbd')][_0xdd90('0xe3')]};}return _0x46125e;});});}else{var _0x30da30=_[_0xdd90('0xe6')](_0x3f0e46)+(_0x3f0e46===_0xdd90('0xc9')?'Website':'Account');var _0x2c4d3b={'attributes':['id',_0xdd90('0xe7'),_0xdd90('0xe8'),'createdAt',_0xdd90('0xde'),_0xdd90('0xe9'),_0xdd90('0xea'),_0xdd90('0xeb'),_0xdd90('0xe1'),_0x30da30+'Id'],'where':{'ContactId':_0xb76df0[_0xdd90('0x27')]['id']},'include':[{'model':db[_0x30da30],'as':_0xdd90('0xec'),'attributes':['id',_0xdd90('0x1d'),_0xdd90('0xed')]},{'model':db[_0xdd90('0xbd')],'as':'Owner','attributes':['id',_0xdd90('0x1d'),_0xdd90('0xe2')]},{'model':db[_0xdd90('0x64')],'as':'Tags','attributes':['id','name',_0xdd90('0x66')],'through':{'attributes':[]}}],'order':[[_0xdd90('0xe5'),'DESC']]};if(_0xb76df0[_0xdd90('0x22')][_0xdd90('0xd2')]){_0x2c4d3b['where'][_0xdd90('0xe5')]={'$gte':_0x688e9d[_0xdd90('0x36')],'$lte':_0x688e9d['to']};}switch(_0x3f0e46){case _0xdd90('0xc9'):_0x2c4d3b[_0xdd90('0x7e')][_0xdd90('0x5e')](_0xdd90('0xee'),_0xdd90('0xef'),_0xdd90('0xf0'),_0xdd90('0xf1'),'osName',_0xdd90('0xf2'),_0xdd90('0xf3'),_0xdd90('0xf4'),_0xdd90('0xf5'));break;case _0xdd90('0xf6'):_0x2c4d3b['attributes'][_0xdd90('0x5e')](_0xdd90('0xf7'),_0xdd90('0xf8'));break;case _0xdd90('0xca'):_0x2c4d3b['attributes'][_0xdd90('0x5e')](_0xdd90('0xf9'),_0xdd90('0xfa'));break;}return db[_[_0xdd90('0xe6')](_0x3f0e46)+_0xdd90('0xfb')][_0xdd90('0xfc')](_0x2c4d3b)['then'](function(_0x1e2b93){_0x2cc85a['count']+=_0x1e2b93[_0xdd90('0x15')];return _[_0xdd90('0x6f')](_0x1e2b93[_0xdd90('0x9d')],function(_0x24a785){var _0x22ded8=_0x24a785[_0xdd90('0x37')]({'plain':!![]});_0x22ded8[_0xdd90('0xce')]=_0x3f0e46;if(_0x22ded8[_0xdd90('0xfd')]){_0x22ded8[_0xdd90('0xfd')]={'id':_0x22ded8[_0xdd90('0xfd')]['id'],'name':_0x22ded8['Owner'][_0xdd90('0x1d')],'fullname':_0x22ded8[_0xdd90('0xfd')][_0xdd90('0xe2')]};}return _0x22ded8;});});}});return Promise['all'](_0x43f975);})[_0xdd90('0x20')](function(_0xcd847d){return _(_0xcd847d)[_0xdd90('0xfe')]()[_0xdd90('0xff')](_0xdd90('0xe5'))[_0xdd90('0x100')]()[_0xdd90('0x101')]();})[_0xdd90('0x20')](function(_0x524e62){_0x2cc85a[_0xdd90('0x9d')]=_0x3358aa[_0xdd90('0x13')]?_0x524e62['slice'](_0x3358aa['offset'],_0x3358aa['offset']+_0x3358aa['limit']):_0x524e62;return _0x2cc85a;})[_0xdd90('0x20')](respondWithFilteredResult(_0x1bb466,_0x3358aa))[_0xdd90('0x24')](handleError(_0x1bb466,null));}; \ No newline at end of file +var _0xdb1b=['isNil','dialTimezone','timezones','utcOffset','additionalPhones','bulkCreate','duplicates','where','$or','push','ListId','spread','hasOwnProperty','contact','params','Tag','Tags','name','color','tag','Phones','ItemType','sequelize','literal','Phones.OrderBy','map','format','cf_%d','omit','startsWith','isEmpty','table','cm_contacts','setFields','id\x20=\x20?','toParam','phone','getTags','findOne','model','filters','intersection','fields','attributes','order','sort','options','nolimit','setTags','ids','setAdditionalPhones','all','ContactItemType','OrderBy','items','item_types','ItemTypeId','description','contact\x20phone\x20exists','PHONE','CmHopperAdditionalPhone','CmHopperId','item','ItemType.OrderBy','`ItemType`.OrderBy','duplicateAdditionalPhones','CmContactId','hopperId','rawAttributes','pick','filter','includeAll','rows','getHopperHistories','ContactId','include','getHopperFinals','uploadCsv','No\x20ListId\x20specified','binding_keys','binding_values','No\x20association\x20values\x20specified!','socket_timestamp','Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed','split','zipObject','No\x20phone\x20column\x20specified','firstName','No\x20firstName\x20column\x20specified','root','server/files/tmp','filename','chmodSync','0777','child_process','fork','../../components/import/cm/csv','CompanyId','pid','upload','file','meta','User','agent','binding','../../components/import/cm/csv2','stringify','start\x20child\x20process\x20correctly!','exit','importUpdates','../../components/import/cm/csvUpdates','message','error\x20child\x20process','sms','openchannel','fax','whatsapp','voice','-createdAt','resolve','includes','channel','toLowerCase','parse','range','isValid','Invalid\x20date\x20for\x20range\x20from\x20filter','Invalid\x20date\x20for\x20range\x20to\x20filter','source','callerid','starttime','endtime','note','createdAt','userSecondDisposition','fullname','startCase','Website','closed','closedAt','secondDisposition','thirdDisposition','UserId','Account','key','Owner','chat','browserName','customerIp','customerPort','deviceModel','ratingMessage','ratingValue','referer','mail','subject','externalUrl','threadId','Interaction','findAndCountAll','flatten','sortBy','reverse','slice','util','path','lodash','squel','papaparse','ioredis','../../components/contacts','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../config/environment/shared','redis','defaults','localhost','socket.io-emitter','register','json','offset','limit','undefined','count','status','set','Content-Range','update','then','error','stack','send','index','query','user','catch','destroy','find','describe','CmContact','tags','length','keys','cf_','columnName','displayName','CmCustomField','findAll','alias','type','values','info','Custom\x20field\x20%s\x20not\x20found\x20on\x20cm_contacts\x20table','merge','body','get','mergeWith','isArray','join','[CmContact][merge]\x20to\x20%s\x20from\x20%s','from','CmHopper','[CmContact][merge][destroy][CmHopper],\x20%s','[CmContact][merge][destroy][CmHopperBlack],\x20%s','create','ChatMessage','ChatOfflineMessage','MailInteraction','MailMessage','SmsInteraction','SmsMessage','FaxInteraction','FaxMessage','OpenchannelInteraction','CmContactHasItem','CmHopperFinal','CmHopperHistory','VoiceCallReport','ChatQueueReport','MailQueueReport','OpenchannelQueueReport','SmsQueueReport','JscriptySessionReport','WhatsappMessage','WhatsappQueueReport'];(function(_0x48ae80,_0x4b9d9d){var _0xaa6e26=function(_0x3dd05f){while(--_0x3dd05f){_0x48ae80['push'](_0x48ae80['shift']());}};_0xaa6e26(++_0x4b9d9d);}(_0xdb1b,0xa4));var _0xbdb1=function(_0x2f3581,_0x23fe61){_0x2f3581=_0x2f3581-0x0;var _0x304df9=_0xdb1b[_0x2f3581];return _0x304df9;};'use strict';var moment=require('moment');var BPromise=require('bluebird');var util=require(_0xbdb1('0x0'));var path=require(_0xbdb1('0x1'));var fs=require('fs');var _=require(_0xbdb1('0x2'));var squel=require(_0xbdb1('0x3'));var Papa=require(_0xbdb1('0x4'));var Redis=require(_0xbdb1('0x5'));var contacts=require(_0xbdb1('0x6'));var qs=require(_0xbdb1('0x7'));var logger=require(_0xbdb1('0x8'))(_0xbdb1('0x9'));var config=require(_0xbdb1('0xa'));var shared=require(_0xbdb1('0xb'));var db=require('../../mysqldb')['db'];config[_0xbdb1('0xc')]=_[_0xbdb1('0xd')](config[_0xbdb1('0xc')],{'host':_0xbdb1('0xe'),'port':0x18eb});var socket=require(_0xbdb1('0xf'))(new Redis(config[_0xbdb1('0xc')]));require('./cmContact.socket')[_0xbdb1('0x10')](socket);function respondWithResult(_0x3f03f5,_0x334830){_0x334830=_0x334830||0xc8;return function(_0x3598c3){if(_0x3598c3){return _0x3f03f5['status'](_0x334830)[_0xbdb1('0x11')](_0x3598c3);}};}function respondWithFilteredResult(_0x35f210,_0x49fa39){return function(_0x251bf8){if(_0x251bf8){var _0xfb8e98=typeof _0x49fa39[_0xbdb1('0x12')]==='undefined'&&typeof _0x49fa39[_0xbdb1('0x13')]===_0xbdb1('0x14');var _0x4a4bfa=_0x251bf8[_0xbdb1('0x15')];var _0x5e3e06=_0xfb8e98?0x0:_0x49fa39['offset'];var _0x247d8a=_0xfb8e98?_0x251bf8['count']:_0x49fa39['offset']+_0x49fa39[_0xbdb1('0x13')];var _0xca1aca;if(_0x247d8a>=_0x4a4bfa){_0x247d8a=_0x4a4bfa;_0xca1aca=0xc8;}else{_0xca1aca=0xce;}_0x35f210[_0xbdb1('0x16')](_0xca1aca);return _0x35f210[_0xbdb1('0x17')](_0xbdb1('0x18'),_0x5e3e06+'-'+_0x247d8a+'/'+_0x4a4bfa)['json'](_0x251bf8);}return null;};}function saveUpdates(_0x2f4872){return function(_0x5f1d14){if(_0x5f1d14){return _0x5f1d14[_0xbdb1('0x19')](_0x2f4872)[_0xbdb1('0x1a')](function(_0x28d437){return _0x28d437;});}return null;};}function removeEntity(_0x230291){return function(_0x9fffc8){if(_0x9fffc8){return _0x9fffc8['destroy']()[_0xbdb1('0x1a')](function(){_0x230291[_0xbdb1('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x445a21){return function(_0x553f94){if(!_0x553f94){_0x445a21['sendStatus'](0x194);}return _0x553f94;};}function handleError(_0x1b837f,_0x3d7796){_0x3d7796=_0x3d7796||0x1f4;return function(_0x3bbebd){logger[_0xbdb1('0x1b')](_0x3bbebd[_0xbdb1('0x1c')]);if(_0x3bbebd['name']){delete _0x3bbebd['name'];}_0x1b837f[_0xbdb1('0x16')](_0x3d7796)[_0xbdb1('0x1d')](_0x3bbebd);};}exports[_0xbdb1('0x1e')]=function(_0x2ad4b7,_0x432bef){var _0x223480={};return contacts['describe']()[_0xbdb1('0x1a')](function(_0x550870){_0x223480=qs['getOptions'](_0x550870,_0x2ad4b7);return contacts['findAll'](_0x2ad4b7[_0xbdb1('0x1f')],_0x2ad4b7[_0xbdb1('0x20')],_0x223480,_0x550870);})[_0xbdb1('0x1a')](respondWithFilteredResult(_0x432bef,_0x223480))[_0xbdb1('0x21')](handleError(_0x432bef,null));};exports[_0xbdb1('0x22')]=function(_0x36fbd1,_0x373ba3){return db['CmContact'][_0xbdb1('0x23')]({'where':{'id':_0x36fbd1['params']['id']}})[_0xbdb1('0x1a')](handleEntityNotFound(_0x373ba3,null))[_0xbdb1('0x1a')](removeEntity(_0x373ba3,null))[_0xbdb1('0x21')](handleError(_0x373ba3,null));};exports[_0xbdb1('0x24')]=function(_0x50f8b5,_0x67b429){return db[_0xbdb1('0x25')][_0xbdb1('0x24')]()['then'](function(_0x4b15df){delete _0x4b15df[_0xbdb1('0x26')];for(var _0xdbddc2=0x0;_0xdbddc20x0){return new Promise(function(_0x25f92c){var _0x48d9ed=[];for(var _0x1fb93c=0x0;_0x1fb93c<_0x15d523['length'];_0x1fb93c++){_0x48d9ed[_0xbdb1('0x5c')](insertAdditionalPhones(_0x15d523[_0x1fb93c][_0xbdb1('0x60')],_0x15d523[_0x1fb93c][_0xbdb1('0x57')]));}Promise['all'](_0x48d9ed)['then'](function(){_0x25f92c(0x1);});})['then'](function(){return{'success':_0x415e89,'failure':_0x6e2b3e,'duplicates':_0x36ae94};});}else{return{'success':_0x415e89,'failure':_0x6e2b3e,'duplicates':_0x36ae94};}}})[_0xbdb1('0x1a')](respondWithResult(_0x25d944,0xc9))[_0xbdb1('0x21')](handleError(_0x25d944,null));};exports['show']=function(_0x1060a9,_0x230000){var _0xf745ba;return db['CmContact'][_0xbdb1('0x24')]()[_0xbdb1('0x1a')](function(_0x3bbb04){return db[_0xbdb1('0x25')][_0xbdb1('0x23')]({'where':{'id':_0x1060a9[_0xbdb1('0x61')]['id']},'include':[{'model':db[_0xbdb1('0x62')],'as':_0xbdb1('0x63'),'attributes':['id',_0xbdb1('0x64'),_0xbdb1('0x65')],'required':_0x1060a9[_0xbdb1('0x1f')][_0xbdb1('0x66')]?!![]:![]},{'model':db[_0xbdb1('0x48')],'as':_0xbdb1('0x67'),'where':{'CmContactId':_0x1060a9[_0xbdb1('0x61')]['id']},'required':![],'include':[{'model':db['ContactItemType'],'as':_0xbdb1('0x68')}]}],'order':[db[_0xbdb1('0x69')][_0xbdb1('0x6a')](_0xbdb1('0x6b'))],'attributes':_[_0xbdb1('0x28')](_0x3bbb04)});})[_0xbdb1('0x1a')](function(_0x2e8a07){if(!_[_0xbdb1('0x53')](_0x2e8a07)){_0xf745ba=_0x2e8a07[_0xbdb1('0x35')]({'plain':!![]});var _0x417d63={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x2e8a07&&_0x2e8a07[_0xbdb1('0x5d')]){if(_0x2e8a07['ListId']){_0x417d63[_0xbdb1('0x5a')]['$and'][_0xbdb1('0x5c')]({'ListId':{'$ne':_0x2e8a07[_0xbdb1('0x5d')]}});}}return db[_0xbdb1('0x2c')][_0xbdb1('0x2d')](_0x417d63);}})[_0xbdb1('0x1a')](function(_0x2692e3){if(!_['isNil'](_0x2692e3)){return _['omit'](_0xf745ba,_[_0xbdb1('0x6c')](_0x2692e3,function(_0x5877b2){return util[_0xbdb1('0x6d')](_0xbdb1('0x6e'),_0x5877b2['id']);}));}})['then'](handleEntityNotFound(_0x230000,null))['then'](respondWithResult(_0x230000,null))[_0xbdb1('0x21')](handleError(_0x230000,null));};exports[_0xbdb1('0x19')]=function(_0x4d8f72,_0x38a5c7){var _0x2aee73;if(_0x4d8f72['body']['id']){delete _0x4d8f72[_0xbdb1('0x34')]['id'];}if(!_['isNil'](_0x4d8f72[_0xbdb1('0x34')][_0xbdb1('0x54')])){var _0x3b8bbf=_0x4d8f72[_0xbdb1('0x34')]['dialTimezone'];if(!_[_0xbdb1('0x53')](shared['timezones'][_0x3b8bbf]))_0x4d8f72[_0xbdb1('0x34')]['utcOffset']=shared[_0xbdb1('0x55')][_0x3b8bbf]['utcOffset'];}return db[_0xbdb1('0x25')][_0xbdb1('0x23')]({'where':{'id':_0x4d8f72['params']['id']}})[_0xbdb1('0x1a')](handleEntityNotFound(_0x38a5c7,null))[_0xbdb1('0x1a')](saveUpdates(_0x4d8f72['body'],null))[_0xbdb1('0x1a')](function(_0x561ac0){_0x2aee73=_0x561ac0;var _0x25a3cc={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x561ac0&&_0x561ac0[_0xbdb1('0x5d')]){if(_0x561ac0[_0xbdb1('0x5d')]){_0x25a3cc[_0xbdb1('0x5a')]['$and'][_0xbdb1('0x5c')]({'ListId':{'$ne':_0x561ac0['ListId']}});}}return db['CmCustomField']['findAll'](_0x25a3cc);})[_0xbdb1('0x1a')](function(_0x2ca5f8){if(_0x2ca5f8){return _[_0xbdb1('0x6f')](_['pickBy'](_0x4d8f72[_0xbdb1('0x34')],function(_0x4e3866,_0x427d3a){return _[_0xbdb1('0x70')](_0x427d3a,_0xbdb1('0x29'));}),_[_0xbdb1('0x6c')](_0x2ca5f8,function(_0x3ef9bd){return util['format'](_0xbdb1('0x6e'),_0x3ef9bd['id']);}));}})[_0xbdb1('0x1a')](function(_0x13235c){if(_0x13235c&&!_[_0xbdb1('0x71')](_0x13235c)){var _0x5d270e=squel[_0xbdb1('0x19')]()[_0xbdb1('0x72')](_0xbdb1('0x73'))[_0xbdb1('0x74')](_0x13235c)[_0xbdb1('0x5a')](_0xbdb1('0x75'),_0x4d8f72['params']['id'])[_0xbdb1('0x76')]();return db[_0xbdb1('0x69')][_0xbdb1('0x1f')](_0x5d270e['text'],{'replacements':_0x5d270e['values']});}})[_0xbdb1('0x1a')](function(){if(_0x4d8f72[_0xbdb1('0x34')]['phone']&&_0x2aee73){return db[_0xbdb1('0x3b')][_0xbdb1('0x19')]({'phone':_0x4d8f72[_0xbdb1('0x34')][_0xbdb1('0x77')],'OrderBy':0x0},{'where':{'ContactId':_0x2aee73['id']}});}})[_0xbdb1('0x1a')](function(){return _0x2aee73;})['then'](respondWithResult(_0x38a5c7,null))[_0xbdb1('0x21')](handleError(_0x38a5c7,null));};exports[_0xbdb1('0x78')]=function(_0x1ea5a5,_0x4f50f0){var _0x152f7b={};var _0x51a284={};var _0x28de98;var _0x5d3c58;return db[_0xbdb1('0x25')][_0xbdb1('0x79')]({'where':{'id':_0x1ea5a5['params']['id']}})[_0xbdb1('0x1a')](handleEntityNotFound(_0x4f50f0,null))['then'](function(_0x531123){if(_0x531123){_0x28de98=_0x531123;_0x51a284[_0xbdb1('0x7a')]=_[_0xbdb1('0x28')](db[_0xbdb1('0x62')]['rawAttributes']);_0x51a284[_0xbdb1('0x1f')]=_[_0xbdb1('0x28')](_0x1ea5a5[_0xbdb1('0x1f')]);_0x51a284[_0xbdb1('0x7b')]=_[_0xbdb1('0x7c')](_0x51a284[_0xbdb1('0x7a')],_0x51a284[_0xbdb1('0x1f')]);_0x152f7b['attributes']=_[_0xbdb1('0x7c')](_0x51a284[_0xbdb1('0x7a')],qs[_0xbdb1('0x7d')](_0x1ea5a5['query'][_0xbdb1('0x7d')]));_0x152f7b[_0xbdb1('0x7e')]=_0x152f7b[_0xbdb1('0x7e')][_0xbdb1('0x27')]?_0x152f7b[_0xbdb1('0x7e')]:_0x51a284[_0xbdb1('0x7a')];_0x152f7b[_0xbdb1('0x7f')]=qs[_0xbdb1('0x80')](_0x1ea5a5[_0xbdb1('0x1f')][_0xbdb1('0x80')]);_0x152f7b[_0xbdb1('0x5a')]=qs[_0xbdb1('0x7b')](_['pick'](_0x1ea5a5[_0xbdb1('0x1f')],_0x51a284[_0xbdb1('0x7b')]));if(_0x1ea5a5['query']['filter']){_0x152f7b[_0xbdb1('0x5a')]=_[_0xbdb1('0x33')](_0x152f7b[_0xbdb1('0x5a')],{'$or':_['map'](_0x152f7b['attributes'],function(_0x39e6f6){var _0x30d3f8={};_0x30d3f8[_0x39e6f6]={'$like':'%'+_0x1ea5a5[_0xbdb1('0x1f')]['filter']+'%'};return _0x30d3f8;})});}_0x152f7b=_[_0xbdb1('0x33')]({},_0x152f7b,_0x1ea5a5[_0xbdb1('0x81')]);return _0x28de98[_0xbdb1('0x78')](_0x152f7b);}})[_0xbdb1('0x1a')](function(_0x4d132b){if(_0x4d132b){_0x5d3c58=_0x4d132b['length'];if(!_0x1ea5a5['query'][_0xbdb1('0x5f')](_0xbdb1('0x82'))){_0x152f7b[_0xbdb1('0x13')]=qs[_0xbdb1('0x13')](_0x1ea5a5[_0xbdb1('0x1f')][_0xbdb1('0x13')]);_0x152f7b[_0xbdb1('0x12')]=qs['offset'](_0x1ea5a5['query'][_0xbdb1('0x12')]);}return _0x28de98[_0xbdb1('0x78')](_0x152f7b);}})[_0xbdb1('0x1a')](function(_0x620d45){if(_0x620d45){return _0x620d45?{'count':_0x5d3c58,'rows':_0x620d45}:null;}})[_0xbdb1('0x1a')](respondWithResult(_0x4f50f0,null))[_0xbdb1('0x21')](handleError(_0x4f50f0,null));};exports[_0xbdb1('0x83')]=function(_0x40160f,_0x3ca8cd){if(_0x40160f[_0xbdb1('0x34')]['id']){delete _0x40160f['body']['id'];}return db['CmContact'][_0xbdb1('0x79')]({'where':{'id':_0x40160f[_0xbdb1('0x61')]['id']}})[_0xbdb1('0x1a')](handleEntityNotFound(_0x3ca8cd,null))['then'](function(_0x18fd80){if(_0x18fd80){return _0x18fd80[_0xbdb1('0x83')](_0x40160f[_0xbdb1('0x34')][_0xbdb1('0x84')]||[]);}return null;})[_0xbdb1('0x1a')](respondWithResult(_0x3ca8cd,null))[_0xbdb1('0x21')](handleError(_0x3ca8cd,null));};exports[_0xbdb1('0x85')]=function(_0xf0c640,_0x30993a){var _0x14b29b=[];_0x14b29b[_0xbdb1('0x5c')](addAdditionalPhones(_0xf0c640[_0xbdb1('0x34')]));Promise[_0xbdb1('0x86')](_0x14b29b)[_0xbdb1('0x1a')](function(){_0x14b29b=[];_0x14b29b['push'](deleteCmHopperPhones(_0xf0c640['body']['id']));_0x14b29b['push'](addCmHopperPhones(_0xf0c640[_0xbdb1('0x34')]['id']));Promise[_0xbdb1('0x86')](_0x14b29b)[_0xbdb1('0x1a')](function(){return[0x1];})[_0xbdb1('0x1a')](respondWithResult(_0x30993a,null));});};function addAdditionalPhones(_0x3975f3){var _0x51052f;return new Promise(function(_0x206876){return db[_0xbdb1('0x48')]['destroy']({'where':{'CmContactId':_0x3975f3['id']}})['then'](function(){db[_0xbdb1('0x87')][_0xbdb1('0x2d')]({'raw':!![],'attributes':['id',_0xbdb1('0x88')]})[_0xbdb1('0x1a')](function(_0x511785){var _0x2687d5=[];for(var _0x58cf4c=0x0;_0x58cf4c<_0x3975f3[_0xbdb1('0x89')]['length'];_0x58cf4c++){var _0x1cd350=_0x3975f3[_0xbdb1('0x8a')]?_['isNil'](_0x3975f3[_0xbdb1('0x8a')][_0x58cf4c])?'':_0x3975f3[_0xbdb1('0x8a')][_0x58cf4c]:_0x3975f3['items'][_0x58cf4c]['ItemTypeId']?_0x3975f3[_0xbdb1('0x89')][_0x58cf4c][_0xbdb1('0x8b')]:'';var _0x525a0f=_[_0xbdb1('0x53')](_0x3975f3['items'][_0x58cf4c][_0xbdb1('0x8c')])?'':_0x3975f3[_0xbdb1('0x89')][_0x58cf4c][_0xbdb1('0x8c')];var _0x22056a=_0x1cd350+':'+_0x3975f3['items'][_0x58cf4c][_0xbdb1('0x77')]+'§'+_0x525a0f;if(_[_0xbdb1('0x53')](_0x51052f))_0x51052f=_0x22056a;else _0x51052f+=';'+_0x22056a;var _0x3a16cd=null;var _0x42840c=null;if(_0x3975f3[_0xbdb1('0x8a')]){if(!_[_0xbdb1('0x53')](_0x3975f3[_0xbdb1('0x8a')][_0x58cf4c])){_0x42840c=_[_0xbdb1('0x23')](_0x511785,function(_0x1dea87){return _0x1dea87['id']===_0x3975f3[_0xbdb1('0x8a')][_0x58cf4c];});if(!_[_0xbdb1('0x53')](_0x42840c)){_0x3a16cd=_0x42840c[_0xbdb1('0x88')];}}}else{if(!_[_0xbdb1('0x53')](_0x3975f3['items'][_0x58cf4c])){_0x42840c=_[_0xbdb1('0x23')](_0x511785,function(_0x36be0a){return _0x36be0a['id']===_0x3975f3['items'][_0x58cf4c][_0xbdb1('0x8b')];});if(!_[_0xbdb1('0x53')](_0x42840c)){_0x3a16cd=_0x58cf4c;}}}if(_[_0xbdb1('0x53')](_0x3a16cd)){_0x3a16cd=0x64;}_0x2687d5['push'](addAdditionalPhone(_0x3975f3['id'],_0x3975f3[_0xbdb1('0x89')][_0x58cf4c]['phone'],_0x3975f3[_0xbdb1('0x8a')]?_[_0xbdb1('0x53')](_0x3975f3[_0xbdb1('0x8a')][_0x58cf4c])?null:_0x3975f3[_0xbdb1('0x8a')][_0x58cf4c]:_0x3975f3[_0xbdb1('0x89')][_0x58cf4c]['ItemTypeId']?_0x3975f3['items'][_0x58cf4c][_0xbdb1('0x8b')]:null,_0x3a16cd,_0x525a0f));}Promise[_0xbdb1('0x86')](_0x2687d5)[_0xbdb1('0x1a')](function(){db[_0xbdb1('0x25')][_0xbdb1('0x19')]({'AdditionalPhones':_0x51052f},{'where':{'id':_0x3975f3['id']}})[_0xbdb1('0x1a')](function(){_0x206876(0x1);});});});});});}function addAdditionalPhone(_0x283a35,_0x3594ce,_0x78b845,_0x42dcce,_0x1bec7c){return db[_0xbdb1('0x48')][_0xbdb1('0x23')]({'where':{'CmContactId':_0x283a35,'item':_0x3594ce}})[_0xbdb1('0x1a')](function(_0x3882ae){if(_0x3882ae)logger[_0xbdb1('0x31')](_0xbdb1('0x8d'),_0x3882ae);else{db[_0xbdb1('0x48')][_0xbdb1('0x3e')]({'CmContactId':_0x283a35,'item':_0x3594ce,'ItemTypeId':_0x78b845,'OrderBy':_0x42dcce,'ItemClass':_0xbdb1('0x8e'),'description':_0x1bec7c});}});}function deleteCmHopperPhones(_0x1ee72c){return new Promise(function(_0x4b57c8){return db[_0xbdb1('0x3b')][_0xbdb1('0x2d')]({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x1ee72c}})[_0xbdb1('0x1a')](function(_0x2325b5){db[_0xbdb1('0x8f')][_0xbdb1('0x22')]({'where':{'CmHopperId':{'$in':_[_0xbdb1('0x6c')](_0x2325b5,'id')}}});})[_0xbdb1('0x1a')](function(){_0x4b57c8(0x1);});});}function addCmHopperPhones(_0x3c297a){return new Promise(function(_0x4d3274){return db['CmHopper']['findAll']({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x3c297a}})[_0xbdb1('0x1a')](function(_0x102d6f){var _0x485474=[];_[_0xbdb1('0x6c')](_0x102d6f,function(_0x20b8e6){_0x485474[_0xbdb1('0x5c')](createCmHopperPhone(_0x3c297a,_0x20b8e6['id']));});Promise['all'](_0x485474)[_0xbdb1('0x1a')](function(){_0x4d3274(0x1);});});});}function createCmHopperPhone(_0xaecf7d,_0x5bc5ff){return new Promise(function(_0x189662){db['CmContactHasItem'][_0xbdb1('0x2d')]({'raw':!![],'attributes':['item','OrderBy'],'where':{'CmContactId':_0xaecf7d,'ItemClass':'PHONE'},'include':[{'model':db[_0xbdb1('0x87')],'attributes':[_0xbdb1('0x88')],'as':_0xbdb1('0x68')}],'order':[_0xbdb1('0x88'),db[_0xbdb1('0x69')][_0xbdb1('0x6a')]('`ItemType`.OrderBy')]})[_0xbdb1('0x1a')](function(_0x39cd69){var _0x232680=0x1;var _0x3e56f9=_[_0xbdb1('0x6c')](_0x39cd69,function(_0x58a14e){_0x58a14e[_0xbdb1('0x90')]=_0x5bc5ff;_0x58a14e[_0xbdb1('0x77')]=_0x58a14e[_0xbdb1('0x91')];_0x58a14e['OrderBy']=_0x232680;delete _0x58a14e[_0xbdb1('0x92')];_0x232680=_0x232680+0x1;return _0x58a14e;});return db[_0xbdb1('0x8f')][_0xbdb1('0x58')](_0x3e56f9,{});})[_0xbdb1('0x1a')](function(){_0x189662(0x1);});});}function insertAdditionalPhones(_0x172638,_0x3c09e0){return new Promise(function(_0x23659b){var _0x5c2e30=[];for(var _0x40f0a1=0x0;_0x40f0a1<_0x3c09e0['length'];_0x40f0a1++){var _0x1e46b6=_0x3c09e0[_0x40f0a1];_0x5c2e30[_0xbdb1('0x5c')](parseContactItemType(_0x1e46b6));}Promise[_0xbdb1('0x86')](_0x5c2e30)[_0xbdb1('0x1a')](function(){var _0x5ed663={'id':_0x172638['id'],'items':_0x3c09e0};return addAdditionalPhones(_0x5ed663)[_0xbdb1('0x1a')](function(){return addCmHopperPhones(_0x172638['id']);});})[_0xbdb1('0x1a')](function(){_0x23659b(_0x172638);});});}function parseContactItemType(_0x49cf32){return new Promise(function(_0x478ecf){if(_0x49cf32['hasOwnProperty'](_0xbdb1('0x8b'))){_0x478ecf(_0x49cf32);}else{return db[_0xbdb1('0x87')][_0xbdb1('0x23')]({'where':{'name':_0x49cf32[_0xbdb1('0x68')]}})[_0xbdb1('0x1a')](function(_0x213b29){if(_['isNil'](_0x213b29))_0x49cf32[_0xbdb1('0x8b')]=null;else _0x49cf32[_0xbdb1('0x8b')]=_0x213b29['id'];_0x478ecf(_0x49cf32);});}});}exports['getAdditionalPhones']=function(_0x4f2760,_0x1d8b26){return db[_0xbdb1('0x48')][_0xbdb1('0x2d')]({'raw':!![],'where':{'CmContactId':_0x4f2760[_0xbdb1('0x61')]['id'],'ItemClass':_0xbdb1('0x8e')},'include':[{'model':db[_0xbdb1('0x87')],'as':'ItemType'}],'order':[['OrderBy'],[db['sequelize'][_0xbdb1('0x6a')](_0xbdb1('0x93'))]]})[_0xbdb1('0x1a')](function(_0x96508c){return _0x96508c;})['then'](respondWithResult(_0x1d8b26,null))['catch'](handleError(_0x1d8b26,null));};exports[_0xbdb1('0x94')]=function(_0x187734,_0x3ab44e){return db[_0xbdb1('0x48')]['findAll']({'raw':!![],'where':{'CmContactId':_0x187734[_0xbdb1('0x34')]['fromContactId']}})[_0xbdb1('0x1a')](function(_0x1b1ab7){var _0x3435b6=_['map'](_0x1b1ab7,function(_0x3709e4){_0x3709e4[_0xbdb1('0x95')]=_0x187734[_0xbdb1('0x34')]['toContactId'];return _0x3709e4;});return db['CmContactHasItem'][_0xbdb1('0x58')](_0x3435b6,{});})[_0xbdb1('0x1a')](function(){return addCmHopperPhones(_0x187734['body']['toContactId']);})['then'](function(){return['ok'];})[_0xbdb1('0x1a')](respondWithResult(_0x3ab44e,null))['catch'](handleError(_0x3ab44e,null));};exports['rescheduleAdditionalPhones']=function(_0x5af3d9,_0x355611){var _0x5349e5=[];_0x5349e5[_0xbdb1('0x5c')](createCmHopperPhone(_0x5af3d9[_0xbdb1('0x34')]['id'],_0x5af3d9[_0xbdb1('0x34')][_0xbdb1('0x96')]));Promise[_0xbdb1('0x86')](_0x5349e5)['then'](function(){return[0x1];})[_0xbdb1('0x1a')](respondWithResult(_0x355611,null));};exports['getHoppers']=function(_0x24f579,_0x4c47fd){var _0x50c8d4={'raw':![],'where':{}};var _0x5716f3={};var _0x2bb8d2={'count':0x0,'rows':[]};return db[_0xbdb1('0x25')]['findOne']({'where':{'id':_0x24f579['params']['id']}})['then'](handleEntityNotFound(_0x4c47fd,null))['then'](function(_0x5ecc1a){if(_0x5ecc1a){_0x5716f3['model']=_[_0xbdb1('0x28')](db[_0xbdb1('0x3b')][_0xbdb1('0x97')]);_0x5716f3[_0xbdb1('0x1f')]=_['keys'](_0x24f579[_0xbdb1('0x1f')]);_0x5716f3[_0xbdb1('0x7b')]=_[_0xbdb1('0x7c')](_0x5716f3[_0xbdb1('0x7a')],_0x5716f3[_0xbdb1('0x1f')]);_0x50c8d4[_0xbdb1('0x7e')]=_[_0xbdb1('0x7c')](_0x5716f3[_0xbdb1('0x7a')],qs[_0xbdb1('0x7d')](_0x24f579[_0xbdb1('0x1f')][_0xbdb1('0x7d')]));_0x50c8d4['attributes']=_0x50c8d4[_0xbdb1('0x7e')][_0xbdb1('0x27')]?_0x50c8d4[_0xbdb1('0x7e')]:_0x5716f3[_0xbdb1('0x7a')];if(!_0x24f579[_0xbdb1('0x1f')]['hasOwnProperty']('nolimit')){_0x50c8d4['limit']=qs[_0xbdb1('0x13')](_0x24f579[_0xbdb1('0x1f')]['limit']);_0x50c8d4[_0xbdb1('0x12')]=qs['offset'](_0x24f579[_0xbdb1('0x1f')]['offset']);}_0x50c8d4[_0xbdb1('0x7f')]=qs[_0xbdb1('0x80')](_0x24f579[_0xbdb1('0x1f')][_0xbdb1('0x80')]);_0x50c8d4[_0xbdb1('0x5a')]=qs[_0xbdb1('0x7b')](_[_0xbdb1('0x98')](_0x24f579[_0xbdb1('0x1f')],_0x5716f3[_0xbdb1('0x7b')]));_0x50c8d4[_0xbdb1('0x5a')]['ContactId']=_0x5ecc1a['id'];if(_0x24f579['query']['filter']){_0x50c8d4[_0xbdb1('0x5a')]=_['merge'](_0x50c8d4['where'],{'$or':_[_0xbdb1('0x6c')](_0x50c8d4['attributes'],function(_0x204a8f){var _0x14e624={};_0x14e624[_0x204a8f]={'$like':'%'+_0x24f579['query'][_0xbdb1('0x99')]+'%'};return _0x14e624;})});}_0x50c8d4=_[_0xbdb1('0x33')]({},_0x50c8d4,_0x24f579[_0xbdb1('0x81')]);return db[_0xbdb1('0x3b')]['count']({'where':_0x50c8d4['where']})[_0xbdb1('0x1a')](function(_0x135d58){_0x2bb8d2['count']=_0x135d58;if(_0x24f579[_0xbdb1('0x1f')][_0xbdb1('0x9a')]){_0x50c8d4['include']=[{'all':!![]}];}return db[_0xbdb1('0x3b')][_0xbdb1('0x2d')](_0x50c8d4);})[_0xbdb1('0x1a')](function(_0x49b200){_0x2bb8d2[_0xbdb1('0x9b')]=_0x49b200;return _0x2bb8d2;});}})[_0xbdb1('0x1a')](respondWithFilteredResult(_0x4c47fd,_0x50c8d4))[_0xbdb1('0x21')](handleError(_0x4c47fd,null));};exports[_0xbdb1('0x9c')]=function(_0x2f8b45,_0xdf34f1){var _0x487a09={'raw':!![],'where':{}};var _0x34a469={};var _0x28c919={'count':0x0,'rows':[]};return db['CmContact'][_0xbdb1('0x79')]({'where':{'id':_0x2f8b45[_0xbdb1('0x61')]['id']}})['then'](handleEntityNotFound(_0xdf34f1,null))[_0xbdb1('0x1a')](function(_0x37f8b3){if(_0x37f8b3){_0x34a469[_0xbdb1('0x7a')]=_[_0xbdb1('0x28')](db[_0xbdb1('0x4a')][_0xbdb1('0x97')]);_0x34a469[_0xbdb1('0x1f')]=_['keys'](_0x2f8b45['query']);_0x34a469[_0xbdb1('0x7b')]=_[_0xbdb1('0x7c')](_0x34a469[_0xbdb1('0x7a')],_0x34a469[_0xbdb1('0x1f')]);_0x487a09['attributes']=_['intersection'](_0x34a469[_0xbdb1('0x7a')],qs[_0xbdb1('0x7d')](_0x2f8b45[_0xbdb1('0x1f')]['fields']));_0x487a09[_0xbdb1('0x7e')]=_0x487a09['attributes'][_0xbdb1('0x27')]?_0x487a09['attributes']:_0x34a469[_0xbdb1('0x7a')];if(!_0x2f8b45['query'][_0xbdb1('0x5f')](_0xbdb1('0x82'))){_0x487a09[_0xbdb1('0x13')]=qs[_0xbdb1('0x13')](_0x2f8b45['query'][_0xbdb1('0x13')]);_0x487a09[_0xbdb1('0x12')]=qs[_0xbdb1('0x12')](_0x2f8b45[_0xbdb1('0x1f')][_0xbdb1('0x12')]);}_0x487a09[_0xbdb1('0x7f')]=qs[_0xbdb1('0x80')](_0x2f8b45[_0xbdb1('0x1f')][_0xbdb1('0x80')]);_0x487a09[_0xbdb1('0x5a')]=qs[_0xbdb1('0x7b')](_[_0xbdb1('0x98')](_0x2f8b45['query'],_0x34a469[_0xbdb1('0x7b')]));_0x487a09[_0xbdb1('0x5a')][_0xbdb1('0x9d')]=_0x37f8b3['id'];if(_0x2f8b45[_0xbdb1('0x1f')][_0xbdb1('0x99')]){_0x487a09[_0xbdb1('0x5a')]=_[_0xbdb1('0x33')](_0x487a09[_0xbdb1('0x5a')],{'$or':_[_0xbdb1('0x6c')](_0x487a09[_0xbdb1('0x7e')],function(_0x3ce7c0){var _0x2d8a2b={};_0x2d8a2b[_0x3ce7c0]={'$like':'%'+_0x2f8b45[_0xbdb1('0x1f')][_0xbdb1('0x99')]+'%'};return _0x2d8a2b;})});}_0x487a09=_['merge']({},_0x487a09,_0x2f8b45[_0xbdb1('0x81')]);return db[_0xbdb1('0x4a')]['count']({'where':_0x487a09['where']})[_0xbdb1('0x1a')](function(_0x55fa7f){_0x28c919['count']=_0x55fa7f;if(_0x2f8b45['query'][_0xbdb1('0x9a')]){_0x487a09[_0xbdb1('0x9e')]=[{'all':!![]}];}return db[_0xbdb1('0x4a')][_0xbdb1('0x2d')](_0x487a09);})['then'](function(_0x5315bc){_0x28c919[_0xbdb1('0x9b')]=_0x5315bc;return _0x28c919;});}})[_0xbdb1('0x1a')](respondWithFilteredResult(_0xdf34f1,_0x487a09))[_0xbdb1('0x21')](handleError(_0xdf34f1,null));};exports[_0xbdb1('0x9f')]=function(_0x35abc9,_0x365c97){var _0x21a81d={'raw':!![],'where':{}};var _0x376856={};var _0x3a425a={'count':0x0,'rows':[]};return db['CmContact'][_0xbdb1('0x79')]({'where':{'id':_0x35abc9['params']['id']}})[_0xbdb1('0x1a')](handleEntityNotFound(_0x365c97,null))[_0xbdb1('0x1a')](function(_0x58d6aa){if(_0x58d6aa){_0x376856['model']=_[_0xbdb1('0x28')](db[_0xbdb1('0x49')]['rawAttributes']);_0x376856[_0xbdb1('0x1f')]=_[_0xbdb1('0x28')](_0x35abc9[_0xbdb1('0x1f')]);_0x376856[_0xbdb1('0x7b')]=_[_0xbdb1('0x7c')](_0x376856[_0xbdb1('0x7a')],_0x376856['query']);_0x21a81d[_0xbdb1('0x7e')]=_['intersection'](_0x376856[_0xbdb1('0x7a')],qs[_0xbdb1('0x7d')](_0x35abc9[_0xbdb1('0x1f')][_0xbdb1('0x7d')]));_0x21a81d[_0xbdb1('0x7e')]=_0x21a81d[_0xbdb1('0x7e')][_0xbdb1('0x27')]?_0x21a81d[_0xbdb1('0x7e')]:_0x376856[_0xbdb1('0x7a')];if(!_0x35abc9[_0xbdb1('0x1f')][_0xbdb1('0x5f')](_0xbdb1('0x82'))){_0x21a81d[_0xbdb1('0x13')]=qs[_0xbdb1('0x13')](_0x35abc9['query']['limit']);_0x21a81d[_0xbdb1('0x12')]=qs[_0xbdb1('0x12')](_0x35abc9[_0xbdb1('0x1f')][_0xbdb1('0x12')]);}_0x21a81d[_0xbdb1('0x7f')]=qs[_0xbdb1('0x80')](_0x35abc9['query'][_0xbdb1('0x80')]);_0x21a81d[_0xbdb1('0x5a')]=qs[_0xbdb1('0x7b')](_[_0xbdb1('0x98')](_0x35abc9[_0xbdb1('0x1f')],_0x376856[_0xbdb1('0x7b')]));_0x21a81d[_0xbdb1('0x5a')][_0xbdb1('0x9d')]=_0x58d6aa['id'];if(_0x35abc9[_0xbdb1('0x1f')]['filter']){_0x21a81d[_0xbdb1('0x5a')]=_[_0xbdb1('0x33')](_0x21a81d[_0xbdb1('0x5a')],{'$or':_[_0xbdb1('0x6c')](_0x21a81d[_0xbdb1('0x7e')],function(_0x2af278){var _0x3bfde7={};_0x3bfde7[_0x2af278]={'$like':'%'+_0x35abc9[_0xbdb1('0x1f')][_0xbdb1('0x99')]+'%'};return _0x3bfde7;})});}_0x21a81d=_[_0xbdb1('0x33')]({},_0x21a81d,_0x35abc9['options']);return db[_0xbdb1('0x49')][_0xbdb1('0x15')]({'where':_0x21a81d['where']})[_0xbdb1('0x1a')](function(_0x2b04fe){_0x3a425a[_0xbdb1('0x15')]=_0x2b04fe;if(_0x35abc9[_0xbdb1('0x1f')][_0xbdb1('0x9a')]){_0x21a81d[_0xbdb1('0x9e')]=[{'all':!![]}];}return db[_0xbdb1('0x49')][_0xbdb1('0x2d')](_0x21a81d);})[_0xbdb1('0x1a')](function(_0x24dd8b){_0x3a425a[_0xbdb1('0x9b')]=_0x24dd8b;return _0x3a425a;});}})[_0xbdb1('0x1a')](respondWithFilteredResult(_0x365c97,_0x21a81d))[_0xbdb1('0x21')](handleError(_0x365c97,null));};exports['getJscriptySessions']=function(_0x444da5,_0x592db8){var _0x10a22d={'raw':!![],'where':{}};var _0x524357={};var _0x2d5d1c={'count':0x0,'rows':[]};return db[_0xbdb1('0x25')][_0xbdb1('0x79')]({'where':{'id':_0x444da5[_0xbdb1('0x61')]['id']}})[_0xbdb1('0x1a')](handleEntityNotFound(_0x592db8,null))['then'](function(_0x2f7639){if(_0x2f7639){_0x524357[_0xbdb1('0x7a')]=_[_0xbdb1('0x28')](db[_0xbdb1('0x50')][_0xbdb1('0x97')]);_0x524357['query']=_['keys'](_0x444da5[_0xbdb1('0x1f')]);_0x524357[_0xbdb1('0x7b')]=_[_0xbdb1('0x7c')](_0x524357['model'],_0x524357[_0xbdb1('0x1f')]);_0x10a22d[_0xbdb1('0x7e')]=_['intersection'](_0x524357[_0xbdb1('0x7a')],qs[_0xbdb1('0x7d')](_0x444da5['query'][_0xbdb1('0x7d')]));_0x10a22d['attributes']=_0x10a22d[_0xbdb1('0x7e')]['length']?_0x10a22d['attributes']:_0x524357['model'];if(!_0x444da5[_0xbdb1('0x1f')]['hasOwnProperty']('nolimit')){_0x10a22d[_0xbdb1('0x13')]=qs[_0xbdb1('0x13')](_0x444da5[_0xbdb1('0x1f')][_0xbdb1('0x13')]);_0x10a22d[_0xbdb1('0x12')]=qs[_0xbdb1('0x12')](_0x444da5[_0xbdb1('0x1f')][_0xbdb1('0x12')]);}_0x10a22d[_0xbdb1('0x7f')]=qs[_0xbdb1('0x80')](_0x444da5[_0xbdb1('0x1f')][_0xbdb1('0x80')]);_0x10a22d[_0xbdb1('0x5a')]=qs[_0xbdb1('0x7b')](_['pick'](_0x444da5[_0xbdb1('0x1f')],_0x524357[_0xbdb1('0x7b')]));_0x10a22d['where'][_0xbdb1('0x9d')]=_0x2f7639['id'];if(_0x444da5['query'][_0xbdb1('0x99')]){_0x10a22d[_0xbdb1('0x5a')]=_[_0xbdb1('0x33')](_0x10a22d[_0xbdb1('0x5a')],{'$or':_['map'](_0x10a22d[_0xbdb1('0x7e')],function(_0x276e81){var _0x332cab={};_0x332cab[_0x276e81]={'$like':'%'+_0x444da5[_0xbdb1('0x1f')][_0xbdb1('0x99')]+'%'};return _0x332cab;})});}_0x10a22d=_[_0xbdb1('0x33')]({},_0x10a22d,_0x444da5[_0xbdb1('0x81')]);return db[_0xbdb1('0x50')][_0xbdb1('0x15')]({'where':_0x10a22d[_0xbdb1('0x5a')]})[_0xbdb1('0x1a')](function(_0x59d5bd){_0x2d5d1c[_0xbdb1('0x15')]=_0x59d5bd;if(_0x444da5[_0xbdb1('0x1f')][_0xbdb1('0x9a')]){_0x10a22d[_0xbdb1('0x9e')]=[{'all':!![]}];}return db[_0xbdb1('0x50')]['findAll'](_0x10a22d);})[_0xbdb1('0x1a')](function(_0x24f512){_0x2d5d1c[_0xbdb1('0x9b')]=_0x24f512;return _0x2d5d1c;});}})['then'](respondWithFilteredResult(_0x592db8,_0x10a22d))['catch'](handleError(_0x592db8,null));};exports[_0xbdb1('0xa0')]=function(_0x44b592,_0x2dd96e){try{if(!_0x44b592['body'][_0xbdb1('0x5d')]){throw new Error(_0xbdb1('0xa1'));}if(!_0x44b592['body'][_0xbdb1('0xa2')]){throw new Error('No\x20association\x20keys\x20specified!');}if(!_0x44b592[_0xbdb1('0x34')][_0xbdb1('0xa3')]){throw new Error(_0xbdb1('0xa4'));}if(!_0x44b592['body'][_0xbdb1('0xa5')]){throw new Error(_0xbdb1('0xa6'));}var _0x19ae11=_0x44b592[_0xbdb1('0x34')][_0xbdb1('0xa2')][_0xbdb1('0xa7')](',');var _0x15e66c=_0x44b592[_0xbdb1('0x34')]['binding_values']['split'](',');if(!_0x19ae11[_0xbdb1('0x27')]||!_0x15e66c[_0xbdb1('0x27')]||_0x19ae11['length']!==_0x15e66c[_0xbdb1('0x27')]){throw new Error('Incorrect\x20binding\x20parameters\x20passed!');}_0x44b592[_0xbdb1('0x34')][_0xbdb1('0x7d')]=_[_0xbdb1('0xa8')](_0x19ae11,_0x15e66c);if(!_0x44b592[_0xbdb1('0x34')]['fields'][_0xbdb1('0x77')]){throw new Error(_0xbdb1('0xa9'));}if(!_0x44b592[_0xbdb1('0x34')][_0xbdb1('0x7d')][_0xbdb1('0xaa')]){throw new Error(_0xbdb1('0xab'));}var _0xb01703=path[_0xbdb1('0x38')](config[_0xbdb1('0xac')],_0xbdb1('0xad'),_0x44b592['file'][_0xbdb1('0xae')]);fs[_0xbdb1('0xaf')](_0xb01703,parseInt(_0xbdb1('0xb0'),0x8));var _0x2f9a28=require(_0xbdb1('0xb1'))[_0xbdb1('0xb2')](path[_0xbdb1('0x38')](__dirname,_0xbdb1('0xb3')),[_0xb01703,_0x44b592['body']['binding_keys'],_0x44b592['body']['binding_values'],_0x44b592[_0xbdb1('0x34')][_0xbdb1('0x5d')],_0x44b592[_0xbdb1('0x34')][_0xbdb1('0xb4')],_0x44b592[_0xbdb1('0x34')][_0xbdb1('0x59')],_0x44b592[_0xbdb1('0x34')]['socket_timestamp']]);return _0x2dd96e['status'](0xc8)['json']({'message':'File\x20uploaded\x20correctly!','pid':_0x2f9a28[_0xbdb1('0xb5')]});}catch(_0x8faa96){return _0x2dd96e[_0xbdb1('0x16')](0x1f4)[_0xbdb1('0x1d')](_0x8faa96);}};exports[_0xbdb1('0xb6')]=function(_0x1acfee,_0x768cc9){var _0x17e8a0=fs['createReadStream'](_0x1acfee[_0xbdb1('0xb7')][_0xbdb1('0x1')]);Papa['parse'](_0x17e8a0,{'header':!![],'skipEmptyLines':!![],'preview':0x1,'complete':function(_0x2432bd){return _0x768cc9[_0xbdb1('0x16')](0xc8)[_0xbdb1('0x11')]({'file':_0x1acfee[_0xbdb1('0xb7')],'fields':_0x2432bd[_0xbdb1('0xb8')][_0xbdb1('0x7d')]});}});};exports['import']=function(_0xdd757,_0x400e52){return db[_0xbdb1('0xb9')]['findAll']({'raw':!![],'attributes':['id'],'where':{'role':_0xbdb1('0xba')}})[_0xbdb1('0x1a')](function(_0x32bdfc){var _0x209a09=![];if(!_0xdd757[_0xbdb1('0x34')][_0xbdb1('0x5d')]){throw new Error(_0xbdb1('0xa1'));}if(!_0xdd757[_0xbdb1('0x34')][_0xbdb1('0xbb')]['phone']){throw new Error('No\x20phone\x20column\x20specified');}if(!_0xdd757[_0xbdb1('0x34')]['binding'][_0xbdb1('0xaa')]){throw new Error('No\x20firstName\x20column\x20specified');}if(!_0xdd757[_0xbdb1('0x34')][_0xbdb1('0xa5')]){throw new Error('Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed');}var _0x25468a=require('child_process')[_0xbdb1('0xb2')](path[_0xbdb1('0x38')](__dirname,_0xbdb1('0xbc')),[_0xdd757['params']['id'],JSON[_0xbdb1('0xbd')](_0xdd757[_0xbdb1('0x34')]),JSON[_0xbdb1('0xbd')](_0x32bdfc)]);_0x25468a['on']('message',function(){_0x209a09=!![];return _0x400e52['status'](0xc8)[_0xbdb1('0x11')]({'message':_0xbdb1('0xbe'),'pid':_0x25468a['pid']});});_0x25468a['on'](_0xbdb1('0xbf'),function(_0x5ebff9){if(_0x5ebff9&&!_0x209a09){return _0x400e52[_0xbdb1('0x16')](0x1f4)[_0xbdb1('0x11')]({'message':'error\x20child\x20process','pid':_0x25468a[_0xbdb1('0xb5')]});}});})['catch'](handleError(_0x400e52,null));};exports[_0xbdb1('0xc0')]=function(_0xc529b,_0x2a8382){return db['User'][_0xbdb1('0x2d')]({'raw':!![],'attributes':['id'],'where':{'role':_0xbdb1('0xba')}})[_0xbdb1('0x1a')](function(_0x428f99){var _0x1d8a8a=![];if(!_0xc529b[_0xbdb1('0x34')][_0xbdb1('0x5d')]){throw new Error('No\x20ListId\x20specified');}if(!_0xc529b[_0xbdb1('0x34')][_0xbdb1('0xbb')]['phone']){throw new Error(_0xbdb1('0xa9'));}if(!_0xc529b[_0xbdb1('0x34')][_0xbdb1('0xbb')][_0xbdb1('0xaa')]){throw new Error(_0xbdb1('0xab'));}if(!_0xc529b[_0xbdb1('0x34')]['socket_timestamp']){throw new Error(_0xbdb1('0xa6'));}var _0x48bd4c=require(_0xbdb1('0xb1'))[_0xbdb1('0xb2')](path[_0xbdb1('0x38')](__dirname,_0xbdb1('0xc1')),[_0xc529b[_0xbdb1('0x61')]['id'],JSON['stringify'](_0xc529b[_0xbdb1('0x34')]),JSON[_0xbdb1('0xbd')](_0x428f99)]);_0x48bd4c['on'](_0xbdb1('0xc2'),function(){_0x1d8a8a=!![];return _0x2a8382[_0xbdb1('0x16')](0xc8)[_0xbdb1('0x11')]({'message':_0xbdb1('0xbe'),'pid':_0x48bd4c[_0xbdb1('0xb5')]});});_0x48bd4c['on'](_0xbdb1('0xbf'),function(_0x2a1f87){if(_0x2a1f87&&!_0x1d8a8a){return _0x2a8382[_0xbdb1('0x16')](0x1f4)[_0xbdb1('0x11')]({'message':_0xbdb1('0xc3'),'pid':_0x48bd4c['pid']});}});})['catch'](handleError(_0x2a8382,null));};exports['getJourney']=function(_0x49ace0,_0x562a2e){var _0x399079=['mail','chat',_0xbdb1('0xc4'),_0xbdb1('0xc5'),_0xbdb1('0xc6'),_0xbdb1('0xc7'),_0xbdb1('0xc8')];var _0x2098f8={'offset':0x0,'order':qs[_0xbdb1('0x80')](_0xbdb1('0xc9'))},_0x583010={'count':0x0,'rows':[]};Promise[_0xbdb1('0xca')]()['then'](function(){if(_0x49ace0[_0xbdb1('0x1f')]['channel']){if(!_[_0xbdb1('0xcb')](_0x399079,_0x49ace0[_0xbdb1('0x1f')][_0xbdb1('0xcc')][_0xbdb1('0xcd')]())){throw new Error('Invalid\x20channel');}_0x399079=[_0x49ace0['query']['channel'][_0xbdb1('0xcd')]()];}if(_0x49ace0[_0xbdb1('0x1f')]['range']){try{var _0x542746=JSON[_0xbdb1('0xce')](_0x49ace0['query'][_0xbdb1('0xcf')]);if(!moment(_0x542746[_0xbdb1('0x3a')])[_0xbdb1('0xd0')]()){throw new Error(_0xbdb1('0xd1'));}if(!moment(_0x542746['to'])['isValid']()){throw new Error(_0xbdb1('0xd2'));}}catch(_0x3d1443){throw new Error('Invalid\x20createdAt\x20filter');}}if(!_0x49ace0['query'][_0xbdb1('0x5f')](_0xbdb1('0x82'))){_0x2098f8[_0xbdb1('0x13')]=qs[_0xbdb1('0x13')](_0x49ace0[_0xbdb1('0x1f')]['limit']||0xa);_0x2098f8['offset']=qs[_0xbdb1('0x12')](_0x49ace0['query'][_0xbdb1('0x12')]);}var _0x4b4aab=_0x399079[_0xbdb1('0x6c')](function(_0x3ec5f2){if(_0x3ec5f2===_0xbdb1('0xc8')){var _0x2e0de4={'attributes':['id','uniqueid',_0xbdb1('0x2f'),_0xbdb1('0xd3'),'destination',_0xbdb1('0xd4'),_0xbdb1('0xd5'),_0xbdb1('0xd6'),'duration',_0xbdb1('0xd7'),_0xbdb1('0xd8'),'userDisposition',_0xbdb1('0xd9'),'userThirdDisposition','UserId'],'where':{'ContactId':_0x49ace0[_0xbdb1('0x61')]['id']},'include':[{'model':db[_0xbdb1('0xb9')],'as':_0xbdb1('0xb9'),'attributes':['id',_0xbdb1('0x64'),_0xbdb1('0xda'),'alias']}],'order':[['createdAt','DESC']]};if(_0x49ace0[_0xbdb1('0x1f')][_0xbdb1('0xcf')]){_0x2e0de4['where'][_0xbdb1('0xd8')]={'$gte':_0x542746[_0xbdb1('0x3a')],'$lte':_0x542746['to']};}return db['VoiceCallReport']['findAndCountAll'](_0x2e0de4)[_0xbdb1('0x1a')](function(_0x5f38db){_0x583010['count']+=_0x5f38db[_0xbdb1('0x15')];return _[_0xbdb1('0x6c')](_0x5f38db[_0xbdb1('0x9b')],function(_0x4d435d){var _0x4f842=_0x4d435d[_0xbdb1('0x35')]({'plain':!![]});_0x4f842[_0xbdb1('0xcc')]=_0x3ec5f2;if(_0x4f842[_0xbdb1('0xb9')]){_0x4f842[_0xbdb1('0xb9')]={'id':_0x4f842['User']['id'],'name':_0x4f842[_0xbdb1('0xb9')][_0xbdb1('0x64')],'fullname':_0x4f842[_0xbdb1('0xb9')]['fullname'],'alias':_0x4f842[_0xbdb1('0xb9')]['alias']};}return _0x4f842;});});}else{var _0x2e7c10=_[_0xbdb1('0xdb')](_0x3ec5f2)+(_0x3ec5f2==='chat'?_0xbdb1('0xdc'):'Account');var _0x2de67e={'attributes':['id',_0xbdb1('0xdd'),_0xbdb1('0xde'),_0xbdb1('0xd8'),'note','disposition',_0xbdb1('0xdf'),_0xbdb1('0xe0'),_0xbdb1('0xe1'),_0x2e7c10+'Id'],'where':{'ContactId':_0x49ace0[_0xbdb1('0x61')]['id']},'include':[{'model':db[_0x2e7c10],'as':_0xbdb1('0xe2'),'attributes':['id','name',_0xbdb1('0xe3')]},{'model':db[_0xbdb1('0xb9')],'as':_0xbdb1('0xe4'),'attributes':['id',_0xbdb1('0x64'),_0xbdb1('0xda')]},{'model':db[_0xbdb1('0x62')],'as':_0xbdb1('0x63'),'attributes':['id','name',_0xbdb1('0x65')],'through':{'attributes':[]}}],'order':[['createdAt','DESC']]};if(_0x49ace0[_0xbdb1('0x1f')]['range']){_0x2de67e[_0xbdb1('0x5a')][_0xbdb1('0xd8')]={'$gte':_0x542746['from'],'$lte':_0x542746['to']};}switch(_0x3ec5f2){case _0xbdb1('0xe5'):_0x2de67e[_0xbdb1('0x7e')][_0xbdb1('0x5c')](_0xbdb1('0xe6'),_0xbdb1('0xe7'),_0xbdb1('0xe8'),_0xbdb1('0xe9'),'osName',_0xbdb1('0xea'),'ratingType',_0xbdb1('0xeb'),_0xbdb1('0xec'));break;case _0xbdb1('0xed'):_0x2de67e['attributes']['push'](_0xbdb1('0xee'),'substatus');break;case _0xbdb1('0xc5'):_0x2de67e[_0xbdb1('0x7e')]['push'](_0xbdb1('0xef'),_0xbdb1('0xf0'));break;}return db[_[_0xbdb1('0xdb')](_0x3ec5f2)+_0xbdb1('0xf1')][_0xbdb1('0xf2')](_0x2de67e)[_0xbdb1('0x1a')](function(_0x58ba6d){_0x583010[_0xbdb1('0x15')]+=_0x58ba6d['count'];return _['map'](_0x58ba6d[_0xbdb1('0x9b')],function(_0x4b21cf){var _0x175450=_0x4b21cf[_0xbdb1('0x35')]({'plain':!![]});_0x175450[_0xbdb1('0xcc')]=_0x3ec5f2;if(_0x175450[_0xbdb1('0xe4')]){_0x175450[_0xbdb1('0xe4')]={'id':_0x175450[_0xbdb1('0xe4')]['id'],'name':_0x175450[_0xbdb1('0xe4')][_0xbdb1('0x64')],'fullname':_0x175450[_0xbdb1('0xe4')]['fullname']};}return _0x175450;});});}});return Promise['all'](_0x4b4aab);})[_0xbdb1('0x1a')](function(_0x3b5a28){return _(_0x3b5a28)[_0xbdb1('0xf3')]()[_0xbdb1('0xf4')](_0xbdb1('0xd8'))[_0xbdb1('0xf5')]()['value']();})[_0xbdb1('0x1a')](function(_0x2eda2e){_0x583010['rows']=_0x2098f8[_0xbdb1('0x13')]?_0x2eda2e[_0xbdb1('0xf6')](_0x2098f8[_0xbdb1('0x12')],_0x2098f8['offset']+_0x2098f8[_0xbdb1('0x13')]):_0x2eda2e;return _0x583010;})[_0xbdb1('0x1a')](respondWithFilteredResult(_0x562a2e,_0x2098f8))[_0xbdb1('0x21')](handleError(_0x562a2e,null));}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.events.js b/server/api/cmContact/cmContact.events.js index b06aacc..6d9deff 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 _0x209d=['events','save','update','remove','emit','hasOwnProperty','hook','exports'];(function(_0x4d3941,_0x5b0bc0){var _0x5c311b=function(_0x2df585){while(--_0x2df585){_0x4d3941['push'](_0x4d3941['shift']());}};_0x5c311b(++_0x5b0bc0);}(_0x209d,0x190));var _0xd209=function(_0x99919b,_0x561853){_0x99919b=_0x99919b-0x0;var _0xdf31d3=_0x209d[_0x99919b];return _0xdf31d3;};'use strict';var EventEmitter=require(_0xd209('0x0'));var CmContact=require('../../mysqldb')['db']['CmContact'];var CmContactEvents=new EventEmitter();CmContactEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xd209('0x1'),'afterUpdate':_0xd209('0x2'),'afterDestroy':_0xd209('0x3')};function emitEvent(_0x1fed94){return function(_0x2f2d2e,_0xbb4423,_0x25d02e){CmContactEvents[_0xd209('0x4')](_0x1fed94+':'+_0x2f2d2e['id'],_0x2f2d2e);CmContactEvents[_0xd209('0x4')](_0x1fed94,_0x2f2d2e);_0x25d02e(null);};}for(var e in events){if(events[_0xd209('0x5')](e)){var event=events[e];CmContact[_0xd209('0x6')](e,emitEvent(event));}}module[_0xd209('0x7')]=CmContactEvents; \ No newline at end of file +var _0x915e=['update','remove','emit','hasOwnProperty','hook','events','setMaxListeners','save'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x915e,0xa5));var _0xe915=function(_0x121783,_0x60c3f7){_0x121783=_0x121783-0x0;var _0x4b78cb=_0x915e[_0x121783];return _0x4b78cb;};'use strict';var EventEmitter=require(_0xe915('0x0'));var CmContact=require('../../mysqldb')['db']['CmContact'];var CmContactEvents=new EventEmitter();CmContactEvents[_0xe915('0x1')](0x0);var events={'afterCreate':_0xe915('0x2'),'afterUpdate':_0xe915('0x3'),'afterDestroy':_0xe915('0x4')};function emitEvent(_0xc6f1a9){return function(_0x2e59e5,_0x4946a1,_0x1737a0){CmContactEvents['emit'](_0xc6f1a9+':'+_0x2e59e5['id'],_0x2e59e5);CmContactEvents[_0xe915('0x5')](_0xc6f1a9,_0x2e59e5);_0x1737a0(null);};}for(var e in events){if(events[_0xe915('0x6')](e)){var event=events[e];CmContact[_0xe915('0x7')](e,emitEvent(event));}}module['exports']=CmContactEvents; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.model.js b/server/api/cmContact/cmContact.model.js index 0b93e5e..7858966 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 _0x4af3=['CmHopperBlack','List\x20not\x20found','destroy','ContactId','VoiceQueueId','push','all','info','[CmContact][afterDestroy][Error]','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','../../config/environment/shared','./cmContact.attributes','exports','define','CmContact','cm_contacts','phone','fti_cm_contacts','firstName','mobile','fax','FULLTEXT','utf8mb4','utf8mb4_unicode_ci','models','get','error','cmContact','scheduledat','format','dialTimezone','VoiceQueue','findOne','then','isNil','utcOffset','add','minutes','YYYY-MM-DD\x20HH:mm:ss','ret','cmContact,\x20afterCreate\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20VoiceQueue\x20','CmHopper','create','priority','callbackUniqueid','catch','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopper\x20VoiceQueue\x20','CmHopperFinal','cmContact,\x20afterCreate,\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20VoiceQueue\x20','ListId','afterCreate','inspect','timezones','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopper\x20Campaign\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20Campaign\x20','findAll','dialCheckDuplicateType','CmList','Lists','length','onlyIfOpen','outbound','BlackLists','cmContact,\x20%s,\x20%s','message','Campaign'];(function(_0x4a93bb,_0x495404){var _0x208468=function(_0x1d82b7){while(--_0x1d82b7){_0x4a93bb['push'](_0x4a93bb['shift']());}};_0x208468(++_0x495404);}(_0x4af3,0x135));var _0x34af=function(_0xe4e303,_0x8f9657){_0xe4e303=_0xe4e303-0x0;var _0x39021e=_0x4af3[_0xe4e303];return _0x39021e;};'use strict';var _=require('lodash');var util=require(_0x34af('0x0'));var logger=require(_0x34af('0x1'))(_0x34af('0x2'));var moment=require(_0x34af('0x3'));var BPromise=require(_0x34af('0x4'));var rp=require(_0x34af('0x5'));var fs=require('fs');var path=require(_0x34af('0x6'));var rimraf=require('rimraf');var config=require(_0x34af('0x7'));var shared=require(_0x34af('0x8'));var attributes=require(_0x34af('0x9'));module[_0x34af('0xa')]=function(_0x1bb8a5,_0x593e68){return _0x1bb8a5[_0x34af('0xb')](_0x34af('0xc'),attributes,{'tableName':_0x34af('0xd'),'paranoid':!![],'indexes':[{'name':_0x34af('0xe'),'fields':['phone']},{'name':_0x34af('0xf'),'fields':[_0x34af('0x10'),'lastName',_0x34af('0xe'),_0x34af('0x11'),_0x34af('0x12'),'email'],'type':_0x34af('0x13')}],'timestamps':!![],'charset':_0x34af('0x14'),'collate':_0x34af('0x15'),'hooks':{'afterCreate':function(_0x12b8a7,_0x12f8e9,_0x2c5fef){var _0x19a62d=_0x1bb8a5[_0x34af('0x16')];var _0x1b18bb=_0x12b8a7[_0x34af('0x17')]({'plain':!![]});function _0x2b9ef1(){return function(_0x301f66){logger[_0x34af('0x18')](_0x34af('0x19'),'afterCreate',util['inspect'](_0x301f66,{'showHidden':![],'depth':null}));};}function _0x4db957(_0x4f60e7,_0x1d541c){var _0x270a70=_0x1d541c[_0x34af('0x1a')]?_0x1d541c[_0x34af('0x1a')]:moment()[_0x34af('0x1b')]('YYYY-MM-DD\x20HH:mm:ss');return new BPromise(function(_0x49208d,_0x3cd380){if(_['isNil'](_0x1d541c[_0x34af('0x1c')])){_0x49208d({'ret':_0x270a70});}else{_0x19a62d[_0x34af('0x1d')][_0x34af('0x1e')]({'where':{'id':_0x4f60e7['id']}})[_0x34af('0x1f')](function(_0xd69dc6){if(!_[_0x34af('0x20')](_0xd69dc6)){var _0x89e614=_0xd69dc6[_0x34af('0x1c')];if(!_['isNil'](_0x89e614)){var _0x1f0b6f=shared['timezones'];var _0x210ca7=_0x1f0b6f[_0x89e614];var _0x2a36d0=_0x1f0b6f[_0x1d541c[_0x34af('0x1c')]];if(!_[_0x34af('0x20')](_0x210ca7)&&!_[_0x34af('0x20')](_0x2a36d0)){var _0x3a5352=_0x210ca7[_0x34af('0x21')]-_0x2a36d0[_0x34af('0x21')];_0x270a70=_0x1d541c[_0x34af('0x1a')]?_0x1d541c[_0x34af('0x1a')]:moment();var _0xf9b3c9=moment(_0x270a70)[_0x34af('0x22')](_0x3a5352,_0x34af('0x23'));_0x49208d({'ret':_0xf9b3c9[_0x34af('0x1b')](_0x34af('0x24'))});}else _0x49208d({'ret':_0x270a70});}else _0x49208d({'ret':_0x270a70});}else{_0x49208d({'ret':_0x270a70});}});}});return 0xa;}var _0x2cf00a=function(_0x4239f9){return new BPromise(function(_0x475d9a,_0x1aad3a){_0x4db957(_0x4239f9,_0x1b18bb)[_0x34af('0x1f')](function(_0x2780bb){_0x1b18bb['scheduledat']=_0x2780bb[_0x34af('0x25')];_0x19a62d['CmHopper']['findOne']({'where':{'phone':_0x1b18bb[_0x34af('0xe')],'VoiceQueueId':_0x4239f9['id']}})[_0x34af('0x1f')](function(_0x30f85d){if(!_[_0x34af('0x20')](_0x30f85d)){throw new Error(_0x34af('0x26')+_0x1b18bb[_0x34af('0xe')]+_0x34af('0x27')+_0x4239f9['id']);}return _0x19a62d[_0x34af('0x28')][_0x34af('0x29')]({'phone':_0x1b18bb[_0x34af('0xe')],'ContactId':_0x1b18bb['id'],'ListId':_0x1b18bb['ListId'],'priority':_0x1b18bb[_0x34af('0x2a')]?_0x1b18bb[_0x34af('0x2a')]:0x2,'scheduledat':_0x1b18bb[_0x34af('0x1a')]?_0x1b18bb[_0x34af('0x1a')]:moment()['format'](_0x34af('0x24')),'callback':_0x1b18bb[_0x34af('0x2b')]?!![]:![],'callbackuniqueid':_0x1b18bb[_0x34af('0x2b')]?_0x1b18bb[_0x34af('0x2b')]:undefined,'callbackat':_0x1b18bb[_0x34af('0x2b')]?moment()[_0x34af('0x1b')](_0x34af('0x24')):undefined,'VoiceQueueId':_0x4239f9['id']});})[_0x34af('0x2c')](function(_0x5c0ba6){_0x1aad3a(_0x5c0ba6);});});});};var _0x3db42d=function(_0x50c7c8){return new BPromise(function(_0xda5ac,_0x536fd6){_0x4db957(_0x50c7c8,_0x1b18bb)[_0x34af('0x1f')](function(_0xe42833){_0x1b18bb[_0x34af('0x1a')]=_0xe42833['ret'];_0x19a62d[_0x34af('0x28')][_0x34af('0x1e')]({'where':{'phone':_0x1b18bb['phone'],'VoiceQueueId':_0x50c7c8['id']}})[_0x34af('0x1f')](function(_0x3cdbb6){if(!_[_0x34af('0x20')](_0x3cdbb6)){throw new Error(_0x34af('0x26')+_0x1b18bb['phone']+_0x34af('0x2d')+_0x50c7c8['id']);}return _0x19a62d[_0x34af('0x2e')][_0x34af('0x1e')]({'where':{'calleridnum':_0x1b18bb[_0x34af('0xe')],'VoiceQueueId':_0x50c7c8['id']}});})['then'](function(_0x4938c6){if(!_[_0x34af('0x20')](_0x4938c6)){throw new Error(_0x34af('0x2f')+_0x1b18bb[_0x34af('0xe')]+_0x34af('0x30')+_0x50c7c8['id']);}return _0x19a62d[_0x34af('0x28')][_0x34af('0x29')]({'phone':_0x1b18bb['phone'],'ContactId':_0x1b18bb['id'],'ListId':_0x1b18bb[_0x34af('0x31')],'priority':_0x1b18bb[_0x34af('0x2a')]?_0x1b18bb[_0x34af('0x2a')]:0x2,'scheduledat':_0x1b18bb['scheduledat']?_0x1b18bb['scheduledat']:moment()[_0x34af('0x1b')](_0x34af('0x24')),'callback':_0x1b18bb[_0x34af('0x2b')]?!![]:![],'callbackuniqueid':_0x1b18bb[_0x34af('0x2b')]?_0x1b18bb['callbackUniqueid']:undefined,'callbackat':_0x1b18bb[_0x34af('0x2b')]?moment()[_0x34af('0x1b')](_0x34af('0x24')):undefined,'VoiceQueueId':_0x50c7c8['id']});})['catch'](function(_0x2b64d7){_0x536fd6(_0x2b64d7);});});});};function _0x176df3(){return function(_0x498616){logger[_0x34af('0x18')](_0x34af('0x19'),_0x34af('0x32'),util[_0x34af('0x33')](_0x498616,{'showHidden':![],'depth':null}));};}function _0x54696b(_0x41796f,_0x375176){var _0x89c242=_0x375176[_0x34af('0x1a')]?_0x375176['scheduledat']:moment()[_0x34af('0x1b')]('YYYY-MM-DD\x20HH:mm:ss');return new BPromise(function(_0x28d2e3,_0x1a746a){if(_[_0x34af('0x20')](_0x375176[_0x34af('0x1c')])){_0x28d2e3({'ret':_0x89c242});}else{_0x19a62d['Campaign']['findOne']({'where':{'id':_0x41796f['id']}})[_0x34af('0x1f')](function(_0x489a89){if(!_['isNil'](_0x489a89)){var _0x19306c=_0x489a89[_0x34af('0x1c')];if(!_[_0x34af('0x20')](_0x19306c)){var _0x1ba1b1=shared[_0x34af('0x34')];var _0x560bee=_0x1ba1b1[_0x19306c];var _0x2db8be=_0x1ba1b1[_0x375176[_0x34af('0x1c')]];if(!_[_0x34af('0x20')](_0x560bee)&&!_[_0x34af('0x20')](_0x2db8be)){var _0x485160=_0x560bee[_0x34af('0x21')]-_0x2db8be[_0x34af('0x21')];_0x89c242=_0x375176[_0x34af('0x1a')]?_0x375176[_0x34af('0x1a')]:moment();var _0x46b4aa=moment(_0x89c242)['add'](_0x485160,_0x34af('0x23'));_0x28d2e3({'ret':_0x46b4aa[_0x34af('0x1b')](_0x34af('0x24'))});}else _0x28d2e3({'ret':_0x89c242});}else _0x28d2e3({'ret':_0x89c242});}else{_0x28d2e3({'ret':_0x89c242});}});}});return 0xa;}var _0x2bab91=function(_0x302115){return new BPromise(function(_0x4825c1,_0x86f06d){_0x54696b(_0x302115,_0x1b18bb)[_0x34af('0x1f')](function(_0x56768b){_0x1b18bb[_0x34af('0x1a')]=_0x56768b[_0x34af('0x25')];_0x19a62d[_0x34af('0x28')][_0x34af('0x1e')]({'where':{'phone':_0x1b18bb[_0x34af('0xe')],'CampaignId':_0x302115['id']}})['then'](function(_0x6f0a76){if(!_[_0x34af('0x20')](_0x6f0a76)){throw new Error(_0x34af('0x26')+_0x1b18bb[_0x34af('0xe')]+'\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20Campaign\x20'+_0x302115['id']);}return _0x19a62d[_0x34af('0x28')][_0x34af('0x29')]({'phone':_0x1b18bb['phone'],'ContactId':_0x1b18bb['id'],'ListId':_0x1b18bb['ListId'],'priority':_0x1b18bb[_0x34af('0x2a')]?_0x1b18bb[_0x34af('0x2a')]:0x2,'scheduledat':_0x1b18bb[_0x34af('0x1a')]?_0x1b18bb[_0x34af('0x1a')]:moment()[_0x34af('0x1b')](_0x34af('0x24')),'callback':_0x1b18bb['callbackUniqueid']?!![]:![],'callbackuniqueid':_0x1b18bb[_0x34af('0x2b')]?_0x1b18bb[_0x34af('0x2b')]:undefined,'callbackat':_0x1b18bb[_0x34af('0x2b')]?moment()['format'](_0x34af('0x24')):undefined,'CampaignId':_0x302115['id']});})[_0x34af('0x2c')](function(_0x26488b){_0x86f06d(_0x26488b);});});});};var _0x2675d0=function(_0x41e13f){return new BPromise(function(_0x28dd0c,_0x2b2dc3){_0x54696b(_0x41e13f,_0x1b18bb)[_0x34af('0x1f')](function(_0x230ff1){_0x1b18bb[_0x34af('0x1a')]=_0x230ff1[_0x34af('0x25')];_0x19a62d[_0x34af('0x28')][_0x34af('0x1e')]({'where':{'phone':_0x1b18bb[_0x34af('0xe')],'CampaignId':_0x41e13f['id']}})[_0x34af('0x1f')](function(_0xe53ca6){if(!_['isNil'](_0xe53ca6)){throw new Error(_0x34af('0x26')+_0x1b18bb['phone']+_0x34af('0x35')+_0x41e13f['id']);}return _0x19a62d[_0x34af('0x2e')][_0x34af('0x1e')]({'where':{'calleridnum':_0x1b18bb[_0x34af('0xe')],'CampaignId':_0x41e13f['id']}});})['then'](function(_0x2ece57){if(!_[_0x34af('0x20')](_0x2ece57)){throw new Error(_0x34af('0x2f')+_0x1b18bb[_0x34af('0xe')]+_0x34af('0x36')+_0x41e13f['id']);}return _0x19a62d[_0x34af('0x28')][_0x34af('0x29')]({'phone':_0x1b18bb[_0x34af('0xe')],'ContactId':_0x1b18bb['id'],'ListId':_0x1b18bb[_0x34af('0x31')],'priority':_0x1b18bb[_0x34af('0x2a')]?_0x1b18bb[_0x34af('0x2a')]:0x2,'scheduledat':_0x1b18bb[_0x34af('0x1a')]?_0x1b18bb[_0x34af('0x1a')]:moment()[_0x34af('0x1b')](_0x34af('0x24')),'callback':_0x1b18bb[_0x34af('0x2b')]?!![]:![],'callbackuniqueid':_0x1b18bb['callbackUniqueid']?_0x1b18bb[_0x34af('0x2b')]:undefined,'callbackat':_0x1b18bb[_0x34af('0x2b')]?moment()[_0x34af('0x1b')](_0x34af('0x24')):undefined,'CampaignId':_0x41e13f['id']});})['catch'](function(_0x57b4cd){_0x2b2dc3(_0x57b4cd);});});});};if(_0x1b18bb[_0x34af('0x31')]){_0x19a62d['VoiceQueue'][_0x34af('0x37')]({'where':{'type':'outbound'},'attributes':['id',_0x34af('0x38'),_0x34af('0x1c')],'include':[{'model':_0x19a62d[_0x34af('0x39')],'as':_0x34af('0x3a'),'where':{'id':_0x1b18bb[_0x34af('0x31')]}}]})[_0x34af('0x1f')](function(_0x4b659b){if(_0x4b659b){var _0x393f36=[];for(var _0x19a650=0x0,_0x181caf;_0x19a650<_0x4b659b[_0x34af('0x3b')];_0x19a650+=0x1){_0x181caf=_0x4b659b[_0x19a650][_0x34af('0x17')]({'plain':!![]});switch(_0x181caf[_0x34af('0x38')]){case'always':_0x3db42d(_0x181caf)[_0x34af('0x2c')](_0x2b9ef1());break;case _0x34af('0x3c'):_0x2cf00a(_0x181caf)[_0x34af('0x2c')](_0x2b9ef1());break;default:_0x54696b(_0x181caf,_0x1b18bb)['then'](function(_0x9dc07d){_0x1b18bb[_0x34af('0x1a')]=_0x9dc07d[_0x34af('0x25')];_0x19a62d[_0x34af('0x28')][_0x34af('0x29')]({'phone':_0x1b18bb[_0x34af('0xe')],'ContactId':_0x1b18bb['id'],'ListId':_0x1b18bb[_0x34af('0x31')],'scheduledat':_0x1b18bb['scheduledat']?_0x1b18bb['scheduledat']:moment()[_0x34af('0x1b')](_0x34af('0x24')),'priority':_0x1b18bb[_0x34af('0x2a')]?_0x1b18bb[_0x34af('0x2a')]:0x2,'callback':_0x1b18bb[_0x34af('0x2b')]?!![]:![],'callbackuniqueid':_0x1b18bb[_0x34af('0x2b')]?_0x1b18bb[_0x34af('0x2b')]:undefined,'callbackat':_0x1b18bb[_0x34af('0x2b')]?moment()[_0x34af('0x1b')](_0x34af('0x24')):undefined,'VoiceQueueId':_0x181caf['id']})[_0x34af('0x2c')](_0x2b9ef1());});}}}})[_0x34af('0x1f')](function(){return _0x19a62d[_0x34af('0x1d')][_0x34af('0x37')]({'where':{'type':_0x34af('0x3d')},'attributes':['id'],'include':[{'model':_0x19a62d[_0x34af('0x39')],'as':_0x34af('0x3e'),'where':{'id':_0x1b18bb[_0x34af('0x31')]}}]})['then'](function(_0x2800c5){if(_0x2800c5){var _0x5cb56e=[];for(var _0x15f6da=0x0,_0x30e1eb;_0x15f6da<_0x2800c5[_0x34af('0x3b')];_0x15f6da+=0x1){_0x30e1eb=_0x2800c5[_0x15f6da]['get']({'plain':!![]});_0x19a62d['CmHopperBlack'][_0x34af('0x29')]({'phone':_0x1b18bb[_0x34af('0xe')],'ContactId':_0x1b18bb['id'],'ListId':_0x1b18bb[_0x34af('0x31')],'VoiceQueueId':_0x30e1eb['id']})['catch'](function(_0x5f5af8){logger[_0x34af('0x18')](_0x34af('0x3f'),_0x34af('0x32'),_0x5f5af8[_0x34af('0x40')]);});}}});})['then'](function(){return _0x19a62d[_0x34af('0x41')][_0x34af('0x37')]({'attributes':['id',_0x34af('0x38'),_0x34af('0x1c')],'include':[{'model':_0x19a62d[_0x34af('0x39')],'as':_0x34af('0x3a'),'where':{'id':_0x1b18bb['ListId']}}]})[_0x34af('0x1f')](function(_0x3a3329){if(_0x3a3329){var _0x254549=[];for(var _0x40d12c=0x0,_0x3e912b;_0x40d12c<_0x3a3329[_0x34af('0x3b')];_0x40d12c+=0x1){_0x3e912b=_0x3a3329[_0x40d12c][_0x34af('0x17')]({'plain':!![]});switch(_0x3e912b[_0x34af('0x38')]){case'always':_0x2675d0(_0x3e912b)[_0x34af('0x2c')](_0x176df3());break;case'onlyIfOpen':_0x2bab91(_0x3e912b)[_0x34af('0x2c')](_0x176df3());break;default:_0x19a62d[_0x34af('0x28')][_0x34af('0x29')]({'phone':_0x1b18bb['phone'],'ContactId':_0x1b18bb['id'],'ListId':_0x1b18bb[_0x34af('0x31')],'scheduledat':_0x1b18bb['scheduledat']?_0x1b18bb[_0x34af('0x1a')]:moment()['format'](_0x34af('0x24')),'priority':_0x1b18bb['priority']?_0x1b18bb[_0x34af('0x2a')]:0x2,'callback':_0x1b18bb['callbackUniqueid']?!![]:![],'callbackuniqueid':_0x1b18bb[_0x34af('0x2b')]?_0x1b18bb['callbackUniqueid']:undefined,'callbackat':_0x1b18bb['callbackUniqueid']?moment()[_0x34af('0x1b')](_0x34af('0x24')):undefined,'CampaignId':_0x3e912b['id']})[_0x34af('0x2c')](_0x176df3());}}}});})[_0x34af('0x1f')](function(){return _0x19a62d['Campaign']['findAll']({'attributes':['id'],'include':[{'model':_0x19a62d[_0x34af('0x39')],'as':'BlackLists','where':{'id':_0x1b18bb[_0x34af('0x31')]}}]})[_0x34af('0x1f')](function(_0x3c2b44){if(_0x3c2b44){var _0x54d36b=[];for(var _0x39fbd8=0x0,_0x36460a;_0x39fbd8<_0x3c2b44[_0x34af('0x3b')];_0x39fbd8+=0x1){_0x36460a=_0x3c2b44[_0x39fbd8][_0x34af('0x17')]({'plain':!![]});_0x19a62d[_0x34af('0x42')][_0x34af('0x29')]({'phone':_0x1b18bb[_0x34af('0xe')],'ContactId':_0x1b18bb['id'],'ListId':_0x1b18bb['ListId'],'CampaignId':_0x36460a['id']})['catch'](function(_0x907e61){logger['error'](_0x34af('0x3f'),_0x34af('0x32'),_0x907e61['message']);});}}});})['then'](function(){_0x2c5fef();})[_0x34af('0x2c')](function(_0x28726b){logger[_0x34af('0x18')]('cmContact,\x20%s,\x20%s',_0x34af('0x32'),_0x28726b['message']);_0x2c5fef(_0x28726b);});}else{_0x2c5fef(new Error(_0x34af('0x43')));}},'afterDestroy':function(_0x2f9da2,_0x1f6501,_0x19edde){var _0x2ec0b2=_0x1bb8a5['models'];var _0x2d672e=_0x2f9da2[_0x34af('0x17')]({'plain':!![]});return _0x2ec0b2[_0x34af('0x28')][_0x34af('0x37')]({'raw':!![],'where':{'ListId':_0x2d672e['ListId'],'ContactId':_0x2d672e['id']}})[_0x34af('0x1f')](function(_0x33850c){if(!_['isEmpty'](_0x33850c)){var _0x4a90a6=[];for(var _0xb82a71=0x0;_0xb82a71<_0x33850c['length'];_0xb82a71+=0x1){var _0x352c08=_0x2ec0b2[_0x34af('0x28')][_0x34af('0x44')]({'where':{'ListId':_0x33850c[_0xb82a71][_0x34af('0x31')],'ContactId':_0x33850c[_0xb82a71][_0x34af('0x45')],'VoiceQueueId':_0x33850c[_0xb82a71][_0x34af('0x46')],'CampaignId':_0x33850c[_0xb82a71]['CampaignId']}});_0x4a90a6[_0x34af('0x47')](_0x352c08);}return BPromise[_0x34af('0x48')](_0x4a90a6);}})[_0x34af('0x1f')](function(_0x2813f4){logger[_0x34af('0x49')]('[CmContact][afterDestroy][Succesfull]',util['inspect'](_0x2813f4,{'showHidden':![],'depth':null}));_0x19edde();})[_0x34af('0x2c')](function(_0x2b06a1){logger['error'](_0x34af('0x4a'),util[_0x34af('0x33')](_0x2b06a1,{'showHidden':![],'depth':null}));_0x19edde(_0x2b06a1);});}}});}; \ No newline at end of file +var _0x8a24=['cmContact,\x20%s,\x20%s','findAll','always','message','List\x20not\x20found','CampaignId','info','[CmContact][afterDestroy][Error]','util','../../config/logger','moment','bluebird','request-promise','path','../../config/environment','exports','define','CmContact','cm_contacts','fti_cm_contacts','firstName','lastName','phone','mobile','fax','FULLTEXT','utf8mb4','utf8mb4_unicode_ci','models','get','cmContact','afterCreate','scheduledat','format','YYYY-MM-DD\x20HH:mm:ss','dialTimezone','VoiceQueue','findOne','then','isNil','utcOffset','add','minutes','CmHopper','cmContact,\x20afterCreate\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20VoiceQueue\x20','create','ListId','priority','callbackUniqueid','catch','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopper\x20VoiceQueue\x20','CmHopperFinal','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20VoiceQueue\x20','error','inspect','Campaign','timezones','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20Campaign\x20','ret','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopper\x20Campaign\x20','cmContact,\x20afterCreate,\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20Campaign\x20','outbound','CmList','length','dialCheckDuplicateType','onlyIfOpen','BlackLists','CmHopperBlack'];(function(_0x2ce623,_0x194212){var _0x1c0808=function(_0x1b827a){while(--_0x1b827a){_0x2ce623['push'](_0x2ce623['shift']());}};_0x1c0808(++_0x194212);}(_0x8a24,0x94));var _0x48a2=function(_0x57e20e,_0x522409){_0x57e20e=_0x57e20e-0x0;var _0x3867b3=_0x8a24[_0x57e20e];return _0x3867b3;};'use strict';var _=require('lodash');var util=require(_0x48a2('0x0'));var logger=require(_0x48a2('0x1'))('api');var moment=require(_0x48a2('0x2'));var BPromise=require(_0x48a2('0x3'));var rp=require(_0x48a2('0x4'));var fs=require('fs');var path=require(_0x48a2('0x5'));var rimraf=require('rimraf');var config=require(_0x48a2('0x6'));var shared=require('../../config/environment/shared');var attributes=require('./cmContact.attributes');module[_0x48a2('0x7')]=function(_0x49bb5b,_0x57e566){return _0x49bb5b[_0x48a2('0x8')](_0x48a2('0x9'),attributes,{'tableName':_0x48a2('0xa'),'paranoid':!![],'indexes':[{'name':'phone','fields':['phone']},{'name':_0x48a2('0xb'),'fields':[_0x48a2('0xc'),_0x48a2('0xd'),_0x48a2('0xe'),_0x48a2('0xf'),_0x48a2('0x10'),'email'],'type':_0x48a2('0x11')}],'timestamps':!![],'charset':_0x48a2('0x12'),'collate':_0x48a2('0x13'),'hooks':{'afterCreate':function(_0x45bc3d,_0x553c8d,_0x2d1f67){var _0x968148=_0x49bb5b[_0x48a2('0x14')];var _0x2e62bc=_0x45bc3d[_0x48a2('0x15')]({'plain':!![]});function _0x607c50(){return function(_0x25f6ad){logger['error'](_0x48a2('0x16'),_0x48a2('0x17'),util['inspect'](_0x25f6ad,{'showHidden':![],'depth':null}));};}function _0x1ba680(_0x437760,_0x31a6d9){var _0x2a0094=_0x31a6d9[_0x48a2('0x18')]?_0x31a6d9[_0x48a2('0x18')]:moment()[_0x48a2('0x19')](_0x48a2('0x1a'));return new BPromise(function(_0x232581,_0x153848){if(_['isNil'](_0x31a6d9[_0x48a2('0x1b')])){_0x232581({'ret':_0x2a0094});}else{_0x968148[_0x48a2('0x1c')][_0x48a2('0x1d')]({'where':{'id':_0x437760['id']}})[_0x48a2('0x1e')](function(_0x5f030a){if(!_[_0x48a2('0x1f')](_0x5f030a)){var _0x444952=_0x5f030a['dialTimezone'];if(!_['isNil'](_0x444952)){var _0x208d86=shared['timezones'];var _0x358b96=_0x208d86[_0x444952];var _0x3858c7=_0x208d86[_0x31a6d9['dialTimezone']];if(!_[_0x48a2('0x1f')](_0x358b96)&&!_['isNil'](_0x3858c7)){var _0x43e8df=_0x358b96[_0x48a2('0x20')]-_0x3858c7[_0x48a2('0x20')];_0x2a0094=_0x31a6d9[_0x48a2('0x18')]?_0x31a6d9[_0x48a2('0x18')]:moment();var _0x2f7dc3=moment(_0x2a0094)[_0x48a2('0x21')](_0x43e8df,_0x48a2('0x22'));_0x232581({'ret':_0x2f7dc3[_0x48a2('0x19')](_0x48a2('0x1a'))});}else _0x232581({'ret':_0x2a0094});}else _0x232581({'ret':_0x2a0094});}else{_0x232581({'ret':_0x2a0094});}});}});return 0xa;}var _0x3c851b=function(_0x5a2d57){return new BPromise(function(_0x1a1f1e,_0x4b4a71){_0x1ba680(_0x5a2d57,_0x2e62bc)[_0x48a2('0x1e')](function(_0xb1b95a){_0x2e62bc[_0x48a2('0x18')]=_0xb1b95a['ret'];_0x968148[_0x48a2('0x23')][_0x48a2('0x1d')]({'where':{'phone':_0x2e62bc['phone'],'VoiceQueueId':_0x5a2d57['id']}})[_0x48a2('0x1e')](function(_0x5a5b12){if(!_['isNil'](_0x5a5b12)){throw new Error(_0x48a2('0x24')+_0x2e62bc['phone']+_0x48a2('0x25')+_0x5a2d57['id']);}return _0x968148[_0x48a2('0x23')][_0x48a2('0x26')]({'phone':_0x2e62bc['phone'],'ContactId':_0x2e62bc['id'],'ListId':_0x2e62bc[_0x48a2('0x27')],'priority':_0x2e62bc[_0x48a2('0x28')]?_0x2e62bc[_0x48a2('0x28')]:0x2,'scheduledat':_0x2e62bc[_0x48a2('0x18')]?_0x2e62bc[_0x48a2('0x18')]:moment()[_0x48a2('0x19')](_0x48a2('0x1a')),'callback':_0x2e62bc[_0x48a2('0x29')]?!![]:![],'callbackuniqueid':_0x2e62bc[_0x48a2('0x29')]?_0x2e62bc[_0x48a2('0x29')]:undefined,'callbackat':_0x2e62bc[_0x48a2('0x29')]?moment()[_0x48a2('0x19')](_0x48a2('0x1a')):undefined,'VoiceQueueId':_0x5a2d57['id']});})[_0x48a2('0x2a')](function(_0x2ddf4d){_0x4b4a71(_0x2ddf4d);});});});};var _0x4f6a2a=function(_0x19f187){return new BPromise(function(_0x2d7286,_0x3ffa55){_0x1ba680(_0x19f187,_0x2e62bc)[_0x48a2('0x1e')](function(_0x399a2d){_0x2e62bc['scheduledat']=_0x399a2d['ret'];_0x968148[_0x48a2('0x23')][_0x48a2('0x1d')]({'where':{'phone':_0x2e62bc[_0x48a2('0xe')],'VoiceQueueId':_0x19f187['id']}})[_0x48a2('0x1e')](function(_0xe70172){if(!_[_0x48a2('0x1f')](_0xe70172)){throw new Error(_0x48a2('0x24')+_0x2e62bc[_0x48a2('0xe')]+_0x48a2('0x2b')+_0x19f187['id']);}return _0x968148[_0x48a2('0x2c')][_0x48a2('0x1d')]({'where':{'calleridnum':_0x2e62bc[_0x48a2('0xe')],'VoiceQueueId':_0x19f187['id']}});})['then'](function(_0x484c3d){if(!_['isNil'](_0x484c3d)){throw new Error('cmContact,\x20afterCreate,\x20'+_0x2e62bc[_0x48a2('0xe')]+_0x48a2('0x2d')+_0x19f187['id']);}return _0x968148['CmHopper'][_0x48a2('0x26')]({'phone':_0x2e62bc[_0x48a2('0xe')],'ContactId':_0x2e62bc['id'],'ListId':_0x2e62bc['ListId'],'priority':_0x2e62bc['priority']?_0x2e62bc[_0x48a2('0x28')]:0x2,'scheduledat':_0x2e62bc[_0x48a2('0x18')]?_0x2e62bc[_0x48a2('0x18')]:moment()[_0x48a2('0x19')](_0x48a2('0x1a')),'callback':_0x2e62bc[_0x48a2('0x29')]?!![]:![],'callbackuniqueid':_0x2e62bc[_0x48a2('0x29')]?_0x2e62bc[_0x48a2('0x29')]:undefined,'callbackat':_0x2e62bc[_0x48a2('0x29')]?moment()[_0x48a2('0x19')](_0x48a2('0x1a')):undefined,'VoiceQueueId':_0x19f187['id']});})[_0x48a2('0x2a')](function(_0x41500d){_0x3ffa55(_0x41500d);});});});};function _0x14acaa(){return function(_0x27c75e){logger[_0x48a2('0x2e')]('cmContact',_0x48a2('0x17'),util[_0x48a2('0x2f')](_0x27c75e,{'showHidden':![],'depth':null}));};}function _0x19510a(_0x5d4447,_0x50c5ef){var _0x4ddc6e=_0x50c5ef['scheduledat']?_0x50c5ef[_0x48a2('0x18')]:moment()[_0x48a2('0x19')](_0x48a2('0x1a'));return new BPromise(function(_0x47e3c7,_0x390c2a){if(_[_0x48a2('0x1f')](_0x50c5ef[_0x48a2('0x1b')])){_0x47e3c7({'ret':_0x4ddc6e});}else{_0x968148[_0x48a2('0x30')][_0x48a2('0x1d')]({'where':{'id':_0x5d4447['id']}})[_0x48a2('0x1e')](function(_0x4ee787){if(!_[_0x48a2('0x1f')](_0x4ee787)){var _0xd3dc98=_0x4ee787[_0x48a2('0x1b')];if(!_[_0x48a2('0x1f')](_0xd3dc98)){var _0x3f4cfc=shared[_0x48a2('0x31')];var _0x15e1d3=_0x3f4cfc[_0xd3dc98];var _0x122b71=_0x3f4cfc[_0x50c5ef[_0x48a2('0x1b')]];if(!_[_0x48a2('0x1f')](_0x15e1d3)&&!_[_0x48a2('0x1f')](_0x122b71)){var _0x3a31b4=_0x15e1d3['utcOffset']-_0x122b71[_0x48a2('0x20')];_0x4ddc6e=_0x50c5ef[_0x48a2('0x18')]?_0x50c5ef[_0x48a2('0x18')]:moment();var _0x4a1fc7=moment(_0x4ddc6e)[_0x48a2('0x21')](_0x3a31b4,'minutes');_0x47e3c7({'ret':_0x4a1fc7[_0x48a2('0x19')](_0x48a2('0x1a'))});}else _0x47e3c7({'ret':_0x4ddc6e});}else _0x47e3c7({'ret':_0x4ddc6e});}else{_0x47e3c7({'ret':_0x4ddc6e});}});}});return 0xa;}var _0x235df0=function(_0x2b6427){return new BPromise(function(_0x5ba6fc,_0x45ca03){_0x19510a(_0x2b6427,_0x2e62bc)[_0x48a2('0x1e')](function(_0x6ce183){_0x2e62bc[_0x48a2('0x18')]=_0x6ce183['ret'];_0x968148[_0x48a2('0x23')][_0x48a2('0x1d')]({'where':{'phone':_0x2e62bc[_0x48a2('0xe')],'CampaignId':_0x2b6427['id']}})['then'](function(_0x5281e6){if(!_[_0x48a2('0x1f')](_0x5281e6)){throw new Error(_0x48a2('0x24')+_0x2e62bc[_0x48a2('0xe')]+_0x48a2('0x32')+_0x2b6427['id']);}return _0x968148[_0x48a2('0x23')][_0x48a2('0x26')]({'phone':_0x2e62bc[_0x48a2('0xe')],'ContactId':_0x2e62bc['id'],'ListId':_0x2e62bc[_0x48a2('0x27')],'priority':_0x2e62bc[_0x48a2('0x28')]?_0x2e62bc[_0x48a2('0x28')]:0x2,'scheduledat':_0x2e62bc['scheduledat']?_0x2e62bc['scheduledat']:moment()[_0x48a2('0x19')](_0x48a2('0x1a')),'callback':_0x2e62bc[_0x48a2('0x29')]?!![]:![],'callbackuniqueid':_0x2e62bc[_0x48a2('0x29')]?_0x2e62bc[_0x48a2('0x29')]:undefined,'callbackat':_0x2e62bc[_0x48a2('0x29')]?moment()[_0x48a2('0x19')](_0x48a2('0x1a')):undefined,'CampaignId':_0x2b6427['id']});})[_0x48a2('0x2a')](function(_0x3d64b5){_0x45ca03(_0x3d64b5);});});});};var _0x418d78=function(_0x47bb2d){return new BPromise(function(_0x1e6cf4,_0x2ac2bc){_0x19510a(_0x47bb2d,_0x2e62bc)['then'](function(_0x2fce93){_0x2e62bc[_0x48a2('0x18')]=_0x2fce93[_0x48a2('0x33')];_0x968148[_0x48a2('0x23')][_0x48a2('0x1d')]({'where':{'phone':_0x2e62bc['phone'],'CampaignId':_0x47bb2d['id']}})[_0x48a2('0x1e')](function(_0x2617ac){if(!_[_0x48a2('0x1f')](_0x2617ac)){throw new Error(_0x48a2('0x24')+_0x2e62bc['phone']+_0x48a2('0x34')+_0x47bb2d['id']);}return _0x968148[_0x48a2('0x2c')]['findOne']({'where':{'calleridnum':_0x2e62bc[_0x48a2('0xe')],'CampaignId':_0x47bb2d['id']}});})['then'](function(_0x434a77){if(!_[_0x48a2('0x1f')](_0x434a77)){throw new Error(_0x48a2('0x35')+_0x2e62bc['phone']+_0x48a2('0x36')+_0x47bb2d['id']);}return _0x968148['CmHopper']['create']({'phone':_0x2e62bc['phone'],'ContactId':_0x2e62bc['id'],'ListId':_0x2e62bc[_0x48a2('0x27')],'priority':_0x2e62bc[_0x48a2('0x28')]?_0x2e62bc[_0x48a2('0x28')]:0x2,'scheduledat':_0x2e62bc[_0x48a2('0x18')]?_0x2e62bc[_0x48a2('0x18')]:moment()[_0x48a2('0x19')](_0x48a2('0x1a')),'callback':_0x2e62bc[_0x48a2('0x29')]?!![]:![],'callbackuniqueid':_0x2e62bc[_0x48a2('0x29')]?_0x2e62bc[_0x48a2('0x29')]:undefined,'callbackat':_0x2e62bc[_0x48a2('0x29')]?moment()[_0x48a2('0x19')](_0x48a2('0x1a')):undefined,'CampaignId':_0x47bb2d['id']});})[_0x48a2('0x2a')](function(_0x3d3a02){_0x2ac2bc(_0x3d3a02);});});});};if(_0x2e62bc['ListId']){_0x968148[_0x48a2('0x1c')]['findAll']({'where':{'type':_0x48a2('0x37')},'attributes':['id','dialCheckDuplicateType',_0x48a2('0x1b')],'include':[{'model':_0x968148[_0x48a2('0x38')],'as':'Lists','where':{'id':_0x2e62bc[_0x48a2('0x27')]}}]})[_0x48a2('0x1e')](function(_0x167fc9){if(_0x167fc9){var _0x4d4b2c=[];for(var _0x305516=0x0,_0x32df02;_0x305516<_0x167fc9[_0x48a2('0x39')];_0x305516+=0x1){_0x32df02=_0x167fc9[_0x305516][_0x48a2('0x15')]({'plain':!![]});switch(_0x32df02[_0x48a2('0x3a')]){case'always':_0x4f6a2a(_0x32df02)['catch'](_0x607c50());break;case _0x48a2('0x3b'):_0x3c851b(_0x32df02)['catch'](_0x607c50());break;default:_0x19510a(_0x32df02,_0x2e62bc)['then'](function(_0x215573){_0x2e62bc[_0x48a2('0x18')]=_0x215573[_0x48a2('0x33')];_0x968148[_0x48a2('0x23')]['create']({'phone':_0x2e62bc[_0x48a2('0xe')],'ContactId':_0x2e62bc['id'],'ListId':_0x2e62bc[_0x48a2('0x27')],'scheduledat':_0x2e62bc['scheduledat']?_0x2e62bc['scheduledat']:moment()[_0x48a2('0x19')](_0x48a2('0x1a')),'priority':_0x2e62bc[_0x48a2('0x28')]?_0x2e62bc['priority']:0x2,'callback':_0x2e62bc[_0x48a2('0x29')]?!![]:![],'callbackuniqueid':_0x2e62bc[_0x48a2('0x29')]?_0x2e62bc[_0x48a2('0x29')]:undefined,'callbackat':_0x2e62bc[_0x48a2('0x29')]?moment()[_0x48a2('0x19')](_0x48a2('0x1a')):undefined,'VoiceQueueId':_0x32df02['id']})['catch'](_0x607c50());});}}}})['then'](function(){return _0x968148[_0x48a2('0x1c')]['findAll']({'where':{'type':_0x48a2('0x37')},'attributes':['id'],'include':[{'model':_0x968148[_0x48a2('0x38')],'as':_0x48a2('0x3c'),'where':{'id':_0x2e62bc[_0x48a2('0x27')]}}]})[_0x48a2('0x1e')](function(_0x55e410){if(_0x55e410){var _0x15493a=[];for(var _0x5997e9=0x0,_0x2bea91;_0x5997e9<_0x55e410[_0x48a2('0x39')];_0x5997e9+=0x1){_0x2bea91=_0x55e410[_0x5997e9][_0x48a2('0x15')]({'plain':!![]});_0x968148[_0x48a2('0x3d')][_0x48a2('0x26')]({'phone':_0x2e62bc[_0x48a2('0xe')],'ContactId':_0x2e62bc['id'],'ListId':_0x2e62bc[_0x48a2('0x27')],'VoiceQueueId':_0x2bea91['id']})[_0x48a2('0x2a')](function(_0x50dd5e){logger[_0x48a2('0x2e')](_0x48a2('0x3e'),'afterCreate',_0x50dd5e['message']);});}}});})[_0x48a2('0x1e')](function(){return _0x968148[_0x48a2('0x30')][_0x48a2('0x3f')]({'attributes':['id',_0x48a2('0x3a'),'dialTimezone'],'include':[{'model':_0x968148[_0x48a2('0x38')],'as':'Lists','where':{'id':_0x2e62bc['ListId']}}]})['then'](function(_0x29fdd5){if(_0x29fdd5){var _0x512c7b=[];for(var _0x56790f=0x0,_0x3b2ffc;_0x56790f<_0x29fdd5['length'];_0x56790f+=0x1){_0x3b2ffc=_0x29fdd5[_0x56790f][_0x48a2('0x15')]({'plain':!![]});switch(_0x3b2ffc[_0x48a2('0x3a')]){case _0x48a2('0x40'):_0x418d78(_0x3b2ffc)['catch'](_0x14acaa());break;case _0x48a2('0x3b'):_0x235df0(_0x3b2ffc)[_0x48a2('0x2a')](_0x14acaa());break;default:_0x968148[_0x48a2('0x23')][_0x48a2('0x26')]({'phone':_0x2e62bc[_0x48a2('0xe')],'ContactId':_0x2e62bc['id'],'ListId':_0x2e62bc['ListId'],'scheduledat':_0x2e62bc[_0x48a2('0x18')]?_0x2e62bc[_0x48a2('0x18')]:moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'priority':_0x2e62bc[_0x48a2('0x28')]?_0x2e62bc['priority']:0x2,'callback':_0x2e62bc['callbackUniqueid']?!![]:![],'callbackuniqueid':_0x2e62bc[_0x48a2('0x29')]?_0x2e62bc[_0x48a2('0x29')]:undefined,'callbackat':_0x2e62bc[_0x48a2('0x29')]?moment()[_0x48a2('0x19')](_0x48a2('0x1a')):undefined,'CampaignId':_0x3b2ffc['id']})['catch'](_0x14acaa());}}}});})[_0x48a2('0x1e')](function(){return _0x968148[_0x48a2('0x30')][_0x48a2('0x3f')]({'attributes':['id'],'include':[{'model':_0x968148[_0x48a2('0x38')],'as':_0x48a2('0x3c'),'where':{'id':_0x2e62bc[_0x48a2('0x27')]}}]})[_0x48a2('0x1e')](function(_0x5e4fbb){if(_0x5e4fbb){var _0x5d0c04=[];for(var _0x2c4c3f=0x0,_0x4f1fcd;_0x2c4c3f<_0x5e4fbb[_0x48a2('0x39')];_0x2c4c3f+=0x1){_0x4f1fcd=_0x5e4fbb[_0x2c4c3f][_0x48a2('0x15')]({'plain':!![]});_0x968148[_0x48a2('0x3d')][_0x48a2('0x26')]({'phone':_0x2e62bc[_0x48a2('0xe')],'ContactId':_0x2e62bc['id'],'ListId':_0x2e62bc[_0x48a2('0x27')],'CampaignId':_0x4f1fcd['id']})[_0x48a2('0x2a')](function(_0x3722d7){logger[_0x48a2('0x2e')](_0x48a2('0x3e'),_0x48a2('0x17'),_0x3722d7[_0x48a2('0x41')]);});}}});})['then'](function(){_0x2d1f67();})[_0x48a2('0x2a')](function(_0x463ab0){logger['error']('cmContact,\x20%s,\x20%s','afterCreate',_0x463ab0[_0x48a2('0x41')]);_0x2d1f67(_0x463ab0);});}else{_0x2d1f67(new Error(_0x48a2('0x42')));}},'afterDestroy':function(_0x347ab3,_0x2eb872,_0x2e8a55){var _0x4cab6c=_0x49bb5b[_0x48a2('0x14')];var _0x25b652=_0x347ab3[_0x48a2('0x15')]({'plain':!![]});return _0x4cab6c[_0x48a2('0x23')][_0x48a2('0x3f')]({'raw':!![],'where':{'ListId':_0x25b652[_0x48a2('0x27')],'ContactId':_0x25b652['id']}})[_0x48a2('0x1e')](function(_0xefc0c7){if(!_['isEmpty'](_0xefc0c7)){var _0x98ac40=[];for(var _0x2bb1ce=0x0;_0x2bb1ce<_0xefc0c7[_0x48a2('0x39')];_0x2bb1ce+=0x1){var _0x38bd38=_0x4cab6c[_0x48a2('0x23')]['destroy']({'where':{'ListId':_0xefc0c7[_0x2bb1ce][_0x48a2('0x27')],'ContactId':_0xefc0c7[_0x2bb1ce]['ContactId'],'VoiceQueueId':_0xefc0c7[_0x2bb1ce]['VoiceQueueId'],'CampaignId':_0xefc0c7[_0x2bb1ce][_0x48a2('0x43')]}});_0x98ac40['push'](_0x38bd38);}return BPromise['all'](_0x98ac40);}})['then'](function(_0x247618){logger[_0x48a2('0x44')]('[CmContact][afterDestroy][Succesfull]',util[_0x48a2('0x2f')](_0x247618,{'showHidden':![],'depth':null}));_0x2e8a55();})['catch'](function(_0x370d35){logger[_0x48a2('0x2e')](_0x48a2('0x45'),util[_0x48a2('0x2f')](_0x370d35,{'showHidden':![],'depth':null}));_0x2e8a55(_0x370d35);});}}});}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.rpc.js b/server/api/cmContact/cmContact.rpc.js index 1e0aa7c..fcdf9f7 100644 --- a/server/api/cmContact/cmContact.rpc.js +++ b/server/api/cmContact/cmContact.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['include','model','length','CmContactHasItem','find','ListId','Contact','isNil','CmContactId','CmContact','catch','CreateCmContact','create','body','keys','startsWith','cf_','table','cm_contacts','set','where','id\x20=\x20?','toString','sequelize','query','lodash','util','moment','bluebird','ioredis','squel','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','./cmContact.socket','register','request','then','info','CmContact,\x20%s,\x20%s','request\x20sent','debug','CmContact,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','GetCmContact','findAll','options','raw','attributes','limit','map'];(function(_0x5d0aa4,_0x3c40cb){var _0x56cb53=function(_0x16b5ea){while(--_0x16b5ea){_0x5d0aa4['push'](_0x5d0aa4['shift']());}};_0x56cb53(++_0x3c40cb);}(_0x9957,0x93));var _0x7995=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x9957[_0x2dafbe];return _0x58a45a;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var moment=require(_0x7995('0x2'));var BPromise=require(_0x7995('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7995('0x4'));var squel=require(_0x7995('0x5'));var db=require(_0x7995('0x6'))['db'];var utils=require(_0x7995('0x7'));var logger=require('../../config/logger')(_0x7995('0x8'));var config=require(_0x7995('0x9'));var jayson=require(_0x7995('0xa'));var client=jayson[_0x7995('0xb')][_0x7995('0xc')]({'port':0x232a});config[_0x7995('0xd')]=_['defaults'](config[_0x7995('0xd')],{'host':_0x7995('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x7995('0xd')]));require(_0x7995('0xf'))[_0x7995('0x10')](socket);function respondWithRpcPromise(_0x35b5fe,_0x3c1d19,_0x1e400a){return new BPromise(function(_0x341672,_0x524f7b){return client[_0x7995('0x11')](_0x35b5fe,_0x1e400a)[_0x7995('0x12')](function(_0x581f22){logger[_0x7995('0x13')](_0x7995('0x14'),_0x3c1d19,_0x7995('0x15'));logger[_0x7995('0x16')](_0x7995('0x17'),_0x3c1d19,_0x7995('0x15'),JSON[_0x7995('0x18')](_0x581f22));if(_0x581f22['error']){if(_0x581f22['error'][_0x7995('0x19')]===0x1f4){logger[_0x7995('0x1a')](_0x7995('0x14'),_0x3c1d19,_0x581f22[_0x7995('0x1a')][_0x7995('0x1b')]);return _0x524f7b(_0x581f22[_0x7995('0x1a')][_0x7995('0x1b')]);}logger[_0x7995('0x1a')]('CmContact,\x20%s,\x20%s',_0x3c1d19,_0x581f22[_0x7995('0x1a')]['message']);return _0x341672(_0x581f22[_0x7995('0x1a')][_0x7995('0x1b')]);}else{logger[_0x7995('0x13')](_0x7995('0x14'),_0x3c1d19,_0x7995('0x15'));_0x341672(_0x581f22[_0x7995('0x1c')]['message']);}})['catch'](function(_0x2536c8){logger['error']('CmContact,\x20%s,\x20%s',_0x3c1d19,_0x2536c8);_0x524f7b(_0x2536c8);});});}exports[_0x7995('0x1d')]=function(_0x3d463e){var _0x4cbe10=this;return new Promise(function(_0x3a9b54,_0x51f276){return db['CmContact'][_0x7995('0x1e')]({'raw':_0x3d463e[_0x7995('0x1f')]?_0x3d463e[_0x7995('0x1f')][_0x7995('0x20')]===undefined?!![]:![]:!![],'where':_0x3d463e[_0x7995('0x1f')]?_0x3d463e[_0x7995('0x1f')]['where']||null:null,'attributes':_0x3d463e[_0x7995('0x1f')]?_0x3d463e[_0x7995('0x1f')][_0x7995('0x21')]||null:null,'limit':_0x3d463e[_0x7995('0x1f')]?_0x3d463e[_0x7995('0x1f')][_0x7995('0x22')]||null:null,'include':_0x3d463e[_0x7995('0x1f')]?_0x3d463e[_0x7995('0x1f')]['include']?_[_0x7995('0x23')](_0x3d463e[_0x7995('0x1f')][_0x7995('0x24')],function(_0x268ce7){return{'model':db[_0x268ce7[_0x7995('0x25')]],'as':_0x268ce7['as'],'attributes':_0x268ce7[_0x7995('0x21')],'include':_0x268ce7['include']?_[_0x7995('0x23')](_0x268ce7['include'],function(_0x229742){return{'model':db[_0x229742[_0x7995('0x25')]],'as':_0x229742['as'],'attributes':_0x229742[_0x7995('0x21')],'include':_0x229742[_0x7995('0x24')]?_[_0x7995('0x23')](_0x229742['include'],function(_0x9b2a15){return{'model':db[_0x9b2a15['model']],'as':_0x9b2a15['as'],'attributes':_0x9b2a15[_0x7995('0x21')]};}):[]};}):[]};}):[]:[]})[_0x7995('0x12')](function(_0x4253e5){logger['info']('GetCmContact',_0x3d463e);logger['debug'](_0x7995('0x1d'),_0x3d463e,JSON[_0x7995('0x18')](_0x4253e5));if(_0x4253e5[_0x7995('0x26')]==0x0){return db[_0x7995('0x27')][_0x7995('0x28')]({'raw':!![],'where':{'item':_0x3d463e[_0x7995('0x1f')]['phone']},'include':[{'model':db['CmContact'],'where':{'ListId':_0x3d463e[_0x7995('0x1f')]['where'][_0x7995('0x29')],'deletedAt':{'$eq':null}},'as':_0x7995('0x2a')}]})[_0x7995('0x12')](function(_0x1e9fa4){if(_[_0x7995('0x2b')](_0x1e9fa4)){_0x3a9b54(_0x4253e5);}else{var _0x510841=_0x1e9fa4[_0x7995('0x2c')];return db[_0x7995('0x2d')]['findAll']({'raw':!![],'where':{'id':_0x510841},'attributes':_0x3d463e['options']?_0x3d463e['options'][_0x7995('0x21')]||null:null})[_0x7995('0x12')](function(_0x4a176f){_0x3a9b54(_0x4a176f);});}});}else{_0x3a9b54(_0x4253e5);}})[_0x7995('0x2e')](function(_0x51b95d){logger[_0x7995('0x1a')](_0x7995('0x1d'),_0x51b95d[_0x7995('0x1b')],_0x3d463e);_0x51f276(_0x4cbe10['error'](0x1f4,_0x51b95d['message']));});});};exports[_0x7995('0x2f')]=function(_0x5e67fe){var _0x5d2428=this;return new Promise(function(_0x3e99cd,_0xe328b1){return db['CmContact'][_0x7995('0x30')](_0x5e67fe[_0x7995('0x31')],{'raw':_0x5e67fe[_0x7995('0x1f')]?_0x5e67fe[_0x7995('0x1f')][_0x7995('0x20')]===undefined?!![]:![]:!![]})['then'](function(_0x2d4285){var _0x242713;for(var _0xf612e6=0x0;_0xf612e6{}\s\\|]/g,'-');_0x59181e(null,util[_0x0a9e('0x26')]('%s-%s%s',path[_0x0a9e('0x27')](_0x5ea472['originalname'],path[_0x0a9e('0x28')](_0x5ea472['originalname'])),Date[_0x0a9e('0x29')](),path[_0x0a9e('0x28')](_0x5ea472[_0x0a9e('0x24')])));}})});router[_0x0a9e('0x18')](_0x0a9e('0x2a'),upload[_0x0a9e('0x2b')](_0x0a9e('0x2c')),controller[_0x0a9e('0x2d')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x3652a7,_0x468813,_0x2b1f27){_0x2b1f27(null,path[_0x0a9e('0x21')](config['root'],_0x0a9e('0x23')));},'filename':function(_0x40e7a3,_0x1843b2,_0x824a4f){_0x1843b2[_0x0a9e('0x24')]=_0x1843b2[_0x0a9e('0x24')][_0x0a9e('0x25')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x824a4f(null,util[_0x0a9e('0x26')](_0x0a9e('0x2e'),path['basename'](_0x1843b2[_0x0a9e('0x24')],path['extname'](_0x1843b2[_0x0a9e('0x24')])),Date[_0x0a9e('0x29')](),path[_0x0a9e('0x28')](_0x1843b2[_0x0a9e('0x24')])));}})});router[_0x0a9e('0x18')]('/upload',upload[_0x0a9e('0x2b')](_0x0a9e('0x2c')),controller[_0x0a9e('0x2f')]);router[_0x0a9e('0x18')](_0x0a9e('0x30'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x31')]);router[_0x0a9e('0x18')]('/uploadUpdates/:id',auth[_0x0a9e('0xd')](),controller['importUpdates']);router[_0x0a9e('0x32')](_0x0a9e('0x33'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x34')]);router['delete'](_0x0a9e('0x33'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x35')]);module[_0x0a9e('0x36')]=router; \ No newline at end of file +var _0xa9e0=['basename','extname','now','/csv','single','file','uploadCsv','%s-%s%s','upload','/upload/:id','import','put','/:id','update','destroy','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmContact.controller','get','index','/describe','show','/:id/tags','isAuthenticated','getTags','/:id/hoppers','getHoppers','/:id/hopper_histories','/:id/hopper_finals','getHopperFinals','/:id/jscripty_sessions','getJscriptySessions','/:id/journey','getJourney','post','create','/create_many','bulkCreate','setTags','setAdditionalPhones','/:id/duplicateAdditionalPhones','/:id/rescheduleAdditionalPhones','rescheduleAdditionalPhones','join','root','server/files/tmp','originalname','replace','format'];(function(_0x248ff8,_0x3bbef8){var _0x12ca92=function(_0x3df850){while(--_0x3df850){_0x248ff8['push'](_0x248ff8['shift']());}};_0x12ca92(++_0x3bbef8);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2d8fc2,_0x1c461d){_0x2d8fc2=_0x2d8fc2-0x0;var _0x3a9e53=_0xa9e0[_0x2d8fc2];return _0x3a9e53;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));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 a2c24ea..bf663af 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 _0x7b05=['STRING','sequelize','exports','INTEGER'];(function(_0x440b28,_0x394b1d){var _0x5e7964=function(_0x38275c){while(--_0x38275c){_0x440b28['push'](_0x440b28['shift']());}};_0x5e7964(++_0x394b1d);}(_0x7b05,0x91));var _0x57b0=function(_0x34325b,_0x5e5afe){_0x34325b=_0x34325b-0x0;var _0x3da348=_0x7b05[_0x34325b];return _0x3da348;};'use strict';var Sequelize=require(_0x57b0('0x0'));module[_0x57b0('0x1')]={'CmContactId':{'type':Sequelize[_0x57b0('0x2')],'primaryKey':!![]},'item':{'type':Sequelize[_0x57b0('0x3')],'defaultValue':'','primaryKey':!![]},'ItemTypeId':{'type':Sequelize['INTEGER'],'defaultValue':null},'ItemClass':{'type':Sequelize[_0x57b0('0x3')],'defaultValue':'PHONE'},'OrderBy':{'type':Sequelize[_0x57b0('0x2')],'defaultValue':null},'description':{'type':Sequelize[_0x57b0('0x3')],'defaultValue':null}}; \ No newline at end of file +var _0xb6b1=['STRING','sequelize','INTEGER'];(function(_0x4089b7,_0x3b4874){var _0x1ad26c=function(_0x2d8a33){while(--_0x2d8a33){_0x4089b7['push'](_0x4089b7['shift']());}};_0x1ad26c(++_0x3b4874);}(_0xb6b1,0x17b));var _0x1b6b=function(_0x1deb72,_0x3f6338){_0x1deb72=_0x1deb72-0x0;var _0x18bbdf=_0xb6b1[_0x1deb72];return _0x18bbdf;};'use strict';var Sequelize=require(_0x1b6b('0x0'));module['exports']={'CmContactId':{'type':Sequelize[_0x1b6b('0x1')],'primaryKey':!![]},'item':{'type':Sequelize['STRING'],'defaultValue':'','primaryKey':!![]},'ItemTypeId':{'type':Sequelize[_0x1b6b('0x1')],'defaultValue':null},'ItemClass':{'type':Sequelize[_0x1b6b('0x2')],'defaultValue':'PHONE'},'OrderBy':{'type':Sequelize[_0x1b6b('0x1')],'defaultValue':null},'description':{'type':Sequelize['STRING'],'defaultValue':null}}; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.controller.js b/server/api/cmContactHasItem/cmContactHasItem.controller.js index 05f0518..cd85b24 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 _0xa144=['set','apply','reject','save','update','then','destroy','get','CmContactHasItems','UserProfileResource','error','stack','name','send','index','map','CmContactHasItem','rawAttributes','key','model','keys','query','filters','attributes','intersection','fields','hasOwnProperty','order','sort','filter','where','type','merge','findAll','rows','catch','show','params','length','include','options','create','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','find','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','count','limit'];(function(_0x45b805,_0x3256b9){var _0x40c931=function(_0x46a9d2){while(--_0x46a9d2){_0x45b805['push'](_0x45b805['shift']());}};_0x40c931(++_0x3256b9);}(_0xa144,0x84));var _0x4a14=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xa144[_0x501510];return _0x1e6ee5;};'use strict';var emlformat=require(_0x4a14('0x0'));var rimraf=require(_0x4a14('0x1'));var zipdir=require(_0x4a14('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4a14('0x3'));var moment=require(_0x4a14('0x4'));var BPromise=require(_0x4a14('0x5'));var Mustache=require(_0x4a14('0x6'));var util=require(_0x4a14('0x7'));var path=require(_0x4a14('0x8'));var sox=require(_0x4a14('0x9'));var csv=require(_0x4a14('0xa'));var ejs=require(_0x4a14('0xb'));var fs=require('fs');var fs_extra=require(_0x4a14('0xc'));var _=require(_0x4a14('0xd'));var squel=require(_0x4a14('0xe'));var crypto=require('crypto');var jsforce=require(_0x4a14('0xf'));var deskjs=require(_0x4a14('0x10'));var toCsv=require('to-csv');var querystring=require(_0x4a14('0x11'));var Papa=require('papaparse');var Redis=require(_0x4a14('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x4a14('0x13'));var as=require(_0x4a14('0x14'));var hardwareService=require(_0x4a14('0x15'));var logger=require(_0x4a14('0x16'))(_0x4a14('0x17'));var utils=require(_0x4a14('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x4a14('0x19'));var db=require(_0x4a14('0x1a'))['db'];function respondWithStatusCode(_0x2a6520,_0x419a31){_0x419a31=_0x419a31||0xcc;return function(_0x19f0e1){if(_0x19f0e1){return _0x2a6520[_0x4a14('0x1b')](_0x419a31);}return _0x2a6520['status'](_0x419a31)['end']();};}function respondWithResult(_0x23e808,_0x704a6a){_0x704a6a=_0x704a6a||0xc8;return function(_0x292fc1){if(_0x292fc1){return _0x23e808[_0x4a14('0x1c')](_0x704a6a)[_0x4a14('0x1d')](_0x292fc1);}};}function respondWithFilteredResult(_0x16f800,_0x17bbe9){return function(_0x5e4f59){if(_0x5e4f59){var _0x145e52=typeof _0x17bbe9[_0x4a14('0x1e')]===_0x4a14('0x1f')&&typeof _0x17bbe9['limit']===_0x4a14('0x1f');var _0xb9b52c=_0x5e4f59[_0x4a14('0x20')];var _0x17ce8d=_0x145e52?0x0:_0x17bbe9['offset'];var _0x250a8a=_0x145e52?_0x5e4f59[_0x4a14('0x20')]:_0x17bbe9[_0x4a14('0x1e')]+_0x17bbe9[_0x4a14('0x21')];var _0x1efeaa;if(_0x250a8a>=_0xb9b52c){_0x250a8a=_0xb9b52c;_0x1efeaa=0xc8;}else{_0x1efeaa=0xce;}_0x16f800[_0x4a14('0x1c')](_0x1efeaa);return _0x16f800[_0x4a14('0x22')]('Content-Range',_0x17ce8d+'-'+_0x250a8a+'/'+_0xb9b52c)['json'](_0x5e4f59);}return null;};}function patchUpdates(_0x26168d){return function(_0x3de17b){try{jsonpatch[_0x4a14('0x23')](_0x3de17b,_0x26168d,!![]);}catch(_0x2f3310){return BPromise[_0x4a14('0x24')](_0x2f3310);}return _0x3de17b[_0x4a14('0x25')]();};}function saveUpdates(_0x208f1c,_0x48fc53){return function(_0x841845){if(_0x841845){return _0x841845[_0x4a14('0x26')](_0x208f1c)[_0x4a14('0x27')](function(_0x1c8065){return _0x1c8065;});}return null;};}function removeEntity(_0x1603a8,_0x1ebf4c){return function(_0x4373c4){if(_0x4373c4){return _0x4373c4[_0x4a14('0x28')]()[_0x4a14('0x27')](function(){var _0x459356=_0x4373c4[_0x4a14('0x29')]({'plain':!![]});var _0x25ce2c=_0x4a14('0x2a');return db[_0x4a14('0x2b')]['destroy']({'where':{'type':_0x25ce2c,'resourceId':_0x459356['id']}})['then'](function(){return _0x4373c4;});})[_0x4a14('0x27')](function(){_0x1603a8['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x16eb6e,_0x5cac29){return function(_0x339655){if(!_0x339655){_0x16eb6e[_0x4a14('0x1b')](0x194);}return _0x339655;};}function handleError(_0x2e330a,_0x3f70a1){_0x3f70a1=_0x3f70a1||0x1f4;return function(_0x5da19e){logger[_0x4a14('0x2c')](_0x5da19e[_0x4a14('0x2d')]);if(_0x5da19e[_0x4a14('0x2e')]){delete _0x5da19e['name'];}_0x2e330a[_0x4a14('0x1c')](_0x3f70a1)[_0x4a14('0x2f')](_0x5da19e);};}exports[_0x4a14('0x30')]=function(_0x53c46a,_0xe95413){var _0x326d83={},_0x588f20={},_0x4d22dc={'count':0x0,'rows':[]};var _0x2dfee3=_[_0x4a14('0x31')](db[_0x4a14('0x32')][_0x4a14('0x33')],function(_0x5065d8){return{'name':_0x5065d8['fieldName'],'type':_0x5065d8['type'][_0x4a14('0x34')]};});_0x588f20[_0x4a14('0x35')]=_[_0x4a14('0x31')](_0x2dfee3,_0x4a14('0x2e'));_0x588f20['query']=_[_0x4a14('0x36')](_0x53c46a[_0x4a14('0x37')]);_0x588f20[_0x4a14('0x38')]=_['intersection'](_0x588f20[_0x4a14('0x35')],_0x588f20['query']);_0x326d83[_0x4a14('0x39')]=_[_0x4a14('0x3a')](_0x588f20['model'],qs['fields'](_0x53c46a['query'][_0x4a14('0x3b')]));_0x326d83[_0x4a14('0x39')]=_0x326d83['attributes']['length']?_0x326d83[_0x4a14('0x39')]:_0x588f20['model'];if(!_0x53c46a[_0x4a14('0x37')][_0x4a14('0x3c')]('nolimit')){_0x326d83[_0x4a14('0x21')]=qs[_0x4a14('0x21')](_0x53c46a[_0x4a14('0x37')]['limit']);_0x326d83[_0x4a14('0x1e')]=qs['offset'](_0x53c46a['query'][_0x4a14('0x1e')]);}_0x326d83[_0x4a14('0x3d')]=qs['sort'](_0x53c46a[_0x4a14('0x37')][_0x4a14('0x3e')]);_0x326d83['where']=qs['filters'](_['pick'](_0x53c46a[_0x4a14('0x37')],_0x588f20[_0x4a14('0x38')]),_0x2dfee3);if(_0x53c46a[_0x4a14('0x37')][_0x4a14('0x3f')]){_0x326d83['where']=_['merge'](_0x326d83[_0x4a14('0x40')],{'$or':_['map'](_0x2dfee3,function(_0x42546a){if(_0x42546a[_0x4a14('0x41')]!=='VIRTUAL'){var _0x323c4f={};_0x323c4f[_0x42546a[_0x4a14('0x2e')]]={'$like':'%'+_0x53c46a[_0x4a14('0x37')][_0x4a14('0x3f')]+'%'};return _0x323c4f;}})});}_0x326d83=_[_0x4a14('0x42')]({},_0x326d83,_0x53c46a['options']);var _0x167096={'where':_0x326d83[_0x4a14('0x40')]};return db[_0x4a14('0x32')][_0x4a14('0x20')](_0x167096)[_0x4a14('0x27')](function(_0x33e5a7){_0x4d22dc[_0x4a14('0x20')]=_0x33e5a7;if(_0x53c46a[_0x4a14('0x37')]['includeAll']){_0x326d83['include']=[{'all':!![]}];}return db['CmContactHasItem'][_0x4a14('0x43')](_0x326d83);})[_0x4a14('0x27')](function(_0x14dc86){_0x4d22dc[_0x4a14('0x44')]=_0x14dc86;return _0x4d22dc;})[_0x4a14('0x27')](respondWithFilteredResult(_0xe95413,_0x326d83))[_0x4a14('0x45')](handleError(_0xe95413,null));};exports[_0x4a14('0x46')]=function(_0x21da90,_0x5d3b6d){var _0x902942={'raw':!![],'where':{'id':_0x21da90[_0x4a14('0x47')]['id']}},_0x143260={};_0x143260[_0x4a14('0x35')]=_[_0x4a14('0x36')](db[_0x4a14('0x32')][_0x4a14('0x33')]);_0x143260[_0x4a14('0x37')]=_[_0x4a14('0x36')](_0x21da90[_0x4a14('0x37')]);_0x143260[_0x4a14('0x38')]=_[_0x4a14('0x3a')](_0x143260[_0x4a14('0x35')],_0x143260['query']);_0x902942[_0x4a14('0x39')]=_[_0x4a14('0x3a')](_0x143260[_0x4a14('0x35')],qs[_0x4a14('0x3b')](_0x21da90[_0x4a14('0x37')][_0x4a14('0x3b')]));_0x902942[_0x4a14('0x39')]=_0x902942[_0x4a14('0x39')][_0x4a14('0x48')]?_0x902942['attributes']:_0x143260['model'];if(_0x21da90[_0x4a14('0x37')]['includeAll']){_0x902942[_0x4a14('0x49')]=[{'all':!![]}];}_0x902942=_[_0x4a14('0x42')]({},_0x902942,_0x21da90[_0x4a14('0x4a')]);return db[_0x4a14('0x32')]['find'](_0x902942)[_0x4a14('0x27')](handleEntityNotFound(_0x5d3b6d,null))[_0x4a14('0x27')](respondWithResult(_0x5d3b6d,null))[_0x4a14('0x45')](handleError(_0x5d3b6d,null));};exports[_0x4a14('0x4b')]=function(_0x3dd1bf,_0x1147e8){return db['CmContactHasItem'][_0x4a14('0x4b')](_0x3dd1bf['body'],{})[_0x4a14('0x27')](function(_0x54b895){var _0x576fab=_0x3dd1bf['user'][_0x4a14('0x29')]({'plain':!![]});if(!_0x576fab)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x576fab[_0x4a14('0x4c')]==='user'){var _0x309b4f=_0x54b895['get']({'plain':!![]});var _0x4cbc64=_0x4a14('0x2a');return db[_0x4a14('0x4d')]['find']({'where':{'name':_0x4cbc64,'userProfileId':_0x576fab[_0x4a14('0x4e')]},'raw':!![]})[_0x4a14('0x27')](function(_0x50f833){if(_0x50f833&&_0x50f833[_0x4a14('0x4f')]===0x0){return db[_0x4a14('0x2b')]['create']({'name':_0x309b4f[_0x4a14('0x2e')],'resourceId':_0x309b4f['id'],'type':_0x50f833[_0x4a14('0x2e')],'sectionId':_0x50f833['id']},{})['then'](function(){return _0x54b895;});}else{return _0x54b895;}})['catch'](function(_0x3dea60){logger[_0x4a14('0x2c')](_0x4a14('0x50'),_0x3dea60);throw _0x3dea60;});}return _0x54b895;})[_0x4a14('0x27')](respondWithResult(_0x1147e8,0xc9))['catch'](handleError(_0x1147e8,null));};exports['update']=function(_0x584f42,_0x52c026){if(_0x584f42[_0x4a14('0x51')]['id']){delete _0x584f42['body']['id'];}return db[_0x4a14('0x32')][_0x4a14('0x52')]({'where':{'id':_0x584f42[_0x4a14('0x47')]['id']}})[_0x4a14('0x27')](handleEntityNotFound(_0x52c026,null))[_0x4a14('0x27')](saveUpdates(_0x584f42[_0x4a14('0x51')],null))[_0x4a14('0x27')](respondWithResult(_0x52c026,null))[_0x4a14('0x45')](handleError(_0x52c026,null));};exports[_0x4a14('0x28')]=function(_0xdbbfe3,_0x36a9ae){return db[_0x4a14('0x32')][_0x4a14('0x52')]({'where':{'id':_0xdbbfe3[_0x4a14('0x47')]['id']}})[_0x4a14('0x27')](handleEntityNotFound(_0x36a9ae,null))['then'](removeEntity(_0x36a9ae,null))[_0x4a14('0x45')](handleError(_0x36a9ae,null));}; \ No newline at end of file +var _0x0fcb=['filters','model','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick','merge','filter','options','includeAll','include','findAll','rows','catch','show','params','create','body','user','role','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','path','sox','to-csv','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','apply','reject','then','destroy','get','UserProfileResource','error','stack','name','send','index','map','CmContactHasItem','rawAttributes','fieldName','type','key','query','keys'];(function(_0x3f1fb4,_0x1ada00){var _0x225401=function(_0xb0cf3c){while(--_0xb0cf3c){_0x3f1fb4['push'](_0x3f1fb4['shift']());}};_0x225401(++_0x1ada00);}(_0x0fcb,0xc0));var _0xb0fc=function(_0x3cbfa7,_0x270bd8){_0x3cbfa7=_0x3cbfa7-0x0;var _0x36a3a6=_0x0fcb[_0x3cbfa7];return _0x36a3a6;};'use strict';var emlformat=require(_0xb0fc('0x0'));var rimraf=require(_0xb0fc('0x1'));var zipdir=require(_0xb0fc('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb0fc('0x3'));var moment=require(_0xb0fc('0x4'));var BPromise=require(_0xb0fc('0x5'));var Mustache=require('mustache');var util=require(_0xb0fc('0x6'));var path=require(_0xb0fc('0x7'));var sox=require(_0xb0fc('0x8'));var csv=require(_0xb0fc('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb0fc('0xa'));var squel=require(_0xb0fc('0xb'));var crypto=require('crypto');var jsforce=require(_0xb0fc('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xb0fc('0x9'));var querystring=require(_0xb0fc('0xd'));var Papa=require(_0xb0fc('0xe'));var Redis=require(_0xb0fc('0xf'));var authService=require(_0xb0fc('0x10'));var qs=require(_0xb0fc('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xb0fc('0x12'))(_0xb0fc('0x13'));var utils=require(_0xb0fc('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xb0fc('0x15'));var db=require(_0xb0fc('0x16'))['db'];function respondWithStatusCode(_0x50f1be,_0x290d78){_0x290d78=_0x290d78||0xcc;return function(_0x1c3275){if(_0x1c3275){return _0x50f1be[_0xb0fc('0x17')](_0x290d78);}return _0x50f1be['status'](_0x290d78)[_0xb0fc('0x18')]();};}function respondWithResult(_0x18b3b7,_0x34551f){_0x34551f=_0x34551f||0xc8;return function(_0x1423a6){if(_0x1423a6){return _0x18b3b7[_0xb0fc('0x19')](_0x34551f)[_0xb0fc('0x1a')](_0x1423a6);}};}function respondWithFilteredResult(_0x587c86,_0x24ea9f){return function(_0x116181){if(_0x116181){var _0x1032a2=typeof _0x24ea9f[_0xb0fc('0x1b')]===_0xb0fc('0x1c')&&typeof _0x24ea9f[_0xb0fc('0x1d')]===_0xb0fc('0x1c');var _0x53ad95=_0x116181[_0xb0fc('0x1e')];var _0x2bc5fb=_0x1032a2?0x0:_0x24ea9f[_0xb0fc('0x1b')];var _0x12f927=_0x1032a2?_0x116181['count']:_0x24ea9f['offset']+_0x24ea9f[_0xb0fc('0x1d')];var _0x34bfa7;if(_0x12f927>=_0x53ad95){_0x12f927=_0x53ad95;_0x34bfa7=0xc8;}else{_0x34bfa7=0xce;}_0x587c86[_0xb0fc('0x19')](_0x34bfa7);return _0x587c86[_0xb0fc('0x1f')]('Content-Range',_0x2bc5fb+'-'+_0x12f927+'/'+_0x53ad95)[_0xb0fc('0x1a')](_0x116181);}return null;};}function patchUpdates(_0x239360){return function(_0x4149c9){try{jsonpatch[_0xb0fc('0x20')](_0x4149c9,_0x239360,!![]);}catch(_0x2c600f){return BPromise[_0xb0fc('0x21')](_0x2c600f);}return _0x4149c9['save']();};}function saveUpdates(_0x1711b5,_0x12ca25){return function(_0x550149){if(_0x550149){return _0x550149['update'](_0x1711b5)[_0xb0fc('0x22')](function(_0x349371){return _0x349371;});}return null;};}function removeEntity(_0x4bae9b,_0x484a65){return function(_0x1072fd){if(_0x1072fd){return _0x1072fd[_0xb0fc('0x23')]()['then'](function(){var _0x2ce05c=_0x1072fd[_0xb0fc('0x24')]({'plain':!![]});var _0x3862af='CmContactHasItems';return db[_0xb0fc('0x25')][_0xb0fc('0x23')]({'where':{'type':_0x3862af,'resourceId':_0x2ce05c['id']}})[_0xb0fc('0x22')](function(){return _0x1072fd;});})[_0xb0fc('0x22')](function(){_0x4bae9b[_0xb0fc('0x19')](0xcc)[_0xb0fc('0x18')]();});}};}function handleEntityNotFound(_0x2c3b9e,_0x187891){return function(_0x1f52a0){if(!_0x1f52a0){_0x2c3b9e[_0xb0fc('0x17')](0x194);}return _0x1f52a0;};}function handleError(_0x10c308,_0x398bdd){_0x398bdd=_0x398bdd||0x1f4;return function(_0x55dff1){logger[_0xb0fc('0x26')](_0x55dff1[_0xb0fc('0x27')]);if(_0x55dff1[_0xb0fc('0x28')]){delete _0x55dff1[_0xb0fc('0x28')];}_0x10c308[_0xb0fc('0x19')](_0x398bdd)[_0xb0fc('0x29')](_0x55dff1);};}exports[_0xb0fc('0x2a')]=function(_0x13af6f,_0x27b109){var _0x2dfb3f={},_0x2d7778={},_0x5d78bf={'count':0x0,'rows':[]};var _0x497dba=_[_0xb0fc('0x2b')](db[_0xb0fc('0x2c')][_0xb0fc('0x2d')],function(_0x557403){return{'name':_0x557403[_0xb0fc('0x2e')],'type':_0x557403[_0xb0fc('0x2f')][_0xb0fc('0x30')]};});_0x2d7778['model']=_[_0xb0fc('0x2b')](_0x497dba,_0xb0fc('0x28'));_0x2d7778[_0xb0fc('0x31')]=_[_0xb0fc('0x32')](_0x13af6f[_0xb0fc('0x31')]);_0x2d7778[_0xb0fc('0x33')]=_['intersection'](_0x2d7778[_0xb0fc('0x34')],_0x2d7778[_0xb0fc('0x31')]);_0x2dfb3f['attributes']=_[_0xb0fc('0x35')](_0x2d7778[_0xb0fc('0x34')],qs['fields'](_0x13af6f[_0xb0fc('0x31')][_0xb0fc('0x36')]));_0x2dfb3f[_0xb0fc('0x37')]=_0x2dfb3f['attributes'][_0xb0fc('0x38')]?_0x2dfb3f[_0xb0fc('0x37')]:_0x2d7778[_0xb0fc('0x34')];if(!_0x13af6f['query'][_0xb0fc('0x39')]('nolimit')){_0x2dfb3f[_0xb0fc('0x1d')]=qs[_0xb0fc('0x1d')](_0x13af6f[_0xb0fc('0x31')][_0xb0fc('0x1d')]);_0x2dfb3f[_0xb0fc('0x1b')]=qs[_0xb0fc('0x1b')](_0x13af6f['query']['offset']);}_0x2dfb3f[_0xb0fc('0x3a')]=qs[_0xb0fc('0x3b')](_0x13af6f[_0xb0fc('0x31')]['sort']);_0x2dfb3f[_0xb0fc('0x3c')]=qs[_0xb0fc('0x33')](_[_0xb0fc('0x3d')](_0x13af6f['query'],_0x2d7778['filters']),_0x497dba);if(_0x13af6f[_0xb0fc('0x31')]['filter']){_0x2dfb3f['where']=_[_0xb0fc('0x3e')](_0x2dfb3f[_0xb0fc('0x3c')],{'$or':_['map'](_0x497dba,function(_0x136f3a){if(_0x136f3a['type']!=='VIRTUAL'){var _0x5d1586={};_0x5d1586[_0x136f3a['name']]={'$like':'%'+_0x13af6f['query'][_0xb0fc('0x3f')]+'%'};return _0x5d1586;}})});}_0x2dfb3f=_['merge']({},_0x2dfb3f,_0x13af6f[_0xb0fc('0x40')]);var _0x4465d7={'where':_0x2dfb3f[_0xb0fc('0x3c')]};return db[_0xb0fc('0x2c')]['count'](_0x4465d7)['then'](function(_0x429134){_0x5d78bf['count']=_0x429134;if(_0x13af6f[_0xb0fc('0x31')][_0xb0fc('0x41')]){_0x2dfb3f[_0xb0fc('0x42')]=[{'all':!![]}];}return db[_0xb0fc('0x2c')][_0xb0fc('0x43')](_0x2dfb3f);})[_0xb0fc('0x22')](function(_0x28002e){_0x5d78bf[_0xb0fc('0x44')]=_0x28002e;return _0x5d78bf;})[_0xb0fc('0x22')](respondWithFilteredResult(_0x27b109,_0x2dfb3f))[_0xb0fc('0x45')](handleError(_0x27b109,null));};exports[_0xb0fc('0x46')]=function(_0x5008e4,_0xefe0bc){var _0x29cc94={'raw':!![],'where':{'id':_0x5008e4[_0xb0fc('0x47')]['id']}},_0x378da0={};_0x378da0[_0xb0fc('0x34')]=_[_0xb0fc('0x32')](db[_0xb0fc('0x2c')][_0xb0fc('0x2d')]);_0x378da0[_0xb0fc('0x31')]=_[_0xb0fc('0x32')](_0x5008e4[_0xb0fc('0x31')]);_0x378da0[_0xb0fc('0x33')]=_[_0xb0fc('0x35')](_0x378da0[_0xb0fc('0x34')],_0x378da0['query']);_0x29cc94[_0xb0fc('0x37')]=_[_0xb0fc('0x35')](_0x378da0[_0xb0fc('0x34')],qs['fields'](_0x5008e4['query'][_0xb0fc('0x36')]));_0x29cc94[_0xb0fc('0x37')]=_0x29cc94['attributes'][_0xb0fc('0x38')]?_0x29cc94[_0xb0fc('0x37')]:_0x378da0['model'];if(_0x5008e4[_0xb0fc('0x31')][_0xb0fc('0x41')]){_0x29cc94[_0xb0fc('0x42')]=[{'all':!![]}];}_0x29cc94=_[_0xb0fc('0x3e')]({},_0x29cc94,_0x5008e4[_0xb0fc('0x40')]);return db[_0xb0fc('0x2c')]['find'](_0x29cc94)[_0xb0fc('0x22')](handleEntityNotFound(_0xefe0bc,null))[_0xb0fc('0x22')](respondWithResult(_0xefe0bc,null))[_0xb0fc('0x45')](handleError(_0xefe0bc,null));};exports[_0xb0fc('0x48')]=function(_0x24ddf7,_0x1d1cf4){return db[_0xb0fc('0x2c')][_0xb0fc('0x48')](_0x24ddf7[_0xb0fc('0x49')],{})[_0xb0fc('0x22')](function(_0x312f92){var _0x329018=_0x24ddf7[_0xb0fc('0x4a')][_0xb0fc('0x24')]({'plain':!![]});if(!_0x329018)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x329018[_0xb0fc('0x4b')]===_0xb0fc('0x4a')){var _0x280815=_0x312f92[_0xb0fc('0x24')]({'plain':!![]});var _0x39339e='CmContactHasItems';return db[_0xb0fc('0x4c')][_0xb0fc('0x4d')]({'where':{'name':_0x39339e,'userProfileId':_0x329018[_0xb0fc('0x4e')]},'raw':!![]})[_0xb0fc('0x22')](function(_0x16e5c3){if(_0x16e5c3&&_0x16e5c3[_0xb0fc('0x4f')]===0x0){return db[_0xb0fc('0x25')][_0xb0fc('0x48')]({'name':_0x280815[_0xb0fc('0x28')],'resourceId':_0x280815['id'],'type':_0x16e5c3[_0xb0fc('0x28')],'sectionId':_0x16e5c3['id']},{})[_0xb0fc('0x22')](function(){return _0x312f92;});}else{return _0x312f92;}})['catch'](function(_0x50859e){logger[_0xb0fc('0x26')](_0xb0fc('0x50'),_0x50859e);throw _0x50859e;});}return _0x312f92;})['then'](respondWithResult(_0x1d1cf4,0xc9))[_0xb0fc('0x45')](handleError(_0x1d1cf4,null));};exports['update']=function(_0x7ee526,_0x468dc5){if(_0x7ee526[_0xb0fc('0x49')]['id']){delete _0x7ee526['body']['id'];}return db[_0xb0fc('0x2c')]['find']({'where':{'id':_0x7ee526[_0xb0fc('0x47')]['id']}})[_0xb0fc('0x22')](handleEntityNotFound(_0x468dc5,null))[_0xb0fc('0x22')](saveUpdates(_0x7ee526[_0xb0fc('0x49')],null))[_0xb0fc('0x22')](respondWithResult(_0x468dc5,null))['catch'](handleError(_0x468dc5,null));};exports[_0xb0fc('0x23')]=function(_0x477321,_0x19e8b5){return db[_0xb0fc('0x2c')][_0xb0fc('0x4d')]({'where':{'id':_0x477321['params']['id']}})[_0xb0fc('0x22')](handleEntityNotFound(_0x19e8b5,null))['then'](removeEntity(_0x19e8b5,null))[_0xb0fc('0x45')](handleError(_0x19e8b5,null));}; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.model.js b/server/api/cmContactHasItem/cmContactHasItem.model.js index 5a54376..bc33358 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 _0x1152=['util','../../config/logger','api','moment','bluebird','request-promise','path','./cmContactHasItem.attributes','exports','define','CmContactHasItem','cm_contact_has_items','lodash'];(function(_0x482f86,_0x510f24){var _0x1a18cf=function(_0x3a2893){while(--_0x3a2893){_0x482f86['push'](_0x482f86['shift']());}};_0x1a18cf(++_0x510f24);}(_0x1152,0x144));var _0x2115=function(_0x539533,_0x59b89b){_0x539533=_0x539533-0x0;var _0x3942f3=_0x1152[_0x539533];return _0x3942f3;};'use strict';var _=require(_0x2115('0x0'));var util=require(_0x2115('0x1'));var logger=require(_0x2115('0x2'))(_0x2115('0x3'));var moment=require(_0x2115('0x4'));var BPromise=require(_0x2115('0x5'));var rp=require(_0x2115('0x6'));var fs=require('fs');var path=require(_0x2115('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x2115('0x8'));module[_0x2115('0x9')]=function(_0x31ca15,_0x5a968d){return _0x31ca15[_0x2115('0xa')](_0x2115('0xb'),attributes,{'tableName':_0x2115('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9ef5=['../../config/environment','exports','define','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x7b97e3,_0x107837){var _0x1d90e0=function(_0x5c2a19){while(--_0x5c2a19){_0x7b97e3['push'](_0x7b97e3['shift']());}};_0x1d90e0(++_0x107837);}(_0x9ef5,0x1a7));var _0x59ef=function(_0x81dcac,_0x8ff7db){_0x81dcac=_0x81dcac-0x0;var _0xc7803b=_0x9ef5[_0x81dcac];return _0xc7803b;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x59ef('0x0'))(_0x59ef('0x1'));var moment=require(_0x59ef('0x2'));var BPromise=require(_0x59ef('0x3'));var rp=require(_0x59ef('0x4'));var fs=require('fs');var path=require(_0x59ef('0x5'));var rimraf=require(_0x59ef('0x6'));var config=require(_0x59ef('0x7'));var attributes=require('./cmContactHasItem.attributes');module[_0x59ef('0x8')]=function(_0x4a8b7f,_0x4a9e40){return _0x4a8b7f[_0x59ef('0x9')]('CmContactHasItem',attributes,{'tableName':'cm_contact_has_items','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.rpc.js b/server/api/cmContactHasItem/cmContactHasItem.rpc.js index b98e337..f7672a0 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 _0xae0d=['result','catch','lodash','util','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','CmContactHasItem,\x20%s,\x20%s','request\x20sent','debug','CmContactHasItem,\x20%s,\x20%s,\x20%s','error','message'];(function(_0x539fb2,_0x5b6718){var _0x4d583d=function(_0x55fa69){while(--_0x55fa69){_0x539fb2['push'](_0x539fb2['shift']());}};_0x4d583d(++_0x5b6718);}(_0xae0d,0x1e6));var _0xdae0=function(_0x21aa44,_0x3919ce){_0x21aa44=_0x21aa44-0x0;var _0xd6207=_0xae0d[_0x21aa44];return _0xd6207;};'use strict';var _=require(_0xdae0('0x0'));var util=require(_0xdae0('0x1'));var moment=require('moment');var BPromise=require(_0xdae0('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xdae0('0x3'))['db'];var utils=require(_0xdae0('0x4'));var logger=require(_0xdae0('0x5'))(_0xdae0('0x6'));var config=require(_0xdae0('0x7'));var jayson=require(_0xdae0('0x8'));var client=jayson[_0xdae0('0x9')][_0xdae0('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5128ff,_0x20c3fb,_0x4cb347){return new BPromise(function(_0x72bfa8,_0x33027a){return client[_0xdae0('0xb')](_0x5128ff,_0x4cb347)[_0xdae0('0xc')](function(_0x2a6542){logger[_0xdae0('0xd')](_0xdae0('0xe'),_0x20c3fb,_0xdae0('0xf'));logger[_0xdae0('0x10')](_0xdae0('0x11'),_0x20c3fb,'request\x20sent',JSON['stringify'](_0x2a6542));if(_0x2a6542[_0xdae0('0x12')]){if(_0x2a6542[_0xdae0('0x12')]['code']===0x1f4){logger[_0xdae0('0x12')](_0xdae0('0xe'),_0x20c3fb,_0x2a6542['error'][_0xdae0('0x13')]);return _0x33027a(_0x2a6542[_0xdae0('0x12')][_0xdae0('0x13')]);}logger[_0xdae0('0x12')](_0xdae0('0xe'),_0x20c3fb,_0x2a6542[_0xdae0('0x12')][_0xdae0('0x13')]);return _0x72bfa8(_0x2a6542[_0xdae0('0x12')][_0xdae0('0x13')]);}else{logger[_0xdae0('0xd')](_0xdae0('0xe'),_0x20c3fb,_0xdae0('0xf'));_0x72bfa8(_0x2a6542[_0xdae0('0x14')]['message']);}})[_0xdae0('0x15')](function(_0x3f0d92){logger['error'](_0xdae0('0xe'),_0x20c3fb,_0x3f0d92);_0x33027a(_0x3f0d92);});});} \ No newline at end of file +var _0x8b28=['CmContactHasItem,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','util','moment','bluebird','randomstring','../../config/utils','../../config/environment','client','http','request','CmContactHasItem,\x20%s,\x20%s','request\x20sent','debug'];(function(_0xd1045f,_0x2b6531){var _0x1a9dd2=function(_0x55b26e){while(--_0x55b26e){_0xd1045f['push'](_0xd1045f['shift']());}};_0x1a9dd2(++_0x2b6531);}(_0x8b28,0xde));var _0x88b2=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x8b28[_0x20a584];return _0x4b41a8;};'use strict';var _=require('lodash');var util=require(_0x88b2('0x0'));var moment=require(_0x88b2('0x1'));var BPromise=require(_0x88b2('0x2'));var rs=require(_0x88b2('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x88b2('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0x88b2('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x88b2('0x6')][_0x88b2('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x26d47c,_0x386c1f,_0x24f88b){return new BPromise(function(_0x375bb5,_0x5cfd3d){return client[_0x88b2('0x8')](_0x26d47c,_0x24f88b)['then'](function(_0x118097){logger['info'](_0x88b2('0x9'),_0x386c1f,_0x88b2('0xa'));logger[_0x88b2('0xb')](_0x88b2('0xc'),_0x386c1f,_0x88b2('0xa'),JSON['stringify'](_0x118097));if(_0x118097[_0x88b2('0xd')]){if(_0x118097[_0x88b2('0xd')][_0x88b2('0xe')]===0x1f4){logger[_0x88b2('0xd')](_0x88b2('0x9'),_0x386c1f,_0x118097[_0x88b2('0xd')][_0x88b2('0xf')]);return _0x5cfd3d(_0x118097['error'][_0x88b2('0xf')]);}logger[_0x88b2('0xd')](_0x88b2('0x9'),_0x386c1f,_0x118097[_0x88b2('0xd')][_0x88b2('0xf')]);return _0x375bb5(_0x118097[_0x88b2('0xd')]['message']);}else{logger['info'](_0x88b2('0x9'),_0x386c1f,'request\x20sent');_0x375bb5(_0x118097[_0x88b2('0x10')][_0x88b2('0xf')]);}})[_0x88b2('0x11')](function(_0x326560){logger[_0x88b2('0xd')](_0x88b2('0x9'),_0x386c1f,_0x326560);_0x5cfd3d(_0x326560);});});} \ No newline at end of file diff --git a/server/api/cmContactHasItem/index.js b/server/api/cmContactHasItem/index.js index 6a888c2..781d724 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 _0x81e8=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','show','post','isAuthenticated','create','/:id','update','delete','destroy','exports','path'];(function(_0x5b077b,_0x50b707){var _0x16faf7=function(_0x41ba83){while(--_0x41ba83){_0x5b077b['push'](_0x5b077b['shift']());}};_0x16faf7(++_0x50b707);}(_0x81e8,0x1db));var _0x881e=function(_0x55f3c2,_0x335b79){_0x55f3c2=_0x55f3c2-0x0;var _0x4df8bb=_0x81e8[_0x55f3c2];return _0x4df8bb;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x881e('0x0'));var timeout=require(_0x881e('0x1'));var express=require(_0x881e('0x2'));var router=express[_0x881e('0x3')]();var fs_extra=require(_0x881e('0x4'));var auth=require(_0x881e('0x5'));var interaction=require(_0x881e('0x6'));var config=require('../../config/environment');var controller=require('./cmContactHasItem.controller');router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x881e('0x7')]('/:id',auth['isAuthenticated'](),controller[_0x881e('0x8')]);router[_0x881e('0x9')]('/',auth[_0x881e('0xa')](),controller[_0x881e('0xb')]);router['put'](_0x881e('0xc'),auth[_0x881e('0xa')](),controller[_0x881e('0xd')]);router[_0x881e('0xe')](_0x881e('0xc'),auth[_0x881e('0xa')](),controller[_0x881e('0xf')]);module[_0x881e('0x10')]=router; \ No newline at end of file +var _0xc82f=['path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./cmContactHasItem.controller','get','isAuthenticated','index','/:id','show','post','create','put','delete','exports','multer','util'];(function(_0x5da875,_0x475a8b){var _0x25d687=function(_0xb8a423){while(--_0xb8a423){_0x5da875['push'](_0x5da875['shift']());}};_0x25d687(++_0x475a8b);}(_0xc82f,0x18d));var _0xfc82=function(_0x5f063e,_0x369330){_0x5f063e=_0x5f063e-0x0;var _0x2c9bae=_0xc82f[_0x5f063e];return _0x2c9bae;};'use strict';var multer=require(_0xfc82('0x0'));var util=require(_0xfc82('0x1'));var path=require(_0xfc82('0x2'));var timeout=require(_0xfc82('0x3'));var express=require(_0xfc82('0x4'));var router=express['Router']();var fs_extra=require(_0xfc82('0x5'));var auth=require(_0xfc82('0x6'));var interaction=require(_0xfc82('0x7'));var config=require('../../config/environment');var controller=require(_0xfc82('0x8'));router[_0xfc82('0x9')]('/',auth[_0xfc82('0xa')](),controller[_0xfc82('0xb')]);router[_0xfc82('0x9')](_0xfc82('0xc'),auth[_0xfc82('0xa')](),controller[_0xfc82('0xd')]);router[_0xfc82('0xe')]('/',auth[_0xfc82('0xa')](),controller[_0xfc82('0xf')]);router[_0xfc82('0x10')](_0xfc82('0xc'),auth['isAuthenticated'](),controller['update']);router[_0xfc82('0x11')]('/:id',auth[_0xfc82('0xa')](),controller['destroy']);module[_0xfc82('0x12')]=router; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.attributes.js b/server/api/cmCustomField/cmCustomField.attributes.js index cc62ebf..a2d1acf 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 _0xd665=['type','select','values','isArray','stringify','BOOLEAN','ENUM','voice','VIRTUAL','getDataValue','alias','STRING','name','TEXT','long'];(function(_0x2aadc8,_0x34947e){var _0x35c190=function(_0x539803){while(--_0x539803){_0x2aadc8['push'](_0x2aadc8['shift']());}};_0x35c190(++_0x34947e);}(_0xd665,0xcb));var _0x5d66=function(_0x5bd53e,_0x150a13){_0x5bd53e=_0x5bd53e-0x0;var _0x347e75=_0xd665[_0x5bd53e];return _0x347e75;};'use strict';var Sequelize=require('sequelize');var _=require('lodash');module['exports']={'name':{'type':Sequelize[_0x5d66('0x0')],'get':function(_0x58c928){return this[_0x5d66('0x1')](_0x5d66('0x2'));}},'alias':{'type':Sequelize[_0x5d66('0x3')],'allowNull':![],'set':function(_0x1e7638){this['setDataValue']('alias',_0x1e7638?_0x1e7638:this[_0x5d66('0x1')](_0x5d66('0x4')));}},'type':{'type':Sequelize[_0x5d66('0x3')],'allowNull':![]},'values':{'type':Sequelize[_0x5d66('0x5')](_0x5d66('0x6')),'get':function(){if(this[_0x5d66('0x1')](_0x5d66('0x7'))===_0x5d66('0x8')){return JSON['parse'](this[_0x5d66('0x1')]('values'));}else{return this[_0x5d66('0x1')](_0x5d66('0x9'));}},'set':function(_0x3fba82){if(Array[_0x5d66('0xa')](_0x3fba82)){this['setDataValue'](_0x5d66('0x9'),JSON[_0x5d66('0xb')](_0x3fba82));}else{this['setDataValue']('values',_0x3fba82);}}},'required':{'type':Sequelize[_0x5d66('0xc')],'defaultValue':![]},'clickToAction':{'type':Sequelize[_0x5d66('0xc')],'defaultValue':![]},'actionType':{'type':Sequelize[_0x5d66('0xd')](_0x5d66('0xe'))}}; \ No newline at end of file +var _0xf557=['lodash','exports','alias','getDataValue','name','STRING','TEXT','long','type','select','parse','values','isArray','setDataValue','stringify','BOOLEAN','ENUM','voice','sequelize'];(function(_0x279824,_0x31226e){var _0x389429=function(_0x491aa3){while(--_0x491aa3){_0x279824['push'](_0x279824['shift']());}};_0x389429(++_0x31226e);}(_0xf557,0x1da));var _0x7f55=function(_0xeac991,_0xbdeb9a){_0xeac991=_0xeac991-0x0;var _0x1491a8=_0xf557[_0xeac991];return _0x1491a8;};'use strict';var Sequelize=require(_0x7f55('0x0'));var _=require(_0x7f55('0x1'));module[_0x7f55('0x2')]={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x4ea366){return this['getDataValue'](_0x7f55('0x3'));}},'alias':{'type':Sequelize['STRING'],'allowNull':![],'set':function(_0x498887){this['setDataValue']('alias',_0x498887?_0x498887:this[_0x7f55('0x4')](_0x7f55('0x5')));}},'type':{'type':Sequelize[_0x7f55('0x6')],'allowNull':![]},'values':{'type':Sequelize[_0x7f55('0x7')](_0x7f55('0x8')),'get':function(){if(this['getDataValue'](_0x7f55('0x9'))===_0x7f55('0xa')){return JSON[_0x7f55('0xb')](this[_0x7f55('0x4')](_0x7f55('0xc')));}else{return this[_0x7f55('0x4')](_0x7f55('0xc'));}},'set':function(_0x5ad222){if(Array[_0x7f55('0xd')](_0x5ad222)){this[_0x7f55('0xe')](_0x7f55('0xc'),JSON[_0x7f55('0xf')](_0x5ad222));}else{this['setDataValue'](_0x7f55('0xc'),_0x5ad222);}}},'required':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'clickToAction':{'type':Sequelize[_0x7f55('0x10')],'defaultValue':![]},'actionType':{'type':Sequelize[_0x7f55('0x11')](_0x7f55('0x12'))}}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.controller.js b/server/api/cmCustomField/cmCustomField.controller.js index 77172db..38bafe2 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 _0x988e=['limit','count','offset','set','Content-Range','apply','reject','update','then','error','name','index','map','CmCustomField','rawAttributes','fieldName','type','key','model','differenceBy','query','keys','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filters','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','show','params','find','catch','body','destroy','create','sequelize','transaction','Sequelize','TEXT','text','number','INTEGER','switch','BOOLEAN','defaultValue','addColumn','cm_contacts','cf_%d','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','end','json','undefined'];(function(_0x2ff4bd,_0x4780a6){var _0x28edc6=function(_0x792380){while(--_0x792380){_0x2ff4bd['push'](_0x2ff4bd['shift']());}};_0x28edc6(++_0x4780a6);}(_0x988e,0x140));var _0xe988=function(_0x5b1ed7,_0x3f6e00){_0x5b1ed7=_0x5b1ed7-0x0;var _0xf4852=_0x988e[_0x5b1ed7];return _0xf4852;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe988('0x0'));var zipdir=require(_0xe988('0x1'));var jsonpatch=require(_0xe988('0x2'));var rp=require('request-promise');var moment=require(_0xe988('0x3'));var BPromise=require(_0xe988('0x4'));var Mustache=require(_0xe988('0x5'));var util=require(_0xe988('0x6'));var path=require(_0xe988('0x7'));var sox=require('sox');var csv=require(_0xe988('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xe988('0x9'));var squel=require(_0xe988('0xa'));var crypto=require(_0xe988('0xb'));var jsforce=require(_0xe988('0xc'));var deskjs=require(_0xe988('0xd'));var toCsv=require(_0xe988('0x8'));var querystring=require(_0xe988('0xe'));var Papa=require(_0xe988('0xf'));var Redis=require(_0xe988('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xe988('0x11'));var hardwareService=require(_0xe988('0x12'));var logger=require(_0xe988('0x13'))(_0xe988('0x14'));var utils=require(_0xe988('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xe988('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x108fc6,_0x1af45d){_0x1af45d=_0x1af45d||0xcc;return function(_0x505114){if(_0x505114){return _0x108fc6[_0xe988('0x17')](_0x1af45d);}return _0x108fc6[_0xe988('0x18')](_0x1af45d)[_0xe988('0x19')]();};}function respondWithResult(_0x5513ba,_0x3ad25e){_0x3ad25e=_0x3ad25e||0xc8;return function(_0x33065b){if(_0x33065b){return _0x5513ba[_0xe988('0x18')](_0x3ad25e)[_0xe988('0x1a')](_0x33065b);}};}function respondWithFilteredResult(_0x3e20fe,_0x5b37f9){return function(_0x118f24){if(_0x118f24){var _0x1c102b=typeof _0x5b37f9['offset']===_0xe988('0x1b')&&typeof _0x5b37f9[_0xe988('0x1c')]===_0xe988('0x1b');var _0x29f2bd=_0x118f24[_0xe988('0x1d')];var _0x1e3d42=_0x1c102b?0x0:_0x5b37f9[_0xe988('0x1e')];var _0x5c64b3=_0x1c102b?_0x118f24[_0xe988('0x1d')]:_0x5b37f9['offset']+_0x5b37f9[_0xe988('0x1c')];var _0x743f8b;if(_0x5c64b3>=_0x29f2bd){_0x5c64b3=_0x29f2bd;_0x743f8b=0xc8;}else{_0x743f8b=0xce;}_0x3e20fe[_0xe988('0x18')](_0x743f8b);return _0x3e20fe[_0xe988('0x1f')](_0xe988('0x20'),_0x1e3d42+'-'+_0x5c64b3+'/'+_0x29f2bd)[_0xe988('0x1a')](_0x118f24);}return null;};}function patchUpdates(_0x590faa){return function(_0x36e915){try{jsonpatch[_0xe988('0x21')](_0x36e915,_0x590faa,!![]);}catch(_0x24c958){return BPromise[_0xe988('0x22')](_0x24c958);}return _0x36e915['save']();};}function saveUpdates(_0x160c69,_0x59bee4){return function(_0x3f17cb){if(_0x3f17cb){return _0x3f17cb[_0xe988('0x23')](_0x160c69)[_0xe988('0x24')](function(_0x2587a3){return _0x2587a3;});}return null;};}function removeEntity(_0x3b8c3c,_0x183c96){return function(_0x4988f2){if(_0x4988f2){return _0x4988f2['destroy']()['then'](function(){_0x3b8c3c[_0xe988('0x18')](0xcc)[_0xe988('0x19')]();});}};}function handleEntityNotFound(_0x41fb09,_0x3c69ea){return function(_0x4d5bbc){if(!_0x4d5bbc){_0x41fb09[_0xe988('0x17')](0x194);}return _0x4d5bbc;};}function handleError(_0x1a104c,_0x1684bc){_0x1684bc=_0x1684bc||0x1f4;return function(_0x2cf645){logger[_0xe988('0x25')](_0x2cf645['stack']);if(_0x2cf645[_0xe988('0x26')]){delete _0x2cf645['name'];}_0x1a104c[_0xe988('0x18')](_0x1684bc)['send'](_0x2cf645);};}exports[_0xe988('0x27')]=function(_0x2cad04,_0x87c2cb){var _0x590835={},_0x29d9eb={},_0xad8908={'count':0x0,'rows':[]};var _0x5b615a=_[_0xe988('0x28')](db[_0xe988('0x29')][_0xe988('0x2a')],function(_0x49985c){return{'name':_0x49985c[_0xe988('0x2b')],'type':_0x49985c[_0xe988('0x2c')][_0xe988('0x2d')]};});_0x29d9eb[_0xe988('0x2e')]=_[_0xe988('0x2f')](_[_0xe988('0x28')](_0x5b615a,_0xe988('0x26')),[_0xe988('0x26')]);_0x29d9eb[_0xe988('0x30')]=_[_0xe988('0x31')](_0x2cad04[_0xe988('0x30')]);_0x29d9eb['filters']=_[_0xe988('0x32')](_0x29d9eb['model'],_0x29d9eb[_0xe988('0x30')]);_0x590835[_0xe988('0x33')]=_[_0xe988('0x32')](_0x29d9eb[_0xe988('0x2e')],qs[_0xe988('0x34')](_0x2cad04[_0xe988('0x30')][_0xe988('0x34')]));_0x590835[_0xe988('0x33')]=_0x590835[_0xe988('0x33')][_0xe988('0x35')]?_0x590835['attributes']:_0x29d9eb['model'];if(!_0x2cad04[_0xe988('0x30')][_0xe988('0x36')]('nolimit')){_0x590835['limit']=qs[_0xe988('0x1c')](_0x2cad04[_0xe988('0x30')]['limit']);_0x590835[_0xe988('0x1e')]=qs[_0xe988('0x1e')](_0x2cad04[_0xe988('0x30')][_0xe988('0x1e')]);}_0x590835[_0xe988('0x37')]=qs['sort'](_0x2cad04[_0xe988('0x30')][_0xe988('0x38')]);_0x590835[_0xe988('0x39')]=qs[_0xe988('0x3a')](_[_0xe988('0x3b')](_0x2cad04[_0xe988('0x30')],_0x29d9eb[_0xe988('0x3a')]),_0x5b615a);if(_0x2cad04[_0xe988('0x30')][_0xe988('0x3c')]){_0x590835[_0xe988('0x39')]=_['merge'](_0x590835[_0xe988('0x39')],{'$or':_[_0xe988('0x28')](_0x5b615a,function(_0x363fc1){if(_0x363fc1[_0xe988('0x2c')]!==_0xe988('0x3d')){var _0x22aa21={};_0x22aa21[_0x363fc1[_0xe988('0x26')]]={'$like':'%'+_0x2cad04[_0xe988('0x30')][_0xe988('0x3c')]+'%'};return _0x22aa21;}})});}_0x590835=_[_0xe988('0x3e')]({},_0x590835,_0x2cad04[_0xe988('0x3f')]);var _0x52b610={'where':_0x590835[_0xe988('0x39')]};return db['CmCustomField'][_0xe988('0x1d')](_0x52b610)[_0xe988('0x24')](function(_0x2cc491){_0xad8908[_0xe988('0x1d')]=_0x2cc491;if(_0x2cad04[_0xe988('0x30')][_0xe988('0x40')]){_0x590835[_0xe988('0x41')]=[{'all':!![]}];}return db[_0xe988('0x29')][_0xe988('0x42')](_0x590835);})['then'](function(_0x2194e0){_0xad8908['rows']=_0x2194e0;return _0xad8908;})[_0xe988('0x24')](respondWithFilteredResult(_0x87c2cb,_0x590835))['catch'](handleError(_0x87c2cb,null));};exports[_0xe988('0x43')]=function(_0x13e4de,_0x67e901){var _0x890fe7={'raw':!![],'where':{'id':_0x13e4de[_0xe988('0x44')]['id']}},_0x5d0186={};_0x5d0186[_0xe988('0x2e')]=_[_0xe988('0x31')](db['CmCustomField']['rawAttributes']);_0x5d0186[_0xe988('0x30')]=_['keys'](_0x13e4de[_0xe988('0x30')]);_0x5d0186[_0xe988('0x3a')]=_[_0xe988('0x32')](_0x5d0186['model'],_0x5d0186[_0xe988('0x30')]);_0x890fe7[_0xe988('0x33')]=_['intersection'](_0x5d0186[_0xe988('0x2e')],qs[_0xe988('0x34')](_0x13e4de[_0xe988('0x30')][_0xe988('0x34')]));_0x890fe7[_0xe988('0x33')]=_0x890fe7[_0xe988('0x33')][_0xe988('0x35')]?_0x890fe7[_0xe988('0x33')]:_0x5d0186['model'];if(_0x13e4de[_0xe988('0x30')][_0xe988('0x40')]){_0x890fe7[_0xe988('0x41')]=[{'all':!![]}];}_0x890fe7=_['merge']({},_0x890fe7,_0x13e4de[_0xe988('0x3f')]);return db[_0xe988('0x29')][_0xe988('0x45')](_0x890fe7)[_0xe988('0x24')](handleEntityNotFound(_0x67e901,null))[_0xe988('0x24')](respondWithResult(_0x67e901,null))[_0xe988('0x46')](handleError(_0x67e901,null));};exports['update']=function(_0xe267f2,_0x1a2e55){if(_0xe267f2[_0xe988('0x47')]['id']){delete _0xe267f2['body']['id'];}return db[_0xe988('0x29')][_0xe988('0x45')]({'where':{'id':_0xe267f2[_0xe988('0x44')]['id']}})[_0xe988('0x24')](handleEntityNotFound(_0x1a2e55,null))[_0xe988('0x24')](saveUpdates(_0xe267f2[_0xe988('0x47')],null))[_0xe988('0x24')](respondWithResult(_0x1a2e55,null))[_0xe988('0x46')](handleError(_0x1a2e55,null));};exports[_0xe988('0x48')]=function(_0x36be91,_0x5bd1e7){return db[_0xe988('0x29')][_0xe988('0x45')]({'where':{'id':_0x36be91[_0xe988('0x44')]['id']}})['then'](handleEntityNotFound(_0x5bd1e7,null))[_0xe988('0x24')](removeEntity(_0x5bd1e7,null))['catch'](handleError(_0x5bd1e7,null));};exports[_0xe988('0x49')]=function(_0x573cea,_0x1cae05){var _0x205a40;return db[_0xe988('0x4a')][_0xe988('0x4b')](function(_0x42a7bb){return db[_0xe988('0x29')][_0xe988('0x49')](_0x573cea[_0xe988('0x47')],{'transaction':_0x42a7bb})[_0xe988('0x24')](function(_0x4706cc){_0x205a40=_0x4706cc;var _0x10ab03={'type':db[_0xe988('0x4c')][_0xe988('0x4d')],'transaction':_0x42a7bb};switch(_0x573cea[_0xe988('0x47')][_0xe988('0x2c')]){case _0xe988('0x4e'):_0x10ab03[_0xe988('0x2c')]=db[_0xe988('0x4c')]['TEXT'];break;case _0xe988('0x4f'):_0x10ab03['type']=db['Sequelize'][_0xe988('0x50')];break;case _0xe988('0x51'):_0x10ab03[_0xe988('0x2c')]=db[_0xe988('0x4c')][_0xe988('0x52')];_0x10ab03[_0xe988('0x53')]=![];break;default:}return db[_0xe988('0x4a')]['queryInterface'][_0xe988('0x54')](_0xe988('0x55'),util['format'](_0xe988('0x56'),_0x205a40['id']),_0x10ab03);})['then'](function(){return _0x205a40;});})[_0xe988('0x24')](respondWithResult(_0x1cae05,0xc9))[_0xe988('0x46')](handleError(_0x1cae05,null));}; \ No newline at end of file +var _0x3d70=['sendStatus','status','end','json','offset','limit','count','set','Content-Range','apply','then','destroy','error','stack','name','send','map','CmCustomField','rawAttributes','fieldName','type','model','differenceBy','query','intersection','fields','attributes','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','include','findAll','rows','catch','show','params','keys','length','includeAll','options','find','update','body','create','sequelize','transaction','Sequelize','text','TEXT','INTEGER','switch','BOOLEAN','queryInterface','cm_contacts','format','cf_%d','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','path','to-csv','fs-extra','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(_0x357386,_0x40d104){var _0x3a7fa3=function(_0xe15dd6){while(--_0xe15dd6){_0x357386['push'](_0x357386['shift']());}};_0x3a7fa3(++_0x40d104);}(_0x3d70,0x13d));var _0x03d7=function(_0x13524d,_0x505b49){_0x13524d=_0x13524d-0x0;var _0x9918b4=_0x3d70[_0x13524d];return _0x9918b4;};'use strict';var emlformat=require(_0x03d7('0x0'));var rimraf=require(_0x03d7('0x1'));var zipdir=require(_0x03d7('0x2'));var jsonpatch=require(_0x03d7('0x3'));var rp=require(_0x03d7('0x4'));var moment=require(_0x03d7('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x03d7('0x6'));var sox=require('sox');var csv=require(_0x03d7('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x03d7('0x8'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x03d7('0x9'));var deskjs=require(_0x03d7('0xa'));var toCsv=require(_0x03d7('0x7'));var querystring=require(_0x03d7('0xb'));var Papa=require(_0x03d7('0xc'));var Redis=require(_0x03d7('0xd'));var authService=require(_0x03d7('0xe'));var qs=require(_0x03d7('0xf'));var as=require(_0x03d7('0x10'));var hardwareService=require(_0x03d7('0x11'));var logger=require(_0x03d7('0x12'))(_0x03d7('0x13'));var utils=require(_0x03d7('0x14'));var config=require(_0x03d7('0x15'));var licenseUtil=require(_0x03d7('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x548386,_0x3cccfc){_0x3cccfc=_0x3cccfc||0xcc;return function(_0x5140a3){if(_0x5140a3){return _0x548386[_0x03d7('0x17')](_0x3cccfc);}return _0x548386[_0x03d7('0x18')](_0x3cccfc)[_0x03d7('0x19')]();};}function respondWithResult(_0x4ded2e,_0x45212c){_0x45212c=_0x45212c||0xc8;return function(_0x17f0a5){if(_0x17f0a5){return _0x4ded2e[_0x03d7('0x18')](_0x45212c)[_0x03d7('0x1a')](_0x17f0a5);}};}function respondWithFilteredResult(_0x3c6adb,_0x30f138){return function(_0xab86b){if(_0xab86b){var _0x489b66=typeof _0x30f138[_0x03d7('0x1b')]==='undefined'&&typeof _0x30f138[_0x03d7('0x1c')]==='undefined';var _0x53d2ef=_0xab86b['count'];var _0x507568=_0x489b66?0x0:_0x30f138[_0x03d7('0x1b')];var _0x920293=_0x489b66?_0xab86b[_0x03d7('0x1d')]:_0x30f138[_0x03d7('0x1b')]+_0x30f138[_0x03d7('0x1c')];var _0x54c92f;if(_0x920293>=_0x53d2ef){_0x920293=_0x53d2ef;_0x54c92f=0xc8;}else{_0x54c92f=0xce;}_0x3c6adb[_0x03d7('0x18')](_0x54c92f);return _0x3c6adb[_0x03d7('0x1e')](_0x03d7('0x1f'),_0x507568+'-'+_0x920293+'/'+_0x53d2ef)[_0x03d7('0x1a')](_0xab86b);}return null;};}function patchUpdates(_0x19ff4c){return function(_0x438d43){try{jsonpatch[_0x03d7('0x20')](_0x438d43,_0x19ff4c,!![]);}catch(_0x2bcf44){return BPromise['reject'](_0x2bcf44);}return _0x438d43['save']();};}function saveUpdates(_0x395ae4,_0x3c875b){return function(_0x42889a){if(_0x42889a){return _0x42889a['update'](_0x395ae4)[_0x03d7('0x21')](function(_0x57ad63){return _0x57ad63;});}return null;};}function removeEntity(_0x1a9423,_0x94e1f0){return function(_0x43f6b0){if(_0x43f6b0){return _0x43f6b0[_0x03d7('0x22')]()[_0x03d7('0x21')](function(){_0x1a9423[_0x03d7('0x18')](0xcc)[_0x03d7('0x19')]();});}};}function handleEntityNotFound(_0x59f24b,_0x49f47d){return function(_0x497ed0){if(!_0x497ed0){_0x59f24b['sendStatus'](0x194);}return _0x497ed0;};}function handleError(_0x3007e7,_0x89ca59){_0x89ca59=_0x89ca59||0x1f4;return function(_0x11519b){logger[_0x03d7('0x23')](_0x11519b[_0x03d7('0x24')]);if(_0x11519b[_0x03d7('0x25')]){delete _0x11519b[_0x03d7('0x25')];}_0x3007e7[_0x03d7('0x18')](_0x89ca59)[_0x03d7('0x26')](_0x11519b);};}exports['index']=function(_0x425840,_0x3bae27){var _0x19e081={},_0x2ee188={},_0x5e566a={'count':0x0,'rows':[]};var _0xeef058=_[_0x03d7('0x27')](db[_0x03d7('0x28')][_0x03d7('0x29')],function(_0x7ea3b6){return{'name':_0x7ea3b6[_0x03d7('0x2a')],'type':_0x7ea3b6[_0x03d7('0x2b')]['key']};});_0x2ee188[_0x03d7('0x2c')]=_[_0x03d7('0x2d')](_[_0x03d7('0x27')](_0xeef058,_0x03d7('0x25')),[_0x03d7('0x25')]);_0x2ee188[_0x03d7('0x2e')]=_['keys'](_0x425840[_0x03d7('0x2e')]);_0x2ee188['filters']=_[_0x03d7('0x2f')](_0x2ee188[_0x03d7('0x2c')],_0x2ee188[_0x03d7('0x2e')]);_0x19e081['attributes']=_[_0x03d7('0x2f')](_0x2ee188[_0x03d7('0x2c')],qs[_0x03d7('0x30')](_0x425840['query'][_0x03d7('0x30')]));_0x19e081[_0x03d7('0x31')]=_0x19e081[_0x03d7('0x31')]['length']?_0x19e081['attributes']:_0x2ee188['model'];if(!_0x425840[_0x03d7('0x2e')]['hasOwnProperty'](_0x03d7('0x32'))){_0x19e081[_0x03d7('0x1c')]=qs['limit'](_0x425840[_0x03d7('0x2e')]['limit']);_0x19e081['offset']=qs[_0x03d7('0x1b')](_0x425840[_0x03d7('0x2e')][_0x03d7('0x1b')]);}_0x19e081[_0x03d7('0x33')]=qs['sort'](_0x425840[_0x03d7('0x2e')][_0x03d7('0x34')]);_0x19e081[_0x03d7('0x35')]=qs[_0x03d7('0x36')](_[_0x03d7('0x37')](_0x425840['query'],_0x2ee188['filters']),_0xeef058);if(_0x425840[_0x03d7('0x2e')][_0x03d7('0x38')]){_0x19e081[_0x03d7('0x35')]=_[_0x03d7('0x39')](_0x19e081[_0x03d7('0x35')],{'$or':_[_0x03d7('0x27')](_0xeef058,function(_0x55a29f){if(_0x55a29f[_0x03d7('0x2b')]!==_0x03d7('0x3a')){var _0x5d0989={};_0x5d0989[_0x55a29f[_0x03d7('0x25')]]={'$like':'%'+_0x425840[_0x03d7('0x2e')][_0x03d7('0x38')]+'%'};return _0x5d0989;}})});}_0x19e081=_[_0x03d7('0x39')]({},_0x19e081,_0x425840['options']);var _0x5e9803={'where':_0x19e081[_0x03d7('0x35')]};return db['CmCustomField'][_0x03d7('0x1d')](_0x5e9803)[_0x03d7('0x21')](function(_0x2abe06){_0x5e566a[_0x03d7('0x1d')]=_0x2abe06;if(_0x425840[_0x03d7('0x2e')]['includeAll']){_0x19e081[_0x03d7('0x3b')]=[{'all':!![]}];}return db[_0x03d7('0x28')][_0x03d7('0x3c')](_0x19e081);})[_0x03d7('0x21')](function(_0x1ffbda){_0x5e566a[_0x03d7('0x3d')]=_0x1ffbda;return _0x5e566a;})[_0x03d7('0x21')](respondWithFilteredResult(_0x3bae27,_0x19e081))[_0x03d7('0x3e')](handleError(_0x3bae27,null));};exports[_0x03d7('0x3f')]=function(_0x48d3cd,_0x4adc6d){var _0x34ba61={'raw':!![],'where':{'id':_0x48d3cd[_0x03d7('0x40')]['id']}},_0x15c319={};_0x15c319['model']=_[_0x03d7('0x41')](db[_0x03d7('0x28')][_0x03d7('0x29')]);_0x15c319[_0x03d7('0x2e')]=_[_0x03d7('0x41')](_0x48d3cd[_0x03d7('0x2e')]);_0x15c319[_0x03d7('0x36')]=_[_0x03d7('0x2f')](_0x15c319[_0x03d7('0x2c')],_0x15c319[_0x03d7('0x2e')]);_0x34ba61[_0x03d7('0x31')]=_[_0x03d7('0x2f')](_0x15c319[_0x03d7('0x2c')],qs[_0x03d7('0x30')](_0x48d3cd[_0x03d7('0x2e')][_0x03d7('0x30')]));_0x34ba61[_0x03d7('0x31')]=_0x34ba61[_0x03d7('0x31')][_0x03d7('0x42')]?_0x34ba61[_0x03d7('0x31')]:_0x15c319['model'];if(_0x48d3cd[_0x03d7('0x2e')][_0x03d7('0x43')]){_0x34ba61[_0x03d7('0x3b')]=[{'all':!![]}];}_0x34ba61=_[_0x03d7('0x39')]({},_0x34ba61,_0x48d3cd[_0x03d7('0x44')]);return db[_0x03d7('0x28')][_0x03d7('0x45')](_0x34ba61)['then'](handleEntityNotFound(_0x4adc6d,null))[_0x03d7('0x21')](respondWithResult(_0x4adc6d,null))[_0x03d7('0x3e')](handleError(_0x4adc6d,null));};exports[_0x03d7('0x46')]=function(_0x8310d,_0x24c1f6){if(_0x8310d['body']['id']){delete _0x8310d[_0x03d7('0x47')]['id'];}return db[_0x03d7('0x28')]['find']({'where':{'id':_0x8310d[_0x03d7('0x40')]['id']}})[_0x03d7('0x21')](handleEntityNotFound(_0x24c1f6,null))[_0x03d7('0x21')](saveUpdates(_0x8310d[_0x03d7('0x47')],null))[_0x03d7('0x21')](respondWithResult(_0x24c1f6,null))[_0x03d7('0x3e')](handleError(_0x24c1f6,null));};exports[_0x03d7('0x22')]=function(_0x49d090,_0x4d2001){return db['CmCustomField'][_0x03d7('0x45')]({'where':{'id':_0x49d090[_0x03d7('0x40')]['id']}})[_0x03d7('0x21')](handleEntityNotFound(_0x4d2001,null))[_0x03d7('0x21')](removeEntity(_0x4d2001,null))[_0x03d7('0x3e')](handleError(_0x4d2001,null));};exports[_0x03d7('0x48')]=function(_0x495fdc,_0x514e7e){var _0x370234;return db[_0x03d7('0x49')][_0x03d7('0x4a')](function(_0x13e294){return db[_0x03d7('0x28')][_0x03d7('0x48')](_0x495fdc[_0x03d7('0x47')],{'transaction':_0x13e294})['then'](function(_0x5967d5){_0x370234=_0x5967d5;var _0x540453={'type':db[_0x03d7('0x4b')]['TEXT'],'transaction':_0x13e294};switch(_0x495fdc[_0x03d7('0x47')]['type']){case _0x03d7('0x4c'):_0x540453[_0x03d7('0x2b')]=db[_0x03d7('0x4b')][_0x03d7('0x4d')];break;case'number':_0x540453[_0x03d7('0x2b')]=db[_0x03d7('0x4b')][_0x03d7('0x4e')];break;case _0x03d7('0x4f'):_0x540453['type']=db['Sequelize'][_0x03d7('0x50')];_0x540453['defaultValue']=![];break;default:}return db[_0x03d7('0x49')][_0x03d7('0x51')]['addColumn'](_0x03d7('0x52'),util[_0x03d7('0x53')](_0x03d7('0x54'),_0x370234['id']),_0x540453);})[_0x03d7('0x21')](function(){return _0x370234;});})[_0x03d7('0x21')](respondWithResult(_0x514e7e,0xc9))[_0x03d7('0x3e')](handleError(_0x514e7e,null));}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.model.js b/server/api/cmCustomField/cmCustomField.model.js index 15c658b..0872744 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 _0x4d86=['exports','define','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment'];(function(_0x55730e,_0xd75445){var _0x2f3596=function(_0x4104bd){while(--_0x4104bd){_0x55730e['push'](_0x55730e['shift']());}};_0x2f3596(++_0xd75445);}(_0x4d86,0x183));var _0x64d8=function(_0x3a1f6c,_0x4d30fb){_0x3a1f6c=_0x3a1f6c-0x0;var _0x4d6a7c=_0x4d86[_0x3a1f6c];return _0x4d6a7c;};'use strict';var _=require(_0x64d8('0x0'));var util=require(_0x64d8('0x1'));var logger=require(_0x64d8('0x2'))(_0x64d8('0x3'));var moment=require(_0x64d8('0x4'));var BPromise=require('bluebird');var rp=require(_0x64d8('0x5'));var fs=require('fs');var path=require(_0x64d8('0x6'));var rimraf=require(_0x64d8('0x7'));var config=require(_0x64d8('0x8'));var attributes=require('./cmCustomField.attributes');module[_0x64d8('0x9')]=function(_0xd83d3,_0x1925f5){return _0xd83d3[_0x64d8('0xa')]('CmCustomField',attributes,{'tableName':'cm_custom_fields','paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8fd9=['exports','define','lodash','moment','request-promise','path','../../config/environment','./cmCustomField.attributes'];(function(_0x2b5d10,_0x36fc32){var _0x346eb3=function(_0x435f5e){while(--_0x435f5e){_0x2b5d10['push'](_0x2b5d10['shift']());}};_0x346eb3(++_0x36fc32);}(_0x8fd9,0x92));var _0x98fd=function(_0x1deba7,_0x30f270){_0x1deba7=_0x1deba7-0x0;var _0x2dcc31=_0x8fd9[_0x1deba7];return _0x2dcc31;};'use strict';var _=require(_0x98fd('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x98fd('0x1'));var BPromise=require('bluebird');var rp=require(_0x98fd('0x2'));var fs=require('fs');var path=require(_0x98fd('0x3'));var rimraf=require('rimraf');var config=require(_0x98fd('0x4'));var attributes=require(_0x98fd('0x5'));module[_0x98fd('0x6')]=function(_0x1f12ae,_0x5ce58f){return _0x1f12ae[_0x98fd('0x7')]('CmCustomField',attributes,{'tableName':'cm_custom_fields','paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.rpc.js b/server/api/cmCustomField/cmCustomField.rpc.js index 536c5c8..47327ee 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 _0x57e6=['then','info','debug','request\x20sent','stringify','error','code','message','CmCustomField,\x20%s,\x20%s','result','catch','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/environment','client','http','request'];(function(_0x1b2ff7,_0x12a034){var _0x31656a=function(_0x1165a5){while(--_0x1165a5){_0x1b2ff7['push'](_0x1b2ff7['shift']());}};_0x31656a(++_0x12a034);}(_0x57e6,0xc8));var _0x657e=function(_0xd13171,_0xc54453){_0xd13171=_0xd13171-0x0;var _0x452bd0=_0x57e6[_0xd13171];return _0x452bd0;};'use strict';var _=require(_0x657e('0x0'));var util=require(_0x657e('0x1'));var moment=require(_0x657e('0x2'));var BPromise=require(_0x657e('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x657e('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x657e('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x657e('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x657e('0x7')][_0x657e('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3afbf7,_0x473fa6,_0x3fe08e){return new BPromise(function(_0x313487,_0x456efa){return client[_0x657e('0x9')](_0x3afbf7,_0x3fe08e)[_0x657e('0xa')](function(_0x19820e){logger[_0x657e('0xb')]('CmCustomField,\x20%s,\x20%s',_0x473fa6,'request\x20sent');logger[_0x657e('0xc')]('CmCustomField,\x20%s,\x20%s,\x20%s',_0x473fa6,_0x657e('0xd'),JSON[_0x657e('0xe')](_0x19820e));if(_0x19820e['error']){if(_0x19820e[_0x657e('0xf')][_0x657e('0x10')]===0x1f4){logger[_0x657e('0xf')]('CmCustomField,\x20%s,\x20%s',_0x473fa6,_0x19820e[_0x657e('0xf')][_0x657e('0x11')]);return _0x456efa(_0x19820e['error'][_0x657e('0x11')]);}logger[_0x657e('0xf')](_0x657e('0x12'),_0x473fa6,_0x19820e['error'][_0x657e('0x11')]);return _0x313487(_0x19820e[_0x657e('0xf')][_0x657e('0x11')]);}else{logger[_0x657e('0xb')]('CmCustomField,\x20%s,\x20%s',_0x473fa6,'request\x20sent');_0x313487(_0x19820e[_0x657e('0x13')][_0x657e('0x11')]);}})[_0x657e('0x14')](function(_0x3907f2){logger[_0x657e('0xf')]('CmCustomField,\x20%s,\x20%s',_0x473fa6,_0x3907f2);_0x456efa(_0x3907f2);});});} \ No newline at end of file +var _0xc235=['error','code','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','CmCustomField,\x20%s,\x20%s','request\x20sent','debug','CmCustomField,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xc235,0x184));var _0x5c23=function(_0x1d0cf3,_0x1080ff){_0x1d0cf3=_0x1d0cf3-0x0;var _0x53463a=_0xc235[_0x1d0cf3];return _0x53463a;};'use strict';var _=require(_0x5c23('0x0'));var util=require(_0x5c23('0x1'));var moment=require(_0x5c23('0x2'));var BPromise=require(_0x5c23('0x3'));var rs=require(_0x5c23('0x4'));var fs=require('fs');var Redis=require(_0x5c23('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x5c23('0x6'));var logger=require(_0x5c23('0x7'))(_0x5c23('0x8'));var config=require(_0x5c23('0x9'));var jayson=require(_0x5c23('0xa'));var client=jayson['client'][_0x5c23('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4483ec,_0x14b33f,_0x301efa){return new BPromise(function(_0x58bfad,_0x4efc4c){return client[_0x5c23('0xc')](_0x4483ec,_0x301efa)[_0x5c23('0xd')](function(_0x287643){logger[_0x5c23('0xe')](_0x5c23('0xf'),_0x14b33f,_0x5c23('0x10'));logger[_0x5c23('0x11')](_0x5c23('0x12'),_0x14b33f,'request\x20sent',JSON[_0x5c23('0x13')](_0x287643));if(_0x287643[_0x5c23('0x14')]){if(_0x287643['error'][_0x5c23('0x15')]===0x1f4){logger[_0x5c23('0x14')]('CmCustomField,\x20%s,\x20%s',_0x14b33f,_0x287643[_0x5c23('0x14')]['message']);return _0x4efc4c(_0x287643[_0x5c23('0x14')][_0x5c23('0x16')]);}logger[_0x5c23('0x14')](_0x5c23('0xf'),_0x14b33f,_0x287643['error']['message']);return _0x58bfad(_0x287643['error']['message']);}else{logger[_0x5c23('0xe')](_0x5c23('0xf'),_0x14b33f,_0x5c23('0x10'));_0x58bfad(_0x287643['result'][_0x5c23('0x16')]);}})[_0x5c23('0x17')](function(_0x39b0a5){logger['error'](_0x5c23('0xf'),_0x14b33f,_0x39b0a5);_0x4efc4c(_0x39b0a5);});});} \ No newline at end of file diff --git a/server/api/cmCustomField/index.js b/server/api/cmCustomField/index.js index 89090d9..dcdab2c 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 _0xed08=['delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmCustomField.controller','get','isAuthenticated','/:id','show','post','create','update'];(function(_0x3bed69,_0xe8d6d9){var _0x3aec02=function(_0xd01efc){while(--_0xd01efc){_0x3bed69['push'](_0x3bed69['shift']());}};_0x3aec02(++_0xe8d6d9);}(_0xed08,0x67));var _0x8ed0=function(_0x231522,_0x46961e){_0x231522=_0x231522-0x0;var _0x3acae2=_0xed08[_0x231522];return _0x3acae2;};'use strict';var multer=require('multer');var util=require(_0x8ed0('0x0'));var path=require(_0x8ed0('0x1'));var timeout=require(_0x8ed0('0x2'));var express=require(_0x8ed0('0x3'));var router=express[_0x8ed0('0x4')]();var fs_extra=require(_0x8ed0('0x5'));var auth=require(_0x8ed0('0x6'));var interaction=require(_0x8ed0('0x7'));var config=require(_0x8ed0('0x8'));var controller=require(_0x8ed0('0x9'));router[_0x8ed0('0xa')]('/',auth[_0x8ed0('0xb')](),controller['index']);router[_0x8ed0('0xa')](_0x8ed0('0xc'),auth[_0x8ed0('0xb')](),controller[_0x8ed0('0xd')]);router[_0x8ed0('0xe')]('/',auth[_0x8ed0('0xb')](),controller[_0x8ed0('0xf')]);router['put'](_0x8ed0('0xc'),auth[_0x8ed0('0xb')](),controller[_0x8ed0('0x10')]);router[_0x8ed0('0x11')]('/:id',auth[_0x8ed0('0xb')](),controller[_0x8ed0('0x12')]);module[_0x8ed0('0x13')]=router; \ No newline at end of file +var _0xa1aa=['delete','destroy','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./cmCustomField.controller','get','index','/:id','isAuthenticated','show','post','create','put'];(function(_0x4d0527,_0x216351){var _0x4ad853=function(_0x5f4268){while(--_0x5f4268){_0x4d0527['push'](_0x4d0527['shift']());}};_0x4ad853(++_0x216351);}(_0xa1aa,0x88));var _0xaa1a=function(_0x45309c,_0x309714){_0x45309c=_0x45309c-0x0;var _0x228809=_0xa1aa[_0x45309c];return _0x228809;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xaa1a('0x0'));var timeout=require(_0xaa1a('0x1'));var express=require(_0xaa1a('0x2'));var router=express[_0xaa1a('0x3')]();var fs_extra=require(_0xaa1a('0x4'));var auth=require(_0xaa1a('0x5'));var interaction=require(_0xaa1a('0x6'));var config=require('../../config/environment');var controller=require(_0xaa1a('0x7'));router[_0xaa1a('0x8')]('/',auth['isAuthenticated'](),controller[_0xaa1a('0x9')]);router[_0xaa1a('0x8')](_0xaa1a('0xa'),auth[_0xaa1a('0xb')](),controller[_0xaa1a('0xc')]);router[_0xaa1a('0xd')]('/',auth[_0xaa1a('0xb')](),controller[_0xaa1a('0xe')]);router[_0xaa1a('0xf')]('/:id',auth[_0xaa1a('0xb')](),controller['update']);router[_0xaa1a('0x10')](_0xaa1a('0xa'),auth[_0xaa1a('0xb')](),controller[_0xaa1a('0x11')]);module[_0xaa1a('0x12')]=router; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.attributes.js b/server/api/cmHopper/cmHopper.attributes.js index 59ee31c..b4b8976 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 _0x9a70=['STRING','BOOLEAN','format','YYYY-MM-DD\x20HH:mm:ss','INTEGER','UNSIGNED','contactListQueue','DATE','moment','sequelize'];(function(_0x382a62,_0x1baa5e){var _0x490a25=function(_0x1b3427){while(--_0x1b3427){_0x382a62['push'](_0x382a62['shift']());}};_0x490a25(++_0x1baa5e);}(_0x9a70,0x120));var _0x09a7=function(_0x1cc8fe,_0x105328){_0x1cc8fe=_0x1cc8fe-0x0;var _0x230054=_0x9a70[_0x1cc8fe];return _0x230054;};'use strict';var moment=require(_0x09a7('0x0'));var Sequelize=require(_0x09a7('0x1'));module['exports']={'phone':{'type':Sequelize[_0x09a7('0x2')],'allowNull':![]},'active':{'type':Sequelize[_0x09a7('0x3')],'defaultValue':![]},'scheduledat':{'type':Sequelize['DATE'],'defaultValue':moment()[_0x09a7('0x4')](_0x09a7('0x5'))},'countbusyretry':{'type':Sequelize[_0x09a7('0x6')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x09a7('0x6')],'defaultValue':0x0},'callback':{'type':Sequelize[_0x09a7('0x3')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x09a7('0x2')],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'priority':{'type':Sequelize['INTEGER'](0x2)[_0x09a7('0x7')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize[_0x09a7('0x3')],'defaultValue':![]},'ContactId':{'type':Sequelize['INTEGER'],'unique':_0x09a7('0x8')},'ListId':{'type':Sequelize['INTEGER'],'unique':_0x09a7('0x8')},'UserId':{'type':Sequelize[_0x09a7('0x6')]},'VoiceQueueId':{'type':Sequelize[_0x09a7('0x6')],'unique':_0x09a7('0x8')},'CampaignId':{'type':Sequelize[_0x09a7('0x6')]},'countnosuchnumberretry':{'type':Sequelize[_0x09a7('0x6')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x09a7('0x6')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x09a7('0x6')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x09a7('0x6')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x09a7('0x6')],'defaultValue':0x0},'OrderBy':{'type':Sequelize[_0x09a7('0x6')],'allowNull':!![],'defaultValue':0x0},'dialTimezone':{'type':Sequelize['STRING']},'recallmeNotifiedDate':{'type':Sequelize[_0x09a7('0x9')],'allowNull':!![],'defaultValue':null}}; \ No newline at end of file +var _0xb3de=['DATE','contactListQueue','moment','sequelize','exports','STRING','BOOLEAN','format','YYYY-MM-DD\x20HH:mm:ss','INTEGER'];(function(_0x45783c,_0x49c56d){var _0x1161da=function(_0x3c5d41){while(--_0x3c5d41){_0x45783c['push'](_0x45783c['shift']());}};_0x1161da(++_0x49c56d);}(_0xb3de,0x1d8));var _0xeb3d=function(_0x49223c,_0x48325d){_0x49223c=_0x49223c-0x0;var _0x2f04cb=_0xb3de[_0x49223c];return _0x2f04cb;};'use strict';var moment=require(_0xeb3d('0x0'));var Sequelize=require(_0xeb3d('0x1'));module[_0xeb3d('0x2')]={'phone':{'type':Sequelize[_0xeb3d('0x3')],'allowNull':![]},'active':{'type':Sequelize[_0xeb3d('0x4')],'defaultValue':![]},'scheduledat':{'type':Sequelize['DATE'],'defaultValue':moment()[_0xeb3d('0x5')](_0xeb3d('0x6'))},'countbusyretry':{'type':Sequelize[_0xeb3d('0x7')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xeb3d('0x7')],'defaultValue':0x0},'callback':{'type':Sequelize[_0xeb3d('0x4')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xeb3d('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize[_0xeb3d('0x8')]},'priority':{'type':Sequelize[_0xeb3d('0x7')](0x2)['UNSIGNED'],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ContactId':{'type':Sequelize[_0xeb3d('0x7')],'unique':_0xeb3d('0x9')},'ListId':{'type':Sequelize['INTEGER'],'unique':_0xeb3d('0x9')},'UserId':{'type':Sequelize[_0xeb3d('0x7')]},'VoiceQueueId':{'type':Sequelize[_0xeb3d('0x7')],'unique':'contactListQueue'},'CampaignId':{'type':Sequelize['INTEGER']},'countnosuchnumberretry':{'type':Sequelize[_0xeb3d('0x7')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xeb3d('0x7')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xeb3d('0x7')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xeb3d('0x7')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xeb3d('0x7')],'defaultValue':0x0},'OrderBy':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':0x0},'dialTimezone':{'type':Sequelize['STRING']},'recallmeNotifiedDate':{'type':Sequelize['DATE'],'allowNull':!![],'defaultValue':null}}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.controller.js b/server/api/cmHopper/cmHopper.controller.js index 1d17c61..84f0f5e 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 _0x8d0a=['$contained','$any','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','merge','where','map','VIRTUAL','filter','options','CmHopper','count','then','includeAll','include','findAll','rows','catch','show','find','create','body','params','describe','destroy','VoiceQueueId','CampaignId','VoiceQueue','dataValues','createdAt','updatedAt','state','statedesc','deleted','membername','user','UserId','deletedat','format','YYYY-MM-DD\x20HH:mm:ss','calleridnum','phone','campaigntype','queue','ivr','CmContact','ContactId','lastName','isNil','firstName','calleridname','finally','CmHopperFinal','CmHopperAdditionalPhone','end','getPreview','getVoiceQueues','preview','dialOrderByScheduledAt','dialPreviewAutoRecallMe','sequelize','transaction','value','direction','prev','isEmpty','hopperIds','priority','ASC','scheduledAt','DESC','literal','COALESCE(CmHopper.UserId,\x200)\x20ASC','COALESCE(CmHopper.UserId,\x200)\x20DESC','findOne','scheduledat','recallme','UPDATE','Contact','CmCompany','Company','Queue','dialActive','LOCK','CmList','List','getOpenContacts','outbound','isNumber','entity\x20not\x20found','getTimezones','push','utcOffset','getTimezone','timezones','moment','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','status','offset','undefined','limit','set','Content-Range','json','update','sendStatus','error','stack','name','send','index','rawAttributes','type','key','model','keys','query','filters','intersection','$and','$gt','$gte','$lt','$lte','$ne','$not','$between','$notBetween','$in','$notIn','$like','$notLike','$iLike','$overlap','$contains'];(function(_0x1bcdc6,_0x1b4ed1){var _0x5bb4b0=function(_0x1ac468){while(--_0x1ac468){_0x1bcdc6['push'](_0x1bcdc6['shift']());}};_0x5bb4b0(++_0x1b4ed1);}(_0x8d0a,0x65));var _0xa8d0=function(_0x4c2462,_0x29a448){_0x4c2462=_0x4c2462-0x0;var _0x568667=_0x8d0a[_0x4c2462];return _0x568667;};'use strict';var moment=require(_0xa8d0('0x0'));var _=require('lodash');var qs=require(_0xa8d0('0x1'));var logger=require(_0xa8d0('0x2'))(_0xa8d0('0x3'));var shared=require(_0xa8d0('0x4'));var db=require(_0xa8d0('0x5'))['db'];function respondWithResult(_0x477190,_0x528287){_0x528287=_0x528287||0xc8;return function(_0x202833){if(_0x202833){return _0x477190[_0xa8d0('0x6')](_0x528287)['json'](_0x202833);}};}function respondWithFilteredResult(_0x1cac4f,_0x212aaf){return function(_0x1f95a7){if(_0x1f95a7){var _0x1f8b78=typeof _0x212aaf[_0xa8d0('0x7')]==='undefined'&&typeof _0x212aaf['limit']===_0xa8d0('0x8');var _0x823481=_0x1f95a7['count'];var _0x5362af=_0x1f8b78?0x0:_0x212aaf['offset'];var _0x296b54=_0x1f8b78?_0x1f95a7['count']:_0x212aaf[_0xa8d0('0x7')]+_0x212aaf[_0xa8d0('0x9')];var _0x44541e;if(_0x296b54>=_0x823481){_0x296b54=_0x823481;_0x44541e=0xc8;}else{_0x44541e=0xce;}_0x1cac4f[_0xa8d0('0x6')](_0x44541e);return _0x1cac4f[_0xa8d0('0xa')](_0xa8d0('0xb'),_0x5362af+'-'+_0x296b54+'/'+_0x823481)[_0xa8d0('0xc')](_0x1f95a7);}return null;};}function saveUpdates(_0x3bf335,_0x329583){return function(_0x1bfcb6){if(_0x1bfcb6){return _0x1bfcb6[_0xa8d0('0xd')](_0x3bf335)['then'](function(_0x757540){return _0x757540;});}return null;};}function handleEntityNotFound(_0x478f66,_0x5a9193){return function(_0x32ea3e){if(!_0x32ea3e){_0x478f66[_0xa8d0('0xe')](0x194);}return _0x32ea3e;};}function handleError(_0x523ec0,_0x31da9f){_0x31da9f=_0x31da9f||0x1f4;return function(_0x459e9d){logger[_0xa8d0('0xf')](_0x459e9d[_0xa8d0('0x10')]);if(_0x459e9d[_0xa8d0('0x11')]){delete _0x459e9d[_0xa8d0('0x11')];}_0x523ec0['status'](_0x31da9f)[_0xa8d0('0x12')](_0x459e9d);};}exports[_0xa8d0('0x13')]=function(_0x5cf619,_0x2f0b00){var _0x1e325a={},_0x53d168={},_0x32b11a={'count':0x0,'rows':[]};var _0xf9267d=_['map'](db['CmHopper'][_0xa8d0('0x14')],function(_0x25ed8d){return{'name':_0x25ed8d['fieldName'],'type':_0x25ed8d[_0xa8d0('0x15')][_0xa8d0('0x16')]};});_0x53d168[_0xa8d0('0x17')]=_['map'](_0xf9267d,_0xa8d0('0x11'));_0x53d168['query']=_[_0xa8d0('0x18')](_0x5cf619[_0xa8d0('0x19')]);_0x53d168[_0xa8d0('0x1a')]=_[_0xa8d0('0x1b')](_0x53d168[_0xa8d0('0x17')],_0x53d168[_0xa8d0('0x19')]);_0x53d168[_0xa8d0('0x1a')]=_['concat'](_0x53d168['filters'],[_0xa8d0('0x1c'),'$or',_0xa8d0('0x1d'),_0xa8d0('0x1e'),_0xa8d0('0x1f'),_0xa8d0('0x20'),_0xa8d0('0x21'),'$eq',_0xa8d0('0x22'),_0xa8d0('0x23'),_0xa8d0('0x24'),_0xa8d0('0x25'),_0xa8d0('0x26'),_0xa8d0('0x27'),_0xa8d0('0x28'),_0xa8d0('0x29'),'$notILike',_0xa8d0('0x27'),_0xa8d0('0x2a'),_0xa8d0('0x2b'),_0xa8d0('0x2c'),_0xa8d0('0x2d')]);_0x1e325a[_0xa8d0('0x2e')]=_['intersection'](_0x53d168[_0xa8d0('0x17')],qs[_0xa8d0('0x2f')](_0x5cf619[_0xa8d0('0x19')][_0xa8d0('0x2f')]));_0x1e325a['attributes']=_0x1e325a[_0xa8d0('0x2e')][_0xa8d0('0x30')]?_0x1e325a['attributes']:_0x53d168['model'];if(!_0x5cf619[_0xa8d0('0x19')][_0xa8d0('0x31')](_0xa8d0('0x32'))){_0x1e325a[_0xa8d0('0x9')]=qs[_0xa8d0('0x9')](_0x5cf619[_0xa8d0('0x19')][_0xa8d0('0x9')]);_0x1e325a[_0xa8d0('0x7')]=qs[_0xa8d0('0x7')](_0x5cf619[_0xa8d0('0x19')][_0xa8d0('0x7')]);}_0x1e325a[_0xa8d0('0x33')]=qs['sort'](_0x5cf619['query'][_0xa8d0('0x34')]);_0x1e325a['where']=qs[_0xa8d0('0x1a')](_[_0xa8d0('0x35')](_0x5cf619[_0xa8d0('0x19')],_0x53d168[_0xa8d0('0x1a')]),_0xf9267d);if(_0x5cf619[_0xa8d0('0x19')]['filter']){_0x1e325a['where']=_[_0xa8d0('0x36')](_0x1e325a[_0xa8d0('0x37')],{'$or':_[_0xa8d0('0x38')](_0xf9267d,function(_0x1352ed){if(_0x1352ed[_0xa8d0('0x15')]!==_0xa8d0('0x39')){var _0x5b2d5e={};_0x5b2d5e[_0x1352ed[_0xa8d0('0x11')]]={'$like':'%'+_0x5cf619[_0xa8d0('0x19')][_0xa8d0('0x3a')]+'%'};return _0x5b2d5e;}})});}_0x1e325a=_['merge']({},_0x1e325a,_0x5cf619[_0xa8d0('0x3b')]);var _0x4ac500={'where':_0x1e325a[_0xa8d0('0x37')]};return db[_0xa8d0('0x3c')][_0xa8d0('0x3d')](_0x4ac500)[_0xa8d0('0x3e')](function(_0x27515e){_0x32b11a['count']=_0x27515e;if(_0x5cf619[_0xa8d0('0x19')][_0xa8d0('0x3f')]){_0x1e325a[_0xa8d0('0x40')]=[{'all':!![]}];}return db[_0xa8d0('0x3c')][_0xa8d0('0x41')](_0x1e325a);})[_0xa8d0('0x3e')](function(_0x5dea4a){_0x32b11a[_0xa8d0('0x42')]=_0x5dea4a;return _0x32b11a;})[_0xa8d0('0x3e')](respondWithFilteredResult(_0x2f0b00,_0x1e325a))[_0xa8d0('0x43')](handleError(_0x2f0b00,null));};exports[_0xa8d0('0x44')]=function(_0xeba90c,_0x2f5186){var _0x1c1e05={'raw':!![],'where':{'id':_0xeba90c['params']['id']}},_0x10dc8b={};_0x10dc8b[_0xa8d0('0x17')]=_['keys'](db[_0xa8d0('0x3c')][_0xa8d0('0x14')]);_0x10dc8b[_0xa8d0('0x19')]=_[_0xa8d0('0x18')](_0xeba90c[_0xa8d0('0x19')]);_0x10dc8b[_0xa8d0('0x1a')]=_[_0xa8d0('0x1b')](_0x10dc8b[_0xa8d0('0x17')],_0x10dc8b[_0xa8d0('0x19')]);_0x1c1e05[_0xa8d0('0x2e')]=_[_0xa8d0('0x1b')](_0x10dc8b[_0xa8d0('0x17')],qs['fields'](_0xeba90c[_0xa8d0('0x19')][_0xa8d0('0x2f')]));_0x1c1e05[_0xa8d0('0x2e')]=_0x1c1e05[_0xa8d0('0x2e')][_0xa8d0('0x30')]?_0x1c1e05[_0xa8d0('0x2e')]:_0x10dc8b['model'];if(_0xeba90c[_0xa8d0('0x19')][_0xa8d0('0x3f')]){_0x1c1e05[_0xa8d0('0x40')]=[{'all':!![]}];}_0x1c1e05=_[_0xa8d0('0x36')]({},_0x1c1e05,_0xeba90c[_0xa8d0('0x3b')]);return db[_0xa8d0('0x3c')][_0xa8d0('0x45')](_0x1c1e05)[_0xa8d0('0x3e')](handleEntityNotFound(_0x2f5186,null))['then'](respondWithResult(_0x2f5186,null))[_0xa8d0('0x43')](handleError(_0x2f5186,null));};exports['create']=function(_0x3f6760,_0x1ae68b){return db[_0xa8d0('0x3c')][_0xa8d0('0x46')](_0x3f6760['body'],{})[_0xa8d0('0x3e')](respondWithResult(_0x1ae68b,0xc9))[_0xa8d0('0x43')](handleError(_0x1ae68b,null));};exports['update']=function(_0x22be14,_0x4b0d20){if(_0x22be14[_0xa8d0('0x47')]['id']){delete _0x22be14['body']['id'];}return db['CmHopper'][_0xa8d0('0x45')]({'where':{'id':_0x22be14[_0xa8d0('0x48')]['id']}})[_0xa8d0('0x3e')](handleEntityNotFound(_0x4b0d20,null))[_0xa8d0('0x3e')](saveUpdates(_0x22be14['body'],null))[_0xa8d0('0x3e')](respondWithResult(_0x4b0d20,null))[_0xa8d0('0x43')](handleError(_0x4b0d20,null));};exports[_0xa8d0('0x49')]=function(_0x352adc,_0x2258d1){return db['CmHopper'][_0xa8d0('0x49')]()['then'](respondWithResult(_0x2258d1,null))[_0xa8d0('0x43')](handleError(_0x2258d1,null));};exports[_0xa8d0('0x4a')]=function(_0x3dd3ae,_0x5a2aef){var _0x900fd0;var _0x149d65=_0x3dd3ae[_0xa8d0('0x48')]['id'];return db[_0xa8d0('0x3c')][_0xa8d0('0x45')]({'where':{'id':_0x3dd3ae['params']['id']}})[_0xa8d0('0x3e')](handleEntityNotFound(_0x5a2aef,null))[_0xa8d0('0x3e')](function(_0x5329d3){if(_0x5329d3){return _0x5329d3[_0xa8d0('0x4a')]()[_0xa8d0('0x3e')](function(_0x20b617){return _0x20b617;});}})[_0xa8d0('0x3e')](function(_0x2eeed7){_0x900fd0=_0x2eeed7;if(_0x2eeed7){if(_0x2eeed7[_0xa8d0('0x4b')]||_0x2eeed7[_0xa8d0('0x4c')]){return db[_0x2eeed7['VoiceQueueId']?_0xa8d0('0x4d'):'Campaign']['find']({'where':{'id':_0x2eeed7[_0xa8d0('0x4b')]?_0x2eeed7[_0xa8d0('0x4b')]:_0x2eeed7['CampaignId']},'attributes':['id',_0xa8d0('0x11')],'raw':!![]});}}})[_0xa8d0('0x3e')](function(_0x238a3f){var _0x5bc28c={};if(_0x238a3f){_[_0xa8d0('0x36')](_0x5bc28c,_['omit'](_0x900fd0[_0xa8d0('0x4e')],[_0xa8d0('0x4f'),_0xa8d0('0x50'),'id']));_0x5bc28c[_0xa8d0('0x51')]=0x15;_0x5bc28c[_0xa8d0('0x52')]=_0xa8d0('0x53');_0x5bc28c['campaign']=_0x238a3f[_0xa8d0('0x11')];_0x5bc28c[_0xa8d0('0x54')]=_0x3dd3ae[_0xa8d0('0x55')]['name'];_0x5bc28c[_0xa8d0('0x56')]=_0x3dd3ae[_0xa8d0('0x55')]['id'];_0x5bc28c[_0xa8d0('0x53')]=!![];_0x5bc28c[_0xa8d0('0x57')]=moment()[_0xa8d0('0x58')](_0xa8d0('0x59'));_0x5bc28c[_0xa8d0('0x5a')]=_0x900fd0[_0xa8d0('0x5b')];_0x5bc28c[_0xa8d0('0x5c')]=_0x900fd0[_0xa8d0('0x4b')]?_0xa8d0('0x5d'):_0xa8d0('0x5e');return db[_0xa8d0('0x5f')]['find']({'where':{'id':_0x5bc28c[_0xa8d0('0x60')]},'attributes':['firstName',_0xa8d0('0x61')]})['then'](function(_0x575301){if(!_[_0xa8d0('0x62')](_0x5a2aef)&&!_[_0xa8d0('0x62')](_0x575301[_0xa8d0('0x63')])){_0x5bc28c['calleridname']=_0x575301['firstName'];if(!_[_0xa8d0('0x62')](_0x575301[_0xa8d0('0x61')])){_0x5bc28c[_0xa8d0('0x64')]+='\x20'+_0x575301['lastName'];}}})[_0xa8d0('0x65')](function(){return db[_0xa8d0('0x66')][_0xa8d0('0x46')](_0x5bc28c);});}})[_0xa8d0('0x3e')](function(_0x20d3fe){return db[_0xa8d0('0x67')]['destroy']({'where':{'CmHopperId':_0x149d65}});})[_0xa8d0('0x3e')](function(){return _0x5a2aef[_0xa8d0('0x6')](0xcc)[_0xa8d0('0x68')]();})[_0xa8d0('0x43')](handleError(_0x5a2aef,null));};exports[_0xa8d0('0x69')]=function(_0x191df2,_0x3504ac){var _0x3a54a9=[];return db[_0xa8d0('0x5f')][_0xa8d0('0x49')]()['then'](function(_0x2e2237){_0x3a54a9=_[_0xa8d0('0x18')](_0x2e2237);return _0x191df2['user'][_0xa8d0('0x6a')]({'where':{'type':'outbound','dialActive':!![],'dialMethod':_0xa8d0('0x6b')},'attributes':['id',_0xa8d0('0x6c'),_0xa8d0('0x6d')],'raw':!![]});})[_0xa8d0('0x3e')](function(_0x59e607){if(_0x59e607&&_0x59e607['length']){return db[_0xa8d0('0x6e')][_0xa8d0('0x6f')](function(_0x41ebd3){var _0x4820d0={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0xa8d0('0x58')](_0xa8d0('0x59'))},'VoiceQueueId':{'$in':_[_0xa8d0('0x38')](_0x59e607,'id')},'$or':[{'UserId':null},{'UserId':_0x191df2[_0xa8d0('0x55')]['id']}]};var _0x203b29={'active':![],'recallme':!![],'VoiceQueueId':{'$in':_(_0x59e607)['filter']([_0xa8d0('0x6d'),0x0])[_0xa8d0('0x38')]('id')[_0xa8d0('0x70')]()},'$or':[{'UserId':null},{'UserId':_0x191df2[_0xa8d0('0x55')]['id']}]};var _0x5a2817={'$or':[_0x4820d0,_0x203b29]};var _0x682412=[];if(_0x191df2[_0xa8d0('0x47')][_0xa8d0('0x71')]&&_0x191df2[_0xa8d0('0x47')]['direction']===_0xa8d0('0x72')){if(!_[_0xa8d0('0x73')](_0x191df2[_0xa8d0('0x47')]['hopperIds'])){_0x5a2817['id']={'$in':_0x191df2[_0xa8d0('0x47')][_0xa8d0('0x74')]};}_0x682412=[[_0xa8d0('0x75'),_0xa8d0('0x76')],[_0xa8d0('0x77'),_0x59e607[0x0]['dialOrderByScheduledAt']===_0xa8d0('0x76')?_0xa8d0('0x78'):'ASC'],db[_0xa8d0('0x6e')][_0xa8d0('0x79')](_0xa8d0('0x7a')),['id',_0xa8d0('0x78')]];}else{if(!_[_0xa8d0('0x73')](_0x191df2[_0xa8d0('0x47')][_0xa8d0('0x74')])){_0x5a2817['id']={'$notIn':_0x191df2['body'][_0xa8d0('0x74')]};}_0x682412=[[_0xa8d0('0x75'),_0xa8d0('0x78')],[_0xa8d0('0x77'),_0x59e607[0x0][_0xa8d0('0x6c')]],db[_0xa8d0('0x6e')][_0xa8d0('0x79')](_0xa8d0('0x7b')),['id','ASC']];}return db[_0xa8d0('0x3c')][_0xa8d0('0x7c')]({'attributes':['id',_0xa8d0('0x7d'),_0xa8d0('0x5b'),_0xa8d0('0x7e')],'where':_0x5a2817,'order':_0x682412,'transaction':_0x41ebd3,'lock':_0x41ebd3['LOCK'][_0xa8d0('0x7f')],'include':[{'model':db[_0xa8d0('0x5f')],'as':_0xa8d0('0x80'),'attributes':_0x3a54a9,'include':[{'model':db[_0xa8d0('0x81')],'as':_0xa8d0('0x82'),'attributes':['id','name']}]},{'model':db['CmList'],'as':'List','attributes':['id',_0xa8d0('0x11')]},{'model':db[_0xa8d0('0x4d')],'as':_0xa8d0('0x83'),'attributes':['id','name',_0xa8d0('0x84')]}]})[_0xa8d0('0x3e')](function(_0x4e373c){if(_0x4e373c){return _0x4e373c[_0xa8d0('0xd')]({'UserId':_0x191df2[_0xa8d0('0x55')]['id']},{'transaction':_0x41ebd3});}});});}})[_0xa8d0('0x3e')](handleEntityNotFound(_0x3504ac,null))['then'](respondWithResult(_0x3504ac,null))['catch'](handleError(_0x3504ac,null));};exports['getPreviewRecall']=function(_0x2e50c5,_0x5ea683,_0x1effc3){var _0x29d2c1=[];var _0x185a62=_0x2e50c5[_0xa8d0('0x48')]['id'];var _0x5c8ce5=_0x2e50c5[_0xa8d0('0x55')]['id'];return db[_0xa8d0('0x5f')][_0xa8d0('0x49')]()['then'](function(_0x37cba8){_0x29d2c1=_[_0xa8d0('0x18')](_0x37cba8);return db[_0xa8d0('0x6e')][_0xa8d0('0x6f')](function(_0x348529){const _0x4509c6={'id':_0x185a62};return db[_0xa8d0('0x3c')][_0xa8d0('0x7c')]({'attributes':['id',_0xa8d0('0x7d'),'recallme'],'where':_0x4509c6,'transaction':_0x348529,'lock':_0x348529[_0xa8d0('0x85')]['UPDATE'],'include':[{'model':db['CmContact'],'as':_0xa8d0('0x80'),'attributes':_0x29d2c1,'include':[{'model':db[_0xa8d0('0x81')],'as':'Company','attributes':['id','name']}]},{'model':db[_0xa8d0('0x86')],'as':_0xa8d0('0x87'),'attributes':['id',_0xa8d0('0x11')]},{'model':db[_0xa8d0('0x4d')],'as':_0xa8d0('0x83'),'attributes':['id','name','dialActive']}]})[_0xa8d0('0x3e')](function(_0x12ad99){if(_0x12ad99){return _0x12ad99['update']({'UserId':_0x5c8ce5},{'transaction':_0x348529});}});});})[_0xa8d0('0x3e')](handleEntityNotFound(_0x5ea683,null))['then'](respondWithResult(_0x5ea683,null))[_0xa8d0('0x43')](handleError(_0x5ea683,null));};exports[_0xa8d0('0x88')]=function(_0x975558,_0x4dad88){return _0x975558['user']['getVoiceQueues']({'where':{'type':_0xa8d0('0x89'),'dialActive':!![],'dialMethod':_0xa8d0('0x6b')},'attributes':['id'],'raw':!![]})[_0xa8d0('0x3e')](function(_0x1815c8){if(_0x1815c8&&_0x1815c8[_0xa8d0('0x30')]){return db[_0xa8d0('0x3c')][_0xa8d0('0x3d')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()['format'](_0xa8d0('0x59'))},'VoiceQueueId':{'$in':_['map'](_0x1815c8,'id')},'$or':[{'UserId':null},{'UserId':_0x975558[_0xa8d0('0x55')]['id']}]}});}return 0x0;})[_0xa8d0('0x3e')](function(_0x379286){if(!_[_0xa8d0('0x62')](_0x379286)&&_[_0xa8d0('0x8a')](_0x379286)){return _0x4dad88[_0xa8d0('0x6')](0xc8)['json']({'contacts':_0x379286});}else{logger['error']('CmHopper,\x20%s,\x20%s,\x20%s',_0xa8d0('0x88'),0x194,_0xa8d0('0x8b'));_0x4dad88[_0xa8d0('0xe')](0x194);}})[_0xa8d0('0x43')](handleError(_0x4dad88,null));};exports[_0xa8d0('0x8c')]=function(_0x2e439b,_0xfcdf8c){var _0x543521=shared['timezones'];var _0x458af1=[];_[_0xa8d0('0x38')](_0x543521,function(_0x4eb658){_0x458af1[_0xa8d0('0x8d')]({'id':_0x4eb658['name'],'name':_0x4eb658['name'],'utcOffset':_0x4eb658[_0xa8d0('0x8e')]});});return _0xfcdf8c[_0xa8d0('0x6')](0xc8)[_0xa8d0('0xc')]({'tz':_0x458af1});};exports[_0xa8d0('0x8f')]=function(_0x1d8197,_0x2be1ad){var _0x76609=shared[_0xa8d0('0x90')];var _0x4fc9fe={};if(!_[_0xa8d0('0x62')](_0x76609[_0x1d8197['body']['id']]))_0x4fc9fe=_0x76609[_0x1d8197[_0xa8d0('0x47')]['id']];return _0x2be1ad[_0xa8d0('0x6')](0xc8)[_0xa8d0('0xc')](_0x4fc9fe);}; \ No newline at end of file +var _0xa7e6=['fieldName','type','key','model','map','query','keys','filters','intersection','concat','$and','$gt','$gte','$lte','$ne','$eq','$not','$between','$notBetween','$notIn','$like','$notLike','$iLike','$notILike','$contains','$contained','$any','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','includeAll','findAll','rows','catch','show','params','merge','options','find','create','body','describe','destroy','VoiceQueueId','VoiceQueue','Campaign','name','dataValues','createdAt','state','statedesc','deleted','campaign','membername','user','deletedat','format','YYYY-MM-DD\x20HH:mm:ss','phone','campaigntype','queue','ivr','ContactId','firstName','lastName','isNil','calleridname','finally','CmHopperFinal','CmHopperAdditionalPhone','CmContact','getVoiceQueues','outbound','preview','dialOrderByScheduledAt','dialPreviewAutoRecallMe','value','hopperIds','priority','ASC','scheduledAt','DESC','literal','sequelize','COALESCE(CmHopper.UserId,\x200)\x20DESC','scheduledat','recallme','LOCK','UPDATE','Contact','CmCompany','Company','Queue','dialActive','getPreviewRecall','transaction','findOne','CmList','getOpenContacts','isNumber','error','CmHopper,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','getTimezones','push','utcOffset','getTimezone','timezones','moment','lodash','../../components/parsers/qs','../../config/logger','api','../../config/environment','status','json','offset','undefined','limit','count','set','update','then','sendStatus','stack','index','CmHopper','rawAttributes'];(function(_0x3b114d,_0x29350f){var _0x119b3c=function(_0x1842b5){while(--_0x1842b5){_0x3b114d['push'](_0x3b114d['shift']());}};_0x119b3c(++_0x29350f);}(_0xa7e6,0x74));var _0x6a7e=function(_0x6fd276,_0x32ca86){_0x6fd276=_0x6fd276-0x0;var _0x870689=_0xa7e6[_0x6fd276];return _0x870689;};'use strict';var moment=require(_0x6a7e('0x0'));var _=require(_0x6a7e('0x1'));var qs=require(_0x6a7e('0x2'));var logger=require(_0x6a7e('0x3'))(_0x6a7e('0x4'));var shared=require(_0x6a7e('0x5'));var db=require('../../mysqldb')['db'];function respondWithResult(_0x3ccca2,_0x8787b5){_0x8787b5=_0x8787b5||0xc8;return function(_0x1ea310){if(_0x1ea310){return _0x3ccca2[_0x6a7e('0x6')](_0x8787b5)[_0x6a7e('0x7')](_0x1ea310);}};}function respondWithFilteredResult(_0x599006,_0x79df6f){return function(_0x16249d){if(_0x16249d){var _0x37165d=typeof _0x79df6f[_0x6a7e('0x8')]===_0x6a7e('0x9')&&typeof _0x79df6f[_0x6a7e('0xa')]===_0x6a7e('0x9');var _0x403962=_0x16249d[_0x6a7e('0xb')];var _0x5f4ff2=_0x37165d?0x0:_0x79df6f['offset'];var _0x557627=_0x37165d?_0x16249d['count']:_0x79df6f[_0x6a7e('0x8')]+_0x79df6f[_0x6a7e('0xa')];var _0x292822;if(_0x557627>=_0x403962){_0x557627=_0x403962;_0x292822=0xc8;}else{_0x292822=0xce;}_0x599006[_0x6a7e('0x6')](_0x292822);return _0x599006[_0x6a7e('0xc')]('Content-Range',_0x5f4ff2+'-'+_0x557627+'/'+_0x403962)[_0x6a7e('0x7')](_0x16249d);}return null;};}function saveUpdates(_0x4754ef,_0x5c0c74){return function(_0x50dcc1){if(_0x50dcc1){return _0x50dcc1[_0x6a7e('0xd')](_0x4754ef)[_0x6a7e('0xe')](function(_0x1ac6da){return _0x1ac6da;});}return null;};}function handleEntityNotFound(_0x374763,_0x4faca9){return function(_0x3137bc){if(!_0x3137bc){_0x374763[_0x6a7e('0xf')](0x194);}return _0x3137bc;};}function handleError(_0x306b83,_0x4576fe){_0x4576fe=_0x4576fe||0x1f4;return function(_0x465566){logger['error'](_0x465566[_0x6a7e('0x10')]);if(_0x465566['name']){delete _0x465566['name'];}_0x306b83[_0x6a7e('0x6')](_0x4576fe)['send'](_0x465566);};}exports[_0x6a7e('0x11')]=function(_0x195761,_0x470197){var _0x470d49={},_0x20e90a={},_0x53abe9={'count':0x0,'rows':[]};var _0x4c3763=_['map'](db[_0x6a7e('0x12')][_0x6a7e('0x13')],function(_0x327565){return{'name':_0x327565[_0x6a7e('0x14')],'type':_0x327565[_0x6a7e('0x15')][_0x6a7e('0x16')]};});_0x20e90a[_0x6a7e('0x17')]=_[_0x6a7e('0x18')](_0x4c3763,'name');_0x20e90a[_0x6a7e('0x19')]=_[_0x6a7e('0x1a')](_0x195761['query']);_0x20e90a[_0x6a7e('0x1b')]=_[_0x6a7e('0x1c')](_0x20e90a[_0x6a7e('0x17')],_0x20e90a['query']);_0x20e90a[_0x6a7e('0x1b')]=_[_0x6a7e('0x1d')](_0x20e90a['filters'],[_0x6a7e('0x1e'),'$or',_0x6a7e('0x1f'),_0x6a7e('0x20'),'$lt',_0x6a7e('0x21'),_0x6a7e('0x22'),_0x6a7e('0x23'),_0x6a7e('0x24'),_0x6a7e('0x25'),_0x6a7e('0x26'),'$in',_0x6a7e('0x27'),_0x6a7e('0x28'),_0x6a7e('0x29'),_0x6a7e('0x2a'),_0x6a7e('0x2b'),'$like','$overlap',_0x6a7e('0x2c'),_0x6a7e('0x2d'),_0x6a7e('0x2e')]);_0x470d49['attributes']=_[_0x6a7e('0x1c')](_0x20e90a['model'],qs[_0x6a7e('0x2f')](_0x195761['query']['fields']));_0x470d49[_0x6a7e('0x30')]=_0x470d49['attributes'][_0x6a7e('0x31')]?_0x470d49['attributes']:_0x20e90a['model'];if(!_0x195761[_0x6a7e('0x19')][_0x6a7e('0x32')](_0x6a7e('0x33'))){_0x470d49[_0x6a7e('0xa')]=qs[_0x6a7e('0xa')](_0x195761[_0x6a7e('0x19')][_0x6a7e('0xa')]);_0x470d49[_0x6a7e('0x8')]=qs[_0x6a7e('0x8')](_0x195761[_0x6a7e('0x19')][_0x6a7e('0x8')]);}_0x470d49[_0x6a7e('0x34')]=qs['sort'](_0x195761[_0x6a7e('0x19')][_0x6a7e('0x35')]);_0x470d49[_0x6a7e('0x36')]=qs['filters'](_[_0x6a7e('0x37')](_0x195761[_0x6a7e('0x19')],_0x20e90a[_0x6a7e('0x1b')]),_0x4c3763);if(_0x195761[_0x6a7e('0x19')][_0x6a7e('0x38')]){_0x470d49[_0x6a7e('0x36')]=_['merge'](_0x470d49['where'],{'$or':_[_0x6a7e('0x18')](_0x4c3763,function(_0x5d3789){if(_0x5d3789[_0x6a7e('0x15')]!==_0x6a7e('0x39')){var _0x5e30cd={};_0x5e30cd[_0x5d3789['name']]={'$like':'%'+_0x195761['query'][_0x6a7e('0x38')]+'%'};return _0x5e30cd;}})});}_0x470d49=_['merge']({},_0x470d49,_0x195761['options']);var _0x512430={'where':_0x470d49['where']};return db[_0x6a7e('0x12')]['count'](_0x512430)[_0x6a7e('0xe')](function(_0x39d544){_0x53abe9[_0x6a7e('0xb')]=_0x39d544;if(_0x195761[_0x6a7e('0x19')][_0x6a7e('0x3a')]){_0x470d49['include']=[{'all':!![]}];}return db[_0x6a7e('0x12')][_0x6a7e('0x3b')](_0x470d49);})['then'](function(_0x3d146f){_0x53abe9[_0x6a7e('0x3c')]=_0x3d146f;return _0x53abe9;})['then'](respondWithFilteredResult(_0x470197,_0x470d49))[_0x6a7e('0x3d')](handleError(_0x470197,null));};exports[_0x6a7e('0x3e')]=function(_0x34b0ef,_0x920c54){var _0x2827f7={'raw':!![],'where':{'id':_0x34b0ef[_0x6a7e('0x3f')]['id']}},_0x28a62e={};_0x28a62e[_0x6a7e('0x17')]=_[_0x6a7e('0x1a')](db[_0x6a7e('0x12')][_0x6a7e('0x13')]);_0x28a62e['query']=_['keys'](_0x34b0ef[_0x6a7e('0x19')]);_0x28a62e[_0x6a7e('0x1b')]=_['intersection'](_0x28a62e[_0x6a7e('0x17')],_0x28a62e[_0x6a7e('0x19')]);_0x2827f7[_0x6a7e('0x30')]=_[_0x6a7e('0x1c')](_0x28a62e[_0x6a7e('0x17')],qs[_0x6a7e('0x2f')](_0x34b0ef[_0x6a7e('0x19')][_0x6a7e('0x2f')]));_0x2827f7[_0x6a7e('0x30')]=_0x2827f7[_0x6a7e('0x30')][_0x6a7e('0x31')]?_0x2827f7[_0x6a7e('0x30')]:_0x28a62e[_0x6a7e('0x17')];if(_0x34b0ef[_0x6a7e('0x19')]['includeAll']){_0x2827f7['include']=[{'all':!![]}];}_0x2827f7=_[_0x6a7e('0x40')]({},_0x2827f7,_0x34b0ef[_0x6a7e('0x41')]);return db[_0x6a7e('0x12')][_0x6a7e('0x42')](_0x2827f7)[_0x6a7e('0xe')](handleEntityNotFound(_0x920c54,null))[_0x6a7e('0xe')](respondWithResult(_0x920c54,null))[_0x6a7e('0x3d')](handleError(_0x920c54,null));};exports[_0x6a7e('0x43')]=function(_0x5cdd48,_0x380e24){return db['CmHopper'][_0x6a7e('0x43')](_0x5cdd48[_0x6a7e('0x44')],{})[_0x6a7e('0xe')](respondWithResult(_0x380e24,0xc9))[_0x6a7e('0x3d')](handleError(_0x380e24,null));};exports['update']=function(_0x248189,_0xc7f6b9){if(_0x248189[_0x6a7e('0x44')]['id']){delete _0x248189['body']['id'];}return db[_0x6a7e('0x12')]['find']({'where':{'id':_0x248189[_0x6a7e('0x3f')]['id']}})[_0x6a7e('0xe')](handleEntityNotFound(_0xc7f6b9,null))[_0x6a7e('0xe')](saveUpdates(_0x248189[_0x6a7e('0x44')],null))['then'](respondWithResult(_0xc7f6b9,null))[_0x6a7e('0x3d')](handleError(_0xc7f6b9,null));};exports[_0x6a7e('0x45')]=function(_0x188ab5,_0x3991bc){return db['CmHopper'][_0x6a7e('0x45')]()['then'](respondWithResult(_0x3991bc,null))[_0x6a7e('0x3d')](handleError(_0x3991bc,null));};exports[_0x6a7e('0x46')]=function(_0x25c2bb,_0x4a7465){var _0xd3252d;var _0x58f58b=_0x25c2bb[_0x6a7e('0x3f')]['id'];return db['CmHopper'][_0x6a7e('0x42')]({'where':{'id':_0x25c2bb[_0x6a7e('0x3f')]['id']}})[_0x6a7e('0xe')](handleEntityNotFound(_0x4a7465,null))[_0x6a7e('0xe')](function(_0x2f2874){if(_0x2f2874){return _0x2f2874[_0x6a7e('0x46')]()['then'](function(_0x3d4395){return _0x3d4395;});}})[_0x6a7e('0xe')](function(_0x27c1e9){_0xd3252d=_0x27c1e9;if(_0x27c1e9){if(_0x27c1e9[_0x6a7e('0x47')]||_0x27c1e9['CampaignId']){return db[_0x27c1e9['VoiceQueueId']?_0x6a7e('0x48'):_0x6a7e('0x49')][_0x6a7e('0x42')]({'where':{'id':_0x27c1e9[_0x6a7e('0x47')]?_0x27c1e9[_0x6a7e('0x47')]:_0x27c1e9['CampaignId']},'attributes':['id',_0x6a7e('0x4a')],'raw':!![]});}}})[_0x6a7e('0xe')](function(_0xe1b38e){var _0x367b8b={};if(_0xe1b38e){_['merge'](_0x367b8b,_['omit'](_0xd3252d[_0x6a7e('0x4b')],[_0x6a7e('0x4c'),'updatedAt','id']));_0x367b8b[_0x6a7e('0x4d')]=0x15;_0x367b8b[_0x6a7e('0x4e')]=_0x6a7e('0x4f');_0x367b8b[_0x6a7e('0x50')]=_0xe1b38e[_0x6a7e('0x4a')];_0x367b8b[_0x6a7e('0x51')]=_0x25c2bb[_0x6a7e('0x52')][_0x6a7e('0x4a')];_0x367b8b['UserId']=_0x25c2bb[_0x6a7e('0x52')]['id'];_0x367b8b[_0x6a7e('0x4f')]=!![];_0x367b8b[_0x6a7e('0x53')]=moment()[_0x6a7e('0x54')](_0x6a7e('0x55'));_0x367b8b['calleridnum']=_0xd3252d[_0x6a7e('0x56')];_0x367b8b[_0x6a7e('0x57')]=_0xd3252d[_0x6a7e('0x47')]?_0x6a7e('0x58'):_0x6a7e('0x59');return db['CmContact'][_0x6a7e('0x42')]({'where':{'id':_0x367b8b[_0x6a7e('0x5a')]},'attributes':[_0x6a7e('0x5b'),_0x6a7e('0x5c')]})['then'](function(_0x2a0592){if(!_[_0x6a7e('0x5d')](_0x4a7465)&&!_[_0x6a7e('0x5d')](_0x2a0592[_0x6a7e('0x5b')])){_0x367b8b[_0x6a7e('0x5e')]=_0x2a0592[_0x6a7e('0x5b')];if(!_['isNil'](_0x2a0592[_0x6a7e('0x5c')])){_0x367b8b[_0x6a7e('0x5e')]+='\x20'+_0x2a0592[_0x6a7e('0x5c')];}}})[_0x6a7e('0x5f')](function(){return db[_0x6a7e('0x60')]['create'](_0x367b8b);});}})[_0x6a7e('0xe')](function(_0x61a72){return db[_0x6a7e('0x61')][_0x6a7e('0x46')]({'where':{'CmHopperId':_0x58f58b}});})['then'](function(){return _0x4a7465[_0x6a7e('0x6')](0xcc)['end']();})['catch'](handleError(_0x4a7465,null));};exports['getPreview']=function(_0x368ffb,_0x3374c7){var _0x5dc96c=[];return db[_0x6a7e('0x62')][_0x6a7e('0x45')]()[_0x6a7e('0xe')](function(_0x512d15){_0x5dc96c=_[_0x6a7e('0x1a')](_0x512d15);return _0x368ffb[_0x6a7e('0x52')][_0x6a7e('0x63')]({'where':{'type':_0x6a7e('0x64'),'dialActive':!![],'dialMethod':_0x6a7e('0x65')},'attributes':['id',_0x6a7e('0x66'),'dialPreviewAutoRecallMe'],'raw':!![]});})[_0x6a7e('0xe')](function(_0x1f76ea){if(_0x1f76ea&&_0x1f76ea[_0x6a7e('0x31')]){return db['sequelize']['transaction'](function(_0x13e653){var _0x231dd1={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x6a7e('0x54')]('YYYY-MM-DD\x20HH:mm:ss')},'VoiceQueueId':{'$in':_['map'](_0x1f76ea,'id')},'$or':[{'UserId':null},{'UserId':_0x368ffb[_0x6a7e('0x52')]['id']}]};var _0x2ea436={'active':![],'recallme':!![],'VoiceQueueId':{'$in':_(_0x1f76ea)[_0x6a7e('0x38')]([_0x6a7e('0x67'),0x0])[_0x6a7e('0x18')]('id')[_0x6a7e('0x68')]()},'$or':[{'UserId':null},{'UserId':_0x368ffb[_0x6a7e('0x52')]['id']}]};var _0x450dd7={'$or':[_0x231dd1,_0x2ea436]};var _0x4cee5f=[];if(_0x368ffb[_0x6a7e('0x44')]['direction']&&_0x368ffb[_0x6a7e('0x44')]['direction']==='prev'){if(!_['isEmpty'](_0x368ffb[_0x6a7e('0x44')]['hopperIds'])){_0x450dd7['id']={'$in':_0x368ffb[_0x6a7e('0x44')][_0x6a7e('0x69')]};}_0x4cee5f=[[_0x6a7e('0x6a'),_0x6a7e('0x6b')],[_0x6a7e('0x6c'),_0x1f76ea[0x0][_0x6a7e('0x66')]===_0x6a7e('0x6b')?_0x6a7e('0x6d'):_0x6a7e('0x6b')],db['sequelize'][_0x6a7e('0x6e')]('COALESCE(CmHopper.UserId,\x200)\x20ASC'),['id',_0x6a7e('0x6d')]];}else{if(!_['isEmpty'](_0x368ffb['body'][_0x6a7e('0x69')])){_0x450dd7['id']={'$notIn':_0x368ffb[_0x6a7e('0x44')][_0x6a7e('0x69')]};}_0x4cee5f=[[_0x6a7e('0x6a'),_0x6a7e('0x6d')],[_0x6a7e('0x6c'),_0x1f76ea[0x0][_0x6a7e('0x66')]],db[_0x6a7e('0x6f')]['literal'](_0x6a7e('0x70')),['id','ASC']];}return db[_0x6a7e('0x12')]['findOne']({'attributes':['id',_0x6a7e('0x71'),_0x6a7e('0x56'),_0x6a7e('0x72')],'where':_0x450dd7,'order':_0x4cee5f,'transaction':_0x13e653,'lock':_0x13e653[_0x6a7e('0x73')][_0x6a7e('0x74')],'include':[{'model':db[_0x6a7e('0x62')],'as':_0x6a7e('0x75'),'attributes':_0x5dc96c,'include':[{'model':db[_0x6a7e('0x76')],'as':_0x6a7e('0x77'),'attributes':['id','name']}]},{'model':db['CmList'],'as':'List','attributes':['id',_0x6a7e('0x4a')]},{'model':db[_0x6a7e('0x48')],'as':_0x6a7e('0x78'),'attributes':['id',_0x6a7e('0x4a'),_0x6a7e('0x79')]}]})[_0x6a7e('0xe')](function(_0x272095){if(_0x272095){return _0x272095[_0x6a7e('0xd')]({'UserId':_0x368ffb[_0x6a7e('0x52')]['id']},{'transaction':_0x13e653});}});});}})[_0x6a7e('0xe')](handleEntityNotFound(_0x3374c7,null))['then'](respondWithResult(_0x3374c7,null))[_0x6a7e('0x3d')](handleError(_0x3374c7,null));};exports[_0x6a7e('0x7a')]=function(_0x209e33,_0x441118,_0x1e278b){var _0x51bc53=[];var _0x1d4a2d=_0x209e33[_0x6a7e('0x3f')]['id'];var _0x5bf64a=_0x209e33[_0x6a7e('0x52')]['id'];return db[_0x6a7e('0x62')][_0x6a7e('0x45')]()['then'](function(_0x42f01c){_0x51bc53=_[_0x6a7e('0x1a')](_0x42f01c);return db[_0x6a7e('0x6f')][_0x6a7e('0x7b')](function(_0x2e8c01){const _0x4ee7e5={'id':_0x1d4a2d};return db['CmHopper'][_0x6a7e('0x7c')]({'attributes':['id',_0x6a7e('0x71'),_0x6a7e('0x72')],'where':_0x4ee7e5,'transaction':_0x2e8c01,'lock':_0x2e8c01[_0x6a7e('0x73')]['UPDATE'],'include':[{'model':db['CmContact'],'as':_0x6a7e('0x75'),'attributes':_0x51bc53,'include':[{'model':db['CmCompany'],'as':_0x6a7e('0x77'),'attributes':['id',_0x6a7e('0x4a')]}]},{'model':db[_0x6a7e('0x7d')],'as':'List','attributes':['id',_0x6a7e('0x4a')]},{'model':db[_0x6a7e('0x48')],'as':_0x6a7e('0x78'),'attributes':['id',_0x6a7e('0x4a'),_0x6a7e('0x79')]}]})['then'](function(_0x3cc9d9){if(_0x3cc9d9){return _0x3cc9d9['update']({'UserId':_0x5bf64a},{'transaction':_0x2e8c01});}});});})[_0x6a7e('0xe')](handleEntityNotFound(_0x441118,null))[_0x6a7e('0xe')](respondWithResult(_0x441118,null))[_0x6a7e('0x3d')](handleError(_0x441118,null));};exports[_0x6a7e('0x7e')]=function(_0x4ece6e,_0xd1b6ed){return _0x4ece6e[_0x6a7e('0x52')][_0x6a7e('0x63')]({'where':{'type':'outbound','dialActive':!![],'dialMethod':'preview'},'attributes':['id'],'raw':!![]})[_0x6a7e('0xe')](function(_0xcf4ba4){if(_0xcf4ba4&&_0xcf4ba4[_0x6a7e('0x31')]){return db['CmHopper']['count']({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()['format'](_0x6a7e('0x55'))},'VoiceQueueId':{'$in':_[_0x6a7e('0x18')](_0xcf4ba4,'id')},'$or':[{'UserId':null},{'UserId':_0x4ece6e[_0x6a7e('0x52')]['id']}]}});}return 0x0;})[_0x6a7e('0xe')](function(_0x412db8){if(!_[_0x6a7e('0x5d')](_0x412db8)&&_[_0x6a7e('0x7f')](_0x412db8)){return _0xd1b6ed[_0x6a7e('0x6')](0xc8)[_0x6a7e('0x7')]({'contacts':_0x412db8});}else{logger[_0x6a7e('0x80')](_0x6a7e('0x81'),'getOpenContacts',0x194,_0x6a7e('0x82'));_0xd1b6ed[_0x6a7e('0xf')](0x194);}})[_0x6a7e('0x3d')](handleError(_0xd1b6ed,null));};exports[_0x6a7e('0x83')]=function(_0x33c930,_0x540998){var _0x340e63=shared['timezones'];var _0x42aac=[];_['map'](_0x340e63,function(_0x2f7e23){_0x42aac[_0x6a7e('0x84')]({'id':_0x2f7e23[_0x6a7e('0x4a')],'name':_0x2f7e23[_0x6a7e('0x4a')],'utcOffset':_0x2f7e23[_0x6a7e('0x85')]});});return _0x540998[_0x6a7e('0x6')](0xc8)['json']({'tz':_0x42aac});};exports[_0x6a7e('0x86')]=function(_0x2ac6f,_0x4ee0de){var _0x481c8b=shared[_0x6a7e('0x87')];var _0x37fd3e={};if(!_[_0x6a7e('0x5d')](_0x481c8b[_0x2ac6f[_0x6a7e('0x44')]['id']]))_0x37fd3e=_0x481c8b[_0x2ac6f['body']['id']];return _0x4ee0de[_0x6a7e('0x6')](0xc8)['json'](_0x37fd3e);}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.model.js b/server/api/cmHopper/cmHopper.model.js index 69067b3..836705a 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 _0xe3da=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cmHopper.attributes','exports','define','CmHopper','scheduledat','priority','lodash','util','../../config/logger'];(function(_0x29ccc1,_0x554f10){var _0x377137=function(_0x28e17b){while(--_0x28e17b){_0x29ccc1['push'](_0x29ccc1['shift']());}};_0x377137(++_0x554f10);}(_0xe3da,0x1cd));var _0xae3d=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xe3da[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0xae3d('0x0'));var util=require(_0xae3d('0x1'));var logger=require(_0xae3d('0x2'))(_0xae3d('0x3'));var moment=require(_0xae3d('0x4'));var BPromise=require(_0xae3d('0x5'));var rp=require(_0xae3d('0x6'));var fs=require('fs');var path=require(_0xae3d('0x7'));var rimraf=require(_0xae3d('0x8'));var config=require(_0xae3d('0x9'));var attributes=require(_0xae3d('0xa'));module[_0xae3d('0xb')]=function(_0xa9a1a,_0xa54808){return _0xa9a1a[_0xae3d('0xc')](_0xae3d('0xd'),attributes,{'tableName':'cm_hopper','paranoid':![],'indexes':[{'name':_0xae3d('0xe'),'fields':[_0xae3d('0xe')]},{'name':'phone','fields':['phone']},{'name':_0xae3d('0xf'),'fields':[_0xae3d('0xf')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x90b1=['priority','lodash','util','../../config/logger','bluebird','request-promise','path','rimraf','define','CmHopper','cm_hopper','scheduledat','phone'];(function(_0x432fca,_0xb0b1b5){var _0x3adba4=function(_0x5e3ae4){while(--_0x5e3ae4){_0x432fca['push'](_0x432fca['shift']());}};_0x3adba4(++_0xb0b1b5);}(_0x90b1,0x1bb));var _0x190b=function(_0x1374f1,_0x19f66f){_0x1374f1=_0x1374f1-0x0;var _0x3f109d=_0x90b1[_0x1374f1];return _0x3f109d;};'use strict';var _=require(_0x190b('0x0'));var util=require(_0x190b('0x1'));var logger=require(_0x190b('0x2'))('api');var moment=require('moment');var BPromise=require(_0x190b('0x3'));var rp=require(_0x190b('0x4'));var fs=require('fs');var path=require(_0x190b('0x5'));var rimraf=require(_0x190b('0x6'));var config=require('../../config/environment');var attributes=require('./cmHopper.attributes');module['exports']=function(_0x5da9c1,_0x27ff8c){return _0x5da9c1[_0x190b('0x7')](_0x190b('0x8'),attributes,{'tableName':_0x190b('0x9'),'paranoid':![],'indexes':[{'name':_0x190b('0xa'),'fields':[_0x190b('0xa')]},{'name':_0x190b('0xb'),'fields':['phone']},{'name':_0x190b('0xc'),'fields':[_0x190b('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.rpc.js b/server/api/cmHopper/cmHopper.rpc.js index 06862f1..9d885e5 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 _0x6f8b=['find','where','info','create','body','CreateCmHopper','UpdateCmHopper','update','UpdateCmHopper\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','active','DestroyCmHopper','destroy','GetContactDialer','CmContact','describe','sequelize','transaction','UPDATE','Contact','keys','Agent','voicePause','length','UserId','push','all','GetContactDialer\x20hopperId\x20[%s]\x20-\x20contactId\x20[%s]\x20-\x20active\x20status\x20[%s]','dataValues','ContactId','CmHopperFinal','MoveContactManagedDialer\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','CountReScheduled','`scheduledat`\x20>=\x20','format','\x22%s\x22','YYYY-MM-DD\x20HH:mm:ss','\x20,\x201,\x20null','contactsRescheduled','GetContactRecallMe','GetContactByPhone','findOne','dialTimezone','DESC','getContactByPhone','ResetActiveCalls','voiceQueueIds','interval','availableAgentsIds','\x20MINUTE','literal','NOW()','User','CmList','List','CmHopperHandlePreviewRecallNotifications','lodash','moment','bluebird','../../config/logger','GetCmHopper','CmHopper','findAll','options','raw','limit','map','include','model','attributes','then','debug','stringify','catch','message','error','ShowCmHopper'];(function(_0x51ab83,_0x2721b9){var _0x14b6de=function(_0x243483){while(--_0x243483){_0x51ab83['push'](_0x51ab83['shift']());}};_0x14b6de(++_0x2721b9);}(_0x6f8b,0x1b3));var _0xb6f8=function(_0x3bc4ac,_0x252d64){_0x3bc4ac=_0x3bc4ac-0x0;var _0x16bd94=_0x6f8b[_0x3bc4ac];return _0x16bd94;};'use strict';var _=require(_0xb6f8('0x0'));var util=require('util');var moment=require(_0xb6f8('0x1'));var BPromise=require(_0xb6f8('0x2'));var db=require('../../mysqldb')['db'];var logger=require(_0xb6f8('0x3'))('rpc');exports[_0xb6f8('0x4')]=function(_0x4c26e7){var _0x309ad7=this;return new Promise(function(_0x427f0f,_0x436b40){return db[_0xb6f8('0x5')][_0xb6f8('0x6')]({'raw':_0x4c26e7['options']?_0x4c26e7[_0xb6f8('0x7')][_0xb6f8('0x8')]===undefined?!![]:![]:!![],'where':_0x4c26e7[_0xb6f8('0x7')]?_0x4c26e7[_0xb6f8('0x7')]['where']||null:null,'attributes':_0x4c26e7['options']?_0x4c26e7[_0xb6f8('0x7')]['attributes']||null:null,'limit':_0x4c26e7['options']?_0x4c26e7[_0xb6f8('0x7')][_0xb6f8('0x9')]||null:null,'include':_0x4c26e7[_0xb6f8('0x7')]?_0x4c26e7[_0xb6f8('0x7')]['include']?_[_0xb6f8('0xa')](_0x4c26e7['options'][_0xb6f8('0xb')],function(_0x3333bc){return{'model':db[_0x3333bc[_0xb6f8('0xc')]],'as':_0x3333bc['as'],'attributes':_0x3333bc['attributes'],'include':_0x3333bc[_0xb6f8('0xb')]?_[_0xb6f8('0xa')](_0x3333bc[_0xb6f8('0xb')],function(_0x4e8bd3){return{'model':db[_0x4e8bd3[_0xb6f8('0xc')]],'as':_0x4e8bd3['as'],'attributes':_0x4e8bd3[_0xb6f8('0xd')],'include':_0x4e8bd3[_0xb6f8('0xb')]?_[_0xb6f8('0xa')](_0x4e8bd3[_0xb6f8('0xb')],function(_0x102fd2){return{'model':db[_0x102fd2[_0xb6f8('0xc')]],'as':_0x102fd2['as'],'attributes':_0x102fd2['attributes']};}):[]};}):[]};}):[]:[]})[_0xb6f8('0xe')](function(_0x215c5a){logger['info'](_0xb6f8('0x4'),_0x4c26e7);logger[_0xb6f8('0xf')](_0xb6f8('0x4'),_0x4c26e7,JSON[_0xb6f8('0x10')](_0x215c5a));_0x427f0f(_0x215c5a);})[_0xb6f8('0x11')](function(_0xb3736d){logger['error'](_0xb6f8('0x4'),_0xb3736d[_0xb6f8('0x12')],_0x4c26e7);_0x436b40(_0x309ad7[_0xb6f8('0x13')](0x1f4,_0xb3736d[_0xb6f8('0x12')]));});});};exports[_0xb6f8('0x14')]=function(_0x355278){var _0x555ae6=this;return new Promise(function(_0x5a0fc4,_0x41b470){return db[_0xb6f8('0x5')][_0xb6f8('0x15')]({'raw':_0x355278['options']?_0x355278[_0xb6f8('0x7')]['raw']===undefined?!![]:![]:!![],'where':_0x355278['options']?_0x355278[_0xb6f8('0x7')][_0xb6f8('0x16')]||null:null,'attributes':_0x355278[_0xb6f8('0x7')]?_0x355278[_0xb6f8('0x7')][_0xb6f8('0xd')]||null:null,'include':_0x355278[_0xb6f8('0x7')]?_0x355278[_0xb6f8('0x7')][_0xb6f8('0xb')]?_[_0xb6f8('0xa')](_0x355278[_0xb6f8('0x7')]['include'],function(_0x54af6a){return{'model':db[_0x54af6a[_0xb6f8('0xc')]],'as':_0x54af6a['as'],'attributes':_0x54af6a[_0xb6f8('0xd')],'include':_0x54af6a['include']?_[_0xb6f8('0xa')](_0x54af6a[_0xb6f8('0xb')],function(_0x319669){return{'model':db[_0x319669['model']],'as':_0x319669['as'],'attributes':_0x319669[_0xb6f8('0xd')],'include':_0x319669[_0xb6f8('0xb')]?_[_0xb6f8('0xa')](_0x319669[_0xb6f8('0xb')],function(_0x149fcd){return{'model':db[_0x149fcd[_0xb6f8('0xc')]],'as':_0x149fcd['as'],'attributes':_0x149fcd[_0xb6f8('0xd')]};}):[]};}):[]};}):[]:[]})[_0xb6f8('0xe')](function(_0x19e144){logger[_0xb6f8('0x17')](_0xb6f8('0x14'),_0x355278);logger[_0xb6f8('0xf')]('ShowCmHopper',_0x355278,JSON[_0xb6f8('0x10')](_0x19e144));_0x5a0fc4(_0x19e144);})[_0xb6f8('0x11')](function(_0x238634){logger[_0xb6f8('0x13')](_0xb6f8('0x14'),_0x238634['message'],_0x355278);_0x41b470(_0x555ae6[_0xb6f8('0x13')](0x1f4,_0x238634['message']));});});};exports['CreateCmHopper']=function(_0x2b96d5){var _0x3b1816=this;return new Promise(function(_0x40982b,_0x969d98){return db[_0xb6f8('0x5')][_0xb6f8('0x18')](_0x2b96d5[_0xb6f8('0x19')],{'raw':_0x2b96d5[_0xb6f8('0x7')]?_0x2b96d5[_0xb6f8('0x7')]['raw']===undefined?!![]:![]:!![]})[_0xb6f8('0xe')](function(_0x44566d){logger['info'](_0xb6f8('0x1a'),_0x2b96d5);logger[_0xb6f8('0xf')](_0xb6f8('0x1a'),_0x2b96d5,JSON[_0xb6f8('0x10')](_0x44566d));_0x40982b(_0x44566d);})['catch'](function(_0x401f7c){logger[_0xb6f8('0x13')](_0xb6f8('0x1a'),_0x401f7c[_0xb6f8('0x12')],_0x2b96d5);_0x969d98(_0x3b1816[_0xb6f8('0x13')](0x1f4,_0x401f7c[_0xb6f8('0x12')]));});});};exports[_0xb6f8('0x1b')]=function(_0x47a332){var _0x52062c=this;return new Promise(function(_0x9db1da,_0x4ac7cc){return db[_0xb6f8('0x5')][_0xb6f8('0x1c')](_0x47a332[_0xb6f8('0x19')],{'raw':_0x47a332[_0xb6f8('0x7')]?_0x47a332['options'][_0xb6f8('0x8')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x47a332[_0xb6f8('0x7')]?_0x47a332[_0xb6f8('0x7')]['where']||null:null,'attributes':_0x47a332[_0xb6f8('0x7')]?_0x47a332[_0xb6f8('0x7')]['attributes']||null:null,'limit':_0x47a332[_0xb6f8('0x7')]?_0x47a332[_0xb6f8('0x7')][_0xb6f8('0x9')]||null:null})[_0xb6f8('0xe')](function(_0x5aa62b){logger[_0xb6f8('0x17')](_0xb6f8('0x1b'),_0x47a332);logger[_0xb6f8('0x17')](_0xb6f8('0x1d'),JSON[_0xb6f8('0x10')](_0x47a332['options'][_0xb6f8('0x16')]),_0x47a332[_0xb6f8('0x19')][_0xb6f8('0x1e')]);logger['debug']('UpdateCmHopper',_0x47a332,JSON['stringify'](_0x5aa62b));_0x9db1da(_0x5aa62b);})[_0xb6f8('0x11')](function(_0x4b93cd){logger['error'](_0xb6f8('0x1b'),_0x4b93cd[_0xb6f8('0x12')],_0x47a332);_0x4ac7cc(_0x52062c[_0xb6f8('0x13')](0x1f4,_0x4b93cd[_0xb6f8('0x12')]));});});};exports[_0xb6f8('0x1f')]=function(_0x26cf20){var _0x31fcf4=this;return new Promise(function(_0x3ca4eb,_0x3b4c80){return db[_0xb6f8('0x5')][_0xb6f8('0x20')]({'where':_0x26cf20[_0xb6f8('0x7')]?_0x26cf20[_0xb6f8('0x7')][_0xb6f8('0x16')]||null:null})[_0xb6f8('0xe')](function(_0x17b9ff){logger[_0xb6f8('0x17')](_0xb6f8('0x1f'),_0x26cf20);logger[_0xb6f8('0xf')](_0xb6f8('0x1f'),_0x26cf20,JSON['stringify'](_0x17b9ff));_0x3ca4eb(_0x17b9ff);})[_0xb6f8('0x11')](function(_0xd886f2){logger[_0xb6f8('0x13')](_0xb6f8('0x1f'),_0xd886f2[_0xb6f8('0x12')],_0x26cf20);_0x3b4c80(_0x31fcf4[_0xb6f8('0x13')](0x1f4,_0xd886f2[_0xb6f8('0x12')]));});});};exports[_0xb6f8('0x21')]=function(_0x528b76){var _0x4088fd=this;return new Promise(function(_0x5552fd,_0x1a3bde){return db[_0xb6f8('0x22')][_0xb6f8('0x23')]()[_0xb6f8('0xe')](function(_0x4d959c){return db[_0xb6f8('0x24')][_0xb6f8('0x25')](function(_0x160f04){return db['CmHopper'][_0xb6f8('0x6')]({'where':_0x528b76[_0xb6f8('0x7')]?_0x528b76[_0xb6f8('0x7')][_0xb6f8('0x16')]||null:null,'attributes':_0x528b76['options']?_0x528b76[_0xb6f8('0x7')][_0xb6f8('0xd')]||null:null,'limit':_0x528b76[_0xb6f8('0x7')]?_0x528b76[_0xb6f8('0x7')][_0xb6f8('0x9')]||null:null,'order':_0x528b76[_0xb6f8('0x7')]?_0x528b76[_0xb6f8('0x7')]['order']||null:null,'transaction':_0x160f04,'lock':_0x160f04['LOCK'][_0xb6f8('0x26')],'include':[{'model':db[_0xb6f8('0x22')],'as':_0xb6f8('0x27'),'attributes':_[_0xb6f8('0x28')](_0x4d959c)},{'model':db['User'],'as':_0xb6f8('0x29'),'attributes':['id','name',_0xb6f8('0x2a')]}]})[_0xb6f8('0xe')](function(_0x5c96d7){var _0x1e3a3d=[];var _0x32e660=[];for(var _0x1e22f6=0x0;_0x1e22f6<_0x5c96d7[_0xb6f8('0x2b')];_0x1e22f6+=0x1){var _0x240195=_0x5c96d7[_0x1e22f6][_0xb6f8('0x2c')];if(_0x240195===null){_0x1e3a3d[_0xb6f8('0x2d')](_0x5c96d7[_0x1e22f6][_0xb6f8('0x1c')](_0x528b76[_0xb6f8('0x19')],{'transaction':_0x160f04}));}else if(!_0x32e660['includes'](_0x240195)){_0x32e660[_0xb6f8('0x2d')](_0x240195);_0x1e3a3d['push'](_0x5c96d7[_0x1e22f6]['update'](_0x528b76[_0xb6f8('0x19')],{'transaction':_0x160f04}));}}return BPromise[_0xb6f8('0x2e')](_0x1e3a3d);});})[_0xb6f8('0xe')](function(_0x1c07ce){logger['info']('GetContactDialer',_0x528b76);if(_0x1c07ce[_0xb6f8('0x2b')]>0x0){logger[_0xb6f8('0x17')](_0xb6f8('0x2f'),_0x1c07ce[0x0][_0xb6f8('0x30')]['id'],_0x1c07ce[0x0][_0xb6f8('0x30')][_0xb6f8('0x31')],_0x1c07ce[0x0]['dataValues'][_0xb6f8('0x1e')]);}logger['debug'](_0xb6f8('0x21'),_0x528b76,JSON[_0xb6f8('0x10')](_0x1c07ce));_0x5552fd(_0x1c07ce);})[_0xb6f8('0x11')](function(_0x1d51ca){logger[_0xb6f8('0x13')]('GetContactDialer',_0x1d51ca['message'],_0x528b76);_0x1a3bde(_0x4088fd[_0xb6f8('0x13')](0x1f4,_0x1d51ca[_0xb6f8('0x12')]));});});});};exports['MoveContactManagedDialer']=function(_0x3dde1c){var _0x261721=this;return new Promise(function(_0x2f71db,_0x1a1623){return db[_0xb6f8('0x24')]['transaction'](function(_0xdcf13d){return db[_0xb6f8('0x32')][_0xb6f8('0x18')](_0x3dde1c[_0xb6f8('0x19')],{'raw':_0x3dde1c[_0xb6f8('0x7')]?_0x3dde1c['options'][_0xb6f8('0x8')]===undefined?!![]:![]:!![],'transaction':_0xdcf13d})[_0xb6f8('0xe')](function(){logger['info'](_0xb6f8('0x33'),JSON[_0xb6f8('0x10')](_0x3dde1c['options'][_0xb6f8('0x16')]),_0x3dde1c[_0xb6f8('0x7')][_0xb6f8('0x16')][_0xb6f8('0x1e')]);return db[_0xb6f8('0x5')]['destroy']({'where':_0x3dde1c[_0xb6f8('0x7')]?_0x3dde1c[_0xb6f8('0x7')][_0xb6f8('0x16')]||null:null,'transaction':_0xdcf13d});});})[_0xb6f8('0xe')](function(_0x18c10b){logger[_0xb6f8('0x17')]('MoveContactManagedDialer',_0x3dde1c);logger[_0xb6f8('0xf')]('MoveContactManagedDialer',_0x3dde1c,JSON['stringify'](_0x18c10b));_0x2f71db(_0x18c10b);})[_0xb6f8('0x11')](function(_0x39dc2b){logger['error']('MoveContactManagedDialer',_0x39dc2b[_0xb6f8('0x12')],_0x3dde1c);_0x1a1623(_0x261721['error'](0x1f4,_0x39dc2b[_0xb6f8('0x12')]));});});};exports[_0xb6f8('0x34')]=function(_0x46e921){var _0x2d4768=this;return new Promise(function(_0x1a33aa,_0x45ca38){return db[_0xb6f8('0x5')][_0xb6f8('0x6')]({'raw':_0x46e921[_0xb6f8('0x7')]?_0x46e921[_0xb6f8('0x7')][_0xb6f8('0x8')]===undefined?!![]:![]:!![],'where':_0x46e921[_0xb6f8('0x7')]?_0x46e921['options'][_0xb6f8('0x16')]||null:null,'attributes':[[db[_0xb6f8('0x24')]['fn']('COUNT',db[_0xb6f8('0x24')]['fn']('IF',db['sequelize']['literal'](_0xb6f8('0x35')+util[_0xb6f8('0x36')](_0xb6f8('0x37'),moment()['format'](_0xb6f8('0x38')))+_0xb6f8('0x39')))),_0xb6f8('0x3a')]]})[_0xb6f8('0xe')](function(_0x188aed){logger[_0xb6f8('0x17')](_0xb6f8('0x34'),_0x46e921);logger[_0xb6f8('0xf')](_0xb6f8('0x34'),_0x46e921,JSON[_0xb6f8('0x10')](_0x188aed));_0x1a33aa(_0x188aed);})[_0xb6f8('0x11')](function(_0x4058ff){logger['error'](_0xb6f8('0x34'),_0x4058ff[_0xb6f8('0x12')],_0x46e921);_0x45ca38(_0x2d4768['error'](0x1f4,_0x4058ff[_0xb6f8('0x12')]));});});};exports[_0xb6f8('0x3b')]=function(_0x54f7c3){var _0x1d1282=this;return new Promise(function(_0x38c34d,_0x3aa667){return db[_0xb6f8('0x22')]['describe']()[_0xb6f8('0xe')](function(){return db[_0xb6f8('0x24')][_0xb6f8('0x25')](function(_0x1eff36){return db['CmHopper'][_0xb6f8('0x6')]({'where':_0x54f7c3['options']?_0x54f7c3[_0xb6f8('0x7')][_0xb6f8('0x16')]||null:null,'attributes':_0x54f7c3[_0xb6f8('0x7')]?_0x54f7c3['options'][_0xb6f8('0xd')]||null:null,'limit':0x1,'order':_0x54f7c3[_0xb6f8('0x7')]?_0x54f7c3['options']['order']||null:null,'group':db[_0xb6f8('0x5')][_0xb6f8('0x2c')],'transaction':_0x1eff36,'lock':_0x1eff36['LOCK'][_0xb6f8('0x26')],'include':_0x54f7c3[_0xb6f8('0x7')]?_0x54f7c3[_0xb6f8('0x7')][_0xb6f8('0xb')]?_[_0xb6f8('0xa')](_0x54f7c3['options']['include'],function(_0x486b0b){return{'model':db[_0x486b0b[_0xb6f8('0xc')]],'as':_0x486b0b['as'],'attributes':_0x486b0b[_0xb6f8('0xd')],'include':_0x486b0b[_0xb6f8('0xb')]?_[_0xb6f8('0xa')](_0x486b0b[_0xb6f8('0xb')],function(_0x33fa77){return{'model':db[_0x33fa77[_0xb6f8('0xc')]],'as':_0x33fa77['as'],'attributes':_0x33fa77[_0xb6f8('0xd')],'include':_0x33fa77[_0xb6f8('0xb')]?_[_0xb6f8('0xa')](_0x33fa77['include'],function(_0x2d8a0c){return{'model':db[_0x2d8a0c['model']],'as':_0x2d8a0c['as'],'attributes':_0x2d8a0c['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x2aa26e){var _0xd5af88=[];for(var _0x5ef3b5=0x0;_0x5ef3b5<_0x2aa26e['length'];_0x5ef3b5+=0x1){_0xd5af88[_0xb6f8('0x2d')](_0x2aa26e[_0x5ef3b5][_0xb6f8('0x1c')](_0x54f7c3['body'],{'transaction':_0x1eff36}));}return BPromise[_0xb6f8('0x2e')](_0xd5af88);});})[_0xb6f8('0xe')](function(_0x101675){logger[_0xb6f8('0x17')](_0xb6f8('0x3b'),_0x54f7c3);logger[_0xb6f8('0xf')](_0xb6f8('0x3b'),_0x54f7c3,JSON[_0xb6f8('0x10')](_0x101675));_0x38c34d(_0x101675);})[_0xb6f8('0x11')](function(_0x2d626d){logger[_0xb6f8('0x13')](_0xb6f8('0x3b'),_0x2d626d['message'],_0x54f7c3);_0x3aa667(_0x1d1282[_0xb6f8('0x13')](0x1f4,_0x2d626d[_0xb6f8('0x12')]));});});});};exports['GetCmHopperPreview']=function(_0x3e8031){var _0x23a6a6=this;return new Promise(function(_0x2fb220,_0x33c3b3){db['CmContact'][_0xb6f8('0x23')]()[_0xb6f8('0xe')](function(_0x12ad15){return db[_0xb6f8('0x5')][_0xb6f8('0x6')]({'raw':_0x3e8031[_0xb6f8('0x7')]?_0x3e8031[_0xb6f8('0x7')]['raw']===undefined?!![]:![]:!![],'where':_0x3e8031['options']?_0x3e8031[_0xb6f8('0x7')]['where']||null:null,'attributes':_0x3e8031[_0xb6f8('0x7')]?_0x3e8031[_0xb6f8('0x7')][_0xb6f8('0xd')]||null:null,'limit':_0x3e8031[_0xb6f8('0x7')]?_0x3e8031[_0xb6f8('0x7')][_0xb6f8('0x9')]||null:null,'include':_0x3e8031[_0xb6f8('0x7')]?_0x3e8031['options']['include']?_[_0xb6f8('0xa')](_0x3e8031['options'][_0xb6f8('0xb')],function(_0x22e254){return{'model':db[_0x22e254[_0xb6f8('0xc')]],'as':_0x22e254['as'],'attributes':_0x22e254['as']===_0xb6f8('0x27')?_[_0xb6f8('0x28')](_0x12ad15):_0x22e254[_0xb6f8('0xd')],'include':_0x22e254[_0xb6f8('0xb')]?_[_0xb6f8('0xa')](_0x22e254[_0xb6f8('0xb')],function(_0x275d39){return{'model':db[_0x275d39[_0xb6f8('0xc')]],'as':_0x275d39['as'],'attributes':_0x275d39[_0xb6f8('0xd')],'include':_0x275d39['include']?_['map'](_0x275d39['include'],function(_0x46b478){return{'model':db[_0x46b478[_0xb6f8('0xc')]],'as':_0x46b478['as'],'attributes':_0x46b478[_0xb6f8('0xd')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x51262c){logger['info'](_0xb6f8('0x4'),_0x3e8031);logger[_0xb6f8('0xf')](_0xb6f8('0x4'),_0x3e8031,JSON[_0xb6f8('0x10')](_0x51262c));_0x2fb220(_0x51262c);})[_0xb6f8('0x11')](function(_0x459211){logger[_0xb6f8('0x13')]('GetCmHopper',_0x459211[_0xb6f8('0x12')],_0x3e8031);_0x33c3b3(_0x23a6a6[_0xb6f8('0x13')](0x1f4,_0x459211[_0xb6f8('0x12')]));});});});};exports[_0xb6f8('0x3c')]=function(_0x26be51){var _0x570c47=this;return new Promise(function(_0x559e2b,_0x3eaf12){return db['CmContact'][_0xb6f8('0x3d')]({'raw':!![],'where':{'phone':_0x26be51[_0xb6f8('0x7')]['where']['phone']},'attributes':['id',_0xb6f8('0x3e')],'order':[['id',_0xb6f8('0x3f')]]})['then'](function(_0x3f50cd){logger['info'](_0xb6f8('0x40'),_0x26be51);logger[_0xb6f8('0xf')](_0xb6f8('0x40'),_0x26be51,JSON[_0xb6f8('0x10')](_0x3f50cd));_0x559e2b(_0x3f50cd);})[_0xb6f8('0x11')](function(_0x474755){logger[_0xb6f8('0x13')](_0xb6f8('0x40'),_0x474755[_0xb6f8('0x12')],_0x26be51);_0x3eaf12(_0x570c47[_0xb6f8('0x13')](0x1f4,_0x474755[_0xb6f8('0x12')]));});});};exports['ResetActiveCalls']=function(_0x279e46){var _0x8a1297=this;return new Promise(function(_0x1e3098,_0x31155b){return db[_0xb6f8('0x24')][_0xb6f8('0x25')](function(_0x144319){var _0x4c246a=_0x279e46['options']&&_0x279e46[_0xb6f8('0x7')][_0xb6f8('0x16')]?_0x279e46[_0xb6f8('0x7')][_0xb6f8('0x16')]:{};return db[_0xb6f8('0x5')][_0xb6f8('0x1c')](_0x279e46[_0xb6f8('0x19')],{'where':_0x4c246a,'transaction':_0x144319})['then'](function(_0x2739c6){logger[_0xb6f8('0x17')](_0xb6f8('0x41'),_0x279e46);logger['debug'](_0xb6f8('0x41'),_0x279e46,JSON[_0xb6f8('0x10')](_0x2739c6));_0x1e3098(_0x2739c6);})['catch'](function(_0x3f6e96){logger[_0xb6f8('0x13')](_0xb6f8('0x41'),_0x3f6e96['message'],_0x279e46);_0x31155b(_0x8a1297[_0xb6f8('0x13')](0x1f4,_0x3f6e96[_0xb6f8('0x12')]));});});});};exports['CmHopperHandlePreviewRecallNotifications']=function(_0x1c69a3){var _0x5a5f35=this;var _0x4e55df=_0x1c69a3[_0xb6f8('0x19')][_0xb6f8('0x16')][_0xb6f8('0x42')];var _0x420ef4=_0x1c69a3[_0xb6f8('0x19')][_0xb6f8('0x16')][_0xb6f8('0x43')];var _0x444005=_0x1c69a3[_0xb6f8('0x19')]['where'][_0xb6f8('0x44')];return new Promise(function(_0x593e80,_0x23caa0){return db[_0xb6f8('0x5')][_0xb6f8('0x6')]({'where':{'voiceQueueId':{'$in':_0x4e55df},'recallme':0x1,'active':0x0,'recallmeNotifiedDate':{'$eq':null},'scheduledat':{'$and':{'$lte':db['sequelize']['literal']('NOW()\x20+\x20INTERVAL\x20'+_0x420ef4+_0xb6f8('0x45')),'$gt':db['sequelize'][_0xb6f8('0x46')](_0xb6f8('0x47'))}},'UserId':{'$in':_0x444005}},'include':[{'model':db[_0xb6f8('0x22')],'as':_0xb6f8('0x27')},{'model':db[_0xb6f8('0x48')],'as':'Agent','attributes':['id','name','voicePause']},{'model':db[_0xb6f8('0x49')],'as':_0xb6f8('0x4a')}]})[_0xb6f8('0xe')](function(_0x45b481){if(_0x45b481[_0xb6f8('0x2b')]>0x0){return db[_0xb6f8('0x24')][_0xb6f8('0x25')](function(_0x57609d){return db[_0xb6f8('0x5')][_0xb6f8('0x1c')]({'recallmeNotifiedDate':db[_0xb6f8('0x24')][_0xb6f8('0x46')]('NOW()')},{'where':{'id':{'$in':_['map'](_0x45b481,'id')}},'transaction':_0x57609d})['then'](function(){_0x593e80(_0x45b481);})[_0xb6f8('0x11')](function(_0x4766a1){logger['error'](_0xb6f8('0x4b'),_0x4766a1['message'],_0x1c69a3);_0x23caa0(_0x5a5f35['error'](0x1f4,_0x4766a1['message']));});})[_0xb6f8('0x11')](function(_0x447a14){logger[_0xb6f8('0x13')](_0xb6f8('0x4b'),_0x447a14['message'],_0x1c69a3);_0x23caa0(_0x5a5f35[_0xb6f8('0x13')](0x1f4,_0x447a14[_0xb6f8('0x12')]));});}else{_0x593e80(_0x45b481);}});});}; \ No newline at end of file +var _0x8dd1=['GetContactDialer\x20hopperId\x20[%s]\x20-\x20contactId\x20[%s]\x20-\x20active\x20status\x20[%s]','dataValues','MoveContactManagedDialer','transaction','CmHopperFinal','MoveContactManagedDialer\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','COUNT','literal','`scheduledat`\x20>=\x20','format','\x22%s\x22','YYYY-MM-DD\x20HH:mm:ss','CountReScheduled','GetContactRecallMe','order','GetCmHopperPreview','GetContactByPhone','findOne','dialTimezone','DESC','getContactByPhone','ResetActiveCalls','CmHopperHandlePreviewRecallNotifications','availableAgentsIds','NOW()\x20+\x20INTERVAL\x20','\x20MINUTE','NOW()','Agent','List','lodash','util','moment','../../mysqldb','rpc','GetCmHopper','CmHopper','findAll','options','raw','where','attributes','limit','map','include','model','then','info','stringify','catch','error','message','ShowCmHopper','debug','CreateCmHopper','create','body','update','UpdateCmHopper','UpdateCmHopper\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','active','DestroyCmHopper','destroy','GetContactDialer','CmContact','describe','sequelize','LOCK','UPDATE','Contact','User','name','voicePause','length','UserId','push','all'];(function(_0x13d183,_0x4ea26a){var _0x4cf208=function(_0x29e956){while(--_0x29e956){_0x13d183['push'](_0x13d183['shift']());}};_0x4cf208(++_0x4ea26a);}(_0x8dd1,0x1e5));var _0x18dd=function(_0x13a4bf,_0x56cb27){_0x13a4bf=_0x13a4bf-0x0;var _0x2933d6=_0x8dd1[_0x13a4bf];return _0x2933d6;};'use strict';var _=require(_0x18dd('0x0'));var util=require(_0x18dd('0x1'));var moment=require(_0x18dd('0x2'));var BPromise=require('bluebird');var db=require(_0x18dd('0x3'))['db'];var logger=require('../../config/logger')(_0x18dd('0x4'));exports[_0x18dd('0x5')]=function(_0x1bccbf){var _0x1726fa=this;return new Promise(function(_0x4c99bf,_0x1093fe){return db[_0x18dd('0x6')][_0x18dd('0x7')]({'raw':_0x1bccbf[_0x18dd('0x8')]?_0x1bccbf[_0x18dd('0x8')][_0x18dd('0x9')]===undefined?!![]:![]:!![],'where':_0x1bccbf[_0x18dd('0x8')]?_0x1bccbf['options'][_0x18dd('0xa')]||null:null,'attributes':_0x1bccbf['options']?_0x1bccbf[_0x18dd('0x8')][_0x18dd('0xb')]||null:null,'limit':_0x1bccbf[_0x18dd('0x8')]?_0x1bccbf[_0x18dd('0x8')][_0x18dd('0xc')]||null:null,'include':_0x1bccbf[_0x18dd('0x8')]?_0x1bccbf[_0x18dd('0x8')]['include']?_[_0x18dd('0xd')](_0x1bccbf[_0x18dd('0x8')][_0x18dd('0xe')],function(_0x390c69){return{'model':db[_0x390c69[_0x18dd('0xf')]],'as':_0x390c69['as'],'attributes':_0x390c69['attributes'],'include':_0x390c69[_0x18dd('0xe')]?_[_0x18dd('0xd')](_0x390c69[_0x18dd('0xe')],function(_0x1b0a98){return{'model':db[_0x1b0a98[_0x18dd('0xf')]],'as':_0x1b0a98['as'],'attributes':_0x1b0a98[_0x18dd('0xb')],'include':_0x1b0a98[_0x18dd('0xe')]?_[_0x18dd('0xd')](_0x1b0a98[_0x18dd('0xe')],function(_0x492b90){return{'model':db[_0x492b90[_0x18dd('0xf')]],'as':_0x492b90['as'],'attributes':_0x492b90[_0x18dd('0xb')]};}):[]};}):[]};}):[]:[]})[_0x18dd('0x10')](function(_0x52ace0){logger[_0x18dd('0x11')](_0x18dd('0x5'),_0x1bccbf);logger['debug'](_0x18dd('0x5'),_0x1bccbf,JSON[_0x18dd('0x12')](_0x52ace0));_0x4c99bf(_0x52ace0);})[_0x18dd('0x13')](function(_0x3fd247){logger[_0x18dd('0x14')]('GetCmHopper',_0x3fd247['message'],_0x1bccbf);_0x1093fe(_0x1726fa[_0x18dd('0x14')](0x1f4,_0x3fd247[_0x18dd('0x15')]));});});};exports[_0x18dd('0x16')]=function(_0x1ee3ce){var _0x2f7875=this;return new Promise(function(_0x63a095,_0x382fef){return db[_0x18dd('0x6')]['find']({'raw':_0x1ee3ce[_0x18dd('0x8')]?_0x1ee3ce[_0x18dd('0x8')]['raw']===undefined?!![]:![]:!![],'where':_0x1ee3ce[_0x18dd('0x8')]?_0x1ee3ce['options'][_0x18dd('0xa')]||null:null,'attributes':_0x1ee3ce[_0x18dd('0x8')]?_0x1ee3ce[_0x18dd('0x8')]['attributes']||null:null,'include':_0x1ee3ce[_0x18dd('0x8')]?_0x1ee3ce['options'][_0x18dd('0xe')]?_[_0x18dd('0xd')](_0x1ee3ce['options'][_0x18dd('0xe')],function(_0x46e628){return{'model':db[_0x46e628[_0x18dd('0xf')]],'as':_0x46e628['as'],'attributes':_0x46e628[_0x18dd('0xb')],'include':_0x46e628[_0x18dd('0xe')]?_[_0x18dd('0xd')](_0x46e628[_0x18dd('0xe')],function(_0x2fe101){return{'model':db[_0x2fe101[_0x18dd('0xf')]],'as':_0x2fe101['as'],'attributes':_0x2fe101[_0x18dd('0xb')],'include':_0x2fe101[_0x18dd('0xe')]?_[_0x18dd('0xd')](_0x2fe101[_0x18dd('0xe')],function(_0x95207c){return{'model':db[_0x95207c[_0x18dd('0xf')]],'as':_0x95207c['as'],'attributes':_0x95207c['attributes']};}):[]};}):[]};}):[]:[]})[_0x18dd('0x10')](function(_0x5b4516){logger['info'](_0x18dd('0x16'),_0x1ee3ce);logger[_0x18dd('0x17')]('ShowCmHopper',_0x1ee3ce,JSON[_0x18dd('0x12')](_0x5b4516));_0x63a095(_0x5b4516);})[_0x18dd('0x13')](function(_0x3998e8){logger[_0x18dd('0x14')](_0x18dd('0x16'),_0x3998e8['message'],_0x1ee3ce);_0x382fef(_0x2f7875[_0x18dd('0x14')](0x1f4,_0x3998e8[_0x18dd('0x15')]));});});};exports[_0x18dd('0x18')]=function(_0xb059d8){var _0x2435a2=this;return new Promise(function(_0x4ec73f,_0x2268e8){return db[_0x18dd('0x6')][_0x18dd('0x19')](_0xb059d8[_0x18dd('0x1a')],{'raw':_0xb059d8[_0x18dd('0x8')]?_0xb059d8[_0x18dd('0x8')]['raw']===undefined?!![]:![]:!![]})[_0x18dd('0x10')](function(_0x5f3fa2){logger[_0x18dd('0x11')]('CreateCmHopper',_0xb059d8);logger[_0x18dd('0x17')]('CreateCmHopper',_0xb059d8,JSON[_0x18dd('0x12')](_0x5f3fa2));_0x4ec73f(_0x5f3fa2);})['catch'](function(_0x3a50f2){logger[_0x18dd('0x14')]('CreateCmHopper',_0x3a50f2['message'],_0xb059d8);_0x2268e8(_0x2435a2['error'](0x1f4,_0x3a50f2[_0x18dd('0x15')]));});});};exports['UpdateCmHopper']=function(_0x42ea97){var _0x555ef8=this;return new Promise(function(_0x4233f1,_0x261dae){return db[_0x18dd('0x6')][_0x18dd('0x1b')](_0x42ea97[_0x18dd('0x1a')],{'raw':_0x42ea97[_0x18dd('0x8')]?_0x42ea97[_0x18dd('0x8')][_0x18dd('0x9')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x42ea97[_0x18dd('0x8')]?_0x42ea97[_0x18dd('0x8')]['where']||null:null,'attributes':_0x42ea97['options']?_0x42ea97[_0x18dd('0x8')][_0x18dd('0xb')]||null:null,'limit':_0x42ea97['options']?_0x42ea97[_0x18dd('0x8')][_0x18dd('0xc')]||null:null})[_0x18dd('0x10')](function(_0xb0046c){logger['info'](_0x18dd('0x1c'),_0x42ea97);logger['info'](_0x18dd('0x1d'),JSON['stringify'](_0x42ea97['options']['where']),_0x42ea97[_0x18dd('0x1a')][_0x18dd('0x1e')]);logger[_0x18dd('0x17')](_0x18dd('0x1c'),_0x42ea97,JSON[_0x18dd('0x12')](_0xb0046c));_0x4233f1(_0xb0046c);})[_0x18dd('0x13')](function(_0x1293a0){logger[_0x18dd('0x14')](_0x18dd('0x1c'),_0x1293a0['message'],_0x42ea97);_0x261dae(_0x555ef8[_0x18dd('0x14')](0x1f4,_0x1293a0[_0x18dd('0x15')]));});});};exports[_0x18dd('0x1f')]=function(_0x373d9){var _0x505df7=this;return new Promise(function(_0x3dca15,_0x2becd6){return db[_0x18dd('0x6')][_0x18dd('0x20')]({'where':_0x373d9['options']?_0x373d9[_0x18dd('0x8')][_0x18dd('0xa')]||null:null})[_0x18dd('0x10')](function(_0x2611a8){logger[_0x18dd('0x11')]('DestroyCmHopper',_0x373d9);logger[_0x18dd('0x17')](_0x18dd('0x1f'),_0x373d9,JSON['stringify'](_0x2611a8));_0x3dca15(_0x2611a8);})['catch'](function(_0x1d7f93){logger[_0x18dd('0x14')](_0x18dd('0x1f'),_0x1d7f93[_0x18dd('0x15')],_0x373d9);_0x2becd6(_0x505df7[_0x18dd('0x14')](0x1f4,_0x1d7f93[_0x18dd('0x15')]));});});};exports[_0x18dd('0x21')]=function(_0x16dc79){var _0x3920ca=this;return new Promise(function(_0x35fcd4,_0x46d32f){return db[_0x18dd('0x22')][_0x18dd('0x23')]()[_0x18dd('0x10')](function(_0x4f0ece){return db[_0x18dd('0x24')]['transaction'](function(_0x4bc960){return db[_0x18dd('0x6')]['findAll']({'where':_0x16dc79[_0x18dd('0x8')]?_0x16dc79[_0x18dd('0x8')][_0x18dd('0xa')]||null:null,'attributes':_0x16dc79[_0x18dd('0x8')]?_0x16dc79['options']['attributes']||null:null,'limit':_0x16dc79[_0x18dd('0x8')]?_0x16dc79[_0x18dd('0x8')][_0x18dd('0xc')]||null:null,'order':_0x16dc79[_0x18dd('0x8')]?_0x16dc79['options']['order']||null:null,'transaction':_0x4bc960,'lock':_0x4bc960[_0x18dd('0x25')][_0x18dd('0x26')],'include':[{'model':db[_0x18dd('0x22')],'as':_0x18dd('0x27'),'attributes':_['keys'](_0x4f0ece)},{'model':db[_0x18dd('0x28')],'as':'Agent','attributes':['id',_0x18dd('0x29'),_0x18dd('0x2a')]}]})['then'](function(_0x40971c){var _0x587246=[];var _0xc71eef=[];for(var _0x4930de=0x0;_0x4930de<_0x40971c[_0x18dd('0x2b')];_0x4930de+=0x1){var _0x34e59b=_0x40971c[_0x4930de][_0x18dd('0x2c')];if(_0x34e59b===null){_0x587246[_0x18dd('0x2d')](_0x40971c[_0x4930de][_0x18dd('0x1b')](_0x16dc79['body'],{'transaction':_0x4bc960}));}else if(!_0xc71eef['includes'](_0x34e59b)){_0xc71eef[_0x18dd('0x2d')](_0x34e59b);_0x587246[_0x18dd('0x2d')](_0x40971c[_0x4930de][_0x18dd('0x1b')](_0x16dc79[_0x18dd('0x1a')],{'transaction':_0x4bc960}));}}return BPromise[_0x18dd('0x2e')](_0x587246);});})[_0x18dd('0x10')](function(_0x45ca1b){logger['info'](_0x18dd('0x21'),_0x16dc79);if(_0x45ca1b['length']>0x0){logger[_0x18dd('0x11')](_0x18dd('0x2f'),_0x45ca1b[0x0][_0x18dd('0x30')]['id'],_0x45ca1b[0x0][_0x18dd('0x30')]['ContactId'],_0x45ca1b[0x0]['dataValues'][_0x18dd('0x1e')]);}logger[_0x18dd('0x17')](_0x18dd('0x21'),_0x16dc79,JSON[_0x18dd('0x12')](_0x45ca1b));_0x35fcd4(_0x45ca1b);})[_0x18dd('0x13')](function(_0x1d20ca){logger[_0x18dd('0x14')](_0x18dd('0x21'),_0x1d20ca[_0x18dd('0x15')],_0x16dc79);_0x46d32f(_0x3920ca['error'](0x1f4,_0x1d20ca[_0x18dd('0x15')]));});});});};exports[_0x18dd('0x31')]=function(_0x1e86ca){var _0xfef52=this;return new Promise(function(_0x1afc67,_0xb5cf84){return db[_0x18dd('0x24')][_0x18dd('0x32')](function(_0x64098f){return db[_0x18dd('0x33')][_0x18dd('0x19')](_0x1e86ca['body'],{'raw':_0x1e86ca[_0x18dd('0x8')]?_0x1e86ca[_0x18dd('0x8')][_0x18dd('0x9')]===undefined?!![]:![]:!![],'transaction':_0x64098f})['then'](function(){logger[_0x18dd('0x11')](_0x18dd('0x34'),JSON['stringify'](_0x1e86ca['options'][_0x18dd('0xa')]),_0x1e86ca[_0x18dd('0x8')][_0x18dd('0xa')][_0x18dd('0x1e')]);return db[_0x18dd('0x6')][_0x18dd('0x20')]({'where':_0x1e86ca[_0x18dd('0x8')]?_0x1e86ca[_0x18dd('0x8')][_0x18dd('0xa')]||null:null,'transaction':_0x64098f});});})[_0x18dd('0x10')](function(_0x2e3413){logger['info']('MoveContactManagedDialer',_0x1e86ca);logger['debug'](_0x18dd('0x31'),_0x1e86ca,JSON['stringify'](_0x2e3413));_0x1afc67(_0x2e3413);})['catch'](function(_0x3a0db1){logger[_0x18dd('0x14')](_0x18dd('0x31'),_0x3a0db1[_0x18dd('0x15')],_0x1e86ca);_0xb5cf84(_0xfef52['error'](0x1f4,_0x3a0db1['message']));});});};exports['CountReScheduled']=function(_0x56e65e){var _0x1d8a4c=this;return new Promise(function(_0x36f8e3,_0x51965c){return db['CmHopper'][_0x18dd('0x7')]({'raw':_0x56e65e[_0x18dd('0x8')]?_0x56e65e['options'][_0x18dd('0x9')]===undefined?!![]:![]:!![],'where':_0x56e65e['options']?_0x56e65e[_0x18dd('0x8')][_0x18dd('0xa')]||null:null,'attributes':[[db[_0x18dd('0x24')]['fn'](_0x18dd('0x35'),db['sequelize']['fn']('IF',db[_0x18dd('0x24')][_0x18dd('0x36')](_0x18dd('0x37')+util[_0x18dd('0x38')](_0x18dd('0x39'),moment()[_0x18dd('0x38')](_0x18dd('0x3a')))+'\x20,\x201,\x20null'))),'contactsRescheduled']]})[_0x18dd('0x10')](function(_0x681ec3){logger[_0x18dd('0x11')](_0x18dd('0x3b'),_0x56e65e);logger[_0x18dd('0x17')](_0x18dd('0x3b'),_0x56e65e,JSON[_0x18dd('0x12')](_0x681ec3));_0x36f8e3(_0x681ec3);})[_0x18dd('0x13')](function(_0x4749a5){logger[_0x18dd('0x14')](_0x18dd('0x3b'),_0x4749a5[_0x18dd('0x15')],_0x56e65e);_0x51965c(_0x1d8a4c[_0x18dd('0x14')](0x1f4,_0x4749a5[_0x18dd('0x15')]));});});};exports[_0x18dd('0x3c')]=function(_0x1eadae){var _0x551f44=this;return new Promise(function(_0x40eb5f,_0xebcf7b){return db[_0x18dd('0x22')][_0x18dd('0x23')]()[_0x18dd('0x10')](function(){return db[_0x18dd('0x24')][_0x18dd('0x32')](function(_0x501565){return db['CmHopper'][_0x18dd('0x7')]({'where':_0x1eadae[_0x18dd('0x8')]?_0x1eadae[_0x18dd('0x8')]['where']||null:null,'attributes':_0x1eadae['options']?_0x1eadae[_0x18dd('0x8')]['attributes']||null:null,'limit':0x1,'order':_0x1eadae[_0x18dd('0x8')]?_0x1eadae[_0x18dd('0x8')][_0x18dd('0x3d')]||null:null,'group':db[_0x18dd('0x6')]['UserId'],'transaction':_0x501565,'lock':_0x501565[_0x18dd('0x25')][_0x18dd('0x26')],'include':_0x1eadae['options']?_0x1eadae[_0x18dd('0x8')]['include']?_[_0x18dd('0xd')](_0x1eadae['options'][_0x18dd('0xe')],function(_0x339345){return{'model':db[_0x339345[_0x18dd('0xf')]],'as':_0x339345['as'],'attributes':_0x339345[_0x18dd('0xb')],'include':_0x339345[_0x18dd('0xe')]?_[_0x18dd('0xd')](_0x339345[_0x18dd('0xe')],function(_0x376370){return{'model':db[_0x376370[_0x18dd('0xf')]],'as':_0x376370['as'],'attributes':_0x376370[_0x18dd('0xb')],'include':_0x376370['include']?_[_0x18dd('0xd')](_0x376370[_0x18dd('0xe')],function(_0x59092d){return{'model':db[_0x59092d['model']],'as':_0x59092d['as'],'attributes':_0x59092d[_0x18dd('0xb')]};}):[]};}):[]};}):[]:[]})[_0x18dd('0x10')](function(_0x453788){var _0x2bb2c7=[];for(var _0x2abe6b=0x0;_0x2abe6b<_0x453788['length'];_0x2abe6b+=0x1){_0x2bb2c7[_0x18dd('0x2d')](_0x453788[_0x2abe6b][_0x18dd('0x1b')](_0x1eadae[_0x18dd('0x1a')],{'transaction':_0x501565}));}return BPromise['all'](_0x2bb2c7);});})['then'](function(_0x10956f){logger['info'](_0x18dd('0x3c'),_0x1eadae);logger[_0x18dd('0x17')](_0x18dd('0x3c'),_0x1eadae,JSON[_0x18dd('0x12')](_0x10956f));_0x40eb5f(_0x10956f);})['catch'](function(_0x5c9ec6){logger[_0x18dd('0x14')](_0x18dd('0x3c'),_0x5c9ec6[_0x18dd('0x15')],_0x1eadae);_0xebcf7b(_0x551f44[_0x18dd('0x14')](0x1f4,_0x5c9ec6[_0x18dd('0x15')]));});});});};exports[_0x18dd('0x3e')]=function(_0x5d09e4){var _0x2cc333=this;return new Promise(function(_0x5b9631,_0x3844c2){db[_0x18dd('0x22')]['describe']()[_0x18dd('0x10')](function(_0x51e015){return db[_0x18dd('0x6')][_0x18dd('0x7')]({'raw':_0x5d09e4[_0x18dd('0x8')]?_0x5d09e4['options'][_0x18dd('0x9')]===undefined?!![]:![]:!![],'where':_0x5d09e4[_0x18dd('0x8')]?_0x5d09e4[_0x18dd('0x8')][_0x18dd('0xa')]||null:null,'attributes':_0x5d09e4['options']?_0x5d09e4[_0x18dd('0x8')][_0x18dd('0xb')]||null:null,'limit':_0x5d09e4[_0x18dd('0x8')]?_0x5d09e4['options'][_0x18dd('0xc')]||null:null,'include':_0x5d09e4[_0x18dd('0x8')]?_0x5d09e4[_0x18dd('0x8')]['include']?_[_0x18dd('0xd')](_0x5d09e4['options'][_0x18dd('0xe')],function(_0x1bbb99){return{'model':db[_0x1bbb99[_0x18dd('0xf')]],'as':_0x1bbb99['as'],'attributes':_0x1bbb99['as']===_0x18dd('0x27')?_['keys'](_0x51e015):_0x1bbb99['attributes'],'include':_0x1bbb99['include']?_[_0x18dd('0xd')](_0x1bbb99[_0x18dd('0xe')],function(_0x5cf1a3){return{'model':db[_0x5cf1a3[_0x18dd('0xf')]],'as':_0x5cf1a3['as'],'attributes':_0x5cf1a3[_0x18dd('0xb')],'include':_0x5cf1a3[_0x18dd('0xe')]?_[_0x18dd('0xd')](_0x5cf1a3[_0x18dd('0xe')],function(_0x5cf8e0){return{'model':db[_0x5cf8e0[_0x18dd('0xf')]],'as':_0x5cf8e0['as'],'attributes':_0x5cf8e0[_0x18dd('0xb')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4228e4){logger[_0x18dd('0x11')](_0x18dd('0x5'),_0x5d09e4);logger['debug'](_0x18dd('0x5'),_0x5d09e4,JSON[_0x18dd('0x12')](_0x4228e4));_0x5b9631(_0x4228e4);})['catch'](function(_0x566906){logger[_0x18dd('0x14')]('GetCmHopper',_0x566906[_0x18dd('0x15')],_0x5d09e4);_0x3844c2(_0x2cc333[_0x18dd('0x14')](0x1f4,_0x566906['message']));});});});};exports[_0x18dd('0x3f')]=function(_0x3afce5){var _0x264d46=this;return new Promise(function(_0x34548d,_0x306431){return db[_0x18dd('0x22')][_0x18dd('0x40')]({'raw':!![],'where':{'phone':_0x3afce5[_0x18dd('0x8')][_0x18dd('0xa')]['phone']},'attributes':['id',_0x18dd('0x41')],'order':[['id',_0x18dd('0x42')]]})[_0x18dd('0x10')](function(_0x11a309){logger[_0x18dd('0x11')](_0x18dd('0x43'),_0x3afce5);logger[_0x18dd('0x17')](_0x18dd('0x43'),_0x3afce5,JSON['stringify'](_0x11a309));_0x34548d(_0x11a309);})[_0x18dd('0x13')](function(_0x4d24a2){logger[_0x18dd('0x14')](_0x18dd('0x43'),_0x4d24a2[_0x18dd('0x15')],_0x3afce5);_0x306431(_0x264d46[_0x18dd('0x14')](0x1f4,_0x4d24a2['message']));});});};exports[_0x18dd('0x44')]=function(_0x346ab1){var _0x38be85=this;return new Promise(function(_0x1cec56,_0x1dedab){return db[_0x18dd('0x24')]['transaction'](function(_0x11cd73){var _0x27fb1d=_0x346ab1[_0x18dd('0x8')]&&_0x346ab1[_0x18dd('0x8')][_0x18dd('0xa')]?_0x346ab1[_0x18dd('0x8')]['where']:{};return db[_0x18dd('0x6')]['update'](_0x346ab1['body'],{'where':_0x27fb1d,'transaction':_0x11cd73})[_0x18dd('0x10')](function(_0x4d8d71){logger[_0x18dd('0x11')](_0x18dd('0x44'),_0x346ab1);logger[_0x18dd('0x17')]('ResetActiveCalls',_0x346ab1,JSON[_0x18dd('0x12')](_0x4d8d71));_0x1cec56(_0x4d8d71);})[_0x18dd('0x13')](function(_0x2faf4b){logger[_0x18dd('0x14')](_0x18dd('0x44'),_0x2faf4b['message'],_0x346ab1);_0x1dedab(_0x38be85[_0x18dd('0x14')](0x1f4,_0x2faf4b['message']));});});});};exports[_0x18dd('0x45')]=function(_0x1acc52){var _0x21d9d3=this;var _0x58f124=_0x1acc52[_0x18dd('0x1a')]['where']['voiceQueueIds'];var _0x53b041=_0x1acc52[_0x18dd('0x1a')][_0x18dd('0xa')]['interval'];var _0x11af1f=_0x1acc52[_0x18dd('0x1a')][_0x18dd('0xa')][_0x18dd('0x46')];return new Promise(function(_0x2b9aa8,_0x55983b){return db[_0x18dd('0x6')]['findAll']({'where':{'voiceQueueId':{'$in':_0x58f124},'recallme':0x1,'active':0x0,'recallmeNotifiedDate':{'$eq':null},'scheduledat':{'$and':{'$lte':db[_0x18dd('0x24')][_0x18dd('0x36')](_0x18dd('0x47')+_0x53b041+_0x18dd('0x48')),'$gt':db[_0x18dd('0x24')][_0x18dd('0x36')](_0x18dd('0x49'))}},'UserId':{'$in':_0x11af1f}},'include':[{'model':db[_0x18dd('0x22')],'as':_0x18dd('0x27')},{'model':db[_0x18dd('0x28')],'as':_0x18dd('0x4a'),'attributes':['id',_0x18dd('0x29'),_0x18dd('0x2a')]},{'model':db['CmList'],'as':_0x18dd('0x4b')}]})[_0x18dd('0x10')](function(_0x1c2e6a){if(_0x1c2e6a[_0x18dd('0x2b')]>0x0){return db['sequelize'][_0x18dd('0x32')](function(_0x52d24f){return db[_0x18dd('0x6')][_0x18dd('0x1b')]({'recallmeNotifiedDate':db[_0x18dd('0x24')][_0x18dd('0x36')]('NOW()')},{'where':{'id':{'$in':_[_0x18dd('0xd')](_0x1c2e6a,'id')}},'transaction':_0x52d24f})[_0x18dd('0x10')](function(){_0x2b9aa8(_0x1c2e6a);})[_0x18dd('0x13')](function(_0x3f13f3){logger[_0x18dd('0x14')]('CmHopperHandlePreviewRecallNotifications',_0x3f13f3[_0x18dd('0x15')],_0x1acc52);_0x55983b(_0x21d9d3['error'](0x1f4,_0x3f13f3[_0x18dd('0x15')]));});})[_0x18dd('0x13')](function(_0x23c118){logger[_0x18dd('0x14')](_0x18dd('0x45'),_0x23c118[_0x18dd('0x15')],_0x1acc52);_0x55983b(_0x21d9d3[_0x18dd('0x14')](0x1f4,_0x23c118[_0x18dd('0x15')]));});}else{_0x2b9aa8(_0x1c2e6a);}});});}; \ No newline at end of file diff --git a/server/api/cmHopper/index.js b/server/api/cmHopper/index.js index 16af9f9..2622cc2 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 _0xf3fe=['destroy','exports','express','Router','./cmHopper.controller','get','isAuthenticated','index','/describe','/opencontacts','getOpenContacts','/timezones','getTimezones','/:id','show','/:id/previewrecall','getPreviewRecall','post','create','/preview','getPreview','/timezone','getTimezone','put','delete'];(function(_0x217cc8,_0x54a7e0){var _0x27be63=function(_0x25a773){while(--_0x25a773){_0x217cc8['push'](_0x217cc8['shift']());}};_0x27be63(++_0x54a7e0);}(_0xf3fe,0x160));var _0xef3f=function(_0x866ecf,_0x484490){_0x866ecf=_0x866ecf-0x0;var _0x359a7b=_0xf3fe[_0x866ecf];return _0x359a7b;};'use strict';var express=require(_0xef3f('0x0'));var router=express[_0xef3f('0x1')]();var auth=require('../../components/auth/service');var controller=require(_0xef3f('0x2'));router[_0xef3f('0x3')]('/',auth[_0xef3f('0x4')](),controller[_0xef3f('0x5')]);router[_0xef3f('0x3')](_0xef3f('0x6'),auth[_0xef3f('0x4')](),controller['describe']);router[_0xef3f('0x3')](_0xef3f('0x7'),auth['isAuthenticated'](),controller[_0xef3f('0x8')]);router[_0xef3f('0x3')](_0xef3f('0x9'),auth[_0xef3f('0x4')](),controller[_0xef3f('0xa')]);router[_0xef3f('0x3')](_0xef3f('0xb'),auth[_0xef3f('0x4')](),controller[_0xef3f('0xc')]);router[_0xef3f('0x3')](_0xef3f('0xd'),auth[_0xef3f('0x4')](),controller[_0xef3f('0xe')]);router[_0xef3f('0xf')]('/',auth[_0xef3f('0x4')](),controller[_0xef3f('0x10')]);router['post'](_0xef3f('0x11'),auth['isAuthenticated'](),controller[_0xef3f('0x12')]);router['post'](_0xef3f('0x13'),auth[_0xef3f('0x4')](),controller[_0xef3f('0x14')]);router[_0xef3f('0x15')](_0xef3f('0xb'),auth[_0xef3f('0x4')](),controller['update']);router[_0xef3f('0x16')]('/:id',auth[_0xef3f('0x4')](),controller[_0xef3f('0x17')]);module[_0xef3f('0x18')]=router; \ No newline at end of file +var _0xb42c=['describe','getOpenContacts','/timezones','getTimezones','/:id','show','/:id/previewrecall','getPreviewRecall','post','create','/preview','getPreview','/timezone','put','update','delete','destroy','Router','./cmHopper.controller','isAuthenticated','index','get','/describe'];(function(_0x2f8d07,_0xb712c8){var _0x444a96=function(_0x33168d){while(--_0x33168d){_0x2f8d07['push'](_0x2f8d07['shift']());}};_0x444a96(++_0xb712c8);}(_0xb42c,0x6d));var _0xcb42=function(_0x11cc79,_0x1970e8){_0x11cc79=_0x11cc79-0x0;var _0x4f591b=_0xb42c[_0x11cc79];return _0x4f591b;};'use strict';var express=require('express');var router=express[_0xcb42('0x0')]();var auth=require('../../components/auth/service');var controller=require(_0xcb42('0x1'));router['get']('/',auth[_0xcb42('0x2')](),controller[_0xcb42('0x3')]);router[_0xcb42('0x4')](_0xcb42('0x5'),auth[_0xcb42('0x2')](),controller[_0xcb42('0x6')]);router[_0xcb42('0x4')]('/opencontacts',auth[_0xcb42('0x2')](),controller[_0xcb42('0x7')]);router[_0xcb42('0x4')](_0xcb42('0x8'),auth[_0xcb42('0x2')](),controller[_0xcb42('0x9')]);router[_0xcb42('0x4')](_0xcb42('0xa'),auth['isAuthenticated'](),controller[_0xcb42('0xb')]);router[_0xcb42('0x4')](_0xcb42('0xc'),auth[_0xcb42('0x2')](),controller[_0xcb42('0xd')]);router[_0xcb42('0xe')]('/',auth['isAuthenticated'](),controller[_0xcb42('0xf')]);router['post'](_0xcb42('0x10'),auth[_0xcb42('0x2')](),controller[_0xcb42('0x11')]);router['post'](_0xcb42('0x12'),auth[_0xcb42('0x2')](),controller['getTimezone']);router[_0xcb42('0x13')](_0xcb42('0xa'),auth['isAuthenticated'](),controller[_0xcb42('0x14')]);router[_0xcb42('0x15')](_0xcb42('0xa'),auth[_0xcb42('0x2')](),controller[_0xcb42('0x16')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js index a9e8944..c3e56b6 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 _0x706b=['sequelize','exports','INTEGER','STRING','DATE','format'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x706b,0x14a));var _0xb706=function(_0x45e9be,_0x7c164e){_0x45e9be=_0x45e9be-0x0;var _0x52e243=_0x706b[_0x45e9be];return _0x52e243;};'use strict';var moment=require('moment');var Sequelize=require(_0xb706('0x0'));module[_0xb706('0x1')]={'CmHopperId':{'type':Sequelize[_0xb706('0x2')]},'phone':{'type':Sequelize[_0xb706('0x3')],'allowNull':![]},'OrderBy':{'type':Sequelize[_0xb706('0x2')],'defaultValue':0x0},'scheduledat':{'type':Sequelize[_0xb706('0x4')],'defaultValue':moment()[_0xb706('0x5')]('YYYY-MM-DD\x20HH:mm:ss')},'countbusyretry':{'type':Sequelize[_0xb706('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xb706('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnosuchnumberretry':{'type':Sequelize[_0xb706('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xb706('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xb706('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xb706('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x8566=['moment','sequelize','exports','INTEGER','STRING','DATE','format'];(function(_0x39b4c5,_0x51f394){var _0x2f1ad1=function(_0x49d2fa){while(--_0x49d2fa){_0x39b4c5['push'](_0x39b4c5['shift']());}};_0x2f1ad1(++_0x51f394);}(_0x8566,0x1a4));var _0x6856=function(_0x162aaa,_0xbc3555){_0x162aaa=_0x162aaa-0x0;var _0x1e3225=_0x8566[_0x162aaa];return _0x1e3225;};'use strict';var moment=require(_0x6856('0x0'));var Sequelize=require(_0x6856('0x1'));module[_0x6856('0x2')]={'CmHopperId':{'type':Sequelize[_0x6856('0x3')]},'phone':{'type':Sequelize[_0x6856('0x4')],'allowNull':![]},'OrderBy':{'type':Sequelize[_0x6856('0x3')],'defaultValue':0x0},'scheduledat':{'type':Sequelize[_0x6856('0x5')],'defaultValue':moment()[_0x6856('0x6')]('YYYY-MM-DD\x20HH:mm:ss')},'countbusyretry':{'type':Sequelize[_0x6856('0x3')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x6856('0x3')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x6856('0x3')],'defaultValue':0x0},'countnosuchnumberretry':{'type':Sequelize[_0x6856('0x3')],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x6856('0x3')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x6856('0x3')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.controller.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.controller.js index 2eb3781..a28f7b4 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 _0x00ea=['Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','catch','find','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','squel','crypto','desk.js','querystring','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','reject','save','update','then','destroy','CmHopperAdditionalPhones','name','send','index','CmHopperAdditionalPhone','rawAttributes','fieldName','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','filter','where','merge','type','VIRTUAL','options','include','show','params','includeAll','create','body','user','get'];(function(_0x47e7cb,_0x4c1b8d){var _0x2a8874=function(_0x36498f){while(--_0x36498f){_0x47e7cb['push'](_0x47e7cb['shift']());}};_0x2a8874(++_0x4c1b8d);}(_0x00ea,0x1d0));var _0xa00e=function(_0x4334ec,_0x15d4b1){_0x4334ec=_0x4334ec-0x0;var _0x16945d=_0x00ea[_0x4334ec];return _0x16945d;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xa00e('0x0'));var jsonpatch=require(_0xa00e('0x1'));var rp=require(_0xa00e('0x2'));var moment=require(_0xa00e('0x3'));var BPromise=require(_0xa00e('0x4'));var Mustache=require(_0xa00e('0x5'));var util=require(_0xa00e('0x6'));var path=require(_0xa00e('0x7'));var sox=require('sox');var csv=require(_0xa00e('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xa00e('0x9'));var crypto=require(_0xa00e('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xa00e('0xb'));var toCsv=require(_0xa00e('0x8'));var querystring=require(_0xa00e('0xc'));var Papa=require(_0xa00e('0xd'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xa00e('0xe'));var hardwareService=require(_0xa00e('0xf'));var logger=require('../../config/logger')('api');var utils=require(_0xa00e('0x10'));var config=require('../../config/environment');var licenseUtil=require(_0xa00e('0x11'));var db=require(_0xa00e('0x12'))['db'];function respondWithStatusCode(_0x1b90c2,_0x5e37db){_0x5e37db=_0x5e37db||0xcc;return function(_0x191004){if(_0x191004){return _0x1b90c2[_0xa00e('0x13')](_0x5e37db);}return _0x1b90c2[_0xa00e('0x14')](_0x5e37db)[_0xa00e('0x15')]();};}function respondWithResult(_0x1a96fb,_0x5abff2){_0x5abff2=_0x5abff2||0xc8;return function(_0x300b26){if(_0x300b26){return _0x1a96fb[_0xa00e('0x14')](_0x5abff2)[_0xa00e('0x16')](_0x300b26);}};}function respondWithFilteredResult(_0x1982e4,_0x528588){return function(_0x5ef3ae){if(_0x5ef3ae){var _0x24f2aa=typeof _0x528588[_0xa00e('0x17')]===_0xa00e('0x18')&&typeof _0x528588['limit']==='undefined';var _0x3f2370=_0x5ef3ae[_0xa00e('0x19')];var _0xde37c6=_0x24f2aa?0x0:_0x528588[_0xa00e('0x17')];var _0x314106=_0x24f2aa?_0x5ef3ae[_0xa00e('0x19')]:_0x528588[_0xa00e('0x17')]+_0x528588[_0xa00e('0x1a')];var _0x523e6c;if(_0x314106>=_0x3f2370){_0x314106=_0x3f2370;_0x523e6c=0xc8;}else{_0x523e6c=0xce;}_0x1982e4[_0xa00e('0x14')](_0x523e6c);return _0x1982e4[_0xa00e('0x1b')]('Content-Range',_0xde37c6+'-'+_0x314106+'/'+_0x3f2370)[_0xa00e('0x16')](_0x5ef3ae);}return null;};}function patchUpdates(_0x4c0300){return function(_0x1b6bb1){try{jsonpatch['apply'](_0x1b6bb1,_0x4c0300,!![]);}catch(_0x3b74c3){return BPromise[_0xa00e('0x1c')](_0x3b74c3);}return _0x1b6bb1[_0xa00e('0x1d')]();};}function saveUpdates(_0x12d20e,_0x3355a0){return function(_0x4de224){if(_0x4de224){return _0x4de224[_0xa00e('0x1e')](_0x12d20e)[_0xa00e('0x1f')](function(_0x27ebcc){return _0x27ebcc;});}return null;};}function removeEntity(_0x4e7887,_0x257541){return function(_0x1ac5bd){if(_0x1ac5bd){return _0x1ac5bd[_0xa00e('0x20')]()[_0xa00e('0x1f')](function(){var _0x4d29e=_0x1ac5bd['get']({'plain':!![]});var _0x3917ad=_0xa00e('0x21');return db['UserProfileResource'][_0xa00e('0x20')]({'where':{'type':_0x3917ad,'resourceId':_0x4d29e['id']}})[_0xa00e('0x1f')](function(){return _0x1ac5bd;});})['then'](function(){_0x4e7887['status'](0xcc)[_0xa00e('0x15')]();});}};}function handleEntityNotFound(_0x261517,_0x3d4c1b){return function(_0x5a55d8){if(!_0x5a55d8){_0x261517[_0xa00e('0x13')](0x194);}return _0x5a55d8;};}function handleError(_0x5bb62d,_0x548122){_0x548122=_0x548122||0x1f4;return function(_0x1bb85f){logger['error'](_0x1bb85f['stack']);if(_0x1bb85f[_0xa00e('0x22')]){delete _0x1bb85f['name'];}_0x5bb62d['status'](_0x548122)[_0xa00e('0x23')](_0x1bb85f);};}exports[_0xa00e('0x24')]=function(_0xb0c5c4,_0x4e366b){var _0x4d0072={},_0x31f901={},_0x3cba91={'count':0x0,'rows':[]};var _0x1d837f=_['map'](db[_0xa00e('0x25')][_0xa00e('0x26')],function(_0x261d0d){return{'name':_0x261d0d[_0xa00e('0x27')],'type':_0x261d0d['type'][_0xa00e('0x28')]};});_0x31f901[_0xa00e('0x29')]=_[_0xa00e('0x2a')](_0x1d837f,'name');_0x31f901[_0xa00e('0x2b')]=_[_0xa00e('0x2c')](_0xb0c5c4[_0xa00e('0x2b')]);_0x31f901[_0xa00e('0x2d')]=_[_0xa00e('0x2e')](_0x31f901[_0xa00e('0x29')],_0x31f901[_0xa00e('0x2b')]);_0x4d0072[_0xa00e('0x2f')]=_['intersection'](_0x31f901[_0xa00e('0x29')],qs[_0xa00e('0x30')](_0xb0c5c4[_0xa00e('0x2b')]['fields']));_0x4d0072[_0xa00e('0x2f')]=_0x4d0072[_0xa00e('0x2f')][_0xa00e('0x31')]?_0x4d0072[_0xa00e('0x2f')]:_0x31f901[_0xa00e('0x29')];if(!_0xb0c5c4[_0xa00e('0x2b')][_0xa00e('0x32')](_0xa00e('0x33'))){_0x4d0072[_0xa00e('0x1a')]=qs['limit'](_0xb0c5c4['query']['limit']);_0x4d0072[_0xa00e('0x17')]=qs['offset'](_0xb0c5c4[_0xa00e('0x2b')]['offset']);}_0x4d0072['order']=qs[_0xa00e('0x34')](_0xb0c5c4['query'][_0xa00e('0x34')]);_0x4d0072['where']=qs[_0xa00e('0x2d')](_[_0xa00e('0x35')](_0xb0c5c4['query'],_0x31f901[_0xa00e('0x2d')]),_0x1d837f);if(_0xb0c5c4[_0xa00e('0x2b')][_0xa00e('0x36')]){_0x4d0072[_0xa00e('0x37')]=_[_0xa00e('0x38')](_0x4d0072[_0xa00e('0x37')],{'$or':_[_0xa00e('0x2a')](_0x1d837f,function(_0x51c0f8){if(_0x51c0f8[_0xa00e('0x39')]!==_0xa00e('0x3a')){var _0xcc3a10={};_0xcc3a10[_0x51c0f8[_0xa00e('0x22')]]={'$like':'%'+_0xb0c5c4[_0xa00e('0x2b')][_0xa00e('0x36')]+'%'};return _0xcc3a10;}})});}_0x4d0072=_[_0xa00e('0x38')]({},_0x4d0072,_0xb0c5c4[_0xa00e('0x3b')]);var _0x5ac963={'where':_0x4d0072[_0xa00e('0x37')]};return db[_0xa00e('0x25')][_0xa00e('0x19')](_0x5ac963)[_0xa00e('0x1f')](function(_0x139030){_0x3cba91[_0xa00e('0x19')]=_0x139030;if(_0xb0c5c4[_0xa00e('0x2b')]['includeAll']){_0x4d0072[_0xa00e('0x3c')]=[{'all':!![]}];}return db[_0xa00e('0x25')]['findAll'](_0x4d0072);})[_0xa00e('0x1f')](function(_0x5d1a4f){_0x3cba91['rows']=_0x5d1a4f;return _0x3cba91;})['then'](respondWithFilteredResult(_0x4e366b,_0x4d0072))['catch'](handleError(_0x4e366b,null));};exports[_0xa00e('0x3d')]=function(_0x4769f3,_0x3dc01a){var _0x3a4fcb={'raw':!![],'where':{'id':_0x4769f3[_0xa00e('0x3e')]['id']}},_0x40b558={};_0x40b558[_0xa00e('0x29')]=_[_0xa00e('0x2c')](db[_0xa00e('0x25')]['rawAttributes']);_0x40b558[_0xa00e('0x2b')]=_[_0xa00e('0x2c')](_0x4769f3[_0xa00e('0x2b')]);_0x40b558['filters']=_[_0xa00e('0x2e')](_0x40b558[_0xa00e('0x29')],_0x40b558[_0xa00e('0x2b')]);_0x3a4fcb['attributes']=_[_0xa00e('0x2e')](_0x40b558[_0xa00e('0x29')],qs['fields'](_0x4769f3[_0xa00e('0x2b')][_0xa00e('0x30')]));_0x3a4fcb[_0xa00e('0x2f')]=_0x3a4fcb['attributes'][_0xa00e('0x31')]?_0x3a4fcb[_0xa00e('0x2f')]:_0x40b558[_0xa00e('0x29')];if(_0x4769f3[_0xa00e('0x2b')][_0xa00e('0x3f')]){_0x3a4fcb[_0xa00e('0x3c')]=[{'all':!![]}];}_0x3a4fcb=_[_0xa00e('0x38')]({},_0x3a4fcb,_0x4769f3[_0xa00e('0x3b')]);return db[_0xa00e('0x25')]['find'](_0x3a4fcb)[_0xa00e('0x1f')](handleEntityNotFound(_0x3dc01a,null))['then'](respondWithResult(_0x3dc01a,null))['catch'](handleError(_0x3dc01a,null));};exports[_0xa00e('0x40')]=function(_0x256528,_0x1fdd4b){return db[_0xa00e('0x25')][_0xa00e('0x40')](_0x256528[_0xa00e('0x41')],{})[_0xa00e('0x1f')](function(_0x10cff3){var _0x1c1e04=_0x256528[_0xa00e('0x42')][_0xa00e('0x43')]({'plain':!![]});if(!_0x1c1e04)throw new Error(_0xa00e('0x44'));if(_0x1c1e04[_0xa00e('0x45')]===_0xa00e('0x42')){var _0x39b4a9=_0x10cff3[_0xa00e('0x43')]({'plain':!![]});var _0x32c7ea=_0xa00e('0x21');return db[_0xa00e('0x46')]['find']({'where':{'name':_0x32c7ea,'userProfileId':_0x1c1e04[_0xa00e('0x47')]},'raw':!![]})['then'](function(_0x531088){if(_0x531088&&_0x531088[_0xa00e('0x48')]===0x0){return db[_0xa00e('0x49')]['create']({'name':_0x39b4a9[_0xa00e('0x22')],'resourceId':_0x39b4a9['id'],'type':_0x531088[_0xa00e('0x22')],'sectionId':_0x531088['id']},{})[_0xa00e('0x1f')](function(){return _0x10cff3;});}else{return _0x10cff3;}})[_0xa00e('0x4a')](function(_0x380d92){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x380d92);throw _0x380d92;});}return _0x10cff3;})[_0xa00e('0x1f')](respondWithResult(_0x1fdd4b,0xc9))[_0xa00e('0x4a')](handleError(_0x1fdd4b,null));};exports['update']=function(_0x9ad4f2,_0x5337b3){if(_0x9ad4f2[_0xa00e('0x41')]['id']){delete _0x9ad4f2[_0xa00e('0x41')]['id'];}return db['CmHopperAdditionalPhone'][_0xa00e('0x4b')]({'where':{'id':_0x9ad4f2[_0xa00e('0x3e')]['id']}})[_0xa00e('0x1f')](handleEntityNotFound(_0x5337b3,null))[_0xa00e('0x1f')](saveUpdates(_0x9ad4f2['body'],null))['then'](respondWithResult(_0x5337b3,null))[_0xa00e('0x4a')](handleError(_0x5337b3,null));};exports[_0xa00e('0x20')]=function(_0xede166,_0x47080e){return db[_0xa00e('0x25')]['find']({'where':{'id':_0xede166['params']['id']}})[_0xa00e('0x1f')](handleEntityNotFound(_0x47080e,null))[_0xa00e('0x1f')](removeEntity(_0x47080e,null))[_0xa00e('0x4a')](handleError(_0x47080e,null));}; \ No newline at end of file +var _0x568a=['send','index','map','rawAttributes','fieldName','type','key','keys','filters','intersection','model','query','attributes','fields','order','sort','where','pick','merge','VIRTUAL','filter','options','CmHopperAdditionalPhone','include','rows','catch','show','params','length','includeAll','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','lodash','squel','jsforce','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','sendStatus','status','end','json','offset','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','CmHopperAdditionalPhones','UserProfileResource','error','stack','name'];(function(_0x4a7631,_0x2c85b9){var _0x1a5a6f=function(_0x1ee3fd){while(--_0x1ee3fd){_0x4a7631['push'](_0x4a7631['shift']());}};_0x1a5a6f(++_0x2c85b9);}(_0x568a,0x79));var _0xa568=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x568a[_0x502c7d];return _0x30b7ed;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa568('0x0'));var zipdir=require(_0xa568('0x1'));var jsonpatch=require(_0xa568('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xa568('0x3'));var Mustache=require(_0xa568('0x4'));var util=require(_0xa568('0x5'));var path=require(_0xa568('0x6'));var sox=require(_0xa568('0x7'));var csv=require(_0xa568('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xa568('0x9'));var squel=require(_0xa568('0xa'));var crypto=require('crypto');var jsforce=require(_0xa568('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xa568('0xc'));var authService=require('../../components/auth/service');var qs=require(_0xa568('0xd'));var as=require(_0xa568('0xe'));var hardwareService=require(_0xa568('0xf'));var logger=require(_0xa568('0x10'))(_0xa568('0x11'));var utils=require('../../config/utils');var config=require(_0xa568('0x12'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x118341,_0x3d1b77){_0x3d1b77=_0x3d1b77||0xcc;return function(_0x5640a7){if(_0x5640a7){return _0x118341[_0xa568('0x13')](_0x3d1b77);}return _0x118341[_0xa568('0x14')](_0x3d1b77)[_0xa568('0x15')]();};}function respondWithResult(_0x3c877f,_0x31f488){_0x31f488=_0x31f488||0xc8;return function(_0x10a085){if(_0x10a085){return _0x3c877f[_0xa568('0x14')](_0x31f488)[_0xa568('0x16')](_0x10a085);}};}function respondWithFilteredResult(_0x5e83a5,_0xfb3473){return function(_0x3bd849){if(_0x3bd849){var _0x278be6=typeof _0xfb3473[_0xa568('0x17')]==='undefined'&&typeof _0xfb3473['limit']==='undefined';var _0x4389c5=_0x3bd849[_0xa568('0x18')];var _0x335d13=_0x278be6?0x0:_0xfb3473[_0xa568('0x17')];var _0x1ed64f=_0x278be6?_0x3bd849[_0xa568('0x18')]:_0xfb3473[_0xa568('0x17')]+_0xfb3473[_0xa568('0x19')];var _0x4591df;if(_0x1ed64f>=_0x4389c5){_0x1ed64f=_0x4389c5;_0x4591df=0xc8;}else{_0x4591df=0xce;}_0x5e83a5[_0xa568('0x14')](_0x4591df);return _0x5e83a5[_0xa568('0x1a')](_0xa568('0x1b'),_0x335d13+'-'+_0x1ed64f+'/'+_0x4389c5)['json'](_0x3bd849);}return null;};}function patchUpdates(_0x1e4f31){return function(_0x49a7a3){try{jsonpatch[_0xa568('0x1c')](_0x49a7a3,_0x1e4f31,!![]);}catch(_0xf9fe7b){return BPromise[_0xa568('0x1d')](_0xf9fe7b);}return _0x49a7a3[_0xa568('0x1e')]();};}function saveUpdates(_0x372f32,_0x1dde6d){return function(_0x33f486){if(_0x33f486){return _0x33f486[_0xa568('0x1f')](_0x372f32)[_0xa568('0x20')](function(_0x5f0cf0){return _0x5f0cf0;});}return null;};}function removeEntity(_0x313d46,_0x2cbe4e){return function(_0x78a633){if(_0x78a633){return _0x78a633[_0xa568('0x21')]()[_0xa568('0x20')](function(){var _0x33459d=_0x78a633['get']({'plain':!![]});var _0x5a06b2=_0xa568('0x22');return db[_0xa568('0x23')]['destroy']({'where':{'type':_0x5a06b2,'resourceId':_0x33459d['id']}})[_0xa568('0x20')](function(){return _0x78a633;});})[_0xa568('0x20')](function(){_0x313d46[_0xa568('0x14')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5e1590,_0xb5cb5e){return function(_0x248bbc){if(!_0x248bbc){_0x5e1590['sendStatus'](0x194);}return _0x248bbc;};}function handleError(_0x57938d,_0x3f014f){_0x3f014f=_0x3f014f||0x1f4;return function(_0xd3062b){logger[_0xa568('0x24')](_0xd3062b[_0xa568('0x25')]);if(_0xd3062b[_0xa568('0x26')]){delete _0xd3062b[_0xa568('0x26')];}_0x57938d[_0xa568('0x14')](_0x3f014f)[_0xa568('0x27')](_0xd3062b);};}exports[_0xa568('0x28')]=function(_0x261c8,_0x1e8340){var _0x2dc7ce={},_0x3b7210={},_0x53ae9c={'count':0x0,'rows':[]};var _0x3bde50=_[_0xa568('0x29')](db['CmHopperAdditionalPhone'][_0xa568('0x2a')],function(_0x57409c){return{'name':_0x57409c[_0xa568('0x2b')],'type':_0x57409c[_0xa568('0x2c')][_0xa568('0x2d')]};});_0x3b7210['model']=_['map'](_0x3bde50,_0xa568('0x26'));_0x3b7210['query']=_[_0xa568('0x2e')](_0x261c8['query']);_0x3b7210[_0xa568('0x2f')]=_[_0xa568('0x30')](_0x3b7210[_0xa568('0x31')],_0x3b7210[_0xa568('0x32')]);_0x2dc7ce[_0xa568('0x33')]=_[_0xa568('0x30')](_0x3b7210[_0xa568('0x31')],qs[_0xa568('0x34')](_0x261c8[_0xa568('0x32')][_0xa568('0x34')]));_0x2dc7ce[_0xa568('0x33')]=_0x2dc7ce[_0xa568('0x33')]['length']?_0x2dc7ce[_0xa568('0x33')]:_0x3b7210['model'];if(!_0x261c8[_0xa568('0x32')]['hasOwnProperty']('nolimit')){_0x2dc7ce[_0xa568('0x19')]=qs[_0xa568('0x19')](_0x261c8[_0xa568('0x32')]['limit']);_0x2dc7ce['offset']=qs[_0xa568('0x17')](_0x261c8[_0xa568('0x32')][_0xa568('0x17')]);}_0x2dc7ce[_0xa568('0x35')]=qs[_0xa568('0x36')](_0x261c8[_0xa568('0x32')][_0xa568('0x36')]);_0x2dc7ce[_0xa568('0x37')]=qs[_0xa568('0x2f')](_[_0xa568('0x38')](_0x261c8[_0xa568('0x32')],_0x3b7210['filters']),_0x3bde50);if(_0x261c8[_0xa568('0x32')]['filter']){_0x2dc7ce[_0xa568('0x37')]=_[_0xa568('0x39')](_0x2dc7ce['where'],{'$or':_[_0xa568('0x29')](_0x3bde50,function(_0x16ddfc){if(_0x16ddfc['type']!==_0xa568('0x3a')){var _0x536bd3={};_0x536bd3[_0x16ddfc[_0xa568('0x26')]]={'$like':'%'+_0x261c8['query'][_0xa568('0x3b')]+'%'};return _0x536bd3;}})});}_0x2dc7ce=_['merge']({},_0x2dc7ce,_0x261c8[_0xa568('0x3c')]);var _0x4711bd={'where':_0x2dc7ce[_0xa568('0x37')]};return db[_0xa568('0x3d')]['count'](_0x4711bd)[_0xa568('0x20')](function(_0x1278b0){_0x53ae9c[_0xa568('0x18')]=_0x1278b0;if(_0x261c8[_0xa568('0x32')]['includeAll']){_0x2dc7ce[_0xa568('0x3e')]=[{'all':!![]}];}return db[_0xa568('0x3d')]['findAll'](_0x2dc7ce);})[_0xa568('0x20')](function(_0x1e3afe){_0x53ae9c[_0xa568('0x3f')]=_0x1e3afe;return _0x53ae9c;})[_0xa568('0x20')](respondWithFilteredResult(_0x1e8340,_0x2dc7ce))[_0xa568('0x40')](handleError(_0x1e8340,null));};exports[_0xa568('0x41')]=function(_0x434a9a,_0x16740a){var _0xfed043={'raw':!![],'where':{'id':_0x434a9a[_0xa568('0x42')]['id']}},_0x353b0b={};_0x353b0b['model']=_[_0xa568('0x2e')](db[_0xa568('0x3d')][_0xa568('0x2a')]);_0x353b0b[_0xa568('0x32')]=_[_0xa568('0x2e')](_0x434a9a[_0xa568('0x32')]);_0x353b0b[_0xa568('0x2f')]=_[_0xa568('0x30')](_0x353b0b['model'],_0x353b0b[_0xa568('0x32')]);_0xfed043[_0xa568('0x33')]=_[_0xa568('0x30')](_0x353b0b[_0xa568('0x31')],qs[_0xa568('0x34')](_0x434a9a['query'][_0xa568('0x34')]));_0xfed043[_0xa568('0x33')]=_0xfed043[_0xa568('0x33')][_0xa568('0x43')]?_0xfed043['attributes']:_0x353b0b[_0xa568('0x31')];if(_0x434a9a['query'][_0xa568('0x44')]){_0xfed043['include']=[{'all':!![]}];}_0xfed043=_[_0xa568('0x39')]({},_0xfed043,_0x434a9a[_0xa568('0x3c')]);return db['CmHopperAdditionalPhone'][_0xa568('0x45')](_0xfed043)[_0xa568('0x20')](handleEntityNotFound(_0x16740a,null))['then'](respondWithResult(_0x16740a,null))['catch'](handleError(_0x16740a,null));};exports[_0xa568('0x46')]=function(_0x196b54,_0x8d6634){return db['CmHopperAdditionalPhone'][_0xa568('0x46')](_0x196b54[_0xa568('0x47')],{})[_0xa568('0x20')](function(_0x24b2cc){var _0xb3e396=_0x196b54[_0xa568('0x48')][_0xa568('0x49')]({'plain':!![]});if(!_0xb3e396)throw new Error(_0xa568('0x4a'));if(_0xb3e396[_0xa568('0x4b')]===_0xa568('0x48')){var _0x10a656=_0x24b2cc[_0xa568('0x49')]({'plain':!![]});var _0x413ee7=_0xa568('0x22');return db[_0xa568('0x4c')]['find']({'where':{'name':_0x413ee7,'userProfileId':_0xb3e396[_0xa568('0x4d')]},'raw':!![]})[_0xa568('0x20')](function(_0x31186f){if(_0x31186f&&_0x31186f[_0xa568('0x4e')]===0x0){return db['UserProfileResource']['create']({'name':_0x10a656['name'],'resourceId':_0x10a656['id'],'type':_0x31186f[_0xa568('0x26')],'sectionId':_0x31186f['id']},{})['then'](function(){return _0x24b2cc;});}else{return _0x24b2cc;}})['catch'](function(_0x21c718){logger[_0xa568('0x24')](_0xa568('0x4f'),_0x21c718);throw _0x21c718;});}return _0x24b2cc;})[_0xa568('0x20')](respondWithResult(_0x8d6634,0xc9))['catch'](handleError(_0x8d6634,null));};exports[_0xa568('0x1f')]=function(_0x18c9a5,_0x4d7623){if(_0x18c9a5[_0xa568('0x47')]['id']){delete _0x18c9a5[_0xa568('0x47')]['id'];}return db['CmHopperAdditionalPhone'][_0xa568('0x45')]({'where':{'id':_0x18c9a5['params']['id']}})[_0xa568('0x20')](handleEntityNotFound(_0x4d7623,null))[_0xa568('0x20')](saveUpdates(_0x18c9a5[_0xa568('0x47')],null))[_0xa568('0x20')](respondWithResult(_0x4d7623,null))[_0xa568('0x40')](handleError(_0x4d7623,null));};exports[_0xa568('0x21')]=function(_0x1d8336,_0x23ca89){return db['CmHopperAdditionalPhone'][_0xa568('0x45')]({'where':{'id':_0x1d8336[_0xa568('0x42')]['id']}})[_0xa568('0x20')](handleEntityNotFound(_0x23ca89,null))['then'](removeEntity(_0x23ca89,null))[_0xa568('0x40')](handleError(_0x23ca89,null));}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js index 877f40b..4762834 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 _0xf88f=['cm_hopper_additional_phones','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./cmHopperAdditionalPhone.attributes','define','CmHopperAdditionalPhone'];(function(_0x2d2194,_0x56fb96){var _0x1febae=function(_0x29990f){while(--_0x29990f){_0x2d2194['push'](_0x2d2194['shift']());}};_0x1febae(++_0x56fb96);}(_0xf88f,0x1bb));var _0xff88=function(_0x1dba79,_0x221474){_0x1dba79=_0x1dba79-0x0;var _0x452a11=_0xf88f[_0x1dba79];return _0x452a11;};'use strict';var _=require(_0xff88('0x0'));var util=require(_0xff88('0x1'));var logger=require(_0xff88('0x2'))(_0xff88('0x3'));var moment=require(_0xff88('0x4'));var BPromise=require(_0xff88('0x5'));var rp=require(_0xff88('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xff88('0x7'));var config=require(_0xff88('0x8'));var attributes=require(_0xff88('0x9'));module['exports']=function(_0x38e1df,_0x406a2e){return _0x38e1df[_0xff88('0xa')](_0xff88('0xb'),attributes,{'tableName':_0xff88('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xaa2c=['util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','define','CmHopperAdditionalPhone','cm_hopper_additional_phones','lodash'];(function(_0x49052b,_0x3ba709){var _0x48c045=function(_0x41ac38){while(--_0x41ac38){_0x49052b['push'](_0x49052b['shift']());}};_0x48c045(++_0x3ba709);}(_0xaa2c,0x1a3));var _0xcaa2=function(_0x1921b8,_0x205eec){_0x1921b8=_0x1921b8-0x0;var _0x367833=_0xaa2c[_0x1921b8];return _0x367833;};'use strict';var _=require(_0xcaa2('0x0'));var util=require(_0xcaa2('0x1'));var logger=require(_0xcaa2('0x2'))(_0xcaa2('0x3'));var moment=require(_0xcaa2('0x4'));var BPromise=require(_0xcaa2('0x5'));var rp=require(_0xcaa2('0x6'));var fs=require('fs');var path=require(_0xcaa2('0x7'));var rimraf=require('rimraf');var config=require(_0xcaa2('0x8'));var attributes=require('./cmHopperAdditionalPhone.attributes');module['exports']=function(_0x4128d7,_0x2258d6){return _0x4128d7[_0xcaa2('0x9')](_0xcaa2('0xa'),attributes,{'tableName':_0xcaa2('0xb'),'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 3f5de37..c4e3718 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 _0xfb71=['client','http','request','info','CmHopperAdditionalPhone,\x20%s,\x20%s','request\x20sent','debug','CmHopperAdditionalPhone,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','VerifyAdditionalPhones','CmHopper','findOne','body','ContactId','VoiceQueueId','CampaignId','then','CmHopperAdditionalPhone','OrderBy','ASC','countcongestionretry','countdropretry','countabandonedretry','countmachineretry','entity','dialGlobalMaxRetry','countbusyretry','countnoanswerretry','countnosuchnumberretry','countagentrejectretry','duration','waitTime','isNil','scheduledat','add','minutes','phone','createdAt','updatedAt','sequelize','transaction','update','IncrementPreviewCounters','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','jayson/promise'];(function(_0x4ef256,_0x2bcd33){var _0x152931=function(_0x56cb69){while(--_0x56cb69){_0x4ef256['push'](_0x4ef256['shift']());}};_0x152931(++_0x2bcd33);}(_0xfb71,0x1ef));var _0x1fb7=function(_0x42acc6,_0x56eeb7){_0x42acc6=_0x42acc6-0x0;var _0x1bb0e4=_0xfb71[_0x42acc6];return _0x1bb0e4;};'use strict';var _=require(_0x1fb7('0x0'));var util=require(_0x1fb7('0x1'));var moment=require(_0x1fb7('0x2'));var BPromise=require(_0x1fb7('0x3'));var rs=require(_0x1fb7('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x1fb7('0x5'));var logger=require(_0x1fb7('0x6'))(_0x1fb7('0x7'));var config=require('../../config/environment');var jayson=require(_0x1fb7('0x8'));var client=jayson[_0x1fb7('0x9')][_0x1fb7('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2112f8,_0x42fc30,_0x45742f){return new BPromise(function(_0x4abac2,_0x287b4a){return client[_0x1fb7('0xb')](_0x2112f8,_0x45742f)['then'](function(_0x968df9){logger[_0x1fb7('0xc')](_0x1fb7('0xd'),_0x42fc30,_0x1fb7('0xe'));logger[_0x1fb7('0xf')](_0x1fb7('0x10'),_0x42fc30,'request\x20sent',JSON['stringify'](_0x968df9));if(_0x968df9[_0x1fb7('0x11')]){if(_0x968df9[_0x1fb7('0x11')][_0x1fb7('0x12')]===0x1f4){logger['error'](_0x1fb7('0xd'),_0x42fc30,_0x968df9[_0x1fb7('0x11')][_0x1fb7('0x13')]);return _0x287b4a(_0x968df9['error']['message']);}logger[_0x1fb7('0x11')]('CmHopperAdditionalPhone,\x20%s,\x20%s',_0x42fc30,_0x968df9['error'][_0x1fb7('0x13')]);return _0x4abac2(_0x968df9['error'][_0x1fb7('0x13')]);}else{logger[_0x1fb7('0xc')](_0x1fb7('0xd'),_0x42fc30,_0x1fb7('0xe'));_0x4abac2(_0x968df9[_0x1fb7('0x14')][_0x1fb7('0x13')]);}})[_0x1fb7('0x15')](function(_0x3126bf){logger[_0x1fb7('0x11')]('CmHopperAdditionalPhone,\x20%s,\x20%s',_0x42fc30,_0x3126bf);_0x287b4a(_0x3126bf);});});}exports[_0x1fb7('0x16')]=function(_0x17de9d){var _0x43b878=this;return new Promise(function(_0x5e34c8,_0x5015b3){return db[_0x1fb7('0x17')][_0x1fb7('0x18')]({'raw':!![],'where':{'ContactId':_0x17de9d[_0x1fb7('0x19')][_0x1fb7('0x1a')],'ListId':_0x17de9d[_0x1fb7('0x19')]['ListId'],'VoiceQueueId':_0x17de9d['body'][_0x1fb7('0x1b')]===undefined?null:_0x17de9d[_0x1fb7('0x19')]['VoiceQueueId'],'CampaignId':_0x17de9d[_0x1fb7('0x19')][_0x1fb7('0x1c')]===undefined?null:_0x17de9d['body']['CampaignId']}})[_0x1fb7('0x1d')](function(_0x294e2b){if(_0x294e2b!=null){return db[_0x1fb7('0x1e')][_0x1fb7('0x18')]({'raw':!![],'where':{'CmHopperId':_0x294e2b['id'],'OrderBy':{'$gt':_0x294e2b[_0x1fb7('0x1f')]}},'order':[[_0x1fb7('0x1f'),_0x1fb7('0x20')]]})['then'](function(_0x3da6af){var _0x2ba773=0x0;if(_0x3da6af){if(_0x3da6af['countbusyretry']+_0x3da6af[_0x1fb7('0x21')]+_0x3da6af['countnoanswerretry']+_0x3da6af['countnosuchnumberretry']+_0x3da6af[_0x1fb7('0x22')]+_0x3da6af[_0x1fb7('0x23')]+_0x3da6af[_0x1fb7('0x24')]+_0x3da6af['countagentrejectretry']<_0x17de9d[_0x1fb7('0x25')][_0x1fb7('0x26')])_0x2ba773=0x1;_0x5e34c8({'additional':_0x2ba773});}else{return db[_0x1fb7('0x1e')][_0x1fb7('0x18')]({'raw':!![],'where':{'CmHopperId':_0x294e2b['id']},'order':[[_0x1fb7('0x1f'),_0x1fb7('0x20')]]})[_0x1fb7('0x1d')](function(_0x378c02){var _0x39bb74=0x0;if(_0x378c02){if(_0x378c02[_0x1fb7('0x27')]+_0x378c02['countcongestionretry']+_0x378c02[_0x1fb7('0x28')]+_0x378c02[_0x1fb7('0x29')]+_0x378c02[_0x1fb7('0x22')]+_0x378c02[_0x1fb7('0x23')]+_0x378c02[_0x1fb7('0x24')]+_0x378c02[_0x1fb7('0x2a')]<_0x17de9d['entity'][_0x1fb7('0x26')])_0x39bb74=0x1;_0x5e34c8({'additional':_0x39bb74});}else{_0x5e34c8({'additional':0x0});}})['catch'](function(_0x5f196f){logger[_0x1fb7('0x11')](_0x1fb7('0x16'),_0x5f196f[_0x1fb7('0x13')]);_0x5015b3(_0x43b878[_0x1fb7('0x11')](0x1f4,_0x5f196f['message']));});}})[_0x1fb7('0x15')](function(_0x468dd0){logger['error'](_0x1fb7('0x16'),_0x468dd0[_0x1fb7('0x13')]);_0x5015b3(_0x43b878[_0x1fb7('0x11')](0x1f4,_0x468dd0[_0x1fb7('0x13')]));});}else _0x5e34c8({'additional':0x0});});});};exports['SwapAdditionalPhones']=function(_0x6240db){var _0x254b3f=this;return new Promise(function(_0x2d2071,_0x301e66){return db[_0x1fb7('0x17')][_0x1fb7('0x18')]({'raw':!![],'where':{'ContactId':_0x6240db[_0x1fb7('0x19')][_0x1fb7('0x1a')],'ListId':_0x6240db['body']['ListId'],'VoiceQueueId':_0x6240db[_0x1fb7('0x19')][_0x1fb7('0x1b')]===undefined?null:_0x6240db[_0x1fb7('0x19')][_0x1fb7('0x1b')],'CampaignId':_0x6240db[_0x1fb7('0x19')][_0x1fb7('0x1c')]===undefined?null:_0x6240db[_0x1fb7('0x19')][_0x1fb7('0x1c')]}})[_0x1fb7('0x1d')](function(_0x4318ed){if(_0x4318ed!=null){return db[_0x1fb7('0x1e')][_0x1fb7('0x18')]({'raw':!![],'where':{'CmHopperId':_0x4318ed['id'],'OrderBy':{'$gte':_0x4318ed[_0x1fb7('0x1f')]}},'order':[[_0x1fb7('0x1f'),_0x1fb7('0x20')]]})['then'](function(_0x6f2c46){if(_0x6f2c46)return activateAdditionalPhone(_0x4318ed,_0x6240db[_0x1fb7('0x19')],_0x6f2c46,_0x6240db[_0x1fb7('0x2b')],_0x6240db[_0x1fb7('0x2c')])['then'](function(_0x36b75d){_0x2d2071(_0x36b75d);});else{return db['CmHopperAdditionalPhone'][_0x1fb7('0x18')]({'raw':!![],'where':{'CmHopperId':_0x4318ed['id']},'order':[[_0x1fb7('0x1f'),'ASC']]})[_0x1fb7('0x1d')](function(_0x2f0da8){if(_0x2f0da8)return activateAdditionalPhone(_0x4318ed,_0x6240db[_0x1fb7('0x19')],_0x2f0da8,_0x6240db[_0x1fb7('0x2b')],_0x6240db[_0x1fb7('0x2c')])[_0x1fb7('0x1d')](function(_0x15d221){_0x2d2071(_0x15d221);});else{_0x2d2071({'id':_0x4318ed['id'],'phone':''});}})[_0x1fb7('0x15')](function(_0x38533a){logger[_0x1fb7('0x11')](_0x1fb7('0x16'),_0x38533a[_0x1fb7('0x13')]);_0x301e66(_0x254b3f[_0x1fb7('0x11')](0x1f4,_0x38533a[_0x1fb7('0x13')]));});}})[_0x1fb7('0x15')](function(_0x142417){logger['error'](_0x1fb7('0x16'),_0x142417[_0x1fb7('0x13')]);_0x301e66(_0x254b3f['error'](0x1f4,_0x142417['message']));});}else _0x2d2071(0x1);});});};function activateAdditionalPhone(_0x425f8c,_0x10c3d2,_0x516431,_0x258630,_0x4bfa2){return new Promise(function(_0x272f57,_0x5ac262){var _0x31580b;if(_[_0x1fb7('0x2d')](_0x516431[_0x1fb7('0x2e')])){_0x516431[_0x1fb7('0x2e')]=moment();}if(moment()>moment(_0x516431[_0x1fb7('0x2e')])){_0x31580b=moment()[_0x1fb7('0x2f')](_0x4bfa2||0x3,_0x1fb7('0x30'));}else{if(_0x516431[_0x1fb7('0x1f')]==0x0){_0x31580b=moment(_0x516431[_0x1fb7('0x2e')]);}else{_0x31580b=moment()['add'](_0x4bfa2||0x3,_0x1fb7('0x30'));}}if(_[_0x1fb7('0x2d')](_0x31580b)){_0x31580b=moment()[_0x1fb7('0x2f')](_0x4bfa2||0x3,_0x1fb7('0x30'));}var _0x5e8eb8={'phone':_0x425f8c[_0x1fb7('0x31')],'active':0x0,'OrderBy':_[_0x1fb7('0x2d')](_0x425f8c[_0x1fb7('0x1f')])?0x0:_0x425f8c[_0x1fb7('0x1f')],'scheduledat':moment()[_0x1fb7('0x2f')](_0x258630||0x1,_0x1fb7('0x30')),'countbusyretry':_0x10c3d2[_0x1fb7('0x27')],'countcongestionretry':_0x10c3d2[_0x1fb7('0x21')],'countnoanswerretry':_0x10c3d2['countnoanswerretry'],'countnosuchnumberretry':_0x10c3d2[_0x1fb7('0x29')],'countdropretry':_0x10c3d2[_0x1fb7('0x22')],'countabandonedretry':_0x10c3d2[_0x1fb7('0x23')],'countmachineretry':_0x10c3d2[_0x1fb7('0x24')],'countagentrejectretry':_0x10c3d2[_0x1fb7('0x2a')],'createdAt':_0x10c3d2[_0x1fb7('0x32')],'updatedAt':_0x10c3d2[_0x1fb7('0x33')]};var _0x5ed54e={'CmHopperId':_0x425f8c['id'],'phone':_0x516431[_0x1fb7('0x31')],'active':0x0,'OrderBy':_[_0x1fb7('0x2d')](_0x516431['OrderBy'])?0x0:_0x516431[_0x1fb7('0x1f')],'scheduledat':_0x31580b,'countbusyretry':_0x516431[_0x1fb7('0x27')],'countcongestionretry':_0x516431['countcongestionretry'],'countnoanswerretry':_0x516431['countnoanswerretry'],'countnosuchnumberretry':_0x516431['countnosuchnumberretry'],'countdropretry':_0x516431[_0x1fb7('0x22')],'countabandonedretry':_0x516431[_0x1fb7('0x23')],'countmachineretry':_0x516431['countmachineretry'],'countagentrejectretry':_0x516431[_0x1fb7('0x2a')],'createdAt':_0x516431[_0x1fb7('0x32')],'updatedAt':_0x516431[_0x1fb7('0x33')]};return db[_0x1fb7('0x34')][_0x1fb7('0x35')](function(_0x438734){return db[_0x1fb7('0x1e')][_0x1fb7('0x36')](_0x5e8eb8,{'where':{'id':_0x516431['id']}},{'transaction':_0x438734})[_0x1fb7('0x1d')](function(){return db[_0x1fb7('0x17')]['update'](_0x5ed54e,{'where':{'id':_0x425f8c['id']}},{'transaction':_0x438734});});})[_0x1fb7('0x1d')](function(_0x5976d6){_0x272f57({'id':_0x425f8c['id'],'phone':_0x516431['phone']});})[_0x1fb7('0x15')](function(_0x4b1ba3){logger[_0x1fb7('0x11')]('activateAdditionalPhone',_0x4b1ba3[_0x1fb7('0x13')]);_0x5ac262({'error':_0x4b1ba3[_0x1fb7('0x13')]});});});}exports[_0x1fb7('0x37')]=function(_0x4be4a6){var _0x27d218=this;return new Promise(function(_0x2fb723,_0x5a3522){return db['CmHopper'][_0x1fb7('0x36')](_0x4be4a6['body']['field'],{'where':{'id':_0x4be4a6[_0x1fb7('0x19')]['id']}})[_0x1fb7('0x1d')](function(_0x31ed3d){_0x2fb723(_0x31ed3d);})[_0x1fb7('0x15')](function(_0x3820bc){logger[_0x1fb7('0x11')](_0x1fb7('0x37'),_0x3820bc['message']);_0x5a3522(_0x27d218[_0x1fb7('0x11')](0x1f4,_0x3820bc[_0x1fb7('0x13')]));});});}; \ No newline at end of file +var _0xf6c7=['request\x20sent','debug','stringify','error','code','message','info','result','catch','VerifyAdditionalPhones','findOne','body','ContactId','VoiceQueueId','CampaignId','then','OrderBy','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countagentrejectretry','dialGlobalMaxRetry','ASC','countmachineretry','entity','SwapAdditionalPhones','waitTime','CmHopperAdditionalPhone','isNil','scheduledat','add','minutes','updatedAt','phone','createdAt','sequelize','activateAdditionalPhone','CmHopper','field','IncrementPreviewCounters','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','request','CmHopperAdditionalPhone,\x20%s,\x20%s'];(function(_0x3dc8d1,_0x3933a7){var _0x297bbe=function(_0x448994){while(--_0x448994){_0x3dc8d1['push'](_0x3dc8d1['shift']());}};_0x297bbe(++_0x3933a7);}(_0xf6c7,0x17b));var _0x7f6c=function(_0x4d389c,_0x376e7d){_0x4d389c=_0x4d389c-0x0;var _0xe62f3c=_0xf6c7[_0x4d389c];return _0xe62f3c;};'use strict';var _=require(_0x7f6c('0x0'));var util=require(_0x7f6c('0x1'));var moment=require('moment');var BPromise=require(_0x7f6c('0x2'));var rs=require(_0x7f6c('0x3'));var fs=require('fs');var Redis=require(_0x7f6c('0x4'));var db=require(_0x7f6c('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x7f6c('0x6'))('rpc');var config=require(_0x7f6c('0x7'));var jayson=require(_0x7f6c('0x8'));var client=jayson[_0x7f6c('0x9')][_0x7f6c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3305d8,_0x4fb947,_0x26f333){return new BPromise(function(_0x39db11,_0x76e979){return client[_0x7f6c('0xb')](_0x3305d8,_0x26f333)['then'](function(_0x5c85b2){logger['info'](_0x7f6c('0xc'),_0x4fb947,_0x7f6c('0xd'));logger[_0x7f6c('0xe')]('CmHopperAdditionalPhone,\x20%s,\x20%s,\x20%s',_0x4fb947,_0x7f6c('0xd'),JSON[_0x7f6c('0xf')](_0x5c85b2));if(_0x5c85b2[_0x7f6c('0x10')]){if(_0x5c85b2[_0x7f6c('0x10')][_0x7f6c('0x11')]===0x1f4){logger['error'](_0x7f6c('0xc'),_0x4fb947,_0x5c85b2['error'][_0x7f6c('0x12')]);return _0x76e979(_0x5c85b2[_0x7f6c('0x10')]['message']);}logger[_0x7f6c('0x10')](_0x7f6c('0xc'),_0x4fb947,_0x5c85b2['error'][_0x7f6c('0x12')]);return _0x39db11(_0x5c85b2[_0x7f6c('0x10')][_0x7f6c('0x12')]);}else{logger[_0x7f6c('0x13')]('CmHopperAdditionalPhone,\x20%s,\x20%s',_0x4fb947,_0x7f6c('0xd'));_0x39db11(_0x5c85b2[_0x7f6c('0x14')]['message']);}})[_0x7f6c('0x15')](function(_0x4e1664){logger[_0x7f6c('0x10')]('CmHopperAdditionalPhone,\x20%s,\x20%s',_0x4fb947,_0x4e1664);_0x76e979(_0x4e1664);});});}exports[_0x7f6c('0x16')]=function(_0x497336){var _0x180ea6=this;return new Promise(function(_0x10ccab,_0x4dc1d7){return db['CmHopper'][_0x7f6c('0x17')]({'raw':!![],'where':{'ContactId':_0x497336[_0x7f6c('0x18')][_0x7f6c('0x19')],'ListId':_0x497336[_0x7f6c('0x18')]['ListId'],'VoiceQueueId':_0x497336[_0x7f6c('0x18')][_0x7f6c('0x1a')]===undefined?null:_0x497336[_0x7f6c('0x18')][_0x7f6c('0x1a')],'CampaignId':_0x497336[_0x7f6c('0x18')][_0x7f6c('0x1b')]===undefined?null:_0x497336['body'][_0x7f6c('0x1b')]}})[_0x7f6c('0x1c')](function(_0x5be451){if(_0x5be451!=null){return db['CmHopperAdditionalPhone'][_0x7f6c('0x17')]({'raw':!![],'where':{'CmHopperId':_0x5be451['id'],'OrderBy':{'$gt':_0x5be451['OrderBy']}},'order':[[_0x7f6c('0x1d'),'ASC']]})[_0x7f6c('0x1c')](function(_0x418167){var _0x1c7bd9=0x0;if(_0x418167){if(_0x418167[_0x7f6c('0x1e')]+_0x418167[_0x7f6c('0x1f')]+_0x418167[_0x7f6c('0x20')]+_0x418167[_0x7f6c('0x21')]+_0x418167[_0x7f6c('0x22')]+_0x418167[_0x7f6c('0x23')]+_0x418167['countmachineretry']+_0x418167[_0x7f6c('0x24')]<_0x497336['entity'][_0x7f6c('0x25')])_0x1c7bd9=0x1;_0x10ccab({'additional':_0x1c7bd9});}else{return db['CmHopperAdditionalPhone'][_0x7f6c('0x17')]({'raw':!![],'where':{'CmHopperId':_0x5be451['id']},'order':[[_0x7f6c('0x1d'),_0x7f6c('0x26')]]})[_0x7f6c('0x1c')](function(_0x54c605){var _0x1aafdf=0x0;if(_0x54c605){if(_0x54c605[_0x7f6c('0x1e')]+_0x54c605[_0x7f6c('0x1f')]+_0x54c605[_0x7f6c('0x20')]+_0x54c605['countnosuchnumberretry']+_0x54c605[_0x7f6c('0x22')]+_0x54c605[_0x7f6c('0x23')]+_0x54c605[_0x7f6c('0x27')]+_0x54c605[_0x7f6c('0x24')]<_0x497336[_0x7f6c('0x28')][_0x7f6c('0x25')])_0x1aafdf=0x1;_0x10ccab({'additional':_0x1aafdf});}else{_0x10ccab({'additional':0x0});}})[_0x7f6c('0x15')](function(_0x403587){logger[_0x7f6c('0x10')](_0x7f6c('0x16'),_0x403587[_0x7f6c('0x12')]);_0x4dc1d7(_0x180ea6[_0x7f6c('0x10')](0x1f4,_0x403587[_0x7f6c('0x12')]));});}})[_0x7f6c('0x15')](function(_0x34ff3c){logger[_0x7f6c('0x10')](_0x7f6c('0x16'),_0x34ff3c[_0x7f6c('0x12')]);_0x4dc1d7(_0x180ea6[_0x7f6c('0x10')](0x1f4,_0x34ff3c[_0x7f6c('0x12')]));});}else _0x10ccab({'additional':0x0});});});};exports[_0x7f6c('0x29')]=function(_0x2c1fb8){var _0x456a53=this;return new Promise(function(_0x14274b,_0x10966d){return db['CmHopper'][_0x7f6c('0x17')]({'raw':!![],'where':{'ContactId':_0x2c1fb8['body'][_0x7f6c('0x19')],'ListId':_0x2c1fb8[_0x7f6c('0x18')]['ListId'],'VoiceQueueId':_0x2c1fb8[_0x7f6c('0x18')]['VoiceQueueId']===undefined?null:_0x2c1fb8['body']['VoiceQueueId'],'CampaignId':_0x2c1fb8[_0x7f6c('0x18')][_0x7f6c('0x1b')]===undefined?null:_0x2c1fb8[_0x7f6c('0x18')][_0x7f6c('0x1b')]}})['then'](function(_0x3445eb){if(_0x3445eb!=null){return db['CmHopperAdditionalPhone'][_0x7f6c('0x17')]({'raw':!![],'where':{'CmHopperId':_0x3445eb['id'],'OrderBy':{'$gte':_0x3445eb['OrderBy']}},'order':[[_0x7f6c('0x1d'),_0x7f6c('0x26')]]})[_0x7f6c('0x1c')](function(_0x35aa80){if(_0x35aa80)return activateAdditionalPhone(_0x3445eb,_0x2c1fb8[_0x7f6c('0x18')],_0x35aa80,_0x2c1fb8['duration'],_0x2c1fb8[_0x7f6c('0x2a')])['then'](function(_0x2bf878){_0x14274b(_0x2bf878);});else{return db[_0x7f6c('0x2b')][_0x7f6c('0x17')]({'raw':!![],'where':{'CmHopperId':_0x3445eb['id']},'order':[[_0x7f6c('0x1d'),_0x7f6c('0x26')]]})[_0x7f6c('0x1c')](function(_0x11fbae){if(_0x11fbae)return activateAdditionalPhone(_0x3445eb,_0x2c1fb8['body'],_0x11fbae,_0x2c1fb8['duration'],_0x2c1fb8[_0x7f6c('0x2a')])[_0x7f6c('0x1c')](function(_0x4495fa){_0x14274b(_0x4495fa);});else{_0x14274b({'id':_0x3445eb['id'],'phone':''});}})[_0x7f6c('0x15')](function(_0xe910d4){logger['error'](_0x7f6c('0x16'),_0xe910d4['message']);_0x10966d(_0x456a53[_0x7f6c('0x10')](0x1f4,_0xe910d4[_0x7f6c('0x12')]));});}})[_0x7f6c('0x15')](function(_0x43d299){logger['error'](_0x7f6c('0x16'),_0x43d299['message']);_0x10966d(_0x456a53[_0x7f6c('0x10')](0x1f4,_0x43d299[_0x7f6c('0x12')]));});}else _0x14274b(0x1);});});};function activateAdditionalPhone(_0x1de6a2,_0x4000fb,_0x3b347b,_0x2d0f5a,_0x5ec002){return new Promise(function(_0x56fbc5,_0x2c135f){var _0x10ad51;if(_[_0x7f6c('0x2c')](_0x3b347b[_0x7f6c('0x2d')])){_0x3b347b['scheduledat']=moment();}if(moment()>moment(_0x3b347b[_0x7f6c('0x2d')])){_0x10ad51=moment()[_0x7f6c('0x2e')](_0x5ec002||0x3,'minutes');}else{if(_0x3b347b[_0x7f6c('0x1d')]==0x0){_0x10ad51=moment(_0x3b347b[_0x7f6c('0x2d')]);}else{_0x10ad51=moment()[_0x7f6c('0x2e')](_0x5ec002||0x3,_0x7f6c('0x2f'));}}if(_['isNil'](_0x10ad51)){_0x10ad51=moment()[_0x7f6c('0x2e')](_0x5ec002||0x3,'minutes');}var _0x32f567={'phone':_0x1de6a2['phone'],'active':0x0,'OrderBy':_[_0x7f6c('0x2c')](_0x1de6a2['OrderBy'])?0x0:_0x1de6a2[_0x7f6c('0x1d')],'scheduledat':moment()['add'](_0x2d0f5a||0x1,_0x7f6c('0x2f')),'countbusyretry':_0x4000fb[_0x7f6c('0x1e')],'countcongestionretry':_0x4000fb[_0x7f6c('0x1f')],'countnoanswerretry':_0x4000fb[_0x7f6c('0x20')],'countnosuchnumberretry':_0x4000fb[_0x7f6c('0x21')],'countdropretry':_0x4000fb[_0x7f6c('0x22')],'countabandonedretry':_0x4000fb['countabandonedretry'],'countmachineretry':_0x4000fb[_0x7f6c('0x27')],'countagentrejectretry':_0x4000fb[_0x7f6c('0x24')],'createdAt':_0x4000fb['createdAt'],'updatedAt':_0x4000fb[_0x7f6c('0x30')]};var _0x8f8b5={'CmHopperId':_0x1de6a2['id'],'phone':_0x3b347b[_0x7f6c('0x31')],'active':0x0,'OrderBy':_[_0x7f6c('0x2c')](_0x3b347b['OrderBy'])?0x0:_0x3b347b['OrderBy'],'scheduledat':_0x10ad51,'countbusyretry':_0x3b347b[_0x7f6c('0x1e')],'countcongestionretry':_0x3b347b[_0x7f6c('0x1f')],'countnoanswerretry':_0x3b347b[_0x7f6c('0x20')],'countnosuchnumberretry':_0x3b347b[_0x7f6c('0x21')],'countdropretry':_0x3b347b['countdropretry'],'countabandonedretry':_0x3b347b[_0x7f6c('0x23')],'countmachineretry':_0x3b347b['countmachineretry'],'countagentrejectretry':_0x3b347b[_0x7f6c('0x24')],'createdAt':_0x3b347b[_0x7f6c('0x32')],'updatedAt':_0x3b347b[_0x7f6c('0x30')]};return db[_0x7f6c('0x33')]['transaction'](function(_0x598acd){return db['CmHopperAdditionalPhone']['update'](_0x32f567,{'where':{'id':_0x3b347b['id']}},{'transaction':_0x598acd})[_0x7f6c('0x1c')](function(){return db['CmHopper']['update'](_0x8f8b5,{'where':{'id':_0x1de6a2['id']}},{'transaction':_0x598acd});});})[_0x7f6c('0x1c')](function(_0x349626){_0x56fbc5({'id':_0x1de6a2['id'],'phone':_0x3b347b['phone']});})[_0x7f6c('0x15')](function(_0x5c2427){logger[_0x7f6c('0x10')](_0x7f6c('0x34'),_0x5c2427[_0x7f6c('0x12')]);_0x2c135f({'error':_0x5c2427[_0x7f6c('0x12')]});});});}exports['IncrementPreviewCounters']=function(_0x51dfad){var _0xbd5328=this;return new Promise(function(_0xfad4b9,_0x826445){return db[_0x7f6c('0x35')]['update'](_0x51dfad['body'][_0x7f6c('0x36')],{'where':{'id':_0x51dfad[_0x7f6c('0x18')]['id']}})[_0x7f6c('0x1c')](function(_0x3d0d9f){_0xfad4b9(_0x3d0d9f);})[_0x7f6c('0x15')](function(_0x547958){logger[_0x7f6c('0x10')](_0x7f6c('0x37'),_0x547958[_0x7f6c('0x12')]);_0x826445(_0xbd5328[_0x7f6c('0x10')](0x1f4,_0x547958[_0x7f6c('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/index.js b/server/api/cmHopperAdditionalPhone/index.js index 7eedaa8..2a47f93 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 _0xd9e3=['./cmHopperAdditionalPhone.controller','get','isAuthenticated','/:id','show','post','create','put','delete','destroy','exports','path','connect-timeout','fs-extra','../../components/interaction/service','../../config/environment'];(function(_0x3592a1,_0x24a8d2){var _0x5ba9ef=function(_0x51a263){while(--_0x51a263){_0x3592a1['push'](_0x3592a1['shift']());}};_0x5ba9ef(++_0x24a8d2);}(_0xd9e3,0x7b));var _0x3d9e=function(_0x4fdbdb,_0x101410){_0x4fdbdb=_0x4fdbdb-0x0;var _0x270a8d=_0xd9e3[_0x4fdbdb];return _0x270a8d;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3d9e('0x0'));var timeout=require(_0x3d9e('0x1'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x3d9e('0x2'));var auth=require('../../components/auth/service');var interaction=require(_0x3d9e('0x3'));var config=require(_0x3d9e('0x4'));var controller=require(_0x3d9e('0x5'));router[_0x3d9e('0x6')]('/',auth[_0x3d9e('0x7')](),controller['index']);router[_0x3d9e('0x6')](_0x3d9e('0x8'),auth[_0x3d9e('0x7')](),controller[_0x3d9e('0x9')]);router[_0x3d9e('0xa')]('/',auth['isAuthenticated'](),controller[_0x3d9e('0xb')]);router[_0x3d9e('0xc')](_0x3d9e('0x8'),auth['isAuthenticated'](),controller['update']);router[_0x3d9e('0xd')](_0x3d9e('0x8'),auth['isAuthenticated'](),controller[_0x3d9e('0xe')]);module[_0x3d9e('0xf')]=router; \ No newline at end of file +var _0x97f5=['/:id','show','post','create','update','exports','multer','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperAdditionalPhone.controller','get','isAuthenticated','index'];(function(_0x5c66b0,_0x95d04a){var _0x50b53a=function(_0x1aa27b){while(--_0x1aa27b){_0x5c66b0['push'](_0x5c66b0['shift']());}};_0x50b53a(++_0x95d04a);}(_0x97f5,0x72));var _0x597f=function(_0x3dddac,_0x3c4ad1){_0x3dddac=_0x3dddac-0x0;var _0x164497=_0x97f5[_0x3dddac];return _0x164497;};'use strict';var multer=require(_0x597f('0x0'));var util=require(_0x597f('0x1'));var path=require(_0x597f('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x597f('0x3')]();var fs_extra=require(_0x597f('0x4'));var auth=require(_0x597f('0x5'));var interaction=require(_0x597f('0x6'));var config=require(_0x597f('0x7'));var controller=require(_0x597f('0x8'));router[_0x597f('0x9')]('/',auth[_0x597f('0xa')](),controller[_0x597f('0xb')]);router['get'](_0x597f('0xc'),auth[_0x597f('0xa')](),controller[_0x597f('0xd')]);router[_0x597f('0xe')]('/',auth[_0x597f('0xa')](),controller[_0x597f('0xf')]);router['put'](_0x597f('0xc'),auth[_0x597f('0xa')](),controller[_0x597f('0x10')]);router['delete']('/:id',auth[_0x597f('0xa')](),controller['destroy']);module[_0x597f('0x11')]=router; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.attributes.js b/server/api/cmHopperBlack/cmHopperBlack.attributes.js index 281d739..5283a41 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 _0x8f6b=['contactListQueue','moment','sequelize','exports','INTEGER'];(function(_0x3f45a5,_0x1aef45){var _0x16d579=function(_0x4b1a49){while(--_0x4b1a49){_0x3f45a5['push'](_0x3f45a5['shift']());}};_0x16d579(++_0x1aef45);}(_0x8f6b,0x146));var _0xb8f6=function(_0x481bf7,_0x437f69){_0x481bf7=_0x481bf7-0x0;var _0x461787=_0x8f6b[_0x481bf7];return _0x461787;};'use strict';var moment=require(_0xb8f6('0x0'));var Sequelize=require(_0xb8f6('0x1'));module[_0xb8f6('0x2')]={'phone':{'type':Sequelize['STRING'],'allowNull':![]},'ContactId':{'type':Sequelize[_0xb8f6('0x3')],'unique':_0xb8f6('0x4')},'ListId':{'type':Sequelize['INTEGER'],'unique':_0xb8f6('0x4')},'VoiceQueueId':{'type':Sequelize[_0xb8f6('0x3')],'unique':'contactListQueue'}}; \ No newline at end of file +var _0x4d61=['STRING','INTEGER','contactListQueue','moment','sequelize','exports'];(function(_0x54d2bd,_0x57c539){var _0x34f0d4=function(_0x2e8bba){while(--_0x2e8bba){_0x54d2bd['push'](_0x54d2bd['shift']());}};_0x34f0d4(++_0x57c539);}(_0x4d61,0x147));var _0x14d6=function(_0x1fb7d1,_0x108781){_0x1fb7d1=_0x1fb7d1-0x0;var _0x2480d8=_0x4d61[_0x1fb7d1];return _0x2480d8;};'use strict';var moment=require(_0x14d6('0x0'));var Sequelize=require(_0x14d6('0x1'));module[_0x14d6('0x2')]={'phone':{'type':Sequelize[_0x14d6('0x3')],'allowNull':![]},'ContactId':{'type':Sequelize[_0x14d6('0x4')],'unique':_0x14d6('0x5')},'ListId':{'type':Sequelize[_0x14d6('0x4')],'unique':_0x14d6('0x5')},'VoiceQueueId':{'type':Sequelize[_0x14d6('0x4')],'unique':'contactListQueue'}}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.controller.js b/server/api/cmHopperBlack/cmHopperBlack.controller.js index edd4837..6daecb0 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 _0x49f3=['map','CmHopperBlack','fieldName','type','query','keys','intersection','model','fields','attributes','nolimit','sort','filters','pick','filter','where','VIRTUAL','merge','options','includeAll','findAll','rows','catch','show','params','rawAttributes','include','find','body','describe','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','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','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','update','then','destroy','stack','name','send','index'];(function(_0x590a38,_0x2bc65c){var _0xf36626=function(_0x551cd1){while(--_0x551cd1){_0x590a38['push'](_0x590a38['shift']());}};_0xf36626(++_0x2bc65c);}(_0x49f3,0xb0));var _0x349f=function(_0xd94a66,_0x10a072){_0xd94a66=_0xd94a66-0x0;var _0x4a1ec8=_0x49f3[_0xd94a66];return _0x4a1ec8;};'use strict';var emlformat=require(_0x349f('0x0'));var rimraf=require(_0x349f('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x349f('0x2'));var rp=require('request-promise');var moment=require(_0x349f('0x3'));var BPromise=require(_0x349f('0x4'));var Mustache=require(_0x349f('0x5'));var util=require(_0x349f('0x6'));var path=require(_0x349f('0x7'));var sox=require(_0x349f('0x8'));var csv=require(_0x349f('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x349f('0xa'));var squel=require(_0x349f('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x349f('0xc'));var toCsv=require(_0x349f('0x9'));var querystring=require(_0x349f('0xd'));var Papa=require(_0x349f('0xe'));var Redis=require('ioredis');var authService=require(_0x349f('0xf'));var qs=require(_0x349f('0x10'));var as=require(_0x349f('0x11'));var hardwareService=require(_0x349f('0x12'));var logger=require(_0x349f('0x13'))(_0x349f('0x14'));var utils=require(_0x349f('0x15'));var config=require(_0x349f('0x16'));var licenseUtil=require(_0x349f('0x17'));var db=require(_0x349f('0x18'))['db'];function respondWithStatusCode(_0x2004f2,_0x3b03e7){_0x3b03e7=_0x3b03e7||0xcc;return function(_0x1438f7){if(_0x1438f7){return _0x2004f2[_0x349f('0x19')](_0x3b03e7);}return _0x2004f2[_0x349f('0x1a')](_0x3b03e7)[_0x349f('0x1b')]();};}function respondWithResult(_0x152bef,_0x3e348a){_0x3e348a=_0x3e348a||0xc8;return function(_0x2ebb16){if(_0x2ebb16){return _0x152bef[_0x349f('0x1a')](_0x3e348a)[_0x349f('0x1c')](_0x2ebb16);}};}function respondWithFilteredResult(_0x539d7f,_0x2896f7){return function(_0x18860c){if(_0x18860c){var _0x51dd0e=typeof _0x2896f7[_0x349f('0x1d')]===_0x349f('0x1e')&&typeof _0x2896f7[_0x349f('0x1f')]===_0x349f('0x1e');var _0x34b5a9=_0x18860c[_0x349f('0x20')];var _0x3677db=_0x51dd0e?0x0:_0x2896f7['offset'];var _0x4b82c4=_0x51dd0e?_0x18860c['count']:_0x2896f7[_0x349f('0x1d')]+_0x2896f7[_0x349f('0x1f')];var _0x4ba17b;if(_0x4b82c4>=_0x34b5a9){_0x4b82c4=_0x34b5a9;_0x4ba17b=0xc8;}else{_0x4ba17b=0xce;}_0x539d7f[_0x349f('0x1a')](_0x4ba17b);return _0x539d7f[_0x349f('0x21')](_0x349f('0x22'),_0x3677db+'-'+_0x4b82c4+'/'+_0x34b5a9)[_0x349f('0x1c')](_0x18860c);}return null;};}function patchUpdates(_0xadebbc){return function(_0x275b1e){try{jsonpatch['apply'](_0x275b1e,_0xadebbc,!![]);}catch(_0x2689d5){return BPromise[_0x349f('0x23')](_0x2689d5);}return _0x275b1e['save']();};}function saveUpdates(_0x531b0b,_0x12d8f6){return function(_0x29fc0f){if(_0x29fc0f){return _0x29fc0f[_0x349f('0x24')](_0x531b0b)[_0x349f('0x25')](function(_0x193adc){return _0x193adc;});}return null;};}function removeEntity(_0x36b0f4,_0x14b6fe){return function(_0x1174d6){if(_0x1174d6){return _0x1174d6[_0x349f('0x26')]()[_0x349f('0x25')](function(){_0x36b0f4[_0x349f('0x1a')](0xcc)[_0x349f('0x1b')]();});}};}function handleEntityNotFound(_0x17074c,_0xa51138){return function(_0x2d677b){if(!_0x2d677b){_0x17074c[_0x349f('0x19')](0x194);}return _0x2d677b;};}function handleError(_0x1711fe,_0x3bb0ce){_0x3bb0ce=_0x3bb0ce||0x1f4;return function(_0x5099de){logger['error'](_0x5099de[_0x349f('0x27')]);if(_0x5099de['name']){delete _0x5099de[_0x349f('0x28')];}_0x1711fe[_0x349f('0x1a')](_0x3bb0ce)[_0x349f('0x29')](_0x5099de);};}exports[_0x349f('0x2a')]=function(_0x3725e4,_0x532bb9){var _0x2987b2={},_0x52e0cf={},_0x3cad73={'count':0x0,'rows':[]};var _0x1f03bc=_[_0x349f('0x2b')](db[_0x349f('0x2c')]['rawAttributes'],function(_0x1c8e1e){return{'name':_0x1c8e1e[_0x349f('0x2d')],'type':_0x1c8e1e[_0x349f('0x2e')]['key']};});_0x52e0cf['model']=_[_0x349f('0x2b')](_0x1f03bc,_0x349f('0x28'));_0x52e0cf[_0x349f('0x2f')]=_[_0x349f('0x30')](_0x3725e4[_0x349f('0x2f')]);_0x52e0cf['filters']=_[_0x349f('0x31')](_0x52e0cf[_0x349f('0x32')],_0x52e0cf[_0x349f('0x2f')]);_0x2987b2['attributes']=_[_0x349f('0x31')](_0x52e0cf[_0x349f('0x32')],qs[_0x349f('0x33')](_0x3725e4[_0x349f('0x2f')][_0x349f('0x33')]));_0x2987b2[_0x349f('0x34')]=_0x2987b2[_0x349f('0x34')]['length']?_0x2987b2[_0x349f('0x34')]:_0x52e0cf[_0x349f('0x32')];if(!_0x3725e4[_0x349f('0x2f')]['hasOwnProperty'](_0x349f('0x35'))){_0x2987b2[_0x349f('0x1f')]=qs[_0x349f('0x1f')](_0x3725e4[_0x349f('0x2f')][_0x349f('0x1f')]);_0x2987b2[_0x349f('0x1d')]=qs[_0x349f('0x1d')](_0x3725e4[_0x349f('0x2f')][_0x349f('0x1d')]);}_0x2987b2['order']=qs[_0x349f('0x36')](_0x3725e4[_0x349f('0x2f')]['sort']);_0x2987b2['where']=qs[_0x349f('0x37')](_[_0x349f('0x38')](_0x3725e4[_0x349f('0x2f')],_0x52e0cf[_0x349f('0x37')]),_0x1f03bc);if(_0x3725e4[_0x349f('0x2f')][_0x349f('0x39')]){_0x2987b2[_0x349f('0x3a')]=_['merge'](_0x2987b2[_0x349f('0x3a')],{'$or':_[_0x349f('0x2b')](_0x1f03bc,function(_0x2e5e9d){if(_0x2e5e9d[_0x349f('0x2e')]!==_0x349f('0x3b')){var _0x874afc={};_0x874afc[_0x2e5e9d[_0x349f('0x28')]]={'$like':'%'+_0x3725e4[_0x349f('0x2f')][_0x349f('0x39')]+'%'};return _0x874afc;}})});}_0x2987b2=_[_0x349f('0x3c')]({},_0x2987b2,_0x3725e4[_0x349f('0x3d')]);var _0x10444f={'where':_0x2987b2[_0x349f('0x3a')]};return db[_0x349f('0x2c')][_0x349f('0x20')](_0x10444f)['then'](function(_0x1b7e34){_0x3cad73[_0x349f('0x20')]=_0x1b7e34;if(_0x3725e4[_0x349f('0x2f')][_0x349f('0x3e')]){_0x2987b2['include']=[{'all':!![]}];}return db[_0x349f('0x2c')][_0x349f('0x3f')](_0x2987b2);})[_0x349f('0x25')](function(_0x454039){_0x3cad73[_0x349f('0x40')]=_0x454039;return _0x3cad73;})[_0x349f('0x25')](respondWithFilteredResult(_0x532bb9,_0x2987b2))[_0x349f('0x41')](handleError(_0x532bb9,null));};exports[_0x349f('0x42')]=function(_0xde09d4,_0x337f95){var _0x10658b={'raw':!![],'where':{'id':_0xde09d4[_0x349f('0x43')]['id']}},_0x11c30c={};_0x11c30c[_0x349f('0x32')]=_[_0x349f('0x30')](db[_0x349f('0x2c')][_0x349f('0x44')]);_0x11c30c[_0x349f('0x2f')]=_[_0x349f('0x30')](_0xde09d4['query']);_0x11c30c['filters']=_[_0x349f('0x31')](_0x11c30c[_0x349f('0x32')],_0x11c30c['query']);_0x10658b[_0x349f('0x34')]=_['intersection'](_0x11c30c[_0x349f('0x32')],qs[_0x349f('0x33')](_0xde09d4[_0x349f('0x2f')][_0x349f('0x33')]));_0x10658b[_0x349f('0x34')]=_0x10658b[_0x349f('0x34')]['length']?_0x10658b[_0x349f('0x34')]:_0x11c30c[_0x349f('0x32')];if(_0xde09d4[_0x349f('0x2f')][_0x349f('0x3e')]){_0x10658b[_0x349f('0x45')]=[{'all':!![]}];}_0x10658b=_[_0x349f('0x3c')]({},_0x10658b,_0xde09d4[_0x349f('0x3d')]);return db['CmHopperBlack'][_0x349f('0x46')](_0x10658b)[_0x349f('0x25')](handleEntityNotFound(_0x337f95,null))[_0x349f('0x25')](respondWithResult(_0x337f95,null))[_0x349f('0x41')](handleError(_0x337f95,null));};exports[_0x349f('0x24')]=function(_0xde9a16,_0x26877a){if(_0xde9a16['body']['id']){delete _0xde9a16[_0x349f('0x47')]['id'];}return db[_0x349f('0x2c')]['find']({'where':{'id':_0xde9a16[_0x349f('0x43')]['id']}})[_0x349f('0x25')](handleEntityNotFound(_0x26877a,null))[_0x349f('0x25')](saveUpdates(_0xde9a16['body'],null))[_0x349f('0x25')](respondWithResult(_0x26877a,null))['catch'](handleError(_0x26877a,null));};exports['destroy']=function(_0x5214d5,_0x2b402a){return db['CmHopperBlack'][_0x349f('0x46')]({'where':{'id':_0x5214d5['params']['id']}})[_0x349f('0x25')](handleEntityNotFound(_0x2b402a,null))['then'](removeEntity(_0x2b402a,null))[_0x349f('0x41')](handleError(_0x2b402a,null));};exports[_0x349f('0x48')]=function(_0x5807ae,_0x1631b7){return db[_0x349f('0x2c')][_0x349f('0x48')]()[_0x349f('0x25')](respondWithResult(_0x1631b7,null))[_0x349f('0x41')](handleError(_0x1631b7,null));}; \ No newline at end of file +var _0xca6b=['rawAttributes','fieldName','type','key','model','keys','query','intersection','attributes','length','hasOwnProperty','order','sort','filters','pick','where','VIRTUAL','filter','merge','options','includeAll','include','findAll','rows','params','fields','find','body','catch','describe','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','count','limit','set','apply','reject','update','then','destroy','sendStatus','error','name','send','index','map','CmHopperBlack'];(function(_0x4a1b99,_0x17ccfa){var _0x9a1761=function(_0x21a954){while(--_0x21a954){_0x4a1b99['push'](_0x4a1b99['shift']());}};_0x9a1761(++_0x17ccfa);}(_0xca6b,0x66));var _0xbca6=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0xca6b[_0x6131cd];return _0x47e916;};'use strict';var emlformat=require(_0xbca6('0x0'));var rimraf=require(_0xbca6('0x1'));var zipdir=require(_0xbca6('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xbca6('0x3'));var moment=require(_0xbca6('0x4'));var BPromise=require(_0xbca6('0x5'));var Mustache=require(_0xbca6('0x6'));var util=require('util');var path=require(_0xbca6('0x7'));var sox=require(_0xbca6('0x8'));var csv=require(_0xbca6('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xbca6('0xa'));var _=require(_0xbca6('0xb'));var squel=require('squel');var crypto=require(_0xbca6('0xc'));var jsforce=require(_0xbca6('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xbca6('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xbca6('0xe'));var qs=require(_0xbca6('0xf'));var as=require(_0xbca6('0x10'));var hardwareService=require(_0xbca6('0x11'));var logger=require('../../config/logger')(_0xbca6('0x12'));var utils=require('../../config/utils');var config=require(_0xbca6('0x13'));var licenseUtil=require(_0xbca6('0x14'));var db=require(_0xbca6('0x15'))['db'];function respondWithStatusCode(_0x2ed079,_0x3eb721){_0x3eb721=_0x3eb721||0xcc;return function(_0x3c902a){if(_0x3c902a){return _0x2ed079['sendStatus'](_0x3eb721);}return _0x2ed079[_0xbca6('0x16')](_0x3eb721)[_0xbca6('0x17')]();};}function respondWithResult(_0x136e78,_0x4e39c4){_0x4e39c4=_0x4e39c4||0xc8;return function(_0x64d476){if(_0x64d476){return _0x136e78[_0xbca6('0x16')](_0x4e39c4)[_0xbca6('0x18')](_0x64d476);}};}function respondWithFilteredResult(_0x1280cd,_0x39097a){return function(_0x1b57bf){if(_0x1b57bf){var _0x3dcd19=typeof _0x39097a[_0xbca6('0x19')]===_0xbca6('0x1a')&&typeof _0x39097a['limit']===_0xbca6('0x1a');var _0x24702a=_0x1b57bf[_0xbca6('0x1b')];var _0x2f8195=_0x3dcd19?0x0:_0x39097a['offset'];var _0x49f389=_0x3dcd19?_0x1b57bf['count']:_0x39097a[_0xbca6('0x19')]+_0x39097a[_0xbca6('0x1c')];var _0x212dc4;if(_0x49f389>=_0x24702a){_0x49f389=_0x24702a;_0x212dc4=0xc8;}else{_0x212dc4=0xce;}_0x1280cd[_0xbca6('0x16')](_0x212dc4);return _0x1280cd[_0xbca6('0x1d')]('Content-Range',_0x2f8195+'-'+_0x49f389+'/'+_0x24702a)['json'](_0x1b57bf);}return null;};}function patchUpdates(_0x4484bd){return function(_0x189afb){try{jsonpatch[_0xbca6('0x1e')](_0x189afb,_0x4484bd,!![]);}catch(_0x500c7d){return BPromise[_0xbca6('0x1f')](_0x500c7d);}return _0x189afb['save']();};}function saveUpdates(_0x3ac760,_0x475a69){return function(_0x584afa){if(_0x584afa){return _0x584afa[_0xbca6('0x20')](_0x3ac760)[_0xbca6('0x21')](function(_0x102e94){return _0x102e94;});}return null;};}function removeEntity(_0x161340,_0xf2d54f){return function(_0x26484c){if(_0x26484c){return _0x26484c[_0xbca6('0x22')]()[_0xbca6('0x21')](function(){_0x161340[_0xbca6('0x16')](0xcc)[_0xbca6('0x17')]();});}};}function handleEntityNotFound(_0x3e300d,_0x1e8304){return function(_0x17ab1c){if(!_0x17ab1c){_0x3e300d[_0xbca6('0x23')](0x194);}return _0x17ab1c;};}function handleError(_0xe17339,_0x33bb79){_0x33bb79=_0x33bb79||0x1f4;return function(_0x317977){logger[_0xbca6('0x24')](_0x317977['stack']);if(_0x317977[_0xbca6('0x25')]){delete _0x317977[_0xbca6('0x25')];}_0xe17339[_0xbca6('0x16')](_0x33bb79)[_0xbca6('0x26')](_0x317977);};}exports[_0xbca6('0x27')]=function(_0x20bcc0,_0x1c4cf0){var _0x2600e1={},_0x5f024d={},_0x1c12d0={'count':0x0,'rows':[]};var _0x10d646=_[_0xbca6('0x28')](db[_0xbca6('0x29')][_0xbca6('0x2a')],function(_0x266449){return{'name':_0x266449[_0xbca6('0x2b')],'type':_0x266449[_0xbca6('0x2c')][_0xbca6('0x2d')]};});_0x5f024d[_0xbca6('0x2e')]=_[_0xbca6('0x28')](_0x10d646,_0xbca6('0x25'));_0x5f024d['query']=_[_0xbca6('0x2f')](_0x20bcc0[_0xbca6('0x30')]);_0x5f024d['filters']=_[_0xbca6('0x31')](_0x5f024d['model'],_0x5f024d['query']);_0x2600e1['attributes']=_['intersection'](_0x5f024d[_0xbca6('0x2e')],qs['fields'](_0x20bcc0[_0xbca6('0x30')]['fields']));_0x2600e1[_0xbca6('0x32')]=_0x2600e1[_0xbca6('0x32')][_0xbca6('0x33')]?_0x2600e1[_0xbca6('0x32')]:_0x5f024d[_0xbca6('0x2e')];if(!_0x20bcc0[_0xbca6('0x30')][_0xbca6('0x34')]('nolimit')){_0x2600e1[_0xbca6('0x1c')]=qs[_0xbca6('0x1c')](_0x20bcc0['query']['limit']);_0x2600e1[_0xbca6('0x19')]=qs['offset'](_0x20bcc0[_0xbca6('0x30')][_0xbca6('0x19')]);}_0x2600e1[_0xbca6('0x35')]=qs[_0xbca6('0x36')](_0x20bcc0[_0xbca6('0x30')][_0xbca6('0x36')]);_0x2600e1['where']=qs[_0xbca6('0x37')](_[_0xbca6('0x38')](_0x20bcc0[_0xbca6('0x30')],_0x5f024d[_0xbca6('0x37')]),_0x10d646);if(_0x20bcc0[_0xbca6('0x30')]['filter']){_0x2600e1[_0xbca6('0x39')]=_['merge'](_0x2600e1[_0xbca6('0x39')],{'$or':_[_0xbca6('0x28')](_0x10d646,function(_0x3f49c2){if(_0x3f49c2['type']!==_0xbca6('0x3a')){var _0x3b0e2c={};_0x3b0e2c[_0x3f49c2[_0xbca6('0x25')]]={'$like':'%'+_0x20bcc0[_0xbca6('0x30')][_0xbca6('0x3b')]+'%'};return _0x3b0e2c;}})});}_0x2600e1=_[_0xbca6('0x3c')]({},_0x2600e1,_0x20bcc0[_0xbca6('0x3d')]);var _0x2d0527={'where':_0x2600e1['where']};return db[_0xbca6('0x29')]['count'](_0x2d0527)['then'](function(_0x118521){_0x1c12d0[_0xbca6('0x1b')]=_0x118521;if(_0x20bcc0[_0xbca6('0x30')][_0xbca6('0x3e')]){_0x2600e1[_0xbca6('0x3f')]=[{'all':!![]}];}return db[_0xbca6('0x29')][_0xbca6('0x40')](_0x2600e1);})[_0xbca6('0x21')](function(_0x345f6f){_0x1c12d0[_0xbca6('0x41')]=_0x345f6f;return _0x1c12d0;})[_0xbca6('0x21')](respondWithFilteredResult(_0x1c4cf0,_0x2600e1))['catch'](handleError(_0x1c4cf0,null));};exports['show']=function(_0x979db9,_0x273eab){var _0x3c28d5={'raw':!![],'where':{'id':_0x979db9[_0xbca6('0x42')]['id']}},_0x5db28a={};_0x5db28a['model']=_[_0xbca6('0x2f')](db['CmHopperBlack'][_0xbca6('0x2a')]);_0x5db28a['query']=_[_0xbca6('0x2f')](_0x979db9[_0xbca6('0x30')]);_0x5db28a[_0xbca6('0x37')]=_[_0xbca6('0x31')](_0x5db28a['model'],_0x5db28a[_0xbca6('0x30')]);_0x3c28d5[_0xbca6('0x32')]=_['intersection'](_0x5db28a[_0xbca6('0x2e')],qs[_0xbca6('0x43')](_0x979db9[_0xbca6('0x30')]['fields']));_0x3c28d5[_0xbca6('0x32')]=_0x3c28d5[_0xbca6('0x32')][_0xbca6('0x33')]?_0x3c28d5[_0xbca6('0x32')]:_0x5db28a[_0xbca6('0x2e')];if(_0x979db9[_0xbca6('0x30')]['includeAll']){_0x3c28d5[_0xbca6('0x3f')]=[{'all':!![]}];}_0x3c28d5=_[_0xbca6('0x3c')]({},_0x3c28d5,_0x979db9['options']);return db['CmHopperBlack'][_0xbca6('0x44')](_0x3c28d5)['then'](handleEntityNotFound(_0x273eab,null))[_0xbca6('0x21')](respondWithResult(_0x273eab,null))['catch'](handleError(_0x273eab,null));};exports[_0xbca6('0x20')]=function(_0x558c13,_0x5222cf){if(_0x558c13[_0xbca6('0x45')]['id']){delete _0x558c13['body']['id'];}return db[_0xbca6('0x29')][_0xbca6('0x44')]({'where':{'id':_0x558c13[_0xbca6('0x42')]['id']}})['then'](handleEntityNotFound(_0x5222cf,null))['then'](saveUpdates(_0x558c13[_0xbca6('0x45')],null))['then'](respondWithResult(_0x5222cf,null))['catch'](handleError(_0x5222cf,null));};exports[_0xbca6('0x22')]=function(_0x4d4129,_0x565c4c){return db['CmHopperBlack']['find']({'where':{'id':_0x4d4129[_0xbca6('0x42')]['id']}})[_0xbca6('0x21')](handleEntityNotFound(_0x565c4c,null))[_0xbca6('0x21')](removeEntity(_0x565c4c,null))[_0xbca6('0x46')](handleError(_0x565c4c,null));};exports[_0xbca6('0x47')]=function(_0x27fa9b,_0x5ea320){return db[_0xbca6('0x29')][_0xbca6('0x47')]()['then'](respondWithResult(_0x5ea320,null))[_0xbca6('0x46')](handleError(_0x5ea320,null));}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.model.js b/server/api/cmHopperBlack/cmHopperBlack.model.js index c60d724..ec2639a 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 _0x3a83=['lodash','util','../../config/logger','moment','bluebird','request-promise','path','./cmHopperBlack.attributes','exports','CmHopperBlack','cm_hopper_black'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3a83,0x79));var _0x33a8=function(_0x1e87e9,_0x123c82){_0x1e87e9=_0x1e87e9-0x0;var _0x41c65e=_0x3a83[_0x1e87e9];return _0x41c65e;};'use strict';var _=require(_0x33a8('0x0'));var util=require(_0x33a8('0x1'));var logger=require(_0x33a8('0x2'))('api');var moment=require(_0x33a8('0x3'));var BPromise=require(_0x33a8('0x4'));var rp=require(_0x33a8('0x5'));var fs=require('fs');var path=require(_0x33a8('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x33a8('0x7'));module[_0x33a8('0x8')]=function(_0x3d41c6,_0x210020){return _0x3d41c6['define'](_0x33a8('0x9'),attributes,{'tableName':_0x33a8('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8b7f=['CmHopperBlack','cm_hopper_black','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define'];(function(_0x2064e5,_0x4f6fa2){var _0x21a233=function(_0x1b2491){while(--_0x1b2491){_0x2064e5['push'](_0x2064e5['shift']());}};_0x21a233(++_0x4f6fa2);}(_0x8b7f,0x1ca));var _0xf8b7=function(_0x46b69a,_0x54db48){_0x46b69a=_0x46b69a-0x0;var _0x27bd7a=_0x8b7f[_0x46b69a];return _0x27bd7a;};'use strict';var _=require('lodash');var util=require(_0xf8b7('0x0'));var logger=require('../../config/logger')(_0xf8b7('0x1'));var moment=require(_0xf8b7('0x2'));var BPromise=require(_0xf8b7('0x3'));var rp=require(_0xf8b7('0x4'));var fs=require('fs');var path=require(_0xf8b7('0x5'));var rimraf=require(_0xf8b7('0x6'));var config=require(_0xf8b7('0x7'));var attributes=require('./cmHopperBlack.attributes');module[_0xf8b7('0x8')]=function(_0x5d0e33,_0xd3aa14){return _0x5d0e33[_0xf8b7('0x9')](_0xf8b7('0xa'),attributes,{'tableName':_0xf8b7('0xb'),'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 75666e0..613b9d9 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 _0x2163=['map','model','UpdateCmHopperBlack','CmHopperBlack','update','body','destroy','DestroyCmHopperBlack','lodash','util','moment','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','request','then','CmHopperBlack,\x20%s,\x20%s','request\x20sent','debug','CmHopperBlack,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','GetCmHopperBlack','options','raw','where','attributes','limit','include'];(function(_0x535e0c,_0x5cfafc){var _0x518585=function(_0x5f1738){while(--_0x5f1738){_0x535e0c['push'](_0x535e0c['shift']());}};_0x518585(++_0x5cfafc);}(_0x2163,0x15e));var _0x3216=function(_0x3a1210,_0x431f1f){_0x3a1210=_0x3a1210-0x0;var _0x18f20f=_0x2163[_0x3a1210];return _0x18f20f;};'use strict';var _=require(_0x3216('0x0'));var util=require(_0x3216('0x1'));var moment=require(_0x3216('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3216('0x3'));var db=require(_0x3216('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x3216('0x5'))(_0x3216('0x6'));var config=require(_0x3216('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x3216('0x8')][_0x3216('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4e34fe,_0x3ffb99,_0x3b892a){return new BPromise(function(_0x534778,_0x305e59){return client[_0x3216('0xa')](_0x4e34fe,_0x3b892a)[_0x3216('0xb')](function(_0x2f457e){logger['info'](_0x3216('0xc'),_0x3ffb99,_0x3216('0xd'));logger[_0x3216('0xe')](_0x3216('0xf'),_0x3ffb99,_0x3216('0xd'),JSON[_0x3216('0x10')](_0x2f457e));if(_0x2f457e[_0x3216('0x11')]){if(_0x2f457e[_0x3216('0x11')][_0x3216('0x12')]===0x1f4){logger['error'](_0x3216('0xc'),_0x3ffb99,_0x2f457e[_0x3216('0x11')][_0x3216('0x13')]);return _0x305e59(_0x2f457e['error'][_0x3216('0x13')]);}logger[_0x3216('0x11')]('CmHopperBlack,\x20%s,\x20%s',_0x3ffb99,_0x2f457e[_0x3216('0x11')][_0x3216('0x13')]);return _0x534778(_0x2f457e['error'][_0x3216('0x13')]);}else{logger[_0x3216('0x14')](_0x3216('0xc'),_0x3ffb99,_0x3216('0xd'));_0x534778(_0x2f457e[_0x3216('0x15')][_0x3216('0x13')]);}})[_0x3216('0x16')](function(_0x1bcfa2){logger[_0x3216('0x11')](_0x3216('0xc'),_0x3ffb99,_0x1bcfa2);_0x305e59(_0x1bcfa2);});});}exports[_0x3216('0x17')]=function(_0x406a95){var _0x4f4dca=this;return new Promise(function(_0x17f83b,_0x3ef567){return db['CmHopperBlack']['findAll']({'raw':_0x406a95[_0x3216('0x18')]?_0x406a95[_0x3216('0x18')][_0x3216('0x19')]===undefined?!![]:![]:!![],'where':_0x406a95[_0x3216('0x18')]?_0x406a95[_0x3216('0x18')][_0x3216('0x1a')]||null:null,'attributes':_0x406a95[_0x3216('0x18')]?_0x406a95[_0x3216('0x18')][_0x3216('0x1b')]||null:null,'limit':_0x406a95[_0x3216('0x18')]?_0x406a95[_0x3216('0x18')][_0x3216('0x1c')]||null:null,'include':_0x406a95[_0x3216('0x18')]?_0x406a95[_0x3216('0x18')][_0x3216('0x1d')]?_[_0x3216('0x1e')](_0x406a95[_0x3216('0x18')][_0x3216('0x1d')],function(_0x26f341){return{'model':db[_0x26f341[_0x3216('0x1f')]],'as':_0x26f341['as'],'attributes':_0x26f341['attributes'],'include':_0x26f341[_0x3216('0x1d')]?_[_0x3216('0x1e')](_0x26f341['include'],function(_0xa1e53f){return{'model':db[_0xa1e53f[_0x3216('0x1f')]],'as':_0xa1e53f['as'],'attributes':_0xa1e53f[_0x3216('0x1b')],'include':_0xa1e53f[_0x3216('0x1d')]?_[_0x3216('0x1e')](_0xa1e53f[_0x3216('0x1d')],function(_0x8c10fb){return{'model':db[_0x8c10fb[_0x3216('0x1f')]],'as':_0x8c10fb['as'],'attributes':_0x8c10fb[_0x3216('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x3216('0xb')](function(_0x2b4f55){logger[_0x3216('0x14')](_0x3216('0x17'),_0x406a95);logger[_0x3216('0xe')](_0x3216('0x17'),_0x406a95,JSON[_0x3216('0x10')](_0x2b4f55));_0x17f83b(_0x2b4f55);})[_0x3216('0x16')](function(_0x484d86){logger['error'](_0x3216('0x17'),_0x484d86[_0x3216('0x13')],_0x406a95);_0x3ef567(_0x4f4dca[_0x3216('0x11')](0x1f4,_0x484d86[_0x3216('0x13')]));});});};exports[_0x3216('0x20')]=function(_0x4ab4e9){var _0x487509=this;return new Promise(function(_0x120ce4,_0xab0525){return db[_0x3216('0x21')][_0x3216('0x22')](_0x4ab4e9[_0x3216('0x23')],{'raw':_0x4ab4e9['options']?_0x4ab4e9[_0x3216('0x18')][_0x3216('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4ab4e9[_0x3216('0x18')]?_0x4ab4e9[_0x3216('0x18')][_0x3216('0x1a')]||null:null,'attributes':_0x4ab4e9['options']?_0x4ab4e9[_0x3216('0x18')][_0x3216('0x1b')]||null:null,'limit':_0x4ab4e9['options']?_0x4ab4e9[_0x3216('0x18')][_0x3216('0x1c')]||null:null})[_0x3216('0xb')](function(_0xca3027){logger[_0x3216('0x14')]('UpdateCmHopperBlack',_0x4ab4e9);logger[_0x3216('0xe')]('UpdateCmHopperBlack',_0x4ab4e9,JSON['stringify'](_0xca3027));_0x120ce4(_0xca3027);})['catch'](function(_0x3171b0){logger[_0x3216('0x11')](_0x3216('0x20'),_0x3171b0['message'],_0x4ab4e9);_0xab0525(_0x487509['error'](0x1f4,_0x3171b0[_0x3216('0x13')]));});});};exports['DestroyCmHopperBlack']=function(_0x28fdc6){var _0x24202b=this;return new Promise(function(_0x142387,_0x35de93){return db[_0x3216('0x21')][_0x3216('0x24')]({'where':_0x28fdc6[_0x3216('0x18')]?_0x28fdc6[_0x3216('0x18')][_0x3216('0x1a')]||null:null})['then'](function(_0x43ba69){logger[_0x3216('0x14')]('DestroyCmHopperBlack',_0x28fdc6);logger[_0x3216('0xe')]('DestroyCmHopperBlack',_0x28fdc6,JSON[_0x3216('0x10')](_0x43ba69));_0x142387(_0x43ba69);})[_0x3216('0x16')](function(_0x455b3c){logger['error'](_0x3216('0x25'),_0x455b3c[_0x3216('0x13')],_0x28fdc6);_0x35de93(_0x24202b[_0x3216('0x11')](0x1f4,_0x455b3c[_0x3216('0x13')]));});});}; \ No newline at end of file +var _0x6240=['lodash','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','request\x20sent','debug','CmHopperBlack,\x20%s,\x20%s,\x20%s','error','CmHopperBlack,\x20%s,\x20%s','message','info','catch','GetCmHopperBlack','findAll','options','include','attributes','map','model','CmHopperBlack','body','where','limit','UpdateCmHopperBlack','stringify','DestroyCmHopperBlack','destroy'];(function(_0x5bc39f,_0x327549){var _0x3a04c5=function(_0x702ef5){while(--_0x702ef5){_0x5bc39f['push'](_0x5bc39f['shift']());}};_0x3a04c5(++_0x327549);}(_0x6240,0x15e));var _0x0624=function(_0x50ad6a,_0x36c2ba){_0x50ad6a=_0x50ad6a-0x0;var _0x4ae816=_0x6240[_0x50ad6a];return _0x4ae816;};'use strict';var _=require(_0x0624('0x0'));var util=require('util');var moment=require(_0x0624('0x1'));var BPromise=require('bluebird');var rs=require(_0x0624('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0624('0x3'))['db'];var utils=require(_0x0624('0x4'));var logger=require(_0x0624('0x5'))(_0x0624('0x6'));var config=require(_0x0624('0x7'));var jayson=require(_0x0624('0x8'));var client=jayson[_0x0624('0x9')][_0x0624('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5c2de5,_0x262e93,_0x1af085){return new BPromise(function(_0x3d0b35,_0x55547d){return client['request'](_0x5c2de5,_0x1af085)[_0x0624('0xb')](function(_0x24ca17){logger['info']('CmHopperBlack,\x20%s,\x20%s',_0x262e93,_0x0624('0xc'));logger[_0x0624('0xd')](_0x0624('0xe'),_0x262e93,'request\x20sent',JSON['stringify'](_0x24ca17));if(_0x24ca17[_0x0624('0xf')]){if(_0x24ca17[_0x0624('0xf')]['code']===0x1f4){logger[_0x0624('0xf')](_0x0624('0x10'),_0x262e93,_0x24ca17[_0x0624('0xf')][_0x0624('0x11')]);return _0x55547d(_0x24ca17['error'][_0x0624('0x11')]);}logger['error'](_0x0624('0x10'),_0x262e93,_0x24ca17[_0x0624('0xf')]['message']);return _0x3d0b35(_0x24ca17[_0x0624('0xf')][_0x0624('0x11')]);}else{logger[_0x0624('0x12')](_0x0624('0x10'),_0x262e93,_0x0624('0xc'));_0x3d0b35(_0x24ca17['result'][_0x0624('0x11')]);}})[_0x0624('0x13')](function(_0x156133){logger[_0x0624('0xf')]('CmHopperBlack,\x20%s,\x20%s',_0x262e93,_0x156133);_0x55547d(_0x156133);});});}exports[_0x0624('0x14')]=function(_0x33d24d){var _0x1a2f95=this;return new Promise(function(_0xc7666a,_0x54c674){return db['CmHopperBlack'][_0x0624('0x15')]({'raw':_0x33d24d[_0x0624('0x16')]?_0x33d24d[_0x0624('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x33d24d[_0x0624('0x16')]?_0x33d24d[_0x0624('0x16')]['where']||null:null,'attributes':_0x33d24d[_0x0624('0x16')]?_0x33d24d[_0x0624('0x16')]['attributes']||null:null,'limit':_0x33d24d[_0x0624('0x16')]?_0x33d24d['options']['limit']||null:null,'include':_0x33d24d['options']?_0x33d24d[_0x0624('0x16')][_0x0624('0x17')]?_['map'](_0x33d24d[_0x0624('0x16')][_0x0624('0x17')],function(_0x342c88){return{'model':db[_0x342c88['model']],'as':_0x342c88['as'],'attributes':_0x342c88[_0x0624('0x18')],'include':_0x342c88[_0x0624('0x17')]?_[_0x0624('0x19')](_0x342c88['include'],function(_0x35134b){return{'model':db[_0x35134b[_0x0624('0x1a')]],'as':_0x35134b['as'],'attributes':_0x35134b[_0x0624('0x18')],'include':_0x35134b['include']?_[_0x0624('0x19')](_0x35134b['include'],function(_0x4f5e57){return{'model':db[_0x4f5e57[_0x0624('0x1a')]],'as':_0x4f5e57['as'],'attributes':_0x4f5e57[_0x0624('0x18')]};}):[]};}):[]};}):[]:[]})[_0x0624('0xb')](function(_0x3d1bc3){logger['info'](_0x0624('0x14'),_0x33d24d);logger[_0x0624('0xd')]('GetCmHopperBlack',_0x33d24d,JSON['stringify'](_0x3d1bc3));_0xc7666a(_0x3d1bc3);})[_0x0624('0x13')](function(_0x4b28de){logger[_0x0624('0xf')](_0x0624('0x14'),_0x4b28de[_0x0624('0x11')],_0x33d24d);_0x54c674(_0x1a2f95[_0x0624('0xf')](0x1f4,_0x4b28de[_0x0624('0x11')]));});});};exports['UpdateCmHopperBlack']=function(_0x5c2937){var _0x574e2f=this;return new Promise(function(_0x22578c,_0x52b0ec){return db[_0x0624('0x1b')]['update'](_0x5c2937[_0x0624('0x1c')],{'raw':_0x5c2937['options']?_0x5c2937[_0x0624('0x16')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5c2937[_0x0624('0x16')]?_0x5c2937[_0x0624('0x16')][_0x0624('0x1d')]||null:null,'attributes':_0x5c2937[_0x0624('0x16')]?_0x5c2937[_0x0624('0x16')][_0x0624('0x18')]||null:null,'limit':_0x5c2937[_0x0624('0x16')]?_0x5c2937['options'][_0x0624('0x1e')]||null:null})[_0x0624('0xb')](function(_0x57525b){logger[_0x0624('0x12')](_0x0624('0x1f'),_0x5c2937);logger[_0x0624('0xd')](_0x0624('0x1f'),_0x5c2937,JSON[_0x0624('0x20')](_0x57525b));_0x22578c(_0x57525b);})['catch'](function(_0xdec99a){logger['error'](_0x0624('0x1f'),_0xdec99a[_0x0624('0x11')],_0x5c2937);_0x52b0ec(_0x574e2f[_0x0624('0xf')](0x1f4,_0xdec99a[_0x0624('0x11')]));});});};exports[_0x0624('0x21')]=function(_0x48c722){var _0x8d1261=this;return new Promise(function(_0x57be0b,_0x277512){return db['CmHopperBlack'][_0x0624('0x22')]({'where':_0x48c722[_0x0624('0x16')]?_0x48c722[_0x0624('0x16')][_0x0624('0x1d')]||null:null})['then'](function(_0x8426a0){logger['info'](_0x0624('0x21'),_0x48c722);logger['debug'](_0x0624('0x21'),_0x48c722,JSON['stringify'](_0x8426a0));_0x57be0b(_0x8426a0);})['catch'](function(_0x388f76){logger[_0x0624('0xf')](_0x0624('0x21'),_0x388f76['message'],_0x48c722);_0x277512(_0x8d1261['error'](0x1f4,_0x388f76[_0x0624('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/index.js b/server/api/cmHopperBlack/index.js index 1671751..463fd7b 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 _0x187d=['multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./cmHopperBlack.controller','isAuthenticated','index','get','/describe','describe','/:id','show','put','update','delete','destroy','exports'];(function(_0x4ab81b,_0x2455f6){var _0x2bd405=function(_0x48c764){while(--_0x48c764){_0x4ab81b['push'](_0x4ab81b['shift']());}};_0x2bd405(++_0x2455f6);}(_0x187d,0x93));var _0xd187=function(_0x40ac5e,_0x2de228){_0x40ac5e=_0x40ac5e-0x0;var _0x2839d6=_0x187d[_0x40ac5e];return _0x2839d6;};'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')](_0xd187('0xe'),auth[_0xd187('0x9')](),controller[_0xd187('0x11')]);router[_0xd187('0x12')]('/:id',auth[_0xd187('0x9')](),controller[_0xd187('0x13')]);module[_0xd187('0x14')]=router; \ No newline at end of file +var _0x1623=['multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','./cmHopperBlack.controller','isAuthenticated','index','/describe','describe','get','/:id','show','put','update','delete','destroy','exports'];(function(_0xc19b03,_0xb08695){var _0xb45327=function(_0x187980){while(--_0x187980){_0xc19b03['push'](_0xc19b03['shift']());}};_0xb45327(++_0xb08695);}(_0x1623,0xab));var _0x3162=function(_0xb69143,_0x48c99e){_0xb69143=_0xb69143-0x0;var _0x551232=_0x1623[_0xb69143];return _0x551232;};'use strict';var multer=require(_0x3162('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x3162('0x1'));var express=require(_0x3162('0x2'));var router=express[_0x3162('0x3')]();var fs_extra=require(_0x3162('0x4'));var auth=require(_0x3162('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x3162('0x6'));router['get']('/',auth[_0x3162('0x7')](),controller[_0x3162('0x8')]);router['get'](_0x3162('0x9'),auth[_0x3162('0x7')](),controller[_0x3162('0xa')]);router[_0x3162('0xb')](_0x3162('0xc'),auth[_0x3162('0x7')](),controller[_0x3162('0xd')]);router[_0x3162('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x3162('0xf')]);router[_0x3162('0x10')](_0x3162('0xc'),auth[_0x3162('0x7')](),controller[_0x3162('0x11')]);module[_0x3162('0x12')]=router; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.attributes.js b/server/api/cmHopperFinal/cmHopperFinal.attributes.js index 655271a..e3624f3 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 _0x4a6a=['BOOLEAN','sequelize','moment','exports','INTEGER','STRING','DATE','getDataValue','setDataValue','followuptime','seconds'];(function(_0x1fb5ff,_0x483362){var _0x89725b=function(_0x5ec4d9){while(--_0x5ec4d9){_0x1fb5ff['push'](_0x1fb5ff['shift']());}};_0x89725b(++_0x483362);}(_0x4a6a,0x182));var _0xa4a6=function(_0x35d87f,_0x2eb5dc){_0x35d87f=_0x35d87f-0x0;var _0x472257=_0x4a6a[_0x35d87f];return _0x472257;};'use strict';var Sequelize=require(_0xa4a6('0x0'));var moment=require(_0xa4a6('0x1'));module[_0xa4a6('0x2')]={'state':{'type':Sequelize[_0xa4a6('0x3')](0x2)},'statedesc':{'type':Sequelize[_0xa4a6('0x4')]},'scheduledat':{'type':Sequelize[_0xa4a6('0x5')]},'countbusyretry':{'type':Sequelize[_0xa4a6('0x3')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xa4a6('0x3')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xa4a6('0x3')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0xa4a6('0x3')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0xa4a6('0x4')]},'originatecalleridnum':{'type':Sequelize[_0xa4a6('0x4')]},'originatecalleridname':{'type':Sequelize[_0xa4a6('0x4')]},'calleridnum':{'type':Sequelize[_0xa4a6('0x4')]},'calleridname':{'type':Sequelize[_0xa4a6('0x4')]},'starttime':{'type':Sequelize[_0xa4a6('0x5')]},'responsetime':{'type':Sequelize[_0xa4a6('0x5')]},'answertime':{'type':Sequelize[_0xa4a6('0x5')]},'droptime':{'type':Sequelize[_0xa4a6('0x5')]},'endtime':{'type':Sequelize['DATE']},'ringtime':{'type':Sequelize[_0xa4a6('0x3')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0xa4a6('0x3')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0xa4a6('0x3')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0xa4a6('0x3')],'defaultValue':0x0},'dropreason':{'type':Sequelize['STRING']},'campaign':{'type':Sequelize[_0xa4a6('0x4')]},'campaigntype':{'type':Sequelize[_0xa4a6('0x4')]},'membername':{'type':Sequelize['STRING']},'reason':{'type':Sequelize[_0xa4a6('0x4')]},'disposition':{'type':Sequelize[_0xa4a6('0x4')]},'secondDisposition':{'type':Sequelize[_0xa4a6('0x4')]},'thirdDisposition':{'type':Sequelize[_0xa4a6('0x4')]},'dispositionat':{'type':Sequelize[_0xa4a6('0x5')],'set':function(_0x1498ca){var _0x8b01fc=this[_0xa4a6('0x6')]('endtime');if(_0x8b01fc&&_0x1498ca){this[_0xa4a6('0x7')](_0xa4a6('0x8'),moment(_0x1498ca)['diff'](moment(_0x8b01fc),_0xa4a6('0x9')));}}},'amd':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fax':{'type':Sequelize[_0xa4a6('0xa')],'defaultValue':![]},'blacklist':{'type':Sequelize[_0xa4a6('0xa')],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0xa4a6('0xa')],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0xa4a6('0x5')]},'callback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xa4a6('0x4')],'defaultValue':null},'callbackat':{'type':Sequelize[_0xa4a6('0x5')]},'deleted':{'type':Sequelize[_0xa4a6('0x4')],'defaultValue':null},'deletedat':{'type':Sequelize[_0xa4a6('0x5')]},'recallme':{'type':Sequelize[_0xa4a6('0xa')],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0xa4a6('0x5')]},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xa4a6('0x3')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xa4a6('0x3')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0xa432=['getDataValue','diff','BOOLEAN','sequelize','INTEGER','STRING','DATE'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xa432,0xdc));var _0x2a43=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0xa432[_0x1ac595];return _0x455fff;};'use strict';var Sequelize=require(_0x2a43('0x0'));var moment=require('moment');module['exports']={'state':{'type':Sequelize[_0x2a43('0x1')](0x2)},'statedesc':{'type':Sequelize[_0x2a43('0x2')]},'scheduledat':{'type':Sequelize['DATE']},'countbusyretry':{'type':Sequelize[_0x2a43('0x1')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x2a43('0x1')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x2a43('0x1')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x2a43('0x1')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x2a43('0x2')]},'originatecalleridnum':{'type':Sequelize[_0x2a43('0x2')]},'originatecalleridname':{'type':Sequelize[_0x2a43('0x2')]},'calleridnum':{'type':Sequelize[_0x2a43('0x2')]},'calleridname':{'type':Sequelize[_0x2a43('0x2')]},'starttime':{'type':Sequelize[_0x2a43('0x3')]},'responsetime':{'type':Sequelize[_0x2a43('0x3')]},'answertime':{'type':Sequelize[_0x2a43('0x3')]},'droptime':{'type':Sequelize[_0x2a43('0x3')]},'endtime':{'type':Sequelize[_0x2a43('0x3')]},'ringtime':{'type':Sequelize[_0x2a43('0x1')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x2a43('0x1')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x2a43('0x1')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x2a43('0x1')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x2a43('0x2')]},'campaign':{'type':Sequelize[_0x2a43('0x2')]},'campaigntype':{'type':Sequelize[_0x2a43('0x2')]},'membername':{'type':Sequelize[_0x2a43('0x2')]},'reason':{'type':Sequelize[_0x2a43('0x2')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x2a43('0x2')]},'thirdDisposition':{'type':Sequelize[_0x2a43('0x2')]},'dispositionat':{'type':Sequelize['DATE'],'set':function(_0x35c95f){var _0x1ed2ea=this[_0x2a43('0x4')]('endtime');if(_0x1ed2ea&&_0x35c95f){this['setDataValue']('followuptime',moment(_0x35c95f)[_0x2a43('0x5')](moment(_0x1ed2ea),'seconds'));}}},'amd':{'type':Sequelize[_0x2a43('0x6')],'defaultValue':![]},'fax':{'type':Sequelize[_0x2a43('0x6')],'defaultValue':![]},'blacklist':{'type':Sequelize[_0x2a43('0x6')],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0x2a43('0x6')],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0x2a43('0x3')]},'callback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x2a43('0x2')],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'deleted':{'type':Sequelize['STRING'],'defaultValue':null},'deletedat':{'type':Sequelize[_0x2a43('0x3')]},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agiafterat':{'type':Sequelize['DATE']},'countnosuchnumberretry':{'type':Sequelize[_0x2a43('0x1')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x2a43('0x1')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x2a43('0x1')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x2a43('0x1')],'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 5c997b2..a82aead 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 _0xeff8=['eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','ejs','fs-extra','lodash','squel','jsforce','desk.js','to-csv','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','index','map','CmHopperFinal','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','length','include','describe','body','uniqueid','find','countContactsQueueCampaignHopperFinal','sequelize','COUNT','literal','`state`\x20=\x203,\x201,\x20null','`state`\x20=\x205,\x201,\x20null','busyContacts','`state`\x20=\x208,\x201,\x20null','congestionContacts','`state`\x20=\x2010\x20,\x201,\x20null','dropContacts','abandonedContacts','`state`\x20=\x2022,\x201,\x20null','reCallContacts','`state`\x20=\x2019,\x201,\x20null','answeringMachine','noSuchContacts','noAnswerContacts','`state`\x20=\x2011\x20,\x201,\x20null','VoiceQueue','insert','into','cm_hopper','fromQuery','phone','scheduledAt','ContactId','ListId','createdAt','updatedAt','select','field','ANY_VALUE(calleridnum)','NOW()','ANY_VALUE(VoiceQueueId)','VoiceQueueId','from','cm_hopper_final','VoiceQueueId\x20=\x20?','state\x20=\x20?','calleridnum\x20IS\x20NOT\x20NULL','calleridnum\x20NOT\x20IN\x20(?)','toString','group','moveContactsIvrCampaignHopperFinal','CampaignId','ANY_VALUE(ContactId)','ANY_VALUE(ListId)','ANY_VALUE(CampaignId)','CampaignId\x20=\x20?','calleridnum','CmHopper','findOne'];(function(_0x4d572e,_0x59ceb7){var _0x43a969=function(_0x2184d1){while(--_0x2184d1){_0x4d572e['push'](_0x4d572e['shift']());}};_0x43a969(++_0x59ceb7);}(_0xeff8,0x186));var _0x8eff=function(_0x42f009,_0x5e27b1){_0x42f009=_0x42f009-0x0;var _0x22a1e0=_0xeff8[_0x42f009];return _0x22a1e0;};'use strict';var emlformat=require(_0x8eff('0x0'));var rimraf=require(_0x8eff('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8eff('0x2'));var rp=require(_0x8eff('0x3'));var moment=require(_0x8eff('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x8eff('0x5'));var util=require(_0x8eff('0x6'));var path=require(_0x8eff('0x7'));var sox=require(_0x8eff('0x8'));var csv=require('to-csv');var ejs=require(_0x8eff('0x9'));var fs=require('fs');var fs_extra=require(_0x8eff('0xa'));var _=require(_0x8eff('0xb'));var squel=require(_0x8eff('0xc'));var crypto=require('crypto');var jsforce=require(_0x8eff('0xd'));var deskjs=require(_0x8eff('0xe'));var toCsv=require(_0x8eff('0xf'));var querystring=require(_0x8eff('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x8eff('0x11'));var qs=require(_0x8eff('0x12'));var as=require(_0x8eff('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8eff('0x14'))(_0x8eff('0x15'));var utils=require('../../config/utils');var config=require(_0x8eff('0x16'));var licenseUtil=require(_0x8eff('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4a399e,_0x45f280){_0x45f280=_0x45f280||0xcc;return function(_0x43c914){if(_0x43c914){return _0x4a399e[_0x8eff('0x18')](_0x45f280);}return _0x4a399e[_0x8eff('0x19')](_0x45f280)[_0x8eff('0x1a')]();};}function respondWithResult(_0x56efdf,_0x3e7c01){_0x3e7c01=_0x3e7c01||0xc8;return function(_0x212a2e){if(_0x212a2e){return _0x56efdf[_0x8eff('0x19')](_0x3e7c01)[_0x8eff('0x1b')](_0x212a2e);}};}function respondWithFilteredResult(_0x228eb1,_0x4cfc91){return function(_0x16202e){if(_0x16202e){var _0xdbb753=typeof _0x4cfc91[_0x8eff('0x1c')]===_0x8eff('0x1d')&&typeof _0x4cfc91[_0x8eff('0x1e')]==='undefined';var _0x32b791=_0x16202e[_0x8eff('0x1f')];var _0x3cd1dc=_0xdbb753?0x0:_0x4cfc91[_0x8eff('0x1c')];var _0x2cd7c5=_0xdbb753?_0x16202e[_0x8eff('0x1f')]:_0x4cfc91[_0x8eff('0x1c')]+_0x4cfc91[_0x8eff('0x1e')];var _0x1b003c;if(_0x2cd7c5>=_0x32b791){_0x2cd7c5=_0x32b791;_0x1b003c=0xc8;}else{_0x1b003c=0xce;}_0x228eb1[_0x8eff('0x19')](_0x1b003c);return _0x228eb1[_0x8eff('0x20')](_0x8eff('0x21'),_0x3cd1dc+'-'+_0x2cd7c5+'/'+_0x32b791)[_0x8eff('0x1b')](_0x16202e);}return null;};}function patchUpdates(_0x2a7337){return function(_0xdbb7b5){try{jsonpatch[_0x8eff('0x22')](_0xdbb7b5,_0x2a7337,!![]);}catch(_0x5e157c){return BPromise[_0x8eff('0x23')](_0x5e157c);}return _0xdbb7b5[_0x8eff('0x24')]();};}function saveUpdates(_0x5a2492,_0x1c4ad3){return function(_0x5ea31f){if(_0x5ea31f){return _0x5ea31f[_0x8eff('0x25')](_0x5a2492)[_0x8eff('0x26')](function(_0x1ccc79){return _0x1ccc79;});}return null;};}function removeEntity(_0x59cc32,_0x1ee09c){return function(_0x4e891c){if(_0x4e891c){return _0x4e891c[_0x8eff('0x27')]()[_0x8eff('0x26')](function(){_0x59cc32['status'](0xcc)[_0x8eff('0x1a')]();});}};}function handleEntityNotFound(_0x5ec3d7,_0x40404b){return function(_0x3b698b){if(!_0x3b698b){_0x5ec3d7[_0x8eff('0x18')](0x194);}return _0x3b698b;};}function handleError(_0x41324b,_0x6359df){_0x6359df=_0x6359df||0x1f4;return function(_0x2e8067){logger['error'](_0x2e8067[_0x8eff('0x28')]);if(_0x2e8067[_0x8eff('0x29')]){delete _0x2e8067[_0x8eff('0x29')];}_0x41324b[_0x8eff('0x19')](_0x6359df)[_0x8eff('0x2a')](_0x2e8067);};}exports[_0x8eff('0x2b')]=function(_0x4cc146,_0x4ed3b8){var _0x44dcdb={},_0x472b19={},_0x17ff3f={'count':0x0,'rows':[]};var _0x5ce071=_[_0x8eff('0x2c')](db[_0x8eff('0x2d')][_0x8eff('0x2e')],function(_0x1da0fa){return{'name':_0x1da0fa[_0x8eff('0x2f')],'type':_0x1da0fa[_0x8eff('0x30')][_0x8eff('0x31')]};});_0x472b19[_0x8eff('0x32')]=_[_0x8eff('0x2c')](_0x5ce071,_0x8eff('0x29'));_0x472b19[_0x8eff('0x33')]=_[_0x8eff('0x34')](_0x4cc146['query']);_0x472b19[_0x8eff('0x35')]=_[_0x8eff('0x36')](_0x472b19[_0x8eff('0x32')],_0x472b19[_0x8eff('0x33')]);_0x44dcdb['attributes']=_[_0x8eff('0x36')](_0x472b19[_0x8eff('0x32')],qs['fields'](_0x4cc146['query'][_0x8eff('0x37')]));_0x44dcdb[_0x8eff('0x38')]=_0x44dcdb['attributes']['length']?_0x44dcdb['attributes']:_0x472b19[_0x8eff('0x32')];if(!_0x4cc146['query'][_0x8eff('0x39')]('nolimit')){_0x44dcdb[_0x8eff('0x1e')]=qs[_0x8eff('0x1e')](_0x4cc146[_0x8eff('0x33')][_0x8eff('0x1e')]);_0x44dcdb[_0x8eff('0x1c')]=qs[_0x8eff('0x1c')](_0x4cc146['query'][_0x8eff('0x1c')]);}_0x44dcdb['order']=qs[_0x8eff('0x3a')](_0x4cc146['query'][_0x8eff('0x3a')]);_0x44dcdb[_0x8eff('0x3b')]=qs[_0x8eff('0x35')](_[_0x8eff('0x3c')](_0x4cc146['query'],_0x472b19[_0x8eff('0x35')]),_0x5ce071);if(_0x4cc146[_0x8eff('0x33')][_0x8eff('0x3d')]){_0x44dcdb['where']=_[_0x8eff('0x3e')](_0x44dcdb[_0x8eff('0x3b')],{'$or':_[_0x8eff('0x2c')](_0x5ce071,function(_0x345bc7){if(_0x345bc7[_0x8eff('0x30')]!==_0x8eff('0x3f')){var _0x29f68e={};_0x29f68e[_0x345bc7[_0x8eff('0x29')]]={'$like':'%'+_0x4cc146[_0x8eff('0x33')]['filter']+'%'};return _0x29f68e;}})});}_0x44dcdb=_['merge']({},_0x44dcdb,_0x4cc146[_0x8eff('0x40')]);var _0x114f8e={'where':_0x44dcdb[_0x8eff('0x3b')]};return db[_0x8eff('0x2d')][_0x8eff('0x1f')](_0x114f8e)[_0x8eff('0x26')](function(_0x18b132){_0x17ff3f['count']=_0x18b132;if(_0x4cc146[_0x8eff('0x33')][_0x8eff('0x41')]){_0x44dcdb['include']=[{'all':!![]}];}return db[_0x8eff('0x2d')][_0x8eff('0x42')](_0x44dcdb);})[_0x8eff('0x26')](function(_0x18309b){_0x17ff3f[_0x8eff('0x43')]=_0x18309b;return _0x17ff3f;})[_0x8eff('0x26')](respondWithFilteredResult(_0x4ed3b8,_0x44dcdb))[_0x8eff('0x44')](handleError(_0x4ed3b8,null));};exports[_0x8eff('0x45')]=function(_0x6d0568,_0x480c4c){var _0x37f376={'raw':!![],'where':{'id':_0x6d0568[_0x8eff('0x46')]['id']}},_0x27a8c9={};_0x27a8c9[_0x8eff('0x32')]=_[_0x8eff('0x34')](db['CmHopperFinal'][_0x8eff('0x2e')]);_0x27a8c9['query']=_[_0x8eff('0x34')](_0x6d0568[_0x8eff('0x33')]);_0x27a8c9[_0x8eff('0x35')]=_[_0x8eff('0x36')](_0x27a8c9['model'],_0x27a8c9[_0x8eff('0x33')]);_0x37f376[_0x8eff('0x38')]=_[_0x8eff('0x36')](_0x27a8c9['model'],qs['fields'](_0x6d0568[_0x8eff('0x33')][_0x8eff('0x37')]));_0x37f376[_0x8eff('0x38')]=_0x37f376[_0x8eff('0x38')][_0x8eff('0x47')]?_0x37f376['attributes']:_0x27a8c9[_0x8eff('0x32')];if(_0x6d0568['query'][_0x8eff('0x41')]){_0x37f376[_0x8eff('0x48')]=[{'all':!![]}];}_0x37f376=_['merge']({},_0x37f376,_0x6d0568['options']);return db['CmHopperFinal']['find'](_0x37f376)['then'](handleEntityNotFound(_0x480c4c,null))['then'](respondWithResult(_0x480c4c,null))[_0x8eff('0x44')](handleError(_0x480c4c,null));};exports[_0x8eff('0x49')]=function(_0x33aa8d,_0x1b5fda){return db[_0x8eff('0x2d')][_0x8eff('0x49')]()[_0x8eff('0x26')](respondWithResult(_0x1b5fda,null))[_0x8eff('0x44')](handleError(_0x1b5fda,null));};exports[_0x8eff('0x25')]=function(_0x3287d6,_0x4c7013){if(_0x3287d6[_0x8eff('0x4a')]['uniqueid']){delete _0x3287d6[_0x8eff('0x4a')][_0x8eff('0x4b')];}return db[_0x8eff('0x2d')][_0x8eff('0x4c')]({'where':{'uniqueid':_0x3287d6[_0x8eff('0x46')]['id']}})[_0x8eff('0x26')](handleEntityNotFound(_0x4c7013,null))[_0x8eff('0x26')](saveUpdates(_0x3287d6[_0x8eff('0x4a')],null))[_0x8eff('0x26')](respondWithResult(_0x4c7013,null))[_0x8eff('0x44')](handleError(_0x4c7013,null));};exports[_0x8eff('0x4d')]=function(_0x452f7a,_0x47b28d,_0x13ae7c){return db[_0x8eff('0x2d')][_0x8eff('0x42')]({'raw':![],'where':{'VoiceQueueId':_0x452f7a[_0x8eff('0x46')]['id']},'attributes':[[db[_0x8eff('0x4e')]['fn'](_0x8eff('0x4f'),db[_0x8eff('0x4e')]['fn']('IF',db[_0x8eff('0x4e')][_0x8eff('0x50')]('`state`\x20=\x200,\x201,\x20null'))),'noSuchContacts'],[db[_0x8eff('0x4e')]['fn'](_0x8eff('0x4f'),db[_0x8eff('0x4e')]['fn']('IF',db[_0x8eff('0x4e')][_0x8eff('0x50')](_0x8eff('0x51')))),'noAnswerContacts'],[db[_0x8eff('0x4e')]['fn'](_0x8eff('0x4f'),db[_0x8eff('0x4e')]['fn']('IF',db['sequelize'][_0x8eff('0x50')](_0x8eff('0x52')))),_0x8eff('0x53')],[db[_0x8eff('0x4e')]['fn']('COUNT',db[_0x8eff('0x4e')]['fn']('IF',db[_0x8eff('0x4e')][_0x8eff('0x50')](_0x8eff('0x54')))),_0x8eff('0x55')],[db[_0x8eff('0x4e')]['fn'](_0x8eff('0x4f'),db['sequelize']['fn']('IF',db[_0x8eff('0x4e')][_0x8eff('0x50')](_0x8eff('0x56')))),_0x8eff('0x57')],[db[_0x8eff('0x4e')]['fn']('COUNT',db[_0x8eff('0x4e')]['fn']('IF',db[_0x8eff('0x4e')][_0x8eff('0x50')]('`state`\x20=\x2011\x20,\x201,\x20null'))),_0x8eff('0x58')],[db['sequelize']['fn'](_0x8eff('0x4f'),db[_0x8eff('0x4e')]['fn']('IF',db[_0x8eff('0x4e')][_0x8eff('0x50')](_0x8eff('0x59')))),_0x8eff('0x5a')],[db[_0x8eff('0x4e')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x8eff('0x4e')]['literal'](_0x8eff('0x5b')))),_0x8eff('0x5c')]]})[_0x8eff('0x26')](handleEntityNotFound(_0x47b28d,null))[_0x8eff('0x26')](respondWithResult(_0x47b28d,null))[_0x8eff('0x44')](handleError(_0x47b28d,null));};exports['countContactsIvrCampaignHopperFinal']=function(_0x4064bd,_0x36afc3,_0x1813df){return db[_0x8eff('0x2d')][_0x8eff('0x42')]({'raw':![],'where':{'CampaignId':_0x4064bd[_0x8eff('0x46')]['id']},'attributes':[[db['sequelize']['fn'](_0x8eff('0x4f'),db['sequelize']['fn']('IF',db[_0x8eff('0x4e')][_0x8eff('0x50')]('`state`\x20=\x200,\x201,\x20null'))),_0x8eff('0x5d')],[db[_0x8eff('0x4e')]['fn'](_0x8eff('0x4f'),db[_0x8eff('0x4e')]['fn']('IF',db[_0x8eff('0x4e')][_0x8eff('0x50')](_0x8eff('0x51')))),_0x8eff('0x5e')],[db['sequelize']['fn'](_0x8eff('0x4f'),db['sequelize']['fn']('IF',db['sequelize'][_0x8eff('0x50')](_0x8eff('0x52')))),'busyContacts'],[db[_0x8eff('0x4e')]['fn'](_0x8eff('0x4f'),db['sequelize']['fn']('IF',db[_0x8eff('0x4e')][_0x8eff('0x50')]('`state`\x20=\x208,\x201,\x20null'))),_0x8eff('0x55')],[db[_0x8eff('0x4e')]['fn'](_0x8eff('0x4f'),db[_0x8eff('0x4e')]['fn']('IF',db[_0x8eff('0x4e')][_0x8eff('0x50')](_0x8eff('0x56')))),'dropContacts'],[db['sequelize']['fn'](_0x8eff('0x4f'),db[_0x8eff('0x4e')]['fn']('IF',db[_0x8eff('0x4e')][_0x8eff('0x50')](_0x8eff('0x5f')))),_0x8eff('0x58')],[db[_0x8eff('0x4e')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x8eff('0x4e')]['literal']('`state`\x20=\x2022,\x201,\x20null'))),'reCallContacts'],[db[_0x8eff('0x4e')]['fn'](_0x8eff('0x4f'),db[_0x8eff('0x4e')]['fn']('IF',db[_0x8eff('0x4e')][_0x8eff('0x50')](_0x8eff('0x5b')))),_0x8eff('0x5c')]]})[_0x8eff('0x26')](handleEntityNotFound(_0x36afc3,null))['then'](respondWithResult(_0x36afc3,null))[_0x8eff('0x44')](handleError(_0x36afc3,null));};exports['moveContactsQueueCampaignHopperFinal']=function(_0x42efc6,_0x35a221,_0x12ebd1){return db[_0x8eff('0x60')][_0x8eff('0x4c')]({'where':{'id':_0x42efc6[_0x8eff('0x46')]['id']}})['then'](handleEntityNotFound(_0x35a221,null))[_0x8eff('0x26')](function(_0x545fcf){var _0x1d8d8f;if(_0x545fcf){_0x1d8d8f=squel[_0x8eff('0x61')]()[_0x8eff('0x62')](_0x8eff('0x63'))[_0x8eff('0x64')]([_0x8eff('0x65'),_0x8eff('0x66'),_0x8eff('0x67'),_0x8eff('0x68'),'VoiceQueueId',_0x8eff('0x69'),_0x8eff('0x6a')],squel[_0x8eff('0x6b')]()[_0x8eff('0x6c')](_0x8eff('0x6d'),_0x8eff('0x65'))[_0x8eff('0x6c')](_0x8eff('0x6e'),_0x8eff('0x66'))[_0x8eff('0x6c')]('ANY_VALUE(ContactId)','ContactId')['field']('ANY_VALUE(ListId)',_0x8eff('0x68'))[_0x8eff('0x6c')](_0x8eff('0x6f'),_0x8eff('0x70'))[_0x8eff('0x6c')](_0x8eff('0x6e'),_0x8eff('0x69'))['field'](_0x8eff('0x6e'),_0x8eff('0x6a'))[_0x8eff('0x71')](_0x8eff('0x72'))['where'](_0x8eff('0x73'),_0x42efc6[_0x8eff('0x46')]['id']['toString']())[_0x8eff('0x3b')](_0x8eff('0x74'),_0x42efc6[_0x8eff('0x4a')]['state']['toString']())['where'](_0x8eff('0x75'))[_0x8eff('0x3b')](_0x8eff('0x76'),squel[_0x8eff('0x6b')]()[_0x8eff('0x6c')](_0x8eff('0x65'))[_0x8eff('0x71')](_0x8eff('0x63'))[_0x8eff('0x3b')](_0x8eff('0x73'),_0x42efc6[_0x8eff('0x46')]['id']['toString']()))[_0x8eff('0x3b')]('calleridnum\x20NOT\x20IN\x20(?)',squel[_0x8eff('0x6b')]()[_0x8eff('0x6c')]('calleridnum')[_0x8eff('0x71')]('cm_hopper_final')[_0x8eff('0x3b')](_0x8eff('0x73'),_0x42efc6[_0x8eff('0x46')]['id'][_0x8eff('0x77')]())[_0x8eff('0x3b')]('state\x20=\x204'))[_0x8eff('0x78')](_0x8eff('0x67')))[_0x8eff('0x77')]();return db[_0x8eff('0x4e')][_0x8eff('0x33')](_0x1d8d8f);}return[];})[_0x8eff('0x26')](respondWithResult(_0x35a221,null))[_0x8eff('0x44')](handleError(_0x35a221,null));};exports[_0x8eff('0x79')]=function(_0x23a771,_0x452b90,_0x43bbce){return db['Campaign'][_0x8eff('0x4c')]({'where':{'id':_0x23a771[_0x8eff('0x46')]['id']}})[_0x8eff('0x26')](handleEntityNotFound(_0x452b90,null))[_0x8eff('0x26')](function(_0x17f63b){var _0x582478;if(_0x17f63b){_0x582478=squel[_0x8eff('0x61')]()[_0x8eff('0x62')]('cm_hopper')['fromQuery']([_0x8eff('0x65'),_0x8eff('0x66'),_0x8eff('0x67'),_0x8eff('0x68'),_0x8eff('0x7a'),_0x8eff('0x69'),'updatedAt'],squel[_0x8eff('0x6b')]()['field'](_0x8eff('0x6d'),_0x8eff('0x65'))['field'](_0x8eff('0x6e'),'scheduledAt')['field'](_0x8eff('0x7b'),'ContactId')[_0x8eff('0x6c')](_0x8eff('0x7c'),'ListId')[_0x8eff('0x6c')](_0x8eff('0x7d'),'CampaignId')[_0x8eff('0x6c')](_0x8eff('0x6e'),_0x8eff('0x69'))[_0x8eff('0x6c')](_0x8eff('0x6e'),_0x8eff('0x6a'))[_0x8eff('0x71')](_0x8eff('0x72'))[_0x8eff('0x3b')]('CampaignId\x20=\x20?',_0x23a771['params']['id']['toString']())[_0x8eff('0x3b')](_0x8eff('0x74'),_0x23a771[_0x8eff('0x4a')]['state'][_0x8eff('0x77')]())[_0x8eff('0x3b')](_0x8eff('0x75'))[_0x8eff('0x3b')](_0x8eff('0x76'),squel[_0x8eff('0x6b')]()['field'](_0x8eff('0x65'))['from'](_0x8eff('0x63'))[_0x8eff('0x3b')](_0x8eff('0x7e'),_0x23a771[_0x8eff('0x46')]['id'][_0x8eff('0x77')]()))[_0x8eff('0x3b')](_0x8eff('0x76'),squel['select']()[_0x8eff('0x6c')](_0x8eff('0x7f'))[_0x8eff('0x71')](_0x8eff('0x72'))[_0x8eff('0x3b')]('CampaignId\x20=\x20?',_0x23a771[_0x8eff('0x46')]['id'][_0x8eff('0x77')]())[_0x8eff('0x3b')]('state\x20=\x204'))['group'](_0x8eff('0x67')))[_0x8eff('0x77')]();return db[_0x8eff('0x4e')]['query'](_0x582478);}return[];})[_0x8eff('0x26')](respondWithResult(_0x452b90,null))['catch'](handleError(_0x452b90,null));};exports['checkContactHopper']=function(_0x10b9ac,_0x6bc93b,_0x10ade6){return db[_0x8eff('0x80')][_0x8eff('0x81')]({'where':{'VoiceQueueId':_0x10b9ac[_0x8eff('0x4a')][_0x8eff('0x70')],'CampaignId':_0x10b9ac[_0x8eff('0x4a')][_0x8eff('0x7a')],'ContactId':_0x10b9ac[_0x8eff('0x4a')][_0x8eff('0x67')]}})[_0x8eff('0x26')](handleEntityNotFound(_0x6bc93b,null))['then'](function(_0x34a0f7){if(_0x34a0f7){return _0x34a0f7;}return null;})[_0x8eff('0x26')](respondWithResult(_0x6bc93b,null))[_0x8eff('0x44')](handleError(_0x6bc93b,null));}; \ No newline at end of file +var _0x814b=['into','cm_hopper','fromQuery','phone','scheduledAt','ContactId','ListId','VoiceQueueId','createdAt','updatedAt','select','field','NOW()','ANY_VALUE(ContactId)','ANY_VALUE(VoiceQueueId)','from','toString','calleridnum\x20IS\x20NOT\x20NULL','calleridnum\x20NOT\x20IN\x20(?)','calleridnum','VoiceQueueId\x20=\x20?','state\x20=\x204','group','Campaign','ANY_VALUE(calleridnum)','ANY_VALUE(CampaignId)','CampaignId','cm_hopper_final','CampaignId\x20=\x20?','checkContactHopper','findOne','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','sort','where','filters','pick','filter','merge','options','CmHopperFinal','includeAll','include','findAll','catch','params','find','describe','body','uniqueid','sequelize','`state`\x20=\x200,\x201,\x20null','noSuchContacts','literal','`state`\x20=\x203,\x201,\x20null','`state`\x20=\x205,\x201,\x20null','`state`\x20=\x208,\x201,\x20null','COUNT','`state`\x20=\x2010\x20,\x201,\x20null','dropContacts','`state`\x20=\x2011\x20,\x201,\x20null','abandonedContacts','reCallContacts','`state`\x20=\x2019,\x201,\x20null','answeringMachine','countContactsIvrCampaignHopperFinal','noAnswerContacts','busyContacts','congestionContacts','`state`\x20=\x2022,\x201,\x20null','moveContactsQueueCampaignHopperFinal','VoiceQueue','insert'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x814b,0x1a2));var _0xb814=function(_0x460666,_0x24bfa0){_0x460666=_0x460666-0x0;var _0x555cbf=_0x814b[_0x460666];return _0x555cbf;};'use strict';var emlformat=require(_0xb814('0x0'));var rimraf=require(_0xb814('0x1'));var zipdir=require(_0xb814('0x2'));var jsonpatch=require(_0xb814('0x3'));var rp=require(_0xb814('0x4'));var moment=require(_0xb814('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xb814('0x6'));var util=require(_0xb814('0x7'));var path=require(_0xb814('0x8'));var sox=require(_0xb814('0x9'));var csv=require(_0xb814('0xa'));var ejs=require(_0xb814('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb814('0xc'));var squel=require(_0xb814('0xd'));var crypto=require('crypto');var jsforce=require(_0xb814('0xe'));var deskjs=require(_0xb814('0xf'));var toCsv=require(_0xb814('0xa'));var querystring=require(_0xb814('0x10'));var Papa=require(_0xb814('0x11'));var Redis=require(_0xb814('0x12'));var authService=require(_0xb814('0x13'));var qs=require(_0xb814('0x14'));var as=require(_0xb814('0x15'));var hardwareService=require(_0xb814('0x16'));var logger=require(_0xb814('0x17'))('api');var utils=require(_0xb814('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0xb814('0x19'));var db=require(_0xb814('0x1a'))['db'];function respondWithStatusCode(_0x35b10d,_0x2cc46b){_0x2cc46b=_0x2cc46b||0xcc;return function(_0x2ce718){if(_0x2ce718){return _0x35b10d[_0xb814('0x1b')](_0x2cc46b);}return _0x35b10d[_0xb814('0x1c')](_0x2cc46b)[_0xb814('0x1d')]();};}function respondWithResult(_0xa0a2e5,_0x2ab627){_0x2ab627=_0x2ab627||0xc8;return function(_0x3f4881){if(_0x3f4881){return _0xa0a2e5[_0xb814('0x1c')](_0x2ab627)[_0xb814('0x1e')](_0x3f4881);}};}function respondWithFilteredResult(_0x39bfcf,_0x303aca){return function(_0x3a71d6){if(_0x3a71d6){var _0x45e0d0=typeof _0x303aca[_0xb814('0x1f')]===_0xb814('0x20')&&typeof _0x303aca[_0xb814('0x21')]===_0xb814('0x20');var _0x48c9df=_0x3a71d6[_0xb814('0x22')];var _0x55ba16=_0x45e0d0?0x0:_0x303aca[_0xb814('0x1f')];var _0xfac75b=_0x45e0d0?_0x3a71d6['count']:_0x303aca['offset']+_0x303aca['limit'];var _0x399b43;if(_0xfac75b>=_0x48c9df){_0xfac75b=_0x48c9df;_0x399b43=0xc8;}else{_0x399b43=0xce;}_0x39bfcf['status'](_0x399b43);return _0x39bfcf['set'](_0xb814('0x23'),_0x55ba16+'-'+_0xfac75b+'/'+_0x48c9df)[_0xb814('0x1e')](_0x3a71d6);}return null;};}function patchUpdates(_0x25b6b6){return function(_0x4e139e){try{jsonpatch[_0xb814('0x24')](_0x4e139e,_0x25b6b6,!![]);}catch(_0x531032){return BPromise[_0xb814('0x25')](_0x531032);}return _0x4e139e[_0xb814('0x26')]();};}function saveUpdates(_0x3b267e,_0x470e81){return function(_0x27352e){if(_0x27352e){return _0x27352e[_0xb814('0x27')](_0x3b267e)[_0xb814('0x28')](function(_0x594470){return _0x594470;});}return null;};}function removeEntity(_0x2ead86,_0x52b7a3){return function(_0x3f81d0){if(_0x3f81d0){return _0x3f81d0[_0xb814('0x29')]()[_0xb814('0x28')](function(){_0x2ead86[_0xb814('0x1c')](0xcc)[_0xb814('0x1d')]();});}};}function handleEntityNotFound(_0xb9e57d,_0x3d836c){return function(_0x5755ea){if(!_0x5755ea){_0xb9e57d[_0xb814('0x1b')](0x194);}return _0x5755ea;};}function handleError(_0xc0ef66,_0x1c2625){_0x1c2625=_0x1c2625||0x1f4;return function(_0x349394){logger[_0xb814('0x2a')](_0x349394[_0xb814('0x2b')]);if(_0x349394[_0xb814('0x2c')]){delete _0x349394[_0xb814('0x2c')];}_0xc0ef66['status'](_0x1c2625)[_0xb814('0x2d')](_0x349394);};}exports[_0xb814('0x2e')]=function(_0x52ed64,_0x9008b2){var _0x37d24d={},_0x530744={},_0x499f22={'count':0x0,'rows':[]};var _0x20577b=_[_0xb814('0x2f')](db['CmHopperFinal'][_0xb814('0x30')],function(_0x526610){return{'name':_0x526610[_0xb814('0x31')],'type':_0x526610['type']['key']};});_0x530744[_0xb814('0x32')]=_['map'](_0x20577b,_0xb814('0x2c'));_0x530744[_0xb814('0x33')]=_[_0xb814('0x34')](_0x52ed64['query']);_0x530744['filters']=_[_0xb814('0x35')](_0x530744[_0xb814('0x32')],_0x530744['query']);_0x37d24d[_0xb814('0x36')]=_[_0xb814('0x35')](_0x530744[_0xb814('0x32')],qs[_0xb814('0x37')](_0x52ed64[_0xb814('0x33')][_0xb814('0x37')]));_0x37d24d[_0xb814('0x36')]=_0x37d24d['attributes'][_0xb814('0x38')]?_0x37d24d[_0xb814('0x36')]:_0x530744[_0xb814('0x32')];if(!_0x52ed64[_0xb814('0x33')][_0xb814('0x39')]('nolimit')){_0x37d24d[_0xb814('0x21')]=qs['limit'](_0x52ed64[_0xb814('0x33')][_0xb814('0x21')]);_0x37d24d[_0xb814('0x1f')]=qs['offset'](_0x52ed64[_0xb814('0x33')][_0xb814('0x1f')]);}_0x37d24d['order']=qs[_0xb814('0x3a')](_0x52ed64[_0xb814('0x33')][_0xb814('0x3a')]);_0x37d24d[_0xb814('0x3b')]=qs[_0xb814('0x3c')](_[_0xb814('0x3d')](_0x52ed64['query'],_0x530744[_0xb814('0x3c')]),_0x20577b);if(_0x52ed64['query'][_0xb814('0x3e')]){_0x37d24d['where']=_[_0xb814('0x3f')](_0x37d24d['where'],{'$or':_[_0xb814('0x2f')](_0x20577b,function(_0x26675a){if(_0x26675a['type']!=='VIRTUAL'){var _0x5dd6bc={};_0x5dd6bc[_0x26675a['name']]={'$like':'%'+_0x52ed64[_0xb814('0x33')][_0xb814('0x3e')]+'%'};return _0x5dd6bc;}})});}_0x37d24d=_[_0xb814('0x3f')]({},_0x37d24d,_0x52ed64[_0xb814('0x40')]);var _0x51cdba={'where':_0x37d24d['where']};return db[_0xb814('0x41')]['count'](_0x51cdba)[_0xb814('0x28')](function(_0x1098eb){_0x499f22[_0xb814('0x22')]=_0x1098eb;if(_0x52ed64[_0xb814('0x33')][_0xb814('0x42')]){_0x37d24d[_0xb814('0x43')]=[{'all':!![]}];}return db[_0xb814('0x41')][_0xb814('0x44')](_0x37d24d);})[_0xb814('0x28')](function(_0x4b6ff8){_0x499f22['rows']=_0x4b6ff8;return _0x499f22;})['then'](respondWithFilteredResult(_0x9008b2,_0x37d24d))[_0xb814('0x45')](handleError(_0x9008b2,null));};exports['show']=function(_0x29416a,_0x580171){var _0x411723={'raw':!![],'where':{'id':_0x29416a[_0xb814('0x46')]['id']}},_0x44ff56={};_0x44ff56[_0xb814('0x32')]=_['keys'](db[_0xb814('0x41')][_0xb814('0x30')]);_0x44ff56[_0xb814('0x33')]=_[_0xb814('0x34')](_0x29416a[_0xb814('0x33')]);_0x44ff56[_0xb814('0x3c')]=_['intersection'](_0x44ff56[_0xb814('0x32')],_0x44ff56[_0xb814('0x33')]);_0x411723[_0xb814('0x36')]=_[_0xb814('0x35')](_0x44ff56[_0xb814('0x32')],qs[_0xb814('0x37')](_0x29416a[_0xb814('0x33')]['fields']));_0x411723['attributes']=_0x411723[_0xb814('0x36')][_0xb814('0x38')]?_0x411723[_0xb814('0x36')]:_0x44ff56[_0xb814('0x32')];if(_0x29416a[_0xb814('0x33')][_0xb814('0x42')]){_0x411723[_0xb814('0x43')]=[{'all':!![]}];}_0x411723=_[_0xb814('0x3f')]({},_0x411723,_0x29416a[_0xb814('0x40')]);return db[_0xb814('0x41')][_0xb814('0x47')](_0x411723)['then'](handleEntityNotFound(_0x580171,null))[_0xb814('0x28')](respondWithResult(_0x580171,null))[_0xb814('0x45')](handleError(_0x580171,null));};exports['describe']=function(_0x338e80,_0x55234d){return db[_0xb814('0x41')][_0xb814('0x48')]()[_0xb814('0x28')](respondWithResult(_0x55234d,null))[_0xb814('0x45')](handleError(_0x55234d,null));};exports[_0xb814('0x27')]=function(_0x4096d4,_0x2cc806){if(_0x4096d4[_0xb814('0x49')][_0xb814('0x4a')]){delete _0x4096d4[_0xb814('0x49')]['uniqueid'];}return db['CmHopperFinal'][_0xb814('0x47')]({'where':{'uniqueid':_0x4096d4[_0xb814('0x46')]['id']}})[_0xb814('0x28')](handleEntityNotFound(_0x2cc806,null))[_0xb814('0x28')](saveUpdates(_0x4096d4[_0xb814('0x49')],null))[_0xb814('0x28')](respondWithResult(_0x2cc806,null))[_0xb814('0x45')](handleError(_0x2cc806,null));};exports['countContactsQueueCampaignHopperFinal']=function(_0x26fd0b,_0x388324,_0xf27a6e){return db['CmHopperFinal'][_0xb814('0x44')]({'raw':![],'where':{'VoiceQueueId':_0x26fd0b['params']['id']},'attributes':[[db[_0xb814('0x4b')]['fn']('COUNT',db[_0xb814('0x4b')]['fn']('IF',db[_0xb814('0x4b')]['literal'](_0xb814('0x4c')))),_0xb814('0x4d')],[db[_0xb814('0x4b')]['fn']('COUNT',db[_0xb814('0x4b')]['fn']('IF',db['sequelize'][_0xb814('0x4e')](_0xb814('0x4f')))),'noAnswerContacts'],[db[_0xb814('0x4b')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0xb814('0x4b')][_0xb814('0x4e')](_0xb814('0x50')))),'busyContacts'],[db[_0xb814('0x4b')]['fn']('COUNT',db[_0xb814('0x4b')]['fn']('IF',db[_0xb814('0x4b')]['literal'](_0xb814('0x51')))),'congestionContacts'],[db[_0xb814('0x4b')]['fn'](_0xb814('0x52'),db[_0xb814('0x4b')]['fn']('IF',db[_0xb814('0x4b')][_0xb814('0x4e')](_0xb814('0x53')))),_0xb814('0x54')],[db[_0xb814('0x4b')]['fn']('COUNT',db[_0xb814('0x4b')]['fn']('IF',db[_0xb814('0x4b')]['literal'](_0xb814('0x55')))),_0xb814('0x56')],[db['sequelize']['fn'](_0xb814('0x52'),db['sequelize']['fn']('IF',db['sequelize'][_0xb814('0x4e')]('`state`\x20=\x2022,\x201,\x20null'))),_0xb814('0x57')],[db[_0xb814('0x4b')]['fn'](_0xb814('0x52'),db['sequelize']['fn']('IF',db[_0xb814('0x4b')]['literal'](_0xb814('0x58')))),_0xb814('0x59')]]})[_0xb814('0x28')](handleEntityNotFound(_0x388324,null))[_0xb814('0x28')](respondWithResult(_0x388324,null))[_0xb814('0x45')](handleError(_0x388324,null));};exports[_0xb814('0x5a')]=function(_0x2e5f99,_0x113350,_0x46014f){return db['CmHopperFinal'][_0xb814('0x44')]({'raw':![],'where':{'CampaignId':_0x2e5f99[_0xb814('0x46')]['id']},'attributes':[[db[_0xb814('0x4b')]['fn'](_0xb814('0x52'),db[_0xb814('0x4b')]['fn']('IF',db[_0xb814('0x4b')]['literal'](_0xb814('0x4c')))),'noSuchContacts'],[db[_0xb814('0x4b')]['fn'](_0xb814('0x52'),db[_0xb814('0x4b')]['fn']('IF',db['sequelize'][_0xb814('0x4e')]('`state`\x20=\x203,\x201,\x20null'))),_0xb814('0x5b')],[db['sequelize']['fn'](_0xb814('0x52'),db[_0xb814('0x4b')]['fn']('IF',db[_0xb814('0x4b')][_0xb814('0x4e')](_0xb814('0x50')))),_0xb814('0x5c')],[db[_0xb814('0x4b')]['fn']('COUNT',db[_0xb814('0x4b')]['fn']('IF',db['sequelize'][_0xb814('0x4e')](_0xb814('0x51')))),_0xb814('0x5d')],[db[_0xb814('0x4b')]['fn'](_0xb814('0x52'),db[_0xb814('0x4b')]['fn']('IF',db['sequelize'][_0xb814('0x4e')](_0xb814('0x53')))),'dropContacts'],[db[_0xb814('0x4b')]['fn'](_0xb814('0x52'),db[_0xb814('0x4b')]['fn']('IF',db[_0xb814('0x4b')][_0xb814('0x4e')]('`state`\x20=\x2011\x20,\x201,\x20null'))),_0xb814('0x56')],[db['sequelize']['fn'](_0xb814('0x52'),db[_0xb814('0x4b')]['fn']('IF',db[_0xb814('0x4b')][_0xb814('0x4e')](_0xb814('0x5e')))),_0xb814('0x57')],[db['sequelize']['fn']('COUNT',db['sequelize']['fn']('IF',db[_0xb814('0x4b')]['literal'](_0xb814('0x58')))),_0xb814('0x59')]]})[_0xb814('0x28')](handleEntityNotFound(_0x113350,null))['then'](respondWithResult(_0x113350,null))[_0xb814('0x45')](handleError(_0x113350,null));};exports[_0xb814('0x5f')]=function(_0xee204,_0x5aabbe,_0x30f717){return db[_0xb814('0x60')][_0xb814('0x47')]({'where':{'id':_0xee204[_0xb814('0x46')]['id']}})['then'](handleEntityNotFound(_0x5aabbe,null))['then'](function(_0x28eaf8){var _0x295488;if(_0x28eaf8){_0x295488=squel[_0xb814('0x61')]()[_0xb814('0x62')](_0xb814('0x63'))[_0xb814('0x64')]([_0xb814('0x65'),_0xb814('0x66'),_0xb814('0x67'),_0xb814('0x68'),_0xb814('0x69'),_0xb814('0x6a'),_0xb814('0x6b')],squel[_0xb814('0x6c')]()[_0xb814('0x6d')]('ANY_VALUE(calleridnum)',_0xb814('0x65'))[_0xb814('0x6d')](_0xb814('0x6e'),_0xb814('0x66'))[_0xb814('0x6d')](_0xb814('0x6f'),'ContactId')[_0xb814('0x6d')]('ANY_VALUE(ListId)',_0xb814('0x68'))[_0xb814('0x6d')](_0xb814('0x70'),_0xb814('0x69'))[_0xb814('0x6d')]('NOW()','createdAt')[_0xb814('0x6d')](_0xb814('0x6e'),_0xb814('0x6b'))[_0xb814('0x71')]('cm_hopper_final')[_0xb814('0x3b')]('VoiceQueueId\x20=\x20?',_0xee204[_0xb814('0x46')]['id'][_0xb814('0x72')]())['where']('state\x20=\x20?',_0xee204[_0xb814('0x49')]['state'][_0xb814('0x72')]())[_0xb814('0x3b')](_0xb814('0x73'))[_0xb814('0x3b')](_0xb814('0x74'),squel[_0xb814('0x6c')]()[_0xb814('0x6d')]('phone')[_0xb814('0x71')]('cm_hopper')[_0xb814('0x3b')]('VoiceQueueId\x20=\x20?',_0xee204[_0xb814('0x46')]['id'][_0xb814('0x72')]()))['where'](_0xb814('0x74'),squel['select']()[_0xb814('0x6d')](_0xb814('0x75'))['from']('cm_hopper_final')[_0xb814('0x3b')](_0xb814('0x76'),_0xee204[_0xb814('0x46')]['id'][_0xb814('0x72')]())[_0xb814('0x3b')](_0xb814('0x77')))[_0xb814('0x78')](_0xb814('0x67')))[_0xb814('0x72')]();return db[_0xb814('0x4b')]['query'](_0x295488);}return[];})['then'](respondWithResult(_0x5aabbe,null))['catch'](handleError(_0x5aabbe,null));};exports['moveContactsIvrCampaignHopperFinal']=function(_0x52b6da,_0x45a202,_0x75a33){return db[_0xb814('0x79')]['find']({'where':{'id':_0x52b6da[_0xb814('0x46')]['id']}})[_0xb814('0x28')](handleEntityNotFound(_0x45a202,null))[_0xb814('0x28')](function(_0x26ce5b){var _0x161658;if(_0x26ce5b){_0x161658=squel[_0xb814('0x61')]()[_0xb814('0x62')](_0xb814('0x63'))['fromQuery']([_0xb814('0x65'),_0xb814('0x66'),_0xb814('0x67'),_0xb814('0x68'),'CampaignId',_0xb814('0x6a'),_0xb814('0x6b')],squel[_0xb814('0x6c')]()[_0xb814('0x6d')](_0xb814('0x7a'),'phone')['field'](_0xb814('0x6e'),'scheduledAt')[_0xb814('0x6d')](_0xb814('0x6f'),'ContactId')[_0xb814('0x6d')]('ANY_VALUE(ListId)',_0xb814('0x68'))['field'](_0xb814('0x7b'),_0xb814('0x7c'))[_0xb814('0x6d')](_0xb814('0x6e'),_0xb814('0x6a'))[_0xb814('0x6d')](_0xb814('0x6e'),'updatedAt')['from'](_0xb814('0x7d'))['where']('CampaignId\x20=\x20?',_0x52b6da[_0xb814('0x46')]['id'][_0xb814('0x72')]())[_0xb814('0x3b')]('state\x20=\x20?',_0x52b6da[_0xb814('0x49')]['state'][_0xb814('0x72')]())[_0xb814('0x3b')](_0xb814('0x73'))[_0xb814('0x3b')]('calleridnum\x20NOT\x20IN\x20(?)',squel[_0xb814('0x6c')]()[_0xb814('0x6d')](_0xb814('0x65'))['from'](_0xb814('0x63'))[_0xb814('0x3b')](_0xb814('0x7e'),_0x52b6da['params']['id'][_0xb814('0x72')]()))[_0xb814('0x3b')](_0xb814('0x74'),squel[_0xb814('0x6c')]()[_0xb814('0x6d')](_0xb814('0x75'))[_0xb814('0x71')](_0xb814('0x7d'))[_0xb814('0x3b')](_0xb814('0x7e'),_0x52b6da[_0xb814('0x46')]['id'][_0xb814('0x72')]())[_0xb814('0x3b')]('state\x20=\x204'))['group'](_0xb814('0x67')))['toString']();return db[_0xb814('0x4b')][_0xb814('0x33')](_0x161658);}return[];})[_0xb814('0x28')](respondWithResult(_0x45a202,null))[_0xb814('0x45')](handleError(_0x45a202,null));};exports[_0xb814('0x7f')]=function(_0x2f1674,_0xf0610f,_0x5db5d0){return db['CmHopper'][_0xb814('0x80')]({'where':{'VoiceQueueId':_0x2f1674['body'][_0xb814('0x69')],'CampaignId':_0x2f1674[_0xb814('0x49')][_0xb814('0x7c')],'ContactId':_0x2f1674['body'][_0xb814('0x67')]}})[_0xb814('0x28')](handleEntityNotFound(_0xf0610f,null))[_0xb814('0x28')](function(_0x38c6da){if(_0x38c6da){return _0x38c6da;}return null;})[_0xb814('0x28')](respondWithResult(_0xf0610f,null))['catch'](handleError(_0xf0610f,null));}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.model.js b/server/api/cmHopperFinal/cmHopperFinal.model.js index 27e321a..8e02404 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 _0xe1bf=['path','rimraf','../../config/environment','./cmHopperFinal.attributes','exports','define','cm_hopper_final','calleridnum','uniqueid','lodash','util','api','moment','bluebird','request-promise'];(function(_0x1b5e83,_0x4c485d){var _0x2104c9=function(_0x3d60b9){while(--_0x3d60b9){_0x1b5e83['push'](_0x1b5e83['shift']());}};_0x2104c9(++_0x4c485d);}(_0xe1bf,0xcc));var _0xfe1b=function(_0x1d6470,_0x224b8b){_0x1d6470=_0x1d6470-0x0;var _0x49d303=_0xe1bf[_0x1d6470];return _0x49d303;};'use strict';var _=require(_0xfe1b('0x0'));var util=require(_0xfe1b('0x1'));var logger=require('../../config/logger')(_0xfe1b('0x2'));var moment=require(_0xfe1b('0x3'));var BPromise=require(_0xfe1b('0x4'));var rp=require(_0xfe1b('0x5'));var fs=require('fs');var path=require(_0xfe1b('0x6'));var rimraf=require(_0xfe1b('0x7'));var config=require(_0xfe1b('0x8'));var attributes=require(_0xfe1b('0x9'));module[_0xfe1b('0xa')]=function(_0x5c67a3,_0x31293e){return _0x5c67a3[_0xfe1b('0xb')]('CmHopperFinal',attributes,{'tableName':_0xfe1b('0xc'),'paranoid':![],'indexes':[{'name':'calleridnum','fields':[_0xfe1b('0xd')]},{'name':_0xfe1b('0xe'),'fields':[_0xfe1b('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x7b33=['api','moment','request-promise','path','rimraf','../../config/environment','./cmHopperFinal.attributes','CmHopperFinal','calleridnum','uniqueid','lodash','util'];(function(_0x5dc277,_0x28347e){var _0x3fbf3f=function(_0x47027f){while(--_0x47027f){_0x5dc277['push'](_0x5dc277['shift']());}};_0x3fbf3f(++_0x28347e);}(_0x7b33,0x8e));var _0x37b3=function(_0x751b24,_0x44ab4c){_0x751b24=_0x751b24-0x0;var _0x208d2b=_0x7b33[_0x751b24];return _0x208d2b;};'use strict';var _=require(_0x37b3('0x0'));var util=require(_0x37b3('0x1'));var logger=require('../../config/logger')(_0x37b3('0x2'));var moment=require(_0x37b3('0x3'));var BPromise=require('bluebird');var rp=require(_0x37b3('0x4'));var fs=require('fs');var path=require(_0x37b3('0x5'));var rimraf=require(_0x37b3('0x6'));var config=require(_0x37b3('0x7'));var attributes=require(_0x37b3('0x8'));module['exports']=function(_0x2b2f58,_0x2a2d1f){return _0x2b2f58['define'](_0x37b3('0x9'),attributes,{'tableName':'cm_hopper_final','paranoid':![],'indexes':[{'name':_0x37b3('0xa'),'fields':['calleridnum']},{'name':_0x37b3('0xb'),'fields':[_0x37b3('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.rpc.js b/server/api/cmHopperFinal/cmHopperFinal.rpc.js index 1f5b9bd..a89c2f0 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(_0x3f0693,_0x5aac7f){var _0x533f84=function(_0x3f310c){while(--_0x3f310c){_0x3f0693['push'](_0x3f0693['shift']());}};_0x533f84(++_0x5aac7f);}(_0xb10b,0x12a));var _0xbb10=function(_0x3240ff,_0x3b9c3d){_0x3240ff=_0x3240ff-0x0;var _0x514858=_0xb10b[_0x3240ff];return _0x514858;};'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(_0x196d3b,_0x2b500e){var _0x3f06b2=function(_0x3423c3){while(--_0x3423c3){_0x196d3b['push'](_0x196d3b['shift']());}};_0x3f06b2(++_0x2b500e);}(_0xb10b,0x12a));var _0xbb10=function(_0x54cd98,_0x3029e6){_0x54cd98=_0x54cd98-0x0;var _0x4abd09=_0xb10b[_0x54cd98];return _0x4abd09;};'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 1d26c04..9960bed 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 _0x6e4d=['multer','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','get','index','/describe','isAuthenticated','describe','/:id','show','/voice/queue/countAttributes/:id','countContactsQueueCampaignHopperFinal','/campaign/countAttributes/:id','countContactsIvrCampaignHopperFinal','post','/voice/queue/moveContacts/:id','moveContactsQueueCampaignHopperFinal','/voice/campaign/moveContacts/:id','moveContactsIvrCampaignHopperFinal','/checkContactHopper','put','update','exports'];(function(_0x46d0a8,_0x59080b){var _0x480cf5=function(_0x4efd9b){while(--_0x4efd9b){_0x46d0a8['push'](_0x46d0a8['shift']());}};_0x480cf5(++_0x59080b);}(_0x6e4d,0x1cb));var _0xd6e4=function(_0x3517f1,_0x41b82b){_0x3517f1=_0x3517f1-0x0;var _0x1a1f8d=_0x6e4d[_0x3517f1];return _0x1a1f8d;};'use strict';var multer=require(_0xd6e4('0x0'));var util=require(_0xd6e4('0x1'));var path=require('path');var timeout=require(_0xd6e4('0x2'));var express=require(_0xd6e4('0x3'));var router=express['Router']();var fs_extra=require(_0xd6e4('0x4'));var auth=require(_0xd6e4('0x5'));var interaction=require(_0xd6e4('0x6'));var config=require('../../config/environment');var controller=require('./cmHopperFinal.controller');router[_0xd6e4('0x7')]('/',auth['isAuthenticated'](),controller[_0xd6e4('0x8')]);router[_0xd6e4('0x7')](_0xd6e4('0x9'),auth[_0xd6e4('0xa')](),controller[_0xd6e4('0xb')]);router[_0xd6e4('0x7')](_0xd6e4('0xc'),auth[_0xd6e4('0xa')](),controller[_0xd6e4('0xd')]);router[_0xd6e4('0x7')](_0xd6e4('0xe'),auth[_0xd6e4('0xa')](),controller[_0xd6e4('0xf')]);router['get'](_0xd6e4('0x10'),auth[_0xd6e4('0xa')](),controller[_0xd6e4('0x11')]);router[_0xd6e4('0x12')](_0xd6e4('0x13'),auth[_0xd6e4('0xa')](),controller[_0xd6e4('0x14')]);router['post'](_0xd6e4('0x15'),auth[_0xd6e4('0xa')](),controller[_0xd6e4('0x16')]);router[_0xd6e4('0x12')](_0xd6e4('0x17'),auth[_0xd6e4('0xa')](),controller['checkContactHopper']);router[_0xd6e4('0x18')](_0xd6e4('0xc'),auth[_0xd6e4('0xa')](),controller[_0xd6e4('0x19')]);module[_0xd6e4('0x1a')]=router; \ No newline at end of file +var _0xf347=['path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','/describe','describe','/:id','show','/voice/queue/countAttributes/:id','countContactsIvrCampaignHopperFinal','post','/voice/queue/moveContacts/:id','moveContactsQueueCampaignHopperFinal','/voice/campaign/moveContacts/:id','moveContactsIvrCampaignHopperFinal','/checkContactHopper','checkContactHopper','put','update','multer'];(function(_0x58c20f,_0x4cdb1b){var _0x3b0318=function(_0x36fa84){while(--_0x36fa84){_0x58c20f['push'](_0x58c20f['shift']());}};_0x3b0318(++_0x4cdb1b);}(_0xf347,0xef));var _0x7f34=function(_0x455826,_0x457e50){_0x455826=_0x455826-0x0;var _0x630016=_0xf347[_0x455826];return _0x630016;};'use strict';var multer=require(_0x7f34('0x0'));var util=require('util');var path=require(_0x7f34('0x1'));var timeout=require(_0x7f34('0x2'));var express=require('express');var router=express[_0x7f34('0x3')]();var fs_extra=require(_0x7f34('0x4'));var auth=require(_0x7f34('0x5'));var interaction=require(_0x7f34('0x6'));var config=require('../../config/environment');var controller=require('./cmHopperFinal.controller');router[_0x7f34('0x7')]('/',auth[_0x7f34('0x8')](),controller['index']);router[_0x7f34('0x7')](_0x7f34('0x9'),auth[_0x7f34('0x8')](),controller[_0x7f34('0xa')]);router[_0x7f34('0x7')](_0x7f34('0xb'),auth['isAuthenticated'](),controller[_0x7f34('0xc')]);router[_0x7f34('0x7')](_0x7f34('0xd'),auth['isAuthenticated'](),controller['countContactsQueueCampaignHopperFinal']);router[_0x7f34('0x7')]('/campaign/countAttributes/:id',auth[_0x7f34('0x8')](),controller[_0x7f34('0xe')]);router[_0x7f34('0xf')](_0x7f34('0x10'),auth['isAuthenticated'](),controller[_0x7f34('0x11')]);router[_0x7f34('0xf')](_0x7f34('0x12'),auth[_0x7f34('0x8')](),controller[_0x7f34('0x13')]);router[_0x7f34('0xf')](_0x7f34('0x14'),auth[_0x7f34('0x8')](),controller[_0x7f34('0x15')]);router[_0x7f34('0x16')]('/:id',auth[_0x7f34('0x8')](),controller[_0x7f34('0x17')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.attributes.js b/server/api/cmHopperHistory/cmHopperHistory.attributes.js index b5ea1bf..7c37399 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 _0x72f6=['exports','INTEGER','DATE','STRING','BOOLEAN','sequelize'];(function(_0x3b69f9,_0x1e2820){var _0x409f99=function(_0x128d8f){while(--_0x128d8f){_0x3b69f9['push'](_0x3b69f9['shift']());}};_0x409f99(++_0x1e2820);}(_0x72f6,0x1a9));var _0x672f=function(_0x228bee,_0x5b2530){_0x228bee=_0x228bee-0x0;var _0x342513=_0x72f6[_0x228bee];return _0x342513;};'use strict';var Sequelize=require(_0x672f('0x0'));module[_0x672f('0x1')]={'state':{'type':Sequelize[_0x672f('0x2')](0x2)},'statedesc':{'type':Sequelize['STRING']},'scheduledat':{'type':Sequelize[_0x672f('0x3')]},'countbusyretry':{'type':Sequelize[_0x672f('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x672f('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x672f('0x2')],'defaultValue':0x0},'countglobal':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x672f('0x4')]},'originatecalleridnum':{'type':Sequelize[_0x672f('0x4')]},'originatecalleridname':{'type':Sequelize[_0x672f('0x4')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x672f('0x4')]},'starttime':{'type':Sequelize[_0x672f('0x3')]},'responsetime':{'type':Sequelize[_0x672f('0x3')]},'answertime':{'type':Sequelize[_0x672f('0x3')]},'droptime':{'type':Sequelize[_0x672f('0x3')]},'endtime':{'type':Sequelize['DATE']},'ringtime':{'type':Sequelize[_0x672f('0x2')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x672f('0x2')],'defaultValue':0x0},'talktime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'followuptime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x672f('0x4')]},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize[_0x672f('0x4')]},'membername':{'type':Sequelize['STRING']},'reason':{'type':Sequelize['STRING']},'amd':{'type':Sequelize[_0x672f('0x5')],'defaultValue':![]},'fax':{'type':Sequelize[_0x672f('0x5')],'defaultValue':![]},'callback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x672f('0x4')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x672f('0x3')]},'recallme':{'type':Sequelize[_0x672f('0x5')],'defaultValue':![]},'editedat':{'type':Sequelize['DATE']},'edited':{'type':Sequelize[_0x672f('0x5')],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x672f('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x672f('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0x672f('0x4')]}}; \ No newline at end of file +var _0x9684=['exports','INTEGER','STRING','DATE','BOOLEAN','sequelize'];(function(_0x2b97d4,_0x3aeeb1){var _0x5c98bf=function(_0x86b48e){while(--_0x86b48e){_0x2b97d4['push'](_0x2b97d4['shift']());}};_0x5c98bf(++_0x3aeeb1);}(_0x9684,0x1bb));var _0x4968=function(_0x535c2a,_0x4d14a2){_0x535c2a=_0x535c2a-0x0;var _0x1e7836=_0x9684[_0x535c2a];return _0x1e7836;};'use strict';var Sequelize=require(_0x4968('0x0'));module[_0x4968('0x1')]={'state':{'type':Sequelize[_0x4968('0x2')](0x2)},'statedesc':{'type':Sequelize[_0x4968('0x3')]},'scheduledat':{'type':Sequelize[_0x4968('0x4')]},'countbusyretry':{'type':Sequelize[_0x4968('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x4968('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x4968('0x2')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x4968('0x2')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x4968('0x3')]},'originatecalleridnum':{'type':Sequelize['STRING']},'originatecalleridname':{'type':Sequelize[_0x4968('0x3')]},'calleridnum':{'type':Sequelize[_0x4968('0x3')]},'calleridname':{'type':Sequelize[_0x4968('0x3')]},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize[_0x4968('0x4')]},'answertime':{'type':Sequelize[_0x4968('0x4')]},'droptime':{'type':Sequelize[_0x4968('0x4')]},'endtime':{'type':Sequelize['DATE']},'ringtime':{'type':Sequelize[_0x4968('0x2')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x4968('0x2')],'defaultValue':0x0},'talktime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x4968('0x2')],'defaultValue':0x0},'dropreason':{'type':Sequelize['STRING']},'campaign':{'type':Sequelize[_0x4968('0x3')]},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize['STRING']},'reason':{'type':Sequelize['STRING']},'amd':{'type':Sequelize[_0x4968('0x5')],'defaultValue':![]},'fax':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x4968('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x4968('0x4')]},'recallme':{'type':Sequelize[_0x4968('0x5')],'defaultValue':![]},'editedat':{'type':Sequelize['DATE']},'edited':{'type':Sequelize[_0x4968('0x5')],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0x4968('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x4968('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x4968('0x2')],'defaultValue':0x0},'dialTimezone':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.controller.js b/server/api/cmHopperHistory/cmHopperHistory.controller.js index dfcd6fa..80e53af 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 _0x52f4=['keys','find','create','body','describe','uniqueid','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','CmHopperHistory','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','pick','filter','where','VIRTUAL','merge','options','count','includeAll','include','findAll','catch','show','params'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x52f4,0x1ce));var _0x452f=function(_0x58b2b7,_0x2c46e5){_0x58b2b7=_0x58b2b7-0x0;var _0x302ec6=_0x52f4[_0x58b2b7];return _0x302ec6;};'use strict';var emlformat=require(_0x452f('0x0'));var rimraf=require(_0x452f('0x1'));var zipdir=require(_0x452f('0x2'));var jsonpatch=require(_0x452f('0x3'));var rp=require(_0x452f('0x4'));var moment=require(_0x452f('0x5'));var BPromise=require(_0x452f('0x6'));var Mustache=require('mustache');var util=require(_0x452f('0x7'));var path=require(_0x452f('0x8'));var sox=require(_0x452f('0x9'));var csv=require(_0x452f('0xa'));var ejs=require(_0x452f('0xb'));var fs=require('fs');var fs_extra=require(_0x452f('0xc'));var _=require(_0x452f('0xd'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x452f('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x452f('0xf'));var Redis=require(_0x452f('0x10'));var authService=require(_0x452f('0x11'));var qs=require(_0x452f('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x452f('0x13'))('api');var utils=require(_0x452f('0x14'));var config=require(_0x452f('0x15'));var licenseUtil=require(_0x452f('0x16'));var db=require(_0x452f('0x17'))['db'];function respondWithStatusCode(_0x15c7bc,_0x8c1120){_0x8c1120=_0x8c1120||0xcc;return function(_0x75f040){if(_0x75f040){return _0x15c7bc[_0x452f('0x18')](_0x8c1120);}return _0x15c7bc[_0x452f('0x19')](_0x8c1120)[_0x452f('0x1a')]();};}function respondWithResult(_0x121123,_0x25a75b){_0x25a75b=_0x25a75b||0xc8;return function(_0x3d2078){if(_0x3d2078){return _0x121123[_0x452f('0x19')](_0x25a75b)[_0x452f('0x1b')](_0x3d2078);}};}function respondWithFilteredResult(_0x391318,_0x4c8214){return function(_0x1f89d6){if(_0x1f89d6){var _0x121c66=typeof _0x4c8214[_0x452f('0x1c')]==='undefined'&&typeof _0x4c8214[_0x452f('0x1d')]==='undefined';var _0x2d5ac2=_0x1f89d6['count'];var _0x8c0c6=_0x121c66?0x0:_0x4c8214[_0x452f('0x1c')];var _0x36a3ba=_0x121c66?_0x1f89d6['count']:_0x4c8214[_0x452f('0x1c')]+_0x4c8214[_0x452f('0x1d')];var _0x48effd;if(_0x36a3ba>=_0x2d5ac2){_0x36a3ba=_0x2d5ac2;_0x48effd=0xc8;}else{_0x48effd=0xce;}_0x391318[_0x452f('0x19')](_0x48effd);return _0x391318['set'](_0x452f('0x1e'),_0x8c0c6+'-'+_0x36a3ba+'/'+_0x2d5ac2)['json'](_0x1f89d6);}return null;};}function patchUpdates(_0x5068e5){return function(_0x3a10d0){try{jsonpatch[_0x452f('0x1f')](_0x3a10d0,_0x5068e5,!![]);}catch(_0xe36778){return BPromise[_0x452f('0x20')](_0xe36778);}return _0x3a10d0[_0x452f('0x21')]();};}function saveUpdates(_0x23652c,_0x1cc8e6){return function(_0x4e9513){if(_0x4e9513){return _0x4e9513[_0x452f('0x22')](_0x23652c)[_0x452f('0x23')](function(_0x5c6598){return _0x5c6598;});}return null;};}function removeEntity(_0x20ebd1,_0x4f2c49){return function(_0x4b7a7c){if(_0x4b7a7c){return _0x4b7a7c[_0x452f('0x24')]()[_0x452f('0x23')](function(){_0x20ebd1[_0x452f('0x19')](0xcc)[_0x452f('0x1a')]();});}};}function handleEntityNotFound(_0x92bff7,_0x1ad542){return function(_0x42aa53){if(!_0x42aa53){_0x92bff7[_0x452f('0x18')](0x194);}return _0x42aa53;};}function handleError(_0x33503b,_0x266abe){_0x266abe=_0x266abe||0x1f4;return function(_0x45174a){logger[_0x452f('0x25')](_0x45174a[_0x452f('0x26')]);if(_0x45174a[_0x452f('0x27')]){delete _0x45174a[_0x452f('0x27')];}_0x33503b[_0x452f('0x19')](_0x266abe)[_0x452f('0x28')](_0x45174a);};}exports['index']=function(_0x47a4e4,_0x568b22){var _0x449b46={},_0xf90db2={},_0x13d218={'count':0x0,'rows':[]};var _0x18dfc6=_['map'](db[_0x452f('0x29')][_0x452f('0x2a')],function(_0x25b234){return{'name':_0x25b234[_0x452f('0x2b')],'type':_0x25b234[_0x452f('0x2c')][_0x452f('0x2d')]};});_0xf90db2[_0x452f('0x2e')]=_[_0x452f('0x2f')](_0x18dfc6,_0x452f('0x27'));_0xf90db2[_0x452f('0x30')]=_['keys'](_0x47a4e4[_0x452f('0x30')]);_0xf90db2[_0x452f('0x31')]=_[_0x452f('0x32')](_0xf90db2[_0x452f('0x2e')],_0xf90db2[_0x452f('0x30')]);_0x449b46['attributes']=_[_0x452f('0x32')](_0xf90db2[_0x452f('0x2e')],qs[_0x452f('0x33')](_0x47a4e4[_0x452f('0x30')]['fields']));_0x449b46[_0x452f('0x34')]=_0x449b46['attributes'][_0x452f('0x35')]?_0x449b46[_0x452f('0x34')]:_0xf90db2['model'];if(!_0x47a4e4[_0x452f('0x30')][_0x452f('0x36')](_0x452f('0x37'))){_0x449b46[_0x452f('0x1d')]=qs[_0x452f('0x1d')](_0x47a4e4[_0x452f('0x30')][_0x452f('0x1d')]);_0x449b46[_0x452f('0x1c')]=qs[_0x452f('0x1c')](_0x47a4e4['query'][_0x452f('0x1c')]);}_0x449b46[_0x452f('0x38')]=qs['sort'](_0x47a4e4[_0x452f('0x30')]['sort']);_0x449b46['where']=qs['filters'](_[_0x452f('0x39')](_0x47a4e4[_0x452f('0x30')],_0xf90db2[_0x452f('0x31')]),_0x18dfc6);if(_0x47a4e4[_0x452f('0x30')][_0x452f('0x3a')]){_0x449b46[_0x452f('0x3b')]=_['merge'](_0x449b46[_0x452f('0x3b')],{'$or':_[_0x452f('0x2f')](_0x18dfc6,function(_0x10bb98){if(_0x10bb98[_0x452f('0x2c')]!==_0x452f('0x3c')){var _0x5b10a4={};_0x5b10a4[_0x10bb98[_0x452f('0x27')]]={'$like':'%'+_0x47a4e4['query'][_0x452f('0x3a')]+'%'};return _0x5b10a4;}})});}_0x449b46=_[_0x452f('0x3d')]({},_0x449b46,_0x47a4e4[_0x452f('0x3e')]);var _0x50fb1a={'where':_0x449b46['where']};return db[_0x452f('0x29')][_0x452f('0x3f')](_0x50fb1a)[_0x452f('0x23')](function(_0x206a4e){_0x13d218[_0x452f('0x3f')]=_0x206a4e;if(_0x47a4e4[_0x452f('0x30')][_0x452f('0x40')]){_0x449b46[_0x452f('0x41')]=[{'all':!![]}];}return db[_0x452f('0x29')][_0x452f('0x42')](_0x449b46);})[_0x452f('0x23')](function(_0x591266){_0x13d218['rows']=_0x591266;return _0x13d218;})[_0x452f('0x23')](respondWithFilteredResult(_0x568b22,_0x449b46))[_0x452f('0x43')](handleError(_0x568b22,null));};exports[_0x452f('0x44')]=function(_0x1234e8,_0x56384a){var _0x3c58e3={'raw':!![],'where':{'id':_0x1234e8[_0x452f('0x45')]['id']}},_0x2e082f={};_0x2e082f['model']=_[_0x452f('0x46')](db[_0x452f('0x29')][_0x452f('0x2a')]);_0x2e082f['query']=_[_0x452f('0x46')](_0x1234e8[_0x452f('0x30')]);_0x2e082f[_0x452f('0x31')]=_['intersection'](_0x2e082f[_0x452f('0x2e')],_0x2e082f[_0x452f('0x30')]);_0x3c58e3[_0x452f('0x34')]=_['intersection'](_0x2e082f['model'],qs[_0x452f('0x33')](_0x1234e8[_0x452f('0x30')][_0x452f('0x33')]));_0x3c58e3[_0x452f('0x34')]=_0x3c58e3[_0x452f('0x34')][_0x452f('0x35')]?_0x3c58e3[_0x452f('0x34')]:_0x2e082f[_0x452f('0x2e')];if(_0x1234e8[_0x452f('0x30')][_0x452f('0x40')]){_0x3c58e3[_0x452f('0x41')]=[{'all':!![]}];}_0x3c58e3=_[_0x452f('0x3d')]({},_0x3c58e3,_0x1234e8[_0x452f('0x3e')]);return db[_0x452f('0x29')][_0x452f('0x47')](_0x3c58e3)[_0x452f('0x23')](handleEntityNotFound(_0x56384a,null))['then'](respondWithResult(_0x56384a,null))[_0x452f('0x43')](handleError(_0x56384a,null));};exports[_0x452f('0x48')]=function(_0x41234e,_0xd93d30){return db['CmHopperHistory']['create'](_0x41234e[_0x452f('0x49')],{})[_0x452f('0x23')](respondWithResult(_0xd93d30,0xc9))['catch'](handleError(_0xd93d30,null));};exports[_0x452f('0x4a')]=function(_0xe5afaa,_0xab1ed9){return db[_0x452f('0x29')]['describe']()['then'](respondWithResult(_0xab1ed9,null))[_0x452f('0x43')](handleError(_0xab1ed9,null));};exports[_0x452f('0x22')]=function(_0x17e9a5,_0x21a2e9){if(_0x17e9a5[_0x452f('0x49')][_0x452f('0x4b')]){delete _0x17e9a5[_0x452f('0x49')][_0x452f('0x4b')];}return db[_0x452f('0x29')][_0x452f('0x47')]({'where':{'uniqueid':_0x17e9a5[_0x452f('0x45')]['id']}})[_0x452f('0x23')](handleEntityNotFound(_0x21a2e9,null))[_0x452f('0x23')](saveUpdates(_0x17e9a5['body'],null))['then'](respondWithResult(_0x21a2e9,null))[_0x452f('0x43')](handleError(_0x21a2e9,null));}; \ No newline at end of file +var _0x0805=['describe','uniqueid','eml-format','rimraf','zip-dir','moment','bluebird','util','path','ejs','fs-extra','lodash','squel','crypto','jsforce','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/environment','../../config/license/util','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','keys','query','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','merge','VIRTUAL','options','CmHopperHistory','includeAll','include','rows','catch','params','find','create','body'];(function(_0x265ab5,_0x494f68){var _0x4936de=function(_0x3b95ac){while(--_0x3b95ac){_0x265ab5['push'](_0x265ab5['shift']());}};_0x4936de(++_0x494f68);}(_0x0805,0x98));var _0x5080=function(_0x4cecc4,_0x4a0424){_0x4cecc4=_0x4cecc4-0x0;var _0xff2392=_0x0805[_0x4cecc4];return _0xff2392;};'use strict';var emlformat=require(_0x5080('0x0'));var rimraf=require(_0x5080('0x1'));var zipdir=require(_0x5080('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x5080('0x3'));var BPromise=require(_0x5080('0x4'));var Mustache=require('mustache');var util=require(_0x5080('0x5'));var path=require(_0x5080('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x5080('0x7'));var fs=require('fs');var fs_extra=require(_0x5080('0x8'));var _=require(_0x5080('0x9'));var squel=require(_0x5080('0xa'));var crypto=require(_0x5080('0xb'));var jsforce=require(_0x5080('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x5080('0xd'));var querystring=require('querystring');var Papa=require(_0x5080('0xe'));var Redis=require(_0x5080('0xf'));var authService=require(_0x5080('0x10'));var qs=require(_0x5080('0x11'));var as=require(_0x5080('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x5080('0x13'));var licenseUtil=require(_0x5080('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x815121,_0x4f2d49){_0x4f2d49=_0x4f2d49||0xcc;return function(_0x16aac2){if(_0x16aac2){return _0x815121[_0x5080('0x15')](_0x4f2d49);}return _0x815121['status'](_0x4f2d49)[_0x5080('0x16')]();};}function respondWithResult(_0x2ea65a,_0x226ec5){_0x226ec5=_0x226ec5||0xc8;return function(_0x6c5073){if(_0x6c5073){return _0x2ea65a[_0x5080('0x17')](_0x226ec5)[_0x5080('0x18')](_0x6c5073);}};}function respondWithFilteredResult(_0xfc7630,_0x35b3bd){return function(_0x474bdb){if(_0x474bdb){var _0x5cddcc=typeof _0x35b3bd[_0x5080('0x19')]===_0x5080('0x1a')&&typeof _0x35b3bd[_0x5080('0x1b')]===_0x5080('0x1a');var _0x5d7a1b=_0x474bdb['count'];var _0x38ffdf=_0x5cddcc?0x0:_0x35b3bd[_0x5080('0x19')];var _0x4b8fc3=_0x5cddcc?_0x474bdb[_0x5080('0x1c')]:_0x35b3bd[_0x5080('0x19')]+_0x35b3bd['limit'];var _0x25cf5d;if(_0x4b8fc3>=_0x5d7a1b){_0x4b8fc3=_0x5d7a1b;_0x25cf5d=0xc8;}else{_0x25cf5d=0xce;}_0xfc7630[_0x5080('0x17')](_0x25cf5d);return _0xfc7630[_0x5080('0x1d')](_0x5080('0x1e'),_0x38ffdf+'-'+_0x4b8fc3+'/'+_0x5d7a1b)[_0x5080('0x18')](_0x474bdb);}return null;};}function patchUpdates(_0x2c0cd7){return function(_0x49b73f){try{jsonpatch[_0x5080('0x1f')](_0x49b73f,_0x2c0cd7,!![]);}catch(_0x467de7){return BPromise['reject'](_0x467de7);}return _0x49b73f[_0x5080('0x20')]();};}function saveUpdates(_0x36f7ae,_0x54bc98){return function(_0x1f72ba){if(_0x1f72ba){return _0x1f72ba[_0x5080('0x21')](_0x36f7ae)[_0x5080('0x22')](function(_0x3b55a3){return _0x3b55a3;});}return null;};}function removeEntity(_0x4ec124,_0x3984f5){return function(_0xae36){if(_0xae36){return _0xae36[_0x5080('0x23')]()[_0x5080('0x22')](function(){_0x4ec124[_0x5080('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x539d86,_0x3ee202){return function(_0x5cfe4f){if(!_0x5cfe4f){_0x539d86[_0x5080('0x15')](0x194);}return _0x5cfe4f;};}function handleError(_0x137dc5,_0x20cf8a){_0x20cf8a=_0x20cf8a||0x1f4;return function(_0x2514a3){logger[_0x5080('0x24')](_0x2514a3[_0x5080('0x25')]);if(_0x2514a3[_0x5080('0x26')]){delete _0x2514a3[_0x5080('0x26')];}_0x137dc5[_0x5080('0x17')](_0x20cf8a)[_0x5080('0x27')](_0x2514a3);};}exports[_0x5080('0x28')]=function(_0x700eff,_0x3d0ab1){var _0x28430c={},_0x252168={},_0x1a7725={'count':0x0,'rows':[]};var _0x56bfcf=_[_0x5080('0x29')](db['CmHopperHistory'][_0x5080('0x2a')],function(_0xf1d987){return{'name':_0xf1d987[_0x5080('0x2b')],'type':_0xf1d987[_0x5080('0x2c')][_0x5080('0x2d')]};});_0x252168['model']=_[_0x5080('0x29')](_0x56bfcf,_0x5080('0x26'));_0x252168['query']=_[_0x5080('0x2e')](_0x700eff[_0x5080('0x2f')]);_0x252168['filters']=_[_0x5080('0x30')](_0x252168[_0x5080('0x31')],_0x252168[_0x5080('0x2f')]);_0x28430c[_0x5080('0x32')]=_[_0x5080('0x30')](_0x252168['model'],qs[_0x5080('0x33')](_0x700eff[_0x5080('0x2f')][_0x5080('0x33')]));_0x28430c[_0x5080('0x32')]=_0x28430c[_0x5080('0x32')][_0x5080('0x34')]?_0x28430c[_0x5080('0x32')]:_0x252168[_0x5080('0x31')];if(!_0x700eff[_0x5080('0x2f')][_0x5080('0x35')](_0x5080('0x36'))){_0x28430c[_0x5080('0x1b')]=qs[_0x5080('0x1b')](_0x700eff['query'][_0x5080('0x1b')]);_0x28430c[_0x5080('0x19')]=qs[_0x5080('0x19')](_0x700eff[_0x5080('0x2f')][_0x5080('0x19')]);}_0x28430c[_0x5080('0x37')]=qs[_0x5080('0x38')](_0x700eff[_0x5080('0x2f')][_0x5080('0x38')]);_0x28430c['where']=qs[_0x5080('0x39')](_[_0x5080('0x3a')](_0x700eff[_0x5080('0x2f')],_0x252168[_0x5080('0x39')]),_0x56bfcf);if(_0x700eff[_0x5080('0x2f')][_0x5080('0x3b')]){_0x28430c[_0x5080('0x3c')]=_[_0x5080('0x3d')](_0x28430c[_0x5080('0x3c')],{'$or':_[_0x5080('0x29')](_0x56bfcf,function(_0x39630c){if(_0x39630c[_0x5080('0x2c')]!==_0x5080('0x3e')){var _0x5af142={};_0x5af142[_0x39630c['name']]={'$like':'%'+_0x700eff[_0x5080('0x2f')][_0x5080('0x3b')]+'%'};return _0x5af142;}})});}_0x28430c=_['merge']({},_0x28430c,_0x700eff[_0x5080('0x3f')]);var _0x59c2b7={'where':_0x28430c[_0x5080('0x3c')]};return db[_0x5080('0x40')]['count'](_0x59c2b7)[_0x5080('0x22')](function(_0x11bb68){_0x1a7725[_0x5080('0x1c')]=_0x11bb68;if(_0x700eff[_0x5080('0x2f')][_0x5080('0x41')]){_0x28430c[_0x5080('0x42')]=[{'all':!![]}];}return db[_0x5080('0x40')]['findAll'](_0x28430c);})[_0x5080('0x22')](function(_0xfe7afc){_0x1a7725[_0x5080('0x43')]=_0xfe7afc;return _0x1a7725;})[_0x5080('0x22')](respondWithFilteredResult(_0x3d0ab1,_0x28430c))[_0x5080('0x44')](handleError(_0x3d0ab1,null));};exports['show']=function(_0x129418,_0x457924){var _0x475f18={'raw':!![],'where':{'id':_0x129418[_0x5080('0x45')]['id']}},_0x379b25={};_0x379b25[_0x5080('0x31')]=_[_0x5080('0x2e')](db[_0x5080('0x40')]['rawAttributes']);_0x379b25[_0x5080('0x2f')]=_[_0x5080('0x2e')](_0x129418[_0x5080('0x2f')]);_0x379b25[_0x5080('0x39')]=_['intersection'](_0x379b25[_0x5080('0x31')],_0x379b25[_0x5080('0x2f')]);_0x475f18[_0x5080('0x32')]=_[_0x5080('0x30')](_0x379b25[_0x5080('0x31')],qs[_0x5080('0x33')](_0x129418[_0x5080('0x2f')][_0x5080('0x33')]));_0x475f18['attributes']=_0x475f18[_0x5080('0x32')]['length']?_0x475f18['attributes']:_0x379b25[_0x5080('0x31')];if(_0x129418[_0x5080('0x2f')][_0x5080('0x41')]){_0x475f18[_0x5080('0x42')]=[{'all':!![]}];}_0x475f18=_[_0x5080('0x3d')]({},_0x475f18,_0x129418['options']);return db[_0x5080('0x40')][_0x5080('0x46')](_0x475f18)['then'](handleEntityNotFound(_0x457924,null))[_0x5080('0x22')](respondWithResult(_0x457924,null))[_0x5080('0x44')](handleError(_0x457924,null));};exports[_0x5080('0x47')]=function(_0x195778,_0x5c7986){return db[_0x5080('0x40')][_0x5080('0x47')](_0x195778[_0x5080('0x48')],{})[_0x5080('0x22')](respondWithResult(_0x5c7986,0xc9))[_0x5080('0x44')](handleError(_0x5c7986,null));};exports['describe']=function(_0xfad1e5,_0x5ca48f){return db[_0x5080('0x40')][_0x5080('0x49')]()[_0x5080('0x22')](respondWithResult(_0x5ca48f,null))['catch'](handleError(_0x5ca48f,null));};exports['update']=function(_0x4871fb,_0x41f9aa){if(_0x4871fb[_0x5080('0x48')][_0x5080('0x4a')]){delete _0x4871fb[_0x5080('0x48')][_0x5080('0x4a')];}return db[_0x5080('0x40')][_0x5080('0x46')]({'where':{'uniqueid':_0x4871fb[_0x5080('0x45')]['id']}})[_0x5080('0x22')](handleEntityNotFound(_0x41f9aa,null))[_0x5080('0x22')](saveUpdates(_0x4871fb['body'],null))[_0x5080('0x22')](respondWithResult(_0x41f9aa,null))[_0x5080('0x44')](handleError(_0x41f9aa,null));}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.model.js b/server/api/cmHopperHistory/cmHopperHistory.model.js index 8795058..e2c99b7 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 _0x23db=['util','../../config/logger','api','moment','bluebird','rimraf','../../config/environment','exports','define','CmHopperHistory','cm_hopper_history','endtime','uniqueid','lodash'];(function(_0xc3b4a1,_0x43e21c){var _0x16c2cf=function(_0xb0b513){while(--_0xb0b513){_0xc3b4a1['push'](_0xc3b4a1['shift']());}};_0x16c2cf(++_0x43e21c);}(_0x23db,0x141));var _0xb23d=function(_0x1f9f37,_0x18776e){_0x1f9f37=_0x1f9f37-0x0;var _0x21c080=_0x23db[_0x1f9f37];return _0x21c080;};'use strict';var _=require(_0xb23d('0x0'));var util=require(_0xb23d('0x1'));var logger=require(_0xb23d('0x2'))(_0xb23d('0x3'));var moment=require(_0xb23d('0x4'));var BPromise=require(_0xb23d('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xb23d('0x6'));var config=require(_0xb23d('0x7'));var attributes=require('./cmHopperHistory.attributes');module[_0xb23d('0x8')]=function(_0x3a2ba6,_0x105811){return _0x3a2ba6[_0xb23d('0x9')](_0xb23d('0xa'),attributes,{'tableName':_0xb23d('0xb'),'paranoid':![],'indexes':[{'name':_0xb23d('0xc'),'fields':[_0xb23d('0xc')]},{'name':_0xb23d('0xd'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x17a7=['endtime','uniqueid','api','moment','bluebird','request-promise','rimraf','./cmHopperHistory.attributes','exports','define','CmHopperHistory','cm_hopper_history'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x17a7,0xc2));var _0x717a=function(_0x5bb65c,_0x3f9f19){_0x5bb65c=_0x5bb65c-0x0;var _0x14a28c=_0x17a7[_0x5bb65c];return _0x14a28c;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x717a('0x0'));var moment=require(_0x717a('0x1'));var BPromise=require(_0x717a('0x2'));var rp=require(_0x717a('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x717a('0x4'));var config=require('../../config/environment');var attributes=require(_0x717a('0x5'));module[_0x717a('0x6')]=function(_0x4dd8c3,_0x232539){return _0x4dd8c3[_0x717a('0x7')](_0x717a('0x8'),attributes,{'tableName':_0x717a('0x9'),'paranoid':![],'indexes':[{'name':'endtime','fields':[_0x717a('0xa')]},{'name':'uniqueid','fields':[_0x717a('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.rpc.js b/server/api/cmHopperHistory/cmHopperHistory.rpc.js index 1ea87e8..034812b 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 _0x0834=['outboundUnknownCallsDay','outboundBlacklistCallsDay','`state`\x20=\x2014,\x201,\x20null','`state`\x20=\x2018,\x201,\x20null','outboundRejectCallsDay','outboundAnswerAgiCallsDay','`state`\x20=\x2020,\x201,\x20null','`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null','outboundReCallsDay','GetVoiceQueueHopperHistory','campaign','name','ivrTotalCallsDays','ivrAnswerCallsDay','moment','bluebird','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','then','info','CmHopperHistory,\x20%s,\x20%s','request\x20sent','debug','CmHopperHistory,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','create','options','raw','CreateCmHopperHistory','CmHopperHistory','findAll','sequelize','COUNT','col','predictiveIntervalTotalCalls','literal','`state`\x20=\x204,\x201,\x20null','predictiveIntervalAnsweredCalls','`state`\x20=\x2010,\x201,\x20null','predictiveIntervalDroppedCallsTimeout','`state`\x20=\x2011,\x201,\x20null','predictiveIntervalDroppedCallsCallersExit','`state`\x20=\x204,\x20`holdtime`,\x20null','predictiveIntervalAvgHoldtime','`state`\x20=\x204,\x20`talktime`,\x20null','AvgHandleTime','`state`\x20=\x200,\x201,\x20null','`state`\x20=\x203,\x201,\x20null','outboundAnswerCallsDay','`state`\x20=\x205,\x201,\x20null','`state`\x20=\x208,\x201,\x20null','outboundCongestionCallsDay','`state`\x20=\x2010\x20,\x201,\x20null','outboundDropCallsDayTimeout','`state`\x20=\x2011\x20,\x201,\x20null','outboundDropCallsDayCallersExit'];(function(_0x4ed520,_0x21be63){var _0x4415a6=function(_0x14b151){while(--_0x14b151){_0x4ed520['push'](_0x4ed520['shift']());}};_0x4415a6(++_0x21be63);}(_0x0834,0x18e));var _0x4083=function(_0x4eb8c6,_0x5afd27){_0x4eb8c6=_0x4eb8c6-0x0;var _0x6ddea8=_0x0834[_0x4eb8c6];return _0x6ddea8;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x4083('0x0'));var BPromise=require(_0x4083('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x4083('0x2'));var logger=require(_0x4083('0x3'))('rpc');var config=require(_0x4083('0x4'));var jayson=require(_0x4083('0x5'));var client=jayson['client'][_0x4083('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x5c5a54,_0x31c7ef,_0x26ed53){return new BPromise(function(_0x2c42bb,_0x1d56dd){return client[_0x4083('0x7')](_0x5c5a54,_0x26ed53)[_0x4083('0x8')](function(_0x3cee37){logger[_0x4083('0x9')](_0x4083('0xa'),_0x31c7ef,_0x4083('0xb'));logger[_0x4083('0xc')](_0x4083('0xd'),_0x31c7ef,_0x4083('0xb'),JSON[_0x4083('0xe')](_0x3cee37));if(_0x3cee37[_0x4083('0xf')]){if(_0x3cee37['error']['code']===0x1f4){logger[_0x4083('0xf')](_0x4083('0xa'),_0x31c7ef,_0x3cee37['error'][_0x4083('0x10')]);return _0x1d56dd(_0x3cee37[_0x4083('0xf')][_0x4083('0x10')]);}logger['error']('CmHopperHistory,\x20%s,\x20%s',_0x31c7ef,_0x3cee37[_0x4083('0xf')][_0x4083('0x10')]);return _0x2c42bb(_0x3cee37['error'][_0x4083('0x10')]);}else{logger[_0x4083('0x9')](_0x4083('0xa'),_0x31c7ef,_0x4083('0xb'));_0x2c42bb(_0x3cee37[_0x4083('0x11')]['message']);}})[_0x4083('0x12')](function(_0x10cadd){logger[_0x4083('0xf')](_0x4083('0xa'),_0x31c7ef,_0x10cadd);_0x1d56dd(_0x10cadd);});});}exports['CreateCmHopperHistory']=function(_0x4e7d59){var _0x4d6089=this;return new Promise(function(_0xafda0c,_0x53d525){return db['CmHopperHistory'][_0x4083('0x13')](_0x4e7d59['body'],{'raw':_0x4e7d59[_0x4083('0x14')]?_0x4e7d59[_0x4083('0x14')][_0x4083('0x15')]===undefined?!![]:![]:!![]})[_0x4083('0x8')](function(_0x4b32e9){logger[_0x4083('0x9')]('CreateCmHopperHistory',_0x4e7d59);logger[_0x4083('0xc')](_0x4083('0x16'),_0x4e7d59,JSON[_0x4083('0xe')](_0x4b32e9));_0xafda0c(_0x4b32e9);})[_0x4083('0x12')](function(_0x5d7461){logger[_0x4083('0xf')]('CreateCmHopperHistory',_0x5d7461[_0x4083('0x10')],_0x4e7d59);_0x53d525(_0x4d6089[_0x4083('0xf')](0x1f4,_0x5d7461['message']));});});};exports['AvgHandleTime']=function(_0x3ce623){var _0x5b1f8a=this;return new Promise(function(_0x5d38e0,_0x5f034c){return db[_0x4083('0x17')][_0x4083('0x18')]({'raw':_0x3ce623[_0x4083('0x14')]?_0x3ce623['options'][_0x4083('0x15')]===undefined?!![]:![]:!![],'where':_0x3ce623[_0x4083('0x14')]?_0x3ce623[_0x4083('0x14')]['where']||null:null,'attributes':[[db[_0x4083('0x19')]['fn'](_0x4083('0x1a'),db['sequelize'][_0x4083('0x1b')]('id')),_0x4083('0x1c')],[db[_0x4083('0x19')]['fn'](_0x4083('0x1a'),db[_0x4083('0x19')]['fn']('IF',db[_0x4083('0x19')][_0x4083('0x1d')](_0x4083('0x1e')))),_0x4083('0x1f')],[db['sequelize']['fn']('COUNT',db[_0x4083('0x19')]['fn']('IF',db[_0x4083('0x19')][_0x4083('0x1d')](_0x4083('0x20')))),_0x4083('0x21')],[db[_0x4083('0x19')]['fn']('COUNT',db[_0x4083('0x19')]['fn']('IF',db[_0x4083('0x19')][_0x4083('0x1d')](_0x4083('0x22')))),_0x4083('0x23')],[db[_0x4083('0x19')]['fn']('AVG',db[_0x4083('0x19')]['fn']('IF',db[_0x4083('0x19')][_0x4083('0x1d')](_0x4083('0x24')))),_0x4083('0x25')],[db[_0x4083('0x19')]['fn']('AVG',db[_0x4083('0x19')]['fn']('IF',db['sequelize'][_0x4083('0x1d')](_0x4083('0x26')))),'predictiveIntervalAvgTalktime']]})[_0x4083('0x8')](function(_0xaeff25){logger[_0x4083('0x9')](_0x4083('0x27'),_0x3ce623);logger['debug']('AvgHandleTime',_0x3ce623,JSON[_0x4083('0xe')](_0xaeff25));_0x5d38e0(_0xaeff25);})[_0x4083('0x12')](function(_0x54267c){logger[_0x4083('0xf')]('AvgHandleTime',_0x54267c[_0x4083('0x10')],_0x3ce623);_0x5f034c(_0x5b1f8a['error'](0x1f4,_0x54267c['message']));});});};exports['GetVoiceQueueHopperHistory']=function(_0x1f4d37){var _0x4080b1=this;return new Promise(function(_0x31347c,_0x6533ee){return db[_0x4083('0x17')]['findAll']({'raw':_0x1f4d37['options']?_0x1f4d37[_0x4083('0x14')][_0x4083('0x15')]===undefined?!![]:![]:!![],'where':_0x1f4d37['options']?_0x1f4d37[_0x4083('0x14')]['where']||null:null,'attributes':[['campaign','name'],[db[_0x4083('0x19')]['fn'](_0x4083('0x1a'),db[_0x4083('0x19')]['fn']('IF',db['sequelize']['literal'](_0x4083('0x28')))),'outboundNoSuchCallsDay'],[db[_0x4083('0x19')]['fn'](_0x4083('0x1a'),db[_0x4083('0x19')]['fn']('IF',db[_0x4083('0x19')][_0x4083('0x1d')](_0x4083('0x29')))),'outboundNoAnswerCallsDay'],[db[_0x4083('0x19')]['fn'](_0x4083('0x1a'),db['sequelize']['fn']('IF',db['sequelize'][_0x4083('0x1d')]('`state`\x20=\x204,\x201,\x20null'))),_0x4083('0x2a')],[db[_0x4083('0x19')]['fn'](_0x4083('0x1a'),db['sequelize']['fn']('IF',db[_0x4083('0x19')][_0x4083('0x1d')](_0x4083('0x2b')))),'outboundBusyCallsDay'],[db[_0x4083('0x19')]['fn'](_0x4083('0x1a'),db[_0x4083('0x19')]['fn']('IF',db[_0x4083('0x19')][_0x4083('0x1d')](_0x4083('0x2c')))),_0x4083('0x2d')],[db[_0x4083('0x19')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x4083('0x19')][_0x4083('0x1d')](_0x4083('0x2e')))),_0x4083('0x2f')],[db[_0x4083('0x19')]['fn'](_0x4083('0x1a'),db[_0x4083('0x19')]['fn']('IF',db['sequelize'][_0x4083('0x1d')](_0x4083('0x30')))),_0x4083('0x31')],[db[_0x4083('0x19')]['fn'](_0x4083('0x1a'),db['sequelize']['fn']('IF',db[_0x4083('0x19')]['literal']('`state`\x20=\x2012,\x201,\x20null'))),_0x4083('0x32')],[db[_0x4083('0x19')]['fn'](_0x4083('0x1a'),db[_0x4083('0x19')]['fn']('IF',db['sequelize'][_0x4083('0x1d')]('`state`\x20=\x2013,\x201,\x20null'))),_0x4083('0x33')],[db[_0x4083('0x19')]['fn'](_0x4083('0x1a'),db['sequelize']['fn']('IF',db[_0x4083('0x19')][_0x4083('0x1d')](_0x4083('0x34')))),'outboundOriginateFailureCallsDay'],[db[_0x4083('0x19')]['fn'](_0x4083('0x1a'),db[_0x4083('0x19')]['fn']('IF',db[_0x4083('0x19')][_0x4083('0x1d')](_0x4083('0x35')))),_0x4083('0x36')],[db['sequelize']['fn'](_0x4083('0x1a'),db[_0x4083('0x19')]['fn']('IF',db[_0x4083('0x19')][_0x4083('0x1d')]('`state`\x20=\x2016,\x201,\x20null'))),_0x4083('0x37')],[db['sequelize']['fn'](_0x4083('0x1a'),db[_0x4083('0x19')]['fn']('IF',db['sequelize'][_0x4083('0x1d')](_0x4083('0x38')))),_0x4083('0x36')],[db[_0x4083('0x19')]['fn'](_0x4083('0x1a'),db[_0x4083('0x19')]['fn']('IF',db['sequelize']['literal'](_0x4083('0x39')))),_0x4083('0x3a')]],'group':['campaign']})[_0x4083('0x8')](function(_0x367e67){logger[_0x4083('0x9')]('GetVoiceQueueHopperHistory',_0x1f4d37);logger[_0x4083('0xc')]('GetVoiceQueueHopperHistory',_0x1f4d37,JSON[_0x4083('0xe')](_0x367e67));_0x31347c(_0x367e67);})[_0x4083('0x12')](function(_0x209be3){logger[_0x4083('0xf')](_0x4083('0x3b'),_0x209be3['message'],_0x1f4d37);_0x6533ee(_0x4080b1['error'](0x1f4,_0x209be3[_0x4083('0x10')]));});});};exports['GetCampaignHopperHistory']=function(_0x3f2c0c){var _0xade4b0=this;return new Promise(function(_0x4d609e,_0x4b3434){return db[_0x4083('0x17')][_0x4083('0x18')]({'raw':_0x3f2c0c[_0x4083('0x14')]?_0x3f2c0c[_0x4083('0x14')][_0x4083('0x15')]===undefined?!![]:![]:!![],'where':_0x3f2c0c['options']?_0x3f2c0c[_0x4083('0x14')]['where']||null:null,'attributes':[[_0x4083('0x3c'),_0x4083('0x3d')],[db[_0x4083('0x19')]['fn']('COUNT',db[_0x4083('0x19')][_0x4083('0x1b')]('id')),_0x4083('0x3e')],[db[_0x4083('0x19')]['fn'](_0x4083('0x1a'),db[_0x4083('0x19')]['fn']('IF',db[_0x4083('0x19')][_0x4083('0x1d')](_0x4083('0x1e')))),_0x4083('0x3f')]],'group':[_0x4083('0x3c')]})[_0x4083('0x8')](function(_0x2858d7){logger[_0x4083('0x9')]('GetCampaignHopperHistory',_0x3f2c0c);logger[_0x4083('0xc')]('GetCampaignHopperHistory',_0x3f2c0c,JSON[_0x4083('0xe')](_0x2858d7));_0x4d609e(_0x2858d7);})[_0x4083('0x12')](function(_0x2a49ae){logger['error']('GetCampaignHopperHistory',_0x2a49ae[_0x4083('0x10')],_0x3f2c0c);_0x4b3434(_0xade4b0[_0x4083('0xf')](0x1f4,_0x2a49ae[_0x4083('0x10')]));});});}; \ No newline at end of file +var _0xf2fa=['`state`\x20=\x200,\x201,\x20null','`state`\x20=\x203,\x201,\x20null','`state`\x20=\x204,\x201,\x20null','outboundAnswerCallsDay','`state`\x20=\x205,\x201,\x20null','outboundBusyCallsDay','`state`\x20=\x208,\x201,\x20null','outboundCongestionCallsDay','outboundDropCallsDayTimeout','`state`\x20=\x2011\x20,\x201,\x20null','outboundUnknownCallsDay','`state`\x20=\x2013,\x201,\x20null','outboundBlacklistCallsDay','`state`\x20=\x2014,\x201,\x20null','`state`\x20=\x2016,\x201,\x20null','outboundAnswerAgiCallsDay','outboundReCallsDay','then','GetCampaignHopperHistory','name','col','ivrAnswerCallsDay','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','info','CmHopperHistory,\x20%s,\x20%s','request\x20sent','debug','CmHopperHistory,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateCmHopperHistory','body','options','raw','findAll','sequelize','COUNT','literal','predictiveIntervalAnsweredCalls','`state`\x20=\x2010,\x201,\x20null','predictiveIntervalDroppedCallsTimeout','`state`\x20=\x204,\x20`holdtime`,\x20null','predictiveIntervalAvgHoldtime','AVG','`state`\x20=\x204,\x20`talktime`,\x20null','AvgHandleTime','GetVoiceQueueHopperHistory','CmHopperHistory','where','campaign'];(function(_0x435e01,_0x14049a){var _0x531373=function(_0x4786ad){while(--_0x4786ad){_0x435e01['push'](_0x435e01['shift']());}};_0x531373(++_0x14049a);}(_0xf2fa,0xd0));var _0xaf2f=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xf2fa[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0xaf2f('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xaf2f('0x1'));var rs=require(_0xaf2f('0x2'));var fs=require('fs');var Redis=require(_0xaf2f('0x3'));var db=require(_0xaf2f('0x4'))['db'];var utils=require(_0xaf2f('0x5'));var logger=require(_0xaf2f('0x6'))(_0xaf2f('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xaf2f('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x45e164,_0x2dfba7,_0x1c3cfa){return new BPromise(function(_0x312d3b,_0x2b65f2){return client['request'](_0x45e164,_0x1c3cfa)['then'](function(_0x50c838){logger[_0xaf2f('0x9')](_0xaf2f('0xa'),_0x2dfba7,_0xaf2f('0xb'));logger[_0xaf2f('0xc')](_0xaf2f('0xd'),_0x2dfba7,_0xaf2f('0xb'),JSON[_0xaf2f('0xe')](_0x50c838));if(_0x50c838[_0xaf2f('0xf')]){if(_0x50c838['error'][_0xaf2f('0x10')]===0x1f4){logger[_0xaf2f('0xf')](_0xaf2f('0xa'),_0x2dfba7,_0x50c838['error']['message']);return _0x2b65f2(_0x50c838['error'][_0xaf2f('0x11')]);}logger[_0xaf2f('0xf')]('CmHopperHistory,\x20%s,\x20%s',_0x2dfba7,_0x50c838[_0xaf2f('0xf')][_0xaf2f('0x11')]);return _0x312d3b(_0x50c838['error'][_0xaf2f('0x11')]);}else{logger['info'](_0xaf2f('0xa'),_0x2dfba7,_0xaf2f('0xb'));_0x312d3b(_0x50c838[_0xaf2f('0x12')][_0xaf2f('0x11')]);}})[_0xaf2f('0x13')](function(_0x32e829){logger[_0xaf2f('0xf')](_0xaf2f('0xa'),_0x2dfba7,_0x32e829);_0x2b65f2(_0x32e829);});});}exports[_0xaf2f('0x14')]=function(_0x244435){var _0x4d2db7=this;return new Promise(function(_0x1a2d28,_0x3376bb){return db['CmHopperHistory']['create'](_0x244435[_0xaf2f('0x15')],{'raw':_0x244435[_0xaf2f('0x16')]?_0x244435['options'][_0xaf2f('0x17')]===undefined?!![]:![]:!![]})['then'](function(_0x2dbd9b){logger['info'](_0xaf2f('0x14'),_0x244435);logger[_0xaf2f('0xc')]('CreateCmHopperHistory',_0x244435,JSON[_0xaf2f('0xe')](_0x2dbd9b));_0x1a2d28(_0x2dbd9b);})[_0xaf2f('0x13')](function(_0x359dc2){logger[_0xaf2f('0xf')](_0xaf2f('0x14'),_0x359dc2[_0xaf2f('0x11')],_0x244435);_0x3376bb(_0x4d2db7[_0xaf2f('0xf')](0x1f4,_0x359dc2[_0xaf2f('0x11')]));});});};exports['AvgHandleTime']=function(_0x5f199d){var _0x22e94c=this;return new Promise(function(_0x7fd44e,_0x17de64){return db['CmHopperHistory'][_0xaf2f('0x18')]({'raw':_0x5f199d[_0xaf2f('0x16')]?_0x5f199d[_0xaf2f('0x16')][_0xaf2f('0x17')]===undefined?!![]:![]:!![],'where':_0x5f199d[_0xaf2f('0x16')]?_0x5f199d[_0xaf2f('0x16')]['where']||null:null,'attributes':[[db['sequelize']['fn']('COUNT',db[_0xaf2f('0x19')]['col']('id')),'predictiveIntervalTotalCalls'],[db[_0xaf2f('0x19')]['fn'](_0xaf2f('0x1a'),db[_0xaf2f('0x19')]['fn']('IF',db[_0xaf2f('0x19')][_0xaf2f('0x1b')]('`state`\x20=\x204,\x201,\x20null'))),_0xaf2f('0x1c')],[db[_0xaf2f('0x19')]['fn']('COUNT',db[_0xaf2f('0x19')]['fn']('IF',db[_0xaf2f('0x19')]['literal'](_0xaf2f('0x1d')))),_0xaf2f('0x1e')],[db[_0xaf2f('0x19')]['fn'](_0xaf2f('0x1a'),db['sequelize']['fn']('IF',db[_0xaf2f('0x19')][_0xaf2f('0x1b')]('`state`\x20=\x2011,\x201,\x20null'))),'predictiveIntervalDroppedCallsCallersExit'],[db[_0xaf2f('0x19')]['fn']('AVG',db[_0xaf2f('0x19')]['fn']('IF',db[_0xaf2f('0x19')][_0xaf2f('0x1b')](_0xaf2f('0x1f')))),_0xaf2f('0x20')],[db['sequelize']['fn'](_0xaf2f('0x21'),db['sequelize']['fn']('IF',db['sequelize'][_0xaf2f('0x1b')](_0xaf2f('0x22')))),'predictiveIntervalAvgTalktime']]})['then'](function(_0x103fd5){logger[_0xaf2f('0x9')](_0xaf2f('0x23'),_0x5f199d);logger[_0xaf2f('0xc')](_0xaf2f('0x23'),_0x5f199d,JSON['stringify'](_0x103fd5));_0x7fd44e(_0x103fd5);})[_0xaf2f('0x13')](function(_0x5144aa){logger[_0xaf2f('0xf')](_0xaf2f('0x23'),_0x5144aa[_0xaf2f('0x11')],_0x5f199d);_0x17de64(_0x22e94c[_0xaf2f('0xf')](0x1f4,_0x5144aa[_0xaf2f('0x11')]));});});};exports[_0xaf2f('0x24')]=function(_0xfc9e67){var _0x41393b=this;return new Promise(function(_0x4c66ad,_0x5db64e){return db[_0xaf2f('0x25')]['findAll']({'raw':_0xfc9e67[_0xaf2f('0x16')]?_0xfc9e67['options'][_0xaf2f('0x17')]===undefined?!![]:![]:!![],'where':_0xfc9e67[_0xaf2f('0x16')]?_0xfc9e67['options'][_0xaf2f('0x26')]||null:null,'attributes':[[_0xaf2f('0x27'),'name'],[db[_0xaf2f('0x19')]['fn'](_0xaf2f('0x1a'),db['sequelize']['fn']('IF',db[_0xaf2f('0x19')]['literal'](_0xaf2f('0x28')))),'outboundNoSuchCallsDay'],[db['sequelize']['fn']('COUNT',db[_0xaf2f('0x19')]['fn']('IF',db[_0xaf2f('0x19')]['literal'](_0xaf2f('0x29')))),'outboundNoAnswerCallsDay'],[db['sequelize']['fn'](_0xaf2f('0x1a'),db[_0xaf2f('0x19')]['fn']('IF',db[_0xaf2f('0x19')][_0xaf2f('0x1b')](_0xaf2f('0x2a')))),_0xaf2f('0x2b')],[db[_0xaf2f('0x19')]['fn'](_0xaf2f('0x1a'),db['sequelize']['fn']('IF',db[_0xaf2f('0x19')][_0xaf2f('0x1b')](_0xaf2f('0x2c')))),_0xaf2f('0x2d')],[db[_0xaf2f('0x19')]['fn']('COUNT',db[_0xaf2f('0x19')]['fn']('IF',db[_0xaf2f('0x19')][_0xaf2f('0x1b')](_0xaf2f('0x2e')))),_0xaf2f('0x2f')],[db['sequelize']['fn'](_0xaf2f('0x1a'),db[_0xaf2f('0x19')]['fn']('IF',db['sequelize'][_0xaf2f('0x1b')]('`state`\x20=\x2010\x20,\x201,\x20null'))),_0xaf2f('0x30')],[db[_0xaf2f('0x19')]['fn']('COUNT',db[_0xaf2f('0x19')]['fn']('IF',db[_0xaf2f('0x19')][_0xaf2f('0x1b')](_0xaf2f('0x31')))),'outboundDropCallsDayCallersExit'],[db['sequelize']['fn'](_0xaf2f('0x1a'),db[_0xaf2f('0x19')]['fn']('IF',db[_0xaf2f('0x19')]['literal']('`state`\x20=\x2012,\x201,\x20null'))),_0xaf2f('0x32')],[db['sequelize']['fn'](_0xaf2f('0x1a'),db[_0xaf2f('0x19')]['fn']('IF',db['sequelize'][_0xaf2f('0x1b')](_0xaf2f('0x33')))),_0xaf2f('0x34')],[db['sequelize']['fn']('COUNT',db[_0xaf2f('0x19')]['fn']('IF',db['sequelize'][_0xaf2f('0x1b')](_0xaf2f('0x35')))),'outboundOriginateFailureCallsDay'],[db[_0xaf2f('0x19')]['fn'](_0xaf2f('0x1a'),db[_0xaf2f('0x19')]['fn']('IF',db[_0xaf2f('0x19')][_0xaf2f('0x1b')]('`state`\x20=\x2018,\x201,\x20null'))),'outboundRejectCallsDay'],[db['sequelize']['fn'](_0xaf2f('0x1a'),db[_0xaf2f('0x19')]['fn']('IF',db['sequelize']['literal'](_0xaf2f('0x36')))),_0xaf2f('0x37')],[db[_0xaf2f('0x19')]['fn'](_0xaf2f('0x1a'),db[_0xaf2f('0x19')]['fn']('IF',db[_0xaf2f('0x19')][_0xaf2f('0x1b')]('`state`\x20=\x2020,\x201,\x20null'))),'outboundRejectCallsDay'],[db[_0xaf2f('0x19')]['fn'](_0xaf2f('0x1a'),db[_0xaf2f('0x19')]['fn']('IF',db[_0xaf2f('0x19')]['literal']('`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null'))),_0xaf2f('0x38')]],'group':[_0xaf2f('0x27')]})[_0xaf2f('0x39')](function(_0x3f0491){logger[_0xaf2f('0x9')](_0xaf2f('0x24'),_0xfc9e67);logger[_0xaf2f('0xc')](_0xaf2f('0x24'),_0xfc9e67,JSON[_0xaf2f('0xe')](_0x3f0491));_0x4c66ad(_0x3f0491);})[_0xaf2f('0x13')](function(_0x24432a){logger[_0xaf2f('0xf')](_0xaf2f('0x24'),_0x24432a['message'],_0xfc9e67);_0x5db64e(_0x41393b[_0xaf2f('0xf')](0x1f4,_0x24432a[_0xaf2f('0x11')]));});});};exports[_0xaf2f('0x3a')]=function(_0x5f1195){var _0x547a7d=this;return new Promise(function(_0x33aaaf,_0x190f9a){return db['CmHopperHistory'][_0xaf2f('0x18')]({'raw':_0x5f1195['options']?_0x5f1195[_0xaf2f('0x16')][_0xaf2f('0x17')]===undefined?!![]:![]:!![],'where':_0x5f1195[_0xaf2f('0x16')]?_0x5f1195[_0xaf2f('0x16')][_0xaf2f('0x26')]||null:null,'attributes':[[_0xaf2f('0x27'),_0xaf2f('0x3b')],[db['sequelize']['fn'](_0xaf2f('0x1a'),db['sequelize'][_0xaf2f('0x3c')]('id')),'ivrTotalCallsDays'],[db[_0xaf2f('0x19')]['fn'](_0xaf2f('0x1a'),db['sequelize']['fn']('IF',db['sequelize'][_0xaf2f('0x1b')](_0xaf2f('0x2a')))),_0xaf2f('0x3d')]],'group':[_0xaf2f('0x27')]})[_0xaf2f('0x39')](function(_0x3d2b58){logger[_0xaf2f('0x9')]('GetCampaignHopperHistory',_0x5f1195);logger['debug'](_0xaf2f('0x3a'),_0x5f1195,JSON['stringify'](_0x3d2b58));_0x33aaaf(_0x3d2b58);})[_0xaf2f('0x13')](function(_0x36bbb1){logger[_0xaf2f('0xf')](_0xaf2f('0x3a'),_0x36bbb1[_0xaf2f('0x11')],_0x5f1195);_0x190f9a(_0x547a7d[_0xaf2f('0xf')](0x1f4,_0x36bbb1[_0xaf2f('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/index.js b/server/api/cmHopperHistory/index.js index 254a802..97a1d8e 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 _0xf90f=['show','post','put','update','exports','multer','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/describe','describe'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xf90f,0x1d9));var _0xff90=function(_0x54961a,_0x11fb85){_0x54961a=_0x54961a-0x0;var _0x5a1d3f=_0xf90f[_0x54961a];return _0x5a1d3f;};'use strict';var multer=require(_0xff90('0x0'));var util=require(_0xff90('0x1'));var path=require(_0xff90('0x2'));var timeout=require('connect-timeout');var express=require(_0xff90('0x3'));var router=express['Router']();var fs_extra=require(_0xff90('0x4'));var auth=require(_0xff90('0x5'));var interaction=require(_0xff90('0x6'));var config=require(_0xff90('0x7'));var controller=require('./cmHopperHistory.controller');router['get']('/',auth[_0xff90('0x8')](),controller[_0xff90('0x9')]);router[_0xff90('0xa')](_0xff90('0xb'),auth[_0xff90('0x8')](),controller[_0xff90('0xc')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0xff90('0xd')]);router[_0xff90('0xe')]('/',auth[_0xff90('0x8')](),controller['create']);router[_0xff90('0xf')]('/:id',auth[_0xff90('0x8')](),controller[_0xff90('0x10')]);module[_0xff90('0x11')]=router; \ No newline at end of file +var _0x8879=['get','isAuthenticated','index','describe','/:id','show','create','put','update','exports','multer','util','connect-timeout','Router','../../components/auth/service','./cmHopperHistory.controller'];(function(_0x6b1715,_0xe53657){var _0x566def=function(_0x3708fd){while(--_0x3708fd){_0x6b1715['push'](_0x6b1715['shift']());}};_0x566def(++_0xe53657);}(_0x8879,0xca));var _0x9887=function(_0x537f4e,_0x495869){_0x537f4e=_0x537f4e-0x0;var _0x34700e=_0x8879[_0x537f4e];return _0x34700e;};'use strict';var multer=require(_0x9887('0x0'));var util=require(_0x9887('0x1'));var path=require('path');var timeout=require(_0x9887('0x2'));var express=require('express');var router=express[_0x9887('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x9887('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x9887('0x5'));router[_0x9887('0x6')]('/',auth[_0x9887('0x7')](),controller[_0x9887('0x8')]);router[_0x9887('0x6')]('/describe',auth[_0x9887('0x7')](),controller[_0x9887('0x9')]);router[_0x9887('0x6')](_0x9887('0xa'),auth[_0x9887('0x7')](),controller[_0x9887('0xb')]);router['post']('/',auth[_0x9887('0x7')](),controller[_0x9887('0xc')]);router[_0x9887('0xd')](_0x9887('0xa'),auth[_0x9887('0x7')](),controller[_0x9887('0xe')]);module[_0x9887('0xf')]=router; \ No newline at end of file diff --git a/server/api/cmList/cmList.attributes.js b/server/api/cmList/cmList.attributes.js index 5e94e1d..f00c806 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 _0x1e19=['name','sequelize','exports','STRING'];(function(_0x12971a,_0x309311){var _0x317bc5=function(_0x1d6917){while(--_0x1d6917){_0x12971a['push'](_0x12971a['shift']());}};_0x317bc5(++_0x309311);}(_0x1e19,0x1c9));var _0x91e1=function(_0x31d370,_0x8aa847){_0x31d370=_0x31d370-0x0;var _0x2c6e73=_0x1e19[_0x31d370];return _0x2c6e73;};'use strict';var Sequelize=require(_0x91e1('0x0'));module[_0x91e1('0x1')]={'name':{'type':Sequelize[_0x91e1('0x2')],'unique':_0x91e1('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x91e1('0x2')]},'dialPrefix':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x5183=['sequelize','exports','STRING'];(function(_0x43ed38,_0x507af1){var _0x181497=function(_0x153d8e){while(--_0x153d8e){_0x43ed38['push'](_0x43ed38['shift']());}};_0x181497(++_0x507af1);}(_0x5183,0x13e));var _0x3518=function(_0x1c02db,_0x388eb7){_0x1c02db=_0x1c02db-0x0;var _0x539c3e=_0x5183[_0x1c02db];return _0x539c3e;};'use strict';var Sequelize=require(_0x3518('0x0'));module[_0x3518('0x1')]={'name':{'type':Sequelize[_0x3518('0x2')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']},'dialPrefix':{'type':Sequelize[_0x3518('0x2')]}}; \ No newline at end of file diff --git a/server/api/cmList/cmList.controller.js b/server/api/cmList/cmList.controller.js index 0b258b2..3538107 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 _0x91b7=['BOOLEAN','defaultValue','queryInterface','addColumn','cf_%s','getCustomFields','getGlobalCustomFields','findAndCountAll','spread','emit','userCmList:save','removeAgents','userCmList:remove','getAgents','User','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','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','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./cmList.socket','register','status','end','json','offset','undefined','limit','count','set','apply','reject','save','then','destroy','get','Lists','UserProfileResource','sendStatus','error','stack','name','map','CmList','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','params','include','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','ListId','Disposition','getDispositions','findOne','hasOwnProperty','removeDispositions','ids','CmContact','tags','join','isArray','push','each','omit','success','errors','message','Malformed\x20request\x20syntax','getContacts','concat','CustomFields','format','cf_%d','raw','getContactsCsv','ContactItemType','OrderBy','alias','select','from','cm_contacts','c.ListId\x20=\x20?','c.deletedAt\x20is\x20null','distinct','field','c.cf_','customField_','item','ItemTypeId\x20=\x20?','CmContactId\x20=\x20c.id','additionalPhone_','description','cm_contact_has_items','description_additionalPhone_','toString','isEmpty','now','writeFileSync','/tmp/list_%d_%s.csv','setHeader','Content-disposition','list_%d_%s.csv','text/csv','download','addCustomField','sequelize','transaction','CmCustomField','addCustomFields','Sequelize','TEXT','number','INTEGER','switch'];(function(_0x428328,_0x3d6dd2){var _0x14a0de=function(_0x2c5de1){while(--_0x2c5de1){_0x428328['push'](_0x428328['shift']());}};_0x14a0de(++_0x3d6dd2);}(_0x91b7,0x161));var _0x791b=function(_0x1b48cd,_0x4e1a55){_0x1b48cd=_0x1b48cd-0x0;var _0x11a3c8=_0x91b7[_0x1b48cd];return _0x11a3c8;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x791b('0x0'));var zipdir=require(_0x791b('0x1'));var jsonpatch=require(_0x791b('0x2'));var rp=require(_0x791b('0x3'));var moment=require(_0x791b('0x4'));var BPromise=require(_0x791b('0x5'));var Mustache=require(_0x791b('0x6'));var util=require('util');var path=require('path');var sox=require(_0x791b('0x7'));var csv=require(_0x791b('0x8'));var ejs=require(_0x791b('0x9'));var fs=require('fs');var fs_extra=require(_0x791b('0xa'));var _=require(_0x791b('0xb'));var squel=require(_0x791b('0xc'));var crypto=require('crypto');var jsforce=require(_0x791b('0xd'));var deskjs=require(_0x791b('0xe'));var toCsv=require(_0x791b('0x8'));var querystring=require(_0x791b('0xf'));var Papa=require(_0x791b('0x10'));var Redis=require(_0x791b('0x11'));var authService=require(_0x791b('0x12'));var qs=require(_0x791b('0x13'));var as=require(_0x791b('0x14'));var hardwareService=require(_0x791b('0x15'));var logger=require(_0x791b('0x16'))('api');var utils=require(_0x791b('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x791b('0x18'));var db=require(_0x791b('0x19'))['db'];var csv_results;config[_0x791b('0x1a')]=_[_0x791b('0x1b')](config[_0x791b('0x1a')],{'host':_0x791b('0x1c'),'port':0x18eb});var socket=require(_0x791b('0x1d'))(new Redis(config[_0x791b('0x1a')]));require(_0x791b('0x1e'))[_0x791b('0x1f')](socket);function respondWithStatusCode(_0x3312d6,_0x1857b4){_0x1857b4=_0x1857b4||0xcc;return function(_0x18dfdf){if(_0x18dfdf){return _0x3312d6['sendStatus'](_0x1857b4);}return _0x3312d6[_0x791b('0x20')](_0x1857b4)[_0x791b('0x21')]();};}function respondWithResult(_0x2b287b,_0x24b660){_0x24b660=_0x24b660||0xc8;return function(_0x1d4bb4){if(_0x1d4bb4){return _0x2b287b[_0x791b('0x20')](_0x24b660)[_0x791b('0x22')](_0x1d4bb4);}};}function respondWithFilteredResult(_0xe448e1,_0x1c624c){return function(_0x52b006){if(_0x52b006){var _0x37f1c2=typeof _0x1c624c[_0x791b('0x23')]===_0x791b('0x24')&&typeof _0x1c624c[_0x791b('0x25')]==='undefined';var _0x360aa4=_0x52b006[_0x791b('0x26')];var _0x1324de=_0x37f1c2?0x0:_0x1c624c['offset'];var _0x197b45=_0x37f1c2?_0x52b006['count']:_0x1c624c[_0x791b('0x23')]+_0x1c624c[_0x791b('0x25')];var _0x40b4d9;if(_0x197b45>=_0x360aa4){_0x197b45=_0x360aa4;_0x40b4d9=0xc8;}else{_0x40b4d9=0xce;}_0xe448e1[_0x791b('0x20')](_0x40b4d9);return _0xe448e1[_0x791b('0x27')]('Content-Range',_0x1324de+'-'+_0x197b45+'/'+_0x360aa4)[_0x791b('0x22')](_0x52b006);}return null;};}function patchUpdates(_0x158287){return function(_0x2a4bef){try{jsonpatch[_0x791b('0x28')](_0x2a4bef,_0x158287,!![]);}catch(_0x13a36e){return BPromise[_0x791b('0x29')](_0x13a36e);}return _0x2a4bef[_0x791b('0x2a')]();};}function saveUpdates(_0x36476f,_0x3ba7d4){return function(_0x4109bc){if(_0x4109bc){return _0x4109bc['update'](_0x36476f)[_0x791b('0x2b')](function(_0x105342){return _0x105342;});}return null;};}function removeEntity(_0x5ace1e,_0x18764b){return function(_0x54103e){if(_0x54103e){return _0x54103e[_0x791b('0x2c')]()[_0x791b('0x2b')](function(){var _0x2bb917=_0x54103e[_0x791b('0x2d')]({'plain':!![]});var _0x464398=_0x791b('0x2e');return db[_0x791b('0x2f')]['destroy']({'where':{'type':_0x464398,'resourceId':_0x2bb917['id']}})[_0x791b('0x2b')](function(){return _0x54103e;});})['then'](function(){_0x5ace1e[_0x791b('0x20')](0xcc)[_0x791b('0x21')]();});}};}function handleEntityNotFound(_0x3169e4,_0x350b13){return function(_0x1ed720){if(!_0x1ed720){_0x3169e4[_0x791b('0x30')](0x194);}return _0x1ed720;};}function handleError(_0x24c70d,_0x2fd562){_0x2fd562=_0x2fd562||0x1f4;return function(_0x44273f){logger[_0x791b('0x31')](_0x44273f[_0x791b('0x32')]);if(_0x44273f[_0x791b('0x33')]){delete _0x44273f[_0x791b('0x33')];}_0x24c70d[_0x791b('0x20')](_0x2fd562)['send'](_0x44273f);};}exports['index']=function(_0x195858,_0x58ecc4){var _0xc12592={},_0x533b2c={},_0x2fb273={'count':0x0,'rows':[]};var _0x49555b=_[_0x791b('0x34')](db[_0x791b('0x35')][_0x791b('0x36')],function(_0x3fc0fb){return{'name':_0x3fc0fb['fieldName'],'type':_0x3fc0fb[_0x791b('0x37')][_0x791b('0x38')]};});_0x533b2c[_0x791b('0x39')]=_[_0x791b('0x34')](_0x49555b,_0x791b('0x33'));_0x533b2c[_0x791b('0x3a')]=_[_0x791b('0x3b')](_0x195858[_0x791b('0x3a')]);_0x533b2c[_0x791b('0x3c')]=_[_0x791b('0x3d')](_0x533b2c[_0x791b('0x39')],_0x533b2c['query']);_0xc12592[_0x791b('0x3e')]=_[_0x791b('0x3d')](_0x533b2c[_0x791b('0x39')],qs[_0x791b('0x3f')](_0x195858['query']['fields']));_0xc12592[_0x791b('0x3e')]=_0xc12592[_0x791b('0x3e')][_0x791b('0x40')]?_0xc12592[_0x791b('0x3e')]:_0x533b2c[_0x791b('0x39')];if(!_0x195858[_0x791b('0x3a')]['hasOwnProperty'](_0x791b('0x41'))){_0xc12592[_0x791b('0x25')]=qs[_0x791b('0x25')](_0x195858[_0x791b('0x3a')][_0x791b('0x25')]);_0xc12592[_0x791b('0x23')]=qs[_0x791b('0x23')](_0x195858[_0x791b('0x3a')][_0x791b('0x23')]);}_0xc12592[_0x791b('0x42')]=qs[_0x791b('0x43')](_0x195858[_0x791b('0x3a')][_0x791b('0x43')]);_0xc12592[_0x791b('0x44')]=qs[_0x791b('0x3c')](_[_0x791b('0x45')](_0x195858[_0x791b('0x3a')],_0x533b2c[_0x791b('0x3c')]),_0x49555b);if(_0x195858['query'][_0x791b('0x46')]){_0xc12592[_0x791b('0x44')]=_[_0x791b('0x47')](_0xc12592[_0x791b('0x44')],{'$or':_[_0x791b('0x34')](_0x49555b,function(_0x9c21ce){if(_0x9c21ce[_0x791b('0x37')]!==_0x791b('0x48')){var _0x33bf1c={};_0x33bf1c[_0x9c21ce[_0x791b('0x33')]]={'$like':'%'+_0x195858[_0x791b('0x3a')][_0x791b('0x46')]+'%'};return _0x33bf1c;}})});}_0xc12592=_['merge']({},_0xc12592,_0x195858[_0x791b('0x49')]);var _0x1c1c63={'where':_0xc12592[_0x791b('0x44')]};return db[_0x791b('0x35')][_0x791b('0x26')](_0x1c1c63)[_0x791b('0x2b')](function(_0x20ada3){_0x2fb273[_0x791b('0x26')]=_0x20ada3;if(_0x195858['query'][_0x791b('0x4a')]){_0xc12592['include']=[{'all':!![]}];}return db[_0x791b('0x35')][_0x791b('0x4b')](_0xc12592);})[_0x791b('0x2b')](function(_0x31570d){_0x2fb273[_0x791b('0x4c')]=_0x31570d;return _0x2fb273;})[_0x791b('0x2b')](respondWithFilteredResult(_0x58ecc4,_0xc12592))[_0x791b('0x4d')](handleError(_0x58ecc4,null));};exports['show']=function(_0xe94386,_0x3a3a00){var _0x47307b={'raw':![],'where':{'id':_0xe94386[_0x791b('0x4e')]['id']}},_0x5bf6e4={};_0x5bf6e4[_0x791b('0x39')]=_[_0x791b('0x3b')](db[_0x791b('0x35')]['rawAttributes']);_0x5bf6e4[_0x791b('0x3a')]=_['keys'](_0xe94386[_0x791b('0x3a')]);_0x5bf6e4[_0x791b('0x3c')]=_['intersection'](_0x5bf6e4[_0x791b('0x39')],_0x5bf6e4[_0x791b('0x3a')]);_0x47307b[_0x791b('0x3e')]=_[_0x791b('0x3d')](_0x5bf6e4[_0x791b('0x39')],qs['fields'](_0xe94386['query'][_0x791b('0x3f')]));_0x47307b[_0x791b('0x3e')]=_0x47307b[_0x791b('0x3e')][_0x791b('0x40')]?_0x47307b[_0x791b('0x3e')]:_0x5bf6e4[_0x791b('0x39')];if(_0xe94386[_0x791b('0x3a')][_0x791b('0x4a')]){_0x47307b[_0x791b('0x4f')]=[{'all':!![]}];}_0x47307b=_[_0x791b('0x47')]({},_0x47307b,_0xe94386[_0x791b('0x49')]);return db[_0x791b('0x35')][_0x791b('0x50')](_0x47307b)[_0x791b('0x2b')](handleEntityNotFound(_0x3a3a00,null))[_0x791b('0x2b')](respondWithResult(_0x3a3a00,null))[_0x791b('0x4d')](handleError(_0x3a3a00,null));};exports[_0x791b('0x51')]=function(_0x3023b9,_0x26ee6){return db[_0x791b('0x35')][_0x791b('0x51')](_0x3023b9[_0x791b('0x52')],{})[_0x791b('0x2b')](function(_0x2d1b53){var _0x14892b=_0x3023b9['user']['get']({'plain':!![]});if(!_0x14892b)throw new Error(_0x791b('0x53'));if(_0x14892b['role']==='user'){var _0x1b30eb=_0x2d1b53[_0x791b('0x2d')]({'plain':!![]});var _0x953884=_0x791b('0x2e');return db[_0x791b('0x54')][_0x791b('0x50')]({'where':{'name':_0x953884,'userProfileId':_0x14892b[_0x791b('0x55')]},'raw':!![]})['then'](function(_0x5ed6fd){if(_0x5ed6fd&&_0x5ed6fd[_0x791b('0x56')]===0x0){return db['UserProfileResource'][_0x791b('0x51')]({'name':_0x1b30eb[_0x791b('0x33')],'resourceId':_0x1b30eb['id'],'type':_0x5ed6fd[_0x791b('0x33')],'sectionId':_0x5ed6fd['id']},{})[_0x791b('0x2b')](function(){return _0x2d1b53;});}else{return _0x2d1b53;}})[_0x791b('0x4d')](function(_0xfab115){logger[_0x791b('0x31')](_0x791b('0x57'),_0xfab115);throw _0xfab115;});}return _0x2d1b53;})[_0x791b('0x2b')](respondWithResult(_0x26ee6,0xc9))[_0x791b('0x4d')](handleError(_0x26ee6,null));};exports['update']=function(_0x57257f,_0xfa1fa5){if(_0x57257f[_0x791b('0x52')]['id']){delete _0x57257f['body']['id'];}return db[_0x791b('0x35')][_0x791b('0x50')]({'where':{'id':_0x57257f[_0x791b('0x4e')]['id']}})[_0x791b('0x2b')](handleEntityNotFound(_0xfa1fa5,null))[_0x791b('0x2b')](saveUpdates(_0x57257f[_0x791b('0x52')],null))[_0x791b('0x2b')](respondWithResult(_0xfa1fa5,null))[_0x791b('0x4d')](handleError(_0xfa1fa5,null));};exports[_0x791b('0x2c')]=function(_0x2cdee1,_0x8dd962){return db[_0x791b('0x35')]['find']({'where':{'id':_0x2cdee1['params']['id']}})['then'](handleEntityNotFound(_0x8dd962,null))['then'](removeEntity(_0x8dd962,null))['catch'](handleError(_0x8dd962,null));};exports[_0x791b('0x58')]=function(_0x214735,_0x4766c4){return db[_0x791b('0x35')][_0x791b('0x58')]()[_0x791b('0x2b')](respondWithResult(_0x4766c4,null))[_0x791b('0x4d')](handleError(_0x4766c4,null));};exports[_0x791b('0x59')]=function(_0x3d47a9,_0x323442,_0xb9b3b4){if(_0x3d47a9['body']['id']){delete _0x3d47a9[_0x791b('0x52')]['id'];}return db['CmList'][_0x791b('0x50')]({'where':{'id':_0x3d47a9[_0x791b('0x4e')]['id']}})[_0x791b('0x2b')](handleEntityNotFound(_0x323442,null))[_0x791b('0x2b')](function(_0x4cd340){if(_0x4cd340){_0x3d47a9[_0x791b('0x52')][_0x791b('0x5a')]=_0x4cd340['id'];return db[_0x791b('0x5b')][_0x791b('0x51')](_0x3d47a9[_0x791b('0x52')]);}})['then'](respondWithResult(_0x323442,null))['catch'](handleError(_0x323442,null));};exports[_0x791b('0x5c')]=function(_0x53709d,_0x4098d2,_0x4669ae){var _0x2a2226={'raw':![],'where':{}};var _0x199921={};var _0x28ae23={'count':0x0,'rows':[]};return db[_0x791b('0x35')][_0x791b('0x5d')]({'where':{'id':_0x53709d[_0x791b('0x4e')]['id']}})['then'](handleEntityNotFound(_0x4098d2,null))['then'](function(_0x443aad){if(_0x443aad){_0x199921[_0x791b('0x39')]=_[_0x791b('0x3b')](db[_0x791b('0x5b')][_0x791b('0x36')]);_0x199921[_0x791b('0x3a')]=_['keys'](_0x53709d[_0x791b('0x3a')]);_0x199921[_0x791b('0x3c')]=_[_0x791b('0x3d')](_0x199921['model'],_0x199921[_0x791b('0x3a')]);_0x2a2226[_0x791b('0x3e')]=_[_0x791b('0x3d')](_0x199921[_0x791b('0x39')],qs[_0x791b('0x3f')](_0x53709d[_0x791b('0x3a')]['fields']));_0x2a2226['attributes']=_0x2a2226[_0x791b('0x3e')][_0x791b('0x40')]?_0x2a2226[_0x791b('0x3e')]:_0x199921[_0x791b('0x39')];if(!_0x53709d[_0x791b('0x3a')][_0x791b('0x5e')]('nolimit')){_0x2a2226[_0x791b('0x25')]=qs[_0x791b('0x25')](_0x53709d[_0x791b('0x3a')]['limit']);_0x2a2226[_0x791b('0x23')]=qs[_0x791b('0x23')](_0x53709d[_0x791b('0x3a')]['offset']);}_0x2a2226[_0x791b('0x42')]=qs[_0x791b('0x43')](_0x53709d['query']['sort']);_0x2a2226['where']=qs['filters'](_[_0x791b('0x45')](_0x53709d[_0x791b('0x3a')],_0x199921['filters']));_0x2a2226[_0x791b('0x44')][_0x791b('0x5a')]=_0x443aad['id'];if(_0x53709d[_0x791b('0x3a')][_0x791b('0x46')]){_0x2a2226[_0x791b('0x44')]=_[_0x791b('0x47')](_0x2a2226[_0x791b('0x44')],{'$or':_[_0x791b('0x34')](_0x2a2226[_0x791b('0x3e')],function(_0x432532){var _0x26c37c={};_0x26c37c[_0x432532]={'$like':'%'+_0x53709d[_0x791b('0x3a')]['filter']+'%'};return _0x26c37c;})});}_0x2a2226=_['merge']({},_0x2a2226,_0x53709d[_0x791b('0x49')]);return db[_0x791b('0x5b')]['count']({'where':_0x2a2226[_0x791b('0x44')]})[_0x791b('0x2b')](function(_0x5336b6){_0x28ae23[_0x791b('0x26')]=_0x5336b6;if(_0x53709d['query'][_0x791b('0x4a')]){_0x2a2226[_0x791b('0x4f')]=[{'all':!![]}];}return db['Disposition'][_0x791b('0x4b')](_0x2a2226);})['then'](function(_0x279cf6){_0x28ae23['rows']=_0x279cf6;return _0x28ae23;});}})[_0x791b('0x2b')](respondWithFilteredResult(_0x4098d2,_0x2a2226))[_0x791b('0x4d')](handleError(_0x4098d2,null));};exports[_0x791b('0x5f')]=function(_0x2404e9,_0x49e734,_0x1f44f9){return db[_0x791b('0x35')][_0x791b('0x50')]({'where':{'id':_0x2404e9[_0x791b('0x4e')]['id']}})[_0x791b('0x2b')](handleEntityNotFound(_0x49e734,null))[_0x791b('0x2b')](function(_0x1b33c8){if(_0x1b33c8){return _0x1b33c8[_0x791b('0x5f')](_0x2404e9[_0x791b('0x3a')][_0x791b('0x60')]);}})['then'](respondWithStatusCode(_0x49e734,null))['catch'](handleError(_0x49e734,null));};exports['addContacts']=function(_0xfbb6bd,_0x566eb5,_0x4b0cc5){return db[_0x791b('0x35')][_0x791b('0x50')]({'where':{'id':_0xfbb6bd[_0x791b('0x4e')]['id']}})['then'](handleEntityNotFound(_0x566eb5,null))[_0x791b('0x2b')](function(_0x170f6e){if(_0x170f6e){var _0x1ef27d=[];var _0x420f99={'success':[],'errors':[]};return db[_0x791b('0x61')][_0x791b('0x58')]()[_0x791b('0x2b')](function(_0xc05672){if(_0xfbb6bd[_0x791b('0x52')][_0x791b('0x62')]&&_['isArray'](_0xfbb6bd['body']['tags'])){if(_0xfbb6bd[_0x791b('0x52')][_0x791b('0x62')]['length']){_0xfbb6bd[_0x791b('0x52')][_0x791b('0x62')]=_0xfbb6bd[_0x791b('0x52')][_0x791b('0x62')][_0x791b('0x63')](';')+';';}else{_0xfbb6bd['body'][_0x791b('0x62')]=null;}}else{_0xfbb6bd[_0x791b('0x52')]['tags']=null;}if(_0xfbb6bd['body']&&_[_0x791b('0x64')](_0xfbb6bd[_0x791b('0x52')])){for(var _0x38dbd6=0x0;_0x38dbd6<_0xfbb6bd[_0x791b('0x52')]['length'];_0x38dbd6+=0x1){_0xfbb6bd[_0x791b('0x52')][_0x38dbd6][_0x791b('0x5a')]=_0xfbb6bd[_0x791b('0x4e')]['id'];_0x1ef27d[_0x791b('0x65')](_0xfbb6bd['body'][_0x38dbd6]);}return BPromise[_0x791b('0x66')](_0x1ef27d,function(_0x44f384){return db['CmContact'][_0x791b('0x51')](_[_0x791b('0x67')](_0x44f384,[_0x791b('0x60'),'id'])||{},{'fields':_[_0x791b('0x3b')](_0xc05672),'raw':!![]})[_0x791b('0x2b')](function(_0x3b707d){_0x420f99[_0x791b('0x68')]['push'](_0x3b707d['dataValues']);})[_0x791b('0x4d')](function(_0x39b5be){_0x420f99[_0x791b('0x69')]['push']({'data':_0x44f384,'error':_0x39b5be[_0x791b('0x6a')]});});})[_0x791b('0x2b')](function(_0x1dc102){return _0x420f99;})[_0x791b('0x4d')](function(_0x1c70cc){return _0x1c70cc;});}else{_0x566eb5[_0x791b('0x20')](0x190)['json']({'message':_0x791b('0x6b')});}});}})[_0x791b('0x2b')](respondWithResult(_0x566eb5,null))['catch'](handleError(_0x566eb5,null));};exports[_0x791b('0x6c')]=function(_0x4ec82e,_0xcf41ce,_0xca043b){var _0x2cdc23;return db[_0x791b('0x35')]['find']({'where':{'id':_0x4ec82e[_0x791b('0x4e')]['id']},'include':[{'model':db['CmCustomField'],'as':'CustomFields'}]})[_0x791b('0x2b')](handleEntityNotFound(_0xcf41ce,null))[_0x791b('0x2b')](function(_0x4e3415){if(_0x4e3415){_0x2cdc23=_0x4e3415;return db[_0x791b('0x61')][_0x791b('0x36')];}})[_0x791b('0x2b')](function(_0x5e4331){if(_0x5e4331){var _0x3f7e1d={};var _0x197b20={};_0x197b20[_0x791b('0x39')]=_[_0x791b('0x6d')](_[_0x791b('0x3b')](_0x5e4331),_['map'](_0x2cdc23[_0x791b('0x6e')],function(_0x298632){return util[_0x791b('0x6f')](_0x791b('0x70'),_0x298632['id']);}));_0x197b20['query']=_[_0x791b('0x3b')](_0x4ec82e[_0x791b('0x3a')]);_0x197b20[_0x791b('0x3c')]=_[_0x791b('0x3d')](_0x197b20['model'],_0x197b20['query']);_0x3f7e1d['attributes']=_['intersection'](_0x197b20[_0x791b('0x39')],qs[_0x791b('0x3f')](_0x4ec82e['query'][_0x791b('0x3f')]));_0x3f7e1d[_0x791b('0x3e')]=_0x3f7e1d[_0x791b('0x3e')]['length']?_0x3f7e1d[_0x791b('0x3e')]:_0x197b20['model'];if(!_0x4ec82e['query'][_0x791b('0x5e')](_0x791b('0x41'))){_0x3f7e1d[_0x791b('0x25')]=qs[_0x791b('0x25')](_0x4ec82e[_0x791b('0x3a')]['limit']);_0x3f7e1d[_0x791b('0x23')]=qs[_0x791b('0x23')](_0x4ec82e[_0x791b('0x3a')][_0x791b('0x23')]);}_0x3f7e1d[_0x791b('0x42')]=qs[_0x791b('0x43')](_0x4ec82e[_0x791b('0x3a')][_0x791b('0x43')]);_0x3f7e1d[_0x791b('0x44')]=qs['filters'](_[_0x791b('0x45')](_0x4ec82e[_0x791b('0x3a')],_0x197b20[_0x791b('0x3c')]));_0x3f7e1d[_0x791b('0x71')]=!![];if(_0x4ec82e['query'][_0x791b('0x46')]){_0x3f7e1d[_0x791b('0x44')]=_['merge'](_0x3f7e1d['where'],{'$or':_[_0x791b('0x34')](_0x3f7e1d[_0x791b('0x3e')],function(_0x254fb0){var _0x1bfb78={};_0x1bfb78[_0x254fb0]={'$like':'%'+_0x4ec82e['query'][_0x791b('0x46')]+'%'};return _0x1bfb78;})});}_0x3f7e1d=_[_0x791b('0x47')]({},_0x3f7e1d,_0x4ec82e[_0x791b('0x49')]);return _0x2cdc23['getContacts'](_0x3f7e1d);}})[_0x791b('0x2b')](respondWithResult(_0xcf41ce,null))[_0x791b('0x4d')](handleError(_0xcf41ce,null));};exports[_0x791b('0x72')]=function(_0x252591,_0x1dc6f7,_0x5321c8){var _0x349489;var _0x1739c1;var _0x3de023;var _0xa37a60=_0x252591[_0x791b('0x4e')]['id'];csv_results=[];return db[_0x791b('0x73')][_0x791b('0x4b')]({'attributes':['id','name'],'raw':!![],'order':[_0x791b('0x74')]})[_0x791b('0x2b')](function(_0x1f5f84){_0x349489=_0x1f5f84;var _0xedf09e=_['keys'](db[_0x791b('0x61')][_0x791b('0x36')]);return db['CmCustomField'][_0x791b('0x4b')]({'raw':!![],'attributes':['id',_0x791b('0x75')]})[_0x791b('0x2b')](function(_0x443fd6){_0x1739c1=_0x443fd6;var _0x2817ee=squel[_0x791b('0x76')]()[_0x791b('0x3f')](_0xedf09e)[_0x791b('0x77')](_0x791b('0x78'),'c')[_0x791b('0x44')](_0x791b('0x79'),_0xa37a60)[_0x791b('0x44')](_0x791b('0x7a'))[_0x791b('0x7b')]();for(var _0x2cf3f4=0x0;_0x2cf3f4<_0x1739c1['length'];_0x2cf3f4++){_0x2817ee[_0x791b('0x7c')](_0x791b('0x7d')+_0x1739c1[_0x2cf3f4]['id'],_0x791b('0x7e')+_0x1739c1[_0x2cf3f4]['alias']);}for(var _0x2cf3f4=0x0;_0x2cf3f4<_0x349489[_0x791b('0x40')];_0x2cf3f4++){_0x2817ee[_0x791b('0x7c')](squel[_0x791b('0x76')]()[_0x791b('0x7c')](_0x791b('0x7f'))[_0x791b('0x77')]('cm_contact_has_items')['where'](_0x791b('0x80'),_0x349489[_0x2cf3f4]['id'])[_0x791b('0x44')](_0x791b('0x81')),_0x791b('0x82')+_0x349489[_0x2cf3f4][_0x791b('0x33')]);_0x2817ee[_0x791b('0x7c')](squel[_0x791b('0x76')]()[_0x791b('0x7c')](_0x791b('0x83'))[_0x791b('0x77')](_0x791b('0x84'))[_0x791b('0x44')](_0x791b('0x80'),_0x349489[_0x2cf3f4]['id'])[_0x791b('0x44')](_0x791b('0x81')),_0x791b('0x85')+_0x349489[_0x2cf3f4][_0x791b('0x33')]);}var _0x522de4=[];_0x522de4[_0x791b('0x65')](_0x2817ee['toString']());BPromise['each'](_0x522de4,handleQuery)[_0x791b('0x2b')](function(_0x3431ff){handleQuery(_0x2817ee[_0x791b('0x86')]());var _0x5a3e9a=csv_results[0x0];if(!_[_0x791b('0x87')](_0x5a3e9a)){var _0x1cfacd=toCsv(_0x5a3e9a);var _0x3f8e4b=Date[_0x791b('0x88')]();fs[_0x791b('0x89')](util['format'](_0x791b('0x8a'),_0xa37a60,_0x3f8e4b),_0x1cfacd);_0x1dc6f7[_0x791b('0x8b')](_0x791b('0x8c'),'attachment;\x20filename='+util['format'](_0x791b('0x8d'),_0xa37a60,_0x3f8e4b));_0x1dc6f7[_0x791b('0x8b')]('Content-type',_0x791b('0x8e'));return _0x1dc6f7[_0x791b('0x8f')](util['format'](_0x791b('0x8a'),_0xa37a60,_0x3f8e4b));}else{return _0x1dc6f7[_0x791b('0x30')](0xcc);}});});});};exports[_0x791b('0x90')]=function(_0x49da06,_0x2006fb,_0x13bc0f){var _0x591e3b;delete _0x49da06['body']['id'];return db['CmList'][_0x791b('0x5d')]({'where':{'id':_0x49da06['params']['id']}})[_0x791b('0x2b')](handleEntityNotFound(_0x2006fb,null))[_0x791b('0x2b')](function(_0x23bb0d){if(_0x23bb0d){return db[_0x791b('0x91')][_0x791b('0x92')](function(_0x3a5ce4){return db[_0x791b('0x93')][_0x791b('0x51')](_0x49da06['body'],{'transaction':_0x3a5ce4})['then'](function(_0x15f002){_0x591e3b=_0x15f002;return _0x23bb0d[_0x791b('0x94')](_0x15f002,{'transaction':_0x3a5ce4});})['then'](function(){var _0x240c82={'type':db[_0x791b('0x95')][_0x791b('0x96')],'transaction':_0x3a5ce4};switch(_0x49da06[_0x791b('0x52')]['type']){case'text':_0x240c82[_0x791b('0x37')]=db[_0x791b('0x95')][_0x791b('0x96')];break;case _0x791b('0x97'):_0x240c82[_0x791b('0x37')]=db[_0x791b('0x95')][_0x791b('0x98')];break;case _0x791b('0x99'):_0x240c82[_0x791b('0x37')]=db['Sequelize'][_0x791b('0x9a')];_0x240c82[_0x791b('0x9b')]=![];break;default:}return db['sequelize'][_0x791b('0x9c')][_0x791b('0x9d')](_0x791b('0x78'),util[_0x791b('0x6f')](_0x791b('0x9e'),_0x591e3b['id']),_0x240c82);})[_0x791b('0x2b')](function(){return _0x591e3b;});});}})[_0x791b('0x2b')](respondWithResult(_0x2006fb,null))['catch'](handleError(_0x2006fb,null));};exports[_0x791b('0x9f')]=function(_0x336048,_0x3e7c7c,_0x147e5e){var _0x3d875c={};var _0x39de5d={};var _0x19e648;var _0x4412f6;return db[_0x791b('0x35')][_0x791b('0x5d')]({'where':{'id':_0x336048[_0x791b('0x4e')]['id']}})[_0x791b('0x2b')](handleEntityNotFound(_0x3e7c7c,null))[_0x791b('0x2b')](function(_0x18008b){if(_0x18008b){_0x19e648=_0x18008b;_0x39de5d[_0x791b('0x39')]=_[_0x791b('0x3b')](db[_0x791b('0x93')][_0x791b('0x36')]);_0x39de5d[_0x791b('0x3a')]=_[_0x791b('0x3b')](_0x336048[_0x791b('0x3a')]);_0x39de5d['filters']=_[_0x791b('0x3d')](_0x39de5d[_0x791b('0x39')],_0x39de5d[_0x791b('0x3a')]);_0x3d875c[_0x791b('0x3e')]=_[_0x791b('0x3d')](_0x39de5d[_0x791b('0x39')],qs[_0x791b('0x3f')](_0x336048[_0x791b('0x3a')]['fields']));_0x3d875c[_0x791b('0x3e')]=_0x3d875c[_0x791b('0x3e')][_0x791b('0x40')]?_0x3d875c[_0x791b('0x3e')]:_0x39de5d['model'];_0x3d875c['order']=qs[_0x791b('0x43')](_0x336048[_0x791b('0x3a')][_0x791b('0x43')]);_0x3d875c[_0x791b('0x44')]=qs[_0x791b('0x3c')](_['pick'](_0x336048[_0x791b('0x3a')],_0x39de5d[_0x791b('0x3c')]));_0x3d875c[_0x791b('0x44')]=_[_0x791b('0x47')](_0x3d875c[_0x791b('0x44')],{'$or':[{'ListId':_0x18008b['id']},{'ListId':null}]});if(_0x336048[_0x791b('0x3a')][_0x791b('0x46')]){_0x3d875c[_0x791b('0x44')]=_[_0x791b('0x47')](_0x3d875c[_0x791b('0x44')],{'$or':_[_0x791b('0x34')](_0x3d875c[_0x791b('0x3e')],function(_0x332360){var _0x4f30e1={};_0x4f30e1[_0x332360]={'$like':'%'+_0x336048[_0x791b('0x3a')][_0x791b('0x46')]+'%'};return _0x4f30e1;})});}_0x3d875c=_[_0x791b('0x47')]({},_0x3d875c,_0x336048['options']);return db[_0x791b('0x93')]['findAndCountAll'](_0x3d875c);}})[_0x791b('0x2b')](respondWithResult(_0x3e7c7c,null))[_0x791b('0x4d')](handleError(_0x3e7c7c,null));};exports[_0x791b('0xa0')]=function(_0x31e2cd,_0x56ecfc){return db[_0x791b('0x93')][_0x791b('0xa1')]({'where':{'ListId':null}})[_0x791b('0x2b')](handleEntityNotFound(_0x56ecfc,null))['then'](function(_0x2ba012){return _0x2ba012;})[_0x791b('0x2b')](respondWithResult(_0x56ecfc,null))[_0x791b('0x4d')](handleError(_0x56ecfc,null));};exports['addAgents']=function(_0x32e559,_0x33e171,_0x314663){return db['CmList'][_0x791b('0x50')]({'where':{'id':_0x32e559[_0x791b('0x4e')]['id']}})[_0x791b('0x2b')](handleEntityNotFound(_0x33e171,null))['then'](function(_0x1246e9){if(_0x1246e9){return _0x1246e9['addAgents'](_0x32e559[_0x791b('0x52')][_0x791b('0x60')],_[_0x791b('0x67')](_0x32e559[_0x791b('0x52')],[_0x791b('0x60'),'id'])||{})[_0x791b('0xa2')](function(_0x5b8545){for(var _0x5b9292=0x0;_0x5b9292<_0x32e559[_0x791b('0x52')][_0x791b('0x60')][_0x791b('0x40')];_0x5b9292+=0x1){socket[_0x791b('0xa3')](_0x791b('0xa4'),{'UserId':Number(_0x32e559[_0x791b('0x52')][_0x791b('0x60')][_0x5b9292]),'CmListId':Number(_0x32e559['params']['id'])});}return _0x5b8545;});}})[_0x791b('0x2b')](respondWithResult(_0x33e171,null))[_0x791b('0x4d')](handleError(_0x33e171,null));};exports[_0x791b('0xa5')]=function(_0xb99ec6,_0x1f6c22,_0x586be7){return db[_0x791b('0x35')][_0x791b('0x50')]({'where':{'id':_0xb99ec6[_0x791b('0x4e')]['id']}})[_0x791b('0x2b')](handleEntityNotFound(_0x1f6c22,null))[_0x791b('0x2b')](function(_0x587694){if(_0x587694){return _0x587694['removeAgents'](_0xb99ec6[_0x791b('0x3a')][_0x791b('0x60')])[_0x791b('0x2b')](function(){if(_[_0x791b('0x64')](_0xb99ec6['query'][_0x791b('0x60')])){for(var _0xb82ac8=0x0;_0xb82ac8<_0xb99ec6[_0x791b('0x3a')][_0x791b('0x60')][_0x791b('0x40')];_0xb82ac8+=0x1){socket[_0x791b('0xa3')]('userCmList:remove',{'UserId':Number(_0xb99ec6[_0x791b('0x3a')][_0x791b('0x60')][_0xb82ac8]),'CmListId':Number(_0xb99ec6[_0x791b('0x4e')]['id'])});}}else{socket['emit'](_0x791b('0xa6'),{'UserId':Number(_0xb99ec6[_0x791b('0x3a')][_0x791b('0x60')]),'CmListId':Number(_0xb99ec6[_0x791b('0x4e')]['id'])});}});}})['then'](respondWithStatusCode(_0x1f6c22,null))[_0x791b('0x4d')](handleError(_0x1f6c22,null));};exports[_0x791b('0xa7')]=function(_0x1d8e66,_0x32b7d5,_0x57ca8b){var _0x317155={};var _0x467e6c={};var _0x512e0d;var _0x1556a9;return db[_0x791b('0x35')][_0x791b('0x5d')]({'where':{'id':_0x1d8e66['params']['id']}})[_0x791b('0x2b')](handleEntityNotFound(_0x32b7d5,null))[_0x791b('0x2b')](function(_0x25a8f6){if(_0x25a8f6){_0x512e0d=_0x25a8f6;_0x467e6c[_0x791b('0x39')]=_['keys'](db[_0x791b('0xa8')][_0x791b('0x36')]);_0x467e6c['query']=_['keys'](_0x1d8e66['query']);_0x467e6c[_0x791b('0x3c')]=_[_0x791b('0x3d')](_0x467e6c[_0x791b('0x39')],_0x467e6c[_0x791b('0x3a')]);_0x317155[_0x791b('0x3e')]=_[_0x791b('0x3d')](_0x467e6c[_0x791b('0x39')],qs[_0x791b('0x3f')](_0x1d8e66['query']['fields']));_0x317155[_0x791b('0x3e')]=_0x317155[_0x791b('0x3e')][_0x791b('0x40')]?_0x317155[_0x791b('0x3e')]:_0x467e6c[_0x791b('0x39')];_0x317155[_0x791b('0x42')]=qs[_0x791b('0x43')](_0x1d8e66[_0x791b('0x3a')][_0x791b('0x43')]);_0x317155[_0x791b('0x44')]=qs[_0x791b('0x3c')](_[_0x791b('0x45')](_0x1d8e66[_0x791b('0x3a')],_0x467e6c[_0x791b('0x3c')]));if(_0x1d8e66[_0x791b('0x3a')][_0x791b('0x46')]){_0x317155[_0x791b('0x44')]=_[_0x791b('0x47')](_0x317155[_0x791b('0x44')],{'$or':_['map'](_0x317155[_0x791b('0x3e')],function(_0x344d9a){var _0x5a63a9={};_0x5a63a9[_0x344d9a]={'$like':'%'+_0x1d8e66['query']['filter']+'%'};return _0x5a63a9;})});}_0x317155=_[_0x791b('0x47')]({},_0x317155,_0x1d8e66[_0x791b('0x49')]);return _0x512e0d['getAgents'](_0x317155);}})['then'](function(_0x90d11){if(_0x90d11){_0x1556a9=_0x90d11[_0x791b('0x40')];if(!_0x1d8e66[_0x791b('0x3a')][_0x791b('0x5e')](_0x791b('0x41'))){_0x317155['limit']=qs['limit'](_0x1d8e66[_0x791b('0x3a')]['limit']);_0x317155[_0x791b('0x23')]=qs[_0x791b('0x23')](_0x1d8e66['query'][_0x791b('0x23')]);}return _0x512e0d[_0x791b('0xa7')](_0x317155);}})['then'](function(_0x490671){if(_0x490671){return _0x490671?{'count':_0x1556a9,'rows':_0x490671}:null;}})[_0x791b('0x2b')](respondWithResult(_0x32b7d5,null))['catch'](handleError(_0x32b7d5,null));};function handleQuery(_0x80ac4d){logger['info'](_0x80ac4d);return db[_0x791b('0x91')][_0x791b('0x3a')](_0x80ac4d)['spread'](function(_0x1bfc4b){csv_results[_0x791b('0x65')](_0x1bfc4b);})['catch'](function(_0x2aed7f){logger[_0x791b('0x31')](_0x2aed7f[_0x791b('0x6a')]);});} \ No newline at end of file +var _0x0cc7=['stack','name','send','index','map','CmList','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','limit','order','sort','where','pick','filter','merge','options','includeAll','findAll','rows','show','params','length','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','Lists','UserProfileSection','userProfileId','autoAssociation','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','ListId','getDispositions','findOne','Disposition','hasOwnProperty','removeDispositions','addContacts','CmContact','tags','isArray','join','push','each','omit','ids','errors','message','Malformed\x20request\x20syntax','getContacts','CustomFields','concat','format','cf_%d','nolimit','raw','getContactsCsv','ContactItemType','CmCustomField','alias','select','from','cm_contacts','c.ListId\x20=\x20?','c.deletedAt\x20is\x20null','distinct','field','c.cf_','customField_','item','cm_contact_has_items','CmContactId\x20=\x20c.id','description','toString','isEmpty','now','writeFileSync','/tmp/list_%d_%s.csv','setHeader','Content-disposition','attachment;\x20filename=','list_%d_%s.csv','Content-type','addCustomField','sequelize','transaction','Sequelize','TEXT','number','INTEGER','switch','defaultValue','queryInterface','cf_%s','getCustomFields','findAndCountAll','addAgents','spread','emit','userCmList:save','removeAgents','userCmList:remove','getAgents','User','info','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','redis','defaults','localhost','./cmList.socket','register','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','apply','reject','update','destroy','get','UserProfileResource','then','error'];(function(_0x34bf97,_0xc60f9d){var _0x292719=function(_0x31354e){while(--_0x31354e){_0x34bf97['push'](_0x34bf97['shift']());}};_0x292719(++_0xc60f9d);}(_0x0cc7,0x77));var _0x70cc=function(_0xd09668,_0x1435b2){_0xd09668=_0xd09668-0x0;var _0x68726=_0x0cc7[_0xd09668];return _0x68726;};'use strict';var emlformat=require(_0x70cc('0x0'));var rimraf=require(_0x70cc('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x70cc('0x2'));var rp=require(_0x70cc('0x3'));var moment=require(_0x70cc('0x4'));var BPromise=require(_0x70cc('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x70cc('0x6'));var sox=require(_0x70cc('0x7'));var csv=require(_0x70cc('0x8'));var ejs=require(_0x70cc('0x9'));var fs=require('fs');var fs_extra=require(_0x70cc('0xa'));var _=require(_0x70cc('0xb'));var squel=require('squel');var crypto=require(_0x70cc('0xc'));var jsforce=require(_0x70cc('0xd'));var deskjs=require(_0x70cc('0xe'));var toCsv=require('to-csv');var querystring=require(_0x70cc('0xf'));var Papa=require('papaparse');var Redis=require(_0x70cc('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x70cc('0x11'));var as=require(_0x70cc('0x12'));var hardwareService=require(_0x70cc('0x13'));var logger=require('../../config/logger')(_0x70cc('0x14'));var utils=require(_0x70cc('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x70cc('0x16'));var db=require('../../mysqldb')['db'];var csv_results;config[_0x70cc('0x17')]=_[_0x70cc('0x18')](config[_0x70cc('0x17')],{'host':_0x70cc('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x70cc('0x1a'))[_0x70cc('0x1b')](socket);function respondWithStatusCode(_0x131eda,_0x41a0c5){_0x41a0c5=_0x41a0c5||0xcc;return function(_0x49a111){if(_0x49a111){return _0x131eda[_0x70cc('0x1c')](_0x41a0c5);}return _0x131eda[_0x70cc('0x1d')](_0x41a0c5)[_0x70cc('0x1e')]();};}function respondWithResult(_0x21d153,_0x1d6c00){_0x1d6c00=_0x1d6c00||0xc8;return function(_0x55cb56){if(_0x55cb56){return _0x21d153[_0x70cc('0x1d')](_0x1d6c00)[_0x70cc('0x1f')](_0x55cb56);}};}function respondWithFilteredResult(_0x1e9658,_0x13c467){return function(_0x251ea4){if(_0x251ea4){var _0x2763cd=typeof _0x13c467[_0x70cc('0x20')]==='undefined'&&typeof _0x13c467['limit']===_0x70cc('0x21');var _0x577b21=_0x251ea4[_0x70cc('0x22')];var _0x10a456=_0x2763cd?0x0:_0x13c467[_0x70cc('0x20')];var _0x456c6a=_0x2763cd?_0x251ea4['count']:_0x13c467[_0x70cc('0x20')]+_0x13c467['limit'];var _0x2dcb26;if(_0x456c6a>=_0x577b21){_0x456c6a=_0x577b21;_0x2dcb26=0xc8;}else{_0x2dcb26=0xce;}_0x1e9658[_0x70cc('0x1d')](_0x2dcb26);return _0x1e9658[_0x70cc('0x23')](_0x70cc('0x24'),_0x10a456+'-'+_0x456c6a+'/'+_0x577b21)['json'](_0x251ea4);}return null;};}function patchUpdates(_0x53a1a4){return function(_0x2e7688){try{jsonpatch[_0x70cc('0x25')](_0x2e7688,_0x53a1a4,!![]);}catch(_0x172e42){return BPromise[_0x70cc('0x26')](_0x172e42);}return _0x2e7688['save']();};}function saveUpdates(_0x4674ee,_0x25e82d){return function(_0x1cd1e2){if(_0x1cd1e2){return _0x1cd1e2[_0x70cc('0x27')](_0x4674ee)['then'](function(_0x5eb6fe){return _0x5eb6fe;});}return null;};}function removeEntity(_0xce9728,_0x2e5992){return function(_0x58df78){if(_0x58df78){return _0x58df78[_0x70cc('0x28')]()['then'](function(){var _0x1a7cd1=_0x58df78[_0x70cc('0x29')]({'plain':!![]});var _0x25fba3='Lists';return db[_0x70cc('0x2a')]['destroy']({'where':{'type':_0x25fba3,'resourceId':_0x1a7cd1['id']}})[_0x70cc('0x2b')](function(){return _0x58df78;});})['then'](function(){_0xce9728[_0x70cc('0x1d')](0xcc)[_0x70cc('0x1e')]();});}};}function handleEntityNotFound(_0xf2195b,_0x14e1ec){return function(_0x4bc0cc){if(!_0x4bc0cc){_0xf2195b[_0x70cc('0x1c')](0x194);}return _0x4bc0cc;};}function handleError(_0x3d4cb1,_0xc238b4){_0xc238b4=_0xc238b4||0x1f4;return function(_0x16acf6){logger[_0x70cc('0x2c')](_0x16acf6[_0x70cc('0x2d')]);if(_0x16acf6[_0x70cc('0x2e')]){delete _0x16acf6[_0x70cc('0x2e')];}_0x3d4cb1[_0x70cc('0x1d')](_0xc238b4)[_0x70cc('0x2f')](_0x16acf6);};}exports[_0x70cc('0x30')]=function(_0x1eab05,_0x2316ad){var _0x401b71={},_0x528d3e={},_0x38eefc={'count':0x0,'rows':[]};var _0x3c7645=_[_0x70cc('0x31')](db[_0x70cc('0x32')][_0x70cc('0x33')],function(_0x1bea24){return{'name':_0x1bea24[_0x70cc('0x34')],'type':_0x1bea24[_0x70cc('0x35')][_0x70cc('0x36')]};});_0x528d3e[_0x70cc('0x37')]=_[_0x70cc('0x31')](_0x3c7645,_0x70cc('0x2e'));_0x528d3e[_0x70cc('0x38')]=_[_0x70cc('0x39')](_0x1eab05[_0x70cc('0x38')]);_0x528d3e[_0x70cc('0x3a')]=_[_0x70cc('0x3b')](_0x528d3e[_0x70cc('0x37')],_0x528d3e[_0x70cc('0x38')]);_0x401b71[_0x70cc('0x3c')]=_['intersection'](_0x528d3e['model'],qs[_0x70cc('0x3d')](_0x1eab05[_0x70cc('0x38')]['fields']));_0x401b71[_0x70cc('0x3c')]=_0x401b71[_0x70cc('0x3c')]['length']?_0x401b71[_0x70cc('0x3c')]:_0x528d3e[_0x70cc('0x37')];if(!_0x1eab05['query']['hasOwnProperty']('nolimit')){_0x401b71[_0x70cc('0x3e')]=qs['limit'](_0x1eab05[_0x70cc('0x38')]['limit']);_0x401b71[_0x70cc('0x20')]=qs[_0x70cc('0x20')](_0x1eab05[_0x70cc('0x38')][_0x70cc('0x20')]);}_0x401b71[_0x70cc('0x3f')]=qs[_0x70cc('0x40')](_0x1eab05[_0x70cc('0x38')][_0x70cc('0x40')]);_0x401b71[_0x70cc('0x41')]=qs[_0x70cc('0x3a')](_[_0x70cc('0x42')](_0x1eab05['query'],_0x528d3e[_0x70cc('0x3a')]),_0x3c7645);if(_0x1eab05[_0x70cc('0x38')][_0x70cc('0x43')]){_0x401b71[_0x70cc('0x41')]=_[_0x70cc('0x44')](_0x401b71[_0x70cc('0x41')],{'$or':_['map'](_0x3c7645,function(_0x2f0d8e){if(_0x2f0d8e['type']!=='VIRTUAL'){var _0xd13195={};_0xd13195[_0x2f0d8e[_0x70cc('0x2e')]]={'$like':'%'+_0x1eab05[_0x70cc('0x38')][_0x70cc('0x43')]+'%'};return _0xd13195;}})});}_0x401b71=_[_0x70cc('0x44')]({},_0x401b71,_0x1eab05[_0x70cc('0x45')]);var _0x333a8a={'where':_0x401b71[_0x70cc('0x41')]};return db[_0x70cc('0x32')][_0x70cc('0x22')](_0x333a8a)['then'](function(_0x109be1){_0x38eefc['count']=_0x109be1;if(_0x1eab05[_0x70cc('0x38')][_0x70cc('0x46')]){_0x401b71['include']=[{'all':!![]}];}return db[_0x70cc('0x32')][_0x70cc('0x47')](_0x401b71);})[_0x70cc('0x2b')](function(_0x152e10){_0x38eefc[_0x70cc('0x48')]=_0x152e10;return _0x38eefc;})[_0x70cc('0x2b')](respondWithFilteredResult(_0x2316ad,_0x401b71))['catch'](handleError(_0x2316ad,null));};exports[_0x70cc('0x49')]=function(_0x377f85,_0x2b9661){var _0x179185={'raw':![],'where':{'id':_0x377f85[_0x70cc('0x4a')]['id']}},_0x4cbd0c={};_0x4cbd0c['model']=_['keys'](db[_0x70cc('0x32')][_0x70cc('0x33')]);_0x4cbd0c[_0x70cc('0x38')]=_[_0x70cc('0x39')](_0x377f85[_0x70cc('0x38')]);_0x4cbd0c['filters']=_[_0x70cc('0x3b')](_0x4cbd0c[_0x70cc('0x37')],_0x4cbd0c[_0x70cc('0x38')]);_0x179185[_0x70cc('0x3c')]=_[_0x70cc('0x3b')](_0x4cbd0c[_0x70cc('0x37')],qs[_0x70cc('0x3d')](_0x377f85['query'][_0x70cc('0x3d')]));_0x179185[_0x70cc('0x3c')]=_0x179185['attributes'][_0x70cc('0x4b')]?_0x179185[_0x70cc('0x3c')]:_0x4cbd0c[_0x70cc('0x37')];if(_0x377f85[_0x70cc('0x38')][_0x70cc('0x46')]){_0x179185[_0x70cc('0x4c')]=[{'all':!![]}];}_0x179185=_[_0x70cc('0x44')]({},_0x179185,_0x377f85[_0x70cc('0x45')]);return db['CmList'][_0x70cc('0x4d')](_0x179185)[_0x70cc('0x2b')](handleEntityNotFound(_0x2b9661,null))[_0x70cc('0x2b')](respondWithResult(_0x2b9661,null))['catch'](handleError(_0x2b9661,null));};exports[_0x70cc('0x4e')]=function(_0x1897c0,_0x529af9){return db[_0x70cc('0x32')][_0x70cc('0x4e')](_0x1897c0[_0x70cc('0x4f')],{})['then'](function(_0x4e41a4){var _0x4e1d74=_0x1897c0[_0x70cc('0x50')]['get']({'plain':!![]});if(!_0x4e1d74)throw new Error(_0x70cc('0x51'));if(_0x4e1d74['role']===_0x70cc('0x50')){var _0x51a233=_0x4e41a4[_0x70cc('0x29')]({'plain':!![]});var _0x914305=_0x70cc('0x52');return db[_0x70cc('0x53')]['find']({'where':{'name':_0x914305,'userProfileId':_0x4e1d74[_0x70cc('0x54')]},'raw':!![]})[_0x70cc('0x2b')](function(_0x5d6000){if(_0x5d6000&&_0x5d6000[_0x70cc('0x55')]===0x0){return db[_0x70cc('0x2a')][_0x70cc('0x4e')]({'name':_0x51a233[_0x70cc('0x2e')],'resourceId':_0x51a233['id'],'type':_0x5d6000[_0x70cc('0x2e')],'sectionId':_0x5d6000['id']},{})[_0x70cc('0x2b')](function(){return _0x4e41a4;});}else{return _0x4e41a4;}})[_0x70cc('0x56')](function(_0x4cf8a7){logger['error'](_0x70cc('0x57'),_0x4cf8a7);throw _0x4cf8a7;});}return _0x4e41a4;})['then'](respondWithResult(_0x529af9,0xc9))[_0x70cc('0x56')](handleError(_0x529af9,null));};exports[_0x70cc('0x27')]=function(_0x13f048,_0x1c8648){if(_0x13f048[_0x70cc('0x4f')]['id']){delete _0x13f048[_0x70cc('0x4f')]['id'];}return db[_0x70cc('0x32')][_0x70cc('0x4d')]({'where':{'id':_0x13f048[_0x70cc('0x4a')]['id']}})[_0x70cc('0x2b')](handleEntityNotFound(_0x1c8648,null))[_0x70cc('0x2b')](saveUpdates(_0x13f048[_0x70cc('0x4f')],null))[_0x70cc('0x2b')](respondWithResult(_0x1c8648,null))[_0x70cc('0x56')](handleError(_0x1c8648,null));};exports[_0x70cc('0x28')]=function(_0x1968a7,_0x360eb3){return db[_0x70cc('0x32')][_0x70cc('0x4d')]({'where':{'id':_0x1968a7[_0x70cc('0x4a')]['id']}})[_0x70cc('0x2b')](handleEntityNotFound(_0x360eb3,null))[_0x70cc('0x2b')](removeEntity(_0x360eb3,null))[_0x70cc('0x56')](handleError(_0x360eb3,null));};exports[_0x70cc('0x58')]=function(_0x359257,_0x304063){return db[_0x70cc('0x32')][_0x70cc('0x58')]()[_0x70cc('0x2b')](respondWithResult(_0x304063,null))[_0x70cc('0x56')](handleError(_0x304063,null));};exports[_0x70cc('0x59')]=function(_0x47a681,_0x53598e,_0x5594c5){if(_0x47a681['body']['id']){delete _0x47a681[_0x70cc('0x4f')]['id'];}return db['CmList'][_0x70cc('0x4d')]({'where':{'id':_0x47a681[_0x70cc('0x4a')]['id']}})['then'](handleEntityNotFound(_0x53598e,null))[_0x70cc('0x2b')](function(_0x17cde0){if(_0x17cde0){_0x47a681[_0x70cc('0x4f')][_0x70cc('0x5a')]=_0x17cde0['id'];return db['Disposition']['create'](_0x47a681[_0x70cc('0x4f')]);}})[_0x70cc('0x2b')](respondWithResult(_0x53598e,null))['catch'](handleError(_0x53598e,null));};exports[_0x70cc('0x5b')]=function(_0x1a1040,_0x32cb3d,_0xa89fbb){var _0x4b5bb0={'raw':![],'where':{}};var _0x248037={};var _0x300327={'count':0x0,'rows':[]};return db[_0x70cc('0x32')][_0x70cc('0x5c')]({'where':{'id':_0x1a1040[_0x70cc('0x4a')]['id']}})[_0x70cc('0x2b')](handleEntityNotFound(_0x32cb3d,null))[_0x70cc('0x2b')](function(_0x445441){if(_0x445441){_0x248037[_0x70cc('0x37')]=_[_0x70cc('0x39')](db[_0x70cc('0x5d')][_0x70cc('0x33')]);_0x248037[_0x70cc('0x38')]=_[_0x70cc('0x39')](_0x1a1040[_0x70cc('0x38')]);_0x248037[_0x70cc('0x3a')]=_[_0x70cc('0x3b')](_0x248037[_0x70cc('0x37')],_0x248037['query']);_0x4b5bb0[_0x70cc('0x3c')]=_[_0x70cc('0x3b')](_0x248037['model'],qs[_0x70cc('0x3d')](_0x1a1040[_0x70cc('0x38')][_0x70cc('0x3d')]));_0x4b5bb0[_0x70cc('0x3c')]=_0x4b5bb0[_0x70cc('0x3c')][_0x70cc('0x4b')]?_0x4b5bb0[_0x70cc('0x3c')]:_0x248037['model'];if(!_0x1a1040['query'][_0x70cc('0x5e')]('nolimit')){_0x4b5bb0['limit']=qs['limit'](_0x1a1040[_0x70cc('0x38')][_0x70cc('0x3e')]);_0x4b5bb0[_0x70cc('0x20')]=qs[_0x70cc('0x20')](_0x1a1040[_0x70cc('0x38')][_0x70cc('0x20')]);}_0x4b5bb0['order']=qs[_0x70cc('0x40')](_0x1a1040[_0x70cc('0x38')]['sort']);_0x4b5bb0[_0x70cc('0x41')]=qs[_0x70cc('0x3a')](_[_0x70cc('0x42')](_0x1a1040[_0x70cc('0x38')],_0x248037[_0x70cc('0x3a')]));_0x4b5bb0['where'][_0x70cc('0x5a')]=_0x445441['id'];if(_0x1a1040[_0x70cc('0x38')][_0x70cc('0x43')]){_0x4b5bb0[_0x70cc('0x41')]=_[_0x70cc('0x44')](_0x4b5bb0[_0x70cc('0x41')],{'$or':_[_0x70cc('0x31')](_0x4b5bb0[_0x70cc('0x3c')],function(_0xa6a3a8){var _0x4bdb68={};_0x4bdb68[_0xa6a3a8]={'$like':'%'+_0x1a1040[_0x70cc('0x38')][_0x70cc('0x43')]+'%'};return _0x4bdb68;})});}_0x4b5bb0=_['merge']({},_0x4b5bb0,_0x1a1040['options']);return db[_0x70cc('0x5d')][_0x70cc('0x22')]({'where':_0x4b5bb0[_0x70cc('0x41')]})[_0x70cc('0x2b')](function(_0x2c4c83){_0x300327['count']=_0x2c4c83;if(_0x1a1040[_0x70cc('0x38')][_0x70cc('0x46')]){_0x4b5bb0[_0x70cc('0x4c')]=[{'all':!![]}];}return db[_0x70cc('0x5d')]['findAll'](_0x4b5bb0);})['then'](function(_0x502040){_0x300327[_0x70cc('0x48')]=_0x502040;return _0x300327;});}})[_0x70cc('0x2b')](respondWithFilteredResult(_0x32cb3d,_0x4b5bb0))[_0x70cc('0x56')](handleError(_0x32cb3d,null));};exports['removeDispositions']=function(_0x36088c,_0x289c1b,_0x356cbe){return db[_0x70cc('0x32')][_0x70cc('0x4d')]({'where':{'id':_0x36088c[_0x70cc('0x4a')]['id']}})['then'](handleEntityNotFound(_0x289c1b,null))['then'](function(_0x482653){if(_0x482653){return _0x482653[_0x70cc('0x5f')](_0x36088c[_0x70cc('0x38')]['ids']);}})[_0x70cc('0x2b')](respondWithStatusCode(_0x289c1b,null))[_0x70cc('0x56')](handleError(_0x289c1b,null));};exports[_0x70cc('0x60')]=function(_0x3c5563,_0x326f2a,_0x264d0b){return db[_0x70cc('0x32')][_0x70cc('0x4d')]({'where':{'id':_0x3c5563['params']['id']}})['then'](handleEntityNotFound(_0x326f2a,null))['then'](function(_0x13e384){if(_0x13e384){var _0x5f56f0=[];var _0x2967e1={'success':[],'errors':[]};return db[_0x70cc('0x61')][_0x70cc('0x58')]()['then'](function(_0x39a15d){if(_0x3c5563[_0x70cc('0x4f')][_0x70cc('0x62')]&&_[_0x70cc('0x63')](_0x3c5563['body'][_0x70cc('0x62')])){if(_0x3c5563[_0x70cc('0x4f')]['tags'][_0x70cc('0x4b')]){_0x3c5563['body'][_0x70cc('0x62')]=_0x3c5563[_0x70cc('0x4f')][_0x70cc('0x62')][_0x70cc('0x64')](';')+';';}else{_0x3c5563['body'][_0x70cc('0x62')]=null;}}else{_0x3c5563[_0x70cc('0x4f')][_0x70cc('0x62')]=null;}if(_0x3c5563[_0x70cc('0x4f')]&&_['isArray'](_0x3c5563[_0x70cc('0x4f')])){for(var _0x341c09=0x0;_0x341c09<_0x3c5563[_0x70cc('0x4f')]['length'];_0x341c09+=0x1){_0x3c5563['body'][_0x341c09][_0x70cc('0x5a')]=_0x3c5563[_0x70cc('0x4a')]['id'];_0x5f56f0[_0x70cc('0x65')](_0x3c5563[_0x70cc('0x4f')][_0x341c09]);}return BPromise[_0x70cc('0x66')](_0x5f56f0,function(_0x158942){return db[_0x70cc('0x61')][_0x70cc('0x4e')](_[_0x70cc('0x67')](_0x158942,[_0x70cc('0x68'),'id'])||{},{'fields':_[_0x70cc('0x39')](_0x39a15d),'raw':!![]})[_0x70cc('0x2b')](function(_0x1e66cd){_0x2967e1['success'][_0x70cc('0x65')](_0x1e66cd['dataValues']);})[_0x70cc('0x56')](function(_0x319846){_0x2967e1[_0x70cc('0x69')][_0x70cc('0x65')]({'data':_0x158942,'error':_0x319846[_0x70cc('0x6a')]});});})['then'](function(_0x2e0058){return _0x2967e1;})[_0x70cc('0x56')](function(_0x38dfaa){return _0x38dfaa;});}else{_0x326f2a['status'](0x190)['json']({'message':_0x70cc('0x6b')});}});}})[_0x70cc('0x2b')](respondWithResult(_0x326f2a,null))[_0x70cc('0x56')](handleError(_0x326f2a,null));};exports[_0x70cc('0x6c')]=function(_0x332e36,_0x36acd7,_0x511c23){var _0x3aef96;return db[_0x70cc('0x32')]['find']({'where':{'id':_0x332e36[_0x70cc('0x4a')]['id']},'include':[{'model':db['CmCustomField'],'as':_0x70cc('0x6d')}]})['then'](handleEntityNotFound(_0x36acd7,null))[_0x70cc('0x2b')](function(_0x4ea9ae){if(_0x4ea9ae){_0x3aef96=_0x4ea9ae;return db[_0x70cc('0x61')][_0x70cc('0x33')];}})[_0x70cc('0x2b')](function(_0x4eeac2){if(_0x4eeac2){var _0x568f19={};var _0x5e75ab={};_0x5e75ab['model']=_[_0x70cc('0x6e')](_[_0x70cc('0x39')](_0x4eeac2),_[_0x70cc('0x31')](_0x3aef96[_0x70cc('0x6d')],function(_0x5c9a20){return util[_0x70cc('0x6f')](_0x70cc('0x70'),_0x5c9a20['id']);}));_0x5e75ab['query']=_['keys'](_0x332e36['query']);_0x5e75ab['filters']=_[_0x70cc('0x3b')](_0x5e75ab[_0x70cc('0x37')],_0x5e75ab['query']);_0x568f19[_0x70cc('0x3c')]=_[_0x70cc('0x3b')](_0x5e75ab[_0x70cc('0x37')],qs[_0x70cc('0x3d')](_0x332e36['query'][_0x70cc('0x3d')]));_0x568f19[_0x70cc('0x3c')]=_0x568f19[_0x70cc('0x3c')][_0x70cc('0x4b')]?_0x568f19[_0x70cc('0x3c')]:_0x5e75ab[_0x70cc('0x37')];if(!_0x332e36[_0x70cc('0x38')][_0x70cc('0x5e')](_0x70cc('0x71'))){_0x568f19[_0x70cc('0x3e')]=qs['limit'](_0x332e36[_0x70cc('0x38')][_0x70cc('0x3e')]);_0x568f19['offset']=qs[_0x70cc('0x20')](_0x332e36[_0x70cc('0x38')][_0x70cc('0x20')]);}_0x568f19[_0x70cc('0x3f')]=qs[_0x70cc('0x40')](_0x332e36['query'][_0x70cc('0x40')]);_0x568f19[_0x70cc('0x41')]=qs[_0x70cc('0x3a')](_['pick'](_0x332e36[_0x70cc('0x38')],_0x5e75ab[_0x70cc('0x3a')]));_0x568f19[_0x70cc('0x72')]=!![];if(_0x332e36[_0x70cc('0x38')][_0x70cc('0x43')]){_0x568f19[_0x70cc('0x41')]=_['merge'](_0x568f19[_0x70cc('0x41')],{'$or':_[_0x70cc('0x31')](_0x568f19[_0x70cc('0x3c')],function(_0x484bbd){var _0x3b3bb3={};_0x3b3bb3[_0x484bbd]={'$like':'%'+_0x332e36[_0x70cc('0x38')][_0x70cc('0x43')]+'%'};return _0x3b3bb3;})});}_0x568f19=_[_0x70cc('0x44')]({},_0x568f19,_0x332e36[_0x70cc('0x45')]);return _0x3aef96[_0x70cc('0x6c')](_0x568f19);}})[_0x70cc('0x2b')](respondWithResult(_0x36acd7,null))[_0x70cc('0x56')](handleError(_0x36acd7,null));};exports[_0x70cc('0x73')]=function(_0x431f8d,_0x21b463,_0x1c519f){var _0xd4eaa7;var _0x59ef06;var _0x43ef04;var _0x1eada0=_0x431f8d[_0x70cc('0x4a')]['id'];csv_results=[];return db[_0x70cc('0x74')][_0x70cc('0x47')]({'attributes':['id',_0x70cc('0x2e')],'raw':!![],'order':['OrderBy']})[_0x70cc('0x2b')](function(_0xf11d14){_0xd4eaa7=_0xf11d14;var _0x223664=_[_0x70cc('0x39')](db[_0x70cc('0x61')][_0x70cc('0x33')]);return db[_0x70cc('0x75')][_0x70cc('0x47')]({'raw':!![],'attributes':['id',_0x70cc('0x76')]})[_0x70cc('0x2b')](function(_0x449b21){_0x59ef06=_0x449b21;var _0x5d9bfb=squel[_0x70cc('0x77')]()[_0x70cc('0x3d')](_0x223664)[_0x70cc('0x78')](_0x70cc('0x79'),'c')['where'](_0x70cc('0x7a'),_0x1eada0)[_0x70cc('0x41')](_0x70cc('0x7b'))[_0x70cc('0x7c')]();for(var _0x58c422=0x0;_0x58c422<_0x59ef06['length'];_0x58c422++){_0x5d9bfb[_0x70cc('0x7d')](_0x70cc('0x7e')+_0x59ef06[_0x58c422]['id'],_0x70cc('0x7f')+_0x59ef06[_0x58c422][_0x70cc('0x76')]);}for(var _0x58c422=0x0;_0x58c422<_0xd4eaa7[_0x70cc('0x4b')];_0x58c422++){_0x5d9bfb[_0x70cc('0x7d')](squel['select']()[_0x70cc('0x7d')](_0x70cc('0x80'))[_0x70cc('0x78')](_0x70cc('0x81'))[_0x70cc('0x41')]('ItemTypeId\x20=\x20?',_0xd4eaa7[_0x58c422]['id'])[_0x70cc('0x41')](_0x70cc('0x82')),'additionalPhone_'+_0xd4eaa7[_0x58c422][_0x70cc('0x2e')]);_0x5d9bfb[_0x70cc('0x7d')](squel['select']()[_0x70cc('0x7d')](_0x70cc('0x83'))['from'](_0x70cc('0x81'))['where']('ItemTypeId\x20=\x20?',_0xd4eaa7[_0x58c422]['id'])[_0x70cc('0x41')]('CmContactId\x20=\x20c.id'),'description_additionalPhone_'+_0xd4eaa7[_0x58c422][_0x70cc('0x2e')]);}var _0x1e16f7=[];_0x1e16f7['push'](_0x5d9bfb[_0x70cc('0x84')]());BPromise[_0x70cc('0x66')](_0x1e16f7,handleQuery)[_0x70cc('0x2b')](function(_0x38aecc){handleQuery(_0x5d9bfb['toString']());var _0x5744a4=csv_results[0x0];if(!_[_0x70cc('0x85')](_0x5744a4)){var _0x536c25=toCsv(_0x5744a4);var _0x598d37=Date[_0x70cc('0x86')]();fs[_0x70cc('0x87')](util['format'](_0x70cc('0x88'),_0x1eada0,_0x598d37),_0x536c25);_0x21b463[_0x70cc('0x89')](_0x70cc('0x8a'),_0x70cc('0x8b')+util[_0x70cc('0x6f')](_0x70cc('0x8c'),_0x1eada0,_0x598d37));_0x21b463[_0x70cc('0x89')](_0x70cc('0x8d'),'text/csv');return _0x21b463['download'](util[_0x70cc('0x6f')](_0x70cc('0x88'),_0x1eada0,_0x598d37));}else{return _0x21b463[_0x70cc('0x1c')](0xcc);}});});});};exports[_0x70cc('0x8e')]=function(_0x272c98,_0x1dcd02,_0xdb1ca8){var _0x27901d;delete _0x272c98['body']['id'];return db['CmList'][_0x70cc('0x5c')]({'where':{'id':_0x272c98[_0x70cc('0x4a')]['id']}})[_0x70cc('0x2b')](handleEntityNotFound(_0x1dcd02,null))['then'](function(_0x4cb9fb){if(_0x4cb9fb){return db[_0x70cc('0x8f')][_0x70cc('0x90')](function(_0x3cda0f){return db[_0x70cc('0x75')][_0x70cc('0x4e')](_0x272c98[_0x70cc('0x4f')],{'transaction':_0x3cda0f})[_0x70cc('0x2b')](function(_0x5f3916){_0x27901d=_0x5f3916;return _0x4cb9fb['addCustomFields'](_0x5f3916,{'transaction':_0x3cda0f});})[_0x70cc('0x2b')](function(){var _0x41962d={'type':db[_0x70cc('0x91')][_0x70cc('0x92')],'transaction':_0x3cda0f};switch(_0x272c98[_0x70cc('0x4f')][_0x70cc('0x35')]){case'text':_0x41962d[_0x70cc('0x35')]=db[_0x70cc('0x91')][_0x70cc('0x92')];break;case _0x70cc('0x93'):_0x41962d[_0x70cc('0x35')]=db[_0x70cc('0x91')][_0x70cc('0x94')];break;case _0x70cc('0x95'):_0x41962d[_0x70cc('0x35')]=db[_0x70cc('0x91')]['BOOLEAN'];_0x41962d[_0x70cc('0x96')]=![];break;default:}return db[_0x70cc('0x8f')][_0x70cc('0x97')]['addColumn'](_0x70cc('0x79'),util[_0x70cc('0x6f')](_0x70cc('0x98'),_0x27901d['id']),_0x41962d);})[_0x70cc('0x2b')](function(){return _0x27901d;});});}})[_0x70cc('0x2b')](respondWithResult(_0x1dcd02,null))[_0x70cc('0x56')](handleError(_0x1dcd02,null));};exports[_0x70cc('0x99')]=function(_0x24657b,_0x5c9e1a,_0x1043ac){var _0x2a5d2a={};var _0xad2605={};var _0x3e7160;var _0x482bce;return db['CmList'][_0x70cc('0x5c')]({'where':{'id':_0x24657b['params']['id']}})['then'](handleEntityNotFound(_0x5c9e1a,null))[_0x70cc('0x2b')](function(_0x5d3b29){if(_0x5d3b29){_0x3e7160=_0x5d3b29;_0xad2605[_0x70cc('0x37')]=_[_0x70cc('0x39')](db[_0x70cc('0x75')][_0x70cc('0x33')]);_0xad2605[_0x70cc('0x38')]=_[_0x70cc('0x39')](_0x24657b[_0x70cc('0x38')]);_0xad2605[_0x70cc('0x3a')]=_[_0x70cc('0x3b')](_0xad2605[_0x70cc('0x37')],_0xad2605[_0x70cc('0x38')]);_0x2a5d2a[_0x70cc('0x3c')]=_[_0x70cc('0x3b')](_0xad2605[_0x70cc('0x37')],qs[_0x70cc('0x3d')](_0x24657b[_0x70cc('0x38')][_0x70cc('0x3d')]));_0x2a5d2a[_0x70cc('0x3c')]=_0x2a5d2a[_0x70cc('0x3c')][_0x70cc('0x4b')]?_0x2a5d2a['attributes']:_0xad2605[_0x70cc('0x37')];_0x2a5d2a['order']=qs[_0x70cc('0x40')](_0x24657b['query'][_0x70cc('0x40')]);_0x2a5d2a['where']=qs['filters'](_['pick'](_0x24657b[_0x70cc('0x38')],_0xad2605['filters']));_0x2a5d2a[_0x70cc('0x41')]=_[_0x70cc('0x44')](_0x2a5d2a[_0x70cc('0x41')],{'$or':[{'ListId':_0x5d3b29['id']},{'ListId':null}]});if(_0x24657b[_0x70cc('0x38')][_0x70cc('0x43')]){_0x2a5d2a['where']=_['merge'](_0x2a5d2a['where'],{'$or':_[_0x70cc('0x31')](_0x2a5d2a['attributes'],function(_0x12c429){var _0xbfc14={};_0xbfc14[_0x12c429]={'$like':'%'+_0x24657b[_0x70cc('0x38')]['filter']+'%'};return _0xbfc14;})});}_0x2a5d2a=_[_0x70cc('0x44')]({},_0x2a5d2a,_0x24657b['options']);return db['CmCustomField'][_0x70cc('0x9a')](_0x2a5d2a);}})[_0x70cc('0x2b')](respondWithResult(_0x5c9e1a,null))[_0x70cc('0x56')](handleError(_0x5c9e1a,null));};exports['getGlobalCustomFields']=function(_0x1c7f36,_0x579e07){return db['CmCustomField'][_0x70cc('0x9a')]({'where':{'ListId':null}})[_0x70cc('0x2b')](handleEntityNotFound(_0x579e07,null))['then'](function(_0x45d3e4){return _0x45d3e4;})[_0x70cc('0x2b')](respondWithResult(_0x579e07,null))[_0x70cc('0x56')](handleError(_0x579e07,null));};exports[_0x70cc('0x9b')]=function(_0x3366cd,_0x5e570b,_0x1e36b7){return db[_0x70cc('0x32')][_0x70cc('0x4d')]({'where':{'id':_0x3366cd[_0x70cc('0x4a')]['id']}})[_0x70cc('0x2b')](handleEntityNotFound(_0x5e570b,null))[_0x70cc('0x2b')](function(_0x2efae0){if(_0x2efae0){return _0x2efae0[_0x70cc('0x9b')](_0x3366cd[_0x70cc('0x4f')][_0x70cc('0x68')],_[_0x70cc('0x67')](_0x3366cd[_0x70cc('0x4f')],[_0x70cc('0x68'),'id'])||{})[_0x70cc('0x9c')](function(_0x657a83){for(var _0x3dc094=0x0;_0x3dc094<_0x3366cd['body'][_0x70cc('0x68')][_0x70cc('0x4b')];_0x3dc094+=0x1){socket[_0x70cc('0x9d')](_0x70cc('0x9e'),{'UserId':Number(_0x3366cd[_0x70cc('0x4f')][_0x70cc('0x68')][_0x3dc094]),'CmListId':Number(_0x3366cd[_0x70cc('0x4a')]['id'])});}return _0x657a83;});}})['then'](respondWithResult(_0x5e570b,null))[_0x70cc('0x56')](handleError(_0x5e570b,null));};exports[_0x70cc('0x9f')]=function(_0x4800e0,_0x5674c2,_0x347a89){return db[_0x70cc('0x32')]['find']({'where':{'id':_0x4800e0['params']['id']}})[_0x70cc('0x2b')](handleEntityNotFound(_0x5674c2,null))['then'](function(_0x3bf8c9){if(_0x3bf8c9){return _0x3bf8c9[_0x70cc('0x9f')](_0x4800e0['query'][_0x70cc('0x68')])[_0x70cc('0x2b')](function(){if(_[_0x70cc('0x63')](_0x4800e0[_0x70cc('0x38')][_0x70cc('0x68')])){for(var _0x39acc2=0x0;_0x39acc2<_0x4800e0[_0x70cc('0x38')]['ids'][_0x70cc('0x4b')];_0x39acc2+=0x1){socket['emit'](_0x70cc('0xa0'),{'UserId':Number(_0x4800e0[_0x70cc('0x38')][_0x70cc('0x68')][_0x39acc2]),'CmListId':Number(_0x4800e0[_0x70cc('0x4a')]['id'])});}}else{socket[_0x70cc('0x9d')](_0x70cc('0xa0'),{'UserId':Number(_0x4800e0[_0x70cc('0x38')][_0x70cc('0x68')]),'CmListId':Number(_0x4800e0[_0x70cc('0x4a')]['id'])});}});}})['then'](respondWithStatusCode(_0x5674c2,null))[_0x70cc('0x56')](handleError(_0x5674c2,null));};exports[_0x70cc('0xa1')]=function(_0xa18228,_0x516731,_0xabde91){var _0x43a5b2={};var _0x15c6d2={};var _0xdd81fb;var _0xc64deb;return db[_0x70cc('0x32')][_0x70cc('0x5c')]({'where':{'id':_0xa18228[_0x70cc('0x4a')]['id']}})[_0x70cc('0x2b')](handleEntityNotFound(_0x516731,null))[_0x70cc('0x2b')](function(_0x4be4c4){if(_0x4be4c4){_0xdd81fb=_0x4be4c4;_0x15c6d2[_0x70cc('0x37')]=_[_0x70cc('0x39')](db[_0x70cc('0xa2')][_0x70cc('0x33')]);_0x15c6d2[_0x70cc('0x38')]=_['keys'](_0xa18228[_0x70cc('0x38')]);_0x15c6d2[_0x70cc('0x3a')]=_[_0x70cc('0x3b')](_0x15c6d2[_0x70cc('0x37')],_0x15c6d2[_0x70cc('0x38')]);_0x43a5b2[_0x70cc('0x3c')]=_[_0x70cc('0x3b')](_0x15c6d2['model'],qs[_0x70cc('0x3d')](_0xa18228[_0x70cc('0x38')]['fields']));_0x43a5b2[_0x70cc('0x3c')]=_0x43a5b2[_0x70cc('0x3c')][_0x70cc('0x4b')]?_0x43a5b2[_0x70cc('0x3c')]:_0x15c6d2[_0x70cc('0x37')];_0x43a5b2[_0x70cc('0x3f')]=qs[_0x70cc('0x40')](_0xa18228[_0x70cc('0x38')][_0x70cc('0x40')]);_0x43a5b2[_0x70cc('0x41')]=qs[_0x70cc('0x3a')](_[_0x70cc('0x42')](_0xa18228[_0x70cc('0x38')],_0x15c6d2[_0x70cc('0x3a')]));if(_0xa18228[_0x70cc('0x38')][_0x70cc('0x43')]){_0x43a5b2[_0x70cc('0x41')]=_[_0x70cc('0x44')](_0x43a5b2[_0x70cc('0x41')],{'$or':_[_0x70cc('0x31')](_0x43a5b2[_0x70cc('0x3c')],function(_0x86e28){var _0x35ef3d={};_0x35ef3d[_0x86e28]={'$like':'%'+_0xa18228[_0x70cc('0x38')][_0x70cc('0x43')]+'%'};return _0x35ef3d;})});}_0x43a5b2=_[_0x70cc('0x44')]({},_0x43a5b2,_0xa18228[_0x70cc('0x45')]);return _0xdd81fb[_0x70cc('0xa1')](_0x43a5b2);}})[_0x70cc('0x2b')](function(_0x242795){if(_0x242795){_0xc64deb=_0x242795[_0x70cc('0x4b')];if(!_0xa18228[_0x70cc('0x38')][_0x70cc('0x5e')](_0x70cc('0x71'))){_0x43a5b2[_0x70cc('0x3e')]=qs[_0x70cc('0x3e')](_0xa18228[_0x70cc('0x38')][_0x70cc('0x3e')]);_0x43a5b2['offset']=qs[_0x70cc('0x20')](_0xa18228[_0x70cc('0x38')][_0x70cc('0x20')]);}return _0xdd81fb[_0x70cc('0xa1')](_0x43a5b2);}})[_0x70cc('0x2b')](function(_0x555a2e){if(_0x555a2e){return _0x555a2e?{'count':_0xc64deb,'rows':_0x555a2e}:null;}})[_0x70cc('0x2b')](respondWithResult(_0x516731,null))[_0x70cc('0x56')](handleError(_0x516731,null));};function handleQuery(_0x358090){logger[_0x70cc('0xa3')](_0x358090);return db[_0x70cc('0x8f')][_0x70cc('0x38')](_0x358090)[_0x70cc('0x9c')](function(_0x549934){csv_results[_0x70cc('0x65')](_0x549934);})[_0x70cc('0x56')](function(_0x45f208){logger[_0x70cc('0x2c')](_0x45f208['message']);});} \ No newline at end of file diff --git a/server/api/cmList/cmList.events.js b/server/api/cmList/cmList.events.js index 7f59ee8..3334c74 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 _0x55ca=['events','../../mysqldb','update','remove','emit','hasOwnProperty','hook'];(function(_0x34325b,_0x5e5afe){var _0x3da348=function(_0x3bf709){while(--_0x3bf709){_0x34325b['push'](_0x34325b['shift']());}};_0x3da348(++_0x5e5afe);}(_0x55ca,0x126));var _0xa55c=function(_0xf3e4a0,_0x16a172){_0xf3e4a0=_0xf3e4a0-0x0;var _0x43f1cc=_0x55ca[_0xf3e4a0];return _0x43f1cc;};'use strict';var EventEmitter=require(_0xa55c('0x0'));var CmList=require(_0xa55c('0x1'))['db']['CmList'];var CmListEvents=new EventEmitter();CmListEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xa55c('0x2'),'afterDestroy':_0xa55c('0x3')};function emitEvent(_0x5dc716){return function(_0x3b478a,_0x2db02a,_0xcb02e3){CmListEvents[_0xa55c('0x4')](_0x5dc716+':'+_0x3b478a['id'],_0x3b478a);CmListEvents[_0xa55c('0x4')](_0x5dc716,_0x3b478a);_0xcb02e3(null);};}for(var e in events){if(events[_0xa55c('0x5')](e)){var event=events[e];CmList[_0xa55c('0x6')](e,emitEvent(event));}}module['exports']=CmListEvents; \ No newline at end of file +var _0x9957=['setMaxListeners','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','CmList'];(function(_0x3f4e75,_0x9c9f0e){var _0x6153c=function(_0x4cfcc4){while(--_0x4cfcc4){_0x3f4e75['push'](_0x3f4e75['shift']());}};_0x6153c(++_0x9c9f0e);}(_0x9957,0x93));var _0x7995=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x9957[_0x5ddb1c];return _0x354adc;};'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 9f1964d..fbb0ed9 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 _0xedd9=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./cmList.attributes','exports','CmList','util'];(function(_0x23e8d2,_0x4c2e4a){var _0x5989c6=function(_0xc71bb1){while(--_0xc71bb1){_0x23e8d2['push'](_0x23e8d2['shift']());}};_0x5989c6(++_0x4c2e4a);}(_0xedd9,0xfc));var _0x9edd=function(_0x34388d,_0x2d6443){_0x34388d=_0x34388d-0x0;var _0x5e388c=_0xedd9[_0x34388d];return _0x5e388c;};'use strict';var _=require('lodash');var util=require(_0x9edd('0x0'));var logger=require(_0x9edd('0x1'))(_0x9edd('0x2'));var moment=require(_0x9edd('0x3'));var BPromise=require(_0x9edd('0x4'));var rp=require(_0x9edd('0x5'));var fs=require('fs');var path=require(_0x9edd('0x6'));var rimraf=require(_0x9edd('0x7'));var config=require('../../config/environment');var attributes=require(_0x9edd('0x8'));module[_0x9edd('0x9')]=function(_0x268f9e,_0x34c1a7){return _0x268f9e['define'](_0x9edd('0xa'),attributes,{'tableName':'cm_lists','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2dae=['lodash','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./cmList.attributes','exports','define','CmList','cm_lists'];(function(_0x5c75fd,_0x321838){var _0x44f10d=function(_0x15f690){while(--_0x15f690){_0x5c75fd['push'](_0x5c75fd['shift']());}};_0x44f10d(++_0x321838);}(_0x2dae,0xc3));var _0xe2da=function(_0x28f1de,_0x355054){_0x28f1de=_0x28f1de-0x0;var _0x5b5dad=_0x2dae[_0x28f1de];return _0x5b5dad;};'use strict';var _=require(_0xe2da('0x0'));var util=require('util');var logger=require(_0xe2da('0x1'))(_0xe2da('0x2'));var moment=require(_0xe2da('0x3'));var BPromise=require(_0xe2da('0x4'));var rp=require(_0xe2da('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe2da('0x6'));var config=require(_0xe2da('0x7'));var attributes=require(_0xe2da('0x8'));module[_0xe2da('0x9')]=function(_0x523c60,_0x3e3e25){return _0x523c60[_0xe2da('0xa')](_0xe2da('0xb'),attributes,{'tableName':_0xe2da('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmList/cmList.rpc.js b/server/api/cmList/cmList.rpc.js index c724c8f..e48175c 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 _0xfcd0=['jayson/promise','redis','defaults','localhost','./cmList.socket','register','request','then','CmList,\x20%s,\x20%s','CmList,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x2fc113,_0x45ec6e){var _0x5144ce=function(_0x47fd29){while(--_0x47fd29){_0x2fc113['push'](_0x2fc113['shift']());}};_0x5144ce(++_0x45ec6e);}(_0xfcd0,0x1cb));var _0x0fcd=function(_0x33339b,_0x4130e6){_0x33339b=_0x33339b-0x0;var _0x56659e=_0xfcd0[_0x33339b];return _0x56659e;};'use strict';var _=require('lodash');var util=require(_0x0fcd('0x0'));var moment=require('moment');var BPromise=require(_0x0fcd('0x1'));var rs=require(_0x0fcd('0x2'));var fs=require('fs');var Redis=require(_0x0fcd('0x3'));var db=require(_0x0fcd('0x4'))['db'];var utils=require(_0x0fcd('0x5'));var logger=require(_0x0fcd('0x6'))(_0x0fcd('0x7'));var config=require(_0x0fcd('0x8'));var jayson=require(_0x0fcd('0x9'));var client=jayson['client']['http']({'port':0x232a});config[_0x0fcd('0xa')]=_[_0x0fcd('0xb')](config[_0x0fcd('0xa')],{'host':_0x0fcd('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0fcd('0xa')]));require(_0x0fcd('0xd'))[_0x0fcd('0xe')](socket);function respondWithRpcPromise(_0x804b22,_0x16edc5,_0x1bd37d){return new BPromise(function(_0x16202e,_0x13a3b4){return client[_0x0fcd('0xf')](_0x804b22,_0x1bd37d)[_0x0fcd('0x10')](function(_0x110d9b){logger['info'](_0x0fcd('0x11'),_0x16edc5,'request\x20sent');logger['debug'](_0x0fcd('0x12'),_0x16edc5,_0x0fcd('0x13'),JSON[_0x0fcd('0x14')](_0x110d9b));if(_0x110d9b[_0x0fcd('0x15')]){if(_0x110d9b[_0x0fcd('0x15')][_0x0fcd('0x16')]===0x1f4){logger['error'](_0x0fcd('0x11'),_0x16edc5,_0x110d9b[_0x0fcd('0x15')][_0x0fcd('0x17')]);return _0x13a3b4(_0x110d9b['error'][_0x0fcd('0x17')]);}logger[_0x0fcd('0x15')](_0x0fcd('0x11'),_0x16edc5,_0x110d9b[_0x0fcd('0x15')][_0x0fcd('0x17')]);return _0x16202e(_0x110d9b[_0x0fcd('0x15')][_0x0fcd('0x17')]);}else{logger[_0x0fcd('0x18')]('CmList,\x20%s,\x20%s',_0x16edc5,_0x0fcd('0x13'));_0x16202e(_0x110d9b['result']['message']);}})[_0x0fcd('0x19')](function(_0x42c603){logger[_0x0fcd('0x15')](_0x0fcd('0x11'),_0x16edc5,_0x42c603);_0x13a3b4(_0x42c603);});});} \ No newline at end of file +var _0x69dc=['debug','CmList,\x20%s,\x20%s,\x20%s','stringify','error','CmList,\x20%s,\x20%s','message','request\x20sent','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http','redis','defaults','localhost','socket.io-emitter','register','request','then','info'];(function(_0x21a35d,_0x3e1b90){var _0x4afcb6=function(_0x51d83a){while(--_0x51d83a){_0x21a35d['push'](_0x21a35d['shift']());}};_0x4afcb6(++_0x3e1b90);}(_0x69dc,0xd8));var _0xc69d=function(_0x24e711,_0x1cdef3){_0x24e711=_0x24e711-0x0;var _0x276794=_0x69dc[_0x24e711];return _0x276794;};'use strict';var _=require(_0xc69d('0x0'));var util=require('util');var moment=require(_0xc69d('0x1'));var BPromise=require(_0xc69d('0x2'));var rs=require(_0xc69d('0x3'));var fs=require('fs');var Redis=require(_0xc69d('0x4'));var db=require(_0xc69d('0x5'))['db'];var utils=require(_0xc69d('0x6'));var logger=require(_0xc69d('0x7'))('rpc');var config=require(_0xc69d('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0xc69d('0x9')]({'port':0x232a});config[_0xc69d('0xa')]=_[_0xc69d('0xb')](config[_0xc69d('0xa')],{'host':_0xc69d('0xc'),'port':0x18eb});var socket=require(_0xc69d('0xd'))(new Redis(config['redis']));require('./cmList.socket')[_0xc69d('0xe')](socket);function respondWithRpcPromise(_0x1d3053,_0x1a068d,_0x156afd){return new BPromise(function(_0x212dbb,_0xb0746){return client[_0xc69d('0xf')](_0x1d3053,_0x156afd)[_0xc69d('0x10')](function(_0x5165cd){logger[_0xc69d('0x11')]('CmList,\x20%s,\x20%s',_0x1a068d,'request\x20sent');logger[_0xc69d('0x12')](_0xc69d('0x13'),_0x1a068d,'request\x20sent',JSON[_0xc69d('0x14')](_0x5165cd));if(_0x5165cd[_0xc69d('0x15')]){if(_0x5165cd[_0xc69d('0x15')]['code']===0x1f4){logger[_0xc69d('0x15')](_0xc69d('0x16'),_0x1a068d,_0x5165cd[_0xc69d('0x15')][_0xc69d('0x17')]);return _0xb0746(_0x5165cd[_0xc69d('0x15')][_0xc69d('0x17')]);}logger['error'](_0xc69d('0x16'),_0x1a068d,_0x5165cd[_0xc69d('0x15')][_0xc69d('0x17')]);return _0x212dbb(_0x5165cd[_0xc69d('0x15')][_0xc69d('0x17')]);}else{logger[_0xc69d('0x11')]('CmList,\x20%s,\x20%s',_0x1a068d,_0xc69d('0x18'));_0x212dbb(_0x5165cd['result'][_0xc69d('0x17')]);}})[_0xc69d('0x19')](function(_0x2a29fe){logger[_0xc69d('0x15')]('CmList,\x20%s,\x20%s',_0x1a068d,_0x2a29fe);_0xb0746(_0x2a29fe);});});} \ No newline at end of file diff --git a/server/api/cmList/cmList.socket.js b/server/api/cmList/cmList.socket.js index 74f72f0..901a8c8 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 _0x0d9c=['remove','update','removeListener','register','length','cmList:','./cmList.events','save'];(function(_0x56a885,_0x336fc8){var _0x186606=function(_0x56327f){while(--_0x56327f){_0x56a885['push'](_0x56a885['shift']());}};_0x186606(++_0x336fc8);}(_0x0d9c,0x9e));var _0xc0d9=function(_0x3eff21,_0x5bf36c){_0x3eff21=_0x3eff21-0x0;var _0x1945bb=_0x0d9c[_0x3eff21];return _0x1945bb;};'use strict';var CmListEvents=require(_0xc0d9('0x0'));var events=[_0xc0d9('0x1'),_0xc0d9('0x2'),_0xc0d9('0x3')];function createListener(_0x36e006,_0x19a1a5){return function(_0x5a84be){_0x19a1a5['emit'](_0x36e006,_0x5a84be);};}function removeListener(_0x5eba60,_0x4c2fcd){return function(){CmListEvents[_0xc0d9('0x4')](_0x5eba60,_0x4c2fcd);};}exports[_0xc0d9('0x5')]=function(_0x3a226b){for(var _0x336804=0x0,_0x17cbec=events[_0xc0d9('0x6')];_0x336804<_0x17cbec;_0x336804++){var _0x2f0386=events[_0x336804];var _0x4ebc5c=createListener(_0xc0d9('0x7')+_0x2f0386,_0x3a226b);CmListEvents['on'](_0x2f0386,_0x4ebc5c);}}; \ No newline at end of file +var _0xd5b4=['removeListener','register','length','cmList:','remove','update','emit'];(function(_0x29679c,_0x4c65e9){var _0x27f4b7=function(_0x5a1820){while(--_0x5a1820){_0x29679c['push'](_0x29679c['shift']());}};_0x27f4b7(++_0x4c65e9);}(_0xd5b4,0x193));var _0x4d5b=function(_0x303257,_0x3f8fdf){_0x303257=_0x303257-0x0;var _0x5f28c1=_0xd5b4[_0x303257];return _0x5f28c1;};'use strict';var CmListEvents=require('./cmList.events');var events=['save',_0x4d5b('0x0'),_0x4d5b('0x1')];function createListener(_0x56d125,_0x2d75d9){return function(_0x2eb538){_0x2d75d9[_0x4d5b('0x2')](_0x56d125,_0x2eb538);};}function removeListener(_0x45ff4e,_0x1997fd){return function(){CmListEvents[_0x4d5b('0x3')](_0x45ff4e,_0x1997fd);};}exports[_0x4d5b('0x4')]=function(_0x4db4c6){for(var _0x464820=0x0,_0x41d1d=events[_0x4d5b('0x5')];_0x464820<_0x41d1d;_0x464820++){var _0x5f5d6e=events[_0x464820];var _0x260f08=createListener(_0x4d5b('0x6')+_0x5f5d6e,_0x4db4c6);CmListEvents['on'](_0x5f5d6e,_0x260f08);}}; \ No newline at end of file diff --git a/server/api/cmList/index.js b/server/api/cmList/index.js index e6d5b30..dcef3f2 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 _0x078a=['exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmList.controller','get','isAuthenticated','index','describe','/global_fields','getGlobalCustomFields','/:id','/:id/dispositions','/:id/contacts','getContacts','/:id/contacts/csv','getContactsCsv','/:id/fields','getCustomFields','post','put','update','delete','destroy','removeDispositions','/:id/users'];(function(_0x8d071c,_0x1bfcf3){var _0x26d97a=function(_0x581155){while(--_0x581155){_0x8d071c['push'](_0x8d071c['shift']());}};_0x26d97a(++_0x1bfcf3);}(_0x078a,0x1c1));var _0xa078=function(_0x1df823,_0x2e5839){_0x1df823=_0x1df823-0x0;var _0x5528f2=_0x078a[_0x1df823];return _0x5528f2;};'use strict';var multer=require(_0xa078('0x0'));var util=require(_0xa078('0x1'));var path=require(_0xa078('0x2'));var timeout=require('connect-timeout');var express=require(_0xa078('0x3'));var router=express[_0xa078('0x4')]();var fs_extra=require(_0xa078('0x5'));var auth=require(_0xa078('0x6'));var interaction=require(_0xa078('0x7'));var config=require(_0xa078('0x8'));var controller=require(_0xa078('0x9'));router[_0xa078('0xa')]('/',auth[_0xa078('0xb')](),controller[_0xa078('0xc')]);router[_0xa078('0xa')]('/describe',auth[_0xa078('0xb')](),controller[_0xa078('0xd')]);router[_0xa078('0xa')](_0xa078('0xe'),auth['isAuthenticated'](),controller[_0xa078('0xf')]);router['get'](_0xa078('0x10'),auth[_0xa078('0xb')](),controller['show']);router[_0xa078('0xa')](_0xa078('0x11'),auth['isAuthenticated'](),controller['getDispositions']);router[_0xa078('0xa')](_0xa078('0x12'),auth[_0xa078('0xb')](),controller[_0xa078('0x13')]);router[_0xa078('0xa')](_0xa078('0x14'),auth[_0xa078('0xb')](),controller[_0xa078('0x15')]);router[_0xa078('0xa')](_0xa078('0x16'),auth['isAuthenticated'](),controller[_0xa078('0x17')]);router[_0xa078('0xa')]('/:id/users',auth[_0xa078('0xb')](),controller['getAgents']);router[_0xa078('0x18')]('/',auth['isAuthenticated'](),controller['create']);router[_0xa078('0x18')]('/:id/dispositions',auth[_0xa078('0xb')](),controller['addDisposition']);router['post'](_0xa078('0x12'),auth[_0xa078('0xb')](),controller['addContacts']);router[_0xa078('0x18')](_0xa078('0x16'),auth[_0xa078('0xb')](),controller['addCustomField']);router[_0xa078('0x18')]('/:id/users',auth[_0xa078('0xb')](),controller['addAgents']);router[_0xa078('0x19')]('/:id',auth[_0xa078('0xb')](),controller[_0xa078('0x1a')]);router[_0xa078('0x1b')]('/:id',auth[_0xa078('0xb')](),controller[_0xa078('0x1c')]);router[_0xa078('0x1b')]('/:id/dispositions',auth[_0xa078('0xb')](),controller[_0xa078('0x1d')]);router[_0xa078('0x1b')](_0xa078('0x1e'),auth[_0xa078('0xb')](),controller['removeAgents']);module[_0xa078('0x1f')]=router; \ No newline at end of file +var _0xb541=['/:id/dispositions','getDispositions','/:id/contacts','getContacts','/:id/contacts/csv','getContactsCsv','/:id/fields','getCustomFields','getAgents','post','create','addDisposition','addContacts','addCustomField','/:id/users','addAgents','put','/:id','update','delete','removeDispositions','removeAgents','exports','multer','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmList.controller','isAuthenticated','index','describe','get','/global_fields','getGlobalCustomFields','show'];(function(_0x5ac099,_0x36ff39){var _0x51d1c2=function(_0x24625a){while(--_0x24625a){_0x5ac099['push'](_0x5ac099['shift']());}};_0x51d1c2(++_0x36ff39);}(_0xb541,0x19d));var _0x1b54=function(_0x26e756,_0xfcbd56){_0x26e756=_0x26e756-0x0;var _0x55b6cf=_0xb541[_0x26e756];return _0x55b6cf;};'use strict';var multer=require(_0x1b54('0x0'));var util=require(_0x1b54('0x1'));var path=require(_0x1b54('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x1b54('0x3')]();var fs_extra=require(_0x1b54('0x4'));var auth=require(_0x1b54('0x5'));var interaction=require(_0x1b54('0x6'));var config=require(_0x1b54('0x7'));var controller=require(_0x1b54('0x8'));router['get']('/',auth[_0x1b54('0x9')](),controller[_0x1b54('0xa')]);router['get']('/describe',auth[_0x1b54('0x9')](),controller[_0x1b54('0xb')]);router[_0x1b54('0xc')](_0x1b54('0xd'),auth[_0x1b54('0x9')](),controller[_0x1b54('0xe')]);router[_0x1b54('0xc')]('/:id',auth[_0x1b54('0x9')](),controller[_0x1b54('0xf')]);router[_0x1b54('0xc')](_0x1b54('0x10'),auth[_0x1b54('0x9')](),controller[_0x1b54('0x11')]);router[_0x1b54('0xc')](_0x1b54('0x12'),auth[_0x1b54('0x9')](),controller[_0x1b54('0x13')]);router[_0x1b54('0xc')](_0x1b54('0x14'),auth[_0x1b54('0x9')](),controller[_0x1b54('0x15')]);router[_0x1b54('0xc')](_0x1b54('0x16'),auth[_0x1b54('0x9')](),controller[_0x1b54('0x17')]);router['get']('/:id/users',auth[_0x1b54('0x9')](),controller[_0x1b54('0x18')]);router[_0x1b54('0x19')]('/',auth[_0x1b54('0x9')](),controller[_0x1b54('0x1a')]);router[_0x1b54('0x19')]('/:id/dispositions',auth[_0x1b54('0x9')](),controller[_0x1b54('0x1b')]);router['post'](_0x1b54('0x12'),auth[_0x1b54('0x9')](),controller[_0x1b54('0x1c')]);router['post'](_0x1b54('0x16'),auth[_0x1b54('0x9')](),controller[_0x1b54('0x1d')]);router['post'](_0x1b54('0x1e'),auth[_0x1b54('0x9')](),controller[_0x1b54('0x1f')]);router[_0x1b54('0x20')](_0x1b54('0x21'),auth['isAuthenticated'](),controller[_0x1b54('0x22')]);router[_0x1b54('0x23')](_0x1b54('0x21'),auth[_0x1b54('0x9')](),controller['destroy']);router[_0x1b54('0x23')](_0x1b54('0x10'),auth[_0x1b54('0x9')](),controller[_0x1b54('0x24')]);router[_0x1b54('0x23')](_0x1b54('0x1e'),auth[_0x1b54('0x9')](),controller[_0x1b54('0x25')]);module[_0x1b54('0x26')]=router; \ No newline at end of file diff --git a/server/api/condition/condition.attributes.js b/server/api/condition/condition.attributes.js index 1d4afbd..fea9ab0 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 _0x2042=['VIRTUAL','field','STRING'];(function(_0x323033,_0x5b2ae5){var _0x39bce3=function(_0x3b9596){while(--_0x3b9596){_0x323033['push'](_0x323033['shift']());}};_0x39bce3(++_0x5b2ae5);}(_0x2042,0x1c8));var _0x2204=function(_0x516e78,_0x52d18b){_0x516e78=_0x516e78-0x0;var _0x12d50c=_0x2042[_0x516e78];return _0x12d50c;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x2204('0x0')],'get':function(_0x197ecb){return this['getDataValue'](_0x2204('0x1'));}},'field':{'type':Sequelize[_0x2204('0x2')],'allowNull':![]},'operator':{'type':Sequelize[_0x2204('0x2')],'allowNull':![]},'value':{'type':Sequelize[_0x2204('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0xb7cc=['sequelize','exports','VIRTUAL','getDataValue','field','STRING'];(function(_0x44bff9,_0x2c9721){var _0x48a92b=function(_0x398b65){while(--_0x398b65){_0x44bff9['push'](_0x44bff9['shift']());}};_0x48a92b(++_0x2c9721);}(_0xb7cc,0x1da));var _0xcb7c=function(_0x20ef64,_0x4a8fe9){_0x20ef64=_0x20ef64-0x0;var _0x3707d8=_0xb7cc[_0x20ef64];return _0x3707d8;};'use strict';var Sequelize=require(_0xcb7c('0x0'));module[_0xcb7c('0x1')]={'name':{'type':Sequelize[_0xcb7c('0x2')],'get':function(_0x17e098){return this[_0xcb7c('0x3')](_0xcb7c('0x4'));}},'field':{'type':Sequelize[_0xcb7c('0x5')],'allowNull':![]},'operator':{'type':Sequelize[_0xcb7c('0x5')],'allowNull':![]},'value':{'type':Sequelize[_0xcb7c('0x5')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/condition/condition.controller.js b/server/api/condition/condition.controller.js index dda7efa..eb9e246 100644 --- a/server/api/condition/condition.controller.js +++ b/server/api/condition/condition.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','reject','save','then','destroy','error','name','send','update','body','Condition','find','catch','params'];(function(_0x822270,_0x34f87b){var _0x2aa7cd=function(_0x2545ed){while(--_0x2545ed){_0x822270['push'](_0x822270['shift']());}};_0x2aa7cd(++_0x34f87b);}(_0x9957,0x93));var _0x7995=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x9957[_0x3947c9];return _0x2e7871;};'use strict';var emlformat=require(_0x7995('0x0'));var rimraf=require(_0x7995('0x1'));var zipdir=require(_0x7995('0x2'));var jsonpatch=require(_0x7995('0x3'));var rp=require('request-promise');var moment=require(_0x7995('0x4'));var BPromise=require(_0x7995('0x5'));var Mustache=require(_0x7995('0x6'));var util=require(_0x7995('0x7'));var path=require('path');var sox=require(_0x7995('0x8'));var csv=require(_0x7995('0x9'));var ejs=require(_0x7995('0xa'));var fs=require('fs');var fs_extra=require(_0x7995('0xb'));var _=require(_0x7995('0xc'));var squel=require(_0x7995('0xd'));var crypto=require('crypto');var jsforce=require(_0x7995('0xe'));var deskjs=require(_0x7995('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7995('0x10'));var Papa=require(_0x7995('0x11'));var Redis=require(_0x7995('0x12'));var authService=require(_0x7995('0x13'));var qs=require(_0x7995('0x14'));var as=require(_0x7995('0x15'));var hardwareService=require(_0x7995('0x16'));var logger=require('../../config/logger')(_0x7995('0x17'));var utils=require(_0x7995('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x7995('0x19'));var db=require(_0x7995('0x1a'))['db'];function respondWithStatusCode(_0x19a27e,_0x385f00){_0x385f00=_0x385f00||0xcc;return function(_0x281576){if(_0x281576){return _0x19a27e[_0x7995('0x1b')](_0x385f00);}return _0x19a27e[_0x7995('0x1c')](_0x385f00)['end']();};}function respondWithResult(_0x58f5ad,_0x2b4e94){_0x2b4e94=_0x2b4e94||0xc8;return function(_0x2233dd){if(_0x2233dd){return _0x58f5ad[_0x7995('0x1c')](_0x2b4e94)[_0x7995('0x1d')](_0x2233dd);}};}function respondWithFilteredResult(_0x3f1d3e,_0x1a5310){return function(_0x2202ce){if(_0x2202ce){var _0x41cbf0=typeof _0x1a5310['offset']===_0x7995('0x1e')&&typeof _0x1a5310['limit']===_0x7995('0x1e');var _0x37f297=_0x2202ce[_0x7995('0x1f')];var _0x291317=_0x41cbf0?0x0:_0x1a5310[_0x7995('0x20')];var _0x37a7d4=_0x41cbf0?_0x2202ce['count']:_0x1a5310['offset']+_0x1a5310[_0x7995('0x21')];var _0x5e6f90;if(_0x37a7d4>=_0x37f297){_0x37a7d4=_0x37f297;_0x5e6f90=0xc8;}else{_0x5e6f90=0xce;}_0x3f1d3e['status'](_0x5e6f90);return _0x3f1d3e[_0x7995('0x22')](_0x7995('0x23'),_0x291317+'-'+_0x37a7d4+'/'+_0x37f297)['json'](_0x2202ce);}return null;};}function patchUpdates(_0x3a9b54){return function(_0x51f276){try{jsonpatch['apply'](_0x51f276,_0x3a9b54,!![]);}catch(_0x3e4c54){return BPromise[_0x7995('0x24')](_0x3e4c54);}return _0x51f276[_0x7995('0x25')]();};}function saveUpdates(_0x1a8568,_0x460924){return function(_0x1c278a){if(_0x1c278a){return _0x1c278a['update'](_0x1a8568)[_0x7995('0x26')](function(_0x46ee4b){return _0x46ee4b;});}return null;};}function removeEntity(_0x204507,_0x285437){return function(_0x563799){if(_0x563799){return _0x563799[_0x7995('0x27')]()[_0x7995('0x26')](function(){_0x204507[_0x7995('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x39df42,_0x34e70c){return function(_0x401dc3){if(!_0x401dc3){_0x39df42[_0x7995('0x1b')](0x194);}return _0x401dc3;};}function handleError(_0x3a3fcf,_0x2a307e){_0x2a307e=_0x2a307e||0x1f4;return function(_0x56691a){logger[_0x7995('0x28')](_0x56691a['stack']);if(_0x56691a[_0x7995('0x29')]){delete _0x56691a[_0x7995('0x29')];}_0x3a3fcf[_0x7995('0x1c')](_0x2a307e)[_0x7995('0x2a')](_0x56691a);};}exports[_0x7995('0x2b')]=function(_0x4b6f99,_0x9b2a15){if(_0x4b6f99['body']['id']){delete _0x4b6f99[_0x7995('0x2c')]['id'];}return db[_0x7995('0x2d')][_0x7995('0x2e')]({'where':{'id':_0x4b6f99['params']['id']}})['then'](handleEntityNotFound(_0x9b2a15,null))['then'](saveUpdates(_0x4b6f99[_0x7995('0x2c')],null))[_0x7995('0x26')](respondWithResult(_0x9b2a15,null))[_0x7995('0x2f')](handleError(_0x9b2a15,null));};exports[_0x7995('0x27')]=function(_0x2e3493,_0x1ca460){return db['Condition']['find']({'where':{'id':_0x2e3493[_0x7995('0x30')]['id']}})['then'](handleEntityNotFound(_0x1ca460,null))[_0x7995('0x26')](removeEntity(_0x1ca460,null))[_0x7995('0x2f')](handleError(_0x1ca460,null));}; \ No newline at end of file +var _0x9957=['eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','reject','save','then','destroy','error','name','send','update','body','Condition','find','catch','params'];(function(_0x1ec8ae,_0x19e89f){var _0x1a25b1=function(_0x10907f){while(--_0x10907f){_0x1ec8ae['push'](_0x1ec8ae['shift']());}};_0x1a25b1(++_0x19e89f);}(_0x9957,0x93));var _0x7995=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x9957[_0xbca1b1];return _0x4e1686;};'use strict';var emlformat=require(_0x7995('0x0'));var rimraf=require(_0x7995('0x1'));var zipdir=require(_0x7995('0x2'));var jsonpatch=require(_0x7995('0x3'));var rp=require('request-promise');var moment=require(_0x7995('0x4'));var BPromise=require(_0x7995('0x5'));var Mustache=require(_0x7995('0x6'));var util=require(_0x7995('0x7'));var path=require('path');var sox=require(_0x7995('0x8'));var csv=require(_0x7995('0x9'));var ejs=require(_0x7995('0xa'));var fs=require('fs');var fs_extra=require(_0x7995('0xb'));var _=require(_0x7995('0xc'));var squel=require(_0x7995('0xd'));var crypto=require('crypto');var jsforce=require(_0x7995('0xe'));var deskjs=require(_0x7995('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7995('0x10'));var Papa=require(_0x7995('0x11'));var Redis=require(_0x7995('0x12'));var authService=require(_0x7995('0x13'));var qs=require(_0x7995('0x14'));var as=require(_0x7995('0x15'));var hardwareService=require(_0x7995('0x16'));var logger=require('../../config/logger')(_0x7995('0x17'));var utils=require(_0x7995('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x7995('0x19'));var db=require(_0x7995('0x1a'))['db'];function respondWithStatusCode(_0x19a27e,_0x385f00){_0x385f00=_0x385f00||0xcc;return function(_0x281576){if(_0x281576){return _0x19a27e[_0x7995('0x1b')](_0x385f00);}return _0x19a27e[_0x7995('0x1c')](_0x385f00)['end']();};}function respondWithResult(_0x58f5ad,_0x2b4e94){_0x2b4e94=_0x2b4e94||0xc8;return function(_0x2233dd){if(_0x2233dd){return _0x58f5ad[_0x7995('0x1c')](_0x2b4e94)[_0x7995('0x1d')](_0x2233dd);}};}function respondWithFilteredResult(_0x3f1d3e,_0x1a5310){return function(_0x2202ce){if(_0x2202ce){var _0x41cbf0=typeof _0x1a5310['offset']===_0x7995('0x1e')&&typeof _0x1a5310['limit']===_0x7995('0x1e');var _0x37f297=_0x2202ce[_0x7995('0x1f')];var _0x291317=_0x41cbf0?0x0:_0x1a5310[_0x7995('0x20')];var _0x37a7d4=_0x41cbf0?_0x2202ce['count']:_0x1a5310['offset']+_0x1a5310[_0x7995('0x21')];var _0x5e6f90;if(_0x37a7d4>=_0x37f297){_0x37a7d4=_0x37f297;_0x5e6f90=0xc8;}else{_0x5e6f90=0xce;}_0x3f1d3e['status'](_0x5e6f90);return _0x3f1d3e[_0x7995('0x22')](_0x7995('0x23'),_0x291317+'-'+_0x37a7d4+'/'+_0x37f297)['json'](_0x2202ce);}return null;};}function patchUpdates(_0x3a9b54){return function(_0x51f276){try{jsonpatch['apply'](_0x51f276,_0x3a9b54,!![]);}catch(_0x3e4c54){return BPromise[_0x7995('0x24')](_0x3e4c54);}return _0x51f276[_0x7995('0x25')]();};}function saveUpdates(_0x1a8568,_0x460924){return function(_0x1c278a){if(_0x1c278a){return _0x1c278a['update'](_0x1a8568)[_0x7995('0x26')](function(_0x46ee4b){return _0x46ee4b;});}return null;};}function removeEntity(_0x204507,_0x285437){return function(_0x563799){if(_0x563799){return _0x563799[_0x7995('0x27')]()[_0x7995('0x26')](function(){_0x204507[_0x7995('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x39df42,_0x34e70c){return function(_0x401dc3){if(!_0x401dc3){_0x39df42[_0x7995('0x1b')](0x194);}return _0x401dc3;};}function handleError(_0x3a3fcf,_0x2a307e){_0x2a307e=_0x2a307e||0x1f4;return function(_0x56691a){logger[_0x7995('0x28')](_0x56691a['stack']);if(_0x56691a[_0x7995('0x29')]){delete _0x56691a[_0x7995('0x29')];}_0x3a3fcf[_0x7995('0x1c')](_0x2a307e)[_0x7995('0x2a')](_0x56691a);};}exports[_0x7995('0x2b')]=function(_0x4b6f99,_0x9b2a15){if(_0x4b6f99['body']['id']){delete _0x4b6f99[_0x7995('0x2c')]['id'];}return db[_0x7995('0x2d')][_0x7995('0x2e')]({'where':{'id':_0x4b6f99['params']['id']}})['then'](handleEntityNotFound(_0x9b2a15,null))['then'](saveUpdates(_0x4b6f99[_0x7995('0x2c')],null))[_0x7995('0x26')](respondWithResult(_0x9b2a15,null))[_0x7995('0x2f')](handleError(_0x9b2a15,null));};exports[_0x7995('0x27')]=function(_0x2e3493,_0x1ca460){return db['Condition']['find']({'where':{'id':_0x2e3493[_0x7995('0x30')]['id']}})['then'](handleEntityNotFound(_0x1ca460,null))[_0x7995('0x26')](removeEntity(_0x1ca460,null))[_0x7995('0x2f')](handleError(_0x1ca460,null));}; \ No newline at end of file diff --git a/server/api/condition/condition.model.js b/server/api/condition/condition.model.js index 1cf6d5e..3b461e2 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 _0x0876=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x556afd,_0x26c2c3){var _0x708f4c=function(_0x3d3205){while(--_0x3d3205){_0x556afd['push'](_0x556afd['shift']());}};_0x708f4c(++_0x26c2c3);}(_0x0876,0xaa));var _0x6087=function(_0x1006fa,_0x306e9a){_0x1006fa=_0x1006fa-0x0;var _0x14d256=_0x0876[_0x1006fa];return _0x14d256;};'use strict';var _=require(_0x6087('0x0'));var util=require(_0x6087('0x1'));var logger=require(_0x6087('0x2'))(_0x6087('0x3'));var moment=require(_0x6087('0x4'));var BPromise=require(_0x6087('0x5'));var rp=require(_0x6087('0x6'));var fs=require('fs');var path=require(_0x6087('0x7'));var rimraf=require(_0x6087('0x8'));var config=require(_0x6087('0x9'));var attributes=require('./condition.attributes');module['exports']=function(_0xd88460,_0x3f9b37){return _0xd88460['define']('Condition',attributes,{'tableName':'tools_conditions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8071=['../../config/logger','moment','bluebird','request-promise','path','../../config/environment','./condition.attributes','exports','define','Condition','tools_conditions','lodash','util'];(function(_0x4e3594,_0x21bfa9){var _0x4fd0bf=function(_0x1c4a73){while(--_0x1c4a73){_0x4e3594['push'](_0x4e3594['shift']());}};_0x4fd0bf(++_0x21bfa9);}(_0x8071,0xf5));var _0x1807=function(_0x50a845,_0x1d43f9){_0x50a845=_0x50a845-0x0;var _0x4e5731=_0x8071[_0x50a845];return _0x4e5731;};'use strict';var _=require(_0x1807('0x0'));var util=require(_0x1807('0x1'));var logger=require(_0x1807('0x2'))('api');var moment=require(_0x1807('0x3'));var BPromise=require(_0x1807('0x4'));var rp=require(_0x1807('0x5'));var fs=require('fs');var path=require(_0x1807('0x6'));var rimraf=require('rimraf');var config=require(_0x1807('0x7'));var attributes=require(_0x1807('0x8'));module[_0x1807('0x9')]=function(_0x2a1775,_0x1b14d7){return _0x2a1775[_0x1807('0xa')](_0x1807('0xb'),attributes,{'tableName':_0x1807('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/condition/condition.rpc.js b/server/api/condition/condition.rpc.js index b87beaf..df24ea2 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 _0x150e=['http','request','info','Condition,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise'];(function(_0x2573f7,_0x1200bc){var _0x57740d=function(_0x4ecf47){while(--_0x4ecf47){_0x2573f7['push'](_0x2573f7['shift']());}};_0x57740d(++_0x1200bc);}(_0x150e,0x97));var _0xe150=function(_0xe6e557,_0x4f724b){_0xe6e557=_0xe6e557-0x0;var _0x15f8a1=_0x150e[_0xe6e557];return _0x15f8a1;};'use strict';var _=require('lodash');var util=require(_0xe150('0x0'));var moment=require(_0xe150('0x1'));var BPromise=require(_0xe150('0x2'));var rs=require(_0xe150('0x3'));var fs=require('fs');var Redis=require(_0xe150('0x4'));var db=require(_0xe150('0x5'))['db'];var utils=require(_0xe150('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0xe150('0x7'));var jayson=require(_0xe150('0x8'));var client=jayson['client'][_0xe150('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x285e6,_0x347491,_0x13e6a9){return new BPromise(function(_0x113bb5,_0x4ede04){return client[_0xe150('0xa')](_0x285e6,_0x13e6a9)['then'](function(_0x5aa3b0){logger[_0xe150('0xb')](_0xe150('0xc'),_0x347491,_0xe150('0xd'));logger[_0xe150('0xe')]('Condition,\x20%s,\x20%s,\x20%s',_0x347491,_0xe150('0xd'),JSON[_0xe150('0xf')](_0x5aa3b0));if(_0x5aa3b0['error']){if(_0x5aa3b0[_0xe150('0x10')]['code']===0x1f4){logger[_0xe150('0x10')](_0xe150('0xc'),_0x347491,_0x5aa3b0['error'][_0xe150('0x11')]);return _0x4ede04(_0x5aa3b0[_0xe150('0x10')][_0xe150('0x11')]);}logger[_0xe150('0x10')]('Condition,\x20%s,\x20%s',_0x347491,_0x5aa3b0[_0xe150('0x10')]['message']);return _0x113bb5(_0x5aa3b0[_0xe150('0x10')][_0xe150('0x11')]);}else{logger[_0xe150('0xb')](_0xe150('0xc'),_0x347491,_0xe150('0xd'));_0x113bb5(_0x5aa3b0[_0xe150('0x12')][_0xe150('0x11')]);}})[_0xe150('0x13')](function(_0x2f2fe1){logger['error'](_0xe150('0xc'),_0x347491,_0x2f2fe1);_0x4ede04(_0x2f2fe1);});});} \ No newline at end of file +var _0x4dfa=['../../config/logger','../../config/environment','jayson/promise','http','request','request\x20sent','debug','error','Condition,\x20%s,\x20%s','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb'];(function(_0x181360,_0x3561a4){var _0x8dc0be=function(_0x3588a2){while(--_0x3588a2){_0x181360['push'](_0x181360['shift']());}};_0x8dc0be(++_0x3561a4);}(_0x4dfa,0x8a));var _0xa4df=function(_0x13d07a,_0x41efc3){_0x13d07a=_0x13d07a-0x0;var _0x5ee0ee=_0x4dfa[_0x13d07a];return _0x5ee0ee;};'use strict';var _=require(_0xa4df('0x0'));var util=require(_0xa4df('0x1'));var moment=require(_0xa4df('0x2'));var BPromise=require('bluebird');var rs=require(_0xa4df('0x3'));var fs=require('fs');var Redis=require(_0xa4df('0x4'));var db=require(_0xa4df('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xa4df('0x6'))('rpc');var config=require(_0xa4df('0x7'));var jayson=require(_0xa4df('0x8'));var client=jayson['client'][_0xa4df('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x14b8d3,_0x1c4c1e,_0x56d0e6){return new BPromise(function(_0x53e9e8,_0x4701eb){return client[_0xa4df('0xa')](_0x14b8d3,_0x56d0e6)['then'](function(_0x2a1b6a){logger['info']('Condition,\x20%s,\x20%s',_0x1c4c1e,_0xa4df('0xb'));logger[_0xa4df('0xc')]('Condition,\x20%s,\x20%s,\x20%s',_0x1c4c1e,'request\x20sent',JSON['stringify'](_0x2a1b6a));if(_0x2a1b6a[_0xa4df('0xd')]){if(_0x2a1b6a[_0xa4df('0xd')]['code']===0x1f4){logger[_0xa4df('0xd')](_0xa4df('0xe'),_0x1c4c1e,_0x2a1b6a[_0xa4df('0xd')][_0xa4df('0xf')]);return _0x4701eb(_0x2a1b6a['error'][_0xa4df('0xf')]);}logger['error']('Condition,\x20%s,\x20%s',_0x1c4c1e,_0x2a1b6a[_0xa4df('0xd')][_0xa4df('0xf')]);return _0x53e9e8(_0x2a1b6a['error'][_0xa4df('0xf')]);}else{logger['info']('Condition,\x20%s,\x20%s',_0x1c4c1e,'request\x20sent');_0x53e9e8(_0x2a1b6a[_0xa4df('0x10')]['message']);}})[_0xa4df('0x11')](function(_0x117fcd){logger[_0xa4df('0xd')](_0xa4df('0xe'),_0x1c4c1e,_0x117fcd);_0x4701eb(_0x117fcd);});});} \ No newline at end of file diff --git a/server/api/condition/index.js b/server/api/condition/index.js index dfcfe59..1bafa55 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 _0x884d=['destroy','exports','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./condition.controller','put','/:id','isAuthenticated','update'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x884d,0xb6));var _0xd884=function(_0x4fea5b,_0x53ede5){_0x4fea5b=_0x4fea5b-0x0;var _0x280d20=_0x884d[_0x4fea5b];return _0x280d20;};'use strict';var multer=require(_0xd884('0x0'));var util=require('util');var path=require(_0xd884('0x1'));var timeout=require('connect-timeout');var express=require(_0xd884('0x2'));var router=express[_0xd884('0x3')]();var fs_extra=require(_0xd884('0x4'));var auth=require(_0xd884('0x5'));var interaction=require(_0xd884('0x6'));var config=require(_0xd884('0x7'));var controller=require(_0xd884('0x8'));router[_0xd884('0x9')](_0xd884('0xa'),auth[_0xd884('0xb')](),controller[_0xd884('0xc')]);router['delete']('/:id',auth[_0xd884('0xb')](),controller[_0xd884('0xd')]);module[_0xd884('0xe')]=router; \ No newline at end of file +var _0x78e3=['update','delete','exports','multer','util','path','fs-extra','../../components/auth/service','../../components/interaction/service','./condition.controller','put','/:id','isAuthenticated'];(function(_0x385a54,_0x101576){var _0x3c6faa=function(_0x5cf441){while(--_0x5cf441){_0x385a54['push'](_0x385a54['shift']());}};_0x3c6faa(++_0x101576);}(_0x78e3,0x1ca));var _0x378e=function(_0x304325,_0x659883){_0x304325=_0x304325-0x0;var _0x253be4=_0x78e3[_0x304325];return _0x253be4;};'use strict';var multer=require(_0x378e('0x0'));var util=require(_0x378e('0x1'));var path=require(_0x378e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x378e('0x3'));var auth=require(_0x378e('0x4'));var interaction=require(_0x378e('0x5'));var config=require('../../config/environment');var controller=require(_0x378e('0x6'));router[_0x378e('0x7')](_0x378e('0x8'),auth[_0x378e('0x9')](),controller[_0x378e('0xa')]);router[_0x378e('0xb')]('/:id',auth[_0x378e('0x9')](),controller['destroy']);module[_0x378e('0xc')]=router; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.attributes.js b/server/api/contactItemType/contactItemType.attributes.js index 35091ae..8654d18 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 _0xd95a=['name','INTEGER','sequelize','exports','STRING'];(function(_0x5cc8b9,_0x20e3c3){var _0x58892e=function(_0x87457a){while(--_0x87457a){_0x5cc8b9['push'](_0x5cc8b9['shift']());}};_0x58892e(++_0x20e3c3);}(_0xd95a,0x13d));var _0xad95=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xd95a[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require(_0xad95('0x0'));module[_0xad95('0x1')]={'name':{'type':Sequelize[_0xad95('0x2')],'allowNull':![],'unique':_0xad95('0x3')},'OrderBy':{'type':Sequelize[_0xad95('0x4')],'allowNull':!![]},'rgbBackgroundColor':{'type':Sequelize['STRING'],'allowNull':!![]}}; \ No newline at end of file +var _0x50e1=['exports','STRING','name','INTEGER','sequelize'];(function(_0x4792c8,_0x5158a1){var _0x35edb1=function(_0x2472d3){while(--_0x2472d3){_0x4792c8['push'](_0x4792c8['shift']());}};_0x35edb1(++_0x5158a1);}(_0x50e1,0xe0));var _0x150e=function(_0x3ecd93,_0x58c5d5){_0x3ecd93=_0x3ecd93-0x0;var _0x1b9154=_0x50e1[_0x3ecd93];return _0x1b9154;};'use strict';var Sequelize=require(_0x150e('0x0'));module[_0x150e('0x1')]={'name':{'type':Sequelize[_0x150e('0x2')],'allowNull':![],'unique':_0x150e('0x3')},'OrderBy':{'type':Sequelize[_0x150e('0x4')],'allowNull':!![]},'rgbBackgroundColor':{'type':Sequelize[_0x150e('0x2')],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.controller.js b/server/api/contactItemType/contactItemType.controller.js index 0273d0d..c498c0f 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 _0x9f0e=['index','map','ContactItemType','rawAttributes','fieldName','type','key','model','query','intersection','attributes','order','sort','where','pick','VIRTUAL','filter','merge','options','includeAll','findAll','catch','show','params','keys','filters','fields','include','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','apply','update','then','destroy','get','ContactItemTypes','UserProfileResource','end','error','stack','name','send'];(function(_0x286077,_0x54769c){var _0x3cff3f=function(_0x7b61d0){while(--_0x7b61d0){_0x286077['push'](_0x286077['shift']());}};_0x3cff3f(++_0x54769c);}(_0x9f0e,0x116));var _0xe9f0=function(_0x43e78f,_0x375a3c){_0x43e78f=_0x43e78f-0x0;var _0x2b000d=_0x9f0e[_0x43e78f];return _0x2b000d;};'use strict';var emlformat=require(_0xe9f0('0x0'));var rimraf=require(_0xe9f0('0x1'));var zipdir=require(_0xe9f0('0x2'));var jsonpatch=require(_0xe9f0('0x3'));var rp=require(_0xe9f0('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xe9f0('0x5'));var util=require(_0xe9f0('0x6'));var path=require(_0xe9f0('0x7'));var sox=require(_0xe9f0('0x8'));var csv=require(_0xe9f0('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xe9f0('0xa'));var squel=require(_0xe9f0('0xb'));var crypto=require(_0xe9f0('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xe9f0('0xd'));var toCsv=require(_0xe9f0('0x9'));var querystring=require(_0xe9f0('0xe'));var Papa=require(_0xe9f0('0xf'));var Redis=require(_0xe9f0('0x10'));var authService=require(_0xe9f0('0x11'));var qs=require(_0xe9f0('0x12'));var as=require(_0xe9f0('0x13'));var hardwareService=require(_0xe9f0('0x14'));var logger=require('../../config/logger')(_0xe9f0('0x15'));var utils=require(_0xe9f0('0x16'));var config=require(_0xe9f0('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xe9f0('0x18'))['db'];function respondWithStatusCode(_0x586763,_0x367545){_0x367545=_0x367545||0xcc;return function(_0xd82420){if(_0xd82420){return _0x586763[_0xe9f0('0x19')](_0x367545);}return _0x586763[_0xe9f0('0x1a')](_0x367545)['end']();};}function respondWithResult(_0x2cf75d,_0x5a10c6){_0x5a10c6=_0x5a10c6||0xc8;return function(_0x1e3ba8){if(_0x1e3ba8){return _0x2cf75d[_0xe9f0('0x1a')](_0x5a10c6)[_0xe9f0('0x1b')](_0x1e3ba8);}};}function respondWithFilteredResult(_0x59320d,_0x28bfac){return function(_0x33e9e4){if(_0x33e9e4){var _0x2e68ef=typeof _0x28bfac['offset']===_0xe9f0('0x1c')&&typeof _0x28bfac[_0xe9f0('0x1d')]===_0xe9f0('0x1c');var _0xd71ac8=_0x33e9e4[_0xe9f0('0x1e')];var _0x2ab12b=_0x2e68ef?0x0:_0x28bfac[_0xe9f0('0x1f')];var _0x59bf5a=_0x2e68ef?_0x33e9e4[_0xe9f0('0x1e')]:_0x28bfac[_0xe9f0('0x1f')]+_0x28bfac[_0xe9f0('0x1d')];var _0x5c4182;if(_0x59bf5a>=_0xd71ac8){_0x59bf5a=_0xd71ac8;_0x5c4182=0xc8;}else{_0x5c4182=0xce;}_0x59320d[_0xe9f0('0x1a')](_0x5c4182);return _0x59320d[_0xe9f0('0x20')](_0xe9f0('0x21'),_0x2ab12b+'-'+_0x59bf5a+'/'+_0xd71ac8)[_0xe9f0('0x1b')](_0x33e9e4);}return null;};}function patchUpdates(_0x5ba788){return function(_0x33f143){try{jsonpatch[_0xe9f0('0x22')](_0x33f143,_0x5ba788,!![]);}catch(_0x583687){return BPromise['reject'](_0x583687);}return _0x33f143['save']();};}function saveUpdates(_0x12fe9f,_0xa1ddc){return function(_0x1211ae){if(_0x1211ae){return _0x1211ae[_0xe9f0('0x23')](_0x12fe9f)[_0xe9f0('0x24')](function(_0x4a5c27){return _0x4a5c27;});}return null;};}function removeEntity(_0x229fe0,_0x38b7ee){return function(_0x437d43){if(_0x437d43){return _0x437d43[_0xe9f0('0x25')]()[_0xe9f0('0x24')](function(){var _0x372ffd=_0x437d43[_0xe9f0('0x26')]({'plain':!![]});var _0x1321bb=_0xe9f0('0x27');return db[_0xe9f0('0x28')]['destroy']({'where':{'type':_0x1321bb,'resourceId':_0x372ffd['id']}})[_0xe9f0('0x24')](function(){return _0x437d43;});})[_0xe9f0('0x24')](function(){_0x229fe0[_0xe9f0('0x1a')](0xcc)[_0xe9f0('0x29')]();});}};}function handleEntityNotFound(_0x4cf1b1,_0x212a38){return function(_0x2613fd){if(!_0x2613fd){_0x4cf1b1[_0xe9f0('0x19')](0x194);}return _0x2613fd;};}function handleError(_0x1f98a7,_0x4335c6){_0x4335c6=_0x4335c6||0x1f4;return function(_0x5457f6){logger[_0xe9f0('0x2a')](_0x5457f6[_0xe9f0('0x2b')]);if(_0x5457f6[_0xe9f0('0x2c')]){delete _0x5457f6[_0xe9f0('0x2c')];}_0x1f98a7[_0xe9f0('0x1a')](_0x4335c6)[_0xe9f0('0x2d')](_0x5457f6);};}exports[_0xe9f0('0x2e')]=function(_0x2efd33,_0x2b6503){var _0x3dbe49={},_0x22806c={},_0x617ad3={'count':0x0,'rows':[]};var _0x445ad0=_[_0xe9f0('0x2f')](db[_0xe9f0('0x30')][_0xe9f0('0x31')],function(_0x80e3ac){return{'name':_0x80e3ac[_0xe9f0('0x32')],'type':_0x80e3ac[_0xe9f0('0x33')][_0xe9f0('0x34')]};});_0x22806c[_0xe9f0('0x35')]=_[_0xe9f0('0x2f')](_0x445ad0,_0xe9f0('0x2c'));_0x22806c[_0xe9f0('0x36')]=_['keys'](_0x2efd33['query']);_0x22806c['filters']=_[_0xe9f0('0x37')](_0x22806c['model'],_0x22806c[_0xe9f0('0x36')]);_0x3dbe49[_0xe9f0('0x38')]=_['intersection'](_0x22806c[_0xe9f0('0x35')],qs['fields'](_0x2efd33['query']['fields']));_0x3dbe49[_0xe9f0('0x38')]=_0x3dbe49[_0xe9f0('0x38')]['length']?_0x3dbe49[_0xe9f0('0x38')]:_0x22806c[_0xe9f0('0x35')];if(!_0x2efd33[_0xe9f0('0x36')]['hasOwnProperty']('nolimit')){_0x3dbe49[_0xe9f0('0x1d')]=qs[_0xe9f0('0x1d')](_0x2efd33[_0xe9f0('0x36')]['limit']);_0x3dbe49[_0xe9f0('0x1f')]=qs[_0xe9f0('0x1f')](_0x2efd33[_0xe9f0('0x36')][_0xe9f0('0x1f')]);}_0x3dbe49[_0xe9f0('0x39')]=qs['sort'](_0x2efd33[_0xe9f0('0x36')][_0xe9f0('0x3a')]);_0x3dbe49[_0xe9f0('0x3b')]=qs['filters'](_[_0xe9f0('0x3c')](_0x2efd33[_0xe9f0('0x36')],_0x22806c['filters']),_0x445ad0);if(_0x2efd33[_0xe9f0('0x36')]['filter']){_0x3dbe49[_0xe9f0('0x3b')]=_['merge'](_0x3dbe49['where'],{'$or':_['map'](_0x445ad0,function(_0x5bddcc){if(_0x5bddcc['type']!==_0xe9f0('0x3d')){var _0x2d4115={};_0x2d4115[_0x5bddcc[_0xe9f0('0x2c')]]={'$like':'%'+_0x2efd33[_0xe9f0('0x36')][_0xe9f0('0x3e')]+'%'};return _0x2d4115;}})});}_0x3dbe49=_[_0xe9f0('0x3f')]({},_0x3dbe49,_0x2efd33[_0xe9f0('0x40')]);var _0x3e79c1={'where':_0x3dbe49[_0xe9f0('0x3b')]};return db['ContactItemType'][_0xe9f0('0x1e')](_0x3e79c1)[_0xe9f0('0x24')](function(_0x36b00a){_0x617ad3['count']=_0x36b00a;if(_0x2efd33['query'][_0xe9f0('0x41')]){_0x3dbe49['include']=[{'all':!![]}];}return db[_0xe9f0('0x30')][_0xe9f0('0x42')](_0x3dbe49);})[_0xe9f0('0x24')](function(_0x42d9d2){_0x617ad3['rows']=_0x42d9d2;return _0x617ad3;})[_0xe9f0('0x24')](respondWithFilteredResult(_0x2b6503,_0x3dbe49))[_0xe9f0('0x43')](handleError(_0x2b6503,null));};exports[_0xe9f0('0x44')]=function(_0x18faaf,_0x37a2ac){var _0x59378a={'raw':!![],'where':{'id':_0x18faaf[_0xe9f0('0x45')]['id']}},_0x60a40d={};_0x60a40d[_0xe9f0('0x35')]=_[_0xe9f0('0x46')](db[_0xe9f0('0x30')]['rawAttributes']);_0x60a40d[_0xe9f0('0x36')]=_['keys'](_0x18faaf['query']);_0x60a40d[_0xe9f0('0x47')]=_[_0xe9f0('0x37')](_0x60a40d['model'],_0x60a40d[_0xe9f0('0x36')]);_0x59378a[_0xe9f0('0x38')]=_[_0xe9f0('0x37')](_0x60a40d[_0xe9f0('0x35')],qs[_0xe9f0('0x48')](_0x18faaf[_0xe9f0('0x36')][_0xe9f0('0x48')]));_0x59378a['attributes']=_0x59378a[_0xe9f0('0x38')]['length']?_0x59378a[_0xe9f0('0x38')]:_0x60a40d['model'];if(_0x18faaf[_0xe9f0('0x36')]['includeAll']){_0x59378a[_0xe9f0('0x49')]=[{'all':!![]}];}_0x59378a=_[_0xe9f0('0x3f')]({},_0x59378a,_0x18faaf[_0xe9f0('0x40')]);return db['ContactItemType'][_0xe9f0('0x4a')](_0x59378a)[_0xe9f0('0x24')](handleEntityNotFound(_0x37a2ac,null))[_0xe9f0('0x24')](respondWithResult(_0x37a2ac,null))[_0xe9f0('0x43')](handleError(_0x37a2ac,null));};exports[_0xe9f0('0x4b')]=function(_0x135175,_0x6ece3f){return db[_0xe9f0('0x30')][_0xe9f0('0x4b')](_0x135175[_0xe9f0('0x4c')],{})[_0xe9f0('0x24')](function(_0x1325a2){var _0x57beee=_0x135175['user'][_0xe9f0('0x26')]({'plain':!![]});if(!_0x57beee)throw new Error(_0xe9f0('0x4d'));if(_0x57beee[_0xe9f0('0x4e')]==='user'){var _0x1ac381=_0x1325a2['get']({'plain':!![]});var _0x323e1e=_0xe9f0('0x27');return db[_0xe9f0('0x4f')][_0xe9f0('0x4a')]({'where':{'name':_0x323e1e,'userProfileId':_0x57beee['userProfileId']},'raw':!![]})[_0xe9f0('0x24')](function(_0x3fa271){if(_0x3fa271&&_0x3fa271['autoAssociation']===0x0){return db[_0xe9f0('0x28')][_0xe9f0('0x4b')]({'name':_0x1ac381[_0xe9f0('0x2c')],'resourceId':_0x1ac381['id'],'type':_0x3fa271[_0xe9f0('0x2c')],'sectionId':_0x3fa271['id']},{})['then'](function(){return _0x1325a2;});}else{return _0x1325a2;}})[_0xe9f0('0x43')](function(_0x3a5d19){logger[_0xe9f0('0x2a')](_0xe9f0('0x50'),_0x3a5d19);throw _0x3a5d19;});}return _0x1325a2;})[_0xe9f0('0x24')](respondWithResult(_0x6ece3f,0xc9))[_0xe9f0('0x43')](handleError(_0x6ece3f,null));};exports[_0xe9f0('0x23')]=function(_0x12d9be,_0x4da78f){if(_0x12d9be[_0xe9f0('0x4c')]['id']){delete _0x12d9be[_0xe9f0('0x4c')]['id'];}return db[_0xe9f0('0x30')][_0xe9f0('0x4a')]({'where':{'id':_0x12d9be[_0xe9f0('0x45')]['id']}})[_0xe9f0('0x24')](handleEntityNotFound(_0x4da78f,null))[_0xe9f0('0x24')](saveUpdates(_0x12d9be[_0xe9f0('0x4c')],null))[_0xe9f0('0x24')](respondWithResult(_0x4da78f,null))[_0xe9f0('0x43')](handleError(_0x4da78f,null));};exports[_0xe9f0('0x25')]=function(_0x3c26ac,_0x4f1c25){return db[_0xe9f0('0x30')]['find']({'where':{'id':_0x3c26ac[_0xe9f0('0x45')]['id']}})[_0xe9f0('0x24')](handleEntityNotFound(_0x4f1c25,null))[_0xe9f0('0x24')](db['CmContactHasItem']['update']({'ItemTypeId':null},{'where':{'ItemTypeId':_0x3c26ac[_0xe9f0('0x45')]['id']}}))['then'](removeEntity(_0x4f1c25,null))[_0xe9f0('0x43')](handleError(_0x4f1c25,null));}; \ No newline at end of file +var _0xab40=['error','stack','name','rawAttributes','fieldName','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','map','type','VIRTUAL','ContactItemType','count','include','findAll','rows','catch','show','params','length','includeAll','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','ContactItemTypes','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','CmContactHasItem','update','eml-format','rimraf','moment','bluebird','mustache','util','path','ejs','lodash','squel','crypto','jsforce','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','undefined','limit','apply','reject','save','then','get','UserProfileResource','destroy'];(function(_0x18b3e1,_0x4f9f6c){var _0x2644d0=function(_0x3fc6f3){while(--_0x3fc6f3){_0x18b3e1['push'](_0x18b3e1['shift']());}};_0x2644d0(++_0x4f9f6c);}(_0xab40,0xcd));var _0x0ab4=function(_0x328a7b,_0x482828){_0x328a7b=_0x328a7b-0x0;var _0x11d46f=_0xab40[_0x328a7b];return _0x11d46f;};'use strict';var emlformat=require(_0x0ab4('0x0'));var rimraf=require(_0x0ab4('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x0ab4('0x2'));var BPromise=require(_0x0ab4('0x3'));var Mustache=require(_0x0ab4('0x4'));var util=require(_0x0ab4('0x5'));var path=require(_0x0ab4('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x0ab4('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0ab4('0x8'));var squel=require(_0x0ab4('0x9'));var crypto=require(_0x0ab4('0xa'));var jsforce=require(_0x0ab4('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0ab4('0xc'));var Redis=require(_0x0ab4('0xd'));var authService=require(_0x0ab4('0xe'));var qs=require(_0x0ab4('0xf'));var as=require(_0x0ab4('0x10'));var hardwareService=require(_0x0ab4('0x11'));var logger=require(_0x0ab4('0x12'))(_0x0ab4('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x0ab4('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x249dc3,_0x45e6fd){_0x45e6fd=_0x45e6fd||0xcc;return function(_0x1e7555){if(_0x1e7555){return _0x249dc3[_0x0ab4('0x15')](_0x45e6fd);}return _0x249dc3[_0x0ab4('0x16')](_0x45e6fd)[_0x0ab4('0x17')]();};}function respondWithResult(_0x112162,_0x2cc644){_0x2cc644=_0x2cc644||0xc8;return function(_0x3cb1df){if(_0x3cb1df){return _0x112162[_0x0ab4('0x16')](_0x2cc644)[_0x0ab4('0x18')](_0x3cb1df);}};}function respondWithFilteredResult(_0x36d246,_0x293e20){return function(_0x45fad1){if(_0x45fad1){var _0x2a83a8=typeof _0x293e20[_0x0ab4('0x19')]===_0x0ab4('0x1a')&&typeof _0x293e20[_0x0ab4('0x1b')]==='undefined';var _0x5000d4=_0x45fad1['count'];var _0x17422f=_0x2a83a8?0x0:_0x293e20[_0x0ab4('0x19')];var _0x2f50d2=_0x2a83a8?_0x45fad1['count']:_0x293e20[_0x0ab4('0x19')]+_0x293e20[_0x0ab4('0x1b')];var _0x212ebd;if(_0x2f50d2>=_0x5000d4){_0x2f50d2=_0x5000d4;_0x212ebd=0xc8;}else{_0x212ebd=0xce;}_0x36d246[_0x0ab4('0x16')](_0x212ebd);return _0x36d246['set']('Content-Range',_0x17422f+'-'+_0x2f50d2+'/'+_0x5000d4)[_0x0ab4('0x18')](_0x45fad1);}return null;};}function patchUpdates(_0x5b1ed5){return function(_0x2b0e29){try{jsonpatch[_0x0ab4('0x1c')](_0x2b0e29,_0x5b1ed5,!![]);}catch(_0x5bb1d0){return BPromise[_0x0ab4('0x1d')](_0x5bb1d0);}return _0x2b0e29[_0x0ab4('0x1e')]();};}function saveUpdates(_0x2c55b3,_0x1d5c14){return function(_0x12d06d){if(_0x12d06d){return _0x12d06d['update'](_0x2c55b3)['then'](function(_0x24b929){return _0x24b929;});}return null;};}function removeEntity(_0x14087f,_0x392afe){return function(_0x13c882){if(_0x13c882){return _0x13c882['destroy']()[_0x0ab4('0x1f')](function(){var _0x3caa9d=_0x13c882[_0x0ab4('0x20')]({'plain':!![]});var _0x4ea9aa='ContactItemTypes';return db[_0x0ab4('0x21')][_0x0ab4('0x22')]({'where':{'type':_0x4ea9aa,'resourceId':_0x3caa9d['id']}})[_0x0ab4('0x1f')](function(){return _0x13c882;});})['then'](function(){_0x14087f['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x19ecc6,_0x5ba3a2){return function(_0x3bf844){if(!_0x3bf844){_0x19ecc6[_0x0ab4('0x15')](0x194);}return _0x3bf844;};}function handleError(_0x4f1aeb,_0x4bd747){_0x4bd747=_0x4bd747||0x1f4;return function(_0x4d0cc1){logger[_0x0ab4('0x23')](_0x4d0cc1[_0x0ab4('0x24')]);if(_0x4d0cc1[_0x0ab4('0x25')]){delete _0x4d0cc1[_0x0ab4('0x25')];}_0x4f1aeb[_0x0ab4('0x16')](_0x4bd747)['send'](_0x4d0cc1);};}exports['index']=function(_0x580d56,_0x2e7a97){var _0x2b66d5={},_0x155d96={},_0x182bbe={'count':0x0,'rows':[]};var _0x46eda7=_['map'](db['ContactItemType'][_0x0ab4('0x26')],function(_0xe6682){return{'name':_0xe6682[_0x0ab4('0x27')],'type':_0xe6682['type']['key']};});_0x155d96[_0x0ab4('0x28')]=_['map'](_0x46eda7,_0x0ab4('0x25'));_0x155d96[_0x0ab4('0x29')]=_[_0x0ab4('0x2a')](_0x580d56[_0x0ab4('0x29')]);_0x155d96[_0x0ab4('0x2b')]=_[_0x0ab4('0x2c')](_0x155d96['model'],_0x155d96[_0x0ab4('0x29')]);_0x2b66d5[_0x0ab4('0x2d')]=_[_0x0ab4('0x2c')](_0x155d96[_0x0ab4('0x28')],qs['fields'](_0x580d56['query'][_0x0ab4('0x2e')]));_0x2b66d5[_0x0ab4('0x2d')]=_0x2b66d5[_0x0ab4('0x2d')]['length']?_0x2b66d5['attributes']:_0x155d96['model'];if(!_0x580d56[_0x0ab4('0x29')][_0x0ab4('0x2f')](_0x0ab4('0x30'))){_0x2b66d5['limit']=qs['limit'](_0x580d56['query'][_0x0ab4('0x1b')]);_0x2b66d5[_0x0ab4('0x19')]=qs[_0x0ab4('0x19')](_0x580d56[_0x0ab4('0x29')][_0x0ab4('0x19')]);}_0x2b66d5[_0x0ab4('0x31')]=qs[_0x0ab4('0x32')](_0x580d56[_0x0ab4('0x29')][_0x0ab4('0x32')]);_0x2b66d5[_0x0ab4('0x33')]=qs['filters'](_[_0x0ab4('0x34')](_0x580d56[_0x0ab4('0x29')],_0x155d96[_0x0ab4('0x2b')]),_0x46eda7);if(_0x580d56[_0x0ab4('0x29')][_0x0ab4('0x35')]){_0x2b66d5[_0x0ab4('0x33')]=_[_0x0ab4('0x36')](_0x2b66d5[_0x0ab4('0x33')],{'$or':_[_0x0ab4('0x37')](_0x46eda7,function(_0x3774ca){if(_0x3774ca[_0x0ab4('0x38')]!==_0x0ab4('0x39')){var _0x4a05c4={};_0x4a05c4[_0x3774ca[_0x0ab4('0x25')]]={'$like':'%'+_0x580d56[_0x0ab4('0x29')][_0x0ab4('0x35')]+'%'};return _0x4a05c4;}})});}_0x2b66d5=_[_0x0ab4('0x36')]({},_0x2b66d5,_0x580d56['options']);var _0x42bece={'where':_0x2b66d5['where']};return db[_0x0ab4('0x3a')][_0x0ab4('0x3b')](_0x42bece)[_0x0ab4('0x1f')](function(_0x245021){_0x182bbe[_0x0ab4('0x3b')]=_0x245021;if(_0x580d56[_0x0ab4('0x29')]['includeAll']){_0x2b66d5[_0x0ab4('0x3c')]=[{'all':!![]}];}return db[_0x0ab4('0x3a')][_0x0ab4('0x3d')](_0x2b66d5);})['then'](function(_0x395e0b){_0x182bbe[_0x0ab4('0x3e')]=_0x395e0b;return _0x182bbe;})[_0x0ab4('0x1f')](respondWithFilteredResult(_0x2e7a97,_0x2b66d5))[_0x0ab4('0x3f')](handleError(_0x2e7a97,null));};exports[_0x0ab4('0x40')]=function(_0x5aa047,_0x5d70eb){var _0x498845={'raw':!![],'where':{'id':_0x5aa047[_0x0ab4('0x41')]['id']}},_0x2f54dd={};_0x2f54dd['model']=_[_0x0ab4('0x2a')](db['ContactItemType'][_0x0ab4('0x26')]);_0x2f54dd['query']=_[_0x0ab4('0x2a')](_0x5aa047[_0x0ab4('0x29')]);_0x2f54dd[_0x0ab4('0x2b')]=_[_0x0ab4('0x2c')](_0x2f54dd[_0x0ab4('0x28')],_0x2f54dd[_0x0ab4('0x29')]);_0x498845['attributes']=_[_0x0ab4('0x2c')](_0x2f54dd[_0x0ab4('0x28')],qs[_0x0ab4('0x2e')](_0x5aa047[_0x0ab4('0x29')][_0x0ab4('0x2e')]));_0x498845[_0x0ab4('0x2d')]=_0x498845['attributes'][_0x0ab4('0x42')]?_0x498845['attributes']:_0x2f54dd[_0x0ab4('0x28')];if(_0x5aa047[_0x0ab4('0x29')][_0x0ab4('0x43')]){_0x498845['include']=[{'all':!![]}];}_0x498845=_[_0x0ab4('0x36')]({},_0x498845,_0x5aa047[_0x0ab4('0x44')]);return db[_0x0ab4('0x3a')][_0x0ab4('0x45')](_0x498845)[_0x0ab4('0x1f')](handleEntityNotFound(_0x5d70eb,null))[_0x0ab4('0x1f')](respondWithResult(_0x5d70eb,null))['catch'](handleError(_0x5d70eb,null));};exports[_0x0ab4('0x46')]=function(_0xdcc118,_0x302894){return db[_0x0ab4('0x3a')][_0x0ab4('0x46')](_0xdcc118[_0x0ab4('0x47')],{})[_0x0ab4('0x1f')](function(_0x356bc9){var _0x22402e=_0xdcc118[_0x0ab4('0x48')][_0x0ab4('0x20')]({'plain':!![]});if(!_0x22402e)throw new Error(_0x0ab4('0x49'));if(_0x22402e[_0x0ab4('0x4a')]==='user'){var _0x2c3a0a=_0x356bc9[_0x0ab4('0x20')]({'plain':!![]});var _0x5800cc=_0x0ab4('0x4b');return db['UserProfileSection']['find']({'where':{'name':_0x5800cc,'userProfileId':_0x22402e[_0x0ab4('0x4c')]},'raw':!![]})[_0x0ab4('0x1f')](function(_0x156e22){if(_0x156e22&&_0x156e22['autoAssociation']===0x0){return db[_0x0ab4('0x21')][_0x0ab4('0x46')]({'name':_0x2c3a0a[_0x0ab4('0x25')],'resourceId':_0x2c3a0a['id'],'type':_0x156e22[_0x0ab4('0x25')],'sectionId':_0x156e22['id']},{})[_0x0ab4('0x1f')](function(){return _0x356bc9;});}else{return _0x356bc9;}})[_0x0ab4('0x3f')](function(_0x1eea3b){logger['error'](_0x0ab4('0x4d'),_0x1eea3b);throw _0x1eea3b;});}return _0x356bc9;})['then'](respondWithResult(_0x302894,0xc9))[_0x0ab4('0x3f')](handleError(_0x302894,null));};exports['update']=function(_0x2597f2,_0x5550ff){if(_0x2597f2['body']['id']){delete _0x2597f2[_0x0ab4('0x47')]['id'];}return db[_0x0ab4('0x3a')][_0x0ab4('0x45')]({'where':{'id':_0x2597f2[_0x0ab4('0x41')]['id']}})['then'](handleEntityNotFound(_0x5550ff,null))[_0x0ab4('0x1f')](saveUpdates(_0x2597f2[_0x0ab4('0x47')],null))[_0x0ab4('0x1f')](respondWithResult(_0x5550ff,null))[_0x0ab4('0x3f')](handleError(_0x5550ff,null));};exports[_0x0ab4('0x22')]=function(_0x2354fa,_0x134437){return db[_0x0ab4('0x3a')][_0x0ab4('0x45')]({'where':{'id':_0x2354fa[_0x0ab4('0x41')]['id']}})[_0x0ab4('0x1f')](handleEntityNotFound(_0x134437,null))[_0x0ab4('0x1f')](db[_0x0ab4('0x4e')][_0x0ab4('0x4f')]({'ItemTypeId':null},{'where':{'ItemTypeId':_0x2354fa[_0x0ab4('0x41')]['id']}}))[_0x0ab4('0x1f')](removeEntity(_0x134437,null))[_0x0ab4('0x3f')](handleError(_0x134437,null));}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.model.js b/server/api/contactItemType/contactItemType.model.js index b4d3164..f94162a 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 _0x97a3=['api','moment','rimraf','exports','define','tools_contact_item_types','lodash','util','../../config/logger'];(function(_0xd9efd2,_0x176541){var _0x4919e0=function(_0x452738){while(--_0x452738){_0xd9efd2['push'](_0xd9efd2['shift']());}};_0x4919e0(++_0x176541);}(_0x97a3,0x1ec));var _0x397a=function(_0x5b532f,_0x519c90){_0x5b532f=_0x5b532f-0x0;var _0x51478c=_0x97a3[_0x5b532f];return _0x51478c;};'use strict';var _=require(_0x397a('0x0'));var util=require(_0x397a('0x1'));var logger=require(_0x397a('0x2'))(_0x397a('0x3'));var moment=require(_0x397a('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x397a('0x5'));var config=require('../../config/environment');var attributes=require('./contactItemType.attributes');module[_0x397a('0x6')]=function(_0x2fc965,_0x2e1b40){return _0x2fc965[_0x397a('0x7')]('ContactItemType',attributes,{'tableName':_0x397a('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2ba9=['bluebird','request-promise','rimraf','../../config/environment','define','ContactItemType','tools_contact_item_types','lodash','util','../../config/logger','api','moment'];(function(_0x1d7075,_0x206f0e){var _0x125ae0=function(_0x258492){while(--_0x258492){_0x1d7075['push'](_0x1d7075['shift']());}};_0x125ae0(++_0x206f0e);}(_0x2ba9,0x1db));var _0x92ba=function(_0x4197c1,_0x22aae6){_0x4197c1=_0x4197c1-0x0;var _0xb3ea0d=_0x2ba9[_0x4197c1];return _0xb3ea0d;};'use strict';var _=require(_0x92ba('0x0'));var util=require(_0x92ba('0x1'));var logger=require(_0x92ba('0x2'))(_0x92ba('0x3'));var moment=require(_0x92ba('0x4'));var BPromise=require(_0x92ba('0x5'));var rp=require(_0x92ba('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x92ba('0x7'));var config=require(_0x92ba('0x8'));var attributes=require('./contactItemType.attributes');module['exports']=function(_0x4096c9,_0x25814c){return _0x4096c9[_0x92ba('0x9')](_0x92ba('0xa'),attributes,{'tableName':_0x92ba('0xb'),'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 e460243..d171acd 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 _0x8a08=['catch','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','info','ContactItemType,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','ContactItemType,\x20%s,\x20%s','message','result'];(function(_0x383627,_0x5be16e){var _0x2c16a0=function(_0x569b72){while(--_0x569b72){_0x383627['push'](_0x383627['shift']());}};_0x2c16a0(++_0x5be16e);}(_0x8a08,0x145));var _0x88a0=function(_0x2c5731,_0x3dacce){_0x2c5731=_0x2c5731-0x0;var _0x56d8ca=_0x8a08[_0x2c5731];return _0x56d8ca;};'use strict';var _=require(_0x88a0('0x0'));var util=require(_0x88a0('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x88a0('0x2'));var fs=require('fs');var Redis=require(_0x88a0('0x3'));var db=require(_0x88a0('0x4'))['db'];var utils=require(_0x88a0('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x88a0('0x6'));var jayson=require(_0x88a0('0x7'));var client=jayson[_0x88a0('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5e2e37,_0x47f5ce,_0x41e8d0){return new BPromise(function(_0x37a308,_0x5d0a0b){return client['request'](_0x5e2e37,_0x41e8d0)['then'](function(_0x73f326){logger[_0x88a0('0x9')]('ContactItemType,\x20%s,\x20%s',_0x47f5ce,'request\x20sent');logger['debug'](_0x88a0('0xa'),_0x47f5ce,_0x88a0('0xb'),JSON[_0x88a0('0xc')](_0x73f326));if(_0x73f326[_0x88a0('0xd')]){if(_0x73f326[_0x88a0('0xd')]['code']===0x1f4){logger['error'](_0x88a0('0xe'),_0x47f5ce,_0x73f326[_0x88a0('0xd')]['message']);return _0x5d0a0b(_0x73f326[_0x88a0('0xd')]['message']);}logger[_0x88a0('0xd')]('ContactItemType,\x20%s,\x20%s',_0x47f5ce,_0x73f326[_0x88a0('0xd')][_0x88a0('0xf')]);return _0x37a308(_0x73f326['error']['message']);}else{logger['info'](_0x88a0('0xe'),_0x47f5ce,_0x88a0('0xb'));_0x37a308(_0x73f326[_0x88a0('0x10')][_0x88a0('0xf')]);}})[_0x88a0('0x11')](function(_0x547d07){logger[_0x88a0('0xd')]('ContactItemType,\x20%s,\x20%s',_0x47f5ce,_0x547d07);_0x5d0a0b(_0x547d07);});});} \ No newline at end of file +var _0x1d3a=['catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','then','info','ContactItemType,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result'];(function(_0x4d03d6,_0x438a06){var _0x22752e=function(_0x1b2894){while(--_0x1b2894){_0x4d03d6['push'](_0x4d03d6['shift']());}};_0x22752e(++_0x438a06);}(_0x1d3a,0xa2));var _0xa1d3=function(_0x4dc7b9,_0x319d5a){_0x4dc7b9=_0x4dc7b9-0x0;var _0x3ab114=_0x1d3a[_0x4dc7b9];return _0x3ab114;};'use strict';var _=require(_0xa1d3('0x0'));var util=require(_0xa1d3('0x1'));var moment=require(_0xa1d3('0x2'));var BPromise=require(_0xa1d3('0x3'));var rs=require(_0xa1d3('0x4'));var fs=require('fs');var Redis=require(_0xa1d3('0x5'));var db=require(_0xa1d3('0x6'))['db'];var utils=require(_0xa1d3('0x7'));var logger=require(_0xa1d3('0x8'))(_0xa1d3('0x9'));var config=require(_0xa1d3('0xa'));var jayson=require(_0xa1d3('0xb'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x29195b,_0x32d5b4,_0x59ac6c){return new BPromise(function(_0x534c61,_0x26c928){return client['request'](_0x29195b,_0x59ac6c)[_0xa1d3('0xc')](function(_0x3e385c){logger[_0xa1d3('0xd')](_0xa1d3('0xe'),_0x32d5b4,'request\x20sent');logger[_0xa1d3('0xf')]('ContactItemType,\x20%s,\x20%s,\x20%s',_0x32d5b4,'request\x20sent',JSON[_0xa1d3('0x10')](_0x3e385c));if(_0x3e385c[_0xa1d3('0x11')]){if(_0x3e385c[_0xa1d3('0x11')][_0xa1d3('0x12')]===0x1f4){logger['error'](_0xa1d3('0xe'),_0x32d5b4,_0x3e385c[_0xa1d3('0x11')][_0xa1d3('0x13')]);return _0x26c928(_0x3e385c[_0xa1d3('0x11')][_0xa1d3('0x13')]);}logger[_0xa1d3('0x11')](_0xa1d3('0xe'),_0x32d5b4,_0x3e385c['error'][_0xa1d3('0x13')]);return _0x534c61(_0x3e385c[_0xa1d3('0x11')][_0xa1d3('0x13')]);}else{logger[_0xa1d3('0xd')](_0xa1d3('0xe'),_0x32d5b4,_0xa1d3('0x14'));_0x534c61(_0x3e385c[_0xa1d3('0x15')][_0xa1d3('0x13')]);}})[_0xa1d3('0x16')](function(_0x3a9f2a){logger[_0xa1d3('0x11')]('ContactItemType,\x20%s,\x20%s',_0x32d5b4,_0x3a9f2a);_0x26c928(_0x3a9f2a);});});} \ No newline at end of file diff --git a/server/api/contactItemType/index.js b/server/api/contactItemType/index.js index fc07708..0da15aa 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 _0xa106=['destroy','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./contactItemType.controller','get','isAuthenticated','/:id','show','post','create','put','update','delete'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0xa106,0xb5));var _0x6a10=function(_0x9be28f,_0x231334){_0x9be28f=_0x9be28f-0x0;var _0xa9f52d=_0xa106[_0x9be28f];return _0xa9f52d;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x6a10('0x0'));var timeout=require(_0x6a10('0x1'));var express=require(_0x6a10('0x2'));var router=express[_0x6a10('0x3')]();var fs_extra=require(_0x6a10('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x6a10('0x5'));var config=require(_0x6a10('0x6'));var controller=require(_0x6a10('0x7'));router[_0x6a10('0x8')]('/',auth[_0x6a10('0x9')](),controller['index']);router[_0x6a10('0x8')](_0x6a10('0xa'),auth['isAuthenticated'](),controller[_0x6a10('0xb')]);router[_0x6a10('0xc')]('/',auth[_0x6a10('0x9')](),controller[_0x6a10('0xd')]);router[_0x6a10('0xe')](_0x6a10('0xa'),auth['isAuthenticated'](),controller[_0x6a10('0xf')]);router[_0x6a10('0x10')]('/:id',auth[_0x6a10('0x9')](),controller[_0x6a10('0x11')]);module['exports']=router; \ No newline at end of file +var _0xf9de=['update','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./contactItemType.controller','get','isAuthenticated','/:id','show','post','create','put'];(function(_0xa03c5,_0x4ef050){var _0x977cb4=function(_0x111acc){while(--_0x111acc){_0xa03c5['push'](_0xa03c5['shift']());}};_0x977cb4(++_0x4ef050);}(_0xf9de,0x12f));var _0xef9d=function(_0x1b3c8a,_0x303d8f){_0x1b3c8a=_0x1b3c8a-0x0;var _0x5ebd13=_0xf9de[_0x1b3c8a];return _0x5ebd13;};'use strict';var multer=require(_0xef9d('0x0'));var util=require(_0xef9d('0x1'));var path=require(_0xef9d('0x2'));var timeout=require(_0xef9d('0x3'));var express=require(_0xef9d('0x4'));var router=express[_0xef9d('0x5')]();var fs_extra=require(_0xef9d('0x6'));var auth=require(_0xef9d('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0xef9d('0x8'));var controller=require(_0xef9d('0x9'));router[_0xef9d('0xa')]('/',auth[_0xef9d('0xb')](),controller['index']);router[_0xef9d('0xa')](_0xef9d('0xc'),auth[_0xef9d('0xb')](),controller[_0xef9d('0xd')]);router[_0xef9d('0xe')]('/',auth[_0xef9d('0xb')](),controller[_0xef9d('0xf')]);router[_0xef9d('0x10')]('/:id',auth[_0xef9d('0xb')](),controller[_0xef9d('0x11')]);router['delete'](_0xef9d('0xc'),auth[_0xef9d('0xb')](),controller[_0xef9d('0x12')]);module[_0xef9d('0x13')]=router; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.attributes.js b/server/api/dashboard/dashboard.attributes.js index b760b71..2fe3b20 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 _0xbaf0=['name','exports','STRING'];(function(_0x1b745b,_0x3e2d40){var _0x120a9d=function(_0x882a6c){while(--_0x882a6c){_0x1b745b['push'](_0x1b745b['shift']());}};_0x120a9d(++_0x3e2d40);}(_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 +var _0x2032=['name','exports','STRING'];(function(_0x13320a,_0x5cef3f){var _0x1b4ce7=function(_0xd16015){while(--_0xd16015){_0x13320a['push'](_0x13320a['shift']());}};_0x1b4ce7(++_0x5cef3f);}(_0x2032,0xd9));var _0x2203=function(_0x1ab766,_0xcf84ed){_0x1ab766=_0x1ab766-0x0;var _0x1152e7=_0x2032[_0x1ab766];return _0x1152e7;};'use strict';var Sequelize=require('sequelize');module[_0x2203('0x0')]={'name':{'type':Sequelize[_0x2203('0x1')],'allowNull':![],'unique':_0x2203('0x2')},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.controller.js b/server/api/dashboard/dashboard.controller.js index 3e3ca2e..b20e659 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 _0x434c=['attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','attrEmailAccounts','attrReport','reportType','attrRefresh','widgetAttributes:\x20%s','stringify','addItem','DashboardId','DashboardItem','getItems','nolimit','eml-format','rimraf','fast-json-patch','request-promise','util','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','localhost','socket.io-emitter','redis','./dashboard.socket','register','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','CustomDashboards','UserProfileResource','stack','name','index','rawAttributes','key','model','query','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','map','type','VIRTUAL','options','Dashboard','includeAll','include','findAll','rows','show','params','keys','filters','find','catch','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','createdAt','updatedAt','body','UserProfileSection','error','iframe','attrUrl','attrs','value','https://','attrPath','clock','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','counter','attrMetric','total','attrVoiceQueues','attrChannel','voice','attrFaxAccounts'];(function(_0x58dd94,_0x11be3a){var _0xc4a529=function(_0x41e11c){while(--_0x41e11c){_0x58dd94['push'](_0x58dd94['shift']());}};_0xc4a529(++_0x11be3a);}(_0x434c,0x116));var _0xc434=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x434c[_0x432682];return _0x463d05;};'use strict';var emlformat=require(_0xc434('0x0'));var rimraf=require(_0xc434('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc434('0x2'));var rp=require(_0xc434('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xc434('0x4'));var path=require(_0xc434('0x5'));var sox=require('sox');var csv=require(_0xc434('0x6'));var ejs=require(_0xc434('0x7'));var fs=require('fs');var fs_extra=require(_0xc434('0x8'));var _=require(_0xc434('0x9'));var squel=require('squel');var crypto=require(_0xc434('0xa'));var jsforce=require(_0xc434('0xb'));var deskjs=require(_0xc434('0xc'));var toCsv=require(_0xc434('0x6'));var querystring=require(_0xc434('0xd'));var Papa=require('papaparse');var Redis=require(_0xc434('0xe'));var authService=require(_0xc434('0xf'));var qs=require(_0xc434('0x10'));var as=require(_0xc434('0x11'));var hardwareService=require(_0xc434('0x12'));var logger=require(_0xc434('0x13'))('api');var utils=require('../../config/utils');var config=require(_0xc434('0x14'));var licenseUtil=require(_0xc434('0x15'));var db=require('../../mysqldb')['db'];config['redis']=_['defaults'](config['redis'],{'host':_0xc434('0x16'),'port':0x18eb});var socket=require(_0xc434('0x17'))(new Redis(config[_0xc434('0x18')]));require(_0xc434('0x19'))[_0xc434('0x1a')](socket);function respondWithStatusCode(_0x209166,_0x18a040){_0x18a040=_0x18a040||0xcc;return function(_0x40b3c5){if(_0x40b3c5){return _0x209166[_0xc434('0x1b')](_0x18a040);}return _0x209166[_0xc434('0x1c')](_0x18a040)[_0xc434('0x1d')]();};}function respondWithResult(_0x148e58,_0x3dbdfc){_0x3dbdfc=_0x3dbdfc||0xc8;return function(_0x42a025){if(_0x42a025){return _0x148e58[_0xc434('0x1c')](_0x3dbdfc)['json'](_0x42a025);}};}function respondWithFilteredResult(_0x1a34c1,_0xb64325){return function(_0x159809){if(_0x159809){var _0x130497=typeof _0xb64325[_0xc434('0x1e')]===_0xc434('0x1f')&&typeof _0xb64325[_0xc434('0x20')]==='undefined';var _0x3339d2=_0x159809[_0xc434('0x21')];var _0x96db03=_0x130497?0x0:_0xb64325[_0xc434('0x1e')];var _0x2fbc21=_0x130497?_0x159809[_0xc434('0x21')]:_0xb64325['offset']+_0xb64325[_0xc434('0x20')];var _0x39761f;if(_0x2fbc21>=_0x3339d2){_0x2fbc21=_0x3339d2;_0x39761f=0xc8;}else{_0x39761f=0xce;}_0x1a34c1[_0xc434('0x1c')](_0x39761f);return _0x1a34c1[_0xc434('0x22')](_0xc434('0x23'),_0x96db03+'-'+_0x2fbc21+'/'+_0x3339d2)['json'](_0x159809);}return null;};}function patchUpdates(_0x556aa9){return function(_0x2082e1){try{jsonpatch[_0xc434('0x24')](_0x2082e1,_0x556aa9,!![]);}catch(_0x2438eb){return BPromise[_0xc434('0x25')](_0x2438eb);}return _0x2082e1['save']();};}function saveUpdates(_0x38bd82,_0x50da13){return function(_0x3ae018){if(_0x3ae018){return _0x3ae018[_0xc434('0x26')](_0x38bd82)[_0xc434('0x27')](function(_0x32ef56){return _0x32ef56;});}return null;};}function removeEntity(_0x57d13d,_0xc5d2a7){return function(_0x6698fb){if(_0x6698fb){return _0x6698fb[_0xc434('0x28')]()[_0xc434('0x27')](function(){var _0x5e3823=_0x6698fb['get']({'plain':!![]});var _0x79f667=_0xc434('0x29');return db[_0xc434('0x2a')][_0xc434('0x28')]({'where':{'type':_0x79f667,'resourceId':_0x5e3823['id']}})[_0xc434('0x27')](function(){return _0x6698fb;});})[_0xc434('0x27')](function(){_0x57d13d[_0xc434('0x1c')](0xcc)[_0xc434('0x1d')]();});}};}function handleEntityNotFound(_0x176802,_0x44bfbf){return function(_0x303803){if(!_0x303803){_0x176802[_0xc434('0x1b')](0x194);}return _0x303803;};}function handleError(_0x52821d,_0x36d28b){_0x36d28b=_0x36d28b||0x1f4;return function(_0x396d39){logger['error'](_0x396d39[_0xc434('0x2b')]);if(_0x396d39[_0xc434('0x2c')]){delete _0x396d39[_0xc434('0x2c')];}_0x52821d[_0xc434('0x1c')](_0x36d28b)['send'](_0x396d39);};}exports[_0xc434('0x2d')]=function(_0x85ce80,_0x24d90c){var _0x1778e1={},_0x31bea7={},_0x549b00={'count':0x0,'rows':[]};var _0xb4fcba=_['map'](db['Dashboard'][_0xc434('0x2e')],function(_0x34eba6){return{'name':_0x34eba6['fieldName'],'type':_0x34eba6['type'][_0xc434('0x2f')]};});_0x31bea7[_0xc434('0x30')]=_['map'](_0xb4fcba,_0xc434('0x2c'));_0x31bea7['query']=_['keys'](_0x85ce80[_0xc434('0x31')]);_0x31bea7['filters']=_['intersection'](_0x31bea7[_0xc434('0x30')],_0x31bea7[_0xc434('0x31')]);_0x1778e1[_0xc434('0x32')]=_[_0xc434('0x33')](_0x31bea7[_0xc434('0x30')],qs[_0xc434('0x34')](_0x85ce80[_0xc434('0x31')][_0xc434('0x34')]));_0x1778e1['attributes']=_0x1778e1['attributes'][_0xc434('0x35')]?_0x1778e1[_0xc434('0x32')]:_0x31bea7[_0xc434('0x30')];if(!_0x85ce80[_0xc434('0x31')][_0xc434('0x36')]('nolimit')){_0x1778e1[_0xc434('0x20')]=qs[_0xc434('0x20')](_0x85ce80[_0xc434('0x31')][_0xc434('0x20')]);_0x1778e1[_0xc434('0x1e')]=qs[_0xc434('0x1e')](_0x85ce80['query'][_0xc434('0x1e')]);}_0x1778e1[_0xc434('0x37')]=qs[_0xc434('0x38')](_0x85ce80[_0xc434('0x31')]['sort']);_0x1778e1[_0xc434('0x39')]=qs['filters'](_[_0xc434('0x3a')](_0x85ce80['query'],_0x31bea7['filters']),_0xb4fcba);if(_0x85ce80[_0xc434('0x31')][_0xc434('0x3b')]){_0x1778e1[_0xc434('0x39')]=_[_0xc434('0x3c')](_0x1778e1[_0xc434('0x39')],{'$or':_[_0xc434('0x3d')](_0xb4fcba,function(_0x1aed30){if(_0x1aed30[_0xc434('0x3e')]!==_0xc434('0x3f')){var _0x5a1fc8={};_0x5a1fc8[_0x1aed30['name']]={'$like':'%'+_0x85ce80[_0xc434('0x31')][_0xc434('0x3b')]+'%'};return _0x5a1fc8;}})});}_0x1778e1=_[_0xc434('0x3c')]({},_0x1778e1,_0x85ce80[_0xc434('0x40')]);var _0x5794b0={'where':_0x1778e1[_0xc434('0x39')]};return db[_0xc434('0x41')][_0xc434('0x21')](_0x5794b0)['then'](function(_0x5a937c){_0x549b00[_0xc434('0x21')]=_0x5a937c;if(_0x85ce80[_0xc434('0x31')][_0xc434('0x42')]){_0x1778e1[_0xc434('0x43')]=[{'all':!![]}];}return db[_0xc434('0x41')][_0xc434('0x44')](_0x1778e1);})[_0xc434('0x27')](function(_0x1bd118){_0x549b00[_0xc434('0x45')]=_0x1bd118;return _0x549b00;})[_0xc434('0x27')](respondWithFilteredResult(_0x24d90c,_0x1778e1))['catch'](handleError(_0x24d90c,null));};exports[_0xc434('0x46')]=function(_0x4be616,_0x1fbe75){var _0x53f1f5={'raw':![],'where':{'id':_0x4be616[_0xc434('0x47')]['id']}},_0x300334={};_0x300334[_0xc434('0x30')]=_[_0xc434('0x48')](db[_0xc434('0x41')][_0xc434('0x2e')]);_0x300334[_0xc434('0x31')]=_['keys'](_0x4be616['query']);_0x300334[_0xc434('0x49')]=_['intersection'](_0x300334[_0xc434('0x30')],_0x300334[_0xc434('0x31')]);_0x53f1f5['attributes']=_[_0xc434('0x33')](_0x300334[_0xc434('0x30')],qs[_0xc434('0x34')](_0x4be616['query'][_0xc434('0x34')]));_0x53f1f5['attributes']=_0x53f1f5['attributes'][_0xc434('0x35')]?_0x53f1f5['attributes']:_0x300334[_0xc434('0x30')];if(_0x4be616[_0xc434('0x31')]['includeAll']){_0x53f1f5[_0xc434('0x43')]=[{'all':!![]}];}_0x53f1f5=_['merge']({},_0x53f1f5,_0x4be616[_0xc434('0x40')]);return db[_0xc434('0x41')][_0xc434('0x4a')](_0x53f1f5)[_0xc434('0x27')](handleEntityNotFound(_0x1fbe75,null))[_0xc434('0x27')](respondWithResult(_0x1fbe75,null))[_0xc434('0x4b')](handleError(_0x1fbe75,null));};exports[_0xc434('0x4c')]=function(_0x891eb4,_0x31281b){return db['Dashboard'][_0xc434('0x4c')](_0x891eb4['body'],{})['then'](function(_0x1c5fe1){var _0x39e25f=_0x891eb4[_0xc434('0x4d')][_0xc434('0x4e')]({'plain':!![]});if(!_0x39e25f)throw new Error(_0xc434('0x4f'));if(_0x39e25f[_0xc434('0x50')]===_0xc434('0x4d')){var _0x47bcbe=_0x1c5fe1[_0xc434('0x4e')]({'plain':!![]});var _0x3f79d3=_0xc434('0x29');return db['UserProfileSection'][_0xc434('0x4a')]({'where':{'name':_0x3f79d3,'userProfileId':_0x39e25f[_0xc434('0x51')]},'raw':!![]})[_0xc434('0x27')](function(_0x26d553){if(_0x26d553&&_0x26d553[_0xc434('0x52')]===0x0){return db[_0xc434('0x2a')][_0xc434('0x4c')]({'name':_0x47bcbe[_0xc434('0x2c')],'resourceId':_0x47bcbe['id'],'type':_0x26d553[_0xc434('0x2c')],'sectionId':_0x26d553['id']},{})['then'](function(){return _0x1c5fe1;});}else{return _0x1c5fe1;}})['catch'](function(_0x22547d){logger['error'](_0xc434('0x53'),_0x22547d);throw _0x22547d;});}return _0x1c5fe1;})[_0xc434('0x27')](respondWithResult(_0x31281b,0xc9))[_0xc434('0x4b')](handleError(_0x31281b,null));};exports[_0xc434('0x54')]=function(_0x4da67f,_0x361504){var _0x36303e={'where':{'id':_0x4da67f[_0xc434('0x47')]['id']}},_0x12ad34={};_0x12ad34[_0xc434('0x30')]=_['keys'](db[_0xc434('0x41')][_0xc434('0x2e')]);_0x36303e[_0xc434('0x32')]=_['intersection'](_0x12ad34[_0xc434('0x30')],qs[_0xc434('0x34')](_0x4da67f['query'][_0xc434('0x34')]));_0x36303e[_0xc434('0x32')]=_0x36303e['attributes'][_0xc434('0x35')]?_0x36303e[_0xc434('0x32')]:_0x12ad34[_0xc434('0x30')];if(_0x4da67f[_0xc434('0x31')][_0xc434('0x42')]){_0x36303e[_0xc434('0x43')]=[{'all':!![]}];}_0x36303e=_[_0xc434('0x3c')]({},_0x36303e,_0x4da67f[_0xc434('0x40')]);return db[_0xc434('0x41')][_0xc434('0x4a')](_0x36303e)[_0xc434('0x27')](handleEntityNotFound(_0x361504,null))[_0xc434('0x27')](function(_0x3b42fe){if(_0x3b42fe){var _0x692598=_0x3b42fe['get']({'plain':!![]});_0x692598=qs['omit'](_0x692598,['id',_0xc434('0x55'),_0xc434('0x56')]);_0x4da67f[_0xc434('0x57')]=_['omit'](_0x4da67f[_0xc434('0x57')],['id',_0xc434('0x55'),_0xc434('0x56')]);return db[_0xc434('0x41')][_0xc434('0x4c')](_[_0xc434('0x3c')](_0x692598,_0x4da67f[_0xc434('0x57')]),{'include':_0x4da67f[_0xc434('0x31')][_0xc434('0x42')]?[{'all':!![]}]:undefined})[_0xc434('0x27')](function(_0x4b89ca){var _0x3e7a40=_0x4da67f[_0xc434('0x4d')]['get']({'plain':!![]});if(!_0x3e7a40)throw new Error(_0xc434('0x4f'));if(_0x3e7a40['role']===_0xc434('0x4d')){var _0x339e59=_0x4b89ca[_0xc434('0x4e')]({'plain':!![]});var _0x4cb4ce=_0xc434('0x29');return db[_0xc434('0x58')]['find']({'where':{'name':_0x4cb4ce,'userProfileId':_0x3e7a40[_0xc434('0x51')]},'raw':!![]})[_0xc434('0x27')](function(_0x5259b6){if(_0x5259b6&&_0x5259b6['autoAssociation']===0x0){return db[_0xc434('0x2a')]['create']({'name':_0x339e59[_0xc434('0x2c')],'resourceId':_0x339e59['id'],'type':_0x5259b6[_0xc434('0x2c')],'sectionId':_0x5259b6['id']},{})[_0xc434('0x27')](function(){return _0x4b89ca;});}else{return _0x4b89ca;}})[_0xc434('0x4b')](function(_0x4525fd){logger[_0xc434('0x59')](_0xc434('0x53'),_0x4525fd);throw _0x4525fd;});}return _0x4b89ca;});}})[_0xc434('0x27')](respondWithResult(_0x361504,0xc9))[_0xc434('0x4b')](handleError(_0x361504,null));};exports[_0xc434('0x26')]=function(_0x47ed82,_0x4b643c){if(_0x47ed82[_0xc434('0x57')]['id']){delete _0x47ed82[_0xc434('0x57')]['id'];}return db[_0xc434('0x41')][_0xc434('0x4a')]({'where':{'id':_0x47ed82['params']['id']}})['then'](handleEntityNotFound(_0x4b643c,null))['then'](saveUpdates(_0x47ed82[_0xc434('0x57')],null))[_0xc434('0x27')](respondWithResult(_0x4b643c,null))[_0xc434('0x4b')](handleError(_0x4b643c,null));};exports[_0xc434('0x28')]=function(_0x147707,_0x40fb43){return db[_0xc434('0x41')][_0xc434('0x4a')]({'where':{'id':_0x147707[_0xc434('0x47')]['id']}})['then'](handleEntityNotFound(_0x40fb43,null))[_0xc434('0x27')](removeEntity(_0x40fb43,null))['catch'](handleError(_0x40fb43,null));};function widgetAttributes(_0x5db68d){try{switch(_0x5db68d[_0xc434('0x3e')]){case _0xc434('0x5a'):return[{'name':_0xc434('0x5b'),'value':_0x5db68d[_0xc434('0x5b')]||(_0x5db68d[_0xc434('0x5c')]&&_0x5db68d['attrs'][0x0]?_0x5db68d[_0xc434('0x5c')][0x0][_0xc434('0x5d')]:undefined)||_0xc434('0x5e')}];case'custom':return[{'name':'attrPath','value':_0x5db68d[_0xc434('0x5f')]||(_0x5db68d['attrs']&&_0x5db68d[_0xc434('0x5c')][0x0]?_0x5db68d[_0xc434('0x5c')][0x0]['value']:undefined)||''}];case _0xc434('0x60'):return[{'name':_0xc434('0x61'),'value':_0x5db68d[_0xc434('0x61')]||(_0x5db68d[_0xc434('0x5c')]&&_0x5db68d[_0xc434('0x5c')][0x0]?_0x5db68d[_0xc434('0x5c')][0x0]['value']:undefined)||_0xc434('0x62')},{'name':_0xc434('0x63'),'value':_0x5db68d[_0xc434('0x63')]||(_0x5db68d['attrs']&&_0x5db68d[_0xc434('0x5c')][0x1]?_0x5db68d['attrs'][0x1]['value']:undefined)||_0xc434('0x64')},{'name':'attrFontSize','value':_0x5db68d[_0xc434('0x65')]||(_0x5db68d[_0xc434('0x5c')]&&_0x5db68d[_0xc434('0x5c')][0x2]?_0x5db68d[_0xc434('0x5c')][0x2]['value']:undefined)||0xc}];case _0xc434('0x66'):return[{'name':_0xc434('0x67'),'value':_0x5db68d['attrMetric']||(_0x5db68d['attrs']&&_0x5db68d[_0xc434('0x5c')][0x0]?_0x5db68d[_0xc434('0x5c')][0x0][_0xc434('0x5d')]:undefined)||_0xc434('0x68')},{'name':'attrVoiceQueues','value':_0x5db68d[_0xc434('0x69')]||(_0x5db68d[_0xc434('0x5c')]&&_0x5db68d[_0xc434('0x5c')][0x1]?_0x5db68d['attrs'][0x1][_0xc434('0x5d')]:undefined)||[]},{'name':_0xc434('0x65'),'value':_0x5db68d[_0xc434('0x65')]||(_0x5db68d[_0xc434('0x5c')]&&_0x5db68d[_0xc434('0x5c')][0x2]?_0x5db68d['attrs'][0x2][_0xc434('0x5d')]:undefined)||0x14},{'name':_0xc434('0x6a'),'value':_0x5db68d[_0xc434('0x6a')]||(_0x5db68d[_0xc434('0x5c')]&&_0x5db68d[_0xc434('0x5c')][0x3]?_0x5db68d['attrs'][0x3][_0xc434('0x5d')]:undefined)||_0xc434('0x6b')},{'name':'attrEmailAccounts','value':_0x5db68d['attrEmailAccounts']||(_0x5db68d[_0xc434('0x5c')]&&_0x5db68d['attrs'][0x4]?_0x5db68d['attrs'][0x4][_0xc434('0x5d')]:undefined)||''},{'name':_0xc434('0x6c'),'value':_0x5db68d[_0xc434('0x6c')]||(_0x5db68d[_0xc434('0x5c')]&&_0x5db68d[_0xc434('0x5c')][0x5]?_0x5db68d[_0xc434('0x5c')][0x5]['value']:undefined)||''},{'name':_0xc434('0x6d'),'value':_0x5db68d[_0xc434('0x6d')]||(_0x5db68d[_0xc434('0x5c')]&&_0x5db68d['attrs'][0x6]?_0x5db68d[_0xc434('0x5c')][0x6][_0xc434('0x5d')]:undefined)||''},{'name':_0xc434('0x6e'),'value':_0x5db68d[_0xc434('0x6e')]||(_0x5db68d[_0xc434('0x5c')]&&_0x5db68d[_0xc434('0x5c')][0x7]?_0x5db68d[_0xc434('0x5c')][0x7]['value']:undefined)||''},{'name':_0xc434('0x6f'),'value':_0x5db68d[_0xc434('0x6f')]||(_0x5db68d[_0xc434('0x5c')]&&_0x5db68d[_0xc434('0x5c')][0x8]?_0x5db68d[_0xc434('0x5c')][0x8][_0xc434('0x5d')]:undefined)||''},{'name':_0xc434('0x70'),'value':_0x5db68d[_0xc434('0x70')]||(_0x5db68d[_0xc434('0x5c')]&&_0x5db68d[_0xc434('0x5c')][0x9]?_0x5db68d[_0xc434('0x5c')][0x9][_0xc434('0x5d')]:undefined)||''}];case _0xc434('0x71'):case _0xc434('0x72'):return[{'name':_0xc434('0x73'),'value':_0x5db68d[_0xc434('0x73')]||(_0x5db68d[_0xc434('0x5c')]&&_0x5db68d['attrs'][0x0]?_0x5db68d[_0xc434('0x5c')][0x0]['value']:undefined)||_0xc434('0x68')},{'name':_0xc434('0x74'),'value':_0x5db68d[_0xc434('0x74')]||(_0x5db68d[_0xc434('0x5c')]&&_0x5db68d[_0xc434('0x5c')][0x1]?_0x5db68d[_0xc434('0x5c')][0x1][_0xc434('0x5d')]:undefined)||null},{'name':'attrSerie3','value':_0x5db68d[_0xc434('0x75')]||(_0x5db68d[_0xc434('0x5c')]&&_0x5db68d[_0xc434('0x5c')][0x2]?_0x5db68d[_0xc434('0x5c')][0x2][_0xc434('0x5d')]:undefined)||null},{'name':_0xc434('0x69'),'value':_0x5db68d['attrVoiceQueues']||(_0x5db68d[_0xc434('0x5c')]&&_0x5db68d[_0xc434('0x5c')][0x3]?_0x5db68d[_0xc434('0x5c')][0x3]['value']:undefined)||[]},{'name':_0xc434('0x6a'),'value':_0x5db68d['attrChannel']||(_0x5db68d[_0xc434('0x5c')]&&_0x5db68d['attrs'][0x4]?_0x5db68d[_0xc434('0x5c')][0x4]['value']:undefined)||_0xc434('0x6b')},{'name':_0xc434('0x76'),'value':_0x5db68d[_0xc434('0x76')]||(_0x5db68d[_0xc434('0x5c')]&&_0x5db68d[_0xc434('0x5c')][0x5]?_0x5db68d[_0xc434('0x5c')][0x5]['value']:undefined)||''},{'name':'attrFaxAccounts','value':_0x5db68d['attrFaxAccounts']||(_0x5db68d['attrs']&&_0x5db68d['attrs'][0x6]?_0x5db68d[_0xc434('0x5c')][0x6][_0xc434('0x5d')]:undefined)||''},{'name':_0xc434('0x6d'),'value':_0x5db68d['attrSmsAccounts']||(_0x5db68d[_0xc434('0x5c')]&&_0x5db68d[_0xc434('0x5c')][0x7]?_0x5db68d[_0xc434('0x5c')][0x7][_0xc434('0x5d')]:undefined)||''},{'name':_0xc434('0x6e'),'value':_0x5db68d[_0xc434('0x6e')]||(_0x5db68d['attrs']&&_0x5db68d[_0xc434('0x5c')][0x8]?_0x5db68d[_0xc434('0x5c')][0x8][_0xc434('0x5d')]:undefined)||''},{'name':'attrWhatsappAccounts','value':_0x5db68d[_0xc434('0x6f')]||(_0x5db68d[_0xc434('0x5c')]&&_0x5db68d['attrs'][0x9]?_0x5db68d[_0xc434('0x5c')][0x9]['value']:undefined)||''},{'name':_0xc434('0x70'),'value':_0x5db68d[_0xc434('0x70')]||(_0x5db68d[_0xc434('0x5c')]&&_0x5db68d[_0xc434('0x5c')][0xa]?_0x5db68d[_0xc434('0x5c')][0xa][_0xc434('0x5d')]:undefined)||''}];case'web-report':return[{'name':_0xc434('0x77'),'type':_0x5db68d[_0xc434('0x78')]||(_0x5db68d[_0xc434('0x5c')]&&_0x5db68d['attrs'][0x0]?_0x5db68d[_0xc434('0x5c')][0x0][_0xc434('0x3e')]:undefined)||null,'value':_0x5db68d['attrReport']||(_0x5db68d[_0xc434('0x5c')]&&_0x5db68d[_0xc434('0x5c')][0x0]?_0x5db68d['attrs'][0x0][_0xc434('0x5d')]:undefined)||null},{'name':_0xc434('0x79'),'value':_0x5db68d[_0xc434('0x79')]||(_0x5db68d[_0xc434('0x5c')]&&_0x5db68d[_0xc434('0x5c')][0x1]?_0x5db68d[_0xc434('0x5c')][0x1][_0xc434('0x5d')]:undefined)||0x0}];default:return[];}}catch(_0x37f284){logger[_0xc434('0x59')](_0xc434('0x7a'),JSON[_0xc434('0x7b')](_0x37f284));return[];}}exports[_0xc434('0x7c')]=function(_0x31cb7e,_0x34aa17,_0x4848c9){if(_0x31cb7e['body']['id']){delete _0x31cb7e['body']['id'];}return db[_0xc434('0x41')][_0xc434('0x4a')]({'where':{'id':_0x31cb7e[_0xc434('0x47')]['id']}})[_0xc434('0x27')](handleEntityNotFound(_0x34aa17,null))[_0xc434('0x27')](function(_0x4b42ef){if(_0x4b42ef){_0x31cb7e['body'][_0xc434('0x7d')]=_0x4b42ef['id'];_0x31cb7e[_0xc434('0x57')][_0xc434('0x5c')]=widgetAttributes(_0x31cb7e['body']);return db[_0xc434('0x7e')][_0xc434('0x4c')](_0x31cb7e[_0xc434('0x57')]);}})[_0xc434('0x27')](respondWithResult(_0x34aa17,null))[_0xc434('0x4b')](handleError(_0x34aa17,null));};exports['getItems']=function(_0x1e63e1,_0x4c5242,_0x46b3cf){var _0x3e79a2={};var _0x226f7a={};var _0x532534;var _0x3975bc;return db[_0xc434('0x41')]['findOne']({'where':{'id':_0x1e63e1[_0xc434('0x47')]['id']}})[_0xc434('0x27')](handleEntityNotFound(_0x4c5242,null))[_0xc434('0x27')](function(_0x55abb4){if(_0x55abb4){_0x532534=_0x55abb4;_0x226f7a[_0xc434('0x30')]=_[_0xc434('0x48')](db[_0xc434('0x7e')][_0xc434('0x2e')]);_0x226f7a[_0xc434('0x31')]=_[_0xc434('0x48')](_0x1e63e1[_0xc434('0x31')]);_0x226f7a[_0xc434('0x49')]=_[_0xc434('0x33')](_0x226f7a[_0xc434('0x30')],_0x226f7a[_0xc434('0x31')]);_0x3e79a2[_0xc434('0x32')]=_[_0xc434('0x33')](_0x226f7a[_0xc434('0x30')],qs[_0xc434('0x34')](_0x1e63e1[_0xc434('0x31')][_0xc434('0x34')]));_0x3e79a2[_0xc434('0x32')]=_0x3e79a2['attributes'][_0xc434('0x35')]?_0x3e79a2[_0xc434('0x32')]:_0x226f7a[_0xc434('0x30')];_0x3e79a2[_0xc434('0x37')]=qs[_0xc434('0x38')](_0x1e63e1[_0xc434('0x31')][_0xc434('0x38')]);_0x3e79a2[_0xc434('0x39')]=qs[_0xc434('0x49')](_[_0xc434('0x3a')](_0x1e63e1[_0xc434('0x31')],_0x226f7a[_0xc434('0x49')]));if(_0x1e63e1[_0xc434('0x31')]['filter']){_0x3e79a2[_0xc434('0x39')]=_[_0xc434('0x3c')](_0x3e79a2[_0xc434('0x39')],{'$or':_[_0xc434('0x3d')](_0x3e79a2['attributes'],function(_0x149325){var _0x5a4047={};_0x5a4047[_0x149325]={'$like':'%'+_0x1e63e1[_0xc434('0x31')][_0xc434('0x3b')]+'%'};return _0x5a4047;})});}_0x3e79a2=_[_0xc434('0x3c')]({},_0x3e79a2,_0x1e63e1['options']);return _0x532534[_0xc434('0x7f')](_0x3e79a2);}})[_0xc434('0x27')](function(_0x571156){if(_0x571156){_0x3975bc=_0x571156[_0xc434('0x35')];if(!_0x1e63e1[_0xc434('0x31')]['hasOwnProperty'](_0xc434('0x80'))){_0x3e79a2[_0xc434('0x20')]=qs[_0xc434('0x20')](_0x1e63e1[_0xc434('0x31')][_0xc434('0x20')]);_0x3e79a2[_0xc434('0x1e')]=qs[_0xc434('0x1e')](_0x1e63e1[_0xc434('0x31')][_0xc434('0x1e')]);}return _0x532534[_0xc434('0x7f')](_0x3e79a2);}})[_0xc434('0x27')](function(_0x3fc2d9){if(_0x3fc2d9){return _0x3fc2d9?{'count':_0x3975bc,'rows':_0x3fc2d9}:null;}})['then'](respondWithResult(_0x4c5242,null))[_0xc434('0x4b')](handleError(_0x4c5242,null));}; \ No newline at end of file +var _0xd19c=['type','keys','query','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','catch','show','params','rawAttributes','length','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','userProfileId','autoAssociation','clone','omit','createdAt','updatedAt','role','CustomDashboards','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','iframe','attrUrl','attrs','value','custom','attrPath','clock','attrHourFormat','HH:mm:ss','attrTimezone','0.00','counter','attrMetric','attrVoiceQueues','attrFontSize','attrChannel','voice','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','pie-chart','attrSerie1','total','attrSerie2','attrSerie3','attrReport','reportType','attrRefresh','widgetAttributes:\x20%s','stringify','addItem','DashboardId','DashboardItem','getItems','findOne','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','squel','crypto','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','register','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','reject','save','then','destroy','get','UserProfileResource','error','stack','name','send','index','map','Dashboard','fieldName'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xd19c,0x1cf));var _0xcd19=function(_0x225776,_0x249f77){_0x225776=_0x225776-0x0;var _0x7d5cef=_0xd19c[_0x225776];return _0x7d5cef;};'use strict';var emlformat=require(_0xcd19('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xcd19('0x1'));var jsonpatch=require(_0xcd19('0x2'));var rp=require(_0xcd19('0x3'));var moment=require(_0xcd19('0x4'));var BPromise=require(_0xcd19('0x5'));var Mustache=require(_0xcd19('0x6'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xcd19('0x7'));var crypto=require(_0xcd19('0x8'));var jsforce=require('jsforce');var deskjs=require(_0xcd19('0x9'));var toCsv=require(_0xcd19('0xa'));var querystring=require(_0xcd19('0xb'));var Papa=require(_0xcd19('0xc'));var Redis=require('ioredis');var authService=require(_0xcd19('0xd'));var qs=require('../../components/parsers/qs');var as=require(_0xcd19('0xe'));var hardwareService=require(_0xcd19('0xf'));var logger=require(_0xcd19('0x10'))(_0xcd19('0x11'));var utils=require(_0xcd19('0x12'));var config=require(_0xcd19('0x13'));var licenseUtil=require(_0xcd19('0x14'));var db=require(_0xcd19('0x15'))['db'];config[_0xcd19('0x16')]=_['defaults'](config['redis'],{'host':_0xcd19('0x17'),'port':0x18eb});var socket=require(_0xcd19('0x18'))(new Redis(config['redis']));require('./dashboard.socket')[_0xcd19('0x19')](socket);function respondWithStatusCode(_0x24af97,_0x47e479){_0x47e479=_0x47e479||0xcc;return function(_0x58820f){if(_0x58820f){return _0x24af97[_0xcd19('0x1a')](_0x47e479);}return _0x24af97[_0xcd19('0x1b')](_0x47e479)[_0xcd19('0x1c')]();};}function respondWithResult(_0x18a13d,_0x181d84){_0x181d84=_0x181d84||0xc8;return function(_0x1f64d6){if(_0x1f64d6){return _0x18a13d[_0xcd19('0x1b')](_0x181d84)[_0xcd19('0x1d')](_0x1f64d6);}};}function respondWithFilteredResult(_0x274017,_0xde20be){return function(_0x5149d6){if(_0x5149d6){var _0x4fee5d=typeof _0xde20be[_0xcd19('0x1e')]===_0xcd19('0x1f')&&typeof _0xde20be['limit']===_0xcd19('0x1f');var _0x346d10=_0x5149d6[_0xcd19('0x20')];var _0x139781=_0x4fee5d?0x0:_0xde20be[_0xcd19('0x1e')];var _0x2a27ad=_0x4fee5d?_0x5149d6[_0xcd19('0x20')]:_0xde20be[_0xcd19('0x1e')]+_0xde20be['limit'];var _0x3f2e70;if(_0x2a27ad>=_0x346d10){_0x2a27ad=_0x346d10;_0x3f2e70=0xc8;}else{_0x3f2e70=0xce;}_0x274017[_0xcd19('0x1b')](_0x3f2e70);return _0x274017[_0xcd19('0x21')](_0xcd19('0x22'),_0x139781+'-'+_0x2a27ad+'/'+_0x346d10)[_0xcd19('0x1d')](_0x5149d6);}return null;};}function patchUpdates(_0xe800ca){return function(_0x336848){try{jsonpatch['apply'](_0x336848,_0xe800ca,!![]);}catch(_0x177d47){return BPromise[_0xcd19('0x23')](_0x177d47);}return _0x336848[_0xcd19('0x24')]();};}function saveUpdates(_0x133724,_0x26ad1a){return function(_0x45bec8){if(_0x45bec8){return _0x45bec8['update'](_0x133724)[_0xcd19('0x25')](function(_0x4a2ecb){return _0x4a2ecb;});}return null;};}function removeEntity(_0x253bb3,_0x258792){return function(_0x44e5ed){if(_0x44e5ed){return _0x44e5ed[_0xcd19('0x26')]()[_0xcd19('0x25')](function(){var _0x43cd6b=_0x44e5ed[_0xcd19('0x27')]({'plain':!![]});var _0x541172='CustomDashboards';return db[_0xcd19('0x28')][_0xcd19('0x26')]({'where':{'type':_0x541172,'resourceId':_0x43cd6b['id']}})[_0xcd19('0x25')](function(){return _0x44e5ed;});})[_0xcd19('0x25')](function(){_0x253bb3[_0xcd19('0x1b')](0xcc)[_0xcd19('0x1c')]();});}};}function handleEntityNotFound(_0x1c8eba,_0x438f50){return function(_0x86ae42){if(!_0x86ae42){_0x1c8eba[_0xcd19('0x1a')](0x194);}return _0x86ae42;};}function handleError(_0xb9b456,_0x223d70){_0x223d70=_0x223d70||0x1f4;return function(_0x483302){logger[_0xcd19('0x29')](_0x483302[_0xcd19('0x2a')]);if(_0x483302['name']){delete _0x483302[_0xcd19('0x2b')];}_0xb9b456[_0xcd19('0x1b')](_0x223d70)[_0xcd19('0x2c')](_0x483302);};}exports[_0xcd19('0x2d')]=function(_0x54a05b,_0x2ebecc){var _0x5a9c61={},_0x5cfed4={},_0x106f8e={'count':0x0,'rows':[]};var _0x5aaf93=_[_0xcd19('0x2e')](db[_0xcd19('0x2f')]['rawAttributes'],function(_0x213c1d){return{'name':_0x213c1d[_0xcd19('0x30')],'type':_0x213c1d[_0xcd19('0x31')]['key']};});_0x5cfed4['model']=_[_0xcd19('0x2e')](_0x5aaf93,'name');_0x5cfed4['query']=_[_0xcd19('0x32')](_0x54a05b[_0xcd19('0x33')]);_0x5cfed4[_0xcd19('0x34')]=_[_0xcd19('0x35')](_0x5cfed4[_0xcd19('0x36')],_0x5cfed4[_0xcd19('0x33')]);_0x5a9c61[_0xcd19('0x37')]=_[_0xcd19('0x35')](_0x5cfed4['model'],qs[_0xcd19('0x38')](_0x54a05b[_0xcd19('0x33')][_0xcd19('0x38')]));_0x5a9c61['attributes']=_0x5a9c61[_0xcd19('0x37')]['length']?_0x5a9c61[_0xcd19('0x37')]:_0x5cfed4['model'];if(!_0x54a05b[_0xcd19('0x33')][_0xcd19('0x39')](_0xcd19('0x3a'))){_0x5a9c61[_0xcd19('0x3b')]=qs['limit'](_0x54a05b[_0xcd19('0x33')][_0xcd19('0x3b')]);_0x5a9c61[_0xcd19('0x1e')]=qs[_0xcd19('0x1e')](_0x54a05b[_0xcd19('0x33')][_0xcd19('0x1e')]);}_0x5a9c61[_0xcd19('0x3c')]=qs[_0xcd19('0x3d')](_0x54a05b['query'][_0xcd19('0x3d')]);_0x5a9c61[_0xcd19('0x3e')]=qs['filters'](_[_0xcd19('0x3f')](_0x54a05b[_0xcd19('0x33')],_0x5cfed4[_0xcd19('0x34')]),_0x5aaf93);if(_0x54a05b[_0xcd19('0x33')][_0xcd19('0x40')]){_0x5a9c61['where']=_['merge'](_0x5a9c61['where'],{'$or':_[_0xcd19('0x2e')](_0x5aaf93,function(_0x533ec5){if(_0x533ec5[_0xcd19('0x31')]!=='VIRTUAL'){var _0x5a097d={};_0x5a097d[_0x533ec5[_0xcd19('0x2b')]]={'$like':'%'+_0x54a05b['query'][_0xcd19('0x40')]+'%'};return _0x5a097d;}})});}_0x5a9c61=_[_0xcd19('0x41')]({},_0x5a9c61,_0x54a05b[_0xcd19('0x42')]);var _0x1b5116={'where':_0x5a9c61[_0xcd19('0x3e')]};return db[_0xcd19('0x2f')][_0xcd19('0x20')](_0x1b5116)[_0xcd19('0x25')](function(_0x50af3b){_0x106f8e[_0xcd19('0x20')]=_0x50af3b;if(_0x54a05b['query'][_0xcd19('0x43')]){_0x5a9c61[_0xcd19('0x44')]=[{'all':!![]}];}return db['Dashboard'][_0xcd19('0x45')](_0x5a9c61);})[_0xcd19('0x25')](function(_0x16135a){_0x106f8e['rows']=_0x16135a;return _0x106f8e;})[_0xcd19('0x25')](respondWithFilteredResult(_0x2ebecc,_0x5a9c61))[_0xcd19('0x46')](handleError(_0x2ebecc,null));};exports[_0xcd19('0x47')]=function(_0x119c4d,_0x5277ac){var _0x1d8534={'raw':![],'where':{'id':_0x119c4d[_0xcd19('0x48')]['id']}},_0x137a11={};_0x137a11[_0xcd19('0x36')]=_['keys'](db[_0xcd19('0x2f')][_0xcd19('0x49')]);_0x137a11[_0xcd19('0x33')]=_[_0xcd19('0x32')](_0x119c4d[_0xcd19('0x33')]);_0x137a11[_0xcd19('0x34')]=_[_0xcd19('0x35')](_0x137a11['model'],_0x137a11[_0xcd19('0x33')]);_0x1d8534[_0xcd19('0x37')]=_[_0xcd19('0x35')](_0x137a11[_0xcd19('0x36')],qs['fields'](_0x119c4d['query'][_0xcd19('0x38')]));_0x1d8534[_0xcd19('0x37')]=_0x1d8534['attributes'][_0xcd19('0x4a')]?_0x1d8534[_0xcd19('0x37')]:_0x137a11[_0xcd19('0x36')];if(_0x119c4d[_0xcd19('0x33')]['includeAll']){_0x1d8534[_0xcd19('0x44')]=[{'all':!![]}];}_0x1d8534=_[_0xcd19('0x41')]({},_0x1d8534,_0x119c4d[_0xcd19('0x42')]);return db[_0xcd19('0x2f')][_0xcd19('0x4b')](_0x1d8534)[_0xcd19('0x25')](handleEntityNotFound(_0x5277ac,null))[_0xcd19('0x25')](respondWithResult(_0x5277ac,null))[_0xcd19('0x46')](handleError(_0x5277ac,null));};exports[_0xcd19('0x4c')]=function(_0x94d8d1,_0x1c4d85){return db[_0xcd19('0x2f')]['create'](_0x94d8d1[_0xcd19('0x4d')],{})[_0xcd19('0x25')](function(_0x5efe6f){var _0x224ef7=_0x94d8d1['user'][_0xcd19('0x27')]({'plain':!![]});if(!_0x224ef7)throw new Error(_0xcd19('0x4e'));if(_0x224ef7['role']===_0xcd19('0x4f')){var _0x3aa4fe=_0x5efe6f[_0xcd19('0x27')]({'plain':!![]});var _0x411555='CustomDashboards';return db['UserProfileSection'][_0xcd19('0x4b')]({'where':{'name':_0x411555,'userProfileId':_0x224ef7[_0xcd19('0x50')]},'raw':!![]})[_0xcd19('0x25')](function(_0x597569){if(_0x597569&&_0x597569[_0xcd19('0x51')]===0x0){return db[_0xcd19('0x28')][_0xcd19('0x4c')]({'name':_0x3aa4fe['name'],'resourceId':_0x3aa4fe['id'],'type':_0x597569[_0xcd19('0x2b')],'sectionId':_0x597569['id']},{})['then'](function(){return _0x5efe6f;});}else{return _0x5efe6f;}})[_0xcd19('0x46')](function(_0x3e7a81){logger[_0xcd19('0x29')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3e7a81);throw _0x3e7a81;});}return _0x5efe6f;})[_0xcd19('0x25')](respondWithResult(_0x1c4d85,0xc9))[_0xcd19('0x46')](handleError(_0x1c4d85,null));};exports[_0xcd19('0x52')]=function(_0x461287,_0x3a8f35){var _0x1375af={'where':{'id':_0x461287[_0xcd19('0x48')]['id']}},_0x3c062f={};_0x3c062f[_0xcd19('0x36')]=_[_0xcd19('0x32')](db[_0xcd19('0x2f')]['rawAttributes']);_0x1375af[_0xcd19('0x37')]=_['intersection'](_0x3c062f['model'],qs[_0xcd19('0x38')](_0x461287[_0xcd19('0x33')][_0xcd19('0x38')]));_0x1375af[_0xcd19('0x37')]=_0x1375af[_0xcd19('0x37')][_0xcd19('0x4a')]?_0x1375af[_0xcd19('0x37')]:_0x3c062f[_0xcd19('0x36')];if(_0x461287[_0xcd19('0x33')][_0xcd19('0x43')]){_0x1375af[_0xcd19('0x44')]=[{'all':!![]}];}_0x1375af=_[_0xcd19('0x41')]({},_0x1375af,_0x461287[_0xcd19('0x42')]);return db['Dashboard'][_0xcd19('0x4b')](_0x1375af)[_0xcd19('0x25')](handleEntityNotFound(_0x3a8f35,null))[_0xcd19('0x25')](function(_0x321b29){if(_0x321b29){var _0x26dd9b=_0x321b29[_0xcd19('0x27')]({'plain':!![]});_0x26dd9b=qs[_0xcd19('0x53')](_0x26dd9b,['id',_0xcd19('0x54'),_0xcd19('0x55')]);_0x461287[_0xcd19('0x4d')]=_['omit'](_0x461287[_0xcd19('0x4d')],['id',_0xcd19('0x54'),'updatedAt']);return db['Dashboard'][_0xcd19('0x4c')](_[_0xcd19('0x41')](_0x26dd9b,_0x461287[_0xcd19('0x4d')]),{'include':_0x461287[_0xcd19('0x33')][_0xcd19('0x43')]?[{'all':!![]}]:undefined})[_0xcd19('0x25')](function(_0x494b12){var _0x1aaedb=_0x461287[_0xcd19('0x4f')]['get']({'plain':!![]});if(!_0x1aaedb)throw new Error(_0xcd19('0x4e'));if(_0x1aaedb[_0xcd19('0x56')]===_0xcd19('0x4f')){var _0x2b350e=_0x494b12['get']({'plain':!![]});var _0x9d8a26=_0xcd19('0x57');return db['UserProfileSection']['find']({'where':{'name':_0x9d8a26,'userProfileId':_0x1aaedb[_0xcd19('0x50')]},'raw':!![]})[_0xcd19('0x25')](function(_0x1129ae){if(_0x1129ae&&_0x1129ae[_0xcd19('0x51')]===0x0){return db['UserProfileResource'][_0xcd19('0x4c')]({'name':_0x2b350e[_0xcd19('0x2b')],'resourceId':_0x2b350e['id'],'type':_0x1129ae[_0xcd19('0x2b')],'sectionId':_0x1129ae['id']},{})['then'](function(){return _0x494b12;});}else{return _0x494b12;}})[_0xcd19('0x46')](function(_0x3f264b){logger[_0xcd19('0x29')](_0xcd19('0x58'),_0x3f264b);throw _0x3f264b;});}return _0x494b12;});}})[_0xcd19('0x25')](respondWithResult(_0x3a8f35,0xc9))[_0xcd19('0x46')](handleError(_0x3a8f35,null));};exports['update']=function(_0x24708f,_0xf69337){if(_0x24708f[_0xcd19('0x4d')]['id']){delete _0x24708f[_0xcd19('0x4d')]['id'];}return db[_0xcd19('0x2f')][_0xcd19('0x4b')]({'where':{'id':_0x24708f[_0xcd19('0x48')]['id']}})['then'](handleEntityNotFound(_0xf69337,null))['then'](saveUpdates(_0x24708f['body'],null))[_0xcd19('0x25')](respondWithResult(_0xf69337,null))[_0xcd19('0x46')](handleError(_0xf69337,null));};exports[_0xcd19('0x26')]=function(_0x384703,_0x147bd3){return db[_0xcd19('0x2f')][_0xcd19('0x4b')]({'where':{'id':_0x384703['params']['id']}})[_0xcd19('0x25')](handleEntityNotFound(_0x147bd3,null))[_0xcd19('0x25')](removeEntity(_0x147bd3,null))[_0xcd19('0x46')](handleError(_0x147bd3,null));};function widgetAttributes(_0x5a9493){try{switch(_0x5a9493[_0xcd19('0x31')]){case _0xcd19('0x59'):return[{'name':_0xcd19('0x5a'),'value':_0x5a9493['attrUrl']||(_0x5a9493[_0xcd19('0x5b')]&&_0x5a9493['attrs'][0x0]?_0x5a9493[_0xcd19('0x5b')][0x0][_0xcd19('0x5c')]:undefined)||'https://'}];case _0xcd19('0x5d'):return[{'name':'attrPath','value':_0x5a9493[_0xcd19('0x5e')]||(_0x5a9493[_0xcd19('0x5b')]&&_0x5a9493['attrs'][0x0]?_0x5a9493[_0xcd19('0x5b')][0x0]['value']:undefined)||''}];case _0xcd19('0x5f'):return[{'name':_0xcd19('0x60'),'value':_0x5a9493['attrHourFormat']||(_0x5a9493[_0xcd19('0x5b')]&&_0x5a9493[_0xcd19('0x5b')][0x0]?_0x5a9493[_0xcd19('0x5b')][0x0][_0xcd19('0x5c')]:undefined)||_0xcd19('0x61')},{'name':_0xcd19('0x62'),'value':_0x5a9493[_0xcd19('0x62')]||(_0x5a9493[_0xcd19('0x5b')]&&_0x5a9493[_0xcd19('0x5b')][0x1]?_0x5a9493[_0xcd19('0x5b')][0x1][_0xcd19('0x5c')]:undefined)||_0xcd19('0x63')},{'name':'attrFontSize','value':_0x5a9493['attrFontSize']||(_0x5a9493['attrs']&&_0x5a9493['attrs'][0x2]?_0x5a9493['attrs'][0x2][_0xcd19('0x5c')]:undefined)||0xc}];case _0xcd19('0x64'):return[{'name':_0xcd19('0x65'),'value':_0x5a9493[_0xcd19('0x65')]||(_0x5a9493[_0xcd19('0x5b')]&&_0x5a9493[_0xcd19('0x5b')][0x0]?_0x5a9493[_0xcd19('0x5b')][0x0][_0xcd19('0x5c')]:undefined)||'total'},{'name':'attrVoiceQueues','value':_0x5a9493[_0xcd19('0x66')]||(_0x5a9493[_0xcd19('0x5b')]&&_0x5a9493[_0xcd19('0x5b')][0x1]?_0x5a9493[_0xcd19('0x5b')][0x1][_0xcd19('0x5c')]:undefined)||[]},{'name':_0xcd19('0x67'),'value':_0x5a9493[_0xcd19('0x67')]||(_0x5a9493['attrs']&&_0x5a9493['attrs'][0x2]?_0x5a9493['attrs'][0x2]['value']:undefined)||0x14},{'name':_0xcd19('0x68'),'value':_0x5a9493[_0xcd19('0x68')]||(_0x5a9493['attrs']&&_0x5a9493[_0xcd19('0x5b')][0x3]?_0x5a9493['attrs'][0x3][_0xcd19('0x5c')]:undefined)||_0xcd19('0x69')},{'name':_0xcd19('0x6a'),'value':_0x5a9493[_0xcd19('0x6a')]||(_0x5a9493[_0xcd19('0x5b')]&&_0x5a9493[_0xcd19('0x5b')][0x4]?_0x5a9493[_0xcd19('0x5b')][0x4]['value']:undefined)||''},{'name':_0xcd19('0x6b'),'value':_0x5a9493[_0xcd19('0x6b')]||(_0x5a9493[_0xcd19('0x5b')]&&_0x5a9493[_0xcd19('0x5b')][0x5]?_0x5a9493[_0xcd19('0x5b')][0x5][_0xcd19('0x5c')]:undefined)||''},{'name':_0xcd19('0x6c'),'value':_0x5a9493['attrSmsAccounts']||(_0x5a9493[_0xcd19('0x5b')]&&_0x5a9493[_0xcd19('0x5b')][0x6]?_0x5a9493['attrs'][0x6][_0xcd19('0x5c')]:undefined)||''},{'name':_0xcd19('0x6d'),'value':_0x5a9493[_0xcd19('0x6d')]||(_0x5a9493[_0xcd19('0x5b')]&&_0x5a9493[_0xcd19('0x5b')][0x7]?_0x5a9493[_0xcd19('0x5b')][0x7][_0xcd19('0x5c')]:undefined)||''},{'name':_0xcd19('0x6e'),'value':_0x5a9493[_0xcd19('0x6e')]||(_0x5a9493['attrs']&&_0x5a9493[_0xcd19('0x5b')][0x8]?_0x5a9493['attrs'][0x8]['value']:undefined)||''},{'name':_0xcd19('0x6f'),'value':_0x5a9493[_0xcd19('0x6f')]||(_0x5a9493[_0xcd19('0x5b')]&&_0x5a9493[_0xcd19('0x5b')][0x9]?_0x5a9493[_0xcd19('0x5b')][0x9][_0xcd19('0x5c')]:undefined)||''}];case _0xcd19('0x70'):case _0xcd19('0x71'):return[{'name':_0xcd19('0x72'),'value':_0x5a9493[_0xcd19('0x72')]||(_0x5a9493[_0xcd19('0x5b')]&&_0x5a9493[_0xcd19('0x5b')][0x0]?_0x5a9493[_0xcd19('0x5b')][0x0][_0xcd19('0x5c')]:undefined)||_0xcd19('0x73')},{'name':_0xcd19('0x74'),'value':_0x5a9493[_0xcd19('0x74')]||(_0x5a9493[_0xcd19('0x5b')]&&_0x5a9493[_0xcd19('0x5b')][0x1]?_0x5a9493[_0xcd19('0x5b')][0x1][_0xcd19('0x5c')]:undefined)||null},{'name':_0xcd19('0x75'),'value':_0x5a9493['attrSerie3']||(_0x5a9493['attrs']&&_0x5a9493[_0xcd19('0x5b')][0x2]?_0x5a9493[_0xcd19('0x5b')][0x2][_0xcd19('0x5c')]:undefined)||null},{'name':'attrVoiceQueues','value':_0x5a9493[_0xcd19('0x66')]||(_0x5a9493[_0xcd19('0x5b')]&&_0x5a9493['attrs'][0x3]?_0x5a9493[_0xcd19('0x5b')][0x3][_0xcd19('0x5c')]:undefined)||[]},{'name':'attrChannel','value':_0x5a9493[_0xcd19('0x68')]||(_0x5a9493[_0xcd19('0x5b')]&&_0x5a9493[_0xcd19('0x5b')][0x4]?_0x5a9493[_0xcd19('0x5b')][0x4][_0xcd19('0x5c')]:undefined)||_0xcd19('0x69')},{'name':_0xcd19('0x6a'),'value':_0x5a9493[_0xcd19('0x6a')]||(_0x5a9493[_0xcd19('0x5b')]&&_0x5a9493[_0xcd19('0x5b')][0x5]?_0x5a9493[_0xcd19('0x5b')][0x5]['value']:undefined)||''},{'name':_0xcd19('0x6b'),'value':_0x5a9493[_0xcd19('0x6b')]||(_0x5a9493[_0xcd19('0x5b')]&&_0x5a9493[_0xcd19('0x5b')][0x6]?_0x5a9493[_0xcd19('0x5b')][0x6][_0xcd19('0x5c')]:undefined)||''},{'name':_0xcd19('0x6c'),'value':_0x5a9493['attrSmsAccounts']||(_0x5a9493[_0xcd19('0x5b')]&&_0x5a9493['attrs'][0x7]?_0x5a9493[_0xcd19('0x5b')][0x7][_0xcd19('0x5c')]:undefined)||''},{'name':_0xcd19('0x6d'),'value':_0x5a9493[_0xcd19('0x6d')]||(_0x5a9493['attrs']&&_0x5a9493[_0xcd19('0x5b')][0x8]?_0x5a9493['attrs'][0x8]['value']:undefined)||''},{'name':_0xcd19('0x6e'),'value':_0x5a9493['attrWhatsappAccounts']||(_0x5a9493[_0xcd19('0x5b')]&&_0x5a9493['attrs'][0x9]?_0x5a9493[_0xcd19('0x5b')][0x9][_0xcd19('0x5c')]:undefined)||''},{'name':_0xcd19('0x6f'),'value':_0x5a9493[_0xcd19('0x6f')]||(_0x5a9493['attrs']&&_0x5a9493[_0xcd19('0x5b')][0xa]?_0x5a9493['attrs'][0xa][_0xcd19('0x5c')]:undefined)||''}];case'web-report':return[{'name':_0xcd19('0x76'),'type':_0x5a9493[_0xcd19('0x77')]||(_0x5a9493['attrs']&&_0x5a9493[_0xcd19('0x5b')][0x0]?_0x5a9493[_0xcd19('0x5b')][0x0][_0xcd19('0x31')]:undefined)||null,'value':_0x5a9493['attrReport']||(_0x5a9493[_0xcd19('0x5b')]&&_0x5a9493[_0xcd19('0x5b')][0x0]?_0x5a9493[_0xcd19('0x5b')][0x0][_0xcd19('0x5c')]:undefined)||null},{'name':_0xcd19('0x78'),'value':_0x5a9493[_0xcd19('0x78')]||(_0x5a9493[_0xcd19('0x5b')]&&_0x5a9493[_0xcd19('0x5b')][0x1]?_0x5a9493['attrs'][0x1][_0xcd19('0x5c')]:undefined)||0x0}];default:return[];}}catch(_0x2e5939){logger['error'](_0xcd19('0x79'),JSON[_0xcd19('0x7a')](_0x2e5939));return[];}}exports[_0xcd19('0x7b')]=function(_0x16ecee,_0x1a0c08,_0x4385f8){if(_0x16ecee[_0xcd19('0x4d')]['id']){delete _0x16ecee[_0xcd19('0x4d')]['id'];}return db['Dashboard'][_0xcd19('0x4b')]({'where':{'id':_0x16ecee[_0xcd19('0x48')]['id']}})['then'](handleEntityNotFound(_0x1a0c08,null))[_0xcd19('0x25')](function(_0xfed47){if(_0xfed47){_0x16ecee[_0xcd19('0x4d')][_0xcd19('0x7c')]=_0xfed47['id'];_0x16ecee['body'][_0xcd19('0x5b')]=widgetAttributes(_0x16ecee['body']);return db[_0xcd19('0x7d')][_0xcd19('0x4c')](_0x16ecee[_0xcd19('0x4d')]);}})[_0xcd19('0x25')](respondWithResult(_0x1a0c08,null))[_0xcd19('0x46')](handleError(_0x1a0c08,null));};exports[_0xcd19('0x7e')]=function(_0x5e55c8,_0x5de2e1,_0x92010d){var _0x100add={};var _0x5af1ff={};var _0x29d5f6;var _0x459148;return db[_0xcd19('0x2f')][_0xcd19('0x7f')]({'where':{'id':_0x5e55c8[_0xcd19('0x48')]['id']}})['then'](handleEntityNotFound(_0x5de2e1,null))[_0xcd19('0x25')](function(_0x43de5a){if(_0x43de5a){_0x29d5f6=_0x43de5a;_0x5af1ff[_0xcd19('0x36')]=_['keys'](db[_0xcd19('0x7d')][_0xcd19('0x49')]);_0x5af1ff[_0xcd19('0x33')]=_[_0xcd19('0x32')](_0x5e55c8[_0xcd19('0x33')]);_0x5af1ff[_0xcd19('0x34')]=_[_0xcd19('0x35')](_0x5af1ff[_0xcd19('0x36')],_0x5af1ff[_0xcd19('0x33')]);_0x100add['attributes']=_[_0xcd19('0x35')](_0x5af1ff['model'],qs[_0xcd19('0x38')](_0x5e55c8['query']['fields']));_0x100add[_0xcd19('0x37')]=_0x100add['attributes'][_0xcd19('0x4a')]?_0x100add[_0xcd19('0x37')]:_0x5af1ff[_0xcd19('0x36')];_0x100add['order']=qs[_0xcd19('0x3d')](_0x5e55c8['query'][_0xcd19('0x3d')]);_0x100add[_0xcd19('0x3e')]=qs[_0xcd19('0x34')](_[_0xcd19('0x3f')](_0x5e55c8[_0xcd19('0x33')],_0x5af1ff[_0xcd19('0x34')]));if(_0x5e55c8[_0xcd19('0x33')][_0xcd19('0x40')]){_0x100add[_0xcd19('0x3e')]=_[_0xcd19('0x41')](_0x100add[_0xcd19('0x3e')],{'$or':_['map'](_0x100add['attributes'],function(_0x43a370){var _0x47e70b={};_0x47e70b[_0x43a370]={'$like':'%'+_0x5e55c8[_0xcd19('0x33')][_0xcd19('0x40')]+'%'};return _0x47e70b;})});}_0x100add=_[_0xcd19('0x41')]({},_0x100add,_0x5e55c8['options']);return _0x29d5f6[_0xcd19('0x7e')](_0x100add);}})['then'](function(_0x2809f3){if(_0x2809f3){_0x459148=_0x2809f3['length'];if(!_0x5e55c8['query'][_0xcd19('0x39')](_0xcd19('0x3a'))){_0x100add[_0xcd19('0x3b')]=qs[_0xcd19('0x3b')](_0x5e55c8[_0xcd19('0x33')][_0xcd19('0x3b')]);_0x100add['offset']=qs[_0xcd19('0x1e')](_0x5e55c8['query']['offset']);}return _0x29d5f6['getItems'](_0x100add);}})['then'](function(_0x46ac5e){if(_0x46ac5e){return _0x46ac5e?{'count':_0x459148,'rows':_0x46ac5e}:null;}})['then'](respondWithResult(_0x5de2e1,null))['catch'](handleError(_0x5de2e1,null));}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.events.js b/server/api/dashboard/dashboard.events.js index a369e36..922928b 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 _0x3f3d=['remove','emit','hasOwnProperty','hook','events','Dashboard','setMaxListeners','save'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3f3d,0xd4));var _0xd3f3=function(_0x3bc298,_0x583d14){_0x3bc298=_0x3bc298-0x0;var _0x31bf58=_0x3f3d[_0x3bc298];return _0x31bf58;};'use strict';var EventEmitter=require(_0xd3f3('0x0'));var Dashboard=require('../../mysqldb')['db'][_0xd3f3('0x1')];var DashboardEvents=new EventEmitter();DashboardEvents[_0xd3f3('0x2')](0x0);var events={'afterCreate':_0xd3f3('0x3'),'afterUpdate':'update','afterDestroy':_0xd3f3('0x4')};function emitEvent(_0x50b34b){return function(_0x329bd0,_0x3168ef,_0x328b92){DashboardEvents[_0xd3f3('0x5')](_0x50b34b+':'+_0x329bd0['id'],_0x329bd0);DashboardEvents[_0xd3f3('0x5')](_0x50b34b,_0x329bd0);_0x328b92(null);};}for(var e in events){if(events[_0xd3f3('0x6')](e)){var event=events[e];Dashboard[_0xd3f3('0x7')](e,emitEvent(event));}}module['exports']=DashboardEvents; \ No newline at end of file +var _0x7007=['emit','hasOwnProperty','hook','events','remove'];(function(_0x247eb1,_0x601184){var _0x49dbb5=function(_0x25258f){while(--_0x25258f){_0x247eb1['push'](_0x247eb1['shift']());}};_0x49dbb5(++_0x601184);}(_0x7007,0xbc));var _0x7700=function(_0x5bf4f5,_0x26bb4b){_0x5bf4f5=_0x5bf4f5-0x0;var _0x23db84=_0x7007[_0x5bf4f5];return _0x23db84;};'use strict';var EventEmitter=require(_0x7700('0x0'));var Dashboard=require('../../mysqldb')['db']['Dashboard'];var DashboardEvents=new EventEmitter();DashboardEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x7700('0x1')};function emitEvent(_0x33a038){return function(_0x4692f3,_0x373001,_0x493720){DashboardEvents[_0x7700('0x2')](_0x33a038+':'+_0x4692f3['id'],_0x4692f3);DashboardEvents['emit'](_0x33a038,_0x4692f3);_0x493720(null);};}for(var e in events){if(events[_0x7700('0x3')](e)){var event=events[e];Dashboard[_0x7700('0x4')](e,emitEvent(event));}}module['exports']=DashboardEvents; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.model.js b/server/api/dashboard/dashboard.model.js index 87f39ef..5e4997f 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 _0x3e1f=['api','moment','bluebird','request-promise','path','rimraf','exports','Dashboard','dashboards','lodash','../../config/logger'];(function(_0x36798a,_0x347c4f){var _0x578847=function(_0x2b0085){while(--_0x2b0085){_0x36798a['push'](_0x36798a['shift']());}};_0x578847(++_0x347c4f);}(_0x3e1f,0xe5));var _0xf3e1=function(_0x28678d,_0x54324f){_0x28678d=_0x28678d-0x0;var _0x1643e9=_0x3e1f[_0x28678d];return _0x1643e9;};'use strict';var _=require(_0xf3e1('0x0'));var util=require('util');var logger=require(_0xf3e1('0x1'))(_0xf3e1('0x2'));var moment=require(_0xf3e1('0x3'));var BPromise=require(_0xf3e1('0x4'));var rp=require(_0xf3e1('0x5'));var fs=require('fs');var path=require(_0xf3e1('0x6'));var rimraf=require(_0xf3e1('0x7'));var config=require('../../config/environment');var attributes=require('./dashboard.attributes');module[_0xf3e1('0x8')]=function(_0x3ee96e,_0x4e24f3){return _0x3ee96e['define'](_0xf3e1('0x9'),attributes,{'tableName':_0xf3e1('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x96ee=['define','Dashboard','util','../../config/logger','path','./dashboard.attributes','exports'];(function(_0x1dc172,_0x220b62){var _0x4444f2=function(_0x461d8f){while(--_0x461d8f){_0x1dc172['push'](_0x1dc172['shift']());}};_0x4444f2(++_0x220b62);}(_0x96ee,0x72));var _0xe96e=function(_0x20c9b2,_0x55d7b1){_0x20c9b2=_0x20c9b2-0x0;var _0x2c6030=_0x96ee[_0x20c9b2];return _0x2c6030;};'use strict';var _=require('lodash');var util=require(_0xe96e('0x0'));var logger=require(_0xe96e('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xe96e('0x2'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xe96e('0x3'));module[_0xe96e('0x4')]=function(_0x55c4fc,_0x32225c){return _0x55c4fc[_0xe96e('0x5')](_0xe96e('0x6'),attributes,{'tableName':'dashboards','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.rpc.js b/server/api/dashboard/dashboard.rpc.js index eed9fee..58177bf 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 _0x9b8d=['../../config/logger','rpc','../../config/environment','client','http','localhost','socket.io-emitter','redis','register','request','then','info','Dashboard,\x20%s,\x20%s','request\x20sent','debug','Dashboard,\x20%s,\x20%s,\x20%s','stringify','error','code','message','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x5181a6,_0x5c529a){var _0x43ce0a=function(_0x38aa35){while(--_0x38aa35){_0x5181a6['push'](_0x5181a6['shift']());}};_0x43ce0a(++_0x5c529a);}(_0x9b8d,0x122));var _0xd9b8=function(_0x4c4037,_0x15054b){_0x4c4037=_0x4c4037-0x0;var _0x357862=_0x9b8d[_0x4c4037];return _0x357862;};'use strict';var _=require(_0xd9b8('0x0'));var util=require(_0xd9b8('0x1'));var moment=require('moment');var BPromise=require(_0xd9b8('0x2'));var rs=require(_0xd9b8('0x3'));var fs=require('fs');var Redis=require(_0xd9b8('0x4'));var db=require(_0xd9b8('0x5'))['db'];var utils=require(_0xd9b8('0x6'));var logger=require(_0xd9b8('0x7'))(_0xd9b8('0x8'));var config=require(_0xd9b8('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xd9b8('0xa')][_0xd9b8('0xb')]({'port':0x232a});config['redis']=_['defaults'](config['redis'],{'host':_0xd9b8('0xc'),'port':0x18eb});var socket=require(_0xd9b8('0xd'))(new Redis(config[_0xd9b8('0xe')]));require('./dashboard.socket')[_0xd9b8('0xf')](socket);function respondWithRpcPromise(_0x18d709,_0x17bf8f,_0x2e6376){return new BPromise(function(_0x4c6bd1,_0x31de40){return client[_0xd9b8('0x10')](_0x18d709,_0x2e6376)[_0xd9b8('0x11')](function(_0x42e054){logger[_0xd9b8('0x12')](_0xd9b8('0x13'),_0x17bf8f,_0xd9b8('0x14'));logger[_0xd9b8('0x15')](_0xd9b8('0x16'),_0x17bf8f,'request\x20sent',JSON[_0xd9b8('0x17')](_0x42e054));if(_0x42e054[_0xd9b8('0x18')]){if(_0x42e054[_0xd9b8('0x18')][_0xd9b8('0x19')]===0x1f4){logger[_0xd9b8('0x18')](_0xd9b8('0x13'),_0x17bf8f,_0x42e054[_0xd9b8('0x18')]['message']);return _0x31de40(_0x42e054['error'][_0xd9b8('0x1a')]);}logger[_0xd9b8('0x18')](_0xd9b8('0x13'),_0x17bf8f,_0x42e054[_0xd9b8('0x18')][_0xd9b8('0x1a')]);return _0x4c6bd1(_0x42e054['error']['message']);}else{logger['info'](_0xd9b8('0x13'),_0x17bf8f,'request\x20sent');_0x4c6bd1(_0x42e054['result'][_0xd9b8('0x1a')]);}})['catch'](function(_0x377f2c){logger[_0xd9b8('0x18')](_0xd9b8('0x13'),_0x17bf8f,_0x377f2c);_0x31de40(_0x377f2c);});});} \ No newline at end of file +var _0x5424=['debug','Dashboard,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','Dashboard,\x20%s,\x20%s','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./dashboard.socket','register','request','info','request\x20sent'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5424,0x78));var _0x4542=function(_0x45bf86,_0x75586e){_0x45bf86=_0x45bf86-0x0;var _0x1f02b7=_0x5424[_0x45bf86];return _0x1f02b7;};'use strict';var _=require('lodash');var util=require(_0x4542('0x0'));var moment=require(_0x4542('0x1'));var BPromise=require(_0x4542('0x2'));var rs=require(_0x4542('0x3'));var fs=require('fs');var Redis=require(_0x4542('0x4'));var db=require(_0x4542('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x4542('0x6'))(_0x4542('0x7'));var config=require(_0x4542('0x8'));var jayson=require(_0x4542('0x9'));var client=jayson[_0x4542('0xa')][_0x4542('0xb')]({'port':0x232a});config[_0x4542('0xc')]=_[_0x4542('0xd')](config['redis'],{'host':_0x4542('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x4542('0xc')]));require(_0x4542('0xf'))[_0x4542('0x10')](socket);function respondWithRpcPromise(_0x7ab7d6,_0x419a3a,_0xaf999c){return new BPromise(function(_0x2cca4f,_0x948c87){return client[_0x4542('0x11')](_0x7ab7d6,_0xaf999c)['then'](function(_0x4cad41){logger[_0x4542('0x12')]('Dashboard,\x20%s,\x20%s',_0x419a3a,_0x4542('0x13'));logger[_0x4542('0x14')](_0x4542('0x15'),_0x419a3a,_0x4542('0x13'),JSON[_0x4542('0x16')](_0x4cad41));if(_0x4cad41[_0x4542('0x17')]){if(_0x4cad41[_0x4542('0x17')]['code']===0x1f4){logger[_0x4542('0x17')]('Dashboard,\x20%s,\x20%s',_0x419a3a,_0x4cad41[_0x4542('0x17')][_0x4542('0x18')]);return _0x948c87(_0x4cad41[_0x4542('0x17')]['message']);}logger[_0x4542('0x17')]('Dashboard,\x20%s,\x20%s',_0x419a3a,_0x4cad41[_0x4542('0x17')][_0x4542('0x18')]);return _0x2cca4f(_0x4cad41['error']['message']);}else{logger[_0x4542('0x12')]('Dashboard,\x20%s,\x20%s',_0x419a3a,'request\x20sent');_0x2cca4f(_0x4cad41[_0x4542('0x19')][_0x4542('0x18')]);}})[_0x4542('0x1a')](function(_0x4140fc){logger[_0x4542('0x17')](_0x4542('0x1b'),_0x419a3a,_0x4140fc);_0x948c87(_0x4140fc);});});} \ No newline at end of file diff --git a/server/api/dashboard/dashboard.socket.js b/server/api/dashboard/dashboard.socket.js index 80b6b4b..6916183 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 _0x83b0=['emit','register','save','remove'];(function(_0x151a33,_0xb7b974){var _0x36dfaf=function(_0x387fac){while(--_0x387fac){_0x151a33['push'](_0x151a33['shift']());}};_0x36dfaf(++_0xb7b974);}(_0x83b0,0x96));var _0x083b=function(_0x14b8c5,_0x3ad8db){_0x14b8c5=_0x14b8c5-0x0;var _0x43beba=_0x83b0[_0x14b8c5];return _0x43beba;};'use strict';var DashboardEvents=require('./dashboard.events');var events=[_0x083b('0x0'),_0x083b('0x1'),'update'];function createListener(_0xefb421,_0x584879){return function(_0x48cb76){_0x584879[_0x083b('0x2')](_0xefb421,_0x48cb76);};}function removeListener(_0x4a7e0d,_0x45e1fb){return function(){DashboardEvents['removeListener'](_0x4a7e0d,_0x45e1fb);};}exports[_0x083b('0x3')]=function(_0x166c38){for(var _0x1bb480=0x0,_0x2c9254=events['length'];_0x1bb480<_0x2c9254;_0x1bb480++){var _0x597219=events[_0x1bb480];var _0x23ed80=createListener('dashboard:'+_0x597219,_0x166c38);DashboardEvents['on'](_0x597219,_0x23ed80);}}; \ No newline at end of file +var _0xd7f4=['remove','emit','register','dashboard:','./dashboard.events','save'];(function(_0x267096,_0x549583){var _0x4c4847=function(_0x5a56f5){while(--_0x5a56f5){_0x267096['push'](_0x267096['shift']());}};_0x4c4847(++_0x549583);}(_0xd7f4,0x1ea));var _0x4d7f=function(_0x47dd86,_0x681d25){_0x47dd86=_0x47dd86-0x0;var _0x4f3685=_0xd7f4[_0x47dd86];return _0x4f3685;};'use strict';var DashboardEvents=require(_0x4d7f('0x0'));var events=[_0x4d7f('0x1'),_0x4d7f('0x2'),'update'];function createListener(_0xf60550,_0x37badd){return function(_0x7ff314){_0x37badd[_0x4d7f('0x3')](_0xf60550,_0x7ff314);};}function removeListener(_0xd9bffe,_0x293336){return function(){DashboardEvents['removeListener'](_0xd9bffe,_0x293336);};}exports[_0x4d7f('0x4')]=function(_0x5a0ffa){for(var _0x514613=0x0,_0x997b18=events['length'];_0x514613<_0x997b18;_0x514613++){var _0x25ca95=events[_0x514613];var _0x3e9504=createListener(_0x4d7f('0x5')+_0x25ca95,_0x5a0ffa);DashboardEvents['on'](_0x25ca95,_0x3e9504);}}; \ No newline at end of file diff --git a/server/api/dashboard/index.js b/server/api/dashboard/index.js index 4a386fd..25d606a 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 _0xb12b=['update','delete','destroy','exports','multer','util','Router','fs-extra','../../config/environment','get','index','/:id','isAuthenticated','show','/:id/items','getItems','create','post','/:id/clone','put'];(function(_0xc596f,_0x5badc7){var _0x4ad736=function(_0x299d95){while(--_0x299d95){_0xc596f['push'](_0xc596f['shift']());}};_0x4ad736(++_0x5badc7);}(_0xb12b,0x68));var _0xbb12=function(_0x27c3d2,_0x29d81f){_0x27c3d2=_0x27c3d2-0x0;var _0x1db1e9=_0xb12b[_0x27c3d2];return _0x1db1e9;};'use strict';var multer=require(_0xbb12('0x0'));var util=require(_0xbb12('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xbb12('0x2')]();var fs_extra=require(_0xbb12('0x3'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xbb12('0x4'));var controller=require('./dashboard.controller');router[_0xbb12('0x5')]('/',auth['isAuthenticated'](),controller[_0xbb12('0x6')]);router[_0xbb12('0x5')](_0xbb12('0x7'),auth[_0xbb12('0x8')](),controller[_0xbb12('0x9')]);router['get'](_0xbb12('0xa'),auth['isAuthenticated'](),controller[_0xbb12('0xb')]);router['post']('/',auth['isAuthenticated'](),controller[_0xbb12('0xc')]);router[_0xbb12('0xd')](_0xbb12('0xe'),auth[_0xbb12('0x8')](),controller['clone']);router[_0xbb12('0xd')]('/:id/items',auth[_0xbb12('0x8')](),controller['addItem']);router[_0xbb12('0xf')](_0xbb12('0x7'),auth[_0xbb12('0x8')](),controller[_0xbb12('0x10')]);router[_0xbb12('0x11')](_0xbb12('0x7'),auth[_0xbb12('0x8')](),controller[_0xbb12('0x12')]);module[_0xbb12('0x13')]=router; \ No newline at end of file +var _0x623b=['/:id','show','/:id/items','getItems','create','/:id/clone','addItem','update','delete','multer','util','path','connect-timeout','fs-extra','../../components/interaction/service','../../config/environment','./dashboard.controller','get','isAuthenticated','index'];(function(_0x4e5c1a,_0x432f8d){var _0x33d762=function(_0x6c6d46){while(--_0x6c6d46){_0x4e5c1a['push'](_0x4e5c1a['shift']());}};_0x33d762(++_0x432f8d);}(_0x623b,0x135));var _0xb623=function(_0x486f4a,_0x478dc7){_0x486f4a=_0x486f4a-0x0;var _0x135d99=_0x623b[_0x486f4a];return _0x135d99;};'use strict';var multer=require(_0xb623('0x0'));var util=require(_0xb623('0x1'));var path=require(_0xb623('0x2'));var timeout=require(_0xb623('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xb623('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xb623('0x5'));var config=require(_0xb623('0x6'));var controller=require(_0xb623('0x7'));router[_0xb623('0x8')]('/',auth[_0xb623('0x9')](),controller[_0xb623('0xa')]);router[_0xb623('0x8')](_0xb623('0xb'),auth[_0xb623('0x9')](),controller[_0xb623('0xc')]);router[_0xb623('0x8')](_0xb623('0xd'),auth[_0xb623('0x9')](),controller[_0xb623('0xe')]);router['post']('/',auth[_0xb623('0x9')](),controller[_0xb623('0xf')]);router['post'](_0xb623('0x10'),auth[_0xb623('0x9')](),controller['clone']);router['post'](_0xb623('0xd'),auth[_0xb623('0x9')](),controller[_0xb623('0x11')]);router['put'](_0xb623('0xb'),auth[_0xb623('0x9')](),controller[_0xb623('0x12')]);router[_0xb623('0x13')](_0xb623('0xb'),auth[_0xb623('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.attributes.js b/server/api/dashboardItem/dashboardItem.attributes.js index 1fef363..3ee260f 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 _0x326f=['#2196f3','sequelize','exports','STRING','TEXT','long','parse','getDataValue','attrs','stringify','setDataValue','INTEGER','#ffffff'];(function(_0x2c049f,_0x21c75e){var _0x26a4fa=function(_0xb78c94){while(--_0xb78c94){_0x2c049f['push'](_0x2c049f['shift']());}};_0x26a4fa(++_0x21c75e);}(_0x326f,0xd1));var _0xf326=function(_0x2de5ca,_0x4bace6){_0x2de5ca=_0x2de5ca-0x0;var _0x4871e5=_0x326f[_0x2de5ca];return _0x4871e5;};'use strict';var Sequelize=require(_0xf326('0x0'));var squel=require('squel');var _=require('lodash');module[_0xf326('0x1')]={'title':{'type':Sequelize[_0xf326('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xf326('0x2')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0xf326('0x3')](_0xf326('0x4')),'get':function(){try{return JSON[_0xf326('0x5')](this[_0xf326('0x6')](_0xf326('0x7')));}catch(_0x1b5a56){return[];}},'set':function(_0x3ace29){try{this['setDataValue'](_0xf326('0x7'),JSON[_0xf326('0x8')](_0x3ace29));}catch(_0x165f95){this[_0xf326('0x9')]('attrs',JSON['stringify']([]));}}},'sizeX':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0xf326('0xa')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0xf326('0xa')]},'col':{'type':Sequelize[_0xf326('0xa')]},'background':{'type':Sequelize[_0xf326('0x2')],'allowNull':![],'defaultValue':_0xf326('0xb'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xf326('0xc'),'validate':{'notEmpty':!![]}},'link':{'type':Sequelize['STRING']},'titleFontSize':{'type':Sequelize[_0xf326('0xa')],'defaultValue':0xc}}; \ No newline at end of file +var _0x9536=['squel','lodash','exports','STRING','long','parse','getDataValue','attrs','setDataValue','stringify','INTEGER','#ffffff','#2196f3','sequelize'];(function(_0x29f1bc,_0x54a5c3){var _0x480d3a=function(_0x34abca){while(--_0x34abca){_0x29f1bc['push'](_0x29f1bc['shift']());}};_0x480d3a(++_0x54a5c3);}(_0x9536,0x179));var _0x6953=function(_0x136a0d,_0x476fe2){_0x136a0d=_0x136a0d-0x0;var _0x212ea5=_0x9536[_0x136a0d];return _0x212ea5;};'use strict';var Sequelize=require(_0x6953('0x0'));var squel=require(_0x6953('0x1'));var _=require(_0x6953('0x2'));module[_0x6953('0x3')]={'title':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x6953('0x4')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize['TEXT'](_0x6953('0x5')),'get':function(){try{return JSON[_0x6953('0x6')](this[_0x6953('0x7')](_0x6953('0x8')));}catch(_0x2f3cc3){return[];}},'set':function(_0x494ac2){try{this[_0x6953('0x9')](_0x6953('0x8'),JSON[_0x6953('0xa')](_0x494ac2));}catch(_0x3e1aff){this[_0x6953('0x9')]('attrs',JSON[_0x6953('0xa')]([]));}}},'sizeX':{'type':Sequelize[_0x6953('0xb')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0x6953('0xb')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize['INTEGER']},'col':{'type':Sequelize[_0x6953('0xb')]},'background':{'type':Sequelize[_0x6953('0x4')],'allowNull':![],'defaultValue':_0x6953('0xc'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize[_0x6953('0x4')],'allowNull':![],'defaultValue':_0x6953('0xd'),'validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0x6953('0x4')]},'titleFontSize':{'type':Sequelize[_0x6953('0xb')],'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 33cf55c..545b620 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 _0x6bfc=['ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../mysqldb','redis','localhost','socket.io-emitter','./dashboardItem.socket','sendStatus','status','end','offset','undefined','limit','set','Content-Range','json','apply','reject','save','update','destroy','then','name','send','params','model','keys','DashboardItem','rawAttributes','query','filters','intersection','attributes','fields','includeAll','include','options','catch','find','attrUrl','attrs','custom','attrPath','value','clock','attrHourFormat','HH:mm:ss','attrTimezone','counter','attrMetric','total','attrVoiceQueues','attrFontSize','attrChannel','voice','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','pie-chart','attrSerie1','attrSerie3','reportType','attrRefresh','error','widgetAttributes:\x20%s','stringify','body','rimraf','zip-dir','fast-json-patch','moment','mustache','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring'];(function(_0x3d5f84,_0x569548){var _0x1981b8=function(_0x3bf9f3){while(--_0x3bf9f3){_0x3d5f84['push'](_0x3d5f84['shift']());}};_0x1981b8(++_0x569548);}(_0x6bfc,0x159));var _0xc6bf=function(_0xbefad8,_0x469a2a){_0xbefad8=_0xbefad8-0x0;var _0x1f8476=_0x6bfc[_0xbefad8];return _0x1f8476;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc6bf('0x0'));var zipdir=require(_0xc6bf('0x1'));var jsonpatch=require(_0xc6bf('0x2'));var rp=require('request-promise');var moment=require(_0xc6bf('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xc6bf('0x4'));var util=require('util');var path=require(_0xc6bf('0x5'));var sox=require(_0xc6bf('0x6'));var csv=require(_0xc6bf('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc6bf('0x8'));var _=require(_0xc6bf('0x9'));var squel=require(_0xc6bf('0xa'));var crypto=require(_0xc6bf('0xb'));var jsforce=require(_0xc6bf('0xc'));var deskjs=require(_0xc6bf('0xd'));var toCsv=require(_0xc6bf('0x7'));var querystring=require(_0xc6bf('0xe'));var Papa=require('papaparse');var Redis=require(_0xc6bf('0xf'));var authService=require(_0xc6bf('0x10'));var qs=require(_0xc6bf('0x11'));var as=require(_0xc6bf('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xc6bf('0x13'));var utils=require(_0xc6bf('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xc6bf('0x15'))['db'];config[_0xc6bf('0x16')]=_['defaults'](config[_0xc6bf('0x16')],{'host':_0xc6bf('0x17'),'port':0x18eb});var socket=require(_0xc6bf('0x18'))(new Redis(config[_0xc6bf('0x16')]));require(_0xc6bf('0x19'))['register'](socket);function respondWithStatusCode(_0x58dd19,_0x56cb99){_0x56cb99=_0x56cb99||0xcc;return function(_0x391117){if(_0x391117){return _0x58dd19[_0xc6bf('0x1a')](_0x56cb99);}return _0x58dd19[_0xc6bf('0x1b')](_0x56cb99)[_0xc6bf('0x1c')]();};}function respondWithResult(_0x368195,_0x478f6){_0x478f6=_0x478f6||0xc8;return function(_0x54d6a8){if(_0x54d6a8){return _0x368195[_0xc6bf('0x1b')](_0x478f6)['json'](_0x54d6a8);}};}function respondWithFilteredResult(_0x4dec90,_0x195c3f){return function(_0x23a9e9){if(_0x23a9e9){var _0x5bdc69=typeof _0x195c3f[_0xc6bf('0x1d')]===_0xc6bf('0x1e')&&typeof _0x195c3f['limit']===_0xc6bf('0x1e');var _0x4adc0a=_0x23a9e9['count'];var _0x501a3b=_0x5bdc69?0x0:_0x195c3f[_0xc6bf('0x1d')];var _0x15cdd4=_0x5bdc69?_0x23a9e9['count']:_0x195c3f['offset']+_0x195c3f[_0xc6bf('0x1f')];var _0x2e47ce;if(_0x15cdd4>=_0x4adc0a){_0x15cdd4=_0x4adc0a;_0x2e47ce=0xc8;}else{_0x2e47ce=0xce;}_0x4dec90['status'](_0x2e47ce);return _0x4dec90[_0xc6bf('0x20')](_0xc6bf('0x21'),_0x501a3b+'-'+_0x15cdd4+'/'+_0x4adc0a)[_0xc6bf('0x22')](_0x23a9e9);}return null;};}function patchUpdates(_0x56e899){return function(_0x5e2537){try{jsonpatch[_0xc6bf('0x23')](_0x5e2537,_0x56e899,!![]);}catch(_0x202856){return BPromise[_0xc6bf('0x24')](_0x202856);}return _0x5e2537[_0xc6bf('0x25')]();};}function saveUpdates(_0x3b5dd7,_0x2df59e){return function(_0x13080f){if(_0x13080f){return _0x13080f[_0xc6bf('0x26')](_0x3b5dd7)['then'](function(_0x312138){return _0x312138;});}return null;};}function removeEntity(_0x24ed4b,_0x3f0b43){return function(_0x532bc1){if(_0x532bc1){return _0x532bc1[_0xc6bf('0x27')]()[_0xc6bf('0x28')](function(){_0x24ed4b[_0xc6bf('0x1b')](0xcc)[_0xc6bf('0x1c')]();});}};}function handleEntityNotFound(_0x1346d5,_0x15396c){return function(_0x5abf52){if(!_0x5abf52){_0x1346d5['sendStatus'](0x194);}return _0x5abf52;};}function handleError(_0x1b6e7c,_0x519dc8){_0x519dc8=_0x519dc8||0x1f4;return function(_0x36b1c7){logger['error'](_0x36b1c7['stack']);if(_0x36b1c7[_0xc6bf('0x29')]){delete _0x36b1c7[_0xc6bf('0x29')];}_0x1b6e7c[_0xc6bf('0x1b')](_0x519dc8)[_0xc6bf('0x2a')](_0x36b1c7);};}exports['show']=function(_0x478af5,_0x543ad5){var _0x4f0234={'raw':![],'where':{'id':_0x478af5[_0xc6bf('0x2b')]['id']}},_0x32407b={};_0x32407b[_0xc6bf('0x2c')]=_[_0xc6bf('0x2d')](db[_0xc6bf('0x2e')][_0xc6bf('0x2f')]);_0x32407b[_0xc6bf('0x30')]=_[_0xc6bf('0x2d')](_0x478af5[_0xc6bf('0x30')]);_0x32407b[_0xc6bf('0x31')]=_[_0xc6bf('0x32')](_0x32407b[_0xc6bf('0x2c')],_0x32407b[_0xc6bf('0x30')]);_0x4f0234[_0xc6bf('0x33')]=_[_0xc6bf('0x32')](_0x32407b['model'],qs[_0xc6bf('0x34')](_0x478af5[_0xc6bf('0x30')][_0xc6bf('0x34')]));_0x4f0234[_0xc6bf('0x33')]=_0x4f0234['attributes']['length']?_0x4f0234[_0xc6bf('0x33')]:_0x32407b[_0xc6bf('0x2c')];if(_0x478af5[_0xc6bf('0x30')][_0xc6bf('0x35')]){_0x4f0234[_0xc6bf('0x36')]=[{'all':!![]}];}_0x4f0234=_['merge']({},_0x4f0234,_0x478af5[_0xc6bf('0x37')]);return db['DashboardItem']['find'](_0x4f0234)[_0xc6bf('0x28')](handleEntityNotFound(_0x543ad5,null))[_0xc6bf('0x28')](respondWithResult(_0x543ad5,null))[_0xc6bf('0x38')](handleError(_0x543ad5,null));};exports[_0xc6bf('0x27')]=function(_0x2965bc,_0x571bdb){return db[_0xc6bf('0x2e')][_0xc6bf('0x39')]({'where':{'id':_0x2965bc['params']['id']}})[_0xc6bf('0x28')](handleEntityNotFound(_0x571bdb,null))[_0xc6bf('0x28')](removeEntity(_0x571bdb,null))[_0xc6bf('0x38')](handleError(_0x571bdb,null));};function widgetAttributes(_0x59b561){try{switch(_0x59b561['type']){case'iframe':return[{'name':_0xc6bf('0x3a'),'value':_0x59b561[_0xc6bf('0x3a')]||(_0x59b561[_0xc6bf('0x3b')]&&_0x59b561['attrs'][0x0]?_0x59b561[_0xc6bf('0x3b')][0x0]['value']:undefined)||'https://'}];case _0xc6bf('0x3c'):return[{'name':_0xc6bf('0x3d'),'value':_0x59b561[_0xc6bf('0x3d')]||(_0x59b561['attrs']&&_0x59b561['attrs'][0x0]?_0x59b561[_0xc6bf('0x3b')][0x0][_0xc6bf('0x3e')]:undefined)||''}];case _0xc6bf('0x3f'):return[{'name':_0xc6bf('0x40'),'value':_0x59b561[_0xc6bf('0x40')]||(_0x59b561[_0xc6bf('0x3b')]&&_0x59b561[_0xc6bf('0x3b')][0x0]?_0x59b561['attrs'][0x0][_0xc6bf('0x3e')]:undefined)||_0xc6bf('0x41')},{'name':_0xc6bf('0x42'),'value':_0x59b561['attrTimezone']||(_0x59b561[_0xc6bf('0x3b')]&&_0x59b561[_0xc6bf('0x3b')][0x1]?_0x59b561[_0xc6bf('0x3b')][0x1]['value']:undefined)||'0.00'},{'name':'attrFontSize','value':_0x59b561['attrFontSize']||(_0x59b561[_0xc6bf('0x3b')]&&_0x59b561[_0xc6bf('0x3b')][0x2]?_0x59b561['attrs'][0x2]['value']:undefined)||0xc}];case _0xc6bf('0x43'):return[{'name':_0xc6bf('0x44'),'value':_0x59b561[_0xc6bf('0x44')]||(_0x59b561['attrs']&&_0x59b561[_0xc6bf('0x3b')][0x0]?_0x59b561[_0xc6bf('0x3b')][0x0][_0xc6bf('0x3e')]:undefined)||_0xc6bf('0x45')},{'name':_0xc6bf('0x46'),'value':_0x59b561[_0xc6bf('0x46')]||(_0x59b561[_0xc6bf('0x3b')]&&_0x59b561['attrs'][0x1]?_0x59b561['attrs'][0x1][_0xc6bf('0x3e')]:undefined)||[]},{'name':_0xc6bf('0x47'),'value':_0x59b561[_0xc6bf('0x47')]||(_0x59b561[_0xc6bf('0x3b')]&&_0x59b561[_0xc6bf('0x3b')][0x2]?_0x59b561[_0xc6bf('0x3b')][0x2][_0xc6bf('0x3e')]:undefined)||0x14},{'name':_0xc6bf('0x48'),'value':_0x59b561[_0xc6bf('0x48')]||(_0x59b561[_0xc6bf('0x3b')]&&_0x59b561[_0xc6bf('0x3b')][0x3]?_0x59b561[_0xc6bf('0x3b')][0x3][_0xc6bf('0x3e')]:undefined)||_0xc6bf('0x49')},{'name':_0xc6bf('0x4a'),'value':_0x59b561[_0xc6bf('0x4a')]||(_0x59b561[_0xc6bf('0x3b')]&&_0x59b561['attrs'][0x4]?_0x59b561[_0xc6bf('0x3b')][0x4][_0xc6bf('0x3e')]:undefined)||''},{'name':_0xc6bf('0x4b'),'value':_0x59b561[_0xc6bf('0x4b')]||(_0x59b561['attrs']&&_0x59b561[_0xc6bf('0x3b')][0x5]?_0x59b561[_0xc6bf('0x3b')][0x5][_0xc6bf('0x3e')]:undefined)||''},{'name':'attrSmsAccounts','value':_0x59b561[_0xc6bf('0x4c')]||(_0x59b561[_0xc6bf('0x3b')]&&_0x59b561[_0xc6bf('0x3b')][0x6]?_0x59b561[_0xc6bf('0x3b')][0x6]['value']:undefined)||''},{'name':_0xc6bf('0x4d'),'value':_0x59b561[_0xc6bf('0x4d')]||(_0x59b561[_0xc6bf('0x3b')]&&_0x59b561['attrs'][0x7]?_0x59b561['attrs'][0x7]['value']:undefined)||''},{'name':_0xc6bf('0x4e'),'value':_0x59b561['attrWhatsappAccounts']||(_0x59b561['attrs']&&_0x59b561[_0xc6bf('0x3b')][0x8]?_0x59b561['attrs'][0x8][_0xc6bf('0x3e')]:undefined)||''},{'name':_0xc6bf('0x4f'),'value':_0x59b561[_0xc6bf('0x4f')]||(_0x59b561[_0xc6bf('0x3b')]&&_0x59b561[_0xc6bf('0x3b')][0x9]?_0x59b561[_0xc6bf('0x3b')][0x9][_0xc6bf('0x3e')]:undefined)||''}];case _0xc6bf('0x50'):case _0xc6bf('0x51'):return[{'name':_0xc6bf('0x52'),'value':_0x59b561[_0xc6bf('0x52')]||(_0x59b561['attrs']&&_0x59b561['attrs'][0x0]?_0x59b561['attrs'][0x0][_0xc6bf('0x3e')]:undefined)||_0xc6bf('0x45')},{'name':'attrSerie2','value':_0x59b561['attrSerie2']||(_0x59b561['attrs']&&_0x59b561[_0xc6bf('0x3b')][0x1]?_0x59b561[_0xc6bf('0x3b')][0x1][_0xc6bf('0x3e')]:undefined)||null},{'name':'attrSerie3','value':_0x59b561[_0xc6bf('0x53')]||(_0x59b561[_0xc6bf('0x3b')]&&_0x59b561['attrs'][0x2]?_0x59b561[_0xc6bf('0x3b')][0x2][_0xc6bf('0x3e')]:undefined)||null},{'name':_0xc6bf('0x46'),'value':_0x59b561[_0xc6bf('0x46')]||(_0x59b561[_0xc6bf('0x3b')]&&_0x59b561[_0xc6bf('0x3b')][0x3]?_0x59b561['attrs'][0x3]['value']:undefined)||[]},{'name':_0xc6bf('0x48'),'value':_0x59b561[_0xc6bf('0x48')]||(_0x59b561[_0xc6bf('0x3b')]&&_0x59b561[_0xc6bf('0x3b')][0x4]?_0x59b561['attrs'][0x4][_0xc6bf('0x3e')]:undefined)||_0xc6bf('0x49')},{'name':_0xc6bf('0x4a'),'value':_0x59b561[_0xc6bf('0x4a')]||(_0x59b561[_0xc6bf('0x3b')]&&_0x59b561['attrs'][0x5]?_0x59b561[_0xc6bf('0x3b')][0x5][_0xc6bf('0x3e')]:undefined)||''},{'name':_0xc6bf('0x4b'),'value':_0x59b561[_0xc6bf('0x4b')]||(_0x59b561[_0xc6bf('0x3b')]&&_0x59b561[_0xc6bf('0x3b')][0x6]?_0x59b561['attrs'][0x6][_0xc6bf('0x3e')]:undefined)||''},{'name':_0xc6bf('0x4c'),'value':_0x59b561['attrSmsAccounts']||(_0x59b561[_0xc6bf('0x3b')]&&_0x59b561[_0xc6bf('0x3b')][0x7]?_0x59b561['attrs'][0x7]['value']:undefined)||''},{'name':_0xc6bf('0x4d'),'value':_0x59b561[_0xc6bf('0x4d')]||(_0x59b561[_0xc6bf('0x3b')]&&_0x59b561[_0xc6bf('0x3b')][0x8]?_0x59b561[_0xc6bf('0x3b')][0x8][_0xc6bf('0x3e')]:undefined)||''},{'name':_0xc6bf('0x4e'),'value':_0x59b561['attrWhatsappAccounts']||(_0x59b561['attrs']&&_0x59b561[_0xc6bf('0x3b')][0x9]?_0x59b561[_0xc6bf('0x3b')][0x9][_0xc6bf('0x3e')]:undefined)||''},{'name':_0xc6bf('0x4f'),'value':_0x59b561[_0xc6bf('0x4f')]||(_0x59b561['attrs']&&_0x59b561[_0xc6bf('0x3b')][0xa]?_0x59b561[_0xc6bf('0x3b')][0xa][_0xc6bf('0x3e')]:undefined)||''}];case'web-report':return[{'name':'attrReport','type':_0x59b561[_0xc6bf('0x54')]||(_0x59b561[_0xc6bf('0x3b')]&&_0x59b561[_0xc6bf('0x3b')][0x0]?_0x59b561[_0xc6bf('0x3b')][0x0]['type']:undefined)||null,'value':_0x59b561['attrReport']||(_0x59b561[_0xc6bf('0x3b')]&&_0x59b561[_0xc6bf('0x3b')][0x0]?_0x59b561[_0xc6bf('0x3b')][0x0][_0xc6bf('0x3e')]:undefined)||null},{'name':_0xc6bf('0x55'),'value':_0x59b561[_0xc6bf('0x55')]||(_0x59b561['attrs']&&_0x59b561['attrs'][0x1]?_0x59b561[_0xc6bf('0x3b')][0x1][_0xc6bf('0x3e')]:undefined)||0x0}];default:return[];}}catch(_0x3ea421){logger[_0xc6bf('0x56')](_0xc6bf('0x57'),JSON[_0xc6bf('0x58')](_0x3ea421));return[];}}exports['create']=function(_0x1c724c,_0x49b1dd){if(_0x1c724c[_0xc6bf('0x59')]){_0x1c724c[_0xc6bf('0x59')][_0xc6bf('0x3b')]=widgetAttributes(_0x1c724c[_0xc6bf('0x59')]);}return db[_0xc6bf('0x2e')]['create'](_0x1c724c['body'],{})['then'](respondWithResult(_0x49b1dd,0xc9))['catch'](handleError(_0x49b1dd,null));};exports[_0xc6bf('0x26')]=function(_0x4e60a6,_0x3e07e5){if(_0x4e60a6[_0xc6bf('0x59')]['id']){delete _0x4e60a6[_0xc6bf('0x59')]['id'];}_0x4e60a6[_0xc6bf('0x59')][_0xc6bf('0x3b')]=widgetAttributes(_0x4e60a6[_0xc6bf('0x59')]);return db[_0xc6bf('0x2e')][_0xc6bf('0x39')]({'where':{'id':_0x4e60a6[_0xc6bf('0x2b')]['id']}})[_0xc6bf('0x28')](handleEntityNotFound(_0x3e07e5,null))['then'](saveUpdates(_0x4e60a6['body'],null))[_0xc6bf('0x28')](respondWithResult(_0x3e07e5,null))['catch'](handleError(_0x3e07e5,null));}; \ No newline at end of file +var _0x446c=['fields','length','includeAll','include','merge','options','catch','DashboardItem','type','attrUrl','attrs','value','https://','attrPath','clock','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','counter','attrMetric','total','attrVoiceQueues','attrChannel','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','attrSerie1','attrSerie2','attrSerie3','voice','attrEmailAccounts','web-report','attrReport','widgetAttributes:\x20%s','create','body','find','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','ejs','fs-extra','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./dashboardItem.socket','register','sendStatus','status','json','offset','limit','undefined','count','set','apply','reject','save','update','then','destroy','end','error','stack','name','send','show','params','model','keys','query','filters','intersection','attributes'];(function(_0x1851e1,_0x2e5eb9){var _0xe07d74=function(_0x5a15db){while(--_0x5a15db){_0x1851e1['push'](_0x1851e1['shift']());}};_0xe07d74(++_0x2e5eb9);}(_0x446c,0x156));var _0xc446=function(_0x3be7ff,_0x12e714){_0x3be7ff=_0x3be7ff-0x0;var _0x186721=_0x446c[_0x3be7ff];return _0x186721;};'use strict';var emlformat=require(_0xc446('0x0'));var rimraf=require(_0xc446('0x1'));var zipdir=require(_0xc446('0x2'));var jsonpatch=require(_0xc446('0x3'));var rp=require('request-promise');var moment=require(_0xc446('0x4'));var BPromise=require(_0xc446('0x5'));var Mustache=require(_0xc446('0x6'));var util=require('util');var path=require(_0xc446('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xc446('0x8'));var fs=require('fs');var fs_extra=require(_0xc446('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xc446('0xa'));var jsforce=require(_0xc446('0xb'));var deskjs=require(_0xc446('0xc'));var toCsv=require(_0xc446('0xd'));var querystring=require(_0xc446('0xe'));var Papa=require('papaparse');var Redis=require(_0xc446('0xf'));var authService=require(_0xc446('0x10'));var qs=require(_0xc446('0x11'));var as=require(_0xc446('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xc446('0x13'))(_0xc446('0x14'));var utils=require(_0xc446('0x15'));var config=require(_0xc446('0x16'));var licenseUtil=require(_0xc446('0x17'));var db=require(_0xc446('0x18'))['db'];config[_0xc446('0x19')]=_[_0xc446('0x1a')](config[_0xc446('0x19')],{'host':_0xc446('0x1b'),'port':0x18eb});var socket=require(_0xc446('0x1c'))(new Redis(config[_0xc446('0x19')]));require(_0xc446('0x1d'))[_0xc446('0x1e')](socket);function respondWithStatusCode(_0x21d8e4,_0x20afd7){_0x20afd7=_0x20afd7||0xcc;return function(_0x7229de){if(_0x7229de){return _0x21d8e4[_0xc446('0x1f')](_0x20afd7);}return _0x21d8e4[_0xc446('0x20')](_0x20afd7)['end']();};}function respondWithResult(_0x3ba115,_0x2f90bc){_0x2f90bc=_0x2f90bc||0xc8;return function(_0x412678){if(_0x412678){return _0x3ba115[_0xc446('0x20')](_0x2f90bc)[_0xc446('0x21')](_0x412678);}};}function respondWithFilteredResult(_0x274040,_0x146be5){return function(_0x30038f){if(_0x30038f){var _0x16f337=typeof _0x146be5[_0xc446('0x22')]==='undefined'&&typeof _0x146be5[_0xc446('0x23')]===_0xc446('0x24');var _0x5cd0c1=_0x30038f[_0xc446('0x25')];var _0x16b806=_0x16f337?0x0:_0x146be5[_0xc446('0x22')];var _0x434c94=_0x16f337?_0x30038f[_0xc446('0x25')]:_0x146be5[_0xc446('0x22')]+_0x146be5[_0xc446('0x23')];var _0xc18765;if(_0x434c94>=_0x5cd0c1){_0x434c94=_0x5cd0c1;_0xc18765=0xc8;}else{_0xc18765=0xce;}_0x274040[_0xc446('0x20')](_0xc18765);return _0x274040[_0xc446('0x26')]('Content-Range',_0x16b806+'-'+_0x434c94+'/'+_0x5cd0c1)[_0xc446('0x21')](_0x30038f);}return null;};}function patchUpdates(_0x1ea08b){return function(_0x21dc0e){try{jsonpatch[_0xc446('0x27')](_0x21dc0e,_0x1ea08b,!![]);}catch(_0x3596f4){return BPromise[_0xc446('0x28')](_0x3596f4);}return _0x21dc0e[_0xc446('0x29')]();};}function saveUpdates(_0x1b785a,_0x380fd6){return function(_0x189ee7){if(_0x189ee7){return _0x189ee7[_0xc446('0x2a')](_0x1b785a)[_0xc446('0x2b')](function(_0x25f58d){return _0x25f58d;});}return null;};}function removeEntity(_0x438410,_0x16133b){return function(_0x1d1585){if(_0x1d1585){return _0x1d1585[_0xc446('0x2c')]()['then'](function(){_0x438410[_0xc446('0x20')](0xcc)[_0xc446('0x2d')]();});}};}function handleEntityNotFound(_0x3b0adf,_0x2e5d8d){return function(_0x215cd6){if(!_0x215cd6){_0x3b0adf[_0xc446('0x1f')](0x194);}return _0x215cd6;};}function handleError(_0x5d5aa8,_0x4d62d9){_0x4d62d9=_0x4d62d9||0x1f4;return function(_0x37532c){logger[_0xc446('0x2e')](_0x37532c[_0xc446('0x2f')]);if(_0x37532c[_0xc446('0x30')]){delete _0x37532c['name'];}_0x5d5aa8[_0xc446('0x20')](_0x4d62d9)[_0xc446('0x31')](_0x37532c);};}exports[_0xc446('0x32')]=function(_0x16be29,_0x1bd4e6){var _0x225603={'raw':![],'where':{'id':_0x16be29[_0xc446('0x33')]['id']}},_0x39302a={};_0x39302a[_0xc446('0x34')]=_[_0xc446('0x35')](db['DashboardItem']['rawAttributes']);_0x39302a['query']=_[_0xc446('0x35')](_0x16be29[_0xc446('0x36')]);_0x39302a[_0xc446('0x37')]=_[_0xc446('0x38')](_0x39302a[_0xc446('0x34')],_0x39302a[_0xc446('0x36')]);_0x225603[_0xc446('0x39')]=_['intersection'](_0x39302a[_0xc446('0x34')],qs[_0xc446('0x3a')](_0x16be29[_0xc446('0x36')][_0xc446('0x3a')]));_0x225603[_0xc446('0x39')]=_0x225603['attributes'][_0xc446('0x3b')]?_0x225603[_0xc446('0x39')]:_0x39302a[_0xc446('0x34')];if(_0x16be29[_0xc446('0x36')][_0xc446('0x3c')]){_0x225603[_0xc446('0x3d')]=[{'all':!![]}];}_0x225603=_[_0xc446('0x3e')]({},_0x225603,_0x16be29[_0xc446('0x3f')]);return db['DashboardItem']['find'](_0x225603)[_0xc446('0x2b')](handleEntityNotFound(_0x1bd4e6,null))[_0xc446('0x2b')](respondWithResult(_0x1bd4e6,null))[_0xc446('0x40')](handleError(_0x1bd4e6,null));};exports['destroy']=function(_0x2b4dae,_0x446c5f){return db[_0xc446('0x41')]['find']({'where':{'id':_0x2b4dae['params']['id']}})['then'](handleEntityNotFound(_0x446c5f,null))[_0xc446('0x2b')](removeEntity(_0x446c5f,null))['catch'](handleError(_0x446c5f,null));};function widgetAttributes(_0x8b1c5b){try{switch(_0x8b1c5b[_0xc446('0x42')]){case'iframe':return[{'name':_0xc446('0x43'),'value':_0x8b1c5b[_0xc446('0x43')]||(_0x8b1c5b[_0xc446('0x44')]&&_0x8b1c5b[_0xc446('0x44')][0x0]?_0x8b1c5b['attrs'][0x0][_0xc446('0x45')]:undefined)||_0xc446('0x46')}];case'custom':return[{'name':_0xc446('0x47'),'value':_0x8b1c5b[_0xc446('0x47')]||(_0x8b1c5b[_0xc446('0x44')]&&_0x8b1c5b[_0xc446('0x44')][0x0]?_0x8b1c5b[_0xc446('0x44')][0x0]['value']:undefined)||''}];case _0xc446('0x48'):return[{'name':_0xc446('0x49'),'value':_0x8b1c5b[_0xc446('0x49')]||(_0x8b1c5b[_0xc446('0x44')]&&_0x8b1c5b[_0xc446('0x44')][0x0]?_0x8b1c5b['attrs'][0x0][_0xc446('0x45')]:undefined)||_0xc446('0x4a')},{'name':_0xc446('0x4b'),'value':_0x8b1c5b[_0xc446('0x4b')]||(_0x8b1c5b[_0xc446('0x44')]&&_0x8b1c5b['attrs'][0x1]?_0x8b1c5b[_0xc446('0x44')][0x1]['value']:undefined)||_0xc446('0x4c')},{'name':_0xc446('0x4d'),'value':_0x8b1c5b['attrFontSize']||(_0x8b1c5b[_0xc446('0x44')]&&_0x8b1c5b[_0xc446('0x44')][0x2]?_0x8b1c5b[_0xc446('0x44')][0x2][_0xc446('0x45')]:undefined)||0xc}];case _0xc446('0x4e'):return[{'name':_0xc446('0x4f'),'value':_0x8b1c5b['attrMetric']||(_0x8b1c5b[_0xc446('0x44')]&&_0x8b1c5b[_0xc446('0x44')][0x0]?_0x8b1c5b[_0xc446('0x44')][0x0]['value']:undefined)||_0xc446('0x50')},{'name':_0xc446('0x51'),'value':_0x8b1c5b[_0xc446('0x51')]||(_0x8b1c5b[_0xc446('0x44')]&&_0x8b1c5b[_0xc446('0x44')][0x1]?_0x8b1c5b[_0xc446('0x44')][0x1][_0xc446('0x45')]:undefined)||[]},{'name':_0xc446('0x4d'),'value':_0x8b1c5b[_0xc446('0x4d')]||(_0x8b1c5b[_0xc446('0x44')]&&_0x8b1c5b[_0xc446('0x44')][0x2]?_0x8b1c5b[_0xc446('0x44')][0x2][_0xc446('0x45')]:undefined)||0x14},{'name':_0xc446('0x52'),'value':_0x8b1c5b[_0xc446('0x52')]||(_0x8b1c5b['attrs']&&_0x8b1c5b['attrs'][0x3]?_0x8b1c5b[_0xc446('0x44')][0x3][_0xc446('0x45')]:undefined)||'voice'},{'name':'attrEmailAccounts','value':_0x8b1c5b['attrEmailAccounts']||(_0x8b1c5b['attrs']&&_0x8b1c5b[_0xc446('0x44')][0x4]?_0x8b1c5b[_0xc446('0x44')][0x4][_0xc446('0x45')]:undefined)||''},{'name':_0xc446('0x53'),'value':_0x8b1c5b[_0xc446('0x53')]||(_0x8b1c5b[_0xc446('0x44')]&&_0x8b1c5b[_0xc446('0x44')][0x5]?_0x8b1c5b[_0xc446('0x44')][0x5][_0xc446('0x45')]:undefined)||''},{'name':_0xc446('0x54'),'value':_0x8b1c5b['attrSmsAccounts']||(_0x8b1c5b[_0xc446('0x44')]&&_0x8b1c5b[_0xc446('0x44')][0x6]?_0x8b1c5b[_0xc446('0x44')][0x6]['value']:undefined)||''},{'name':_0xc446('0x55'),'value':_0x8b1c5b['attrOpenchannelAccounts']||(_0x8b1c5b[_0xc446('0x44')]&&_0x8b1c5b[_0xc446('0x44')][0x7]?_0x8b1c5b[_0xc446('0x44')][0x7][_0xc446('0x45')]:undefined)||''},{'name':_0xc446('0x56'),'value':_0x8b1c5b['attrWhatsappAccounts']||(_0x8b1c5b[_0xc446('0x44')]&&_0x8b1c5b['attrs'][0x8]?_0x8b1c5b[_0xc446('0x44')][0x8]['value']:undefined)||''},{'name':_0xc446('0x57'),'value':_0x8b1c5b['attrChatWebsites']||(_0x8b1c5b[_0xc446('0x44')]&&_0x8b1c5b[_0xc446('0x44')][0x9]?_0x8b1c5b['attrs'][0x9]['value']:undefined)||''}];case _0xc446('0x58'):case'pie-chart':return[{'name':_0xc446('0x59'),'value':_0x8b1c5b[_0xc446('0x59')]||(_0x8b1c5b[_0xc446('0x44')]&&_0x8b1c5b[_0xc446('0x44')][0x0]?_0x8b1c5b[_0xc446('0x44')][0x0][_0xc446('0x45')]:undefined)||_0xc446('0x50')},{'name':'attrSerie2','value':_0x8b1c5b[_0xc446('0x5a')]||(_0x8b1c5b[_0xc446('0x44')]&&_0x8b1c5b[_0xc446('0x44')][0x1]?_0x8b1c5b[_0xc446('0x44')][0x1][_0xc446('0x45')]:undefined)||null},{'name':_0xc446('0x5b'),'value':_0x8b1c5b[_0xc446('0x5b')]||(_0x8b1c5b[_0xc446('0x44')]&&_0x8b1c5b[_0xc446('0x44')][0x2]?_0x8b1c5b[_0xc446('0x44')][0x2][_0xc446('0x45')]:undefined)||null},{'name':_0xc446('0x51'),'value':_0x8b1c5b['attrVoiceQueues']||(_0x8b1c5b[_0xc446('0x44')]&&_0x8b1c5b[_0xc446('0x44')][0x3]?_0x8b1c5b[_0xc446('0x44')][0x3][_0xc446('0x45')]:undefined)||[]},{'name':'attrChannel','value':_0x8b1c5b['attrChannel']||(_0x8b1c5b[_0xc446('0x44')]&&_0x8b1c5b['attrs'][0x4]?_0x8b1c5b[_0xc446('0x44')][0x4][_0xc446('0x45')]:undefined)||_0xc446('0x5c')},{'name':'attrEmailAccounts','value':_0x8b1c5b[_0xc446('0x5d')]||(_0x8b1c5b[_0xc446('0x44')]&&_0x8b1c5b[_0xc446('0x44')][0x5]?_0x8b1c5b['attrs'][0x5]['value']:undefined)||''},{'name':_0xc446('0x53'),'value':_0x8b1c5b[_0xc446('0x53')]||(_0x8b1c5b[_0xc446('0x44')]&&_0x8b1c5b[_0xc446('0x44')][0x6]?_0x8b1c5b[_0xc446('0x44')][0x6][_0xc446('0x45')]:undefined)||''},{'name':_0xc446('0x54'),'value':_0x8b1c5b[_0xc446('0x54')]||(_0x8b1c5b[_0xc446('0x44')]&&_0x8b1c5b[_0xc446('0x44')][0x7]?_0x8b1c5b[_0xc446('0x44')][0x7]['value']:undefined)||''},{'name':'attrOpenchannelAccounts','value':_0x8b1c5b['attrOpenchannelAccounts']||(_0x8b1c5b['attrs']&&_0x8b1c5b['attrs'][0x8]?_0x8b1c5b[_0xc446('0x44')][0x8][_0xc446('0x45')]:undefined)||''},{'name':_0xc446('0x56'),'value':_0x8b1c5b[_0xc446('0x56')]||(_0x8b1c5b[_0xc446('0x44')]&&_0x8b1c5b['attrs'][0x9]?_0x8b1c5b[_0xc446('0x44')][0x9]['value']:undefined)||''},{'name':_0xc446('0x57'),'value':_0x8b1c5b[_0xc446('0x57')]||(_0x8b1c5b[_0xc446('0x44')]&&_0x8b1c5b['attrs'][0xa]?_0x8b1c5b[_0xc446('0x44')][0xa]['value']:undefined)||''}];case _0xc446('0x5e'):return[{'name':_0xc446('0x5f'),'type':_0x8b1c5b['reportType']||(_0x8b1c5b[_0xc446('0x44')]&&_0x8b1c5b[_0xc446('0x44')][0x0]?_0x8b1c5b[_0xc446('0x44')][0x0][_0xc446('0x42')]:undefined)||null,'value':_0x8b1c5b['attrReport']||(_0x8b1c5b[_0xc446('0x44')]&&_0x8b1c5b[_0xc446('0x44')][0x0]?_0x8b1c5b[_0xc446('0x44')][0x0][_0xc446('0x45')]:undefined)||null},{'name':'attrRefresh','value':_0x8b1c5b['attrRefresh']||(_0x8b1c5b[_0xc446('0x44')]&&_0x8b1c5b[_0xc446('0x44')][0x1]?_0x8b1c5b[_0xc446('0x44')][0x1][_0xc446('0x45')]:undefined)||0x0}];default:return[];}}catch(_0x18412d){logger[_0xc446('0x2e')](_0xc446('0x60'),JSON['stringify'](_0x18412d));return[];}}exports[_0xc446('0x61')]=function(_0x221671,_0x39f96f){if(_0x221671['body']){_0x221671['body']['attrs']=widgetAttributes(_0x221671['body']);}return db['DashboardItem'][_0xc446('0x61')](_0x221671['body'],{})[_0xc446('0x2b')](respondWithResult(_0x39f96f,0xc9))[_0xc446('0x40')](handleError(_0x39f96f,null));};exports[_0xc446('0x2a')]=function(_0x908141,_0x187dd9){if(_0x908141[_0xc446('0x62')]['id']){delete _0x908141[_0xc446('0x62')]['id'];}_0x908141[_0xc446('0x62')][_0xc446('0x44')]=widgetAttributes(_0x908141[_0xc446('0x62')]);return db['DashboardItem'][_0xc446('0x63')]({'where':{'id':_0x908141[_0xc446('0x33')]['id']}})[_0xc446('0x2b')](handleEntityNotFound(_0x187dd9,null))[_0xc446('0x2b')](saveUpdates(_0x908141['body'],null))[_0xc446('0x2b')](respondWithResult(_0x187dd9,null))[_0xc446('0x40')](handleError(_0x187dd9,null));}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.events.js b/server/api/dashboardItem/dashboardItem.events.js index 57214e3..2028a5f 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 _0xfc8c=['update','hasOwnProperty','exports','events','../../mysqldb','DashboardItem','setMaxListeners','save'];(function(_0x187ee1,_0x486fdd){var _0x174752=function(_0xd96a00){while(--_0xd96a00){_0x187ee1['push'](_0x187ee1['shift']());}};_0x174752(++_0x486fdd);}(_0xfc8c,0x6b));var _0xcfc8=function(_0x54fe1c,_0x5d208c){_0x54fe1c=_0x54fe1c-0x0;var _0x460aaa=_0xfc8c[_0x54fe1c];return _0x460aaa;};'use strict';var EventEmitter=require(_0xcfc8('0x0'));var DashboardItem=require(_0xcfc8('0x1'))['db'][_0xcfc8('0x2')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0xcfc8('0x3')](0x0);var events={'afterCreate':_0xcfc8('0x4'),'afterUpdate':_0xcfc8('0x5'),'afterDestroy':'remove'};function emitEvent(_0x36b866){return function(_0x3f8a7c,_0x59e9c,_0x411628){DashboardItemEvents['emit'](_0x36b866+':'+_0x3f8a7c['id'],_0x3f8a7c);DashboardItemEvents['emit'](_0x36b866,_0x3f8a7c);_0x411628(null);};}for(var e in events){if(events[_0xcfc8('0x6')](e)){var event=events[e];DashboardItem['hook'](e,emitEvent(event));}}module[_0xcfc8('0x7')]=DashboardItemEvents; \ No newline at end of file +var _0xeed2=['update','emit','hasOwnProperty','events','../../mysqldb','DashboardItem','setMaxListeners','save'];(function(_0x5271b6,_0x3b72d9){var _0x56f864=function(_0x93ae1d){while(--_0x93ae1d){_0x5271b6['push'](_0x5271b6['shift']());}};_0x56f864(++_0x3b72d9);}(_0xeed2,0xf3));var _0x2eed=function(_0x3eb305,_0x2b215c){_0x3eb305=_0x3eb305-0x0;var _0x5178b6=_0xeed2[_0x3eb305];return _0x5178b6;};'use strict';var EventEmitter=require(_0x2eed('0x0'));var DashboardItem=require(_0x2eed('0x1'))['db'][_0x2eed('0x2')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0x2eed('0x3')](0x0);var events={'afterCreate':_0x2eed('0x4'),'afterUpdate':_0x2eed('0x5'),'afterDestroy':'remove'};function emitEvent(_0xd5ab3b){return function(_0x408315,_0x45a78d,_0x38df5a){DashboardItemEvents['emit'](_0xd5ab3b+':'+_0x408315['id'],_0x408315);DashboardItemEvents[_0x2eed('0x6')](_0xd5ab3b,_0x408315);_0x38df5a(null);};}for(var e in events){if(events[_0x2eed('0x7')](e)){var event=events[e];DashboardItem['hook'](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 9b028c1..ac27ba8 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 _0x848c=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','DashboardItem','dashboard_items','lodash'];(function(_0x53417c,_0x126dee){var _0x49407d=function(_0x1b1737){while(--_0x1b1737){_0x53417c['push'](_0x53417c['shift']());}};_0x49407d(++_0x126dee);}(_0x848c,0x110));var _0xc848=function(_0x2ad477,_0x323d3a){_0x2ad477=_0x2ad477-0x0;var _0x3083da=_0x848c[_0x2ad477];return _0x3083da;};'use strict';var _=require(_0xc848('0x0'));var util=require(_0xc848('0x1'));var logger=require(_0xc848('0x2'))(_0xc848('0x3'));var moment=require(_0xc848('0x4'));var BPromise=require(_0xc848('0x5'));var rp=require(_0xc848('0x6'));var fs=require('fs');var path=require(_0xc848('0x7'));var rimraf=require(_0xc848('0x8'));var config=require(_0xc848('0x9'));var attributes=require('./dashboardItem.attributes');module[_0xc848('0xa')]=function(_0x415ed5,_0x311b5f){return _0x415ed5['define'](_0xc848('0xb'),attributes,{'tableName':_0xc848('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x435a=['bluebird','request-promise','./dashboardItem.attributes','exports','define','DashboardItem','dashboard_items'];(function(_0x3126ac,_0x48ce78){var _0xe22cc8=function(_0x5bdef5){while(--_0x5bdef5){_0x3126ac['push'](_0x3126ac['shift']());}};_0xe22cc8(++_0x48ce78);}(_0x435a,0x13b));var _0xa435=function(_0x3d829d,_0x5af899){_0x3d829d=_0x3d829d-0x0;var _0x318701=_0x435a[_0x3d829d];return _0x318701;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xa435('0x0'));var rp=require(_0xa435('0x1'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xa435('0x2'));module[_0xa435('0x3')]=function(_0x1a8386,_0xc88a73){return _0x1a8386[_0xa435('0x4')](_0xa435('0x5'),attributes,{'tableName':_0xa435('0x6'),'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 fbd74f6..eb4c978 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 _0x88d9=['rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./dashboardItem.socket','register','request','then','info','DashboardItem,\x20%s,\x20%s','request\x20sent','debug','DashboardItem,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/logger'];(function(_0x13211b,_0x3050c2){var _0x4adb44=function(_0x3885c6){while(--_0x3885c6){_0x13211b['push'](_0x13211b['shift']());}};_0x4adb44(++_0x3050c2);}(_0x88d9,0xa8));var _0x988d=function(_0x422ec5,_0x4da984){_0x422ec5=_0x422ec5-0x0;var _0x2eff46=_0x88d9[_0x422ec5];return _0x2eff46;};'use strict';var _=require(_0x988d('0x0'));var util=require('util');var moment=require(_0x988d('0x1'));var BPromise=require('bluebird');var rs=require(_0x988d('0x2'));var fs=require('fs');var Redis=require(_0x988d('0x3'));var db=require(_0x988d('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x988d('0x5'))(_0x988d('0x6'));var config=require(_0x988d('0x7'));var jayson=require(_0x988d('0x8'));var client=jayson[_0x988d('0x9')][_0x988d('0xa')]({'port':0x232a});config[_0x988d('0xb')]=_[_0x988d('0xc')](config[_0x988d('0xb')],{'host':_0x988d('0xd'),'port':0x18eb});var socket=require(_0x988d('0xe'))(new Redis(config['redis']));require(_0x988d('0xf'))[_0x988d('0x10')](socket);function respondWithRpcPromise(_0x267b97,_0x1e4eb0,_0x4b6dda){return new BPromise(function(_0x56bcc3,_0x508646){return client[_0x988d('0x11')](_0x267b97,_0x4b6dda)[_0x988d('0x12')](function(_0x33e372){logger[_0x988d('0x13')](_0x988d('0x14'),_0x1e4eb0,_0x988d('0x15'));logger[_0x988d('0x16')](_0x988d('0x17'),_0x1e4eb0,'request\x20sent',JSON[_0x988d('0x18')](_0x33e372));if(_0x33e372[_0x988d('0x19')]){if(_0x33e372[_0x988d('0x19')]['code']===0x1f4){logger['error'](_0x988d('0x14'),_0x1e4eb0,_0x33e372[_0x988d('0x19')][_0x988d('0x1a')]);return _0x508646(_0x33e372[_0x988d('0x19')]['message']);}logger[_0x988d('0x19')](_0x988d('0x14'),_0x1e4eb0,_0x33e372[_0x988d('0x19')][_0x988d('0x1a')]);return _0x56bcc3(_0x33e372['error']['message']);}else{logger[_0x988d('0x13')](_0x988d('0x14'),_0x1e4eb0,_0x988d('0x15'));_0x56bcc3(_0x33e372[_0x988d('0x1b')][_0x988d('0x1a')]);}})[_0x988d('0x1c')](function(_0x4b3f8e){logger[_0x988d('0x19')]('DashboardItem,\x20%s,\x20%s',_0x1e4eb0,_0x4b3f8e);_0x508646(_0x4b3f8e);});});} \ No newline at end of file +var _0x99f6=['request\x20sent','debug','stringify','error','code','message','result','catch','lodash','util','moment','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','redis','localhost','./dashboardItem.socket','register','request','info','DashboardItem,\x20%s,\x20%s'];(function(_0x4862d1,_0x534614){var _0x38332f=function(_0x7d066e){while(--_0x7d066e){_0x4862d1['push'](_0x4862d1['shift']());}};_0x38332f(++_0x534614);}(_0x99f6,0x1b8));var _0x699f=function(_0x4ce7b7,_0x9b9ba1){_0x4ce7b7=_0x4ce7b7-0x0;var _0x44591f=_0x99f6[_0x4ce7b7];return _0x44591f;};'use strict';var _=require(_0x699f('0x0'));var util=require(_0x699f('0x1'));var moment=require(_0x699f('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x699f('0x3'))['db'];var utils=require(_0x699f('0x4'));var logger=require('../../config/logger')(_0x699f('0x5'));var config=require('../../config/environment');var jayson=require(_0x699f('0x6'));var client=jayson[_0x699f('0x7')][_0x699f('0x8')]({'port':0x232a});config[_0x699f('0x9')]=_['defaults'](config['redis'],{'host':_0x699f('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x699f('0xb'))[_0x699f('0xc')](socket);function respondWithRpcPromise(_0x52990d,_0xe254a6,_0x5177c0){return new BPromise(function(_0xc214cb,_0x3f8117){return client[_0x699f('0xd')](_0x52990d,_0x5177c0)['then'](function(_0x5d1189){logger[_0x699f('0xe')](_0x699f('0xf'),_0xe254a6,_0x699f('0x10'));logger[_0x699f('0x11')]('DashboardItem,\x20%s,\x20%s,\x20%s',_0xe254a6,_0x699f('0x10'),JSON[_0x699f('0x12')](_0x5d1189));if(_0x5d1189[_0x699f('0x13')]){if(_0x5d1189[_0x699f('0x13')][_0x699f('0x14')]===0x1f4){logger[_0x699f('0x13')]('DashboardItem,\x20%s,\x20%s',_0xe254a6,_0x5d1189['error'][_0x699f('0x15')]);return _0x3f8117(_0x5d1189[_0x699f('0x13')][_0x699f('0x15')]);}logger['error'](_0x699f('0xf'),_0xe254a6,_0x5d1189[_0x699f('0x13')][_0x699f('0x15')]);return _0xc214cb(_0x5d1189[_0x699f('0x13')][_0x699f('0x15')]);}else{logger[_0x699f('0xe')](_0x699f('0xf'),_0xe254a6,_0x699f('0x10'));_0xc214cb(_0x5d1189[_0x699f('0x16')][_0x699f('0x15')]);}})[_0x699f('0x17')](function(_0x4d23dc){logger[_0x699f('0x13')](_0x699f('0xf'),_0xe254a6,_0x4d23dc);_0x3f8117(_0x4d23dc);});});} \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.socket.js b/server/api/dashboardItem/dashboardItem.socket.js index 1f0ceaf..d3f364a 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 _0xfcd2=['emit','register','dashboardItem:','./dashboardItem.events','save','update'];(function(_0xdea41a,_0x552987){var _0x15d0d8=function(_0x1e0d0b){while(--_0x1e0d0b){_0xdea41a['push'](_0xdea41a['shift']());}};_0x15d0d8(++_0x552987);}(_0xfcd2,0xcf));var _0x2fcd=function(_0x1700d9,_0x244f75){_0x1700d9=_0x1700d9-0x0;var _0x23e78d=_0xfcd2[_0x1700d9];return _0x23e78d;};'use strict';var DashboardItemEvents=require(_0x2fcd('0x0'));var events=[_0x2fcd('0x1'),'remove',_0x2fcd('0x2')];function createListener(_0x294e03,_0x306583){return function(_0x5f16f2){_0x306583[_0x2fcd('0x3')](_0x294e03,_0x5f16f2);};}function removeListener(_0x516a93,_0x489668){return function(){DashboardItemEvents['removeListener'](_0x516a93,_0x489668);};}exports[_0x2fcd('0x4')]=function(_0x20aa02){for(var _0x52ae92=0x0,_0x2a1f50=events['length'];_0x52ae92<_0x2a1f50;_0x52ae92++){var _0x5adc26=events[_0x52ae92];var _0x5030d3=createListener(_0x2fcd('0x5')+_0x5adc26,_0x20aa02);DashboardItemEvents['on'](_0x5adc26,_0x5030d3);}}; \ No newline at end of file +var _0xe130=['emit','removeListener','register','length','dashboardItem:','remove'];(function(_0x299157,_0x12cca6){var _0x225ba0=function(_0x1ab76c){while(--_0x1ab76c){_0x299157['push'](_0x299157['shift']());}};_0x225ba0(++_0x12cca6);}(_0xe130,0x113));var _0x0e13=function(_0x517578,_0x453afc){_0x517578=_0x517578-0x0;var _0x1b3a20=_0xe130[_0x517578];return _0x1b3a20;};'use strict';var DashboardItemEvents=require('./dashboardItem.events');var events=['save',_0x0e13('0x0'),'update'];function createListener(_0x2d4446,_0xc6371e){return function(_0xf5d65e){_0xc6371e[_0x0e13('0x1')](_0x2d4446,_0xf5d65e);};}function removeListener(_0x292f6b,_0x63840e){return function(){DashboardItemEvents[_0x0e13('0x2')](_0x292f6b,_0x63840e);};}exports[_0x0e13('0x3')]=function(_0x50ffaf){for(var _0x25dffe=0x0,_0x21a8fd=events[_0x0e13('0x4')];_0x25dffe<_0x21a8fd;_0x25dffe++){var _0x51eeac=events[_0x25dffe];var _0x5a5ded=createListener(_0x0e13('0x5')+_0x51eeac,_0x50ffaf);DashboardItemEvents['on'](_0x51eeac,_0x5a5ded);}}; \ No newline at end of file diff --git a/server/api/dashboardItem/index.js b/server/api/dashboardItem/index.js index 1ebe0a8..acd3b33 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 _0x5100=['/:id','update','delete','exports','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./dashboardItem.controller','get','isAuthenticated','show','post','create','put'];(function(_0x21fc68,_0x459828){var _0x3561e1=function(_0x3dea77){while(--_0x3dea77){_0x21fc68['push'](_0x21fc68['shift']());}};_0x3561e1(++_0x459828);}(_0x5100,0xc2));var _0x0510=function(_0x44fb3d,_0x206053){_0x44fb3d=_0x44fb3d-0x0;var _0x3bdaed=_0x5100[_0x44fb3d];return _0x3bdaed;};'use strict';var multer=require('multer');var util=require(_0x0510('0x0'));var path=require(_0x0510('0x1'));var timeout=require(_0x0510('0x2'));var express=require('express');var router=express[_0x0510('0x3')]();var fs_extra=require(_0x0510('0x4'));var auth=require(_0x0510('0x5'));var interaction=require(_0x0510('0x6'));var config=require(_0x0510('0x7'));var controller=require(_0x0510('0x8'));router[_0x0510('0x9')]('/:id',auth[_0x0510('0xa')](),controller[_0x0510('0xb')]);router[_0x0510('0xc')]('/',auth[_0x0510('0xa')](),controller[_0x0510('0xd')]);router[_0x0510('0xe')](_0x0510('0xf'),auth[_0x0510('0xa')](),controller[_0x0510('0x10')]);router[_0x0510('0x11')](_0x0510('0xf'),auth[_0x0510('0xa')](),controller['destroy']);module[_0x0510('0x12')]=router; \ No newline at end of file +var _0x682d=['update','destroy','exports','multer','path','connect-timeout','Router','fs-extra','../../config/environment','./dashboardItem.controller','isAuthenticated','post','create','put'];(function(_0x491197,_0x3cee6a){var _0x57051d=function(_0x3f51bb){while(--_0x3f51bb){_0x491197['push'](_0x491197['shift']());}};_0x57051d(++_0x3cee6a);}(_0x682d,0x1b5));var _0xd682=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x682d[_0x14add3];return _0x4a174f;};'use strict';var multer=require(_0xd682('0x0'));var util=require('util');var path=require(_0xd682('0x1'));var timeout=require(_0xd682('0x2'));var express=require('express');var router=express[_0xd682('0x3')]();var fs_extra=require(_0xd682('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xd682('0x5'));var controller=require(_0xd682('0x6'));router['get']('/:id',auth[_0xd682('0x7')](),controller['show']);router[_0xd682('0x8')]('/',auth[_0xd682('0x7')](),controller[_0xd682('0x9')]);router[_0xd682('0xa')]('/:id',auth[_0xd682('0x7')](),controller[_0xd682('0xb')]);router['delete']('/:id',auth[_0xd682('0x7')](),controller[_0xd682('0xc')]);module[_0xd682('0xd')]=router; \ No newline at end of file diff --git a/server/api/disposition/disposition.attributes.js b/server/api/disposition/disposition.attributes.js index ecc9ff2..20d6426 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 _0x323b=['exports','STRING','second','third','sequelize'];(function(_0x40ac5e,_0x2de228){var _0x2839d6=function(_0x123d47){while(--_0x123d47){_0x40ac5e['push'](_0x40ac5e['shift']());}};_0x2839d6(++_0x2de228);}(_0x323b,0x8b));var _0xb323=function(_0x289ff5,_0x1ef955){_0x289ff5=_0x289ff5-0x0;var _0x42e8bc=_0x323b[_0x289ff5];return _0x42e8bc;};'use strict';var Sequelize=require(_0xb323('0x0'));module[_0xb323('0x1')]={'name':{'type':Sequelize[_0xb323('0x2')],'allowNull':![]},'level':{'type':Sequelize['ENUM']('first',_0xb323('0x3'),_0xb323('0x4')),'allowNull':![],'defaultValue':'first'},'description':{'type':Sequelize[_0xb323('0x2')]}}; \ No newline at end of file +var _0xbdb1=['second','third','exports','STRING','ENUM','first'];(function(_0x437d59,_0x5a52ac){var _0x32e950=function(_0x4ad939){while(--_0x4ad939){_0x437d59['push'](_0x437d59['shift']());}};_0x32e950(++_0x5a52ac);}(_0xbdb1,0x13a));var _0x1bdb=function(_0x4907de,_0x5bbdc6){_0x4907de=_0x4907de-0x0;var _0x482054=_0xbdb1[_0x4907de];return _0x482054;};'use strict';var Sequelize=require('sequelize');module[_0x1bdb('0x0')]={'name':{'type':Sequelize[_0x1bdb('0x1')],'allowNull':![]},'level':{'type':Sequelize[_0x1bdb('0x2')](_0x1bdb('0x3'),_0x1bdb('0x4'),_0x1bdb('0x5')),'allowNull':![],'defaultValue':'first'},'description':{'type':Sequelize[_0x1bdb('0x1')]}}; \ No newline at end of file diff --git a/server/api/disposition/disposition.controller.js b/server/api/disposition/disposition.controller.js index 4eab239..ca6c36b 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 _0x38ec=['body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','sendStatus','status','end','json','offset','limit','undefined','count','Content-Range','apply','reject','save','then','destroy','get','Dispositions','UserProfileResource','error','stack','name','index','map','Disposition','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','includeAll','include','findAll','rows','catch','params','options','find','create','user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update'];(function(_0x4264ee,_0x520320){var _0x46d043=function(_0x4636e8){while(--_0x4636e8){_0x4264ee['push'](_0x4264ee['shift']());}};_0x46d043(++_0x520320);}(_0x38ec,0xfa));var _0xc38e=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x38ec[_0xa464c9];return _0x3d73c4;};'use strict';var emlformat=require(_0xc38e('0x0'));var rimraf=require(_0xc38e('0x1'));var zipdir=require(_0xc38e('0x2'));var jsonpatch=require(_0xc38e('0x3'));var rp=require(_0xc38e('0x4'));var moment=require(_0xc38e('0x5'));var BPromise=require(_0xc38e('0x6'));var Mustache=require(_0xc38e('0x7'));var util=require(_0xc38e('0x8'));var path=require('path');var sox=require(_0xc38e('0x9'));var csv=require(_0xc38e('0xa'));var ejs=require(_0xc38e('0xb'));var fs=require('fs');var fs_extra=require(_0xc38e('0xc'));var _=require(_0xc38e('0xd'));var squel=require(_0xc38e('0xe'));var crypto=require(_0xc38e('0xf'));var jsforce=require(_0xc38e('0x10'));var deskjs=require(_0xc38e('0x11'));var toCsv=require(_0xc38e('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xc38e('0x12'));var authService=require(_0xc38e('0x13'));var qs=require(_0xc38e('0x14'));var as=require(_0xc38e('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xc38e('0x16'))(_0xc38e('0x17'));var utils=require('../../config/utils');var config=require(_0xc38e('0x18'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x259a4d,_0x3e90ab){_0x3e90ab=_0x3e90ab||0xcc;return function(_0x3c808d){if(_0x3c808d){return _0x259a4d[_0xc38e('0x19')](_0x3e90ab);}return _0x259a4d[_0xc38e('0x1a')](_0x3e90ab)[_0xc38e('0x1b')]();};}function respondWithResult(_0x32273a,_0x33e11a){_0x33e11a=_0x33e11a||0xc8;return function(_0x4f6f89){if(_0x4f6f89){return _0x32273a[_0xc38e('0x1a')](_0x33e11a)[_0xc38e('0x1c')](_0x4f6f89);}};}function respondWithFilteredResult(_0x5cb21f,_0x10fee9){return function(_0x13c707){if(_0x13c707){var _0x1d189f=typeof _0x10fee9[_0xc38e('0x1d')]==='undefined'&&typeof _0x10fee9[_0xc38e('0x1e')]===_0xc38e('0x1f');var _0x38be21=_0x13c707[_0xc38e('0x20')];var _0x29a89b=_0x1d189f?0x0:_0x10fee9[_0xc38e('0x1d')];var _0x14d09f=_0x1d189f?_0x13c707[_0xc38e('0x20')]:_0x10fee9[_0xc38e('0x1d')]+_0x10fee9[_0xc38e('0x1e')];var _0x38e4af;if(_0x14d09f>=_0x38be21){_0x14d09f=_0x38be21;_0x38e4af=0xc8;}else{_0x38e4af=0xce;}_0x5cb21f[_0xc38e('0x1a')](_0x38e4af);return _0x5cb21f['set'](_0xc38e('0x21'),_0x29a89b+'-'+_0x14d09f+'/'+_0x38be21)[_0xc38e('0x1c')](_0x13c707);}return null;};}function patchUpdates(_0x5d8a6c){return function(_0x48e7d4){try{jsonpatch[_0xc38e('0x22')](_0x48e7d4,_0x5d8a6c,!![]);}catch(_0x16f781){return BPromise[_0xc38e('0x23')](_0x16f781);}return _0x48e7d4[_0xc38e('0x24')]();};}function saveUpdates(_0x135f77,_0x45ad96){return function(_0x4bdd5d){if(_0x4bdd5d){return _0x4bdd5d['update'](_0x135f77)[_0xc38e('0x25')](function(_0x388918){return _0x388918;});}return null;};}function removeEntity(_0x4cf9d3,_0xcc1fa){return function(_0x538398){if(_0x538398){return _0x538398[_0xc38e('0x26')]()[_0xc38e('0x25')](function(){var _0x12528c=_0x538398[_0xc38e('0x27')]({'plain':!![]});var _0x35c2de=_0xc38e('0x28');return db[_0xc38e('0x29')]['destroy']({'where':{'type':_0x35c2de,'resourceId':_0x12528c['id']}})['then'](function(){return _0x538398;});})['then'](function(){_0x4cf9d3[_0xc38e('0x1a')](0xcc)[_0xc38e('0x1b')]();});}};}function handleEntityNotFound(_0x3a6203,_0x2b3963){return function(_0x19b6c3){if(!_0x19b6c3){_0x3a6203[_0xc38e('0x19')](0x194);}return _0x19b6c3;};}function handleError(_0x26e70d,_0x2621b2){_0x2621b2=_0x2621b2||0x1f4;return function(_0x76853f){logger[_0xc38e('0x2a')](_0x76853f[_0xc38e('0x2b')]);if(_0x76853f[_0xc38e('0x2c')]){delete _0x76853f[_0xc38e('0x2c')];}_0x26e70d[_0xc38e('0x1a')](_0x2621b2)['send'](_0x76853f);};}exports[_0xc38e('0x2d')]=function(_0x105a8a,_0x35e567){var _0x1f9200={},_0x1880ed={},_0x6dea58={'count':0x0,'rows':[]};var _0x4b2128=_[_0xc38e('0x2e')](db[_0xc38e('0x2f')][_0xc38e('0x30')],function(_0x2eb3a5){return{'name':_0x2eb3a5[_0xc38e('0x31')],'type':_0x2eb3a5[_0xc38e('0x32')][_0xc38e('0x33')]};});_0x1880ed[_0xc38e('0x34')]=_[_0xc38e('0x2e')](_0x4b2128,_0xc38e('0x2c'));_0x1880ed[_0xc38e('0x35')]=_[_0xc38e('0x36')](_0x105a8a[_0xc38e('0x35')]);_0x1880ed[_0xc38e('0x37')]=_[_0xc38e('0x38')](_0x1880ed[_0xc38e('0x34')],_0x1880ed['query']);_0x1f9200['attributes']=_[_0xc38e('0x38')](_0x1880ed[_0xc38e('0x34')],qs[_0xc38e('0x39')](_0x105a8a[_0xc38e('0x35')][_0xc38e('0x39')]));_0x1f9200[_0xc38e('0x3a')]=_0x1f9200['attributes'][_0xc38e('0x3b')]?_0x1f9200[_0xc38e('0x3a')]:_0x1880ed[_0xc38e('0x34')];if(!_0x105a8a[_0xc38e('0x35')][_0xc38e('0x3c')](_0xc38e('0x3d'))){_0x1f9200[_0xc38e('0x1e')]=qs[_0xc38e('0x1e')](_0x105a8a[_0xc38e('0x35')]['limit']);_0x1f9200[_0xc38e('0x1d')]=qs['offset'](_0x105a8a[_0xc38e('0x35')][_0xc38e('0x1d')]);}_0x1f9200[_0xc38e('0x3e')]=qs[_0xc38e('0x3f')](_0x105a8a[_0xc38e('0x35')][_0xc38e('0x3f')]);_0x1f9200[_0xc38e('0x40')]=qs[_0xc38e('0x37')](_[_0xc38e('0x41')](_0x105a8a[_0xc38e('0x35')],_0x1880ed[_0xc38e('0x37')]),_0x4b2128);if(_0x105a8a[_0xc38e('0x35')]['filter']){_0x1f9200[_0xc38e('0x40')]=_[_0xc38e('0x42')](_0x1f9200[_0xc38e('0x40')],{'$or':_[_0xc38e('0x2e')](_0x4b2128,function(_0x4a5b19){if(_0x4a5b19[_0xc38e('0x32')]!=='VIRTUAL'){var _0x18a805={};_0x18a805[_0x4a5b19[_0xc38e('0x2c')]]={'$like':'%'+_0x105a8a[_0xc38e('0x35')]['filter']+'%'};return _0x18a805;}})});}_0x1f9200=_['merge']({},_0x1f9200,_0x105a8a['options']);var _0x502365={'where':_0x1f9200[_0xc38e('0x40')]};return db['Disposition'][_0xc38e('0x20')](_0x502365)['then'](function(_0xc879d3){_0x6dea58[_0xc38e('0x20')]=_0xc879d3;if(_0x105a8a[_0xc38e('0x35')][_0xc38e('0x43')]){_0x1f9200[_0xc38e('0x44')]=[{'all':!![]}];}return db['Disposition'][_0xc38e('0x45')](_0x1f9200);})[_0xc38e('0x25')](function(_0x42287c){_0x6dea58[_0xc38e('0x46')]=_0x42287c;return _0x6dea58;})[_0xc38e('0x25')](respondWithFilteredResult(_0x35e567,_0x1f9200))[_0xc38e('0x47')](handleError(_0x35e567,null));};exports['show']=function(_0xead33f,_0x3f51ef){var _0x1bf043={'raw':!![],'where':{'id':_0xead33f[_0xc38e('0x48')]['id']}},_0x4fd907={};_0x4fd907[_0xc38e('0x34')]=_['keys'](db[_0xc38e('0x2f')]['rawAttributes']);_0x4fd907['query']=_[_0xc38e('0x36')](_0xead33f[_0xc38e('0x35')]);_0x4fd907[_0xc38e('0x37')]=_['intersection'](_0x4fd907['model'],_0x4fd907[_0xc38e('0x35')]);_0x1bf043[_0xc38e('0x3a')]=_[_0xc38e('0x38')](_0x4fd907[_0xc38e('0x34')],qs[_0xc38e('0x39')](_0xead33f[_0xc38e('0x35')][_0xc38e('0x39')]));_0x1bf043[_0xc38e('0x3a')]=_0x1bf043[_0xc38e('0x3a')]['length']?_0x1bf043['attributes']:_0x4fd907['model'];if(_0xead33f[_0xc38e('0x35')][_0xc38e('0x43')]){_0x1bf043[_0xc38e('0x44')]=[{'all':!![]}];}_0x1bf043=_[_0xc38e('0x42')]({},_0x1bf043,_0xead33f[_0xc38e('0x49')]);return db[_0xc38e('0x2f')][_0xc38e('0x4a')](_0x1bf043)[_0xc38e('0x25')](handleEntityNotFound(_0x3f51ef,null))[_0xc38e('0x25')](respondWithResult(_0x3f51ef,null))[_0xc38e('0x47')](handleError(_0x3f51ef,null));};exports[_0xc38e('0x4b')]=function(_0x3c93,_0x28ae3a){return db['Disposition'][_0xc38e('0x4b')](_0x3c93['body'],{})[_0xc38e('0x25')](function(_0x290404){var _0x3c1ac4=_0x3c93[_0xc38e('0x4c')][_0xc38e('0x27')]({'plain':!![]});if(!_0x3c1ac4)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3c1ac4[_0xc38e('0x4d')]===_0xc38e('0x4c')){var _0x1d95e9=_0x290404[_0xc38e('0x27')]({'plain':!![]});var _0x4df5d4='Dispositions';return db['UserProfileSection'][_0xc38e('0x4a')]({'where':{'name':_0x4df5d4,'userProfileId':_0x3c1ac4[_0xc38e('0x4e')]},'raw':!![]})['then'](function(_0x143a17){if(_0x143a17&&_0x143a17[_0xc38e('0x4f')]===0x0){return db['UserProfileResource']['create']({'name':_0x1d95e9[_0xc38e('0x2c')],'resourceId':_0x1d95e9['id'],'type':_0x143a17[_0xc38e('0x2c')],'sectionId':_0x143a17['id']},{})['then'](function(){return _0x290404;});}else{return _0x290404;}})[_0xc38e('0x47')](function(_0x41881a){logger[_0xc38e('0x2a')](_0xc38e('0x50'),_0x41881a);throw _0x41881a;});}return _0x290404;})['then'](respondWithResult(_0x28ae3a,0xc9))[_0xc38e('0x47')](handleError(_0x28ae3a,null));};exports[_0xc38e('0x51')]=function(_0xba6652,_0x1cf4c7){if(_0xba6652[_0xc38e('0x52')]['id']){delete _0xba6652[_0xc38e('0x52')]['id'];}return db['Disposition'][_0xc38e('0x4a')]({'where':{'id':_0xba6652[_0xc38e('0x48')]['id']}})['then'](handleEntityNotFound(_0x1cf4c7,null))['then'](saveUpdates(_0xba6652['body'],null))[_0xc38e('0x25')](respondWithResult(_0x1cf4c7,null))[_0xc38e('0x47')](handleError(_0x1cf4c7,null));};exports['destroy']=function(_0x38c5ce,_0x17916d){return db[_0xc38e('0x2f')][_0xc38e('0x4a')]({'where':{'id':_0x38c5ce[_0xc38e('0x48')]['id']}})[_0xc38e('0x25')](handleEntityNotFound(_0x17916d,null))[_0xc38e('0x25')](removeEntity(_0x17916d,null))[_0xc38e('0x47')](handleError(_0x17916d,null));}; \ No newline at end of file +var _0x38e7=['index','map','Disposition','rawAttributes','fieldName','type','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','show','params','find','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','count','limit','Content-Range','apply','reject','save','then','destroy','Dispositions','UserProfileResource','error','stack','name'];(function(_0x2d2c16,_0x4e88b6){var _0x53f2fb=function(_0x6b6dac){while(--_0x6b6dac){_0x2d2c16['push'](_0x2d2c16['shift']());}};_0x53f2fb(++_0x4e88b6);}(_0x38e7,0x124));var _0x738e=function(_0x1af05b,_0x5134b5){_0x1af05b=_0x1af05b-0x0;var _0x5be7cc=_0x38e7[_0x1af05b];return _0x5be7cc;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x738e('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x738e('0x1'));var rp=require(_0x738e('0x2'));var moment=require(_0x738e('0x3'));var BPromise=require(_0x738e('0x4'));var Mustache=require(_0x738e('0x5'));var util=require(_0x738e('0x6'));var path=require(_0x738e('0x7'));var sox=require('sox');var csv=require(_0x738e('0x8'));var ejs=require(_0x738e('0x9'));var fs=require('fs');var fs_extra=require(_0x738e('0xa'));var _=require(_0x738e('0xb'));var squel=require(_0x738e('0xc'));var crypto=require(_0x738e('0xd'));var jsforce=require(_0x738e('0xe'));var deskjs=require(_0x738e('0xf'));var toCsv=require(_0x738e('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x738e('0x10'));var authService=require(_0x738e('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x738e('0x12'));var hardwareService=require(_0x738e('0x13'));var logger=require(_0x738e('0x14'))(_0x738e('0x15'));var utils=require(_0x738e('0x16'));var config=require(_0x738e('0x17'));var licenseUtil=require(_0x738e('0x18'));var db=require(_0x738e('0x19'))['db'];function respondWithStatusCode(_0xebda88,_0x1324b8){_0x1324b8=_0x1324b8||0xcc;return function(_0x32f0a2){if(_0x32f0a2){return _0xebda88['sendStatus'](_0x1324b8);}return _0xebda88['status'](_0x1324b8)[_0x738e('0x1a')]();};}function respondWithResult(_0x1f0490,_0x5dcdd9){_0x5dcdd9=_0x5dcdd9||0xc8;return function(_0x209485){if(_0x209485){return _0x1f0490[_0x738e('0x1b')](_0x5dcdd9)[_0x738e('0x1c')](_0x209485);}};}function respondWithFilteredResult(_0x42a029,_0x3eb12b){return function(_0x487f6a){if(_0x487f6a){var _0x5907f8=typeof _0x3eb12b[_0x738e('0x1d')]===_0x738e('0x1e')&&typeof _0x3eb12b['limit']==='undefined';var _0x55b0c8=_0x487f6a[_0x738e('0x1f')];var _0x480f5c=_0x5907f8?0x0:_0x3eb12b['offset'];var _0x4d99cc=_0x5907f8?_0x487f6a[_0x738e('0x1f')]:_0x3eb12b[_0x738e('0x1d')]+_0x3eb12b[_0x738e('0x20')];var _0x5a7903;if(_0x4d99cc>=_0x55b0c8){_0x4d99cc=_0x55b0c8;_0x5a7903=0xc8;}else{_0x5a7903=0xce;}_0x42a029['status'](_0x5a7903);return _0x42a029['set'](_0x738e('0x21'),_0x480f5c+'-'+_0x4d99cc+'/'+_0x55b0c8)[_0x738e('0x1c')](_0x487f6a);}return null;};}function patchUpdates(_0x3dbaca){return function(_0x5352ab){try{jsonpatch[_0x738e('0x22')](_0x5352ab,_0x3dbaca,!![]);}catch(_0x554d00){return BPromise[_0x738e('0x23')](_0x554d00);}return _0x5352ab[_0x738e('0x24')]();};}function saveUpdates(_0xb51078,_0x25f9d4){return function(_0x483b97){if(_0x483b97){return _0x483b97['update'](_0xb51078)[_0x738e('0x25')](function(_0x106d6e){return _0x106d6e;});}return null;};}function removeEntity(_0x312493,_0x444410){return function(_0x3c5b02){if(_0x3c5b02){return _0x3c5b02[_0x738e('0x26')]()[_0x738e('0x25')](function(){var _0x1379ec=_0x3c5b02['get']({'plain':!![]});var _0x2c3303=_0x738e('0x27');return db[_0x738e('0x28')][_0x738e('0x26')]({'where':{'type':_0x2c3303,'resourceId':_0x1379ec['id']}})[_0x738e('0x25')](function(){return _0x3c5b02;});})['then'](function(){_0x312493[_0x738e('0x1b')](0xcc)[_0x738e('0x1a')]();});}};}function handleEntityNotFound(_0x2e8895,_0x18dc51){return function(_0x1ee175){if(!_0x1ee175){_0x2e8895['sendStatus'](0x194);}return _0x1ee175;};}function handleError(_0x1b9881,_0x5dc9ce){_0x5dc9ce=_0x5dc9ce||0x1f4;return function(_0x2d77b0){logger[_0x738e('0x29')](_0x2d77b0[_0x738e('0x2a')]);if(_0x2d77b0[_0x738e('0x2b')]){delete _0x2d77b0['name'];}_0x1b9881[_0x738e('0x1b')](_0x5dc9ce)['send'](_0x2d77b0);};}exports[_0x738e('0x2c')]=function(_0x992321,_0x94851){var _0x454034={},_0x4170ea={},_0x1483f4={'count':0x0,'rows':[]};var _0x26f75e=_[_0x738e('0x2d')](db[_0x738e('0x2e')][_0x738e('0x2f')],function(_0x5c17ca){return{'name':_0x5c17ca[_0x738e('0x30')],'type':_0x5c17ca[_0x738e('0x31')]['key']};});_0x4170ea[_0x738e('0x32')]=_['map'](_0x26f75e,_0x738e('0x2b'));_0x4170ea[_0x738e('0x33')]=_[_0x738e('0x34')](_0x992321[_0x738e('0x33')]);_0x4170ea[_0x738e('0x35')]=_[_0x738e('0x36')](_0x4170ea[_0x738e('0x32')],_0x4170ea[_0x738e('0x33')]);_0x454034['attributes']=_[_0x738e('0x36')](_0x4170ea['model'],qs['fields'](_0x992321['query'][_0x738e('0x37')]));_0x454034[_0x738e('0x38')]=_0x454034[_0x738e('0x38')][_0x738e('0x39')]?_0x454034[_0x738e('0x38')]:_0x4170ea[_0x738e('0x32')];if(!_0x992321[_0x738e('0x33')][_0x738e('0x3a')](_0x738e('0x3b'))){_0x454034[_0x738e('0x20')]=qs[_0x738e('0x20')](_0x992321[_0x738e('0x33')]['limit']);_0x454034[_0x738e('0x1d')]=qs['offset'](_0x992321['query'][_0x738e('0x1d')]);}_0x454034['order']=qs[_0x738e('0x3c')](_0x992321['query']['sort']);_0x454034[_0x738e('0x3d')]=qs[_0x738e('0x35')](_[_0x738e('0x3e')](_0x992321[_0x738e('0x33')],_0x4170ea[_0x738e('0x35')]),_0x26f75e);if(_0x992321[_0x738e('0x33')][_0x738e('0x3f')]){_0x454034[_0x738e('0x3d')]=_['merge'](_0x454034[_0x738e('0x3d')],{'$or':_[_0x738e('0x2d')](_0x26f75e,function(_0x174b83){if(_0x174b83[_0x738e('0x31')]!=='VIRTUAL'){var _0x3eff26={};_0x3eff26[_0x174b83[_0x738e('0x2b')]]={'$like':'%'+_0x992321[_0x738e('0x33')][_0x738e('0x3f')]+'%'};return _0x3eff26;}})});}_0x454034=_[_0x738e('0x40')]({},_0x454034,_0x992321[_0x738e('0x41')]);var _0x122289={'where':_0x454034[_0x738e('0x3d')]};return db['Disposition'][_0x738e('0x1f')](_0x122289)[_0x738e('0x25')](function(_0x3203b3){_0x1483f4[_0x738e('0x1f')]=_0x3203b3;if(_0x992321[_0x738e('0x33')][_0x738e('0x42')]){_0x454034[_0x738e('0x43')]=[{'all':!![]}];}return db[_0x738e('0x2e')][_0x738e('0x44')](_0x454034);})['then'](function(_0x555c4a){_0x1483f4[_0x738e('0x45')]=_0x555c4a;return _0x1483f4;})[_0x738e('0x25')](respondWithFilteredResult(_0x94851,_0x454034))['catch'](handleError(_0x94851,null));};exports[_0x738e('0x46')]=function(_0x30cb31,_0x1f369b){var _0x5e854a={'raw':!![],'where':{'id':_0x30cb31[_0x738e('0x47')]['id']}},_0x15a253={};_0x15a253[_0x738e('0x32')]=_[_0x738e('0x34')](db[_0x738e('0x2e')][_0x738e('0x2f')]);_0x15a253['query']=_['keys'](_0x30cb31['query']);_0x15a253[_0x738e('0x35')]=_[_0x738e('0x36')](_0x15a253[_0x738e('0x32')],_0x15a253['query']);_0x5e854a['attributes']=_[_0x738e('0x36')](_0x15a253[_0x738e('0x32')],qs[_0x738e('0x37')](_0x30cb31[_0x738e('0x33')]['fields']));_0x5e854a['attributes']=_0x5e854a[_0x738e('0x38')][_0x738e('0x39')]?_0x5e854a['attributes']:_0x15a253[_0x738e('0x32')];if(_0x30cb31[_0x738e('0x33')]['includeAll']){_0x5e854a['include']=[{'all':!![]}];}_0x5e854a=_[_0x738e('0x40')]({},_0x5e854a,_0x30cb31[_0x738e('0x41')]);return db[_0x738e('0x2e')][_0x738e('0x48')](_0x5e854a)[_0x738e('0x25')](handleEntityNotFound(_0x1f369b,null))[_0x738e('0x25')](respondWithResult(_0x1f369b,null))['catch'](handleError(_0x1f369b,null));};exports[_0x738e('0x49')]=function(_0x1f8ddf,_0x2495f4){return db[_0x738e('0x2e')][_0x738e('0x49')](_0x1f8ddf[_0x738e('0x4a')],{})[_0x738e('0x25')](function(_0x409489){var _0x3ceef8=_0x1f8ddf['user'][_0x738e('0x4b')]({'plain':!![]});if(!_0x3ceef8)throw new Error(_0x738e('0x4c'));if(_0x3ceef8[_0x738e('0x4d')]===_0x738e('0x4e')){var _0xb9536e=_0x409489[_0x738e('0x4b')]({'plain':!![]});var _0x27d413='Dispositions';return db[_0x738e('0x4f')][_0x738e('0x48')]({'where':{'name':_0x27d413,'userProfileId':_0x3ceef8[_0x738e('0x50')]},'raw':!![]})[_0x738e('0x25')](function(_0x40ec96){if(_0x40ec96&&_0x40ec96['autoAssociation']===0x0){return db['UserProfileResource'][_0x738e('0x49')]({'name':_0xb9536e[_0x738e('0x2b')],'resourceId':_0xb9536e['id'],'type':_0x40ec96[_0x738e('0x2b')],'sectionId':_0x40ec96['id']},{})[_0x738e('0x25')](function(){return _0x409489;});}else{return _0x409489;}})[_0x738e('0x51')](function(_0x2f00fb){logger[_0x738e('0x29')](_0x738e('0x52'),_0x2f00fb);throw _0x2f00fb;});}return _0x409489;})[_0x738e('0x25')](respondWithResult(_0x2495f4,0xc9))['catch'](handleError(_0x2495f4,null));};exports[_0x738e('0x53')]=function(_0x2acada,_0x5c7b01){if(_0x2acada[_0x738e('0x4a')]['id']){delete _0x2acada[_0x738e('0x4a')]['id'];}return db['Disposition']['find']({'where':{'id':_0x2acada[_0x738e('0x47')]['id']}})[_0x738e('0x25')](handleEntityNotFound(_0x5c7b01,null))[_0x738e('0x25')](saveUpdates(_0x2acada[_0x738e('0x4a')],null))[_0x738e('0x25')](respondWithResult(_0x5c7b01,null))[_0x738e('0x51')](handleError(_0x5c7b01,null));};exports[_0x738e('0x26')]=function(_0x27fed4,_0x4999ef){return db[_0x738e('0x2e')][_0x738e('0x48')]({'where':{'id':_0x27fed4[_0x738e('0x47')]['id']}})['then'](handleEntityNotFound(_0x4999ef,null))[_0x738e('0x25')](removeEntity(_0x4999ef,null))[_0x738e('0x51')](handleError(_0x4999ef,null));}; \ No newline at end of file diff --git a/server/api/disposition/disposition.model.js b/server/api/disposition/disposition.model.js index 394b64a..c12d5e7 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 _0xb420=['ListId','name_chat','ChatWebsiteId','name_mail','MailAccountId','name_sms','SmsAccountId','name_openchannel','OpenchannelAccountId','name_whatsapp','WhatsappAccountId','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./disposition.attributes','exports','Disposition','tools_dispositions','name_voice','name'];(function(_0x4dc7b9,_0x319d5a){var _0x3ab114=function(_0x51a9df){while(--_0x51a9df){_0x4dc7b9['push'](_0x4dc7b9['shift']());}};_0x3ab114(++_0x319d5a);}(_0xb420,0x1ab));var _0x0b42=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xb420[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x0b42('0x0'));var util=require(_0x0b42('0x1'));var logger=require(_0x0b42('0x2'))(_0x0b42('0x3'));var moment=require(_0x0b42('0x4'));var BPromise=require('bluebird');var rp=require(_0x0b42('0x5'));var fs=require('fs');var path=require(_0x0b42('0x6'));var rimraf=require(_0x0b42('0x7'));var config=require(_0x0b42('0x8'));var attributes=require(_0x0b42('0x9'));module[_0x0b42('0xa')]=function(_0x130a4b,_0x3d87ba){return _0x130a4b['define'](_0x0b42('0xb'),attributes,{'tableName':_0x0b42('0xc'),'paranoid':![],'indexes':[{'unique':!![],'name':_0x0b42('0xd'),'fields':[_0x0b42('0xe'),_0x0b42('0xf')]},{'unique':!![],'name':_0x0b42('0x10'),'fields':['name',_0x0b42('0x11')]},{'unique':!![],'name':_0x0b42('0x12'),'fields':['name',_0x0b42('0x13')]},{'unique':!![],'name':_0x0b42('0x14'),'fields':['name',_0x0b42('0x15')]},{'unique':!![],'name':'name_fax','fields':[_0x0b42('0xe'),'FaxAccountId']},{'unique':!![],'name':_0x0b42('0x16'),'fields':[_0x0b42('0xe'),_0x0b42('0x17')]},{'unique':!![],'name':_0x0b42('0x18'),'fields':['name',_0x0b42('0x19')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xd667=['tools_dispositions','name_voice','name','ListId','name_mail','MailAccountId','name_sms','SmsAccountId','name_fax','FaxAccountId','name_openchannel','OpenchannelAccountId','name_whatsapp','lodash','api','moment','request-promise','rimraf','../../config/environment','./disposition.attributes'];(function(_0x351739,_0x43fd1a){var _0x50b5c8=function(_0x3925b4){while(--_0x3925b4){_0x351739['push'](_0x351739['shift']());}};_0x50b5c8(++_0x43fd1a);}(_0xd667,0x139));var _0x7d66=function(_0x57f474,_0x45e30a){_0x57f474=_0x57f474-0x0;var _0x59be97=_0xd667[_0x57f474];return _0x59be97;};'use strict';var _=require(_0x7d66('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x7d66('0x1'));var moment=require(_0x7d66('0x2'));var BPromise=require('bluebird');var rp=require(_0x7d66('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7d66('0x4'));var config=require(_0x7d66('0x5'));var attributes=require(_0x7d66('0x6'));module['exports']=function(_0x5bde78,_0x548059){return _0x5bde78['define']('Disposition',attributes,{'tableName':_0x7d66('0x7'),'paranoid':![],'indexes':[{'unique':!![],'name':_0x7d66('0x8'),'fields':[_0x7d66('0x9'),_0x7d66('0xa')]},{'unique':!![],'name':'name_chat','fields':[_0x7d66('0x9'),'ChatWebsiteId']},{'unique':!![],'name':_0x7d66('0xb'),'fields':[_0x7d66('0x9'),_0x7d66('0xc')]},{'unique':!![],'name':_0x7d66('0xd'),'fields':[_0x7d66('0x9'),_0x7d66('0xe')]},{'unique':!![],'name':_0x7d66('0xf'),'fields':['name',_0x7d66('0x10')]},{'unique':!![],'name':_0x7d66('0x11'),'fields':[_0x7d66('0x9'),_0x7d66('0x12')]},{'unique':!![],'name':_0x7d66('0x13'),'fields':['name','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 0914a22..016ed00 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(_0x183cc4,_0xaaa23){var _0x54e0c3=function(_0x4f3af2){while(--_0x4f3af2){_0x183cc4['push'](_0x183cc4['shift']());}};_0x54e0c3(++_0xaaa23);}(_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(_0x1bcd69,_0x5e13b6){var _0x2adb06=function(_0x3c2ae3){while(--_0x3c2ae3){_0x1bcd69['push'](_0x1bcd69['shift']());}};_0x2adb06(++_0x5e13b6);}(_0xa9e0,0x123));var _0x0a9e=function(_0x220dbb,_0x99328d){_0x220dbb=_0x220dbb-0x0;var _0x2b77de=_0xa9e0[_0x220dbb];return _0x2b77de;};'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 3490f8a..e45ae3d 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 _0xaa44=['./disposition.controller','index','get','/:id','isAuthenticated','post','put','update','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x121d9e,_0x11b966){var _0x5df466=function(_0x519340){while(--_0x519340){_0x121d9e['push'](_0x121d9e['shift']());}};_0x5df466(++_0x11b966);}(_0xaa44,0x127));var _0x4aa4=function(_0x5463e5,_0x5b34cb){_0x5463e5=_0x5463e5-0x0;var _0x5d5811=_0xaa44[_0x5463e5];return _0x5d5811;};'use strict';var multer=require('multer');var util=require(_0x4aa4('0x0'));var path=require(_0x4aa4('0x1'));var timeout=require(_0x4aa4('0x2'));var express=require(_0x4aa4('0x3'));var router=express[_0x4aa4('0x4')]();var fs_extra=require(_0x4aa4('0x5'));var auth=require(_0x4aa4('0x6'));var interaction=require(_0x4aa4('0x7'));var config=require(_0x4aa4('0x8'));var controller=require(_0x4aa4('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0x4aa4('0xa')]);router[_0x4aa4('0xb')](_0x4aa4('0xc'),auth[_0x4aa4('0xd')](),controller['show']);router[_0x4aa4('0xe')]('/',auth[_0x4aa4('0xd')](),controller['create']);router[_0x4aa4('0xf')](_0x4aa4('0xc'),auth[_0x4aa4('0xd')](),controller[_0x4aa4('0x10')]);router['delete'](_0x4aa4('0xc'),auth[_0x4aa4('0xd')](),controller[_0x4aa4('0x11')]);module[_0x4aa4('0x12')]=router; \ No newline at end of file +var _0x998d=['update','delete','/:id','destroy','exports','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../config/environment','./disposition.controller','get','isAuthenticated','index','show','post','create'];(function(_0x35fc20,_0xb434a){var _0x263507=function(_0x920963){while(--_0x920963){_0x35fc20['push'](_0x35fc20['shift']());}};_0x263507(++_0xb434a);}(_0x998d,0x148));var _0xd998=function(_0x10a2fb,_0x3e096d){_0x10a2fb=_0x10a2fb-0x0;var _0x2a5b50=_0x998d[_0x10a2fb];return _0x2a5b50;};'use strict';var multer=require(_0xd998('0x0'));var util=require(_0xd998('0x1'));var path=require(_0xd998('0x2'));var timeout=require(_0xd998('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xd998('0x4'));var auth=require(_0xd998('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xd998('0x6'));var controller=require(_0xd998('0x7'));router[_0xd998('0x8')]('/',auth[_0xd998('0x9')](),controller[_0xd998('0xa')]);router[_0xd998('0x8')]('/:id',auth[_0xd998('0x9')](),controller[_0xd998('0xb')]);router[_0xd998('0xc')]('/',auth['isAuthenticated'](),controller[_0xd998('0xd')]);router['put']('/:id',auth[_0xd998('0x9')](),controller[_0xd998('0xe')]);router[_0xd998('0xf')](_0xd998('0x10'),auth[_0xd998('0x9')](),controller[_0xd998('0x11')]);module[_0xd998('0x12')]=router; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.attributes.js b/server/api/faxAccount/faxAccount.attributes.js index 437a7e6..972865d 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 _0x49c1=['IAX','DADHI','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','STRING','ENUM','yes','localstationid','2400','7200','9600','14400','4800','12000','v17,v27,v29','INTEGER','SIP'];(function(_0x44a758,_0xf2441b){var _0x3778fb=function(_0x527ad1){while(--_0x527ad1){_0x44a758['push'](_0x44a758['shift']());}};_0x3778fb(++_0xf2441b);}(_0x49c1,0xef));var _0x149c=function(_0x362705,_0x395f45){_0x362705=_0x362705-0x0;var _0x29f928=_0x49c1[_0x362705];return _0x29f928;};'use strict';var Sequelize=require(_0x149c('0x0'));module['exports']={'name':{'type':Sequelize[_0x149c('0x1')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x149c('0x1')]},'ecm':{'type':Sequelize[_0x149c('0x2')]('yes','no'),'defaultValue':_0x149c('0x3')},'headerinfo':{'type':Sequelize[_0x149c('0x1')],'defaultValue':'xCALLY\x20Motion\x20Fax'},'localstationid':{'type':Sequelize[_0x149c('0x1')],'unique':_0x149c('0x4')},'minrate':{'type':Sequelize['ENUM'](_0x149c('0x5'),'4800',_0x149c('0x6'),_0x149c('0x7'),'12000',_0x149c('0x8')),'defaultValue':_0x149c('0x9')},'maxrate':{'type':Sequelize['ENUM'](_0x149c('0x5'),_0x149c('0x9'),'7200',_0x149c('0x7'),_0x149c('0xa'),_0x149c('0x8')),'defaultValue':_0x149c('0x8')},'modem':{'type':Sequelize['STRING'],'defaultValue':_0x149c('0xb')},'gateway':{'type':Sequelize[_0x149c('0x1')],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0x149c('0x1')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize[_0x149c('0xc')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0x149c('0x2')](_0x149c('0xd'),_0x149c('0xe'),_0x149c('0xf'),'KHOMP'),'defaultValue':_0x149c('0xd')},'key':{'type':Sequelize[_0x149c('0x1')],'allowNull':![]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0x149c('0x10');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x149c('0x11')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x149c('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x149c('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x149c('0x11')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x149c('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x149c('0x11')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x149c('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x149c('0xc')],'allowNull':!![],'defaultValue':null,'comment':_0x149c('0x12')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x149c('0x13'),'set':function(_0x160d4f){if(!_0x160d4f)this[_0x149c('0x14')](_0x149c('0x15'),null);this[_0x149c('0x14')](_0x149c('0x16'),_0x160d4f);}}}; \ No newline at end of file +var _0x4c60=['4800','7200','9600','12000','14400','v17,v27,v29','INTEGER','SIP','DADHI','KHOMP','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','exports','STRING','yes','localstationid','ENUM','2400'];(function(_0x9b9a89,_0x148994){var _0x22572f=function(_0x37e849){while(--_0x37e849){_0x9b9a89['push'](_0x9b9a89['shift']());}};_0x22572f(++_0x148994);}(_0x4c60,0xc1));var _0x04c6=function(_0x13e0e5,_0x139120){_0x13e0e5=_0x13e0e5-0x0;var _0x1e4ec1=_0x4c60[_0x13e0e5];return _0x1e4ec1;};'use strict';var Sequelize=require(_0x04c6('0x0'));module[_0x04c6('0x1')]={'name':{'type':Sequelize[_0x04c6('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x04c6('0x2')]},'ecm':{'type':Sequelize['ENUM'](_0x04c6('0x3'),'no'),'defaultValue':'yes'},'headerinfo':{'type':Sequelize['STRING'],'defaultValue':'xCALLY\x20Motion\x20Fax'},'localstationid':{'type':Sequelize['STRING'],'unique':_0x04c6('0x4')},'minrate':{'type':Sequelize[_0x04c6('0x5')](_0x04c6('0x6'),_0x04c6('0x7'),_0x04c6('0x8'),_0x04c6('0x9'),_0x04c6('0xa'),'14400'),'defaultValue':_0x04c6('0x7')},'maxrate':{'type':Sequelize[_0x04c6('0x5')](_0x04c6('0x6'),_0x04c6('0x7'),'7200','9600','12000',_0x04c6('0xb')),'defaultValue':'14400'},'modem':{'type':Sequelize[_0x04c6('0x2')],'defaultValue':_0x04c6('0xc')},'gateway':{'type':Sequelize['STRING'],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0x04c6('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize[_0x04c6('0xd')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0x04c6('0x5')](_0x04c6('0xe'),'IAX',_0x04c6('0xf'),_0x04c6('0x10')),'defaultValue':_0x04c6('0xe')},'key':{'type':Sequelize['STRING'],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x04c6('0x11')],'defaultValue':function(){return _0x04c6('0x12');}},'notificationSound':{'type':Sequelize[_0x04c6('0x13')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x04c6('0x13')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x04c6('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x04c6('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x04c6('0x13')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x04c6('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x04c6('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x04c6('0xd')],'allowNull':!![],'defaultValue':null,'comment':_0x04c6('0x14')},'mandatoryDisposition':{'type':Sequelize[_0x04c6('0x13')],'defaultValue':![],'comment':_0x04c6('0x15'),'set':function(_0xfb4db5){if(!_0xfb4db5)this[_0x04c6('0x16')](_0x04c6('0x17'),null);this['setDataValue'](_0x04c6('0x18'),_0xfb4db5);}}}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.controller.js b/server/api/faxAccount/faxAccount.controller.js index 7089f7e..36e9b87 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 _0xe244=['FAXOPT(','Wait','ReceiveFax','VoiceExtension','updateAccountApplications','bulkCreate','tech','TrunkId','ListId','findById','getMessages','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','FaxMessage','CmList','Contacts','updatedAt','DESC','attachments','root','server/files/attachments','basename','CheckAfterSend','isNil','path','from','\x22%s\x22\x20<%s>','fax','List','List\x20not\x20found','out','Messages','Contact\x20not\x20found','spread','filename','dataValues','SendFax','SendFaxRpc,\x20%s','addAgents','emit','removeAgents','isArray','userFaxAccount:remove','getAgents','rimraf','fast-json-patch','moment','mustache','util','sox','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./faxAccount.socket','client','http','request','then','info','debug','stringify','error','FaxAccount,\x20%s,\x20%s','message','status','end','json','offset','undefined','count','set','Content-Range','apply','save','update','destroy','FaxAccounts','UserProfileResource','sendStatus','stack','name','send','Pause','mandatoryDispositionPause','FaxAccount','rawAttributes','fieldName','key','map','keys','query','intersection','model','attributes','hasOwnProperty','nolimit','limit','order','sort','pick','filters','where','merge','type','VIRTUAL','includeAll','include','rows','catch','show','params','fields','length','options','find','create','body','user','get','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','FaxAccountId','Disposition','getDispositions','filter','findAll','removeDispositions','ids','addAnswer','CannedAnswer','findOne','removeAnswers','addInteraction','FaxInteraction','omit','getInteractions','CmContact','User','Owner','fullname','Tag','Tags','color','tag','transaction','sequelize','Transaction','FaxApplication','findAndCountAll','priority','finally','getApplications','from-voip-provider','exten','system','description','Fax\x20Extension','appdata','Answer','push','CDR(type)=inbound-fax','gateway','faxdetect','headerinfo','maxrate','minrate','modem'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xe244,0xed));var _0x4e24=function(_0x1d1779,_0x284147){_0x1d1779=_0x1d1779-0x0;var _0x2377e9=_0xe244[_0x1d1779];return _0x2377e9;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x4e24('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4e24('0x1'));var rp=require('request-promise');var moment=require(_0x4e24('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x4e24('0x3'));var util=require(_0x4e24('0x4'));var path=require('path');var sox=require(_0x4e24('0x5'));var csv=require('to-csv');var ejs=require(_0x4e24('0x6'));var fs=require('fs');var fs_extra=require(_0x4e24('0x7'));var _=require(_0x4e24('0x8'));var squel=require(_0x4e24('0x9'));var crypto=require('crypto');var jsforce=require(_0x4e24('0xa'));var deskjs=require(_0x4e24('0xb'));var toCsv=require('to-csv');var querystring=require(_0x4e24('0xc'));var Papa=require(_0x4e24('0xd'));var Redis=require('ioredis');var authService=require(_0x4e24('0xe'));var qs=require(_0x4e24('0xf'));var as=require(_0x4e24('0x10'));var hardwareService=require(_0x4e24('0x11'));var logger=require('../../config/logger')(_0x4e24('0x12'));var utils=require('../../config/utils');var config=require(_0x4e24('0x13'));var licenseUtil=require(_0x4e24('0x14'));var db=require(_0x4e24('0x15'))['db'];config['redis']=_[_0x4e24('0x16')](config[_0x4e24('0x17')],{'host':_0x4e24('0x18'),'port':0x18eb});var socket=require(_0x4e24('0x19'))(new Redis(config[_0x4e24('0x17')]));require(_0x4e24('0x1a'))['register'](socket);var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232c});var client9002=jayson[_0x4e24('0x1b')][_0x4e24('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x501604,_0x53f921,_0x59b1a0,_0x3722b6){return new BPromise(function(_0x17f80a,_0x580e8b){var _0x317ced=_0x3722b6||client;return _0x317ced[_0x4e24('0x1d')](_0x501604,_0x59b1a0)[_0x4e24('0x1e')](function(_0x4bdfa5){logger[_0x4e24('0x1f')]('FaxAccount,\x20%s,\x20%s',_0x53f921,'request\x20sent');logger[_0x4e24('0x20')]('FaxAccount,\x20%s,\x20%s,\x20%s',_0x53f921,'request\x20sent',JSON[_0x4e24('0x21')](_0x4bdfa5));if(_0x4bdfa5['error']){if(_0x4bdfa5['error']['code']===0x1f4){logger[_0x4e24('0x22')](_0x4e24('0x23'),_0x53f921,_0x4bdfa5[_0x4e24('0x22')][_0x4e24('0x24')]);return _0x580e8b(_0x4bdfa5[_0x4e24('0x22')][_0x4e24('0x24')]);}logger['error']('FaxAccount,\x20%s,\x20%s',_0x53f921,_0x4bdfa5[_0x4e24('0x22')][_0x4e24('0x24')]);return _0x17f80a(_0x4bdfa5[_0x4e24('0x22')]['message']);}else{logger['info'](_0x4e24('0x23'),_0x53f921,'request\x20sent');_0x17f80a(_0x4bdfa5['result'][_0x4e24('0x24')]);}})['catch'](function(_0x22b762){logger[_0x4e24('0x22')](_0x4e24('0x23'),_0x53f921,_0x22b762);_0x580e8b(_0x22b762);});});}function respondWithStatusCode(_0x2ff327,_0x208c29){_0x208c29=_0x208c29||0xcc;return function(_0x3cfb3d){if(_0x3cfb3d){return _0x2ff327['sendStatus'](_0x208c29);}return _0x2ff327[_0x4e24('0x25')](_0x208c29)[_0x4e24('0x26')]();};}function respondWithResult(_0x231765,_0x42eab7){_0x42eab7=_0x42eab7||0xc8;return function(_0x4cc210){if(_0x4cc210){return _0x231765[_0x4e24('0x25')](_0x42eab7)[_0x4e24('0x27')](_0x4cc210);}};}function respondWithFilteredResult(_0x5e8546,_0x500f39){return function(_0x211b20){if(_0x211b20){var _0x4ff509=typeof _0x500f39[_0x4e24('0x28')]===_0x4e24('0x29')&&typeof _0x500f39['limit']===_0x4e24('0x29');var _0x3b4b88=_0x211b20[_0x4e24('0x2a')];var _0x42d135=_0x4ff509?0x0:_0x500f39['offset'];var _0x27daf5=_0x4ff509?_0x211b20[_0x4e24('0x2a')]:_0x500f39[_0x4e24('0x28')]+_0x500f39['limit'];var _0x85f727;if(_0x27daf5>=_0x3b4b88){_0x27daf5=_0x3b4b88;_0x85f727=0xc8;}else{_0x85f727=0xce;}_0x5e8546['status'](_0x85f727);return _0x5e8546[_0x4e24('0x2b')](_0x4e24('0x2c'),_0x42d135+'-'+_0x27daf5+'/'+_0x3b4b88)[_0x4e24('0x27')](_0x211b20);}return null;};}function patchUpdates(_0x540e7e){return function(_0x4f8961){try{jsonpatch[_0x4e24('0x2d')](_0x4f8961,_0x540e7e,!![]);}catch(_0x4f0d13){return BPromise['reject'](_0x4f0d13);}return _0x4f8961[_0x4e24('0x2e')]();};}function saveUpdates(_0xed9f0b,_0x1f7b49){return function(_0xfd3bf8){if(_0xfd3bf8){return _0xfd3bf8[_0x4e24('0x2f')](_0xed9f0b)[_0x4e24('0x1e')](function(_0x1837eb){return _0x1837eb;});}return null;};}function removeEntity(_0x55ed3f,_0x3cf65a){return function(_0x473e80){if(_0x473e80){return _0x473e80[_0x4e24('0x30')]()[_0x4e24('0x1e')](function(){var _0x3f2a0f=_0x473e80['get']({'plain':!![]});var _0x45d2ad=_0x4e24('0x31');return db[_0x4e24('0x32')][_0x4e24('0x30')]({'where':{'type':_0x45d2ad,'resourceId':_0x3f2a0f['id']}})[_0x4e24('0x1e')](function(){return _0x473e80;});})['then'](function(){_0x55ed3f[_0x4e24('0x25')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2d5aac,_0x1b687a){return function(_0x3da141){if(!_0x3da141){_0x2d5aac[_0x4e24('0x33')](0x194);}return _0x3da141;};}function handleError(_0x1f059a,_0x13a5fa){_0x13a5fa=_0x13a5fa||0x1f4;return function(_0x57ad98){logger[_0x4e24('0x22')](_0x57ad98[_0x4e24('0x34')]);if(_0x57ad98['name']){delete _0x57ad98[_0x4e24('0x35')];}_0x1f059a[_0x4e24('0x25')](_0x13a5fa)[_0x4e24('0x36')](_0x57ad98);};}exports['index']=function(_0x38e766,_0x4f22c5){var _0x2a23b1={'include':[{'model':db[_0x4e24('0x37')],'as':_0x4e24('0x38')}]},_0x4fc341={},_0x180746={'count':0x0,'rows':[]};var _0x1f24b8=_['map'](db[_0x4e24('0x39')][_0x4e24('0x3a')],function(_0x51d744){return{'name':_0x51d744[_0x4e24('0x3b')],'type':_0x51d744['type'][_0x4e24('0x3c')]};});_0x4fc341['model']=_[_0x4e24('0x3d')](_0x1f24b8,_0x4e24('0x35'));_0x4fc341['query']=_[_0x4e24('0x3e')](_0x38e766[_0x4e24('0x3f')]);_0x4fc341['filters']=_[_0x4e24('0x40')](_0x4fc341[_0x4e24('0x41')],_0x4fc341[_0x4e24('0x3f')]);_0x2a23b1[_0x4e24('0x42')]=_[_0x4e24('0x40')](_0x4fc341['model'],qs['fields'](_0x38e766[_0x4e24('0x3f')]['fields']));_0x2a23b1[_0x4e24('0x42')]=_0x2a23b1['attributes']['length']?_0x2a23b1[_0x4e24('0x42')]:_0x4fc341[_0x4e24('0x41')];if(!_0x38e766[_0x4e24('0x3f')][_0x4e24('0x43')](_0x4e24('0x44'))){_0x2a23b1[_0x4e24('0x45')]=qs['limit'](_0x38e766['query'][_0x4e24('0x45')]);_0x2a23b1[_0x4e24('0x28')]=qs['offset'](_0x38e766[_0x4e24('0x3f')][_0x4e24('0x28')]);}_0x2a23b1[_0x4e24('0x46')]=qs[_0x4e24('0x47')](_0x38e766[_0x4e24('0x3f')][_0x4e24('0x47')]);_0x2a23b1['where']=qs['filters'](_[_0x4e24('0x48')](_0x38e766[_0x4e24('0x3f')],_0x4fc341[_0x4e24('0x49')]),_0x1f24b8);if(_0x38e766['query']['filter']){_0x2a23b1[_0x4e24('0x4a')]=_[_0x4e24('0x4b')](_0x2a23b1['where'],{'$or':_[_0x4e24('0x3d')](_0x1f24b8,function(_0xc812c4){if(_0xc812c4[_0x4e24('0x4c')]!==_0x4e24('0x4d')){var _0x3f7d4f={};_0x3f7d4f[_0xc812c4[_0x4e24('0x35')]]={'$like':'%'+_0x38e766[_0x4e24('0x3f')]['filter']+'%'};return _0x3f7d4f;}})});}_0x2a23b1=_[_0x4e24('0x4b')]({},_0x2a23b1,_0x38e766['options']);var _0x19a334={'where':_0x2a23b1[_0x4e24('0x4a')]};return db['FaxAccount'][_0x4e24('0x2a')](_0x19a334)[_0x4e24('0x1e')](function(_0x72d43f){_0x180746['count']=_0x72d43f;if(_0x38e766[_0x4e24('0x3f')][_0x4e24('0x4e')]){_0x2a23b1[_0x4e24('0x4f')]=[{'all':!![]}];}return db[_0x4e24('0x39')]['findAll'](_0x2a23b1);})[_0x4e24('0x1e')](function(_0x29f9b4){_0x180746[_0x4e24('0x50')]=_0x29f9b4;return _0x180746;})['then'](respondWithFilteredResult(_0x4f22c5,_0x2a23b1))[_0x4e24('0x51')](handleError(_0x4f22c5,null));};exports[_0x4e24('0x52')]=function(_0x366d99,_0xc298aa){var _0x385c56={'raw':![],'where':{'id':_0x366d99[_0x4e24('0x53')]['id']},'include':[{'model':db[_0x4e24('0x37')],'as':_0x4e24('0x38')}]},_0x43e072={};_0x43e072[_0x4e24('0x41')]=_[_0x4e24('0x3e')](db[_0x4e24('0x39')][_0x4e24('0x3a')]);_0x43e072[_0x4e24('0x3f')]=_[_0x4e24('0x3e')](_0x366d99[_0x4e24('0x3f')]);_0x43e072[_0x4e24('0x49')]=_[_0x4e24('0x40')](_0x43e072[_0x4e24('0x41')],_0x43e072['query']);_0x385c56[_0x4e24('0x42')]=_[_0x4e24('0x40')](_0x43e072[_0x4e24('0x41')],qs[_0x4e24('0x54')](_0x366d99['query'][_0x4e24('0x54')]));_0x385c56[_0x4e24('0x42')]=_0x385c56[_0x4e24('0x42')][_0x4e24('0x55')]?_0x385c56[_0x4e24('0x42')]:_0x43e072['model'];if(_0x366d99[_0x4e24('0x3f')]['includeAll']){_0x385c56['include']=[{'all':!![]}];}_0x385c56=_[_0x4e24('0x4b')]({},_0x385c56,_0x366d99[_0x4e24('0x56')]);return db[_0x4e24('0x39')][_0x4e24('0x57')](_0x385c56)['then'](handleEntityNotFound(_0xc298aa,null))['then'](respondWithResult(_0xc298aa,null))[_0x4e24('0x51')](handleError(_0xc298aa,null));};exports[_0x4e24('0x58')]=function(_0xefd77e,_0x2b28df){return db[_0x4e24('0x39')][_0x4e24('0x58')](_0xefd77e[_0x4e24('0x59')],{})['then'](function(_0x590c74){var _0x1e373a=_0xefd77e[_0x4e24('0x5a')][_0x4e24('0x5b')]({'plain':!![]});if(!_0x1e373a)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1e373a[_0x4e24('0x5c')]===_0x4e24('0x5a')){var _0x3b8d64=_0x590c74['get']({'plain':!![]});var _0x16f514='FaxAccounts';return db[_0x4e24('0x5d')][_0x4e24('0x57')]({'where':{'name':_0x16f514,'userProfileId':_0x1e373a[_0x4e24('0x5e')]},'raw':!![]})['then'](function(_0xfb2364){if(_0xfb2364&&_0xfb2364[_0x4e24('0x5f')]===0x0){return db[_0x4e24('0x32')][_0x4e24('0x58')]({'name':_0x3b8d64[_0x4e24('0x35')],'resourceId':_0x3b8d64['id'],'type':_0xfb2364[_0x4e24('0x35')],'sectionId':_0xfb2364['id']},{})['then'](function(){return _0x590c74;});}else{return _0x590c74;}})[_0x4e24('0x51')](function(_0x32e4b1){logger[_0x4e24('0x22')](_0x4e24('0x60'),_0x32e4b1);throw _0x32e4b1;});}return _0x590c74;})[_0x4e24('0x1e')](respondWithResult(_0x2b28df,0xc9))[_0x4e24('0x51')](handleError(_0x2b28df,null));};exports[_0x4e24('0x2f')]=function(_0x1fafea,_0x1d517a){if(_0x1fafea['body']['id']){delete _0x1fafea['body']['id'];}return db[_0x4e24('0x39')][_0x4e24('0x57')]({'where':{'id':_0x1fafea[_0x4e24('0x53')]['id']},'include':[{'model':db[_0x4e24('0x37')],'as':_0x4e24('0x38')}]})[_0x4e24('0x1e')](handleEntityNotFound(_0x1d517a,null))[_0x4e24('0x1e')](saveUpdates(_0x1fafea[_0x4e24('0x59')],null))['then'](respondWithResult(_0x1d517a,null))['catch'](handleError(_0x1d517a,null));};exports[_0x4e24('0x30')]=function(_0x6f68f1,_0x3f24d9){return db[_0x4e24('0x39')][_0x4e24('0x57')]({'where':{'id':_0x6f68f1[_0x4e24('0x53')]['id']}})[_0x4e24('0x1e')](handleEntityNotFound(_0x3f24d9,null))['then'](removeEntity(_0x3f24d9,null))[_0x4e24('0x51')](handleError(_0x3f24d9,null));};exports[_0x4e24('0x61')]=function(_0x4cd6fe,_0x30d88d){return db['FaxAccount'][_0x4e24('0x61')]()['then'](respondWithResult(_0x30d88d,null))[_0x4e24('0x51')](handleError(_0x30d88d,null));};exports[_0x4e24('0x62')]=function(_0x5cfd10,_0xaf1519,_0x223356){if(_0x5cfd10[_0x4e24('0x59')]['id']){delete _0x5cfd10['body']['id'];}return db[_0x4e24('0x39')][_0x4e24('0x57')]({'where':{'id':_0x5cfd10[_0x4e24('0x53')]['id']}})[_0x4e24('0x1e')](handleEntityNotFound(_0xaf1519,null))[_0x4e24('0x1e')](function(_0x1f2ef6){if(_0x1f2ef6){_0x5cfd10[_0x4e24('0x59')][_0x4e24('0x63')]=_0x1f2ef6['id'];return db[_0x4e24('0x64')]['create'](_0x5cfd10[_0x4e24('0x59')]);}})[_0x4e24('0x1e')](respondWithResult(_0xaf1519,null))[_0x4e24('0x51')](handleError(_0xaf1519,null));};exports[_0x4e24('0x65')]=function(_0x1181ed,_0x2be31a,_0x3c3812){var _0x5d49ac={'raw':![],'where':{}};var _0x27b08e={};var _0x4858cf={'count':0x0,'rows':[]};return db[_0x4e24('0x39')]['findOne']({'where':{'id':_0x1181ed[_0x4e24('0x53')]['id']}})[_0x4e24('0x1e')](handleEntityNotFound(_0x2be31a,null))[_0x4e24('0x1e')](function(_0x5f14ed){if(_0x5f14ed){_0x27b08e[_0x4e24('0x41')]=_[_0x4e24('0x3e')](db[_0x4e24('0x64')][_0x4e24('0x3a')]);_0x27b08e[_0x4e24('0x3f')]=_['keys'](_0x1181ed[_0x4e24('0x3f')]);_0x27b08e[_0x4e24('0x49')]=_[_0x4e24('0x40')](_0x27b08e[_0x4e24('0x41')],_0x27b08e[_0x4e24('0x3f')]);_0x5d49ac['attributes']=_[_0x4e24('0x40')](_0x27b08e[_0x4e24('0x41')],qs[_0x4e24('0x54')](_0x1181ed[_0x4e24('0x3f')][_0x4e24('0x54')]));_0x5d49ac['attributes']=_0x5d49ac[_0x4e24('0x42')][_0x4e24('0x55')]?_0x5d49ac[_0x4e24('0x42')]:_0x27b08e[_0x4e24('0x41')];if(!_0x1181ed['query'][_0x4e24('0x43')](_0x4e24('0x44'))){_0x5d49ac['limit']=qs['limit'](_0x1181ed['query'][_0x4e24('0x45')]);_0x5d49ac[_0x4e24('0x28')]=qs[_0x4e24('0x28')](_0x1181ed[_0x4e24('0x3f')][_0x4e24('0x28')]);}_0x5d49ac[_0x4e24('0x46')]=qs[_0x4e24('0x47')](_0x1181ed[_0x4e24('0x3f')][_0x4e24('0x47')]);_0x5d49ac['where']=qs['filters'](_[_0x4e24('0x48')](_0x1181ed[_0x4e24('0x3f')],_0x27b08e[_0x4e24('0x49')]));_0x5d49ac[_0x4e24('0x4a')][_0x4e24('0x63')]=_0x5f14ed['id'];if(_0x1181ed[_0x4e24('0x3f')][_0x4e24('0x66')]){_0x5d49ac[_0x4e24('0x4a')]=_[_0x4e24('0x4b')](_0x5d49ac[_0x4e24('0x4a')],{'$or':_[_0x4e24('0x3d')](_0x5d49ac[_0x4e24('0x42')],function(_0x288492){var _0x1bbc61={};_0x1bbc61[_0x288492]={'$like':'%'+_0x1181ed[_0x4e24('0x3f')][_0x4e24('0x66')]+'%'};return _0x1bbc61;})});}_0x5d49ac=_['merge']({},_0x5d49ac,_0x1181ed['options']);return db[_0x4e24('0x64')][_0x4e24('0x2a')]({'where':_0x5d49ac[_0x4e24('0x4a')]})['then'](function(_0x213417){_0x4858cf['count']=_0x213417;if(_0x1181ed[_0x4e24('0x3f')][_0x4e24('0x4e')]){_0x5d49ac[_0x4e24('0x4f')]=[{'all':!![]}];}return db[_0x4e24('0x64')][_0x4e24('0x67')](_0x5d49ac);})[_0x4e24('0x1e')](function(_0x380cf4){_0x4858cf[_0x4e24('0x50')]=_0x380cf4;return _0x4858cf;});}})['then'](respondWithFilteredResult(_0x2be31a,_0x5d49ac))['catch'](handleError(_0x2be31a,null));};exports[_0x4e24('0x68')]=function(_0x40dd23,_0x394b1d,_0x4d392f){return db[_0x4e24('0x39')][_0x4e24('0x57')]({'where':{'id':_0x40dd23[_0x4e24('0x53')]['id']}})['then'](handleEntityNotFound(_0x394b1d,null))[_0x4e24('0x1e')](function(_0x2f9200){if(_0x2f9200){return _0x2f9200[_0x4e24('0x68')](_0x40dd23[_0x4e24('0x3f')][_0x4e24('0x69')]);}})[_0x4e24('0x1e')](respondWithStatusCode(_0x394b1d,null))[_0x4e24('0x51')](handleError(_0x394b1d,null));};exports[_0x4e24('0x6a')]=function(_0x217415,_0xf4ab61,_0x5ed8c9){if(_0x217415['body']['id']){delete _0x217415['body']['id'];}return db[_0x4e24('0x39')][_0x4e24('0x57')]({'where':{'id':_0x217415['params']['id']}})[_0x4e24('0x1e')](handleEntityNotFound(_0xf4ab61,null))[_0x4e24('0x1e')](function(_0x18bb5d){if(_0x18bb5d){_0x217415['body']['FaxAccountId']=_0x18bb5d['id'];return db[_0x4e24('0x6b')]['create'](_0x217415[_0x4e24('0x59')]);}})[_0x4e24('0x1e')](respondWithResult(_0xf4ab61,null))[_0x4e24('0x51')](handleError(_0xf4ab61,null));};exports['getAnswers']=function(_0x5f30a7,_0x5f0aff,_0x1d603c){var _0x3d2d66={'raw':![],'where':{}};var _0x289a83={};var _0x864dae={'count':0x0,'rows':[]};return db[_0x4e24('0x39')][_0x4e24('0x6c')]({'where':{'id':_0x5f30a7[_0x4e24('0x53')]['id']}})[_0x4e24('0x1e')](handleEntityNotFound(_0x5f0aff,null))['then'](function(_0x14e5b8){if(_0x14e5b8){_0x289a83[_0x4e24('0x41')]=_['keys'](db[_0x4e24('0x6b')]['rawAttributes']);_0x289a83['query']=_[_0x4e24('0x3e')](_0x5f30a7[_0x4e24('0x3f')]);_0x289a83[_0x4e24('0x49')]=_[_0x4e24('0x40')](_0x289a83[_0x4e24('0x41')],_0x289a83[_0x4e24('0x3f')]);_0x3d2d66['attributes']=_[_0x4e24('0x40')](_0x289a83['model'],qs[_0x4e24('0x54')](_0x5f30a7[_0x4e24('0x3f')]['fields']));_0x3d2d66[_0x4e24('0x42')]=_0x3d2d66[_0x4e24('0x42')][_0x4e24('0x55')]?_0x3d2d66['attributes']:_0x289a83[_0x4e24('0x41')];if(!_0x5f30a7[_0x4e24('0x3f')][_0x4e24('0x43')]('nolimit')){_0x3d2d66[_0x4e24('0x45')]=qs[_0x4e24('0x45')](_0x5f30a7[_0x4e24('0x3f')][_0x4e24('0x45')]);_0x3d2d66[_0x4e24('0x28')]=qs[_0x4e24('0x28')](_0x5f30a7[_0x4e24('0x3f')][_0x4e24('0x28')]);}_0x3d2d66[_0x4e24('0x46')]=qs[_0x4e24('0x47')](_0x5f30a7[_0x4e24('0x3f')][_0x4e24('0x47')]);_0x3d2d66['where']=qs['filters'](_['pick'](_0x5f30a7['query'],_0x289a83['filters']));_0x3d2d66[_0x4e24('0x4a')]['FaxAccountId']=_0x14e5b8['id'];if(_0x5f30a7[_0x4e24('0x3f')]['filter']){_0x3d2d66['where']=_[_0x4e24('0x4b')](_0x3d2d66[_0x4e24('0x4a')],{'$or':_['map'](_0x3d2d66[_0x4e24('0x42')],function(_0xf3fa0c){var _0x282a8d={};_0x282a8d[_0xf3fa0c]={'$like':'%'+_0x5f30a7[_0x4e24('0x3f')]['filter']+'%'};return _0x282a8d;})});}_0x3d2d66=_[_0x4e24('0x4b')]({},_0x3d2d66,_0x5f30a7[_0x4e24('0x56')]);return db[_0x4e24('0x6b')]['count']({'where':_0x3d2d66[_0x4e24('0x4a')]})[_0x4e24('0x1e')](function(_0x2db9b4){_0x864dae[_0x4e24('0x2a')]=_0x2db9b4;if(_0x5f30a7['query'][_0x4e24('0x4e')]){_0x3d2d66[_0x4e24('0x4f')]=[{'all':!![]}];}return db[_0x4e24('0x6b')][_0x4e24('0x67')](_0x3d2d66);})['then'](function(_0x2bd957){_0x864dae[_0x4e24('0x50')]=_0x2bd957;return _0x864dae;});}})[_0x4e24('0x1e')](respondWithFilteredResult(_0x5f0aff,_0x3d2d66))[_0x4e24('0x51')](handleError(_0x5f0aff,null));};exports[_0x4e24('0x6d')]=function(_0x132b01,_0x318370,_0x415593){return db[_0x4e24('0x39')][_0x4e24('0x57')]({'where':{'id':_0x132b01['params']['id']}})[_0x4e24('0x1e')](handleEntityNotFound(_0x318370,null))[_0x4e24('0x1e')](function(_0x2a9a62){if(_0x2a9a62){return _0x2a9a62[_0x4e24('0x6d')](_0x132b01[_0x4e24('0x3f')][_0x4e24('0x69')]);}})[_0x4e24('0x1e')](respondWithStatusCode(_0x318370,null))[_0x4e24('0x51')](handleError(_0x318370,null));};exports[_0x4e24('0x6e')]=function(_0x2e7b4a,_0x1771db,_0x48e661){return db[_0x4e24('0x6f')][_0x4e24('0x57')]({'where':{'id':_0x2e7b4a['params']['id']}})[_0x4e24('0x1e')](handleEntityNotFound(_0x1771db,null))[_0x4e24('0x1e')](function(_0x5eb45c){if(_0x5eb45c){return _0x5eb45c[_0x4e24('0x6e')](_0x2e7b4a[_0x4e24('0x59')][_0x4e24('0x69')],_[_0x4e24('0x70')](_0x2e7b4a[_0x4e24('0x59')],[_0x4e24('0x69'),'id'])||{});}})[_0x4e24('0x1e')](respondWithResult(_0x1771db,null))[_0x4e24('0x51')](handleError(_0x1771db,null));};exports[_0x4e24('0x71')]=function(_0x6d9292,_0x4228ad,_0x51e10e){var _0x2b8182={'raw':![],'where':{}};var _0x147614={};var _0x2d06c8={'count':0x0,'rows':[]};return db[_0x4e24('0x39')][_0x4e24('0x6c')]({'where':{'id':_0x6d9292[_0x4e24('0x53')]['id']}})['then'](handleEntityNotFound(_0x4228ad,null))[_0x4e24('0x1e')](function(_0x2553c9){if(_0x2553c9){_0x147614[_0x4e24('0x41')]=_[_0x4e24('0x3e')](db[_0x4e24('0x6f')]['rawAttributes']);_0x147614[_0x4e24('0x3f')]=_['keys'](_0x6d9292['query']);_0x147614[_0x4e24('0x49')]=_['intersection'](_0x147614[_0x4e24('0x41')],_0x147614[_0x4e24('0x3f')]);_0x2b8182[_0x4e24('0x42')]=_[_0x4e24('0x40')](_0x147614['model'],qs['fields'](_0x6d9292[_0x4e24('0x3f')]['fields']));_0x2b8182[_0x4e24('0x42')]=_0x2b8182[_0x4e24('0x42')][_0x4e24('0x55')]?_0x2b8182['attributes']:_0x147614[_0x4e24('0x41')];if(!_0x6d9292[_0x4e24('0x3f')]['hasOwnProperty'](_0x4e24('0x44'))){_0x2b8182[_0x4e24('0x45')]=qs[_0x4e24('0x45')](_0x6d9292[_0x4e24('0x3f')][_0x4e24('0x45')]);_0x2b8182['offset']=qs[_0x4e24('0x28')](_0x6d9292['query'][_0x4e24('0x28')]);}_0x2b8182[_0x4e24('0x46')]=qs[_0x4e24('0x47')](_0x6d9292[_0x4e24('0x3f')][_0x4e24('0x47')]);_0x2b8182[_0x4e24('0x4a')]=qs[_0x4e24('0x49')](_['pick'](_0x6d9292[_0x4e24('0x3f')],_0x147614['filters']));_0x2b8182[_0x4e24('0x4a')]['FaxAccountId']=_0x2553c9['id'];if(_0x6d9292[_0x4e24('0x3f')][_0x4e24('0x66')]){_0x2b8182[_0x4e24('0x4a')]=_['merge'](_0x2b8182[_0x4e24('0x4a')],{'$or':_[_0x4e24('0x3d')](_0x2b8182['attributes'],function(_0x402fa6){var _0x2ed537={};_0x2ed537[_0x402fa6]={'$like':'%'+_0x6d9292[_0x4e24('0x3f')]['filter']+'%'};return _0x2ed537;})});}_0x2b8182=_[_0x4e24('0x4b')]({},_0x2b8182,_0x6d9292[_0x4e24('0x56')]);return db[_0x4e24('0x6f')][_0x4e24('0x2a')]({'where':_0x2b8182[_0x4e24('0x4a')]})['then'](function(_0x281edf){_0x2d06c8[_0x4e24('0x2a')]=_0x281edf;if(_0x6d9292[_0x4e24('0x3f')]['includeAll']){_0x2b8182[_0x4e24('0x4f')]=[{'model':db[_0x4e24('0x72')],'as':'Contact','required':![]},{'model':db[_0x4e24('0x73')],'as':_0x4e24('0x74'),'attributes':['name',_0x4e24('0x75'),'internal'],'required':![]},{'model':db[_0x4e24('0x76')],'as':_0x4e24('0x77'),'attributes':['id',_0x4e24('0x35'),_0x4e24('0x78')],'where':_0x6d9292[_0x4e24('0x3f')][_0x4e24('0x79')]?{'id':_0x6d9292['query'][_0x4e24('0x79')]}:undefined,'required':_0x6d9292['query']['tag']?!![]:![]}];}return db[_0x4e24('0x6f')][_0x4e24('0x67')](_0x2b8182);})[_0x4e24('0x1e')](function(_0x184fc8){_0x2d06c8['rows']=_0x184fc8;return _0x2d06c8;});}})[_0x4e24('0x1e')](respondWithFilteredResult(_0x4228ad,_0x2b8182))[_0x4e24('0x51')](handleError(_0x4228ad,null));};exports['addApplications']=function(_0x4bf81f,_0x145c99){var _0x52241a=_0x4bf81f[_0x4e24('0x53')]['id'];var _0xe33034=_0x4bf81f[_0x4e24('0x59')];var _0x52a477=0xc8;var _0x31faa5=null;return db['sequelize'][_0x4e24('0x7a')]({'isolationLevel':db[_0x4e24('0x7b')][_0x4e24('0x7c')]['ISOLATION_LEVELS']['READ_COMMITTED']},function(_0x3ffa8a){return db[_0x4e24('0x39')]['findOne']({'where':{'id':_0x52241a},'transaction':_0x3ffa8a})[_0x4e24('0x1e')](function(_0x39c73b){if(_0x39c73b){return db[_0x4e24('0x7d')]['destroy']({'where':{'FaxAccountId':_0x52241a},'transaction':_0x3ffa8a})[_0x4e24('0x1e')](function(){var _0x25ccef=_['map'](_0xe33034,function(_0x3efc1c){_0x3efc1c['FaxAccountId']=_0x52241a;return _0x3efc1c;});return db[_0x4e24('0x7d')]['bulkCreate'](_0x25ccef,{'transaction':_0x3ffa8a});});}else{_0x52a477=0x194;_0x31faa5=[];}});})[_0x4e24('0x1e')](function(){if(_0x52a477!==0x194){return db[_0x4e24('0x7d')][_0x4e24('0x7e')]({'where':{'FaxAccountId':_0x52241a},'order':_0x4e24('0x7f')})['then'](function(_0x456d70){_0x31faa5=_0x456d70;});}})[_0x4e24('0x51')](function(_0x4c569a){_0x52a477=0x1f4;logger[_0x4e24('0x22')](_0x4c569a[_0x4e24('0x34')]);if(_0x4c569a[_0x4e24('0x35')]){delete _0x4c569a[_0x4e24('0x35')];}_0x31faa5=_0x4c569a;})[_0x4e24('0x80')](function(){if(_0x31faa5===null){_0x145c99[_0x4e24('0x33')](_0x52a477);}else{if(_0x52a477===0x1f4){_0x145c99[_0x4e24('0x25')](_0x52a477)[_0x4e24('0x36')](_0x31faa5);}else{_0x145c99['status'](_0x52a477)[_0x4e24('0x27')](_0x31faa5);}}});};exports[_0x4e24('0x81')]=function(_0x2e92fc,_0x401178,_0x3c9d84){var _0x2b8237={};var _0x14e7b5={};var _0x25e72a;var _0x5bbc10;return db['FaxAccount'][_0x4e24('0x6c')]({'where':{'id':_0x2e92fc[_0x4e24('0x53')]['id']}})['then'](handleEntityNotFound(_0x401178,null))['then'](function(_0x3b892b){if(_0x3b892b){_0x25e72a=_0x3b892b;_0x14e7b5[_0x4e24('0x41')]=_['keys'](db[_0x4e24('0x7d')][_0x4e24('0x3a')]);_0x14e7b5[_0x4e24('0x3f')]=_[_0x4e24('0x3e')](_0x2e92fc[_0x4e24('0x3f')]);_0x14e7b5['filters']=_[_0x4e24('0x40')](_0x14e7b5[_0x4e24('0x41')],_0x14e7b5['query']);_0x2b8237[_0x4e24('0x42')]=_[_0x4e24('0x40')](_0x14e7b5[_0x4e24('0x41')],qs[_0x4e24('0x54')](_0x2e92fc[_0x4e24('0x3f')]['fields']));_0x2b8237[_0x4e24('0x42')]=_0x2b8237[_0x4e24('0x42')]['length']?_0x2b8237['attributes']:_0x14e7b5['model'];_0x2b8237[_0x4e24('0x46')]=qs[_0x4e24('0x47')](_0x2e92fc[_0x4e24('0x3f')]['sort']);_0x2b8237[_0x4e24('0x4a')]=qs[_0x4e24('0x49')](_['pick'](_0x2e92fc[_0x4e24('0x3f')],_0x14e7b5['filters']));if(_0x2e92fc[_0x4e24('0x3f')]['filter']){_0x2b8237[_0x4e24('0x4a')]=_['merge'](_0x2b8237[_0x4e24('0x4a')],{'$or':_['map'](_0x2b8237[_0x4e24('0x42')],function(_0x621d85){var _0x550a63={};_0x550a63[_0x621d85]={'$like':'%'+_0x2e92fc[_0x4e24('0x3f')][_0x4e24('0x66')]+'%'};return _0x550a63;})});}_0x2b8237=_[_0x4e24('0x4b')]({},_0x2b8237,_0x2e92fc[_0x4e24('0x56')]);return _0x25e72a[_0x4e24('0x81')](_0x2b8237);}})['then'](function(_0x4858a3){if(_0x4858a3){_0x5bbc10=_0x4858a3[_0x4e24('0x55')];if(!_0x2e92fc[_0x4e24('0x3f')][_0x4e24('0x43')](_0x4e24('0x44'))){_0x2b8237['limit']=qs['limit'](_0x2e92fc[_0x4e24('0x3f')][_0x4e24('0x45')]);_0x2b8237[_0x4e24('0x28')]=qs[_0x4e24('0x28')](_0x2e92fc['query'][_0x4e24('0x28')]);}return _0x25e72a[_0x4e24('0x81')](_0x2b8237);}})['then'](function(_0x27c0bd){if(_0x27c0bd){return _0x27c0bd?{'count':_0x5bbc10,'rows':_0x27c0bd}:null;}})[_0x4e24('0x1e')](respondWithResult(_0x401178,null))[_0x4e24('0x51')](handleError(_0x401178,null));};function Extension(_0x39c5c0,_0x12001a,_0x2a9b54,_0x27c7b4){this['context']=_0x4e24('0x82');this[_0x4e24('0x83')]=_0x39c5c0['localstationid'];this['app']=_0x27c7b4;this[_0x4e24('0x4c')]=_0x4e24('0x84');this[_0x4e24('0x85')]=_0x4e24('0x86');this[_0x4e24('0x63')]=_0x39c5c0['id'];this[_0x4e24('0x7f')]=_0x12001a;this[_0x4e24('0x87')]=_0x2a9b54;}function createExtensionsReciveFax(_0xd12b0b){var _0x505ee9=0x1;var _0x1583d5=[];_0x1583d5['push'](new Extension(_0xd12b0b,_0x505ee9,'',_0x4e24('0x88')));_0x505ee9+=0x1;_0x1583d5[_0x4e24('0x89')](new Extension(_0xd12b0b,_0x505ee9,_0x4e24('0x8a'),'Set'));_0x505ee9+=0x1;for(var _0x4dfcca in _0xd12b0b){if(_0xd12b0b[_0x4e24('0x43')](_0x4dfcca)&&(_0x4dfcca==='ecm'||_0x4dfcca==='localstationid'||_0x4dfcca===_0x4e24('0x8b')||_0x4dfcca===_0x4e24('0x8c')||_0x4dfcca===_0x4e24('0x8d')||_0x4dfcca===_0x4e24('0x8e')||_0x4dfcca===_0x4e24('0x8f')||_0x4dfcca===_0x4e24('0x90')||_0x4dfcca==='t38timeout')){_0x1583d5['push'](new Extension(_0xd12b0b,_0x505ee9,_0x4e24('0x91')+_0x4dfcca+')='+_0xd12b0b[_0x4dfcca],'Set'));_0x505ee9+=0x1;}}_0x1583d5[_0x4e24('0x89')](new Extension(_0xd12b0b,_0x505ee9,'6',_0x4e24('0x92')));_0x505ee9+=0x1;_0x1583d5[_0x4e24('0x89')](new Extension(_0xd12b0b,_0x505ee9,'/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',_0x4e24('0x93')));_0x505ee9=0x0;return _0x1583d5;}exports['addAccountApplications']=function(_0x59c9e7,_0x455aef,_0x4f28c5){var _0xde5322;return db[_0x4e24('0x7b')][_0x4e24('0x7a')](function(_0x29f1b5){return db[_0x4e24('0x39')]['create'](_0x59c9e7[_0x4e24('0x59')],{'transaction':_0x29f1b5})[_0x4e24('0x1e')](function(_0x2eaa62){_0xde5322=_0x2eaa62[_0x4e24('0x5b')]({'plain':!![]});return db[_0x4e24('0x94')]['bulkCreate'](createExtensionsReciveFax(_0xde5322),{'transaction':_0x29f1b5});});})[_0x4e24('0x1e')](function(){return _0xde5322;})[_0x4e24('0x1e')](respondWithResult(_0x455aef,null))[_0x4e24('0x51')](handleError(_0x455aef,null));};exports[_0x4e24('0x95')]=function(_0x1bd4d8,_0x268e84,_0x251b05){var _0x87a677;return db[_0x4e24('0x7b')][_0x4e24('0x7a')](function(_0x3ceb9b){return db[_0x4e24('0x39')][_0x4e24('0x2f')](_0x1bd4d8[_0x4e24('0x59')],{'where':{'id':_0x1bd4d8[_0x4e24('0x59')]['id']},'transaction':_0x3ceb9b})[_0x4e24('0x1e')](function(_0x12d492){return db[_0x4e24('0x94')][_0x4e24('0x30')]({'where':{'FaxAccountId':_0x1bd4d8[_0x4e24('0x59')]['id']},'transaction':_0x3ceb9b})[_0x4e24('0x1e')](function(_0x513284){return db[_0x4e24('0x94')][_0x4e24('0x96')](createExtensionsReciveFax(_[_0x4e24('0x70')](_0x1bd4d8[_0x4e24('0x59')],[_0x4e24('0x97'),_0x4e24('0x3c'),'createdAt','updatedAt',_0x4e24('0x98'),_0x4e24('0x99')])),{'transaction':_0x3ceb9b});});});})[_0x4e24('0x1e')](function(){return db[_0x4e24('0x39')][_0x4e24('0x9a')](_0x1bd4d8[_0x4e24('0x59')]['id']);})[_0x4e24('0x1e')](respondWithResult(_0x268e84,null))[_0x4e24('0x51')](handleError(_0x268e84,null));};exports[_0x4e24('0x9b')]=function(_0x4c8a89,_0x26f23a,_0x4e0610){var _0x1e07fd={'raw':!![],'where':{}};var _0x211292={};var _0x5d670b={'count':0x0,'rows':[]};return db['FaxAccount'][_0x4e24('0x6c')]({'where':{'id':_0x4c8a89[_0x4e24('0x53')]['id']}})['then'](handleEntityNotFound(_0x26f23a,null))['then'](function(_0x43e694){if(_0x43e694){_0x211292[_0x4e24('0x41')]=_[_0x4e24('0x3e')](db['FaxMessage']['rawAttributes']);_0x211292['query']=_[_0x4e24('0x3e')](_0x4c8a89[_0x4e24('0x3f')]);_0x211292['filters']=_[_0x4e24('0x40')](_0x211292[_0x4e24('0x41')],_0x211292[_0x4e24('0x3f')]);_0x1e07fd[_0x4e24('0x42')]=_['intersection'](_0x211292['model'],qs[_0x4e24('0x54')](_0x4c8a89[_0x4e24('0x3f')][_0x4e24('0x54')]));_0x1e07fd[_0x4e24('0x42')]=_0x1e07fd[_0x4e24('0x42')][_0x4e24('0x55')]?_0x1e07fd[_0x4e24('0x42')]:_0x211292[_0x4e24('0x41')];if(!_0x4c8a89[_0x4e24('0x3f')][_0x4e24('0x43')](_0x4e24('0x44'))){_0x1e07fd[_0x4e24('0x45')]=qs[_0x4e24('0x45')](_0x4c8a89[_0x4e24('0x3f')][_0x4e24('0x45')]);_0x1e07fd[_0x4e24('0x28')]=qs[_0x4e24('0x28')](_0x4c8a89[_0x4e24('0x3f')][_0x4e24('0x28')]);}_0x1e07fd[_0x4e24('0x46')]=qs['sort'](_0x4c8a89['query']['sort']);_0x1e07fd[_0x4e24('0x4a')]=qs[_0x4e24('0x49')](_['pick'](_0x4c8a89[_0x4e24('0x3f')],_0x211292[_0x4e24('0x49')]));_0x1e07fd[_0x4e24('0x4a')][_0x4e24('0x63')]=_0x43e694['id'];if(_0x4c8a89[_0x4e24('0x3f')][_0x4e24('0x66')]){_0x1e07fd['where']=_[_0x4e24('0x4b')](_0x1e07fd[_0x4e24('0x4a')],{'$or':_[_0x4e24('0x3d')](_0x1e07fd['attributes'],function(_0x217b3c){var _0x3afa15={};_0x3afa15[_0x217b3c]={'$like':'%'+_0x4c8a89[_0x4e24('0x3f')][_0x4e24('0x66')]+'%'};return _0x3afa15;})});}if(_0x4c8a89['query'][_0x4e24('0x9c')]){var _0x1c11b5=_0x4c8a89[_0x4e24('0x3f')][_0x4e24('0x9c')][_0x4e24('0x9d')](',');var _0x226cb9={};_0x226cb9[_0x1c11b5[0x0]]={'$gte':moment(_0x1c11b5[0x1])[_0x4e24('0x9e')](_0x4e24('0x9f'))};_0x1e07fd[_0x4e24('0x4a')]=_[_0x4e24('0x4b')](_0x1e07fd['where'],_0x226cb9);}_0x1e07fd=_[_0x4e24('0x4b')]({},_0x1e07fd,_0x4c8a89['options']);return db[_0x4e24('0xa0')]['count']({'where':_0x1e07fd[_0x4e24('0x4a')]})[_0x4e24('0x1e')](function(_0x8a49b5){_0x5d670b[_0x4e24('0x2a')]=_0x8a49b5;if(_0x4c8a89[_0x4e24('0x3f')][_0x4e24('0x4e')]){_0x1e07fd[_0x4e24('0x4f')]=[{'all':!![]}];}return db['FaxMessage']['findAll'](_0x1e07fd);})['then'](function(_0x43792e){_0x5d670b[_0x4e24('0x50')]=_0x43792e;return _0x5d670b;});}})[_0x4e24('0x1e')](respondWithFilteredResult(_0x26f23a,_0x1e07fd))[_0x4e24('0x51')](handleError(_0x26f23a,null));};exports[_0x4e24('0x36')]=function(_0x453a6,_0x27604a,_0x3d34d7){var _0x3d24cb,_0x336df2={},_0x1e137d;if(_0x453a6[_0x4e24('0x59')]['to']){_0x1e137d=_0x453a6[_0x4e24('0x59')]['to'][0x0];}return db['FaxAccount'][_0x4e24('0x57')]({'where':{'id':_0x453a6[_0x4e24('0x53')]['id']},'include':[{'model':db[_0x4e24('0xa1')],'as':'List','include':[{'model':db[_0x4e24('0x72')],'as':_0x4e24('0xa2'),'where':{'fax':_0x1e137d},'limit':0x1,'order':[[_0x4e24('0xa3'),_0x4e24('0xa4')]]}]}]})['then'](handleEntityNotFound(_0x27604a,null))[_0x4e24('0x1e')](function(_0x3d0f4b){_0x3d24cb=_0x3d0f4b;if(_0x453a6[_0x4e24('0x59')][_0x4e24('0xa5')]&&_0x453a6[_0x4e24('0x59')][_0x4e24('0xa5')][_0x4e24('0x55')]){for(var _0x48ef9a=0x0;_0x48ef9a<_0x453a6[_0x4e24('0x59')][_0x4e24('0xa5')]['length'];_0x48ef9a+=0x1){_0x453a6[_0x4e24('0x59')][_0x4e24('0xa5')][_0x48ef9a]={'filename':_0x453a6[_0x4e24('0x59')]['attachments'][_0x48ef9a][_0x4e24('0x35')],'id':_0x453a6[_0x4e24('0x59')][_0x4e24('0xa5')][_0x48ef9a]['id'],'path':path['join'](config[_0x4e24('0xa6')],_0x4e24('0xa7'),_0x453a6['body'][_0x4e24('0xa5')][_0x48ef9a][_0x4e24('0xa8')])};}}return respondWithRpcPromise(_0x4e24('0xa9'),_0x4e24('0xa9'),{'FaxAccountId':_[_0x4e24('0xaa')](_0x453a6['params']['id'])?undefined:_0x453a6['params']['id'],'path':_[_0x4e24('0xaa')](_0x453a6['body'][_0x4e24('0xa5')][0x0]['path'])?undefined:_0x453a6[_0x4e24('0x59')][_0x4e24('0xa5')][0x0][_0x4e24('0xab')],'fax':_[_0x4e24('0xaa')](_0x453a6[_0x4e24('0x59')]['to'][0x0])?undefined:_0x453a6['body']['to'][0x0]},client9002);})[_0x4e24('0x1e')](function(){if(_0x3d24cb){if(_[_0x4e24('0xaa')](_0x453a6[_0x4e24('0x59')]['from'])){_0x453a6[_0x4e24('0x59')][_0x4e24('0xac')]=util[_0x4e24('0x9e')](_0x4e24('0xad'),_0x3d24cb[_0x4e24('0x35')],_0x3d24cb[_0x4e24('0xae')]);}if(_0x3d24cb[_0x4e24('0xaf')]){if(_0x3d24cb[_0x4e24('0xaf')][_0x4e24('0xa2')][_0x4e24('0x55')]){return _0x3d24cb[_0x4e24('0xaf')][_0x4e24('0xa2')][0x0];}else{return db[_0x4e24('0x72')][_0x4e24('0x58')](_[_0x4e24('0x16')](_0x453a6['body'],{'firstName':_0x453a6[_0x4e24('0x59')]['to'][0x0],'phone':_0x453a6['body']['to'][0x0],'fax':_0x453a6['body']['to'][0x0],'ListId':_0x3d24cb[_0x4e24('0x99')]}));}}else{throw new Error(_0x4e24('0xb0'));}}else{throw new Error('Send\x20Fax\x20failed');}})['then'](function(_0x3e3cdc){if(_0x3e3cdc){return db[_0x4e24('0x6f')][_0x4e24('0x57')]({'where':{'ContactId':_0x3e3cdc['id'],'closed':![],'FaxAccountId':_0x3d24cb['id']}})[_0x4e24('0x1e')](function(_0x39d2a4){if(_0x39d2a4){return[_0x39d2a4,![]];}return db[_0x4e24('0x6f')][_0x4e24('0x58')]({'UserId':_0x453a6[_0x4e24('0x5a')]['id'],'ContactId':_0x3e3cdc['id'],'FaxAccountId':_0x3d24cb['id'],'fax':_0x453a6['body']['to'][0x0],'firstMsgDirection':_0x4e24('0xb1'),'Messages':[_[_0x4e24('0x4b')](_0x453a6['body'],{'read':![],'body':_0x453a6[_0x4e24('0x59')][_0x4e24('0xa5')][0x0]['filename'],'FaxAccountId':_0x3d24cb['id'],'UserId':_0x453a6[_0x4e24('0x5a')]['id'],'ContactId':_0x3e3cdc['id'],'AttachmentId':_0x453a6[_0x4e24('0x59')][_0x4e24('0xa5')][0x0]['id']})]},{'include':[{'model':db[_0x4e24('0xa0')],'as':_0x4e24('0xb2')}]})['then'](function(_0x5d4b8f){return[_0x5d4b8f,!![]];});});}else{throw new Error(_0x4e24('0xb3'));}})[_0x4e24('0xb4')](function(_0x32ff09,_0x1250ed){if(_0x1250ed){return _0x32ff09;}return db[_0x4e24('0xa0')][_0x4e24('0x58')]({'direction':_0x4e24('0xb1'),'read':![],'body':_0x453a6['body'][_0x4e24('0xa5')][0x0][_0x4e24('0xb5')],'FaxAccountId':_0x3d24cb['id'],'FaxInteractionId':_0x32ff09['id'],'UserId':_0x453a6[_0x4e24('0x5a')]['id'],'ContactId':_0x32ff09['ContactId'],'AttachmentId':_0x453a6['body'][_0x4e24('0xa5')][0x0]['id']})[_0x4e24('0x1e')](function(_0x39da9b){_0x32ff09[_0x4e24('0xb6')][_0x4e24('0xb2')]=[];_0x32ff09[_0x4e24('0xb6')]['Messages'][_0x4e24('0x89')](_0x39da9b[_0x4e24('0xb6')]);return _0x32ff09;});})[_0x4e24('0x1e')](function(_0x1208a0){respondWithRpcPromise(_0x4e24('0xb7'),_0x4e24('0xb7'),{'FaxAccountId':_[_0x4e24('0xaa')](_0x453a6[_0x4e24('0x53')]['id'])?undefined:_0x453a6[_0x4e24('0x53')]['id'],'path':_[_0x4e24('0xaa')](_0x453a6[_0x4e24('0x59')]['attachments'][0x0][_0x4e24('0xab')])?undefined:_0x453a6['body'][_0x4e24('0xa5')][0x0][_0x4e24('0xab')],'fax':_[_0x4e24('0xaa')](_0x453a6[_0x4e24('0x59')]['to'][0x0])?undefined:_0x453a6[_0x4e24('0x59')]['to'][0x0],'AttachmentId':_0x453a6[_0x4e24('0x59')][_0x4e24('0xa5')][0x0]['id']},client9002)['then'](function(_0x37dbce){logger[_0x4e24('0x1f')](_0x4e24('0xb8'),_0x37dbce);})[_0x4e24('0x51')](function(_0x16e564){logger[_0x4e24('0x1f')](_0x4e24('0xb8'),_0x16e564);});return _0x1208a0;})[_0x4e24('0x1e')](respondWithResult(_0x27604a,null))['catch'](handleError(_0x27604a,null));};exports['addAgents']=function(_0x4946e9,_0x3f30bc,_0x2fcdac){return db[_0x4e24('0x39')]['find']({'where':{'id':_0x4946e9[_0x4e24('0x53')]['id']}})[_0x4e24('0x1e')](handleEntityNotFound(_0x3f30bc,null))[_0x4e24('0x1e')](function(_0x28af94){if(_0x28af94){return _0x28af94[_0x4e24('0xb9')](_0x4946e9['body'][_0x4e24('0x69')],_[_0x4e24('0x70')](_0x4946e9[_0x4e24('0x59')],[_0x4e24('0x69'),'id'])||{})[_0x4e24('0xb4')](function(_0x430ecd){for(var _0x5dd5dc=0x0;_0x5dd5dc<_0x4946e9['body'][_0x4e24('0x69')][_0x4e24('0x55')];_0x5dd5dc+=0x1){socket[_0x4e24('0xba')]('userFaxAccount:save',{'UserId':Number(_0x4946e9[_0x4e24('0x59')][_0x4e24('0x69')][_0x5dd5dc]),'FaxAccountId':Number(_0x4946e9[_0x4e24('0x53')]['id'])});}return _0x430ecd;});}})[_0x4e24('0x1e')](respondWithResult(_0x3f30bc,null))[_0x4e24('0x51')](handleError(_0x3f30bc,null));};exports['removeAgents']=function(_0x1d4a47,_0x129d25,_0x2ffd19){return db[_0x4e24('0x39')][_0x4e24('0x57')]({'where':{'id':_0x1d4a47[_0x4e24('0x53')]['id']}})[_0x4e24('0x1e')](handleEntityNotFound(_0x129d25,null))[_0x4e24('0x1e')](function(_0x58de57){if(_0x58de57){return _0x58de57[_0x4e24('0xbb')](_0x1d4a47[_0x4e24('0x3f')][_0x4e24('0x69')])[_0x4e24('0x1e')](function(){if(_[_0x4e24('0xbc')](_0x1d4a47['query']['ids'])){for(var _0x42d7f6=0x0;_0x42d7f6<_0x1d4a47[_0x4e24('0x3f')]['ids'][_0x4e24('0x55')];_0x42d7f6+=0x1){socket[_0x4e24('0xba')]('userFaxAccount:remove',{'UserId':Number(_0x1d4a47[_0x4e24('0x3f')][_0x4e24('0x69')][_0x42d7f6]),'FaxAccountId':Number(_0x1d4a47[_0x4e24('0x53')]['id'])});}}else{socket[_0x4e24('0xba')](_0x4e24('0xbd'),{'UserId':Number(_0x1d4a47[_0x4e24('0x3f')][_0x4e24('0x69')]),'FaxAccountId':Number(_0x1d4a47[_0x4e24('0x53')]['id'])});}});}})[_0x4e24('0x1e')](respondWithStatusCode(_0x129d25,null))[_0x4e24('0x51')](handleError(_0x129d25,null));};exports[_0x4e24('0xbe')]=function(_0x334e75,_0x3cf2ba,_0x578f9f){var _0x444b45={};var _0x4d3e8a={};var _0x1ecf4e;var _0x5ddc5f;return db[_0x4e24('0x39')]['findOne']({'where':{'id':_0x334e75[_0x4e24('0x53')]['id']}})['then'](handleEntityNotFound(_0x3cf2ba,null))[_0x4e24('0x1e')](function(_0x28ee2a){if(_0x28ee2a){_0x1ecf4e=_0x28ee2a;_0x4d3e8a[_0x4e24('0x41')]=_[_0x4e24('0x3e')](db[_0x4e24('0x73')][_0x4e24('0x3a')]);_0x4d3e8a[_0x4e24('0x3f')]=_['keys'](_0x334e75['query']);_0x4d3e8a[_0x4e24('0x49')]=_[_0x4e24('0x40')](_0x4d3e8a['model'],_0x4d3e8a[_0x4e24('0x3f')]);_0x444b45[_0x4e24('0x42')]=_[_0x4e24('0x40')](_0x4d3e8a[_0x4e24('0x41')],qs['fields'](_0x334e75[_0x4e24('0x3f')][_0x4e24('0x54')]));_0x444b45[_0x4e24('0x42')]=_0x444b45['attributes'][_0x4e24('0x55')]?_0x444b45[_0x4e24('0x42')]:_0x4d3e8a[_0x4e24('0x41')];_0x444b45['order']=qs[_0x4e24('0x47')](_0x334e75[_0x4e24('0x3f')]['sort']);_0x444b45[_0x4e24('0x4a')]=qs[_0x4e24('0x49')](_[_0x4e24('0x48')](_0x334e75[_0x4e24('0x3f')],_0x4d3e8a[_0x4e24('0x49')]));if(_0x334e75[_0x4e24('0x3f')][_0x4e24('0x66')]){_0x444b45['where']=_[_0x4e24('0x4b')](_0x444b45[_0x4e24('0x4a')],{'$or':_['map'](_0x444b45[_0x4e24('0x42')],function(_0x48d3d9){var _0x3b8a9c={};_0x3b8a9c[_0x48d3d9]={'$like':'%'+_0x334e75[_0x4e24('0x3f')][_0x4e24('0x66')]+'%'};return _0x3b8a9c;})});}_0x444b45=_[_0x4e24('0x4b')]({},_0x444b45,_0x334e75[_0x4e24('0x56')]);return _0x1ecf4e[_0x4e24('0xbe')](_0x444b45);}})[_0x4e24('0x1e')](function(_0x28b5eb){if(_0x28b5eb){_0x5ddc5f=_0x28b5eb[_0x4e24('0x55')];if(!_0x334e75[_0x4e24('0x3f')][_0x4e24('0x43')](_0x4e24('0x44'))){_0x444b45[_0x4e24('0x45')]=qs[_0x4e24('0x45')](_0x334e75['query']['limit']);_0x444b45[_0x4e24('0x28')]=qs['offset'](_0x334e75['query'][_0x4e24('0x28')]);}return _0x1ecf4e[_0x4e24('0xbe')](_0x444b45);}})['then'](function(_0xe45e7b){if(_0xe45e7b){return _0xe45e7b?{'count':_0x5ddc5f,'rows':_0xe45e7b}:null;}})[_0x4e24('0x1e')](respondWithResult(_0x3cf2ba,null))[_0x4e24('0x51')](handleError(_0x3cf2ba,null));}; \ No newline at end of file +var _0xcc53=['Fax\x20Extension','push','Answer','CDR(type)=inbound-fax','Set','ecm','localstationid','gateway','headerinfo','maxrate','minrate','FAXOPT(','/var/opt/motion2/server/files/attachments/fax-${CALLERID(num)}-${CUT(UNIQUEID,.,1)}-${CUT(UNIQUEID,.,2)}-${STRFTIME(,,%C%y%m%d%H%M%S)}-rx.tif,d','ReceiveFax','addAccountApplications','VoiceExtension','tech','key','createdAt','updatedAt','TrunkId','findById','getMessages','FaxMessage','$gte','split','YYYY-MM-DD\x20HH:mm:ss','CmList','List','Contacts','DESC','attachments','root','server/files/attachments','CheckAfterSend','isNil','from','format','fax','List\x20not\x20found','user','out','filename','Messages','Contact\x20not\x20found','spread','ContactId','dataValues','SendFax','SendFaxRpc,\x20%s','emit','userFaxAccount:save','removeAgents','isArray','userFaxAccount:remove','getAgents','User','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','register','jayson/promise','client','http','request','info','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','get','FaxAccounts','end','sendStatus','stack','name','send','index','Pause','mandatoryDispositionPause','map','FaxAccount','rawAttributes','fieldName','type','model','keys','filters','intersection','query','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','merge','includeAll','findAll','rows','show','params','options','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','find','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','destroy','describe','addDisposition','FaxAccountId','Disposition','findOne','length','filter','ids','addAnswer','CannedAnswer','getAnswers','include','removeAnswers','FaxInteraction','addInteraction','omit','getInteractions','CmContact','Owner','fullname','internal','Tag','Tags','color','tag','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','FaxApplication','bulkCreate','findAndCountAll','priority','getApplications','context','from-voip-provider','exten','app','description'];(function(_0x146dc8,_0x481f69){var _0x48f74a=function(_0x2cee47){while(--_0x2cee47){_0x146dc8['push'](_0x146dc8['shift']());}};_0x48f74a(++_0x481f69);}(_0xcc53,0x102));var _0x3cc5=function(_0x245700,_0x902ce9){_0x245700=_0x245700-0x0;var _0x5f871f=_0xcc53[_0x245700];return _0x5f871f;};'use strict';var emlformat=require(_0x3cc5('0x0'));var rimraf=require(_0x3cc5('0x1'));var zipdir=require(_0x3cc5('0x2'));var jsonpatch=require(_0x3cc5('0x3'));var rp=require(_0x3cc5('0x4'));var moment=require(_0x3cc5('0x5'));var BPromise=require(_0x3cc5('0x6'));var Mustache=require(_0x3cc5('0x7'));var util=require(_0x3cc5('0x8'));var path=require(_0x3cc5('0x9'));var sox=require(_0x3cc5('0xa'));var csv=require('to-csv');var ejs=require(_0x3cc5('0xb'));var fs=require('fs');var fs_extra=require(_0x3cc5('0xc'));var _=require(_0x3cc5('0xd'));var squel=require('squel');var crypto=require(_0x3cc5('0xe'));var jsforce=require(_0x3cc5('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x3cc5('0x10'));var querystring=require(_0x3cc5('0x11'));var Papa=require(_0x3cc5('0x12'));var Redis=require(_0x3cc5('0x13'));var authService=require(_0x3cc5('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0x3cc5('0x15'));var hardwareService=require(_0x3cc5('0x16'));var logger=require(_0x3cc5('0x17'))('api');var utils=require(_0x3cc5('0x18'));var config=require(_0x3cc5('0x19'));var licenseUtil=require(_0x3cc5('0x1a'));var db=require(_0x3cc5('0x1b'))['db'];config[_0x3cc5('0x1c')]=_['defaults'](config[_0x3cc5('0x1c')],{'host':_0x3cc5('0x1d'),'port':0x18eb});var socket=require(_0x3cc5('0x1e'))(new Redis(config[_0x3cc5('0x1c')]));require('./faxAccount.socket')[_0x3cc5('0x1f')](socket);var jayson=require(_0x3cc5('0x20'));var client=jayson[_0x3cc5('0x21')][_0x3cc5('0x22')]({'port':0x232c});var client9002=jayson['client'][_0x3cc5('0x22')]({'port':0x232a});function respondWithRpcPromise(_0x33a041,_0x2fa5bc,_0x45609b,_0x1472e0){return new BPromise(function(_0x2f1b6a,_0x8d589d){var _0x2f8981=_0x1472e0||client;return _0x2f8981[_0x3cc5('0x23')](_0x33a041,_0x45609b)['then'](function(_0x15e6d8){logger[_0x3cc5('0x24')](_0x3cc5('0x25'),_0x2fa5bc,_0x3cc5('0x26'));logger[_0x3cc5('0x27')]('FaxAccount,\x20%s,\x20%s,\x20%s',_0x2fa5bc,'request\x20sent',JSON[_0x3cc5('0x28')](_0x15e6d8));if(_0x15e6d8['error']){if(_0x15e6d8[_0x3cc5('0x29')][_0x3cc5('0x2a')]===0x1f4){logger[_0x3cc5('0x29')](_0x3cc5('0x25'),_0x2fa5bc,_0x15e6d8[_0x3cc5('0x29')]['message']);return _0x8d589d(_0x15e6d8[_0x3cc5('0x29')][_0x3cc5('0x2b')]);}logger[_0x3cc5('0x29')]('FaxAccount,\x20%s,\x20%s',_0x2fa5bc,_0x15e6d8[_0x3cc5('0x29')][_0x3cc5('0x2b')]);return _0x2f1b6a(_0x15e6d8[_0x3cc5('0x29')]['message']);}else{logger['info'](_0x3cc5('0x25'),_0x2fa5bc,_0x3cc5('0x26'));_0x2f1b6a(_0x15e6d8[_0x3cc5('0x2c')][_0x3cc5('0x2b')]);}})[_0x3cc5('0x2d')](function(_0x2b7054){logger['error'](_0x3cc5('0x25'),_0x2fa5bc,_0x2b7054);_0x8d589d(_0x2b7054);});});}function respondWithStatusCode(_0x40e476,_0x5d83fd){_0x5d83fd=_0x5d83fd||0xcc;return function(_0x2d76bd){if(_0x2d76bd){return _0x40e476['sendStatus'](_0x5d83fd);}return _0x40e476[_0x3cc5('0x2e')](_0x5d83fd)['end']();};}function respondWithResult(_0xac6b0c,_0x3774b6){_0x3774b6=_0x3774b6||0xc8;return function(_0x424007){if(_0x424007){return _0xac6b0c['status'](_0x3774b6)[_0x3cc5('0x2f')](_0x424007);}};}function respondWithFilteredResult(_0x3e95d9,_0x1ad0e3){return function(_0x547373){if(_0x547373){var _0x50eae1=typeof _0x1ad0e3['offset']===_0x3cc5('0x30')&&typeof _0x1ad0e3[_0x3cc5('0x31')]==='undefined';var _0xde04cd=_0x547373[_0x3cc5('0x32')];var _0x3117d6=_0x50eae1?0x0:_0x1ad0e3[_0x3cc5('0x33')];var _0x28f9cd=_0x50eae1?_0x547373[_0x3cc5('0x32')]:_0x1ad0e3['offset']+_0x1ad0e3[_0x3cc5('0x31')];var _0x201996;if(_0x28f9cd>=_0xde04cd){_0x28f9cd=_0xde04cd;_0x201996=0xc8;}else{_0x201996=0xce;}_0x3e95d9[_0x3cc5('0x2e')](_0x201996);return _0x3e95d9[_0x3cc5('0x34')](_0x3cc5('0x35'),_0x3117d6+'-'+_0x28f9cd+'/'+_0xde04cd)[_0x3cc5('0x2f')](_0x547373);}return null;};}function patchUpdates(_0x549036){return function(_0x225dd3){try{jsonpatch[_0x3cc5('0x36')](_0x225dd3,_0x549036,!![]);}catch(_0x15be0f){return BPromise[_0x3cc5('0x37')](_0x15be0f);}return _0x225dd3[_0x3cc5('0x38')]();};}function saveUpdates(_0x3f22a4,_0x48b42f){return function(_0x54679c){if(_0x54679c){return _0x54679c[_0x3cc5('0x39')](_0x3f22a4)[_0x3cc5('0x3a')](function(_0x12e70c){return _0x12e70c;});}return null;};}function removeEntity(_0x35e496,_0x3ba961){return function(_0x2dfc0f){if(_0x2dfc0f){return _0x2dfc0f['destroy']()['then'](function(){var _0x5b2e7a=_0x2dfc0f[_0x3cc5('0x3b')]({'plain':!![]});var _0xa3f6ec=_0x3cc5('0x3c');return db['UserProfileResource']['destroy']({'where':{'type':_0xa3f6ec,'resourceId':_0x5b2e7a['id']}})[_0x3cc5('0x3a')](function(){return _0x2dfc0f;});})[_0x3cc5('0x3a')](function(){_0x35e496['status'](0xcc)[_0x3cc5('0x3d')]();});}};}function handleEntityNotFound(_0x2f81cc,_0x232cc1){return function(_0x4e563c){if(!_0x4e563c){_0x2f81cc[_0x3cc5('0x3e')](0x194);}return _0x4e563c;};}function handleError(_0x790c41,_0x4380a5){_0x4380a5=_0x4380a5||0x1f4;return function(_0x41fb47){logger['error'](_0x41fb47[_0x3cc5('0x3f')]);if(_0x41fb47[_0x3cc5('0x40')]){delete _0x41fb47[_0x3cc5('0x40')];}_0x790c41[_0x3cc5('0x2e')](_0x4380a5)[_0x3cc5('0x41')](_0x41fb47);};}exports[_0x3cc5('0x42')]=function(_0x9688ea,_0x197978){var _0x3626da={'include':[{'model':db[_0x3cc5('0x43')],'as':_0x3cc5('0x44')}]},_0x3b4c38={},_0x2c5e58={'count':0x0,'rows':[]};var _0x4812e2=_[_0x3cc5('0x45')](db[_0x3cc5('0x46')][_0x3cc5('0x47')],function(_0x61bbc2){return{'name':_0x61bbc2[_0x3cc5('0x48')],'type':_0x61bbc2[_0x3cc5('0x49')]['key']};});_0x3b4c38[_0x3cc5('0x4a')]=_[_0x3cc5('0x45')](_0x4812e2,_0x3cc5('0x40'));_0x3b4c38['query']=_[_0x3cc5('0x4b')](_0x9688ea['query']);_0x3b4c38[_0x3cc5('0x4c')]=_[_0x3cc5('0x4d')](_0x3b4c38['model'],_0x3b4c38[_0x3cc5('0x4e')]);_0x3626da[_0x3cc5('0x4f')]=_[_0x3cc5('0x4d')](_0x3b4c38[_0x3cc5('0x4a')],qs[_0x3cc5('0x50')](_0x9688ea[_0x3cc5('0x4e')][_0x3cc5('0x50')]));_0x3626da[_0x3cc5('0x4f')]=_0x3626da[_0x3cc5('0x4f')]['length']?_0x3626da[_0x3cc5('0x4f')]:_0x3b4c38[_0x3cc5('0x4a')];if(!_0x9688ea[_0x3cc5('0x4e')][_0x3cc5('0x51')](_0x3cc5('0x52'))){_0x3626da['limit']=qs[_0x3cc5('0x31')](_0x9688ea[_0x3cc5('0x4e')][_0x3cc5('0x31')]);_0x3626da[_0x3cc5('0x33')]=qs[_0x3cc5('0x33')](_0x9688ea[_0x3cc5('0x4e')]['offset']);}_0x3626da[_0x3cc5('0x53')]=qs[_0x3cc5('0x54')](_0x9688ea[_0x3cc5('0x4e')][_0x3cc5('0x54')]);_0x3626da[_0x3cc5('0x55')]=qs[_0x3cc5('0x4c')](_[_0x3cc5('0x56')](_0x9688ea[_0x3cc5('0x4e')],_0x3b4c38[_0x3cc5('0x4c')]),_0x4812e2);if(_0x9688ea[_0x3cc5('0x4e')]['filter']){_0x3626da['where']=_['merge'](_0x3626da['where'],{'$or':_[_0x3cc5('0x45')](_0x4812e2,function(_0x3110d4){if(_0x3110d4[_0x3cc5('0x49')]!=='VIRTUAL'){var _0x2d1177={};_0x2d1177[_0x3110d4[_0x3cc5('0x40')]]={'$like':'%'+_0x9688ea[_0x3cc5('0x4e')]['filter']+'%'};return _0x2d1177;}})});}_0x3626da=_[_0x3cc5('0x57')]({},_0x3626da,_0x9688ea['options']);var _0x391b53={'where':_0x3626da[_0x3cc5('0x55')]};return db['FaxAccount'][_0x3cc5('0x32')](_0x391b53)[_0x3cc5('0x3a')](function(_0x453311){_0x2c5e58[_0x3cc5('0x32')]=_0x453311;if(_0x9688ea[_0x3cc5('0x4e')][_0x3cc5('0x58')]){_0x3626da['include']=[{'all':!![]}];}return db[_0x3cc5('0x46')][_0x3cc5('0x59')](_0x3626da);})[_0x3cc5('0x3a')](function(_0x21073d){_0x2c5e58[_0x3cc5('0x5a')]=_0x21073d;return _0x2c5e58;})['then'](respondWithFilteredResult(_0x197978,_0x3626da))[_0x3cc5('0x2d')](handleError(_0x197978,null));};exports[_0x3cc5('0x5b')]=function(_0x51d61a,_0x2f20f6){var _0x3e9f11={'raw':![],'where':{'id':_0x51d61a[_0x3cc5('0x5c')]['id']},'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]},_0x154de3={};_0x154de3[_0x3cc5('0x4a')]=_[_0x3cc5('0x4b')](db[_0x3cc5('0x46')][_0x3cc5('0x47')]);_0x154de3['query']=_[_0x3cc5('0x4b')](_0x51d61a[_0x3cc5('0x4e')]);_0x154de3[_0x3cc5('0x4c')]=_[_0x3cc5('0x4d')](_0x154de3['model'],_0x154de3[_0x3cc5('0x4e')]);_0x3e9f11[_0x3cc5('0x4f')]=_[_0x3cc5('0x4d')](_0x154de3[_0x3cc5('0x4a')],qs[_0x3cc5('0x50')](_0x51d61a[_0x3cc5('0x4e')][_0x3cc5('0x50')]));_0x3e9f11['attributes']=_0x3e9f11[_0x3cc5('0x4f')]['length']?_0x3e9f11[_0x3cc5('0x4f')]:_0x154de3[_0x3cc5('0x4a')];if(_0x51d61a[_0x3cc5('0x4e')][_0x3cc5('0x58')]){_0x3e9f11['include']=[{'all':!![]}];}_0x3e9f11=_[_0x3cc5('0x57')]({},_0x3e9f11,_0x51d61a[_0x3cc5('0x5d')]);return db[_0x3cc5('0x46')]['find'](_0x3e9f11)[_0x3cc5('0x3a')](handleEntityNotFound(_0x2f20f6,null))[_0x3cc5('0x3a')](respondWithResult(_0x2f20f6,null))[_0x3cc5('0x2d')](handleError(_0x2f20f6,null));};exports['create']=function(_0x5ee538,_0x585808){return db['FaxAccount'][_0x3cc5('0x5e')](_0x5ee538[_0x3cc5('0x5f')],{})[_0x3cc5('0x3a')](function(_0x51e80a){var _0x47f8a7=_0x5ee538['user'][_0x3cc5('0x3b')]({'plain':!![]});if(!_0x47f8a7)throw new Error(_0x3cc5('0x60'));if(_0x47f8a7[_0x3cc5('0x61')]==='user'){var _0x134dfb=_0x51e80a['get']({'plain':!![]});var _0x57653e='FaxAccounts';return db['UserProfileSection'][_0x3cc5('0x62')]({'where':{'name':_0x57653e,'userProfileId':_0x47f8a7['userProfileId']},'raw':!![]})['then'](function(_0x247466){if(_0x247466&&_0x247466[_0x3cc5('0x63')]===0x0){return db[_0x3cc5('0x64')]['create']({'name':_0x134dfb['name'],'resourceId':_0x134dfb['id'],'type':_0x247466[_0x3cc5('0x40')],'sectionId':_0x247466['id']},{})[_0x3cc5('0x3a')](function(){return _0x51e80a;});}else{return _0x51e80a;}})[_0x3cc5('0x2d')](function(_0x5c2abe){logger['error'](_0x3cc5('0x65'),_0x5c2abe);throw _0x5c2abe;});}return _0x51e80a;})['then'](respondWithResult(_0x585808,0xc9))[_0x3cc5('0x2d')](handleError(_0x585808,null));};exports[_0x3cc5('0x39')]=function(_0x57988b,_0x525a67){if(_0x57988b[_0x3cc5('0x5f')]['id']){delete _0x57988b[_0x3cc5('0x5f')]['id'];}return db['FaxAccount']['find']({'where':{'id':_0x57988b[_0x3cc5('0x5c')]['id']},'include':[{'model':db[_0x3cc5('0x43')],'as':_0x3cc5('0x44')}]})[_0x3cc5('0x3a')](handleEntityNotFound(_0x525a67,null))[_0x3cc5('0x3a')](saveUpdates(_0x57988b['body'],null))[_0x3cc5('0x3a')](respondWithResult(_0x525a67,null))['catch'](handleError(_0x525a67,null));};exports[_0x3cc5('0x66')]=function(_0x1e3b8f,_0x2690bb){return db[_0x3cc5('0x46')][_0x3cc5('0x62')]({'where':{'id':_0x1e3b8f[_0x3cc5('0x5c')]['id']}})[_0x3cc5('0x3a')](handleEntityNotFound(_0x2690bb,null))['then'](removeEntity(_0x2690bb,null))['catch'](handleError(_0x2690bb,null));};exports[_0x3cc5('0x67')]=function(_0x9b8df0,_0x18d96d){return db[_0x3cc5('0x46')][_0x3cc5('0x67')]()[_0x3cc5('0x3a')](respondWithResult(_0x18d96d,null))[_0x3cc5('0x2d')](handleError(_0x18d96d,null));};exports[_0x3cc5('0x68')]=function(_0x394698,_0x5eb01b,_0x38679b){if(_0x394698[_0x3cc5('0x5f')]['id']){delete _0x394698[_0x3cc5('0x5f')]['id'];}return db['FaxAccount'][_0x3cc5('0x62')]({'where':{'id':_0x394698['params']['id']}})[_0x3cc5('0x3a')](handleEntityNotFound(_0x5eb01b,null))[_0x3cc5('0x3a')](function(_0xe15a8b){if(_0xe15a8b){_0x394698[_0x3cc5('0x5f')][_0x3cc5('0x69')]=_0xe15a8b['id'];return db[_0x3cc5('0x6a')][_0x3cc5('0x5e')](_0x394698[_0x3cc5('0x5f')]);}})[_0x3cc5('0x3a')](respondWithResult(_0x5eb01b,null))[_0x3cc5('0x2d')](handleError(_0x5eb01b,null));};exports['getDispositions']=function(_0x1d2e46,_0x5c82a6,_0x5a06a2){var _0x33e637={'raw':![],'where':{}};var _0x4bdee7={};var _0x4396f3={'count':0x0,'rows':[]};return db[_0x3cc5('0x46')][_0x3cc5('0x6b')]({'where':{'id':_0x1d2e46[_0x3cc5('0x5c')]['id']}})[_0x3cc5('0x3a')](handleEntityNotFound(_0x5c82a6,null))[_0x3cc5('0x3a')](function(_0x3499b1){if(_0x3499b1){_0x4bdee7[_0x3cc5('0x4a')]=_[_0x3cc5('0x4b')](db[_0x3cc5('0x6a')][_0x3cc5('0x47')]);_0x4bdee7[_0x3cc5('0x4e')]=_['keys'](_0x1d2e46[_0x3cc5('0x4e')]);_0x4bdee7[_0x3cc5('0x4c')]=_['intersection'](_0x4bdee7['model'],_0x4bdee7['query']);_0x33e637[_0x3cc5('0x4f')]=_['intersection'](_0x4bdee7[_0x3cc5('0x4a')],qs[_0x3cc5('0x50')](_0x1d2e46[_0x3cc5('0x4e')][_0x3cc5('0x50')]));_0x33e637[_0x3cc5('0x4f')]=_0x33e637[_0x3cc5('0x4f')][_0x3cc5('0x6c')]?_0x33e637[_0x3cc5('0x4f')]:_0x4bdee7[_0x3cc5('0x4a')];if(!_0x1d2e46['query'][_0x3cc5('0x51')]('nolimit')){_0x33e637[_0x3cc5('0x31')]=qs[_0x3cc5('0x31')](_0x1d2e46[_0x3cc5('0x4e')]['limit']);_0x33e637[_0x3cc5('0x33')]=qs[_0x3cc5('0x33')](_0x1d2e46[_0x3cc5('0x4e')]['offset']);}_0x33e637[_0x3cc5('0x53')]=qs[_0x3cc5('0x54')](_0x1d2e46[_0x3cc5('0x4e')][_0x3cc5('0x54')]);_0x33e637[_0x3cc5('0x55')]=qs[_0x3cc5('0x4c')](_['pick'](_0x1d2e46[_0x3cc5('0x4e')],_0x4bdee7[_0x3cc5('0x4c')]));_0x33e637[_0x3cc5('0x55')][_0x3cc5('0x69')]=_0x3499b1['id'];if(_0x1d2e46[_0x3cc5('0x4e')][_0x3cc5('0x6d')]){_0x33e637[_0x3cc5('0x55')]=_[_0x3cc5('0x57')](_0x33e637[_0x3cc5('0x55')],{'$or':_[_0x3cc5('0x45')](_0x33e637[_0x3cc5('0x4f')],function(_0xdf38c1){var _0x1ffaaa={};_0x1ffaaa[_0xdf38c1]={'$like':'%'+_0x1d2e46[_0x3cc5('0x4e')][_0x3cc5('0x6d')]+'%'};return _0x1ffaaa;})});}_0x33e637=_[_0x3cc5('0x57')]({},_0x33e637,_0x1d2e46[_0x3cc5('0x5d')]);return db[_0x3cc5('0x6a')][_0x3cc5('0x32')]({'where':_0x33e637['where']})[_0x3cc5('0x3a')](function(_0x2f83f1){_0x4396f3[_0x3cc5('0x32')]=_0x2f83f1;if(_0x1d2e46['query']['includeAll']){_0x33e637['include']=[{'all':!![]}];}return db[_0x3cc5('0x6a')][_0x3cc5('0x59')](_0x33e637);})[_0x3cc5('0x3a')](function(_0x8598aa){_0x4396f3[_0x3cc5('0x5a')]=_0x8598aa;return _0x4396f3;});}})[_0x3cc5('0x3a')](respondWithFilteredResult(_0x5c82a6,_0x33e637))[_0x3cc5('0x2d')](handleError(_0x5c82a6,null));};exports['removeDispositions']=function(_0x537c25,_0x50ddaa,_0x92e1ed){return db[_0x3cc5('0x46')][_0x3cc5('0x62')]({'where':{'id':_0x537c25['params']['id']}})[_0x3cc5('0x3a')](handleEntityNotFound(_0x50ddaa,null))['then'](function(_0xdfad1c){if(_0xdfad1c){return _0xdfad1c['removeDispositions'](_0x537c25[_0x3cc5('0x4e')][_0x3cc5('0x6e')]);}})[_0x3cc5('0x3a')](respondWithStatusCode(_0x50ddaa,null))[_0x3cc5('0x2d')](handleError(_0x50ddaa,null));};exports[_0x3cc5('0x6f')]=function(_0xd805f,_0x528896,_0x493a35){if(_0xd805f['body']['id']){delete _0xd805f[_0x3cc5('0x5f')]['id'];}return db[_0x3cc5('0x46')][_0x3cc5('0x62')]({'where':{'id':_0xd805f[_0x3cc5('0x5c')]['id']}})[_0x3cc5('0x3a')](handleEntityNotFound(_0x528896,null))[_0x3cc5('0x3a')](function(_0x28dac3){if(_0x28dac3){_0xd805f['body'][_0x3cc5('0x69')]=_0x28dac3['id'];return db[_0x3cc5('0x70')][_0x3cc5('0x5e')](_0xd805f['body']);}})[_0x3cc5('0x3a')](respondWithResult(_0x528896,null))['catch'](handleError(_0x528896,null));};exports[_0x3cc5('0x71')]=function(_0xd5e678,_0x52c5f2,_0x24cff7){var _0x50eddc={'raw':![],'where':{}};var _0x1b6fcb={};var _0x2645bb={'count':0x0,'rows':[]};return db['FaxAccount'][_0x3cc5('0x6b')]({'where':{'id':_0xd5e678[_0x3cc5('0x5c')]['id']}})[_0x3cc5('0x3a')](handleEntityNotFound(_0x52c5f2,null))['then'](function(_0x396df6){if(_0x396df6){_0x1b6fcb[_0x3cc5('0x4a')]=_['keys'](db['CannedAnswer']['rawAttributes']);_0x1b6fcb[_0x3cc5('0x4e')]=_[_0x3cc5('0x4b')](_0xd5e678[_0x3cc5('0x4e')]);_0x1b6fcb[_0x3cc5('0x4c')]=_[_0x3cc5('0x4d')](_0x1b6fcb[_0x3cc5('0x4a')],_0x1b6fcb[_0x3cc5('0x4e')]);_0x50eddc[_0x3cc5('0x4f')]=_[_0x3cc5('0x4d')](_0x1b6fcb[_0x3cc5('0x4a')],qs[_0x3cc5('0x50')](_0xd5e678[_0x3cc5('0x4e')]['fields']));_0x50eddc[_0x3cc5('0x4f')]=_0x50eddc[_0x3cc5('0x4f')][_0x3cc5('0x6c')]?_0x50eddc[_0x3cc5('0x4f')]:_0x1b6fcb['model'];if(!_0xd5e678[_0x3cc5('0x4e')]['hasOwnProperty'](_0x3cc5('0x52'))){_0x50eddc[_0x3cc5('0x31')]=qs[_0x3cc5('0x31')](_0xd5e678[_0x3cc5('0x4e')][_0x3cc5('0x31')]);_0x50eddc[_0x3cc5('0x33')]=qs['offset'](_0xd5e678['query'][_0x3cc5('0x33')]);}_0x50eddc[_0x3cc5('0x53')]=qs[_0x3cc5('0x54')](_0xd5e678[_0x3cc5('0x4e')][_0x3cc5('0x54')]);_0x50eddc['where']=qs[_0x3cc5('0x4c')](_['pick'](_0xd5e678[_0x3cc5('0x4e')],_0x1b6fcb[_0x3cc5('0x4c')]));_0x50eddc[_0x3cc5('0x55')]['FaxAccountId']=_0x396df6['id'];if(_0xd5e678[_0x3cc5('0x4e')][_0x3cc5('0x6d')]){_0x50eddc[_0x3cc5('0x55')]=_[_0x3cc5('0x57')](_0x50eddc[_0x3cc5('0x55')],{'$or':_[_0x3cc5('0x45')](_0x50eddc[_0x3cc5('0x4f')],function(_0x59d055){var _0x55fa40={};_0x55fa40[_0x59d055]={'$like':'%'+_0xd5e678[_0x3cc5('0x4e')][_0x3cc5('0x6d')]+'%'};return _0x55fa40;})});}_0x50eddc=_[_0x3cc5('0x57')]({},_0x50eddc,_0xd5e678[_0x3cc5('0x5d')]);return db[_0x3cc5('0x70')][_0x3cc5('0x32')]({'where':_0x50eddc['where']})['then'](function(_0x1e49a5){_0x2645bb[_0x3cc5('0x32')]=_0x1e49a5;if(_0xd5e678[_0x3cc5('0x4e')][_0x3cc5('0x58')]){_0x50eddc[_0x3cc5('0x72')]=[{'all':!![]}];}return db['CannedAnswer']['findAll'](_0x50eddc);})['then'](function(_0x48994b){_0x2645bb['rows']=_0x48994b;return _0x2645bb;});}})['then'](respondWithFilteredResult(_0x52c5f2,_0x50eddc))[_0x3cc5('0x2d')](handleError(_0x52c5f2,null));};exports[_0x3cc5('0x73')]=function(_0x33f30b,_0x5c1272,_0x5b63db){return db[_0x3cc5('0x46')][_0x3cc5('0x62')]({'where':{'id':_0x33f30b[_0x3cc5('0x5c')]['id']}})['then'](handleEntityNotFound(_0x5c1272,null))[_0x3cc5('0x3a')](function(_0x10c910){if(_0x10c910){return _0x10c910[_0x3cc5('0x73')](_0x33f30b[_0x3cc5('0x4e')][_0x3cc5('0x6e')]);}})['then'](respondWithStatusCode(_0x5c1272,null))['catch'](handleError(_0x5c1272,null));};exports['addInteraction']=function(_0xf9a322,_0x381ad6,_0xea817c){return db[_0x3cc5('0x74')][_0x3cc5('0x62')]({'where':{'id':_0xf9a322[_0x3cc5('0x5c')]['id']}})[_0x3cc5('0x3a')](handleEntityNotFound(_0x381ad6,null))[_0x3cc5('0x3a')](function(_0x3684af){if(_0x3684af){return _0x3684af[_0x3cc5('0x75')](_0xf9a322[_0x3cc5('0x5f')][_0x3cc5('0x6e')],_[_0x3cc5('0x76')](_0xf9a322['body'],[_0x3cc5('0x6e'),'id'])||{});}})[_0x3cc5('0x3a')](respondWithResult(_0x381ad6,null))[_0x3cc5('0x2d')](handleError(_0x381ad6,null));};exports[_0x3cc5('0x77')]=function(_0x16c12e,_0x397b00,_0x1bd1b3){var _0x91978b={'raw':![],'where':{}};var _0x340f5f={};var _0x4f075d={'count':0x0,'rows':[]};return db['FaxAccount'][_0x3cc5('0x6b')]({'where':{'id':_0x16c12e[_0x3cc5('0x5c')]['id']}})[_0x3cc5('0x3a')](handleEntityNotFound(_0x397b00,null))[_0x3cc5('0x3a')](function(_0x456df2){if(_0x456df2){_0x340f5f[_0x3cc5('0x4a')]=_[_0x3cc5('0x4b')](db['FaxInteraction'][_0x3cc5('0x47')]);_0x340f5f[_0x3cc5('0x4e')]=_[_0x3cc5('0x4b')](_0x16c12e['query']);_0x340f5f[_0x3cc5('0x4c')]=_['intersection'](_0x340f5f[_0x3cc5('0x4a')],_0x340f5f[_0x3cc5('0x4e')]);_0x91978b[_0x3cc5('0x4f')]=_[_0x3cc5('0x4d')](_0x340f5f[_0x3cc5('0x4a')],qs[_0x3cc5('0x50')](_0x16c12e[_0x3cc5('0x4e')][_0x3cc5('0x50')]));_0x91978b[_0x3cc5('0x4f')]=_0x91978b[_0x3cc5('0x4f')][_0x3cc5('0x6c')]?_0x91978b[_0x3cc5('0x4f')]:_0x340f5f['model'];if(!_0x16c12e[_0x3cc5('0x4e')]['hasOwnProperty'](_0x3cc5('0x52'))){_0x91978b[_0x3cc5('0x31')]=qs[_0x3cc5('0x31')](_0x16c12e['query']['limit']);_0x91978b[_0x3cc5('0x33')]=qs[_0x3cc5('0x33')](_0x16c12e[_0x3cc5('0x4e')][_0x3cc5('0x33')]);}_0x91978b[_0x3cc5('0x53')]=qs[_0x3cc5('0x54')](_0x16c12e[_0x3cc5('0x4e')]['sort']);_0x91978b[_0x3cc5('0x55')]=qs['filters'](_[_0x3cc5('0x56')](_0x16c12e[_0x3cc5('0x4e')],_0x340f5f[_0x3cc5('0x4c')]));_0x91978b[_0x3cc5('0x55')][_0x3cc5('0x69')]=_0x456df2['id'];if(_0x16c12e[_0x3cc5('0x4e')][_0x3cc5('0x6d')]){_0x91978b[_0x3cc5('0x55')]=_[_0x3cc5('0x57')](_0x91978b[_0x3cc5('0x55')],{'$or':_[_0x3cc5('0x45')](_0x91978b[_0x3cc5('0x4f')],function(_0x4e9915){var _0xe2a434={};_0xe2a434[_0x4e9915]={'$like':'%'+_0x16c12e[_0x3cc5('0x4e')][_0x3cc5('0x6d')]+'%'};return _0xe2a434;})});}_0x91978b=_['merge']({},_0x91978b,_0x16c12e[_0x3cc5('0x5d')]);return db[_0x3cc5('0x74')][_0x3cc5('0x32')]({'where':_0x91978b['where']})['then'](function(_0x4bb39c){_0x4f075d['count']=_0x4bb39c;if(_0x16c12e[_0x3cc5('0x4e')]['includeAll']){_0x91978b['include']=[{'model':db[_0x3cc5('0x78')],'as':'Contact','required':![]},{'model':db['User'],'as':_0x3cc5('0x79'),'attributes':[_0x3cc5('0x40'),_0x3cc5('0x7a'),_0x3cc5('0x7b')],'required':![]},{'model':db[_0x3cc5('0x7c')],'as':_0x3cc5('0x7d'),'attributes':['id',_0x3cc5('0x40'),_0x3cc5('0x7e')],'where':_0x16c12e[_0x3cc5('0x4e')][_0x3cc5('0x7f')]?{'id':_0x16c12e['query'][_0x3cc5('0x7f')]}:undefined,'required':_0x16c12e[_0x3cc5('0x4e')][_0x3cc5('0x7f')]?!![]:![]}];}return db[_0x3cc5('0x74')][_0x3cc5('0x59')](_0x91978b);})[_0x3cc5('0x3a')](function(_0x14ce25){_0x4f075d['rows']=_0x14ce25;return _0x4f075d;});}})['then'](respondWithFilteredResult(_0x397b00,_0x91978b))['catch'](handleError(_0x397b00,null));};exports[_0x3cc5('0x80')]=function(_0x29af60,_0x265188){var _0x4dc734=_0x29af60['params']['id'];var _0x34ad3e=_0x29af60['body'];var _0x7b7ee2=0xc8;var _0x505518=null;return db[_0x3cc5('0x81')][_0x3cc5('0x82')]({'isolationLevel':db[_0x3cc5('0x81')][_0x3cc5('0x83')][_0x3cc5('0x84')][_0x3cc5('0x85')]},function(_0x359ba2){return db[_0x3cc5('0x46')]['findOne']({'where':{'id':_0x4dc734},'transaction':_0x359ba2})[_0x3cc5('0x3a')](function(_0x15d2d0){if(_0x15d2d0){return db[_0x3cc5('0x86')][_0x3cc5('0x66')]({'where':{'FaxAccountId':_0x4dc734},'transaction':_0x359ba2})[_0x3cc5('0x3a')](function(){var _0x356a5b=_[_0x3cc5('0x45')](_0x34ad3e,function(_0x45c873){_0x45c873[_0x3cc5('0x69')]=_0x4dc734;return _0x45c873;});return db['FaxApplication'][_0x3cc5('0x87')](_0x356a5b,{'transaction':_0x359ba2});});}else{_0x7b7ee2=0x194;_0x505518=[];}});})[_0x3cc5('0x3a')](function(){if(_0x7b7ee2!==0x194){return db[_0x3cc5('0x86')][_0x3cc5('0x88')]({'where':{'FaxAccountId':_0x4dc734},'order':_0x3cc5('0x89')})[_0x3cc5('0x3a')](function(_0x16f507){_0x505518=_0x16f507;});}})[_0x3cc5('0x2d')](function(_0x38f906){_0x7b7ee2=0x1f4;logger[_0x3cc5('0x29')](_0x38f906[_0x3cc5('0x3f')]);if(_0x38f906['name']){delete _0x38f906['name'];}_0x505518=_0x38f906;})['finally'](function(){if(_0x505518===null){_0x265188[_0x3cc5('0x3e')](_0x7b7ee2);}else{if(_0x7b7ee2===0x1f4){_0x265188[_0x3cc5('0x2e')](_0x7b7ee2)[_0x3cc5('0x41')](_0x505518);}else{_0x265188[_0x3cc5('0x2e')](_0x7b7ee2)['json'](_0x505518);}}});};exports[_0x3cc5('0x8a')]=function(_0x156717,_0x138a3f,_0x381ccf){var _0x3558c9={};var _0x2b98fb={};var _0xe69eaa;var _0x10c55a;return db['FaxAccount']['findOne']({'where':{'id':_0x156717[_0x3cc5('0x5c')]['id']}})[_0x3cc5('0x3a')](handleEntityNotFound(_0x138a3f,null))[_0x3cc5('0x3a')](function(_0x339386){if(_0x339386){_0xe69eaa=_0x339386;_0x2b98fb[_0x3cc5('0x4a')]=_[_0x3cc5('0x4b')](db[_0x3cc5('0x86')][_0x3cc5('0x47')]);_0x2b98fb[_0x3cc5('0x4e')]=_['keys'](_0x156717['query']);_0x2b98fb[_0x3cc5('0x4c')]=_[_0x3cc5('0x4d')](_0x2b98fb[_0x3cc5('0x4a')],_0x2b98fb['query']);_0x3558c9['attributes']=_[_0x3cc5('0x4d')](_0x2b98fb[_0x3cc5('0x4a')],qs['fields'](_0x156717[_0x3cc5('0x4e')][_0x3cc5('0x50')]));_0x3558c9['attributes']=_0x3558c9[_0x3cc5('0x4f')]['length']?_0x3558c9[_0x3cc5('0x4f')]:_0x2b98fb[_0x3cc5('0x4a')];_0x3558c9[_0x3cc5('0x53')]=qs[_0x3cc5('0x54')](_0x156717[_0x3cc5('0x4e')]['sort']);_0x3558c9[_0x3cc5('0x55')]=qs[_0x3cc5('0x4c')](_[_0x3cc5('0x56')](_0x156717[_0x3cc5('0x4e')],_0x2b98fb[_0x3cc5('0x4c')]));if(_0x156717[_0x3cc5('0x4e')]['filter']){_0x3558c9[_0x3cc5('0x55')]=_[_0x3cc5('0x57')](_0x3558c9['where'],{'$or':_['map'](_0x3558c9[_0x3cc5('0x4f')],function(_0x38456c){var _0x194d09={};_0x194d09[_0x38456c]={'$like':'%'+_0x156717[_0x3cc5('0x4e')]['filter']+'%'};return _0x194d09;})});}_0x3558c9=_['merge']({},_0x3558c9,_0x156717[_0x3cc5('0x5d')]);return _0xe69eaa[_0x3cc5('0x8a')](_0x3558c9);}})[_0x3cc5('0x3a')](function(_0x5d10bf){if(_0x5d10bf){_0x10c55a=_0x5d10bf[_0x3cc5('0x6c')];if(!_0x156717[_0x3cc5('0x4e')][_0x3cc5('0x51')](_0x3cc5('0x52'))){_0x3558c9[_0x3cc5('0x31')]=qs[_0x3cc5('0x31')](_0x156717['query'][_0x3cc5('0x31')]);_0x3558c9[_0x3cc5('0x33')]=qs[_0x3cc5('0x33')](_0x156717[_0x3cc5('0x4e')][_0x3cc5('0x33')]);}return _0xe69eaa['getApplications'](_0x3558c9);}})[_0x3cc5('0x3a')](function(_0x168cc3){if(_0x168cc3){return _0x168cc3?{'count':_0x10c55a,'rows':_0x168cc3}:null;}})[_0x3cc5('0x3a')](respondWithResult(_0x138a3f,null))[_0x3cc5('0x2d')](handleError(_0x138a3f,null));};function Extension(_0x5c0722,_0x2f815e,_0x13d043,_0x138d24){this[_0x3cc5('0x8b')]=_0x3cc5('0x8c');this[_0x3cc5('0x8d')]=_0x5c0722['localstationid'];this[_0x3cc5('0x8e')]=_0x138d24;this['type']='system';this[_0x3cc5('0x8f')]=_0x3cc5('0x90');this[_0x3cc5('0x69')]=_0x5c0722['id'];this[_0x3cc5('0x89')]=_0x2f815e;this['appdata']=_0x13d043;}function createExtensionsReciveFax(_0x2f1601){var _0x165178=0x1;var _0x575700=[];_0x575700[_0x3cc5('0x91')](new Extension(_0x2f1601,_0x165178,'',_0x3cc5('0x92')));_0x165178+=0x1;_0x575700['push'](new Extension(_0x2f1601,_0x165178,_0x3cc5('0x93'),_0x3cc5('0x94')));_0x165178+=0x1;for(var _0x3addac in _0x2f1601){if(_0x2f1601[_0x3cc5('0x51')](_0x3addac)&&(_0x3addac===_0x3cc5('0x95')||_0x3addac===_0x3cc5('0x96')||_0x3addac===_0x3cc5('0x97')||_0x3addac==='faxdetect'||_0x3addac===_0x3cc5('0x98')||_0x3addac===_0x3cc5('0x99')||_0x3addac===_0x3cc5('0x9a')||_0x3addac==='modem'||_0x3addac==='t38timeout')){_0x575700[_0x3cc5('0x91')](new Extension(_0x2f1601,_0x165178,_0x3cc5('0x9b')+_0x3addac+')='+_0x2f1601[_0x3addac],_0x3cc5('0x94')));_0x165178+=0x1;}}_0x575700[_0x3cc5('0x91')](new Extension(_0x2f1601,_0x165178,'6','Wait'));_0x165178+=0x1;_0x575700['push'](new Extension(_0x2f1601,_0x165178,_0x3cc5('0x9c'),_0x3cc5('0x9d')));_0x165178=0x0;return _0x575700;}exports[_0x3cc5('0x9e')]=function(_0x29729f,_0x3b7f7b,_0x750c55){var _0x32fbbb;return db[_0x3cc5('0x81')][_0x3cc5('0x82')](function(_0x1ebce5){return db[_0x3cc5('0x46')][_0x3cc5('0x5e')](_0x29729f['body'],{'transaction':_0x1ebce5})[_0x3cc5('0x3a')](function(_0x5169a4){_0x32fbbb=_0x5169a4['get']({'plain':!![]});return db[_0x3cc5('0x9f')][_0x3cc5('0x87')](createExtensionsReciveFax(_0x32fbbb),{'transaction':_0x1ebce5});});})['then'](function(){return _0x32fbbb;})[_0x3cc5('0x3a')](respondWithResult(_0x3b7f7b,null))[_0x3cc5('0x2d')](handleError(_0x3b7f7b,null));};exports['updateAccountApplications']=function(_0x3036ca,_0x12a3d9,_0x1b491f){var _0x3f7c98;return db[_0x3cc5('0x81')][_0x3cc5('0x82')](function(_0x213cf1){return db[_0x3cc5('0x46')]['update'](_0x3036ca['body'],{'where':{'id':_0x3036ca[_0x3cc5('0x5f')]['id']},'transaction':_0x213cf1})[_0x3cc5('0x3a')](function(_0x5af877){return db[_0x3cc5('0x9f')][_0x3cc5('0x66')]({'where':{'FaxAccountId':_0x3036ca[_0x3cc5('0x5f')]['id']},'transaction':_0x213cf1})[_0x3cc5('0x3a')](function(_0x1b0224){return db[_0x3cc5('0x9f')][_0x3cc5('0x87')](createExtensionsReciveFax(_[_0x3cc5('0x76')](_0x3036ca[_0x3cc5('0x5f')],[_0x3cc5('0xa0'),_0x3cc5('0xa1'),_0x3cc5('0xa2'),_0x3cc5('0xa3'),_0x3cc5('0xa4'),'ListId'])),{'transaction':_0x213cf1});});});})[_0x3cc5('0x3a')](function(){return db[_0x3cc5('0x46')][_0x3cc5('0xa5')](_0x3036ca['body']['id']);})[_0x3cc5('0x3a')](respondWithResult(_0x12a3d9,null))['catch'](handleError(_0x12a3d9,null));};exports[_0x3cc5('0xa6')]=function(_0x439fbd,_0x3139b4,_0x974d6d){var _0xb58160={'raw':!![],'where':{}};var _0x368249={};var _0x16d5a9={'count':0x0,'rows':[]};return db[_0x3cc5('0x46')][_0x3cc5('0x6b')]({'where':{'id':_0x439fbd[_0x3cc5('0x5c')]['id']}})[_0x3cc5('0x3a')](handleEntityNotFound(_0x3139b4,null))[_0x3cc5('0x3a')](function(_0xeb769c){if(_0xeb769c){_0x368249[_0x3cc5('0x4a')]=_[_0x3cc5('0x4b')](db[_0x3cc5('0xa7')][_0x3cc5('0x47')]);_0x368249['query']=_[_0x3cc5('0x4b')](_0x439fbd[_0x3cc5('0x4e')]);_0x368249[_0x3cc5('0x4c')]=_[_0x3cc5('0x4d')](_0x368249[_0x3cc5('0x4a')],_0x368249[_0x3cc5('0x4e')]);_0xb58160[_0x3cc5('0x4f')]=_[_0x3cc5('0x4d')](_0x368249[_0x3cc5('0x4a')],qs[_0x3cc5('0x50')](_0x439fbd[_0x3cc5('0x4e')][_0x3cc5('0x50')]));_0xb58160[_0x3cc5('0x4f')]=_0xb58160[_0x3cc5('0x4f')]['length']?_0xb58160['attributes']:_0x368249[_0x3cc5('0x4a')];if(!_0x439fbd[_0x3cc5('0x4e')][_0x3cc5('0x51')](_0x3cc5('0x52'))){_0xb58160[_0x3cc5('0x31')]=qs[_0x3cc5('0x31')](_0x439fbd[_0x3cc5('0x4e')][_0x3cc5('0x31')]);_0xb58160[_0x3cc5('0x33')]=qs['offset'](_0x439fbd['query'][_0x3cc5('0x33')]);}_0xb58160[_0x3cc5('0x53')]=qs[_0x3cc5('0x54')](_0x439fbd[_0x3cc5('0x4e')][_0x3cc5('0x54')]);_0xb58160[_0x3cc5('0x55')]=qs[_0x3cc5('0x4c')](_['pick'](_0x439fbd['query'],_0x368249[_0x3cc5('0x4c')]));_0xb58160[_0x3cc5('0x55')][_0x3cc5('0x69')]=_0xeb769c['id'];if(_0x439fbd[_0x3cc5('0x4e')]['filter']){_0xb58160[_0x3cc5('0x55')]=_[_0x3cc5('0x57')](_0xb58160[_0x3cc5('0x55')],{'$or':_['map'](_0xb58160[_0x3cc5('0x4f')],function(_0x459e3c){var _0x2ca865={};_0x2ca865[_0x459e3c]={'$like':'%'+_0x439fbd[_0x3cc5('0x4e')][_0x3cc5('0x6d')]+'%'};return _0x2ca865;})});}if(_0x439fbd['query'][_0x3cc5('0xa8')]){var _0x1529ac=_0x439fbd[_0x3cc5('0x4e')][_0x3cc5('0xa8')][_0x3cc5('0xa9')](',');var _0x405fc3={};_0x405fc3[_0x1529ac[0x0]]={'$gte':moment(_0x1529ac[0x1])['format'](_0x3cc5('0xaa'))};_0xb58160[_0x3cc5('0x55')]=_[_0x3cc5('0x57')](_0xb58160[_0x3cc5('0x55')],_0x405fc3);}_0xb58160=_['merge']({},_0xb58160,_0x439fbd[_0x3cc5('0x5d')]);return db['FaxMessage'][_0x3cc5('0x32')]({'where':_0xb58160[_0x3cc5('0x55')]})[_0x3cc5('0x3a')](function(_0x3b56ca){_0x16d5a9[_0x3cc5('0x32')]=_0x3b56ca;if(_0x439fbd[_0x3cc5('0x4e')][_0x3cc5('0x58')]){_0xb58160[_0x3cc5('0x72')]=[{'all':!![]}];}return db[_0x3cc5('0xa7')][_0x3cc5('0x59')](_0xb58160);})[_0x3cc5('0x3a')](function(_0x20ccbf){_0x16d5a9[_0x3cc5('0x5a')]=_0x20ccbf;return _0x16d5a9;});}})[_0x3cc5('0x3a')](respondWithFilteredResult(_0x3139b4,_0xb58160))[_0x3cc5('0x2d')](handleError(_0x3139b4,null));};exports[_0x3cc5('0x41')]=function(_0xa2a809,_0x599f8e,_0x25e0db){var _0x122bbe,_0x2932bf={},_0x4d2ef8;if(_0xa2a809[_0x3cc5('0x5f')]['to']){_0x4d2ef8=_0xa2a809[_0x3cc5('0x5f')]['to'][0x0];}return db[_0x3cc5('0x46')]['find']({'where':{'id':_0xa2a809[_0x3cc5('0x5c')]['id']},'include':[{'model':db[_0x3cc5('0xab')],'as':_0x3cc5('0xac'),'include':[{'model':db['CmContact'],'as':_0x3cc5('0xad'),'where':{'fax':_0x4d2ef8},'limit':0x1,'order':[[_0x3cc5('0xa3'),_0x3cc5('0xae')]]}]}]})[_0x3cc5('0x3a')](handleEntityNotFound(_0x599f8e,null))[_0x3cc5('0x3a')](function(_0xff3e05){_0x122bbe=_0xff3e05;if(_0xa2a809[_0x3cc5('0x5f')][_0x3cc5('0xaf')]&&_0xa2a809['body'][_0x3cc5('0xaf')]['length']){for(var _0x31271d=0x0;_0x31271d<_0xa2a809[_0x3cc5('0x5f')][_0x3cc5('0xaf')][_0x3cc5('0x6c')];_0x31271d+=0x1){_0xa2a809['body'][_0x3cc5('0xaf')][_0x31271d]={'filename':_0xa2a809[_0x3cc5('0x5f')][_0x3cc5('0xaf')][_0x31271d][_0x3cc5('0x40')],'id':_0xa2a809[_0x3cc5('0x5f')][_0x3cc5('0xaf')][_0x31271d]['id'],'path':path['join'](config[_0x3cc5('0xb0')],_0x3cc5('0xb1'),_0xa2a809['body']['attachments'][_0x31271d]['basename'])};}}return respondWithRpcPromise('CheckAfterSend',_0x3cc5('0xb2'),{'FaxAccountId':_[_0x3cc5('0xb3')](_0xa2a809['params']['id'])?undefined:_0xa2a809[_0x3cc5('0x5c')]['id'],'path':_['isNil'](_0xa2a809[_0x3cc5('0x5f')][_0x3cc5('0xaf')][0x0][_0x3cc5('0x9')])?undefined:_0xa2a809[_0x3cc5('0x5f')][_0x3cc5('0xaf')][0x0][_0x3cc5('0x9')],'fax':_[_0x3cc5('0xb3')](_0xa2a809[_0x3cc5('0x5f')]['to'][0x0])?undefined:_0xa2a809[_0x3cc5('0x5f')]['to'][0x0]},client9002);})['then'](function(){if(_0x122bbe){if(_[_0x3cc5('0xb3')](_0xa2a809[_0x3cc5('0x5f')][_0x3cc5('0xb4')])){_0xa2a809[_0x3cc5('0x5f')][_0x3cc5('0xb4')]=util[_0x3cc5('0xb5')]('\x22%s\x22\x20<%s>',_0x122bbe['name'],_0x122bbe[_0x3cc5('0xb6')]);}if(_0x122bbe[_0x3cc5('0xac')]){if(_0x122bbe['List'][_0x3cc5('0xad')][_0x3cc5('0x6c')]){return _0x122bbe['List'][_0x3cc5('0xad')][0x0];}else{return db['CmContact'][_0x3cc5('0x5e')](_['defaults'](_0xa2a809[_0x3cc5('0x5f')],{'firstName':_0xa2a809[_0x3cc5('0x5f')]['to'][0x0],'phone':_0xa2a809[_0x3cc5('0x5f')]['to'][0x0],'fax':_0xa2a809[_0x3cc5('0x5f')]['to'][0x0],'ListId':_0x122bbe['ListId']}));}}else{throw new Error(_0x3cc5('0xb7'));}}else{throw new Error('Send\x20Fax\x20failed');}})[_0x3cc5('0x3a')](function(_0x28edcb){if(_0x28edcb){return db[_0x3cc5('0x74')][_0x3cc5('0x62')]({'where':{'ContactId':_0x28edcb['id'],'closed':![],'FaxAccountId':_0x122bbe['id']}})[_0x3cc5('0x3a')](function(_0x260560){if(_0x260560){return[_0x260560,![]];}return db[_0x3cc5('0x74')][_0x3cc5('0x5e')]({'UserId':_0xa2a809[_0x3cc5('0xb8')]['id'],'ContactId':_0x28edcb['id'],'FaxAccountId':_0x122bbe['id'],'fax':_0xa2a809['body']['to'][0x0],'firstMsgDirection':_0x3cc5('0xb9'),'Messages':[_[_0x3cc5('0x57')](_0xa2a809[_0x3cc5('0x5f')],{'read':![],'body':_0xa2a809[_0x3cc5('0x5f')][_0x3cc5('0xaf')][0x0][_0x3cc5('0xba')],'FaxAccountId':_0x122bbe['id'],'UserId':_0xa2a809[_0x3cc5('0xb8')]['id'],'ContactId':_0x28edcb['id'],'AttachmentId':_0xa2a809[_0x3cc5('0x5f')][_0x3cc5('0xaf')][0x0]['id']})]},{'include':[{'model':db[_0x3cc5('0xa7')],'as':_0x3cc5('0xbb')}]})[_0x3cc5('0x3a')](function(_0x2eec5f){return[_0x2eec5f,!![]];});});}else{throw new Error(_0x3cc5('0xbc'));}})[_0x3cc5('0xbd')](function(_0x4f5876,_0x47b6c9){if(_0x47b6c9){return _0x4f5876;}return db[_0x3cc5('0xa7')]['create']({'direction':'out','read':![],'body':_0xa2a809[_0x3cc5('0x5f')][_0x3cc5('0xaf')][0x0][_0x3cc5('0xba')],'FaxAccountId':_0x122bbe['id'],'FaxInteractionId':_0x4f5876['id'],'UserId':_0xa2a809['user']['id'],'ContactId':_0x4f5876[_0x3cc5('0xbe')],'AttachmentId':_0xa2a809['body']['attachments'][0x0]['id']})['then'](function(_0x2d9413){_0x4f5876[_0x3cc5('0xbf')][_0x3cc5('0xbb')]=[];_0x4f5876[_0x3cc5('0xbf')][_0x3cc5('0xbb')][_0x3cc5('0x91')](_0x2d9413['dataValues']);return _0x4f5876;});})['then'](function(_0x57f7b9){respondWithRpcPromise(_0x3cc5('0xc0'),'SendFax',{'FaxAccountId':_[_0x3cc5('0xb3')](_0xa2a809['params']['id'])?undefined:_0xa2a809['params']['id'],'path':_[_0x3cc5('0xb3')](_0xa2a809['body'][_0x3cc5('0xaf')][0x0][_0x3cc5('0x9')])?undefined:_0xa2a809[_0x3cc5('0x5f')][_0x3cc5('0xaf')][0x0][_0x3cc5('0x9')],'fax':_[_0x3cc5('0xb3')](_0xa2a809['body']['to'][0x0])?undefined:_0xa2a809[_0x3cc5('0x5f')]['to'][0x0],'AttachmentId':_0xa2a809[_0x3cc5('0x5f')]['attachments'][0x0]['id']},client9002)['then'](function(_0x437ac2){logger[_0x3cc5('0x24')](_0x3cc5('0xc1'),_0x437ac2);})['catch'](function(_0x5c24fc){logger[_0x3cc5('0x24')](_0x3cc5('0xc1'),_0x5c24fc);});return _0x57f7b9;})['then'](respondWithResult(_0x599f8e,null))[_0x3cc5('0x2d')](handleError(_0x599f8e,null));};exports['addAgents']=function(_0x445f53,_0x3ec271,_0x3a3f0b){return db[_0x3cc5('0x46')]['find']({'where':{'id':_0x445f53[_0x3cc5('0x5c')]['id']}})['then'](handleEntityNotFound(_0x3ec271,null))[_0x3cc5('0x3a')](function(_0x117b2c){if(_0x117b2c){return _0x117b2c['addAgents'](_0x445f53[_0x3cc5('0x5f')][_0x3cc5('0x6e')],_[_0x3cc5('0x76')](_0x445f53['body'],[_0x3cc5('0x6e'),'id'])||{})[_0x3cc5('0xbd')](function(_0x48a2c2){for(var _0x329745=0x0;_0x329745<_0x445f53[_0x3cc5('0x5f')][_0x3cc5('0x6e')][_0x3cc5('0x6c')];_0x329745+=0x1){socket[_0x3cc5('0xc2')](_0x3cc5('0xc3'),{'UserId':Number(_0x445f53[_0x3cc5('0x5f')]['ids'][_0x329745]),'FaxAccountId':Number(_0x445f53[_0x3cc5('0x5c')]['id'])});}return _0x48a2c2;});}})['then'](respondWithResult(_0x3ec271,null))[_0x3cc5('0x2d')](handleError(_0x3ec271,null));};exports[_0x3cc5('0xc4')]=function(_0x405517,_0x53e6c5,_0x3f8ba3){return db[_0x3cc5('0x46')][_0x3cc5('0x62')]({'where':{'id':_0x405517[_0x3cc5('0x5c')]['id']}})[_0x3cc5('0x3a')](handleEntityNotFound(_0x53e6c5,null))['then'](function(_0x15c719){if(_0x15c719){return _0x15c719[_0x3cc5('0xc4')](_0x405517[_0x3cc5('0x4e')]['ids'])[_0x3cc5('0x3a')](function(){if(_[_0x3cc5('0xc5')](_0x405517[_0x3cc5('0x4e')][_0x3cc5('0x6e')])){for(var _0xf984f9=0x0;_0xf984f9<_0x405517[_0x3cc5('0x4e')][_0x3cc5('0x6e')][_0x3cc5('0x6c')];_0xf984f9+=0x1){socket['emit'](_0x3cc5('0xc6'),{'UserId':Number(_0x405517[_0x3cc5('0x4e')][_0x3cc5('0x6e')][_0xf984f9]),'FaxAccountId':Number(_0x405517['params']['id'])});}}else{socket['emit'](_0x3cc5('0xc6'),{'UserId':Number(_0x405517[_0x3cc5('0x4e')][_0x3cc5('0x6e')]),'FaxAccountId':Number(_0x405517[_0x3cc5('0x5c')]['id'])});}});}})[_0x3cc5('0x3a')](respondWithStatusCode(_0x53e6c5,null))['catch'](handleError(_0x53e6c5,null));};exports[_0x3cc5('0xc7')]=function(_0x5ca62e,_0x3ffbe2,_0xa611b){var _0x28bbe5={};var _0x99644e={};var _0x61cb7a;var _0x3c937d;return db[_0x3cc5('0x46')]['findOne']({'where':{'id':_0x5ca62e[_0x3cc5('0x5c')]['id']}})[_0x3cc5('0x3a')](handleEntityNotFound(_0x3ffbe2,null))[_0x3cc5('0x3a')](function(_0x3c9134){if(_0x3c9134){_0x61cb7a=_0x3c9134;_0x99644e[_0x3cc5('0x4a')]=_[_0x3cc5('0x4b')](db[_0x3cc5('0xc8')][_0x3cc5('0x47')]);_0x99644e[_0x3cc5('0x4e')]=_[_0x3cc5('0x4b')](_0x5ca62e[_0x3cc5('0x4e')]);_0x99644e[_0x3cc5('0x4c')]=_[_0x3cc5('0x4d')](_0x99644e[_0x3cc5('0x4a')],_0x99644e[_0x3cc5('0x4e')]);_0x28bbe5[_0x3cc5('0x4f')]=_[_0x3cc5('0x4d')](_0x99644e[_0x3cc5('0x4a')],qs[_0x3cc5('0x50')](_0x5ca62e[_0x3cc5('0x4e')]['fields']));_0x28bbe5[_0x3cc5('0x4f')]=_0x28bbe5[_0x3cc5('0x4f')][_0x3cc5('0x6c')]?_0x28bbe5[_0x3cc5('0x4f')]:_0x99644e[_0x3cc5('0x4a')];_0x28bbe5[_0x3cc5('0x53')]=qs[_0x3cc5('0x54')](_0x5ca62e[_0x3cc5('0x4e')][_0x3cc5('0x54')]);_0x28bbe5[_0x3cc5('0x55')]=qs[_0x3cc5('0x4c')](_[_0x3cc5('0x56')](_0x5ca62e[_0x3cc5('0x4e')],_0x99644e[_0x3cc5('0x4c')]));if(_0x5ca62e[_0x3cc5('0x4e')][_0x3cc5('0x6d')]){_0x28bbe5['where']=_['merge'](_0x28bbe5['where'],{'$or':_[_0x3cc5('0x45')](_0x28bbe5[_0x3cc5('0x4f')],function(_0x341b46){var _0xf4cc69={};_0xf4cc69[_0x341b46]={'$like':'%'+_0x5ca62e[_0x3cc5('0x4e')]['filter']+'%'};return _0xf4cc69;})});}_0x28bbe5=_[_0x3cc5('0x57')]({},_0x28bbe5,_0x5ca62e[_0x3cc5('0x5d')]);return _0x61cb7a['getAgents'](_0x28bbe5);}})[_0x3cc5('0x3a')](function(_0x55e3a4){if(_0x55e3a4){_0x3c937d=_0x55e3a4[_0x3cc5('0x6c')];if(!_0x5ca62e[_0x3cc5('0x4e')][_0x3cc5('0x51')](_0x3cc5('0x52'))){_0x28bbe5['limit']=qs['limit'](_0x5ca62e['query'][_0x3cc5('0x31')]);_0x28bbe5[_0x3cc5('0x33')]=qs[_0x3cc5('0x33')](_0x5ca62e[_0x3cc5('0x4e')][_0x3cc5('0x33')]);}return _0x61cb7a[_0x3cc5('0xc7')](_0x28bbe5);}})[_0x3cc5('0x3a')](function(_0x1e64bd){if(_0x1e64bd){return _0x1e64bd?{'count':_0x3c937d,'rows':_0x1e64bd}:null;}})[_0x3cc5('0x3a')](respondWithResult(_0x3ffbe2,null))['catch'](handleError(_0x3ffbe2,null));}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.events.js b/server/api/faxAccount/faxAccount.events.js index c792d59..08b8d8c 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 _0xe44d=['emit','hasOwnProperty','hook','events','FaxAccount','setMaxListeners','save','update','remove'];(function(_0x1306e9,_0x4fd1ce){var _0x15eafb=function(_0x16ebed){while(--_0x16ebed){_0x1306e9['push'](_0x1306e9['shift']());}};_0x15eafb(++_0x4fd1ce);}(_0xe44d,0xc0));var _0xde44=function(_0x5c2e3e,_0x26ecd3){_0x5c2e3e=_0x5c2e3e-0x0;var _0x53f64a=_0xe44d[_0x5c2e3e];return _0x53f64a;};'use strict';var EventEmitter=require(_0xde44('0x0'));var FaxAccount=require('../../mysqldb')['db'][_0xde44('0x1')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0xde44('0x2')](0x0);var events={'afterCreate':_0xde44('0x3'),'afterUpdate':_0xde44('0x4'),'afterDestroy':_0xde44('0x5')};function emitEvent(_0x70ab4d){return function(_0x51e32,_0x534872,_0x27d5da){FaxAccountEvents[_0xde44('0x6')](_0x70ab4d+':'+_0x51e32['id'],_0x51e32);FaxAccountEvents[_0xde44('0x6')](_0x70ab4d,_0x51e32);_0x27d5da(null);};}for(var e in events){if(events[_0xde44('0x7')](e)){var event=events[e];FaxAccount[_0xde44('0x8')](e,emitEvent(event));}}module['exports']=FaxAccountEvents; \ No newline at end of file +var _0x1b31=['remove','emit','exports','events','FaxAccount'];(function(_0x4f2c56,_0xf7c9a7){var _0x45d8b9=function(_0x354aaa){while(--_0x354aaa){_0x4f2c56['push'](_0x4f2c56['shift']());}};_0x45d8b9(++_0xf7c9a7);}(_0x1b31,0x8f));var _0x11b3=function(_0x3af2c4,_0x4c13ef){_0x3af2c4=_0x3af2c4-0x0;var _0x131495=_0x1b31[_0x3af2c4];return _0x131495;};'use strict';var EventEmitter=require(_0x11b3('0x0'));var FaxAccount=require('../../mysqldb')['db'][_0x11b3('0x1')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x11b3('0x2')};function emitEvent(_0xee2438){return function(_0x1cbea8,_0x170791,_0xcd793e){FaxAccountEvents[_0x11b3('0x3')](_0xee2438+':'+_0x1cbea8['id'],_0x1cbea8);FaxAccountEvents['emit'](_0xee2438,_0x1cbea8);_0xcd793e(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxAccount['hook'](e,emitEvent(event));}}module[_0x11b3('0x4')]=FaxAccountEvents; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.model.js b/server/api/faxAccount/faxAccount.model.js index 4227384..d73d452 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 _0x8270=['bluebird','rimraf','../../config/environment','./faxAccount.attributes','exports','define','FaxAccount','fax_accounts','lodash','util','../../config/logger','api','moment'];(function(_0x2d992e,_0x19de68){var _0x336657=function(_0x1b479f){while(--_0x1b479f){_0x2d992e['push'](_0x2d992e['shift']());}};_0x336657(++_0x19de68);}(_0x8270,0x10c));var _0x0827=function(_0x4d133d,_0x562833){_0x4d133d=_0x4d133d-0x0;var _0x375d87=_0x8270[_0x4d133d];return _0x375d87;};'use strict';var _=require(_0x0827('0x0'));var util=require(_0x0827('0x1'));var logger=require(_0x0827('0x2'))(_0x0827('0x3'));var moment=require(_0x0827('0x4'));var BPromise=require(_0x0827('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x0827('0x6'));var config=require(_0x0827('0x7'));var attributes=require(_0x0827('0x8'));module[_0x0827('0x9')]=function(_0xb6357e,_0x2ff546){return _0xb6357e[_0x0827('0xa')](_0x0827('0xb'),attributes,{'tableName':_0x0827('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0059=['FaxAccount','fax_accounts','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./faxAccount.attributes','exports','define'];(function(_0x628eee,_0x3f3fba){var _0x447718=function(_0x38112b){while(--_0x38112b){_0x628eee['push'](_0x628eee['shift']());}};_0x447718(++_0x3f3fba);}(_0x0059,0x10c));var _0x9005=function(_0x3e21f4,_0x43d310){_0x3e21f4=_0x3e21f4-0x0;var _0x40fc49=_0x0059[_0x3e21f4];return _0x40fc49;};'use strict';var _=require(_0x9005('0x0'));var util=require(_0x9005('0x1'));var logger=require(_0x9005('0x2'))(_0x9005('0x3'));var moment=require(_0x9005('0x4'));var BPromise=require(_0x9005('0x5'));var rp=require(_0x9005('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9005('0x7'));var config=require(_0x9005('0x8'));var attributes=require(_0x9005('0x9'));module[_0x9005('0xa')]=function(_0x48d20b,_0x3b58b0){return _0x48d20b[_0x9005('0xb')](_0x9005('0xc'),attributes,{'tableName':_0x9005('0xd'),'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 5b6d14b..b6d48f5 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 _0xb4fa=['find','account','CmList','List','Contacts','DESC','FaxApplication','Applications','get','applications','orderBy','asc','length','create','contact','FaxInteraction','spread','autoclose','push','close','unmanaged','*,*,*,*','created','interaction','FaxMessage','ContactId','AttachmentId','UserId','name','agent','queueId','FaxQueue','unshift','waitForTheAssignedQueue','Start','startRouting','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','redis','defaults','localhost','./faxAccount.socket','register','request','info','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','error','code','FaxAccount,\x20%s,\x20%s','message','result','catch','GetFaxAccount','FaxAccount','findAll','options','raw','where','attributes','limit','include','map','model','then','NotifyFaxAccount','fax','CmContact','describe','Sequelize','no\x20available\x20attributes','keys','createdAt','difference','updatedAt','ListId','body','from','ValidationError','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','isNil','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes'];(function(_0x224df3,_0x4bee29){var _0x544b14=function(_0x571be3){while(--_0x571be3){_0x224df3['push'](_0x224df3['shift']());}};_0x544b14(++_0x4bee29);}(_0xb4fa,0x82));var _0xab4f=function(_0x2f8d1d,_0x23e53e){_0x2f8d1d=_0x2f8d1d-0x0;var _0x23890d=_0xb4fa[_0x2f8d1d];return _0x23890d;};'use strict';var _=require('lodash');var util=require(_0xab4f('0x0'));var moment=require(_0xab4f('0x1'));var BPromise=require(_0xab4f('0x2'));var rs=require(_0xab4f('0x3'));var fs=require('fs');var Redis=require(_0xab4f('0x4'));var db=require(_0xab4f('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xab4f('0x6'))(_0xab4f('0x7'));var config=require('../../config/environment');var jayson=require(_0xab4f('0x8'));var client=jayson[_0xab4f('0x9')]['http']({'port':0x232c});config[_0xab4f('0xa')]=_[_0xab4f('0xb')](config[_0xab4f('0xa')],{'host':_0xab4f('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xab4f('0xa')]));require(_0xab4f('0xd'))[_0xab4f('0xe')](socket);function respondWithRpcPromise(_0x1dd0b0,_0x2bd57f,_0x2f78eb){return new BPromise(function(_0x41c2df,_0x2ef8f5){return client[_0xab4f('0xf')](_0x1dd0b0,_0x2f78eb)['then'](function(_0x43001d){logger[_0xab4f('0x10')]('FaxAccount,\x20%s,\x20%s',_0x2bd57f,_0xab4f('0x11'));logger[_0xab4f('0x12')](_0xab4f('0x13'),_0x2bd57f,_0xab4f('0x11'),JSON['stringify'](_0x43001d));if(_0x43001d[_0xab4f('0x14')]){if(_0x43001d[_0xab4f('0x14')][_0xab4f('0x15')]===0x1f4){logger[_0xab4f('0x14')](_0xab4f('0x16'),_0x2bd57f,_0x43001d[_0xab4f('0x14')][_0xab4f('0x17')]);return _0x2ef8f5(_0x43001d['error'][_0xab4f('0x17')]);}logger[_0xab4f('0x14')](_0xab4f('0x16'),_0x2bd57f,_0x43001d[_0xab4f('0x14')][_0xab4f('0x17')]);return _0x41c2df(_0x43001d['error'][_0xab4f('0x17')]);}else{logger['info'](_0xab4f('0x16'),_0x2bd57f,'request\x20sent');_0x41c2df(_0x43001d[_0xab4f('0x18')][_0xab4f('0x17')]);}})[_0xab4f('0x19')](function(_0x432c86){logger[_0xab4f('0x14')](_0xab4f('0x16'),_0x2bd57f,_0x432c86);_0x2ef8f5(_0x432c86);});});}exports[_0xab4f('0x1a')]=function(_0x251a5f){var _0x3259a3=this;return new Promise(function(_0x437536,_0x3122c7){return db[_0xab4f('0x1b')][_0xab4f('0x1c')]({'raw':_0x251a5f['options']?_0x251a5f[_0xab4f('0x1d')][_0xab4f('0x1e')]===undefined?!![]:![]:!![],'where':_0x251a5f['options']?_0x251a5f[_0xab4f('0x1d')][_0xab4f('0x1f')]||null:null,'attributes':_0x251a5f[_0xab4f('0x1d')]?_0x251a5f[_0xab4f('0x1d')][_0xab4f('0x20')]||null:null,'limit':_0x251a5f[_0xab4f('0x1d')]?_0x251a5f['options'][_0xab4f('0x21')]||null:null,'include':_0x251a5f[_0xab4f('0x1d')]?_0x251a5f['options'][_0xab4f('0x22')]?_[_0xab4f('0x23')](_0x251a5f[_0xab4f('0x1d')][_0xab4f('0x22')],function(_0x2d2790){return{'model':db[_0x2d2790[_0xab4f('0x24')]],'as':_0x2d2790['as'],'attributes':_0x2d2790[_0xab4f('0x20')],'include':_0x2d2790[_0xab4f('0x22')]?_[_0xab4f('0x23')](_0x2d2790['include'],function(_0x4a00dc){return{'model':db[_0x4a00dc['model']],'as':_0x4a00dc['as'],'attributes':_0x4a00dc[_0xab4f('0x20')],'include':_0x4a00dc[_0xab4f('0x22')]?_[_0xab4f('0x23')](_0x4a00dc['include'],function(_0x335ba4){return{'model':db[_0x335ba4['model']],'as':_0x335ba4['as'],'attributes':_0x335ba4['attributes']};}):[]};}):[]};}):[]:[]})[_0xab4f('0x25')](function(_0x39ce27){logger[_0xab4f('0x10')](_0xab4f('0x1a'),_0x251a5f);logger[_0xab4f('0x12')](_0xab4f('0x1a'),_0x251a5f,JSON['stringify'](_0x39ce27));_0x437536(_0x39ce27);})[_0xab4f('0x19')](function(_0x5e48fa){logger['error'](_0xab4f('0x1a'),_0x5e48fa[_0xab4f('0x17')],_0x251a5f);_0x3122c7(_0x3259a3[_0xab4f('0x14')](0x1f4,_0x5e48fa[_0xab4f('0x17')]));});});};exports[_0xab4f('0x26')]=function(_0x5c5fd0,_0x4b0f4d,_0xdf8c00){var _0x26938f=this;return new Promise(function(_0x3d85f5,_0x13e1fb){var _0x7e3d23={'body':_0x5c5fd0['body'],'channel':_0xab4f('0x27')};var _0x57ed32=[];var _0x103954=[];var _0x576d24={};return db[_0xab4f('0x28')][_0xab4f('0x29')]()['then'](function(_0x576fc8){if(!_0x576fc8){throw new db[(_0xab4f('0x2a'))]['ValidationError'](_0xab4f('0x2b'));}_0x57ed32=_['difference'](_[_0xab4f('0x2c')](_0x576fc8),[_0xab4f('0x2d'),'updatedAt']);_0x103954=_[_0xab4f('0x2e')](_['keys'](_0x576fc8),[_0xab4f('0x2d'),_0xab4f('0x2f'),'CompanyId',_0xab4f('0x30')]);if(_0x5c5fd0['body']['id']){delete _0x5c5fd0[_0xab4f('0x31')]['id'];}if(_['isNil'](_0x5c5fd0[_0xab4f('0x31')][_0xab4f('0x32')])){throw new db[(_0xab4f('0x2a'))][(_0xab4f('0x33'))](_0xab4f('0x34'));}if(_['isNil'](_0x5c5fd0[_0xab4f('0x31')][_0xab4f('0x31')])||_0x5c5fd0[_0xab4f('0x31')][_0xab4f('0x31')]===''){throw new db[(_0xab4f('0x2a'))][(_0xab4f('0x33'))](_0xab4f('0x35'));}if(_[_0xab4f('0x36')](_0x5c5fd0[_0xab4f('0x31')][_0xab4f('0x37')])){throw new db['Sequelize'][(_0xab4f('0x33'))](_0xab4f('0x38')+_0x103954);}if(!_[_0xab4f('0x39')](_0x103954,_0x5c5fd0['body'][_0xab4f('0x37')])){throw new db['Sequelize'][(_0xab4f('0x33'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x103954);}_0x576d24[_0x5c5fd0['body'][_0xab4f('0x37')]]=_0x5c5fd0[_0xab4f('0x31')][_0xab4f('0x32')];})[_0xab4f('0x25')](function(){return db[_0xab4f('0x1b')][_0xab4f('0x3a')]({'where':{'id':_0x5c5fd0[_0xab4f('0x3b')]['id']},'include':[{'model':db[_0xab4f('0x3c')],'as':_0xab4f('0x3d'),'include':[{'model':db[_0xab4f('0x28')],'as':_0xab4f('0x3e'),'where':_0x576d24,'limit':0x1,'order':[[_0xab4f('0x2f'),_0xab4f('0x3f')]]}]},{'model':db[_0xab4f('0x40')],'as':_0xab4f('0x41')}]});})[_0xab4f('0x25')](function(_0x2b4aad){if(_0x2b4aad&&_0x2b4aad[_0xab4f('0x3d')]){var _0x45731e=_0x2b4aad[_0xab4f('0x42')]({'plain':!![]});_0x7e3d23[_0xab4f('0x3b')]=_0x45731e;_0x7e3d23[_0xab4f('0x43')]=_0x45731e[_0xab4f('0x41')];_0x7e3d23['list']=_0x45731e[_0xab4f('0x3d')];_0x7e3d23[_0xab4f('0x43')]=_[_0xab4f('0x44')](_0x7e3d23[_0xab4f('0x43')],['priority'],[_0xab4f('0x45')]);if(_0x7e3d23[_0xab4f('0x3b')][_0xab4f('0x41')]){delete _0x7e3d23[_0xab4f('0x3b')][_0xab4f('0x41')];}if(_0x7e3d23[_0xab4f('0x3b')][_0xab4f('0x3d')]&&_0x7e3d23['account'][_0xab4f('0x3d')][_0xab4f('0x3e')][_0xab4f('0x46')]){return _0x7e3d23['account']['List'][_0xab4f('0x3e')][0x0];}var _0x128b92=_[_0xab4f('0xb')](_0x5c5fd0['body'],{'firstName':_0x5c5fd0[_0xab4f('0x31')][_0xab4f('0x32')],'ListId':_0x45731e[_0xab4f('0x30')]});_0x128b92[_0x5c5fd0[_0xab4f('0x31')]['mapKey']]=_0x5c5fd0[_0xab4f('0x31')][_0xab4f('0x32')];return db[_0xab4f('0x28')][_0xab4f('0x47')](_0x128b92,{'fields':_0x57ed32,'raw':!![]});}})[_0xab4f('0x25')](function(_0x343c7b){_0x7e3d23[_0xab4f('0x48')]=_0x343c7b;if(_0x343c7b){var _0x2f6d69={'ContactId':_0x343c7b['id'],'FaxAccountId':_0x5c5fd0[_0xab4f('0x3b')]['id'],'fax':_0x343c7b[_0xab4f('0x27')]};return db['FaxInteraction'][_0xab4f('0x3a')]({'where':{'ContactId':_0x343c7b['id'],'closed':![],'FaxAccountId':_0x5c5fd0['account']['id']}})[_0xab4f('0x25')](function(_0x41eb97){if(_0x41eb97){return[_0x41eb97,![]];}return db[_0xab4f('0x49')]['create'](_0x2f6d69)[_0xab4f('0x25')](function(_0x1851fd){return[_0x1851fd,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})[_0xab4f('0x4a')](function(_0xa2ae7c,_0x4bd6e3){var _0x10add1=_0xa2ae7c[_0xab4f('0x42')]({'plain':!![]});if(_0x4bd6e3){if(_0x7e3d23[_0xab4f('0x3b')][_0xab4f('0x4b')]){_0x7e3d23['applications'][_0xab4f('0x4c')]({'id':0x0,'priority':_0x7e3d23[_0xab4f('0x43')][_0xab4f('0x46')]+0x1,'app':_0xab4f('0x4d'),'appdata':_0xab4f('0x4e'),'interval':_0xab4f('0x4f')});}_0x10add1['created']=!![];}else{_0x10add1[_0xab4f('0x50')]=![];}_0x7e3d23[_0xab4f('0x51')]=_0x10add1;return db[_0xab4f('0x52')][_0xab4f('0x47')]({'body':_0x5c5fd0[_0xab4f('0x31')][_0xab4f('0x31')],'FaxAccountId':_0x5c5fd0[_0xab4f('0x3b')]['id'],'FaxInteractionId':_0xa2ae7c['id'],'direction':'in','ContactId':_0xa2ae7c[_0xab4f('0x53')],'AttachmentId':_0x5c5fd0[_0xab4f('0x31')][_0xab4f('0x54')]});})[_0xab4f('0x25')](function(_0x2f7cdf){_0x7e3d23['message']=_0x2f7cdf;if(!_0x7e3d23[_0xab4f('0x51')][_0xab4f('0x55')])return;return db['User'][_0xab4f('0x3a')]({'attributes':['id',_0xab4f('0x56')],'where':{'id':_0x7e3d23[_0xab4f('0x51')]['UserId']}});})[_0xab4f('0x25')](function(_0x284c37){if(_0x284c37){_0x7e3d23[_0xab4f('0x43')]['unshift']({'id':0x0,'priority':0x0,'app':_0xab4f('0x57'),'appdata':_0x284c37[_0xab4f('0x56')]+','+(_0x7e3d23[_0xab4f('0x3b')]['waitForTheAssignedAgent']||0xa),'interval':_0xab4f('0x4f')});}if(!_0x7e3d23[_0xab4f('0x51')][_0xab4f('0x58')])return;return db[_0xab4f('0x59')][_0xab4f('0x3a')]({'attributes':['id',_0xab4f('0x56')],'where':{'id':_0x7e3d23['interaction'][_0xab4f('0x58')]}});})[_0xab4f('0x25')](function(_0x5ddbc4){if(_0x5ddbc4){_0x7e3d23[_0xab4f('0x43')][_0xab4f('0x5a')]({'id':0x0,'priority':0x1,'app':'queue','appdata':_0x5ddbc4[_0xab4f('0x56')]+','+(_0x7e3d23['account'][_0xab4f('0x5b')]||0x12c),'interval':_0xab4f('0x4f')});}return respondWithRpcPromise(_0xab4f('0x5c'),_0xab4f('0x5d'),_0x7e3d23);})[_0xab4f('0x25')](function(_0x5528f0){_0x3d85f5(_0x5528f0);})[_0xab4f('0x19')](function(_0x540a84){_0x13e1fb(_0x26938f[_0xab4f('0x14')](0x1f4,_0x540a84[_0xab4f('0x17')]));});});}; \ No newline at end of file +var _0x0d37=['created','ContactId','AttachmentId','interaction','User','unshift','name','waitForTheAssignedAgent','queueId','FaxQueue','waitForTheAssignedQueue','Start','startRouting','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./faxAccount.socket','register','request','then','info','FaxAccount,\x20%s,\x20%s','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','catch','GetFaxAccount','FaxAccount','findAll','options','raw','where','attributes','include','map','model','debug','NotifyFaxAccount','body','fax','describe','Sequelize','ValidationError','no\x20available\x20attributes','difference','keys','createdAt','updatedAt','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','find','account','CmList','List','Contacts','DESC','FaxApplication','Applications','get','applications','list','orderBy','asc','length','CmContact','create','contact','FaxInteraction','Contact\x20not\x20found','*,*,*,*'];(function(_0x2070da,_0x45e586){var _0x4f9fe1=function(_0x5b6f2a){while(--_0x5b6f2a){_0x2070da['push'](_0x2070da['shift']());}};_0x4f9fe1(++_0x45e586);}(_0x0d37,0xc9));var _0x70d3=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x0d37[_0x2641f9];return _0x585741;};'use strict';var _=require(_0x70d3('0x0'));var util=require('util');var moment=require(_0x70d3('0x1'));var BPromise=require(_0x70d3('0x2'));var rs=require(_0x70d3('0x3'));var fs=require('fs');var Redis=require(_0x70d3('0x4'));var db=require(_0x70d3('0x5'))['db'];var utils=require(_0x70d3('0x6'));var logger=require('../../config/logger')(_0x70d3('0x7'));var config=require(_0x70d3('0x8'));var jayson=require(_0x70d3('0x9'));var client=jayson[_0x70d3('0xa')][_0x70d3('0xb')]({'port':0x232c});config[_0x70d3('0xc')]=_[_0x70d3('0xd')](config[_0x70d3('0xc')],{'host':_0x70d3('0xe'),'port':0x18eb});var socket=require(_0x70d3('0xf'))(new Redis(config[_0x70d3('0xc')]));require(_0x70d3('0x10'))[_0x70d3('0x11')](socket);function respondWithRpcPromise(_0x2c6710,_0x36b3b6,_0xdd5b43){return new BPromise(function(_0x18dc5b,_0xc1f73c){return client[_0x70d3('0x12')](_0x2c6710,_0xdd5b43)[_0x70d3('0x13')](function(_0x5eb9d0){logger[_0x70d3('0x14')](_0x70d3('0x15'),_0x36b3b6,'request\x20sent');logger['debug'](_0x70d3('0x16'),_0x36b3b6,'request\x20sent',JSON[_0x70d3('0x17')](_0x5eb9d0));if(_0x5eb9d0['error']){if(_0x5eb9d0[_0x70d3('0x18')][_0x70d3('0x19')]===0x1f4){logger['error'](_0x70d3('0x15'),_0x36b3b6,_0x5eb9d0[_0x70d3('0x18')]['message']);return _0xc1f73c(_0x5eb9d0['error'][_0x70d3('0x1a')]);}logger[_0x70d3('0x18')](_0x70d3('0x15'),_0x36b3b6,_0x5eb9d0[_0x70d3('0x18')][_0x70d3('0x1a')]);return _0x18dc5b(_0x5eb9d0[_0x70d3('0x18')][_0x70d3('0x1a')]);}else{logger[_0x70d3('0x14')](_0x70d3('0x15'),_0x36b3b6,_0x70d3('0x1b'));_0x18dc5b(_0x5eb9d0['result'][_0x70d3('0x1a')]);}})[_0x70d3('0x1c')](function(_0x60b817){logger[_0x70d3('0x18')]('FaxAccount,\x20%s,\x20%s',_0x36b3b6,_0x60b817);_0xc1f73c(_0x60b817);});});}exports[_0x70d3('0x1d')]=function(_0x3fc04d){var _0x5062fc=this;return new Promise(function(_0x156024,_0x2af603){return db[_0x70d3('0x1e')][_0x70d3('0x1f')]({'raw':_0x3fc04d[_0x70d3('0x20')]?_0x3fc04d[_0x70d3('0x20')][_0x70d3('0x21')]===undefined?!![]:![]:!![],'where':_0x3fc04d[_0x70d3('0x20')]?_0x3fc04d['options'][_0x70d3('0x22')]||null:null,'attributes':_0x3fc04d[_0x70d3('0x20')]?_0x3fc04d[_0x70d3('0x20')][_0x70d3('0x23')]||null:null,'limit':_0x3fc04d[_0x70d3('0x20')]?_0x3fc04d[_0x70d3('0x20')]['limit']||null:null,'include':_0x3fc04d[_0x70d3('0x20')]?_0x3fc04d[_0x70d3('0x20')][_0x70d3('0x24')]?_[_0x70d3('0x25')](_0x3fc04d[_0x70d3('0x20')][_0x70d3('0x24')],function(_0x30e2c3){return{'model':db[_0x30e2c3[_0x70d3('0x26')]],'as':_0x30e2c3['as'],'attributes':_0x30e2c3['attributes'],'include':_0x30e2c3[_0x70d3('0x24')]?_[_0x70d3('0x25')](_0x30e2c3[_0x70d3('0x24')],function(_0x39c26d){return{'model':db[_0x39c26d[_0x70d3('0x26')]],'as':_0x39c26d['as'],'attributes':_0x39c26d[_0x70d3('0x23')],'include':_0x39c26d[_0x70d3('0x24')]?_['map'](_0x39c26d['include'],function(_0xdb4644){return{'model':db[_0xdb4644[_0x70d3('0x26')]],'as':_0xdb4644['as'],'attributes':_0xdb4644[_0x70d3('0x23')]};}):[]};}):[]};}):[]:[]})[_0x70d3('0x13')](function(_0x4de122){logger[_0x70d3('0x14')](_0x70d3('0x1d'),_0x3fc04d);logger[_0x70d3('0x27')](_0x70d3('0x1d'),_0x3fc04d,JSON[_0x70d3('0x17')](_0x4de122));_0x156024(_0x4de122);})['catch'](function(_0x25d56c){logger['error'](_0x70d3('0x1d'),_0x25d56c[_0x70d3('0x1a')],_0x3fc04d);_0x2af603(_0x5062fc[_0x70d3('0x18')](0x1f4,_0x25d56c[_0x70d3('0x1a')]));});});};exports[_0x70d3('0x28')]=function(_0x122687,_0x4c5341,_0x5f1de2){var _0x375b5f=this;return new Promise(function(_0x3c02e7,_0x3e2836){var _0x57cb35={'body':_0x122687[_0x70d3('0x29')],'channel':_0x70d3('0x2a')};var _0x173f5b=[];var _0x55adec=[];var _0x1504d8={};return db['CmContact'][_0x70d3('0x2b')]()['then'](function(_0x5a4628){if(!_0x5a4628){throw new db[(_0x70d3('0x2c'))][(_0x70d3('0x2d'))](_0x70d3('0x2e'));}_0x173f5b=_[_0x70d3('0x2f')](_[_0x70d3('0x30')](_0x5a4628),[_0x70d3('0x31'),_0x70d3('0x32')]);_0x55adec=_[_0x70d3('0x2f')](_[_0x70d3('0x30')](_0x5a4628),[_0x70d3('0x31'),_0x70d3('0x32'),_0x70d3('0x33'),_0x70d3('0x34')]);if(_0x122687['body']['id']){delete _0x122687[_0x70d3('0x29')]['id'];}if(_[_0x70d3('0x35')](_0x122687[_0x70d3('0x29')][_0x70d3('0x36')])){throw new db['Sequelize'][(_0x70d3('0x2d'))](_0x70d3('0x37'));}if(_[_0x70d3('0x35')](_0x122687['body']['body'])||_0x122687[_0x70d3('0x29')][_0x70d3('0x29')]===''){throw new db[(_0x70d3('0x2c'))][(_0x70d3('0x2d'))](_0x70d3('0x38'));}if(_['isNil'](_0x122687['body'][_0x70d3('0x39')])){throw new db[(_0x70d3('0x2c'))]['ValidationError'](_0x70d3('0x3a')+_0x55adec);}if(!_[_0x70d3('0x3b')](_0x55adec,_0x122687['body'][_0x70d3('0x39')])){throw new db[(_0x70d3('0x2c'))][(_0x70d3('0x2d'))](_0x70d3('0x3c')+_0x55adec);}_0x1504d8[_0x122687[_0x70d3('0x29')][_0x70d3('0x39')]]=_0x122687[_0x70d3('0x29')][_0x70d3('0x36')];})[_0x70d3('0x13')](function(){return db[_0x70d3('0x1e')][_0x70d3('0x3d')]({'where':{'id':_0x122687[_0x70d3('0x3e')]['id']},'include':[{'model':db[_0x70d3('0x3f')],'as':_0x70d3('0x40'),'include':[{'model':db['CmContact'],'as':_0x70d3('0x41'),'where':_0x1504d8,'limit':0x1,'order':[[_0x70d3('0x32'),_0x70d3('0x42')]]}]},{'model':db[_0x70d3('0x43')],'as':_0x70d3('0x44')}]});})[_0x70d3('0x13')](function(_0x15b28b){if(_0x15b28b&&_0x15b28b[_0x70d3('0x40')]){var _0xbc63b1=_0x15b28b[_0x70d3('0x45')]({'plain':!![]});_0x57cb35['account']=_0xbc63b1;_0x57cb35[_0x70d3('0x46')]=_0xbc63b1['Applications'];_0x57cb35[_0x70d3('0x47')]=_0xbc63b1['List'];_0x57cb35[_0x70d3('0x46')]=_[_0x70d3('0x48')](_0x57cb35[_0x70d3('0x46')],['priority'],[_0x70d3('0x49')]);if(_0x57cb35[_0x70d3('0x3e')]['Applications']){delete _0x57cb35[_0x70d3('0x3e')][_0x70d3('0x44')];}if(_0x57cb35[_0x70d3('0x3e')][_0x70d3('0x40')]&&_0x57cb35[_0x70d3('0x3e')][_0x70d3('0x40')][_0x70d3('0x41')][_0x70d3('0x4a')]){return _0x57cb35[_0x70d3('0x3e')]['List'][_0x70d3('0x41')][0x0];}var _0x5946ff=_[_0x70d3('0xd')](_0x122687['body'],{'firstName':_0x122687['body']['from'],'ListId':_0xbc63b1[_0x70d3('0x34')]});_0x5946ff[_0x122687[_0x70d3('0x29')][_0x70d3('0x39')]]=_0x122687['body'][_0x70d3('0x36')];return db[_0x70d3('0x4b')][_0x70d3('0x4c')](_0x5946ff,{'fields':_0x173f5b,'raw':!![]});}})[_0x70d3('0x13')](function(_0x1ecd6e){_0x57cb35[_0x70d3('0x4d')]=_0x1ecd6e;if(_0x1ecd6e){var _0x521c2f={'ContactId':_0x1ecd6e['id'],'FaxAccountId':_0x122687['account']['id'],'fax':_0x1ecd6e[_0x70d3('0x2a')]};return db[_0x70d3('0x4e')]['find']({'where':{'ContactId':_0x1ecd6e['id'],'closed':![],'FaxAccountId':_0x122687['account']['id']}})[_0x70d3('0x13')](function(_0x1941d6){if(_0x1941d6){return[_0x1941d6,![]];}return db[_0x70d3('0x4e')][_0x70d3('0x4c')](_0x521c2f)['then'](function(_0x4af17f){return[_0x4af17f,!![]];});});}else{throw new Error(_0x70d3('0x4f'));}})['spread'](function(_0x2927e1,_0x59620f){var _0x5959fe=_0x2927e1[_0x70d3('0x45')]({'plain':!![]});if(_0x59620f){if(_0x57cb35[_0x70d3('0x3e')]['autoclose']){_0x57cb35[_0x70d3('0x46')]['push']({'id':0x0,'priority':_0x57cb35[_0x70d3('0x46')][_0x70d3('0x4a')]+0x1,'app':'close','appdata':'unmanaged','interval':_0x70d3('0x50')});}_0x5959fe['created']=!![];}else{_0x5959fe[_0x70d3('0x51')]=![];}_0x57cb35['interaction']=_0x5959fe;return db['FaxMessage'][_0x70d3('0x4c')]({'body':_0x122687['body'][_0x70d3('0x29')],'FaxAccountId':_0x122687['account']['id'],'FaxInteractionId':_0x2927e1['id'],'direction':'in','ContactId':_0x2927e1[_0x70d3('0x52')],'AttachmentId':_0x122687[_0x70d3('0x29')][_0x70d3('0x53')]});})[_0x70d3('0x13')](function(_0x25d886){_0x57cb35['message']=_0x25d886;if(!_0x57cb35[_0x70d3('0x54')]['UserId'])return;return db[_0x70d3('0x55')][_0x70d3('0x3d')]({'attributes':['id','name'],'where':{'id':_0x57cb35['interaction']['UserId']}});})['then'](function(_0x153809){if(_0x153809){_0x57cb35[_0x70d3('0x46')][_0x70d3('0x56')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x153809[_0x70d3('0x57')]+','+(_0x57cb35[_0x70d3('0x3e')][_0x70d3('0x58')]||0xa),'interval':_0x70d3('0x50')});}if(!_0x57cb35[_0x70d3('0x54')][_0x70d3('0x59')])return;return db[_0x70d3('0x5a')][_0x70d3('0x3d')]({'attributes':['id',_0x70d3('0x57')],'where':{'id':_0x57cb35['interaction']['queueId']}});})['then'](function(_0x421b75){if(_0x421b75){_0x57cb35[_0x70d3('0x46')][_0x70d3('0x56')]({'id':0x0,'priority':0x1,'app':'queue','appdata':_0x421b75['name']+','+(_0x57cb35['account'][_0x70d3('0x5b')]||0x12c),'interval':_0x70d3('0x50')});}return respondWithRpcPromise(_0x70d3('0x5c'),_0x70d3('0x5d'),_0x57cb35);})[_0x70d3('0x13')](function(_0x37c3d7){_0x3c02e7(_0x37c3d7);})[_0x70d3('0x1c')](function(_0x2ecf3e){_0x3e2836(_0x375b5f['error'](0x1f4,_0x2ecf3e[_0x70d3('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.socket.js b/server/api/faxAccount/faxAccount.socket.js index a8a297a..39dbc06 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 _0xa581=['register','faxAccount:','./faxAccount.events','save','update','emit','removeListener'];(function(_0x5b3008,_0x4fb270){var _0x33543b=function(_0x130dd4){while(--_0x130dd4){_0x5b3008['push'](_0x5b3008['shift']());}};_0x33543b(++_0x4fb270);}(_0xa581,0x159));var _0x1a58=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa581[_0x3dd15e];return _0x231fd0;};'use strict';var FaxAccountEvents=require(_0x1a58('0x0'));var events=[_0x1a58('0x1'),'remove',_0x1a58('0x2')];function createListener(_0x119078,_0xbd9422){return function(_0x410e55){_0xbd9422[_0x1a58('0x3')](_0x119078,_0x410e55);};}function removeListener(_0x41a01e,_0x888eb5){return function(){FaxAccountEvents[_0x1a58('0x4')](_0x41a01e,_0x888eb5);};}exports[_0x1a58('0x5')]=function(_0x34d9ea){for(var _0x414da2=0x0,_0x55f420=events['length'];_0x414da2<_0x55f420;_0x414da2++){var _0x229b43=events[_0x414da2];var _0x2c2f27=createListener(_0x1a58('0x6')+_0x229b43,_0x34d9ea);FaxAccountEvents['on'](_0x229b43,_0x2c2f27);}}; \ No newline at end of file +var _0x1649=['length','faxAccount:','./faxAccount.events','remove','update','register'];(function(_0x2e135a,_0x341b79){var _0x3d308f=function(_0x4e8f8c){while(--_0x4e8f8c){_0x2e135a['push'](_0x2e135a['shift']());}};_0x3d308f(++_0x341b79);}(_0x1649,0x7a));var _0x9164=function(_0x4f85a2,_0xd9bfb1){_0x4f85a2=_0x4f85a2-0x0;var _0x62e21b=_0x1649[_0x4f85a2];return _0x62e21b;};'use strict';var FaxAccountEvents=require(_0x9164('0x0'));var events=['save',_0x9164('0x1'),_0x9164('0x2')];function createListener(_0x248638,_0x8724c2){return function(_0x5ccce9){_0x8724c2['emit'](_0x248638,_0x5ccce9);};}function removeListener(_0x367774,_0xbac62e){return function(){FaxAccountEvents['removeListener'](_0x367774,_0xbac62e);};}exports[_0x9164('0x3')]=function(_0x24b570){for(var _0x18c0c3=0x0,_0xdba2a9=events[_0x9164('0x4')];_0x18c0c3<_0xdba2a9;_0x18c0c3++){var _0x25b7cb=events[_0x18c0c3];var _0x4290b3=createListener(_0x9164('0x5')+_0x25b7cb,_0x24b570);FaxAccountEvents['on'](_0x25b7cb,_0x4290b3);}}; \ No newline at end of file diff --git a/server/api/faxAccount/index.js b/server/api/faxAccount/index.js index 1fb46fa..5d47711 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 _0xd000=['show','/:id/dispositions','/:id/canned_answers','/:id/interactions','getInteractions','/:id/applications','getApplications','/:id/messages','getMessages','/:id/users','getAgents','post','create','addDisposition','addAnswer','addInteraction','addApplications','/addaccountapplications','/updateaccountapplications','/:id/send','send','put','update','delete','destroy','removeAnswers','exports','multer','util','connect-timeout','Router','../../components/auth/service','../../config/environment','get','index','isAuthenticated','describe','/:id'];(function(_0x41075d,_0x112862){var _0x11f102=function(_0x49f373){while(--_0x49f373){_0x41075d['push'](_0x41075d['shift']());}};_0x11f102(++_0x112862);}(_0xd000,0x1bd));var _0x0d00=function(_0x221b2e,_0x51a42b){_0x221b2e=_0x221b2e-0x0;var _0x1b3029=_0xd000[_0x221b2e];return _0x1b3029;};'use strict';var multer=require(_0x0d00('0x0'));var util=require(_0x0d00('0x1'));var path=require('path');var timeout=require(_0x0d00('0x2'));var express=require('express');var router=express[_0x0d00('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0d00('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x0d00('0x5'));var controller=require('./faxAccount.controller');router[_0x0d00('0x6')]('/',auth['isAuthenticated'](),controller[_0x0d00('0x7')]);router[_0x0d00('0x6')]('/describe',auth[_0x0d00('0x8')](),controller[_0x0d00('0x9')]);router[_0x0d00('0x6')](_0x0d00('0xa'),auth[_0x0d00('0x8')](),controller[_0x0d00('0xb')]);router[_0x0d00('0x6')](_0x0d00('0xc'),auth[_0x0d00('0x8')](),controller['getDispositions']);router['get'](_0x0d00('0xd'),auth[_0x0d00('0x8')](),controller['getAnswers']);router['get'](_0x0d00('0xe'),auth[_0x0d00('0x8')](),controller[_0x0d00('0xf')]);router['get'](_0x0d00('0x10'),auth[_0x0d00('0x8')](),controller[_0x0d00('0x11')]);router['get'](_0x0d00('0x12'),auth[_0x0d00('0x8')](),controller[_0x0d00('0x13')]);router[_0x0d00('0x6')](_0x0d00('0x14'),auth['isAuthenticated'](),controller[_0x0d00('0x15')]);router[_0x0d00('0x16')]('/',auth[_0x0d00('0x8')](),controller[_0x0d00('0x17')]);router[_0x0d00('0x16')](_0x0d00('0xc'),auth[_0x0d00('0x8')](),controller[_0x0d00('0x18')]);router[_0x0d00('0x16')](_0x0d00('0xd'),auth['isAuthenticated'](),controller[_0x0d00('0x19')]);router['post'](_0x0d00('0xe'),auth[_0x0d00('0x8')](),controller[_0x0d00('0x1a')]);router[_0x0d00('0x16')](_0x0d00('0x10'),auth[_0x0d00('0x8')](),controller[_0x0d00('0x1b')]);router['post'](_0x0d00('0x1c'),auth[_0x0d00('0x8')](),controller['addAccountApplications']);router['post'](_0x0d00('0x1d'),auth['isAuthenticated'](),controller['updateAccountApplications']);router[_0x0d00('0x16')](_0x0d00('0x1e'),auth[_0x0d00('0x8')](),controller[_0x0d00('0x1f')]);router[_0x0d00('0x16')]('/:id/users',auth['isAuthenticated'](),controller['addAgents']);router[_0x0d00('0x20')]('/:id',auth[_0x0d00('0x8')](),controller[_0x0d00('0x21')]);router[_0x0d00('0x22')]('/:id',auth[_0x0d00('0x8')](),controller[_0x0d00('0x23')]);router[_0x0d00('0x22')](_0x0d00('0xc'),auth[_0x0d00('0x8')](),controller['removeDispositions']);router[_0x0d00('0x22')](_0x0d00('0xd'),auth[_0x0d00('0x8')](),controller[_0x0d00('0x24')]);router[_0x0d00('0x22')](_0x0d00('0x14'),auth[_0x0d00('0x8')](),controller['removeAgents']);module[_0x0d00('0x25')]=router; \ No newline at end of file +var _0x4146=['/:id/applications','getApplications','/:id/messages','getMessages','/:id/users','post','create','addDisposition','/:id/canned_answers','addAnswer','addInteraction','addApplications','/addaccountapplications','addAccountApplications','/updateaccountapplications','updateAccountApplications','/:id/send','send','addAgents','/:id','update','delete','destroy','removeDispositions','removeAgents','path','connect-timeout','express','fs-extra','../../components/auth/service','get','isAuthenticated','index','/describe','describe','show','/:id/dispositions','getAnswers','/:id/interactions'];(function(_0x2a081b,_0x32183f){var _0x32e550=function(_0x2e33a6){while(--_0x2e33a6){_0x2a081b['push'](_0x2a081b['shift']());}};_0x32e550(++_0x32183f);}(_0x4146,0xb5));var _0x6414=function(_0x14707d,_0x5e3eca){_0x14707d=_0x14707d-0x0;var _0x3e1b4b=_0x4146[_0x14707d];return _0x3e1b4b;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x6414('0x0'));var timeout=require(_0x6414('0x1'));var express=require(_0x6414('0x2'));var router=express['Router']();var fs_extra=require(_0x6414('0x3'));var auth=require(_0x6414('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./faxAccount.controller');router[_0x6414('0x5')]('/',auth[_0x6414('0x6')](),controller[_0x6414('0x7')]);router[_0x6414('0x5')](_0x6414('0x8'),auth['isAuthenticated'](),controller[_0x6414('0x9')]);router['get']('/:id',auth[_0x6414('0x6')](),controller[_0x6414('0xa')]);router[_0x6414('0x5')](_0x6414('0xb'),auth[_0x6414('0x6')](),controller['getDispositions']);router[_0x6414('0x5')]('/:id/canned_answers',auth[_0x6414('0x6')](),controller[_0x6414('0xc')]);router[_0x6414('0x5')](_0x6414('0xd'),auth['isAuthenticated'](),controller['getInteractions']);router[_0x6414('0x5')](_0x6414('0xe'),auth[_0x6414('0x6')](),controller[_0x6414('0xf')]);router[_0x6414('0x5')](_0x6414('0x10'),auth[_0x6414('0x6')](),controller[_0x6414('0x11')]);router['get'](_0x6414('0x12'),auth[_0x6414('0x6')](),controller['getAgents']);router[_0x6414('0x13')]('/',auth[_0x6414('0x6')](),controller[_0x6414('0x14')]);router[_0x6414('0x13')](_0x6414('0xb'),auth[_0x6414('0x6')](),controller[_0x6414('0x15')]);router[_0x6414('0x13')](_0x6414('0x16'),auth[_0x6414('0x6')](),controller[_0x6414('0x17')]);router['post'](_0x6414('0xd'),auth[_0x6414('0x6')](),controller[_0x6414('0x18')]);router['post'](_0x6414('0xe'),auth[_0x6414('0x6')](),controller[_0x6414('0x19')]);router[_0x6414('0x13')](_0x6414('0x1a'),auth['isAuthenticated'](),controller[_0x6414('0x1b')]);router[_0x6414('0x13')](_0x6414('0x1c'),auth['isAuthenticated'](),controller[_0x6414('0x1d')]);router[_0x6414('0x13')](_0x6414('0x1e'),auth[_0x6414('0x6')](),controller[_0x6414('0x1f')]);router[_0x6414('0x13')](_0x6414('0x12'),auth['isAuthenticated'](),controller[_0x6414('0x20')]);router['put'](_0x6414('0x21'),auth[_0x6414('0x6')](),controller[_0x6414('0x22')]);router[_0x6414('0x23')](_0x6414('0x21'),auth[_0x6414('0x6')](),controller[_0x6414('0x24')]);router[_0x6414('0x23')](_0x6414('0xb'),auth[_0x6414('0x6')](),controller[_0x6414('0x25')]);router[_0x6414('0x23')](_0x6414('0x16'),auth[_0x6414('0x6')](),controller['removeAnswers']);router[_0x6414('0x23')]('/:id/users',auth[_0x6414('0x6')](),controller[_0x6414('0x26')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.attributes.js b/server/api/faxApplication/faxApplication.attributes.js index 797e449..c729fd2 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 _0x7d08=['INTEGER','STRING','noop','*,*,*,*','sequelize'];(function(_0x2ee736,_0x30b781){var _0x253723=function(_0xd26f5f){while(--_0xd26f5f){_0x2ee736['push'](_0x2ee736['shift']());}};_0x253723(++_0x30b781);}(_0x7d08,0x6d));var _0x87d0=function(_0x4286db,_0x244dd2){_0x4286db=_0x4286db-0x0;var _0x2c600e=_0x7d08[_0x4286db];return _0x2c600e;};'use strict';var Sequelize=require(_0x87d0('0x0'));module['exports']={'priority':{'type':Sequelize[_0x87d0('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x87d0('0x2')],'allowNull':![],'defaultValue':_0x87d0('0x3')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x87d0('0x2')],'defaultValue':_0x87d0('0x4')}}; \ No newline at end of file +var _0x91ab=['INTEGER','STRING','noop','TEXT','*,*,*,*','sequelize','exports'];(function(_0x407de8,_0x339323){var _0x479375=function(_0xff0cb5){while(--_0xff0cb5){_0x407de8['push'](_0x407de8['shift']());}};_0x479375(++_0x339323);}(_0x91ab,0x83));var _0xb91a=function(_0x2555d0,_0x4150a6){_0x2555d0=_0x2555d0-0x0;var _0x3bb486=_0x91ab[_0x2555d0];return _0x3bb486;};'use strict';var Sequelize=require(_0xb91a('0x0'));module[_0xb91a('0x1')]={'priority':{'type':Sequelize[_0xb91a('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0xb91a('0x3')],'allowNull':![],'defaultValue':_0xb91a('0x4')},'appdata':{'type':Sequelize[_0xb91a('0x5')]()},'description':{'type':Sequelize[_0xb91a('0x3')]},'interval':{'type':Sequelize[_0xb91a('0x3')],'defaultValue':_0xb91a('0x6')}}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.controller.js b/server/api/faxApplication/faxApplication.controller.js index bb618ca..dc0e5c7 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 _0x2cb8=['sox','to-csv','fs-extra','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/license/util','status','json','offset','count','limit','set','reject','update','then','stack','name','send','index','FaxApplication','rawAttributes','fieldName','type','key','map','query','keys','filters','intersection','attributes','fields','length','model','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','rows','catch','show','params','find','create','body','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path'];(function(_0x2c33e7,_0x1f8c13){var _0xcdffed=function(_0xa71a2b){while(--_0xa71a2b){_0x2c33e7['push'](_0x2c33e7['shift']());}};_0xcdffed(++_0x1f8c13);}(_0x2cb8,0x18a));var _0x82cb=function(_0x410adc,_0x1a4cc2){_0x410adc=_0x410adc-0x0;var _0x3917f2=_0x2cb8[_0x410adc];return _0x3917f2;};'use strict';var emlformat=require(_0x82cb('0x0'));var rimraf=require(_0x82cb('0x1'));var zipdir=require(_0x82cb('0x2'));var jsonpatch=require(_0x82cb('0x3'));var rp=require(_0x82cb('0x4'));var moment=require('moment');var BPromise=require(_0x82cb('0x5'));var Mustache=require('mustache');var util=require(_0x82cb('0x6'));var path=require(_0x82cb('0x7'));var sox=require(_0x82cb('0x8'));var csv=require(_0x82cb('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x82cb('0xa'));var _=require('lodash');var squel=require(_0x82cb('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x82cb('0xc'));var toCsv=require(_0x82cb('0x9'));var querystring=require('querystring');var Papa=require(_0x82cb('0xd'));var Redis=require(_0x82cb('0xe'));var authService=require(_0x82cb('0xf'));var qs=require(_0x82cb('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x82cb('0x11'));var logger=require('../../config/logger')(_0x82cb('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x82cb('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x267545,_0x71e296){_0x71e296=_0x71e296||0xcc;return function(_0x4e4856){if(_0x4e4856){return _0x267545['sendStatus'](_0x71e296);}return _0x267545[_0x82cb('0x14')](_0x71e296)['end']();};}function respondWithResult(_0x12e600,_0x233a10){_0x233a10=_0x233a10||0xc8;return function(_0x4649a6){if(_0x4649a6){return _0x12e600[_0x82cb('0x14')](_0x233a10)[_0x82cb('0x15')](_0x4649a6);}};}function respondWithFilteredResult(_0x44c021,_0x495c43){return function(_0x58c721){if(_0x58c721){var _0x4c61ba=typeof _0x495c43[_0x82cb('0x16')]==='undefined'&&typeof _0x495c43['limit']==='undefined';var _0x5b0912=_0x58c721[_0x82cb('0x17')];var _0x4d250b=_0x4c61ba?0x0:_0x495c43[_0x82cb('0x16')];var _0x288fbd=_0x4c61ba?_0x58c721[_0x82cb('0x17')]:_0x495c43['offset']+_0x495c43[_0x82cb('0x18')];var _0x425b2e;if(_0x288fbd>=_0x5b0912){_0x288fbd=_0x5b0912;_0x425b2e=0xc8;}else{_0x425b2e=0xce;}_0x44c021['status'](_0x425b2e);return _0x44c021[_0x82cb('0x19')]('Content-Range',_0x4d250b+'-'+_0x288fbd+'/'+_0x5b0912)[_0x82cb('0x15')](_0x58c721);}return null;};}function patchUpdates(_0x177c9e){return function(_0x154cb3){try{jsonpatch['apply'](_0x154cb3,_0x177c9e,!![]);}catch(_0x3b1ab5){return BPromise[_0x82cb('0x1a')](_0x3b1ab5);}return _0x154cb3['save']();};}function saveUpdates(_0x424554,_0x41ef38){return function(_0x18347c){if(_0x18347c){return _0x18347c[_0x82cb('0x1b')](_0x424554)[_0x82cb('0x1c')](function(_0x327465){return _0x327465;});}return null;};}function removeEntity(_0x231305,_0x16cb45){return function(_0x1a5aa5){if(_0x1a5aa5){return _0x1a5aa5['destroy']()[_0x82cb('0x1c')](function(){_0x231305[_0x82cb('0x14')](0xcc)['end']();});}};}function handleEntityNotFound(_0x45168a,_0xda1f77){return function(_0x1b4c3c){if(!_0x1b4c3c){_0x45168a['sendStatus'](0x194);}return _0x1b4c3c;};}function handleError(_0x1af53f,_0x2d5cd0){_0x2d5cd0=_0x2d5cd0||0x1f4;return function(_0x3ecc2b){logger['error'](_0x3ecc2b[_0x82cb('0x1d')]);if(_0x3ecc2b[_0x82cb('0x1e')]){delete _0x3ecc2b[_0x82cb('0x1e')];}_0x1af53f[_0x82cb('0x14')](_0x2d5cd0)[_0x82cb('0x1f')](_0x3ecc2b);};}exports[_0x82cb('0x20')]=function(_0x197497,_0x4b5207){var _0x273291={},_0xfc4553={},_0x45d782={'count':0x0,'rows':[]};var _0x3b3606=_['map'](db[_0x82cb('0x21')][_0x82cb('0x22')],function(_0x96553d){return{'name':_0x96553d[_0x82cb('0x23')],'type':_0x96553d[_0x82cb('0x24')][_0x82cb('0x25')]};});_0xfc4553['model']=_[_0x82cb('0x26')](_0x3b3606,_0x82cb('0x1e'));_0xfc4553[_0x82cb('0x27')]=_[_0x82cb('0x28')](_0x197497['query']);_0xfc4553[_0x82cb('0x29')]=_[_0x82cb('0x2a')](_0xfc4553['model'],_0xfc4553['query']);_0x273291[_0x82cb('0x2b')]=_[_0x82cb('0x2a')](_0xfc4553['model'],qs[_0x82cb('0x2c')](_0x197497[_0x82cb('0x27')][_0x82cb('0x2c')]));_0x273291[_0x82cb('0x2b')]=_0x273291['attributes'][_0x82cb('0x2d')]?_0x273291['attributes']:_0xfc4553[_0x82cb('0x2e')];if(!_0x197497['query'][_0x82cb('0x2f')](_0x82cb('0x30'))){_0x273291['limit']=qs['limit'](_0x197497[_0x82cb('0x27')]['limit']);_0x273291['offset']=qs[_0x82cb('0x16')](_0x197497[_0x82cb('0x27')][_0x82cb('0x16')]);}_0x273291[_0x82cb('0x31')]=qs[_0x82cb('0x32')](_0x197497[_0x82cb('0x27')][_0x82cb('0x32')]);_0x273291[_0x82cb('0x33')]=qs[_0x82cb('0x29')](_[_0x82cb('0x34')](_0x197497[_0x82cb('0x27')],_0xfc4553[_0x82cb('0x29')]),_0x3b3606);if(_0x197497[_0x82cb('0x27')]['filter']){_0x273291[_0x82cb('0x33')]=_[_0x82cb('0x35')](_0x273291['where'],{'$or':_[_0x82cb('0x26')](_0x3b3606,function(_0x2eb021){if(_0x2eb021[_0x82cb('0x24')]!==_0x82cb('0x36')){var _0x53e386={};_0x53e386[_0x2eb021['name']]={'$like':'%'+_0x197497['query'][_0x82cb('0x37')]+'%'};return _0x53e386;}})});}_0x273291=_['merge']({},_0x273291,_0x197497[_0x82cb('0x38')]);var _0x2afac5={'where':_0x273291['where']};return db[_0x82cb('0x21')]['count'](_0x2afac5)[_0x82cb('0x1c')](function(_0x4078c9){_0x45d782[_0x82cb('0x17')]=_0x4078c9;if(_0x197497[_0x82cb('0x27')][_0x82cb('0x39')]){_0x273291[_0x82cb('0x3a')]=[{'all':!![]}];}return db['FaxApplication']['findAll'](_0x273291);})[_0x82cb('0x1c')](function(_0x195a6e){_0x45d782[_0x82cb('0x3b')]=_0x195a6e;return _0x45d782;})[_0x82cb('0x1c')](respondWithFilteredResult(_0x4b5207,_0x273291))[_0x82cb('0x3c')](handleError(_0x4b5207,null));};exports[_0x82cb('0x3d')]=function(_0x40b5c0,_0x5676de){var _0x3f5745={'raw':!![],'where':{'id':_0x40b5c0[_0x82cb('0x3e')]['id']}},_0x479d2a={};_0x479d2a[_0x82cb('0x2e')]=_[_0x82cb('0x28')](db['FaxApplication'][_0x82cb('0x22')]);_0x479d2a[_0x82cb('0x27')]=_[_0x82cb('0x28')](_0x40b5c0[_0x82cb('0x27')]);_0x479d2a[_0x82cb('0x29')]=_[_0x82cb('0x2a')](_0x479d2a[_0x82cb('0x2e')],_0x479d2a[_0x82cb('0x27')]);_0x3f5745[_0x82cb('0x2b')]=_[_0x82cb('0x2a')](_0x479d2a['model'],qs[_0x82cb('0x2c')](_0x40b5c0[_0x82cb('0x27')][_0x82cb('0x2c')]));_0x3f5745[_0x82cb('0x2b')]=_0x3f5745[_0x82cb('0x2b')][_0x82cb('0x2d')]?_0x3f5745[_0x82cb('0x2b')]:_0x479d2a[_0x82cb('0x2e')];if(_0x40b5c0[_0x82cb('0x27')]['includeAll']){_0x3f5745[_0x82cb('0x3a')]=[{'all':!![]}];}_0x3f5745=_['merge']({},_0x3f5745,_0x40b5c0[_0x82cb('0x38')]);return db[_0x82cb('0x21')][_0x82cb('0x3f')](_0x3f5745)[_0x82cb('0x1c')](handleEntityNotFound(_0x5676de,null))[_0x82cb('0x1c')](respondWithResult(_0x5676de,null))[_0x82cb('0x3c')](handleError(_0x5676de,null));};exports[_0x82cb('0x40')]=function(_0x1b1399,_0x3de957){return db[_0x82cb('0x21')][_0x82cb('0x40')](_0x1b1399[_0x82cb('0x41')],{})[_0x82cb('0x1c')](respondWithResult(_0x3de957,0xc9))['catch'](handleError(_0x3de957,null));};exports[_0x82cb('0x1b')]=function(_0x5dd718,_0x570144){if(_0x5dd718[_0x82cb('0x41')]['id']){delete _0x5dd718[_0x82cb('0x41')]['id'];}return db[_0x82cb('0x21')]['find']({'where':{'id':_0x5dd718['params']['id']}})['then'](handleEntityNotFound(_0x570144,null))[_0x82cb('0x1c')](saveUpdates(_0x5dd718[_0x82cb('0x41')],null))['then'](respondWithResult(_0x570144,null))[_0x82cb('0x3c')](handleError(_0x570144,null));};exports[_0x82cb('0x42')]=function(_0x3439a2,_0x2641df){return db[_0x82cb('0x21')][_0x82cb('0x3f')]({'where':{'id':_0x3439a2[_0x82cb('0x3e')]['id']}})[_0x82cb('0x1c')](handleEntityNotFound(_0x2641df,null))[_0x82cb('0x1c')](removeEntity(_0x2641df,null))[_0x82cb('0x3c')](handleError(_0x2641df,null));}; \ No newline at end of file +var _0x6011=['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','sendStatus','status','end','json','undefined','limit','count','offset','Content-Range','apply','save','update','destroy','error','name','send','index','map','rawAttributes','key','query','keys','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','merge','type','VIRTUAL','options','FaxApplication','then','catch','params','includeAll','include','create','body','find','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','squel'];(function(_0x493d93,_0x345b6f){var _0x57d6f3=function(_0x19aa40){while(--_0x19aa40){_0x493d93['push'](_0x493d93['shift']());}};_0x57d6f3(++_0x345b6f);}(_0x6011,0x81));var _0x1601=function(_0x32059f,_0x26df54){_0x32059f=_0x32059f-0x0;var _0x549716=_0x6011[_0x32059f];return _0x549716;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x1601('0x0'));var rp=require(_0x1601('0x1'));var moment=require(_0x1601('0x2'));var BPromise=require(_0x1601('0x3'));var Mustache=require(_0x1601('0x4'));var util=require(_0x1601('0x5'));var path=require('path');var sox=require(_0x1601('0x6'));var csv=require(_0x1601('0x7'));var ejs=require(_0x1601('0x8'));var fs=require('fs');var fs_extra=require(_0x1601('0x9'));var _=require('lodash');var squel=require(_0x1601('0xa'));var crypto=require(_0x1601('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x1601('0xc'));var toCsv=require('to-csv');var querystring=require(_0x1601('0xd'));var Papa=require(_0x1601('0xe'));var Redis=require('ioredis');var authService=require(_0x1601('0xf'));var qs=require(_0x1601('0x10'));var as=require(_0x1601('0x11'));var hardwareService=require(_0x1601('0x12'));var logger=require(_0x1601('0x13'))(_0x1601('0x14'));var utils=require(_0x1601('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x1601('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x36449d,_0x5e55c7){_0x5e55c7=_0x5e55c7||0xcc;return function(_0x231142){if(_0x231142){return _0x36449d[_0x1601('0x17')](_0x5e55c7);}return _0x36449d[_0x1601('0x18')](_0x5e55c7)[_0x1601('0x19')]();};}function respondWithResult(_0x32ece3,_0x376212){_0x376212=_0x376212||0xc8;return function(_0x4ea42d){if(_0x4ea42d){return _0x32ece3['status'](_0x376212)[_0x1601('0x1a')](_0x4ea42d);}};}function respondWithFilteredResult(_0x29baf2,_0x2b0221){return function(_0x551e95){if(_0x551e95){var _0x23d8d7=typeof _0x2b0221['offset']===_0x1601('0x1b')&&typeof _0x2b0221[_0x1601('0x1c')]===_0x1601('0x1b');var _0x1d1d8d=_0x551e95[_0x1601('0x1d')];var _0x154938=_0x23d8d7?0x0:_0x2b0221[_0x1601('0x1e')];var _0x80516c=_0x23d8d7?_0x551e95[_0x1601('0x1d')]:_0x2b0221[_0x1601('0x1e')]+_0x2b0221[_0x1601('0x1c')];var _0x1c44b6;if(_0x80516c>=_0x1d1d8d){_0x80516c=_0x1d1d8d;_0x1c44b6=0xc8;}else{_0x1c44b6=0xce;}_0x29baf2[_0x1601('0x18')](_0x1c44b6);return _0x29baf2['set'](_0x1601('0x1f'),_0x154938+'-'+_0x80516c+'/'+_0x1d1d8d)[_0x1601('0x1a')](_0x551e95);}return null;};}function patchUpdates(_0x312d18){return function(_0x57f92a){try{jsonpatch[_0x1601('0x20')](_0x57f92a,_0x312d18,!![]);}catch(_0x2a977a){return BPromise['reject'](_0x2a977a);}return _0x57f92a[_0x1601('0x21')]();};}function saveUpdates(_0x54bf16,_0x31350b){return function(_0x4515cc){if(_0x4515cc){return _0x4515cc[_0x1601('0x22')](_0x54bf16)['then'](function(_0x46ce14){return _0x46ce14;});}return null;};}function removeEntity(_0x2283c7,_0x5f4e06){return function(_0x23d607){if(_0x23d607){return _0x23d607[_0x1601('0x23')]()['then'](function(){_0x2283c7[_0x1601('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x565875,_0x3b982d){return function(_0x5f02a2){if(!_0x5f02a2){_0x565875['sendStatus'](0x194);}return _0x5f02a2;};}function handleError(_0x3cfd7e,_0x55bc03){_0x55bc03=_0x55bc03||0x1f4;return function(_0x51e85c){logger[_0x1601('0x24')](_0x51e85c['stack']);if(_0x51e85c[_0x1601('0x25')]){delete _0x51e85c[_0x1601('0x25')];}_0x3cfd7e['status'](_0x55bc03)[_0x1601('0x26')](_0x51e85c);};}exports[_0x1601('0x27')]=function(_0x5843e2,_0xcbcd2e){var _0x368835={},_0x89c09a={},_0x29b39d={'count':0x0,'rows':[]};var _0x34d255=_[_0x1601('0x28')](db['FaxApplication'][_0x1601('0x29')],function(_0x4e889f){return{'name':_0x4e889f['fieldName'],'type':_0x4e889f['type'][_0x1601('0x2a')]};});_0x89c09a['model']=_[_0x1601('0x28')](_0x34d255,_0x1601('0x25'));_0x89c09a[_0x1601('0x2b')]=_[_0x1601('0x2c')](_0x5843e2[_0x1601('0x2b')]);_0x89c09a[_0x1601('0x2d')]=_[_0x1601('0x2e')](_0x89c09a['model'],_0x89c09a['query']);_0x368835[_0x1601('0x2f')]=_[_0x1601('0x2e')](_0x89c09a[_0x1601('0x30')],qs[_0x1601('0x31')](_0x5843e2[_0x1601('0x2b')]['fields']));_0x368835[_0x1601('0x2f')]=_0x368835['attributes'][_0x1601('0x32')]?_0x368835[_0x1601('0x2f')]:_0x89c09a[_0x1601('0x30')];if(!_0x5843e2[_0x1601('0x2b')][_0x1601('0x33')](_0x1601('0x34'))){_0x368835['limit']=qs[_0x1601('0x1c')](_0x5843e2[_0x1601('0x2b')][_0x1601('0x1c')]);_0x368835['offset']=qs['offset'](_0x5843e2[_0x1601('0x2b')][_0x1601('0x1e')]);}_0x368835[_0x1601('0x35')]=qs[_0x1601('0x36')](_0x5843e2['query'][_0x1601('0x36')]);_0x368835['where']=qs[_0x1601('0x2d')](_[_0x1601('0x37')](_0x5843e2[_0x1601('0x2b')],_0x89c09a[_0x1601('0x2d')]),_0x34d255);if(_0x5843e2[_0x1601('0x2b')][_0x1601('0x38')]){_0x368835['where']=_[_0x1601('0x39')](_0x368835['where'],{'$or':_['map'](_0x34d255,function(_0x4c2181){if(_0x4c2181[_0x1601('0x3a')]!==_0x1601('0x3b')){var _0x25b855={};_0x25b855[_0x4c2181[_0x1601('0x25')]]={'$like':'%'+_0x5843e2['query']['filter']+'%'};return _0x25b855;}})});}_0x368835=_[_0x1601('0x39')]({},_0x368835,_0x5843e2[_0x1601('0x3c')]);var _0x39aeb={'where':_0x368835['where']};return db[_0x1601('0x3d')][_0x1601('0x1d')](_0x39aeb)[_0x1601('0x3e')](function(_0x45b003){_0x29b39d[_0x1601('0x1d')]=_0x45b003;if(_0x5843e2[_0x1601('0x2b')]['includeAll']){_0x368835['include']=[{'all':!![]}];}return db['FaxApplication']['findAll'](_0x368835);})[_0x1601('0x3e')](function(_0x46da80){_0x29b39d['rows']=_0x46da80;return _0x29b39d;})[_0x1601('0x3e')](respondWithFilteredResult(_0xcbcd2e,_0x368835))[_0x1601('0x3f')](handleError(_0xcbcd2e,null));};exports['show']=function(_0x571aef,_0x1bbb98){var _0x466711={'raw':!![],'where':{'id':_0x571aef[_0x1601('0x40')]['id']}},_0xd3ab58={};_0xd3ab58[_0x1601('0x30')]=_[_0x1601('0x2c')](db[_0x1601('0x3d')][_0x1601('0x29')]);_0xd3ab58[_0x1601('0x2b')]=_['keys'](_0x571aef[_0x1601('0x2b')]);_0xd3ab58[_0x1601('0x2d')]=_[_0x1601('0x2e')](_0xd3ab58[_0x1601('0x30')],_0xd3ab58[_0x1601('0x2b')]);_0x466711[_0x1601('0x2f')]=_['intersection'](_0xd3ab58[_0x1601('0x30')],qs[_0x1601('0x31')](_0x571aef[_0x1601('0x2b')][_0x1601('0x31')]));_0x466711['attributes']=_0x466711[_0x1601('0x2f')][_0x1601('0x32')]?_0x466711[_0x1601('0x2f')]:_0xd3ab58[_0x1601('0x30')];if(_0x571aef[_0x1601('0x2b')][_0x1601('0x41')]){_0x466711[_0x1601('0x42')]=[{'all':!![]}];}_0x466711=_['merge']({},_0x466711,_0x571aef[_0x1601('0x3c')]);return db[_0x1601('0x3d')]['find'](_0x466711)[_0x1601('0x3e')](handleEntityNotFound(_0x1bbb98,null))[_0x1601('0x3e')](respondWithResult(_0x1bbb98,null))[_0x1601('0x3f')](handleError(_0x1bbb98,null));};exports[_0x1601('0x43')]=function(_0x6c82e3,_0x4160b6){return db[_0x1601('0x3d')]['create'](_0x6c82e3[_0x1601('0x44')],{})[_0x1601('0x3e')](respondWithResult(_0x4160b6,0xc9))[_0x1601('0x3f')](handleError(_0x4160b6,null));};exports['update']=function(_0x56cb45,_0x503c80){if(_0x56cb45[_0x1601('0x44')]['id']){delete _0x56cb45[_0x1601('0x44')]['id'];}return db[_0x1601('0x3d')][_0x1601('0x45')]({'where':{'id':_0x56cb45[_0x1601('0x40')]['id']}})[_0x1601('0x3e')](handleEntityNotFound(_0x503c80,null))[_0x1601('0x3e')](saveUpdates(_0x56cb45['body'],null))[_0x1601('0x3e')](respondWithResult(_0x503c80,null))[_0x1601('0x3f')](handleError(_0x503c80,null));};exports[_0x1601('0x23')]=function(_0x1caeab,_0x4f0a28){return db[_0x1601('0x3d')][_0x1601('0x45')]({'where':{'id':_0x1caeab[_0x1601('0x40')]['id']}})['then'](handleEntityNotFound(_0x4f0a28,null))[_0x1601('0x3e')](removeEntity(_0x4f0a28,null))[_0x1601('0x3f')](handleError(_0x4f0a28,null));}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.model.js b/server/api/faxApplication/faxApplication.model.js index 122bac1..384b1ae 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 _0x6682=['moment','request-promise','rimraf','exports','FaxApplication','fax_applications','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger'];(function(_0x80d625,_0xb00711){var _0x400497=function(_0x2b4106){while(--_0x2b4106){_0x80d625['push'](_0x80d625['shift']());}};_0x400497(++_0xb00711);}(_0x6682,0xa8));var _0x2668=function(_0x5b5490,_0x687b7c){_0x5b5490=_0x5b5490-0x0;var _0x2cdc70=_0x6682[_0x5b5490];return _0x2cdc70;};'use strict';var _=require('lodash');var util=require(_0x2668('0x0'));var logger=require(_0x2668('0x1'))('api');var moment=require(_0x2668('0x2'));var BPromise=require('bluebird');var rp=require(_0x2668('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2668('0x4'));var config=require('../../config/environment');var attributes=require('./faxApplication.attributes');module[_0x2668('0x5')]=function(_0xc9c43a,_0x2073f6){return _0xc9c43a['define'](_0x2668('0x6'),attributes,{'tableName':_0x2668('0x7'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x2668('0x8'),'collate':_0x2668('0x9')});}; \ No newline at end of file +var _0xf340=['path','rimraf','../../config/environment','./faxApplication.attributes','exports','define','FaxApplication','fax_applications','utf8mb4','lodash','util','../../config/logger','api','bluebird','request-promise'];(function(_0x73914f,_0x2100e5){var _0x4234a=function(_0x586531){while(--_0x586531){_0x73914f['push'](_0x73914f['shift']());}};_0x4234a(++_0x2100e5);}(_0xf340,0xbd));var _0x0f34=function(_0x6cc0dd,_0x214f7d){_0x6cc0dd=_0x6cc0dd-0x0;var _0x3133a9=_0xf340[_0x6cc0dd];return _0x3133a9;};'use strict';var _=require(_0x0f34('0x0'));var util=require(_0x0f34('0x1'));var logger=require(_0x0f34('0x2'))(_0x0f34('0x3'));var moment=require('moment');var BPromise=require(_0x0f34('0x4'));var rp=require(_0x0f34('0x5'));var fs=require('fs');var path=require(_0x0f34('0x6'));var rimraf=require(_0x0f34('0x7'));var config=require(_0x0f34('0x8'));var attributes=require(_0x0f34('0x9'));module[_0x0f34('0xa')]=function(_0x21f076,_0x206630){return _0x21f076[_0x0f34('0xb')](_0x0f34('0xc'),attributes,{'tableName':_0x0f34('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x0f34('0xe'),'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 fd6c529..29f7ac7 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 _0xd881=['message','result','catch','UpdateFaxApplication','FaxApplication','update','body','options','raw','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','then','info','FaxApplication,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xd881,0x182));var _0x1d88=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0xd881[_0x40a045];return _0x1a687c;};'use strict';var _=require(_0x1d88('0x0'));var util=require('util');var moment=require(_0x1d88('0x1'));var BPromise=require(_0x1d88('0x2'));var rs=require(_0x1d88('0x3'));var fs=require('fs');var Redis=require(_0x1d88('0x4'));var db=require(_0x1d88('0x5'))['db'];var utils=require(_0x1d88('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x1d88('0x7'));var jayson=require(_0x1d88('0x8'));var client=jayson[_0x1d88('0x9')][_0x1d88('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x576757,_0x3aa622,_0x19534b){return new BPromise(function(_0x4f09c7,_0x35e35f){return client[_0x1d88('0xb')](_0x576757,_0x19534b)[_0x1d88('0xc')](function(_0x34a5b9){logger[_0x1d88('0xd')](_0x1d88('0xe'),_0x3aa622,_0x1d88('0xf'));logger[_0x1d88('0x10')]('FaxApplication,\x20%s,\x20%s,\x20%s',_0x3aa622,_0x1d88('0xf'),JSON[_0x1d88('0x11')](_0x34a5b9));if(_0x34a5b9[_0x1d88('0x12')]){if(_0x34a5b9['error'][_0x1d88('0x13')]===0x1f4){logger['error'](_0x1d88('0xe'),_0x3aa622,_0x34a5b9['error']['message']);return _0x35e35f(_0x34a5b9[_0x1d88('0x12')][_0x1d88('0x14')]);}logger['error'](_0x1d88('0xe'),_0x3aa622,_0x34a5b9[_0x1d88('0x12')][_0x1d88('0x14')]);return _0x4f09c7(_0x34a5b9[_0x1d88('0x12')][_0x1d88('0x14')]);}else{logger['info'](_0x1d88('0xe'),_0x3aa622,_0x1d88('0xf'));_0x4f09c7(_0x34a5b9[_0x1d88('0x15')]['message']);}})[_0x1d88('0x16')](function(_0x4bb9a1){logger[_0x1d88('0x12')]('FaxApplication,\x20%s,\x20%s',_0x3aa622,_0x4bb9a1);_0x35e35f(_0x4bb9a1);});});}exports[_0x1d88('0x17')]=function(_0x38f1ae){var _0x246357=this;return new Promise(function(_0x2ff49e,_0x567cc5){return db[_0x1d88('0x18')][_0x1d88('0x19')](_0x38f1ae[_0x1d88('0x1a')],{'raw':_0x38f1ae['options']?_0x38f1ae[_0x1d88('0x1b')][_0x1d88('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x38f1ae[_0x1d88('0x1b')]?_0x38f1ae[_0x1d88('0x1b')]['where']||null:null,'attributes':_0x38f1ae[_0x1d88('0x1b')]?_0x38f1ae[_0x1d88('0x1b')]['attributes']||null:null,'limit':_0x38f1ae['options']?_0x38f1ae[_0x1d88('0x1b')]['limit']||null:null})[_0x1d88('0xc')](function(_0x85bab3){logger[_0x1d88('0xd')](_0x1d88('0x17'),_0x38f1ae);logger[_0x1d88('0x10')]('UpdateFaxApplication',_0x38f1ae,JSON[_0x1d88('0x11')](_0x85bab3));_0x2ff49e(_0x85bab3);})[_0x1d88('0x16')](function(_0x1a799a){logger['error']('UpdateFaxApplication',_0x1a799a[_0x1d88('0x14')],_0x38f1ae);_0x567cc5(_0x246357['error'](0x1f4,_0x1a799a[_0x1d88('0x14')]));});});}; \ No newline at end of file +var _0x06cb=['request\x20sent','stringify','error','message','UpdateFaxApplication','FaxApplication','body','options','raw','limit','then','debug','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','FaxApplication,\x20%s,\x20%s','FaxApplication,\x20%s,\x20%s,\x20%s'];(function(_0x5d78e7,_0x5e0d00){var _0x13175b=function(_0x40e7bc){while(--_0x40e7bc){_0x5d78e7['push'](_0x5d78e7['shift']());}};_0x13175b(++_0x5e0d00);}(_0x06cb,0x1c6));var _0xb06c=function(_0x470b74,_0x44eb5a){_0x470b74=_0x470b74-0x0;var _0x4e7680=_0x06cb[_0x470b74];return _0x4e7680;};'use strict';var _=require(_0xb06c('0x0'));var util=require(_0xb06c('0x1'));var moment=require(_0xb06c('0x2'));var BPromise=require(_0xb06c('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb06c('0x4'))['db'];var utils=require(_0xb06c('0x5'));var logger=require(_0xb06c('0x6'))(_0xb06c('0x7'));var config=require(_0xb06c('0x8'));var jayson=require(_0xb06c('0x9'));var client=jayson['client'][_0xb06c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4625b3,_0x323616,_0x33510e){return new BPromise(function(_0x61724,_0x36bffa){return client['request'](_0x4625b3,_0x33510e)['then'](function(_0x3a2106){logger[_0xb06c('0xb')](_0xb06c('0xc'),_0x323616,'request\x20sent');logger['debug'](_0xb06c('0xd'),_0x323616,_0xb06c('0xe'),JSON[_0xb06c('0xf')](_0x3a2106));if(_0x3a2106[_0xb06c('0x10')]){if(_0x3a2106['error']['code']===0x1f4){logger['error'](_0xb06c('0xc'),_0x323616,_0x3a2106['error'][_0xb06c('0x11')]);return _0x36bffa(_0x3a2106[_0xb06c('0x10')][_0xb06c('0x11')]);}logger['error'](_0xb06c('0xc'),_0x323616,_0x3a2106['error'][_0xb06c('0x11')]);return _0x61724(_0x3a2106[_0xb06c('0x10')][_0xb06c('0x11')]);}else{logger['info'](_0xb06c('0xc'),_0x323616,_0xb06c('0xe'));_0x61724(_0x3a2106['result'][_0xb06c('0x11')]);}})['catch'](function(_0x21a607){logger[_0xb06c('0x10')]('FaxApplication,\x20%s,\x20%s',_0x323616,_0x21a607);_0x36bffa(_0x21a607);});});}exports[_0xb06c('0x12')]=function(_0x2ec642){var _0x376452=this;return new Promise(function(_0x498562,_0x17e6d8){return db[_0xb06c('0x13')]['update'](_0x2ec642[_0xb06c('0x14')],{'raw':_0x2ec642['options']?_0x2ec642[_0xb06c('0x15')][_0xb06c('0x16')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2ec642[_0xb06c('0x15')]?_0x2ec642[_0xb06c('0x15')]['where']||null:null,'attributes':_0x2ec642[_0xb06c('0x15')]?_0x2ec642[_0xb06c('0x15')]['attributes']||null:null,'limit':_0x2ec642[_0xb06c('0x15')]?_0x2ec642[_0xb06c('0x15')][_0xb06c('0x17')]||null:null})[_0xb06c('0x18')](function(_0x1fb358){logger[_0xb06c('0xb')]('UpdateFaxApplication',_0x2ec642);logger[_0xb06c('0x19')](_0xb06c('0x12'),_0x2ec642,JSON[_0xb06c('0xf')](_0x1fb358));_0x498562(_0x1fb358);})['catch'](function(_0x3d4c01){logger['error'](_0xb06c('0x12'),_0x3d4c01[_0xb06c('0x11')],_0x2ec642);_0x17e6d8(_0x376452[_0xb06c('0x10')](0x1f4,_0x3d4c01[_0xb06c('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/faxApplication/index.js b/server/api/faxApplication/index.js index 93dd070..bc781df 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 _0xea28=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./faxApplication.controller','get','index','/:id','isAuthenticated','show','post','create','put','update','destroy','exports','multer'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xea28,0x13a));var _0x8ea2=function(_0x24ba10,_0x12587c){_0x24ba10=_0x24ba10-0x0;var _0x3d8e38=_0xea28[_0x24ba10];return _0x3d8e38;};'use strict';var multer=require(_0x8ea2('0x0'));var util=require(_0x8ea2('0x1'));var path=require(_0x8ea2('0x2'));var timeout=require(_0x8ea2('0x3'));var express=require(_0x8ea2('0x4'));var router=express[_0x8ea2('0x5')]();var fs_extra=require(_0x8ea2('0x6'));var auth=require(_0x8ea2('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x8ea2('0x8'));var controller=require(_0x8ea2('0x9'));router[_0x8ea2('0xa')]('/',auth['isAuthenticated'](),controller[_0x8ea2('0xb')]);router[_0x8ea2('0xa')](_0x8ea2('0xc'),auth[_0x8ea2('0xd')](),controller[_0x8ea2('0xe')]);router[_0x8ea2('0xf')]('/',auth[_0x8ea2('0xd')](),controller[_0x8ea2('0x10')]);router[_0x8ea2('0x11')](_0x8ea2('0xc'),auth[_0x8ea2('0xd')](),controller[_0x8ea2('0x12')]);router['delete']('/:id',auth[_0x8ea2('0xd')](),controller[_0x8ea2('0x13')]);module[_0x8ea2('0x14')]=router; \ No newline at end of file +var _0xf7b4=['express','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxApplication.controller','get','isAuthenticated','index','/:id','show','post','put','update','delete','destroy','multer','connect-timeout'];(function(_0x44afa4,_0x5be27b){var _0xcad289=function(_0x206272){while(--_0x206272){_0x44afa4['push'](_0x44afa4['shift']());}};_0xcad289(++_0x5be27b);}(_0xf7b4,0x152));var _0x4f7b=function(_0x542174,_0xf4190){_0x542174=_0x542174-0x0;var _0x3b4c31=_0xf7b4[_0x542174];return _0x3b4c31;};'use strict';var multer=require(_0x4f7b('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x4f7b('0x1'));var express=require(_0x4f7b('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x4f7b('0x3'));var interaction=require(_0x4f7b('0x4'));var config=require(_0x4f7b('0x5'));var controller=require(_0x4f7b('0x6'));router[_0x4f7b('0x7')]('/',auth[_0x4f7b('0x8')](),controller[_0x4f7b('0x9')]);router[_0x4f7b('0x7')](_0x4f7b('0xa'),auth[_0x4f7b('0x8')](),controller[_0x4f7b('0xb')]);router[_0x4f7b('0xc')]('/',auth[_0x4f7b('0x8')](),controller['create']);router[_0x4f7b('0xd')](_0x4f7b('0xa'),auth['isAuthenticated'](),controller[_0x4f7b('0xe')]);router[_0x4f7b('0xf')](_0x4f7b('0xa'),auth[_0x4f7b('0x8')](),controller[_0x4f7b('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.attributes.js b/server/api/faxInteraction/faxInteraction.attributes.js index ff4be9d..20b85e2 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 _0x2a07=['STRING','ENUM','out','INTEGER','sequelize','exports','BOOLEAN','DATE'];(function(_0x42512a,_0x2497f5){var _0x49a278=function(_0x526865){while(--_0x526865){_0x42512a['push'](_0x42512a['shift']());}};_0x49a278(++_0x2497f5);}(_0x2a07,0x74));var _0x72a0=function(_0x3b119f,_0x4f10d3){_0x3b119f=_0x3b119f-0x0;var _0x1aff29=_0x2a07[_0x3b119f];return _0x1aff29;};'use strict';var Sequelize=require(_0x72a0('0x0'));module[_0x72a0('0x1')]={'closed':{'type':Sequelize[_0x72a0('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x72a0('0x3')]},'disposition':{'type':Sequelize[_0x72a0('0x4')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x72a0('0x4')]},'note':{'type':Sequelize[_0x72a0('0x4')]},'read1stAt':{'type':Sequelize[_0x72a0('0x3')]},'fax':{'type':Sequelize[_0x72a0('0x4')]},'firstMsgDirection':{'type':Sequelize[_0x72a0('0x5')]('in',_0x72a0('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x72a0('0x3')]},'lastMsgDirection':{'type':Sequelize[_0x72a0('0x5')]('in',_0x72a0('0x6')),'defaultValue':'in','allowNull':![]},'queueId':{'type':Sequelize[_0x72a0('0x7')]}}; \ No newline at end of file +var _0x4b17=['STRING','ENUM','out','DATE','INTEGER','sequelize','BOOLEAN'];(function(_0x2374b1,_0x2e969c){var _0x54166a=function(_0x1b3825){while(--_0x1b3825){_0x2374b1['push'](_0x2374b1['shift']());}};_0x54166a(++_0x2e969c);}(_0x4b17,0x10f));var _0x74b1=function(_0x380a3f,_0x202483){_0x380a3f=_0x380a3f-0x0;var _0x2b4eca=_0x4b17[_0x380a3f];return _0x2b4eca;};'use strict';var Sequelize=require(_0x74b1('0x0'));module['exports']={'closed':{'type':Sequelize[_0x74b1('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0x74b1('0x2')]},'secondDisposition':{'type':Sequelize[_0x74b1('0x2')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x74b1('0x2')]},'read1stAt':{'type':Sequelize['DATE']},'fax':{'type':Sequelize['STRING']},'firstMsgDirection':{'type':Sequelize[_0x74b1('0x3')]('in',_0x74b1('0x4')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x74b1('0x5')]},'lastMsgDirection':{'type':Sequelize[_0x74b1('0x3')]('in',_0x74b1('0x4')),'defaultValue':'in','allowNull':![]},'queueId':{'type':Sequelize[_0x74b1('0x6')]}}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.controller.js b/server/api/faxInteraction/faxInteraction.controller.js index dbf675c..33b66e1 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 _0xebe0=['attachments','join','transcript-%d-%s.zip','Attachment','Messages','createdAt','mkdirSync','basename','existsSync','createReadStream','pipe','createWriteStream','log','err','unlinkSync','sendStatus','rimraf','zip-dir','moment','bluebird','util','path','lodash','../../components/parsers/qs','../../config/logger','../../mysqldb','redis','defaults','./faxInteraction.socket','register','status','end','json','offset','limit','count','set','Content-Range','update','then','error','stack','name','index','map','FaxInteraction','rawAttributes','key','findAll','fax','user','catch','show','model','keys','query','intersection','attributes','fields','length','includeAll','include','merge','options','create','body','find','describe','addMessage','params','omit','ids','getMessages','findOne','FaxMessage','filters','hasOwnProperty','sort','where','filter','$gte','format','rows','setTags','color','emit','removeTags','download','toString','root','server','tmp','files'];(function(_0x4a6e77,_0x4a677c){var _0x1c137e=function(_0x3ecd59){while(--_0x3ecd59){_0x4a6e77['push'](_0x4a6e77['shift']());}};_0x1c137e(++_0x4a677c);}(_0xebe0,0x127));var _0x0ebe=function(_0x38f95e,_0x357c55){_0x38f95e=_0x38f95e-0x0;var _0x265769=_0xebe0[_0x38f95e];return _0x265769;};'use strict';var rimraf=require(_0x0ebe('0x0'));var zipdir=require(_0x0ebe('0x1'));var moment=require(_0x0ebe('0x2'));var BPromise=require(_0x0ebe('0x3'));var util=require(_0x0ebe('0x4'));var path=require(_0x0ebe('0x5'));var fs=require('fs');var _=require(_0x0ebe('0x6'));var Redis=require('ioredis');var interaction=require('../../components/interaction/service');var qs=require(_0x0ebe('0x7'));var logger=require(_0x0ebe('0x8'))('api');var config=require('../../config/environment');var db=require(_0x0ebe('0x9'))['db'];config[_0x0ebe('0xa')]=_[_0x0ebe('0xb')](config[_0x0ebe('0xa')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0ebe('0xa')]));require(_0x0ebe('0xc'))[_0x0ebe('0xd')](socket);function respondWithStatusCode(_0x36cc33,_0x2be20d){_0x2be20d=_0x2be20d||0xcc;return function(_0x2715db){if(_0x2715db){return _0x36cc33['sendStatus'](_0x2be20d);}return _0x36cc33[_0x0ebe('0xe')](_0x2be20d)[_0x0ebe('0xf')]();};}function respondWithResult(_0x41fbf4,_0xbe3819){_0xbe3819=_0xbe3819||0xc8;return function(_0xc73971){if(_0xc73971){return _0x41fbf4['status'](_0xbe3819)[_0x0ebe('0x10')](_0xc73971);}};}function respondWithFilteredResult(_0x516ce2,_0xdb1db4){return function(_0x4c4745){if(_0x4c4745){var _0x228dde=typeof _0xdb1db4[_0x0ebe('0x11')]==='undefined'&&typeof _0xdb1db4[_0x0ebe('0x12')]==='undefined';var _0x4951a0=_0x4c4745['count'];var _0x12b8e9=_0x228dde?0x0:_0xdb1db4[_0x0ebe('0x11')];var _0x57e10d=_0x228dde?_0x4c4745[_0x0ebe('0x13')]:_0xdb1db4[_0x0ebe('0x11')]+_0xdb1db4[_0x0ebe('0x12')];var _0x1eedd8;if(_0x57e10d>=_0x4951a0){_0x57e10d=_0x4951a0;_0x1eedd8=0xc8;}else{_0x1eedd8=0xce;}_0x516ce2[_0x0ebe('0xe')](_0x1eedd8);return _0x516ce2[_0x0ebe('0x14')](_0x0ebe('0x15'),_0x12b8e9+'-'+_0x57e10d+'/'+_0x4951a0)[_0x0ebe('0x10')](_0x4c4745);}return null;};}function saveUpdates(_0x288227){return function(_0x4f81b3){if(_0x4f81b3){return _0x4f81b3[_0x0ebe('0x16')](_0x288227)[_0x0ebe('0x17')](function(_0x4fc42e){return _0x4fc42e;});}return null;};}function removeEntity(_0x18bac3){return function(_0x1d283e){if(_0x1d283e){return _0x1d283e['destroy']()[_0x0ebe('0x17')](function(){_0x18bac3[_0x0ebe('0xe')](0xcc)[_0x0ebe('0xf')]();});}};}function handleEntityNotFound(_0x25a312){return function(_0xf0b506){if(!_0xf0b506){_0x25a312['sendStatus'](0x194);}return _0xf0b506;};}function handleError(_0x2266b4,_0x1ac1ea){_0x1ac1ea=_0x1ac1ea||0x1f4;return function(_0x29547e){logger[_0x0ebe('0x18')](_0x29547e[_0x0ebe('0x19')]);if(_0x29547e[_0x0ebe('0x1a')]){delete _0x29547e[_0x0ebe('0x1a')];}_0x2266b4[_0x0ebe('0xe')](_0x1ac1ea)['send'](_0x29547e);};}exports[_0x0ebe('0x1b')]=function(_0x2045b6,_0x230f82){var _0x218e33={};var _0x1d933b=_[_0x0ebe('0x1c')](db[_0x0ebe('0x1d')][_0x0ebe('0x1e')],function(_0x4f9d5d){return{'name':_0x4f9d5d['fieldName'],'type':_0x4f9d5d['type'][_0x0ebe('0x1f')]};});_0x218e33=qs['getOptions'](_0x1d933b,_0x2045b6);return interaction[_0x0ebe('0x20')](_0x0ebe('0x21'),_0x2045b6['query'],_0x2045b6[_0x0ebe('0x22')],_0x218e33,_0x1d933b)['then'](respondWithFilteredResult(_0x230f82,_0x218e33))[_0x0ebe('0x23')](handleError(_0x230f82,null));};exports[_0x0ebe('0x24')]=function(_0x39ba94,_0x13379f){var _0x145136={'raw':![],'where':{'id':_0x39ba94['params']['id']}},_0x5249b9={};_0x5249b9[_0x0ebe('0x25')]=_[_0x0ebe('0x26')](db[_0x0ebe('0x1d')][_0x0ebe('0x1e')]);_0x5249b9[_0x0ebe('0x27')]=_[_0x0ebe('0x26')](_0x39ba94[_0x0ebe('0x27')]);_0x5249b9['filters']=_[_0x0ebe('0x28')](_0x5249b9[_0x0ebe('0x25')],_0x5249b9['query']);_0x145136[_0x0ebe('0x29')]=_[_0x0ebe('0x28')](_0x5249b9[_0x0ebe('0x25')],qs[_0x0ebe('0x2a')](_0x39ba94['query'][_0x0ebe('0x2a')]));_0x145136[_0x0ebe('0x29')]=_0x145136['attributes'][_0x0ebe('0x2b')]?_0x145136['attributes']:_0x5249b9[_0x0ebe('0x25')];if(_0x39ba94[_0x0ebe('0x27')][_0x0ebe('0x2c')]){_0x145136[_0x0ebe('0x2d')]=[{'all':!![]}];}_0x145136=_[_0x0ebe('0x2e')]({},_0x145136,_0x39ba94[_0x0ebe('0x2f')]);return db['FaxInteraction']['find'](_0x145136)[_0x0ebe('0x17')](handleEntityNotFound(_0x13379f,null))[_0x0ebe('0x17')](respondWithResult(_0x13379f,null))[_0x0ebe('0x23')](handleError(_0x13379f,null));};exports[_0x0ebe('0x30')]=function(_0x598bd3,_0x36811a){return db[_0x0ebe('0x1d')]['create'](_0x598bd3[_0x0ebe('0x31')],{})['then'](respondWithResult(_0x36811a,0xc9))['catch'](handleError(_0x36811a,null));};exports[_0x0ebe('0x16')]=function(_0xaeb96c,_0xcdeb0b){if(_0xaeb96c['body']['id']){delete _0xaeb96c[_0x0ebe('0x31')]['id'];}return db[_0x0ebe('0x1d')][_0x0ebe('0x32')]({'where':{'id':_0xaeb96c['params']['id']}})[_0x0ebe('0x17')](handleEntityNotFound(_0xcdeb0b,null))[_0x0ebe('0x17')](saveUpdates(_0xaeb96c[_0x0ebe('0x31')],null))['then'](respondWithResult(_0xcdeb0b,null))[_0x0ebe('0x23')](handleError(_0xcdeb0b,null));};exports['destroy']=function(_0x15b9e3,_0x2d8954){return db[_0x0ebe('0x1d')][_0x0ebe('0x32')]({'where':{'id':_0x15b9e3['params']['id']}})['then'](handleEntityNotFound(_0x2d8954,null))[_0x0ebe('0x17')](removeEntity(_0x2d8954,null))[_0x0ebe('0x23')](handleError(_0x2d8954,null));};exports[_0x0ebe('0x33')]=function(_0x14a83d,_0x5d6bba){return db[_0x0ebe('0x1d')]['describe']()['then'](respondWithResult(_0x5d6bba,null))[_0x0ebe('0x23')](handleError(_0x5d6bba,null));};exports[_0x0ebe('0x34')]=function(_0x46f800,_0xfa6c0f){return db['FaxMessage']['find']({'where':{'id':_0x46f800[_0x0ebe('0x35')]['id']}})['then'](handleEntityNotFound(_0xfa6c0f,null))[_0x0ebe('0x17')](function(_0x37c391){if(_0x37c391){return _0x37c391[_0x0ebe('0x34')](_0x46f800[_0x0ebe('0x31')]['ids'],_[_0x0ebe('0x36')](_0x46f800['body'],[_0x0ebe('0x37'),'id'])||{});}})[_0x0ebe('0x17')](respondWithResult(_0xfa6c0f,null))['catch'](handleError(_0xfa6c0f,null));};exports[_0x0ebe('0x38')]=function(_0x16c50d,_0x376990){var _0x1347d8={'raw':![],'where':{}};var _0x44e63e={};var _0x3271f2={'count':0x0,'rows':[]};return db['FaxInteraction'][_0x0ebe('0x39')]({'where':{'id':_0x16c50d['params']['id']}})[_0x0ebe('0x17')](handleEntityNotFound(_0x376990,null))['then'](function(_0x3a8820){if(_0x3a8820){_0x44e63e[_0x0ebe('0x25')]=_[_0x0ebe('0x26')](db[_0x0ebe('0x3a')][_0x0ebe('0x1e')]);_0x44e63e[_0x0ebe('0x27')]=_[_0x0ebe('0x26')](_0x16c50d[_0x0ebe('0x27')]);_0x44e63e[_0x0ebe('0x3b')]=_['intersection'](_0x44e63e[_0x0ebe('0x25')],_0x44e63e[_0x0ebe('0x27')]);_0x1347d8[_0x0ebe('0x29')]=_[_0x0ebe('0x28')](_0x44e63e[_0x0ebe('0x25')],qs[_0x0ebe('0x2a')](_0x16c50d[_0x0ebe('0x27')]['fields']));_0x1347d8[_0x0ebe('0x29')]=_0x1347d8[_0x0ebe('0x29')][_0x0ebe('0x2b')]?_0x1347d8['attributes']:_0x44e63e[_0x0ebe('0x25')];if(!_0x16c50d[_0x0ebe('0x27')][_0x0ebe('0x3c')]('nolimit')){_0x1347d8[_0x0ebe('0x12')]=qs[_0x0ebe('0x12')](_0x16c50d[_0x0ebe('0x27')][_0x0ebe('0x12')]);_0x1347d8[_0x0ebe('0x11')]=qs['offset'](_0x16c50d[_0x0ebe('0x27')]['offset']);}_0x1347d8['order']=qs[_0x0ebe('0x3d')](_0x16c50d['query']['sort']);_0x1347d8[_0x0ebe('0x3e')]=qs[_0x0ebe('0x3b')](_['pick'](_0x16c50d[_0x0ebe('0x27')],_0x44e63e['filters']));_0x1347d8['where']['FaxInteractionId']=_0x3a8820['id'];if(_0x16c50d[_0x0ebe('0x27')][_0x0ebe('0x3f')]){_0x1347d8[_0x0ebe('0x3e')]=_[_0x0ebe('0x2e')](_0x1347d8[_0x0ebe('0x3e')],{'$or':_[_0x0ebe('0x1c')](_0x1347d8[_0x0ebe('0x29')],function(_0x17d1ff){var _0x1d4328={};_0x1d4328[_0x17d1ff]={'$like':'%'+_0x16c50d[_0x0ebe('0x27')][_0x0ebe('0x3f')]+'%'};return _0x1d4328;})});}if(_0x16c50d[_0x0ebe('0x27')][_0x0ebe('0x40')]){var _0xda6d33=_0x16c50d[_0x0ebe('0x27')][_0x0ebe('0x40')]['split'](',');var _0x475d57={};_0x475d57[_0xda6d33[0x0]]={'$gte':moment(_0xda6d33[0x1])[_0x0ebe('0x41')]('YYYY-MM-DD\x20HH:mm:ss')};_0x1347d8['where']=_[_0x0ebe('0x2e')](_0x1347d8[_0x0ebe('0x3e')],_0x475d57);}_0x1347d8=_[_0x0ebe('0x2e')]({},_0x1347d8,_0x16c50d[_0x0ebe('0x2f')]);return db[_0x0ebe('0x3a')][_0x0ebe('0x13')]({'where':_0x1347d8[_0x0ebe('0x3e')]})[_0x0ebe('0x17')](function(_0x4a706d){_0x3271f2[_0x0ebe('0x13')]=_0x4a706d;if(_0x16c50d['query']['includeAll']){_0x1347d8[_0x0ebe('0x2d')]=[{'all':!![]}];}return db['FaxMessage'][_0x0ebe('0x20')](_0x1347d8);})['then'](function(_0x3bd5fd){_0x3271f2[_0x0ebe('0x42')]=_0x3bd5fd;return _0x3271f2;});}})[_0x0ebe('0x17')](respondWithFilteredResult(_0x376990,_0x1347d8))[_0x0ebe('0x23')](handleError(_0x376990,null));};exports['addTags']=function(_0x2e6faf,_0x4771f2){return db[_0x0ebe('0x1d')]['find']({'where':{'id':_0x2e6faf[_0x0ebe('0x35')]['id']}})[_0x0ebe('0x17')](handleEntityNotFound(_0x4771f2,null))[_0x0ebe('0x17')](function(_0x1b9543){if(_0x1b9543){return _0x1b9543[_0x0ebe('0x43')](_0x2e6faf[_0x0ebe('0x31')]['ids'],_['omit'](_0x2e6faf[_0x0ebe('0x31')],[_0x0ebe('0x37'),'id'])||{})['spread'](function(){return db['Tag'][_0x0ebe('0x20')]({'attributes':['id',_0x0ebe('0x1a'),_0x0ebe('0x44')],'where':{'id':_0x2e6faf[_0x0ebe('0x31')][_0x0ebe('0x37')]}});})[_0x0ebe('0x17')](function(_0x25e445){socket[_0x0ebe('0x45')]('faxInteractionTags:save',{'id':Number(_0x2e6faf[_0x0ebe('0x35')]['id']),'tags':_0x25e445||[]});return{'id':Number(_0x2e6faf[_0x0ebe('0x35')]['id']),'tags':_0x25e445||[]};});}})[_0x0ebe('0x17')](respondWithResult(_0x4771f2,null))[_0x0ebe('0x23')](handleError(_0x4771f2,null));};exports['removeTags']=function(_0x334f1d,_0x223388){return db[_0x0ebe('0x1d')][_0x0ebe('0x32')]({'where':{'id':_0x334f1d['params']['id']}})[_0x0ebe('0x17')](handleEntityNotFound(_0x223388,null))[_0x0ebe('0x17')](function(_0x6d1271){if(_0x6d1271){return _0x6d1271[_0x0ebe('0x46')](_0x334f1d['query']['ids']);}})['then'](respondWithStatusCode(_0x223388,null))['catch'](handleError(_0x223388,null));};exports[_0x0ebe('0x47')]=function(_0xff5f71,_0x148cd4){var _0x1fb784=moment()['unix']()[_0x0ebe('0x48')]();var _0x359ab1=path['join'](config[_0x0ebe('0x49')],_0x0ebe('0x4a'),'files',_0x0ebe('0x4b'));var _0x3da3e3=path['join'](config[_0x0ebe('0x49')],_0x0ebe('0x4a'),_0x0ebe('0x4c'),_0x0ebe('0x4d'));var _0xc0d517=path[_0x0ebe('0x4e')](_0x359ab1,_0x1fb784);var _0xf96775=util[_0x0ebe('0x41')](_0x0ebe('0x4f'),_0xff5f71[_0x0ebe('0x35')]['id'],_0x1fb784);var _0x362307=path[_0x0ebe('0x4e')](_0x359ab1,_0xf96775);var _0x1f5a6e=[];_0x1f5a6e['push']({'model':db['Attachment'],'as':_0x0ebe('0x50'),'raw':!![]});var _0x358ced=[{'model':db['FaxMessage'],'as':_0x0ebe('0x51'),'attributes':['id','body',_0x0ebe('0x52')],'include':_0x1f5a6e}];return db[_0x0ebe('0x1d')][_0x0ebe('0x32')]({'where':{'id':_0xff5f71[_0x0ebe('0x35')]['id']},'include':_0x358ced})['then'](handleEntityNotFound(_0x148cd4,null))['then'](function(_0xdd5a92){if(_0xdd5a92&&_0xdd5a92[_0x0ebe('0x51')]){var _0x12d2d9=_0xdd5a92['get']({'plain':!![]});fs[_0x0ebe('0x53')](_0xc0d517);for(var _0x4afee5=0x0;_0x4afee5<_0x12d2d9[_0x0ebe('0x51')][_0x0ebe('0x2b')];_0x4afee5++){var _0x1d8867=_0x12d2d9[_0x0ebe('0x51')][_0x4afee5][_0x0ebe('0x50')];if(_0x1d8867){var _0x38e7f7=path[_0x0ebe('0x4e')](_0x3da3e3,_0x1d8867[_0x0ebe('0x54')]);if(fs[_0x0ebe('0x55')](_0x38e7f7)){fs[_0x0ebe('0x56')](_0x38e7f7)[_0x0ebe('0x57')](fs[_0x0ebe('0x58')](path[_0x0ebe('0x4e')](_0xc0d517,_0x1d8867[_0x0ebe('0x54')])));}}}return BPromise['resolve']()['then'](function(){return new BPromise(function(_0x190561,_0x400b7a){zipdir(_0xc0d517,{'saveTo':_0x362307},function(_0x57ebac,_0x4e1ba0){if(_0x57ebac)return _0x400b7a(_0x57ebac);return _0x190561(_0x4e1ba0);});})['then'](function(){return new BPromise(function(_0x8c5cfd,_0x532448){rimraf(_0xc0d517,function(_0x3f6cd8){if(_0x3f6cd8)_0x532448(_0x3f6cd8);return _0x8c5cfd();});});})[_0x0ebe('0x17')](function(){return _0x148cd4[_0x0ebe('0x47')](_0x362307,_0xf96775,function(_0x4e33c0){if(_0x4e33c0){console[_0x0ebe('0x59')](_0x0ebe('0x5a'),_0x4e33c0);}else{fs[_0x0ebe('0x5b')](_0x362307);}});});});}else{return _0x148cd4[_0x0ebe('0x5c')](0xc8);}})[_0x0ebe('0x23')](handleError(_0x148cd4,null));}; \ No newline at end of file +var _0xa555=['localhost','redis','./faxInteraction.socket','register','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','update','destroy','then','end','stack','name','send','index','map','FaxInteraction','rawAttributes','fieldName','type','key','getOptions','findAll','fax','user','catch','show','params','keys','query','filters','intersection','model','attributes','fields','includeAll','include','options','find','create','body','describe','addMessage','ids','omit','FaxMessage','hasOwnProperty','nolimit','order','sort','where','pick','FaxInteractionId','filter','merge','$gte','split','YYYY-MM-DD\x20HH:mm:ss','rows','addTags','setTags','spread','color','emit','faxInteractionTags:save','removeTags','download','unix','toString','join','root','server','files','tmp','attachments','format','transcript-%d-%s.zip','push','Attachment','createdAt','Messages','get','mkdirSync','basename','createReadStream','pipe','createWriteStream','log','err','unlinkSync','rimraf','zip-dir','moment','util','path','lodash','../../components/interaction/service','../../components/parsers/qs','api','../../config/environment','../../mysqldb'];(function(_0x1a7f0d,_0xb4acc6){var _0x52a780=function(_0x3a24c7){while(--_0x3a24c7){_0x1a7f0d['push'](_0x1a7f0d['shift']());}};_0x52a780(++_0xb4acc6);}(_0xa555,0x1a1));var _0x5a55=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xa555[_0x501510];return _0x1e6ee5;};'use strict';var rimraf=require(_0x5a55('0x0'));var zipdir=require(_0x5a55('0x1'));var moment=require(_0x5a55('0x2'));var BPromise=require('bluebird');var util=require(_0x5a55('0x3'));var path=require(_0x5a55('0x4'));var fs=require('fs');var _=require(_0x5a55('0x5'));var Redis=require('ioredis');var interaction=require(_0x5a55('0x6'));var qs=require(_0x5a55('0x7'));var logger=require('../../config/logger')(_0x5a55('0x8'));var config=require(_0x5a55('0x9'));var db=require(_0x5a55('0xa'))['db'];config['redis']=_['defaults'](config['redis'],{'host':_0x5a55('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x5a55('0xc')]));require(_0x5a55('0xd'))[_0x5a55('0xe')](socket);function respondWithStatusCode(_0x3f8512,_0x5ceb84){_0x5ceb84=_0x5ceb84||0xcc;return function(_0x3aa8a6){if(_0x3aa8a6){return _0x3f8512[_0x5a55('0xf')](_0x5ceb84);}return _0x3f8512[_0x5a55('0x10')](_0x5ceb84)['end']();};}function respondWithResult(_0x67f1c8,_0x32cfd3){_0x32cfd3=_0x32cfd3||0xc8;return function(_0xd4cc19){if(_0xd4cc19){return _0x67f1c8[_0x5a55('0x10')](_0x32cfd3)[_0x5a55('0x11')](_0xd4cc19);}};}function respondWithFilteredResult(_0x1c59d1,_0x1145d6){return function(_0x19f122){if(_0x19f122){var _0x4c3d24=typeof _0x1145d6[_0x5a55('0x12')]===_0x5a55('0x13')&&typeof _0x1145d6[_0x5a55('0x14')]===_0x5a55('0x13');var _0x24bb71=_0x19f122[_0x5a55('0x15')];var _0x26340f=_0x4c3d24?0x0:_0x1145d6[_0x5a55('0x12')];var _0x2840a5=_0x4c3d24?_0x19f122[_0x5a55('0x15')]:_0x1145d6[_0x5a55('0x12')]+_0x1145d6[_0x5a55('0x14')];var _0x55044e;if(_0x2840a5>=_0x24bb71){_0x2840a5=_0x24bb71;_0x55044e=0xc8;}else{_0x55044e=0xce;}_0x1c59d1[_0x5a55('0x10')](_0x55044e);return _0x1c59d1[_0x5a55('0x16')](_0x5a55('0x17'),_0x26340f+'-'+_0x2840a5+'/'+_0x24bb71)['json'](_0x19f122);}return null;};}function saveUpdates(_0x44b7f1){return function(_0x23894e){if(_0x23894e){return _0x23894e[_0x5a55('0x18')](_0x44b7f1)['then'](function(_0x580204){return _0x580204;});}return null;};}function removeEntity(_0x2ac709){return function(_0x2731a8){if(_0x2731a8){return _0x2731a8[_0x5a55('0x19')]()[_0x5a55('0x1a')](function(){_0x2ac709[_0x5a55('0x10')](0xcc)[_0x5a55('0x1b')]();});}};}function handleEntityNotFound(_0x46fc4d){return function(_0x5a2016){if(!_0x5a2016){_0x46fc4d['sendStatus'](0x194);}return _0x5a2016;};}function handleError(_0x17df30,_0x2d8c12){_0x2d8c12=_0x2d8c12||0x1f4;return function(_0x2ea072){logger['error'](_0x2ea072[_0x5a55('0x1c')]);if(_0x2ea072[_0x5a55('0x1d')]){delete _0x2ea072[_0x5a55('0x1d')];}_0x17df30[_0x5a55('0x10')](_0x2d8c12)[_0x5a55('0x1e')](_0x2ea072);};}exports[_0x5a55('0x1f')]=function(_0x144929,_0x130958){var _0x36fd33={};var _0x55838e=_[_0x5a55('0x20')](db[_0x5a55('0x21')][_0x5a55('0x22')],function(_0x3f41a0){return{'name':_0x3f41a0[_0x5a55('0x23')],'type':_0x3f41a0[_0x5a55('0x24')][_0x5a55('0x25')]};});_0x36fd33=qs[_0x5a55('0x26')](_0x55838e,_0x144929);return interaction[_0x5a55('0x27')](_0x5a55('0x28'),_0x144929['query'],_0x144929[_0x5a55('0x29')],_0x36fd33,_0x55838e)[_0x5a55('0x1a')](respondWithFilteredResult(_0x130958,_0x36fd33))[_0x5a55('0x2a')](handleError(_0x130958,null));};exports[_0x5a55('0x2b')]=function(_0x18d1f4,_0x9edf42){var _0x985bf={'raw':![],'where':{'id':_0x18d1f4[_0x5a55('0x2c')]['id']}},_0x5f31b6={};_0x5f31b6['model']=_[_0x5a55('0x2d')](db[_0x5a55('0x21')][_0x5a55('0x22')]);_0x5f31b6[_0x5a55('0x2e')]=_[_0x5a55('0x2d')](_0x18d1f4[_0x5a55('0x2e')]);_0x5f31b6[_0x5a55('0x2f')]=_[_0x5a55('0x30')](_0x5f31b6[_0x5a55('0x31')],_0x5f31b6[_0x5a55('0x2e')]);_0x985bf[_0x5a55('0x32')]=_[_0x5a55('0x30')](_0x5f31b6[_0x5a55('0x31')],qs[_0x5a55('0x33')](_0x18d1f4[_0x5a55('0x2e')][_0x5a55('0x33')]));_0x985bf[_0x5a55('0x32')]=_0x985bf['attributes']['length']?_0x985bf[_0x5a55('0x32')]:_0x5f31b6[_0x5a55('0x31')];if(_0x18d1f4[_0x5a55('0x2e')][_0x5a55('0x34')]){_0x985bf[_0x5a55('0x35')]=[{'all':!![]}];}_0x985bf=_['merge']({},_0x985bf,_0x18d1f4[_0x5a55('0x36')]);return db['FaxInteraction'][_0x5a55('0x37')](_0x985bf)[_0x5a55('0x1a')](handleEntityNotFound(_0x9edf42,null))[_0x5a55('0x1a')](respondWithResult(_0x9edf42,null))['catch'](handleError(_0x9edf42,null));};exports[_0x5a55('0x38')]=function(_0x4e2087,_0x3ab0bc){return db[_0x5a55('0x21')][_0x5a55('0x38')](_0x4e2087['body'],{})[_0x5a55('0x1a')](respondWithResult(_0x3ab0bc,0xc9))[_0x5a55('0x2a')](handleError(_0x3ab0bc,null));};exports[_0x5a55('0x18')]=function(_0x557804,_0x31f3b8){if(_0x557804[_0x5a55('0x39')]['id']){delete _0x557804['body']['id'];}return db[_0x5a55('0x21')]['find']({'where':{'id':_0x557804[_0x5a55('0x2c')]['id']}})[_0x5a55('0x1a')](handleEntityNotFound(_0x31f3b8,null))[_0x5a55('0x1a')](saveUpdates(_0x557804[_0x5a55('0x39')],null))[_0x5a55('0x1a')](respondWithResult(_0x31f3b8,null))['catch'](handleError(_0x31f3b8,null));};exports[_0x5a55('0x19')]=function(_0x11513d,_0x45a1de){return db[_0x5a55('0x21')][_0x5a55('0x37')]({'where':{'id':_0x11513d['params']['id']}})['then'](handleEntityNotFound(_0x45a1de,null))[_0x5a55('0x1a')](removeEntity(_0x45a1de,null))['catch'](handleError(_0x45a1de,null));};exports[_0x5a55('0x3a')]=function(_0x3aeaaf,_0x4d46fc){return db[_0x5a55('0x21')][_0x5a55('0x3a')]()[_0x5a55('0x1a')](respondWithResult(_0x4d46fc,null))[_0x5a55('0x2a')](handleError(_0x4d46fc,null));};exports[_0x5a55('0x3b')]=function(_0x1ae505,_0x24b4ea){return db['FaxMessage'][_0x5a55('0x37')]({'where':{'id':_0x1ae505[_0x5a55('0x2c')]['id']}})['then'](handleEntityNotFound(_0x24b4ea,null))[_0x5a55('0x1a')](function(_0x2748f9){if(_0x2748f9){return _0x2748f9['addMessage'](_0x1ae505[_0x5a55('0x39')][_0x5a55('0x3c')],_[_0x5a55('0x3d')](_0x1ae505[_0x5a55('0x39')],[_0x5a55('0x3c'),'id'])||{});}})['then'](respondWithResult(_0x24b4ea,null))[_0x5a55('0x2a')](handleError(_0x24b4ea,null));};exports['getMessages']=function(_0x2fe660,_0x15deb9){var _0x35aeb={'raw':![],'where':{}};var _0x17dc57={};var _0x1b66fd={'count':0x0,'rows':[]};return db[_0x5a55('0x21')]['findOne']({'where':{'id':_0x2fe660[_0x5a55('0x2c')]['id']}})[_0x5a55('0x1a')](handleEntityNotFound(_0x15deb9,null))[_0x5a55('0x1a')](function(_0x257369){if(_0x257369){_0x17dc57['model']=_['keys'](db[_0x5a55('0x3e')][_0x5a55('0x22')]);_0x17dc57[_0x5a55('0x2e')]=_[_0x5a55('0x2d')](_0x2fe660[_0x5a55('0x2e')]);_0x17dc57[_0x5a55('0x2f')]=_[_0x5a55('0x30')](_0x17dc57[_0x5a55('0x31')],_0x17dc57[_0x5a55('0x2e')]);_0x35aeb[_0x5a55('0x32')]=_['intersection'](_0x17dc57[_0x5a55('0x31')],qs[_0x5a55('0x33')](_0x2fe660['query'][_0x5a55('0x33')]));_0x35aeb[_0x5a55('0x32')]=_0x35aeb[_0x5a55('0x32')]['length']?_0x35aeb['attributes']:_0x17dc57[_0x5a55('0x31')];if(!_0x2fe660[_0x5a55('0x2e')][_0x5a55('0x3f')](_0x5a55('0x40'))){_0x35aeb[_0x5a55('0x14')]=qs[_0x5a55('0x14')](_0x2fe660[_0x5a55('0x2e')][_0x5a55('0x14')]);_0x35aeb[_0x5a55('0x12')]=qs['offset'](_0x2fe660[_0x5a55('0x2e')][_0x5a55('0x12')]);}_0x35aeb[_0x5a55('0x41')]=qs[_0x5a55('0x42')](_0x2fe660[_0x5a55('0x2e')][_0x5a55('0x42')]);_0x35aeb[_0x5a55('0x43')]=qs[_0x5a55('0x2f')](_[_0x5a55('0x44')](_0x2fe660[_0x5a55('0x2e')],_0x17dc57['filters']));_0x35aeb[_0x5a55('0x43')][_0x5a55('0x45')]=_0x257369['id'];if(_0x2fe660[_0x5a55('0x2e')][_0x5a55('0x46')]){_0x35aeb[_0x5a55('0x43')]=_[_0x5a55('0x47')](_0x35aeb[_0x5a55('0x43')],{'$or':_[_0x5a55('0x20')](_0x35aeb[_0x5a55('0x32')],function(_0x1fa75a){var _0x3479ed={};_0x3479ed[_0x1fa75a]={'$like':'%'+_0x2fe660['query']['filter']+'%'};return _0x3479ed;})});}if(_0x2fe660[_0x5a55('0x2e')]['$gte']){var _0x256609=_0x2fe660['query'][_0x5a55('0x48')][_0x5a55('0x49')](',');var _0x33cf12={};_0x33cf12[_0x256609[0x0]]={'$gte':moment(_0x256609[0x1])['format'](_0x5a55('0x4a'))};_0x35aeb[_0x5a55('0x43')]=_[_0x5a55('0x47')](_0x35aeb['where'],_0x33cf12);}_0x35aeb=_[_0x5a55('0x47')]({},_0x35aeb,_0x2fe660[_0x5a55('0x36')]);return db[_0x5a55('0x3e')]['count']({'where':_0x35aeb[_0x5a55('0x43')]})[_0x5a55('0x1a')](function(_0x39f8c0){_0x1b66fd[_0x5a55('0x15')]=_0x39f8c0;if(_0x2fe660[_0x5a55('0x2e')][_0x5a55('0x34')]){_0x35aeb['include']=[{'all':!![]}];}return db[_0x5a55('0x3e')][_0x5a55('0x27')](_0x35aeb);})[_0x5a55('0x1a')](function(_0x3e875d){_0x1b66fd[_0x5a55('0x4b')]=_0x3e875d;return _0x1b66fd;});}})[_0x5a55('0x1a')](respondWithFilteredResult(_0x15deb9,_0x35aeb))['catch'](handleError(_0x15deb9,null));};exports[_0x5a55('0x4c')]=function(_0x12c26e,_0x1684dd){return db[_0x5a55('0x21')][_0x5a55('0x37')]({'where':{'id':_0x12c26e[_0x5a55('0x2c')]['id']}})[_0x5a55('0x1a')](handleEntityNotFound(_0x1684dd,null))[_0x5a55('0x1a')](function(_0x1d7a97){if(_0x1d7a97){return _0x1d7a97[_0x5a55('0x4d')](_0x12c26e['body'][_0x5a55('0x3c')],_[_0x5a55('0x3d')](_0x12c26e[_0x5a55('0x39')],[_0x5a55('0x3c'),'id'])||{})[_0x5a55('0x4e')](function(){return db['Tag']['findAll']({'attributes':['id',_0x5a55('0x1d'),_0x5a55('0x4f')],'where':{'id':_0x12c26e[_0x5a55('0x39')][_0x5a55('0x3c')]}});})[_0x5a55('0x1a')](function(_0x7f3355){socket[_0x5a55('0x50')](_0x5a55('0x51'),{'id':Number(_0x12c26e[_0x5a55('0x2c')]['id']),'tags':_0x7f3355||[]});return{'id':Number(_0x12c26e[_0x5a55('0x2c')]['id']),'tags':_0x7f3355||[]};});}})['then'](respondWithResult(_0x1684dd,null))['catch'](handleError(_0x1684dd,null));};exports[_0x5a55('0x52')]=function(_0x3ea074,_0x5eb0e7){return db[_0x5a55('0x21')][_0x5a55('0x37')]({'where':{'id':_0x3ea074[_0x5a55('0x2c')]['id']}})['then'](handleEntityNotFound(_0x5eb0e7,null))[_0x5a55('0x1a')](function(_0xf165fb){if(_0xf165fb){return _0xf165fb['removeTags'](_0x3ea074[_0x5a55('0x2e')][_0x5a55('0x3c')]);}})[_0x5a55('0x1a')](respondWithStatusCode(_0x5eb0e7,null))['catch'](handleError(_0x5eb0e7,null));};exports[_0x5a55('0x53')]=function(_0x2fa3ee,_0x2ef71d){var _0x4e75de=moment()[_0x5a55('0x54')]()[_0x5a55('0x55')]();var _0x4d306d=path[_0x5a55('0x56')](config[_0x5a55('0x57')],_0x5a55('0x58'),_0x5a55('0x59'),_0x5a55('0x5a'));var _0x483d42=path[_0x5a55('0x56')](config[_0x5a55('0x57')],_0x5a55('0x58'),_0x5a55('0x59'),_0x5a55('0x5b'));var _0x13c754=path['join'](_0x4d306d,_0x4e75de);var _0x14ecc1=util[_0x5a55('0x5c')](_0x5a55('0x5d'),_0x2fa3ee[_0x5a55('0x2c')]['id'],_0x4e75de);var _0x69f0c6=path[_0x5a55('0x56')](_0x4d306d,_0x14ecc1);var _0x3f5c17=[];_0x3f5c17[_0x5a55('0x5e')]({'model':db[_0x5a55('0x5f')],'as':'Attachment','raw':!![]});var _0x166f36=[{'model':db[_0x5a55('0x3e')],'as':'Messages','attributes':['id',_0x5a55('0x39'),_0x5a55('0x60')],'include':_0x3f5c17}];return db[_0x5a55('0x21')][_0x5a55('0x37')]({'where':{'id':_0x2fa3ee[_0x5a55('0x2c')]['id']},'include':_0x166f36})[_0x5a55('0x1a')](handleEntityNotFound(_0x2ef71d,null))[_0x5a55('0x1a')](function(_0x4ed7a8){if(_0x4ed7a8&&_0x4ed7a8[_0x5a55('0x61')]){var _0x5c338f=_0x4ed7a8[_0x5a55('0x62')]({'plain':!![]});fs[_0x5a55('0x63')](_0x13c754);for(var _0x2e76f3=0x0;_0x2e76f3<_0x5c338f[_0x5a55('0x61')]['length'];_0x2e76f3++){var _0x450c48=_0x5c338f[_0x5a55('0x61')][_0x2e76f3][_0x5a55('0x5f')];if(_0x450c48){var _0x34fc76=path[_0x5a55('0x56')](_0x483d42,_0x450c48[_0x5a55('0x64')]);if(fs['existsSync'](_0x34fc76)){fs[_0x5a55('0x65')](_0x34fc76)[_0x5a55('0x66')](fs[_0x5a55('0x67')](path[_0x5a55('0x56')](_0x13c754,_0x450c48[_0x5a55('0x64')])));}}}return BPromise['resolve']()[_0x5a55('0x1a')](function(){return new BPromise(function(_0x330568,_0x1678e1){zipdir(_0x13c754,{'saveTo':_0x69f0c6},function(_0x55ce82,_0x346fc0){if(_0x55ce82)return _0x1678e1(_0x55ce82);return _0x330568(_0x346fc0);});})[_0x5a55('0x1a')](function(){return new BPromise(function(_0x493db4,_0x1619b7){rimraf(_0x13c754,function(_0x4392f4){if(_0x4392f4)_0x1619b7(_0x4392f4);return _0x493db4();});});})[_0x5a55('0x1a')](function(){return _0x2ef71d[_0x5a55('0x53')](_0x69f0c6,_0x14ecc1,function(_0x2c671a){if(_0x2c671a){console[_0x5a55('0x68')](_0x5a55('0x69'),_0x2c671a);}else{fs[_0x5a55('0x6a')](_0x69f0c6);}});});});}else{return _0x2ef71d[_0x5a55('0xf')](0xc8);}})['catch'](handleError(_0x2ef71d,null));}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.events.js b/server/api/faxInteraction/faxInteraction.events.js index 072ea8a..f75dfd2 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 _0x47c4=['findAll','setDataValue','unreadMessages','length','emit','catch','hasOwnProperty','hook','exports','events','../../mysqldb','FaxInteraction','FaxMessage','setMaxListeners','update','remove','getUsers','then','map'];(function(_0x454d39,_0x60939a){var _0xb167c4=function(_0x57c691){while(--_0x57c691){_0x454d39['push'](_0x454d39['shift']());}};_0xb167c4(++_0x60939a);}(_0x47c4,0x7b));var _0x447c=function(_0x43b5a7,_0xf5e3d6){_0x43b5a7=_0x43b5a7-0x0;var _0x5461fe=_0x47c4[_0x43b5a7];return _0x5461fe;};'use strict';var EventEmitter=require(_0x447c('0x0'));var FaxInteraction=require(_0x447c('0x1'))['db'][_0x447c('0x2')];var FaxMessage=require('../../mysqldb')['db'][_0x447c('0x3')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0x447c('0x4')](0x0);var events={'afterCreate':'save','afterUpdate':_0x447c('0x5'),'afterDestroy':_0x447c('0x6')};function emitEvent(_0x3de9a9){return function(_0x80fc61,_0x5cdc87,_0xd97edd){_0x80fc61[_0x447c('0x7')]({'attributes':['id'],'raw':!![]})[_0x447c('0x8')](function(_0x354e5a){_0x80fc61['setDataValue']('Users',_0x354e5a[_0x447c('0x9')](function(_0x260e68){return{'id':_0x260e68['id']};}));return FaxMessage[_0x447c('0xa')]({'where':{'FaxInteractionId':_0x80fc61['id'],'direction':'in','read':![]},'raw':!![]});})[_0x447c('0x8')](function(_0x3dd879){_0x80fc61[_0x447c('0xb')](_0x447c('0xc'),_0x3dd879[_0x447c('0xd')]);FaxInteractionEvents['emit'](_0x3de9a9+':'+_0x80fc61['id'],_0x80fc61);FaxInteractionEvents[_0x447c('0xe')](_0x3de9a9,_0x80fc61);_0xd97edd(null);})[_0x447c('0xf')](_0xd97edd(null));};}for(var e in events){if(events[_0x447c('0x10')](e)){var event=events[e];FaxInteraction[_0x447c('0x11')](e,emitEvent(event));}}module[_0x447c('0x12')]=FaxInteractionEvents; \ No newline at end of file +var _0x502e=['then','unreadMessages','length','emit','catch','hook','exports','events','../../mysqldb','FaxInteraction','FaxMessage','setMaxListeners','save','update','remove','getUsers','setDataValue','Users','map'];(function(_0x47361f,_0x3d25f4){var _0x231a00=function(_0x30f45f){while(--_0x30f45f){_0x47361f['push'](_0x47361f['shift']());}};_0x231a00(++_0x3d25f4);}(_0x502e,0x79));var _0xe502=function(_0x9fd1be,_0x168c55){_0x9fd1be=_0x9fd1be-0x0;var _0x5b2c8b=_0x502e[_0x9fd1be];return _0x5b2c8b;};'use strict';var EventEmitter=require(_0xe502('0x0'));var FaxInteraction=require(_0xe502('0x1'))['db'][_0xe502('0x2')];var FaxMessage=require(_0xe502('0x1'))['db'][_0xe502('0x3')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0xe502('0x4')](0x0);var events={'afterCreate':_0xe502('0x5'),'afterUpdate':_0xe502('0x6'),'afterDestroy':_0xe502('0x7')};function emitEvent(_0x519bb3){return function(_0x579f34,_0x5ea6e5,_0x4c740c){_0x579f34[_0xe502('0x8')]({'attributes':['id'],'raw':!![]})['then'](function(_0x47bc14){_0x579f34[_0xe502('0x9')](_0xe502('0xa'),_0x47bc14[_0xe502('0xb')](function(_0x617381){return{'id':_0x617381['id']};}));return FaxMessage['findAll']({'where':{'FaxInteractionId':_0x579f34['id'],'direction':'in','read':![]},'raw':!![]});})[_0xe502('0xc')](function(_0x5cafe0){_0x579f34[_0xe502('0x9')](_0xe502('0xd'),_0x5cafe0[_0xe502('0xe')]);FaxInteractionEvents[_0xe502('0xf')](_0x519bb3+':'+_0x579f34['id'],_0x579f34);FaxInteractionEvents[_0xe502('0xf')](_0x519bb3,_0x579f34);_0x4c740c(null);})[_0xe502('0x10')](_0x4c740c(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxInteraction[_0xe502('0x11')](e,emitEvent(event));}}module[_0xe502('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 33b845f..a14d104 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 _0x88f3=['define','fax_interactions','closedAt','format','util','moment','bluebird','request-promise','path','rimraf','../../config/environment','./faxInteraction.attributes'];(function(_0x240d29,_0x293207){var _0x1828e5=function(_0x5d0153){while(--_0x5d0153){_0x240d29['push'](_0x240d29['shift']());}};_0x1828e5(++_0x293207);}(_0x88f3,0x184));var _0x388f=function(_0x42150b,_0x46adaa){_0x42150b=_0x42150b-0x0;var _0x306f98=_0x88f3[_0x42150b];return _0x306f98;};'use strict';var _=require('lodash');var util=require(_0x388f('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x388f('0x1'));var BPromise=require(_0x388f('0x2'));var rp=require(_0x388f('0x3'));var fs=require('fs');var path=require(_0x388f('0x4'));var rimraf=require(_0x388f('0x5'));var config=require(_0x388f('0x6'));var attributes=require(_0x388f('0x7'));module['exports']=function(_0x42ed88,_0x2128af){return _0x42ed88[_0x388f('0x8')]('FaxInteraction',attributes,{'tableName':_0x388f('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x4be3a8,_0x4ac36c,_0x57d503){if(_0x4be3a8['changed']('closed')){_0x4be3a8[_0x388f('0xa')]=moment()[_0x388f('0xb')]('YYYY-MM-DD\x20HH:mm:ss');}_0x57d503(null,_0x4be3a8);}}});}; \ No newline at end of file +var _0x278b=['bluebird','path','rimraf','../../config/environment','./faxInteraction.attributes','define','fax_interactions','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','util','../../config/logger','api','moment'];(function(_0x13a7d0,_0xe26397){var _0x441364=function(_0x4248f4){while(--_0x4248f4){_0x13a7d0['push'](_0x13a7d0['shift']());}};_0x441364(++_0xe26397);}(_0x278b,0xec));var _0xb278=function(_0x3f88bc,_0xe38cf5){_0x3f88bc=_0x3f88bc-0x0;var _0x4df1c4=_0x278b[_0x3f88bc];return _0x4df1c4;};'use strict';var _=require('lodash');var util=require(_0xb278('0x0'));var logger=require(_0xb278('0x1'))(_0xb278('0x2'));var moment=require(_0xb278('0x3'));var BPromise=require(_0xb278('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb278('0x5'));var rimraf=require(_0xb278('0x6'));var config=require(_0xb278('0x7'));var attributes=require(_0xb278('0x8'));module['exports']=function(_0x22455c,_0x189349){return _0x22455c[_0xb278('0x9')]('FaxInteraction',attributes,{'tableName':_0xb278('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x3a3a92,_0x4352ad,_0x386ed5){if(_0x3a3a92[_0xb278('0xb')](_0xb278('0xc'))){_0x3a3a92[_0xb278('0xd')]=moment()[_0xb278('0xe')](_0xb278('0xf'));}_0x386ed5(null,_0x3a3a92);}}});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.rpc.js b/server/api/faxInteraction/faxInteraction.rpc.js index c0364bd..c224fe3 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 _0xeb59=['stringify','error','code','message','result','catch','UpdateFaxInteraction','FaxInteraction','update','options','where','limit','find','addTags','body','ids','spread','AddTags','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','socket.io-emitter','./faxInteraction.socket','register','then','info','FaxInteraction,\x20%s,\x20%s','request\x20sent','debug','FaxInteraction,\x20%s,\x20%s,\x20%s'];(function(_0x5d5c49,_0x528f94){var _0x41cb72=function(_0x4fe8e2){while(--_0x4fe8e2){_0x5d5c49['push'](_0x5d5c49['shift']());}};_0x41cb72(++_0x528f94);}(_0xeb59,0x108));var _0x9eb5=function(_0x5d1044,_0x18f656){_0x5d1044=_0x5d1044-0x0;var _0x3cd90e=_0xeb59[_0x5d1044];return _0x3cd90e;};'use strict';var _=require(_0x9eb5('0x0'));var util=require('util');var moment=require(_0x9eb5('0x1'));var BPromise=require(_0x9eb5('0x2'));var rs=require(_0x9eb5('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9eb5('0x4'))['db'];var utils=require(_0x9eb5('0x5'));var logger=require(_0x9eb5('0x6'))(_0x9eb5('0x7'));var config=require(_0x9eb5('0x8'));var jayson=require(_0x9eb5('0x9'));var client=jayson[_0x9eb5('0xa')][_0x9eb5('0xb')]({'port':0x232a});config['redis']=_[_0x9eb5('0xc')](config[_0x9eb5('0xd')],{'host':'localhost','port':0x18eb});var socket=require(_0x9eb5('0xe'))(new Redis(config['redis']));require(_0x9eb5('0xf'))[_0x9eb5('0x10')](socket);function respondWithRpcPromise(_0x8caedc,_0x2afb04,_0x2980fa){return new BPromise(function(_0x4689cf,_0x5038de){return client['request'](_0x8caedc,_0x2980fa)[_0x9eb5('0x11')](function(_0x175f91){logger[_0x9eb5('0x12')](_0x9eb5('0x13'),_0x2afb04,_0x9eb5('0x14'));logger[_0x9eb5('0x15')](_0x9eb5('0x16'),_0x2afb04,_0x9eb5('0x14'),JSON[_0x9eb5('0x17')](_0x175f91));if(_0x175f91[_0x9eb5('0x18')]){if(_0x175f91[_0x9eb5('0x18')][_0x9eb5('0x19')]===0x1f4){logger[_0x9eb5('0x18')](_0x9eb5('0x13'),_0x2afb04,_0x175f91[_0x9eb5('0x18')]['message']);return _0x5038de(_0x175f91['error'][_0x9eb5('0x1a')]);}logger['error']('FaxInteraction,\x20%s,\x20%s',_0x2afb04,_0x175f91[_0x9eb5('0x18')]['message']);return _0x4689cf(_0x175f91[_0x9eb5('0x18')][_0x9eb5('0x1a')]);}else{logger['info'](_0x9eb5('0x13'),_0x2afb04,_0x9eb5('0x14'));_0x4689cf(_0x175f91[_0x9eb5('0x1b')][_0x9eb5('0x1a')]);}})[_0x9eb5('0x1c')](function(_0xec54fa){logger['error'](_0x9eb5('0x13'),_0x2afb04,_0xec54fa);_0x5038de(_0xec54fa);});});}exports[_0x9eb5('0x1d')]=function(_0x5f2321){var _0x257844=this;return new Promise(function(_0x118995,_0x1e3985){return db[_0x9eb5('0x1e')][_0x9eb5('0x1f')](_0x5f2321['body'],{'raw':_0x5f2321[_0x9eb5('0x20')]?_0x5f2321[_0x9eb5('0x20')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5f2321[_0x9eb5('0x20')]?_0x5f2321[_0x9eb5('0x20')][_0x9eb5('0x21')]||null:null,'attributes':_0x5f2321[_0x9eb5('0x20')]?_0x5f2321['options']['attributes']||null:null,'limit':_0x5f2321[_0x9eb5('0x20')]?_0x5f2321[_0x9eb5('0x20')][_0x9eb5('0x22')]||null:null})[_0x9eb5('0x11')](function(_0xa3dade){logger[_0x9eb5('0x12')](_0x9eb5('0x1d'),_0x5f2321);logger[_0x9eb5('0x15')](_0x9eb5('0x1d'),_0x5f2321,JSON[_0x9eb5('0x17')](_0xa3dade));_0x118995(_0xa3dade);})[_0x9eb5('0x1c')](function(_0x42b1fd){logger['error'](_0x9eb5('0x1d'),_0x42b1fd['message'],_0x5f2321);_0x1e3985(_0x257844[_0x9eb5('0x18')](0x1f4,_0x42b1fd['message']));});});};exports['AddTagsToFaxInteraction']=function(_0x59fd9e){return new Promise(function(_0x4b083f,_0x275960){return db['FaxInteraction'][_0x9eb5('0x23')]({'where':_0x59fd9e[_0x9eb5('0x20')]?_0x59fd9e[_0x9eb5('0x20')][_0x9eb5('0x21')]||null:null})[_0x9eb5('0x11')](function(_0x22de65){if(_0x22de65){return _0x22de65[_0x9eb5('0x24')](_0x59fd9e[_0x9eb5('0x25')][_0x9eb5('0x26')],_['omit'](_0x59fd9e[_0x9eb5('0x25')],['ids','id'])||{});}})[_0x9eb5('0x27')](function(_0x52fab2){logger[_0x9eb5('0x12')](_0x9eb5('0x28'),_0x59fd9e);logger['debug']('AddTags',_0x59fd9e,JSON[_0x9eb5('0x17')](_0x52fab2));_0x4b083f(_0x52fab2);})['catch'](function(_0x423c1d){logger['error'](_0x9eb5('0x28'),_0x423c1d[_0x9eb5('0x1a')],_0x59fd9e);_0x275960(_this[_0x9eb5('0x18')](0x1f4,_0x423c1d['message']));});});}; \ No newline at end of file +var _0x8c5a=['update','body','options','raw','where','attributes','limit','debug','stringify','catch','AddTagsToFaxInteraction','ids','omit','AddTags','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','localhost','socket.io-emitter','./faxInteraction.socket','register','request','then','info','FaxInteraction,\x20%s,\x20%s','request\x20sent','FaxInteraction,\x20%s,\x20%s,\x20%s','error','code','message','UpdateFaxInteraction','FaxInteraction'];(function(_0x596778,_0x33dbb1){var _0x34e022=function(_0x4f71d0){while(--_0x4f71d0){_0x596778['push'](_0x596778['shift']());}};_0x34e022(++_0x33dbb1);}(_0x8c5a,0x126));var _0xa8c5=function(_0x3c14a1,_0x5a6937){_0x3c14a1=_0x3c14a1-0x0;var _0x1122a7=_0x8c5a[_0x3c14a1];return _0x1122a7;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xa8c5('0x0'));var BPromise=require(_0xa8c5('0x1'));var rs=require(_0xa8c5('0x2'));var fs=require('fs');var Redis=require(_0xa8c5('0x3'));var db=require(_0xa8c5('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xa8c5('0x5'))(_0xa8c5('0x6'));var config=require(_0xa8c5('0x7'));var jayson=require(_0xa8c5('0x8'));var client=jayson[_0xa8c5('0x9')]['http']({'port':0x232a});config[_0xa8c5('0xa')]=_['defaults'](config['redis'],{'host':_0xa8c5('0xb'),'port':0x18eb});var socket=require(_0xa8c5('0xc'))(new Redis(config[_0xa8c5('0xa')]));require(_0xa8c5('0xd'))[_0xa8c5('0xe')](socket);function respondWithRpcPromise(_0x377ce2,_0x351155,_0x3b8ba3){return new BPromise(function(_0x2de38e,_0x3bd34e){return client[_0xa8c5('0xf')](_0x377ce2,_0x3b8ba3)[_0xa8c5('0x10')](function(_0x153443){logger[_0xa8c5('0x11')](_0xa8c5('0x12'),_0x351155,_0xa8c5('0x13'));logger['debug'](_0xa8c5('0x14'),_0x351155,_0xa8c5('0x13'),JSON['stringify'](_0x153443));if(_0x153443[_0xa8c5('0x15')]){if(_0x153443[_0xa8c5('0x15')][_0xa8c5('0x16')]===0x1f4){logger['error'](_0xa8c5('0x12'),_0x351155,_0x153443[_0xa8c5('0x15')][_0xa8c5('0x17')]);return _0x3bd34e(_0x153443[_0xa8c5('0x15')][_0xa8c5('0x17')]);}logger[_0xa8c5('0x15')](_0xa8c5('0x12'),_0x351155,_0x153443[_0xa8c5('0x15')][_0xa8c5('0x17')]);return _0x2de38e(_0x153443[_0xa8c5('0x15')][_0xa8c5('0x17')]);}else{logger[_0xa8c5('0x11')](_0xa8c5('0x12'),_0x351155,_0xa8c5('0x13'));_0x2de38e(_0x153443['result'][_0xa8c5('0x17')]);}})['catch'](function(_0x1503f6){logger['error'](_0xa8c5('0x12'),_0x351155,_0x1503f6);_0x3bd34e(_0x1503f6);});});}exports[_0xa8c5('0x18')]=function(_0x307bf8){var _0x4d1eb7=this;return new Promise(function(_0x285f1b,_0x530448){return db[_0xa8c5('0x19')][_0xa8c5('0x1a')](_0x307bf8[_0xa8c5('0x1b')],{'raw':_0x307bf8[_0xa8c5('0x1c')]?_0x307bf8['options'][_0xa8c5('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x307bf8[_0xa8c5('0x1c')]?_0x307bf8[_0xa8c5('0x1c')][_0xa8c5('0x1e')]||null:null,'attributes':_0x307bf8[_0xa8c5('0x1c')]?_0x307bf8[_0xa8c5('0x1c')][_0xa8c5('0x1f')]||null:null,'limit':_0x307bf8['options']?_0x307bf8[_0xa8c5('0x1c')][_0xa8c5('0x20')]||null:null})[_0xa8c5('0x10')](function(_0x39b693){logger[_0xa8c5('0x11')](_0xa8c5('0x18'),_0x307bf8);logger[_0xa8c5('0x21')](_0xa8c5('0x18'),_0x307bf8,JSON[_0xa8c5('0x22')](_0x39b693));_0x285f1b(_0x39b693);})[_0xa8c5('0x23')](function(_0x583517){logger['error'](_0xa8c5('0x18'),_0x583517['message'],_0x307bf8);_0x530448(_0x4d1eb7[_0xa8c5('0x15')](0x1f4,_0x583517['message']));});});};exports[_0xa8c5('0x24')]=function(_0x3dc011){return new Promise(function(_0x37a149,_0x37587e){return db[_0xa8c5('0x19')]['find']({'where':_0x3dc011['options']?_0x3dc011['options']['where']||null:null})[_0xa8c5('0x10')](function(_0x249316){if(_0x249316){return _0x249316['addTags'](_0x3dc011['body'][_0xa8c5('0x25')],_[_0xa8c5('0x26')](_0x3dc011[_0xa8c5('0x1b')],[_0xa8c5('0x25'),'id'])||{});}})['spread'](function(_0x13e595){logger[_0xa8c5('0x11')](_0xa8c5('0x27'),_0x3dc011);logger['debug'](_0xa8c5('0x27'),_0x3dc011,JSON[_0xa8c5('0x22')](_0x13e595));_0x37a149(_0x13e595);})['catch'](function(_0x2f3290){logger[_0xa8c5('0x15')](_0xa8c5('0x27'),_0x2f3290[_0xa8c5('0x17')],_0x3dc011);_0x37587e(_this['error'](0x1f4,_0x2f3290['message']));});});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.socket.js b/server/api/faxInteraction/faxInteraction.socket.js index 1c8f4f0..036acb0 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 _0xeff4=['./faxInteraction.events','remove','update','removeListener','length','faxInteraction:'];(function(_0x5a6961,_0xd41ca6){var _0x4af0a6=function(_0x1201fe){while(--_0x1201fe){_0x5a6961['push'](_0x5a6961['shift']());}};_0x4af0a6(++_0xd41ca6);}(_0xeff4,0xcc));var _0x4eff=function(_0x5f1cf8,_0x5e0923){_0x5f1cf8=_0x5f1cf8-0x0;var _0x27d0fa=_0xeff4[_0x5f1cf8];return _0x27d0fa;};'use strict';var FaxInteractionEvents=require(_0x4eff('0x0'));var events=['save',_0x4eff('0x1'),_0x4eff('0x2')];function createListener(_0x133c44,_0x1b43d1){return function(_0x48cdeb){_0x1b43d1['emit'](_0x133c44,_0x48cdeb);};}function removeListener(_0x530b16,_0x2cc132){return function(){FaxInteractionEvents[_0x4eff('0x3')](_0x530b16,_0x2cc132);};}exports['register']=function(_0x1e6139){for(var _0x20087b=0x0,_0x9ac0f8=events[_0x4eff('0x4')];_0x20087b<_0x9ac0f8;_0x20087b++){var _0xc32c70=events[_0x20087b];var _0x20d1e8=createListener(_0x4eff('0x5')+_0xc32c70,_0x1e6139);FaxInteractionEvents['on'](_0xc32c70,_0x20d1e8);}}; \ No newline at end of file +var _0x7005=['faxInteraction:','./faxInteraction.events','save','remove','emit','removeListener','register'];(function(_0x337dd9,_0x54e3f3){var _0x20f4fc=function(_0x4230de){while(--_0x4230de){_0x337dd9['push'](_0x337dd9['shift']());}};_0x20f4fc(++_0x54e3f3);}(_0x7005,0x71));var _0x5700=function(_0x5218ce,_0x17ac96){_0x5218ce=_0x5218ce-0x0;var _0x428fe3=_0x7005[_0x5218ce];return _0x428fe3;};'use strict';var FaxInteractionEvents=require(_0x5700('0x0'));var events=[_0x5700('0x1'),_0x5700('0x2'),'update'];function createListener(_0x222e7d,_0x28dcee){return function(_0x1e2d92){_0x28dcee[_0x5700('0x3')](_0x222e7d,_0x1e2d92);};}function removeListener(_0x545464,_0x4fd02b){return function(){FaxInteractionEvents[_0x5700('0x4')](_0x545464,_0x4fd02b);};}exports[_0x5700('0x5')]=function(_0x1c6a95){for(var _0x3730ec=0x0,_0x400c9a=events['length'];_0x3730ec<_0x400c9a;_0x3730ec++){var _0x59cf01=events[_0x3730ec];var _0x45e241=createListener(_0x5700('0x6')+_0x59cf01,_0x1c6a95);FaxInteractionEvents['on'](_0x59cf01,_0x45e241);}}; \ No newline at end of file diff --git a/server/api/faxInteraction/index.js b/server/api/faxInteraction/index.js index 9e1cfad..e8044dd 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 _0xadae=['get','isAuthenticated','/describe','describe','/:id','show','/:id/messages','getMessages','/:id/download','post','create','addMessage','/:id/tags','tracked','faxinteraction:addtags','fax','faxinteraction:update','update','delete','exports','multer','util','path','../../config/environment'];(function(_0x3fc343,_0x2c8627){var _0x14e58b=function(_0x227422){while(--_0x227422){_0x3fc343['push'](_0x3fc343['shift']());}};_0x14e58b(++_0x2c8627);}(_0xadae,0x134));var _0xeada=function(_0xf50820,_0x56f041){_0xf50820=_0xf50820-0x0;var _0x2a9b10=_0xadae[_0xf50820];return _0x2a9b10;};'use strict';var multer=require(_0xeada('0x0'));var util=require(_0xeada('0x1'));var path=require(_0xeada('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xeada('0x3'));var controller=require('./faxInteraction.controller');router[_0xeada('0x4')]('/',auth[_0xeada('0x5')](),controller['index']);router['get'](_0xeada('0x6'),auth[_0xeada('0x5')](),controller[_0xeada('0x7')]);router[_0xeada('0x4')](_0xeada('0x8'),auth[_0xeada('0x5')](),controller[_0xeada('0x9')]);router[_0xeada('0x4')](_0xeada('0xa'),auth[_0xeada('0x5')](),controller[_0xeada('0xb')]);router[_0xeada('0x4')](_0xeada('0xc'),auth['isAuthenticated'](),controller['download']);router[_0xeada('0xd')]('/',auth[_0xeada('0x5')](),controller[_0xeada('0xe')]);router[_0xeada('0xd')](_0xeada('0xa'),auth['isAuthenticated'](),controller[_0xeada('0xf')]);router[_0xeada('0xd')](_0xeada('0x10'),auth[_0xeada('0x5')](),interaction[_0xeada('0x11')]('fax',_0xeada('0x12')),controller['addTags']);router['put']('/:id',auth['isAuthenticated'](),interaction[_0xeada('0x11')](_0xeada('0x13'),_0xeada('0x14')),controller[_0xeada('0x15')]);router[_0xeada('0x16')](_0xeada('0x8'),auth[_0xeada('0x5')](),interaction[_0xeada('0x11')]('fax','faxinteraction:destroy'),controller['destroy']);router[_0xeada('0x16')]('/:id/tags',auth[_0xeada('0x5')](),controller['removeTags']);module[_0xeada('0x17')]=router; \ No newline at end of file +var _0x1311=['faxinteraction:addtags','addTags','put','/:id','faxinteraction:update','update','delete','faxinteraction:destroy','destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxInteraction.controller','get','isAuthenticated','index','/describe','show','/:id/messages','getMessages','/:id/download','download','create','post','addMessage','/:id/tags','tracked','fax'];(function(_0x72cb50,_0x33ba23){var _0x32c397=function(_0x46a302){while(--_0x46a302){_0x72cb50['push'](_0x72cb50['shift']());}};_0x32c397(++_0x33ba23);}(_0x1311,0x1c4));var _0x1131=function(_0x32ced6,_0x2b8aa7){_0x32ced6=_0x32ced6-0x0;var _0x38e47d=_0x1311[_0x32ced6];return _0x38e47d;};'use strict';var multer=require(_0x1131('0x0'));var util=require(_0x1131('0x1'));var path=require(_0x1131('0x2'));var timeout=require(_0x1131('0x3'));var express=require(_0x1131('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x1131('0x5'));var interaction=require(_0x1131('0x6'));var config=require(_0x1131('0x7'));var controller=require(_0x1131('0x8'));router[_0x1131('0x9')]('/',auth[_0x1131('0xa')](),controller[_0x1131('0xb')]);router[_0x1131('0x9')](_0x1131('0xc'),auth[_0x1131('0xa')](),controller['describe']);router[_0x1131('0x9')]('/:id',auth[_0x1131('0xa')](),controller[_0x1131('0xd')]);router[_0x1131('0x9')](_0x1131('0xe'),auth['isAuthenticated'](),controller[_0x1131('0xf')]);router[_0x1131('0x9')](_0x1131('0x10'),auth[_0x1131('0xa')](),controller[_0x1131('0x11')]);router['post']('/',auth['isAuthenticated'](),controller[_0x1131('0x12')]);router[_0x1131('0x13')](_0x1131('0xe'),auth[_0x1131('0xa')](),controller[_0x1131('0x14')]);router['post'](_0x1131('0x15'),auth[_0x1131('0xa')](),interaction[_0x1131('0x16')](_0x1131('0x17'),_0x1131('0x18')),controller[_0x1131('0x19')]);router[_0x1131('0x1a')](_0x1131('0x1b'),auth[_0x1131('0xa')](),interaction[_0x1131('0x16')]('fax',_0x1131('0x1c')),controller[_0x1131('0x1d')]);router[_0x1131('0x1e')](_0x1131('0x1b'),auth[_0x1131('0xa')](),interaction[_0x1131('0x16')](_0x1131('0x17'),_0x1131('0x1f')),controller[_0x1131('0x20')]);router[_0x1131('0x1e')](_0x1131('0x15'),auth[_0x1131('0xa')](),controller['removeTags']);module[_0x1131('0x21')]=router; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.attributes.js b/server/api/faxMessage/faxMessage.attributes.js index ac7e4bd..2c80778 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 _0x98d3=['exports','medium','ENUM','out','TEXT','sequelize'];(function(_0x4ac92f,_0x4a5bf4){var _0x4d6005=function(_0x386e05){while(--_0x386e05){_0x4ac92f['push'](_0x4ac92f['shift']());}};_0x4d6005(++_0x4a5bf4);}(_0x98d3,0x173));var _0x398d=function(_0x29fa5f,_0x457445){_0x29fa5f=_0x29fa5f-0x0;var _0x6bb4ff=_0x98d3[_0x29fa5f];return _0x6bb4ff;};'use strict';var Sequelize=require(_0x398d('0x0'));module[_0x398d('0x1')]={'body':{'type':Sequelize['TEXT'](_0x398d('0x2')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0x398d('0x3')]('in','out'),'defaultValue':_0x398d('0x4'),'allowNull':![]},'failMessage':{'type':Sequelize[_0x398d('0x5')],'defaultValue':null},'readAt':{'type':Sequelize['DATE']}}; \ No newline at end of file +var _0xb43b=['out','DATE','sequelize','TEXT','medium','BOOLEAN','ENUM'];(function(_0x1cdabe,_0x286194){var _0x3dcc9c=function(_0x5aa9c7){while(--_0x5aa9c7){_0x1cdabe['push'](_0x1cdabe['shift']());}};_0x3dcc9c(++_0x286194);}(_0xb43b,0xbf));var _0xbb43=function(_0x1df8a1,_0x130780){_0x1df8a1=_0x1df8a1-0x0;var _0x22e4f0=_0xb43b[_0x1df8a1];return _0x22e4f0;};'use strict';var Sequelize=require(_0xbb43('0x0'));module['exports']={'body':{'type':Sequelize[_0xbb43('0x1')](_0xbb43('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0xbb43('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0xbb43('0x4')]('in',_0xbb43('0x5')),'defaultValue':_0xbb43('0x5'),'allowNull':![]},'failMessage':{'type':Sequelize[_0xbb43('0x1')],'defaultValue':null},'readAt':{'type':Sequelize[_0xbb43('0x6')]}}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.controller.js b/server/api/faxMessage/faxMessage.controller.js index 83c1ebd..49092cf 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 _0x3b2a=['../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','socket.io-emitter','register','jayson/promise','client','http','request','then','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','pick','filter','merge','VIRTUAL','options','where','FaxMessage','includeAll','include','findAll','rows','params','body','describe','fax-interactions','accept','fax','readAt','format','user','agent','UserId','find','FaxInteractionId','isNil','read1stAt','YYYY-MM-DD\x20HH:mm:ss','interaction','info','[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','stringify','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','Sequelize','QueryTypes','SELECT','contact','fullname','email','internal','manual','interface','motionChannel','channel','EventManager','acceptmessage','get','FaxInteraction','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','sequelize','User','SIP/%s','event','rejectmessage','create','CmContact','Attachment','findOne','SendFax','FaxAccountId','/var/opt/motion2/server/files/attachments/%s','basename','AttachmentId','join','root','server','attachments','download','eml-format','rimraf','zip-dir','fast-json-patch','util','path','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils'];(function(_0x4fa13a,_0x1ff9f3){var _0x470976=function(_0x1ccf25){while(--_0x1ccf25){_0x4fa13a['push'](_0x4fa13a['shift']());}};_0x470976(++_0x1ff9f3);}(_0x3b2a,0x1ae));var _0xa3b2=function(_0x40b19e,_0x51f6ec){_0x40b19e=_0x40b19e-0x0;var _0x423c2f=_0x3b2a[_0x40b19e];return _0x423c2f;};'use strict';var emlformat=require(_0xa3b2('0x0'));var rimraf=require(_0xa3b2('0x1'));var zipdir=require(_0xa3b2('0x2'));var jsonpatch=require(_0xa3b2('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xa3b2('0x4'));var path=require(_0xa3b2('0x5'));var sox=require('sox');var csv=require(_0xa3b2('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xa3b2('0x7'));var _=require(_0xa3b2('0x8'));var squel=require(_0xa3b2('0x9'));var crypto=require(_0xa3b2('0xa'));var jsforce=require(_0xa3b2('0xb'));var deskjs=require(_0xa3b2('0xc'));var toCsv=require(_0xa3b2('0x6'));var querystring=require('querystring');var Papa=require(_0xa3b2('0xd'));var Redis=require('ioredis');var authService=require(_0xa3b2('0xe'));var qs=require(_0xa3b2('0xf'));var as=require(_0xa3b2('0x10'));var hardwareService=require(_0xa3b2('0x11'));var logger=require(_0xa3b2('0x12'))('api');var utils=require(_0xa3b2('0x13'));var config=require(_0xa3b2('0x14'));var licenseUtil=require(_0xa3b2('0x15'));var db=require(_0xa3b2('0x16'))['db'];config['redis']=_[_0xa3b2('0x17')](config[_0xa3b2('0x18')],{'host':'localhost','port':0x18eb});var socket=require(_0xa3b2('0x19'))(new Redis(config['redis']));require('./faxMessage.socket')[_0xa3b2('0x1a')](socket);var jayson=require(_0xa3b2('0x1b'));var client=jayson[_0xa3b2('0x1c')][_0xa3b2('0x1d')]({'port':0x232c});var client9002=jayson[_0xa3b2('0x1c')]['http']({'port':0x232a});function respondWithRpcPromise(_0x387c57,_0x32b170,_0x415c54,_0x28dc8c){return new BPromise(function(_0x1afe14,_0x22643f){var _0x45f505=_0x28dc8c||client;return _0x45f505[_0xa3b2('0x1e')](_0x387c57,_0x415c54)[_0xa3b2('0x1f')](function(_0xdd5cfa){logger['info'](_0xa3b2('0x20'),_0x32b170,_0xa3b2('0x21'));logger[_0xa3b2('0x22')](_0xa3b2('0x23'),_0x32b170,'request\x20sent',JSON['stringify'](_0xdd5cfa));if(_0xdd5cfa[_0xa3b2('0x24')]){if(_0xdd5cfa[_0xa3b2('0x24')][_0xa3b2('0x25')]===0x1f4){logger[_0xa3b2('0x24')](_0xa3b2('0x20'),_0x32b170,_0xdd5cfa[_0xa3b2('0x24')][_0xa3b2('0x26')]);return _0x22643f(_0xdd5cfa[_0xa3b2('0x24')][_0xa3b2('0x26')]);}logger[_0xa3b2('0x24')](_0xa3b2('0x20'),_0x32b170,_0xdd5cfa[_0xa3b2('0x24')]['message']);return _0x1afe14(_0xdd5cfa[_0xa3b2('0x24')][_0xa3b2('0x26')]);}else{logger['info'](_0xa3b2('0x20'),_0x32b170,_0xa3b2('0x21'));_0x1afe14(_0xdd5cfa[_0xa3b2('0x27')]['message']);}})[_0xa3b2('0x28')](function(_0x3f805f){logger[_0xa3b2('0x24')](_0xa3b2('0x20'),_0x32b170,_0x3f805f);_0x22643f(_0x3f805f);});});}function respondWithStatusCode(_0x3aaf90,_0x29d80d){_0x29d80d=_0x29d80d||0xcc;return function(_0x430b71){if(_0x430b71){return _0x3aaf90[_0xa3b2('0x29')](_0x29d80d);}return _0x3aaf90['status'](_0x29d80d)[_0xa3b2('0x2a')]();};}function respondWithResult(_0x3545c1,_0xaa0c58){_0xaa0c58=_0xaa0c58||0xc8;return function(_0x55bfa4){if(_0x55bfa4){return _0x3545c1[_0xa3b2('0x2b')](_0xaa0c58)[_0xa3b2('0x2c')](_0x55bfa4);}};}function respondWithFilteredResult(_0x201b98,_0xbb01b1){return function(_0x28b59e){if(_0x28b59e){var _0x58635c=typeof _0xbb01b1[_0xa3b2('0x2d')]===_0xa3b2('0x2e')&&typeof _0xbb01b1[_0xa3b2('0x2f')]===_0xa3b2('0x2e');var _0x30609c=_0x28b59e[_0xa3b2('0x30')];var _0x57bc05=_0x58635c?0x0:_0xbb01b1['offset'];var _0x29afb7=_0x58635c?_0x28b59e['count']:_0xbb01b1[_0xa3b2('0x2d')]+_0xbb01b1[_0xa3b2('0x2f')];var _0x538a3a;if(_0x29afb7>=_0x30609c){_0x29afb7=_0x30609c;_0x538a3a=0xc8;}else{_0x538a3a=0xce;}_0x201b98[_0xa3b2('0x2b')](_0x538a3a);return _0x201b98[_0xa3b2('0x31')](_0xa3b2('0x32'),_0x57bc05+'-'+_0x29afb7+'/'+_0x30609c)[_0xa3b2('0x2c')](_0x28b59e);}return null;};}function patchUpdates(_0x5ad478){return function(_0x5f54ea){try{jsonpatch[_0xa3b2('0x33')](_0x5f54ea,_0x5ad478,!![]);}catch(_0x316bce){return BPromise[_0xa3b2('0x34')](_0x316bce);}return _0x5f54ea[_0xa3b2('0x35')]();};}function saveUpdates(_0x3f5456,_0x46e025){return function(_0x5ca5d9){if(_0x5ca5d9){return _0x5ca5d9[_0xa3b2('0x36')](_0x3f5456)[_0xa3b2('0x1f')](function(_0x2ca82f){return _0x2ca82f;});}return null;};}function removeEntity(_0x387a13,_0x61a086){return function(_0x5d535b){if(_0x5d535b){return _0x5d535b[_0xa3b2('0x37')]()['then'](function(){_0x387a13[_0xa3b2('0x2b')](0xcc)[_0xa3b2('0x2a')]();});}};}function handleEntityNotFound(_0xc266c3,_0x4b799d){return function(_0x178fec){if(!_0x178fec){_0xc266c3[_0xa3b2('0x29')](0x194);}return _0x178fec;};}function handleError(_0x42205a,_0x101318){_0x101318=_0x101318||0x1f4;return function(_0x1fb4ae){logger[_0xa3b2('0x24')](_0x1fb4ae[_0xa3b2('0x38')]);if(_0x1fb4ae[_0xa3b2('0x39')]){delete _0x1fb4ae[_0xa3b2('0x39')];}_0x42205a['status'](_0x101318)[_0xa3b2('0x3a')](_0x1fb4ae);};}exports[_0xa3b2('0x3b')]=function(_0x44c2dd,_0x2573b4){var _0x2a705f={},_0x45060e={},_0x4d6b34={'count':0x0,'rows':[]};var _0xb3460d=_[_0xa3b2('0x3c')](db['FaxMessage'][_0xa3b2('0x3d')],function(_0x224c7a){return{'name':_0x224c7a[_0xa3b2('0x3e')],'type':_0x224c7a[_0xa3b2('0x3f')][_0xa3b2('0x40')]};});_0x45060e[_0xa3b2('0x41')]=_[_0xa3b2('0x3c')](_0xb3460d,_0xa3b2('0x39'));_0x45060e[_0xa3b2('0x42')]=_[_0xa3b2('0x43')](_0x44c2dd[_0xa3b2('0x42')]);_0x45060e[_0xa3b2('0x44')]=_[_0xa3b2('0x45')](_0x45060e[_0xa3b2('0x41')],_0x45060e[_0xa3b2('0x42')]);_0x2a705f[_0xa3b2('0x46')]=_['intersection'](_0x45060e[_0xa3b2('0x41')],qs[_0xa3b2('0x47')](_0x44c2dd[_0xa3b2('0x42')][_0xa3b2('0x47')]));_0x2a705f['attributes']=_0x2a705f[_0xa3b2('0x46')][_0xa3b2('0x48')]?_0x2a705f['attributes']:_0x45060e['model'];if(!_0x44c2dd[_0xa3b2('0x42')][_0xa3b2('0x49')]('nolimit')){_0x2a705f['limit']=qs['limit'](_0x44c2dd[_0xa3b2('0x42')][_0xa3b2('0x2f')]);_0x2a705f[_0xa3b2('0x2d')]=qs['offset'](_0x44c2dd[_0xa3b2('0x42')][_0xa3b2('0x2d')]);}_0x2a705f[_0xa3b2('0x4a')]=qs[_0xa3b2('0x4b')](_0x44c2dd[_0xa3b2('0x42')][_0xa3b2('0x4b')]);_0x2a705f['where']=qs[_0xa3b2('0x44')](_[_0xa3b2('0x4c')](_0x44c2dd[_0xa3b2('0x42')],_0x45060e[_0xa3b2('0x44')]),_0xb3460d);if(_0x44c2dd[_0xa3b2('0x42')][_0xa3b2('0x4d')]){_0x2a705f['where']=_[_0xa3b2('0x4e')](_0x2a705f['where'],{'$or':_[_0xa3b2('0x3c')](_0xb3460d,function(_0x114d29){if(_0x114d29[_0xa3b2('0x3f')]!==_0xa3b2('0x4f')){var _0x1a3346={};_0x1a3346[_0x114d29['name']]={'$like':'%'+_0x44c2dd[_0xa3b2('0x42')]['filter']+'%'};return _0x1a3346;}})});}_0x2a705f=_[_0xa3b2('0x4e')]({},_0x2a705f,_0x44c2dd[_0xa3b2('0x50')]);var _0x718c3d={'where':_0x2a705f[_0xa3b2('0x51')]};return db[_0xa3b2('0x52')]['count'](_0x718c3d)[_0xa3b2('0x1f')](function(_0x2016c7){_0x4d6b34[_0xa3b2('0x30')]=_0x2016c7;if(_0x44c2dd['query'][_0xa3b2('0x53')]){_0x2a705f[_0xa3b2('0x54')]=[{'all':!![]}];}return db[_0xa3b2('0x52')][_0xa3b2('0x55')](_0x2a705f);})[_0xa3b2('0x1f')](function(_0x1a58cc){_0x4d6b34[_0xa3b2('0x56')]=_0x1a58cc;return _0x4d6b34;})[_0xa3b2('0x1f')](respondWithFilteredResult(_0x2573b4,_0x2a705f))[_0xa3b2('0x28')](handleError(_0x2573b4,null));};exports['show']=function(_0x113cdf,_0x4f03f0){var _0x4035c7={'raw':!![],'where':{'id':_0x113cdf[_0xa3b2('0x57')]['id']}},_0x19685c={};_0x19685c[_0xa3b2('0x41')]=_[_0xa3b2('0x43')](db[_0xa3b2('0x52')][_0xa3b2('0x3d')]);_0x19685c[_0xa3b2('0x42')]=_[_0xa3b2('0x43')](_0x113cdf[_0xa3b2('0x42')]);_0x19685c[_0xa3b2('0x44')]=_[_0xa3b2('0x45')](_0x19685c[_0xa3b2('0x41')],_0x19685c[_0xa3b2('0x42')]);_0x4035c7[_0xa3b2('0x46')]=_[_0xa3b2('0x45')](_0x19685c['model'],qs[_0xa3b2('0x47')](_0x113cdf['query'][_0xa3b2('0x47')]));_0x4035c7[_0xa3b2('0x46')]=_0x4035c7[_0xa3b2('0x46')][_0xa3b2('0x48')]?_0x4035c7[_0xa3b2('0x46')]:_0x19685c[_0xa3b2('0x41')];if(_0x113cdf['query'][_0xa3b2('0x53')]){_0x4035c7['include']=[{'all':!![]}];}_0x4035c7=_['merge']({},_0x4035c7,_0x113cdf[_0xa3b2('0x50')]);return db[_0xa3b2('0x52')]['find'](_0x4035c7)[_0xa3b2('0x1f')](handleEntityNotFound(_0x4f03f0,null))[_0xa3b2('0x1f')](respondWithResult(_0x4f03f0,null))[_0xa3b2('0x28')](handleError(_0x4f03f0,null));};exports[_0xa3b2('0x36')]=function(_0x35a0e8,_0x294321){if(_0x35a0e8[_0xa3b2('0x58')]['id']){delete _0x35a0e8[_0xa3b2('0x58')]['id'];}return db[_0xa3b2('0x52')]['find']({'where':{'id':_0x35a0e8[_0xa3b2('0x57')]['id']}})[_0xa3b2('0x1f')](handleEntityNotFound(_0x294321,null))[_0xa3b2('0x1f')](saveUpdates(_0x35a0e8[_0xa3b2('0x58')],null))[_0xa3b2('0x1f')](respondWithResult(_0x294321,null))[_0xa3b2('0x28')](handleError(_0x294321,null));};exports[_0xa3b2('0x37')]=function(_0x45f212,_0x46c863){return db[_0xa3b2('0x52')]['find']({'where':{'id':_0x45f212[_0xa3b2('0x57')]['id']}})[_0xa3b2('0x1f')](handleEntityNotFound(_0x46c863,null))[_0xa3b2('0x1f')](removeEntity(_0x46c863,null))[_0xa3b2('0x28')](handleError(_0x46c863,null));};exports['describe']=function(_0x4179c9,_0x4c6d3d){return db['FaxMessage'][_0xa3b2('0x59')]()[_0xa3b2('0x1f')](respondWithResult(_0x4c6d3d,null))['catch'](handleError(_0x4c6d3d,null));};var interaction_log=require(_0xa3b2('0x12'))(_0xa3b2('0x5a'));exports[_0xa3b2('0x5b')]=function(_0x30094b,_0x52b7c2,_0x334365){var _0x48b994={'agent':{},'channel':_0xa3b2('0x5c')};if(_0x30094b[_0xa3b2('0x58')]['id']){delete _0x30094b['body']['id'];}_0x30094b['body']['read']=!![];_0x30094b[_0xa3b2('0x58')][_0xa3b2('0x5d')]=moment()[_0xa3b2('0x5e')]('YYYY-MM-DD\x20HH:mm:ss');_0x30094b[_0xa3b2('0x58')]['UserId']=_0x30094b['body']['UserId']||_0x30094b[_0xa3b2('0x5f')]['id'];_0x48b994[_0xa3b2('0x60')]['id']=_0x30094b[_0xa3b2('0x58')][_0xa3b2('0x61')];return db['FaxMessage'][_0xa3b2('0x62')]({'where':{'id':_0x30094b[_0xa3b2('0x57')]['id'],'UserId':null}})[_0xa3b2('0x1f')](handleEntityNotFound(_0x52b7c2,null))['then'](saveUpdates(_0x30094b['body'],null))[_0xa3b2('0x1f')](function(_0x3be7f6){if(_0x3be7f6){_0x48b994[_0xa3b2('0x26')]=_0x3be7f6['get']({'plain':!![]});return db['FaxInteraction'][_0xa3b2('0x62')]({'where':{'id':_0x3be7f6[_0xa3b2('0x63')]}});}return null;})[_0xa3b2('0x1f')](handleEntityNotFound(_0x52b7c2,null))[_0xa3b2('0x1f')](function(_0x216396){if(_0x216396){return _0x216396[_0xa3b2('0x36')]({'UserId':_0x30094b['body']['UserId'],'read1stAt':_[_0xa3b2('0x64')](_0x216396[_0xa3b2('0x65')])?moment()[_0xa3b2('0x5e')](_0xa3b2('0x66')):undefined});}return null;})[_0xa3b2('0x1f')](function(_0x3efdf5){if(_0x3efdf5){_0x48b994[_0xa3b2('0x67')]=_0x3efdf5['get']({'plain':!![]});interaction_log[_0xa3b2('0x68')](_0xa3b2('0x69'),_0x30094b['user']['id'],_0x30094b[_0xa3b2('0x5f')]['name'],_0x30094b[_0xa3b2('0x5f')][_0xa3b2('0x6a')],_0x48b994[_0xa3b2('0x67')]['id'],_0x30094b['body']?JSON[_0xa3b2('0x6b')](_0x30094b[_0xa3b2('0x58')]):_0xa3b2('0x6c'));return respondWithRpcPromise(_0xa3b2('0x6d'),_0xa3b2('0x6e'),_0x48b994);}return null;})[_0xa3b2('0x1f')](function(_0x196548){var _0x544ba2=_0xa3b2('0x6f')+_0x196548[_0xa3b2('0x26')][_0xa3b2('0x70')];return db['sequelize'][_0xa3b2('0x42')](_0x544ba2,{'type':db[_0xa3b2('0x71')][_0xa3b2('0x72')][_0xa3b2('0x73')],'raw':!![]})[_0xa3b2('0x1f')](function(_0x3a5bf2){return _0x3a5bf2;});})[_0xa3b2('0x1f')](function(_0x369daf){if(_0x369daf){_0x48b994[_0xa3b2('0x26')][_0xa3b2('0x74')]=_0x369daf[0x0];if(!_0x30094b['body'][_0xa3b2('0x61')])return;return db['User'][_0xa3b2('0x62')]({'where':{'id':_0x30094b['body'][_0xa3b2('0x61')],'role':_0xa3b2('0x60')},'attributes':['id','name',_0xa3b2('0x75'),_0xa3b2('0x76'),_0xa3b2('0x77')],'raw':!![]});}return null;})[_0xa3b2('0x1f')](function(_0x46d8db){if(!_0x46d8db)return null;_0x48b994['message'][_0xa3b2('0x60')]=_0x46d8db;return _0x48b994;})[_0xa3b2('0x1f')](function(_0x3a673f){if(_0x3a673f){if(_0x30094b[_0xa3b2('0x58')][_0xa3b2('0x78')]){_0x48b994['message'][_0xa3b2('0x79')]=util[_0xa3b2('0x5e')]('SIP/%s',_0x30094b[_0xa3b2('0x5f')][_0xa3b2('0x39')]);_0x48b994[_0xa3b2('0x26')]['channel']=_0x48b994['channel'];_0x48b994[_0xa3b2('0x26')][_0xa3b2('0x7a')]=_0x48b994[_0xa3b2('0x7b')];_0x48b994[_0xa3b2('0x26')]['event']=_0xa3b2('0x5b');return respondWithRpcPromise(_0xa3b2('0x7c'),_0xa3b2('0x7c'),{'event':_0xa3b2('0x7d'),'message':_0x48b994[_0xa3b2('0x26')]},client9002)[_0xa3b2('0x1f')](function(){return _0x48b994;});}return _0x48b994;}return null;})[_0xa3b2('0x1f')](respondWithResult(_0x52b7c2,null))[_0xa3b2('0x28')](handleError(_0x52b7c2,null));};var interaction_log=require(_0xa3b2('0x12'))(_0xa3b2('0x5a'));exports[_0xa3b2('0x34')]=function(_0x442fb5,_0x2df943,_0x473c8b){var _0x3108e3={'agent':{},'channel':_0xa3b2('0x5c')};if(_0x442fb5[_0xa3b2('0x58')]['id']){delete _0x442fb5[_0xa3b2('0x58')]['id'];}_0x442fb5[_0xa3b2('0x58')][_0xa3b2('0x61')]=_0x442fb5['body'][_0xa3b2('0x61')]||_0x442fb5['user']['id'];_0x3108e3[_0xa3b2('0x60')]['id']=_0x442fb5[_0xa3b2('0x58')]['UserId'];return db[_0xa3b2('0x52')][_0xa3b2('0x62')]({'where':{'id':_0x442fb5[_0xa3b2('0x57')]['id'],'UserId':null}})[_0xa3b2('0x1f')](handleEntityNotFound(_0x2df943,null))[_0xa3b2('0x1f')](function(_0x501799){if(_0x501799){_0x3108e3[_0xa3b2('0x26')]=_0x501799[_0xa3b2('0x7e')]({'plain':!![]});return db[_0xa3b2('0x7f')]['find']({'where':{'id':_0x501799[_0xa3b2('0x63')]}});}return null;})['then'](handleEntityNotFound(_0x2df943,null))[_0xa3b2('0x1f')](function(_0x1688df){if(_0x1688df){_0x3108e3[_0xa3b2('0x67')]=_0x1688df[_0xa3b2('0x7e')]({'plain':!![]});interaction_log[_0xa3b2('0x68')](_0xa3b2('0x80'),_0x442fb5['user']['id'],_0x442fb5[_0xa3b2('0x5f')][_0xa3b2('0x39')],_0x442fb5['user'][_0xa3b2('0x6a')],_0x3108e3[_0xa3b2('0x67')]['id'],_0x442fb5[_0xa3b2('0x58')]?JSON[_0xa3b2('0x6b')](_0x442fb5['body']):_0xa3b2('0x6c'));return respondWithRpcPromise(_0xa3b2('0x81'),_0xa3b2('0x82'),_0x3108e3);}return null;})[_0xa3b2('0x1f')](function(_0x1eef2e){var _0x1c15d1='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x1eef2e['message'][_0xa3b2('0x70')];return db[_0xa3b2('0x83')][_0xa3b2('0x42')](_0x1c15d1,{'type':db[_0xa3b2('0x71')][_0xa3b2('0x72')]['SELECT'],'raw':!![]})['then'](function(_0x5782b3){return _0x5782b3;});})['then'](function(_0x41d03c){if(_0x41d03c){_0x3108e3[_0xa3b2('0x26')]['contact']=_0x41d03c[0x0];if(!_0x442fb5['body'][_0xa3b2('0x61')])return;return db[_0xa3b2('0x84')][_0xa3b2('0x62')]({'where':{'id':_0x442fb5[_0xa3b2('0x58')][_0xa3b2('0x61')],'role':_0xa3b2('0x60')},'attributes':['id','name',_0xa3b2('0x75'),'email','internal'],'raw':!![]});}return null;})['then'](function(_0x263e5b){if(!_0x263e5b)return null;_0x3108e3['message'][_0xa3b2('0x60')]=_0x263e5b;return _0x3108e3;})[_0xa3b2('0x1f')](function(_0x341581){if(_0x341581){_0x341581[_0xa3b2('0x26')]['interface']=util['format'](_0xa3b2('0x85'),_0x442fb5[_0xa3b2('0x5f')]['name']);_0x341581['message'][_0xa3b2('0x7b')]=_0x3108e3['channel'];_0x341581[_0xa3b2('0x26')][_0xa3b2('0x7a')]=_0x3108e3[_0xa3b2('0x7b')];_0x341581[_0xa3b2('0x26')][_0xa3b2('0x86')]=_0xa3b2('0x34');respondWithRpcPromise(_0xa3b2('0x7c'),'EventManager',{'event':_0xa3b2('0x87'),'message':_0x341581['message']},client9002);return _0x3108e3;}return null;})[_0xa3b2('0x1f')](respondWithResult(_0x2df943,null))[_0xa3b2('0x28')](handleError(_0x2df943,null));};exports[_0xa3b2('0x88')]=function(_0x402a4a,_0x4ed1a8){var _0x8cc6ad;return db['FaxMessage'][_0xa3b2('0x88')](_0x402a4a['body'],{})[_0xa3b2('0x1f')](function(_0x4e3adc){_0x8cc6ad=_0x4e3adc;return db[_0xa3b2('0x89')]['findOne']({'where':{'id':_0x8cc6ad['ContactId']}});})[_0xa3b2('0x1f')](function(_0x171dae){if(_[_0xa3b2('0x64')](_0x171dae)){return;}else{_0x8cc6ad['fax']=_0x171dae['fax'];return db[_0xa3b2('0x8a')][_0xa3b2('0x8b')]({'where':{'id':_0x8cc6ad['AttachmentId']}});}})[_0xa3b2('0x1f')](function(_0xd27910){return respondWithRpcPromise('SendFax',_0xa3b2('0x8c'),{'FaxAccountId':_[_0xa3b2('0x64')](_0x402a4a['body'])?undefined:_0x402a4a[_0xa3b2('0x58')][_0xa3b2('0x8d')],'path':_[_0xa3b2('0x64')](_0xd27910)?undefined:util[_0xa3b2('0x5e')](_0xa3b2('0x8e'),_0xd27910[_0xa3b2('0x8f')]),'fax':_[_0xa3b2('0x64')](_0x8cc6ad[_0xa3b2('0x5c')])?undefined:_0x8cc6ad[_0xa3b2('0x5c')],'AttachmentId':_0x8cc6ad[_0xa3b2('0x90')]},client9002);})[_0xa3b2('0x1f')](respondWithResult(_0x4ed1a8,0xc9))[_0xa3b2('0x28')](handleError(_0x4ed1a8,null));};exports['download']=function(_0x287cd5,_0xa1945c){var _0xbf306d=path[_0xa3b2('0x91')](config[_0xa3b2('0x92')],_0xa3b2('0x93'),'files',_0xa3b2('0x94'));return db['FaxMessage'][_0xa3b2('0x62')]({'where':{'id':_0x287cd5['params']['id']},'include':[{'model':db[_0xa3b2('0x8a')],'as':_0xa3b2('0x8a')}]})[_0xa3b2('0x1f')](handleEntityNotFound(_0xa1945c,null))['then'](function(_0x4c06b6){if(_0x4c06b6){return _0xa1945c[_0xa3b2('0x95')](path[_0xa3b2('0x91')](_0xbf306d,_0x4c06b6['Attachment'][_0xa3b2('0x8f')]));}})[_0xa3b2('0x28')](handleError(_0xa1945c,null));}; \ No newline at end of file +var _0xd9fc=['interaction','[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','acceptMessage','ContactId','sequelize','Sequelize','QueryTypes','contact','User','agent','fullname','email','manual','SIP/%s','channel','motionChannel','event','EventManager','acceptmessage','fax-interactions','fax','get','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','internal','interface','rejectmessage','create','CmContact','findOne','Attachment','AttachmentId','SendFax','FaxAccountId','basename','download','join','server','files','attachments','eml-format','rimraf','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./faxMessage.socket','jayson/promise','client','http','request','then','info','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','sendStatus','status','json','limit','offset','set','apply','reject','update','destroy','end','stack','name','index','map','FaxMessage','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','fields','attributes','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','count','includeAll','include','findAll','rows','catch','show','length','find','body','params','describe','../../config/logger','accept','read','readAt','format','UserId','user','FaxInteraction','FaxInteractionId','isNil','read1stAt','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x590d2d,_0x253b9c){var _0xb040c2=function(_0x2d93cc){while(--_0x2d93cc){_0x590d2d['push'](_0x590d2d['shift']());}};_0xb040c2(++_0x253b9c);}(_0xd9fc,0x150));var _0xcd9f=function(_0x4d8529,_0x438fbc){_0x4d8529=_0x4d8529-0x0;var _0x4b5e97=_0xd9fc[_0x4d8529];return _0x4b5e97;};'use strict';var emlformat=require(_0xcd9f('0x0'));var rimraf=require(_0xcd9f('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xcd9f('0x2'));var BPromise=require(_0xcd9f('0x3'));var Mustache=require(_0xcd9f('0x4'));var util=require('util');var path=require(_0xcd9f('0x5'));var sox=require(_0xcd9f('0x6'));var csv=require(_0xcd9f('0x7'));var ejs=require(_0xcd9f('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xcd9f('0x9'));var squel=require('squel');var crypto=require(_0xcd9f('0xa'));var jsforce=require(_0xcd9f('0xb'));var deskjs=require(_0xcd9f('0xc'));var toCsv=require(_0xcd9f('0x7'));var querystring=require(_0xcd9f('0xd'));var Papa=require(_0xcd9f('0xe'));var Redis=require(_0xcd9f('0xf'));var authService=require(_0xcd9f('0x10'));var qs=require(_0xcd9f('0x11'));var as=require(_0xcd9f('0x12'));var hardwareService=require(_0xcd9f('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0xcd9f('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xcd9f('0x15'));var db=require(_0xcd9f('0x16'))['db'];config[_0xcd9f('0x17')]=_[_0xcd9f('0x18')](config['redis'],{'host':_0xcd9f('0x19'),'port':0x18eb});var socket=require(_0xcd9f('0x1a'))(new Redis(config[_0xcd9f('0x17')]));require(_0xcd9f('0x1b'))['register'](socket);var jayson=require(_0xcd9f('0x1c'));var client=jayson[_0xcd9f('0x1d')][_0xcd9f('0x1e')]({'port':0x232c});var client9002=jayson[_0xcd9f('0x1d')][_0xcd9f('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x3d798b,_0x84b0db,_0x4f547e,_0x511527){return new BPromise(function(_0x176027,_0x45ef9d){var _0x117ed4=_0x511527||client;return _0x117ed4[_0xcd9f('0x1f')](_0x3d798b,_0x4f547e)[_0xcd9f('0x20')](function(_0x34f416){logger[_0xcd9f('0x21')](_0xcd9f('0x22'),_0x84b0db,_0xcd9f('0x23'));logger[_0xcd9f('0x24')](_0xcd9f('0x25'),_0x84b0db,_0xcd9f('0x23'),JSON[_0xcd9f('0x26')](_0x34f416));if(_0x34f416[_0xcd9f('0x27')]){if(_0x34f416[_0xcd9f('0x27')][_0xcd9f('0x28')]===0x1f4){logger['error'](_0xcd9f('0x22'),_0x84b0db,_0x34f416['error'][_0xcd9f('0x29')]);return _0x45ef9d(_0x34f416['error']['message']);}logger[_0xcd9f('0x27')](_0xcd9f('0x22'),_0x84b0db,_0x34f416['error'][_0xcd9f('0x29')]);return _0x176027(_0x34f416['error']['message']);}else{logger[_0xcd9f('0x21')]('FaxMessage,\x20%s,\x20%s',_0x84b0db,_0xcd9f('0x23'));_0x176027(_0x34f416['result'][_0xcd9f('0x29')]);}})['catch'](function(_0x3be96c){logger['error'](_0xcd9f('0x22'),_0x84b0db,_0x3be96c);_0x45ef9d(_0x3be96c);});});}function respondWithStatusCode(_0x341703,_0x2b5ca2){_0x2b5ca2=_0x2b5ca2||0xcc;return function(_0x301445){if(_0x301445){return _0x341703[_0xcd9f('0x2a')](_0x2b5ca2);}return _0x341703[_0xcd9f('0x2b')](_0x2b5ca2)['end']();};}function respondWithResult(_0x618a32,_0x5e4fde){_0x5e4fde=_0x5e4fde||0xc8;return function(_0x35fdec){if(_0x35fdec){return _0x618a32[_0xcd9f('0x2b')](_0x5e4fde)[_0xcd9f('0x2c')](_0x35fdec);}};}function respondWithFilteredResult(_0x2bd3d8,_0x372b4e){return function(_0x3a8d2e){if(_0x3a8d2e){var _0x159133=typeof _0x372b4e['offset']==='undefined'&&typeof _0x372b4e[_0xcd9f('0x2d')]==='undefined';var _0x2e889c=_0x3a8d2e['count'];var _0x5a9629=_0x159133?0x0:_0x372b4e[_0xcd9f('0x2e')];var _0x161ccc=_0x159133?_0x3a8d2e['count']:_0x372b4e[_0xcd9f('0x2e')]+_0x372b4e[_0xcd9f('0x2d')];var _0x1e3971;if(_0x161ccc>=_0x2e889c){_0x161ccc=_0x2e889c;_0x1e3971=0xc8;}else{_0x1e3971=0xce;}_0x2bd3d8['status'](_0x1e3971);return _0x2bd3d8[_0xcd9f('0x2f')]('Content-Range',_0x5a9629+'-'+_0x161ccc+'/'+_0x2e889c)[_0xcd9f('0x2c')](_0x3a8d2e);}return null;};}function patchUpdates(_0x287438){return function(_0x18b10c){try{jsonpatch[_0xcd9f('0x30')](_0x18b10c,_0x287438,!![]);}catch(_0x1b9be6){return BPromise[_0xcd9f('0x31')](_0x1b9be6);}return _0x18b10c['save']();};}function saveUpdates(_0x536bd6,_0x5eb315){return function(_0x4b5006){if(_0x4b5006){return _0x4b5006[_0xcd9f('0x32')](_0x536bd6)[_0xcd9f('0x20')](function(_0x26c7b5){return _0x26c7b5;});}return null;};}function removeEntity(_0x5ac20e,_0x535ace){return function(_0x4ba402){if(_0x4ba402){return _0x4ba402[_0xcd9f('0x33')]()[_0xcd9f('0x20')](function(){_0x5ac20e[_0xcd9f('0x2b')](0xcc)[_0xcd9f('0x34')]();});}};}function handleEntityNotFound(_0x1b31b3,_0x2c4908){return function(_0x12f013){if(!_0x12f013){_0x1b31b3[_0xcd9f('0x2a')](0x194);}return _0x12f013;};}function handleError(_0x45a2ba,_0x5e434f){_0x5e434f=_0x5e434f||0x1f4;return function(_0x5e8be9){logger[_0xcd9f('0x27')](_0x5e8be9[_0xcd9f('0x35')]);if(_0x5e8be9['name']){delete _0x5e8be9[_0xcd9f('0x36')];}_0x45a2ba[_0xcd9f('0x2b')](_0x5e434f)['send'](_0x5e8be9);};}exports[_0xcd9f('0x37')]=function(_0x511d5c,_0x23585c){var _0x277a5a={},_0x2820e6={},_0x292406={'count':0x0,'rows':[]};var _0x42516c=_[_0xcd9f('0x38')](db[_0xcd9f('0x39')][_0xcd9f('0x3a')],function(_0x331682){return{'name':_0x331682[_0xcd9f('0x3b')],'type':_0x331682[_0xcd9f('0x3c')][_0xcd9f('0x3d')]};});_0x2820e6[_0xcd9f('0x3e')]=_[_0xcd9f('0x38')](_0x42516c,_0xcd9f('0x36'));_0x2820e6['query']=_[_0xcd9f('0x3f')](_0x511d5c[_0xcd9f('0x40')]);_0x2820e6[_0xcd9f('0x41')]=_[_0xcd9f('0x42')](_0x2820e6[_0xcd9f('0x3e')],_0x2820e6[_0xcd9f('0x40')]);_0x277a5a['attributes']=_[_0xcd9f('0x42')](_0x2820e6[_0xcd9f('0x3e')],qs[_0xcd9f('0x43')](_0x511d5c['query']['fields']));_0x277a5a[_0xcd9f('0x44')]=_0x277a5a[_0xcd9f('0x44')]['length']?_0x277a5a[_0xcd9f('0x44')]:_0x2820e6[_0xcd9f('0x3e')];if(!_0x511d5c[_0xcd9f('0x40')][_0xcd9f('0x45')]('nolimit')){_0x277a5a[_0xcd9f('0x2d')]=qs[_0xcd9f('0x2d')](_0x511d5c[_0xcd9f('0x40')][_0xcd9f('0x2d')]);_0x277a5a[_0xcd9f('0x2e')]=qs[_0xcd9f('0x2e')](_0x511d5c['query'][_0xcd9f('0x2e')]);}_0x277a5a[_0xcd9f('0x46')]=qs[_0xcd9f('0x47')](_0x511d5c[_0xcd9f('0x40')][_0xcd9f('0x47')]);_0x277a5a[_0xcd9f('0x48')]=qs[_0xcd9f('0x41')](_[_0xcd9f('0x49')](_0x511d5c[_0xcd9f('0x40')],_0x2820e6[_0xcd9f('0x41')]),_0x42516c);if(_0x511d5c['query'][_0xcd9f('0x4a')]){_0x277a5a[_0xcd9f('0x48')]=_[_0xcd9f('0x4b')](_0x277a5a[_0xcd9f('0x48')],{'$or':_['map'](_0x42516c,function(_0x4877de){if(_0x4877de[_0xcd9f('0x3c')]!==_0xcd9f('0x4c')){var _0x31ba97={};_0x31ba97[_0x4877de[_0xcd9f('0x36')]]={'$like':'%'+_0x511d5c[_0xcd9f('0x40')][_0xcd9f('0x4a')]+'%'};return _0x31ba97;}})});}_0x277a5a=_[_0xcd9f('0x4b')]({},_0x277a5a,_0x511d5c[_0xcd9f('0x4d')]);var _0x41682={'where':_0x277a5a[_0xcd9f('0x48')]};return db['FaxMessage'][_0xcd9f('0x4e')](_0x41682)[_0xcd9f('0x20')](function(_0x4377a4){_0x292406[_0xcd9f('0x4e')]=_0x4377a4;if(_0x511d5c['query'][_0xcd9f('0x4f')]){_0x277a5a[_0xcd9f('0x50')]=[{'all':!![]}];}return db['FaxMessage'][_0xcd9f('0x51')](_0x277a5a);})['then'](function(_0xbe49cf){_0x292406[_0xcd9f('0x52')]=_0xbe49cf;return _0x292406;})[_0xcd9f('0x20')](respondWithFilteredResult(_0x23585c,_0x277a5a))[_0xcd9f('0x53')](handleError(_0x23585c,null));};exports[_0xcd9f('0x54')]=function(_0x24aa07,_0x570215){var _0x536e0d={'raw':!![],'where':{'id':_0x24aa07['params']['id']}},_0xed0efc={};_0xed0efc[_0xcd9f('0x3e')]=_['keys'](db[_0xcd9f('0x39')][_0xcd9f('0x3a')]);_0xed0efc[_0xcd9f('0x40')]=_[_0xcd9f('0x3f')](_0x24aa07[_0xcd9f('0x40')]);_0xed0efc[_0xcd9f('0x41')]=_[_0xcd9f('0x42')](_0xed0efc[_0xcd9f('0x3e')],_0xed0efc['query']);_0x536e0d[_0xcd9f('0x44')]=_[_0xcd9f('0x42')](_0xed0efc[_0xcd9f('0x3e')],qs[_0xcd9f('0x43')](_0x24aa07['query'][_0xcd9f('0x43')]));_0x536e0d[_0xcd9f('0x44')]=_0x536e0d[_0xcd9f('0x44')][_0xcd9f('0x55')]?_0x536e0d['attributes']:_0xed0efc[_0xcd9f('0x3e')];if(_0x24aa07[_0xcd9f('0x40')][_0xcd9f('0x4f')]){_0x536e0d['include']=[{'all':!![]}];}_0x536e0d=_[_0xcd9f('0x4b')]({},_0x536e0d,_0x24aa07[_0xcd9f('0x4d')]);return db['FaxMessage'][_0xcd9f('0x56')](_0x536e0d)[_0xcd9f('0x20')](handleEntityNotFound(_0x570215,null))[_0xcd9f('0x20')](respondWithResult(_0x570215,null))[_0xcd9f('0x53')](handleError(_0x570215,null));};exports['update']=function(_0x4f2f4e,_0x4071f2){if(_0x4f2f4e[_0xcd9f('0x57')]['id']){delete _0x4f2f4e[_0xcd9f('0x57')]['id'];}return db['FaxMessage'][_0xcd9f('0x56')]({'where':{'id':_0x4f2f4e[_0xcd9f('0x58')]['id']}})[_0xcd9f('0x20')](handleEntityNotFound(_0x4071f2,null))[_0xcd9f('0x20')](saveUpdates(_0x4f2f4e['body'],null))[_0xcd9f('0x20')](respondWithResult(_0x4071f2,null))[_0xcd9f('0x53')](handleError(_0x4071f2,null));};exports[_0xcd9f('0x33')]=function(_0x37c480,_0x585b5a){return db[_0xcd9f('0x39')]['find']({'where':{'id':_0x37c480[_0xcd9f('0x58')]['id']}})[_0xcd9f('0x20')](handleEntityNotFound(_0x585b5a,null))[_0xcd9f('0x20')](removeEntity(_0x585b5a,null))[_0xcd9f('0x53')](handleError(_0x585b5a,null));};exports['describe']=function(_0x4efccb,_0xf28ca7){return db[_0xcd9f('0x39')][_0xcd9f('0x59')]()['then'](respondWithResult(_0xf28ca7,null))[_0xcd9f('0x53')](handleError(_0xf28ca7,null));};var interaction_log=require(_0xcd9f('0x5a'))('fax-interactions');exports[_0xcd9f('0x5b')]=function(_0x1f1894,_0x4ff633,_0x430a14){var _0x3101ac={'agent':{},'channel':'fax'};if(_0x1f1894['body']['id']){delete _0x1f1894['body']['id'];}_0x1f1894[_0xcd9f('0x57')][_0xcd9f('0x5c')]=!![];_0x1f1894[_0xcd9f('0x57')][_0xcd9f('0x5d')]=moment()[_0xcd9f('0x5e')]('YYYY-MM-DD\x20HH:mm:ss');_0x1f1894[_0xcd9f('0x57')][_0xcd9f('0x5f')]=_0x1f1894[_0xcd9f('0x57')][_0xcd9f('0x5f')]||_0x1f1894[_0xcd9f('0x60')]['id'];_0x3101ac['agent']['id']=_0x1f1894[_0xcd9f('0x57')][_0xcd9f('0x5f')];return db[_0xcd9f('0x39')][_0xcd9f('0x56')]({'where':{'id':_0x1f1894[_0xcd9f('0x58')]['id'],'UserId':null}})[_0xcd9f('0x20')](handleEntityNotFound(_0x4ff633,null))['then'](saveUpdates(_0x1f1894[_0xcd9f('0x57')],null))['then'](function(_0x1871ab){if(_0x1871ab){_0x3101ac[_0xcd9f('0x29')]=_0x1871ab['get']({'plain':!![]});return db[_0xcd9f('0x61')][_0xcd9f('0x56')]({'where':{'id':_0x1871ab[_0xcd9f('0x62')]}});}return null;})[_0xcd9f('0x20')](handleEntityNotFound(_0x4ff633,null))[_0xcd9f('0x20')](function(_0x32df13){if(_0x32df13){return _0x32df13[_0xcd9f('0x32')]({'UserId':_0x1f1894[_0xcd9f('0x57')][_0xcd9f('0x5f')],'read1stAt':_[_0xcd9f('0x63')](_0x32df13[_0xcd9f('0x64')])?moment()[_0xcd9f('0x5e')](_0xcd9f('0x65')):undefined});}return null;})['then'](function(_0x17c3f4){if(_0x17c3f4){_0x3101ac[_0xcd9f('0x66')]=_0x17c3f4['get']({'plain':!![]});interaction_log[_0xcd9f('0x21')](_0xcd9f('0x67'),_0x1f1894[_0xcd9f('0x60')]['id'],_0x1f1894[_0xcd9f('0x60')][_0xcd9f('0x36')],_0x1f1894[_0xcd9f('0x60')][_0xcd9f('0x68')],_0x3101ac[_0xcd9f('0x66')]['id'],_0x1f1894[_0xcd9f('0x57')]?JSON[_0xcd9f('0x26')](_0x1f1894[_0xcd9f('0x57')]):_0xcd9f('0x69'));return respondWithRpcPromise(_0xcd9f('0x6a'),_0xcd9f('0x6b'),_0x3101ac);}return null;})[_0xcd9f('0x20')](function(_0x1c0a97){var _0x32345d='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x1c0a97[_0xcd9f('0x29')][_0xcd9f('0x6c')];return db[_0xcd9f('0x6d')][_0xcd9f('0x40')](_0x32345d,{'type':db[_0xcd9f('0x6e')][_0xcd9f('0x6f')]['SELECT'],'raw':!![]})['then'](function(_0x2180d6){return _0x2180d6;});})[_0xcd9f('0x20')](function(_0x12d12e){if(_0x12d12e){_0x3101ac[_0xcd9f('0x29')][_0xcd9f('0x70')]=_0x12d12e[0x0];if(!_0x1f1894[_0xcd9f('0x57')]['UserId'])return;return db[_0xcd9f('0x71')]['find']({'where':{'id':_0x1f1894['body'][_0xcd9f('0x5f')],'role':_0xcd9f('0x72')},'attributes':['id',_0xcd9f('0x36'),_0xcd9f('0x73'),_0xcd9f('0x74'),'internal'],'raw':!![]});}return null;})['then'](function(_0x25e787){if(!_0x25e787)return null;_0x3101ac[_0xcd9f('0x29')]['agent']=_0x25e787;return _0x3101ac;})['then'](function(_0x1fe52f){if(_0x1fe52f){if(_0x1f1894[_0xcd9f('0x57')][_0xcd9f('0x75')]){_0x3101ac[_0xcd9f('0x29')]['interface']=util[_0xcd9f('0x5e')](_0xcd9f('0x76'),_0x1f1894[_0xcd9f('0x60')][_0xcd9f('0x36')]);_0x3101ac[_0xcd9f('0x29')][_0xcd9f('0x77')]=_0x3101ac['channel'];_0x3101ac[_0xcd9f('0x29')][_0xcd9f('0x78')]=_0x3101ac[_0xcd9f('0x77')];_0x3101ac['message'][_0xcd9f('0x79')]=_0xcd9f('0x5b');return respondWithRpcPromise(_0xcd9f('0x7a'),'EventManager',{'event':_0xcd9f('0x7b'),'message':_0x3101ac[_0xcd9f('0x29')]},client9002)[_0xcd9f('0x20')](function(){return _0x3101ac;});}return _0x3101ac;}return null;})[_0xcd9f('0x20')](respondWithResult(_0x4ff633,null))[_0xcd9f('0x53')](handleError(_0x4ff633,null));};var interaction_log=require(_0xcd9f('0x5a'))(_0xcd9f('0x7c'));exports[_0xcd9f('0x31')]=function(_0x4c5a19,_0x511563,_0x196ae0){var _0x275e66={'agent':{},'channel':_0xcd9f('0x7d')};if(_0x4c5a19[_0xcd9f('0x57')]['id']){delete _0x4c5a19[_0xcd9f('0x57')]['id'];}_0x4c5a19[_0xcd9f('0x57')][_0xcd9f('0x5f')]=_0x4c5a19[_0xcd9f('0x57')][_0xcd9f('0x5f')]||_0x4c5a19[_0xcd9f('0x60')]['id'];_0x275e66['agent']['id']=_0x4c5a19[_0xcd9f('0x57')][_0xcd9f('0x5f')];return db[_0xcd9f('0x39')][_0xcd9f('0x56')]({'where':{'id':_0x4c5a19[_0xcd9f('0x58')]['id'],'UserId':null}})[_0xcd9f('0x20')](handleEntityNotFound(_0x511563,null))[_0xcd9f('0x20')](function(_0x779305){if(_0x779305){_0x275e66[_0xcd9f('0x29')]=_0x779305[_0xcd9f('0x7e')]({'plain':!![]});return db[_0xcd9f('0x61')][_0xcd9f('0x56')]({'where':{'id':_0x779305[_0xcd9f('0x62')]}});}return null;})[_0xcd9f('0x20')](handleEntityNotFound(_0x511563,null))[_0xcd9f('0x20')](function(_0x209a29){if(_0x209a29){_0x275e66['interaction']=_0x209a29[_0xcd9f('0x7e')]({'plain':!![]});interaction_log[_0xcd9f('0x21')](_0xcd9f('0x7f'),_0x4c5a19[_0xcd9f('0x60')]['id'],_0x4c5a19[_0xcd9f('0x60')]['name'],_0x4c5a19[_0xcd9f('0x60')][_0xcd9f('0x68')],_0x275e66[_0xcd9f('0x66')]['id'],_0x4c5a19[_0xcd9f('0x57')]?JSON['stringify'](_0x4c5a19[_0xcd9f('0x57')]):_0xcd9f('0x69'));return respondWithRpcPromise(_0xcd9f('0x80'),'rejectMessage',_0x275e66);}return null;})[_0xcd9f('0x20')](function(_0x1b6632){var _0x46fc62=_0xcd9f('0x81')+_0x1b6632[_0xcd9f('0x29')][_0xcd9f('0x6c')];return db[_0xcd9f('0x6d')][_0xcd9f('0x40')](_0x46fc62,{'type':db[_0xcd9f('0x6e')][_0xcd9f('0x6f')]['SELECT'],'raw':!![]})[_0xcd9f('0x20')](function(_0x195867){return _0x195867;});})['then'](function(_0x2e5dbf){if(_0x2e5dbf){_0x275e66['message'][_0xcd9f('0x70')]=_0x2e5dbf[0x0];if(!_0x4c5a19['body'][_0xcd9f('0x5f')])return;return db[_0xcd9f('0x71')][_0xcd9f('0x56')]({'where':{'id':_0x4c5a19[_0xcd9f('0x57')]['UserId'],'role':_0xcd9f('0x72')},'attributes':['id',_0xcd9f('0x36'),_0xcd9f('0x73'),_0xcd9f('0x74'),_0xcd9f('0x82')],'raw':!![]});}return null;})[_0xcd9f('0x20')](function(_0x4ddd74){if(!_0x4ddd74)return null;_0x275e66[_0xcd9f('0x29')][_0xcd9f('0x72')]=_0x4ddd74;return _0x275e66;})[_0xcd9f('0x20')](function(_0x3b5646){if(_0x3b5646){_0x3b5646[_0xcd9f('0x29')][_0xcd9f('0x83')]=util[_0xcd9f('0x5e')](_0xcd9f('0x76'),_0x4c5a19[_0xcd9f('0x60')]['name']);_0x3b5646[_0xcd9f('0x29')]['channel']=_0x275e66['channel'];_0x3b5646[_0xcd9f('0x29')][_0xcd9f('0x78')]=_0x275e66['channel'];_0x3b5646['message'][_0xcd9f('0x79')]=_0xcd9f('0x31');respondWithRpcPromise(_0xcd9f('0x7a'),_0xcd9f('0x7a'),{'event':_0xcd9f('0x84'),'message':_0x3b5646[_0xcd9f('0x29')]},client9002);return _0x275e66;}return null;})[_0xcd9f('0x20')](respondWithResult(_0x511563,null))['catch'](handleError(_0x511563,null));};exports[_0xcd9f('0x85')]=function(_0x291559,_0xf00bc2){var _0x20aa07;return db[_0xcd9f('0x39')]['create'](_0x291559[_0xcd9f('0x57')],{})['then'](function(_0x3c6842){_0x20aa07=_0x3c6842;return db[_0xcd9f('0x86')][_0xcd9f('0x87')]({'where':{'id':_0x20aa07['ContactId']}});})[_0xcd9f('0x20')](function(_0x4df5ac){if(_['isNil'](_0x4df5ac)){return;}else{_0x20aa07[_0xcd9f('0x7d')]=_0x4df5ac['fax'];return db[_0xcd9f('0x88')][_0xcd9f('0x87')]({'where':{'id':_0x20aa07[_0xcd9f('0x89')]}});}})[_0xcd9f('0x20')](function(_0xaf65dd){return respondWithRpcPromise(_0xcd9f('0x8a'),_0xcd9f('0x8a'),{'FaxAccountId':_['isNil'](_0x291559['body'])?undefined:_0x291559[_0xcd9f('0x57')][_0xcd9f('0x8b')],'path':_['isNil'](_0xaf65dd)?undefined:util[_0xcd9f('0x5e')]('/var/opt/motion2/server/files/attachments/%s',_0xaf65dd[_0xcd9f('0x8c')]),'fax':_[_0xcd9f('0x63')](_0x20aa07['fax'])?undefined:_0x20aa07['fax'],'AttachmentId':_0x20aa07[_0xcd9f('0x89')]},client9002);})[_0xcd9f('0x20')](respondWithResult(_0xf00bc2,0xc9))[_0xcd9f('0x53')](handleError(_0xf00bc2,null));};exports[_0xcd9f('0x8d')]=function(_0x345d63,_0x574b11){var _0x3fc7dc=path[_0xcd9f('0x8e')](config['root'],_0xcd9f('0x8f'),_0xcd9f('0x90'),_0xcd9f('0x91'));return db[_0xcd9f('0x39')][_0xcd9f('0x56')]({'where':{'id':_0x345d63['params']['id']},'include':[{'model':db[_0xcd9f('0x88')],'as':_0xcd9f('0x88')}]})[_0xcd9f('0x20')](handleEntityNotFound(_0x574b11,null))['then'](function(_0x2e20cd){if(_0x2e20cd){return _0x574b11[_0xcd9f('0x8d')](path['join'](_0x3fc7dc,_0x2e20cd[_0xcd9f('0x88')][_0xcd9f('0x8c')]));}})['catch'](handleError(_0x574b11,null));}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.events.js b/server/api/faxMessage/faxMessage.events.js index 6e34e36..f0086dc 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 _0xbea5=['../../mysqldb','setMaxListeners','save','update','remove','emit','exports','events'];(function(_0x547df,_0x5576f3){var _0x5c0b0b=function(_0x570196){while(--_0x570196){_0x547df['push'](_0x547df['shift']());}};_0x5c0b0b(++_0x5576f3);}(_0xbea5,0x177));var _0x5bea=function(_0x400b43,_0x55da4e){_0x400b43=_0x400b43-0x0;var _0x3c330f=_0xbea5[_0x400b43];return _0x3c330f;};'use strict';var EventEmitter=require(_0x5bea('0x0'));var FaxMessage=require(_0x5bea('0x1'))['db']['FaxMessage'];var FaxMessageEvents=new EventEmitter();FaxMessageEvents[_0x5bea('0x2')](0x0);var events={'afterCreate':_0x5bea('0x3'),'afterUpdate':_0x5bea('0x4'),'afterDestroy':_0x5bea('0x5')};function emitEvent(_0x1eb3b6){return function(_0x528183,_0x5cd985,_0xbf43f5){FaxMessageEvents['emit'](_0x1eb3b6+':'+_0x528183['id'],_0x528183);FaxMessageEvents[_0x5bea('0x6')](_0x1eb3b6,_0x528183);_0xbf43f5(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxMessage['hook'](e,emitEvent(event));}}module[_0x5bea('0x7')]=FaxMessageEvents; \ No newline at end of file +var _0x7d37=['FaxMessage','save','update','remove','emit','hasOwnProperty','exports','events','../../mysqldb'];(function(_0x3e384b,_0x59a016){var _0x33d8ff=function(_0x1674b8){while(--_0x1674b8){_0x3e384b['push'](_0x3e384b['shift']());}};_0x33d8ff(++_0x59a016);}(_0x7d37,0x1db));var _0x77d3=function(_0x453c53,_0x88c188){_0x453c53=_0x453c53-0x0;var _0x4e9de7=_0x7d37[_0x453c53];return _0x4e9de7;};'use strict';var EventEmitter=require(_0x77d3('0x0'));var FaxMessage=require(_0x77d3('0x1'))['db'][_0x77d3('0x2')];var FaxMessageEvents=new EventEmitter();FaxMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x77d3('0x3'),'afterUpdate':_0x77d3('0x4'),'afterDestroy':_0x77d3('0x5')};function emitEvent(_0x52c909){return function(_0x293f20,_0x2ae533,_0x59773d){FaxMessageEvents[_0x77d3('0x6')](_0x52c909+':'+_0x293f20['id'],_0x293f20);FaxMessageEvents['emit'](_0x52c909,_0x293f20);_0x59773d(null);};}for(var e in events){if(events[_0x77d3('0x7')](e)){var event=events[e];FaxMessage['hook'](e,emitEvent(event));}}module[_0x77d3('0x8')]=FaxMessageEvents; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.model.js b/server/api/faxMessage/faxMessage.model.js index b75489e..3ce07f6 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 _0xc9d9=['../../config/environment','./faxMessage.attributes','exports','FaxMessage','fax_messages','body','FULLTEXT','models','get','direction','toLowerCase','out','isNil','UserId','FaxInteraction','findOne','update','catch','error','utf8mb4','utf8mb4_unicode_ci','api','moment','request-promise','path','rimraf'];(function(_0x528d24,_0x2e9c32){var _0x30ac28=function(_0x140c27){while(--_0x140c27){_0x528d24['push'](_0x528d24['shift']());}};_0x30ac28(++_0x2e9c32);}(_0xc9d9,0x1cf));var _0x9c9d=function(_0x121cb0,_0x18bf4a){_0x121cb0=_0x121cb0-0x0;var _0x279ab9=_0xc9d9[_0x121cb0];return _0x279ab9;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x9c9d('0x0'));var moment=require(_0x9c9d('0x1'));var BPromise=require('bluebird');var rp=require(_0x9c9d('0x2'));var fs=require('fs');var path=require(_0x9c9d('0x3'));var rimraf=require(_0x9c9d('0x4'));var config=require(_0x9c9d('0x5'));var attributes=require(_0x9c9d('0x6'));module[_0x9c9d('0x7')]=function(_0x3f85e2,_0x3da6e2){return _0x3f85e2['define'](_0x9c9d('0x8'),attributes,{'tableName':_0x9c9d('0x9'),'paranoid':![],'indexes':[{'name':'fti_fax_messages','fields':[_0x9c9d('0xa')],'type':_0x9c9d('0xb')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x135539,_0x3ed511,_0x3cf639){var _0x1a0309=_0x3f85e2[_0x9c9d('0xc')];var _0x41d636=_0x135539[_0x9c9d('0xd')]({'plain':!![]});if(_0x41d636[_0x9c9d('0xe')]['toLowerCase']()==='in'||_0x41d636[_0x9c9d('0xe')][_0x9c9d('0xf')]()===_0x9c9d('0x10')&&!_0x41d636['secret']&&!_[_0x9c9d('0x11')](_0x41d636[_0x9c9d('0x12')])){_0x1a0309[_0x9c9d('0x13')][_0x9c9d('0x14')]({'where':{'id':_0x41d636['FaxInteractionId']}})['then'](function(_0xc92950){if(_0xc92950){_0xc92950[_0x9c9d('0x15')]({'lastMsgAt':_0x41d636['createdAt'],'lastMsgDirection':_0x41d636[_0x9c9d('0xe')][_0x9c9d('0xf')]()});}})[_0x9c9d('0x16')](function(_0x3f30f8){console[_0x9c9d('0x17')](_0x3f30f8);});}_0x3cf639();}},'charset':_0x9c9d('0x18'),'collate':_0x9c9d('0x19')});}; \ No newline at end of file +var _0xf873=['body','models','get','toLowerCase','direction','out','secret','isNil','UserId','FaxInteraction','FaxInteractionId','update','createdAt','catch','error','utf8mb4','lodash','util','api','moment','bluebird','request-promise','define','FaxMessage','fax_messages','fti_fax_messages'];(function(_0x545fe3,_0x3b191f){var _0x480702=function(_0x21c970){while(--_0x21c970){_0x545fe3['push'](_0x545fe3['shift']());}};_0x480702(++_0x3b191f);}(_0xf873,0x92));var _0x3f87=function(_0xcf5188,_0xeb7f72){_0xcf5188=_0xcf5188-0x0;var _0x550766=_0xf873[_0xcf5188];return _0x550766;};'use strict';var _=require(_0x3f87('0x0'));var util=require(_0x3f87('0x1'));var logger=require('../../config/logger')(_0x3f87('0x2'));var moment=require(_0x3f87('0x3'));var BPromise=require(_0x3f87('0x4'));var rp=require(_0x3f87('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./faxMessage.attributes');module['exports']=function(_0x28d1fd,_0x5ad8a3){return _0x28d1fd[_0x3f87('0x6')](_0x3f87('0x7'),attributes,{'tableName':_0x3f87('0x8'),'paranoid':![],'indexes':[{'name':_0x3f87('0x9'),'fields':[_0x3f87('0xa')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x2c9d75,_0x48b80d,_0x1137c7){var _0x6592fe=_0x28d1fd[_0x3f87('0xb')];var _0x2aff7f=_0x2c9d75[_0x3f87('0xc')]({'plain':!![]});if(_0x2aff7f['direction'][_0x3f87('0xd')]()==='in'||_0x2aff7f[_0x3f87('0xe')][_0x3f87('0xd')]()===_0x3f87('0xf')&&!_0x2aff7f[_0x3f87('0x10')]&&!_[_0x3f87('0x11')](_0x2aff7f[_0x3f87('0x12')])){_0x6592fe[_0x3f87('0x13')]['findOne']({'where':{'id':_0x2aff7f[_0x3f87('0x14')]}})['then'](function(_0x1657fa){if(_0x1657fa){_0x1657fa[_0x3f87('0x15')]({'lastMsgAt':_0x2aff7f[_0x3f87('0x16')],'lastMsgDirection':_0x2aff7f[_0x3f87('0xe')]['toLowerCase']()});}})[_0x3f87('0x17')](function(_0x493da1){console[_0x3f87('0x18')](_0x493da1);});}_0x1137c7();}},'charset':_0x3f87('0x19'),'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 2a438dd..db47bf9 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 _0x008c=['randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','socket.io-emitter','register','request','info','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','error','message','catch','options','raw','then','CreateFaxMessage','attributes','limit','UpdateFaxMessage','stringify','lodash','util','moment','bluebird'];(function(_0x425c5b,_0x5a23a5){var _0x3ec47a=function(_0x1aaef9){while(--_0x1aaef9){_0x425c5b['push'](_0x425c5b['shift']());}};_0x3ec47a(++_0x5a23a5);}(_0x008c,0x188));var _0xc008=function(_0x1455f3,_0x2eba86){_0x1455f3=_0x1455f3-0x0;var _0x2a2534=_0x008c[_0x1455f3];return _0x2a2534;};'use strict';var _=require(_0xc008('0x0'));var util=require(_0xc008('0x1'));var moment=require(_0xc008('0x2'));var BPromise=require(_0xc008('0x3'));var rs=require(_0xc008('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc008('0x5'))['db'];var utils=require(_0xc008('0x6'));var logger=require(_0xc008('0x7'))(_0xc008('0x8'));var config=require(_0xc008('0x9'));var jayson=require(_0xc008('0xa'));var client=jayson[_0xc008('0xb')][_0xc008('0xc')]({'port':0x232a});config[_0xc008('0xd')]=_['defaults'](config[_0xc008('0xd')],{'host':'localhost','port':0x18eb});var socket=require(_0xc008('0xe'))(new Redis(config['redis']));require('./faxMessage.socket')[_0xc008('0xf')](socket);function respondWithRpcPromise(_0x7231b4,_0x57c46d,_0x51ba7d){return new BPromise(function(_0x543eb8,_0x1eacfa){return client[_0xc008('0x10')](_0x7231b4,_0x51ba7d)['then'](function(_0xae2dab){logger[_0xc008('0x11')](_0xc008('0x12'),_0x57c46d,_0xc008('0x13'));logger[_0xc008('0x14')](_0xc008('0x15'),_0x57c46d,_0xc008('0x13'),JSON['stringify'](_0xae2dab));if(_0xae2dab['error']){if(_0xae2dab[_0xc008('0x16')]['code']===0x1f4){logger[_0xc008('0x16')](_0xc008('0x12'),_0x57c46d,_0xae2dab[_0xc008('0x16')][_0xc008('0x17')]);return _0x1eacfa(_0xae2dab[_0xc008('0x16')]['message']);}logger['error']('FaxMessage,\x20%s,\x20%s',_0x57c46d,_0xae2dab[_0xc008('0x16')][_0xc008('0x17')]);return _0x543eb8(_0xae2dab[_0xc008('0x16')][_0xc008('0x17')]);}else{logger['info']('FaxMessage,\x20%s,\x20%s',_0x57c46d,'request\x20sent');_0x543eb8(_0xae2dab['result'][_0xc008('0x17')]);}})[_0xc008('0x18')](function(_0x501137){logger[_0xc008('0x16')]('FaxMessage,\x20%s,\x20%s',_0x57c46d,_0x501137);_0x1eacfa(_0x501137);});});}exports['CreateFaxMessage']=function(_0x543e5d){var _0x50261c=this;return new Promise(function(_0x5754a0,_0x4b9726){return db['FaxMessage']['create'](_0x543e5d['body'],{'raw':_0x543e5d['options']?_0x543e5d[_0xc008('0x19')][_0xc008('0x1a')]===undefined?!![]:![]:!![]})[_0xc008('0x1b')](function(_0x415af3){logger[_0xc008('0x11')](_0xc008('0x1c'),_0x543e5d);logger['debug'](_0xc008('0x1c'),_0x543e5d,JSON['stringify'](_0x415af3));_0x5754a0(_0x415af3);})['catch'](function(_0x218599){logger[_0xc008('0x16')](_0xc008('0x1c'),_0x218599[_0xc008('0x17')],_0x543e5d);_0x4b9726(_0x50261c['error'](0x1f4,_0x218599['message']));});});};exports['UpdateFaxMessage']=function(_0x3f7b07){var _0x15dade=this;return new Promise(function(_0x92c582,_0x2e31c2){return db['FaxMessage']['update'](_0x3f7b07['body'],{'raw':_0x3f7b07['options']?_0x3f7b07['options'][_0xc008('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3f7b07[_0xc008('0x19')]?_0x3f7b07[_0xc008('0x19')]['where']||null:null,'attributes':_0x3f7b07[_0xc008('0x19')]?_0x3f7b07[_0xc008('0x19')][_0xc008('0x1d')]||null:null,'limit':_0x3f7b07[_0xc008('0x19')]?_0x3f7b07['options'][_0xc008('0x1e')]||null:null})[_0xc008('0x1b')](function(_0x53ed35){logger['info']('UpdateFaxMessage',_0x3f7b07);logger[_0xc008('0x14')](_0xc008('0x1f'),_0x3f7b07,JSON[_0xc008('0x20')](_0x53ed35));_0x92c582(_0x53ed35);})[_0xc008('0x18')](function(_0x1de04b){logger[_0xc008('0x16')](_0xc008('0x1f'),_0x1de04b[_0xc008('0x17')],_0x3f7b07);_0x2e31c2(_0x15dade[_0xc008('0x16')](0x1f4,_0x1de04b[_0xc008('0x17')]));});});}; \ No newline at end of file +var _0x425d=['lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./faxMessage.socket','register','request','then','info','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','CreateFaxMessage','FaxMessage','body','options','raw','catch','UpdateFaxMessage','where','attributes','limit'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x425d,0x1e0));var _0xd425=function(_0x58bf72,_0x270672){_0x58bf72=_0x58bf72-0x0;var _0x5ac3aa=_0x425d[_0x58bf72];return _0x5ac3aa;};'use strict';var _=require(_0xd425('0x0'));var util=require('util');var moment=require(_0xd425('0x1'));var BPromise=require(_0xd425('0x2'));var rs=require(_0xd425('0x3'));var fs=require('fs');var Redis=require(_0xd425('0x4'));var db=require(_0xd425('0x5'))['db'];var utils=require(_0xd425('0x6'));var logger=require(_0xd425('0x7'))('rpc');var config=require(_0xd425('0x8'));var jayson=require(_0xd425('0x9'));var client=jayson[_0xd425('0xa')][_0xd425('0xb')]({'port':0x232a});config[_0xd425('0xc')]=_[_0xd425('0xd')](config['redis'],{'host':_0xd425('0xe'),'port':0x18eb});var socket=require(_0xd425('0xf'))(new Redis(config[_0xd425('0xc')]));require(_0xd425('0x10'))[_0xd425('0x11')](socket);function respondWithRpcPromise(_0x2beb20,_0x30111e,_0x1969ba){return new BPromise(function(_0x3a7a01,_0x35a7f4){return client[_0xd425('0x12')](_0x2beb20,_0x1969ba)[_0xd425('0x13')](function(_0x26f6d2){logger[_0xd425('0x14')](_0xd425('0x15'),_0x30111e,_0xd425('0x16'));logger[_0xd425('0x17')](_0xd425('0x18'),_0x30111e,_0xd425('0x16'),JSON[_0xd425('0x19')](_0x26f6d2));if(_0x26f6d2['error']){if(_0x26f6d2[_0xd425('0x1a')][_0xd425('0x1b')]===0x1f4){logger[_0xd425('0x1a')]('FaxMessage,\x20%s,\x20%s',_0x30111e,_0x26f6d2[_0xd425('0x1a')][_0xd425('0x1c')]);return _0x35a7f4(_0x26f6d2[_0xd425('0x1a')][_0xd425('0x1c')]);}logger[_0xd425('0x1a')]('FaxMessage,\x20%s,\x20%s',_0x30111e,_0x26f6d2[_0xd425('0x1a')][_0xd425('0x1c')]);return _0x3a7a01(_0x26f6d2[_0xd425('0x1a')][_0xd425('0x1c')]);}else{logger['info'](_0xd425('0x15'),_0x30111e,_0xd425('0x16'));_0x3a7a01(_0x26f6d2[_0xd425('0x1d')][_0xd425('0x1c')]);}})['catch'](function(_0x58a0c1){logger['error']('FaxMessage,\x20%s,\x20%s',_0x30111e,_0x58a0c1);_0x35a7f4(_0x58a0c1);});});}exports[_0xd425('0x1e')]=function(_0xb92870){var _0x3c98db=this;return new Promise(function(_0x5e797a,_0x355af0){return db[_0xd425('0x1f')]['create'](_0xb92870[_0xd425('0x20')],{'raw':_0xb92870[_0xd425('0x21')]?_0xb92870[_0xd425('0x21')][_0xd425('0x22')]===undefined?!![]:![]:!![]})[_0xd425('0x13')](function(_0xb240c4){logger[_0xd425('0x14')](_0xd425('0x1e'),_0xb92870);logger[_0xd425('0x17')](_0xd425('0x1e'),_0xb92870,JSON[_0xd425('0x19')](_0xb240c4));_0x5e797a(_0xb240c4);})[_0xd425('0x23')](function(_0x47f44a){logger[_0xd425('0x1a')](_0xd425('0x1e'),_0x47f44a[_0xd425('0x1c')],_0xb92870);_0x355af0(_0x3c98db[_0xd425('0x1a')](0x1f4,_0x47f44a[_0xd425('0x1c')]));});});};exports[_0xd425('0x24')]=function(_0x3c3402){var _0x577e4b=this;return new Promise(function(_0x12f951,_0x177de2){return db[_0xd425('0x1f')]['update'](_0x3c3402[_0xd425('0x20')],{'raw':_0x3c3402[_0xd425('0x21')]?_0x3c3402[_0xd425('0x21')][_0xd425('0x22')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3c3402[_0xd425('0x21')]?_0x3c3402[_0xd425('0x21')][_0xd425('0x25')]||null:null,'attributes':_0x3c3402[_0xd425('0x21')]?_0x3c3402[_0xd425('0x21')][_0xd425('0x26')]||null:null,'limit':_0x3c3402['options']?_0x3c3402[_0xd425('0x21')][_0xd425('0x27')]||null:null})[_0xd425('0x13')](function(_0x3695dd){logger[_0xd425('0x14')](_0xd425('0x24'),_0x3c3402);logger[_0xd425('0x17')](_0xd425('0x24'),_0x3c3402,JSON[_0xd425('0x19')](_0x3695dd));_0x12f951(_0x3695dd);})[_0xd425('0x23')](function(_0x3583b0){logger['error'](_0xd425('0x24'),_0x3583b0[_0xd425('0x1c')],_0x3c3402);_0x177de2(_0x577e4b[_0xd425('0x1a')](0x1f4,_0x3583b0[_0xd425('0x1c')]));});});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.socket.js b/server/api/faxMessage/faxMessage.socket.js index bfa9a53..5fff965 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 _0xdf48=['length','faxMessage:','save','remove','update','emit','removeListener','register'];(function(_0x3be452,_0x13943f){var _0x49ce45=function(_0x4cf632){while(--_0x4cf632){_0x3be452['push'](_0x3be452['shift']());}};_0x49ce45(++_0x13943f);}(_0xdf48,0x7a));var _0x8df4=function(_0x428e26,_0x52cc9f){_0x428e26=_0x428e26-0x0;var _0x3c525e=_0xdf48[_0x428e26];return _0x3c525e;};'use strict';var FaxMessageEvents=require('./faxMessage.events');var events=[_0x8df4('0x0'),_0x8df4('0x1'),_0x8df4('0x2')];function createListener(_0x4b74b0,_0x384d3a){return function(_0x41d137){_0x384d3a[_0x8df4('0x3')](_0x4b74b0,_0x41d137);};}function removeListener(_0x3e0bf4,_0x5219b0){return function(){FaxMessageEvents[_0x8df4('0x4')](_0x3e0bf4,_0x5219b0);};}exports[_0x8df4('0x5')]=function(_0x4adf05){for(var _0xff7c9f=0x0,_0x3a3708=events[_0x8df4('0x6')];_0xff7c9f<_0x3a3708;_0xff7c9f++){var _0x6368dd=events[_0xff7c9f];var _0x3c7d66=createListener(_0x8df4('0x7')+_0x6368dd,_0x4adf05);FaxMessageEvents['on'](_0x6368dd,_0x3c7d66);}}; \ No newline at end of file +var _0xf967=['save','remove','update','register','faxMessage:','./faxMessage.events'];(function(_0x4331f8,_0xe06640){var _0x44a1a5=function(_0x2c5e92){while(--_0x2c5e92){_0x4331f8['push'](_0x4331f8['shift']());}};_0x44a1a5(++_0xe06640);}(_0xf967,0x119));var _0x7f96=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0xf967[_0x4b369d];return _0x571a98;};'use strict';var FaxMessageEvents=require(_0x7f96('0x0'));var events=[_0x7f96('0x1'),_0x7f96('0x2'),_0x7f96('0x3')];function createListener(_0x208148,_0x2aa9a0){return function(_0xb24a74){_0x2aa9a0['emit'](_0x208148,_0xb24a74);};}function removeListener(_0x14459d,_0x34b65){return function(){FaxMessageEvents['removeListener'](_0x14459d,_0x34b65);};}exports[_0x7f96('0x4')]=function(_0xdb3f99){for(var _0x48a183=0x0,_0x25b2ba=events['length'];_0x48a183<_0x25b2ba;_0x48a183++){var _0x19d975=events[_0x48a183];var _0x166a8a=createListener(_0x7f96('0x5')+_0x19d975,_0xdb3f99);FaxMessageEvents['on'](_0x19d975,_0x166a8a);}}; \ No newline at end of file diff --git a/server/api/faxMessage/index.js b/server/api/faxMessage/index.js index e50962d..573fc71 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 _0x16d2=['./faxMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/download','post','tracked','fax','faxmessage:create','create','put','update','/:id/accept','/:id/reject','reject','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x450bf9,_0x1895de){var _0x268350=function(_0xebafa7){while(--_0xebafa7){_0x450bf9['push'](_0x450bf9['shift']());}};_0x268350(++_0x1895de);}(_0x16d2,0x123));var _0x216d=function(_0x298fd6,_0x45bcb){_0x298fd6=_0x298fd6-0x0;var _0x3a28c6=_0x16d2[_0x298fd6];return _0x3a28c6;};'use strict';var multer=require(_0x216d('0x0'));var util=require(_0x216d('0x1'));var path=require(_0x216d('0x2'));var timeout=require(_0x216d('0x3'));var express=require(_0x216d('0x4'));var router=express[_0x216d('0x5')]();var fs_extra=require(_0x216d('0x6'));var auth=require(_0x216d('0x7'));var interaction=require(_0x216d('0x8'));var config=require('../../config/environment');var controller=require(_0x216d('0x9'));router[_0x216d('0xa')]('/',auth[_0x216d('0xb')](),controller[_0x216d('0xc')]);router[_0x216d('0xa')](_0x216d('0xd'),auth[_0x216d('0xb')](),controller[_0x216d('0xe')]);router['get'](_0x216d('0xf'),auth[_0x216d('0xb')](),controller[_0x216d('0x10')]);router[_0x216d('0xa')](_0x216d('0x11'),auth[_0x216d('0xb')](),controller['download']);router[_0x216d('0x12')]('/',auth['isAuthenticated'](),interaction[_0x216d('0x13')](_0x216d('0x14'),_0x216d('0x15')),controller[_0x216d('0x16')]);router[_0x216d('0x17')](_0x216d('0xf'),auth['isAuthenticated'](),controller[_0x216d('0x18')]);router['put'](_0x216d('0x19'),auth[_0x216d('0xb')](),controller['accept']);router[_0x216d('0x17')](_0x216d('0x1a'),auth['isAuthenticated'](),controller[_0x216d('0x1b')]);router['delete'](_0x216d('0xf'),auth[_0x216d('0xb')](),controller[_0x216d('0x1c')]);module[_0x216d('0x1d')]=router; \ No newline at end of file +var _0x7072=['/:id/download','download','post','tracked','fax','faxmessage:create','create','put','accept','/:id/reject','delete','exports','util','path','connect-timeout','express','Router','../../components/interaction/service','./faxMessage.controller','get','isAuthenticated','index','/describe','describe','/:id'];(function(_0xe48598,_0x2eca40){var _0x200b0e=function(_0x5dc47b){while(--_0x5dc47b){_0xe48598['push'](_0xe48598['shift']());}};_0x200b0e(++_0x2eca40);}(_0x7072,0x138));var _0x2707=function(_0x17b6e3,_0x4522ed){_0x17b6e3=_0x17b6e3-0x0;var _0x3906f3=_0x7072[_0x17b6e3];return _0x3906f3;};'use strict';var multer=require('multer');var util=require(_0x2707('0x0'));var path=require(_0x2707('0x1'));var timeout=require(_0x2707('0x2'));var express=require(_0x2707('0x3'));var router=express[_0x2707('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x2707('0x5'));var config=require('../../config/environment');var controller=require(_0x2707('0x6'));router[_0x2707('0x7')]('/',auth[_0x2707('0x8')](),controller[_0x2707('0x9')]);router[_0x2707('0x7')](_0x2707('0xa'),auth[_0x2707('0x8')](),controller[_0x2707('0xb')]);router[_0x2707('0x7')](_0x2707('0xc'),auth['isAuthenticated'](),controller['show']);router[_0x2707('0x7')](_0x2707('0xd'),auth[_0x2707('0x8')](),controller[_0x2707('0xe')]);router[_0x2707('0xf')]('/',auth[_0x2707('0x8')](),interaction[_0x2707('0x10')](_0x2707('0x11'),_0x2707('0x12')),controller[_0x2707('0x13')]);router[_0x2707('0x14')](_0x2707('0xc'),auth[_0x2707('0x8')](),controller['update']);router[_0x2707('0x14')]('/:id/accept',auth[_0x2707('0x8')](),controller[_0x2707('0x15')]);router[_0x2707('0x14')](_0x2707('0x16'),auth[_0x2707('0x8')](),controller['reject']);router[_0x2707('0x17')](_0x2707('0xc'),auth[_0x2707('0x8')](),controller['destroy']);module[_0x2707('0x18')]=router; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.attributes.js b/server/api/faxQueue/faxQueue.attributes.js index 164524a..dcdefd7 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 _0x20dc=['sequelize','STRING','name','INTEGER','ENUM','rrmemory','beepall','roundrobin'];(function(_0xa6d0c4,_0x36f539){var _0x3f5569=function(_0x50551a){while(--_0x50551a){_0xa6d0c4['push'](_0xa6d0c4['shift']());}};_0x3f5569(++_0x36f539);}(_0x20dc,0xb8));var _0xc20d=function(_0x9d1e6b,_0x3bdc22){_0x9d1e6b=_0x9d1e6b-0x0;var _0x2b3070=_0x20dc[_0x9d1e6b];return _0x2b3070;};'use strict';var Sequelize=require(_0xc20d('0x0'));module['exports']={'name':{'type':Sequelize[_0xc20d('0x1')],'unique':_0xc20d('0x2'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xc20d('0x1')]},'timeout':{'type':Sequelize[_0xc20d('0x3')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xc20d('0x4')](_0xc20d('0x5'),_0xc20d('0x6'),_0xc20d('0x7')),'allowNull':![]},'lastAgent':{'type':Sequelize[_0xc20d('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0x1d91=['sequelize','exports','STRING','INTEGER','ENUM','rrmemory','roundrobin'];(function(_0x579b79,_0x5b57b2){var _0x41e899=function(_0x2c8b7){while(--_0x2c8b7){_0x579b79['push'](_0x579b79['shift']());}};_0x41e899(++_0x5b57b2);}(_0x1d91,0x150));var _0x11d9=function(_0x29aa8f,_0x3c9ade){_0x29aa8f=_0x29aa8f-0x0;var _0x4f94cb=_0x1d91[_0x29aa8f];return _0x4f94cb;};'use strict';var Sequelize=require(_0x11d9('0x0'));module[_0x11d9('0x1')]={'name':{'type':Sequelize[_0x11d9('0x2')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x11d9('0x2')]},'timeout':{'type':Sequelize[_0x11d9('0x3')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x11d9('0x4')](_0x11d9('0x5'),'beepall',_0x11d9('0x6')),'allowNull':![]},'lastAgent':{'type':Sequelize[_0x11d9('0x3')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.controller.js b/server/api/faxQueue/faxQueue.controller.js index 8b5676d..941aa01 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 _0x38b8=['value','removeAgents','userFaxQueue:remove','addAgents','spread','isArray','getAgents','bluebird','lodash','squel','../../components/parsers/qs','../../config/environment','../../mysqldb','redis','localhost','./faxQueue.socket','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','update','then','destroy','get','UserProfileResource','error','stack','name','send','map','rawAttributes','type','key','query','FaxQueue','findAll','rows','catch','show','params','keys','filters','intersection','model','fields','attributes','length','include','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','FaxQueues','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','hasOwnProperty','order','sort','where','FaxQueueId','filter','merge','UserFaxQueue','User','findAndCountAll','UserId','updatedAt','createdAt','format','%s/%s','SIP','faxPause','getTeams','pick','nolimit','ids','Team','voicePause','flatMap','Agents','sequelize','transaction','each','findOrCreate','forEach','emit','userFaxQueue:save','removeTeams','select','field','tq.TeamId','from','team_has_fax_queues','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','FaxQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','QueryTypes','SELECT','every','TeamId','all','union','compact'];(function(_0x3d0d48,_0x12cb00){var _0x384d2a=function(_0x37d175){while(--_0x37d175){_0x3d0d48['push'](_0x3d0d48['shift']());}};_0x384d2a(++_0x12cb00);}(_0x38b8,0x7f));var _0x838b=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x38b8[_0x14add3];return _0x4a174f;};'use strict';var BPromise=require(_0x838b('0x0'));var util=require('util');var _=require(_0x838b('0x1'));var squel=require(_0x838b('0x2'));var Redis=require('ioredis');var qs=require(_0x838b('0x3'));var logger=require('../../config/logger')('api');var config=require(_0x838b('0x4'));var db=require(_0x838b('0x5'))['db'];config['redis']=_['defaults'](config[_0x838b('0x6')],{'host':_0x838b('0x7'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x838b('0x6')]));require(_0x838b('0x8'))['register'](socket);function respondWithStatusCode(_0x552245,_0x1a6bc0){_0x1a6bc0=_0x1a6bc0||0xcc;return function(_0x1a4797){if(_0x1a4797){return _0x552245[_0x838b('0x9')](_0x1a6bc0);}return _0x552245['status'](_0x1a6bc0)[_0x838b('0xa')]();};}function respondWithResult(_0x51cf71,_0x3884e3){_0x3884e3=_0x3884e3||0xc8;return function(_0x24ce13){if(_0x24ce13){return _0x51cf71[_0x838b('0xb')](_0x3884e3)[_0x838b('0xc')](_0x24ce13);}};}function respondWithFilteredResult(_0x241e6a,_0x263a96){return function(_0x4d2c3b){if(_0x4d2c3b){var _0x3a57cf=typeof _0x263a96[_0x838b('0xd')]===_0x838b('0xe')&&typeof _0x263a96[_0x838b('0xf')]===_0x838b('0xe');var _0x21cc45=_0x4d2c3b[_0x838b('0x10')];var _0x3324de=_0x3a57cf?0x0:_0x263a96[_0x838b('0xd')];var _0x525c60=_0x3a57cf?_0x4d2c3b[_0x838b('0x10')]:_0x263a96['offset']+_0x263a96['limit'];var _0x584b04;if(_0x525c60>=_0x21cc45){_0x525c60=_0x21cc45;_0x584b04=0xc8;}else{_0x584b04=0xce;}_0x241e6a[_0x838b('0xb')](_0x584b04);return _0x241e6a[_0x838b('0x11')](_0x838b('0x12'),_0x3324de+'-'+_0x525c60+'/'+_0x21cc45)[_0x838b('0xc')](_0x4d2c3b);}return null;};}function saveUpdates(_0x94e893){return function(_0x4a729e){if(_0x4a729e){return _0x4a729e[_0x838b('0x13')](_0x94e893)[_0x838b('0x14')](function(_0x44a62c){return _0x44a62c;});}return null;};}function removeEntity(_0x1e4f5f){return function(_0x48c4ab){if(_0x48c4ab){return _0x48c4ab[_0x838b('0x15')]()[_0x838b('0x14')](function(){var _0x49f209=_0x48c4ab[_0x838b('0x16')]({'plain':!![]});var _0x46eedc='FaxQueues';return db[_0x838b('0x17')][_0x838b('0x15')]({'where':{'type':_0x46eedc,'resourceId':_0x49f209['id']}})[_0x838b('0x14')](function(){return _0x48c4ab;});})['then'](function(){_0x1e4f5f[_0x838b('0xb')](0xcc)[_0x838b('0xa')]();});}};}function handleEntityNotFound(_0x119e4e){return function(_0x1a5241){if(!_0x1a5241){_0x119e4e[_0x838b('0x9')](0x194);}return _0x1a5241;};}function handleError(_0x3f8848,_0x11de0e){_0x11de0e=_0x11de0e||0x1f4;return function(_0x3da3f1){logger[_0x838b('0x18')](_0x3da3f1[_0x838b('0x19')]);if(_0x3da3f1[_0x838b('0x1a')]){delete _0x3da3f1[_0x838b('0x1a')];}_0x3f8848[_0x838b('0xb')](_0x11de0e)[_0x838b('0x1b')](_0x3da3f1);};}exports['index']=function(_0xb9b05f,_0x59be76){var _0x51adc6={};var _0x430400={'count':0x0,'rows':[]};var _0x2bc24c=_[_0x838b('0x1c')](db['FaxQueue'][_0x838b('0x1d')],function(_0x27f385){return{'name':_0x27f385['fieldName'],'type':_0x27f385[_0x838b('0x1e')][_0x838b('0x1f')]};});_0x51adc6=qs['getOptions'](_0x2bc24c,_0xb9b05f);var _0x576bfa={'where':_0x51adc6['where']};return db['FaxQueue']['count'](_0x576bfa)['then'](function(_0x1e74a6){_0x430400[_0x838b('0x10')]=_0x1e74a6;_0x51adc6['include']=qs['include'](_0xb9b05f[_0x838b('0x20')]);return db[_0x838b('0x21')][_0x838b('0x22')](_0x51adc6);})[_0x838b('0x14')](function(_0x16c081){_0x430400[_0x838b('0x23')]=_0x16c081;return _0x430400;})[_0x838b('0x14')](respondWithFilteredResult(_0x59be76,_0x51adc6))[_0x838b('0x24')](handleError(_0x59be76,null));};exports[_0x838b('0x25')]=function(_0x549a0e,_0xe392b1){var _0x756dcc={'raw':!![],'where':{'id':_0x549a0e[_0x838b('0x26')]['id']}},_0xd4f382={};_0xd4f382['model']=_[_0x838b('0x27')](db[_0x838b('0x21')][_0x838b('0x1d')]);_0xd4f382[_0x838b('0x20')]=_[_0x838b('0x27')](_0x549a0e['query']);_0xd4f382[_0x838b('0x28')]=_[_0x838b('0x29')](_0xd4f382[_0x838b('0x2a')],_0xd4f382[_0x838b('0x20')]);_0x756dcc['attributes']=_[_0x838b('0x29')](_0xd4f382[_0x838b('0x2a')],qs['fields'](_0x549a0e[_0x838b('0x20')][_0x838b('0x2b')]));_0x756dcc[_0x838b('0x2c')]=_0x756dcc[_0x838b('0x2c')][_0x838b('0x2d')]?_0x756dcc['attributes']:_0xd4f382[_0x838b('0x2a')];if(_0x549a0e[_0x838b('0x20')]['includeAll']){_0x756dcc[_0x838b('0x2e')]=[{'all':!![]}];}_0x756dcc=_['merge']({},_0x756dcc,_0x549a0e[_0x838b('0x2f')]);return db['FaxQueue'][_0x838b('0x30')](_0x756dcc)['then'](handleEntityNotFound(_0xe392b1,null))[_0x838b('0x14')](respondWithResult(_0xe392b1,null))[_0x838b('0x24')](handleError(_0xe392b1,null));};exports[_0x838b('0x31')]=function(_0x47460d,_0x476db0){return db[_0x838b('0x21')][_0x838b('0x31')](_0x47460d[_0x838b('0x32')],{})[_0x838b('0x14')](function(_0x1fec60){var _0x4ee9c2=_0x47460d[_0x838b('0x33')]['get']({'plain':!![]});if(!_0x4ee9c2)throw new Error(_0x838b('0x34'));if(_0x4ee9c2[_0x838b('0x35')]===_0x838b('0x33')){var _0x11a7c5=_0x1fec60[_0x838b('0x16')]({'plain':!![]});var _0x3934b7=_0x838b('0x36');return db[_0x838b('0x37')]['find']({'where':{'name':_0x3934b7,'userProfileId':_0x4ee9c2[_0x838b('0x38')]},'raw':!![]})[_0x838b('0x14')](function(_0x18db4f){if(_0x18db4f&&_0x18db4f[_0x838b('0x39')]===0x0){return db[_0x838b('0x17')][_0x838b('0x31')]({'name':_0x11a7c5['name'],'resourceId':_0x11a7c5['id'],'type':_0x18db4f[_0x838b('0x1a')],'sectionId':_0x18db4f['id']},{})['then'](function(){return _0x1fec60;});}else{return _0x1fec60;}})[_0x838b('0x24')](function(_0x3e67de){logger['error'](_0x838b('0x3a'),_0x3e67de);throw _0x3e67de;});}return _0x1fec60;})[_0x838b('0x14')](respondWithResult(_0x476db0,0xc9))[_0x838b('0x24')](handleError(_0x476db0,null));};exports[_0x838b('0x13')]=function(_0x4a66fb,_0x51689a){if(_0x4a66fb[_0x838b('0x32')]['id']){delete _0x4a66fb[_0x838b('0x32')]['id'];}return db['FaxQueue'][_0x838b('0x30')]({'where':{'id':_0x4a66fb['params']['id']}})[_0x838b('0x14')](handleEntityNotFound(_0x51689a,null))[_0x838b('0x14')](saveUpdates(_0x4a66fb[_0x838b('0x32')],null))[_0x838b('0x14')](respondWithResult(_0x51689a,null))[_0x838b('0x24')](handleError(_0x51689a,null));};exports['destroy']=function(_0x12e816,_0x5f42a7){return db[_0x838b('0x21')]['find']({'where':{'id':_0x12e816[_0x838b('0x26')]['id']}})[_0x838b('0x14')](handleEntityNotFound(_0x5f42a7,null))['then'](removeEntity(_0x5f42a7,null))[_0x838b('0x24')](handleError(_0x5f42a7,null));};exports[_0x838b('0x3b')]=function(_0x5c1fd2,_0x2e665c){return db['FaxQueue'][_0x838b('0x3b')]()[_0x838b('0x14')](respondWithResult(_0x2e665c,null))['catch'](handleError(_0x2e665c,null));};exports[_0x838b('0x3c')]=function(_0x5739ff,_0x4d7336){var _0x55f812={'raw':!![],'where':{}},_0x583bda={},_0x2aa6b7;return db[_0x838b('0x21')][_0x838b('0x3d')]({'where':{'id':_0x5739ff[_0x838b('0x26')]['id']}})[_0x838b('0x14')](handleEntityNotFound(_0x4d7336,null))[_0x838b('0x14')](function(_0x5ebde7){if(_0x5ebde7){_0x2aa6b7=_0x5ebde7[_0x838b('0x16')]({'plain':!![]});_0x583bda['model']=_[_0x838b('0x27')](db['UserFaxQueue'][_0x838b('0x1d')]);_0x583bda[_0x838b('0x20')]=_[_0x838b('0x27')](_0x5739ff[_0x838b('0x20')]);_0x583bda[_0x838b('0x28')]=_['intersection'](_0x583bda['model'],_0x583bda[_0x838b('0x20')]);_0x55f812[_0x838b('0x2c')]=_['intersection'](_0x583bda['model'],qs[_0x838b('0x2b')](_0x5739ff[_0x838b('0x20')][_0x838b('0x2b')]));_0x55f812[_0x838b('0x2c')]=_0x55f812[_0x838b('0x2c')][_0x838b('0x2d')]?_0x55f812[_0x838b('0x2c')]:_0x583bda[_0x838b('0x2a')];if(!_0x5739ff[_0x838b('0x20')][_0x838b('0x3e')]('nolimit')){_0x55f812['limit']=qs['limit'](_0x5739ff[_0x838b('0x20')][_0x838b('0xf')]);_0x55f812[_0x838b('0xd')]=qs[_0x838b('0xd')](_0x5739ff[_0x838b('0x20')]['offset']);}_0x55f812[_0x838b('0x3f')]=qs['sort'](_0x5739ff['query'][_0x838b('0x40')]);_0x55f812[_0x838b('0x41')]=qs[_0x838b('0x28')](_['pick'](_0x5739ff[_0x838b('0x20')],_0x583bda[_0x838b('0x28')]));_0x55f812[_0x838b('0x41')][_0x838b('0x42')]=_0x5ebde7['id'];if(_0x5739ff[_0x838b('0x20')][_0x838b('0x43')]){_0x55f812['where']=_[_0x838b('0x44')](_0x55f812[_0x838b('0x41')],{'$or':_[_0x838b('0x1c')](_0x55f812[_0x838b('0x2c')],function(_0x3b73ba){var _0x122b52={};_0x122b52[_0x3b73ba]={'$like':'%'+_0x5739ff[_0x838b('0x20')]['filter']+'%'};return _0x122b52;})});}_0x55f812=_[_0x838b('0x44')]({},_0x55f812,_0x5739ff[_0x838b('0x2f')]);return db[_0x838b('0x45')][_0x838b('0x22')](_0x55f812);}})[_0x838b('0x14')](function(_0x359056){if(_0x359056){return db[_0x838b('0x46')][_0x838b('0x47')]({'where':{'id':_[_0x838b('0x1c')](_0x359056,_0x838b('0x48')),'role':'agent'},'attributes':['id',_0x838b('0x1a'),'faxPause',_0x838b('0x49'),_0x838b('0x4a')]});}})[_0x838b('0x14')](function(_0x164e01){if(_0x164e01){return{'count':_0x164e01[_0x838b('0x10')],'rows':_[_0x838b('0x1c')](_0x164e01['rows'],function(_0x393270){return{'membername':_0x393270[_0x838b('0x1a')],'UserId':_0x393270['id'],'queue_name':_0x2aa6b7[_0x838b('0x1a')],'FaxQueueId':_0x2aa6b7['id'],'interface':util[_0x838b('0x4b')](_0x838b('0x4c'),_0x838b('0x4d'),_0x393270[_0x838b('0x1a')]),'penalty':0x0,'paused':_0x393270[_0x838b('0x4e')],'createdAt':_0x393270[_0x838b('0x4a')],'updatedAt':_0x393270[_0x838b('0x49')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x838b('0x14')](respondWithFilteredResult(_0x4d7336,_0x55f812))[_0x838b('0x24')](handleError(_0x4d7336,null));};exports[_0x838b('0x4f')]=function(_0xad196e,_0x5503c1){var _0x197865={};var _0x5f182c={};var _0x4e377d;var _0x2e2c91;return db['FaxQueue'][_0x838b('0x3d')]({'where':{'id':_0xad196e[_0x838b('0x26')]['id']}})[_0x838b('0x14')](handleEntityNotFound(_0x5503c1,null))[_0x838b('0x14')](function(_0x2fd614){if(_0x2fd614){_0x4e377d=_0x2fd614;_0x5f182c[_0x838b('0x2a')]=_['keys'](db['Team'][_0x838b('0x1d')]);_0x5f182c[_0x838b('0x20')]=_[_0x838b('0x27')](_0xad196e[_0x838b('0x20')]);_0x5f182c['filters']=_['intersection'](_0x5f182c['model'],_0x5f182c[_0x838b('0x20')]);_0x197865[_0x838b('0x2c')]=_['intersection'](_0x5f182c[_0x838b('0x2a')],qs['fields'](_0xad196e[_0x838b('0x20')]['fields']));_0x197865['attributes']=_0x197865['attributes']['length']?_0x197865[_0x838b('0x2c')]:_0x5f182c[_0x838b('0x2a')];_0x197865['order']=qs[_0x838b('0x40')](_0xad196e['query'][_0x838b('0x40')]);_0x197865[_0x838b('0x41')]=qs[_0x838b('0x28')](_[_0x838b('0x50')](_0xad196e[_0x838b('0x20')],_0x5f182c[_0x838b('0x28')]));if(_0xad196e[_0x838b('0x20')][_0x838b('0x43')]){_0x197865['where']=_[_0x838b('0x44')](_0x197865[_0x838b('0x41')],{'$or':_[_0x838b('0x1c')](_0x197865[_0x838b('0x2c')],function(_0x537c21){var _0x59e508={};_0x59e508[_0x537c21]={'$like':'%'+_0xad196e[_0x838b('0x20')]['filter']+'%'};return _0x59e508;})});}_0x197865=_[_0x838b('0x44')]({},_0x197865,_0xad196e[_0x838b('0x2f')]);return _0x4e377d[_0x838b('0x4f')](_0x197865);}})[_0x838b('0x14')](function(_0x4710ce){if(_0x4710ce){_0x2e2c91=_0x4710ce[_0x838b('0x2d')];if(!_0xad196e[_0x838b('0x20')][_0x838b('0x3e')](_0x838b('0x51'))){_0x197865[_0x838b('0xf')]=qs[_0x838b('0xf')](_0xad196e['query'][_0x838b('0xf')]);_0x197865['offset']=qs['offset'](_0xad196e[_0x838b('0x20')][_0x838b('0xd')]);}return _0x4e377d[_0x838b('0x4f')](_0x197865);}})[_0x838b('0x14')](function(_0x5a301d){if(_0x5a301d){return _0x5a301d?{'count':_0x2e2c91,'rows':_0x5a301d}:null;}})[_0x838b('0x14')](respondWithResult(_0x5503c1,null))[_0x838b('0x24')](handleError(_0x5503c1,null));};exports['addTeams']=function(_0x4fe3c6,_0x42c3a5){var _0x47566b=_0x4fe3c6['body'][_0x838b('0x52')];return db[_0x838b('0x53')]['findAll']({'where':{'id':_0x47566b},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id',_0x838b('0x1a'),'online',_0x838b('0x54'),'interface'],'raw':!![]}]})[_0x838b('0x14')](function(_0x2c8ea5){if(_0x2c8ea5){var _0x2cf9be=_[_0x838b('0x55')](_0x2c8ea5,function(_0x31e780){var _0x7d3321=_0x31e780[_0x838b('0x16')]({'plain':!![]});return _0x7d3321[_0x838b('0x56')];});return db[_0x838b('0x21')]['find']({'where':{'id':_0x4fe3c6['params']['id']}})[_0x838b('0x14')](function(_0x1241df){return db[_0x838b('0x57')][_0x838b('0x58')](function(_0x8f3359){return _0x1241df['addTeams'](_0x47566b,{'transaction':_0x8f3359})[_0x838b('0x14')](function(){return BPromise[_0x838b('0x59')](_0x2cf9be,function(_0x56d8bb){return db['UserFaxQueue'][_0x838b('0x5a')]({'where':{'UserId':_0x56d8bb['id'],'FaxQueueId':_0x4fe3c6[_0x838b('0x26')]['id']},'transaction':_0x8f3359});});})[_0x838b('0x14')](function(){_0x2cf9be[_0x838b('0x5b')](function(_0x57ff74){socket[_0x838b('0x5c')](_0x838b('0x5d'),{'UserId':_0x57ff74['id'],'FaxQueueId':_0x1241df['id']});});});});});}})[_0x838b('0x14')](respondWithStatusCode(_0x42c3a5,null))[_0x838b('0x24')](handleError(_0x42c3a5,null));};exports[_0x838b('0x5e')]=function(_0x44a251,_0xa3f233){return db[_0x838b('0x53')][_0x838b('0x22')]({'where':{'id':_0x44a251[_0x838b('0x20')][_0x838b('0x52')]},'attributes':['id'],'include':[{'model':db[_0x838b('0x46')],'as':_0x838b('0x56'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0xa3f233,null))['then'](function(_0x2882b2){var _0x50b17b=_[_0x838b('0x1c')](_0x2882b2,'id');var _0x3a1bfb=[];var _0x139942=[];var _0x518d7a=squel[_0x838b('0x5f')]();_0x518d7a[_0x838b('0x60')](_0x838b('0x61'))[_0x838b('0x62')](_0x838b('0x63'),'tq')['join'](_0x838b('0x64'),'ut',_0x838b('0x65'))[_0x838b('0x41')](_0x838b('0x66'),_0x44a251[_0x838b('0x26')]['id']);for(var _0x4f509f=0x0;_0x4f509f<_0x2882b2[_0x838b('0x2d')];_0x4f509f+=0x1){let _0x46beed=_0x2882b2[_0x4f509f];for(var _0x2dfe77=0x0;_0x2dfe77<_0x46beed[_0x838b('0x56')][_0x838b('0x2d')];_0x2dfe77+=0x1){let _0x4138f4=_0x46beed[_0x838b('0x56')][_0x2dfe77];var _0x3a97d4=_0x518d7a[_0x838b('0x67')]();_0x3a97d4['where'](_0x838b('0x68'),_0x4138f4['id']);_0x139942[_0x838b('0x69')](db[_0x838b('0x57')][_0x838b('0x20')](_0x3a97d4['toString'](),{'type':db[_0x838b('0x57')][_0x838b('0x6a')][_0x838b('0x6b')]})[_0x838b('0x14')](function(_0x4b3eb2){if(_0x4b3eb2[_0x838b('0x2d')]===0x1){return _0x4138f4['id'];}else{var _0x2750a8=_[_0x838b('0x6c')](_[_0x838b('0x1c')](_0x4b3eb2,_0x838b('0x6d')),function(_0x20f1d0){return _['includes'](_0x50b17b,_0x20f1d0);});if(_0x2750a8){return _0x4138f4['id'];}}}));}}return BPromise[_0x838b('0x6e')](_0x139942)['then'](function(_0x501cbf){_0x3a1bfb=_(_0x3a1bfb)[_0x838b('0x6f')](_0x501cbf)[_0x838b('0x70')]()[_0x838b('0x71')]();return db[_0x838b('0x21')][_0x838b('0x30')]({'where':{'id':_0x44a251[_0x838b('0x26')]['id']}})[_0x838b('0x14')](function(_0x30e526){return db[_0x838b('0x57')]['transaction'](function(_0x222eda){return _0x30e526[_0x838b('0x5e')](_0x44a251['query'][_0x838b('0x52')],{'transaction':_0x222eda})['then'](function(){if(!_['isEmpty'](_0x3a1bfb)){return _0x30e526[_0x838b('0x72')](_0x3a1bfb,{'transaction':_0x222eda});}})['then'](function(){_0x3a1bfb[_0x838b('0x5b')](function(_0x40b4c0){socket[_0x838b('0x5c')](_0x838b('0x73'),{'UserId':_0x40b4c0,'FaxQueueId':_0x30e526['id']});});});});});});})[_0x838b('0x14')](respondWithStatusCode(_0xa3f233,null))[_0x838b('0x24')](handleError(_0xa3f233,null));};exports[_0x838b('0x74')]=function(_0x295212,_0x3c4bf8){return db[_0x838b('0x21')][_0x838b('0x30')]({'where':{'id':_0x295212[_0x838b('0x26')]['id']}})[_0x838b('0x14')](handleEntityNotFound(_0x3c4bf8,null))[_0x838b('0x14')](function(_0x49cabf){if(_0x49cabf){return _0x49cabf[_0x838b('0x74')](_0x295212['body'][_0x838b('0x52')],_['omit'](_0x295212[_0x838b('0x32')],['ids','id'])||{})[_0x838b('0x75')](function(_0x3e3970){for(var _0x212008=0x0;_0x212008<_0x295212[_0x838b('0x32')][_0x838b('0x52')][_0x838b('0x2d')];_0x212008+=0x1){socket['emit'](_0x838b('0x5d'),{'UserId':Number(_0x295212['body'][_0x838b('0x52')][_0x212008]),'FaxQueueId':Number(_0x295212[_0x838b('0x26')]['id'])});}return _0x3e3970;});}})[_0x838b('0x14')](respondWithResult(_0x3c4bf8,null))[_0x838b('0x24')](handleError(_0x3c4bf8,null));};exports[_0x838b('0x72')]=function(_0x412e27,_0x539414){return db[_0x838b('0x21')][_0x838b('0x30')]({'where':{'id':_0x412e27[_0x838b('0x26')]['id']}})[_0x838b('0x14')](handleEntityNotFound(_0x539414,null))['then'](function(_0x3f8fc1){if(_0x3f8fc1){return _0x3f8fc1['removeAgents'](_0x412e27['query'][_0x838b('0x52')])[_0x838b('0x14')](function(){if(_[_0x838b('0x76')](_0x412e27[_0x838b('0x20')]['ids'])){for(var _0x418350=0x0;_0x418350<_0x412e27['query'][_0x838b('0x52')][_0x838b('0x2d')];_0x418350+=0x1){socket[_0x838b('0x5c')](_0x838b('0x73'),{'UserId':Number(_0x412e27['query'][_0x838b('0x52')][_0x418350]),'FaxQueueId':Number(_0x412e27[_0x838b('0x26')]['id'])});}}else{socket['emit'](_0x838b('0x73'),{'UserId':Number(_0x412e27['query'][_0x838b('0x52')]),'FaxQueueId':Number(_0x412e27[_0x838b('0x26')]['id'])});}});}})[_0x838b('0x14')](respondWithStatusCode(_0x539414,null))[_0x838b('0x24')](handleError(_0x539414,null));};exports['getAgents']=function(_0x378e01,_0xe023d3){var _0x4912d7={};var _0x2b95a5={};var _0xd31d36;var _0xfec153;return db[_0x838b('0x21')]['findOne']({'where':{'id':_0x378e01[_0x838b('0x26')]['id']}})[_0x838b('0x14')](handleEntityNotFound(_0xe023d3,null))[_0x838b('0x14')](function(_0x32ce7e){if(_0x32ce7e){_0xd31d36=_0x32ce7e;_0x2b95a5[_0x838b('0x2a')]=_[_0x838b('0x27')](db[_0x838b('0x46')][_0x838b('0x1d')]);_0x2b95a5[_0x838b('0x20')]=_[_0x838b('0x27')](_0x378e01[_0x838b('0x20')]);_0x2b95a5[_0x838b('0x28')]=_['intersection'](_0x2b95a5[_0x838b('0x2a')],_0x2b95a5[_0x838b('0x20')]);_0x4912d7[_0x838b('0x2c')]=_[_0x838b('0x29')](_0x2b95a5[_0x838b('0x2a')],qs[_0x838b('0x2b')](_0x378e01[_0x838b('0x20')][_0x838b('0x2b')]));_0x4912d7[_0x838b('0x2c')]=_0x4912d7[_0x838b('0x2c')]['length']?_0x4912d7[_0x838b('0x2c')]:_0x2b95a5['model'];_0x4912d7[_0x838b('0x3f')]=qs[_0x838b('0x40')](_0x378e01[_0x838b('0x20')]['sort']);_0x4912d7[_0x838b('0x41')]=qs[_0x838b('0x28')](_[_0x838b('0x50')](_0x378e01[_0x838b('0x20')],_0x2b95a5[_0x838b('0x28')]));if(_0x378e01[_0x838b('0x20')][_0x838b('0x43')]){_0x4912d7[_0x838b('0x41')]=_[_0x838b('0x44')](_0x4912d7[_0x838b('0x41')],{'$or':_['map'](_0x4912d7[_0x838b('0x2c')],function(_0x1e1c57){var _0xedd70c={};_0xedd70c[_0x1e1c57]={'$like':'%'+_0x378e01[_0x838b('0x20')]['filter']+'%'};return _0xedd70c;})});}_0x4912d7=_[_0x838b('0x44')]({},_0x4912d7,_0x378e01['options']);return _0xd31d36[_0x838b('0x77')](_0x4912d7);}})[_0x838b('0x14')](function(_0x47c71b){if(_0x47c71b){_0xfec153=_0x47c71b[_0x838b('0x2d')];if(!_0x378e01['query']['hasOwnProperty'](_0x838b('0x51'))){_0x4912d7['limit']=qs[_0x838b('0xf')](_0x378e01['query'][_0x838b('0xf')]);_0x4912d7['offset']=qs['offset'](_0x378e01[_0x838b('0x20')]['offset']);}return _0xd31d36[_0x838b('0x77')](_0x4912d7);}})[_0x838b('0x14')](function(_0x5b4ac7){if(_0x5b4ac7){return _0x5b4ac7?{'count':_0xfec153,'rows':_0x5b4ac7}:null;}})['then'](respondWithResult(_0xe023d3,null))[_0x838b('0x24')](handleError(_0xe023d3,null));}; \ No newline at end of file +var _0xc838=['create','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','catch','update','body','describe','findOne','UserFaxQueue','nolimit','order','sort','pick','FaxQueueId','merge','filter','findAndCountAll','UserId','agent','faxPause','updatedAt','createdAt','format','%s/%s','SIP','getTeams','Team','hasOwnProperty','addTeams','ids','Agents','voicePause','interface','flatMap','sequelize','transaction','each','findOrCreate','forEach','userFaxQueue:save','removeTeams','User','tq.TeamId','from','team_has_fax_queues','join','ut.TeamId\x20=\x20tq.TeamId','clone','push','toString','QueryTypes','SELECT','every','includes','all','compact','value','isEmpty','removeAgents','emit','addAgents','omit','spread','isArray','userFaxQueue:remove','getAgents','bluebird','util','lodash','squel','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','end','json','undefined','count','offset','limit','set','Content-Range','then','FaxQueues','UserProfileResource','name','index','map','FaxQueue','rawAttributes','fieldName','where','include','findAll','rows','show','params','model','keys','query','filters','intersection','fields','attributes','length','includeAll','options','find','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId'];(function(_0x58d00e,_0x5e6616){var _0xa85df7=function(_0x2f5e3b){while(--_0x2f5e3b){_0x58d00e['push'](_0x58d00e['shift']());}};_0xa85df7(++_0x5e6616);}(_0xc838,0xbd));var _0x8c83=function(_0x451651,_0x43a896){_0x451651=_0x451651-0x0;var _0x2f49af=_0xc838[_0x451651];return _0x2f49af;};'use strict';var BPromise=require(_0x8c83('0x0'));var util=require(_0x8c83('0x1'));var _=require(_0x8c83('0x2'));var squel=require(_0x8c83('0x3'));var Redis=require(_0x8c83('0x4'));var qs=require(_0x8c83('0x5'));var logger=require(_0x8c83('0x6'))(_0x8c83('0x7'));var config=require(_0x8c83('0x8'));var db=require(_0x8c83('0x9'))['db'];config[_0x8c83('0xa')]=_[_0x8c83('0xb')](config[_0x8c83('0xa')],{'host':_0x8c83('0xc'),'port':0x18eb});var socket=require(_0x8c83('0xd'))(new Redis(config['redis']));require('./faxQueue.socket')[_0x8c83('0xe')](socket);function respondWithStatusCode(_0x4c2f04,_0x389c28){_0x389c28=_0x389c28||0xcc;return function(_0x3e7a8f){if(_0x3e7a8f){return _0x4c2f04[_0x8c83('0xf')](_0x389c28);}return _0x4c2f04[_0x8c83('0x10')](_0x389c28)[_0x8c83('0x11')]();};}function respondWithResult(_0x21442e,_0x2e547f){_0x2e547f=_0x2e547f||0xc8;return function(_0x105a36){if(_0x105a36){return _0x21442e[_0x8c83('0x10')](_0x2e547f)[_0x8c83('0x12')](_0x105a36);}};}function respondWithFilteredResult(_0x2fb6e5,_0x599205){return function(_0x1fc0b1){if(_0x1fc0b1){var _0x506562=typeof _0x599205['offset']===_0x8c83('0x13')&&typeof _0x599205['limit']===_0x8c83('0x13');var _0x113c7b=_0x1fc0b1[_0x8c83('0x14')];var _0x45d86c=_0x506562?0x0:_0x599205[_0x8c83('0x15')];var _0x1aaac5=_0x506562?_0x1fc0b1[_0x8c83('0x14')]:_0x599205[_0x8c83('0x15')]+_0x599205[_0x8c83('0x16')];var _0xf2dee0;if(_0x1aaac5>=_0x113c7b){_0x1aaac5=_0x113c7b;_0xf2dee0=0xc8;}else{_0xf2dee0=0xce;}_0x2fb6e5['status'](_0xf2dee0);return _0x2fb6e5[_0x8c83('0x17')](_0x8c83('0x18'),_0x45d86c+'-'+_0x1aaac5+'/'+_0x113c7b)['json'](_0x1fc0b1);}return null;};}function saveUpdates(_0x593c97){return function(_0x40bc0d){if(_0x40bc0d){return _0x40bc0d['update'](_0x593c97)[_0x8c83('0x19')](function(_0x535962){return _0x535962;});}return null;};}function removeEntity(_0x47d076){return function(_0x3f4b38){if(_0x3f4b38){return _0x3f4b38['destroy']()[_0x8c83('0x19')](function(){var _0x8899b3=_0x3f4b38['get']({'plain':!![]});var _0x5a2a69=_0x8c83('0x1a');return db[_0x8c83('0x1b')]['destroy']({'where':{'type':_0x5a2a69,'resourceId':_0x8899b3['id']}})[_0x8c83('0x19')](function(){return _0x3f4b38;});})[_0x8c83('0x19')](function(){_0x47d076['status'](0xcc)[_0x8c83('0x11')]();});}};}function handleEntityNotFound(_0x4cde38){return function(_0x34fdab){if(!_0x34fdab){_0x4cde38[_0x8c83('0xf')](0x194);}return _0x34fdab;};}function handleError(_0x17937e,_0xf7b089){_0xf7b089=_0xf7b089||0x1f4;return function(_0x9e56){logger['error'](_0x9e56['stack']);if(_0x9e56[_0x8c83('0x1c')]){delete _0x9e56[_0x8c83('0x1c')];}_0x17937e['status'](_0xf7b089)['send'](_0x9e56);};}exports[_0x8c83('0x1d')]=function(_0xce3514,_0x27aefd){var _0x5034e1={};var _0x1bd922={'count':0x0,'rows':[]};var _0x4f7088=_[_0x8c83('0x1e')](db[_0x8c83('0x1f')][_0x8c83('0x20')],function(_0x1180e1){return{'name':_0x1180e1[_0x8c83('0x21')],'type':_0x1180e1['type']['key']};});_0x5034e1=qs['getOptions'](_0x4f7088,_0xce3514);var _0x41d7be={'where':_0x5034e1[_0x8c83('0x22')]};return db['FaxQueue'][_0x8c83('0x14')](_0x41d7be)[_0x8c83('0x19')](function(_0x142201){_0x1bd922['count']=_0x142201;_0x5034e1['include']=qs[_0x8c83('0x23')](_0xce3514['query']);return db[_0x8c83('0x1f')][_0x8c83('0x24')](_0x5034e1);})[_0x8c83('0x19')](function(_0x178056){_0x1bd922[_0x8c83('0x25')]=_0x178056;return _0x1bd922;})[_0x8c83('0x19')](respondWithFilteredResult(_0x27aefd,_0x5034e1))['catch'](handleError(_0x27aefd,null));};exports[_0x8c83('0x26')]=function(_0x5587db,_0x4c9bca){var _0x6ca25b={'raw':!![],'where':{'id':_0x5587db[_0x8c83('0x27')]['id']}},_0x242d5b={};_0x242d5b[_0x8c83('0x28')]=_[_0x8c83('0x29')](db[_0x8c83('0x1f')][_0x8c83('0x20')]);_0x242d5b['query']=_[_0x8c83('0x29')](_0x5587db[_0x8c83('0x2a')]);_0x242d5b[_0x8c83('0x2b')]=_['intersection'](_0x242d5b[_0x8c83('0x28')],_0x242d5b[_0x8c83('0x2a')]);_0x6ca25b['attributes']=_[_0x8c83('0x2c')](_0x242d5b[_0x8c83('0x28')],qs[_0x8c83('0x2d')](_0x5587db[_0x8c83('0x2a')][_0x8c83('0x2d')]));_0x6ca25b[_0x8c83('0x2e')]=_0x6ca25b[_0x8c83('0x2e')][_0x8c83('0x2f')]?_0x6ca25b[_0x8c83('0x2e')]:_0x242d5b[_0x8c83('0x28')];if(_0x5587db[_0x8c83('0x2a')][_0x8c83('0x30')]){_0x6ca25b['include']=[{'all':!![]}];}_0x6ca25b=_['merge']({},_0x6ca25b,_0x5587db[_0x8c83('0x31')]);return db[_0x8c83('0x1f')][_0x8c83('0x32')](_0x6ca25b)[_0x8c83('0x19')](handleEntityNotFound(_0x4c9bca,null))[_0x8c83('0x19')](respondWithResult(_0x4c9bca,null))['catch'](handleError(_0x4c9bca,null));};exports['create']=function(_0x3a200c,_0x4347d6){return db[_0x8c83('0x1f')]['create'](_0x3a200c['body'],{})['then'](function(_0x4cde01){var _0x259bca=_0x3a200c[_0x8c83('0x33')][_0x8c83('0x34')]({'plain':!![]});if(!_0x259bca)throw new Error(_0x8c83('0x35'));if(_0x259bca[_0x8c83('0x36')]===_0x8c83('0x33')){var _0x1e9867=_0x4cde01[_0x8c83('0x34')]({'plain':!![]});var _0x4da901='FaxQueues';return db[_0x8c83('0x37')][_0x8c83('0x32')]({'where':{'name':_0x4da901,'userProfileId':_0x259bca[_0x8c83('0x38')]},'raw':!![]})['then'](function(_0x2bab6d){if(_0x2bab6d&&_0x2bab6d['autoAssociation']===0x0){return db[_0x8c83('0x1b')][_0x8c83('0x39')]({'name':_0x1e9867['name'],'resourceId':_0x1e9867['id'],'type':_0x2bab6d[_0x8c83('0x1c')],'sectionId':_0x2bab6d['id']},{})['then'](function(){return _0x4cde01;});}else{return _0x4cde01;}})['catch'](function(_0x5dfc16){logger[_0x8c83('0x3a')](_0x8c83('0x3b'),_0x5dfc16);throw _0x5dfc16;});}return _0x4cde01;})[_0x8c83('0x19')](respondWithResult(_0x4347d6,0xc9))[_0x8c83('0x3c')](handleError(_0x4347d6,null));};exports[_0x8c83('0x3d')]=function(_0x3883de,_0x3a6c98){if(_0x3883de['body']['id']){delete _0x3883de['body']['id'];}return db[_0x8c83('0x1f')][_0x8c83('0x32')]({'where':{'id':_0x3883de[_0x8c83('0x27')]['id']}})[_0x8c83('0x19')](handleEntityNotFound(_0x3a6c98,null))[_0x8c83('0x19')](saveUpdates(_0x3883de[_0x8c83('0x3e')],null))[_0x8c83('0x19')](respondWithResult(_0x3a6c98,null))['catch'](handleError(_0x3a6c98,null));};exports['destroy']=function(_0x2a4c6c,_0x1f1a10){return db[_0x8c83('0x1f')][_0x8c83('0x32')]({'where':{'id':_0x2a4c6c[_0x8c83('0x27')]['id']}})[_0x8c83('0x19')](handleEntityNotFound(_0x1f1a10,null))[_0x8c83('0x19')](removeEntity(_0x1f1a10,null))[_0x8c83('0x3c')](handleError(_0x1f1a10,null));};exports[_0x8c83('0x3f')]=function(_0x1c5033,_0x50ef1e){return db['FaxQueue'][_0x8c83('0x3f')]()[_0x8c83('0x19')](respondWithResult(_0x50ef1e,null))[_0x8c83('0x3c')](handleError(_0x50ef1e,null));};exports['getMembers']=function(_0x37d89c,_0x19ff09){var _0x28d8b0={'raw':!![],'where':{}},_0x53c8f3={},_0x5338fd;return db['FaxQueue'][_0x8c83('0x40')]({'where':{'id':_0x37d89c['params']['id']}})['then'](handleEntityNotFound(_0x19ff09,null))[_0x8c83('0x19')](function(_0x4f2aea){if(_0x4f2aea){_0x5338fd=_0x4f2aea[_0x8c83('0x34')]({'plain':!![]});_0x53c8f3[_0x8c83('0x28')]=_[_0x8c83('0x29')](db[_0x8c83('0x41')]['rawAttributes']);_0x53c8f3['query']=_[_0x8c83('0x29')](_0x37d89c[_0x8c83('0x2a')]);_0x53c8f3[_0x8c83('0x2b')]=_['intersection'](_0x53c8f3[_0x8c83('0x28')],_0x53c8f3['query']);_0x28d8b0[_0x8c83('0x2e')]=_[_0x8c83('0x2c')](_0x53c8f3[_0x8c83('0x28')],qs[_0x8c83('0x2d')](_0x37d89c['query'][_0x8c83('0x2d')]));_0x28d8b0['attributes']=_0x28d8b0['attributes'][_0x8c83('0x2f')]?_0x28d8b0[_0x8c83('0x2e')]:_0x53c8f3[_0x8c83('0x28')];if(!_0x37d89c[_0x8c83('0x2a')]['hasOwnProperty'](_0x8c83('0x42'))){_0x28d8b0[_0x8c83('0x16')]=qs[_0x8c83('0x16')](_0x37d89c[_0x8c83('0x2a')][_0x8c83('0x16')]);_0x28d8b0[_0x8c83('0x15')]=qs[_0x8c83('0x15')](_0x37d89c[_0x8c83('0x2a')]['offset']);}_0x28d8b0[_0x8c83('0x43')]=qs['sort'](_0x37d89c[_0x8c83('0x2a')][_0x8c83('0x44')]);_0x28d8b0['where']=qs['filters'](_[_0x8c83('0x45')](_0x37d89c[_0x8c83('0x2a')],_0x53c8f3['filters']));_0x28d8b0['where'][_0x8c83('0x46')]=_0x4f2aea['id'];if(_0x37d89c[_0x8c83('0x2a')]['filter']){_0x28d8b0[_0x8c83('0x22')]=_[_0x8c83('0x47')](_0x28d8b0[_0x8c83('0x22')],{'$or':_['map'](_0x28d8b0[_0x8c83('0x2e')],function(_0x1f7d36){var _0x10a783={};_0x10a783[_0x1f7d36]={'$like':'%'+_0x37d89c['query'][_0x8c83('0x48')]+'%'};return _0x10a783;})});}_0x28d8b0=_[_0x8c83('0x47')]({},_0x28d8b0,_0x37d89c[_0x8c83('0x31')]);return db[_0x8c83('0x41')][_0x8c83('0x24')](_0x28d8b0);}})[_0x8c83('0x19')](function(_0x57a463){if(_0x57a463){return db['User'][_0x8c83('0x49')]({'where':{'id':_[_0x8c83('0x1e')](_0x57a463,_0x8c83('0x4a')),'role':_0x8c83('0x4b')},'attributes':['id',_0x8c83('0x1c'),_0x8c83('0x4c'),_0x8c83('0x4d'),_0x8c83('0x4e')]});}})[_0x8c83('0x19')](function(_0x480bf4){if(_0x480bf4){return{'count':_0x480bf4['count'],'rows':_[_0x8c83('0x1e')](_0x480bf4[_0x8c83('0x25')],function(_0x30ff01){return{'membername':_0x30ff01[_0x8c83('0x1c')],'UserId':_0x30ff01['id'],'queue_name':_0x5338fd[_0x8c83('0x1c')],'FaxQueueId':_0x5338fd['id'],'interface':util[_0x8c83('0x4f')](_0x8c83('0x50'),_0x8c83('0x51'),_0x30ff01[_0x8c83('0x1c')]),'penalty':0x0,'paused':_0x30ff01[_0x8c83('0x4c')],'createdAt':_0x30ff01['createdAt'],'updatedAt':_0x30ff01[_0x8c83('0x4d')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x8c83('0x19')](respondWithFilteredResult(_0x19ff09,_0x28d8b0))[_0x8c83('0x3c')](handleError(_0x19ff09,null));};exports[_0x8c83('0x52')]=function(_0x2c9865,_0xe7401b){var _0x1573bc={};var _0x31130c={};var _0x2f0a57;var _0x724ecf;return db['FaxQueue'][_0x8c83('0x40')]({'where':{'id':_0x2c9865['params']['id']}})[_0x8c83('0x19')](handleEntityNotFound(_0xe7401b,null))[_0x8c83('0x19')](function(_0x3cc45c){if(_0x3cc45c){_0x2f0a57=_0x3cc45c;_0x31130c['model']=_[_0x8c83('0x29')](db[_0x8c83('0x53')]['rawAttributes']);_0x31130c['query']=_['keys'](_0x2c9865[_0x8c83('0x2a')]);_0x31130c['filters']=_[_0x8c83('0x2c')](_0x31130c[_0x8c83('0x28')],_0x31130c['query']);_0x1573bc['attributes']=_['intersection'](_0x31130c[_0x8c83('0x28')],qs[_0x8c83('0x2d')](_0x2c9865['query']['fields']));_0x1573bc[_0x8c83('0x2e')]=_0x1573bc[_0x8c83('0x2e')]['length']?_0x1573bc[_0x8c83('0x2e')]:_0x31130c[_0x8c83('0x28')];_0x1573bc[_0x8c83('0x43')]=qs['sort'](_0x2c9865[_0x8c83('0x2a')][_0x8c83('0x44')]);_0x1573bc[_0x8c83('0x22')]=qs['filters'](_[_0x8c83('0x45')](_0x2c9865['query'],_0x31130c[_0x8c83('0x2b')]));if(_0x2c9865[_0x8c83('0x2a')][_0x8c83('0x48')]){_0x1573bc[_0x8c83('0x22')]=_['merge'](_0x1573bc['where'],{'$or':_[_0x8c83('0x1e')](_0x1573bc[_0x8c83('0x2e')],function(_0x4169b9){var _0x54ba39={};_0x54ba39[_0x4169b9]={'$like':'%'+_0x2c9865[_0x8c83('0x2a')]['filter']+'%'};return _0x54ba39;})});}_0x1573bc=_[_0x8c83('0x47')]({},_0x1573bc,_0x2c9865[_0x8c83('0x31')]);return _0x2f0a57[_0x8c83('0x52')](_0x1573bc);}})[_0x8c83('0x19')](function(_0x3fbbb4){if(_0x3fbbb4){_0x724ecf=_0x3fbbb4['length'];if(!_0x2c9865[_0x8c83('0x2a')][_0x8c83('0x54')](_0x8c83('0x42'))){_0x1573bc['limit']=qs['limit'](_0x2c9865[_0x8c83('0x2a')][_0x8c83('0x16')]);_0x1573bc['offset']=qs[_0x8c83('0x15')](_0x2c9865['query'][_0x8c83('0x15')]);}return _0x2f0a57[_0x8c83('0x52')](_0x1573bc);}})[_0x8c83('0x19')](function(_0x1f7b9f){if(_0x1f7b9f){return _0x1f7b9f?{'count':_0x724ecf,'rows':_0x1f7b9f}:null;}})['then'](respondWithResult(_0xe7401b,null))['catch'](handleError(_0xe7401b,null));};exports[_0x8c83('0x55')]=function(_0x479a92,_0x28f1cb){var _0x4aae54=_0x479a92['body'][_0x8c83('0x56')];return db[_0x8c83('0x53')]['findAll']({'where':{'id':_0x4aae54},'attributes':['id'],'include':[{'model':db['User'],'as':_0x8c83('0x57'),'attributes':['id',_0x8c83('0x1c'),'online',_0x8c83('0x58'),_0x8c83('0x59')],'raw':!![]}]})[_0x8c83('0x19')](function(_0x27c855){if(_0x27c855){var _0x1e6417=_[_0x8c83('0x5a')](_0x27c855,function(_0x4236f8){var _0x1bdafe=_0x4236f8[_0x8c83('0x34')]({'plain':!![]});return _0x1bdafe[_0x8c83('0x57')];});return db[_0x8c83('0x1f')][_0x8c83('0x32')]({'where':{'id':_0x479a92[_0x8c83('0x27')]['id']}})[_0x8c83('0x19')](function(_0x28c917){return db[_0x8c83('0x5b')][_0x8c83('0x5c')](function(_0x556d0a){return _0x28c917[_0x8c83('0x55')](_0x4aae54,{'transaction':_0x556d0a})['then'](function(){return BPromise[_0x8c83('0x5d')](_0x1e6417,function(_0x4c2822){return db[_0x8c83('0x41')][_0x8c83('0x5e')]({'where':{'UserId':_0x4c2822['id'],'FaxQueueId':_0x479a92[_0x8c83('0x27')]['id']},'transaction':_0x556d0a});});})[_0x8c83('0x19')](function(){_0x1e6417[_0x8c83('0x5f')](function(_0x292a0d){socket['emit'](_0x8c83('0x60'),{'UserId':_0x292a0d['id'],'FaxQueueId':_0x28c917['id']});});});});});}})[_0x8c83('0x19')](respondWithStatusCode(_0x28f1cb,null))['catch'](handleError(_0x28f1cb,null));};exports[_0x8c83('0x61')]=function(_0x38cf08,_0x4a8ab1){return db[_0x8c83('0x53')][_0x8c83('0x24')]({'where':{'id':_0x38cf08[_0x8c83('0x2a')][_0x8c83('0x56')]},'attributes':['id'],'include':[{'model':db[_0x8c83('0x62')],'as':_0x8c83('0x57'),'attributes':['id'],'raw':!![]}]})[_0x8c83('0x19')](handleEntityNotFound(_0x4a8ab1,null))['then'](function(_0x3cda43){var _0x33b38d=_[_0x8c83('0x1e')](_0x3cda43,'id');var _0x386b95=[];var _0x3b2b03=[];var _0x1f90fb=squel['select']();_0x1f90fb['field'](_0x8c83('0x63'))[_0x8c83('0x64')](_0x8c83('0x65'),'tq')[_0x8c83('0x66')]('user_has_teams','ut',_0x8c83('0x67'))['where']('FaxQueueId\x20=\x20?',_0x38cf08[_0x8c83('0x27')]['id']);for(var _0x1dc42e=0x0;_0x1dc42e<_0x3cda43[_0x8c83('0x2f')];_0x1dc42e+=0x1){let _0x254957=_0x3cda43[_0x1dc42e];for(var _0x3a2037=0x0;_0x3a2037<_0x254957['Agents'][_0x8c83('0x2f')];_0x3a2037+=0x1){let _0x1201e8=_0x254957['Agents'][_0x3a2037];var _0x5b8aa3=_0x1f90fb[_0x8c83('0x68')]();_0x5b8aa3[_0x8c83('0x22')]('ut.UserId\x20=\x20?',_0x1201e8['id']);_0x3b2b03[_0x8c83('0x69')](db['sequelize'][_0x8c83('0x2a')](_0x5b8aa3[_0x8c83('0x6a')](),{'type':db['sequelize'][_0x8c83('0x6b')][_0x8c83('0x6c')]})['then'](function(_0x303100){if(_0x303100[_0x8c83('0x2f')]===0x1){return _0x1201e8['id'];}else{var _0x114126=_[_0x8c83('0x6d')](_[_0x8c83('0x1e')](_0x303100,'TeamId'),function(_0x4c62ff){return _[_0x8c83('0x6e')](_0x33b38d,_0x4c62ff);});if(_0x114126){return _0x1201e8['id'];}}}));}}return BPromise[_0x8c83('0x6f')](_0x3b2b03)[_0x8c83('0x19')](function(_0x5135fb){_0x386b95=_(_0x386b95)['union'](_0x5135fb)[_0x8c83('0x70')]()[_0x8c83('0x71')]();return db[_0x8c83('0x1f')][_0x8c83('0x32')]({'where':{'id':_0x38cf08['params']['id']}})[_0x8c83('0x19')](function(_0x3cad90){return db[_0x8c83('0x5b')][_0x8c83('0x5c')](function(_0x201c2f){return _0x3cad90['removeTeams'](_0x38cf08['query'][_0x8c83('0x56')],{'transaction':_0x201c2f})[_0x8c83('0x19')](function(){if(!_[_0x8c83('0x72')](_0x386b95)){return _0x3cad90[_0x8c83('0x73')](_0x386b95,{'transaction':_0x201c2f});}})[_0x8c83('0x19')](function(){_0x386b95[_0x8c83('0x5f')](function(_0xe71a0f){socket[_0x8c83('0x74')]('userFaxQueue:remove',{'UserId':_0xe71a0f,'FaxQueueId':_0x3cad90['id']});});});});});});})[_0x8c83('0x19')](respondWithStatusCode(_0x4a8ab1,null))['catch'](handleError(_0x4a8ab1,null));};exports[_0x8c83('0x75')]=function(_0x29c52b,_0x3dbb17){return db[_0x8c83('0x1f')][_0x8c83('0x32')]({'where':{'id':_0x29c52b[_0x8c83('0x27')]['id']}})[_0x8c83('0x19')](handleEntityNotFound(_0x3dbb17,null))[_0x8c83('0x19')](function(_0x58f7e5){if(_0x58f7e5){return _0x58f7e5[_0x8c83('0x75')](_0x29c52b[_0x8c83('0x3e')][_0x8c83('0x56')],_[_0x8c83('0x76')](_0x29c52b[_0x8c83('0x3e')],[_0x8c83('0x56'),'id'])||{})[_0x8c83('0x77')](function(_0x40c6db){for(var _0x1c095a=0x0;_0x1c095a<_0x29c52b[_0x8c83('0x3e')][_0x8c83('0x56')][_0x8c83('0x2f')];_0x1c095a+=0x1){socket[_0x8c83('0x74')]('userFaxQueue:save',{'UserId':Number(_0x29c52b[_0x8c83('0x3e')][_0x8c83('0x56')][_0x1c095a]),'FaxQueueId':Number(_0x29c52b[_0x8c83('0x27')]['id'])});}return _0x40c6db;});}})[_0x8c83('0x19')](respondWithResult(_0x3dbb17,null))[_0x8c83('0x3c')](handleError(_0x3dbb17,null));};exports[_0x8c83('0x73')]=function(_0x21aa78,_0x24ee37){return db[_0x8c83('0x1f')]['find']({'where':{'id':_0x21aa78['params']['id']}})[_0x8c83('0x19')](handleEntityNotFound(_0x24ee37,null))['then'](function(_0x2e7176){if(_0x2e7176){return _0x2e7176[_0x8c83('0x73')](_0x21aa78[_0x8c83('0x2a')][_0x8c83('0x56')])[_0x8c83('0x19')](function(){if(_[_0x8c83('0x78')](_0x21aa78[_0x8c83('0x2a')]['ids'])){for(var _0x55c54b=0x0;_0x55c54b<_0x21aa78[_0x8c83('0x2a')]['ids'][_0x8c83('0x2f')];_0x55c54b+=0x1){socket[_0x8c83('0x74')](_0x8c83('0x79'),{'UserId':Number(_0x21aa78[_0x8c83('0x2a')][_0x8c83('0x56')][_0x55c54b]),'FaxQueueId':Number(_0x21aa78['params']['id'])});}}else{socket[_0x8c83('0x74')](_0x8c83('0x79'),{'UserId':Number(_0x21aa78['query']['ids']),'FaxQueueId':Number(_0x21aa78[_0x8c83('0x27')]['id'])});}});}})[_0x8c83('0x19')](respondWithStatusCode(_0x24ee37,null))['catch'](handleError(_0x24ee37,null));};exports['getAgents']=function(_0x261d38,_0x3ddbfe){var _0x51bd82={};var _0x55be5b={};var _0x4e62bb;var _0x1d3e22;return db[_0x8c83('0x1f')][_0x8c83('0x40')]({'where':{'id':_0x261d38['params']['id']}})[_0x8c83('0x19')](handleEntityNotFound(_0x3ddbfe,null))['then'](function(_0x105b62){if(_0x105b62){_0x4e62bb=_0x105b62;_0x55be5b[_0x8c83('0x28')]=_[_0x8c83('0x29')](db[_0x8c83('0x62')][_0x8c83('0x20')]);_0x55be5b[_0x8c83('0x2a')]=_['keys'](_0x261d38[_0x8c83('0x2a')]);_0x55be5b[_0x8c83('0x2b')]=_[_0x8c83('0x2c')](_0x55be5b[_0x8c83('0x28')],_0x55be5b[_0x8c83('0x2a')]);_0x51bd82[_0x8c83('0x2e')]=_[_0x8c83('0x2c')](_0x55be5b['model'],qs['fields'](_0x261d38[_0x8c83('0x2a')][_0x8c83('0x2d')]));_0x51bd82[_0x8c83('0x2e')]=_0x51bd82['attributes'][_0x8c83('0x2f')]?_0x51bd82[_0x8c83('0x2e')]:_0x55be5b[_0x8c83('0x28')];_0x51bd82[_0x8c83('0x43')]=qs[_0x8c83('0x44')](_0x261d38[_0x8c83('0x2a')][_0x8c83('0x44')]);_0x51bd82[_0x8c83('0x22')]=qs['filters'](_['pick'](_0x261d38['query'],_0x55be5b[_0x8c83('0x2b')]));if(_0x261d38['query'][_0x8c83('0x48')]){_0x51bd82[_0x8c83('0x22')]=_[_0x8c83('0x47')](_0x51bd82[_0x8c83('0x22')],{'$or':_[_0x8c83('0x1e')](_0x51bd82['attributes'],function(_0x5975fa){var _0x53c770={};_0x53c770[_0x5975fa]={'$like':'%'+_0x261d38[_0x8c83('0x2a')][_0x8c83('0x48')]+'%'};return _0x53c770;})});}_0x51bd82=_['merge']({},_0x51bd82,_0x261d38[_0x8c83('0x31')]);return _0x4e62bb['getAgents'](_0x51bd82);}})[_0x8c83('0x19')](function(_0x4dd494){if(_0x4dd494){_0x1d3e22=_0x4dd494['length'];if(!_0x261d38[_0x8c83('0x2a')][_0x8c83('0x54')](_0x8c83('0x42'))){_0x51bd82[_0x8c83('0x16')]=qs[_0x8c83('0x16')](_0x261d38['query'][_0x8c83('0x16')]);_0x51bd82[_0x8c83('0x15')]=qs[_0x8c83('0x15')](_0x261d38[_0x8c83('0x2a')][_0x8c83('0x15')]);}return _0x4e62bb[_0x8c83('0x7a')](_0x51bd82);}})[_0x8c83('0x19')](function(_0x1f0379){if(_0x1f0379){return _0x1f0379?{'count':_0x1d3e22,'rows':_0x1f0379}:null;}})[_0x8c83('0x19')](respondWithResult(_0x3ddbfe,null))['catch'](handleError(_0x3ddbfe,null));}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.events.js b/server/api/faxQueue/faxQueue.events.js index eb3c601..991b3db 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 _0x3fce=['save','emit','hasOwnProperty','hook','exports','events','../../mysqldb','FaxQueue','setMaxListeners'];(function(_0x2d486b,_0x5f213c){var _0x4291d1=function(_0x2cebcb){while(--_0x2cebcb){_0x2d486b['push'](_0x2d486b['shift']());}};_0x4291d1(++_0x5f213c);}(_0x3fce,0xdd));var _0xe3fc=function(_0x3f8759,_0x3fe6fb){_0x3f8759=_0x3f8759-0x0;var _0x2d33ca=_0x3fce[_0x3f8759];return _0x2d33ca;};'use strict';var EventEmitter=require(_0xe3fc('0x0'));var FaxQueue=require(_0xe3fc('0x1'))['db'][_0xe3fc('0x2')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0xe3fc('0x3')](0x0);var events={'afterCreate':_0xe3fc('0x4'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x59b3c2){return function(_0x28a02c,_0x3b9131,_0x15d990){FaxQueueEvents['emit'](_0x59b3c2+':'+_0x28a02c['id'],_0x28a02c);FaxQueueEvents[_0xe3fc('0x5')](_0x59b3c2,_0x28a02c);_0x15d990(null);};}for(var e in events){if(events[_0xe3fc('0x6')](e)){var event=events[e];FaxQueue[_0xe3fc('0x7')](e,emitEvent(event));}}module[_0xe3fc('0x8')]=FaxQueueEvents; \ No newline at end of file +var _0x0948=['remove','emit','hasOwnProperty','hook','exports','../../mysqldb','FaxQueue','save','update'];(function(_0x498745,_0x377c24){var _0x471c0b=function(_0x13a979){while(--_0x13a979){_0x498745['push'](_0x498745['shift']());}};_0x471c0b(++_0x377c24);}(_0x0948,0x1eb));var _0x8094=function(_0x386525,_0xefae6){_0x386525=_0x386525-0x0;var _0x14d015=_0x0948[_0x386525];return _0x14d015;};'use strict';var EventEmitter=require('events');var FaxQueue=require(_0x8094('0x0'))['db'][_0x8094('0x1')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x8094('0x2'),'afterUpdate':_0x8094('0x3'),'afterDestroy':_0x8094('0x4')};function emitEvent(_0x2fa75b){return function(_0x214d2b,_0xc13ef7,_0x2495a7){FaxQueueEvents['emit'](_0x2fa75b+':'+_0x214d2b['id'],_0x214d2b);FaxQueueEvents[_0x8094('0x5')](_0x2fa75b,_0x214d2b);_0x2495a7(null);};}for(var e in events){if(events[_0x8094('0x6')](e)){var event=events[e];FaxQueue[_0x8094('0x7')](e,emitEvent(event));}}module[_0x8094('0x8')]=FaxQueueEvents; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.model.js b/server/api/faxQueue/faxQueue.model.js index 3c6a157..85c356b 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 _0xdf0c=['lodash','../../config/logger','api','moment','bluebird','path','../../config/environment','./faxQueue.attributes','define','FaxQueue','fax_queues'];(function(_0x5ac5c8,_0x473065){var _0x4229c7=function(_0xe47fde){while(--_0xe47fde){_0x5ac5c8['push'](_0x5ac5c8['shift']());}};_0x4229c7(++_0x473065);}(_0xdf0c,0x197));var _0xcdf0=function(_0x1ca7c4,_0x1436c8){_0x1ca7c4=_0x1ca7c4-0x0;var _0x5399c7=_0xdf0c[_0x1ca7c4];return _0x5399c7;};'use strict';var _=require(_0xcdf0('0x0'));var util=require('util');var logger=require(_0xcdf0('0x1'))(_0xcdf0('0x2'));var moment=require(_0xcdf0('0x3'));var BPromise=require(_0xcdf0('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xcdf0('0x5'));var rimraf=require('rimraf');var config=require(_0xcdf0('0x6'));var attributes=require(_0xcdf0('0x7'));module['exports']=function(_0x58579d,_0x2f3b53){return _0x58579d[_0xcdf0('0x8')](_0xcdf0('0x9'),attributes,{'tableName':_0xcdf0('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5a32=['util','api','bluebird','path','rimraf','exports','FaxQueue'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5a32,0xc4));var _0x25a3=function(_0x928c8,_0x54f145){_0x928c8=_0x928c8-0x0;var _0x29c44e=_0x5a32[_0x928c8];return _0x29c44e;};'use strict';var _=require('lodash');var util=require(_0x25a3('0x0'));var logger=require('../../config/logger')(_0x25a3('0x1'));var moment=require('moment');var BPromise=require(_0x25a3('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x25a3('0x3'));var rimraf=require(_0x25a3('0x4'));var config=require('../../config/environment');var attributes=require('./faxQueue.attributes');module[_0x25a3('0x5')]=function(_0x351a53,_0x1b749b){return _0x351a53['define'](_0x25a3('0x6'),attributes,{'tableName':'fax_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.rpc.js b/server/api/faxQueue/faxQueue.rpc.js index 48f1fa6..762e7e6 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 _0x87bf=['debug','stringify','error','code','FaxQueue,\x20%s,\x20%s','message','result','catch','options','raw','where','limit','map','include','model','attributes','GetFaxQueue','FaxQueue','find','ShowFaxQueue','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./faxQueue.socket','register','request','then','info','request\x20sent'];(function(_0x2006e1,_0x1daa2d){var _0x3f4b72=function(_0x133c61){while(--_0x133c61){_0x2006e1['push'](_0x2006e1['shift']());}};_0x3f4b72(++_0x1daa2d);}(_0x87bf,0x1d7));var _0xf87b=function(_0x379eaf,_0x4eb489){_0x379eaf=_0x379eaf-0x0;var _0x326f1f=_0x87bf[_0x379eaf];return _0x326f1f;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xf87b('0x0'));var BPromise=require(_0xf87b('0x1'));var rs=require(_0xf87b('0x2'));var fs=require('fs');var Redis=require(_0xf87b('0x3'));var db=require(_0xf87b('0x4'))['db'];var utils=require(_0xf87b('0x5'));var logger=require(_0xf87b('0x6'))(_0xf87b('0x7'));var config=require(_0xf87b('0x8'));var jayson=require(_0xf87b('0x9'));var client=jayson[_0xf87b('0xa')][_0xf87b('0xb')]({'port':0x232a});config[_0xf87b('0xc')]=_[_0xf87b('0xd')](config['redis'],{'host':_0xf87b('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xf87b('0xf'))[_0xf87b('0x10')](socket);function respondWithRpcPromise(_0xb5d67,_0x2be8d9,_0x50c2f4){return new BPromise(function(_0x2c865c,_0x7672de){return client[_0xf87b('0x11')](_0xb5d67,_0x50c2f4)[_0xf87b('0x12')](function(_0x536fe8){logger[_0xf87b('0x13')]('FaxQueue,\x20%s,\x20%s',_0x2be8d9,_0xf87b('0x14'));logger[_0xf87b('0x15')]('FaxQueue,\x20%s,\x20%s,\x20%s',_0x2be8d9,_0xf87b('0x14'),JSON[_0xf87b('0x16')](_0x536fe8));if(_0x536fe8['error']){if(_0x536fe8[_0xf87b('0x17')][_0xf87b('0x18')]===0x1f4){logger[_0xf87b('0x17')](_0xf87b('0x19'),_0x2be8d9,_0x536fe8[_0xf87b('0x17')]['message']);return _0x7672de(_0x536fe8[_0xf87b('0x17')]['message']);}logger[_0xf87b('0x17')](_0xf87b('0x19'),_0x2be8d9,_0x536fe8['error'][_0xf87b('0x1a')]);return _0x2c865c(_0x536fe8['error']['message']);}else{logger[_0xf87b('0x13')]('FaxQueue,\x20%s,\x20%s',_0x2be8d9,_0xf87b('0x14'));_0x2c865c(_0x536fe8[_0xf87b('0x1b')]['message']);}})[_0xf87b('0x1c')](function(_0x128d86){logger[_0xf87b('0x17')](_0xf87b('0x19'),_0x2be8d9,_0x128d86);_0x7672de(_0x128d86);});});}exports['GetFaxQueue']=function(_0x35c77e){var _0x1104f1=this;return new Promise(function(_0x761545,_0x278159){return db['FaxQueue']['findAll']({'raw':_0x35c77e['options']?_0x35c77e[_0xf87b('0x1d')][_0xf87b('0x1e')]===undefined?!![]:![]:!![],'where':_0x35c77e[_0xf87b('0x1d')]?_0x35c77e[_0xf87b('0x1d')][_0xf87b('0x1f')]||null:null,'attributes':_0x35c77e[_0xf87b('0x1d')]?_0x35c77e[_0xf87b('0x1d')]['attributes']||null:null,'limit':_0x35c77e[_0xf87b('0x1d')]?_0x35c77e['options'][_0xf87b('0x20')]||null:null,'include':_0x35c77e[_0xf87b('0x1d')]?_0x35c77e[_0xf87b('0x1d')]['include']?_[_0xf87b('0x21')](_0x35c77e[_0xf87b('0x1d')][_0xf87b('0x22')],function(_0x40c78e){return{'model':db[_0x40c78e[_0xf87b('0x23')]],'as':_0x40c78e['as'],'attributes':_0x40c78e['attributes'],'include':_0x40c78e[_0xf87b('0x22')]?_['map'](_0x40c78e[_0xf87b('0x22')],function(_0x2ffbcd){return{'model':db[_0x2ffbcd[_0xf87b('0x23')]],'as':_0x2ffbcd['as'],'attributes':_0x2ffbcd[_0xf87b('0x24')],'include':_0x2ffbcd[_0xf87b('0x22')]?_[_0xf87b('0x21')](_0x2ffbcd[_0xf87b('0x22')],function(_0x283cdb){return{'model':db[_0x283cdb[_0xf87b('0x23')]],'as':_0x283cdb['as'],'attributes':_0x283cdb[_0xf87b('0x24')]};}):[]};}):[]};}):[]:[]})[_0xf87b('0x12')](function(_0x343493){logger[_0xf87b('0x13')](_0xf87b('0x25'),_0x35c77e);logger[_0xf87b('0x15')](_0xf87b('0x25'),_0x35c77e,JSON[_0xf87b('0x16')](_0x343493));_0x761545(_0x343493);})[_0xf87b('0x1c')](function(_0x1f0075){logger[_0xf87b('0x17')](_0xf87b('0x25'),_0x1f0075[_0xf87b('0x1a')],_0x35c77e);_0x278159(_0x1104f1[_0xf87b('0x17')](0x1f4,_0x1f0075['message']));});});};exports['ShowFaxQueue']=function(_0x33d857){var _0x4ebda9=this;return new Promise(function(_0x2807a5,_0x126c59){return db[_0xf87b('0x26')][_0xf87b('0x27')]({'raw':_0x33d857['options']?_0x33d857[_0xf87b('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0x33d857[_0xf87b('0x1d')]?_0x33d857[_0xf87b('0x1d')][_0xf87b('0x1f')]||null:null,'attributes':_0x33d857[_0xf87b('0x1d')]?_0x33d857[_0xf87b('0x1d')][_0xf87b('0x24')]||null:null,'include':_0x33d857['options']?_0x33d857['options'][_0xf87b('0x22')]?_[_0xf87b('0x21')](_0x33d857['options'][_0xf87b('0x22')],function(_0x2b0e69){return{'model':db[_0x2b0e69[_0xf87b('0x23')]],'as':_0x2b0e69['as'],'attributes':_0x2b0e69['attributes'],'include':_0x2b0e69[_0xf87b('0x22')]?_[_0xf87b('0x21')](_0x2b0e69[_0xf87b('0x22')],function(_0x4573b3){return{'model':db[_0x4573b3['model']],'as':_0x4573b3['as'],'attributes':_0x4573b3[_0xf87b('0x24')],'include':_0x4573b3[_0xf87b('0x22')]?_[_0xf87b('0x21')](_0x4573b3[_0xf87b('0x22')],function(_0xe4750f){return{'model':db[_0xe4750f[_0xf87b('0x23')]],'as':_0xe4750f['as'],'attributes':_0xe4750f[_0xf87b('0x24')]};}):[]};}):[]};}):[]:[]})[_0xf87b('0x12')](function(_0x40bf76){logger[_0xf87b('0x13')]('ShowFaxQueue',_0x33d857);logger['debug'](_0xf87b('0x28'),_0x33d857,JSON['stringify'](_0x40bf76));_0x2807a5(_0x40bf76);})[_0xf87b('0x1c')](function(_0x2927cf){logger['error'](_0xf87b('0x28'),_0x2927cf[_0xf87b('0x1a')],_0x33d857);_0x126c59(_0x4ebda9['error'](0x1f4,_0x2927cf[_0xf87b('0x1a')]));});});}; \ No newline at end of file +var _0x2bac=['options','where','include','model','attributes','map','then','GetFaxQueue','ShowFaxQueue','find','raw','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','localhost','socket.io-emitter','./faxQueue.socket','FaxQueue,\x20%s,\x20%s','request\x20sent','debug','FaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','findAll'];(function(_0x5b6744,_0x49c9c2){var _0x43d97a=function(_0x55633e){while(--_0x55633e){_0x5b6744['push'](_0x5b6744['shift']());}};_0x43d97a(++_0x49c9c2);}(_0x2bac,0x1d4));var _0xc2ba=function(_0x297818,_0x5f4d36){_0x297818=_0x297818-0x0;var _0x469ee3=_0x2bac[_0x297818];return _0x469ee3;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xc2ba('0x0'));var BPromise=require(_0xc2ba('0x1'));var rs=require(_0xc2ba('0x2'));var fs=require('fs');var Redis=require(_0xc2ba('0x3'));var db=require(_0xc2ba('0x4'))['db'];var utils=require(_0xc2ba('0x5'));var logger=require(_0xc2ba('0x6'))(_0xc2ba('0x7'));var config=require(_0xc2ba('0x8'));var jayson=require(_0xc2ba('0x9'));var client=jayson[_0xc2ba('0xa')]['http']({'port':0x232a});config[_0xc2ba('0xb')]=_['defaults'](config[_0xc2ba('0xb')],{'host':_0xc2ba('0xc'),'port':0x18eb});var socket=require(_0xc2ba('0xd'))(new Redis(config[_0xc2ba('0xb')]));require(_0xc2ba('0xe'))['register'](socket);function respondWithRpcPromise(_0x5dbbc8,_0x315327,_0x444081){return new BPromise(function(_0x5f37fb,_0x3d933a){return client['request'](_0x5dbbc8,_0x444081)['then'](function(_0x46a9e9){logger['info'](_0xc2ba('0xf'),_0x315327,_0xc2ba('0x10'));logger[_0xc2ba('0x11')](_0xc2ba('0x12'),_0x315327,_0xc2ba('0x10'),JSON[_0xc2ba('0x13')](_0x46a9e9));if(_0x46a9e9[_0xc2ba('0x14')]){if(_0x46a9e9[_0xc2ba('0x14')][_0xc2ba('0x15')]===0x1f4){logger[_0xc2ba('0x14')](_0xc2ba('0xf'),_0x315327,_0x46a9e9[_0xc2ba('0x14')][_0xc2ba('0x16')]);return _0x3d933a(_0x46a9e9['error'][_0xc2ba('0x16')]);}logger[_0xc2ba('0x14')](_0xc2ba('0xf'),_0x315327,_0x46a9e9[_0xc2ba('0x14')][_0xc2ba('0x16')]);return _0x5f37fb(_0x46a9e9['error'][_0xc2ba('0x16')]);}else{logger[_0xc2ba('0x17')](_0xc2ba('0xf'),_0x315327,_0xc2ba('0x10'));_0x5f37fb(_0x46a9e9[_0xc2ba('0x18')][_0xc2ba('0x16')]);}})['catch'](function(_0x3f8bdf){logger['error'](_0xc2ba('0xf'),_0x315327,_0x3f8bdf);_0x3d933a(_0x3f8bdf);});});}exports['GetFaxQueue']=function(_0x18e776){var _0x5540bb=this;return new Promise(function(_0x30534a,_0x31e168){return db['FaxQueue'][_0xc2ba('0x19')]({'raw':_0x18e776[_0xc2ba('0x1a')]?_0x18e776[_0xc2ba('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x18e776['options']?_0x18e776[_0xc2ba('0x1a')][_0xc2ba('0x1b')]||null:null,'attributes':_0x18e776['options']?_0x18e776[_0xc2ba('0x1a')]['attributes']||null:null,'limit':_0x18e776['options']?_0x18e776[_0xc2ba('0x1a')]['limit']||null:null,'include':_0x18e776['options']?_0x18e776[_0xc2ba('0x1a')]['include']?_['map'](_0x18e776[_0xc2ba('0x1a')][_0xc2ba('0x1c')],function(_0x2de2c0){return{'model':db[_0x2de2c0[_0xc2ba('0x1d')]],'as':_0x2de2c0['as'],'attributes':_0x2de2c0['attributes'],'include':_0x2de2c0[_0xc2ba('0x1c')]?_['map'](_0x2de2c0[_0xc2ba('0x1c')],function(_0x237a87){return{'model':db[_0x237a87[_0xc2ba('0x1d')]],'as':_0x237a87['as'],'attributes':_0x237a87[_0xc2ba('0x1e')],'include':_0x237a87[_0xc2ba('0x1c')]?_[_0xc2ba('0x1f')](_0x237a87[_0xc2ba('0x1c')],function(_0x5472ff){return{'model':db[_0x5472ff[_0xc2ba('0x1d')]],'as':_0x5472ff['as'],'attributes':_0x5472ff[_0xc2ba('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xc2ba('0x20')](function(_0x2407d0){logger[_0xc2ba('0x17')](_0xc2ba('0x21'),_0x18e776);logger[_0xc2ba('0x11')](_0xc2ba('0x21'),_0x18e776,JSON[_0xc2ba('0x13')](_0x2407d0));_0x30534a(_0x2407d0);})['catch'](function(_0x26eae2){logger[_0xc2ba('0x14')](_0xc2ba('0x21'),_0x26eae2[_0xc2ba('0x16')],_0x18e776);_0x31e168(_0x5540bb[_0xc2ba('0x14')](0x1f4,_0x26eae2[_0xc2ba('0x16')]));});});};exports[_0xc2ba('0x22')]=function(_0x29bf8a){var _0x5704ea=this;return new Promise(function(_0xc97d8d,_0xc3bcdf){return db['FaxQueue'][_0xc2ba('0x23')]({'raw':_0x29bf8a['options']?_0x29bf8a[_0xc2ba('0x1a')][_0xc2ba('0x24')]===undefined?!![]:![]:!![],'where':_0x29bf8a[_0xc2ba('0x1a')]?_0x29bf8a[_0xc2ba('0x1a')][_0xc2ba('0x1b')]||null:null,'attributes':_0x29bf8a['options']?_0x29bf8a[_0xc2ba('0x1a')][_0xc2ba('0x1e')]||null:null,'include':_0x29bf8a['options']?_0x29bf8a[_0xc2ba('0x1a')][_0xc2ba('0x1c')]?_[_0xc2ba('0x1f')](_0x29bf8a['options'][_0xc2ba('0x1c')],function(_0x2a02a9){return{'model':db[_0x2a02a9[_0xc2ba('0x1d')]],'as':_0x2a02a9['as'],'attributes':_0x2a02a9['attributes'],'include':_0x2a02a9['include']?_[_0xc2ba('0x1f')](_0x2a02a9[_0xc2ba('0x1c')],function(_0x111320){return{'model':db[_0x111320[_0xc2ba('0x1d')]],'as':_0x111320['as'],'attributes':_0x111320['attributes'],'include':_0x111320[_0xc2ba('0x1c')]?_['map'](_0x111320['include'],function(_0xdbd3d3){return{'model':db[_0xdbd3d3['model']],'as':_0xdbd3d3['as'],'attributes':_0xdbd3d3[_0xc2ba('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xc2ba('0x20')](function(_0x2c7602){logger[_0xc2ba('0x17')](_0xc2ba('0x22'),_0x29bf8a);logger[_0xc2ba('0x11')]('ShowFaxQueue',_0x29bf8a,JSON[_0xc2ba('0x13')](_0x2c7602));_0xc97d8d(_0x2c7602);})[_0xc2ba('0x25')](function(_0x367c26){logger[_0xc2ba('0x14')](_0xc2ba('0x22'),_0x367c26[_0xc2ba('0x16')],_0x29bf8a);_0xc3bcdf(_0x5704ea['error'](0x1f4,_0x367c26['message']));});});}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.socket.js b/server/api/faxQueue/faxQueue.socket.js index eec9412..a845db5 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 _0x920e=['remove','update','emit','removeListener','register','length','faxQueue:','save'];(function(_0x345d9a,_0x1da2e5){var _0x7fe4f=function(_0x49e20a){while(--_0x49e20a){_0x345d9a['push'](_0x345d9a['shift']());}};_0x7fe4f(++_0x1da2e5);}(_0x920e,0xc7));var _0xe920=function(_0x29ac12,_0x78fc8a){_0x29ac12=_0x29ac12-0x0;var _0x8caade=_0x920e[_0x29ac12];return _0x8caade;};'use strict';var FaxQueueEvents=require('./faxQueue.events');var events=[_0xe920('0x0'),_0xe920('0x1'),_0xe920('0x2')];function createListener(_0x4cc852,_0x2345d7){return function(_0x4598cc){_0x2345d7[_0xe920('0x3')](_0x4cc852,_0x4598cc);};}function removeListener(_0xda2e29,_0x579748){return function(){FaxQueueEvents[_0xe920('0x4')](_0xda2e29,_0x579748);};}exports[_0xe920('0x5')]=function(_0x5bd263){for(var _0x2966b0=0x0,_0x100438=events[_0xe920('0x6')];_0x2966b0<_0x100438;_0x2966b0++){var _0x2ca58d=events[_0x2966b0];var _0x56a01d=createListener(_0xe920('0x7')+_0x2ca58d,_0x5bd263);FaxQueueEvents['on'](_0x2ca58d,_0x56a01d);}}; \ No newline at end of file +var _0x1220=['emit','length','./faxQueue.events','save'];(function(_0x2b3513,_0x3b62d4){var _0x1486cd=function(_0x1902fc){while(--_0x1902fc){_0x2b3513['push'](_0x2b3513['shift']());}};_0x1486cd(++_0x3b62d4);}(_0x1220,0x8a));var _0x0122=function(_0x422905,_0x3bce3a){_0x422905=_0x422905-0x0;var _0x33dc6c=_0x1220[_0x422905];return _0x33dc6c;};'use strict';var FaxQueueEvents=require(_0x0122('0x0'));var events=[_0x0122('0x1'),'remove','update'];function createListener(_0x4842aa,_0x1b23e6){return function(_0xebad2b){_0x1b23e6[_0x0122('0x2')](_0x4842aa,_0xebad2b);};}function removeListener(_0x400a17,_0x2876f4){return function(){FaxQueueEvents['removeListener'](_0x400a17,_0x2876f4);};}exports['register']=function(_0x300dfe){for(var _0x33bd09=0x0,_0x8b4dca=events[_0x0122('0x3')];_0x33bd09<_0x8b4dca;_0x33bd09++){var _0x5b72e5=events[_0x33bd09];var _0x38e810=createListener('faxQueue:'+_0x5b72e5,_0x300dfe);FaxQueueEvents['on'](_0x5b72e5,_0x38e810);}}; \ No newline at end of file diff --git a/server/api/faxQueue/index.js b/server/api/faxQueue/index.js index d0bc2ad..03cdc9e 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 _0xa809=['express','../../components/interaction/service','../../config/environment','./faxQueue.controller','get','index','/describe','isAuthenticated','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','getAgents','post','create','addAgents','put','update','delete','removeTeams','/:id/users','exports','util'];(function(_0xf34109,_0x380779){var _0x570bfc=function(_0x1ad086){while(--_0x1ad086){_0xf34109['push'](_0xf34109['shift']());}};_0x570bfc(++_0x380779);}(_0xa809,0x1f3));var _0x9a80=function(_0x5be338,_0x5c82f5){_0x5be338=_0x5be338-0x0;var _0x55d43b=_0xa809[_0x5be338];return _0x55d43b;};'use strict';var multer=require('multer');var util=require(_0x9a80('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x9a80('0x1'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x9a80('0x2'));var config=require(_0x9a80('0x3'));var controller=require(_0x9a80('0x4'));router[_0x9a80('0x5')]('/',auth['isAuthenticated'](),controller[_0x9a80('0x6')]);router['get'](_0x9a80('0x7'),auth[_0x9a80('0x8')](),controller['describe']);router[_0x9a80('0x5')](_0x9a80('0x9'),auth[_0x9a80('0x8')](),controller[_0x9a80('0xa')]);router['get'](_0x9a80('0xb'),auth[_0x9a80('0x8')](),controller[_0x9a80('0xc')]);router[_0x9a80('0x5')](_0x9a80('0xd'),auth[_0x9a80('0x8')](),controller[_0x9a80('0xe')]);router[_0x9a80('0x5')]('/:id/users',auth[_0x9a80('0x8')](),controller[_0x9a80('0xf')]);router[_0x9a80('0x10')]('/',auth[_0x9a80('0x8')](),controller[_0x9a80('0x11')]);router[_0x9a80('0x10')](_0x9a80('0xd'),auth[_0x9a80('0x8')](),controller['addTeams']);router[_0x9a80('0x10')]('/:id/users',auth[_0x9a80('0x8')](),controller[_0x9a80('0x12')]);router[_0x9a80('0x13')]('/:id',auth[_0x9a80('0x8')](),controller[_0x9a80('0x14')]);router[_0x9a80('0x15')](_0x9a80('0x9'),auth[_0x9a80('0x8')](),controller['destroy']);router[_0x9a80('0x15')]('/:id/teams',auth[_0x9a80('0x8')](),controller[_0x9a80('0x16')]);router[_0x9a80('0x15')](_0x9a80('0x17'),auth['isAuthenticated'](),controller['removeAgents']);module[_0x9a80('0x18')]=router; \ No newline at end of file +var _0x9f37=['exports','multer','util','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','./faxQueue.controller','get','/describe','isAuthenticated','describe','/:id','/:id/members','getMembers','getTeams','getAgents','post','/:id/teams','addTeams','/:id/users','put','update','delete','removeTeams','removeAgents'];(function(_0x4beb19,_0x3b6afe){var _0x3b2cbe=function(_0x5c00b){while(--_0x5c00b){_0x4beb19['push'](_0x4beb19['shift']());}};_0x3b2cbe(++_0x3b6afe);}(_0x9f37,0xd1));var _0x79f3=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x9f37[_0x2c91e9];return _0x13f0ff;};'use strict';var multer=require(_0x79f3('0x0'));var util=require(_0x79f3('0x1'));var path=require('path');var timeout=require(_0x79f3('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x79f3('0x3'));var auth=require(_0x79f3('0x4'));var interaction=require(_0x79f3('0x5'));var config=require('../../config/environment');var controller=require(_0x79f3('0x6'));router[_0x79f3('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0x79f3('0x7')](_0x79f3('0x8'),auth[_0x79f3('0x9')](),controller[_0x79f3('0xa')]);router['get'](_0x79f3('0xb'),auth[_0x79f3('0x9')](),controller['show']);router[_0x79f3('0x7')](_0x79f3('0xc'),auth[_0x79f3('0x9')](),controller[_0x79f3('0xd')]);router[_0x79f3('0x7')]('/:id/teams',auth[_0x79f3('0x9')](),controller[_0x79f3('0xe')]);router['get']('/:id/users',auth[_0x79f3('0x9')](),controller[_0x79f3('0xf')]);router[_0x79f3('0x10')]('/',auth[_0x79f3('0x9')](),controller['create']);router[_0x79f3('0x10')](_0x79f3('0x11'),auth[_0x79f3('0x9')](),controller[_0x79f3('0x12')]);router[_0x79f3('0x10')](_0x79f3('0x13'),auth['isAuthenticated'](),controller['addAgents']);router[_0x79f3('0x14')](_0x79f3('0xb'),auth['isAuthenticated'](),controller[_0x79f3('0x15')]);router[_0x79f3('0x16')](_0x79f3('0xb'),auth[_0x79f3('0x9')](),controller['destroy']);router[_0x79f3('0x16')](_0x79f3('0x11'),auth[_0x79f3('0x9')](),controller[_0x79f3('0x17')]);router[_0x79f3('0x16')](_0x79f3('0x13'),auth[_0x79f3('0x9')](),controller[_0x79f3('0x18')]);module[_0x79f3('0x19')]=router; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.attributes.js b/server/api/faxQueueReport/faxQueueReport.attributes.js index 9e420c1..a7248aa 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 _0xb18e=['DATE','moment','sequelize','STRING'];(function(_0x49f53c,_0x26dbc9){var _0x464ded=function(_0x22d770){while(--_0x22d770){_0x49f53c['push'](_0x49f53c['shift']());}};_0x464ded(++_0x26dbc9);}(_0xb18e,0x199));var _0xeb18=function(_0x59b439,_0x14ae7b){_0x59b439=_0x59b439-0x0;var _0x521ea3=_0xb18e[_0x59b439];return _0x521ea3;};'use strict';var moment=require(_0xeb18('0x0'));var Sequelize=require(_0xeb18('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0xeb18('0x2')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0xeb18('0x3')]},'leaveAt':{'type':Sequelize[_0xeb18('0x3')]},'acceptAt':{'type':Sequelize[_0xeb18('0x3')]},'exitAt':{'type':Sequelize[_0xeb18('0x3')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x015d=['DATE','STRING','moment','sequelize'];(function(_0x21b4af,_0x42ab0a){var _0x20a8f6=function(_0x2ac494){while(--_0x2ac494){_0x21b4af['push'](_0x21b4af['shift']());}};_0x20a8f6(++_0x42ab0a);}(_0x015d,0xd2));var _0xd015=function(_0xbf8ebe,_0x3b69a5){_0xbf8ebe=_0xbf8ebe-0x0;var _0x1e25e8=_0x015d[_0xbf8ebe];return _0x1e25e8;};'use strict';var moment=require(_0xd015('0x0'));var Sequelize=require(_0xd015('0x1'));module['exports']={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0xd015('0x2')]},'leaveAt':{'type':Sequelize[_0xd015('0x2')]},'acceptAt':{'type':Sequelize[_0xd015('0x2')]},'exitAt':{'type':Sequelize[_0xd015('0x2')]},'reason':{'type':Sequelize[_0xd015('0x3')]}}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.controller.js b/server/api/faxQueueReport/faxQueueReport.controller.js index 3b9c051..261b513 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 _0xbefe=['mustache','util','path','sox','ejs','fs-extra','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','update','then','destroy','sendStatus','error','FaxQueueReport','fieldName','key','map','name','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','type','merge','includeAll','findAll','rows','catch','show','rawAttributes','options','find','create','body','params','describe','rimraf','fast-json-patch','request-promise','moment','bluebird'];(function(_0x4ffa03,_0x363a82){var _0x30d661=function(_0x36ba86){while(--_0x36ba86){_0x4ffa03['push'](_0x4ffa03['shift']());}};_0x30d661(++_0x363a82);}(_0xbefe,0x168));var _0xebef=function(_0x1b4f25,_0x387b6c){_0x1b4f25=_0x1b4f25-0x0;var _0x3491f2=_0xbefe[_0x1b4f25];return _0x3491f2;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xebef('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xebef('0x1'));var rp=require(_0xebef('0x2'));var moment=require(_0xebef('0x3'));var BPromise=require(_0xebef('0x4'));var Mustache=require(_0xebef('0x5'));var util=require(_0xebef('0x6'));var path=require(_0xebef('0x7'));var sox=require(_0xebef('0x8'));var csv=require('to-csv');var ejs=require(_0xebef('0x9'));var fs=require('fs');var fs_extra=require(_0xebef('0xa'));var _=require(_0xebef('0xb'));var squel=require('squel');var crypto=require(_0xebef('0xc'));var jsforce=require(_0xebef('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xebef('0xe'));var Papa=require(_0xebef('0xf'));var Redis=require(_0xebef('0x10'));var authService=require(_0xebef('0x11'));var qs=require(_0xebef('0x12'));var as=require(_0xebef('0x13'));var hardwareService=require(_0xebef('0x14'));var logger=require(_0xebef('0x15'))('api');var utils=require(_0xebef('0x16'));var config=require(_0xebef('0x17'));var licenseUtil=require(_0xebef('0x18'));var db=require(_0xebef('0x19'))['db'];function respondWithStatusCode(_0x1dcae4,_0x566dbe){_0x566dbe=_0x566dbe||0xcc;return function(_0x584ac2){if(_0x584ac2){return _0x1dcae4['sendStatus'](_0x566dbe);}return _0x1dcae4['status'](_0x566dbe)[_0xebef('0x1a')]();};}function respondWithResult(_0x124634,_0x31772a){_0x31772a=_0x31772a||0xc8;return function(_0x35cd7a){if(_0x35cd7a){return _0x124634[_0xebef('0x1b')](_0x31772a)[_0xebef('0x1c')](_0x35cd7a);}};}function respondWithFilteredResult(_0x5813eb,_0x32ec37){return function(_0x9411d4){if(_0x9411d4){var _0x1921aa=typeof _0x32ec37[_0xebef('0x1d')]===_0xebef('0x1e')&&typeof _0x32ec37[_0xebef('0x1f')]===_0xebef('0x1e');var _0x1e4ddf=_0x9411d4[_0xebef('0x20')];var _0x16856f=_0x1921aa?0x0:_0x32ec37[_0xebef('0x1d')];var _0x5161f1=_0x1921aa?_0x9411d4[_0xebef('0x20')]:_0x32ec37[_0xebef('0x1d')]+_0x32ec37[_0xebef('0x1f')];var _0x502c1e;if(_0x5161f1>=_0x1e4ddf){_0x5161f1=_0x1e4ddf;_0x502c1e=0xc8;}else{_0x502c1e=0xce;}_0x5813eb[_0xebef('0x1b')](_0x502c1e);return _0x5813eb[_0xebef('0x21')](_0xebef('0x22'),_0x16856f+'-'+_0x5161f1+'/'+_0x1e4ddf)[_0xebef('0x1c')](_0x9411d4);}return null;};}function patchUpdates(_0x7ca0cc){return function(_0x138760){try{jsonpatch[_0xebef('0x23')](_0x138760,_0x7ca0cc,!![]);}catch(_0x4cc18e){return BPromise['reject'](_0x4cc18e);}return _0x138760['save']();};}function saveUpdates(_0x59e078,_0x2f1193){return function(_0x38f0b8){if(_0x38f0b8){return _0x38f0b8[_0xebef('0x24')](_0x59e078)[_0xebef('0x25')](function(_0x1ee3b){return _0x1ee3b;});}return null;};}function removeEntity(_0xe8dcbf,_0x5c5091){return function(_0x460104){if(_0x460104){return _0x460104[_0xebef('0x26')]()[_0xebef('0x25')](function(){_0xe8dcbf[_0xebef('0x1b')](0xcc)[_0xebef('0x1a')]();});}};}function handleEntityNotFound(_0x27f212,_0x36ca6b){return function(_0x42d2af){if(!_0x42d2af){_0x27f212[_0xebef('0x27')](0x194);}return _0x42d2af;};}function handleError(_0x2d63a8,_0x456a81){_0x456a81=_0x456a81||0x1f4;return function(_0x4fb77f){logger[_0xebef('0x28')](_0x4fb77f['stack']);if(_0x4fb77f['name']){delete _0x4fb77f['name'];}_0x2d63a8['status'](_0x456a81)['send'](_0x4fb77f);};}exports['index']=function(_0x55732a,_0x5703fc){var _0x506e64={},_0x5a9249={},_0x54001c={'count':0x0,'rows':[]};var _0x136ac3=_['map'](db[_0xebef('0x29')]['rawAttributes'],function(_0x3efbc4){return{'name':_0x3efbc4[_0xebef('0x2a')],'type':_0x3efbc4['type'][_0xebef('0x2b')]};});_0x5a9249['model']=_[_0xebef('0x2c')](_0x136ac3,_0xebef('0x2d'));_0x5a9249[_0xebef('0x2e')]=_[_0xebef('0x2f')](_0x55732a[_0xebef('0x2e')]);_0x5a9249[_0xebef('0x30')]=_['intersection'](_0x5a9249[_0xebef('0x31')],_0x5a9249['query']);_0x506e64[_0xebef('0x32')]=_[_0xebef('0x33')](_0x5a9249[_0xebef('0x31')],qs[_0xebef('0x34')](_0x55732a[_0xebef('0x2e')][_0xebef('0x34')]));_0x506e64[_0xebef('0x32')]=_0x506e64['attributes'][_0xebef('0x35')]?_0x506e64[_0xebef('0x32')]:_0x5a9249[_0xebef('0x31')];if(!_0x55732a[_0xebef('0x2e')][_0xebef('0x36')](_0xebef('0x37'))){_0x506e64[_0xebef('0x1f')]=qs['limit'](_0x55732a[_0xebef('0x2e')][_0xebef('0x1f')]);_0x506e64['offset']=qs[_0xebef('0x1d')](_0x55732a[_0xebef('0x2e')][_0xebef('0x1d')]);}_0x506e64[_0xebef('0x38')]=qs[_0xebef('0x39')](_0x55732a['query'][_0xebef('0x39')]);_0x506e64[_0xebef('0x3a')]=qs['filters'](_['pick'](_0x55732a[_0xebef('0x2e')],_0x5a9249['filters']),_0x136ac3);if(_0x55732a['query']['filter']){_0x506e64[_0xebef('0x3a')]=_['merge'](_0x506e64['where'],{'$or':_[_0xebef('0x2c')](_0x136ac3,function(_0xd9406){if(_0xd9406[_0xebef('0x3b')]!=='VIRTUAL'){var _0x16971a={};_0x16971a[_0xd9406['name']]={'$like':'%'+_0x55732a['query']['filter']+'%'};return _0x16971a;}})});}_0x506e64=_[_0xebef('0x3c')]({},_0x506e64,_0x55732a['options']);var _0x1e7698={'where':_0x506e64['where']};return db['FaxQueueReport'][_0xebef('0x20')](_0x1e7698)[_0xebef('0x25')](function(_0x22703d){_0x54001c[_0xebef('0x20')]=_0x22703d;if(_0x55732a[_0xebef('0x2e')][_0xebef('0x3d')]){_0x506e64['include']=[{'all':!![]}];}return db[_0xebef('0x29')][_0xebef('0x3e')](_0x506e64);})[_0xebef('0x25')](function(_0xdf1921){_0x54001c[_0xebef('0x3f')]=_0xdf1921;return _0x54001c;})[_0xebef('0x25')](respondWithFilteredResult(_0x5703fc,_0x506e64))[_0xebef('0x40')](handleError(_0x5703fc,null));};exports[_0xebef('0x41')]=function(_0xf4b159,_0xa69151){var _0x56fe84={'raw':!![],'where':{'id':_0xf4b159['params']['id']}},_0x5cf908={};_0x5cf908['model']=_[_0xebef('0x2f')](db[_0xebef('0x29')][_0xebef('0x42')]);_0x5cf908[_0xebef('0x2e')]=_[_0xebef('0x2f')](_0xf4b159['query']);_0x5cf908['filters']=_[_0xebef('0x33')](_0x5cf908['model'],_0x5cf908['query']);_0x56fe84[_0xebef('0x32')]=_[_0xebef('0x33')](_0x5cf908[_0xebef('0x31')],qs[_0xebef('0x34')](_0xf4b159[_0xebef('0x2e')][_0xebef('0x34')]));_0x56fe84[_0xebef('0x32')]=_0x56fe84[_0xebef('0x32')][_0xebef('0x35')]?_0x56fe84[_0xebef('0x32')]:_0x5cf908[_0xebef('0x31')];if(_0xf4b159[_0xebef('0x2e')][_0xebef('0x3d')]){_0x56fe84['include']=[{'all':!![]}];}_0x56fe84=_[_0xebef('0x3c')]({},_0x56fe84,_0xf4b159[_0xebef('0x43')]);return db[_0xebef('0x29')][_0xebef('0x44')](_0x56fe84)[_0xebef('0x25')](handleEntityNotFound(_0xa69151,null))[_0xebef('0x25')](respondWithResult(_0xa69151,null))['catch'](handleError(_0xa69151,null));};exports[_0xebef('0x45')]=function(_0x349490,_0x1c7c81){return db['FaxQueueReport']['create'](_0x349490[_0xebef('0x46')],{})['then'](respondWithResult(_0x1c7c81,0xc9))[_0xebef('0x40')](handleError(_0x1c7c81,null));};exports[_0xebef('0x24')]=function(_0x2f22de,_0x1d70e8){if(_0x2f22de[_0xebef('0x46')]['id']){delete _0x2f22de[_0xebef('0x46')]['id'];}return db[_0xebef('0x29')]['find']({'where':{'id':_0x2f22de[_0xebef('0x47')]['id']}})['then'](handleEntityNotFound(_0x1d70e8,null))[_0xebef('0x25')](saveUpdates(_0x2f22de[_0xebef('0x46')],null))[_0xebef('0x25')](respondWithResult(_0x1d70e8,null))[_0xebef('0x40')](handleError(_0x1d70e8,null));};exports['destroy']=function(_0x5f9e80,_0x52f067){return db['FaxQueueReport'][_0xebef('0x44')]({'where':{'id':_0x5f9e80[_0xebef('0x47')]['id']}})[_0xebef('0x25')](handleEntityNotFound(_0x52f067,null))[_0xebef('0x25')](removeEntity(_0x52f067,null))[_0xebef('0x40')](handleError(_0x52f067,null));};exports[_0xebef('0x48')]=function(_0x2b7c09,_0x35a755){return db[_0xebef('0x29')][_0xebef('0x48')]()[_0xebef('0x25')](respondWithResult(_0x35a755,null))[_0xebef('0x40')](handleError(_0x35a755,null));}; \ No newline at end of file +var _0x1f38=['to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','apply','update','then','destroy','end','error','name','send','index','map','FaxQueueReport','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','length','nolimit','order','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','catch','show','keys','create','body','find','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox'];(function(_0x4525cb,_0x4239f6){var _0x486554=function(_0x2d06a0){while(--_0x2d06a0){_0x4525cb['push'](_0x4525cb['shift']());}};_0x486554(++_0x4239f6);}(_0x1f38,0xd7));var _0x81f3=function(_0x2715b5,_0xdc645f){_0x2715b5=_0x2715b5-0x0;var _0x114369=_0x1f38[_0x2715b5];return _0x114369;};'use strict';var emlformat=require(_0x81f3('0x0'));var rimraf=require(_0x81f3('0x1'));var zipdir=require(_0x81f3('0x2'));var jsonpatch=require(_0x81f3('0x3'));var rp=require(_0x81f3('0x4'));var moment=require(_0x81f3('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x81f3('0x6'));var util=require(_0x81f3('0x7'));var path=require(_0x81f3('0x8'));var sox=require(_0x81f3('0x9'));var csv=require(_0x81f3('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x81f3('0xb'));var _=require(_0x81f3('0xc'));var squel=require(_0x81f3('0xd'));var crypto=require(_0x81f3('0xe'));var jsforce=require(_0x81f3('0xf'));var deskjs=require(_0x81f3('0x10'));var toCsv=require(_0x81f3('0xa'));var querystring=require(_0x81f3('0x11'));var Papa=require(_0x81f3('0x12'));var Redis=require(_0x81f3('0x13'));var authService=require(_0x81f3('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0x81f3('0x15'));var hardwareService=require(_0x81f3('0x16'));var logger=require(_0x81f3('0x17'))(_0x81f3('0x18'));var utils=require(_0x81f3('0x19'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x81f3('0x1a'))['db'];function respondWithStatusCode(_0x3ca3e8,_0x28a6ee){_0x28a6ee=_0x28a6ee||0xcc;return function(_0x422140){if(_0x422140){return _0x3ca3e8[_0x81f3('0x1b')](_0x28a6ee);}return _0x3ca3e8[_0x81f3('0x1c')](_0x28a6ee)['end']();};}function respondWithResult(_0x169119,_0x79b7b){_0x79b7b=_0x79b7b||0xc8;return function(_0x469b84){if(_0x469b84){return _0x169119['status'](_0x79b7b)[_0x81f3('0x1d')](_0x469b84);}};}function respondWithFilteredResult(_0x44c4e9,_0x3f177b){return function(_0x3a444c){if(_0x3a444c){var _0x19c5f1=typeof _0x3f177b[_0x81f3('0x1e')]===_0x81f3('0x1f')&&typeof _0x3f177b[_0x81f3('0x20')]===_0x81f3('0x1f');var _0x2fbf4e=_0x3a444c[_0x81f3('0x21')];var _0x48f4a2=_0x19c5f1?0x0:_0x3f177b[_0x81f3('0x1e')];var _0x336d5c=_0x19c5f1?_0x3a444c[_0x81f3('0x21')]:_0x3f177b[_0x81f3('0x1e')]+_0x3f177b[_0x81f3('0x20')];var _0x49181a;if(_0x336d5c>=_0x2fbf4e){_0x336d5c=_0x2fbf4e;_0x49181a=0xc8;}else{_0x49181a=0xce;}_0x44c4e9[_0x81f3('0x1c')](_0x49181a);return _0x44c4e9[_0x81f3('0x22')]('Content-Range',_0x48f4a2+'-'+_0x336d5c+'/'+_0x2fbf4e)[_0x81f3('0x1d')](_0x3a444c);}return null;};}function patchUpdates(_0x5a5ca2){return function(_0x3ddc0d){try{jsonpatch[_0x81f3('0x23')](_0x3ddc0d,_0x5a5ca2,!![]);}catch(_0x473da7){return BPromise['reject'](_0x473da7);}return _0x3ddc0d['save']();};}function saveUpdates(_0x105fe6,_0x3fdc9f){return function(_0x4aaeff){if(_0x4aaeff){return _0x4aaeff[_0x81f3('0x24')](_0x105fe6)[_0x81f3('0x25')](function(_0x4f6dee){return _0x4f6dee;});}return null;};}function removeEntity(_0x3f22a4,_0x1ced46){return function(_0x1acee8){if(_0x1acee8){return _0x1acee8[_0x81f3('0x26')]()[_0x81f3('0x25')](function(){_0x3f22a4[_0x81f3('0x1c')](0xcc)[_0x81f3('0x27')]();});}};}function handleEntityNotFound(_0x521c6d,_0x1c7302){return function(_0x572cdb){if(!_0x572cdb){_0x521c6d['sendStatus'](0x194);}return _0x572cdb;};}function handleError(_0x33c276,_0x76e8d){_0x76e8d=_0x76e8d||0x1f4;return function(_0x5a94a0){logger[_0x81f3('0x28')](_0x5a94a0['stack']);if(_0x5a94a0[_0x81f3('0x29')]){delete _0x5a94a0[_0x81f3('0x29')];}_0x33c276['status'](_0x76e8d)[_0x81f3('0x2a')](_0x5a94a0);};}exports[_0x81f3('0x2b')]=function(_0x46025a,_0x38b939){var _0x37ed34={},_0x2cc9b2={},_0x25ef3e={'count':0x0,'rows':[]};var _0x560adf=_[_0x81f3('0x2c')](db[_0x81f3('0x2d')][_0x81f3('0x2e')],function(_0x15441a){return{'name':_0x15441a[_0x81f3('0x2f')],'type':_0x15441a[_0x81f3('0x30')]['key']};});_0x2cc9b2[_0x81f3('0x31')]=_['map'](_0x560adf,'name');_0x2cc9b2[_0x81f3('0x32')]=_['keys'](_0x46025a[_0x81f3('0x32')]);_0x2cc9b2[_0x81f3('0x33')]=_[_0x81f3('0x34')](_0x2cc9b2[_0x81f3('0x31')],_0x2cc9b2[_0x81f3('0x32')]);_0x37ed34[_0x81f3('0x35')]=_[_0x81f3('0x34')](_0x2cc9b2[_0x81f3('0x31')],qs[_0x81f3('0x36')](_0x46025a[_0x81f3('0x32')][_0x81f3('0x36')]));_0x37ed34[_0x81f3('0x35')]=_0x37ed34[_0x81f3('0x35')][_0x81f3('0x37')]?_0x37ed34['attributes']:_0x2cc9b2[_0x81f3('0x31')];if(!_0x46025a[_0x81f3('0x32')]['hasOwnProperty'](_0x81f3('0x38'))){_0x37ed34[_0x81f3('0x20')]=qs[_0x81f3('0x20')](_0x46025a[_0x81f3('0x32')]['limit']);_0x37ed34[_0x81f3('0x1e')]=qs[_0x81f3('0x1e')](_0x46025a[_0x81f3('0x32')][_0x81f3('0x1e')]);}_0x37ed34[_0x81f3('0x39')]=qs['sort'](_0x46025a[_0x81f3('0x32')]['sort']);_0x37ed34[_0x81f3('0x3a')]=qs[_0x81f3('0x33')](_[_0x81f3('0x3b')](_0x46025a[_0x81f3('0x32')],_0x2cc9b2['filters']),_0x560adf);if(_0x46025a['query'][_0x81f3('0x3c')]){_0x37ed34['where']=_['merge'](_0x37ed34[_0x81f3('0x3a')],{'$or':_[_0x81f3('0x2c')](_0x560adf,function(_0x395d6a){if(_0x395d6a[_0x81f3('0x30')]!==_0x81f3('0x3d')){var _0x574046={};_0x574046[_0x395d6a[_0x81f3('0x29')]]={'$like':'%'+_0x46025a['query']['filter']+'%'};return _0x574046;}})});}_0x37ed34=_[_0x81f3('0x3e')]({},_0x37ed34,_0x46025a[_0x81f3('0x3f')]);var _0x1ad0c5={'where':_0x37ed34['where']};return db[_0x81f3('0x2d')][_0x81f3('0x21')](_0x1ad0c5)[_0x81f3('0x25')](function(_0x196f71){_0x25ef3e[_0x81f3('0x21')]=_0x196f71;if(_0x46025a[_0x81f3('0x32')][_0x81f3('0x40')]){_0x37ed34[_0x81f3('0x41')]=[{'all':!![]}];}return db[_0x81f3('0x2d')][_0x81f3('0x42')](_0x37ed34);})[_0x81f3('0x25')](function(_0x3aa573){_0x25ef3e['rows']=_0x3aa573;return _0x25ef3e;})[_0x81f3('0x25')](respondWithFilteredResult(_0x38b939,_0x37ed34))[_0x81f3('0x43')](handleError(_0x38b939,null));};exports[_0x81f3('0x44')]=function(_0xc4c1d8,_0x406dde){var _0x33a1a8={'raw':!![],'where':{'id':_0xc4c1d8['params']['id']}},_0x26903a={};_0x26903a[_0x81f3('0x31')]=_[_0x81f3('0x45')](db[_0x81f3('0x2d')][_0x81f3('0x2e')]);_0x26903a[_0x81f3('0x32')]=_[_0x81f3('0x45')](_0xc4c1d8[_0x81f3('0x32')]);_0x26903a[_0x81f3('0x33')]=_[_0x81f3('0x34')](_0x26903a[_0x81f3('0x31')],_0x26903a[_0x81f3('0x32')]);_0x33a1a8[_0x81f3('0x35')]=_[_0x81f3('0x34')](_0x26903a['model'],qs[_0x81f3('0x36')](_0xc4c1d8[_0x81f3('0x32')][_0x81f3('0x36')]));_0x33a1a8[_0x81f3('0x35')]=_0x33a1a8[_0x81f3('0x35')][_0x81f3('0x37')]?_0x33a1a8[_0x81f3('0x35')]:_0x26903a['model'];if(_0xc4c1d8[_0x81f3('0x32')][_0x81f3('0x40')]){_0x33a1a8['include']=[{'all':!![]}];}_0x33a1a8=_[_0x81f3('0x3e')]({},_0x33a1a8,_0xc4c1d8[_0x81f3('0x3f')]);return db[_0x81f3('0x2d')]['find'](_0x33a1a8)[_0x81f3('0x25')](handleEntityNotFound(_0x406dde,null))[_0x81f3('0x25')](respondWithResult(_0x406dde,null))[_0x81f3('0x43')](handleError(_0x406dde,null));};exports[_0x81f3('0x46')]=function(_0x34792b,_0x53944a){return db[_0x81f3('0x2d')]['create'](_0x34792b['body'],{})['then'](respondWithResult(_0x53944a,0xc9))[_0x81f3('0x43')](handleError(_0x53944a,null));};exports[_0x81f3('0x24')]=function(_0x53caf9,_0x2cd316){if(_0x53caf9['body']['id']){delete _0x53caf9[_0x81f3('0x47')]['id'];}return db['FaxQueueReport'][_0x81f3('0x48')]({'where':{'id':_0x53caf9['params']['id']}})[_0x81f3('0x25')](handleEntityNotFound(_0x2cd316,null))[_0x81f3('0x25')](saveUpdates(_0x53caf9[_0x81f3('0x47')],null))['then'](respondWithResult(_0x2cd316,null))[_0x81f3('0x43')](handleError(_0x2cd316,null));};exports[_0x81f3('0x26')]=function(_0x4d2db9,_0x45682d){return db[_0x81f3('0x2d')]['find']({'where':{'id':_0x4d2db9[_0x81f3('0x49')]['id']}})[_0x81f3('0x25')](handleEntityNotFound(_0x45682d,null))[_0x81f3('0x25')](removeEntity(_0x45682d,null))[_0x81f3('0x43')](handleError(_0x45682d,null));};exports[_0x81f3('0x4a')]=function(_0x3be28d,_0xaf51a3){return db['FaxQueueReport']['describe']()[_0x81f3('0x25')](respondWithResult(_0xaf51a3,null))[_0x81f3('0x43')](handleError(_0xaf51a3,null));}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.model.js b/server/api/faxQueueReport/faxQueueReport.model.js index d1ca9e8..2ad2a00 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 _0xc4aa=['bluebird','../../config/environment','./faxQueueReport.attributes','exports','define','FaxQueueReport','report_fax_queue','lodash','util','../../config/logger','api','moment'];(function(_0x123088,_0x32a7a8){var _0xfedf22=function(_0xdc652b){while(--_0xdc652b){_0x123088['push'](_0x123088['shift']());}};_0xfedf22(++_0x32a7a8);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x46698a,_0x8de1e4){_0x46698a=_0x46698a-0x0;var _0x356db0=_0xc4aa[_0x46698a];return _0x356db0;};'use strict';var _=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var logger=require(_0xac4a('0x2'))(_0xac4a('0x3'));var moment=require(_0xac4a('0x4'));var BPromise=require(_0xac4a('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xac4a('0x6'));var attributes=require(_0xac4a('0x7'));module[_0xac4a('0x8')]=function(_0x215f39,_0x96be2b){return _0x215f39[_0xac4a('0x9')](_0xac4a('0xa'),attributes,{'tableName':_0xac4a('0xb'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x814b=['../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./faxQueueReport.attributes','exports','define','FaxQueueReport','uniqueid','lodash','util'];(function(_0x4207f4,_0x1f778b){var _0x29a621=function(_0xa6f5b7){while(--_0xa6f5b7){_0x4207f4['push'](_0x4207f4['shift']());}};_0x29a621(++_0x1f778b);}(_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_fax_queue','paranoid':![],'indexes':[{'name':_0xb814('0xd'),'fields':[_0xb814('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.rpc.js b/server/api/faxQueueReport/faxQueueReport.rpc.js index 7d4b6ff..74608c7 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 _0x4366=['../../config/environment','jayson/promise','client','http','then','info','request\x20sent','debug','FaxQueueReport,\x20%s,\x20%s,\x20%s','error','message','FaxQueueReport,\x20%s,\x20%s','result','catch','FaxQueueReport','create','body','options','CreateFaxQueueReport','stringify','update','raw','where','attributes','limit','UpdateFaxQueueReport','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','rpc'];(function(_0x20fb02,_0x96c029){var _0x24a33e=function(_0x4b5c8a){while(--_0x4b5c8a){_0x20fb02['push'](_0x20fb02['shift']());}};_0x24a33e(++_0x96c029);}(_0x4366,0x185));var _0x6436=function(_0x208e67,_0x276ba2){_0x208e67=_0x208e67-0x0;var _0x13cf12=_0x4366[_0x208e67];return _0x13cf12;};'use strict';var _=require(_0x6436('0x0'));var util=require(_0x6436('0x1'));var moment=require(_0x6436('0x2'));var BPromise=require('bluebird');var rs=require(_0x6436('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6436('0x4'))['db'];var utils=require(_0x6436('0x5'));var logger=require('../../config/logger')(_0x6436('0x6'));var config=require(_0x6436('0x7'));var jayson=require(_0x6436('0x8'));var client=jayson[_0x6436('0x9')][_0x6436('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x32de80,_0x3f0127,_0x4da957){return new BPromise(function(_0x2e4068,_0x20cea1){return client['request'](_0x32de80,_0x4da957)[_0x6436('0xb')](function(_0x523647){logger[_0x6436('0xc')]('FaxQueueReport,\x20%s,\x20%s',_0x3f0127,_0x6436('0xd'));logger[_0x6436('0xe')](_0x6436('0xf'),_0x3f0127,_0x6436('0xd'),JSON['stringify'](_0x523647));if(_0x523647[_0x6436('0x10')]){if(_0x523647[_0x6436('0x10')]['code']===0x1f4){logger['error']('FaxQueueReport,\x20%s,\x20%s',_0x3f0127,_0x523647[_0x6436('0x10')][_0x6436('0x11')]);return _0x20cea1(_0x523647[_0x6436('0x10')][_0x6436('0x11')]);}logger[_0x6436('0x10')](_0x6436('0x12'),_0x3f0127,_0x523647[_0x6436('0x10')][_0x6436('0x11')]);return _0x2e4068(_0x523647[_0x6436('0x10')][_0x6436('0x11')]);}else{logger['info'](_0x6436('0x12'),_0x3f0127,_0x6436('0xd'));_0x2e4068(_0x523647[_0x6436('0x13')][_0x6436('0x11')]);}})[_0x6436('0x14')](function(_0x5e5041){logger[_0x6436('0x10')](_0x6436('0x12'),_0x3f0127,_0x5e5041);_0x20cea1(_0x5e5041);});});}exports['CreateFaxQueueReport']=function(_0x889b18){var _0x3417fe=this;return new Promise(function(_0x535a09,_0x7637b){return db[_0x6436('0x15')][_0x6436('0x16')](_0x889b18[_0x6436('0x17')],{'raw':_0x889b18[_0x6436('0x18')]?_0x889b18['options']['raw']===undefined?!![]:![]:!![]})['then'](function(_0x281542){logger['info'](_0x6436('0x19'),_0x889b18);logger[_0x6436('0xe')](_0x6436('0x19'),_0x889b18,JSON[_0x6436('0x1a')](_0x281542));_0x535a09(_0x281542);})[_0x6436('0x14')](function(_0x302771){logger[_0x6436('0x10')]('CreateFaxQueueReport',_0x302771['message'],_0x889b18);_0x7637b(_0x3417fe[_0x6436('0x10')](0x1f4,_0x302771[_0x6436('0x11')]));});});};exports['UpdateFaxQueueReport']=function(_0x2ab238){var _0x1df1b3=this;return new Promise(function(_0x5b5d3f,_0x3f5bf1){return db['FaxQueueReport'][_0x6436('0x1b')](_0x2ab238[_0x6436('0x17')],{'raw':_0x2ab238[_0x6436('0x18')]?_0x2ab238['options'][_0x6436('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2ab238[_0x6436('0x18')]?_0x2ab238[_0x6436('0x18')][_0x6436('0x1d')]||null:null,'attributes':_0x2ab238['options']?_0x2ab238[_0x6436('0x18')][_0x6436('0x1e')]||null:null,'limit':_0x2ab238[_0x6436('0x18')]?_0x2ab238[_0x6436('0x18')][_0x6436('0x1f')]||null:null})[_0x6436('0xb')](function(_0x131820){logger['info'](_0x6436('0x20'),_0x2ab238);logger[_0x6436('0xe')](_0x6436('0x20'),_0x2ab238,JSON[_0x6436('0x1a')](_0x131820));_0x5b5d3f(_0x131820);})[_0x6436('0x14')](function(_0x459506){logger[_0x6436('0x10')](_0x6436('0x20'),_0x459506[_0x6436('0x11')],_0x2ab238);_0x3f5bf1(_0x1df1b3[_0x6436('0x10')](0x1f4,_0x459506[_0x6436('0x11')]));});});}; \ No newline at end of file +var _0x20de=['../../config/utils','rpc','../../config/environment','http','then','info','FaxQueueReport,\x20%s,\x20%s','request\x20sent','debug','FaxQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','FaxQueueReport','create','options','raw','CreateFaxQueueReport','update','body','attributes','limit','UpdateFaxQueueReport','util','moment','bluebird','../../mysqldb'];(function(_0x21001b,_0x3ff1a8){var _0x665a00=function(_0x98d912){while(--_0x98d912){_0x21001b['push'](_0x21001b['shift']());}};_0x665a00(++_0x3ff1a8);}(_0x20de,0xe4));var _0xe20d=function(_0x4792c8,_0x5158a1){_0x4792c8=_0x4792c8-0x0;var _0x35edb1=_0x20de[_0x4792c8];return _0x35edb1;};'use strict';var _=require('lodash');var util=require(_0xe20d('0x0'));var moment=require(_0xe20d('0x1'));var BPromise=require(_0xe20d('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe20d('0x3'))['db'];var utils=require(_0xe20d('0x4'));var logger=require('../../config/logger')(_0xe20d('0x5'));var config=require(_0xe20d('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0xe20d('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x4e9e1a,_0x3a39d1,_0x26b97c){return new BPromise(function(_0x1adf49,_0x22336a){return client['request'](_0x4e9e1a,_0x26b97c)[_0xe20d('0x8')](function(_0x2e4875){logger[_0xe20d('0x9')](_0xe20d('0xa'),_0x3a39d1,_0xe20d('0xb'));logger[_0xe20d('0xc')](_0xe20d('0xd'),_0x3a39d1,'request\x20sent',JSON[_0xe20d('0xe')](_0x2e4875));if(_0x2e4875[_0xe20d('0xf')]){if(_0x2e4875['error'][_0xe20d('0x10')]===0x1f4){logger[_0xe20d('0xf')](_0xe20d('0xa'),_0x3a39d1,_0x2e4875[_0xe20d('0xf')][_0xe20d('0x11')]);return _0x22336a(_0x2e4875['error'][_0xe20d('0x11')]);}logger['error'](_0xe20d('0xa'),_0x3a39d1,_0x2e4875['error']['message']);return _0x1adf49(_0x2e4875[_0xe20d('0xf')]['message']);}else{logger[_0xe20d('0x9')](_0xe20d('0xa'),_0x3a39d1,_0xe20d('0xb'));_0x1adf49(_0x2e4875['result'][_0xe20d('0x11')]);}})[_0xe20d('0x12')](function(_0x8b7c8b){logger[_0xe20d('0xf')](_0xe20d('0xa'),_0x3a39d1,_0x8b7c8b);_0x22336a(_0x8b7c8b);});});}exports['CreateFaxQueueReport']=function(_0x6c42a0){var _0x271414=this;return new Promise(function(_0x847ed4,_0x2e5ce5){return db[_0xe20d('0x13')][_0xe20d('0x14')](_0x6c42a0['body'],{'raw':_0x6c42a0[_0xe20d('0x15')]?_0x6c42a0['options'][_0xe20d('0x16')]===undefined?!![]:![]:!![]})[_0xe20d('0x8')](function(_0x36e5f7){logger[_0xe20d('0x9')](_0xe20d('0x17'),_0x6c42a0);logger[_0xe20d('0xc')](_0xe20d('0x17'),_0x6c42a0,JSON['stringify'](_0x36e5f7));_0x847ed4(_0x36e5f7);})[_0xe20d('0x12')](function(_0x4fe433){logger[_0xe20d('0xf')](_0xe20d('0x17'),_0x4fe433['message'],_0x6c42a0);_0x2e5ce5(_0x271414[_0xe20d('0xf')](0x1f4,_0x4fe433[_0xe20d('0x11')]));});});};exports['UpdateFaxQueueReport']=function(_0x181f9a){var _0x21e7cb=this;return new Promise(function(_0x503c84,_0x37add3){return db[_0xe20d('0x13')][_0xe20d('0x18')](_0x181f9a[_0xe20d('0x19')],{'raw':_0x181f9a[_0xe20d('0x15')]?_0x181f9a['options'][_0xe20d('0x16')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x181f9a['options']?_0x181f9a[_0xe20d('0x15')]['where']||null:null,'attributes':_0x181f9a['options']?_0x181f9a[_0xe20d('0x15')][_0xe20d('0x1a')]||null:null,'limit':_0x181f9a[_0xe20d('0x15')]?_0x181f9a[_0xe20d('0x15')][_0xe20d('0x1b')]||null:null})[_0xe20d('0x8')](function(_0x132f1e){logger[_0xe20d('0x9')]('UpdateFaxQueueReport',_0x181f9a);logger['debug']('UpdateFaxQueueReport',_0x181f9a,JSON['stringify'](_0x132f1e));_0x503c84(_0x132f1e);})[_0xe20d('0x12')](function(_0x320d68){logger[_0xe20d('0xf')](_0xe20d('0x1c'),_0x320d68[_0xe20d('0x11')],_0x181f9a);_0x37add3(_0x21e7cb[_0xe20d('0xf')](0x1f4,_0x320d68[_0xe20d('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/index.js b/server/api/faxQueueReport/index.js index ad379ec..98ed1a9 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 _0x0cbd=['delete','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxQueueReport.controller','get','isAuthenticated','/describe','describe','/:id','show','post','create','put','update'];(function(_0x13187a,_0x2fcec4){var _0x65b85f=function(_0x33bf1f){while(--_0x33bf1f){_0x13187a['push'](_0x13187a['shift']());}};_0x65b85f(++_0x2fcec4);}(_0x0cbd,0x136));var _0xd0cb=function(_0x28e0ce,_0x2effed){_0x28e0ce=_0x28e0ce-0x0;var _0x3fcf1e=_0x0cbd[_0x28e0ce];return _0x3fcf1e;};'use strict';var multer=require(_0xd0cb('0x0'));var util=require('util');var path=require(_0xd0cb('0x1'));var timeout=require(_0xd0cb('0x2'));var express=require(_0xd0cb('0x3'));var router=express[_0xd0cb('0x4')]();var fs_extra=require(_0xd0cb('0x5'));var auth=require(_0xd0cb('0x6'));var interaction=require(_0xd0cb('0x7'));var config=require(_0xd0cb('0x8'));var controller=require(_0xd0cb('0x9'));router[_0xd0cb('0xa')]('/',auth[_0xd0cb('0xb')](),controller['index']);router['get'](_0xd0cb('0xc'),auth[_0xd0cb('0xb')](),controller[_0xd0cb('0xd')]);router[_0xd0cb('0xa')](_0xd0cb('0xe'),auth['isAuthenticated'](),controller[_0xd0cb('0xf')]);router[_0xd0cb('0x10')]('/',auth['isAuthenticated'](),controller[_0xd0cb('0x11')]);router[_0xd0cb('0x12')](_0xd0cb('0xe'),auth['isAuthenticated'](),controller[_0xd0cb('0x13')]);router[_0xd0cb('0x14')](_0xd0cb('0xe'),auth['isAuthenticated'](),controller['destroy']);module[_0xd0cb('0x15')]=router; \ No newline at end of file +var _0x9660=['../../components/auth/service','../../components/interaction/service','./faxQueueReport.controller','get','isAuthenticated','describe','/:id','show','post','put','update','delete','destroy','exports','multer','path','connect-timeout','express','Router'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x9660,0x151));var _0x0966=function(_0x202517,_0x47ada9){_0x202517=_0x202517-0x0;var _0x72463a=_0x9660[_0x202517];return _0x72463a;};'use strict';var multer=require(_0x0966('0x0'));var util=require('util');var path=require(_0x0966('0x1'));var timeout=require(_0x0966('0x2'));var express=require(_0x0966('0x3'));var router=express[_0x0966('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x0966('0x5'));var interaction=require(_0x0966('0x6'));var config=require('../../config/environment');var controller=require(_0x0966('0x7'));router[_0x0966('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0x0966('0x8')]('/describe',auth[_0x0966('0x9')](),controller[_0x0966('0xa')]);router[_0x0966('0x8')](_0x0966('0xb'),auth['isAuthenticated'](),controller[_0x0966('0xc')]);router[_0x0966('0xd')]('/',auth[_0x0966('0x9')](),controller['create']);router[_0x0966('0xe')](_0x0966('0xb'),auth[_0x0966('0x9')](),controller[_0x0966('0xf')]);router[_0x0966('0x10')](_0x0966('0xb'),auth['isAuthenticated'](),controller[_0x0966('0x11')]);module[_0x0966('0x12')]=router; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.attributes.js b/server/api/faxTransferReport/faxTransferReport.attributes.js index 00e51cc..70e7d5c 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 _0x9bde=['NOW','sequelize','STRING','account','agent','queue','DATE'];(function(_0x5a7112,_0x1f9492){var _0x3147f7=function(_0x4d2329){while(--_0x4d2329){_0x5a7112['push'](_0x5a7112['shift']());}};_0x3147f7(++_0x1f9492);}(_0x9bde,0xe1));var _0xe9bd=function(_0x1cf2f1,_0x3fd0b2){_0x1cf2f1=_0x1cf2f1-0x0;var _0x3e02e0=_0x9bde[_0x1cf2f1];return _0x3e02e0;};'use strict';var moment=require('moment');var Sequelize=require(_0xe9bd('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0xe9bd('0x1')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xe9bd('0x2'),_0xe9bd('0x3'),_0xe9bd('0x4')),'allowNull':![],'defaultValue':_0xe9bd('0x4')},'transferredAt':{'type':Sequelize[_0xe9bd('0x5')],'allowNull':![],'defaultValue':Sequelize[_0xe9bd('0x6')]}}; \ No newline at end of file +var _0xb43b=['DATE','NOW','moment','sequelize','STRING','ENUM','account','queue'];(function(_0x544099,_0x372b30){var _0x20ab09=function(_0x149613){while(--_0x149613){_0x544099['push'](_0x544099['shift']());}};_0x20ab09(++_0x372b30);}(_0xb43b,0x1b2));var _0xbb43=function(_0x3eec67,_0x5c7161){_0x3eec67=_0x3eec67-0x0;var _0x5262b3=_0xb43b[_0x3eec67];return _0x5262b3;};'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 fd9b741..df8a70f 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 _0xd622=['find','create','body','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','end','json','undefined','count','offset','limit','Content-Range','apply','reject','save','update','then','error','stack','name','index','map','FaxTransferReport','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','length'];(function(_0x40542f,_0x9c86f7){var _0x3b961f=function(_0x25c185){while(--_0x25c185){_0x40542f['push'](_0x40542f['shift']());}};_0x3b961f(++_0x9c86f7);}(_0xd622,0x124));var _0x2d62=function(_0x2fc661,_0x409b70){_0x2fc661=_0x2fc661-0x0;var _0x2d435f=_0xd622[_0x2fc661];return _0x2d435f;};'use strict';var emlformat=require(_0x2d62('0x0'));var rimraf=require(_0x2d62('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2d62('0x2'));var rp=require(_0x2d62('0x3'));var moment=require(_0x2d62('0x4'));var BPromise=require(_0x2d62('0x5'));var Mustache=require(_0x2d62('0x6'));var util=require(_0x2d62('0x7'));var path=require('path');var sox=require(_0x2d62('0x8'));var csv=require(_0x2d62('0x9'));var ejs=require(_0x2d62('0xa'));var fs=require('fs');var fs_extra=require(_0x2d62('0xb'));var _=require(_0x2d62('0xc'));var squel=require(_0x2d62('0xd'));var crypto=require(_0x2d62('0xe'));var jsforce=require(_0x2d62('0xf'));var deskjs=require(_0x2d62('0x10'));var toCsv=require(_0x2d62('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x2d62('0x11'));var as=require(_0x2d62('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2d62('0x13'))(_0x2d62('0x14'));var utils=require(_0x2d62('0x15'));var config=require(_0x2d62('0x16'));var licenseUtil=require(_0x2d62('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2d4691,_0x5ac943){_0x5ac943=_0x5ac943||0xcc;return function(_0x12255a){if(_0x12255a){return _0x2d4691['sendStatus'](_0x5ac943);}return _0x2d4691[_0x2d62('0x18')](_0x5ac943)[_0x2d62('0x19')]();};}function respondWithResult(_0x30f63e,_0x318852){_0x318852=_0x318852||0xc8;return function(_0x3a8950){if(_0x3a8950){return _0x30f63e[_0x2d62('0x18')](_0x318852)[_0x2d62('0x1a')](_0x3a8950);}};}function respondWithFilteredResult(_0x5c049a,_0x2ca6ab){return function(_0x1a4610){if(_0x1a4610){var _0x418f4b=typeof _0x2ca6ab['offset']==='undefined'&&typeof _0x2ca6ab['limit']===_0x2d62('0x1b');var _0xcb4b10=_0x1a4610[_0x2d62('0x1c')];var _0x2e6ac6=_0x418f4b?0x0:_0x2ca6ab['offset'];var _0x5f43cc=_0x418f4b?_0x1a4610[_0x2d62('0x1c')]:_0x2ca6ab[_0x2d62('0x1d')]+_0x2ca6ab[_0x2d62('0x1e')];var _0x1e7901;if(_0x5f43cc>=_0xcb4b10){_0x5f43cc=_0xcb4b10;_0x1e7901=0xc8;}else{_0x1e7901=0xce;}_0x5c049a[_0x2d62('0x18')](_0x1e7901);return _0x5c049a['set'](_0x2d62('0x1f'),_0x2e6ac6+'-'+_0x5f43cc+'/'+_0xcb4b10)[_0x2d62('0x1a')](_0x1a4610);}return null;};}function patchUpdates(_0x363a4b){return function(_0x19f08c){try{jsonpatch[_0x2d62('0x20')](_0x19f08c,_0x363a4b,!![]);}catch(_0x512edf){return BPromise[_0x2d62('0x21')](_0x512edf);}return _0x19f08c[_0x2d62('0x22')]();};}function saveUpdates(_0x3efea2,_0x405845){return function(_0x1ff64b){if(_0x1ff64b){return _0x1ff64b[_0x2d62('0x23')](_0x3efea2)[_0x2d62('0x24')](function(_0x5172fd){return _0x5172fd;});}return null;};}function removeEntity(_0xce1f7a,_0x73dffb){return function(_0xd0f252){if(_0xd0f252){return _0xd0f252['destroy']()[_0x2d62('0x24')](function(){_0xce1f7a[_0x2d62('0x18')](0xcc)[_0x2d62('0x19')]();});}};}function handleEntityNotFound(_0x273c42,_0x2ba5d4){return function(_0x2f1f88){if(!_0x2f1f88){_0x273c42['sendStatus'](0x194);}return _0x2f1f88;};}function handleError(_0x12e263,_0x104f76){_0x104f76=_0x104f76||0x1f4;return function(_0x2c1fa5){logger[_0x2d62('0x25')](_0x2c1fa5[_0x2d62('0x26')]);if(_0x2c1fa5[_0x2d62('0x27')]){delete _0x2c1fa5[_0x2d62('0x27')];}_0x12e263[_0x2d62('0x18')](_0x104f76)['send'](_0x2c1fa5);};}exports[_0x2d62('0x28')]=function(_0x555b1a,_0x506b1b){var _0x20eb23={},_0x1b815f={},_0x20902c={'count':0x0,'rows':[]};var _0x586133=_[_0x2d62('0x29')](db[_0x2d62('0x2a')]['rawAttributes'],function(_0x15988a){return{'name':_0x15988a[_0x2d62('0x2b')],'type':_0x15988a[_0x2d62('0x2c')][_0x2d62('0x2d')]};});_0x1b815f[_0x2d62('0x2e')]=_[_0x2d62('0x29')](_0x586133,_0x2d62('0x27'));_0x1b815f[_0x2d62('0x2f')]=_[_0x2d62('0x30')](_0x555b1a[_0x2d62('0x2f')]);_0x1b815f[_0x2d62('0x31')]=_[_0x2d62('0x32')](_0x1b815f[_0x2d62('0x2e')],_0x1b815f['query']);_0x20eb23[_0x2d62('0x33')]=_[_0x2d62('0x32')](_0x1b815f[_0x2d62('0x2e')],qs[_0x2d62('0x34')](_0x555b1a[_0x2d62('0x2f')]['fields']));_0x20eb23[_0x2d62('0x33')]=_0x20eb23[_0x2d62('0x33')]['length']?_0x20eb23[_0x2d62('0x33')]:_0x1b815f['model'];if(!_0x555b1a[_0x2d62('0x2f')][_0x2d62('0x35')](_0x2d62('0x36'))){_0x20eb23[_0x2d62('0x1e')]=qs[_0x2d62('0x1e')](_0x555b1a[_0x2d62('0x2f')][_0x2d62('0x1e')]);_0x20eb23[_0x2d62('0x1d')]=qs[_0x2d62('0x1d')](_0x555b1a[_0x2d62('0x2f')]['offset']);}_0x20eb23['order']=qs[_0x2d62('0x37')](_0x555b1a[_0x2d62('0x2f')][_0x2d62('0x37')]);_0x20eb23[_0x2d62('0x38')]=qs['filters'](_['pick'](_0x555b1a[_0x2d62('0x2f')],_0x1b815f[_0x2d62('0x31')]),_0x586133);if(_0x555b1a[_0x2d62('0x2f')][_0x2d62('0x39')]){_0x20eb23[_0x2d62('0x38')]=_[_0x2d62('0x3a')](_0x20eb23[_0x2d62('0x38')],{'$or':_[_0x2d62('0x29')](_0x586133,function(_0x165e77){if(_0x165e77['type']!=='VIRTUAL'){var _0x1db58e={};_0x1db58e[_0x165e77[_0x2d62('0x27')]]={'$like':'%'+_0x555b1a[_0x2d62('0x2f')][_0x2d62('0x39')]+'%'};return _0x1db58e;}})});}_0x20eb23=_['merge']({},_0x20eb23,_0x555b1a[_0x2d62('0x3b')]);var _0x4f803c={'where':_0x20eb23[_0x2d62('0x38')]};return db[_0x2d62('0x2a')][_0x2d62('0x1c')](_0x4f803c)[_0x2d62('0x24')](function(_0x4fc7cf){_0x20902c[_0x2d62('0x1c')]=_0x4fc7cf;if(_0x555b1a[_0x2d62('0x2f')][_0x2d62('0x3c')]){_0x20eb23[_0x2d62('0x3d')]=[{'all':!![]}];}return db[_0x2d62('0x2a')][_0x2d62('0x3e')](_0x20eb23);})['then'](function(_0x44b733){_0x20902c[_0x2d62('0x3f')]=_0x44b733;return _0x20902c;})[_0x2d62('0x24')](respondWithFilteredResult(_0x506b1b,_0x20eb23))[_0x2d62('0x40')](handleError(_0x506b1b,null));};exports[_0x2d62('0x41')]=function(_0x16c947,_0x2a6541){var _0x25ed8e={'raw':!![],'where':{'id':_0x16c947[_0x2d62('0x42')]['id']}},_0xa164db={};_0xa164db['model']=_[_0x2d62('0x30')](db[_0x2d62('0x2a')]['rawAttributes']);_0xa164db[_0x2d62('0x2f')]=_['keys'](_0x16c947[_0x2d62('0x2f')]);_0xa164db['filters']=_[_0x2d62('0x32')](_0xa164db['model'],_0xa164db[_0x2d62('0x2f')]);_0x25ed8e['attributes']=_[_0x2d62('0x32')](_0xa164db['model'],qs[_0x2d62('0x34')](_0x16c947['query'][_0x2d62('0x34')]));_0x25ed8e[_0x2d62('0x33')]=_0x25ed8e['attributes'][_0x2d62('0x43')]?_0x25ed8e['attributes']:_0xa164db[_0x2d62('0x2e')];if(_0x16c947[_0x2d62('0x2f')][_0x2d62('0x3c')]){_0x25ed8e['include']=[{'all':!![]}];}_0x25ed8e=_[_0x2d62('0x3a')]({},_0x25ed8e,_0x16c947[_0x2d62('0x3b')]);return db['FaxTransferReport'][_0x2d62('0x44')](_0x25ed8e)[_0x2d62('0x24')](handleEntityNotFound(_0x2a6541,null))['then'](respondWithResult(_0x2a6541,null))[_0x2d62('0x40')](handleError(_0x2a6541,null));};exports['create']=function(_0x185f1a,_0x126ea3){return db[_0x2d62('0x2a')][_0x2d62('0x45')](_0x185f1a[_0x2d62('0x46')],{})[_0x2d62('0x24')](respondWithResult(_0x126ea3,0xc9))[_0x2d62('0x40')](handleError(_0x126ea3,null));};exports[_0x2d62('0x23')]=function(_0x282ae0,_0x455dc9){if(_0x282ae0['body']['id']){delete _0x282ae0[_0x2d62('0x46')]['id'];}return db['FaxTransferReport'][_0x2d62('0x44')]({'where':{'id':_0x282ae0[_0x2d62('0x42')]['id']}})[_0x2d62('0x24')](handleEntityNotFound(_0x455dc9,null))[_0x2d62('0x24')](saveUpdates(_0x282ae0['body'],null))[_0x2d62('0x24')](respondWithResult(_0x455dc9,null))[_0x2d62('0x40')](handleError(_0x455dc9,null));};exports['destroy']=function(_0x2ab0f3,_0x58a99f){return db[_0x2d62('0x2a')][_0x2d62('0x44')]({'where':{'id':_0x2ab0f3[_0x2d62('0x42')]['id']}})[_0x2d62('0x24')](handleEntityNotFound(_0x58a99f,null))[_0x2d62('0x24')](removeEntity(_0x58a99f,null))[_0x2d62('0x40')](handleError(_0x58a99f,null));};exports['describe']=function(_0x5df5a1,_0x3052ea){return db[_0x2d62('0x2a')][_0x2d62('0x47')]()[_0x2d62('0x24')](respondWithResult(_0x3052ea,null))[_0x2d62('0x40')](handleError(_0x3052ea,null));}; \ No newline at end of file +var _0x0c63=['crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','destroy','then','error','stack','send','index','map','FaxTransferReport','rawAttributes','fieldName','type','model','name','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','options','includeAll','include','catch','show','params','keys','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','to-csv','ejs','fs-extra','squel'];(function(_0x49331a,_0x2a2d11){var _0x413a11=function(_0xddc5e4){while(--_0xddc5e4){_0x49331a['push'](_0x49331a['shift']());}};_0x413a11(++_0x2a2d11);}(_0x0c63,0x114));var _0x30c6=function(_0x499d6a,_0x322be5){_0x499d6a=_0x499d6a-0x0;var _0x5778fa=_0x0c63[_0x499d6a];return _0x5778fa;};'use strict';var emlformat=require(_0x30c6('0x0'));var rimraf=require(_0x30c6('0x1'));var zipdir=require(_0x30c6('0x2'));var jsonpatch=require(_0x30c6('0x3'));var rp=require(_0x30c6('0x4'));var moment=require(_0x30c6('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x30c6('0x6'));var path=require(_0x30c6('0x7'));var sox=require('sox');var csv=require(_0x30c6('0x8'));var ejs=require(_0x30c6('0x9'));var fs=require('fs');var fs_extra=require(_0x30c6('0xa'));var _=require('lodash');var squel=require(_0x30c6('0xb'));var crypto=require(_0x30c6('0xc'));var jsforce=require(_0x30c6('0xd'));var deskjs=require(_0x30c6('0xe'));var toCsv=require('to-csv');var querystring=require(_0x30c6('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x30c6('0x10'));var qs=require(_0x30c6('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x30c6('0x12'));var logger=require(_0x30c6('0x13'))('api');var utils=require('../../config/utils');var config=require(_0x30c6('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x30c6('0x15'))['db'];function respondWithStatusCode(_0x3821db,_0x2fc5e9){_0x2fc5e9=_0x2fc5e9||0xcc;return function(_0x5857c0){if(_0x5857c0){return _0x3821db[_0x30c6('0x16')](_0x2fc5e9);}return _0x3821db[_0x30c6('0x17')](_0x2fc5e9)[_0x30c6('0x18')]();};}function respondWithResult(_0x1c939b,_0xe8b264){_0xe8b264=_0xe8b264||0xc8;return function(_0x24605a){if(_0x24605a){return _0x1c939b[_0x30c6('0x17')](_0xe8b264)[_0x30c6('0x19')](_0x24605a);}};}function respondWithFilteredResult(_0x418286,_0xdb87de){return function(_0x19b3e9){if(_0x19b3e9){var _0x45b994=typeof _0xdb87de[_0x30c6('0x1a')]===_0x30c6('0x1b')&&typeof _0xdb87de[_0x30c6('0x1c')]===_0x30c6('0x1b');var _0x55811d=_0x19b3e9[_0x30c6('0x1d')];var _0x44d229=_0x45b994?0x0:_0xdb87de[_0x30c6('0x1a')];var _0x46abd4=_0x45b994?_0x19b3e9[_0x30c6('0x1d')]:_0xdb87de[_0x30c6('0x1a')]+_0xdb87de[_0x30c6('0x1c')];var _0x49d0c8;if(_0x46abd4>=_0x55811d){_0x46abd4=_0x55811d;_0x49d0c8=0xc8;}else{_0x49d0c8=0xce;}_0x418286[_0x30c6('0x17')](_0x49d0c8);return _0x418286[_0x30c6('0x1e')](_0x30c6('0x1f'),_0x44d229+'-'+_0x46abd4+'/'+_0x55811d)[_0x30c6('0x19')](_0x19b3e9);}return null;};}function patchUpdates(_0x12569a){return function(_0x325aa6){try{jsonpatch[_0x30c6('0x20')](_0x325aa6,_0x12569a,!![]);}catch(_0x550263){return BPromise['reject'](_0x550263);}return _0x325aa6[_0x30c6('0x21')]();};}function saveUpdates(_0xb4737b,_0x292d98){return function(_0x42d954){if(_0x42d954){return _0x42d954[_0x30c6('0x22')](_0xb4737b)['then'](function(_0x2432a3){return _0x2432a3;});}return null;};}function removeEntity(_0x53484f,_0x62ef2c){return function(_0xac3c6b){if(_0xac3c6b){return _0xac3c6b[_0x30c6('0x23')]()[_0x30c6('0x24')](function(){_0x53484f[_0x30c6('0x17')](0xcc)[_0x30c6('0x18')]();});}};}function handleEntityNotFound(_0x514f19,_0x85bf76){return function(_0x3fec9a){if(!_0x3fec9a){_0x514f19[_0x30c6('0x16')](0x194);}return _0x3fec9a;};}function handleError(_0x764a85,_0x40d63e){_0x40d63e=_0x40d63e||0x1f4;return function(_0x18f82b){logger[_0x30c6('0x25')](_0x18f82b[_0x30c6('0x26')]);if(_0x18f82b['name']){delete _0x18f82b['name'];}_0x764a85[_0x30c6('0x17')](_0x40d63e)[_0x30c6('0x27')](_0x18f82b);};}exports[_0x30c6('0x28')]=function(_0x4deb07,_0x6fc48e){var _0x353198={},_0x1b560c={},_0x45f687={'count':0x0,'rows':[]};var _0x4ac08f=_[_0x30c6('0x29')](db[_0x30c6('0x2a')][_0x30c6('0x2b')],function(_0x5d7086){return{'name':_0x5d7086[_0x30c6('0x2c')],'type':_0x5d7086[_0x30c6('0x2d')]['key']};});_0x1b560c[_0x30c6('0x2e')]=_[_0x30c6('0x29')](_0x4ac08f,_0x30c6('0x2f'));_0x1b560c[_0x30c6('0x30')]=_['keys'](_0x4deb07[_0x30c6('0x30')]);_0x1b560c[_0x30c6('0x31')]=_[_0x30c6('0x32')](_0x1b560c[_0x30c6('0x2e')],_0x1b560c[_0x30c6('0x30')]);_0x353198['attributes']=_[_0x30c6('0x32')](_0x1b560c['model'],qs['fields'](_0x4deb07['query'][_0x30c6('0x33')]));_0x353198[_0x30c6('0x34')]=_0x353198['attributes'][_0x30c6('0x35')]?_0x353198['attributes']:_0x1b560c[_0x30c6('0x2e')];if(!_0x4deb07[_0x30c6('0x30')][_0x30c6('0x36')](_0x30c6('0x37'))){_0x353198[_0x30c6('0x1c')]=qs[_0x30c6('0x1c')](_0x4deb07[_0x30c6('0x30')][_0x30c6('0x1c')]);_0x353198[_0x30c6('0x1a')]=qs['offset'](_0x4deb07[_0x30c6('0x30')][_0x30c6('0x1a')]);}_0x353198['order']=qs[_0x30c6('0x38')](_0x4deb07[_0x30c6('0x30')][_0x30c6('0x38')]);_0x353198[_0x30c6('0x39')]=qs[_0x30c6('0x31')](_['pick'](_0x4deb07[_0x30c6('0x30')],_0x1b560c[_0x30c6('0x31')]),_0x4ac08f);if(_0x4deb07[_0x30c6('0x30')][_0x30c6('0x3a')]){_0x353198[_0x30c6('0x39')]=_[_0x30c6('0x3b')](_0x353198[_0x30c6('0x39')],{'$or':_[_0x30c6('0x29')](_0x4ac08f,function(_0x502d73){if(_0x502d73[_0x30c6('0x2d')]!==_0x30c6('0x3c')){var _0x3a9742={};_0x3a9742[_0x502d73['name']]={'$like':'%'+_0x4deb07[_0x30c6('0x30')][_0x30c6('0x3a')]+'%'};return _0x3a9742;}})});}_0x353198=_[_0x30c6('0x3b')]({},_0x353198,_0x4deb07[_0x30c6('0x3d')]);var _0x524afc={'where':_0x353198[_0x30c6('0x39')]};return db[_0x30c6('0x2a')][_0x30c6('0x1d')](_0x524afc)[_0x30c6('0x24')](function(_0x285966){_0x45f687[_0x30c6('0x1d')]=_0x285966;if(_0x4deb07[_0x30c6('0x30')][_0x30c6('0x3e')]){_0x353198[_0x30c6('0x3f')]=[{'all':!![]}];}return db[_0x30c6('0x2a')]['findAll'](_0x353198);})[_0x30c6('0x24')](function(_0xd6e6f0){_0x45f687['rows']=_0xd6e6f0;return _0x45f687;})[_0x30c6('0x24')](respondWithFilteredResult(_0x6fc48e,_0x353198))[_0x30c6('0x40')](handleError(_0x6fc48e,null));};exports[_0x30c6('0x41')]=function(_0x3e8626,_0x3fd9e){var _0x5181e7={'raw':!![],'where':{'id':_0x3e8626[_0x30c6('0x42')]['id']}},_0x43fe90={};_0x43fe90['model']=_[_0x30c6('0x43')](db[_0x30c6('0x2a')][_0x30c6('0x2b')]);_0x43fe90['query']=_[_0x30c6('0x43')](_0x3e8626[_0x30c6('0x30')]);_0x43fe90[_0x30c6('0x31')]=_['intersection'](_0x43fe90['model'],_0x43fe90['query']);_0x5181e7[_0x30c6('0x34')]=_[_0x30c6('0x32')](_0x43fe90['model'],qs['fields'](_0x3e8626['query'][_0x30c6('0x33')]));_0x5181e7[_0x30c6('0x34')]=_0x5181e7[_0x30c6('0x34')][_0x30c6('0x35')]?_0x5181e7[_0x30c6('0x34')]:_0x43fe90[_0x30c6('0x2e')];if(_0x3e8626['query'][_0x30c6('0x3e')]){_0x5181e7['include']=[{'all':!![]}];}_0x5181e7=_[_0x30c6('0x3b')]({},_0x5181e7,_0x3e8626['options']);return db['FaxTransferReport'][_0x30c6('0x44')](_0x5181e7)['then'](handleEntityNotFound(_0x3fd9e,null))[_0x30c6('0x24')](respondWithResult(_0x3fd9e,null))[_0x30c6('0x40')](handleError(_0x3fd9e,null));};exports[_0x30c6('0x45')]=function(_0x4bcf5a,_0xb46747){return db[_0x30c6('0x2a')][_0x30c6('0x45')](_0x4bcf5a[_0x30c6('0x46')],{})[_0x30c6('0x24')](respondWithResult(_0xb46747,0xc9))['catch'](handleError(_0xb46747,null));};exports[_0x30c6('0x22')]=function(_0x5cd2c6,_0x563073){if(_0x5cd2c6[_0x30c6('0x46')]['id']){delete _0x5cd2c6['body']['id'];}return db[_0x30c6('0x2a')][_0x30c6('0x44')]({'where':{'id':_0x5cd2c6[_0x30c6('0x42')]['id']}})[_0x30c6('0x24')](handleEntityNotFound(_0x563073,null))[_0x30c6('0x24')](saveUpdates(_0x5cd2c6[_0x30c6('0x46')],null))[_0x30c6('0x24')](respondWithResult(_0x563073,null))[_0x30c6('0x40')](handleError(_0x563073,null));};exports[_0x30c6('0x23')]=function(_0xb029d7,_0x1cda8c){return db[_0x30c6('0x2a')][_0x30c6('0x44')]({'where':{'id':_0xb029d7[_0x30c6('0x42')]['id']}})[_0x30c6('0x24')](handleEntityNotFound(_0x1cda8c,null))[_0x30c6('0x24')](removeEntity(_0x1cda8c,null))['catch'](handleError(_0x1cda8c,null));};exports[_0x30c6('0x47')]=function(_0x3a40bd,_0x779d0b){return db[_0x30c6('0x2a')][_0x30c6('0x47')]()['then'](respondWithResult(_0x779d0b,null))[_0x30c6('0x40')](handleError(_0x779d0b,null));}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.model.js b/server/api/faxTransferReport/faxTransferReport.model.js index ec001a4..2ea8b55 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 _0xefdf=['moment','bluebird','path','rimraf','./faxTransferReport.attributes','define','FaxTransferReport','report_fax_transfer','uniqueid','util','../../config/logger','api'];(function(_0x1aee8a,_0x50b1df){var _0x51f53c=function(_0x5aed5b){while(--_0x5aed5b){_0x1aee8a['push'](_0x1aee8a['shift']());}};_0x51f53c(++_0x50b1df);}(_0xefdf,0x129));var _0xfefd=function(_0x50ac27,_0x1306e3){_0x50ac27=_0x50ac27-0x0;var _0x45f86a=_0xefdf[_0x50ac27];return _0x45f86a;};'use strict';var _=require('lodash');var util=require(_0xfefd('0x0'));var logger=require(_0xfefd('0x1'))(_0xfefd('0x2'));var moment=require(_0xfefd('0x3'));var BPromise=require(_0xfefd('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xfefd('0x5'));var rimraf=require(_0xfefd('0x6'));var config=require('../../config/environment');var attributes=require(_0xfefd('0x7'));module['exports']=function(_0x952e03,_0x55a4ae){return _0x952e03[_0xfefd('0x8')](_0xfefd('0x9'),attributes,{'tableName':_0xfefd('0xa'),'paranoid':![],'indexes':[{'name':_0xfefd('0xb'),'fields':[_0xfefd('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xd547=['moment','bluebird','request-promise','path','rimraf','./faxTransferReport.attributes','exports','FaxTransferReport','uniqueid','lodash','util','../../config/logger','api'];(function(_0x36e913,_0x5620a4){var _0x3d52b0=function(_0x13456a){while(--_0x13456a){_0x36e913['push'](_0x36e913['shift']());}};_0x3d52b0(++_0x5620a4);}(_0xd547,0x1a9));var _0x7d54=function(_0x18a81a,_0x4fc65b){_0x18a81a=_0x18a81a-0x0;var _0x114027=_0xd547[_0x18a81a];return _0x114027;};'use strict';var _=require(_0x7d54('0x0'));var util=require(_0x7d54('0x1'));var logger=require(_0x7d54('0x2'))(_0x7d54('0x3'));var moment=require(_0x7d54('0x4'));var BPromise=require(_0x7d54('0x5'));var rp=require(_0x7d54('0x6'));var fs=require('fs');var path=require(_0x7d54('0x7'));var rimraf=require(_0x7d54('0x8'));var config=require('../../config/environment');var attributes=require(_0x7d54('0x9'));module[_0x7d54('0xa')]=function(_0x28d24a,_0x128523){return _0x28d24a['define'](_0x7d54('0xb'),attributes,{'tableName':'report_fax_transfer','paranoid':![],'indexes':[{'name':_0x7d54('0xc'),'fields':[_0x7d54('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.rpc.js b/server/api/faxTransferReport/faxTransferReport.rpc.js index 5a50bdf..c9794d8 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 _0xe37f=['rpc','../../config/environment','jayson/promise','client','http','request','request\x20sent','debug','FaxTransferReport,\x20%s,\x20%s,\x20%s','error','message','info','FaxTransferReport,\x20%s,\x20%s','result','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger'];(function(_0x4b055c,_0x4b870b){var _0x4b62bb=function(_0x4884c2){while(--_0x4884c2){_0x4b055c['push'](_0x4b055c['shift']());}};_0x4b62bb(++_0x4b870b);}(_0xe37f,0x1dd));var _0xfe37=function(_0x4c3070,_0xc2fb4c){_0x4c3070=_0x4c3070-0x0;var _0x536a44=_0xe37f[_0x4c3070];return _0x536a44;};'use strict';var _=require('lodash');var util=require(_0xfe37('0x0'));var moment=require('moment');var BPromise=require(_0xfe37('0x1'));var rs=require(_0xfe37('0x2'));var fs=require('fs');var Redis=require(_0xfe37('0x3'));var db=require(_0xfe37('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xfe37('0x5'))(_0xfe37('0x6'));var config=require(_0xfe37('0x7'));var jayson=require(_0xfe37('0x8'));var client=jayson[_0xfe37('0x9')][_0xfe37('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3494f5,_0x420a77,_0x7afb57){return new BPromise(function(_0x5811cf,_0x5598a3){return client[_0xfe37('0xb')](_0x3494f5,_0x7afb57)['then'](function(_0x260d7e){logger['info']('FaxTransferReport,\x20%s,\x20%s',_0x420a77,_0xfe37('0xc'));logger[_0xfe37('0xd')](_0xfe37('0xe'),_0x420a77,_0xfe37('0xc'),JSON['stringify'](_0x260d7e));if(_0x260d7e[_0xfe37('0xf')]){if(_0x260d7e[_0xfe37('0xf')]['code']===0x1f4){logger[_0xfe37('0xf')]('FaxTransferReport,\x20%s,\x20%s',_0x420a77,_0x260d7e[_0xfe37('0xf')][_0xfe37('0x10')]);return _0x5598a3(_0x260d7e[_0xfe37('0xf')]['message']);}logger['error']('FaxTransferReport,\x20%s,\x20%s',_0x420a77,_0x260d7e[_0xfe37('0xf')]['message']);return _0x5811cf(_0x260d7e['error'][_0xfe37('0x10')]);}else{logger[_0xfe37('0x11')](_0xfe37('0x12'),_0x420a77,_0xfe37('0xc'));_0x5811cf(_0x260d7e[_0xfe37('0x13')][_0xfe37('0x10')]);}})[_0xfe37('0x14')](function(_0x1e0f7f){logger[_0xfe37('0xf')](_0xfe37('0x12'),_0x420a77,_0x1e0f7f);_0x5598a3(_0x1e0f7f);});});} \ No newline at end of file +var _0x8e9f=['jayson/promise','client','http','request','FaxTransferReport,\x20%s,\x20%s','request\x20sent','FaxTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment'];(function(_0x30033a,_0x5ce4a6){var _0x5e3518=function(_0x11494a){while(--_0x11494a){_0x30033a['push'](_0x30033a['shift']());}};_0x5e3518(++_0x5ce4a6);}(_0x8e9f,0x1c6));var _0xf8e9=function(_0xf0bc07,_0x510ebf){_0xf0bc07=_0xf0bc07-0x0;var _0x1c50c2=_0x8e9f[_0xf0bc07];return _0x1c50c2;};'use strict';var _=require(_0xf8e9('0x0'));var util=require(_0xf8e9('0x1'));var moment=require(_0xf8e9('0x2'));var BPromise=require('bluebird');var rs=require(_0xf8e9('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf8e9('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xf8e9('0x5'))(_0xf8e9('0x6'));var config=require(_0xf8e9('0x7'));var jayson=require(_0xf8e9('0x8'));var client=jayson[_0xf8e9('0x9')][_0xf8e9('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3d98e5,_0xbc89de,_0x303e7c){return new BPromise(function(_0x150bf4,_0x5e19bd){return client[_0xf8e9('0xb')](_0x3d98e5,_0x303e7c)['then'](function(_0x43a784){logger['info'](_0xf8e9('0xc'),_0xbc89de,_0xf8e9('0xd'));logger['debug'](_0xf8e9('0xe'),_0xbc89de,_0xf8e9('0xd'),JSON[_0xf8e9('0xf')](_0x43a784));if(_0x43a784[_0xf8e9('0x10')]){if(_0x43a784[_0xf8e9('0x10')][_0xf8e9('0x11')]===0x1f4){logger[_0xf8e9('0x10')]('FaxTransferReport,\x20%s,\x20%s',_0xbc89de,_0x43a784[_0xf8e9('0x10')][_0xf8e9('0x12')]);return _0x5e19bd(_0x43a784[_0xf8e9('0x10')][_0xf8e9('0x12')]);}logger[_0xf8e9('0x10')](_0xf8e9('0xc'),_0xbc89de,_0x43a784['error'][_0xf8e9('0x12')]);return _0x150bf4(_0x43a784[_0xf8e9('0x10')][_0xf8e9('0x12')]);}else{logger[_0xf8e9('0x13')](_0xf8e9('0xc'),_0xbc89de,'request\x20sent');_0x150bf4(_0x43a784[_0xf8e9('0x14')][_0xf8e9('0x12')]);}})[_0xf8e9('0x15')](function(_0x31e261){logger['error'](_0xf8e9('0xc'),_0xbc89de,_0x31e261);_0x5e19bd(_0x31e261);});});} \ No newline at end of file diff --git a/server/api/faxTransferReport/index.js b/server/api/faxTransferReport/index.js index dcc0446..70d15ee 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 _0x27f0=['multer','util','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxTransferReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','update','destroy'];(function(_0x48fdb2,_0x3b0f10){var _0x23b8b7=function(_0x52ab69){while(--_0x52ab69){_0x48fdb2['push'](_0x48fdb2['shift']());}};_0x23b8b7(++_0x3b0f10);}(_0x27f0,0xd1));var _0x027f=function(_0x2dbcef,_0x1cfecb){_0x2dbcef=_0x2dbcef-0x0;var _0x5a90ea=_0x27f0[_0x2dbcef];return _0x5a90ea;};'use strict';var multer=require(_0x027f('0x0'));var util=require(_0x027f('0x1'));var path=require('path');var timeout=require(_0x027f('0x2'));var express=require(_0x027f('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x027f('0x4'));var interaction=require(_0x027f('0x5'));var config=require(_0x027f('0x6'));var controller=require(_0x027f('0x7'));router[_0x027f('0x8')]('/',auth[_0x027f('0x9')](),controller[_0x027f('0xa')]);router[_0x027f('0x8')](_0x027f('0xb'),auth[_0x027f('0x9')](),controller[_0x027f('0xc')]);router['get'](_0x027f('0xd'),auth[_0x027f('0x9')](),controller[_0x027f('0xe')]);router[_0x027f('0xf')]('/',auth['isAuthenticated'](),controller[_0x027f('0x10')]);router['put']('/:id',auth[_0x027f('0x9')](),controller[_0x027f('0x11')]);router['delete'](_0x027f('0xd'),auth[_0x027f('0x9')](),controller[_0x027f('0x12')]);module['exports']=router; \ No newline at end of file +var _0x2d91=['isAuthenticated','show','post','put','update','destroy','path','connect-timeout','Router','fs-extra','../../components/interaction/service','get','index','/describe','describe','/:id'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x2d91,0xa6));var _0x12d9=function(_0x1e3c16,_0x372caa){_0x1e3c16=_0x1e3c16-0x0;var _0x47a0c9=_0x2d91[_0x1e3c16];return _0x47a0c9;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x12d9('0x0'));var timeout=require(_0x12d9('0x1'));var express=require('express');var router=express[_0x12d9('0x2')]();var fs_extra=require(_0x12d9('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x12d9('0x4'));var config=require('../../config/environment');var controller=require('./faxTransferReport.controller');router[_0x12d9('0x5')]('/',auth['isAuthenticated'](),controller[_0x12d9('0x6')]);router['get'](_0x12d9('0x7'),auth['isAuthenticated'](),controller[_0x12d9('0x8')]);router[_0x12d9('0x5')](_0x12d9('0x9'),auth[_0x12d9('0xa')](),controller[_0x12d9('0xb')]);router[_0x12d9('0xc')]('/',auth['isAuthenticated'](),controller['create']);router[_0x12d9('0xd')](_0x12d9('0x9'),auth['isAuthenticated'](),controller[_0x12d9('0xe')]);router['delete']('/:id',auth[_0x12d9('0xa')](),controller[_0x12d9('0xf')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/index.js b/server/api/intDeskAccount/index.js index 52a6afa..a22a017 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 _0xe02a=['exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./intDeskAccount.controller','get','isAuthenticated','index','/:id','/:id/configurations','getConfigurations','/:id/fields','getFields','create','addConfiguration','put','delete'];(function(_0x1a7e89,_0x86bb7e){var _0xc8ebc4=function(_0x3ed474){while(--_0x3ed474){_0x1a7e89['push'](_0x1a7e89['shift']());}};_0xc8ebc4(++_0x86bb7e);}(_0xe02a,0xb9));var _0xae02=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xe02a[_0x122ef9];return _0x42fba0;};'use strict';var multer=require(_0xae02('0x0'));var util=require(_0xae02('0x1'));var path=require(_0xae02('0x2'));var timeout=require(_0xae02('0x3'));var express=require(_0xae02('0x4'));var router=express[_0xae02('0x5')]();var fs_extra=require(_0xae02('0x6'));var auth=require(_0xae02('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0xae02('0x8'));var controller=require(_0xae02('0x9'));router[_0xae02('0xa')]('/',auth[_0xae02('0xb')](),controller[_0xae02('0xc')]);router[_0xae02('0xa')](_0xae02('0xd'),auth[_0xae02('0xb')](),controller['show']);router[_0xae02('0xa')](_0xae02('0xe'),auth['isAuthenticated'](),controller[_0xae02('0xf')]);router[_0xae02('0xa')](_0xae02('0x10'),auth[_0xae02('0xb')](),controller[_0xae02('0x11')]);router['post']('/',auth['isAuthenticated'](),controller[_0xae02('0x12')]);router['post'](_0xae02('0xe'),auth[_0xae02('0xb')](),controller[_0xae02('0x13')]);router[_0xae02('0x14')]('/:id',auth[_0xae02('0xb')](),controller['update']);router[_0xae02('0x15')](_0xae02('0xd'),auth[_0xae02('0xb')](),controller['destroy']);module[_0xae02('0x16')]=router; \ No newline at end of file +var _0xa5c8=['create','put','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post'];(function(_0x4bd42a,_0x550d78){var _0x2ea4e2=function(_0x5ab6b8){while(--_0x5ab6b8){_0x4bd42a['push'](_0x4bd42a['shift']());}};_0x2ea4e2(++_0x550d78);}(_0xa5c8,0x10d));var _0x8a5c=function(_0x5809e8,_0xf4f104){_0x5809e8=_0x5809e8-0x0;var _0x230453=_0xa5c8[_0x5809e8];return _0x230453;};'use strict';var multer=require(_0x8a5c('0x0'));var util=require(_0x8a5c('0x1'));var path=require(_0x8a5c('0x2'));var timeout=require(_0x8a5c('0x3'));var express=require(_0x8a5c('0x4'));var router=express['Router']();var fs_extra=require(_0x8a5c('0x5'));var auth=require(_0x8a5c('0x6'));var interaction=require(_0x8a5c('0x7'));var config=require(_0x8a5c('0x8'));var controller=require('./intDeskAccount.controller');router[_0x8a5c('0x9')]('/',auth[_0x8a5c('0xa')](),controller[_0x8a5c('0xb')]);router[_0x8a5c('0x9')](_0x8a5c('0xc'),auth[_0x8a5c('0xa')](),controller[_0x8a5c('0xd')]);router[_0x8a5c('0x9')](_0x8a5c('0xe'),auth[_0x8a5c('0xa')](),controller[_0x8a5c('0xf')]);router['get'](_0x8a5c('0x10'),auth[_0x8a5c('0xa')](),controller[_0x8a5c('0x11')]);router[_0x8a5c('0x12')]('/',auth['isAuthenticated'](),controller[_0x8a5c('0x13')]);router[_0x8a5c('0x12')](_0x8a5c('0xe'),auth[_0x8a5c('0xa')](),controller['addConfiguration']);router[_0x8a5c('0x14')](_0x8a5c('0xc'),auth['isAuthenticated'](),controller['update']);router[_0x8a5c('0x15')]('/:id',auth[_0x8a5c('0xa')](),controller[_0x8a5c('0x16')]);module[_0x8a5c('0x17')]=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.attributes.js b/server/api/intDeskAccount/intDeskAccount.attributes.js index f26641c..fa1e242 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 _0xd83e=['basic','integrationTab','newTab','sequelize','STRING'];(function(_0x240eee,_0x249118){var _0x411632=function(_0x99d99f){while(--_0x99d99f){_0x240eee['push'](_0x240eee['shift']());}};_0x411632(++_0x249118);}(_0xd83e,0x152));var _0xed83=function(_0x4a1854,_0x392527){_0x4a1854=_0x4a1854-0x0;var _0x198b47=_0xd83e[_0x4a1854];return _0x198b47;};'use strict';var Sequelize=require(_0xed83('0x0'));module['exports']={'name':{'type':Sequelize[_0xed83('0x1')]},'description':{'type':Sequelize[_0xed83('0x1')]},'username':{'type':Sequelize[_0xed83('0x1')]},'remoteUri':{'type':Sequelize['STRING']},'authType':{'type':Sequelize['ENUM'](_0xed83('0x2')),'defaultValue':_0xed83('0x2')},'password':{'type':Sequelize['STRING']},'consumerKey':{'type':Sequelize[_0xed83('0x1')]},'consumerSecret':{'type':Sequelize[_0xed83('0x1')]},'token':{'type':Sequelize[_0xed83('0x1')]},'tokenSecret':{'type':Sequelize[_0xed83('0x1')]},'serverUrl':{'type':Sequelize[_0xed83('0x1')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xed83('0x3'),_0xed83('0x4')),'defaultValue':_0xed83('0x3')}}; \ No newline at end of file +var _0x7a2c=['ENUM','integrationTab','newTab','sequelize','STRING','basic'];(function(_0x57494e,_0x2c4d3d){var _0x4099da=function(_0x38c521){while(--_0x38c521){_0x57494e['push'](_0x57494e['shift']());}};_0x4099da(++_0x2c4d3d);}(_0x7a2c,0x1c5));var _0xc7a2=function(_0x5d5227,_0xb556e){_0x5d5227=_0x5d5227-0x0;var _0x334724=_0x7a2c[_0x5d5227];return _0x334724;};'use strict';var Sequelize=require(_0xc7a2('0x0'));module['exports']={'name':{'type':Sequelize[_0xc7a2('0x1')]},'description':{'type':Sequelize[_0xc7a2('0x1')]},'username':{'type':Sequelize[_0xc7a2('0x1')]},'remoteUri':{'type':Sequelize['STRING']},'authType':{'type':Sequelize['ENUM'](_0xc7a2('0x2')),'defaultValue':_0xc7a2('0x2')},'password':{'type':Sequelize[_0xc7a2('0x1')]},'consumerKey':{'type':Sequelize[_0xc7a2('0x1')]},'consumerSecret':{'type':Sequelize['STRING']},'token':{'type':Sequelize[_0xc7a2('0x1')]},'tokenSecret':{'type':Sequelize[_0xc7a2('0x1')]},'serverUrl':{'type':Sequelize[_0xc7a2('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0xc7a2('0x3')](_0xc7a2('0x4'),_0xc7a2('0x5')),'defaultValue':_0xc7a2('0x4')}}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.controller.js b/server/api/intDeskAccount/intDeskAccount.controller.js index fb63397..1051fd4 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 _0xa6ad=['create','body','update','getConfigurations','findOne','order','hasOwnProperty','nolimit','AccountId','channel','Descriptions','getDescriptions','DeskConfiguration','Subjects','DeskField','getFields','priority','authType','username','password','consumerKey','consumerSecret','tokenSecret','remoteUri','slice','substring','lastIndexOf','GET','format','application/json','basic','Authorization','toString','base64','concat','entries','label','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','eml-format','zip-dir','fast-json-patch','util','path','sox','to-csv','ejs','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','reject','save','then','destroy','error','stack','name','send','index','DeskAccount','rawAttributes','fieldName','type','key','model','map','query','keys','intersection','attributes','fields','length','sort','where','filters','pick','merge','filter','options','includeAll','include','findAll','show','params','find','catch'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xa6ad,0x104));var _0xda6a=function(_0x5627e1,_0x1b2dbf){_0x5627e1=_0x5627e1-0x0;var _0x2f013f=_0xa6ad[_0x5627e1];return _0x2f013f;};'use strict';var emlformat=require(_0xda6a('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xda6a('0x1'));var jsonpatch=require(_0xda6a('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xda6a('0x3'));var path=require(_0xda6a('0x4'));var sox=require(_0xda6a('0x5'));var csv=require(_0xda6a('0x6'));var ejs=require(_0xda6a('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xda6a('0x8'));var crypto=require(_0xda6a('0x9'));var jsforce=require('jsforce');var deskjs=require(_0xda6a('0xa'));var toCsv=require(_0xda6a('0x6'));var querystring=require(_0xda6a('0xb'));var Papa=require(_0xda6a('0xc'));var Redis=require('ioredis');var authService=require(_0xda6a('0xd'));var qs=require('../../components/parsers/qs');var as=require(_0xda6a('0xe'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xda6a('0xf'))(_0xda6a('0x10'));var utils=require(_0xda6a('0x11'));var config=require(_0xda6a('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0xda6a('0x13'))['db'];var integrations=require(_0xda6a('0x14'));function respondWithStatusCode(_0x5c2be0,_0x58fbe4){_0x58fbe4=_0x58fbe4||0xcc;return function(_0x2f17aa){if(_0x2f17aa){return _0x5c2be0[_0xda6a('0x15')](_0x58fbe4);}return _0x5c2be0[_0xda6a('0x16')](_0x58fbe4)[_0xda6a('0x17')]();};}function respondWithResult(_0x2b4bd1,_0x403779){_0x403779=_0x403779||0xc8;return function(_0x1dd694){if(_0x1dd694){return _0x2b4bd1[_0xda6a('0x16')](_0x403779)['json'](_0x1dd694);}};}function respondWithFilteredResult(_0x14a5c0,_0x34d9af){return function(_0x29651a){if(_0x29651a){var _0x341dd1=typeof _0x34d9af[_0xda6a('0x18')]===_0xda6a('0x19')&&typeof _0x34d9af[_0xda6a('0x1a')]==='undefined';var _0x4a7534=_0x29651a[_0xda6a('0x1b')];var _0x4cff3f=_0x341dd1?0x0:_0x34d9af[_0xda6a('0x18')];var _0x107123=_0x341dd1?_0x29651a['count']:_0x34d9af[_0xda6a('0x18')]+_0x34d9af[_0xda6a('0x1a')];var _0x5be8e6;if(_0x107123>=_0x4a7534){_0x107123=_0x4a7534;_0x5be8e6=0xc8;}else{_0x5be8e6=0xce;}_0x14a5c0['status'](_0x5be8e6);return _0x14a5c0[_0xda6a('0x1c')](_0xda6a('0x1d'),_0x4cff3f+'-'+_0x107123+'/'+_0x4a7534)[_0xda6a('0x1e')](_0x29651a);}return null;};}function patchUpdates(_0x3d9d10){return function(_0xa5a333){try{jsonpatch['apply'](_0xa5a333,_0x3d9d10,!![]);}catch(_0x358821){return BPromise[_0xda6a('0x1f')](_0x358821);}return _0xa5a333[_0xda6a('0x20')]();};}function saveUpdates(_0x471002,_0x4ce120){return function(_0xb17c25){if(_0xb17c25){return _0xb17c25['update'](_0x471002)[_0xda6a('0x21')](function(_0x1982d4){return _0x1982d4;});}return null;};}function removeEntity(_0x494f37,_0x2eeb83){return function(_0x1ff413){if(_0x1ff413){return _0x1ff413[_0xda6a('0x22')]()['then'](function(){_0x494f37[_0xda6a('0x16')](0xcc)[_0xda6a('0x17')]();});}};}function handleEntityNotFound(_0x1284d5,_0x1dac8){return function(_0x1d6b4f){if(!_0x1d6b4f){_0x1284d5[_0xda6a('0x15')](0x194);}return _0x1d6b4f;};}function handleError(_0x2bc23a,_0x3bce60){_0x3bce60=_0x3bce60||0x1f4;return function(_0x20c231){logger[_0xda6a('0x23')](_0x20c231[_0xda6a('0x24')]);if(_0x20c231['name']){delete _0x20c231[_0xda6a('0x25')];}_0x2bc23a['status'](_0x3bce60)[_0xda6a('0x26')](_0x20c231);};}exports[_0xda6a('0x27')]=function(_0x5ba61a,_0x4783d5){var _0xeb5ca0={},_0x51b52d={},_0x360a0c={'count':0x0,'rows':[]};var _0x271825=_['map'](db[_0xda6a('0x28')][_0xda6a('0x29')],function(_0x1e78a9){return{'name':_0x1e78a9[_0xda6a('0x2a')],'type':_0x1e78a9[_0xda6a('0x2b')][_0xda6a('0x2c')]};});_0x51b52d[_0xda6a('0x2d')]=_[_0xda6a('0x2e')](_0x271825,_0xda6a('0x25'));_0x51b52d[_0xda6a('0x2f')]=_[_0xda6a('0x30')](_0x5ba61a['query']);_0x51b52d['filters']=_[_0xda6a('0x31')](_0x51b52d[_0xda6a('0x2d')],_0x51b52d[_0xda6a('0x2f')]);_0xeb5ca0[_0xda6a('0x32')]=_[_0xda6a('0x31')](_0x51b52d['model'],qs[_0xda6a('0x33')](_0x5ba61a[_0xda6a('0x2f')]['fields']));_0xeb5ca0[_0xda6a('0x32')]=_0xeb5ca0[_0xda6a('0x32')][_0xda6a('0x34')]?_0xeb5ca0[_0xda6a('0x32')]:_0x51b52d['model'];if(!_0x5ba61a[_0xda6a('0x2f')]['hasOwnProperty']('nolimit')){_0xeb5ca0[_0xda6a('0x1a')]=qs[_0xda6a('0x1a')](_0x5ba61a['query'][_0xda6a('0x1a')]);_0xeb5ca0['offset']=qs['offset'](_0x5ba61a[_0xda6a('0x2f')][_0xda6a('0x18')]);}_0xeb5ca0['order']=qs['sort'](_0x5ba61a['query'][_0xda6a('0x35')]);_0xeb5ca0[_0xda6a('0x36')]=qs[_0xda6a('0x37')](_[_0xda6a('0x38')](_0x5ba61a[_0xda6a('0x2f')],_0x51b52d['filters']),_0x271825);if(_0x5ba61a[_0xda6a('0x2f')]['filter']){_0xeb5ca0['where']=_[_0xda6a('0x39')](_0xeb5ca0[_0xda6a('0x36')],{'$or':_[_0xda6a('0x2e')](_0x271825,function(_0x35396d){if(_0x35396d[_0xda6a('0x2b')]!=='VIRTUAL'){var _0x5e50a0={};_0x5e50a0[_0x35396d[_0xda6a('0x25')]]={'$like':'%'+_0x5ba61a[_0xda6a('0x2f')][_0xda6a('0x3a')]+'%'};return _0x5e50a0;}})});}_0xeb5ca0=_[_0xda6a('0x39')]({},_0xeb5ca0,_0x5ba61a[_0xda6a('0x3b')]);var _0x5906be={'where':_0xeb5ca0[_0xda6a('0x36')]};return db['DeskAccount'][_0xda6a('0x1b')](_0x5906be)['then'](function(_0x52c11c){_0x360a0c[_0xda6a('0x1b')]=_0x52c11c;if(_0x5ba61a[_0xda6a('0x2f')][_0xda6a('0x3c')]){_0xeb5ca0[_0xda6a('0x3d')]=[{'all':!![]}];}return db['DeskAccount'][_0xda6a('0x3e')](_0xeb5ca0);})[_0xda6a('0x21')](function(_0x18ed10){_0x360a0c['rows']=_0x18ed10;return _0x360a0c;})[_0xda6a('0x21')](respondWithFilteredResult(_0x4783d5,_0xeb5ca0))['catch'](handleError(_0x4783d5,null));};exports[_0xda6a('0x3f')]=function(_0x27a829,_0x40a2a4){var _0x4e60f3={'raw':![],'where':{'id':_0x27a829[_0xda6a('0x40')]['id']}},_0x3ce9f1={};_0x3ce9f1[_0xda6a('0x2d')]=_[_0xda6a('0x30')](db[_0xda6a('0x28')][_0xda6a('0x29')]);_0x3ce9f1[_0xda6a('0x2f')]=_[_0xda6a('0x30')](_0x27a829['query']);_0x3ce9f1[_0xda6a('0x37')]=_[_0xda6a('0x31')](_0x3ce9f1[_0xda6a('0x2d')],_0x3ce9f1['query']);_0x4e60f3[_0xda6a('0x32')]=_['intersection'](_0x3ce9f1[_0xda6a('0x2d')],qs[_0xda6a('0x33')](_0x27a829[_0xda6a('0x2f')][_0xda6a('0x33')]));_0x4e60f3['attributes']=_0x4e60f3[_0xda6a('0x32')]['length']?_0x4e60f3[_0xda6a('0x32')]:_0x3ce9f1['model'];if(_0x27a829['query'][_0xda6a('0x3c')]){_0x4e60f3[_0xda6a('0x3d')]=[{'all':!![]}];}_0x4e60f3=_['merge']({},_0x4e60f3,_0x27a829[_0xda6a('0x3b')]);return db['DeskAccount'][_0xda6a('0x41')](_0x4e60f3)[_0xda6a('0x21')](handleEntityNotFound(_0x40a2a4,null))[_0xda6a('0x21')](respondWithResult(_0x40a2a4,null))[_0xda6a('0x42')](handleError(_0x40a2a4,null));};exports['create']=function(_0x118dff,_0x4f6378){return db[_0xda6a('0x28')][_0xda6a('0x43')](_0x118dff[_0xda6a('0x44')],{})['then'](respondWithResult(_0x4f6378,0xc9))[_0xda6a('0x42')](handleError(_0x4f6378,null));};exports[_0xda6a('0x45')]=function(_0x286fe0,_0x48bd2b){if(_0x286fe0[_0xda6a('0x44')]['id']){delete _0x286fe0[_0xda6a('0x44')]['id'];}return db[_0xda6a('0x28')][_0xda6a('0x41')]({'where':{'id':_0x286fe0[_0xda6a('0x40')]['id']}})['then'](handleEntityNotFound(_0x48bd2b,null))[_0xda6a('0x21')](saveUpdates(_0x286fe0[_0xda6a('0x44')],null))['then'](respondWithResult(_0x48bd2b,null))[_0xda6a('0x42')](handleError(_0x48bd2b,null));};exports['destroy']=function(_0x2b49ed,_0x5c2816){return db[_0xda6a('0x28')]['find']({'where':{'id':_0x2b49ed[_0xda6a('0x40')]['id']}})['then'](handleEntityNotFound(_0x5c2816,null))['then'](removeEntity(_0x5c2816,null))[_0xda6a('0x42')](handleError(_0x5c2816,null));};exports[_0xda6a('0x46')]=function(_0x39d761,_0x295b1c,_0x5206a5){var _0x145fe3={};var _0x532b9c={};var _0x2678d0;var _0x51c38c;return db[_0xda6a('0x28')][_0xda6a('0x47')]({'where':{'id':_0x39d761['params']['id']}})[_0xda6a('0x21')](handleEntityNotFound(_0x295b1c,null))[_0xda6a('0x21')](function(_0x4c3a33){if(_0x4c3a33){_0x2678d0=_0x4c3a33;_0x532b9c[_0xda6a('0x2d')]=_[_0xda6a('0x30')](db['DeskConfiguration'][_0xda6a('0x29')]);_0x532b9c[_0xda6a('0x2f')]=_[_0xda6a('0x30')](_0x39d761[_0xda6a('0x2f')]);_0x532b9c[_0xda6a('0x37')]=_[_0xda6a('0x31')](_0x532b9c[_0xda6a('0x2d')],_0x532b9c['query']);_0x145fe3[_0xda6a('0x32')]=_[_0xda6a('0x31')](_0x532b9c[_0xda6a('0x2d')],qs['fields'](_0x39d761[_0xda6a('0x2f')][_0xda6a('0x33')]));_0x145fe3[_0xda6a('0x32')]=_0x145fe3['attributes']['length']?_0x145fe3[_0xda6a('0x32')]:_0x532b9c[_0xda6a('0x2d')];_0x145fe3[_0xda6a('0x48')]=qs[_0xda6a('0x35')](_0x39d761['query']['sort']);_0x145fe3[_0xda6a('0x36')]=qs[_0xda6a('0x37')](_['pick'](_0x39d761['query'],_0x532b9c[_0xda6a('0x37')]));if(_0x39d761['query']['filter']){_0x145fe3['where']=_[_0xda6a('0x39')](_0x145fe3[_0xda6a('0x36')],{'$or':_[_0xda6a('0x2e')](_0x145fe3[_0xda6a('0x32')],function(_0xb585c2){var _0x300208={};_0x300208[_0xb585c2]={'$like':'%'+_0x39d761[_0xda6a('0x2f')][_0xda6a('0x3a')]+'%'};return _0x300208;})});}_0x145fe3=_[_0xda6a('0x39')]({},_0x145fe3,_0x39d761[_0xda6a('0x3b')]);return _0x2678d0[_0xda6a('0x46')](_0x145fe3);}})[_0xda6a('0x21')](function(_0x4df747){if(_0x4df747){_0x51c38c=_0x4df747[_0xda6a('0x34')];if(!_0x39d761[_0xda6a('0x2f')][_0xda6a('0x49')](_0xda6a('0x4a'))){_0x145fe3['limit']=qs[_0xda6a('0x1a')](_0x39d761['query'][_0xda6a('0x1a')]);_0x145fe3[_0xda6a('0x18')]=qs[_0xda6a('0x18')](_0x39d761['query'][_0xda6a('0x18')]);}return _0x2678d0['getConfigurations'](_0x145fe3);}})[_0xda6a('0x21')](function(_0x4efb3d){if(_0x4efb3d){return _0x4efb3d?{'count':_0x51c38c,'rows':_0x4efb3d}:null;}})[_0xda6a('0x21')](respondWithResult(_0x295b1c,null))[_0xda6a('0x42')](handleError(_0x295b1c,null));};exports['addConfiguration']=function(_0x23e888,_0x3c1318,_0x9b0460){if(_0x23e888[_0xda6a('0x44')]['id']){delete _0x23e888[_0xda6a('0x44')]['id'];}return db[_0xda6a('0x28')][_0xda6a('0x47')]({'where':{'id':_0x23e888['params']['id']}})[_0xda6a('0x21')](handleEntityNotFound(_0x3c1318,null))[_0xda6a('0x21')](function(_0x1b8d53){if(_0x1b8d53){_0x23e888[_0xda6a('0x44')][_0xda6a('0x4b')]=_0x1b8d53['id'];_0x23e888[_0xda6a('0x44')]['Subjects']=integrations['getSubjects'](_0x23e888[_0xda6a('0x44')][_0xda6a('0x4c')],_0x23e888[_0xda6a('0x44')][_0xda6a('0x2b')]);_0x23e888[_0xda6a('0x44')][_0xda6a('0x4d')]=integrations[_0xda6a('0x4e')](_0x23e888[_0xda6a('0x44')][_0xda6a('0x4c')],_0x23e888[_0xda6a('0x44')]['type']);return db[_0xda6a('0x4f')][_0xda6a('0x43')](_0x23e888[_0xda6a('0x44')],{'include':[{'model':db['DeskField'],'as':_0xda6a('0x50')},{'model':db[_0xda6a('0x51')],'as':_0xda6a('0x4d')}]});}return null;})['then'](respondWithResult(_0x3c1318,null))[_0xda6a('0x42')](handleError(_0x3c1318,null));};exports[_0xda6a('0x52')]=function(_0x36ee56,_0x360da3,_0x3d32e7){var _0x2bdb08=[{'name':_0xda6a('0x53'),'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 _0x515246='';return db[_0xda6a('0x28')][_0xda6a('0x47')]({'where':{'id':_0x36ee56['params']['id']},'attributes':['id','remoteUri',_0xda6a('0x54'),_0xda6a('0x55'),_0xda6a('0x56'),_0xda6a('0x57'),_0xda6a('0x58'),'token',_0xda6a('0x59')]})[_0xda6a('0x21')](handleEntityNotFound(_0x360da3,null))['then'](function(_0x10294f){if(_0x10294f){_0x515246=_0x10294f[_0xda6a('0x5a')];var _0xcd0f61=_0x515246[_0xda6a('0x5b')](-0x1);if(_0xcd0f61==='/'){_0x515246=_0x515246[_0xda6a('0x5c')](0x0,_0x515246[_0xda6a('0x5d')](_0xcd0f61));}var _0x4b3c2c={'method':_0xda6a('0x5e'),'uri':util[_0xda6a('0x5f')]('%s/custom_fields',_0x515246),'headers':{'Content-Type':_0xda6a('0x60'),'Accept':'application/json'},'json':!![]};if(_0x10294f[_0xda6a('0x54')]===_0xda6a('0x61')){_0x4b3c2c['headers'][_0xda6a('0x62')]=util[_0xda6a('0x5f')]('Basic\x20%s',new Buffer(util[_0xda6a('0x5f')]('%s:%s',_0x10294f[_0xda6a('0x55')],_0x10294f[_0xda6a('0x56')]))[_0xda6a('0x63')](_0xda6a('0x64')));}return rp(_0x4b3c2c)['then'](function(_0xea4bb7){return _0x2bdb08[_0xda6a('0x65')](_[_0xda6a('0x2e')](_0xea4bb7['_embedded'][_0xda6a('0x66')],function(_0x12ad0a){return{'id':_0x12ad0a[_0xda6a('0x25')],'name':_0x12ad0a[_0xda6a('0x25')],'type':_0x12ad0a[_0xda6a('0x2b')],'active':_0x12ad0a['active'],'label':_0x12ad0a[_0xda6a('0x67')],'custom':!![]};}));});}})[_0xda6a('0x21')](function(_0x22b147){return{'count':_0x22b147['length'],'rows':_0x22b147};})[_0xda6a('0x21')](respondWithResult(_0x360da3,null))[_0xda6a('0x42')](function(_0x25da2f){var _0x58cb39=_0x36ee56[_0xda6a('0x2f')][_0xda6a('0x68')]?0x1f4:_0x25da2f[_0xda6a('0x69')]||0x1f4;logger[_0xda6a('0x23')](_0xda6a('0x6a'),_0xda6a('0x52'),_0x58cb39,JSON[_0xda6a('0x6b')](_0x25da2f));delete _0x25da2f[_0xda6a('0x25')];if(_0x58cb39===0x191){_0x58cb39=0x190;}_0x360da3['status'](_0x58cb39)[_0xda6a('0x26')](_0x36ee56[_0xda6a('0x2f')][_0xda6a('0x68')]?{'message':_0xda6a('0x6c'),'statusCode':_0x25da2f['statusCode']}:_0x25da2f);});}; \ No newline at end of file +var _0x57dc=['statusCode','error','getFields,\x20%s,\x20%s,\x20%s','getFields','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','stack','name','send','index','map','DeskAccount','rawAttributes','fieldName','model','query','keys','filters','attributes','intersection','fields','length','nolimit','order','sort','pick','filter','where','merge','type','options','includeAll','findAll','show','params','include','catch','create','body','find','getConfigurations','findOne','hasOwnProperty','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','DeskConfiguration','DeskField','priority','remoteUri','username','consumerKey','consumerSecret','token','tokenSecret','substring','lastIndexOf','format','%s/custom_fields','application/json','authType','headers','%s:%s','password','toString','base64','concat','_embedded','active','label','test'];(function(_0x4fbd10,_0x131d69){var _0x63e2f9=function(_0x4dd05e){while(--_0x4dd05e){_0x4fbd10['push'](_0x4fbd10['shift']());}};_0x63e2f9(++_0x131d69);}(_0x57dc,0x1c5));var _0xc57d=function(_0x1ae4a9,_0x4c0ed9){_0x1ae4a9=_0x1ae4a9-0x0;var _0x54d0b0=_0x57dc[_0x1ae4a9];return _0x54d0b0;};'use strict';var emlformat=require(_0xc57d('0x0'));var rimraf=require(_0xc57d('0x1'));var zipdir=require(_0xc57d('0x2'));var jsonpatch=require(_0xc57d('0x3'));var rp=require('request-promise');var moment=require(_0xc57d('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xc57d('0x5'));var util=require(_0xc57d('0x6'));var path=require(_0xc57d('0x7'));var sox=require(_0xc57d('0x8'));var csv=require(_0xc57d('0x9'));var ejs=require(_0xc57d('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc57d('0xb'));var squel=require('squel');var crypto=require(_0xc57d('0xc'));var jsforce=require(_0xc57d('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xc57d('0x9'));var querystring=require(_0xc57d('0xe'));var Papa=require('papaparse');var Redis=require(_0xc57d('0xf'));var authService=require(_0xc57d('0x10'));var qs=require(_0xc57d('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc57d('0x12'));var logger=require('../../config/logger')(_0xc57d('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xc57d('0x14'));var db=require(_0xc57d('0x15'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x201bc4,_0x467918){_0x467918=_0x467918||0xcc;return function(_0x194f34){if(_0x194f34){return _0x201bc4['sendStatus'](_0x467918);}return _0x201bc4[_0xc57d('0x16')](_0x467918)[_0xc57d('0x17')]();};}function respondWithResult(_0x1da4df,_0x1d6ca1){_0x1d6ca1=_0x1d6ca1||0xc8;return function(_0x3eb98e){if(_0x3eb98e){return _0x1da4df[_0xc57d('0x16')](_0x1d6ca1)[_0xc57d('0x18')](_0x3eb98e);}};}function respondWithFilteredResult(_0x454a49,_0x432cfe){return function(_0xdb4bd9){if(_0xdb4bd9){var _0x3751f3=typeof _0x432cfe[_0xc57d('0x19')]===_0xc57d('0x1a')&&typeof _0x432cfe[_0xc57d('0x1b')]==='undefined';var _0x3d06cf=_0xdb4bd9[_0xc57d('0x1c')];var _0x52df81=_0x3751f3?0x0:_0x432cfe['offset'];var _0x29e2a9=_0x3751f3?_0xdb4bd9[_0xc57d('0x1c')]:_0x432cfe[_0xc57d('0x19')]+_0x432cfe[_0xc57d('0x1b')];var _0x213a53;if(_0x29e2a9>=_0x3d06cf){_0x29e2a9=_0x3d06cf;_0x213a53=0xc8;}else{_0x213a53=0xce;}_0x454a49[_0xc57d('0x16')](_0x213a53);return _0x454a49[_0xc57d('0x1d')](_0xc57d('0x1e'),_0x52df81+'-'+_0x29e2a9+'/'+_0x3d06cf)[_0xc57d('0x18')](_0xdb4bd9);}return null;};}function patchUpdates(_0x26ce24){return function(_0x1b16af){try{jsonpatch[_0xc57d('0x1f')](_0x1b16af,_0x26ce24,!![]);}catch(_0x132b8b){return BPromise[_0xc57d('0x20')](_0x132b8b);}return _0x1b16af[_0xc57d('0x21')]();};}function saveUpdates(_0x5076fe,_0x29d687){return function(_0x18a813){if(_0x18a813){return _0x18a813[_0xc57d('0x22')](_0x5076fe)[_0xc57d('0x23')](function(_0x54bf89){return _0x54bf89;});}return null;};}function removeEntity(_0x1a4b9f,_0x2e1648){return function(_0x106127){if(_0x106127){return _0x106127[_0xc57d('0x24')]()[_0xc57d('0x23')](function(){_0x1a4b9f[_0xc57d('0x16')](0xcc)[_0xc57d('0x17')]();});}};}function handleEntityNotFound(_0x1dd4d4,_0x133f67){return function(_0x12dee3){if(!_0x12dee3){_0x1dd4d4[_0xc57d('0x25')](0x194);}return _0x12dee3;};}function handleError(_0x4b3342,_0x2f549e){_0x2f549e=_0x2f549e||0x1f4;return function(_0x4a93c9){logger['error'](_0x4a93c9[_0xc57d('0x26')]);if(_0x4a93c9[_0xc57d('0x27')]){delete _0x4a93c9[_0xc57d('0x27')];}_0x4b3342[_0xc57d('0x16')](_0x2f549e)[_0xc57d('0x28')](_0x4a93c9);};}exports[_0xc57d('0x29')]=function(_0x4d4bc8,_0x114ddc){var _0x478b94={},_0x33cab6={},_0x1a2c49={'count':0x0,'rows':[]};var _0x392f23=_[_0xc57d('0x2a')](db[_0xc57d('0x2b')][_0xc57d('0x2c')],function(_0x85a494){return{'name':_0x85a494[_0xc57d('0x2d')],'type':_0x85a494['type']['key']};});_0x33cab6[_0xc57d('0x2e')]=_[_0xc57d('0x2a')](_0x392f23,'name');_0x33cab6[_0xc57d('0x2f')]=_[_0xc57d('0x30')](_0x4d4bc8[_0xc57d('0x2f')]);_0x33cab6[_0xc57d('0x31')]=_['intersection'](_0x33cab6[_0xc57d('0x2e')],_0x33cab6[_0xc57d('0x2f')]);_0x478b94[_0xc57d('0x32')]=_[_0xc57d('0x33')](_0x33cab6[_0xc57d('0x2e')],qs[_0xc57d('0x34')](_0x4d4bc8[_0xc57d('0x2f')][_0xc57d('0x34')]));_0x478b94[_0xc57d('0x32')]=_0x478b94['attributes'][_0xc57d('0x35')]?_0x478b94['attributes']:_0x33cab6[_0xc57d('0x2e')];if(!_0x4d4bc8['query']['hasOwnProperty'](_0xc57d('0x36'))){_0x478b94[_0xc57d('0x1b')]=qs[_0xc57d('0x1b')](_0x4d4bc8[_0xc57d('0x2f')][_0xc57d('0x1b')]);_0x478b94[_0xc57d('0x19')]=qs['offset'](_0x4d4bc8['query'][_0xc57d('0x19')]);}_0x478b94[_0xc57d('0x37')]=qs[_0xc57d('0x38')](_0x4d4bc8[_0xc57d('0x2f')]['sort']);_0x478b94['where']=qs['filters'](_[_0xc57d('0x39')](_0x4d4bc8[_0xc57d('0x2f')],_0x33cab6[_0xc57d('0x31')]),_0x392f23);if(_0x4d4bc8[_0xc57d('0x2f')][_0xc57d('0x3a')]){_0x478b94[_0xc57d('0x3b')]=_[_0xc57d('0x3c')](_0x478b94[_0xc57d('0x3b')],{'$or':_[_0xc57d('0x2a')](_0x392f23,function(_0x32f1e8){if(_0x32f1e8[_0xc57d('0x3d')]!=='VIRTUAL'){var _0x2d8880={};_0x2d8880[_0x32f1e8[_0xc57d('0x27')]]={'$like':'%'+_0x4d4bc8[_0xc57d('0x2f')][_0xc57d('0x3a')]+'%'};return _0x2d8880;}})});}_0x478b94=_[_0xc57d('0x3c')]({},_0x478b94,_0x4d4bc8[_0xc57d('0x3e')]);var _0x5dab1f={'where':_0x478b94['where']};return db[_0xc57d('0x2b')][_0xc57d('0x1c')](_0x5dab1f)[_0xc57d('0x23')](function(_0x340726){_0x1a2c49[_0xc57d('0x1c')]=_0x340726;if(_0x4d4bc8[_0xc57d('0x2f')][_0xc57d('0x3f')]){_0x478b94['include']=[{'all':!![]}];}return db['DeskAccount'][_0xc57d('0x40')](_0x478b94);})[_0xc57d('0x23')](function(_0x1de33c){_0x1a2c49['rows']=_0x1de33c;return _0x1a2c49;})[_0xc57d('0x23')](respondWithFilteredResult(_0x114ddc,_0x478b94))['catch'](handleError(_0x114ddc,null));};exports[_0xc57d('0x41')]=function(_0x21b091,_0x3ecd58){var _0x1a901b={'raw':![],'where':{'id':_0x21b091[_0xc57d('0x42')]['id']}},_0x56a125={};_0x56a125[_0xc57d('0x2e')]=_[_0xc57d('0x30')](db[_0xc57d('0x2b')][_0xc57d('0x2c')]);_0x56a125['query']=_[_0xc57d('0x30')](_0x21b091[_0xc57d('0x2f')]);_0x56a125[_0xc57d('0x31')]=_['intersection'](_0x56a125[_0xc57d('0x2e')],_0x56a125['query']);_0x1a901b[_0xc57d('0x32')]=_[_0xc57d('0x33')](_0x56a125['model'],qs[_0xc57d('0x34')](_0x21b091[_0xc57d('0x2f')][_0xc57d('0x34')]));_0x1a901b['attributes']=_0x1a901b['attributes']['length']?_0x1a901b[_0xc57d('0x32')]:_0x56a125['model'];if(_0x21b091[_0xc57d('0x2f')]['includeAll']){_0x1a901b[_0xc57d('0x43')]=[{'all':!![]}];}_0x1a901b=_['merge']({},_0x1a901b,_0x21b091['options']);return db[_0xc57d('0x2b')]['find'](_0x1a901b)[_0xc57d('0x23')](handleEntityNotFound(_0x3ecd58,null))[_0xc57d('0x23')](respondWithResult(_0x3ecd58,null))[_0xc57d('0x44')](handleError(_0x3ecd58,null));};exports[_0xc57d('0x45')]=function(_0x3f2eef,_0x48eed8){return db['DeskAccount'][_0xc57d('0x45')](_0x3f2eef[_0xc57d('0x46')],{})[_0xc57d('0x23')](respondWithResult(_0x48eed8,0xc9))[_0xc57d('0x44')](handleError(_0x48eed8,null));};exports[_0xc57d('0x22')]=function(_0x1d8ff9,_0x4d6717){if(_0x1d8ff9['body']['id']){delete _0x1d8ff9[_0xc57d('0x46')]['id'];}return db[_0xc57d('0x2b')]['find']({'where':{'id':_0x1d8ff9[_0xc57d('0x42')]['id']}})[_0xc57d('0x23')](handleEntityNotFound(_0x4d6717,null))['then'](saveUpdates(_0x1d8ff9[_0xc57d('0x46')],null))['then'](respondWithResult(_0x4d6717,null))[_0xc57d('0x44')](handleError(_0x4d6717,null));};exports[_0xc57d('0x24')]=function(_0xab960b,_0x456549){return db['DeskAccount'][_0xc57d('0x47')]({'where':{'id':_0xab960b[_0xc57d('0x42')]['id']}})['then'](handleEntityNotFound(_0x456549,null))['then'](removeEntity(_0x456549,null))[_0xc57d('0x44')](handleError(_0x456549,null));};exports[_0xc57d('0x48')]=function(_0x33f79b,_0x272ea7,_0x5c214d){var _0x4dea25={};var _0x39366b={};var _0x102c32;var _0x44324c;return db[_0xc57d('0x2b')][_0xc57d('0x49')]({'where':{'id':_0x33f79b['params']['id']}})[_0xc57d('0x23')](handleEntityNotFound(_0x272ea7,null))[_0xc57d('0x23')](function(_0x48d087){if(_0x48d087){_0x102c32=_0x48d087;_0x39366b['model']=_['keys'](db['DeskConfiguration'][_0xc57d('0x2c')]);_0x39366b[_0xc57d('0x2f')]=_[_0xc57d('0x30')](_0x33f79b['query']);_0x39366b['filters']=_['intersection'](_0x39366b[_0xc57d('0x2e')],_0x39366b['query']);_0x4dea25[_0xc57d('0x32')]=_[_0xc57d('0x33')](_0x39366b[_0xc57d('0x2e')],qs[_0xc57d('0x34')](_0x33f79b[_0xc57d('0x2f')]['fields']));_0x4dea25[_0xc57d('0x32')]=_0x4dea25[_0xc57d('0x32')][_0xc57d('0x35')]?_0x4dea25[_0xc57d('0x32')]:_0x39366b['model'];_0x4dea25[_0xc57d('0x37')]=qs[_0xc57d('0x38')](_0x33f79b[_0xc57d('0x2f')][_0xc57d('0x38')]);_0x4dea25[_0xc57d('0x3b')]=qs[_0xc57d('0x31')](_['pick'](_0x33f79b[_0xc57d('0x2f')],_0x39366b[_0xc57d('0x31')]));if(_0x33f79b[_0xc57d('0x2f')][_0xc57d('0x3a')]){_0x4dea25[_0xc57d('0x3b')]=_[_0xc57d('0x3c')](_0x4dea25[_0xc57d('0x3b')],{'$or':_[_0xc57d('0x2a')](_0x4dea25[_0xc57d('0x32')],function(_0xd6c670){var _0x52da83={};_0x52da83[_0xd6c670]={'$like':'%'+_0x33f79b[_0xc57d('0x2f')]['filter']+'%'};return _0x52da83;})});}_0x4dea25=_[_0xc57d('0x3c')]({},_0x4dea25,_0x33f79b[_0xc57d('0x3e')]);return _0x102c32[_0xc57d('0x48')](_0x4dea25);}})[_0xc57d('0x23')](function(_0x1a3651){if(_0x1a3651){_0x44324c=_0x1a3651['length'];if(!_0x33f79b[_0xc57d('0x2f')][_0xc57d('0x4a')]('nolimit')){_0x4dea25[_0xc57d('0x1b')]=qs[_0xc57d('0x1b')](_0x33f79b[_0xc57d('0x2f')][_0xc57d('0x1b')]);_0x4dea25[_0xc57d('0x19')]=qs[_0xc57d('0x19')](_0x33f79b['query'][_0xc57d('0x19')]);}return _0x102c32[_0xc57d('0x48')](_0x4dea25);}})[_0xc57d('0x23')](function(_0x1a6e4f){if(_0x1a6e4f){return _0x1a6e4f?{'count':_0x44324c,'rows':_0x1a6e4f}:null;}})[_0xc57d('0x23')](respondWithResult(_0x272ea7,null))[_0xc57d('0x44')](handleError(_0x272ea7,null));};exports[_0xc57d('0x4b')]=function(_0x18cdcf,_0x5c190f,_0x5339aa){if(_0x18cdcf['body']['id']){delete _0x18cdcf[_0xc57d('0x46')]['id'];}return db['DeskAccount']['findOne']({'where':{'id':_0x18cdcf[_0xc57d('0x42')]['id']}})[_0xc57d('0x23')](handleEntityNotFound(_0x5c190f,null))[_0xc57d('0x23')](function(_0x11c6cd){if(_0x11c6cd){_0x18cdcf['body'][_0xc57d('0x4c')]=_0x11c6cd['id'];_0x18cdcf[_0xc57d('0x46')][_0xc57d('0x4d')]=integrations[_0xc57d('0x4e')](_0x18cdcf['body'][_0xc57d('0x4f')],_0x18cdcf['body'][_0xc57d('0x3d')]);_0x18cdcf[_0xc57d('0x46')][_0xc57d('0x50')]=integrations[_0xc57d('0x51')](_0x18cdcf['body'][_0xc57d('0x4f')],_0x18cdcf[_0xc57d('0x46')][_0xc57d('0x3d')]);return db[_0xc57d('0x52')][_0xc57d('0x45')](_0x18cdcf[_0xc57d('0x46')],{'include':[{'model':db[_0xc57d('0x53')],'as':_0xc57d('0x4d')},{'model':db[_0xc57d('0x53')],'as':_0xc57d('0x50')}]});}return null;})[_0xc57d('0x23')](respondWithResult(_0x5c190f,null))[_0xc57d('0x44')](handleError(_0x5c190f,null));};exports['getFields']=function(_0xde150a,_0x58ff6f,_0x52b476){var _0x35dc40=[{'name':_0xc57d('0x54'),'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 _0xa026ef='';return db['DeskAccount'][_0xc57d('0x49')]({'where':{'id':_0xde150a[_0xc57d('0x42')]['id']},'attributes':['id',_0xc57d('0x55'),'authType',_0xc57d('0x56'),'password',_0xc57d('0x57'),_0xc57d('0x58'),_0xc57d('0x59'),_0xc57d('0x5a')]})[_0xc57d('0x23')](handleEntityNotFound(_0x58ff6f,null))[_0xc57d('0x23')](function(_0x1e9162){if(_0x1e9162){_0xa026ef=_0x1e9162[_0xc57d('0x55')];var _0x345d17=_0xa026ef['slice'](-0x1);if(_0x345d17==='/'){_0xa026ef=_0xa026ef[_0xc57d('0x5b')](0x0,_0xa026ef[_0xc57d('0x5c')](_0x345d17));}var _0x50449b={'method':'GET','uri':util[_0xc57d('0x5d')](_0xc57d('0x5e'),_0xa026ef),'headers':{'Content-Type':_0xc57d('0x5f'),'Accept':'application/json'},'json':!![]};if(_0x1e9162[_0xc57d('0x60')]==='basic'){_0x50449b[_0xc57d('0x61')]['Authorization']=util[_0xc57d('0x5d')]('Basic\x20%s',new Buffer(util[_0xc57d('0x5d')](_0xc57d('0x62'),_0x1e9162[_0xc57d('0x56')],_0x1e9162[_0xc57d('0x63')]))[_0xc57d('0x64')](_0xc57d('0x65')));}return rp(_0x50449b)[_0xc57d('0x23')](function(_0x37c85b){return _0x35dc40[_0xc57d('0x66')](_[_0xc57d('0x2a')](_0x37c85b[_0xc57d('0x67')]['entries'],function(_0x5d3ec3){return{'id':_0x5d3ec3[_0xc57d('0x27')],'name':_0x5d3ec3['name'],'type':_0x5d3ec3[_0xc57d('0x3d')],'active':_0x5d3ec3[_0xc57d('0x68')],'label':_0x5d3ec3[_0xc57d('0x69')],'custom':!![]};}));});}})[_0xc57d('0x23')](function(_0x2daf64){return{'count':_0x2daf64[_0xc57d('0x35')],'rows':_0x2daf64};})[_0xc57d('0x23')](respondWithResult(_0x58ff6f,null))[_0xc57d('0x44')](function(_0x1cf2bc){var _0x545135=_0xde150a[_0xc57d('0x2f')][_0xc57d('0x6a')]?0x1f4:_0x1cf2bc[_0xc57d('0x6b')]||0x1f4;logger[_0xc57d('0x6c')](_0xc57d('0x6d'),_0xc57d('0x6e'),_0x545135,JSON['stringify'](_0x1cf2bc));delete _0x1cf2bc[_0xc57d('0x27')];if(_0x545135===0x191){_0x545135=0x190;}_0x58ff6f[_0xc57d('0x16')](_0x545135)[_0xc57d('0x28')](_0xde150a[_0xc57d('0x2f')]['test']?{'message':_0xc57d('0x6f'),'statusCode':_0x1cf2bc[_0xc57d('0x6b')]}:_0x1cf2bc);});}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.model.js b/server/api/intDeskAccount/intDeskAccount.model.js index ec79e96..6ab6297 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 _0xc05e=['../../config/environment','../../components/integrations/configuration','exports','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf'];(function(_0x5a23a4,_0x2eeb57){var _0x13a098=function(_0x40514f){while(--_0x40514f){_0x5a23a4['push'](_0x5a23a4['shift']());}};_0x13a098(++_0x2eeb57);}(_0xc05e,0x66));var _0xec05=function(_0x3bb216,_0x26eced){_0x3bb216=_0x3bb216-0x0;var _0x24961c=_0xc05e[_0x3bb216];return _0x24961c;};'use strict';var _=require(_0xec05('0x0'));var util=require(_0xec05('0x1'));var logger=require(_0xec05('0x2'))(_0xec05('0x3'));var moment=require(_0xec05('0x4'));var BPromise=require(_0xec05('0x5'));var rp=require(_0xec05('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xec05('0x7'));var config=require(_0xec05('0x8'));var attributes=require('./intDeskAccount.attributes');var integrations=require(_0xec05('0x9'));module[_0xec05('0xa')]=function(_0x2babb4,_0x7e859e){return _0x2babb4['define']('DeskAccount',attributes,{'tableName':'int_desk_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x54fd=['lodash','api','moment','request-promise','path','rimraf','./intDeskAccount.attributes','../../components/integrations/configuration','exports','define','DeskAccount'];(function(_0x32a884,_0x183853){var _0x242f9b=function(_0x556c63){while(--_0x556c63){_0x32a884['push'](_0x32a884['shift']());}};_0x242f9b(++_0x183853);}(_0x54fd,0x129));var _0xd54f=function(_0x2372ea,_0x53ac11){_0x2372ea=_0x2372ea-0x0;var _0x323cf0=_0x54fd[_0x2372ea];return _0x323cf0;};'use strict';var _=require(_0xd54f('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xd54f('0x1'));var moment=require(_0xd54f('0x2'));var BPromise=require('bluebird');var rp=require(_0xd54f('0x3'));var fs=require('fs');var path=require(_0xd54f('0x4'));var rimraf=require(_0xd54f('0x5'));var config=require('../../config/environment');var attributes=require(_0xd54f('0x6'));var integrations=require(_0xd54f('0x7'));module[_0xd54f('0x8')]=function(_0x7e3bfe,_0x4a1b71){return _0x7e3bfe[_0xd54f('0x9')](_0xd54f('0xa'),attributes,{'tableName':'int_desk_accounts','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 0881fdc..381c0a9 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 _0xbb18=['find','ShowDeskAccount','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','DeskAccount,\x20%s,\x20%s','request\x20sent','DeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','GetDeskAccount','DeskAccount','findAll','options','raw','where','attributes','include','map','model','debug'];(function(_0xd832be,_0x176f86){var _0xef366=function(_0x486ec8){while(--_0x486ec8){_0xd832be['push'](_0xd832be['shift']());}};_0xef366(++_0x176f86);}(_0xbb18,0xfe));var _0x8bb1=function(_0x3f3519,_0xd53cae){_0x3f3519=_0x3f3519-0x0;var _0x23b6bf=_0xbb18[_0x3f3519];return _0x23b6bf;};'use strict';var _=require(_0x8bb1('0x0'));var util=require(_0x8bb1('0x1'));var moment=require(_0x8bb1('0x2'));var BPromise=require(_0x8bb1('0x3'));var rs=require(_0x8bb1('0x4'));var fs=require('fs');var Redis=require(_0x8bb1('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x8bb1('0x6'))(_0x8bb1('0x7'));var config=require(_0x8bb1('0x8'));var jayson=require(_0x8bb1('0x9'));var client=jayson[_0x8bb1('0xa')][_0x8bb1('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2b9677,_0x46faa0,_0x3a28ea){return new BPromise(function(_0x16a76e,_0x58eb15){return client[_0x8bb1('0xc')](_0x2b9677,_0x3a28ea)[_0x8bb1('0xd')](function(_0x131f61){logger[_0x8bb1('0xe')](_0x8bb1('0xf'),_0x46faa0,_0x8bb1('0x10'));logger['debug'](_0x8bb1('0x11'),_0x46faa0,_0x8bb1('0x10'),JSON[_0x8bb1('0x12')](_0x131f61));if(_0x131f61[_0x8bb1('0x13')]){if(_0x131f61[_0x8bb1('0x13')]['code']===0x1f4){logger['error'](_0x8bb1('0xf'),_0x46faa0,_0x131f61[_0x8bb1('0x13')][_0x8bb1('0x14')]);return _0x58eb15(_0x131f61[_0x8bb1('0x13')][_0x8bb1('0x14')]);}logger[_0x8bb1('0x13')](_0x8bb1('0xf'),_0x46faa0,_0x131f61[_0x8bb1('0x13')][_0x8bb1('0x14')]);return _0x16a76e(_0x131f61[_0x8bb1('0x13')][_0x8bb1('0x14')]);}else{logger[_0x8bb1('0xe')](_0x8bb1('0xf'),_0x46faa0,'request\x20sent');_0x16a76e(_0x131f61[_0x8bb1('0x15')]['message']);}})[_0x8bb1('0x16')](function(_0x149d11){logger[_0x8bb1('0x13')]('DeskAccount,\x20%s,\x20%s',_0x46faa0,_0x149d11);_0x58eb15(_0x149d11);});});}exports[_0x8bb1('0x17')]=function(_0x2e7aeb){var _0x14a483=this;return new Promise(function(_0x4c3e3a,_0x3ee147){return db[_0x8bb1('0x18')][_0x8bb1('0x19')]({'raw':_0x2e7aeb['options']?_0x2e7aeb[_0x8bb1('0x1a')][_0x8bb1('0x1b')]===undefined?!![]:![]:!![],'where':_0x2e7aeb[_0x8bb1('0x1a')]?_0x2e7aeb[_0x8bb1('0x1a')][_0x8bb1('0x1c')]||null:null,'attributes':_0x2e7aeb[_0x8bb1('0x1a')]?_0x2e7aeb['options'][_0x8bb1('0x1d')]||null:null,'limit':_0x2e7aeb[_0x8bb1('0x1a')]?_0x2e7aeb[_0x8bb1('0x1a')]['limit']||null:null,'include':_0x2e7aeb['options']?_0x2e7aeb[_0x8bb1('0x1a')]['include']?_['map'](_0x2e7aeb[_0x8bb1('0x1a')][_0x8bb1('0x1e')],function(_0x31492d){return{'model':db[_0x31492d['model']],'as':_0x31492d['as'],'attributes':_0x31492d[_0x8bb1('0x1d')],'include':_0x31492d[_0x8bb1('0x1e')]?_[_0x8bb1('0x1f')](_0x31492d['include'],function(_0x544898){return{'model':db[_0x544898[_0x8bb1('0x20')]],'as':_0x544898['as'],'attributes':_0x544898[_0x8bb1('0x1d')],'include':_0x544898[_0x8bb1('0x1e')]?_[_0x8bb1('0x1f')](_0x544898['include'],function(_0x42b2bb){return{'model':db[_0x42b2bb['model']],'as':_0x42b2bb['as'],'attributes':_0x42b2bb[_0x8bb1('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x8bb1('0xd')](function(_0x5456ed){logger['info'](_0x8bb1('0x17'),_0x2e7aeb);logger[_0x8bb1('0x21')](_0x8bb1('0x17'),_0x2e7aeb,JSON[_0x8bb1('0x12')](_0x5456ed));_0x4c3e3a(_0x5456ed);})[_0x8bb1('0x16')](function(_0xe1a9ca){logger[_0x8bb1('0x13')](_0x8bb1('0x17'),_0xe1a9ca['message'],_0x2e7aeb);_0x3ee147(_0x14a483[_0x8bb1('0x13')](0x1f4,_0xe1a9ca[_0x8bb1('0x14')]));});});};exports['ShowDeskAccount']=function(_0x151e55){var _0x101867=this;return new Promise(function(_0x46b998,_0x1c3ae8){return db['DeskAccount'][_0x8bb1('0x22')]({'raw':_0x151e55['options']?_0x151e55['options'][_0x8bb1('0x1b')]===undefined?!![]:![]:!![],'where':_0x151e55[_0x8bb1('0x1a')]?_0x151e55['options'][_0x8bb1('0x1c')]||null:null,'attributes':_0x151e55[_0x8bb1('0x1a')]?_0x151e55[_0x8bb1('0x1a')][_0x8bb1('0x1d')]||null:null,'include':_0x151e55[_0x8bb1('0x1a')]?_0x151e55[_0x8bb1('0x1a')][_0x8bb1('0x1e')]?_[_0x8bb1('0x1f')](_0x151e55['options'][_0x8bb1('0x1e')],function(_0x2f8e40){return{'model':db[_0x2f8e40[_0x8bb1('0x20')]],'as':_0x2f8e40['as'],'attributes':_0x2f8e40[_0x8bb1('0x1d')],'include':_0x2f8e40[_0x8bb1('0x1e')]?_[_0x8bb1('0x1f')](_0x2f8e40['include'],function(_0x303b3b){return{'model':db[_0x303b3b['model']],'as':_0x303b3b['as'],'attributes':_0x303b3b[_0x8bb1('0x1d')],'include':_0x303b3b[_0x8bb1('0x1e')]?_[_0x8bb1('0x1f')](_0x303b3b['include'],function(_0x1ca203){return{'model':db[_0x1ca203[_0x8bb1('0x20')]],'as':_0x1ca203['as'],'attributes':_0x1ca203['attributes']};}):[]};}):[]};}):[]:[]})[_0x8bb1('0xd')](function(_0x3daec8){logger[_0x8bb1('0xe')](_0x8bb1('0x23'),_0x151e55);logger[_0x8bb1('0x21')](_0x8bb1('0x23'),_0x151e55,JSON[_0x8bb1('0x12')](_0x3daec8));_0x46b998(_0x3daec8);})[_0x8bb1('0x16')](function(_0x336709){logger['error']('ShowDeskAccount',_0x336709[_0x8bb1('0x14')],_0x151e55);_0x1c3ae8(_0x101867[_0x8bb1('0x13')](0x1f4,_0x336709[_0x8bb1('0x14')]));});});}; \ No newline at end of file +var _0x845e=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','client','http','request','then','info','DeskAccount,\x20%s,\x20%s','request\x20sent','debug','DeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','GetDeskAccount','DeskAccount','findAll','options','raw','where','attributes','map','include','model','ShowDeskAccount','find','util','moment'];(function(_0x46ba47,_0x4852b2){var _0x1aad10=function(_0x278f57){while(--_0x278f57){_0x46ba47['push'](_0x46ba47['shift']());}};_0x1aad10(++_0x4852b2);}(_0x845e,0x64));var _0xe845=function(_0x1dd6f1,_0x4ab826){_0x1dd6f1=_0x1dd6f1-0x0;var _0x4bb8d0=_0x845e[_0x1dd6f1];return _0x4bb8d0;};'use strict';var _=require('lodash');var util=require(_0xe845('0x0'));var moment=require(_0xe845('0x1'));var BPromise=require(_0xe845('0x2'));var rs=require(_0xe845('0x3'));var fs=require('fs');var Redis=require(_0xe845('0x4'));var db=require(_0xe845('0x5'))['db'];var utils=require(_0xe845('0x6'));var logger=require('../../config/logger')(_0xe845('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xe845('0x8')][_0xe845('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x40d4f7,_0x32e9cc,_0x305165){return new BPromise(function(_0x2454d9,_0xbd83bd){return client[_0xe845('0xa')](_0x40d4f7,_0x305165)[_0xe845('0xb')](function(_0x566c7a){logger[_0xe845('0xc')](_0xe845('0xd'),_0x32e9cc,_0xe845('0xe'));logger[_0xe845('0xf')](_0xe845('0x10'),_0x32e9cc,'request\x20sent',JSON[_0xe845('0x11')](_0x566c7a));if(_0x566c7a[_0xe845('0x12')]){if(_0x566c7a['error'][_0xe845('0x13')]===0x1f4){logger['error'](_0xe845('0xd'),_0x32e9cc,_0x566c7a[_0xe845('0x12')][_0xe845('0x14')]);return _0xbd83bd(_0x566c7a[_0xe845('0x12')][_0xe845('0x14')]);}logger[_0xe845('0x12')](_0xe845('0xd'),_0x32e9cc,_0x566c7a[_0xe845('0x12')]['message']);return _0x2454d9(_0x566c7a[_0xe845('0x12')][_0xe845('0x14')]);}else{logger[_0xe845('0xc')](_0xe845('0xd'),_0x32e9cc,_0xe845('0xe'));_0x2454d9(_0x566c7a['result'][_0xe845('0x14')]);}})[_0xe845('0x15')](function(_0x13c0ac){logger[_0xe845('0x12')](_0xe845('0xd'),_0x32e9cc,_0x13c0ac);_0xbd83bd(_0x13c0ac);});});}exports[_0xe845('0x16')]=function(_0x31e922){var _0x205f0c=this;return new Promise(function(_0x1efa6c,_0x267b67){return db[_0xe845('0x17')][_0xe845('0x18')]({'raw':_0x31e922[_0xe845('0x19')]?_0x31e922[_0xe845('0x19')][_0xe845('0x1a')]===undefined?!![]:![]:!![],'where':_0x31e922[_0xe845('0x19')]?_0x31e922[_0xe845('0x19')][_0xe845('0x1b')]||null:null,'attributes':_0x31e922[_0xe845('0x19')]?_0x31e922['options'][_0xe845('0x1c')]||null:null,'limit':_0x31e922[_0xe845('0x19')]?_0x31e922[_0xe845('0x19')]['limit']||null:null,'include':_0x31e922[_0xe845('0x19')]?_0x31e922[_0xe845('0x19')]['include']?_[_0xe845('0x1d')](_0x31e922[_0xe845('0x19')][_0xe845('0x1e')],function(_0x4dc28b){return{'model':db[_0x4dc28b[_0xe845('0x1f')]],'as':_0x4dc28b['as'],'attributes':_0x4dc28b[_0xe845('0x1c')],'include':_0x4dc28b[_0xe845('0x1e')]?_[_0xe845('0x1d')](_0x4dc28b['include'],function(_0xc4511d){return{'model':db[_0xc4511d['model']],'as':_0xc4511d['as'],'attributes':_0xc4511d[_0xe845('0x1c')],'include':_0xc4511d[_0xe845('0x1e')]?_['map'](_0xc4511d[_0xe845('0x1e')],function(_0x606f08){return{'model':db[_0x606f08[_0xe845('0x1f')]],'as':_0x606f08['as'],'attributes':_0x606f08[_0xe845('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xe845('0xb')](function(_0x174643){logger[_0xe845('0xc')]('GetDeskAccount',_0x31e922);logger[_0xe845('0xf')](_0xe845('0x16'),_0x31e922,JSON[_0xe845('0x11')](_0x174643));_0x1efa6c(_0x174643);})[_0xe845('0x15')](function(_0x1d0669){logger[_0xe845('0x12')](_0xe845('0x16'),_0x1d0669[_0xe845('0x14')],_0x31e922);_0x267b67(_0x205f0c['error'](0x1f4,_0x1d0669['message']));});});};exports[_0xe845('0x20')]=function(_0x42578e){var _0x4f72df=this;return new Promise(function(_0x3c9140,_0x1f4ee3){return db['DeskAccount'][_0xe845('0x21')]({'raw':_0x42578e['options']?_0x42578e[_0xe845('0x19')][_0xe845('0x1a')]===undefined?!![]:![]:!![],'where':_0x42578e[_0xe845('0x19')]?_0x42578e[_0xe845('0x19')][_0xe845('0x1b')]||null:null,'attributes':_0x42578e[_0xe845('0x19')]?_0x42578e['options'][_0xe845('0x1c')]||null:null,'include':_0x42578e[_0xe845('0x19')]?_0x42578e[_0xe845('0x19')][_0xe845('0x1e')]?_[_0xe845('0x1d')](_0x42578e[_0xe845('0x19')][_0xe845('0x1e')],function(_0x26f5ee){return{'model':db[_0x26f5ee['model']],'as':_0x26f5ee['as'],'attributes':_0x26f5ee[_0xe845('0x1c')],'include':_0x26f5ee['include']?_[_0xe845('0x1d')](_0x26f5ee[_0xe845('0x1e')],function(_0x4e7f5c){return{'model':db[_0x4e7f5c[_0xe845('0x1f')]],'as':_0x4e7f5c['as'],'attributes':_0x4e7f5c[_0xe845('0x1c')],'include':_0x4e7f5c['include']?_[_0xe845('0x1d')](_0x4e7f5c['include'],function(_0x9c7408){return{'model':db[_0x9c7408[_0xe845('0x1f')]],'as':_0x9c7408['as'],'attributes':_0x9c7408['attributes']};}):[]};}):[]};}):[]:[]})[_0xe845('0xb')](function(_0xcece03){logger['info']('ShowDeskAccount',_0x42578e);logger[_0xe845('0xf')](_0xe845('0x20'),_0x42578e,JSON[_0xe845('0x11')](_0xcece03));_0x3c9140(_0xcece03);})['catch'](function(_0x4b26ee){logger['error'](_0xe845('0x20'),_0x4b26ee[_0xe845('0x14')],_0x42578e);_0x1f4ee3(_0x4f72df['error'](0x1f4,_0x4b26ee['message']));});});}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/index.js b/server/api/intDeskConfiguration/index.js index b218734..921219b 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 _0x9c44=['destroy','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./intDeskConfiguration.controller','isAuthenticated','index','get','/:id','/:id/fields','getFields','getSubjects','/:id/descriptions','/:id/tags','post','setTags','put','update'];(function(_0x2c5f2d,_0x10c2d0){var _0x367760=function(_0x24db49){while(--_0x24db49){_0x2c5f2d['push'](_0x2c5f2d['shift']());}};_0x367760(++_0x10c2d0);}(_0x9c44,0x178));var _0x49c4=function(_0x18ab2a,_0x4debcd){_0x18ab2a=_0x18ab2a-0x0;var _0x16dcee=_0x9c44[_0x18ab2a];return _0x16dcee;};'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');var controller=require(_0x49c4('0x6'));router['get']('/',auth[_0x49c4('0x7')](),controller[_0x49c4('0x8')]);router[_0x49c4('0x9')](_0x49c4('0xa'),auth[_0x49c4('0x7')](),controller['show']);router[_0x49c4('0x9')](_0x49c4('0xb'),auth[_0x49c4('0x7')](),controller[_0x49c4('0xc')]);router['get']('/:id/subjects',auth[_0x49c4('0x7')](),controller[_0x49c4('0xd')]);router['get'](_0x49c4('0xe'),auth[_0x49c4('0x7')](),controller['getDescriptions']);router['get'](_0x49c4('0xf'),auth[_0x49c4('0x7')](),controller['getTags']);router[_0x49c4('0x10')]('/',auth[_0x49c4('0x7')](),controller['create']);router[_0x49c4('0x10')](_0x49c4('0xf'),auth[_0x49c4('0x7')](),controller[_0x49c4('0x11')]);router[_0x49c4('0x12')](_0x49c4('0xa'),auth[_0x49c4('0x7')](),controller[_0x49c4('0x13')]);router['delete'](_0x49c4('0xa'),auth[_0x49c4('0x7')](),controller[_0x49c4('0x14')]);module[_0x49c4('0x15')]=router; \ No newline at end of file +var _0xedd9=['getTags','post','create','setTags','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intDeskConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getSubjects','/:id/descriptions','/:id/tags'];(function(_0x295bad,_0xe95240){var _0x56bb3d=function(_0x572a36){while(--_0x572a36){_0x295bad['push'](_0x295bad['shift']());}};_0x56bb3d(++_0xe95240);}(_0xedd9,0xfc));var _0x9edd=function(_0x39c302,_0x452cd1){_0x39c302=_0x39c302-0x0;var _0x53f444=_0xedd9[_0x39c302];return _0x53f444;};'use strict';var multer=require('multer');var util=require(_0x9edd('0x0'));var path=require(_0x9edd('0x1'));var timeout=require(_0x9edd('0x2'));var express=require(_0x9edd('0x3'));var router=express[_0x9edd('0x4')]();var fs_extra=require(_0x9edd('0x5'));var auth=require(_0x9edd('0x6'));var interaction=require(_0x9edd('0x7'));var config=require('../../config/environment');var controller=require(_0x9edd('0x8'));router[_0x9edd('0x9')]('/',auth[_0x9edd('0xa')](),controller[_0x9edd('0xb')]);router['get'](_0x9edd('0xc'),auth['isAuthenticated'](),controller[_0x9edd('0xd')]);router[_0x9edd('0x9')](_0x9edd('0xe'),auth[_0x9edd('0xa')](),controller['getFields']);router[_0x9edd('0x9')]('/:id/subjects',auth[_0x9edd('0xa')](),controller[_0x9edd('0xf')]);router['get'](_0x9edd('0x10'),auth[_0x9edd('0xa')](),controller['getDescriptions']);router[_0x9edd('0x9')](_0x9edd('0x11'),auth[_0x9edd('0xa')](),controller[_0x9edd('0x12')]);router[_0x9edd('0x13')]('/',auth[_0x9edd('0xa')](),controller[_0x9edd('0x14')]);router[_0x9edd('0x13')]('/:id/tags',auth[_0x9edd('0xa')](),controller[_0x9edd('0x15')]);router[_0x9edd('0x16')](_0x9edd('0xc'),auth[_0x9edd('0xa')](),controller[_0x9edd('0x17')]);router[_0x9edd('0x18')](_0x9edd('0xc'),auth['isAuthenticated'](),controller[_0x9edd('0x19')]);module[_0x9edd('0x1a')]=router; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js b/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js index 613a9e2..fe44ef6 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 _0x00fb=['STRING'];(function(_0x13755a,_0x2a6a1b){var _0x40003e=function(_0xfdd49b){while(--_0xfdd49b){_0x13755a['push'](_0x13755a['shift']());}};_0x40003e(++_0x2a6a1b);}(_0x00fb,0x117));var _0xb00f=function(_0x873c6b,_0x4e9a60){_0x873c6b=_0x873c6b-0x0;var _0x2da337=_0x00fb[_0x873c6b];return _0x2da337;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xb00f('0x0')]}}; \ No newline at end of file +var _0x3e81=['sequelize'];(function(_0x16c4df,_0x41b5ca){var _0x4ccd2f=function(_0x43e715){while(--_0x43e715){_0x16c4df['push'](_0x16c4df['shift']());}};_0x4ccd2f(++_0x41b5ca);}(_0x3e81,0x126));var _0x13e8=function(_0x47c418,_0x1e3182){_0x47c418=_0x47c418-0x0;var _0x83159=_0x3e81[_0x47c418];return _0x83159;};'use strict';var Sequelize=require(_0x13e8('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.controller.js b/server/api/intDeskConfiguration/intDeskConfiguration.controller.js index 080202c..801b800 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 _0x16a8=['request-promise','bluebird','mustache','path','sox','ejs','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','destroy','then','error','stack','name','send','index','map','DeskConfiguration','rawAttributes','fieldName','type','query','keys','intersection','attributes','fields','model','hasOwnProperty','sort','filters','pick','filter','merge','where','VIRTUAL','include','rows','show','params','includeAll','options','find','create','body','catch','update','getFields','findOne','order','nolimit','getSubjects','DeskField','length','getDescriptions','getTags','Tag','setTags','ids','eml-format','rimraf','zip-dir'];(function(_0x584b9d,_0x1cb5c5){var _0x172053=function(_0x5036ec){while(--_0x5036ec){_0x584b9d['push'](_0x584b9d['shift']());}};_0x172053(++_0x1cb5c5);}(_0x16a8,0xa5));var _0x816a=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x16a8[_0x3b380d];return _0x54502b;};'use strict';var emlformat=require(_0x816a('0x0'));var rimraf=require(_0x816a('0x1'));var zipdir=require(_0x816a('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x816a('0x3'));var moment=require('moment');var BPromise=require(_0x816a('0x4'));var Mustache=require(_0x816a('0x5'));var util=require('util');var path=require(_0x816a('0x6'));var sox=require(_0x816a('0x7'));var csv=require('to-csv');var ejs=require(_0x816a('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0x816a('0x9'));var jsforce=require(_0x816a('0xa'));var deskjs=require('desk.js');var toCsv=require(_0x816a('0xb'));var querystring=require(_0x816a('0xc'));var Papa=require(_0x816a('0xd'));var Redis=require(_0x816a('0xe'));var authService=require(_0x816a('0xf'));var qs=require(_0x816a('0x10'));var as=require(_0x816a('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x816a('0x12'))(_0x816a('0x13'));var utils=require(_0x816a('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x816a('0x15'));var db=require(_0x816a('0x16'))['db'];function respondWithStatusCode(_0x5d5c6d,_0x485cf9){_0x485cf9=_0x485cf9||0xcc;return function(_0xddd554){if(_0xddd554){return _0x5d5c6d[_0x816a('0x17')](_0x485cf9);}return _0x5d5c6d[_0x816a('0x18')](_0x485cf9)[_0x816a('0x19')]();};}function respondWithResult(_0x2b04d2,_0x34bda6){_0x34bda6=_0x34bda6||0xc8;return function(_0x41f943){if(_0x41f943){return _0x2b04d2[_0x816a('0x18')](_0x34bda6)[_0x816a('0x1a')](_0x41f943);}};}function respondWithFilteredResult(_0x3d012b,_0x6ed84e){return function(_0x1c4a78){if(_0x1c4a78){var _0x40f94b=typeof _0x6ed84e[_0x816a('0x1b')]===_0x816a('0x1c')&&typeof _0x6ed84e[_0x816a('0x1d')]===_0x816a('0x1c');var _0x5f1c38=_0x1c4a78['count'];var _0x28afd4=_0x40f94b?0x0:_0x6ed84e[_0x816a('0x1b')];var _0x81162f=_0x40f94b?_0x1c4a78[_0x816a('0x1e')]:_0x6ed84e[_0x816a('0x1b')]+_0x6ed84e[_0x816a('0x1d')];var _0x27b62a;if(_0x81162f>=_0x5f1c38){_0x81162f=_0x5f1c38;_0x27b62a=0xc8;}else{_0x27b62a=0xce;}_0x3d012b[_0x816a('0x18')](_0x27b62a);return _0x3d012b[_0x816a('0x1f')](_0x816a('0x20'),_0x28afd4+'-'+_0x81162f+'/'+_0x5f1c38)[_0x816a('0x1a')](_0x1c4a78);}return null;};}function patchUpdates(_0x159c00){return function(_0x11cf96){try{jsonpatch['apply'](_0x11cf96,_0x159c00,!![]);}catch(_0x1e092b){return BPromise[_0x816a('0x21')](_0x1e092b);}return _0x11cf96[_0x816a('0x22')]();};}function saveUpdates(_0x5731f8,_0x2d926c){return function(_0x56c858){if(_0x56c858){return _0x56c858['update'](_0x5731f8)['then'](function(_0xbcfa02){return _0xbcfa02;});}return null;};}function removeEntity(_0x398e4c,_0x4f2fe7){return function(_0x2087ff){if(_0x2087ff){return _0x2087ff[_0x816a('0x23')]()[_0x816a('0x24')](function(){_0x398e4c['status'](0xcc)[_0x816a('0x19')]();});}};}function handleEntityNotFound(_0x465412,_0x80c28){return function(_0x4429f5){if(!_0x4429f5){_0x465412[_0x816a('0x17')](0x194);}return _0x4429f5;};}function handleError(_0x238b9b,_0x8b846b){_0x8b846b=_0x8b846b||0x1f4;return function(_0xcc7780){logger[_0x816a('0x25')](_0xcc7780[_0x816a('0x26')]);if(_0xcc7780[_0x816a('0x27')]){delete _0xcc7780['name'];}_0x238b9b['status'](_0x8b846b)[_0x816a('0x28')](_0xcc7780);};}exports[_0x816a('0x29')]=function(_0xc631f4,_0x82ee63){var _0x171742={},_0x507665={},_0x191a69={'count':0x0,'rows':[]};var _0x16cf4d=_[_0x816a('0x2a')](db[_0x816a('0x2b')][_0x816a('0x2c')],function(_0x7236da){return{'name':_0x7236da[_0x816a('0x2d')],'type':_0x7236da[_0x816a('0x2e')]['key']};});_0x507665['model']=_['map'](_0x16cf4d,_0x816a('0x27'));_0x507665[_0x816a('0x2f')]=_[_0x816a('0x30')](_0xc631f4['query']);_0x507665['filters']=_[_0x816a('0x31')](_0x507665['model'],_0x507665[_0x816a('0x2f')]);_0x171742[_0x816a('0x32')]=_[_0x816a('0x31')](_0x507665['model'],qs[_0x816a('0x33')](_0xc631f4[_0x816a('0x2f')][_0x816a('0x33')]));_0x171742[_0x816a('0x32')]=_0x171742['attributes']['length']?_0x171742[_0x816a('0x32')]:_0x507665[_0x816a('0x34')];if(!_0xc631f4[_0x816a('0x2f')][_0x816a('0x35')]('nolimit')){_0x171742[_0x816a('0x1d')]=qs['limit'](_0xc631f4[_0x816a('0x2f')][_0x816a('0x1d')]);_0x171742[_0x816a('0x1b')]=qs['offset'](_0xc631f4[_0x816a('0x2f')][_0x816a('0x1b')]);}_0x171742['order']=qs[_0x816a('0x36')](_0xc631f4[_0x816a('0x2f')][_0x816a('0x36')]);_0x171742['where']=qs[_0x816a('0x37')](_[_0x816a('0x38')](_0xc631f4[_0x816a('0x2f')],_0x507665[_0x816a('0x37')]),_0x16cf4d);if(_0xc631f4[_0x816a('0x2f')][_0x816a('0x39')]){_0x171742['where']=_[_0x816a('0x3a')](_0x171742[_0x816a('0x3b')],{'$or':_[_0x816a('0x2a')](_0x16cf4d,function(_0x3fba4e){if(_0x3fba4e[_0x816a('0x2e')]!==_0x816a('0x3c')){var _0x2779e1={};_0x2779e1[_0x3fba4e[_0x816a('0x27')]]={'$like':'%'+_0xc631f4[_0x816a('0x2f')]['filter']+'%'};return _0x2779e1;}})});}_0x171742=_[_0x816a('0x3a')]({},_0x171742,_0xc631f4['options']);var _0x105846={'where':_0x171742[_0x816a('0x3b')]};return db[_0x816a('0x2b')][_0x816a('0x1e')](_0x105846)[_0x816a('0x24')](function(_0x159100){_0x191a69[_0x816a('0x1e')]=_0x159100;if(_0xc631f4['query']['includeAll']){_0x171742[_0x816a('0x3d')]=[{'all':!![]}];}return db[_0x816a('0x2b')]['findAll'](_0x171742);})[_0x816a('0x24')](function(_0x2eba78){_0x191a69[_0x816a('0x3e')]=_0x2eba78;return _0x191a69;})[_0x816a('0x24')](respondWithFilteredResult(_0x82ee63,_0x171742))['catch'](handleError(_0x82ee63,null));};exports[_0x816a('0x3f')]=function(_0x499c67,_0xa1f024){var _0x39a5a5={'raw':![],'where':{'id':_0x499c67[_0x816a('0x40')]['id']}},_0x55f5e4={};_0x55f5e4[_0x816a('0x34')]=_['keys'](db['DeskConfiguration'][_0x816a('0x2c')]);_0x55f5e4[_0x816a('0x2f')]=_[_0x816a('0x30')](_0x499c67[_0x816a('0x2f')]);_0x55f5e4[_0x816a('0x37')]=_['intersection'](_0x55f5e4[_0x816a('0x34')],_0x55f5e4[_0x816a('0x2f')]);_0x39a5a5['attributes']=_[_0x816a('0x31')](_0x55f5e4[_0x816a('0x34')],qs[_0x816a('0x33')](_0x499c67[_0x816a('0x2f')]['fields']));_0x39a5a5[_0x816a('0x32')]=_0x39a5a5[_0x816a('0x32')]['length']?_0x39a5a5['attributes']:_0x55f5e4[_0x816a('0x34')];if(_0x499c67[_0x816a('0x2f')][_0x816a('0x41')]){_0x39a5a5[_0x816a('0x3d')]=[{'all':!![]}];}_0x39a5a5=_[_0x816a('0x3a')]({},_0x39a5a5,_0x499c67[_0x816a('0x42')]);return db['DeskConfiguration'][_0x816a('0x43')](_0x39a5a5)['then'](handleEntityNotFound(_0xa1f024,null))[_0x816a('0x24')](respondWithResult(_0xa1f024,null))['catch'](handleError(_0xa1f024,null));};exports[_0x816a('0x44')]=function(_0x3c8d20,_0x5c355f){return db[_0x816a('0x2b')][_0x816a('0x44')](_0x3c8d20[_0x816a('0x45')],{})[_0x816a('0x24')](respondWithResult(_0x5c355f,0xc9))[_0x816a('0x46')](handleError(_0x5c355f,null));};exports[_0x816a('0x47')]=function(_0x4de6eb,_0x47eba8){if(_0x4de6eb['body']['id']){delete _0x4de6eb[_0x816a('0x45')]['id'];}return db[_0x816a('0x2b')][_0x816a('0x43')]({'where':{'id':_0x4de6eb[_0x816a('0x40')]['id']}})[_0x816a('0x24')](handleEntityNotFound(_0x47eba8,null))[_0x816a('0x24')](saveUpdates(_0x4de6eb[_0x816a('0x45')],null))[_0x816a('0x24')](respondWithResult(_0x47eba8,null))[_0x816a('0x46')](handleError(_0x47eba8,null));};exports['destroy']=function(_0x48783d,_0x482c9c){return db[_0x816a('0x2b')][_0x816a('0x43')]({'where':{'id':_0x48783d['params']['id']}})[_0x816a('0x24')](handleEntityNotFound(_0x482c9c,null))[_0x816a('0x24')](removeEntity(_0x482c9c,null))[_0x816a('0x46')](handleError(_0x482c9c,null));};exports[_0x816a('0x48')]=function(_0x48178d,_0x5348bc,_0x5d32af){var _0x506ef1={};var _0x5d85c8={};var _0x56931b;var _0x38fe02;return db[_0x816a('0x2b')][_0x816a('0x49')]({'where':{'id':_0x48178d[_0x816a('0x40')]['id']}})[_0x816a('0x24')](handleEntityNotFound(_0x5348bc,null))[_0x816a('0x24')](function(_0x3cd250){if(_0x3cd250){_0x56931b=_0x3cd250;_0x5d85c8[_0x816a('0x34')]=_['keys'](db['DeskField'][_0x816a('0x2c')]);_0x5d85c8['query']=_[_0x816a('0x30')](_0x48178d[_0x816a('0x2f')]);_0x5d85c8['filters']=_[_0x816a('0x31')](_0x5d85c8[_0x816a('0x34')],_0x5d85c8[_0x816a('0x2f')]);_0x506ef1['attributes']=_[_0x816a('0x31')](_0x5d85c8[_0x816a('0x34')],qs[_0x816a('0x33')](_0x48178d['query'][_0x816a('0x33')]));_0x506ef1['attributes']=_0x506ef1[_0x816a('0x32')]['length']?_0x506ef1['attributes']:_0x5d85c8[_0x816a('0x34')];_0x506ef1[_0x816a('0x4a')]=qs[_0x816a('0x36')](_0x48178d['query']['sort']);_0x506ef1[_0x816a('0x3b')]=qs['filters'](_[_0x816a('0x38')](_0x48178d['query'],_0x5d85c8[_0x816a('0x37')]));if(_0x48178d[_0x816a('0x2f')][_0x816a('0x39')]){_0x506ef1['where']=_[_0x816a('0x3a')](_0x506ef1[_0x816a('0x3b')],{'$or':_['map'](_0x506ef1[_0x816a('0x32')],function(_0x3b479a){var _0x371971={};_0x371971[_0x3b479a]={'$like':'%'+_0x48178d['query'][_0x816a('0x39')]+'%'};return _0x371971;})});}_0x506ef1=_[_0x816a('0x3a')]({},_0x506ef1,_0x48178d[_0x816a('0x42')]);return _0x56931b[_0x816a('0x48')](_0x506ef1);}})[_0x816a('0x24')](function(_0x2e2016){if(_0x2e2016){_0x38fe02=_0x2e2016['length'];if(!_0x48178d['query'][_0x816a('0x35')](_0x816a('0x4b'))){_0x506ef1[_0x816a('0x1d')]=qs[_0x816a('0x1d')](_0x48178d['query']['limit']);_0x506ef1['offset']=qs['offset'](_0x48178d[_0x816a('0x2f')][_0x816a('0x1b')]);}return _0x56931b[_0x816a('0x48')](_0x506ef1);}})['then'](function(_0x5c9b37){if(_0x5c9b37){return _0x5c9b37?{'count':_0x38fe02,'rows':_0x5c9b37}:null;}})['then'](respondWithResult(_0x5348bc,null))[_0x816a('0x46')](handleError(_0x5348bc,null));};exports[_0x816a('0x4c')]=function(_0x419028,_0x311cdd,_0x4b9883){var _0x22d746={};var _0x5a2b44={};var _0x5375b8;var _0x16cff5;return db[_0x816a('0x2b')][_0x816a('0x49')]({'where':{'id':_0x419028['params']['id']}})[_0x816a('0x24')](handleEntityNotFound(_0x311cdd,null))[_0x816a('0x24')](function(_0x52c642){if(_0x52c642){_0x5375b8=_0x52c642;_0x5a2b44['model']=_[_0x816a('0x30')](db[_0x816a('0x4d')][_0x816a('0x2c')]);_0x5a2b44['query']=_[_0x816a('0x30')](_0x419028['query']);_0x5a2b44[_0x816a('0x37')]=_[_0x816a('0x31')](_0x5a2b44[_0x816a('0x34')],_0x5a2b44['query']);_0x22d746[_0x816a('0x32')]=_[_0x816a('0x31')](_0x5a2b44['model'],qs[_0x816a('0x33')](_0x419028['query'][_0x816a('0x33')]));_0x22d746[_0x816a('0x32')]=_0x22d746['attributes']['length']?_0x22d746[_0x816a('0x32')]:_0x5a2b44['model'];_0x22d746[_0x816a('0x4a')]=qs['sort'](_0x419028[_0x816a('0x2f')][_0x816a('0x36')]);_0x22d746[_0x816a('0x3b')]=qs['filters'](_['pick'](_0x419028[_0x816a('0x2f')],_0x5a2b44[_0x816a('0x37')]));if(_0x419028[_0x816a('0x2f')][_0x816a('0x39')]){_0x22d746[_0x816a('0x3b')]=_[_0x816a('0x3a')](_0x22d746[_0x816a('0x3b')],{'$or':_[_0x816a('0x2a')](_0x22d746[_0x816a('0x32')],function(_0x2392c4){var _0x5a0f12={};_0x5a0f12[_0x2392c4]={'$like':'%'+_0x419028[_0x816a('0x2f')][_0x816a('0x39')]+'%'};return _0x5a0f12;})});}_0x22d746=_[_0x816a('0x3a')]({},_0x22d746,_0x419028[_0x816a('0x42')]);return _0x5375b8[_0x816a('0x4c')](_0x22d746);}})[_0x816a('0x24')](function(_0x2fa341){if(_0x2fa341){_0x16cff5=_0x2fa341[_0x816a('0x4e')];if(!_0x419028[_0x816a('0x2f')][_0x816a('0x35')](_0x816a('0x4b'))){_0x22d746[_0x816a('0x1d')]=qs[_0x816a('0x1d')](_0x419028[_0x816a('0x2f')][_0x816a('0x1d')]);_0x22d746[_0x816a('0x1b')]=qs[_0x816a('0x1b')](_0x419028[_0x816a('0x2f')][_0x816a('0x1b')]);}return _0x5375b8[_0x816a('0x4c')](_0x22d746);}})[_0x816a('0x24')](function(_0x5f1b23){if(_0x5f1b23){return _0x5f1b23?{'count':_0x16cff5,'rows':_0x5f1b23}:null;}})[_0x816a('0x24')](respondWithResult(_0x311cdd,null))[_0x816a('0x46')](handleError(_0x311cdd,null));};exports[_0x816a('0x4f')]=function(_0x31d75d,_0x52e516,_0x532055){var _0x57504f={};var _0x595a18={};var _0x46a08d;var _0x56db27;return db['DeskConfiguration'][_0x816a('0x49')]({'where':{'id':_0x31d75d[_0x816a('0x40')]['id']}})['then'](handleEntityNotFound(_0x52e516,null))[_0x816a('0x24')](function(_0x454b4e){if(_0x454b4e){_0x46a08d=_0x454b4e;_0x595a18[_0x816a('0x34')]=_[_0x816a('0x30')](db[_0x816a('0x4d')][_0x816a('0x2c')]);_0x595a18['query']=_[_0x816a('0x30')](_0x31d75d[_0x816a('0x2f')]);_0x595a18[_0x816a('0x37')]=_[_0x816a('0x31')](_0x595a18[_0x816a('0x34')],_0x595a18[_0x816a('0x2f')]);_0x57504f[_0x816a('0x32')]=_[_0x816a('0x31')](_0x595a18[_0x816a('0x34')],qs[_0x816a('0x33')](_0x31d75d[_0x816a('0x2f')][_0x816a('0x33')]));_0x57504f[_0x816a('0x32')]=_0x57504f[_0x816a('0x32')]['length']?_0x57504f[_0x816a('0x32')]:_0x595a18[_0x816a('0x34')];_0x57504f[_0x816a('0x4a')]=qs['sort'](_0x31d75d[_0x816a('0x2f')][_0x816a('0x36')]);_0x57504f[_0x816a('0x3b')]=qs[_0x816a('0x37')](_[_0x816a('0x38')](_0x31d75d['query'],_0x595a18[_0x816a('0x37')]));if(_0x31d75d[_0x816a('0x2f')][_0x816a('0x39')]){_0x57504f[_0x816a('0x3b')]=_['merge'](_0x57504f[_0x816a('0x3b')],{'$or':_[_0x816a('0x2a')](_0x57504f[_0x816a('0x32')],function(_0x2b0cb8){var _0x4ca15a={};_0x4ca15a[_0x2b0cb8]={'$like':'%'+_0x31d75d[_0x816a('0x2f')][_0x816a('0x39')]+'%'};return _0x4ca15a;})});}_0x57504f=_[_0x816a('0x3a')]({},_0x57504f,_0x31d75d['options']);return _0x46a08d[_0x816a('0x4f')](_0x57504f);}})['then'](function(_0x1e3ca2){if(_0x1e3ca2){_0x56db27=_0x1e3ca2['length'];if(!_0x31d75d[_0x816a('0x2f')][_0x816a('0x35')](_0x816a('0x4b'))){_0x57504f[_0x816a('0x1d')]=qs['limit'](_0x31d75d[_0x816a('0x2f')][_0x816a('0x1d')]);_0x57504f[_0x816a('0x1b')]=qs[_0x816a('0x1b')](_0x31d75d[_0x816a('0x2f')][_0x816a('0x1b')]);}return _0x46a08d[_0x816a('0x4f')](_0x57504f);}})[_0x816a('0x24')](function(_0x24f841){if(_0x24f841){return _0x24f841?{'count':_0x56db27,'rows':_0x24f841}:null;}})[_0x816a('0x24')](respondWithResult(_0x52e516,null))[_0x816a('0x46')](handleError(_0x52e516,null));};exports[_0x816a('0x50')]=function(_0x1c0d55,_0x469167,_0x48d8a3){var _0x39ee07={};var _0xd42a10={};var _0x1c4936;var _0x260174;return db[_0x816a('0x2b')]['findOne']({'where':{'id':_0x1c0d55[_0x816a('0x40')]['id']}})[_0x816a('0x24')](handleEntityNotFound(_0x469167,null))['then'](function(_0x6bcc01){if(_0x6bcc01){_0x1c4936=_0x6bcc01;_0xd42a10[_0x816a('0x34')]=_[_0x816a('0x30')](db[_0x816a('0x51')][_0x816a('0x2c')]);_0xd42a10[_0x816a('0x2f')]=_[_0x816a('0x30')](_0x1c0d55[_0x816a('0x2f')]);_0xd42a10[_0x816a('0x37')]=_[_0x816a('0x31')](_0xd42a10['model'],_0xd42a10[_0x816a('0x2f')]);_0x39ee07['attributes']=_[_0x816a('0x31')](_0xd42a10['model'],qs[_0x816a('0x33')](_0x1c0d55['query'][_0x816a('0x33')]));_0x39ee07[_0x816a('0x32')]=_0x39ee07[_0x816a('0x32')]['length']?_0x39ee07['attributes']:_0xd42a10[_0x816a('0x34')];_0x39ee07[_0x816a('0x4a')]=qs[_0x816a('0x36')](_0x1c0d55[_0x816a('0x2f')][_0x816a('0x36')]);_0x39ee07[_0x816a('0x3b')]=qs[_0x816a('0x37')](_[_0x816a('0x38')](_0x1c0d55[_0x816a('0x2f')],_0xd42a10[_0x816a('0x37')]));if(_0x1c0d55[_0x816a('0x2f')]['filter']){_0x39ee07[_0x816a('0x3b')]=_[_0x816a('0x3a')](_0x39ee07[_0x816a('0x3b')],{'$or':_[_0x816a('0x2a')](_0x39ee07[_0x816a('0x32')],function(_0x23fa0b){var _0x39a174={};_0x39a174[_0x23fa0b]={'$like':'%'+_0x1c0d55[_0x816a('0x2f')][_0x816a('0x39')]+'%'};return _0x39a174;})});}_0x39ee07=_[_0x816a('0x3a')]({},_0x39ee07,_0x1c0d55[_0x816a('0x42')]);return _0x1c4936['getTags'](_0x39ee07);}})['then'](function(_0xbbedda){if(_0xbbedda){_0x260174=_0xbbedda[_0x816a('0x4e')];if(!_0x1c0d55['query'][_0x816a('0x35')]('nolimit')){_0x39ee07[_0x816a('0x1d')]=qs['limit'](_0x1c0d55[_0x816a('0x2f')][_0x816a('0x1d')]);_0x39ee07['offset']=qs[_0x816a('0x1b')](_0x1c0d55[_0x816a('0x2f')][_0x816a('0x1b')]);}return _0x1c4936['getTags'](_0x39ee07);}})[_0x816a('0x24')](function(_0x50658c){if(_0x50658c){return _0x50658c?{'count':_0x260174,'rows':_0x50658c}:null;}})[_0x816a('0x24')](respondWithResult(_0x469167,null))['catch'](handleError(_0x469167,null));};exports['setTags']=function(_0x269f61,_0x1ebb92,_0x5e8d02){if(_0x269f61['body']['id']){delete _0x269f61[_0x816a('0x45')]['id'];}return db[_0x816a('0x2b')][_0x816a('0x49')]({'where':{'id':_0x269f61[_0x816a('0x40')]['id']}})['then'](handleEntityNotFound(_0x1ebb92,null))[_0x816a('0x24')](function(_0x4e353a){if(_0x4e353a){return _0x4e353a[_0x816a('0x52')](_0x269f61['body'][_0x816a('0x53')]||[]);}return null;})[_0x816a('0x24')](respondWithResult(_0x1ebb92,null))[_0x816a('0x46')](handleError(_0x1ebb92,null));}; \ No newline at end of file +var _0xd583=['options','then','includeAll','include','DeskConfiguration','findAll','rows','catch','show','params','find','create','body','destroy','getFields','findOne','DeskField','getSubjects','nolimit','getDescriptions','getTags','ids','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','save','update','error','stack','name','send','index','rawAttributes','type','key','map','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','pick','filter','where','VIRTUAL','merge'];(function(_0x46698a,_0x8de1e4){var _0x356db0=function(_0x19e83c){while(--_0x19e83c){_0x46698a['push'](_0x46698a['shift']());}};_0x356db0(++_0x8de1e4);}(_0xd583,0x10f));var _0x3d58=function(_0x493720,_0x2e7724){_0x493720=_0x493720-0x0;var _0x3cfc8e=_0xd583[_0x493720];return _0x3cfc8e;};'use strict';var emlformat=require(_0x3d58('0x0'));var rimraf=require(_0x3d58('0x1'));var zipdir=require(_0x3d58('0x2'));var jsonpatch=require(_0x3d58('0x3'));var rp=require(_0x3d58('0x4'));var moment=require(_0x3d58('0x5'));var BPromise=require(_0x3d58('0x6'));var Mustache=require(_0x3d58('0x7'));var util=require(_0x3d58('0x8'));var path=require(_0x3d58('0x9'));var sox=require('sox');var csv=require(_0x3d58('0xa'));var ejs=require(_0x3d58('0xb'));var fs=require('fs');var fs_extra=require(_0x3d58('0xc'));var _=require(_0x3d58('0xd'));var squel=require('squel');var crypto=require(_0x3d58('0xe'));var jsforce=require(_0x3d58('0xf'));var deskjs=require(_0x3d58('0x10'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x3d58('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x3d58('0x12'));var hardwareService=require(_0x3d58('0x13'));var logger=require(_0x3d58('0x14'))(_0x3d58('0x15'));var utils=require('../../config/utils');var config=require(_0x3d58('0x16'));var licenseUtil=require(_0x3d58('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x27a264,_0x2299c0){_0x2299c0=_0x2299c0||0xcc;return function(_0x4f1114){if(_0x4f1114){return _0x27a264[_0x3d58('0x18')](_0x2299c0);}return _0x27a264[_0x3d58('0x19')](_0x2299c0)[_0x3d58('0x1a')]();};}function respondWithResult(_0x5060b7,_0x825062){_0x825062=_0x825062||0xc8;return function(_0x196b1d){if(_0x196b1d){return _0x5060b7['status'](_0x825062)[_0x3d58('0x1b')](_0x196b1d);}};}function respondWithFilteredResult(_0x1b6045,_0x39a7a8){return function(_0x2195ae){if(_0x2195ae){var _0x204a22=typeof _0x39a7a8['offset']===_0x3d58('0x1c')&&typeof _0x39a7a8[_0x3d58('0x1d')]==='undefined';var _0x458b95=_0x2195ae[_0x3d58('0x1e')];var _0x473e0f=_0x204a22?0x0:_0x39a7a8[_0x3d58('0x1f')];var _0x2d16ee=_0x204a22?_0x2195ae[_0x3d58('0x1e')]:_0x39a7a8[_0x3d58('0x1f')]+_0x39a7a8[_0x3d58('0x1d')];var _0xade50b;if(_0x2d16ee>=_0x458b95){_0x2d16ee=_0x458b95;_0xade50b=0xc8;}else{_0xade50b=0xce;}_0x1b6045[_0x3d58('0x19')](_0xade50b);return _0x1b6045[_0x3d58('0x20')](_0x3d58('0x21'),_0x473e0f+'-'+_0x2d16ee+'/'+_0x458b95)[_0x3d58('0x1b')](_0x2195ae);}return null;};}function patchUpdates(_0xb605b0){return function(_0x287a83){try{jsonpatch['apply'](_0x287a83,_0xb605b0,!![]);}catch(_0x5cfd5a){return BPromise['reject'](_0x5cfd5a);}return _0x287a83[_0x3d58('0x22')]();};}function saveUpdates(_0xecfa89,_0x3f7e7b){return function(_0x1c54ff){if(_0x1c54ff){return _0x1c54ff[_0x3d58('0x23')](_0xecfa89)['then'](function(_0x3598cf){return _0x3598cf;});}return null;};}function removeEntity(_0x286732,_0x3c886c){return function(_0x5ecb81){if(_0x5ecb81){return _0x5ecb81['destroy']()['then'](function(){_0x286732[_0x3d58('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2c3c13,_0x3fe470){return function(_0x26b75c){if(!_0x26b75c){_0x2c3c13['sendStatus'](0x194);}return _0x26b75c;};}function handleError(_0x21160f,_0x3d9506){_0x3d9506=_0x3d9506||0x1f4;return function(_0x26d63e){logger[_0x3d58('0x24')](_0x26d63e[_0x3d58('0x25')]);if(_0x26d63e[_0x3d58('0x26')]){delete _0x26d63e['name'];}_0x21160f['status'](_0x3d9506)[_0x3d58('0x27')](_0x26d63e);};}exports[_0x3d58('0x28')]=function(_0x3569e0,_0x1b37e7){var _0x4f933c={},_0x3cb915={},_0xbac466={'count':0x0,'rows':[]};var _0x34affd=_['map'](db['DeskConfiguration'][_0x3d58('0x29')],function(_0x205d1f){return{'name':_0x205d1f['fieldName'],'type':_0x205d1f[_0x3d58('0x2a')][_0x3d58('0x2b')]};});_0x3cb915['model']=_[_0x3d58('0x2c')](_0x34affd,_0x3d58('0x26'));_0x3cb915[_0x3d58('0x2d')]=_[_0x3d58('0x2e')](_0x3569e0[_0x3d58('0x2d')]);_0x3cb915[_0x3d58('0x2f')]=_[_0x3d58('0x30')](_0x3cb915[_0x3d58('0x31')],_0x3cb915[_0x3d58('0x2d')]);_0x4f933c[_0x3d58('0x32')]=_[_0x3d58('0x30')](_0x3cb915[_0x3d58('0x31')],qs[_0x3d58('0x33')](_0x3569e0['query'][_0x3d58('0x33')]));_0x4f933c['attributes']=_0x4f933c[_0x3d58('0x32')][_0x3d58('0x34')]?_0x4f933c[_0x3d58('0x32')]:_0x3cb915[_0x3d58('0x31')];if(!_0x3569e0['query'][_0x3d58('0x35')]('nolimit')){_0x4f933c[_0x3d58('0x1d')]=qs[_0x3d58('0x1d')](_0x3569e0[_0x3d58('0x2d')]['limit']);_0x4f933c[_0x3d58('0x1f')]=qs[_0x3d58('0x1f')](_0x3569e0[_0x3d58('0x2d')]['offset']);}_0x4f933c[_0x3d58('0x36')]=qs['sort'](_0x3569e0[_0x3d58('0x2d')][_0x3d58('0x37')]);_0x4f933c['where']=qs[_0x3d58('0x2f')](_[_0x3d58('0x38')](_0x3569e0['query'],_0x3cb915[_0x3d58('0x2f')]),_0x34affd);if(_0x3569e0[_0x3d58('0x2d')][_0x3d58('0x39')]){_0x4f933c[_0x3d58('0x3a')]=_['merge'](_0x4f933c[_0x3d58('0x3a')],{'$or':_[_0x3d58('0x2c')](_0x34affd,function(_0x1e9096){if(_0x1e9096[_0x3d58('0x2a')]!==_0x3d58('0x3b')){var _0x50bc1a={};_0x50bc1a[_0x1e9096[_0x3d58('0x26')]]={'$like':'%'+_0x3569e0['query'][_0x3d58('0x39')]+'%'};return _0x50bc1a;}})});}_0x4f933c=_[_0x3d58('0x3c')]({},_0x4f933c,_0x3569e0[_0x3d58('0x3d')]);var _0x209bcc={'where':_0x4f933c[_0x3d58('0x3a')]};return db['DeskConfiguration'][_0x3d58('0x1e')](_0x209bcc)[_0x3d58('0x3e')](function(_0x256c05){_0xbac466[_0x3d58('0x1e')]=_0x256c05;if(_0x3569e0[_0x3d58('0x2d')][_0x3d58('0x3f')]){_0x4f933c[_0x3d58('0x40')]=[{'all':!![]}];}return db[_0x3d58('0x41')][_0x3d58('0x42')](_0x4f933c);})['then'](function(_0x15cd48){_0xbac466[_0x3d58('0x43')]=_0x15cd48;return _0xbac466;})[_0x3d58('0x3e')](respondWithFilteredResult(_0x1b37e7,_0x4f933c))[_0x3d58('0x44')](handleError(_0x1b37e7,null));};exports[_0x3d58('0x45')]=function(_0x218ddd,_0x3f2138){var _0xc463d={'raw':![],'where':{'id':_0x218ddd[_0x3d58('0x46')]['id']}},_0x52a099={};_0x52a099[_0x3d58('0x31')]=_[_0x3d58('0x2e')](db[_0x3d58('0x41')][_0x3d58('0x29')]);_0x52a099[_0x3d58('0x2d')]=_[_0x3d58('0x2e')](_0x218ddd[_0x3d58('0x2d')]);_0x52a099[_0x3d58('0x2f')]=_[_0x3d58('0x30')](_0x52a099[_0x3d58('0x31')],_0x52a099['query']);_0xc463d[_0x3d58('0x32')]=_[_0x3d58('0x30')](_0x52a099[_0x3d58('0x31')],qs[_0x3d58('0x33')](_0x218ddd['query'][_0x3d58('0x33')]));_0xc463d[_0x3d58('0x32')]=_0xc463d['attributes'][_0x3d58('0x34')]?_0xc463d['attributes']:_0x52a099[_0x3d58('0x31')];if(_0x218ddd[_0x3d58('0x2d')][_0x3d58('0x3f')]){_0xc463d[_0x3d58('0x40')]=[{'all':!![]}];}_0xc463d=_[_0x3d58('0x3c')]({},_0xc463d,_0x218ddd[_0x3d58('0x3d')]);return db[_0x3d58('0x41')][_0x3d58('0x47')](_0xc463d)['then'](handleEntityNotFound(_0x3f2138,null))['then'](respondWithResult(_0x3f2138,null))['catch'](handleError(_0x3f2138,null));};exports[_0x3d58('0x48')]=function(_0x3d9b39,_0x266534){return db[_0x3d58('0x41')][_0x3d58('0x48')](_0x3d9b39[_0x3d58('0x49')],{})['then'](respondWithResult(_0x266534,0xc9))[_0x3d58('0x44')](handleError(_0x266534,null));};exports[_0x3d58('0x23')]=function(_0x5f55ef,_0x83d4f0){if(_0x5f55ef['body']['id']){delete _0x5f55ef[_0x3d58('0x49')]['id'];}return db[_0x3d58('0x41')][_0x3d58('0x47')]({'where':{'id':_0x5f55ef[_0x3d58('0x46')]['id']}})[_0x3d58('0x3e')](handleEntityNotFound(_0x83d4f0,null))[_0x3d58('0x3e')](saveUpdates(_0x5f55ef[_0x3d58('0x49')],null))[_0x3d58('0x3e')](respondWithResult(_0x83d4f0,null))[_0x3d58('0x44')](handleError(_0x83d4f0,null));};exports[_0x3d58('0x4a')]=function(_0x8f18dc,_0x3024a9){return db[_0x3d58('0x41')][_0x3d58('0x47')]({'where':{'id':_0x8f18dc['params']['id']}})['then'](handleEntityNotFound(_0x3024a9,null))[_0x3d58('0x3e')](removeEntity(_0x3024a9,null))['catch'](handleError(_0x3024a9,null));};exports[_0x3d58('0x4b')]=function(_0x299e8c,_0x38407d,_0x3b9f23){var _0x583974={};var _0x5bc534={};var _0x501ae3;var _0x30bcb6;return db[_0x3d58('0x41')][_0x3d58('0x4c')]({'where':{'id':_0x299e8c[_0x3d58('0x46')]['id']}})[_0x3d58('0x3e')](handleEntityNotFound(_0x38407d,null))[_0x3d58('0x3e')](function(_0xde374e){if(_0xde374e){_0x501ae3=_0xde374e;_0x5bc534[_0x3d58('0x31')]=_['keys'](db[_0x3d58('0x4d')][_0x3d58('0x29')]);_0x5bc534['query']=_[_0x3d58('0x2e')](_0x299e8c[_0x3d58('0x2d')]);_0x5bc534[_0x3d58('0x2f')]=_[_0x3d58('0x30')](_0x5bc534['model'],_0x5bc534[_0x3d58('0x2d')]);_0x583974[_0x3d58('0x32')]=_[_0x3d58('0x30')](_0x5bc534[_0x3d58('0x31')],qs[_0x3d58('0x33')](_0x299e8c[_0x3d58('0x2d')][_0x3d58('0x33')]));_0x583974['attributes']=_0x583974[_0x3d58('0x32')]['length']?_0x583974[_0x3d58('0x32')]:_0x5bc534[_0x3d58('0x31')];_0x583974[_0x3d58('0x36')]=qs[_0x3d58('0x37')](_0x299e8c[_0x3d58('0x2d')]['sort']);_0x583974[_0x3d58('0x3a')]=qs[_0x3d58('0x2f')](_[_0x3d58('0x38')](_0x299e8c[_0x3d58('0x2d')],_0x5bc534['filters']));if(_0x299e8c['query'][_0x3d58('0x39')]){_0x583974[_0x3d58('0x3a')]=_[_0x3d58('0x3c')](_0x583974[_0x3d58('0x3a')],{'$or':_[_0x3d58('0x2c')](_0x583974['attributes'],function(_0x2fb2fd){var _0xea4f84={};_0xea4f84[_0x2fb2fd]={'$like':'%'+_0x299e8c[_0x3d58('0x2d')][_0x3d58('0x39')]+'%'};return _0xea4f84;})});}_0x583974=_[_0x3d58('0x3c')]({},_0x583974,_0x299e8c[_0x3d58('0x3d')]);return _0x501ae3[_0x3d58('0x4b')](_0x583974);}})[_0x3d58('0x3e')](function(_0x21ce93){if(_0x21ce93){_0x30bcb6=_0x21ce93[_0x3d58('0x34')];if(!_0x299e8c['query'][_0x3d58('0x35')]('nolimit')){_0x583974[_0x3d58('0x1d')]=qs[_0x3d58('0x1d')](_0x299e8c[_0x3d58('0x2d')][_0x3d58('0x1d')]);_0x583974['offset']=qs['offset'](_0x299e8c[_0x3d58('0x2d')][_0x3d58('0x1f')]);}return _0x501ae3[_0x3d58('0x4b')](_0x583974);}})[_0x3d58('0x3e')](function(_0x3cef0f){if(_0x3cef0f){return _0x3cef0f?{'count':_0x30bcb6,'rows':_0x3cef0f}:null;}})[_0x3d58('0x3e')](respondWithResult(_0x38407d,null))[_0x3d58('0x44')](handleError(_0x38407d,null));};exports[_0x3d58('0x4e')]=function(_0x41a762,_0x1fb282,_0x2b86c4){var _0x107d86={};var _0xa51f60={};var _0x12bc7a;var _0x50f793;return db[_0x3d58('0x41')][_0x3d58('0x4c')]({'where':{'id':_0x41a762['params']['id']}})[_0x3d58('0x3e')](handleEntityNotFound(_0x1fb282,null))['then'](function(_0x57313c){if(_0x57313c){_0x12bc7a=_0x57313c;_0xa51f60[_0x3d58('0x31')]=_['keys'](db[_0x3d58('0x4d')][_0x3d58('0x29')]);_0xa51f60[_0x3d58('0x2d')]=_[_0x3d58('0x2e')](_0x41a762['query']);_0xa51f60['filters']=_[_0x3d58('0x30')](_0xa51f60[_0x3d58('0x31')],_0xa51f60[_0x3d58('0x2d')]);_0x107d86[_0x3d58('0x32')]=_[_0x3d58('0x30')](_0xa51f60[_0x3d58('0x31')],qs[_0x3d58('0x33')](_0x41a762[_0x3d58('0x2d')][_0x3d58('0x33')]));_0x107d86[_0x3d58('0x32')]=_0x107d86['attributes'][_0x3d58('0x34')]?_0x107d86[_0x3d58('0x32')]:_0xa51f60[_0x3d58('0x31')];_0x107d86[_0x3d58('0x36')]=qs[_0x3d58('0x37')](_0x41a762[_0x3d58('0x2d')][_0x3d58('0x37')]);_0x107d86[_0x3d58('0x3a')]=qs[_0x3d58('0x2f')](_[_0x3d58('0x38')](_0x41a762[_0x3d58('0x2d')],_0xa51f60['filters']));if(_0x41a762[_0x3d58('0x2d')][_0x3d58('0x39')]){_0x107d86['where']=_[_0x3d58('0x3c')](_0x107d86[_0x3d58('0x3a')],{'$or':_[_0x3d58('0x2c')](_0x107d86[_0x3d58('0x32')],function(_0x24259b){var _0x42ee91={};_0x42ee91[_0x24259b]={'$like':'%'+_0x41a762['query'][_0x3d58('0x39')]+'%'};return _0x42ee91;})});}_0x107d86=_[_0x3d58('0x3c')]({},_0x107d86,_0x41a762[_0x3d58('0x3d')]);return _0x12bc7a[_0x3d58('0x4e')](_0x107d86);}})[_0x3d58('0x3e')](function(_0x1ffe8c){if(_0x1ffe8c){_0x50f793=_0x1ffe8c[_0x3d58('0x34')];if(!_0x41a762[_0x3d58('0x2d')][_0x3d58('0x35')](_0x3d58('0x4f'))){_0x107d86[_0x3d58('0x1d')]=qs[_0x3d58('0x1d')](_0x41a762[_0x3d58('0x2d')][_0x3d58('0x1d')]);_0x107d86[_0x3d58('0x1f')]=qs[_0x3d58('0x1f')](_0x41a762[_0x3d58('0x2d')]['offset']);}return _0x12bc7a[_0x3d58('0x4e')](_0x107d86);}})[_0x3d58('0x3e')](function(_0x117cd2){if(_0x117cd2){return _0x117cd2?{'count':_0x50f793,'rows':_0x117cd2}:null;}})[_0x3d58('0x3e')](respondWithResult(_0x1fb282,null))[_0x3d58('0x44')](handleError(_0x1fb282,null));};exports[_0x3d58('0x50')]=function(_0x48b8b4,_0x14eb6f,_0x2f089d){var _0x1c0230={};var _0x226324={};var _0x1c30d2;var _0x3821c5;return db[_0x3d58('0x41')][_0x3d58('0x4c')]({'where':{'id':_0x48b8b4[_0x3d58('0x46')]['id']}})['then'](handleEntityNotFound(_0x14eb6f,null))[_0x3d58('0x3e')](function(_0x50dae4){if(_0x50dae4){_0x1c30d2=_0x50dae4;_0x226324['model']=_[_0x3d58('0x2e')](db['DeskField'][_0x3d58('0x29')]);_0x226324[_0x3d58('0x2d')]=_[_0x3d58('0x2e')](_0x48b8b4[_0x3d58('0x2d')]);_0x226324[_0x3d58('0x2f')]=_[_0x3d58('0x30')](_0x226324[_0x3d58('0x31')],_0x226324[_0x3d58('0x2d')]);_0x1c0230[_0x3d58('0x32')]=_[_0x3d58('0x30')](_0x226324['model'],qs[_0x3d58('0x33')](_0x48b8b4[_0x3d58('0x2d')][_0x3d58('0x33')]));_0x1c0230[_0x3d58('0x32')]=_0x1c0230[_0x3d58('0x32')][_0x3d58('0x34')]?_0x1c0230['attributes']:_0x226324[_0x3d58('0x31')];_0x1c0230[_0x3d58('0x36')]=qs[_0x3d58('0x37')](_0x48b8b4[_0x3d58('0x2d')][_0x3d58('0x37')]);_0x1c0230[_0x3d58('0x3a')]=qs['filters'](_[_0x3d58('0x38')](_0x48b8b4[_0x3d58('0x2d')],_0x226324['filters']));if(_0x48b8b4['query'][_0x3d58('0x39')]){_0x1c0230[_0x3d58('0x3a')]=_[_0x3d58('0x3c')](_0x1c0230[_0x3d58('0x3a')],{'$or':_[_0x3d58('0x2c')](_0x1c0230[_0x3d58('0x32')],function(_0x103f44){var _0xbc25c2={};_0xbc25c2[_0x103f44]={'$like':'%'+_0x48b8b4[_0x3d58('0x2d')][_0x3d58('0x39')]+'%'};return _0xbc25c2;})});}_0x1c0230=_['merge']({},_0x1c0230,_0x48b8b4['options']);return _0x1c30d2[_0x3d58('0x50')](_0x1c0230);}})[_0x3d58('0x3e')](function(_0x27c374){if(_0x27c374){_0x3821c5=_0x27c374[_0x3d58('0x34')];if(!_0x48b8b4[_0x3d58('0x2d')][_0x3d58('0x35')](_0x3d58('0x4f'))){_0x1c0230['limit']=qs[_0x3d58('0x1d')](_0x48b8b4['query']['limit']);_0x1c0230[_0x3d58('0x1f')]=qs['offset'](_0x48b8b4[_0x3d58('0x2d')][_0x3d58('0x1f')]);}return _0x1c30d2['getDescriptions'](_0x1c0230);}})[_0x3d58('0x3e')](function(_0x969cd8){if(_0x969cd8){return _0x969cd8?{'count':_0x3821c5,'rows':_0x969cd8}:null;}})[_0x3d58('0x3e')](respondWithResult(_0x14eb6f,null))[_0x3d58('0x44')](handleError(_0x14eb6f,null));};exports[_0x3d58('0x51')]=function(_0x16b728,_0x3a4686,_0x5cf3fc){var _0x3a958d={};var _0x2fe001={};var _0x2af7b4;var _0x684b53;return db[_0x3d58('0x41')][_0x3d58('0x4c')]({'where':{'id':_0x16b728[_0x3d58('0x46')]['id']}})[_0x3d58('0x3e')](handleEntityNotFound(_0x3a4686,null))['then'](function(_0x1d4059){if(_0x1d4059){_0x2af7b4=_0x1d4059;_0x2fe001[_0x3d58('0x31')]=_[_0x3d58('0x2e')](db['Tag'][_0x3d58('0x29')]);_0x2fe001['query']=_['keys'](_0x16b728[_0x3d58('0x2d')]);_0x2fe001[_0x3d58('0x2f')]=_[_0x3d58('0x30')](_0x2fe001[_0x3d58('0x31')],_0x2fe001[_0x3d58('0x2d')]);_0x3a958d['attributes']=_[_0x3d58('0x30')](_0x2fe001[_0x3d58('0x31')],qs[_0x3d58('0x33')](_0x16b728[_0x3d58('0x2d')][_0x3d58('0x33')]));_0x3a958d[_0x3d58('0x32')]=_0x3a958d[_0x3d58('0x32')][_0x3d58('0x34')]?_0x3a958d[_0x3d58('0x32')]:_0x2fe001[_0x3d58('0x31')];_0x3a958d[_0x3d58('0x36')]=qs['sort'](_0x16b728[_0x3d58('0x2d')][_0x3d58('0x37')]);_0x3a958d[_0x3d58('0x3a')]=qs['filters'](_['pick'](_0x16b728['query'],_0x2fe001[_0x3d58('0x2f')]));if(_0x16b728[_0x3d58('0x2d')]['filter']){_0x3a958d[_0x3d58('0x3a')]=_['merge'](_0x3a958d['where'],{'$or':_['map'](_0x3a958d[_0x3d58('0x32')],function(_0x3946bb){var _0x5cb6f6={};_0x5cb6f6[_0x3946bb]={'$like':'%'+_0x16b728[_0x3d58('0x2d')][_0x3d58('0x39')]+'%'};return _0x5cb6f6;})});}_0x3a958d=_[_0x3d58('0x3c')]({},_0x3a958d,_0x16b728[_0x3d58('0x3d')]);return _0x2af7b4['getTags'](_0x3a958d);}})[_0x3d58('0x3e')](function(_0x26132c){if(_0x26132c){_0x684b53=_0x26132c['length'];if(!_0x16b728[_0x3d58('0x2d')][_0x3d58('0x35')](_0x3d58('0x4f'))){_0x3a958d[_0x3d58('0x1d')]=qs[_0x3d58('0x1d')](_0x16b728[_0x3d58('0x2d')][_0x3d58('0x1d')]);_0x3a958d['offset']=qs[_0x3d58('0x1f')](_0x16b728[_0x3d58('0x2d')]['offset']);}return _0x2af7b4[_0x3d58('0x51')](_0x3a958d);}})['then'](function(_0x2f453a){if(_0x2f453a){return _0x2f453a?{'count':_0x684b53,'rows':_0x2f453a}:null;}})[_0x3d58('0x3e')](respondWithResult(_0x3a4686,null))['catch'](handleError(_0x3a4686,null));};exports['setTags']=function(_0x350a6d,_0x32ca94,_0x435b8c){if(_0x350a6d['body']['id']){delete _0x350a6d['body']['id'];}return db[_0x3d58('0x41')][_0x3d58('0x4c')]({'where':{'id':_0x350a6d[_0x3d58('0x46')]['id']}})[_0x3d58('0x3e')](handleEntityNotFound(_0x32ca94,null))[_0x3d58('0x3e')](function(_0x455c53){if(_0x455c53){return _0x455c53['setTags'](_0x350a6d[_0x3d58('0x49')][_0x3d58('0x52')]||[]);}return null;})[_0x3d58('0x3e')](respondWithResult(_0x32ca94,null))[_0x3d58('0x44')](handleError(_0x32ca94,null));}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.model.js b/server/api/intDeskConfiguration/intDeskConfiguration.model.js index f23319a..b79807b 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 _0xa0b8=['request-promise','rimraf','../../config/environment','./intDeskConfiguration.attributes','exports','define','int_desk_configurations','lodash','../../config/logger','api','moment','bluebird'];(function(_0x48f8d5,_0x34f897){var _0x47f9e5=function(_0x1b417f){while(--_0x1b417f){_0x48f8d5['push'](_0x48f8d5['shift']());}};_0x47f9e5(++_0x34f897);}(_0xa0b8,0x133));var _0x8a0b=function(_0x3c7a73,_0x3cd0f5){_0x3c7a73=_0x3c7a73-0x0;var _0xd0e2b6=_0xa0b8[_0x3c7a73];return _0xd0e2b6;};'use strict';var _=require(_0x8a0b('0x0'));var util=require('util');var logger=require(_0x8a0b('0x1'))(_0x8a0b('0x2'));var moment=require(_0x8a0b('0x3'));var BPromise=require(_0x8a0b('0x4'));var rp=require(_0x8a0b('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8a0b('0x6'));var config=require(_0x8a0b('0x7'));var attributes=require(_0x8a0b('0x8'));module[_0x8a0b('0x9')]=function(_0x5726a2,_0x320d22){return _0x5726a2[_0x8a0b('0xa')]('DeskConfiguration',attributes,{'tableName':_0x8a0b('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcf78=['define','DeskConfiguration','int_desk_configurations','lodash','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','exports'];(function(_0x577e10,_0x40fe30){var _0x3a3e65=function(_0x57e467){while(--_0x57e467){_0x577e10['push'](_0x577e10['shift']());}};_0x3a3e65(++_0x40fe30);}(_0xcf78,0x13b));var _0x8cf7=function(_0x438d45,_0x10cbb0){_0x438d45=_0x438d45-0x0;var _0x583fa0=_0xcf78[_0x438d45];return _0x583fa0;};'use strict';var _=require(_0x8cf7('0x0'));var util=require('util');var logger=require(_0x8cf7('0x1'))(_0x8cf7('0x2'));var moment=require(_0x8cf7('0x3'));var BPromise=require('bluebird');var rp=require(_0x8cf7('0x4'));var fs=require('fs');var path=require(_0x8cf7('0x5'));var rimraf=require(_0x8cf7('0x6'));var config=require(_0x8cf7('0x7'));var attributes=require('./intDeskConfiguration.attributes');module[_0x8cf7('0x8')]=function(_0x527791,_0x3f67e4){return _0x527791[_0x8cf7('0x9')](_0x8cf7('0xa'),attributes,{'tableName':_0x8cf7('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.rpc.js b/server/api/intDeskConfiguration/intDeskConfiguration.rpc.js index 9c57f25..d30dc37 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 _0xd26f=['request','info','DeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','DeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x118707,_0x48014e){var _0x2945fb=function(_0x42984c){while(--_0x42984c){_0x118707['push'](_0x118707['shift']());}};_0x2945fb(++_0x48014e);}(_0xd26f,0x113));var _0xfd26=function(_0x550d12,_0x5384bd){_0x550d12=_0x550d12-0x0;var _0x12103d=_0xd26f[_0x550d12];return _0x12103d;};'use strict';var _=require(_0xfd26('0x0'));var util=require(_0xfd26('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xfd26('0x2'));var fs=require('fs');var Redis=require(_0xfd26('0x3'));var db=require(_0xfd26('0x4'))['db'];var utils=require(_0xfd26('0x5'));var logger=require(_0xfd26('0x6'))(_0xfd26('0x7'));var config=require(_0xfd26('0x8'));var jayson=require(_0xfd26('0x9'));var client=jayson[_0xfd26('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x22b353,_0x3c148d,_0x1905a2){return new BPromise(function(_0x3d405f,_0x3c9154){return client[_0xfd26('0xb')](_0x22b353,_0x1905a2)['then'](function(_0xcf2fdb){logger[_0xfd26('0xc')](_0xfd26('0xd'),_0x3c148d,_0xfd26('0xe'));logger[_0xfd26('0xf')](_0xfd26('0x10'),_0x3c148d,'request\x20sent',JSON[_0xfd26('0x11')](_0xcf2fdb));if(_0xcf2fdb['error']){if(_0xcf2fdb[_0xfd26('0x12')]['code']===0x1f4){logger['error']('DeskConfiguration,\x20%s,\x20%s',_0x3c148d,_0xcf2fdb['error']['message']);return _0x3c9154(_0xcf2fdb[_0xfd26('0x12')][_0xfd26('0x13')]);}logger[_0xfd26('0x12')](_0xfd26('0xd'),_0x3c148d,_0xcf2fdb[_0xfd26('0x12')][_0xfd26('0x13')]);return _0x3d405f(_0xcf2fdb[_0xfd26('0x12')][_0xfd26('0x13')]);}else{logger[_0xfd26('0xc')](_0xfd26('0xd'),_0x3c148d,_0xfd26('0xe'));_0x3d405f(_0xcf2fdb[_0xfd26('0x14')][_0xfd26('0x13')]);}})[_0xfd26('0x15')](function(_0x2f9b37){logger['error'](_0xfd26('0xd'),_0x3c148d,_0x2f9b37);_0x3c9154(_0x2f9b37);});});} \ No newline at end of file +var _0xdbc6=['client','then','DeskConfiguration,\x20%s,\x20%s','request\x20sent','DeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise'];(function(_0x4833d3,_0x4cd31b){var _0x271ec3=function(_0x4f7fc0){while(--_0x4f7fc0){_0x4833d3['push'](_0x4833d3['shift']());}};_0x271ec3(++_0x4cd31b);}(_0xdbc6,0x13b));var _0x6dbc=function(_0x269c2d,_0x53df50){_0x269c2d=_0x269c2d-0x0;var _0x6c1bce=_0xdbc6[_0x269c2d];return _0x6c1bce;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x6dbc('0x0'));var BPromise=require('bluebird');var rs=require(_0x6dbc('0x1'));var fs=require('fs');var Redis=require(_0x6dbc('0x2'));var db=require(_0x6dbc('0x3'))['db'];var utils=require(_0x6dbc('0x4'));var logger=require(_0x6dbc('0x5'))(_0x6dbc('0x6'));var config=require('../../config/environment');var jayson=require(_0x6dbc('0x7'));var client=jayson[_0x6dbc('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0xbfd1f,_0x18da4b,_0x24849e){return new BPromise(function(_0x2f028f,_0x3231d8){return client['request'](_0xbfd1f,_0x24849e)[_0x6dbc('0x9')](function(_0x3c57b4){logger['info'](_0x6dbc('0xa'),_0x18da4b,_0x6dbc('0xb'));logger['debug'](_0x6dbc('0xc'),_0x18da4b,_0x6dbc('0xb'),JSON[_0x6dbc('0xd')](_0x3c57b4));if(_0x3c57b4[_0x6dbc('0xe')]){if(_0x3c57b4[_0x6dbc('0xe')]['code']===0x1f4){logger['error'](_0x6dbc('0xa'),_0x18da4b,_0x3c57b4[_0x6dbc('0xe')][_0x6dbc('0xf')]);return _0x3231d8(_0x3c57b4[_0x6dbc('0xe')][_0x6dbc('0xf')]);}logger[_0x6dbc('0xe')](_0x6dbc('0xa'),_0x18da4b,_0x3c57b4[_0x6dbc('0xe')][_0x6dbc('0xf')]);return _0x2f028f(_0x3c57b4['error'][_0x6dbc('0xf')]);}else{logger[_0x6dbc('0x10')](_0x6dbc('0xa'),_0x18da4b,_0x6dbc('0xb'));_0x2f028f(_0x3c57b4[_0x6dbc('0x11')][_0x6dbc('0xf')]);}})[_0x6dbc('0x12')](function(_0x1ee71a){logger['error']('DeskConfiguration,\x20%s,\x20%s',_0x18da4b,_0x1ee71a);_0x3231d8(_0x1ee71a);});});} \ No newline at end of file diff --git a/server/api/intDeskField/index.js b/server/api/intDeskField/index.js index 52fcd40..6e699d7 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 _0x1e4c=['destroy','exports','multer','util','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','post','put','update'];(function(_0x5b7f48,_0x4d8a1d){var _0x2424b0=function(_0x21b28b){while(--_0x21b28b){_0x5b7f48['push'](_0x5b7f48['shift']());}};_0x2424b0(++_0x4d8a1d);}(_0x1e4c,0x1bc));var _0xc1e4=function(_0x5d79d1,_0x406f36){_0x5d79d1=_0x5d79d1-0x0;var _0x277e2e=_0x1e4c[_0x5d79d1];return _0x277e2e;};'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('./intDeskField.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 +var _0x4295=['update','delete','destroy','exports','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intDeskField.controller','get','isAuthenticated','index','/:id','show','post','put'];(function(_0x38af48,_0x400460){var _0x445384=function(_0x464435){while(--_0x464435){_0x38af48['push'](_0x38af48['shift']());}};_0x445384(++_0x400460);}(_0x4295,0x147));var _0x5429=function(_0x6f5598,_0xabeb74){_0x6f5598=_0x6f5598-0x0;var _0x1e1325=_0x4295[_0x6f5598];return _0x1e1325;};'use strict';var multer=require('multer');var util=require(_0x5429('0x0'));var path=require(_0x5429('0x1'));var timeout=require('connect-timeout');var express=require(_0x5429('0x2'));var router=express[_0x5429('0x3')]();var fs_extra=require(_0x5429('0x4'));var auth=require(_0x5429('0x5'));var interaction=require(_0x5429('0x6'));var config=require('../../config/environment');var controller=require(_0x5429('0x7'));router[_0x5429('0x8')]('/',auth[_0x5429('0x9')](),controller[_0x5429('0xa')]);router[_0x5429('0x8')](_0x5429('0xb'),auth[_0x5429('0x9')](),controller[_0x5429('0xc')]);router[_0x5429('0xd')]('/',auth[_0x5429('0x9')](),controller['create']);router[_0x5429('0xe')](_0x5429('0xb'),auth[_0x5429('0x9')](),controller[_0x5429('0xf')]);router[_0x5429('0x10')](_0x5429('0xb'),auth['isAuthenticated'](),controller[_0x5429('0x11')]);module[_0x5429('0x12')]=router; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.attributes.js b/server/api/intDeskField/intDeskField.attributes.js index 11943a0..c252628 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 _0xb958=['string','STRING','ENUM','BOOLEAN','sequelize','variable','customVariable','keyValue','picklist'];(function(_0x465a0c,_0x19d4d5){var _0x1e202e=function(_0x27bd8a){while(--_0x27bd8a){_0x465a0c['push'](_0x465a0c['shift']());}};_0x1e202e(++_0x19d4d5);}(_0xb958,0x109));var _0x8b95=function(_0x27dba4,_0x419253){_0x27dba4=_0x27dba4-0x0;var _0x35ec9d=_0xb958[_0x27dba4];return _0x35ec9d;};'use strict';var Sequelize=require(_0x8b95('0x0'));module['exports']={'type':{'type':Sequelize['ENUM']('string',_0x8b95('0x1'),_0x8b95('0x2'),_0x8b95('0x3'),_0x8b95('0x4')),'defaultValue':_0x8b95('0x5')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x8b95('0x6')]},'keyType':{'type':Sequelize[_0x8b95('0x7')](_0x8b95('0x5'),_0x8b95('0x1'),_0x8b95('0x2'))},'keyContent':{'type':Sequelize[_0x8b95('0x6')]},'idField':{'type':Sequelize[_0x8b95('0x6')]},'nameField':{'type':Sequelize[_0x8b95('0x6')]},'customField':{'type':Sequelize[_0x8b95('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x8b95('0x6')]}}; \ No newline at end of file +var _0xf63a=['customVariable','keyValue','picklist','STRING','BOOLEAN','ENUM','string','variable'];(function(_0x2bcd82,_0x427da9){var _0x39216c=function(_0x5128ad){while(--_0x5128ad){_0x2bcd82['push'](_0x2bcd82['shift']());}};_0x39216c(++_0x427da9);}(_0xf63a,0x8d));var _0xaf63=function(_0x4a2689,_0x314a16){_0x4a2689=_0x4a2689-0x0;var _0x463450=_0xf63a[_0x4a2689];return _0x463450;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize[_0xaf63('0x0')](_0xaf63('0x1'),_0xaf63('0x2'),_0xaf63('0x3'),_0xaf63('0x4'),_0xaf63('0x5')),'defaultValue':_0xaf63('0x1')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0xaf63('0x6')]},'keyType':{'type':Sequelize['ENUM'](_0xaf63('0x1'),_0xaf63('0x2'),_0xaf63('0x3'))},'keyContent':{'type':Sequelize[_0xaf63('0x6')]},'idField':{'type':Sequelize[_0xaf63('0x6')]},'nameField':{'type':Sequelize[_0xaf63('0x6')]},'customField':{'type':Sequelize[_0xaf63('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xaf63('0x6')]}}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.controller.js b/server/api/intDeskField/intDeskField.controller.js index 91cacd6..d7745ba 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 _0x9a96=['reject','save','update','then','destroy','sendStatus','error','stack','name','send','map','rawAttributes','fieldName','type','key','keys','filters','intersection','model','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','filter','merge','options','DeskField','findAll','catch','includeAll','include','find','create','body','params','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply'];(function(_0x5b8a37,_0x5f5554){var _0x421c10=function(_0x47e343){while(--_0x47e343){_0x5b8a37['push'](_0x5b8a37['shift']());}};_0x421c10(++_0x5f5554);}(_0x9a96,0x117));var _0x69a9=function(_0x49178e,_0x4b6d5e){_0x49178e=_0x49178e-0x0;var _0x9e9a29=_0x9a96[_0x49178e];return _0x9e9a29;};'use strict';var emlformat=require(_0x69a9('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x69a9('0x1'));var jsonpatch=require(_0x69a9('0x2'));var rp=require(_0x69a9('0x3'));var moment=require(_0x69a9('0x4'));var BPromise=require(_0x69a9('0x5'));var Mustache=require(_0x69a9('0x6'));var util=require(_0x69a9('0x7'));var path=require(_0x69a9('0x8'));var sox=require('sox');var csv=require(_0x69a9('0x9'));var ejs=require(_0x69a9('0xa'));var fs=require('fs');var fs_extra=require(_0x69a9('0xb'));var _=require(_0x69a9('0xc'));var squel=require(_0x69a9('0xd'));var crypto=require('crypto');var jsforce=require(_0x69a9('0xe'));var deskjs=require(_0x69a9('0xf'));var toCsv=require(_0x69a9('0x9'));var querystring=require(_0x69a9('0x10'));var Papa=require('papaparse');var Redis=require(_0x69a9('0x11'));var authService=require(_0x69a9('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x69a9('0x13'));var hardwareService=require(_0x69a9('0x14'));var logger=require(_0x69a9('0x15'))(_0x69a9('0x16'));var utils=require(_0x69a9('0x17'));var config=require(_0x69a9('0x18'));var licenseUtil=require(_0x69a9('0x19'));var db=require(_0x69a9('0x1a'))['db'];function respondWithStatusCode(_0x5ce814,_0x4cd1b5){_0x4cd1b5=_0x4cd1b5||0xcc;return function(_0x5db48a){if(_0x5db48a){return _0x5ce814['sendStatus'](_0x4cd1b5);}return _0x5ce814[_0x69a9('0x1b')](_0x4cd1b5)[_0x69a9('0x1c')]();};}function respondWithResult(_0x414a04,_0x1747d6){_0x1747d6=_0x1747d6||0xc8;return function(_0x5d8dc9){if(_0x5d8dc9){return _0x414a04['status'](_0x1747d6)[_0x69a9('0x1d')](_0x5d8dc9);}};}function respondWithFilteredResult(_0x39c0db,_0x25651d){return function(_0x39275e){if(_0x39275e){var _0x327f9d=typeof _0x25651d[_0x69a9('0x1e')]===_0x69a9('0x1f')&&typeof _0x25651d[_0x69a9('0x20')]==='undefined';var _0x2810eb=_0x39275e['count'];var _0x50381c=_0x327f9d?0x0:_0x25651d[_0x69a9('0x1e')];var _0x5d5c44=_0x327f9d?_0x39275e[_0x69a9('0x21')]:_0x25651d[_0x69a9('0x1e')]+_0x25651d[_0x69a9('0x20')];var _0x1f1c1e;if(_0x5d5c44>=_0x2810eb){_0x5d5c44=_0x2810eb;_0x1f1c1e=0xc8;}else{_0x1f1c1e=0xce;}_0x39c0db[_0x69a9('0x1b')](_0x1f1c1e);return _0x39c0db[_0x69a9('0x22')](_0x69a9('0x23'),_0x50381c+'-'+_0x5d5c44+'/'+_0x2810eb)[_0x69a9('0x1d')](_0x39275e);}return null;};}function patchUpdates(_0x3d52f1){return function(_0x376d32){try{jsonpatch[_0x69a9('0x24')](_0x376d32,_0x3d52f1,!![]);}catch(_0x48248c){return BPromise[_0x69a9('0x25')](_0x48248c);}return _0x376d32[_0x69a9('0x26')]();};}function saveUpdates(_0x32317b,_0x160258){return function(_0x3806f9){if(_0x3806f9){return _0x3806f9[_0x69a9('0x27')](_0x32317b)[_0x69a9('0x28')](function(_0x5351f3){return _0x5351f3;});}return null;};}function removeEntity(_0x57f3b4,_0x1f9517){return function(_0x43815b){if(_0x43815b){return _0x43815b[_0x69a9('0x29')]()['then'](function(){_0x57f3b4[_0x69a9('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5877d7,_0x281861){return function(_0x1abc57){if(!_0x1abc57){_0x5877d7[_0x69a9('0x2a')](0x194);}return _0x1abc57;};}function handleError(_0x356f33,_0x4864ea){_0x4864ea=_0x4864ea||0x1f4;return function(_0xecd137){logger[_0x69a9('0x2b')](_0xecd137[_0x69a9('0x2c')]);if(_0xecd137[_0x69a9('0x2d')]){delete _0xecd137[_0x69a9('0x2d')];}_0x356f33[_0x69a9('0x1b')](_0x4864ea)[_0x69a9('0x2e')](_0xecd137);};}exports['index']=function(_0x1c74f5,_0x13e5bf){var _0x190c3e={},_0x19f538={},_0x375877={'count':0x0,'rows':[]};var _0x2a70ad=_[_0x69a9('0x2f')](db['DeskField'][_0x69a9('0x30')],function(_0x410f5b){return{'name':_0x410f5b[_0x69a9('0x31')],'type':_0x410f5b[_0x69a9('0x32')][_0x69a9('0x33')]};});_0x19f538['model']=_[_0x69a9('0x2f')](_0x2a70ad,_0x69a9('0x2d'));_0x19f538['query']=_[_0x69a9('0x34')](_0x1c74f5['query']);_0x19f538[_0x69a9('0x35')]=_[_0x69a9('0x36')](_0x19f538[_0x69a9('0x37')],_0x19f538[_0x69a9('0x38')]);_0x190c3e[_0x69a9('0x39')]=_[_0x69a9('0x36')](_0x19f538[_0x69a9('0x37')],qs[_0x69a9('0x3a')](_0x1c74f5[_0x69a9('0x38')][_0x69a9('0x3a')]));_0x190c3e['attributes']=_0x190c3e[_0x69a9('0x39')][_0x69a9('0x3b')]?_0x190c3e[_0x69a9('0x39')]:_0x19f538[_0x69a9('0x37')];if(!_0x1c74f5[_0x69a9('0x38')][_0x69a9('0x3c')](_0x69a9('0x3d'))){_0x190c3e[_0x69a9('0x20')]=qs[_0x69a9('0x20')](_0x1c74f5[_0x69a9('0x38')][_0x69a9('0x20')]);_0x190c3e[_0x69a9('0x1e')]=qs[_0x69a9('0x1e')](_0x1c74f5[_0x69a9('0x38')][_0x69a9('0x1e')]);}_0x190c3e[_0x69a9('0x3e')]=qs[_0x69a9('0x3f')](_0x1c74f5[_0x69a9('0x38')][_0x69a9('0x3f')]);_0x190c3e[_0x69a9('0x40')]=qs[_0x69a9('0x35')](_[_0x69a9('0x41')](_0x1c74f5[_0x69a9('0x38')],_0x19f538[_0x69a9('0x35')]),_0x2a70ad);if(_0x1c74f5[_0x69a9('0x38')]['filter']){_0x190c3e['where']=_['merge'](_0x190c3e[_0x69a9('0x40')],{'$or':_[_0x69a9('0x2f')](_0x2a70ad,function(_0x8176dd){if(_0x8176dd[_0x69a9('0x32')]!==_0x69a9('0x42')){var _0x26f87c={};_0x26f87c[_0x8176dd[_0x69a9('0x2d')]]={'$like':'%'+_0x1c74f5[_0x69a9('0x38')][_0x69a9('0x43')]+'%'};return _0x26f87c;}})});}_0x190c3e=_[_0x69a9('0x44')]({},_0x190c3e,_0x1c74f5[_0x69a9('0x45')]);var _0x2744aa={'where':_0x190c3e[_0x69a9('0x40')]};return db['DeskField'][_0x69a9('0x21')](_0x2744aa)[_0x69a9('0x28')](function(_0x4469a5){_0x375877['count']=_0x4469a5;if(_0x1c74f5[_0x69a9('0x38')]['includeAll']){_0x190c3e['include']=[{'all':!![]}];}return db[_0x69a9('0x46')][_0x69a9('0x47')](_0x190c3e);})[_0x69a9('0x28')](function(_0x36f031){_0x375877['rows']=_0x36f031;return _0x375877;})[_0x69a9('0x28')](respondWithFilteredResult(_0x13e5bf,_0x190c3e))[_0x69a9('0x48')](handleError(_0x13e5bf,null));};exports['show']=function(_0x48b292,_0x4851ba){var _0x41e4bf={'raw':!![],'where':{'id':_0x48b292['params']['id']}},_0x5b78cd={};_0x5b78cd[_0x69a9('0x37')]=_['keys'](db[_0x69a9('0x46')][_0x69a9('0x30')]);_0x5b78cd[_0x69a9('0x38')]=_[_0x69a9('0x34')](_0x48b292['query']);_0x5b78cd[_0x69a9('0x35')]=_[_0x69a9('0x36')](_0x5b78cd[_0x69a9('0x37')],_0x5b78cd[_0x69a9('0x38')]);_0x41e4bf[_0x69a9('0x39')]=_['intersection'](_0x5b78cd[_0x69a9('0x37')],qs[_0x69a9('0x3a')](_0x48b292[_0x69a9('0x38')][_0x69a9('0x3a')]));_0x41e4bf[_0x69a9('0x39')]=_0x41e4bf[_0x69a9('0x39')]['length']?_0x41e4bf[_0x69a9('0x39')]:_0x5b78cd[_0x69a9('0x37')];if(_0x48b292[_0x69a9('0x38')][_0x69a9('0x49')]){_0x41e4bf[_0x69a9('0x4a')]=[{'all':!![]}];}_0x41e4bf=_[_0x69a9('0x44')]({},_0x41e4bf,_0x48b292[_0x69a9('0x45')]);return db[_0x69a9('0x46')][_0x69a9('0x4b')](_0x41e4bf)[_0x69a9('0x28')](handleEntityNotFound(_0x4851ba,null))[_0x69a9('0x28')](respondWithResult(_0x4851ba,null))[_0x69a9('0x48')](handleError(_0x4851ba,null));};exports['create']=function(_0x4fe86a,_0x41330c){return db[_0x69a9('0x46')][_0x69a9('0x4c')](_0x4fe86a[_0x69a9('0x4d')],{})['then'](respondWithResult(_0x41330c,0xc9))[_0x69a9('0x48')](handleError(_0x41330c,null));};exports[_0x69a9('0x27')]=function(_0x2b6cee,_0x5d2d20){if(_0x2b6cee[_0x69a9('0x4d')]['id']){delete _0x2b6cee[_0x69a9('0x4d')]['id'];}return db[_0x69a9('0x46')][_0x69a9('0x4b')]({'where':{'id':_0x2b6cee[_0x69a9('0x4e')]['id']}})[_0x69a9('0x28')](handleEntityNotFound(_0x5d2d20,null))[_0x69a9('0x28')](saveUpdates(_0x2b6cee[_0x69a9('0x4d')],null))[_0x69a9('0x28')](respondWithResult(_0x5d2d20,null))['catch'](handleError(_0x5d2d20,null));};exports[_0x69a9('0x29')]=function(_0x4094ce,_0x15eb5a){return db['DeskField'][_0x69a9('0x4b')]({'where':{'id':_0x4094ce[_0x69a9('0x4e')]['id']}})['then'](handleEntityNotFound(_0x15eb5a,null))[_0x69a9('0x28')](removeEntity(_0x15eb5a,null))['catch'](handleError(_0x15eb5a,null));}; \ No newline at end of file +var _0xca84=['type','key','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','includeAll','findAll','rows','catch','params','include','find','create','body','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','update','then','destroy','sendStatus','stack','name','send','index','map','DeskField','rawAttributes','fieldName'];(function(_0xa02398,_0x1875b6){var _0x522b73=function(_0x391efc){while(--_0x391efc){_0xa02398['push'](_0xa02398['shift']());}};_0x522b73(++_0x1875b6);}(_0xca84,0xf5));var _0x4ca8=function(_0x5f28e3,_0x27a373){_0x5f28e3=_0x5f28e3-0x0;var _0x1529af=_0xca84[_0x5f28e3];return _0x1529af;};'use strict';var emlformat=require(_0x4ca8('0x0'));var rimraf=require(_0x4ca8('0x1'));var zipdir=require(_0x4ca8('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4ca8('0x3'));var moment=require(_0x4ca8('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x4ca8('0x5'));var util=require(_0x4ca8('0x6'));var path=require(_0x4ca8('0x7'));var sox=require(_0x4ca8('0x8'));var csv=require(_0x4ca8('0x9'));var ejs=require(_0x4ca8('0xa'));var fs=require('fs');var fs_extra=require(_0x4ca8('0xb'));var _=require(_0x4ca8('0xc'));var squel=require(_0x4ca8('0xd'));var crypto=require(_0x4ca8('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x4ca8('0xf'));var toCsv=require('to-csv');var querystring=require(_0x4ca8('0x10'));var Papa=require('papaparse');var Redis=require(_0x4ca8('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x4ca8('0x12'));var as=require(_0x4ca8('0x13'));var hardwareService=require(_0x4ca8('0x14'));var logger=require(_0x4ca8('0x15'))(_0x4ca8('0x16'));var utils=require(_0x4ca8('0x17'));var config=require(_0x4ca8('0x18'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4d58bf,_0x49f39e){_0x49f39e=_0x49f39e||0xcc;return function(_0x309286){if(_0x309286){return _0x4d58bf['sendStatus'](_0x49f39e);}return _0x4d58bf[_0x4ca8('0x19')](_0x49f39e)[_0x4ca8('0x1a')]();};}function respondWithResult(_0x522db3,_0x564518){_0x564518=_0x564518||0xc8;return function(_0xaf215e){if(_0xaf215e){return _0x522db3[_0x4ca8('0x19')](_0x564518)[_0x4ca8('0x1b')](_0xaf215e);}};}function respondWithFilteredResult(_0x770b5b,_0x379d8c){return function(_0x64c350){if(_0x64c350){var _0x342481=typeof _0x379d8c[_0x4ca8('0x1c')]===_0x4ca8('0x1d')&&typeof _0x379d8c[_0x4ca8('0x1e')]===_0x4ca8('0x1d');var _0x316b80=_0x64c350['count'];var _0xedd3=_0x342481?0x0:_0x379d8c[_0x4ca8('0x1c')];var _0x59e85b=_0x342481?_0x64c350[_0x4ca8('0x1f')]:_0x379d8c[_0x4ca8('0x1c')]+_0x379d8c['limit'];var _0x23b57a;if(_0x59e85b>=_0x316b80){_0x59e85b=_0x316b80;_0x23b57a=0xc8;}else{_0x23b57a=0xce;}_0x770b5b[_0x4ca8('0x19')](_0x23b57a);return _0x770b5b['set'](_0x4ca8('0x20'),_0xedd3+'-'+_0x59e85b+'/'+_0x316b80)['json'](_0x64c350);}return null;};}function patchUpdates(_0x2764e4){return function(_0x2e8cb8){try{jsonpatch[_0x4ca8('0x21')](_0x2e8cb8,_0x2764e4,!![]);}catch(_0x838ff0){return BPromise[_0x4ca8('0x22')](_0x838ff0);}return _0x2e8cb8['save']();};}function saveUpdates(_0x273a4d,_0xf50050){return function(_0x354072){if(_0x354072){return _0x354072[_0x4ca8('0x23')](_0x273a4d)[_0x4ca8('0x24')](function(_0x4d090a){return _0x4d090a;});}return null;};}function removeEntity(_0x30b731,_0x3691e2){return function(_0x398ed4){if(_0x398ed4){return _0x398ed4[_0x4ca8('0x25')]()[_0x4ca8('0x24')](function(){_0x30b731['status'](0xcc)[_0x4ca8('0x1a')]();});}};}function handleEntityNotFound(_0x297341,_0xbe9bd4){return function(_0x5c150c){if(!_0x5c150c){_0x297341[_0x4ca8('0x26')](0x194);}return _0x5c150c;};}function handleError(_0x22f857,_0x8443c6){_0x8443c6=_0x8443c6||0x1f4;return function(_0x1f2231){logger['error'](_0x1f2231[_0x4ca8('0x27')]);if(_0x1f2231[_0x4ca8('0x28')]){delete _0x1f2231['name'];}_0x22f857[_0x4ca8('0x19')](_0x8443c6)[_0x4ca8('0x29')](_0x1f2231);};}exports[_0x4ca8('0x2a')]=function(_0x2735d1,_0x1eb599){var _0x5f1ce5={},_0xab2501={},_0x418c30={'count':0x0,'rows':[]};var _0x4d28a9=_[_0x4ca8('0x2b')](db[_0x4ca8('0x2c')][_0x4ca8('0x2d')],function(_0xe96d6c){return{'name':_0xe96d6c[_0x4ca8('0x2e')],'type':_0xe96d6c[_0x4ca8('0x2f')][_0x4ca8('0x30')]};});_0xab2501['model']=_[_0x4ca8('0x2b')](_0x4d28a9,_0x4ca8('0x28'));_0xab2501[_0x4ca8('0x31')]=_[_0x4ca8('0x32')](_0x2735d1[_0x4ca8('0x31')]);_0xab2501[_0x4ca8('0x33')]=_['intersection'](_0xab2501[_0x4ca8('0x34')],_0xab2501['query']);_0x5f1ce5[_0x4ca8('0x35')]=_[_0x4ca8('0x36')](_0xab2501[_0x4ca8('0x34')],qs[_0x4ca8('0x37')](_0x2735d1['query']['fields']));_0x5f1ce5[_0x4ca8('0x35')]=_0x5f1ce5['attributes'][_0x4ca8('0x38')]?_0x5f1ce5[_0x4ca8('0x35')]:_0xab2501[_0x4ca8('0x34')];if(!_0x2735d1[_0x4ca8('0x31')][_0x4ca8('0x39')](_0x4ca8('0x3a'))){_0x5f1ce5[_0x4ca8('0x1e')]=qs[_0x4ca8('0x1e')](_0x2735d1['query']['limit']);_0x5f1ce5['offset']=qs['offset'](_0x2735d1[_0x4ca8('0x31')]['offset']);}_0x5f1ce5[_0x4ca8('0x3b')]=qs[_0x4ca8('0x3c')](_0x2735d1[_0x4ca8('0x31')][_0x4ca8('0x3c')]);_0x5f1ce5[_0x4ca8('0x3d')]=qs[_0x4ca8('0x33')](_['pick'](_0x2735d1[_0x4ca8('0x31')],_0xab2501[_0x4ca8('0x33')]),_0x4d28a9);if(_0x2735d1[_0x4ca8('0x31')]['filter']){_0x5f1ce5[_0x4ca8('0x3d')]=_[_0x4ca8('0x3e')](_0x5f1ce5[_0x4ca8('0x3d')],{'$or':_[_0x4ca8('0x2b')](_0x4d28a9,function(_0x52bbc){if(_0x52bbc[_0x4ca8('0x2f')]!==_0x4ca8('0x3f')){var _0x2fd55a={};_0x2fd55a[_0x52bbc[_0x4ca8('0x28')]]={'$like':'%'+_0x2735d1[_0x4ca8('0x31')]['filter']+'%'};return _0x2fd55a;}})});}_0x5f1ce5=_[_0x4ca8('0x3e')]({},_0x5f1ce5,_0x2735d1['options']);var _0x516453={'where':_0x5f1ce5[_0x4ca8('0x3d')]};return db[_0x4ca8('0x2c')][_0x4ca8('0x1f')](_0x516453)[_0x4ca8('0x24')](function(_0x184845){_0x418c30['count']=_0x184845;if(_0x2735d1[_0x4ca8('0x31')][_0x4ca8('0x40')]){_0x5f1ce5['include']=[{'all':!![]}];}return db[_0x4ca8('0x2c')][_0x4ca8('0x41')](_0x5f1ce5);})[_0x4ca8('0x24')](function(_0xeaf988){_0x418c30[_0x4ca8('0x42')]=_0xeaf988;return _0x418c30;})[_0x4ca8('0x24')](respondWithFilteredResult(_0x1eb599,_0x5f1ce5))[_0x4ca8('0x43')](handleError(_0x1eb599,null));};exports['show']=function(_0x447df4,_0x2be5b5){var _0x4937f4={'raw':!![],'where':{'id':_0x447df4[_0x4ca8('0x44')]['id']}},_0x346fa1={};_0x346fa1[_0x4ca8('0x34')]=_[_0x4ca8('0x32')](db[_0x4ca8('0x2c')][_0x4ca8('0x2d')]);_0x346fa1['query']=_[_0x4ca8('0x32')](_0x447df4['query']);_0x346fa1[_0x4ca8('0x33')]=_['intersection'](_0x346fa1[_0x4ca8('0x34')],_0x346fa1[_0x4ca8('0x31')]);_0x4937f4[_0x4ca8('0x35')]=_['intersection'](_0x346fa1[_0x4ca8('0x34')],qs[_0x4ca8('0x37')](_0x447df4[_0x4ca8('0x31')][_0x4ca8('0x37')]));_0x4937f4[_0x4ca8('0x35')]=_0x4937f4[_0x4ca8('0x35')][_0x4ca8('0x38')]?_0x4937f4[_0x4ca8('0x35')]:_0x346fa1[_0x4ca8('0x34')];if(_0x447df4[_0x4ca8('0x31')][_0x4ca8('0x40')]){_0x4937f4[_0x4ca8('0x45')]=[{'all':!![]}];}_0x4937f4=_[_0x4ca8('0x3e')]({},_0x4937f4,_0x447df4['options']);return db['DeskField'][_0x4ca8('0x46')](_0x4937f4)['then'](handleEntityNotFound(_0x2be5b5,null))[_0x4ca8('0x24')](respondWithResult(_0x2be5b5,null))['catch'](handleError(_0x2be5b5,null));};exports[_0x4ca8('0x47')]=function(_0x31957f,_0x38df23){return db[_0x4ca8('0x2c')][_0x4ca8('0x47')](_0x31957f[_0x4ca8('0x48')],{})[_0x4ca8('0x24')](respondWithResult(_0x38df23,0xc9))[_0x4ca8('0x43')](handleError(_0x38df23,null));};exports[_0x4ca8('0x23')]=function(_0x4d71e4,_0x362329){if(_0x4d71e4[_0x4ca8('0x48')]['id']){delete _0x4d71e4['body']['id'];}return db[_0x4ca8('0x2c')][_0x4ca8('0x46')]({'where':{'id':_0x4d71e4[_0x4ca8('0x44')]['id']}})[_0x4ca8('0x24')](handleEntityNotFound(_0x362329,null))[_0x4ca8('0x24')](saveUpdates(_0x4d71e4[_0x4ca8('0x48')],null))[_0x4ca8('0x24')](respondWithResult(_0x362329,null))[_0x4ca8('0x43')](handleError(_0x362329,null));};exports[_0x4ca8('0x25')]=function(_0x1528c3,_0x2c6d71){return db[_0x4ca8('0x2c')][_0x4ca8('0x46')]({'where':{'id':_0x1528c3['params']['id']}})[_0x4ca8('0x24')](handleEntityNotFound(_0x2c6d71,null))[_0x4ca8('0x24')](removeEntity(_0x2c6d71,null))[_0x4ca8('0x43')](handleError(_0x2c6d71,null));}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.model.js b/server/api/intDeskField/intDeskField.model.js index b027ccd..9335aaa 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 _0x4446=['../../config/environment','./intDeskField.attributes','exports','define','DeskField','idField','FieldId','lodash','util','moment','bluebird','path','rimraf'];(function(_0x3e5bc6,_0x5f4685){var _0x44651a=function(_0x33b4f5){while(--_0x33b4f5){_0x3e5bc6['push'](_0x3e5bc6['shift']());}};_0x44651a(++_0x5f4685);}(_0x4446,0x180));var _0x6444=function(_0x274df2,_0x4856d1){_0x274df2=_0x274df2-0x0;var _0x7163b0=_0x4446[_0x274df2];return _0x7163b0;};'use strict';var _=require(_0x6444('0x0'));var util=require(_0x6444('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x6444('0x2'));var BPromise=require(_0x6444('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6444('0x4'));var rimraf=require(_0x6444('0x5'));var config=require(_0x6444('0x6'));var attributes=require(_0x6444('0x7'));module[_0x6444('0x8')]=function(_0x2b21d1,_0x266259){return _0x2b21d1[_0x6444('0x9')](_0x6444('0xa'),attributes,{'tableName':'int_desk_fields','paranoid':![],'indexes':[{'name':'desk_unique_index','fields':[_0x6444('0xb'),_0x6444('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x9d2b=['int_desk_fields','desk_unique_index','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intDeskField.attributes','exports','DeskField'];(function(_0x23c2c3,_0x27ecc8){var _0x41e09f=function(_0x5e6873){while(--_0x5e6873){_0x23c2c3['push'](_0x23c2c3['shift']());}};_0x41e09f(++_0x27ecc8);}(_0x9d2b,0x1a6));var _0xb9d2=function(_0x1a4a06,_0x36a5c2){_0x1a4a06=_0x1a4a06-0x0;var _0x49ec08=_0x9d2b[_0x1a4a06];return _0x49ec08;};'use strict';var _=require('lodash');var util=require(_0xb9d2('0x0'));var logger=require(_0xb9d2('0x1'))(_0xb9d2('0x2'));var moment=require(_0xb9d2('0x3'));var BPromise=require(_0xb9d2('0x4'));var rp=require(_0xb9d2('0x5'));var fs=require('fs');var path=require(_0xb9d2('0x6'));var rimraf=require(_0xb9d2('0x7'));var config=require(_0xb9d2('0x8'));var attributes=require(_0xb9d2('0x9'));module[_0xb9d2('0xa')]=function(_0x11db2d,_0x2c6ac1){return _0x11db2d['define'](_0xb9d2('0xb'),attributes,{'tableName':_0xb9d2('0xc'),'paranoid':![],'indexes':[{'name':_0xb9d2('0xd'),'fields':['idField','FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.rpc.js b/server/api/intDeskField/intDeskField.rpc.js index 55ccda4..94bf9b1 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 _0xfcb0=['randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','request','then','info','DeskField,\x20%s,\x20%s','request\x20sent','debug','DeskField,\x20%s,\x20%s,\x20%s','error','code','message','result','moment'];(function(_0x2c80c1,_0xf479b3){var _0x375cd8=function(_0xeb509a){while(--_0xeb509a){_0x2c80c1['push'](_0x2c80c1['shift']());}};_0x375cd8(++_0xf479b3);}(_0xfcb0,0xc5));var _0x0fcb=function(_0x3687ca,_0x300281){_0x3687ca=_0x3687ca-0x0;var _0xa84cb8=_0xfcb0[_0x3687ca];return _0xa84cb8;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x0fcb('0x0'));var BPromise=require('bluebird');var rs=require(_0x0fcb('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0fcb('0x2'))['db'];var utils=require(_0x0fcb('0x3'));var logger=require('../../config/logger')(_0x0fcb('0x4'));var config=require(_0x0fcb('0x5'));var jayson=require(_0x0fcb('0x6'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x625963,_0x3139b5,_0x55c6bc){return new BPromise(function(_0x12c678,_0x1c7dc2){return client[_0x0fcb('0x7')](_0x625963,_0x55c6bc)[_0x0fcb('0x8')](function(_0x237acb){logger[_0x0fcb('0x9')](_0x0fcb('0xa'),_0x3139b5,_0x0fcb('0xb'));logger[_0x0fcb('0xc')](_0x0fcb('0xd'),_0x3139b5,_0x0fcb('0xb'),JSON['stringify'](_0x237acb));if(_0x237acb[_0x0fcb('0xe')]){if(_0x237acb[_0x0fcb('0xe')][_0x0fcb('0xf')]===0x1f4){logger[_0x0fcb('0xe')](_0x0fcb('0xa'),_0x3139b5,_0x237acb[_0x0fcb('0xe')]['message']);return _0x1c7dc2(_0x237acb[_0x0fcb('0xe')][_0x0fcb('0x10')]);}logger[_0x0fcb('0xe')](_0x0fcb('0xa'),_0x3139b5,_0x237acb['error'][_0x0fcb('0x10')]);return _0x12c678(_0x237acb[_0x0fcb('0xe')][_0x0fcb('0x10')]);}else{logger['info']('DeskField,\x20%s,\x20%s',_0x3139b5,_0x0fcb('0xb'));_0x12c678(_0x237acb[_0x0fcb('0x11')][_0x0fcb('0x10')]);}})['catch'](function(_0x354899){logger['error']('DeskField,\x20%s,\x20%s',_0x3139b5,_0x354899);_0x1c7dc2(_0x354899);});});} \ No newline at end of file +var _0x5d40=['stringify','error','code','message','catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','DeskField,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x3bdd14,_0x1c2221){var _0x1ad937=function(_0x557499){while(--_0x557499){_0x3bdd14['push'](_0x3bdd14['shift']());}};_0x1ad937(++_0x1c2221);}(_0x5d40,0x1bd));var _0x05d4=function(_0x1e0686,_0x3d21ed){_0x1e0686=_0x1e0686-0x0;var _0x4d8f1a=_0x5d40[_0x1e0686];return _0x4d8f1a;};'use strict';var _=require('lodash');var util=require(_0x05d4('0x0'));var moment=require(_0x05d4('0x1'));var BPromise=require(_0x05d4('0x2'));var rs=require(_0x05d4('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x05d4('0x4'))['db'];var utils=require(_0x05d4('0x5'));var logger=require(_0x05d4('0x6'))(_0x05d4('0x7'));var config=require(_0x05d4('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x05d4('0x9')][_0x05d4('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4b70b0,_0x2b9c2f,_0x7dd211){return new BPromise(function(_0x1b2d9a,_0x155014){return client[_0x05d4('0xb')](_0x4b70b0,_0x7dd211)[_0x05d4('0xc')](function(_0xa1f996){logger[_0x05d4('0xd')](_0x05d4('0xe'),_0x2b9c2f,_0x05d4('0xf'));logger[_0x05d4('0x10')]('DeskField,\x20%s,\x20%s,\x20%s',_0x2b9c2f,_0x05d4('0xf'),JSON[_0x05d4('0x11')](_0xa1f996));if(_0xa1f996[_0x05d4('0x12')]){if(_0xa1f996[_0x05d4('0x12')][_0x05d4('0x13')]===0x1f4){logger['error'](_0x05d4('0xe'),_0x2b9c2f,_0xa1f996[_0x05d4('0x12')]['message']);return _0x155014(_0xa1f996[_0x05d4('0x12')]['message']);}logger['error'](_0x05d4('0xe'),_0x2b9c2f,_0xa1f996[_0x05d4('0x12')][_0x05d4('0x14')]);return _0x1b2d9a(_0xa1f996[_0x05d4('0x12')][_0x05d4('0x14')]);}else{logger[_0x05d4('0xd')]('DeskField,\x20%s,\x20%s',_0x2b9c2f,_0x05d4('0xf'));_0x1b2d9a(_0xa1f996['result']['message']);}})[_0x05d4('0x15')](function(_0x44ed3d){logger['error']('DeskField,\x20%s,\x20%s',_0x2b9c2f,_0x44ed3d);_0x155014(_0x44ed3d);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/index.js b/server/api/intDynamics365Account/index.js index 8880ed4..cf6df82 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 _0x720f=['connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Account.controller','get','isAuthenticated','index','/:id','/:id/configurations','getConfigurations','getFields','post','create','addConfiguration','put','update','delete','destroy','multer','util','path'];(function(_0x1b02a6,_0x74f890){var _0x31c442=function(_0x185c54){while(--_0x185c54){_0x1b02a6['push'](_0x1b02a6['shift']());}};_0x31c442(++_0x74f890);}(_0x720f,0x1e0));var _0xf720=function(_0x25bea7,_0x49ab45){_0x25bea7=_0x25bea7-0x0;var _0x175952=_0x720f[_0x25bea7];return _0x175952;};'use strict';var multer=require(_0xf720('0x0'));var util=require(_0xf720('0x1'));var path=require(_0xf720('0x2'));var timeout=require(_0xf720('0x3'));var express=require('express');var router=express[_0xf720('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xf720('0x5'));var interaction=require(_0xf720('0x6'));var config=require(_0xf720('0x7'));var controller=require(_0xf720('0x8'));router[_0xf720('0x9')]('/',auth[_0xf720('0xa')](),controller[_0xf720('0xb')]);router[_0xf720('0x9')](_0xf720('0xc'),auth[_0xf720('0xa')](),controller['show']);router[_0xf720('0x9')](_0xf720('0xd'),auth[_0xf720('0xa')](),controller[_0xf720('0xe')]);router[_0xf720('0x9')]('/:id/fields',auth[_0xf720('0xa')](),controller[_0xf720('0xf')]);router[_0xf720('0x10')]('/',auth[_0xf720('0xa')](),controller[_0xf720('0x11')]);router['post']('/:id/configurations',auth[_0xf720('0xa')](),controller[_0xf720('0x12')]);router[_0xf720('0x13')](_0xf720('0xc'),auth['isAuthenticated'](),controller[_0xf720('0x14')]);router[_0xf720('0x15')](_0xf720('0xc'),auth[_0xf720('0xa')](),controller[_0xf720('0x16')]);module['exports']=router; \ No newline at end of file +var _0x1dce=['path','connect-timeout','express','fs-extra','../../config/environment','get','isAuthenticated','index','/:id','/:id/configurations','getConfigurations','/:id/fields','getFields','create','addConfiguration','put','update','delete','exports','multer'];(function(_0x255d5b,_0x4f6f35){var _0x3e141a=function(_0x249ee2){while(--_0x249ee2){_0x255d5b['push'](_0x255d5b['shift']());}};_0x3e141a(++_0x4f6f35);}(_0x1dce,0x1f3));var _0xe1dc=function(_0x41b2bb,_0x4324e3){_0x41b2bb=_0x41b2bb-0x0;var _0x7e369b=_0x1dce[_0x41b2bb];return _0x7e369b;};'use strict';var multer=require(_0xe1dc('0x0'));var util=require('util');var path=require(_0xe1dc('0x1'));var timeout=require(_0xe1dc('0x2'));var express=require(_0xe1dc('0x3'));var router=express['Router']();var fs_extra=require(_0xe1dc('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xe1dc('0x5'));var controller=require('./intDynamics365Account.controller');router[_0xe1dc('0x6')]('/',auth[_0xe1dc('0x7')](),controller[_0xe1dc('0x8')]);router['get'](_0xe1dc('0x9'),auth['isAuthenticated'](),controller['show']);router[_0xe1dc('0x6')](_0xe1dc('0xa'),auth[_0xe1dc('0x7')](),controller[_0xe1dc('0xb')]);router['get'](_0xe1dc('0xc'),auth['isAuthenticated'](),controller[_0xe1dc('0xd')]);router['post']('/',auth[_0xe1dc('0x7')](),controller[_0xe1dc('0xe')]);router['post'](_0xe1dc('0xa'),auth[_0xe1dc('0x7')](),controller[_0xe1dc('0xf')]);router[_0xe1dc('0x10')](_0xe1dc('0x9'),auth['isAuthenticated'](),controller[_0xe1dc('0x11')]);router[_0xe1dc('0x12')]('/:id',auth[_0xe1dc('0x7')](),controller['destroy']);module[_0xe1dc('0x13')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.attributes.js b/server/api/intDynamics365Account/intDynamics365Account.attributes.js index 9067afc..f273a75 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 _0x539d=['STRING','sequelize'];(function(_0x41482a,_0x2fece6){var _0x574b03=function(_0x4750a9){while(--_0x4750a9){_0x41482a['push'](_0x41482a['shift']());}};_0x574b03(++_0x2fece6);}(_0x539d,0x17b));var _0xd539=function(_0x3cec45,_0x37d817){_0x3cec45=_0x3cec45-0x0;var _0x51d691=_0x539d[_0x3cec45];return _0x51d691;};'use strict';var Sequelize=require(_0xd539('0x0'));module['exports']={'name':{'type':Sequelize[_0xd539('0x1')]},'username':{'type':Sequelize[_0xd539('0x1')]},'password':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize['STRING']},'tenantId':{'type':Sequelize[_0xd539('0x1')]},'clientId':{'type':Sequelize[_0xd539('0x1')]},'clientSecret':{'type':Sequelize[_0xd539('0x1')]},'serverUrl':{'type':Sequelize[_0xd539('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0xd539('0x1')]},'modernAuthentication':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file +var _0xf360=['STRING','BOOLEAN','sequelize','exports'];(function(_0x719cfb,_0x28037c){var _0x6ec12f=function(_0x6cd353){while(--_0x6cd353){_0x719cfb['push'](_0x719cfb['shift']());}};_0x6ec12f(++_0x28037c);}(_0xf360,0x9e));var _0x0f36=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0xf360[_0x2c91e9];return _0x13f0ff;};'use strict';var Sequelize=require(_0x0f36('0x0'));module[_0x0f36('0x1')]={'name':{'type':Sequelize[_0x0f36('0x2')]},'username':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0x0f36('0x2')]},'remoteUri':{'type':Sequelize['STRING']},'tenantId':{'type':Sequelize[_0x0f36('0x2')]},'clientId':{'type':Sequelize[_0x0f36('0x2')]},'clientSecret':{'type':Sequelize[_0x0f36('0x2')]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0x0f36('0x2')]},'modernAuthentication':{'type':Sequelize[_0x0f36('0x3')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.controller.js b/server/api/intDynamics365Account/intDynamics365Account.controller.js index 9c175cb..5892160 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 _0xcf3b=['clientSecret','modernAuthentication','CloudProvider','data5','access_token','data7','POST','/oauth2/token','password','GET','Bearer\x20','4.0','value','EntityDefinitions(',')?$select=LogicalName&$expand=Attributes($select=LogicalName)','Attributes','remove','LogicalName','forEach','@odata.type','PicklistAttributeMetadata','MetadataId','all','isNil','BooleanAttributeMetadata','BigIntAttributeMetadata','IntegerAttributeMetadata','MemoAttributeMetadata','StateAttributeMetadata','push','concat','test','statusCode','Wrong\x20credentials',')/Attributes(',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','OptionSet','Options','UserLocalizedLabel','Label','Value','DisplayName',')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','TrueOption','true','false',')/Microsoft.Dynamics.CRM.','?$select=DisplayName,LogicalName','lodash','../../components/parsers/qs','../../config/logger','api','../../mysqldb','../../components/integrations/configuration','status','json','offset','limit','count','set','Content-Range','update','then','destroy','end','error','stack','name','send','index','map','Dynamics365Account','rawAttributes','fieldName','type','key','model','keys','filters','intersection','attributes','fields','query','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','includeAll','rows','catch','show','params','length','options','create','body','find','getConfigurations','findOne','Dynamics365Configuration','addConfiguration','AccountId','Subjects','getSubjects','Descriptions','channel','slice','substring','lastIndexOf','format','%s/api/data/v9.0/','getFields','ticketType','incident','Incident','PhoneCall','title','customerid','ownerid','caseorigincode','subject','phonenumber','regardingobjectid','directioncode','phonecall_activity_parties','accountidname','accountidyominame','billedserviceunits','contactidname','contractidname','createdbyexternalpartyname','createdbyexternalpartyyominame','createdbyyominame','createdonbehalfbyname','customeridname','customeridtype','customeridyominame','entitlementidname','entityimage_timestamp','escalatedon','exchangerate','firstresponsebykpiidname','followupby','kbarticleidname','lastonholdtime','modifiedbyexternalpartyname','modifiedbyexternalpartyyominame','modifiedbyname','modifiedon','modifiedonbehalfbyname','modifiedonbehalfbyyominame','msdyn_incidenttypename','numberofchildincidents','overriddencreatedon','owneridname','owneridtype','owneridyominame','parentcaseidname','primarycontactidname','primarycontactidyominame','prioritycodename','productidname','productserialnumber','resolveby','resolvebykpiidname','responsiblecontactidname','responsiblecontactidyominame','sentimentvalue','slainvokedidname','slaname','socialprofileidname','statecode','statuscode','subjectidname','ticketnumber','timezoneruleversionnumber','transactioncurrencyidname','traversedpath','versionnumber','username','remoteUri','tenantId','clientId'];(function(_0x54f89f,_0x1843d2){var _0x3b560c=function(_0x5c893d){while(--_0x5c893d){_0x54f89f['push'](_0x54f89f['shift']());}};_0x3b560c(++_0x1843d2);}(_0xcf3b,0xee));var _0xbcf3=function(_0x1c5f9a,_0x288491){_0x1c5f9a=_0x1c5f9a-0x0;var _0x46a5bd=_0xcf3b[_0x1c5f9a];return _0x46a5bd;};'use strict';var rp=require('request-promise');var util=require('util');var _=require(_0xbcf3('0x0'));var qs=require(_0xbcf3('0x1'));var logger=require(_0xbcf3('0x2'))(_0xbcf3('0x3'));var db=require(_0xbcf3('0x4'))['db'];var integrations=require(_0xbcf3('0x5'));function respondWithResult(_0x506c9d,_0x9fe60c){_0x9fe60c=_0x9fe60c||0xc8;return function(_0x25722a){if(_0x25722a){return _0x506c9d[_0xbcf3('0x6')](_0x9fe60c)[_0xbcf3('0x7')](_0x25722a);}};}function respondWithFilteredResult(_0x5442e5,_0x4c7d3a){return function(_0xfef604){if(_0xfef604){var _0x15274c=typeof _0x4c7d3a[_0xbcf3('0x8')]==='undefined'&&typeof _0x4c7d3a[_0xbcf3('0x9')]==='undefined';var _0x5ee69a=_0xfef604[_0xbcf3('0xa')];var _0x475798=_0x15274c?0x0:_0x4c7d3a['offset'];var _0x19d09b=_0x15274c?_0xfef604[_0xbcf3('0xa')]:_0x4c7d3a[_0xbcf3('0x8')]+_0x4c7d3a['limit'];var _0x3efeda;if(_0x19d09b>=_0x5ee69a){_0x19d09b=_0x5ee69a;_0x3efeda=0xc8;}else{_0x3efeda=0xce;}_0x5442e5['status'](_0x3efeda);return _0x5442e5[_0xbcf3('0xb')](_0xbcf3('0xc'),_0x475798+'-'+_0x19d09b+'/'+_0x5ee69a)[_0xbcf3('0x7')](_0xfef604);}return null;};}function saveUpdates(_0x90fd82){return function(_0x161c2f){if(_0x161c2f){return _0x161c2f[_0xbcf3('0xd')](_0x90fd82)[_0xbcf3('0xe')](function(_0xb6664b){return _0xb6664b;});}return null;};}function removeEntity(_0x18ee99){return function(_0x4cf601){if(_0x4cf601){return _0x4cf601[_0xbcf3('0xf')]()[_0xbcf3('0xe')](function(){_0x18ee99[_0xbcf3('0x6')](0xcc)[_0xbcf3('0x10')]();});}};}function handleEntityNotFound(_0x26fe87){return function(_0x420555){if(!_0x420555){_0x26fe87['sendStatus'](0x194);}return _0x420555;};}function handleError(_0x21e8a5,_0x5fd88d){_0x5fd88d=_0x5fd88d||0x1f4;return function(_0x42ba60){logger[_0xbcf3('0x11')](_0x42ba60[_0xbcf3('0x12')]);if(_0x42ba60[_0xbcf3('0x13')]){delete _0x42ba60['name'];}_0x21e8a5['status'](_0x5fd88d)[_0xbcf3('0x14')](_0x42ba60);};}exports[_0xbcf3('0x15')]=function(_0x2b28af,_0x17cea1){var _0x42d96c={},_0x4b394b={},_0x2932f9={'count':0x0,'rows':[]};var _0x39ce6a=_[_0xbcf3('0x16')](db[_0xbcf3('0x17')][_0xbcf3('0x18')],function(_0xea77d){return{'name':_0xea77d[_0xbcf3('0x19')],'type':_0xea77d[_0xbcf3('0x1a')][_0xbcf3('0x1b')]};});_0x4b394b[_0xbcf3('0x1c')]=_[_0xbcf3('0x16')](_0x39ce6a,_0xbcf3('0x13'));_0x4b394b['query']=_[_0xbcf3('0x1d')](_0x2b28af['query']);_0x4b394b[_0xbcf3('0x1e')]=_[_0xbcf3('0x1f')](_0x4b394b[_0xbcf3('0x1c')],_0x4b394b['query']);_0x42d96c[_0xbcf3('0x20')]=_[_0xbcf3('0x1f')](_0x4b394b[_0xbcf3('0x1c')],qs[_0xbcf3('0x21')](_0x2b28af[_0xbcf3('0x22')][_0xbcf3('0x21')]));_0x42d96c[_0xbcf3('0x20')]=_0x42d96c['attributes']['length']?_0x42d96c['attributes']:_0x4b394b[_0xbcf3('0x1c')];if(!_0x2b28af[_0xbcf3('0x22')][_0xbcf3('0x23')](_0xbcf3('0x24'))){_0x42d96c['limit']=qs[_0xbcf3('0x9')](_0x2b28af[_0xbcf3('0x22')]['limit']);_0x42d96c[_0xbcf3('0x8')]=qs['offset'](_0x2b28af[_0xbcf3('0x22')][_0xbcf3('0x8')]);}_0x42d96c[_0xbcf3('0x25')]=qs[_0xbcf3('0x26')](_0x2b28af[_0xbcf3('0x22')][_0xbcf3('0x26')]);_0x42d96c[_0xbcf3('0x27')]=qs[_0xbcf3('0x1e')](_[_0xbcf3('0x28')](_0x2b28af[_0xbcf3('0x22')],_0x4b394b[_0xbcf3('0x1e')]),_0x39ce6a);if(_0x2b28af[_0xbcf3('0x22')][_0xbcf3('0x29')]){_0x42d96c[_0xbcf3('0x27')]=_['merge'](_0x42d96c[_0xbcf3('0x27')],{'$or':_['map'](_0x39ce6a,function(_0x3a3235){if(_0x3a3235['type']!==_0xbcf3('0x2a')){var _0x45d9fc={};_0x45d9fc[_0x3a3235[_0xbcf3('0x13')]]={'$like':'%'+_0x2b28af[_0xbcf3('0x22')][_0xbcf3('0x29')]+'%'};return _0x45d9fc;}})});}_0x42d96c=_[_0xbcf3('0x2b')]({},_0x42d96c,_0x2b28af['options']);var _0x2c6a42={'where':_0x42d96c[_0xbcf3('0x27')]};return db[_0xbcf3('0x17')]['count'](_0x2c6a42)['then'](function(_0x427285){_0x2932f9['count']=_0x427285;if(_0x2b28af['query'][_0xbcf3('0x2c')]){_0x42d96c['include']=[{'all':!![]}];}return db[_0xbcf3('0x17')]['findAll'](_0x42d96c);})[_0xbcf3('0xe')](function(_0x15fb87){_0x2932f9[_0xbcf3('0x2d')]=_0x15fb87;return _0x2932f9;})['then'](respondWithFilteredResult(_0x17cea1,_0x42d96c))[_0xbcf3('0x2e')](handleError(_0x17cea1,null));};exports[_0xbcf3('0x2f')]=function(_0x2abb92,_0x515b03){var _0x8e63d7={'raw':![],'where':{'id':_0x2abb92[_0xbcf3('0x30')]['id']}},_0x57b18e={};_0x57b18e[_0xbcf3('0x1c')]=_[_0xbcf3('0x1d')](db[_0xbcf3('0x17')][_0xbcf3('0x18')]);_0x57b18e[_0xbcf3('0x22')]=_['keys'](_0x2abb92[_0xbcf3('0x22')]);_0x57b18e['filters']=_['intersection'](_0x57b18e['model'],_0x57b18e[_0xbcf3('0x22')]);_0x8e63d7[_0xbcf3('0x20')]=_[_0xbcf3('0x1f')](_0x57b18e[_0xbcf3('0x1c')],qs[_0xbcf3('0x21')](_0x2abb92[_0xbcf3('0x22')][_0xbcf3('0x21')]));_0x8e63d7[_0xbcf3('0x20')]=_0x8e63d7[_0xbcf3('0x20')][_0xbcf3('0x31')]?_0x8e63d7[_0xbcf3('0x20')]:_0x57b18e['model'];if(_0x2abb92['query'][_0xbcf3('0x2c')]){_0x8e63d7['include']=[{'all':!![]}];}_0x8e63d7=_[_0xbcf3('0x2b')]({},_0x8e63d7,_0x2abb92[_0xbcf3('0x32')]);return db[_0xbcf3('0x17')]['find'](_0x8e63d7)['then'](handleEntityNotFound(_0x515b03,null))[_0xbcf3('0xe')](respondWithResult(_0x515b03,null))[_0xbcf3('0x2e')](handleError(_0x515b03,null));};exports[_0xbcf3('0x33')]=function(_0x5cf0e4,_0x172783){return db[_0xbcf3('0x17')]['create'](_0x5cf0e4[_0xbcf3('0x34')],{})[_0xbcf3('0xe')](respondWithResult(_0x172783,0xc9))[_0xbcf3('0x2e')](handleError(_0x172783,null));};exports['update']=function(_0x14b33b,_0x27f92c){if(_0x14b33b['body']['id']){delete _0x14b33b[_0xbcf3('0x34')]['id'];}return db[_0xbcf3('0x17')][_0xbcf3('0x35')]({'where':{'id':_0x14b33b['params']['id']}})[_0xbcf3('0xe')](handleEntityNotFound(_0x27f92c,null))['then'](saveUpdates(_0x14b33b[_0xbcf3('0x34')],null))[_0xbcf3('0xe')](respondWithResult(_0x27f92c,null))[_0xbcf3('0x2e')](handleError(_0x27f92c,null));};exports[_0xbcf3('0xf')]=function(_0x4ad7bc,_0x503f74){return db['Dynamics365Account'][_0xbcf3('0x35')]({'where':{'id':_0x4ad7bc[_0xbcf3('0x30')]['id']}})[_0xbcf3('0xe')](handleEntityNotFound(_0x503f74,null))[_0xbcf3('0xe')](removeEntity(_0x503f74,null))[_0xbcf3('0x2e')](handleError(_0x503f74,null));};exports[_0xbcf3('0x36')]=function(_0x3a6ec5,_0x3803ef){var _0x4034a4={};var _0x395b32={};var _0x5c4962;var _0x56359f;return db['Dynamics365Account'][_0xbcf3('0x37')]({'where':{'id':_0x3a6ec5['params']['id']}})['then'](handleEntityNotFound(_0x3803ef,null))['then'](function(_0x14c8f7){if(_0x14c8f7){_0x5c4962=_0x14c8f7;_0x395b32[_0xbcf3('0x1c')]=_[_0xbcf3('0x1d')](db[_0xbcf3('0x38')][_0xbcf3('0x18')]);_0x395b32[_0xbcf3('0x22')]=_[_0xbcf3('0x1d')](_0x3a6ec5[_0xbcf3('0x22')]);_0x395b32[_0xbcf3('0x1e')]=_['intersection'](_0x395b32[_0xbcf3('0x1c')],_0x395b32[_0xbcf3('0x22')]);_0x4034a4['attributes']=_['intersection'](_0x395b32[_0xbcf3('0x1c')],qs['fields'](_0x3a6ec5[_0xbcf3('0x22')][_0xbcf3('0x21')]));_0x4034a4[_0xbcf3('0x20')]=_0x4034a4[_0xbcf3('0x20')][_0xbcf3('0x31')]?_0x4034a4[_0xbcf3('0x20')]:_0x395b32['model'];_0x4034a4['order']=qs['sort'](_0x3a6ec5[_0xbcf3('0x22')][_0xbcf3('0x26')]);_0x4034a4[_0xbcf3('0x27')]=qs['filters'](_[_0xbcf3('0x28')](_0x3a6ec5['query'],_0x395b32[_0xbcf3('0x1e')]));if(_0x3a6ec5[_0xbcf3('0x22')]['filter']){_0x4034a4[_0xbcf3('0x27')]=_['merge'](_0x4034a4['where'],{'$or':_[_0xbcf3('0x16')](_0x4034a4[_0xbcf3('0x20')],function(_0x3a50ac){var _0x2b82ca={};_0x2b82ca[_0x3a50ac]={'$like':'%'+_0x3a6ec5[_0xbcf3('0x22')][_0xbcf3('0x29')]+'%'};return _0x2b82ca;})});}_0x4034a4=_['merge']({},_0x4034a4,_0x3a6ec5[_0xbcf3('0x32')]);return _0x5c4962['getConfigurations'](_0x4034a4);}})[_0xbcf3('0xe')](function(_0x1532c4){if(_0x1532c4){_0x56359f=_0x1532c4[_0xbcf3('0x31')];if(!_0x3a6ec5[_0xbcf3('0x22')]['hasOwnProperty'](_0xbcf3('0x24'))){_0x4034a4[_0xbcf3('0x9')]=qs[_0xbcf3('0x9')](_0x3a6ec5[_0xbcf3('0x22')][_0xbcf3('0x9')]);_0x4034a4[_0xbcf3('0x8')]=qs[_0xbcf3('0x8')](_0x3a6ec5['query'][_0xbcf3('0x8')]);}return _0x5c4962[_0xbcf3('0x36')](_0x4034a4);}})['then'](function(_0xa2b16f){if(_0xa2b16f){return _0xa2b16f?{'count':_0x56359f,'rows':_0xa2b16f}:null;}})[_0xbcf3('0xe')](respondWithResult(_0x3803ef,null))[_0xbcf3('0x2e')](handleError(_0x3803ef,null));};exports[_0xbcf3('0x39')]=function(_0x4da0af,_0x23c7f5){if(_0x4da0af[_0xbcf3('0x34')]['id']){delete _0x4da0af[_0xbcf3('0x34')]['id'];}return db[_0xbcf3('0x17')]['findOne']({'where':{'id':_0x4da0af['params']['id']}})[_0xbcf3('0xe')](handleEntityNotFound(_0x23c7f5,null))[_0xbcf3('0xe')](function(_0x2f53b0){if(_0x2f53b0){_0x4da0af['body'][_0xbcf3('0x3a')]=_0x2f53b0['id'];_0x4da0af[_0xbcf3('0x34')][_0xbcf3('0x3b')]=integrations[_0xbcf3('0x3c')](_0x4da0af['body']['channel'],_0x4da0af[_0xbcf3('0x34')]['type']);_0x4da0af['body'][_0xbcf3('0x3d')]=integrations['getDescriptions'](_0x4da0af[_0xbcf3('0x34')][_0xbcf3('0x3e')],_0x4da0af['body']['type']);return db[_0xbcf3('0x38')][_0xbcf3('0x33')](_0x4da0af[_0xbcf3('0x34')],{'include':[{'model':db['Dynamics365Field'],'as':_0xbcf3('0x3b')},{'model':db['Dynamics365Field'],'as':_0xbcf3('0x3d')}]});}return null;})[_0xbcf3('0xe')](respondWithResult(_0x23c7f5,null))[_0xbcf3('0x2e')](handleError(_0x23c7f5,null));};function sanitizeRemoteUri(_0x4d9097){var _0x1635fe=_0x4d9097[_0xbcf3('0x3f')](-0x1);if(_0x1635fe==='/')return _0x4d9097[_0xbcf3('0x40')](0x0,_0x4d9097[_0xbcf3('0x41')](_0x1635fe));return _0x4d9097;}function getWebApiUrl(_0x43bc6d){return util[_0xbcf3('0x42')](_0xbcf3('0x43'),_0x43bc6d);}exports[_0xbcf3('0x44')]=function(_0x220267,_0x42592f){var _0x1f63a0=_0x220267['query'][_0xbcf3('0x45')];var _0x366185=_0x1f63a0===_0xbcf3('0x46')?_0xbcf3('0x47'):_0xbcf3('0x48');var _0x2c1cfc='';var _0x5ab4e9='';var _0x232700='';var _0xba79af='';var _0x4b41e5='';var _0x35cff8='';var _0x46b1bf='';var _0x2e372c='';var _0x41517e=[_0xbcf3('0x49'),'description',_0xbcf3('0x4a'),_0xbcf3('0x4b'),_0xbcf3('0x4c'),_0xbcf3('0x4d'),_0xbcf3('0x4e'),_0xbcf3('0x4f'),_0xbcf3('0x50'),_0xbcf3('0x51')];var _0x5ac2ea=[_0xbcf3('0x52'),_0xbcf3('0x53'),'actualserviceunits',_0xbcf3('0x54'),_0xbcf3('0x55'),'contactidyominame','contractdetailidname',_0xbcf3('0x56'),_0xbcf3('0x57'),_0xbcf3('0x58'),'createdbyname',_0xbcf3('0x59'),'createdon',_0xbcf3('0x5a'),'createdonbehalfbyyominame',_0xbcf3('0x5b'),_0xbcf3('0x5c'),_0xbcf3('0x5d'),'emailaddress',_0xbcf3('0x5e'),_0xbcf3('0x5f'),'entityimage_url',_0xbcf3('0x60'),_0xbcf3('0x61'),_0xbcf3('0x62'),_0xbcf3('0x63'),'importsequencenumber','influencescore',_0xbcf3('0x64'),_0xbcf3('0x65'),'masteridname',_0xbcf3('0x66'),_0xbcf3('0x67'),_0xbcf3('0x68'),'modifiedbyyominame',_0xbcf3('0x69'),_0xbcf3('0x6a'),_0xbcf3('0x6b'),_0xbcf3('0x6c'),'msdyn_iotalertname',_0xbcf3('0x6d'),'onholdtime',_0xbcf3('0x6e'),_0xbcf3('0x6f'),_0xbcf3('0x70'),_0xbcf3('0x71'),_0xbcf3('0x72'),_0xbcf3('0x73'),_0xbcf3('0x74'),_0xbcf3('0x75'),_0xbcf3('0x76'),_0xbcf3('0x77'),_0xbcf3('0x78'),_0xbcf3('0x79'),'responseby',_0xbcf3('0x7a'),_0xbcf3('0x7b'),_0xbcf3('0x7c'),_0xbcf3('0x7d'),_0xbcf3('0x7e'),_0xbcf3('0x7f'),_0xbcf3('0x80'),_0xbcf3('0x81'),_0xbcf3('0x82'),_0xbcf3('0x83'),_0xbcf3('0x84'),_0xbcf3('0x85'),_0xbcf3('0x86'),'utcconversiontimezonecode',_0xbcf3('0x87')];var _0x28cbd2=_0x41517e['concat'](_0x5ac2ea);return db[_0xbcf3('0x17')][_0xbcf3('0x37')]({'where':{'id':_0x220267['params']['id']},'attributes':['id',_0xbcf3('0x88'),'password',_0xbcf3('0x89'),_0xbcf3('0x8a'),_0xbcf3('0x8b'),_0xbcf3('0x8c'),_0xbcf3('0x8d')],'include':[{'model':db[_0xbcf3('0x8e')],'as':_0xbcf3('0x8e'),'attributes':['id',_0xbcf3('0x8f'),'data7']}]})[_0xbcf3('0xe')](handleEntityNotFound(_0x42592f,null))['then'](function(_0x2d7e6c){if(_0x2d7e6c){if(_0x2d7e6c['modernAuthentication']){_0x2d7e6c[_0xbcf3('0x90')]=_0x2d7e6c[_0xbcf3('0x8e')][_0xbcf3('0x8f')];_0x2e372c=sanitizeRemoteUri(_0x2d7e6c[_0xbcf3('0x8e')][_0xbcf3('0x91')]);_0x46b1bf=getWebApiUrl(_0x2e372c);return _0x2d7e6c;}_0x2e372c=sanitizeRemoteUri(_0x2d7e6c['remoteUri']);_0x46b1bf=getWebApiUrl(_0x2e372c);var _0x2ccbd5={'method':_0xbcf3('0x92'),'uri':'https://login.microsoftonline.com/'+_0x2d7e6c[_0xbcf3('0x8a')]+_0xbcf3('0x93'),'form':{'client_id':_0x2d7e6c[_0xbcf3('0x8b')],'resource':_0x2e372c,'username':_0x2d7e6c[_0xbcf3('0x88')],'password':_0x2d7e6c[_0xbcf3('0x94')],'grant_type':_0xbcf3('0x94'),'client_secret':_0x2d7e6c['clientSecret']},'json':!![]};return rp(_0x2ccbd5);}})['then'](function(_0x5efbf6){_0x35cff8=_0x5efbf6['access_token'];var _0x351a70={'method':_0xbcf3('0x95'),'uri':encodeURI(_0x46b1bf+'EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27'+_0x366185+'\x27'),'headers':{'Authorization':_0xbcf3('0x96')+_0x35cff8,'If-None-Match':null,'OData-Version':_0xbcf3('0x97')},'json':!![]};return rp(_0x351a70);})[_0xbcf3('0xe')](function(_0x59e01e){var _0x8da568=_0x59e01e[_0xbcf3('0x98')][0x0];var _0x5e63df=_0x8da568['MetadataId'];var _0x3b6624={'method':_0xbcf3('0x95'),'uri':_0x46b1bf+_0xbcf3('0x99')+_0x5e63df+_0xbcf3('0x9a'),'headers':{'Authorization':'Bearer\x20'+_0x35cff8,'If-None-Match':null,'OData-Version':_0xbcf3('0x97')},'json':!![]};return rp(_0x3b6624);})[_0xbcf3('0xe')](function(_0x2e7172){_0x2c1cfc=_0x2e7172;_0x5ab4e9=_0x2c1cfc[_0xbcf3('0x9b')];_0x5ab4e9=_[_0xbcf3('0x9c')](_0x5ab4e9,function(_0x4d0cec){return!_0x28cbd2['includes'](_0x4d0cec[_0xbcf3('0x9d')]);});var _0x2e9613=[];var _0xe8be4c=[];_0x5ab4e9[_0xbcf3('0x9e')](function(_0x510bef){if(_0x510bef[_0xbcf3('0x9f')]){var _0x1231cc=_0x510bef[_0xbcf3('0x9f')][_0xbcf3('0x40')](_0x510bef['@odata.type']['lastIndexOf']('.')+0x1);if(_0x1231cc===_0xbcf3('0xa0')){_0x2e9613['push'](getSelectList(_0x46b1bf,_0x1f63a0,_0xe8be4c,_0x2c1cfc['MetadataId'],_0x510bef[_0xbcf3('0xa1')],_0x35cff8));}}});return Promise[_0xbcf3('0xa2')](_0x2e9613);})[_0xbcf3('0xe')](function(_0x4e9996){_0x232700=_0x4e9996[0x0];var _0x47bd3d=[];var _0x3ec209=[];_0x5ab4e9[_0xbcf3('0x9e')](function(_0x71fdcd){if(!_[_0xbcf3('0xa3')](_0x71fdcd[_0xbcf3('0x9f')])){var _0x1c8e1d=_0x71fdcd['@odata.type'][_0xbcf3('0x40')](_0x71fdcd[_0xbcf3('0x9f')][_0xbcf3('0x41')]('.')+0x1);if(_0x1c8e1d===_0xbcf3('0xa4')){_0x47bd3d['push'](getBooleanList(_0x46b1bf,_0x1f63a0,_0x3ec209,_0x2c1cfc[_0xbcf3('0xa1')],_0x71fdcd['MetadataId'],_0x35cff8));}}});return Promise[_0xbcf3('0xa2')](_0x47bd3d);})[_0xbcf3('0xe')](function(_0x13d024){_0xba79af=_0x13d024[0x0];var _0x54c79a=[];var _0x1a86f7=[];_0x5ab4e9['forEach'](function(_0xb5248e){if(_0xb5248e[_0xbcf3('0x9f')]){var _0x242ef7=_0xb5248e[_0xbcf3('0x9f')][_0xbcf3('0x40')](_0xb5248e[_0xbcf3('0x9f')]['lastIndexOf']('.')+0x1);if(_0x242ef7==='StringAttributeMetadata'||_0x242ef7==='DoubleAttributeMetadata'||_0x242ef7===_0xbcf3('0xa5')||_0x242ef7===_0xbcf3('0xa6')||_0x242ef7===_0xbcf3('0xa7')||_0x242ef7==='DateTimeAttributeMetadata'||_0x242ef7==='StatusAttributeMetadata'||_0x242ef7==='EntityNameAttributeMetadata'||_0x242ef7===_0xbcf3('0xa8')||_0x242ef7==='DecimalAttributeMetadata'){_0x54c79a[_0xbcf3('0xa9')](getInputList(_0x46b1bf,_0x1f63a0,_0x242ef7,_0x1a86f7,_0x2c1cfc[_0xbcf3('0xa1')],_0xb5248e[_0xbcf3('0xa1')],_0x35cff8));}}});return Promise[_0xbcf3('0xa2')](_0x54c79a);})[_0xbcf3('0xe')](function(_0x58ed73){_0x4b41e5=_0x58ed73[0x0];var _0x131dfa=_0x232700[_0xbcf3('0xaa')](_0xba79af)['concat'](_0x4b41e5);var _0x314d90={'count':_0x131dfa[_0xbcf3('0x31')],'rows':_0x131dfa};return _0x314d90;})[_0xbcf3('0xe')](respondWithResult(_0x42592f,null))[_0xbcf3('0x2e')](function(_0x28cbdc){var _0x58f87b=_0x220267[_0xbcf3('0x22')][_0xbcf3('0xab')]?0x1f4:_0x28cbdc[_0xbcf3('0xac')]||0x1f4;logger['error'](_0x28cbdc[_0xbcf3('0x12')]);delete _0x28cbdc['name'];if(_0x58f87b===0x191){_0x58f87b=0x190;}_0x42592f['status'](_0x58f87b)[_0xbcf3('0x14')](_0x220267[_0xbcf3('0x22')][_0xbcf3('0xab')]?{'message':_0xbcf3('0xad'),'statusCode':_0x28cbdc[_0xbcf3('0xac')]}:_0x28cbdc);});};function getSelectList(_0x39932e,_0x516e68,_0x20d07b,_0x1367a9,_0xac4a3f,_0x52ab20){var _0x18db3c={'method':'GET','uri':_0x39932e+_0xbcf3('0x99')+_0x1367a9+_0xbcf3('0xae')+_0xac4a3f+_0xbcf3('0xaf')+_0xbcf3('0xb0'),'headers':{'Authorization':_0xbcf3('0x96')+_0x52ab20,'If-None-Match':null,'OData-Version':_0xbcf3('0x97')},'json':!![]};return rp(_0x18db3c)[_0xbcf3('0xe')](function(_0x52cda3){var _0x44b522=[];var _0x1abb4a=_0x52cda3[_0xbcf3('0xb1')][_0xbcf3('0xb2')];_0x1abb4a[_0xbcf3('0x9e')](function(_0x503e27){_0x44b522[_0xbcf3('0xa9')]({'name':_0x503e27['Label'][_0xbcf3('0xb3')][_0xbcf3('0xb4')],'value':String(_0x503e27[_0xbcf3('0xb5')])});});var _0x3eca3a={'id':_0x516e68+'_'+_0x52cda3[_0xbcf3('0x9d')],'name':_0x52cda3[_0xbcf3('0xb6')][_0xbcf3('0xb3')][_0xbcf3('0xb4')],'custom':![],'options':_0x44b522};_0x20d07b[_0xbcf3('0xa9')](_0x3eca3a);return _0x20d07b;});}function getBooleanList(_0x37f492,_0x394b29,_0x45cc7a,_0x3d90f2,_0x4e5d2e,_0x520d5e){var _0x4fe160={'method':_0xbcf3('0x95'),'uri':_0x37f492+_0xbcf3('0x99')+_0x3d90f2+')/Attributes('+_0x4e5d2e+_0xbcf3('0xb7'),'headers':{'Authorization':_0xbcf3('0x96')+_0x520d5e,'If-None-Match':null,'OData-Version':_0xbcf3('0x97')},'json':!![]};return rp(_0x4fe160)[_0xbcf3('0xe')](function(_0x5e1c24){var _0x19582f=[];_0x19582f['push']({'name':_0x5e1c24['OptionSet'][_0xbcf3('0xb8')][_0xbcf3('0xb4')][_0xbcf3('0xb3')][_0xbcf3('0xb4')],'value':_0xbcf3('0xb9')},{'name':_0x5e1c24['OptionSet']['FalseOption'][_0xbcf3('0xb4')][_0xbcf3('0xb3')][_0xbcf3('0xb4')],'value':_0xbcf3('0xba')});var _0x4d100a={'id':_0x394b29+'_'+_0x5e1c24[_0xbcf3('0x9d')],'name':_0x5e1c24[_0xbcf3('0xb6')][_0xbcf3('0xb3')][_0xbcf3('0xb4')],'custom':![],'options':_0x19582f};_0x45cc7a[_0xbcf3('0xa9')](_0x4d100a);return _0x45cc7a;});}function getInputList(_0x3f5a01,_0xd80d29,_0x4f4c27,_0x1c62f2,_0x22ca14,_0x14622b,_0x42e04b){var _0x2f0dc8={'method':_0xbcf3('0x95'),'uri':_0x3f5a01+'EntityDefinitions('+_0x22ca14+')/Attributes('+_0x14622b+_0xbcf3('0xbb')+_0x4f4c27+_0xbcf3('0xbc'),'headers':{'Authorization':_0xbcf3('0x96')+_0x42e04b,'If-None-Match':null,'OData-Version':_0xbcf3('0x97')},'json':!![]};return rp(_0x2f0dc8)[_0xbcf3('0xe')](function(_0x1d8a1c){var _0x1e04f7={'id':_0xd80d29+'_'+_0x1d8a1c[_0xbcf3('0x9d')],'name':_0x1d8a1c[_0xbcf3('0xb6')][_0xbcf3('0xb3')]?_0x1d8a1c[_0xbcf3('0xb6')][_0xbcf3('0xb3')]['Label']:_0x1d8a1c[_0xbcf3('0x9d')],'custom':![],'options':[]};_0x1c62f2[_0xbcf3('0xa9')](_0x1e04f7);return _0x1c62f2;});} \ No newline at end of file +var _0xc17d=['createdonbehalfbyname','createdonbehalfbyyominame','customeridtype','customeridyominame','emailaddress','escalatedon','exchangerate','firstresponsebykpiidname','followupby','importsequencenumber','kbarticleidname','lastonholdtime','masteridname','modifiedbyexternalpartyname','modifiedbyexternalpartyyominame','modifiedbyyominame','modifiedon','modifiedonbehalfbyyominame','msdyn_incidenttypename','numberofchildincidents','onholdtime','overriddencreatedon','owneridname','owneridtype','primarycontactidname','primarycontactidyominame','productidname','productserialnumber','resolveby','resolvebykpiidname','responseby','responsiblecontactidname','responsiblecontactidyominame','sentimentvalue','slainvokedidname','slaname','socialprofileidname','statuscode','ticketnumber','versionnumber','concat','username','password','remoteUri','clientId','clientSecret','CloudProvider','data5','modernAuthentication','https://login.microsoftonline.com/','tenantId','/oauth2/token','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','Bearer\x20','4.0','MetadataId','GET','EntityDefinitions(',')?$select=LogicalName&$expand=Attributes($select=LogicalName)','Attributes','remove','LogicalName','forEach','@odata.type','PicklistAttributeMetadata','push','isNil','BooleanAttributeMetadata','StringAttributeMetadata','DoubleAttributeMetadata','BigIntAttributeMetadata','MemoAttributeMetadata','DateTimeAttributeMetadata','StateAttributeMetadata','DecimalAttributeMetadata','test','statusCode','Wrong\x20credentials',')/Attributes(','OptionSet','Options','Value','UserLocalizedLabel','Label',')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','TrueOption','true','DisplayName',')/Microsoft.Dynamics.CRM.','?$select=DisplayName,LogicalName','util','../../config/logger','api','../../components/integrations/configuration','status','json','offset','undefined','limit','set','Content-Range','update','destroy','then','end','sendStatus','error','stack','name','send','index','map','Dynamics365Account','rawAttributes','fieldName','type','query','keys','filters','intersection','attributes','model','fields','nolimit','order','sort','pick','where','merge','VIRTUAL','options','count','includeAll','include','show','params','length','find','create','body','catch','getConfigurations','findOne','filter','hasOwnProperty','addConfiguration','Subjects','Descriptions','getDescriptions','channel','Dynamics365Configuration','Dynamics365Field','slice','substring','lastIndexOf','format','%s/api/data/v9.0/','getFields','incident','Incident','PhoneCall','description','customerid','caseorigincode','subject','phonenumber','directioncode','accountidyominame','actualserviceunits','contactidname','contactidyominame','contractdetailidname','createdbyexternalpartyname','createdbyexternalpartyyominame','createdbyyominame','createdon'];(function(_0x4a3be0,_0xfd3c52){var _0x7bc703=function(_0x145992){while(--_0x145992){_0x4a3be0['push'](_0x4a3be0['shift']());}};_0x7bc703(++_0xfd3c52);}(_0xc17d,0x10a));var _0xdc17=function(_0xdd46e8,_0x1b3b76){_0xdd46e8=_0xdd46e8-0x0;var _0x2283c5=_0xc17d[_0xdd46e8];return _0x2283c5;};'use strict';var rp=require('request-promise');var util=require(_0xdc17('0x0'));var _=require('lodash');var qs=require('../../components/parsers/qs');var logger=require(_0xdc17('0x1'))(_0xdc17('0x2'));var db=require('../../mysqldb')['db'];var integrations=require(_0xdc17('0x3'));function respondWithResult(_0x26bed3,_0x50feb3){_0x50feb3=_0x50feb3||0xc8;return function(_0x633a63){if(_0x633a63){return _0x26bed3[_0xdc17('0x4')](_0x50feb3)[_0xdc17('0x5')](_0x633a63);}};}function respondWithFilteredResult(_0x2801c5,_0x24a550){return function(_0x5b2ffa){if(_0x5b2ffa){var _0x59f959=typeof _0x24a550[_0xdc17('0x6')]===_0xdc17('0x7')&&typeof _0x24a550[_0xdc17('0x8')]===_0xdc17('0x7');var _0x3b85d8=_0x5b2ffa['count'];var _0x521455=_0x59f959?0x0:_0x24a550[_0xdc17('0x6')];var _0x5a1145=_0x59f959?_0x5b2ffa['count']:_0x24a550[_0xdc17('0x6')]+_0x24a550['limit'];var _0x193e2a;if(_0x5a1145>=_0x3b85d8){_0x5a1145=_0x3b85d8;_0x193e2a=0xc8;}else{_0x193e2a=0xce;}_0x2801c5[_0xdc17('0x4')](_0x193e2a);return _0x2801c5[_0xdc17('0x9')](_0xdc17('0xa'),_0x521455+'-'+_0x5a1145+'/'+_0x3b85d8)[_0xdc17('0x5')](_0x5b2ffa);}return null;};}function saveUpdates(_0x1aa520){return function(_0x316bc4){if(_0x316bc4){return _0x316bc4[_0xdc17('0xb')](_0x1aa520)['then'](function(_0x37e344){return _0x37e344;});}return null;};}function removeEntity(_0x470f20){return function(_0x366981){if(_0x366981){return _0x366981[_0xdc17('0xc')]()[_0xdc17('0xd')](function(){_0x470f20['status'](0xcc)[_0xdc17('0xe')]();});}};}function handleEntityNotFound(_0x2a5ba9){return function(_0x1996c8){if(!_0x1996c8){_0x2a5ba9[_0xdc17('0xf')](0x194);}return _0x1996c8;};}function handleError(_0x233cef,_0x1a36f7){_0x1a36f7=_0x1a36f7||0x1f4;return function(_0x49e552){logger[_0xdc17('0x10')](_0x49e552[_0xdc17('0x11')]);if(_0x49e552[_0xdc17('0x12')]){delete _0x49e552[_0xdc17('0x12')];}_0x233cef[_0xdc17('0x4')](_0x1a36f7)[_0xdc17('0x13')](_0x49e552);};}exports[_0xdc17('0x14')]=function(_0x312785,_0x244837){var _0x384035={},_0x1d9e66={},_0x2d1b17={'count':0x0,'rows':[]};var _0x5b4acb=_[_0xdc17('0x15')](db[_0xdc17('0x16')][_0xdc17('0x17')],function(_0x4326b4){return{'name':_0x4326b4[_0xdc17('0x18')],'type':_0x4326b4[_0xdc17('0x19')]['key']};});_0x1d9e66['model']=_['map'](_0x5b4acb,_0xdc17('0x12'));_0x1d9e66[_0xdc17('0x1a')]=_[_0xdc17('0x1b')](_0x312785[_0xdc17('0x1a')]);_0x1d9e66[_0xdc17('0x1c')]=_[_0xdc17('0x1d')](_0x1d9e66['model'],_0x1d9e66[_0xdc17('0x1a')]);_0x384035[_0xdc17('0x1e')]=_[_0xdc17('0x1d')](_0x1d9e66[_0xdc17('0x1f')],qs[_0xdc17('0x20')](_0x312785[_0xdc17('0x1a')]['fields']));_0x384035[_0xdc17('0x1e')]=_0x384035[_0xdc17('0x1e')]['length']?_0x384035[_0xdc17('0x1e')]:_0x1d9e66[_0xdc17('0x1f')];if(!_0x312785[_0xdc17('0x1a')]['hasOwnProperty'](_0xdc17('0x21'))){_0x384035[_0xdc17('0x8')]=qs[_0xdc17('0x8')](_0x312785[_0xdc17('0x1a')][_0xdc17('0x8')]);_0x384035[_0xdc17('0x6')]=qs['offset'](_0x312785[_0xdc17('0x1a')][_0xdc17('0x6')]);}_0x384035[_0xdc17('0x22')]=qs['sort'](_0x312785[_0xdc17('0x1a')][_0xdc17('0x23')]);_0x384035['where']=qs[_0xdc17('0x1c')](_[_0xdc17('0x24')](_0x312785['query'],_0x1d9e66[_0xdc17('0x1c')]),_0x5b4acb);if(_0x312785[_0xdc17('0x1a')]['filter']){_0x384035[_0xdc17('0x25')]=_[_0xdc17('0x26')](_0x384035[_0xdc17('0x25')],{'$or':_[_0xdc17('0x15')](_0x5b4acb,function(_0x42ceb0){if(_0x42ceb0[_0xdc17('0x19')]!==_0xdc17('0x27')){var _0x28ab7a={};_0x28ab7a[_0x42ceb0[_0xdc17('0x12')]]={'$like':'%'+_0x312785[_0xdc17('0x1a')]['filter']+'%'};return _0x28ab7a;}})});}_0x384035=_[_0xdc17('0x26')]({},_0x384035,_0x312785[_0xdc17('0x28')]);var _0x1039da={'where':_0x384035[_0xdc17('0x25')]};return db['Dynamics365Account'][_0xdc17('0x29')](_0x1039da)[_0xdc17('0xd')](function(_0xa657d2){_0x2d1b17[_0xdc17('0x29')]=_0xa657d2;if(_0x312785['query'][_0xdc17('0x2a')]){_0x384035[_0xdc17('0x2b')]=[{'all':!![]}];}return db[_0xdc17('0x16')]['findAll'](_0x384035);})[_0xdc17('0xd')](function(_0x569d9a){_0x2d1b17['rows']=_0x569d9a;return _0x2d1b17;})['then'](respondWithFilteredResult(_0x244837,_0x384035))['catch'](handleError(_0x244837,null));};exports[_0xdc17('0x2c')]=function(_0x4f2edc,_0xa376c){var _0x5dcc22={'raw':![],'where':{'id':_0x4f2edc[_0xdc17('0x2d')]['id']}},_0x525310={};_0x525310[_0xdc17('0x1f')]=_[_0xdc17('0x1b')](db[_0xdc17('0x16')][_0xdc17('0x17')]);_0x525310[_0xdc17('0x1a')]=_[_0xdc17('0x1b')](_0x4f2edc[_0xdc17('0x1a')]);_0x525310[_0xdc17('0x1c')]=_[_0xdc17('0x1d')](_0x525310[_0xdc17('0x1f')],_0x525310['query']);_0x5dcc22['attributes']=_[_0xdc17('0x1d')](_0x525310[_0xdc17('0x1f')],qs[_0xdc17('0x20')](_0x4f2edc[_0xdc17('0x1a')]['fields']));_0x5dcc22['attributes']=_0x5dcc22['attributes'][_0xdc17('0x2e')]?_0x5dcc22['attributes']:_0x525310[_0xdc17('0x1f')];if(_0x4f2edc[_0xdc17('0x1a')]['includeAll']){_0x5dcc22[_0xdc17('0x2b')]=[{'all':!![]}];}_0x5dcc22=_[_0xdc17('0x26')]({},_0x5dcc22,_0x4f2edc[_0xdc17('0x28')]);return db[_0xdc17('0x16')][_0xdc17('0x2f')](_0x5dcc22)['then'](handleEntityNotFound(_0xa376c,null))[_0xdc17('0xd')](respondWithResult(_0xa376c,null))['catch'](handleError(_0xa376c,null));};exports[_0xdc17('0x30')]=function(_0x118a5c,_0x387826){return db['Dynamics365Account']['create'](_0x118a5c[_0xdc17('0x31')],{})['then'](respondWithResult(_0x387826,0xc9))[_0xdc17('0x32')](handleError(_0x387826,null));};exports[_0xdc17('0xb')]=function(_0x2f6768,_0x1405a6){if(_0x2f6768['body']['id']){delete _0x2f6768[_0xdc17('0x31')]['id'];}return db[_0xdc17('0x16')][_0xdc17('0x2f')]({'where':{'id':_0x2f6768[_0xdc17('0x2d')]['id']}})[_0xdc17('0xd')](handleEntityNotFound(_0x1405a6,null))[_0xdc17('0xd')](saveUpdates(_0x2f6768[_0xdc17('0x31')],null))[_0xdc17('0xd')](respondWithResult(_0x1405a6,null))['catch'](handleError(_0x1405a6,null));};exports[_0xdc17('0xc')]=function(_0xc4c135,_0x333b95){return db[_0xdc17('0x16')][_0xdc17('0x2f')]({'where':{'id':_0xc4c135['params']['id']}})[_0xdc17('0xd')](handleEntityNotFound(_0x333b95,null))[_0xdc17('0xd')](removeEntity(_0x333b95,null))[_0xdc17('0x32')](handleError(_0x333b95,null));};exports[_0xdc17('0x33')]=function(_0x27c76b,_0x32d409){var _0x58ca5c={};var _0x2fa049={};var _0x228728;var _0x142db6;return db['Dynamics365Account'][_0xdc17('0x34')]({'where':{'id':_0x27c76b[_0xdc17('0x2d')]['id']}})[_0xdc17('0xd')](handleEntityNotFound(_0x32d409,null))['then'](function(_0x46a0f6){if(_0x46a0f6){_0x228728=_0x46a0f6;_0x2fa049[_0xdc17('0x1f')]=_['keys'](db['Dynamics365Configuration'][_0xdc17('0x17')]);_0x2fa049[_0xdc17('0x1a')]=_[_0xdc17('0x1b')](_0x27c76b['query']);_0x2fa049['filters']=_[_0xdc17('0x1d')](_0x2fa049[_0xdc17('0x1f')],_0x2fa049[_0xdc17('0x1a')]);_0x58ca5c[_0xdc17('0x1e')]=_[_0xdc17('0x1d')](_0x2fa049[_0xdc17('0x1f')],qs[_0xdc17('0x20')](_0x27c76b['query'][_0xdc17('0x20')]));_0x58ca5c[_0xdc17('0x1e')]=_0x58ca5c['attributes'][_0xdc17('0x2e')]?_0x58ca5c[_0xdc17('0x1e')]:_0x2fa049[_0xdc17('0x1f')];_0x58ca5c[_0xdc17('0x22')]=qs[_0xdc17('0x23')](_0x27c76b[_0xdc17('0x1a')][_0xdc17('0x23')]);_0x58ca5c[_0xdc17('0x25')]=qs[_0xdc17('0x1c')](_[_0xdc17('0x24')](_0x27c76b[_0xdc17('0x1a')],_0x2fa049['filters']));if(_0x27c76b[_0xdc17('0x1a')][_0xdc17('0x35')]){_0x58ca5c['where']=_[_0xdc17('0x26')](_0x58ca5c['where'],{'$or':_[_0xdc17('0x15')](_0x58ca5c['attributes'],function(_0x1f8594){var _0x12921f={};_0x12921f[_0x1f8594]={'$like':'%'+_0x27c76b[_0xdc17('0x1a')][_0xdc17('0x35')]+'%'};return _0x12921f;})});}_0x58ca5c=_[_0xdc17('0x26')]({},_0x58ca5c,_0x27c76b[_0xdc17('0x28')]);return _0x228728[_0xdc17('0x33')](_0x58ca5c);}})[_0xdc17('0xd')](function(_0x296af5){if(_0x296af5){_0x142db6=_0x296af5['length'];if(!_0x27c76b['query'][_0xdc17('0x36')](_0xdc17('0x21'))){_0x58ca5c[_0xdc17('0x8')]=qs['limit'](_0x27c76b['query'][_0xdc17('0x8')]);_0x58ca5c[_0xdc17('0x6')]=qs[_0xdc17('0x6')](_0x27c76b[_0xdc17('0x1a')][_0xdc17('0x6')]);}return _0x228728[_0xdc17('0x33')](_0x58ca5c);}})['then'](function(_0x2e8862){if(_0x2e8862){return _0x2e8862?{'count':_0x142db6,'rows':_0x2e8862}:null;}})[_0xdc17('0xd')](respondWithResult(_0x32d409,null))[_0xdc17('0x32')](handleError(_0x32d409,null));};exports[_0xdc17('0x37')]=function(_0x5c5972,_0x2fd3dd){if(_0x5c5972[_0xdc17('0x31')]['id']){delete _0x5c5972[_0xdc17('0x31')]['id'];}return db['Dynamics365Account'][_0xdc17('0x34')]({'where':{'id':_0x5c5972[_0xdc17('0x2d')]['id']}})[_0xdc17('0xd')](handleEntityNotFound(_0x2fd3dd,null))[_0xdc17('0xd')](function(_0x1090b4){if(_0x1090b4){_0x5c5972['body']['AccountId']=_0x1090b4['id'];_0x5c5972[_0xdc17('0x31')][_0xdc17('0x38')]=integrations['getSubjects'](_0x5c5972['body']['channel'],_0x5c5972['body'][_0xdc17('0x19')]);_0x5c5972[_0xdc17('0x31')][_0xdc17('0x39')]=integrations[_0xdc17('0x3a')](_0x5c5972['body'][_0xdc17('0x3b')],_0x5c5972['body'][_0xdc17('0x19')]);return db[_0xdc17('0x3c')]['create'](_0x5c5972[_0xdc17('0x31')],{'include':[{'model':db[_0xdc17('0x3d')],'as':_0xdc17('0x38')},{'model':db['Dynamics365Field'],'as':'Descriptions'}]});}return null;})[_0xdc17('0xd')](respondWithResult(_0x2fd3dd,null))[_0xdc17('0x32')](handleError(_0x2fd3dd,null));};function sanitizeRemoteUri(_0x473890){var _0x374a81=_0x473890[_0xdc17('0x3e')](-0x1);if(_0x374a81==='/')return _0x473890[_0xdc17('0x3f')](0x0,_0x473890[_0xdc17('0x40')](_0x374a81));return _0x473890;}function getWebApiUrl(_0x135107){return util[_0xdc17('0x41')](_0xdc17('0x42'),_0x135107);}exports[_0xdc17('0x43')]=function(_0x39dc04,_0x1e07e6){var _0x5b1664=_0x39dc04[_0xdc17('0x1a')]['ticketType'];var _0x17515a=_0x5b1664===_0xdc17('0x44')?_0xdc17('0x45'):_0xdc17('0x46');var _0x22c9ca='';var _0x567175='';var _0x28e0a3='';var _0x5bf168='';var _0x3f9cf3='';var _0x1c1a57='';var _0x283ab4='';var _0xc6b92d='';var _0x1b844c=['title',_0xdc17('0x47'),_0xdc17('0x48'),'ownerid',_0xdc17('0x49'),_0xdc17('0x4a'),_0xdc17('0x4b'),'regardingobjectid',_0xdc17('0x4c'),'phonecall_activity_parties'];var _0xfb12f4=['accountidname',_0xdc17('0x4d'),_0xdc17('0x4e'),'billedserviceunits',_0xdc17('0x4f'),_0xdc17('0x50'),_0xdc17('0x51'),'contractidname',_0xdc17('0x52'),_0xdc17('0x53'),'createdbyname',_0xdc17('0x54'),_0xdc17('0x55'),_0xdc17('0x56'),_0xdc17('0x57'),'customeridname',_0xdc17('0x58'),_0xdc17('0x59'),_0xdc17('0x5a'),'entitlementidname','entityimage_timestamp','entityimage_url',_0xdc17('0x5b'),_0xdc17('0x5c'),_0xdc17('0x5d'),_0xdc17('0x5e'),_0xdc17('0x5f'),'influencescore',_0xdc17('0x60'),_0xdc17('0x61'),_0xdc17('0x62'),_0xdc17('0x63'),_0xdc17('0x64'),'modifiedbyname',_0xdc17('0x65'),_0xdc17('0x66'),'modifiedonbehalfbyname',_0xdc17('0x67'),_0xdc17('0x68'),'msdyn_iotalertname',_0xdc17('0x69'),_0xdc17('0x6a'),_0xdc17('0x6b'),_0xdc17('0x6c'),_0xdc17('0x6d'),'owneridyominame','parentcaseidname',_0xdc17('0x6e'),_0xdc17('0x6f'),'prioritycodename',_0xdc17('0x70'),_0xdc17('0x71'),_0xdc17('0x72'),_0xdc17('0x73'),_0xdc17('0x74'),_0xdc17('0x75'),_0xdc17('0x76'),_0xdc17('0x77'),_0xdc17('0x78'),_0xdc17('0x79'),_0xdc17('0x7a'),'statecode',_0xdc17('0x7b'),'subjectidname',_0xdc17('0x7c'),'timezoneruleversionnumber','transactioncurrencyidname','traversedpath','utcconversiontimezonecode',_0xdc17('0x7d')];var _0x2544c9=_0x1b844c[_0xdc17('0x7e')](_0xfb12f4);return db[_0xdc17('0x16')]['findOne']({'where':{'id':_0x39dc04[_0xdc17('0x2d')]['id']},'attributes':['id',_0xdc17('0x7f'),_0xdc17('0x80'),_0xdc17('0x81'),'tenantId',_0xdc17('0x82'),_0xdc17('0x83'),'modernAuthentication'],'include':[{'model':db[_0xdc17('0x84')],'as':_0xdc17('0x84'),'attributes':['id',_0xdc17('0x85'),'data7']}]})[_0xdc17('0xd')](handleEntityNotFound(_0x1e07e6,null))[_0xdc17('0xd')](function(_0x40690a){if(_0x40690a){if(_0x40690a[_0xdc17('0x86')]){_0x40690a['access_token']=_0x40690a[_0xdc17('0x84')][_0xdc17('0x85')];_0xc6b92d=sanitizeRemoteUri(_0x40690a[_0xdc17('0x84')]['data7']);_0x283ab4=getWebApiUrl(_0xc6b92d);return _0x40690a;}_0xc6b92d=sanitizeRemoteUri(_0x40690a['remoteUri']);_0x283ab4=getWebApiUrl(_0xc6b92d);var _0x847853={'method':'POST','uri':_0xdc17('0x87')+_0x40690a[_0xdc17('0x88')]+_0xdc17('0x89'),'form':{'client_id':_0x40690a[_0xdc17('0x82')],'resource':_0xc6b92d,'username':_0x40690a[_0xdc17('0x7f')],'password':_0x40690a[_0xdc17('0x80')],'grant_type':_0xdc17('0x80'),'client_secret':_0x40690a[_0xdc17('0x83')]},'json':!![]};return rp(_0x847853);}})['then'](function(_0x5c0a35){_0x1c1a57=_0x5c0a35['access_token'];var _0xed22cf={'method':'GET','uri':encodeURI(_0x283ab4+_0xdc17('0x8a')+_0x17515a+'\x27'),'headers':{'Authorization':_0xdc17('0x8b')+_0x1c1a57,'If-None-Match':null,'OData-Version':_0xdc17('0x8c')},'json':!![]};return rp(_0xed22cf);})[_0xdc17('0xd')](function(_0x2a7666){var _0x2e6730=_0x2a7666['value'][0x0];var _0x5cdab0=_0x2e6730[_0xdc17('0x8d')];var _0x3da541={'method':_0xdc17('0x8e'),'uri':_0x283ab4+_0xdc17('0x8f')+_0x5cdab0+_0xdc17('0x90'),'headers':{'Authorization':_0xdc17('0x8b')+_0x1c1a57,'If-None-Match':null,'OData-Version':_0xdc17('0x8c')},'json':!![]};return rp(_0x3da541);})['then'](function(_0x29f00d){_0x22c9ca=_0x29f00d;_0x567175=_0x22c9ca[_0xdc17('0x91')];_0x567175=_[_0xdc17('0x92')](_0x567175,function(_0x2196a1){return!_0x2544c9['includes'](_0x2196a1[_0xdc17('0x93')]);});var _0x5298ae=[];var _0x4eb777=[];_0x567175[_0xdc17('0x94')](function(_0xacb0cf){if(_0xacb0cf[_0xdc17('0x95')]){var _0x1af7d2=_0xacb0cf[_0xdc17('0x95')]['substring'](_0xacb0cf[_0xdc17('0x95')][_0xdc17('0x40')]('.')+0x1);if(_0x1af7d2===_0xdc17('0x96')){_0x5298ae[_0xdc17('0x97')](getSelectList(_0x283ab4,_0x5b1664,_0x4eb777,_0x22c9ca[_0xdc17('0x8d')],_0xacb0cf[_0xdc17('0x8d')],_0x1c1a57));}}});return Promise['all'](_0x5298ae);})[_0xdc17('0xd')](function(_0x243c29){_0x28e0a3=_0x243c29[0x0];var _0x2939c7=[];var _0x1bb52d=[];_0x567175[_0xdc17('0x94')](function(_0x2ad6af){if(!_[_0xdc17('0x98')](_0x2ad6af[_0xdc17('0x95')])){var _0x48301a=_0x2ad6af['@odata.type'][_0xdc17('0x3f')](_0x2ad6af[_0xdc17('0x95')][_0xdc17('0x40')]('.')+0x1);if(_0x48301a===_0xdc17('0x99')){_0x2939c7[_0xdc17('0x97')](getBooleanList(_0x283ab4,_0x5b1664,_0x1bb52d,_0x22c9ca[_0xdc17('0x8d')],_0x2ad6af[_0xdc17('0x8d')],_0x1c1a57));}}});return Promise['all'](_0x2939c7);})[_0xdc17('0xd')](function(_0x1366fc){_0x5bf168=_0x1366fc[0x0];var _0x24dff6=[];var _0x546f0d=[];_0x567175['forEach'](function(_0x496dfc){if(_0x496dfc['@odata.type']){var _0x5e9c00=_0x496dfc['@odata.type'][_0xdc17('0x3f')](_0x496dfc[_0xdc17('0x95')][_0xdc17('0x40')]('.')+0x1);if(_0x5e9c00===_0xdc17('0x9a')||_0x5e9c00===_0xdc17('0x9b')||_0x5e9c00===_0xdc17('0x9c')||_0x5e9c00==='IntegerAttributeMetadata'||_0x5e9c00===_0xdc17('0x9d')||_0x5e9c00===_0xdc17('0x9e')||_0x5e9c00==='StatusAttributeMetadata'||_0x5e9c00==='EntityNameAttributeMetadata'||_0x5e9c00===_0xdc17('0x9f')||_0x5e9c00===_0xdc17('0xa0')){_0x24dff6[_0xdc17('0x97')](getInputList(_0x283ab4,_0x5b1664,_0x5e9c00,_0x546f0d,_0x22c9ca[_0xdc17('0x8d')],_0x496dfc[_0xdc17('0x8d')],_0x1c1a57));}}});return Promise['all'](_0x24dff6);})['then'](function(_0x2b2863){_0x3f9cf3=_0x2b2863[0x0];var _0x528358=_0x28e0a3[_0xdc17('0x7e')](_0x5bf168)[_0xdc17('0x7e')](_0x3f9cf3);var _0x56fd2b={'count':_0x528358[_0xdc17('0x2e')],'rows':_0x528358};return _0x56fd2b;})[_0xdc17('0xd')](respondWithResult(_0x1e07e6,null))['catch'](function(_0x1fd180){var _0x54d8a6=_0x39dc04['query'][_0xdc17('0xa1')]?0x1f4:_0x1fd180[_0xdc17('0xa2')]||0x1f4;logger['error'](_0x1fd180[_0xdc17('0x11')]);delete _0x1fd180[_0xdc17('0x12')];if(_0x54d8a6===0x191){_0x54d8a6=0x190;}_0x1e07e6['status'](_0x54d8a6)[_0xdc17('0x13')](_0x39dc04[_0xdc17('0x1a')][_0xdc17('0xa1')]?{'message':_0xdc17('0xa3'),'statusCode':_0x1fd180[_0xdc17('0xa2')]}:_0x1fd180);});};function getSelectList(_0x1982f8,_0x33d864,_0x41c3d2,_0x3e4a0f,_0x447a79,_0x3b4cb7){var _0x2c5df0={'method':_0xdc17('0x8e'),'uri':_0x1982f8+_0xdc17('0x8f')+_0x3e4a0f+_0xdc17('0xa4')+_0x447a79+')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?'+'$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','headers':{'Authorization':'Bearer\x20'+_0x3b4cb7,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x2c5df0)[_0xdc17('0xd')](function(_0x18566c){var _0x261838=[];var _0x4e47c8=_0x18566c[_0xdc17('0xa5')][_0xdc17('0xa6')];_0x4e47c8[_0xdc17('0x94')](function(_0x1a4472){_0x261838['push']({'name':_0x1a4472['Label']['UserLocalizedLabel']['Label'],'value':String(_0x1a4472[_0xdc17('0xa7')])});});var _0x1033ba={'id':_0x33d864+'_'+_0x18566c[_0xdc17('0x93')],'name':_0x18566c['DisplayName'][_0xdc17('0xa8')][_0xdc17('0xa9')],'custom':![],'options':_0x261838};_0x41c3d2[_0xdc17('0x97')](_0x1033ba);return _0x41c3d2;});}function getBooleanList(_0x196432,_0x48a8c1,_0x289727,_0x4938e6,_0x1bbb48,_0x2483b7){var _0x2cdd21={'method':'GET','uri':_0x196432+_0xdc17('0x8f')+_0x4938e6+_0xdc17('0xa4')+_0x1bbb48+_0xdc17('0xaa'),'headers':{'Authorization':_0xdc17('0x8b')+_0x2483b7,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x2cdd21)['then'](function(_0x5d5413){var _0x4a7a94=[];_0x4a7a94[_0xdc17('0x97')]({'name':_0x5d5413[_0xdc17('0xa5')][_0xdc17('0xab')]['Label'][_0xdc17('0xa8')][_0xdc17('0xa9')],'value':_0xdc17('0xac')},{'name':_0x5d5413[_0xdc17('0xa5')]['FalseOption'][_0xdc17('0xa9')][_0xdc17('0xa8')][_0xdc17('0xa9')],'value':'false'});var _0x4984c1={'id':_0x48a8c1+'_'+_0x5d5413['LogicalName'],'name':_0x5d5413[_0xdc17('0xad')][_0xdc17('0xa8')][_0xdc17('0xa9')],'custom':![],'options':_0x4a7a94};_0x289727['push'](_0x4984c1);return _0x289727;});}function getInputList(_0x4854a9,_0x352c10,_0x3e0fd8,_0x1f26fb,_0xe870e5,_0x21f48d,_0x5cb98e){var _0x272859={'method':_0xdc17('0x8e'),'uri':_0x4854a9+_0xdc17('0x8f')+_0xe870e5+_0xdc17('0xa4')+_0x21f48d+_0xdc17('0xae')+_0x3e0fd8+_0xdc17('0xaf'),'headers':{'Authorization':_0xdc17('0x8b')+_0x5cb98e,'If-None-Match':null,'OData-Version':_0xdc17('0x8c')},'json':!![]};return rp(_0x272859)[_0xdc17('0xd')](function(_0x5667fe){var _0x45acb1={'id':_0x352c10+'_'+_0x5667fe[_0xdc17('0x93')],'name':_0x5667fe[_0xdc17('0xad')][_0xdc17('0xa8')]?_0x5667fe[_0xdc17('0xad')][_0xdc17('0xa8')][_0xdc17('0xa9')]:_0x5667fe[_0xdc17('0x93')],'custom':![],'options':[]};_0x1f26fb[_0xdc17('0x97')](_0x45acb1);return _0x1f26fb;});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.model.js b/server/api/intDynamics365Account/intDynamics365Account.model.js index a30f770..f31537c 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(_0x4bd67a,_0x4f9725){var _0x2be5fb=function(_0x33e132){while(--_0x33e132){_0x4bd67a['push'](_0x4bd67a['shift']());}};_0x2be5fb(++_0x4f9725);}(_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 _0xbaf0=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intDynamics365Account.attributes','../../components/integrations/configuration','exports','define','Dynamics365Account','util'];(function(_0x4bfbe8,_0x4b5f04){var _0xd853b9=function(_0x4908a1){while(--_0x4908a1){_0x4bfbe8['push'](_0x4bfbe8['shift']());}};_0xd853b9(++_0x4b5f04);}(_0xbaf0,0x12a));var _0x0baf=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0xbaf0[_0x2f5ac5];return _0x37c9a8;};'use strict';var _=require('lodash');var util=require(_0x0baf('0x0'));var logger=require(_0x0baf('0x1'))(_0x0baf('0x2'));var moment=require(_0x0baf('0x3'));var BPromise=require(_0x0baf('0x4'));var rp=require(_0x0baf('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0baf('0x6'));var config=require(_0x0baf('0x7'));var attributes=require(_0x0baf('0x8'));var integrations=require(_0x0baf('0x9'));module[_0x0baf('0xa')]=function(_0x335e24,_0x1a10b1){return _0x335e24[_0x0baf('0xb')](_0x0baf('0xc'),attributes,{'tableName':'int_dynamics365_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.rpc.js b/server/api/intDynamics365Account/intDynamics365Account.rpc.js index 0ec3448..988475a 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 _0x1a8b=['../../config/utils','../../config/logger','rpc','jayson/promise','http','request','info','Dynamics365Account,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','GetDynamics365Account','Dynamics365Account','options','raw','where','attributes','limit','include','map','model','then','ShowDynamics365Account','debug','lodash','util','moment','bluebird','ioredis','../../mysqldb'];(function(_0x3dca97,_0x486174){var _0x3cdd9a=function(_0x5f29c5){while(--_0x5f29c5){_0x3dca97['push'](_0x3dca97['shift']());}};_0x3cdd9a(++_0x486174);}(_0x1a8b,0x10a));var _0xb1a8=function(_0x59e40f,_0xd1588b){_0x59e40f=_0x59e40f-0x0;var _0x1532bd=_0x1a8b[_0x59e40f];return _0x1532bd;};'use strict';var _=require(_0xb1a8('0x0'));var util=require(_0xb1a8('0x1'));var moment=require(_0xb1a8('0x2'));var BPromise=require(_0xb1a8('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb1a8('0x4'));var db=require(_0xb1a8('0x5'))['db'];var utils=require(_0xb1a8('0x6'));var logger=require(_0xb1a8('0x7'))(_0xb1a8('0x8'));var config=require('../../config/environment');var jayson=require(_0xb1a8('0x9'));var client=jayson['client'][_0xb1a8('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1befb0,_0xcc083,_0x21360d){return new BPromise(function(_0x3362e1,_0x564c08){return client[_0xb1a8('0xb')](_0x1befb0,_0x21360d)['then'](function(_0x2053ca){logger[_0xb1a8('0xc')](_0xb1a8('0xd'),_0xcc083,_0xb1a8('0xe'));logger['debug']('Dynamics365Account,\x20%s,\x20%s,\x20%s',_0xcc083,'request\x20sent',JSON[_0xb1a8('0xf')](_0x2053ca));if(_0x2053ca[_0xb1a8('0x10')]){if(_0x2053ca[_0xb1a8('0x10')][_0xb1a8('0x11')]===0x1f4){logger['error'](_0xb1a8('0xd'),_0xcc083,_0x2053ca[_0xb1a8('0x10')][_0xb1a8('0x12')]);return _0x564c08(_0x2053ca[_0xb1a8('0x10')][_0xb1a8('0x12')]);}logger[_0xb1a8('0x10')]('Dynamics365Account,\x20%s,\x20%s',_0xcc083,_0x2053ca[_0xb1a8('0x10')][_0xb1a8('0x12')]);return _0x3362e1(_0x2053ca[_0xb1a8('0x10')]['message']);}else{logger[_0xb1a8('0xc')](_0xb1a8('0xd'),_0xcc083,_0xb1a8('0xe'));_0x3362e1(_0x2053ca[_0xb1a8('0x13')]['message']);}})[_0xb1a8('0x14')](function(_0x204fe9){logger[_0xb1a8('0x10')](_0xb1a8('0xd'),_0xcc083,_0x204fe9);_0x564c08(_0x204fe9);});});}exports[_0xb1a8('0x15')]=function(_0xccad2d){var _0x2e550c=this;return new Promise(function(_0x4cf595,_0x56b598){return db[_0xb1a8('0x16')]['findAll']({'raw':_0xccad2d['options']?_0xccad2d[_0xb1a8('0x17')][_0xb1a8('0x18')]===undefined?!![]:![]:!![],'where':_0xccad2d[_0xb1a8('0x17')]?_0xccad2d['options'][_0xb1a8('0x19')]||null:null,'attributes':_0xccad2d[_0xb1a8('0x17')]?_0xccad2d[_0xb1a8('0x17')][_0xb1a8('0x1a')]||null:null,'limit':_0xccad2d[_0xb1a8('0x17')]?_0xccad2d['options'][_0xb1a8('0x1b')]||null:null,'include':_0xccad2d[_0xb1a8('0x17')]?_0xccad2d['options'][_0xb1a8('0x1c')]?_[_0xb1a8('0x1d')](_0xccad2d[_0xb1a8('0x17')][_0xb1a8('0x1c')],function(_0x42ed0f){return{'model':db[_0x42ed0f[_0xb1a8('0x1e')]],'as':_0x42ed0f['as'],'attributes':_0x42ed0f['attributes'],'include':_0x42ed0f['include']?_['map'](_0x42ed0f['include'],function(_0x842c8c){return{'model':db[_0x842c8c['model']],'as':_0x842c8c['as'],'attributes':_0x842c8c[_0xb1a8('0x1a')],'include':_0x842c8c[_0xb1a8('0x1c')]?_[_0xb1a8('0x1d')](_0x842c8c[_0xb1a8('0x1c')],function(_0x4a9da5){return{'model':db[_0x4a9da5[_0xb1a8('0x1e')]],'as':_0x4a9da5['as'],'attributes':_0x4a9da5['attributes']};}):[]};}):[]};}):[]:[]})[_0xb1a8('0x1f')](function(_0x31370c){logger[_0xb1a8('0xc')]('GetDynamics365Account',_0xccad2d);logger['debug'](_0xb1a8('0x15'),_0xccad2d,JSON[_0xb1a8('0xf')](_0x31370c));_0x4cf595(_0x31370c);})[_0xb1a8('0x14')](function(_0x9e3c36){logger[_0xb1a8('0x10')]('GetDynamics365Account',_0x9e3c36['message'],_0xccad2d);_0x56b598(_0x2e550c[_0xb1a8('0x10')](0x1f4,_0x9e3c36[_0xb1a8('0x12')]));});});};exports[_0xb1a8('0x20')]=function(_0x2fa87b){var _0x338842=this;return new Promise(function(_0x2019b9,_0xbf29dd){return db[_0xb1a8('0x16')]['find']({'raw':_0x2fa87b[_0xb1a8('0x17')]?_0x2fa87b[_0xb1a8('0x17')][_0xb1a8('0x18')]===undefined?!![]:![]:!![],'where':_0x2fa87b[_0xb1a8('0x17')]?_0x2fa87b[_0xb1a8('0x17')]['where']||null:null,'attributes':_0x2fa87b['options']?_0x2fa87b[_0xb1a8('0x17')][_0xb1a8('0x1a')]||null:null,'include':_0x2fa87b[_0xb1a8('0x17')]?_0x2fa87b[_0xb1a8('0x17')][_0xb1a8('0x1c')]?_['map'](_0x2fa87b[_0xb1a8('0x17')][_0xb1a8('0x1c')],function(_0x317624){return{'model':db[_0x317624[_0xb1a8('0x1e')]],'as':_0x317624['as'],'attributes':_0x317624[_0xb1a8('0x1a')],'include':_0x317624[_0xb1a8('0x1c')]?_[_0xb1a8('0x1d')](_0x317624['include'],function(_0x4cefc8){return{'model':db[_0x4cefc8['model']],'as':_0x4cefc8['as'],'attributes':_0x4cefc8[_0xb1a8('0x1a')],'include':_0x4cefc8[_0xb1a8('0x1c')]?_[_0xb1a8('0x1d')](_0x4cefc8['include'],function(_0x217acb){return{'model':db[_0x217acb[_0xb1a8('0x1e')]],'as':_0x217acb['as'],'attributes':_0x217acb[_0xb1a8('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xb1a8('0x1f')](function(_0x25644d){logger[_0xb1a8('0xc')](_0xb1a8('0x20'),_0x2fa87b);logger[_0xb1a8('0x21')]('ShowDynamics365Account',_0x2fa87b,JSON[_0xb1a8('0xf')](_0x25644d));_0x2019b9(_0x25644d);})[_0xb1a8('0x14')](function(_0x325356){logger['error'](_0xb1a8('0x20'),_0x325356[_0xb1a8('0x12')],_0x2fa87b);_0xbf29dd(_0x338842[_0xb1a8('0x10')](0x1f4,_0x325356[_0xb1a8('0x12')]));});});}; \ No newline at end of file +var _0x94d2=['then','Dynamics365Account,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','Dynamics365Account','findAll','options','raw','where','limit','include','map','model','attributes','info','GetDynamics365Account','stringify','find','ShowDynamics365Account','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request'];(function(_0x1c9f90,_0x538898){var _0x2e0c4c=function(_0x458786){while(--_0x458786){_0x1c9f90['push'](_0x1c9f90['shift']());}};_0x2e0c4c(++_0x538898);}(_0x94d2,0x1e0));var _0x294d=function(_0x383dbb,_0x17d41b){_0x383dbb=_0x383dbb-0x0;var _0x6e8bde=_0x94d2[_0x383dbb];return _0x6e8bde;};'use strict';var _=require(_0x294d('0x0'));var util=require(_0x294d('0x1'));var moment=require(_0x294d('0x2'));var BPromise=require(_0x294d('0x3'));var rs=require(_0x294d('0x4'));var fs=require('fs');var Redis=require(_0x294d('0x5'));var db=require(_0x294d('0x6'))['db'];var utils=require(_0x294d('0x7'));var logger=require(_0x294d('0x8'))('rpc');var config=require(_0x294d('0x9'));var jayson=require(_0x294d('0xa'));var client=jayson[_0x294d('0xb')][_0x294d('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x40a465,_0x557e9f,_0x595119){return new BPromise(function(_0x29dc16,_0x37538f){return client[_0x294d('0xd')](_0x40a465,_0x595119)[_0x294d('0xe')](function(_0x5ab517){logger['info'](_0x294d('0xf'),_0x557e9f,_0x294d('0x10'));logger[_0x294d('0x11')]('Dynamics365Account,\x20%s,\x20%s,\x20%s',_0x557e9f,_0x294d('0x10'),JSON['stringify'](_0x5ab517));if(_0x5ab517[_0x294d('0x12')]){if(_0x5ab517['error'][_0x294d('0x13')]===0x1f4){logger[_0x294d('0x12')](_0x294d('0xf'),_0x557e9f,_0x5ab517[_0x294d('0x12')][_0x294d('0x14')]);return _0x37538f(_0x5ab517['error'][_0x294d('0x14')]);}logger[_0x294d('0x12')](_0x294d('0xf'),_0x557e9f,_0x5ab517[_0x294d('0x12')][_0x294d('0x14')]);return _0x29dc16(_0x5ab517[_0x294d('0x12')][_0x294d('0x14')]);}else{logger['info'](_0x294d('0xf'),_0x557e9f,_0x294d('0x10'));_0x29dc16(_0x5ab517[_0x294d('0x15')][_0x294d('0x14')]);}})[_0x294d('0x16')](function(_0x161d38){logger[_0x294d('0x12')](_0x294d('0xf'),_0x557e9f,_0x161d38);_0x37538f(_0x161d38);});});}exports['GetDynamics365Account']=function(_0x4aa08c){var _0x1af130=this;return new Promise(function(_0x4638e8,_0x311e41){return db[_0x294d('0x17')][_0x294d('0x18')]({'raw':_0x4aa08c[_0x294d('0x19')]?_0x4aa08c[_0x294d('0x19')][_0x294d('0x1a')]===undefined?!![]:![]:!![],'where':_0x4aa08c[_0x294d('0x19')]?_0x4aa08c['options'][_0x294d('0x1b')]||null:null,'attributes':_0x4aa08c[_0x294d('0x19')]?_0x4aa08c['options']['attributes']||null:null,'limit':_0x4aa08c[_0x294d('0x19')]?_0x4aa08c[_0x294d('0x19')][_0x294d('0x1c')]||null:null,'include':_0x4aa08c[_0x294d('0x19')]?_0x4aa08c[_0x294d('0x19')][_0x294d('0x1d')]?_[_0x294d('0x1e')](_0x4aa08c['options'][_0x294d('0x1d')],function(_0x53329d){return{'model':db[_0x53329d[_0x294d('0x1f')]],'as':_0x53329d['as'],'attributes':_0x53329d[_0x294d('0x20')],'include':_0x53329d['include']?_[_0x294d('0x1e')](_0x53329d['include'],function(_0x54eaf3){return{'model':db[_0x54eaf3[_0x294d('0x1f')]],'as':_0x54eaf3['as'],'attributes':_0x54eaf3[_0x294d('0x20')],'include':_0x54eaf3[_0x294d('0x1d')]?_[_0x294d('0x1e')](_0x54eaf3[_0x294d('0x1d')],function(_0x5051c1){return{'model':db[_0x5051c1[_0x294d('0x1f')]],'as':_0x5051c1['as'],'attributes':_0x5051c1['attributes']};}):[]};}):[]};}):[]:[]})[_0x294d('0xe')](function(_0x3de70f){logger[_0x294d('0x21')]('GetDynamics365Account',_0x4aa08c);logger[_0x294d('0x11')](_0x294d('0x22'),_0x4aa08c,JSON[_0x294d('0x23')](_0x3de70f));_0x4638e8(_0x3de70f);})[_0x294d('0x16')](function(_0x2fd558){logger['error'](_0x294d('0x22'),_0x2fd558[_0x294d('0x14')],_0x4aa08c);_0x311e41(_0x1af130[_0x294d('0x12')](0x1f4,_0x2fd558[_0x294d('0x14')]));});});};exports['ShowDynamics365Account']=function(_0x59d74b){var _0x4b80e8=this;return new Promise(function(_0x454cbb,_0x281a29){return db['Dynamics365Account'][_0x294d('0x24')]({'raw':_0x59d74b['options']?_0x59d74b['options'][_0x294d('0x1a')]===undefined?!![]:![]:!![],'where':_0x59d74b[_0x294d('0x19')]?_0x59d74b[_0x294d('0x19')]['where']||null:null,'attributes':_0x59d74b[_0x294d('0x19')]?_0x59d74b['options'][_0x294d('0x20')]||null:null,'include':_0x59d74b[_0x294d('0x19')]?_0x59d74b['options'][_0x294d('0x1d')]?_['map'](_0x59d74b['options']['include'],function(_0x3e0284){return{'model':db[_0x3e0284['model']],'as':_0x3e0284['as'],'attributes':_0x3e0284[_0x294d('0x20')],'include':_0x3e0284[_0x294d('0x1d')]?_[_0x294d('0x1e')](_0x3e0284['include'],function(_0xa41758){return{'model':db[_0xa41758['model']],'as':_0xa41758['as'],'attributes':_0xa41758['attributes'],'include':_0xa41758[_0x294d('0x1d')]?_[_0x294d('0x1e')](_0xa41758['include'],function(_0x14ec02){return{'model':db[_0x14ec02[_0x294d('0x1f')]],'as':_0x14ec02['as'],'attributes':_0x14ec02[_0x294d('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x349f30){logger[_0x294d('0x21')](_0x294d('0x25'),_0x59d74b);logger[_0x294d('0x11')](_0x294d('0x25'),_0x59d74b,JSON[_0x294d('0x23')](_0x349f30));_0x454cbb(_0x349f30);})[_0x294d('0x16')](function(_0x149764){logger[_0x294d('0x12')]('ShowDynamics365Account',_0x149764[_0x294d('0x14')],_0x59d74b);_0x281a29(_0x4b80e8[_0x294d('0x12')](0x1f4,_0x149764[_0x294d('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/index.js b/server/api/intDynamics365Configuration/index.js index cb53edc..c9e5fbd 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 _0x6df4=['/:id/fields','getSubjects','/:id/descriptions','getDescriptions','post','create','update','exports','multer','path','connect-timeout','../../components/auth/service','get','index','isAuthenticated','show'];(function(_0x1fe581,_0x505b64){var _0x393f2d=function(_0x1a8671){while(--_0x1a8671){_0x1fe581['push'](_0x1fe581['shift']());}};_0x393f2d(++_0x505b64);}(_0x6df4,0x78));var _0x46df=function(_0x1b2ff7,_0x12a034){_0x1b2ff7=_0x1b2ff7-0x0;var _0x31656a=_0x6df4[_0x1b2ff7];return _0x31656a;};'use strict';var multer=require(_0x46df('0x0'));var util=require('util');var path=require(_0x46df('0x1'));var timeout=require(_0x46df('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x46df('0x3'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./intDynamics365Configuration.controller');router[_0x46df('0x4')]('/',auth['isAuthenticated'](),controller[_0x46df('0x5')]);router[_0x46df('0x4')]('/:id',auth[_0x46df('0x6')](),controller[_0x46df('0x7')]);router[_0x46df('0x4')](_0x46df('0x8'),auth[_0x46df('0x6')](),controller['getFields']);router[_0x46df('0x4')]('/:id/subjects',auth[_0x46df('0x6')](),controller[_0x46df('0x9')]);router[_0x46df('0x4')](_0x46df('0xa'),auth['isAuthenticated'](),controller[_0x46df('0xb')]);router[_0x46df('0xc')]('/',auth[_0x46df('0x6')](),controller[_0x46df('0xd')]);router['put']('/:id',auth[_0x46df('0x6')](),controller[_0x46df('0xe')]);router['delete']('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x46df('0xf')]=router; \ No newline at end of file +var _0x3eae=['../../components/interaction/service','../../config/environment','./intDynamics365Configuration.controller','isAuthenticated','index','get','/:id','show','/:id/fields','/:id/subjects','getSubjects','getDescriptions','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra'];(function(_0x13bea0,_0x210a0c){var _0x3f12df=function(_0x11ef1c){while(--_0x11ef1c){_0x13bea0['push'](_0x13bea0['shift']());}};_0x3f12df(++_0x210a0c);}(_0x3eae,0x126));var _0xe3ea=function(_0x385c76,_0xb97335){_0x385c76=_0x385c76-0x0;var _0x5c8367=_0x3eae[_0x385c76];return _0x5c8367;};'use strict';var multer=require(_0xe3ea('0x0'));var util=require(_0xe3ea('0x1'));var path=require(_0xe3ea('0x2'));var timeout=require(_0xe3ea('0x3'));var express=require('express');var router=express[_0xe3ea('0x4')]();var fs_extra=require(_0xe3ea('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xe3ea('0x6'));var config=require(_0xe3ea('0x7'));var controller=require(_0xe3ea('0x8'));router['get']('/',auth[_0xe3ea('0x9')](),controller[_0xe3ea('0xa')]);router[_0xe3ea('0xb')](_0xe3ea('0xc'),auth[_0xe3ea('0x9')](),controller[_0xe3ea('0xd')]);router['get'](_0xe3ea('0xe'),auth[_0xe3ea('0x9')](),controller['getFields']);router[_0xe3ea('0xb')](_0xe3ea('0xf'),auth[_0xe3ea('0x9')](),controller[_0xe3ea('0x10')]);router[_0xe3ea('0xb')]('/:id/descriptions',auth[_0xe3ea('0x9')](),controller[_0xe3ea('0x11')]);router[_0xe3ea('0x12')]('/',auth['isAuthenticated'](),controller[_0xe3ea('0x13')]);router[_0xe3ea('0x14')](_0xe3ea('0xc'),auth[_0xe3ea('0x9')](),controller[_0xe3ea('0x15')]);router[_0xe3ea('0x16')]('/:id',auth['isAuthenticated'](),controller[_0xe3ea('0x17')]);module[_0xe3ea('0x18')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js index 51c6c56..e8e5e4d 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 _0xdc00=['STRING','ENUM','incident','contact','BOOLEAN','sequelize'];(function(_0xbb091,_0x3fe7ee){var _0x467a04=function(_0x3a978d){while(--_0x3a978d){_0xbb091['push'](_0xbb091['shift']());}};_0x467a04(++_0x3fe7ee);}(_0xdc00,0x1c1));var _0x0dc0=function(_0x1527e0,_0x43ca55){_0x1527e0=_0x1527e0-0x0;var _0xf8187c=_0xdc00[_0x1527e0];return _0xf8187c;};'use strict';var Sequelize=require(_0x0dc0('0x0'));module['exports']={'name':{'type':Sequelize[_0x0dc0('0x1')]},'description':{'type':Sequelize[_0x0dc0('0x1')]},'ticketType':{'type':Sequelize[_0x0dc0('0x2')](_0x0dc0('0x3'),'phonecall'),'defaultValue':_0x0dc0('0x3')},'moduleCreate':{'type':Sequelize[_0x0dc0('0x2')](_0x0dc0('0x4'),'nothing'),'defaultValue':_0x0dc0('0x4'),'allowNull':![]},'additionalSearchContact':{'type':Sequelize[_0x0dc0('0x1')],'allowNull':!![]},'openNewTab':{'type':Sequelize[_0x0dc0('0x5')],'defaultValue':!![]}}; \ No newline at end of file +var _0x0ee3=['BOOLEAN','exports','STRING','ENUM','contact','nothing'];(function(_0xf89ad3,_0x4a4a05){var _0x324449=function(_0xe7bab5){while(--_0xe7bab5){_0xf89ad3['push'](_0xf89ad3['shift']());}};_0x324449(++_0x4a4a05);}(_0x0ee3,0x187));var _0x30ee=function(_0x4f4f3d,_0x2cc448){_0x4f4f3d=_0x4f4f3d-0x0;var _0x4ac4a3=_0x0ee3[_0x4f4f3d];return _0x4ac4a3;};'use strict';var Sequelize=require('sequelize');module[_0x30ee('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x30ee('0x1')]},'ticketType':{'type':Sequelize['ENUM']('incident','phonecall'),'defaultValue':'incident'},'moduleCreate':{'type':Sequelize[_0x30ee('0x2')](_0x30ee('0x3'),_0x30ee('0x4')),'defaultValue':_0x30ee('0x3'),'allowNull':![]},'additionalSearchContact':{'type':Sequelize[_0x30ee('0x1')],'allowNull':!![]},'openNewTab':{'type':Sequelize[_0x30ee('0x5')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js index bede197..61d27d6 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 _0x440c=['../../config/utils','../../config/license/util','status','offset','undefined','limit','count','set','Content-Range','json','reject','update','then','end','sendStatus','stack','name','send','index','Dynamics365Configuration','rawAttributes','fieldName','type','model','map','filters','intersection','query','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','options','includeAll','findAll','rows','catch','show','params','keys','length','include','find','create','body','destroy','getFields','Dynamics365Field','getSubjects','findOne','getDescriptions','rimraf','zip-dir','fast-json-patch','bluebird','util','path','sox','to-csv','fs-extra','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api'];(function(_0x307108,_0x424a69){var _0x46dbda=function(_0x5d1a2b){while(--_0x5d1a2b){_0x307108['push'](_0x307108['shift']());}};_0x46dbda(++_0x424a69);}(_0x440c,0xcd));var _0xc440=function(_0x525bed,_0x14e3f6){_0x525bed=_0x525bed-0x0;var _0x2fdd05=_0x440c[_0x525bed];return _0x2fdd05;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc440('0x0'));var zipdir=require(_0xc440('0x1'));var jsonpatch=require(_0xc440('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xc440('0x3'));var Mustache=require('mustache');var util=require(_0xc440('0x4'));var path=require(_0xc440('0x5'));var sox=require(_0xc440('0x6'));var csv=require(_0xc440('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc440('0x8'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xc440('0x9'));var deskjs=require(_0xc440('0xa'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xc440('0xb'));var Redis=require('ioredis');var authService=require(_0xc440('0xc'));var qs=require(_0xc440('0xd'));var as=require(_0xc440('0xe'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xc440('0xf'))(_0xc440('0x10'));var utils=require(_0xc440('0x11'));var config=require('../../config/environment');var licenseUtil=require(_0xc440('0x12'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4447ae,_0x1795a1){_0x1795a1=_0x1795a1||0xcc;return function(_0x5e49b2){if(_0x5e49b2){return _0x4447ae['sendStatus'](_0x1795a1);}return _0x4447ae['status'](_0x1795a1)['end']();};}function respondWithResult(_0x279253,_0x2bcc92){_0x2bcc92=_0x2bcc92||0xc8;return function(_0xe7c19b){if(_0xe7c19b){return _0x279253[_0xc440('0x13')](_0x2bcc92)['json'](_0xe7c19b);}};}function respondWithFilteredResult(_0x383b3e,_0x4ca5a7){return function(_0x269fd1){if(_0x269fd1){var _0xfce0c8=typeof _0x4ca5a7[_0xc440('0x14')]===_0xc440('0x15')&&typeof _0x4ca5a7[_0xc440('0x16')]===_0xc440('0x15');var _0x3b0b2f=_0x269fd1[_0xc440('0x17')];var _0x2c302b=_0xfce0c8?0x0:_0x4ca5a7[_0xc440('0x14')];var _0x3c67ff=_0xfce0c8?_0x269fd1[_0xc440('0x17')]:_0x4ca5a7['offset']+_0x4ca5a7[_0xc440('0x16')];var _0x205bdb;if(_0x3c67ff>=_0x3b0b2f){_0x3c67ff=_0x3b0b2f;_0x205bdb=0xc8;}else{_0x205bdb=0xce;}_0x383b3e['status'](_0x205bdb);return _0x383b3e[_0xc440('0x18')](_0xc440('0x19'),_0x2c302b+'-'+_0x3c67ff+'/'+_0x3b0b2f)[_0xc440('0x1a')](_0x269fd1);}return null;};}function patchUpdates(_0x5cdcca){return function(_0x1790b1){try{jsonpatch['apply'](_0x1790b1,_0x5cdcca,!![]);}catch(_0x114a87){return BPromise[_0xc440('0x1b')](_0x114a87);}return _0x1790b1['save']();};}function saveUpdates(_0x444cef,_0x36ed55){return function(_0x152230){if(_0x152230){return _0x152230[_0xc440('0x1c')](_0x444cef)['then'](function(_0x2010f2){return _0x2010f2;});}return null;};}function removeEntity(_0x362ef6,_0x42fb69){return function(_0x8b690a){if(_0x8b690a){return _0x8b690a['destroy']()[_0xc440('0x1d')](function(){_0x362ef6[_0xc440('0x13')](0xcc)[_0xc440('0x1e')]();});}};}function handleEntityNotFound(_0x3440e9,_0x14242a){return function(_0x2bfd0f){if(!_0x2bfd0f){_0x3440e9[_0xc440('0x1f')](0x194);}return _0x2bfd0f;};}function handleError(_0x5ee8f3,_0x231dda){_0x231dda=_0x231dda||0x1f4;return function(_0x3bc685){logger['error'](_0x3bc685[_0xc440('0x20')]);if(_0x3bc685['name']){delete _0x3bc685[_0xc440('0x21')];}_0x5ee8f3[_0xc440('0x13')](_0x231dda)[_0xc440('0x22')](_0x3bc685);};}exports[_0xc440('0x23')]=function(_0x135eba,_0x43354c){var _0x51b426={},_0x8ffe44={},_0x1ebb19={'count':0x0,'rows':[]};var _0x169e2f=_['map'](db[_0xc440('0x24')][_0xc440('0x25')],function(_0x17c8dc){return{'name':_0x17c8dc[_0xc440('0x26')],'type':_0x17c8dc[_0xc440('0x27')]['key']};});_0x8ffe44[_0xc440('0x28')]=_[_0xc440('0x29')](_0x169e2f,_0xc440('0x21'));_0x8ffe44['query']=_['keys'](_0x135eba['query']);_0x8ffe44[_0xc440('0x2a')]=_[_0xc440('0x2b')](_0x8ffe44[_0xc440('0x28')],_0x8ffe44[_0xc440('0x2c')]);_0x51b426[_0xc440('0x2d')]=_['intersection'](_0x8ffe44[_0xc440('0x28')],qs[_0xc440('0x2e')](_0x135eba['query'][_0xc440('0x2e')]));_0x51b426[_0xc440('0x2d')]=_0x51b426['attributes']['length']?_0x51b426[_0xc440('0x2d')]:_0x8ffe44['model'];if(!_0x135eba[_0xc440('0x2c')][_0xc440('0x2f')](_0xc440('0x30'))){_0x51b426[_0xc440('0x16')]=qs[_0xc440('0x16')](_0x135eba[_0xc440('0x2c')]['limit']);_0x51b426[_0xc440('0x14')]=qs['offset'](_0x135eba['query'][_0xc440('0x14')]);}_0x51b426[_0xc440('0x31')]=qs[_0xc440('0x32')](_0x135eba[_0xc440('0x2c')][_0xc440('0x32')]);_0x51b426['where']=qs[_0xc440('0x2a')](_[_0xc440('0x33')](_0x135eba[_0xc440('0x2c')],_0x8ffe44['filters']),_0x169e2f);if(_0x135eba[_0xc440('0x2c')][_0xc440('0x34')]){_0x51b426[_0xc440('0x35')]=_['merge'](_0x51b426[_0xc440('0x35')],{'$or':_[_0xc440('0x29')](_0x169e2f,function(_0x16b346){if(_0x16b346['type']!=='VIRTUAL'){var _0xe76400={};_0xe76400[_0x16b346[_0xc440('0x21')]]={'$like':'%'+_0x135eba['query']['filter']+'%'};return _0xe76400;}})});}_0x51b426=_[_0xc440('0x36')]({},_0x51b426,_0x135eba[_0xc440('0x37')]);var _0x49e3f2={'where':_0x51b426['where']};return db[_0xc440('0x24')][_0xc440('0x17')](_0x49e3f2)[_0xc440('0x1d')](function(_0x32d0a7){_0x1ebb19[_0xc440('0x17')]=_0x32d0a7;if(_0x135eba[_0xc440('0x2c')][_0xc440('0x38')]){_0x51b426['include']=[{'all':!![]}];}return db[_0xc440('0x24')][_0xc440('0x39')](_0x51b426);})[_0xc440('0x1d')](function(_0xfc15ee){_0x1ebb19[_0xc440('0x3a')]=_0xfc15ee;return _0x1ebb19;})[_0xc440('0x1d')](respondWithFilteredResult(_0x43354c,_0x51b426))[_0xc440('0x3b')](handleError(_0x43354c,null));};exports[_0xc440('0x3c')]=function(_0x417809,_0x311f72){var _0x44eae0={'raw':![],'where':{'id':_0x417809[_0xc440('0x3d')]['id']}},_0x3e94b3={};_0x3e94b3['model']=_[_0xc440('0x3e')](db[_0xc440('0x24')][_0xc440('0x25')]);_0x3e94b3[_0xc440('0x2c')]=_[_0xc440('0x3e')](_0x417809[_0xc440('0x2c')]);_0x3e94b3[_0xc440('0x2a')]=_[_0xc440('0x2b')](_0x3e94b3[_0xc440('0x28')],_0x3e94b3[_0xc440('0x2c')]);_0x44eae0[_0xc440('0x2d')]=_[_0xc440('0x2b')](_0x3e94b3[_0xc440('0x28')],qs[_0xc440('0x2e')](_0x417809[_0xc440('0x2c')][_0xc440('0x2e')]));_0x44eae0['attributes']=_0x44eae0[_0xc440('0x2d')][_0xc440('0x3f')]?_0x44eae0[_0xc440('0x2d')]:_0x3e94b3['model'];if(_0x417809[_0xc440('0x2c')]['includeAll']){_0x44eae0[_0xc440('0x40')]=[{'all':!![]}];}_0x44eae0=_[_0xc440('0x36')]({},_0x44eae0,_0x417809[_0xc440('0x37')]);return db['Dynamics365Configuration'][_0xc440('0x41')](_0x44eae0)['then'](handleEntityNotFound(_0x311f72,null))[_0xc440('0x1d')](respondWithResult(_0x311f72,null))[_0xc440('0x3b')](handleError(_0x311f72,null));};exports[_0xc440('0x42')]=function(_0x4dd7e6,_0x1e4fd3){return db[_0xc440('0x24')][_0xc440('0x42')](_0x4dd7e6[_0xc440('0x43')],{})[_0xc440('0x1d')](respondWithResult(_0x1e4fd3,0xc9))[_0xc440('0x3b')](handleError(_0x1e4fd3,null));};exports[_0xc440('0x1c')]=function(_0x68b72e,_0x45f2e4){if(_0x68b72e[_0xc440('0x43')]['id']){delete _0x68b72e[_0xc440('0x43')]['id'];}return db[_0xc440('0x24')]['find']({'where':{'id':_0x68b72e['params']['id']}})[_0xc440('0x1d')](handleEntityNotFound(_0x45f2e4,null))[_0xc440('0x1d')](saveUpdates(_0x68b72e[_0xc440('0x43')],null))[_0xc440('0x1d')](respondWithResult(_0x45f2e4,null))['catch'](handleError(_0x45f2e4,null));};exports[_0xc440('0x44')]=function(_0x36cbdb,_0x9429a1){return db[_0xc440('0x24')][_0xc440('0x41')]({'where':{'id':_0x36cbdb['params']['id']}})[_0xc440('0x1d')](handleEntityNotFound(_0x9429a1,null))[_0xc440('0x1d')](removeEntity(_0x9429a1,null))[_0xc440('0x3b')](handleError(_0x9429a1,null));};exports[_0xc440('0x45')]=function(_0x336526,_0x1bf7aa,_0x439821){var _0x3b954e={};var _0x506cc2={};var _0x4883ad;var _0x481e6b;return db['Dynamics365Configuration']['findOne']({'where':{'id':_0x336526[_0xc440('0x3d')]['id']}})[_0xc440('0x1d')](handleEntityNotFound(_0x1bf7aa,null))[_0xc440('0x1d')](function(_0x1cd80f){if(_0x1cd80f){_0x4883ad=_0x1cd80f;_0x506cc2[_0xc440('0x28')]=_[_0xc440('0x3e')](db[_0xc440('0x46')]['rawAttributes']);_0x506cc2[_0xc440('0x2c')]=_[_0xc440('0x3e')](_0x336526[_0xc440('0x2c')]);_0x506cc2[_0xc440('0x2a')]=_[_0xc440('0x2b')](_0x506cc2[_0xc440('0x28')],_0x506cc2['query']);_0x3b954e['attributes']=_[_0xc440('0x2b')](_0x506cc2[_0xc440('0x28')],qs[_0xc440('0x2e')](_0x336526[_0xc440('0x2c')][_0xc440('0x2e')]));_0x3b954e[_0xc440('0x2d')]=_0x3b954e[_0xc440('0x2d')][_0xc440('0x3f')]?_0x3b954e[_0xc440('0x2d')]:_0x506cc2[_0xc440('0x28')];_0x3b954e['order']=qs[_0xc440('0x32')](_0x336526['query'][_0xc440('0x32')]);_0x3b954e[_0xc440('0x35')]=qs['filters'](_[_0xc440('0x33')](_0x336526[_0xc440('0x2c')],_0x506cc2[_0xc440('0x2a')]));if(_0x336526[_0xc440('0x2c')]['filter']){_0x3b954e[_0xc440('0x35')]=_[_0xc440('0x36')](_0x3b954e[_0xc440('0x35')],{'$or':_[_0xc440('0x29')](_0x3b954e[_0xc440('0x2d')],function(_0xdc7fc7){var _0x476e6a={};_0x476e6a[_0xdc7fc7]={'$like':'%'+_0x336526[_0xc440('0x2c')][_0xc440('0x34')]+'%'};return _0x476e6a;})});}_0x3b954e=_[_0xc440('0x36')]({},_0x3b954e,_0x336526[_0xc440('0x37')]);return _0x4883ad[_0xc440('0x45')](_0x3b954e);}})['then'](function(_0x578512){if(_0x578512){_0x481e6b=_0x578512[_0xc440('0x3f')];if(!_0x336526[_0xc440('0x2c')][_0xc440('0x2f')](_0xc440('0x30'))){_0x3b954e[_0xc440('0x16')]=qs[_0xc440('0x16')](_0x336526[_0xc440('0x2c')]['limit']);_0x3b954e[_0xc440('0x14')]=qs[_0xc440('0x14')](_0x336526[_0xc440('0x2c')]['offset']);}return _0x4883ad[_0xc440('0x45')](_0x3b954e);}})[_0xc440('0x1d')](function(_0x10d525){if(_0x10d525){return _0x10d525?{'count':_0x481e6b,'rows':_0x10d525}:null;}})[_0xc440('0x1d')](respondWithResult(_0x1bf7aa,null))[_0xc440('0x3b')](handleError(_0x1bf7aa,null));};exports[_0xc440('0x47')]=function(_0x7db8c0,_0xcaff54,_0x3c65c7){var _0x220dec={};var _0x4b1b5a={};var _0x33b414;var _0x23e9eb;return db[_0xc440('0x24')][_0xc440('0x48')]({'where':{'id':_0x7db8c0['params']['id']}})[_0xc440('0x1d')](handleEntityNotFound(_0xcaff54,null))[_0xc440('0x1d')](function(_0x4402d8){if(_0x4402d8){_0x33b414=_0x4402d8;_0x4b1b5a[_0xc440('0x28')]=_[_0xc440('0x3e')](db[_0xc440('0x46')]['rawAttributes']);_0x4b1b5a['query']=_[_0xc440('0x3e')](_0x7db8c0[_0xc440('0x2c')]);_0x4b1b5a[_0xc440('0x2a')]=_[_0xc440('0x2b')](_0x4b1b5a[_0xc440('0x28')],_0x4b1b5a[_0xc440('0x2c')]);_0x220dec[_0xc440('0x2d')]=_[_0xc440('0x2b')](_0x4b1b5a[_0xc440('0x28')],qs['fields'](_0x7db8c0['query'][_0xc440('0x2e')]));_0x220dec[_0xc440('0x2d')]=_0x220dec[_0xc440('0x2d')][_0xc440('0x3f')]?_0x220dec[_0xc440('0x2d')]:_0x4b1b5a['model'];_0x220dec[_0xc440('0x31')]=qs[_0xc440('0x32')](_0x7db8c0[_0xc440('0x2c')][_0xc440('0x32')]);_0x220dec[_0xc440('0x35')]=qs[_0xc440('0x2a')](_[_0xc440('0x33')](_0x7db8c0[_0xc440('0x2c')],_0x4b1b5a['filters']));if(_0x7db8c0[_0xc440('0x2c')][_0xc440('0x34')]){_0x220dec[_0xc440('0x35')]=_[_0xc440('0x36')](_0x220dec[_0xc440('0x35')],{'$or':_[_0xc440('0x29')](_0x220dec['attributes'],function(_0xb038e2){var _0x6ccfdb={};_0x6ccfdb[_0xb038e2]={'$like':'%'+_0x7db8c0[_0xc440('0x2c')][_0xc440('0x34')]+'%'};return _0x6ccfdb;})});}_0x220dec=_[_0xc440('0x36')]({},_0x220dec,_0x7db8c0[_0xc440('0x37')]);return _0x33b414[_0xc440('0x47')](_0x220dec);}})['then'](function(_0x29e5ae){if(_0x29e5ae){_0x23e9eb=_0x29e5ae['length'];if(!_0x7db8c0['query']['hasOwnProperty'](_0xc440('0x30'))){_0x220dec[_0xc440('0x16')]=qs[_0xc440('0x16')](_0x7db8c0['query']['limit']);_0x220dec[_0xc440('0x14')]=qs[_0xc440('0x14')](_0x7db8c0['query']['offset']);}return _0x33b414[_0xc440('0x47')](_0x220dec);}})[_0xc440('0x1d')](function(_0x192557){if(_0x192557){return _0x192557?{'count':_0x23e9eb,'rows':_0x192557}:null;}})['then'](respondWithResult(_0xcaff54,null))[_0xc440('0x3b')](handleError(_0xcaff54,null));};exports[_0xc440('0x49')]=function(_0x191055,_0x53ebe1,_0x38a1d0){var _0xa803a8={};var _0x2f772f={};var _0xf7794b;var _0x5c8515;return db[_0xc440('0x24')][_0xc440('0x48')]({'where':{'id':_0x191055[_0xc440('0x3d')]['id']}})[_0xc440('0x1d')](handleEntityNotFound(_0x53ebe1,null))['then'](function(_0x2b08dd){if(_0x2b08dd){_0xf7794b=_0x2b08dd;_0x2f772f[_0xc440('0x28')]=_[_0xc440('0x3e')](db[_0xc440('0x46')][_0xc440('0x25')]);_0x2f772f[_0xc440('0x2c')]=_[_0xc440('0x3e')](_0x191055[_0xc440('0x2c')]);_0x2f772f['filters']=_['intersection'](_0x2f772f[_0xc440('0x28')],_0x2f772f[_0xc440('0x2c')]);_0xa803a8[_0xc440('0x2d')]=_[_0xc440('0x2b')](_0x2f772f[_0xc440('0x28')],qs[_0xc440('0x2e')](_0x191055[_0xc440('0x2c')][_0xc440('0x2e')]));_0xa803a8[_0xc440('0x2d')]=_0xa803a8[_0xc440('0x2d')][_0xc440('0x3f')]?_0xa803a8[_0xc440('0x2d')]:_0x2f772f[_0xc440('0x28')];_0xa803a8['order']=qs['sort'](_0x191055[_0xc440('0x2c')]['sort']);_0xa803a8['where']=qs[_0xc440('0x2a')](_[_0xc440('0x33')](_0x191055['query'],_0x2f772f[_0xc440('0x2a')]));if(_0x191055['query'][_0xc440('0x34')]){_0xa803a8[_0xc440('0x35')]=_['merge'](_0xa803a8['where'],{'$or':_[_0xc440('0x29')](_0xa803a8[_0xc440('0x2d')],function(_0x6b392d){var _0x2ac368={};_0x2ac368[_0x6b392d]={'$like':'%'+_0x191055[_0xc440('0x2c')][_0xc440('0x34')]+'%'};return _0x2ac368;})});}_0xa803a8=_[_0xc440('0x36')]({},_0xa803a8,_0x191055[_0xc440('0x37')]);return _0xf7794b['getDescriptions'](_0xa803a8);}})[_0xc440('0x1d')](function(_0x84573a){if(_0x84573a){_0x5c8515=_0x84573a[_0xc440('0x3f')];if(!_0x191055[_0xc440('0x2c')][_0xc440('0x2f')](_0xc440('0x30'))){_0xa803a8['limit']=qs[_0xc440('0x16')](_0x191055['query'][_0xc440('0x16')]);_0xa803a8['offset']=qs[_0xc440('0x14')](_0x191055[_0xc440('0x2c')][_0xc440('0x14')]);}return _0xf7794b['getDescriptions'](_0xa803a8);}})[_0xc440('0x1d')](function(_0x2b4ccc){if(_0x2b4ccc){return _0x2b4ccc?{'count':_0x5c8515,'rows':_0x2b4ccc}:null;}})[_0xc440('0x1d')](respondWithResult(_0x53ebe1,null))[_0xc440('0x3b')](handleError(_0x53ebe1,null));}; \ No newline at end of file +var _0xb691=['../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','then','destroy','error','stack','name','send','index','map','Dynamics365Configuration','key','model','query','keys','filters','attributes','fields','hasOwnProperty','order','sort','pick','filter','where','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','rawAttributes','length','find','create','body','update','params','findOne','Dynamics365Field','intersection','getFields','getSubjects','nolimit','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','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'];(function(_0x68c979,_0x431cff){var _0x4f0001=function(_0xa7595d){while(--_0xa7595d){_0x68c979['push'](_0x68c979['shift']());}};_0x4f0001(++_0x431cff);}(_0xb691,0x194));var _0x1b69=function(_0x279368,_0x41c002){_0x279368=_0x279368-0x0;var _0x40b6d0=_0xb691[_0x279368];return _0x40b6d0;};'use strict';var emlformat=require(_0x1b69('0x0'));var rimraf=require(_0x1b69('0x1'));var zipdir=require(_0x1b69('0x2'));var jsonpatch=require(_0x1b69('0x3'));var rp=require(_0x1b69('0x4'));var moment=require(_0x1b69('0x5'));var BPromise=require(_0x1b69('0x6'));var Mustache=require(_0x1b69('0x7'));var util=require(_0x1b69('0x8'));var path=require(_0x1b69('0x9'));var sox=require('sox');var csv=require(_0x1b69('0xa'));var ejs=require(_0x1b69('0xb'));var fs=require('fs');var fs_extra=require(_0x1b69('0xc'));var _=require(_0x1b69('0xd'));var squel=require(_0x1b69('0xe'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x1b69('0xf'));var Papa=require(_0x1b69('0x10'));var Redis=require(_0x1b69('0x11'));var authService=require(_0x1b69('0x12'));var qs=require(_0x1b69('0x13'));var as=require(_0x1b69('0x14'));var hardwareService=require(_0x1b69('0x15'));var logger=require(_0x1b69('0x16'))(_0x1b69('0x17'));var utils=require(_0x1b69('0x18'));var config=require(_0x1b69('0x19'));var licenseUtil=require(_0x1b69('0x1a'));var db=require(_0x1b69('0x1b'))['db'];function respondWithStatusCode(_0x37f8af,_0x2b8a69){_0x2b8a69=_0x2b8a69||0xcc;return function(_0x3657a9){if(_0x3657a9){return _0x37f8af[_0x1b69('0x1c')](_0x2b8a69);}return _0x37f8af[_0x1b69('0x1d')](_0x2b8a69)[_0x1b69('0x1e')]();};}function respondWithResult(_0x4c36bb,_0x50dbd4){_0x50dbd4=_0x50dbd4||0xc8;return function(_0x2b604a){if(_0x2b604a){return _0x4c36bb[_0x1b69('0x1d')](_0x50dbd4)[_0x1b69('0x1f')](_0x2b604a);}};}function respondWithFilteredResult(_0x136fc2,_0x1aef28){return function(_0x48ea01){if(_0x48ea01){var _0x419df2=typeof _0x1aef28[_0x1b69('0x20')]===_0x1b69('0x21')&&typeof _0x1aef28['limit']===_0x1b69('0x21');var _0x31765b=_0x48ea01[_0x1b69('0x22')];var _0x10a3d5=_0x419df2?0x0:_0x1aef28[_0x1b69('0x20')];var _0x3d9b24=_0x419df2?_0x48ea01[_0x1b69('0x22')]:_0x1aef28[_0x1b69('0x20')]+_0x1aef28[_0x1b69('0x23')];var _0x40bfcd;if(_0x3d9b24>=_0x31765b){_0x3d9b24=_0x31765b;_0x40bfcd=0xc8;}else{_0x40bfcd=0xce;}_0x136fc2['status'](_0x40bfcd);return _0x136fc2[_0x1b69('0x24')](_0x1b69('0x25'),_0x10a3d5+'-'+_0x3d9b24+'/'+_0x31765b)[_0x1b69('0x1f')](_0x48ea01);}return null;};}function patchUpdates(_0x312f2e){return function(_0x3a8285){try{jsonpatch[_0x1b69('0x26')](_0x3a8285,_0x312f2e,!![]);}catch(_0xbb03b5){return BPromise[_0x1b69('0x27')](_0xbb03b5);}return _0x3a8285['save']();};}function saveUpdates(_0xb5f353,_0x58adea){return function(_0x6e0d7f){if(_0x6e0d7f){return _0x6e0d7f['update'](_0xb5f353)[_0x1b69('0x28')](function(_0x19e5b9){return _0x19e5b9;});}return null;};}function removeEntity(_0x40123e,_0x374c49){return function(_0x3a3d49){if(_0x3a3d49){return _0x3a3d49[_0x1b69('0x29')]()['then'](function(){_0x40123e['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x5c3983,_0x33dc6e){return function(_0x2c784b){if(!_0x2c784b){_0x5c3983[_0x1b69('0x1c')](0x194);}return _0x2c784b;};}function handleError(_0x3439a0,_0x7ab2ec){_0x7ab2ec=_0x7ab2ec||0x1f4;return function(_0x3dc7ba){logger[_0x1b69('0x2a')](_0x3dc7ba[_0x1b69('0x2b')]);if(_0x3dc7ba[_0x1b69('0x2c')]){delete _0x3dc7ba[_0x1b69('0x2c')];}_0x3439a0[_0x1b69('0x1d')](_0x7ab2ec)[_0x1b69('0x2d')](_0x3dc7ba);};}exports[_0x1b69('0x2e')]=function(_0x188313,_0x4c40a4){var _0x51d8c3={},_0x20cde0={},_0x1bca9e={'count':0x0,'rows':[]};var _0xe98989=_[_0x1b69('0x2f')](db[_0x1b69('0x30')]['rawAttributes'],function(_0x3dc5ce){return{'name':_0x3dc5ce['fieldName'],'type':_0x3dc5ce['type'][_0x1b69('0x31')]};});_0x20cde0[_0x1b69('0x32')]=_[_0x1b69('0x2f')](_0xe98989,_0x1b69('0x2c'));_0x20cde0[_0x1b69('0x33')]=_[_0x1b69('0x34')](_0x188313[_0x1b69('0x33')]);_0x20cde0[_0x1b69('0x35')]=_['intersection'](_0x20cde0['model'],_0x20cde0[_0x1b69('0x33')]);_0x51d8c3[_0x1b69('0x36')]=_['intersection'](_0x20cde0[_0x1b69('0x32')],qs[_0x1b69('0x37')](_0x188313[_0x1b69('0x33')][_0x1b69('0x37')]));_0x51d8c3[_0x1b69('0x36')]=_0x51d8c3[_0x1b69('0x36')]['length']?_0x51d8c3[_0x1b69('0x36')]:_0x20cde0[_0x1b69('0x32')];if(!_0x188313[_0x1b69('0x33')][_0x1b69('0x38')]('nolimit')){_0x51d8c3[_0x1b69('0x23')]=qs[_0x1b69('0x23')](_0x188313[_0x1b69('0x33')][_0x1b69('0x23')]);_0x51d8c3[_0x1b69('0x20')]=qs[_0x1b69('0x20')](_0x188313['query']['offset']);}_0x51d8c3[_0x1b69('0x39')]=qs[_0x1b69('0x3a')](_0x188313[_0x1b69('0x33')][_0x1b69('0x3a')]);_0x51d8c3['where']=qs[_0x1b69('0x35')](_[_0x1b69('0x3b')](_0x188313[_0x1b69('0x33')],_0x20cde0['filters']),_0xe98989);if(_0x188313[_0x1b69('0x33')][_0x1b69('0x3c')]){_0x51d8c3[_0x1b69('0x3d')]=_[_0x1b69('0x3e')](_0x51d8c3[_0x1b69('0x3d')],{'$or':_[_0x1b69('0x2f')](_0xe98989,function(_0x2dba2d){if(_0x2dba2d[_0x1b69('0x3f')]!==_0x1b69('0x40')){var _0x5cef8f={};_0x5cef8f[_0x2dba2d['name']]={'$like':'%'+_0x188313[_0x1b69('0x33')][_0x1b69('0x3c')]+'%'};return _0x5cef8f;}})});}_0x51d8c3=_['merge']({},_0x51d8c3,_0x188313[_0x1b69('0x41')]);var _0x42a90c={'where':_0x51d8c3[_0x1b69('0x3d')]};return db[_0x1b69('0x30')][_0x1b69('0x22')](_0x42a90c)[_0x1b69('0x28')](function(_0x4d6bde){_0x1bca9e[_0x1b69('0x22')]=_0x4d6bde;if(_0x188313['query'][_0x1b69('0x42')]){_0x51d8c3[_0x1b69('0x43')]=[{'all':!![]}];}return db[_0x1b69('0x30')][_0x1b69('0x44')](_0x51d8c3);})[_0x1b69('0x28')](function(_0x48949b){_0x1bca9e[_0x1b69('0x45')]=_0x48949b;return _0x1bca9e;})[_0x1b69('0x28')](respondWithFilteredResult(_0x4c40a4,_0x51d8c3))[_0x1b69('0x46')](handleError(_0x4c40a4,null));};exports[_0x1b69('0x47')]=function(_0x5b9b67,_0x59f480){var _0x463f38={'raw':![],'where':{'id':_0x5b9b67['params']['id']}},_0x422285={};_0x422285[_0x1b69('0x32')]=_[_0x1b69('0x34')](db[_0x1b69('0x30')][_0x1b69('0x48')]);_0x422285[_0x1b69('0x33')]=_[_0x1b69('0x34')](_0x5b9b67['query']);_0x422285[_0x1b69('0x35')]=_['intersection'](_0x422285[_0x1b69('0x32')],_0x422285[_0x1b69('0x33')]);_0x463f38['attributes']=_['intersection'](_0x422285[_0x1b69('0x32')],qs[_0x1b69('0x37')](_0x5b9b67['query'][_0x1b69('0x37')]));_0x463f38[_0x1b69('0x36')]=_0x463f38[_0x1b69('0x36')][_0x1b69('0x49')]?_0x463f38['attributes']:_0x422285[_0x1b69('0x32')];if(_0x5b9b67[_0x1b69('0x33')][_0x1b69('0x42')]){_0x463f38[_0x1b69('0x43')]=[{'all':!![]}];}_0x463f38=_[_0x1b69('0x3e')]({},_0x463f38,_0x5b9b67[_0x1b69('0x41')]);return db['Dynamics365Configuration'][_0x1b69('0x4a')](_0x463f38)[_0x1b69('0x28')](handleEntityNotFound(_0x59f480,null))[_0x1b69('0x28')](respondWithResult(_0x59f480,null))['catch'](handleError(_0x59f480,null));};exports[_0x1b69('0x4b')]=function(_0x3e9a6b,_0x928911){return db[_0x1b69('0x30')]['create'](_0x3e9a6b[_0x1b69('0x4c')],{})['then'](respondWithResult(_0x928911,0xc9))[_0x1b69('0x46')](handleError(_0x928911,null));};exports[_0x1b69('0x4d')]=function(_0x5bfc4d,_0x3e580f){if(_0x5bfc4d[_0x1b69('0x4c')]['id']){delete _0x5bfc4d[_0x1b69('0x4c')]['id'];}return db[_0x1b69('0x30')][_0x1b69('0x4a')]({'where':{'id':_0x5bfc4d[_0x1b69('0x4e')]['id']}})['then'](handleEntityNotFound(_0x3e580f,null))[_0x1b69('0x28')](saveUpdates(_0x5bfc4d[_0x1b69('0x4c')],null))[_0x1b69('0x28')](respondWithResult(_0x3e580f,null))[_0x1b69('0x46')](handleError(_0x3e580f,null));};exports[_0x1b69('0x29')]=function(_0x1bfe1e,_0x25e987){return db[_0x1b69('0x30')][_0x1b69('0x4a')]({'where':{'id':_0x1bfe1e['params']['id']}})[_0x1b69('0x28')](handleEntityNotFound(_0x25e987,null))[_0x1b69('0x28')](removeEntity(_0x25e987,null))[_0x1b69('0x46')](handleError(_0x25e987,null));};exports['getFields']=function(_0x47271e,_0x135b00,_0x4b65a1){var _0x523a9a={};var _0x282c00={};var _0x590e17;var _0x20a9ff;return db[_0x1b69('0x30')][_0x1b69('0x4f')]({'where':{'id':_0x47271e[_0x1b69('0x4e')]['id']}})['then'](handleEntityNotFound(_0x135b00,null))[_0x1b69('0x28')](function(_0x528ff5){if(_0x528ff5){_0x590e17=_0x528ff5;_0x282c00['model']=_[_0x1b69('0x34')](db[_0x1b69('0x50')][_0x1b69('0x48')]);_0x282c00['query']=_['keys'](_0x47271e['query']);_0x282c00[_0x1b69('0x35')]=_[_0x1b69('0x51')](_0x282c00[_0x1b69('0x32')],_0x282c00[_0x1b69('0x33')]);_0x523a9a[_0x1b69('0x36')]=_['intersection'](_0x282c00[_0x1b69('0x32')],qs[_0x1b69('0x37')](_0x47271e[_0x1b69('0x33')]['fields']));_0x523a9a[_0x1b69('0x36')]=_0x523a9a[_0x1b69('0x36')][_0x1b69('0x49')]?_0x523a9a[_0x1b69('0x36')]:_0x282c00[_0x1b69('0x32')];_0x523a9a[_0x1b69('0x39')]=qs[_0x1b69('0x3a')](_0x47271e['query'][_0x1b69('0x3a')]);_0x523a9a[_0x1b69('0x3d')]=qs[_0x1b69('0x35')](_['pick'](_0x47271e[_0x1b69('0x33')],_0x282c00['filters']));if(_0x47271e[_0x1b69('0x33')]['filter']){_0x523a9a[_0x1b69('0x3d')]=_[_0x1b69('0x3e')](_0x523a9a[_0x1b69('0x3d')],{'$or':_[_0x1b69('0x2f')](_0x523a9a[_0x1b69('0x36')],function(_0x478903){var _0x110408={};_0x110408[_0x478903]={'$like':'%'+_0x47271e[_0x1b69('0x33')][_0x1b69('0x3c')]+'%'};return _0x110408;})});}_0x523a9a=_['merge']({},_0x523a9a,_0x47271e[_0x1b69('0x41')]);return _0x590e17[_0x1b69('0x52')](_0x523a9a);}})[_0x1b69('0x28')](function(_0x46cc41){if(_0x46cc41){_0x20a9ff=_0x46cc41[_0x1b69('0x49')];if(!_0x47271e[_0x1b69('0x33')][_0x1b69('0x38')]('nolimit')){_0x523a9a[_0x1b69('0x23')]=qs['limit'](_0x47271e[_0x1b69('0x33')][_0x1b69('0x23')]);_0x523a9a[_0x1b69('0x20')]=qs[_0x1b69('0x20')](_0x47271e[_0x1b69('0x33')][_0x1b69('0x20')]);}return _0x590e17['getFields'](_0x523a9a);}})[_0x1b69('0x28')](function(_0x1096f4){if(_0x1096f4){return _0x1096f4?{'count':_0x20a9ff,'rows':_0x1096f4}:null;}})[_0x1b69('0x28')](respondWithResult(_0x135b00,null))[_0x1b69('0x46')](handleError(_0x135b00,null));};exports[_0x1b69('0x53')]=function(_0x3b1065,_0xe874a8,_0x529ff3){var _0x123062={};var _0x175ddd={};var _0x47d400;var _0x444f25;return db[_0x1b69('0x30')][_0x1b69('0x4f')]({'where':{'id':_0x3b1065[_0x1b69('0x4e')]['id']}})['then'](handleEntityNotFound(_0xe874a8,null))[_0x1b69('0x28')](function(_0x4d115b){if(_0x4d115b){_0x47d400=_0x4d115b;_0x175ddd[_0x1b69('0x32')]=_['keys'](db['Dynamics365Field'][_0x1b69('0x48')]);_0x175ddd['query']=_[_0x1b69('0x34')](_0x3b1065['query']);_0x175ddd[_0x1b69('0x35')]=_['intersection'](_0x175ddd[_0x1b69('0x32')],_0x175ddd[_0x1b69('0x33')]);_0x123062[_0x1b69('0x36')]=_[_0x1b69('0x51')](_0x175ddd[_0x1b69('0x32')],qs[_0x1b69('0x37')](_0x3b1065[_0x1b69('0x33')][_0x1b69('0x37')]));_0x123062['attributes']=_0x123062[_0x1b69('0x36')][_0x1b69('0x49')]?_0x123062[_0x1b69('0x36')]:_0x175ddd[_0x1b69('0x32')];_0x123062[_0x1b69('0x39')]=qs[_0x1b69('0x3a')](_0x3b1065[_0x1b69('0x33')][_0x1b69('0x3a')]);_0x123062[_0x1b69('0x3d')]=qs[_0x1b69('0x35')](_[_0x1b69('0x3b')](_0x3b1065[_0x1b69('0x33')],_0x175ddd[_0x1b69('0x35')]));if(_0x3b1065['query']['filter']){_0x123062[_0x1b69('0x3d')]=_[_0x1b69('0x3e')](_0x123062[_0x1b69('0x3d')],{'$or':_[_0x1b69('0x2f')](_0x123062[_0x1b69('0x36')],function(_0x5bd598){var _0x49ac0e={};_0x49ac0e[_0x5bd598]={'$like':'%'+_0x3b1065[_0x1b69('0x33')][_0x1b69('0x3c')]+'%'};return _0x49ac0e;})});}_0x123062=_[_0x1b69('0x3e')]({},_0x123062,_0x3b1065[_0x1b69('0x41')]);return _0x47d400[_0x1b69('0x53')](_0x123062);}})[_0x1b69('0x28')](function(_0x37c234){if(_0x37c234){_0x444f25=_0x37c234[_0x1b69('0x49')];if(!_0x3b1065[_0x1b69('0x33')][_0x1b69('0x38')](_0x1b69('0x54'))){_0x123062[_0x1b69('0x23')]=qs['limit'](_0x3b1065[_0x1b69('0x33')][_0x1b69('0x23')]);_0x123062[_0x1b69('0x20')]=qs[_0x1b69('0x20')](_0x3b1065[_0x1b69('0x33')][_0x1b69('0x20')]);}return _0x47d400[_0x1b69('0x53')](_0x123062);}})['then'](function(_0x1d13d9){if(_0x1d13d9){return _0x1d13d9?{'count':_0x444f25,'rows':_0x1d13d9}:null;}})[_0x1b69('0x28')](respondWithResult(_0xe874a8,null))[_0x1b69('0x46')](handleError(_0xe874a8,null));};exports[_0x1b69('0x55')]=function(_0x1c3589,_0x51d50f,_0x24d572){var _0x20428e={};var _0x44e042={};var _0x49d3fa;var _0x333cae;return db['Dynamics365Configuration'][_0x1b69('0x4f')]({'where':{'id':_0x1c3589[_0x1b69('0x4e')]['id']}})[_0x1b69('0x28')](handleEntityNotFound(_0x51d50f,null))['then'](function(_0xccca71){if(_0xccca71){_0x49d3fa=_0xccca71;_0x44e042[_0x1b69('0x32')]=_[_0x1b69('0x34')](db[_0x1b69('0x50')][_0x1b69('0x48')]);_0x44e042[_0x1b69('0x33')]=_[_0x1b69('0x34')](_0x1c3589[_0x1b69('0x33')]);_0x44e042[_0x1b69('0x35')]=_[_0x1b69('0x51')](_0x44e042[_0x1b69('0x32')],_0x44e042[_0x1b69('0x33')]);_0x20428e['attributes']=_['intersection'](_0x44e042['model'],qs['fields'](_0x1c3589[_0x1b69('0x33')]['fields']));_0x20428e['attributes']=_0x20428e[_0x1b69('0x36')]['length']?_0x20428e[_0x1b69('0x36')]:_0x44e042[_0x1b69('0x32')];_0x20428e[_0x1b69('0x39')]=qs[_0x1b69('0x3a')](_0x1c3589[_0x1b69('0x33')][_0x1b69('0x3a')]);_0x20428e[_0x1b69('0x3d')]=qs[_0x1b69('0x35')](_[_0x1b69('0x3b')](_0x1c3589[_0x1b69('0x33')],_0x44e042[_0x1b69('0x35')]));if(_0x1c3589[_0x1b69('0x33')][_0x1b69('0x3c')]){_0x20428e[_0x1b69('0x3d')]=_[_0x1b69('0x3e')](_0x20428e[_0x1b69('0x3d')],{'$or':_[_0x1b69('0x2f')](_0x20428e[_0x1b69('0x36')],function(_0x15c6c1){var _0x1bb34f={};_0x1bb34f[_0x15c6c1]={'$like':'%'+_0x1c3589['query'][_0x1b69('0x3c')]+'%'};return _0x1bb34f;})});}_0x20428e=_['merge']({},_0x20428e,_0x1c3589[_0x1b69('0x41')]);return _0x49d3fa[_0x1b69('0x55')](_0x20428e);}})[_0x1b69('0x28')](function(_0x1ad20f){if(_0x1ad20f){_0x333cae=_0x1ad20f[_0x1b69('0x49')];if(!_0x1c3589[_0x1b69('0x33')][_0x1b69('0x38')](_0x1b69('0x54'))){_0x20428e[_0x1b69('0x23')]=qs[_0x1b69('0x23')](_0x1c3589['query'][_0x1b69('0x23')]);_0x20428e['offset']=qs[_0x1b69('0x20')](_0x1c3589[_0x1b69('0x33')][_0x1b69('0x20')]);}return _0x49d3fa[_0x1b69('0x55')](_0x20428e);}})[_0x1b69('0x28')](function(_0x54f760){if(_0x54f760){return _0x54f760?{'count':_0x333cae,'rows':_0x54f760}:null;}})['then'](respondWithResult(_0x51d50f,null))[_0x1b69('0x46')](handleError(_0x51d50f,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js index 37fd5a4..01e9adf 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 _0x9a19=['lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intDynamics365Configuration.attributes','exports','define'];(function(_0x59d89e,_0x55edf5){var _0x554e93=function(_0x3d40bc){while(--_0x3d40bc){_0x59d89e['push'](_0x59d89e['shift']());}};_0x554e93(++_0x55edf5);}(_0x9a19,0x114));var _0x99a1=function(_0x3430aa,_0x57cd92){_0x3430aa=_0x3430aa-0x0;var _0x2ac5c=_0x9a19[_0x3430aa];return _0x2ac5c;};'use strict';var _=require(_0x99a1('0x0'));var util=require(_0x99a1('0x1'));var logger=require(_0x99a1('0x2'))('api');var moment=require(_0x99a1('0x3'));var BPromise=require(_0x99a1('0x4'));var rp=require(_0x99a1('0x5'));var fs=require('fs');var path=require(_0x99a1('0x6'));var rimraf=require(_0x99a1('0x7'));var config=require(_0x99a1('0x8'));var attributes=require(_0x99a1('0x9'));module[_0x99a1('0xa')]=function(_0x3eff4a,_0xff0240){return _0x3eff4a[_0x99a1('0xb')]('Dynamics365Configuration',attributes,{'tableName':'int_dynamics365_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd6d6=['path','rimraf','../../config/environment','./intDynamics365Configuration.attributes','exports','define','Dynamics365Configuration','int_dynamics365_configurations','lodash','util','../../config/logger','api','bluebird','request-promise'];(function(_0x2e9064,_0x425f57){var _0x148b4c=function(_0x376416){while(--_0x376416){_0x2e9064['push'](_0x2e9064['shift']());}};_0x148b4c(++_0x425f57);}(_0xd6d6,0xbe));var _0x6d6d=function(_0x22fd93,_0x32074f){_0x22fd93=_0x22fd93-0x0;var _0x1d3bee=_0xd6d6[_0x22fd93];return _0x1d3bee;};'use strict';var _=require(_0x6d6d('0x0'));var util=require(_0x6d6d('0x1'));var logger=require(_0x6d6d('0x2'))(_0x6d6d('0x3'));var moment=require('moment');var BPromise=require(_0x6d6d('0x4'));var rp=require(_0x6d6d('0x5'));var fs=require('fs');var path=require(_0x6d6d('0x6'));var rimraf=require(_0x6d6d('0x7'));var config=require(_0x6d6d('0x8'));var attributes=require(_0x6d6d('0x9'));module[_0x6d6d('0xa')]=function(_0x5702dc,_0x210ff7){return _0x5702dc[_0x6d6d('0xb')](_0x6d6d('0xc'),attributes,{'tableName':_0x6d6d('0xd'),'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 bff9418..f7f9340 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 _0xe909=['debug','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','Dynamics365Configuration,\x20%s,\x20%s','request\x20sent'];(function(_0x46493f,_0x454c82){var _0x220cd0=function(_0x1648de){while(--_0x1648de){_0x46493f['push'](_0x46493f['shift']());}};_0x220cd0(++_0x454c82);}(_0xe909,0x14a));var _0x9e90=function(_0x302e6e,_0x98d53f){_0x302e6e=_0x302e6e-0x0;var _0x406175=_0xe909[_0x302e6e];return _0x406175;};'use strict';var _=require(_0x9e90('0x0'));var util=require(_0x9e90('0x1'));var moment=require(_0x9e90('0x2'));var BPromise=require(_0x9e90('0x3'));var rs=require(_0x9e90('0x4'));var fs=require('fs');var Redis=require(_0x9e90('0x5'));var db=require(_0x9e90('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x9e90('0x7'));var config=require(_0x9e90('0x8'));var jayson=require(_0x9e90('0x9'));var client=jayson[_0x9e90('0xa')][_0x9e90('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x51f277,_0x4a4943,_0x506697){return new BPromise(function(_0xacd02d,_0x17490e){return client[_0x9e90('0xc')](_0x51f277,_0x506697)['then'](function(_0x37958f){logger['info'](_0x9e90('0xd'),_0x4a4943,_0x9e90('0xe'));logger[_0x9e90('0xf')](_0x9e90('0x10'),_0x4a4943,'request\x20sent',JSON[_0x9e90('0x11')](_0x37958f));if(_0x37958f[_0x9e90('0x12')]){if(_0x37958f[_0x9e90('0x12')][_0x9e90('0x13')]===0x1f4){logger[_0x9e90('0x12')](_0x9e90('0xd'),_0x4a4943,_0x37958f[_0x9e90('0x12')][_0x9e90('0x14')]);return _0x17490e(_0x37958f[_0x9e90('0x12')][_0x9e90('0x14')]);}logger[_0x9e90('0x12')](_0x9e90('0xd'),_0x4a4943,_0x37958f[_0x9e90('0x12')][_0x9e90('0x14')]);return _0xacd02d(_0x37958f['error'][_0x9e90('0x14')]);}else{logger[_0x9e90('0x15')](_0x9e90('0xd'),_0x4a4943,_0x9e90('0xe'));_0xacd02d(_0x37958f[_0x9e90('0x16')]['message']);}})['catch'](function(_0x236b52){logger[_0x9e90('0x12')](_0x9e90('0xd'),_0x4a4943,_0x236b52);_0x17490e(_0x236b52);});});} \ No newline at end of file +var _0xe694=['Dynamics365Configuration,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','request','then','info'];(function(_0x28c66d,_0x31a698){var _0x1869d1=function(_0x38eac9){while(--_0x38eac9){_0x28c66d['push'](_0x28c66d['shift']());}};_0x1869d1(++_0x31a698);}(_0xe694,0x94));var _0x4e69=function(_0x48a509,_0x30df45){_0x48a509=_0x48a509-0x0;var _0x4155e9=_0xe694[_0x48a509];return _0x4155e9;};'use strict';var _=require(_0x4e69('0x0'));var util=require('util');var moment=require(_0x4e69('0x1'));var BPromise=require(_0x4e69('0x2'));var rs=require(_0x4e69('0x3'));var fs=require('fs');var Redis=require(_0x4e69('0x4'));var db=require(_0x4e69('0x5'))['db'];var utils=require(_0x4e69('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x4e69('0x7'));var jayson=require(_0x4e69('0x8'));var client=jayson[_0x4e69('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1d1bda,_0x1b4659,_0xe9cfcc){return new BPromise(function(_0x153bce,_0x2ee902){return client[_0x4e69('0xa')](_0x1d1bda,_0xe9cfcc)[_0x4e69('0xb')](function(_0x3b3eb1){logger[_0x4e69('0xc')](_0x4e69('0xd'),_0x1b4659,_0x4e69('0xe'));logger[_0x4e69('0xf')](_0x4e69('0x10'),_0x1b4659,_0x4e69('0xe'),JSON[_0x4e69('0x11')](_0x3b3eb1));if(_0x3b3eb1['error']){if(_0x3b3eb1[_0x4e69('0x12')][_0x4e69('0x13')]===0x1f4){logger[_0x4e69('0x12')](_0x4e69('0xd'),_0x1b4659,_0x3b3eb1[_0x4e69('0x12')]['message']);return _0x2ee902(_0x3b3eb1[_0x4e69('0x12')][_0x4e69('0x14')]);}logger['error']('Dynamics365Configuration,\x20%s,\x20%s',_0x1b4659,_0x3b3eb1[_0x4e69('0x12')][_0x4e69('0x14')]);return _0x153bce(_0x3b3eb1[_0x4e69('0x12')]['message']);}else{logger[_0x4e69('0xc')]('Dynamics365Configuration,\x20%s,\x20%s',_0x1b4659,_0x4e69('0xe'));_0x153bce(_0x3b3eb1[_0x4e69('0x15')][_0x4e69('0x14')]);}})[_0x4e69('0x16')](function(_0x1065a1){logger[_0x4e69('0x12')]('Dynamics365Configuration,\x20%s,\x20%s',_0x1b4659,_0x1065a1);_0x2ee902(_0x1065a1);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Field/index.js b/server/api/intDynamics365Field/index.js index 773da30..88557bf 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 _0x9df1=['path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','post','put','update','delete','destroy','multer'];(function(_0x25d368,_0x59e491){var _0x1c6fc7=function(_0x6d2c6e){while(--_0x6d2c6e){_0x25d368['push'](_0x25d368['shift']());}};_0x1c6fc7(++_0x59e491);}(_0x9df1,0x14f));var _0x19df=function(_0x148379,_0x4bc905){_0x148379=_0x148379-0x0;var _0x33db64=_0x9df1[_0x148379];return _0x33db64;};'use strict';var multer=require(_0x19df('0x0'));var util=require('util');var path=require(_0x19df('0x1'));var timeout=require('connect-timeout');var express=require(_0x19df('0x2'));var router=express[_0x19df('0x3')]();var fs_extra=require(_0x19df('0x4'));var auth=require(_0x19df('0x5'));var interaction=require(_0x19df('0x6'));var config=require(_0x19df('0x7'));var controller=require('./intDynamics365Field.controller');router[_0x19df('0x8')]('/',auth[_0x19df('0x9')](),controller['index']);router[_0x19df('0x8')](_0x19df('0xa'),auth[_0x19df('0x9')](),controller['show']);router[_0x19df('0xb')]('/',auth['isAuthenticated'](),controller['create']);router[_0x19df('0xc')](_0x19df('0xa'),auth[_0x19df('0x9')](),controller[_0x19df('0xd')]);router[_0x19df('0xe')]('/:id',auth[_0x19df('0x9')](),controller[_0x19df('0xf')]);module['exports']=router; \ No newline at end of file +var _0x56ab=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Field.controller','isAuthenticated','index','get','/:id','show','create','update','destroy','exports','multer','util','connect-timeout','express'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x56ab,0x165));var _0xb56a=function(_0x46b514,_0x46e5e6){_0x46b514=_0x46b514-0x0;var _0x4e8a59=_0x56ab[_0x46b514];return _0x4e8a59;};'use strict';var multer=require(_0xb56a('0x0'));var util=require(_0xb56a('0x1'));var path=require('path');var timeout=require(_0xb56a('0x2'));var express=require(_0xb56a('0x3'));var router=express[_0xb56a('0x4')]();var fs_extra=require(_0xb56a('0x5'));var auth=require(_0xb56a('0x6'));var interaction=require(_0xb56a('0x7'));var config=require(_0xb56a('0x8'));var controller=require(_0xb56a('0x9'));router['get']('/',auth[_0xb56a('0xa')](),controller[_0xb56a('0xb')]);router[_0xb56a('0xc')](_0xb56a('0xd'),auth[_0xb56a('0xa')](),controller[_0xb56a('0xe')]);router['post']('/',auth['isAuthenticated'](),controller[_0xb56a('0xf')]);router['put'](_0xb56a('0xd'),auth[_0xb56a('0xa')](),controller[_0xb56a('0x10')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xb56a('0x11')]);module[_0xb56a('0x12')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.attributes.js b/server/api/intDynamics365Field/intDynamics365Field.attributes.js index d7ed2b9..db517fb 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 _0x5dce=['keyValue','STRING','ENUM','BOOLEAN','string','customVariable'];(function(_0x6e10e9,_0x12a36f){var _0x3da05e=function(_0x1e6ac0){while(--_0x1e6ac0){_0x6e10e9['push'](_0x6e10e9['shift']());}};_0x3da05e(++_0x12a36f);}(_0x5dce,0x1ae));var _0xe5dc=function(_0x5b5c48,_0x15ee61){_0x5b5c48=_0x5b5c48-0x0;var _0xbf7c7a=_0x5dce[_0x5b5c48];return _0xbf7c7a;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize['ENUM'](_0xe5dc('0x0'),'variable',_0xe5dc('0x1'),_0xe5dc('0x2'),'picklist'),'defaultValue':_0xe5dc('0x0')},'content':{'type':Sequelize[_0xe5dc('0x3')]},'key':{'type':Sequelize[_0xe5dc('0x3')]},'keyType':{'type':Sequelize[_0xe5dc('0x4')](_0xe5dc('0x0'),'variable',_0xe5dc('0x1'))},'keyContent':{'type':Sequelize[_0xe5dc('0x3')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0xe5dc('0x3')]},'customField':{'type':Sequelize[_0xe5dc('0x5')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xe5dc('0x3')]}}; \ No newline at end of file +var _0x69fc=['string','variable','customVariable','keyValue','STRING','BOOLEAN','sequelize','ENUM'];(function(_0x40cabc,_0x5d68b5){var _0x2ac19e=function(_0x190c57){while(--_0x190c57){_0x40cabc['push'](_0x40cabc['shift']());}};_0x2ac19e(++_0x5d68b5);}(_0x69fc,0xbe));var _0xc69f=function(_0xbc35a6,_0x4d9550){_0xbc35a6=_0xbc35a6-0x0;var _0x46b9c6=_0x69fc[_0xbc35a6];return _0x46b9c6;};'use strict';var Sequelize=require(_0xc69f('0x0'));module['exports']={'type':{'type':Sequelize[_0xc69f('0x1')](_0xc69f('0x2'),_0xc69f('0x3'),_0xc69f('0x4'),_0xc69f('0x5'),'picklist'),'defaultValue':_0xc69f('0x2')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0xc69f('0x6')]},'keyType':{'type':Sequelize[_0xc69f('0x1')](_0xc69f('0x2'),_0xc69f('0x3'),_0xc69f('0x4'))},'keyContent':{'type':Sequelize[_0xc69f('0x6')]},'idField':{'type':Sequelize[_0xc69f('0x6')]},'nameField':{'type':Sequelize[_0xc69f('0x6')]},'customField':{'type':Sequelize[_0xc69f('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xc69f('0x6')]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.controller.js b/server/api/intDynamics365Field/intDynamics365Field.controller.js index 933a2e8..8b0c32b 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 _0x3c83=['name','send','index','map','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','Dynamics365Field','includeAll','include','rows','catch','show','params','keys','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','limit','undefined','count','set','apply','reject','update','then','destroy','error','stack'];(function(_0x3a840c,_0x2c866a){var _0x16627f=function(_0x294d7c){while(--_0x294d7c){_0x3a840c['push'](_0x3a840c['shift']());}};_0x16627f(++_0x2c866a);}(_0x3c83,0x110));var _0x33c8=function(_0x4f2622,_0x2b6b0d){_0x4f2622=_0x4f2622-0x0;var _0x447e16=_0x3c83[_0x4f2622];return _0x447e16;};'use strict';var emlformat=require(_0x33c8('0x0'));var rimraf=require(_0x33c8('0x1'));var zipdir=require(_0x33c8('0x2'));var jsonpatch=require(_0x33c8('0x3'));var rp=require(_0x33c8('0x4'));var moment=require('moment');var BPromise=require(_0x33c8('0x5'));var Mustache=require(_0x33c8('0x6'));var util=require(_0x33c8('0x7'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x33c8('0x8'));var fs=require('fs');var fs_extra=require(_0x33c8('0x9'));var _=require(_0x33c8('0xa'));var squel=require(_0x33c8('0xb'));var crypto=require(_0x33c8('0xc'));var jsforce=require(_0x33c8('0xd'));var deskjs=require(_0x33c8('0xe'));var toCsv=require(_0x33c8('0xf'));var querystring=require(_0x33c8('0x10'));var Papa=require(_0x33c8('0x11'));var Redis=require(_0x33c8('0x12'));var authService=require(_0x33c8('0x13'));var qs=require(_0x33c8('0x14'));var as=require(_0x33c8('0x15'));var hardwareService=require(_0x33c8('0x16'));var logger=require(_0x33c8('0x17'))(_0x33c8('0x18'));var utils=require(_0x33c8('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0x33c8('0x1a'));var db=require(_0x33c8('0x1b'))['db'];function respondWithStatusCode(_0x3306d3,_0x8fd31c){_0x8fd31c=_0x8fd31c||0xcc;return function(_0xec6e8b){if(_0xec6e8b){return _0x3306d3[_0x33c8('0x1c')](_0x8fd31c);}return _0x3306d3['status'](_0x8fd31c)[_0x33c8('0x1d')]();};}function respondWithResult(_0x5314ff,_0x38f9a7){_0x38f9a7=_0x38f9a7||0xc8;return function(_0x2a25a3){if(_0x2a25a3){return _0x5314ff[_0x33c8('0x1e')](_0x38f9a7)[_0x33c8('0x1f')](_0x2a25a3);}};}function respondWithFilteredResult(_0x17f1db,_0xd93164){return function(_0x39935c){if(_0x39935c){var _0x345d47=typeof _0xd93164[_0x33c8('0x20')]==='undefined'&&typeof _0xd93164[_0x33c8('0x21')]===_0x33c8('0x22');var _0x2cd43e=_0x39935c[_0x33c8('0x23')];var _0x10a3da=_0x345d47?0x0:_0xd93164[_0x33c8('0x20')];var _0x3d66ba=_0x345d47?_0x39935c[_0x33c8('0x23')]:_0xd93164[_0x33c8('0x20')]+_0xd93164['limit'];var _0x5863ab;if(_0x3d66ba>=_0x2cd43e){_0x3d66ba=_0x2cd43e;_0x5863ab=0xc8;}else{_0x5863ab=0xce;}_0x17f1db[_0x33c8('0x1e')](_0x5863ab);return _0x17f1db[_0x33c8('0x24')]('Content-Range',_0x10a3da+'-'+_0x3d66ba+'/'+_0x2cd43e)[_0x33c8('0x1f')](_0x39935c);}return null;};}function patchUpdates(_0x2c1800){return function(_0x3aa413){try{jsonpatch[_0x33c8('0x25')](_0x3aa413,_0x2c1800,!![]);}catch(_0x89a8c0){return BPromise[_0x33c8('0x26')](_0x89a8c0);}return _0x3aa413['save']();};}function saveUpdates(_0x18a709,_0x5d69d3){return function(_0x112edd){if(_0x112edd){return _0x112edd[_0x33c8('0x27')](_0x18a709)[_0x33c8('0x28')](function(_0x539392){return _0x539392;});}return null;};}function removeEntity(_0x4ae85b,_0x20cb6d){return function(_0x572ec2){if(_0x572ec2){return _0x572ec2[_0x33c8('0x29')]()['then'](function(){_0x4ae85b[_0x33c8('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0xc77fa0,_0x28bee2){return function(_0x4c50d1){if(!_0x4c50d1){_0xc77fa0[_0x33c8('0x1c')](0x194);}return _0x4c50d1;};}function handleError(_0x42e30c,_0x68588a){_0x68588a=_0x68588a||0x1f4;return function(_0x32389b){logger[_0x33c8('0x2a')](_0x32389b[_0x33c8('0x2b')]);if(_0x32389b['name']){delete _0x32389b[_0x33c8('0x2c')];}_0x42e30c[_0x33c8('0x1e')](_0x68588a)[_0x33c8('0x2d')](_0x32389b);};}exports[_0x33c8('0x2e')]=function(_0x2bce74,_0x30e97c){var _0x1957cd={},_0x1d2d40={},_0x6db353={'count':0x0,'rows':[]};var _0x506479=_[_0x33c8('0x2f')](db['Dynamics365Field'][_0x33c8('0x30')],function(_0x2aed32){return{'name':_0x2aed32[_0x33c8('0x31')],'type':_0x2aed32[_0x33c8('0x32')][_0x33c8('0x33')]};});_0x1d2d40[_0x33c8('0x34')]=_[_0x33c8('0x2f')](_0x506479,_0x33c8('0x2c'));_0x1d2d40['query']=_['keys'](_0x2bce74[_0x33c8('0x35')]);_0x1d2d40[_0x33c8('0x36')]=_[_0x33c8('0x37')](_0x1d2d40['model'],_0x1d2d40['query']);_0x1957cd['attributes']=_['intersection'](_0x1d2d40['model'],qs[_0x33c8('0x38')](_0x2bce74[_0x33c8('0x35')][_0x33c8('0x38')]));_0x1957cd[_0x33c8('0x39')]=_0x1957cd[_0x33c8('0x39')][_0x33c8('0x3a')]?_0x1957cd[_0x33c8('0x39')]:_0x1d2d40['model'];if(!_0x2bce74[_0x33c8('0x35')][_0x33c8('0x3b')]('nolimit')){_0x1957cd['limit']=qs[_0x33c8('0x21')](_0x2bce74['query']['limit']);_0x1957cd[_0x33c8('0x20')]=qs[_0x33c8('0x20')](_0x2bce74[_0x33c8('0x35')]['offset']);}_0x1957cd[_0x33c8('0x3c')]=qs[_0x33c8('0x3d')](_0x2bce74['query'][_0x33c8('0x3d')]);_0x1957cd[_0x33c8('0x3e')]=qs['filters'](_[_0x33c8('0x3f')](_0x2bce74['query'],_0x1d2d40[_0x33c8('0x36')]),_0x506479);if(_0x2bce74[_0x33c8('0x35')][_0x33c8('0x40')]){_0x1957cd[_0x33c8('0x3e')]=_[_0x33c8('0x41')](_0x1957cd[_0x33c8('0x3e')],{'$or':_[_0x33c8('0x2f')](_0x506479,function(_0x2c6238){if(_0x2c6238[_0x33c8('0x32')]!==_0x33c8('0x42')){var _0x5d34ec={};_0x5d34ec[_0x2c6238[_0x33c8('0x2c')]]={'$like':'%'+_0x2bce74[_0x33c8('0x35')][_0x33c8('0x40')]+'%'};return _0x5d34ec;}})});}_0x1957cd=_['merge']({},_0x1957cd,_0x2bce74[_0x33c8('0x43')]);var _0x1ee6eb={'where':_0x1957cd[_0x33c8('0x3e')]};return db[_0x33c8('0x44')][_0x33c8('0x23')](_0x1ee6eb)[_0x33c8('0x28')](function(_0x2baf9c){_0x6db353['count']=_0x2baf9c;if(_0x2bce74['query'][_0x33c8('0x45')]){_0x1957cd[_0x33c8('0x46')]=[{'all':!![]}];}return db['Dynamics365Field']['findAll'](_0x1957cd);})[_0x33c8('0x28')](function(_0x494f1c){_0x6db353[_0x33c8('0x47')]=_0x494f1c;return _0x6db353;})[_0x33c8('0x28')](respondWithFilteredResult(_0x30e97c,_0x1957cd))[_0x33c8('0x48')](handleError(_0x30e97c,null));};exports[_0x33c8('0x49')]=function(_0x577cd0,_0x3ca097){var _0x55c6ff={'raw':!![],'where':{'id':_0x577cd0[_0x33c8('0x4a')]['id']}},_0x247427={};_0x247427['model']=_['keys'](db[_0x33c8('0x44')][_0x33c8('0x30')]);_0x247427[_0x33c8('0x35')]=_[_0x33c8('0x4b')](_0x577cd0[_0x33c8('0x35')]);_0x247427['filters']=_[_0x33c8('0x37')](_0x247427[_0x33c8('0x34')],_0x247427['query']);_0x55c6ff[_0x33c8('0x39')]=_[_0x33c8('0x37')](_0x247427['model'],qs['fields'](_0x577cd0['query'][_0x33c8('0x38')]));_0x55c6ff[_0x33c8('0x39')]=_0x55c6ff['attributes'][_0x33c8('0x3a')]?_0x55c6ff[_0x33c8('0x39')]:_0x247427['model'];if(_0x577cd0[_0x33c8('0x35')][_0x33c8('0x45')]){_0x55c6ff[_0x33c8('0x46')]=[{'all':!![]}];}_0x55c6ff=_[_0x33c8('0x41')]({},_0x55c6ff,_0x577cd0['options']);return db['Dynamics365Field'][_0x33c8('0x4c')](_0x55c6ff)[_0x33c8('0x28')](handleEntityNotFound(_0x3ca097,null))[_0x33c8('0x28')](respondWithResult(_0x3ca097,null))['catch'](handleError(_0x3ca097,null));};exports['create']=function(_0x1d17a7,_0x1ab5e6){return db['Dynamics365Field'][_0x33c8('0x4d')](_0x1d17a7[_0x33c8('0x4e')],{})['then'](respondWithResult(_0x1ab5e6,0xc9))[_0x33c8('0x48')](handleError(_0x1ab5e6,null));};exports[_0x33c8('0x27')]=function(_0x27ead4,_0x1ed31e){if(_0x27ead4[_0x33c8('0x4e')]['id']){delete _0x27ead4['body']['id'];}return db[_0x33c8('0x44')][_0x33c8('0x4c')]({'where':{'id':_0x27ead4[_0x33c8('0x4a')]['id']}})[_0x33c8('0x28')](handleEntityNotFound(_0x1ed31e,null))['then'](saveUpdates(_0x27ead4[_0x33c8('0x4e')],null))[_0x33c8('0x28')](respondWithResult(_0x1ed31e,null))[_0x33c8('0x48')](handleError(_0x1ed31e,null));};exports[_0x33c8('0x29')]=function(_0xf437f0,_0x12cb83){return db[_0x33c8('0x44')][_0x33c8('0x4c')]({'where':{'id':_0xf437f0[_0x33c8('0x4a')]['id']}})['then'](handleEntityNotFound(_0x12cb83,null))['then'](removeEntity(_0x12cb83,null))[_0x33c8('0x48')](handleError(_0x12cb83,null));}; \ No newline at end of file +var _0xab65=['../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','limit','count','set','reject','save','then','destroy','end','stack','name','map','Dynamics365Field','fieldName','type','key','model','query','keys','filters','attributes','fields','nolimit','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','rows','catch','rawAttributes','intersection','create','body','find','params','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','ejs','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x2f7d42,_0x5d7e00){var _0x52a70c=function(_0x2de1ec){while(--_0x2de1ec){_0x2f7d42['push'](_0x2f7d42['shift']());}};_0x52a70c(++_0x5d7e00);}(_0xab65,0x1ce));var _0x5ab6=function(_0x542ce5,_0x2dd3b8){_0x542ce5=_0x542ce5-0x0;var _0x4ec1c7=_0xab65[_0x542ce5];return _0x4ec1c7;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5ab6('0x0'));var zipdir=require(_0x5ab6('0x1'));var jsonpatch=require(_0x5ab6('0x2'));var rp=require('request-promise');var moment=require(_0x5ab6('0x3'));var BPromise=require(_0x5ab6('0x4'));var Mustache=require(_0x5ab6('0x5'));var util=require('util');var path=require(_0x5ab6('0x6'));var sox=require(_0x5ab6('0x7'));var csv=require('to-csv');var ejs=require(_0x5ab6('0x8'));var fs=require('fs');var fs_extra=require(_0x5ab6('0x9'));var _=require(_0x5ab6('0xa'));var squel=require('squel');var crypto=require(_0x5ab6('0xb'));var jsforce=require(_0x5ab6('0xc'));var deskjs=require(_0x5ab6('0xd'));var toCsv=require(_0x5ab6('0xe'));var querystring=require(_0x5ab6('0xf'));var Papa=require(_0x5ab6('0x10'));var Redis=require(_0x5ab6('0x11'));var authService=require(_0x5ab6('0x12'));var qs=require(_0x5ab6('0x13'));var as=require(_0x5ab6('0x14'));var hardwareService=require(_0x5ab6('0x15'));var logger=require(_0x5ab6('0x16'))(_0x5ab6('0x17'));var utils=require(_0x5ab6('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x5ab6('0x19'));var db=require(_0x5ab6('0x1a'))['db'];function respondWithStatusCode(_0x2d6f52,_0x5de17a){_0x5de17a=_0x5de17a||0xcc;return function(_0x3df03a){if(_0x3df03a){return _0x2d6f52[_0x5ab6('0x1b')](_0x5de17a);}return _0x2d6f52['status'](_0x5de17a)['end']();};}function respondWithResult(_0x56f72b,_0x160dd1){_0x160dd1=_0x160dd1||0xc8;return function(_0x3cb9e9){if(_0x3cb9e9){return _0x56f72b[_0x5ab6('0x1c')](_0x160dd1)['json'](_0x3cb9e9);}};}function respondWithFilteredResult(_0x274863,_0x42dc60){return function(_0x4f6a2e){if(_0x4f6a2e){var _0x380299=typeof _0x42dc60[_0x5ab6('0x1d')]===_0x5ab6('0x1e')&&typeof _0x42dc60[_0x5ab6('0x1f')]==='undefined';var _0x4915d1=_0x4f6a2e[_0x5ab6('0x20')];var _0xea571c=_0x380299?0x0:_0x42dc60[_0x5ab6('0x1d')];var _0x568aa4=_0x380299?_0x4f6a2e[_0x5ab6('0x20')]:_0x42dc60['offset']+_0x42dc60[_0x5ab6('0x1f')];var _0x31c598;if(_0x568aa4>=_0x4915d1){_0x568aa4=_0x4915d1;_0x31c598=0xc8;}else{_0x31c598=0xce;}_0x274863[_0x5ab6('0x1c')](_0x31c598);return _0x274863[_0x5ab6('0x21')]('Content-Range',_0xea571c+'-'+_0x568aa4+'/'+_0x4915d1)['json'](_0x4f6a2e);}return null;};}function patchUpdates(_0x58edca){return function(_0x8907b5){try{jsonpatch['apply'](_0x8907b5,_0x58edca,!![]);}catch(_0x4fda12){return BPromise[_0x5ab6('0x22')](_0x4fda12);}return _0x8907b5[_0x5ab6('0x23')]();};}function saveUpdates(_0x43724c,_0x304304){return function(_0x2932e2){if(_0x2932e2){return _0x2932e2['update'](_0x43724c)[_0x5ab6('0x24')](function(_0x1e9ffb){return _0x1e9ffb;});}return null;};}function removeEntity(_0x118290,_0x37b562){return function(_0x15fab4){if(_0x15fab4){return _0x15fab4[_0x5ab6('0x25')]()[_0x5ab6('0x24')](function(){_0x118290[_0x5ab6('0x1c')](0xcc)[_0x5ab6('0x26')]();});}};}function handleEntityNotFound(_0x1c4fc2,_0xd86274){return function(_0x1d3bd6){if(!_0x1d3bd6){_0x1c4fc2[_0x5ab6('0x1b')](0x194);}return _0x1d3bd6;};}function handleError(_0x1dd426,_0x2bbcb7){_0x2bbcb7=_0x2bbcb7||0x1f4;return function(_0x436867){logger['error'](_0x436867[_0x5ab6('0x27')]);if(_0x436867[_0x5ab6('0x28')]){delete _0x436867[_0x5ab6('0x28')];}_0x1dd426[_0x5ab6('0x1c')](_0x2bbcb7)['send'](_0x436867);};}exports['index']=function(_0x32972c,_0x48112e){var _0x3487ef={},_0x4da46e={},_0x3f674b={'count':0x0,'rows':[]};var _0x84f736=_[_0x5ab6('0x29')](db[_0x5ab6('0x2a')]['rawAttributes'],function(_0x557be4){return{'name':_0x557be4[_0x5ab6('0x2b')],'type':_0x557be4[_0x5ab6('0x2c')][_0x5ab6('0x2d')]};});_0x4da46e[_0x5ab6('0x2e')]=_['map'](_0x84f736,_0x5ab6('0x28'));_0x4da46e[_0x5ab6('0x2f')]=_[_0x5ab6('0x30')](_0x32972c[_0x5ab6('0x2f')]);_0x4da46e[_0x5ab6('0x31')]=_['intersection'](_0x4da46e['model'],_0x4da46e[_0x5ab6('0x2f')]);_0x3487ef[_0x5ab6('0x32')]=_['intersection'](_0x4da46e[_0x5ab6('0x2e')],qs[_0x5ab6('0x33')](_0x32972c[_0x5ab6('0x2f')][_0x5ab6('0x33')]));_0x3487ef[_0x5ab6('0x32')]=_0x3487ef[_0x5ab6('0x32')]['length']?_0x3487ef[_0x5ab6('0x32')]:_0x4da46e['model'];if(!_0x32972c[_0x5ab6('0x2f')]['hasOwnProperty'](_0x5ab6('0x34'))){_0x3487ef[_0x5ab6('0x1f')]=qs[_0x5ab6('0x1f')](_0x32972c[_0x5ab6('0x2f')][_0x5ab6('0x1f')]);_0x3487ef[_0x5ab6('0x1d')]=qs[_0x5ab6('0x1d')](_0x32972c[_0x5ab6('0x2f')][_0x5ab6('0x1d')]);}_0x3487ef['order']=qs[_0x5ab6('0x35')](_0x32972c['query'][_0x5ab6('0x35')]);_0x3487ef[_0x5ab6('0x36')]=qs[_0x5ab6('0x31')](_[_0x5ab6('0x37')](_0x32972c[_0x5ab6('0x2f')],_0x4da46e[_0x5ab6('0x31')]),_0x84f736);if(_0x32972c[_0x5ab6('0x2f')][_0x5ab6('0x38')]){_0x3487ef[_0x5ab6('0x36')]=_[_0x5ab6('0x39')](_0x3487ef['where'],{'$or':_[_0x5ab6('0x29')](_0x84f736,function(_0x593b27){if(_0x593b27[_0x5ab6('0x2c')]!==_0x5ab6('0x3a')){var _0x23bb82={};_0x23bb82[_0x593b27['name']]={'$like':'%'+_0x32972c[_0x5ab6('0x2f')][_0x5ab6('0x38')]+'%'};return _0x23bb82;}})});}_0x3487ef=_[_0x5ab6('0x39')]({},_0x3487ef,_0x32972c['options']);var _0x4bd6ac={'where':_0x3487ef[_0x5ab6('0x36')]};return db[_0x5ab6('0x2a')][_0x5ab6('0x20')](_0x4bd6ac)[_0x5ab6('0x24')](function(_0x4a72be){_0x3f674b[_0x5ab6('0x20')]=_0x4a72be;if(_0x32972c[_0x5ab6('0x2f')][_0x5ab6('0x3b')]){_0x3487ef[_0x5ab6('0x3c')]=[{'all':!![]}];}return db[_0x5ab6('0x2a')]['findAll'](_0x3487ef);})[_0x5ab6('0x24')](function(_0x3daa7d){_0x3f674b[_0x5ab6('0x3d')]=_0x3daa7d;return _0x3f674b;})[_0x5ab6('0x24')](respondWithFilteredResult(_0x48112e,_0x3487ef))[_0x5ab6('0x3e')](handleError(_0x48112e,null));};exports['show']=function(_0x3d9a76,_0x4f26dd){var _0x1336bf={'raw':!![],'where':{'id':_0x3d9a76['params']['id']}},_0x254460={};_0x254460['model']=_[_0x5ab6('0x30')](db[_0x5ab6('0x2a')][_0x5ab6('0x3f')]);_0x254460[_0x5ab6('0x2f')]=_[_0x5ab6('0x30')](_0x3d9a76['query']);_0x254460[_0x5ab6('0x31')]=_[_0x5ab6('0x40')](_0x254460[_0x5ab6('0x2e')],_0x254460['query']);_0x1336bf[_0x5ab6('0x32')]=_[_0x5ab6('0x40')](_0x254460['model'],qs[_0x5ab6('0x33')](_0x3d9a76[_0x5ab6('0x2f')][_0x5ab6('0x33')]));_0x1336bf[_0x5ab6('0x32')]=_0x1336bf[_0x5ab6('0x32')]['length']?_0x1336bf[_0x5ab6('0x32')]:_0x254460[_0x5ab6('0x2e')];if(_0x3d9a76[_0x5ab6('0x2f')]['includeAll']){_0x1336bf[_0x5ab6('0x3c')]=[{'all':!![]}];}_0x1336bf=_[_0x5ab6('0x39')]({},_0x1336bf,_0x3d9a76['options']);return db[_0x5ab6('0x2a')]['find'](_0x1336bf)[_0x5ab6('0x24')](handleEntityNotFound(_0x4f26dd,null))[_0x5ab6('0x24')](respondWithResult(_0x4f26dd,null))['catch'](handleError(_0x4f26dd,null));};exports[_0x5ab6('0x41')]=function(_0x1313e1,_0x2b4ff9){return db['Dynamics365Field'][_0x5ab6('0x41')](_0x1313e1[_0x5ab6('0x42')],{})[_0x5ab6('0x24')](respondWithResult(_0x2b4ff9,0xc9))[_0x5ab6('0x3e')](handleError(_0x2b4ff9,null));};exports['update']=function(_0x2659ce,_0x2f952a){if(_0x2659ce['body']['id']){delete _0x2659ce[_0x5ab6('0x42')]['id'];}return db[_0x5ab6('0x2a')]['find']({'where':{'id':_0x2659ce['params']['id']}})[_0x5ab6('0x24')](handleEntityNotFound(_0x2f952a,null))['then'](saveUpdates(_0x2659ce[_0x5ab6('0x42')],null))[_0x5ab6('0x24')](respondWithResult(_0x2f952a,null))[_0x5ab6('0x3e')](handleError(_0x2f952a,null));};exports[_0x5ab6('0x25')]=function(_0x4106e4,_0x593ee8){return db[_0x5ab6('0x2a')][_0x5ab6('0x43')]({'where':{'id':_0x4106e4[_0x5ab6('0x44')]['id']}})[_0x5ab6('0x24')](handleEntityNotFound(_0x593ee8,null))[_0x5ab6('0x24')](removeEntity(_0x593ee8,null))[_0x5ab6('0x3e')](handleError(_0x593ee8,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.model.js b/server/api/intDynamics365Field/intDynamics365Field.model.js index 2887ce2..a449d74 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 _0xc3c7=['../../config/environment','./intDynamics365Field.attributes','exports','define','dynamics365_unique_index','idField','FieldId','lodash','util','../../config/logger','moment','request-promise','path','rimraf'];(function(_0x4d9242,_0x385b6e){var _0x59301e=function(_0x54d2ef){while(--_0x54d2ef){_0x4d9242['push'](_0x4d9242['shift']());}};_0x59301e(++_0x385b6e);}(_0xc3c7,0x77));var _0x7c3c=function(_0x1d895d,_0x3e5c93){_0x1d895d=_0x1d895d-0x0;var _0x2dae23=_0xc3c7[_0x1d895d];return _0x2dae23;};'use strict';var _=require(_0x7c3c('0x0'));var util=require(_0x7c3c('0x1'));var logger=require(_0x7c3c('0x2'))('api');var moment=require(_0x7c3c('0x3'));var BPromise=require('bluebird');var rp=require(_0x7c3c('0x4'));var fs=require('fs');var path=require(_0x7c3c('0x5'));var rimraf=require(_0x7c3c('0x6'));var config=require(_0x7c3c('0x7'));var attributes=require(_0x7c3c('0x8'));module[_0x7c3c('0x9')]=function(_0x138e57,_0x5817a9){return _0x138e57[_0x7c3c('0xa')]('Dynamics365Field',attributes,{'tableName':'int_dynamics365_fields','paranoid':![],'indexes':[{'name':_0x7c3c('0xb'),'fields':[_0x7c3c('0xc'),_0x7c3c('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x1bb6=['lodash','util','../../config/logger','api','bluebird','rimraf','./intDynamics365Field.attributes','exports','define','dynamics365_unique_index','idField','FieldId'];(function(_0x3a7634,_0x2db384){var _0x23bbe9=function(_0x226734){while(--_0x226734){_0x3a7634['push'](_0x3a7634['shift']());}};_0x23bbe9(++_0x2db384);}(_0x1bb6,0x1b0));var _0x61bb=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x1bb6[_0x19e35c];return _0x3e1fe8;};'use strict';var _=require(_0x61bb('0x0'));var util=require(_0x61bb('0x1'));var logger=require(_0x61bb('0x2'))(_0x61bb('0x3'));var moment=require('moment');var BPromise=require(_0x61bb('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x61bb('0x5'));var config=require('../../config/environment');var attributes=require(_0x61bb('0x6'));module[_0x61bb('0x7')]=function(_0x41c4ec,_0x2104c1){return _0x41c4ec[_0x61bb('0x8')]('Dynamics365Field',attributes,{'tableName':'int_dynamics365_fields','paranoid':![],'indexes':[{'name':_0x61bb('0x9'),'fields':[_0x61bb('0xa'),_0x61bb('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 504a209..1f8249f 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 _0xc9d1=['then','info','Dynamics365Field,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request'];(function(_0x2461d3,_0x1adfe2){var _0x266394=function(_0x365850){while(--_0x365850){_0x2461d3['push'](_0x2461d3['shift']());}};_0x266394(++_0x1adfe2);}(_0xc9d1,0x172));var _0x1c9d=function(_0x12fde3,_0x4800c6){_0x12fde3=_0x12fde3-0x0;var _0x521038=_0xc9d1[_0x12fde3];return _0x521038;};'use strict';var _=require(_0x1c9d('0x0'));var util=require(_0x1c9d('0x1'));var moment=require(_0x1c9d('0x2'));var BPromise=require(_0x1c9d('0x3'));var rs=require(_0x1c9d('0x4'));var fs=require('fs');var Redis=require(_0x1c9d('0x5'));var db=require(_0x1c9d('0x6'))['db'];var utils=require(_0x1c9d('0x7'));var logger=require('../../config/logger')(_0x1c9d('0x8'));var config=require(_0x1c9d('0x9'));var jayson=require(_0x1c9d('0xa'));var client=jayson[_0x1c9d('0xb')][_0x1c9d('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x4f0c2c,_0x23f295,_0x350077){return new BPromise(function(_0x14a1d5,_0x3dea09){return client[_0x1c9d('0xd')](_0x4f0c2c,_0x350077)[_0x1c9d('0xe')](function(_0x447ea0){logger[_0x1c9d('0xf')](_0x1c9d('0x10'),_0x23f295,_0x1c9d('0x11'));logger[_0x1c9d('0x12')]('Dynamics365Field,\x20%s,\x20%s,\x20%s',_0x23f295,_0x1c9d('0x11'),JSON[_0x1c9d('0x13')](_0x447ea0));if(_0x447ea0[_0x1c9d('0x14')]){if(_0x447ea0[_0x1c9d('0x14')][_0x1c9d('0x15')]===0x1f4){logger[_0x1c9d('0x14')](_0x1c9d('0x10'),_0x23f295,_0x447ea0['error'][_0x1c9d('0x16')]);return _0x3dea09(_0x447ea0[_0x1c9d('0x14')]['message']);}logger[_0x1c9d('0x14')]('Dynamics365Field,\x20%s,\x20%s',_0x23f295,_0x447ea0['error'][_0x1c9d('0x16')]);return _0x14a1d5(_0x447ea0[_0x1c9d('0x14')]['message']);}else{logger[_0x1c9d('0xf')](_0x1c9d('0x10'),_0x23f295,_0x1c9d('0x11'));_0x14a1d5(_0x447ea0['result']['message']);}})[_0x1c9d('0x17')](function(_0x320bbd){logger[_0x1c9d('0x14')]('Dynamics365Field,\x20%s,\x20%s',_0x23f295,_0x320bbd);_0x3dea09(_0x320bbd);});});} \ No newline at end of file +var _0xf04a=['message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','then','info','Dynamics365Field,\x20%s,\x20%s','request\x20sent','Dynamics365Field,\x20%s,\x20%s,\x20%s','error','code'];(function(_0x380a7e,_0x1cd918){var _0x44c66f=function(_0xcad6f3){while(--_0xcad6f3){_0x380a7e['push'](_0x380a7e['shift']());}};_0x44c66f(++_0x1cd918);}(_0xf04a,0xb2));var _0xaf04=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xf04a[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xaf04('0x0'));var util=require(_0xaf04('0x1'));var moment=require(_0xaf04('0x2'));var BPromise=require(_0xaf04('0x3'));var rs=require(_0xaf04('0x4'));var fs=require('fs');var Redis=require(_0xaf04('0x5'));var db=require(_0xaf04('0x6'))['db'];var utils=require(_0xaf04('0x7'));var logger=require(_0xaf04('0x8'))('rpc');var config=require(_0xaf04('0x9'));var jayson=require(_0xaf04('0xa'));var client=jayson[_0xaf04('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1f0371,_0x5d6f5d,_0x574826){return new BPromise(function(_0xa42834,_0x113f5e){return client[_0xaf04('0xc')](_0x1f0371,_0x574826)[_0xaf04('0xd')](function(_0x15ad0b){logger[_0xaf04('0xe')](_0xaf04('0xf'),_0x5d6f5d,_0xaf04('0x10'));logger['debug'](_0xaf04('0x11'),_0x5d6f5d,_0xaf04('0x10'),JSON['stringify'](_0x15ad0b));if(_0x15ad0b[_0xaf04('0x12')]){if(_0x15ad0b['error'][_0xaf04('0x13')]===0x1f4){logger[_0xaf04('0x12')](_0xaf04('0xf'),_0x5d6f5d,_0x15ad0b[_0xaf04('0x12')][_0xaf04('0x14')]);return _0x113f5e(_0x15ad0b[_0xaf04('0x12')][_0xaf04('0x14')]);}logger[_0xaf04('0x12')](_0xaf04('0xf'),_0x5d6f5d,_0x15ad0b[_0xaf04('0x12')]['message']);return _0xa42834(_0x15ad0b[_0xaf04('0x12')][_0xaf04('0x14')]);}else{logger[_0xaf04('0xe')]('Dynamics365Field,\x20%s,\x20%s',_0x5d6f5d,'request\x20sent');_0xa42834(_0x15ad0b[_0xaf04('0x15')][_0xaf04('0x14')]);}})['catch'](function(_0x34b015){logger['error'](_0xaf04('0xf'),_0x5d6f5d,_0x34b015);_0x113f5e(_0x34b015);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/index.js b/server/api/intFreshdeskAccount/index.js index fb04704..4f472fc 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 _0xbe62=['get','/:id','show','/:id/configurations','/:id/fields','getFields','post','create','put','update','destroy','exports','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index'];(function(_0x46b22a,_0x5bf83a){var _0x44c2e8=function(_0x21b6fc){while(--_0x21b6fc){_0x46b22a['push'](_0x46b22a['shift']());}};_0x44c2e8(++_0x5bf83a);}(_0xbe62,0xf3));var _0x2be6=function(_0x48f3f1,_0x22c934){_0x48f3f1=_0x48f3f1-0x0;var _0xd43a99=_0xbe62[_0x48f3f1];return _0xd43a99;};'use strict';var multer=require('multer');var util=require(_0x2be6('0x0'));var path=require('path');var timeout=require(_0x2be6('0x1'));var express=require('express');var router=express[_0x2be6('0x2')]();var fs_extra=require(_0x2be6('0x3'));var auth=require(_0x2be6('0x4'));var interaction=require(_0x2be6('0x5'));var config=require(_0x2be6('0x6'));var controller=require('./intFreshdeskAccount.controller');router['get']('/',auth[_0x2be6('0x7')](),controller[_0x2be6('0x8')]);router[_0x2be6('0x9')](_0x2be6('0xa'),auth['isAuthenticated'](),controller[_0x2be6('0xb')]);router['get'](_0x2be6('0xc'),auth[_0x2be6('0x7')](),controller['getConfigurations']);router[_0x2be6('0x9')](_0x2be6('0xd'),auth['isAuthenticated'](),controller[_0x2be6('0xe')]);router[_0x2be6('0xf')]('/',auth['isAuthenticated'](),controller[_0x2be6('0x10')]);router[_0x2be6('0xf')]('/:id/configurations',auth[_0x2be6('0x7')](),controller['addConfiguration']);router[_0x2be6('0x11')](_0x2be6('0xa'),auth['isAuthenticated'](),controller[_0x2be6('0x12')]);router['delete'](_0x2be6('0xa'),auth[_0x2be6('0x7')](),controller[_0x2be6('0x13')]);module[_0x2be6('0x14')]=router; \ No newline at end of file +var _0x77f4=['connect-timeout','express','Router','fs-extra','../../components/auth/service','./intFreshdeskAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','multer','util','path'];(function(_0x165545,_0x319611){var _0x21c922=function(_0x1e5777){while(--_0x1e5777){_0x165545['push'](_0x165545['shift']());}};_0x21c922(++_0x319611);}(_0x77f4,0xd5));var _0x477f=function(_0x5afa59,_0x505bd7){_0x5afa59=_0x5afa59-0x0;var _0x5db28b=_0x77f4[_0x5afa59];return _0x5db28b;};'use strict';var multer=require(_0x477f('0x0'));var util=require(_0x477f('0x1'));var path=require(_0x477f('0x2'));var timeout=require(_0x477f('0x3'));var express=require(_0x477f('0x4'));var router=express[_0x477f('0x5')]();var fs_extra=require(_0x477f('0x6'));var auth=require(_0x477f('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x477f('0x8'));router[_0x477f('0x9')]('/',auth[_0x477f('0xa')](),controller[_0x477f('0xb')]);router[_0x477f('0x9')](_0x477f('0xc'),auth[_0x477f('0xa')](),controller[_0x477f('0xd')]);router['get'](_0x477f('0xe'),auth[_0x477f('0xa')](),controller[_0x477f('0xf')]);router[_0x477f('0x9')](_0x477f('0x10'),auth[_0x477f('0xa')](),controller[_0x477f('0x11')]);router[_0x477f('0x12')]('/',auth[_0x477f('0xa')](),controller[_0x477f('0x13')]);router[_0x477f('0x12')](_0x477f('0xe'),auth[_0x477f('0xa')](),controller[_0x477f('0x14')]);router[_0x477f('0x15')](_0x477f('0xc'),auth[_0x477f('0xa')](),controller[_0x477f('0x16')]);router[_0x477f('0x17')]('/:id',auth[_0x477f('0xa')](),controller['destroy']);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 ac39325..559d0cd 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 _0x66fa=['exports','STRING','username','remoteUri','sequelize'];(function(_0x12b8b7,_0xff939a){var _0x3cbd4b=function(_0x547a00){while(--_0x547a00){_0x12b8b7['push'](_0x12b8b7['shift']());}};_0x3cbd4b(++_0xff939a);}(_0x66fa,0x117));var _0xa66f=function(_0x2a52fe,_0x2de2fb){_0x2a52fe=_0x2a52fe-0x0;var _0x41e9b4=_0x66fa[_0x2a52fe];return _0x41e9b4;};'use strict';var Sequelize=require(_0xa66f('0x0'));module[_0xa66f('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xa66f('0x2')]},'username':{'type':Sequelize[_0xa66f('0x2')],'unique':_0xa66f('0x3')},'apiKey':{'type':Sequelize[_0xa66f('0x2')]},'remoteUri':{'type':Sequelize[_0xa66f('0x2')],'unique':_0xa66f('0x4')},'serverUrl':{'type':Sequelize[_0xa66f('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0xffd6=['exports','STRING','username','sequelize'];(function(_0xe53cb0,_0xd1b120){var _0x2b0c0d=function(_0x308b44){while(--_0x308b44){_0xe53cb0['push'](_0xe53cb0['shift']());}};_0x2b0c0d(++_0xd1b120);}(_0xffd6,0x97));var _0x6ffd=function(_0x1c0991,_0x4f22d2){_0x1c0991=_0x1c0991-0x0;var _0x5034de=_0xffd6[_0x1c0991];return _0x5034de;};'use strict';var Sequelize=require(_0x6ffd('0x0'));module[_0x6ffd('0x1')]={'name':{'type':Sequelize[_0x6ffd('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize['STRING'],'unique':_0x6ffd('0x3')},'apiKey':{'type':Sequelize[_0x6ffd('0x2')]},'remoteUri':{'type':Sequelize[_0x6ffd('0x2')],'unique':'remoteUri'},'serverUrl':{'type':Sequelize[_0x6ffd('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js index 2769706..d91b251 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 _0xcff8=['papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','status','json','offset','undefined','limit','set','Content-Range','apply','reject','save','update','destroy','then','end','sendStatus','error','stack','name','send','index','map','FreshdeskAccount','rawAttributes','fieldName','key','query','filters','model','attributes','fields','length','hasOwnProperty','nolimit','order','where','pick','merge','type','VIRTUAL','filter','options','count','includeAll','rows','catch','show','params','intersection','find','body','findOne','FreshdeskConfiguration','keys','sort','getConfigurations','getSubjects','Descriptions','channel','create','FreshdeskField','getFields','remoteUri','apiKey','substring','lastIndexOf','GET','format','api/v2/ticket_fields','Basic\x20%s','%s:X','toString','base64','requester','subject','agent','priority','source','ticket_type','group','remove','includes','default','custom_text','custom_dropdown','choices','capitalize','test','statusCode','stringify','Wrong\x20credentials','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv'];(function(_0x515232,_0x3de920){var _0x45685c=function(_0x25bae8){while(--_0x25bae8){_0x515232['push'](_0x515232['shift']());}};_0x45685c(++_0x3de920);}(_0xcff8,0x14b));var _0x8cff=function(_0x4e4e88,_0x5d70ff){_0x4e4e88=_0x4e4e88-0x0;var _0x4a93ae=_0xcff8[_0x4e4e88];return _0x4a93ae;};'use strict';var emlformat=require(_0x8cff('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x8cff('0x1'));var jsonpatch=require(_0x8cff('0x2'));var rp=require('request-promise');var moment=require(_0x8cff('0x3'));var BPromise=require(_0x8cff('0x4'));var Mustache=require(_0x8cff('0x5'));var util=require(_0x8cff('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(_0x8cff('0x7'));var _=require(_0x8cff('0x8'));var squel=require(_0x8cff('0x9'));var crypto=require(_0x8cff('0xa'));var jsforce=require(_0x8cff('0xb'));var deskjs=require(_0x8cff('0xc'));var toCsv=require(_0x8cff('0xd'));var querystring=require('querystring');var Papa=require(_0x8cff('0xe'));var Redis=require(_0x8cff('0xf'));var authService=require(_0x8cff('0x10'));var qs=require(_0x8cff('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8cff('0x12'));var logger=require(_0x8cff('0x13'))(_0x8cff('0x14'));var utils=require(_0x8cff('0x15'));var config=require(_0x8cff('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x8cff('0x17'))['db'];var integrations=require(_0x8cff('0x18'));function respondWithStatusCode(_0x20acb7,_0x3e642b){_0x3e642b=_0x3e642b||0xcc;return function(_0x313373){if(_0x313373){return _0x20acb7['sendStatus'](_0x3e642b);}return _0x20acb7[_0x8cff('0x19')](_0x3e642b)['end']();};}function respondWithResult(_0x4b3faf,_0x1d8c09){_0x1d8c09=_0x1d8c09||0xc8;return function(_0x40b492){if(_0x40b492){return _0x4b3faf[_0x8cff('0x19')](_0x1d8c09)[_0x8cff('0x1a')](_0x40b492);}};}function respondWithFilteredResult(_0x26d516,_0xac398f){return function(_0x31214d){if(_0x31214d){var _0xd3cbe9=typeof _0xac398f[_0x8cff('0x1b')]===_0x8cff('0x1c')&&typeof _0xac398f[_0x8cff('0x1d')]===_0x8cff('0x1c');var _0x2db2dd=_0x31214d['count'];var _0x3d07a8=_0xd3cbe9?0x0:_0xac398f['offset'];var _0x585d1d=_0xd3cbe9?_0x31214d['count']:_0xac398f[_0x8cff('0x1b')]+_0xac398f['limit'];var _0x109742;if(_0x585d1d>=_0x2db2dd){_0x585d1d=_0x2db2dd;_0x109742=0xc8;}else{_0x109742=0xce;}_0x26d516[_0x8cff('0x19')](_0x109742);return _0x26d516[_0x8cff('0x1e')](_0x8cff('0x1f'),_0x3d07a8+'-'+_0x585d1d+'/'+_0x2db2dd)['json'](_0x31214d);}return null;};}function patchUpdates(_0x2ab819){return function(_0x448538){try{jsonpatch[_0x8cff('0x20')](_0x448538,_0x2ab819,!![]);}catch(_0x38cfe1){return BPromise[_0x8cff('0x21')](_0x38cfe1);}return _0x448538[_0x8cff('0x22')]();};}function saveUpdates(_0x2d4770,_0x53a9af){return function(_0x3a3321){if(_0x3a3321){return _0x3a3321[_0x8cff('0x23')](_0x2d4770)['then'](function(_0x4e171c){return _0x4e171c;});}return null;};}function removeEntity(_0x4b211e,_0x1d4c93){return function(_0x354c3b){if(_0x354c3b){return _0x354c3b[_0x8cff('0x24')]()[_0x8cff('0x25')](function(){_0x4b211e[_0x8cff('0x19')](0xcc)[_0x8cff('0x26')]();});}};}function handleEntityNotFound(_0xb46b17,_0x149fe5){return function(_0x47c166){if(!_0x47c166){_0xb46b17[_0x8cff('0x27')](0x194);}return _0x47c166;};}function handleError(_0x55f03b,_0xf47d91){_0xf47d91=_0xf47d91||0x1f4;return function(_0x42407f){logger[_0x8cff('0x28')](_0x42407f[_0x8cff('0x29')]);if(_0x42407f[_0x8cff('0x2a')]){delete _0x42407f[_0x8cff('0x2a')];}_0x55f03b[_0x8cff('0x19')](_0xf47d91)[_0x8cff('0x2b')](_0x42407f);};}exports[_0x8cff('0x2c')]=function(_0x1fcb15,_0x1852b2){var _0x60244d={},_0x5248d2={},_0x541a9c={'count':0x0,'rows':[]};var _0x41ea22=_[_0x8cff('0x2d')](db[_0x8cff('0x2e')][_0x8cff('0x2f')],function(_0x59f74b){return{'name':_0x59f74b[_0x8cff('0x30')],'type':_0x59f74b['type'][_0x8cff('0x31')]};});_0x5248d2['model']=_[_0x8cff('0x2d')](_0x41ea22,'name');_0x5248d2[_0x8cff('0x32')]=_['keys'](_0x1fcb15['query']);_0x5248d2[_0x8cff('0x33')]=_['intersection'](_0x5248d2[_0x8cff('0x34')],_0x5248d2['query']);_0x60244d[_0x8cff('0x35')]=_['intersection'](_0x5248d2['model'],qs[_0x8cff('0x36')](_0x1fcb15[_0x8cff('0x32')][_0x8cff('0x36')]));_0x60244d[_0x8cff('0x35')]=_0x60244d[_0x8cff('0x35')][_0x8cff('0x37')]?_0x60244d[_0x8cff('0x35')]:_0x5248d2[_0x8cff('0x34')];if(!_0x1fcb15[_0x8cff('0x32')][_0x8cff('0x38')](_0x8cff('0x39'))){_0x60244d['limit']=qs[_0x8cff('0x1d')](_0x1fcb15[_0x8cff('0x32')]['limit']);_0x60244d[_0x8cff('0x1b')]=qs[_0x8cff('0x1b')](_0x1fcb15[_0x8cff('0x32')][_0x8cff('0x1b')]);}_0x60244d[_0x8cff('0x3a')]=qs['sort'](_0x1fcb15[_0x8cff('0x32')]['sort']);_0x60244d[_0x8cff('0x3b')]=qs[_0x8cff('0x33')](_[_0x8cff('0x3c')](_0x1fcb15[_0x8cff('0x32')],_0x5248d2['filters']),_0x41ea22);if(_0x1fcb15[_0x8cff('0x32')]['filter']){_0x60244d[_0x8cff('0x3b')]=_[_0x8cff('0x3d')](_0x60244d[_0x8cff('0x3b')],{'$or':_[_0x8cff('0x2d')](_0x41ea22,function(_0x29b61d){if(_0x29b61d[_0x8cff('0x3e')]!==_0x8cff('0x3f')){var _0x5c28a3={};_0x5c28a3[_0x29b61d[_0x8cff('0x2a')]]={'$like':'%'+_0x1fcb15['query'][_0x8cff('0x40')]+'%'};return _0x5c28a3;}})});}_0x60244d=_[_0x8cff('0x3d')]({},_0x60244d,_0x1fcb15[_0x8cff('0x41')]);var _0x23d55d={'where':_0x60244d['where']};return db[_0x8cff('0x2e')][_0x8cff('0x42')](_0x23d55d)[_0x8cff('0x25')](function(_0xe2525c){_0x541a9c['count']=_0xe2525c;if(_0x1fcb15[_0x8cff('0x32')][_0x8cff('0x43')]){_0x60244d['include']=[{'all':!![]}];}return db[_0x8cff('0x2e')]['findAll'](_0x60244d);})['then'](function(_0x39849a){_0x541a9c[_0x8cff('0x44')]=_0x39849a;return _0x541a9c;})[_0x8cff('0x25')](respondWithFilteredResult(_0x1852b2,_0x60244d))[_0x8cff('0x45')](handleError(_0x1852b2,null));};exports[_0x8cff('0x46')]=function(_0x571646,_0x403d83){var _0x3c72eb={'raw':![],'where':{'id':_0x571646[_0x8cff('0x47')]['id']}},_0x132ece={};_0x132ece[_0x8cff('0x34')]=_['keys'](db['FreshdeskAccount'][_0x8cff('0x2f')]);_0x132ece['query']=_['keys'](_0x571646[_0x8cff('0x32')]);_0x132ece['filters']=_[_0x8cff('0x48')](_0x132ece[_0x8cff('0x34')],_0x132ece[_0x8cff('0x32')]);_0x3c72eb[_0x8cff('0x35')]=_[_0x8cff('0x48')](_0x132ece['model'],qs[_0x8cff('0x36')](_0x571646['query'][_0x8cff('0x36')]));_0x3c72eb[_0x8cff('0x35')]=_0x3c72eb[_0x8cff('0x35')]['length']?_0x3c72eb[_0x8cff('0x35')]:_0x132ece[_0x8cff('0x34')];if(_0x571646['query'][_0x8cff('0x43')]){_0x3c72eb['include']=[{'all':!![]}];}_0x3c72eb=_['merge']({},_0x3c72eb,_0x571646[_0x8cff('0x41')]);return db['FreshdeskAccount'][_0x8cff('0x49')](_0x3c72eb)[_0x8cff('0x25')](handleEntityNotFound(_0x403d83,null))['then'](respondWithResult(_0x403d83,null))[_0x8cff('0x45')](handleError(_0x403d83,null));};exports['create']=function(_0x45ec06,_0x4f7bc4){return db['FreshdeskAccount']['create'](_0x45ec06[_0x8cff('0x4a')],{})[_0x8cff('0x25')](respondWithResult(_0x4f7bc4,0xc9))[_0x8cff('0x45')](handleError(_0x4f7bc4,null));};exports[_0x8cff('0x23')]=function(_0x3501c5,_0x5d1f9d){if(_0x3501c5[_0x8cff('0x4a')]['id']){delete _0x3501c5[_0x8cff('0x4a')]['id'];}return db[_0x8cff('0x2e')][_0x8cff('0x49')]({'where':{'id':_0x3501c5['params']['id']}})[_0x8cff('0x25')](handleEntityNotFound(_0x5d1f9d,null))['then'](saveUpdates(_0x3501c5[_0x8cff('0x4a')],null))[_0x8cff('0x25')](respondWithResult(_0x5d1f9d,null))['catch'](handleError(_0x5d1f9d,null));};exports[_0x8cff('0x24')]=function(_0x27efda,_0x5c5d){return db['FreshdeskAccount'][_0x8cff('0x49')]({'where':{'id':_0x27efda['params']['id']}})[_0x8cff('0x25')](handleEntityNotFound(_0x5c5d,null))[_0x8cff('0x25')](removeEntity(_0x5c5d,null))['catch'](handleError(_0x5c5d,null));};exports['getConfigurations']=function(_0x57534f,_0x4ddaba,_0x5466b3){var _0x546d0a={};var _0x934063={};var _0x2b0db3;var _0x5a43bd;return db[_0x8cff('0x2e')][_0x8cff('0x4b')]({'where':{'id':_0x57534f[_0x8cff('0x47')]['id']}})[_0x8cff('0x25')](handleEntityNotFound(_0x4ddaba,null))[_0x8cff('0x25')](function(_0x2e77a3){if(_0x2e77a3){_0x2b0db3=_0x2e77a3;_0x934063['model']=_['keys'](db[_0x8cff('0x4c')][_0x8cff('0x2f')]);_0x934063[_0x8cff('0x32')]=_[_0x8cff('0x4d')](_0x57534f[_0x8cff('0x32')]);_0x934063[_0x8cff('0x33')]=_[_0x8cff('0x48')](_0x934063['model'],_0x934063[_0x8cff('0x32')]);_0x546d0a[_0x8cff('0x35')]=_[_0x8cff('0x48')](_0x934063[_0x8cff('0x34')],qs['fields'](_0x57534f[_0x8cff('0x32')][_0x8cff('0x36')]));_0x546d0a[_0x8cff('0x35')]=_0x546d0a[_0x8cff('0x35')][_0x8cff('0x37')]?_0x546d0a[_0x8cff('0x35')]:_0x934063[_0x8cff('0x34')];_0x546d0a['order']=qs[_0x8cff('0x4e')](_0x57534f['query'][_0x8cff('0x4e')]);_0x546d0a['where']=qs[_0x8cff('0x33')](_['pick'](_0x57534f[_0x8cff('0x32')],_0x934063[_0x8cff('0x33')]));if(_0x57534f[_0x8cff('0x32')][_0x8cff('0x40')]){_0x546d0a[_0x8cff('0x3b')]=_['merge'](_0x546d0a[_0x8cff('0x3b')],{'$or':_[_0x8cff('0x2d')](_0x546d0a[_0x8cff('0x35')],function(_0x1b7e2f){var _0x5a70c1={};_0x5a70c1[_0x1b7e2f]={'$like':'%'+_0x57534f[_0x8cff('0x32')][_0x8cff('0x40')]+'%'};return _0x5a70c1;})});}_0x546d0a=_[_0x8cff('0x3d')]({},_0x546d0a,_0x57534f[_0x8cff('0x41')]);return _0x2b0db3[_0x8cff('0x4f')](_0x546d0a);}})['then'](function(_0x59275a){if(_0x59275a){_0x5a43bd=_0x59275a[_0x8cff('0x37')];if(!_0x57534f[_0x8cff('0x32')][_0x8cff('0x38')](_0x8cff('0x39'))){_0x546d0a[_0x8cff('0x1d')]=qs[_0x8cff('0x1d')](_0x57534f['query'][_0x8cff('0x1d')]);_0x546d0a[_0x8cff('0x1b')]=qs['offset'](_0x57534f['query'][_0x8cff('0x1b')]);}return _0x2b0db3[_0x8cff('0x4f')](_0x546d0a);}})[_0x8cff('0x25')](function(_0x295780){if(_0x295780){return _0x295780?{'count':_0x5a43bd,'rows':_0x295780}:null;}})[_0x8cff('0x25')](respondWithResult(_0x4ddaba,null))[_0x8cff('0x45')](handleError(_0x4ddaba,null));};exports['addConfiguration']=function(_0x505907,_0x2585cd,_0xc0d284){if(_0x505907[_0x8cff('0x4a')]['id']){delete _0x505907['body']['id'];}return db[_0x8cff('0x2e')][_0x8cff('0x4b')]({'where':{'id':_0x505907['params']['id']}})['then'](handleEntityNotFound(_0x2585cd,null))[_0x8cff('0x25')](function(_0x26acd3){if(_0x26acd3){_0x505907['body']['AccountId']=_0x26acd3['id'];_0x505907[_0x8cff('0x4a')]['Subjects']=integrations[_0x8cff('0x50')](_0x505907['body']['channel'],_0x505907[_0x8cff('0x4a')]['type']);_0x505907[_0x8cff('0x4a')][_0x8cff('0x51')]=integrations['getDescriptions'](_0x505907[_0x8cff('0x4a')][_0x8cff('0x52')],_0x505907[_0x8cff('0x4a')][_0x8cff('0x3e')]);return db[_0x8cff('0x4c')][_0x8cff('0x53')](_0x505907[_0x8cff('0x4a')],{'include':[{'model':db[_0x8cff('0x54')],'as':'Subjects'},{'model':db['FreshdeskField'],'as':_0x8cff('0x51')}]});}return null;})['then'](respondWithResult(_0x2585cd,null))['catch'](handleError(_0x2585cd,null));};exports[_0x8cff('0x55')]=function(_0x233cd8,_0x37bc92,_0x1a00c1){var _0x385ea0='';return db['FreshdeskAccount']['findOne']({'where':{'id':_0x233cd8[_0x8cff('0x47')]['id']},'attributes':['id',_0x8cff('0x56'),_0x8cff('0x57')]})[_0x8cff('0x25')](handleEntityNotFound(_0x37bc92,null))[_0x8cff('0x25')](function(_0x20d92c){if(_0x20d92c){_0x385ea0=_0x20d92c['remoteUri'];var _0x2815b8=_0x385ea0['slice'](-0x1);if(_0x2815b8==='/'){_0x385ea0=_0x385ea0[_0x8cff('0x58')](0x0,_0x385ea0[_0x8cff('0x59')](_0x2815b8));}return rp({'method':_0x8cff('0x5a'),'uri':util[_0x8cff('0x5b')]('%s/%s',_0x385ea0,_0x8cff('0x5c')),'headers':{'Authorization':util[_0x8cff('0x5b')](_0x8cff('0x5d'),new Buffer(util[_0x8cff('0x5b')](_0x8cff('0x5e'),_0x20d92c[_0x8cff('0x57')]))[_0x8cff('0x5f')](_0x8cff('0x60')))},'json':!![]});}})['then'](function(_0x33a62f){if(_0x33a62f){var _0x194544=[_0x8cff('0x61'),_0x8cff('0x62'),_0x8cff('0x63'),'description',_0x8cff('0x19'),_0x8cff('0x64'),'group',_0x8cff('0x65'),_0x8cff('0x66'),_0x8cff('0x67'),'company'];_[_0x8cff('0x68')](_0x33a62f,function(_0x51c868){return _0x194544[_0x8cff('0x69')](_0x51c868[_0x8cff('0x2a')])||!_0x51c868[_0x8cff('0x6a')]&&_0x51c868['type']!==_0x8cff('0x6b')&&_0x51c868['type']!==_0x8cff('0x6c');});return{'count':_0x33a62f[_0x8cff('0x37')],'rows':_[_0x8cff('0x2d')](_0x33a62f,function(_0x14d0cc){return{'id':_0x14d0cc['name'],'name':_0x14d0cc['label'],'custom':!_0x14d0cc['default'],'options':_0x14d0cc[_0x8cff('0x6d')]?_[_0x8cff('0x2d')](_0x14d0cc[_0x8cff('0x6d')],function(_0x95c58e){return{'name':_[_0x8cff('0x6e')](_0x95c58e),'value':_0x95c58e};}):[]};})};}})[_0x8cff('0x25')](respondWithResult(_0x37bc92,null))[_0x8cff('0x45')](function(_0x3a4e58){var _0x55efc1=_0x233cd8[_0x8cff('0x32')][_0x8cff('0x6f')]?0x1f4:_0x3a4e58[_0x8cff('0x70')]||0x1f4;logger['error']('getFields,\x20%s,\x20%s,\x20%s',_0x8cff('0x55'),_0x55efc1,JSON[_0x8cff('0x71')](_0x3a4e58));delete _0x3a4e58['name'];if(_0x55efc1===0x191){_0x55efc1=0x190;}_0x37bc92['status'](_0x55efc1)[_0x8cff('0x2b')](_0x233cd8[_0x8cff('0x32')][_0x8cff('0x6f')]?{'message':_0x8cff('0x72'),'statusCode':_0x3a4e58['statusCode']}:_0x3a4e58);});}; \ No newline at end of file +var _0x93ed=['requester','subject','agent','description','priority','group','source','ticket_type','remove','includes','default','custom_text','custom_dropdown','label','choices','capitalize','test','statusCode','stringify','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','status','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','destroy','end','error','stack','name','send','FreshdeskAccount','rawAttributes','fieldName','type','key','map','query','keys','filters','intersection','fields','attributes','model','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','includeAll','include','rows','show','length','find','catch','create','body','getConfigurations','params','FreshdeskConfiguration','addConfiguration','findOne','AccountId','Subjects','getSubjects','channel','Descriptions','FreshdeskField','getFields','remoteUri','apiKey','substring','lastIndexOf','GET','%s/%s','api/v2/ticket_fields','format','Basic\x20%s','%s:X','toString','base64'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x93ed,0xfe));var _0xd93e=function(_0x2e19c6,_0x271b24){_0x2e19c6=_0x2e19c6-0x0;var _0x2150e4=_0x93ed[_0x2e19c6];return _0x2150e4;};'use strict';var emlformat=require(_0xd93e('0x0'));var rimraf=require(_0xd93e('0x1'));var zipdir=require(_0xd93e('0x2'));var jsonpatch=require(_0xd93e('0x3'));var rp=require(_0xd93e('0x4'));var moment=require('moment');var BPromise=require(_0xd93e('0x5'));var Mustache=require('mustache');var util=require(_0xd93e('0x6'));var path=require(_0xd93e('0x7'));var sox=require('sox');var csv=require(_0xd93e('0x8'));var ejs=require(_0xd93e('0x9'));var fs=require('fs');var fs_extra=require(_0xd93e('0xa'));var _=require(_0xd93e('0xb'));var squel=require(_0xd93e('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xd93e('0xd'));var toCsv=require(_0xd93e('0x8'));var querystring=require(_0xd93e('0xe'));var Papa=require(_0xd93e('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xd93e('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd93e('0x11'));var logger=require(_0xd93e('0x12'))(_0xd93e('0x13'));var utils=require(_0xd93e('0x14'));var config=require(_0xd93e('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xd93e('0x16'))['db'];var integrations=require(_0xd93e('0x17'));function respondWithStatusCode(_0x444b08,_0x2e4284){_0x2e4284=_0x2e4284||0xcc;return function(_0x2032c7){if(_0x2032c7){return _0x444b08['sendStatus'](_0x2e4284);}return _0x444b08['status'](_0x2e4284)['end']();};}function respondWithResult(_0x567589,_0x1e1ef4){_0x1e1ef4=_0x1e1ef4||0xc8;return function(_0x42eea7){if(_0x42eea7){return _0x567589[_0xd93e('0x18')](_0x1e1ef4)['json'](_0x42eea7);}};}function respondWithFilteredResult(_0xc53b90,_0x490bc0){return function(_0x1826b8){if(_0x1826b8){var _0x164238=typeof _0x490bc0[_0xd93e('0x19')]===_0xd93e('0x1a')&&typeof _0x490bc0[_0xd93e('0x1b')]===_0xd93e('0x1a');var _0x433ced=_0x1826b8['count'];var _0x50c196=_0x164238?0x0:_0x490bc0['offset'];var _0x2e9fff=_0x164238?_0x1826b8[_0xd93e('0x1c')]:_0x490bc0[_0xd93e('0x19')]+_0x490bc0['limit'];var _0x4c1d3a;if(_0x2e9fff>=_0x433ced){_0x2e9fff=_0x433ced;_0x4c1d3a=0xc8;}else{_0x4c1d3a=0xce;}_0xc53b90[_0xd93e('0x18')](_0x4c1d3a);return _0xc53b90[_0xd93e('0x1d')](_0xd93e('0x1e'),_0x50c196+'-'+_0x2e9fff+'/'+_0x433ced)[_0xd93e('0x1f')](_0x1826b8);}return null;};}function patchUpdates(_0x5bc3f9){return function(_0x23b151){try{jsonpatch[_0xd93e('0x20')](_0x23b151,_0x5bc3f9,!![]);}catch(_0x336e14){return BPromise[_0xd93e('0x21')](_0x336e14);}return _0x23b151[_0xd93e('0x22')]();};}function saveUpdates(_0x4909c1,_0x52376d){return function(_0x287e01){if(_0x287e01){return _0x287e01[_0xd93e('0x23')](_0x4909c1)[_0xd93e('0x24')](function(_0xe5553f){return _0xe5553f;});}return null;};}function removeEntity(_0xd74297,_0x128e72){return function(_0xa0bcbe){if(_0xa0bcbe){return _0xa0bcbe[_0xd93e('0x25')]()[_0xd93e('0x24')](function(){_0xd74297[_0xd93e('0x18')](0xcc)[_0xd93e('0x26')]();});}};}function handleEntityNotFound(_0x538a3e,_0xf6c667){return function(_0x50eec4){if(!_0x50eec4){_0x538a3e['sendStatus'](0x194);}return _0x50eec4;};}function handleError(_0x1b2f60,_0x2175ad){_0x2175ad=_0x2175ad||0x1f4;return function(_0x5aaa9a){logger[_0xd93e('0x27')](_0x5aaa9a[_0xd93e('0x28')]);if(_0x5aaa9a[_0xd93e('0x29')]){delete _0x5aaa9a['name'];}_0x1b2f60[_0xd93e('0x18')](_0x2175ad)[_0xd93e('0x2a')](_0x5aaa9a);};}exports['index']=function(_0x2bff6e,_0x131a9c){var _0x49dae={},_0x41c479={},_0x4e4895={'count':0x0,'rows':[]};var _0x519ee8=_['map'](db[_0xd93e('0x2b')][_0xd93e('0x2c')],function(_0x23c1b4){return{'name':_0x23c1b4[_0xd93e('0x2d')],'type':_0x23c1b4[_0xd93e('0x2e')][_0xd93e('0x2f')]};});_0x41c479['model']=_[_0xd93e('0x30')](_0x519ee8,'name');_0x41c479[_0xd93e('0x31')]=_[_0xd93e('0x32')](_0x2bff6e[_0xd93e('0x31')]);_0x41c479[_0xd93e('0x33')]=_[_0xd93e('0x34')](_0x41c479['model'],_0x41c479['query']);_0x49dae['attributes']=_['intersection'](_0x41c479['model'],qs[_0xd93e('0x35')](_0x2bff6e[_0xd93e('0x31')][_0xd93e('0x35')]));_0x49dae['attributes']=_0x49dae[_0xd93e('0x36')]['length']?_0x49dae['attributes']:_0x41c479[_0xd93e('0x37')];if(!_0x2bff6e[_0xd93e('0x31')][_0xd93e('0x38')](_0xd93e('0x39'))){_0x49dae['limit']=qs['limit'](_0x2bff6e[_0xd93e('0x31')][_0xd93e('0x1b')]);_0x49dae[_0xd93e('0x19')]=qs['offset'](_0x2bff6e[_0xd93e('0x31')][_0xd93e('0x19')]);}_0x49dae['order']=qs['sort'](_0x2bff6e['query'][_0xd93e('0x3a')]);_0x49dae[_0xd93e('0x3b')]=qs[_0xd93e('0x33')](_[_0xd93e('0x3c')](_0x2bff6e[_0xd93e('0x31')],_0x41c479[_0xd93e('0x33')]),_0x519ee8);if(_0x2bff6e[_0xd93e('0x31')]['filter']){_0x49dae[_0xd93e('0x3b')]=_['merge'](_0x49dae[_0xd93e('0x3b')],{'$or':_['map'](_0x519ee8,function(_0x35423f){if(_0x35423f[_0xd93e('0x2e')]!=='VIRTUAL'){var _0x341010={};_0x341010[_0x35423f[_0xd93e('0x29')]]={'$like':'%'+_0x2bff6e['query'][_0xd93e('0x3d')]+'%'};return _0x341010;}})});}_0x49dae=_[_0xd93e('0x3e')]({},_0x49dae,_0x2bff6e[_0xd93e('0x3f')]);var _0x5090bb={'where':_0x49dae['where']};return db['FreshdeskAccount'][_0xd93e('0x1c')](_0x5090bb)[_0xd93e('0x24')](function(_0x17a368){_0x4e4895[_0xd93e('0x1c')]=_0x17a368;if(_0x2bff6e[_0xd93e('0x31')][_0xd93e('0x40')]){_0x49dae[_0xd93e('0x41')]=[{'all':!![]}];}return db[_0xd93e('0x2b')]['findAll'](_0x49dae);})[_0xd93e('0x24')](function(_0x5eeee6){_0x4e4895[_0xd93e('0x42')]=_0x5eeee6;return _0x4e4895;})[_0xd93e('0x24')](respondWithFilteredResult(_0x131a9c,_0x49dae))['catch'](handleError(_0x131a9c,null));};exports[_0xd93e('0x43')]=function(_0x3d490d,_0x11d951){var _0x20c463={'raw':![],'where':{'id':_0x3d490d['params']['id']}},_0x2204c3={};_0x2204c3[_0xd93e('0x37')]=_[_0xd93e('0x32')](db[_0xd93e('0x2b')]['rawAttributes']);_0x2204c3[_0xd93e('0x31')]=_['keys'](_0x3d490d['query']);_0x2204c3[_0xd93e('0x33')]=_[_0xd93e('0x34')](_0x2204c3[_0xd93e('0x37')],_0x2204c3['query']);_0x20c463['attributes']=_[_0xd93e('0x34')](_0x2204c3[_0xd93e('0x37')],qs[_0xd93e('0x35')](_0x3d490d[_0xd93e('0x31')]['fields']));_0x20c463['attributes']=_0x20c463[_0xd93e('0x36')][_0xd93e('0x44')]?_0x20c463[_0xd93e('0x36')]:_0x2204c3[_0xd93e('0x37')];if(_0x3d490d[_0xd93e('0x31')][_0xd93e('0x40')]){_0x20c463[_0xd93e('0x41')]=[{'all':!![]}];}_0x20c463=_[_0xd93e('0x3e')]({},_0x20c463,_0x3d490d[_0xd93e('0x3f')]);return db[_0xd93e('0x2b')][_0xd93e('0x45')](_0x20c463)[_0xd93e('0x24')](handleEntityNotFound(_0x11d951,null))[_0xd93e('0x24')](respondWithResult(_0x11d951,null))[_0xd93e('0x46')](handleError(_0x11d951,null));};exports[_0xd93e('0x47')]=function(_0x1624da,_0x543de8){return db[_0xd93e('0x2b')][_0xd93e('0x47')](_0x1624da[_0xd93e('0x48')],{})[_0xd93e('0x24')](respondWithResult(_0x543de8,0xc9))['catch'](handleError(_0x543de8,null));};exports[_0xd93e('0x23')]=function(_0x57ba4f,_0x467b02){if(_0x57ba4f[_0xd93e('0x48')]['id']){delete _0x57ba4f[_0xd93e('0x48')]['id'];}return db[_0xd93e('0x2b')][_0xd93e('0x45')]({'where':{'id':_0x57ba4f['params']['id']}})[_0xd93e('0x24')](handleEntityNotFound(_0x467b02,null))[_0xd93e('0x24')](saveUpdates(_0x57ba4f[_0xd93e('0x48')],null))[_0xd93e('0x24')](respondWithResult(_0x467b02,null))[_0xd93e('0x46')](handleError(_0x467b02,null));};exports['destroy']=function(_0x1d552d,_0xef2705){return db[_0xd93e('0x2b')][_0xd93e('0x45')]({'where':{'id':_0x1d552d['params']['id']}})['then'](handleEntityNotFound(_0xef2705,null))[_0xd93e('0x24')](removeEntity(_0xef2705,null))[_0xd93e('0x46')](handleError(_0xef2705,null));};exports[_0xd93e('0x49')]=function(_0x2e2eed,_0x3d197d,_0x1cc130){var _0x1fa006={};var _0x15f2c1={};var _0x56be38;var _0x4c6eaa;return db[_0xd93e('0x2b')]['findOne']({'where':{'id':_0x2e2eed[_0xd93e('0x4a')]['id']}})[_0xd93e('0x24')](handleEntityNotFound(_0x3d197d,null))[_0xd93e('0x24')](function(_0x2025c9){if(_0x2025c9){_0x56be38=_0x2025c9;_0x15f2c1[_0xd93e('0x37')]=_['keys'](db[_0xd93e('0x4b')]['rawAttributes']);_0x15f2c1[_0xd93e('0x31')]=_[_0xd93e('0x32')](_0x2e2eed[_0xd93e('0x31')]);_0x15f2c1['filters']=_[_0xd93e('0x34')](_0x15f2c1['model'],_0x15f2c1['query']);_0x1fa006[_0xd93e('0x36')]=_[_0xd93e('0x34')](_0x15f2c1[_0xd93e('0x37')],qs[_0xd93e('0x35')](_0x2e2eed[_0xd93e('0x31')]['fields']));_0x1fa006['attributes']=_0x1fa006['attributes']['length']?_0x1fa006[_0xd93e('0x36')]:_0x15f2c1[_0xd93e('0x37')];_0x1fa006['order']=qs[_0xd93e('0x3a')](_0x2e2eed['query'][_0xd93e('0x3a')]);_0x1fa006[_0xd93e('0x3b')]=qs[_0xd93e('0x33')](_[_0xd93e('0x3c')](_0x2e2eed[_0xd93e('0x31')],_0x15f2c1[_0xd93e('0x33')]));if(_0x2e2eed[_0xd93e('0x31')][_0xd93e('0x3d')]){_0x1fa006['where']=_[_0xd93e('0x3e')](_0x1fa006[_0xd93e('0x3b')],{'$or':_[_0xd93e('0x30')](_0x1fa006[_0xd93e('0x36')],function(_0x3278c9){var _0x4b3c5c={};_0x4b3c5c[_0x3278c9]={'$like':'%'+_0x2e2eed[_0xd93e('0x31')][_0xd93e('0x3d')]+'%'};return _0x4b3c5c;})});}_0x1fa006=_[_0xd93e('0x3e')]({},_0x1fa006,_0x2e2eed[_0xd93e('0x3f')]);return _0x56be38['getConfigurations'](_0x1fa006);}})['then'](function(_0x1efb3f){if(_0x1efb3f){_0x4c6eaa=_0x1efb3f[_0xd93e('0x44')];if(!_0x2e2eed[_0xd93e('0x31')][_0xd93e('0x38')](_0xd93e('0x39'))){_0x1fa006[_0xd93e('0x1b')]=qs[_0xd93e('0x1b')](_0x2e2eed['query'][_0xd93e('0x1b')]);_0x1fa006[_0xd93e('0x19')]=qs['offset'](_0x2e2eed[_0xd93e('0x31')]['offset']);}return _0x56be38[_0xd93e('0x49')](_0x1fa006);}})[_0xd93e('0x24')](function(_0x336bc6){if(_0x336bc6){return _0x336bc6?{'count':_0x4c6eaa,'rows':_0x336bc6}:null;}})[_0xd93e('0x24')](respondWithResult(_0x3d197d,null))['catch'](handleError(_0x3d197d,null));};exports[_0xd93e('0x4c')]=function(_0x2e228a,_0x4d701d,_0xc5d319){if(_0x2e228a['body']['id']){delete _0x2e228a[_0xd93e('0x48')]['id'];}return db[_0xd93e('0x2b')][_0xd93e('0x4d')]({'where':{'id':_0x2e228a['params']['id']}})['then'](handleEntityNotFound(_0x4d701d,null))[_0xd93e('0x24')](function(_0x5214e8){if(_0x5214e8){_0x2e228a[_0xd93e('0x48')][_0xd93e('0x4e')]=_0x5214e8['id'];_0x2e228a['body'][_0xd93e('0x4f')]=integrations[_0xd93e('0x50')](_0x2e228a[_0xd93e('0x48')][_0xd93e('0x51')],_0x2e228a['body'][_0xd93e('0x2e')]);_0x2e228a[_0xd93e('0x48')][_0xd93e('0x52')]=integrations['getDescriptions'](_0x2e228a[_0xd93e('0x48')]['channel'],_0x2e228a[_0xd93e('0x48')][_0xd93e('0x2e')]);return db[_0xd93e('0x4b')]['create'](_0x2e228a[_0xd93e('0x48')],{'include':[{'model':db[_0xd93e('0x53')],'as':_0xd93e('0x4f')},{'model':db[_0xd93e('0x53')],'as':_0xd93e('0x52')}]});}return null;})[_0xd93e('0x24')](respondWithResult(_0x4d701d,null))[_0xd93e('0x46')](handleError(_0x4d701d,null));};exports[_0xd93e('0x54')]=function(_0x24de38,_0x12f2ad,_0x27e5c4){var _0x5ecaad='';return db[_0xd93e('0x2b')][_0xd93e('0x4d')]({'where':{'id':_0x24de38[_0xd93e('0x4a')]['id']},'attributes':['id',_0xd93e('0x55'),_0xd93e('0x56')]})['then'](handleEntityNotFound(_0x12f2ad,null))[_0xd93e('0x24')](function(_0xdc1751){if(_0xdc1751){_0x5ecaad=_0xdc1751[_0xd93e('0x55')];var _0x20d88b=_0x5ecaad['slice'](-0x1);if(_0x20d88b==='/'){_0x5ecaad=_0x5ecaad[_0xd93e('0x57')](0x0,_0x5ecaad[_0xd93e('0x58')](_0x20d88b));}return rp({'method':_0xd93e('0x59'),'uri':util['format'](_0xd93e('0x5a'),_0x5ecaad,_0xd93e('0x5b')),'headers':{'Authorization':util[_0xd93e('0x5c')](_0xd93e('0x5d'),new Buffer(util[_0xd93e('0x5c')](_0xd93e('0x5e'),_0xdc1751[_0xd93e('0x56')]))[_0xd93e('0x5f')](_0xd93e('0x60')))},'json':!![]});}})['then'](function(_0xda7ecc){if(_0xda7ecc){var _0x5a6eea=[_0xd93e('0x61'),_0xd93e('0x62'),_0xd93e('0x63'),_0xd93e('0x64'),_0xd93e('0x18'),_0xd93e('0x65'),_0xd93e('0x66'),_0xd93e('0x67'),_0xd93e('0x68'),_0xd93e('0x66'),'company'];_[_0xd93e('0x69')](_0xda7ecc,function(_0x3b6512){return _0x5a6eea[_0xd93e('0x6a')](_0x3b6512['name'])||!_0x3b6512[_0xd93e('0x6b')]&&_0x3b6512[_0xd93e('0x2e')]!==_0xd93e('0x6c')&&_0x3b6512[_0xd93e('0x2e')]!==_0xd93e('0x6d');});return{'count':_0xda7ecc[_0xd93e('0x44')],'rows':_[_0xd93e('0x30')](_0xda7ecc,function(_0x5c1581){return{'id':_0x5c1581[_0xd93e('0x29')],'name':_0x5c1581[_0xd93e('0x6e')],'custom':!_0x5c1581[_0xd93e('0x6b')],'options':_0x5c1581[_0xd93e('0x6f')]?_['map'](_0x5c1581['choices'],function(_0x18add0){return{'name':_[_0xd93e('0x70')](_0x18add0),'value':_0x18add0};}):[]};})};}})[_0xd93e('0x24')](respondWithResult(_0x12f2ad,null))[_0xd93e('0x46')](function(_0x54ce9a){var _0x45c0ac=_0x24de38['query'][_0xd93e('0x71')]?0x1f4:_0x54ce9a[_0xd93e('0x72')]||0x1f4;logger[_0xd93e('0x27')]('getFields,\x20%s,\x20%s,\x20%s',_0xd93e('0x54'),_0x45c0ac,JSON[_0xd93e('0x73')](_0x54ce9a));delete _0x54ce9a['name'];if(_0x45c0ac===0x191){_0x45c0ac=0x190;}_0x12f2ad[_0xd93e('0x18')](_0x45c0ac)[_0xd93e('0x2a')](_0x24de38[_0xd93e('0x31')][_0xd93e('0x71')]?{'message':_0xd93e('0x74'),'statusCode':_0x54ce9a[_0xd93e('0x72')]}:_0x54ce9a);});}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js index 68fa9f7..a455c4a 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 _0xb174=['rimraf','../../components/integrations/configuration','FreshdeskAccount','int_freshdesk_accounts','util','../../config/logger','bluebird','request-promise','path'];(function(_0x35da42,_0x5c2610){var _0x370035=function(_0x546db5){while(--_0x546db5){_0x35da42['push'](_0x35da42['shift']());}};_0x370035(++_0x5c2610);}(_0xb174,0x109));var _0x4b17=function(_0x34420e,_0x5304a9){_0x34420e=_0x34420e-0x0;var _0x19d680=_0xb174[_0x34420e];return _0x19d680;};'use strict';var _=require('lodash');var util=require(_0x4b17('0x0'));var logger=require(_0x4b17('0x1'))('api');var moment=require('moment');var BPromise=require(_0x4b17('0x2'));var rp=require(_0x4b17('0x3'));var fs=require('fs');var path=require(_0x4b17('0x4'));var rimraf=require(_0x4b17('0x5'));var config=require('../../config/environment');var attributes=require('./intFreshdeskAccount.attributes');var integrations=require(_0x4b17('0x6'));module['exports']=function(_0x1482df,_0x3d5581){return _0x1482df['define'](_0x4b17('0x7'),attributes,{'tableName':_0x4b17('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd11b=['../../config/environment','./intFreshdeskAccount.attributes','../../components/integrations/configuration','exports','define','int_freshdesk_accounts','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x3ac563,_0x53621e){var _0x3e855f=function(_0xd0d3fb){while(--_0xd0d3fb){_0x3ac563['push'](_0x3ac563['shift']());}};_0x3e855f(++_0x53621e);}(_0xd11b,0x1cd));var _0xbd11=function(_0x350fe1,_0x53971c){_0x350fe1=_0x350fe1-0x0;var _0x8b53d6=_0xd11b[_0x350fe1];return _0x8b53d6;};'use strict';var _=require(_0xbd11('0x0'));var util=require(_0xbd11('0x1'));var logger=require(_0xbd11('0x2'))(_0xbd11('0x3'));var moment=require(_0xbd11('0x4'));var BPromise=require(_0xbd11('0x5'));var rp=require(_0xbd11('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xbd11('0x7'));var attributes=require(_0xbd11('0x8'));var integrations=require(_0xbd11('0x9'));module[_0xbd11('0xa')]=function(_0x2d5c4f,_0x7c93bb){return _0x2d5c4f[_0xbd11('0xb')]('FreshdeskAccount',attributes,{'tableName':_0xbd11('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 a795da1..c955c4a 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 _0xa7ac=['../../config/environment','client','request','then','info','FreshdeskAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','GetFreshdeskAccount','findAll','options','raw','where','attributes','limit','include','map','model','ShowFreshdeskAccount','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x377f25,_0x2565d2){var _0x4d70f7=function(_0x5c9023){while(--_0x5c9023){_0x377f25['push'](_0x377f25['shift']());}};_0x4d70f7(++_0x2565d2);}(_0xa7ac,0x14e));var _0xca7a=function(_0x47b6db,_0x73e3fc){_0x47b6db=_0x47b6db-0x0;var _0x1b3b93=_0xa7ac[_0x47b6db];return _0x1b3b93;};'use strict';var _=require('lodash');var util=require(_0xca7a('0x0'));var moment=require('moment');var BPromise=require(_0xca7a('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xca7a('0x2'));var db=require(_0xca7a('0x3'))['db'];var utils=require(_0xca7a('0x4'));var logger=require(_0xca7a('0x5'))(_0xca7a('0x6'));var config=require(_0xca7a('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xca7a('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4c19cf,_0x2115de,_0x5386c0){return new BPromise(function(_0x1ce1b8,_0xa55113){return client[_0xca7a('0x9')](_0x4c19cf,_0x5386c0)[_0xca7a('0xa')](function(_0x58aa59){logger[_0xca7a('0xb')](_0xca7a('0xc'),_0x2115de,_0xca7a('0xd'));logger[_0xca7a('0xe')]('FreshdeskAccount,\x20%s,\x20%s,\x20%s',_0x2115de,_0xca7a('0xd'),JSON[_0xca7a('0xf')](_0x58aa59));if(_0x58aa59['error']){if(_0x58aa59[_0xca7a('0x10')][_0xca7a('0x11')]===0x1f4){logger[_0xca7a('0x10')]('FreshdeskAccount,\x20%s,\x20%s',_0x2115de,_0x58aa59[_0xca7a('0x10')][_0xca7a('0x12')]);return _0xa55113(_0x58aa59['error']['message']);}logger[_0xca7a('0x10')](_0xca7a('0xc'),_0x2115de,_0x58aa59[_0xca7a('0x10')][_0xca7a('0x12')]);return _0x1ce1b8(_0x58aa59[_0xca7a('0x10')][_0xca7a('0x12')]);}else{logger[_0xca7a('0xb')]('FreshdeskAccount,\x20%s,\x20%s',_0x2115de,'request\x20sent');_0x1ce1b8(_0x58aa59['result'][_0xca7a('0x12')]);}})[_0xca7a('0x13')](function(_0x2a92f6){logger[_0xca7a('0x10')](_0xca7a('0xc'),_0x2115de,_0x2a92f6);_0xa55113(_0x2a92f6);});});}exports[_0xca7a('0x14')]=function(_0xbbec7a){var _0x30d8d9=this;return new Promise(function(_0xa53d73,_0x575d5a){return db['FreshdeskAccount'][_0xca7a('0x15')]({'raw':_0xbbec7a['options']?_0xbbec7a[_0xca7a('0x16')][_0xca7a('0x17')]===undefined?!![]:![]:!![],'where':_0xbbec7a[_0xca7a('0x16')]?_0xbbec7a[_0xca7a('0x16')][_0xca7a('0x18')]||null:null,'attributes':_0xbbec7a[_0xca7a('0x16')]?_0xbbec7a['options'][_0xca7a('0x19')]||null:null,'limit':_0xbbec7a[_0xca7a('0x16')]?_0xbbec7a[_0xca7a('0x16')][_0xca7a('0x1a')]||null:null,'include':_0xbbec7a[_0xca7a('0x16')]?_0xbbec7a[_0xca7a('0x16')][_0xca7a('0x1b')]?_[_0xca7a('0x1c')](_0xbbec7a[_0xca7a('0x16')][_0xca7a('0x1b')],function(_0x2f0f33){return{'model':db[_0x2f0f33[_0xca7a('0x1d')]],'as':_0x2f0f33['as'],'attributes':_0x2f0f33[_0xca7a('0x19')],'include':_0x2f0f33[_0xca7a('0x1b')]?_[_0xca7a('0x1c')](_0x2f0f33[_0xca7a('0x1b')],function(_0x1ce7ec){return{'model':db[_0x1ce7ec[_0xca7a('0x1d')]],'as':_0x1ce7ec['as'],'attributes':_0x1ce7ec[_0xca7a('0x19')],'include':_0x1ce7ec[_0xca7a('0x1b')]?_[_0xca7a('0x1c')](_0x1ce7ec[_0xca7a('0x1b')],function(_0x5118f8){return{'model':db[_0x5118f8['model']],'as':_0x5118f8['as'],'attributes':_0x5118f8['attributes']};}):[]};}):[]};}):[]:[]})[_0xca7a('0xa')](function(_0x38daad){logger[_0xca7a('0xb')](_0xca7a('0x14'),_0xbbec7a);logger[_0xca7a('0xe')](_0xca7a('0x14'),_0xbbec7a,JSON['stringify'](_0x38daad));_0xa53d73(_0x38daad);})[_0xca7a('0x13')](function(_0x351f3b){logger['error']('GetFreshdeskAccount',_0x351f3b['message'],_0xbbec7a);_0x575d5a(_0x30d8d9[_0xca7a('0x10')](0x1f4,_0x351f3b['message']));});});};exports['ShowFreshdeskAccount']=function(_0x3ac3ed){var _0x241315=this;return new Promise(function(_0x7fb3b0,_0x209863){return db['FreshdeskAccount']['find']({'raw':_0x3ac3ed[_0xca7a('0x16')]?_0x3ac3ed[_0xca7a('0x16')][_0xca7a('0x17')]===undefined?!![]:![]:!![],'where':_0x3ac3ed['options']?_0x3ac3ed[_0xca7a('0x16')][_0xca7a('0x18')]||null:null,'attributes':_0x3ac3ed['options']?_0x3ac3ed[_0xca7a('0x16')][_0xca7a('0x19')]||null:null,'include':_0x3ac3ed[_0xca7a('0x16')]?_0x3ac3ed[_0xca7a('0x16')][_0xca7a('0x1b')]?_[_0xca7a('0x1c')](_0x3ac3ed[_0xca7a('0x16')]['include'],function(_0x2cd7f8){return{'model':db[_0x2cd7f8[_0xca7a('0x1d')]],'as':_0x2cd7f8['as'],'attributes':_0x2cd7f8[_0xca7a('0x19')],'include':_0x2cd7f8['include']?_[_0xca7a('0x1c')](_0x2cd7f8[_0xca7a('0x1b')],function(_0x16ebb9){return{'model':db[_0x16ebb9[_0xca7a('0x1d')]],'as':_0x16ebb9['as'],'attributes':_0x16ebb9[_0xca7a('0x19')],'include':_0x16ebb9[_0xca7a('0x1b')]?_['map'](_0x16ebb9['include'],function(_0x472f41){return{'model':db[_0x472f41[_0xca7a('0x1d')]],'as':_0x472f41['as'],'attributes':_0x472f41[_0xca7a('0x19')]};}):[]};}):[]};}):[]:[]})[_0xca7a('0xa')](function(_0x5d032a){logger[_0xca7a('0xb')](_0xca7a('0x1e'),_0x3ac3ed);logger[_0xca7a('0xe')](_0xca7a('0x1e'),_0x3ac3ed,JSON[_0xca7a('0xf')](_0x5d032a));_0x7fb3b0(_0x5d032a);})[_0xca7a('0x13')](function(_0x488400){logger[_0xca7a('0x10')](_0xca7a('0x1e'),_0x488400[_0xca7a('0x12')],_0x3ac3ed);_0x209863(_0x241315[_0xca7a('0x10')](0x1f4,_0x488400[_0xca7a('0x12')]));});});}; \ No newline at end of file +var _0x133b=['code','message','result','FreshdeskAccount','options','raw','where','attributes','limit','map','include','model','GetFreshdeskAccount','catch','ShowFreshdeskAccount','find','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','then','info','FreshdeskAccount,\x20%s,\x20%s','request\x20sent','debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x1d8edc,_0x3dc8c8){var _0x10d35f=function(_0x24dabd){while(--_0x24dabd){_0x1d8edc['push'](_0x1d8edc['shift']());}};_0x10d35f(++_0x3dc8c8);}(_0x133b,0x7c));var _0xb133=function(_0x45f441,_0x35b586){_0x45f441=_0x45f441-0x0;var _0x5d24e0=_0x133b[_0x45f441];return _0x5d24e0;};'use strict';var _=require('lodash');var util=require(_0xb133('0x0'));var moment=require(_0xb133('0x1'));var BPromise=require(_0xb133('0x2'));var rs=require(_0xb133('0x3'));var fs=require('fs');var Redis=require(_0xb133('0x4'));var db=require(_0xb133('0x5'))['db'];var utils=require(_0xb133('0x6'));var logger=require('../../config/logger')(_0xb133('0x7'));var config=require(_0xb133('0x8'));var jayson=require(_0xb133('0x9'));var client=jayson['client'][_0xb133('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2a4a23,_0x293381,_0x3f0d97){return new BPromise(function(_0x1b811f,_0x385af1){return client[_0xb133('0xb')](_0x2a4a23,_0x3f0d97)[_0xb133('0xc')](function(_0x1aab25){logger[_0xb133('0xd')](_0xb133('0xe'),_0x293381,_0xb133('0xf'));logger[_0xb133('0x10')](_0xb133('0x11'),_0x293381,_0xb133('0xf'),JSON[_0xb133('0x12')](_0x1aab25));if(_0x1aab25['error']){if(_0x1aab25[_0xb133('0x13')][_0xb133('0x14')]===0x1f4){logger[_0xb133('0x13')](_0xb133('0xe'),_0x293381,_0x1aab25[_0xb133('0x13')][_0xb133('0x15')]);return _0x385af1(_0x1aab25[_0xb133('0x13')]['message']);}logger[_0xb133('0x13')](_0xb133('0xe'),_0x293381,_0x1aab25['error']['message']);return _0x1b811f(_0x1aab25['error'][_0xb133('0x15')]);}else{logger[_0xb133('0xd')]('FreshdeskAccount,\x20%s,\x20%s',_0x293381,_0xb133('0xf'));_0x1b811f(_0x1aab25[_0xb133('0x16')][_0xb133('0x15')]);}})['catch'](function(_0x5a46d1){logger[_0xb133('0x13')](_0xb133('0xe'),_0x293381,_0x5a46d1);_0x385af1(_0x5a46d1);});});}exports['GetFreshdeskAccount']=function(_0x239eeb){var _0x163168=this;return new Promise(function(_0x109eee,_0x18b76a){return db[_0xb133('0x17')]['findAll']({'raw':_0x239eeb[_0xb133('0x18')]?_0x239eeb[_0xb133('0x18')][_0xb133('0x19')]===undefined?!![]:![]:!![],'where':_0x239eeb['options']?_0x239eeb[_0xb133('0x18')][_0xb133('0x1a')]||null:null,'attributes':_0x239eeb['options']?_0x239eeb[_0xb133('0x18')][_0xb133('0x1b')]||null:null,'limit':_0x239eeb[_0xb133('0x18')]?_0x239eeb[_0xb133('0x18')][_0xb133('0x1c')]||null:null,'include':_0x239eeb['options']?_0x239eeb[_0xb133('0x18')]['include']?_[_0xb133('0x1d')](_0x239eeb['options'][_0xb133('0x1e')],function(_0x41342b){return{'model':db[_0x41342b[_0xb133('0x1f')]],'as':_0x41342b['as'],'attributes':_0x41342b[_0xb133('0x1b')],'include':_0x41342b[_0xb133('0x1e')]?_['map'](_0x41342b[_0xb133('0x1e')],function(_0x1ffed5){return{'model':db[_0x1ffed5['model']],'as':_0x1ffed5['as'],'attributes':_0x1ffed5['attributes'],'include':_0x1ffed5['include']?_[_0xb133('0x1d')](_0x1ffed5['include'],function(_0x1a7ff6){return{'model':db[_0x1a7ff6['model']],'as':_0x1a7ff6['as'],'attributes':_0x1a7ff6['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x1a3541){logger['info'](_0xb133('0x20'),_0x239eeb);logger['debug'](_0xb133('0x20'),_0x239eeb,JSON[_0xb133('0x12')](_0x1a3541));_0x109eee(_0x1a3541);})[_0xb133('0x21')](function(_0x58c758){logger[_0xb133('0x13')](_0xb133('0x20'),_0x58c758['message'],_0x239eeb);_0x18b76a(_0x163168['error'](0x1f4,_0x58c758[_0xb133('0x15')]));});});};exports[_0xb133('0x22')]=function(_0x1fbc6d){var _0x3d41b8=this;return new Promise(function(_0x2c0d45,_0x32a4c1){return db[_0xb133('0x17')][_0xb133('0x23')]({'raw':_0x1fbc6d[_0xb133('0x18')]?_0x1fbc6d[_0xb133('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x1fbc6d[_0xb133('0x18')]?_0x1fbc6d[_0xb133('0x18')][_0xb133('0x1a')]||null:null,'attributes':_0x1fbc6d[_0xb133('0x18')]?_0x1fbc6d[_0xb133('0x18')][_0xb133('0x1b')]||null:null,'include':_0x1fbc6d[_0xb133('0x18')]?_0x1fbc6d[_0xb133('0x18')][_0xb133('0x1e')]?_[_0xb133('0x1d')](_0x1fbc6d[_0xb133('0x18')][_0xb133('0x1e')],function(_0x27fa85){return{'model':db[_0x27fa85[_0xb133('0x1f')]],'as':_0x27fa85['as'],'attributes':_0x27fa85[_0xb133('0x1b')],'include':_0x27fa85[_0xb133('0x1e')]?_[_0xb133('0x1d')](_0x27fa85[_0xb133('0x1e')],function(_0x47f922){return{'model':db[_0x47f922[_0xb133('0x1f')]],'as':_0x47f922['as'],'attributes':_0x47f922[_0xb133('0x1b')],'include':_0x47f922[_0xb133('0x1e')]?_['map'](_0x47f922[_0xb133('0x1e')],function(_0x3f1ab9){return{'model':db[_0x3f1ab9[_0xb133('0x1f')]],'as':_0x3f1ab9['as'],'attributes':_0x3f1ab9[_0xb133('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xb133('0xc')](function(_0x942278){logger[_0xb133('0xd')](_0xb133('0x22'),_0x1fbc6d);logger[_0xb133('0x10')]('ShowFreshdeskAccount',_0x1fbc6d,JSON['stringify'](_0x942278));_0x2c0d45(_0x942278);})[_0xb133('0x21')](function(_0x56ac36){logger['error'](_0xb133('0x22'),_0x56ac36[_0xb133('0x15')],_0x1fbc6d);_0x32a4c1(_0x3d41b8[_0xb133('0x13')](0x1f4,_0x56ac36[_0xb133('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/index.js b/server/api/intFreshdeskConfiguration/index.js index 9059dbc..5583a69 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 _0xbfe4=['index','get','/:id','/:id/fields','/:id/descriptions','getDescriptions','/:id/tags','getTags','post','setTags','put','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskConfiguration.controller','isAuthenticated'];(function(_0x5448c6,_0x108fab){var _0x510306=function(_0x4cd04e){while(--_0x4cd04e){_0x5448c6['push'](_0x5448c6['shift']());}};_0x510306(++_0x108fab);}(_0xbfe4,0x195));var _0x4bfe=function(_0x3e30c1,_0x4f64b3){_0x3e30c1=_0x3e30c1-0x0;var _0xf27341=_0xbfe4[_0x3e30c1];return _0xf27341;};'use strict';var multer=require(_0x4bfe('0x0'));var util=require(_0x4bfe('0x1'));var path=require('path');var timeout=require(_0x4bfe('0x2'));var express=require(_0x4bfe('0x3'));var router=express[_0x4bfe('0x4')]();var fs_extra=require(_0x4bfe('0x5'));var auth=require(_0x4bfe('0x6'));var interaction=require(_0x4bfe('0x7'));var config=require(_0x4bfe('0x8'));var controller=require(_0x4bfe('0x9'));router['get']('/',auth[_0x4bfe('0xa')](),controller[_0x4bfe('0xb')]);router[_0x4bfe('0xc')](_0x4bfe('0xd'),auth['isAuthenticated'](),controller['show']);router['get'](_0x4bfe('0xe'),auth[_0x4bfe('0xa')](),controller['getFields']);router['get']('/:id/subjects',auth[_0x4bfe('0xa')](),controller['getSubjects']);router[_0x4bfe('0xc')](_0x4bfe('0xf'),auth['isAuthenticated'](),controller[_0x4bfe('0x10')]);router[_0x4bfe('0xc')](_0x4bfe('0x11'),auth[_0x4bfe('0xa')](),controller[_0x4bfe('0x12')]);router[_0x4bfe('0x13')]('/',auth[_0x4bfe('0xa')](),controller['create']);router[_0x4bfe('0x13')](_0x4bfe('0x11'),auth[_0x4bfe('0xa')](),controller[_0x4bfe('0x14')]);router[_0x4bfe('0x15')](_0x4bfe('0xd'),auth[_0x4bfe('0xa')](),controller[_0x4bfe('0x16')]);router[_0x4bfe('0x17')](_0x4bfe('0xd'),auth[_0x4bfe('0xa')](),controller[_0x4bfe('0x18')]);module[_0x4bfe('0x19')]=router; \ No newline at end of file +var _0x4927=['multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intFreshdeskConfiguration.controller','get','isAuthenticated','index','show','/:id/fields','getFields','/:id/tags','post','create','setTags','put','/:id','update','delete','destroy','exports'];(function(_0x40b6f9,_0x505c1c){var _0x124607=function(_0x4c298b){while(--_0x4c298b){_0x40b6f9['push'](_0x40b6f9['shift']());}};_0x124607(++_0x505c1c);}(_0x4927,0xc8));var _0x7492=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x4927[_0x397e5f];return _0x5302b8;};'use strict';var multer=require(_0x7492('0x0'));var util=require(_0x7492('0x1'));var path=require('path');var timeout=require(_0x7492('0x2'));var express=require(_0x7492('0x3'));var router=express[_0x7492('0x4')]();var fs_extra=require(_0x7492('0x5'));var auth=require(_0x7492('0x6'));var interaction=require(_0x7492('0x7'));var config=require('../../config/environment');var controller=require(_0x7492('0x8'));router[_0x7492('0x9')]('/',auth[_0x7492('0xa')](),controller[_0x7492('0xb')]);router['get']('/:id',auth[_0x7492('0xa')](),controller[_0x7492('0xc')]);router[_0x7492('0x9')](_0x7492('0xd'),auth[_0x7492('0xa')](),controller[_0x7492('0xe')]);router[_0x7492('0x9')]('/:id/subjects',auth['isAuthenticated'](),controller['getSubjects']);router[_0x7492('0x9')]('/:id/descriptions',auth[_0x7492('0xa')](),controller['getDescriptions']);router['get'](_0x7492('0xf'),auth['isAuthenticated'](),controller['getTags']);router[_0x7492('0x10')]('/',auth['isAuthenticated'](),controller[_0x7492('0x11')]);router['post'](_0x7492('0xf'),auth[_0x7492('0xa')](),controller[_0x7492('0x12')]);router[_0x7492('0x13')](_0x7492('0x14'),auth[_0x7492('0xa')](),controller[_0x7492('0x15')]);router[_0x7492('0x16')](_0x7492('0x14'),auth[_0x7492('0xa')](),controller[_0x7492('0x17')]);module[_0x7492('0x18')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js index 7ffd40b..d01ee27 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 _0xc26f=['STRING','sequelize'];(function(_0x3207a4,_0x1b9024){var _0x5c8dff=function(_0x4611b9){while(--_0x4611b9){_0x3207a4['push'](_0x3207a4['shift']());}};_0x5c8dff(++_0x1b9024);}(_0xc26f,0x1d9));var _0xfc26=function(_0x178e48,_0x3c9509){_0x178e48=_0x178e48-0x0;var _0x440d7e=_0xc26f[_0x178e48];return _0x440d7e;};'use strict';var Sequelize=require(_0xfc26('0x0'));module['exports']={'name':{'type':Sequelize[_0xfc26('0x1')]},'description':{'type':Sequelize[_0xfc26('0x1')]}}; \ No newline at end of file +var _0x5c2f=['STRING','sequelize','exports'];(function(_0x27ecd0,_0x2cae63){var _0xd17f0f=function(_0x3e02e5){while(--_0x3e02e5){_0x27ecd0['push'](_0x27ecd0['shift']());}};_0xd17f0f(++_0x2cae63);}(_0x5c2f,0x19f));var _0xf5c2=function(_0xe09d0,_0x1e55d0){_0xe09d0=_0xe09d0-0x0;var _0x44ad05=_0x5c2f[_0xe09d0];return _0x44ad05;};'use strict';var Sequelize=require(_0xf5c2('0x0'));module[_0xf5c2('0x1')]={'name':{'type':Sequelize[_0xf5c2('0x2')]},'description':{'type':Sequelize[_0xf5c2('0x2')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js index 0b1d1f0..e54168c 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 _0x509e=['limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','name','send','index','map','FreshdeskConfiguration','fieldName','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','type','VIRTUAL','filter','merge','options','includeAll','include','findAll','catch','show','params','rawAttributes','find','create','body','getFields','findOne','FreshdeskField','getSubjects','getDescriptions','Tag','getTags','setTags','ids','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','status','end','json','offset','undefined'];(function(_0x40bd70,_0x2108ff){var _0x5cfab8=function(_0x3c17dc){while(--_0x3c17dc){_0x40bd70['push'](_0x40bd70['shift']());}};_0x5cfab8(++_0x2108ff);}(_0x509e,0x8f));var _0xe509=function(_0x844020,_0x524d8a){_0x844020=_0x844020-0x0;var _0x4fd26e=_0x509e[_0x844020];return _0x4fd26e;};'use strict';var emlformat=require(_0xe509('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xe509('0x1'));var jsonpatch=require(_0xe509('0x2'));var rp=require(_0xe509('0x3'));var moment=require(_0xe509('0x4'));var BPromise=require(_0xe509('0x5'));var Mustache=require(_0xe509('0x6'));var util=require('util');var path=require(_0xe509('0x7'));var sox=require('sox');var csv=require(_0xe509('0x8'));var ejs=require(_0xe509('0x9'));var fs=require('fs');var fs_extra=require(_0xe509('0xa'));var _=require(_0xe509('0xb'));var squel=require(_0xe509('0xc'));var crypto=require(_0xe509('0xd'));var jsforce=require(_0xe509('0xe'));var deskjs=require(_0xe509('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xe509('0x10'));var Redis=require(_0xe509('0x11'));var authService=require(_0xe509('0x12'));var qs=require(_0xe509('0x13'));var as=require(_0xe509('0x14'));var hardwareService=require(_0xe509('0x15'));var logger=require(_0xe509('0x16'))(_0xe509('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xe509('0x18'));var db=require(_0xe509('0x19'))['db'];function respondWithStatusCode(_0x4ab21a,_0x16809b){_0x16809b=_0x16809b||0xcc;return function(_0x1cf5c7){if(_0x1cf5c7){return _0x4ab21a['sendStatus'](_0x16809b);}return _0x4ab21a[_0xe509('0x1a')](_0x16809b)[_0xe509('0x1b')]();};}function respondWithResult(_0x5b9a04,_0x7cd348){_0x7cd348=_0x7cd348||0xc8;return function(_0xe61138){if(_0xe61138){return _0x5b9a04[_0xe509('0x1a')](_0x7cd348)[_0xe509('0x1c')](_0xe61138);}};}function respondWithFilteredResult(_0x2740d8,_0x117eab){return function(_0x2e92cb){if(_0x2e92cb){var _0x4faa13=typeof _0x117eab[_0xe509('0x1d')]===_0xe509('0x1e')&&typeof _0x117eab[_0xe509('0x1f')]===_0xe509('0x1e');var _0x5767f9=_0x2e92cb[_0xe509('0x20')];var _0x87c52=_0x4faa13?0x0:_0x117eab['offset'];var _0x5c0ccd=_0x4faa13?_0x2e92cb[_0xe509('0x20')]:_0x117eab[_0xe509('0x1d')]+_0x117eab[_0xe509('0x1f')];var _0x40d5c3;if(_0x5c0ccd>=_0x5767f9){_0x5c0ccd=_0x5767f9;_0x40d5c3=0xc8;}else{_0x40d5c3=0xce;}_0x2740d8[_0xe509('0x1a')](_0x40d5c3);return _0x2740d8[_0xe509('0x21')](_0xe509('0x22'),_0x87c52+'-'+_0x5c0ccd+'/'+_0x5767f9)[_0xe509('0x1c')](_0x2e92cb);}return null;};}function patchUpdates(_0x6aed70){return function(_0x58236e){try{jsonpatch[_0xe509('0x23')](_0x58236e,_0x6aed70,!![]);}catch(_0x29d0a7){return BPromise[_0xe509('0x24')](_0x29d0a7);}return _0x58236e[_0xe509('0x25')]();};}function saveUpdates(_0x5e0586,_0xbe2502){return function(_0x295575){if(_0x295575){return _0x295575[_0xe509('0x26')](_0x5e0586)[_0xe509('0x27')](function(_0x183ff0){return _0x183ff0;});}return null;};}function removeEntity(_0x15664b,_0x1a3a74){return function(_0x40ce03){if(_0x40ce03){return _0x40ce03[_0xe509('0x28')]()['then'](function(){_0x15664b['status'](0xcc)[_0xe509('0x1b')]();});}};}function handleEntityNotFound(_0x17f7f3,_0x5f0841){return function(_0x1d71a3){if(!_0x1d71a3){_0x17f7f3['sendStatus'](0x194);}return _0x1d71a3;};}function handleError(_0x55911d,_0x4d5552){_0x4d5552=_0x4d5552||0x1f4;return function(_0x3ae3a5){logger[_0xe509('0x29')](_0x3ae3a5['stack']);if(_0x3ae3a5[_0xe509('0x2a')]){delete _0x3ae3a5['name'];}_0x55911d['status'](_0x4d5552)[_0xe509('0x2b')](_0x3ae3a5);};}exports[_0xe509('0x2c')]=function(_0x59357b,_0x6fbf8f){var _0x4c6dff={},_0x1cf20f={},_0x5d5eef={'count':0x0,'rows':[]};var _0xadac0c=_[_0xe509('0x2d')](db[_0xe509('0x2e')]['rawAttributes'],function(_0xb51357){return{'name':_0xb51357[_0xe509('0x2f')],'type':_0xb51357['type'][_0xe509('0x30')]};});_0x1cf20f[_0xe509('0x31')]=_[_0xe509('0x2d')](_0xadac0c,'name');_0x1cf20f[_0xe509('0x32')]=_[_0xe509('0x33')](_0x59357b[_0xe509('0x32')]);_0x1cf20f['filters']=_[_0xe509('0x34')](_0x1cf20f[_0xe509('0x31')],_0x1cf20f[_0xe509('0x32')]);_0x4c6dff['attributes']=_[_0xe509('0x34')](_0x1cf20f[_0xe509('0x31')],qs[_0xe509('0x35')](_0x59357b[_0xe509('0x32')][_0xe509('0x35')]));_0x4c6dff[_0xe509('0x36')]=_0x4c6dff[_0xe509('0x36')][_0xe509('0x37')]?_0x4c6dff[_0xe509('0x36')]:_0x1cf20f[_0xe509('0x31')];if(!_0x59357b[_0xe509('0x32')][_0xe509('0x38')](_0xe509('0x39'))){_0x4c6dff[_0xe509('0x1f')]=qs[_0xe509('0x1f')](_0x59357b['query'][_0xe509('0x1f')]);_0x4c6dff[_0xe509('0x1d')]=qs['offset'](_0x59357b['query'][_0xe509('0x1d')]);}_0x4c6dff[_0xe509('0x3a')]=qs['sort'](_0x59357b[_0xe509('0x32')][_0xe509('0x3b')]);_0x4c6dff[_0xe509('0x3c')]=qs[_0xe509('0x3d')](_[_0xe509('0x3e')](_0x59357b[_0xe509('0x32')],_0x1cf20f[_0xe509('0x3d')]),_0xadac0c);if(_0x59357b[_0xe509('0x32')]['filter']){_0x4c6dff[_0xe509('0x3c')]=_['merge'](_0x4c6dff['where'],{'$or':_[_0xe509('0x2d')](_0xadac0c,function(_0x36f138){if(_0x36f138[_0xe509('0x3f')]!==_0xe509('0x40')){var _0x19a270={};_0x19a270[_0x36f138[_0xe509('0x2a')]]={'$like':'%'+_0x59357b['query'][_0xe509('0x41')]+'%'};return _0x19a270;}})});}_0x4c6dff=_[_0xe509('0x42')]({},_0x4c6dff,_0x59357b[_0xe509('0x43')]);var _0x13f079={'where':_0x4c6dff[_0xe509('0x3c')]};return db[_0xe509('0x2e')][_0xe509('0x20')](_0x13f079)[_0xe509('0x27')](function(_0x597f57){_0x5d5eef[_0xe509('0x20')]=_0x597f57;if(_0x59357b[_0xe509('0x32')][_0xe509('0x44')]){_0x4c6dff[_0xe509('0x45')]=[{'all':!![]}];}return db[_0xe509('0x2e')][_0xe509('0x46')](_0x4c6dff);})[_0xe509('0x27')](function(_0x1db247){_0x5d5eef['rows']=_0x1db247;return _0x5d5eef;})[_0xe509('0x27')](respondWithFilteredResult(_0x6fbf8f,_0x4c6dff))[_0xe509('0x47')](handleError(_0x6fbf8f,null));};exports[_0xe509('0x48')]=function(_0x63e3df,_0x4f9680){var _0x18c2cc={'raw':![],'where':{'id':_0x63e3df[_0xe509('0x49')]['id']}},_0x19fdf6={};_0x19fdf6[_0xe509('0x31')]=_[_0xe509('0x33')](db[_0xe509('0x2e')][_0xe509('0x4a')]);_0x19fdf6[_0xe509('0x32')]=_[_0xe509('0x33')](_0x63e3df[_0xe509('0x32')]);_0x19fdf6[_0xe509('0x3d')]=_[_0xe509('0x34')](_0x19fdf6[_0xe509('0x31')],_0x19fdf6[_0xe509('0x32')]);_0x18c2cc['attributes']=_[_0xe509('0x34')](_0x19fdf6[_0xe509('0x31')],qs[_0xe509('0x35')](_0x63e3df['query'][_0xe509('0x35')]));_0x18c2cc[_0xe509('0x36')]=_0x18c2cc[_0xe509('0x36')][_0xe509('0x37')]?_0x18c2cc[_0xe509('0x36')]:_0x19fdf6[_0xe509('0x31')];if(_0x63e3df[_0xe509('0x32')][_0xe509('0x44')]){_0x18c2cc[_0xe509('0x45')]=[{'all':!![]}];}_0x18c2cc=_[_0xe509('0x42')]({},_0x18c2cc,_0x63e3df['options']);return db[_0xe509('0x2e')][_0xe509('0x4b')](_0x18c2cc)[_0xe509('0x27')](handleEntityNotFound(_0x4f9680,null))[_0xe509('0x27')](respondWithResult(_0x4f9680,null))['catch'](handleError(_0x4f9680,null));};exports[_0xe509('0x4c')]=function(_0x491c85,_0x1f4840){return db[_0xe509('0x2e')][_0xe509('0x4c')](_0x491c85['body'],{})['then'](respondWithResult(_0x1f4840,0xc9))[_0xe509('0x47')](handleError(_0x1f4840,null));};exports[_0xe509('0x26')]=function(_0x115778,_0x33de6e){if(_0x115778[_0xe509('0x4d')]['id']){delete _0x115778['body']['id'];}return db[_0xe509('0x2e')][_0xe509('0x4b')]({'where':{'id':_0x115778[_0xe509('0x49')]['id']}})[_0xe509('0x27')](handleEntityNotFound(_0x33de6e,null))['then'](saveUpdates(_0x115778[_0xe509('0x4d')],null))[_0xe509('0x27')](respondWithResult(_0x33de6e,null))[_0xe509('0x47')](handleError(_0x33de6e,null));};exports[_0xe509('0x28')]=function(_0x10ef1d,_0x56fd29){return db[_0xe509('0x2e')][_0xe509('0x4b')]({'where':{'id':_0x10ef1d[_0xe509('0x49')]['id']}})[_0xe509('0x27')](handleEntityNotFound(_0x56fd29,null))['then'](removeEntity(_0x56fd29,null))[_0xe509('0x47')](handleError(_0x56fd29,null));};exports[_0xe509('0x4e')]=function(_0x1f9042,_0xf29a49,_0x4f2436){var _0x51479c={};var _0x4f54c5={};var _0x4dbe3a;var _0x152d89;return db['FreshdeskConfiguration'][_0xe509('0x4f')]({'where':{'id':_0x1f9042[_0xe509('0x49')]['id']}})[_0xe509('0x27')](handleEntityNotFound(_0xf29a49,null))[_0xe509('0x27')](function(_0x350ee5){if(_0x350ee5){_0x4dbe3a=_0x350ee5;_0x4f54c5[_0xe509('0x31')]=_[_0xe509('0x33')](db[_0xe509('0x50')][_0xe509('0x4a')]);_0x4f54c5['query']=_['keys'](_0x1f9042['query']);_0x4f54c5['filters']=_[_0xe509('0x34')](_0x4f54c5[_0xe509('0x31')],_0x4f54c5[_0xe509('0x32')]);_0x51479c[_0xe509('0x36')]=_[_0xe509('0x34')](_0x4f54c5[_0xe509('0x31')],qs[_0xe509('0x35')](_0x1f9042[_0xe509('0x32')][_0xe509('0x35')]));_0x51479c[_0xe509('0x36')]=_0x51479c[_0xe509('0x36')][_0xe509('0x37')]?_0x51479c[_0xe509('0x36')]:_0x4f54c5[_0xe509('0x31')];_0x51479c[_0xe509('0x3a')]=qs['sort'](_0x1f9042[_0xe509('0x32')][_0xe509('0x3b')]);_0x51479c[_0xe509('0x3c')]=qs[_0xe509('0x3d')](_[_0xe509('0x3e')](_0x1f9042[_0xe509('0x32')],_0x4f54c5[_0xe509('0x3d')]));if(_0x1f9042[_0xe509('0x32')][_0xe509('0x41')]){_0x51479c['where']=_['merge'](_0x51479c[_0xe509('0x3c')],{'$or':_['map'](_0x51479c[_0xe509('0x36')],function(_0x2bf82d){var _0x236c5f={};_0x236c5f[_0x2bf82d]={'$like':'%'+_0x1f9042[_0xe509('0x32')][_0xe509('0x41')]+'%'};return _0x236c5f;})});}_0x51479c=_['merge']({},_0x51479c,_0x1f9042[_0xe509('0x43')]);return _0x4dbe3a[_0xe509('0x4e')](_0x51479c);}})[_0xe509('0x27')](function(_0x32621e){if(_0x32621e){_0x152d89=_0x32621e[_0xe509('0x37')];if(!_0x1f9042[_0xe509('0x32')][_0xe509('0x38')](_0xe509('0x39'))){_0x51479c[_0xe509('0x1f')]=qs[_0xe509('0x1f')](_0x1f9042['query'][_0xe509('0x1f')]);_0x51479c[_0xe509('0x1d')]=qs[_0xe509('0x1d')](_0x1f9042[_0xe509('0x32')][_0xe509('0x1d')]);}return _0x4dbe3a['getFields'](_0x51479c);}})[_0xe509('0x27')](function(_0x257796){if(_0x257796){return _0x257796?{'count':_0x152d89,'rows':_0x257796}:null;}})[_0xe509('0x27')](respondWithResult(_0xf29a49,null))[_0xe509('0x47')](handleError(_0xf29a49,null));};exports[_0xe509('0x51')]=function(_0x5ea89b,_0x5626d6,_0x224de7){var _0x790ba3={};var _0x4696a5={};var _0x398342;var _0x1f1d30;return db[_0xe509('0x2e')]['findOne']({'where':{'id':_0x5ea89b[_0xe509('0x49')]['id']}})[_0xe509('0x27')](handleEntityNotFound(_0x5626d6,null))[_0xe509('0x27')](function(_0xee4def){if(_0xee4def){_0x398342=_0xee4def;_0x4696a5[_0xe509('0x31')]=_[_0xe509('0x33')](db['FreshdeskField'][_0xe509('0x4a')]);_0x4696a5[_0xe509('0x32')]=_[_0xe509('0x33')](_0x5ea89b[_0xe509('0x32')]);_0x4696a5['filters']=_['intersection'](_0x4696a5[_0xe509('0x31')],_0x4696a5[_0xe509('0x32')]);_0x790ba3[_0xe509('0x36')]=_['intersection'](_0x4696a5['model'],qs[_0xe509('0x35')](_0x5ea89b[_0xe509('0x32')][_0xe509('0x35')]));_0x790ba3[_0xe509('0x36')]=_0x790ba3[_0xe509('0x36')][_0xe509('0x37')]?_0x790ba3[_0xe509('0x36')]:_0x4696a5[_0xe509('0x31')];_0x790ba3['order']=qs[_0xe509('0x3b')](_0x5ea89b[_0xe509('0x32')]['sort']);_0x790ba3[_0xe509('0x3c')]=qs['filters'](_[_0xe509('0x3e')](_0x5ea89b[_0xe509('0x32')],_0x4696a5[_0xe509('0x3d')]));if(_0x5ea89b[_0xe509('0x32')][_0xe509('0x41')]){_0x790ba3[_0xe509('0x3c')]=_[_0xe509('0x42')](_0x790ba3['where'],{'$or':_[_0xe509('0x2d')](_0x790ba3[_0xe509('0x36')],function(_0x263f3f){var _0x38b536={};_0x38b536[_0x263f3f]={'$like':'%'+_0x5ea89b['query']['filter']+'%'};return _0x38b536;})});}_0x790ba3=_[_0xe509('0x42')]({},_0x790ba3,_0x5ea89b[_0xe509('0x43')]);return _0x398342[_0xe509('0x51')](_0x790ba3);}})[_0xe509('0x27')](function(_0x46f125){if(_0x46f125){_0x1f1d30=_0x46f125[_0xe509('0x37')];if(!_0x5ea89b[_0xe509('0x32')][_0xe509('0x38')]('nolimit')){_0x790ba3[_0xe509('0x1f')]=qs[_0xe509('0x1f')](_0x5ea89b[_0xe509('0x32')]['limit']);_0x790ba3['offset']=qs[_0xe509('0x1d')](_0x5ea89b[_0xe509('0x32')][_0xe509('0x1d')]);}return _0x398342[_0xe509('0x51')](_0x790ba3);}})[_0xe509('0x27')](function(_0x4df2f6){if(_0x4df2f6){return _0x4df2f6?{'count':_0x1f1d30,'rows':_0x4df2f6}:null;}})['then'](respondWithResult(_0x5626d6,null))[_0xe509('0x47')](handleError(_0x5626d6,null));};exports[_0xe509('0x52')]=function(_0x2b352d,_0x4f94b6,_0xc016dc){var _0x34b8b8={};var _0x5e787c={};var _0x5141bc;var _0xdccc3b;return db[_0xe509('0x2e')]['findOne']({'where':{'id':_0x2b352d['params']['id']}})[_0xe509('0x27')](handleEntityNotFound(_0x4f94b6,null))[_0xe509('0x27')](function(_0x132cd8){if(_0x132cd8){_0x5141bc=_0x132cd8;_0x5e787c[_0xe509('0x31')]=_[_0xe509('0x33')](db[_0xe509('0x50')]['rawAttributes']);_0x5e787c[_0xe509('0x32')]=_[_0xe509('0x33')](_0x2b352d[_0xe509('0x32')]);_0x5e787c['filters']=_[_0xe509('0x34')](_0x5e787c[_0xe509('0x31')],_0x5e787c[_0xe509('0x32')]);_0x34b8b8[_0xe509('0x36')]=_[_0xe509('0x34')](_0x5e787c[_0xe509('0x31')],qs[_0xe509('0x35')](_0x2b352d['query'][_0xe509('0x35')]));_0x34b8b8[_0xe509('0x36')]=_0x34b8b8[_0xe509('0x36')][_0xe509('0x37')]?_0x34b8b8[_0xe509('0x36')]:_0x5e787c['model'];_0x34b8b8[_0xe509('0x3a')]=qs[_0xe509('0x3b')](_0x2b352d[_0xe509('0x32')][_0xe509('0x3b')]);_0x34b8b8[_0xe509('0x3c')]=qs[_0xe509('0x3d')](_[_0xe509('0x3e')](_0x2b352d[_0xe509('0x32')],_0x5e787c[_0xe509('0x3d')]));if(_0x2b352d[_0xe509('0x32')][_0xe509('0x41')]){_0x34b8b8[_0xe509('0x3c')]=_[_0xe509('0x42')](_0x34b8b8[_0xe509('0x3c')],{'$or':_[_0xe509('0x2d')](_0x34b8b8['attributes'],function(_0x50e4e7){var _0x6d3d77={};_0x6d3d77[_0x50e4e7]={'$like':'%'+_0x2b352d['query'][_0xe509('0x41')]+'%'};return _0x6d3d77;})});}_0x34b8b8=_[_0xe509('0x42')]({},_0x34b8b8,_0x2b352d[_0xe509('0x43')]);return _0x5141bc[_0xe509('0x52')](_0x34b8b8);}})[_0xe509('0x27')](function(_0x3a00f8){if(_0x3a00f8){_0xdccc3b=_0x3a00f8['length'];if(!_0x2b352d[_0xe509('0x32')][_0xe509('0x38')](_0xe509('0x39'))){_0x34b8b8['limit']=qs['limit'](_0x2b352d[_0xe509('0x32')][_0xe509('0x1f')]);_0x34b8b8['offset']=qs['offset'](_0x2b352d[_0xe509('0x32')][_0xe509('0x1d')]);}return _0x5141bc[_0xe509('0x52')](_0x34b8b8);}})[_0xe509('0x27')](function(_0x45b8bb){if(_0x45b8bb){return _0x45b8bb?{'count':_0xdccc3b,'rows':_0x45b8bb}:null;}})[_0xe509('0x27')](respondWithResult(_0x4f94b6,null))[_0xe509('0x47')](handleError(_0x4f94b6,null));};exports['getTags']=function(_0x59d1bb,_0x1038a2,_0x3be644){var _0x189407={};var _0x3ef48c={};var _0x140168;var _0x84a6e1;return db[_0xe509('0x2e')]['findOne']({'where':{'id':_0x59d1bb[_0xe509('0x49')]['id']}})['then'](handleEntityNotFound(_0x1038a2,null))[_0xe509('0x27')](function(_0x26d9b0){if(_0x26d9b0){_0x140168=_0x26d9b0;_0x3ef48c['model']=_[_0xe509('0x33')](db[_0xe509('0x53')]['rawAttributes']);_0x3ef48c[_0xe509('0x32')]=_['keys'](_0x59d1bb['query']);_0x3ef48c['filters']=_['intersection'](_0x3ef48c[_0xe509('0x31')],_0x3ef48c[_0xe509('0x32')]);_0x189407[_0xe509('0x36')]=_['intersection'](_0x3ef48c[_0xe509('0x31')],qs['fields'](_0x59d1bb[_0xe509('0x32')][_0xe509('0x35')]));_0x189407[_0xe509('0x36')]=_0x189407[_0xe509('0x36')][_0xe509('0x37')]?_0x189407[_0xe509('0x36')]:_0x3ef48c['model'];_0x189407[_0xe509('0x3a')]=qs['sort'](_0x59d1bb[_0xe509('0x32')][_0xe509('0x3b')]);_0x189407['where']=qs[_0xe509('0x3d')](_['pick'](_0x59d1bb['query'],_0x3ef48c['filters']));if(_0x59d1bb[_0xe509('0x32')]['filter']){_0x189407['where']=_['merge'](_0x189407['where'],{'$or':_[_0xe509('0x2d')](_0x189407['attributes'],function(_0x30d56b){var _0x3f8a61={};_0x3f8a61[_0x30d56b]={'$like':'%'+_0x59d1bb[_0xe509('0x32')][_0xe509('0x41')]+'%'};return _0x3f8a61;})});}_0x189407=_[_0xe509('0x42')]({},_0x189407,_0x59d1bb['options']);return _0x140168[_0xe509('0x54')](_0x189407);}})[_0xe509('0x27')](function(_0x1439d0){if(_0x1439d0){_0x84a6e1=_0x1439d0['length'];if(!_0x59d1bb[_0xe509('0x32')][_0xe509('0x38')](_0xe509('0x39'))){_0x189407[_0xe509('0x1f')]=qs['limit'](_0x59d1bb[_0xe509('0x32')][_0xe509('0x1f')]);_0x189407[_0xe509('0x1d')]=qs[_0xe509('0x1d')](_0x59d1bb[_0xe509('0x32')][_0xe509('0x1d')]);}return _0x140168[_0xe509('0x54')](_0x189407);}})[_0xe509('0x27')](function(_0xaa060){if(_0xaa060){return _0xaa060?{'count':_0x84a6e1,'rows':_0xaa060}:null;}})[_0xe509('0x27')](respondWithResult(_0x1038a2,null))[_0xe509('0x47')](handleError(_0x1038a2,null));};exports[_0xe509('0x55')]=function(_0x4eaa52,_0x43ec4e,_0x447a33){if(_0x4eaa52[_0xe509('0x4d')]['id']){delete _0x4eaa52[_0xe509('0x4d')]['id'];}return db[_0xe509('0x2e')][_0xe509('0x4f')]({'where':{'id':_0x4eaa52[_0xe509('0x49')]['id']}})[_0xe509('0x27')](handleEntityNotFound(_0x43ec4e,null))[_0xe509('0x27')](function(_0x4c092b){if(_0x4c092b){return _0x4c092b[_0xe509('0x55')](_0x4eaa52[_0xe509('0x4d')][_0xe509('0x56')]||[]);}return null;})[_0xe509('0x27')](respondWithResult(_0x43ec4e,null))[_0xe509('0x47')](handleError(_0x43ec4e,null));}; \ No newline at end of file +var _0xddba=['ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','count','limit','set','Content-Range','json','apply','reject','save','update','then','destroy','error','stack','name','send','index','FreshdeskConfiguration','rawAttributes','type','key','map','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','rows','catch','show','params','length','include','find','body','getFields','findOne','FreshdeskField','nolimit','getSubjects','getDescriptions','Tag','getTags','setTags','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv'];(function(_0x5acc60,_0x43255e){var _0x3828ff=function(_0x21af7d){while(--_0x21af7d){_0x5acc60['push'](_0x5acc60['shift']());}};_0x3828ff(++_0x43255e);}(_0xddba,0xfa));var _0xaddb=function(_0x28d37a,_0x3884c7){_0x28d37a=_0x28d37a-0x0;var _0x46e5fe=_0xddba[_0x28d37a];return _0x46e5fe;};'use strict';var emlformat=require(_0xaddb('0x0'));var rimraf=require(_0xaddb('0x1'));var zipdir=require(_0xaddb('0x2'));var jsonpatch=require(_0xaddb('0x3'));var rp=require(_0xaddb('0x4'));var moment=require('moment');var BPromise=require(_0xaddb('0x5'));var Mustache=require(_0xaddb('0x6'));var util=require(_0xaddb('0x7'));var path=require(_0xaddb('0x8'));var sox=require(_0xaddb('0x9'));var csv=require(_0xaddb('0xa'));var ejs=require(_0xaddb('0xb'));var fs=require('fs');var fs_extra=require(_0xaddb('0xc'));var _=require(_0xaddb('0xd'));var squel=require(_0xaddb('0xe'));var crypto=require(_0xaddb('0xf'));var jsforce=require(_0xaddb('0x10'));var deskjs=require('desk.js');var toCsv=require(_0xaddb('0xa'));var querystring=require(_0xaddb('0x11'));var Papa=require(_0xaddb('0x12'));var Redis=require(_0xaddb('0x13'));var authService=require(_0xaddb('0x14'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xaddb('0x15'))(_0xaddb('0x16'));var utils=require(_0xaddb('0x17'));var config=require(_0xaddb('0x18'));var licenseUtil=require(_0xaddb('0x19'));var db=require(_0xaddb('0x1a'))['db'];function respondWithStatusCode(_0x45b18f,_0x253392){_0x253392=_0x253392||0xcc;return function(_0x3b849d){if(_0x3b849d){return _0x45b18f[_0xaddb('0x1b')](_0x253392);}return _0x45b18f[_0xaddb('0x1c')](_0x253392)[_0xaddb('0x1d')]();};}function respondWithResult(_0x466c63,_0x515084){_0x515084=_0x515084||0xc8;return function(_0x2b38c4){if(_0x2b38c4){return _0x466c63[_0xaddb('0x1c')](_0x515084)['json'](_0x2b38c4);}};}function respondWithFilteredResult(_0x14b3ef,_0x511d9e){return function(_0x4da53d){if(_0x4da53d){var _0x3e3254=typeof _0x511d9e[_0xaddb('0x1e')]==='undefined'&&typeof _0x511d9e['limit']===_0xaddb('0x1f');var _0x2b18a0=_0x4da53d[_0xaddb('0x20')];var _0x26a647=_0x3e3254?0x0:_0x511d9e[_0xaddb('0x1e')];var _0x54484c=_0x3e3254?_0x4da53d[_0xaddb('0x20')]:_0x511d9e[_0xaddb('0x1e')]+_0x511d9e[_0xaddb('0x21')];var _0x4ac325;if(_0x54484c>=_0x2b18a0){_0x54484c=_0x2b18a0;_0x4ac325=0xc8;}else{_0x4ac325=0xce;}_0x14b3ef['status'](_0x4ac325);return _0x14b3ef[_0xaddb('0x22')](_0xaddb('0x23'),_0x26a647+'-'+_0x54484c+'/'+_0x2b18a0)[_0xaddb('0x24')](_0x4da53d);}return null;};}function patchUpdates(_0x4b22cd){return function(_0x4e3e6a){try{jsonpatch[_0xaddb('0x25')](_0x4e3e6a,_0x4b22cd,!![]);}catch(_0x4cce43){return BPromise[_0xaddb('0x26')](_0x4cce43);}return _0x4e3e6a[_0xaddb('0x27')]();};}function saveUpdates(_0x6b874e,_0x32d5d8){return function(_0x13182a){if(_0x13182a){return _0x13182a[_0xaddb('0x28')](_0x6b874e)[_0xaddb('0x29')](function(_0x56610b){return _0x56610b;});}return null;};}function removeEntity(_0x14bbd9,_0x116940){return function(_0x4ee6fc){if(_0x4ee6fc){return _0x4ee6fc[_0xaddb('0x2a')]()[_0xaddb('0x29')](function(){_0x14bbd9[_0xaddb('0x1c')](0xcc)[_0xaddb('0x1d')]();});}};}function handleEntityNotFound(_0xf145a2,_0x25c968){return function(_0x43cd57){if(!_0x43cd57){_0xf145a2[_0xaddb('0x1b')](0x194);}return _0x43cd57;};}function handleError(_0x1c2f89,_0x24dd96){_0x24dd96=_0x24dd96||0x1f4;return function(_0x2a591a){logger[_0xaddb('0x2b')](_0x2a591a[_0xaddb('0x2c')]);if(_0x2a591a[_0xaddb('0x2d')]){delete _0x2a591a[_0xaddb('0x2d')];}_0x1c2f89[_0xaddb('0x1c')](_0x24dd96)[_0xaddb('0x2e')](_0x2a591a);};}exports[_0xaddb('0x2f')]=function(_0x541122,_0x299cc5){var _0x2cf7ed={},_0x329f06={},_0x43ff0c={'count':0x0,'rows':[]};var _0x235e75=_['map'](db[_0xaddb('0x30')][_0xaddb('0x31')],function(_0x1081f4){return{'name':_0x1081f4['fieldName'],'type':_0x1081f4[_0xaddb('0x32')][_0xaddb('0x33')]};});_0x329f06['model']=_[_0xaddb('0x34')](_0x235e75,_0xaddb('0x2d'));_0x329f06[_0xaddb('0x35')]=_[_0xaddb('0x36')](_0x541122[_0xaddb('0x35')]);_0x329f06[_0xaddb('0x37')]=_[_0xaddb('0x38')](_0x329f06[_0xaddb('0x39')],_0x329f06[_0xaddb('0x35')]);_0x2cf7ed[_0xaddb('0x3a')]=_[_0xaddb('0x38')](_0x329f06[_0xaddb('0x39')],qs[_0xaddb('0x3b')](_0x541122[_0xaddb('0x35')][_0xaddb('0x3b')]));_0x2cf7ed[_0xaddb('0x3a')]=_0x2cf7ed[_0xaddb('0x3a')]['length']?_0x2cf7ed[_0xaddb('0x3a')]:_0x329f06['model'];if(!_0x541122[_0xaddb('0x35')][_0xaddb('0x3c')]('nolimit')){_0x2cf7ed[_0xaddb('0x21')]=qs[_0xaddb('0x21')](_0x541122[_0xaddb('0x35')]['limit']);_0x2cf7ed[_0xaddb('0x1e')]=qs[_0xaddb('0x1e')](_0x541122[_0xaddb('0x35')][_0xaddb('0x1e')]);}_0x2cf7ed[_0xaddb('0x3d')]=qs[_0xaddb('0x3e')](_0x541122[_0xaddb('0x35')][_0xaddb('0x3e')]);_0x2cf7ed[_0xaddb('0x3f')]=qs['filters'](_[_0xaddb('0x40')](_0x541122['query'],_0x329f06['filters']),_0x235e75);if(_0x541122['query'][_0xaddb('0x41')]){_0x2cf7ed['where']=_[_0xaddb('0x42')](_0x2cf7ed[_0xaddb('0x3f')],{'$or':_[_0xaddb('0x34')](_0x235e75,function(_0x20d65a){if(_0x20d65a[_0xaddb('0x32')]!==_0xaddb('0x43')){var _0x1e9bb9={};_0x1e9bb9[_0x20d65a[_0xaddb('0x2d')]]={'$like':'%'+_0x541122[_0xaddb('0x35')][_0xaddb('0x41')]+'%'};return _0x1e9bb9;}})});}_0x2cf7ed=_[_0xaddb('0x42')]({},_0x2cf7ed,_0x541122[_0xaddb('0x44')]);var _0x2ffa23={'where':_0x2cf7ed[_0xaddb('0x3f')]};return db[_0xaddb('0x30')][_0xaddb('0x20')](_0x2ffa23)[_0xaddb('0x29')](function(_0x3c03a5){_0x43ff0c[_0xaddb('0x20')]=_0x3c03a5;if(_0x541122[_0xaddb('0x35')][_0xaddb('0x45')]){_0x2cf7ed['include']=[{'all':!![]}];}return db[_0xaddb('0x30')]['findAll'](_0x2cf7ed);})[_0xaddb('0x29')](function(_0x456c53){_0x43ff0c[_0xaddb('0x46')]=_0x456c53;return _0x43ff0c;})[_0xaddb('0x29')](respondWithFilteredResult(_0x299cc5,_0x2cf7ed))[_0xaddb('0x47')](handleError(_0x299cc5,null));};exports[_0xaddb('0x48')]=function(_0x5ccc95,_0x344719){var _0x538421={'raw':![],'where':{'id':_0x5ccc95[_0xaddb('0x49')]['id']}},_0x4dd790={};_0x4dd790[_0xaddb('0x39')]=_[_0xaddb('0x36')](db[_0xaddb('0x30')][_0xaddb('0x31')]);_0x4dd790[_0xaddb('0x35')]=_[_0xaddb('0x36')](_0x5ccc95[_0xaddb('0x35')]);_0x4dd790[_0xaddb('0x37')]=_['intersection'](_0x4dd790[_0xaddb('0x39')],_0x4dd790['query']);_0x538421[_0xaddb('0x3a')]=_[_0xaddb('0x38')](_0x4dd790[_0xaddb('0x39')],qs[_0xaddb('0x3b')](_0x5ccc95[_0xaddb('0x35')][_0xaddb('0x3b')]));_0x538421[_0xaddb('0x3a')]=_0x538421['attributes'][_0xaddb('0x4a')]?_0x538421[_0xaddb('0x3a')]:_0x4dd790[_0xaddb('0x39')];if(_0x5ccc95[_0xaddb('0x35')][_0xaddb('0x45')]){_0x538421[_0xaddb('0x4b')]=[{'all':!![]}];}_0x538421=_[_0xaddb('0x42')]({},_0x538421,_0x5ccc95[_0xaddb('0x44')]);return db[_0xaddb('0x30')][_0xaddb('0x4c')](_0x538421)['then'](handleEntityNotFound(_0x344719,null))[_0xaddb('0x29')](respondWithResult(_0x344719,null))['catch'](handleError(_0x344719,null));};exports['create']=function(_0x3bca4f,_0x2b983a){return db[_0xaddb('0x30')]['create'](_0x3bca4f['body'],{})[_0xaddb('0x29')](respondWithResult(_0x2b983a,0xc9))['catch'](handleError(_0x2b983a,null));};exports[_0xaddb('0x28')]=function(_0x1fc680,_0x5aa857){if(_0x1fc680[_0xaddb('0x4d')]['id']){delete _0x1fc680[_0xaddb('0x4d')]['id'];}return db[_0xaddb('0x30')][_0xaddb('0x4c')]({'where':{'id':_0x1fc680[_0xaddb('0x49')]['id']}})['then'](handleEntityNotFound(_0x5aa857,null))[_0xaddb('0x29')](saveUpdates(_0x1fc680[_0xaddb('0x4d')],null))[_0xaddb('0x29')](respondWithResult(_0x5aa857,null))[_0xaddb('0x47')](handleError(_0x5aa857,null));};exports[_0xaddb('0x2a')]=function(_0x107f06,_0x2d3f91){return db['FreshdeskConfiguration'][_0xaddb('0x4c')]({'where':{'id':_0x107f06[_0xaddb('0x49')]['id']}})[_0xaddb('0x29')](handleEntityNotFound(_0x2d3f91,null))['then'](removeEntity(_0x2d3f91,null))[_0xaddb('0x47')](handleError(_0x2d3f91,null));};exports[_0xaddb('0x4e')]=function(_0x4043e8,_0x502146,_0x589326){var _0x21e5e0={};var _0x264dfb={};var _0x52675a;var _0x187312;return db[_0xaddb('0x30')][_0xaddb('0x4f')]({'where':{'id':_0x4043e8[_0xaddb('0x49')]['id']}})[_0xaddb('0x29')](handleEntityNotFound(_0x502146,null))['then'](function(_0x92c493){if(_0x92c493){_0x52675a=_0x92c493;_0x264dfb['model']=_[_0xaddb('0x36')](db[_0xaddb('0x50')][_0xaddb('0x31')]);_0x264dfb[_0xaddb('0x35')]=_['keys'](_0x4043e8['query']);_0x264dfb[_0xaddb('0x37')]=_[_0xaddb('0x38')](_0x264dfb[_0xaddb('0x39')],_0x264dfb['query']);_0x21e5e0[_0xaddb('0x3a')]=_[_0xaddb('0x38')](_0x264dfb[_0xaddb('0x39')],qs[_0xaddb('0x3b')](_0x4043e8[_0xaddb('0x35')][_0xaddb('0x3b')]));_0x21e5e0['attributes']=_0x21e5e0[_0xaddb('0x3a')][_0xaddb('0x4a')]?_0x21e5e0[_0xaddb('0x3a')]:_0x264dfb[_0xaddb('0x39')];_0x21e5e0[_0xaddb('0x3d')]=qs['sort'](_0x4043e8[_0xaddb('0x35')][_0xaddb('0x3e')]);_0x21e5e0[_0xaddb('0x3f')]=qs[_0xaddb('0x37')](_[_0xaddb('0x40')](_0x4043e8[_0xaddb('0x35')],_0x264dfb[_0xaddb('0x37')]));if(_0x4043e8[_0xaddb('0x35')][_0xaddb('0x41')]){_0x21e5e0[_0xaddb('0x3f')]=_[_0xaddb('0x42')](_0x21e5e0['where'],{'$or':_['map'](_0x21e5e0[_0xaddb('0x3a')],function(_0x12218a){var _0x5210ae={};_0x5210ae[_0x12218a]={'$like':'%'+_0x4043e8['query']['filter']+'%'};return _0x5210ae;})});}_0x21e5e0=_[_0xaddb('0x42')]({},_0x21e5e0,_0x4043e8[_0xaddb('0x44')]);return _0x52675a[_0xaddb('0x4e')](_0x21e5e0);}})['then'](function(_0x407735){if(_0x407735){_0x187312=_0x407735[_0xaddb('0x4a')];if(!_0x4043e8[_0xaddb('0x35')][_0xaddb('0x3c')](_0xaddb('0x51'))){_0x21e5e0[_0xaddb('0x21')]=qs[_0xaddb('0x21')](_0x4043e8[_0xaddb('0x35')][_0xaddb('0x21')]);_0x21e5e0[_0xaddb('0x1e')]=qs['offset'](_0x4043e8[_0xaddb('0x35')][_0xaddb('0x1e')]);}return _0x52675a[_0xaddb('0x4e')](_0x21e5e0);}})[_0xaddb('0x29')](function(_0x678296){if(_0x678296){return _0x678296?{'count':_0x187312,'rows':_0x678296}:null;}})[_0xaddb('0x29')](respondWithResult(_0x502146,null))[_0xaddb('0x47')](handleError(_0x502146,null));};exports[_0xaddb('0x52')]=function(_0x3f1a4b,_0x55b600,_0x4fa2fc){var _0x10763c={};var _0x414d49={};var _0xcaa9b0;var _0x46eed5;return db[_0xaddb('0x30')][_0xaddb('0x4f')]({'where':{'id':_0x3f1a4b[_0xaddb('0x49')]['id']}})[_0xaddb('0x29')](handleEntityNotFound(_0x55b600,null))['then'](function(_0x2f4ce9){if(_0x2f4ce9){_0xcaa9b0=_0x2f4ce9;_0x414d49[_0xaddb('0x39')]=_['keys'](db[_0xaddb('0x50')][_0xaddb('0x31')]);_0x414d49[_0xaddb('0x35')]=_[_0xaddb('0x36')](_0x3f1a4b[_0xaddb('0x35')]);_0x414d49[_0xaddb('0x37')]=_[_0xaddb('0x38')](_0x414d49[_0xaddb('0x39')],_0x414d49[_0xaddb('0x35')]);_0x10763c[_0xaddb('0x3a')]=_['intersection'](_0x414d49[_0xaddb('0x39')],qs[_0xaddb('0x3b')](_0x3f1a4b['query'][_0xaddb('0x3b')]));_0x10763c[_0xaddb('0x3a')]=_0x10763c[_0xaddb('0x3a')][_0xaddb('0x4a')]?_0x10763c[_0xaddb('0x3a')]:_0x414d49['model'];_0x10763c[_0xaddb('0x3d')]=qs[_0xaddb('0x3e')](_0x3f1a4b[_0xaddb('0x35')]['sort']);_0x10763c[_0xaddb('0x3f')]=qs[_0xaddb('0x37')](_[_0xaddb('0x40')](_0x3f1a4b[_0xaddb('0x35')],_0x414d49[_0xaddb('0x37')]));if(_0x3f1a4b[_0xaddb('0x35')]['filter']){_0x10763c[_0xaddb('0x3f')]=_['merge'](_0x10763c[_0xaddb('0x3f')],{'$or':_[_0xaddb('0x34')](_0x10763c[_0xaddb('0x3a')],function(_0x72e533){var _0x4cffd5={};_0x4cffd5[_0x72e533]={'$like':'%'+_0x3f1a4b[_0xaddb('0x35')][_0xaddb('0x41')]+'%'};return _0x4cffd5;})});}_0x10763c=_[_0xaddb('0x42')]({},_0x10763c,_0x3f1a4b[_0xaddb('0x44')]);return _0xcaa9b0[_0xaddb('0x52')](_0x10763c);}})[_0xaddb('0x29')](function(_0x3c54d6){if(_0x3c54d6){_0x46eed5=_0x3c54d6[_0xaddb('0x4a')];if(!_0x3f1a4b['query'][_0xaddb('0x3c')](_0xaddb('0x51'))){_0x10763c[_0xaddb('0x21')]=qs[_0xaddb('0x21')](_0x3f1a4b[_0xaddb('0x35')][_0xaddb('0x21')]);_0x10763c[_0xaddb('0x1e')]=qs[_0xaddb('0x1e')](_0x3f1a4b[_0xaddb('0x35')][_0xaddb('0x1e')]);}return _0xcaa9b0['getSubjects'](_0x10763c);}})[_0xaddb('0x29')](function(_0x50970f){if(_0x50970f){return _0x50970f?{'count':_0x46eed5,'rows':_0x50970f}:null;}})[_0xaddb('0x29')](respondWithResult(_0x55b600,null))[_0xaddb('0x47')](handleError(_0x55b600,null));};exports[_0xaddb('0x53')]=function(_0x1dfead,_0x3ec965,_0x52bc6c){var _0x3573b1={};var _0x35c6b8={};var _0x472b6d;var _0x5a6345;return db[_0xaddb('0x30')][_0xaddb('0x4f')]({'where':{'id':_0x1dfead[_0xaddb('0x49')]['id']}})[_0xaddb('0x29')](handleEntityNotFound(_0x3ec965,null))[_0xaddb('0x29')](function(_0x566010){if(_0x566010){_0x472b6d=_0x566010;_0x35c6b8[_0xaddb('0x39')]=_[_0xaddb('0x36')](db[_0xaddb('0x50')][_0xaddb('0x31')]);_0x35c6b8[_0xaddb('0x35')]=_[_0xaddb('0x36')](_0x1dfead[_0xaddb('0x35')]);_0x35c6b8[_0xaddb('0x37')]=_['intersection'](_0x35c6b8[_0xaddb('0x39')],_0x35c6b8[_0xaddb('0x35')]);_0x3573b1['attributes']=_['intersection'](_0x35c6b8['model'],qs[_0xaddb('0x3b')](_0x1dfead[_0xaddb('0x35')][_0xaddb('0x3b')]));_0x3573b1[_0xaddb('0x3a')]=_0x3573b1[_0xaddb('0x3a')][_0xaddb('0x4a')]?_0x3573b1[_0xaddb('0x3a')]:_0x35c6b8['model'];_0x3573b1[_0xaddb('0x3d')]=qs[_0xaddb('0x3e')](_0x1dfead[_0xaddb('0x35')][_0xaddb('0x3e')]);_0x3573b1[_0xaddb('0x3f')]=qs[_0xaddb('0x37')](_['pick'](_0x1dfead[_0xaddb('0x35')],_0x35c6b8[_0xaddb('0x37')]));if(_0x1dfead[_0xaddb('0x35')]['filter']){_0x3573b1[_0xaddb('0x3f')]=_[_0xaddb('0x42')](_0x3573b1[_0xaddb('0x3f')],{'$or':_['map'](_0x3573b1[_0xaddb('0x3a')],function(_0x567ed3){var _0x54face={};_0x54face[_0x567ed3]={'$like':'%'+_0x1dfead['query'][_0xaddb('0x41')]+'%'};return _0x54face;})});}_0x3573b1=_['merge']({},_0x3573b1,_0x1dfead[_0xaddb('0x44')]);return _0x472b6d['getDescriptions'](_0x3573b1);}})['then'](function(_0x3f5213){if(_0x3f5213){_0x5a6345=_0x3f5213[_0xaddb('0x4a')];if(!_0x1dfead['query'][_0xaddb('0x3c')](_0xaddb('0x51'))){_0x3573b1[_0xaddb('0x21')]=qs[_0xaddb('0x21')](_0x1dfead[_0xaddb('0x35')][_0xaddb('0x21')]);_0x3573b1[_0xaddb('0x1e')]=qs['offset'](_0x1dfead[_0xaddb('0x35')][_0xaddb('0x1e')]);}return _0x472b6d[_0xaddb('0x53')](_0x3573b1);}})[_0xaddb('0x29')](function(_0x1b9ac8){if(_0x1b9ac8){return _0x1b9ac8?{'count':_0x5a6345,'rows':_0x1b9ac8}:null;}})[_0xaddb('0x29')](respondWithResult(_0x3ec965,null))[_0xaddb('0x47')](handleError(_0x3ec965,null));};exports['getTags']=function(_0xbe8a27,_0x441418,_0x5ab840){var _0x2f295={};var _0x3f0e24={};var _0x58c2f6;var _0x22220d;return db['FreshdeskConfiguration'][_0xaddb('0x4f')]({'where':{'id':_0xbe8a27[_0xaddb('0x49')]['id']}})['then'](handleEntityNotFound(_0x441418,null))[_0xaddb('0x29')](function(_0x5c2f72){if(_0x5c2f72){_0x58c2f6=_0x5c2f72;_0x3f0e24[_0xaddb('0x39')]=_[_0xaddb('0x36')](db[_0xaddb('0x54')][_0xaddb('0x31')]);_0x3f0e24[_0xaddb('0x35')]=_[_0xaddb('0x36')](_0xbe8a27[_0xaddb('0x35')]);_0x3f0e24[_0xaddb('0x37')]=_['intersection'](_0x3f0e24['model'],_0x3f0e24['query']);_0x2f295[_0xaddb('0x3a')]=_[_0xaddb('0x38')](_0x3f0e24[_0xaddb('0x39')],qs['fields'](_0xbe8a27[_0xaddb('0x35')][_0xaddb('0x3b')]));_0x2f295[_0xaddb('0x3a')]=_0x2f295[_0xaddb('0x3a')][_0xaddb('0x4a')]?_0x2f295['attributes']:_0x3f0e24[_0xaddb('0x39')];_0x2f295[_0xaddb('0x3d')]=qs[_0xaddb('0x3e')](_0xbe8a27['query'][_0xaddb('0x3e')]);_0x2f295[_0xaddb('0x3f')]=qs[_0xaddb('0x37')](_[_0xaddb('0x40')](_0xbe8a27[_0xaddb('0x35')],_0x3f0e24[_0xaddb('0x37')]));if(_0xbe8a27[_0xaddb('0x35')][_0xaddb('0x41')]){_0x2f295[_0xaddb('0x3f')]=_[_0xaddb('0x42')](_0x2f295[_0xaddb('0x3f')],{'$or':_[_0xaddb('0x34')](_0x2f295[_0xaddb('0x3a')],function(_0x45cf95){var _0x299b6b={};_0x299b6b[_0x45cf95]={'$like':'%'+_0xbe8a27[_0xaddb('0x35')][_0xaddb('0x41')]+'%'};return _0x299b6b;})});}_0x2f295=_[_0xaddb('0x42')]({},_0x2f295,_0xbe8a27[_0xaddb('0x44')]);return _0x58c2f6[_0xaddb('0x55')](_0x2f295);}})[_0xaddb('0x29')](function(_0x383703){if(_0x383703){_0x22220d=_0x383703[_0xaddb('0x4a')];if(!_0xbe8a27['query'][_0xaddb('0x3c')](_0xaddb('0x51'))){_0x2f295[_0xaddb('0x21')]=qs[_0xaddb('0x21')](_0xbe8a27[_0xaddb('0x35')][_0xaddb('0x21')]);_0x2f295[_0xaddb('0x1e')]=qs[_0xaddb('0x1e')](_0xbe8a27['query'][_0xaddb('0x1e')]);}return _0x58c2f6[_0xaddb('0x55')](_0x2f295);}})[_0xaddb('0x29')](function(_0x449019){if(_0x449019){return _0x449019?{'count':_0x22220d,'rows':_0x449019}:null;}})[_0xaddb('0x29')](respondWithResult(_0x441418,null))[_0xaddb('0x47')](handleError(_0x441418,null));};exports[_0xaddb('0x56')]=function(_0x33cdf4,_0x8b6899,_0x3c5f97){if(_0x33cdf4[_0xaddb('0x4d')]['id']){delete _0x33cdf4['body']['id'];}return db[_0xaddb('0x30')]['findOne']({'where':{'id':_0x33cdf4[_0xaddb('0x49')]['id']}})['then'](handleEntityNotFound(_0x8b6899,null))[_0xaddb('0x29')](function(_0x4526d7){if(_0x4526d7){return _0x4526d7[_0xaddb('0x56')](_0x33cdf4[_0xaddb('0x4d')]['ids']||[]);}return null;})['then'](respondWithResult(_0x8b6899,null))['catch'](handleError(_0x8b6899,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js index d248f89..b93f64a 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 _0x9247=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./intFreshdeskConfiguration.attributes','define','FreshdeskConfiguration','lodash','util','../../config/logger','api'];(function(_0x24237f,_0x4cf32c){var _0x48298e=function(_0x3f7511){while(--_0x3f7511){_0x24237f['push'](_0x24237f['shift']());}};_0x48298e(++_0x4cf32c);}(_0x9247,0x1a9));var _0x7924=function(_0x11d486,_0x275600){_0x11d486=_0x11d486-0x0;var _0x24695b=_0x9247[_0x11d486];return _0x24695b;};'use strict';var _=require(_0x7924('0x0'));var util=require(_0x7924('0x1'));var logger=require(_0x7924('0x2'))(_0x7924('0x3'));var moment=require(_0x7924('0x4'));var BPromise=require(_0x7924('0x5'));var rp=require(_0x7924('0x6'));var fs=require('fs');var path=require(_0x7924('0x7'));var rimraf=require(_0x7924('0x8'));var config=require(_0x7924('0x9'));var attributes=require(_0x7924('0xa'));module['exports']=function(_0x3af0fe,_0x207dca){return _0x3af0fe[_0x7924('0xb')](_0x7924('0xc'),attributes,{'tableName':'int_freshdesk_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1f81=['bluebird','rimraf','../../config/environment','define','FreshdeskConfiguration','int_freshdesk_configurations','lodash','util','../../config/logger','api'];(function(_0x320649,_0x3fd9d6){var _0x1602b5=function(_0x588e27){while(--_0x588e27){_0x320649['push'](_0x320649['shift']());}};_0x1602b5(++_0x3fd9d6);}(_0x1f81,0x1b4));var _0x11f8=function(_0x80d733,_0x266211){_0x80d733=_0x80d733-0x0;var _0x435868=_0x1f81[_0x80d733];return _0x435868;};'use strict';var _=require(_0x11f8('0x0'));var util=require(_0x11f8('0x1'));var logger=require(_0x11f8('0x2'))(_0x11f8('0x3'));var moment=require('moment');var BPromise=require(_0x11f8('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x11f8('0x5'));var config=require(_0x11f8('0x6'));var attributes=require('./intFreshdeskConfiguration.attributes');module['exports']=function(_0x53f540,_0x3e89a1){return _0x53f540[_0x11f8('0x7')](_0x11f8('0x8'),attributes,{'tableName':_0x11f8('0x9'),'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 8a739e9..e32cf78 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 _0xd764=['../../config/utils','../../config/environment','http','request','then','info','FreshdeskConfiguration,\x20%s,\x20%s','debug','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','moment','bluebird','randomstring','../../mysqldb'];(function(_0x5c469a,_0x1eec70){var _0x270dda=function(_0x2dea52){while(--_0x2dea52){_0x5c469a['push'](_0x5c469a['shift']());}};_0x270dda(++_0x1eec70);}(_0xd764,0x140));var _0x4d76=function(_0x387703,_0x24d046){_0x387703=_0x387703-0x0;var _0x4ca897=_0xd764[_0x387703];return _0x4ca897;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x4d76('0x0'));var BPromise=require(_0x4d76('0x1'));var rs=require(_0x4d76('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4d76('0x3'))['db'];var utils=require(_0x4d76('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0x4d76('0x5'));var jayson=require('jayson/promise');var client=jayson['client'][_0x4d76('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x2105e7,_0x4abeb1,_0x41ae80){return new BPromise(function(_0x3b7c35,_0x43d2fa){return client[_0x4d76('0x7')](_0x2105e7,_0x41ae80)[_0x4d76('0x8')](function(_0x2ab5d4){logger[_0x4d76('0x9')](_0x4d76('0xa'),_0x4abeb1,'request\x20sent');logger[_0x4d76('0xb')](_0x4d76('0xc'),_0x4abeb1,_0x4d76('0xd'),JSON['stringify'](_0x2ab5d4));if(_0x2ab5d4[_0x4d76('0xe')]){if(_0x2ab5d4[_0x4d76('0xe')][_0x4d76('0xf')]===0x1f4){logger['error'](_0x4d76('0xa'),_0x4abeb1,_0x2ab5d4[_0x4d76('0xe')][_0x4d76('0x10')]);return _0x43d2fa(_0x2ab5d4[_0x4d76('0xe')][_0x4d76('0x10')]);}logger[_0x4d76('0xe')](_0x4d76('0xa'),_0x4abeb1,_0x2ab5d4[_0x4d76('0xe')][_0x4d76('0x10')]);return _0x3b7c35(_0x2ab5d4[_0x4d76('0xe')][_0x4d76('0x10')]);}else{logger[_0x4d76('0x9')](_0x4d76('0xa'),_0x4abeb1,_0x4d76('0xd'));_0x3b7c35(_0x2ab5d4[_0x4d76('0x11')][_0x4d76('0x10')]);}})['catch'](function(_0x438609){logger[_0x4d76('0xe')](_0x4d76('0xa'),_0x4abeb1,_0x438609);_0x43d2fa(_0x438609);});});} \ No newline at end of file +var _0x5e1e=['util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','FreshdeskConfiguration,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','lodash'];(function(_0x1bba6c,_0x1f94cf){var _0x415735=function(_0x3ef30d){while(--_0x3ef30d){_0x1bba6c['push'](_0x1bba6c['shift']());}};_0x415735(++_0x1f94cf);}(_0x5e1e,0x11d));var _0xe5e1=function(_0x484e36,_0x4482d8){_0x484e36=_0x484e36-0x0;var _0xafc85d=_0x5e1e[_0x484e36];return _0xafc85d;};'use strict';var _=require(_0xe5e1('0x0'));var util=require(_0xe5e1('0x1'));var moment=require(_0xe5e1('0x2'));var BPromise=require(_0xe5e1('0x3'));var rs=require(_0xe5e1('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe5e1('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xe5e1('0x6'))(_0xe5e1('0x7'));var config=require(_0xe5e1('0x8'));var jayson=require(_0xe5e1('0x9'));var client=jayson[_0xe5e1('0xa')][_0xe5e1('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x44cb46,_0x21d989,_0x2e447c){return new BPromise(function(_0x57bef3,_0x760e76){return client[_0xe5e1('0xc')](_0x44cb46,_0x2e447c)[_0xe5e1('0xd')](function(_0x1e87cf){logger[_0xe5e1('0xe')](_0xe5e1('0xf'),_0x21d989,'request\x20sent');logger['debug']('FreshdeskConfiguration,\x20%s,\x20%s,\x20%s',_0x21d989,_0xe5e1('0x10'),JSON[_0xe5e1('0x11')](_0x1e87cf));if(_0x1e87cf['error']){if(_0x1e87cf[_0xe5e1('0x12')]['code']===0x1f4){logger[_0xe5e1('0x12')](_0xe5e1('0xf'),_0x21d989,_0x1e87cf[_0xe5e1('0x12')][_0xe5e1('0x13')]);return _0x760e76(_0x1e87cf['error'][_0xe5e1('0x13')]);}logger[_0xe5e1('0x12')](_0xe5e1('0xf'),_0x21d989,_0x1e87cf['error'][_0xe5e1('0x13')]);return _0x57bef3(_0x1e87cf[_0xe5e1('0x12')][_0xe5e1('0x13')]);}else{logger['info'](_0xe5e1('0xf'),_0x21d989,_0xe5e1('0x10'));_0x57bef3(_0x1e87cf[_0xe5e1('0x14')][_0xe5e1('0x13')]);}})[_0xe5e1('0x15')](function(_0x1e7635){logger[_0xe5e1('0x12')](_0xe5e1('0xf'),_0x21d989,_0x1e7635);_0x760e76(_0x1e7635);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskField/index.js b/server/api/intFreshdeskField/index.js index c6760e8..3cba7ed 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 _0x05da=['index','/:id','show','create','update','delete','destroy','exports','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskField.controller','get','isAuthenticated'];(function(_0x38d77d,_0x129b8c){var _0xa8cfd2=function(_0x35e427){while(--_0x35e427){_0x38d77d['push'](_0x38d77d['shift']());}};_0xa8cfd2(++_0x129b8c);}(_0x05da,0x104));var _0xa05d=function(_0x28a342,_0x16b671){_0x28a342=_0x28a342-0x0;var _0x52989c=_0x05da[_0x28a342];return _0x52989c;};'use strict';var multer=require('multer');var util=require(_0xa05d('0x0'));var path=require(_0xa05d('0x1'));var timeout=require('connect-timeout');var express=require(_0xa05d('0x2'));var router=express[_0xa05d('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xa05d('0x4'));var interaction=require(_0xa05d('0x5'));var config=require(_0xa05d('0x6'));var controller=require(_0xa05d('0x7'));router[_0xa05d('0x8')]('/',auth[_0xa05d('0x9')](),controller[_0xa05d('0xa')]);router[_0xa05d('0x8')](_0xa05d('0xb'),auth['isAuthenticated'](),controller[_0xa05d('0xc')]);router['post']('/',auth[_0xa05d('0x9')](),controller[_0xa05d('0xd')]);router['put'](_0xa05d('0xb'),auth[_0xa05d('0x9')](),controller[_0xa05d('0xe')]);router[_0xa05d('0xf')](_0xa05d('0xb'),auth[_0xa05d('0x9')](),controller[_0xa05d('0x10')]);module[_0xa05d('0x11')]=router; \ No newline at end of file +var _0xd82c=['../../components/interaction/service','../../config/environment','./intFreshdeskField.controller','isAuthenticated','index','get','show','post','put','/:id','update','delete','destroy','multer','util','express','Router','fs-extra','../../components/auth/service'];(function(_0x49e584,_0x2886f8){var _0x58b1be=function(_0x40397c){while(--_0x40397c){_0x49e584['push'](_0x49e584['shift']());}};_0x58b1be(++_0x2886f8);}(_0xd82c,0x1c2));var _0xcd82=function(_0x430166,_0x31530a){_0x430166=_0x430166-0x0;var _0x16fde5=_0xd82c[_0x430166];return _0x16fde5;};'use strict';var multer=require(_0xcd82('0x0'));var util=require(_0xcd82('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xcd82('0x2'));var router=express[_0xcd82('0x3')]();var fs_extra=require(_0xcd82('0x4'));var auth=require(_0xcd82('0x5'));var interaction=require(_0xcd82('0x6'));var config=require(_0xcd82('0x7'));var controller=require(_0xcd82('0x8'));router['get']('/',auth[_0xcd82('0x9')](),controller[_0xcd82('0xa')]);router[_0xcd82('0xb')]('/:id',auth[_0xcd82('0x9')](),controller[_0xcd82('0xc')]);router[_0xcd82('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0xcd82('0xe')](_0xcd82('0xf'),auth[_0xcd82('0x9')](),controller[_0xcd82('0x10')]);router[_0xcd82('0x11')](_0xcd82('0xf'),auth[_0xcd82('0x9')](),controller[_0xcd82('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 df068ea..64df464 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 _0x948d=['variable','customVariable','keyValue','picklist','STRING','sequelize','ENUM','string'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x948d,0xfd));var _0xd948=function(_0x2ab857,_0x5d3853){_0x2ab857=_0x2ab857-0x0;var _0x523303=_0x948d[_0x2ab857];return _0x523303;};'use strict';var Sequelize=require(_0xd948('0x0'));module['exports']={'type':{'type':Sequelize[_0xd948('0x1')](_0xd948('0x2'),_0xd948('0x3'),_0xd948('0x4'),_0xd948('0x5'),_0xd948('0x6')),'defaultValue':_0xd948('0x2')},'content':{'type':Sequelize[_0xd948('0x7')]},'key':{'type':Sequelize[_0xd948('0x7')]},'keyType':{'type':Sequelize[_0xd948('0x1')]('string',_0xd948('0x3'),_0xd948('0x4'))},'keyContent':{'type':Sequelize[_0xd948('0x7')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xd948('0x7')]}}; \ No newline at end of file +var _0x362d=['ENUM','string','variable','keyValue','STRING','customVariable'];(function(_0x4ae633,_0x57c745){var _0x3eab76=function(_0x41ab43){while(--_0x41ab43){_0x4ae633['push'](_0x4ae633['shift']());}};_0x3eab76(++_0x57c745);}(_0x362d,0xc6));var _0xd362=function(_0x3f4de7,_0x3a978c){_0x3f4de7=_0x3f4de7-0x0;var _0x56e5a1=_0x362d[_0x3f4de7];return _0x56e5a1;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize[_0xd362('0x0')](_0xd362('0x1'),_0xd362('0x2'),'customVariable',_0xd362('0x3'),'picklist'),'defaultValue':_0xd362('0x1')},'content':{'type':Sequelize[_0xd362('0x4')]},'key':{'type':Sequelize[_0xd362('0x4')]},'keyType':{'type':Sequelize[_0xd362('0x0')](_0xd362('0x1'),_0xd362('0x2'),_0xd362('0x5'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0xd362('0x4')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xd362('0x4')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.controller.js b/server/api/intFreshdeskField/intFreshdeskField.controller.js index 5c47e11..e216de3 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 _0xfc03=['to-csv','ejs','fs-extra','lodash','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','FreshdeskField','fieldName','type','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','keys','rawAttributes','find','catch','create','body','eml-format','zip-dir','fast-json-patch','moment','mustache','util','path','sox'];(function(_0x8066c9,_0x5e6f8a){var _0x505a5f=function(_0x1e76dd){while(--_0x1e76dd){_0x8066c9['push'](_0x8066c9['shift']());}};_0x505a5f(++_0x5e6f8a);}(_0xfc03,0x16f));var _0x3fc0=function(_0x4e676e,_0x2a7c6d){_0x4e676e=_0x4e676e-0x0;var _0x336a3c=_0xfc03[_0x4e676e];return _0x336a3c;};'use strict';var emlformat=require(_0x3fc0('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x3fc0('0x1'));var jsonpatch=require(_0x3fc0('0x2'));var rp=require('request-promise');var moment=require(_0x3fc0('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x3fc0('0x4'));var util=require(_0x3fc0('0x5'));var path=require(_0x3fc0('0x6'));var sox=require(_0x3fc0('0x7'));var csv=require(_0x3fc0('0x8'));var ejs=require(_0x3fc0('0x9'));var fs=require('fs');var fs_extra=require(_0x3fc0('0xa'));var _=require(_0x3fc0('0xb'));var squel=require('squel');var crypto=require(_0x3fc0('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x3fc0('0xd'));var toCsv=require(_0x3fc0('0x8'));var querystring=require(_0x3fc0('0xe'));var Papa=require(_0x3fc0('0xf'));var Redis=require('ioredis');var authService=require(_0x3fc0('0x10'));var qs=require(_0x3fc0('0x11'));var as=require(_0x3fc0('0x12'));var hardwareService=require(_0x3fc0('0x13'));var logger=require(_0x3fc0('0x14'))('api');var utils=require(_0x3fc0('0x15'));var config=require(_0x3fc0('0x16'));var licenseUtil=require(_0x3fc0('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1011b7,_0x582e22){_0x582e22=_0x582e22||0xcc;return function(_0x3a4cc0){if(_0x3a4cc0){return _0x1011b7[_0x3fc0('0x18')](_0x582e22);}return _0x1011b7['status'](_0x582e22)[_0x3fc0('0x19')]();};}function respondWithResult(_0x422926,_0x392c46){_0x392c46=_0x392c46||0xc8;return function(_0x4eb69a){if(_0x4eb69a){return _0x422926[_0x3fc0('0x1a')](_0x392c46)[_0x3fc0('0x1b')](_0x4eb69a);}};}function respondWithFilteredResult(_0x367ce1,_0x27619a){return function(_0x562ecc){if(_0x562ecc){var _0x277dbf=typeof _0x27619a[_0x3fc0('0x1c')]===_0x3fc0('0x1d')&&typeof _0x27619a['limit']===_0x3fc0('0x1d');var _0x491446=_0x562ecc[_0x3fc0('0x1e')];var _0x3c5026=_0x277dbf?0x0:_0x27619a['offset'];var _0x3bb388=_0x277dbf?_0x562ecc[_0x3fc0('0x1e')]:_0x27619a[_0x3fc0('0x1c')]+_0x27619a[_0x3fc0('0x1f')];var _0x1bd575;if(_0x3bb388>=_0x491446){_0x3bb388=_0x491446;_0x1bd575=0xc8;}else{_0x1bd575=0xce;}_0x367ce1[_0x3fc0('0x1a')](_0x1bd575);return _0x367ce1[_0x3fc0('0x20')](_0x3fc0('0x21'),_0x3c5026+'-'+_0x3bb388+'/'+_0x491446)[_0x3fc0('0x1b')](_0x562ecc);}return null;};}function patchUpdates(_0x5c859e){return function(_0xf13744){try{jsonpatch[_0x3fc0('0x22')](_0xf13744,_0x5c859e,!![]);}catch(_0x34ffa7){return BPromise[_0x3fc0('0x23')](_0x34ffa7);}return _0xf13744[_0x3fc0('0x24')]();};}function saveUpdates(_0x448293,_0x47c770){return function(_0x477674){if(_0x477674){return _0x477674[_0x3fc0('0x25')](_0x448293)[_0x3fc0('0x26')](function(_0x28fc65){return _0x28fc65;});}return null;};}function removeEntity(_0x46c213,_0x303dd2){return function(_0x2f423e){if(_0x2f423e){return _0x2f423e[_0x3fc0('0x27')]()[_0x3fc0('0x26')](function(){_0x46c213[_0x3fc0('0x1a')](0xcc)[_0x3fc0('0x19')]();});}};}function handleEntityNotFound(_0x1abe10,_0x784765){return function(_0xba1a23){if(!_0xba1a23){_0x1abe10[_0x3fc0('0x18')](0x194);}return _0xba1a23;};}function handleError(_0xbec5b5,_0x4f5111){_0x4f5111=_0x4f5111||0x1f4;return function(_0x365c8e){logger[_0x3fc0('0x28')](_0x365c8e[_0x3fc0('0x29')]);if(_0x365c8e[_0x3fc0('0x2a')]){delete _0x365c8e['name'];}_0xbec5b5[_0x3fc0('0x1a')](_0x4f5111)[_0x3fc0('0x2b')](_0x365c8e);};}exports[_0x3fc0('0x2c')]=function(_0x2645b4,_0x559fcc){var _0x1e4d99={},_0x1a2261={},_0x1960a4={'count':0x0,'rows':[]};var _0xac736c=_[_0x3fc0('0x2d')](db[_0x3fc0('0x2e')]['rawAttributes'],function(_0xd9ecae){return{'name':_0xd9ecae[_0x3fc0('0x2f')],'type':_0xd9ecae[_0x3fc0('0x30')][_0x3fc0('0x31')]};});_0x1a2261[_0x3fc0('0x32')]=_[_0x3fc0('0x2d')](_0xac736c,_0x3fc0('0x2a'));_0x1a2261[_0x3fc0('0x33')]=_['keys'](_0x2645b4['query']);_0x1a2261[_0x3fc0('0x34')]=_['intersection'](_0x1a2261[_0x3fc0('0x32')],_0x1a2261[_0x3fc0('0x33')]);_0x1e4d99[_0x3fc0('0x35')]=_[_0x3fc0('0x36')](_0x1a2261[_0x3fc0('0x32')],qs['fields'](_0x2645b4['query'][_0x3fc0('0x37')]));_0x1e4d99[_0x3fc0('0x35')]=_0x1e4d99[_0x3fc0('0x35')][_0x3fc0('0x38')]?_0x1e4d99[_0x3fc0('0x35')]:_0x1a2261['model'];if(!_0x2645b4[_0x3fc0('0x33')][_0x3fc0('0x39')](_0x3fc0('0x3a'))){_0x1e4d99['limit']=qs[_0x3fc0('0x1f')](_0x2645b4[_0x3fc0('0x33')][_0x3fc0('0x1f')]);_0x1e4d99[_0x3fc0('0x1c')]=qs['offset'](_0x2645b4[_0x3fc0('0x33')][_0x3fc0('0x1c')]);}_0x1e4d99['order']=qs[_0x3fc0('0x3b')](_0x2645b4['query'][_0x3fc0('0x3b')]);_0x1e4d99[_0x3fc0('0x3c')]=qs[_0x3fc0('0x34')](_[_0x3fc0('0x3d')](_0x2645b4[_0x3fc0('0x33')],_0x1a2261[_0x3fc0('0x34')]),_0xac736c);if(_0x2645b4[_0x3fc0('0x33')][_0x3fc0('0x3e')]){_0x1e4d99[_0x3fc0('0x3c')]=_[_0x3fc0('0x3f')](_0x1e4d99[_0x3fc0('0x3c')],{'$or':_['map'](_0xac736c,function(_0x6bbe04){if(_0x6bbe04[_0x3fc0('0x30')]!==_0x3fc0('0x40')){var _0x28b4d5={};_0x28b4d5[_0x6bbe04[_0x3fc0('0x2a')]]={'$like':'%'+_0x2645b4[_0x3fc0('0x33')]['filter']+'%'};return _0x28b4d5;}})});}_0x1e4d99=_['merge']({},_0x1e4d99,_0x2645b4[_0x3fc0('0x41')]);var _0x3386d2={'where':_0x1e4d99[_0x3fc0('0x3c')]};return db[_0x3fc0('0x2e')][_0x3fc0('0x1e')](_0x3386d2)['then'](function(_0x53b45e){_0x1960a4['count']=_0x53b45e;if(_0x2645b4[_0x3fc0('0x33')][_0x3fc0('0x42')]){_0x1e4d99[_0x3fc0('0x43')]=[{'all':!![]}];}return db['FreshdeskField']['findAll'](_0x1e4d99);})[_0x3fc0('0x26')](function(_0x239dc5){_0x1960a4[_0x3fc0('0x44')]=_0x239dc5;return _0x1960a4;})[_0x3fc0('0x26')](respondWithFilteredResult(_0x559fcc,_0x1e4d99))['catch'](handleError(_0x559fcc,null));};exports['show']=function(_0x17510a,_0x2a45dc){var _0x547670={'raw':!![],'where':{'id':_0x17510a['params']['id']}},_0x32768f={};_0x32768f[_0x3fc0('0x32')]=_[_0x3fc0('0x45')](db[_0x3fc0('0x2e')][_0x3fc0('0x46')]);_0x32768f[_0x3fc0('0x33')]=_[_0x3fc0('0x45')](_0x17510a[_0x3fc0('0x33')]);_0x32768f[_0x3fc0('0x34')]=_['intersection'](_0x32768f[_0x3fc0('0x32')],_0x32768f['query']);_0x547670[_0x3fc0('0x35')]=_[_0x3fc0('0x36')](_0x32768f[_0x3fc0('0x32')],qs[_0x3fc0('0x37')](_0x17510a[_0x3fc0('0x33')]['fields']));_0x547670[_0x3fc0('0x35')]=_0x547670[_0x3fc0('0x35')][_0x3fc0('0x38')]?_0x547670[_0x3fc0('0x35')]:_0x32768f['model'];if(_0x17510a[_0x3fc0('0x33')]['includeAll']){_0x547670[_0x3fc0('0x43')]=[{'all':!![]}];}_0x547670=_[_0x3fc0('0x3f')]({},_0x547670,_0x17510a[_0x3fc0('0x41')]);return db[_0x3fc0('0x2e')][_0x3fc0('0x47')](_0x547670)['then'](handleEntityNotFound(_0x2a45dc,null))[_0x3fc0('0x26')](respondWithResult(_0x2a45dc,null))[_0x3fc0('0x48')](handleError(_0x2a45dc,null));};exports[_0x3fc0('0x49')]=function(_0x4c4aed,_0x3df404){return db[_0x3fc0('0x2e')]['create'](_0x4c4aed[_0x3fc0('0x4a')],{})[_0x3fc0('0x26')](respondWithResult(_0x3df404,0xc9))[_0x3fc0('0x48')](handleError(_0x3df404,null));};exports['update']=function(_0x5e5c73,_0x3a35ac){if(_0x5e5c73[_0x3fc0('0x4a')]['id']){delete _0x5e5c73[_0x3fc0('0x4a')]['id'];}return db['FreshdeskField'][_0x3fc0('0x47')]({'where':{'id':_0x5e5c73['params']['id']}})[_0x3fc0('0x26')](handleEntityNotFound(_0x3a35ac,null))['then'](saveUpdates(_0x5e5c73['body'],null))['then'](respondWithResult(_0x3a35ac,null))[_0x3fc0('0x48')](handleError(_0x3a35ac,null));};exports[_0x3fc0('0x27')]=function(_0x141b4c,_0x3730f5){return db[_0x3fc0('0x2e')][_0x3fc0('0x47')]({'where':{'id':_0x141b4c['params']['id']}})[_0x3fc0('0x26')](handleEntityNotFound(_0x3730f5,null))[_0x3fc0('0x26')](removeEntity(_0x3730f5,null))['catch'](handleError(_0x3730f5,null));}; \ No newline at end of file +var _0xa0bc=['ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','stack','name','send','map','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','pick','filter','merge','VIRTUAL','options','FreshdeskField','findAll','rows','show','create','catch','body','find','params','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse'];(function(_0x256f03,_0x3b838a){var _0x4a2053=function(_0x9e33a6){while(--_0x9e33a6){_0x256f03['push'](_0x256f03['shift']());}};_0x4a2053(++_0x3b838a);}(_0xa0bc,0x1b6));var _0xca0b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa0bc[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xca0b('0x0'));var zipdir=require(_0xca0b('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xca0b('0x2'));var moment=require(_0xca0b('0x3'));var BPromise=require(_0xca0b('0x4'));var Mustache=require(_0xca0b('0x5'));var util=require(_0xca0b('0x6'));var path=require(_0xca0b('0x7'));var sox=require(_0xca0b('0x8'));var csv=require(_0xca0b('0x9'));var ejs=require(_0xca0b('0xa'));var fs=require('fs');var fs_extra=require(_0xca0b('0xb'));var _=require(_0xca0b('0xc'));var squel=require(_0xca0b('0xd'));var crypto=require(_0xca0b('0xe'));var jsforce=require(_0xca0b('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xca0b('0x9'));var querystring=require(_0xca0b('0x10'));var Papa=require(_0xca0b('0x11'));var Redis=require(_0xca0b('0x12'));var authService=require(_0xca0b('0x13'));var qs=require(_0xca0b('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xca0b('0x15'));var logger=require(_0xca0b('0x16'))(_0xca0b('0x17'));var utils=require(_0xca0b('0x18'));var config=require(_0xca0b('0x19'));var licenseUtil=require(_0xca0b('0x1a'));var db=require(_0xca0b('0x1b'))['db'];function respondWithStatusCode(_0x3a2e25,_0x22ca9d){_0x22ca9d=_0x22ca9d||0xcc;return function(_0x2ce366){if(_0x2ce366){return _0x3a2e25['sendStatus'](_0x22ca9d);}return _0x3a2e25[_0xca0b('0x1c')](_0x22ca9d)[_0xca0b('0x1d')]();};}function respondWithResult(_0x358972,_0x5da205){_0x5da205=_0x5da205||0xc8;return function(_0x106ed6){if(_0x106ed6){return _0x358972[_0xca0b('0x1c')](_0x5da205)[_0xca0b('0x1e')](_0x106ed6);}};}function respondWithFilteredResult(_0x2beba9,_0x42b68e){return function(_0x404c6d){if(_0x404c6d){var _0x4d7620=typeof _0x42b68e[_0xca0b('0x1f')]===_0xca0b('0x20')&&typeof _0x42b68e['limit']===_0xca0b('0x20');var _0x5db810=_0x404c6d[_0xca0b('0x21')];var _0x5050b7=_0x4d7620?0x0:_0x42b68e[_0xca0b('0x1f')];var _0x32eff7=_0x4d7620?_0x404c6d[_0xca0b('0x21')]:_0x42b68e['offset']+_0x42b68e[_0xca0b('0x22')];var _0x2c0c53;if(_0x32eff7>=_0x5db810){_0x32eff7=_0x5db810;_0x2c0c53=0xc8;}else{_0x2c0c53=0xce;}_0x2beba9['status'](_0x2c0c53);return _0x2beba9[_0xca0b('0x23')](_0xca0b('0x24'),_0x5050b7+'-'+_0x32eff7+'/'+_0x5db810)[_0xca0b('0x1e')](_0x404c6d);}return null;};}function patchUpdates(_0x59bda9){return function(_0x865393){try{jsonpatch[_0xca0b('0x25')](_0x865393,_0x59bda9,!![]);}catch(_0x484e26){return BPromise[_0xca0b('0x26')](_0x484e26);}return _0x865393[_0xca0b('0x27')]();};}function saveUpdates(_0x2ae93b,_0x49e695){return function(_0x119589){if(_0x119589){return _0x119589[_0xca0b('0x28')](_0x2ae93b)[_0xca0b('0x29')](function(_0x504d91){return _0x504d91;});}return null;};}function removeEntity(_0x54fb03,_0x11f5c3){return function(_0x428459){if(_0x428459){return _0x428459[_0xca0b('0x2a')]()[_0xca0b('0x29')](function(){_0x54fb03[_0xca0b('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0xe122e8,_0x10b5f3){return function(_0x131c0e){if(!_0x131c0e){_0xe122e8[_0xca0b('0x2b')](0x194);}return _0x131c0e;};}function handleError(_0x15478d,_0x48e172){_0x48e172=_0x48e172||0x1f4;return function(_0x4d2d1a){logger['error'](_0x4d2d1a[_0xca0b('0x2c')]);if(_0x4d2d1a[_0xca0b('0x2d')]){delete _0x4d2d1a[_0xca0b('0x2d')];}_0x15478d[_0xca0b('0x1c')](_0x48e172)[_0xca0b('0x2e')](_0x4d2d1a);};}exports['index']=function(_0x23af62,_0xbfcb5f){var _0x3b73ff={},_0x20f0d5={},_0x227cdc={'count':0x0,'rows':[]};var _0x449a3a=_[_0xca0b('0x2f')](db['FreshdeskField'][_0xca0b('0x30')],function(_0x17a365){return{'name':_0x17a365[_0xca0b('0x31')],'type':_0x17a365[_0xca0b('0x32')]['key']};});_0x20f0d5[_0xca0b('0x33')]=_[_0xca0b('0x2f')](_0x449a3a,_0xca0b('0x2d'));_0x20f0d5[_0xca0b('0x34')]=_[_0xca0b('0x35')](_0x23af62[_0xca0b('0x34')]);_0x20f0d5[_0xca0b('0x36')]=_[_0xca0b('0x37')](_0x20f0d5[_0xca0b('0x33')],_0x20f0d5[_0xca0b('0x34')]);_0x3b73ff[_0xca0b('0x38')]=_[_0xca0b('0x37')](_0x20f0d5[_0xca0b('0x33')],qs[_0xca0b('0x39')](_0x23af62[_0xca0b('0x34')]['fields']));_0x3b73ff[_0xca0b('0x38')]=_0x3b73ff[_0xca0b('0x38')][_0xca0b('0x3a')]?_0x3b73ff[_0xca0b('0x38')]:_0x20f0d5['model'];if(!_0x23af62[_0xca0b('0x34')][_0xca0b('0x3b')]('nolimit')){_0x3b73ff[_0xca0b('0x22')]=qs[_0xca0b('0x22')](_0x23af62[_0xca0b('0x34')][_0xca0b('0x22')]);_0x3b73ff[_0xca0b('0x1f')]=qs[_0xca0b('0x1f')](_0x23af62[_0xca0b('0x34')][_0xca0b('0x1f')]);}_0x3b73ff['order']=qs['sort'](_0x23af62[_0xca0b('0x34')][_0xca0b('0x3c')]);_0x3b73ff[_0xca0b('0x3d')]=qs[_0xca0b('0x36')](_[_0xca0b('0x3e')](_0x23af62[_0xca0b('0x34')],_0x20f0d5[_0xca0b('0x36')]),_0x449a3a);if(_0x23af62[_0xca0b('0x34')][_0xca0b('0x3f')]){_0x3b73ff[_0xca0b('0x3d')]=_[_0xca0b('0x40')](_0x3b73ff[_0xca0b('0x3d')],{'$or':_[_0xca0b('0x2f')](_0x449a3a,function(_0x236edc){if(_0x236edc[_0xca0b('0x32')]!==_0xca0b('0x41')){var _0xdce72f={};_0xdce72f[_0x236edc[_0xca0b('0x2d')]]={'$like':'%'+_0x23af62[_0xca0b('0x34')][_0xca0b('0x3f')]+'%'};return _0xdce72f;}})});}_0x3b73ff=_[_0xca0b('0x40')]({},_0x3b73ff,_0x23af62[_0xca0b('0x42')]);var _0x1757f0={'where':_0x3b73ff[_0xca0b('0x3d')]};return db[_0xca0b('0x43')]['count'](_0x1757f0)['then'](function(_0x1e62f5){_0x227cdc[_0xca0b('0x21')]=_0x1e62f5;if(_0x23af62['query']['includeAll']){_0x3b73ff['include']=[{'all':!![]}];}return db[_0xca0b('0x43')][_0xca0b('0x44')](_0x3b73ff);})[_0xca0b('0x29')](function(_0xf9e175){_0x227cdc[_0xca0b('0x45')]=_0xf9e175;return _0x227cdc;})['then'](respondWithFilteredResult(_0xbfcb5f,_0x3b73ff))['catch'](handleError(_0xbfcb5f,null));};exports[_0xca0b('0x46')]=function(_0x543bf8,_0x170d76){var _0x4eca5d={'raw':!![],'where':{'id':_0x543bf8['params']['id']}},_0x57bab3={};_0x57bab3[_0xca0b('0x33')]=_[_0xca0b('0x35')](db[_0xca0b('0x43')][_0xca0b('0x30')]);_0x57bab3[_0xca0b('0x34')]=_[_0xca0b('0x35')](_0x543bf8['query']);_0x57bab3[_0xca0b('0x36')]=_[_0xca0b('0x37')](_0x57bab3[_0xca0b('0x33')],_0x57bab3[_0xca0b('0x34')]);_0x4eca5d[_0xca0b('0x38')]=_['intersection'](_0x57bab3['model'],qs[_0xca0b('0x39')](_0x543bf8[_0xca0b('0x34')][_0xca0b('0x39')]));_0x4eca5d[_0xca0b('0x38')]=_0x4eca5d['attributes'][_0xca0b('0x3a')]?_0x4eca5d[_0xca0b('0x38')]:_0x57bab3[_0xca0b('0x33')];if(_0x543bf8[_0xca0b('0x34')]['includeAll']){_0x4eca5d['include']=[{'all':!![]}];}_0x4eca5d=_[_0xca0b('0x40')]({},_0x4eca5d,_0x543bf8[_0xca0b('0x42')]);return db[_0xca0b('0x43')]['find'](_0x4eca5d)[_0xca0b('0x29')](handleEntityNotFound(_0x170d76,null))[_0xca0b('0x29')](respondWithResult(_0x170d76,null))['catch'](handleError(_0x170d76,null));};exports['create']=function(_0x4f531c,_0x379a06){return db[_0xca0b('0x43')][_0xca0b('0x47')](_0x4f531c['body'],{})['then'](respondWithResult(_0x379a06,0xc9))[_0xca0b('0x48')](handleError(_0x379a06,null));};exports[_0xca0b('0x28')]=function(_0x250288,_0x174e81){if(_0x250288[_0xca0b('0x49')]['id']){delete _0x250288[_0xca0b('0x49')]['id'];}return db['FreshdeskField']['find']({'where':{'id':_0x250288['params']['id']}})[_0xca0b('0x29')](handleEntityNotFound(_0x174e81,null))[_0xca0b('0x29')](saveUpdates(_0x250288['body'],null))[_0xca0b('0x29')](respondWithResult(_0x174e81,null))[_0xca0b('0x48')](handleError(_0x174e81,null));};exports[_0xca0b('0x2a')]=function(_0x535cce,_0x251820){return db['FreshdeskField'][_0xca0b('0x4a')]({'where':{'id':_0x535cce[_0xca0b('0x4b')]['id']}})[_0xca0b('0x29')](handleEntityNotFound(_0x251820,null))[_0xca0b('0x29')](removeEntity(_0x251820,null))[_0xca0b('0x48')](handleError(_0x251820,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.model.js b/server/api/intFreshdeskField/intFreshdeskField.model.js index 95c3a86..d1a3aed 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 _0x31c2=['path','rimraf','../../config/environment','./intFreshdeskField.attributes','exports','FreshdeskField','freshdesk_unique_index','idField','FieldId','lodash','api','moment','request-promise'];(function(_0x47541b,_0x269b12){var _0x11d886=function(_0x5abc92){while(--_0x5abc92){_0x47541b['push'](_0x47541b['shift']());}};_0x11d886(++_0x269b12);}(_0x31c2,0x98));var _0x231c=function(_0x1a0703,_0x1f7b1a){_0x1a0703=_0x1a0703-0x0;var _0x5f5d11=_0x31c2[_0x1a0703];return _0x5f5d11;};'use strict';var _=require(_0x231c('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x231c('0x1'));var moment=require(_0x231c('0x2'));var BPromise=require('bluebird');var rp=require(_0x231c('0x3'));var fs=require('fs');var path=require(_0x231c('0x4'));var rimraf=require(_0x231c('0x5'));var config=require(_0x231c('0x6'));var attributes=require(_0x231c('0x7'));module[_0x231c('0x8')]=function(_0x21b4df,_0x4442b9){return _0x21b4df['define'](_0x231c('0x9'),attributes,{'tableName':'int_freshdesk_fields','paranoid':![],'indexes':[{'name':_0x231c('0xa'),'fields':[_0x231c('0xb'),_0x231c('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x68c5=['freshdesk_unique_index','idField','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','define','FreshdeskField','int_freshdesk_fields'];(function(_0x2a7c46,_0x304757){var _0x378d8b=function(_0x5875cf){while(--_0x5875cf){_0x2a7c46['push'](_0x2a7c46['shift']());}};_0x378d8b(++_0x304757);}(_0x68c5,0x136));var _0x568c=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x68c5[_0x2f5ac5];return _0x37c9a8;};'use strict';var _=require(_0x568c('0x0'));var util=require('util');var logger=require(_0x568c('0x1'))(_0x568c('0x2'));var moment=require(_0x568c('0x3'));var BPromise=require(_0x568c('0x4'));var rp=require(_0x568c('0x5'));var fs=require('fs');var path=require(_0x568c('0x6'));var rimraf=require(_0x568c('0x7'));var config=require(_0x568c('0x8'));var attributes=require('./intFreshdeskField.attributes');module['exports']=function(_0x452710,_0x4c2eb4){return _0x452710[_0x568c('0x9')](_0x568c('0xa'),attributes,{'tableName':_0x568c('0xb'),'paranoid':![],'indexes':[{'name':_0x568c('0xc'),'fields':[_0x568c('0xd'),'FieldId'],'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 039cd5b..7a16bef 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 _0xcb08=['info','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','then','FreshdeskField,\x20%s,\x20%s','FreshdeskField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message'];(function(_0x1e5963,_0x4d5f26){var _0x4853ab=function(_0xabd544){while(--_0xabd544){_0x1e5963['push'](_0x1e5963['shift']());}};_0x4853ab(++_0x4d5f26);}(_0xcb08,0xa3));var _0x8cb0=function(_0x11f2fa,_0x38520b){_0x11f2fa=_0x11f2fa-0x0;var _0x5ea329=_0xcb08[_0x11f2fa];return _0x5ea329;};'use strict';var _=require(_0x8cb0('0x0'));var util=require(_0x8cb0('0x1'));var moment=require(_0x8cb0('0x2'));var BPromise=require(_0x8cb0('0x3'));var rs=require(_0x8cb0('0x4'));var fs=require('fs');var Redis=require(_0x8cb0('0x5'));var db=require(_0x8cb0('0x6'))['db'];var utils=require(_0x8cb0('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0x8cb0('0x8'));var jayson=require(_0x8cb0('0x9'));var client=jayson[_0x8cb0('0xa')][_0x8cb0('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x10e25f,_0x3caf23,_0x5e218b){return new BPromise(function(_0x389970,_0x354309){return client[_0x8cb0('0xc')](_0x10e25f,_0x5e218b)[_0x8cb0('0xd')](function(_0x488c2c){logger['info'](_0x8cb0('0xe'),_0x3caf23,'request\x20sent');logger['debug'](_0x8cb0('0xf'),_0x3caf23,_0x8cb0('0x10'),JSON[_0x8cb0('0x11')](_0x488c2c));if(_0x488c2c['error']){if(_0x488c2c[_0x8cb0('0x12')][_0x8cb0('0x13')]===0x1f4){logger[_0x8cb0('0x12')](_0x8cb0('0xe'),_0x3caf23,_0x488c2c[_0x8cb0('0x12')]['message']);return _0x354309(_0x488c2c[_0x8cb0('0x12')][_0x8cb0('0x14')]);}logger['error']('FreshdeskField,\x20%s,\x20%s',_0x3caf23,_0x488c2c[_0x8cb0('0x12')][_0x8cb0('0x14')]);return _0x389970(_0x488c2c['error']['message']);}else{logger[_0x8cb0('0x15')]('FreshdeskField,\x20%s,\x20%s',_0x3caf23,_0x8cb0('0x10'));_0x389970(_0x488c2c[_0x8cb0('0x16')][_0x8cb0('0x14')]);}})['catch'](function(_0x503be7){logger['error'](_0x8cb0('0xe'),_0x3caf23,_0x503be7);_0x354309(_0x503be7);});});} \ No newline at end of file +var _0x0515=['../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','FreshdeskField,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','util','moment','randomstring','ioredis'];(function(_0x50d63f,_0x289202){var _0x925092=function(_0x30ab37){while(--_0x30ab37){_0x50d63f['push'](_0x50d63f['shift']());}};_0x925092(++_0x289202);}(_0x0515,0xd8));var _0x5051=function(_0xdb01a,_0x54a83a){_0xdb01a=_0xdb01a-0x0;var _0x107ede=_0x0515[_0xdb01a];return _0x107ede;};'use strict';var _=require('lodash');var util=require(_0x5051('0x0'));var moment=require(_0x5051('0x1'));var BPromise=require('bluebird');var rs=require(_0x5051('0x2'));var fs=require('fs');var Redis=require(_0x5051('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x5051('0x4'));var logger=require(_0x5051('0x5'))('rpc');var config=require(_0x5051('0x6'));var jayson=require(_0x5051('0x7'));var client=jayson[_0x5051('0x8')][_0x5051('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3a84e1,_0x343dde,_0x556f64){return new BPromise(function(_0x1129c5,_0x1d477f){return client[_0x5051('0xa')](_0x3a84e1,_0x556f64)['then'](function(_0x18136b){logger[_0x5051('0xb')](_0x5051('0xc'),_0x343dde,_0x5051('0xd'));logger[_0x5051('0xe')]('FreshdeskField,\x20%s,\x20%s,\x20%s',_0x343dde,'request\x20sent',JSON[_0x5051('0xf')](_0x18136b));if(_0x18136b[_0x5051('0x10')]){if(_0x18136b[_0x5051('0x10')][_0x5051('0x11')]===0x1f4){logger[_0x5051('0x10')](_0x5051('0xc'),_0x343dde,_0x18136b[_0x5051('0x10')][_0x5051('0x12')]);return _0x1d477f(_0x18136b[_0x5051('0x10')][_0x5051('0x12')]);}logger[_0x5051('0x10')](_0x5051('0xc'),_0x343dde,_0x18136b['error'][_0x5051('0x12')]);return _0x1129c5(_0x18136b[_0x5051('0x10')]['message']);}else{logger[_0x5051('0xb')](_0x5051('0xc'),_0x343dde,_0x5051('0xd'));_0x1129c5(_0x18136b['result'][_0x5051('0x12')]);}})[_0x5051('0x13')](function(_0x3fd49d){logger[_0x5051('0x10')](_0x5051('0xc'),_0x343dde,_0x3fd49d);_0x1d477f(_0x3fd49d);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/index.js b/server/api/intFreshsalesAccount/index.js index 3877ac3..a16d104 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 _0xbc9d=['express','../../components/interaction/service','../../config/environment','./intFreshsalesAccount.controller','get','isAuthenticated','index','show','/:id/fields','getFields','post','create','/:id/configurations','addConfiguration','put','update','delete','/:id','destroy','multer','util','path','connect-timeout'];(function(_0x42aa1c,_0x271da2){var _0x51f28b=function(_0x3c688a){while(--_0x3c688a){_0x42aa1c['push'](_0x42aa1c['shift']());}};_0x51f28b(++_0x271da2);}(_0xbc9d,0xb4));var _0xdbc9=function(_0x5b1f5b,_0x6dae4d){_0x5b1f5b=_0x5b1f5b-0x0;var _0x43a0f0=_0xbc9d[_0x5b1f5b];return _0x43a0f0;};'use strict';var multer=require(_0xdbc9('0x0'));var util=require(_0xdbc9('0x1'));var path=require(_0xdbc9('0x2'));var timeout=require(_0xdbc9('0x3'));var express=require(_0xdbc9('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xdbc9('0x5'));var config=require(_0xdbc9('0x6'));var controller=require(_0xdbc9('0x7'));router[_0xdbc9('0x8')]('/',auth[_0xdbc9('0x9')](),controller[_0xdbc9('0xa')]);router[_0xdbc9('0x8')]('/:id',auth[_0xdbc9('0x9')](),controller[_0xdbc9('0xb')]);router[_0xdbc9('0x8')]('/:id/configurations',auth[_0xdbc9('0x9')](),controller['getConfigurations']);router['get'](_0xdbc9('0xc'),auth[_0xdbc9('0x9')](),controller[_0xdbc9('0xd')]);router[_0xdbc9('0xe')]('/',auth['isAuthenticated'](),controller[_0xdbc9('0xf')]);router[_0xdbc9('0xe')](_0xdbc9('0x10'),auth[_0xdbc9('0x9')](),controller[_0xdbc9('0x11')]);router[_0xdbc9('0x12')]('/:id',auth['isAuthenticated'](),controller[_0xdbc9('0x13')]);router[_0xdbc9('0x14')](_0xdbc9('0x15'),auth[_0xdbc9('0x9')](),controller[_0xdbc9('0x16')]);module['exports']=router; \ No newline at end of file +var _0xd87e=['post','create','addConfiguration','update','delete','destroy','multer','util','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./intFreshsalesAccount.controller','isAuthenticated','/:id','show','get','getConfigurations','/:id/fields','getFields'];(function(_0x131d98,_0x2d8377){var _0x1156b4=function(_0xfb8a39){while(--_0xfb8a39){_0x131d98['push'](_0x131d98['shift']());}};_0x1156b4(++_0x2d8377);}(_0xd87e,0x1bf));var _0xed87=function(_0x52812a,_0x38cc57){_0x52812a=_0x52812a-0x0;var _0x83cfa9=_0xd87e[_0x52812a];return _0x83cfa9;};'use strict';var multer=require(_0xed87('0x0'));var util=require(_0xed87('0x1'));var path=require('path');var timeout=require(_0xed87('0x2'));var express=require(_0xed87('0x3'));var router=express[_0xed87('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xed87('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xed87('0x6'));var controller=require(_0xed87('0x7'));router['get']('/',auth[_0xed87('0x8')](),controller['index']);router['get'](_0xed87('0x9'),auth[_0xed87('0x8')](),controller[_0xed87('0xa')]);router[_0xed87('0xb')]('/:id/configurations',auth[_0xed87('0x8')](),controller[_0xed87('0xc')]);router[_0xed87('0xb')](_0xed87('0xd'),auth[_0xed87('0x8')](),controller[_0xed87('0xe')]);router[_0xed87('0xf')]('/',auth['isAuthenticated'](),controller[_0xed87('0x10')]);router[_0xed87('0xf')]('/:id/configurations',auth[_0xed87('0x8')](),controller[_0xed87('0x11')]);router['put']('/:id',auth[_0xed87('0x8')](),controller[_0xed87('0x12')]);router[_0xed87('0x13')](_0xed87('0x9'),auth[_0xed87('0x8')](),controller[_0xed87('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js index a48ffa7..ac89e00 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 _0xd824=['exports','STRING','username','remoteUri','sequelize'];(function(_0x548b9c,_0x38f67a){var _0x45f83b=function(_0x541570){while(--_0x541570){_0x548b9c['push'](_0x548b9c['shift']());}};_0x45f83b(++_0x38f67a);}(_0xd824,0xc2));var _0x4d82=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0xd824[_0x57b54c];return _0x59cc19;};'use strict';var Sequelize=require(_0x4d82('0x0'));module[_0x4d82('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x4d82('0x2')],'unique':_0x4d82('0x3')},'apiKey':{'type':Sequelize[_0x4d82('0x2')]},'remoteUri':{'type':Sequelize[_0x4d82('0x2')],'unique':_0x4d82('0x4')},'serverUrl':{'type':Sequelize[_0x4d82('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x4991=['STRING','username','remoteUri','sequelize'];(function(_0x43dbb3,_0x1cc31c){var _0x217f5b=function(_0xa7c056){while(--_0xa7c056){_0x43dbb3['push'](_0x43dbb3['shift']());}};_0x217f5b(++_0x1cc31c);}(_0x4991,0xf7));var _0x1499=function(_0xe99733,_0x2a9d78){_0xe99733=_0xe99733-0x0;var _0x39699b=_0x4991[_0xe99733];return _0x39699b;};'use strict';var Sequelize=require(_0x1499('0x0'));module['exports']={'name':{'type':Sequelize[_0x1499('0x1')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x1499('0x1')],'unique':_0x1499('0x2')},'apiKey':{'type':Sequelize[_0x1499('0x1')]},'remoteUri':{'type':Sequelize[_0x1499('0x1')],'unique':_0x1499('0x3')},'serverUrl':{'type':Sequelize[_0x1499('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 744240d..13b41c2 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 _0x9a72=['params','keys','find','catch','create','body','getConfigurations','findOne','FreshsalesConfiguration','addConfiguration','AccountId','Subjects','channel','Descriptions','getDescriptions','FreshsalesField','getFields','username','remoteUri','apiKey','substring','lastIndexOf','GET','format','%s%s','/api/selector/owners','Token\x20token=','users','email','test','statusCode','error','getFields,\x20%s,\x20%s,\x20%s','stringify','send','Wrong\x20credentials','eml-format','rimraf','fast-json-patch','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','end','stack','name','index','map','FreshsalesAccount','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','type','VIRTUAL','merge','options','includeAll','rows','show'];(function(_0x34721e,_0x3da82b){var _0x564c1a=function(_0x4b4a08){while(--_0x4b4a08){_0x34721e['push'](_0x34721e['shift']());}};_0x564c1a(++_0x3da82b);}(_0x9a72,0x8e));var _0x29a7=function(_0x364fa1,_0x125e23){_0x364fa1=_0x364fa1-0x0;var _0x4a062d=_0x9a72[_0x364fa1];return _0x4a062d;};'use strict';var emlformat=require(_0x29a7('0x0'));var rimraf=require(_0x29a7('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x29a7('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x29a7('0x3'));var Mustache=require(_0x29a7('0x4'));var util=require(_0x29a7('0x5'));var path=require(_0x29a7('0x6'));var sox=require('sox');var csv=require(_0x29a7('0x7'));var ejs=require(_0x29a7('0x8'));var fs=require('fs');var fs_extra=require(_0x29a7('0x9'));var _=require(_0x29a7('0xa'));var squel=require(_0x29a7('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x29a7('0xc'));var toCsv=require(_0x29a7('0x7'));var querystring=require(_0x29a7('0xd'));var Papa=require(_0x29a7('0xe'));var Redis=require(_0x29a7('0xf'));var authService=require(_0x29a7('0x10'));var qs=require(_0x29a7('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x29a7('0x12'))(_0x29a7('0x13'));var utils=require(_0x29a7('0x14'));var config=require(_0x29a7('0x15'));var licenseUtil=require(_0x29a7('0x16'));var db=require(_0x29a7('0x17'))['db'];var integrations=require(_0x29a7('0x18'));function respondWithStatusCode(_0x4a8c3a,_0x1ca193){_0x1ca193=_0x1ca193||0xcc;return function(_0x1078d4){if(_0x1078d4){return _0x4a8c3a[_0x29a7('0x19')](_0x1ca193);}return _0x4a8c3a[_0x29a7('0x1a')](_0x1ca193)['end']();};}function respondWithResult(_0x47c384,_0x3433a3){_0x3433a3=_0x3433a3||0xc8;return function(_0x1f8a84){if(_0x1f8a84){return _0x47c384[_0x29a7('0x1a')](_0x3433a3)[_0x29a7('0x1b')](_0x1f8a84);}};}function respondWithFilteredResult(_0x100ed1,_0x4d7c43){return function(_0x2636f5){if(_0x2636f5){var _0x5b43b9=typeof _0x4d7c43[_0x29a7('0x1c')]===_0x29a7('0x1d')&&typeof _0x4d7c43[_0x29a7('0x1e')]===_0x29a7('0x1d');var _0x67d0c8=_0x2636f5[_0x29a7('0x1f')];var _0x4c0b97=_0x5b43b9?0x0:_0x4d7c43[_0x29a7('0x1c')];var _0x2512aa=_0x5b43b9?_0x2636f5[_0x29a7('0x1f')]:_0x4d7c43[_0x29a7('0x1c')]+_0x4d7c43[_0x29a7('0x1e')];var _0x2acc03;if(_0x2512aa>=_0x67d0c8){_0x2512aa=_0x67d0c8;_0x2acc03=0xc8;}else{_0x2acc03=0xce;}_0x100ed1['status'](_0x2acc03);return _0x100ed1[_0x29a7('0x20')](_0x29a7('0x21'),_0x4c0b97+'-'+_0x2512aa+'/'+_0x67d0c8)[_0x29a7('0x1b')](_0x2636f5);}return null;};}function patchUpdates(_0x250757){return function(_0x4c3307){try{jsonpatch[_0x29a7('0x22')](_0x4c3307,_0x250757,!![]);}catch(_0x4f3370){return BPromise[_0x29a7('0x23')](_0x4f3370);}return _0x4c3307[_0x29a7('0x24')]();};}function saveUpdates(_0x2ef42f,_0x2dd7c0){return function(_0x233e35){if(_0x233e35){return _0x233e35[_0x29a7('0x25')](_0x2ef42f)[_0x29a7('0x26')](function(_0x2d7ac8){return _0x2d7ac8;});}return null;};}function removeEntity(_0x5f4042,_0x8ff3e2){return function(_0x211696){if(_0x211696){return _0x211696[_0x29a7('0x27')]()[_0x29a7('0x26')](function(){_0x5f4042[_0x29a7('0x1a')](0xcc)[_0x29a7('0x28')]();});}};}function handleEntityNotFound(_0x128aec,_0x2cca4e){return function(_0x1116bf){if(!_0x1116bf){_0x128aec[_0x29a7('0x19')](0x194);}return _0x1116bf;};}function handleError(_0x5028c2,_0x555e35){_0x555e35=_0x555e35||0x1f4;return function(_0x5082ae){logger['error'](_0x5082ae[_0x29a7('0x29')]);if(_0x5082ae[_0x29a7('0x2a')]){delete _0x5082ae[_0x29a7('0x2a')];}_0x5028c2[_0x29a7('0x1a')](_0x555e35)['send'](_0x5082ae);};}exports[_0x29a7('0x2b')]=function(_0x2f84a7,_0x308e3d){var _0x3e0d47={},_0x23467e={},_0x2566a7={'count':0x0,'rows':[]};var _0x2cb271=_[_0x29a7('0x2c')](db[_0x29a7('0x2d')][_0x29a7('0x2e')],function(_0x5b52d5){return{'name':_0x5b52d5[_0x29a7('0x2f')],'type':_0x5b52d5['type'][_0x29a7('0x30')]};});_0x23467e[_0x29a7('0x31')]=_['map'](_0x2cb271,_0x29a7('0x2a'));_0x23467e['query']=_['keys'](_0x2f84a7[_0x29a7('0x32')]);_0x23467e[_0x29a7('0x33')]=_[_0x29a7('0x34')](_0x23467e[_0x29a7('0x31')],_0x23467e['query']);_0x3e0d47[_0x29a7('0x35')]=_[_0x29a7('0x34')](_0x23467e[_0x29a7('0x31')],qs[_0x29a7('0x36')](_0x2f84a7[_0x29a7('0x32')][_0x29a7('0x36')]));_0x3e0d47['attributes']=_0x3e0d47[_0x29a7('0x35')][_0x29a7('0x37')]?_0x3e0d47[_0x29a7('0x35')]:_0x23467e[_0x29a7('0x31')];if(!_0x2f84a7[_0x29a7('0x32')][_0x29a7('0x38')](_0x29a7('0x39'))){_0x3e0d47[_0x29a7('0x1e')]=qs[_0x29a7('0x1e')](_0x2f84a7[_0x29a7('0x32')][_0x29a7('0x1e')]);_0x3e0d47[_0x29a7('0x1c')]=qs[_0x29a7('0x1c')](_0x2f84a7[_0x29a7('0x32')][_0x29a7('0x1c')]);}_0x3e0d47[_0x29a7('0x3a')]=qs[_0x29a7('0x3b')](_0x2f84a7[_0x29a7('0x32')][_0x29a7('0x3b')]);_0x3e0d47[_0x29a7('0x3c')]=qs['filters'](_[_0x29a7('0x3d')](_0x2f84a7[_0x29a7('0x32')],_0x23467e[_0x29a7('0x33')]),_0x2cb271);if(_0x2f84a7[_0x29a7('0x32')][_0x29a7('0x3e')]){_0x3e0d47[_0x29a7('0x3c')]=_['merge'](_0x3e0d47[_0x29a7('0x3c')],{'$or':_['map'](_0x2cb271,function(_0x414640){if(_0x414640[_0x29a7('0x3f')]!==_0x29a7('0x40')){var _0x5ea201={};_0x5ea201[_0x414640[_0x29a7('0x2a')]]={'$like':'%'+_0x2f84a7['query'][_0x29a7('0x3e')]+'%'};return _0x5ea201;}})});}_0x3e0d47=_[_0x29a7('0x41')]({},_0x3e0d47,_0x2f84a7[_0x29a7('0x42')]);var _0x2542f8={'where':_0x3e0d47[_0x29a7('0x3c')]};return db[_0x29a7('0x2d')][_0x29a7('0x1f')](_0x2542f8)['then'](function(_0x278bb6){_0x2566a7[_0x29a7('0x1f')]=_0x278bb6;if(_0x2f84a7[_0x29a7('0x32')][_0x29a7('0x43')]){_0x3e0d47['include']=[{'all':!![]}];}return db['FreshsalesAccount']['findAll'](_0x3e0d47);})[_0x29a7('0x26')](function(_0x5ceeb7){_0x2566a7[_0x29a7('0x44')]=_0x5ceeb7;return _0x2566a7;})['then'](respondWithFilteredResult(_0x308e3d,_0x3e0d47))['catch'](handleError(_0x308e3d,null));};exports[_0x29a7('0x45')]=function(_0x3a1c8c,_0x31a7cb){var _0xa4344a={'raw':![],'where':{'id':_0x3a1c8c[_0x29a7('0x46')]['id']}},_0x379433={};_0x379433[_0x29a7('0x31')]=_[_0x29a7('0x47')](db['FreshsalesAccount'][_0x29a7('0x2e')]);_0x379433[_0x29a7('0x32')]=_[_0x29a7('0x47')](_0x3a1c8c[_0x29a7('0x32')]);_0x379433[_0x29a7('0x33')]=_[_0x29a7('0x34')](_0x379433['model'],_0x379433['query']);_0xa4344a[_0x29a7('0x35')]=_[_0x29a7('0x34')](_0x379433[_0x29a7('0x31')],qs['fields'](_0x3a1c8c[_0x29a7('0x32')][_0x29a7('0x36')]));_0xa4344a[_0x29a7('0x35')]=_0xa4344a[_0x29a7('0x35')][_0x29a7('0x37')]?_0xa4344a[_0x29a7('0x35')]:_0x379433[_0x29a7('0x31')];if(_0x3a1c8c[_0x29a7('0x32')][_0x29a7('0x43')]){_0xa4344a['include']=[{'all':!![]}];}_0xa4344a=_[_0x29a7('0x41')]({},_0xa4344a,_0x3a1c8c['options']);return db[_0x29a7('0x2d')][_0x29a7('0x48')](_0xa4344a)[_0x29a7('0x26')](handleEntityNotFound(_0x31a7cb,null))['then'](respondWithResult(_0x31a7cb,null))[_0x29a7('0x49')](handleError(_0x31a7cb,null));};exports[_0x29a7('0x4a')]=function(_0x171f48,_0x5e2d53){return db[_0x29a7('0x2d')]['create'](_0x171f48['body'],{})['then'](respondWithResult(_0x5e2d53,0xc9))['catch'](handleError(_0x5e2d53,null));};exports[_0x29a7('0x25')]=function(_0x3597ff,_0x34e4af){if(_0x3597ff['body']['id']){delete _0x3597ff[_0x29a7('0x4b')]['id'];}return db[_0x29a7('0x2d')][_0x29a7('0x48')]({'where':{'id':_0x3597ff['params']['id']}})[_0x29a7('0x26')](handleEntityNotFound(_0x34e4af,null))[_0x29a7('0x26')](saveUpdates(_0x3597ff[_0x29a7('0x4b')],null))['then'](respondWithResult(_0x34e4af,null))[_0x29a7('0x49')](handleError(_0x34e4af,null));};exports[_0x29a7('0x27')]=function(_0x587e91,_0x58ad4d){return db[_0x29a7('0x2d')][_0x29a7('0x48')]({'where':{'id':_0x587e91[_0x29a7('0x46')]['id']}})[_0x29a7('0x26')](handleEntityNotFound(_0x58ad4d,null))[_0x29a7('0x26')](removeEntity(_0x58ad4d,null))[_0x29a7('0x49')](handleError(_0x58ad4d,null));};exports[_0x29a7('0x4c')]=function(_0x5a4c44,_0x367dc9,_0x1f2269){var _0x578618={};var _0xbb0047={};var _0x496fa1;var _0x34666a;return db[_0x29a7('0x2d')][_0x29a7('0x4d')]({'where':{'id':_0x5a4c44['params']['id']}})[_0x29a7('0x26')](handleEntityNotFound(_0x367dc9,null))[_0x29a7('0x26')](function(_0x1e78a2){if(_0x1e78a2){_0x496fa1=_0x1e78a2;_0xbb0047[_0x29a7('0x31')]=_['keys'](db[_0x29a7('0x4e')][_0x29a7('0x2e')]);_0xbb0047[_0x29a7('0x32')]=_[_0x29a7('0x47')](_0x5a4c44[_0x29a7('0x32')]);_0xbb0047[_0x29a7('0x33')]=_[_0x29a7('0x34')](_0xbb0047[_0x29a7('0x31')],_0xbb0047[_0x29a7('0x32')]);_0x578618[_0x29a7('0x35')]=_[_0x29a7('0x34')](_0xbb0047['model'],qs[_0x29a7('0x36')](_0x5a4c44[_0x29a7('0x32')][_0x29a7('0x36')]));_0x578618['attributes']=_0x578618[_0x29a7('0x35')][_0x29a7('0x37')]?_0x578618[_0x29a7('0x35')]:_0xbb0047[_0x29a7('0x31')];_0x578618[_0x29a7('0x3a')]=qs[_0x29a7('0x3b')](_0x5a4c44[_0x29a7('0x32')][_0x29a7('0x3b')]);_0x578618[_0x29a7('0x3c')]=qs['filters'](_[_0x29a7('0x3d')](_0x5a4c44[_0x29a7('0x32')],_0xbb0047[_0x29a7('0x33')]));if(_0x5a4c44[_0x29a7('0x32')][_0x29a7('0x3e')]){_0x578618[_0x29a7('0x3c')]=_['merge'](_0x578618[_0x29a7('0x3c')],{'$or':_[_0x29a7('0x2c')](_0x578618[_0x29a7('0x35')],function(_0x1a63b0){var _0x48f6f6={};_0x48f6f6[_0x1a63b0]={'$like':'%'+_0x5a4c44[_0x29a7('0x32')][_0x29a7('0x3e')]+'%'};return _0x48f6f6;})});}_0x578618=_[_0x29a7('0x41')]({},_0x578618,_0x5a4c44[_0x29a7('0x42')]);return _0x496fa1[_0x29a7('0x4c')](_0x578618);}})['then'](function(_0x56af8a){if(_0x56af8a){_0x34666a=_0x56af8a[_0x29a7('0x37')];if(!_0x5a4c44[_0x29a7('0x32')][_0x29a7('0x38')](_0x29a7('0x39'))){_0x578618[_0x29a7('0x1e')]=qs['limit'](_0x5a4c44[_0x29a7('0x32')]['limit']);_0x578618[_0x29a7('0x1c')]=qs[_0x29a7('0x1c')](_0x5a4c44[_0x29a7('0x32')]['offset']);}return _0x496fa1[_0x29a7('0x4c')](_0x578618);}})[_0x29a7('0x26')](function(_0x4bed23){if(_0x4bed23){return _0x4bed23?{'count':_0x34666a,'rows':_0x4bed23}:null;}})[_0x29a7('0x26')](respondWithResult(_0x367dc9,null))[_0x29a7('0x49')](handleError(_0x367dc9,null));};exports[_0x29a7('0x4f')]=function(_0xff3545,_0x4009e8,_0x109fd0){if(_0xff3545[_0x29a7('0x4b')]['id']){delete _0xff3545[_0x29a7('0x4b')]['id'];}return db[_0x29a7('0x2d')][_0x29a7('0x4d')]({'where':{'id':_0xff3545['params']['id']}})['then'](handleEntityNotFound(_0x4009e8,null))[_0x29a7('0x26')](function(_0x464b9a){if(_0x464b9a){_0xff3545['body'][_0x29a7('0x50')]=_0x464b9a['id'];_0xff3545[_0x29a7('0x4b')][_0x29a7('0x51')]=integrations['getSubjects'](_0xff3545['body'][_0x29a7('0x52')],_0xff3545[_0x29a7('0x4b')][_0x29a7('0x3f')]);_0xff3545[_0x29a7('0x4b')][_0x29a7('0x53')]=integrations[_0x29a7('0x54')](_0xff3545[_0x29a7('0x4b')][_0x29a7('0x52')],_0xff3545[_0x29a7('0x4b')]['type']);return db[_0x29a7('0x4e')][_0x29a7('0x4a')](_0xff3545[_0x29a7('0x4b')],{'include':[{'model':db['FreshsalesField'],'as':_0x29a7('0x51')},{'model':db[_0x29a7('0x55')],'as':_0x29a7('0x53')}]});}return null;})[_0x29a7('0x26')](respondWithResult(_0x4009e8,null))['catch'](handleError(_0x4009e8,null));};exports[_0x29a7('0x56')]=function(_0x5f5666,_0xc8bb0c,_0x1372e6){var _0xdd45c2='';var _0x4fe5ae='';return db[_0x29a7('0x2d')][_0x29a7('0x4d')]({'where':{'id':_0x5f5666[_0x29a7('0x46')]['id']},'attributes':['id',_0x29a7('0x57'),_0x29a7('0x58'),_0x29a7('0x59')]})[_0x29a7('0x26')](handleEntityNotFound(_0xc8bb0c,null))[_0x29a7('0x26')](function(_0x14b39a){if(_0x14b39a){_0x4fe5ae=_0x14b39a[_0x29a7('0x57')];_0xdd45c2=_0x14b39a[_0x29a7('0x58')];var _0x5e5ce2=_0x14b39a['remoteUri']['slice'](-0x1);if(_0x5e5ce2==='/'){_0xdd45c2=_0xdd45c2[_0x29a7('0x5a')](0x0,_0xdd45c2[_0x29a7('0x5b')](_0x5e5ce2));}return rp({'method':_0x29a7('0x5c'),'uri':util[_0x29a7('0x5d')](_0x29a7('0x5e'),_0xdd45c2,_0x29a7('0x5f')),'headers':{'Authorization':_0x29a7('0x60')+_0x14b39a[_0x29a7('0x59')]},'json':!![]});}})[_0x29a7('0x26')](function(_0x4043e9){if(_0x4043e9){var _0x12a711=_0x4043e9[_0x29a7('0x61')];var _0x3fda11=![];var _0x53b4c7=null;for(_0x53b4c7=0x0;_0x53b4c7<_0x12a711['length'];_0x53b4c7++){if(_0x12a711[_0x53b4c7][_0x29a7('0x62')]===_0x4fe5ae){_0x3fda11=!![];}}if(_0x3fda11){return!![];}else{throw new Error({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}})[_0x29a7('0x26')](respondWithResult(_0xc8bb0c,null))[_0x29a7('0x49')](function(_0x4a15ae){var _0x51d07c=_0x5f5666[_0x29a7('0x32')][_0x29a7('0x63')]?0x1f4:_0x4a15ae[_0x29a7('0x64')]||0x1f4;logger[_0x29a7('0x65')](_0x29a7('0x66'),'getFields',_0x51d07c,JSON[_0x29a7('0x67')](_0x4a15ae));delete _0x4a15ae[_0x29a7('0x2a')];if(_0x51d07c===0x191){_0x51d07c=0x190;}_0xc8bb0c[_0x29a7('0x1a')](_0x51d07c)[_0x29a7('0x68')](_0x5f5666['query']['test']?{'message':_0x29a7('0x69'),'statusCode':_0x4a15ae['statusCode']}:_0x4a15ae);});}; \ No newline at end of file +var _0x3d1b=['fieldName','type','key','model','query','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','includeAll','include','findAll','show','params','fields','find','body','catch','update','getConfigurations','order','addConfiguration','findOne','AccountId','Subjects','getSubjects','channel','FreshsalesConfiguration','FreshsalesField','Descriptions','getFields','username','remoteUri','apiKey','slice','substring','lastIndexOf','GET','format','%s%s','Token\x20token=','users','email','Requested\x20Resource\x20not\x20Found','statusCode','stringify','test','eml-format','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/logger','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','status','offset','limit','undefined','count','set','Content-Range','json','apply','reject','save','then','destroy','end','sendStatus','error','stack','name','send','map','FreshsalesAccount','rawAttributes'];(function(_0x99e2a6,_0x110ad2){var _0x20d32a=function(_0x291ffc){while(--_0x291ffc){_0x99e2a6['push'](_0x99e2a6['shift']());}};_0x20d32a(++_0x110ad2);}(_0x3d1b,0x104));var _0xb3d1=function(_0x3c371a,_0x3893fa){_0x3c371a=_0x3c371a-0x0;var _0x1ad099=_0x3d1b[_0x3c371a];return _0x1ad099;};'use strict';var emlformat=require(_0xb3d1('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xb3d1('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xb3d1('0x2'));var BPromise=require(_0xb3d1('0x3'));var Mustache=require(_0xb3d1('0x4'));var util=require(_0xb3d1('0x5'));var path=require(_0xb3d1('0x6'));var sox=require('sox');var csv=require(_0xb3d1('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xb3d1('0x8'));var _=require(_0xb3d1('0x9'));var squel=require(_0xb3d1('0xa'));var crypto=require(_0xb3d1('0xb'));var jsforce=require(_0xb3d1('0xc'));var deskjs=require(_0xb3d1('0xd'));var toCsv=require(_0xb3d1('0x7'));var querystring=require('querystring');var Papa=require(_0xb3d1('0xe'));var Redis=require(_0xb3d1('0xf'));var authService=require(_0xb3d1('0x10'));var qs=require(_0xb3d1('0x11'));var as=require(_0xb3d1('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xb3d1('0x13'))('api');var utils=require('../../config/utils');var config=require(_0xb3d1('0x14'));var licenseUtil=require(_0xb3d1('0x15'));var db=require(_0xb3d1('0x16'))['db'];var integrations=require(_0xb3d1('0x17'));function respondWithStatusCode(_0x4a034b,_0x2d9138){_0x2d9138=_0x2d9138||0xcc;return function(_0x43d609){if(_0x43d609){return _0x4a034b['sendStatus'](_0x2d9138);}return _0x4a034b[_0xb3d1('0x18')](_0x2d9138)['end']();};}function respondWithResult(_0x241c46,_0x3f6609){_0x3f6609=_0x3f6609||0xc8;return function(_0x9671db){if(_0x9671db){return _0x241c46['status'](_0x3f6609)['json'](_0x9671db);}};}function respondWithFilteredResult(_0x28c49c,_0x336499){return function(_0x2d6451){if(_0x2d6451){var _0x1405cc=typeof _0x336499[_0xb3d1('0x19')]==='undefined'&&typeof _0x336499[_0xb3d1('0x1a')]===_0xb3d1('0x1b');var _0x3fe71d=_0x2d6451[_0xb3d1('0x1c')];var _0x44523e=_0x1405cc?0x0:_0x336499[_0xb3d1('0x19')];var _0xc825e6=_0x1405cc?_0x2d6451[_0xb3d1('0x1c')]:_0x336499[_0xb3d1('0x19')]+_0x336499['limit'];var _0x574614;if(_0xc825e6>=_0x3fe71d){_0xc825e6=_0x3fe71d;_0x574614=0xc8;}else{_0x574614=0xce;}_0x28c49c[_0xb3d1('0x18')](_0x574614);return _0x28c49c[_0xb3d1('0x1d')](_0xb3d1('0x1e'),_0x44523e+'-'+_0xc825e6+'/'+_0x3fe71d)[_0xb3d1('0x1f')](_0x2d6451);}return null;};}function patchUpdates(_0x27096a){return function(_0x48d966){try{jsonpatch[_0xb3d1('0x20')](_0x48d966,_0x27096a,!![]);}catch(_0x3dab11){return BPromise[_0xb3d1('0x21')](_0x3dab11);}return _0x48d966[_0xb3d1('0x22')]();};}function saveUpdates(_0x172ffc,_0x4a8c4a){return function(_0x42480b){if(_0x42480b){return _0x42480b['update'](_0x172ffc)[_0xb3d1('0x23')](function(_0x37c22d){return _0x37c22d;});}return null;};}function removeEntity(_0x2a312d,_0x2816da){return function(_0x5c68db){if(_0x5c68db){return _0x5c68db[_0xb3d1('0x24')]()[_0xb3d1('0x23')](function(){_0x2a312d[_0xb3d1('0x18')](0xcc)[_0xb3d1('0x25')]();});}};}function handleEntityNotFound(_0x15bfc7,_0x22edec){return function(_0xdb5efe){if(!_0xdb5efe){_0x15bfc7[_0xb3d1('0x26')](0x194);}return _0xdb5efe;};}function handleError(_0x5de64c,_0x112437){_0x112437=_0x112437||0x1f4;return function(_0x23050c){logger[_0xb3d1('0x27')](_0x23050c[_0xb3d1('0x28')]);if(_0x23050c['name']){delete _0x23050c[_0xb3d1('0x29')];}_0x5de64c['status'](_0x112437)[_0xb3d1('0x2a')](_0x23050c);};}exports['index']=function(_0x1c694d,_0x40c356){var _0x4d67e6={},_0x3dbc8a={},_0x14e200={'count':0x0,'rows':[]};var _0x42c7c4=_[_0xb3d1('0x2b')](db[_0xb3d1('0x2c')][_0xb3d1('0x2d')],function(_0x4b9669){return{'name':_0x4b9669[_0xb3d1('0x2e')],'type':_0x4b9669[_0xb3d1('0x2f')][_0xb3d1('0x30')]};});_0x3dbc8a[_0xb3d1('0x31')]=_[_0xb3d1('0x2b')](_0x42c7c4,_0xb3d1('0x29'));_0x3dbc8a[_0xb3d1('0x32')]=_[_0xb3d1('0x33')](_0x1c694d[_0xb3d1('0x32')]);_0x3dbc8a[_0xb3d1('0x34')]=_[_0xb3d1('0x35')](_0x3dbc8a['model'],_0x3dbc8a['query']);_0x4d67e6[_0xb3d1('0x36')]=_[_0xb3d1('0x35')](_0x3dbc8a[_0xb3d1('0x31')],qs['fields'](_0x1c694d[_0xb3d1('0x32')]['fields']));_0x4d67e6[_0xb3d1('0x36')]=_0x4d67e6[_0xb3d1('0x36')][_0xb3d1('0x37')]?_0x4d67e6['attributes']:_0x3dbc8a[_0xb3d1('0x31')];if(!_0x1c694d[_0xb3d1('0x32')][_0xb3d1('0x38')](_0xb3d1('0x39'))){_0x4d67e6[_0xb3d1('0x1a')]=qs['limit'](_0x1c694d['query'][_0xb3d1('0x1a')]);_0x4d67e6['offset']=qs[_0xb3d1('0x19')](_0x1c694d[_0xb3d1('0x32')][_0xb3d1('0x19')]);}_0x4d67e6['order']=qs[_0xb3d1('0x3a')](_0x1c694d[_0xb3d1('0x32')]['sort']);_0x4d67e6[_0xb3d1('0x3b')]=qs['filters'](_[_0xb3d1('0x3c')](_0x1c694d[_0xb3d1('0x32')],_0x3dbc8a[_0xb3d1('0x34')]),_0x42c7c4);if(_0x1c694d[_0xb3d1('0x32')][_0xb3d1('0x3d')]){_0x4d67e6[_0xb3d1('0x3b')]=_[_0xb3d1('0x3e')](_0x4d67e6[_0xb3d1('0x3b')],{'$or':_[_0xb3d1('0x2b')](_0x42c7c4,function(_0x3a7246){if(_0x3a7246[_0xb3d1('0x2f')]!=='VIRTUAL'){var _0x930641={};_0x930641[_0x3a7246[_0xb3d1('0x29')]]={'$like':'%'+_0x1c694d[_0xb3d1('0x32')][_0xb3d1('0x3d')]+'%'};return _0x930641;}})});}_0x4d67e6=_[_0xb3d1('0x3e')]({},_0x4d67e6,_0x1c694d[_0xb3d1('0x3f')]);var _0x1b82e0={'where':_0x4d67e6['where']};return db[_0xb3d1('0x2c')][_0xb3d1('0x1c')](_0x1b82e0)[_0xb3d1('0x23')](function(_0xa2a0b8){_0x14e200[_0xb3d1('0x1c')]=_0xa2a0b8;if(_0x1c694d['query'][_0xb3d1('0x40')]){_0x4d67e6[_0xb3d1('0x41')]=[{'all':!![]}];}return db[_0xb3d1('0x2c')][_0xb3d1('0x42')](_0x4d67e6);})[_0xb3d1('0x23')](function(_0x36d434){_0x14e200['rows']=_0x36d434;return _0x14e200;})[_0xb3d1('0x23')](respondWithFilteredResult(_0x40c356,_0x4d67e6))['catch'](handleError(_0x40c356,null));};exports[_0xb3d1('0x43')]=function(_0x26ba88,_0x3262d4){var _0xd8419e={'raw':![],'where':{'id':_0x26ba88[_0xb3d1('0x44')]['id']}},_0x3cdcaa={};_0x3cdcaa[_0xb3d1('0x31')]=_[_0xb3d1('0x33')](db['FreshsalesAccount'][_0xb3d1('0x2d')]);_0x3cdcaa[_0xb3d1('0x32')]=_[_0xb3d1('0x33')](_0x26ba88[_0xb3d1('0x32')]);_0x3cdcaa[_0xb3d1('0x34')]=_[_0xb3d1('0x35')](_0x3cdcaa['model'],_0x3cdcaa['query']);_0xd8419e['attributes']=_['intersection'](_0x3cdcaa[_0xb3d1('0x31')],qs[_0xb3d1('0x45')](_0x26ba88[_0xb3d1('0x32')][_0xb3d1('0x45')]));_0xd8419e[_0xb3d1('0x36')]=_0xd8419e[_0xb3d1('0x36')][_0xb3d1('0x37')]?_0xd8419e[_0xb3d1('0x36')]:_0x3cdcaa[_0xb3d1('0x31')];if(_0x26ba88[_0xb3d1('0x32')][_0xb3d1('0x40')]){_0xd8419e[_0xb3d1('0x41')]=[{'all':!![]}];}_0xd8419e=_['merge']({},_0xd8419e,_0x26ba88['options']);return db[_0xb3d1('0x2c')][_0xb3d1('0x46')](_0xd8419e)[_0xb3d1('0x23')](handleEntityNotFound(_0x3262d4,null))[_0xb3d1('0x23')](respondWithResult(_0x3262d4,null))['catch'](handleError(_0x3262d4,null));};exports['create']=function(_0x3f7322,_0x36b838){return db[_0xb3d1('0x2c')]['create'](_0x3f7322[_0xb3d1('0x47')],{})[_0xb3d1('0x23')](respondWithResult(_0x36b838,0xc9))[_0xb3d1('0x48')](handleError(_0x36b838,null));};exports[_0xb3d1('0x49')]=function(_0x517806,_0x2f514f){if(_0x517806[_0xb3d1('0x47')]['id']){delete _0x517806[_0xb3d1('0x47')]['id'];}return db['FreshsalesAccount']['find']({'where':{'id':_0x517806[_0xb3d1('0x44')]['id']}})[_0xb3d1('0x23')](handleEntityNotFound(_0x2f514f,null))['then'](saveUpdates(_0x517806[_0xb3d1('0x47')],null))[_0xb3d1('0x23')](respondWithResult(_0x2f514f,null))[_0xb3d1('0x48')](handleError(_0x2f514f,null));};exports[_0xb3d1('0x24')]=function(_0x3710a3,_0x47d3ad){return db[_0xb3d1('0x2c')][_0xb3d1('0x46')]({'where':{'id':_0x3710a3[_0xb3d1('0x44')]['id']}})[_0xb3d1('0x23')](handleEntityNotFound(_0x47d3ad,null))[_0xb3d1('0x23')](removeEntity(_0x47d3ad,null))[_0xb3d1('0x48')](handleError(_0x47d3ad,null));};exports[_0xb3d1('0x4a')]=function(_0x5c6939,_0x2901e0,_0x5dfc3d){var _0x1dd68a={};var _0x4aa908={};var _0x45dcba;var _0x2b7f92;return db[_0xb3d1('0x2c')]['findOne']({'where':{'id':_0x5c6939[_0xb3d1('0x44')]['id']}})['then'](handleEntityNotFound(_0x2901e0,null))[_0xb3d1('0x23')](function(_0x7dad8a){if(_0x7dad8a){_0x45dcba=_0x7dad8a;_0x4aa908['model']=_[_0xb3d1('0x33')](db['FreshsalesConfiguration'][_0xb3d1('0x2d')]);_0x4aa908[_0xb3d1('0x32')]=_['keys'](_0x5c6939[_0xb3d1('0x32')]);_0x4aa908['filters']=_[_0xb3d1('0x35')](_0x4aa908['model'],_0x4aa908[_0xb3d1('0x32')]);_0x1dd68a['attributes']=_[_0xb3d1('0x35')](_0x4aa908[_0xb3d1('0x31')],qs['fields'](_0x5c6939['query'][_0xb3d1('0x45')]));_0x1dd68a[_0xb3d1('0x36')]=_0x1dd68a[_0xb3d1('0x36')]['length']?_0x1dd68a['attributes']:_0x4aa908[_0xb3d1('0x31')];_0x1dd68a[_0xb3d1('0x4b')]=qs[_0xb3d1('0x3a')](_0x5c6939[_0xb3d1('0x32')]['sort']);_0x1dd68a['where']=qs[_0xb3d1('0x34')](_['pick'](_0x5c6939[_0xb3d1('0x32')],_0x4aa908[_0xb3d1('0x34')]));if(_0x5c6939['query'][_0xb3d1('0x3d')]){_0x1dd68a[_0xb3d1('0x3b')]=_[_0xb3d1('0x3e')](_0x1dd68a['where'],{'$or':_[_0xb3d1('0x2b')](_0x1dd68a['attributes'],function(_0x4903bb){var _0x1e48ad={};_0x1e48ad[_0x4903bb]={'$like':'%'+_0x5c6939[_0xb3d1('0x32')][_0xb3d1('0x3d')]+'%'};return _0x1e48ad;})});}_0x1dd68a=_[_0xb3d1('0x3e')]({},_0x1dd68a,_0x5c6939[_0xb3d1('0x3f')]);return _0x45dcba[_0xb3d1('0x4a')](_0x1dd68a);}})[_0xb3d1('0x23')](function(_0x393689){if(_0x393689){_0x2b7f92=_0x393689[_0xb3d1('0x37')];if(!_0x5c6939['query'][_0xb3d1('0x38')](_0xb3d1('0x39'))){_0x1dd68a['limit']=qs['limit'](_0x5c6939['query']['limit']);_0x1dd68a[_0xb3d1('0x19')]=qs[_0xb3d1('0x19')](_0x5c6939['query'][_0xb3d1('0x19')]);}return _0x45dcba[_0xb3d1('0x4a')](_0x1dd68a);}})['then'](function(_0x854847){if(_0x854847){return _0x854847?{'count':_0x2b7f92,'rows':_0x854847}:null;}})[_0xb3d1('0x23')](respondWithResult(_0x2901e0,null))[_0xb3d1('0x48')](handleError(_0x2901e0,null));};exports[_0xb3d1('0x4c')]=function(_0x4584de,_0x3d840e,_0xe0400c){if(_0x4584de[_0xb3d1('0x47')]['id']){delete _0x4584de['body']['id'];}return db[_0xb3d1('0x2c')][_0xb3d1('0x4d')]({'where':{'id':_0x4584de['params']['id']}})[_0xb3d1('0x23')](handleEntityNotFound(_0x3d840e,null))[_0xb3d1('0x23')](function(_0x179efc){if(_0x179efc){_0x4584de['body'][_0xb3d1('0x4e')]=_0x179efc['id'];_0x4584de[_0xb3d1('0x47')][_0xb3d1('0x4f')]=integrations[_0xb3d1('0x50')](_0x4584de[_0xb3d1('0x47')]['channel'],_0x4584de['body'][_0xb3d1('0x2f')]);_0x4584de['body']['Descriptions']=integrations['getDescriptions'](_0x4584de[_0xb3d1('0x47')][_0xb3d1('0x51')],_0x4584de[_0xb3d1('0x47')][_0xb3d1('0x2f')]);return db[_0xb3d1('0x52')]['create'](_0x4584de[_0xb3d1('0x47')],{'include':[{'model':db[_0xb3d1('0x53')],'as':_0xb3d1('0x4f')},{'model':db[_0xb3d1('0x53')],'as':_0xb3d1('0x54')}]});}return null;})[_0xb3d1('0x23')](respondWithResult(_0x3d840e,null))[_0xb3d1('0x48')](handleError(_0x3d840e,null));};exports[_0xb3d1('0x55')]=function(_0x5e9625,_0x3448b0,_0x502cfe){var _0x217212='';var _0x97b4d8='';return db[_0xb3d1('0x2c')][_0xb3d1('0x4d')]({'where':{'id':_0x5e9625[_0xb3d1('0x44')]['id']},'attributes':['id',_0xb3d1('0x56'),_0xb3d1('0x57'),_0xb3d1('0x58')]})[_0xb3d1('0x23')](handleEntityNotFound(_0x3448b0,null))['then'](function(_0x4832dc){if(_0x4832dc){_0x97b4d8=_0x4832dc[_0xb3d1('0x56')];_0x217212=_0x4832dc['remoteUri'];var _0x5b4f38=_0x4832dc[_0xb3d1('0x57')][_0xb3d1('0x59')](-0x1);if(_0x5b4f38==='/'){_0x217212=_0x217212[_0xb3d1('0x5a')](0x0,_0x217212[_0xb3d1('0x5b')](_0x5b4f38));}return rp({'method':_0xb3d1('0x5c'),'uri':util[_0xb3d1('0x5d')](_0xb3d1('0x5e'),_0x217212,'/api/selector/owners'),'headers':{'Authorization':_0xb3d1('0x5f')+_0x4832dc['apiKey']},'json':!![]});}})['then'](function(_0x175942){if(_0x175942){var _0x222f96=_0x175942[_0xb3d1('0x60')];var _0x577a42=![];var _0x25089c=null;for(_0x25089c=0x0;_0x25089c<_0x222f96[_0xb3d1('0x37')];_0x25089c++){if(_0x222f96[_0x25089c][_0xb3d1('0x61')]===_0x97b4d8){_0x577a42=!![];}}if(_0x577a42){return!![];}else{throw new Error({'statusCode':0x194,'message':_0xb3d1('0x62')});}}})[_0xb3d1('0x23')](respondWithResult(_0x3448b0,null))[_0xb3d1('0x48')](function(_0x26cb8f){var _0x23da80=_0x5e9625[_0xb3d1('0x32')]['test']?0x1f4:_0x26cb8f[_0xb3d1('0x63')]||0x1f4;logger[_0xb3d1('0x27')]('getFields,\x20%s,\x20%s,\x20%s','getFields',_0x23da80,JSON[_0xb3d1('0x64')](_0x26cb8f));delete _0x26cb8f['name'];if(_0x23da80===0x191){_0x23da80=0x190;}_0x3448b0[_0xb3d1('0x18')](_0x23da80)[_0xb3d1('0x2a')](_0x5e9625[_0xb3d1('0x32')][_0xb3d1('0x65')]?{'message':'Wrong\x20credentials','statusCode':_0x26cb8f['statusCode']}:_0x26cb8f);});}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js index 806d098..6e9db2e 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 _0xd046=['rimraf','./intFreshsalesAccount.attributes','int_freshsales_accounts','util','../../config/logger','api','bluebird'];(function(_0x53cf8e,_0x3d290f){var _0x459197=function(_0x67073c){while(--_0x67073c){_0x53cf8e['push'](_0x53cf8e['shift']());}};_0x459197(++_0x3d290f);}(_0xd046,0x129));var _0x6d04=function(_0x554a6b,_0x4006d1){_0x554a6b=_0x554a6b-0x0;var _0xe17e60=_0xd046[_0x554a6b];return _0xe17e60;};'use strict';var _=require('lodash');var util=require(_0x6d04('0x0'));var logger=require(_0x6d04('0x1'))(_0x6d04('0x2'));var moment=require('moment');var BPromise=require(_0x6d04('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x6d04('0x4'));var config=require('../../config/environment');var attributes=require(_0x6d04('0x5'));var integrations=require('../../components/integrations/configuration');module['exports']=function(_0xf3b4e7,_0x1968c4){return _0xf3b4e7['define']('FreshsalesAccount',attributes,{'tableName':_0x6d04('0x6'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4745=['path','rimraf','../../config/environment','./intFreshsalesAccount.attributes','../../components/integrations/configuration','FreshsalesAccount','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x5865fe,_0x320a58){var _0x28df36=function(_0x5e22e0){while(--_0x5e22e0){_0x5865fe['push'](_0x5865fe['shift']());}};_0x28df36(++_0x320a58);}(_0x4745,0x1e7));var _0x5474=function(_0xbe200f,_0x4b50eb){_0xbe200f=_0xbe200f-0x0;var _0x192597=_0x4745[_0xbe200f];return _0x192597;};'use strict';var _=require(_0x5474('0x0'));var util=require(_0x5474('0x1'));var logger=require(_0x5474('0x2'))(_0x5474('0x3'));var moment=require(_0x5474('0x4'));var BPromise=require(_0x5474('0x5'));var rp=require(_0x5474('0x6'));var fs=require('fs');var path=require(_0x5474('0x7'));var rimraf=require(_0x5474('0x8'));var config=require(_0x5474('0x9'));var attributes=require(_0x5474('0xa'));var integrations=require(_0x5474('0xb'));module['exports']=function(_0x3d1e1,_0x431f81){return _0x3d1e1['define'](_0x5474('0xc'),attributes,{'tableName':'int_freshsales_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.rpc.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.rpc.js index 6157197..31aa846 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 _0xfcf0=['request','info','FreshsalesAccount,\x20%s,\x20%s','debug','request\x20sent','stringify','error','message','result','GetFreshsalesAccount','findAll','options','raw','where','attributes','limit','include','map','model','then','FreshsalesAccount','find','ShowFreshsalesAccount','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0xf955a0,_0x17a432){var _0x1663ef=function(_0x2ec2bc){while(--_0x2ec2bc){_0xf955a0['push'](_0xf955a0['shift']());}};_0x1663ef(++_0x17a432);}(_0xfcf0,0x138));var _0x0fcf=function(_0x3817a9,_0x29e215){_0x3817a9=_0x3817a9-0x0;var _0x443f30=_0xfcf0[_0x3817a9];return _0x443f30;};'use strict';var _=require(_0x0fcf('0x0'));var util=require(_0x0fcf('0x1'));var moment=require('moment');var BPromise=require(_0x0fcf('0x2'));var rs=require(_0x0fcf('0x3'));var fs=require('fs');var Redis=require(_0x0fcf('0x4'));var db=require(_0x0fcf('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x0fcf('0x6'))(_0x0fcf('0x7'));var config=require(_0x0fcf('0x8'));var jayson=require(_0x0fcf('0x9'));var client=jayson[_0x0fcf('0xa')][_0x0fcf('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x61bbb9,_0x2dfdf8,_0x50c575){return new BPromise(function(_0x1388d1,_0x6ced94){return client[_0x0fcf('0xc')](_0x61bbb9,_0x50c575)['then'](function(_0x69a840){logger[_0x0fcf('0xd')](_0x0fcf('0xe'),_0x2dfdf8,'request\x20sent');logger[_0x0fcf('0xf')]('FreshsalesAccount,\x20%s,\x20%s,\x20%s',_0x2dfdf8,_0x0fcf('0x10'),JSON[_0x0fcf('0x11')](_0x69a840));if(_0x69a840[_0x0fcf('0x12')]){if(_0x69a840['error']['code']===0x1f4){logger[_0x0fcf('0x12')](_0x0fcf('0xe'),_0x2dfdf8,_0x69a840['error'][_0x0fcf('0x13')]);return _0x6ced94(_0x69a840[_0x0fcf('0x12')][_0x0fcf('0x13')]);}logger[_0x0fcf('0x12')](_0x0fcf('0xe'),_0x2dfdf8,_0x69a840['error'][_0x0fcf('0x13')]);return _0x1388d1(_0x69a840[_0x0fcf('0x12')][_0x0fcf('0x13')]);}else{logger['info'](_0x0fcf('0xe'),_0x2dfdf8,_0x0fcf('0x10'));_0x1388d1(_0x69a840[_0x0fcf('0x14')][_0x0fcf('0x13')]);}})['catch'](function(_0x3e78d0){logger[_0x0fcf('0x12')](_0x0fcf('0xe'),_0x2dfdf8,_0x3e78d0);_0x6ced94(_0x3e78d0);});});}exports[_0x0fcf('0x15')]=function(_0x19cfbd){var _0x567320=this;return new Promise(function(_0x18ea32,_0x1a8f58){return db['FreshsalesAccount'][_0x0fcf('0x16')]({'raw':_0x19cfbd[_0x0fcf('0x17')]?_0x19cfbd['options'][_0x0fcf('0x18')]===undefined?!![]:![]:!![],'where':_0x19cfbd['options']?_0x19cfbd[_0x0fcf('0x17')][_0x0fcf('0x19')]||null:null,'attributes':_0x19cfbd['options']?_0x19cfbd[_0x0fcf('0x17')][_0x0fcf('0x1a')]||null:null,'limit':_0x19cfbd[_0x0fcf('0x17')]?_0x19cfbd['options'][_0x0fcf('0x1b')]||null:null,'include':_0x19cfbd[_0x0fcf('0x17')]?_0x19cfbd[_0x0fcf('0x17')][_0x0fcf('0x1c')]?_[_0x0fcf('0x1d')](_0x19cfbd[_0x0fcf('0x17')]['include'],function(_0x2eef74){return{'model':db[_0x2eef74[_0x0fcf('0x1e')]],'as':_0x2eef74['as'],'attributes':_0x2eef74[_0x0fcf('0x1a')],'include':_0x2eef74[_0x0fcf('0x1c')]?_[_0x0fcf('0x1d')](_0x2eef74[_0x0fcf('0x1c')],function(_0x2ce990){return{'model':db[_0x2ce990[_0x0fcf('0x1e')]],'as':_0x2ce990['as'],'attributes':_0x2ce990[_0x0fcf('0x1a')],'include':_0x2ce990['include']?_[_0x0fcf('0x1d')](_0x2ce990[_0x0fcf('0x1c')],function(_0x41b7a2){return{'model':db[_0x41b7a2[_0x0fcf('0x1e')]],'as':_0x41b7a2['as'],'attributes':_0x41b7a2[_0x0fcf('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x0fcf('0x1f')](function(_0x2730b0){logger['info'](_0x0fcf('0x15'),_0x19cfbd);logger[_0x0fcf('0xf')](_0x0fcf('0x15'),_0x19cfbd,JSON[_0x0fcf('0x11')](_0x2730b0));_0x18ea32(_0x2730b0);})['catch'](function(_0x5d9bcd){logger['error'](_0x0fcf('0x15'),_0x5d9bcd['message'],_0x19cfbd);_0x1a8f58(_0x567320[_0x0fcf('0x12')](0x1f4,_0x5d9bcd[_0x0fcf('0x13')]));});});};exports['ShowFreshsalesAccount']=function(_0xdfd3ec){var _0x117041=this;return new Promise(function(_0xa52f52,_0x161496){return db[_0x0fcf('0x20')][_0x0fcf('0x21')]({'raw':_0xdfd3ec['options']?_0xdfd3ec[_0x0fcf('0x17')][_0x0fcf('0x18')]===undefined?!![]:![]:!![],'where':_0xdfd3ec[_0x0fcf('0x17')]?_0xdfd3ec[_0x0fcf('0x17')][_0x0fcf('0x19')]||null:null,'attributes':_0xdfd3ec[_0x0fcf('0x17')]?_0xdfd3ec['options'][_0x0fcf('0x1a')]||null:null,'include':_0xdfd3ec[_0x0fcf('0x17')]?_0xdfd3ec[_0x0fcf('0x17')][_0x0fcf('0x1c')]?_[_0x0fcf('0x1d')](_0xdfd3ec[_0x0fcf('0x17')][_0x0fcf('0x1c')],function(_0x344957){return{'model':db[_0x344957[_0x0fcf('0x1e')]],'as':_0x344957['as'],'attributes':_0x344957[_0x0fcf('0x1a')],'include':_0x344957[_0x0fcf('0x1c')]?_[_0x0fcf('0x1d')](_0x344957[_0x0fcf('0x1c')],function(_0x17346e){return{'model':db[_0x17346e['model']],'as':_0x17346e['as'],'attributes':_0x17346e['attributes'],'include':_0x17346e[_0x0fcf('0x1c')]?_['map'](_0x17346e['include'],function(_0x1a1e07){return{'model':db[_0x1a1e07[_0x0fcf('0x1e')]],'as':_0x1a1e07['as'],'attributes':_0x1a1e07[_0x0fcf('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x57e635){logger[_0x0fcf('0xd')](_0x0fcf('0x22'),_0xdfd3ec);logger[_0x0fcf('0xf')]('ShowFreshsalesAccount',_0xdfd3ec,JSON[_0x0fcf('0x11')](_0x57e635));_0xa52f52(_0x57e635);})[_0x0fcf('0x23')](function(_0x29067e){logger['error']('ShowFreshsalesAccount',_0x29067e['message'],_0xdfd3ec);_0x161496(_0x117041[_0x0fcf('0x12')](0x1f4,_0x29067e[_0x0fcf('0x13')]));});});}; \ No newline at end of file +var _0x4991=['where','attributes','limit','include','map','model','catch','ShowFreshsalesAccount','find','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','FreshsalesAccount,\x20%s,\x20%s','debug','FreshsalesAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','GetFreshsalesAccount','findAll','options','raw'];(function(_0x236843,_0x36ada6){var _0x1beb7f=function(_0x4618da){while(--_0x4618da){_0x236843['push'](_0x236843['shift']());}};_0x1beb7f(++_0x36ada6);}(_0x4991,0xf7));var _0x1499=function(_0x47d586,_0x1aff73){_0x47d586=_0x47d586-0x0;var _0x17b936=_0x4991[_0x47d586];return _0x17b936;};'use strict';var _=require(_0x1499('0x0'));var util=require('util');var moment=require(_0x1499('0x1'));var BPromise=require('bluebird');var rs=require(_0x1499('0x2'));var fs=require('fs');var Redis=require(_0x1499('0x3'));var db=require(_0x1499('0x4'))['db'];var utils=require(_0x1499('0x5'));var logger=require(_0x1499('0x6'))(_0x1499('0x7'));var config=require(_0x1499('0x8'));var jayson=require(_0x1499('0x9'));var client=jayson['client'][_0x1499('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1c3bd7,_0x1c65c3,_0x33b261){return new BPromise(function(_0x133bae,_0x380e48){return client[_0x1499('0xb')](_0x1c3bd7,_0x33b261)[_0x1499('0xc')](function(_0x48d2ca){logger[_0x1499('0xd')](_0x1499('0xe'),_0x1c65c3,'request\x20sent');logger[_0x1499('0xf')](_0x1499('0x10'),_0x1c65c3,'request\x20sent',JSON[_0x1499('0x11')](_0x48d2ca));if(_0x48d2ca[_0x1499('0x12')]){if(_0x48d2ca['error']['code']===0x1f4){logger['error'](_0x1499('0xe'),_0x1c65c3,_0x48d2ca[_0x1499('0x12')][_0x1499('0x13')]);return _0x380e48(_0x48d2ca[_0x1499('0x12')][_0x1499('0x13')]);}logger['error']('FreshsalesAccount,\x20%s,\x20%s',_0x1c65c3,_0x48d2ca[_0x1499('0x12')]['message']);return _0x133bae(_0x48d2ca[_0x1499('0x12')][_0x1499('0x13')]);}else{logger[_0x1499('0xd')](_0x1499('0xe'),_0x1c65c3,'request\x20sent');_0x133bae(_0x48d2ca[_0x1499('0x14')][_0x1499('0x13')]);}})['catch'](function(_0x25164c){logger[_0x1499('0x12')](_0x1499('0xe'),_0x1c65c3,_0x25164c);_0x380e48(_0x25164c);});});}exports[_0x1499('0x15')]=function(_0x1e45a9){var _0x27e533=this;return new Promise(function(_0x5b9859,_0x541477){return db['FreshsalesAccount'][_0x1499('0x16')]({'raw':_0x1e45a9[_0x1499('0x17')]?_0x1e45a9['options'][_0x1499('0x18')]===undefined?!![]:![]:!![],'where':_0x1e45a9[_0x1499('0x17')]?_0x1e45a9[_0x1499('0x17')][_0x1499('0x19')]||null:null,'attributes':_0x1e45a9[_0x1499('0x17')]?_0x1e45a9[_0x1499('0x17')][_0x1499('0x1a')]||null:null,'limit':_0x1e45a9[_0x1499('0x17')]?_0x1e45a9[_0x1499('0x17')][_0x1499('0x1b')]||null:null,'include':_0x1e45a9[_0x1499('0x17')]?_0x1e45a9[_0x1499('0x17')][_0x1499('0x1c')]?_[_0x1499('0x1d')](_0x1e45a9[_0x1499('0x17')][_0x1499('0x1c')],function(_0x2c7f57){return{'model':db[_0x2c7f57['model']],'as':_0x2c7f57['as'],'attributes':_0x2c7f57[_0x1499('0x1a')],'include':_0x2c7f57[_0x1499('0x1c')]?_[_0x1499('0x1d')](_0x2c7f57[_0x1499('0x1c')],function(_0x3968e0){return{'model':db[_0x3968e0[_0x1499('0x1e')]],'as':_0x3968e0['as'],'attributes':_0x3968e0['attributes'],'include':_0x3968e0['include']?_[_0x1499('0x1d')](_0x3968e0[_0x1499('0x1c')],function(_0x3b9259){return{'model':db[_0x3b9259[_0x1499('0x1e')]],'as':_0x3b9259['as'],'attributes':_0x3b9259[_0x1499('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3e5ed1){logger['info']('GetFreshsalesAccount',_0x1e45a9);logger['debug'](_0x1499('0x15'),_0x1e45a9,JSON[_0x1499('0x11')](_0x3e5ed1));_0x5b9859(_0x3e5ed1);})[_0x1499('0x1f')](function(_0x1b460b){logger[_0x1499('0x12')](_0x1499('0x15'),_0x1b460b[_0x1499('0x13')],_0x1e45a9);_0x541477(_0x27e533['error'](0x1f4,_0x1b460b[_0x1499('0x13')]));});});};exports[_0x1499('0x20')]=function(_0x39995b){var _0x5b59ea=this;return new Promise(function(_0x2dae84,_0x16466c){return db['FreshsalesAccount'][_0x1499('0x21')]({'raw':_0x39995b[_0x1499('0x17')]?_0x39995b['options'][_0x1499('0x18')]===undefined?!![]:![]:!![],'where':_0x39995b[_0x1499('0x17')]?_0x39995b[_0x1499('0x17')][_0x1499('0x19')]||null:null,'attributes':_0x39995b[_0x1499('0x17')]?_0x39995b[_0x1499('0x17')][_0x1499('0x1a')]||null:null,'include':_0x39995b[_0x1499('0x17')]?_0x39995b[_0x1499('0x17')][_0x1499('0x1c')]?_[_0x1499('0x1d')](_0x39995b[_0x1499('0x17')][_0x1499('0x1c')],function(_0x3f4c1a){return{'model':db[_0x3f4c1a[_0x1499('0x1e')]],'as':_0x3f4c1a['as'],'attributes':_0x3f4c1a[_0x1499('0x1a')],'include':_0x3f4c1a[_0x1499('0x1c')]?_[_0x1499('0x1d')](_0x3f4c1a[_0x1499('0x1c')],function(_0x29e89e){return{'model':db[_0x29e89e['model']],'as':_0x29e89e['as'],'attributes':_0x29e89e[_0x1499('0x1a')],'include':_0x29e89e[_0x1499('0x1c')]?_[_0x1499('0x1d')](_0x29e89e[_0x1499('0x1c')],function(_0x31251c){return{'model':db[_0x31251c[_0x1499('0x1e')]],'as':_0x31251c['as'],'attributes':_0x31251c[_0x1499('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x1499('0xc')](function(_0x12cf93){logger[_0x1499('0xd')](_0x1499('0x20'),_0x39995b);logger['debug']('ShowFreshsalesAccount',_0x39995b,JSON[_0x1499('0x11')](_0x12cf93));_0x2dae84(_0x12cf93);})['catch'](function(_0x29bb8f){logger['error'](_0x1499('0x20'),_0x29bb8f[_0x1499('0x13')],_0x39995b);_0x16466c(_0x5b59ea[_0x1499('0x12')](0x1f4,_0x29bb8f[_0x1499('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/index.js b/server/api/intFreshsalesConfiguration/index.js index 0e2f0ae..b9d3b29 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 _0x5d53=['show','/:id/subjects','getSubjects','getFields','post','create','put','update','delete','destroy','exports','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/:id'];(function(_0x5dc4f1,_0x52e7d3){var _0x2fa955=function(_0x33a5ca){while(--_0x33a5ca){_0x5dc4f1['push'](_0x5dc4f1['shift']());}};_0x2fa955(++_0x52e7d3);}(_0x5d53,0x1d9));var _0x35d5=function(_0x56562d,_0x578183){_0x56562d=_0x56562d-0x0;var _0xdafef9=_0x5d53[_0x56562d];return _0xdafef9;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x35d5('0x0'));var timeout=require(_0x35d5('0x1'));var express=require(_0x35d5('0x2'));var router=express[_0x35d5('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x35d5('0x4'));var interaction=require(_0x35d5('0x5'));var config=require(_0x35d5('0x6'));var controller=require('./intFreshsalesConfiguration.controller');router['get']('/',auth[_0x35d5('0x7')](),controller[_0x35d5('0x8')]);router[_0x35d5('0x9')](_0x35d5('0xa'),auth['isAuthenticated'](),controller[_0x35d5('0xb')]);router['get'](_0x35d5('0xc'),auth[_0x35d5('0x7')](),controller[_0x35d5('0xd')]);router['get']('/:id/descriptions',auth[_0x35d5('0x7')](),controller['getDescriptions']);router[_0x35d5('0x9')]('/:id/fields',auth[_0x35d5('0x7')](),controller[_0x35d5('0xe')]);router[_0x35d5('0xf')]('/',auth[_0x35d5('0x7')](),controller[_0x35d5('0x10')]);router[_0x35d5('0x11')](_0x35d5('0xa'),auth[_0x35d5('0x7')](),controller[_0x35d5('0x12')]);router[_0x35d5('0x13')](_0x35d5('0xa'),auth[_0x35d5('0x7')](),controller[_0x35d5('0x14')]);module[_0x35d5('0x15')]=router; \ No newline at end of file +var _0x08ac=['/:id/descriptions','getDescriptions','getFields','post','create','update','delete','destroy','exports','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/:id'];(function(_0x2d56b6,_0x31c8d7){var _0x5c2c67=function(_0x45f0f2){while(--_0x45f0f2){_0x2d56b6['push'](_0x2d56b6['shift']());}};_0x5c2c67(++_0x31c8d7);}(_0x08ac,0x1d5));var _0xc08a=function(_0x14fd3d,_0x5904b2){_0x14fd3d=_0x14fd3d-0x0;var _0x182c4d=_0x08ac[_0x14fd3d];return _0x182c4d;};'use strict';var multer=require(_0xc08a('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xc08a('0x1'));var express=require(_0xc08a('0x2'));var router=express[_0xc08a('0x3')]();var fs_extra=require(_0xc08a('0x4'));var auth=require(_0xc08a('0x5'));var interaction=require(_0xc08a('0x6'));var config=require('../../config/environment');var controller=require('./intFreshsalesConfiguration.controller');router[_0xc08a('0x7')]('/',auth[_0xc08a('0x8')](),controller[_0xc08a('0x9')]);router[_0xc08a('0x7')](_0xc08a('0xa'),auth[_0xc08a('0x8')](),controller['show']);router[_0xc08a('0x7')]('/:id/subjects',auth[_0xc08a('0x8')](),controller['getSubjects']);router[_0xc08a('0x7')](_0xc08a('0xb'),auth[_0xc08a('0x8')](),controller[_0xc08a('0xc')]);router['get']('/:id/fields',auth[_0xc08a('0x8')](),controller[_0xc08a('0xd')]);router[_0xc08a('0xe')]('/',auth[_0xc08a('0x8')](),controller[_0xc08a('0xf')]);router['put']('/:id',auth[_0xc08a('0x8')](),controller[_0xc08a('0x10')]);router[_0xc08a('0x11')](_0xc08a('0xa'),auth[_0xc08a('0x8')](),controller[_0xc08a('0x12')]);module[_0xc08a('0x13')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js index 85b5315..e9409a0 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 _0xaf56=['STRING','sequelize','exports'];(function(_0x41bb01,_0x1018de){var _0x59dc75=function(_0x405c38){while(--_0x405c38){_0x41bb01['push'](_0x41bb01['shift']());}};_0x59dc75(++_0x1018de);}(_0xaf56,0x1a8));var _0x6af5=function(_0x51b0dc,_0x5307b7){_0x51b0dc=_0x51b0dc-0x0;var _0x13fa89=_0xaf56[_0x51b0dc];return _0x13fa89;};'use strict';var Sequelize=require(_0x6af5('0x0'));module[_0x6af5('0x1')]={'name':{'type':Sequelize[_0x6af5('0x2')]},'description':{'type':Sequelize[_0x6af5('0x2')]}}; \ No newline at end of file +var _0x8912=['STRING','exports'];(function(_0x5793a8,_0x1a6d12){var _0x2b58f5=function(_0x5b8b75){while(--_0x5b8b75){_0x5793a8['push'](_0x5793a8['shift']());}};_0x2b58f5(++_0x1a6d12);}(_0x8912,0xc3));var _0x2891=function(_0x396a32,_0x1197dc){_0x396a32=_0x396a32-0x0;var _0x200557=_0x8912[_0x396a32];return _0x200557;};'use strict';var Sequelize=require('sequelize');module[_0x2891('0x0')]={'name':{'type':Sequelize[_0x2891('0x1')]},'description':{'type':Sequelize[_0x2891('0x1')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js index 927a332..9c8e3bf 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 _0x12f5=['include','findAll','rows','show','find','catch','create','body','params','getSubjects','findOne','FreshsalesField','getDescriptions','getFields','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','save','update','then','destroy','error','stack','name','index','map','FreshsalesConfiguration','rawAttributes','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','type','VIRTUAL','options','includeAll'];(function(_0x1b0a6e,_0x5c4262){var _0x18fd42=function(_0xf8f3a){while(--_0xf8f3a){_0x1b0a6e['push'](_0x1b0a6e['shift']());}};_0x18fd42(++_0x5c4262);}(_0x12f5,0xb6));var _0x512f=function(_0x5f09c5,_0x2bfca0){_0x5f09c5=_0x5f09c5-0x0;var _0x426ad9=_0x12f5[_0x5f09c5];return _0x426ad9;};'use strict';var emlformat=require(_0x512f('0x0'));var rimraf=require(_0x512f('0x1'));var zipdir=require(_0x512f('0x2'));var jsonpatch=require(_0x512f('0x3'));var rp=require(_0x512f('0x4'));var moment=require(_0x512f('0x5'));var BPromise=require(_0x512f('0x6'));var Mustache=require('mustache');var util=require(_0x512f('0x7'));var path=require(_0x512f('0x8'));var sox=require(_0x512f('0x9'));var csv=require(_0x512f('0xa'));var ejs=require(_0x512f('0xb'));var fs=require('fs');var fs_extra=require(_0x512f('0xc'));var _=require(_0x512f('0xd'));var squel=require('squel');var crypto=require(_0x512f('0xe'));var jsforce=require(_0x512f('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x512f('0xa'));var querystring=require(_0x512f('0x10'));var Papa=require(_0x512f('0x11'));var Redis=require(_0x512f('0x12'));var authService=require(_0x512f('0x13'));var qs=require(_0x512f('0x14'));var as=require(_0x512f('0x15'));var hardwareService=require(_0x512f('0x16'));var logger=require(_0x512f('0x17'))(_0x512f('0x18'));var utils=require(_0x512f('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0x512f('0x1a'));var db=require(_0x512f('0x1b'))['db'];function respondWithStatusCode(_0x4b8091,_0x358442){_0x358442=_0x358442||0xcc;return function(_0x55c3d9){if(_0x55c3d9){return _0x4b8091[_0x512f('0x1c')](_0x358442);}return _0x4b8091[_0x512f('0x1d')](_0x358442)[_0x512f('0x1e')]();};}function respondWithResult(_0x332293,_0x3debad){_0x3debad=_0x3debad||0xc8;return function(_0x970e63){if(_0x970e63){return _0x332293[_0x512f('0x1d')](_0x3debad)[_0x512f('0x1f')](_0x970e63);}};}function respondWithFilteredResult(_0x3061bb,_0x4e357a){return function(_0x54e287){if(_0x54e287){var _0x587316=typeof _0x4e357a[_0x512f('0x20')]==='undefined'&&typeof _0x4e357a[_0x512f('0x21')]===_0x512f('0x22');var _0x3631cd=_0x54e287['count'];var _0x524766=_0x587316?0x0:_0x4e357a[_0x512f('0x20')];var _0x40f8ff=_0x587316?_0x54e287[_0x512f('0x23')]:_0x4e357a[_0x512f('0x20')]+_0x4e357a['limit'];var _0x2ee4e6;if(_0x40f8ff>=_0x3631cd){_0x40f8ff=_0x3631cd;_0x2ee4e6=0xc8;}else{_0x2ee4e6=0xce;}_0x3061bb[_0x512f('0x1d')](_0x2ee4e6);return _0x3061bb[_0x512f('0x24')](_0x512f('0x25'),_0x524766+'-'+_0x40f8ff+'/'+_0x3631cd)[_0x512f('0x1f')](_0x54e287);}return null;};}function patchUpdates(_0x137ee8){return function(_0x1c1da5){try{jsonpatch['apply'](_0x1c1da5,_0x137ee8,!![]);}catch(_0x57ab78){return BPromise['reject'](_0x57ab78);}return _0x1c1da5[_0x512f('0x26')]();};}function saveUpdates(_0x34f28d,_0x478daf){return function(_0x49c967){if(_0x49c967){return _0x49c967[_0x512f('0x27')](_0x34f28d)[_0x512f('0x28')](function(_0x18f2a3){return _0x18f2a3;});}return null;};}function removeEntity(_0x141301,_0xa2b57b){return function(_0x13ddba){if(_0x13ddba){return _0x13ddba[_0x512f('0x29')]()[_0x512f('0x28')](function(){_0x141301['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x30474e,_0x54a28d){return function(_0x46358f){if(!_0x46358f){_0x30474e['sendStatus'](0x194);}return _0x46358f;};}function handleError(_0x264ac2,_0x3940b3){_0x3940b3=_0x3940b3||0x1f4;return function(_0xfec5d1){logger[_0x512f('0x2a')](_0xfec5d1[_0x512f('0x2b')]);if(_0xfec5d1[_0x512f('0x2c')]){delete _0xfec5d1[_0x512f('0x2c')];}_0x264ac2[_0x512f('0x1d')](_0x3940b3)['send'](_0xfec5d1);};}exports[_0x512f('0x2d')]=function(_0x538767,_0x384c76){var _0x4119c1={},_0x53f0c2={},_0x13d3c9={'count':0x0,'rows':[]};var _0x197998=_[_0x512f('0x2e')](db[_0x512f('0x2f')][_0x512f('0x30')],function(_0x22243d){return{'name':_0x22243d['fieldName'],'type':_0x22243d['type'][_0x512f('0x31')]};});_0x53f0c2['model']=_['map'](_0x197998,_0x512f('0x2c'));_0x53f0c2[_0x512f('0x32')]=_[_0x512f('0x33')](_0x538767[_0x512f('0x32')]);_0x53f0c2[_0x512f('0x34')]=_[_0x512f('0x35')](_0x53f0c2[_0x512f('0x36')],_0x53f0c2['query']);_0x4119c1[_0x512f('0x37')]=_[_0x512f('0x35')](_0x53f0c2[_0x512f('0x36')],qs[_0x512f('0x38')](_0x538767[_0x512f('0x32')]['fields']));_0x4119c1[_0x512f('0x37')]=_0x4119c1[_0x512f('0x37')][_0x512f('0x39')]?_0x4119c1[_0x512f('0x37')]:_0x53f0c2[_0x512f('0x36')];if(!_0x538767[_0x512f('0x32')][_0x512f('0x3a')](_0x512f('0x3b'))){_0x4119c1[_0x512f('0x21')]=qs[_0x512f('0x21')](_0x538767[_0x512f('0x32')][_0x512f('0x21')]);_0x4119c1[_0x512f('0x20')]=qs['offset'](_0x538767[_0x512f('0x32')][_0x512f('0x20')]);}_0x4119c1[_0x512f('0x3c')]=qs['sort'](_0x538767[_0x512f('0x32')][_0x512f('0x3d')]);_0x4119c1['where']=qs[_0x512f('0x34')](_[_0x512f('0x3e')](_0x538767[_0x512f('0x32')],_0x53f0c2['filters']),_0x197998);if(_0x538767[_0x512f('0x32')][_0x512f('0x3f')]){_0x4119c1[_0x512f('0x40')]=_[_0x512f('0x41')](_0x4119c1[_0x512f('0x40')],{'$or':_['map'](_0x197998,function(_0x33852f){if(_0x33852f[_0x512f('0x42')]!==_0x512f('0x43')){var _0x150508={};_0x150508[_0x33852f[_0x512f('0x2c')]]={'$like':'%'+_0x538767[_0x512f('0x32')][_0x512f('0x3f')]+'%'};return _0x150508;}})});}_0x4119c1=_[_0x512f('0x41')]({},_0x4119c1,_0x538767[_0x512f('0x44')]);var _0x55e94e={'where':_0x4119c1['where']};return db['FreshsalesConfiguration']['count'](_0x55e94e)[_0x512f('0x28')](function(_0x63b401){_0x13d3c9['count']=_0x63b401;if(_0x538767[_0x512f('0x32')][_0x512f('0x45')]){_0x4119c1[_0x512f('0x46')]=[{'all':!![]}];}return db['FreshsalesConfiguration'][_0x512f('0x47')](_0x4119c1);})[_0x512f('0x28')](function(_0x561754){_0x13d3c9[_0x512f('0x48')]=_0x561754;return _0x13d3c9;})[_0x512f('0x28')](respondWithFilteredResult(_0x384c76,_0x4119c1))['catch'](handleError(_0x384c76,null));};exports[_0x512f('0x49')]=function(_0x43ff58,_0x18720c){var _0x5ca1a5={'raw':![],'where':{'id':_0x43ff58['params']['id']}},_0xdcaa1c={};_0xdcaa1c[_0x512f('0x36')]=_[_0x512f('0x33')](db[_0x512f('0x2f')][_0x512f('0x30')]);_0xdcaa1c[_0x512f('0x32')]=_[_0x512f('0x33')](_0x43ff58['query']);_0xdcaa1c[_0x512f('0x34')]=_['intersection'](_0xdcaa1c[_0x512f('0x36')],_0xdcaa1c[_0x512f('0x32')]);_0x5ca1a5[_0x512f('0x37')]=_[_0x512f('0x35')](_0xdcaa1c[_0x512f('0x36')],qs[_0x512f('0x38')](_0x43ff58['query']['fields']));_0x5ca1a5[_0x512f('0x37')]=_0x5ca1a5[_0x512f('0x37')][_0x512f('0x39')]?_0x5ca1a5['attributes']:_0xdcaa1c[_0x512f('0x36')];if(_0x43ff58[_0x512f('0x32')][_0x512f('0x45')]){_0x5ca1a5[_0x512f('0x46')]=[{'all':!![]}];}_0x5ca1a5=_[_0x512f('0x41')]({},_0x5ca1a5,_0x43ff58[_0x512f('0x44')]);return db[_0x512f('0x2f')][_0x512f('0x4a')](_0x5ca1a5)[_0x512f('0x28')](handleEntityNotFound(_0x18720c,null))[_0x512f('0x28')](respondWithResult(_0x18720c,null))[_0x512f('0x4b')](handleError(_0x18720c,null));};exports[_0x512f('0x4c')]=function(_0x125c50,_0x428cfa){return db[_0x512f('0x2f')][_0x512f('0x4c')](_0x125c50[_0x512f('0x4d')],{})[_0x512f('0x28')](respondWithResult(_0x428cfa,0xc9))[_0x512f('0x4b')](handleError(_0x428cfa,null));};exports['update']=function(_0x7a0dd8,_0x170bf7){if(_0x7a0dd8['body']['id']){delete _0x7a0dd8[_0x512f('0x4d')]['id'];}return db[_0x512f('0x2f')][_0x512f('0x4a')]({'where':{'id':_0x7a0dd8[_0x512f('0x4e')]['id']}})['then'](handleEntityNotFound(_0x170bf7,null))['then'](saveUpdates(_0x7a0dd8[_0x512f('0x4d')],null))[_0x512f('0x28')](respondWithResult(_0x170bf7,null))[_0x512f('0x4b')](handleError(_0x170bf7,null));};exports[_0x512f('0x29')]=function(_0x51485a,_0x1a4d11){return db[_0x512f('0x2f')][_0x512f('0x4a')]({'where':{'id':_0x51485a[_0x512f('0x4e')]['id']}})[_0x512f('0x28')](handleEntityNotFound(_0x1a4d11,null))[_0x512f('0x28')](removeEntity(_0x1a4d11,null))[_0x512f('0x4b')](handleError(_0x1a4d11,null));};exports[_0x512f('0x4f')]=function(_0xb1c4ec,_0x1d5655,_0x59fd1e){var _0x5d8fab={};var _0x554a5d={};var _0x48591c;var _0x17016b;return db['FreshsalesConfiguration'][_0x512f('0x50')]({'where':{'id':_0xb1c4ec[_0x512f('0x4e')]['id']}})['then'](handleEntityNotFound(_0x1d5655,null))[_0x512f('0x28')](function(_0x318f2d){if(_0x318f2d){_0x48591c=_0x318f2d;_0x554a5d[_0x512f('0x36')]=_[_0x512f('0x33')](db[_0x512f('0x51')][_0x512f('0x30')]);_0x554a5d[_0x512f('0x32')]=_[_0x512f('0x33')](_0xb1c4ec[_0x512f('0x32')]);_0x554a5d[_0x512f('0x34')]=_[_0x512f('0x35')](_0x554a5d['model'],_0x554a5d[_0x512f('0x32')]);_0x5d8fab[_0x512f('0x37')]=_['intersection'](_0x554a5d[_0x512f('0x36')],qs[_0x512f('0x38')](_0xb1c4ec[_0x512f('0x32')][_0x512f('0x38')]));_0x5d8fab[_0x512f('0x37')]=_0x5d8fab[_0x512f('0x37')][_0x512f('0x39')]?_0x5d8fab[_0x512f('0x37')]:_0x554a5d[_0x512f('0x36')];_0x5d8fab[_0x512f('0x3c')]=qs[_0x512f('0x3d')](_0xb1c4ec[_0x512f('0x32')][_0x512f('0x3d')]);_0x5d8fab['where']=qs['filters'](_[_0x512f('0x3e')](_0xb1c4ec[_0x512f('0x32')],_0x554a5d['filters']));if(_0xb1c4ec['query'][_0x512f('0x3f')]){_0x5d8fab[_0x512f('0x40')]=_[_0x512f('0x41')](_0x5d8fab['where'],{'$or':_[_0x512f('0x2e')](_0x5d8fab[_0x512f('0x37')],function(_0x43001c){var _0x2ea01c={};_0x2ea01c[_0x43001c]={'$like':'%'+_0xb1c4ec[_0x512f('0x32')][_0x512f('0x3f')]+'%'};return _0x2ea01c;})});}_0x5d8fab=_[_0x512f('0x41')]({},_0x5d8fab,_0xb1c4ec[_0x512f('0x44')]);return _0x48591c[_0x512f('0x4f')](_0x5d8fab);}})['then'](function(_0x1c5b68){if(_0x1c5b68){_0x17016b=_0x1c5b68[_0x512f('0x39')];if(!_0xb1c4ec[_0x512f('0x32')][_0x512f('0x3a')]('nolimit')){_0x5d8fab['limit']=qs[_0x512f('0x21')](_0xb1c4ec[_0x512f('0x32')]['limit']);_0x5d8fab[_0x512f('0x20')]=qs[_0x512f('0x20')](_0xb1c4ec[_0x512f('0x32')][_0x512f('0x20')]);}return _0x48591c[_0x512f('0x4f')](_0x5d8fab);}})[_0x512f('0x28')](function(_0x5ee732){if(_0x5ee732){return _0x5ee732?{'count':_0x17016b,'rows':_0x5ee732}:null;}})['then'](respondWithResult(_0x1d5655,null))[_0x512f('0x4b')](handleError(_0x1d5655,null));};exports['getDescriptions']=function(_0x599708,_0x2fff0c,_0x4be8e2){var _0x2daa6a={};var _0x463b93={};var _0x453511;var _0x5eddea;return db[_0x512f('0x2f')][_0x512f('0x50')]({'where':{'id':_0x599708[_0x512f('0x4e')]['id']}})[_0x512f('0x28')](handleEntityNotFound(_0x2fff0c,null))[_0x512f('0x28')](function(_0x805271){if(_0x805271){_0x453511=_0x805271;_0x463b93[_0x512f('0x36')]=_['keys'](db[_0x512f('0x51')]['rawAttributes']);_0x463b93[_0x512f('0x32')]=_['keys'](_0x599708['query']);_0x463b93[_0x512f('0x34')]=_[_0x512f('0x35')](_0x463b93['model'],_0x463b93[_0x512f('0x32')]);_0x2daa6a[_0x512f('0x37')]=_[_0x512f('0x35')](_0x463b93[_0x512f('0x36')],qs[_0x512f('0x38')](_0x599708[_0x512f('0x32')]['fields']));_0x2daa6a[_0x512f('0x37')]=_0x2daa6a['attributes'][_0x512f('0x39')]?_0x2daa6a[_0x512f('0x37')]:_0x463b93[_0x512f('0x36')];_0x2daa6a[_0x512f('0x3c')]=qs[_0x512f('0x3d')](_0x599708['query'][_0x512f('0x3d')]);_0x2daa6a[_0x512f('0x40')]=qs[_0x512f('0x34')](_[_0x512f('0x3e')](_0x599708[_0x512f('0x32')],_0x463b93['filters']));if(_0x599708['query'][_0x512f('0x3f')]){_0x2daa6a[_0x512f('0x40')]=_[_0x512f('0x41')](_0x2daa6a[_0x512f('0x40')],{'$or':_[_0x512f('0x2e')](_0x2daa6a[_0x512f('0x37')],function(_0x208326){var _0x34cd13={};_0x34cd13[_0x208326]={'$like':'%'+_0x599708[_0x512f('0x32')][_0x512f('0x3f')]+'%'};return _0x34cd13;})});}_0x2daa6a=_[_0x512f('0x41')]({},_0x2daa6a,_0x599708['options']);return _0x453511[_0x512f('0x52')](_0x2daa6a);}})[_0x512f('0x28')](function(_0x9e1ec1){if(_0x9e1ec1){_0x5eddea=_0x9e1ec1[_0x512f('0x39')];if(!_0x599708[_0x512f('0x32')][_0x512f('0x3a')](_0x512f('0x3b'))){_0x2daa6a[_0x512f('0x21')]=qs['limit'](_0x599708[_0x512f('0x32')][_0x512f('0x21')]);_0x2daa6a[_0x512f('0x20')]=qs[_0x512f('0x20')](_0x599708[_0x512f('0x32')][_0x512f('0x20')]);}return _0x453511[_0x512f('0x52')](_0x2daa6a);}})[_0x512f('0x28')](function(_0x114f23){if(_0x114f23){return _0x114f23?{'count':_0x5eddea,'rows':_0x114f23}:null;}})[_0x512f('0x28')](respondWithResult(_0x2fff0c,null))[_0x512f('0x4b')](handleError(_0x2fff0c,null));};exports[_0x512f('0x53')]=function(_0x5f46a7,_0x7a1cbc,_0x52f3ee){var _0x476aad={};var _0x2d16eb={};var _0x11127d;var _0x59e438;return db[_0x512f('0x2f')][_0x512f('0x50')]({'where':{'id':_0x5f46a7['params']['id']}})[_0x512f('0x28')](handleEntityNotFound(_0x7a1cbc,null))['then'](function(_0x67026b){if(_0x67026b){_0x11127d=_0x67026b;_0x2d16eb[_0x512f('0x36')]=_[_0x512f('0x33')](db[_0x512f('0x51')][_0x512f('0x30')]);_0x2d16eb[_0x512f('0x32')]=_[_0x512f('0x33')](_0x5f46a7[_0x512f('0x32')]);_0x2d16eb[_0x512f('0x34')]=_[_0x512f('0x35')](_0x2d16eb[_0x512f('0x36')],_0x2d16eb[_0x512f('0x32')]);_0x476aad[_0x512f('0x37')]=_[_0x512f('0x35')](_0x2d16eb[_0x512f('0x36')],qs[_0x512f('0x38')](_0x5f46a7['query'][_0x512f('0x38')]));_0x476aad['attributes']=_0x476aad[_0x512f('0x37')][_0x512f('0x39')]?_0x476aad['attributes']:_0x2d16eb[_0x512f('0x36')];_0x476aad['order']=qs[_0x512f('0x3d')](_0x5f46a7['query']['sort']);_0x476aad[_0x512f('0x40')]=qs[_0x512f('0x34')](_['pick'](_0x5f46a7['query'],_0x2d16eb[_0x512f('0x34')]));if(_0x5f46a7['query'][_0x512f('0x3f')]){_0x476aad[_0x512f('0x40')]=_[_0x512f('0x41')](_0x476aad[_0x512f('0x40')],{'$or':_[_0x512f('0x2e')](_0x476aad['attributes'],function(_0xa4dac3){var _0xb0a1a7={};_0xb0a1a7[_0xa4dac3]={'$like':'%'+_0x5f46a7[_0x512f('0x32')]['filter']+'%'};return _0xb0a1a7;})});}_0x476aad=_[_0x512f('0x41')]({},_0x476aad,_0x5f46a7['options']);return _0x11127d[_0x512f('0x53')](_0x476aad);}})[_0x512f('0x28')](function(_0x4c5ea1){if(_0x4c5ea1){_0x59e438=_0x4c5ea1['length'];if(!_0x5f46a7[_0x512f('0x32')]['hasOwnProperty']('nolimit')){_0x476aad[_0x512f('0x21')]=qs[_0x512f('0x21')](_0x5f46a7[_0x512f('0x32')][_0x512f('0x21')]);_0x476aad[_0x512f('0x20')]=qs['offset'](_0x5f46a7[_0x512f('0x32')][_0x512f('0x20')]);}return _0x11127d[_0x512f('0x53')](_0x476aad);}})['then'](function(_0x335d04){if(_0x335d04){return _0x335d04?{'count':_0x59e438,'rows':_0x335d04}:null;}})[_0x512f('0x28')](respondWithResult(_0x7a1cbc,null))[_0x512f('0x4b')](handleError(_0x7a1cbc,null));}; \ No newline at end of file +var _0x5358=['../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','error','stack','name','send','index','map','FreshsalesConfiguration','fieldName','type','key','model','query','intersection','fields','attributes','length','nolimit','offset','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','keys','rawAttributes','find','create','body','getSubjects','findOne','FreshsalesField','hasOwnProperty','getDescriptions','getFields','eml-format','rimraf','zip-dir','moment','bluebird','mustache','sox','ejs','fs-extra','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware'];(function(_0xb4ce16,_0x2bd30c){var _0x14055c=function(_0x16909e){while(--_0x16909e){_0xb4ce16['push'](_0xb4ce16['shift']());}};_0x14055c(++_0x2bd30c);}(_0x5358,0x18b));var _0x8535=function(_0x58769b,_0x1b5fb8){_0x58769b=_0x58769b-0x0;var _0x2e3894=_0x5358[_0x58769b];return _0x2e3894;};'use strict';var emlformat=require(_0x8535('0x0'));var rimraf=require(_0x8535('0x1'));var zipdir=require(_0x8535('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x8535('0x3'));var BPromise=require(_0x8535('0x4'));var Mustache=require(_0x8535('0x5'));var util=require('util');var path=require('path');var sox=require(_0x8535('0x6'));var csv=require('to-csv');var ejs=require(_0x8535('0x7'));var fs=require('fs');var fs_extra=require(_0x8535('0x8'));var _=require(_0x8535('0x9'));var squel=require(_0x8535('0xa'));var crypto=require('crypto');var jsforce=require(_0x8535('0xb'));var deskjs=require(_0x8535('0xc'));var toCsv=require(_0x8535('0xd'));var querystring=require(_0x8535('0xe'));var Papa=require(_0x8535('0xf'));var Redis=require(_0x8535('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x8535('0x11'));var as=require(_0x8535('0x12'));var hardwareService=require(_0x8535('0x13'));var logger=require(_0x8535('0x14'))(_0x8535('0x15'));var utils=require('../../config/utils');var config=require(_0x8535('0x16'));var licenseUtil=require(_0x8535('0x17'));var db=require(_0x8535('0x18'))['db'];function respondWithStatusCode(_0x548f16,_0x1da003){_0x1da003=_0x1da003||0xcc;return function(_0x3319cd){if(_0x3319cd){return _0x548f16[_0x8535('0x19')](_0x1da003);}return _0x548f16[_0x8535('0x1a')](_0x1da003)['end']();};}function respondWithResult(_0x3e40b3,_0x9c3fb1){_0x9c3fb1=_0x9c3fb1||0xc8;return function(_0x59769e){if(_0x59769e){return _0x3e40b3[_0x8535('0x1a')](_0x9c3fb1)[_0x8535('0x1b')](_0x59769e);}};}function respondWithFilteredResult(_0x343bac,_0x27dd42){return function(_0x178a6d){if(_0x178a6d){var _0x2d3ad4=typeof _0x27dd42['offset']===_0x8535('0x1c')&&typeof _0x27dd42[_0x8535('0x1d')]===_0x8535('0x1c');var _0x7d7fd6=_0x178a6d[_0x8535('0x1e')];var _0x5cdf8a=_0x2d3ad4?0x0:_0x27dd42['offset'];var _0x3306cd=_0x2d3ad4?_0x178a6d[_0x8535('0x1e')]:_0x27dd42['offset']+_0x27dd42['limit'];var _0x11f909;if(_0x3306cd>=_0x7d7fd6){_0x3306cd=_0x7d7fd6;_0x11f909=0xc8;}else{_0x11f909=0xce;}_0x343bac[_0x8535('0x1a')](_0x11f909);return _0x343bac[_0x8535('0x1f')](_0x8535('0x20'),_0x5cdf8a+'-'+_0x3306cd+'/'+_0x7d7fd6)['json'](_0x178a6d);}return null;};}function patchUpdates(_0x2d9ce6){return function(_0x245f68){try{jsonpatch[_0x8535('0x21')](_0x245f68,_0x2d9ce6,!![]);}catch(_0x1ab9a2){return BPromise[_0x8535('0x22')](_0x1ab9a2);}return _0x245f68['save']();};}function saveUpdates(_0x46f9b3,_0x3dae4b){return function(_0x5b3d24){if(_0x5b3d24){return _0x5b3d24[_0x8535('0x23')](_0x46f9b3)[_0x8535('0x24')](function(_0x62a768){return _0x62a768;});}return null;};}function removeEntity(_0x2d9b71,_0x17a070){return function(_0x3032bf){if(_0x3032bf){return _0x3032bf[_0x8535('0x25')]()[_0x8535('0x24')](function(){_0x2d9b71['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x5a484f,_0x7c2819){return function(_0x106839){if(!_0x106839){_0x5a484f[_0x8535('0x19')](0x194);}return _0x106839;};}function handleError(_0xa6435c,_0x43c358){_0x43c358=_0x43c358||0x1f4;return function(_0xe21889){logger[_0x8535('0x26')](_0xe21889[_0x8535('0x27')]);if(_0xe21889[_0x8535('0x28')]){delete _0xe21889[_0x8535('0x28')];}_0xa6435c[_0x8535('0x1a')](_0x43c358)[_0x8535('0x29')](_0xe21889);};}exports[_0x8535('0x2a')]=function(_0x5f4281,_0xe7cbd8){var _0x3f46d8={},_0x2ba3d8={},_0x42302e={'count':0x0,'rows':[]};var _0x4fa589=_[_0x8535('0x2b')](db[_0x8535('0x2c')]['rawAttributes'],function(_0x4d0c7a){return{'name':_0x4d0c7a[_0x8535('0x2d')],'type':_0x4d0c7a[_0x8535('0x2e')][_0x8535('0x2f')]};});_0x2ba3d8[_0x8535('0x30')]=_[_0x8535('0x2b')](_0x4fa589,_0x8535('0x28'));_0x2ba3d8['query']=_['keys'](_0x5f4281[_0x8535('0x31')]);_0x2ba3d8['filters']=_[_0x8535('0x32')](_0x2ba3d8['model'],_0x2ba3d8[_0x8535('0x31')]);_0x3f46d8['attributes']=_['intersection'](_0x2ba3d8[_0x8535('0x30')],qs[_0x8535('0x33')](_0x5f4281['query'][_0x8535('0x33')]));_0x3f46d8['attributes']=_0x3f46d8[_0x8535('0x34')][_0x8535('0x35')]?_0x3f46d8[_0x8535('0x34')]:_0x2ba3d8[_0x8535('0x30')];if(!_0x5f4281[_0x8535('0x31')]['hasOwnProperty'](_0x8535('0x36'))){_0x3f46d8['limit']=qs['limit'](_0x5f4281[_0x8535('0x31')][_0x8535('0x1d')]);_0x3f46d8[_0x8535('0x37')]=qs[_0x8535('0x37')](_0x5f4281[_0x8535('0x31')]['offset']);}_0x3f46d8[_0x8535('0x38')]=qs[_0x8535('0x39')](_0x5f4281['query'][_0x8535('0x39')]);_0x3f46d8[_0x8535('0x3a')]=qs[_0x8535('0x3b')](_[_0x8535('0x3c')](_0x5f4281[_0x8535('0x31')],_0x2ba3d8[_0x8535('0x3b')]),_0x4fa589);if(_0x5f4281['query'][_0x8535('0x3d')]){_0x3f46d8['where']=_[_0x8535('0x3e')](_0x3f46d8[_0x8535('0x3a')],{'$or':_[_0x8535('0x2b')](_0x4fa589,function(_0x374a78){if(_0x374a78[_0x8535('0x2e')]!==_0x8535('0x3f')){var _0x42f7b0={};_0x42f7b0[_0x374a78[_0x8535('0x28')]]={'$like':'%'+_0x5f4281[_0x8535('0x31')]['filter']+'%'};return _0x42f7b0;}})});}_0x3f46d8=_[_0x8535('0x3e')]({},_0x3f46d8,_0x5f4281[_0x8535('0x40')]);var _0x244997={'where':_0x3f46d8[_0x8535('0x3a')]};return db['FreshsalesConfiguration'][_0x8535('0x1e')](_0x244997)[_0x8535('0x24')](function(_0x2bd61b){_0x42302e[_0x8535('0x1e')]=_0x2bd61b;if(_0x5f4281[_0x8535('0x31')][_0x8535('0x41')]){_0x3f46d8[_0x8535('0x42')]=[{'all':!![]}];}return db['FreshsalesConfiguration'][_0x8535('0x43')](_0x3f46d8);})[_0x8535('0x24')](function(_0x417362){_0x42302e[_0x8535('0x44')]=_0x417362;return _0x42302e;})[_0x8535('0x24')](respondWithFilteredResult(_0xe7cbd8,_0x3f46d8))[_0x8535('0x45')](handleError(_0xe7cbd8,null));};exports[_0x8535('0x46')]=function(_0x5714dd,_0x20dad7){var _0x3545b5={'raw':![],'where':{'id':_0x5714dd[_0x8535('0x47')]['id']}},_0x5cf304={};_0x5cf304[_0x8535('0x30')]=_[_0x8535('0x48')](db[_0x8535('0x2c')][_0x8535('0x49')]);_0x5cf304['query']=_[_0x8535('0x48')](_0x5714dd['query']);_0x5cf304['filters']=_[_0x8535('0x32')](_0x5cf304[_0x8535('0x30')],_0x5cf304[_0x8535('0x31')]);_0x3545b5[_0x8535('0x34')]=_[_0x8535('0x32')](_0x5cf304[_0x8535('0x30')],qs[_0x8535('0x33')](_0x5714dd[_0x8535('0x31')][_0x8535('0x33')]));_0x3545b5[_0x8535('0x34')]=_0x3545b5[_0x8535('0x34')][_0x8535('0x35')]?_0x3545b5[_0x8535('0x34')]:_0x5cf304[_0x8535('0x30')];if(_0x5714dd[_0x8535('0x31')]['includeAll']){_0x3545b5[_0x8535('0x42')]=[{'all':!![]}];}_0x3545b5=_['merge']({},_0x3545b5,_0x5714dd['options']);return db['FreshsalesConfiguration'][_0x8535('0x4a')](_0x3545b5)['then'](handleEntityNotFound(_0x20dad7,null))['then'](respondWithResult(_0x20dad7,null))['catch'](handleError(_0x20dad7,null));};exports[_0x8535('0x4b')]=function(_0x5458c3,_0x2a1449){return db[_0x8535('0x2c')][_0x8535('0x4b')](_0x5458c3['body'],{})[_0x8535('0x24')](respondWithResult(_0x2a1449,0xc9))['catch'](handleError(_0x2a1449,null));};exports[_0x8535('0x23')]=function(_0x213abf,_0x572c72){if(_0x213abf[_0x8535('0x4c')]['id']){delete _0x213abf[_0x8535('0x4c')]['id'];}return db[_0x8535('0x2c')][_0x8535('0x4a')]({'where':{'id':_0x213abf[_0x8535('0x47')]['id']}})[_0x8535('0x24')](handleEntityNotFound(_0x572c72,null))[_0x8535('0x24')](saveUpdates(_0x213abf[_0x8535('0x4c')],null))[_0x8535('0x24')](respondWithResult(_0x572c72,null))[_0x8535('0x45')](handleError(_0x572c72,null));};exports[_0x8535('0x25')]=function(_0x25ced3,_0x4848a7){return db[_0x8535('0x2c')][_0x8535('0x4a')]({'where':{'id':_0x25ced3[_0x8535('0x47')]['id']}})['then'](handleEntityNotFound(_0x4848a7,null))[_0x8535('0x24')](removeEntity(_0x4848a7,null))[_0x8535('0x45')](handleError(_0x4848a7,null));};exports[_0x8535('0x4d')]=function(_0x36cc77,_0x33bb51,_0x1c665f){var _0xcb198={};var _0x1d7ec1={};var _0x351ab0;var _0x347302;return db['FreshsalesConfiguration'][_0x8535('0x4e')]({'where':{'id':_0x36cc77[_0x8535('0x47')]['id']}})[_0x8535('0x24')](handleEntityNotFound(_0x33bb51,null))[_0x8535('0x24')](function(_0x244534){if(_0x244534){_0x351ab0=_0x244534;_0x1d7ec1['model']=_[_0x8535('0x48')](db[_0x8535('0x4f')][_0x8535('0x49')]);_0x1d7ec1['query']=_[_0x8535('0x48')](_0x36cc77['query']);_0x1d7ec1[_0x8535('0x3b')]=_[_0x8535('0x32')](_0x1d7ec1['model'],_0x1d7ec1['query']);_0xcb198[_0x8535('0x34')]=_[_0x8535('0x32')](_0x1d7ec1[_0x8535('0x30')],qs[_0x8535('0x33')](_0x36cc77[_0x8535('0x31')][_0x8535('0x33')]));_0xcb198[_0x8535('0x34')]=_0xcb198[_0x8535('0x34')][_0x8535('0x35')]?_0xcb198[_0x8535('0x34')]:_0x1d7ec1[_0x8535('0x30')];_0xcb198['order']=qs[_0x8535('0x39')](_0x36cc77['query'][_0x8535('0x39')]);_0xcb198[_0x8535('0x3a')]=qs[_0x8535('0x3b')](_[_0x8535('0x3c')](_0x36cc77[_0x8535('0x31')],_0x1d7ec1[_0x8535('0x3b')]));if(_0x36cc77[_0x8535('0x31')][_0x8535('0x3d')]){_0xcb198[_0x8535('0x3a')]=_[_0x8535('0x3e')](_0xcb198['where'],{'$or':_[_0x8535('0x2b')](_0xcb198[_0x8535('0x34')],function(_0x4df127){var _0x550e36={};_0x550e36[_0x4df127]={'$like':'%'+_0x36cc77[_0x8535('0x31')][_0x8535('0x3d')]+'%'};return _0x550e36;})});}_0xcb198=_[_0x8535('0x3e')]({},_0xcb198,_0x36cc77[_0x8535('0x40')]);return _0x351ab0[_0x8535('0x4d')](_0xcb198);}})['then'](function(_0x5cf46b){if(_0x5cf46b){_0x347302=_0x5cf46b['length'];if(!_0x36cc77[_0x8535('0x31')][_0x8535('0x50')](_0x8535('0x36'))){_0xcb198[_0x8535('0x1d')]=qs[_0x8535('0x1d')](_0x36cc77[_0x8535('0x31')][_0x8535('0x1d')]);_0xcb198[_0x8535('0x37')]=qs[_0x8535('0x37')](_0x36cc77['query'][_0x8535('0x37')]);}return _0x351ab0[_0x8535('0x4d')](_0xcb198);}})[_0x8535('0x24')](function(_0x36ff9f){if(_0x36ff9f){return _0x36ff9f?{'count':_0x347302,'rows':_0x36ff9f}:null;}})[_0x8535('0x24')](respondWithResult(_0x33bb51,null))['catch'](handleError(_0x33bb51,null));};exports[_0x8535('0x51')]=function(_0x3f16fb,_0x1f4d27,_0x1fae06){var _0x1dd51e={};var _0x3ffdf7={};var _0x50e94e;var _0x2191fd;return db[_0x8535('0x2c')]['findOne']({'where':{'id':_0x3f16fb[_0x8535('0x47')]['id']}})[_0x8535('0x24')](handleEntityNotFound(_0x1f4d27,null))[_0x8535('0x24')](function(_0x14389f){if(_0x14389f){_0x50e94e=_0x14389f;_0x3ffdf7[_0x8535('0x30')]=_[_0x8535('0x48')](db[_0x8535('0x4f')]['rawAttributes']);_0x3ffdf7[_0x8535('0x31')]=_[_0x8535('0x48')](_0x3f16fb['query']);_0x3ffdf7[_0x8535('0x3b')]=_[_0x8535('0x32')](_0x3ffdf7[_0x8535('0x30')],_0x3ffdf7[_0x8535('0x31')]);_0x1dd51e['attributes']=_[_0x8535('0x32')](_0x3ffdf7[_0x8535('0x30')],qs['fields'](_0x3f16fb[_0x8535('0x31')]['fields']));_0x1dd51e['attributes']=_0x1dd51e[_0x8535('0x34')][_0x8535('0x35')]?_0x1dd51e[_0x8535('0x34')]:_0x3ffdf7['model'];_0x1dd51e['order']=qs['sort'](_0x3f16fb['query']['sort']);_0x1dd51e[_0x8535('0x3a')]=qs[_0x8535('0x3b')](_['pick'](_0x3f16fb[_0x8535('0x31')],_0x3ffdf7[_0x8535('0x3b')]));if(_0x3f16fb[_0x8535('0x31')]['filter']){_0x1dd51e[_0x8535('0x3a')]=_[_0x8535('0x3e')](_0x1dd51e['where'],{'$or':_[_0x8535('0x2b')](_0x1dd51e[_0x8535('0x34')],function(_0x324bfd){var _0x3c899f={};_0x3c899f[_0x324bfd]={'$like':'%'+_0x3f16fb[_0x8535('0x31')]['filter']+'%'};return _0x3c899f;})});}_0x1dd51e=_[_0x8535('0x3e')]({},_0x1dd51e,_0x3f16fb[_0x8535('0x40')]);return _0x50e94e[_0x8535('0x51')](_0x1dd51e);}})[_0x8535('0x24')](function(_0x1dad3){if(_0x1dad3){_0x2191fd=_0x1dad3[_0x8535('0x35')];if(!_0x3f16fb[_0x8535('0x31')]['hasOwnProperty']('nolimit')){_0x1dd51e[_0x8535('0x1d')]=qs[_0x8535('0x1d')](_0x3f16fb[_0x8535('0x31')][_0x8535('0x1d')]);_0x1dd51e[_0x8535('0x37')]=qs[_0x8535('0x37')](_0x3f16fb[_0x8535('0x31')][_0x8535('0x37')]);}return _0x50e94e[_0x8535('0x51')](_0x1dd51e);}})[_0x8535('0x24')](function(_0x19a61d){if(_0x19a61d){return _0x19a61d?{'count':_0x2191fd,'rows':_0x19a61d}:null;}})[_0x8535('0x24')](respondWithResult(_0x1f4d27,null))[_0x8535('0x45')](handleError(_0x1f4d27,null));};exports[_0x8535('0x52')]=function(_0x1427f7,_0x30ff07,_0x3dff35){var _0x4b45c4={};var _0x40a237={};var _0x1afe18;var _0x2aadba;return db[_0x8535('0x2c')][_0x8535('0x4e')]({'where':{'id':_0x1427f7[_0x8535('0x47')]['id']}})['then'](handleEntityNotFound(_0x30ff07,null))[_0x8535('0x24')](function(_0x3e2ea7){if(_0x3e2ea7){_0x1afe18=_0x3e2ea7;_0x40a237[_0x8535('0x30')]=_[_0x8535('0x48')](db['FreshsalesField'][_0x8535('0x49')]);_0x40a237[_0x8535('0x31')]=_[_0x8535('0x48')](_0x1427f7[_0x8535('0x31')]);_0x40a237['filters']=_['intersection'](_0x40a237['model'],_0x40a237['query']);_0x4b45c4[_0x8535('0x34')]=_[_0x8535('0x32')](_0x40a237[_0x8535('0x30')],qs['fields'](_0x1427f7[_0x8535('0x31')][_0x8535('0x33')]));_0x4b45c4[_0x8535('0x34')]=_0x4b45c4[_0x8535('0x34')][_0x8535('0x35')]?_0x4b45c4['attributes']:_0x40a237['model'];_0x4b45c4[_0x8535('0x38')]=qs['sort'](_0x1427f7[_0x8535('0x31')][_0x8535('0x39')]);_0x4b45c4['where']=qs[_0x8535('0x3b')](_['pick'](_0x1427f7[_0x8535('0x31')],_0x40a237['filters']));if(_0x1427f7['query'][_0x8535('0x3d')]){_0x4b45c4[_0x8535('0x3a')]=_[_0x8535('0x3e')](_0x4b45c4[_0x8535('0x3a')],{'$or':_[_0x8535('0x2b')](_0x4b45c4[_0x8535('0x34')],function(_0x33a383){var _0x130810={};_0x130810[_0x33a383]={'$like':'%'+_0x1427f7['query']['filter']+'%'};return _0x130810;})});}_0x4b45c4=_[_0x8535('0x3e')]({},_0x4b45c4,_0x1427f7[_0x8535('0x40')]);return _0x1afe18[_0x8535('0x52')](_0x4b45c4);}})['then'](function(_0x5104c6){if(_0x5104c6){_0x2aadba=_0x5104c6[_0x8535('0x35')];if(!_0x1427f7['query'][_0x8535('0x50')](_0x8535('0x36'))){_0x4b45c4['limit']=qs['limit'](_0x1427f7[_0x8535('0x31')][_0x8535('0x1d')]);_0x4b45c4[_0x8535('0x37')]=qs[_0x8535('0x37')](_0x1427f7['query']['offset']);}return _0x1afe18['getFields'](_0x4b45c4);}})[_0x8535('0x24')](function(_0x437268){if(_0x437268){return _0x437268?{'count':_0x2aadba,'rows':_0x437268}:null;}})['then'](respondWithResult(_0x30ff07,null))[_0x8535('0x45')](handleError(_0x30ff07,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js index 12002cc..c6e0163 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 _0x01dc=['api','moment','rimraf','./intFreshsalesConfiguration.attributes','exports','define','FreshsalesConfiguration','int_freshsales_configurations','lodash','util','../../config/logger'];(function(_0x544afe,_0x256f92){var _0x12d9e9=function(_0x460830){while(--_0x460830){_0x544afe['push'](_0x544afe['shift']());}};_0x12d9e9(++_0x256f92);}(_0x01dc,0x1aa));var _0xc01d=function(_0x28ab59,_0x592c6f){_0x28ab59=_0x28ab59-0x0;var _0x1a525c=_0x01dc[_0x28ab59];return _0x1a525c;};'use strict';var _=require(_0xc01d('0x0'));var util=require(_0xc01d('0x1'));var logger=require(_0xc01d('0x2'))(_0xc01d('0x3'));var moment=require(_0xc01d('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xc01d('0x5'));var config=require('../../config/environment');var attributes=require(_0xc01d('0x6'));module[_0xc01d('0x7')]=function(_0x2a748d,_0x2dd4f0){return _0x2a748d[_0xc01d('0x8')](_0xc01d('0x9'),attributes,{'tableName':_0xc01d('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7d2a=['path','rimraf','../../config/environment','./intFreshsalesConfiguration.attributes','exports','FreshsalesConfiguration','int_freshsales_configurations','lodash','util','moment','bluebird','request-promise'];(function(_0x172402,_0x2be91f){var _0x1b6331=function(_0x3bba21){while(--_0x3bba21){_0x172402['push'](_0x172402['shift']());}};_0x1b6331(++_0x2be91f);}(_0x7d2a,0xa3));var _0xa7d2=function(_0x38c744,_0x1592d6){_0x38c744=_0x38c744-0x0;var _0x134be1=_0x7d2a[_0x38c744];return _0x134be1;};'use strict';var _=require(_0xa7d2('0x0'));var util=require(_0xa7d2('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xa7d2('0x2'));var BPromise=require(_0xa7d2('0x3'));var rp=require(_0xa7d2('0x4'));var fs=require('fs');var path=require(_0xa7d2('0x5'));var rimraf=require(_0xa7d2('0x6'));var config=require(_0xa7d2('0x7'));var attributes=require(_0xa7d2('0x8'));module[_0xa7d2('0x9')]=function(_0x134dbe,_0x518fb5){return _0x134dbe['define'](_0xa7d2('0xa'),attributes,{'tableName':_0xa7d2('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.rpc.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.rpc.js index 35d71d9..f317811 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 _0x35a3=['http','then','info','FreshsalesConfiguration,\x20%s,\x20%s','request\x20sent','debug','error','message','lodash','util','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x340c76,_0x2aa33c){var _0x304eb3=function(_0x2da4c6){while(--_0x2da4c6){_0x340c76['push'](_0x340c76['shift']());}};_0x304eb3(++_0x2aa33c);}(_0x35a3,0xce));var _0x335a=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x35a3[_0x2dafbe];return _0x58a45a;};'use strict';var _=require(_0x335a('0x0'));var util=require(_0x335a('0x1'));var moment=require('moment');var BPromise=require(_0x335a('0x2'));var rs=require(_0x335a('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x335a('0x4'));var logger=require(_0x335a('0x5'))(_0x335a('0x6'));var config=require(_0x335a('0x7'));var jayson=require(_0x335a('0x8'));var client=jayson[_0x335a('0x9')][_0x335a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xba8ff7,_0x3155bd,_0x2f0970){return new BPromise(function(_0x3bb2aa,_0x5d1f6f){return client['request'](_0xba8ff7,_0x2f0970)[_0x335a('0xb')](function(_0x773b27){logger[_0x335a('0xc')](_0x335a('0xd'),_0x3155bd,_0x335a('0xe'));logger[_0x335a('0xf')]('FreshsalesConfiguration,\x20%s,\x20%s,\x20%s',_0x3155bd,'request\x20sent',JSON['stringify'](_0x773b27));if(_0x773b27['error']){if(_0x773b27[_0x335a('0x10')]['code']===0x1f4){logger[_0x335a('0x10')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x3155bd,_0x773b27[_0x335a('0x10')]['message']);return _0x5d1f6f(_0x773b27[_0x335a('0x10')][_0x335a('0x11')]);}logger['error'](_0x335a('0xd'),_0x3155bd,_0x773b27[_0x335a('0x10')][_0x335a('0x11')]);return _0x3bb2aa(_0x773b27[_0x335a('0x10')][_0x335a('0x11')]);}else{logger['info'](_0x335a('0xd'),_0x3155bd,_0x335a('0xe'));_0x3bb2aa(_0x773b27['result']['message']);}})['catch'](function(_0x30f0d3){logger['error'](_0x335a('0xd'),_0x3155bd,_0x30f0d3);_0x5d1f6f(_0x30f0d3);});});} \ No newline at end of file +var _0x5447=['util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','FreshsalesConfiguration,\x20%s,\x20%s','debug','error','message','info','catch'];(function(_0x1ea7d1,_0x4b4578){var _0x30b0ea=function(_0x4f573d){while(--_0x4f573d){_0x1ea7d1['push'](_0x1ea7d1['shift']());}};_0x30b0ea(++_0x4b4578);}(_0x5447,0xc6));var _0x7544=function(_0x4afa31,_0xa44012){_0x4afa31=_0x4afa31-0x0;var _0xc19534=_0x5447[_0x4afa31];return _0xc19534;};'use strict';var _=require('lodash');var util=require(_0x7544('0x0'));var moment=require(_0x7544('0x1'));var BPromise=require('bluebird');var rs=require(_0x7544('0x2'));var fs=require('fs');var Redis=require(_0x7544('0x3'));var db=require(_0x7544('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x7544('0x5'))('rpc');var config=require(_0x7544('0x6'));var jayson=require(_0x7544('0x7'));var client=jayson[_0x7544('0x8')][_0x7544('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3b273b,_0x2c6df9,_0x5c1a9a){return new BPromise(function(_0x4940f5,_0x3f4db4){return client[_0x7544('0xa')](_0x3b273b,_0x5c1a9a)[_0x7544('0xb')](function(_0x254614){logger['info'](_0x7544('0xc'),_0x2c6df9,'request\x20sent');logger[_0x7544('0xd')]('FreshsalesConfiguration,\x20%s,\x20%s,\x20%s',_0x2c6df9,'request\x20sent',JSON['stringify'](_0x254614));if(_0x254614[_0x7544('0xe')]){if(_0x254614[_0x7544('0xe')]['code']===0x1f4){logger[_0x7544('0xe')](_0x7544('0xc'),_0x2c6df9,_0x254614[_0x7544('0xe')][_0x7544('0xf')]);return _0x3f4db4(_0x254614[_0x7544('0xe')][_0x7544('0xf')]);}logger[_0x7544('0xe')](_0x7544('0xc'),_0x2c6df9,_0x254614[_0x7544('0xe')]['message']);return _0x4940f5(_0x254614[_0x7544('0xe')][_0x7544('0xf')]);}else{logger[_0x7544('0x10')](_0x7544('0xc'),_0x2c6df9,'request\x20sent');_0x4940f5(_0x254614['result'][_0x7544('0xf')]);}})[_0x7544('0x11')](function(_0x31622f){logger[_0x7544('0xe')](_0x7544('0xc'),_0x2c6df9,_0x31622f);_0x3f4db4(_0x31622f);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesField/index.js b/server/api/intFreshsalesField/index.js index 972b6b1..fdb7815 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 _0xe130=['post','/:id','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./intFreshsalesField.controller','get','isAuthenticated'];(function(_0x3190e2,_0x59d896){var _0x4bc460=function(_0x4be02e){while(--_0x4be02e){_0x3190e2['push'](_0x3190e2['shift']());}};_0x4bc460(++_0x59d896);}(_0xe130,0x127));var _0x0e13=function(_0x473b22,_0x5c4780){_0x473b22=_0x473b22-0x0;var _0x466d20=_0xe130[_0x473b22];return _0x466d20;};'use strict';var multer=require(_0x0e13('0x0'));var util=require(_0x0e13('0x1'));var path=require('path');var timeout=require(_0x0e13('0x2'));var express=require(_0x0e13('0x3'));var router=express[_0x0e13('0x4')]();var fs_extra=require(_0x0e13('0x5'));var auth=require(_0x0e13('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x0e13('0x7'));var controller=require(_0x0e13('0x8'));router[_0x0e13('0x9')]('/',auth[_0x0e13('0xa')](),controller['index']);router[_0x0e13('0x9')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x0e13('0xb')]('/',auth[_0x0e13('0xa')](),controller['create']);router['put'](_0x0e13('0xc'),auth[_0x0e13('0xa')](),controller[_0x0e13('0xd')]);router[_0x0e13('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x0e13('0xf')]);module[_0x0e13('0x10')]=router; \ No newline at end of file +var _0xd66c=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesField.controller','get','isAuthenticated','index','show','post','create','put','update','/:id','exports','multer','path','connect-timeout','express'];(function(_0x4eec9b,_0x4aea09){var _0x2e3849=function(_0x24c06d){while(--_0x24c06d){_0x4eec9b['push'](_0x4eec9b['shift']());}};_0x2e3849(++_0x4aea09);}(_0xd66c,0x106));var _0xcd66=function(_0x212fcc,_0x9a5423){_0x212fcc=_0x212fcc-0x0;var _0x4c129c=_0xd66c[_0x212fcc];return _0x4c129c;};'use strict';var multer=require(_0xcd66('0x0'));var util=require('util');var path=require(_0xcd66('0x1'));var timeout=require(_0xcd66('0x2'));var express=require(_0xcd66('0x3'));var router=express[_0xcd66('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xcd66('0x5'));var interaction=require(_0xcd66('0x6'));var config=require(_0xcd66('0x7'));var controller=require(_0xcd66('0x8'));router[_0xcd66('0x9')]('/',auth[_0xcd66('0xa')](),controller[_0xcd66('0xb')]);router[_0xcd66('0x9')]('/:id',auth[_0xcd66('0xa')](),controller[_0xcd66('0xc')]);router[_0xcd66('0xd')]('/',auth[_0xcd66('0xa')](),controller[_0xcd66('0xe')]);router[_0xcd66('0xf')]('/:id',auth['isAuthenticated'](),controller[_0xcd66('0x10')]);router['delete'](_0xcd66('0x11'),auth[_0xcd66('0xa')](),controller['destroy']);module[_0xcd66('0x12')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.attributes.js b/server/api/intFreshsalesField/intFreshsalesField.attributes.js index d3d648e..6fd6a3f 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 _0x1408=['customVariable','keyValue','picklist','STRING','BOOLEAN','sequelize','ENUM','string','variable'];(function(_0x2579ab,_0x5d56a5){var _0x5e0fa1=function(_0x34fb3a){while(--_0x34fb3a){_0x2579ab['push'](_0x2579ab['shift']());}};_0x5e0fa1(++_0x5d56a5);}(_0x1408,0x19a));var _0x8140=function(_0x274d8d,_0x5a8cac){_0x274d8d=_0x274d8d-0x0;var _0x113126=_0x1408[_0x274d8d];return _0x113126;};'use strict';var Sequelize=require(_0x8140('0x0'));module['exports']={'type':{'type':Sequelize[_0x8140('0x1')](_0x8140('0x2'),_0x8140('0x3'),_0x8140('0x4'),_0x8140('0x5'),_0x8140('0x6')),'defaultValue':'string'},'content':{'type':Sequelize[_0x8140('0x7')]},'key':{'type':Sequelize[_0x8140('0x7')]},'keyType':{'type':Sequelize[_0x8140('0x1')]('string',_0x8140('0x3'),_0x8140('0x4'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x8140('0x7')]},'nameField':{'type':Sequelize[_0x8140('0x7')]},'customField':{'type':Sequelize[_0x8140('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x8140('0x7')]}}; \ No newline at end of file +var _0x4861=['STRING','exports','string','variable','customVariable','keyValue','picklist'];(function(_0x20babc,_0x18ef86){var _0x19621d=function(_0x361700){while(--_0x361700){_0x20babc['push'](_0x20babc['shift']());}};_0x19621d(++_0x18ef86);}(_0x4861,0x71));var _0x1486=function(_0x5d2803,_0xf375bd){_0x5d2803=_0x5d2803-0x0;var _0xdcad2c=_0x4861[_0x5d2803];return _0xdcad2c;};'use strict';var Sequelize=require('sequelize');module[_0x1486('0x0')]={'type':{'type':Sequelize['ENUM'](_0x1486('0x1'),_0x1486('0x2'),_0x1486('0x3'),_0x1486('0x4'),_0x1486('0x5')),'defaultValue':_0x1486('0x1')},'content':{'type':Sequelize[_0x1486('0x6')]},'key':{'type':Sequelize[_0x1486('0x6')]},'keyType':{'type':Sequelize['ENUM'](_0x1486('0x1'),'variable',_0x1486('0x3'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x1486('0x6')]},'nameField':{'type':Sequelize[_0x1486('0x6')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.controller.js b/server/api/intFreshsalesField/intFreshsalesField.controller.js index 5d4b24c..1e90213 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 _0xb184=['intersection','query','fields','attributes','length','hasOwnProperty','nolimit','sort','pick','filters','where','merge','VIRTUAL','filter','options','FreshsalesField','includeAll','findAll','catch','show','include','find','create','body','update','params','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','sendStatus','status','end','json','offset','undefined','count','limit','Content-Range','apply','reject','save','then','destroy','error','stack','name','index','rawAttributes','key','model','map','keys'];(function(_0x4f7449,_0x407356){var _0x21e3cb=function(_0x40f623){while(--_0x40f623){_0x4f7449['push'](_0x4f7449['shift']());}};_0x21e3cb(++_0x407356);}(_0xb184,0xef));var _0x4b18=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb184[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x4b18('0x0'));var rimraf=require(_0x4b18('0x1'));var zipdir=require(_0x4b18('0x2'));var jsonpatch=require(_0x4b18('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x4b18('0x4'));var Mustache=require(_0x4b18('0x5'));var util=require(_0x4b18('0x6'));var path=require(_0x4b18('0x7'));var sox=require(_0x4b18('0x8'));var csv=require(_0x4b18('0x9'));var ejs=require(_0x4b18('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0x4b18('0xb'));var jsforce=require(_0x4b18('0xc'));var deskjs=require(_0x4b18('0xd'));var toCsv=require('to-csv');var querystring=require(_0x4b18('0xe'));var Papa=require(_0x4b18('0xf'));var Redis=require('ioredis');var authService=require(_0x4b18('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x4b18('0x11'));var hardwareService=require(_0x4b18('0x12'));var logger=require('../../config/logger')(_0x4b18('0x13'));var utils=require(_0x4b18('0x14'));var config=require(_0x4b18('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x54d332,_0x5a1633){_0x5a1633=_0x5a1633||0xcc;return function(_0x53e0fa){if(_0x53e0fa){return _0x54d332[_0x4b18('0x16')](_0x5a1633);}return _0x54d332[_0x4b18('0x17')](_0x5a1633)[_0x4b18('0x18')]();};}function respondWithResult(_0x47964a,_0x4b553d){_0x4b553d=_0x4b553d||0xc8;return function(_0x33021b){if(_0x33021b){return _0x47964a[_0x4b18('0x17')](_0x4b553d)[_0x4b18('0x19')](_0x33021b);}};}function respondWithFilteredResult(_0x85459b,_0x2f70f4){return function(_0x3bbee5){if(_0x3bbee5){var _0x228b08=typeof _0x2f70f4[_0x4b18('0x1a')]===_0x4b18('0x1b')&&typeof _0x2f70f4['limit']==='undefined';var _0x2be03c=_0x3bbee5[_0x4b18('0x1c')];var _0x347f42=_0x228b08?0x0:_0x2f70f4[_0x4b18('0x1a')];var _0x3b180f=_0x228b08?_0x3bbee5[_0x4b18('0x1c')]:_0x2f70f4[_0x4b18('0x1a')]+_0x2f70f4[_0x4b18('0x1d')];var _0x250b37;if(_0x3b180f>=_0x2be03c){_0x3b180f=_0x2be03c;_0x250b37=0xc8;}else{_0x250b37=0xce;}_0x85459b[_0x4b18('0x17')](_0x250b37);return _0x85459b['set'](_0x4b18('0x1e'),_0x347f42+'-'+_0x3b180f+'/'+_0x2be03c)['json'](_0x3bbee5);}return null;};}function patchUpdates(_0x1c5e74){return function(_0x185fa1){try{jsonpatch[_0x4b18('0x1f')](_0x185fa1,_0x1c5e74,!![]);}catch(_0x54712d){return BPromise[_0x4b18('0x20')](_0x54712d);}return _0x185fa1[_0x4b18('0x21')]();};}function saveUpdates(_0x429815,_0x244b0c){return function(_0x252cf3){if(_0x252cf3){return _0x252cf3['update'](_0x429815)[_0x4b18('0x22')](function(_0x301db2){return _0x301db2;});}return null;};}function removeEntity(_0x1519dc,_0x4fa9a9){return function(_0x5b54f5){if(_0x5b54f5){return _0x5b54f5[_0x4b18('0x23')]()[_0x4b18('0x22')](function(){_0x1519dc[_0x4b18('0x17')](0xcc)[_0x4b18('0x18')]();});}};}function handleEntityNotFound(_0x1206d2,_0x1f5a01){return function(_0x245552){if(!_0x245552){_0x1206d2[_0x4b18('0x16')](0x194);}return _0x245552;};}function handleError(_0x214ac4,_0x4982ed){_0x4982ed=_0x4982ed||0x1f4;return function(_0x37dd49){logger[_0x4b18('0x24')](_0x37dd49[_0x4b18('0x25')]);if(_0x37dd49['name']){delete _0x37dd49[_0x4b18('0x26')];}_0x214ac4['status'](_0x4982ed)['send'](_0x37dd49);};}exports[_0x4b18('0x27')]=function(_0x194ea8,_0x52f671){var _0xf3b009={},_0x359873={},_0x30b775={'count':0x0,'rows':[]};var _0x1cab71=_['map'](db['FreshsalesField'][_0x4b18('0x28')],function(_0x4168b6){return{'name':_0x4168b6['fieldName'],'type':_0x4168b6['type'][_0x4b18('0x29')]};});_0x359873[_0x4b18('0x2a')]=_[_0x4b18('0x2b')](_0x1cab71,_0x4b18('0x26'));_0x359873['query']=_[_0x4b18('0x2c')](_0x194ea8['query']);_0x359873['filters']=_[_0x4b18('0x2d')](_0x359873[_0x4b18('0x2a')],_0x359873[_0x4b18('0x2e')]);_0xf3b009['attributes']=_[_0x4b18('0x2d')](_0x359873[_0x4b18('0x2a')],qs[_0x4b18('0x2f')](_0x194ea8['query'][_0x4b18('0x2f')]));_0xf3b009[_0x4b18('0x30')]=_0xf3b009['attributes'][_0x4b18('0x31')]?_0xf3b009[_0x4b18('0x30')]:_0x359873[_0x4b18('0x2a')];if(!_0x194ea8['query'][_0x4b18('0x32')](_0x4b18('0x33'))){_0xf3b009[_0x4b18('0x1d')]=qs[_0x4b18('0x1d')](_0x194ea8[_0x4b18('0x2e')]['limit']);_0xf3b009[_0x4b18('0x1a')]=qs['offset'](_0x194ea8[_0x4b18('0x2e')][_0x4b18('0x1a')]);}_0xf3b009['order']=qs[_0x4b18('0x34')](_0x194ea8[_0x4b18('0x2e')][_0x4b18('0x34')]);_0xf3b009['where']=qs['filters'](_[_0x4b18('0x35')](_0x194ea8[_0x4b18('0x2e')],_0x359873[_0x4b18('0x36')]),_0x1cab71);if(_0x194ea8[_0x4b18('0x2e')]['filter']){_0xf3b009[_0x4b18('0x37')]=_[_0x4b18('0x38')](_0xf3b009[_0x4b18('0x37')],{'$or':_[_0x4b18('0x2b')](_0x1cab71,function(_0x3969ec){if(_0x3969ec['type']!==_0x4b18('0x39')){var _0x720a58={};_0x720a58[_0x3969ec[_0x4b18('0x26')]]={'$like':'%'+_0x194ea8[_0x4b18('0x2e')][_0x4b18('0x3a')]+'%'};return _0x720a58;}})});}_0xf3b009=_[_0x4b18('0x38')]({},_0xf3b009,_0x194ea8[_0x4b18('0x3b')]);var _0x2bb0dc={'where':_0xf3b009[_0x4b18('0x37')]};return db[_0x4b18('0x3c')][_0x4b18('0x1c')](_0x2bb0dc)[_0x4b18('0x22')](function(_0x4ad2ee){_0x30b775[_0x4b18('0x1c')]=_0x4ad2ee;if(_0x194ea8['query'][_0x4b18('0x3d')]){_0xf3b009['include']=[{'all':!![]}];}return db[_0x4b18('0x3c')][_0x4b18('0x3e')](_0xf3b009);})[_0x4b18('0x22')](function(_0x57fca0){_0x30b775['rows']=_0x57fca0;return _0x30b775;})['then'](respondWithFilteredResult(_0x52f671,_0xf3b009))[_0x4b18('0x3f')](handleError(_0x52f671,null));};exports[_0x4b18('0x40')]=function(_0x3c083b,_0x336dc8){var _0x4df3a1={'raw':!![],'where':{'id':_0x3c083b['params']['id']}},_0x19a0f1={};_0x19a0f1[_0x4b18('0x2a')]=_[_0x4b18('0x2c')](db[_0x4b18('0x3c')][_0x4b18('0x28')]);_0x19a0f1[_0x4b18('0x2e')]=_[_0x4b18('0x2c')](_0x3c083b[_0x4b18('0x2e')]);_0x19a0f1['filters']=_['intersection'](_0x19a0f1[_0x4b18('0x2a')],_0x19a0f1['query']);_0x4df3a1['attributes']=_[_0x4b18('0x2d')](_0x19a0f1[_0x4b18('0x2a')],qs['fields'](_0x3c083b['query'][_0x4b18('0x2f')]));_0x4df3a1[_0x4b18('0x30')]=_0x4df3a1[_0x4b18('0x30')]['length']?_0x4df3a1[_0x4b18('0x30')]:_0x19a0f1[_0x4b18('0x2a')];if(_0x3c083b['query']['includeAll']){_0x4df3a1[_0x4b18('0x41')]=[{'all':!![]}];}_0x4df3a1=_[_0x4b18('0x38')]({},_0x4df3a1,_0x3c083b[_0x4b18('0x3b')]);return db['FreshsalesField'][_0x4b18('0x42')](_0x4df3a1)[_0x4b18('0x22')](handleEntityNotFound(_0x336dc8,null))[_0x4b18('0x22')](respondWithResult(_0x336dc8,null))['catch'](handleError(_0x336dc8,null));};exports['create']=function(_0x3a8cf0,_0xa74ccc){return db[_0x4b18('0x3c')][_0x4b18('0x43')](_0x3a8cf0[_0x4b18('0x44')],{})[_0x4b18('0x22')](respondWithResult(_0xa74ccc,0xc9))[_0x4b18('0x3f')](handleError(_0xa74ccc,null));};exports[_0x4b18('0x45')]=function(_0x47cab0,_0x3f3f7e){if(_0x47cab0[_0x4b18('0x44')]['id']){delete _0x47cab0[_0x4b18('0x44')]['id'];}return db[_0x4b18('0x3c')]['find']({'where':{'id':_0x47cab0['params']['id']}})[_0x4b18('0x22')](handleEntityNotFound(_0x3f3f7e,null))[_0x4b18('0x22')](saveUpdates(_0x47cab0[_0x4b18('0x44')],null))[_0x4b18('0x22')](respondWithResult(_0x3f3f7e,null))[_0x4b18('0x3f')](handleError(_0x3f3f7e,null));};exports[_0x4b18('0x23')]=function(_0x4ec8b1,_0x1d04b6){return db[_0x4b18('0x3c')][_0x4b18('0x42')]({'where':{'id':_0x4ec8b1[_0x4b18('0x46')]['id']}})['then'](handleEntityNotFound(_0x1d04b6,null))['then'](removeEntity(_0x1d04b6,null))[_0x4b18('0x3f')](handleError(_0x1d04b6,null));}; \ No newline at end of file +var _0xc2e1=['type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','merge','filter','options','includeAll','include','findAll','rows','catch','show','params','create','body','find','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','offset','undefined','limit','count','Content-Range','json','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','FreshsalesField','rawAttributes','fieldName'];(function(_0x58afd5,_0x534a48){var _0x3e503b=function(_0x27ba44){while(--_0x27ba44){_0x58afd5['push'](_0x58afd5['shift']());}};_0x3e503b(++_0x534a48);}(_0xc2e1,0x1ea));var _0x1c2e=function(_0x2c203e,_0x253d39){_0x2c203e=_0x2c203e-0x0;var _0x28f34e=_0xc2e1[_0x2c203e];return _0x28f34e;};'use strict';var emlformat=require(_0x1c2e('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x1c2e('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x1c2e('0x2'));var moment=require(_0x1c2e('0x3'));var BPromise=require(_0x1c2e('0x4'));var Mustache=require(_0x1c2e('0x5'));var util=require(_0x1c2e('0x6'));var path=require(_0x1c2e('0x7'));var sox=require(_0x1c2e('0x8'));var csv=require(_0x1c2e('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1c2e('0xa'));var _=require(_0x1c2e('0xb'));var squel=require(_0x1c2e('0xc'));var crypto=require(_0x1c2e('0xd'));var jsforce=require(_0x1c2e('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x1c2e('0x9'));var querystring=require(_0x1c2e('0xf'));var Papa=require('papaparse');var Redis=require(_0x1c2e('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x1c2e('0x11'));var as=require(_0x1c2e('0x12'));var hardwareService=require(_0x1c2e('0x13'));var logger=require(_0x1c2e('0x14'))(_0x1c2e('0x15'));var utils=require(_0x1c2e('0x16'));var config=require(_0x1c2e('0x17'));var licenseUtil=require(_0x1c2e('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x10d192,_0x48ee88){_0x48ee88=_0x48ee88||0xcc;return function(_0x5ed102){if(_0x5ed102){return _0x10d192[_0x1c2e('0x19')](_0x48ee88);}return _0x10d192['status'](_0x48ee88)[_0x1c2e('0x1a')]();};}function respondWithResult(_0x3245b7,_0x30420e){_0x30420e=_0x30420e||0xc8;return function(_0x3a6d05){if(_0x3a6d05){return _0x3245b7[_0x1c2e('0x1b')](_0x30420e)['json'](_0x3a6d05);}};}function respondWithFilteredResult(_0x241d3b,_0x43dd72){return function(_0xf00939){if(_0xf00939){var _0x33b103=typeof _0x43dd72[_0x1c2e('0x1c')]===_0x1c2e('0x1d')&&typeof _0x43dd72[_0x1c2e('0x1e')]===_0x1c2e('0x1d');var _0xee31b7=_0xf00939['count'];var _0x9412d3=_0x33b103?0x0:_0x43dd72[_0x1c2e('0x1c')];var _0x494fc9=_0x33b103?_0xf00939[_0x1c2e('0x1f')]:_0x43dd72[_0x1c2e('0x1c')]+_0x43dd72['limit'];var _0x37d427;if(_0x494fc9>=_0xee31b7){_0x494fc9=_0xee31b7;_0x37d427=0xc8;}else{_0x37d427=0xce;}_0x241d3b[_0x1c2e('0x1b')](_0x37d427);return _0x241d3b['set'](_0x1c2e('0x20'),_0x9412d3+'-'+_0x494fc9+'/'+_0xee31b7)[_0x1c2e('0x21')](_0xf00939);}return null;};}function patchUpdates(_0x2d644e){return function(_0x272eb5){try{jsonpatch[_0x1c2e('0x22')](_0x272eb5,_0x2d644e,!![]);}catch(_0x504983){return BPromise[_0x1c2e('0x23')](_0x504983);}return _0x272eb5[_0x1c2e('0x24')]();};}function saveUpdates(_0x4f86cb,_0x2c81d8){return function(_0x4b30ba){if(_0x4b30ba){return _0x4b30ba[_0x1c2e('0x25')](_0x4f86cb)[_0x1c2e('0x26')](function(_0x1ada39){return _0x1ada39;});}return null;};}function removeEntity(_0x10e310,_0x1422a2){return function(_0xab1891){if(_0xab1891){return _0xab1891[_0x1c2e('0x27')]()[_0x1c2e('0x26')](function(){_0x10e310['status'](0xcc)[_0x1c2e('0x1a')]();});}};}function handleEntityNotFound(_0x561166,_0x3fbec4){return function(_0x13230c){if(!_0x13230c){_0x561166[_0x1c2e('0x19')](0x194);}return _0x13230c;};}function handleError(_0x1d9153,_0x580153){_0x580153=_0x580153||0x1f4;return function(_0x536c9c){logger[_0x1c2e('0x28')](_0x536c9c[_0x1c2e('0x29')]);if(_0x536c9c[_0x1c2e('0x2a')]){delete _0x536c9c[_0x1c2e('0x2a')];}_0x1d9153[_0x1c2e('0x1b')](_0x580153)[_0x1c2e('0x2b')](_0x536c9c);};}exports[_0x1c2e('0x2c')]=function(_0xe4c1a2,_0x41b7b4){var _0x518abf={},_0x622f2d={},_0x5ec5e4={'count':0x0,'rows':[]};var _0xe61695=_[_0x1c2e('0x2d')](db[_0x1c2e('0x2e')][_0x1c2e('0x2f')],function(_0x3ed80c){return{'name':_0x3ed80c[_0x1c2e('0x30')],'type':_0x3ed80c[_0x1c2e('0x31')][_0x1c2e('0x32')]};});_0x622f2d[_0x1c2e('0x33')]=_[_0x1c2e('0x2d')](_0xe61695,_0x1c2e('0x2a'));_0x622f2d[_0x1c2e('0x34')]=_[_0x1c2e('0x35')](_0xe4c1a2[_0x1c2e('0x34')]);_0x622f2d[_0x1c2e('0x36')]=_[_0x1c2e('0x37')](_0x622f2d[_0x1c2e('0x33')],_0x622f2d[_0x1c2e('0x34')]);_0x518abf[_0x1c2e('0x38')]=_['intersection'](_0x622f2d['model'],qs[_0x1c2e('0x39')](_0xe4c1a2[_0x1c2e('0x34')]['fields']));_0x518abf[_0x1c2e('0x38')]=_0x518abf['attributes'][_0x1c2e('0x3a')]?_0x518abf[_0x1c2e('0x38')]:_0x622f2d['model'];if(!_0xe4c1a2[_0x1c2e('0x34')][_0x1c2e('0x3b')](_0x1c2e('0x3c'))){_0x518abf[_0x1c2e('0x1e')]=qs[_0x1c2e('0x1e')](_0xe4c1a2[_0x1c2e('0x34')][_0x1c2e('0x1e')]);_0x518abf[_0x1c2e('0x1c')]=qs[_0x1c2e('0x1c')](_0xe4c1a2[_0x1c2e('0x34')][_0x1c2e('0x1c')]);}_0x518abf[_0x1c2e('0x3d')]=qs[_0x1c2e('0x3e')](_0xe4c1a2[_0x1c2e('0x34')]['sort']);_0x518abf[_0x1c2e('0x3f')]=qs[_0x1c2e('0x36')](_['pick'](_0xe4c1a2[_0x1c2e('0x34')],_0x622f2d[_0x1c2e('0x36')]),_0xe61695);if(_0xe4c1a2[_0x1c2e('0x34')]['filter']){_0x518abf[_0x1c2e('0x3f')]=_[_0x1c2e('0x40')](_0x518abf[_0x1c2e('0x3f')],{'$or':_[_0x1c2e('0x2d')](_0xe61695,function(_0x1526f4){if(_0x1526f4[_0x1c2e('0x31')]!=='VIRTUAL'){var _0x43cad7={};_0x43cad7[_0x1526f4[_0x1c2e('0x2a')]]={'$like':'%'+_0xe4c1a2[_0x1c2e('0x34')][_0x1c2e('0x41')]+'%'};return _0x43cad7;}})});}_0x518abf=_[_0x1c2e('0x40')]({},_0x518abf,_0xe4c1a2[_0x1c2e('0x42')]);var _0x31d141={'where':_0x518abf[_0x1c2e('0x3f')]};return db['FreshsalesField'][_0x1c2e('0x1f')](_0x31d141)[_0x1c2e('0x26')](function(_0x750563){_0x5ec5e4['count']=_0x750563;if(_0xe4c1a2[_0x1c2e('0x34')][_0x1c2e('0x43')]){_0x518abf[_0x1c2e('0x44')]=[{'all':!![]}];}return db[_0x1c2e('0x2e')][_0x1c2e('0x45')](_0x518abf);})[_0x1c2e('0x26')](function(_0x2b4284){_0x5ec5e4[_0x1c2e('0x46')]=_0x2b4284;return _0x5ec5e4;})[_0x1c2e('0x26')](respondWithFilteredResult(_0x41b7b4,_0x518abf))[_0x1c2e('0x47')](handleError(_0x41b7b4,null));};exports[_0x1c2e('0x48')]=function(_0x174e8b,_0xd5f46b){var _0x2912e9={'raw':!![],'where':{'id':_0x174e8b[_0x1c2e('0x49')]['id']}},_0x5a1b8c={};_0x5a1b8c[_0x1c2e('0x33')]=_[_0x1c2e('0x35')](db['FreshsalesField']['rawAttributes']);_0x5a1b8c[_0x1c2e('0x34')]=_[_0x1c2e('0x35')](_0x174e8b[_0x1c2e('0x34')]);_0x5a1b8c[_0x1c2e('0x36')]=_[_0x1c2e('0x37')](_0x5a1b8c[_0x1c2e('0x33')],_0x5a1b8c[_0x1c2e('0x34')]);_0x2912e9[_0x1c2e('0x38')]=_[_0x1c2e('0x37')](_0x5a1b8c[_0x1c2e('0x33')],qs[_0x1c2e('0x39')](_0x174e8b['query'][_0x1c2e('0x39')]));_0x2912e9[_0x1c2e('0x38')]=_0x2912e9[_0x1c2e('0x38')][_0x1c2e('0x3a')]?_0x2912e9[_0x1c2e('0x38')]:_0x5a1b8c[_0x1c2e('0x33')];if(_0x174e8b[_0x1c2e('0x34')][_0x1c2e('0x43')]){_0x2912e9[_0x1c2e('0x44')]=[{'all':!![]}];}_0x2912e9=_[_0x1c2e('0x40')]({},_0x2912e9,_0x174e8b['options']);return db[_0x1c2e('0x2e')]['find'](_0x2912e9)[_0x1c2e('0x26')](handleEntityNotFound(_0xd5f46b,null))['then'](respondWithResult(_0xd5f46b,null))[_0x1c2e('0x47')](handleError(_0xd5f46b,null));};exports[_0x1c2e('0x4a')]=function(_0x15458e,_0xc4f138){return db[_0x1c2e('0x2e')][_0x1c2e('0x4a')](_0x15458e['body'],{})['then'](respondWithResult(_0xc4f138,0xc9))[_0x1c2e('0x47')](handleError(_0xc4f138,null));};exports[_0x1c2e('0x25')]=function(_0xaa10d3,_0x169f43){if(_0xaa10d3[_0x1c2e('0x4b')]['id']){delete _0xaa10d3[_0x1c2e('0x4b')]['id'];}return db['FreshsalesField'][_0x1c2e('0x4c')]({'where':{'id':_0xaa10d3[_0x1c2e('0x49')]['id']}})[_0x1c2e('0x26')](handleEntityNotFound(_0x169f43,null))[_0x1c2e('0x26')](saveUpdates(_0xaa10d3[_0x1c2e('0x4b')],null))['then'](respondWithResult(_0x169f43,null))['catch'](handleError(_0x169f43,null));};exports[_0x1c2e('0x27')]=function(_0x43921d,_0x2bb031){return db[_0x1c2e('0x2e')][_0x1c2e('0x4c')]({'where':{'id':_0x43921d[_0x1c2e('0x49')]['id']}})['then'](handleEntityNotFound(_0x2bb031,null))[_0x1c2e('0x26')](removeEntity(_0x2bb031,null))[_0x1c2e('0x47')](handleError(_0x2bb031,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.model.js b/server/api/intFreshsalesField/intFreshsalesField.model.js index 845f623..590204b 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 _0x6e1c=['idField','FieldId','lodash','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intFreshsalesField.attributes','exports','FreshsalesField','int_freshsales_fields','freshsales_unique_index'];(function(_0x109caa,_0x2d57b4){var _0x2afadd=function(_0x12971c){while(--_0x12971c){_0x109caa['push'](_0x109caa['shift']());}};_0x2afadd(++_0x2d57b4);}(_0x6e1c,0xb6));var _0xc6e1=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x6e1c[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0xc6e1('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xc6e1('0x1'));var moment=require(_0xc6e1('0x2'));var BPromise=require(_0xc6e1('0x3'));var rp=require(_0xc6e1('0x4'));var fs=require('fs');var path=require(_0xc6e1('0x5'));var rimraf=require(_0xc6e1('0x6'));var config=require(_0xc6e1('0x7'));var attributes=require(_0xc6e1('0x8'));module[_0xc6e1('0x9')]=function(_0x3e2d6c,_0x468a80){return _0x3e2d6c['define'](_0xc6e1('0xa'),attributes,{'tableName':_0xc6e1('0xb'),'paranoid':![],'indexes':[{'name':_0xc6e1('0xc'),'fields':[_0xc6e1('0xd'),_0xc6e1('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xef0a=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./intFreshsalesField.attributes','define','FreshsalesField','idField','FieldId','lodash','util','../../config/logger','api'];(function(_0x44a347,_0x965cd4){var _0x4489f1=function(_0x123c30){while(--_0x123c30){_0x44a347['push'](_0x44a347['shift']());}};_0x4489f1(++_0x965cd4);}(_0xef0a,0xdd));var _0xaef0=function(_0x49fb85,_0x18dcaa){_0x49fb85=_0x49fb85-0x0;var _0x23347e=_0xef0a[_0x49fb85];return _0x23347e;};'use strict';var _=require(_0xaef0('0x0'));var util=require(_0xaef0('0x1'));var logger=require(_0xaef0('0x2'))(_0xaef0('0x3'));var moment=require(_0xaef0('0x4'));var BPromise=require(_0xaef0('0x5'));var rp=require(_0xaef0('0x6'));var fs=require('fs');var path=require(_0xaef0('0x7'));var rimraf=require(_0xaef0('0x8'));var config=require(_0xaef0('0x9'));var attributes=require(_0xaef0('0xa'));module['exports']=function(_0x32868a,_0x12dd17){return _0x32868a[_0xaef0('0xb')](_0xaef0('0xc'),attributes,{'tableName':'int_freshsales_fields','paranoid':![],'indexes':[{'name':'freshsales_unique_index','fields':[_0xaef0('0xd'),_0xaef0('0xe')],'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 7f58944..468dda8 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 _0xdbf5=['util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','FreshsalesField,\x20%s,\x20%s','debug','stringify','code','error','message','request\x20sent','result','catch'];(function(_0x17993c,_0x3bfd92){var _0x3ca20a=function(_0x1196dd){while(--_0x1196dd){_0x17993c['push'](_0x17993c['shift']());}};_0x3ca20a(++_0x3bfd92);}(_0xdbf5,0x18c));var _0x5dbf=function(_0x578918,_0x42883f){_0x578918=_0x578918-0x0;var _0x1c20e8=_0xdbf5[_0x578918];return _0x1c20e8;};'use strict';var _=require('lodash');var util=require(_0x5dbf('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x5dbf('0x1'));var fs=require('fs');var Redis=require(_0x5dbf('0x2'));var db=require(_0x5dbf('0x3'))['db'];var utils=require(_0x5dbf('0x4'));var logger=require(_0x5dbf('0x5'))(_0x5dbf('0x6'));var config=require(_0x5dbf('0x7'));var jayson=require(_0x5dbf('0x8'));var client=jayson[_0x5dbf('0x9')][_0x5dbf('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x209b7d,_0x88128e,_0x93e657){return new BPromise(function(_0x52b039,_0x134810){return client['request'](_0x209b7d,_0x93e657)[_0x5dbf('0xb')](function(_0x3bec50){logger[_0x5dbf('0xc')](_0x5dbf('0xd'),_0x88128e,'request\x20sent');logger[_0x5dbf('0xe')]('FreshsalesField,\x20%s,\x20%s,\x20%s',_0x88128e,'request\x20sent',JSON[_0x5dbf('0xf')](_0x3bec50));if(_0x3bec50['error']){if(_0x3bec50['error'][_0x5dbf('0x10')]===0x1f4){logger['error'](_0x5dbf('0xd'),_0x88128e,_0x3bec50[_0x5dbf('0x11')][_0x5dbf('0x12')]);return _0x134810(_0x3bec50[_0x5dbf('0x11')][_0x5dbf('0x12')]);}logger['error']('FreshsalesField,\x20%s,\x20%s',_0x88128e,_0x3bec50[_0x5dbf('0x11')][_0x5dbf('0x12')]);return _0x52b039(_0x3bec50['error'][_0x5dbf('0x12')]);}else{logger[_0x5dbf('0xc')](_0x5dbf('0xd'),_0x88128e,_0x5dbf('0x13'));_0x52b039(_0x3bec50[_0x5dbf('0x14')][_0x5dbf('0x12')]);}})[_0x5dbf('0x15')](function(_0x50ef1d){logger['error'](_0x5dbf('0xd'),_0x88128e,_0x50ef1d);_0x134810(_0x50ef1d);});});} \ No newline at end of file +var _0xf61e=['info','FreshsalesField,\x20%s,\x20%s','request\x20sent','debug','FreshsalesField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x4148c7,_0x5a8ab9){var _0x174690=function(_0x2ae68a){while(--_0x2ae68a){_0x4148c7['push'](_0x4148c7['shift']());}};_0x174690(++_0x5a8ab9);}(_0xf61e,0x191));var _0xef61=function(_0x54417c,_0x27ae91){_0x54417c=_0x54417c-0x0;var _0x24e98b=_0xf61e[_0x54417c];return _0x24e98b;};'use strict';var _=require(_0xef61('0x0'));var util=require(_0xef61('0x1'));var moment=require(_0xef61('0x2'));var BPromise=require(_0xef61('0x3'));var rs=require(_0xef61('0x4'));var fs=require('fs');var Redis=require(_0xef61('0x5'));var db=require(_0xef61('0x6'))['db'];var utils=require(_0xef61('0x7'));var logger=require(_0xef61('0x8'))(_0xef61('0x9'));var config=require(_0xef61('0xa'));var jayson=require(_0xef61('0xb'));var client=jayson['client'][_0xef61('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x3e2f79,_0x4f0cc5,_0x2242a7){return new BPromise(function(_0x277fa1,_0x106e7f){return client['request'](_0x3e2f79,_0x2242a7)['then'](function(_0x188894){logger[_0xef61('0xd')](_0xef61('0xe'),_0x4f0cc5,_0xef61('0xf'));logger[_0xef61('0x10')](_0xef61('0x11'),_0x4f0cc5,_0xef61('0xf'),JSON[_0xef61('0x12')](_0x188894));if(_0x188894[_0xef61('0x13')]){if(_0x188894[_0xef61('0x13')][_0xef61('0x14')]===0x1f4){logger[_0xef61('0x13')](_0xef61('0xe'),_0x4f0cc5,_0x188894[_0xef61('0x13')]['message']);return _0x106e7f(_0x188894[_0xef61('0x13')]['message']);}logger[_0xef61('0x13')](_0xef61('0xe'),_0x4f0cc5,_0x188894[_0xef61('0x13')][_0xef61('0x15')]);return _0x277fa1(_0x188894['error'][_0xef61('0x15')]);}else{logger[_0xef61('0xd')](_0xef61('0xe'),_0x4f0cc5,_0xef61('0xf'));_0x277fa1(_0x188894['result'][_0xef61('0x15')]);}})[_0xef61('0x16')](function(_0x4f7a62){logger[_0xef61('0x13')](_0xef61('0xe'),_0x4f0cc5,_0x4f7a62);_0x106e7f(_0x4f7a62);});});} \ No newline at end of file diff --git a/server/api/intSalesforceAccount/index.js b/server/api/intSalesforceAccount/index.js index 7a15561..cf8689f 100644 --- a/server/api/intSalesforceAccount/index.js +++ b/server/api/intSalesforceAccount/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intSalesforceAccount.controller','get','isAuthenticated','index','/:id','show','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','destroy','exports','multer','util','path'];(function(_0x944045,_0x343d55){var _0x7d29f4=function(_0xac25fc){while(--_0xac25fc){_0x944045['push'](_0x944045['shift']());}};_0x7d29f4(++_0x343d55);}(_0x9957,0x93));var _0x7995=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x9957[_0x4cf98e];return _0x1623ac;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x11')]('/',auth['isAuthenticated'](),controller[_0x7995('0x12')]);router[_0x7995('0x11')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x14')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router[_0x7995('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x7995('0x17')]);module[_0x7995('0x18')]=router; \ No newline at end of file +var _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceAccount.controller','get','index','/:id','getConfigurations','/:id/fields','isAuthenticated','getFields','post','addConfiguration','put','update','destroy','exports','multer','util','path'];(function(_0x1df980,_0x2bb80a){var _0x3d0e9a=function(_0x447ce9){while(--_0x447ce9){_0x1df980['push'](_0x1df980['shift']());}};_0x3d0e9a(++_0x2bb80a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x311c35,_0x534915){_0x311c35=_0x311c35-0x0;var _0x5cc50c=_0xa9e0[_0x311c35];return _0x5cc50c;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/configurations',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')]('/',auth['isAuthenticated'](),controller['create']);router['post']('/:id/configurations',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x11')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x12')]);router['delete'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);module[_0x0a9e('0x14')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js b/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js index 76184f3..cff6103 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 _0xd9b4=['sequelize','exports','STRING','username','ENUM','integrationTab','newTab'];(function(_0x368fb9,_0x1a9895){var _0x4892fb=function(_0x28d735){while(--_0x28d735){_0x368fb9['push'](_0x368fb9['shift']());}};_0x4892fb(++_0x1a9895);}(_0xd9b4,0x1c0));var _0x4d9b=function(_0x3f9aeb,_0x231e27){_0x3f9aeb=_0x3f9aeb-0x0;var _0x1772b4=_0xd9b4[_0x3f9aeb];return _0x1772b4;};'use strict';var Sequelize=require(_0x4d9b('0x0'));module[_0x4d9b('0x1')]={'name':{'type':Sequelize[_0x4d9b('0x2')]},'description':{'type':Sequelize[_0x4d9b('0x2')]},'username':{'type':Sequelize[_0x4d9b('0x2')],'unique':_0x4d9b('0x3')},'remoteUri':{'type':Sequelize[_0x4d9b('0x2')]},'password':{'type':Sequelize[_0x4d9b('0x2')]},'clientId':{'type':Sequelize['STRING']},'clientSecret':{'type':Sequelize['STRING']},'securityToken':{'type':Sequelize[_0x4d9b('0x2')]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x4d9b('0x4')](_0x4d9b('0x5'),_0x4d9b('0x6')),'defaultValue':_0x4d9b('0x5')}}; \ No newline at end of file +var _0x6d38=['exports','STRING','ENUM','integrationTab','newTab'];(function(_0x50856f,_0x262f2c){var _0x505ca2=function(_0x4df2f2){while(--_0x4df2f2){_0x50856f['push'](_0x50856f['shift']());}};_0x505ca2(++_0x262f2c);}(_0x6d38,0x1ef));var _0x86d3=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0x6d38[_0x465028];return _0xb783d4;};'use strict';var Sequelize=require('sequelize');module[_0x86d3('0x0')]={'name':{'type':Sequelize[_0x86d3('0x1')]},'description':{'type':Sequelize[_0x86d3('0x1')]},'username':{'type':Sequelize['STRING'],'unique':'username'},'remoteUri':{'type':Sequelize[_0x86d3('0x1')]},'password':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize[_0x86d3('0x1')]},'clientSecret':{'type':Sequelize[_0x86d3('0x1')]},'securityToken':{'type':Sequelize[_0x86d3('0x1')]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x86d3('0x2')](_0x86d3('0x3'),_0x86d3('0x4')),'defaultValue':_0x86d3('0x3')}}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.controller.js b/server/api/intSalesforceAccount/intSalesforceAccount.controller.js index 6578079..8574da2 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 _0xe7ae=['lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','reject','save','then','stack','name','index','map','SalesforceAccount','rawAttributes','fieldName','type','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filters','filter','VIRTUAL','merge','count','includeAll','include','findAll','rows','show','params','keys','options','find','catch','create','body','update','destroy','getConfigurations','findOne','SalesforceConfiguration','order','addConfiguration','Subjects','getSubjects','channel','Descriptions','getDescriptions','SalesforceField','getFields','clientId','clientSecret','username','password','securityToken','remoteUri','slice','lastIndexOf','login','concat','isNil','ticketType','sobject','describe','IsReminderSet','IsRecurrence','Subject','Description','string','int','picklist','boolean','email','textarea','phone','remove','includes','label','custom','picklistValues','value','False','false','test','statusCode','error','send','Wrong\x20credentials','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','to-csv','fs-extra'];(function(_0x88849c,_0x37dd09){var _0x296b57=function(_0x292205){while(--_0x292205){_0x88849c['push'](_0x88849c['shift']());}};_0x296b57(++_0x37dd09);}(_0xe7ae,0x1ed));var _0xee7a=function(_0x440d30,_0x397fd8){_0x440d30=_0x440d30-0x0;var _0x38971c=_0xe7ae[_0x440d30];return _0x38971c;};'use strict';var emlformat=require(_0xee7a('0x0'));var rimraf=require(_0xee7a('0x1'));var zipdir=require(_0xee7a('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xee7a('0x3'));var moment=require(_0xee7a('0x4'));var BPromise=require(_0xee7a('0x5'));var Mustache=require(_0xee7a('0x6'));var util=require(_0xee7a('0x7'));var path=require(_0xee7a('0x8'));var sox=require('sox');var csv=require(_0xee7a('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xee7a('0xa'));var _=require(_0xee7a('0xb'));var squel=require(_0xee7a('0xc'));var crypto=require(_0xee7a('0xd'));var jsforce=require(_0xee7a('0xe'));var deskjs=require(_0xee7a('0xf'));var toCsv=require(_0xee7a('0x9'));var querystring=require(_0xee7a('0x10'));var Papa=require(_0xee7a('0x11'));var Redis=require(_0xee7a('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xee7a('0x13'));var as=require(_0xee7a('0x14'));var hardwareService=require(_0xee7a('0x15'));var logger=require('../../config/logger')(_0xee7a('0x16'));var utils=require(_0xee7a('0x17'));var config=require(_0xee7a('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xee7a('0x19'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x1e9402,_0x25347a){_0x25347a=_0x25347a||0xcc;return function(_0x54eacb){if(_0x54eacb){return _0x1e9402[_0xee7a('0x1a')](_0x25347a);}return _0x1e9402[_0xee7a('0x1b')](_0x25347a)[_0xee7a('0x1c')]();};}function respondWithResult(_0x5ddc4f,_0x4b1345){_0x4b1345=_0x4b1345||0xc8;return function(_0x4a19d3){if(_0x4a19d3){return _0x5ddc4f[_0xee7a('0x1b')](_0x4b1345)[_0xee7a('0x1d')](_0x4a19d3);}};}function respondWithFilteredResult(_0x2e8aca,_0x42119e){return function(_0x1b7366){if(_0x1b7366){var _0x4f3de5=typeof _0x42119e[_0xee7a('0x1e')]==='undefined'&&typeof _0x42119e[_0xee7a('0x1f')]==='undefined';var _0xbd4834=_0x1b7366['count'];var _0x3a084f=_0x4f3de5?0x0:_0x42119e[_0xee7a('0x1e')];var _0x2f3636=_0x4f3de5?_0x1b7366['count']:_0x42119e[_0xee7a('0x1e')]+_0x42119e[_0xee7a('0x1f')];var _0x278d0c;if(_0x2f3636>=_0xbd4834){_0x2f3636=_0xbd4834;_0x278d0c=0xc8;}else{_0x278d0c=0xce;}_0x2e8aca[_0xee7a('0x1b')](_0x278d0c);return _0x2e8aca[_0xee7a('0x20')](_0xee7a('0x21'),_0x3a084f+'-'+_0x2f3636+'/'+_0xbd4834)['json'](_0x1b7366);}return null;};}function patchUpdates(_0x177c0f){return function(_0x15f8b4){try{jsonpatch[_0xee7a('0x22')](_0x15f8b4,_0x177c0f,!![]);}catch(_0x5b7f5d){return BPromise[_0xee7a('0x23')](_0x5b7f5d);}return _0x15f8b4[_0xee7a('0x24')]();};}function saveUpdates(_0xd55040,_0x581acc){return function(_0x43c05d){if(_0x43c05d){return _0x43c05d['update'](_0xd55040)[_0xee7a('0x25')](function(_0x59b447){return _0x59b447;});}return null;};}function removeEntity(_0x414c30,_0x4107e4){return function(_0x57d1b2){if(_0x57d1b2){return _0x57d1b2['destroy']()['then'](function(){_0x414c30[_0xee7a('0x1b')](0xcc)[_0xee7a('0x1c')]();});}};}function handleEntityNotFound(_0x1b4673,_0x30b71b){return function(_0x75e692){if(!_0x75e692){_0x1b4673['sendStatus'](0x194);}return _0x75e692;};}function handleError(_0x297aab,_0x4215a){_0x4215a=_0x4215a||0x1f4;return function(_0x325b55){logger['error'](_0x325b55[_0xee7a('0x26')]);if(_0x325b55[_0xee7a('0x27')]){delete _0x325b55[_0xee7a('0x27')];}_0x297aab[_0xee7a('0x1b')](_0x4215a)['send'](_0x325b55);};}exports[_0xee7a('0x28')]=function(_0x4ce5c9,_0x39e8a8){var _0x16b3d9={},_0x5adaed={},_0x7fd821={'count':0x0,'rows':[]};var _0x30bde9=_[_0xee7a('0x29')](db[_0xee7a('0x2a')][_0xee7a('0x2b')],function(_0x3d0640){return{'name':_0x3d0640[_0xee7a('0x2c')],'type':_0x3d0640[_0xee7a('0x2d')]['key']};});_0x5adaed[_0xee7a('0x2e')]=_[_0xee7a('0x29')](_0x30bde9,_0xee7a('0x27'));_0x5adaed[_0xee7a('0x2f')]=_['keys'](_0x4ce5c9[_0xee7a('0x2f')]);_0x5adaed['filters']=_[_0xee7a('0x30')](_0x5adaed[_0xee7a('0x2e')],_0x5adaed[_0xee7a('0x2f')]);_0x16b3d9[_0xee7a('0x31')]=_[_0xee7a('0x30')](_0x5adaed['model'],qs[_0xee7a('0x32')](_0x4ce5c9[_0xee7a('0x2f')]['fields']));_0x16b3d9[_0xee7a('0x31')]=_0x16b3d9['attributes'][_0xee7a('0x33')]?_0x16b3d9[_0xee7a('0x31')]:_0x5adaed[_0xee7a('0x2e')];if(!_0x4ce5c9[_0xee7a('0x2f')][_0xee7a('0x34')](_0xee7a('0x35'))){_0x16b3d9[_0xee7a('0x1f')]=qs[_0xee7a('0x1f')](_0x4ce5c9['query'][_0xee7a('0x1f')]);_0x16b3d9[_0xee7a('0x1e')]=qs[_0xee7a('0x1e')](_0x4ce5c9[_0xee7a('0x2f')][_0xee7a('0x1e')]);}_0x16b3d9['order']=qs[_0xee7a('0x36')](_0x4ce5c9[_0xee7a('0x2f')][_0xee7a('0x36')]);_0x16b3d9[_0xee7a('0x37')]=qs['filters'](_[_0xee7a('0x38')](_0x4ce5c9['query'],_0x5adaed[_0xee7a('0x39')]),_0x30bde9);if(_0x4ce5c9[_0xee7a('0x2f')][_0xee7a('0x3a')]){_0x16b3d9[_0xee7a('0x37')]=_['merge'](_0x16b3d9['where'],{'$or':_[_0xee7a('0x29')](_0x30bde9,function(_0xb09bc2){if(_0xb09bc2[_0xee7a('0x2d')]!==_0xee7a('0x3b')){var _0x39caf6={};_0x39caf6[_0xb09bc2[_0xee7a('0x27')]]={'$like':'%'+_0x4ce5c9['query'][_0xee7a('0x3a')]+'%'};return _0x39caf6;}})});}_0x16b3d9=_[_0xee7a('0x3c')]({},_0x16b3d9,_0x4ce5c9['options']);var _0x3c7489={'where':_0x16b3d9[_0xee7a('0x37')]};return db[_0xee7a('0x2a')]['count'](_0x3c7489)[_0xee7a('0x25')](function(_0x2f808f){_0x7fd821[_0xee7a('0x3d')]=_0x2f808f;if(_0x4ce5c9['query'][_0xee7a('0x3e')]){_0x16b3d9[_0xee7a('0x3f')]=[{'all':!![]}];}return db[_0xee7a('0x2a')][_0xee7a('0x40')](_0x16b3d9);})[_0xee7a('0x25')](function(_0x204f31){_0x7fd821[_0xee7a('0x41')]=_0x204f31;return _0x7fd821;})['then'](respondWithFilteredResult(_0x39e8a8,_0x16b3d9))['catch'](handleError(_0x39e8a8,null));};exports[_0xee7a('0x42')]=function(_0x5102a3,_0x2cdfa7){var _0x1970e8={'raw':![],'where':{'id':_0x5102a3[_0xee7a('0x43')]['id']}},_0x1d5b0f={};_0x1d5b0f[_0xee7a('0x2e')]=_[_0xee7a('0x44')](db[_0xee7a('0x2a')]['rawAttributes']);_0x1d5b0f[_0xee7a('0x2f')]=_[_0xee7a('0x44')](_0x5102a3[_0xee7a('0x2f')]);_0x1d5b0f['filters']=_[_0xee7a('0x30')](_0x1d5b0f[_0xee7a('0x2e')],_0x1d5b0f['query']);_0x1970e8[_0xee7a('0x31')]=_['intersection'](_0x1d5b0f[_0xee7a('0x2e')],qs[_0xee7a('0x32')](_0x5102a3[_0xee7a('0x2f')][_0xee7a('0x32')]));_0x1970e8[_0xee7a('0x31')]=_0x1970e8[_0xee7a('0x31')][_0xee7a('0x33')]?_0x1970e8[_0xee7a('0x31')]:_0x1d5b0f[_0xee7a('0x2e')];if(_0x5102a3[_0xee7a('0x2f')][_0xee7a('0x3e')]){_0x1970e8[_0xee7a('0x3f')]=[{'all':!![]}];}_0x1970e8=_['merge']({},_0x1970e8,_0x5102a3[_0xee7a('0x45')]);return db[_0xee7a('0x2a')][_0xee7a('0x46')](_0x1970e8)[_0xee7a('0x25')](handleEntityNotFound(_0x2cdfa7,null))['then'](respondWithResult(_0x2cdfa7,null))[_0xee7a('0x47')](handleError(_0x2cdfa7,null));};exports[_0xee7a('0x48')]=function(_0x39c669,_0x3a906b){return db[_0xee7a('0x2a')][_0xee7a('0x48')](_0x39c669[_0xee7a('0x49')],{})[_0xee7a('0x25')](respondWithResult(_0x3a906b,0xc9))[_0xee7a('0x47')](handleError(_0x3a906b,null));};exports[_0xee7a('0x4a')]=function(_0x20f7c4,_0x4b49f6){if(_0x20f7c4[_0xee7a('0x49')]['id']){delete _0x20f7c4[_0xee7a('0x49')]['id'];}return db[_0xee7a('0x2a')][_0xee7a('0x46')]({'where':{'id':_0x20f7c4[_0xee7a('0x43')]['id']}})[_0xee7a('0x25')](handleEntityNotFound(_0x4b49f6,null))[_0xee7a('0x25')](saveUpdates(_0x20f7c4[_0xee7a('0x49')],null))[_0xee7a('0x25')](respondWithResult(_0x4b49f6,null))[_0xee7a('0x47')](handleError(_0x4b49f6,null));};exports[_0xee7a('0x4b')]=function(_0x279b03,_0xe4c8ea){return db[_0xee7a('0x2a')]['find']({'where':{'id':_0x279b03[_0xee7a('0x43')]['id']}})[_0xee7a('0x25')](handleEntityNotFound(_0xe4c8ea,null))['then'](removeEntity(_0xe4c8ea,null))['catch'](handleError(_0xe4c8ea,null));};exports[_0xee7a('0x4c')]=function(_0x1e93dd,_0x3c6cb5,_0x47511d){var _0x3d40dc={};var _0x2a6f5a={};var _0xe0cc5e;var _0x1d7768;return db['SalesforceAccount'][_0xee7a('0x4d')]({'where':{'id':_0x1e93dd[_0xee7a('0x43')]['id']}})[_0xee7a('0x25')](handleEntityNotFound(_0x3c6cb5,null))[_0xee7a('0x25')](function(_0x579846){if(_0x579846){_0xe0cc5e=_0x579846;_0x2a6f5a['model']=_['keys'](db[_0xee7a('0x4e')][_0xee7a('0x2b')]);_0x2a6f5a['query']=_[_0xee7a('0x44')](_0x1e93dd[_0xee7a('0x2f')]);_0x2a6f5a[_0xee7a('0x39')]=_['intersection'](_0x2a6f5a['model'],_0x2a6f5a[_0xee7a('0x2f')]);_0x3d40dc[_0xee7a('0x31')]=_[_0xee7a('0x30')](_0x2a6f5a[_0xee7a('0x2e')],qs[_0xee7a('0x32')](_0x1e93dd[_0xee7a('0x2f')][_0xee7a('0x32')]));_0x3d40dc['attributes']=_0x3d40dc['attributes'][_0xee7a('0x33')]?_0x3d40dc['attributes']:_0x2a6f5a['model'];_0x3d40dc[_0xee7a('0x4f')]=qs['sort'](_0x1e93dd[_0xee7a('0x2f')][_0xee7a('0x36')]);_0x3d40dc[_0xee7a('0x37')]=qs[_0xee7a('0x39')](_[_0xee7a('0x38')](_0x1e93dd[_0xee7a('0x2f')],_0x2a6f5a['filters']));if(_0x1e93dd[_0xee7a('0x2f')]['filter']){_0x3d40dc[_0xee7a('0x37')]=_[_0xee7a('0x3c')](_0x3d40dc[_0xee7a('0x37')],{'$or':_[_0xee7a('0x29')](_0x3d40dc[_0xee7a('0x31')],function(_0x55657c){var _0x309945={};_0x309945[_0x55657c]={'$like':'%'+_0x1e93dd[_0xee7a('0x2f')][_0xee7a('0x3a')]+'%'};return _0x309945;})});}_0x3d40dc=_[_0xee7a('0x3c')]({},_0x3d40dc,_0x1e93dd[_0xee7a('0x45')]);return _0xe0cc5e[_0xee7a('0x4c')](_0x3d40dc);}})['then'](function(_0x40118b){if(_0x40118b){_0x1d7768=_0x40118b['length'];if(!_0x1e93dd[_0xee7a('0x2f')][_0xee7a('0x34')](_0xee7a('0x35'))){_0x3d40dc[_0xee7a('0x1f')]=qs[_0xee7a('0x1f')](_0x1e93dd[_0xee7a('0x2f')][_0xee7a('0x1f')]);_0x3d40dc['offset']=qs[_0xee7a('0x1e')](_0x1e93dd['query'][_0xee7a('0x1e')]);}return _0xe0cc5e['getConfigurations'](_0x3d40dc);}})['then'](function(_0x5af1b1){if(_0x5af1b1){return _0x5af1b1?{'count':_0x1d7768,'rows':_0x5af1b1}:null;}})['then'](respondWithResult(_0x3c6cb5,null))[_0xee7a('0x47')](handleError(_0x3c6cb5,null));};exports[_0xee7a('0x50')]=function(_0x3492f1,_0x7e53c0,_0x297762){if(_0x3492f1[_0xee7a('0x49')]['id']){delete _0x3492f1[_0xee7a('0x49')]['id'];}return db[_0xee7a('0x2a')]['findOne']({'where':{'id':_0x3492f1[_0xee7a('0x43')]['id']}})[_0xee7a('0x25')](handleEntityNotFound(_0x7e53c0,null))[_0xee7a('0x25')](function(_0x1850d0){if(_0x1850d0){_0x3492f1[_0xee7a('0x49')]['AccountId']=_0x1850d0['id'];_0x3492f1['body'][_0xee7a('0x51')]=integrations[_0xee7a('0x52')](_0x3492f1[_0xee7a('0x49')][_0xee7a('0x53')],_0x3492f1[_0xee7a('0x49')][_0xee7a('0x2d')]);_0x3492f1[_0xee7a('0x49')][_0xee7a('0x54')]=integrations[_0xee7a('0x55')](_0x3492f1['body'][_0xee7a('0x53')],_0x3492f1[_0xee7a('0x49')][_0xee7a('0x2d')]);return db[_0xee7a('0x4e')][_0xee7a('0x48')](_0x3492f1['body'],{'include':[{'model':db['SalesforceField'],'as':_0xee7a('0x51')},{'model':db[_0xee7a('0x56')],'as':_0xee7a('0x54')}]});}return null;})[_0xee7a('0x25')](respondWithResult(_0x7e53c0,null))[_0xee7a('0x47')](handleError(_0x7e53c0,null));};exports[_0xee7a('0x57')]=function(_0x31927c,_0x261ede,_0x3d9c60){var _0x615c50;var _0x554da1='';var _0xa54551='Task';return db[_0xee7a('0x2a')][_0xee7a('0x4d')]({'where':{'id':_0x31927c[_0xee7a('0x43')]['id']},'attributes':['id','remoteUri',_0xee7a('0x58'),_0xee7a('0x59'),_0xee7a('0x5a'),_0xee7a('0x5b'),_0xee7a('0x5c')]})['then'](handleEntityNotFound(_0x261ede,null))[_0xee7a('0x25')](function(_0x1142d2){if(_0x1142d2){_0x554da1=_0x1142d2[_0xee7a('0x5d')];var _0x4c46ca=_0x554da1[_0xee7a('0x5e')](-0x1);if(_0x4c46ca==='/'){_0x554da1=_0x554da1['substring'](0x0,_0x554da1[_0xee7a('0x5f')](_0x4c46ca));}_0x615c50=new jsforce['Connection']({'oauth2':{'loginUrl':_0x554da1,'clientId':_0x1142d2[_0xee7a('0x58')],'clientSecret':_0x1142d2['clientSecret']}});return _0x615c50[_0xee7a('0x60')](_0x1142d2['username'],_0x1142d2[_0xee7a('0x5b')][_0xee7a('0x61')](_0x1142d2['securityToken']));}})[_0xee7a('0x25')](function(_0x567235){if(_0x567235){if(!_[_0xee7a('0x62')](_0x31927c[_0xee7a('0x2f')][_0xee7a('0x63')])){_0xa54551=_0x31927c[_0xee7a('0x2f')]['ticketType'];}return _0x615c50[_0xee7a('0x64')](_0xa54551)[_0xee7a('0x65')]();}})['then'](function(_0x2a8ddf){var _0x3da686=['OwnerId','ActivityDate',_0xee7a('0x66'),_0xee7a('0x67'),_0xee7a('0x68'),_0xee7a('0x69')];var _0x249768=[_0xee7a('0x6a'),_0xee7a('0x6b'),_0xee7a('0x6c'),_0xee7a('0x6d'),_0xee7a('0x6e'),_0xee7a('0x6f'),_0xee7a('0x70')];if(_0x2a8ddf){_[_0xee7a('0x71')](_0x2a8ddf['fields'],function(_0x5232b4){return _0x3da686[_0xee7a('0x72')](_0x5232b4[_0xee7a('0x27')])||!_0x249768['includes'](_0x5232b4[_0xee7a('0x2d')]);});return{'count':_0x2a8ddf['fields'][_0xee7a('0x33')],'rows':_[_0xee7a('0x29')](_0x2a8ddf[_0xee7a('0x32')],function(_0x4131b3){return{'id':_0x4131b3['name'],'name':_0x4131b3[_0xee7a('0x73')],'custom':_0x4131b3[_0xee7a('0x74')],'options':_0x4131b3[_0xee7a('0x75')][_0xee7a('0x33')]>0x0?_[_0xee7a('0x29')](_0x4131b3[_0xee7a('0x75')],function(_0x458ade){return{'name':_0x458ade[_0xee7a('0x73')],'value':_0x458ade[_0xee7a('0x76')]};}):_0x4131b3[_0xee7a('0x2d')]==_0xee7a('0x6d')?[{'name':'True','value':'true'},{'name':_0xee7a('0x77'),'value':_0xee7a('0x78')}]:[]};})};}})[_0xee7a('0x25')](respondWithResult(_0x261ede,null))[_0xee7a('0x47')](function(_0x201acb){var _0x565ca8=_0x31927c['query'][_0xee7a('0x79')]?0x1f4:_0x201acb[_0xee7a('0x7a')]||0x1f4;logger[_0xee7a('0x7b')]('getFields,\x20%s,\x20%s,\x20%s',_0xee7a('0x57'),_0x565ca8,JSON['stringify'](_0x201acb));delete _0x201acb[_0xee7a('0x27')];if(_0x565ca8===0x191){_0x565ca8=0x190;}_0x261ede[_0xee7a('0x1b')](_0x565ca8)[_0xee7a('0x7c')](_0x31927c[_0xee7a('0x2f')]['test']?{'message':_0xee7a('0x7d'),'statusCode':_0x201acb['statusCode']}:_0x201acb);});}; \ No newline at end of file +var _0xe685=['error','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','rimraf','moment','bluebird','mustache','util','to-csv','ejs','lodash','squel','crypto','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','then','name','send','map','SalesforceAccount','fieldName','type','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','where','pick','filter','merge','VIRTUAL','includeAll','include','rows','show','params','rawAttributes','options','find','catch','create','body','getConfigurations','findOne','SalesforceConfiguration','order','sort','nolimit','addConfiguration','Subjects','getSubjects','channel','Descriptions','getDescriptions','SalesforceField','getFields','remoteUri','clientId','clientSecret','username','password','securityToken','slice','Connection','login','concat','ticketType','sobject','ActivityDate','IsReminderSet','IsRecurrence','Subject','string','int','picklist','boolean','email','textarea','includes','label','custom','value','True','false','test','statusCode'];(function(_0x51f111,_0x52357b){var _0x572dd2=function(_0x501431){while(--_0x501431){_0x51f111['push'](_0x51f111['shift']());}};_0x572dd2(++_0x52357b);}(_0xe685,0xea));var _0x5e68=function(_0x5bc773,_0x5b0e17){_0x5bc773=_0x5bc773-0x0;var _0x10cf24=_0xe685[_0x5bc773];return _0x10cf24;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5e68('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x5e68('0x1'));var BPromise=require(_0x5e68('0x2'));var Mustache=require(_0x5e68('0x3'));var util=require(_0x5e68('0x4'));var path=require('path');var sox=require('sox');var csv=require(_0x5e68('0x5'));var ejs=require(_0x5e68('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x5e68('0x7'));var squel=require(_0x5e68('0x8'));var crypto=require(_0x5e68('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x5e68('0xa'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x5e68('0xb'));var Redis=require('ioredis');var authService=require(_0x5e68('0xc'));var qs=require(_0x5e68('0xd'));var as=require(_0x5e68('0xe'));var hardwareService=require(_0x5e68('0xf'));var logger=require(_0x5e68('0x10'))('api');var utils=require(_0x5e68('0x11'));var config=require(_0x5e68('0x12'));var licenseUtil=require(_0x5e68('0x13'));var db=require('../../mysqldb')['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x291fa7,_0x2554c3){_0x2554c3=_0x2554c3||0xcc;return function(_0x38ff33){if(_0x38ff33){return _0x291fa7[_0x5e68('0x14')](_0x2554c3);}return _0x291fa7[_0x5e68('0x15')](_0x2554c3)[_0x5e68('0x16')]();};}function respondWithResult(_0x4208d7,_0x1bdb60){_0x1bdb60=_0x1bdb60||0xc8;return function(_0x465783){if(_0x465783){return _0x4208d7['status'](_0x1bdb60)[_0x5e68('0x17')](_0x465783);}};}function respondWithFilteredResult(_0x353819,_0x481c8c){return function(_0x1d4abe){if(_0x1d4abe){var _0x16d0ef=typeof _0x481c8c[_0x5e68('0x18')]===_0x5e68('0x19')&&typeof _0x481c8c[_0x5e68('0x1a')]==='undefined';var _0x5455b5=_0x1d4abe[_0x5e68('0x1b')];var _0x47bc04=_0x16d0ef?0x0:_0x481c8c[_0x5e68('0x18')];var _0x4b9d65=_0x16d0ef?_0x1d4abe[_0x5e68('0x1b')]:_0x481c8c[_0x5e68('0x18')]+_0x481c8c[_0x5e68('0x1a')];var _0x3ef5d6;if(_0x4b9d65>=_0x5455b5){_0x4b9d65=_0x5455b5;_0x3ef5d6=0xc8;}else{_0x3ef5d6=0xce;}_0x353819[_0x5e68('0x15')](_0x3ef5d6);return _0x353819[_0x5e68('0x1c')](_0x5e68('0x1d'),_0x47bc04+'-'+_0x4b9d65+'/'+_0x5455b5)['json'](_0x1d4abe);}return null;};}function patchUpdates(_0x2ed0a7){return function(_0x42be03){try{jsonpatch[_0x5e68('0x1e')](_0x42be03,_0x2ed0a7,!![]);}catch(_0x5b2dc5){return BPromise[_0x5e68('0x1f')](_0x5b2dc5);}return _0x42be03[_0x5e68('0x20')]();};}function saveUpdates(_0x194ccc,_0xed6bef){return function(_0x5afd12){if(_0x5afd12){return _0x5afd12[_0x5e68('0x21')](_0x194ccc)['then'](function(_0x1094b6){return _0x1094b6;});}return null;};}function removeEntity(_0x27a5b0,_0x640f4c){return function(_0x44da71){if(_0x44da71){return _0x44da71[_0x5e68('0x22')]()[_0x5e68('0x23')](function(){_0x27a5b0[_0x5e68('0x15')](0xcc)[_0x5e68('0x16')]();});}};}function handleEntityNotFound(_0x288084,_0x57ec6b){return function(_0xa6496a){if(!_0xa6496a){_0x288084[_0x5e68('0x14')](0x194);}return _0xa6496a;};}function handleError(_0x449ca6,_0x4c3dc1){_0x4c3dc1=_0x4c3dc1||0x1f4;return function(_0x2c9a27){logger['error'](_0x2c9a27['stack']);if(_0x2c9a27[_0x5e68('0x24')]){delete _0x2c9a27['name'];}_0x449ca6[_0x5e68('0x15')](_0x4c3dc1)[_0x5e68('0x25')](_0x2c9a27);};}exports['index']=function(_0x223284,_0x54a495){var _0x2eb50f={},_0x5003d3={},_0x4d320b={'count':0x0,'rows':[]};var _0x321b6f=_[_0x5e68('0x26')](db[_0x5e68('0x27')]['rawAttributes'],function(_0x2e1028){return{'name':_0x2e1028[_0x5e68('0x28')],'type':_0x2e1028[_0x5e68('0x29')]['key']};});_0x5003d3['model']=_['map'](_0x321b6f,'name');_0x5003d3[_0x5e68('0x2a')]=_[_0x5e68('0x2b')](_0x223284['query']);_0x5003d3[_0x5e68('0x2c')]=_[_0x5e68('0x2d')](_0x5003d3['model'],_0x5003d3[_0x5e68('0x2a')]);_0x2eb50f['attributes']=_[_0x5e68('0x2d')](_0x5003d3[_0x5e68('0x2e')],qs[_0x5e68('0x2f')](_0x223284['query'][_0x5e68('0x2f')]));_0x2eb50f[_0x5e68('0x30')]=_0x2eb50f[_0x5e68('0x30')][_0x5e68('0x31')]?_0x2eb50f['attributes']:_0x5003d3[_0x5e68('0x2e')];if(!_0x223284[_0x5e68('0x2a')][_0x5e68('0x32')]('nolimit')){_0x2eb50f[_0x5e68('0x1a')]=qs[_0x5e68('0x1a')](_0x223284[_0x5e68('0x2a')][_0x5e68('0x1a')]);_0x2eb50f[_0x5e68('0x18')]=qs['offset'](_0x223284['query'][_0x5e68('0x18')]);}_0x2eb50f['order']=qs['sort'](_0x223284[_0x5e68('0x2a')]['sort']);_0x2eb50f[_0x5e68('0x33')]=qs[_0x5e68('0x2c')](_[_0x5e68('0x34')](_0x223284[_0x5e68('0x2a')],_0x5003d3[_0x5e68('0x2c')]),_0x321b6f);if(_0x223284['query'][_0x5e68('0x35')]){_0x2eb50f['where']=_[_0x5e68('0x36')](_0x2eb50f['where'],{'$or':_[_0x5e68('0x26')](_0x321b6f,function(_0x29b88b){if(_0x29b88b['type']!==_0x5e68('0x37')){var _0x30ff75={};_0x30ff75[_0x29b88b[_0x5e68('0x24')]]={'$like':'%'+_0x223284[_0x5e68('0x2a')]['filter']+'%'};return _0x30ff75;}})});}_0x2eb50f=_[_0x5e68('0x36')]({},_0x2eb50f,_0x223284['options']);var _0xf8f665={'where':_0x2eb50f['where']};return db[_0x5e68('0x27')][_0x5e68('0x1b')](_0xf8f665)[_0x5e68('0x23')](function(_0x138484){_0x4d320b[_0x5e68('0x1b')]=_0x138484;if(_0x223284[_0x5e68('0x2a')][_0x5e68('0x38')]){_0x2eb50f[_0x5e68('0x39')]=[{'all':!![]}];}return db['SalesforceAccount']['findAll'](_0x2eb50f);})[_0x5e68('0x23')](function(_0x18fcb9){_0x4d320b[_0x5e68('0x3a')]=_0x18fcb9;return _0x4d320b;})[_0x5e68('0x23')](respondWithFilteredResult(_0x54a495,_0x2eb50f))['catch'](handleError(_0x54a495,null));};exports[_0x5e68('0x3b')]=function(_0x53e721,_0x2c2674){var _0xc4b15={'raw':![],'where':{'id':_0x53e721[_0x5e68('0x3c')]['id']}},_0x46a45e={};_0x46a45e[_0x5e68('0x2e')]=_[_0x5e68('0x2b')](db[_0x5e68('0x27')][_0x5e68('0x3d')]);_0x46a45e['query']=_[_0x5e68('0x2b')](_0x53e721[_0x5e68('0x2a')]);_0x46a45e[_0x5e68('0x2c')]=_[_0x5e68('0x2d')](_0x46a45e['model'],_0x46a45e['query']);_0xc4b15[_0x5e68('0x30')]=_['intersection'](_0x46a45e[_0x5e68('0x2e')],qs['fields'](_0x53e721[_0x5e68('0x2a')]['fields']));_0xc4b15[_0x5e68('0x30')]=_0xc4b15[_0x5e68('0x30')][_0x5e68('0x31')]?_0xc4b15[_0x5e68('0x30')]:_0x46a45e[_0x5e68('0x2e')];if(_0x53e721[_0x5e68('0x2a')][_0x5e68('0x38')]){_0xc4b15['include']=[{'all':!![]}];}_0xc4b15=_[_0x5e68('0x36')]({},_0xc4b15,_0x53e721[_0x5e68('0x3e')]);return db[_0x5e68('0x27')][_0x5e68('0x3f')](_0xc4b15)[_0x5e68('0x23')](handleEntityNotFound(_0x2c2674,null))[_0x5e68('0x23')](respondWithResult(_0x2c2674,null))[_0x5e68('0x40')](handleError(_0x2c2674,null));};exports[_0x5e68('0x41')]=function(_0x155ec6,_0x58f7b4){return db[_0x5e68('0x27')][_0x5e68('0x41')](_0x155ec6[_0x5e68('0x42')],{})[_0x5e68('0x23')](respondWithResult(_0x58f7b4,0xc9))[_0x5e68('0x40')](handleError(_0x58f7b4,null));};exports[_0x5e68('0x21')]=function(_0x1f45b0,_0x49dfd1){if(_0x1f45b0[_0x5e68('0x42')]['id']){delete _0x1f45b0['body']['id'];}return db[_0x5e68('0x27')][_0x5e68('0x3f')]({'where':{'id':_0x1f45b0[_0x5e68('0x3c')]['id']}})[_0x5e68('0x23')](handleEntityNotFound(_0x49dfd1,null))[_0x5e68('0x23')](saveUpdates(_0x1f45b0[_0x5e68('0x42')],null))[_0x5e68('0x23')](respondWithResult(_0x49dfd1,null))['catch'](handleError(_0x49dfd1,null));};exports[_0x5e68('0x22')]=function(_0x180efb,_0xcbefdd){return db[_0x5e68('0x27')][_0x5e68('0x3f')]({'where':{'id':_0x180efb['params']['id']}})[_0x5e68('0x23')](handleEntityNotFound(_0xcbefdd,null))[_0x5e68('0x23')](removeEntity(_0xcbefdd,null))[_0x5e68('0x40')](handleError(_0xcbefdd,null));};exports[_0x5e68('0x43')]=function(_0x234f0c,_0x1420f3,_0x160af1){var _0x3e9556={};var _0x3cbde2={};var _0x51a599;var _0x58d9b8;return db[_0x5e68('0x27')][_0x5e68('0x44')]({'where':{'id':_0x234f0c[_0x5e68('0x3c')]['id']}})[_0x5e68('0x23')](handleEntityNotFound(_0x1420f3,null))[_0x5e68('0x23')](function(_0x58171c){if(_0x58171c){_0x51a599=_0x58171c;_0x3cbde2['model']=_['keys'](db[_0x5e68('0x45')][_0x5e68('0x3d')]);_0x3cbde2['query']=_[_0x5e68('0x2b')](_0x234f0c[_0x5e68('0x2a')]);_0x3cbde2[_0x5e68('0x2c')]=_[_0x5e68('0x2d')](_0x3cbde2[_0x5e68('0x2e')],_0x3cbde2[_0x5e68('0x2a')]);_0x3e9556[_0x5e68('0x30')]=_[_0x5e68('0x2d')](_0x3cbde2['model'],qs[_0x5e68('0x2f')](_0x234f0c['query']['fields']));_0x3e9556['attributes']=_0x3e9556[_0x5e68('0x30')]['length']?_0x3e9556[_0x5e68('0x30')]:_0x3cbde2[_0x5e68('0x2e')];_0x3e9556[_0x5e68('0x46')]=qs['sort'](_0x234f0c['query'][_0x5e68('0x47')]);_0x3e9556['where']=qs[_0x5e68('0x2c')](_[_0x5e68('0x34')](_0x234f0c[_0x5e68('0x2a')],_0x3cbde2[_0x5e68('0x2c')]));if(_0x234f0c['query'][_0x5e68('0x35')]){_0x3e9556['where']=_[_0x5e68('0x36')](_0x3e9556[_0x5e68('0x33')],{'$or':_[_0x5e68('0x26')](_0x3e9556[_0x5e68('0x30')],function(_0x5796c8){var _0x494c41={};_0x494c41[_0x5796c8]={'$like':'%'+_0x234f0c['query']['filter']+'%'};return _0x494c41;})});}_0x3e9556=_[_0x5e68('0x36')]({},_0x3e9556,_0x234f0c['options']);return _0x51a599['getConfigurations'](_0x3e9556);}})[_0x5e68('0x23')](function(_0x15e61b){if(_0x15e61b){_0x58d9b8=_0x15e61b[_0x5e68('0x31')];if(!_0x234f0c[_0x5e68('0x2a')][_0x5e68('0x32')](_0x5e68('0x48'))){_0x3e9556['limit']=qs['limit'](_0x234f0c[_0x5e68('0x2a')]['limit']);_0x3e9556[_0x5e68('0x18')]=qs[_0x5e68('0x18')](_0x234f0c[_0x5e68('0x2a')][_0x5e68('0x18')]);}return _0x51a599['getConfigurations'](_0x3e9556);}})[_0x5e68('0x23')](function(_0x481ae2){if(_0x481ae2){return _0x481ae2?{'count':_0x58d9b8,'rows':_0x481ae2}:null;}})[_0x5e68('0x23')](respondWithResult(_0x1420f3,null))[_0x5e68('0x40')](handleError(_0x1420f3,null));};exports[_0x5e68('0x49')]=function(_0x5791b0,_0x2a68b2,_0x33e1c3){if(_0x5791b0[_0x5e68('0x42')]['id']){delete _0x5791b0[_0x5e68('0x42')]['id'];}return db[_0x5e68('0x27')][_0x5e68('0x44')]({'where':{'id':_0x5791b0[_0x5e68('0x3c')]['id']}})[_0x5e68('0x23')](handleEntityNotFound(_0x2a68b2,null))[_0x5e68('0x23')](function(_0x1cba14){if(_0x1cba14){_0x5791b0[_0x5e68('0x42')]['AccountId']=_0x1cba14['id'];_0x5791b0[_0x5e68('0x42')][_0x5e68('0x4a')]=integrations[_0x5e68('0x4b')](_0x5791b0['body'][_0x5e68('0x4c')],_0x5791b0['body'][_0x5e68('0x29')]);_0x5791b0[_0x5e68('0x42')][_0x5e68('0x4d')]=integrations[_0x5e68('0x4e')](_0x5791b0[_0x5e68('0x42')]['channel'],_0x5791b0['body']['type']);return db[_0x5e68('0x45')][_0x5e68('0x41')](_0x5791b0[_0x5e68('0x42')],{'include':[{'model':db[_0x5e68('0x4f')],'as':_0x5e68('0x4a')},{'model':db[_0x5e68('0x4f')],'as':'Descriptions'}]});}return null;})[_0x5e68('0x23')](respondWithResult(_0x2a68b2,null))[_0x5e68('0x40')](handleError(_0x2a68b2,null));};exports[_0x5e68('0x50')]=function(_0x414e15,_0x523786,_0x5e0bd3){var _0x35a053;var _0x376a31='';var _0x36444f='Task';return db['SalesforceAccount'][_0x5e68('0x44')]({'where':{'id':_0x414e15[_0x5e68('0x3c')]['id']},'attributes':['id',_0x5e68('0x51'),_0x5e68('0x52'),_0x5e68('0x53'),_0x5e68('0x54'),_0x5e68('0x55'),_0x5e68('0x56')]})['then'](handleEntityNotFound(_0x523786,null))['then'](function(_0x357d81){if(_0x357d81){_0x376a31=_0x357d81[_0x5e68('0x51')];var _0x5064dc=_0x376a31[_0x5e68('0x57')](-0x1);if(_0x5064dc==='/'){_0x376a31=_0x376a31['substring'](0x0,_0x376a31['lastIndexOf'](_0x5064dc));}_0x35a053=new jsforce[(_0x5e68('0x58'))]({'oauth2':{'loginUrl':_0x376a31,'clientId':_0x357d81['clientId'],'clientSecret':_0x357d81['clientSecret']}});return _0x35a053[_0x5e68('0x59')](_0x357d81['username'],_0x357d81[_0x5e68('0x55')][_0x5e68('0x5a')](_0x357d81['securityToken']));}})[_0x5e68('0x23')](function(_0x2e641f){if(_0x2e641f){if(!_['isNil'](_0x414e15['query']['ticketType'])){_0x36444f=_0x414e15[_0x5e68('0x2a')][_0x5e68('0x5b')];}return _0x35a053[_0x5e68('0x5c')](_0x36444f)['describe']();}})[_0x5e68('0x23')](function(_0x2bb561){var _0x2a1cbc=['OwnerId',_0x5e68('0x5d'),_0x5e68('0x5e'),_0x5e68('0x5f'),_0x5e68('0x60'),'Description'];var _0x1fd199=[_0x5e68('0x61'),_0x5e68('0x62'),_0x5e68('0x63'),_0x5e68('0x64'),_0x5e68('0x65'),_0x5e68('0x66'),'phone'];if(_0x2bb561){_['remove'](_0x2bb561[_0x5e68('0x2f')],function(_0x83bd4e){return _0x2a1cbc['includes'](_0x83bd4e[_0x5e68('0x24')])||!_0x1fd199[_0x5e68('0x67')](_0x83bd4e[_0x5e68('0x29')]);});return{'count':_0x2bb561[_0x5e68('0x2f')][_0x5e68('0x31')],'rows':_[_0x5e68('0x26')](_0x2bb561['fields'],function(_0x42f246){return{'id':_0x42f246[_0x5e68('0x24')],'name':_0x42f246[_0x5e68('0x68')],'custom':_0x42f246[_0x5e68('0x69')],'options':_0x42f246['picklistValues'][_0x5e68('0x31')]>0x0?_[_0x5e68('0x26')](_0x42f246['picklistValues'],function(_0xd8cd99){return{'name':_0xd8cd99[_0x5e68('0x68')],'value':_0xd8cd99[_0x5e68('0x6a')]};}):_0x42f246[_0x5e68('0x29')]==_0x5e68('0x64')?[{'name':_0x5e68('0x6b'),'value':'true'},{'name':'False','value':_0x5e68('0x6c')}]:[]};})};}})[_0x5e68('0x23')](respondWithResult(_0x523786,null))[_0x5e68('0x40')](function(_0x5c06cb){var _0x1b7bae=_0x414e15[_0x5e68('0x2a')][_0x5e68('0x6d')]?0x1f4:_0x5c06cb[_0x5e68('0x6e')]||0x1f4;logger[_0x5e68('0x6f')](_0x5e68('0x70'),_0x5e68('0x50'),_0x1b7bae,JSON[_0x5e68('0x71')](_0x5c06cb));delete _0x5c06cb[_0x5e68('0x24')];if(_0x1b7bae===0x191){_0x1b7bae=0x190;}_0x523786['status'](_0x1b7bae)[_0x5e68('0x25')](_0x414e15['query'][_0x5e68('0x6d')]?{'message':_0x5e68('0x72'),'statusCode':_0x5c06cb['statusCode']}:_0x5c06cb);});}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.model.js b/server/api/intSalesforceAccount/intSalesforceAccount.model.js index f96b7f9..b0eab29 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 _0x9585=['define','SalesforceAccount','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intSalesforceAccount.attributes','exports'];(function(_0x24f7bf,_0x5ca676){var _0xb87006=function(_0x50cb2f){while(--_0x50cb2f){_0x24f7bf['push'](_0x24f7bf['shift']());}};_0xb87006(++_0x5ca676);}(_0x9585,0x15e));var _0x5958=function(_0x9188d3,_0x3b712e){_0x9188d3=_0x9188d3-0x0;var _0x5e5a0d=_0x9585[_0x9188d3];return _0x5e5a0d;};'use strict';var _=require('lodash');var util=require(_0x5958('0x0'));var logger=require('../../config/logger')(_0x5958('0x1'));var moment=require(_0x5958('0x2'));var BPromise=require(_0x5958('0x3'));var rp=require(_0x5958('0x4'));var fs=require('fs');var path=require(_0x5958('0x5'));var rimraf=require(_0x5958('0x6'));var config=require(_0x5958('0x7'));var attributes=require(_0x5958('0x8'));var integrations=require('../../components/integrations/configuration');module[_0x5958('0x9')]=function(_0x48ddaf,_0xc050d5){return _0x48ddaf[_0x5958('0xa')](_0x5958('0xb'),attributes,{'tableName':'int_salesforce_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd5fe=['bluebird','rimraf','../../config/environment','exports','define','SalesforceAccount','int_salesforce_accounts','lodash','util','api'];(function(_0x9aada2,_0xd2d349){var _0x196dff=function(_0x5ad061){while(--_0x5ad061){_0x9aada2['push'](_0x9aada2['shift']());}};_0x196dff(++_0xd2d349);}(_0xd5fe,0x1ab));var _0xed5f=function(_0x2dee2f,_0x19572f){_0x2dee2f=_0x2dee2f-0x0;var _0x327c18=_0xd5fe[_0x2dee2f];return _0x327c18;};'use strict';var _=require(_0xed5f('0x0'));var util=require(_0xed5f('0x1'));var logger=require('../../config/logger')(_0xed5f('0x2'));var moment=require('moment');var BPromise=require(_0xed5f('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xed5f('0x4'));var config=require(_0xed5f('0x5'));var attributes=require('./intSalesforceAccount.attributes');var integrations=require('../../components/integrations/configuration');module[_0xed5f('0x6')]=function(_0x20a6b9,_0x3a98a7){return _0x20a6b9[_0xed5f('0x7')](_0xed5f('0x8'),attributes,{'tableName':_0xed5f('0x9'),'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 66cf5d9..b52938e 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 _0xdaa1=['attributes','info','GetSalesforceAccount','stringify','ShowSalesforceAccount','where','then','catch','util','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','request\x20sent','debug','error','SalesforceAccount,\x20%s,\x20%s','message','result','SalesforceAccount','options','raw','include','map','model'];(function(_0x4dd523,_0x397fc8){var _0x2b442d=function(_0x28074e){while(--_0x28074e){_0x4dd523['push'](_0x4dd523['shift']());}};_0x2b442d(++_0x397fc8);}(_0xdaa1,0x1ba));var _0x1daa=function(_0x57ed7a,_0x27c8f3){_0x57ed7a=_0x57ed7a-0x0;var _0x1aa635=_0xdaa1[_0x57ed7a];return _0x1aa635;};'use strict';var _=require('lodash');var util=require(_0x1daa('0x0'));var moment=require('moment');var BPromise=require(_0x1daa('0x1'));var rs=require(_0x1daa('0x2'));var fs=require('fs');var Redis=require(_0x1daa('0x3'));var db=require(_0x1daa('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x1daa('0x5'));var config=require(_0x1daa('0x6'));var jayson=require(_0x1daa('0x7'));var client=jayson[_0x1daa('0x8')][_0x1daa('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x52650b,_0x1cdc99,_0x59055c){return new BPromise(function(_0x47ac90,_0x302d64){return client[_0x1daa('0xa')](_0x52650b,_0x59055c)['then'](function(_0x25c449){logger['info']('SalesforceAccount,\x20%s,\x20%s',_0x1cdc99,_0x1daa('0xb'));logger[_0x1daa('0xc')]('SalesforceAccount,\x20%s,\x20%s,\x20%s',_0x1cdc99,_0x1daa('0xb'),JSON['stringify'](_0x25c449));if(_0x25c449['error']){if(_0x25c449[_0x1daa('0xd')]['code']===0x1f4){logger[_0x1daa('0xd')](_0x1daa('0xe'),_0x1cdc99,_0x25c449[_0x1daa('0xd')][_0x1daa('0xf')]);return _0x302d64(_0x25c449[_0x1daa('0xd')][_0x1daa('0xf')]);}logger[_0x1daa('0xd')](_0x1daa('0xe'),_0x1cdc99,_0x25c449[_0x1daa('0xd')][_0x1daa('0xf')]);return _0x47ac90(_0x25c449[_0x1daa('0xd')][_0x1daa('0xf')]);}else{logger['info'](_0x1daa('0xe'),_0x1cdc99,'request\x20sent');_0x47ac90(_0x25c449[_0x1daa('0x10')][_0x1daa('0xf')]);}})['catch'](function(_0x421d5b){logger[_0x1daa('0xd')](_0x1daa('0xe'),_0x1cdc99,_0x421d5b);_0x302d64(_0x421d5b);});});}exports['GetSalesforceAccount']=function(_0x8e086c){var _0x3a13cc=this;return new Promise(function(_0x1a7c42,_0x5b7381){return db[_0x1daa('0x11')]['findAll']({'raw':_0x8e086c[_0x1daa('0x12')]?_0x8e086c[_0x1daa('0x12')][_0x1daa('0x13')]===undefined?!![]:![]:!![],'where':_0x8e086c['options']?_0x8e086c[_0x1daa('0x12')]['where']||null:null,'attributes':_0x8e086c[_0x1daa('0x12')]?_0x8e086c[_0x1daa('0x12')]['attributes']||null:null,'limit':_0x8e086c[_0x1daa('0x12')]?_0x8e086c['options']['limit']||null:null,'include':_0x8e086c[_0x1daa('0x12')]?_0x8e086c[_0x1daa('0x12')][_0x1daa('0x14')]?_[_0x1daa('0x15')](_0x8e086c[_0x1daa('0x12')][_0x1daa('0x14')],function(_0x3c0117){return{'model':db[_0x3c0117[_0x1daa('0x16')]],'as':_0x3c0117['as'],'attributes':_0x3c0117['attributes'],'include':_0x3c0117[_0x1daa('0x14')]?_[_0x1daa('0x15')](_0x3c0117[_0x1daa('0x14')],function(_0xe8dcdd){return{'model':db[_0xe8dcdd[_0x1daa('0x16')]],'as':_0xe8dcdd['as'],'attributes':_0xe8dcdd[_0x1daa('0x17')],'include':_0xe8dcdd[_0x1daa('0x14')]?_[_0x1daa('0x15')](_0xe8dcdd[_0x1daa('0x14')],function(_0x2d40c3){return{'model':db[_0x2d40c3['model']],'as':_0x2d40c3['as'],'attributes':_0x2d40c3['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x138961){logger[_0x1daa('0x18')](_0x1daa('0x19'),_0x8e086c);logger['debug']('GetSalesforceAccount',_0x8e086c,JSON[_0x1daa('0x1a')](_0x138961));_0x1a7c42(_0x138961);})['catch'](function(_0x4313dd){logger['error'](_0x1daa('0x19'),_0x4313dd[_0x1daa('0xf')],_0x8e086c);_0x5b7381(_0x3a13cc[_0x1daa('0xd')](0x1f4,_0x4313dd[_0x1daa('0xf')]));});});};exports[_0x1daa('0x1b')]=function(_0x574722){var _0x25b2a9=this;return new Promise(function(_0x14bc6a,_0x497204){return db[_0x1daa('0x11')]['find']({'raw':_0x574722['options']?_0x574722[_0x1daa('0x12')][_0x1daa('0x13')]===undefined?!![]:![]:!![],'where':_0x574722[_0x1daa('0x12')]?_0x574722['options'][_0x1daa('0x1c')]||null:null,'attributes':_0x574722['options']?_0x574722[_0x1daa('0x12')][_0x1daa('0x17')]||null:null,'include':_0x574722[_0x1daa('0x12')]?_0x574722[_0x1daa('0x12')][_0x1daa('0x14')]?_[_0x1daa('0x15')](_0x574722[_0x1daa('0x12')]['include'],function(_0x2bf247){return{'model':db[_0x2bf247[_0x1daa('0x16')]],'as':_0x2bf247['as'],'attributes':_0x2bf247[_0x1daa('0x17')],'include':_0x2bf247[_0x1daa('0x14')]?_[_0x1daa('0x15')](_0x2bf247['include'],function(_0x11967d){return{'model':db[_0x11967d[_0x1daa('0x16')]],'as':_0x11967d['as'],'attributes':_0x11967d['attributes'],'include':_0x11967d[_0x1daa('0x14')]?_[_0x1daa('0x15')](_0x11967d['include'],function(_0x9ae2c2){return{'model':db[_0x9ae2c2[_0x1daa('0x16')]],'as':_0x9ae2c2['as'],'attributes':_0x9ae2c2[_0x1daa('0x17')]};}):[]};}):[]};}):[]:[]})[_0x1daa('0x1d')](function(_0x1ef981){logger['info'](_0x1daa('0x1b'),_0x574722);logger[_0x1daa('0xc')](_0x1daa('0x1b'),_0x574722,JSON['stringify'](_0x1ef981));_0x14bc6a(_0x1ef981);})[_0x1daa('0x1e')](function(_0x2fe17d){logger[_0x1daa('0xd')]('ShowSalesforceAccount',_0x2fe17d[_0x1daa('0xf')],_0x574722);_0x497204(_0x25b2a9['error'](0x1f4,_0x2fe17d['message']));});});}; \ No newline at end of file +var _0xfbe4=['request','then','info','SalesforceAccount,\x20%s,\x20%s','request\x20sent','debug','SalesforceAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','GetSalesforceAccount','SalesforceAccount','findAll','options','where','limit','include','map','model','attributes','ShowSalesforceAccount','find','raw','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http'];(function(_0x2f3947,_0x2ee083){var _0x3e6ab7=function(_0x4057c0){while(--_0x4057c0){_0x2f3947['push'](_0x2f3947['shift']());}};_0x3e6ab7(++_0x2ee083);}(_0xfbe4,0x153));var _0x4fbe=function(_0x42f50b,_0x3d5fa7){_0x42f50b=_0x42f50b-0x0;var _0x454ece=_0xfbe4[_0x42f50b];return _0x454ece;};'use strict';var _=require(_0x4fbe('0x0'));var util=require(_0x4fbe('0x1'));var moment=require(_0x4fbe('0x2'));var BPromise=require(_0x4fbe('0x3'));var rs=require(_0x4fbe('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4fbe('0x5'))['db'];var utils=require(_0x4fbe('0x6'));var logger=require(_0x4fbe('0x7'))('rpc');var config=require(_0x4fbe('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x4fbe('0x9')][_0x4fbe('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x19a165,_0x4f0f41,_0x1f997b){return new BPromise(function(_0xeef67c,_0xaf771b){return client[_0x4fbe('0xb')](_0x19a165,_0x1f997b)[_0x4fbe('0xc')](function(_0x16518b){logger[_0x4fbe('0xd')](_0x4fbe('0xe'),_0x4f0f41,_0x4fbe('0xf'));logger[_0x4fbe('0x10')](_0x4fbe('0x11'),_0x4f0f41,_0x4fbe('0xf'),JSON[_0x4fbe('0x12')](_0x16518b));if(_0x16518b[_0x4fbe('0x13')]){if(_0x16518b[_0x4fbe('0x13')]['code']===0x1f4){logger[_0x4fbe('0x13')](_0x4fbe('0xe'),_0x4f0f41,_0x16518b[_0x4fbe('0x13')][_0x4fbe('0x14')]);return _0xaf771b(_0x16518b[_0x4fbe('0x13')][_0x4fbe('0x14')]);}logger['error']('SalesforceAccount,\x20%s,\x20%s',_0x4f0f41,_0x16518b[_0x4fbe('0x13')]['message']);return _0xeef67c(_0x16518b[_0x4fbe('0x13')]['message']);}else{logger[_0x4fbe('0xd')](_0x4fbe('0xe'),_0x4f0f41,'request\x20sent');_0xeef67c(_0x16518b['result'][_0x4fbe('0x14')]);}})[_0x4fbe('0x15')](function(_0x2db23a){logger[_0x4fbe('0x13')]('SalesforceAccount,\x20%s,\x20%s',_0x4f0f41,_0x2db23a);_0xaf771b(_0x2db23a);});});}exports[_0x4fbe('0x16')]=function(_0x149dca){var _0x3f1374=this;return new Promise(function(_0xa18aac,_0x5689a1){return db[_0x4fbe('0x17')][_0x4fbe('0x18')]({'raw':_0x149dca[_0x4fbe('0x19')]?_0x149dca[_0x4fbe('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x149dca[_0x4fbe('0x19')]?_0x149dca[_0x4fbe('0x19')][_0x4fbe('0x1a')]||null:null,'attributes':_0x149dca['options']?_0x149dca[_0x4fbe('0x19')]['attributes']||null:null,'limit':_0x149dca[_0x4fbe('0x19')]?_0x149dca[_0x4fbe('0x19')][_0x4fbe('0x1b')]||null:null,'include':_0x149dca['options']?_0x149dca[_0x4fbe('0x19')][_0x4fbe('0x1c')]?_[_0x4fbe('0x1d')](_0x149dca['options'][_0x4fbe('0x1c')],function(_0x12687f){return{'model':db[_0x12687f[_0x4fbe('0x1e')]],'as':_0x12687f['as'],'attributes':_0x12687f[_0x4fbe('0x1f')],'include':_0x12687f[_0x4fbe('0x1c')]?_[_0x4fbe('0x1d')](_0x12687f[_0x4fbe('0x1c')],function(_0x536b5a){return{'model':db[_0x536b5a[_0x4fbe('0x1e')]],'as':_0x536b5a['as'],'attributes':_0x536b5a[_0x4fbe('0x1f')],'include':_0x536b5a[_0x4fbe('0x1c')]?_[_0x4fbe('0x1d')](_0x536b5a[_0x4fbe('0x1c')],function(_0x4f658e){return{'model':db[_0x4f658e[_0x4fbe('0x1e')]],'as':_0x4f658e['as'],'attributes':_0x4f658e['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x5ab8c5){logger[_0x4fbe('0xd')](_0x4fbe('0x16'),_0x149dca);logger[_0x4fbe('0x10')](_0x4fbe('0x16'),_0x149dca,JSON[_0x4fbe('0x12')](_0x5ab8c5));_0xa18aac(_0x5ab8c5);})['catch'](function(_0x369a6f){logger[_0x4fbe('0x13')](_0x4fbe('0x16'),_0x369a6f['message'],_0x149dca);_0x5689a1(_0x3f1374[_0x4fbe('0x13')](0x1f4,_0x369a6f[_0x4fbe('0x14')]));});});};exports[_0x4fbe('0x20')]=function(_0x291ae8){var _0xe4fa96=this;return new Promise(function(_0x3d5a7e,_0x36620e){return db['SalesforceAccount'][_0x4fbe('0x21')]({'raw':_0x291ae8[_0x4fbe('0x19')]?_0x291ae8['options'][_0x4fbe('0x22')]===undefined?!![]:![]:!![],'where':_0x291ae8[_0x4fbe('0x19')]?_0x291ae8[_0x4fbe('0x19')]['where']||null:null,'attributes':_0x291ae8[_0x4fbe('0x19')]?_0x291ae8['options'][_0x4fbe('0x1f')]||null:null,'include':_0x291ae8['options']?_0x291ae8[_0x4fbe('0x19')]['include']?_[_0x4fbe('0x1d')](_0x291ae8[_0x4fbe('0x19')][_0x4fbe('0x1c')],function(_0x77b58f){return{'model':db[_0x77b58f[_0x4fbe('0x1e')]],'as':_0x77b58f['as'],'attributes':_0x77b58f[_0x4fbe('0x1f')],'include':_0x77b58f[_0x4fbe('0x1c')]?_[_0x4fbe('0x1d')](_0x77b58f['include'],function(_0x24228d){return{'model':db[_0x24228d[_0x4fbe('0x1e')]],'as':_0x24228d['as'],'attributes':_0x24228d[_0x4fbe('0x1f')],'include':_0x24228d['include']?_[_0x4fbe('0x1d')](_0x24228d[_0x4fbe('0x1c')],function(_0x2b3c47){return{'model':db[_0x2b3c47[_0x4fbe('0x1e')]],'as':_0x2b3c47['as'],'attributes':_0x2b3c47[_0x4fbe('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x4fbe('0xc')](function(_0x3102ee){logger[_0x4fbe('0xd')](_0x4fbe('0x20'),_0x291ae8);logger['debug'](_0x4fbe('0x20'),_0x291ae8,JSON[_0x4fbe('0x12')](_0x3102ee));_0x3d5a7e(_0x3102ee);})[_0x4fbe('0x15')](function(_0x8f46c0){logger['error'](_0x4fbe('0x20'),_0x8f46c0[_0x4fbe('0x14')],_0x291ae8);_0x36620e(_0xe4fa96[_0x4fbe('0x13')](0x1f4,_0x8f46c0['message']));});});}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/index.js b/server/api/intSalesforceConfiguration/index.js index 6d37251..957cd31 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 _0xdb28=['path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','post','create','put','delete','destroy','exports','multer','util'];(function(_0x36eaaa,_0x326732){var _0x461349=function(_0x4e4180){while(--_0x4e4180){_0x36eaaa['push'](_0x36eaaa['shift']());}};_0x461349(++_0x326732);}(_0xdb28,0x106));var _0x8db2=function(_0x476396,_0x39b05e){_0x476396=_0x476396-0x0;var _0x215c88=_0xdb28[_0x476396];return _0x215c88;};'use strict';var multer=require(_0x8db2('0x0'));var util=require(_0x8db2('0x1'));var path=require(_0x8db2('0x2'));var timeout=require(_0x8db2('0x3'));var express=require('express');var router=express[_0x8db2('0x4')]();var fs_extra=require(_0x8db2('0x5'));var auth=require(_0x8db2('0x6'));var interaction=require(_0x8db2('0x7'));var config=require(_0x8db2('0x8'));var controller=require('./intSalesforceConfiguration.controller');router[_0x8db2('0x9')]('/',auth[_0x8db2('0xa')](),controller['index']);router['get'](_0x8db2('0xb'),auth[_0x8db2('0xa')](),controller[_0x8db2('0xc')]);router[_0x8db2('0x9')](_0x8db2('0xd'),auth[_0x8db2('0xa')](),controller[_0x8db2('0xe')]);router['get'](_0x8db2('0xf'),auth[_0x8db2('0xa')](),controller[_0x8db2('0x10')]);router['get'](_0x8db2('0x11'),auth[_0x8db2('0xa')](),controller['getDescriptions']);router[_0x8db2('0x12')]('/',auth[_0x8db2('0xa')](),controller[_0x8db2('0x13')]);router[_0x8db2('0x14')](_0x8db2('0xb'),auth['isAuthenticated'](),controller['update']);router[_0x8db2('0x15')](_0x8db2('0xb'),auth[_0x8db2('0xa')](),controller[_0x8db2('0x16')]);module[_0x8db2('0x17')]=router; \ No newline at end of file +var _0xdb28=['path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','post','create','put','delete','destroy','exports','multer','util'];(function(_0x513aa5,_0x1fba79){var _0x1a1a7c=function(_0x240e3f){while(--_0x240e3f){_0x513aa5['push'](_0x513aa5['shift']());}};_0x1a1a7c(++_0x1fba79);}(_0xdb28,0x106));var _0x8db2=function(_0x129047,_0x3617b3){_0x129047=_0x129047-0x0;var _0x1d5ee0=_0xdb28[_0x129047];return _0x1d5ee0;};'use strict';var multer=require(_0x8db2('0x0'));var util=require(_0x8db2('0x1'));var path=require(_0x8db2('0x2'));var timeout=require(_0x8db2('0x3'));var express=require('express');var router=express[_0x8db2('0x4')]();var fs_extra=require(_0x8db2('0x5'));var auth=require(_0x8db2('0x6'));var interaction=require(_0x8db2('0x7'));var config=require(_0x8db2('0x8'));var controller=require('./intSalesforceConfiguration.controller');router[_0x8db2('0x9')]('/',auth[_0x8db2('0xa')](),controller['index']);router['get'](_0x8db2('0xb'),auth[_0x8db2('0xa')](),controller[_0x8db2('0xc')]);router[_0x8db2('0x9')](_0x8db2('0xd'),auth[_0x8db2('0xa')](),controller[_0x8db2('0xe')]);router['get'](_0x8db2('0xf'),auth[_0x8db2('0xa')](),controller[_0x8db2('0x10')]);router['get'](_0x8db2('0x11'),auth[_0x8db2('0xa')](),controller['getDescriptions']);router[_0x8db2('0x12')]('/',auth[_0x8db2('0xa')](),controller[_0x8db2('0x13')]);router[_0x8db2('0x14')](_0x8db2('0xb'),auth['isAuthenticated'](),controller['update']);router[_0x8db2('0x15')](_0x8db2('0xb'),auth[_0x8db2('0xa')](),controller[_0x8db2('0x16')]);module[_0x8db2('0x17')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js index fba4b2c..a90fedf 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 _0x52fd=['account','contact_lead','nothing','sequelize','exports','STRING','ENUM','Task','Case','contact','lead','account_contact_lead'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x52fd,0x18f));var _0xd52f=function(_0x2283dc,_0x2fcfc5){_0x2283dc=_0x2283dc-0x0;var _0x16db90=_0x52fd[_0x2283dc];return _0x16db90;};'use strict';var Sequelize=require(_0xd52f('0x0'));module[_0xd52f('0x1')]={'name':{'type':Sequelize[_0xd52f('0x2')]},'description':{'type':Sequelize[_0xd52f('0x2')]},'ticketType':{'type':Sequelize[_0xd52f('0x3')](_0xd52f('0x4'),_0xd52f('0x5')),'defaultValue':_0xd52f('0x4')},'moduleSearch':{'type':Sequelize[_0xd52f('0x3')]('contact_lead',_0xd52f('0x6'),_0xd52f('0x7'),_0xd52f('0x8'),_0xd52f('0x9')),'defaultValue':_0xd52f('0xa')},'moduleCreate':{'type':Sequelize['ENUM'](_0xd52f('0xb'),_0xd52f('0x6'),_0xd52f('0x7'),_0xd52f('0x9')),'defaultValue':_0xd52f('0x7')},'leadId':{'type':Sequelize[_0xd52f('0x2')]},'additionalSearchAccount':{'type':Sequelize[_0xd52f('0x2')]},'additionalSearchContact':{'type':Sequelize[_0xd52f('0x2')]},'additionalSearchLead':{'type':Sequelize[_0xd52f('0x2')]}}; \ No newline at end of file +var _0x0918=['account','contact_lead','nothing','lead','STRING','ENUM','Task','Case','contact'];(function(_0x51b861,_0xb480d3){var _0x52401b=function(_0x30c1ea){while(--_0x30c1ea){_0x51b861['push'](_0x51b861['shift']());}};_0x52401b(++_0xb480d3);}(_0x0918,0x1b4));var _0x8091=function(_0x2e7dd0,_0x2e0016){_0x2e7dd0=_0x2e7dd0-0x0;var _0x5699e4=_0x0918[_0x2e7dd0];return _0x5699e4;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x8091('0x0')]},'description':{'type':Sequelize[_0x8091('0x0')]},'ticketType':{'type':Sequelize[_0x8091('0x1')](_0x8091('0x2'),_0x8091('0x3')),'defaultValue':_0x8091('0x2')},'moduleSearch':{'type':Sequelize[_0x8091('0x1')]('contact_lead',_0x8091('0x4'),'lead','account_contact_lead',_0x8091('0x5')),'defaultValue':_0x8091('0x6')},'moduleCreate':{'type':Sequelize[_0x8091('0x1')](_0x8091('0x7'),_0x8091('0x4'),_0x8091('0x8'),_0x8091('0x5')),'defaultValue':'lead'},'leadId':{'type':Sequelize[_0x8091('0x0')]},'additionalSearchAccount':{'type':Sequelize[_0x8091('0x0')]},'additionalSearchContact':{'type':Sequelize[_0x8091('0x0')]},'additionalSearchLead':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js index 6139ce5..b3ae8b7 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 _0x04fa=['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','apply','reject','save','update','destroy','then','error','stack','name','send','index','map','SalesforceConfiguration','rawAttributes','fieldName','type','filters','model','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','keys','intersection','find','create','body','params','getFields','SalesforceField','pick','findOne','getSubjects','getDescriptions','options','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv'];(function(_0x16ba74,_0x2ebcfa){var _0x4333a6=function(_0x13b137){while(--_0x13b137){_0x16ba74['push'](_0x16ba74['shift']());}};_0x4333a6(++_0x2ebcfa);}(_0x04fa,0x145));var _0xa04f=function(_0x1f8125,_0xde57b){_0x1f8125=_0x1f8125-0x0;var _0x5b2f4a=_0x04fa[_0x1f8125];return _0x5b2f4a;};'use strict';var emlformat=require(_0xa04f('0x0'));var rimraf=require(_0xa04f('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa04f('0x2'));var rp=require(_0xa04f('0x3'));var moment=require(_0xa04f('0x4'));var BPromise=require(_0xa04f('0x5'));var Mustache=require('mustache');var util=require(_0xa04f('0x6'));var path=require(_0xa04f('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xa04f('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xa04f('0x9'));var squel=require(_0xa04f('0xa'));var crypto=require(_0xa04f('0xb'));var jsforce=require(_0xa04f('0xc'));var deskjs=require(_0xa04f('0xd'));var toCsv=require(_0xa04f('0xe'));var querystring=require(_0xa04f('0xf'));var Papa=require(_0xa04f('0x10'));var Redis=require(_0xa04f('0x11'));var authService=require(_0xa04f('0x12'));var qs=require(_0xa04f('0x13'));var as=require(_0xa04f('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa04f('0x15'))(_0xa04f('0x16'));var utils=require(_0xa04f('0x17'));var config=require(_0xa04f('0x18'));var licenseUtil=require(_0xa04f('0x19'));var db=require(_0xa04f('0x1a'))['db'];function respondWithStatusCode(_0x303c8f,_0x27b6f8){_0x27b6f8=_0x27b6f8||0xcc;return function(_0xff9c2a){if(_0xff9c2a){return _0x303c8f[_0xa04f('0x1b')](_0x27b6f8);}return _0x303c8f[_0xa04f('0x1c')](_0x27b6f8)[_0xa04f('0x1d')]();};}function respondWithResult(_0x42dbac,_0x135eae){_0x135eae=_0x135eae||0xc8;return function(_0xcac10b){if(_0xcac10b){return _0x42dbac[_0xa04f('0x1c')](_0x135eae)[_0xa04f('0x1e')](_0xcac10b);}};}function respondWithFilteredResult(_0x3ea8d0,_0x114593){return function(_0x349bed){if(_0x349bed){var _0x573a07=typeof _0x114593[_0xa04f('0x1f')]===_0xa04f('0x20')&&typeof _0x114593[_0xa04f('0x21')]===_0xa04f('0x20');var _0x230950=_0x349bed[_0xa04f('0x22')];var _0x491c30=_0x573a07?0x0:_0x114593['offset'];var _0x3e1af8=_0x573a07?_0x349bed[_0xa04f('0x22')]:_0x114593['offset']+_0x114593['limit'];var _0x24e7ff;if(_0x3e1af8>=_0x230950){_0x3e1af8=_0x230950;_0x24e7ff=0xc8;}else{_0x24e7ff=0xce;}_0x3ea8d0[_0xa04f('0x1c')](_0x24e7ff);return _0x3ea8d0[_0xa04f('0x23')]('Content-Range',_0x491c30+'-'+_0x3e1af8+'/'+_0x230950)['json'](_0x349bed);}return null;};}function patchUpdates(_0x255b1a){return function(_0x4250b2){try{jsonpatch[_0xa04f('0x24')](_0x4250b2,_0x255b1a,!![]);}catch(_0x22384a){return BPromise[_0xa04f('0x25')](_0x22384a);}return _0x4250b2[_0xa04f('0x26')]();};}function saveUpdates(_0xd020a,_0x1f649a){return function(_0x2b94a9){if(_0x2b94a9){return _0x2b94a9[_0xa04f('0x27')](_0xd020a)['then'](function(_0x3741c9){return _0x3741c9;});}return null;};}function removeEntity(_0x1c3c3e,_0x1215dd){return function(_0x375476){if(_0x375476){return _0x375476[_0xa04f('0x28')]()[_0xa04f('0x29')](function(){_0x1c3c3e[_0xa04f('0x1c')](0xcc)[_0xa04f('0x1d')]();});}};}function handleEntityNotFound(_0x169b66,_0x4092cf){return function(_0x2d64af){if(!_0x2d64af){_0x169b66[_0xa04f('0x1b')](0x194);}return _0x2d64af;};}function handleError(_0x853378,_0xe3e793){_0xe3e793=_0xe3e793||0x1f4;return function(_0x572acb){logger[_0xa04f('0x2a')](_0x572acb[_0xa04f('0x2b')]);if(_0x572acb['name']){delete _0x572acb[_0xa04f('0x2c')];}_0x853378[_0xa04f('0x1c')](_0xe3e793)[_0xa04f('0x2d')](_0x572acb);};}exports[_0xa04f('0x2e')]=function(_0x580350,_0x3e075b){var _0x523cb4={},_0x891b9b={},_0x150198={'count':0x0,'rows':[]};var _0x5622e3=_[_0xa04f('0x2f')](db[_0xa04f('0x30')][_0xa04f('0x31')],function(_0x2123e3){return{'name':_0x2123e3[_0xa04f('0x32')],'type':_0x2123e3[_0xa04f('0x33')]['key']};});_0x891b9b['model']=_['map'](_0x5622e3,_0xa04f('0x2c'));_0x891b9b['query']=_['keys'](_0x580350['query']);_0x891b9b[_0xa04f('0x34')]=_['intersection'](_0x891b9b[_0xa04f('0x35')],_0x891b9b[_0xa04f('0x36')]);_0x523cb4[_0xa04f('0x37')]=_['intersection'](_0x891b9b[_0xa04f('0x35')],qs[_0xa04f('0x38')](_0x580350[_0xa04f('0x36')][_0xa04f('0x38')]));_0x523cb4[_0xa04f('0x37')]=_0x523cb4['attributes'][_0xa04f('0x39')]?_0x523cb4['attributes']:_0x891b9b[_0xa04f('0x35')];if(!_0x580350['query'][_0xa04f('0x3a')](_0xa04f('0x3b'))){_0x523cb4[_0xa04f('0x21')]=qs['limit'](_0x580350['query']['limit']);_0x523cb4['offset']=qs[_0xa04f('0x1f')](_0x580350[_0xa04f('0x36')][_0xa04f('0x1f')]);}_0x523cb4[_0xa04f('0x3c')]=qs[_0xa04f('0x3d')](_0x580350[_0xa04f('0x36')][_0xa04f('0x3d')]);_0x523cb4[_0xa04f('0x3e')]=qs[_0xa04f('0x34')](_['pick'](_0x580350[_0xa04f('0x36')],_0x891b9b[_0xa04f('0x34')]),_0x5622e3);if(_0x580350['query'][_0xa04f('0x3f')]){_0x523cb4[_0xa04f('0x3e')]=_[_0xa04f('0x40')](_0x523cb4[_0xa04f('0x3e')],{'$or':_[_0xa04f('0x2f')](_0x5622e3,function(_0x55997e){if(_0x55997e['type']!==_0xa04f('0x41')){var _0xc7c930={};_0xc7c930[_0x55997e[_0xa04f('0x2c')]]={'$like':'%'+_0x580350['query'][_0xa04f('0x3f')]+'%'};return _0xc7c930;}})});}_0x523cb4=_[_0xa04f('0x40')]({},_0x523cb4,_0x580350['options']);var _0x19967d={'where':_0x523cb4[_0xa04f('0x3e')]};return db[_0xa04f('0x30')][_0xa04f('0x22')](_0x19967d)[_0xa04f('0x29')](function(_0x11cf63){_0x150198['count']=_0x11cf63;if(_0x580350[_0xa04f('0x36')][_0xa04f('0x42')]){_0x523cb4[_0xa04f('0x43')]=[{'all':!![]}];}return db['SalesforceConfiguration'][_0xa04f('0x44')](_0x523cb4);})[_0xa04f('0x29')](function(_0x381e5b){_0x150198[_0xa04f('0x45')]=_0x381e5b;return _0x150198;})['then'](respondWithFilteredResult(_0x3e075b,_0x523cb4))[_0xa04f('0x46')](handleError(_0x3e075b,null));};exports[_0xa04f('0x47')]=function(_0xdca84c,_0x42e80c){var _0x498e3b={'raw':![],'where':{'id':_0xdca84c['params']['id']}},_0x2c9371={};_0x2c9371[_0xa04f('0x35')]=_[_0xa04f('0x48')](db['SalesforceConfiguration'][_0xa04f('0x31')]);_0x2c9371[_0xa04f('0x36')]=_[_0xa04f('0x48')](_0xdca84c[_0xa04f('0x36')]);_0x2c9371[_0xa04f('0x34')]=_[_0xa04f('0x49')](_0x2c9371[_0xa04f('0x35')],_0x2c9371[_0xa04f('0x36')]);_0x498e3b['attributes']=_['intersection'](_0x2c9371['model'],qs[_0xa04f('0x38')](_0xdca84c[_0xa04f('0x36')][_0xa04f('0x38')]));_0x498e3b[_0xa04f('0x37')]=_0x498e3b[_0xa04f('0x37')][_0xa04f('0x39')]?_0x498e3b[_0xa04f('0x37')]:_0x2c9371[_0xa04f('0x35')];if(_0xdca84c[_0xa04f('0x36')]['includeAll']){_0x498e3b['include']=[{'all':!![]}];}_0x498e3b=_[_0xa04f('0x40')]({},_0x498e3b,_0xdca84c['options']);return db[_0xa04f('0x30')][_0xa04f('0x4a')](_0x498e3b)[_0xa04f('0x29')](handleEntityNotFound(_0x42e80c,null))[_0xa04f('0x29')](respondWithResult(_0x42e80c,null))[_0xa04f('0x46')](handleError(_0x42e80c,null));};exports[_0xa04f('0x4b')]=function(_0x3f5265,_0x260d44){return db[_0xa04f('0x30')][_0xa04f('0x4b')](_0x3f5265[_0xa04f('0x4c')],{})[_0xa04f('0x29')](respondWithResult(_0x260d44,0xc9))[_0xa04f('0x46')](handleError(_0x260d44,null));};exports[_0xa04f('0x27')]=function(_0x56f6e7,_0x48c2f1){if(_0x56f6e7[_0xa04f('0x4c')]['id']){delete _0x56f6e7['body']['id'];}return db[_0xa04f('0x30')][_0xa04f('0x4a')]({'where':{'id':_0x56f6e7[_0xa04f('0x4d')]['id']}})['then'](handleEntityNotFound(_0x48c2f1,null))['then'](saveUpdates(_0x56f6e7[_0xa04f('0x4c')],null))[_0xa04f('0x29')](respondWithResult(_0x48c2f1,null))['catch'](handleError(_0x48c2f1,null));};exports['destroy']=function(_0x1caca5,_0xa72d68){return db[_0xa04f('0x30')]['find']({'where':{'id':_0x1caca5[_0xa04f('0x4d')]['id']}})[_0xa04f('0x29')](handleEntityNotFound(_0xa72d68,null))[_0xa04f('0x29')](removeEntity(_0xa72d68,null))[_0xa04f('0x46')](handleError(_0xa72d68,null));};exports[_0xa04f('0x4e')]=function(_0x146254,_0x4ba875,_0x388747){var _0x24ab43={};var _0x8ddb84={};var _0x5ea0d5;var _0x245329;return db[_0xa04f('0x30')]['findOne']({'where':{'id':_0x146254[_0xa04f('0x4d')]['id']}})[_0xa04f('0x29')](handleEntityNotFound(_0x4ba875,null))[_0xa04f('0x29')](function(_0x2d568e){if(_0x2d568e){_0x5ea0d5=_0x2d568e;_0x8ddb84[_0xa04f('0x35')]=_[_0xa04f('0x48')](db[_0xa04f('0x4f')][_0xa04f('0x31')]);_0x8ddb84[_0xa04f('0x36')]=_['keys'](_0x146254[_0xa04f('0x36')]);_0x8ddb84[_0xa04f('0x34')]=_[_0xa04f('0x49')](_0x8ddb84[_0xa04f('0x35')],_0x8ddb84[_0xa04f('0x36')]);_0x24ab43[_0xa04f('0x37')]=_['intersection'](_0x8ddb84[_0xa04f('0x35')],qs[_0xa04f('0x38')](_0x146254[_0xa04f('0x36')][_0xa04f('0x38')]));_0x24ab43[_0xa04f('0x37')]=_0x24ab43[_0xa04f('0x37')][_0xa04f('0x39')]?_0x24ab43[_0xa04f('0x37')]:_0x8ddb84[_0xa04f('0x35')];_0x24ab43[_0xa04f('0x3c')]=qs[_0xa04f('0x3d')](_0x146254[_0xa04f('0x36')][_0xa04f('0x3d')]);_0x24ab43[_0xa04f('0x3e')]=qs[_0xa04f('0x34')](_[_0xa04f('0x50')](_0x146254[_0xa04f('0x36')],_0x8ddb84[_0xa04f('0x34')]));if(_0x146254['query'][_0xa04f('0x3f')]){_0x24ab43['where']=_[_0xa04f('0x40')](_0x24ab43[_0xa04f('0x3e')],{'$or':_[_0xa04f('0x2f')](_0x24ab43[_0xa04f('0x37')],function(_0xff5bd5){var _0x192fc2={};_0x192fc2[_0xff5bd5]={'$like':'%'+_0x146254[_0xa04f('0x36')][_0xa04f('0x3f')]+'%'};return _0x192fc2;})});}_0x24ab43=_[_0xa04f('0x40')]({},_0x24ab43,_0x146254['options']);return _0x5ea0d5[_0xa04f('0x4e')](_0x24ab43);}})['then'](function(_0x3b6a94){if(_0x3b6a94){_0x245329=_0x3b6a94[_0xa04f('0x39')];if(!_0x146254[_0xa04f('0x36')][_0xa04f('0x3a')](_0xa04f('0x3b'))){_0x24ab43['limit']=qs[_0xa04f('0x21')](_0x146254['query'][_0xa04f('0x21')]);_0x24ab43[_0xa04f('0x1f')]=qs[_0xa04f('0x1f')](_0x146254[_0xa04f('0x36')][_0xa04f('0x1f')]);}return _0x5ea0d5[_0xa04f('0x4e')](_0x24ab43);}})[_0xa04f('0x29')](function(_0x4c4030){if(_0x4c4030){return _0x4c4030?{'count':_0x245329,'rows':_0x4c4030}:null;}})[_0xa04f('0x29')](respondWithResult(_0x4ba875,null))[_0xa04f('0x46')](handleError(_0x4ba875,null));};exports['getSubjects']=function(_0x3530df,_0xa76ef4,_0x79e394){var _0x4499d1={};var _0x244826={};var _0x554d5a;var _0xe593da;return db['SalesforceConfiguration'][_0xa04f('0x51')]({'where':{'id':_0x3530df[_0xa04f('0x4d')]['id']}})[_0xa04f('0x29')](handleEntityNotFound(_0xa76ef4,null))[_0xa04f('0x29')](function(_0xfeeb36){if(_0xfeeb36){_0x554d5a=_0xfeeb36;_0x244826['model']=_[_0xa04f('0x48')](db[_0xa04f('0x4f')][_0xa04f('0x31')]);_0x244826[_0xa04f('0x36')]=_[_0xa04f('0x48')](_0x3530df[_0xa04f('0x36')]);_0x244826[_0xa04f('0x34')]=_[_0xa04f('0x49')](_0x244826[_0xa04f('0x35')],_0x244826[_0xa04f('0x36')]);_0x4499d1[_0xa04f('0x37')]=_[_0xa04f('0x49')](_0x244826[_0xa04f('0x35')],qs[_0xa04f('0x38')](_0x3530df['query']['fields']));_0x4499d1[_0xa04f('0x37')]=_0x4499d1['attributes'][_0xa04f('0x39')]?_0x4499d1[_0xa04f('0x37')]:_0x244826['model'];_0x4499d1['order']=qs[_0xa04f('0x3d')](_0x3530df[_0xa04f('0x36')][_0xa04f('0x3d')]);_0x4499d1[_0xa04f('0x3e')]=qs[_0xa04f('0x34')](_[_0xa04f('0x50')](_0x3530df[_0xa04f('0x36')],_0x244826[_0xa04f('0x34')]));if(_0x3530df[_0xa04f('0x36')][_0xa04f('0x3f')]){_0x4499d1['where']=_[_0xa04f('0x40')](_0x4499d1['where'],{'$or':_[_0xa04f('0x2f')](_0x4499d1['attributes'],function(_0x397344){var _0x20ebba={};_0x20ebba[_0x397344]={'$like':'%'+_0x3530df[_0xa04f('0x36')][_0xa04f('0x3f')]+'%'};return _0x20ebba;})});}_0x4499d1=_[_0xa04f('0x40')]({},_0x4499d1,_0x3530df['options']);return _0x554d5a[_0xa04f('0x52')](_0x4499d1);}})[_0xa04f('0x29')](function(_0x296cbe){if(_0x296cbe){_0xe593da=_0x296cbe['length'];if(!_0x3530df[_0xa04f('0x36')][_0xa04f('0x3a')](_0xa04f('0x3b'))){_0x4499d1[_0xa04f('0x21')]=qs[_0xa04f('0x21')](_0x3530df[_0xa04f('0x36')][_0xa04f('0x21')]);_0x4499d1['offset']=qs[_0xa04f('0x1f')](_0x3530df['query']['offset']);}return _0x554d5a[_0xa04f('0x52')](_0x4499d1);}})[_0xa04f('0x29')](function(_0x36edb6){if(_0x36edb6){return _0x36edb6?{'count':_0xe593da,'rows':_0x36edb6}:null;}})[_0xa04f('0x29')](respondWithResult(_0xa76ef4,null))[_0xa04f('0x46')](handleError(_0xa76ef4,null));};exports[_0xa04f('0x53')]=function(_0x6b88de,_0x37bd1e,_0x5dc392){var _0x453296={};var _0x333190={};var _0x59773e;var _0x125bda;return db[_0xa04f('0x30')][_0xa04f('0x51')]({'where':{'id':_0x6b88de[_0xa04f('0x4d')]['id']}})['then'](handleEntityNotFound(_0x37bd1e,null))[_0xa04f('0x29')](function(_0x41e025){if(_0x41e025){_0x59773e=_0x41e025;_0x333190[_0xa04f('0x35')]=_[_0xa04f('0x48')](db['SalesforceField'][_0xa04f('0x31')]);_0x333190['query']=_['keys'](_0x6b88de[_0xa04f('0x36')]);_0x333190['filters']=_['intersection'](_0x333190[_0xa04f('0x35')],_0x333190[_0xa04f('0x36')]);_0x453296['attributes']=_['intersection'](_0x333190[_0xa04f('0x35')],qs[_0xa04f('0x38')](_0x6b88de[_0xa04f('0x36')][_0xa04f('0x38')]));_0x453296[_0xa04f('0x37')]=_0x453296[_0xa04f('0x37')][_0xa04f('0x39')]?_0x453296[_0xa04f('0x37')]:_0x333190[_0xa04f('0x35')];_0x453296[_0xa04f('0x3c')]=qs[_0xa04f('0x3d')](_0x6b88de[_0xa04f('0x36')][_0xa04f('0x3d')]);_0x453296[_0xa04f('0x3e')]=qs[_0xa04f('0x34')](_[_0xa04f('0x50')](_0x6b88de[_0xa04f('0x36')],_0x333190['filters']));if(_0x6b88de[_0xa04f('0x36')]['filter']){_0x453296['where']=_[_0xa04f('0x40')](_0x453296['where'],{'$or':_[_0xa04f('0x2f')](_0x453296[_0xa04f('0x37')],function(_0x2937ee){var _0x389f05={};_0x389f05[_0x2937ee]={'$like':'%'+_0x6b88de[_0xa04f('0x36')]['filter']+'%'};return _0x389f05;})});}_0x453296=_[_0xa04f('0x40')]({},_0x453296,_0x6b88de[_0xa04f('0x54')]);return _0x59773e[_0xa04f('0x53')](_0x453296);}})[_0xa04f('0x29')](function(_0x269542){if(_0x269542){_0x125bda=_0x269542['length'];if(!_0x6b88de['query'][_0xa04f('0x3a')](_0xa04f('0x3b'))){_0x453296[_0xa04f('0x21')]=qs[_0xa04f('0x21')](_0x6b88de[_0xa04f('0x36')][_0xa04f('0x21')]);_0x453296['offset']=qs[_0xa04f('0x1f')](_0x6b88de[_0xa04f('0x36')]['offset']);}return _0x59773e[_0xa04f('0x53')](_0x453296);}})[_0xa04f('0x29')](function(_0x5653f0){if(_0x5653f0){return _0x5653f0?{'count':_0x125bda,'rows':_0x5653f0}:null;}})['then'](respondWithResult(_0x37bd1e,null))[_0xa04f('0x46')](handleError(_0x37bd1e,null));}; \ No newline at end of file +var _0xceee=['stack','name','send','index','map','SalesforceConfiguration','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','where','merge','VIRTUAL','filter','options','findAll','catch','includeAll','include','find','create','body','params','SalesforceField','rawAttributes','order','getFields','getSubjects','findOne','getDescriptions','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy'];(function(_0x4ab60f,_0x40d581){var _0x15319a=function(_0x1f5c7b){while(--_0x1f5c7b){_0x4ab60f['push'](_0x4ab60f['shift']());}};_0x15319a(++_0x40d581);}(_0xceee,0xbb));var _0xecee=function(_0x261d56,_0x31fc38){_0x261d56=_0x261d56-0x0;var _0x1da928=_0xceee[_0x261d56];return _0x1da928;};'use strict';var emlformat=require(_0xecee('0x0'));var rimraf=require(_0xecee('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xecee('0x2'));var moment=require(_0xecee('0x3'));var BPromise=require(_0xecee('0x4'));var Mustache=require(_0xecee('0x5'));var util=require(_0xecee('0x6'));var path=require(_0xecee('0x7'));var sox=require('sox');var csv=require(_0xecee('0x8'));var ejs=require(_0xecee('0x9'));var fs=require('fs');var fs_extra=require(_0xecee('0xa'));var _=require(_0xecee('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xecee('0xc'));var deskjs=require(_0xecee('0xd'));var toCsv=require('to-csv');var querystring=require(_0xecee('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xecee('0xf'));var qs=require(_0xecee('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xecee('0x11'));var utils=require('../../config/utils');var config=require(_0xecee('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0xecee('0x13'))['db'];function respondWithStatusCode(_0x9af27d,_0xa72d91){_0xa72d91=_0xa72d91||0xcc;return function(_0x2fb8eb){if(_0x2fb8eb){return _0x9af27d[_0xecee('0x14')](_0xa72d91);}return _0x9af27d[_0xecee('0x15')](_0xa72d91)[_0xecee('0x16')]();};}function respondWithResult(_0x3d8a2f,_0x5793d2){_0x5793d2=_0x5793d2||0xc8;return function(_0x3a7d2f){if(_0x3a7d2f){return _0x3d8a2f[_0xecee('0x15')](_0x5793d2)[_0xecee('0x17')](_0x3a7d2f);}};}function respondWithFilteredResult(_0x23c586,_0x3e04a0){return function(_0x48a9be){if(_0x48a9be){var _0x4754df=typeof _0x3e04a0[_0xecee('0x18')]===_0xecee('0x19')&&typeof _0x3e04a0[_0xecee('0x1a')]===_0xecee('0x19');var _0x1dd609=_0x48a9be[_0xecee('0x1b')];var _0x55dc2a=_0x4754df?0x0:_0x3e04a0[_0xecee('0x18')];var _0x308d2b=_0x4754df?_0x48a9be[_0xecee('0x1b')]:_0x3e04a0['offset']+_0x3e04a0[_0xecee('0x1a')];var _0x45a3af;if(_0x308d2b>=_0x1dd609){_0x308d2b=_0x1dd609;_0x45a3af=0xc8;}else{_0x45a3af=0xce;}_0x23c586[_0xecee('0x15')](_0x45a3af);return _0x23c586[_0xecee('0x1c')](_0xecee('0x1d'),_0x55dc2a+'-'+_0x308d2b+'/'+_0x1dd609)[_0xecee('0x17')](_0x48a9be);}return null;};}function patchUpdates(_0x481198){return function(_0x505af6){try{jsonpatch['apply'](_0x505af6,_0x481198,!![]);}catch(_0x9f8c62){return BPromise[_0xecee('0x1e')](_0x9f8c62);}return _0x505af6[_0xecee('0x1f')]();};}function saveUpdates(_0x86fe0f,_0x27e3d7){return function(_0x23b64a){if(_0x23b64a){return _0x23b64a[_0xecee('0x20')](_0x86fe0f)[_0xecee('0x21')](function(_0xc4ef66){return _0xc4ef66;});}return null;};}function removeEntity(_0x56e11c,_0x455743){return function(_0x5f09b0){if(_0x5f09b0){return _0x5f09b0[_0xecee('0x22')]()['then'](function(){_0x56e11c[_0xecee('0x15')](0xcc)[_0xecee('0x16')]();});}};}function handleEntityNotFound(_0x1ae344,_0x92055f){return function(_0x51f732){if(!_0x51f732){_0x1ae344['sendStatus'](0x194);}return _0x51f732;};}function handleError(_0x25b7af,_0x29f02c){_0x29f02c=_0x29f02c||0x1f4;return function(_0x2e6929){logger['error'](_0x2e6929[_0xecee('0x23')]);if(_0x2e6929[_0xecee('0x24')]){delete _0x2e6929[_0xecee('0x24')];}_0x25b7af[_0xecee('0x15')](_0x29f02c)[_0xecee('0x25')](_0x2e6929);};}exports[_0xecee('0x26')]=function(_0x4410d8,_0x42733d){var _0x4d5bb9={},_0x48e16b={},_0x72ae5f={'count':0x0,'rows':[]};var _0x1d5473=_[_0xecee('0x27')](db[_0xecee('0x28')]['rawAttributes'],function(_0x2ba54f){return{'name':_0x2ba54f['fieldName'],'type':_0x2ba54f[_0xecee('0x29')]['key']};});_0x48e16b[_0xecee('0x2a')]=_[_0xecee('0x27')](_0x1d5473,_0xecee('0x24'));_0x48e16b[_0xecee('0x2b')]=_[_0xecee('0x2c')](_0x4410d8['query']);_0x48e16b[_0xecee('0x2d')]=_[_0xecee('0x2e')](_0x48e16b[_0xecee('0x2a')],_0x48e16b[_0xecee('0x2b')]);_0x4d5bb9[_0xecee('0x2f')]=_[_0xecee('0x2e')](_0x48e16b['model'],qs[_0xecee('0x30')](_0x4410d8[_0xecee('0x2b')]['fields']));_0x4d5bb9[_0xecee('0x2f')]=_0x4d5bb9['attributes'][_0xecee('0x31')]?_0x4d5bb9['attributes']:_0x48e16b['model'];if(!_0x4410d8[_0xecee('0x2b')][_0xecee('0x32')](_0xecee('0x33'))){_0x4d5bb9['limit']=qs[_0xecee('0x1a')](_0x4410d8['query'][_0xecee('0x1a')]);_0x4d5bb9[_0xecee('0x18')]=qs['offset'](_0x4410d8[_0xecee('0x2b')]['offset']);}_0x4d5bb9['order']=qs[_0xecee('0x34')](_0x4410d8[_0xecee('0x2b')]['sort']);_0x4d5bb9['where']=qs['filters'](_[_0xecee('0x35')](_0x4410d8[_0xecee('0x2b')],_0x48e16b[_0xecee('0x2d')]),_0x1d5473);if(_0x4410d8[_0xecee('0x2b')]['filter']){_0x4d5bb9[_0xecee('0x36')]=_[_0xecee('0x37')](_0x4d5bb9[_0xecee('0x36')],{'$or':_[_0xecee('0x27')](_0x1d5473,function(_0x120a88){if(_0x120a88[_0xecee('0x29')]!==_0xecee('0x38')){var _0x499452={};_0x499452[_0x120a88[_0xecee('0x24')]]={'$like':'%'+_0x4410d8[_0xecee('0x2b')][_0xecee('0x39')]+'%'};return _0x499452;}})});}_0x4d5bb9=_[_0xecee('0x37')]({},_0x4d5bb9,_0x4410d8[_0xecee('0x3a')]);var _0x272a38={'where':_0x4d5bb9[_0xecee('0x36')]};return db[_0xecee('0x28')][_0xecee('0x1b')](_0x272a38)[_0xecee('0x21')](function(_0x407d4e){_0x72ae5f[_0xecee('0x1b')]=_0x407d4e;if(_0x4410d8[_0xecee('0x2b')]['includeAll']){_0x4d5bb9['include']=[{'all':!![]}];}return db[_0xecee('0x28')][_0xecee('0x3b')](_0x4d5bb9);})[_0xecee('0x21')](function(_0x3f5425){_0x72ae5f['rows']=_0x3f5425;return _0x72ae5f;})[_0xecee('0x21')](respondWithFilteredResult(_0x42733d,_0x4d5bb9))[_0xecee('0x3c')](handleError(_0x42733d,null));};exports['show']=function(_0x33a6a5,_0x462e47){var _0x5a4a8d={'raw':![],'where':{'id':_0x33a6a5['params']['id']}},_0x40a9a4={};_0x40a9a4[_0xecee('0x2a')]=_['keys'](db[_0xecee('0x28')]['rawAttributes']);_0x40a9a4[_0xecee('0x2b')]=_['keys'](_0x33a6a5['query']);_0x40a9a4[_0xecee('0x2d')]=_[_0xecee('0x2e')](_0x40a9a4[_0xecee('0x2a')],_0x40a9a4[_0xecee('0x2b')]);_0x5a4a8d[_0xecee('0x2f')]=_[_0xecee('0x2e')](_0x40a9a4[_0xecee('0x2a')],qs[_0xecee('0x30')](_0x33a6a5[_0xecee('0x2b')]['fields']));_0x5a4a8d[_0xecee('0x2f')]=_0x5a4a8d[_0xecee('0x2f')][_0xecee('0x31')]?_0x5a4a8d[_0xecee('0x2f')]:_0x40a9a4['model'];if(_0x33a6a5[_0xecee('0x2b')][_0xecee('0x3d')]){_0x5a4a8d[_0xecee('0x3e')]=[{'all':!![]}];}_0x5a4a8d=_[_0xecee('0x37')]({},_0x5a4a8d,_0x33a6a5[_0xecee('0x3a')]);return db['SalesforceConfiguration'][_0xecee('0x3f')](_0x5a4a8d)[_0xecee('0x21')](handleEntityNotFound(_0x462e47,null))[_0xecee('0x21')](respondWithResult(_0x462e47,null))[_0xecee('0x3c')](handleError(_0x462e47,null));};exports[_0xecee('0x40')]=function(_0x10b2fc,_0x23398c){return db[_0xecee('0x28')]['create'](_0x10b2fc[_0xecee('0x41')],{})[_0xecee('0x21')](respondWithResult(_0x23398c,0xc9))[_0xecee('0x3c')](handleError(_0x23398c,null));};exports[_0xecee('0x20')]=function(_0x4ffe13,_0x10b168){if(_0x4ffe13[_0xecee('0x41')]['id']){delete _0x4ffe13[_0xecee('0x41')]['id'];}return db[_0xecee('0x28')]['find']({'where':{'id':_0x4ffe13['params']['id']}})[_0xecee('0x21')](handleEntityNotFound(_0x10b168,null))[_0xecee('0x21')](saveUpdates(_0x4ffe13[_0xecee('0x41')],null))[_0xecee('0x21')](respondWithResult(_0x10b168,null))[_0xecee('0x3c')](handleError(_0x10b168,null));};exports[_0xecee('0x22')]=function(_0x4479cf,_0x2debd8){return db[_0xecee('0x28')][_0xecee('0x3f')]({'where':{'id':_0x4479cf[_0xecee('0x42')]['id']}})[_0xecee('0x21')](handleEntityNotFound(_0x2debd8,null))[_0xecee('0x21')](removeEntity(_0x2debd8,null))[_0xecee('0x3c')](handleError(_0x2debd8,null));};exports['getFields']=function(_0xb08e02,_0x2ff792,_0x246cbc){var _0x396282={};var _0x700ce7={};var _0x4851f9;var _0x2a9e8a;return db[_0xecee('0x28')]['findOne']({'where':{'id':_0xb08e02['params']['id']}})[_0xecee('0x21')](handleEntityNotFound(_0x2ff792,null))[_0xecee('0x21')](function(_0xc019ed){if(_0xc019ed){_0x4851f9=_0xc019ed;_0x700ce7[_0xecee('0x2a')]=_[_0xecee('0x2c')](db[_0xecee('0x43')][_0xecee('0x44')]);_0x700ce7[_0xecee('0x2b')]=_[_0xecee('0x2c')](_0xb08e02[_0xecee('0x2b')]);_0x700ce7[_0xecee('0x2d')]=_['intersection'](_0x700ce7['model'],_0x700ce7[_0xecee('0x2b')]);_0x396282[_0xecee('0x2f')]=_[_0xecee('0x2e')](_0x700ce7['model'],qs[_0xecee('0x30')](_0xb08e02[_0xecee('0x2b')]['fields']));_0x396282[_0xecee('0x2f')]=_0x396282['attributes']['length']?_0x396282[_0xecee('0x2f')]:_0x700ce7[_0xecee('0x2a')];_0x396282[_0xecee('0x45')]=qs[_0xecee('0x34')](_0xb08e02[_0xecee('0x2b')][_0xecee('0x34')]);_0x396282[_0xecee('0x36')]=qs[_0xecee('0x2d')](_['pick'](_0xb08e02[_0xecee('0x2b')],_0x700ce7[_0xecee('0x2d')]));if(_0xb08e02[_0xecee('0x2b')]['filter']){_0x396282['where']=_[_0xecee('0x37')](_0x396282['where'],{'$or':_[_0xecee('0x27')](_0x396282[_0xecee('0x2f')],function(_0x1a7f58){var _0x22082d={};_0x22082d[_0x1a7f58]={'$like':'%'+_0xb08e02[_0xecee('0x2b')]['filter']+'%'};return _0x22082d;})});}_0x396282=_[_0xecee('0x37')]({},_0x396282,_0xb08e02[_0xecee('0x3a')]);return _0x4851f9[_0xecee('0x46')](_0x396282);}})[_0xecee('0x21')](function(_0x35b1ed){if(_0x35b1ed){_0x2a9e8a=_0x35b1ed[_0xecee('0x31')];if(!_0xb08e02['query'][_0xecee('0x32')](_0xecee('0x33'))){_0x396282[_0xecee('0x1a')]=qs[_0xecee('0x1a')](_0xb08e02[_0xecee('0x2b')][_0xecee('0x1a')]);_0x396282[_0xecee('0x18')]=qs[_0xecee('0x18')](_0xb08e02['query'][_0xecee('0x18')]);}return _0x4851f9[_0xecee('0x46')](_0x396282);}})['then'](function(_0x5e5f5b){if(_0x5e5f5b){return _0x5e5f5b?{'count':_0x2a9e8a,'rows':_0x5e5f5b}:null;}})['then'](respondWithResult(_0x2ff792,null))['catch'](handleError(_0x2ff792,null));};exports[_0xecee('0x47')]=function(_0x3b2f71,_0x1e8bad,_0xac3408){var _0x5d1750={};var _0x4752fd={};var _0x4c8f0a;var _0x47a2ec;return db[_0xecee('0x28')][_0xecee('0x48')]({'where':{'id':_0x3b2f71['params']['id']}})['then'](handleEntityNotFound(_0x1e8bad,null))[_0xecee('0x21')](function(_0x39421f){if(_0x39421f){_0x4c8f0a=_0x39421f;_0x4752fd[_0xecee('0x2a')]=_['keys'](db[_0xecee('0x43')]['rawAttributes']);_0x4752fd[_0xecee('0x2b')]=_[_0xecee('0x2c')](_0x3b2f71['query']);_0x4752fd[_0xecee('0x2d')]=_[_0xecee('0x2e')](_0x4752fd[_0xecee('0x2a')],_0x4752fd[_0xecee('0x2b')]);_0x5d1750['attributes']=_['intersection'](_0x4752fd[_0xecee('0x2a')],qs[_0xecee('0x30')](_0x3b2f71['query'][_0xecee('0x30')]));_0x5d1750[_0xecee('0x2f')]=_0x5d1750['attributes'][_0xecee('0x31')]?_0x5d1750[_0xecee('0x2f')]:_0x4752fd[_0xecee('0x2a')];_0x5d1750[_0xecee('0x45')]=qs[_0xecee('0x34')](_0x3b2f71[_0xecee('0x2b')][_0xecee('0x34')]);_0x5d1750[_0xecee('0x36')]=qs[_0xecee('0x2d')](_['pick'](_0x3b2f71[_0xecee('0x2b')],_0x4752fd[_0xecee('0x2d')]));if(_0x3b2f71['query'][_0xecee('0x39')]){_0x5d1750[_0xecee('0x36')]=_[_0xecee('0x37')](_0x5d1750[_0xecee('0x36')],{'$or':_[_0xecee('0x27')](_0x5d1750[_0xecee('0x2f')],function(_0x25ceb5){var _0x52991f={};_0x52991f[_0x25ceb5]={'$like':'%'+_0x3b2f71[_0xecee('0x2b')][_0xecee('0x39')]+'%'};return _0x52991f;})});}_0x5d1750=_[_0xecee('0x37')]({},_0x5d1750,_0x3b2f71[_0xecee('0x3a')]);return _0x4c8f0a[_0xecee('0x47')](_0x5d1750);}})[_0xecee('0x21')](function(_0x4b8ae9){if(_0x4b8ae9){_0x47a2ec=_0x4b8ae9[_0xecee('0x31')];if(!_0x3b2f71[_0xecee('0x2b')]['hasOwnProperty']('nolimit')){_0x5d1750[_0xecee('0x1a')]=qs['limit'](_0x3b2f71[_0xecee('0x2b')][_0xecee('0x1a')]);_0x5d1750['offset']=qs[_0xecee('0x18')](_0x3b2f71[_0xecee('0x2b')]['offset']);}return _0x4c8f0a[_0xecee('0x47')](_0x5d1750);}})[_0xecee('0x21')](function(_0x2b4216){if(_0x2b4216){return _0x2b4216?{'count':_0x47a2ec,'rows':_0x2b4216}:null;}})[_0xecee('0x21')](respondWithResult(_0x1e8bad,null))[_0xecee('0x3c')](handleError(_0x1e8bad,null));};exports[_0xecee('0x49')]=function(_0x27020e,_0x21bd49,_0x250b87){var _0x25b4af={};var _0x1f837a={};var _0x12a86d;var _0x4c533f;return db['SalesforceConfiguration'][_0xecee('0x48')]({'where':{'id':_0x27020e[_0xecee('0x42')]['id']}})[_0xecee('0x21')](handleEntityNotFound(_0x21bd49,null))[_0xecee('0x21')](function(_0x57dd40){if(_0x57dd40){_0x12a86d=_0x57dd40;_0x1f837a[_0xecee('0x2a')]=_[_0xecee('0x2c')](db[_0xecee('0x43')][_0xecee('0x44')]);_0x1f837a[_0xecee('0x2b')]=_['keys'](_0x27020e[_0xecee('0x2b')]);_0x1f837a[_0xecee('0x2d')]=_[_0xecee('0x2e')](_0x1f837a[_0xecee('0x2a')],_0x1f837a[_0xecee('0x2b')]);_0x25b4af[_0xecee('0x2f')]=_[_0xecee('0x2e')](_0x1f837a[_0xecee('0x2a')],qs[_0xecee('0x30')](_0x27020e[_0xecee('0x2b')][_0xecee('0x30')]));_0x25b4af[_0xecee('0x2f')]=_0x25b4af[_0xecee('0x2f')]['length']?_0x25b4af[_0xecee('0x2f')]:_0x1f837a[_0xecee('0x2a')];_0x25b4af[_0xecee('0x45')]=qs[_0xecee('0x34')](_0x27020e[_0xecee('0x2b')][_0xecee('0x34')]);_0x25b4af[_0xecee('0x36')]=qs[_0xecee('0x2d')](_['pick'](_0x27020e[_0xecee('0x2b')],_0x1f837a[_0xecee('0x2d')]));if(_0x27020e[_0xecee('0x2b')]['filter']){_0x25b4af[_0xecee('0x36')]=_[_0xecee('0x37')](_0x25b4af[_0xecee('0x36')],{'$or':_['map'](_0x25b4af[_0xecee('0x2f')],function(_0x5bb00b){var _0xc52402={};_0xc52402[_0x5bb00b]={'$like':'%'+_0x27020e['query']['filter']+'%'};return _0xc52402;})});}_0x25b4af=_['merge']({},_0x25b4af,_0x27020e['options']);return _0x12a86d[_0xecee('0x49')](_0x25b4af);}})[_0xecee('0x21')](function(_0x19827d){if(_0x19827d){_0x4c533f=_0x19827d[_0xecee('0x31')];if(!_0x27020e['query'][_0xecee('0x32')]('nolimit')){_0x25b4af[_0xecee('0x1a')]=qs[_0xecee('0x1a')](_0x27020e[_0xecee('0x2b')][_0xecee('0x1a')]);_0x25b4af[_0xecee('0x18')]=qs[_0xecee('0x18')](_0x27020e['query'][_0xecee('0x18')]);}return _0x12a86d['getDescriptions'](_0x25b4af);}})[_0xecee('0x21')](function(_0x5aee3d){if(_0x5aee3d){return _0x5aee3d?{'count':_0x4c533f,'rows':_0x5aee3d}:null;}})[_0xecee('0x21')](respondWithResult(_0x21bd49,null))['catch'](handleError(_0x21bd49,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js index 7279069..cb7c391 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 _0x1b58=['util','api','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','SalesforceConfiguration','lodash'];(function(_0x5e570c,_0x233990){var _0xc62527=function(_0xd18777){while(--_0xd18777){_0x5e570c['push'](_0x5e570c['shift']());}};_0xc62527(++_0x233990);}(_0x1b58,0x1ee));var _0x81b5=function(_0x46693d,_0x48bf63){_0x46693d=_0x46693d-0x0;var _0x185fcf=_0x1b58[_0x46693d];return _0x185fcf;};'use strict';var _=require(_0x81b5('0x0'));var util=require(_0x81b5('0x1'));var logger=require('../../config/logger')(_0x81b5('0x2'));var moment=require('moment');var BPromise=require(_0x81b5('0x3'));var rp=require(_0x81b5('0x4'));var fs=require('fs');var path=require(_0x81b5('0x5'));var rimraf=require(_0x81b5('0x6'));var config=require(_0x81b5('0x7'));var attributes=require('./intSalesforceConfiguration.attributes');module[_0x81b5('0x8')]=function(_0x4f306a,_0x29512f){return _0x4f306a[_0x81b5('0x9')](_0x81b5('0xa'),attributes,{'tableName':'int_salesforce_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x670b=['../../config/environment','exports','int_salesforce_configurations','util','../../config/logger','moment','bluebird','path'];(function(_0x2d9f05,_0x5b4566){var _0x463cc4=function(_0x2b24ec){while(--_0x2b24ec){_0x2d9f05['push'](_0x2d9f05['shift']());}};_0x463cc4(++_0x5b4566);}(_0x670b,0x13b));var _0xb670=function(_0x21e039,_0x3e9573){_0x21e039=_0x21e039-0x0;var _0x586aba=_0x670b[_0x21e039];return _0x586aba;};'use strict';var _=require('lodash');var util=require(_0xb670('0x0'));var logger=require(_0xb670('0x1'))('api');var moment=require(_0xb670('0x2'));var BPromise=require(_0xb670('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb670('0x4'));var rimraf=require('rimraf');var config=require(_0xb670('0x5'));var attributes=require('./intSalesforceConfiguration.attributes');module[_0xb670('0x6')]=function(_0x5d1aaa,_0xb39dbb){return _0x5d1aaa['define']('SalesforceConfiguration',attributes,{'tableName':_0xb670('0x7'),'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 14f9675..5908efb 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 _0x9e5b=['SalesforceConfiguration,\x20%s,\x20%s','request\x20sent','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','then','info'];(function(_0x2fd37c,_0xde537a){var _0xff5ef5=function(_0x5bae19){while(--_0x5bae19){_0x2fd37c['push'](_0x2fd37c['shift']());}};_0xff5ef5(++_0xde537a);}(_0x9e5b,0x12f));var _0xb9e5=function(_0x41022c,_0x5f1d85){_0x41022c=_0x41022c-0x0;var _0x26d10d=_0x9e5b[_0x41022c];return _0x26d10d;};'use strict';var _=require('lodash');var util=require(_0xb9e5('0x0'));var moment=require('moment');var BPromise=require(_0xb9e5('0x1'));var rs=require(_0xb9e5('0x2'));var fs=require('fs');var Redis=require(_0xb9e5('0x3'));var db=require(_0xb9e5('0x4'))['db'];var utils=require(_0xb9e5('0x5'));var logger=require(_0xb9e5('0x6'))('rpc');var config=require(_0xb9e5('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xb9e5('0x8')][_0xb9e5('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x15529b,_0x35e0ce,_0x3cf59e){return new BPromise(function(_0x3865e4,_0x1de4c0){return client['request'](_0x15529b,_0x3cf59e)[_0xb9e5('0xa')](function(_0x37e97e){logger[_0xb9e5('0xb')](_0xb9e5('0xc'),_0x35e0ce,_0xb9e5('0xd'));logger['debug'](_0xb9e5('0xe'),_0x35e0ce,_0xb9e5('0xd'),JSON[_0xb9e5('0xf')](_0x37e97e));if(_0x37e97e['error']){if(_0x37e97e[_0xb9e5('0x10')][_0xb9e5('0x11')]===0x1f4){logger[_0xb9e5('0x10')](_0xb9e5('0xc'),_0x35e0ce,_0x37e97e[_0xb9e5('0x10')][_0xb9e5('0x12')]);return _0x1de4c0(_0x37e97e['error'][_0xb9e5('0x12')]);}logger[_0xb9e5('0x10')](_0xb9e5('0xc'),_0x35e0ce,_0x37e97e[_0xb9e5('0x10')][_0xb9e5('0x12')]);return _0x3865e4(_0x37e97e['error']['message']);}else{logger[_0xb9e5('0xb')](_0xb9e5('0xc'),_0x35e0ce,_0xb9e5('0xd'));_0x3865e4(_0x37e97e[_0xb9e5('0x13')][_0xb9e5('0x12')]);}})[_0xb9e5('0x14')](function(_0x4ecded){logger['error'](_0xb9e5('0xc'),_0x35e0ce,_0x4ecded);_0x1de4c0(_0x4ecded);});});} \ No newline at end of file +var _0xcea4=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','debug','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','SalesforceConfiguration,\x20%s,\x20%s','message','info','request\x20sent','result','catch','moment','bluebird','ioredis','../../mysqldb','../../config/utils'];(function(_0x436827,_0x570104){var _0x22434d=function(_0x55c067){while(--_0x55c067){_0x436827['push'](_0x436827['shift']());}};_0x22434d(++_0x570104);}(_0xcea4,0x85));var _0x4cea=function(_0x4cd690,_0x4797cc){_0x4cd690=_0x4cd690-0x0;var _0x4a74a9=_0xcea4[_0x4cd690];return _0x4a74a9;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x4cea('0x0'));var BPromise=require(_0x4cea('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4cea('0x2'));var db=require(_0x4cea('0x3'))['db'];var utils=require(_0x4cea('0x4'));var logger=require(_0x4cea('0x5'))(_0x4cea('0x6'));var config=require(_0x4cea('0x7'));var jayson=require(_0x4cea('0x8'));var client=jayson[_0x4cea('0x9')][_0x4cea('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x37b09b,_0x21b6bb,_0xd59571){return new BPromise(function(_0x4796eb,_0x47f6e0){return client[_0x4cea('0xb')](_0x37b09b,_0xd59571)[_0x4cea('0xc')](function(_0xd69532){logger['info']('SalesforceConfiguration,\x20%s,\x20%s',_0x21b6bb,'request\x20sent');logger[_0x4cea('0xd')](_0x4cea('0xe'),_0x21b6bb,'request\x20sent',JSON[_0x4cea('0xf')](_0xd69532));if(_0xd69532['error']){if(_0xd69532[_0x4cea('0x10')]['code']===0x1f4){logger[_0x4cea('0x10')](_0x4cea('0x11'),_0x21b6bb,_0xd69532['error']['message']);return _0x47f6e0(_0xd69532[_0x4cea('0x10')][_0x4cea('0x12')]);}logger[_0x4cea('0x10')]('SalesforceConfiguration,\x20%s,\x20%s',_0x21b6bb,_0xd69532[_0x4cea('0x10')][_0x4cea('0x12')]);return _0x4796eb(_0xd69532[_0x4cea('0x10')][_0x4cea('0x12')]);}else{logger[_0x4cea('0x13')](_0x4cea('0x11'),_0x21b6bb,_0x4cea('0x14'));_0x4796eb(_0xd69532[_0x4cea('0x15')][_0x4cea('0x12')]);}})[_0x4cea('0x16')](function(_0x5cda0e){logger[_0x4cea('0x10')]('SalesforceConfiguration,\x20%s,\x20%s',_0x21b6bb,_0x5cda0e);_0x47f6e0(_0x5cda0e);});});} \ No newline at end of file diff --git a/server/api/intSalesforceField/index.js b/server/api/intSalesforceField/index.js index 14a02cd..fc58937 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 _0x62b2=['../../config/environment','get','index','isAuthenticated','show','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x2222fe,_0x3be5a5){var _0x22304f=function(_0x41df2d){while(--_0x41df2d){_0x2222fe['push'](_0x2222fe['shift']());}};_0x22304f(++_0x3be5a5);}(_0x62b2,0xdc));var _0x262b=function(_0x48f7e3,_0x46d7cc){_0x48f7e3=_0x48f7e3-0x0;var _0x2459d7=_0x62b2[_0x48f7e3];return _0x2459d7;};'use strict';var multer=require(_0x262b('0x0'));var util=require(_0x262b('0x1'));var path=require(_0x262b('0x2'));var timeout=require(_0x262b('0x3'));var express=require(_0x262b('0x4'));var router=express[_0x262b('0x5')]();var fs_extra=require(_0x262b('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x262b('0x7'));var config=require(_0x262b('0x8'));var controller=require('./intSalesforceField.controller');router[_0x262b('0x9')]('/',auth['isAuthenticated'](),controller[_0x262b('0xa')]);router['get']('/:id',auth[_0x262b('0xb')](),controller[_0x262b('0xc')]);router['post']('/',auth[_0x262b('0xb')](),controller['create']);router[_0x262b('0xd')](_0x262b('0xe'),auth[_0x262b('0xb')](),controller[_0x262b('0xf')]);router[_0x262b('0x10')]('/:id',auth['isAuthenticated'](),controller[_0x262b('0x11')]);module[_0x262b('0x12')]=router; \ No newline at end of file +var _0x29e2=['index','show','post','put','/:id','delete','destroy','exports','multer','connect-timeout','express','Router','../../components/auth/service','get','isAuthenticated'];(function(_0x1694f5,_0x49b7c3){var _0x5b4321=function(_0x58c183){while(--_0x58c183){_0x1694f5['push'](_0x1694f5['shift']());}};_0x5b4321(++_0x49b7c3);}(_0x29e2,0x17f));var _0x229e=function(_0x17da92,_0x15892d){_0x17da92=_0x17da92-0x0;var _0x576a32=_0x29e2[_0x17da92];return _0x576a32;};'use strict';var multer=require(_0x229e('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x229e('0x1'));var express=require(_0x229e('0x2'));var router=express[_0x229e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x229e('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./intSalesforceField.controller');router[_0x229e('0x5')]('/',auth[_0x229e('0x6')](),controller[_0x229e('0x7')]);router[_0x229e('0x5')]('/:id',auth[_0x229e('0x6')](),controller[_0x229e('0x8')]);router[_0x229e('0x9')]('/',auth[_0x229e('0x6')](),controller['create']);router[_0x229e('0xa')](_0x229e('0xb'),auth[_0x229e('0x6')](),controller['update']);router[_0x229e('0xc')]('/:id',auth['isAuthenticated'](),controller[_0x229e('0xd')]);module[_0x229e('0xe')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.attributes.js b/server/api/intSalesforceField/intSalesforceField.attributes.js index 73f7f1d..0d014a0 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 _0x17b9=['string','variable','picklist','STRING','sequelize','exports','ENUM'];(function(_0x3cdee4,_0xfad487){var _0x35634b=function(_0x37372b){while(--_0x37372b){_0x3cdee4['push'](_0x3cdee4['shift']());}};_0x35634b(++_0xfad487);}(_0x17b9,0x18c));var _0x917b=function(_0x131abd,_0x4d8a17){_0x131abd=_0x131abd-0x0;var _0x49eb22=_0x17b9[_0x131abd];return _0x49eb22;};'use strict';var Sequelize=require(_0x917b('0x0'));module[_0x917b('0x1')]={'type':{'type':Sequelize[_0x917b('0x2')](_0x917b('0x3'),_0x917b('0x4'),'customVariable','keyValue',_0x917b('0x5')),'defaultValue':_0x917b('0x3')},'content':{'type':Sequelize[_0x917b('0x6')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize['ENUM'](_0x917b('0x3'),_0x917b('0x4'),'customVariable')},'keyContent':{'type':Sequelize[_0x917b('0x6')]},'idField':{'type':Sequelize['STRING']},'variableName':{'type':Sequelize[_0x917b('0x6')]}}; \ No newline at end of file +var _0x7cbd=['variable','customVariable','keyValue','picklist','STRING','sequelize','ENUM','string'];(function(_0x24061a,_0x1c9f4d){var _0x82054e=function(_0x2ec346){while(--_0x2ec346){_0x24061a['push'](_0x24061a['shift']());}};_0x82054e(++_0x1c9f4d);}(_0x7cbd,0xd5));var _0xd7cb=function(_0x43b584,_0x20a6bd){_0x43b584=_0x43b584-0x0;var _0x48f27b=_0x7cbd[_0x43b584];return _0x48f27b;};'use strict';var Sequelize=require(_0xd7cb('0x0'));module['exports']={'type':{'type':Sequelize[_0xd7cb('0x1')](_0xd7cb('0x2'),_0xd7cb('0x3'),_0xd7cb('0x4'),_0xd7cb('0x5'),_0xd7cb('0x6')),'defaultValue':'string'},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xd7cb('0x1')](_0xd7cb('0x2'),_0xd7cb('0x3'),_0xd7cb('0x4'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0xd7cb('0x7')]},'variableName':{'type':Sequelize[_0xd7cb('0x7')]}}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.controller.js b/server/api/intSalesforceField/intSalesforceField.controller.js index 0ea8ba1..f17679c 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 _0x6e2e=['../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','destroy','error','name','map','SalesforceField','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','include','findAll','show','params','keys','options','find','catch','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','ejs','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x6e2e,0xcc));var _0xe6e2=function(_0x38c699,_0x56fea7){_0x38c699=_0x38c699-0x0;var _0x3b1ded=_0x6e2e[_0x38c699];return _0x3b1ded;};'use strict';var emlformat=require(_0xe6e2('0x0'));var rimraf=require(_0xe6e2('0x1'));var zipdir=require(_0xe6e2('0x2'));var jsonpatch=require(_0xe6e2('0x3'));var rp=require(_0xe6e2('0x4'));var moment=require(_0xe6e2('0x5'));var BPromise=require(_0xe6e2('0x6'));var Mustache=require('mustache');var util=require(_0xe6e2('0x7'));var path=require(_0xe6e2('0x8'));var sox=require(_0xe6e2('0x9'));var csv=require('to-csv');var ejs=require(_0xe6e2('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xe6e2('0xb'));var crypto=require(_0xe6e2('0xc'));var jsforce=require(_0xe6e2('0xd'));var deskjs=require(_0xe6e2('0xe'));var toCsv=require(_0xe6e2('0xf'));var querystring=require(_0xe6e2('0x10'));var Papa=require(_0xe6e2('0x11'));var Redis=require(_0xe6e2('0x12'));var authService=require(_0xe6e2('0x13'));var qs=require(_0xe6e2('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe6e2('0x15'));var logger=require(_0xe6e2('0x16'))(_0xe6e2('0x17'));var utils=require('../../config/utils');var config=require(_0xe6e2('0x18'));var licenseUtil=require(_0xe6e2('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1b294d,_0x3d6be8){_0x3d6be8=_0x3d6be8||0xcc;return function(_0xfe8a72){if(_0xfe8a72){return _0x1b294d[_0xe6e2('0x1a')](_0x3d6be8);}return _0x1b294d[_0xe6e2('0x1b')](_0x3d6be8)[_0xe6e2('0x1c')]();};}function respondWithResult(_0x252960,_0x1cf4df){_0x1cf4df=_0x1cf4df||0xc8;return function(_0x69f30f){if(_0x69f30f){return _0x252960[_0xe6e2('0x1b')](_0x1cf4df)['json'](_0x69f30f);}};}function respondWithFilteredResult(_0x35d3b6,_0x4d8fef){return function(_0x3c2dd2){if(_0x3c2dd2){var _0x1cc027=typeof _0x4d8fef[_0xe6e2('0x1d')]===_0xe6e2('0x1e')&&typeof _0x4d8fef[_0xe6e2('0x1f')]===_0xe6e2('0x1e');var _0x4799d8=_0x3c2dd2['count'];var _0xb44f6d=_0x1cc027?0x0:_0x4d8fef[_0xe6e2('0x1d')];var _0x2cb45f=_0x1cc027?_0x3c2dd2[_0xe6e2('0x20')]:_0x4d8fef[_0xe6e2('0x1d')]+_0x4d8fef[_0xe6e2('0x1f')];var _0x10666e;if(_0x2cb45f>=_0x4799d8){_0x2cb45f=_0x4799d8;_0x10666e=0xc8;}else{_0x10666e=0xce;}_0x35d3b6['status'](_0x10666e);return _0x35d3b6[_0xe6e2('0x21')](_0xe6e2('0x22'),_0xb44f6d+'-'+_0x2cb45f+'/'+_0x4799d8)[_0xe6e2('0x23')](_0x3c2dd2);}return null;};}function patchUpdates(_0x58515b){return function(_0x4bbe0e){try{jsonpatch[_0xe6e2('0x24')](_0x4bbe0e,_0x58515b,!![]);}catch(_0x547e44){return BPromise[_0xe6e2('0x25')](_0x547e44);}return _0x4bbe0e[_0xe6e2('0x26')]();};}function saveUpdates(_0x13f882,_0x32ffe2){return function(_0xfff3b2){if(_0xfff3b2){return _0xfff3b2[_0xe6e2('0x27')](_0x13f882)[_0xe6e2('0x28')](function(_0x213ea7){return _0x213ea7;});}return null;};}function removeEntity(_0x246ccc,_0xcf3089){return function(_0x1164b9){if(_0x1164b9){return _0x1164b9[_0xe6e2('0x29')]()['then'](function(){_0x246ccc[_0xe6e2('0x1b')](0xcc)[_0xe6e2('0x1c')]();});}};}function handleEntityNotFound(_0x1c7ec3,_0x3f0e81){return function(_0x595f7f){if(!_0x595f7f){_0x1c7ec3[_0xe6e2('0x1a')](0x194);}return _0x595f7f;};}function handleError(_0x40bfa1,_0x137e53){_0x137e53=_0x137e53||0x1f4;return function(_0x2cf91a){logger[_0xe6e2('0x2a')](_0x2cf91a['stack']);if(_0x2cf91a['name']){delete _0x2cf91a[_0xe6e2('0x2b')];}_0x40bfa1['status'](_0x137e53)['send'](_0x2cf91a);};}exports['index']=function(_0x3f982e,_0x47742c){var _0x1c1c21={},_0x3fc6b7={},_0x5b07dd={'count':0x0,'rows':[]};var _0x4c0b15=_[_0xe6e2('0x2c')](db[_0xe6e2('0x2d')][_0xe6e2('0x2e')],function(_0x231973){return{'name':_0x231973[_0xe6e2('0x2f')],'type':_0x231973[_0xe6e2('0x30')][_0xe6e2('0x31')]};});_0x3fc6b7[_0xe6e2('0x32')]=_[_0xe6e2('0x2c')](_0x4c0b15,_0xe6e2('0x2b'));_0x3fc6b7[_0xe6e2('0x33')]=_['keys'](_0x3f982e['query']);_0x3fc6b7[_0xe6e2('0x34')]=_[_0xe6e2('0x35')](_0x3fc6b7[_0xe6e2('0x32')],_0x3fc6b7[_0xe6e2('0x33')]);_0x1c1c21[_0xe6e2('0x36')]=_[_0xe6e2('0x35')](_0x3fc6b7[_0xe6e2('0x32')],qs[_0xe6e2('0x37')](_0x3f982e[_0xe6e2('0x33')][_0xe6e2('0x37')]));_0x1c1c21[_0xe6e2('0x36')]=_0x1c1c21['attributes'][_0xe6e2('0x38')]?_0x1c1c21[_0xe6e2('0x36')]:_0x3fc6b7[_0xe6e2('0x32')];if(!_0x3f982e[_0xe6e2('0x33')][_0xe6e2('0x39')](_0xe6e2('0x3a'))){_0x1c1c21[_0xe6e2('0x1f')]=qs[_0xe6e2('0x1f')](_0x3f982e[_0xe6e2('0x33')]['limit']);_0x1c1c21['offset']=qs[_0xe6e2('0x1d')](_0x3f982e[_0xe6e2('0x33')][_0xe6e2('0x1d')]);}_0x1c1c21['order']=qs['sort'](_0x3f982e[_0xe6e2('0x33')][_0xe6e2('0x3b')]);_0x1c1c21[_0xe6e2('0x3c')]=qs[_0xe6e2('0x34')](_[_0xe6e2('0x3d')](_0x3f982e[_0xe6e2('0x33')],_0x3fc6b7[_0xe6e2('0x34')]),_0x4c0b15);if(_0x3f982e[_0xe6e2('0x33')][_0xe6e2('0x3e')]){_0x1c1c21['where']=_[_0xe6e2('0x3f')](_0x1c1c21[_0xe6e2('0x3c')],{'$or':_['map'](_0x4c0b15,function(_0x50bd5d){if(_0x50bd5d['type']!==_0xe6e2('0x40')){var _0x4bd6d9={};_0x4bd6d9[_0x50bd5d['name']]={'$like':'%'+_0x3f982e[_0xe6e2('0x33')]['filter']+'%'};return _0x4bd6d9;}})});}_0x1c1c21=_[_0xe6e2('0x3f')]({},_0x1c1c21,_0x3f982e['options']);var _0x439b9b={'where':_0x1c1c21[_0xe6e2('0x3c')]};return db[_0xe6e2('0x2d')]['count'](_0x439b9b)[_0xe6e2('0x28')](function(_0x21e823){_0x5b07dd[_0xe6e2('0x20')]=_0x21e823;if(_0x3f982e['query']['includeAll']){_0x1c1c21[_0xe6e2('0x41')]=[{'all':!![]}];}return db[_0xe6e2('0x2d')][_0xe6e2('0x42')](_0x1c1c21);})[_0xe6e2('0x28')](function(_0x3d3bf3){_0x5b07dd['rows']=_0x3d3bf3;return _0x5b07dd;})[_0xe6e2('0x28')](respondWithFilteredResult(_0x47742c,_0x1c1c21))['catch'](handleError(_0x47742c,null));};exports[_0xe6e2('0x43')]=function(_0x211171,_0x21861c){var _0x1dede3={'raw':!![],'where':{'id':_0x211171[_0xe6e2('0x44')]['id']}},_0x347f3e={};_0x347f3e[_0xe6e2('0x32')]=_[_0xe6e2('0x45')](db[_0xe6e2('0x2d')][_0xe6e2('0x2e')]);_0x347f3e[_0xe6e2('0x33')]=_[_0xe6e2('0x45')](_0x211171[_0xe6e2('0x33')]);_0x347f3e[_0xe6e2('0x34')]=_['intersection'](_0x347f3e[_0xe6e2('0x32')],_0x347f3e[_0xe6e2('0x33')]);_0x1dede3[_0xe6e2('0x36')]=_['intersection'](_0x347f3e[_0xe6e2('0x32')],qs[_0xe6e2('0x37')](_0x211171[_0xe6e2('0x33')]['fields']));_0x1dede3[_0xe6e2('0x36')]=_0x1dede3['attributes']['length']?_0x1dede3[_0xe6e2('0x36')]:_0x347f3e[_0xe6e2('0x32')];if(_0x211171[_0xe6e2('0x33')]['includeAll']){_0x1dede3['include']=[{'all':!![]}];}_0x1dede3=_['merge']({},_0x1dede3,_0x211171[_0xe6e2('0x46')]);return db['SalesforceField'][_0xe6e2('0x47')](_0x1dede3)[_0xe6e2('0x28')](handleEntityNotFound(_0x21861c,null))[_0xe6e2('0x28')](respondWithResult(_0x21861c,null))[_0xe6e2('0x48')](handleError(_0x21861c,null));};exports[_0xe6e2('0x49')]=function(_0x27d144,_0x3839c1){return db['SalesforceField'][_0xe6e2('0x49')](_0x27d144['body'],{})[_0xe6e2('0x28')](respondWithResult(_0x3839c1,0xc9))[_0xe6e2('0x48')](handleError(_0x3839c1,null));};exports[_0xe6e2('0x27')]=function(_0x2181fc,_0x4f1ded){if(_0x2181fc[_0xe6e2('0x4a')]['id']){delete _0x2181fc['body']['id'];}return db[_0xe6e2('0x2d')][_0xe6e2('0x47')]({'where':{'id':_0x2181fc[_0xe6e2('0x44')]['id']}})[_0xe6e2('0x28')](handleEntityNotFound(_0x4f1ded,null))[_0xe6e2('0x28')](saveUpdates(_0x2181fc[_0xe6e2('0x4a')],null))[_0xe6e2('0x28')](respondWithResult(_0x4f1ded,null))[_0xe6e2('0x48')](handleError(_0x4f1ded,null));};exports[_0xe6e2('0x29')]=function(_0x2903ba,_0x101e2b){return db[_0xe6e2('0x2d')][_0xe6e2('0x47')]({'where':{'id':_0x2903ba['params']['id']}})[_0xe6e2('0x28')](handleEntityNotFound(_0x101e2b,null))['then'](removeEntity(_0x101e2b,null))[_0xe6e2('0x48')](handleError(_0x101e2b,null));}; \ No newline at end of file +var _0x3ddc=['zip-dir','request-promise','moment','bluebird','mustache','util','path','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/utils','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','save','update','destroy','then','error','stack','name','index','SalesforceField','rawAttributes','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','find','create','body','params','eml-format','rimraf'];(function(_0x59e9f2,_0x94ab80){var _0x3b6f86=function(_0x1eea8a){while(--_0x1eea8a){_0x59e9f2['push'](_0x59e9f2['shift']());}};_0x3b6f86(++_0x94ab80);}(_0x3ddc,0xd3));var _0xc3dd=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x3ddc[_0x21a9d9];return _0x46adce;};'use strict';var emlformat=require(_0xc3dd('0x0'));var rimraf=require(_0xc3dd('0x1'));var zipdir=require(_0xc3dd('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xc3dd('0x3'));var moment=require(_0xc3dd('0x4'));var BPromise=require(_0xc3dd('0x5'));var Mustache=require(_0xc3dd('0x6'));var util=require(_0xc3dd('0x7'));var path=require(_0xc3dd('0x8'));var sox=require('sox');var csv=require(_0xc3dd('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc3dd('0xa'));var _=require(_0xc3dd('0xb'));var squel=require(_0xc3dd('0xc'));var crypto=require(_0xc3dd('0xd'));var jsforce=require(_0xc3dd('0xe'));var deskjs=require(_0xc3dd('0xf'));var toCsv=require(_0xc3dd('0x9'));var querystring=require(_0xc3dd('0x10'));var Papa=require(_0xc3dd('0x11'));var Redis=require('ioredis');var authService=require(_0xc3dd('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xc3dd('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0xc3dd('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xc3dd('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3fac12,_0xa0cc8c){_0xa0cc8c=_0xa0cc8c||0xcc;return function(_0x4e9074){if(_0x4e9074){return _0x3fac12[_0xc3dd('0x16')](_0xa0cc8c);}return _0x3fac12[_0xc3dd('0x17')](_0xa0cc8c)[_0xc3dd('0x18')]();};}function respondWithResult(_0x3fcdf6,_0x15b297){_0x15b297=_0x15b297||0xc8;return function(_0x1c31b0){if(_0x1c31b0){return _0x3fcdf6[_0xc3dd('0x17')](_0x15b297)[_0xc3dd('0x19')](_0x1c31b0);}};}function respondWithFilteredResult(_0x3e0f90,_0x464712){return function(_0x46a5ac){if(_0x46a5ac){var _0x3ce2e3=typeof _0x464712[_0xc3dd('0x1a')]===_0xc3dd('0x1b')&&typeof _0x464712[_0xc3dd('0x1c')]===_0xc3dd('0x1b');var _0x30908e=_0x46a5ac['count'];var _0x198df8=_0x3ce2e3?0x0:_0x464712[_0xc3dd('0x1a')];var _0x5598e=_0x3ce2e3?_0x46a5ac[_0xc3dd('0x1d')]:_0x464712[_0xc3dd('0x1a')]+_0x464712[_0xc3dd('0x1c')];var _0x4094f0;if(_0x5598e>=_0x30908e){_0x5598e=_0x30908e;_0x4094f0=0xc8;}else{_0x4094f0=0xce;}_0x3e0f90[_0xc3dd('0x17')](_0x4094f0);return _0x3e0f90[_0xc3dd('0x1e')](_0xc3dd('0x1f'),_0x198df8+'-'+_0x5598e+'/'+_0x30908e)[_0xc3dd('0x19')](_0x46a5ac);}return null;};}function patchUpdates(_0x57d7d5){return function(_0x22bd5e){try{jsonpatch['apply'](_0x22bd5e,_0x57d7d5,!![]);}catch(_0x168205){return BPromise['reject'](_0x168205);}return _0x22bd5e[_0xc3dd('0x20')]();};}function saveUpdates(_0x4622ed,_0x4905c3){return function(_0x305d65){if(_0x305d65){return _0x305d65[_0xc3dd('0x21')](_0x4622ed)['then'](function(_0x5ac530){return _0x5ac530;});}return null;};}function removeEntity(_0x13e9de,_0x3a99b0){return function(_0x3f46a1){if(_0x3f46a1){return _0x3f46a1[_0xc3dd('0x22')]()[_0xc3dd('0x23')](function(){_0x13e9de[_0xc3dd('0x17')](0xcc)[_0xc3dd('0x18')]();});}};}function handleEntityNotFound(_0x496ca0,_0x511465){return function(_0xd6d8c0){if(!_0xd6d8c0){_0x496ca0[_0xc3dd('0x16')](0x194);}return _0xd6d8c0;};}function handleError(_0x4cc1f1,_0x212d2f){_0x212d2f=_0x212d2f||0x1f4;return function(_0x4b4fd4){logger[_0xc3dd('0x24')](_0x4b4fd4[_0xc3dd('0x25')]);if(_0x4b4fd4[_0xc3dd('0x26')]){delete _0x4b4fd4[_0xc3dd('0x26')];}_0x4cc1f1[_0xc3dd('0x17')](_0x212d2f)['send'](_0x4b4fd4);};}exports[_0xc3dd('0x27')]=function(_0x4b5754,_0x466fbb){var _0x4544b2={},_0x120206={},_0x3f52aa={'count':0x0,'rows':[]};var _0x1e8483=_['map'](db[_0xc3dd('0x28')][_0xc3dd('0x29')],function(_0x52afb6){return{'name':_0x52afb6['fieldName'],'type':_0x52afb6[_0xc3dd('0x2a')][_0xc3dd('0x2b')]};});_0x120206[_0xc3dd('0x2c')]=_[_0xc3dd('0x2d')](_0x1e8483,_0xc3dd('0x26'));_0x120206[_0xc3dd('0x2e')]=_[_0xc3dd('0x2f')](_0x4b5754[_0xc3dd('0x2e')]);_0x120206[_0xc3dd('0x30')]=_[_0xc3dd('0x31')](_0x120206['model'],_0x120206[_0xc3dd('0x2e')]);_0x4544b2[_0xc3dd('0x32')]=_[_0xc3dd('0x31')](_0x120206['model'],qs[_0xc3dd('0x33')](_0x4b5754['query']['fields']));_0x4544b2[_0xc3dd('0x32')]=_0x4544b2['attributes'][_0xc3dd('0x34')]?_0x4544b2[_0xc3dd('0x32')]:_0x120206[_0xc3dd('0x2c')];if(!_0x4b5754['query'][_0xc3dd('0x35')](_0xc3dd('0x36'))){_0x4544b2[_0xc3dd('0x1c')]=qs[_0xc3dd('0x1c')](_0x4b5754[_0xc3dd('0x2e')][_0xc3dd('0x1c')]);_0x4544b2['offset']=qs[_0xc3dd('0x1a')](_0x4b5754['query'][_0xc3dd('0x1a')]);}_0x4544b2[_0xc3dd('0x37')]=qs[_0xc3dd('0x38')](_0x4b5754[_0xc3dd('0x2e')][_0xc3dd('0x38')]);_0x4544b2[_0xc3dd('0x39')]=qs[_0xc3dd('0x30')](_[_0xc3dd('0x3a')](_0x4b5754['query'],_0x120206[_0xc3dd('0x30')]),_0x1e8483);if(_0x4b5754[_0xc3dd('0x2e')][_0xc3dd('0x3b')]){_0x4544b2['where']=_[_0xc3dd('0x3c')](_0x4544b2[_0xc3dd('0x39')],{'$or':_[_0xc3dd('0x2d')](_0x1e8483,function(_0x192493){if(_0x192493[_0xc3dd('0x2a')]!==_0xc3dd('0x3d')){var _0x118985={};_0x118985[_0x192493[_0xc3dd('0x26')]]={'$like':'%'+_0x4b5754[_0xc3dd('0x2e')][_0xc3dd('0x3b')]+'%'};return _0x118985;}})});}_0x4544b2=_[_0xc3dd('0x3c')]({},_0x4544b2,_0x4b5754[_0xc3dd('0x3e')]);var _0x1a079f={'where':_0x4544b2['where']};return db[_0xc3dd('0x28')][_0xc3dd('0x1d')](_0x1a079f)[_0xc3dd('0x23')](function(_0x29c5b7){_0x3f52aa['count']=_0x29c5b7;if(_0x4b5754[_0xc3dd('0x2e')][_0xc3dd('0x3f')]){_0x4544b2[_0xc3dd('0x40')]=[{'all':!![]}];}return db['SalesforceField']['findAll'](_0x4544b2);})[_0xc3dd('0x23')](function(_0x1ee539){_0x3f52aa[_0xc3dd('0x41')]=_0x1ee539;return _0x3f52aa;})[_0xc3dd('0x23')](respondWithFilteredResult(_0x466fbb,_0x4544b2))[_0xc3dd('0x42')](handleError(_0x466fbb,null));};exports['show']=function(_0xa7dd25,_0x2572b1){var _0x514a04={'raw':!![],'where':{'id':_0xa7dd25['params']['id']}},_0x3dce56={};_0x3dce56[_0xc3dd('0x2c')]=_[_0xc3dd('0x2f')](db[_0xc3dd('0x28')][_0xc3dd('0x29')]);_0x3dce56['query']=_[_0xc3dd('0x2f')](_0xa7dd25[_0xc3dd('0x2e')]);_0x3dce56['filters']=_[_0xc3dd('0x31')](_0x3dce56[_0xc3dd('0x2c')],_0x3dce56['query']);_0x514a04[_0xc3dd('0x32')]=_['intersection'](_0x3dce56['model'],qs['fields'](_0xa7dd25[_0xc3dd('0x2e')][_0xc3dd('0x33')]));_0x514a04[_0xc3dd('0x32')]=_0x514a04['attributes']['length']?_0x514a04[_0xc3dd('0x32')]:_0x3dce56[_0xc3dd('0x2c')];if(_0xa7dd25[_0xc3dd('0x2e')]['includeAll']){_0x514a04[_0xc3dd('0x40')]=[{'all':!![]}];}_0x514a04=_['merge']({},_0x514a04,_0xa7dd25[_0xc3dd('0x3e')]);return db[_0xc3dd('0x28')][_0xc3dd('0x43')](_0x514a04)[_0xc3dd('0x23')](handleEntityNotFound(_0x2572b1,null))[_0xc3dd('0x23')](respondWithResult(_0x2572b1,null))[_0xc3dd('0x42')](handleError(_0x2572b1,null));};exports[_0xc3dd('0x44')]=function(_0x3c2d25,_0x1c5b1e){return db[_0xc3dd('0x28')]['create'](_0x3c2d25['body'],{})[_0xc3dd('0x23')](respondWithResult(_0x1c5b1e,0xc9))[_0xc3dd('0x42')](handleError(_0x1c5b1e,null));};exports[_0xc3dd('0x21')]=function(_0x42fc2b,_0x526274){if(_0x42fc2b[_0xc3dd('0x45')]['id']){delete _0x42fc2b[_0xc3dd('0x45')]['id'];}return db[_0xc3dd('0x28')]['find']({'where':{'id':_0x42fc2b[_0xc3dd('0x46')]['id']}})['then'](handleEntityNotFound(_0x526274,null))['then'](saveUpdates(_0x42fc2b['body'],null))['then'](respondWithResult(_0x526274,null))['catch'](handleError(_0x526274,null));};exports[_0xc3dd('0x22')]=function(_0x4b98f2,_0x3f5466){return db['SalesforceField']['find']({'where':{'id':_0x4b98f2['params']['id']}})[_0xc3dd('0x23')](handleEntityNotFound(_0x3f5466,null))[_0xc3dd('0x23')](removeEntity(_0x3f5466,null))[_0xc3dd('0x42')](handleError(_0x3f5466,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.model.js b/server/api/intSalesforceField/intSalesforceField.model.js index 6bac91e..2e19a4c 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 _0x3111=['request-promise','path','rimraf','./intSalesforceField.attributes','exports','define','SalesforceField','int_salesforce_fields','idField','FieldId','lodash','../../config/logger','api','bluebird'];(function(_0x4b0f70,_0x1a5f81){var _0x1bd81f=function(_0x4bce22){while(--_0x4bce22){_0x4b0f70['push'](_0x4b0f70['shift']());}};_0x1bd81f(++_0x1a5f81);}(_0x3111,0x130));var _0x1311=function(_0x40538d,_0x291ee3){_0x40538d=_0x40538d-0x0;var _0x2fdbb8=_0x3111[_0x40538d];return _0x2fdbb8;};'use strict';var _=require(_0x1311('0x0'));var util=require('util');var logger=require(_0x1311('0x1'))(_0x1311('0x2'));var moment=require('moment');var BPromise=require(_0x1311('0x3'));var rp=require(_0x1311('0x4'));var fs=require('fs');var path=require(_0x1311('0x5'));var rimraf=require(_0x1311('0x6'));var config=require('../../config/environment');var attributes=require(_0x1311('0x7'));module[_0x1311('0x8')]=function(_0x559481,_0x2c3659){return _0x559481[_0x1311('0x9')](_0x1311('0xa'),attributes,{'tableName':_0x1311('0xb'),'paranoid':![],'indexes':[{'name':'salesforce_unique_index','fields':[_0x1311('0xc'),_0x1311('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x94b4=['./intSalesforceField.attributes','exports','define','SalesforceField','int_salesforce_fields','salesforce_unique_index','idField','FieldId','util','../../config/logger','api','request-promise','path','rimraf','../../config/environment'];(function(_0x598aa9,_0x36ce33){var _0x4ccbc3=function(_0x3be91a){while(--_0x3be91a){_0x598aa9['push'](_0x598aa9['shift']());}};_0x4ccbc3(++_0x36ce33);}(_0x94b4,0x1ca));var _0x494b=function(_0x3f5a5a,_0x3ab1e8){_0x3f5a5a=_0x3f5a5a-0x0;var _0x508359=_0x94b4[_0x3f5a5a];return _0x508359;};'use strict';var _=require('lodash');var util=require(_0x494b('0x0'));var logger=require(_0x494b('0x1'))(_0x494b('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x494b('0x3'));var fs=require('fs');var path=require(_0x494b('0x4'));var rimraf=require(_0x494b('0x5'));var config=require(_0x494b('0x6'));var attributes=require(_0x494b('0x7'));module[_0x494b('0x8')]=function(_0x48b897,_0x25b232){return _0x48b897[_0x494b('0x9')](_0x494b('0xa'),attributes,{'tableName':_0x494b('0xb'),'paranoid':![],'indexes':[{'name':_0x494b('0xc'),'fields':[_0x494b('0xd'),_0x494b('0xe')],'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 6905c93..d126ad8 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 _0x8a3d=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','then','SalesforceField,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','info','result','lodash','util','moment','bluebird','randomstring'];(function(_0x2bdf04,_0x5e608e){var _0x33ce04=function(_0x357c41){while(--_0x357c41){_0x2bdf04['push'](_0x2bdf04['shift']());}};_0x33ce04(++_0x5e608e);}(_0x8a3d,0xff));var _0xd8a3=function(_0x5f1e7b,_0x10b34a){_0x5f1e7b=_0x5f1e7b-0x0;var _0x5bbb10=_0x8a3d[_0x5f1e7b];return _0x5bbb10;};'use strict';var _=require(_0xd8a3('0x0'));var util=require(_0xd8a3('0x1'));var moment=require(_0xd8a3('0x2'));var BPromise=require(_0xd8a3('0x3'));var rs=require(_0xd8a3('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd8a3('0x5'))['db'];var utils=require(_0xd8a3('0x6'));var logger=require(_0xd8a3('0x7'))(_0xd8a3('0x8'));var config=require(_0xd8a3('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xd8a3('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x397763,_0x46d08e,_0x472995){return new BPromise(function(_0x5672a8,_0xf809df){return client['request'](_0x397763,_0x472995)[_0xd8a3('0xb')](function(_0x53b0d0){logger['info'](_0xd8a3('0xc'),_0x46d08e,_0xd8a3('0xd'));logger[_0xd8a3('0xe')]('SalesforceField,\x20%s,\x20%s,\x20%s',_0x46d08e,'request\x20sent',JSON[_0xd8a3('0xf')](_0x53b0d0));if(_0x53b0d0[_0xd8a3('0x10')]){if(_0x53b0d0[_0xd8a3('0x10')]['code']===0x1f4){logger[_0xd8a3('0x10')](_0xd8a3('0xc'),_0x46d08e,_0x53b0d0[_0xd8a3('0x10')]['message']);return _0xf809df(_0x53b0d0[_0xd8a3('0x10')][_0xd8a3('0x11')]);}logger[_0xd8a3('0x10')](_0xd8a3('0xc'),_0x46d08e,_0x53b0d0[_0xd8a3('0x10')][_0xd8a3('0x11')]);return _0x5672a8(_0x53b0d0['error'][_0xd8a3('0x11')]);}else{logger[_0xd8a3('0x12')](_0xd8a3('0xc'),_0x46d08e,_0xd8a3('0xd'));_0x5672a8(_0x53b0d0[_0xd8a3('0x13')]['message']);}})['catch'](function(_0x4b83fa){logger[_0xd8a3('0x10')](_0xd8a3('0xc'),_0x46d08e,_0x4b83fa);_0xf809df(_0x4b83fa);});});} \ No newline at end of file +var _0x4dd9=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','SalesforceField,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','lodash'];(function(_0x2da70f,_0x6329f0){var _0x3fcba4=function(_0x521f82){while(--_0x521f82){_0x2da70f['push'](_0x2da70f['shift']());}};_0x3fcba4(++_0x6329f0);}(_0x4dd9,0x18f));var _0x94dd=function(_0x36a997,_0x288f0b){_0x36a997=_0x36a997-0x0;var _0x561b1b=_0x4dd9[_0x36a997];return _0x561b1b;};'use strict';var _=require(_0x94dd('0x0'));var util=require(_0x94dd('0x1'));var moment=require(_0x94dd('0x2'));var BPromise=require(_0x94dd('0x3'));var rs=require(_0x94dd('0x4'));var fs=require('fs');var Redis=require(_0x94dd('0x5'));var db=require(_0x94dd('0x6'))['db'];var utils=require(_0x94dd('0x7'));var logger=require(_0x94dd('0x8'))('rpc');var config=require(_0x94dd('0x9'));var jayson=require(_0x94dd('0xa'));var client=jayson[_0x94dd('0xb')][_0x94dd('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x45b8ec,_0x1b2a7e,_0x313fdc){return new BPromise(function(_0x569092,_0x420739){return client[_0x94dd('0xd')](_0x45b8ec,_0x313fdc)[_0x94dd('0xe')](function(_0x2fd6f4){logger[_0x94dd('0xf')](_0x94dd('0x10'),_0x1b2a7e,'request\x20sent');logger[_0x94dd('0x11')]('SalesforceField,\x20%s,\x20%s,\x20%s',_0x1b2a7e,_0x94dd('0x12'),JSON[_0x94dd('0x13')](_0x2fd6f4));if(_0x2fd6f4['error']){if(_0x2fd6f4[_0x94dd('0x14')][_0x94dd('0x15')]===0x1f4){logger[_0x94dd('0x14')](_0x94dd('0x10'),_0x1b2a7e,_0x2fd6f4[_0x94dd('0x14')][_0x94dd('0x16')]);return _0x420739(_0x2fd6f4[_0x94dd('0x14')][_0x94dd('0x16')]);}logger[_0x94dd('0x14')](_0x94dd('0x10'),_0x1b2a7e,_0x2fd6f4['error'][_0x94dd('0x16')]);return _0x569092(_0x2fd6f4[_0x94dd('0x14')][_0x94dd('0x16')]);}else{logger['info']('SalesforceField,\x20%s,\x20%s',_0x1b2a7e,_0x94dd('0x12'));_0x569092(_0x2fd6f4[_0x94dd('0x17')][_0x94dd('0x16')]);}})[_0x94dd('0x18')](function(_0x5d8a5e){logger[_0x94dd('0x14')](_0x94dd('0x10'),_0x1b2a7e,_0x5d8a5e);_0x420739(_0x5d8a5e);});});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/index.js b/server/api/intServicenowAccount/index.js index 892a1ce..e504d40 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 _0x8445=['/:id/fields','getFields','post','create','addConfiguration','/:id','delete','destroy','exports','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intServicenowAccount.controller','get','index','isAuthenticated','show','/:id/configurations','getConfigurations'];(function(_0x449284,_0x2f5d76){var _0xcdd966=function(_0x3a55d0){while(--_0x3a55d0){_0x449284['push'](_0x449284['shift']());}};_0xcdd966(++_0x2f5d76);}(_0x8445,0x1a7));var _0x5844=function(_0xda99d6,_0x5d0efa){_0xda99d6=_0xda99d6-0x0;var _0x4d8540=_0x8445[_0xda99d6];return _0x4d8540;};'use strict';var multer=require(_0x5844('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x5844('0x1'));var express=require(_0x5844('0x2'));var router=express[_0x5844('0x3')]();var fs_extra=require(_0x5844('0x4'));var auth=require(_0x5844('0x5'));var interaction=require(_0x5844('0x6'));var config=require('../../config/environment');var controller=require(_0x5844('0x7'));router[_0x5844('0x8')]('/',auth['isAuthenticated'](),controller[_0x5844('0x9')]);router['get']('/:id',auth[_0x5844('0xa')](),controller[_0x5844('0xb')]);router['get'](_0x5844('0xc'),auth['isAuthenticated'](),controller[_0x5844('0xd')]);router[_0x5844('0x8')](_0x5844('0xe'),auth[_0x5844('0xa')](),controller[_0x5844('0xf')]);router[_0x5844('0x10')]('/',auth[_0x5844('0xa')](),controller[_0x5844('0x11')]);router[_0x5844('0x10')]('/:id/configurations',auth[_0x5844('0xa')](),controller[_0x5844('0x12')]);router['put'](_0x5844('0x13'),auth[_0x5844('0xa')](),controller['update']);router[_0x5844('0x14')](_0x5844('0x13'),auth['isAuthenticated'](),controller[_0x5844('0x15')]);module[_0x5844('0x16')]=router; \ No newline at end of file +var _0x3785=['destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./intServicenowAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','/:id/fields','create','post','addConfiguration','update','delete'];(function(_0x3ab9ee,_0x4a74b8){var _0x82ee88=function(_0x6ccc7e){while(--_0x6ccc7e){_0x3ab9ee['push'](_0x3ab9ee['shift']());}};_0x82ee88(++_0x4a74b8);}(_0x3785,0x92));var _0x5378=function(_0xae7c2f,_0xf31e04){_0xae7c2f=_0xae7c2f-0x0;var _0x5d7001=_0x3785[_0xae7c2f];return _0x5d7001;};'use strict';var multer=require(_0x5378('0x0'));var util=require(_0x5378('0x1'));var path=require(_0x5378('0x2'));var timeout=require(_0x5378('0x3'));var express=require(_0x5378('0x4'));var router=express[_0x5378('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x5378('0x6'));var interaction=require(_0x5378('0x7'));var config=require('../../config/environment');var controller=require(_0x5378('0x8'));router[_0x5378('0x9')]('/',auth[_0x5378('0xa')](),controller[_0x5378('0xb')]);router[_0x5378('0x9')](_0x5378('0xc'),auth[_0x5378('0xa')](),controller[_0x5378('0xd')]);router[_0x5378('0x9')](_0x5378('0xe'),auth[_0x5378('0xa')](),controller[_0x5378('0xf')]);router[_0x5378('0x9')](_0x5378('0x10'),auth[_0x5378('0xa')](),controller['getFields']);router['post']('/',auth[_0x5378('0xa')](),controller[_0x5378('0x11')]);router[_0x5378('0x12')]('/:id/configurations',auth[_0x5378('0xa')](),controller[_0x5378('0x13')]);router['put'](_0x5378('0xc'),auth[_0x5378('0xa')](),controller[_0x5378('0x14')]);router[_0x5378('0x15')](_0x5378('0xc'),auth[_0x5378('0xa')](),controller[_0x5378('0x16')]);module[_0x5378('0x17')]=router; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.attributes.js b/server/api/intServicenowAccount/intServicenowAccount.attributes.js index 58637a8..ecd0c8a 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 _0x3b2b=['sequelize','exports','STRING','username','remoteUri'];(function(_0x29498c,_0x463c64){var _0x2d2591=function(_0x50d6d2){while(--_0x50d6d2){_0x29498c['push'](_0x29498c['shift']());}};_0x2d2591(++_0x463c64);}(_0x3b2b,0x64));var _0xb3b2=function(_0x37bd26,_0x5ad346){_0x37bd26=_0x37bd26-0x0;var _0xe83dc4=_0x3b2b[_0x37bd26];return _0xe83dc4;};'use strict';var Sequelize=require(_0xb3b2('0x0'));module[_0xb3b2('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xb3b2('0x2')]},'username':{'type':Sequelize[_0xb3b2('0x2')],'unique':_0xb3b2('0x3')},'password':{'type':Sequelize[_0xb3b2('0x2')]},'email':{'type':Sequelize[_0xb3b2('0x2')]},'remoteUri':{'type':Sequelize[_0xb3b2('0x2')],'unique':_0xb3b2('0x4')},'serverUrl':{'type':Sequelize[_0xb3b2('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0xfdb4=['exports','STRING','remoteUri','sequelize'];(function(_0x165058,_0x151426){var _0x3dc05e=function(_0x516698){while(--_0x516698){_0x165058['push'](_0x165058['shift']());}};_0x3dc05e(++_0x151426);}(_0xfdb4,0x127));var _0x4fdb=function(_0x28d18d,_0x55896b){_0x28d18d=_0x28d18d-0x0;var _0x470640=_0xfdb4[_0x28d18d];return _0x470640;};'use strict';var Sequelize=require(_0x4fdb('0x0'));module[_0x4fdb('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x4fdb('0x2')]},'username':{'type':Sequelize[_0x4fdb('0x2')],'unique':'username'},'password':{'type':Sequelize[_0x4fdb('0x2')]},'email':{'type':Sequelize[_0x4fdb('0x2')]},'remoteUri':{'type':Sequelize[_0x4fdb('0x2')],'unique':_0x4fdb('0x3')},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.controller.js b/server/api/intServicenowAccount/intServicenowAccount.controller.js index c6764a5..33a8376 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 _0x8fab=['remove','includes','forEach','internalType','label','push','all','assign','TCL:\x20_object','log','concat','ServiceNow\x20error:\x20','statusCode','test','Wrong\x20credentials','True','true','sys_choice?sysparm_query=name=incident^element=','inactive','false','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','ejs','fs-extra','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','json','undefined','limit','offset','count','set','Content-Range','save','update','then','destroy','end','error','name','send','map','rawAttributes','query','keys','filters','model','attributes','intersection','fields','order','sort','where','type','VIRTUAL','merge','options','ServicenowAccount','include','findAll','catch','show','params','length','includeAll','create','body','find','getConfigurations','pick','filter','hasOwnProperty','nolimit','addConfiguration','findOne','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','ServicenowConfiguration','ServicenowField','getFields','hold_reason','knowledge','subcategory','close_code','category','parent','made_sla','caused_by','watch_list','upon_reject','sys_updated_on','approval_history','number','resolved_by','opened_by','user_input','sys_created_on','sys_domain','state','sys_created_by','calendar_stc','closed_at','cmdb_ci','impact','business_service','priority','rfc','time_worked','opened_at','business_duration','group_list','work_end','reopened_time','resolved_at','short_description','delivery_task','work_start','assignment_group','business_stc','additional_assignee_list','description','calendar_duration','notify','parent_incident','contact_type','reopened_by','urgency','company','reassignment_count','assigned_to','severity','comments','sla_due','approval','due_date','sys_tags','upon_approval','location','username','password','email','serverUrl','remoteUri','slice','substring','lastIndexOf','format','%s/api/now/doc/table/schema/','GET','incident?sysparm_display_value=all','result','incident\x20table\x20objects'];(function(_0x505489,_0x5b28c1){var _0x103f1d=function(_0x4ece9e){while(--_0x4ece9e){_0x505489['push'](_0x505489['shift']());}};_0x103f1d(++_0x5b28c1);}(_0x8fab,0x178));var _0xb8fa=function(_0x113411,_0x3bf18b){_0x113411=_0x113411-0x0;var _0x1c6a0e=_0x8fab[_0x113411];return _0x1c6a0e;};'use strict';var emlformat=require(_0xb8fa('0x0'));var rimraf=require(_0xb8fa('0x1'));var zipdir=require(_0xb8fa('0x2'));var jsonpatch=require(_0xb8fa('0x3'));var rp=require(_0xb8fa('0x4'));var moment=require(_0xb8fa('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xb8fa('0x6'));var path=require(_0xb8fa('0x7'));var sox=require(_0xb8fa('0x8'));var csv=require('to-csv');var ejs=require(_0xb8fa('0x9'));var fs=require('fs');var fs_extra=require(_0xb8fa('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xb8fa('0xb'));var jsforce=require(_0xb8fa('0xc'));var deskjs=require(_0xb8fa('0xd'));var toCsv=require(_0xb8fa('0xe'));var querystring=require('querystring');var Papa=require(_0xb8fa('0xf'));var Redis=require(_0xb8fa('0x10'));var authService=require(_0xb8fa('0x11'));var qs=require(_0xb8fa('0x12'));var as=require(_0xb8fa('0x13'));var hardwareService=require(_0xb8fa('0x14'));var logger=require(_0xb8fa('0x15'))('api');var utils=require(_0xb8fa('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xb8fa('0x17'));var db=require(_0xb8fa('0x18'))['db'];var integrations=require(_0xb8fa('0x19'));function respondWithStatusCode(_0x404523,_0x5e3d63){_0x5e3d63=_0x5e3d63||0xcc;return function(_0x3b8aeb){if(_0x3b8aeb){return _0x404523[_0xb8fa('0x1a')](_0x5e3d63);}return _0x404523[_0xb8fa('0x1b')](_0x5e3d63)['end']();};}function respondWithResult(_0x219468,_0x84f1ae){_0x84f1ae=_0x84f1ae||0xc8;return function(_0x567a5e){if(_0x567a5e){return _0x219468[_0xb8fa('0x1b')](_0x84f1ae)[_0xb8fa('0x1c')](_0x567a5e);}};}function respondWithFilteredResult(_0x4baa84,_0x774f8c){return function(_0x56d817){if(_0x56d817){var _0x24f20f=typeof _0x774f8c['offset']===_0xb8fa('0x1d')&&typeof _0x774f8c[_0xb8fa('0x1e')]===_0xb8fa('0x1d');var _0x42d7a5=_0x56d817['count'];var _0x627a1=_0x24f20f?0x0:_0x774f8c[_0xb8fa('0x1f')];var _0x50e8e9=_0x24f20f?_0x56d817[_0xb8fa('0x20')]:_0x774f8c[_0xb8fa('0x1f')]+_0x774f8c[_0xb8fa('0x1e')];var _0x3a1a10;if(_0x50e8e9>=_0x42d7a5){_0x50e8e9=_0x42d7a5;_0x3a1a10=0xc8;}else{_0x3a1a10=0xce;}_0x4baa84['status'](_0x3a1a10);return _0x4baa84[_0xb8fa('0x21')](_0xb8fa('0x22'),_0x627a1+'-'+_0x50e8e9+'/'+_0x42d7a5)[_0xb8fa('0x1c')](_0x56d817);}return null;};}function patchUpdates(_0x293604){return function(_0x1648bd){try{jsonpatch['apply'](_0x1648bd,_0x293604,!![]);}catch(_0x5c1582){return BPromise['reject'](_0x5c1582);}return _0x1648bd[_0xb8fa('0x23')]();};}function saveUpdates(_0xe73f6c,_0x2850d2){return function(_0x5f4f4f){if(_0x5f4f4f){return _0x5f4f4f[_0xb8fa('0x24')](_0xe73f6c)[_0xb8fa('0x25')](function(_0x59fba3){return _0x59fba3;});}return null;};}function removeEntity(_0x2d1db4,_0x665bdb){return function(_0x9a58d3){if(_0x9a58d3){return _0x9a58d3[_0xb8fa('0x26')]()[_0xb8fa('0x25')](function(){_0x2d1db4['status'](0xcc)[_0xb8fa('0x27')]();});}};}function handleEntityNotFound(_0x528953,_0x431d81){return function(_0x1d67ee){if(!_0x1d67ee){_0x528953['sendStatus'](0x194);}return _0x1d67ee;};}function handleError(_0x393d3a,_0x50771d){_0x50771d=_0x50771d||0x1f4;return function(_0x376cc1){logger[_0xb8fa('0x28')](_0x376cc1['stack']);if(_0x376cc1['name']){delete _0x376cc1[_0xb8fa('0x29')];}_0x393d3a[_0xb8fa('0x1b')](_0x50771d)[_0xb8fa('0x2a')](_0x376cc1);};}exports['index']=function(_0x510f6f,_0x349066){var _0x17669a={},_0x175221={},_0x56d947={'count':0x0,'rows':[]};var _0x26332c=_[_0xb8fa('0x2b')](db['ServicenowAccount'][_0xb8fa('0x2c')],function(_0x4000dc){return{'name':_0x4000dc['fieldName'],'type':_0x4000dc['type']['key']};});_0x175221['model']=_[_0xb8fa('0x2b')](_0x26332c,_0xb8fa('0x29'));_0x175221[_0xb8fa('0x2d')]=_[_0xb8fa('0x2e')](_0x510f6f[_0xb8fa('0x2d')]);_0x175221[_0xb8fa('0x2f')]=_['intersection'](_0x175221[_0xb8fa('0x30')],_0x175221['query']);_0x17669a[_0xb8fa('0x31')]=_[_0xb8fa('0x32')](_0x175221[_0xb8fa('0x30')],qs[_0xb8fa('0x33')](_0x510f6f[_0xb8fa('0x2d')]['fields']));_0x17669a[_0xb8fa('0x31')]=_0x17669a[_0xb8fa('0x31')]['length']?_0x17669a[_0xb8fa('0x31')]:_0x175221[_0xb8fa('0x30')];if(!_0x510f6f[_0xb8fa('0x2d')]['hasOwnProperty']('nolimit')){_0x17669a[_0xb8fa('0x1e')]=qs[_0xb8fa('0x1e')](_0x510f6f['query']['limit']);_0x17669a[_0xb8fa('0x1f')]=qs['offset'](_0x510f6f[_0xb8fa('0x2d')][_0xb8fa('0x1f')]);}_0x17669a[_0xb8fa('0x34')]=qs[_0xb8fa('0x35')](_0x510f6f[_0xb8fa('0x2d')][_0xb8fa('0x35')]);_0x17669a[_0xb8fa('0x36')]=qs[_0xb8fa('0x2f')](_['pick'](_0x510f6f['query'],_0x175221[_0xb8fa('0x2f')]),_0x26332c);if(_0x510f6f['query']['filter']){_0x17669a[_0xb8fa('0x36')]=_['merge'](_0x17669a[_0xb8fa('0x36')],{'$or':_[_0xb8fa('0x2b')](_0x26332c,function(_0x3e17f5){if(_0x3e17f5[_0xb8fa('0x37')]!==_0xb8fa('0x38')){var _0x543811={};_0x543811[_0x3e17f5[_0xb8fa('0x29')]]={'$like':'%'+_0x510f6f[_0xb8fa('0x2d')]['filter']+'%'};return _0x543811;}})});}_0x17669a=_[_0xb8fa('0x39')]({},_0x17669a,_0x510f6f[_0xb8fa('0x3a')]);var _0x1c93f8={'where':_0x17669a[_0xb8fa('0x36')]};return db[_0xb8fa('0x3b')][_0xb8fa('0x20')](_0x1c93f8)[_0xb8fa('0x25')](function(_0x1e67d8){_0x56d947[_0xb8fa('0x20')]=_0x1e67d8;if(_0x510f6f[_0xb8fa('0x2d')]['includeAll']){_0x17669a[_0xb8fa('0x3c')]=[{'all':!![]}];}return db['ServicenowAccount'][_0xb8fa('0x3d')](_0x17669a);})[_0xb8fa('0x25')](function(_0x1f380e){_0x56d947['rows']=_0x1f380e;return _0x56d947;})['then'](respondWithFilteredResult(_0x349066,_0x17669a))[_0xb8fa('0x3e')](handleError(_0x349066,null));};exports[_0xb8fa('0x3f')]=function(_0x44f1d7,_0x278130){var _0x187fab={'raw':![],'where':{'id':_0x44f1d7[_0xb8fa('0x40')]['id']}},_0xfc2ff4={};_0xfc2ff4[_0xb8fa('0x30')]=_['keys'](db[_0xb8fa('0x3b')][_0xb8fa('0x2c')]);_0xfc2ff4[_0xb8fa('0x2d')]=_[_0xb8fa('0x2e')](_0x44f1d7['query']);_0xfc2ff4[_0xb8fa('0x2f')]=_[_0xb8fa('0x32')](_0xfc2ff4['model'],_0xfc2ff4['query']);_0x187fab[_0xb8fa('0x31')]=_[_0xb8fa('0x32')](_0xfc2ff4[_0xb8fa('0x30')],qs[_0xb8fa('0x33')](_0x44f1d7[_0xb8fa('0x2d')][_0xb8fa('0x33')]));_0x187fab[_0xb8fa('0x31')]=_0x187fab[_0xb8fa('0x31')][_0xb8fa('0x41')]?_0x187fab['attributes']:_0xfc2ff4[_0xb8fa('0x30')];if(_0x44f1d7['query'][_0xb8fa('0x42')]){_0x187fab[_0xb8fa('0x3c')]=[{'all':!![]}];}_0x187fab=_[_0xb8fa('0x39')]({},_0x187fab,_0x44f1d7[_0xb8fa('0x3a')]);return db['ServicenowAccount']['find'](_0x187fab)[_0xb8fa('0x25')](handleEntityNotFound(_0x278130,null))[_0xb8fa('0x25')](respondWithResult(_0x278130,null))['catch'](handleError(_0x278130,null));};exports[_0xb8fa('0x43')]=function(_0x5a473b,_0x4205cc){return db[_0xb8fa('0x3b')][_0xb8fa('0x43')](_0x5a473b[_0xb8fa('0x44')],{})[_0xb8fa('0x25')](respondWithResult(_0x4205cc,0xc9))[_0xb8fa('0x3e')](handleError(_0x4205cc,null));};exports[_0xb8fa('0x24')]=function(_0x3c224f,_0x2ce541){if(_0x3c224f[_0xb8fa('0x44')]['id']){delete _0x3c224f['body']['id'];}return db[_0xb8fa('0x3b')][_0xb8fa('0x45')]({'where':{'id':_0x3c224f[_0xb8fa('0x40')]['id']}})['then'](handleEntityNotFound(_0x2ce541,null))[_0xb8fa('0x25')](saveUpdates(_0x3c224f[_0xb8fa('0x44')],null))[_0xb8fa('0x25')](respondWithResult(_0x2ce541,null))['catch'](handleError(_0x2ce541,null));};exports[_0xb8fa('0x26')]=function(_0x54dc28,_0x673f06){return db[_0xb8fa('0x3b')][_0xb8fa('0x45')]({'where':{'id':_0x54dc28[_0xb8fa('0x40')]['id']}})[_0xb8fa('0x25')](handleEntityNotFound(_0x673f06,null))[_0xb8fa('0x25')](removeEntity(_0x673f06,null))['catch'](handleError(_0x673f06,null));};exports[_0xb8fa('0x46')]=function(_0x1699ea,_0x1fa044,_0x10c259){var _0x2ce3b6={};var _0x3d96d1={};var _0x514ca9;var _0x145782;return db[_0xb8fa('0x3b')]['findOne']({'where':{'id':_0x1699ea['params']['id']}})[_0xb8fa('0x25')](handleEntityNotFound(_0x1fa044,null))['then'](function(_0x5cb3a8){if(_0x5cb3a8){_0x514ca9=_0x5cb3a8;_0x3d96d1[_0xb8fa('0x30')]=_['keys'](db['ServicenowConfiguration'][_0xb8fa('0x2c')]);_0x3d96d1[_0xb8fa('0x2d')]=_['keys'](_0x1699ea[_0xb8fa('0x2d')]);_0x3d96d1[_0xb8fa('0x2f')]=_[_0xb8fa('0x32')](_0x3d96d1[_0xb8fa('0x30')],_0x3d96d1[_0xb8fa('0x2d')]);_0x2ce3b6[_0xb8fa('0x31')]=_[_0xb8fa('0x32')](_0x3d96d1[_0xb8fa('0x30')],qs['fields'](_0x1699ea['query'][_0xb8fa('0x33')]));_0x2ce3b6[_0xb8fa('0x31')]=_0x2ce3b6['attributes'][_0xb8fa('0x41')]?_0x2ce3b6['attributes']:_0x3d96d1[_0xb8fa('0x30')];_0x2ce3b6[_0xb8fa('0x34')]=qs[_0xb8fa('0x35')](_0x1699ea[_0xb8fa('0x2d')]['sort']);_0x2ce3b6[_0xb8fa('0x36')]=qs['filters'](_[_0xb8fa('0x47')](_0x1699ea['query'],_0x3d96d1[_0xb8fa('0x2f')]));if(_0x1699ea[_0xb8fa('0x2d')]['filter']){_0x2ce3b6[_0xb8fa('0x36')]=_[_0xb8fa('0x39')](_0x2ce3b6[_0xb8fa('0x36')],{'$or':_['map'](_0x2ce3b6[_0xb8fa('0x31')],function(_0x5ad7fa){var _0x1bcda9={};_0x1bcda9[_0x5ad7fa]={'$like':'%'+_0x1699ea[_0xb8fa('0x2d')][_0xb8fa('0x48')]+'%'};return _0x1bcda9;})});}_0x2ce3b6=_['merge']({},_0x2ce3b6,_0x1699ea[_0xb8fa('0x3a')]);return _0x514ca9['getConfigurations'](_0x2ce3b6);}})[_0xb8fa('0x25')](function(_0x57c336){if(_0x57c336){_0x145782=_0x57c336[_0xb8fa('0x41')];if(!_0x1699ea[_0xb8fa('0x2d')][_0xb8fa('0x49')](_0xb8fa('0x4a'))){_0x2ce3b6[_0xb8fa('0x1e')]=qs['limit'](_0x1699ea['query']['limit']);_0x2ce3b6[_0xb8fa('0x1f')]=qs[_0xb8fa('0x1f')](_0x1699ea[_0xb8fa('0x2d')]['offset']);}return _0x514ca9[_0xb8fa('0x46')](_0x2ce3b6);}})[_0xb8fa('0x25')](function(_0x568643){if(_0x568643){return _0x568643?{'count':_0x145782,'rows':_0x568643}:null;}})[_0xb8fa('0x25')](respondWithResult(_0x1fa044,null))['catch'](handleError(_0x1fa044,null));};exports[_0xb8fa('0x4b')]=function(_0x344863,_0x3a0c74,_0x32e777){if(_0x344863['body']['id']){delete _0x344863[_0xb8fa('0x44')]['id'];}return db[_0xb8fa('0x3b')][_0xb8fa('0x4c')]({'where':{'id':_0x344863[_0xb8fa('0x40')]['id']}})[_0xb8fa('0x25')](handleEntityNotFound(_0x3a0c74,null))[_0xb8fa('0x25')](function(_0x23de8b){if(_0x23de8b){_0x344863['body'][_0xb8fa('0x4d')]=_0x23de8b['id'];_0x344863['body'][_0xb8fa('0x4e')]=integrations[_0xb8fa('0x4f')](_0x344863['body'][_0xb8fa('0x50')],_0x344863[_0xb8fa('0x44')][_0xb8fa('0x37')]);_0x344863[_0xb8fa('0x44')][_0xb8fa('0x51')]=integrations[_0xb8fa('0x52')](_0x344863['body']['channel'],_0x344863[_0xb8fa('0x44')]['type']);return db[_0xb8fa('0x53')][_0xb8fa('0x43')](_0x344863[_0xb8fa('0x44')],{'include':[{'model':db[_0xb8fa('0x54')],'as':'Subjects'},{'model':db[_0xb8fa('0x54')],'as':_0xb8fa('0x51')}]});}return null;})['then'](respondWithResult(_0x3a0c74,null))[_0xb8fa('0x3e')](handleError(_0x3a0c74,null));};exports[_0xb8fa('0x55')]=function(_0x107ce9,_0x338954,_0x4e158f){var _0x1c5452=['made_sla',_0xb8fa('0x56'),_0xb8fa('0x57'),_0xb8fa('0x58'),_0xb8fa('0x59'),'notify','incident_state','severity',_0xb8fa('0x5a')];var _0x1926bc=[_0xb8fa('0x5b'),_0xb8fa('0x5c'),_0xb8fa('0x5d'),_0xb8fa('0x5e'),_0xb8fa('0x5f'),_0xb8fa('0x60'),'child_incidents','hold_reason',_0xb8fa('0x61'),_0xb8fa('0x62'),_0xb8fa('0x63'),'sys_updated_by',_0xb8fa('0x64'),_0xb8fa('0x65'),_0xb8fa('0x66'),_0xb8fa('0x67'),_0xb8fa('0x68'),_0xb8fa('0x69'),_0xb8fa('0x57'),'order',_0xb8fa('0x6a'),_0xb8fa('0x6b'),_0xb8fa('0x6c'),'delivery_plan',_0xb8fa('0x6d'),'active','work_notes_list',_0xb8fa('0x6e'),_0xb8fa('0x6f'),'sys_domain_path',_0xb8fa('0x70'),_0xb8fa('0x71'),'expected_start',_0xb8fa('0x72'),_0xb8fa('0x73'),_0xb8fa('0x74'),_0xb8fa('0x75'),_0xb8fa('0x76'),_0xb8fa('0x77'),'caller_id','approval_set','subcategory','work_notes',_0xb8fa('0x78'),'close_code','correlation_display',_0xb8fa('0x79'),_0xb8fa('0x7a'),_0xb8fa('0x7b'),_0xb8fa('0x7c'),_0xb8fa('0x7d'),_0xb8fa('0x7e'),_0xb8fa('0x7f'),_0xb8fa('0x80'),'sys_class_name','close_notes','closed_by','follow_up',_0xb8fa('0x81'),'sys_id',_0xb8fa('0x82'),_0xb8fa('0x83'),'incident_state',_0xb8fa('0x84'),'problem_id',_0xb8fa('0x85'),_0xb8fa('0x86'),'activity_due',_0xb8fa('0x87'),_0xb8fa('0x88'),_0xb8fa('0x89'),_0xb8fa('0x8a'),_0xb8fa('0x8b'),'comments_and_work_notes',_0xb8fa('0x8c'),'sys_mod_count','reopen_count',_0xb8fa('0x8d'),'escalation',_0xb8fa('0x8e'),'correlation_id',_0xb8fa('0x8f'),_0xb8fa('0x5a')];var _0x3c539d='';var _0x20464a='';var _0x90d55a=[];var _0x48f081='';var _0xc047b5='';var _0x6317fc=[];var _0x1f159e='';var _0x12e5dd='';var _0x4dc328={};var _0x1967bf='';return db[_0xb8fa('0x3b')]['findOne']({'where':{'id':_0x107ce9[_0xb8fa('0x40')]['id']},'attributes':['id',_0xb8fa('0x90'),_0xb8fa('0x91'),_0xb8fa('0x92'),'remoteUri',_0xb8fa('0x93')]})[_0xb8fa('0x25')](handleEntityNotFound(_0x338954,null))[_0xb8fa('0x25')](function(_0x4ec60e){if(_0x4ec60e){_0x1967bf=_0x4ec60e[_0xb8fa('0x94')];var _0x3dc134=_0x1967bf[_0xb8fa('0x95')](-0x1);if(_0x3dc134==='/'){_0x1967bf=_0x1967bf[_0xb8fa('0x96')](0x0,_0x1967bf[_0xb8fa('0x97')](_0x3dc134));}_0x12e5dd=util[_0xb8fa('0x98')](_0xb8fa('0x99'),_0x1967bf);_0x1f159e=util[_0xb8fa('0x98')]('%s/api/now/table/',_0x1967bf);_0x4dc328={'user':_0x4ec60e[_0xb8fa('0x90')],'pass':_0x4ec60e[_0xb8fa('0x91')]};var _0xea24c1={'method':_0xb8fa('0x9a'),'uri':_0x12e5dd+_0xb8fa('0x9b'),'auth':_0x4dc328,'json':!![]};return rp(_0xea24c1);}})[_0xb8fa('0x25')](function(_0x989267){if(_0x989267[_0xb8fa('0x9c')][_0xb8fa('0x41')]>0x0){_0x3c539d=_0x989267[_0xb8fa('0x9c')];}console['log'](_0xb8fa('0x9d'),_0x3c539d);_0x6317fc=[];_0x20464a=Object['assign']([],_0x3c539d);_[_0xb8fa('0x9e')](_0x20464a,function(_0xe2babf){return!_0x1c5452[_0xb8fa('0x9f')](_0xe2babf['name']);});_0x20464a[_0xb8fa('0xa0')](function(_0x5c6bf2){var _0x29d35e=createFieldObject(_0x1f159e,_0x4dc328,_0x5c6bf2[_0xb8fa('0xa1')],_0x5c6bf2[_0xb8fa('0x29')],_0x5c6bf2[_0xb8fa('0xa2')],![]);_0x6317fc[_0xb8fa('0xa3')](_0x29d35e);});return Promise[_0xb8fa('0xa4')](_0x6317fc);})[_0xb8fa('0x25')](function(_0x1fb348){_0x90d55a=_0x1fb348;_0x48f081=Object[_0xb8fa('0xa5')]([],_0x3c539d);console['log'](_0xb8fa('0xa6'),_0x3c539d);_[_0xb8fa('0x9e')](_0x48f081,function(_0x153c31){return _0x1926bc[_0xb8fa('0x9f')](_0x153c31['name']);});console[_0xb8fa('0xa7')]('TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom',_0x48f081);_0x6317fc=[];_0x48f081['forEach'](function(_0x53c3de){var _0x117b25=createFieldObject(_0x1f159e,_0x4dc328,_0x53c3de[_0xb8fa('0xa1')],_0x53c3de[_0xb8fa('0x29')],_0x53c3de['label'],!![]);_0x6317fc[_0xb8fa('0xa3')](_0x117b25);});return Promise[_0xb8fa('0xa4')](_0x6317fc);})['then'](function(_0x280e72){_0xc047b5=_0x280e72;var _0x2c4757=_0x90d55a[_0xb8fa('0xa8')](_0xc047b5);return{'count':_0x2c4757[_0xb8fa('0x41')],'rows':_0x2c4757};})['then'](respondWithResult(_0x338954,null))['catch'](function(_0x3dc579){console['log'](_0xb8fa('0xa9')+_0x3dc579);var _0x32f29e=_0x107ce9[_0xb8fa('0x2d')]['test']?0x1f4:_0x3dc579[_0xb8fa('0xaa')]||0x1f4;logger[_0xb8fa('0x28')](_0x3dc579['stack']);delete _0x3dc579['name'];if(_0x32f29e===0x191){_0x32f29e=0x190;}_0x338954[_0xb8fa('0x1b')](_0x32f29e)[_0xb8fa('0x2a')](_0x107ce9['query'][_0xb8fa('0xab')]?{'message':_0xb8fa('0xac'),'statusCode':_0x3dc579[_0xb8fa('0xaa')]}:_0x3dc579);});};function createFieldObject(_0x346ac5,_0x1789b0,_0x3fba4e,_0x350d0d,_0x34e031,_0x2d4e9d){return new Promise(function(_0x58df4b,_0x18a879){var _0x28ee13={'id':_0x350d0d,'name':_0x34e031,'custom':_0x2d4e9d};if(_0x3fba4e==='boolean'){_0x28ee13[_0xb8fa('0x3a')]=[{'name':_0xb8fa('0xad'),'value':_0xb8fa('0xae')},{'name':'False','value':'false'}];_0x58df4b(_0x28ee13);}else{var _0x33707b={'method':_0xb8fa('0x9a'),'uri':_0x346ac5+_0xb8fa('0xaf')+_0x350d0d,'auth':_0x1789b0,'json':!![]};return rp(_0x33707b)[_0xb8fa('0x25')](function(_0x21261c){var _0x56fa57=[];if(_0x21261c[_0xb8fa('0x9c')][_0xb8fa('0x41')]>0x0){_0x21261c[_0xb8fa('0x9c')][_0xb8fa('0xa0')](function(_0x3ffabb){if(_0x3ffabb[_0xb8fa('0xb0')]===_0xb8fa('0xb1')){var _0x2dad18={'name':_0x3ffabb[_0xb8fa('0xa2')],'value':_0x3ffabb['value']};_0x56fa57[_0xb8fa('0xa3')](_0x2dad18);}});}_0x28ee13[_0xb8fa('0x3a')]=_0x56fa57;if(_0x28ee13['options'][_0xb8fa('0x41')]>0x0){_0x58df4b(_0x28ee13);}else{if(_0x2d4e9d==![]){_0x58df4b();}else{_0x58df4b(_0x28ee13);}}});}});} \ No newline at end of file +var _0x5386=['getDescriptions','ServicenowField','Subjects','getFields','made_sla','hold_reason','knowledge','subcategory','close_code','notify','incident_state','category','parent','caused_by','sys_updated_on','child_incidents','approval_history','resolved_by','sys_created_on','sys_domain','state','sys_created_by','closed_at','cmdb_ci','delivery_plan','impact','active','work_notes_list','business_service','sys_domain_path','time_worked','expected_start','opened_at','business_duration','reopened_time','approval_set','work_notes','delivery_task','work_start','business_stc','additional_assignee_list','calendar_duration','sys_class_name','close_notes','closed_by','follow_up','contact_type','reopened_by','urgency','problem_id','company','reassignment_count','assigned_to','severity','comments','sla_due','approval','comments_and_work_notes','due_date','sys_mod_count','reopen_count','escalation','upon_approval','correlation_id','location','username','email','remoteUri','serverUrl','substring','lastIndexOf','%s/api/now/doc/table/schema/','format','GET','incident?sysparm_display_value=all','result','log','incident\x20table\x20objects','assign','remove','includes','forEach','internalType','push','TCL:\x20_object','concat','ServiceNow\x20error:\x20','test','statusCode','error','send','Wrong\x20credentials','boolean','True','true','False','sys_choice?sysparm_query=name=incident^element=','inactive','label','value','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','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','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','stack','map','ServicenowAccount','rawAttributes','type','key','name','query','keys','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','rows','catch','show','params','find','create','body','destroy','findOne','ServicenowConfiguration','getConfigurations','addConfiguration','AccountId','getSubjects','channel','Descriptions'];(function(_0x35decc,_0x4b1cf6){var _0x5761ea=function(_0x30fc02){while(--_0x30fc02){_0x35decc['push'](_0x35decc['shift']());}};_0x5761ea(++_0x4b1cf6);}(_0x5386,0x11d));var _0x6538=function(_0x3afaae,_0x1ee943){_0x3afaae=_0x3afaae-0x0;var _0x21c7cc=_0x5386[_0x3afaae];return _0x21c7cc;};'use strict';var emlformat=require(_0x6538('0x0'));var rimraf=require(_0x6538('0x1'));var zipdir=require(_0x6538('0x2'));var jsonpatch=require(_0x6538('0x3'));var rp=require(_0x6538('0x4'));var moment=require(_0x6538('0x5'));var BPromise=require(_0x6538('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0x6538('0x7'));var sox=require(_0x6538('0x8'));var csv=require(_0x6538('0x9'));var ejs=require(_0x6538('0xa'));var fs=require('fs');var fs_extra=require(_0x6538('0xb'));var _=require(_0x6538('0xc'));var squel=require(_0x6538('0xd'));var crypto=require(_0x6538('0xe'));var jsforce=require(_0x6538('0xf'));var deskjs=require(_0x6538('0x10'));var toCsv=require(_0x6538('0x9'));var querystring=require('querystring');var Papa=require(_0x6538('0x11'));var Redis=require(_0x6538('0x12'));var authService=require(_0x6538('0x13'));var qs=require(_0x6538('0x14'));var as=require(_0x6538('0x15'));var hardwareService=require(_0x6538('0x16'));var logger=require(_0x6538('0x17'))('api');var utils=require(_0x6538('0x18'));var config=require(_0x6538('0x19'));var licenseUtil=require(_0x6538('0x1a'));var db=require('../../mysqldb')['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x5bce5c,_0x3e5ae7){_0x3e5ae7=_0x3e5ae7||0xcc;return function(_0x2d7d13){if(_0x2d7d13){return _0x5bce5c[_0x6538('0x1b')](_0x3e5ae7);}return _0x5bce5c[_0x6538('0x1c')](_0x3e5ae7)[_0x6538('0x1d')]();};}function respondWithResult(_0x2c42fb,_0x8d7cb0){_0x8d7cb0=_0x8d7cb0||0xc8;return function(_0x1af193){if(_0x1af193){return _0x2c42fb[_0x6538('0x1c')](_0x8d7cb0)[_0x6538('0x1e')](_0x1af193);}};}function respondWithFilteredResult(_0x53239f,_0x2b2fa2){return function(_0x515246){if(_0x515246){var _0x46c2b4=typeof _0x2b2fa2['offset']===_0x6538('0x1f')&&typeof _0x2b2fa2[_0x6538('0x20')]===_0x6538('0x1f');var _0x52aa1e=_0x515246[_0x6538('0x21')];var _0x44aad7=_0x46c2b4?0x0:_0x2b2fa2['offset'];var _0xdf99a3=_0x46c2b4?_0x515246[_0x6538('0x21')]:_0x2b2fa2[_0x6538('0x22')]+_0x2b2fa2[_0x6538('0x20')];var _0x427937;if(_0xdf99a3>=_0x52aa1e){_0xdf99a3=_0x52aa1e;_0x427937=0xc8;}else{_0x427937=0xce;}_0x53239f[_0x6538('0x1c')](_0x427937);return _0x53239f[_0x6538('0x23')](_0x6538('0x24'),_0x44aad7+'-'+_0xdf99a3+'/'+_0x52aa1e)['json'](_0x515246);}return null;};}function patchUpdates(_0x31dc44){return function(_0x5e95af){try{jsonpatch[_0x6538('0x25')](_0x5e95af,_0x31dc44,!![]);}catch(_0x55b481){return BPromise[_0x6538('0x26')](_0x55b481);}return _0x5e95af[_0x6538('0x27')]();};}function saveUpdates(_0x592eb3,_0x56abee){return function(_0x2de4fe){if(_0x2de4fe){return _0x2de4fe[_0x6538('0x28')](_0x592eb3)[_0x6538('0x29')](function(_0x1766e6){return _0x1766e6;});}return null;};}function removeEntity(_0x2d4c9b,_0x48e38a){return function(_0x4a3007){if(_0x4a3007){return _0x4a3007['destroy']()['then'](function(){_0x2d4c9b[_0x6538('0x1c')](0xcc)[_0x6538('0x1d')]();});}};}function handleEntityNotFound(_0x280fe0,_0x982de){return function(_0x4f94a3){if(!_0x4f94a3){_0x280fe0[_0x6538('0x1b')](0x194);}return _0x4f94a3;};}function handleError(_0xc77908,_0x1c8f63){_0x1c8f63=_0x1c8f63||0x1f4;return function(_0x50c90b){logger['error'](_0x50c90b[_0x6538('0x2a')]);if(_0x50c90b['name']){delete _0x50c90b['name'];}_0xc77908[_0x6538('0x1c')](_0x1c8f63)['send'](_0x50c90b);};}exports['index']=function(_0x3f0a82,_0x6d0209){var _0x2321ad={},_0x19f69f={},_0x1614ea={'count':0x0,'rows':[]};var _0x671932=_[_0x6538('0x2b')](db[_0x6538('0x2c')][_0x6538('0x2d')],function(_0x292306){return{'name':_0x292306['fieldName'],'type':_0x292306[_0x6538('0x2e')][_0x6538('0x2f')]};});_0x19f69f['model']=_[_0x6538('0x2b')](_0x671932,_0x6538('0x30'));_0x19f69f[_0x6538('0x31')]=_[_0x6538('0x32')](_0x3f0a82[_0x6538('0x31')]);_0x19f69f[_0x6538('0x33')]=_[_0x6538('0x34')](_0x19f69f['model'],_0x19f69f[_0x6538('0x31')]);_0x2321ad[_0x6538('0x35')]=_[_0x6538('0x34')](_0x19f69f[_0x6538('0x36')],qs[_0x6538('0x37')](_0x3f0a82[_0x6538('0x31')][_0x6538('0x37')]));_0x2321ad[_0x6538('0x35')]=_0x2321ad[_0x6538('0x35')][_0x6538('0x38')]?_0x2321ad[_0x6538('0x35')]:_0x19f69f[_0x6538('0x36')];if(!_0x3f0a82['query'][_0x6538('0x39')](_0x6538('0x3a'))){_0x2321ad[_0x6538('0x20')]=qs['limit'](_0x3f0a82[_0x6538('0x31')][_0x6538('0x20')]);_0x2321ad['offset']=qs[_0x6538('0x22')](_0x3f0a82['query']['offset']);}_0x2321ad[_0x6538('0x3b')]=qs[_0x6538('0x3c')](_0x3f0a82[_0x6538('0x31')][_0x6538('0x3c')]);_0x2321ad[_0x6538('0x3d')]=qs[_0x6538('0x33')](_[_0x6538('0x3e')](_0x3f0a82[_0x6538('0x31')],_0x19f69f['filters']),_0x671932);if(_0x3f0a82[_0x6538('0x31')]['filter']){_0x2321ad[_0x6538('0x3d')]=_[_0x6538('0x3f')](_0x2321ad[_0x6538('0x3d')],{'$or':_['map'](_0x671932,function(_0x491297){if(_0x491297[_0x6538('0x2e')]!==_0x6538('0x40')){var _0x201f58={};_0x201f58[_0x491297[_0x6538('0x30')]]={'$like':'%'+_0x3f0a82[_0x6538('0x31')][_0x6538('0x41')]+'%'};return _0x201f58;}})});}_0x2321ad=_['merge']({},_0x2321ad,_0x3f0a82[_0x6538('0x42')]);var _0x582c36={'where':_0x2321ad[_0x6538('0x3d')]};return db[_0x6538('0x2c')][_0x6538('0x21')](_0x582c36)['then'](function(_0x26d1db){_0x1614ea[_0x6538('0x21')]=_0x26d1db;if(_0x3f0a82[_0x6538('0x31')][_0x6538('0x43')]){_0x2321ad[_0x6538('0x44')]=[{'all':!![]}];}return db[_0x6538('0x2c')]['findAll'](_0x2321ad);})[_0x6538('0x29')](function(_0xec182a){_0x1614ea[_0x6538('0x45')]=_0xec182a;return _0x1614ea;})['then'](respondWithFilteredResult(_0x6d0209,_0x2321ad))[_0x6538('0x46')](handleError(_0x6d0209,null));};exports[_0x6538('0x47')]=function(_0x13b771,_0x1d1a2d){var _0x3ff26b={'raw':![],'where':{'id':_0x13b771[_0x6538('0x48')]['id']}},_0x2e81ef={};_0x2e81ef[_0x6538('0x36')]=_[_0x6538('0x32')](db[_0x6538('0x2c')]['rawAttributes']);_0x2e81ef[_0x6538('0x31')]=_['keys'](_0x13b771[_0x6538('0x31')]);_0x2e81ef[_0x6538('0x33')]=_[_0x6538('0x34')](_0x2e81ef[_0x6538('0x36')],_0x2e81ef[_0x6538('0x31')]);_0x3ff26b[_0x6538('0x35')]=_[_0x6538('0x34')](_0x2e81ef['model'],qs[_0x6538('0x37')](_0x13b771[_0x6538('0x31')]['fields']));_0x3ff26b[_0x6538('0x35')]=_0x3ff26b['attributes']['length']?_0x3ff26b[_0x6538('0x35')]:_0x2e81ef['model'];if(_0x13b771[_0x6538('0x31')][_0x6538('0x43')]){_0x3ff26b[_0x6538('0x44')]=[{'all':!![]}];}_0x3ff26b=_[_0x6538('0x3f')]({},_0x3ff26b,_0x13b771[_0x6538('0x42')]);return db[_0x6538('0x2c')][_0x6538('0x49')](_0x3ff26b)[_0x6538('0x29')](handleEntityNotFound(_0x1d1a2d,null))[_0x6538('0x29')](respondWithResult(_0x1d1a2d,null))[_0x6538('0x46')](handleError(_0x1d1a2d,null));};exports[_0x6538('0x4a')]=function(_0x2ac089,_0x300ef5){return db[_0x6538('0x2c')][_0x6538('0x4a')](_0x2ac089[_0x6538('0x4b')],{})[_0x6538('0x29')](respondWithResult(_0x300ef5,0xc9))['catch'](handleError(_0x300ef5,null));};exports[_0x6538('0x28')]=function(_0x16c7c4,_0x4100b8){if(_0x16c7c4[_0x6538('0x4b')]['id']){delete _0x16c7c4[_0x6538('0x4b')]['id'];}return db[_0x6538('0x2c')][_0x6538('0x49')]({'where':{'id':_0x16c7c4[_0x6538('0x48')]['id']}})[_0x6538('0x29')](handleEntityNotFound(_0x4100b8,null))['then'](saveUpdates(_0x16c7c4[_0x6538('0x4b')],null))['then'](respondWithResult(_0x4100b8,null))[_0x6538('0x46')](handleError(_0x4100b8,null));};exports[_0x6538('0x4c')]=function(_0x4ef83a,_0xa4283){return db[_0x6538('0x2c')][_0x6538('0x49')]({'where':{'id':_0x4ef83a['params']['id']}})[_0x6538('0x29')](handleEntityNotFound(_0xa4283,null))[_0x6538('0x29')](removeEntity(_0xa4283,null))[_0x6538('0x46')](handleError(_0xa4283,null));};exports['getConfigurations']=function(_0x277430,_0x2e2661,_0x525d71){var _0x2f46f9={};var _0x4593da={};var _0xbb60c8;var _0x3da3e9;return db[_0x6538('0x2c')][_0x6538('0x4d')]({'where':{'id':_0x277430[_0x6538('0x48')]['id']}})[_0x6538('0x29')](handleEntityNotFound(_0x2e2661,null))[_0x6538('0x29')](function(_0x4496f8){if(_0x4496f8){_0xbb60c8=_0x4496f8;_0x4593da[_0x6538('0x36')]=_[_0x6538('0x32')](db[_0x6538('0x4e')][_0x6538('0x2d')]);_0x4593da[_0x6538('0x31')]=_[_0x6538('0x32')](_0x277430[_0x6538('0x31')]);_0x4593da[_0x6538('0x33')]=_[_0x6538('0x34')](_0x4593da['model'],_0x4593da['query']);_0x2f46f9[_0x6538('0x35')]=_['intersection'](_0x4593da[_0x6538('0x36')],qs[_0x6538('0x37')](_0x277430[_0x6538('0x31')]['fields']));_0x2f46f9['attributes']=_0x2f46f9[_0x6538('0x35')]['length']?_0x2f46f9[_0x6538('0x35')]:_0x4593da[_0x6538('0x36')];_0x2f46f9[_0x6538('0x3b')]=qs[_0x6538('0x3c')](_0x277430['query'][_0x6538('0x3c')]);_0x2f46f9[_0x6538('0x3d')]=qs[_0x6538('0x33')](_[_0x6538('0x3e')](_0x277430[_0x6538('0x31')],_0x4593da['filters']));if(_0x277430[_0x6538('0x31')][_0x6538('0x41')]){_0x2f46f9['where']=_[_0x6538('0x3f')](_0x2f46f9[_0x6538('0x3d')],{'$or':_[_0x6538('0x2b')](_0x2f46f9[_0x6538('0x35')],function(_0x36e8ff){var _0x23169c={};_0x23169c[_0x36e8ff]={'$like':'%'+_0x277430[_0x6538('0x31')][_0x6538('0x41')]+'%'};return _0x23169c;})});}_0x2f46f9=_[_0x6538('0x3f')]({},_0x2f46f9,_0x277430[_0x6538('0x42')]);return _0xbb60c8['getConfigurations'](_0x2f46f9);}})[_0x6538('0x29')](function(_0x58b355){if(_0x58b355){_0x3da3e9=_0x58b355[_0x6538('0x38')];if(!_0x277430['query'][_0x6538('0x39')](_0x6538('0x3a'))){_0x2f46f9['limit']=qs[_0x6538('0x20')](_0x277430[_0x6538('0x31')]['limit']);_0x2f46f9[_0x6538('0x22')]=qs[_0x6538('0x22')](_0x277430[_0x6538('0x31')][_0x6538('0x22')]);}return _0xbb60c8[_0x6538('0x4f')](_0x2f46f9);}})['then'](function(_0x1d1d87){if(_0x1d1d87){return _0x1d1d87?{'count':_0x3da3e9,'rows':_0x1d1d87}:null;}})[_0x6538('0x29')](respondWithResult(_0x2e2661,null))[_0x6538('0x46')](handleError(_0x2e2661,null));};exports[_0x6538('0x50')]=function(_0x4dbc08,_0x354a4f,_0x29cfdc){if(_0x4dbc08[_0x6538('0x4b')]['id']){delete _0x4dbc08[_0x6538('0x4b')]['id'];}return db['ServicenowAccount'][_0x6538('0x4d')]({'where':{'id':_0x4dbc08[_0x6538('0x48')]['id']}})[_0x6538('0x29')](handleEntityNotFound(_0x354a4f,null))['then'](function(_0x29d139){if(_0x29d139){_0x4dbc08[_0x6538('0x4b')][_0x6538('0x51')]=_0x29d139['id'];_0x4dbc08['body']['Subjects']=integrations[_0x6538('0x52')](_0x4dbc08[_0x6538('0x4b')][_0x6538('0x53')],_0x4dbc08[_0x6538('0x4b')]['type']);_0x4dbc08[_0x6538('0x4b')][_0x6538('0x54')]=integrations[_0x6538('0x55')](_0x4dbc08[_0x6538('0x4b')][_0x6538('0x53')],_0x4dbc08[_0x6538('0x4b')][_0x6538('0x2e')]);return db[_0x6538('0x4e')][_0x6538('0x4a')](_0x4dbc08[_0x6538('0x4b')],{'include':[{'model':db[_0x6538('0x56')],'as':_0x6538('0x57')},{'model':db[_0x6538('0x56')],'as':_0x6538('0x54')}]});}return null;})[_0x6538('0x29')](respondWithResult(_0x354a4f,null))['catch'](handleError(_0x354a4f,null));};exports[_0x6538('0x58')]=function(_0x36f800,_0x504786,_0x30ec20){var _0xe5b6a=[_0x6538('0x59'),_0x6538('0x5a'),_0x6538('0x5b'),_0x6538('0x5c'),_0x6538('0x5d'),_0x6538('0x5e'),_0x6538('0x5f'),'severity',_0x6538('0x60')];var _0x4b01e7=[_0x6538('0x61'),'made_sla',_0x6538('0x62'),'watch_list','upon_reject',_0x6538('0x63'),_0x6538('0x64'),_0x6538('0x5a'),_0x6538('0x65'),'number',_0x6538('0x66'),'sys_updated_by','opened_by','user_input',_0x6538('0x67'),_0x6538('0x68'),_0x6538('0x69'),_0x6538('0x6a'),'knowledge',_0x6538('0x3b'),'calendar_stc',_0x6538('0x6b'),_0x6538('0x6c'),_0x6538('0x6d'),_0x6538('0x6e'),_0x6538('0x6f'),_0x6538('0x70'),_0x6538('0x71'),'priority',_0x6538('0x72'),'rfc',_0x6538('0x73'),_0x6538('0x74'),_0x6538('0x75'),_0x6538('0x76'),'group_list','work_end',_0x6538('0x77'),'resolved_at','caller_id',_0x6538('0x78'),_0x6538('0x5c'),_0x6538('0x79'),'short_description',_0x6538('0x5d'),'correlation_display',_0x6538('0x7a'),_0x6538('0x7b'),'assignment_group',_0x6538('0x7c'),_0x6538('0x7d'),'description',_0x6538('0x7e'),_0x6538('0x5e'),_0x6538('0x7f'),_0x6538('0x80'),_0x6538('0x81'),_0x6538('0x82'),'parent_incident','sys_id',_0x6538('0x83'),_0x6538('0x84'),_0x6538('0x5f'),_0x6538('0x85'),_0x6538('0x86'),_0x6538('0x87'),_0x6538('0x88'),'activity_due',_0x6538('0x89'),_0x6538('0x8a'),_0x6538('0x8b'),_0x6538('0x8c'),_0x6538('0x8d'),_0x6538('0x8e'),_0x6538('0x8f'),_0x6538('0x90'),_0x6538('0x91'),'sys_tags',_0x6538('0x92'),_0x6538('0x93'),_0x6538('0x94'),_0x6538('0x95'),'category'];var _0x2fff45='';var _0x239d24='';var _0xf2a6ea=[];var _0x2eb420='';var _0x5023dc='';var _0x2335e0=[];var _0x627e1='';var _0xb50fed='';var _0x27cb9c={};var _0x2da6f3='';return db[_0x6538('0x2c')]['findOne']({'where':{'id':_0x36f800[_0x6538('0x48')]['id']},'attributes':['id',_0x6538('0x96'),'password',_0x6538('0x97'),_0x6538('0x98'),_0x6538('0x99')]})['then'](handleEntityNotFound(_0x504786,null))[_0x6538('0x29')](function(_0x3716e0){if(_0x3716e0){_0x2da6f3=_0x3716e0[_0x6538('0x98')];var _0x36a69a=_0x2da6f3['slice'](-0x1);if(_0x36a69a==='/'){_0x2da6f3=_0x2da6f3[_0x6538('0x9a')](0x0,_0x2da6f3[_0x6538('0x9b')](_0x36a69a));}_0xb50fed=util['format'](_0x6538('0x9c'),_0x2da6f3);_0x627e1=util[_0x6538('0x9d')]('%s/api/now/table/',_0x2da6f3);_0x27cb9c={'user':_0x3716e0['username'],'pass':_0x3716e0['password']};var _0x354a5e={'method':_0x6538('0x9e'),'uri':_0xb50fed+_0x6538('0x9f'),'auth':_0x27cb9c,'json':!![]};return rp(_0x354a5e);}})[_0x6538('0x29')](function(_0x3dd8b8){if(_0x3dd8b8[_0x6538('0xa0')]['length']>0x0){_0x2fff45=_0x3dd8b8['result'];}console[_0x6538('0xa1')](_0x6538('0xa2'),_0x2fff45);_0x2335e0=[];_0x239d24=Object[_0x6538('0xa3')]([],_0x2fff45);_[_0x6538('0xa4')](_0x239d24,function(_0x2eee28){return!_0xe5b6a[_0x6538('0xa5')](_0x2eee28[_0x6538('0x30')]);});_0x239d24[_0x6538('0xa6')](function(_0x233ed8){var _0x1c53c1=createFieldObject(_0x627e1,_0x27cb9c,_0x233ed8[_0x6538('0xa7')],_0x233ed8[_0x6538('0x30')],_0x233ed8['label'],![]);_0x2335e0[_0x6538('0xa8')](_0x1c53c1);});return Promise['all'](_0x2335e0);})[_0x6538('0x29')](function(_0x4f6c07){_0xf2a6ea=_0x4f6c07;_0x2eb420=Object[_0x6538('0xa3')]([],_0x2fff45);console[_0x6538('0xa1')](_0x6538('0xa9'),_0x2fff45);_[_0x6538('0xa4')](_0x2eb420,function(_0x34c381){return _0x4b01e7[_0x6538('0xa5')](_0x34c381[_0x6538('0x30')]);});console['log']('TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom',_0x2eb420);_0x2335e0=[];_0x2eb420[_0x6538('0xa6')](function(_0x83d195){var _0x3e944b=createFieldObject(_0x627e1,_0x27cb9c,_0x83d195[_0x6538('0xa7')],_0x83d195[_0x6538('0x30')],_0x83d195['label'],!![]);_0x2335e0[_0x6538('0xa8')](_0x3e944b);});return Promise['all'](_0x2335e0);})[_0x6538('0x29')](function(_0x11364d){_0x5023dc=_0x11364d;var _0x43ad22=_0xf2a6ea[_0x6538('0xaa')](_0x5023dc);return{'count':_0x43ad22[_0x6538('0x38')],'rows':_0x43ad22};})['then'](respondWithResult(_0x504786,null))['catch'](function(_0x59cbd6){console['log'](_0x6538('0xab')+_0x59cbd6);var _0x2090f3=_0x36f800[_0x6538('0x31')][_0x6538('0xac')]?0x1f4:_0x59cbd6[_0x6538('0xad')]||0x1f4;logger[_0x6538('0xae')](_0x59cbd6[_0x6538('0x2a')]);delete _0x59cbd6[_0x6538('0x30')];if(_0x2090f3===0x191){_0x2090f3=0x190;}_0x504786[_0x6538('0x1c')](_0x2090f3)[_0x6538('0xaf')](_0x36f800[_0x6538('0x31')][_0x6538('0xac')]?{'message':_0x6538('0xb0'),'statusCode':_0x59cbd6[_0x6538('0xad')]}:_0x59cbd6);});};function createFieldObject(_0x1bb2dc,_0x12fdbf,_0x2b6025,_0x5a0b66,_0x69a812,_0x54afd8){return new Promise(function(_0xbf43f4,_0x4c13ee){var _0x157d7e={'id':_0x5a0b66,'name':_0x69a812,'custom':_0x54afd8};if(_0x2b6025===_0x6538('0xb1')){_0x157d7e['options']=[{'name':_0x6538('0xb2'),'value':_0x6538('0xb3')},{'name':_0x6538('0xb4'),'value':'false'}];_0xbf43f4(_0x157d7e);}else{var _0x1529f8={'method':_0x6538('0x9e'),'uri':_0x1bb2dc+_0x6538('0xb5')+_0x5a0b66,'auth':_0x12fdbf,'json':!![]};return rp(_0x1529f8)['then'](function(_0x289881){var _0x4115fa=[];if(_0x289881[_0x6538('0xa0')]['length']>0x0){_0x289881[_0x6538('0xa0')]['forEach'](function(_0x3f5e04){if(_0x3f5e04[_0x6538('0xb6')]==='false'){var _0x2b648e={'name':_0x3f5e04[_0x6538('0xb7')],'value':_0x3f5e04[_0x6538('0xb8')]};_0x4115fa[_0x6538('0xa8')](_0x2b648e);}});}_0x157d7e[_0x6538('0x42')]=_0x4115fa;if(_0x157d7e[_0x6538('0x42')][_0x6538('0x38')]>0x0){_0xbf43f4(_0x157d7e);}else{if(_0x54afd8==![]){_0xbf43f4();}else{_0xbf43f4(_0x157d7e);}}});}});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.model.js b/server/api/intServicenowAccount/intServicenowAccount.model.js index 7203a2f..d7e876b 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 _0xe3da=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./intServicenowAccount.attributes','../../components/integrations/configuration','exports','define','int_servicenow_accounts','lodash','util','../../config/logger','api'];(function(_0x3123d7,_0x20d651){var _0x5ec935=function(_0x563ee3){while(--_0x563ee3){_0x3123d7['push'](_0x3123d7['shift']());}};_0x5ec935(++_0x20d651);}(_0xe3da,0x1cd));var _0xae3d=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0xe3da[_0x19950b];return _0x3c6b41;};'use strict';var _=require(_0xae3d('0x0'));var util=require(_0xae3d('0x1'));var logger=require(_0xae3d('0x2'))(_0xae3d('0x3'));var moment=require(_0xae3d('0x4'));var BPromise=require(_0xae3d('0x5'));var rp=require(_0xae3d('0x6'));var fs=require('fs');var path=require(_0xae3d('0x7'));var rimraf=require(_0xae3d('0x8'));var config=require(_0xae3d('0x9'));var attributes=require(_0xae3d('0xa'));var integrations=require(_0xae3d('0xb'));module[_0xae3d('0xc')]=function(_0xa54808,_0x476579){return _0xa54808[_0xae3d('0xd')]('ServicenowAccount',attributes,{'tableName':_0xae3d('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xabce=['path','rimraf','../../config/environment','exports','ServicenowAccount','int_servicenow_accounts','lodash','util','../../config/logger','api','moment'];(function(_0x3fb5eb,_0x5947a6){var _0x481291=function(_0x74e4e){while(--_0x74e4e){_0x3fb5eb['push'](_0x3fb5eb['shift']());}};_0x481291(++_0x5947a6);}(_0xabce,0x103));var _0xeabc=function(_0x1eda20,_0x1149f4){_0x1eda20=_0x1eda20-0x0;var _0x31b953=_0xabce[_0x1eda20];return _0x31b953;};'use strict';var _=require(_0xeabc('0x0'));var util=require(_0xeabc('0x1'));var logger=require(_0xeabc('0x2'))(_0xeabc('0x3'));var moment=require(_0xeabc('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xeabc('0x5'));var rimraf=require(_0xeabc('0x6'));var config=require(_0xeabc('0x7'));var attributes=require('./intServicenowAccount.attributes');var integrations=require('../../components/integrations/configuration');module[_0xeabc('0x8')]=function(_0x52a4d7,_0x229ba4){return _0x52a4d7['define'](_0xeabc('0x9'),attributes,{'tableName':_0xeabc('0xa'),'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 9e2827d..cc8e15e 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 _0x5d4d=['raw','ShowServicenowAccount','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','ServicenowAccount,\x20%s,\x20%s','debug','ServicenowAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','GetServicenowAccount','options','where','attributes','limit','include','model','map','then','find'];(function(_0x20059d,_0x244ac6){var _0x5dad42=function(_0x57c112){while(--_0x57c112){_0x20059d['push'](_0x20059d['shift']());}};_0x5dad42(++_0x244ac6);}(_0x5d4d,0xa7));var _0xd5d4=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5d4d[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xd5d4('0x0'));var util=require(_0xd5d4('0x1'));var moment=require(_0xd5d4('0x2'));var BPromise=require(_0xd5d4('0x3'));var rs=require(_0xd5d4('0x4'));var fs=require('fs');var Redis=require(_0xd5d4('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xd5d4('0x6'));var logger=require(_0xd5d4('0x7'))('rpc');var config=require(_0xd5d4('0x8'));var jayson=require(_0xd5d4('0x9'));var client=jayson['client'][_0xd5d4('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x21ca80,_0x7899fe,_0x33a294){return new BPromise(function(_0x276ea3,_0x509ad9){return client['request'](_0x21ca80,_0x33a294)['then'](function(_0x3cfdc7){logger['info'](_0xd5d4('0xb'),_0x7899fe,'request\x20sent');logger[_0xd5d4('0xc')](_0xd5d4('0xd'),_0x7899fe,'request\x20sent',JSON[_0xd5d4('0xe')](_0x3cfdc7));if(_0x3cfdc7[_0xd5d4('0xf')]){if(_0x3cfdc7[_0xd5d4('0xf')][_0xd5d4('0x10')]===0x1f4){logger[_0xd5d4('0xf')](_0xd5d4('0xb'),_0x7899fe,_0x3cfdc7[_0xd5d4('0xf')][_0xd5d4('0x11')]);return _0x509ad9(_0x3cfdc7['error']['message']);}logger['error'](_0xd5d4('0xb'),_0x7899fe,_0x3cfdc7[_0xd5d4('0xf')][_0xd5d4('0x11')]);return _0x276ea3(_0x3cfdc7[_0xd5d4('0xf')]['message']);}else{logger[_0xd5d4('0x12')]('ServicenowAccount,\x20%s,\x20%s',_0x7899fe,'request\x20sent');_0x276ea3(_0x3cfdc7[_0xd5d4('0x13')][_0xd5d4('0x11')]);}})[_0xd5d4('0x14')](function(_0x3d3e87){logger[_0xd5d4('0xf')](_0xd5d4('0xb'),_0x7899fe,_0x3d3e87);_0x509ad9(_0x3d3e87);});});}exports[_0xd5d4('0x15')]=function(_0x582da6){var _0x53080c=this;return new Promise(function(_0x249362,_0x55f124){return db['ServicenowAccount']['findAll']({'raw':_0x582da6[_0xd5d4('0x16')]?_0x582da6[_0xd5d4('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x582da6['options']?_0x582da6['options'][_0xd5d4('0x17')]||null:null,'attributes':_0x582da6[_0xd5d4('0x16')]?_0x582da6[_0xd5d4('0x16')][_0xd5d4('0x18')]||null:null,'limit':_0x582da6[_0xd5d4('0x16')]?_0x582da6['options'][_0xd5d4('0x19')]||null:null,'include':_0x582da6['options']?_0x582da6[_0xd5d4('0x16')][_0xd5d4('0x1a')]?_['map'](_0x582da6[_0xd5d4('0x16')][_0xd5d4('0x1a')],function(_0x1e9830){return{'model':db[_0x1e9830[_0xd5d4('0x1b')]],'as':_0x1e9830['as'],'attributes':_0x1e9830[_0xd5d4('0x18')],'include':_0x1e9830[_0xd5d4('0x1a')]?_[_0xd5d4('0x1c')](_0x1e9830[_0xd5d4('0x1a')],function(_0x4f316a){return{'model':db[_0x4f316a['model']],'as':_0x4f316a['as'],'attributes':_0x4f316a[_0xd5d4('0x18')],'include':_0x4f316a[_0xd5d4('0x1a')]?_[_0xd5d4('0x1c')](_0x4f316a[_0xd5d4('0x1a')],function(_0x9d27ca){return{'model':db[_0x9d27ca[_0xd5d4('0x1b')]],'as':_0x9d27ca['as'],'attributes':_0x9d27ca[_0xd5d4('0x18')]};}):[]};}):[]};}):[]:[]})[_0xd5d4('0x1d')](function(_0x3ee11b){logger['info']('GetServicenowAccount',_0x582da6);logger[_0xd5d4('0xc')]('GetServicenowAccount',_0x582da6,JSON['stringify'](_0x3ee11b));_0x249362(_0x3ee11b);})['catch'](function(_0x4807c1){logger[_0xd5d4('0xf')](_0xd5d4('0x15'),_0x4807c1[_0xd5d4('0x11')],_0x582da6);_0x55f124(_0x53080c[_0xd5d4('0xf')](0x1f4,_0x4807c1[_0xd5d4('0x11')]));});});};exports['ShowServicenowAccount']=function(_0x225e2a){var _0x287e5a=this;return new Promise(function(_0x4b5a09,_0x39d88e){return db['ServicenowAccount'][_0xd5d4('0x1e')]({'raw':_0x225e2a[_0xd5d4('0x16')]?_0x225e2a[_0xd5d4('0x16')][_0xd5d4('0x1f')]===undefined?!![]:![]:!![],'where':_0x225e2a[_0xd5d4('0x16')]?_0x225e2a[_0xd5d4('0x16')][_0xd5d4('0x17')]||null:null,'attributes':_0x225e2a[_0xd5d4('0x16')]?_0x225e2a[_0xd5d4('0x16')][_0xd5d4('0x18')]||null:null,'include':_0x225e2a[_0xd5d4('0x16')]?_0x225e2a['options'][_0xd5d4('0x1a')]?_[_0xd5d4('0x1c')](_0x225e2a[_0xd5d4('0x16')][_0xd5d4('0x1a')],function(_0xdf786){return{'model':db[_0xdf786[_0xd5d4('0x1b')]],'as':_0xdf786['as'],'attributes':_0xdf786[_0xd5d4('0x18')],'include':_0xdf786['include']?_[_0xd5d4('0x1c')](_0xdf786[_0xd5d4('0x1a')],function(_0x1810d6){return{'model':db[_0x1810d6[_0xd5d4('0x1b')]],'as':_0x1810d6['as'],'attributes':_0x1810d6[_0xd5d4('0x18')],'include':_0x1810d6[_0xd5d4('0x1a')]?_[_0xd5d4('0x1c')](_0x1810d6['include'],function(_0x14a4f1){return{'model':db[_0x14a4f1['model']],'as':_0x14a4f1['as'],'attributes':_0x14a4f1[_0xd5d4('0x18')]};}):[]};}):[]};}):[]:[]})[_0xd5d4('0x1d')](function(_0x3539f2){logger['info'](_0xd5d4('0x20'),_0x225e2a);logger[_0xd5d4('0xc')](_0xd5d4('0x20'),_0x225e2a,JSON[_0xd5d4('0xe')](_0x3539f2));_0x4b5a09(_0x3539f2);})[_0xd5d4('0x14')](function(_0x584fbe){logger[_0xd5d4('0xf')](_0xd5d4('0x20'),_0x584fbe[_0xd5d4('0x11')],_0x225e2a);_0x39d88e(_0x287e5a[_0xd5d4('0xf')](0x1f4,_0x584fbe[_0xd5d4('0x11')]));});});}; \ No newline at end of file +var _0x974b=['../../config/utils','rpc','../../config/environment','http','request','then','ServicenowAccount,\x20%s,\x20%s','ServicenowAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','GetServicenowAccount','ServicenowAccount','findAll','options','raw','attributes','limit','include','model','map','debug','catch','ShowServicenowAccount','find','where','lodash','util','bluebird'];(function(_0x2ed1ad,_0x1fb8a1){var _0x1deb5e=function(_0x4a5d76){while(--_0x4a5d76){_0x2ed1ad['push'](_0x2ed1ad['shift']());}};_0x1deb5e(++_0x1fb8a1);}(_0x974b,0x1cb));var _0xb974=function(_0x2543be,_0x19ebd6){_0x2543be=_0x2543be-0x0;var _0x4636d0=_0x974b[_0x2543be];return _0x4636d0;};'use strict';var _=require(_0xb974('0x0'));var util=require(_0xb974('0x1'));var moment=require('moment');var BPromise=require(_0xb974('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xb974('0x3'));var logger=require('../../config/logger')(_0xb974('0x4'));var config=require(_0xb974('0x5'));var jayson=require('jayson/promise');var client=jayson['client'][_0xb974('0x6')]({'port':0x232a});function respondWithRpcPromise(_0xf1e171,_0x1e9ec4,_0x2b3663){return new BPromise(function(_0x103a35,_0x347152){return client[_0xb974('0x7')](_0xf1e171,_0x2b3663)[_0xb974('0x8')](function(_0x51045b){logger['info'](_0xb974('0x9'),_0x1e9ec4,'request\x20sent');logger['debug'](_0xb974('0xa'),_0x1e9ec4,_0xb974('0xb'),JSON[_0xb974('0xc')](_0x51045b));if(_0x51045b[_0xb974('0xd')]){if(_0x51045b['error'][_0xb974('0xe')]===0x1f4){logger[_0xb974('0xd')]('ServicenowAccount,\x20%s,\x20%s',_0x1e9ec4,_0x51045b[_0xb974('0xd')]['message']);return _0x347152(_0x51045b[_0xb974('0xd')][_0xb974('0xf')]);}logger[_0xb974('0xd')]('ServicenowAccount,\x20%s,\x20%s',_0x1e9ec4,_0x51045b['error']['message']);return _0x103a35(_0x51045b[_0xb974('0xd')][_0xb974('0xf')]);}else{logger[_0xb974('0x10')](_0xb974('0x9'),_0x1e9ec4,'request\x20sent');_0x103a35(_0x51045b[_0xb974('0x11')][_0xb974('0xf')]);}})['catch'](function(_0x22111c){logger['error']('ServicenowAccount,\x20%s,\x20%s',_0x1e9ec4,_0x22111c);_0x347152(_0x22111c);});});}exports[_0xb974('0x12')]=function(_0x37692a){var _0x39a443=this;return new Promise(function(_0x38ce9d,_0x196618){return db[_0xb974('0x13')][_0xb974('0x14')]({'raw':_0x37692a[_0xb974('0x15')]?_0x37692a['options'][_0xb974('0x16')]===undefined?!![]:![]:!![],'where':_0x37692a[_0xb974('0x15')]?_0x37692a['options']['where']||null:null,'attributes':_0x37692a['options']?_0x37692a[_0xb974('0x15')][_0xb974('0x17')]||null:null,'limit':_0x37692a[_0xb974('0x15')]?_0x37692a['options'][_0xb974('0x18')]||null:null,'include':_0x37692a[_0xb974('0x15')]?_0x37692a['options'][_0xb974('0x19')]?_['map'](_0x37692a[_0xb974('0x15')][_0xb974('0x19')],function(_0x53d7f2){return{'model':db[_0x53d7f2[_0xb974('0x1a')]],'as':_0x53d7f2['as'],'attributes':_0x53d7f2[_0xb974('0x17')],'include':_0x53d7f2[_0xb974('0x19')]?_[_0xb974('0x1b')](_0x53d7f2['include'],function(_0x3aff2c){return{'model':db[_0x3aff2c[_0xb974('0x1a')]],'as':_0x3aff2c['as'],'attributes':_0x3aff2c[_0xb974('0x17')],'include':_0x3aff2c[_0xb974('0x19')]?_[_0xb974('0x1b')](_0x3aff2c['include'],function(_0x28fd00){return{'model':db[_0x28fd00[_0xb974('0x1a')]],'as':_0x28fd00['as'],'attributes':_0x28fd00[_0xb974('0x17')]};}):[]};}):[]};}):[]:[]})[_0xb974('0x8')](function(_0x45231b){logger[_0xb974('0x10')](_0xb974('0x12'),_0x37692a);logger[_0xb974('0x1c')](_0xb974('0x12'),_0x37692a,JSON[_0xb974('0xc')](_0x45231b));_0x38ce9d(_0x45231b);})[_0xb974('0x1d')](function(_0x55225f){logger['error'](_0xb974('0x12'),_0x55225f[_0xb974('0xf')],_0x37692a);_0x196618(_0x39a443[_0xb974('0xd')](0x1f4,_0x55225f['message']));});});};exports[_0xb974('0x1e')]=function(_0x254568){var _0x37fce9=this;return new Promise(function(_0x558c74,_0x4e5fa0){return db[_0xb974('0x13')][_0xb974('0x1f')]({'raw':_0x254568[_0xb974('0x15')]?_0x254568[_0xb974('0x15')]['raw']===undefined?!![]:![]:!![],'where':_0x254568[_0xb974('0x15')]?_0x254568['options'][_0xb974('0x20')]||null:null,'attributes':_0x254568[_0xb974('0x15')]?_0x254568[_0xb974('0x15')][_0xb974('0x17')]||null:null,'include':_0x254568[_0xb974('0x15')]?_0x254568[_0xb974('0x15')][_0xb974('0x19')]?_['map'](_0x254568['options'][_0xb974('0x19')],function(_0x5a2f55){return{'model':db[_0x5a2f55['model']],'as':_0x5a2f55['as'],'attributes':_0x5a2f55[_0xb974('0x17')],'include':_0x5a2f55[_0xb974('0x19')]?_['map'](_0x5a2f55[_0xb974('0x19')],function(_0x5d365c){return{'model':db[_0x5d365c[_0xb974('0x1a')]],'as':_0x5d365c['as'],'attributes':_0x5d365c['attributes'],'include':_0x5d365c[_0xb974('0x19')]?_[_0xb974('0x1b')](_0x5d365c[_0xb974('0x19')],function(_0x1dd1b2){return{'model':db[_0x1dd1b2['model']],'as':_0x1dd1b2['as'],'attributes':_0x1dd1b2[_0xb974('0x17')]};}):[]};}):[]};}):[]:[]})[_0xb974('0x8')](function(_0x544d97){logger[_0xb974('0x10')](_0xb974('0x1e'),_0x254568);logger[_0xb974('0x1c')](_0xb974('0x1e'),_0x254568,JSON[_0xb974('0xc')](_0x544d97));_0x558c74(_0x544d97);})['catch'](function(_0xa57259){logger['error'](_0xb974('0x1e'),_0xa57259['message'],_0x254568);_0x4e5fa0(_0x37fce9[_0xb974('0xd')](0x1f4,_0xa57259[_0xb974('0xf')]));});});}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/index.js b/server/api/intServicenowConfiguration/index.js index a457356..63ba4e0 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 _0x90e0=['get','isAuthenticated','index','/:id','show','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','create','put','update','delete','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowConfiguration.controller'];(function(_0x50b7e2,_0xe40aa6){var _0x214daf=function(_0x54e66a){while(--_0x54e66a){_0x50b7e2['push'](_0x50b7e2['shift']());}};_0x214daf(++_0xe40aa6);}(_0x90e0,0xb7));var _0x090e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x90e0[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x090e('0x0'));var util=require('util');var path=require(_0x090e('0x1'));var timeout=require(_0x090e('0x2'));var express=require(_0x090e('0x3'));var router=express['Router']();var fs_extra=require(_0x090e('0x4'));var auth=require(_0x090e('0x5'));var interaction=require(_0x090e('0x6'));var config=require(_0x090e('0x7'));var controller=require(_0x090e('0x8'));router[_0x090e('0x9')]('/',auth[_0x090e('0xa')](),controller[_0x090e('0xb')]);router[_0x090e('0x9')](_0x090e('0xc'),auth[_0x090e('0xa')](),controller[_0x090e('0xd')]);router[_0x090e('0x9')]('/:id/fields',auth['isAuthenticated'](),controller[_0x090e('0xe')]);router[_0x090e('0x9')](_0x090e('0xf'),auth['isAuthenticated'](),controller[_0x090e('0x10')]);router[_0x090e('0x9')](_0x090e('0x11'),auth[_0x090e('0xa')](),controller[_0x090e('0x12')]);router[_0x090e('0x13')]('/',auth['isAuthenticated'](),controller[_0x090e('0x14')]);router[_0x090e('0x15')](_0x090e('0xc'),auth[_0x090e('0xa')](),controller[_0x090e('0x16')]);router[_0x090e('0x17')](_0x090e('0xc'),auth[_0x090e('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xde91=['../../components/auth/service','../../config/environment','./intServicenowConfiguration.controller','get','isAuthenticated','index','/:id','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','put','exports','util','path','express','Router'];(function(_0x33fadc,_0x590a1a){var _0x8ce20=function(_0x1ac5e7){while(--_0x1ac5e7){_0x33fadc['push'](_0x33fadc['shift']());}};_0x8ce20(++_0x590a1a);}(_0xde91,0x100));var _0x1de9=function(_0x1044e5,_0x498e01){_0x1044e5=_0x1044e5-0x0;var _0x5ad0dd=_0xde91[_0x1044e5];return _0x5ad0dd;};'use strict';var multer=require('multer');var util=require(_0x1de9('0x0'));var path=require(_0x1de9('0x1'));var timeout=require('connect-timeout');var express=require(_0x1de9('0x2'));var router=express[_0x1de9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1de9('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x1de9('0x5'));var controller=require(_0x1de9('0x6'));router[_0x1de9('0x7')]('/',auth[_0x1de9('0x8')](),controller[_0x1de9('0x9')]);router[_0x1de9('0x7')](_0x1de9('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x1de9('0x7')](_0x1de9('0xb'),auth['isAuthenticated'](),controller[_0x1de9('0xc')]);router['get'](_0x1de9('0xd'),auth[_0x1de9('0x8')](),controller[_0x1de9('0xe')]);router[_0x1de9('0x7')](_0x1de9('0xf'),auth['isAuthenticated'](),controller[_0x1de9('0x10')]);router[_0x1de9('0x11')]('/',auth[_0x1de9('0x8')](),controller['create']);router[_0x1de9('0x12')](_0x1de9('0xa'),auth[_0x1de9('0x8')](),controller['update']);router['delete'](_0x1de9('0xa'),auth[_0x1de9('0x8')](),controller['destroy']);module[_0x1de9('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 cd4141b..42ad82a 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 _0xc615=['exports','STRING'];(function(_0x307d86,_0x9264f2){var _0x361745=function(_0x1b64e1){while(--_0x1b64e1){_0x307d86['push'](_0x307d86['shift']());}};_0x361745(++_0x9264f2);}(_0xc615,0x194));var _0x5c61=function(_0x4b2863,_0x494899){_0x4b2863=_0x4b2863-0x0;var _0x567d67=_0xc615[_0x4b2863];return _0x567d67;};'use strict';var Sequelize=require('sequelize');module[_0x5c61('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x5c61('0x1')]}}; \ No newline at end of file +var _0x2eb1=['STRING','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2eb1,0x1c7));var _0x12eb=function(_0x47fb0b,_0x5300d7){_0x47fb0b=_0x47fb0b-0x0;var _0x4eb00a=_0x2eb1[_0x47fb0b];return _0x4eb00a;};'use strict';var Sequelize=require('sequelize');module[_0x12eb('0x0')]={'name':{'type':Sequelize[_0x12eb('0x1')]},'description':{'type':Sequelize[_0x12eb('0x1')]}}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js index 083f36b..8be48e5 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 _0x2e58=['name','send','index','map','ServicenowConfiguration','rawAttributes','fieldName','type','keys','filters','intersection','model','query','fields','attributes','length','hasOwnProperty','nolimit','sort','pick','merge','where','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','find','create','body','getFields','findOne','ServicenowField','order','filter','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../config/license/hardware','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','destroy','then','error','stack'];(function(_0x3b76f7,_0x566c53){var _0x43984e=function(_0x164f77){while(--_0x164f77){_0x3b76f7['push'](_0x3b76f7['shift']());}};_0x43984e(++_0x566c53);}(_0x2e58,0x79));var _0x82e5=function(_0xf6268a,_0x4d2a75){_0xf6268a=_0xf6268a-0x0;var _0x479dbd=_0x2e58[_0xf6268a];return _0x479dbd;};'use strict';var emlformat=require(_0x82e5('0x0'));var rimraf=require(_0x82e5('0x1'));var zipdir=require(_0x82e5('0x2'));var jsonpatch=require(_0x82e5('0x3'));var rp=require(_0x82e5('0x4'));var moment=require(_0x82e5('0x5'));var BPromise=require(_0x82e5('0x6'));var Mustache=require('mustache');var util=require(_0x82e5('0x7'));var path=require(_0x82e5('0x8'));var sox=require(_0x82e5('0x9'));var csv=require(_0x82e5('0xa'));var ejs=require(_0x82e5('0xb'));var fs=require('fs');var fs_extra=require(_0x82e5('0xc'));var _=require(_0x82e5('0xd'));var squel=require('squel');var crypto=require(_0x82e5('0xe'));var jsforce=require(_0x82e5('0xf'));var deskjs=require(_0x82e5('0x10'));var toCsv=require(_0x82e5('0xa'));var querystring=require(_0x82e5('0x11'));var Papa=require(_0x82e5('0x12'));var Redis=require('ioredis');var authService=require(_0x82e5('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x82e5('0x14'));var logger=require('../../config/logger')(_0x82e5('0x15'));var utils=require('../../config/utils');var config=require(_0x82e5('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x82e5('0x17'))['db'];function respondWithStatusCode(_0x4a4dec,_0x9dd361){_0x9dd361=_0x9dd361||0xcc;return function(_0x8b5892){if(_0x8b5892){return _0x4a4dec[_0x82e5('0x18')](_0x9dd361);}return _0x4a4dec[_0x82e5('0x19')](_0x9dd361)[_0x82e5('0x1a')]();};}function respondWithResult(_0x20d989,_0x4c096d){_0x4c096d=_0x4c096d||0xc8;return function(_0x5e91d1){if(_0x5e91d1){return _0x20d989[_0x82e5('0x19')](_0x4c096d)[_0x82e5('0x1b')](_0x5e91d1);}};}function respondWithFilteredResult(_0x11324b,_0x343ce6){return function(_0x20802c){if(_0x20802c){var _0x557337=typeof _0x343ce6[_0x82e5('0x1c')]===_0x82e5('0x1d')&&typeof _0x343ce6[_0x82e5('0x1e')]==='undefined';var _0x533b3b=_0x20802c[_0x82e5('0x1f')];var _0x5eb889=_0x557337?0x0:_0x343ce6['offset'];var _0x26e7fd=_0x557337?_0x20802c[_0x82e5('0x1f')]:_0x343ce6[_0x82e5('0x1c')]+_0x343ce6[_0x82e5('0x1e')];var _0xf4b53e;if(_0x26e7fd>=_0x533b3b){_0x26e7fd=_0x533b3b;_0xf4b53e=0xc8;}else{_0xf4b53e=0xce;}_0x11324b[_0x82e5('0x19')](_0xf4b53e);return _0x11324b[_0x82e5('0x20')]('Content-Range',_0x5eb889+'-'+_0x26e7fd+'/'+_0x533b3b)['json'](_0x20802c);}return null;};}function patchUpdates(_0x5c7b02){return function(_0x3609cb){try{jsonpatch[_0x82e5('0x21')](_0x3609cb,_0x5c7b02,!![]);}catch(_0x2e0570){return BPromise[_0x82e5('0x22')](_0x2e0570);}return _0x3609cb[_0x82e5('0x23')]();};}function saveUpdates(_0x5a6b4c,_0x3cd89f){return function(_0x425dd3){if(_0x425dd3){return _0x425dd3[_0x82e5('0x24')](_0x5a6b4c)['then'](function(_0x34426b){return _0x34426b;});}return null;};}function removeEntity(_0x2a041e,_0xcca52f){return function(_0x4fe9c9){if(_0x4fe9c9){return _0x4fe9c9[_0x82e5('0x25')]()[_0x82e5('0x26')](function(){_0x2a041e[_0x82e5('0x19')](0xcc)[_0x82e5('0x1a')]();});}};}function handleEntityNotFound(_0x4498f9,_0x211967){return function(_0x497ed8){if(!_0x497ed8){_0x4498f9[_0x82e5('0x18')](0x194);}return _0x497ed8;};}function handleError(_0x344c01,_0x36d4be){_0x36d4be=_0x36d4be||0x1f4;return function(_0x59aacf){logger[_0x82e5('0x27')](_0x59aacf[_0x82e5('0x28')]);if(_0x59aacf[_0x82e5('0x29')]){delete _0x59aacf[_0x82e5('0x29')];}_0x344c01[_0x82e5('0x19')](_0x36d4be)[_0x82e5('0x2a')](_0x59aacf);};}exports[_0x82e5('0x2b')]=function(_0x28a3ac,_0x5551c2){var _0x5c1297={},_0x57e887={},_0x40915b={'count':0x0,'rows':[]};var _0x224daa=_[_0x82e5('0x2c')](db[_0x82e5('0x2d')][_0x82e5('0x2e')],function(_0x6bcf34){return{'name':_0x6bcf34[_0x82e5('0x2f')],'type':_0x6bcf34[_0x82e5('0x30')]['key']};});_0x57e887['model']=_[_0x82e5('0x2c')](_0x224daa,'name');_0x57e887['query']=_[_0x82e5('0x31')](_0x28a3ac['query']);_0x57e887[_0x82e5('0x32')]=_[_0x82e5('0x33')](_0x57e887[_0x82e5('0x34')],_0x57e887[_0x82e5('0x35')]);_0x5c1297['attributes']=_['intersection'](_0x57e887[_0x82e5('0x34')],qs[_0x82e5('0x36')](_0x28a3ac['query'][_0x82e5('0x36')]));_0x5c1297[_0x82e5('0x37')]=_0x5c1297[_0x82e5('0x37')][_0x82e5('0x38')]?_0x5c1297[_0x82e5('0x37')]:_0x57e887['model'];if(!_0x28a3ac[_0x82e5('0x35')][_0x82e5('0x39')](_0x82e5('0x3a'))){_0x5c1297[_0x82e5('0x1e')]=qs[_0x82e5('0x1e')](_0x28a3ac[_0x82e5('0x35')][_0x82e5('0x1e')]);_0x5c1297[_0x82e5('0x1c')]=qs[_0x82e5('0x1c')](_0x28a3ac[_0x82e5('0x35')][_0x82e5('0x1c')]);}_0x5c1297['order']=qs['sort'](_0x28a3ac[_0x82e5('0x35')][_0x82e5('0x3b')]);_0x5c1297['where']=qs[_0x82e5('0x32')](_[_0x82e5('0x3c')](_0x28a3ac[_0x82e5('0x35')],_0x57e887['filters']),_0x224daa);if(_0x28a3ac[_0x82e5('0x35')]['filter']){_0x5c1297['where']=_[_0x82e5('0x3d')](_0x5c1297[_0x82e5('0x3e')],{'$or':_[_0x82e5('0x2c')](_0x224daa,function(_0x23fb4d){if(_0x23fb4d['type']!==_0x82e5('0x3f')){var _0x124693={};_0x124693[_0x23fb4d[_0x82e5('0x29')]]={'$like':'%'+_0x28a3ac[_0x82e5('0x35')]['filter']+'%'};return _0x124693;}})});}_0x5c1297=_[_0x82e5('0x3d')]({},_0x5c1297,_0x28a3ac[_0x82e5('0x40')]);var _0x23222c={'where':_0x5c1297[_0x82e5('0x3e')]};return db[_0x82e5('0x2d')]['count'](_0x23222c)[_0x82e5('0x26')](function(_0x3f368e){_0x40915b['count']=_0x3f368e;if(_0x28a3ac[_0x82e5('0x35')][_0x82e5('0x41')]){_0x5c1297[_0x82e5('0x42')]=[{'all':!![]}];}return db[_0x82e5('0x2d')][_0x82e5('0x43')](_0x5c1297);})[_0x82e5('0x26')](function(_0x200120){_0x40915b[_0x82e5('0x44')]=_0x200120;return _0x40915b;})['then'](respondWithFilteredResult(_0x5551c2,_0x5c1297))[_0x82e5('0x45')](handleError(_0x5551c2,null));};exports['show']=function(_0x114f79,_0x23a80d){var _0x36e701={'raw':![],'where':{'id':_0x114f79[_0x82e5('0x46')]['id']}},_0x656dad={};_0x656dad['model']=_['keys'](db[_0x82e5('0x2d')][_0x82e5('0x2e')]);_0x656dad['query']=_[_0x82e5('0x31')](_0x114f79[_0x82e5('0x35')]);_0x656dad[_0x82e5('0x32')]=_['intersection'](_0x656dad[_0x82e5('0x34')],_0x656dad[_0x82e5('0x35')]);_0x36e701['attributes']=_['intersection'](_0x656dad[_0x82e5('0x34')],qs['fields'](_0x114f79[_0x82e5('0x35')][_0x82e5('0x36')]));_0x36e701[_0x82e5('0x37')]=_0x36e701[_0x82e5('0x37')][_0x82e5('0x38')]?_0x36e701[_0x82e5('0x37')]:_0x656dad['model'];if(_0x114f79[_0x82e5('0x35')][_0x82e5('0x41')]){_0x36e701[_0x82e5('0x42')]=[{'all':!![]}];}_0x36e701=_['merge']({},_0x36e701,_0x114f79[_0x82e5('0x40')]);return db['ServicenowConfiguration'][_0x82e5('0x47')](_0x36e701)[_0x82e5('0x26')](handleEntityNotFound(_0x23a80d,null))[_0x82e5('0x26')](respondWithResult(_0x23a80d,null))['catch'](handleError(_0x23a80d,null));};exports[_0x82e5('0x48')]=function(_0xcfb999,_0x19b427){return db[_0x82e5('0x2d')][_0x82e5('0x48')](_0xcfb999[_0x82e5('0x49')],{})[_0x82e5('0x26')](respondWithResult(_0x19b427,0xc9))[_0x82e5('0x45')](handleError(_0x19b427,null));};exports[_0x82e5('0x24')]=function(_0x28ee1a,_0xa0e570){if(_0x28ee1a[_0x82e5('0x49')]['id']){delete _0x28ee1a['body']['id'];}return db['ServicenowConfiguration'][_0x82e5('0x47')]({'where':{'id':_0x28ee1a['params']['id']}})[_0x82e5('0x26')](handleEntityNotFound(_0xa0e570,null))['then'](saveUpdates(_0x28ee1a[_0x82e5('0x49')],null))[_0x82e5('0x26')](respondWithResult(_0xa0e570,null))[_0x82e5('0x45')](handleError(_0xa0e570,null));};exports[_0x82e5('0x25')]=function(_0x114b3e,_0x572dc1){return db[_0x82e5('0x2d')][_0x82e5('0x47')]({'where':{'id':_0x114b3e[_0x82e5('0x46')]['id']}})[_0x82e5('0x26')](handleEntityNotFound(_0x572dc1,null))[_0x82e5('0x26')](removeEntity(_0x572dc1,null))['catch'](handleError(_0x572dc1,null));};exports[_0x82e5('0x4a')]=function(_0xd0bd3,_0x6fd2a,_0x357fec){var _0x35eafa={};var _0x35447e={};var _0x274cfc;var _0x237d32;return db[_0x82e5('0x2d')][_0x82e5('0x4b')]({'where':{'id':_0xd0bd3['params']['id']}})[_0x82e5('0x26')](handleEntityNotFound(_0x6fd2a,null))['then'](function(_0x204eee){if(_0x204eee){_0x274cfc=_0x204eee;_0x35447e[_0x82e5('0x34')]=_[_0x82e5('0x31')](db[_0x82e5('0x4c')][_0x82e5('0x2e')]);_0x35447e[_0x82e5('0x35')]=_['keys'](_0xd0bd3[_0x82e5('0x35')]);_0x35447e[_0x82e5('0x32')]=_['intersection'](_0x35447e['model'],_0x35447e[_0x82e5('0x35')]);_0x35eafa['attributes']=_[_0x82e5('0x33')](_0x35447e['model'],qs[_0x82e5('0x36')](_0xd0bd3['query']['fields']));_0x35eafa[_0x82e5('0x37')]=_0x35eafa[_0x82e5('0x37')]['length']?_0x35eafa[_0x82e5('0x37')]:_0x35447e[_0x82e5('0x34')];_0x35eafa[_0x82e5('0x4d')]=qs[_0x82e5('0x3b')](_0xd0bd3[_0x82e5('0x35')]['sort']);_0x35eafa[_0x82e5('0x3e')]=qs[_0x82e5('0x32')](_[_0x82e5('0x3c')](_0xd0bd3[_0x82e5('0x35')],_0x35447e[_0x82e5('0x32')]));if(_0xd0bd3[_0x82e5('0x35')][_0x82e5('0x4e')]){_0x35eafa[_0x82e5('0x3e')]=_[_0x82e5('0x3d')](_0x35eafa['where'],{'$or':_[_0x82e5('0x2c')](_0x35eafa[_0x82e5('0x37')],function(_0x4d6202){var _0x40d273={};_0x40d273[_0x4d6202]={'$like':'%'+_0xd0bd3[_0x82e5('0x35')][_0x82e5('0x4e')]+'%'};return _0x40d273;})});}_0x35eafa=_[_0x82e5('0x3d')]({},_0x35eafa,_0xd0bd3[_0x82e5('0x40')]);return _0x274cfc[_0x82e5('0x4a')](_0x35eafa);}})[_0x82e5('0x26')](function(_0x27f16e){if(_0x27f16e){_0x237d32=_0x27f16e[_0x82e5('0x38')];if(!_0xd0bd3[_0x82e5('0x35')][_0x82e5('0x39')]('nolimit')){_0x35eafa['limit']=qs[_0x82e5('0x1e')](_0xd0bd3[_0x82e5('0x35')][_0x82e5('0x1e')]);_0x35eafa[_0x82e5('0x1c')]=qs['offset'](_0xd0bd3['query']['offset']);}return _0x274cfc[_0x82e5('0x4a')](_0x35eafa);}})[_0x82e5('0x26')](function(_0x529d6a){if(_0x529d6a){return _0x529d6a?{'count':_0x237d32,'rows':_0x529d6a}:null;}})[_0x82e5('0x26')](respondWithResult(_0x6fd2a,null))[_0x82e5('0x45')](handleError(_0x6fd2a,null));};exports[_0x82e5('0x4f')]=function(_0xb74347,_0x496ca3,_0x404a62){var _0x384c9b={};var _0x2aab06={};var _0x31d180;var _0x5cd9b2;return db[_0x82e5('0x2d')][_0x82e5('0x4b')]({'where':{'id':_0xb74347[_0x82e5('0x46')]['id']}})[_0x82e5('0x26')](handleEntityNotFound(_0x496ca3,null))['then'](function(_0x500bdb){if(_0x500bdb){_0x31d180=_0x500bdb;_0x2aab06[_0x82e5('0x34')]=_[_0x82e5('0x31')](db[_0x82e5('0x4c')]['rawAttributes']);_0x2aab06['query']=_[_0x82e5('0x31')](_0xb74347['query']);_0x2aab06[_0x82e5('0x32')]=_[_0x82e5('0x33')](_0x2aab06[_0x82e5('0x34')],_0x2aab06['query']);_0x384c9b['attributes']=_[_0x82e5('0x33')](_0x2aab06[_0x82e5('0x34')],qs['fields'](_0xb74347[_0x82e5('0x35')][_0x82e5('0x36')]));_0x384c9b[_0x82e5('0x37')]=_0x384c9b[_0x82e5('0x37')][_0x82e5('0x38')]?_0x384c9b[_0x82e5('0x37')]:_0x2aab06['model'];_0x384c9b[_0x82e5('0x4d')]=qs[_0x82e5('0x3b')](_0xb74347['query'][_0x82e5('0x3b')]);_0x384c9b['where']=qs[_0x82e5('0x32')](_[_0x82e5('0x3c')](_0xb74347['query'],_0x2aab06[_0x82e5('0x32')]));if(_0xb74347[_0x82e5('0x35')]['filter']){_0x384c9b[_0x82e5('0x3e')]=_[_0x82e5('0x3d')](_0x384c9b[_0x82e5('0x3e')],{'$or':_[_0x82e5('0x2c')](_0x384c9b['attributes'],function(_0x1cedc6){var _0x1b2500={};_0x1b2500[_0x1cedc6]={'$like':'%'+_0xb74347['query'][_0x82e5('0x4e')]+'%'};return _0x1b2500;})});}_0x384c9b=_[_0x82e5('0x3d')]({},_0x384c9b,_0xb74347[_0x82e5('0x40')]);return _0x31d180['getSubjects'](_0x384c9b);}})[_0x82e5('0x26')](function(_0x13ae03){if(_0x13ae03){_0x5cd9b2=_0x13ae03[_0x82e5('0x38')];if(!_0xb74347['query']['hasOwnProperty'](_0x82e5('0x3a'))){_0x384c9b[_0x82e5('0x1e')]=qs[_0x82e5('0x1e')](_0xb74347['query'][_0x82e5('0x1e')]);_0x384c9b['offset']=qs[_0x82e5('0x1c')](_0xb74347[_0x82e5('0x35')][_0x82e5('0x1c')]);}return _0x31d180[_0x82e5('0x4f')](_0x384c9b);}})[_0x82e5('0x26')](function(_0x2cc369){if(_0x2cc369){return _0x2cc369?{'count':_0x5cd9b2,'rows':_0x2cc369}:null;}})['then'](respondWithResult(_0x496ca3,null))['catch'](handleError(_0x496ca3,null));};exports[_0x82e5('0x50')]=function(_0x3c26ec,_0x48b294,_0x367bef){var _0x38ea5b={};var _0x4adb85={};var _0x5b279e;var _0xfd532e;return db[_0x82e5('0x2d')][_0x82e5('0x4b')]({'where':{'id':_0x3c26ec[_0x82e5('0x46')]['id']}})['then'](handleEntityNotFound(_0x48b294,null))[_0x82e5('0x26')](function(_0x411152){if(_0x411152){_0x5b279e=_0x411152;_0x4adb85['model']=_[_0x82e5('0x31')](db['ServicenowField']['rawAttributes']);_0x4adb85[_0x82e5('0x35')]=_[_0x82e5('0x31')](_0x3c26ec[_0x82e5('0x35')]);_0x4adb85['filters']=_[_0x82e5('0x33')](_0x4adb85[_0x82e5('0x34')],_0x4adb85[_0x82e5('0x35')]);_0x38ea5b['attributes']=_['intersection'](_0x4adb85['model'],qs[_0x82e5('0x36')](_0x3c26ec[_0x82e5('0x35')][_0x82e5('0x36')]));_0x38ea5b['attributes']=_0x38ea5b[_0x82e5('0x37')]['length']?_0x38ea5b[_0x82e5('0x37')]:_0x4adb85[_0x82e5('0x34')];_0x38ea5b['order']=qs['sort'](_0x3c26ec[_0x82e5('0x35')][_0x82e5('0x3b')]);_0x38ea5b[_0x82e5('0x3e')]=qs[_0x82e5('0x32')](_[_0x82e5('0x3c')](_0x3c26ec['query'],_0x4adb85['filters']));if(_0x3c26ec[_0x82e5('0x35')][_0x82e5('0x4e')]){_0x38ea5b[_0x82e5('0x3e')]=_[_0x82e5('0x3d')](_0x38ea5b['where'],{'$or':_[_0x82e5('0x2c')](_0x38ea5b['attributes'],function(_0x34bf22){var _0x334ddd={};_0x334ddd[_0x34bf22]={'$like':'%'+_0x3c26ec[_0x82e5('0x35')][_0x82e5('0x4e')]+'%'};return _0x334ddd;})});}_0x38ea5b=_['merge']({},_0x38ea5b,_0x3c26ec['options']);return _0x5b279e[_0x82e5('0x50')](_0x38ea5b);}})['then'](function(_0x542d6d){if(_0x542d6d){_0xfd532e=_0x542d6d[_0x82e5('0x38')];if(!_0x3c26ec['query']['hasOwnProperty'](_0x82e5('0x3a'))){_0x38ea5b[_0x82e5('0x1e')]=qs[_0x82e5('0x1e')](_0x3c26ec['query'][_0x82e5('0x1e')]);_0x38ea5b[_0x82e5('0x1c')]=qs[_0x82e5('0x1c')](_0x3c26ec[_0x82e5('0x35')][_0x82e5('0x1c')]);}return _0x5b279e[_0x82e5('0x50')](_0x38ea5b);}})['then'](function(_0x307515){if(_0x307515){return _0x307515?{'count':_0xfd532e,'rows':_0x307515}:null;}})[_0x82e5('0x26')](respondWithResult(_0x48b294,null))[_0x82e5('0x45')](handleError(_0x48b294,null));}; \ No newline at end of file +var _0x292a=['limit','status','set','Content-Range','reject','save','destroy','then','error','name','send','index','ServicenowConfiguration','rawAttributes','fieldName','type','key','model','map','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','count','includeAll','include','rows','catch','show','params','create','body','find','getFields','findOne','ServicenowField','order','getSubjects','getDescriptions','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','undefined'];(function(_0x5bf538,_0x5eb7eb){var _0x4b3b86=function(_0x4ee451){while(--_0x4ee451){_0x5bf538['push'](_0x5bf538['shift']());}};_0x4b3b86(++_0x5eb7eb);}(_0x292a,0x84));var _0xa292=function(_0x51a6d6,_0x3c9c49){_0x51a6d6=_0x51a6d6-0x0;var _0x5ef1a8=_0x292a[_0x51a6d6];return _0x5ef1a8;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa292('0x0'));var zipdir=require(_0xa292('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa292('0x2'));var moment=require('moment');var BPromise=require(_0xa292('0x3'));var Mustache=require(_0xa292('0x4'));var util=require(_0xa292('0x5'));var path=require(_0xa292('0x6'));var sox=require(_0xa292('0x7'));var csv=require(_0xa292('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xa292('0x9'));var _=require(_0xa292('0xa'));var squel=require(_0xa292('0xb'));var crypto=require(_0xa292('0xc'));var jsforce=require(_0xa292('0xd'));var deskjs=require(_0xa292('0xe'));var toCsv=require(_0xa292('0x8'));var querystring=require(_0xa292('0xf'));var Papa=require('papaparse');var Redis=require(_0xa292('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xa292('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa292('0x12'));var logger=require(_0xa292('0x13'))(_0xa292('0x14'));var utils=require(_0xa292('0x15'));var config=require(_0xa292('0x16'));var licenseUtil=require(_0xa292('0x17'));var db=require(_0xa292('0x18'))['db'];function respondWithStatusCode(_0x211764,_0x722ad0){_0x722ad0=_0x722ad0||0xcc;return function(_0xfd8e94){if(_0xfd8e94){return _0x211764[_0xa292('0x19')](_0x722ad0);}return _0x211764['status'](_0x722ad0)[_0xa292('0x1a')]();};}function respondWithResult(_0x359882,_0x5ae01c){_0x5ae01c=_0x5ae01c||0xc8;return function(_0x2cc204){if(_0x2cc204){return _0x359882['status'](_0x5ae01c)[_0xa292('0x1b')](_0x2cc204);}};}function respondWithFilteredResult(_0x1b543e,_0x528575){return function(_0x2ac0a9){if(_0x2ac0a9){var _0x161260=typeof _0x528575[_0xa292('0x1c')]==='undefined'&&typeof _0x528575['limit']===_0xa292('0x1d');var _0x39bba0=_0x2ac0a9['count'];var _0x58de0d=_0x161260?0x0:_0x528575[_0xa292('0x1c')];var _0x35d8a5=_0x161260?_0x2ac0a9['count']:_0x528575[_0xa292('0x1c')]+_0x528575[_0xa292('0x1e')];var _0x1d2fd7;if(_0x35d8a5>=_0x39bba0){_0x35d8a5=_0x39bba0;_0x1d2fd7=0xc8;}else{_0x1d2fd7=0xce;}_0x1b543e[_0xa292('0x1f')](_0x1d2fd7);return _0x1b543e[_0xa292('0x20')](_0xa292('0x21'),_0x58de0d+'-'+_0x35d8a5+'/'+_0x39bba0)[_0xa292('0x1b')](_0x2ac0a9);}return null;};}function patchUpdates(_0x3623af){return function(_0x42ccdd){try{jsonpatch['apply'](_0x42ccdd,_0x3623af,!![]);}catch(_0x263b4b){return BPromise[_0xa292('0x22')](_0x263b4b);}return _0x42ccdd[_0xa292('0x23')]();};}function saveUpdates(_0x12ad6a,_0x284689){return function(_0x4fcd6c){if(_0x4fcd6c){return _0x4fcd6c['update'](_0x12ad6a)['then'](function(_0x1b68e7){return _0x1b68e7;});}return null;};}function removeEntity(_0x5eb791,_0x2bb402){return function(_0x1eaee4){if(_0x1eaee4){return _0x1eaee4[_0xa292('0x24')]()[_0xa292('0x25')](function(){_0x5eb791[_0xa292('0x1f')](0xcc)[_0xa292('0x1a')]();});}};}function handleEntityNotFound(_0x4e7009,_0x2ebda8){return function(_0xd4fd83){if(!_0xd4fd83){_0x4e7009['sendStatus'](0x194);}return _0xd4fd83;};}function handleError(_0x5cbb22,_0x225a45){_0x225a45=_0x225a45||0x1f4;return function(_0x5e9f6d){logger[_0xa292('0x26')](_0x5e9f6d['stack']);if(_0x5e9f6d[_0xa292('0x27')]){delete _0x5e9f6d[_0xa292('0x27')];}_0x5cbb22[_0xa292('0x1f')](_0x225a45)[_0xa292('0x28')](_0x5e9f6d);};}exports[_0xa292('0x29')]=function(_0x17664c,_0x5826d3){var _0x34ac6c={},_0x240b5a={},_0x1d8435={'count':0x0,'rows':[]};var _0xd6f9e6=_['map'](db[_0xa292('0x2a')][_0xa292('0x2b')],function(_0x254105){return{'name':_0x254105[_0xa292('0x2c')],'type':_0x254105[_0xa292('0x2d')][_0xa292('0x2e')]};});_0x240b5a[_0xa292('0x2f')]=_[_0xa292('0x30')](_0xd6f9e6,'name');_0x240b5a['query']=_[_0xa292('0x31')](_0x17664c[_0xa292('0x32')]);_0x240b5a[_0xa292('0x33')]=_[_0xa292('0x34')](_0x240b5a[_0xa292('0x2f')],_0x240b5a['query']);_0x34ac6c['attributes']=_[_0xa292('0x34')](_0x240b5a[_0xa292('0x2f')],qs[_0xa292('0x35')](_0x17664c[_0xa292('0x32')][_0xa292('0x35')]));_0x34ac6c[_0xa292('0x36')]=_0x34ac6c['attributes'][_0xa292('0x37')]?_0x34ac6c[_0xa292('0x36')]:_0x240b5a[_0xa292('0x2f')];if(!_0x17664c['query'][_0xa292('0x38')](_0xa292('0x39'))){_0x34ac6c[_0xa292('0x1e')]=qs['limit'](_0x17664c[_0xa292('0x32')]['limit']);_0x34ac6c['offset']=qs[_0xa292('0x1c')](_0x17664c[_0xa292('0x32')][_0xa292('0x1c')]);}_0x34ac6c['order']=qs[_0xa292('0x3a')](_0x17664c[_0xa292('0x32')]['sort']);_0x34ac6c[_0xa292('0x3b')]=qs[_0xa292('0x33')](_[_0xa292('0x3c')](_0x17664c[_0xa292('0x32')],_0x240b5a[_0xa292('0x33')]),_0xd6f9e6);if(_0x17664c[_0xa292('0x32')][_0xa292('0x3d')]){_0x34ac6c[_0xa292('0x3b')]=_[_0xa292('0x3e')](_0x34ac6c['where'],{'$or':_['map'](_0xd6f9e6,function(_0x23bdfc){if(_0x23bdfc['type']!==_0xa292('0x3f')){var _0x3519f6={};_0x3519f6[_0x23bdfc[_0xa292('0x27')]]={'$like':'%'+_0x17664c[_0xa292('0x32')]['filter']+'%'};return _0x3519f6;}})});}_0x34ac6c=_['merge']({},_0x34ac6c,_0x17664c[_0xa292('0x40')]);var _0x4f7b91={'where':_0x34ac6c[_0xa292('0x3b')]};return db[_0xa292('0x2a')][_0xa292('0x41')](_0x4f7b91)[_0xa292('0x25')](function(_0x3d2367){_0x1d8435[_0xa292('0x41')]=_0x3d2367;if(_0x17664c[_0xa292('0x32')][_0xa292('0x42')]){_0x34ac6c[_0xa292('0x43')]=[{'all':!![]}];}return db[_0xa292('0x2a')]['findAll'](_0x34ac6c);})['then'](function(_0xe90ef8){_0x1d8435[_0xa292('0x44')]=_0xe90ef8;return _0x1d8435;})[_0xa292('0x25')](respondWithFilteredResult(_0x5826d3,_0x34ac6c))[_0xa292('0x45')](handleError(_0x5826d3,null));};exports[_0xa292('0x46')]=function(_0x2c7492,_0x38eb4c){var _0x727402={'raw':![],'where':{'id':_0x2c7492[_0xa292('0x47')]['id']}},_0x97fd4c={};_0x97fd4c[_0xa292('0x2f')]=_[_0xa292('0x31')](db['ServicenowConfiguration']['rawAttributes']);_0x97fd4c[_0xa292('0x32')]=_[_0xa292('0x31')](_0x2c7492[_0xa292('0x32')]);_0x97fd4c[_0xa292('0x33')]=_[_0xa292('0x34')](_0x97fd4c[_0xa292('0x2f')],_0x97fd4c[_0xa292('0x32')]);_0x727402[_0xa292('0x36')]=_[_0xa292('0x34')](_0x97fd4c['model'],qs[_0xa292('0x35')](_0x2c7492['query'][_0xa292('0x35')]));_0x727402['attributes']=_0x727402[_0xa292('0x36')]['length']?_0x727402[_0xa292('0x36')]:_0x97fd4c[_0xa292('0x2f')];if(_0x2c7492[_0xa292('0x32')][_0xa292('0x42')]){_0x727402['include']=[{'all':!![]}];}_0x727402=_[_0xa292('0x3e')]({},_0x727402,_0x2c7492[_0xa292('0x40')]);return db['ServicenowConfiguration']['find'](_0x727402)[_0xa292('0x25')](handleEntityNotFound(_0x38eb4c,null))['then'](respondWithResult(_0x38eb4c,null))['catch'](handleError(_0x38eb4c,null));};exports[_0xa292('0x48')]=function(_0x386727,_0x17d1cc){return db[_0xa292('0x2a')][_0xa292('0x48')](_0x386727[_0xa292('0x49')],{})[_0xa292('0x25')](respondWithResult(_0x17d1cc,0xc9))[_0xa292('0x45')](handleError(_0x17d1cc,null));};exports['update']=function(_0x2a8d3f,_0x18ede5){if(_0x2a8d3f['body']['id']){delete _0x2a8d3f[_0xa292('0x49')]['id'];}return db['ServicenowConfiguration'][_0xa292('0x4a')]({'where':{'id':_0x2a8d3f['params']['id']}})[_0xa292('0x25')](handleEntityNotFound(_0x18ede5,null))[_0xa292('0x25')](saveUpdates(_0x2a8d3f[_0xa292('0x49')],null))[_0xa292('0x25')](respondWithResult(_0x18ede5,null))[_0xa292('0x45')](handleError(_0x18ede5,null));};exports[_0xa292('0x24')]=function(_0x25724a,_0x406d21){return db[_0xa292('0x2a')]['find']({'where':{'id':_0x25724a[_0xa292('0x47')]['id']}})['then'](handleEntityNotFound(_0x406d21,null))['then'](removeEntity(_0x406d21,null))[_0xa292('0x45')](handleError(_0x406d21,null));};exports[_0xa292('0x4b')]=function(_0x48b95c,_0x560326,_0x560bf6){var _0x33d092={};var _0x415e21={};var _0x8bd59c;var _0x5768db;return db[_0xa292('0x2a')][_0xa292('0x4c')]({'where':{'id':_0x48b95c['params']['id']}})[_0xa292('0x25')](handleEntityNotFound(_0x560326,null))[_0xa292('0x25')](function(_0x283768){if(_0x283768){_0x8bd59c=_0x283768;_0x415e21[_0xa292('0x2f')]=_[_0xa292('0x31')](db[_0xa292('0x4d')][_0xa292('0x2b')]);_0x415e21[_0xa292('0x32')]=_['keys'](_0x48b95c[_0xa292('0x32')]);_0x415e21[_0xa292('0x33')]=_[_0xa292('0x34')](_0x415e21[_0xa292('0x2f')],_0x415e21[_0xa292('0x32')]);_0x33d092[_0xa292('0x36')]=_[_0xa292('0x34')](_0x415e21[_0xa292('0x2f')],qs[_0xa292('0x35')](_0x48b95c['query']['fields']));_0x33d092['attributes']=_0x33d092[_0xa292('0x36')][_0xa292('0x37')]?_0x33d092['attributes']:_0x415e21[_0xa292('0x2f')];_0x33d092[_0xa292('0x4e')]=qs['sort'](_0x48b95c['query'][_0xa292('0x3a')]);_0x33d092[_0xa292('0x3b')]=qs[_0xa292('0x33')](_[_0xa292('0x3c')](_0x48b95c['query'],_0x415e21[_0xa292('0x33')]));if(_0x48b95c[_0xa292('0x32')][_0xa292('0x3d')]){_0x33d092[_0xa292('0x3b')]=_['merge'](_0x33d092[_0xa292('0x3b')],{'$or':_[_0xa292('0x30')](_0x33d092[_0xa292('0x36')],function(_0x24ad79){var _0x452cad={};_0x452cad[_0x24ad79]={'$like':'%'+_0x48b95c[_0xa292('0x32')][_0xa292('0x3d')]+'%'};return _0x452cad;})});}_0x33d092=_[_0xa292('0x3e')]({},_0x33d092,_0x48b95c[_0xa292('0x40')]);return _0x8bd59c[_0xa292('0x4b')](_0x33d092);}})[_0xa292('0x25')](function(_0x5013e2){if(_0x5013e2){_0x5768db=_0x5013e2[_0xa292('0x37')];if(!_0x48b95c[_0xa292('0x32')][_0xa292('0x38')](_0xa292('0x39'))){_0x33d092[_0xa292('0x1e')]=qs[_0xa292('0x1e')](_0x48b95c[_0xa292('0x32')][_0xa292('0x1e')]);_0x33d092[_0xa292('0x1c')]=qs['offset'](_0x48b95c[_0xa292('0x32')][_0xa292('0x1c')]);}return _0x8bd59c['getFields'](_0x33d092);}})[_0xa292('0x25')](function(_0x30eff1){if(_0x30eff1){return _0x30eff1?{'count':_0x5768db,'rows':_0x30eff1}:null;}})[_0xa292('0x25')](respondWithResult(_0x560326,null))[_0xa292('0x45')](handleError(_0x560326,null));};exports['getSubjects']=function(_0x233850,_0x226e64,_0x1fe290){var _0x39e294={};var _0x45eef3={};var _0x21b84e;var _0x8b41ef;return db[_0xa292('0x2a')][_0xa292('0x4c')]({'where':{'id':_0x233850[_0xa292('0x47')]['id']}})[_0xa292('0x25')](handleEntityNotFound(_0x226e64,null))[_0xa292('0x25')](function(_0x323951){if(_0x323951){_0x21b84e=_0x323951;_0x45eef3[_0xa292('0x2f')]=_[_0xa292('0x31')](db[_0xa292('0x4d')][_0xa292('0x2b')]);_0x45eef3[_0xa292('0x32')]=_[_0xa292('0x31')](_0x233850[_0xa292('0x32')]);_0x45eef3[_0xa292('0x33')]=_['intersection'](_0x45eef3[_0xa292('0x2f')],_0x45eef3[_0xa292('0x32')]);_0x39e294[_0xa292('0x36')]=_[_0xa292('0x34')](_0x45eef3['model'],qs[_0xa292('0x35')](_0x233850[_0xa292('0x32')]['fields']));_0x39e294[_0xa292('0x36')]=_0x39e294['attributes']['length']?_0x39e294[_0xa292('0x36')]:_0x45eef3[_0xa292('0x2f')];_0x39e294[_0xa292('0x4e')]=qs[_0xa292('0x3a')](_0x233850[_0xa292('0x32')][_0xa292('0x3a')]);_0x39e294[_0xa292('0x3b')]=qs[_0xa292('0x33')](_[_0xa292('0x3c')](_0x233850[_0xa292('0x32')],_0x45eef3[_0xa292('0x33')]));if(_0x233850[_0xa292('0x32')][_0xa292('0x3d')]){_0x39e294[_0xa292('0x3b')]=_[_0xa292('0x3e')](_0x39e294[_0xa292('0x3b')],{'$or':_[_0xa292('0x30')](_0x39e294[_0xa292('0x36')],function(_0x5e5587){var _0x4b12dd={};_0x4b12dd[_0x5e5587]={'$like':'%'+_0x233850['query'][_0xa292('0x3d')]+'%'};return _0x4b12dd;})});}_0x39e294=_['merge']({},_0x39e294,_0x233850[_0xa292('0x40')]);return _0x21b84e[_0xa292('0x4f')](_0x39e294);}})['then'](function(_0x312157){if(_0x312157){_0x8b41ef=_0x312157[_0xa292('0x37')];if(!_0x233850[_0xa292('0x32')][_0xa292('0x38')](_0xa292('0x39'))){_0x39e294['limit']=qs[_0xa292('0x1e')](_0x233850[_0xa292('0x32')][_0xa292('0x1e')]);_0x39e294['offset']=qs['offset'](_0x233850['query']['offset']);}return _0x21b84e['getSubjects'](_0x39e294);}})[_0xa292('0x25')](function(_0x22bb44){if(_0x22bb44){return _0x22bb44?{'count':_0x8b41ef,'rows':_0x22bb44}:null;}})[_0xa292('0x25')](respondWithResult(_0x226e64,null))['catch'](handleError(_0x226e64,null));};exports[_0xa292('0x50')]=function(_0x2f57f9,_0x51ec10,_0x323495){var _0x37e56c={};var _0x30c699={};var _0x50f99d;var _0x26895f;return db[_0xa292('0x2a')][_0xa292('0x4c')]({'where':{'id':_0x2f57f9['params']['id']}})['then'](handleEntityNotFound(_0x51ec10,null))[_0xa292('0x25')](function(_0x412760){if(_0x412760){_0x50f99d=_0x412760;_0x30c699['model']=_['keys'](db[_0xa292('0x4d')][_0xa292('0x2b')]);_0x30c699[_0xa292('0x32')]=_[_0xa292('0x31')](_0x2f57f9[_0xa292('0x32')]);_0x30c699['filters']=_[_0xa292('0x34')](_0x30c699['model'],_0x30c699[_0xa292('0x32')]);_0x37e56c[_0xa292('0x36')]=_[_0xa292('0x34')](_0x30c699[_0xa292('0x2f')],qs[_0xa292('0x35')](_0x2f57f9[_0xa292('0x32')]['fields']));_0x37e56c[_0xa292('0x36')]=_0x37e56c[_0xa292('0x36')]['length']?_0x37e56c[_0xa292('0x36')]:_0x30c699['model'];_0x37e56c['order']=qs[_0xa292('0x3a')](_0x2f57f9['query'][_0xa292('0x3a')]);_0x37e56c['where']=qs[_0xa292('0x33')](_[_0xa292('0x3c')](_0x2f57f9[_0xa292('0x32')],_0x30c699[_0xa292('0x33')]));if(_0x2f57f9[_0xa292('0x32')][_0xa292('0x3d')]){_0x37e56c[_0xa292('0x3b')]=_[_0xa292('0x3e')](_0x37e56c[_0xa292('0x3b')],{'$or':_['map'](_0x37e56c[_0xa292('0x36')],function(_0x3e41dd){var _0x159146={};_0x159146[_0x3e41dd]={'$like':'%'+_0x2f57f9[_0xa292('0x32')][_0xa292('0x3d')]+'%'};return _0x159146;})});}_0x37e56c=_[_0xa292('0x3e')]({},_0x37e56c,_0x2f57f9[_0xa292('0x40')]);return _0x50f99d[_0xa292('0x50')](_0x37e56c);}})[_0xa292('0x25')](function(_0x2ea4db){if(_0x2ea4db){_0x26895f=_0x2ea4db[_0xa292('0x37')];if(!_0x2f57f9[_0xa292('0x32')][_0xa292('0x38')](_0xa292('0x39'))){_0x37e56c[_0xa292('0x1e')]=qs['limit'](_0x2f57f9[_0xa292('0x32')][_0xa292('0x1e')]);_0x37e56c['offset']=qs[_0xa292('0x1c')](_0x2f57f9[_0xa292('0x32')][_0xa292('0x1c')]);}return _0x50f99d['getDescriptions'](_0x37e56c);}})['then'](function(_0x17fcb1){if(_0x17fcb1){return _0x17fcb1?{'count':_0x26895f,'rows':_0x17fcb1}:null;}})[_0xa292('0x25')](respondWithResult(_0x51ec10,null))[_0xa292('0x45')](handleError(_0x51ec10,null));}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js index dfff144..fa35f00 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 _0x61d0=['rimraf','./intServicenowConfiguration.attributes','exports','define','ServicenowConfiguration','int_servicenow_configurations','lodash','../../config/logger','api','bluebird','path'];(function(_0xe30e17,_0xce02be){var _0x2342c9=function(_0x20b733){while(--_0x20b733){_0xe30e17['push'](_0xe30e17['shift']());}};_0x2342c9(++_0xce02be);}(_0x61d0,0x187));var _0x061d=function(_0x34232c,_0x18e61d){_0x34232c=_0x34232c-0x0;var _0x4d4f4e=_0x61d0[_0x34232c];return _0x4d4f4e;};'use strict';var _=require(_0x061d('0x0'));var util=require('util');var logger=require(_0x061d('0x1'))(_0x061d('0x2'));var moment=require('moment');var BPromise=require(_0x061d('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x061d('0x4'));var rimraf=require(_0x061d('0x5'));var config=require('../../config/environment');var attributes=require(_0x061d('0x6'));module[_0x061d('0x7')]=function(_0x14e976,_0x255478){return _0x14e976[_0x061d('0x8')](_0x061d('0x9'),attributes,{'tableName':_0x061d('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x723c=['util','../../config/logger','moment','request-promise','path','rimraf','../../config/environment','./intServicenowConfiguration.attributes','exports','define','ServicenowConfiguration'];(function(_0xbc3542,_0x4de021){var _0x1c88ff=function(_0x1d1fb4){while(--_0x1d1fb4){_0xbc3542['push'](_0xbc3542['shift']());}};_0x1c88ff(++_0x4de021);}(_0x723c,0x1ad));var _0xc723=function(_0xdf6e01,_0x12dc0e){_0xdf6e01=_0xdf6e01-0x0;var _0x18b170=_0x723c[_0xdf6e01];return _0x18b170;};'use strict';var _=require('lodash');var util=require(_0xc723('0x0'));var logger=require(_0xc723('0x1'))('api');var moment=require(_0xc723('0x2'));var BPromise=require('bluebird');var rp=require(_0xc723('0x3'));var fs=require('fs');var path=require(_0xc723('0x4'));var rimraf=require(_0xc723('0x5'));var config=require(_0xc723('0x6'));var attributes=require(_0xc723('0x7'));module[_0xc723('0x8')]=function(_0xa08b3,_0x4eb5ff){return _0xa08b3[_0xc723('0x9')](_0xc723('0xa'),attributes,{'tableName':'int_servicenow_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.rpc.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.rpc.js index a35195b..c2e1012 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 _0x95fe=['randomstring','ioredis','../../config/logger','../../config/environment','client','http','request\x20sent','debug','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','ServicenowConfiguration,\x20%s,\x20%s','message','info','result','catch','util','moment'];(function(_0x32506f,_0x373192){var _0x1e6b33=function(_0x473209){while(--_0x473209){_0x32506f['push'](_0x32506f['shift']());}};_0x1e6b33(++_0x373192);}(_0x95fe,0x154));var _0xe95f=function(_0x3dd972,_0x46dd84){_0x3dd972=_0x3dd972-0x0;var _0x3800e0=_0x95fe[_0x3dd972];return _0x3800e0;};'use strict';var _=require('lodash');var util=require(_0xe95f('0x0'));var moment=require(_0xe95f('0x1'));var BPromise=require('bluebird');var rs=require(_0xe95f('0x2'));var fs=require('fs');var Redis=require(_0xe95f('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xe95f('0x4'))('rpc');var config=require(_0xe95f('0x5'));var jayson=require('jayson/promise');var client=jayson[_0xe95f('0x6')][_0xe95f('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x1f709b,_0x571d5c,_0x2123a4){return new BPromise(function(_0x81b820,_0x502426){return client['request'](_0x1f709b,_0x2123a4)['then'](function(_0x247b3d){logger['info']('ServicenowConfiguration,\x20%s,\x20%s',_0x571d5c,_0xe95f('0x8'));logger[_0xe95f('0x9')](_0xe95f('0xa'),_0x571d5c,_0xe95f('0x8'),JSON[_0xe95f('0xb')](_0x247b3d));if(_0x247b3d[_0xe95f('0xc')]){if(_0x247b3d['error'][_0xe95f('0xd')]===0x1f4){logger[_0xe95f('0xc')](_0xe95f('0xe'),_0x571d5c,_0x247b3d[_0xe95f('0xc')][_0xe95f('0xf')]);return _0x502426(_0x247b3d[_0xe95f('0xc')][_0xe95f('0xf')]);}logger['error'](_0xe95f('0xe'),_0x571d5c,_0x247b3d[_0xe95f('0xc')][_0xe95f('0xf')]);return _0x81b820(_0x247b3d[_0xe95f('0xc')][_0xe95f('0xf')]);}else{logger[_0xe95f('0x10')](_0xe95f('0xe'),_0x571d5c,'request\x20sent');_0x81b820(_0x247b3d[_0xe95f('0x11')][_0xe95f('0xf')]);}})[_0xe95f('0x12')](function(_0xfa05dc){logger[_0xe95f('0xc')](_0xe95f('0xe'),_0x571d5c,_0xfa05dc);_0x502426(_0xfa05dc);});});} \ No newline at end of file +var _0x5f43=['ServicenowConfiguration,\x20%s,\x20%s','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','lodash','util','moment','randomstring','../../config/utils','../../config/logger','../../config/environment','client','http','request','then','info'];(function(_0x1ec100,_0x4d46b0){var _0x3ed9f4=function(_0xea9408){while(--_0xea9408){_0x1ec100['push'](_0x1ec100['shift']());}};_0x3ed9f4(++_0x4d46b0);}(_0x5f43,0xe4));var _0x35f4=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5f43[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x35f4('0x0'));var util=require(_0x35f4('0x1'));var moment=require(_0x35f4('0x2'));var BPromise=require('bluebird');var rs=require(_0x35f4('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x35f4('0x4'));var logger=require(_0x35f4('0x5'))('rpc');var config=require(_0x35f4('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x35f4('0x7')][_0x35f4('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4ef6fc,_0x56a2ee,_0x1fcd56){return new BPromise(function(_0x1b378b,_0x5e405b){return client[_0x35f4('0x9')](_0x4ef6fc,_0x1fcd56)[_0x35f4('0xa')](function(_0x1530e6){logger[_0x35f4('0xb')](_0x35f4('0xc'),_0x56a2ee,'request\x20sent');logger['debug'](_0x35f4('0xd'),_0x56a2ee,_0x35f4('0xe'),JSON['stringify'](_0x1530e6));if(_0x1530e6[_0x35f4('0xf')]){if(_0x1530e6['error'][_0x35f4('0x10')]===0x1f4){logger[_0x35f4('0xf')](_0x35f4('0xc'),_0x56a2ee,_0x1530e6[_0x35f4('0xf')]['message']);return _0x5e405b(_0x1530e6[_0x35f4('0xf')][_0x35f4('0x11')]);}logger[_0x35f4('0xf')](_0x35f4('0xc'),_0x56a2ee,_0x1530e6[_0x35f4('0xf')][_0x35f4('0x11')]);return _0x1b378b(_0x1530e6[_0x35f4('0xf')][_0x35f4('0x11')]);}else{logger[_0x35f4('0xb')](_0x35f4('0xc'),_0x56a2ee,_0x35f4('0xe'));_0x1b378b(_0x1530e6[_0x35f4('0x12')][_0x35f4('0x11')]);}})[_0x35f4('0x13')](function(_0x127ba1){logger['error'](_0x35f4('0xc'),_0x56a2ee,_0x127ba1);_0x5e405b(_0x127ba1);});});} \ No newline at end of file diff --git a/server/api/intServicenowField/index.js b/server/api/intServicenowField/index.js index 601f9dc..1bebf7d 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 _0x0961=['/:id','isAuthenticated','show','post','put','update','delete','destroy','exports','multer','fs-extra','../../components/auth/service','../../config/environment','./intServicenowField.controller','get'];(function(_0x24ce7d,_0x53c2b2){var _0x445c5d=function(_0x51ec09){while(--_0x51ec09){_0x24ce7d['push'](_0x24ce7d['shift']());}};_0x445c5d(++_0x53c2b2);}(_0x0961,0x81));var _0x1096=function(_0x2deac4,_0xc27a2b){_0x2deac4=_0x2deac4-0x0;var _0x1c0bda=_0x0961[_0x2deac4];return _0x1c0bda;};'use strict';var multer=require(_0x1096('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x1096('0x1'));var auth=require(_0x1096('0x2'));var interaction=require('../../components/interaction/service');var config=require(_0x1096('0x3'));var controller=require(_0x1096('0x4'));router[_0x1096('0x5')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x1096('0x6'),auth[_0x1096('0x7')](),controller[_0x1096('0x8')]);router[_0x1096('0x9')]('/',auth[_0x1096('0x7')](),controller['create']);router[_0x1096('0xa')]('/:id',auth[_0x1096('0x7')](),controller[_0x1096('0xb')]);router[_0x1096('0xc')](_0x1096('0x6'),auth['isAuthenticated'](),controller[_0x1096('0xd')]);module[_0x1096('0xe')]=router; \ No newline at end of file +var _0x3ea2=['update','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intServicenowField.controller','isAuthenticated','index','get','/:id','show','post','create','put'];(function(_0x50aa4f,_0x5e4caa){var _0x2fe613=function(_0x2e2a7f){while(--_0x2e2a7f){_0x50aa4f['push'](_0x50aa4f['shift']());}};_0x2fe613(++_0x5e4caa);}(_0x3ea2,0x17d));var _0x23ea=function(_0x1d760b,_0x47f9fe){_0x1d760b=_0x1d760b-0x0;var _0x18fb17=_0x3ea2[_0x1d760b];return _0x18fb17;};'use strict';var multer=require(_0x23ea('0x0'));var util=require(_0x23ea('0x1'));var path=require(_0x23ea('0x2'));var timeout=require(_0x23ea('0x3'));var express=require(_0x23ea('0x4'));var router=express[_0x23ea('0x5')]();var fs_extra=require(_0x23ea('0x6'));var auth=require(_0x23ea('0x7'));var interaction=require(_0x23ea('0x8'));var config=require('../../config/environment');var controller=require(_0x23ea('0x9'));router['get']('/',auth[_0x23ea('0xa')](),controller[_0x23ea('0xb')]);router[_0x23ea('0xc')](_0x23ea('0xd'),auth[_0x23ea('0xa')](),controller[_0x23ea('0xe')]);router[_0x23ea('0xf')]('/',auth[_0x23ea('0xa')](),controller[_0x23ea('0x10')]);router[_0x23ea('0x11')](_0x23ea('0xd'),auth[_0x23ea('0xa')](),controller[_0x23ea('0x12')]);router[_0x23ea('0x13')]('/:id',auth[_0x23ea('0xa')](),controller[_0x23ea('0x14')]);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 4fa1c14..620e5f8 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 _0xfcda=['customVariable','keyValue','picklist','string','STRING','BOOLEAN','sequelize','exports','ENUM','variable'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xfcda,0x100));var _0xafcd=function(_0x1ddb40,_0x2966c8){_0x1ddb40=_0x1ddb40-0x0;var _0x508db9=_0xfcda[_0x1ddb40];return _0x508db9;};'use strict';var Sequelize=require(_0xafcd('0x0'));module[_0xafcd('0x1')]={'type':{'type':Sequelize[_0xafcd('0x2')]('string',_0xafcd('0x3'),_0xafcd('0x4'),_0xafcd('0x5'),_0xafcd('0x6')),'defaultValue':_0xafcd('0x7')},'content':{'type':Sequelize[_0xafcd('0x8')]},'key':{'type':Sequelize[_0xafcd('0x8')]},'keyType':{'type':Sequelize[_0xafcd('0x2')](_0xafcd('0x7'),_0xafcd('0x3'),_0xafcd('0x4'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0xafcd('0x8')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0xafcd('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xafcd('0x8')]}}; \ No newline at end of file +var _0x04bc=['customVariable','picklist','string','STRING','variable','BOOLEAN','sequelize','exports','ENUM'];(function(_0x428497,_0xece53d){var _0x3c971c=function(_0x487411){while(--_0x487411){_0x428497['push'](_0x428497['shift']());}};_0x3c971c(++_0xece53d);}(_0x04bc,0xba));var _0xc04b=function(_0x3d02d1,_0x2b0c86){_0x3d02d1=_0x3d02d1-0x0;var _0x4633d1=_0x04bc[_0x3d02d1];return _0x4633d1;};'use strict';var Sequelize=require(_0xc04b('0x0'));module[_0xc04b('0x1')]={'type':{'type':Sequelize[_0xc04b('0x2')]('string','variable',_0xc04b('0x3'),'keyValue',_0xc04b('0x4')),'defaultValue':_0xc04b('0x5')},'content':{'type':Sequelize[_0xc04b('0x6')]},'key':{'type':Sequelize[_0xc04b('0x6')]},'keyType':{'type':Sequelize[_0xc04b('0x2')](_0xc04b('0x5'),_0xc04b('0x7'),'customVariable')},'keyContent':{'type':Sequelize[_0xc04b('0x6')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0xc04b('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xc04b('0x6')]}}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.controller.js b/server/api/intServicenowField/intServicenowField.controller.js index 53fd0ec..89abb18 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 _0xa16d=['update','body','destroy','eml-format','zip-dir','fast-json-patch','moment','bluebird','util','path','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','then','error','stack','name','index','map','ServicenowField','rawAttributes','fieldName','type','key','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','pick','filter','where','merge','VIRTUAL','options','include','findAll','rows','catch','params','keys','find','create'];(function(_0x2330f3,_0x465d50){var _0x472b15=function(_0x5853b9){while(--_0x5853b9){_0x2330f3['push'](_0x2330f3['shift']());}};_0x472b15(++_0x465d50);}(_0xa16d,0x95));var _0xda16=function(_0x1928c9,_0x13a6d1){_0x1928c9=_0x1928c9-0x0;var _0x51b5fb=_0xa16d[_0x1928c9];return _0x51b5fb;};'use strict';var emlformat=require(_0xda16('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xda16('0x1'));var jsonpatch=require(_0xda16('0x2'));var rp=require('request-promise');var moment=require(_0xda16('0x3'));var BPromise=require(_0xda16('0x4'));var Mustache=require('mustache');var util=require(_0xda16('0x5'));var path=require(_0xda16('0x6'));var sox=require('sox');var csv=require(_0xda16('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xda16('0x8'));var _=require(_0xda16('0x9'));var squel=require(_0xda16('0xa'));var crypto=require(_0xda16('0xb'));var jsforce=require(_0xda16('0xc'));var deskjs=require(_0xda16('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xda16('0xe'));var Redis=require('ioredis');var authService=require(_0xda16('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xda16('0x10'));var logger=require(_0xda16('0x11'))(_0xda16('0x12'));var utils=require(_0xda16('0x13'));var config=require(_0xda16('0x14'));var licenseUtil=require(_0xda16('0x15'));var db=require(_0xda16('0x16'))['db'];function respondWithStatusCode(_0x429e1c,_0x131f08){_0x131f08=_0x131f08||0xcc;return function(_0x92f1e8){if(_0x92f1e8){return _0x429e1c[_0xda16('0x17')](_0x131f08);}return _0x429e1c[_0xda16('0x18')](_0x131f08)[_0xda16('0x19')]();};}function respondWithResult(_0x5d2fdd,_0x319e13){_0x319e13=_0x319e13||0xc8;return function(_0x1d8c80){if(_0x1d8c80){return _0x5d2fdd['status'](_0x319e13)[_0xda16('0x1a')](_0x1d8c80);}};}function respondWithFilteredResult(_0x190991,_0x162cda){return function(_0x127af2){if(_0x127af2){var _0x5e152e=typeof _0x162cda[_0xda16('0x1b')]===_0xda16('0x1c')&&typeof _0x162cda[_0xda16('0x1d')]===_0xda16('0x1c');var _0x4370ee=_0x127af2[_0xda16('0x1e')];var _0x231b63=_0x5e152e?0x0:_0x162cda[_0xda16('0x1b')];var _0x4c24dd=_0x5e152e?_0x127af2[_0xda16('0x1e')]:_0x162cda[_0xda16('0x1b')]+_0x162cda[_0xda16('0x1d')];var _0x466592;if(_0x4c24dd>=_0x4370ee){_0x4c24dd=_0x4370ee;_0x466592=0xc8;}else{_0x466592=0xce;}_0x190991['status'](_0x466592);return _0x190991[_0xda16('0x1f')](_0xda16('0x20'),_0x231b63+'-'+_0x4c24dd+'/'+_0x4370ee)['json'](_0x127af2);}return null;};}function patchUpdates(_0x1a89b1){return function(_0xc157d8){try{jsonpatch['apply'](_0xc157d8,_0x1a89b1,!![]);}catch(_0x146509){return BPromise[_0xda16('0x21')](_0x146509);}return _0xc157d8[_0xda16('0x22')]();};}function saveUpdates(_0x185e17,_0x37523b){return function(_0x430881){if(_0x430881){return _0x430881['update'](_0x185e17)[_0xda16('0x23')](function(_0x57ecff){return _0x57ecff;});}return null;};}function removeEntity(_0x2e4176,_0x2fb9dd){return function(_0xaa1570){if(_0xaa1570){return _0xaa1570['destroy']()[_0xda16('0x23')](function(){_0x2e4176[_0xda16('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x225300,_0x380278){return function(_0x169de4){if(!_0x169de4){_0x225300[_0xda16('0x17')](0x194);}return _0x169de4;};}function handleError(_0x46a7e9,_0x574c64){_0x574c64=_0x574c64||0x1f4;return function(_0x18f972){logger[_0xda16('0x24')](_0x18f972[_0xda16('0x25')]);if(_0x18f972[_0xda16('0x26')]){delete _0x18f972['name'];}_0x46a7e9['status'](_0x574c64)['send'](_0x18f972);};}exports[_0xda16('0x27')]=function(_0x3ffd5a,_0x47a6a7){var _0x1a047a={},_0x258487={},_0xdf1f7b={'count':0x0,'rows':[]};var _0x3469bc=_[_0xda16('0x28')](db[_0xda16('0x29')][_0xda16('0x2a')],function(_0x558709){return{'name':_0x558709[_0xda16('0x2b')],'type':_0x558709[_0xda16('0x2c')][_0xda16('0x2d')]};});_0x258487['model']=_[_0xda16('0x28')](_0x3469bc,_0xda16('0x26'));_0x258487['query']=_['keys'](_0x3ffd5a[_0xda16('0x2e')]);_0x258487[_0xda16('0x2f')]=_[_0xda16('0x30')](_0x258487[_0xda16('0x31')],_0x258487[_0xda16('0x2e')]);_0x1a047a[_0xda16('0x32')]=_['intersection'](_0x258487[_0xda16('0x31')],qs[_0xda16('0x33')](_0x3ffd5a[_0xda16('0x2e')]['fields']));_0x1a047a[_0xda16('0x32')]=_0x1a047a[_0xda16('0x32')][_0xda16('0x34')]?_0x1a047a[_0xda16('0x32')]:_0x258487[_0xda16('0x31')];if(!_0x3ffd5a[_0xda16('0x2e')][_0xda16('0x35')]('nolimit')){_0x1a047a[_0xda16('0x1d')]=qs[_0xda16('0x1d')](_0x3ffd5a[_0xda16('0x2e')]['limit']);_0x1a047a[_0xda16('0x1b')]=qs[_0xda16('0x1b')](_0x3ffd5a[_0xda16('0x2e')][_0xda16('0x1b')]);}_0x1a047a[_0xda16('0x36')]=qs['sort'](_0x3ffd5a[_0xda16('0x2e')][_0xda16('0x37')]);_0x1a047a['where']=qs['filters'](_[_0xda16('0x38')](_0x3ffd5a[_0xda16('0x2e')],_0x258487[_0xda16('0x2f')]),_0x3469bc);if(_0x3ffd5a['query'][_0xda16('0x39')]){_0x1a047a[_0xda16('0x3a')]=_[_0xda16('0x3b')](_0x1a047a[_0xda16('0x3a')],{'$or':_['map'](_0x3469bc,function(_0x1574ac){if(_0x1574ac['type']!==_0xda16('0x3c')){var _0x3bc2a5={};_0x3bc2a5[_0x1574ac[_0xda16('0x26')]]={'$like':'%'+_0x3ffd5a['query'][_0xda16('0x39')]+'%'};return _0x3bc2a5;}})});}_0x1a047a=_['merge']({},_0x1a047a,_0x3ffd5a[_0xda16('0x3d')]);var _0x113397={'where':_0x1a047a['where']};return db['ServicenowField']['count'](_0x113397)[_0xda16('0x23')](function(_0x283e96){_0xdf1f7b[_0xda16('0x1e')]=_0x283e96;if(_0x3ffd5a[_0xda16('0x2e')]['includeAll']){_0x1a047a[_0xda16('0x3e')]=[{'all':!![]}];}return db['ServicenowField'][_0xda16('0x3f')](_0x1a047a);})[_0xda16('0x23')](function(_0x16427a){_0xdf1f7b[_0xda16('0x40')]=_0x16427a;return _0xdf1f7b;})[_0xda16('0x23')](respondWithFilteredResult(_0x47a6a7,_0x1a047a))[_0xda16('0x41')](handleError(_0x47a6a7,null));};exports['show']=function(_0x7cb754,_0x2861c0){var _0x15a820={'raw':!![],'where':{'id':_0x7cb754[_0xda16('0x42')]['id']}},_0x254f11={};_0x254f11[_0xda16('0x31')]=_[_0xda16('0x43')](db['ServicenowField']['rawAttributes']);_0x254f11[_0xda16('0x2e')]=_[_0xda16('0x43')](_0x7cb754['query']);_0x254f11[_0xda16('0x2f')]=_[_0xda16('0x30')](_0x254f11[_0xda16('0x31')],_0x254f11['query']);_0x15a820[_0xda16('0x32')]=_[_0xda16('0x30')](_0x254f11[_0xda16('0x31')],qs['fields'](_0x7cb754[_0xda16('0x2e')][_0xda16('0x33')]));_0x15a820[_0xda16('0x32')]=_0x15a820[_0xda16('0x32')][_0xda16('0x34')]?_0x15a820[_0xda16('0x32')]:_0x254f11[_0xda16('0x31')];if(_0x7cb754['query']['includeAll']){_0x15a820[_0xda16('0x3e')]=[{'all':!![]}];}_0x15a820=_[_0xda16('0x3b')]({},_0x15a820,_0x7cb754['options']);return db[_0xda16('0x29')][_0xda16('0x44')](_0x15a820)[_0xda16('0x23')](handleEntityNotFound(_0x2861c0,null))[_0xda16('0x23')](respondWithResult(_0x2861c0,null))[_0xda16('0x41')](handleError(_0x2861c0,null));};exports[_0xda16('0x45')]=function(_0x48cde7,_0x362148){return db[_0xda16('0x29')][_0xda16('0x45')](_0x48cde7['body'],{})[_0xda16('0x23')](respondWithResult(_0x362148,0xc9))[_0xda16('0x41')](handleError(_0x362148,null));};exports[_0xda16('0x46')]=function(_0x2c7773,_0x9fb77a){if(_0x2c7773[_0xda16('0x47')]['id']){delete _0x2c7773[_0xda16('0x47')]['id'];}return db[_0xda16('0x29')][_0xda16('0x44')]({'where':{'id':_0x2c7773[_0xda16('0x42')]['id']}})['then'](handleEntityNotFound(_0x9fb77a,null))['then'](saveUpdates(_0x2c7773[_0xda16('0x47')],null))[_0xda16('0x23')](respondWithResult(_0x9fb77a,null))[_0xda16('0x41')](handleError(_0x9fb77a,null));};exports[_0xda16('0x48')]=function(_0x12d2b4,_0x431bf4){return db[_0xda16('0x29')][_0xda16('0x44')]({'where':{'id':_0x12d2b4[_0xda16('0x42')]['id']}})[_0xda16('0x23')](handleEntityNotFound(_0x431bf4,null))['then'](removeEntity(_0x431bf4,null))[_0xda16('0x41')](handleError(_0x431bf4,null));}; \ No newline at end of file +var _0x424b=['ServicenowField','rawAttributes','key','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','type','options','count','includeAll','findAll','rows','show','keys','include','find','catch','create','body','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','undefined','limit','offset','set','Content-Range','json','apply','reject','save','update','then','destroy','end','sendStatus','stack','name','send','index'];(function(_0x568ccf,_0x55d51e){var _0x4832ff=function(_0x4b92d4){while(--_0x4b92d4){_0x568ccf['push'](_0x568ccf['shift']());}};_0x4832ff(++_0x55d51e);}(_0x424b,0x6a));var _0xb424=function(_0x50fa9a,_0x1da236){_0x50fa9a=_0x50fa9a-0x0;var _0x2bff39=_0x424b[_0x50fa9a];return _0x2bff39;};'use strict';var emlformat=require(_0xb424('0x0'));var rimraf=require(_0xb424('0x1'));var zipdir=require(_0xb424('0x2'));var jsonpatch=require(_0xb424('0x3'));var rp=require(_0xb424('0x4'));var moment=require('moment');var BPromise=require(_0xb424('0x5'));var Mustache=require(_0xb424('0x6'));var util=require('util');var path=require(_0xb424('0x7'));var sox=require('sox');var csv=require(_0xb424('0x8'));var ejs=require(_0xb424('0x9'));var fs=require('fs');var fs_extra=require(_0xb424('0xa'));var _=require(_0xb424('0xb'));var squel=require('squel');var crypto=require(_0xb424('0xc'));var jsforce=require(_0xb424('0xd'));var deskjs=require(_0xb424('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xb424('0xf'));var authService=require(_0xb424('0x10'));var qs=require(_0xb424('0x11'));var as=require(_0xb424('0x12'));var hardwareService=require(_0xb424('0x13'));var logger=require(_0xb424('0x14'))(_0xb424('0x15'));var utils=require(_0xb424('0x16'));var config=require(_0xb424('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xb424('0x18'))['db'];function respondWithStatusCode(_0x1c7cc9,_0x3c4de1){_0x3c4de1=_0x3c4de1||0xcc;return function(_0x3b1ed5){if(_0x3b1ed5){return _0x1c7cc9['sendStatus'](_0x3c4de1);}return _0x1c7cc9[_0xb424('0x19')](_0x3c4de1)['end']();};}function respondWithResult(_0x45c4e2,_0x445d5b){_0x445d5b=_0x445d5b||0xc8;return function(_0x4d85d9){if(_0x4d85d9){return _0x45c4e2[_0xb424('0x19')](_0x445d5b)['json'](_0x4d85d9);}};}function respondWithFilteredResult(_0x192a30,_0x5cfd34){return function(_0x1be19e){if(_0x1be19e){var _0xd537e9=typeof _0x5cfd34['offset']===_0xb424('0x1a')&&typeof _0x5cfd34[_0xb424('0x1b')]===_0xb424('0x1a');var _0xe4ebd8=_0x1be19e['count'];var _0x371d0a=_0xd537e9?0x0:_0x5cfd34['offset'];var _0x53e022=_0xd537e9?_0x1be19e['count']:_0x5cfd34[_0xb424('0x1c')]+_0x5cfd34[_0xb424('0x1b')];var _0x1ad032;if(_0x53e022>=_0xe4ebd8){_0x53e022=_0xe4ebd8;_0x1ad032=0xc8;}else{_0x1ad032=0xce;}_0x192a30[_0xb424('0x19')](_0x1ad032);return _0x192a30[_0xb424('0x1d')](_0xb424('0x1e'),_0x371d0a+'-'+_0x53e022+'/'+_0xe4ebd8)[_0xb424('0x1f')](_0x1be19e);}return null;};}function patchUpdates(_0x1f961d){return function(_0x2ffee9){try{jsonpatch[_0xb424('0x20')](_0x2ffee9,_0x1f961d,!![]);}catch(_0x15b6b0){return BPromise[_0xb424('0x21')](_0x15b6b0);}return _0x2ffee9[_0xb424('0x22')]();};}function saveUpdates(_0x42a348,_0x47fcb3){return function(_0x23a84e){if(_0x23a84e){return _0x23a84e[_0xb424('0x23')](_0x42a348)[_0xb424('0x24')](function(_0x344624){return _0x344624;});}return null;};}function removeEntity(_0x71c617,_0x12ba04){return function(_0x35606b){if(_0x35606b){return _0x35606b[_0xb424('0x25')]()[_0xb424('0x24')](function(){_0x71c617[_0xb424('0x19')](0xcc)[_0xb424('0x26')]();});}};}function handleEntityNotFound(_0x37ce57,_0x3e4b37){return function(_0x2dbd37){if(!_0x2dbd37){_0x37ce57[_0xb424('0x27')](0x194);}return _0x2dbd37;};}function handleError(_0x3b0e1e,_0x5e8d7c){_0x5e8d7c=_0x5e8d7c||0x1f4;return function(_0x8ab4d1){logger['error'](_0x8ab4d1[_0xb424('0x28')]);if(_0x8ab4d1[_0xb424('0x29')]){delete _0x8ab4d1['name'];}_0x3b0e1e[_0xb424('0x19')](_0x5e8d7c)[_0xb424('0x2a')](_0x8ab4d1);};}exports[_0xb424('0x2b')]=function(_0x48f10f,_0x35e3c7){var _0x5338ef={},_0x33612f={},_0x133790={'count':0x0,'rows':[]};var _0x3e11a3=_['map'](db[_0xb424('0x2c')][_0xb424('0x2d')],function(_0x5b39f5){return{'name':_0x5b39f5['fieldName'],'type':_0x5b39f5['type'][_0xb424('0x2e')]};});_0x33612f[_0xb424('0x2f')]=_[_0xb424('0x30')](_0x3e11a3,_0xb424('0x29'));_0x33612f[_0xb424('0x31')]=_['keys'](_0x48f10f['query']);_0x33612f[_0xb424('0x32')]=_[_0xb424('0x33')](_0x33612f['model'],_0x33612f[_0xb424('0x31')]);_0x5338ef[_0xb424('0x34')]=_['intersection'](_0x33612f['model'],qs['fields'](_0x48f10f[_0xb424('0x31')][_0xb424('0x35')]));_0x5338ef[_0xb424('0x34')]=_0x5338ef['attributes'][_0xb424('0x36')]?_0x5338ef[_0xb424('0x34')]:_0x33612f[_0xb424('0x2f')];if(!_0x48f10f['query'][_0xb424('0x37')](_0xb424('0x38'))){_0x5338ef[_0xb424('0x1b')]=qs[_0xb424('0x1b')](_0x48f10f[_0xb424('0x31')]['limit']);_0x5338ef[_0xb424('0x1c')]=qs[_0xb424('0x1c')](_0x48f10f['query']['offset']);}_0x5338ef['order']=qs['sort'](_0x48f10f[_0xb424('0x31')][_0xb424('0x39')]);_0x5338ef[_0xb424('0x3a')]=qs['filters'](_['pick'](_0x48f10f['query'],_0x33612f['filters']),_0x3e11a3);if(_0x48f10f[_0xb424('0x31')][_0xb424('0x3b')]){_0x5338ef[_0xb424('0x3a')]=_[_0xb424('0x3c')](_0x5338ef[_0xb424('0x3a')],{'$or':_[_0xb424('0x30')](_0x3e11a3,function(_0x2d2356){if(_0x2d2356[_0xb424('0x3d')]!=='VIRTUAL'){var _0x5cf1b5={};_0x5cf1b5[_0x2d2356[_0xb424('0x29')]]={'$like':'%'+_0x48f10f[_0xb424('0x31')][_0xb424('0x3b')]+'%'};return _0x5cf1b5;}})});}_0x5338ef=_[_0xb424('0x3c')]({},_0x5338ef,_0x48f10f[_0xb424('0x3e')]);var _0x13d956={'where':_0x5338ef[_0xb424('0x3a')]};return db[_0xb424('0x2c')][_0xb424('0x3f')](_0x13d956)[_0xb424('0x24')](function(_0x57132a){_0x133790[_0xb424('0x3f')]=_0x57132a;if(_0x48f10f[_0xb424('0x31')][_0xb424('0x40')]){_0x5338ef['include']=[{'all':!![]}];}return db[_0xb424('0x2c')][_0xb424('0x41')](_0x5338ef);})['then'](function(_0x251569){_0x133790[_0xb424('0x42')]=_0x251569;return _0x133790;})[_0xb424('0x24')](respondWithFilteredResult(_0x35e3c7,_0x5338ef))['catch'](handleError(_0x35e3c7,null));};exports[_0xb424('0x43')]=function(_0x5ef1f0,_0x89cf90){var _0x299d57={'raw':!![],'where':{'id':_0x5ef1f0['params']['id']}},_0x529d43={};_0x529d43[_0xb424('0x2f')]=_[_0xb424('0x44')](db['ServicenowField'][_0xb424('0x2d')]);_0x529d43[_0xb424('0x31')]=_[_0xb424('0x44')](_0x5ef1f0[_0xb424('0x31')]);_0x529d43[_0xb424('0x32')]=_[_0xb424('0x33')](_0x529d43[_0xb424('0x2f')],_0x529d43[_0xb424('0x31')]);_0x299d57[_0xb424('0x34')]=_[_0xb424('0x33')](_0x529d43['model'],qs[_0xb424('0x35')](_0x5ef1f0[_0xb424('0x31')]['fields']));_0x299d57[_0xb424('0x34')]=_0x299d57[_0xb424('0x34')][_0xb424('0x36')]?_0x299d57[_0xb424('0x34')]:_0x529d43['model'];if(_0x5ef1f0[_0xb424('0x31')][_0xb424('0x40')]){_0x299d57[_0xb424('0x45')]=[{'all':!![]}];}_0x299d57=_[_0xb424('0x3c')]({},_0x299d57,_0x5ef1f0['options']);return db[_0xb424('0x2c')][_0xb424('0x46')](_0x299d57)['then'](handleEntityNotFound(_0x89cf90,null))[_0xb424('0x24')](respondWithResult(_0x89cf90,null))[_0xb424('0x47')](handleError(_0x89cf90,null));};exports['create']=function(_0x3cec66,_0x112752){return db[_0xb424('0x2c')][_0xb424('0x48')](_0x3cec66[_0xb424('0x49')],{})[_0xb424('0x24')](respondWithResult(_0x112752,0xc9))[_0xb424('0x47')](handleError(_0x112752,null));};exports[_0xb424('0x23')]=function(_0x22b5fb,_0x34cad3){if(_0x22b5fb[_0xb424('0x49')]['id']){delete _0x22b5fb[_0xb424('0x49')]['id'];}return db['ServicenowField'][_0xb424('0x46')]({'where':{'id':_0x22b5fb[_0xb424('0x4a')]['id']}})[_0xb424('0x24')](handleEntityNotFound(_0x34cad3,null))[_0xb424('0x24')](saveUpdates(_0x22b5fb[_0xb424('0x49')],null))[_0xb424('0x24')](respondWithResult(_0x34cad3,null))[_0xb424('0x47')](handleError(_0x34cad3,null));};exports[_0xb424('0x25')]=function(_0x2bcfaf,_0x4b8c51){return db[_0xb424('0x2c')][_0xb424('0x46')]({'where':{'id':_0x2bcfaf['params']['id']}})[_0xb424('0x24')](handleEntityNotFound(_0x4b8c51,null))[_0xb424('0x24')](removeEntity(_0x4b8c51,null))[_0xb424('0x47')](handleError(_0x4b8c51,null));}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.model.js b/server/api/intServicenowField/intServicenowField.model.js index ecaf2bb..d189740 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 _0x9e05=['exports','ServicenowField','servicenow_unique_index','idField','lodash','util','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','./intServicenowField.attributes'];(function(_0x59eb02,_0xdba397){var _0x259391=function(_0x609f31){while(--_0x609f31){_0x59eb02['push'](_0x59eb02['shift']());}};_0x259391(++_0xdba397);}(_0x9e05,0x1e5));var _0x59e0=function(_0x2b3dda,_0x2f617b){_0x2b3dda=_0x2b3dda-0x0;var _0x561d00=_0x9e05[_0x2b3dda];return _0x561d00;};'use strict';var _=require(_0x59e0('0x0'));var util=require(_0x59e0('0x1'));var logger=require(_0x59e0('0x2'))(_0x59e0('0x3'));var moment=require('moment');var BPromise=require(_0x59e0('0x4'));var rp=require(_0x59e0('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x59e0('0x6'));var config=require(_0x59e0('0x7'));var attributes=require(_0x59e0('0x8'));module[_0x59e0('0x9')]=function(_0x4994d2,_0xa78e99){return _0x4994d2['define'](_0x59e0('0xa'),attributes,{'tableName':'int_servicenow_fields','paranoid':![],'indexes':[{'name':_0x59e0('0xb'),'fields':[_0x59e0('0xc'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xc215=['ServicenowField','servicenow_unique_index','lodash','../../config/logger','api','moment','rimraf','./intServicenowField.attributes','exports'];(function(_0x4def89,_0x2319f3){var _0x3e8bd6=function(_0x5f54ca){while(--_0x5f54ca){_0x4def89['push'](_0x4def89['shift']());}};_0x3e8bd6(++_0x2319f3);}(_0xc215,0x1d6));var _0x5c21=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xc215[_0x19e35c];return _0x3e1fe8;};'use strict';var _=require(_0x5c21('0x0'));var util=require('util');var logger=require(_0x5c21('0x1'))(_0x5c21('0x2'));var moment=require(_0x5c21('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x5c21('0x4'));var config=require('../../config/environment');var attributes=require(_0x5c21('0x5'));module[_0x5c21('0x6')]=function(_0x33b07b,_0x18bc32){return _0x33b07b['define'](_0x5c21('0x7'),attributes,{'tableName':'int_servicenow_fields','paranoid':![],'indexes':[{'name':_0x5c21('0x8'),'fields':['idField','FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.rpc.js b/server/api/intServicenowField/intServicenowField.rpc.js index c78be61..4e89243 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 _0xac4a=['ServicenowField,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','client','then','info','debug','ServicenowField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0xac4a,0x13f));var _0xaac4=function(_0x277774,_0x4d34d6){_0x277774=_0x277774-0x0;var _0x4b75ce=_0xac4a[_0x277774];return _0x4b75ce;};'use strict';var _=require(_0xaac4('0x0'));var util=require(_0xaac4('0x1'));var moment=require(_0xaac4('0x2'));var BPromise=require(_0xaac4('0x3'));var rs=require(_0xaac4('0x4'));var fs=require('fs');var Redis=require(_0xaac4('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xaac4('0x6'))(_0xaac4('0x7'));var config=require(_0xaac4('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xaac4('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1cdfc5,_0x5870e8,_0x1e4283){return new BPromise(function(_0x27354c,_0x567295){return client['request'](_0x1cdfc5,_0x1e4283)[_0xaac4('0xa')](function(_0x50d114){logger[_0xaac4('0xb')]('ServicenowField,\x20%s,\x20%s',_0x5870e8,'request\x20sent');logger[_0xaac4('0xc')](_0xaac4('0xd'),_0x5870e8,_0xaac4('0xe'),JSON[_0xaac4('0xf')](_0x50d114));if(_0x50d114[_0xaac4('0x10')]){if(_0x50d114['error']['code']===0x1f4){logger[_0xaac4('0x10')](_0xaac4('0x11'),_0x5870e8,_0x50d114[_0xaac4('0x10')]['message']);return _0x567295(_0x50d114[_0xaac4('0x10')][_0xaac4('0x12')]);}logger['error'](_0xaac4('0x11'),_0x5870e8,_0x50d114[_0xaac4('0x10')][_0xaac4('0x12')]);return _0x27354c(_0x50d114[_0xaac4('0x10')][_0xaac4('0x12')]);}else{logger[_0xaac4('0xb')](_0xaac4('0x11'),_0x5870e8,_0xaac4('0xe'));_0x27354c(_0x50d114[_0xaac4('0x13')][_0xaac4('0x12')]);}})[_0xaac4('0x14')](function(_0x1766c2){logger[_0xaac4('0x10')]('ServicenowField,\x20%s,\x20%s',_0x5870e8,_0x1766c2);_0x567295(_0x1766c2);});});} \ No newline at end of file +var _0x70e0=['code','ServicenowField,\x20%s,\x20%s','message','result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','request','then','info','debug','ServicenowField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x992741,_0x1e0763){var _0x25942c=function(_0x2ffc8d){while(--_0x2ffc8d){_0x992741['push'](_0x992741['shift']());}};_0x25942c(++_0x1e0763);}(_0x70e0,0x17b));var _0x070e=function(_0x2cae76,_0x17ae3f){_0x2cae76=_0x2cae76-0x0;var _0x5ee036=_0x70e0[_0x2cae76];return _0x5ee036;};'use strict';var _=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var moment=require(_0x070e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x070e('0x3'));var db=require(_0x070e('0x4'))['db'];var utils=require(_0x070e('0x5'));var logger=require(_0x070e('0x6'))('rpc');var config=require(_0x070e('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x070e('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x56e420,_0x5032e5,_0x35ab0c){return new BPromise(function(_0x1e11f0,_0x604664){return client[_0x070e('0x9')](_0x56e420,_0x35ab0c)[_0x070e('0xa')](function(_0x68a09e){logger[_0x070e('0xb')]('ServicenowField,\x20%s,\x20%s',_0x5032e5,'request\x20sent');logger[_0x070e('0xc')](_0x070e('0xd'),_0x5032e5,_0x070e('0xe'),JSON[_0x070e('0xf')](_0x68a09e));if(_0x68a09e[_0x070e('0x10')]){if(_0x68a09e[_0x070e('0x10')][_0x070e('0x11')]===0x1f4){logger[_0x070e('0x10')](_0x070e('0x12'),_0x5032e5,_0x68a09e[_0x070e('0x10')][_0x070e('0x13')]);return _0x604664(_0x68a09e['error']['message']);}logger[_0x070e('0x10')]('ServicenowField,\x20%s,\x20%s',_0x5032e5,_0x68a09e['error']['message']);return _0x1e11f0(_0x68a09e[_0x070e('0x10')][_0x070e('0x13')]);}else{logger['info']('ServicenowField,\x20%s,\x20%s',_0x5032e5,_0x070e('0xe'));_0x1e11f0(_0x68a09e[_0x070e('0x14')][_0x070e('0x13')]);}})[_0x070e('0x15')](function(_0x5bc71e){logger['error'](_0x070e('0x12'),_0x5032e5,_0x5bc71e);_0x604664(_0x5bc71e);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/index.js b/server/api/intSugarcrmAccount/index.js index 3467c83..6e4edec 100644 --- a/server/api/intSugarcrmAccount/index.js +++ b/server/api/intSugarcrmAccount/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intSugarcrmAccount.controller','get','isAuthenticated','index','/:id','show','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','destroy','exports','multer','util','path'];(function(_0x301a3d,_0x1601d3){var _0x1a3374=function(_0x2e55f5){while(--_0x2e55f5){_0x301a3d['push'](_0x301a3d['shift']());}};_0x1a3374(++_0x1601d3);}(_0x9957,0x93));var _0x7995=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x9957[_0x5ddb1c];return _0x354adc;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x11')]('/',auth['isAuthenticated'](),controller[_0x7995('0x12')]);router[_0x7995('0x11')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x14')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router[_0x7995('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x7995('0x17')]);module[_0x7995('0x18')]=router; \ No newline at end of file +var _0x9957=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intSugarcrmAccount.controller','get','isAuthenticated','index','/:id','show','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','destroy','exports','multer','util','path'];(function(_0x7845e2,_0x37afe4){var _0x116ada=function(_0x2cceed){while(--_0x2cceed){_0x7845e2['push'](_0x7845e2['shift']());}};_0x116ada(++_0x37afe4);}(_0x9957,0x93));var _0x7995=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x9957[_0x1ac595];return _0x455fff;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x11')]('/',auth['isAuthenticated'](),controller[_0x7995('0x12')]);router[_0x7995('0x11')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x14')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router[_0x7995('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x7995('0x17')]);module[_0x7995('0x18')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js index 1081a05..41386e9 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(_0x4e8c5a,_0x3ca8f6){var _0x525ddd=function(_0x291734){while(--_0x291734){_0x4e8c5a['push'](_0x4e8c5a['shift']());}};_0x525ddd(++_0x3ca8f6);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2cfb58,_0x3d9412){_0x2cfb58=_0x2cfb58-0x0;var _0xd99951=_0xa9e0[_0x2cfb58];return _0xd99951;};'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(_0x5dc5ba,_0x366058){var _0x5a5b2f=function(_0x348023){while(--_0x348023){_0x5dc5ba['push'](_0x5dc5ba['shift']());}};_0x5a5b2f(++_0x366058);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2cfb58,_0x3d9412){_0x2cfb58=_0x2cfb58-0x0;var _0xd99951=_0xa9e0[_0x2cfb58];return _0xd99951;};'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 3d4eca1..3a0fd41 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 _0xf14d=['send','index','map','SugarcrmAccount','rawAttributes','fieldName','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','merge','VIRTUAL','filter','options','include','findAll','rows','catch','params','includeAll','find','create','body','getConfigurations','findOne','SugarcrmConfiguration','where','addConfiguration','Subjects','getSubjects','channel','Descriptions','getDescriptions','type','SugarcrmField','getFields','assigned_user_id','description','date_start','duration_hours','parent_id','parent_type','parent_name','direction','slice','substring','lastIndexOf','POST','format','%s%s','/service/v4_1/rest.php','login','JSON','stringify','username','password','xCALLY\x20Motion\x20Integration','Invalid\x20Login','Password\x20Expired','get_module_fields','values','module_fields','includes','label','endsWith','value','test','statusCode','Wrong\x20credentials','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','fs-extra','lodash','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','../../components/integrations/configuration','sendStatus','status','json','offset','undefined','count','limit','Content-Range','apply','reject','update','then','end','error','name'];(function(_0x32f7d7,_0x54231b){var _0x133d09=function(_0x41a7ab){while(--_0x41a7ab){_0x32f7d7['push'](_0x32f7d7['shift']());}};_0x133d09(++_0x54231b);}(_0xf14d,0xc5));var _0xdf14=function(_0x586e13,_0x4f402e){_0x586e13=_0x586e13-0x0;var _0x332d00=_0xf14d[_0x586e13];return _0x332d00;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xdf14('0x0'));var zipdir=require(_0xdf14('0x1'));var jsonpatch=require(_0xdf14('0x2'));var rp=require(_0xdf14('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xdf14('0x4'));var util=require(_0xdf14('0x5'));var path=require(_0xdf14('0x6'));var sox=require(_0xdf14('0x7'));var csv=require(_0xdf14('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xdf14('0x9'));var _=require(_0xdf14('0xa'));var squel=require('squel');var crypto=require(_0xdf14('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xdf14('0xc'));var toCsv=require(_0xdf14('0x8'));var querystring=require(_0xdf14('0xd'));var Papa=require(_0xdf14('0xe'));var Redis=require(_0xdf14('0xf'));var authService=require(_0xdf14('0x10'));var qs=require(_0xdf14('0x11'));var as=require(_0xdf14('0x12'));var hardwareService=require(_0xdf14('0x13'));var logger=require(_0xdf14('0x14'))(_0xdf14('0x15'));var utils=require(_0xdf14('0x16'));var config=require(_0xdf14('0x17'));var licenseUtil=require(_0xdf14('0x18'));var db=require('../../mysqldb')['db'];var integrations=require(_0xdf14('0x19'));function respondWithStatusCode(_0x4c2b51,_0x364c0e){_0x364c0e=_0x364c0e||0xcc;return function(_0x498f66){if(_0x498f66){return _0x4c2b51[_0xdf14('0x1a')](_0x364c0e);}return _0x4c2b51[_0xdf14('0x1b')](_0x364c0e)['end']();};}function respondWithResult(_0x3b64c7,_0xdc77fa){_0xdc77fa=_0xdc77fa||0xc8;return function(_0x11b2e0){if(_0x11b2e0){return _0x3b64c7[_0xdf14('0x1b')](_0xdc77fa)[_0xdf14('0x1c')](_0x11b2e0);}};}function respondWithFilteredResult(_0x4a6a65,_0x2f2093){return function(_0x1b37fd){if(_0x1b37fd){var _0xf76953=typeof _0x2f2093[_0xdf14('0x1d')]===_0xdf14('0x1e')&&typeof _0x2f2093['limit']==='undefined';var _0x524743=_0x1b37fd[_0xdf14('0x1f')];var _0x395866=_0xf76953?0x0:_0x2f2093[_0xdf14('0x1d')];var _0xec3bbd=_0xf76953?_0x1b37fd[_0xdf14('0x1f')]:_0x2f2093[_0xdf14('0x1d')]+_0x2f2093[_0xdf14('0x20')];var _0x1f4c27;if(_0xec3bbd>=_0x524743){_0xec3bbd=_0x524743;_0x1f4c27=0xc8;}else{_0x1f4c27=0xce;}_0x4a6a65[_0xdf14('0x1b')](_0x1f4c27);return _0x4a6a65['set'](_0xdf14('0x21'),_0x395866+'-'+_0xec3bbd+'/'+_0x524743)['json'](_0x1b37fd);}return null;};}function patchUpdates(_0x4f2355){return function(_0x13c3c4){try{jsonpatch[_0xdf14('0x22')](_0x13c3c4,_0x4f2355,!![]);}catch(_0x56d629){return BPromise[_0xdf14('0x23')](_0x56d629);}return _0x13c3c4['save']();};}function saveUpdates(_0x575181,_0xd0baf8){return function(_0x180452){if(_0x180452){return _0x180452[_0xdf14('0x24')](_0x575181)[_0xdf14('0x25')](function(_0x26871c){return _0x26871c;});}return null;};}function removeEntity(_0x5731dc,_0x15b2a4){return function(_0x28d4b8){if(_0x28d4b8){return _0x28d4b8['destroy']()[_0xdf14('0x25')](function(){_0x5731dc['status'](0xcc)[_0xdf14('0x26')]();});}};}function handleEntityNotFound(_0x174162,_0x4911f5){return function(_0x2f1c37){if(!_0x2f1c37){_0x174162[_0xdf14('0x1a')](0x194);}return _0x2f1c37;};}function handleError(_0x36ec98,_0x3d7b2c){_0x3d7b2c=_0x3d7b2c||0x1f4;return function(_0x3d6de4){logger[_0xdf14('0x27')](_0x3d6de4['stack']);if(_0x3d6de4[_0xdf14('0x28')]){delete _0x3d6de4[_0xdf14('0x28')];}_0x36ec98['status'](_0x3d7b2c)[_0xdf14('0x29')](_0x3d6de4);};}exports[_0xdf14('0x2a')]=function(_0x330e86,_0x4ceed4){var _0x969fec={},_0x180a3e={},_0x187b4d={'count':0x0,'rows':[]};var _0x573b6c=_[_0xdf14('0x2b')](db[_0xdf14('0x2c')][_0xdf14('0x2d')],function(_0x15b373){return{'name':_0x15b373[_0xdf14('0x2e')],'type':_0x15b373['type']['key']};});_0x180a3e[_0xdf14('0x2f')]=_[_0xdf14('0x2b')](_0x573b6c,_0xdf14('0x28'));_0x180a3e[_0xdf14('0x30')]=_[_0xdf14('0x31')](_0x330e86[_0xdf14('0x30')]);_0x180a3e['filters']=_[_0xdf14('0x32')](_0x180a3e[_0xdf14('0x2f')],_0x180a3e['query']);_0x969fec[_0xdf14('0x33')]=_['intersection'](_0x180a3e[_0xdf14('0x2f')],qs[_0xdf14('0x34')](_0x330e86['query'][_0xdf14('0x34')]));_0x969fec[_0xdf14('0x33')]=_0x969fec['attributes'][_0xdf14('0x35')]?_0x969fec[_0xdf14('0x33')]:_0x180a3e[_0xdf14('0x2f')];if(!_0x330e86[_0xdf14('0x30')][_0xdf14('0x36')](_0xdf14('0x37'))){_0x969fec['limit']=qs[_0xdf14('0x20')](_0x330e86[_0xdf14('0x30')][_0xdf14('0x20')]);_0x969fec[_0xdf14('0x1d')]=qs['offset'](_0x330e86['query'][_0xdf14('0x1d')]);}_0x969fec[_0xdf14('0x38')]=qs[_0xdf14('0x39')](_0x330e86[_0xdf14('0x30')][_0xdf14('0x39')]);_0x969fec['where']=qs[_0xdf14('0x3a')](_[_0xdf14('0x3b')](_0x330e86[_0xdf14('0x30')],_0x180a3e[_0xdf14('0x3a')]),_0x573b6c);if(_0x330e86[_0xdf14('0x30')]['filter']){_0x969fec['where']=_[_0xdf14('0x3c')](_0x969fec['where'],{'$or':_['map'](_0x573b6c,function(_0x5f4cbf){if(_0x5f4cbf['type']!==_0xdf14('0x3d')){var _0x1adfb5={};_0x1adfb5[_0x5f4cbf[_0xdf14('0x28')]]={'$like':'%'+_0x330e86[_0xdf14('0x30')][_0xdf14('0x3e')]+'%'};return _0x1adfb5;}})});}_0x969fec=_[_0xdf14('0x3c')]({},_0x969fec,_0x330e86[_0xdf14('0x3f')]);var _0x4cdd67={'where':_0x969fec['where']};return db[_0xdf14('0x2c')]['count'](_0x4cdd67)[_0xdf14('0x25')](function(_0x3787c5){_0x187b4d[_0xdf14('0x1f')]=_0x3787c5;if(_0x330e86[_0xdf14('0x30')]['includeAll']){_0x969fec[_0xdf14('0x40')]=[{'all':!![]}];}return db['SugarcrmAccount'][_0xdf14('0x41')](_0x969fec);})[_0xdf14('0x25')](function(_0x2b8ef9){_0x187b4d[_0xdf14('0x42')]=_0x2b8ef9;return _0x187b4d;})[_0xdf14('0x25')](respondWithFilteredResult(_0x4ceed4,_0x969fec))[_0xdf14('0x43')](handleError(_0x4ceed4,null));};exports['show']=function(_0xb244f,_0x3a61f9){var _0x1e5042={'raw':![],'where':{'id':_0xb244f[_0xdf14('0x44')]['id']}},_0x346387={};_0x346387[_0xdf14('0x2f')]=_[_0xdf14('0x31')](db[_0xdf14('0x2c')][_0xdf14('0x2d')]);_0x346387[_0xdf14('0x30')]=_[_0xdf14('0x31')](_0xb244f[_0xdf14('0x30')]);_0x346387[_0xdf14('0x3a')]=_['intersection'](_0x346387['model'],_0x346387[_0xdf14('0x30')]);_0x1e5042[_0xdf14('0x33')]=_[_0xdf14('0x32')](_0x346387[_0xdf14('0x2f')],qs['fields'](_0xb244f[_0xdf14('0x30')]['fields']));_0x1e5042['attributes']=_0x1e5042['attributes'][_0xdf14('0x35')]?_0x1e5042[_0xdf14('0x33')]:_0x346387[_0xdf14('0x2f')];if(_0xb244f[_0xdf14('0x30')][_0xdf14('0x45')]){_0x1e5042['include']=[{'all':!![]}];}_0x1e5042=_[_0xdf14('0x3c')]({},_0x1e5042,_0xb244f[_0xdf14('0x3f')]);return db[_0xdf14('0x2c')][_0xdf14('0x46')](_0x1e5042)[_0xdf14('0x25')](handleEntityNotFound(_0x3a61f9,null))[_0xdf14('0x25')](respondWithResult(_0x3a61f9,null))[_0xdf14('0x43')](handleError(_0x3a61f9,null));};exports[_0xdf14('0x47')]=function(_0x2034c6,_0x2b28e0){return db['SugarcrmAccount'][_0xdf14('0x47')](_0x2034c6['body'],{})[_0xdf14('0x25')](respondWithResult(_0x2b28e0,0xc9))[_0xdf14('0x43')](handleError(_0x2b28e0,null));};exports[_0xdf14('0x24')]=function(_0x36370b,_0x33dc6b){if(_0x36370b[_0xdf14('0x48')]['id']){delete _0x36370b[_0xdf14('0x48')]['id'];}return db['SugarcrmAccount'][_0xdf14('0x46')]({'where':{'id':_0x36370b[_0xdf14('0x44')]['id']}})[_0xdf14('0x25')](handleEntityNotFound(_0x33dc6b,null))[_0xdf14('0x25')](saveUpdates(_0x36370b['body'],null))['then'](respondWithResult(_0x33dc6b,null))[_0xdf14('0x43')](handleError(_0x33dc6b,null));};exports['destroy']=function(_0x1a9fcc,_0x30b683){return db[_0xdf14('0x2c')]['find']({'where':{'id':_0x1a9fcc[_0xdf14('0x44')]['id']}})[_0xdf14('0x25')](handleEntityNotFound(_0x30b683,null))[_0xdf14('0x25')](removeEntity(_0x30b683,null))['catch'](handleError(_0x30b683,null));};exports[_0xdf14('0x49')]=function(_0x57b47b,_0x11c21b,_0x44df10){var _0x575f19={};var _0x382372={};var _0x2dee23;var _0x14d51a;return db[_0xdf14('0x2c')][_0xdf14('0x4a')]({'where':{'id':_0x57b47b['params']['id']}})['then'](handleEntityNotFound(_0x11c21b,null))[_0xdf14('0x25')](function(_0x3426c3){if(_0x3426c3){_0x2dee23=_0x3426c3;_0x382372[_0xdf14('0x2f')]=_[_0xdf14('0x31')](db[_0xdf14('0x4b')][_0xdf14('0x2d')]);_0x382372['query']=_[_0xdf14('0x31')](_0x57b47b[_0xdf14('0x30')]);_0x382372[_0xdf14('0x3a')]=_['intersection'](_0x382372[_0xdf14('0x2f')],_0x382372['query']);_0x575f19['attributes']=_[_0xdf14('0x32')](_0x382372[_0xdf14('0x2f')],qs[_0xdf14('0x34')](_0x57b47b[_0xdf14('0x30')][_0xdf14('0x34')]));_0x575f19[_0xdf14('0x33')]=_0x575f19[_0xdf14('0x33')][_0xdf14('0x35')]?_0x575f19[_0xdf14('0x33')]:_0x382372[_0xdf14('0x2f')];_0x575f19['order']=qs[_0xdf14('0x39')](_0x57b47b[_0xdf14('0x30')][_0xdf14('0x39')]);_0x575f19[_0xdf14('0x4c')]=qs[_0xdf14('0x3a')](_[_0xdf14('0x3b')](_0x57b47b[_0xdf14('0x30')],_0x382372[_0xdf14('0x3a')]));if(_0x57b47b[_0xdf14('0x30')][_0xdf14('0x3e')]){_0x575f19[_0xdf14('0x4c')]=_['merge'](_0x575f19[_0xdf14('0x4c')],{'$or':_[_0xdf14('0x2b')](_0x575f19[_0xdf14('0x33')],function(_0x19357f){var _0x136d38={};_0x136d38[_0x19357f]={'$like':'%'+_0x57b47b['query']['filter']+'%'};return _0x136d38;})});}_0x575f19=_['merge']({},_0x575f19,_0x57b47b[_0xdf14('0x3f')]);return _0x2dee23['getConfigurations'](_0x575f19);}})[_0xdf14('0x25')](function(_0x2c012d){if(_0x2c012d){_0x14d51a=_0x2c012d[_0xdf14('0x35')];if(!_0x57b47b['query'][_0xdf14('0x36')](_0xdf14('0x37'))){_0x575f19[_0xdf14('0x20')]=qs['limit'](_0x57b47b['query'][_0xdf14('0x20')]);_0x575f19['offset']=qs[_0xdf14('0x1d')](_0x57b47b[_0xdf14('0x30')][_0xdf14('0x1d')]);}return _0x2dee23[_0xdf14('0x49')](_0x575f19);}})[_0xdf14('0x25')](function(_0x50f6b3){if(_0x50f6b3){return _0x50f6b3?{'count':_0x14d51a,'rows':_0x50f6b3}:null;}})['then'](respondWithResult(_0x11c21b,null))[_0xdf14('0x43')](handleError(_0x11c21b,null));};exports[_0xdf14('0x4d')]=function(_0x513093,_0x3f6a60,_0x34d7cf){if(_0x513093[_0xdf14('0x48')]['id']){delete _0x513093[_0xdf14('0x48')]['id'];}return db[_0xdf14('0x2c')][_0xdf14('0x4a')]({'where':{'id':_0x513093[_0xdf14('0x44')]['id']}})[_0xdf14('0x25')](handleEntityNotFound(_0x3f6a60,null))[_0xdf14('0x25')](function(_0x49de62){if(_0x49de62){_0x513093['body']['AccountId']=_0x49de62['id'];_0x513093[_0xdf14('0x48')][_0xdf14('0x4e')]=integrations[_0xdf14('0x4f')](_0x513093[_0xdf14('0x48')][_0xdf14('0x50')],_0x513093[_0xdf14('0x48')]['type']);_0x513093['body'][_0xdf14('0x51')]=integrations[_0xdf14('0x52')](_0x513093['body']['channel'],_0x513093[_0xdf14('0x48')][_0xdf14('0x53')]);return db[_0xdf14('0x4b')][_0xdf14('0x47')](_0x513093[_0xdf14('0x48')],{'include':[{'model':db[_0xdf14('0x54')],'as':'Subjects'},{'model':db[_0xdf14('0x54')],'as':_0xdf14('0x51')}]});}return null;})[_0xdf14('0x25')](respondWithResult(_0x3f6a60,null))[_0xdf14('0x43')](handleError(_0x3f6a60,null));};exports[_0xdf14('0x55')]=function(_0x3c152e,_0x2d3cba,_0xf3bf33){var _0x1c5d92='';var _0x5d6f85=['id','name',_0xdf14('0x56'),'created_by',_0xdf14('0x57'),_0xdf14('0x58'),_0xdf14('0x59'),'duration_minutes',_0xdf14('0x5a'),_0xdf14('0x5b'),_0xdf14('0x5c'),_0xdf14('0x5d')];return db[_0xdf14('0x2c')][_0xdf14('0x4a')]({'where':{'id':_0x3c152e[_0xdf14('0x44')]['id']},'attributes':['id','username','password','remoteUri']})[_0xdf14('0x25')](handleEntityNotFound(_0x2d3cba,null))['then'](function(_0x2ea592){if(_0x2ea592){_0x1c5d92=_0x2ea592['remoteUri'];var _0x719634=_0x1c5d92[_0xdf14('0x5e')](-0x1);if(_0x719634==='/'){_0x1c5d92=_0x1c5d92[_0xdf14('0x5f')](0x0,_0x1c5d92[_0xdf14('0x60')](_0x719634));}return rp({'method':_0xdf14('0x61'),'uri':util[_0xdf14('0x62')](_0xdf14('0x63'),_0x1c5d92,_0xdf14('0x64')),'json':!![],'form':{'method':_0xdf14('0x65'),'input_type':_0xdf14('0x66'),'response_type':'JSON','rest_data':JSON[_0xdf14('0x67')]({'user_auth':{'user_name':_0x2ea592[_0xdf14('0x68')],'password':_0x2ea592[_0xdf14('0x69')],'encryption':'PLAIN'},'application':_0xdf14('0x6a')})}});}})[_0xdf14('0x25')](function(_0x5c3a0b){if(_0x5c3a0b&&_0x5c3a0b[_0xdf14('0x28')]!==_0xdf14('0x6b')&&_0x5c3a0b[_0xdf14('0x28')]!==_0xdf14('0x6c')){return rp({'method':_0xdf14('0x61'),'uri':util[_0xdf14('0x62')](_0xdf14('0x63'),_0x1c5d92,_0xdf14('0x64')),'json':!![],'form':{'method':_0xdf14('0x6d'),'input_type':'JSON','response_type':_0xdf14('0x66'),'rest_data':JSON[_0xdf14('0x67')]({'session':_0x5c3a0b['id'],'module_name':'Calls'})}})[_0xdf14('0x25')](function(_0x452b03){if(_0x452b03){var _0x3660da=_[_0xdf14('0x6e')](_0x452b03[_0xdf14('0x6f')]);_['remove'](_0x3660da,function(_0xb56a3b){return _0x5d6f85[_0xdf14('0x70')](_0xb56a3b[_0xdf14('0x28')]);});return{'count':_0x3660da[_0xdf14('0x35')],'rows':_[_0xdf14('0x2b')](_0x3660da,function(_0x162886){return{'id':_0x162886['name'],'name':_0x162886[_0xdf14('0x71')],'custom':_[_0xdf14('0x72')](_0x162886[_0xdf14('0x28')],'_c')?!![]:![],'options':_0x162886[_0xdf14('0x3f')]?_[_0xdf14('0x2b')](_[_0xdf14('0x6e')](_0x162886[_0xdf14('0x3f')]),function(_0x2cbb56){return{'name':_0x2cbb56[_0xdf14('0x73')],'value':_0x2cbb56[_0xdf14('0x28')]};}):[]};})};}})[_0xdf14('0x25')](respondWithResult(_0x2d3cba,null))['catch'](function(_0x3274aa){var _0x45311a=_0x3c152e[_0xdf14('0x30')][_0xdf14('0x74')]?0x1f4:_0x3274aa[_0xdf14('0x75')]||0x1f4;logger[_0xdf14('0x27')]('getFields,\x20%s,\x20%s,\x20%s','getFields',_0x45311a,JSON['stringify'](_0x3274aa));delete _0x3274aa[_0xdf14('0x28')];if(_0x45311a===0x191){_0x45311a=0x190;}_0x2d3cba[_0xdf14('0x1b')](_0x45311a)['send'](_0x3c152e[_0xdf14('0x30')][_0xdf14('0x74')]?{'message':_0xdf14('0x76'),'statusCode':_0x3274aa['statusCode']}:_0x3274aa);});}else{var _0x5661b6=0x1f4;_0x2d3cba['status'](_0x5661b6)[_0xdf14('0x29')]({'message':_0xdf14('0x76'),'statusCode':0x190});}});}; \ No newline at end of file +var _0x783c=['parent_id','parent_type','direction','password','slice','substring','POST','format','%s%s','/service/v4_1/rest.php','login','JSON','username','PLAIN','xCALLY\x20Motion\x20Integration','Invalid\x20Login','Password\x20Expired','get_module_fields','stringify','values','module_fields','remove','includes','label','endsWith','value','test','statusCode','error','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','util','path','sox','ejs','fs-extra','lodash','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../components/integrations/configuration','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','update','then','destroy','stack','name','send','map','SugarcrmAccount','key','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','options','includeAll','include','findAll','rows','catch','params','rawAttributes','find','create','body','findOne','getConfigurations','addConfiguration','AccountId','Subjects','channel','SugarcrmConfiguration','Descriptions','getFields','assigned_user_id','created_by','date_start','duration_hours','duration_minutes'];(function(_0x4ee23e,_0x523daf){var _0x50a2bf=function(_0x4c6ea1){while(--_0x4c6ea1){_0x4ee23e['push'](_0x4ee23e['shift']());}};_0x50a2bf(++_0x523daf);}(_0x783c,0x94));var _0xc783=function(_0x14c2ce,_0x2cb5f4){_0x14c2ce=_0x14c2ce-0x0;var _0xec8055=_0x783c[_0x14c2ce];return _0xec8055;};'use strict';var emlformat=require(_0xc783('0x0'));var rimraf=require(_0xc783('0x1'));var zipdir=require(_0xc783('0x2'));var jsonpatch=require(_0xc783('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xc783('0x4'));var Mustache=require('mustache');var util=require(_0xc783('0x5'));var path=require(_0xc783('0x6'));var sox=require(_0xc783('0x7'));var csv=require('to-csv');var ejs=require(_0xc783('0x8'));var fs=require('fs');var fs_extra=require(_0xc783('0x9'));var _=require(_0xc783('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xc783('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xc783('0xc'));var Papa=require(_0xc783('0xd'));var Redis=require(_0xc783('0xe'));var authService=require(_0xc783('0xf'));var qs=require(_0xc783('0x10'));var as=require(_0xc783('0x11'));var hardwareService=require(_0xc783('0x12'));var logger=require(_0xc783('0x13'))(_0xc783('0x14'));var utils=require(_0xc783('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var integrations=require(_0xc783('0x16'));function respondWithStatusCode(_0x721324,_0x8b6ce0){_0x8b6ce0=_0x8b6ce0||0xcc;return function(_0x2915c2){if(_0x2915c2){return _0x721324[_0xc783('0x17')](_0x8b6ce0);}return _0x721324[_0xc783('0x18')](_0x8b6ce0)[_0xc783('0x19')]();};}function respondWithResult(_0x53fc7d,_0x4a473a){_0x4a473a=_0x4a473a||0xc8;return function(_0x4f4651){if(_0x4f4651){return _0x53fc7d[_0xc783('0x18')](_0x4a473a)['json'](_0x4f4651);}};}function respondWithFilteredResult(_0x3da57e,_0x2cbb40){return function(_0x3feabb){if(_0x3feabb){var _0x5dee7d=typeof _0x2cbb40[_0xc783('0x1a')]===_0xc783('0x1b')&&typeof _0x2cbb40[_0xc783('0x1c')]===_0xc783('0x1b');var _0x4c837a=_0x3feabb[_0xc783('0x1d')];var _0x4c15d2=_0x5dee7d?0x0:_0x2cbb40['offset'];var _0x234888=_0x5dee7d?_0x3feabb[_0xc783('0x1d')]:_0x2cbb40[_0xc783('0x1a')]+_0x2cbb40[_0xc783('0x1c')];var _0x3ea580;if(_0x234888>=_0x4c837a){_0x234888=_0x4c837a;_0x3ea580=0xc8;}else{_0x3ea580=0xce;}_0x3da57e[_0xc783('0x18')](_0x3ea580);return _0x3da57e[_0xc783('0x1e')](_0xc783('0x1f'),_0x4c15d2+'-'+_0x234888+'/'+_0x4c837a)[_0xc783('0x20')](_0x3feabb);}return null;};}function patchUpdates(_0x5954e6){return function(_0x5a80b5){try{jsonpatch[_0xc783('0x21')](_0x5a80b5,_0x5954e6,!![]);}catch(_0x459c59){return BPromise[_0xc783('0x22')](_0x459c59);}return _0x5a80b5['save']();};}function saveUpdates(_0x21ddf6,_0x54d6d8){return function(_0x53bfc8){if(_0x53bfc8){return _0x53bfc8[_0xc783('0x23')](_0x21ddf6)[_0xc783('0x24')](function(_0x2b4da8){return _0x2b4da8;});}return null;};}function removeEntity(_0xb16aa,_0x4a890b){return function(_0x5b6dba){if(_0x5b6dba){return _0x5b6dba[_0xc783('0x25')]()[_0xc783('0x24')](function(){_0xb16aa[_0xc783('0x18')](0xcc)[_0xc783('0x19')]();});}};}function handleEntityNotFound(_0x57bba7,_0x4caf99){return function(_0x1d375b){if(!_0x1d375b){_0x57bba7[_0xc783('0x17')](0x194);}return _0x1d375b;};}function handleError(_0x745de1,_0x3252be){_0x3252be=_0x3252be||0x1f4;return function(_0x1ff2a4){logger['error'](_0x1ff2a4[_0xc783('0x26')]);if(_0x1ff2a4[_0xc783('0x27')]){delete _0x1ff2a4[_0xc783('0x27')];}_0x745de1[_0xc783('0x18')](_0x3252be)[_0xc783('0x28')](_0x1ff2a4);};}exports['index']=function(_0x2cc9ca,_0x2ad487){var _0x2705bc={},_0x1a4027={},_0x3173bc={'count':0x0,'rows':[]};var _0xb01263=_[_0xc783('0x29')](db[_0xc783('0x2a')]['rawAttributes'],function(_0x10196f){return{'name':_0x10196f['fieldName'],'type':_0x10196f['type'][_0xc783('0x2b')]};});_0x1a4027['model']=_[_0xc783('0x29')](_0xb01263,_0xc783('0x27'));_0x1a4027[_0xc783('0x2c')]=_[_0xc783('0x2d')](_0x2cc9ca[_0xc783('0x2c')]);_0x1a4027[_0xc783('0x2e')]=_['intersection'](_0x1a4027[_0xc783('0x2f')],_0x1a4027[_0xc783('0x2c')]);_0x2705bc[_0xc783('0x30')]=_[_0xc783('0x31')](_0x1a4027['model'],qs[_0xc783('0x32')](_0x2cc9ca['query'][_0xc783('0x32')]));_0x2705bc[_0xc783('0x30')]=_0x2705bc['attributes'][_0xc783('0x33')]?_0x2705bc[_0xc783('0x30')]:_0x1a4027[_0xc783('0x2f')];if(!_0x2cc9ca['query'][_0xc783('0x34')](_0xc783('0x35'))){_0x2705bc[_0xc783('0x1c')]=qs['limit'](_0x2cc9ca[_0xc783('0x2c')][_0xc783('0x1c')]);_0x2705bc['offset']=qs['offset'](_0x2cc9ca[_0xc783('0x2c')][_0xc783('0x1a')]);}_0x2705bc[_0xc783('0x36')]=qs['sort'](_0x2cc9ca[_0xc783('0x2c')][_0xc783('0x37')]);_0x2705bc[_0xc783('0x38')]=qs[_0xc783('0x2e')](_[_0xc783('0x39')](_0x2cc9ca['query'],_0x1a4027['filters']),_0xb01263);if(_0x2cc9ca['query'][_0xc783('0x3a')]){_0x2705bc[_0xc783('0x38')]=_[_0xc783('0x3b')](_0x2705bc[_0xc783('0x38')],{'$or':_[_0xc783('0x29')](_0xb01263,function(_0x42e9b6){if(_0x42e9b6[_0xc783('0x3c')]!=='VIRTUAL'){var _0x28a64e={};_0x28a64e[_0x42e9b6[_0xc783('0x27')]]={'$like':'%'+_0x2cc9ca[_0xc783('0x2c')][_0xc783('0x3a')]+'%'};return _0x28a64e;}})});}_0x2705bc=_[_0xc783('0x3b')]({},_0x2705bc,_0x2cc9ca[_0xc783('0x3d')]);var _0x593b2f={'where':_0x2705bc[_0xc783('0x38')]};return db[_0xc783('0x2a')][_0xc783('0x1d')](_0x593b2f)[_0xc783('0x24')](function(_0x4799ee){_0x3173bc['count']=_0x4799ee;if(_0x2cc9ca[_0xc783('0x2c')][_0xc783('0x3e')]){_0x2705bc[_0xc783('0x3f')]=[{'all':!![]}];}return db['SugarcrmAccount'][_0xc783('0x40')](_0x2705bc);})[_0xc783('0x24')](function(_0x1028e8){_0x3173bc[_0xc783('0x41')]=_0x1028e8;return _0x3173bc;})[_0xc783('0x24')](respondWithFilteredResult(_0x2ad487,_0x2705bc))[_0xc783('0x42')](handleError(_0x2ad487,null));};exports['show']=function(_0x25dc06,_0x52bf10){var _0x79f9b2={'raw':![],'where':{'id':_0x25dc06[_0xc783('0x43')]['id']}},_0x220b35={};_0x220b35[_0xc783('0x2f')]=_[_0xc783('0x2d')](db[_0xc783('0x2a')][_0xc783('0x44')]);_0x220b35['query']=_[_0xc783('0x2d')](_0x25dc06[_0xc783('0x2c')]);_0x220b35['filters']=_[_0xc783('0x31')](_0x220b35[_0xc783('0x2f')],_0x220b35[_0xc783('0x2c')]);_0x79f9b2['attributes']=_[_0xc783('0x31')](_0x220b35[_0xc783('0x2f')],qs[_0xc783('0x32')](_0x25dc06[_0xc783('0x2c')][_0xc783('0x32')]));_0x79f9b2[_0xc783('0x30')]=_0x79f9b2[_0xc783('0x30')][_0xc783('0x33')]?_0x79f9b2['attributes']:_0x220b35[_0xc783('0x2f')];if(_0x25dc06[_0xc783('0x2c')]['includeAll']){_0x79f9b2['include']=[{'all':!![]}];}_0x79f9b2=_[_0xc783('0x3b')]({},_0x79f9b2,_0x25dc06['options']);return db[_0xc783('0x2a')][_0xc783('0x45')](_0x79f9b2)['then'](handleEntityNotFound(_0x52bf10,null))[_0xc783('0x24')](respondWithResult(_0x52bf10,null))[_0xc783('0x42')](handleError(_0x52bf10,null));};exports[_0xc783('0x46')]=function(_0x4a682c,_0x4c278a){return db[_0xc783('0x2a')][_0xc783('0x46')](_0x4a682c[_0xc783('0x47')],{})[_0xc783('0x24')](respondWithResult(_0x4c278a,0xc9))['catch'](handleError(_0x4c278a,null));};exports[_0xc783('0x23')]=function(_0x273393,_0x38345f){if(_0x273393[_0xc783('0x47')]['id']){delete _0x273393[_0xc783('0x47')]['id'];}return db[_0xc783('0x2a')]['find']({'where':{'id':_0x273393[_0xc783('0x43')]['id']}})[_0xc783('0x24')](handleEntityNotFound(_0x38345f,null))[_0xc783('0x24')](saveUpdates(_0x273393[_0xc783('0x47')],null))['then'](respondWithResult(_0x38345f,null))['catch'](handleError(_0x38345f,null));};exports[_0xc783('0x25')]=function(_0x55051c,_0x2adc61){return db[_0xc783('0x2a')][_0xc783('0x45')]({'where':{'id':_0x55051c[_0xc783('0x43')]['id']}})[_0xc783('0x24')](handleEntityNotFound(_0x2adc61,null))[_0xc783('0x24')](removeEntity(_0x2adc61,null))['catch'](handleError(_0x2adc61,null));};exports['getConfigurations']=function(_0x212ac3,_0x157983,_0x1e0d8a){var _0x502d25={};var _0x192843={};var _0x52ed2f;var _0x4b56f9;return db[_0xc783('0x2a')][_0xc783('0x48')]({'where':{'id':_0x212ac3[_0xc783('0x43')]['id']}})[_0xc783('0x24')](handleEntityNotFound(_0x157983,null))['then'](function(_0x45284a){if(_0x45284a){_0x52ed2f=_0x45284a;_0x192843['model']=_[_0xc783('0x2d')](db['SugarcrmConfiguration'][_0xc783('0x44')]);_0x192843['query']=_[_0xc783('0x2d')](_0x212ac3[_0xc783('0x2c')]);_0x192843['filters']=_['intersection'](_0x192843['model'],_0x192843[_0xc783('0x2c')]);_0x502d25[_0xc783('0x30')]=_[_0xc783('0x31')](_0x192843[_0xc783('0x2f')],qs[_0xc783('0x32')](_0x212ac3[_0xc783('0x2c')][_0xc783('0x32')]));_0x502d25['attributes']=_0x502d25['attributes']['length']?_0x502d25[_0xc783('0x30')]:_0x192843['model'];_0x502d25[_0xc783('0x36')]=qs['sort'](_0x212ac3[_0xc783('0x2c')][_0xc783('0x37')]);_0x502d25[_0xc783('0x38')]=qs[_0xc783('0x2e')](_[_0xc783('0x39')](_0x212ac3[_0xc783('0x2c')],_0x192843[_0xc783('0x2e')]));if(_0x212ac3['query'][_0xc783('0x3a')]){_0x502d25[_0xc783('0x38')]=_[_0xc783('0x3b')](_0x502d25[_0xc783('0x38')],{'$or':_[_0xc783('0x29')](_0x502d25['attributes'],function(_0x370196){var _0x2da12f={};_0x2da12f[_0x370196]={'$like':'%'+_0x212ac3[_0xc783('0x2c')][_0xc783('0x3a')]+'%'};return _0x2da12f;})});}_0x502d25=_[_0xc783('0x3b')]({},_0x502d25,_0x212ac3['options']);return _0x52ed2f[_0xc783('0x49')](_0x502d25);}})['then'](function(_0x115255){if(_0x115255){_0x4b56f9=_0x115255[_0xc783('0x33')];if(!_0x212ac3['query']['hasOwnProperty'](_0xc783('0x35'))){_0x502d25['limit']=qs[_0xc783('0x1c')](_0x212ac3['query'][_0xc783('0x1c')]);_0x502d25[_0xc783('0x1a')]=qs[_0xc783('0x1a')](_0x212ac3[_0xc783('0x2c')]['offset']);}return _0x52ed2f[_0xc783('0x49')](_0x502d25);}})[_0xc783('0x24')](function(_0x355b8f){if(_0x355b8f){return _0x355b8f?{'count':_0x4b56f9,'rows':_0x355b8f}:null;}})[_0xc783('0x24')](respondWithResult(_0x157983,null))[_0xc783('0x42')](handleError(_0x157983,null));};exports[_0xc783('0x4a')]=function(_0x44baec,_0x54b6cc,_0x7b6177){if(_0x44baec[_0xc783('0x47')]['id']){delete _0x44baec[_0xc783('0x47')]['id'];}return db[_0xc783('0x2a')][_0xc783('0x48')]({'where':{'id':_0x44baec[_0xc783('0x43')]['id']}})[_0xc783('0x24')](handleEntityNotFound(_0x54b6cc,null))[_0xc783('0x24')](function(_0x519084){if(_0x519084){_0x44baec[_0xc783('0x47')][_0xc783('0x4b')]=_0x519084['id'];_0x44baec[_0xc783('0x47')][_0xc783('0x4c')]=integrations['getSubjects'](_0x44baec[_0xc783('0x47')][_0xc783('0x4d')],_0x44baec[_0xc783('0x47')][_0xc783('0x3c')]);_0x44baec[_0xc783('0x47')]['Descriptions']=integrations['getDescriptions'](_0x44baec['body']['channel'],_0x44baec[_0xc783('0x47')][_0xc783('0x3c')]);return db[_0xc783('0x4e')][_0xc783('0x46')](_0x44baec['body'],{'include':[{'model':db['SugarcrmField'],'as':_0xc783('0x4c')},{'model':db['SugarcrmField'],'as':_0xc783('0x4f')}]});}return null;})[_0xc783('0x24')](respondWithResult(_0x54b6cc,null))[_0xc783('0x42')](handleError(_0x54b6cc,null));};exports[_0xc783('0x50')]=function(_0x4fb2d6,_0x332b9a,_0x3a6948){var _0x521d96='';var _0x35e754=['id',_0xc783('0x27'),_0xc783('0x51'),_0xc783('0x52'),'description',_0xc783('0x53'),_0xc783('0x54'),_0xc783('0x55'),_0xc783('0x56'),_0xc783('0x57'),'parent_name',_0xc783('0x58')];return db['SugarcrmAccount']['findOne']({'where':{'id':_0x4fb2d6['params']['id']},'attributes':['id','username',_0xc783('0x59'),'remoteUri']})['then'](handleEntityNotFound(_0x332b9a,null))[_0xc783('0x24')](function(_0x16e667){if(_0x16e667){_0x521d96=_0x16e667['remoteUri'];var _0x164527=_0x521d96[_0xc783('0x5a')](-0x1);if(_0x164527==='/'){_0x521d96=_0x521d96[_0xc783('0x5b')](0x0,_0x521d96['lastIndexOf'](_0x164527));}return rp({'method':_0xc783('0x5c'),'uri':util[_0xc783('0x5d')](_0xc783('0x5e'),_0x521d96,_0xc783('0x5f')),'json':!![],'form':{'method':_0xc783('0x60'),'input_type':_0xc783('0x61'),'response_type':'JSON','rest_data':JSON['stringify']({'user_auth':{'user_name':_0x16e667[_0xc783('0x62')],'password':_0x16e667['password'],'encryption':_0xc783('0x63')},'application':_0xc783('0x64')})}});}})[_0xc783('0x24')](function(_0x8108a4){if(_0x8108a4&&_0x8108a4[_0xc783('0x27')]!==_0xc783('0x65')&&_0x8108a4['name']!==_0xc783('0x66')){return rp({'method':_0xc783('0x5c'),'uri':util[_0xc783('0x5d')](_0xc783('0x5e'),_0x521d96,_0xc783('0x5f')),'json':!![],'form':{'method':_0xc783('0x67'),'input_type':_0xc783('0x61'),'response_type':_0xc783('0x61'),'rest_data':JSON[_0xc783('0x68')]({'session':_0x8108a4['id'],'module_name':'Calls'})}})[_0xc783('0x24')](function(_0x3770b5){if(_0x3770b5){var _0x2f3247=_[_0xc783('0x69')](_0x3770b5[_0xc783('0x6a')]);_[_0xc783('0x6b')](_0x2f3247,function(_0x456d42){return _0x35e754[_0xc783('0x6c')](_0x456d42[_0xc783('0x27')]);});return{'count':_0x2f3247[_0xc783('0x33')],'rows':_[_0xc783('0x29')](_0x2f3247,function(_0x5a3e18){return{'id':_0x5a3e18[_0xc783('0x27')],'name':_0x5a3e18[_0xc783('0x6d')],'custom':_[_0xc783('0x6e')](_0x5a3e18['name'],'_c')?!![]:![],'options':_0x5a3e18[_0xc783('0x3d')]?_[_0xc783('0x29')](_['values'](_0x5a3e18['options']),function(_0x361572){return{'name':_0x361572[_0xc783('0x6f')],'value':_0x361572[_0xc783('0x27')]};}):[]};})};}})[_0xc783('0x24')](respondWithResult(_0x332b9a,null))[_0xc783('0x42')](function(_0x57613a){var _0x1364d0=_0x4fb2d6['query'][_0xc783('0x70')]?0x1f4:_0x57613a[_0xc783('0x71')]||0x1f4;logger[_0xc783('0x72')](_0xc783('0x73'),_0xc783('0x50'),_0x1364d0,JSON[_0xc783('0x68')](_0x57613a));delete _0x57613a[_0xc783('0x27')];if(_0x1364d0===0x191){_0x1364d0=0x190;}_0x332b9a[_0xc783('0x18')](_0x1364d0)[_0xc783('0x28')](_0x4fb2d6['query']['test']?{'message':_0xc783('0x74'),'statusCode':_0x57613a[_0xc783('0x71')]}:_0x57613a);});}else{var _0x3cf8e9=0x1f4;_0x332b9a[_0xc783('0x18')](_0x3cf8e9)['send']({'message':_0xc783('0x74'),'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 bd8d388..cf1b479 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 _0x0100=['SugarcrmAccount','int_sugarcrm_accounts','lodash','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','./intSugarcrmAccount.attributes','../../components/integrations/configuration','define'];(function(_0xd370d5,_0x3cdbb9){var _0x1250f2=function(_0x4bb0f8){while(--_0x4bb0f8){_0xd370d5['push'](_0xd370d5['shift']());}};_0x1250f2(++_0x3cdbb9);}(_0x0100,0x7a));var _0x0010=function(_0x1889e8,_0x30b3df){_0x1889e8=_0x1889e8-0x0;var _0x3a8bac=_0x0100[_0x1889e8];return _0x3a8bac;};'use strict';var _=require(_0x0010('0x0'));var util=require('util');var logger=require(_0x0010('0x1'))(_0x0010('0x2'));var moment=require('moment');var BPromise=require(_0x0010('0x3'));var rp=require(_0x0010('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0010('0x5'));var config=require(_0x0010('0x6'));var attributes=require(_0x0010('0x7'));var integrations=require(_0x0010('0x8'));module['exports']=function(_0x2ba276,_0x45a0bc){return _0x2ba276[_0x0010('0x9')](_0x0010('0xa'),attributes,{'tableName':_0x0010('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd758=['../../config/environment','../../components/integrations/configuration','exports','define','SugarcrmAccount','int_sugarcrm_accounts','lodash','util','../../config/logger','api','moment','path','rimraf'];(function(_0x5179a5,_0x419746){var _0x15c8ce=function(_0x1b13c4){while(--_0x1b13c4){_0x5179a5['push'](_0x5179a5['shift']());}};_0x15c8ce(++_0x419746);}(_0xd758,0x172));var _0x8d75=function(_0x18a54e,_0xa8b60c){_0x18a54e=_0x18a54e-0x0;var _0x5cd615=_0xd758[_0x18a54e];return _0x5cd615;};'use strict';var _=require(_0x8d75('0x0'));var util=require(_0x8d75('0x1'));var logger=require(_0x8d75('0x2'))(_0x8d75('0x3'));var moment=require(_0x8d75('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x8d75('0x5'));var rimraf=require(_0x8d75('0x6'));var config=require(_0x8d75('0x7'));var attributes=require('./intSugarcrmAccount.attributes');var integrations=require(_0x8d75('0x8'));module[_0x8d75('0x9')]=function(_0x388960,_0x2c6a33){return _0x388960[_0x8d75('0xa')](_0x8d75('0xb'),attributes,{'tableName':_0x8d75('0xc'),'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 fe14930..f066b92 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 _0x175a=['attributes','include','map','model','catch','ShowSugarcrmAccount','find','where','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','SugarcrmAccount,\x20%s,\x20%s','request\x20sent','debug','SugarcrmAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','GetSugarcrmAccount','SugarcrmAccount','findAll','options','raw'];(function(_0x246f36,_0x47addd){var _0x227f58=function(_0x412bc0){while(--_0x412bc0){_0x246f36['push'](_0x246f36['shift']());}};_0x227f58(++_0x47addd);}(_0x175a,0xc6));var _0xa175=function(_0x54b1d8,_0x3356c5){_0x54b1d8=_0x54b1d8-0x0;var _0x5eeacd=_0x175a[_0x54b1d8];return _0x5eeacd;};'use strict';var _=require(_0xa175('0x0'));var util=require(_0xa175('0x1'));var moment=require(_0xa175('0x2'));var BPromise=require(_0xa175('0x3'));var rs=require(_0xa175('0x4'));var fs=require('fs');var Redis=require(_0xa175('0x5'));var db=require(_0xa175('0x6'))['db'];var utils=require(_0xa175('0x7'));var logger=require(_0xa175('0x8'))(_0xa175('0x9'));var config=require(_0xa175('0xa'));var jayson=require(_0xa175('0xb'));var client=jayson['client'][_0xa175('0xc')]({'port':0x232a});function respondWithRpcPromise(_0xa142db,_0xbeed5b,_0x43a621){return new BPromise(function(_0x16629a,_0x143056){return client[_0xa175('0xd')](_0xa142db,_0x43a621)[_0xa175('0xe')](function(_0x4f47cf){logger[_0xa175('0xf')](_0xa175('0x10'),_0xbeed5b,_0xa175('0x11'));logger[_0xa175('0x12')](_0xa175('0x13'),_0xbeed5b,_0xa175('0x11'),JSON[_0xa175('0x14')](_0x4f47cf));if(_0x4f47cf[_0xa175('0x15')]){if(_0x4f47cf['error'][_0xa175('0x16')]===0x1f4){logger[_0xa175('0x15')](_0xa175('0x10'),_0xbeed5b,_0x4f47cf[_0xa175('0x15')][_0xa175('0x17')]);return _0x143056(_0x4f47cf[_0xa175('0x15')][_0xa175('0x17')]);}logger[_0xa175('0x15')](_0xa175('0x10'),_0xbeed5b,_0x4f47cf['error'][_0xa175('0x17')]);return _0x16629a(_0x4f47cf[_0xa175('0x15')][_0xa175('0x17')]);}else{logger[_0xa175('0xf')](_0xa175('0x10'),_0xbeed5b,_0xa175('0x11'));_0x16629a(_0x4f47cf[_0xa175('0x18')][_0xa175('0x17')]);}})['catch'](function(_0x40b5f0){logger[_0xa175('0x15')](_0xa175('0x10'),_0xbeed5b,_0x40b5f0);_0x143056(_0x40b5f0);});});}exports[_0xa175('0x19')]=function(_0x2576a4){var _0x20cd5d=this;return new Promise(function(_0x11f3c6,_0x32fc2b){return db[_0xa175('0x1a')][_0xa175('0x1b')]({'raw':_0x2576a4[_0xa175('0x1c')]?_0x2576a4[_0xa175('0x1c')][_0xa175('0x1d')]===undefined?!![]:![]:!![],'where':_0x2576a4[_0xa175('0x1c')]?_0x2576a4['options']['where']||null:null,'attributes':_0x2576a4['options']?_0x2576a4[_0xa175('0x1c')][_0xa175('0x1e')]||null:null,'limit':_0x2576a4[_0xa175('0x1c')]?_0x2576a4[_0xa175('0x1c')]['limit']||null:null,'include':_0x2576a4['options']?_0x2576a4[_0xa175('0x1c')][_0xa175('0x1f')]?_[_0xa175('0x20')](_0x2576a4['options'][_0xa175('0x1f')],function(_0x198398){return{'model':db[_0x198398['model']],'as':_0x198398['as'],'attributes':_0x198398[_0xa175('0x1e')],'include':_0x198398[_0xa175('0x1f')]?_[_0xa175('0x20')](_0x198398[_0xa175('0x1f')],function(_0x1a0f3e){return{'model':db[_0x1a0f3e[_0xa175('0x21')]],'as':_0x1a0f3e['as'],'attributes':_0x1a0f3e['attributes'],'include':_0x1a0f3e['include']?_[_0xa175('0x20')](_0x1a0f3e[_0xa175('0x1f')],function(_0x5d30cb){return{'model':db[_0x5d30cb[_0xa175('0x21')]],'as':_0x5d30cb['as'],'attributes':_0x5d30cb['attributes']};}):[]};}):[]};}):[]:[]})[_0xa175('0xe')](function(_0x53b6ce){logger[_0xa175('0xf')](_0xa175('0x19'),_0x2576a4);logger[_0xa175('0x12')]('GetSugarcrmAccount',_0x2576a4,JSON[_0xa175('0x14')](_0x53b6ce));_0x11f3c6(_0x53b6ce);})[_0xa175('0x22')](function(_0xe630ff){logger[_0xa175('0x15')](_0xa175('0x19'),_0xe630ff['message'],_0x2576a4);_0x32fc2b(_0x20cd5d[_0xa175('0x15')](0x1f4,_0xe630ff[_0xa175('0x17')]));});});};exports[_0xa175('0x23')]=function(_0x167f67){var _0x454abb=this;return new Promise(function(_0x3c15b5,_0x2f04a2){return db[_0xa175('0x1a')][_0xa175('0x24')]({'raw':_0x167f67[_0xa175('0x1c')]?_0x167f67['options'][_0xa175('0x1d')]===undefined?!![]:![]:!![],'where':_0x167f67[_0xa175('0x1c')]?_0x167f67[_0xa175('0x1c')][_0xa175('0x25')]||null:null,'attributes':_0x167f67[_0xa175('0x1c')]?_0x167f67[_0xa175('0x1c')][_0xa175('0x1e')]||null:null,'include':_0x167f67[_0xa175('0x1c')]?_0x167f67[_0xa175('0x1c')][_0xa175('0x1f')]?_[_0xa175('0x20')](_0x167f67[_0xa175('0x1c')][_0xa175('0x1f')],function(_0x5396b5){return{'model':db[_0x5396b5['model']],'as':_0x5396b5['as'],'attributes':_0x5396b5['attributes'],'include':_0x5396b5[_0xa175('0x1f')]?_['map'](_0x5396b5[_0xa175('0x1f')],function(_0x4ff745){return{'model':db[_0x4ff745['model']],'as':_0x4ff745['as'],'attributes':_0x4ff745[_0xa175('0x1e')],'include':_0x4ff745[_0xa175('0x1f')]?_['map'](_0x4ff745[_0xa175('0x1f')],function(_0xe79329){return{'model':db[_0xe79329[_0xa175('0x21')]],'as':_0xe79329['as'],'attributes':_0xe79329[_0xa175('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xa175('0xe')](function(_0x4ca35c){logger[_0xa175('0xf')](_0xa175('0x23'),_0x167f67);logger[_0xa175('0x12')](_0xa175('0x23'),_0x167f67,JSON[_0xa175('0x14')](_0x4ca35c));_0x3c15b5(_0x4ca35c);})[_0xa175('0x22')](function(_0x4e08dc){logger['error']('ShowSugarcrmAccount',_0x4e08dc[_0xa175('0x17')],_0x167f67);_0x2f04a2(_0x454abb[_0xa175('0x15')](0x1f4,_0x4e08dc[_0xa175('0x17')]));});});}; \ No newline at end of file +var _0xfb61=['ioredis','../../mysqldb','../../config/utils','../../config/environment','client','http','then','info','SugarcrmAccount,\x20%s,\x20%s','request\x20sent','debug','SugarcrmAccount,\x20%s,\x20%s,\x20%s','error','message','findAll','options','where','attributes','limit','include','model','GetSugarcrmAccount','stringify','catch','ShowSugarcrmAccount','SugarcrmAccount','raw','map','lodash','util','moment','bluebird','randomstring'];(function(_0xe8da69,_0x593b7b){var _0x556581=function(_0xbc31d1){while(--_0xbc31d1){_0xe8da69['push'](_0xe8da69['shift']());}};_0x556581(++_0x593b7b);}(_0xfb61,0x1a8));var _0x1fb6=function(_0x214a25,_0x15071d){_0x214a25=_0x214a25-0x0;var _0x405988=_0xfb61[_0x214a25];return _0x405988;};'use strict';var _=require(_0x1fb6('0x0'));var util=require(_0x1fb6('0x1'));var moment=require(_0x1fb6('0x2'));var BPromise=require(_0x1fb6('0x3'));var rs=require(_0x1fb6('0x4'));var fs=require('fs');var Redis=require(_0x1fb6('0x5'));var db=require(_0x1fb6('0x6'))['db'];var utils=require(_0x1fb6('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0x1fb6('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x1fb6('0x9')][_0x1fb6('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1b528e,_0x255743,_0x2cc31c){return new BPromise(function(_0x2a5568,_0x9f35cd){return client['request'](_0x1b528e,_0x2cc31c)[_0x1fb6('0xb')](function(_0x154b73){logger[_0x1fb6('0xc')](_0x1fb6('0xd'),_0x255743,_0x1fb6('0xe'));logger[_0x1fb6('0xf')](_0x1fb6('0x10'),_0x255743,_0x1fb6('0xe'),JSON['stringify'](_0x154b73));if(_0x154b73[_0x1fb6('0x11')]){if(_0x154b73[_0x1fb6('0x11')]['code']===0x1f4){logger[_0x1fb6('0x11')]('SugarcrmAccount,\x20%s,\x20%s',_0x255743,_0x154b73[_0x1fb6('0x11')][_0x1fb6('0x12')]);return _0x9f35cd(_0x154b73[_0x1fb6('0x11')][_0x1fb6('0x12')]);}logger[_0x1fb6('0x11')](_0x1fb6('0xd'),_0x255743,_0x154b73[_0x1fb6('0x11')][_0x1fb6('0x12')]);return _0x2a5568(_0x154b73[_0x1fb6('0x11')][_0x1fb6('0x12')]);}else{logger[_0x1fb6('0xc')](_0x1fb6('0xd'),_0x255743,_0x1fb6('0xe'));_0x2a5568(_0x154b73['result'][_0x1fb6('0x12')]);}})['catch'](function(_0x238332){logger[_0x1fb6('0x11')]('SugarcrmAccount,\x20%s,\x20%s',_0x255743,_0x238332);_0x9f35cd(_0x238332);});});}exports['GetSugarcrmAccount']=function(_0x4ed0d1){var _0x11480c=this;return new Promise(function(_0x4ce97d,_0x13c8e8){return db['SugarcrmAccount'][_0x1fb6('0x13')]({'raw':_0x4ed0d1[_0x1fb6('0x14')]?_0x4ed0d1['options']['raw']===undefined?!![]:![]:!![],'where':_0x4ed0d1[_0x1fb6('0x14')]?_0x4ed0d1[_0x1fb6('0x14')][_0x1fb6('0x15')]||null:null,'attributes':_0x4ed0d1['options']?_0x4ed0d1[_0x1fb6('0x14')][_0x1fb6('0x16')]||null:null,'limit':_0x4ed0d1[_0x1fb6('0x14')]?_0x4ed0d1[_0x1fb6('0x14')][_0x1fb6('0x17')]||null:null,'include':_0x4ed0d1[_0x1fb6('0x14')]?_0x4ed0d1[_0x1fb6('0x14')][_0x1fb6('0x18')]?_['map'](_0x4ed0d1[_0x1fb6('0x14')][_0x1fb6('0x18')],function(_0x346c6f){return{'model':db[_0x346c6f[_0x1fb6('0x19')]],'as':_0x346c6f['as'],'attributes':_0x346c6f['attributes'],'include':_0x346c6f[_0x1fb6('0x18')]?_['map'](_0x346c6f[_0x1fb6('0x18')],function(_0x40e9e8){return{'model':db[_0x40e9e8[_0x1fb6('0x19')]],'as':_0x40e9e8['as'],'attributes':_0x40e9e8[_0x1fb6('0x16')],'include':_0x40e9e8[_0x1fb6('0x18')]?_['map'](_0x40e9e8[_0x1fb6('0x18')],function(_0x16f236){return{'model':db[_0x16f236['model']],'as':_0x16f236['as'],'attributes':_0x16f236[_0x1fb6('0x16')]};}):[]};}):[]};}):[]:[]})[_0x1fb6('0xb')](function(_0x4bf959){logger[_0x1fb6('0xc')](_0x1fb6('0x1a'),_0x4ed0d1);logger[_0x1fb6('0xf')](_0x1fb6('0x1a'),_0x4ed0d1,JSON[_0x1fb6('0x1b')](_0x4bf959));_0x4ce97d(_0x4bf959);})[_0x1fb6('0x1c')](function(_0x1de203){logger['error']('GetSugarcrmAccount',_0x1de203[_0x1fb6('0x12')],_0x4ed0d1);_0x13c8e8(_0x11480c['error'](0x1f4,_0x1de203[_0x1fb6('0x12')]));});});};exports[_0x1fb6('0x1d')]=function(_0x1352dc){var _0x4aaa71=this;return new Promise(function(_0x42dde9,_0x4341c1){return db[_0x1fb6('0x1e')]['find']({'raw':_0x1352dc[_0x1fb6('0x14')]?_0x1352dc['options'][_0x1fb6('0x1f')]===undefined?!![]:![]:!![],'where':_0x1352dc['options']?_0x1352dc[_0x1fb6('0x14')][_0x1fb6('0x15')]||null:null,'attributes':_0x1352dc[_0x1fb6('0x14')]?_0x1352dc[_0x1fb6('0x14')]['attributes']||null:null,'include':_0x1352dc[_0x1fb6('0x14')]?_0x1352dc[_0x1fb6('0x14')][_0x1fb6('0x18')]?_[_0x1fb6('0x20')](_0x1352dc[_0x1fb6('0x14')]['include'],function(_0xf3034b){return{'model':db[_0xf3034b[_0x1fb6('0x19')]],'as':_0xf3034b['as'],'attributes':_0xf3034b[_0x1fb6('0x16')],'include':_0xf3034b[_0x1fb6('0x18')]?_[_0x1fb6('0x20')](_0xf3034b['include'],function(_0x5f5127){return{'model':db[_0x5f5127[_0x1fb6('0x19')]],'as':_0x5f5127['as'],'attributes':_0x5f5127['attributes'],'include':_0x5f5127['include']?_['map'](_0x5f5127[_0x1fb6('0x18')],function(_0x152bba){return{'model':db[_0x152bba['model']],'as':_0x152bba['as'],'attributes':_0x152bba[_0x1fb6('0x16')]};}):[]};}):[]};}):[]:[]})[_0x1fb6('0xb')](function(_0x4f9779){logger[_0x1fb6('0xc')](_0x1fb6('0x1d'),_0x1352dc);logger[_0x1fb6('0xf')](_0x1fb6('0x1d'),_0x1352dc,JSON[_0x1fb6('0x1b')](_0x4f9779));_0x42dde9(_0x4f9779);})[_0x1fb6('0x1c')](function(_0x23e4b3){logger[_0x1fb6('0x11')](_0x1fb6('0x1d'),_0x23e4b3[_0x1fb6('0x12')],_0x1352dc);_0x4341c1(_0x4aaa71[_0x1fb6('0x11')](0x1f4,_0x23e4b3[_0x1fb6('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/index.js b/server/api/intSugarcrmConfiguration/index.js index a09f462..33f5ff7 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 _0x070e=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmConfiguration.controller','get','index','/:id','isAuthenticated','getFields','/:id/subjects','/:id/descriptions','post','create','put','update','delete','destroy','exports','multer','path','connect-timeout','express'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x070e,0xcb));var _0xe070=function(_0x5400e3,_0x498ca5){_0x5400e3=_0x5400e3-0x0;var _0x2e34c=_0x070e[_0x5400e3];return _0x2e34c;};'use strict';var multer=require(_0xe070('0x0'));var util=require('util');var path=require(_0xe070('0x1'));var timeout=require(_0xe070('0x2'));var express=require(_0xe070('0x3'));var router=express['Router']();var fs_extra=require(_0xe070('0x4'));var auth=require(_0xe070('0x5'));var interaction=require(_0xe070('0x6'));var config=require(_0xe070('0x7'));var controller=require(_0xe070('0x8'));router[_0xe070('0x9')]('/',auth['isAuthenticated'](),controller[_0xe070('0xa')]);router[_0xe070('0x9')](_0xe070('0xb'),auth[_0xe070('0xc')](),controller['show']);router['get']('/:id/fields',auth[_0xe070('0xc')](),controller[_0xe070('0xd')]);router[_0xe070('0x9')](_0xe070('0xe'),auth[_0xe070('0xc')](),controller['getSubjects']);router[_0xe070('0x9')](_0xe070('0xf'),auth[_0xe070('0xc')](),controller['getDescriptions']);router[_0xe070('0x10')]('/',auth['isAuthenticated'](),controller[_0xe070('0x11')]);router[_0xe070('0x12')]('/:id',auth[_0xe070('0xc')](),controller[_0xe070('0x13')]);router[_0xe070('0x14')](_0xe070('0xb'),auth['isAuthenticated'](),controller[_0xe070('0x15')]);module[_0xe070('0x16')]=router; \ No newline at end of file +var _0x525f=['destroy','multer','connect-timeout','Router','../../components/interaction/service','../../config/environment','get','index','/:id','isAuthenticated','show','/:id/fields','getFields','/:id/subjects','/:id/descriptions','post','put','update','delete'];(function(_0x5bb65,_0x2c8602){var _0x5a56dd=function(_0x15fbdc){while(--_0x15fbdc){_0x5bb65['push'](_0x5bb65['shift']());}};_0x5a56dd(++_0x2c8602);}(_0x525f,0x1dc));var _0xf525=function(_0x4afb4a,_0x32fa2c){_0x4afb4a=_0x4afb4a-0x0;var _0x5ccfea=_0x525f[_0x4afb4a];return _0x5ccfea;};'use strict';var multer=require(_0xf525('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xf525('0x1'));var express=require('express');var router=express[_0xf525('0x2')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xf525('0x3'));var config=require(_0xf525('0x4'));var controller=require('./intSugarcrmConfiguration.controller');router[_0xf525('0x5')]('/',auth['isAuthenticated'](),controller[_0xf525('0x6')]);router[_0xf525('0x5')](_0xf525('0x7'),auth[_0xf525('0x8')](),controller[_0xf525('0x9')]);router['get'](_0xf525('0xa'),auth[_0xf525('0x8')](),controller[_0xf525('0xb')]);router[_0xf525('0x5')](_0xf525('0xc'),auth[_0xf525('0x8')](),controller['getSubjects']);router[_0xf525('0x5')](_0xf525('0xd'),auth[_0xf525('0x8')](),controller['getDescriptions']);router[_0xf525('0xe')]('/',auth[_0xf525('0x8')](),controller['create']);router[_0xf525('0xf')](_0xf525('0x7'),auth['isAuthenticated'](),controller[_0xf525('0x10')]);router[_0xf525('0x11')](_0xf525('0x7'),auth['isAuthenticated'](),controller[_0xf525('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js index 393f63d..50b5b86 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 _0x3b2c=['sequelize','exports','STRING'];(function(_0x46b1b8,_0x4c310b){var _0x583b24=function(_0x2d756c){while(--_0x2d756c){_0x46b1b8['push'](_0x46b1b8['shift']());}};_0x583b24(++_0x4c310b);}(_0x3b2c,0x13e));var _0xc3b2=function(_0x1b8adf,_0x4b218b){_0x1b8adf=_0x1b8adf-0x0;var _0x14943e=_0x3b2c[_0x1b8adf];return _0x14943e;};'use strict';var Sequelize=require(_0xc3b2('0x0'));module[_0xc3b2('0x1')]={'name':{'type':Sequelize[_0xc3b2('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x958f=['STRING','sequelize','exports'];(function(_0x4cf98e,_0xba4b79){var _0x1623ac=function(_0x459bc0){while(--_0x459bc0){_0x4cf98e['push'](_0x4cf98e['shift']());}};_0x1623ac(++_0xba4b79);}(_0x958f,0x79));var _0xf958=function(_0x2dadb9,_0x42cfe6){_0x2dadb9=_0x2dadb9-0x0;var _0x2f0097=_0x958f[_0x2dadb9];return _0x2f0097;};'use strict';var Sequelize=require(_0xf958('0x0'));module[_0xf958('0x1')]={'name':{'type':Sequelize[_0xf958('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js index efb4597..b323d32 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 _0x12c7=['filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','params','create','body','find','getFields','findOne','SugarcrmField','order','getSubjects','nolimit','getDescriptions','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','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/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','error','stack','send','map','SugarcrmConfiguration','rawAttributes','fieldName','type','key','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','sort','where','filters','pick'];(function(_0x105598,_0xe7dd46){var _0x1b8b5a=function(_0x3fb5a2){while(--_0x3fb5a2){_0x105598['push'](_0x105598['shift']());}};_0x1b8b5a(++_0xe7dd46);}(_0x12c7,0x107));var _0x712c=function(_0x16aca7,_0x26e217){_0x16aca7=_0x16aca7-0x0;var _0x32099c=_0x12c7[_0x16aca7];return _0x32099c;};'use strict';var emlformat=require(_0x712c('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x712c('0x1'));var rp=require(_0x712c('0x2'));var moment=require(_0x712c('0x3'));var BPromise=require(_0x712c('0x4'));var Mustache=require(_0x712c('0x5'));var util=require('util');var path=require(_0x712c('0x6'));var sox=require(_0x712c('0x7'));var csv=require(_0x712c('0x8'));var ejs=require(_0x712c('0x9'));var fs=require('fs');var fs_extra=require(_0x712c('0xa'));var _=require(_0x712c('0xb'));var squel=require(_0x712c('0xc'));var crypto=require(_0x712c('0xd'));var jsforce=require(_0x712c('0xe'));var deskjs=require(_0x712c('0xf'));var toCsv=require(_0x712c('0x8'));var querystring=require('querystring');var Papa=require(_0x712c('0x10'));var Redis=require(_0x712c('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x712c('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x712c('0x13'));var logger=require(_0x712c('0x14'))(_0x712c('0x15'));var utils=require(_0x712c('0x16'));var config=require(_0x712c('0x17'));var licenseUtil=require(_0x712c('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4a2cf8,_0x32077d){_0x32077d=_0x32077d||0xcc;return function(_0x12956f){if(_0x12956f){return _0x4a2cf8[_0x712c('0x19')](_0x32077d);}return _0x4a2cf8[_0x712c('0x1a')](_0x32077d)[_0x712c('0x1b')]();};}function respondWithResult(_0x2d0d8a,_0x4b8849){_0x4b8849=_0x4b8849||0xc8;return function(_0x239278){if(_0x239278){return _0x2d0d8a[_0x712c('0x1a')](_0x4b8849)[_0x712c('0x1c')](_0x239278);}};}function respondWithFilteredResult(_0x4d5845,_0xb6806a){return function(_0x393716){if(_0x393716){var _0x231ebc=typeof _0xb6806a[_0x712c('0x1d')]===_0x712c('0x1e')&&typeof _0xb6806a[_0x712c('0x1f')]===_0x712c('0x1e');var _0x5df1bd=_0x393716['count'];var _0x5a22de=_0x231ebc?0x0:_0xb6806a['offset'];var _0x11e3f9=_0x231ebc?_0x393716[_0x712c('0x20')]:_0xb6806a[_0x712c('0x1d')]+_0xb6806a[_0x712c('0x1f')];var _0x1e274a;if(_0x11e3f9>=_0x5df1bd){_0x11e3f9=_0x5df1bd;_0x1e274a=0xc8;}else{_0x1e274a=0xce;}_0x4d5845[_0x712c('0x1a')](_0x1e274a);return _0x4d5845[_0x712c('0x21')]('Content-Range',_0x5a22de+'-'+_0x11e3f9+'/'+_0x5df1bd)[_0x712c('0x1c')](_0x393716);}return null;};}function patchUpdates(_0x3614f4){return function(_0xf5525f){try{jsonpatch[_0x712c('0x22')](_0xf5525f,_0x3614f4,!![]);}catch(_0x49632c){return BPromise[_0x712c('0x23')](_0x49632c);}return _0xf5525f[_0x712c('0x24')]();};}function saveUpdates(_0x3fdc74,_0x211b0f){return function(_0x33395c){if(_0x33395c){return _0x33395c[_0x712c('0x25')](_0x3fdc74)[_0x712c('0x26')](function(_0x31cacd){return _0x31cacd;});}return null;};}function removeEntity(_0x31404c,_0x211f84){return function(_0x1cfbcd){if(_0x1cfbcd){return _0x1cfbcd[_0x712c('0x27')]()['then'](function(){_0x31404c[_0x712c('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x870fb2,_0x501be5){return function(_0x4b759f){if(!_0x4b759f){_0x870fb2[_0x712c('0x19')](0x194);}return _0x4b759f;};}function handleError(_0x458c07,_0x18b59e){_0x18b59e=_0x18b59e||0x1f4;return function(_0x39a55d){logger[_0x712c('0x28')](_0x39a55d[_0x712c('0x29')]);if(_0x39a55d['name']){delete _0x39a55d['name'];}_0x458c07['status'](_0x18b59e)[_0x712c('0x2a')](_0x39a55d);};}exports['index']=function(_0xc2cbdf,_0x4f7bde){var _0x3b0ccd={},_0x51e406={},_0x4387a0={'count':0x0,'rows':[]};var _0x55a196=_[_0x712c('0x2b')](db[_0x712c('0x2c')][_0x712c('0x2d')],function(_0x37c7bf){return{'name':_0x37c7bf[_0x712c('0x2e')],'type':_0x37c7bf[_0x712c('0x2f')][_0x712c('0x30')]};});_0x51e406['model']=_[_0x712c('0x2b')](_0x55a196,'name');_0x51e406[_0x712c('0x31')]=_[_0x712c('0x32')](_0xc2cbdf[_0x712c('0x31')]);_0x51e406['filters']=_[_0x712c('0x33')](_0x51e406[_0x712c('0x34')],_0x51e406[_0x712c('0x31')]);_0x3b0ccd[_0x712c('0x35')]=_[_0x712c('0x33')](_0x51e406[_0x712c('0x34')],qs[_0x712c('0x36')](_0xc2cbdf[_0x712c('0x31')]['fields']));_0x3b0ccd['attributes']=_0x3b0ccd[_0x712c('0x35')][_0x712c('0x37')]?_0x3b0ccd[_0x712c('0x35')]:_0x51e406[_0x712c('0x34')];if(!_0xc2cbdf[_0x712c('0x31')][_0x712c('0x38')]('nolimit')){_0x3b0ccd[_0x712c('0x1f')]=qs[_0x712c('0x1f')](_0xc2cbdf[_0x712c('0x31')][_0x712c('0x1f')]);_0x3b0ccd[_0x712c('0x1d')]=qs[_0x712c('0x1d')](_0xc2cbdf['query'][_0x712c('0x1d')]);}_0x3b0ccd['order']=qs['sort'](_0xc2cbdf[_0x712c('0x31')][_0x712c('0x39')]);_0x3b0ccd[_0x712c('0x3a')]=qs[_0x712c('0x3b')](_[_0x712c('0x3c')](_0xc2cbdf['query'],_0x51e406['filters']),_0x55a196);if(_0xc2cbdf[_0x712c('0x31')][_0x712c('0x3d')]){_0x3b0ccd['where']=_[_0x712c('0x3e')](_0x3b0ccd[_0x712c('0x3a')],{'$or':_[_0x712c('0x2b')](_0x55a196,function(_0xcbe83d){if(_0xcbe83d[_0x712c('0x2f')]!==_0x712c('0x3f')){var _0x40d8a3={};_0x40d8a3[_0xcbe83d['name']]={'$like':'%'+_0xc2cbdf['query'][_0x712c('0x3d')]+'%'};return _0x40d8a3;}})});}_0x3b0ccd=_[_0x712c('0x3e')]({},_0x3b0ccd,_0xc2cbdf[_0x712c('0x40')]);var _0x2e1275={'where':_0x3b0ccd[_0x712c('0x3a')]};return db[_0x712c('0x2c')]['count'](_0x2e1275)[_0x712c('0x26')](function(_0x494afb){_0x4387a0[_0x712c('0x20')]=_0x494afb;if(_0xc2cbdf['query'][_0x712c('0x41')]){_0x3b0ccd[_0x712c('0x42')]=[{'all':!![]}];}return db[_0x712c('0x2c')][_0x712c('0x43')](_0x3b0ccd);})['then'](function(_0x5ec59e){_0x4387a0['rows']=_0x5ec59e;return _0x4387a0;})[_0x712c('0x26')](respondWithFilteredResult(_0x4f7bde,_0x3b0ccd))[_0x712c('0x44')](handleError(_0x4f7bde,null));};exports[_0x712c('0x45')]=function(_0x280f1b,_0x27e90e){var _0x1a4aca={'raw':![],'where':{'id':_0x280f1b[_0x712c('0x46')]['id']}},_0x639317={};_0x639317[_0x712c('0x34')]=_[_0x712c('0x32')](db[_0x712c('0x2c')][_0x712c('0x2d')]);_0x639317[_0x712c('0x31')]=_[_0x712c('0x32')](_0x280f1b[_0x712c('0x31')]);_0x639317[_0x712c('0x3b')]=_[_0x712c('0x33')](_0x639317[_0x712c('0x34')],_0x639317[_0x712c('0x31')]);_0x1a4aca[_0x712c('0x35')]=_[_0x712c('0x33')](_0x639317[_0x712c('0x34')],qs[_0x712c('0x36')](_0x280f1b[_0x712c('0x31')][_0x712c('0x36')]));_0x1a4aca['attributes']=_0x1a4aca[_0x712c('0x35')][_0x712c('0x37')]?_0x1a4aca[_0x712c('0x35')]:_0x639317[_0x712c('0x34')];if(_0x280f1b['query']['includeAll']){_0x1a4aca[_0x712c('0x42')]=[{'all':!![]}];}_0x1a4aca=_[_0x712c('0x3e')]({},_0x1a4aca,_0x280f1b['options']);return db[_0x712c('0x2c')]['find'](_0x1a4aca)[_0x712c('0x26')](handleEntityNotFound(_0x27e90e,null))[_0x712c('0x26')](respondWithResult(_0x27e90e,null))['catch'](handleError(_0x27e90e,null));};exports[_0x712c('0x47')]=function(_0x4d28e5,_0x2e68e4){return db[_0x712c('0x2c')][_0x712c('0x47')](_0x4d28e5[_0x712c('0x48')],{})['then'](respondWithResult(_0x2e68e4,0xc9))[_0x712c('0x44')](handleError(_0x2e68e4,null));};exports[_0x712c('0x25')]=function(_0x15f320,_0x3b31c1){if(_0x15f320['body']['id']){delete _0x15f320[_0x712c('0x48')]['id'];}return db[_0x712c('0x2c')][_0x712c('0x49')]({'where':{'id':_0x15f320[_0x712c('0x46')]['id']}})[_0x712c('0x26')](handleEntityNotFound(_0x3b31c1,null))[_0x712c('0x26')](saveUpdates(_0x15f320['body'],null))[_0x712c('0x26')](respondWithResult(_0x3b31c1,null))['catch'](handleError(_0x3b31c1,null));};exports['destroy']=function(_0x5c5efc,_0xe28722){return db[_0x712c('0x2c')][_0x712c('0x49')]({'where':{'id':_0x5c5efc[_0x712c('0x46')]['id']}})[_0x712c('0x26')](handleEntityNotFound(_0xe28722,null))['then'](removeEntity(_0xe28722,null))[_0x712c('0x44')](handleError(_0xe28722,null));};exports[_0x712c('0x4a')]=function(_0x108f5d,_0x4a5034,_0x293c75){var _0x4b15a4={};var _0x441c9a={};var _0x3fcaad;var _0xa00c40;return db['SugarcrmConfiguration'][_0x712c('0x4b')]({'where':{'id':_0x108f5d[_0x712c('0x46')]['id']}})[_0x712c('0x26')](handleEntityNotFound(_0x4a5034,null))['then'](function(_0x2044c4){if(_0x2044c4){_0x3fcaad=_0x2044c4;_0x441c9a['model']=_[_0x712c('0x32')](db['SugarcrmField']['rawAttributes']);_0x441c9a['query']=_[_0x712c('0x32')](_0x108f5d[_0x712c('0x31')]);_0x441c9a['filters']=_[_0x712c('0x33')](_0x441c9a['model'],_0x441c9a[_0x712c('0x31')]);_0x4b15a4[_0x712c('0x35')]=_[_0x712c('0x33')](_0x441c9a['model'],qs[_0x712c('0x36')](_0x108f5d['query']['fields']));_0x4b15a4[_0x712c('0x35')]=_0x4b15a4[_0x712c('0x35')][_0x712c('0x37')]?_0x4b15a4[_0x712c('0x35')]:_0x441c9a[_0x712c('0x34')];_0x4b15a4['order']=qs[_0x712c('0x39')](_0x108f5d[_0x712c('0x31')][_0x712c('0x39')]);_0x4b15a4[_0x712c('0x3a')]=qs[_0x712c('0x3b')](_[_0x712c('0x3c')](_0x108f5d[_0x712c('0x31')],_0x441c9a[_0x712c('0x3b')]));if(_0x108f5d['query'][_0x712c('0x3d')]){_0x4b15a4['where']=_['merge'](_0x4b15a4['where'],{'$or':_['map'](_0x4b15a4[_0x712c('0x35')],function(_0x4e5221){var _0x34fb5b={};_0x34fb5b[_0x4e5221]={'$like':'%'+_0x108f5d[_0x712c('0x31')][_0x712c('0x3d')]+'%'};return _0x34fb5b;})});}_0x4b15a4=_[_0x712c('0x3e')]({},_0x4b15a4,_0x108f5d[_0x712c('0x40')]);return _0x3fcaad['getFields'](_0x4b15a4);}})[_0x712c('0x26')](function(_0x548cf3){if(_0x548cf3){_0xa00c40=_0x548cf3[_0x712c('0x37')];if(!_0x108f5d['query'][_0x712c('0x38')]('nolimit')){_0x4b15a4[_0x712c('0x1f')]=qs[_0x712c('0x1f')](_0x108f5d[_0x712c('0x31')][_0x712c('0x1f')]);_0x4b15a4['offset']=qs[_0x712c('0x1d')](_0x108f5d['query'][_0x712c('0x1d')]);}return _0x3fcaad[_0x712c('0x4a')](_0x4b15a4);}})[_0x712c('0x26')](function(_0x3e2552){if(_0x3e2552){return _0x3e2552?{'count':_0xa00c40,'rows':_0x3e2552}:null;}})['then'](respondWithResult(_0x4a5034,null))[_0x712c('0x44')](handleError(_0x4a5034,null));};exports['getSubjects']=function(_0x137310,_0x2b6d10,_0x33b165){var _0x42174a={};var _0x1c09c7={};var _0x35ad94;var _0x4e25fd;return db[_0x712c('0x2c')][_0x712c('0x4b')]({'where':{'id':_0x137310[_0x712c('0x46')]['id']}})[_0x712c('0x26')](handleEntityNotFound(_0x2b6d10,null))[_0x712c('0x26')](function(_0x3303cb){if(_0x3303cb){_0x35ad94=_0x3303cb;_0x1c09c7['model']=_['keys'](db[_0x712c('0x4c')][_0x712c('0x2d')]);_0x1c09c7[_0x712c('0x31')]=_['keys'](_0x137310[_0x712c('0x31')]);_0x1c09c7[_0x712c('0x3b')]=_[_0x712c('0x33')](_0x1c09c7['model'],_0x1c09c7['query']);_0x42174a[_0x712c('0x35')]=_[_0x712c('0x33')](_0x1c09c7[_0x712c('0x34')],qs[_0x712c('0x36')](_0x137310[_0x712c('0x31')]['fields']));_0x42174a[_0x712c('0x35')]=_0x42174a[_0x712c('0x35')]['length']?_0x42174a[_0x712c('0x35')]:_0x1c09c7[_0x712c('0x34')];_0x42174a[_0x712c('0x4d')]=qs[_0x712c('0x39')](_0x137310[_0x712c('0x31')][_0x712c('0x39')]);_0x42174a[_0x712c('0x3a')]=qs[_0x712c('0x3b')](_[_0x712c('0x3c')](_0x137310[_0x712c('0x31')],_0x1c09c7[_0x712c('0x3b')]));if(_0x137310[_0x712c('0x31')]['filter']){_0x42174a[_0x712c('0x3a')]=_[_0x712c('0x3e')](_0x42174a['where'],{'$or':_[_0x712c('0x2b')](_0x42174a[_0x712c('0x35')],function(_0x1a7cf4){var _0x42387d={};_0x42387d[_0x1a7cf4]={'$like':'%'+_0x137310['query'][_0x712c('0x3d')]+'%'};return _0x42387d;})});}_0x42174a=_[_0x712c('0x3e')]({},_0x42174a,_0x137310[_0x712c('0x40')]);return _0x35ad94[_0x712c('0x4e')](_0x42174a);}})[_0x712c('0x26')](function(_0x1ce018){if(_0x1ce018){_0x4e25fd=_0x1ce018[_0x712c('0x37')];if(!_0x137310[_0x712c('0x31')]['hasOwnProperty'](_0x712c('0x4f'))){_0x42174a[_0x712c('0x1f')]=qs['limit'](_0x137310['query'][_0x712c('0x1f')]);_0x42174a[_0x712c('0x1d')]=qs[_0x712c('0x1d')](_0x137310[_0x712c('0x31')]['offset']);}return _0x35ad94[_0x712c('0x4e')](_0x42174a);}})['then'](function(_0x574660){if(_0x574660){return _0x574660?{'count':_0x4e25fd,'rows':_0x574660}:null;}})[_0x712c('0x26')](respondWithResult(_0x2b6d10,null))[_0x712c('0x44')](handleError(_0x2b6d10,null));};exports[_0x712c('0x50')]=function(_0x88fd9,_0x11b928,_0x4b3880){var _0x276ade={};var _0x46f6e5={};var _0x11f94c;var _0x5def84;return db['SugarcrmConfiguration'][_0x712c('0x4b')]({'where':{'id':_0x88fd9[_0x712c('0x46')]['id']}})[_0x712c('0x26')](handleEntityNotFound(_0x11b928,null))[_0x712c('0x26')](function(_0x1e7042){if(_0x1e7042){_0x11f94c=_0x1e7042;_0x46f6e5[_0x712c('0x34')]=_[_0x712c('0x32')](db[_0x712c('0x4c')][_0x712c('0x2d')]);_0x46f6e5['query']=_[_0x712c('0x32')](_0x88fd9[_0x712c('0x31')]);_0x46f6e5['filters']=_['intersection'](_0x46f6e5['model'],_0x46f6e5[_0x712c('0x31')]);_0x276ade[_0x712c('0x35')]=_[_0x712c('0x33')](_0x46f6e5['model'],qs[_0x712c('0x36')](_0x88fd9[_0x712c('0x31')][_0x712c('0x36')]));_0x276ade[_0x712c('0x35')]=_0x276ade['attributes'][_0x712c('0x37')]?_0x276ade[_0x712c('0x35')]:_0x46f6e5['model'];_0x276ade[_0x712c('0x4d')]=qs['sort'](_0x88fd9[_0x712c('0x31')][_0x712c('0x39')]);_0x276ade[_0x712c('0x3a')]=qs['filters'](_[_0x712c('0x3c')](_0x88fd9[_0x712c('0x31')],_0x46f6e5['filters']));if(_0x88fd9[_0x712c('0x31')][_0x712c('0x3d')]){_0x276ade[_0x712c('0x3a')]=_[_0x712c('0x3e')](_0x276ade['where'],{'$or':_[_0x712c('0x2b')](_0x276ade[_0x712c('0x35')],function(_0x3d0074){var _0x23876c={};_0x23876c[_0x3d0074]={'$like':'%'+_0x88fd9[_0x712c('0x31')][_0x712c('0x3d')]+'%'};return _0x23876c;})});}_0x276ade=_[_0x712c('0x3e')]({},_0x276ade,_0x88fd9[_0x712c('0x40')]);return _0x11f94c['getDescriptions'](_0x276ade);}})[_0x712c('0x26')](function(_0x337b19){if(_0x337b19){_0x5def84=_0x337b19[_0x712c('0x37')];if(!_0x88fd9[_0x712c('0x31')][_0x712c('0x38')](_0x712c('0x4f'))){_0x276ade['limit']=qs['limit'](_0x88fd9[_0x712c('0x31')]['limit']);_0x276ade[_0x712c('0x1d')]=qs[_0x712c('0x1d')](_0x88fd9[_0x712c('0x31')][_0x712c('0x1d')]);}return _0x11f94c['getDescriptions'](_0x276ade);}})[_0x712c('0x26')](function(_0x14bbf4){if(_0x14bbf4){return _0x14bbf4?{'count':_0x5def84,'rows':_0x14bbf4}:null;}})['then'](respondWithResult(_0x11b928,null))[_0x712c('0x44')](handleError(_0x11b928,null));}; \ No newline at end of file +var _0xdfe9=['stack','name','send','index','rawAttributes','type','key','model','map','query','keys','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filters','pick','merge','VIRTUAL','filter','options','SugarcrmConfiguration','include','findAll','rows','show','params','includeAll','catch','create','body','find','getFields','findOne','SugarcrmField','nolimit','getSubjects','getDescriptions','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','undefined','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy'];(function(_0x2bb930,_0xe92f28){var _0x4a7d19=function(_0x31d554){while(--_0x31d554){_0x2bb930['push'](_0x2bb930['shift']());}};_0x4a7d19(++_0xe92f28);}(_0xdfe9,0x7a));var _0x9dfe=function(_0x168148,_0x22e633){_0x168148=_0x168148-0x0;var _0xbb73a3=_0xdfe9[_0x168148];return _0xbb73a3;};'use strict';var emlformat=require(_0x9dfe('0x0'));var rimraf=require(_0x9dfe('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x9dfe('0x2'));var rp=require(_0x9dfe('0x3'));var moment=require(_0x9dfe('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x9dfe('0x5'));var util=require(_0x9dfe('0x6'));var path=require(_0x9dfe('0x7'));var sox=require(_0x9dfe('0x8'));var csv=require(_0x9dfe('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9dfe('0xa'));var _=require(_0x9dfe('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x9dfe('0xc'));var toCsv=require(_0x9dfe('0x9'));var querystring=require(_0x9dfe('0xd'));var Papa=require('papaparse');var Redis=require(_0x9dfe('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x9dfe('0xf'));var as=require(_0x9dfe('0x10'));var hardwareService=require(_0x9dfe('0x11'));var logger=require(_0x9dfe('0x12'))('api');var utils=require(_0x9dfe('0x13'));var config=require(_0x9dfe('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x9dfe('0x15'))['db'];function respondWithStatusCode(_0x379204,_0x41beb8){_0x41beb8=_0x41beb8||0xcc;return function(_0x95cf71){if(_0x95cf71){return _0x379204[_0x9dfe('0x16')](_0x41beb8);}return _0x379204[_0x9dfe('0x17')](_0x41beb8)[_0x9dfe('0x18')]();};}function respondWithResult(_0x667204,_0x5723e9){_0x5723e9=_0x5723e9||0xc8;return function(_0x531a7a){if(_0x531a7a){return _0x667204[_0x9dfe('0x17')](_0x5723e9)[_0x9dfe('0x19')](_0x531a7a);}};}function respondWithFilteredResult(_0x4fa241,_0x2f147d){return function(_0x33c2b9){if(_0x33c2b9){var _0x5e3f70=typeof _0x2f147d['offset']==='undefined'&&typeof _0x2f147d['limit']===_0x9dfe('0x1a');var _0x413ee5=_0x33c2b9[_0x9dfe('0x1b')];var _0x1470eb=_0x5e3f70?0x0:_0x2f147d[_0x9dfe('0x1c')];var _0x391448=_0x5e3f70?_0x33c2b9[_0x9dfe('0x1b')]:_0x2f147d[_0x9dfe('0x1c')]+_0x2f147d[_0x9dfe('0x1d')];var _0x597255;if(_0x391448>=_0x413ee5){_0x391448=_0x413ee5;_0x597255=0xc8;}else{_0x597255=0xce;}_0x4fa241[_0x9dfe('0x17')](_0x597255);return _0x4fa241[_0x9dfe('0x1e')](_0x9dfe('0x1f'),_0x1470eb+'-'+_0x391448+'/'+_0x413ee5)[_0x9dfe('0x19')](_0x33c2b9);}return null;};}function patchUpdates(_0xe635a7){return function(_0x5b3507){try{jsonpatch[_0x9dfe('0x20')](_0x5b3507,_0xe635a7,!![]);}catch(_0x86e40f){return BPromise[_0x9dfe('0x21')](_0x86e40f);}return _0x5b3507[_0x9dfe('0x22')]();};}function saveUpdates(_0x1b777e,_0x1db687){return function(_0x439883){if(_0x439883){return _0x439883[_0x9dfe('0x23')](_0x1b777e)[_0x9dfe('0x24')](function(_0x3ae2a2){return _0x3ae2a2;});}return null;};}function removeEntity(_0x3c6f57,_0x3ef2e8){return function(_0x28051a){if(_0x28051a){return _0x28051a[_0x9dfe('0x25')]()['then'](function(){_0x3c6f57[_0x9dfe('0x17')](0xcc)[_0x9dfe('0x18')]();});}};}function handleEntityNotFound(_0x319336,_0x42af12){return function(_0x4fce8f){if(!_0x4fce8f){_0x319336['sendStatus'](0x194);}return _0x4fce8f;};}function handleError(_0x56733f,_0x425a9a){_0x425a9a=_0x425a9a||0x1f4;return function(_0x2d5998){logger['error'](_0x2d5998[_0x9dfe('0x26')]);if(_0x2d5998[_0x9dfe('0x27')]){delete _0x2d5998[_0x9dfe('0x27')];}_0x56733f[_0x9dfe('0x17')](_0x425a9a)[_0x9dfe('0x28')](_0x2d5998);};}exports[_0x9dfe('0x29')]=function(_0xba12e7,_0x44c101){var _0x36b23a={},_0x47dd04={},_0x3b3f96={'count':0x0,'rows':[]};var _0x48fd0f=_['map'](db['SugarcrmConfiguration'][_0x9dfe('0x2a')],function(_0x83c4b7){return{'name':_0x83c4b7['fieldName'],'type':_0x83c4b7[_0x9dfe('0x2b')][_0x9dfe('0x2c')]};});_0x47dd04[_0x9dfe('0x2d')]=_[_0x9dfe('0x2e')](_0x48fd0f,'name');_0x47dd04[_0x9dfe('0x2f')]=_[_0x9dfe('0x30')](_0xba12e7[_0x9dfe('0x2f')]);_0x47dd04['filters']=_[_0x9dfe('0x31')](_0x47dd04[_0x9dfe('0x2d')],_0x47dd04['query']);_0x36b23a[_0x9dfe('0x32')]=_['intersection'](_0x47dd04[_0x9dfe('0x2d')],qs[_0x9dfe('0x33')](_0xba12e7['query']['fields']));_0x36b23a['attributes']=_0x36b23a['attributes'][_0x9dfe('0x34')]?_0x36b23a[_0x9dfe('0x32')]:_0x47dd04[_0x9dfe('0x2d')];if(!_0xba12e7[_0x9dfe('0x2f')][_0x9dfe('0x35')]('nolimit')){_0x36b23a[_0x9dfe('0x1d')]=qs[_0x9dfe('0x1d')](_0xba12e7[_0x9dfe('0x2f')][_0x9dfe('0x1d')]);_0x36b23a[_0x9dfe('0x1c')]=qs['offset'](_0xba12e7[_0x9dfe('0x2f')][_0x9dfe('0x1c')]);}_0x36b23a[_0x9dfe('0x36')]=qs[_0x9dfe('0x37')](_0xba12e7[_0x9dfe('0x2f')]['sort']);_0x36b23a[_0x9dfe('0x38')]=qs[_0x9dfe('0x39')](_[_0x9dfe('0x3a')](_0xba12e7[_0x9dfe('0x2f')],_0x47dd04[_0x9dfe('0x39')]),_0x48fd0f);if(_0xba12e7[_0x9dfe('0x2f')]['filter']){_0x36b23a[_0x9dfe('0x38')]=_[_0x9dfe('0x3b')](_0x36b23a['where'],{'$or':_[_0x9dfe('0x2e')](_0x48fd0f,function(_0x519f02){if(_0x519f02['type']!==_0x9dfe('0x3c')){var _0x3817a2={};_0x3817a2[_0x519f02[_0x9dfe('0x27')]]={'$like':'%'+_0xba12e7[_0x9dfe('0x2f')][_0x9dfe('0x3d')]+'%'};return _0x3817a2;}})});}_0x36b23a=_[_0x9dfe('0x3b')]({},_0x36b23a,_0xba12e7[_0x9dfe('0x3e')]);var _0x29f08a={'where':_0x36b23a[_0x9dfe('0x38')]};return db[_0x9dfe('0x3f')][_0x9dfe('0x1b')](_0x29f08a)[_0x9dfe('0x24')](function(_0x95db2a){_0x3b3f96[_0x9dfe('0x1b')]=_0x95db2a;if(_0xba12e7['query']['includeAll']){_0x36b23a[_0x9dfe('0x40')]=[{'all':!![]}];}return db[_0x9dfe('0x3f')][_0x9dfe('0x41')](_0x36b23a);})['then'](function(_0x108eac){_0x3b3f96[_0x9dfe('0x42')]=_0x108eac;return _0x3b3f96;})[_0x9dfe('0x24')](respondWithFilteredResult(_0x44c101,_0x36b23a))['catch'](handleError(_0x44c101,null));};exports[_0x9dfe('0x43')]=function(_0x1db564,_0x3c500f){var _0x3b821f={'raw':![],'where':{'id':_0x1db564[_0x9dfe('0x44')]['id']}},_0x3fa16e={};_0x3fa16e[_0x9dfe('0x2d')]=_[_0x9dfe('0x30')](db['SugarcrmConfiguration'][_0x9dfe('0x2a')]);_0x3fa16e['query']=_[_0x9dfe('0x30')](_0x1db564[_0x9dfe('0x2f')]);_0x3fa16e[_0x9dfe('0x39')]=_[_0x9dfe('0x31')](_0x3fa16e[_0x9dfe('0x2d')],_0x3fa16e[_0x9dfe('0x2f')]);_0x3b821f[_0x9dfe('0x32')]=_[_0x9dfe('0x31')](_0x3fa16e[_0x9dfe('0x2d')],qs[_0x9dfe('0x33')](_0x1db564[_0x9dfe('0x2f')][_0x9dfe('0x33')]));_0x3b821f[_0x9dfe('0x32')]=_0x3b821f[_0x9dfe('0x32')][_0x9dfe('0x34')]?_0x3b821f[_0x9dfe('0x32')]:_0x3fa16e[_0x9dfe('0x2d')];if(_0x1db564['query'][_0x9dfe('0x45')]){_0x3b821f[_0x9dfe('0x40')]=[{'all':!![]}];}_0x3b821f=_[_0x9dfe('0x3b')]({},_0x3b821f,_0x1db564['options']);return db['SugarcrmConfiguration']['find'](_0x3b821f)[_0x9dfe('0x24')](handleEntityNotFound(_0x3c500f,null))[_0x9dfe('0x24')](respondWithResult(_0x3c500f,null))[_0x9dfe('0x46')](handleError(_0x3c500f,null));};exports[_0x9dfe('0x47')]=function(_0x571072,_0x323858){return db[_0x9dfe('0x3f')][_0x9dfe('0x47')](_0x571072[_0x9dfe('0x48')],{})[_0x9dfe('0x24')](respondWithResult(_0x323858,0xc9))[_0x9dfe('0x46')](handleError(_0x323858,null));};exports[_0x9dfe('0x23')]=function(_0x4f882d,_0x1e0402){if(_0x4f882d[_0x9dfe('0x48')]['id']){delete _0x4f882d['body']['id'];}return db[_0x9dfe('0x3f')][_0x9dfe('0x49')]({'where':{'id':_0x4f882d[_0x9dfe('0x44')]['id']}})[_0x9dfe('0x24')](handleEntityNotFound(_0x1e0402,null))[_0x9dfe('0x24')](saveUpdates(_0x4f882d[_0x9dfe('0x48')],null))[_0x9dfe('0x24')](respondWithResult(_0x1e0402,null))['catch'](handleError(_0x1e0402,null));};exports['destroy']=function(_0x5c3bc3,_0x1d5387){return db[_0x9dfe('0x3f')][_0x9dfe('0x49')]({'where':{'id':_0x5c3bc3['params']['id']}})[_0x9dfe('0x24')](handleEntityNotFound(_0x1d5387,null))[_0x9dfe('0x24')](removeEntity(_0x1d5387,null))[_0x9dfe('0x46')](handleError(_0x1d5387,null));};exports[_0x9dfe('0x4a')]=function(_0x18a9d5,_0x315a61,_0x4b9e21){var _0x4bde49={};var _0x31f595={};var _0x4826c6;var _0x9242fe;return db[_0x9dfe('0x3f')][_0x9dfe('0x4b')]({'where':{'id':_0x18a9d5[_0x9dfe('0x44')]['id']}})[_0x9dfe('0x24')](handleEntityNotFound(_0x315a61,null))[_0x9dfe('0x24')](function(_0x12f75f){if(_0x12f75f){_0x4826c6=_0x12f75f;_0x31f595['model']=_[_0x9dfe('0x30')](db[_0x9dfe('0x4c')][_0x9dfe('0x2a')]);_0x31f595[_0x9dfe('0x2f')]=_[_0x9dfe('0x30')](_0x18a9d5[_0x9dfe('0x2f')]);_0x31f595[_0x9dfe('0x39')]=_[_0x9dfe('0x31')](_0x31f595[_0x9dfe('0x2d')],_0x31f595[_0x9dfe('0x2f')]);_0x4bde49[_0x9dfe('0x32')]=_[_0x9dfe('0x31')](_0x31f595[_0x9dfe('0x2d')],qs[_0x9dfe('0x33')](_0x18a9d5['query']['fields']));_0x4bde49[_0x9dfe('0x32')]=_0x4bde49[_0x9dfe('0x32')][_0x9dfe('0x34')]?_0x4bde49['attributes']:_0x31f595['model'];_0x4bde49[_0x9dfe('0x36')]=qs[_0x9dfe('0x37')](_0x18a9d5[_0x9dfe('0x2f')][_0x9dfe('0x37')]);_0x4bde49['where']=qs[_0x9dfe('0x39')](_['pick'](_0x18a9d5['query'],_0x31f595[_0x9dfe('0x39')]));if(_0x18a9d5[_0x9dfe('0x2f')][_0x9dfe('0x3d')]){_0x4bde49[_0x9dfe('0x38')]=_[_0x9dfe('0x3b')](_0x4bde49[_0x9dfe('0x38')],{'$or':_['map'](_0x4bde49[_0x9dfe('0x32')],function(_0x543e9d){var _0x5a1d60={};_0x5a1d60[_0x543e9d]={'$like':'%'+_0x18a9d5[_0x9dfe('0x2f')]['filter']+'%'};return _0x5a1d60;})});}_0x4bde49=_[_0x9dfe('0x3b')]({},_0x4bde49,_0x18a9d5[_0x9dfe('0x3e')]);return _0x4826c6[_0x9dfe('0x4a')](_0x4bde49);}})['then'](function(_0x23b30e){if(_0x23b30e){_0x9242fe=_0x23b30e[_0x9dfe('0x34')];if(!_0x18a9d5[_0x9dfe('0x2f')][_0x9dfe('0x35')](_0x9dfe('0x4d'))){_0x4bde49['limit']=qs['limit'](_0x18a9d5[_0x9dfe('0x2f')][_0x9dfe('0x1d')]);_0x4bde49['offset']=qs[_0x9dfe('0x1c')](_0x18a9d5[_0x9dfe('0x2f')][_0x9dfe('0x1c')]);}return _0x4826c6['getFields'](_0x4bde49);}})[_0x9dfe('0x24')](function(_0x21ad4d){if(_0x21ad4d){return _0x21ad4d?{'count':_0x9242fe,'rows':_0x21ad4d}:null;}})['then'](respondWithResult(_0x315a61,null))['catch'](handleError(_0x315a61,null));};exports[_0x9dfe('0x4e')]=function(_0x14a9bb,_0x39d93e,_0xb6c95d){var _0x103f27={};var _0x3fdd7d={};var _0x5cb1cb;var _0x21976a;return db[_0x9dfe('0x3f')]['findOne']({'where':{'id':_0x14a9bb[_0x9dfe('0x44')]['id']}})[_0x9dfe('0x24')](handleEntityNotFound(_0x39d93e,null))[_0x9dfe('0x24')](function(_0x334853){if(_0x334853){_0x5cb1cb=_0x334853;_0x3fdd7d[_0x9dfe('0x2d')]=_[_0x9dfe('0x30')](db['SugarcrmField'][_0x9dfe('0x2a')]);_0x3fdd7d[_0x9dfe('0x2f')]=_[_0x9dfe('0x30')](_0x14a9bb[_0x9dfe('0x2f')]);_0x3fdd7d[_0x9dfe('0x39')]=_[_0x9dfe('0x31')](_0x3fdd7d['model'],_0x3fdd7d[_0x9dfe('0x2f')]);_0x103f27[_0x9dfe('0x32')]=_[_0x9dfe('0x31')](_0x3fdd7d[_0x9dfe('0x2d')],qs[_0x9dfe('0x33')](_0x14a9bb[_0x9dfe('0x2f')]['fields']));_0x103f27[_0x9dfe('0x32')]=_0x103f27[_0x9dfe('0x32')][_0x9dfe('0x34')]?_0x103f27[_0x9dfe('0x32')]:_0x3fdd7d[_0x9dfe('0x2d')];_0x103f27[_0x9dfe('0x36')]=qs['sort'](_0x14a9bb['query']['sort']);_0x103f27[_0x9dfe('0x38')]=qs[_0x9dfe('0x39')](_[_0x9dfe('0x3a')](_0x14a9bb[_0x9dfe('0x2f')],_0x3fdd7d['filters']));if(_0x14a9bb[_0x9dfe('0x2f')]['filter']){_0x103f27['where']=_[_0x9dfe('0x3b')](_0x103f27[_0x9dfe('0x38')],{'$or':_['map'](_0x103f27[_0x9dfe('0x32')],function(_0x39acbb){var _0x3d5044={};_0x3d5044[_0x39acbb]={'$like':'%'+_0x14a9bb[_0x9dfe('0x2f')][_0x9dfe('0x3d')]+'%'};return _0x3d5044;})});}_0x103f27=_[_0x9dfe('0x3b')]({},_0x103f27,_0x14a9bb[_0x9dfe('0x3e')]);return _0x5cb1cb[_0x9dfe('0x4e')](_0x103f27);}})[_0x9dfe('0x24')](function(_0x314bb6){if(_0x314bb6){_0x21976a=_0x314bb6[_0x9dfe('0x34')];if(!_0x14a9bb[_0x9dfe('0x2f')][_0x9dfe('0x35')](_0x9dfe('0x4d'))){_0x103f27[_0x9dfe('0x1d')]=qs[_0x9dfe('0x1d')](_0x14a9bb[_0x9dfe('0x2f')][_0x9dfe('0x1d')]);_0x103f27['offset']=qs['offset'](_0x14a9bb[_0x9dfe('0x2f')]['offset']);}return _0x5cb1cb[_0x9dfe('0x4e')](_0x103f27);}})['then'](function(_0x38794b){if(_0x38794b){return _0x38794b?{'count':_0x21976a,'rows':_0x38794b}:null;}})[_0x9dfe('0x24')](respondWithResult(_0x39d93e,null))[_0x9dfe('0x46')](handleError(_0x39d93e,null));};exports[_0x9dfe('0x4f')]=function(_0x9ddef4,_0x1e13ca,_0x235dfc){var _0x31b02e={};var _0x1e0061={};var _0x505bd5;var _0x23ecdb;return db[_0x9dfe('0x3f')][_0x9dfe('0x4b')]({'where':{'id':_0x9ddef4[_0x9dfe('0x44')]['id']}})[_0x9dfe('0x24')](handleEntityNotFound(_0x1e13ca,null))[_0x9dfe('0x24')](function(_0x2a045b){if(_0x2a045b){_0x505bd5=_0x2a045b;_0x1e0061['model']=_['keys'](db[_0x9dfe('0x4c')]['rawAttributes']);_0x1e0061[_0x9dfe('0x2f')]=_['keys'](_0x9ddef4[_0x9dfe('0x2f')]);_0x1e0061[_0x9dfe('0x39')]=_[_0x9dfe('0x31')](_0x1e0061[_0x9dfe('0x2d')],_0x1e0061['query']);_0x31b02e['attributes']=_[_0x9dfe('0x31')](_0x1e0061['model'],qs[_0x9dfe('0x33')](_0x9ddef4[_0x9dfe('0x2f')][_0x9dfe('0x33')]));_0x31b02e[_0x9dfe('0x32')]=_0x31b02e[_0x9dfe('0x32')][_0x9dfe('0x34')]?_0x31b02e[_0x9dfe('0x32')]:_0x1e0061['model'];_0x31b02e[_0x9dfe('0x36')]=qs[_0x9dfe('0x37')](_0x9ddef4[_0x9dfe('0x2f')][_0x9dfe('0x37')]);_0x31b02e['where']=qs[_0x9dfe('0x39')](_['pick'](_0x9ddef4[_0x9dfe('0x2f')],_0x1e0061[_0x9dfe('0x39')]));if(_0x9ddef4['query']['filter']){_0x31b02e[_0x9dfe('0x38')]=_[_0x9dfe('0x3b')](_0x31b02e[_0x9dfe('0x38')],{'$or':_[_0x9dfe('0x2e')](_0x31b02e[_0x9dfe('0x32')],function(_0x27b79e){var _0x556271={};_0x556271[_0x27b79e]={'$like':'%'+_0x9ddef4[_0x9dfe('0x2f')][_0x9dfe('0x3d')]+'%'};return _0x556271;})});}_0x31b02e=_[_0x9dfe('0x3b')]({},_0x31b02e,_0x9ddef4[_0x9dfe('0x3e')]);return _0x505bd5[_0x9dfe('0x4f')](_0x31b02e);}})[_0x9dfe('0x24')](function(_0x41402c){if(_0x41402c){_0x23ecdb=_0x41402c[_0x9dfe('0x34')];if(!_0x9ddef4[_0x9dfe('0x2f')][_0x9dfe('0x35')](_0x9dfe('0x4d'))){_0x31b02e[_0x9dfe('0x1d')]=qs[_0x9dfe('0x1d')](_0x9ddef4[_0x9dfe('0x2f')]['limit']);_0x31b02e[_0x9dfe('0x1c')]=qs[_0x9dfe('0x1c')](_0x9ddef4['query'][_0x9dfe('0x1c')]);}return _0x505bd5[_0x9dfe('0x4f')](_0x31b02e);}})[_0x9dfe('0x24')](function(_0x42fbff){if(_0x42fbff){return _0x42fbff?{'count':_0x23ecdb,'rows':_0x42fbff}:null;}})[_0x9dfe('0x24')](respondWithResult(_0x1e13ca,null))[_0x9dfe('0x46')](handleError(_0x1e13ca,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js index 3fcd714..18b1e1a 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 _0xee4d=['exports','define','SugarcrmConfiguration','int_sugarcrm_configurations','lodash','util','../../config/logger','api','moment','bluebird','rimraf','../../config/environment'];(function(_0xa1e3e3,_0x29fe0e){var _0xc980e9=function(_0x1f5adc){while(--_0x1f5adc){_0xa1e3e3['push'](_0xa1e3e3['shift']());}};_0xc980e9(++_0x29fe0e);}(_0xee4d,0x124));var _0xdee4=function(_0x465a0c,_0x19d4d5){_0x465a0c=_0x465a0c-0x0;var _0x1e202e=_0xee4d[_0x465a0c];return _0x1e202e;};'use strict';var _=require(_0xdee4('0x0'));var util=require(_0xdee4('0x1'));var logger=require(_0xdee4('0x2'))(_0xdee4('0x3'));var moment=require(_0xdee4('0x4'));var BPromise=require(_0xdee4('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xdee4('0x6'));var config=require(_0xdee4('0x7'));var attributes=require('./intSugarcrmConfiguration.attributes');module[_0xdee4('0x8')]=function(_0x5a5d23,_0x4aa018){return _0x5a5d23[_0xdee4('0x9')](_0xdee4('0xa'),attributes,{'tableName':_0xdee4('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6a2f=['request-promise','../../config/environment','./intSugarcrmConfiguration.attributes','define','int_sugarcrm_configurations','lodash','../../config/logger','api','moment'];(function(_0x198e30,_0x491c9e){var _0x42aff5=function(_0x450ac0){while(--_0x450ac0){_0x198e30['push'](_0x198e30['shift']());}};_0x42aff5(++_0x491c9e);}(_0x6a2f,0x17f));var _0xf6a2=function(_0x54aea3,_0xae7d81){_0x54aea3=_0x54aea3-0x0;var _0x21ae46=_0x6a2f[_0x54aea3];return _0x21ae46;};'use strict';var _=require(_0xf6a2('0x0'));var util=require('util');var logger=require(_0xf6a2('0x1'))(_0xf6a2('0x2'));var moment=require(_0xf6a2('0x3'));var BPromise=require('bluebird');var rp=require(_0xf6a2('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xf6a2('0x5'));var attributes=require(_0xf6a2('0x6'));module['exports']=function(_0x4ab355,_0x21ed54){return _0x4ab355[_0xf6a2('0x7')]('SugarcrmConfiguration',attributes,{'tableName':_0xf6a2('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.rpc.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.rpc.js index d22b76f..8f521db 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 _0xfd99=['../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then','info','request\x20sent','debug','stringify','code','error','message','SugarcrmConfiguration,\x20%s,\x20%s','catch','util','moment','randomstring','ioredis','../../mysqldb'];(function(_0x4bf865,_0x2c68eb){var _0x3c96f7=function(_0x3bb091){while(--_0x3bb091){_0x4bf865['push'](_0x4bf865['shift']());}};_0x3c96f7(++_0x2c68eb);}(_0xfd99,0x1c9));var _0x9fd9=function(_0x38a9e6,_0x1b2f5d){_0x38a9e6=_0x38a9e6-0x0;var _0x2bf78b=_0xfd99[_0x38a9e6];return _0x2bf78b;};'use strict';var _=require('lodash');var util=require(_0x9fd9('0x0'));var moment=require(_0x9fd9('0x1'));var BPromise=require('bluebird');var rs=require(_0x9fd9('0x2'));var fs=require('fs');var Redis=require(_0x9fd9('0x3'));var db=require(_0x9fd9('0x4'))['db'];var utils=require(_0x9fd9('0x5'));var logger=require('../../config/logger')(_0x9fd9('0x6'));var config=require(_0x9fd9('0x7'));var jayson=require(_0x9fd9('0x8'));var client=jayson[_0x9fd9('0x9')][_0x9fd9('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x39fabd,_0x5b0a95,_0xb50453){return new BPromise(function(_0x10b572,_0x699838){return client['request'](_0x39fabd,_0xb50453)[_0x9fd9('0xb')](function(_0x184631){logger[_0x9fd9('0xc')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x5b0a95,_0x9fd9('0xd'));logger[_0x9fd9('0xe')]('SugarcrmConfiguration,\x20%s,\x20%s,\x20%s',_0x5b0a95,_0x9fd9('0xd'),JSON[_0x9fd9('0xf')](_0x184631));if(_0x184631['error']){if(_0x184631['error'][_0x9fd9('0x10')]===0x1f4){logger[_0x9fd9('0x11')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x5b0a95,_0x184631[_0x9fd9('0x11')][_0x9fd9('0x12')]);return _0x699838(_0x184631[_0x9fd9('0x11')]['message']);}logger[_0x9fd9('0x11')](_0x9fd9('0x13'),_0x5b0a95,_0x184631['error'][_0x9fd9('0x12')]);return _0x10b572(_0x184631[_0x9fd9('0x11')][_0x9fd9('0x12')]);}else{logger[_0x9fd9('0xc')](_0x9fd9('0x13'),_0x5b0a95,'request\x20sent');_0x10b572(_0x184631['result'][_0x9fd9('0x12')]);}})[_0x9fd9('0x14')](function(_0x13f819){logger[_0x9fd9('0x11')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x5b0a95,_0x13f819);_0x699838(_0x13f819);});});} \ No newline at end of file +var _0x5497=['rpc','client','http','SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','util','moment','bluebird','randomstring','../../config/utils','../../config/logger'];(function(_0x3db51d,_0x3b8d1b){var _0x217e76=function(_0x5298c5){while(--_0x5298c5){_0x3db51d['push'](_0x3db51d['shift']());}};_0x217e76(++_0x3b8d1b);}(_0x5497,0x1e8));var _0x7549=function(_0x4bf0bc,_0x2c6490){_0x4bf0bc=_0x4bf0bc-0x0;var _0x223837=_0x5497[_0x4bf0bc];return _0x223837;};'use strict';var _=require('lodash');var util=require(_0x7549('0x0'));var moment=require(_0x7549('0x1'));var BPromise=require(_0x7549('0x2'));var rs=require(_0x7549('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x7549('0x4'));var logger=require(_0x7549('0x5'))(_0x7549('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x7549('0x7')][_0x7549('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2b9fdb,_0x3b2483,_0x51c52a){return new BPromise(function(_0x864bd4,_0x3ef83f){return client['request'](_0x2b9fdb,_0x51c52a)['then'](function(_0x3144ba){logger['info'](_0x7549('0x9'),_0x3b2483,_0x7549('0xa'));logger['debug'](_0x7549('0xb'),_0x3b2483,_0x7549('0xa'),JSON[_0x7549('0xc')](_0x3144ba));if(_0x3144ba['error']){if(_0x3144ba[_0x7549('0xd')][_0x7549('0xe')]===0x1f4){logger[_0x7549('0xd')](_0x7549('0x9'),_0x3b2483,_0x3144ba[_0x7549('0xd')][_0x7549('0xf')]);return _0x3ef83f(_0x3144ba[_0x7549('0xd')]['message']);}logger['error'](_0x7549('0x9'),_0x3b2483,_0x3144ba['error'][_0x7549('0xf')]);return _0x864bd4(_0x3144ba['error'][_0x7549('0xf')]);}else{logger[_0x7549('0x10')](_0x7549('0x9'),_0x3b2483,_0x7549('0xa'));_0x864bd4(_0x3144ba[_0x7549('0x11')][_0x7549('0xf')]);}})[_0x7549('0x12')](function(_0x44095c){logger['error'](_0x7549('0x9'),_0x3b2483,_0x44095c);_0x3ef83f(_0x44095c);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmField/index.js b/server/api/intSugarcrmField/index.js index a45181d..111c970 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 _0x4ede=['/:id','isAuthenticated','show','post','create','put','update','destroy','exports','multer','path','connect-timeout','express','fs-extra','../../components/interaction/service','./intSugarcrmField.controller','get'];(function(_0x2d9a23,_0x481dc4){var _0x5198ee=function(_0x27d373){while(--_0x27d373){_0x2d9a23['push'](_0x2d9a23['shift']());}};_0x5198ee(++_0x481dc4);}(_0x4ede,0x190));var _0xe4ed=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x4ede[_0x432682];return _0x463d05;};'use strict';var multer=require(_0xe4ed('0x0'));var util=require('util');var path=require(_0xe4ed('0x1'));var timeout=require(_0xe4ed('0x2'));var express=require(_0xe4ed('0x3'));var router=express['Router']();var fs_extra=require(_0xe4ed('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xe4ed('0x5'));var config=require('../../config/environment');var controller=require(_0xe4ed('0x6'));router[_0xe4ed('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0xe4ed('0x7')](_0xe4ed('0x8'),auth[_0xe4ed('0x9')](),controller[_0xe4ed('0xa')]);router[_0xe4ed('0xb')]('/',auth[_0xe4ed('0x9')](),controller[_0xe4ed('0xc')]);router[_0xe4ed('0xd')](_0xe4ed('0x8'),auth['isAuthenticated'](),controller[_0xe4ed('0xe')]);router['delete']('/:id',auth[_0xe4ed('0x9')](),controller[_0xe4ed('0xf')]);module[_0xe4ed('0x10')]=router; \ No newline at end of file +var _0xed6f=['isAuthenticated','index','post','put','delete','/:id','destroy','exports','util','path','connect-timeout','express','fs-extra','../../components/auth/service','./intSugarcrmField.controller','get'];(function(_0x269d1f,_0x15cec3){var _0x342bd7=function(_0x58cf22){while(--_0x58cf22){_0x269d1f['push'](_0x269d1f['shift']());}};_0x342bd7(++_0x15cec3);}(_0xed6f,0x1d8));var _0xfed6=function(_0x2acbce,_0x2b48d3){_0x2acbce=_0x2acbce-0x0;var _0x1de0e0=_0xed6f[_0x2acbce];return _0x1de0e0;};'use strict';var multer=require('multer');var util=require(_0xfed6('0x0'));var path=require(_0xfed6('0x1'));var timeout=require(_0xfed6('0x2'));var express=require(_0xfed6('0x3'));var router=express['Router']();var fs_extra=require(_0xfed6('0x4'));var auth=require(_0xfed6('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xfed6('0x6'));router[_0xfed6('0x7')]('/',auth[_0xfed6('0x8')](),controller[_0xfed6('0x9')]);router['get']('/:id',auth[_0xfed6('0x8')](),controller['show']);router[_0xfed6('0xa')]('/',auth['isAuthenticated'](),controller['create']);router[_0xfed6('0xb')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0xfed6('0xc')](_0xfed6('0xd'),auth[_0xfed6('0x8')](),controller[_0xfed6('0xe')]);module[_0xfed6('0xf')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.attributes.js b/server/api/intSugarcrmField/intSugarcrmField.attributes.js index 1036831..8ca4b93 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 _0xce8f=['ENUM','string','variable','customVariable','keyValue','picklist','STRING','BOOLEAN','sequelize','exports'];(function(_0x440947,_0x889078){var _0x45a372=function(_0x45fd7c){while(--_0x45fd7c){_0x440947['push'](_0x440947['shift']());}};_0x45a372(++_0x889078);}(_0xce8f,0xf8));var _0xfce8=function(_0x53e35e,_0x114a69){_0x53e35e=_0x53e35e-0x0;var _0xaaaa6a=_0xce8f[_0x53e35e];return _0xaaaa6a;};'use strict';var Sequelize=require(_0xfce8('0x0'));module[_0xfce8('0x1')]={'type':{'type':Sequelize[_0xfce8('0x2')](_0xfce8('0x3'),_0xfce8('0x4'),_0xfce8('0x5'),_0xfce8('0x6'),_0xfce8('0x7')),'defaultValue':_0xfce8('0x3')},'content':{'type':Sequelize[_0xfce8('0x8')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xfce8('0x2')]('string','variable',_0xfce8('0x5'))},'keyContent':{'type':Sequelize[_0xfce8('0x8')]},'idField':{'type':Sequelize[_0xfce8('0x8')]},'nameField':{'type':Sequelize[_0xfce8('0x8')]},'customField':{'type':Sequelize[_0xfce8('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xfce8('0x8')]}}; \ No newline at end of file +var _0x9849=['STRING','BOOLEAN','exports','ENUM','variable','customVariable','keyValue','picklist','string'];(function(_0x546e26,_0x18fc24){var _0x4702e7=function(_0x96ba40){while(--_0x96ba40){_0x546e26['push'](_0x546e26['shift']());}};_0x4702e7(++_0x18fc24);}(_0x9849,0x173));var _0x9984=function(_0x102e37,_0x14a181){_0x102e37=_0x102e37-0x0;var _0x35a07c=_0x9849[_0x102e37];return _0x35a07c;};'use strict';var Sequelize=require('sequelize');module[_0x9984('0x0')]={'type':{'type':Sequelize[_0x9984('0x1')]('string',_0x9984('0x2'),_0x9984('0x3'),_0x9984('0x4'),_0x9984('0x5')),'defaultValue':_0x9984('0x6')},'content':{'type':Sequelize[_0x9984('0x7')]},'key':{'type':Sequelize[_0x9984('0x7')]},'keyType':{'type':Sequelize[_0x9984('0x1')]('string','variable',_0x9984('0x3'))},'keyContent':{'type':Sequelize[_0x9984('0x7')]},'idField':{'type':Sequelize[_0x9984('0x7')]},'nameField':{'type':Sequelize[_0x9984('0x7')]},'customField':{'type':Sequelize[_0x9984('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.controller.js b/server/api/intSugarcrmField/intSugarcrmField.controller.js index 012f692..f6a011b 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 _0x020d=['Content-Range','apply','reject','save','destroy','then','error','name','send','index','SugarcrmField','rawAttributes','fieldName','key','model','map','keys','query','filters','intersection','attributes','fields','order','sort','where','pick','filter','VIRTUAL','merge','includeAll','include','findAll','catch','show','params','length','options','create','body','find','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set'];(function(_0x32e9d3,_0x49bcd3){var _0x562fea=function(_0x1c74fa){while(--_0x1c74fa){_0x32e9d3['push'](_0x32e9d3['shift']());}};_0x562fea(++_0x49bcd3);}(_0x020d,0xb6));var _0xd020=function(_0x344468,_0x6a66da){_0x344468=_0x344468-0x0;var _0x1ca8ba=_0x020d[_0x344468];return _0x1ca8ba;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xd020('0x0'));var zipdir=require(_0xd020('0x1'));var jsonpatch=require(_0xd020('0x2'));var rp=require(_0xd020('0x3'));var moment=require(_0xd020('0x4'));var BPromise=require(_0xd020('0x5'));var Mustache=require(_0xd020('0x6'));var util=require(_0xd020('0x7'));var path=require(_0xd020('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xd020('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xd020('0xa'));var squel=require(_0xd020('0xb'));var crypto=require('crypto');var jsforce=require(_0xd020('0xc'));var deskjs=require(_0xd020('0xd'));var toCsv=require(_0xd020('0xe'));var querystring=require(_0xd020('0xf'));var Papa=require(_0xd020('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xd020('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xd020('0x12'));var utils=require(_0xd020('0x13'));var config=require(_0xd020('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0xd020('0x15'))['db'];function respondWithStatusCode(_0x48f477,_0xc195b9){_0xc195b9=_0xc195b9||0xcc;return function(_0x3433b0){if(_0x3433b0){return _0x48f477[_0xd020('0x16')](_0xc195b9);}return _0x48f477[_0xd020('0x17')](_0xc195b9)[_0xd020('0x18')]();};}function respondWithResult(_0x40c6d7,_0x2a8afa){_0x2a8afa=_0x2a8afa||0xc8;return function(_0xb5d97d){if(_0xb5d97d){return _0x40c6d7['status'](_0x2a8afa)[_0xd020('0x19')](_0xb5d97d);}};}function respondWithFilteredResult(_0x32e7df,_0x4b953b){return function(_0x36f925){if(_0x36f925){var _0x55848b=typeof _0x4b953b['offset']===_0xd020('0x1a')&&typeof _0x4b953b[_0xd020('0x1b')]===_0xd020('0x1a');var _0x551235=_0x36f925[_0xd020('0x1c')];var _0x58a8f5=_0x55848b?0x0:_0x4b953b[_0xd020('0x1d')];var _0x50ba7d=_0x55848b?_0x36f925[_0xd020('0x1c')]:_0x4b953b[_0xd020('0x1d')]+_0x4b953b['limit'];var _0x19000e;if(_0x50ba7d>=_0x551235){_0x50ba7d=_0x551235;_0x19000e=0xc8;}else{_0x19000e=0xce;}_0x32e7df[_0xd020('0x17')](_0x19000e);return _0x32e7df[_0xd020('0x1e')](_0xd020('0x1f'),_0x58a8f5+'-'+_0x50ba7d+'/'+_0x551235)[_0xd020('0x19')](_0x36f925);}return null;};}function patchUpdates(_0x59f8aa){return function(_0x4f084c){try{jsonpatch[_0xd020('0x20')](_0x4f084c,_0x59f8aa,!![]);}catch(_0x20a38b){return BPromise[_0xd020('0x21')](_0x20a38b);}return _0x4f084c[_0xd020('0x22')]();};}function saveUpdates(_0x46de25,_0x51abb5){return function(_0x1eea52){if(_0x1eea52){return _0x1eea52['update'](_0x46de25)['then'](function(_0x27f092){return _0x27f092;});}return null;};}function removeEntity(_0x4ad4ba,_0x4b9337){return function(_0x1e74fa){if(_0x1e74fa){return _0x1e74fa[_0xd020('0x23')]()[_0xd020('0x24')](function(){_0x4ad4ba['status'](0xcc)[_0xd020('0x18')]();});}};}function handleEntityNotFound(_0x4dba3a,_0x9600e6){return function(_0x9fe7cf){if(!_0x9fe7cf){_0x4dba3a[_0xd020('0x16')](0x194);}return _0x9fe7cf;};}function handleError(_0x5e820b,_0xa10a6){_0xa10a6=_0xa10a6||0x1f4;return function(_0x3f9862){logger[_0xd020('0x25')](_0x3f9862['stack']);if(_0x3f9862['name']){delete _0x3f9862[_0xd020('0x26')];}_0x5e820b['status'](_0xa10a6)[_0xd020('0x27')](_0x3f9862);};}exports[_0xd020('0x28')]=function(_0x253118,_0x4ff1ba){var _0xd91dc9={},_0x3d5744={},_0x2c24bc={'count':0x0,'rows':[]};var _0x2b9bb4=_['map'](db[_0xd020('0x29')][_0xd020('0x2a')],function(_0x404673){return{'name':_0x404673[_0xd020('0x2b')],'type':_0x404673['type'][_0xd020('0x2c')]};});_0x3d5744[_0xd020('0x2d')]=_[_0xd020('0x2e')](_0x2b9bb4,_0xd020('0x26'));_0x3d5744['query']=_[_0xd020('0x2f')](_0x253118[_0xd020('0x30')]);_0x3d5744[_0xd020('0x31')]=_[_0xd020('0x32')](_0x3d5744[_0xd020('0x2d')],_0x3d5744[_0xd020('0x30')]);_0xd91dc9[_0xd020('0x33')]=_[_0xd020('0x32')](_0x3d5744['model'],qs['fields'](_0x253118['query'][_0xd020('0x34')]));_0xd91dc9['attributes']=_0xd91dc9[_0xd020('0x33')]['length']?_0xd91dc9[_0xd020('0x33')]:_0x3d5744[_0xd020('0x2d')];if(!_0x253118[_0xd020('0x30')]['hasOwnProperty']('nolimit')){_0xd91dc9[_0xd020('0x1b')]=qs[_0xd020('0x1b')](_0x253118[_0xd020('0x30')][_0xd020('0x1b')]);_0xd91dc9['offset']=qs[_0xd020('0x1d')](_0x253118[_0xd020('0x30')][_0xd020('0x1d')]);}_0xd91dc9[_0xd020('0x35')]=qs[_0xd020('0x36')](_0x253118[_0xd020('0x30')][_0xd020('0x36')]);_0xd91dc9[_0xd020('0x37')]=qs[_0xd020('0x31')](_[_0xd020('0x38')](_0x253118['query'],_0x3d5744['filters']),_0x2b9bb4);if(_0x253118[_0xd020('0x30')][_0xd020('0x39')]){_0xd91dc9[_0xd020('0x37')]=_['merge'](_0xd91dc9[_0xd020('0x37')],{'$or':_[_0xd020('0x2e')](_0x2b9bb4,function(_0x1d63a1){if(_0x1d63a1['type']!==_0xd020('0x3a')){var _0x4d7746={};_0x4d7746[_0x1d63a1['name']]={'$like':'%'+_0x253118[_0xd020('0x30')]['filter']+'%'};return _0x4d7746;}})});}_0xd91dc9=_[_0xd020('0x3b')]({},_0xd91dc9,_0x253118['options']);var _0x59cbb4={'where':_0xd91dc9[_0xd020('0x37')]};return db[_0xd020('0x29')][_0xd020('0x1c')](_0x59cbb4)['then'](function(_0x151d16){_0x2c24bc[_0xd020('0x1c')]=_0x151d16;if(_0x253118[_0xd020('0x30')][_0xd020('0x3c')]){_0xd91dc9[_0xd020('0x3d')]=[{'all':!![]}];}return db['SugarcrmField'][_0xd020('0x3e')](_0xd91dc9);})[_0xd020('0x24')](function(_0x26396e){_0x2c24bc['rows']=_0x26396e;return _0x2c24bc;})[_0xd020('0x24')](respondWithFilteredResult(_0x4ff1ba,_0xd91dc9))[_0xd020('0x3f')](handleError(_0x4ff1ba,null));};exports[_0xd020('0x40')]=function(_0x5d59d3,_0x1108a7){var _0x32ad06={'raw':!![],'where':{'id':_0x5d59d3[_0xd020('0x41')]['id']}},_0xb5f983={};_0xb5f983[_0xd020('0x2d')]=_[_0xd020('0x2f')](db[_0xd020('0x29')]['rawAttributes']);_0xb5f983[_0xd020('0x30')]=_['keys'](_0x5d59d3[_0xd020('0x30')]);_0xb5f983[_0xd020('0x31')]=_['intersection'](_0xb5f983[_0xd020('0x2d')],_0xb5f983[_0xd020('0x30')]);_0x32ad06[_0xd020('0x33')]=_[_0xd020('0x32')](_0xb5f983[_0xd020('0x2d')],qs[_0xd020('0x34')](_0x5d59d3[_0xd020('0x30')][_0xd020('0x34')]));_0x32ad06[_0xd020('0x33')]=_0x32ad06[_0xd020('0x33')][_0xd020('0x42')]?_0x32ad06[_0xd020('0x33')]:_0xb5f983[_0xd020('0x2d')];if(_0x5d59d3[_0xd020('0x30')][_0xd020('0x3c')]){_0x32ad06[_0xd020('0x3d')]=[{'all':!![]}];}_0x32ad06=_['merge']({},_0x32ad06,_0x5d59d3[_0xd020('0x43')]);return db[_0xd020('0x29')]['find'](_0x32ad06)[_0xd020('0x24')](handleEntityNotFound(_0x1108a7,null))[_0xd020('0x24')](respondWithResult(_0x1108a7,null))[_0xd020('0x3f')](handleError(_0x1108a7,null));};exports['create']=function(_0x20efa1,_0x365e36){return db[_0xd020('0x29')][_0xd020('0x44')](_0x20efa1['body'],{})[_0xd020('0x24')](respondWithResult(_0x365e36,0xc9))[_0xd020('0x3f')](handleError(_0x365e36,null));};exports['update']=function(_0x3ec91e,_0x15771b){if(_0x3ec91e['body']['id']){delete _0x3ec91e[_0xd020('0x45')]['id'];}return db[_0xd020('0x29')][_0xd020('0x46')]({'where':{'id':_0x3ec91e['params']['id']}})[_0xd020('0x24')](handleEntityNotFound(_0x15771b,null))[_0xd020('0x24')](saveUpdates(_0x3ec91e[_0xd020('0x45')],null))[_0xd020('0x24')](respondWithResult(_0x15771b,null))[_0xd020('0x3f')](handleError(_0x15771b,null));};exports[_0xd020('0x23')]=function(_0x990412,_0x4b5221){return db['SugarcrmField'][_0xd020('0x46')]({'where':{'id':_0x990412[_0xd020('0x41')]['id']}})['then'](handleEntityNotFound(_0x4b5221,null))[_0xd020('0x24')](removeEntity(_0x4b5221,null))[_0xd020('0x3f')](handleError(_0x4b5221,null));}; \ No newline at end of file +var _0x5bc1=['undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','status','sendStatus','error','name','send','index','map','SugarcrmField','rawAttributes','key','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','rows','catch','show','params','includeAll','create','body','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','end','json','offset'];(function(_0x5b2175,_0x36947c){var _0x4f93a1=function(_0x60a0a6){while(--_0x60a0a6){_0x5b2175['push'](_0x5b2175['shift']());}};_0x4f93a1(++_0x36947c);}(_0x5bc1,0x1a4));var _0x15bc=function(_0x3b9bc0,_0x1c48df){_0x3b9bc0=_0x3b9bc0-0x0;var _0x9eeb03=_0x5bc1[_0x3b9bc0];return _0x9eeb03;};'use strict';var emlformat=require(_0x15bc('0x0'));var rimraf=require(_0x15bc('0x1'));var zipdir=require(_0x15bc('0x2'));var jsonpatch=require(_0x15bc('0x3'));var rp=require(_0x15bc('0x4'));var moment=require(_0x15bc('0x5'));var BPromise=require(_0x15bc('0x6'));var Mustache=require(_0x15bc('0x7'));var util=require(_0x15bc('0x8'));var path=require(_0x15bc('0x9'));var sox=require(_0x15bc('0xa'));var csv=require(_0x15bc('0xb'));var ejs=require(_0x15bc('0xc'));var fs=require('fs');var fs_extra=require(_0x15bc('0xd'));var _=require(_0x15bc('0xe'));var squel=require(_0x15bc('0xf'));var crypto=require(_0x15bc('0x10'));var jsforce=require(_0x15bc('0x11'));var deskjs=require(_0x15bc('0x12'));var toCsv=require('to-csv');var querystring=require(_0x15bc('0x13'));var Papa=require(_0x15bc('0x14'));var Redis=require('ioredis');var authService=require(_0x15bc('0x15'));var qs=require(_0x15bc('0x16'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x15bc('0x17'))(_0x15bc('0x18'));var utils=require(_0x15bc('0x19'));var config=require(_0x15bc('0x1a'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x28bdd1,_0x418e85){_0x418e85=_0x418e85||0xcc;return function(_0x3b7d1d){if(_0x3b7d1d){return _0x28bdd1['sendStatus'](_0x418e85);}return _0x28bdd1['status'](_0x418e85)[_0x15bc('0x1b')]();};}function respondWithResult(_0xe2013f,_0x4cb8e2){_0x4cb8e2=_0x4cb8e2||0xc8;return function(_0xff2a31){if(_0xff2a31){return _0xe2013f['status'](_0x4cb8e2)[_0x15bc('0x1c')](_0xff2a31);}};}function respondWithFilteredResult(_0x2465d4,_0x9bd41e){return function(_0x30755e){if(_0x30755e){var _0x387086=typeof _0x9bd41e[_0x15bc('0x1d')]===_0x15bc('0x1e')&&typeof _0x9bd41e[_0x15bc('0x1f')]===_0x15bc('0x1e');var _0x35f60a=_0x30755e[_0x15bc('0x20')];var _0x43b0d6=_0x387086?0x0:_0x9bd41e['offset'];var _0x2f7a6b=_0x387086?_0x30755e[_0x15bc('0x20')]:_0x9bd41e['offset']+_0x9bd41e[_0x15bc('0x1f')];var _0x1e2761;if(_0x2f7a6b>=_0x35f60a){_0x2f7a6b=_0x35f60a;_0x1e2761=0xc8;}else{_0x1e2761=0xce;}_0x2465d4['status'](_0x1e2761);return _0x2465d4[_0x15bc('0x21')](_0x15bc('0x22'),_0x43b0d6+'-'+_0x2f7a6b+'/'+_0x35f60a)['json'](_0x30755e);}return null;};}function patchUpdates(_0x36f203){return function(_0x2ddf75){try{jsonpatch[_0x15bc('0x23')](_0x2ddf75,_0x36f203,!![]);}catch(_0x589e17){return BPromise[_0x15bc('0x24')](_0x589e17);}return _0x2ddf75['save']();};}function saveUpdates(_0x37bd4e,_0x15910d){return function(_0x4d163b){if(_0x4d163b){return _0x4d163b[_0x15bc('0x25')](_0x37bd4e)[_0x15bc('0x26')](function(_0x5d053b){return _0x5d053b;});}return null;};}function removeEntity(_0x5ed66e,_0x2fb918){return function(_0x54f421){if(_0x54f421){return _0x54f421[_0x15bc('0x27')]()['then'](function(){_0x5ed66e[_0x15bc('0x28')](0xcc)[_0x15bc('0x1b')]();});}};}function handleEntityNotFound(_0xddb83b,_0x310e99){return function(_0x749b78){if(!_0x749b78){_0xddb83b[_0x15bc('0x29')](0x194);}return _0x749b78;};}function handleError(_0x4d3dc8,_0x245af6){_0x245af6=_0x245af6||0x1f4;return function(_0x3a98d2){logger[_0x15bc('0x2a')](_0x3a98d2['stack']);if(_0x3a98d2[_0x15bc('0x2b')]){delete _0x3a98d2[_0x15bc('0x2b')];}_0x4d3dc8['status'](_0x245af6)[_0x15bc('0x2c')](_0x3a98d2);};}exports[_0x15bc('0x2d')]=function(_0x1fefff,_0x2b0aff){var _0x5d98d2={},_0xe005c1={},_0x5c9e3d={'count':0x0,'rows':[]};var _0x1c477e=_[_0x15bc('0x2e')](db[_0x15bc('0x2f')][_0x15bc('0x30')],function(_0x5c7c88){return{'name':_0x5c7c88['fieldName'],'type':_0x5c7c88['type'][_0x15bc('0x31')]};});_0xe005c1['model']=_[_0x15bc('0x2e')](_0x1c477e,'name');_0xe005c1['query']=_[_0x15bc('0x32')](_0x1fefff[_0x15bc('0x33')]);_0xe005c1[_0x15bc('0x34')]=_[_0x15bc('0x35')](_0xe005c1[_0x15bc('0x36')],_0xe005c1['query']);_0x5d98d2[_0x15bc('0x37')]=_[_0x15bc('0x35')](_0xe005c1[_0x15bc('0x36')],qs[_0x15bc('0x38')](_0x1fefff['query']['fields']));_0x5d98d2[_0x15bc('0x37')]=_0x5d98d2[_0x15bc('0x37')][_0x15bc('0x39')]?_0x5d98d2[_0x15bc('0x37')]:_0xe005c1[_0x15bc('0x36')];if(!_0x1fefff[_0x15bc('0x33')][_0x15bc('0x3a')](_0x15bc('0x3b'))){_0x5d98d2['limit']=qs[_0x15bc('0x1f')](_0x1fefff[_0x15bc('0x33')][_0x15bc('0x1f')]);_0x5d98d2[_0x15bc('0x1d')]=qs['offset'](_0x1fefff[_0x15bc('0x33')]['offset']);}_0x5d98d2['order']=qs['sort'](_0x1fefff['query'][_0x15bc('0x3c')]);_0x5d98d2[_0x15bc('0x3d')]=qs[_0x15bc('0x34')](_[_0x15bc('0x3e')](_0x1fefff[_0x15bc('0x33')],_0xe005c1[_0x15bc('0x34')]),_0x1c477e);if(_0x1fefff[_0x15bc('0x33')][_0x15bc('0x3f')]){_0x5d98d2[_0x15bc('0x3d')]=_[_0x15bc('0x40')](_0x5d98d2[_0x15bc('0x3d')],{'$or':_[_0x15bc('0x2e')](_0x1c477e,function(_0x356fec){if(_0x356fec['type']!==_0x15bc('0x41')){var _0xbba27f={};_0xbba27f[_0x356fec[_0x15bc('0x2b')]]={'$like':'%'+_0x1fefff[_0x15bc('0x33')][_0x15bc('0x3f')]+'%'};return _0xbba27f;}})});}_0x5d98d2=_['merge']({},_0x5d98d2,_0x1fefff[_0x15bc('0x42')]);var _0x2b0bf9={'where':_0x5d98d2[_0x15bc('0x3d')]};return db[_0x15bc('0x2f')][_0x15bc('0x20')](_0x2b0bf9)[_0x15bc('0x26')](function(_0x411c90){_0x5c9e3d[_0x15bc('0x20')]=_0x411c90;if(_0x1fefff[_0x15bc('0x33')]['includeAll']){_0x5d98d2['include']=[{'all':!![]}];}return db[_0x15bc('0x2f')]['findAll'](_0x5d98d2);})[_0x15bc('0x26')](function(_0x3d4758){_0x5c9e3d[_0x15bc('0x43')]=_0x3d4758;return _0x5c9e3d;})[_0x15bc('0x26')](respondWithFilteredResult(_0x2b0aff,_0x5d98d2))[_0x15bc('0x44')](handleError(_0x2b0aff,null));};exports[_0x15bc('0x45')]=function(_0x29e284,_0x57a864){var _0x5609a0={'raw':!![],'where':{'id':_0x29e284[_0x15bc('0x46')]['id']}},_0x178e2a={};_0x178e2a['model']=_[_0x15bc('0x32')](db[_0x15bc('0x2f')][_0x15bc('0x30')]);_0x178e2a[_0x15bc('0x33')]=_[_0x15bc('0x32')](_0x29e284[_0x15bc('0x33')]);_0x178e2a[_0x15bc('0x34')]=_[_0x15bc('0x35')](_0x178e2a['model'],_0x178e2a[_0x15bc('0x33')]);_0x5609a0[_0x15bc('0x37')]=_[_0x15bc('0x35')](_0x178e2a[_0x15bc('0x36')],qs['fields'](_0x29e284[_0x15bc('0x33')][_0x15bc('0x38')]));_0x5609a0[_0x15bc('0x37')]=_0x5609a0[_0x15bc('0x37')][_0x15bc('0x39')]?_0x5609a0[_0x15bc('0x37')]:_0x178e2a[_0x15bc('0x36')];if(_0x29e284[_0x15bc('0x33')][_0x15bc('0x47')]){_0x5609a0['include']=[{'all':!![]}];}_0x5609a0=_['merge']({},_0x5609a0,_0x29e284[_0x15bc('0x42')]);return db[_0x15bc('0x2f')]['find'](_0x5609a0)[_0x15bc('0x26')](handleEntityNotFound(_0x57a864,null))[_0x15bc('0x26')](respondWithResult(_0x57a864,null))[_0x15bc('0x44')](handleError(_0x57a864,null));};exports['create']=function(_0x421f3c,_0x15aae5){return db[_0x15bc('0x2f')][_0x15bc('0x48')](_0x421f3c[_0x15bc('0x49')],{})[_0x15bc('0x26')](respondWithResult(_0x15aae5,0xc9))[_0x15bc('0x44')](handleError(_0x15aae5,null));};exports[_0x15bc('0x25')]=function(_0x363430,_0x460142){if(_0x363430['body']['id']){delete _0x363430[_0x15bc('0x49')]['id'];}return db[_0x15bc('0x2f')][_0x15bc('0x4a')]({'where':{'id':_0x363430[_0x15bc('0x46')]['id']}})['then'](handleEntityNotFound(_0x460142,null))[_0x15bc('0x26')](saveUpdates(_0x363430['body'],null))[_0x15bc('0x26')](respondWithResult(_0x460142,null))['catch'](handleError(_0x460142,null));};exports[_0x15bc('0x27')]=function(_0x57959e,_0x464301){return db[_0x15bc('0x2f')][_0x15bc('0x4a')]({'where':{'id':_0x57959e[_0x15bc('0x46')]['id']}})['then'](handleEntityNotFound(_0x464301,null))['then'](removeEntity(_0x464301,null))[_0x15bc('0x44')](handleError(_0x464301,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.model.js b/server/api/intSugarcrmField/intSugarcrmField.model.js index f30521d..a42511e 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 _0xe9f1=['SugarcrmField','sugarcrm_unique_index','idField','lodash','util','../../config/logger','moment','bluebird','path','./intSugarcrmField.attributes'];(function(_0x5cd6fd,_0x430a68){var _0x4153d3=function(_0x1cb77e){while(--_0x1cb77e){_0x5cd6fd['push'](_0x5cd6fd['shift']());}};_0x4153d3(++_0x430a68);}(_0xe9f1,0x139));var _0x1e9f=function(_0x491a7f,_0x28bb80){_0x491a7f=_0x491a7f-0x0;var _0x3d8f44=_0xe9f1[_0x491a7f];return _0x3d8f44;};'use strict';var _=require(_0x1e9f('0x0'));var util=require(_0x1e9f('0x1'));var logger=require(_0x1e9f('0x2'))('api');var moment=require(_0x1e9f('0x3'));var BPromise=require(_0x1e9f('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1e9f('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x1e9f('0x6'));module['exports']=function(_0x4968c1,_0x556817){return _0x4968c1['define'](_0x1e9f('0x7'),attributes,{'tableName':'int_sugarcrm_fields','paranoid':![],'indexes':[{'name':_0x1e9f('0x8'),'fields':[_0x1e9f('0x9'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x42eb=['define','int_sugarcrm_fields','sugarcrm_unique_index','idField','FieldId','util','api','moment','bluebird','path','rimraf','../../config/environment','./intSugarcrmField.attributes','exports'];(function(_0x534412,_0x25125e){var _0x5bc2d5=function(_0x3ab842){while(--_0x3ab842){_0x534412['push'](_0x534412['shift']());}};_0x5bc2d5(++_0x25125e);}(_0x42eb,0x1d3));var _0xb42e=function(_0x54defc,_0x627178){_0x54defc=_0x54defc-0x0;var _0x1955d3=_0x42eb[_0x54defc];return _0x1955d3;};'use strict';var _=require('lodash');var util=require(_0xb42e('0x0'));var logger=require('../../config/logger')(_0xb42e('0x1'));var moment=require(_0xb42e('0x2'));var BPromise=require(_0xb42e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb42e('0x4'));var rimraf=require(_0xb42e('0x5'));var config=require(_0xb42e('0x6'));var attributes=require(_0xb42e('0x7'));module[_0xb42e('0x8')]=function(_0x5cbc9f,_0x33f542){return _0x5cbc9f[_0xb42e('0x9')]('SugarcrmField',attributes,{'tableName':_0xb42e('0xa'),'paranoid':![],'indexes':[{'name':_0xb42e('0xb'),'fields':[_0xb42e('0xc'),_0xb42e('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.rpc.js b/server/api/intSugarcrmField/intSugarcrmField.rpc.js index 91d4769..7c6fb22 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 _0xfbf4=['info','SugarcrmField,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../config/environment','jayson/promise','http','request'];(function(_0x2a9490,_0x43cb5f){var _0x5bf90e=function(_0x207583){while(--_0x207583){_0x2a9490['push'](_0x2a9490['shift']());}};_0x5bf90e(++_0x43cb5f);}(_0xfbf4,0x75));var _0x4fbf=function(_0x31995d,_0x589acc){_0x31995d=_0x31995d-0x0;var _0x33c391=_0xfbf4[_0x31995d];return _0x33c391;};'use strict';var _=require(_0x4fbf('0x0'));var util=require(_0x4fbf('0x1'));var moment=require('moment');var BPromise=require(_0x4fbf('0x2'));var rs=require(_0x4fbf('0x3'));var fs=require('fs');var Redis=require(_0x4fbf('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x4fbf('0x5'));var jayson=require(_0x4fbf('0x6'));var client=jayson['client'][_0x4fbf('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x5a5be8,_0x338674,_0x15a1d2){return new BPromise(function(_0x1ada1f,_0xe12206){return client[_0x4fbf('0x8')](_0x5a5be8,_0x15a1d2)['then'](function(_0x22602c){logger[_0x4fbf('0x9')](_0x4fbf('0xa'),_0x338674,_0x4fbf('0xb'));logger['debug']('SugarcrmField,\x20%s,\x20%s,\x20%s',_0x338674,_0x4fbf('0xb'),JSON[_0x4fbf('0xc')](_0x22602c));if(_0x22602c[_0x4fbf('0xd')]){if(_0x22602c[_0x4fbf('0xd')][_0x4fbf('0xe')]===0x1f4){logger['error'](_0x4fbf('0xa'),_0x338674,_0x22602c[_0x4fbf('0xd')]['message']);return _0xe12206(_0x22602c[_0x4fbf('0xd')][_0x4fbf('0xf')]);}logger[_0x4fbf('0xd')](_0x4fbf('0xa'),_0x338674,_0x22602c[_0x4fbf('0xd')][_0x4fbf('0xf')]);return _0x1ada1f(_0x22602c[_0x4fbf('0xd')][_0x4fbf('0xf')]);}else{logger[_0x4fbf('0x9')](_0x4fbf('0xa'),_0x338674,_0x4fbf('0xb'));_0x1ada1f(_0x22602c[_0x4fbf('0x10')]['message']);}})[_0x4fbf('0x11')](function(_0x1335e6){logger[_0x4fbf('0xd')](_0x4fbf('0xa'),_0x338674,_0x1335e6);_0xe12206(_0x1335e6);});});} \ No newline at end of file +var _0xb17b=['util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','jayson/promise','client','request','then','info','SugarcrmField,\x20%s,\x20%s','request\x20sent','SugarcrmField,\x20%s,\x20%s,\x20%s','stringify','error','message','lodash'];(function(_0x3f6c29,_0x370d86){var _0x4af959=function(_0x263612){while(--_0x263612){_0x3f6c29['push'](_0x3f6c29['shift']());}};_0x4af959(++_0x370d86);}(_0xb17b,0x142));var _0xbb17=function(_0x448516,_0x3559ad){_0x448516=_0x448516-0x0;var _0x137d26=_0xb17b[_0x448516];return _0x137d26;};'use strict';var _=require(_0xbb17('0x0'));var util=require(_0xbb17('0x1'));var moment=require(_0xbb17('0x2'));var BPromise=require(_0xbb17('0x3'));var rs=require(_0xbb17('0x4'));var fs=require('fs');var Redis=require(_0xbb17('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xbb17('0x6'));var logger=require('../../config/logger')(_0xbb17('0x7'));var config=require('../../config/environment');var jayson=require(_0xbb17('0x8'));var client=jayson[_0xbb17('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x44d166,_0x3b4ee1,_0x5ea1c1){return new BPromise(function(_0x4fc92c,_0x47344b){return client[_0xbb17('0xa')](_0x44d166,_0x5ea1c1)[_0xbb17('0xb')](function(_0x5998c5){logger[_0xbb17('0xc')](_0xbb17('0xd'),_0x3b4ee1,_0xbb17('0xe'));logger['debug'](_0xbb17('0xf'),_0x3b4ee1,_0xbb17('0xe'),JSON[_0xbb17('0x10')](_0x5998c5));if(_0x5998c5[_0xbb17('0x11')]){if(_0x5998c5['error']['code']===0x1f4){logger[_0xbb17('0x11')](_0xbb17('0xd'),_0x3b4ee1,_0x5998c5[_0xbb17('0x11')][_0xbb17('0x12')]);return _0x47344b(_0x5998c5['error'][_0xbb17('0x12')]);}logger[_0xbb17('0x11')](_0xbb17('0xd'),_0x3b4ee1,_0x5998c5[_0xbb17('0x11')][_0xbb17('0x12')]);return _0x4fc92c(_0x5998c5[_0xbb17('0x11')][_0xbb17('0x12')]);}else{logger[_0xbb17('0xc')]('SugarcrmField,\x20%s,\x20%s',_0x3b4ee1,_0xbb17('0xe'));_0x4fc92c(_0x5998c5['result'][_0xbb17('0x12')]);}})['catch'](function(_0x53e363){logger[_0xbb17('0x11')](_0xbb17('0xd'),_0x3b4ee1,_0x53e363);_0x47344b(_0x53e363);});});} \ No newline at end of file diff --git a/server/api/intVtigerAccount/index.js b/server/api/intVtigerAccount/index.js index a14bc48..01e5fdb 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 _0xefe5=['update','delete','destroy','exports','multer','path','connect-timeout','Router','fs-extra','../../components/interaction/service','./intVtigerAccount.controller','get','isAuthenticated','index','show','/:id/configurations','getConfigurations','/:id/fields','post','create','put','/:id'];(function(_0xbb6185,_0x98d595){var _0x435d96=function(_0x8e0918){while(--_0x8e0918){_0xbb6185['push'](_0xbb6185['shift']());}};_0x435d96(++_0x98d595);}(_0xefe5,0xf6));var _0x5efe=function(_0x4a6de2,_0x451b92){_0x4a6de2=_0x4a6de2-0x0;var _0x5c4cb8=_0xefe5[_0x4a6de2];return _0x5c4cb8;};'use strict';var multer=require(_0x5efe('0x0'));var util=require('util');var path=require(_0x5efe('0x1'));var timeout=require(_0x5efe('0x2'));var express=require('express');var router=express[_0x5efe('0x3')]();var fs_extra=require(_0x5efe('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x5efe('0x5'));var config=require('../../config/environment');var controller=require(_0x5efe('0x6'));router[_0x5efe('0x7')]('/',auth[_0x5efe('0x8')](),controller[_0x5efe('0x9')]);router[_0x5efe('0x7')]('/:id',auth[_0x5efe('0x8')](),controller[_0x5efe('0xa')]);router[_0x5efe('0x7')](_0x5efe('0xb'),auth[_0x5efe('0x8')](),controller[_0x5efe('0xc')]);router[_0x5efe('0x7')](_0x5efe('0xd'),auth[_0x5efe('0x8')](),controller['getFields']);router[_0x5efe('0xe')]('/',auth[_0x5efe('0x8')](),controller[_0x5efe('0xf')]);router[_0x5efe('0xe')]('/:id/configurations',auth['isAuthenticated'](),controller['addConfiguration']);router[_0x5efe('0x10')](_0x5efe('0x11'),auth[_0x5efe('0x8')](),controller[_0x5efe('0x12')]);router[_0x5efe('0x13')](_0x5efe('0x11'),auth[_0x5efe('0x8')](),controller[_0x5efe('0x14')]);module[_0x5efe('0x15')]=router; \ No newline at end of file +var _0xea70=['../../components/interaction/service','../../config/environment','./intVtigerAccount.controller','get','isAuthenticated','/:id','show','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','delete','destroy','multer','util','path','express','fs-extra'];(function(_0x325f1a,_0x44cea5){var _0x15f0fd=function(_0x23407c){while(--_0x23407c){_0x325f1a['push'](_0x325f1a['shift']());}};_0x15f0fd(++_0x44cea5);}(_0xea70,0x175));var _0x0ea7=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xea70[_0xa464c9];return _0x3d73c4;};'use strict';var multer=require(_0x0ea7('0x0'));var util=require(_0x0ea7('0x1'));var path=require(_0x0ea7('0x2'));var timeout=require('connect-timeout');var express=require(_0x0ea7('0x3'));var router=express['Router']();var fs_extra=require(_0x0ea7('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x0ea7('0x5'));var config=require(_0x0ea7('0x6'));var controller=require(_0x0ea7('0x7'));router[_0x0ea7('0x8')]('/',auth[_0x0ea7('0x9')](),controller['index']);router[_0x0ea7('0x8')](_0x0ea7('0xa'),auth['isAuthenticated'](),controller[_0x0ea7('0xb')]);router[_0x0ea7('0x8')]('/:id/configurations',auth[_0x0ea7('0x9')](),controller[_0x0ea7('0xc')]);router[_0x0ea7('0x8')](_0x0ea7('0xd'),auth['isAuthenticated'](),controller[_0x0ea7('0xe')]);router[_0x0ea7('0xf')]('/',auth[_0x0ea7('0x9')](),controller[_0x0ea7('0x10')]);router[_0x0ea7('0xf')]('/:id/configurations',auth[_0x0ea7('0x9')](),controller[_0x0ea7('0x11')]);router[_0x0ea7('0x12')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0x0ea7('0x13')](_0x0ea7('0xa'),auth[_0x0ea7('0x9')](),controller[_0x0ea7('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.attributes.js b/server/api/intVtigerAccount/intVtigerAccount.attributes.js index d2d7445..6838430 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 _0xcd75=['STRING','HelpDesk','sequelize','exports'];(function(_0x1f0910,_0x5345dc){var _0x1ad566=function(_0x46f0d5){while(--_0x46f0d5){_0x1f0910['push'](_0x1f0910['shift']());}};_0x1ad566(++_0x5345dc);}(_0xcd75,0x10e));var _0x5cd7=function(_0x24e964,_0x5e6454){_0x24e964=_0x24e964-0x0;var _0x4044b5=_0xcd75[_0x24e964];return _0x4044b5;};'use strict';var Sequelize=require(_0x5cd7('0x0'));module[_0x5cd7('0x1')]={'name':{'type':Sequelize[_0x5cd7('0x2')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x5cd7('0x2')],'allowNull':![]},'moduleName':{'type':Sequelize[_0x5cd7('0x2')],'allowNull':![],'defaultValue':_0x5cd7('0x3')},'remoteUri':{'type':Sequelize[_0x5cd7('0x2')],'allowNull':![]},'serverUrl':{'type':Sequelize[_0x5cd7('0x2')],'allowNull':![]},'accessKey':{'type':Sequelize[_0x5cd7('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x861a=['exports','STRING','HelpDesk','sequelize'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x861a,0x117));var _0xa861=function(_0x1b058f,_0x5eeb2c){_0x1b058f=_0x1b058f-0x0;var _0x2148df=_0x861a[_0x1b058f];return _0x2148df;};'use strict';var Sequelize=require(_0xa861('0x0'));module[_0xa861('0x1')]={'name':{'type':Sequelize[_0xa861('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xa861('0x2')]},'username':{'type':Sequelize[_0xa861('0x2')],'allowNull':![]},'moduleName':{'type':Sequelize[_0xa861('0x2')],'allowNull':![],'defaultValue':_0xa861('0x3')},'remoteUri':{'type':Sequelize[_0xa861('0x2')],'allowNull':![]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'accessKey':{'type':Sequelize[_0xa861('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 6e0a497..7bd8d32 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 _0x6e6d=['picklist','picklistValues','label','value','vTiger\x20error:\x20','statusCode','error','getFields,\x20%s,\x20%s,\x20%s','stringify','test','rimraf','fast-json-patch','request-promise','bluebird','mustache','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/license/util','../../mysqldb','../../components/integrations/configuration','status','json','offset','limit','count','apply','reject','save','then','destroy','stack','name','send','index','VtigerAccount','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','rows','catch','rawAttributes','fields','length','includeAll','include','find','update','body','params','getConfigurations','findOne','VtigerConfiguration','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','create','VtigerField','md5','username','description','moduleName','remoteUri','serverUrl','slice','substring','%s/webservice.php','GET','success','token','describe','result','sessionName','autogenerated','reference','owner','remove','includes','editable','startsWith','cf_'];(function(_0x3c65e5,_0x1b96f2){var _0x50179f=function(_0x4638ca){while(--_0x4638ca){_0x3c65e5['push'](_0x3c65e5['shift']());}};_0x50179f(++_0x1b96f2);}(_0x6e6d,0x7c));var _0xd6e6=function(_0xfdc070,_0x359a79){_0xfdc070=_0xfdc070-0x0;var _0x4430dd=_0x6e6d[_0xfdc070];return _0x4430dd;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xd6e6('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd6e6('0x1'));var rp=require(_0xd6e6('0x2'));var moment=require('moment');var BPromise=require(_0xd6e6('0x3'));var Mustache=require(_0xd6e6('0x4'));var util=require('util');var path=require(_0xd6e6('0x5'));var sox=require(_0xd6e6('0x6'));var csv=require('to-csv');var ejs=require(_0xd6e6('0x7'));var fs=require('fs');var fs_extra=require(_0xd6e6('0x8'));var _=require(_0xd6e6('0x9'));var squel=require(_0xd6e6('0xa'));var crypto=require(_0xd6e6('0xb'));var jsforce=require(_0xd6e6('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xd6e6('0xd'));var querystring=require(_0xd6e6('0xe'));var Papa=require(_0xd6e6('0xf'));var Redis=require(_0xd6e6('0x10'));var authService=require(_0xd6e6('0x11'));var qs=require(_0xd6e6('0x12'));var as=require(_0xd6e6('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xd6e6('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xd6e6('0x15'));var db=require(_0xd6e6('0x16'))['db'];var integrations=require(_0xd6e6('0x17'));function respondWithStatusCode(_0x2b0fd5,_0x376d5e){_0x376d5e=_0x376d5e||0xcc;return function(_0x12984c){if(_0x12984c){return _0x2b0fd5['sendStatus'](_0x376d5e);}return _0x2b0fd5[_0xd6e6('0x18')](_0x376d5e)['end']();};}function respondWithResult(_0x50ac3d,_0x303d98){_0x303d98=_0x303d98||0xc8;return function(_0x256f24){if(_0x256f24){return _0x50ac3d[_0xd6e6('0x18')](_0x303d98)[_0xd6e6('0x19')](_0x256f24);}};}function respondWithFilteredResult(_0x4338dc,_0x23033c){return function(_0x4d13b5){if(_0x4d13b5){var _0x23a295=typeof _0x23033c[_0xd6e6('0x1a')]==='undefined'&&typeof _0x23033c[_0xd6e6('0x1b')]==='undefined';var _0x3b02ec=_0x4d13b5['count'];var _0x476842=_0x23a295?0x0:_0x23033c[_0xd6e6('0x1a')];var _0x1d6d51=_0x23a295?_0x4d13b5[_0xd6e6('0x1c')]:_0x23033c[_0xd6e6('0x1a')]+_0x23033c[_0xd6e6('0x1b')];var _0x200fa6;if(_0x1d6d51>=_0x3b02ec){_0x1d6d51=_0x3b02ec;_0x200fa6=0xc8;}else{_0x200fa6=0xce;}_0x4338dc['status'](_0x200fa6);return _0x4338dc['set']('Content-Range',_0x476842+'-'+_0x1d6d51+'/'+_0x3b02ec)['json'](_0x4d13b5);}return null;};}function patchUpdates(_0x218796){return function(_0x5c10ed){try{jsonpatch[_0xd6e6('0x1d')](_0x5c10ed,_0x218796,!![]);}catch(_0xe7e1bc){return BPromise[_0xd6e6('0x1e')](_0xe7e1bc);}return _0x5c10ed[_0xd6e6('0x1f')]();};}function saveUpdates(_0x28ce0a,_0x6a6a0f){return function(_0x144da1){if(_0x144da1){return _0x144da1['update'](_0x28ce0a)[_0xd6e6('0x20')](function(_0x3da69a){return _0x3da69a;});}return null;};}function removeEntity(_0x54afaf,_0x7a2d7a){return function(_0x2f5f0e){if(_0x2f5f0e){return _0x2f5f0e[_0xd6e6('0x21')]()[_0xd6e6('0x20')](function(){_0x54afaf[_0xd6e6('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x51c4f4,_0x1ad89e){return function(_0x427157){if(!_0x427157){_0x51c4f4['sendStatus'](0x194);}return _0x427157;};}function handleError(_0x158afd,_0x39526f){_0x39526f=_0x39526f||0x1f4;return function(_0x4bf651){logger['error'](_0x4bf651[_0xd6e6('0x22')]);if(_0x4bf651[_0xd6e6('0x23')]){delete _0x4bf651[_0xd6e6('0x23')];}_0x158afd[_0xd6e6('0x18')](_0x39526f)[_0xd6e6('0x24')](_0x4bf651);};}exports[_0xd6e6('0x25')]=function(_0x346400,_0x1e012f){var _0x5f3245={},_0x2d2b59={},_0x24dc20={'count':0x0,'rows':[]};var _0x42bc39=_['map'](db[_0xd6e6('0x26')]['rawAttributes'],function(_0x309573){return{'name':_0x309573[_0xd6e6('0x27')],'type':_0x309573[_0xd6e6('0x28')][_0xd6e6('0x29')]};});_0x2d2b59[_0xd6e6('0x2a')]=_[_0xd6e6('0x2b')](_0x42bc39,_0xd6e6('0x23'));_0x2d2b59[_0xd6e6('0x2c')]=_[_0xd6e6('0x2d')](_0x346400[_0xd6e6('0x2c')]);_0x2d2b59[_0xd6e6('0x2e')]=_[_0xd6e6('0x2f')](_0x2d2b59['model'],_0x2d2b59['query']);_0x5f3245[_0xd6e6('0x30')]=_[_0xd6e6('0x2f')](_0x2d2b59[_0xd6e6('0x2a')],qs['fields'](_0x346400[_0xd6e6('0x2c')]['fields']));_0x5f3245['attributes']=_0x5f3245['attributes']['length']?_0x5f3245[_0xd6e6('0x30')]:_0x2d2b59['model'];if(!_0x346400[_0xd6e6('0x2c')][_0xd6e6('0x31')]('nolimit')){_0x5f3245[_0xd6e6('0x1b')]=qs[_0xd6e6('0x1b')](_0x346400[_0xd6e6('0x2c')][_0xd6e6('0x1b')]);_0x5f3245['offset']=qs['offset'](_0x346400[_0xd6e6('0x2c')][_0xd6e6('0x1a')]);}_0x5f3245[_0xd6e6('0x32')]=qs[_0xd6e6('0x33')](_0x346400[_0xd6e6('0x2c')]['sort']);_0x5f3245[_0xd6e6('0x34')]=qs[_0xd6e6('0x2e')](_[_0xd6e6('0x35')](_0x346400['query'],_0x2d2b59[_0xd6e6('0x2e')]),_0x42bc39);if(_0x346400[_0xd6e6('0x2c')][_0xd6e6('0x36')]){_0x5f3245['where']=_[_0xd6e6('0x37')](_0x5f3245[_0xd6e6('0x34')],{'$or':_[_0xd6e6('0x2b')](_0x42bc39,function(_0x434d70){if(_0x434d70[_0xd6e6('0x28')]!==_0xd6e6('0x38')){var _0x497d61={};_0x497d61[_0x434d70['name']]={'$like':'%'+_0x346400[_0xd6e6('0x2c')][_0xd6e6('0x36')]+'%'};return _0x497d61;}})});}_0x5f3245=_['merge']({},_0x5f3245,_0x346400[_0xd6e6('0x39')]);var _0x4e0735={'where':_0x5f3245[_0xd6e6('0x34')]};return db[_0xd6e6('0x26')]['count'](_0x4e0735)['then'](function(_0x35b4ad){_0x24dc20[_0xd6e6('0x1c')]=_0x35b4ad;if(_0x346400[_0xd6e6('0x2c')]['includeAll']){_0x5f3245['include']=[{'all':!![]}];}return db[_0xd6e6('0x26')]['findAll'](_0x5f3245);})['then'](function(_0x51c510){_0x24dc20[_0xd6e6('0x3a')]=_0x51c510;return _0x24dc20;})[_0xd6e6('0x20')](respondWithFilteredResult(_0x1e012f,_0x5f3245))[_0xd6e6('0x3b')](handleError(_0x1e012f,null));};exports['show']=function(_0x34792f,_0x1f2640){var _0x393218={'raw':![],'where':{'id':_0x34792f['params']['id']}},_0x5a170c={};_0x5a170c[_0xd6e6('0x2a')]=_['keys'](db[_0xd6e6('0x26')][_0xd6e6('0x3c')]);_0x5a170c[_0xd6e6('0x2c')]=_[_0xd6e6('0x2d')](_0x34792f[_0xd6e6('0x2c')]);_0x5a170c[_0xd6e6('0x2e')]=_[_0xd6e6('0x2f')](_0x5a170c['model'],_0x5a170c['query']);_0x393218['attributes']=_['intersection'](_0x5a170c['model'],qs[_0xd6e6('0x3d')](_0x34792f[_0xd6e6('0x2c')][_0xd6e6('0x3d')]));_0x393218[_0xd6e6('0x30')]=_0x393218[_0xd6e6('0x30')][_0xd6e6('0x3e')]?_0x393218[_0xd6e6('0x30')]:_0x5a170c[_0xd6e6('0x2a')];if(_0x34792f['query'][_0xd6e6('0x3f')]){_0x393218[_0xd6e6('0x40')]=[{'all':!![]}];}_0x393218=_['merge']({},_0x393218,_0x34792f[_0xd6e6('0x39')]);return db[_0xd6e6('0x26')][_0xd6e6('0x41')](_0x393218)[_0xd6e6('0x20')](handleEntityNotFound(_0x1f2640,null))[_0xd6e6('0x20')](respondWithResult(_0x1f2640,null))['catch'](handleError(_0x1f2640,null));};exports['create']=function(_0x34ca92,_0xae4a8d){return db[_0xd6e6('0x26')]['create'](_0x34ca92['body'],{})[_0xd6e6('0x20')](respondWithResult(_0xae4a8d,0xc9))[_0xd6e6('0x3b')](handleError(_0xae4a8d,null));};exports[_0xd6e6('0x42')]=function(_0x2e5343,_0x54fdf7){if(_0x2e5343[_0xd6e6('0x43')]['id']){delete _0x2e5343[_0xd6e6('0x43')]['id'];}return db[_0xd6e6('0x26')]['find']({'where':{'id':_0x2e5343[_0xd6e6('0x44')]['id']}})[_0xd6e6('0x20')](handleEntityNotFound(_0x54fdf7,null))[_0xd6e6('0x20')](saveUpdates(_0x2e5343[_0xd6e6('0x43')],null))['then'](respondWithResult(_0x54fdf7,null))[_0xd6e6('0x3b')](handleError(_0x54fdf7,null));};exports['destroy']=function(_0x30df33,_0x4221a4){return db[_0xd6e6('0x26')]['find']({'where':{'id':_0x30df33['params']['id']}})[_0xd6e6('0x20')](handleEntityNotFound(_0x4221a4,null))[_0xd6e6('0x20')](removeEntity(_0x4221a4,null))[_0xd6e6('0x3b')](handleError(_0x4221a4,null));};exports[_0xd6e6('0x45')]=function(_0xea114d,_0x2ddffb,_0xedffd6){var _0x332b85={};var _0x2a90a7={};var _0x19dd5a;var _0x2cb2c5;return db[_0xd6e6('0x26')][_0xd6e6('0x46')]({'where':{'id':_0xea114d[_0xd6e6('0x44')]['id']}})[_0xd6e6('0x20')](handleEntityNotFound(_0x2ddffb,null))[_0xd6e6('0x20')](function(_0x21e4ab){if(_0x21e4ab){_0x19dd5a=_0x21e4ab;_0x2a90a7['model']=_[_0xd6e6('0x2d')](db[_0xd6e6('0x47')][_0xd6e6('0x3c')]);_0x2a90a7[_0xd6e6('0x2c')]=_[_0xd6e6('0x2d')](_0xea114d['query']);_0x2a90a7[_0xd6e6('0x2e')]=_[_0xd6e6('0x2f')](_0x2a90a7[_0xd6e6('0x2a')],_0x2a90a7[_0xd6e6('0x2c')]);_0x332b85[_0xd6e6('0x30')]=_[_0xd6e6('0x2f')](_0x2a90a7[_0xd6e6('0x2a')],qs['fields'](_0xea114d[_0xd6e6('0x2c')][_0xd6e6('0x3d')]));_0x332b85[_0xd6e6('0x30')]=_0x332b85[_0xd6e6('0x30')]['length']?_0x332b85[_0xd6e6('0x30')]:_0x2a90a7[_0xd6e6('0x2a')];_0x332b85[_0xd6e6('0x32')]=qs['sort'](_0xea114d[_0xd6e6('0x2c')][_0xd6e6('0x33')]);_0x332b85['where']=qs['filters'](_[_0xd6e6('0x35')](_0xea114d[_0xd6e6('0x2c')],_0x2a90a7['filters']));if(_0xea114d[_0xd6e6('0x2c')][_0xd6e6('0x36')]){_0x332b85[_0xd6e6('0x34')]=_[_0xd6e6('0x37')](_0x332b85[_0xd6e6('0x34')],{'$or':_[_0xd6e6('0x2b')](_0x332b85[_0xd6e6('0x30')],function(_0x431ecf){var _0x471d13={};_0x471d13[_0x431ecf]={'$like':'%'+_0xea114d[_0xd6e6('0x2c')][_0xd6e6('0x36')]+'%'};return _0x471d13;})});}_0x332b85=_[_0xd6e6('0x37')]({},_0x332b85,_0xea114d[_0xd6e6('0x39')]);return _0x19dd5a['getConfigurations'](_0x332b85);}})[_0xd6e6('0x20')](function(_0x1b1380){if(_0x1b1380){_0x2cb2c5=_0x1b1380[_0xd6e6('0x3e')];if(!_0xea114d[_0xd6e6('0x2c')]['hasOwnProperty']('nolimit')){_0x332b85[_0xd6e6('0x1b')]=qs['limit'](_0xea114d[_0xd6e6('0x2c')][_0xd6e6('0x1b')]);_0x332b85[_0xd6e6('0x1a')]=qs[_0xd6e6('0x1a')](_0xea114d[_0xd6e6('0x2c')][_0xd6e6('0x1a')]);}return _0x19dd5a[_0xd6e6('0x45')](_0x332b85);}})['then'](function(_0x26b00d){if(_0x26b00d){return _0x26b00d?{'count':_0x2cb2c5,'rows':_0x26b00d}:null;}})[_0xd6e6('0x20')](respondWithResult(_0x2ddffb,null))[_0xd6e6('0x3b')](handleError(_0x2ddffb,null));};exports[_0xd6e6('0x48')]=function(_0x4cf3cf,_0x58a5f7,_0xd08ab4){if(_0x4cf3cf['body']['id']){delete _0x4cf3cf['body']['id'];}return db[_0xd6e6('0x26')]['findOne']({'where':{'id':_0x4cf3cf[_0xd6e6('0x44')]['id']}})[_0xd6e6('0x20')](handleEntityNotFound(_0x58a5f7,null))[_0xd6e6('0x20')](function(_0x1e8873){if(_0x1e8873){_0x4cf3cf[_0xd6e6('0x43')][_0xd6e6('0x49')]=_0x1e8873['id'];_0x4cf3cf['body'][_0xd6e6('0x4a')]=integrations[_0xd6e6('0x4b')](_0x4cf3cf[_0xd6e6('0x43')][_0xd6e6('0x4c')],_0x4cf3cf[_0xd6e6('0x43')][_0xd6e6('0x28')]);_0x4cf3cf[_0xd6e6('0x43')][_0xd6e6('0x4d')]=integrations[_0xd6e6('0x4e')](_0x4cf3cf['body'][_0xd6e6('0x4c')],_0x4cf3cf[_0xd6e6('0x43')][_0xd6e6('0x28')]);return db[_0xd6e6('0x47')][_0xd6e6('0x4f')](_0x4cf3cf['body'],{'include':[{'model':db[_0xd6e6('0x50')],'as':_0xd6e6('0x4a')},{'model':db[_0xd6e6('0x50')],'as':_0xd6e6('0x4d')}]});}return null;})[_0xd6e6('0x20')](respondWithResult(_0x58a5f7,null))['catch'](handleError(_0x58a5f7,null));};var md5=require(_0xd6e6('0x51'));exports['getFields']=function(_0x4cec8f,_0x2019d6,_0x1bb9bb){var _0x3b8694=null;var _0x50a611=null;var _0x122376=null;var _0x3504f4=null;var _0x184b2f='';return db[_0xd6e6('0x26')][_0xd6e6('0x46')]({'where':{'id':_0x4cec8f['params']['id']},'attributes':['id','name',_0xd6e6('0x52'),_0xd6e6('0x53'),_0xd6e6('0x54'),_0xd6e6('0x55'),_0xd6e6('0x56'),'accessKey']})[_0xd6e6('0x20')](handleEntityNotFound(_0x2019d6,null))[_0xd6e6('0x20')](function(_0x229445){if(_0x229445){_0x3b8694=_0x229445[_0xd6e6('0x52')];_0x50a611=_0x229445['accessKey'];_0x122376=_0x229445['moduleName'];_0x184b2f=_0x229445[_0xd6e6('0x55')];var _0x4e2728=_0x184b2f[_0xd6e6('0x57')](-0x1);if(_0x4e2728==='/'){_0x184b2f=_0x184b2f[_0xd6e6('0x58')](0x0,_0x184b2f['lastIndexOf'](_0x4e2728));}_0x3504f4=util['format'](_0xd6e6('0x59'),_0x184b2f);var _0x572786={'method':_0xd6e6('0x5a'),'uri':_0x3504f4,'qs':{'operation':'getchallenge','username':_0x229445[_0xd6e6('0x52')]},'json':!![]};return rp(_0x572786);}})[_0xd6e6('0x20')](function(_0x589a7e){if(_0x589a7e[_0xd6e6('0x5b')]){var _0x3007de={'method':'POST','uri':_0x3504f4,'form':{'operation':'login','username':_0x3b8694,'accessKey':md5(_0x589a7e['result'][_0xd6e6('0x5c')]+_0x50a611)},'json':!![]};return rp(_0x3007de);}})['then'](function(_0x300ec8){if(_0x300ec8['success']){var _0x17881e={'method':_0xd6e6('0x5a'),'uri':_0x3504f4,'qs':{'operation':_0xd6e6('0x5d'),'username':_0x3b8694,'sessionName':_0x300ec8[_0xd6e6('0x5e')][_0xd6e6('0x5f')],'elementType':_0x122376},'json':!![]};return rp(_0x17881e);}})[_0xd6e6('0x20')](function(_0x1d79c8){if(_0x1d79c8[_0xd6e6('0x5b')]){var _0x381b0b=[_0xd6e6('0x60'),_0xd6e6('0x61'),_0xd6e6('0x62')];_[_0xd6e6('0x63')](_0x1d79c8['result']['fields'],function(_0x1147c0){return _0x381b0b[_0xd6e6('0x64')](_0x1147c0['type'][_0xd6e6('0x23')]);});_[_0xd6e6('0x63')](_0x1d79c8['result']['fields'],function(_0x4043d4){return _0x4043d4[_0xd6e6('0x65')]==='false';});return{'count':_0x1d79c8[_0xd6e6('0x5e')][_0xd6e6('0x3d')]['length'],'rows':_[_0xd6e6('0x2b')](_0x1d79c8[_0xd6e6('0x5e')][_0xd6e6('0x3d')],function(_0x367434){return{'id':_0x367434[_0xd6e6('0x23')],'name':_0x367434['label'],'custom':_[_0xd6e6('0x66')](_0x367434['name'],_0xd6e6('0x67'))?!![]:![],'options':_0x367434[_0xd6e6('0x28')]['name']===_0xd6e6('0x68')&&_0x367434['type'][_0xd6e6('0x69')][_0xd6e6('0x3e')]>0x0?_['map'](_0x367434['type']['picklistValues'],function(_0x4068c2){return{'name':_0x4068c2[_0xd6e6('0x6a')],'value':_0x4068c2[_0xd6e6('0x6b')]};}):[]};})};}})[_0xd6e6('0x20')](respondWithResult(_0x2019d6,null))[_0xd6e6('0x3b')](function(_0x27cbcf){console['log'](_0xd6e6('0x6c')+_0x27cbcf);var _0x1a3d50=_0x4cec8f[_0xd6e6('0x2c')]['test']?0x1f4:_0x27cbcf[_0xd6e6('0x6d')]||0x1f4;logger[_0xd6e6('0x6e')](_0xd6e6('0x6f'),'getFields',_0x1a3d50,JSON[_0xd6e6('0x70')](_0x27cbcf));delete _0x27cbcf[_0xd6e6('0x23')];if(_0x1a3d50===0x191){_0x1a3d50=0x190;}_0x2019d6['status'](_0x1a3d50)[_0xd6e6('0x24')](_0x4cec8f[_0xd6e6('0x2c')][_0xd6e6('0x71')]?{'message':'Wrong\x20credentials','statusCode':_0x27cbcf['statusCode']}:_0x27cbcf);});}; \ No newline at end of file +var _0x1ca3=['nolimit','sort','where','pick','filter','VIRTUAL','merge','options','count','includeAll','include','findAll','catch','show','params','rawAttributes','intersection','create','body','find','getConfigurations','VtigerConfiguration','order','addConfiguration','findOne','AccountId','getSubjects','channel','Descriptions','VtigerField','Subjects','getFields','username','description','moduleName','remoteUri','accessKey','slice','substring','lastIndexOf','format','GET','getchallenge','login','result','token','describe','success','autogenerated','remove','false','label','cf_','picklist','picklistValues','vTiger\x20error:\x20','test','getFields,\x20%s,\x20%s,\x20%s','stringify','statusCode','eml-format','rimraf','zip-dir','fast-json-patch','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','limit','set','Content-Range','apply','save','update','then','destroy','error','stack','name','send','index','map','VtigerAccount','fieldName','type','key','model','query','keys','filters','attributes','fields','length','hasOwnProperty'];(function(_0xa67fe7,_0x5c1204){var _0x203834=function(_0x2d6865){while(--_0x2d6865){_0xa67fe7['push'](_0xa67fe7['shift']());}};_0x203834(++_0x5c1204);}(_0x1ca3,0xb0));var _0x31ca=function(_0x5e0574,_0xf5e161){_0x5e0574=_0x5e0574-0x0;var _0x1fdd1b=_0x1ca3[_0x5e0574];return _0x1fdd1b;};'use strict';var emlformat=require(_0x31ca('0x0'));var rimraf=require(_0x31ca('0x1'));var zipdir=require(_0x31ca('0x2'));var jsonpatch=require(_0x31ca('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x31ca('0x4'));var util=require('util');var path=require('path');var sox=require(_0x31ca('0x5'));var csv=require(_0x31ca('0x6'));var ejs=require(_0x31ca('0x7'));var fs=require('fs');var fs_extra=require(_0x31ca('0x8'));var _=require(_0x31ca('0x9'));var squel=require(_0x31ca('0xa'));var crypto=require(_0x31ca('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x31ca('0xc'));var toCsv=require(_0x31ca('0x6'));var querystring=require(_0x31ca('0xd'));var Papa=require('papaparse');var Redis=require(_0x31ca('0xe'));var authService=require(_0x31ca('0xf'));var qs=require(_0x31ca('0x10'));var as=require(_0x31ca('0x11'));var hardwareService=require(_0x31ca('0x12'));var logger=require('../../config/logger')(_0x31ca('0x13'));var utils=require(_0x31ca('0x14'));var config=require(_0x31ca('0x15'));var licenseUtil=require(_0x31ca('0x16'));var db=require('../../mysqldb')['db'];var integrations=require(_0x31ca('0x17'));function respondWithStatusCode(_0x5c3403,_0x37a5a5){_0x37a5a5=_0x37a5a5||0xcc;return function(_0x445ef6){if(_0x445ef6){return _0x5c3403[_0x31ca('0x18')](_0x37a5a5);}return _0x5c3403[_0x31ca('0x19')](_0x37a5a5)[_0x31ca('0x1a')]();};}function respondWithResult(_0x527fc9,_0x594320){_0x594320=_0x594320||0xc8;return function(_0x41f285){if(_0x41f285){return _0x527fc9[_0x31ca('0x19')](_0x594320)[_0x31ca('0x1b')](_0x41f285);}};}function respondWithFilteredResult(_0x39a5ef,_0x4c84e3){return function(_0x48fa6f){if(_0x48fa6f){var _0x472f0c=typeof _0x4c84e3[_0x31ca('0x1c')]===_0x31ca('0x1d')&&typeof _0x4c84e3[_0x31ca('0x1e')]===_0x31ca('0x1d');var _0x2d5510=_0x48fa6f['count'];var _0x546c44=_0x472f0c?0x0:_0x4c84e3[_0x31ca('0x1c')];var _0x54696c=_0x472f0c?_0x48fa6f['count']:_0x4c84e3['offset']+_0x4c84e3[_0x31ca('0x1e')];var _0x35c75d;if(_0x54696c>=_0x2d5510){_0x54696c=_0x2d5510;_0x35c75d=0xc8;}else{_0x35c75d=0xce;}_0x39a5ef[_0x31ca('0x19')](_0x35c75d);return _0x39a5ef[_0x31ca('0x1f')](_0x31ca('0x20'),_0x546c44+'-'+_0x54696c+'/'+_0x2d5510)[_0x31ca('0x1b')](_0x48fa6f);}return null;};}function patchUpdates(_0x53fe66){return function(_0x28253c){try{jsonpatch[_0x31ca('0x21')](_0x28253c,_0x53fe66,!![]);}catch(_0x5593b7){return BPromise['reject'](_0x5593b7);}return _0x28253c[_0x31ca('0x22')]();};}function saveUpdates(_0x419309,_0x5a331c){return function(_0x15bb1d){if(_0x15bb1d){return _0x15bb1d[_0x31ca('0x23')](_0x419309)[_0x31ca('0x24')](function(_0x6ac07d){return _0x6ac07d;});}return null;};}function removeEntity(_0x1c9a9e,_0x55f439){return function(_0x3ff827){if(_0x3ff827){return _0x3ff827[_0x31ca('0x25')]()[_0x31ca('0x24')](function(){_0x1c9a9e['status'](0xcc)[_0x31ca('0x1a')]();});}};}function handleEntityNotFound(_0x17f2e9,_0x43b848){return function(_0x577e46){if(!_0x577e46){_0x17f2e9[_0x31ca('0x18')](0x194);}return _0x577e46;};}function handleError(_0x533da4,_0x455867){_0x455867=_0x455867||0x1f4;return function(_0x270f06){logger[_0x31ca('0x26')](_0x270f06[_0x31ca('0x27')]);if(_0x270f06[_0x31ca('0x28')]){delete _0x270f06[_0x31ca('0x28')];}_0x533da4[_0x31ca('0x19')](_0x455867)[_0x31ca('0x29')](_0x270f06);};}exports[_0x31ca('0x2a')]=function(_0x24c008,_0x400f6f){var _0x3c0f67={},_0x22d389={},_0x5dd6d7={'count':0x0,'rows':[]};var _0x2e6a68=_[_0x31ca('0x2b')](db[_0x31ca('0x2c')]['rawAttributes'],function(_0x28a311){return{'name':_0x28a311[_0x31ca('0x2d')],'type':_0x28a311[_0x31ca('0x2e')][_0x31ca('0x2f')]};});_0x22d389[_0x31ca('0x30')]=_[_0x31ca('0x2b')](_0x2e6a68,_0x31ca('0x28'));_0x22d389[_0x31ca('0x31')]=_[_0x31ca('0x32')](_0x24c008['query']);_0x22d389[_0x31ca('0x33')]=_['intersection'](_0x22d389['model'],_0x22d389[_0x31ca('0x31')]);_0x3c0f67[_0x31ca('0x34')]=_['intersection'](_0x22d389['model'],qs[_0x31ca('0x35')](_0x24c008[_0x31ca('0x31')][_0x31ca('0x35')]));_0x3c0f67[_0x31ca('0x34')]=_0x3c0f67[_0x31ca('0x34')][_0x31ca('0x36')]?_0x3c0f67[_0x31ca('0x34')]:_0x22d389[_0x31ca('0x30')];if(!_0x24c008[_0x31ca('0x31')][_0x31ca('0x37')](_0x31ca('0x38'))){_0x3c0f67['limit']=qs['limit'](_0x24c008['query'][_0x31ca('0x1e')]);_0x3c0f67[_0x31ca('0x1c')]=qs[_0x31ca('0x1c')](_0x24c008[_0x31ca('0x31')][_0x31ca('0x1c')]);}_0x3c0f67['order']=qs[_0x31ca('0x39')](_0x24c008['query'][_0x31ca('0x39')]);_0x3c0f67[_0x31ca('0x3a')]=qs[_0x31ca('0x33')](_[_0x31ca('0x3b')](_0x24c008[_0x31ca('0x31')],_0x22d389[_0x31ca('0x33')]),_0x2e6a68);if(_0x24c008[_0x31ca('0x31')][_0x31ca('0x3c')]){_0x3c0f67[_0x31ca('0x3a')]=_['merge'](_0x3c0f67[_0x31ca('0x3a')],{'$or':_['map'](_0x2e6a68,function(_0x5da123){if(_0x5da123[_0x31ca('0x2e')]!==_0x31ca('0x3d')){var _0x4a184b={};_0x4a184b[_0x5da123['name']]={'$like':'%'+_0x24c008[_0x31ca('0x31')][_0x31ca('0x3c')]+'%'};return _0x4a184b;}})});}_0x3c0f67=_[_0x31ca('0x3e')]({},_0x3c0f67,_0x24c008[_0x31ca('0x3f')]);var _0x500bba={'where':_0x3c0f67[_0x31ca('0x3a')]};return db[_0x31ca('0x2c')][_0x31ca('0x40')](_0x500bba)[_0x31ca('0x24')](function(_0x2027ab){_0x5dd6d7[_0x31ca('0x40')]=_0x2027ab;if(_0x24c008[_0x31ca('0x31')][_0x31ca('0x41')]){_0x3c0f67[_0x31ca('0x42')]=[{'all':!![]}];}return db[_0x31ca('0x2c')][_0x31ca('0x43')](_0x3c0f67);})[_0x31ca('0x24')](function(_0x4a7bd8){_0x5dd6d7['rows']=_0x4a7bd8;return _0x5dd6d7;})['then'](respondWithFilteredResult(_0x400f6f,_0x3c0f67))[_0x31ca('0x44')](handleError(_0x400f6f,null));};exports[_0x31ca('0x45')]=function(_0x336dfe,_0x4b94a8){var _0x5838c0={'raw':![],'where':{'id':_0x336dfe[_0x31ca('0x46')]['id']}},_0x23bda4={};_0x23bda4[_0x31ca('0x30')]=_[_0x31ca('0x32')](db[_0x31ca('0x2c')][_0x31ca('0x47')]);_0x23bda4['query']=_[_0x31ca('0x32')](_0x336dfe['query']);_0x23bda4[_0x31ca('0x33')]=_[_0x31ca('0x48')](_0x23bda4[_0x31ca('0x30')],_0x23bda4[_0x31ca('0x31')]);_0x5838c0[_0x31ca('0x34')]=_[_0x31ca('0x48')](_0x23bda4[_0x31ca('0x30')],qs['fields'](_0x336dfe[_0x31ca('0x31')]['fields']));_0x5838c0[_0x31ca('0x34')]=_0x5838c0[_0x31ca('0x34')][_0x31ca('0x36')]?_0x5838c0[_0x31ca('0x34')]:_0x23bda4['model'];if(_0x336dfe[_0x31ca('0x31')][_0x31ca('0x41')]){_0x5838c0['include']=[{'all':!![]}];}_0x5838c0=_[_0x31ca('0x3e')]({},_0x5838c0,_0x336dfe[_0x31ca('0x3f')]);return db[_0x31ca('0x2c')]['find'](_0x5838c0)[_0x31ca('0x24')](handleEntityNotFound(_0x4b94a8,null))['then'](respondWithResult(_0x4b94a8,null))[_0x31ca('0x44')](handleError(_0x4b94a8,null));};exports[_0x31ca('0x49')]=function(_0x19a910,_0x180116){return db[_0x31ca('0x2c')][_0x31ca('0x49')](_0x19a910[_0x31ca('0x4a')],{})[_0x31ca('0x24')](respondWithResult(_0x180116,0xc9))['catch'](handleError(_0x180116,null));};exports['update']=function(_0x454a6e,_0x23e42b){if(_0x454a6e[_0x31ca('0x4a')]['id']){delete _0x454a6e[_0x31ca('0x4a')]['id'];}return db[_0x31ca('0x2c')][_0x31ca('0x4b')]({'where':{'id':_0x454a6e[_0x31ca('0x46')]['id']}})['then'](handleEntityNotFound(_0x23e42b,null))[_0x31ca('0x24')](saveUpdates(_0x454a6e[_0x31ca('0x4a')],null))[_0x31ca('0x24')](respondWithResult(_0x23e42b,null))[_0x31ca('0x44')](handleError(_0x23e42b,null));};exports[_0x31ca('0x25')]=function(_0x5b79a5,_0x479f36){return db['VtigerAccount']['find']({'where':{'id':_0x5b79a5[_0x31ca('0x46')]['id']}})['then'](handleEntityNotFound(_0x479f36,null))[_0x31ca('0x24')](removeEntity(_0x479f36,null))[_0x31ca('0x44')](handleError(_0x479f36,null));};exports[_0x31ca('0x4c')]=function(_0x39e72a,_0x374cf7,_0x3c754c){var _0x57f136={};var _0x1632c5={};var _0xff1f72;var _0x19d8c5;return db[_0x31ca('0x2c')]['findOne']({'where':{'id':_0x39e72a[_0x31ca('0x46')]['id']}})[_0x31ca('0x24')](handleEntityNotFound(_0x374cf7,null))[_0x31ca('0x24')](function(_0x512ab7){if(_0x512ab7){_0xff1f72=_0x512ab7;_0x1632c5['model']=_['keys'](db[_0x31ca('0x4d')][_0x31ca('0x47')]);_0x1632c5['query']=_[_0x31ca('0x32')](_0x39e72a['query']);_0x1632c5[_0x31ca('0x33')]=_[_0x31ca('0x48')](_0x1632c5[_0x31ca('0x30')],_0x1632c5[_0x31ca('0x31')]);_0x57f136[_0x31ca('0x34')]=_['intersection'](_0x1632c5[_0x31ca('0x30')],qs['fields'](_0x39e72a[_0x31ca('0x31')][_0x31ca('0x35')]));_0x57f136[_0x31ca('0x34')]=_0x57f136[_0x31ca('0x34')][_0x31ca('0x36')]?_0x57f136[_0x31ca('0x34')]:_0x1632c5['model'];_0x57f136[_0x31ca('0x4e')]=qs[_0x31ca('0x39')](_0x39e72a[_0x31ca('0x31')][_0x31ca('0x39')]);_0x57f136['where']=qs[_0x31ca('0x33')](_[_0x31ca('0x3b')](_0x39e72a[_0x31ca('0x31')],_0x1632c5[_0x31ca('0x33')]));if(_0x39e72a[_0x31ca('0x31')][_0x31ca('0x3c')]){_0x57f136[_0x31ca('0x3a')]=_['merge'](_0x57f136[_0x31ca('0x3a')],{'$or':_[_0x31ca('0x2b')](_0x57f136[_0x31ca('0x34')],function(_0x394eab){var _0x118a2d={};_0x118a2d[_0x394eab]={'$like':'%'+_0x39e72a['query'][_0x31ca('0x3c')]+'%'};return _0x118a2d;})});}_0x57f136=_[_0x31ca('0x3e')]({},_0x57f136,_0x39e72a[_0x31ca('0x3f')]);return _0xff1f72[_0x31ca('0x4c')](_0x57f136);}})[_0x31ca('0x24')](function(_0x31f31e){if(_0x31f31e){_0x19d8c5=_0x31f31e[_0x31ca('0x36')];if(!_0x39e72a[_0x31ca('0x31')][_0x31ca('0x37')]('nolimit')){_0x57f136[_0x31ca('0x1e')]=qs[_0x31ca('0x1e')](_0x39e72a['query'][_0x31ca('0x1e')]);_0x57f136[_0x31ca('0x1c')]=qs[_0x31ca('0x1c')](_0x39e72a[_0x31ca('0x31')]['offset']);}return _0xff1f72[_0x31ca('0x4c')](_0x57f136);}})[_0x31ca('0x24')](function(_0x4024b2){if(_0x4024b2){return _0x4024b2?{'count':_0x19d8c5,'rows':_0x4024b2}:null;}})[_0x31ca('0x24')](respondWithResult(_0x374cf7,null))[_0x31ca('0x44')](handleError(_0x374cf7,null));};exports[_0x31ca('0x4f')]=function(_0x10aa5,_0x503460,_0x337a56){if(_0x10aa5[_0x31ca('0x4a')]['id']){delete _0x10aa5[_0x31ca('0x4a')]['id'];}return db['VtigerAccount'][_0x31ca('0x50')]({'where':{'id':_0x10aa5[_0x31ca('0x46')]['id']}})[_0x31ca('0x24')](handleEntityNotFound(_0x503460,null))['then'](function(_0x5a168a){if(_0x5a168a){_0x10aa5[_0x31ca('0x4a')][_0x31ca('0x51')]=_0x5a168a['id'];_0x10aa5[_0x31ca('0x4a')]['Subjects']=integrations[_0x31ca('0x52')](_0x10aa5[_0x31ca('0x4a')][_0x31ca('0x53')],_0x10aa5['body'][_0x31ca('0x2e')]);_0x10aa5[_0x31ca('0x4a')][_0x31ca('0x54')]=integrations['getDescriptions'](_0x10aa5[_0x31ca('0x4a')][_0x31ca('0x53')],_0x10aa5[_0x31ca('0x4a')][_0x31ca('0x2e')]);return db[_0x31ca('0x4d')][_0x31ca('0x49')](_0x10aa5[_0x31ca('0x4a')],{'include':[{'model':db[_0x31ca('0x55')],'as':_0x31ca('0x56')},{'model':db[_0x31ca('0x55')],'as':_0x31ca('0x54')}]});}return null;})[_0x31ca('0x24')](respondWithResult(_0x503460,null))[_0x31ca('0x44')](handleError(_0x503460,null));};var md5=require('md5');exports[_0x31ca('0x57')]=function(_0x123619,_0x421f3e,_0x587908){var _0x1b0cb2=null;var _0x106a1e=null;var _0x2ed59b=null;var _0x11f8fc=null;var _0x292e44='';return db[_0x31ca('0x2c')][_0x31ca('0x50')]({'where':{'id':_0x123619[_0x31ca('0x46')]['id']},'attributes':['id',_0x31ca('0x28'),_0x31ca('0x58'),_0x31ca('0x59'),_0x31ca('0x5a'),_0x31ca('0x5b'),'serverUrl',_0x31ca('0x5c')]})['then'](handleEntityNotFound(_0x421f3e,null))[_0x31ca('0x24')](function(_0x4a26ce){if(_0x4a26ce){_0x1b0cb2=_0x4a26ce[_0x31ca('0x58')];_0x106a1e=_0x4a26ce[_0x31ca('0x5c')];_0x2ed59b=_0x4a26ce[_0x31ca('0x5a')];_0x292e44=_0x4a26ce['remoteUri'];var _0x28c7db=_0x292e44[_0x31ca('0x5d')](-0x1);if(_0x28c7db==='/'){_0x292e44=_0x292e44[_0x31ca('0x5e')](0x0,_0x292e44[_0x31ca('0x5f')](_0x28c7db));}_0x11f8fc=util[_0x31ca('0x60')]('%s/webservice.php',_0x292e44);var _0x3abbea={'method':_0x31ca('0x61'),'uri':_0x11f8fc,'qs':{'operation':_0x31ca('0x62'),'username':_0x4a26ce[_0x31ca('0x58')]},'json':!![]};return rp(_0x3abbea);}})['then'](function(_0x17ad3a){if(_0x17ad3a['success']){var _0x158965={'method':'POST','uri':_0x11f8fc,'form':{'operation':_0x31ca('0x63'),'username':_0x1b0cb2,'accessKey':md5(_0x17ad3a[_0x31ca('0x64')][_0x31ca('0x65')]+_0x106a1e)},'json':!![]};return rp(_0x158965);}})['then'](function(_0x5cfdaf){if(_0x5cfdaf['success']){var _0x17b051={'method':'GET','uri':_0x11f8fc,'qs':{'operation':_0x31ca('0x66'),'username':_0x1b0cb2,'sessionName':_0x5cfdaf[_0x31ca('0x64')]['sessionName'],'elementType':_0x2ed59b},'json':!![]};return rp(_0x17b051);}})[_0x31ca('0x24')](function(_0x12626c){if(_0x12626c[_0x31ca('0x67')]){var _0x23826f=[_0x31ca('0x68'),'reference','owner'];_[_0x31ca('0x69')](_0x12626c['result'][_0x31ca('0x35')],function(_0x3358e4){return _0x23826f['includes'](_0x3358e4[_0x31ca('0x2e')]['name']);});_[_0x31ca('0x69')](_0x12626c[_0x31ca('0x64')][_0x31ca('0x35')],function(_0x5d0ff9){return _0x5d0ff9['editable']===_0x31ca('0x6a');});return{'count':_0x12626c[_0x31ca('0x64')][_0x31ca('0x35')]['length'],'rows':_['map'](_0x12626c[_0x31ca('0x64')][_0x31ca('0x35')],function(_0x44db52){return{'id':_0x44db52['name'],'name':_0x44db52[_0x31ca('0x6b')],'custom':_['startsWith'](_0x44db52[_0x31ca('0x28')],_0x31ca('0x6c'))?!![]:![],'options':_0x44db52[_0x31ca('0x2e')][_0x31ca('0x28')]===_0x31ca('0x6d')&&_0x44db52['type'][_0x31ca('0x6e')][_0x31ca('0x36')]>0x0?_[_0x31ca('0x2b')](_0x44db52[_0x31ca('0x2e')][_0x31ca('0x6e')],function(_0x16b02d){return{'name':_0x16b02d[_0x31ca('0x6b')],'value':_0x16b02d['value']};}):[]};})};}})[_0x31ca('0x24')](respondWithResult(_0x421f3e,null))[_0x31ca('0x44')](function(_0x19022e){console['log'](_0x31ca('0x6f')+_0x19022e);var _0x7c60c2=_0x123619[_0x31ca('0x31')][_0x31ca('0x70')]?0x1f4:_0x19022e['statusCode']||0x1f4;logger[_0x31ca('0x26')](_0x31ca('0x71'),_0x31ca('0x57'),_0x7c60c2,JSON[_0x31ca('0x72')](_0x19022e));delete _0x19022e[_0x31ca('0x28')];if(_0x7c60c2===0x191){_0x7c60c2=0x190;}_0x421f3e['status'](_0x7c60c2)[_0x31ca('0x29')](_0x123619['query'][_0x31ca('0x70')]?{'message':'Wrong\x20credentials','statusCode':_0x19022e[_0x31ca('0x73')]}:_0x19022e);});}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.model.js b/server/api/intVtigerAccount/intVtigerAccount.model.js index 2d40e1b..bd26988 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 _0xe904=['rimraf','../../config/environment','./intVtigerAccount.attributes','../../components/integrations/configuration','int_vtiger_accounts','lodash','../../config/logger','api','moment','request-promise'];(function(_0x31adba,_0x101923){var _0x408ad0=function(_0x5c6759){while(--_0x5c6759){_0x31adba['push'](_0x31adba['shift']());}};_0x408ad0(++_0x101923);}(_0xe904,0x73));var _0x4e90=function(_0x52cbaa,_0x4dd3d3){_0x52cbaa=_0x52cbaa-0x0;var _0x38698e=_0xe904[_0x52cbaa];return _0x38698e;};'use strict';var _=require(_0x4e90('0x0'));var util=require('util');var logger=require(_0x4e90('0x1'))(_0x4e90('0x2'));var moment=require(_0x4e90('0x3'));var BPromise=require('bluebird');var rp=require(_0x4e90('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4e90('0x5'));var config=require(_0x4e90('0x6'));var attributes=require(_0x4e90('0x7'));var integrations=require(_0x4e90('0x8'));module['exports']=function(_0x1a0eb2,_0x30ad92){return _0x1a0eb2['define']('VtigerAccount',attributes,{'tableName':_0x4e90('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2995=['api','bluebird','request-promise','path','rimraf','../../config/environment','../../components/integrations/configuration','exports','define','int_vtiger_accounts','lodash','../../config/logger'];(function(_0x14ffe3,_0x119d82){var _0x36a690=function(_0x50b518){while(--_0x50b518){_0x14ffe3['push'](_0x14ffe3['shift']());}};_0x36a690(++_0x119d82);}(_0x2995,0x1ea));var _0x5299=function(_0x2c7661,_0x41a8b1){_0x2c7661=_0x2c7661-0x0;var _0x4a87c9=_0x2995[_0x2c7661];return _0x4a87c9;};'use strict';var _=require(_0x5299('0x0'));var util=require('util');var logger=require(_0x5299('0x1'))(_0x5299('0x2'));var moment=require('moment');var BPromise=require(_0x5299('0x3'));var rp=require(_0x5299('0x4'));var fs=require('fs');var path=require(_0x5299('0x5'));var rimraf=require(_0x5299('0x6'));var config=require(_0x5299('0x7'));var attributes=require('./intVtigerAccount.attributes');var integrations=require(_0x5299('0x8'));module[_0x5299('0x9')]=function(_0x4c9820,_0x58febc){return _0x4c9820[_0x5299('0xa')]('VtigerAccount',attributes,{'tableName':_0x5299('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.rpc.js b/server/api/intVtigerAccount/intVtigerAccount.rpc.js index 81b94f8..1698c83 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 _0xd914=['raw','where','attributes','limit','include','map','model','then','ShowVtigerAccount','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request','info','VtigerAccount,\x20%s,\x20%s','request\x20sent','debug','VtigerAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','GetVtigerAccount','VtigerAccount','options'];(function(_0x49f67f,_0x4113a4){var _0x4779a1=function(_0x5064b0){while(--_0x5064b0){_0x49f67f['push'](_0x49f67f['shift']());}};_0x4779a1(++_0x4113a4);}(_0xd914,0x17f));var _0x4d91=function(_0x3f88bc,_0xe38cf5){_0x3f88bc=_0x3f88bc-0x0;var _0x4df1c4=_0xd914[_0x3f88bc];return _0x4df1c4;};'use strict';var _=require(_0x4d91('0x0'));var util=require(_0x4d91('0x1'));var moment=require('moment');var BPromise=require(_0x4d91('0x2'));var rs=require(_0x4d91('0x3'));var fs=require('fs');var Redis=require(_0x4d91('0x4'));var db=require(_0x4d91('0x5'))['db'];var utils=require(_0x4d91('0x6'));var logger=require(_0x4d91('0x7'))('rpc');var config=require(_0x4d91('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x4d91('0x9')][_0x4d91('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x175ce3,_0x27c0d5,_0x22f2a4){return new BPromise(function(_0x150767,_0x3016c0){return client[_0x4d91('0xb')](_0x175ce3,_0x22f2a4)['then'](function(_0x37bde4){logger[_0x4d91('0xc')](_0x4d91('0xd'),_0x27c0d5,_0x4d91('0xe'));logger[_0x4d91('0xf')](_0x4d91('0x10'),_0x27c0d5,'request\x20sent',JSON['stringify'](_0x37bde4));if(_0x37bde4[_0x4d91('0x11')]){if(_0x37bde4[_0x4d91('0x11')][_0x4d91('0x12')]===0x1f4){logger[_0x4d91('0x11')](_0x4d91('0xd'),_0x27c0d5,_0x37bde4[_0x4d91('0x11')]['message']);return _0x3016c0(_0x37bde4['error'][_0x4d91('0x13')]);}logger[_0x4d91('0x11')](_0x4d91('0xd'),_0x27c0d5,_0x37bde4[_0x4d91('0x11')][_0x4d91('0x13')]);return _0x150767(_0x37bde4[_0x4d91('0x11')][_0x4d91('0x13')]);}else{logger['info'](_0x4d91('0xd'),_0x27c0d5,_0x4d91('0xe'));_0x150767(_0x37bde4[_0x4d91('0x14')][_0x4d91('0x13')]);}})[_0x4d91('0x15')](function(_0x554ca8){logger[_0x4d91('0x11')](_0x4d91('0xd'),_0x27c0d5,_0x554ca8);_0x3016c0(_0x554ca8);});});}exports[_0x4d91('0x16')]=function(_0x44b9a7){var _0x4cfa40=this;return new Promise(function(_0x350e23,_0x3b579b){return db[_0x4d91('0x17')]['findAll']({'raw':_0x44b9a7[_0x4d91('0x18')]?_0x44b9a7[_0x4d91('0x18')][_0x4d91('0x19')]===undefined?!![]:![]:!![],'where':_0x44b9a7[_0x4d91('0x18')]?_0x44b9a7[_0x4d91('0x18')][_0x4d91('0x1a')]||null:null,'attributes':_0x44b9a7[_0x4d91('0x18')]?_0x44b9a7[_0x4d91('0x18')][_0x4d91('0x1b')]||null:null,'limit':_0x44b9a7[_0x4d91('0x18')]?_0x44b9a7['options'][_0x4d91('0x1c')]||null:null,'include':_0x44b9a7['options']?_0x44b9a7['options'][_0x4d91('0x1d')]?_[_0x4d91('0x1e')](_0x44b9a7[_0x4d91('0x18')][_0x4d91('0x1d')],function(_0x7d8cbf){return{'model':db[_0x7d8cbf[_0x4d91('0x1f')]],'as':_0x7d8cbf['as'],'attributes':_0x7d8cbf[_0x4d91('0x1b')],'include':_0x7d8cbf[_0x4d91('0x1d')]?_['map'](_0x7d8cbf['include'],function(_0x1ee6b3){return{'model':db[_0x1ee6b3[_0x4d91('0x1f')]],'as':_0x1ee6b3['as'],'attributes':_0x1ee6b3[_0x4d91('0x1b')],'include':_0x1ee6b3[_0x4d91('0x1d')]?_[_0x4d91('0x1e')](_0x1ee6b3[_0x4d91('0x1d')],function(_0x14bdb4){return{'model':db[_0x14bdb4['model']],'as':_0x14bdb4['as'],'attributes':_0x14bdb4[_0x4d91('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x4d91('0x20')](function(_0x12ac74){logger['info']('GetVtigerAccount',_0x44b9a7);logger[_0x4d91('0xf')](_0x4d91('0x16'),_0x44b9a7,JSON['stringify'](_0x12ac74));_0x350e23(_0x12ac74);})['catch'](function(_0x42d5a0){logger[_0x4d91('0x11')](_0x4d91('0x16'),_0x42d5a0[_0x4d91('0x13')],_0x44b9a7);_0x3b579b(_0x4cfa40['error'](0x1f4,_0x42d5a0[_0x4d91('0x13')]));});});};exports[_0x4d91('0x21')]=function(_0x468e95){var _0xee7535=this;return new Promise(function(_0xa63422,_0x3466f3){return db[_0x4d91('0x17')]['find']({'raw':_0x468e95[_0x4d91('0x18')]?_0x468e95['options']['raw']===undefined?!![]:![]:!![],'where':_0x468e95[_0x4d91('0x18')]?_0x468e95[_0x4d91('0x18')]['where']||null:null,'attributes':_0x468e95[_0x4d91('0x18')]?_0x468e95[_0x4d91('0x18')][_0x4d91('0x1b')]||null:null,'include':_0x468e95[_0x4d91('0x18')]?_0x468e95[_0x4d91('0x18')]['include']?_[_0x4d91('0x1e')](_0x468e95[_0x4d91('0x18')][_0x4d91('0x1d')],function(_0x2b8131){return{'model':db[_0x2b8131[_0x4d91('0x1f')]],'as':_0x2b8131['as'],'attributes':_0x2b8131[_0x4d91('0x1b')],'include':_0x2b8131['include']?_[_0x4d91('0x1e')](_0x2b8131[_0x4d91('0x1d')],function(_0x5c2247){return{'model':db[_0x5c2247[_0x4d91('0x1f')]],'as':_0x5c2247['as'],'attributes':_0x5c2247[_0x4d91('0x1b')],'include':_0x5c2247[_0x4d91('0x1d')]?_['map'](_0x5c2247[_0x4d91('0x1d')],function(_0x2c8b54){return{'model':db[_0x2c8b54[_0x4d91('0x1f')]],'as':_0x2c8b54['as'],'attributes':_0x2c8b54[_0x4d91('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x64cee3){logger[_0x4d91('0xc')](_0x4d91('0x21'),_0x468e95);logger[_0x4d91('0xf')]('ShowVtigerAccount',_0x468e95,JSON['stringify'](_0x64cee3));_0xa63422(_0x64cee3);})[_0x4d91('0x15')](function(_0x3dac76){logger['error'](_0x4d91('0x21'),_0x3dac76[_0x4d91('0x13')],_0x468e95);_0x3466f3(_0xee7535[_0x4d91('0x11')](0x1f4,_0x3dac76[_0x4d91('0x13')]));});});}; \ No newline at end of file +var _0xf4eb=['VtigerAccount','findAll','options','where','attributes','limit','map','model','include','find','raw','ShowVtigerAccount','lodash','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','VtigerAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','GetVtigerAccount'];(function(_0x56ed3c,_0x469243){var _0x45914e=function(_0x383350){while(--_0x383350){_0x56ed3c['push'](_0x56ed3c['shift']());}};_0x45914e(++_0x469243);}(_0xf4eb,0xec));var _0xbf4e=function(_0xc92c7e,_0x3d26c3){_0xc92c7e=_0xc92c7e-0x0;var _0x19655b=_0xf4eb[_0xc92c7e];return _0x19655b;};'use strict';var _=require(_0xbf4e('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbf4e('0x1'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xbf4e('0x2'))(_0xbf4e('0x3'));var config=require(_0xbf4e('0x4'));var jayson=require(_0xbf4e('0x5'));var client=jayson[_0xbf4e('0x6')][_0xbf4e('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x15b99f,_0x540736,_0x449d55){return new BPromise(function(_0x5013c2,_0x5e23d4){return client[_0xbf4e('0x8')](_0x15b99f,_0x449d55)[_0xbf4e('0x9')](function(_0xcc4097){logger[_0xbf4e('0xa')](_0xbf4e('0xb'),_0x540736,_0xbf4e('0xc'));logger[_0xbf4e('0xd')]('VtigerAccount,\x20%s,\x20%s,\x20%s',_0x540736,'request\x20sent',JSON[_0xbf4e('0xe')](_0xcc4097));if(_0xcc4097['error']){if(_0xcc4097[_0xbf4e('0xf')][_0xbf4e('0x10')]===0x1f4){logger['error'](_0xbf4e('0xb'),_0x540736,_0xcc4097['error']['message']);return _0x5e23d4(_0xcc4097[_0xbf4e('0xf')][_0xbf4e('0x11')]);}logger[_0xbf4e('0xf')](_0xbf4e('0xb'),_0x540736,_0xcc4097[_0xbf4e('0xf')][_0xbf4e('0x11')]);return _0x5013c2(_0xcc4097['error']['message']);}else{logger[_0xbf4e('0xa')](_0xbf4e('0xb'),_0x540736,_0xbf4e('0xc'));_0x5013c2(_0xcc4097['result'][_0xbf4e('0x11')]);}})[_0xbf4e('0x12')](function(_0x912fc0){logger[_0xbf4e('0xf')]('VtigerAccount,\x20%s,\x20%s',_0x540736,_0x912fc0);_0x5e23d4(_0x912fc0);});});}exports[_0xbf4e('0x13')]=function(_0x577c27){var _0x5db03f=this;return new Promise(function(_0x566ec3,_0x4f8762){return db[_0xbf4e('0x14')][_0xbf4e('0x15')]({'raw':_0x577c27[_0xbf4e('0x16')]?_0x577c27['options']['raw']===undefined?!![]:![]:!![],'where':_0x577c27[_0xbf4e('0x16')]?_0x577c27[_0xbf4e('0x16')][_0xbf4e('0x17')]||null:null,'attributes':_0x577c27[_0xbf4e('0x16')]?_0x577c27[_0xbf4e('0x16')][_0xbf4e('0x18')]||null:null,'limit':_0x577c27[_0xbf4e('0x16')]?_0x577c27[_0xbf4e('0x16')][_0xbf4e('0x19')]||null:null,'include':_0x577c27[_0xbf4e('0x16')]?_0x577c27[_0xbf4e('0x16')]['include']?_[_0xbf4e('0x1a')](_0x577c27[_0xbf4e('0x16')]['include'],function(_0x31e3f5){return{'model':db[_0x31e3f5[_0xbf4e('0x1b')]],'as':_0x31e3f5['as'],'attributes':_0x31e3f5[_0xbf4e('0x18')],'include':_0x31e3f5[_0xbf4e('0x1c')]?_[_0xbf4e('0x1a')](_0x31e3f5['include'],function(_0x90635e){return{'model':db[_0x90635e[_0xbf4e('0x1b')]],'as':_0x90635e['as'],'attributes':_0x90635e[_0xbf4e('0x18')],'include':_0x90635e['include']?_[_0xbf4e('0x1a')](_0x90635e['include'],function(_0x5bcf71){return{'model':db[_0x5bcf71[_0xbf4e('0x1b')]],'as':_0x5bcf71['as'],'attributes':_0x5bcf71['attributes']};}):[]};}):[]};}):[]:[]})[_0xbf4e('0x9')](function(_0x315df3){logger[_0xbf4e('0xa')](_0xbf4e('0x13'),_0x577c27);logger['debug'](_0xbf4e('0x13'),_0x577c27,JSON[_0xbf4e('0xe')](_0x315df3));_0x566ec3(_0x315df3);})[_0xbf4e('0x12')](function(_0x4cd4a1){logger[_0xbf4e('0xf')]('GetVtigerAccount',_0x4cd4a1[_0xbf4e('0x11')],_0x577c27);_0x4f8762(_0x5db03f[_0xbf4e('0xf')](0x1f4,_0x4cd4a1[_0xbf4e('0x11')]));});});};exports['ShowVtigerAccount']=function(_0x1d12e2){var _0x362716=this;return new Promise(function(_0x2f3cf8,_0xc7ca87){return db[_0xbf4e('0x14')][_0xbf4e('0x1d')]({'raw':_0x1d12e2['options']?_0x1d12e2[_0xbf4e('0x16')][_0xbf4e('0x1e')]===undefined?!![]:![]:!![],'where':_0x1d12e2['options']?_0x1d12e2[_0xbf4e('0x16')][_0xbf4e('0x17')]||null:null,'attributes':_0x1d12e2['options']?_0x1d12e2[_0xbf4e('0x16')]['attributes']||null:null,'include':_0x1d12e2[_0xbf4e('0x16')]?_0x1d12e2['options'][_0xbf4e('0x1c')]?_[_0xbf4e('0x1a')](_0x1d12e2[_0xbf4e('0x16')]['include'],function(_0x2716b7){return{'model':db[_0x2716b7[_0xbf4e('0x1b')]],'as':_0x2716b7['as'],'attributes':_0x2716b7[_0xbf4e('0x18')],'include':_0x2716b7[_0xbf4e('0x1c')]?_[_0xbf4e('0x1a')](_0x2716b7[_0xbf4e('0x1c')],function(_0x5b8440){return{'model':db[_0x5b8440[_0xbf4e('0x1b')]],'as':_0x5b8440['as'],'attributes':_0x5b8440[_0xbf4e('0x18')],'include':_0x5b8440[_0xbf4e('0x1c')]?_[_0xbf4e('0x1a')](_0x5b8440[_0xbf4e('0x1c')],function(_0x5b7ea1){return{'model':db[_0x5b7ea1['model']],'as':_0x5b7ea1['as'],'attributes':_0x5b7ea1['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x429c07){logger[_0xbf4e('0xa')](_0xbf4e('0x1f'),_0x1d12e2);logger[_0xbf4e('0xd')](_0xbf4e('0x1f'),_0x1d12e2,JSON[_0xbf4e('0xe')](_0x429c07));_0x2f3cf8(_0x429c07);})[_0xbf4e('0x12')](function(_0x467b74){logger[_0xbf4e('0xf')]('ShowVtigerAccount',_0x467b74['message'],_0x1d12e2);_0xc7ca87(_0x362716[_0xbf4e('0xf')](0x1f4,_0x467b74[_0xbf4e('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/index.js b/server/api/intVtigerConfiguration/index.js index 5868b26..989b114 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 _0xa615=['exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./intVtigerConfiguration.controller','get','isAuthenticated','/:id','show','/:id/fields','getSubjects','/:id/descriptions','post','put','delete','destroy'];(function(_0x87510b,_0x2bc31d){var _0x54d7ba=function(_0x799d05){while(--_0x799d05){_0x87510b['push'](_0x87510b['shift']());}};_0x54d7ba(++_0x2bc31d);}(_0xa615,0x161));var _0x5a61=function(_0x4a8ba5,_0x36af49){_0x4a8ba5=_0x4a8ba5-0x0;var _0x2840bd=_0xa615[_0x4a8ba5];return _0x2840bd;};'use strict';var multer=require(_0x5a61('0x0'));var util=require(_0x5a61('0x1'));var path=require(_0x5a61('0x2'));var timeout=require(_0x5a61('0x3'));var express=require(_0x5a61('0x4'));var router=express[_0x5a61('0x5')]();var fs_extra=require(_0x5a61('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x5a61('0x7'));var config=require(_0x5a61('0x8'));var controller=require(_0x5a61('0x9'));router[_0x5a61('0xa')]('/',auth[_0x5a61('0xb')](),controller['index']);router[_0x5a61('0xa')](_0x5a61('0xc'),auth[_0x5a61('0xb')](),controller[_0x5a61('0xd')]);router[_0x5a61('0xa')](_0x5a61('0xe'),auth[_0x5a61('0xb')](),controller['getFields']);router['get']('/:id/subjects',auth[_0x5a61('0xb')](),controller[_0x5a61('0xf')]);router['get'](_0x5a61('0x10'),auth[_0x5a61('0xb')](),controller['getDescriptions']);router[_0x5a61('0x11')]('/',auth[_0x5a61('0xb')](),controller['create']);router[_0x5a61('0x12')](_0x5a61('0xc'),auth[_0x5a61('0xb')](),controller['update']);router[_0x5a61('0x13')](_0x5a61('0xc'),auth[_0x5a61('0xb')](),controller[_0x5a61('0x14')]);module[_0x5a61('0x15')]=router; \ No newline at end of file +var _0x0cfa=['index','/:id','show','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','create','put','update','delete','destroy','exports','multer','express','Router','fs-extra','../../config/environment','./intVtigerConfiguration.controller','get','isAuthenticated'];(function(_0x3186aa,_0x34c21e){var _0x2d8c36=function(_0x239e99){while(--_0x239e99){_0x3186aa['push'](_0x3186aa['shift']());}};_0x2d8c36(++_0x34c21e);}(_0x0cfa,0x123));var _0xa0cf=function(_0x31cd7b,_0x10a8af){_0x31cd7b=_0x31cd7b-0x0;var _0x3f8579=_0x0cfa[_0x31cd7b];return _0x3f8579;};'use strict';var multer=require(_0xa0cf('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0xa0cf('0x1'));var router=express[_0xa0cf('0x2')]();var fs_extra=require(_0xa0cf('0x3'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xa0cf('0x4'));var controller=require(_0xa0cf('0x5'));router[_0xa0cf('0x6')]('/',auth[_0xa0cf('0x7')](),controller[_0xa0cf('0x8')]);router['get'](_0xa0cf('0x9'),auth[_0xa0cf('0x7')](),controller[_0xa0cf('0xa')]);router[_0xa0cf('0x6')]('/:id/fields',auth[_0xa0cf('0x7')](),controller[_0xa0cf('0xb')]);router[_0xa0cf('0x6')](_0xa0cf('0xc'),auth['isAuthenticated'](),controller[_0xa0cf('0xd')]);router[_0xa0cf('0x6')](_0xa0cf('0xe'),auth[_0xa0cf('0x7')](),controller[_0xa0cf('0xf')]);router[_0xa0cf('0x10')]('/',auth[_0xa0cf('0x7')](),controller[_0xa0cf('0x11')]);router[_0xa0cf('0x12')]('/:id',auth[_0xa0cf('0x7')](),controller[_0xa0cf('0x13')]);router[_0xa0cf('0x14')]('/:id',auth[_0xa0cf('0x7')](),controller[_0xa0cf('0x15')]);module[_0xa0cf('0x16')]=router; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js index 973cef8..990f66b 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 _0x5203=['exports'];(function(_0x403ca6,_0x24e284){var _0x4e0e05=function(_0x3a76ba){while(--_0x3a76ba){_0x403ca6['push'](_0x403ca6['shift']());}};_0x4e0e05(++_0x24e284);}(_0x5203,0x186));var _0x3520=function(_0x547ecb,_0x1d6889){_0x547ecb=_0x547ecb-0x0;var _0x148e80=_0x5203[_0x547ecb];return _0x148e80;};'use strict';var Sequelize=require('sequelize');module[_0x3520('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xd178=['sequelize','exports'];(function(_0x505585,_0x2d59e8){var _0x3409f4=function(_0x1053b5){while(--_0x1053b5){_0x505585['push'](_0x505585['shift']());}};_0x3409f4(++_0x2d59e8);}(_0xd178,0xd0));var _0x8d17=function(_0x433a86,_0x175b5c){_0x433a86=_0x433a86-0x0;var _0x23000c=_0xd178[_0x433a86];return _0x23000c;};'use strict';var Sequelize=require(_0x8d17('0x0'));module[_0x8d17('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js index c944893..b6df5ed 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 _0xdeb3=['getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','ejs','fs-extra','lodash','squel','crypto','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','../../mysqldb','status','end','json','undefined','limit','offset','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','index','rawAttributes','fieldName','type','map','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','options','VtigerConfiguration','count','includeAll','rows','catch','show','keys','include','find','create','body','params','getFields','findOne','VtigerField','pick','getSubjects'];(function(_0x22431e,_0x5af0a3){var _0xd978e9=function(_0x2bbdd7){while(--_0x2bbdd7){_0x22431e['push'](_0x22431e['shift']());}};_0xd978e9(++_0x5af0a3);}(_0xdeb3,0xeb));var _0x3deb=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0xdeb3[_0x3ab51d];return _0x29a04e;};'use strict';var emlformat=require(_0x3deb('0x0'));var rimraf=require(_0x3deb('0x1'));var zipdir=require(_0x3deb('0x2'));var jsonpatch=require(_0x3deb('0x3'));var rp=require(_0x3deb('0x4'));var moment=require(_0x3deb('0x5'));var BPromise=require(_0x3deb('0x6'));var Mustache=require(_0x3deb('0x7'));var util=require(_0x3deb('0x8'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x3deb('0x9'));var fs=require('fs');var fs_extra=require(_0x3deb('0xa'));var _=require(_0x3deb('0xb'));var squel=require(_0x3deb('0xc'));var crypto=require(_0x3deb('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x3deb('0xe'));var querystring=require(_0x3deb('0xf'));var Papa=require(_0x3deb('0x10'));var Redis=require(_0x3deb('0x11'));var authService=require(_0x3deb('0x12'));var qs=require(_0x3deb('0x13'));var as=require(_0x3deb('0x14'));var hardwareService=require(_0x3deb('0x15'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x3deb('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x3deb('0x17'))['db'];function respondWithStatusCode(_0x21f596,_0x78aa81){_0x78aa81=_0x78aa81||0xcc;return function(_0x1055dc){if(_0x1055dc){return _0x21f596['sendStatus'](_0x78aa81);}return _0x21f596[_0x3deb('0x18')](_0x78aa81)[_0x3deb('0x19')]();};}function respondWithResult(_0x1a651d,_0x228e23){_0x228e23=_0x228e23||0xc8;return function(_0x329f3a){if(_0x329f3a){return _0x1a651d[_0x3deb('0x18')](_0x228e23)[_0x3deb('0x1a')](_0x329f3a);}};}function respondWithFilteredResult(_0xa25716,_0x4a291e){return function(_0x428f90){if(_0x428f90){var _0xa45605=typeof _0x4a291e['offset']===_0x3deb('0x1b')&&typeof _0x4a291e[_0x3deb('0x1c')]==='undefined';var _0x5cd9db=_0x428f90['count'];var _0x2a8ec4=_0xa45605?0x0:_0x4a291e[_0x3deb('0x1d')];var _0x4adbaa=_0xa45605?_0x428f90['count']:_0x4a291e[_0x3deb('0x1d')]+_0x4a291e[_0x3deb('0x1c')];var _0xb6be32;if(_0x4adbaa>=_0x5cd9db){_0x4adbaa=_0x5cd9db;_0xb6be32=0xc8;}else{_0xb6be32=0xce;}_0xa25716[_0x3deb('0x18')](_0xb6be32);return _0xa25716['set'](_0x3deb('0x1e'),_0x2a8ec4+'-'+_0x4adbaa+'/'+_0x5cd9db)[_0x3deb('0x1a')](_0x428f90);}return null;};}function patchUpdates(_0xbd82de){return function(_0x4ceab2){try{jsonpatch[_0x3deb('0x1f')](_0x4ceab2,_0xbd82de,!![]);}catch(_0x144671){return BPromise[_0x3deb('0x20')](_0x144671);}return _0x4ceab2[_0x3deb('0x21')]();};}function saveUpdates(_0x22ea80,_0x543014){return function(_0x35843b){if(_0x35843b){return _0x35843b[_0x3deb('0x22')](_0x22ea80)[_0x3deb('0x23')](function(_0x428869){return _0x428869;});}return null;};}function removeEntity(_0x12f415,_0x385e2a){return function(_0x3f3d52){if(_0x3f3d52){return _0x3f3d52[_0x3deb('0x24')]()['then'](function(){_0x12f415[_0x3deb('0x18')](0xcc)[_0x3deb('0x19')]();});}};}function handleEntityNotFound(_0x1aacbd,_0x427f9f){return function(_0x472a46){if(!_0x472a46){_0x1aacbd['sendStatus'](0x194);}return _0x472a46;};}function handleError(_0x1185dd,_0x225ea9){_0x225ea9=_0x225ea9||0x1f4;return function(_0x474878){logger[_0x3deb('0x25')](_0x474878[_0x3deb('0x26')]);if(_0x474878[_0x3deb('0x27')]){delete _0x474878[_0x3deb('0x27')];}_0x1185dd['status'](_0x225ea9)['send'](_0x474878);};}exports[_0x3deb('0x28')]=function(_0x520f24,_0x2efb59){var _0x28a4ca={},_0x2bd20f={},_0x492ca0={'count':0x0,'rows':[]};var _0x460512=_['map'](db['VtigerConfiguration'][_0x3deb('0x29')],function(_0x205c22){return{'name':_0x205c22[_0x3deb('0x2a')],'type':_0x205c22[_0x3deb('0x2b')]['key']};});_0x2bd20f['model']=_[_0x3deb('0x2c')](_0x460512,_0x3deb('0x27'));_0x2bd20f['query']=_['keys'](_0x520f24[_0x3deb('0x2d')]);_0x2bd20f[_0x3deb('0x2e')]=_[_0x3deb('0x2f')](_0x2bd20f['model'],_0x2bd20f[_0x3deb('0x2d')]);_0x28a4ca['attributes']=_[_0x3deb('0x2f')](_0x2bd20f[_0x3deb('0x30')],qs[_0x3deb('0x31')](_0x520f24[_0x3deb('0x2d')][_0x3deb('0x31')]));_0x28a4ca[_0x3deb('0x32')]=_0x28a4ca[_0x3deb('0x32')][_0x3deb('0x33')]?_0x28a4ca[_0x3deb('0x32')]:_0x2bd20f[_0x3deb('0x30')];if(!_0x520f24['query'][_0x3deb('0x34')](_0x3deb('0x35'))){_0x28a4ca[_0x3deb('0x1c')]=qs[_0x3deb('0x1c')](_0x520f24[_0x3deb('0x2d')][_0x3deb('0x1c')]);_0x28a4ca[_0x3deb('0x1d')]=qs[_0x3deb('0x1d')](_0x520f24[_0x3deb('0x2d')][_0x3deb('0x1d')]);}_0x28a4ca[_0x3deb('0x36')]=qs[_0x3deb('0x37')](_0x520f24[_0x3deb('0x2d')][_0x3deb('0x37')]);_0x28a4ca[_0x3deb('0x38')]=qs[_0x3deb('0x2e')](_['pick'](_0x520f24['query'],_0x2bd20f[_0x3deb('0x2e')]),_0x460512);if(_0x520f24[_0x3deb('0x2d')][_0x3deb('0x39')]){_0x28a4ca['where']=_[_0x3deb('0x3a')](_0x28a4ca['where'],{'$or':_[_0x3deb('0x2c')](_0x460512,function(_0x53525c){if(_0x53525c[_0x3deb('0x2b')]!=='VIRTUAL'){var _0x3103c5={};_0x3103c5[_0x53525c[_0x3deb('0x27')]]={'$like':'%'+_0x520f24[_0x3deb('0x2d')][_0x3deb('0x39')]+'%'};return _0x3103c5;}})});}_0x28a4ca=_['merge']({},_0x28a4ca,_0x520f24[_0x3deb('0x3b')]);var _0x53fdef={'where':_0x28a4ca[_0x3deb('0x38')]};return db[_0x3deb('0x3c')][_0x3deb('0x3d')](_0x53fdef)[_0x3deb('0x23')](function(_0x3c9310){_0x492ca0[_0x3deb('0x3d')]=_0x3c9310;if(_0x520f24[_0x3deb('0x2d')][_0x3deb('0x3e')]){_0x28a4ca['include']=[{'all':!![]}];}return db[_0x3deb('0x3c')]['findAll'](_0x28a4ca);})['then'](function(_0x5bbbfa){_0x492ca0[_0x3deb('0x3f')]=_0x5bbbfa;return _0x492ca0;})[_0x3deb('0x23')](respondWithFilteredResult(_0x2efb59,_0x28a4ca))[_0x3deb('0x40')](handleError(_0x2efb59,null));};exports[_0x3deb('0x41')]=function(_0x27a64e,_0x7e7374){var _0x2e2c03={'raw':![],'where':{'id':_0x27a64e['params']['id']}},_0x4eed4a={};_0x4eed4a[_0x3deb('0x30')]=_[_0x3deb('0x42')](db[_0x3deb('0x3c')][_0x3deb('0x29')]);_0x4eed4a[_0x3deb('0x2d')]=_['keys'](_0x27a64e[_0x3deb('0x2d')]);_0x4eed4a[_0x3deb('0x2e')]=_[_0x3deb('0x2f')](_0x4eed4a['model'],_0x4eed4a[_0x3deb('0x2d')]);_0x2e2c03[_0x3deb('0x32')]=_[_0x3deb('0x2f')](_0x4eed4a[_0x3deb('0x30')],qs[_0x3deb('0x31')](_0x27a64e['query'][_0x3deb('0x31')]));_0x2e2c03[_0x3deb('0x32')]=_0x2e2c03[_0x3deb('0x32')]['length']?_0x2e2c03['attributes']:_0x4eed4a[_0x3deb('0x30')];if(_0x27a64e[_0x3deb('0x2d')][_0x3deb('0x3e')]){_0x2e2c03[_0x3deb('0x43')]=[{'all':!![]}];}_0x2e2c03=_[_0x3deb('0x3a')]({},_0x2e2c03,_0x27a64e['options']);return db[_0x3deb('0x3c')][_0x3deb('0x44')](_0x2e2c03)[_0x3deb('0x23')](handleEntityNotFound(_0x7e7374,null))[_0x3deb('0x23')](respondWithResult(_0x7e7374,null))[_0x3deb('0x40')](handleError(_0x7e7374,null));};exports[_0x3deb('0x45')]=function(_0x524ac8,_0x384788){return db[_0x3deb('0x3c')]['create'](_0x524ac8[_0x3deb('0x46')],{})[_0x3deb('0x23')](respondWithResult(_0x384788,0xc9))[_0x3deb('0x40')](handleError(_0x384788,null));};exports[_0x3deb('0x22')]=function(_0x448505,_0x4b3cd6){if(_0x448505[_0x3deb('0x46')]['id']){delete _0x448505[_0x3deb('0x46')]['id'];}return db['VtigerConfiguration']['find']({'where':{'id':_0x448505['params']['id']}})[_0x3deb('0x23')](handleEntityNotFound(_0x4b3cd6,null))[_0x3deb('0x23')](saveUpdates(_0x448505['body'],null))['then'](respondWithResult(_0x4b3cd6,null))[_0x3deb('0x40')](handleError(_0x4b3cd6,null));};exports[_0x3deb('0x24')]=function(_0x8aabc0,_0x3b4688){return db['VtigerConfiguration'][_0x3deb('0x44')]({'where':{'id':_0x8aabc0[_0x3deb('0x47')]['id']}})[_0x3deb('0x23')](handleEntityNotFound(_0x3b4688,null))[_0x3deb('0x23')](removeEntity(_0x3b4688,null))[_0x3deb('0x40')](handleError(_0x3b4688,null));};exports[_0x3deb('0x48')]=function(_0x19a1d7,_0x662ee6,_0x5099ee){var _0x4e1fb8={};var _0x20adac={};var _0x375851;var _0x190a74;return db[_0x3deb('0x3c')][_0x3deb('0x49')]({'where':{'id':_0x19a1d7[_0x3deb('0x47')]['id']}})[_0x3deb('0x23')](handleEntityNotFound(_0x662ee6,null))[_0x3deb('0x23')](function(_0x2bc3ae){if(_0x2bc3ae){_0x375851=_0x2bc3ae;_0x20adac[_0x3deb('0x30')]=_[_0x3deb('0x42')](db[_0x3deb('0x4a')][_0x3deb('0x29')]);_0x20adac[_0x3deb('0x2d')]=_['keys'](_0x19a1d7['query']);_0x20adac[_0x3deb('0x2e')]=_['intersection'](_0x20adac['model'],_0x20adac[_0x3deb('0x2d')]);_0x4e1fb8[_0x3deb('0x32')]=_[_0x3deb('0x2f')](_0x20adac[_0x3deb('0x30')],qs['fields'](_0x19a1d7[_0x3deb('0x2d')][_0x3deb('0x31')]));_0x4e1fb8[_0x3deb('0x32')]=_0x4e1fb8[_0x3deb('0x32')][_0x3deb('0x33')]?_0x4e1fb8[_0x3deb('0x32')]:_0x20adac[_0x3deb('0x30')];_0x4e1fb8[_0x3deb('0x36')]=qs[_0x3deb('0x37')](_0x19a1d7[_0x3deb('0x2d')][_0x3deb('0x37')]);_0x4e1fb8[_0x3deb('0x38')]=qs[_0x3deb('0x2e')](_[_0x3deb('0x4b')](_0x19a1d7[_0x3deb('0x2d')],_0x20adac[_0x3deb('0x2e')]));if(_0x19a1d7['query'][_0x3deb('0x39')]){_0x4e1fb8[_0x3deb('0x38')]=_[_0x3deb('0x3a')](_0x4e1fb8[_0x3deb('0x38')],{'$or':_[_0x3deb('0x2c')](_0x4e1fb8['attributes'],function(_0x3299e0){var _0x5084da={};_0x5084da[_0x3299e0]={'$like':'%'+_0x19a1d7[_0x3deb('0x2d')][_0x3deb('0x39')]+'%'};return _0x5084da;})});}_0x4e1fb8=_[_0x3deb('0x3a')]({},_0x4e1fb8,_0x19a1d7[_0x3deb('0x3b')]);return _0x375851[_0x3deb('0x48')](_0x4e1fb8);}})[_0x3deb('0x23')](function(_0x4efd88){if(_0x4efd88){_0x190a74=_0x4efd88[_0x3deb('0x33')];if(!_0x19a1d7[_0x3deb('0x2d')][_0x3deb('0x34')](_0x3deb('0x35'))){_0x4e1fb8[_0x3deb('0x1c')]=qs[_0x3deb('0x1c')](_0x19a1d7[_0x3deb('0x2d')][_0x3deb('0x1c')]);_0x4e1fb8[_0x3deb('0x1d')]=qs[_0x3deb('0x1d')](_0x19a1d7[_0x3deb('0x2d')][_0x3deb('0x1d')]);}return _0x375851['getFields'](_0x4e1fb8);}})['then'](function(_0x15dcf1){if(_0x15dcf1){return _0x15dcf1?{'count':_0x190a74,'rows':_0x15dcf1}:null;}})[_0x3deb('0x23')](respondWithResult(_0x662ee6,null))[_0x3deb('0x40')](handleError(_0x662ee6,null));};exports[_0x3deb('0x4c')]=function(_0x13e29a,_0x462061,_0x4a9417){var _0x2723e4={};var _0x50575a={};var _0xc6c09f;var _0x2cefd9;return db[_0x3deb('0x3c')][_0x3deb('0x49')]({'where':{'id':_0x13e29a[_0x3deb('0x47')]['id']}})[_0x3deb('0x23')](handleEntityNotFound(_0x462061,null))['then'](function(_0xaaab6f){if(_0xaaab6f){_0xc6c09f=_0xaaab6f;_0x50575a[_0x3deb('0x30')]=_[_0x3deb('0x42')](db[_0x3deb('0x4a')][_0x3deb('0x29')]);_0x50575a[_0x3deb('0x2d')]=_[_0x3deb('0x42')](_0x13e29a['query']);_0x50575a[_0x3deb('0x2e')]=_[_0x3deb('0x2f')](_0x50575a[_0x3deb('0x30')],_0x50575a[_0x3deb('0x2d')]);_0x2723e4[_0x3deb('0x32')]=_['intersection'](_0x50575a[_0x3deb('0x30')],qs[_0x3deb('0x31')](_0x13e29a[_0x3deb('0x2d')][_0x3deb('0x31')]));_0x2723e4[_0x3deb('0x32')]=_0x2723e4[_0x3deb('0x32')][_0x3deb('0x33')]?_0x2723e4[_0x3deb('0x32')]:_0x50575a[_0x3deb('0x30')];_0x2723e4[_0x3deb('0x36')]=qs[_0x3deb('0x37')](_0x13e29a[_0x3deb('0x2d')][_0x3deb('0x37')]);_0x2723e4['where']=qs[_0x3deb('0x2e')](_[_0x3deb('0x4b')](_0x13e29a[_0x3deb('0x2d')],_0x50575a[_0x3deb('0x2e')]));if(_0x13e29a[_0x3deb('0x2d')][_0x3deb('0x39')]){_0x2723e4[_0x3deb('0x38')]=_['merge'](_0x2723e4[_0x3deb('0x38')],{'$or':_[_0x3deb('0x2c')](_0x2723e4[_0x3deb('0x32')],function(_0x9a07b5){var _0x454d2e={};_0x454d2e[_0x9a07b5]={'$like':'%'+_0x13e29a[_0x3deb('0x2d')][_0x3deb('0x39')]+'%'};return _0x454d2e;})});}_0x2723e4=_[_0x3deb('0x3a')]({},_0x2723e4,_0x13e29a[_0x3deb('0x3b')]);return _0xc6c09f[_0x3deb('0x4c')](_0x2723e4);}})[_0x3deb('0x23')](function(_0x4a7067){if(_0x4a7067){_0x2cefd9=_0x4a7067[_0x3deb('0x33')];if(!_0x13e29a[_0x3deb('0x2d')]['hasOwnProperty'](_0x3deb('0x35'))){_0x2723e4[_0x3deb('0x1c')]=qs[_0x3deb('0x1c')](_0x13e29a['query'][_0x3deb('0x1c')]);_0x2723e4['offset']=qs['offset'](_0x13e29a[_0x3deb('0x2d')]['offset']);}return _0xc6c09f[_0x3deb('0x4c')](_0x2723e4);}})[_0x3deb('0x23')](function(_0x4f6105){if(_0x4f6105){return _0x4f6105?{'count':_0x2cefd9,'rows':_0x4f6105}:null;}})['then'](respondWithResult(_0x462061,null))[_0x3deb('0x40')](handleError(_0x462061,null));};exports['getDescriptions']=function(_0x3bebe6,_0x30bc5b,_0xd399e2){var _0x1f03b4={};var _0x5acd2a={};var _0x27fc7e;var _0x2469b6;return db[_0x3deb('0x3c')][_0x3deb('0x49')]({'where':{'id':_0x3bebe6[_0x3deb('0x47')]['id']}})[_0x3deb('0x23')](handleEntityNotFound(_0x30bc5b,null))[_0x3deb('0x23')](function(_0x4bceef){if(_0x4bceef){_0x27fc7e=_0x4bceef;_0x5acd2a[_0x3deb('0x30')]=_['keys'](db[_0x3deb('0x4a')][_0x3deb('0x29')]);_0x5acd2a[_0x3deb('0x2d')]=_[_0x3deb('0x42')](_0x3bebe6[_0x3deb('0x2d')]);_0x5acd2a[_0x3deb('0x2e')]=_['intersection'](_0x5acd2a[_0x3deb('0x30')],_0x5acd2a[_0x3deb('0x2d')]);_0x1f03b4[_0x3deb('0x32')]=_[_0x3deb('0x2f')](_0x5acd2a['model'],qs['fields'](_0x3bebe6['query']['fields']));_0x1f03b4['attributes']=_0x1f03b4[_0x3deb('0x32')][_0x3deb('0x33')]?_0x1f03b4[_0x3deb('0x32')]:_0x5acd2a[_0x3deb('0x30')];_0x1f03b4['order']=qs[_0x3deb('0x37')](_0x3bebe6[_0x3deb('0x2d')][_0x3deb('0x37')]);_0x1f03b4[_0x3deb('0x38')]=qs[_0x3deb('0x2e')](_['pick'](_0x3bebe6[_0x3deb('0x2d')],_0x5acd2a['filters']));if(_0x3bebe6[_0x3deb('0x2d')][_0x3deb('0x39')]){_0x1f03b4[_0x3deb('0x38')]=_[_0x3deb('0x3a')](_0x1f03b4[_0x3deb('0x38')],{'$or':_[_0x3deb('0x2c')](_0x1f03b4[_0x3deb('0x32')],function(_0x2abaec){var _0x2ca178={};_0x2ca178[_0x2abaec]={'$like':'%'+_0x3bebe6[_0x3deb('0x2d')][_0x3deb('0x39')]+'%'};return _0x2ca178;})});}_0x1f03b4=_[_0x3deb('0x3a')]({},_0x1f03b4,_0x3bebe6[_0x3deb('0x3b')]);return _0x27fc7e[_0x3deb('0x4d')](_0x1f03b4);}})['then'](function(_0x26cd49){if(_0x26cd49){_0x2469b6=_0x26cd49[_0x3deb('0x33')];if(!_0x3bebe6[_0x3deb('0x2d')]['hasOwnProperty'](_0x3deb('0x35'))){_0x1f03b4[_0x3deb('0x1c')]=qs[_0x3deb('0x1c')](_0x3bebe6['query']['limit']);_0x1f03b4[_0x3deb('0x1d')]=qs[_0x3deb('0x1d')](_0x3bebe6[_0x3deb('0x2d')][_0x3deb('0x1d')]);}return _0x27fc7e[_0x3deb('0x4d')](_0x1f03b4);}})[_0x3deb('0x23')](function(_0x5716f1){if(_0x5716f1){return _0x5716f1?{'count':_0x2469b6,'rows':_0x5716f1}:null;}})[_0x3deb('0x23')](respondWithResult(_0x30bc5b,null))[_0x3deb('0x40')](handleError(_0x30bc5b,null));}; \ No newline at end of file +var _0x0d1a=['eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','save','update','then','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','keys','filters','intersection','attributes','model','fields','query','hasOwnProperty','sort','where','filter','merge','VIRTUAL','options','VtigerConfiguration','includeAll','include','findAll','rows','catch','show','params','length','find','create','body','getFields','order','pick','nolimit','findOne','VtigerField','getSubjects','getDescriptions'];(function(_0x177f58,_0x7eb824){var _0x30c13d=function(_0x24d737){while(--_0x24d737){_0x177f58['push'](_0x177f58['shift']());}};_0x30c13d(++_0x7eb824);}(_0x0d1a,0x1e6));var _0xa0d1=function(_0x18921b,_0x1a9fe9){_0x18921b=_0x18921b-0x0;var _0xae75c5=_0x0d1a[_0x18921b];return _0xae75c5;};'use strict';var emlformat=require(_0xa0d1('0x0'));var rimraf=require(_0xa0d1('0x1'));var zipdir=require(_0xa0d1('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa0d1('0x3'));var moment=require('moment');var BPromise=require(_0xa0d1('0x4'));var Mustache=require(_0xa0d1('0x5'));var util=require(_0xa0d1('0x6'));var path=require(_0xa0d1('0x7'));var sox=require(_0xa0d1('0x8'));var csv=require('to-csv');var ejs=require(_0xa0d1('0x9'));var fs=require('fs');var fs_extra=require(_0xa0d1('0xa'));var _=require(_0xa0d1('0xb'));var squel=require(_0xa0d1('0xc'));var crypto=require(_0xa0d1('0xd'));var jsforce=require(_0xa0d1('0xe'));var deskjs=require(_0xa0d1('0xf'));var toCsv=require(_0xa0d1('0x10'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xa0d1('0x11'));var authService=require(_0xa0d1('0x12'));var qs=require(_0xa0d1('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa0d1('0x14'));var logger=require('../../config/logger')(_0xa0d1('0x15'));var utils=require(_0xa0d1('0x16'));var config=require(_0xa0d1('0x17'));var licenseUtil=require(_0xa0d1('0x18'));var db=require(_0xa0d1('0x19'))['db'];function respondWithStatusCode(_0x2aaf98,_0x444158){_0x444158=_0x444158||0xcc;return function(_0xf3700e){if(_0xf3700e){return _0x2aaf98[_0xa0d1('0x1a')](_0x444158);}return _0x2aaf98[_0xa0d1('0x1b')](_0x444158)[_0xa0d1('0x1c')]();};}function respondWithResult(_0x54b860,_0x1d0d71){_0x1d0d71=_0x1d0d71||0xc8;return function(_0x5c14c4){if(_0x5c14c4){return _0x54b860[_0xa0d1('0x1b')](_0x1d0d71)[_0xa0d1('0x1d')](_0x5c14c4);}};}function respondWithFilteredResult(_0x1a29d4,_0x3b4009){return function(_0x1496e6){if(_0x1496e6){var _0x37641e=typeof _0x3b4009[_0xa0d1('0x1e')]==='undefined'&&typeof _0x3b4009[_0xa0d1('0x1f')]===_0xa0d1('0x20');var _0x4de85c=_0x1496e6[_0xa0d1('0x21')];var _0x4bba06=_0x37641e?0x0:_0x3b4009[_0xa0d1('0x1e')];var _0x1adcb5=_0x37641e?_0x1496e6[_0xa0d1('0x21')]:_0x3b4009[_0xa0d1('0x1e')]+_0x3b4009[_0xa0d1('0x1f')];var _0x36bf1b;if(_0x1adcb5>=_0x4de85c){_0x1adcb5=_0x4de85c;_0x36bf1b=0xc8;}else{_0x36bf1b=0xce;}_0x1a29d4[_0xa0d1('0x1b')](_0x36bf1b);return _0x1a29d4['set']('Content-Range',_0x4bba06+'-'+_0x1adcb5+'/'+_0x4de85c)['json'](_0x1496e6);}return null;};}function patchUpdates(_0x339652){return function(_0x1c2b3f){try{jsonpatch['apply'](_0x1c2b3f,_0x339652,!![]);}catch(_0x2798e7){return BPromise['reject'](_0x2798e7);}return _0x1c2b3f[_0xa0d1('0x22')]();};}function saveUpdates(_0x4ffa9f,_0x12615c){return function(_0x5bd2a4){if(_0x5bd2a4){return _0x5bd2a4[_0xa0d1('0x23')](_0x4ffa9f)[_0xa0d1('0x24')](function(_0x49598e){return _0x49598e;});}return null;};}function removeEntity(_0x5dbd70,_0x19b33e){return function(_0x3e582e){if(_0x3e582e){return _0x3e582e['destroy']()[_0xa0d1('0x24')](function(){_0x5dbd70[_0xa0d1('0x1b')](0xcc)[_0xa0d1('0x1c')]();});}};}function handleEntityNotFound(_0x6ef549,_0x250766){return function(_0x5c768c){if(!_0x5c768c){_0x6ef549[_0xa0d1('0x1a')](0x194);}return _0x5c768c;};}function handleError(_0x102254,_0x5a9860){_0x5a9860=_0x5a9860||0x1f4;return function(_0x3ce5c4){logger[_0xa0d1('0x25')](_0x3ce5c4[_0xa0d1('0x26')]);if(_0x3ce5c4['name']){delete _0x3ce5c4[_0xa0d1('0x27')];}_0x102254[_0xa0d1('0x1b')](_0x5a9860)[_0xa0d1('0x28')](_0x3ce5c4);};}exports[_0xa0d1('0x29')]=function(_0x3aea3b,_0x5dc40b){var _0x434b64={},_0x5ae36b={},_0x5a2f11={'count':0x0,'rows':[]};var _0x2c68e1=_[_0xa0d1('0x2a')](db['VtigerConfiguration'][_0xa0d1('0x2b')],function(_0x1c9fde){return{'name':_0x1c9fde[_0xa0d1('0x2c')],'type':_0x1c9fde[_0xa0d1('0x2d')][_0xa0d1('0x2e')]};});_0x5ae36b['model']=_[_0xa0d1('0x2a')](_0x2c68e1,_0xa0d1('0x27'));_0x5ae36b['query']=_[_0xa0d1('0x2f')](_0x3aea3b['query']);_0x5ae36b[_0xa0d1('0x30')]=_[_0xa0d1('0x31')](_0x5ae36b['model'],_0x5ae36b['query']);_0x434b64[_0xa0d1('0x32')]=_['intersection'](_0x5ae36b[_0xa0d1('0x33')],qs[_0xa0d1('0x34')](_0x3aea3b[_0xa0d1('0x35')][_0xa0d1('0x34')]));_0x434b64[_0xa0d1('0x32')]=_0x434b64[_0xa0d1('0x32')]['length']?_0x434b64[_0xa0d1('0x32')]:_0x5ae36b[_0xa0d1('0x33')];if(!_0x3aea3b[_0xa0d1('0x35')][_0xa0d1('0x36')]('nolimit')){_0x434b64[_0xa0d1('0x1f')]=qs[_0xa0d1('0x1f')](_0x3aea3b[_0xa0d1('0x35')][_0xa0d1('0x1f')]);_0x434b64[_0xa0d1('0x1e')]=qs[_0xa0d1('0x1e')](_0x3aea3b['query'][_0xa0d1('0x1e')]);}_0x434b64['order']=qs[_0xa0d1('0x37')](_0x3aea3b[_0xa0d1('0x35')][_0xa0d1('0x37')]);_0x434b64[_0xa0d1('0x38')]=qs[_0xa0d1('0x30')](_['pick'](_0x3aea3b[_0xa0d1('0x35')],_0x5ae36b[_0xa0d1('0x30')]),_0x2c68e1);if(_0x3aea3b['query'][_0xa0d1('0x39')]){_0x434b64[_0xa0d1('0x38')]=_[_0xa0d1('0x3a')](_0x434b64[_0xa0d1('0x38')],{'$or':_[_0xa0d1('0x2a')](_0x2c68e1,function(_0x2bd281){if(_0x2bd281[_0xa0d1('0x2d')]!==_0xa0d1('0x3b')){var _0x507d9a={};_0x507d9a[_0x2bd281['name']]={'$like':'%'+_0x3aea3b[_0xa0d1('0x35')][_0xa0d1('0x39')]+'%'};return _0x507d9a;}})});}_0x434b64=_['merge']({},_0x434b64,_0x3aea3b[_0xa0d1('0x3c')]);var _0x235995={'where':_0x434b64[_0xa0d1('0x38')]};return db[_0xa0d1('0x3d')][_0xa0d1('0x21')](_0x235995)[_0xa0d1('0x24')](function(_0x35a331){_0x5a2f11[_0xa0d1('0x21')]=_0x35a331;if(_0x3aea3b[_0xa0d1('0x35')][_0xa0d1('0x3e')]){_0x434b64[_0xa0d1('0x3f')]=[{'all':!![]}];}return db[_0xa0d1('0x3d')][_0xa0d1('0x40')](_0x434b64);})[_0xa0d1('0x24')](function(_0x2dbcc2){_0x5a2f11[_0xa0d1('0x41')]=_0x2dbcc2;return _0x5a2f11;})[_0xa0d1('0x24')](respondWithFilteredResult(_0x5dc40b,_0x434b64))[_0xa0d1('0x42')](handleError(_0x5dc40b,null));};exports[_0xa0d1('0x43')]=function(_0x1edc3f,_0x350754){var _0x26afa6={'raw':![],'where':{'id':_0x1edc3f[_0xa0d1('0x44')]['id']}},_0x1cacfe={};_0x1cacfe[_0xa0d1('0x33')]=_[_0xa0d1('0x2f')](db['VtigerConfiguration'][_0xa0d1('0x2b')]);_0x1cacfe['query']=_[_0xa0d1('0x2f')](_0x1edc3f[_0xa0d1('0x35')]);_0x1cacfe[_0xa0d1('0x30')]=_[_0xa0d1('0x31')](_0x1cacfe[_0xa0d1('0x33')],_0x1cacfe['query']);_0x26afa6['attributes']=_['intersection'](_0x1cacfe[_0xa0d1('0x33')],qs[_0xa0d1('0x34')](_0x1edc3f[_0xa0d1('0x35')][_0xa0d1('0x34')]));_0x26afa6[_0xa0d1('0x32')]=_0x26afa6['attributes'][_0xa0d1('0x45')]?_0x26afa6[_0xa0d1('0x32')]:_0x1cacfe['model'];if(_0x1edc3f[_0xa0d1('0x35')][_0xa0d1('0x3e')]){_0x26afa6['include']=[{'all':!![]}];}_0x26afa6=_[_0xa0d1('0x3a')]({},_0x26afa6,_0x1edc3f[_0xa0d1('0x3c')]);return db['VtigerConfiguration'][_0xa0d1('0x46')](_0x26afa6)['then'](handleEntityNotFound(_0x350754,null))[_0xa0d1('0x24')](respondWithResult(_0x350754,null))['catch'](handleError(_0x350754,null));};exports['create']=function(_0x3bfa39,_0x4023b9){return db['VtigerConfiguration'][_0xa0d1('0x47')](_0x3bfa39['body'],{})[_0xa0d1('0x24')](respondWithResult(_0x4023b9,0xc9))[_0xa0d1('0x42')](handleError(_0x4023b9,null));};exports[_0xa0d1('0x23')]=function(_0x1c2ae0,_0x64a456){if(_0x1c2ae0[_0xa0d1('0x48')]['id']){delete _0x1c2ae0['body']['id'];}return db['VtigerConfiguration']['find']({'where':{'id':_0x1c2ae0[_0xa0d1('0x44')]['id']}})[_0xa0d1('0x24')](handleEntityNotFound(_0x64a456,null))['then'](saveUpdates(_0x1c2ae0['body'],null))['then'](respondWithResult(_0x64a456,null))['catch'](handleError(_0x64a456,null));};exports['destroy']=function(_0x100ad7,_0x270962){return db[_0xa0d1('0x3d')][_0xa0d1('0x46')]({'where':{'id':_0x100ad7[_0xa0d1('0x44')]['id']}})[_0xa0d1('0x24')](handleEntityNotFound(_0x270962,null))[_0xa0d1('0x24')](removeEntity(_0x270962,null))[_0xa0d1('0x42')](handleError(_0x270962,null));};exports[_0xa0d1('0x49')]=function(_0x33347d,_0x4a2e44,_0x5dbf4a){var _0x49c1ea={};var _0x264873={};var _0x43c89b;var _0x123d95;return db['VtigerConfiguration']['findOne']({'where':{'id':_0x33347d[_0xa0d1('0x44')]['id']}})[_0xa0d1('0x24')](handleEntityNotFound(_0x4a2e44,null))['then'](function(_0x41223a){if(_0x41223a){_0x43c89b=_0x41223a;_0x264873[_0xa0d1('0x33')]=_[_0xa0d1('0x2f')](db['VtigerField'][_0xa0d1('0x2b')]);_0x264873['query']=_['keys'](_0x33347d['query']);_0x264873[_0xa0d1('0x30')]=_['intersection'](_0x264873[_0xa0d1('0x33')],_0x264873['query']);_0x49c1ea[_0xa0d1('0x32')]=_[_0xa0d1('0x31')](_0x264873[_0xa0d1('0x33')],qs[_0xa0d1('0x34')](_0x33347d[_0xa0d1('0x35')][_0xa0d1('0x34')]));_0x49c1ea[_0xa0d1('0x32')]=_0x49c1ea[_0xa0d1('0x32')][_0xa0d1('0x45')]?_0x49c1ea['attributes']:_0x264873[_0xa0d1('0x33')];_0x49c1ea[_0xa0d1('0x4a')]=qs[_0xa0d1('0x37')](_0x33347d[_0xa0d1('0x35')][_0xa0d1('0x37')]);_0x49c1ea[_0xa0d1('0x38')]=qs[_0xa0d1('0x30')](_[_0xa0d1('0x4b')](_0x33347d[_0xa0d1('0x35')],_0x264873[_0xa0d1('0x30')]));if(_0x33347d[_0xa0d1('0x35')][_0xa0d1('0x39')]){_0x49c1ea[_0xa0d1('0x38')]=_[_0xa0d1('0x3a')](_0x49c1ea[_0xa0d1('0x38')],{'$or':_['map'](_0x49c1ea[_0xa0d1('0x32')],function(_0x410fc7){var _0x274a17={};_0x274a17[_0x410fc7]={'$like':'%'+_0x33347d['query'][_0xa0d1('0x39')]+'%'};return _0x274a17;})});}_0x49c1ea=_['merge']({},_0x49c1ea,_0x33347d[_0xa0d1('0x3c')]);return _0x43c89b[_0xa0d1('0x49')](_0x49c1ea);}})[_0xa0d1('0x24')](function(_0x19feb0){if(_0x19feb0){_0x123d95=_0x19feb0['length'];if(!_0x33347d[_0xa0d1('0x35')][_0xa0d1('0x36')](_0xa0d1('0x4c'))){_0x49c1ea[_0xa0d1('0x1f')]=qs[_0xa0d1('0x1f')](_0x33347d[_0xa0d1('0x35')]['limit']);_0x49c1ea['offset']=qs[_0xa0d1('0x1e')](_0x33347d['query'][_0xa0d1('0x1e')]);}return _0x43c89b[_0xa0d1('0x49')](_0x49c1ea);}})['then'](function(_0x5ee358){if(_0x5ee358){return _0x5ee358?{'count':_0x123d95,'rows':_0x5ee358}:null;}})[_0xa0d1('0x24')](respondWithResult(_0x4a2e44,null))[_0xa0d1('0x42')](handleError(_0x4a2e44,null));};exports['getSubjects']=function(_0x4e9037,_0x50570a,_0x132fde){var _0x1e695c={};var _0x3301f1={};var _0x3d81e9;var _0x30eb72;return db[_0xa0d1('0x3d')][_0xa0d1('0x4d')]({'where':{'id':_0x4e9037['params']['id']}})[_0xa0d1('0x24')](handleEntityNotFound(_0x50570a,null))['then'](function(_0x8dafb6){if(_0x8dafb6){_0x3d81e9=_0x8dafb6;_0x3301f1[_0xa0d1('0x33')]=_['keys'](db[_0xa0d1('0x4e')][_0xa0d1('0x2b')]);_0x3301f1[_0xa0d1('0x35')]=_[_0xa0d1('0x2f')](_0x4e9037['query']);_0x3301f1['filters']=_[_0xa0d1('0x31')](_0x3301f1[_0xa0d1('0x33')],_0x3301f1[_0xa0d1('0x35')]);_0x1e695c[_0xa0d1('0x32')]=_['intersection'](_0x3301f1[_0xa0d1('0x33')],qs[_0xa0d1('0x34')](_0x4e9037[_0xa0d1('0x35')]['fields']));_0x1e695c[_0xa0d1('0x32')]=_0x1e695c[_0xa0d1('0x32')][_0xa0d1('0x45')]?_0x1e695c['attributes']:_0x3301f1[_0xa0d1('0x33')];_0x1e695c['order']=qs[_0xa0d1('0x37')](_0x4e9037['query'][_0xa0d1('0x37')]);_0x1e695c[_0xa0d1('0x38')]=qs[_0xa0d1('0x30')](_['pick'](_0x4e9037[_0xa0d1('0x35')],_0x3301f1[_0xa0d1('0x30')]));if(_0x4e9037[_0xa0d1('0x35')][_0xa0d1('0x39')]){_0x1e695c[_0xa0d1('0x38')]=_[_0xa0d1('0x3a')](_0x1e695c[_0xa0d1('0x38')],{'$or':_[_0xa0d1('0x2a')](_0x1e695c[_0xa0d1('0x32')],function(_0x360c71){var _0x598ef6={};_0x598ef6[_0x360c71]={'$like':'%'+_0x4e9037[_0xa0d1('0x35')][_0xa0d1('0x39')]+'%'};return _0x598ef6;})});}_0x1e695c=_['merge']({},_0x1e695c,_0x4e9037['options']);return _0x3d81e9['getSubjects'](_0x1e695c);}})[_0xa0d1('0x24')](function(_0x3a03e4){if(_0x3a03e4){_0x30eb72=_0x3a03e4[_0xa0d1('0x45')];if(!_0x4e9037['query']['hasOwnProperty'](_0xa0d1('0x4c'))){_0x1e695c[_0xa0d1('0x1f')]=qs[_0xa0d1('0x1f')](_0x4e9037['query'][_0xa0d1('0x1f')]);_0x1e695c[_0xa0d1('0x1e')]=qs[_0xa0d1('0x1e')](_0x4e9037[_0xa0d1('0x35')][_0xa0d1('0x1e')]);}return _0x3d81e9[_0xa0d1('0x4f')](_0x1e695c);}})[_0xa0d1('0x24')](function(_0x5cb74a){if(_0x5cb74a){return _0x5cb74a?{'count':_0x30eb72,'rows':_0x5cb74a}:null;}})['then'](respondWithResult(_0x50570a,null))[_0xa0d1('0x42')](handleError(_0x50570a,null));};exports[_0xa0d1('0x50')]=function(_0x57ef59,_0x3bcc6e,_0x4680a3){var _0x34b9a6={};var _0x1a5cde={};var _0x466647;var _0x360a64;return db[_0xa0d1('0x3d')][_0xa0d1('0x4d')]({'where':{'id':_0x57ef59['params']['id']}})['then'](handleEntityNotFound(_0x3bcc6e,null))[_0xa0d1('0x24')](function(_0x40a43b){if(_0x40a43b){_0x466647=_0x40a43b;_0x1a5cde['model']=_[_0xa0d1('0x2f')](db[_0xa0d1('0x4e')][_0xa0d1('0x2b')]);_0x1a5cde[_0xa0d1('0x35')]=_[_0xa0d1('0x2f')](_0x57ef59[_0xa0d1('0x35')]);_0x1a5cde[_0xa0d1('0x30')]=_[_0xa0d1('0x31')](_0x1a5cde[_0xa0d1('0x33')],_0x1a5cde[_0xa0d1('0x35')]);_0x34b9a6[_0xa0d1('0x32')]=_[_0xa0d1('0x31')](_0x1a5cde[_0xa0d1('0x33')],qs[_0xa0d1('0x34')](_0x57ef59[_0xa0d1('0x35')][_0xa0d1('0x34')]));_0x34b9a6[_0xa0d1('0x32')]=_0x34b9a6[_0xa0d1('0x32')]['length']?_0x34b9a6[_0xa0d1('0x32')]:_0x1a5cde[_0xa0d1('0x33')];_0x34b9a6[_0xa0d1('0x4a')]=qs['sort'](_0x57ef59[_0xa0d1('0x35')][_0xa0d1('0x37')]);_0x34b9a6['where']=qs['filters'](_[_0xa0d1('0x4b')](_0x57ef59['query'],_0x1a5cde[_0xa0d1('0x30')]));if(_0x57ef59[_0xa0d1('0x35')]['filter']){_0x34b9a6[_0xa0d1('0x38')]=_['merge'](_0x34b9a6['where'],{'$or':_[_0xa0d1('0x2a')](_0x34b9a6['attributes'],function(_0x22401f){var _0x1b423a={};_0x1b423a[_0x22401f]={'$like':'%'+_0x57ef59[_0xa0d1('0x35')]['filter']+'%'};return _0x1b423a;})});}_0x34b9a6=_[_0xa0d1('0x3a')]({},_0x34b9a6,_0x57ef59[_0xa0d1('0x3c')]);return _0x466647[_0xa0d1('0x50')](_0x34b9a6);}})[_0xa0d1('0x24')](function(_0x593d0a){if(_0x593d0a){_0x360a64=_0x593d0a[_0xa0d1('0x45')];if(!_0x57ef59[_0xa0d1('0x35')][_0xa0d1('0x36')](_0xa0d1('0x4c'))){_0x34b9a6[_0xa0d1('0x1f')]=qs[_0xa0d1('0x1f')](_0x57ef59[_0xa0d1('0x35')][_0xa0d1('0x1f')]);_0x34b9a6[_0xa0d1('0x1e')]=qs[_0xa0d1('0x1e')](_0x57ef59[_0xa0d1('0x35')][_0xa0d1('0x1e')]);}return _0x466647[_0xa0d1('0x50')](_0x34b9a6);}})[_0xa0d1('0x24')](function(_0x458e12){if(_0x458e12){return _0x458e12?{'count':_0x360a64,'rows':_0x458e12}:null;}})[_0xa0d1('0x24')](respondWithResult(_0x3bcc6e,null))[_0xa0d1('0x42')](handleError(_0x3bcc6e,null));}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js index c5162fd..d00b184 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 _0x9a1e=['util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intVtigerConfiguration.attributes','define','VtigerConfiguration','int_vtiger_configurations','lodash'];(function(_0xc051b2,_0x3d6d9d){var _0x599dc2=function(_0x235ded){while(--_0x235ded){_0xc051b2['push'](_0xc051b2['shift']());}};_0x599dc2(++_0x3d6d9d);}(_0x9a1e,0x144));var _0xe9a1=function(_0x3c25cd,_0x4c3fcb){_0x3c25cd=_0x3c25cd-0x0;var _0x149a64=_0x9a1e[_0x3c25cd];return _0x149a64;};'use strict';var _=require(_0xe9a1('0x0'));var util=require(_0xe9a1('0x1'));var logger=require(_0xe9a1('0x2'))('api');var moment=require(_0xe9a1('0x3'));var BPromise=require(_0xe9a1('0x4'));var rp=require(_0xe9a1('0x5'));var fs=require('fs');var path=require(_0xe9a1('0x6'));var rimraf=require(_0xe9a1('0x7'));var config=require(_0xe9a1('0x8'));var attributes=require(_0xe9a1('0x9'));module['exports']=function(_0x12fa17,_0xaa3aaa){return _0x12fa17[_0xe9a1('0xa')](_0xe9a1('0xb'),attributes,{'tableName':_0xe9a1('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7731=['int_vtiger_configurations','util','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','VtigerConfiguration'];(function(_0x2aec52,_0x59d962){var _0x3b8835=function(_0x3e2604){while(--_0x3e2604){_0x2aec52['push'](_0x2aec52['shift']());}};_0x3b8835(++_0x59d962);}(_0x7731,0x114));var _0x1773=function(_0x59933e,_0x2aa6be){_0x59933e=_0x59933e-0x0;var _0x48f7ac=_0x7731[_0x59933e];return _0x48f7ac;};'use strict';var _=require('lodash');var util=require(_0x1773('0x0'));var logger=require(_0x1773('0x1'))('api');var moment=require('moment');var BPromise=require(_0x1773('0x2'));var rp=require(_0x1773('0x3'));var fs=require('fs');var path=require(_0x1773('0x4'));var rimraf=require(_0x1773('0x5'));var config=require(_0x1773('0x6'));var attributes=require('./intVtigerConfiguration.attributes');module[_0x1773('0x7')]=function(_0x2c92e4,_0x4a5872){return _0x2c92e4[_0x1773('0x8')](_0x1773('0x9'),attributes,{'tableName':_0x1773('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 89fb6d9..5eeba5d 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 _0xbaaa=['../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','VtigerConfiguration,\x20%s,\x20%s','debug','error','code','message','request\x20sent','lodash','util','bluebird','randomstring','ioredis'];(function(_0xe18ab7,_0x95a601){var _0x531ce5=function(_0x5ebb8b){while(--_0x5ebb8b){_0xe18ab7['push'](_0xe18ab7['shift']());}};_0x531ce5(++_0x95a601);}(_0xbaaa,0x1b3));var _0xabaa=function(_0x49b207,_0x408ade){_0x49b207=_0x49b207-0x0;var _0x2dc8fa=_0xbaaa[_0x49b207];return _0x2dc8fa;};'use strict';var _=require(_0xabaa('0x0'));var util=require(_0xabaa('0x1'));var moment=require('moment');var BPromise=require(_0xabaa('0x2'));var rs=require(_0xabaa('0x3'));var fs=require('fs');var Redis=require(_0xabaa('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xabaa('0x5'));var logger=require('../../config/logger')(_0xabaa('0x6'));var config=require(_0xabaa('0x7'));var jayson=require(_0xabaa('0x8'));var client=jayson[_0xabaa('0x9')][_0xabaa('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3d265d,_0x453d96,_0x497e0f){return new BPromise(function(_0x426188,_0x6df816){return client[_0xabaa('0xb')](_0x3d265d,_0x497e0f)[_0xabaa('0xc')](function(_0x3baec1){logger[_0xabaa('0xd')](_0xabaa('0xe'),_0x453d96,'request\x20sent');logger[_0xabaa('0xf')]('VtigerConfiguration,\x20%s,\x20%s,\x20%s',_0x453d96,'request\x20sent',JSON['stringify'](_0x3baec1));if(_0x3baec1[_0xabaa('0x10')]){if(_0x3baec1[_0xabaa('0x10')][_0xabaa('0x11')]===0x1f4){logger[_0xabaa('0x10')]('VtigerConfiguration,\x20%s,\x20%s',_0x453d96,_0x3baec1[_0xabaa('0x10')][_0xabaa('0x12')]);return _0x6df816(_0x3baec1[_0xabaa('0x10')]['message']);}logger[_0xabaa('0x10')]('VtigerConfiguration,\x20%s,\x20%s',_0x453d96,_0x3baec1[_0xabaa('0x10')][_0xabaa('0x12')]);return _0x426188(_0x3baec1[_0xabaa('0x10')][_0xabaa('0x12')]);}else{logger[_0xabaa('0xd')](_0xabaa('0xe'),_0x453d96,_0xabaa('0x13'));_0x426188(_0x3baec1['result'][_0xabaa('0x12')]);}})['catch'](function(_0x581a75){logger['error'](_0xabaa('0xe'),_0x453d96,_0x581a75);_0x6df816(_0x581a75);});});} \ No newline at end of file +var _0x6ecc=['moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','request','then','VtigerConfiguration,\x20%s,\x20%s','debug','VtigerConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','info','request\x20sent','catch','util'];(function(_0x5783f4,_0x4a9e0a){var _0x28e380=function(_0x1ffc49){while(--_0x1ffc49){_0x5783f4['push'](_0x5783f4['shift']());}};_0x28e380(++_0x4a9e0a);}(_0x6ecc,0x8b));var _0xc6ec=function(_0x1e961b,_0x1520a5){_0x1e961b=_0x1e961b-0x0;var _0x28326f=_0x6ecc[_0x1e961b];return _0x28326f;};'use strict';var _=require('lodash');var util=require(_0xc6ec('0x0'));var moment=require(_0xc6ec('0x1'));var BPromise=require('bluebird');var rs=require(_0xc6ec('0x2'));var fs=require('fs');var Redis=require(_0xc6ec('0x3'));var db=require(_0xc6ec('0x4'))['db'];var utils=require(_0xc6ec('0x5'));var logger=require(_0xc6ec('0x6'))('rpc');var config=require(_0xc6ec('0x7'));var jayson=require(_0xc6ec('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3554bb,_0x173be2,_0x2861b7){return new BPromise(function(_0x1454a5,_0x70a2cd){return client[_0xc6ec('0x9')](_0x3554bb,_0x2861b7)[_0xc6ec('0xa')](function(_0x620aac){logger['info'](_0xc6ec('0xb'),_0x173be2,'request\x20sent');logger[_0xc6ec('0xc')](_0xc6ec('0xd'),_0x173be2,'request\x20sent',JSON[_0xc6ec('0xe')](_0x620aac));if(_0x620aac[_0xc6ec('0xf')]){if(_0x620aac[_0xc6ec('0xf')]['code']===0x1f4){logger['error']('VtigerConfiguration,\x20%s,\x20%s',_0x173be2,_0x620aac[_0xc6ec('0xf')][_0xc6ec('0x10')]);return _0x70a2cd(_0x620aac[_0xc6ec('0xf')][_0xc6ec('0x10')]);}logger[_0xc6ec('0xf')](_0xc6ec('0xb'),_0x173be2,_0x620aac[_0xc6ec('0xf')][_0xc6ec('0x10')]);return _0x1454a5(_0x620aac['error']['message']);}else{logger[_0xc6ec('0x11')]('VtigerConfiguration,\x20%s,\x20%s',_0x173be2,_0xc6ec('0x12'));_0x1454a5(_0x620aac['result'][_0xc6ec('0x10')]);}})[_0xc6ec('0x13')](function(_0x24ce20){logger[_0xc6ec('0xf')](_0xc6ec('0xb'),_0x173be2,_0x24ce20);_0x70a2cd(_0x24ce20);});});} \ No newline at end of file diff --git a/server/api/intVtigerField/index.js b/server/api/intVtigerField/index.js index a24970a..95e227c 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 _0x1c05=['update','delete','destroy','multer','util','path','connect-timeout','Router','../../components/auth/service','get','isAuthenticated','index','show','post','create','put','/:id'];(function(_0x325149,_0x16196a){var _0x2e9ba1=function(_0x449a2f){while(--_0x449a2f){_0x325149['push'](_0x325149['shift']());}};_0x2e9ba1(++_0x16196a);}(_0x1c05,0x135));var _0x51c0=function(_0x4044b9,_0x396d74){_0x4044b9=_0x4044b9-0x0;var _0x323277=_0x1c05[_0x4044b9];return _0x323277;};'use strict';var multer=require(_0x51c0('0x0'));var util=require(_0x51c0('0x1'));var path=require(_0x51c0('0x2'));var timeout=require(_0x51c0('0x3'));var express=require('express');var router=express[_0x51c0('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x51c0('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./intVtigerField.controller');router[_0x51c0('0x6')]('/',auth[_0x51c0('0x7')](),controller[_0x51c0('0x8')]);router[_0x51c0('0x6')]('/:id',auth[_0x51c0('0x7')](),controller[_0x51c0('0x9')]);router[_0x51c0('0xa')]('/',auth[_0x51c0('0x7')](),controller[_0x51c0('0xb')]);router[_0x51c0('0xc')](_0x51c0('0xd'),auth[_0x51c0('0x7')](),controller[_0x51c0('0xe')]);router[_0x51c0('0xf')](_0x51c0('0xd'),auth['isAuthenticated'](),controller[_0x51c0('0x10')]);module['exports']=router; \ No newline at end of file +var _0xc3f0=['show','post','put','/:id','update','destroy','multer','path','Router','../../components/interaction/service','../../config/environment','get','isAuthenticated'];(function(_0x4440f3,_0x3d1418){var _0x426de2=function(_0x5a3c6a){while(--_0x5a3c6a){_0x4440f3['push'](_0x4440f3['shift']());}};_0x426de2(++_0x3d1418);}(_0xc3f0,0xf0));var _0x0c3f=function(_0x44f88c,_0x437294){_0x44f88c=_0x44f88c-0x0;var _0x56dd44=_0xc3f0[_0x44f88c];return _0x56dd44;};'use strict';var multer=require(_0x0c3f('0x0'));var util=require('util');var path=require(_0x0c3f('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0c3f('0x2')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x0c3f('0x3'));var config=require(_0x0c3f('0x4'));var controller=require('./intVtigerField.controller');router[_0x0c3f('0x5')]('/',auth['isAuthenticated'](),controller['index']);router['get']('/:id',auth[_0x0c3f('0x6')](),controller[_0x0c3f('0x7')]);router[_0x0c3f('0x8')]('/',auth[_0x0c3f('0x6')](),controller['create']);router[_0x0c3f('0x9')](_0x0c3f('0xa'),auth['isAuthenticated'](),controller[_0x0c3f('0xb')]);router['delete'](_0x0c3f('0xa'),auth[_0x0c3f('0x6')](),controller[_0x0c3f('0xc')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.attributes.js b/server/api/intVtigerField/intVtigerField.attributes.js index e4b32d6..12de83e 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 _0xadef=['keyValue','picklist','STRING','BOOLEAN','sequelize','exports','ENUM','string','variable','customVariable'];(function(_0x126c9d,_0x1bea95){var _0x25d1d1=function(_0x1b63b6){while(--_0x1b63b6){_0x126c9d['push'](_0x126c9d['shift']());}};_0x25d1d1(++_0x1bea95);}(_0xadef,0x1d0));var _0xfade=function(_0x2596d0,_0x5ee8ca){_0x2596d0=_0x2596d0-0x0;var _0x1f0533=_0xadef[_0x2596d0];return _0x1f0533;};'use strict';var Sequelize=require(_0xfade('0x0'));module[_0xfade('0x1')]={'type':{'type':Sequelize[_0xfade('0x2')](_0xfade('0x3'),_0xfade('0x4'),_0xfade('0x5'),_0xfade('0x6'),_0xfade('0x7')),'defaultValue':'string'},'content':{'type':Sequelize[_0xfade('0x8')]},'key':{'type':Sequelize[_0xfade('0x8')]},'keyType':{'type':Sequelize[_0xfade('0x2')](_0xfade('0x3'),_0xfade('0x4'),_0xfade('0x5'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0xfade('0x8')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0xfade('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xe819=['ENUM','string','variable','customVariable','picklist','STRING','BOOLEAN','sequelize','exports'];(function(_0x543ae5,_0x24e12f){var _0x5da735=function(_0x55ea98){while(--_0x55ea98){_0x543ae5['push'](_0x543ae5['shift']());}};_0x5da735(++_0x24e12f);}(_0xe819,0x193));var _0x9e81=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0xe819[_0x3b380d];return _0x54502b;};'use strict';var Sequelize=require(_0x9e81('0x0'));module[_0x9e81('0x1')]={'type':{'type':Sequelize[_0x9e81('0x2')](_0x9e81('0x3'),_0x9e81('0x4'),_0x9e81('0x5'),'keyValue',_0x9e81('0x6')),'defaultValue':'string'},'content':{'type':Sequelize[_0x9e81('0x7')]},'key':{'type':Sequelize[_0x9e81('0x7')]},'keyType':{'type':Sequelize[_0x9e81('0x2')]('string','variable',_0x9e81('0x5'))},'keyContent':{'type':Sequelize[_0x9e81('0x7')]},'idField':{'type':Sequelize[_0x9e81('0x7')]},'nameField':{'type':Sequelize[_0x9e81('0x7')]},'customField':{'type':Sequelize[_0x9e81('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x9e81('0x7')]}}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.controller.js b/server/api/intVtigerField/intVtigerField.controller.js index fe1e661..bafbda5 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 _0x1434=['nolimit','limit','order','sort','where','filter','merge','options','includeAll','findAll','rows','show','params','keys','include','find','catch','create','body','update','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','offset','undefined','count','apply','reject','save','then','destroy','error','stack','name','send','index','VtigerField','rawAttributes','fieldName','type','key','model','map','query','filters','attributes','intersection','fields','length','hasOwnProperty'];(function(_0x2d9fff,_0x48e513){var _0x5d14f6=function(_0x188cdb){while(--_0x188cdb){_0x2d9fff['push'](_0x2d9fff['shift']());}};_0x5d14f6(++_0x48e513);}(_0x1434,0xf2));var _0x4143=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x1434[_0x502c7d];return _0x30b7ed;};'use strict';var emlformat=require(_0x4143('0x0'));var rimraf=require(_0x4143('0x1'));var zipdir=require(_0x4143('0x2'));var jsonpatch=require(_0x4143('0x3'));var rp=require('request-promise');var moment=require(_0x4143('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x4143('0x5'));var util=require('util');var path=require(_0x4143('0x6'));var sox=require(_0x4143('0x7'));var csv=require(_0x4143('0x8'));var ejs=require(_0x4143('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x4143('0xa'));var crypto=require(_0x4143('0xb'));var jsforce=require(_0x4143('0xc'));var deskjs=require(_0x4143('0xd'));var toCsv=require(_0x4143('0x8'));var querystring=require(_0x4143('0xe'));var Papa=require(_0x4143('0xf'));var Redis=require(_0x4143('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x4143('0x11'));var as=require(_0x4143('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x4143('0x13'))(_0x4143('0x14'));var utils=require(_0x4143('0x15'));var config=require(_0x4143('0x16'));var licenseUtil=require(_0x4143('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x45d19d,_0x466322){_0x466322=_0x466322||0xcc;return function(_0x50a585){if(_0x50a585){return _0x45d19d[_0x4143('0x18')](_0x466322);}return _0x45d19d[_0x4143('0x19')](_0x466322)[_0x4143('0x1a')]();};}function respondWithResult(_0x299816,_0x403377){_0x403377=_0x403377||0xc8;return function(_0x282d89){if(_0x282d89){return _0x299816[_0x4143('0x19')](_0x403377)['json'](_0x282d89);}};}function respondWithFilteredResult(_0xa84864,_0x23be77){return function(_0x488204){if(_0x488204){var _0x44ca90=typeof _0x23be77[_0x4143('0x1b')]===_0x4143('0x1c')&&typeof _0x23be77['limit']===_0x4143('0x1c');var _0x18eec1=_0x488204[_0x4143('0x1d')];var _0x4340e9=_0x44ca90?0x0:_0x23be77['offset'];var _0x153340=_0x44ca90?_0x488204[_0x4143('0x1d')]:_0x23be77['offset']+_0x23be77['limit'];var _0x5657ee;if(_0x153340>=_0x18eec1){_0x153340=_0x18eec1;_0x5657ee=0xc8;}else{_0x5657ee=0xce;}_0xa84864[_0x4143('0x19')](_0x5657ee);return _0xa84864['set']('Content-Range',_0x4340e9+'-'+_0x153340+'/'+_0x18eec1)['json'](_0x488204);}return null;};}function patchUpdates(_0x30d504){return function(_0x110118){try{jsonpatch[_0x4143('0x1e')](_0x110118,_0x30d504,!![]);}catch(_0x48dc34){return BPromise[_0x4143('0x1f')](_0x48dc34);}return _0x110118[_0x4143('0x20')]();};}function saveUpdates(_0x35b8f8,_0x2b37be){return function(_0x58cf69){if(_0x58cf69){return _0x58cf69['update'](_0x35b8f8)[_0x4143('0x21')](function(_0x15c800){return _0x15c800;});}return null;};}function removeEntity(_0x40c48d,_0x52c7f0){return function(_0xfa96e4){if(_0xfa96e4){return _0xfa96e4[_0x4143('0x22')]()[_0x4143('0x21')](function(){_0x40c48d[_0x4143('0x19')](0xcc)[_0x4143('0x1a')]();});}};}function handleEntityNotFound(_0x1f5059,_0x2e7022){return function(_0x21d8d0){if(!_0x21d8d0){_0x1f5059[_0x4143('0x18')](0x194);}return _0x21d8d0;};}function handleError(_0x1978c0,_0x4609be){_0x4609be=_0x4609be||0x1f4;return function(_0x15eeb3){logger[_0x4143('0x23')](_0x15eeb3[_0x4143('0x24')]);if(_0x15eeb3['name']){delete _0x15eeb3[_0x4143('0x25')];}_0x1978c0[_0x4143('0x19')](_0x4609be)[_0x4143('0x26')](_0x15eeb3);};}exports[_0x4143('0x27')]=function(_0xa30554,_0x17f921){var _0x1ec9a8={},_0x1fee85={},_0x5ea84d={'count':0x0,'rows':[]};var _0x2484a3=_['map'](db[_0x4143('0x28')][_0x4143('0x29')],function(_0x416e3c){return{'name':_0x416e3c[_0x4143('0x2a')],'type':_0x416e3c[_0x4143('0x2b')][_0x4143('0x2c')]};});_0x1fee85[_0x4143('0x2d')]=_[_0x4143('0x2e')](_0x2484a3,_0x4143('0x25'));_0x1fee85[_0x4143('0x2f')]=_['keys'](_0xa30554[_0x4143('0x2f')]);_0x1fee85[_0x4143('0x30')]=_['intersection'](_0x1fee85[_0x4143('0x2d')],_0x1fee85[_0x4143('0x2f')]);_0x1ec9a8[_0x4143('0x31')]=_[_0x4143('0x32')](_0x1fee85['model'],qs[_0x4143('0x33')](_0xa30554['query'][_0x4143('0x33')]));_0x1ec9a8['attributes']=_0x1ec9a8['attributes'][_0x4143('0x34')]?_0x1ec9a8['attributes']:_0x1fee85[_0x4143('0x2d')];if(!_0xa30554[_0x4143('0x2f')][_0x4143('0x35')](_0x4143('0x36'))){_0x1ec9a8[_0x4143('0x37')]=qs[_0x4143('0x37')](_0xa30554[_0x4143('0x2f')][_0x4143('0x37')]);_0x1ec9a8[_0x4143('0x1b')]=qs['offset'](_0xa30554[_0x4143('0x2f')]['offset']);}_0x1ec9a8[_0x4143('0x38')]=qs[_0x4143('0x39')](_0xa30554[_0x4143('0x2f')][_0x4143('0x39')]);_0x1ec9a8[_0x4143('0x3a')]=qs[_0x4143('0x30')](_['pick'](_0xa30554['query'],_0x1fee85[_0x4143('0x30')]),_0x2484a3);if(_0xa30554[_0x4143('0x2f')][_0x4143('0x3b')]){_0x1ec9a8[_0x4143('0x3a')]=_['merge'](_0x1ec9a8['where'],{'$or':_['map'](_0x2484a3,function(_0x51575d){if(_0x51575d['type']!=='VIRTUAL'){var _0x5eaaed={};_0x5eaaed[_0x51575d[_0x4143('0x25')]]={'$like':'%'+_0xa30554[_0x4143('0x2f')][_0x4143('0x3b')]+'%'};return _0x5eaaed;}})});}_0x1ec9a8=_[_0x4143('0x3c')]({},_0x1ec9a8,_0xa30554[_0x4143('0x3d')]);var _0x48907f={'where':_0x1ec9a8['where']};return db[_0x4143('0x28')][_0x4143('0x1d')](_0x48907f)[_0x4143('0x21')](function(_0x539ed5){_0x5ea84d[_0x4143('0x1d')]=_0x539ed5;if(_0xa30554[_0x4143('0x2f')][_0x4143('0x3e')]){_0x1ec9a8['include']=[{'all':!![]}];}return db[_0x4143('0x28')][_0x4143('0x3f')](_0x1ec9a8);})['then'](function(_0x46fd76){_0x5ea84d[_0x4143('0x40')]=_0x46fd76;return _0x5ea84d;})[_0x4143('0x21')](respondWithFilteredResult(_0x17f921,_0x1ec9a8))['catch'](handleError(_0x17f921,null));};exports[_0x4143('0x41')]=function(_0x509eb2,_0x1a9ade){var _0x1a819d={'raw':!![],'where':{'id':_0x509eb2[_0x4143('0x42')]['id']}},_0x26e0db={};_0x26e0db[_0x4143('0x2d')]=_[_0x4143('0x43')](db['VtigerField'][_0x4143('0x29')]);_0x26e0db[_0x4143('0x2f')]=_[_0x4143('0x43')](_0x509eb2['query']);_0x26e0db[_0x4143('0x30')]=_[_0x4143('0x32')](_0x26e0db[_0x4143('0x2d')],_0x26e0db[_0x4143('0x2f')]);_0x1a819d['attributes']=_[_0x4143('0x32')](_0x26e0db[_0x4143('0x2d')],qs[_0x4143('0x33')](_0x509eb2[_0x4143('0x2f')][_0x4143('0x33')]));_0x1a819d['attributes']=_0x1a819d[_0x4143('0x31')][_0x4143('0x34')]?_0x1a819d[_0x4143('0x31')]:_0x26e0db[_0x4143('0x2d')];if(_0x509eb2['query'][_0x4143('0x3e')]){_0x1a819d[_0x4143('0x44')]=[{'all':!![]}];}_0x1a819d=_[_0x4143('0x3c')]({},_0x1a819d,_0x509eb2['options']);return db[_0x4143('0x28')][_0x4143('0x45')](_0x1a819d)[_0x4143('0x21')](handleEntityNotFound(_0x1a9ade,null))[_0x4143('0x21')](respondWithResult(_0x1a9ade,null))[_0x4143('0x46')](handleError(_0x1a9ade,null));};exports[_0x4143('0x47')]=function(_0x56492c,_0x59e06a){return db[_0x4143('0x28')][_0x4143('0x47')](_0x56492c[_0x4143('0x48')],{})[_0x4143('0x21')](respondWithResult(_0x59e06a,0xc9))[_0x4143('0x46')](handleError(_0x59e06a,null));};exports[_0x4143('0x49')]=function(_0x182ce7,_0x1acc57){if(_0x182ce7[_0x4143('0x48')]['id']){delete _0x182ce7[_0x4143('0x48')]['id'];}return db[_0x4143('0x28')][_0x4143('0x45')]({'where':{'id':_0x182ce7[_0x4143('0x42')]['id']}})['then'](handleEntityNotFound(_0x1acc57,null))[_0x4143('0x21')](saveUpdates(_0x182ce7[_0x4143('0x48')],null))[_0x4143('0x21')](respondWithResult(_0x1acc57,null))[_0x4143('0x46')](handleError(_0x1acc57,null));};exports[_0x4143('0x22')]=function(_0x27fffe,_0xb8c109){return db['VtigerField'][_0x4143('0x45')]({'where':{'id':_0x27fffe[_0x4143('0x42')]['id']}})[_0x4143('0x21')](handleEntityNotFound(_0xb8c109,null))[_0x4143('0x21')](removeEntity(_0xb8c109,null))['catch'](handleError(_0xb8c109,null));}; \ No newline at end of file +var _0x83db=['filter','merge','options','includeAll','include','findAll','rows','keys','length','find','catch','create','body','params','destroy','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','stack','name','send','VtigerField','rawAttributes','type','key','model','map','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick'];(function(_0x3f94f9,_0x42774b){var _0x46f84f=function(_0xa080d8){while(--_0xa080d8){_0x3f94f9['push'](_0x3f94f9['shift']());}};_0x46f84f(++_0x42774b);}(_0x83db,0x13f));var _0xb83d=function(_0x39c009,_0x21b330){_0x39c009=_0x39c009-0x0;var _0x2c6cb8=_0x83db[_0x39c009];return _0x2c6cb8;};'use strict';var emlformat=require(_0xb83d('0x0'));var rimraf=require(_0xb83d('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb83d('0x2'));var rp=require(_0xb83d('0x3'));var moment=require(_0xb83d('0x4'));var BPromise=require(_0xb83d('0x5'));var Mustache=require(_0xb83d('0x6'));var util=require(_0xb83d('0x7'));var path=require(_0xb83d('0x8'));var sox=require(_0xb83d('0x9'));var csv=require(_0xb83d('0xa'));var ejs=require(_0xb83d('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb83d('0xc'));var squel=require(_0xb83d('0xd'));var crypto=require(_0xb83d('0xe'));var jsforce=require(_0xb83d('0xf'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xb83d('0x10'));var Redis=require(_0xb83d('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xb83d('0x12'));var as=require(_0xb83d('0x13'));var hardwareService=require(_0xb83d('0x14'));var logger=require(_0xb83d('0x15'))(_0xb83d('0x16'));var utils=require(_0xb83d('0x17'));var config=require(_0xb83d('0x18'));var licenseUtil=require(_0xb83d('0x19'));var db=require(_0xb83d('0x1a'))['db'];function respondWithStatusCode(_0x9bbedb,_0x40a56f){_0x40a56f=_0x40a56f||0xcc;return function(_0x2a5c40){if(_0x2a5c40){return _0x9bbedb[_0xb83d('0x1b')](_0x40a56f);}return _0x9bbedb[_0xb83d('0x1c')](_0x40a56f)[_0xb83d('0x1d')]();};}function respondWithResult(_0x24c44b,_0xdb2029){_0xdb2029=_0xdb2029||0xc8;return function(_0x5850c1){if(_0x5850c1){return _0x24c44b[_0xb83d('0x1c')](_0xdb2029)[_0xb83d('0x1e')](_0x5850c1);}};}function respondWithFilteredResult(_0x59df08,_0x4489d1){return function(_0x55c1e5){if(_0x55c1e5){var _0x1df89e=typeof _0x4489d1[_0xb83d('0x1f')]===_0xb83d('0x20')&&typeof _0x4489d1['limit']===_0xb83d('0x20');var _0x1e2bbd=_0x55c1e5[_0xb83d('0x21')];var _0x400df5=_0x1df89e?0x0:_0x4489d1[_0xb83d('0x1f')];var _0x305591=_0x1df89e?_0x55c1e5[_0xb83d('0x21')]:_0x4489d1[_0xb83d('0x1f')]+_0x4489d1[_0xb83d('0x22')];var _0x3a7556;if(_0x305591>=_0x1e2bbd){_0x305591=_0x1e2bbd;_0x3a7556=0xc8;}else{_0x3a7556=0xce;}_0x59df08['status'](_0x3a7556);return _0x59df08[_0xb83d('0x23')](_0xb83d('0x24'),_0x400df5+'-'+_0x305591+'/'+_0x1e2bbd)[_0xb83d('0x1e')](_0x55c1e5);}return null;};}function patchUpdates(_0x2cbda6){return function(_0xef63ba){try{jsonpatch[_0xb83d('0x25')](_0xef63ba,_0x2cbda6,!![]);}catch(_0x270895){return BPromise[_0xb83d('0x26')](_0x270895);}return _0xef63ba[_0xb83d('0x27')]();};}function saveUpdates(_0x55c3ee,_0x337180){return function(_0xe7e707){if(_0xe7e707){return _0xe7e707[_0xb83d('0x28')](_0x55c3ee)[_0xb83d('0x29')](function(_0x253e1d){return _0x253e1d;});}return null;};}function removeEntity(_0x5b93d6,_0x425c08){return function(_0x6a1b8){if(_0x6a1b8){return _0x6a1b8['destroy']()[_0xb83d('0x29')](function(){_0x5b93d6[_0xb83d('0x1c')](0xcc)[_0xb83d('0x1d')]();});}};}function handleEntityNotFound(_0x1a5507,_0x5e80f8){return function(_0x443223){if(!_0x443223){_0x1a5507[_0xb83d('0x1b')](0x194);}return _0x443223;};}function handleError(_0x35fdf4,_0x2d9630){_0x2d9630=_0x2d9630||0x1f4;return function(_0x5a2e0b){logger['error'](_0x5a2e0b[_0xb83d('0x2a')]);if(_0x5a2e0b[_0xb83d('0x2b')]){delete _0x5a2e0b['name'];}_0x35fdf4['status'](_0x2d9630)[_0xb83d('0x2c')](_0x5a2e0b);};}exports['index']=function(_0x5ab220,_0x3ad44f){var _0x1ef30f={},_0x21fa45={},_0xf8650a={'count':0x0,'rows':[]};var _0x4f3e87=_['map'](db[_0xb83d('0x2d')][_0xb83d('0x2e')],function(_0x57d01d){return{'name':_0x57d01d['fieldName'],'type':_0x57d01d[_0xb83d('0x2f')][_0xb83d('0x30')]};});_0x21fa45[_0xb83d('0x31')]=_[_0xb83d('0x32')](_0x4f3e87,_0xb83d('0x2b'));_0x21fa45[_0xb83d('0x33')]=_['keys'](_0x5ab220[_0xb83d('0x33')]);_0x21fa45[_0xb83d('0x34')]=_[_0xb83d('0x35')](_0x21fa45[_0xb83d('0x31')],_0x21fa45[_0xb83d('0x33')]);_0x1ef30f[_0xb83d('0x36')]=_[_0xb83d('0x35')](_0x21fa45[_0xb83d('0x31')],qs[_0xb83d('0x37')](_0x5ab220[_0xb83d('0x33')][_0xb83d('0x37')]));_0x1ef30f[_0xb83d('0x36')]=_0x1ef30f[_0xb83d('0x36')]['length']?_0x1ef30f[_0xb83d('0x36')]:_0x21fa45[_0xb83d('0x31')];if(!_0x5ab220['query'][_0xb83d('0x38')](_0xb83d('0x39'))){_0x1ef30f['limit']=qs[_0xb83d('0x22')](_0x5ab220[_0xb83d('0x33')][_0xb83d('0x22')]);_0x1ef30f['offset']=qs[_0xb83d('0x1f')](_0x5ab220['query'][_0xb83d('0x1f')]);}_0x1ef30f['order']=qs['sort'](_0x5ab220['query'][_0xb83d('0x3a')]);_0x1ef30f[_0xb83d('0x3b')]=qs[_0xb83d('0x34')](_[_0xb83d('0x3c')](_0x5ab220[_0xb83d('0x33')],_0x21fa45[_0xb83d('0x34')]),_0x4f3e87);if(_0x5ab220[_0xb83d('0x33')][_0xb83d('0x3d')]){_0x1ef30f[_0xb83d('0x3b')]=_[_0xb83d('0x3e')](_0x1ef30f['where'],{'$or':_[_0xb83d('0x32')](_0x4f3e87,function(_0x2c8aff){if(_0x2c8aff[_0xb83d('0x2f')]!=='VIRTUAL'){var _0x11d1f3={};_0x11d1f3[_0x2c8aff[_0xb83d('0x2b')]]={'$like':'%'+_0x5ab220[_0xb83d('0x33')][_0xb83d('0x3d')]+'%'};return _0x11d1f3;}})});}_0x1ef30f=_[_0xb83d('0x3e')]({},_0x1ef30f,_0x5ab220[_0xb83d('0x3f')]);var _0x90b8ca={'where':_0x1ef30f[_0xb83d('0x3b')]};return db['VtigerField'][_0xb83d('0x21')](_0x90b8ca)[_0xb83d('0x29')](function(_0x19dfdf){_0xf8650a[_0xb83d('0x21')]=_0x19dfdf;if(_0x5ab220[_0xb83d('0x33')][_0xb83d('0x40')]){_0x1ef30f[_0xb83d('0x41')]=[{'all':!![]}];}return db[_0xb83d('0x2d')][_0xb83d('0x42')](_0x1ef30f);})[_0xb83d('0x29')](function(_0x60db6a){_0xf8650a[_0xb83d('0x43')]=_0x60db6a;return _0xf8650a;})[_0xb83d('0x29')](respondWithFilteredResult(_0x3ad44f,_0x1ef30f))['catch'](handleError(_0x3ad44f,null));};exports['show']=function(_0x21c62f,_0x52ee8a){var _0x5851d5={'raw':!![],'where':{'id':_0x21c62f['params']['id']}},_0x16ec73={};_0x16ec73[_0xb83d('0x31')]=_[_0xb83d('0x44')](db[_0xb83d('0x2d')][_0xb83d('0x2e')]);_0x16ec73[_0xb83d('0x33')]=_['keys'](_0x21c62f[_0xb83d('0x33')]);_0x16ec73[_0xb83d('0x34')]=_['intersection'](_0x16ec73[_0xb83d('0x31')],_0x16ec73[_0xb83d('0x33')]);_0x5851d5[_0xb83d('0x36')]=_[_0xb83d('0x35')](_0x16ec73[_0xb83d('0x31')],qs[_0xb83d('0x37')](_0x21c62f[_0xb83d('0x33')][_0xb83d('0x37')]));_0x5851d5[_0xb83d('0x36')]=_0x5851d5[_0xb83d('0x36')][_0xb83d('0x45')]?_0x5851d5[_0xb83d('0x36')]:_0x16ec73[_0xb83d('0x31')];if(_0x21c62f[_0xb83d('0x33')][_0xb83d('0x40')]){_0x5851d5[_0xb83d('0x41')]=[{'all':!![]}];}_0x5851d5=_[_0xb83d('0x3e')]({},_0x5851d5,_0x21c62f[_0xb83d('0x3f')]);return db[_0xb83d('0x2d')][_0xb83d('0x46')](_0x5851d5)[_0xb83d('0x29')](handleEntityNotFound(_0x52ee8a,null))[_0xb83d('0x29')](respondWithResult(_0x52ee8a,null))[_0xb83d('0x47')](handleError(_0x52ee8a,null));};exports[_0xb83d('0x48')]=function(_0x4df647,_0x343b43){return db[_0xb83d('0x2d')][_0xb83d('0x48')](_0x4df647[_0xb83d('0x49')],{})['then'](respondWithResult(_0x343b43,0xc9))[_0xb83d('0x47')](handleError(_0x343b43,null));};exports[_0xb83d('0x28')]=function(_0x257ec4,_0x252aed){if(_0x257ec4[_0xb83d('0x49')]['id']){delete _0x257ec4[_0xb83d('0x49')]['id'];}return db[_0xb83d('0x2d')][_0xb83d('0x46')]({'where':{'id':_0x257ec4[_0xb83d('0x4a')]['id']}})[_0xb83d('0x29')](handleEntityNotFound(_0x252aed,null))[_0xb83d('0x29')](saveUpdates(_0x257ec4['body'],null))[_0xb83d('0x29')](respondWithResult(_0x252aed,null))[_0xb83d('0x47')](handleError(_0x252aed,null));};exports[_0xb83d('0x4b')]=function(_0x3332bb,_0x1fae2c){return db[_0xb83d('0x2d')]['find']({'where':{'id':_0x3332bb[_0xb83d('0x4a')]['id']}})['then'](handleEntityNotFound(_0x1fae2c,null))['then'](removeEntity(_0x1fae2c,null))[_0xb83d('0x47')](handleError(_0x1fae2c,null));}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.model.js b/server/api/intVtigerField/intVtigerField.model.js index 4b1caba..71c09ab 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 _0xf245=['../../config/logger','api','bluebird','request-promise','path','rimraf','./intVtigerField.attributes','define','VtigerField','int_vtiger_fields','vtiger_unique_index','idField','FieldId','lodash','util'];(function(_0x5cf67a,_0x5dfb36){var _0x311c9d=function(_0x4d0df0){while(--_0x4d0df0){_0x5cf67a['push'](_0x5cf67a['shift']());}};_0x311c9d(++_0x5dfb36);}(_0xf245,0x11b));var _0x5f24=function(_0x36d203,_0x3653f3){_0x36d203=_0x36d203-0x0;var _0x2f9e62=_0xf245[_0x36d203];return _0x2f9e62;};'use strict';var _=require(_0x5f24('0x0'));var util=require(_0x5f24('0x1'));var logger=require(_0x5f24('0x2'))(_0x5f24('0x3'));var moment=require('moment');var BPromise=require(_0x5f24('0x4'));var rp=require(_0x5f24('0x5'));var fs=require('fs');var path=require(_0x5f24('0x6'));var rimraf=require(_0x5f24('0x7'));var config=require('../../config/environment');var attributes=require(_0x5f24('0x8'));module['exports']=function(_0xbd4d6d,_0x4dbc71){return _0xbd4d6d[_0x5f24('0x9')](_0x5f24('0xa'),attributes,{'tableName':_0x5f24('0xb'),'paranoid':![],'indexes':[{'name':_0x5f24('0xc'),'fields':[_0x5f24('0xd'),_0x5f24('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x26bf=['./intVtigerField.attributes','define','VtigerField','idField','FieldId','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x26bf,0x101));var _0xf26b=function(_0x1256e1,_0x18af18){_0x1256e1=_0x1256e1-0x0;var _0x1132b4=_0x26bf[_0x1256e1];return _0x1132b4;};'use strict';var _=require(_0xf26b('0x0'));var util=require(_0xf26b('0x1'));var logger=require(_0xf26b('0x2'))(_0xf26b('0x3'));var moment=require(_0xf26b('0x4'));var BPromise=require(_0xf26b('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf26b('0x6'));var rimraf=require(_0xf26b('0x7'));var config=require(_0xf26b('0x8'));var attributes=require(_0xf26b('0x9'));module['exports']=function(_0x1a4868,_0x400253){return _0x1a4868[_0xf26b('0xa')](_0xf26b('0xb'),attributes,{'tableName':'int_vtiger_fields','paranoid':![],'indexes':[{'name':'vtiger_unique_index','fields':[_0xf26b('0xc'),_0xf26b('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 74f3d0e..2ded2f7 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 _0xfcb0=['VtigerField,\x20%s,\x20%s','info','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','then','debug','VtigerField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message'];(function(_0x3a0dbc,_0x52e9c2){var _0x2b9ea3=function(_0x50f199){while(--_0x50f199){_0x3a0dbc['push'](_0x3a0dbc['shift']());}};_0x2b9ea3(++_0x52e9c2);}(_0xfcb0,0x8e));var _0x0fcb=function(_0x4ae62a,_0x54efa3){_0x4ae62a=_0x4ae62a-0x0;var _0x2f2971=_0xfcb0[_0x4ae62a];return _0x2f2971;};'use strict';var _=require(_0x0fcb('0x0'));var util=require('util');var moment=require(_0x0fcb('0x1'));var BPromise=require(_0x0fcb('0x2'));var rs=require(_0x0fcb('0x3'));var fs=require('fs');var Redis=require(_0x0fcb('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x0fcb('0x5'));var logger=require(_0x0fcb('0x6'))(_0x0fcb('0x7'));var config=require(_0x0fcb('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x0fcb('0x9')][_0x0fcb('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x202ea3,_0x173a39,_0x16e73d){return new BPromise(function(_0x5ab863,_0x396e60){return client['request'](_0x202ea3,_0x16e73d)[_0x0fcb('0xb')](function(_0x3d2378){logger['info']('VtigerField,\x20%s,\x20%s',_0x173a39,'request\x20sent');logger[_0x0fcb('0xc')](_0x0fcb('0xd'),_0x173a39,_0x0fcb('0xe'),JSON[_0x0fcb('0xf')](_0x3d2378));if(_0x3d2378[_0x0fcb('0x10')]){if(_0x3d2378[_0x0fcb('0x10')][_0x0fcb('0x11')]===0x1f4){logger[_0x0fcb('0x10')]('VtigerField,\x20%s,\x20%s',_0x173a39,_0x3d2378['error'][_0x0fcb('0x12')]);return _0x396e60(_0x3d2378[_0x0fcb('0x10')][_0x0fcb('0x12')]);}logger['error'](_0x0fcb('0x13'),_0x173a39,_0x3d2378[_0x0fcb('0x10')]['message']);return _0x5ab863(_0x3d2378[_0x0fcb('0x10')][_0x0fcb('0x12')]);}else{logger[_0x0fcb('0x14')](_0x0fcb('0x13'),_0x173a39,_0x0fcb('0xe'));_0x5ab863(_0x3d2378[_0x0fcb('0x15')][_0x0fcb('0x12')]);}})[_0x0fcb('0x16')](function(_0x53021b){logger[_0x0fcb('0x10')](_0x0fcb('0x13'),_0x173a39,_0x53021b);_0x396e60(_0x53021b);});});} \ No newline at end of file +var _0xf958=['catch','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','info','VtigerField,\x20%s,\x20%s','request\x20sent','debug','VtigerField,\x20%s,\x20%s,\x20%s','stringify','error','message','result'];(function(_0x484156,_0x6fe8a2){var _0x23b64a=function(_0x235811){while(--_0x235811){_0x484156['push'](_0x484156['shift']());}};_0x23b64a(++_0x6fe8a2);}(_0xf958,0x1cf));var _0x8f95=function(_0x354bb1,_0x439ec3){_0x354bb1=_0x354bb1-0x0;var _0x39cddd=_0xf958[_0x354bb1];return _0x39cddd;};'use strict';var _=require(_0x8f95('0x0'));var util=require(_0x8f95('0x1'));var moment=require(_0x8f95('0x2'));var BPromise=require('bluebird');var rs=require(_0x8f95('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8f95('0x4'))['db'];var utils=require(_0x8f95('0x5'));var logger=require('../../config/logger')(_0x8f95('0x6'));var config=require(_0x8f95('0x7'));var jayson=require(_0x8f95('0x8'));var client=jayson[_0x8f95('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2a08f2,_0x5c9ab1,_0x10c77d){return new BPromise(function(_0x5b7861,_0x136254){return client[_0x8f95('0xa')](_0x2a08f2,_0x10c77d)['then'](function(_0x5209d3){logger[_0x8f95('0xb')](_0x8f95('0xc'),_0x5c9ab1,_0x8f95('0xd'));logger[_0x8f95('0xe')](_0x8f95('0xf'),_0x5c9ab1,_0x8f95('0xd'),JSON[_0x8f95('0x10')](_0x5209d3));if(_0x5209d3['error']){if(_0x5209d3[_0x8f95('0x11')]['code']===0x1f4){logger['error'](_0x8f95('0xc'),_0x5c9ab1,_0x5209d3[_0x8f95('0x11')][_0x8f95('0x12')]);return _0x136254(_0x5209d3[_0x8f95('0x11')][_0x8f95('0x12')]);}logger['error'](_0x8f95('0xc'),_0x5c9ab1,_0x5209d3[_0x8f95('0x11')][_0x8f95('0x12')]);return _0x5b7861(_0x5209d3[_0x8f95('0x11')][_0x8f95('0x12')]);}else{logger['info'](_0x8f95('0xc'),_0x5c9ab1,_0x8f95('0xd'));_0x5b7861(_0x5209d3[_0x8f95('0x13')]['message']);}})[_0x8f95('0x14')](function(_0x256da3){logger[_0x8f95('0x11')]('VtigerField,\x20%s,\x20%s',_0x5c9ab1,_0x256da3);_0x136254(_0x256da3);});});} \ No newline at end of file diff --git a/server/api/intZendeskAccount/index.js b/server/api/intZendeskAccount/index.js index 2a74f7a..39fab66 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 _0x5e01=['isAuthenticated','show','/:id/configurations','getConfigurations','post','addConfiguration','put','/:id','destroy','exports','multer','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskAccount.controller','get'];(function(_0x4ce315,_0x388074){var _0x1a6160=function(_0x510e0d){while(--_0x510e0d){_0x4ce315['push'](_0x4ce315['shift']());}};_0x1a6160(++_0x388074);}(_0x5e01,0x160));var _0x15e0=function(_0x51c819,_0xd812db){_0x51c819=_0x51c819-0x0;var _0x15c5d2=_0x5e01[_0x51c819];return _0x15c5d2;};'use strict';var multer=require(_0x15e0('0x0'));var util=require('util');var path=require(_0x15e0('0x1'));var timeout=require(_0x15e0('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x15e0('0x3'));var auth=require(_0x15e0('0x4'));var interaction=require(_0x15e0('0x5'));var config=require(_0x15e0('0x6'));var controller=require(_0x15e0('0x7'));router[_0x15e0('0x8')]('/',auth[_0x15e0('0x9')](),controller['index']);router[_0x15e0('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x15e0('0xa')]);router[_0x15e0('0x8')](_0x15e0('0xb'),auth[_0x15e0('0x9')](),controller[_0x15e0('0xc')]);router[_0x15e0('0x8')]('/:id/fields',auth[_0x15e0('0x9')](),controller['getFields']);router[_0x15e0('0xd')]('/',auth[_0x15e0('0x9')](),controller['create']);router[_0x15e0('0xd')](_0x15e0('0xb'),auth['isAuthenticated'](),controller[_0x15e0('0xe')]);router[_0x15e0('0xf')]('/:id',auth['isAuthenticated'](),controller['update']);router['delete'](_0x15e0('0x10'),auth[_0x15e0('0x9')](),controller[_0x15e0('0x11')]);module[_0x15e0('0x12')]=router; \ No newline at end of file +var _0x8390=['post','addConfiguration','put','/:id','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intZendeskAccount.controller','isAuthenticated','get','show','/:id/configurations','getConfigurations','/:id/fields','getFields'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x8390,0xf8));var _0x0839=function(_0xb24a3e,_0x4a3594){_0xb24a3e=_0xb24a3e-0x0;var _0x4038d7=_0x8390[_0xb24a3e];return _0x4038d7;};'use strict';var multer=require(_0x0839('0x0'));var util=require(_0x0839('0x1'));var path=require('path');var timeout=require(_0x0839('0x2'));var express=require(_0x0839('0x3'));var router=express[_0x0839('0x4')]();var fs_extra=require(_0x0839('0x5'));var auth=require(_0x0839('0x6'));var interaction=require(_0x0839('0x7'));var config=require('../../config/environment');var controller=require(_0x0839('0x8'));router['get']('/',auth[_0x0839('0x9')](),controller['index']);router[_0x0839('0xa')]('/:id',auth[_0x0839('0x9')](),controller[_0x0839('0xb')]);router[_0x0839('0xa')](_0x0839('0xc'),auth['isAuthenticated'](),controller[_0x0839('0xd')]);router[_0x0839('0xa')](_0x0839('0xe'),auth[_0x0839('0x9')](),controller[_0x0839('0xf')]);router[_0x0839('0x10')]('/',auth['isAuthenticated'](),controller['create']);router['post'](_0x0839('0xc'),auth['isAuthenticated'](),controller[_0x0839('0x11')]);router[_0x0839('0x12')](_0x0839('0x13'),auth['isAuthenticated'](),controller[_0x0839('0x14')]);router[_0x0839('0x15')](_0x0839('0x13'),auth[_0x0839('0x9')](),controller[_0x0839('0x16')]);module[_0x0839('0x17')]=router; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.attributes.js b/server/api/intZendeskAccount/intZendeskAccount.attributes.js index 3063220..8c99e37 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 _0x7c1a=['integrationTab','sequelize','exports','STRING','username','ENUM','token','password'];(function(_0x381379,_0x3f3b86){var _0x3e1063=function(_0x4c282d){while(--_0x4c282d){_0x381379['push'](_0x381379['shift']());}};_0x3e1063(++_0x3f3b86);}(_0x7c1a,0x159));var _0xa7c1=function(_0x3a8af0,_0xa738ca){_0x3a8af0=_0x3a8af0-0x0;var _0x4fa12a=_0x7c1a[_0x3a8af0];return _0x4fa12a;};'use strict';var Sequelize=require(_0xa7c1('0x0'));module[_0xa7c1('0x1')]={'name':{'type':Sequelize[_0xa7c1('0x2')]},'description':{'type':Sequelize[_0xa7c1('0x2')]},'username':{'type':Sequelize[_0xa7c1('0x2')],'unique':_0xa7c1('0x3')},'password':{'type':Sequelize['STRING']},'token':{'type':Sequelize[_0xa7c1('0x2')]},'remoteUri':{'type':Sequelize[_0xa7c1('0x2')],'unique':'remoteUri'},'authType':{'type':Sequelize[_0xa7c1('0x4')]('password',_0xa7c1('0x5')),'defaultValue':_0xa7c1('0x6')},'serverUrl':{'type':Sequelize[_0xa7c1('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xa7c1('0x4')]('integrationTab','newTab'),'defaultValue':_0xa7c1('0x7')}}; \ No newline at end of file +var _0x81c6=['remoteUri','ENUM','password','token','integrationTab','exports','username','STRING'];(function(_0x832a1f,_0x4be740){var _0x3e4b83=function(_0x3b90ff){while(--_0x3b90ff){_0x832a1f['push'](_0x832a1f['shift']());}};_0x3e4b83(++_0x4be740);}(_0x81c6,0x1d5));var _0x681c=function(_0x5caee2,_0x325a65){_0x5caee2=_0x5caee2-0x0;var _0x3f8747=_0x81c6[_0x5caee2];return _0x3f8747;};'use strict';var Sequelize=require('sequelize');module[_0x681c('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize['STRING'],'unique':_0x681c('0x1')},'password':{'type':Sequelize[_0x681c('0x2')]},'token':{'type':Sequelize[_0x681c('0x2')]},'remoteUri':{'type':Sequelize['STRING'],'unique':_0x681c('0x3')},'authType':{'type':Sequelize[_0x681c('0x4')](_0x681c('0x5'),_0x681c('0x6')),'defaultValue':'password'},'serverUrl':{'type':Sequelize[_0x681c('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x681c('0x4')]('integrationTab','newTab'),'defaultValue':_0x681c('0x7')}}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.controller.js b/server/api/intZendeskAccount/intZendeskAccount.controller.js index ea5f2a1..67816ab 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 _0x6f7a=['name','send','index','map','ZendeskAccount','rawAttributes','type','key','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','keys','find','create','body','update','getConfigurations','findOne','Subjects','getSubjects','channel','getDescriptions','ZendeskConfiguration','ZendeskField','Descriptions','getFields','slice','substring','lastIndexOf','GET','format','%s/%s','ticket_fields','authType','headers','Basic\x20%s','%s:%s','username','password','toString','base64','token','%s/token:%s','ValidationError','Unknown\x20authentication\x20type','description','group','includes','position','title','system_field_options','custom_field_options','statusCode','error','getFields,\x20%s,\x20%s,\x20%s','stringify','test','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','then'];(function(_0x2d7f0e,_0x3e6fbd){var _0x110b07=function(_0x557b00){while(--_0x557b00){_0x2d7f0e['push'](_0x2d7f0e['shift']());}};_0x110b07(++_0x3e6fbd);}(_0x6f7a,0x1ae));var _0xa6f7=function(_0xb9a554,_0x3ffcfa){_0xb9a554=_0xb9a554-0x0;var _0x3b2cc8=_0x6f7a[_0xb9a554];return _0x3b2cc8;};'use strict';var emlformat=require(_0xa6f7('0x0'));var rimraf=require(_0xa6f7('0x1'));var zipdir=require(_0xa6f7('0x2'));var jsonpatch=require(_0xa6f7('0x3'));var rp=require('request-promise');var moment=require(_0xa6f7('0x4'));var BPromise=require(_0xa6f7('0x5'));var Mustache=require(_0xa6f7('0x6'));var util=require(_0xa6f7('0x7'));var path=require(_0xa6f7('0x8'));var sox=require(_0xa6f7('0x9'));var csv=require(_0xa6f7('0xa'));var ejs=require(_0xa6f7('0xb'));var fs=require('fs');var fs_extra=require(_0xa6f7('0xc'));var _=require(_0xa6f7('0xd'));var squel=require(_0xa6f7('0xe'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xa6f7('0xf'));var toCsv=require(_0xa6f7('0xa'));var querystring=require(_0xa6f7('0x10'));var Papa=require(_0xa6f7('0x11'));var Redis=require(_0xa6f7('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xa6f7('0x13'));var hardwareService=require(_0xa6f7('0x14'));var logger=require('../../config/logger')(_0xa6f7('0x15'));var utils=require('../../config/utils');var config=require(_0xa6f7('0x16'));var licenseUtil=require(_0xa6f7('0x17'));var db=require(_0xa6f7('0x18'))['db'];var integrations=require(_0xa6f7('0x19'));function respondWithStatusCode(_0x5a3035,_0x3fc7f1){_0x3fc7f1=_0x3fc7f1||0xcc;return function(_0x532352){if(_0x532352){return _0x5a3035[_0xa6f7('0x1a')](_0x3fc7f1);}return _0x5a3035[_0xa6f7('0x1b')](_0x3fc7f1)[_0xa6f7('0x1c')]();};}function respondWithResult(_0x4d3d59,_0x34c02d){_0x34c02d=_0x34c02d||0xc8;return function(_0x491fae){if(_0x491fae){return _0x4d3d59[_0xa6f7('0x1b')](_0x34c02d)['json'](_0x491fae);}};}function respondWithFilteredResult(_0x17b814,_0x17f9c5){return function(_0x6efd38){if(_0x6efd38){var _0x47e664=typeof _0x17f9c5[_0xa6f7('0x1d')]===_0xa6f7('0x1e')&&typeof _0x17f9c5[_0xa6f7('0x1f')]===_0xa6f7('0x1e');var _0x5681d5=_0x6efd38['count'];var _0xba7755=_0x47e664?0x0:_0x17f9c5['offset'];var _0x378967=_0x47e664?_0x6efd38[_0xa6f7('0x20')]:_0x17f9c5['offset']+_0x17f9c5[_0xa6f7('0x1f')];var _0xb2cfaa;if(_0x378967>=_0x5681d5){_0x378967=_0x5681d5;_0xb2cfaa=0xc8;}else{_0xb2cfaa=0xce;}_0x17b814[_0xa6f7('0x1b')](_0xb2cfaa);return _0x17b814[_0xa6f7('0x21')](_0xa6f7('0x22'),_0xba7755+'-'+_0x378967+'/'+_0x5681d5)[_0xa6f7('0x23')](_0x6efd38);}return null;};}function patchUpdates(_0x4887ad){return function(_0x3c0c55){try{jsonpatch[_0xa6f7('0x24')](_0x3c0c55,_0x4887ad,!![]);}catch(_0x58b6a1){return BPromise['reject'](_0x58b6a1);}return _0x3c0c55['save']();};}function saveUpdates(_0x1de6c9,_0x119950){return function(_0x566b63){if(_0x566b63){return _0x566b63['update'](_0x1de6c9)['then'](function(_0x2b6a84){return _0x2b6a84;});}return null;};}function removeEntity(_0xc77e8e,_0x28263e){return function(_0x5baaa9){if(_0x5baaa9){return _0x5baaa9['destroy']()[_0xa6f7('0x25')](function(){_0xc77e8e['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x402d25,_0x5efdce){return function(_0x35847e){if(!_0x35847e){_0x402d25[_0xa6f7('0x1a')](0x194);}return _0x35847e;};}function handleError(_0x3c79ea,_0x2b4c6c){_0x2b4c6c=_0x2b4c6c||0x1f4;return function(_0x3a3508){logger['error'](_0x3a3508['stack']);if(_0x3a3508[_0xa6f7('0x26')]){delete _0x3a3508[_0xa6f7('0x26')];}_0x3c79ea['status'](_0x2b4c6c)[_0xa6f7('0x27')](_0x3a3508);};}exports[_0xa6f7('0x28')]=function(_0x87bccc,_0x3a7ff9){var _0x224f5a={},_0x10bf77={},_0x353de8={'count':0x0,'rows':[]};var _0x54f72c=_[_0xa6f7('0x29')](db[_0xa6f7('0x2a')][_0xa6f7('0x2b')],function(_0x278bad){return{'name':_0x278bad['fieldName'],'type':_0x278bad[_0xa6f7('0x2c')][_0xa6f7('0x2d')]};});_0x10bf77['model']=_[_0xa6f7('0x29')](_0x54f72c,_0xa6f7('0x26'));_0x10bf77['query']=_['keys'](_0x87bccc[_0xa6f7('0x2e')]);_0x10bf77[_0xa6f7('0x2f')]=_[_0xa6f7('0x30')](_0x10bf77[_0xa6f7('0x31')],_0x10bf77[_0xa6f7('0x2e')]);_0x224f5a['attributes']=_['intersection'](_0x10bf77[_0xa6f7('0x31')],qs['fields'](_0x87bccc[_0xa6f7('0x2e')][_0xa6f7('0x32')]));_0x224f5a[_0xa6f7('0x33')]=_0x224f5a[_0xa6f7('0x33')][_0xa6f7('0x34')]?_0x224f5a[_0xa6f7('0x33')]:_0x10bf77['model'];if(!_0x87bccc[_0xa6f7('0x2e')][_0xa6f7('0x35')](_0xa6f7('0x36'))){_0x224f5a['limit']=qs[_0xa6f7('0x1f')](_0x87bccc['query'][_0xa6f7('0x1f')]);_0x224f5a[_0xa6f7('0x1d')]=qs[_0xa6f7('0x1d')](_0x87bccc['query'][_0xa6f7('0x1d')]);}_0x224f5a[_0xa6f7('0x37')]=qs[_0xa6f7('0x38')](_0x87bccc[_0xa6f7('0x2e')][_0xa6f7('0x38')]);_0x224f5a[_0xa6f7('0x39')]=qs['filters'](_[_0xa6f7('0x3a')](_0x87bccc[_0xa6f7('0x2e')],_0x10bf77[_0xa6f7('0x2f')]),_0x54f72c);if(_0x87bccc[_0xa6f7('0x2e')][_0xa6f7('0x3b')]){_0x224f5a[_0xa6f7('0x39')]=_[_0xa6f7('0x3c')](_0x224f5a[_0xa6f7('0x39')],{'$or':_['map'](_0x54f72c,function(_0x1b5213){if(_0x1b5213[_0xa6f7('0x2c')]!==_0xa6f7('0x3d')){var _0x518088={};_0x518088[_0x1b5213[_0xa6f7('0x26')]]={'$like':'%'+_0x87bccc[_0xa6f7('0x2e')]['filter']+'%'};return _0x518088;}})});}_0x224f5a=_[_0xa6f7('0x3c')]({},_0x224f5a,_0x87bccc[_0xa6f7('0x3e')]);var _0x3ecb88={'where':_0x224f5a[_0xa6f7('0x39')]};return db[_0xa6f7('0x2a')]['count'](_0x3ecb88)[_0xa6f7('0x25')](function(_0x1ce691){_0x353de8[_0xa6f7('0x20')]=_0x1ce691;if(_0x87bccc[_0xa6f7('0x2e')][_0xa6f7('0x3f')]){_0x224f5a[_0xa6f7('0x40')]=[{'all':!![]}];}return db[_0xa6f7('0x2a')][_0xa6f7('0x41')](_0x224f5a);})['then'](function(_0x5ac005){_0x353de8[_0xa6f7('0x42')]=_0x5ac005;return _0x353de8;})[_0xa6f7('0x25')](respondWithFilteredResult(_0x3a7ff9,_0x224f5a))[_0xa6f7('0x43')](handleError(_0x3a7ff9,null));};exports[_0xa6f7('0x44')]=function(_0x2ac07f,_0x387714){var _0x21fdd7={'raw':![],'where':{'id':_0x2ac07f[_0xa6f7('0x45')]['id']}},_0x404552={};_0x404552[_0xa6f7('0x31')]=_['keys'](db[_0xa6f7('0x2a')][_0xa6f7('0x2b')]);_0x404552['query']=_[_0xa6f7('0x46')](_0x2ac07f[_0xa6f7('0x2e')]);_0x404552[_0xa6f7('0x2f')]=_[_0xa6f7('0x30')](_0x404552['model'],_0x404552[_0xa6f7('0x2e')]);_0x21fdd7['attributes']=_['intersection'](_0x404552[_0xa6f7('0x31')],qs[_0xa6f7('0x32')](_0x2ac07f[_0xa6f7('0x2e')][_0xa6f7('0x32')]));_0x21fdd7[_0xa6f7('0x33')]=_0x21fdd7[_0xa6f7('0x33')][_0xa6f7('0x34')]?_0x21fdd7['attributes']:_0x404552[_0xa6f7('0x31')];if(_0x2ac07f[_0xa6f7('0x2e')]['includeAll']){_0x21fdd7[_0xa6f7('0x40')]=[{'all':!![]}];}_0x21fdd7=_[_0xa6f7('0x3c')]({},_0x21fdd7,_0x2ac07f[_0xa6f7('0x3e')]);return db['ZendeskAccount'][_0xa6f7('0x47')](_0x21fdd7)['then'](handleEntityNotFound(_0x387714,null))[_0xa6f7('0x25')](respondWithResult(_0x387714,null))[_0xa6f7('0x43')](handleError(_0x387714,null));};exports[_0xa6f7('0x48')]=function(_0x5f3c84,_0x5df564){return db[_0xa6f7('0x2a')]['create'](_0x5f3c84[_0xa6f7('0x49')],{})['then'](respondWithResult(_0x5df564,0xc9))['catch'](handleError(_0x5df564,null));};exports[_0xa6f7('0x4a')]=function(_0x2e3a04,_0x350071){if(_0x2e3a04[_0xa6f7('0x49')]['id']){delete _0x2e3a04[_0xa6f7('0x49')]['id'];}return db[_0xa6f7('0x2a')]['find']({'where':{'id':_0x2e3a04[_0xa6f7('0x45')]['id']}})[_0xa6f7('0x25')](handleEntityNotFound(_0x350071,null))['then'](saveUpdates(_0x2e3a04[_0xa6f7('0x49')],null))['then'](respondWithResult(_0x350071,null))[_0xa6f7('0x43')](handleError(_0x350071,null));};exports['destroy']=function(_0x488efc,_0x60eacc){return db[_0xa6f7('0x2a')][_0xa6f7('0x47')]({'where':{'id':_0x488efc[_0xa6f7('0x45')]['id']}})[_0xa6f7('0x25')](handleEntityNotFound(_0x60eacc,null))['then'](removeEntity(_0x60eacc,null))[_0xa6f7('0x43')](handleError(_0x60eacc,null));};exports[_0xa6f7('0x4b')]=function(_0x5cddc9,_0x4b83f6,_0x5991f9){var _0x1d7bcd={};var _0x1c2099={};var _0x134dd7;var _0x55369a;return db[_0xa6f7('0x2a')]['findOne']({'where':{'id':_0x5cddc9[_0xa6f7('0x45')]['id']}})[_0xa6f7('0x25')](handleEntityNotFound(_0x4b83f6,null))[_0xa6f7('0x25')](function(_0x1dcb45){if(_0x1dcb45){_0x134dd7=_0x1dcb45;_0x1c2099[_0xa6f7('0x31')]=_['keys'](db['ZendeskConfiguration'][_0xa6f7('0x2b')]);_0x1c2099[_0xa6f7('0x2e')]=_[_0xa6f7('0x46')](_0x5cddc9[_0xa6f7('0x2e')]);_0x1c2099['filters']=_[_0xa6f7('0x30')](_0x1c2099[_0xa6f7('0x31')],_0x1c2099[_0xa6f7('0x2e')]);_0x1d7bcd[_0xa6f7('0x33')]=_[_0xa6f7('0x30')](_0x1c2099[_0xa6f7('0x31')],qs['fields'](_0x5cddc9[_0xa6f7('0x2e')][_0xa6f7('0x32')]));_0x1d7bcd[_0xa6f7('0x33')]=_0x1d7bcd['attributes'][_0xa6f7('0x34')]?_0x1d7bcd[_0xa6f7('0x33')]:_0x1c2099[_0xa6f7('0x31')];_0x1d7bcd[_0xa6f7('0x37')]=qs['sort'](_0x5cddc9['query'][_0xa6f7('0x38')]);_0x1d7bcd[_0xa6f7('0x39')]=qs[_0xa6f7('0x2f')](_[_0xa6f7('0x3a')](_0x5cddc9[_0xa6f7('0x2e')],_0x1c2099[_0xa6f7('0x2f')]));if(_0x5cddc9[_0xa6f7('0x2e')]['filter']){_0x1d7bcd[_0xa6f7('0x39')]=_[_0xa6f7('0x3c')](_0x1d7bcd[_0xa6f7('0x39')],{'$or':_[_0xa6f7('0x29')](_0x1d7bcd[_0xa6f7('0x33')],function(_0x11fba9){var _0xa52de0={};_0xa52de0[_0x11fba9]={'$like':'%'+_0x5cddc9[_0xa6f7('0x2e')][_0xa6f7('0x3b')]+'%'};return _0xa52de0;})});}_0x1d7bcd=_[_0xa6f7('0x3c')]({},_0x1d7bcd,_0x5cddc9[_0xa6f7('0x3e')]);return _0x134dd7['getConfigurations'](_0x1d7bcd);}})[_0xa6f7('0x25')](function(_0x55c5ce){if(_0x55c5ce){_0x55369a=_0x55c5ce[_0xa6f7('0x34')];if(!_0x5cddc9['query'][_0xa6f7('0x35')](_0xa6f7('0x36'))){_0x1d7bcd['limit']=qs[_0xa6f7('0x1f')](_0x5cddc9[_0xa6f7('0x2e')][_0xa6f7('0x1f')]);_0x1d7bcd['offset']=qs[_0xa6f7('0x1d')](_0x5cddc9['query'][_0xa6f7('0x1d')]);}return _0x134dd7[_0xa6f7('0x4b')](_0x1d7bcd);}})['then'](function(_0xd8a485){if(_0xd8a485){return _0xd8a485?{'count':_0x55369a,'rows':_0xd8a485}:null;}})['then'](respondWithResult(_0x4b83f6,null))[_0xa6f7('0x43')](handleError(_0x4b83f6,null));};exports['addConfiguration']=function(_0x14f28e,_0x341dd6,_0x2bf525){if(_0x14f28e[_0xa6f7('0x49')]['id']){delete _0x14f28e[_0xa6f7('0x49')]['id'];}return db[_0xa6f7('0x2a')][_0xa6f7('0x4c')]({'where':{'id':_0x14f28e[_0xa6f7('0x45')]['id']}})[_0xa6f7('0x25')](handleEntityNotFound(_0x341dd6,null))[_0xa6f7('0x25')](function(_0x110ea5){if(_0x110ea5){_0x14f28e[_0xa6f7('0x49')]['AccountId']=_0x110ea5['id'];_0x14f28e[_0xa6f7('0x49')][_0xa6f7('0x4d')]=integrations[_0xa6f7('0x4e')](_0x14f28e[_0xa6f7('0x49')][_0xa6f7('0x4f')],_0x14f28e[_0xa6f7('0x49')][_0xa6f7('0x2c')]);_0x14f28e[_0xa6f7('0x49')]['Descriptions']=integrations[_0xa6f7('0x50')](_0x14f28e[_0xa6f7('0x49')][_0xa6f7('0x4f')],_0x14f28e['body'][_0xa6f7('0x2c')]);return db[_0xa6f7('0x51')][_0xa6f7('0x48')](_0x14f28e[_0xa6f7('0x49')],{'include':[{'model':db[_0xa6f7('0x52')],'as':_0xa6f7('0x4d')},{'model':db[_0xa6f7('0x52')],'as':_0xa6f7('0x53')}]});}return null;})['then'](respondWithResult(_0x341dd6,null))['catch'](handleError(_0x341dd6,null));};exports[_0xa6f7('0x54')]=function(_0x326feb,_0x5e6d94,_0x3aa759){var _0x18ff29='';return db[_0xa6f7('0x2a')]['findOne']({'where':{'id':_0x326feb[_0xa6f7('0x45')]['id']},'attributes':['id','username','password','token','authType','remoteUri']})[_0xa6f7('0x25')](handleEntityNotFound(_0x5e6d94,null))[_0xa6f7('0x25')](function(_0x41dc51){if(_0x41dc51){_0x18ff29=_0x41dc51['remoteUri'];var _0x849412=_0x18ff29[_0xa6f7('0x55')](-0x1);if(_0x849412==='/'){_0x18ff29=_0x18ff29[_0xa6f7('0x56')](0x0,_0x18ff29[_0xa6f7('0x57')](_0x849412));}var _0x740cb5={'method':_0xa6f7('0x58'),'uri':util[_0xa6f7('0x59')](_0xa6f7('0x5a'),_0x18ff29,_0xa6f7('0x5b')),'json':!![]};switch(_0x41dc51[_0xa6f7('0x5c')]){case'password':_0x740cb5[_0xa6f7('0x5d')]={'Authorization':util[_0xa6f7('0x59')](_0xa6f7('0x5e'),new Buffer(util[_0xa6f7('0x59')](_0xa6f7('0x5f'),_0x41dc51[_0xa6f7('0x60')],_0x41dc51[_0xa6f7('0x61')]))[_0xa6f7('0x62')](_0xa6f7('0x63')))};break;case _0xa6f7('0x64'):_0x740cb5[_0xa6f7('0x5d')]={'Authorization':util['format']('Basic\x20%s',new Buffer(util[_0xa6f7('0x59')](_0xa6f7('0x65'),_0x41dc51[_0xa6f7('0x60')],_0x41dc51['token']))[_0xa6f7('0x62')](_0xa6f7('0x63')))};break;default:throw new db['Sequelize'][(_0xa6f7('0x66'))](_0xa6f7('0x67'));}return rp(_0x740cb5);}})['then'](function(_0x52dcd9){if(_0x52dcd9){var _0xadf749=['subject',_0xa6f7('0x68'),_0xa6f7('0x69'),'assignee'];_['remove'](_0x52dcd9[_0xa6f7('0x5b')],function(_0x1da89a){return _0xadf749[_0xa6f7('0x6a')](_0x1da89a['type']);});return{'count':_0x52dcd9[_0xa6f7('0x5b')][_0xa6f7('0x34')],'rows':_[_0xa6f7('0x29')](_0x52dcd9[_0xa6f7('0x5b')],function(_0x70d8c3){return{'id':_0x70d8c3['id'],'name':_0x70d8c3[_0xa6f7('0x6b')]>0x7?_0x70d8c3[_0xa6f7('0x6c')]:_0x70d8c3[_0xa6f7('0x2c')],'custom':_0x70d8c3[_0xa6f7('0x6b')]>0x7?!![]:![],'options':_0x70d8c3[_0xa6f7('0x6d')]?_0x70d8c3[_0xa6f7('0x6d')]:_0x70d8c3['custom_field_options']?_0x70d8c3[_0xa6f7('0x6e')]:[]};})};}})[_0xa6f7('0x25')](respondWithResult(_0x5e6d94,null))[_0xa6f7('0x43')](function(_0x1f3f99){var _0x46e6c4=_0x326feb[_0xa6f7('0x2e')]['test']?0x1f4:_0x1f3f99[_0xa6f7('0x6f')]||0x1f4;logger[_0xa6f7('0x70')](_0xa6f7('0x71'),_0xa6f7('0x54'),_0x46e6c4,JSON[_0xa6f7('0x72')](_0x1f3f99));delete _0x1f3f99[_0xa6f7('0x26')];if(_0x46e6c4===0x191){_0x46e6c4=0x190;}_0x5e6d94['status'](_0x46e6c4)['send'](_0x326feb[_0xa6f7('0x2e')][_0xa6f7('0x73')]?{'message':_0xa6f7('0x74'),'statusCode':_0x1f3f99[_0xa6f7('0x6f')]}:_0x1f3f99);});}; \ No newline at end of file +var _0xa571=['lastIndexOf','GET','format','%s/%s','ticket_fields','headers','%s:%s','password','toString','base64','Basic\x20%s','Sequelize','ValidationError','Unknown\x20authentication\x20type','subject','description','assignee','remove','includes','position','title','system_field_options','custom_field_options','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','path','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','../../components/integrations/configuration','sendStatus','end','status','json','offset','undefined','limit','count','Content-Range','reject','save','update','then','destroy','name','send','map','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','options','ZendeskAccount','includeAll','include','findAll','rows','catch','show','params','find','create','body','findOne','ZendeskConfiguration','order','merge','getConfigurations','addConfiguration','AccountId','Subjects','getSubjects','getDescriptions','channel','ZendeskField','Descriptions','getFields','username','token','authType','remoteUri','slice','substring'];(function(_0x87b0ff,_0x314389){var _0x3bc0b2=function(_0x41682b){while(--_0x41682b){_0x87b0ff['push'](_0x87b0ff['shift']());}};_0x3bc0b2(++_0x314389);}(_0xa571,0x107));var _0x1a57=function(_0x36373f,_0x4d2435){_0x36373f=_0x36373f-0x0;var _0x429356=_0xa571[_0x36373f];return _0x429356;};'use strict';var emlformat=require(_0x1a57('0x0'));var rimraf=require(_0x1a57('0x1'));var zipdir=require(_0x1a57('0x2'));var jsonpatch=require(_0x1a57('0x3'));var rp=require('request-promise');var moment=require(_0x1a57('0x4'));var BPromise=require(_0x1a57('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x1a57('0x6'));var sox=require('sox');var csv=require(_0x1a57('0x7'));var ejs=require(_0x1a57('0x8'));var fs=require('fs');var fs_extra=require(_0x1a57('0x9'));var _=require(_0x1a57('0xa'));var squel=require(_0x1a57('0xb'));var crypto=require(_0x1a57('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x1a57('0xd'));var toCsv=require(_0x1a57('0x7'));var querystring=require(_0x1a57('0xe'));var Papa=require('papaparse');var Redis=require(_0x1a57('0xf'));var authService=require(_0x1a57('0x10'));var qs=require(_0x1a57('0x11'));var as=require(_0x1a57('0x12'));var hardwareService=require(_0x1a57('0x13'));var logger=require(_0x1a57('0x14'))(_0x1a57('0x15'));var utils=require(_0x1a57('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x1a57('0x17'))['db'];var integrations=require(_0x1a57('0x18'));function respondWithStatusCode(_0x202d9a,_0x5ae643){_0x5ae643=_0x5ae643||0xcc;return function(_0x3de36a){if(_0x3de36a){return _0x202d9a[_0x1a57('0x19')](_0x5ae643);}return _0x202d9a['status'](_0x5ae643)[_0x1a57('0x1a')]();};}function respondWithResult(_0x587422,_0xd08107){_0xd08107=_0xd08107||0xc8;return function(_0x17434c){if(_0x17434c){return _0x587422[_0x1a57('0x1b')](_0xd08107)[_0x1a57('0x1c')](_0x17434c);}};}function respondWithFilteredResult(_0x5802d6,_0x20f7ad){return function(_0x53c61f){if(_0x53c61f){var _0x49ee05=typeof _0x20f7ad[_0x1a57('0x1d')]===_0x1a57('0x1e')&&typeof _0x20f7ad[_0x1a57('0x1f')]==='undefined';var _0x10793e=_0x53c61f[_0x1a57('0x20')];var _0x80f8c1=_0x49ee05?0x0:_0x20f7ad['offset'];var _0x3daa66=_0x49ee05?_0x53c61f[_0x1a57('0x20')]:_0x20f7ad[_0x1a57('0x1d')]+_0x20f7ad[_0x1a57('0x1f')];var _0xe936dd;if(_0x3daa66>=_0x10793e){_0x3daa66=_0x10793e;_0xe936dd=0xc8;}else{_0xe936dd=0xce;}_0x5802d6['status'](_0xe936dd);return _0x5802d6['set'](_0x1a57('0x21'),_0x80f8c1+'-'+_0x3daa66+'/'+_0x10793e)[_0x1a57('0x1c')](_0x53c61f);}return null;};}function patchUpdates(_0x211c63){return function(_0x4d3e05){try{jsonpatch['apply'](_0x4d3e05,_0x211c63,!![]);}catch(_0x51e271){return BPromise[_0x1a57('0x22')](_0x51e271);}return _0x4d3e05[_0x1a57('0x23')]();};}function saveUpdates(_0x3f52b9,_0xee133b){return function(_0x277d06){if(_0x277d06){return _0x277d06[_0x1a57('0x24')](_0x3f52b9)[_0x1a57('0x25')](function(_0x2f8b00){return _0x2f8b00;});}return null;};}function removeEntity(_0x183ca3,_0x35d5dc){return function(_0x29e7cd){if(_0x29e7cd){return _0x29e7cd[_0x1a57('0x26')]()[_0x1a57('0x25')](function(){_0x183ca3[_0x1a57('0x1b')](0xcc)[_0x1a57('0x1a')]();});}};}function handleEntityNotFound(_0x182649,_0x25c1e9){return function(_0x267302){if(!_0x267302){_0x182649[_0x1a57('0x19')](0x194);}return _0x267302;};}function handleError(_0xf6ffef,_0x26584b){_0x26584b=_0x26584b||0x1f4;return function(_0x1dd939){logger['error'](_0x1dd939['stack']);if(_0x1dd939[_0x1a57('0x27')]){delete _0x1dd939[_0x1a57('0x27')];}_0xf6ffef['status'](_0x26584b)[_0x1a57('0x28')](_0x1dd939);};}exports['index']=function(_0x2d8738,_0x4a2901){var _0x53bf6e={},_0x8179a4={},_0x274fe6={'count':0x0,'rows':[]};var _0x30527c=_[_0x1a57('0x29')](db['ZendeskAccount'][_0x1a57('0x2a')],function(_0x396832){return{'name':_0x396832[_0x1a57('0x2b')],'type':_0x396832[_0x1a57('0x2c')]['key']};});_0x8179a4[_0x1a57('0x2d')]=_[_0x1a57('0x29')](_0x30527c,_0x1a57('0x27'));_0x8179a4[_0x1a57('0x2e')]=_[_0x1a57('0x2f')](_0x2d8738[_0x1a57('0x2e')]);_0x8179a4[_0x1a57('0x30')]=_[_0x1a57('0x31')](_0x8179a4[_0x1a57('0x2d')],_0x8179a4['query']);_0x53bf6e[_0x1a57('0x32')]=_[_0x1a57('0x31')](_0x8179a4['model'],qs['fields'](_0x2d8738[_0x1a57('0x2e')][_0x1a57('0x33')]));_0x53bf6e[_0x1a57('0x32')]=_0x53bf6e[_0x1a57('0x32')][_0x1a57('0x34')]?_0x53bf6e[_0x1a57('0x32')]:_0x8179a4[_0x1a57('0x2d')];if(!_0x2d8738[_0x1a57('0x2e')][_0x1a57('0x35')](_0x1a57('0x36'))){_0x53bf6e[_0x1a57('0x1f')]=qs[_0x1a57('0x1f')](_0x2d8738[_0x1a57('0x2e')][_0x1a57('0x1f')]);_0x53bf6e[_0x1a57('0x1d')]=qs[_0x1a57('0x1d')](_0x2d8738[_0x1a57('0x2e')][_0x1a57('0x1d')]);}_0x53bf6e['order']=qs[_0x1a57('0x37')](_0x2d8738[_0x1a57('0x2e')][_0x1a57('0x37')]);_0x53bf6e[_0x1a57('0x38')]=qs[_0x1a57('0x30')](_[_0x1a57('0x39')](_0x2d8738[_0x1a57('0x2e')],_0x8179a4[_0x1a57('0x30')]),_0x30527c);if(_0x2d8738[_0x1a57('0x2e')]['filter']){_0x53bf6e['where']=_['merge'](_0x53bf6e['where'],{'$or':_[_0x1a57('0x29')](_0x30527c,function(_0x14d619){if(_0x14d619[_0x1a57('0x2c')]!=='VIRTUAL'){var _0x364797={};_0x364797[_0x14d619[_0x1a57('0x27')]]={'$like':'%'+_0x2d8738[_0x1a57('0x2e')][_0x1a57('0x3a')]+'%'};return _0x364797;}})});}_0x53bf6e=_['merge']({},_0x53bf6e,_0x2d8738[_0x1a57('0x3b')]);var _0x5e79f0={'where':_0x53bf6e[_0x1a57('0x38')]};return db[_0x1a57('0x3c')][_0x1a57('0x20')](_0x5e79f0)['then'](function(_0x1848cc){_0x274fe6[_0x1a57('0x20')]=_0x1848cc;if(_0x2d8738[_0x1a57('0x2e')][_0x1a57('0x3d')]){_0x53bf6e[_0x1a57('0x3e')]=[{'all':!![]}];}return db['ZendeskAccount'][_0x1a57('0x3f')](_0x53bf6e);})['then'](function(_0x4ba6b3){_0x274fe6[_0x1a57('0x40')]=_0x4ba6b3;return _0x274fe6;})['then'](respondWithFilteredResult(_0x4a2901,_0x53bf6e))[_0x1a57('0x41')](handleError(_0x4a2901,null));};exports[_0x1a57('0x42')]=function(_0x3fbae1,_0x59abb1){var _0x188a50={'raw':![],'where':{'id':_0x3fbae1[_0x1a57('0x43')]['id']}},_0x3c7ea8={};_0x3c7ea8[_0x1a57('0x2d')]=_['keys'](db[_0x1a57('0x3c')][_0x1a57('0x2a')]);_0x3c7ea8['query']=_[_0x1a57('0x2f')](_0x3fbae1['query']);_0x3c7ea8['filters']=_[_0x1a57('0x31')](_0x3c7ea8[_0x1a57('0x2d')],_0x3c7ea8[_0x1a57('0x2e')]);_0x188a50[_0x1a57('0x32')]=_['intersection'](_0x3c7ea8[_0x1a57('0x2d')],qs[_0x1a57('0x33')](_0x3fbae1[_0x1a57('0x2e')][_0x1a57('0x33')]));_0x188a50[_0x1a57('0x32')]=_0x188a50['attributes'][_0x1a57('0x34')]?_0x188a50[_0x1a57('0x32')]:_0x3c7ea8[_0x1a57('0x2d')];if(_0x3fbae1[_0x1a57('0x2e')]['includeAll']){_0x188a50[_0x1a57('0x3e')]=[{'all':!![]}];}_0x188a50=_['merge']({},_0x188a50,_0x3fbae1[_0x1a57('0x3b')]);return db[_0x1a57('0x3c')][_0x1a57('0x44')](_0x188a50)[_0x1a57('0x25')](handleEntityNotFound(_0x59abb1,null))[_0x1a57('0x25')](respondWithResult(_0x59abb1,null))[_0x1a57('0x41')](handleError(_0x59abb1,null));};exports[_0x1a57('0x45')]=function(_0x401285,_0x29fe1f){return db[_0x1a57('0x3c')][_0x1a57('0x45')](_0x401285[_0x1a57('0x46')],{})[_0x1a57('0x25')](respondWithResult(_0x29fe1f,0xc9))['catch'](handleError(_0x29fe1f,null));};exports[_0x1a57('0x24')]=function(_0x480aff,_0x3bf103){if(_0x480aff[_0x1a57('0x46')]['id']){delete _0x480aff[_0x1a57('0x46')]['id'];}return db[_0x1a57('0x3c')][_0x1a57('0x44')]({'where':{'id':_0x480aff[_0x1a57('0x43')]['id']}})[_0x1a57('0x25')](handleEntityNotFound(_0x3bf103,null))[_0x1a57('0x25')](saveUpdates(_0x480aff[_0x1a57('0x46')],null))['then'](respondWithResult(_0x3bf103,null))[_0x1a57('0x41')](handleError(_0x3bf103,null));};exports[_0x1a57('0x26')]=function(_0x51651d,_0x15f1f5){return db[_0x1a57('0x3c')]['find']({'where':{'id':_0x51651d[_0x1a57('0x43')]['id']}})[_0x1a57('0x25')](handleEntityNotFound(_0x15f1f5,null))['then'](removeEntity(_0x15f1f5,null))['catch'](handleError(_0x15f1f5,null));};exports['getConfigurations']=function(_0x2c1bac,_0x41465b,_0x509c4f){var _0x1ec79c={};var _0x18267c={};var _0x572202;var _0x5e510e;return db['ZendeskAccount'][_0x1a57('0x47')]({'where':{'id':_0x2c1bac[_0x1a57('0x43')]['id']}})[_0x1a57('0x25')](handleEntityNotFound(_0x41465b,null))[_0x1a57('0x25')](function(_0x28738e){if(_0x28738e){_0x572202=_0x28738e;_0x18267c[_0x1a57('0x2d')]=_[_0x1a57('0x2f')](db[_0x1a57('0x48')]['rawAttributes']);_0x18267c['query']=_['keys'](_0x2c1bac['query']);_0x18267c['filters']=_[_0x1a57('0x31')](_0x18267c[_0x1a57('0x2d')],_0x18267c[_0x1a57('0x2e')]);_0x1ec79c[_0x1a57('0x32')]=_[_0x1a57('0x31')](_0x18267c[_0x1a57('0x2d')],qs[_0x1a57('0x33')](_0x2c1bac[_0x1a57('0x2e')]['fields']));_0x1ec79c['attributes']=_0x1ec79c['attributes'][_0x1a57('0x34')]?_0x1ec79c['attributes']:_0x18267c[_0x1a57('0x2d')];_0x1ec79c[_0x1a57('0x49')]=qs[_0x1a57('0x37')](_0x2c1bac[_0x1a57('0x2e')][_0x1a57('0x37')]);_0x1ec79c[_0x1a57('0x38')]=qs[_0x1a57('0x30')](_['pick'](_0x2c1bac['query'],_0x18267c['filters']));if(_0x2c1bac[_0x1a57('0x2e')][_0x1a57('0x3a')]){_0x1ec79c[_0x1a57('0x38')]=_[_0x1a57('0x4a')](_0x1ec79c[_0x1a57('0x38')],{'$or':_[_0x1a57('0x29')](_0x1ec79c[_0x1a57('0x32')],function(_0x4ab246){var _0x5b691c={};_0x5b691c[_0x4ab246]={'$like':'%'+_0x2c1bac[_0x1a57('0x2e')][_0x1a57('0x3a')]+'%'};return _0x5b691c;})});}_0x1ec79c=_[_0x1a57('0x4a')]({},_0x1ec79c,_0x2c1bac[_0x1a57('0x3b')]);return _0x572202[_0x1a57('0x4b')](_0x1ec79c);}})[_0x1a57('0x25')](function(_0x59a731){if(_0x59a731){_0x5e510e=_0x59a731['length'];if(!_0x2c1bac[_0x1a57('0x2e')][_0x1a57('0x35')]('nolimit')){_0x1ec79c['limit']=qs[_0x1a57('0x1f')](_0x2c1bac[_0x1a57('0x2e')][_0x1a57('0x1f')]);_0x1ec79c[_0x1a57('0x1d')]=qs[_0x1a57('0x1d')](_0x2c1bac[_0x1a57('0x2e')][_0x1a57('0x1d')]);}return _0x572202['getConfigurations'](_0x1ec79c);}})['then'](function(_0x2fbf49){if(_0x2fbf49){return _0x2fbf49?{'count':_0x5e510e,'rows':_0x2fbf49}:null;}})[_0x1a57('0x25')](respondWithResult(_0x41465b,null))[_0x1a57('0x41')](handleError(_0x41465b,null));};exports[_0x1a57('0x4c')]=function(_0x5d92dc,_0x33092d,_0x28354c){if(_0x5d92dc[_0x1a57('0x46')]['id']){delete _0x5d92dc[_0x1a57('0x46')]['id'];}return db[_0x1a57('0x3c')]['findOne']({'where':{'id':_0x5d92dc['params']['id']}})['then'](handleEntityNotFound(_0x33092d,null))[_0x1a57('0x25')](function(_0x223ba5){if(_0x223ba5){_0x5d92dc[_0x1a57('0x46')][_0x1a57('0x4d')]=_0x223ba5['id'];_0x5d92dc[_0x1a57('0x46')][_0x1a57('0x4e')]=integrations[_0x1a57('0x4f')](_0x5d92dc[_0x1a57('0x46')]['channel'],_0x5d92dc[_0x1a57('0x46')][_0x1a57('0x2c')]);_0x5d92dc['body']['Descriptions']=integrations[_0x1a57('0x50')](_0x5d92dc['body'][_0x1a57('0x51')],_0x5d92dc[_0x1a57('0x46')][_0x1a57('0x2c')]);return db[_0x1a57('0x48')][_0x1a57('0x45')](_0x5d92dc[_0x1a57('0x46')],{'include':[{'model':db[_0x1a57('0x52')],'as':_0x1a57('0x4e')},{'model':db['ZendeskField'],'as':_0x1a57('0x53')}]});}return null;})[_0x1a57('0x25')](respondWithResult(_0x33092d,null))['catch'](handleError(_0x33092d,null));};exports[_0x1a57('0x54')]=function(_0x392f49,_0x20b0d5,_0x570674){var _0x5c3eb8='';return db[_0x1a57('0x3c')][_0x1a57('0x47')]({'where':{'id':_0x392f49[_0x1a57('0x43')]['id']},'attributes':['id',_0x1a57('0x55'),'password',_0x1a57('0x56'),_0x1a57('0x57'),_0x1a57('0x58')]})[_0x1a57('0x25')](handleEntityNotFound(_0x20b0d5,null))[_0x1a57('0x25')](function(_0x58d8cc){if(_0x58d8cc){_0x5c3eb8=_0x58d8cc[_0x1a57('0x58')];var _0x393187=_0x5c3eb8[_0x1a57('0x59')](-0x1);if(_0x393187==='/'){_0x5c3eb8=_0x5c3eb8[_0x1a57('0x5a')](0x0,_0x5c3eb8[_0x1a57('0x5b')](_0x393187));}var _0x69f3fb={'method':_0x1a57('0x5c'),'uri':util[_0x1a57('0x5d')](_0x1a57('0x5e'),_0x5c3eb8,_0x1a57('0x5f')),'json':!![]};switch(_0x58d8cc[_0x1a57('0x57')]){case'password':_0x69f3fb[_0x1a57('0x60')]={'Authorization':util[_0x1a57('0x5d')]('Basic\x20%s',new Buffer(util[_0x1a57('0x5d')](_0x1a57('0x61'),_0x58d8cc['username'],_0x58d8cc[_0x1a57('0x62')]))[_0x1a57('0x63')](_0x1a57('0x64')))};break;case _0x1a57('0x56'):_0x69f3fb[_0x1a57('0x60')]={'Authorization':util[_0x1a57('0x5d')](_0x1a57('0x65'),new Buffer(util[_0x1a57('0x5d')]('%s/token:%s',_0x58d8cc[_0x1a57('0x55')],_0x58d8cc[_0x1a57('0x56')]))['toString'](_0x1a57('0x64')))};break;default:throw new db[(_0x1a57('0x66'))][(_0x1a57('0x67'))](_0x1a57('0x68'));}return rp(_0x69f3fb);}})[_0x1a57('0x25')](function(_0xf2b1c5){if(_0xf2b1c5){var _0x220725=[_0x1a57('0x69'),_0x1a57('0x6a'),'group',_0x1a57('0x6b')];_[_0x1a57('0x6c')](_0xf2b1c5[_0x1a57('0x5f')],function(_0x1e4d4e){return _0x220725[_0x1a57('0x6d')](_0x1e4d4e['type']);});return{'count':_0xf2b1c5[_0x1a57('0x5f')][_0x1a57('0x34')],'rows':_[_0x1a57('0x29')](_0xf2b1c5[_0x1a57('0x5f')],function(_0x33f8da){return{'id':_0x33f8da['id'],'name':_0x33f8da[_0x1a57('0x6e')]>0x7?_0x33f8da[_0x1a57('0x6f')]:_0x33f8da[_0x1a57('0x2c')],'custom':_0x33f8da['position']>0x7?!![]:![],'options':_0x33f8da[_0x1a57('0x70')]?_0x33f8da[_0x1a57('0x70')]:_0x33f8da[_0x1a57('0x71')]?_0x33f8da[_0x1a57('0x71')]:[]};})};}})['then'](respondWithResult(_0x20b0d5,null))['catch'](function(_0x49f809){var _0x57cd92=_0x392f49['query'][_0x1a57('0x72')]?0x1f4:_0x49f809[_0x1a57('0x73')]||0x1f4;logger['error'](_0x1a57('0x74'),_0x1a57('0x54'),_0x57cd92,JSON['stringify'](_0x49f809));delete _0x49f809[_0x1a57('0x27')];if(_0x57cd92===0x191){_0x57cd92=0x190;}_0x20b0d5[_0x1a57('0x1b')](_0x57cd92)[_0x1a57('0x28')](_0x392f49[_0x1a57('0x2e')]['test']?{'message':_0x1a57('0x75'),'statusCode':_0x49f809[_0x1a57('0x73')]}:_0x49f809);});}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.model.js b/server/api/intZendeskAccount/intZendeskAccount.model.js index ae4d5aa..d501f98 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 _0x3c4d=['request-promise','path','rimraf','./intZendeskAccount.attributes','../../components/integrations/configuration','exports','ZendeskAccount','int_zendesk_accounts','lodash','util','../../config/logger','api','moment'];(function(_0xf7f765,_0x10c49a){var _0x587bdb=function(_0x182440){while(--_0x182440){_0xf7f765['push'](_0xf7f765['shift']());}};_0x587bdb(++_0x10c49a);}(_0x3c4d,0x1c2));var _0xd3c4=function(_0x238364,_0x505402){_0x238364=_0x238364-0x0;var _0x3a43a6=_0x3c4d[_0x238364];return _0x3a43a6;};'use strict';var _=require(_0xd3c4('0x0'));var util=require(_0xd3c4('0x1'));var logger=require(_0xd3c4('0x2'))(_0xd3c4('0x3'));var moment=require(_0xd3c4('0x4'));var BPromise=require('bluebird');var rp=require(_0xd3c4('0x5'));var fs=require('fs');var path=require(_0xd3c4('0x6'));var rimraf=require(_0xd3c4('0x7'));var config=require('../../config/environment');var attributes=require(_0xd3c4('0x8'));var integrations=require(_0xd3c4('0x9'));module[_0xd3c4('0xa')]=function(_0x313070,_0x51c069){return _0x313070['define'](_0xd3c4('0xb'),attributes,{'tableName':_0xd3c4('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x66c9=['api','moment','bluebird','request-promise','../../components/integrations/configuration','exports','ZendeskAccount','lodash','util','../../config/logger'];(function(_0x138cec,_0x3cf8c9){var _0x1515f0=function(_0x3dbab0){while(--_0x3dbab0){_0x138cec['push'](_0x138cec['shift']());}};_0x1515f0(++_0x3cf8c9);}(_0x66c9,0x1dd));var _0x966c=function(_0x376ac1,_0x510e23){_0x376ac1=_0x376ac1-0x0;var _0x14cb27=_0x66c9[_0x376ac1];return _0x14cb27;};'use strict';var _=require(_0x966c('0x0'));var util=require(_0x966c('0x1'));var logger=require(_0x966c('0x2'))(_0x966c('0x3'));var moment=require(_0x966c('0x4'));var BPromise=require(_0x966c('0x5'));var rp=require(_0x966c('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./intZendeskAccount.attributes');var integrations=require(_0x966c('0x7'));module[_0x966c('0x8')]=function(_0x1090b0,_0x588722){return _0x1090b0['define'](_0x966c('0x9'),attributes,{'tableName':'int_zendesk_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.rpc.js b/server/api/intZendeskAccount/intZendeskAccount.rpc.js index 448ee53..707c27d 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 _0xdaf0=['client','http','request','then','info','ZendeskAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','GetZendeskAccount','ZendeskAccount','findAll','options','where','limit','include','map','model','attributes','ShowZendeskAccount','raw','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x29aefc,_0x4dcf53){var _0x11be36=function(_0x3d472a){while(--_0x3d472a){_0x29aefc['push'](_0x29aefc['shift']());}};_0x11be36(++_0x4dcf53);}(_0xdaf0,0xb2));var _0x0daf=function(_0x82096d,_0x2f846a){_0x82096d=_0x82096d-0x0;var _0x270dec=_0xdaf0[_0x82096d];return _0x270dec;};'use strict';var _=require(_0x0daf('0x0'));var util=require(_0x0daf('0x1'));var moment=require(_0x0daf('0x2'));var BPromise=require(_0x0daf('0x3'));var rs=require(_0x0daf('0x4'));var fs=require('fs');var Redis=require(_0x0daf('0x5'));var db=require(_0x0daf('0x6'))['db'];var utils=require(_0x0daf('0x7'));var logger=require(_0x0daf('0x8'))(_0x0daf('0x9'));var config=require(_0x0daf('0xa'));var jayson=require(_0x0daf('0xb'));var client=jayson[_0x0daf('0xc')][_0x0daf('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x2a2594,_0x29e8ef,_0x33c0e0){return new BPromise(function(_0x3fc5e4,_0x2415b4){return client[_0x0daf('0xe')](_0x2a2594,_0x33c0e0)[_0x0daf('0xf')](function(_0xd2229f){logger[_0x0daf('0x10')](_0x0daf('0x11'),_0x29e8ef,_0x0daf('0x12'));logger[_0x0daf('0x13')]('ZendeskAccount,\x20%s,\x20%s,\x20%s',_0x29e8ef,_0x0daf('0x12'),JSON[_0x0daf('0x14')](_0xd2229f));if(_0xd2229f[_0x0daf('0x15')]){if(_0xd2229f['error'][_0x0daf('0x16')]===0x1f4){logger[_0x0daf('0x15')]('ZendeskAccount,\x20%s,\x20%s',_0x29e8ef,_0xd2229f[_0x0daf('0x15')][_0x0daf('0x17')]);return _0x2415b4(_0xd2229f[_0x0daf('0x15')]['message']);}logger[_0x0daf('0x15')](_0x0daf('0x11'),_0x29e8ef,_0xd2229f[_0x0daf('0x15')][_0x0daf('0x17')]);return _0x3fc5e4(_0xd2229f[_0x0daf('0x15')][_0x0daf('0x17')]);}else{logger[_0x0daf('0x10')]('ZendeskAccount,\x20%s,\x20%s',_0x29e8ef,_0x0daf('0x12'));_0x3fc5e4(_0xd2229f[_0x0daf('0x18')][_0x0daf('0x17')]);}})[_0x0daf('0x19')](function(_0x2a8a2d){logger[_0x0daf('0x15')](_0x0daf('0x11'),_0x29e8ef,_0x2a8a2d);_0x2415b4(_0x2a8a2d);});});}exports[_0x0daf('0x1a')]=function(_0x46948a){var _0x453741=this;return new Promise(function(_0xe9058b,_0x511af6){return db[_0x0daf('0x1b')][_0x0daf('0x1c')]({'raw':_0x46948a[_0x0daf('0x1d')]?_0x46948a[_0x0daf('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0x46948a[_0x0daf('0x1d')]?_0x46948a['options'][_0x0daf('0x1e')]||null:null,'attributes':_0x46948a[_0x0daf('0x1d')]?_0x46948a[_0x0daf('0x1d')]['attributes']||null:null,'limit':_0x46948a[_0x0daf('0x1d')]?_0x46948a[_0x0daf('0x1d')][_0x0daf('0x1f')]||null:null,'include':_0x46948a[_0x0daf('0x1d')]?_0x46948a[_0x0daf('0x1d')][_0x0daf('0x20')]?_[_0x0daf('0x21')](_0x46948a['options']['include'],function(_0x4c1175){return{'model':db[_0x4c1175[_0x0daf('0x22')]],'as':_0x4c1175['as'],'attributes':_0x4c1175[_0x0daf('0x23')],'include':_0x4c1175[_0x0daf('0x20')]?_[_0x0daf('0x21')](_0x4c1175['include'],function(_0x3e0952){return{'model':db[_0x3e0952[_0x0daf('0x22')]],'as':_0x3e0952['as'],'attributes':_0x3e0952[_0x0daf('0x23')],'include':_0x3e0952[_0x0daf('0x20')]?_[_0x0daf('0x21')](_0x3e0952[_0x0daf('0x20')],function(_0x4ace38){return{'model':db[_0x4ace38[_0x0daf('0x22')]],'as':_0x4ace38['as'],'attributes':_0x4ace38['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x3b9278){logger[_0x0daf('0x10')]('GetZendeskAccount',_0x46948a);logger[_0x0daf('0x13')]('GetZendeskAccount',_0x46948a,JSON[_0x0daf('0x14')](_0x3b9278));_0xe9058b(_0x3b9278);})[_0x0daf('0x19')](function(_0x433c2d){logger[_0x0daf('0x15')](_0x0daf('0x1a'),_0x433c2d['message'],_0x46948a);_0x511af6(_0x453741[_0x0daf('0x15')](0x1f4,_0x433c2d[_0x0daf('0x17')]));});});};exports[_0x0daf('0x24')]=function(_0x46ef29){var _0x230d91=this;return new Promise(function(_0x2d2486,_0xa09db2){return db['ZendeskAccount']['find']({'raw':_0x46ef29[_0x0daf('0x1d')]?_0x46ef29[_0x0daf('0x1d')][_0x0daf('0x25')]===undefined?!![]:![]:!![],'where':_0x46ef29[_0x0daf('0x1d')]?_0x46ef29[_0x0daf('0x1d')][_0x0daf('0x1e')]||null:null,'attributes':_0x46ef29[_0x0daf('0x1d')]?_0x46ef29['options'][_0x0daf('0x23')]||null:null,'include':_0x46ef29[_0x0daf('0x1d')]?_0x46ef29[_0x0daf('0x1d')][_0x0daf('0x20')]?_['map'](_0x46ef29[_0x0daf('0x1d')][_0x0daf('0x20')],function(_0x317004){return{'model':db[_0x317004[_0x0daf('0x22')]],'as':_0x317004['as'],'attributes':_0x317004[_0x0daf('0x23')],'include':_0x317004[_0x0daf('0x20')]?_[_0x0daf('0x21')](_0x317004[_0x0daf('0x20')],function(_0x1fad47){return{'model':db[_0x1fad47['model']],'as':_0x1fad47['as'],'attributes':_0x1fad47[_0x0daf('0x23')],'include':_0x1fad47[_0x0daf('0x20')]?_[_0x0daf('0x21')](_0x1fad47[_0x0daf('0x20')],function(_0x2ddc89){return{'model':db[_0x2ddc89['model']],'as':_0x2ddc89['as'],'attributes':_0x2ddc89[_0x0daf('0x23')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x383ce1){logger['info'](_0x0daf('0x24'),_0x46ef29);logger[_0x0daf('0x13')]('ShowZendeskAccount',_0x46ef29,JSON[_0x0daf('0x14')](_0x383ce1));_0x2d2486(_0x383ce1);})['catch'](function(_0x38bd2a){logger['error'](_0x0daf('0x24'),_0x38bd2a[_0x0daf('0x17')],_0x46ef29);_0xa09db2(_0x230d91[_0x0daf('0x15')](0x1f4,_0x38bd2a['message']));});});}; \ No newline at end of file +var _0xbd08=['findAll','options','raw','where','attributes','map','include','model','GetZendeskAccount','ShowZendeskAccount','find','lodash','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','then','info','request\x20sent','debug','ZendeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','ZendeskAccount,\x20%s,\x20%s','catch','ZendeskAccount'];(function(_0x1b3564,_0x16c919){var _0x504069=function(_0x9322b6){while(--_0x9322b6){_0x1b3564['push'](_0x1b3564['shift']());}};_0x504069(++_0x16c919);}(_0xbd08,0x6e));var _0x8bd0=function(_0x476bf4,_0x2a3755){_0x476bf4=_0x476bf4-0x0;var _0x788ffe=_0xbd08[_0x476bf4];return _0x788ffe;};'use strict';var _=require(_0x8bd0('0x0'));var util=require('util');var moment=require(_0x8bd0('0x1'));var BPromise=require('bluebird');var rs=require(_0x8bd0('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8bd0('0x3'))['db'];var utils=require(_0x8bd0('0x4'));var logger=require(_0x8bd0('0x5'))('rpc');var config=require(_0x8bd0('0x6'));var jayson=require(_0x8bd0('0x7'));var client=jayson['client'][_0x8bd0('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4660f8,_0x248781,_0x32cf5a){return new BPromise(function(_0x202c95,_0x31baa3){return client[_0x8bd0('0x9')](_0x4660f8,_0x32cf5a)[_0x8bd0('0xa')](function(_0xf1838b){logger[_0x8bd0('0xb')]('ZendeskAccount,\x20%s,\x20%s',_0x248781,_0x8bd0('0xc'));logger[_0x8bd0('0xd')](_0x8bd0('0xe'),_0x248781,'request\x20sent',JSON[_0x8bd0('0xf')](_0xf1838b));if(_0xf1838b[_0x8bd0('0x10')]){if(_0xf1838b[_0x8bd0('0x10')][_0x8bd0('0x11')]===0x1f4){logger['error']('ZendeskAccount,\x20%s,\x20%s',_0x248781,_0xf1838b[_0x8bd0('0x10')][_0x8bd0('0x12')]);return _0x31baa3(_0xf1838b[_0x8bd0('0x10')]['message']);}logger[_0x8bd0('0x10')](_0x8bd0('0x13'),_0x248781,_0xf1838b[_0x8bd0('0x10')]['message']);return _0x202c95(_0xf1838b[_0x8bd0('0x10')][_0x8bd0('0x12')]);}else{logger[_0x8bd0('0xb')]('ZendeskAccount,\x20%s,\x20%s',_0x248781,_0x8bd0('0xc'));_0x202c95(_0xf1838b['result']['message']);}})[_0x8bd0('0x14')](function(_0x44ff58){logger['error']('ZendeskAccount,\x20%s,\x20%s',_0x248781,_0x44ff58);_0x31baa3(_0x44ff58);});});}exports['GetZendeskAccount']=function(_0x241283){var _0x4b2cbc=this;return new Promise(function(_0x349e66,_0x3031fa){return db[_0x8bd0('0x15')][_0x8bd0('0x16')]({'raw':_0x241283[_0x8bd0('0x17')]?_0x241283[_0x8bd0('0x17')][_0x8bd0('0x18')]===undefined?!![]:![]:!![],'where':_0x241283['options']?_0x241283['options'][_0x8bd0('0x19')]||null:null,'attributes':_0x241283[_0x8bd0('0x17')]?_0x241283['options'][_0x8bd0('0x1a')]||null:null,'limit':_0x241283['options']?_0x241283[_0x8bd0('0x17')]['limit']||null:null,'include':_0x241283['options']?_0x241283[_0x8bd0('0x17')]['include']?_[_0x8bd0('0x1b')](_0x241283[_0x8bd0('0x17')][_0x8bd0('0x1c')],function(_0x28644a){return{'model':db[_0x28644a[_0x8bd0('0x1d')]],'as':_0x28644a['as'],'attributes':_0x28644a[_0x8bd0('0x1a')],'include':_0x28644a[_0x8bd0('0x1c')]?_[_0x8bd0('0x1b')](_0x28644a[_0x8bd0('0x1c')],function(_0x358e20){return{'model':db[_0x358e20[_0x8bd0('0x1d')]],'as':_0x358e20['as'],'attributes':_0x358e20[_0x8bd0('0x1a')],'include':_0x358e20[_0x8bd0('0x1c')]?_[_0x8bd0('0x1b')](_0x358e20[_0x8bd0('0x1c')],function(_0x5ca626){return{'model':db[_0x5ca626['model']],'as':_0x5ca626['as'],'attributes':_0x5ca626[_0x8bd0('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x8bd0('0xa')](function(_0x6d107c){logger['info'](_0x8bd0('0x1e'),_0x241283);logger[_0x8bd0('0xd')](_0x8bd0('0x1e'),_0x241283,JSON[_0x8bd0('0xf')](_0x6d107c));_0x349e66(_0x6d107c);})[_0x8bd0('0x14')](function(_0xd4b3f8){logger[_0x8bd0('0x10')](_0x8bd0('0x1e'),_0xd4b3f8['message'],_0x241283);_0x3031fa(_0x4b2cbc[_0x8bd0('0x10')](0x1f4,_0xd4b3f8[_0x8bd0('0x12')]));});});};exports[_0x8bd0('0x1f')]=function(_0x586b55){var _0x44feb5=this;return new Promise(function(_0x3ff3dd,_0x2ff0ad){return db['ZendeskAccount'][_0x8bd0('0x20')]({'raw':_0x586b55[_0x8bd0('0x17')]?_0x586b55['options'][_0x8bd0('0x18')]===undefined?!![]:![]:!![],'where':_0x586b55['options']?_0x586b55[_0x8bd0('0x17')]['where']||null:null,'attributes':_0x586b55[_0x8bd0('0x17')]?_0x586b55['options'][_0x8bd0('0x1a')]||null:null,'include':_0x586b55[_0x8bd0('0x17')]?_0x586b55[_0x8bd0('0x17')][_0x8bd0('0x1c')]?_[_0x8bd0('0x1b')](_0x586b55[_0x8bd0('0x17')][_0x8bd0('0x1c')],function(_0x3a2eac){return{'model':db[_0x3a2eac[_0x8bd0('0x1d')]],'as':_0x3a2eac['as'],'attributes':_0x3a2eac[_0x8bd0('0x1a')],'include':_0x3a2eac[_0x8bd0('0x1c')]?_['map'](_0x3a2eac['include'],function(_0x243eb6){return{'model':db[_0x243eb6[_0x8bd0('0x1d')]],'as':_0x243eb6['as'],'attributes':_0x243eb6['attributes'],'include':_0x243eb6[_0x8bd0('0x1c')]?_['map'](_0x243eb6['include'],function(_0x1af8e1){return{'model':db[_0x1af8e1[_0x8bd0('0x1d')]],'as':_0x1af8e1['as'],'attributes':_0x1af8e1[_0x8bd0('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4a73a5){logger['info'](_0x8bd0('0x1f'),_0x586b55);logger[_0x8bd0('0xd')](_0x8bd0('0x1f'),_0x586b55,JSON[_0x8bd0('0xf')](_0x4a73a5));_0x3ff3dd(_0x4a73a5);})[_0x8bd0('0x14')](function(_0x1d4a49){logger[_0x8bd0('0x10')](_0x8bd0('0x1f'),_0x1d4a49['message'],_0x586b55);_0x2ff0ad(_0x44feb5[_0x8bd0('0x10')](0x1f4,_0x1d4a49[_0x8bd0('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/index.js b/server/api/intZendeskConfiguration/index.js index b72ae3b..03915e2 100644 --- a/server/api/intZendeskConfiguration/index.js +++ b/server/api/intZendeskConfiguration/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0713=['/:id/subjects','getSubjects','getDescriptions','/:id/tags','post','setTags','update','delete','destroy','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./intZendeskConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields'];(function(_0x4e6ffc,_0xe2e373){var _0x2ba7ac=function(_0xa02f18){while(--_0xa02f18){_0x4e6ffc['push'](_0x4e6ffc['shift']());}};_0x2ba7ac(++_0xe2e373);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3071('0x0'));var timeout=require(_0x3071('0x1'));var express=require(_0x3071('0x2'));var router=express[_0x3071('0x3')]();var fs_extra=require(_0x3071('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));var controller=require(_0x3071('0x7'));router[_0x3071('0x8')]('/',auth[_0x3071('0x9')](),controller[_0x3071('0xa')]);router[_0x3071('0x8')](_0x3071('0xb'),auth[_0x3071('0x9')](),controller[_0x3071('0xc')]);router[_0x3071('0x8')](_0x3071('0xd'),auth[_0x3071('0x9')](),controller['getFields']);router[_0x3071('0x8')](_0x3071('0xe'),auth[_0x3071('0x9')](),controller[_0x3071('0xf')]);router[_0x3071('0x8')]('/:id/descriptions',auth[_0x3071('0x9')](),controller[_0x3071('0x10')]);router[_0x3071('0x8')](_0x3071('0x11'),auth[_0x3071('0x9')](),controller['getTags']);router['post']('/',auth[_0x3071('0x9')](),controller['create']);router[_0x3071('0x12')](_0x3071('0x11'),auth['isAuthenticated'](),controller[_0x3071('0x13')]);router['put'](_0x3071('0xb'),auth[_0x3071('0x9')](),controller[_0x3071('0x14')]);router[_0x3071('0x15')](_0x3071('0xb'),auth[_0x3071('0x9')](),controller[_0x3071('0x16')]);module[_0x3071('0x17')]=router; \ No newline at end of file +var _0x0bb5=['put','delete','destroy','exports','multer','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskConfiguration.controller','get','/:id','isAuthenticated','show','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','getTags','create','post','setTags'];(function(_0x12a50e,_0x169b19){var _0xb09760=function(_0x6ea973){while(--_0x6ea973){_0x12a50e['push'](_0x12a50e['shift']());}};_0xb09760(++_0x169b19);}(_0x0bb5,0x148));var _0x50bb=function(_0x132b41,_0x22d192){_0x132b41=_0x132b41-0x0;var _0x4a21e7=_0x0bb5[_0x132b41];return _0x4a21e7;};'use strict';var multer=require(_0x50bb('0x0'));var util=require(_0x50bb('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x50bb('0x2'));var router=express[_0x50bb('0x3')]();var fs_extra=require(_0x50bb('0x4'));var auth=require(_0x50bb('0x5'));var interaction=require(_0x50bb('0x6'));var config=require(_0x50bb('0x7'));var controller=require(_0x50bb('0x8'));router[_0x50bb('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x50bb('0x9')](_0x50bb('0xa'),auth[_0x50bb('0xb')](),controller[_0x50bb('0xc')]);router['get']('/:id/fields',auth[_0x50bb('0xb')](),controller[_0x50bb('0xd')]);router[_0x50bb('0x9')](_0x50bb('0xe'),auth['isAuthenticated'](),controller[_0x50bb('0xf')]);router[_0x50bb('0x9')](_0x50bb('0x10'),auth[_0x50bb('0xb')](),controller[_0x50bb('0x11')]);router[_0x50bb('0x9')](_0x50bb('0x12'),auth['isAuthenticated'](),controller[_0x50bb('0x13')]);router['post']('/',auth[_0x50bb('0xb')](),controller[_0x50bb('0x14')]);router[_0x50bb('0x15')]('/:id/tags',auth[_0x50bb('0xb')](),controller[_0x50bb('0x16')]);router[_0x50bb('0x17')]('/:id',auth[_0x50bb('0xb')](),controller['update']);router[_0x50bb('0x18')](_0x50bb('0xa'),auth[_0x50bb('0xb')](),controller[_0x50bb('0x19')]);module[_0x50bb('0x1a')]=router; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js index f4e9efe..1d484ed 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 _0xc059=['STRING','exports'];(function(_0x47b58b,_0x41a189){var _0x46bebe=function(_0x22bbfa){while(--_0x22bbfa){_0x47b58b['push'](_0x47b58b['shift']());}};_0x46bebe(++_0x41a189);}(_0xc059,0xbb));var _0x9c05=function(_0x5eb6e6,_0x17f551){_0x5eb6e6=_0x5eb6e6-0x0;var _0x35c38b=_0xc059[_0x5eb6e6];return _0x35c38b;};'use strict';var Sequelize=require('sequelize');module[_0x9c05('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x9c05('0x1')]}}; \ No newline at end of file +var _0x2d47=['sequelize','exports','STRING'];(function(_0x985a99,_0x2c2b4e){var _0xd3eea4=function(_0x2e9276){while(--_0x2e9276){_0x985a99['push'](_0x985a99['shift']());}};_0xd3eea4(++_0x2c2b4e);}(_0x2d47,0x132));var _0x72d4=function(_0x33a7fc,_0xe092e2){_0x33a7fc=_0x33a7fc-0x0;var _0xdedfa3=_0x2d47[_0x33a7fc];return _0xdedfa3;};'use strict';var Sequelize=require(_0x72d4('0x0'));module[_0x72d4('0x1')]={'name':{'type':Sequelize[_0x72d4('0x2')]},'description':{'type':Sequelize[_0x72d4('0x2')]}}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js index d131c5d..6abbf37 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 _0x1740=['../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','reject','destroy','then','end','error','stack','name','index','map','ZendeskConfiguration','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','options','include','findAll','rows','catch','params','includeAll','find','create','body','getFields','ZendeskField','hasOwnProperty','getSubjects','findOne','getDescriptions','getTags','Tag','setTags','ids','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs'];(function(_0x52960b,_0x1f3321){var _0x520ed8=function(_0x542aa1){while(--_0x542aa1){_0x52960b['push'](_0x52960b['shift']());}};_0x520ed8(++_0x1f3321);}(_0x1740,0x18a));var _0x0174=function(_0xe659cb,_0x104ce2){_0xe659cb=_0xe659cb-0x0;var _0x5ddc1d=_0x1740[_0xe659cb];return _0x5ddc1d;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0174('0x0'));var zipdir=require(_0x0174('0x1'));var jsonpatch=require(_0x0174('0x2'));var rp=require(_0x0174('0x3'));var moment=require(_0x0174('0x4'));var BPromise=require(_0x0174('0x5'));var Mustache=require(_0x0174('0x6'));var util=require('util');var path=require(_0x0174('0x7'));var sox=require(_0x0174('0x8'));var csv=require(_0x0174('0x9'));var ejs=require(_0x0174('0xa'));var fs=require('fs');var fs_extra=require(_0x0174('0xb'));var _=require('lodash');var squel=require(_0x0174('0xc'));var crypto=require(_0x0174('0xd'));var jsforce=require(_0x0174('0xe'));var deskjs=require(_0x0174('0xf'));var toCsv=require(_0x0174('0x9'));var querystring=require(_0x0174('0x10'));var Papa=require(_0x0174('0x11'));var Redis=require(_0x0174('0x12'));var authService=require(_0x0174('0x13'));var qs=require(_0x0174('0x14'));var as=require(_0x0174('0x15'));var hardwareService=require(_0x0174('0x16'));var logger=require('../../config/logger')(_0x0174('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x0174('0x18'));var db=require(_0x0174('0x19'))['db'];function respondWithStatusCode(_0x4d5590,_0x30213c){_0x30213c=_0x30213c||0xcc;return function(_0x13c991){if(_0x13c991){return _0x4d5590[_0x0174('0x1a')](_0x30213c);}return _0x4d5590[_0x0174('0x1b')](_0x30213c)['end']();};}function respondWithResult(_0x3dd5ed,_0x3b1013){_0x3b1013=_0x3b1013||0xc8;return function(_0x4640ba){if(_0x4640ba){return _0x3dd5ed['status'](_0x3b1013)[_0x0174('0x1c')](_0x4640ba);}};}function respondWithFilteredResult(_0x10fc10,_0x18dac7){return function(_0x17a303){if(_0x17a303){var _0x177e0d=typeof _0x18dac7['offset']===_0x0174('0x1d')&&typeof _0x18dac7[_0x0174('0x1e')]===_0x0174('0x1d');var _0x287140=_0x17a303[_0x0174('0x1f')];var _0x54897c=_0x177e0d?0x0:_0x18dac7[_0x0174('0x20')];var _0x401417=_0x177e0d?_0x17a303[_0x0174('0x1f')]:_0x18dac7['offset']+_0x18dac7[_0x0174('0x1e')];var _0xfa9913;if(_0x401417>=_0x287140){_0x401417=_0x287140;_0xfa9913=0xc8;}else{_0xfa9913=0xce;}_0x10fc10['status'](_0xfa9913);return _0x10fc10[_0x0174('0x21')](_0x0174('0x22'),_0x54897c+'-'+_0x401417+'/'+_0x287140)['json'](_0x17a303);}return null;};}function patchUpdates(_0x5cfe81){return function(_0x510b11){try{jsonpatch['apply'](_0x510b11,_0x5cfe81,!![]);}catch(_0x37e2ac){return BPromise[_0x0174('0x23')](_0x37e2ac);}return _0x510b11['save']();};}function saveUpdates(_0x4d430f,_0x568777){return function(_0x4488ed){if(_0x4488ed){return _0x4488ed['update'](_0x4d430f)['then'](function(_0x5b7b0d){return _0x5b7b0d;});}return null;};}function removeEntity(_0xeb04a1,_0x39fba6){return function(_0x89af08){if(_0x89af08){return _0x89af08[_0x0174('0x24')]()[_0x0174('0x25')](function(){_0xeb04a1[_0x0174('0x1b')](0xcc)[_0x0174('0x26')]();});}};}function handleEntityNotFound(_0x3084e2,_0x5c2122){return function(_0x43b2ba){if(!_0x43b2ba){_0x3084e2[_0x0174('0x1a')](0x194);}return _0x43b2ba;};}function handleError(_0x45e599,_0x5f024f){_0x5f024f=_0x5f024f||0x1f4;return function(_0x1403fe){logger[_0x0174('0x27')](_0x1403fe[_0x0174('0x28')]);if(_0x1403fe[_0x0174('0x29')]){delete _0x1403fe['name'];}_0x45e599[_0x0174('0x1b')](_0x5f024f)['send'](_0x1403fe);};}exports[_0x0174('0x2a')]=function(_0x4da1b2,_0x1ce56b){var _0x32d97c={},_0x4c7a2d={},_0x18f541={'count':0x0,'rows':[]};var _0x255b97=_[_0x0174('0x2b')](db[_0x0174('0x2c')][_0x0174('0x2d')],function(_0x1984b9){return{'name':_0x1984b9['fieldName'],'type':_0x1984b9[_0x0174('0x2e')][_0x0174('0x2f')]};});_0x4c7a2d[_0x0174('0x30')]=_[_0x0174('0x2b')](_0x255b97,_0x0174('0x29'));_0x4c7a2d[_0x0174('0x31')]=_[_0x0174('0x32')](_0x4da1b2['query']);_0x4c7a2d[_0x0174('0x33')]=_[_0x0174('0x34')](_0x4c7a2d['model'],_0x4c7a2d[_0x0174('0x31')]);_0x32d97c[_0x0174('0x35')]=_[_0x0174('0x34')](_0x4c7a2d['model'],qs[_0x0174('0x36')](_0x4da1b2[_0x0174('0x31')][_0x0174('0x36')]));_0x32d97c[_0x0174('0x35')]=_0x32d97c[_0x0174('0x35')][_0x0174('0x37')]?_0x32d97c[_0x0174('0x35')]:_0x4c7a2d[_0x0174('0x30')];if(!_0x4da1b2[_0x0174('0x31')]['hasOwnProperty'](_0x0174('0x38'))){_0x32d97c['limit']=qs['limit'](_0x4da1b2[_0x0174('0x31')][_0x0174('0x1e')]);_0x32d97c[_0x0174('0x20')]=qs[_0x0174('0x20')](_0x4da1b2['query'][_0x0174('0x20')]);}_0x32d97c[_0x0174('0x39')]=qs[_0x0174('0x3a')](_0x4da1b2['query']['sort']);_0x32d97c[_0x0174('0x3b')]=qs[_0x0174('0x33')](_[_0x0174('0x3c')](_0x4da1b2[_0x0174('0x31')],_0x4c7a2d[_0x0174('0x33')]),_0x255b97);if(_0x4da1b2[_0x0174('0x31')][_0x0174('0x3d')]){_0x32d97c[_0x0174('0x3b')]=_[_0x0174('0x3e')](_0x32d97c['where'],{'$or':_['map'](_0x255b97,function(_0x4a1670){if(_0x4a1670[_0x0174('0x2e')]!=='VIRTUAL'){var _0x553f9b={};_0x553f9b[_0x4a1670[_0x0174('0x29')]]={'$like':'%'+_0x4da1b2[_0x0174('0x31')]['filter']+'%'};return _0x553f9b;}})});}_0x32d97c=_[_0x0174('0x3e')]({},_0x32d97c,_0x4da1b2[_0x0174('0x3f')]);var _0xd3bb30={'where':_0x32d97c[_0x0174('0x3b')]};return db[_0x0174('0x2c')][_0x0174('0x1f')](_0xd3bb30)[_0x0174('0x25')](function(_0x5e94d9){_0x18f541[_0x0174('0x1f')]=_0x5e94d9;if(_0x4da1b2['query']['includeAll']){_0x32d97c[_0x0174('0x40')]=[{'all':!![]}];}return db[_0x0174('0x2c')][_0x0174('0x41')](_0x32d97c);})[_0x0174('0x25')](function(_0x5c4171){_0x18f541[_0x0174('0x42')]=_0x5c4171;return _0x18f541;})['then'](respondWithFilteredResult(_0x1ce56b,_0x32d97c))[_0x0174('0x43')](handleError(_0x1ce56b,null));};exports['show']=function(_0xb1728b,_0x255da8){var _0xa1a4ad={'raw':![],'where':{'id':_0xb1728b[_0x0174('0x44')]['id']}},_0xc8e57c={};_0xc8e57c['model']=_[_0x0174('0x32')](db[_0x0174('0x2c')][_0x0174('0x2d')]);_0xc8e57c[_0x0174('0x31')]=_[_0x0174('0x32')](_0xb1728b[_0x0174('0x31')]);_0xc8e57c[_0x0174('0x33')]=_[_0x0174('0x34')](_0xc8e57c[_0x0174('0x30')],_0xc8e57c['query']);_0xa1a4ad[_0x0174('0x35')]=_['intersection'](_0xc8e57c[_0x0174('0x30')],qs[_0x0174('0x36')](_0xb1728b['query']['fields']));_0xa1a4ad[_0x0174('0x35')]=_0xa1a4ad[_0x0174('0x35')][_0x0174('0x37')]?_0xa1a4ad[_0x0174('0x35')]:_0xc8e57c['model'];if(_0xb1728b['query'][_0x0174('0x45')]){_0xa1a4ad[_0x0174('0x40')]=[{'all':!![]}];}_0xa1a4ad=_[_0x0174('0x3e')]({},_0xa1a4ad,_0xb1728b['options']);return db[_0x0174('0x2c')][_0x0174('0x46')](_0xa1a4ad)[_0x0174('0x25')](handleEntityNotFound(_0x255da8,null))['then'](respondWithResult(_0x255da8,null))[_0x0174('0x43')](handleError(_0x255da8,null));};exports[_0x0174('0x47')]=function(_0x3833c7,_0x3c804c){return db[_0x0174('0x2c')][_0x0174('0x47')](_0x3833c7['body'],{})['then'](respondWithResult(_0x3c804c,0xc9))['catch'](handleError(_0x3c804c,null));};exports['update']=function(_0x5a9523,_0x38c294){if(_0x5a9523['body']['id']){delete _0x5a9523[_0x0174('0x48')]['id'];}return db['ZendeskConfiguration'][_0x0174('0x46')]({'where':{'id':_0x5a9523['params']['id']}})[_0x0174('0x25')](handleEntityNotFound(_0x38c294,null))[_0x0174('0x25')](saveUpdates(_0x5a9523[_0x0174('0x48')],null))[_0x0174('0x25')](respondWithResult(_0x38c294,null))[_0x0174('0x43')](handleError(_0x38c294,null));};exports[_0x0174('0x24')]=function(_0x4c8229,_0x3654cd){return db[_0x0174('0x2c')][_0x0174('0x46')]({'where':{'id':_0x4c8229['params']['id']}})[_0x0174('0x25')](handleEntityNotFound(_0x3654cd,null))[_0x0174('0x25')](removeEntity(_0x3654cd,null))[_0x0174('0x43')](handleError(_0x3654cd,null));};exports[_0x0174('0x49')]=function(_0x2471f5,_0x70e5b4,_0x589589){var _0x473ff5={};var _0x3f0345={};var _0x41faa8;var _0x4ebf20;return db[_0x0174('0x2c')]['findOne']({'where':{'id':_0x2471f5[_0x0174('0x44')]['id']}})[_0x0174('0x25')](handleEntityNotFound(_0x70e5b4,null))[_0x0174('0x25')](function(_0x2a03a4){if(_0x2a03a4){_0x41faa8=_0x2a03a4;_0x3f0345[_0x0174('0x30')]=_[_0x0174('0x32')](db[_0x0174('0x4a')][_0x0174('0x2d')]);_0x3f0345[_0x0174('0x31')]=_['keys'](_0x2471f5['query']);_0x3f0345[_0x0174('0x33')]=_[_0x0174('0x34')](_0x3f0345['model'],_0x3f0345[_0x0174('0x31')]);_0x473ff5['attributes']=_[_0x0174('0x34')](_0x3f0345[_0x0174('0x30')],qs['fields'](_0x2471f5[_0x0174('0x31')]['fields']));_0x473ff5[_0x0174('0x35')]=_0x473ff5[_0x0174('0x35')][_0x0174('0x37')]?_0x473ff5[_0x0174('0x35')]:_0x3f0345[_0x0174('0x30')];_0x473ff5[_0x0174('0x39')]=qs[_0x0174('0x3a')](_0x2471f5[_0x0174('0x31')][_0x0174('0x3a')]);_0x473ff5[_0x0174('0x3b')]=qs[_0x0174('0x33')](_[_0x0174('0x3c')](_0x2471f5[_0x0174('0x31')],_0x3f0345[_0x0174('0x33')]));if(_0x2471f5[_0x0174('0x31')][_0x0174('0x3d')]){_0x473ff5[_0x0174('0x3b')]=_[_0x0174('0x3e')](_0x473ff5[_0x0174('0x3b')],{'$or':_[_0x0174('0x2b')](_0x473ff5[_0x0174('0x35')],function(_0x11d1d7){var _0x467a55={};_0x467a55[_0x11d1d7]={'$like':'%'+_0x2471f5[_0x0174('0x31')][_0x0174('0x3d')]+'%'};return _0x467a55;})});}_0x473ff5=_[_0x0174('0x3e')]({},_0x473ff5,_0x2471f5[_0x0174('0x3f')]);return _0x41faa8[_0x0174('0x49')](_0x473ff5);}})[_0x0174('0x25')](function(_0x34a278){if(_0x34a278){_0x4ebf20=_0x34a278[_0x0174('0x37')];if(!_0x2471f5[_0x0174('0x31')][_0x0174('0x4b')](_0x0174('0x38'))){_0x473ff5[_0x0174('0x1e')]=qs[_0x0174('0x1e')](_0x2471f5[_0x0174('0x31')]['limit']);_0x473ff5[_0x0174('0x20')]=qs[_0x0174('0x20')](_0x2471f5[_0x0174('0x31')]['offset']);}return _0x41faa8[_0x0174('0x49')](_0x473ff5);}})[_0x0174('0x25')](function(_0x2bf92c){if(_0x2bf92c){return _0x2bf92c?{'count':_0x4ebf20,'rows':_0x2bf92c}:null;}})[_0x0174('0x25')](respondWithResult(_0x70e5b4,null))[_0x0174('0x43')](handleError(_0x70e5b4,null));};exports[_0x0174('0x4c')]=function(_0x879074,_0xa2f74a,_0x5ee388){var _0x42261b={};var _0x2224c4={};var _0x44ed2f;var _0x5294e0;return db['ZendeskConfiguration'][_0x0174('0x4d')]({'where':{'id':_0x879074[_0x0174('0x44')]['id']}})['then'](handleEntityNotFound(_0xa2f74a,null))['then'](function(_0x496585){if(_0x496585){_0x44ed2f=_0x496585;_0x2224c4[_0x0174('0x30')]=_[_0x0174('0x32')](db[_0x0174('0x4a')]['rawAttributes']);_0x2224c4['query']=_[_0x0174('0x32')](_0x879074[_0x0174('0x31')]);_0x2224c4['filters']=_[_0x0174('0x34')](_0x2224c4['model'],_0x2224c4['query']);_0x42261b['attributes']=_[_0x0174('0x34')](_0x2224c4['model'],qs[_0x0174('0x36')](_0x879074[_0x0174('0x31')]['fields']));_0x42261b[_0x0174('0x35')]=_0x42261b[_0x0174('0x35')][_0x0174('0x37')]?_0x42261b[_0x0174('0x35')]:_0x2224c4[_0x0174('0x30')];_0x42261b[_0x0174('0x39')]=qs[_0x0174('0x3a')](_0x879074['query'][_0x0174('0x3a')]);_0x42261b[_0x0174('0x3b')]=qs[_0x0174('0x33')](_[_0x0174('0x3c')](_0x879074[_0x0174('0x31')],_0x2224c4[_0x0174('0x33')]));if(_0x879074[_0x0174('0x31')][_0x0174('0x3d')]){_0x42261b['where']=_[_0x0174('0x3e')](_0x42261b[_0x0174('0x3b')],{'$or':_[_0x0174('0x2b')](_0x42261b[_0x0174('0x35')],function(_0x22f36e){var _0x386d60={};_0x386d60[_0x22f36e]={'$like':'%'+_0x879074['query'][_0x0174('0x3d')]+'%'};return _0x386d60;})});}_0x42261b=_[_0x0174('0x3e')]({},_0x42261b,_0x879074[_0x0174('0x3f')]);return _0x44ed2f[_0x0174('0x4c')](_0x42261b);}})[_0x0174('0x25')](function(_0x1b4b7c){if(_0x1b4b7c){_0x5294e0=_0x1b4b7c[_0x0174('0x37')];if(!_0x879074[_0x0174('0x31')][_0x0174('0x4b')](_0x0174('0x38'))){_0x42261b[_0x0174('0x1e')]=qs[_0x0174('0x1e')](_0x879074['query'][_0x0174('0x1e')]);_0x42261b[_0x0174('0x20')]=qs[_0x0174('0x20')](_0x879074[_0x0174('0x31')][_0x0174('0x20')]);}return _0x44ed2f['getSubjects'](_0x42261b);}})['then'](function(_0x329b3e){if(_0x329b3e){return _0x329b3e?{'count':_0x5294e0,'rows':_0x329b3e}:null;}})[_0x0174('0x25')](respondWithResult(_0xa2f74a,null))['catch'](handleError(_0xa2f74a,null));};exports['getDescriptions']=function(_0x2b2c89,_0x447094,_0x39a0db){var _0xd14e0={};var _0x1a03bc={};var _0x24bdc7;var _0x46d741;return db[_0x0174('0x2c')][_0x0174('0x4d')]({'where':{'id':_0x2b2c89[_0x0174('0x44')]['id']}})[_0x0174('0x25')](handleEntityNotFound(_0x447094,null))[_0x0174('0x25')](function(_0x328159){if(_0x328159){_0x24bdc7=_0x328159;_0x1a03bc['model']=_[_0x0174('0x32')](db[_0x0174('0x4a')][_0x0174('0x2d')]);_0x1a03bc[_0x0174('0x31')]=_[_0x0174('0x32')](_0x2b2c89[_0x0174('0x31')]);_0x1a03bc[_0x0174('0x33')]=_[_0x0174('0x34')](_0x1a03bc['model'],_0x1a03bc[_0x0174('0x31')]);_0xd14e0[_0x0174('0x35')]=_[_0x0174('0x34')](_0x1a03bc[_0x0174('0x30')],qs['fields'](_0x2b2c89[_0x0174('0x31')][_0x0174('0x36')]));_0xd14e0[_0x0174('0x35')]=_0xd14e0['attributes'][_0x0174('0x37')]?_0xd14e0[_0x0174('0x35')]:_0x1a03bc[_0x0174('0x30')];_0xd14e0['order']=qs[_0x0174('0x3a')](_0x2b2c89[_0x0174('0x31')]['sort']);_0xd14e0[_0x0174('0x3b')]=qs['filters'](_[_0x0174('0x3c')](_0x2b2c89[_0x0174('0x31')],_0x1a03bc['filters']));if(_0x2b2c89[_0x0174('0x31')][_0x0174('0x3d')]){_0xd14e0[_0x0174('0x3b')]=_[_0x0174('0x3e')](_0xd14e0[_0x0174('0x3b')],{'$or':_[_0x0174('0x2b')](_0xd14e0[_0x0174('0x35')],function(_0x4107d2){var _0x3b3cbd={};_0x3b3cbd[_0x4107d2]={'$like':'%'+_0x2b2c89[_0x0174('0x31')][_0x0174('0x3d')]+'%'};return _0x3b3cbd;})});}_0xd14e0=_[_0x0174('0x3e')]({},_0xd14e0,_0x2b2c89[_0x0174('0x3f')]);return _0x24bdc7[_0x0174('0x4e')](_0xd14e0);}})['then'](function(_0x3e3ec1){if(_0x3e3ec1){_0x46d741=_0x3e3ec1[_0x0174('0x37')];if(!_0x2b2c89[_0x0174('0x31')][_0x0174('0x4b')](_0x0174('0x38'))){_0xd14e0[_0x0174('0x1e')]=qs[_0x0174('0x1e')](_0x2b2c89[_0x0174('0x31')][_0x0174('0x1e')]);_0xd14e0[_0x0174('0x20')]=qs[_0x0174('0x20')](_0x2b2c89[_0x0174('0x31')][_0x0174('0x20')]);}return _0x24bdc7['getDescriptions'](_0xd14e0);}})[_0x0174('0x25')](function(_0x4d5021){if(_0x4d5021){return _0x4d5021?{'count':_0x46d741,'rows':_0x4d5021}:null;}})[_0x0174('0x25')](respondWithResult(_0x447094,null))[_0x0174('0x43')](handleError(_0x447094,null));};exports[_0x0174('0x4f')]=function(_0x37c28a,_0x4dfc12,_0x76bb1){var _0x4b217f={};var _0x5eb9da={};var _0x12ee19;var _0x2bed29;return db[_0x0174('0x2c')][_0x0174('0x4d')]({'where':{'id':_0x37c28a[_0x0174('0x44')]['id']}})[_0x0174('0x25')](handleEntityNotFound(_0x4dfc12,null))[_0x0174('0x25')](function(_0x3d79af){if(_0x3d79af){_0x12ee19=_0x3d79af;_0x5eb9da[_0x0174('0x30')]=_[_0x0174('0x32')](db[_0x0174('0x50')]['rawAttributes']);_0x5eb9da[_0x0174('0x31')]=_[_0x0174('0x32')](_0x37c28a[_0x0174('0x31')]);_0x5eb9da[_0x0174('0x33')]=_[_0x0174('0x34')](_0x5eb9da[_0x0174('0x30')],_0x5eb9da[_0x0174('0x31')]);_0x4b217f[_0x0174('0x35')]=_['intersection'](_0x5eb9da[_0x0174('0x30')],qs[_0x0174('0x36')](_0x37c28a[_0x0174('0x31')][_0x0174('0x36')]));_0x4b217f[_0x0174('0x35')]=_0x4b217f[_0x0174('0x35')][_0x0174('0x37')]?_0x4b217f[_0x0174('0x35')]:_0x5eb9da[_0x0174('0x30')];_0x4b217f[_0x0174('0x39')]=qs[_0x0174('0x3a')](_0x37c28a[_0x0174('0x31')][_0x0174('0x3a')]);_0x4b217f['where']=qs['filters'](_[_0x0174('0x3c')](_0x37c28a['query'],_0x5eb9da['filters']));if(_0x37c28a['query'][_0x0174('0x3d')]){_0x4b217f[_0x0174('0x3b')]=_[_0x0174('0x3e')](_0x4b217f[_0x0174('0x3b')],{'$or':_['map'](_0x4b217f[_0x0174('0x35')],function(_0x5137df){var _0x586d0f={};_0x586d0f[_0x5137df]={'$like':'%'+_0x37c28a['query'][_0x0174('0x3d')]+'%'};return _0x586d0f;})});}_0x4b217f=_['merge']({},_0x4b217f,_0x37c28a[_0x0174('0x3f')]);return _0x12ee19['getTags'](_0x4b217f);}})[_0x0174('0x25')](function(_0x4b6c4c){if(_0x4b6c4c){_0x2bed29=_0x4b6c4c['length'];if(!_0x37c28a[_0x0174('0x31')][_0x0174('0x4b')](_0x0174('0x38'))){_0x4b217f[_0x0174('0x1e')]=qs[_0x0174('0x1e')](_0x37c28a[_0x0174('0x31')][_0x0174('0x1e')]);_0x4b217f[_0x0174('0x20')]=qs[_0x0174('0x20')](_0x37c28a[_0x0174('0x31')][_0x0174('0x20')]);}return _0x12ee19[_0x0174('0x4f')](_0x4b217f);}})['then'](function(_0x294002){if(_0x294002){return _0x294002?{'count':_0x2bed29,'rows':_0x294002}:null;}})[_0x0174('0x25')](respondWithResult(_0x4dfc12,null))[_0x0174('0x43')](handleError(_0x4dfc12,null));};exports[_0x0174('0x51')]=function(_0x151d19,_0x501446,_0xb3a03){if(_0x151d19[_0x0174('0x48')]['id']){delete _0x151d19[_0x0174('0x48')]['id'];}return db[_0x0174('0x2c')][_0x0174('0x4d')]({'where':{'id':_0x151d19['params']['id']}})[_0x0174('0x25')](handleEntityNotFound(_0x501446,null))['then'](function(_0x37b345){if(_0x37b345){return _0x37b345['setTags'](_0x151d19[_0x0174('0x48')][_0x0174('0x52')]||[]);}return null;})[_0x0174('0x25')](respondWithResult(_0x501446,null))[_0x0174('0x43')](handleError(_0x501446,null));}; \ No newline at end of file +var _0x30a2=['filter','options','findAll','rows','catch','params','include','create','body','getFields','findOne','ZendeskField','pick','getSubjects','getTags','setTags','ids','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','limit','count','offset','Content-Range','update','then','destroy','error','send','index','map','ZendeskConfiguration','rawAttributes','fieldName','type','key','model','name','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','merge'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x30a2,0xfb));var _0x230a=function(_0x3f3bad,_0x193f06){_0x3f3bad=_0x3f3bad-0x0;var _0x4f0801=_0x30a2[_0x3f3bad];return _0x4f0801;};'use strict';var emlformat=require(_0x230a('0x0'));var rimraf=require(_0x230a('0x1'));var zipdir=require(_0x230a('0x2'));var jsonpatch=require(_0x230a('0x3'));var rp=require('request-promise');var moment=require(_0x230a('0x4'));var BPromise=require(_0x230a('0x5'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x230a('0x6'));var csv=require(_0x230a('0x7'));var ejs=require(_0x230a('0x8'));var fs=require('fs');var fs_extra=require(_0x230a('0x9'));var _=require(_0x230a('0xa'));var squel=require(_0x230a('0xb'));var crypto=require(_0x230a('0xc'));var jsforce=require(_0x230a('0xd'));var deskjs=require(_0x230a('0xe'));var toCsv=require('to-csv');var querystring=require(_0x230a('0xf'));var Papa=require(_0x230a('0x10'));var Redis=require(_0x230a('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x230a('0x12'));var as=require(_0x230a('0x13'));var hardwareService=require(_0x230a('0x14'));var logger=require(_0x230a('0x15'))(_0x230a('0x16'));var utils=require('../../config/utils');var config=require(_0x230a('0x17'));var licenseUtil=require(_0x230a('0x18'));var db=require(_0x230a('0x19'))['db'];function respondWithStatusCode(_0xfdb320,_0x4bc44d){_0x4bc44d=_0x4bc44d||0xcc;return function(_0x1d41c4){if(_0x1d41c4){return _0xfdb320[_0x230a('0x1a')](_0x4bc44d);}return _0xfdb320[_0x230a('0x1b')](_0x4bc44d)['end']();};}function respondWithResult(_0x3b7a36,_0x9cc8cf){_0x9cc8cf=_0x9cc8cf||0xc8;return function(_0x78de8c){if(_0x78de8c){return _0x3b7a36[_0x230a('0x1b')](_0x9cc8cf)[_0x230a('0x1c')](_0x78de8c);}};}function respondWithFilteredResult(_0x116b42,_0x32d9ed){return function(_0x5b0493){if(_0x5b0493){var _0x3df16c=typeof _0x32d9ed['offset']===_0x230a('0x1d')&&typeof _0x32d9ed[_0x230a('0x1e')]==='undefined';var _0x36ed0f=_0x5b0493[_0x230a('0x1f')];var _0x4dc64a=_0x3df16c?0x0:_0x32d9ed[_0x230a('0x20')];var _0x2ffbb1=_0x3df16c?_0x5b0493['count']:_0x32d9ed[_0x230a('0x20')]+_0x32d9ed[_0x230a('0x1e')];var _0x14006f;if(_0x2ffbb1>=_0x36ed0f){_0x2ffbb1=_0x36ed0f;_0x14006f=0xc8;}else{_0x14006f=0xce;}_0x116b42['status'](_0x14006f);return _0x116b42['set'](_0x230a('0x21'),_0x4dc64a+'-'+_0x2ffbb1+'/'+_0x36ed0f)['json'](_0x5b0493);}return null;};}function patchUpdates(_0x5dcfbd){return function(_0x39bf42){try{jsonpatch['apply'](_0x39bf42,_0x5dcfbd,!![]);}catch(_0x60ccf2){return BPromise['reject'](_0x60ccf2);}return _0x39bf42['save']();};}function saveUpdates(_0x144a71,_0x17d758){return function(_0x53ea7b){if(_0x53ea7b){return _0x53ea7b[_0x230a('0x22')](_0x144a71)[_0x230a('0x23')](function(_0x165a75){return _0x165a75;});}return null;};}function removeEntity(_0x50db28,_0xd06514){return function(_0x50a10a){if(_0x50a10a){return _0x50a10a[_0x230a('0x24')]()[_0x230a('0x23')](function(){_0x50db28[_0x230a('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1bc08d,_0x1abbc1){return function(_0x3662cf){if(!_0x3662cf){_0x1bc08d[_0x230a('0x1a')](0x194);}return _0x3662cf;};}function handleError(_0x5f2833,_0x4fd6b3){_0x4fd6b3=_0x4fd6b3||0x1f4;return function(_0x5da83f){logger[_0x230a('0x25')](_0x5da83f['stack']);if(_0x5da83f['name']){delete _0x5da83f['name'];}_0x5f2833[_0x230a('0x1b')](_0x4fd6b3)[_0x230a('0x26')](_0x5da83f);};}exports[_0x230a('0x27')]=function(_0x20659a,_0x1349af){var _0x502a4d={},_0x192265={},_0x9fbaf3={'count':0x0,'rows':[]};var _0x4bde13=_[_0x230a('0x28')](db[_0x230a('0x29')][_0x230a('0x2a')],function(_0x24c76b){return{'name':_0x24c76b[_0x230a('0x2b')],'type':_0x24c76b[_0x230a('0x2c')][_0x230a('0x2d')]};});_0x192265[_0x230a('0x2e')]=_['map'](_0x4bde13,_0x230a('0x2f'));_0x192265[_0x230a('0x30')]=_[_0x230a('0x31')](_0x20659a['query']);_0x192265[_0x230a('0x32')]=_['intersection'](_0x192265[_0x230a('0x2e')],_0x192265[_0x230a('0x30')]);_0x502a4d[_0x230a('0x33')]=_[_0x230a('0x34')](_0x192265[_0x230a('0x2e')],qs['fields'](_0x20659a['query'][_0x230a('0x35')]));_0x502a4d[_0x230a('0x33')]=_0x502a4d['attributes'][_0x230a('0x36')]?_0x502a4d['attributes']:_0x192265[_0x230a('0x2e')];if(!_0x20659a[_0x230a('0x30')][_0x230a('0x37')](_0x230a('0x38'))){_0x502a4d[_0x230a('0x1e')]=qs[_0x230a('0x1e')](_0x20659a[_0x230a('0x30')]['limit']);_0x502a4d[_0x230a('0x20')]=qs['offset'](_0x20659a['query'][_0x230a('0x20')]);}_0x502a4d[_0x230a('0x39')]=qs[_0x230a('0x3a')](_0x20659a[_0x230a('0x30')]['sort']);_0x502a4d[_0x230a('0x3b')]=qs[_0x230a('0x32')](_['pick'](_0x20659a['query'],_0x192265['filters']),_0x4bde13);if(_0x20659a['query']['filter']){_0x502a4d['where']=_[_0x230a('0x3c')](_0x502a4d['where'],{'$or':_['map'](_0x4bde13,function(_0x5481ad){if(_0x5481ad[_0x230a('0x2c')]!=='VIRTUAL'){var _0x4d07df={};_0x4d07df[_0x5481ad[_0x230a('0x2f')]]={'$like':'%'+_0x20659a['query'][_0x230a('0x3d')]+'%'};return _0x4d07df;}})});}_0x502a4d=_['merge']({},_0x502a4d,_0x20659a[_0x230a('0x3e')]);var _0x129d0f={'where':_0x502a4d[_0x230a('0x3b')]};return db[_0x230a('0x29')][_0x230a('0x1f')](_0x129d0f)['then'](function(_0x264163){_0x9fbaf3['count']=_0x264163;if(_0x20659a[_0x230a('0x30')]['includeAll']){_0x502a4d['include']=[{'all':!![]}];}return db[_0x230a('0x29')][_0x230a('0x3f')](_0x502a4d);})[_0x230a('0x23')](function(_0x1eae2e){_0x9fbaf3[_0x230a('0x40')]=_0x1eae2e;return _0x9fbaf3;})[_0x230a('0x23')](respondWithFilteredResult(_0x1349af,_0x502a4d))[_0x230a('0x41')](handleError(_0x1349af,null));};exports['show']=function(_0x5d0947,_0x48d797){var _0x24c18e={'raw':![],'where':{'id':_0x5d0947[_0x230a('0x42')]['id']}},_0x2e4a95={};_0x2e4a95[_0x230a('0x2e')]=_[_0x230a('0x31')](db['ZendeskConfiguration'][_0x230a('0x2a')]);_0x2e4a95[_0x230a('0x30')]=_[_0x230a('0x31')](_0x5d0947[_0x230a('0x30')]);_0x2e4a95[_0x230a('0x32')]=_['intersection'](_0x2e4a95[_0x230a('0x2e')],_0x2e4a95[_0x230a('0x30')]);_0x24c18e[_0x230a('0x33')]=_['intersection'](_0x2e4a95['model'],qs['fields'](_0x5d0947['query']['fields']));_0x24c18e[_0x230a('0x33')]=_0x24c18e[_0x230a('0x33')][_0x230a('0x36')]?_0x24c18e[_0x230a('0x33')]:_0x2e4a95['model'];if(_0x5d0947[_0x230a('0x30')]['includeAll']){_0x24c18e[_0x230a('0x43')]=[{'all':!![]}];}_0x24c18e=_[_0x230a('0x3c')]({},_0x24c18e,_0x5d0947[_0x230a('0x3e')]);return db['ZendeskConfiguration']['find'](_0x24c18e)['then'](handleEntityNotFound(_0x48d797,null))['then'](respondWithResult(_0x48d797,null))[_0x230a('0x41')](handleError(_0x48d797,null));};exports[_0x230a('0x44')]=function(_0x179039,_0x291a7d){return db['ZendeskConfiguration'][_0x230a('0x44')](_0x179039[_0x230a('0x45')],{})['then'](respondWithResult(_0x291a7d,0xc9))['catch'](handleError(_0x291a7d,null));};exports[_0x230a('0x22')]=function(_0x1d7d38,_0x38a01a){if(_0x1d7d38[_0x230a('0x45')]['id']){delete _0x1d7d38[_0x230a('0x45')]['id'];}return db[_0x230a('0x29')]['find']({'where':{'id':_0x1d7d38[_0x230a('0x42')]['id']}})['then'](handleEntityNotFound(_0x38a01a,null))[_0x230a('0x23')](saveUpdates(_0x1d7d38[_0x230a('0x45')],null))['then'](respondWithResult(_0x38a01a,null))[_0x230a('0x41')](handleError(_0x38a01a,null));};exports[_0x230a('0x24')]=function(_0x3cd405,_0x3e6264){return db[_0x230a('0x29')]['find']({'where':{'id':_0x3cd405[_0x230a('0x42')]['id']}})[_0x230a('0x23')](handleEntityNotFound(_0x3e6264,null))['then'](removeEntity(_0x3e6264,null))[_0x230a('0x41')](handleError(_0x3e6264,null));};exports[_0x230a('0x46')]=function(_0x4c1e66,_0x380193,_0x3ca407){var _0x507ee1={};var _0x1577a1={};var _0x2ebf37;var _0x38b70b;return db[_0x230a('0x29')][_0x230a('0x47')]({'where':{'id':_0x4c1e66[_0x230a('0x42')]['id']}})[_0x230a('0x23')](handleEntityNotFound(_0x380193,null))[_0x230a('0x23')](function(_0x164d1a){if(_0x164d1a){_0x2ebf37=_0x164d1a;_0x1577a1[_0x230a('0x2e')]=_[_0x230a('0x31')](db[_0x230a('0x48')]['rawAttributes']);_0x1577a1['query']=_[_0x230a('0x31')](_0x4c1e66[_0x230a('0x30')]);_0x1577a1[_0x230a('0x32')]=_[_0x230a('0x34')](_0x1577a1['model'],_0x1577a1['query']);_0x507ee1[_0x230a('0x33')]=_['intersection'](_0x1577a1['model'],qs[_0x230a('0x35')](_0x4c1e66[_0x230a('0x30')][_0x230a('0x35')]));_0x507ee1[_0x230a('0x33')]=_0x507ee1[_0x230a('0x33')]['length']?_0x507ee1['attributes']:_0x1577a1[_0x230a('0x2e')];_0x507ee1[_0x230a('0x39')]=qs[_0x230a('0x3a')](_0x4c1e66[_0x230a('0x30')][_0x230a('0x3a')]);_0x507ee1[_0x230a('0x3b')]=qs[_0x230a('0x32')](_[_0x230a('0x49')](_0x4c1e66[_0x230a('0x30')],_0x1577a1[_0x230a('0x32')]));if(_0x4c1e66[_0x230a('0x30')][_0x230a('0x3d')]){_0x507ee1[_0x230a('0x3b')]=_[_0x230a('0x3c')](_0x507ee1[_0x230a('0x3b')],{'$or':_[_0x230a('0x28')](_0x507ee1[_0x230a('0x33')],function(_0x35faf5){var _0x16b6b0={};_0x16b6b0[_0x35faf5]={'$like':'%'+_0x4c1e66[_0x230a('0x30')][_0x230a('0x3d')]+'%'};return _0x16b6b0;})});}_0x507ee1=_[_0x230a('0x3c')]({},_0x507ee1,_0x4c1e66[_0x230a('0x3e')]);return _0x2ebf37[_0x230a('0x46')](_0x507ee1);}})['then'](function(_0x8cfcc5){if(_0x8cfcc5){_0x38b70b=_0x8cfcc5[_0x230a('0x36')];if(!_0x4c1e66['query'][_0x230a('0x37')](_0x230a('0x38'))){_0x507ee1[_0x230a('0x1e')]=qs[_0x230a('0x1e')](_0x4c1e66[_0x230a('0x30')][_0x230a('0x1e')]);_0x507ee1['offset']=qs[_0x230a('0x20')](_0x4c1e66[_0x230a('0x30')][_0x230a('0x20')]);}return _0x2ebf37[_0x230a('0x46')](_0x507ee1);}})['then'](function(_0x14a8b1){if(_0x14a8b1){return _0x14a8b1?{'count':_0x38b70b,'rows':_0x14a8b1}:null;}})[_0x230a('0x23')](respondWithResult(_0x380193,null))[_0x230a('0x41')](handleError(_0x380193,null));};exports[_0x230a('0x4a')]=function(_0x5173dc,_0x5480d0,_0x3f2e59){var _0x5daa1e={};var _0x4ab2a6={};var _0x50df0f;var _0x130ad0;return db['ZendeskConfiguration']['findOne']({'where':{'id':_0x5173dc[_0x230a('0x42')]['id']}})['then'](handleEntityNotFound(_0x5480d0,null))[_0x230a('0x23')](function(_0x1c7740){if(_0x1c7740){_0x50df0f=_0x1c7740;_0x4ab2a6[_0x230a('0x2e')]=_[_0x230a('0x31')](db[_0x230a('0x48')][_0x230a('0x2a')]);_0x4ab2a6['query']=_[_0x230a('0x31')](_0x5173dc[_0x230a('0x30')]);_0x4ab2a6[_0x230a('0x32')]=_['intersection'](_0x4ab2a6['model'],_0x4ab2a6[_0x230a('0x30')]);_0x5daa1e['attributes']=_[_0x230a('0x34')](_0x4ab2a6[_0x230a('0x2e')],qs[_0x230a('0x35')](_0x5173dc[_0x230a('0x30')][_0x230a('0x35')]));_0x5daa1e['attributes']=_0x5daa1e[_0x230a('0x33')][_0x230a('0x36')]?_0x5daa1e['attributes']:_0x4ab2a6[_0x230a('0x2e')];_0x5daa1e[_0x230a('0x39')]=qs[_0x230a('0x3a')](_0x5173dc['query'][_0x230a('0x3a')]);_0x5daa1e[_0x230a('0x3b')]=qs['filters'](_[_0x230a('0x49')](_0x5173dc[_0x230a('0x30')],_0x4ab2a6[_0x230a('0x32')]));if(_0x5173dc[_0x230a('0x30')]['filter']){_0x5daa1e[_0x230a('0x3b')]=_['merge'](_0x5daa1e[_0x230a('0x3b')],{'$or':_['map'](_0x5daa1e[_0x230a('0x33')],function(_0x2df95e){var _0x30b03c={};_0x30b03c[_0x2df95e]={'$like':'%'+_0x5173dc['query'][_0x230a('0x3d')]+'%'};return _0x30b03c;})});}_0x5daa1e=_[_0x230a('0x3c')]({},_0x5daa1e,_0x5173dc[_0x230a('0x3e')]);return _0x50df0f[_0x230a('0x4a')](_0x5daa1e);}})[_0x230a('0x23')](function(_0x31b54f){if(_0x31b54f){_0x130ad0=_0x31b54f[_0x230a('0x36')];if(!_0x5173dc[_0x230a('0x30')][_0x230a('0x37')](_0x230a('0x38'))){_0x5daa1e[_0x230a('0x1e')]=qs[_0x230a('0x1e')](_0x5173dc['query'][_0x230a('0x1e')]);_0x5daa1e[_0x230a('0x20')]=qs['offset'](_0x5173dc[_0x230a('0x30')]['offset']);}return _0x50df0f[_0x230a('0x4a')](_0x5daa1e);}})[_0x230a('0x23')](function(_0x409939){if(_0x409939){return _0x409939?{'count':_0x130ad0,'rows':_0x409939}:null;}})[_0x230a('0x23')](respondWithResult(_0x5480d0,null))[_0x230a('0x41')](handleError(_0x5480d0,null));};exports['getDescriptions']=function(_0x14cc8d,_0x20784a,_0xf58419){var _0x25890e={};var _0x36afa0={};var _0x250673;var _0x1d8388;return db[_0x230a('0x29')][_0x230a('0x47')]({'where':{'id':_0x14cc8d['params']['id']}})[_0x230a('0x23')](handleEntityNotFound(_0x20784a,null))[_0x230a('0x23')](function(_0x35ce50){if(_0x35ce50){_0x250673=_0x35ce50;_0x36afa0[_0x230a('0x2e')]=_[_0x230a('0x31')](db['ZendeskField'][_0x230a('0x2a')]);_0x36afa0[_0x230a('0x30')]=_[_0x230a('0x31')](_0x14cc8d[_0x230a('0x30')]);_0x36afa0[_0x230a('0x32')]=_[_0x230a('0x34')](_0x36afa0[_0x230a('0x2e')],_0x36afa0[_0x230a('0x30')]);_0x25890e[_0x230a('0x33')]=_['intersection'](_0x36afa0[_0x230a('0x2e')],qs[_0x230a('0x35')](_0x14cc8d[_0x230a('0x30')][_0x230a('0x35')]));_0x25890e[_0x230a('0x33')]=_0x25890e[_0x230a('0x33')][_0x230a('0x36')]?_0x25890e[_0x230a('0x33')]:_0x36afa0['model'];_0x25890e[_0x230a('0x39')]=qs[_0x230a('0x3a')](_0x14cc8d[_0x230a('0x30')][_0x230a('0x3a')]);_0x25890e['where']=qs[_0x230a('0x32')](_['pick'](_0x14cc8d['query'],_0x36afa0[_0x230a('0x32')]));if(_0x14cc8d[_0x230a('0x30')]['filter']){_0x25890e[_0x230a('0x3b')]=_[_0x230a('0x3c')](_0x25890e[_0x230a('0x3b')],{'$or':_['map'](_0x25890e[_0x230a('0x33')],function(_0x361795){var _0x41e320={};_0x41e320[_0x361795]={'$like':'%'+_0x14cc8d['query']['filter']+'%'};return _0x41e320;})});}_0x25890e=_[_0x230a('0x3c')]({},_0x25890e,_0x14cc8d[_0x230a('0x3e')]);return _0x250673['getDescriptions'](_0x25890e);}})['then'](function(_0x53a6ea){if(_0x53a6ea){_0x1d8388=_0x53a6ea[_0x230a('0x36')];if(!_0x14cc8d[_0x230a('0x30')][_0x230a('0x37')](_0x230a('0x38'))){_0x25890e[_0x230a('0x1e')]=qs[_0x230a('0x1e')](_0x14cc8d[_0x230a('0x30')][_0x230a('0x1e')]);_0x25890e[_0x230a('0x20')]=qs[_0x230a('0x20')](_0x14cc8d['query']['offset']);}return _0x250673['getDescriptions'](_0x25890e);}})[_0x230a('0x23')](function(_0x4913e3){if(_0x4913e3){return _0x4913e3?{'count':_0x1d8388,'rows':_0x4913e3}:null;}})[_0x230a('0x23')](respondWithResult(_0x20784a,null))[_0x230a('0x41')](handleError(_0x20784a,null));};exports[_0x230a('0x4b')]=function(_0x11f558,_0x377af3,_0x2e8e4d){var _0x1e37b8={};var _0x2fc8dd={};var _0x2abeda;var _0x2d120f;return db[_0x230a('0x29')]['findOne']({'where':{'id':_0x11f558['params']['id']}})['then'](handleEntityNotFound(_0x377af3,null))[_0x230a('0x23')](function(_0x281e5c){if(_0x281e5c){_0x2abeda=_0x281e5c;_0x2fc8dd[_0x230a('0x2e')]=_[_0x230a('0x31')](db['Tag']['rawAttributes']);_0x2fc8dd[_0x230a('0x30')]=_[_0x230a('0x31')](_0x11f558[_0x230a('0x30')]);_0x2fc8dd[_0x230a('0x32')]=_[_0x230a('0x34')](_0x2fc8dd[_0x230a('0x2e')],_0x2fc8dd['query']);_0x1e37b8['attributes']=_[_0x230a('0x34')](_0x2fc8dd[_0x230a('0x2e')],qs[_0x230a('0x35')](_0x11f558[_0x230a('0x30')]['fields']));_0x1e37b8['attributes']=_0x1e37b8[_0x230a('0x33')][_0x230a('0x36')]?_0x1e37b8[_0x230a('0x33')]:_0x2fc8dd[_0x230a('0x2e')];_0x1e37b8[_0x230a('0x39')]=qs[_0x230a('0x3a')](_0x11f558[_0x230a('0x30')][_0x230a('0x3a')]);_0x1e37b8[_0x230a('0x3b')]=qs[_0x230a('0x32')](_[_0x230a('0x49')](_0x11f558[_0x230a('0x30')],_0x2fc8dd['filters']));if(_0x11f558['query'][_0x230a('0x3d')]){_0x1e37b8[_0x230a('0x3b')]=_[_0x230a('0x3c')](_0x1e37b8['where'],{'$or':_[_0x230a('0x28')](_0x1e37b8['attributes'],function(_0x2b2dd0){var _0x133230={};_0x133230[_0x2b2dd0]={'$like':'%'+_0x11f558[_0x230a('0x30')]['filter']+'%'};return _0x133230;})});}_0x1e37b8=_['merge']({},_0x1e37b8,_0x11f558[_0x230a('0x3e')]);return _0x2abeda[_0x230a('0x4b')](_0x1e37b8);}})[_0x230a('0x23')](function(_0x1be6f0){if(_0x1be6f0){_0x2d120f=_0x1be6f0['length'];if(!_0x11f558[_0x230a('0x30')][_0x230a('0x37')](_0x230a('0x38'))){_0x1e37b8[_0x230a('0x1e')]=qs[_0x230a('0x1e')](_0x11f558['query'][_0x230a('0x1e')]);_0x1e37b8[_0x230a('0x20')]=qs[_0x230a('0x20')](_0x11f558[_0x230a('0x30')][_0x230a('0x20')]);}return _0x2abeda[_0x230a('0x4b')](_0x1e37b8);}})[_0x230a('0x23')](function(_0x42f8fe){if(_0x42f8fe){return _0x42f8fe?{'count':_0x2d120f,'rows':_0x42f8fe}:null;}})['then'](respondWithResult(_0x377af3,null))[_0x230a('0x41')](handleError(_0x377af3,null));};exports[_0x230a('0x4c')]=function(_0x4952fe,_0x29686e,_0x55b945){if(_0x4952fe[_0x230a('0x45')]['id']){delete _0x4952fe[_0x230a('0x45')]['id'];}return db[_0x230a('0x29')][_0x230a('0x47')]({'where':{'id':_0x4952fe[_0x230a('0x42')]['id']}})[_0x230a('0x23')](handleEntityNotFound(_0x29686e,null))[_0x230a('0x23')](function(_0x36cc45){if(_0x36cc45){return _0x36cc45['setTags'](_0x4952fe[_0x230a('0x45')][_0x230a('0x4d')]||[]);}return null;})['then'](respondWithResult(_0x29686e,null))['catch'](handleError(_0x29686e,null));}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js index c4a3f8a..bdd64a0 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 _0x5f66=['request-promise','path','../../config/environment','exports','ZendeskConfiguration','int_zendesk_configurations','util','api','moment','bluebird'];(function(_0x21549c,_0x6d64d1){var _0x426cbd=function(_0x323f5b){while(--_0x323f5b){_0x21549c['push'](_0x21549c['shift']());}};_0x426cbd(++_0x6d64d1);}(_0x5f66,0x1a0));var _0x65f6=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x5f66[_0x2f5ac5];return _0x37c9a8;};'use strict';var _=require('lodash');var util=require(_0x65f6('0x0'));var logger=require('../../config/logger')(_0x65f6('0x1'));var moment=require(_0x65f6('0x2'));var BPromise=require(_0x65f6('0x3'));var rp=require(_0x65f6('0x4'));var fs=require('fs');var path=require(_0x65f6('0x5'));var rimraf=require('rimraf');var config=require(_0x65f6('0x6'));var attributes=require('./intZendeskConfiguration.attributes');module[_0x65f6('0x7')]=function(_0x22b017,_0x4ec221){return _0x22b017['define'](_0x65f6('0x8'),attributes,{'tableName':_0x65f6('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc900=['api','moment','request-promise','path','../../config/environment','./intZendeskConfiguration.attributes','exports','define','int_zendesk_configurations','../../config/logger'];(function(_0x454165,_0x1f3e74){var _0x56db53=function(_0x23388c){while(--_0x23388c){_0x454165['push'](_0x454165['shift']());}};_0x56db53(++_0x1f3e74);}(_0xc900,0xb3));var _0x0c90=function(_0x36ba7a,_0x1ce129){_0x36ba7a=_0x36ba7a-0x0;var _0x4a2470=_0xc900[_0x36ba7a];return _0x4a2470;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x0c90('0x0'))(_0x0c90('0x1'));var moment=require(_0x0c90('0x2'));var BPromise=require('bluebird');var rp=require(_0x0c90('0x3'));var fs=require('fs');var path=require(_0x0c90('0x4'));var rimraf=require('rimraf');var config=require(_0x0c90('0x5'));var attributes=require(_0x0c90('0x6'));module[_0x0c90('0x7')]=function(_0x718a5c,_0x42f9a3){return _0x718a5c[_0x0c90('0x8')]('ZendeskConfiguration',attributes,{'tableName':_0x0c90('0x9'),'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 9a0a965..51fe087 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 _0x8dd4=['info','result','catch','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','jayson/promise','client','http','ZendeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message'];(function(_0x44d385,_0x1a313a){var _0x5c2cc5=function(_0x5d1d76){while(--_0x5d1d76){_0x44d385['push'](_0x44d385['shift']());}};_0x5c2cc5(++_0x1a313a);}(_0x8dd4,0x88));var _0x48dd=function(_0x1de37d,_0x1dba7d){_0x1de37d=_0x1de37d-0x0;var _0x1371f7=_0x8dd4[_0x1de37d];return _0x1371f7;};'use strict';var _=require('lodash');var util=require(_0x48dd('0x0'));var moment=require(_0x48dd('0x1'));var BPromise=require('bluebird');var rs=require(_0x48dd('0x2'));var fs=require('fs');var Redis=require(_0x48dd('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x48dd('0x4'));var logger=require(_0x48dd('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0x48dd('0x6'));var client=jayson[_0x48dd('0x7')][_0x48dd('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4a4d51,_0x1f1191,_0x7f01e4){return new BPromise(function(_0x2797b5,_0x34d53d){return client['request'](_0x4a4d51,_0x7f01e4)['then'](function(_0x12e53f){logger['info'](_0x48dd('0x9'),_0x1f1191,_0x48dd('0xa'));logger[_0x48dd('0xb')]('ZendeskConfiguration,\x20%s,\x20%s,\x20%s',_0x1f1191,_0x48dd('0xa'),JSON[_0x48dd('0xc')](_0x12e53f));if(_0x12e53f['error']){if(_0x12e53f[_0x48dd('0xd')][_0x48dd('0xe')]===0x1f4){logger[_0x48dd('0xd')](_0x48dd('0x9'),_0x1f1191,_0x12e53f[_0x48dd('0xd')][_0x48dd('0xf')]);return _0x34d53d(_0x12e53f['error']['message']);}logger['error'](_0x48dd('0x9'),_0x1f1191,_0x12e53f[_0x48dd('0xd')][_0x48dd('0xf')]);return _0x2797b5(_0x12e53f['error']['message']);}else{logger[_0x48dd('0x10')](_0x48dd('0x9'),_0x1f1191,'request\x20sent');_0x2797b5(_0x12e53f[_0x48dd('0x11')][_0x48dd('0xf')]);}})[_0x48dd('0x12')](function(_0x35146d){logger[_0x48dd('0xd')]('ZendeskConfiguration,\x20%s,\x20%s',_0x1f1191,_0x35146d);_0x34d53d(_0x35146d);});});} \ No newline at end of file +var _0x1ce1=['client','http','request','then','info','ZendeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x3abd13,_0x3912ba){var _0x4504a5=function(_0x31f7f1){while(--_0x31f7f1){_0x3abd13['push'](_0x3abd13['shift']());}};_0x4504a5(++_0x3912ba);}(_0x1ce1,0x1da));var _0x11ce=function(_0x150551,_0x6cbe68){_0x150551=_0x150551-0x0;var _0x19f9fc=_0x1ce1[_0x150551];return _0x19f9fc;};'use strict';var _=require(_0x11ce('0x0'));var util=require(_0x11ce('0x1'));var moment=require(_0x11ce('0x2'));var BPromise=require(_0x11ce('0x3'));var rs=require(_0x11ce('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x11ce('0x5'));var logger=require(_0x11ce('0x6'))(_0x11ce('0x7'));var config=require(_0x11ce('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x11ce('0x9')][_0x11ce('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3409a9,_0x5cd208,_0xdf887d){return new BPromise(function(_0x5cd00d,_0x54acc4){return client[_0x11ce('0xb')](_0x3409a9,_0xdf887d)[_0x11ce('0xc')](function(_0x368cb3){logger[_0x11ce('0xd')](_0x11ce('0xe'),_0x5cd208,_0x11ce('0xf'));logger[_0x11ce('0x10')](_0x11ce('0x11'),_0x5cd208,_0x11ce('0xf'),JSON[_0x11ce('0x12')](_0x368cb3));if(_0x368cb3['error']){if(_0x368cb3[_0x11ce('0x13')][_0x11ce('0x14')]===0x1f4){logger[_0x11ce('0x13')]('ZendeskConfiguration,\x20%s,\x20%s',_0x5cd208,_0x368cb3['error'][_0x11ce('0x15')]);return _0x54acc4(_0x368cb3[_0x11ce('0x13')]['message']);}logger['error']('ZendeskConfiguration,\x20%s,\x20%s',_0x5cd208,_0x368cb3[_0x11ce('0x13')][_0x11ce('0x15')]);return _0x5cd00d(_0x368cb3[_0x11ce('0x13')][_0x11ce('0x15')]);}else{logger[_0x11ce('0xd')]('ZendeskConfiguration,\x20%s,\x20%s',_0x5cd208,_0x11ce('0xf'));_0x5cd00d(_0x368cb3[_0x11ce('0x16')][_0x11ce('0x15')]);}})['catch'](function(_0x15582f){logger['error'](_0x11ce('0xe'),_0x5cd208,_0x15582f);_0x54acc4(_0x15582f);});});} \ No newline at end of file diff --git a/server/api/intZendeskField/index.js b/server/api/intZendeskField/index.js index 49e30a8..6fa9786 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 _0x5f8e=['index','/:id','show','put','update','delete','destroy','exports','util','connect-timeout','express','../../components/interaction/service','../../config/environment','./intZendeskField.controller','get','isAuthenticated'];(function(_0x31f7c5,_0x3bf428){var _0x19fabc=function(_0x268080){while(--_0x268080){_0x31f7c5['push'](_0x31f7c5['shift']());}};_0x19fabc(++_0x3bf428);}(_0x5f8e,0xd8));var _0xe5f8=function(_0x72895a,_0x433607){_0x72895a=_0x72895a-0x0;var _0x5226d5=_0x5f8e[_0x72895a];return _0x5226d5;};'use strict';var multer=require('multer');var util=require(_0xe5f8('0x0'));var path=require('path');var timeout=require(_0xe5f8('0x1'));var express=require(_0xe5f8('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xe5f8('0x3'));var config=require(_0xe5f8('0x4'));var controller=require(_0xe5f8('0x5'));router[_0xe5f8('0x6')]('/',auth[_0xe5f8('0x7')](),controller[_0xe5f8('0x8')]);router[_0xe5f8('0x6')](_0xe5f8('0x9'),auth[_0xe5f8('0x7')](),controller[_0xe5f8('0xa')]);router['post']('/',auth[_0xe5f8('0x7')](),controller['create']);router[_0xe5f8('0xb')](_0xe5f8('0x9'),auth['isAuthenticated'](),controller[_0xe5f8('0xc')]);router[_0xe5f8('0xd')](_0xe5f8('0x9'),auth['isAuthenticated'](),controller[_0xe5f8('0xe')]);module[_0xe5f8('0xf')]=router; \ No newline at end of file +var _0x36f2=['put','update','delete','destroy','exports','util','path','connect-timeout','express','fs-extra','../../config/environment','./intZendeskField.controller','get','isAuthenticated','index','/:id','show','post','create'];(function(_0xd58b2,_0x126018){var _0x2575d0=function(_0x39844e){while(--_0x39844e){_0xd58b2['push'](_0xd58b2['shift']());}};_0x2575d0(++_0x126018);}(_0x36f2,0xc3));var _0x236f=function(_0x1133cd,_0x344580){_0x1133cd=_0x1133cd-0x0;var _0x1816d1=_0x36f2[_0x1133cd];return _0x1816d1;};'use strict';var multer=require('multer');var util=require(_0x236f('0x0'));var path=require(_0x236f('0x1'));var timeout=require(_0x236f('0x2'));var express=require(_0x236f('0x3'));var router=express['Router']();var fs_extra=require(_0x236f('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x236f('0x5'));var controller=require(_0x236f('0x6'));router[_0x236f('0x7')]('/',auth[_0x236f('0x8')](),controller[_0x236f('0x9')]);router['get'](_0x236f('0xa'),auth[_0x236f('0x8')](),controller[_0x236f('0xb')]);router[_0x236f('0xc')]('/',auth[_0x236f('0x8')](),controller[_0x236f('0xd')]);router[_0x236f('0xe')](_0x236f('0xa'),auth[_0x236f('0x8')](),controller[_0x236f('0xf')]);router[_0x236f('0x10')](_0x236f('0xa'),auth[_0x236f('0x8')](),controller[_0x236f('0x11')]);module[_0x236f('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 e51e4a7..7282976 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 _0x19a1=['BOOLEAN','sequelize','ENUM','variable','customVariable','keyValue','string','STRING'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x19a1,0x1b1));var _0x119a=function(_0x1e035c,_0xf906b){_0x1e035c=_0x1e035c-0x0;var _0x3a63f0=_0x19a1[_0x1e035c];return _0x3a63f0;};'use strict';var Sequelize=require(_0x119a('0x0'));module['exports']={'type':{'type':Sequelize[_0x119a('0x1')]('string',_0x119a('0x2'),_0x119a('0x3'),_0x119a('0x4'),'picklist'),'defaultValue':_0x119a('0x5')},'content':{'type':Sequelize[_0x119a('0x6')]},'key':{'type':Sequelize[_0x119a('0x6')]},'keyType':{'type':Sequelize[_0x119a('0x1')](_0x119a('0x5'),'variable',_0x119a('0x3'))},'keyContent':{'type':Sequelize[_0x119a('0x6')]},'idField':{'type':Sequelize[_0x119a('0x6')]},'nameField':{'type':Sequelize[_0x119a('0x6')]},'customField':{'type':Sequelize[_0x119a('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x3bd1=['ENUM','string','customVariable','keyValue','picklist','STRING','variable','BOOLEAN','sequelize','exports'];(function(_0x764874,_0x3ed544){var _0x29f9d5=function(_0x152dad){while(--_0x152dad){_0x764874['push'](_0x764874['shift']());}};_0x29f9d5(++_0x3ed544);}(_0x3bd1,0x116));var _0x13bd=function(_0x53b3be,_0x3f1013){_0x53b3be=_0x53b3be-0x0;var _0x4f7677=_0x3bd1[_0x53b3be];return _0x4f7677;};'use strict';var Sequelize=require(_0x13bd('0x0'));module[_0x13bd('0x1')]={'type':{'type':Sequelize[_0x13bd('0x2')](_0x13bd('0x3'),'variable',_0x13bd('0x4'),_0x13bd('0x5'),_0x13bd('0x6')),'defaultValue':'string'},'content':{'type':Sequelize[_0x13bd('0x7')]},'key':{'type':Sequelize[_0x13bd('0x7')]},'keyType':{'type':Sequelize[_0x13bd('0x2')](_0x13bd('0x3'),_0x13bd('0x8'),_0x13bd('0x4'))},'keyContent':{'type':Sequelize[_0x13bd('0x7')]},'idField':{'type':Sequelize[_0x13bd('0x7')]},'nameField':{'type':Sequelize[_0x13bd('0x7')]},'customField':{'type':Sequelize[_0x13bd('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x13bd('0x7')]}}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.controller.js b/server/api/intZendeskField/intZendeskField.controller.js index 7cd6bd6..7d94874 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 _0x8985=['query','keys','filters','intersection','model','attributes','fields','length','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','catch','rawAttributes','find','create','body','params','eml-format','rimraf','zip-dir','request-promise','mustache','util','ejs','fs-extra','lodash','crypto','desk.js','to-csv','papaparse','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','set','apply','save','update','then','destroy','end','error','name','send','index','map','ZendeskField','fieldName','type','key'];(function(_0x33a610,_0x390034){var _0x1893b3=function(_0x531418){while(--_0x531418){_0x33a610['push'](_0x33a610['shift']());}};_0x1893b3(++_0x390034);}(_0x8985,0x198));var _0x5898=function(_0x3fff53,_0xf8d045){_0x3fff53=_0x3fff53-0x0;var _0x41d153=_0x8985[_0x3fff53];return _0x41d153;};'use strict';var emlformat=require(_0x5898('0x0'));var rimraf=require(_0x5898('0x1'));var zipdir=require(_0x5898('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x5898('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x5898('0x4'));var util=require(_0x5898('0x5'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x5898('0x6'));var fs=require('fs');var fs_extra=require(_0x5898('0x7'));var _=require(_0x5898('0x8'));var squel=require('squel');var crypto=require(_0x5898('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x5898('0xa'));var toCsv=require(_0x5898('0xb'));var querystring=require('querystring');var Papa=require(_0x5898('0xc'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x5898('0xd'));var utils=require(_0x5898('0xe'));var config=require(_0x5898('0xf'));var licenseUtil=require(_0x5898('0x10'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1fcec2,_0x3f8e8d){_0x3f8e8d=_0x3f8e8d||0xcc;return function(_0x26836c){if(_0x26836c){return _0x1fcec2[_0x5898('0x11')](_0x3f8e8d);}return _0x1fcec2[_0x5898('0x12')](_0x3f8e8d)['end']();};}function respondWithResult(_0x3e4723,_0x119224){_0x119224=_0x119224||0xc8;return function(_0x51c06d){if(_0x51c06d){return _0x3e4723[_0x5898('0x12')](_0x119224)[_0x5898('0x13')](_0x51c06d);}};}function respondWithFilteredResult(_0x5ba4ea,_0x1bfb2b){return function(_0x1b013d){if(_0x1b013d){var _0x322487=typeof _0x1bfb2b[_0x5898('0x14')]===_0x5898('0x15')&&typeof _0x1bfb2b[_0x5898('0x16')]==='undefined';var _0x52a406=_0x1b013d[_0x5898('0x17')];var _0x319a7e=_0x322487?0x0:_0x1bfb2b[_0x5898('0x14')];var _0x3afcbd=_0x322487?_0x1b013d[_0x5898('0x17')]:_0x1bfb2b[_0x5898('0x14')]+_0x1bfb2b[_0x5898('0x16')];var _0x39c9dd;if(_0x3afcbd>=_0x52a406){_0x3afcbd=_0x52a406;_0x39c9dd=0xc8;}else{_0x39c9dd=0xce;}_0x5ba4ea[_0x5898('0x12')](_0x39c9dd);return _0x5ba4ea[_0x5898('0x18')]('Content-Range',_0x319a7e+'-'+_0x3afcbd+'/'+_0x52a406)[_0x5898('0x13')](_0x1b013d);}return null;};}function patchUpdates(_0x449039){return function(_0x5536d7){try{jsonpatch[_0x5898('0x19')](_0x5536d7,_0x449039,!![]);}catch(_0x39b530){return BPromise['reject'](_0x39b530);}return _0x5536d7[_0x5898('0x1a')]();};}function saveUpdates(_0x571f15,_0x341813){return function(_0x30114d){if(_0x30114d){return _0x30114d[_0x5898('0x1b')](_0x571f15)[_0x5898('0x1c')](function(_0x399a69){return _0x399a69;});}return null;};}function removeEntity(_0x425bad,_0x1681f8){return function(_0x51376b){if(_0x51376b){return _0x51376b[_0x5898('0x1d')]()['then'](function(){_0x425bad[_0x5898('0x12')](0xcc)[_0x5898('0x1e')]();});}};}function handleEntityNotFound(_0xf369cf,_0x59bb5f){return function(_0x13e202){if(!_0x13e202){_0xf369cf['sendStatus'](0x194);}return _0x13e202;};}function handleError(_0x591893,_0x3e6699){_0x3e6699=_0x3e6699||0x1f4;return function(_0x22898c){logger[_0x5898('0x1f')](_0x22898c['stack']);if(_0x22898c['name']){delete _0x22898c[_0x5898('0x20')];}_0x591893['status'](_0x3e6699)[_0x5898('0x21')](_0x22898c);};}exports[_0x5898('0x22')]=function(_0x3efd07,_0x256ace){var _0x2f1777={},_0x212c7e={},_0x3a744c={'count':0x0,'rows':[]};var _0x4c0a5f=_[_0x5898('0x23')](db[_0x5898('0x24')]['rawAttributes'],function(_0x5983d1){return{'name':_0x5983d1[_0x5898('0x25')],'type':_0x5983d1[_0x5898('0x26')][_0x5898('0x27')]};});_0x212c7e['model']=_[_0x5898('0x23')](_0x4c0a5f,_0x5898('0x20'));_0x212c7e[_0x5898('0x28')]=_[_0x5898('0x29')](_0x3efd07[_0x5898('0x28')]);_0x212c7e[_0x5898('0x2a')]=_[_0x5898('0x2b')](_0x212c7e[_0x5898('0x2c')],_0x212c7e[_0x5898('0x28')]);_0x2f1777[_0x5898('0x2d')]=_['intersection'](_0x212c7e[_0x5898('0x2c')],qs['fields'](_0x3efd07[_0x5898('0x28')][_0x5898('0x2e')]));_0x2f1777['attributes']=_0x2f1777[_0x5898('0x2d')][_0x5898('0x2f')]?_0x2f1777['attributes']:_0x212c7e['model'];if(!_0x3efd07[_0x5898('0x28')]['hasOwnProperty'](_0x5898('0x30'))){_0x2f1777[_0x5898('0x16')]=qs['limit'](_0x3efd07[_0x5898('0x28')]['limit']);_0x2f1777[_0x5898('0x14')]=qs[_0x5898('0x14')](_0x3efd07['query']['offset']);}_0x2f1777['order']=qs[_0x5898('0x31')](_0x3efd07[_0x5898('0x28')][_0x5898('0x31')]);_0x2f1777[_0x5898('0x32')]=qs[_0x5898('0x2a')](_[_0x5898('0x33')](_0x3efd07[_0x5898('0x28')],_0x212c7e[_0x5898('0x2a')]),_0x4c0a5f);if(_0x3efd07[_0x5898('0x28')][_0x5898('0x34')]){_0x2f1777[_0x5898('0x32')]=_[_0x5898('0x35')](_0x2f1777[_0x5898('0x32')],{'$or':_[_0x5898('0x23')](_0x4c0a5f,function(_0x45ff60){if(_0x45ff60['type']!==_0x5898('0x36')){var _0x51609a={};_0x51609a[_0x45ff60['name']]={'$like':'%'+_0x3efd07[_0x5898('0x28')][_0x5898('0x34')]+'%'};return _0x51609a;}})});}_0x2f1777=_[_0x5898('0x35')]({},_0x2f1777,_0x3efd07[_0x5898('0x37')]);var _0x1b4518={'where':_0x2f1777[_0x5898('0x32')]};return db[_0x5898('0x24')][_0x5898('0x17')](_0x1b4518)['then'](function(_0x4d1d3d){_0x3a744c[_0x5898('0x17')]=_0x4d1d3d;if(_0x3efd07[_0x5898('0x28')][_0x5898('0x38')]){_0x2f1777[_0x5898('0x39')]=[{'all':!![]}];}return db['ZendeskField']['findAll'](_0x2f1777);})[_0x5898('0x1c')](function(_0x4c0446){_0x3a744c['rows']=_0x4c0446;return _0x3a744c;})[_0x5898('0x1c')](respondWithFilteredResult(_0x256ace,_0x2f1777))[_0x5898('0x3a')](handleError(_0x256ace,null));};exports['show']=function(_0x1c24ac,_0xe80604){var _0x3e01b7={'raw':!![],'where':{'id':_0x1c24ac['params']['id']}},_0x126936={};_0x126936[_0x5898('0x2c')]=_[_0x5898('0x29')](db[_0x5898('0x24')][_0x5898('0x3b')]);_0x126936[_0x5898('0x28')]=_[_0x5898('0x29')](_0x1c24ac['query']);_0x126936[_0x5898('0x2a')]=_[_0x5898('0x2b')](_0x126936[_0x5898('0x2c')],_0x126936[_0x5898('0x28')]);_0x3e01b7['attributes']=_['intersection'](_0x126936[_0x5898('0x2c')],qs[_0x5898('0x2e')](_0x1c24ac[_0x5898('0x28')][_0x5898('0x2e')]));_0x3e01b7[_0x5898('0x2d')]=_0x3e01b7['attributes'][_0x5898('0x2f')]?_0x3e01b7['attributes']:_0x126936[_0x5898('0x2c')];if(_0x1c24ac[_0x5898('0x28')][_0x5898('0x38')]){_0x3e01b7['include']=[{'all':!![]}];}_0x3e01b7=_[_0x5898('0x35')]({},_0x3e01b7,_0x1c24ac[_0x5898('0x37')]);return db['ZendeskField'][_0x5898('0x3c')](_0x3e01b7)[_0x5898('0x1c')](handleEntityNotFound(_0xe80604,null))[_0x5898('0x1c')](respondWithResult(_0xe80604,null))['catch'](handleError(_0xe80604,null));};exports['create']=function(_0x816dbc,_0x112316){return db[_0x5898('0x24')][_0x5898('0x3d')](_0x816dbc[_0x5898('0x3e')],{})[_0x5898('0x1c')](respondWithResult(_0x112316,0xc9))[_0x5898('0x3a')](handleError(_0x112316,null));};exports[_0x5898('0x1b')]=function(_0x199728,_0xa7941e){if(_0x199728[_0x5898('0x3e')]['id']){delete _0x199728[_0x5898('0x3e')]['id'];}return db[_0x5898('0x24')][_0x5898('0x3c')]({'where':{'id':_0x199728['params']['id']}})[_0x5898('0x1c')](handleEntityNotFound(_0xa7941e,null))['then'](saveUpdates(_0x199728[_0x5898('0x3e')],null))['then'](respondWithResult(_0xa7941e,null))[_0x5898('0x3a')](handleError(_0xa7941e,null));};exports[_0x5898('0x1d')]=function(_0x5b4e7a,_0x50d1c2){return db[_0x5898('0x24')][_0x5898('0x3c')]({'where':{'id':_0x5b4e7a[_0x5898('0x3f')]['id']}})[_0x5898('0x1c')](handleEntityNotFound(_0x50d1c2,null))[_0x5898('0x1c')](removeEntity(_0x50d1c2,null))['catch'](handleError(_0x50d1c2,null));}; \ No newline at end of file +var _0x32d3=['apply','update','then','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','type','model','query','keys','filters','intersection','fields','length','attributes','hasOwnProperty','nolimit','sort','where','pick','filter','VIRTUAL','merge','options','ZendeskField','count','includeAll','include','findAll','catch','show','params','find','create','body','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','../../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','offset','undefined','limit','Content-Range'];(function(_0x1fc122,_0x5e2c17){var _0xa2cb13=function(_0x263b13){while(--_0x263b13){_0x1fc122['push'](_0x1fc122['shift']());}};_0xa2cb13(++_0x5e2c17);}(_0x32d3,0xbf));var _0x332d=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x32d3[_0x5b644e];return _0x49c6bf;};'use strict';var emlformat=require(_0x332d('0x0'));var rimraf=require(_0x332d('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x332d('0x2'));var rp=require(_0x332d('0x3'));var moment=require(_0x332d('0x4'));var BPromise=require(_0x332d('0x5'));var Mustache=require(_0x332d('0x6'));var util=require(_0x332d('0x7'));var path=require(_0x332d('0x8'));var sox=require(_0x332d('0x9'));var csv=require(_0x332d('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x332d('0xb'));var _=require('lodash');var squel=require(_0x332d('0xc'));var crypto=require(_0x332d('0xd'));var jsforce=require(_0x332d('0xe'));var deskjs=require(_0x332d('0xf'));var toCsv=require(_0x332d('0xa'));var querystring=require(_0x332d('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x332d('0x11'));var qs=require(_0x332d('0x12'));var as=require(_0x332d('0x13'));var hardwareService=require(_0x332d('0x14'));var logger=require(_0x332d('0x15'))('api');var utils=require(_0x332d('0x16'));var config=require(_0x332d('0x17'));var licenseUtil=require(_0x332d('0x18'));var db=require(_0x332d('0x19'))['db'];function respondWithStatusCode(_0x3cf120,_0x3a0a22){_0x3a0a22=_0x3a0a22||0xcc;return function(_0x5de395){if(_0x5de395){return _0x3cf120[_0x332d('0x1a')](_0x3a0a22);}return _0x3cf120['status'](_0x3a0a22)[_0x332d('0x1b')]();};}function respondWithResult(_0x188d3e,_0xd4152a){_0xd4152a=_0xd4152a||0xc8;return function(_0x5ecbde){if(_0x5ecbde){return _0x188d3e[_0x332d('0x1c')](_0xd4152a)[_0x332d('0x1d')](_0x5ecbde);}};}function respondWithFilteredResult(_0x37182c,_0x540941){return function(_0x3d7c65){if(_0x3d7c65){var _0x4402ff=typeof _0x540941[_0x332d('0x1e')]===_0x332d('0x1f')&&typeof _0x540941[_0x332d('0x20')]===_0x332d('0x1f');var _0x2193ad=_0x3d7c65['count'];var _0xab6015=_0x4402ff?0x0:_0x540941['offset'];var _0xd8dbe8=_0x4402ff?_0x3d7c65['count']:_0x540941[_0x332d('0x1e')]+_0x540941['limit'];var _0x1e0393;if(_0xd8dbe8>=_0x2193ad){_0xd8dbe8=_0x2193ad;_0x1e0393=0xc8;}else{_0x1e0393=0xce;}_0x37182c[_0x332d('0x1c')](_0x1e0393);return _0x37182c['set'](_0x332d('0x21'),_0xab6015+'-'+_0xd8dbe8+'/'+_0x2193ad)[_0x332d('0x1d')](_0x3d7c65);}return null;};}function patchUpdates(_0x1ac382){return function(_0x5c2a59){try{jsonpatch[_0x332d('0x22')](_0x5c2a59,_0x1ac382,!![]);}catch(_0xed49a0){return BPromise['reject'](_0xed49a0);}return _0x5c2a59['save']();};}function saveUpdates(_0x4c2076,_0x56acd9){return function(_0x3aad0e){if(_0x3aad0e){return _0x3aad0e[_0x332d('0x23')](_0x4c2076)[_0x332d('0x24')](function(_0x130648){return _0x130648;});}return null;};}function removeEntity(_0x350241,_0x451c29){return function(_0x5aa10c){if(_0x5aa10c){return _0x5aa10c[_0x332d('0x25')]()[_0x332d('0x24')](function(){_0x350241[_0x332d('0x1c')](0xcc)[_0x332d('0x1b')]();});}};}function handleEntityNotFound(_0xcc115e,_0x25ff5f){return function(_0x21c283){if(!_0x21c283){_0xcc115e[_0x332d('0x1a')](0x194);}return _0x21c283;};}function handleError(_0x8d4358,_0x22139e){_0x22139e=_0x22139e||0x1f4;return function(_0xff019b){logger[_0x332d('0x26')](_0xff019b[_0x332d('0x27')]);if(_0xff019b[_0x332d('0x28')]){delete _0xff019b[_0x332d('0x28')];}_0x8d4358[_0x332d('0x1c')](_0x22139e)[_0x332d('0x29')](_0xff019b);};}exports[_0x332d('0x2a')]=function(_0x831b59,_0x5f4304){var _0x43836a={},_0x45860a={},_0x29e1ae={'count':0x0,'rows':[]};var _0x4904d0=_[_0x332d('0x2b')](db['ZendeskField'][_0x332d('0x2c')],function(_0x1931ea){return{'name':_0x1931ea[_0x332d('0x2d')],'type':_0x1931ea[_0x332d('0x2e')]['key']};});_0x45860a[_0x332d('0x2f')]=_[_0x332d('0x2b')](_0x4904d0,_0x332d('0x28'));_0x45860a[_0x332d('0x30')]=_[_0x332d('0x31')](_0x831b59[_0x332d('0x30')]);_0x45860a[_0x332d('0x32')]=_['intersection'](_0x45860a[_0x332d('0x2f')],_0x45860a['query']);_0x43836a['attributes']=_[_0x332d('0x33')](_0x45860a[_0x332d('0x2f')],qs[_0x332d('0x34')](_0x831b59[_0x332d('0x30')][_0x332d('0x34')]));_0x43836a['attributes']=_0x43836a['attributes'][_0x332d('0x35')]?_0x43836a[_0x332d('0x36')]:_0x45860a[_0x332d('0x2f')];if(!_0x831b59[_0x332d('0x30')][_0x332d('0x37')](_0x332d('0x38'))){_0x43836a[_0x332d('0x20')]=qs['limit'](_0x831b59['query']['limit']);_0x43836a[_0x332d('0x1e')]=qs[_0x332d('0x1e')](_0x831b59[_0x332d('0x30')]['offset']);}_0x43836a['order']=qs['sort'](_0x831b59[_0x332d('0x30')][_0x332d('0x39')]);_0x43836a[_0x332d('0x3a')]=qs[_0x332d('0x32')](_[_0x332d('0x3b')](_0x831b59[_0x332d('0x30')],_0x45860a['filters']),_0x4904d0);if(_0x831b59['query'][_0x332d('0x3c')]){_0x43836a[_0x332d('0x3a')]=_['merge'](_0x43836a[_0x332d('0x3a')],{'$or':_[_0x332d('0x2b')](_0x4904d0,function(_0x385673){if(_0x385673['type']!==_0x332d('0x3d')){var _0x1cb44c={};_0x1cb44c[_0x385673[_0x332d('0x28')]]={'$like':'%'+_0x831b59[_0x332d('0x30')][_0x332d('0x3c')]+'%'};return _0x1cb44c;}})});}_0x43836a=_[_0x332d('0x3e')]({},_0x43836a,_0x831b59[_0x332d('0x3f')]);var _0x3b8ae0={'where':_0x43836a['where']};return db[_0x332d('0x40')][_0x332d('0x41')](_0x3b8ae0)[_0x332d('0x24')](function(_0x235e75){_0x29e1ae[_0x332d('0x41')]=_0x235e75;if(_0x831b59['query'][_0x332d('0x42')]){_0x43836a[_0x332d('0x43')]=[{'all':!![]}];}return db[_0x332d('0x40')][_0x332d('0x44')](_0x43836a);})[_0x332d('0x24')](function(_0x116f9e){_0x29e1ae['rows']=_0x116f9e;return _0x29e1ae;})[_0x332d('0x24')](respondWithFilteredResult(_0x5f4304,_0x43836a))[_0x332d('0x45')](handleError(_0x5f4304,null));};exports[_0x332d('0x46')]=function(_0x524240,_0x227f33){var _0x9320ad={'raw':!![],'where':{'id':_0x524240[_0x332d('0x47')]['id']}},_0x35e002={};_0x35e002['model']=_[_0x332d('0x31')](db[_0x332d('0x40')]['rawAttributes']);_0x35e002[_0x332d('0x30')]=_[_0x332d('0x31')](_0x524240[_0x332d('0x30')]);_0x35e002['filters']=_[_0x332d('0x33')](_0x35e002[_0x332d('0x2f')],_0x35e002['query']);_0x9320ad['attributes']=_[_0x332d('0x33')](_0x35e002[_0x332d('0x2f')],qs[_0x332d('0x34')](_0x524240[_0x332d('0x30')][_0x332d('0x34')]));_0x9320ad[_0x332d('0x36')]=_0x9320ad[_0x332d('0x36')][_0x332d('0x35')]?_0x9320ad[_0x332d('0x36')]:_0x35e002['model'];if(_0x524240[_0x332d('0x30')][_0x332d('0x42')]){_0x9320ad[_0x332d('0x43')]=[{'all':!![]}];}_0x9320ad=_[_0x332d('0x3e')]({},_0x9320ad,_0x524240[_0x332d('0x3f')]);return db[_0x332d('0x40')][_0x332d('0x48')](_0x9320ad)[_0x332d('0x24')](handleEntityNotFound(_0x227f33,null))[_0x332d('0x24')](respondWithResult(_0x227f33,null))[_0x332d('0x45')](handleError(_0x227f33,null));};exports[_0x332d('0x49')]=function(_0x1221a3,_0x488743){return db['ZendeskField'][_0x332d('0x49')](_0x1221a3[_0x332d('0x4a')],{})[_0x332d('0x24')](respondWithResult(_0x488743,0xc9))[_0x332d('0x45')](handleError(_0x488743,null));};exports[_0x332d('0x23')]=function(_0xcd025d,_0x5a0576){if(_0xcd025d[_0x332d('0x4a')]['id']){delete _0xcd025d[_0x332d('0x4a')]['id'];}return db[_0x332d('0x40')][_0x332d('0x48')]({'where':{'id':_0xcd025d['params']['id']}})['then'](handleEntityNotFound(_0x5a0576,null))[_0x332d('0x24')](saveUpdates(_0xcd025d['body'],null))[_0x332d('0x24')](respondWithResult(_0x5a0576,null))[_0x332d('0x45')](handleError(_0x5a0576,null));};exports[_0x332d('0x25')]=function(_0x1f4fe7,_0x72accc){return db[_0x332d('0x40')][_0x332d('0x48')]({'where':{'id':_0x1f4fe7[_0x332d('0x47')]['id']}})['then'](handleEntityNotFound(_0x72accc,null))[_0x332d('0x24')](removeEntity(_0x72accc,null))['catch'](handleError(_0x72accc,null));}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.model.js b/server/api/intZendeskField/intZendeskField.model.js index e80a836..8b3c961 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 _0x5676=['moment','request-promise','path','../../config/environment','exports','int_zendesk_fields','zendesk_unique_index','idField','FieldId','lodash','../../config/logger'];(function(_0x17c6bf,_0x514e01){var _0x76b78=function(_0x470039){while(--_0x470039){_0x17c6bf['push'](_0x17c6bf['shift']());}};_0x76b78(++_0x514e01);}(_0x5676,0xcf));var _0x6567=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5676[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x6567('0x0'));var util=require('util');var logger=require(_0x6567('0x1'))('api');var moment=require(_0x6567('0x2'));var BPromise=require('bluebird');var rp=require(_0x6567('0x3'));var fs=require('fs');var path=require(_0x6567('0x4'));var rimraf=require('rimraf');var config=require(_0x6567('0x5'));var attributes=require('./intZendeskField.attributes');module[_0x6567('0x6')]=function(_0x2f33df,_0x312696){return _0x2f33df['define']('ZendeskField',attributes,{'tableName':_0x6567('0x7'),'paranoid':![],'indexes':[{'name':_0x6567('0x8'),'fields':[_0x6567('0x9'),_0x6567('0xa')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xdbb0=['lodash','util','api','moment','bluebird','request-promise','path','../../config/environment','exports','ZendeskField','zendesk_unique_index','idField','FieldId'];(function(_0x423797,_0x3d393b){var _0x57ec0c=function(_0x24c145){while(--_0x24c145){_0x423797['push'](_0x423797['shift']());}};_0x57ec0c(++_0x3d393b);}(_0xdbb0,0x1ad));var _0x0dbb=function(_0x47b295,_0x4120bb){_0x47b295=_0x47b295-0x0;var _0x29003c=_0xdbb0[_0x47b295];return _0x29003c;};'use strict';var _=require(_0x0dbb('0x0'));var util=require(_0x0dbb('0x1'));var logger=require('../../config/logger')(_0x0dbb('0x2'));var moment=require(_0x0dbb('0x3'));var BPromise=require(_0x0dbb('0x4'));var rp=require(_0x0dbb('0x5'));var fs=require('fs');var path=require(_0x0dbb('0x6'));var rimraf=require('rimraf');var config=require(_0x0dbb('0x7'));var attributes=require('./intZendeskField.attributes');module[_0x0dbb('0x8')]=function(_0x56ba47,_0x2c3220){return _0x56ba47['define'](_0x0dbb('0x9'),attributes,{'tableName':'int_zendesk_fields','paranoid':![],'indexes':[{'name':_0x0dbb('0xa'),'fields':[_0x0dbb('0xb'),_0x0dbb('0xc')],'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 43a1938..2e6dc6c 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 _0x2764=['jayson/promise','client','request','then','info','ZendeskField,\x20%s,\x20%s','request\x20sent','debug','ZendeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment'];(function(_0x32e6b9,_0x1ba001){var _0xd18132=function(_0x10af6a){while(--_0x10af6a){_0x32e6b9['push'](_0x32e6b9['shift']());}};_0xd18132(++_0x1ba001);}(_0x2764,0x1d9));var _0x4276=function(_0x14c271,_0x24c63d){_0x14c271=_0x14c271-0x0;var _0x16aa21=_0x2764[_0x14c271];return _0x16aa21;};'use strict';var _=require(_0x4276('0x0'));var util=require(_0x4276('0x1'));var moment=require(_0x4276('0x2'));var BPromise=require(_0x4276('0x3'));var rs=require(_0x4276('0x4'));var fs=require('fs');var Redis=require(_0x4276('0x5'));var db=require(_0x4276('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x4276('0x7'))(_0x4276('0x8'));var config=require(_0x4276('0x9'));var jayson=require(_0x4276('0xa'));var client=jayson[_0x4276('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x730895,_0x526607,_0x332518){return new BPromise(function(_0x2607e0,_0x457391){return client[_0x4276('0xc')](_0x730895,_0x332518)[_0x4276('0xd')](function(_0x39d73d){logger[_0x4276('0xe')](_0x4276('0xf'),_0x526607,_0x4276('0x10'));logger[_0x4276('0x11')](_0x4276('0x12'),_0x526607,'request\x20sent',JSON[_0x4276('0x13')](_0x39d73d));if(_0x39d73d['error']){if(_0x39d73d[_0x4276('0x14')][_0x4276('0x15')]===0x1f4){logger[_0x4276('0x14')]('ZendeskField,\x20%s,\x20%s',_0x526607,_0x39d73d[_0x4276('0x14')][_0x4276('0x16')]);return _0x457391(_0x39d73d['error'][_0x4276('0x16')]);}logger[_0x4276('0x14')](_0x4276('0xf'),_0x526607,_0x39d73d[_0x4276('0x14')][_0x4276('0x16')]);return _0x2607e0(_0x39d73d['error'][_0x4276('0x16')]);}else{logger['info'](_0x4276('0xf'),_0x526607,_0x4276('0x10'));_0x2607e0(_0x39d73d['result'][_0x4276('0x16')]);}})['catch'](function(_0x22cb90){logger[_0x4276('0x14')](_0x4276('0xf'),_0x526607,_0x22cb90);_0x457391(_0x22cb90);});});} \ No newline at end of file +var _0x793e=['../../config/environment','jayson/promise','client','http','info','ZendeskField,\x20%s,\x20%s','request\x20sent','debug','ZendeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x556634,_0x520958){var _0x4429fd=function(_0x1e7eb9){while(--_0x1e7eb9){_0x556634['push'](_0x556634['shift']());}};_0x4429fd(++_0x520958);}(_0x793e,0x81));var _0xe793=function(_0x182fff,_0x568aee){_0x182fff=_0x182fff-0x0;var _0x1b4171=_0x793e[_0x182fff];return _0x1b4171;};'use strict';var _=require('lodash');var util=require(_0xe793('0x0'));var moment=require(_0xe793('0x1'));var BPromise=require(_0xe793('0x2'));var rs=require(_0xe793('0x3'));var fs=require('fs');var Redis=require(_0xe793('0x4'));var db=require(_0xe793('0x5'))['db'];var utils=require(_0xe793('0x6'));var logger=require(_0xe793('0x7'))(_0xe793('0x8'));var config=require(_0xe793('0x9'));var jayson=require(_0xe793('0xa'));var client=jayson[_0xe793('0xb')][_0xe793('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x14f662,_0x4c2521,_0x464188){return new BPromise(function(_0x44e6a4,_0x459084){return client['request'](_0x14f662,_0x464188)['then'](function(_0x338019){logger[_0xe793('0xd')](_0xe793('0xe'),_0x4c2521,_0xe793('0xf'));logger[_0xe793('0x10')](_0xe793('0x11'),_0x4c2521,'request\x20sent',JSON[_0xe793('0x12')](_0x338019));if(_0x338019[_0xe793('0x13')]){if(_0x338019['error'][_0xe793('0x14')]===0x1f4){logger[_0xe793('0x13')](_0xe793('0xe'),_0x4c2521,_0x338019[_0xe793('0x13')][_0xe793('0x15')]);return _0x459084(_0x338019[_0xe793('0x13')]['message']);}logger[_0xe793('0x13')](_0xe793('0xe'),_0x4c2521,_0x338019[_0xe793('0x13')][_0xe793('0x15')]);return _0x44e6a4(_0x338019[_0xe793('0x13')][_0xe793('0x15')]);}else{logger[_0xe793('0xd')](_0xe793('0xe'),_0x4c2521,_0xe793('0xf'));_0x44e6a4(_0x338019[_0xe793('0x16')][_0xe793('0x15')]);}})['catch'](function(_0x437da4){logger['error'](_0xe793('0xe'),_0x4c2521,_0x437da4);_0x459084(_0x437da4);});});} \ No newline at end of file diff --git a/server/api/intZohoAccount/index.js b/server/api/intZohoAccount/index.js index 4f03e53..82c7a99 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 _0x75cc=['isAuthenticated','index','/:id','show','/:id/configurations','/:id/fields','getFields','post','create','update','delete','exports','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoAccount.controller','get'];(function(_0x460fd7,_0x2012db){var _0x44d1c2=function(_0x545e11){while(--_0x545e11){_0x460fd7['push'](_0x460fd7['shift']());}};_0x44d1c2(++_0x2012db);}(_0x75cc,0x1ef));var _0xc75c=function(_0xb7da0e,_0x2adcdb){_0xb7da0e=_0xb7da0e-0x0;var _0x576050=_0x75cc[_0xb7da0e];return _0x576050;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xc75c('0x0'));var timeout=require('connect-timeout');var express=require(_0xc75c('0x1'));var router=express[_0xc75c('0x2')]();var fs_extra=require(_0xc75c('0x3'));var auth=require(_0xc75c('0x4'));var interaction=require(_0xc75c('0x5'));var config=require(_0xc75c('0x6'));var controller=require(_0xc75c('0x7'));router[_0xc75c('0x8')]('/',auth[_0xc75c('0x9')](),controller[_0xc75c('0xa')]);router['get'](_0xc75c('0xb'),auth[_0xc75c('0x9')](),controller[_0xc75c('0xc')]);router[_0xc75c('0x8')](_0xc75c('0xd'),auth['isAuthenticated'](),controller['getConfigurations']);router[_0xc75c('0x8')](_0xc75c('0xe'),auth[_0xc75c('0x9')](),controller[_0xc75c('0xf')]);router[_0xc75c('0x10')]('/',auth[_0xc75c('0x9')](),controller[_0xc75c('0x11')]);router[_0xc75c('0x10')](_0xc75c('0xd'),auth[_0xc75c('0x9')](),controller['addConfiguration']);router['put'](_0xc75c('0xb'),auth[_0xc75c('0x9')](),controller[_0xc75c('0x12')]);router[_0xc75c('0x13')](_0xc75c('0xb'),auth[_0xc75c('0x9')](),controller['destroy']);module[_0xc75c('0x14')]=router; \ No newline at end of file +var _0xa43d=['multer','util','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoAccount.controller','get','isAuthenticated','index','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','/:id','destroy'];(function(_0x275746,_0x37c6ed){var _0x5f1900=function(_0x2a6555){while(--_0x2a6555){_0x275746['push'](_0x275746['shift']());}};_0x5f1900(++_0x37c6ed);}(_0xa43d,0x159));var _0xda43=function(_0x45943c,_0x292e90){_0x45943c=_0x45943c-0x0;var _0xe1cf98=_0xa43d[_0x45943c];return _0xe1cf98;};'use strict';var multer=require(_0xda43('0x0'));var util=require(_0xda43('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xda43('0x2'));var router=express['Router']();var fs_extra=require(_0xda43('0x3'));var auth=require(_0xda43('0x4'));var interaction=require(_0xda43('0x5'));var config=require(_0xda43('0x6'));var controller=require(_0xda43('0x7'));router[_0xda43('0x8')]('/',auth[_0xda43('0x9')](),controller[_0xda43('0xa')]);router[_0xda43('0x8')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0xda43('0x8')](_0xda43('0xb'),auth['isAuthenticated'](),controller[_0xda43('0xc')]);router[_0xda43('0x8')](_0xda43('0xd'),auth[_0xda43('0x9')](),controller[_0xda43('0xe')]);router[_0xda43('0xf')]('/',auth[_0xda43('0x9')](),controller[_0xda43('0x10')]);router[_0xda43('0xf')](_0xda43('0xb'),auth['isAuthenticated'](),controller[_0xda43('0x11')]);router[_0xda43('0x12')]('/:id',auth[_0xda43('0x9')](),controller[_0xda43('0x13')]);router[_0xda43('0x14')](_0xda43('0x15'),auth['isAuthenticated'](),controller[_0xda43('0x16')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.attributes.js b/server/api/intZohoAccount/intZohoAccount.attributes.js index ce41438..7e88156 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 _0x6f0d=['exports','STRING'];(function(_0x235e0c,_0x19813c){var _0x3f0c5f=function(_0x4c7eab){while(--_0x4c7eab){_0x235e0c['push'](_0x235e0c['shift']());}};_0x3f0c5f(++_0x19813c);}(_0x6f0d,0x16c));var _0xd6f0=function(_0xee2283,_0xa387b3){_0xee2283=_0xee2283-0x0;var _0x21c824=_0x6f0d[_0xee2283];return _0x21c824;};'use strict';var Sequelize=require('sequelize');module[_0xd6f0('0x0')]={'name':{'type':Sequelize[_0xd6f0('0x1')]},'description':{'type':Sequelize[_0xd6f0('0x1')]},'host':{'type':Sequelize[_0xd6f0('0x1')]},'zone':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize[_0xd6f0('0x1')]},'clientSecret':{'type':Sequelize[_0xd6f0('0x1')]},'serverUrl':{'type':Sequelize[_0xd6f0('0x1')],'allowNull':![]},'code':{'type':Sequelize[_0xd6f0('0x1')]},'refreshToken':{'type':Sequelize[_0xd6f0('0x1')]}}; \ No newline at end of file +var _0x17ba=['sequelize','exports','STRING'];(function(_0x332109,_0x474add){var _0x7a6ab2=function(_0x5132dd){while(--_0x5132dd){_0x332109['push'](_0x332109['shift']());}};_0x7a6ab2(++_0x474add);}(_0x17ba,0xab));var _0xa17b=function(_0x529c00,_0x298516){_0x529c00=_0x529c00-0x0;var _0x10bbf7=_0x17ba[_0x529c00];return _0x10bbf7;};'use strict';var Sequelize=require(_0xa17b('0x0'));module[_0xa17b('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xa17b('0x2')]},'host':{'type':Sequelize[_0xa17b('0x2')]},'zone':{'type':Sequelize[_0xa17b('0x2')]},'clientId':{'type':Sequelize[_0xa17b('0x2')]},'clientSecret':{'type':Sequelize[_0xa17b('0x2')]},'serverUrl':{'type':Sequelize[_0xa17b('0x2')],'allowNull':![]},'code':{'type':Sequelize[_0xa17b('0x2')]},'refreshToken':{'type':Sequelize[_0xa17b('0x2')]}}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.controller.js b/server/api/intZohoAccount/intZohoAccount.controller.js index 2254d72..7b0d774 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 _0x8827=['count','offset','set','Content-Range','apply','reject','save','then','destroy','error','stack','name','send','map','ZohoAccount','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','limit','where','pick','filter','VIRTUAL','merge','options','includeAll','findAll','rows','catch','show','rawAttributes','include','create','body','find','params','getConfigurations','findOne','ZohoConfiguration','order','hasOwnProperty','nolimit','addConfiguration','getSubjects','channel','Descriptions','getDescriptions','ZohoField','Subjects','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','/oauth/v2/token','refreshToken','clientId','clientSecret','access_token','Unable\x20to\x20retrieve\x20the\x20access\x20token','host','zone','serverUrl','code','zoho.eu','substring','lastIndexOf','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','https://www.zohoapis.%s/crm/v2/settings/fields','Calls','Zoho-oauthtoken\x20','response','message','Owner','Subject','Description','WhoId','Call_Start_Time','Call_Type','remove','includes','api_name','system_mandatory','push','display_label','data_type','picklist','pick_list_values','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','stringify','Wrong\x20credentials','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../components/integrations/configuration','sendStatus','status','end','json'];(function(_0x1fb2cd,_0x213c0f){var _0x39a37f=function(_0x435908){while(--_0x435908){_0x1fb2cd['push'](_0x1fb2cd['shift']());}};_0x39a37f(++_0x213c0f);}(_0x8827,0x1e4));var _0x7882=function(_0x4a9dae,_0x1ca5a3){_0x4a9dae=_0x4a9dae-0x0;var _0x30a62e=_0x8827[_0x4a9dae];return _0x30a62e;};'use strict';var emlformat=require(_0x7882('0x0'));var rimraf=require(_0x7882('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x7882('0x2'));var rp=require(_0x7882('0x3'));var moment=require(_0x7882('0x4'));var BPromise=require(_0x7882('0x5'));var Mustache=require(_0x7882('0x6'));var util=require(_0x7882('0x7'));var path=require(_0x7882('0x8'));var sox=require(_0x7882('0x9'));var csv=require(_0x7882('0xa'));var ejs=require(_0x7882('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7882('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x7882('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x7882('0xe'));var Papa=require(_0x7882('0xf'));var Redis=require('ioredis');var authService=require(_0x7882('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x7882('0x11'));var hardwareService=require(_0x7882('0x12'));var logger=require(_0x7882('0x13'))('api');var utils=require(_0x7882('0x14'));var config=require(_0x7882('0x15'));var licenseUtil=require(_0x7882('0x16'));var db=require('../../mysqldb')['db'];var integrations=require(_0x7882('0x17'));function respondWithStatusCode(_0xec214c,_0x7bd458){_0x7bd458=_0x7bd458||0xcc;return function(_0x453365){if(_0x453365){return _0xec214c[_0x7882('0x18')](_0x7bd458);}return _0xec214c[_0x7882('0x19')](_0x7bd458)[_0x7882('0x1a')]();};}function respondWithResult(_0x2cc1d1,_0x452e0a){_0x452e0a=_0x452e0a||0xc8;return function(_0x1553fc){if(_0x1553fc){return _0x2cc1d1[_0x7882('0x19')](_0x452e0a)[_0x7882('0x1b')](_0x1553fc);}};}function respondWithFilteredResult(_0x452589,_0x594c55){return function(_0x4e820d){if(_0x4e820d){var _0x19d51c=typeof _0x594c55['offset']==='undefined'&&typeof _0x594c55['limit']==='undefined';var _0x49b46b=_0x4e820d[_0x7882('0x1c')];var _0x34f95f=_0x19d51c?0x0:_0x594c55[_0x7882('0x1d')];var _0x267137=_0x19d51c?_0x4e820d[_0x7882('0x1c')]:_0x594c55['offset']+_0x594c55['limit'];var _0x459fab;if(_0x267137>=_0x49b46b){_0x267137=_0x49b46b;_0x459fab=0xc8;}else{_0x459fab=0xce;}_0x452589[_0x7882('0x19')](_0x459fab);return _0x452589[_0x7882('0x1e')](_0x7882('0x1f'),_0x34f95f+'-'+_0x267137+'/'+_0x49b46b)[_0x7882('0x1b')](_0x4e820d);}return null;};}function patchUpdates(_0x56ccf6){return function(_0x22ae12){try{jsonpatch[_0x7882('0x20')](_0x22ae12,_0x56ccf6,!![]);}catch(_0x2ce1c6){return BPromise[_0x7882('0x21')](_0x2ce1c6);}return _0x22ae12[_0x7882('0x22')]();};}function saveUpdates(_0x54a595,_0x3b7aea){return function(_0x1a25fe){if(_0x1a25fe){return _0x1a25fe['update'](_0x54a595)[_0x7882('0x23')](function(_0x220b7e){return _0x220b7e;});}return null;};}function removeEntity(_0x59f8e9,_0x445d9b){return function(_0x360265){if(_0x360265){return _0x360265[_0x7882('0x24')]()[_0x7882('0x23')](function(){_0x59f8e9[_0x7882('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x124e6d,_0x366f06){return function(_0x51ca8d){if(!_0x51ca8d){_0x124e6d[_0x7882('0x18')](0x194);}return _0x51ca8d;};}function handleError(_0x368f74,_0xba09bb){_0xba09bb=_0xba09bb||0x1f4;return function(_0x9883e5){logger[_0x7882('0x25')](_0x9883e5[_0x7882('0x26')]);if(_0x9883e5[_0x7882('0x27')]){delete _0x9883e5[_0x7882('0x27')];}_0x368f74[_0x7882('0x19')](_0xba09bb)[_0x7882('0x28')](_0x9883e5);};}exports['index']=function(_0x518a66,_0x50a440){var _0x47559f={},_0xc6540c={},_0x37e31d={'count':0x0,'rows':[]};var _0x444294=_[_0x7882('0x29')](db[_0x7882('0x2a')]['rawAttributes'],function(_0x1475eb){return{'name':_0x1475eb[_0x7882('0x2b')],'type':_0x1475eb[_0x7882('0x2c')][_0x7882('0x2d')]};});_0xc6540c[_0x7882('0x2e')]=_[_0x7882('0x29')](_0x444294,_0x7882('0x27'));_0xc6540c['query']=_[_0x7882('0x2f')](_0x518a66[_0x7882('0x30')]);_0xc6540c[_0x7882('0x31')]=_[_0x7882('0x32')](_0xc6540c[_0x7882('0x2e')],_0xc6540c[_0x7882('0x30')]);_0x47559f[_0x7882('0x33')]=_[_0x7882('0x32')](_0xc6540c['model'],qs['fields'](_0x518a66[_0x7882('0x30')][_0x7882('0x34')]));_0x47559f[_0x7882('0x33')]=_0x47559f[_0x7882('0x33')][_0x7882('0x35')]?_0x47559f['attributes']:_0xc6540c[_0x7882('0x2e')];if(!_0x518a66['query']['hasOwnProperty']('nolimit')){_0x47559f[_0x7882('0x36')]=qs['limit'](_0x518a66['query']['limit']);_0x47559f[_0x7882('0x1d')]=qs['offset'](_0x518a66[_0x7882('0x30')][_0x7882('0x1d')]);}_0x47559f['order']=qs['sort'](_0x518a66['query']['sort']);_0x47559f[_0x7882('0x37')]=qs['filters'](_[_0x7882('0x38')](_0x518a66[_0x7882('0x30')],_0xc6540c['filters']),_0x444294);if(_0x518a66[_0x7882('0x30')][_0x7882('0x39')]){_0x47559f[_0x7882('0x37')]=_['merge'](_0x47559f['where'],{'$or':_[_0x7882('0x29')](_0x444294,function(_0x1b4dd9){if(_0x1b4dd9['type']!==_0x7882('0x3a')){var _0x2275be={};_0x2275be[_0x1b4dd9[_0x7882('0x27')]]={'$like':'%'+_0x518a66[_0x7882('0x30')]['filter']+'%'};return _0x2275be;}})});}_0x47559f=_[_0x7882('0x3b')]({},_0x47559f,_0x518a66[_0x7882('0x3c')]);var _0x3e85b4={'where':_0x47559f[_0x7882('0x37')]};return db[_0x7882('0x2a')]['count'](_0x3e85b4)[_0x7882('0x23')](function(_0x483153){_0x37e31d['count']=_0x483153;if(_0x518a66[_0x7882('0x30')][_0x7882('0x3d')]){_0x47559f['include']=[{'all':!![]}];}return db[_0x7882('0x2a')][_0x7882('0x3e')](_0x47559f);})[_0x7882('0x23')](function(_0x3f15cd){_0x37e31d[_0x7882('0x3f')]=_0x3f15cd;return _0x37e31d;})[_0x7882('0x23')](respondWithFilteredResult(_0x50a440,_0x47559f))[_0x7882('0x40')](handleError(_0x50a440,null));};exports[_0x7882('0x41')]=function(_0x18d86a,_0x1015dd){var _0x42f229={'raw':![],'where':{'id':_0x18d86a['params']['id']}},_0x17e94={};_0x17e94[_0x7882('0x2e')]=_['keys'](db[_0x7882('0x2a')][_0x7882('0x42')]);_0x17e94[_0x7882('0x30')]=_[_0x7882('0x2f')](_0x18d86a[_0x7882('0x30')]);_0x17e94[_0x7882('0x31')]=_[_0x7882('0x32')](_0x17e94['model'],_0x17e94['query']);_0x42f229[_0x7882('0x33')]=_[_0x7882('0x32')](_0x17e94[_0x7882('0x2e')],qs['fields'](_0x18d86a[_0x7882('0x30')][_0x7882('0x34')]));_0x42f229['attributes']=_0x42f229['attributes'][_0x7882('0x35')]?_0x42f229[_0x7882('0x33')]:_0x17e94[_0x7882('0x2e')];if(_0x18d86a[_0x7882('0x30')][_0x7882('0x3d')]){_0x42f229[_0x7882('0x43')]=[{'all':!![]}];}_0x42f229=_[_0x7882('0x3b')]({},_0x42f229,_0x18d86a[_0x7882('0x3c')]);return db[_0x7882('0x2a')]['find'](_0x42f229)['then'](handleEntityNotFound(_0x1015dd,null))[_0x7882('0x23')](respondWithResult(_0x1015dd,null))['catch'](handleError(_0x1015dd,null));};exports['create']=function(_0x1dd7cc,_0x5c6c6f){return db[_0x7882('0x2a')][_0x7882('0x44')](_0x1dd7cc['body'],{})[_0x7882('0x23')](respondWithResult(_0x5c6c6f,0xc9))['catch'](handleError(_0x5c6c6f,null));};exports['update']=function(_0x15ab38,_0x461982){if(_0x15ab38[_0x7882('0x45')]['id']){delete _0x15ab38[_0x7882('0x45')]['id'];}return db[_0x7882('0x2a')][_0x7882('0x46')]({'where':{'id':_0x15ab38[_0x7882('0x47')]['id']}})[_0x7882('0x23')](handleEntityNotFound(_0x461982,null))['then'](saveUpdates(_0x15ab38[_0x7882('0x45')],null))[_0x7882('0x23')](respondWithResult(_0x461982,null))[_0x7882('0x40')](handleError(_0x461982,null));};exports[_0x7882('0x24')]=function(_0x52c55b,_0x4cd9bc){return db[_0x7882('0x2a')][_0x7882('0x46')]({'where':{'id':_0x52c55b['params']['id']}})[_0x7882('0x23')](handleEntityNotFound(_0x4cd9bc,null))[_0x7882('0x23')](removeEntity(_0x4cd9bc,null))[_0x7882('0x40')](handleError(_0x4cd9bc,null));};exports[_0x7882('0x48')]=function(_0x1ea966,_0x15cfa1,_0xc86566){var _0x2307e2={};var _0x2ec86a={};var _0x21724c;var _0x2ae6e4;return db['ZohoAccount'][_0x7882('0x49')]({'where':{'id':_0x1ea966['params']['id']}})[_0x7882('0x23')](handleEntityNotFound(_0x15cfa1,null))[_0x7882('0x23')](function(_0x581f53){if(_0x581f53){_0x21724c=_0x581f53;_0x2ec86a['model']=_[_0x7882('0x2f')](db[_0x7882('0x4a')][_0x7882('0x42')]);_0x2ec86a['query']=_[_0x7882('0x2f')](_0x1ea966[_0x7882('0x30')]);_0x2ec86a[_0x7882('0x31')]=_[_0x7882('0x32')](_0x2ec86a[_0x7882('0x2e')],_0x2ec86a[_0x7882('0x30')]);_0x2307e2['attributes']=_[_0x7882('0x32')](_0x2ec86a[_0x7882('0x2e')],qs[_0x7882('0x34')](_0x1ea966['query'][_0x7882('0x34')]));_0x2307e2[_0x7882('0x33')]=_0x2307e2['attributes'][_0x7882('0x35')]?_0x2307e2[_0x7882('0x33')]:_0x2ec86a[_0x7882('0x2e')];_0x2307e2[_0x7882('0x4b')]=qs['sort'](_0x1ea966['query']['sort']);_0x2307e2[_0x7882('0x37')]=qs[_0x7882('0x31')](_[_0x7882('0x38')](_0x1ea966['query'],_0x2ec86a[_0x7882('0x31')]));if(_0x1ea966[_0x7882('0x30')][_0x7882('0x39')]){_0x2307e2['where']=_['merge'](_0x2307e2[_0x7882('0x37')],{'$or':_['map'](_0x2307e2[_0x7882('0x33')],function(_0x5855b0){var _0x689ee1={};_0x689ee1[_0x5855b0]={'$like':'%'+_0x1ea966[_0x7882('0x30')]['filter']+'%'};return _0x689ee1;})});}_0x2307e2=_[_0x7882('0x3b')]({},_0x2307e2,_0x1ea966['options']);return _0x21724c['getConfigurations'](_0x2307e2);}})[_0x7882('0x23')](function(_0x1e398b){if(_0x1e398b){_0x2ae6e4=_0x1e398b[_0x7882('0x35')];if(!_0x1ea966[_0x7882('0x30')][_0x7882('0x4c')](_0x7882('0x4d'))){_0x2307e2[_0x7882('0x36')]=qs[_0x7882('0x36')](_0x1ea966['query'][_0x7882('0x36')]);_0x2307e2['offset']=qs[_0x7882('0x1d')](_0x1ea966[_0x7882('0x30')][_0x7882('0x1d')]);}return _0x21724c[_0x7882('0x48')](_0x2307e2);}})[_0x7882('0x23')](function(_0x317bc6){if(_0x317bc6){return _0x317bc6?{'count':_0x2ae6e4,'rows':_0x317bc6}:null;}})[_0x7882('0x23')](respondWithResult(_0x15cfa1,null))[_0x7882('0x40')](handleError(_0x15cfa1,null));};exports[_0x7882('0x4e')]=function(_0x1becab,_0x17919f,_0x172723){if(_0x1becab[_0x7882('0x45')]['id']){delete _0x1becab[_0x7882('0x45')]['id'];}return db[_0x7882('0x2a')][_0x7882('0x49')]({'where':{'id':_0x1becab[_0x7882('0x47')]['id']}})[_0x7882('0x23')](handleEntityNotFound(_0x17919f,null))['then'](function(_0x167398){if(_0x167398){_0x1becab['body']['AccountId']=_0x167398['id'];_0x1becab['body']['Subjects']=integrations[_0x7882('0x4f')](_0x1becab['body'][_0x7882('0x50')],_0x1becab[_0x7882('0x45')]['type']);_0x1becab[_0x7882('0x45')][_0x7882('0x51')]=integrations[_0x7882('0x52')](_0x1becab[_0x7882('0x45')][_0x7882('0x50')],_0x1becab[_0x7882('0x45')]['type']);return db[_0x7882('0x4a')][_0x7882('0x44')](_0x1becab['body'],{'include':[{'model':db[_0x7882('0x53')],'as':_0x7882('0x54')},{'model':db[_0x7882('0x53')],'as':'Descriptions'}]});}return null;})['then'](respondWithResult(_0x17919f,null))[_0x7882('0x40')](handleError(_0x17919f,null));};function getAccessToken(_0x51593f){return new Promise(function(_0x3a42ba,_0x50765b){var _0x5d37bf;switch(_0x51593f['zone']){case'US':_0x5d37bf=_0x7882('0x55');break;case'AU':_0x5d37bf=_0x7882('0x56');break;case'EU':_0x5d37bf='https://accounts.zoho.eu';break;case'IN':_0x5d37bf='https://accounts.zoho.in';break;case'CN':_0x5d37bf='https://accounts.zoho.com.cn';break;default:_0x5d37bf=_0x7882('0x57');break;}var _0x5406da={'method':'POST','uri':_0x5d37bf+_0x7882('0x58'),'qs':{'refresh_token':_0x51593f[_0x7882('0x59')],'client_id':_0x51593f[_0x7882('0x5a')],'client_secret':_0x51593f[_0x7882('0x5b')],'grant_type':'refresh_token'},'json':!![]};return rp(_0x5406da)['then'](function(_0x57aa64){if(_0x57aa64[_0x7882('0x5c')]){_0x3a42ba(_0x57aa64[_0x7882('0x5c')]);}else{_0x50765b(_0x7882('0x5d'));}})[_0x7882('0x40')](function(_0x4bb2cd){_0x50765b(_0x4bb2cd);});});}exports['getFields']=function(_0x511dd7,_0x2b09c8,_0x145c5b){var _0xfea3a8,_0x5af2a1,_0x288ebf,_0x7698ca,_0x32201b;return db[_0x7882('0x2a')][_0x7882('0x49')]({'where':{'id':_0x511dd7[_0x7882('0x47')]['id']},'attributes':['id',_0x7882('0x5e'),_0x7882('0x5f'),_0x7882('0x5a'),_0x7882('0x5b'),_0x7882('0x60'),_0x7882('0x61'),_0x7882('0x59')]})[_0x7882('0x23')](handleEntityNotFound(_0x2b09c8,null))[_0x7882('0x23')](function(_0x44bf89){_0x32201b=_0x44bf89;_0xfea3a8=_0x32201b[_0x7882('0x5e')];_0x5af2a1=_0xfea3a8===_0x7882('0x62')?'eu':'com';_0x288ebf=_0x32201b[_0x7882('0x60')];var _0x56eac2=_0x288ebf['slice'](-0x1);if(_0x56eac2==='/'||_0x56eac2==='\x5c'||_0x56eac2===':'){_0x288ebf=_0x288ebf[_0x7882('0x63')](0x0,_0x288ebf[_0x7882('0x64')](_0x56eac2));}if(!_0x32201b['refreshToken']){throw new Error(_0x7882('0x65'));}return getAccessToken(_0x32201b);})[_0x7882('0x23')](function(_0x1f3616){if(_0x1f3616){return rp({'method':'GET','uri':util['format'](_0x7882('0x66'),_0x5af2a1),'qs':{'module':_0x7882('0x67')},'headers':{'Authorization':_0x7882('0x68')+_0x1f3616},'json':!![]});}})['then'](function(_0x544f6a){if(_0x544f6a){if(_0x544f6a[_0x7882('0x69')]&&_0x544f6a[_0x7882('0x69')][_0x7882('0x25')]){throw new Error(_0x544f6a[_0x7882('0x69')][_0x7882('0x25')][_0x7882('0x6a')]);}var _0x2d6e53=[];var _0x358676=[];var _0x2339d3=[_0x7882('0x6b'),_0x7882('0x6c'),_0x7882('0x6d'),_0x7882('0x6e'),'Call_Duration','Call_Result',_0x7882('0x6f'),_0x7882('0x70')];_0x358676=_[_0x7882('0x71')](_0x544f6a[_0x7882('0x34')],function(_0x41935a){return _0x2339d3[_0x7882('0x72')](_0x41935a[_0x7882('0x73')]);});for(var _0x2d6356=0x0;_0x2d6356<_0x358676['length'];_0x2d6356++){if(_0x358676[_0x2d6356][_0x7882('0x74')]===![]){_0x2d6e53[_0x7882('0x75')]({'id':_0x358676[_0x2d6356]['id'],'name':_0x358676[_0x2d6356][_0x7882('0x76')],'custom':_0x358676[_0x2d6356]['custom_field'],'options':_0x358676[_0x2d6356][_0x7882('0x77')]===_0x7882('0x78')&&_0x358676[_0x2d6356][_0x7882('0x79')][_0x7882('0x35')]>-0x1?_[_0x7882('0x29')](_0x358676[_0x2d6356][_0x7882('0x79')],function(_0x5498f9){return{'name':_0x5498f9,'value':_0x5498f9};}):[]});}}return{'count':_0x2d6e53['length'],'rows':_0x2d6e53};}else{return{'count':0x0,'rows':[]};}})[_0x7882('0x23')](respondWithResult(_0x2b09c8,null))['catch'](function(_0x1c9f58){var _0x342414=_0x511dd7[_0x7882('0x30')][_0x7882('0x7a')]?0x1f4:_0x1c9f58[_0x7882('0x7b')]||0x1f4;logger[_0x7882('0x25')](_0x7882('0x7c'),_0x7882('0x7d'),_0x342414,JSON[_0x7882('0x7e')](_0x1c9f58));delete _0x1c9f58[_0x7882('0x27')];if(_0x342414===0x191){_0x342414=0x190;}_0x2b09c8[_0x7882('0x19')](_0x342414)['send'](_0x511dd7['query'][_0x7882('0x7a')]?{'message':_0x7882('0x7f'),'statusCode':_0x1c9f58[_0x7882('0x7b')]}:_0x1c9f58);});}; \ No newline at end of file +var _0x4965=['end','status','json','offset','undefined','limit','count','set','apply','reject','save','update','then','error','stack','name','send','index','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','sort','where','pick','map','VIRTUAL','filter','merge','options','include','ZohoAccount','findAll','rows','params','keys','length','includeAll','find','catch','create','body','destroy','getConfigurations','ZohoConfiguration','order','findOne','AccountId','Subjects','channel','Descriptions','getDescriptions','ZohoField','zone','https://accounts.zoho.in','https://accounts.zoho.com.cn','https://accounts.zoho.eu','POST','refreshToken','clientId','clientSecret','access_token','Unable\x20to\x20retrieve\x20the\x20access\x20token','host','serverUrl','zoho.eu','com','slice','substring','lastIndexOf','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','Calls','Zoho-oauthtoken\x20','response','message','Owner','Subject','WhoId','Call_Duration','Call_Result','Call_Start_Time','Call_Type','remove','includes','api_name','push','display_label','custom_field','data_type','picklist','pick_list_values','statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','stringify','Wrong\x20credentials','eml-format','rimraf','zip-dir','bluebird','util','path','sox','ejs','fs-extra','lodash','squel','jsforce','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','../../components/integrations/configuration','sendStatus'];(function(_0x2dc201,_0x4d6980){var _0xfc06b2=function(_0xade7fc){while(--_0xade7fc){_0x2dc201['push'](_0x2dc201['shift']());}};_0xfc06b2(++_0x4d6980);}(_0x4965,0x16e));var _0x5496=function(_0x303310,_0x3d6211){_0x303310=_0x303310-0x0;var _0x1e4370=_0x4965[_0x303310];return _0x1e4370;};'use strict';var emlformat=require(_0x5496('0x0'));var rimraf=require(_0x5496('0x1'));var zipdir=require(_0x5496('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x5496('0x3'));var Mustache=require('mustache');var util=require(_0x5496('0x4'));var path=require(_0x5496('0x5'));var sox=require(_0x5496('0x6'));var csv=require('to-csv');var ejs=require(_0x5496('0x7'));var fs=require('fs');var fs_extra=require(_0x5496('0x8'));var _=require(_0x5496('0x9'));var squel=require(_0x5496('0xa'));var crypto=require('crypto');var jsforce=require(_0x5496('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x5496('0xc'));var querystring=require(_0x5496('0xd'));var Papa=require(_0x5496('0xe'));var Redis=require('ioredis');var authService=require(_0x5496('0xf'));var qs=require(_0x5496('0x10'));var as=require(_0x5496('0x11'));var hardwareService=require(_0x5496('0x12'));var logger=require(_0x5496('0x13'))(_0x5496('0x14'));var utils=require(_0x5496('0x15'));var config=require(_0x5496('0x16'));var licenseUtil=require(_0x5496('0x17'));var db=require(_0x5496('0x18'))['db'];var integrations=require(_0x5496('0x19'));function respondWithStatusCode(_0x3a7353,_0x39f846){_0x39f846=_0x39f846||0xcc;return function(_0x45c7fb){if(_0x45c7fb){return _0x3a7353[_0x5496('0x1a')](_0x39f846);}return _0x3a7353['status'](_0x39f846)[_0x5496('0x1b')]();};}function respondWithResult(_0x3b6d0f,_0x27072e){_0x27072e=_0x27072e||0xc8;return function(_0x35520e){if(_0x35520e){return _0x3b6d0f[_0x5496('0x1c')](_0x27072e)[_0x5496('0x1d')](_0x35520e);}};}function respondWithFilteredResult(_0xe68124,_0x2f746c){return function(_0x4c7317){if(_0x4c7317){var _0x4bf295=typeof _0x2f746c[_0x5496('0x1e')]===_0x5496('0x1f')&&typeof _0x2f746c[_0x5496('0x20')]===_0x5496('0x1f');var _0x333c6d=_0x4c7317[_0x5496('0x21')];var _0x165c58=_0x4bf295?0x0:_0x2f746c[_0x5496('0x1e')];var _0x11beb8=_0x4bf295?_0x4c7317['count']:_0x2f746c['offset']+_0x2f746c[_0x5496('0x20')];var _0x1258f8;if(_0x11beb8>=_0x333c6d){_0x11beb8=_0x333c6d;_0x1258f8=0xc8;}else{_0x1258f8=0xce;}_0xe68124[_0x5496('0x1c')](_0x1258f8);return _0xe68124[_0x5496('0x22')]('Content-Range',_0x165c58+'-'+_0x11beb8+'/'+_0x333c6d)[_0x5496('0x1d')](_0x4c7317);}return null;};}function patchUpdates(_0x2df542){return function(_0x58b5a2){try{jsonpatch[_0x5496('0x23')](_0x58b5a2,_0x2df542,!![]);}catch(_0x2435fb){return BPromise[_0x5496('0x24')](_0x2435fb);}return _0x58b5a2[_0x5496('0x25')]();};}function saveUpdates(_0x23bd12,_0x408716){return function(_0x25a988){if(_0x25a988){return _0x25a988[_0x5496('0x26')](_0x23bd12)[_0x5496('0x27')](function(_0x203876){return _0x203876;});}return null;};}function removeEntity(_0x394551,_0x1ab3ca){return function(_0x385134){if(_0x385134){return _0x385134['destroy']()[_0x5496('0x27')](function(){_0x394551['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4bce20,_0xc6e98b){return function(_0x409d64){if(!_0x409d64){_0x4bce20[_0x5496('0x1a')](0x194);}return _0x409d64;};}function handleError(_0x2a5e6b,_0x21bad5){_0x21bad5=_0x21bad5||0x1f4;return function(_0x3253aa){logger[_0x5496('0x28')](_0x3253aa[_0x5496('0x29')]);if(_0x3253aa[_0x5496('0x2a')]){delete _0x3253aa[_0x5496('0x2a')];}_0x2a5e6b['status'](_0x21bad5)[_0x5496('0x2b')](_0x3253aa);};}exports[_0x5496('0x2c')]=function(_0x519bd7,_0x802f78){var _0x1ff1a0={},_0x119a56={},_0x47dfa7={'count':0x0,'rows':[]};var _0x57358c=_['map'](db['ZohoAccount'][_0x5496('0x2d')],function(_0x36a421){return{'name':_0x36a421[_0x5496('0x2e')],'type':_0x36a421[_0x5496('0x2f')][_0x5496('0x30')]};});_0x119a56[_0x5496('0x31')]=_['map'](_0x57358c,_0x5496('0x2a'));_0x119a56[_0x5496('0x32')]=_['keys'](_0x519bd7[_0x5496('0x32')]);_0x119a56[_0x5496('0x33')]=_[_0x5496('0x34')](_0x119a56[_0x5496('0x31')],_0x119a56['query']);_0x1ff1a0['attributes']=_[_0x5496('0x34')](_0x119a56[_0x5496('0x31')],qs[_0x5496('0x35')](_0x519bd7[_0x5496('0x32')][_0x5496('0x35')]));_0x1ff1a0[_0x5496('0x36')]=_0x1ff1a0[_0x5496('0x36')]['length']?_0x1ff1a0['attributes']:_0x119a56[_0x5496('0x31')];if(!_0x519bd7['query'][_0x5496('0x37')](_0x5496('0x38'))){_0x1ff1a0[_0x5496('0x20')]=qs[_0x5496('0x20')](_0x519bd7[_0x5496('0x32')]['limit']);_0x1ff1a0[_0x5496('0x1e')]=qs['offset'](_0x519bd7[_0x5496('0x32')][_0x5496('0x1e')]);}_0x1ff1a0['order']=qs[_0x5496('0x39')](_0x519bd7[_0x5496('0x32')]['sort']);_0x1ff1a0[_0x5496('0x3a')]=qs[_0x5496('0x33')](_[_0x5496('0x3b')](_0x519bd7[_0x5496('0x32')],_0x119a56['filters']),_0x57358c);if(_0x519bd7['query']['filter']){_0x1ff1a0[_0x5496('0x3a')]=_['merge'](_0x1ff1a0['where'],{'$or':_[_0x5496('0x3c')](_0x57358c,function(_0x265b6d){if(_0x265b6d['type']!==_0x5496('0x3d')){var _0x2426b8={};_0x2426b8[_0x265b6d['name']]={'$like':'%'+_0x519bd7[_0x5496('0x32')][_0x5496('0x3e')]+'%'};return _0x2426b8;}})});}_0x1ff1a0=_[_0x5496('0x3f')]({},_0x1ff1a0,_0x519bd7[_0x5496('0x40')]);var _0x1af21b={'where':_0x1ff1a0['where']};return db['ZohoAccount'][_0x5496('0x21')](_0x1af21b)[_0x5496('0x27')](function(_0x4dffd2){_0x47dfa7[_0x5496('0x21')]=_0x4dffd2;if(_0x519bd7[_0x5496('0x32')]['includeAll']){_0x1ff1a0[_0x5496('0x41')]=[{'all':!![]}];}return db[_0x5496('0x42')][_0x5496('0x43')](_0x1ff1a0);})[_0x5496('0x27')](function(_0x47088c){_0x47dfa7[_0x5496('0x44')]=_0x47088c;return _0x47dfa7;})[_0x5496('0x27')](respondWithFilteredResult(_0x802f78,_0x1ff1a0))['catch'](handleError(_0x802f78,null));};exports['show']=function(_0x3cc798,_0x4314b1){var _0x4a9701={'raw':![],'where':{'id':_0x3cc798[_0x5496('0x45')]['id']}},_0x3bc507={};_0x3bc507[_0x5496('0x31')]=_[_0x5496('0x46')](db[_0x5496('0x42')][_0x5496('0x2d')]);_0x3bc507[_0x5496('0x32')]=_[_0x5496('0x46')](_0x3cc798['query']);_0x3bc507[_0x5496('0x33')]=_[_0x5496('0x34')](_0x3bc507[_0x5496('0x31')],_0x3bc507[_0x5496('0x32')]);_0x4a9701[_0x5496('0x36')]=_[_0x5496('0x34')](_0x3bc507[_0x5496('0x31')],qs['fields'](_0x3cc798['query'][_0x5496('0x35')]));_0x4a9701[_0x5496('0x36')]=_0x4a9701[_0x5496('0x36')][_0x5496('0x47')]?_0x4a9701['attributes']:_0x3bc507[_0x5496('0x31')];if(_0x3cc798[_0x5496('0x32')][_0x5496('0x48')]){_0x4a9701['include']=[{'all':!![]}];}_0x4a9701=_[_0x5496('0x3f')]({},_0x4a9701,_0x3cc798[_0x5496('0x40')]);return db[_0x5496('0x42')][_0x5496('0x49')](_0x4a9701)[_0x5496('0x27')](handleEntityNotFound(_0x4314b1,null))[_0x5496('0x27')](respondWithResult(_0x4314b1,null))[_0x5496('0x4a')](handleError(_0x4314b1,null));};exports[_0x5496('0x4b')]=function(_0x3d79e0,_0x429632){return db['ZohoAccount'][_0x5496('0x4b')](_0x3d79e0[_0x5496('0x4c')],{})[_0x5496('0x27')](respondWithResult(_0x429632,0xc9))[_0x5496('0x4a')](handleError(_0x429632,null));};exports[_0x5496('0x26')]=function(_0x36be2b,_0x15fbde){if(_0x36be2b[_0x5496('0x4c')]['id']){delete _0x36be2b['body']['id'];}return db['ZohoAccount'][_0x5496('0x49')]({'where':{'id':_0x36be2b[_0x5496('0x45')]['id']}})[_0x5496('0x27')](handleEntityNotFound(_0x15fbde,null))[_0x5496('0x27')](saveUpdates(_0x36be2b['body'],null))[_0x5496('0x27')](respondWithResult(_0x15fbde,null))[_0x5496('0x4a')](handleError(_0x15fbde,null));};exports[_0x5496('0x4d')]=function(_0x2225df,_0x395e94){return db[_0x5496('0x42')][_0x5496('0x49')]({'where':{'id':_0x2225df[_0x5496('0x45')]['id']}})[_0x5496('0x27')](handleEntityNotFound(_0x395e94,null))[_0x5496('0x27')](removeEntity(_0x395e94,null))[_0x5496('0x4a')](handleError(_0x395e94,null));};exports[_0x5496('0x4e')]=function(_0x5df52b,_0x12e603,_0x383be3){var _0x16486f={};var _0x356109={};var _0xbde23e;var _0x43268c;return db[_0x5496('0x42')]['findOne']({'where':{'id':_0x5df52b[_0x5496('0x45')]['id']}})[_0x5496('0x27')](handleEntityNotFound(_0x12e603,null))['then'](function(_0x30af69){if(_0x30af69){_0xbde23e=_0x30af69;_0x356109[_0x5496('0x31')]=_[_0x5496('0x46')](db[_0x5496('0x4f')][_0x5496('0x2d')]);_0x356109[_0x5496('0x32')]=_[_0x5496('0x46')](_0x5df52b[_0x5496('0x32')]);_0x356109[_0x5496('0x33')]=_[_0x5496('0x34')](_0x356109[_0x5496('0x31')],_0x356109[_0x5496('0x32')]);_0x16486f[_0x5496('0x36')]=_[_0x5496('0x34')](_0x356109[_0x5496('0x31')],qs['fields'](_0x5df52b[_0x5496('0x32')][_0x5496('0x35')]));_0x16486f[_0x5496('0x36')]=_0x16486f[_0x5496('0x36')]['length']?_0x16486f['attributes']:_0x356109[_0x5496('0x31')];_0x16486f[_0x5496('0x50')]=qs[_0x5496('0x39')](_0x5df52b[_0x5496('0x32')][_0x5496('0x39')]);_0x16486f[_0x5496('0x3a')]=qs[_0x5496('0x33')](_['pick'](_0x5df52b[_0x5496('0x32')],_0x356109[_0x5496('0x33')]));if(_0x5df52b[_0x5496('0x32')][_0x5496('0x3e')]){_0x16486f[_0x5496('0x3a')]=_[_0x5496('0x3f')](_0x16486f[_0x5496('0x3a')],{'$or':_[_0x5496('0x3c')](_0x16486f[_0x5496('0x36')],function(_0x20ee4a){var _0x4f56cb={};_0x4f56cb[_0x20ee4a]={'$like':'%'+_0x5df52b[_0x5496('0x32')][_0x5496('0x3e')]+'%'};return _0x4f56cb;})});}_0x16486f=_[_0x5496('0x3f')]({},_0x16486f,_0x5df52b[_0x5496('0x40')]);return _0xbde23e[_0x5496('0x4e')](_0x16486f);}})[_0x5496('0x27')](function(_0x560658){if(_0x560658){_0x43268c=_0x560658[_0x5496('0x47')];if(!_0x5df52b[_0x5496('0x32')][_0x5496('0x37')]('nolimit')){_0x16486f['limit']=qs['limit'](_0x5df52b[_0x5496('0x32')][_0x5496('0x20')]);_0x16486f[_0x5496('0x1e')]=qs[_0x5496('0x1e')](_0x5df52b[_0x5496('0x32')][_0x5496('0x1e')]);}return _0xbde23e[_0x5496('0x4e')](_0x16486f);}})[_0x5496('0x27')](function(_0x49b7e5){if(_0x49b7e5){return _0x49b7e5?{'count':_0x43268c,'rows':_0x49b7e5}:null;}})[_0x5496('0x27')](respondWithResult(_0x12e603,null))['catch'](handleError(_0x12e603,null));};exports['addConfiguration']=function(_0x3c37da,_0x154e3a,_0x36b9f0){if(_0x3c37da[_0x5496('0x4c')]['id']){delete _0x3c37da[_0x5496('0x4c')]['id'];}return db['ZohoAccount'][_0x5496('0x51')]({'where':{'id':_0x3c37da[_0x5496('0x45')]['id']}})['then'](handleEntityNotFound(_0x154e3a,null))[_0x5496('0x27')](function(_0x28acc0){if(_0x28acc0){_0x3c37da[_0x5496('0x4c')][_0x5496('0x52')]=_0x28acc0['id'];_0x3c37da[_0x5496('0x4c')][_0x5496('0x53')]=integrations['getSubjects'](_0x3c37da['body'][_0x5496('0x54')],_0x3c37da[_0x5496('0x4c')]['type']);_0x3c37da['body'][_0x5496('0x55')]=integrations[_0x5496('0x56')](_0x3c37da[_0x5496('0x4c')][_0x5496('0x54')],_0x3c37da[_0x5496('0x4c')]['type']);return db[_0x5496('0x4f')]['create'](_0x3c37da[_0x5496('0x4c')],{'include':[{'model':db['ZohoField'],'as':_0x5496('0x53')},{'model':db[_0x5496('0x57')],'as':_0x5496('0x55')}]});}return null;})[_0x5496('0x27')](respondWithResult(_0x154e3a,null))['catch'](handleError(_0x154e3a,null));};function getAccessToken(_0x110dbf){return new Promise(function(_0x107896,_0x39d04d){var _0x30f477;switch(_0x110dbf[_0x5496('0x58')]){case'US':_0x30f477='https://accounts.zoho.com';break;case'AU':_0x30f477='https://accounts.zoho.com.au';break;case'EU':_0x30f477='https://accounts.zoho.eu';break;case'IN':_0x30f477=_0x5496('0x59');break;case'CN':_0x30f477=_0x5496('0x5a');break;default:_0x30f477=_0x5496('0x5b');break;}var _0x45712e={'method':_0x5496('0x5c'),'uri':_0x30f477+'/oauth/v2/token','qs':{'refresh_token':_0x110dbf[_0x5496('0x5d')],'client_id':_0x110dbf[_0x5496('0x5e')],'client_secret':_0x110dbf[_0x5496('0x5f')],'grant_type':'refresh_token'},'json':!![]};return rp(_0x45712e)['then'](function(_0xdd45d8){if(_0xdd45d8[_0x5496('0x60')]){_0x107896(_0xdd45d8[_0x5496('0x60')]);}else{_0x39d04d(_0x5496('0x61'));}})[_0x5496('0x4a')](function(_0x777dd0){_0x39d04d(_0x777dd0);});});}exports['getFields']=function(_0x198d38,_0x4bbbe7,_0x26b6a3){var _0x256675,_0xb61b25,_0x17ccde,_0x3320ad,_0x4c5325;return db[_0x5496('0x42')][_0x5496('0x51')]({'where':{'id':_0x198d38[_0x5496('0x45')]['id']},'attributes':['id',_0x5496('0x62'),_0x5496('0x58'),_0x5496('0x5e'),'clientSecret',_0x5496('0x63'),'code','refreshToken']})[_0x5496('0x27')](handleEntityNotFound(_0x4bbbe7,null))[_0x5496('0x27')](function(_0x132834){_0x4c5325=_0x132834;_0x256675=_0x4c5325['host'];_0xb61b25=_0x256675===_0x5496('0x64')?'eu':_0x5496('0x65');_0x17ccde=_0x4c5325[_0x5496('0x63')];var _0x260e8f=_0x17ccde[_0x5496('0x66')](-0x1);if(_0x260e8f==='/'||_0x260e8f==='\x5c'||_0x260e8f===':'){_0x17ccde=_0x17ccde[_0x5496('0x67')](0x0,_0x17ccde[_0x5496('0x68')](_0x260e8f));}if(!_0x4c5325[_0x5496('0x5d')]){throw new Error(_0x5496('0x69'));}return getAccessToken(_0x4c5325);})[_0x5496('0x27')](function(_0x25702d){if(_0x25702d){return rp({'method':'GET','uri':util['format']('https://www.zohoapis.%s/crm/v2/settings/fields',_0xb61b25),'qs':{'module':_0x5496('0x6a')},'headers':{'Authorization':_0x5496('0x6b')+_0x25702d},'json':!![]});}})[_0x5496('0x27')](function(_0x4afc08){if(_0x4afc08){if(_0x4afc08[_0x5496('0x6c')]&&_0x4afc08[_0x5496('0x6c')][_0x5496('0x28')]){throw new Error(_0x4afc08[_0x5496('0x6c')][_0x5496('0x28')][_0x5496('0x6d')]);}var _0x4e59d3=[];var _0x2f99ab=[];var _0x31ced2=[_0x5496('0x6e'),_0x5496('0x6f'),'Description',_0x5496('0x70'),_0x5496('0x71'),_0x5496('0x72'),_0x5496('0x73'),_0x5496('0x74')];_0x2f99ab=_[_0x5496('0x75')](_0x4afc08[_0x5496('0x35')],function(_0x23b9e2){return _0x31ced2[_0x5496('0x76')](_0x23b9e2[_0x5496('0x77')]);});for(var _0x2feb26=0x0;_0x2feb26<_0x2f99ab['length'];_0x2feb26++){if(_0x2f99ab[_0x2feb26]['system_mandatory']===![]){_0x4e59d3[_0x5496('0x78')]({'id':_0x2f99ab[_0x2feb26]['id'],'name':_0x2f99ab[_0x2feb26][_0x5496('0x79')],'custom':_0x2f99ab[_0x2feb26][_0x5496('0x7a')],'options':_0x2f99ab[_0x2feb26][_0x5496('0x7b')]===_0x5496('0x7c')&&_0x2f99ab[_0x2feb26][_0x5496('0x7d')][_0x5496('0x47')]>-0x1?_['map'](_0x2f99ab[_0x2feb26][_0x5496('0x7d')],function(_0x34796b){return{'name':_0x34796b,'value':_0x34796b};}):[]});}}return{'count':_0x4e59d3[_0x5496('0x47')],'rows':_0x4e59d3};}else{return{'count':0x0,'rows':[]};}})[_0x5496('0x27')](respondWithResult(_0x4bbbe7,null))[_0x5496('0x4a')](function(_0x3655fd){var _0x14723c=_0x198d38[_0x5496('0x32')]['test']?0x1f4:_0x3655fd[_0x5496('0x7e')]||0x1f4;logger['error'](_0x5496('0x7f'),_0x5496('0x80'),_0x14723c,JSON[_0x5496('0x81')](_0x3655fd));delete _0x3655fd[_0x5496('0x2a')];if(_0x14723c===0x191){_0x14723c=0x190;}_0x4bbbe7['status'](_0x14723c)[_0x5496('0x2b')](_0x198d38[_0x5496('0x32')]['test']?{'message':_0x5496('0x82'),'statusCode':_0x3655fd['statusCode']}:_0x3655fd);});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.model.js b/server/api/intZohoAccount/intZohoAccount.model.js index 9d81257..f41b982 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 _0x39e9=['catch','error','authorization_code','lodash','../../config/logger','api','moment','bluebird','request-promise','path','./intZohoAccount.attributes','../../components/integrations/configuration','define','ZohoAccount','int_zoho_accounts','changed','zone','serverUrl','clientId','clientSecret','code','host','slice','substring','lastIndexOf','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.com.cn','https://accounts.zoho.eu','POST','/oauth/v2/token','application/x-www-form-urlencoded','then','parse','refresh_token','refreshToken','info','format','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','name','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','inspect'];(function(_0x28611e,_0x586726){var _0x530f69=function(_0x407906){while(--_0x407906){_0x28611e['push'](_0x28611e['shift']());}};_0x530f69(++_0x586726);}(_0x39e9,0x1a7));var _0x939e=function(_0x18a79d,_0x57bd2c){_0x18a79d=_0x18a79d-0x0;var _0x4f8848=_0x39e9[_0x18a79d];return _0x4f8848;};'use strict';var _=require(_0x939e('0x0'));var util=require('util');var logger=require(_0x939e('0x1'))(_0x939e('0x2'));var moment=require(_0x939e('0x3'));var BPromise=require(_0x939e('0x4'));var rp=require(_0x939e('0x5'));var fs=require('fs');var path=require(_0x939e('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x939e('0x7'));var integrations=require(_0x939e('0x8'));module['exports']=function(_0xfc4168,_0x41d40e){return _0xfc4168[_0x939e('0x9')](_0x939e('0xa'),attributes,{'tableName':_0x939e('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x1396c2,_0x10f9c0,_0x5577e1){if(_0x1396c2[_0x939e('0xc')](_0x939e('0xd'))||_0x1396c2[_0x939e('0xc')](_0x939e('0xe'))||_0x1396c2[_0x939e('0xc')](_0x939e('0xf'))||_0x1396c2[_0x939e('0xc')](_0x939e('0x10'))||_0x1396c2[_0x939e('0xc')](_0x939e('0x11'))||_0x1396c2[_0x939e('0xc')](_0x939e('0x12'))){var _0x470d7f,_0x42ceb1;_0x470d7f=_0x1396c2[_0x939e('0xe')];var _0x4caabd=_0x470d7f[_0x939e('0x13')](-0x1);if(_0x4caabd==='/'||_0x4caabd==='\x5c'||_0x4caabd===':'){_0x470d7f=_0x470d7f[_0x939e('0x14')](0x0,_0x470d7f[_0x939e('0x15')](_0x4caabd));}switch(_0x1396c2[_0x939e('0xd')]){case'US':_0x42ceb1=_0x939e('0x16');break;case'AU':_0x42ceb1=_0x939e('0x17');break;case'IN':_0x42ceb1='https://accounts.zoho.in';break;case'CN':_0x42ceb1=_0x939e('0x18');break;default:_0x42ceb1=_0x939e('0x19');break;}var _0x4983fc={'method':_0x939e('0x1a'),'uri':_0x42ceb1+_0x939e('0x1b'),'form':{'grant_type':'authorization_code','client_id':_0x1396c2['clientId'],'client_secret':_0x1396c2[_0x939e('0x10')],'redirect_uri':_0x1396c2['serverUrl'],'code':_0x1396c2[_0x939e('0x11')]},'headers':{'Content-Type':_0x939e('0x1c')}};return rp(_0x4983fc)[_0x939e('0x1d')](function(_0xf229d2){var _0x3716aa=JSON[_0x939e('0x1e')](_0xf229d2);if(_0x3716aa[_0x939e('0x1f')]){_0x1396c2[_0x939e('0x20')]=_0x3716aa[_0x939e('0x1f')];logger[_0x939e('0x21')](util[_0x939e('0x22')](_0x939e('0x23'),_0x1396c2[_0x939e('0x24')],_0x1396c2['id']));}else{logger['error'](util['format'](_0x939e('0x25'),_0x1396c2[_0x939e('0x24')],_0x1396c2['id']),util[_0x939e('0x26')](_0x3716aa,{'showHidden':![],'depth':null}));}return _0x5577e1(null,_0x10f9c0);})[_0x939e('0x27')](function(_0x5f0ed9){logger[_0x939e('0x28')](util[_0x939e('0x22')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x1396c2[_0x939e('0x24')],_0x1396c2['id']),util[_0x939e('0x26')](parsedResult,{'showHidden':![],'depth':null}));return _0x5577e1(_0x5f0ed9);});}else{return _0x5577e1(null,_0x10f9c0);}},'beforeUpdate':function(_0x203426,_0x14ed48,_0x4f4376){if(_0x203426[_0x939e('0xc')](_0x939e('0xd'))||_0x203426['changed'](_0x939e('0xe'))||_0x203426[_0x939e('0xc')]('clientId')||_0x203426[_0x939e('0xc')]('clientSecret')||_0x203426[_0x939e('0xc')](_0x939e('0x11'))||_0x203426[_0x939e('0xc')](_0x939e('0x12'))){var _0x584ef2,_0x2b66af;_0x584ef2=_0x203426[_0x939e('0xe')];var _0x57f554=_0x584ef2[_0x939e('0x13')](-0x1);if(_0x57f554==='/'||_0x57f554==='\x5c'||_0x57f554===':'){_0x584ef2=_0x584ef2['substring'](0x0,_0x584ef2[_0x939e('0x15')](_0x57f554));}switch(_0x203426[_0x939e('0xd')]){case'US':_0x2b66af=_0x939e('0x16');break;case'AU':_0x2b66af=_0x939e('0x17');break;case'IN':_0x2b66af='https://accounts.zoho.in';break;case'CN':_0x2b66af=_0x939e('0x18');break;default:_0x2b66af=_0x939e('0x19');break;}var _0x4eefce={'method':_0x939e('0x1a'),'uri':_0x2b66af+_0x939e('0x1b'),'form':{'grant_type':_0x939e('0x29'),'client_id':_0x203426[_0x939e('0xf')],'client_secret':_0x203426[_0x939e('0x10')],'redirect_uri':_0x203426['serverUrl'],'code':_0x203426['code']},'headers':{'Content-Type':'application/x-www-form-urlencoded'}};return rp(_0x4eefce)[_0x939e('0x1d')](function(_0x17befa){var _0x4c1e61=JSON[_0x939e('0x1e')](_0x17befa);if(_0x4c1e61['refresh_token']){_0x203426[_0x939e('0x20')]=_0x4c1e61[_0x939e('0x1f')];logger['info'](util[_0x939e('0x22')](_0x939e('0x23'),_0x203426[_0x939e('0x24')],_0x203426['id']));}else{logger[_0x939e('0x28')](util[_0x939e('0x22')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x203426[_0x939e('0x24')],_0x203426['id']),util['inspect'](_0x4c1e61,{'showHidden':![],'depth':null}));}return _0x4f4376(null,_0x14ed48);})[_0x939e('0x27')](function(_0x14b205){logger[_0x939e('0x28')](util[_0x939e('0x22')](_0x939e('0x25'),_0x203426['name'],_0x203426['id']),util[_0x939e('0x26')](parsedResult,{'showHidden':![],'depth':null}));return _0x4f4376(_0x14b205);});}else{return _0x4f4376(null,_0x14ed48);}}}});}; \ No newline at end of file +var _0x2f1d=['format','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','inspect','catch','error','https://accounts.zoho.com','https://accounts.zoho.com.au','lodash','util','api','bluebird','request-promise','rimraf','../../config/environment','./intZohoAccount.attributes','exports','define','int_zoho_accounts','changed','zone','serverUrl','clientId','code','host','slice','substring','lastIndexOf','https://accounts.zoho.in','https://accounts.zoho.com.cn','https://accounts.zoho.eu','POST','/oauth/v2/token','authorization_code','clientSecret','application/x-www-form-urlencoded','then','parse','refresh_token','refreshToken','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','name'];(function(_0x4ac595,_0x158dfe){var _0x49cff7=function(_0x5eaea4){while(--_0x5eaea4){_0x4ac595['push'](_0x4ac595['shift']());}};_0x49cff7(++_0x158dfe);}(_0x2f1d,0x126));var _0xd2f1=function(_0x3d42d8,_0x4cffaa){_0x3d42d8=_0x3d42d8-0x0;var _0x27fc41=_0x2f1d[_0x3d42d8];return _0x27fc41;};'use strict';var _=require(_0xd2f1('0x0'));var util=require(_0xd2f1('0x1'));var logger=require('../../config/logger')(_0xd2f1('0x2'));var moment=require('moment');var BPromise=require(_0xd2f1('0x3'));var rp=require(_0xd2f1('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd2f1('0x5'));var config=require(_0xd2f1('0x6'));var attributes=require(_0xd2f1('0x7'));var integrations=require('../../components/integrations/configuration');module[_0xd2f1('0x8')]=function(_0x19565e,_0x2c029e){return _0x19565e[_0xd2f1('0x9')]('ZohoAccount',attributes,{'tableName':_0xd2f1('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x5717ba,_0x149325,_0x24cdb7){if(_0x5717ba[_0xd2f1('0xb')](_0xd2f1('0xc'))||_0x5717ba[_0xd2f1('0xb')](_0xd2f1('0xd'))||_0x5717ba['changed'](_0xd2f1('0xe'))||_0x5717ba['changed']('clientSecret')||_0x5717ba[_0xd2f1('0xb')](_0xd2f1('0xf'))||_0x5717ba[_0xd2f1('0xb')](_0xd2f1('0x10'))){var _0x3ca4fb,_0x533b05;_0x3ca4fb=_0x5717ba[_0xd2f1('0xd')];var _0x9411a3=_0x3ca4fb[_0xd2f1('0x11')](-0x1);if(_0x9411a3==='/'||_0x9411a3==='\x5c'||_0x9411a3===':'){_0x3ca4fb=_0x3ca4fb[_0xd2f1('0x12')](0x0,_0x3ca4fb[_0xd2f1('0x13')](_0x9411a3));}switch(_0x5717ba[_0xd2f1('0xc')]){case'US':_0x533b05='https://accounts.zoho.com';break;case'AU':_0x533b05='https://accounts.zoho.com.au';break;case'IN':_0x533b05=_0xd2f1('0x14');break;case'CN':_0x533b05=_0xd2f1('0x15');break;default:_0x533b05=_0xd2f1('0x16');break;}var _0x587760={'method':_0xd2f1('0x17'),'uri':_0x533b05+_0xd2f1('0x18'),'form':{'grant_type':_0xd2f1('0x19'),'client_id':_0x5717ba[_0xd2f1('0xe')],'client_secret':_0x5717ba[_0xd2f1('0x1a')],'redirect_uri':_0x5717ba[_0xd2f1('0xd')],'code':_0x5717ba[_0xd2f1('0xf')]},'headers':{'Content-Type':_0xd2f1('0x1b')}};return rp(_0x587760)[_0xd2f1('0x1c')](function(_0x588bc6){var _0x17fff0=JSON[_0xd2f1('0x1d')](_0x588bc6);if(_0x17fff0[_0xd2f1('0x1e')]){_0x5717ba[_0xd2f1('0x1f')]=_0x17fff0[_0xd2f1('0x1e')];logger['info'](util['format'](_0xd2f1('0x20'),_0x5717ba[_0xd2f1('0x21')],_0x5717ba['id']));}else{logger['error'](util[_0xd2f1('0x22')](_0xd2f1('0x23'),_0x5717ba[_0xd2f1('0x21')],_0x5717ba['id']),util[_0xd2f1('0x24')](_0x17fff0,{'showHidden':![],'depth':null}));}return _0x24cdb7(null,_0x149325);})[_0xd2f1('0x25')](function(_0x416986){logger[_0xd2f1('0x26')](util[_0xd2f1('0x22')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x5717ba['name'],_0x5717ba['id']),util[_0xd2f1('0x24')](parsedResult,{'showHidden':![],'depth':null}));return _0x24cdb7(_0x416986);});}else{return _0x24cdb7(null,_0x149325);}},'beforeUpdate':function(_0x10d98e,_0x56f981,_0x2706bc){if(_0x10d98e[_0xd2f1('0xb')]('zone')||_0x10d98e[_0xd2f1('0xb')](_0xd2f1('0xd'))||_0x10d98e['changed'](_0xd2f1('0xe'))||_0x10d98e[_0xd2f1('0xb')](_0xd2f1('0x1a'))||_0x10d98e[_0xd2f1('0xb')](_0xd2f1('0xf'))||_0x10d98e[_0xd2f1('0xb')](_0xd2f1('0x10'))){var _0x376b6f,_0x187774;_0x376b6f=_0x10d98e[_0xd2f1('0xd')];var _0x135bd0=_0x376b6f[_0xd2f1('0x11')](-0x1);if(_0x135bd0==='/'||_0x135bd0==='\x5c'||_0x135bd0===':'){_0x376b6f=_0x376b6f['substring'](0x0,_0x376b6f[_0xd2f1('0x13')](_0x135bd0));}switch(_0x10d98e[_0xd2f1('0xc')]){case'US':_0x187774=_0xd2f1('0x27');break;case'AU':_0x187774=_0xd2f1('0x28');break;case'IN':_0x187774=_0xd2f1('0x14');break;case'CN':_0x187774=_0xd2f1('0x15');break;default:_0x187774=_0xd2f1('0x16');break;}var _0x622d87={'method':'POST','uri':_0x187774+_0xd2f1('0x18'),'form':{'grant_type':'authorization_code','client_id':_0x10d98e[_0xd2f1('0xe')],'client_secret':_0x10d98e[_0xd2f1('0x1a')],'redirect_uri':_0x10d98e[_0xd2f1('0xd')],'code':_0x10d98e[_0xd2f1('0xf')]},'headers':{'Content-Type':_0xd2f1('0x1b')}};return rp(_0x622d87)[_0xd2f1('0x1c')](function(_0x134a58){var _0x419f97=JSON[_0xd2f1('0x1d')](_0x134a58);if(_0x419f97[_0xd2f1('0x1e')]){_0x10d98e['refreshToken']=_0x419f97[_0xd2f1('0x1e')];logger['info'](util[_0xd2f1('0x22')](_0xd2f1('0x20'),_0x10d98e[_0xd2f1('0x21')],_0x10d98e['id']));}else{logger['error'](util['format'](_0xd2f1('0x23'),_0x10d98e[_0xd2f1('0x21')],_0x10d98e['id']),util[_0xd2f1('0x24')](_0x419f97,{'showHidden':![],'depth':null}));}return _0x2706bc(null,_0x56f981);})[_0xd2f1('0x25')](function(_0x500eb5){logger['error'](util[_0xd2f1('0x22')](_0xd2f1('0x23'),_0x10d98e[_0xd2f1('0x21')],_0x10d98e['id']),util[_0xd2f1('0x24')](parsedResult,{'showHidden':![],'depth':null}));return _0x2706bc(_0x500eb5);});}else{return _0x2706bc(null,_0x56f981);}}}});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.rpc.js b/server/api/intZohoAccount/intZohoAccount.rpc.js index 93dfae7..792ca33 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 _0xe9ef=['message','result','catch','GetZohoAccount','ZohoAccount','findAll','options','where','attributes','limit','include','map','model','debug','raw','ShowZohoAccount','lodash','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','ZohoAccount,\x20%s,\x20%s','request\x20sent','ZohoAccount,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x49da1c,_0xfa5c6d){var _0xf08f6d=function(_0x42ae57){while(--_0x42ae57){_0x49da1c['push'](_0x49da1c['shift']());}};_0xf08f6d(++_0xfa5c6d);}(_0xe9ef,0x16e));var _0xfe9e=function(_0x158e3b,_0x4534b){_0x158e3b=_0x158e3b-0x0;var _0x551a1d=_0xe9ef[_0x158e3b];return _0x551a1d;};'use strict';var _=require(_0xfe9e('0x0'));var util=require('util');var moment=require(_0xfe9e('0x1'));var BPromise=require(_0xfe9e('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xfe9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xfe9e('0x4'));var logger=require(_0xfe9e('0x5'))(_0xfe9e('0x6'));var config=require(_0xfe9e('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xfe9e('0x8')][_0xfe9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x493722,_0x539d85,_0x1ae09c){return new BPromise(function(_0x51d134,_0x4325a6){return client[_0xfe9e('0xa')](_0x493722,_0x1ae09c)[_0xfe9e('0xb')](function(_0x48cd0b){logger[_0xfe9e('0xc')](_0xfe9e('0xd'),_0x539d85,_0xfe9e('0xe'));logger['debug'](_0xfe9e('0xf'),_0x539d85,'request\x20sent',JSON[_0xfe9e('0x10')](_0x48cd0b));if(_0x48cd0b[_0xfe9e('0x11')]){if(_0x48cd0b[_0xfe9e('0x11')][_0xfe9e('0x12')]===0x1f4){logger[_0xfe9e('0x11')](_0xfe9e('0xd'),_0x539d85,_0x48cd0b[_0xfe9e('0x11')][_0xfe9e('0x13')]);return _0x4325a6(_0x48cd0b[_0xfe9e('0x11')]['message']);}logger[_0xfe9e('0x11')](_0xfe9e('0xd'),_0x539d85,_0x48cd0b['error'][_0xfe9e('0x13')]);return _0x51d134(_0x48cd0b[_0xfe9e('0x11')][_0xfe9e('0x13')]);}else{logger[_0xfe9e('0xc')]('ZohoAccount,\x20%s,\x20%s',_0x539d85,'request\x20sent');_0x51d134(_0x48cd0b[_0xfe9e('0x14')][_0xfe9e('0x13')]);}})[_0xfe9e('0x15')](function(_0x30ad77){logger['error'](_0xfe9e('0xd'),_0x539d85,_0x30ad77);_0x4325a6(_0x30ad77);});});}exports[_0xfe9e('0x16')]=function(_0xdf0a3b){var _0x3e18bc=this;return new Promise(function(_0x495344,_0x299d8c){return db[_0xfe9e('0x17')][_0xfe9e('0x18')]({'raw':_0xdf0a3b[_0xfe9e('0x19')]?_0xdf0a3b[_0xfe9e('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0xdf0a3b['options']?_0xdf0a3b[_0xfe9e('0x19')][_0xfe9e('0x1a')]||null:null,'attributes':_0xdf0a3b[_0xfe9e('0x19')]?_0xdf0a3b[_0xfe9e('0x19')][_0xfe9e('0x1b')]||null:null,'limit':_0xdf0a3b[_0xfe9e('0x19')]?_0xdf0a3b[_0xfe9e('0x19')][_0xfe9e('0x1c')]||null:null,'include':_0xdf0a3b[_0xfe9e('0x19')]?_0xdf0a3b[_0xfe9e('0x19')][_0xfe9e('0x1d')]?_[_0xfe9e('0x1e')](_0xdf0a3b['options'][_0xfe9e('0x1d')],function(_0x269bcb){return{'model':db[_0x269bcb['model']],'as':_0x269bcb['as'],'attributes':_0x269bcb[_0xfe9e('0x1b')],'include':_0x269bcb['include']?_[_0xfe9e('0x1e')](_0x269bcb[_0xfe9e('0x1d')],function(_0x56308e){return{'model':db[_0x56308e[_0xfe9e('0x1f')]],'as':_0x56308e['as'],'attributes':_0x56308e[_0xfe9e('0x1b')],'include':_0x56308e[_0xfe9e('0x1d')]?_[_0xfe9e('0x1e')](_0x56308e[_0xfe9e('0x1d')],function(_0x42f89d){return{'model':db[_0x42f89d[_0xfe9e('0x1f')]],'as':_0x42f89d['as'],'attributes':_0x42f89d[_0xfe9e('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xfe9e('0xb')](function(_0x3f7228){logger[_0xfe9e('0xc')](_0xfe9e('0x16'),_0xdf0a3b);logger[_0xfe9e('0x20')]('GetZohoAccount',_0xdf0a3b,JSON['stringify'](_0x3f7228));_0x495344(_0x3f7228);})[_0xfe9e('0x15')](function(_0x116b50){logger[_0xfe9e('0x11')](_0xfe9e('0x16'),_0x116b50['message'],_0xdf0a3b);_0x299d8c(_0x3e18bc[_0xfe9e('0x11')](0x1f4,_0x116b50['message']));});});};exports['ShowZohoAccount']=function(_0x4fcc67){var _0x3a8829=this;return new Promise(function(_0x291a49,_0x130f57){return db['ZohoAccount']['find']({'raw':_0x4fcc67[_0xfe9e('0x19')]?_0x4fcc67[_0xfe9e('0x19')][_0xfe9e('0x21')]===undefined?!![]:![]:!![],'where':_0x4fcc67[_0xfe9e('0x19')]?_0x4fcc67[_0xfe9e('0x19')]['where']||null:null,'attributes':_0x4fcc67['options']?_0x4fcc67[_0xfe9e('0x19')][_0xfe9e('0x1b')]||null:null,'include':_0x4fcc67[_0xfe9e('0x19')]?_0x4fcc67[_0xfe9e('0x19')][_0xfe9e('0x1d')]?_[_0xfe9e('0x1e')](_0x4fcc67[_0xfe9e('0x19')][_0xfe9e('0x1d')],function(_0x4f5c40){return{'model':db[_0x4f5c40[_0xfe9e('0x1f')]],'as':_0x4f5c40['as'],'attributes':_0x4f5c40[_0xfe9e('0x1b')],'include':_0x4f5c40[_0xfe9e('0x1d')]?_['map'](_0x4f5c40[_0xfe9e('0x1d')],function(_0xfd3e47){return{'model':db[_0xfd3e47['model']],'as':_0xfd3e47['as'],'attributes':_0xfd3e47['attributes'],'include':_0xfd3e47[_0xfe9e('0x1d')]?_[_0xfe9e('0x1e')](_0xfd3e47[_0xfe9e('0x1d')],function(_0x31a933){return{'model':db[_0x31a933[_0xfe9e('0x1f')]],'as':_0x31a933['as'],'attributes':_0x31a933[_0xfe9e('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xfe9e('0xb')](function(_0x4d0947){logger['info'](_0xfe9e('0x22'),_0x4fcc67);logger[_0xfe9e('0x20')](_0xfe9e('0x22'),_0x4fcc67,JSON[_0xfe9e('0x10')](_0x4d0947));_0x291a49(_0x4d0947);})[_0xfe9e('0x15')](function(_0x334409){logger[_0xfe9e('0x11')]('ShowZohoAccount',_0x334409[_0xfe9e('0x13')],_0x4fcc67);_0x130f57(_0x3a8829['error'](0x1f4,_0x334409[_0xfe9e('0x13')]));});});}; \ No newline at end of file +var _0x7e74=['message','result','catch','GetZohoAccount','ZohoAccount','findAll','options','raw','attributes','map','include','model','where','ShowZohoAccount','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ZohoAccount,\x20%s,\x20%s','request\x20sent','debug','ZohoAccount,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x9b49c6,_0x2ea7ba){var _0x578e11=function(_0x1d3e5c){while(--_0x1d3e5c){_0x9b49c6['push'](_0x9b49c6['shift']());}};_0x578e11(++_0x2ea7ba);}(_0x7e74,0xbd));var _0x47e7=function(_0xdeca95,_0x1609c3){_0xdeca95=_0xdeca95-0x0;var _0x5d3ca8=_0x7e74[_0xdeca95];return _0x5d3ca8;};'use strict';var _=require(_0x47e7('0x0'));var util=require('util');var moment=require(_0x47e7('0x1'));var BPromise=require(_0x47e7('0x2'));var rs=require(_0x47e7('0x3'));var fs=require('fs');var Redis=require(_0x47e7('0x4'));var db=require(_0x47e7('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x47e7('0x6'))(_0x47e7('0x7'));var config=require(_0x47e7('0x8'));var jayson=require(_0x47e7('0x9'));var client=jayson[_0x47e7('0xa')][_0x47e7('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x412d3e,_0x50fc6c,_0x29cd0a){return new BPromise(function(_0x4dc1ee,_0x14fe2f){return client[_0x47e7('0xc')](_0x412d3e,_0x29cd0a)[_0x47e7('0xd')](function(_0x2f66c0){logger[_0x47e7('0xe')](_0x47e7('0xf'),_0x50fc6c,_0x47e7('0x10'));logger[_0x47e7('0x11')](_0x47e7('0x12'),_0x50fc6c,_0x47e7('0x10'),JSON[_0x47e7('0x13')](_0x2f66c0));if(_0x2f66c0[_0x47e7('0x14')]){if(_0x2f66c0[_0x47e7('0x14')]['code']===0x1f4){logger[_0x47e7('0x14')](_0x47e7('0xf'),_0x50fc6c,_0x2f66c0[_0x47e7('0x14')]['message']);return _0x14fe2f(_0x2f66c0[_0x47e7('0x14')][_0x47e7('0x15')]);}logger[_0x47e7('0x14')](_0x47e7('0xf'),_0x50fc6c,_0x2f66c0['error'][_0x47e7('0x15')]);return _0x4dc1ee(_0x2f66c0[_0x47e7('0x14')][_0x47e7('0x15')]);}else{logger[_0x47e7('0xe')](_0x47e7('0xf'),_0x50fc6c,'request\x20sent');_0x4dc1ee(_0x2f66c0[_0x47e7('0x16')]['message']);}})[_0x47e7('0x17')](function(_0x8c320e){logger[_0x47e7('0x14')](_0x47e7('0xf'),_0x50fc6c,_0x8c320e);_0x14fe2f(_0x8c320e);});});}exports[_0x47e7('0x18')]=function(_0x4429e6){var _0x6a3682=this;return new Promise(function(_0x42d837,_0x25d0f0){return db[_0x47e7('0x19')][_0x47e7('0x1a')]({'raw':_0x4429e6[_0x47e7('0x1b')]?_0x4429e6[_0x47e7('0x1b')][_0x47e7('0x1c')]===undefined?!![]:![]:!![],'where':_0x4429e6['options']?_0x4429e6['options']['where']||null:null,'attributes':_0x4429e6['options']?_0x4429e6[_0x47e7('0x1b')][_0x47e7('0x1d')]||null:null,'limit':_0x4429e6[_0x47e7('0x1b')]?_0x4429e6[_0x47e7('0x1b')]['limit']||null:null,'include':_0x4429e6['options']?_0x4429e6[_0x47e7('0x1b')]['include']?_[_0x47e7('0x1e')](_0x4429e6['options'][_0x47e7('0x1f')],function(_0x8e7237){return{'model':db[_0x8e7237[_0x47e7('0x20')]],'as':_0x8e7237['as'],'attributes':_0x8e7237[_0x47e7('0x1d')],'include':_0x8e7237['include']?_['map'](_0x8e7237[_0x47e7('0x1f')],function(_0x25c0ca){return{'model':db[_0x25c0ca[_0x47e7('0x20')]],'as':_0x25c0ca['as'],'attributes':_0x25c0ca[_0x47e7('0x1d')],'include':_0x25c0ca['include']?_[_0x47e7('0x1e')](_0x25c0ca[_0x47e7('0x1f')],function(_0x28f414){return{'model':db[_0x28f414[_0x47e7('0x20')]],'as':_0x28f414['as'],'attributes':_0x28f414['attributes']};}):[]};}):[]};}):[]:[]})[_0x47e7('0xd')](function(_0x1bdb4c){logger[_0x47e7('0xe')](_0x47e7('0x18'),_0x4429e6);logger[_0x47e7('0x11')](_0x47e7('0x18'),_0x4429e6,JSON[_0x47e7('0x13')](_0x1bdb4c));_0x42d837(_0x1bdb4c);})[_0x47e7('0x17')](function(_0x172c80){logger[_0x47e7('0x14')](_0x47e7('0x18'),_0x172c80[_0x47e7('0x15')],_0x4429e6);_0x25d0f0(_0x6a3682[_0x47e7('0x14')](0x1f4,_0x172c80[_0x47e7('0x15')]));});});};exports['ShowZohoAccount']=function(_0x2bc66d){var _0x193a9a=this;return new Promise(function(_0x4078bd,_0x2f8f2d){return db[_0x47e7('0x19')]['find']({'raw':_0x2bc66d[_0x47e7('0x1b')]?_0x2bc66d[_0x47e7('0x1b')][_0x47e7('0x1c')]===undefined?!![]:![]:!![],'where':_0x2bc66d[_0x47e7('0x1b')]?_0x2bc66d[_0x47e7('0x1b')][_0x47e7('0x21')]||null:null,'attributes':_0x2bc66d[_0x47e7('0x1b')]?_0x2bc66d['options']['attributes']||null:null,'include':_0x2bc66d[_0x47e7('0x1b')]?_0x2bc66d['options'][_0x47e7('0x1f')]?_[_0x47e7('0x1e')](_0x2bc66d['options'][_0x47e7('0x1f')],function(_0x228a56){return{'model':db[_0x228a56[_0x47e7('0x20')]],'as':_0x228a56['as'],'attributes':_0x228a56['attributes'],'include':_0x228a56['include']?_[_0x47e7('0x1e')](_0x228a56[_0x47e7('0x1f')],function(_0x4a4667){return{'model':db[_0x4a4667[_0x47e7('0x20')]],'as':_0x4a4667['as'],'attributes':_0x4a4667[_0x47e7('0x1d')],'include':_0x4a4667[_0x47e7('0x1f')]?_['map'](_0x4a4667[_0x47e7('0x1f')],function(_0x5711eb){return{'model':db[_0x5711eb[_0x47e7('0x20')]],'as':_0x5711eb['as'],'attributes':_0x5711eb[_0x47e7('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x47e7('0xd')](function(_0x47ecc9){logger[_0x47e7('0xe')](_0x47e7('0x22'),_0x2bc66d);logger[_0x47e7('0x11')](_0x47e7('0x22'),_0x2bc66d,JSON[_0x47e7('0x13')](_0x47ecc9));_0x4078bd(_0x47ecc9);})[_0x47e7('0x17')](function(_0x4a551a){logger['error'](_0x47e7('0x22'),_0x4a551a['message'],_0x2bc66d);_0x2f8f2d(_0x193a9a[_0x47e7('0x14')](0x1f4,_0x4a551a[_0x47e7('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/index.js b/server/api/intZohoConfiguration/index.js index 6b3947c..dff2611 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 _0x80d1=['getSubjects','/:id/descriptions','getDescriptions','post','create','update','delete','multer','path','connect-timeout','express','Router','fs-extra','../../config/environment','./intZohoConfiguration.controller','get','isAuthenticated','/:id','show','/:id/fields','getFields'];(function(_0x1776ed,_0x168065){var _0x383c1c=function(_0x2facae){while(--_0x2facae){_0x1776ed['push'](_0x1776ed['shift']());}};_0x383c1c(++_0x168065);}(_0x80d1,0x12d));var _0x180d=function(_0x4773f0,_0x2b77be){_0x4773f0=_0x4773f0-0x0;var _0x327ef2=_0x80d1[_0x4773f0];return _0x327ef2;};'use strict';var multer=require(_0x180d('0x0'));var util=require('util');var path=require(_0x180d('0x1'));var timeout=require(_0x180d('0x2'));var express=require(_0x180d('0x3'));var router=express[_0x180d('0x4')]();var fs_extra=require(_0x180d('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x180d('0x6'));var controller=require(_0x180d('0x7'));router[_0x180d('0x8')]('/',auth[_0x180d('0x9')](),controller['index']);router[_0x180d('0x8')](_0x180d('0xa'),auth[_0x180d('0x9')](),controller[_0x180d('0xb')]);router['get'](_0x180d('0xc'),auth[_0x180d('0x9')](),controller[_0x180d('0xd')]);router[_0x180d('0x8')]('/:id/subjects',auth['isAuthenticated'](),controller[_0x180d('0xe')]);router['get'](_0x180d('0xf'),auth[_0x180d('0x9')](),controller[_0x180d('0x10')]);router[_0x180d('0x11')]('/',auth[_0x180d('0x9')](),controller[_0x180d('0x12')]);router['put']('/:id',auth[_0x180d('0x9')](),controller[_0x180d('0x13')]);router[_0x180d('0x14')](_0x180d('0xa'),auth[_0x180d('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xe6d5=['isAuthenticated','index','get','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','create','put','update','delete','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x2bee21,_0x21d6fc){var _0x3242bb=function(_0x525509){while(--_0x525509){_0x2bee21['push'](_0x2bee21['shift']());}};_0x3242bb(++_0x21d6fc);}(_0xe6d5,0x187));var _0x5e6d=function(_0x55fa03,_0xcb96c2){_0x55fa03=_0x55fa03-0x0;var _0x2cd7cd=_0xe6d5[_0x55fa03];return _0x2cd7cd;};'use strict';var multer=require(_0x5e6d('0x0'));var util=require('util');var path=require(_0x5e6d('0x1'));var timeout=require(_0x5e6d('0x2'));var express=require(_0x5e6d('0x3'));var router=express[_0x5e6d('0x4')]();var fs_extra=require(_0x5e6d('0x5'));var auth=require(_0x5e6d('0x6'));var interaction=require(_0x5e6d('0x7'));var config=require(_0x5e6d('0x8'));var controller=require('./intZohoConfiguration.controller');router['get']('/',auth[_0x5e6d('0x9')](),controller[_0x5e6d('0xa')]);router[_0x5e6d('0xb')](_0x5e6d('0xc'),auth['isAuthenticated'](),controller[_0x5e6d('0xd')]);router[_0x5e6d('0xb')](_0x5e6d('0xe'),auth[_0x5e6d('0x9')](),controller[_0x5e6d('0xf')]);router[_0x5e6d('0xb')](_0x5e6d('0x10'),auth[_0x5e6d('0x9')](),controller[_0x5e6d('0x11')]);router[_0x5e6d('0xb')](_0x5e6d('0x12'),auth[_0x5e6d('0x9')](),controller[_0x5e6d('0x13')]);router[_0x5e6d('0x14')]('/',auth['isAuthenticated'](),controller[_0x5e6d('0x15')]);router[_0x5e6d('0x16')](_0x5e6d('0xc'),auth['isAuthenticated'](),controller[_0x5e6d('0x17')]);router[_0x5e6d('0x18')](_0x5e6d('0xc'),auth[_0x5e6d('0x9')](),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 7f97524..f74e852 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 _0x7a43=['contact','nothing','contact_lead','exports','STRING','ENUM','lead'];(function(_0x279d3f,_0x55285d){var _0xb6b0ed=function(_0x498e14){while(--_0x498e14){_0x279d3f['push'](_0x279d3f['shift']());}};_0xb6b0ed(++_0x55285d);}(_0x7a43,0x13e));var _0x37a4=function(_0x40ef7a,_0x5e574f){_0x40ef7a=_0x40ef7a-0x0;var _0x1fb000=_0x7a43[_0x40ef7a];return _0x1fb000;};'use strict';var Sequelize=require('sequelize');module[_0x37a4('0x0')]={'name':{'type':Sequelize[_0x37a4('0x1')]},'moduleCreate':{'type':Sequelize[_0x37a4('0x2')](_0x37a4('0x3'),_0x37a4('0x4'),_0x37a4('0x5')),'defaultValue':'lead'},'moduleSearch':{'type':Sequelize[_0x37a4('0x2')](_0x37a4('0x6'),_0x37a4('0x4'),_0x37a4('0x3')),'defaultValue':_0x37a4('0x6')},'description':{'type':Sequelize[_0x37a4('0x1')]}}; \ No newline at end of file +var _0x3ec3=['sequelize','exports','STRING','lead','nothing','ENUM','contact_lead','contact'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x3ec3,0x148));var _0x33ec=function(_0x1682a9,_0x34b75f){_0x1682a9=_0x1682a9-0x0;var _0x1cdf47=_0x3ec3[_0x1682a9];return _0x1cdf47;};'use strict';var Sequelize=require(_0x33ec('0x0'));module[_0x33ec('0x1')]={'name':{'type':Sequelize[_0x33ec('0x2')]},'moduleCreate':{'type':Sequelize['ENUM'](_0x33ec('0x3'),'contact',_0x33ec('0x4')),'defaultValue':_0x33ec('0x3')},'moduleSearch':{'type':Sequelize[_0x33ec('0x5')](_0x33ec('0x6'),_0x33ec('0x7'),_0x33ec('0x3')),'defaultValue':'contact_lead'},'description':{'type':Sequelize[_0x33ec('0x2')]}}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.controller.js b/server/api/intZohoConfiguration/intZohoConfiguration.controller.js index 5be34e2..5b5f55d 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 _0xafe4=['save','update','destroy','then','status','error','stack','name','send','index','map','ZohoConfiguration','type','query','keys','filters','intersection','model','attributes','fields','length','nolimit','order','sort','filter','where','merge','VIRTUAL','includeAll','include','rows','show','params','rawAttributes','options','find','catch','create','body','findOne','ZohoField','pick','getFields','hasOwnProperty','getSubjects','getDescriptions','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','json','undefined','limit','count','offset','set','Content-Range','apply'];(function(_0x8b4939,_0x4a8076){var _0x40e5fb=function(_0x5c507f){while(--_0x5c507f){_0x8b4939['push'](_0x8b4939['shift']());}};_0x40e5fb(++_0x4a8076);}(_0xafe4,0x1c8));var _0x4afe=function(_0x3acddd,_0x17ae87){_0x3acddd=_0x3acddd-0x0;var _0x376479=_0xafe4[_0x3acddd];return _0x376479;};'use strict';var emlformat=require(_0x4afe('0x0'));var rimraf=require(_0x4afe('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4afe('0x2'));var rp=require('request-promise');var moment=require(_0x4afe('0x3'));var BPromise=require(_0x4afe('0x4'));var Mustache=require(_0x4afe('0x5'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x4afe('0x6'));var ejs=require(_0x4afe('0x7'));var fs=require('fs');var fs_extra=require(_0x4afe('0x8'));var _=require(_0x4afe('0x9'));var squel=require(_0x4afe('0xa'));var crypto=require(_0x4afe('0xb'));var jsforce=require(_0x4afe('0xc'));var deskjs=require(_0x4afe('0xd'));var toCsv=require(_0x4afe('0x6'));var querystring=require(_0x4afe('0xe'));var Papa=require(_0x4afe('0xf'));var Redis=require(_0x4afe('0x10'));var authService=require(_0x4afe('0x11'));var qs=require(_0x4afe('0x12'));var as=require(_0x4afe('0x13'));var hardwareService=require(_0x4afe('0x14'));var logger=require(_0x4afe('0x15'))(_0x4afe('0x16'));var utils=require(_0x4afe('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x4afe('0x18'));var db=require(_0x4afe('0x19'))['db'];function respondWithStatusCode(_0x40d4dc,_0x157482){_0x157482=_0x157482||0xcc;return function(_0x3c1efe){if(_0x3c1efe){return _0x40d4dc[_0x4afe('0x1a')](_0x157482);}return _0x40d4dc['status'](_0x157482)[_0x4afe('0x1b')]();};}function respondWithResult(_0x19e097,_0x12a569){_0x12a569=_0x12a569||0xc8;return function(_0x568c2c){if(_0x568c2c){return _0x19e097['status'](_0x12a569)[_0x4afe('0x1c')](_0x568c2c);}};}function respondWithFilteredResult(_0x509eea,_0xe9aa01){return function(_0x198a4e){if(_0x198a4e){var _0x37de88=typeof _0xe9aa01['offset']===_0x4afe('0x1d')&&typeof _0xe9aa01[_0x4afe('0x1e')]===_0x4afe('0x1d');var _0x64d6d6=_0x198a4e[_0x4afe('0x1f')];var _0x6495db=_0x37de88?0x0:_0xe9aa01[_0x4afe('0x20')];var _0x29a710=_0x37de88?_0x198a4e[_0x4afe('0x1f')]:_0xe9aa01[_0x4afe('0x20')]+_0xe9aa01[_0x4afe('0x1e')];var _0xe40c74;if(_0x29a710>=_0x64d6d6){_0x29a710=_0x64d6d6;_0xe40c74=0xc8;}else{_0xe40c74=0xce;}_0x509eea['status'](_0xe40c74);return _0x509eea[_0x4afe('0x21')](_0x4afe('0x22'),_0x6495db+'-'+_0x29a710+'/'+_0x64d6d6)[_0x4afe('0x1c')](_0x198a4e);}return null;};}function patchUpdates(_0x3b4d8e){return function(_0x170915){try{jsonpatch[_0x4afe('0x23')](_0x170915,_0x3b4d8e,!![]);}catch(_0x4395c5){return BPromise['reject'](_0x4395c5);}return _0x170915[_0x4afe('0x24')]();};}function saveUpdates(_0x3ff210,_0x519fe3){return function(_0x2bb0c7){if(_0x2bb0c7){return _0x2bb0c7[_0x4afe('0x25')](_0x3ff210)['then'](function(_0x469256){return _0x469256;});}return null;};}function removeEntity(_0x2c6177,_0x5655a5){return function(_0x5d9a0a){if(_0x5d9a0a){return _0x5d9a0a[_0x4afe('0x26')]()[_0x4afe('0x27')](function(){_0x2c6177[_0x4afe('0x28')](0xcc)[_0x4afe('0x1b')]();});}};}function handleEntityNotFound(_0x30b183,_0x4903bd){return function(_0x4c5d34){if(!_0x4c5d34){_0x30b183[_0x4afe('0x1a')](0x194);}return _0x4c5d34;};}function handleError(_0x2b6fdc,_0x16b108){_0x16b108=_0x16b108||0x1f4;return function(_0x4a1563){logger[_0x4afe('0x29')](_0x4a1563[_0x4afe('0x2a')]);if(_0x4a1563[_0x4afe('0x2b')]){delete _0x4a1563['name'];}_0x2b6fdc[_0x4afe('0x28')](_0x16b108)[_0x4afe('0x2c')](_0x4a1563);};}exports[_0x4afe('0x2d')]=function(_0x6280e9,_0x56da2f){var _0xd59ab2={},_0x546ba8={},_0x50b255={'count':0x0,'rows':[]};var _0x36e3a7=_[_0x4afe('0x2e')](db[_0x4afe('0x2f')]['rawAttributes'],function(_0x53f00d){return{'name':_0x53f00d['fieldName'],'type':_0x53f00d[_0x4afe('0x30')]['key']};});_0x546ba8['model']=_[_0x4afe('0x2e')](_0x36e3a7,_0x4afe('0x2b'));_0x546ba8[_0x4afe('0x31')]=_[_0x4afe('0x32')](_0x6280e9['query']);_0x546ba8[_0x4afe('0x33')]=_[_0x4afe('0x34')](_0x546ba8[_0x4afe('0x35')],_0x546ba8[_0x4afe('0x31')]);_0xd59ab2[_0x4afe('0x36')]=_[_0x4afe('0x34')](_0x546ba8[_0x4afe('0x35')],qs['fields'](_0x6280e9[_0x4afe('0x31')][_0x4afe('0x37')]));_0xd59ab2[_0x4afe('0x36')]=_0xd59ab2['attributes'][_0x4afe('0x38')]?_0xd59ab2[_0x4afe('0x36')]:_0x546ba8[_0x4afe('0x35')];if(!_0x6280e9[_0x4afe('0x31')]['hasOwnProperty'](_0x4afe('0x39'))){_0xd59ab2[_0x4afe('0x1e')]=qs[_0x4afe('0x1e')](_0x6280e9[_0x4afe('0x31')]['limit']);_0xd59ab2[_0x4afe('0x20')]=qs[_0x4afe('0x20')](_0x6280e9[_0x4afe('0x31')][_0x4afe('0x20')]);}_0xd59ab2[_0x4afe('0x3a')]=qs[_0x4afe('0x3b')](_0x6280e9['query'][_0x4afe('0x3b')]);_0xd59ab2['where']=qs['filters'](_['pick'](_0x6280e9[_0x4afe('0x31')],_0x546ba8['filters']),_0x36e3a7);if(_0x6280e9['query'][_0x4afe('0x3c')]){_0xd59ab2[_0x4afe('0x3d')]=_[_0x4afe('0x3e')](_0xd59ab2[_0x4afe('0x3d')],{'$or':_[_0x4afe('0x2e')](_0x36e3a7,function(_0x5665a4){if(_0x5665a4[_0x4afe('0x30')]!==_0x4afe('0x3f')){var _0x44c233={};_0x44c233[_0x5665a4[_0x4afe('0x2b')]]={'$like':'%'+_0x6280e9[_0x4afe('0x31')][_0x4afe('0x3c')]+'%'};return _0x44c233;}})});}_0xd59ab2=_['merge']({},_0xd59ab2,_0x6280e9['options']);var _0x51e850={'where':_0xd59ab2[_0x4afe('0x3d')]};return db[_0x4afe('0x2f')]['count'](_0x51e850)['then'](function(_0x1bb32f){_0x50b255[_0x4afe('0x1f')]=_0x1bb32f;if(_0x6280e9[_0x4afe('0x31')][_0x4afe('0x40')]){_0xd59ab2[_0x4afe('0x41')]=[{'all':!![]}];}return db[_0x4afe('0x2f')]['findAll'](_0xd59ab2);})['then'](function(_0x24de7d){_0x50b255[_0x4afe('0x42')]=_0x24de7d;return _0x50b255;})['then'](respondWithFilteredResult(_0x56da2f,_0xd59ab2))['catch'](handleError(_0x56da2f,null));};exports[_0x4afe('0x43')]=function(_0xff2767,_0x5091e9){var _0x118767={'raw':![],'where':{'id':_0xff2767[_0x4afe('0x44')]['id']}},_0x147afe={};_0x147afe[_0x4afe('0x35')]=_[_0x4afe('0x32')](db['ZohoConfiguration'][_0x4afe('0x45')]);_0x147afe[_0x4afe('0x31')]=_[_0x4afe('0x32')](_0xff2767['query']);_0x147afe[_0x4afe('0x33')]=_[_0x4afe('0x34')](_0x147afe['model'],_0x147afe[_0x4afe('0x31')]);_0x118767[_0x4afe('0x36')]=_[_0x4afe('0x34')](_0x147afe[_0x4afe('0x35')],qs[_0x4afe('0x37')](_0xff2767['query'][_0x4afe('0x37')]));_0x118767[_0x4afe('0x36')]=_0x118767[_0x4afe('0x36')][_0x4afe('0x38')]?_0x118767[_0x4afe('0x36')]:_0x147afe[_0x4afe('0x35')];if(_0xff2767[_0x4afe('0x31')][_0x4afe('0x40')]){_0x118767[_0x4afe('0x41')]=[{'all':!![]}];}_0x118767=_[_0x4afe('0x3e')]({},_0x118767,_0xff2767[_0x4afe('0x46')]);return db['ZohoConfiguration'][_0x4afe('0x47')](_0x118767)[_0x4afe('0x27')](handleEntityNotFound(_0x5091e9,null))[_0x4afe('0x27')](respondWithResult(_0x5091e9,null))[_0x4afe('0x48')](handleError(_0x5091e9,null));};exports[_0x4afe('0x49')]=function(_0xb946c4,_0x4bf0d6){return db[_0x4afe('0x2f')][_0x4afe('0x49')](_0xb946c4['body'],{})[_0x4afe('0x27')](respondWithResult(_0x4bf0d6,0xc9))[_0x4afe('0x48')](handleError(_0x4bf0d6,null));};exports[_0x4afe('0x25')]=function(_0x187f18,_0x5118b5){if(_0x187f18['body']['id']){delete _0x187f18[_0x4afe('0x4a')]['id'];}return db[_0x4afe('0x2f')]['find']({'where':{'id':_0x187f18[_0x4afe('0x44')]['id']}})[_0x4afe('0x27')](handleEntityNotFound(_0x5118b5,null))['then'](saveUpdates(_0x187f18[_0x4afe('0x4a')],null))[_0x4afe('0x27')](respondWithResult(_0x5118b5,null))['catch'](handleError(_0x5118b5,null));};exports['destroy']=function(_0x188e30,_0x49301d){return db[_0x4afe('0x2f')][_0x4afe('0x47')]({'where':{'id':_0x188e30[_0x4afe('0x44')]['id']}})[_0x4afe('0x27')](handleEntityNotFound(_0x49301d,null))['then'](removeEntity(_0x49301d,null))['catch'](handleError(_0x49301d,null));};exports['getFields']=function(_0x4f9d4f,_0x1a1ce6,_0xf33899){var _0x78117d={};var _0x2413f7={};var _0x53d9ee;var _0x1801d7;return db[_0x4afe('0x2f')][_0x4afe('0x4b')]({'where':{'id':_0x4f9d4f[_0x4afe('0x44')]['id']}})[_0x4afe('0x27')](handleEntityNotFound(_0x1a1ce6,null))[_0x4afe('0x27')](function(_0x483581){if(_0x483581){_0x53d9ee=_0x483581;_0x2413f7['model']=_[_0x4afe('0x32')](db[_0x4afe('0x4c')][_0x4afe('0x45')]);_0x2413f7[_0x4afe('0x31')]=_['keys'](_0x4f9d4f[_0x4afe('0x31')]);_0x2413f7[_0x4afe('0x33')]=_[_0x4afe('0x34')](_0x2413f7[_0x4afe('0x35')],_0x2413f7[_0x4afe('0x31')]);_0x78117d[_0x4afe('0x36')]=_[_0x4afe('0x34')](_0x2413f7[_0x4afe('0x35')],qs[_0x4afe('0x37')](_0x4f9d4f[_0x4afe('0x31')][_0x4afe('0x37')]));_0x78117d[_0x4afe('0x36')]=_0x78117d[_0x4afe('0x36')][_0x4afe('0x38')]?_0x78117d[_0x4afe('0x36')]:_0x2413f7['model'];_0x78117d[_0x4afe('0x3a')]=qs[_0x4afe('0x3b')](_0x4f9d4f[_0x4afe('0x31')]['sort']);_0x78117d[_0x4afe('0x3d')]=qs[_0x4afe('0x33')](_[_0x4afe('0x4d')](_0x4f9d4f[_0x4afe('0x31')],_0x2413f7['filters']));if(_0x4f9d4f[_0x4afe('0x31')]['filter']){_0x78117d[_0x4afe('0x3d')]=_['merge'](_0x78117d[_0x4afe('0x3d')],{'$or':_[_0x4afe('0x2e')](_0x78117d[_0x4afe('0x36')],function(_0x27c25f){var _0x550ec0={};_0x550ec0[_0x27c25f]={'$like':'%'+_0x4f9d4f[_0x4afe('0x31')]['filter']+'%'};return _0x550ec0;})});}_0x78117d=_[_0x4afe('0x3e')]({},_0x78117d,_0x4f9d4f[_0x4afe('0x46')]);return _0x53d9ee[_0x4afe('0x4e')](_0x78117d);}})[_0x4afe('0x27')](function(_0xb9146d){if(_0xb9146d){_0x1801d7=_0xb9146d['length'];if(!_0x4f9d4f[_0x4afe('0x31')][_0x4afe('0x4f')](_0x4afe('0x39'))){_0x78117d[_0x4afe('0x1e')]=qs[_0x4afe('0x1e')](_0x4f9d4f[_0x4afe('0x31')][_0x4afe('0x1e')]);_0x78117d[_0x4afe('0x20')]=qs[_0x4afe('0x20')](_0x4f9d4f[_0x4afe('0x31')][_0x4afe('0x20')]);}return _0x53d9ee[_0x4afe('0x4e')](_0x78117d);}})[_0x4afe('0x27')](function(_0x2628bd){if(_0x2628bd){return _0x2628bd?{'count':_0x1801d7,'rows':_0x2628bd}:null;}})['then'](respondWithResult(_0x1a1ce6,null))['catch'](handleError(_0x1a1ce6,null));};exports[_0x4afe('0x50')]=function(_0x2b4c04,_0x291b05,_0x36371f){var _0x5e87db={};var _0x455bd9={};var _0x51bef6;var _0x1fa3ba;return db[_0x4afe('0x2f')][_0x4afe('0x4b')]({'where':{'id':_0x2b4c04[_0x4afe('0x44')]['id']}})[_0x4afe('0x27')](handleEntityNotFound(_0x291b05,null))[_0x4afe('0x27')](function(_0x28b548){if(_0x28b548){_0x51bef6=_0x28b548;_0x455bd9[_0x4afe('0x35')]=_[_0x4afe('0x32')](db[_0x4afe('0x4c')][_0x4afe('0x45')]);_0x455bd9[_0x4afe('0x31')]=_[_0x4afe('0x32')](_0x2b4c04[_0x4afe('0x31')]);_0x455bd9[_0x4afe('0x33')]=_['intersection'](_0x455bd9['model'],_0x455bd9[_0x4afe('0x31')]);_0x5e87db['attributes']=_[_0x4afe('0x34')](_0x455bd9[_0x4afe('0x35')],qs['fields'](_0x2b4c04['query'][_0x4afe('0x37')]));_0x5e87db['attributes']=_0x5e87db[_0x4afe('0x36')][_0x4afe('0x38')]?_0x5e87db[_0x4afe('0x36')]:_0x455bd9[_0x4afe('0x35')];_0x5e87db[_0x4afe('0x3a')]=qs[_0x4afe('0x3b')](_0x2b4c04[_0x4afe('0x31')][_0x4afe('0x3b')]);_0x5e87db[_0x4afe('0x3d')]=qs[_0x4afe('0x33')](_[_0x4afe('0x4d')](_0x2b4c04[_0x4afe('0x31')],_0x455bd9[_0x4afe('0x33')]));if(_0x2b4c04[_0x4afe('0x31')][_0x4afe('0x3c')]){_0x5e87db[_0x4afe('0x3d')]=_[_0x4afe('0x3e')](_0x5e87db[_0x4afe('0x3d')],{'$or':_[_0x4afe('0x2e')](_0x5e87db['attributes'],function(_0x5ab454){var _0x499336={};_0x499336[_0x5ab454]={'$like':'%'+_0x2b4c04[_0x4afe('0x31')]['filter']+'%'};return _0x499336;})});}_0x5e87db=_[_0x4afe('0x3e')]({},_0x5e87db,_0x2b4c04['options']);return _0x51bef6['getSubjects'](_0x5e87db);}})['then'](function(_0x1d86f0){if(_0x1d86f0){_0x1fa3ba=_0x1d86f0[_0x4afe('0x38')];if(!_0x2b4c04[_0x4afe('0x31')]['hasOwnProperty'](_0x4afe('0x39'))){_0x5e87db[_0x4afe('0x1e')]=qs[_0x4afe('0x1e')](_0x2b4c04[_0x4afe('0x31')]['limit']);_0x5e87db[_0x4afe('0x20')]=qs[_0x4afe('0x20')](_0x2b4c04['query'][_0x4afe('0x20')]);}return _0x51bef6[_0x4afe('0x50')](_0x5e87db);}})['then'](function(_0x12ef42){if(_0x12ef42){return _0x12ef42?{'count':_0x1fa3ba,'rows':_0x12ef42}:null;}})[_0x4afe('0x27')](respondWithResult(_0x291b05,null))[_0x4afe('0x48')](handleError(_0x291b05,null));};exports[_0x4afe('0x51')]=function(_0x4efaed,_0x460f4c,_0x404b2d){var _0xe1ce4f={};var _0x5b93eb={};var _0x576d5a;var _0x5ece36;return db[_0x4afe('0x2f')][_0x4afe('0x4b')]({'where':{'id':_0x4efaed[_0x4afe('0x44')]['id']}})[_0x4afe('0x27')](handleEntityNotFound(_0x460f4c,null))[_0x4afe('0x27')](function(_0x1580a8){if(_0x1580a8){_0x576d5a=_0x1580a8;_0x5b93eb[_0x4afe('0x35')]=_[_0x4afe('0x32')](db[_0x4afe('0x4c')][_0x4afe('0x45')]);_0x5b93eb['query']=_['keys'](_0x4efaed[_0x4afe('0x31')]);_0x5b93eb[_0x4afe('0x33')]=_[_0x4afe('0x34')](_0x5b93eb[_0x4afe('0x35')],_0x5b93eb[_0x4afe('0x31')]);_0xe1ce4f[_0x4afe('0x36')]=_[_0x4afe('0x34')](_0x5b93eb['model'],qs[_0x4afe('0x37')](_0x4efaed[_0x4afe('0x31')][_0x4afe('0x37')]));_0xe1ce4f[_0x4afe('0x36')]=_0xe1ce4f[_0x4afe('0x36')]['length']?_0xe1ce4f[_0x4afe('0x36')]:_0x5b93eb[_0x4afe('0x35')];_0xe1ce4f[_0x4afe('0x3a')]=qs['sort'](_0x4efaed[_0x4afe('0x31')][_0x4afe('0x3b')]);_0xe1ce4f[_0x4afe('0x3d')]=qs[_0x4afe('0x33')](_[_0x4afe('0x4d')](_0x4efaed[_0x4afe('0x31')],_0x5b93eb['filters']));if(_0x4efaed[_0x4afe('0x31')][_0x4afe('0x3c')]){_0xe1ce4f[_0x4afe('0x3d')]=_[_0x4afe('0x3e')](_0xe1ce4f['where'],{'$or':_[_0x4afe('0x2e')](_0xe1ce4f[_0x4afe('0x36')],function(_0x3bb4ea){var _0x437a20={};_0x437a20[_0x3bb4ea]={'$like':'%'+_0x4efaed[_0x4afe('0x31')][_0x4afe('0x3c')]+'%'};return _0x437a20;})});}_0xe1ce4f=_['merge']({},_0xe1ce4f,_0x4efaed[_0x4afe('0x46')]);return _0x576d5a[_0x4afe('0x51')](_0xe1ce4f);}})['then'](function(_0x87ca24){if(_0x87ca24){_0x5ece36=_0x87ca24[_0x4afe('0x38')];if(!_0x4efaed[_0x4afe('0x31')][_0x4afe('0x4f')](_0x4afe('0x39'))){_0xe1ce4f[_0x4afe('0x1e')]=qs[_0x4afe('0x1e')](_0x4efaed[_0x4afe('0x31')][_0x4afe('0x1e')]);_0xe1ce4f[_0x4afe('0x20')]=qs[_0x4afe('0x20')](_0x4efaed['query']['offset']);}return _0x576d5a['getDescriptions'](_0xe1ce4f);}})['then'](function(_0x9d624d){if(_0x9d624d){return _0x9d624d?{'count':_0x5ece36,'rows':_0x9d624d}:null;}})['then'](respondWithResult(_0x460f4c,null))[_0x4afe('0x48')](handleError(_0x460f4c,null));}; \ No newline at end of file +var _0x57ad=['getDescriptions','eml-format','rimraf','fast-json-patch','request-promise','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','undefined','limit','count','offset','set','Content-Range','apply','save','update','sendStatus','error','stack','name','send','index','map','ZohoConfiguration','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','VIRTUAL','merge','options','then','findAll','rows','catch','show','include','create','body','params','destroy','find','getFields','findOne','ZohoField','getSubjects'];(function(_0x28629b,_0x2b2d2a){var _0x290ae7=function(_0x1c96ca){while(--_0x1c96ca){_0x28629b['push'](_0x28629b['shift']());}};_0x290ae7(++_0x2b2d2a);}(_0x57ad,0x145));var _0xd57a=function(_0x40bcc0,_0x58e25a){_0x40bcc0=_0x40bcc0-0x0;var _0x314620=_0x57ad[_0x40bcc0];return _0x314620;};'use strict';var emlformat=require(_0xd57a('0x0'));var rimraf=require(_0xd57a('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd57a('0x2'));var rp=require(_0xd57a('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xd57a('0x4'));var util=require(_0xd57a('0x5'));var path=require(_0xd57a('0x6'));var sox=require('sox');var csv=require(_0xd57a('0x7'));var ejs=require(_0xd57a('0x8'));var fs=require('fs');var fs_extra=require(_0xd57a('0x9'));var _=require(_0xd57a('0xa'));var squel=require(_0xd57a('0xb'));var crypto=require(_0xd57a('0xc'));var jsforce=require(_0xd57a('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xd57a('0xe'));var Papa=require('papaparse');var Redis=require(_0xd57a('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xd57a('0x10'));var as=require(_0xd57a('0x11'));var hardwareService=require(_0xd57a('0x12'));var logger=require(_0xd57a('0x13'))('api');var utils=require(_0xd57a('0x14'));var config=require(_0xd57a('0x15'));var licenseUtil=require(_0xd57a('0x16'));var db=require(_0xd57a('0x17'))['db'];function respondWithStatusCode(_0x19e2eb,_0x4a5457){_0x4a5457=_0x4a5457||0xcc;return function(_0x5326bf){if(_0x5326bf){return _0x19e2eb['sendStatus'](_0x4a5457);}return _0x19e2eb[_0xd57a('0x18')](_0x4a5457)['end']();};}function respondWithResult(_0x1d98f7,_0x7c2840){_0x7c2840=_0x7c2840||0xc8;return function(_0x3b78c2){if(_0x3b78c2){return _0x1d98f7[_0xd57a('0x18')](_0x7c2840)[_0xd57a('0x19')](_0x3b78c2);}};}function respondWithFilteredResult(_0x3f8f59,_0x14b94c){return function(_0xe7903a){if(_0xe7903a){var _0x1a3754=typeof _0x14b94c['offset']===_0xd57a('0x1a')&&typeof _0x14b94c[_0xd57a('0x1b')]==='undefined';var _0x32618e=_0xe7903a[_0xd57a('0x1c')];var _0x584573=_0x1a3754?0x0:_0x14b94c[_0xd57a('0x1d')];var _0x293264=_0x1a3754?_0xe7903a[_0xd57a('0x1c')]:_0x14b94c[_0xd57a('0x1d')]+_0x14b94c[_0xd57a('0x1b')];var _0x4bd339;if(_0x293264>=_0x32618e){_0x293264=_0x32618e;_0x4bd339=0xc8;}else{_0x4bd339=0xce;}_0x3f8f59[_0xd57a('0x18')](_0x4bd339);return _0x3f8f59[_0xd57a('0x1e')](_0xd57a('0x1f'),_0x584573+'-'+_0x293264+'/'+_0x32618e)[_0xd57a('0x19')](_0xe7903a);}return null;};}function patchUpdates(_0x5cad2b){return function(_0x55e247){try{jsonpatch[_0xd57a('0x20')](_0x55e247,_0x5cad2b,!![]);}catch(_0x554a4e){return BPromise['reject'](_0x554a4e);}return _0x55e247[_0xd57a('0x21')]();};}function saveUpdates(_0x7acc8f,_0x513096){return function(_0x9904c){if(_0x9904c){return _0x9904c[_0xd57a('0x22')](_0x7acc8f)['then'](function(_0xce2686){return _0xce2686;});}return null;};}function removeEntity(_0x54161c,_0x479a94){return function(_0x1301ba){if(_0x1301ba){return _0x1301ba['destroy']()['then'](function(){_0x54161c[_0xd57a('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x164dd1,_0x47bb1f){return function(_0x51de86){if(!_0x51de86){_0x164dd1[_0xd57a('0x23')](0x194);}return _0x51de86;};}function handleError(_0x32e251,_0xd87237){_0xd87237=_0xd87237||0x1f4;return function(_0x40e211){logger[_0xd57a('0x24')](_0x40e211[_0xd57a('0x25')]);if(_0x40e211[_0xd57a('0x26')]){delete _0x40e211[_0xd57a('0x26')];}_0x32e251['status'](_0xd87237)[_0xd57a('0x27')](_0x40e211);};}exports[_0xd57a('0x28')]=function(_0x1be8be,_0x49ec6c){var _0x54d365={},_0x2d90f1={},_0x290a4e={'count':0x0,'rows':[]};var _0x554cdb=_[_0xd57a('0x29')](db[_0xd57a('0x2a')][_0xd57a('0x2b')],function(_0x37bf25){return{'name':_0x37bf25[_0xd57a('0x2c')],'type':_0x37bf25[_0xd57a('0x2d')][_0xd57a('0x2e')]};});_0x2d90f1[_0xd57a('0x2f')]=_['map'](_0x554cdb,_0xd57a('0x26'));_0x2d90f1[_0xd57a('0x30')]=_[_0xd57a('0x31')](_0x1be8be[_0xd57a('0x30')]);_0x2d90f1[_0xd57a('0x32')]=_['intersection'](_0x2d90f1[_0xd57a('0x2f')],_0x2d90f1[_0xd57a('0x30')]);_0x54d365[_0xd57a('0x33')]=_[_0xd57a('0x34')](_0x2d90f1['model'],qs[_0xd57a('0x35')](_0x1be8be[_0xd57a('0x30')]['fields']));_0x54d365['attributes']=_0x54d365[_0xd57a('0x33')][_0xd57a('0x36')]?_0x54d365[_0xd57a('0x33')]:_0x2d90f1[_0xd57a('0x2f')];if(!_0x1be8be[_0xd57a('0x30')][_0xd57a('0x37')](_0xd57a('0x38'))){_0x54d365['limit']=qs[_0xd57a('0x1b')](_0x1be8be[_0xd57a('0x30')]['limit']);_0x54d365[_0xd57a('0x1d')]=qs[_0xd57a('0x1d')](_0x1be8be[_0xd57a('0x30')]['offset']);}_0x54d365[_0xd57a('0x39')]=qs[_0xd57a('0x3a')](_0x1be8be['query']['sort']);_0x54d365['where']=qs['filters'](_[_0xd57a('0x3b')](_0x1be8be[_0xd57a('0x30')],_0x2d90f1[_0xd57a('0x32')]),_0x554cdb);if(_0x1be8be[_0xd57a('0x30')][_0xd57a('0x3c')]){_0x54d365[_0xd57a('0x3d')]=_['merge'](_0x54d365[_0xd57a('0x3d')],{'$or':_[_0xd57a('0x29')](_0x554cdb,function(_0x3f5282){if(_0x3f5282[_0xd57a('0x2d')]!==_0xd57a('0x3e')){var _0x327fc5={};_0x327fc5[_0x3f5282[_0xd57a('0x26')]]={'$like':'%'+_0x1be8be['query']['filter']+'%'};return _0x327fc5;}})});}_0x54d365=_[_0xd57a('0x3f')]({},_0x54d365,_0x1be8be[_0xd57a('0x40')]);var _0x4a133c={'where':_0x54d365['where']};return db[_0xd57a('0x2a')][_0xd57a('0x1c')](_0x4a133c)[_0xd57a('0x41')](function(_0x54bd9f){_0x290a4e[_0xd57a('0x1c')]=_0x54bd9f;if(_0x1be8be['query']['includeAll']){_0x54d365['include']=[{'all':!![]}];}return db[_0xd57a('0x2a')][_0xd57a('0x42')](_0x54d365);})['then'](function(_0xce763b){_0x290a4e[_0xd57a('0x43')]=_0xce763b;return _0x290a4e;})[_0xd57a('0x41')](respondWithFilteredResult(_0x49ec6c,_0x54d365))[_0xd57a('0x44')](handleError(_0x49ec6c,null));};exports[_0xd57a('0x45')]=function(_0x303ef7,_0x34bb13){var _0xc28f7d={'raw':![],'where':{'id':_0x303ef7['params']['id']}},_0x424b66={};_0x424b66[_0xd57a('0x2f')]=_[_0xd57a('0x31')](db['ZohoConfiguration'][_0xd57a('0x2b')]);_0x424b66[_0xd57a('0x30')]=_[_0xd57a('0x31')](_0x303ef7[_0xd57a('0x30')]);_0x424b66[_0xd57a('0x32')]=_[_0xd57a('0x34')](_0x424b66[_0xd57a('0x2f')],_0x424b66['query']);_0xc28f7d[_0xd57a('0x33')]=_[_0xd57a('0x34')](_0x424b66[_0xd57a('0x2f')],qs[_0xd57a('0x35')](_0x303ef7['query'][_0xd57a('0x35')]));_0xc28f7d[_0xd57a('0x33')]=_0xc28f7d[_0xd57a('0x33')][_0xd57a('0x36')]?_0xc28f7d[_0xd57a('0x33')]:_0x424b66[_0xd57a('0x2f')];if(_0x303ef7['query']['includeAll']){_0xc28f7d[_0xd57a('0x46')]=[{'all':!![]}];}_0xc28f7d=_[_0xd57a('0x3f')]({},_0xc28f7d,_0x303ef7[_0xd57a('0x40')]);return db[_0xd57a('0x2a')]['find'](_0xc28f7d)['then'](handleEntityNotFound(_0x34bb13,null))[_0xd57a('0x41')](respondWithResult(_0x34bb13,null))['catch'](handleError(_0x34bb13,null));};exports['create']=function(_0x2f9522,_0x10abb4){return db[_0xd57a('0x2a')][_0xd57a('0x47')](_0x2f9522[_0xd57a('0x48')],{})['then'](respondWithResult(_0x10abb4,0xc9))[_0xd57a('0x44')](handleError(_0x10abb4,null));};exports[_0xd57a('0x22')]=function(_0x44ad4d,_0x39e7f4){if(_0x44ad4d[_0xd57a('0x48')]['id']){delete _0x44ad4d['body']['id'];}return db[_0xd57a('0x2a')]['find']({'where':{'id':_0x44ad4d[_0xd57a('0x49')]['id']}})[_0xd57a('0x41')](handleEntityNotFound(_0x39e7f4,null))[_0xd57a('0x41')](saveUpdates(_0x44ad4d[_0xd57a('0x48')],null))['then'](respondWithResult(_0x39e7f4,null))['catch'](handleError(_0x39e7f4,null));};exports[_0xd57a('0x4a')]=function(_0x233e8f,_0x5ed294){return db[_0xd57a('0x2a')][_0xd57a('0x4b')]({'where':{'id':_0x233e8f['params']['id']}})['then'](handleEntityNotFound(_0x5ed294,null))[_0xd57a('0x41')](removeEntity(_0x5ed294,null))[_0xd57a('0x44')](handleError(_0x5ed294,null));};exports[_0xd57a('0x4c')]=function(_0x531ae9,_0x51b8f5,_0x26276e){var _0xb34d1c={};var _0x1d453f={};var _0x33b3df;var _0xe2b784;return db[_0xd57a('0x2a')][_0xd57a('0x4d')]({'where':{'id':_0x531ae9[_0xd57a('0x49')]['id']}})[_0xd57a('0x41')](handleEntityNotFound(_0x51b8f5,null))[_0xd57a('0x41')](function(_0x3b4c8a){if(_0x3b4c8a){_0x33b3df=_0x3b4c8a;_0x1d453f[_0xd57a('0x2f')]=_[_0xd57a('0x31')](db[_0xd57a('0x4e')]['rawAttributes']);_0x1d453f[_0xd57a('0x30')]=_[_0xd57a('0x31')](_0x531ae9[_0xd57a('0x30')]);_0x1d453f[_0xd57a('0x32')]=_[_0xd57a('0x34')](_0x1d453f[_0xd57a('0x2f')],_0x1d453f[_0xd57a('0x30')]);_0xb34d1c[_0xd57a('0x33')]=_[_0xd57a('0x34')](_0x1d453f[_0xd57a('0x2f')],qs[_0xd57a('0x35')](_0x531ae9['query']['fields']));_0xb34d1c[_0xd57a('0x33')]=_0xb34d1c['attributes']['length']?_0xb34d1c[_0xd57a('0x33')]:_0x1d453f['model'];_0xb34d1c[_0xd57a('0x39')]=qs[_0xd57a('0x3a')](_0x531ae9[_0xd57a('0x30')][_0xd57a('0x3a')]);_0xb34d1c[_0xd57a('0x3d')]=qs['filters'](_[_0xd57a('0x3b')](_0x531ae9['query'],_0x1d453f[_0xd57a('0x32')]));if(_0x531ae9[_0xd57a('0x30')]['filter']){_0xb34d1c[_0xd57a('0x3d')]=_[_0xd57a('0x3f')](_0xb34d1c[_0xd57a('0x3d')],{'$or':_[_0xd57a('0x29')](_0xb34d1c['attributes'],function(_0x5244f9){var _0x2e8f33={};_0x2e8f33[_0x5244f9]={'$like':'%'+_0x531ae9['query'][_0xd57a('0x3c')]+'%'};return _0x2e8f33;})});}_0xb34d1c=_[_0xd57a('0x3f')]({},_0xb34d1c,_0x531ae9[_0xd57a('0x40')]);return _0x33b3df[_0xd57a('0x4c')](_0xb34d1c);}})[_0xd57a('0x41')](function(_0x4e86a2){if(_0x4e86a2){_0xe2b784=_0x4e86a2[_0xd57a('0x36')];if(!_0x531ae9[_0xd57a('0x30')]['hasOwnProperty'](_0xd57a('0x38'))){_0xb34d1c[_0xd57a('0x1b')]=qs[_0xd57a('0x1b')](_0x531ae9[_0xd57a('0x30')]['limit']);_0xb34d1c[_0xd57a('0x1d')]=qs[_0xd57a('0x1d')](_0x531ae9['query'][_0xd57a('0x1d')]);}return _0x33b3df[_0xd57a('0x4c')](_0xb34d1c);}})[_0xd57a('0x41')](function(_0x14cc11){if(_0x14cc11){return _0x14cc11?{'count':_0xe2b784,'rows':_0x14cc11}:null;}})[_0xd57a('0x41')](respondWithResult(_0x51b8f5,null))[_0xd57a('0x44')](handleError(_0x51b8f5,null));};exports[_0xd57a('0x4f')]=function(_0x56d390,_0x16ec39,_0x24654b){var _0xb8f196={};var _0x50c833={};var _0xa3123e;var _0x58ede1;return db[_0xd57a('0x2a')]['findOne']({'where':{'id':_0x56d390['params']['id']}})[_0xd57a('0x41')](handleEntityNotFound(_0x16ec39,null))[_0xd57a('0x41')](function(_0x107ae2){if(_0x107ae2){_0xa3123e=_0x107ae2;_0x50c833[_0xd57a('0x2f')]=_[_0xd57a('0x31')](db[_0xd57a('0x4e')]['rawAttributes']);_0x50c833[_0xd57a('0x30')]=_[_0xd57a('0x31')](_0x56d390[_0xd57a('0x30')]);_0x50c833[_0xd57a('0x32')]=_[_0xd57a('0x34')](_0x50c833[_0xd57a('0x2f')],_0x50c833[_0xd57a('0x30')]);_0xb8f196[_0xd57a('0x33')]=_[_0xd57a('0x34')](_0x50c833[_0xd57a('0x2f')],qs[_0xd57a('0x35')](_0x56d390[_0xd57a('0x30')][_0xd57a('0x35')]));_0xb8f196[_0xd57a('0x33')]=_0xb8f196['attributes'][_0xd57a('0x36')]?_0xb8f196[_0xd57a('0x33')]:_0x50c833['model'];_0xb8f196[_0xd57a('0x39')]=qs[_0xd57a('0x3a')](_0x56d390[_0xd57a('0x30')][_0xd57a('0x3a')]);_0xb8f196[_0xd57a('0x3d')]=qs['filters'](_['pick'](_0x56d390['query'],_0x50c833[_0xd57a('0x32')]));if(_0x56d390[_0xd57a('0x30')]['filter']){_0xb8f196[_0xd57a('0x3d')]=_[_0xd57a('0x3f')](_0xb8f196[_0xd57a('0x3d')],{'$or':_['map'](_0xb8f196['attributes'],function(_0x1aa464){var _0x39176f={};_0x39176f[_0x1aa464]={'$like':'%'+_0x56d390[_0xd57a('0x30')]['filter']+'%'};return _0x39176f;})});}_0xb8f196=_['merge']({},_0xb8f196,_0x56d390['options']);return _0xa3123e[_0xd57a('0x4f')](_0xb8f196);}})[_0xd57a('0x41')](function(_0x2e38de){if(_0x2e38de){_0x58ede1=_0x2e38de[_0xd57a('0x36')];if(!_0x56d390[_0xd57a('0x30')]['hasOwnProperty'](_0xd57a('0x38'))){_0xb8f196[_0xd57a('0x1b')]=qs[_0xd57a('0x1b')](_0x56d390[_0xd57a('0x30')][_0xd57a('0x1b')]);_0xb8f196[_0xd57a('0x1d')]=qs[_0xd57a('0x1d')](_0x56d390['query'][_0xd57a('0x1d')]);}return _0xa3123e[_0xd57a('0x4f')](_0xb8f196);}})['then'](function(_0x174832){if(_0x174832){return _0x174832?{'count':_0x58ede1,'rows':_0x174832}:null;}})[_0xd57a('0x41')](respondWithResult(_0x16ec39,null))['catch'](handleError(_0x16ec39,null));};exports['getDescriptions']=function(_0x27bb96,_0x3563d5,_0x27ba26){var _0x4d6ec3={};var _0x2ba6c5={};var _0x192179;var _0x403b8b;return db[_0xd57a('0x2a')][_0xd57a('0x4d')]({'where':{'id':_0x27bb96[_0xd57a('0x49')]['id']}})['then'](handleEntityNotFound(_0x3563d5,null))['then'](function(_0x35d925){if(_0x35d925){_0x192179=_0x35d925;_0x2ba6c5[_0xd57a('0x2f')]=_[_0xd57a('0x31')](db[_0xd57a('0x4e')][_0xd57a('0x2b')]);_0x2ba6c5[_0xd57a('0x30')]=_[_0xd57a('0x31')](_0x27bb96[_0xd57a('0x30')]);_0x2ba6c5[_0xd57a('0x32')]=_[_0xd57a('0x34')](_0x2ba6c5[_0xd57a('0x2f')],_0x2ba6c5[_0xd57a('0x30')]);_0x4d6ec3[_0xd57a('0x33')]=_[_0xd57a('0x34')](_0x2ba6c5[_0xd57a('0x2f')],qs[_0xd57a('0x35')](_0x27bb96[_0xd57a('0x30')][_0xd57a('0x35')]));_0x4d6ec3['attributes']=_0x4d6ec3[_0xd57a('0x33')]['length']?_0x4d6ec3['attributes']:_0x2ba6c5['model'];_0x4d6ec3[_0xd57a('0x39')]=qs[_0xd57a('0x3a')](_0x27bb96['query'][_0xd57a('0x3a')]);_0x4d6ec3[_0xd57a('0x3d')]=qs['filters'](_[_0xd57a('0x3b')](_0x27bb96['query'],_0x2ba6c5[_0xd57a('0x32')]));if(_0x27bb96[_0xd57a('0x30')]['filter']){_0x4d6ec3[_0xd57a('0x3d')]=_['merge'](_0x4d6ec3[_0xd57a('0x3d')],{'$or':_[_0xd57a('0x29')](_0x4d6ec3['attributes'],function(_0x1c35c7){var _0x40f02c={};_0x40f02c[_0x1c35c7]={'$like':'%'+_0x27bb96['query'][_0xd57a('0x3c')]+'%'};return _0x40f02c;})});}_0x4d6ec3=_['merge']({},_0x4d6ec3,_0x27bb96[_0xd57a('0x40')]);return _0x192179[_0xd57a('0x50')](_0x4d6ec3);}})[_0xd57a('0x41')](function(_0x5ae160){if(_0x5ae160){_0x403b8b=_0x5ae160[_0xd57a('0x36')];if(!_0x27bb96[_0xd57a('0x30')][_0xd57a('0x37')](_0xd57a('0x38'))){_0x4d6ec3[_0xd57a('0x1b')]=qs['limit'](_0x27bb96[_0xd57a('0x30')][_0xd57a('0x1b')]);_0x4d6ec3[_0xd57a('0x1d')]=qs[_0xd57a('0x1d')](_0x27bb96[_0xd57a('0x30')][_0xd57a('0x1d')]);}return _0x192179[_0xd57a('0x50')](_0x4d6ec3);}})[_0xd57a('0x41')](function(_0xb63cae){if(_0xb63cae){return _0xb63cae?{'count':_0x403b8b,'rows':_0xb63cae}:null;}})['then'](respondWithResult(_0x3563d5,null))[_0xd57a('0x44')](handleError(_0x3563d5,null));}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.model.js b/server/api/intZohoConfiguration/intZohoConfiguration.model.js index bea756f..b80a12b 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 _0x8e9f=['rimraf','../../config/environment','./intZohoConfiguration.attributes','exports','define','int_zoho_configurations','lodash','../../config/logger','api','moment','bluebird','path'];(function(_0x342594,_0x8f2cc7){var _0x4a08c4=function(_0x6ddde6){while(--_0x6ddde6){_0x342594['push'](_0x342594['shift']());}};_0x4a08c4(++_0x8f2cc7);}(_0x8e9f,0x16e));var _0xf8e9=function(_0x2555d0,_0x4150a6){_0x2555d0=_0x2555d0-0x0;var _0x3bb486=_0x8e9f[_0x2555d0];return _0x3bb486;};'use strict';var _=require(_0xf8e9('0x0'));var util=require('util');var logger=require(_0xf8e9('0x1'))(_0xf8e9('0x2'));var moment=require(_0xf8e9('0x3'));var BPromise=require(_0xf8e9('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf8e9('0x5'));var rimraf=require(_0xf8e9('0x6'));var config=require(_0xf8e9('0x7'));var attributes=require(_0xf8e9('0x8'));module[_0xf8e9('0x9')]=function(_0x1b9202,_0x27e326){return _0x1b9202[_0xf8e9('0xa')]('ZohoConfiguration',attributes,{'tableName':_0xf8e9('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x008b=['./intZohoConfiguration.attributes','exports','ZohoConfiguration','int_zoho_configurations','lodash','util','../../config/logger','api','request-promise','../../config/environment'];(function(_0x3d42d8,_0x4cffaa){var _0x27fc41=function(_0x3a363b){while(--_0x3a363b){_0x3d42d8['push'](_0x3d42d8['shift']());}};_0x27fc41(++_0x4cffaa);}(_0x008b,0x144));var _0xb008=function(_0x2206fc,_0x1c184c){_0x2206fc=_0x2206fc-0x0;var _0x1861f1=_0x008b[_0x2206fc];return _0x1861f1;};'use strict';var _=require(_0xb008('0x0'));var util=require(_0xb008('0x1'));var logger=require(_0xb008('0x2'))(_0xb008('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xb008('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xb008('0x5'));var attributes=require(_0xb008('0x6'));module[_0xb008('0x7')]=function(_0x3f5f8a,_0x53531f){return _0x3f5f8a['define'](_0xb008('0x8'),attributes,{'tableName':_0xb008('0x9'),'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 50d4f88..9cedc6e 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 _0x0e88=['ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','ZohoConfiguration,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','lodash','util','moment','bluebird','randomstring'];(function(_0xf4666e,_0x571140){var _0x1853f1=function(_0x5160a5){while(--_0x5160a5){_0xf4666e['push'](_0xf4666e['shift']());}};_0x1853f1(++_0x571140);}(_0x0e88,0x1c7));var _0x80e8=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x0e88[_0x17d9e3];return _0x14192d;};'use strict';var _=require(_0x80e8('0x0'));var util=require(_0x80e8('0x1'));var moment=require(_0x80e8('0x2'));var BPromise=require(_0x80e8('0x3'));var rs=require(_0x80e8('0x4'));var fs=require('fs');var Redis=require(_0x80e8('0x5'));var db=require(_0x80e8('0x6'))['db'];var utils=require(_0x80e8('0x7'));var logger=require(_0x80e8('0x8'))('rpc');var config=require(_0x80e8('0x9'));var jayson=require(_0x80e8('0xa'));var client=jayson[_0x80e8('0xb')][_0x80e8('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x262992,_0x24daec,_0x440ca1){return new BPromise(function(_0x4ac345,_0x4c69dd){return client[_0x80e8('0xd')](_0x262992,_0x440ca1)[_0x80e8('0xe')](function(_0x39d043){logger[_0x80e8('0xf')](_0x80e8('0x10'),_0x24daec,_0x80e8('0x11'));logger[_0x80e8('0x12')]('ZohoConfiguration,\x20%s,\x20%s,\x20%s',_0x24daec,_0x80e8('0x11'),JSON['stringify'](_0x39d043));if(_0x39d043[_0x80e8('0x13')]){if(_0x39d043[_0x80e8('0x13')][_0x80e8('0x14')]===0x1f4){logger['error'](_0x80e8('0x10'),_0x24daec,_0x39d043[_0x80e8('0x13')][_0x80e8('0x15')]);return _0x4c69dd(_0x39d043[_0x80e8('0x13')][_0x80e8('0x15')]);}logger[_0x80e8('0x13')](_0x80e8('0x10'),_0x24daec,_0x39d043[_0x80e8('0x13')][_0x80e8('0x15')]);return _0x4ac345(_0x39d043['error'][_0x80e8('0x15')]);}else{logger[_0x80e8('0xf')](_0x80e8('0x10'),_0x24daec,_0x80e8('0x11'));_0x4ac345(_0x39d043[_0x80e8('0x16')][_0x80e8('0x15')]);}})['catch'](function(_0x25bff1){logger[_0x80e8('0x13')](_0x80e8('0x10'),_0x24daec,_0x25bff1);_0x4c69dd(_0x25bff1);});});} \ No newline at end of file +var _0xc7cb=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','http','request','then','ZohoConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','lodash'];(function(_0x58e92d,_0x1181bd){var _0x45d179=function(_0xf162a4){while(--_0xf162a4){_0x58e92d['push'](_0x58e92d['shift']());}};_0x45d179(++_0x1181bd);}(_0xc7cb,0x12b));var _0xbc7c=function(_0x1e3e5e,_0x525d38){_0x1e3e5e=_0x1e3e5e-0x0;var _0x3b33fe=_0xc7cb[_0x1e3e5e];return _0x3b33fe;};'use strict';var _=require(_0xbc7c('0x0'));var util=require('util');var moment=require(_0xbc7c('0x1'));var BPromise=require(_0xbc7c('0x2'));var rs=require(_0xbc7c('0x3'));var fs=require('fs');var Redis=require(_0xbc7c('0x4'));var db=require(_0xbc7c('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xbc7c('0x6'))(_0xbc7c('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0xbc7c('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1220e1,_0x2783aa,_0x212173){return new BPromise(function(_0x56c564,_0x334209){return client[_0xbc7c('0x9')](_0x1220e1,_0x212173)[_0xbc7c('0xa')](function(_0x249d4b){logger['info'](_0xbc7c('0xb'),_0x2783aa,_0xbc7c('0xc'));logger[_0xbc7c('0xd')](_0xbc7c('0xe'),_0x2783aa,_0xbc7c('0xc'),JSON[_0xbc7c('0xf')](_0x249d4b));if(_0x249d4b[_0xbc7c('0x10')]){if(_0x249d4b[_0xbc7c('0x10')]['code']===0x1f4){logger[_0xbc7c('0x10')](_0xbc7c('0xb'),_0x2783aa,_0x249d4b[_0xbc7c('0x10')][_0xbc7c('0x11')]);return _0x334209(_0x249d4b[_0xbc7c('0x10')][_0xbc7c('0x11')]);}logger['error'](_0xbc7c('0xb'),_0x2783aa,_0x249d4b[_0xbc7c('0x10')][_0xbc7c('0x11')]);return _0x56c564(_0x249d4b[_0xbc7c('0x10')][_0xbc7c('0x11')]);}else{logger[_0xbc7c('0x12')](_0xbc7c('0xb'),_0x2783aa,_0xbc7c('0xc'));_0x56c564(_0x249d4b[_0xbc7c('0x13')][_0xbc7c('0x11')]);}})['catch'](function(_0x24d4d2){logger[_0xbc7c('0x10')]('ZohoConfiguration,\x20%s,\x20%s',_0x2783aa,_0x24d4d2);_0x334209(_0x24d4d2);});});} \ No newline at end of file diff --git a/server/api/intZohoField/index.js b/server/api/intZohoField/index.js index 9f9b84e..305b900 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 _0x9d13=['exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intZohoField.controller','isAuthenticated','index','get','post','create','put','/:id','update','delete','destroy'];(function(_0x235b0d,_0x3dc9c9){var _0x3be595=function(_0x1de0f1){while(--_0x1de0f1){_0x235b0d['push'](_0x235b0d['shift']());}};_0x3be595(++_0x3dc9c9);}(_0x9d13,0x13c));var _0x39d1=function(_0x4fe9d8,_0x39f8be){_0x4fe9d8=_0x4fe9d8-0x0;var _0x561b44=_0x9d13[_0x4fe9d8];return _0x561b44;};'use strict';var multer=require(_0x39d1('0x0'));var util=require(_0x39d1('0x1'));var path=require(_0x39d1('0x2'));var timeout=require(_0x39d1('0x3'));var express=require(_0x39d1('0x4'));var router=express[_0x39d1('0x5')]();var fs_extra=require(_0x39d1('0x6'));var auth=require(_0x39d1('0x7'));var interaction=require(_0x39d1('0x8'));var config=require('../../config/environment');var controller=require(_0x39d1('0x9'));router['get']('/',auth[_0x39d1('0xa')](),controller[_0x39d1('0xb')]);router[_0x39d1('0xc')]('/:id',auth[_0x39d1('0xa')](),controller['show']);router[_0x39d1('0xd')]('/',auth['isAuthenticated'](),controller[_0x39d1('0xe')]);router[_0x39d1('0xf')](_0x39d1('0x10'),auth['isAuthenticated'](),controller[_0x39d1('0x11')]);router[_0x39d1('0x12')](_0x39d1('0x10'),auth[_0x39d1('0xa')](),controller[_0x39d1('0x13')]);module[_0x39d1('0x14')]=router; \ No newline at end of file +var _0x9dc0=['path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./intZohoField.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','multer','util'];(function(_0x5335ea,_0x2a612d){var _0x40a7da=function(_0x28023c){while(--_0x28023c){_0x5335ea['push'](_0x5335ea['shift']());}};_0x40a7da(++_0x2a612d);}(_0x9dc0,0xe5));var _0x09dc=function(_0x4dda69,_0x2a0fe4){_0x4dda69=_0x4dda69-0x0;var _0x9014a9=_0x9dc0[_0x4dda69];return _0x9014a9;};'use strict';var multer=require(_0x09dc('0x0'));var util=require(_0x09dc('0x1'));var path=require(_0x09dc('0x2'));var timeout=require(_0x09dc('0x3'));var express=require(_0x09dc('0x4'));var router=express[_0x09dc('0x5')]();var fs_extra=require(_0x09dc('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x09dc('0x7'));var config=require(_0x09dc('0x8'));var controller=require(_0x09dc('0x9'));router[_0x09dc('0xa')]('/',auth[_0x09dc('0xb')](),controller[_0x09dc('0xc')]);router[_0x09dc('0xa')](_0x09dc('0xd'),auth[_0x09dc('0xb')](),controller[_0x09dc('0xe')]);router[_0x09dc('0xf')]('/',auth[_0x09dc('0xb')](),controller[_0x09dc('0x10')]);router[_0x09dc('0x11')]('/:id',auth[_0x09dc('0xb')](),controller[_0x09dc('0x12')]);router[_0x09dc('0x13')]('/:id',auth[_0x09dc('0xb')](),controller[_0x09dc('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.attributes.js b/server/api/intZohoField/intZohoField.attributes.js index a4e55ec..f3e7356 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 _0xbd9c=['picklist','string','STRING','customVariable','BOOLEAN','sequelize','exports','ENUM','variable'];(function(_0xda99d6,_0x5d0efa){var _0x4d8540=function(_0x5e2e94){while(--_0x5e2e94){_0xda99d6['push'](_0xda99d6['shift']());}};_0x4d8540(++_0x5d0efa);}(_0xbd9c,0x10a));var _0xcbd9=function(_0x241424,_0x25eb5d){_0x241424=_0x241424-0x0;var _0x3da798=_0xbd9c[_0x241424];return _0x3da798;};'use strict';var Sequelize=require(_0xcbd9('0x0'));module[_0xcbd9('0x1')]={'type':{'type':Sequelize[_0xcbd9('0x2')]('string',_0xcbd9('0x3'),'customVariable','keyValue',_0xcbd9('0x4')),'defaultValue':_0xcbd9('0x5')},'content':{'type':Sequelize[_0xcbd9('0x6')]},'key':{'type':Sequelize[_0xcbd9('0x6')]},'keyType':{'type':Sequelize[_0xcbd9('0x2')](_0xcbd9('0x5'),_0xcbd9('0x3'),_0xcbd9('0x7'))},'keyContent':{'type':Sequelize[_0xcbd9('0x6')]},'idField':{'type':Sequelize[_0xcbd9('0x6')]},'nameField':{'type':Sequelize[_0xcbd9('0x6')]},'customField':{'type':Sequelize[_0xcbd9('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xcbd9('0x6')]}}; \ No newline at end of file +var _0x2eff=['customVariable','BOOLEAN','sequelize','exports','ENUM','string','variable','keyValue','STRING'];(function(_0x26cab7,_0x1ccfca){var _0x31ba06=function(_0x1ed04a){while(--_0x1ed04a){_0x26cab7['push'](_0x26cab7['shift']());}};_0x31ba06(++_0x1ccfca);}(_0x2eff,0xad));var _0xf2ef=function(_0x1bd845,_0x567d93){_0x1bd845=_0x1bd845-0x0;var _0x2257b3=_0x2eff[_0x1bd845];return _0x2257b3;};'use strict';var Sequelize=require(_0xf2ef('0x0'));module[_0xf2ef('0x1')]={'type':{'type':Sequelize[_0xf2ef('0x2')](_0xf2ef('0x3'),_0xf2ef('0x4'),'customVariable',_0xf2ef('0x5'),'picklist'),'defaultValue':_0xf2ef('0x3')},'content':{'type':Sequelize[_0xf2ef('0x6')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xf2ef('0x2')]('string','variable',_0xf2ef('0x7'))},'keyContent':{'type':Sequelize[_0xf2ef('0x6')]},'idField':{'type':Sequelize[_0xf2ef('0x6')]},'nameField':{'type':Sequelize[_0xf2ef('0x6')]},'customField':{'type':Sequelize[_0xf2ef('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xf2ef('0x6')]}}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.controller.js b/server/api/intZohoField/intZohoField.controller.js index 6ab843f..794b85a 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 _0xe127=['../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','limit','count','set','Content-Range','json','reject','save','update','then','destroy','error','name','send','index','ZohoField','rawAttributes','fieldName','type','key','map','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','create','body','find','rimraf','zip-dir','request-promise','moment','bluebird','util','path','sox','to-csv','lodash','squel','jsforce','querystring','ioredis','../../components/auth/service'];(function(_0x5b1f14,_0x5a772b){var _0x27371d=function(_0x2e1547){while(--_0x2e1547){_0x5b1f14['push'](_0x5b1f14['shift']());}};_0x27371d(++_0x5a772b);}(_0xe127,0x1e2));var _0x7e12=function(_0x1222fa,_0x3fa16d){_0x1222fa=_0x1222fa-0x0;var _0x494b92=_0xe127[_0x1222fa];return _0x494b92;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7e12('0x0'));var zipdir=require(_0x7e12('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7e12('0x2'));var moment=require(_0x7e12('0x3'));var BPromise=require(_0x7e12('0x4'));var Mustache=require('mustache');var util=require(_0x7e12('0x5'));var path=require(_0x7e12('0x6'));var sox=require(_0x7e12('0x7'));var csv=require(_0x7e12('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7e12('0x9'));var squel=require(_0x7e12('0xa'));var crypto=require('crypto');var jsforce=require(_0x7e12('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x7e12('0x8'));var querystring=require(_0x7e12('0xc'));var Papa=require('papaparse');var Redis=require(_0x7e12('0xd'));var authService=require(_0x7e12('0xe'));var qs=require(_0x7e12('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7e12('0x10'));var logger=require('../../config/logger')(_0x7e12('0x11'));var utils=require(_0x7e12('0x12'));var config=require(_0x7e12('0x13'));var licenseUtil=require(_0x7e12('0x14'));var db=require(_0x7e12('0x15'))['db'];function respondWithStatusCode(_0x12da35,_0x16b02f){_0x16b02f=_0x16b02f||0xcc;return function(_0x3da31c){if(_0x3da31c){return _0x12da35[_0x7e12('0x16')](_0x16b02f);}return _0x12da35['status'](_0x16b02f)['end']();};}function respondWithResult(_0x4a0956,_0x5a00d3){_0x5a00d3=_0x5a00d3||0xc8;return function(_0x3e4b4b){if(_0x3e4b4b){return _0x4a0956[_0x7e12('0x17')](_0x5a00d3)['json'](_0x3e4b4b);}};}function respondWithFilteredResult(_0x42b6ee,_0x2c201c){return function(_0x409f45){if(_0x409f45){var _0x1d9326=typeof _0x2c201c[_0x7e12('0x18')]===_0x7e12('0x19')&&typeof _0x2c201c[_0x7e12('0x1a')]===_0x7e12('0x19');var _0x65453f=_0x409f45[_0x7e12('0x1b')];var _0x13eb3e=_0x1d9326?0x0:_0x2c201c[_0x7e12('0x18')];var _0x4c1e24=_0x1d9326?_0x409f45[_0x7e12('0x1b')]:_0x2c201c[_0x7e12('0x18')]+_0x2c201c[_0x7e12('0x1a')];var _0x44cfcb;if(_0x4c1e24>=_0x65453f){_0x4c1e24=_0x65453f;_0x44cfcb=0xc8;}else{_0x44cfcb=0xce;}_0x42b6ee[_0x7e12('0x17')](_0x44cfcb);return _0x42b6ee[_0x7e12('0x1c')](_0x7e12('0x1d'),_0x13eb3e+'-'+_0x4c1e24+'/'+_0x65453f)[_0x7e12('0x1e')](_0x409f45);}return null;};}function patchUpdates(_0x55de45){return function(_0x292fad){try{jsonpatch['apply'](_0x292fad,_0x55de45,!![]);}catch(_0x5d3e1a){return BPromise[_0x7e12('0x1f')](_0x5d3e1a);}return _0x292fad[_0x7e12('0x20')]();};}function saveUpdates(_0x88b28c,_0x228119){return function(_0x38ab81){if(_0x38ab81){return _0x38ab81[_0x7e12('0x21')](_0x88b28c)[_0x7e12('0x22')](function(_0x4505d0){return _0x4505d0;});}return null;};}function removeEntity(_0x371b5a,_0xadc6e2){return function(_0x1cef98){if(_0x1cef98){return _0x1cef98[_0x7e12('0x23')]()['then'](function(){_0x371b5a[_0x7e12('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x686e3a,_0x3c6e0a){return function(_0x2dc8ce){if(!_0x2dc8ce){_0x686e3a[_0x7e12('0x16')](0x194);}return _0x2dc8ce;};}function handleError(_0x216b70,_0x57cce7){_0x57cce7=_0x57cce7||0x1f4;return function(_0x1c0bff){logger[_0x7e12('0x24')](_0x1c0bff['stack']);if(_0x1c0bff[_0x7e12('0x25')]){delete _0x1c0bff['name'];}_0x216b70['status'](_0x57cce7)[_0x7e12('0x26')](_0x1c0bff);};}exports[_0x7e12('0x27')]=function(_0x4f0c58,_0x1d0870){var _0x1bbf2f={},_0x1aee48={},_0x3c191e={'count':0x0,'rows':[]};var _0x40fe24=_['map'](db[_0x7e12('0x28')][_0x7e12('0x29')],function(_0x1b28f5){return{'name':_0x1b28f5[_0x7e12('0x2a')],'type':_0x1b28f5[_0x7e12('0x2b')][_0x7e12('0x2c')]};});_0x1aee48['model']=_[_0x7e12('0x2d')](_0x40fe24,'name');_0x1aee48[_0x7e12('0x2e')]=_[_0x7e12('0x2f')](_0x4f0c58[_0x7e12('0x2e')]);_0x1aee48[_0x7e12('0x30')]=_[_0x7e12('0x31')](_0x1aee48[_0x7e12('0x32')],_0x1aee48[_0x7e12('0x2e')]);_0x1bbf2f[_0x7e12('0x33')]=_['intersection'](_0x1aee48[_0x7e12('0x32')],qs[_0x7e12('0x34')](_0x4f0c58[_0x7e12('0x2e')][_0x7e12('0x34')]));_0x1bbf2f[_0x7e12('0x33')]=_0x1bbf2f['attributes'][_0x7e12('0x35')]?_0x1bbf2f['attributes']:_0x1aee48[_0x7e12('0x32')];if(!_0x4f0c58[_0x7e12('0x2e')][_0x7e12('0x36')]('nolimit')){_0x1bbf2f['limit']=qs[_0x7e12('0x1a')](_0x4f0c58[_0x7e12('0x2e')][_0x7e12('0x1a')]);_0x1bbf2f[_0x7e12('0x18')]=qs[_0x7e12('0x18')](_0x4f0c58[_0x7e12('0x2e')][_0x7e12('0x18')]);}_0x1bbf2f['order']=qs[_0x7e12('0x37')](_0x4f0c58[_0x7e12('0x2e')]['sort']);_0x1bbf2f[_0x7e12('0x38')]=qs[_0x7e12('0x30')](_[_0x7e12('0x39')](_0x4f0c58[_0x7e12('0x2e')],_0x1aee48[_0x7e12('0x30')]),_0x40fe24);if(_0x4f0c58[_0x7e12('0x2e')][_0x7e12('0x3a')]){_0x1bbf2f[_0x7e12('0x38')]=_[_0x7e12('0x3b')](_0x1bbf2f[_0x7e12('0x38')],{'$or':_['map'](_0x40fe24,function(_0x2a9619){if(_0x2a9619[_0x7e12('0x2b')]!=='VIRTUAL'){var _0x6ebcb8={};_0x6ebcb8[_0x2a9619[_0x7e12('0x25')]]={'$like':'%'+_0x4f0c58[_0x7e12('0x2e')][_0x7e12('0x3a')]+'%'};return _0x6ebcb8;}})});}_0x1bbf2f=_['merge']({},_0x1bbf2f,_0x4f0c58[_0x7e12('0x3c')]);var _0x586bf1={'where':_0x1bbf2f['where']};return db['ZohoField'][_0x7e12('0x1b')](_0x586bf1)['then'](function(_0x24c278){_0x3c191e['count']=_0x24c278;if(_0x4f0c58[_0x7e12('0x2e')][_0x7e12('0x3d')]){_0x1bbf2f[_0x7e12('0x3e')]=[{'all':!![]}];}return db[_0x7e12('0x28')][_0x7e12('0x3f')](_0x1bbf2f);})[_0x7e12('0x22')](function(_0x48ea04){_0x3c191e[_0x7e12('0x40')]=_0x48ea04;return _0x3c191e;})[_0x7e12('0x22')](respondWithFilteredResult(_0x1d0870,_0x1bbf2f))[_0x7e12('0x41')](handleError(_0x1d0870,null));};exports[_0x7e12('0x42')]=function(_0x57e88a,_0x36b9a3){var _0x1975a6={'raw':!![],'where':{'id':_0x57e88a[_0x7e12('0x43')]['id']}},_0x1588fa={};_0x1588fa[_0x7e12('0x32')]=_[_0x7e12('0x2f')](db['ZohoField'][_0x7e12('0x29')]);_0x1588fa[_0x7e12('0x2e')]=_[_0x7e12('0x2f')](_0x57e88a[_0x7e12('0x2e')]);_0x1588fa[_0x7e12('0x30')]=_[_0x7e12('0x31')](_0x1588fa[_0x7e12('0x32')],_0x1588fa['query']);_0x1975a6[_0x7e12('0x33')]=_[_0x7e12('0x31')](_0x1588fa[_0x7e12('0x32')],qs['fields'](_0x57e88a[_0x7e12('0x2e')][_0x7e12('0x34')]));_0x1975a6[_0x7e12('0x33')]=_0x1975a6[_0x7e12('0x33')][_0x7e12('0x35')]?_0x1975a6[_0x7e12('0x33')]:_0x1588fa[_0x7e12('0x32')];if(_0x57e88a[_0x7e12('0x2e')][_0x7e12('0x3d')]){_0x1975a6[_0x7e12('0x3e')]=[{'all':!![]}];}_0x1975a6=_[_0x7e12('0x3b')]({},_0x1975a6,_0x57e88a[_0x7e12('0x3c')]);return db[_0x7e12('0x28')]['find'](_0x1975a6)[_0x7e12('0x22')](handleEntityNotFound(_0x36b9a3,null))['then'](respondWithResult(_0x36b9a3,null))[_0x7e12('0x41')](handleError(_0x36b9a3,null));};exports[_0x7e12('0x44')]=function(_0x5903c7,_0x3c79e5){return db[_0x7e12('0x28')][_0x7e12('0x44')](_0x5903c7[_0x7e12('0x45')],{})['then'](respondWithResult(_0x3c79e5,0xc9))[_0x7e12('0x41')](handleError(_0x3c79e5,null));};exports[_0x7e12('0x21')]=function(_0x2d11fd,_0x4f01ea){if(_0x2d11fd[_0x7e12('0x45')]['id']){delete _0x2d11fd['body']['id'];}return db[_0x7e12('0x28')][_0x7e12('0x46')]({'where':{'id':_0x2d11fd[_0x7e12('0x43')]['id']}})['then'](handleEntityNotFound(_0x4f01ea,null))[_0x7e12('0x22')](saveUpdates(_0x2d11fd[_0x7e12('0x45')],null))[_0x7e12('0x22')](respondWithResult(_0x4f01ea,null))[_0x7e12('0x41')](handleError(_0x4f01ea,null));};exports[_0x7e12('0x23')]=function(_0x3744e7,_0x25bac3){return db[_0x7e12('0x28')][_0x7e12('0x46')]({'where':{'id':_0x3744e7[_0x7e12('0x43')]['id']}})[_0x7e12('0x22')](handleEntityNotFound(_0x25bac3,null))['then'](removeEntity(_0x25bac3,null))[_0x7e12('0x41')](handleError(_0x25bac3,null));}; \ No newline at end of file +var _0x6cb4=['count','limit','set','Content-Range','apply','reject','save','update','then','stack','name','send','index','map','ZohoField','fieldName','key','model','query','keys','filters','intersection','fields','attributes','nolimit','order','sort','where','filter','merge','includeAll','rows','catch','show','params','rawAttributes','length','options','find','create','body','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../mysqldb','status','end','json','undefined','offset'];(function(_0x13f280,_0xf8d085){var _0x50fbcd=function(_0x50b066){while(--_0x50b066){_0x13f280['push'](_0x13f280['shift']());}};_0x50fbcd(++_0xf8d085);}(_0x6cb4,0xff));var _0x46cb=function(_0x5ae333,_0x5917ca){_0x5ae333=_0x5ae333-0x0;var _0x23a79d=_0x6cb4[_0x5ae333];return _0x23a79d;};'use strict';var emlformat=require(_0x46cb('0x0'));var rimraf=require(_0x46cb('0x1'));var zipdir=require(_0x46cb('0x2'));var jsonpatch=require(_0x46cb('0x3'));var rp=require(_0x46cb('0x4'));var moment=require(_0x46cb('0x5'));var BPromise=require(_0x46cb('0x6'));var Mustache=require(_0x46cb('0x7'));var util=require(_0x46cb('0x8'));var path=require('path');var sox=require(_0x46cb('0x9'));var csv=require('to-csv');var ejs=require(_0x46cb('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x46cb('0xb'));var squel=require(_0x46cb('0xc'));var crypto=require(_0x46cb('0xd'));var jsforce=require(_0x46cb('0xe'));var deskjs=require(_0x46cb('0xf'));var toCsv=require(_0x46cb('0x10'));var querystring=require('querystring');var Papa=require(_0x46cb('0x11'));var Redis=require(_0x46cb('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x46cb('0x13'));var as=require(_0x46cb('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x46cb('0x15'))(_0x46cb('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x46cb('0x17'))['db'];function respondWithStatusCode(_0x323ac2,_0x1058a8){_0x1058a8=_0x1058a8||0xcc;return function(_0xf22158){if(_0xf22158){return _0x323ac2['sendStatus'](_0x1058a8);}return _0x323ac2[_0x46cb('0x18')](_0x1058a8)[_0x46cb('0x19')]();};}function respondWithResult(_0x2a1f9d,_0x3c0071){_0x3c0071=_0x3c0071||0xc8;return function(_0x1f7150){if(_0x1f7150){return _0x2a1f9d[_0x46cb('0x18')](_0x3c0071)[_0x46cb('0x1a')](_0x1f7150);}};}function respondWithFilteredResult(_0x3c396b,_0x37d368){return function(_0x41e398){if(_0x41e398){var _0x136215=typeof _0x37d368['offset']===_0x46cb('0x1b')&&typeof _0x37d368['limit']===_0x46cb('0x1b');var _0x4ab22b=_0x41e398['count'];var _0x4e3454=_0x136215?0x0:_0x37d368[_0x46cb('0x1c')];var _0x1f2891=_0x136215?_0x41e398[_0x46cb('0x1d')]:_0x37d368[_0x46cb('0x1c')]+_0x37d368[_0x46cb('0x1e')];var _0x26e38d;if(_0x1f2891>=_0x4ab22b){_0x1f2891=_0x4ab22b;_0x26e38d=0xc8;}else{_0x26e38d=0xce;}_0x3c396b[_0x46cb('0x18')](_0x26e38d);return _0x3c396b[_0x46cb('0x1f')](_0x46cb('0x20'),_0x4e3454+'-'+_0x1f2891+'/'+_0x4ab22b)[_0x46cb('0x1a')](_0x41e398);}return null;};}function patchUpdates(_0x149483){return function(_0x46e541){try{jsonpatch[_0x46cb('0x21')](_0x46e541,_0x149483,!![]);}catch(_0x2f438b){return BPromise[_0x46cb('0x22')](_0x2f438b);}return _0x46e541[_0x46cb('0x23')]();};}function saveUpdates(_0x7084b2,_0x1fb467){return function(_0x41ecd2){if(_0x41ecd2){return _0x41ecd2[_0x46cb('0x24')](_0x7084b2)[_0x46cb('0x25')](function(_0x1e9e38){return _0x1e9e38;});}return null;};}function removeEntity(_0x309e4b,_0xadcad6){return function(_0x40e0e5){if(_0x40e0e5){return _0x40e0e5['destroy']()['then'](function(){_0x309e4b[_0x46cb('0x18')](0xcc)[_0x46cb('0x19')]();});}};}function handleEntityNotFound(_0x2711ac,_0xe078a8){return function(_0x6e6d9){if(!_0x6e6d9){_0x2711ac['sendStatus'](0x194);}return _0x6e6d9;};}function handleError(_0xc5a9a4,_0x578ffd){_0x578ffd=_0x578ffd||0x1f4;return function(_0x495886){logger['error'](_0x495886[_0x46cb('0x26')]);if(_0x495886[_0x46cb('0x27')]){delete _0x495886[_0x46cb('0x27')];}_0xc5a9a4[_0x46cb('0x18')](_0x578ffd)[_0x46cb('0x28')](_0x495886);};}exports[_0x46cb('0x29')]=function(_0x378dc7,_0x8c65b2){var _0x2b846a={},_0x12e01e={},_0x4620ef={'count':0x0,'rows':[]};var _0x4a1517=_[_0x46cb('0x2a')](db[_0x46cb('0x2b')]['rawAttributes'],function(_0x49e0bc){return{'name':_0x49e0bc[_0x46cb('0x2c')],'type':_0x49e0bc['type'][_0x46cb('0x2d')]};});_0x12e01e[_0x46cb('0x2e')]=_[_0x46cb('0x2a')](_0x4a1517,_0x46cb('0x27'));_0x12e01e[_0x46cb('0x2f')]=_[_0x46cb('0x30')](_0x378dc7['query']);_0x12e01e[_0x46cb('0x31')]=_['intersection'](_0x12e01e[_0x46cb('0x2e')],_0x12e01e[_0x46cb('0x2f')]);_0x2b846a['attributes']=_[_0x46cb('0x32')](_0x12e01e[_0x46cb('0x2e')],qs[_0x46cb('0x33')](_0x378dc7[_0x46cb('0x2f')][_0x46cb('0x33')]));_0x2b846a['attributes']=_0x2b846a[_0x46cb('0x34')]['length']?_0x2b846a[_0x46cb('0x34')]:_0x12e01e[_0x46cb('0x2e')];if(!_0x378dc7[_0x46cb('0x2f')]['hasOwnProperty'](_0x46cb('0x35'))){_0x2b846a[_0x46cb('0x1e')]=qs['limit'](_0x378dc7[_0x46cb('0x2f')][_0x46cb('0x1e')]);_0x2b846a[_0x46cb('0x1c')]=qs[_0x46cb('0x1c')](_0x378dc7[_0x46cb('0x2f')][_0x46cb('0x1c')]);}_0x2b846a[_0x46cb('0x36')]=qs[_0x46cb('0x37')](_0x378dc7[_0x46cb('0x2f')][_0x46cb('0x37')]);_0x2b846a[_0x46cb('0x38')]=qs['filters'](_['pick'](_0x378dc7['query'],_0x12e01e[_0x46cb('0x31')]),_0x4a1517);if(_0x378dc7[_0x46cb('0x2f')][_0x46cb('0x39')]){_0x2b846a[_0x46cb('0x38')]=_[_0x46cb('0x3a')](_0x2b846a[_0x46cb('0x38')],{'$or':_['map'](_0x4a1517,function(_0x1f2e11){if(_0x1f2e11['type']!=='VIRTUAL'){var _0x173fac={};_0x173fac[_0x1f2e11['name']]={'$like':'%'+_0x378dc7['query'][_0x46cb('0x39')]+'%'};return _0x173fac;}})});}_0x2b846a=_['merge']({},_0x2b846a,_0x378dc7['options']);var _0x67bd14={'where':_0x2b846a[_0x46cb('0x38')]};return db[_0x46cb('0x2b')][_0x46cb('0x1d')](_0x67bd14)[_0x46cb('0x25')](function(_0x4075b4){_0x4620ef[_0x46cb('0x1d')]=_0x4075b4;if(_0x378dc7['query'][_0x46cb('0x3b')]){_0x2b846a['include']=[{'all':!![]}];}return db[_0x46cb('0x2b')]['findAll'](_0x2b846a);})[_0x46cb('0x25')](function(_0x2fbad9){_0x4620ef[_0x46cb('0x3c')]=_0x2fbad9;return _0x4620ef;})['then'](respondWithFilteredResult(_0x8c65b2,_0x2b846a))[_0x46cb('0x3d')](handleError(_0x8c65b2,null));};exports[_0x46cb('0x3e')]=function(_0x4d24b6,_0x18be96){var _0x3d0b83={'raw':!![],'where':{'id':_0x4d24b6[_0x46cb('0x3f')]['id']}},_0x1f67af={};_0x1f67af[_0x46cb('0x2e')]=_['keys'](db['ZohoField'][_0x46cb('0x40')]);_0x1f67af['query']=_[_0x46cb('0x30')](_0x4d24b6[_0x46cb('0x2f')]);_0x1f67af['filters']=_[_0x46cb('0x32')](_0x1f67af[_0x46cb('0x2e')],_0x1f67af[_0x46cb('0x2f')]);_0x3d0b83['attributes']=_['intersection'](_0x1f67af['model'],qs['fields'](_0x4d24b6[_0x46cb('0x2f')][_0x46cb('0x33')]));_0x3d0b83[_0x46cb('0x34')]=_0x3d0b83[_0x46cb('0x34')][_0x46cb('0x41')]?_0x3d0b83['attributes']:_0x1f67af['model'];if(_0x4d24b6[_0x46cb('0x2f')][_0x46cb('0x3b')]){_0x3d0b83['include']=[{'all':!![]}];}_0x3d0b83=_[_0x46cb('0x3a')]({},_0x3d0b83,_0x4d24b6[_0x46cb('0x42')]);return db[_0x46cb('0x2b')][_0x46cb('0x43')](_0x3d0b83)[_0x46cb('0x25')](handleEntityNotFound(_0x18be96,null))[_0x46cb('0x25')](respondWithResult(_0x18be96,null))[_0x46cb('0x3d')](handleError(_0x18be96,null));};exports['create']=function(_0x58c69f,_0x449593){return db['ZohoField'][_0x46cb('0x44')](_0x58c69f[_0x46cb('0x45')],{})[_0x46cb('0x25')](respondWithResult(_0x449593,0xc9))['catch'](handleError(_0x449593,null));};exports[_0x46cb('0x24')]=function(_0x5c1665,_0x5c02c9){if(_0x5c1665[_0x46cb('0x45')]['id']){delete _0x5c1665[_0x46cb('0x45')]['id'];}return db[_0x46cb('0x2b')][_0x46cb('0x43')]({'where':{'id':_0x5c1665[_0x46cb('0x3f')]['id']}})[_0x46cb('0x25')](handleEntityNotFound(_0x5c02c9,null))[_0x46cb('0x25')](saveUpdates(_0x5c1665['body'],null))['then'](respondWithResult(_0x5c02c9,null))[_0x46cb('0x3d')](handleError(_0x5c02c9,null));};exports[_0x46cb('0x46')]=function(_0x52e479,_0x34399d){return db[_0x46cb('0x2b')][_0x46cb('0x43')]({'where':{'id':_0x52e479[_0x46cb('0x3f')]['id']}})[_0x46cb('0x25')](handleEntityNotFound(_0x34399d,null))['then'](removeEntity(_0x34399d,null))[_0x46cb('0x3d')](handleError(_0x34399d,null));}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.model.js b/server/api/intZohoField/intZohoField.model.js index 4f9826d..3ac1074 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 _0xa46e=['path','../../config/environment','exports','define','int_zoho_fields','zoho_unique_index','idField','FieldId','lodash','util','api','moment','bluebird'];(function(_0x5a0b65,_0x3bc1bc){var _0x2b228b=function(_0x5bbdcc){while(--_0x5bbdcc){_0x5a0b65['push'](_0x5a0b65['shift']());}};_0x2b228b(++_0x3bc1bc);}(_0xa46e,0x8a));var _0xea46=function(_0x363ef8,_0x4ecb1a){_0x363ef8=_0x363ef8-0x0;var _0x148822=_0xa46e[_0x363ef8];return _0x148822;};'use strict';var _=require(_0xea46('0x0'));var util=require(_0xea46('0x1'));var logger=require('../../config/logger')(_0xea46('0x2'));var moment=require(_0xea46('0x3'));var BPromise=require(_0xea46('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xea46('0x5'));var rimraf=require('rimraf');var config=require(_0xea46('0x6'));var attributes=require('./intZohoField.attributes');module[_0xea46('0x7')]=function(_0x528404,_0x10bee5){return _0x528404[_0xea46('0x8')]('ZohoField',attributes,{'tableName':_0xea46('0x9'),'paranoid':![],'indexes':[{'name':_0xea46('0xa'),'fields':[_0xea46('0xb'),_0xea46('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x7ee1=['request-promise','rimraf','../../config/environment','./intZohoField.attributes','exports','define','int_zoho_fields','idField','FieldId','lodash','moment','bluebird'];(function(_0x1bc22b,_0x46ea2d){var _0x1e9efa=function(_0x50f378){while(--_0x50f378){_0x1bc22b['push'](_0x1bc22b['shift']());}};_0x1e9efa(++_0x46ea2d);}(_0x7ee1,0x8d));var _0x17ee=function(_0x40c0e1,_0x37811d){_0x40c0e1=_0x40c0e1-0x0;var _0x4efaa8=_0x7ee1[_0x40c0e1];return _0x4efaa8;};'use strict';var _=require(_0x17ee('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x17ee('0x1'));var BPromise=require(_0x17ee('0x2'));var rp=require(_0x17ee('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x17ee('0x4'));var config=require(_0x17ee('0x5'));var attributes=require(_0x17ee('0x6'));module[_0x17ee('0x7')]=function(_0x5c0617,_0x52b1db){return _0x5c0617[_0x17ee('0x8')]('ZohoField',attributes,{'tableName':_0x17ee('0x9'),'paranoid':![],'indexes':[{'name':'zoho_unique_index','fields':[_0x17ee('0xa'),_0x17ee('0xb')],'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 74dfff5..60a87ef 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 _0x1d50=['error','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','http','ZohoField,\x20%s,\x20%s','request\x20sent','debug','ZohoField,\x20%s,\x20%s,\x20%s'];(function(_0x1078fd,_0x110cfc){var _0x564774=function(_0x56f411){while(--_0x56f411){_0x1078fd['push'](_0x1078fd['shift']());}};_0x564774(++_0x110cfc);}(_0x1d50,0x124));var _0x01d5=function(_0x41b7d7,_0x556b7f){_0x41b7d7=_0x41b7d7-0x0;var _0x5d771e=_0x1d50[_0x41b7d7];return _0x5d771e;};'use strict';var _=require(_0x01d5('0x0'));var util=require('util');var moment=require(_0x01d5('0x1'));var BPromise=require(_0x01d5('0x2'));var rs=require(_0x01d5('0x3'));var fs=require('fs');var Redis=require(_0x01d5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x01d5('0x5'));var logger=require(_0x01d5('0x6'))(_0x01d5('0x7'));var config=require('../../config/environment');var jayson=require(_0x01d5('0x8'));var client=jayson['client'][_0x01d5('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x6fb4ab,_0x5bc72c,_0x3b0f41){return new BPromise(function(_0x147078,_0x11c46a){return client['request'](_0x6fb4ab,_0x3b0f41)['then'](function(_0x1cbb47){logger['info'](_0x01d5('0xa'),_0x5bc72c,_0x01d5('0xb'));logger[_0x01d5('0xc')](_0x01d5('0xd'),_0x5bc72c,_0x01d5('0xb'),JSON['stringify'](_0x1cbb47));if(_0x1cbb47['error']){if(_0x1cbb47[_0x01d5('0xe')]['code']===0x1f4){logger[_0x01d5('0xe')](_0x01d5('0xa'),_0x5bc72c,_0x1cbb47[_0x01d5('0xe')][_0x01d5('0xf')]);return _0x11c46a(_0x1cbb47[_0x01d5('0xe')]['message']);}logger['error'](_0x01d5('0xa'),_0x5bc72c,_0x1cbb47[_0x01d5('0xe')][_0x01d5('0xf')]);return _0x147078(_0x1cbb47[_0x01d5('0xe')][_0x01d5('0xf')]);}else{logger['info'](_0x01d5('0xa'),_0x5bc72c,_0x01d5('0xb'));_0x147078(_0x1cbb47[_0x01d5('0x10')][_0x01d5('0xf')]);}})[_0x01d5('0x11')](function(_0x24a3cc){logger[_0x01d5('0xe')](_0x01d5('0xa'),_0x5bc72c,_0x24a3cc);_0x11c46a(_0x24a3cc);});});} \ No newline at end of file +var _0xf68c=['../../mysqldb','../../config/utils','../../config/logger','rpc','client','then','info','request\x20sent','debug','stringify','error','code','ZohoField,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring'];(function(_0xa16cc0,_0x217e43){var _0x5b7c04=function(_0xb3e2eb){while(--_0xb3e2eb){_0xa16cc0['push'](_0xa16cc0['shift']());}};_0x5b7c04(++_0x217e43);}(_0xf68c,0x175));var _0xcf68=function(_0x2dff33,_0x3cdfdf){_0x2dff33=_0x2dff33-0x0;var _0x2c722b=_0xf68c[_0x2dff33];return _0x2c722b;};'use strict';var _=require(_0xcf68('0x0'));var util=require(_0xcf68('0x1'));var moment=require(_0xcf68('0x2'));var BPromise=require(_0xcf68('0x3'));var rs=require(_0xcf68('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xcf68('0x5'))['db'];var utils=require(_0xcf68('0x6'));var logger=require(_0xcf68('0x7'))(_0xcf68('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xcf68('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x633cea,_0x1422db,_0x3d7e1f){return new BPromise(function(_0x1d387a,_0x5de3dc){return client['request'](_0x633cea,_0x3d7e1f)[_0xcf68('0xa')](function(_0x15bb8f){logger[_0xcf68('0xb')]('ZohoField,\x20%s,\x20%s',_0x1422db,_0xcf68('0xc'));logger[_0xcf68('0xd')]('ZohoField,\x20%s,\x20%s,\x20%s',_0x1422db,_0xcf68('0xc'),JSON[_0xcf68('0xe')](_0x15bb8f));if(_0x15bb8f[_0xcf68('0xf')]){if(_0x15bb8f['error'][_0xcf68('0x10')]===0x1f4){logger[_0xcf68('0xf')](_0xcf68('0x11'),_0x1422db,_0x15bb8f['error'][_0xcf68('0x12')]);return _0x5de3dc(_0x15bb8f[_0xcf68('0xf')][_0xcf68('0x12')]);}logger[_0xcf68('0xf')](_0xcf68('0x11'),_0x1422db,_0x15bb8f[_0xcf68('0xf')][_0xcf68('0x12')]);return _0x1d387a(_0x15bb8f['error'][_0xcf68('0x12')]);}else{logger[_0xcf68('0xb')](_0xcf68('0x11'),_0x1422db,_0xcf68('0xc'));_0x1d387a(_0x15bb8f[_0xcf68('0x13')][_0xcf68('0x12')]);}})[_0xcf68('0x14')](function(_0x4bf053){logger[_0xcf68('0xf')](_0xcf68('0x11'),_0x1422db,_0x4bf053);_0x5de3dc(_0x4bf053);});});} \ No newline at end of file diff --git a/server/api/integration/index.js b/server/api/integration/index.js index 0890905..4e93acf 100644 --- a/server/api/integration/index.js +++ b/server/api/integration/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x1613dd,_0x48294d){var _0xaae07=function(_0x1e11d5){while(--_0x1e11d5){_0x1613dd['push'](_0x1613dd['shift']());}};_0xaae07(++_0x48294d);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3071('0x0'));var timeout=require(_0x3071('0x1'));var express=require(_0x3071('0x2'));var router=express[_0x3071('0x3')]();var fs_extra=require(_0x3071('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));module[_0x3071('0x7')]=router; \ No newline at end of file +var _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x3045c6,_0x538123){var _0x48304a=function(_0x3f88a2){while(--_0x3f88a2){_0x3045c6['push'](_0x3045c6['shift']());}};_0x48304a(++_0x538123);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x44bcb0,_0x235aa9){_0x44bcb0=_0x44bcb0-0x0;var _0xfaf881=_0xcb91[_0x44bcb0];return _0xfaf881;};'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/integration/integration.attributes.js b/server/api/integration/integration.attributes.js index 37ca267..99a9bf6 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 _0xd35f=['sequelize','unique_name_and_version','STRING','INTEGER','BOOLEAN','state'];(function(_0x26b622,_0x237e9e){var _0x58a028=function(_0xde1652){while(--_0xde1652){_0x26b622['push'](_0x26b622['shift']());}};_0x58a028(++_0x237e9e);}(_0xd35f,0xd2));var _0xfd35=function(_0x59dccc,_0x184c1c){_0x59dccc=_0x59dccc-0x0;var _0xc97bcb=_0xd35f[_0x59dccc];return _0xc97bcb;};'use strict';var Sequelize=require(_0xfd35('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xfd35('0x1')},'version':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xfd35('0x1')},'main':{'type':Sequelize[_0xfd35('0x2')],'defaultValue':'app.js'},'filename':{'type':Sequelize[_0xfd35('0x2')]},'path':{'type':Sequelize[_0xfd35('0x2')]},'type':{'type':Sequelize[_0xfd35('0x2')]},'size':{'type':Sequelize[_0xfd35('0x3')]},'active':{'type':Sequelize[_0xfd35('0x4')],'defaultValue':![]},'author':{'type':Sequelize['STRING']},'logo':{'type':Sequelize[_0xfd35('0x2')]},'state':{'type':Sequelize[_0xfd35('0x2')],'unique':_0xfd35('0x5')},'description':{'type':Sequelize[_0xfd35('0x2')]},'title':{'type':Sequelize[_0xfd35('0x2')]},'remoteUri':{'type':Sequelize['STRING']},'link':{'type':Sequelize[_0xfd35('0x2')],'defaultValue':'#'}}; \ No newline at end of file +var _0x7e87=['exports','STRING','unique_name_and_version','INTEGER','BOOLEAN'];(function(_0x565711,_0x4e20bf){var _0x49df60=function(_0x122dbc){while(--_0x122dbc){_0x565711['push'](_0x565711['shift']());}};_0x49df60(++_0x4e20bf);}(_0x7e87,0x172));var _0x77e8=function(_0x3ea882,_0x5b2e3f){_0x3ea882=_0x3ea882-0x0;var _0x3bb58e=_0x7e87[_0x3ea882];return _0x3bb58e;};'use strict';var Sequelize=require('sequelize');module[_0x77e8('0x0')]={'name':{'type':Sequelize[_0x77e8('0x1')],'allowNull':![],'unique':_0x77e8('0x2')},'version':{'type':Sequelize[_0x77e8('0x1')],'allowNull':![],'unique':_0x77e8('0x2')},'main':{'type':Sequelize[_0x77e8('0x1')],'defaultValue':'app.js'},'filename':{'type':Sequelize[_0x77e8('0x1')]},'path':{'type':Sequelize[_0x77e8('0x1')]},'type':{'type':Sequelize[_0x77e8('0x1')]},'size':{'type':Sequelize[_0x77e8('0x3')]},'active':{'type':Sequelize[_0x77e8('0x4')],'defaultValue':![]},'author':{'type':Sequelize[_0x77e8('0x1')]},'logo':{'type':Sequelize['STRING']},'state':{'type':Sequelize[_0x77e8('0x1')],'unique':'state'},'description':{'type':Sequelize[_0x77e8('0x1')]},'title':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x77e8('0x1')]},'link':{'type':Sequelize[_0x77e8('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 fdc5bf7..00d80c3 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 _0xdb28=['error','stack','name','send','index','Integration','fieldName','type','key','map','query','keys','model','fields','attributes','length','nolimit','order','sort','filters','filter','where','VIRTUAL','merge','options','includeAll','findAll','rows','catch','show','params','rawAttributes','intersection','include','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','count','limit','set','apply','save','update','then','sendStatus'];(function(_0x200d2a,_0x2635f4){var _0x24868e=function(_0x4f4ef2){while(--_0x4f4ef2){_0x200d2a['push'](_0x200d2a['shift']());}};_0x24868e(++_0x2635f4);}(_0xdb28,0x106));var _0x8db2=function(_0x34a8f1,_0x3b701f){_0x34a8f1=_0x34a8f1-0x0;var _0x2eb12e=_0xdb28[_0x34a8f1];return _0x2eb12e;};'use strict';var emlformat=require(_0x8db2('0x0'));var rimraf=require(_0x8db2('0x1'));var zipdir=require(_0x8db2('0x2'));var jsonpatch=require(_0x8db2('0x3'));var rp=require('request-promise');var moment=require(_0x8db2('0x4'));var BPromise=require(_0x8db2('0x5'));var Mustache=require(_0x8db2('0x6'));var util=require(_0x8db2('0x7'));var path=require(_0x8db2('0x8'));var sox=require('sox');var csv=require(_0x8db2('0x9'));var ejs=require(_0x8db2('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x8db2('0xb'));var crypto=require(_0x8db2('0xc'));var jsforce=require(_0x8db2('0xd'));var deskjs=require(_0x8db2('0xe'));var toCsv=require(_0x8db2('0x9'));var querystring=require(_0x8db2('0xf'));var Papa=require(_0x8db2('0x10'));var Redis=require('ioredis');var authService=require(_0x8db2('0x11'));var qs=require(_0x8db2('0x12'));var as=require(_0x8db2('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8db2('0x14'))(_0x8db2('0x15'));var utils=require('../../config/utils');var config=require(_0x8db2('0x16'));var licenseUtil=require(_0x8db2('0x17'));var db=require(_0x8db2('0x18'))['db'];function respondWithStatusCode(_0x204f49,_0x37d017){_0x37d017=_0x37d017||0xcc;return function(_0x559fb1){if(_0x559fb1){return _0x204f49['sendStatus'](_0x37d017);}return _0x204f49[_0x8db2('0x19')](_0x37d017)[_0x8db2('0x1a')]();};}function respondWithResult(_0x350d61,_0x1d6a15){_0x1d6a15=_0x1d6a15||0xc8;return function(_0x227355){if(_0x227355){return _0x350d61[_0x8db2('0x19')](_0x1d6a15)[_0x8db2('0x1b')](_0x227355);}};}function respondWithFilteredResult(_0x3c96a7,_0x131252){return function(_0x16c8c2){if(_0x16c8c2){var _0x5489a9=typeof _0x131252[_0x8db2('0x1c')]===_0x8db2('0x1d')&&typeof _0x131252['limit']===_0x8db2('0x1d');var _0x44957d=_0x16c8c2[_0x8db2('0x1e')];var _0x3fddc2=_0x5489a9?0x0:_0x131252[_0x8db2('0x1c')];var _0x46ce14=_0x5489a9?_0x16c8c2['count']:_0x131252['offset']+_0x131252[_0x8db2('0x1f')];var _0x104e33;if(_0x46ce14>=_0x44957d){_0x46ce14=_0x44957d;_0x104e33=0xc8;}else{_0x104e33=0xce;}_0x3c96a7[_0x8db2('0x19')](_0x104e33);return _0x3c96a7[_0x8db2('0x20')]('Content-Range',_0x3fddc2+'-'+_0x46ce14+'/'+_0x44957d)[_0x8db2('0x1b')](_0x16c8c2);}return null;};}function patchUpdates(_0x36a9ff){return function(_0x260940){try{jsonpatch[_0x8db2('0x21')](_0x260940,_0x36a9ff,!![]);}catch(_0x3dbe8e){return BPromise['reject'](_0x3dbe8e);}return _0x260940[_0x8db2('0x22')]();};}function saveUpdates(_0x3e30e6,_0x18f69c){return function(_0x125be2){if(_0x125be2){return _0x125be2[_0x8db2('0x23')](_0x3e30e6)[_0x8db2('0x24')](function(_0x796ec1){return _0x796ec1;});}return null;};}function removeEntity(_0x5c6614,_0x256202){return function(_0x4f6516){if(_0x4f6516){return _0x4f6516['destroy']()['then'](function(){_0x5c6614['status'](0xcc)[_0x8db2('0x1a')]();});}};}function handleEntityNotFound(_0x29b5cd,_0x3be281){return function(_0x2baed0){if(!_0x2baed0){_0x29b5cd[_0x8db2('0x25')](0x194);}return _0x2baed0;};}function handleError(_0x8d4f54,_0x58cd9d){_0x58cd9d=_0x58cd9d||0x1f4;return function(_0x3544ba){logger[_0x8db2('0x26')](_0x3544ba[_0x8db2('0x27')]);if(_0x3544ba[_0x8db2('0x28')]){delete _0x3544ba['name'];}_0x8d4f54[_0x8db2('0x19')](_0x58cd9d)[_0x8db2('0x29')](_0x3544ba);};}exports[_0x8db2('0x2a')]=function(_0x1687ed,_0xbe5ece){var _0x21bae5={},_0xa54ea3={},_0x3124d5={'count':0x0,'rows':[]};var _0xbc5366=_['map'](db[_0x8db2('0x2b')]['rawAttributes'],function(_0x59cb77){return{'name':_0x59cb77[_0x8db2('0x2c')],'type':_0x59cb77[_0x8db2('0x2d')][_0x8db2('0x2e')]};});_0xa54ea3['model']=_[_0x8db2('0x2f')](_0xbc5366,'name');_0xa54ea3[_0x8db2('0x30')]=_[_0x8db2('0x31')](_0x1687ed[_0x8db2('0x30')]);_0xa54ea3['filters']=_['intersection'](_0xa54ea3[_0x8db2('0x32')],_0xa54ea3[_0x8db2('0x30')]);_0x21bae5['attributes']=_['intersection'](_0xa54ea3[_0x8db2('0x32')],qs[_0x8db2('0x33')](_0x1687ed[_0x8db2('0x30')][_0x8db2('0x33')]));_0x21bae5[_0x8db2('0x34')]=_0x21bae5[_0x8db2('0x34')][_0x8db2('0x35')]?_0x21bae5[_0x8db2('0x34')]:_0xa54ea3[_0x8db2('0x32')];if(!_0x1687ed[_0x8db2('0x30')]['hasOwnProperty'](_0x8db2('0x36'))){_0x21bae5[_0x8db2('0x1f')]=qs['limit'](_0x1687ed[_0x8db2('0x30')][_0x8db2('0x1f')]);_0x21bae5['offset']=qs['offset'](_0x1687ed[_0x8db2('0x30')]['offset']);}_0x21bae5[_0x8db2('0x37')]=qs[_0x8db2('0x38')](_0x1687ed[_0x8db2('0x30')][_0x8db2('0x38')]);_0x21bae5['where']=qs[_0x8db2('0x39')](_['pick'](_0x1687ed[_0x8db2('0x30')],_0xa54ea3[_0x8db2('0x39')]),_0xbc5366);if(_0x1687ed[_0x8db2('0x30')][_0x8db2('0x3a')]){_0x21bae5['where']=_['merge'](_0x21bae5[_0x8db2('0x3b')],{'$or':_[_0x8db2('0x2f')](_0xbc5366,function(_0x5dc2b4){if(_0x5dc2b4[_0x8db2('0x2d')]!==_0x8db2('0x3c')){var _0x656dd2={};_0x656dd2[_0x5dc2b4['name']]={'$like':'%'+_0x1687ed[_0x8db2('0x30')][_0x8db2('0x3a')]+'%'};return _0x656dd2;}})});}_0x21bae5=_[_0x8db2('0x3d')]({},_0x21bae5,_0x1687ed[_0x8db2('0x3e')]);var _0x2e6f0c={'where':_0x21bae5[_0x8db2('0x3b')]};return db[_0x8db2('0x2b')][_0x8db2('0x1e')](_0x2e6f0c)[_0x8db2('0x24')](function(_0x63c561){_0x3124d5[_0x8db2('0x1e')]=_0x63c561;if(_0x1687ed[_0x8db2('0x30')][_0x8db2('0x3f')]){_0x21bae5['include']=[{'all':!![]}];}return db[_0x8db2('0x2b')][_0x8db2('0x40')](_0x21bae5);})['then'](function(_0x49a7ae){_0x3124d5[_0x8db2('0x41')]=_0x49a7ae;return _0x3124d5;})['then'](respondWithFilteredResult(_0xbe5ece,_0x21bae5))[_0x8db2('0x42')](handleError(_0xbe5ece,null));};exports[_0x8db2('0x43')]=function(_0x313130,_0x307783){var _0xb4fe2c={'raw':![],'where':{'id':_0x313130[_0x8db2('0x44')]['id']}},_0x30d606={};_0x30d606['model']=_[_0x8db2('0x31')](db[_0x8db2('0x2b')][_0x8db2('0x45')]);_0x30d606[_0x8db2('0x30')]=_['keys'](_0x313130[_0x8db2('0x30')]);_0x30d606[_0x8db2('0x39')]=_[_0x8db2('0x46')](_0x30d606[_0x8db2('0x32')],_0x30d606['query']);_0xb4fe2c[_0x8db2('0x34')]=_['intersection'](_0x30d606[_0x8db2('0x32')],qs[_0x8db2('0x33')](_0x313130[_0x8db2('0x30')]['fields']));_0xb4fe2c['attributes']=_0xb4fe2c[_0x8db2('0x34')]['length']?_0xb4fe2c[_0x8db2('0x34')]:_0x30d606[_0x8db2('0x32')];if(_0x313130[_0x8db2('0x30')][_0x8db2('0x3f')]){_0xb4fe2c[_0x8db2('0x47')]=[{'all':!![]}];}_0xb4fe2c=_[_0x8db2('0x3d')]({},_0xb4fe2c,_0x313130[_0x8db2('0x3e')]);return db[_0x8db2('0x2b')][_0x8db2('0x48')](_0xb4fe2c)[_0x8db2('0x24')](handleEntityNotFound(_0x307783,null))[_0x8db2('0x24')](respondWithResult(_0x307783,null))[_0x8db2('0x42')](handleError(_0x307783,null));};exports['create']=function(_0x449109,_0x2ada52){return db[_0x8db2('0x2b')][_0x8db2('0x49')](_0x449109['body'],{})['then'](respondWithResult(_0x2ada52,0xc9))[_0x8db2('0x42')](handleError(_0x2ada52,null));};exports[_0x8db2('0x23')]=function(_0x164020,_0x4c66e5){if(_0x164020['body']['id']){delete _0x164020['body']['id'];}return db[_0x8db2('0x2b')][_0x8db2('0x48')]({'where':{'id':_0x164020[_0x8db2('0x44')]['id']}})[_0x8db2('0x24')](handleEntityNotFound(_0x4c66e5,null))[_0x8db2('0x24')](saveUpdates(_0x164020[_0x8db2('0x4a')],null))[_0x8db2('0x24')](respondWithResult(_0x4c66e5,null))['catch'](handleError(_0x4c66e5,null));};exports['destroy']=function(_0x3d29bc,_0x18c6ef){return db[_0x8db2('0x2b')][_0x8db2('0x48')]({'where':{'id':_0x3d29bc[_0x8db2('0x44')]['id']}})[_0x8db2('0x24')](handleEntityNotFound(_0x18c6ef,null))[_0x8db2('0x24')](removeEntity(_0x18c6ef,null))[_0x8db2('0x42')](handleError(_0x18c6ef,null));}; \ No newline at end of file +var _0x2ef3=['update','error','stack','name','send','map','rawAttributes','fieldName','type','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','options','Integration','then','includeAll','include','findAll','catch','show','params','keys','create','body','find','destroy','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'];(function(_0x23e0c1,_0x3db138){var _0x5b19e6=function(_0x560fc0){while(--_0x560fc0){_0x23e0c1['push'](_0x23e0c1['shift']());}};_0x5b19e6(++_0x3db138);}(_0x2ef3,0xba));var _0x32ef=function(_0x40fdeb,_0x137ed9){_0x40fdeb=_0x40fdeb-0x0;var _0x2ae88c=_0x2ef3[_0x40fdeb];return _0x2ae88c;};'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['Integration'][_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')]=[{'all':!![]}];}return db[_0x32ef('0x3d')][_0x32ef('0x41')](_0x5a04cd);})[_0x32ef('0x3e')](function(_0x3c0e44){_0x3c569d['rows']=_0x3c0e44;return _0x3c569d;})['then'](respondWithFilteredResult(_0x2f5d06,_0x5a04cd))[_0x32ef('0x42')](handleError(_0x2f5d06,null));};exports[_0x32ef('0x43')]=function(_0x2a33dd,_0x765c63){var _0x5dca14={'raw':![],'where':{'id':_0x2a33dd[_0x32ef('0x44')]['id']}},_0x2901a1={};_0x2901a1['model']=_[_0x32ef('0x45')](db['Integration'][_0x32ef('0x2a')]);_0x2901a1[_0x32ef('0x2f')]=_[_0x32ef('0x45')](_0x2a33dd[_0x32ef('0x2f')]);_0x2901a1[_0x32ef('0x30')]=_[_0x32ef('0x32')](_0x2901a1[_0x32ef('0x2e')],_0x2901a1[_0x32ef('0x2f')]);_0x5dca14[_0x32ef('0x31')]=_[_0x32ef('0x32')](_0x2901a1['model'],qs[_0x32ef('0x33')](_0x2a33dd['query'][_0x32ef('0x33')]));_0x5dca14[_0x32ef('0x31')]=_0x5dca14[_0x32ef('0x31')]['length']?_0x5dca14[_0x32ef('0x31')]:_0x2901a1[_0x32ef('0x2e')];if(_0x2a33dd[_0x32ef('0x2f')][_0x32ef('0x3f')]){_0x5dca14[_0x32ef('0x40')]=[{'all':!![]}];}_0x5dca14=_[_0x32ef('0x3b')]({},_0x5dca14,_0x2a33dd[_0x32ef('0x3c')]);return db['Integration']['find'](_0x5dca14)[_0x32ef('0x3e')](handleEntityNotFound(_0x765c63,null))[_0x32ef('0x3e')](respondWithResult(_0x765c63,null))[_0x32ef('0x42')](handleError(_0x765c63,null));};exports[_0x32ef('0x46')]=function(_0x209361,_0xd67dc9){return db[_0x32ef('0x3d')][_0x32ef('0x46')](_0x209361[_0x32ef('0x47')],{})[_0x32ef('0x3e')](respondWithResult(_0xd67dc9,0xc9))[_0x32ef('0x42')](handleError(_0xd67dc9,null));};exports[_0x32ef('0x24')]=function(_0x36a65c,_0x4c2534){if(_0x36a65c[_0x32ef('0x47')]['id']){delete _0x36a65c[_0x32ef('0x47')]['id'];}return db[_0x32ef('0x3d')][_0x32ef('0x48')]({'where':{'id':_0x36a65c[_0x32ef('0x44')]['id']}})[_0x32ef('0x3e')](handleEntityNotFound(_0x4c2534,null))[_0x32ef('0x3e')](saveUpdates(_0x36a65c[_0x32ef('0x47')],null))[_0x32ef('0x3e')](respondWithResult(_0x4c2534,null))[_0x32ef('0x42')](handleError(_0x4c2534,null));};exports[_0x32ef('0x49')]=function(_0x29d456,_0x272377){return db[_0x32ef('0x3d')][_0x32ef('0x48')]({'where':{'id':_0x29d456[_0x32ef('0x44')]['id']}})[_0x32ef('0x3e')](handleEntityNotFound(_0x272377,null))[_0x32ef('0x3e')](removeEntity(_0x272377,null))['catch'](handleError(_0x272377,null));}; \ No newline at end of file diff --git a/server/api/integration/integration.model.js b/server/api/integration/integration.model.js index 7a558d7..8829733 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 _0x1632=['request-promise','path','rimraf','../../config/environment','./integration.attributes','exports','define','lodash','util','../../config/logger','api','bluebird'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x1632,0x14b));var _0x2163=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1632[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x2163('0x0'));var util=require(_0x2163('0x1'));var logger=require(_0x2163('0x2'))(_0x2163('0x3'));var moment=require('moment');var BPromise=require(_0x2163('0x4'));var rp=require(_0x2163('0x5'));var fs=require('fs');var path=require(_0x2163('0x6'));var rimraf=require(_0x2163('0x7'));var config=require(_0x2163('0x8'));var attributes=require(_0x2163('0x9'));module[_0x2163('0xa')]=function(_0x12a136,_0x55c228){return _0x12a136[_0x2163('0xb')]('Integration',attributes,{'tableName':'integrations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x25fe=['../../config/environment','./integration.attributes','exports','define','Integration','integrations','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x2f5294,_0x58552f){var _0x5dbefb=function(_0x11594a){while(--_0x11594a){_0x2f5294['push'](_0x2f5294['shift']());}};_0x5dbefb(++_0x58552f);}(_0x25fe,0x12c));var _0xe25f=function(_0x25b4a4,_0x2e081b){_0x25b4a4=_0x25b4a4-0x0;var _0x707267=_0x25fe[_0x25b4a4];return _0x707267;};'use strict';var _=require(_0xe25f('0x0'));var util=require(_0xe25f('0x1'));var logger=require(_0xe25f('0x2'))(_0xe25f('0x3'));var moment=require(_0xe25f('0x4'));var BPromise=require(_0xe25f('0x5'));var rp=require(_0xe25f('0x6'));var fs=require('fs');var path=require(_0xe25f('0x7'));var rimraf=require('rimraf');var config=require(_0xe25f('0x8'));var attributes=require(_0xe25f('0x9'));module[_0xe25f('0xa')]=function(_0x1ee41f,_0x5bff16){return _0x1ee41f[_0xe25f('0xb')](_0xe25f('0xc'),attributes,{'tableName':_0xe25f('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/integration/integration.rpc.js b/server/api/integration/integration.rpc.js index c6d2c01..d21bc88 100644 --- a/server/api/integration/integration.rpc.js +++ b/server/api/integration/integration.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe2fe=['then','info','Integration,\x20%s,\x20%s','stringify','error','message','request\x20sent','result','lodash','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request'];(function(_0x4fa5c0,_0x3103db){var _0x560e42=function(_0x469377){while(--_0x469377){_0x4fa5c0['push'](_0x4fa5c0['shift']());}};_0x560e42(++_0x3103db);}(_0xe2fe,0x86));var _0xee2f=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xe2fe[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0xee2f('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xee2f('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xee2f('0x2'));var db=require(_0xee2f('0x3'))['db'];var utils=require(_0xee2f('0x4'));var logger=require(_0xee2f('0x5'))(_0xee2f('0x6'));var config=require('../../config/environment');var jayson=require(_0xee2f('0x7'));var client=jayson[_0xee2f('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1533a0,_0x2e1c8c,_0x5a7975){return new BPromise(function(_0x3c4095,_0x5ea796){return client[_0xee2f('0x9')](_0x1533a0,_0x5a7975)[_0xee2f('0xa')](function(_0x53f7dd){logger[_0xee2f('0xb')](_0xee2f('0xc'),_0x2e1c8c,'request\x20sent');logger['debug']('Integration,\x20%s,\x20%s,\x20%s',_0x2e1c8c,'request\x20sent',JSON[_0xee2f('0xd')](_0x53f7dd));if(_0x53f7dd['error']){if(_0x53f7dd['error']['code']===0x1f4){logger[_0xee2f('0xe')](_0xee2f('0xc'),_0x2e1c8c,_0x53f7dd[_0xee2f('0xe')][_0xee2f('0xf')]);return _0x5ea796(_0x53f7dd[_0xee2f('0xe')][_0xee2f('0xf')]);}logger['error'](_0xee2f('0xc'),_0x2e1c8c,_0x53f7dd['error'][_0xee2f('0xf')]);return _0x3c4095(_0x53f7dd[_0xee2f('0xe')]['message']);}else{logger[_0xee2f('0xb')](_0xee2f('0xc'),_0x2e1c8c,_0xee2f('0x10'));_0x3c4095(_0x53f7dd[_0xee2f('0x11')][_0xee2f('0xf')]);}})['catch'](function(_0x3f6372){logger['error'](_0xee2f('0xc'),_0x2e1c8c,_0x3f6372);_0x5ea796(_0x3f6372);});});} \ No newline at end of file +var _0xda2d=['bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','client','http','then','Integration,\x20%s,\x20%s','request\x20sent','debug','Integration,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','util','moment'];(function(_0x3b660f,_0x45c3db){var _0x187a29=function(_0x11cedf){while(--_0x11cedf){_0x3b660f['push'](_0x3b660f['shift']());}};_0x187a29(++_0x45c3db);}(_0xda2d,0x102));var _0xdda2=function(_0xb997f1,_0x2b3811){_0xb997f1=_0xb997f1-0x0;var _0x24c56b=_0xda2d[_0xb997f1];return _0x24c56b;};'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']('Integration,\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')]('Integration,\x20%s,\x20%s',_0x2f55dc,_0x55d674);_0x341c7b(_0x55d674);});});} \ No newline at end of file diff --git a/server/api/integrationReport/index.js b/server/api/integrationReport/index.js index a314c09..76e2ea9 100644 --- a/server/api/integrationReport/index.js +++ b/server/api/integrationReport/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1261=['create','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./integrationReport.controller','index','get','isAuthenticated','describe','/:id','post'];(function(_0x103722,_0x5b7ec5){var _0xea5be6=function(_0x77ae28){while(--_0x77ae28){_0x103722['push'](_0x103722['shift']());}};_0xea5be6(++_0x5b7ec5);}(_0x1261,0x144));var _0x1126=function(_0x1551af,_0x5223c3){_0x1551af=_0x1551af-0x0;var _0xd8eb82=_0x1261[_0x1551af];return _0xd8eb82;};'use strict';var multer=require('multer');var util=require(_0x1126('0x0'));var path=require(_0x1126('0x1'));var timeout=require(_0x1126('0x2'));var express=require(_0x1126('0x3'));var router=express[_0x1126('0x4')]();var fs_extra=require(_0x1126('0x5'));var auth=require(_0x1126('0x6'));var interaction=require(_0x1126('0x7'));var config=require(_0x1126('0x8'));var controller=require(_0x1126('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0x1126('0xa')]);router[_0x1126('0xb')]('/describe',auth[_0x1126('0xc')](),controller[_0x1126('0xd')]);router[_0x1126('0xb')](_0x1126('0xe'),auth[_0x1126('0xc')](),controller['show']);router[_0x1126('0xf')]('/',auth[_0x1126('0xc')](),controller[_0x1126('0x10')]);router['put'](_0x1126('0xe'),auth['isAuthenticated'](),controller['update']);router[_0x1126('0x11')]('/:id',auth[_0x1126('0xc')](),controller[_0x1126('0x12')]);module[_0x1126('0x13')]=router; \ No newline at end of file +var _0xc6ac=['./integrationReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','put','delete','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x29c68a,_0x373534){var _0x26852d=function(_0x2dbb21){while(--_0x2dbb21){_0x29c68a['push'](_0x29c68a['shift']());}};_0x26852d(++_0x373534);}(_0xc6ac,0x15b));var _0xcc6a=function(_0x152dda,_0xb60739){_0x152dda=_0x152dda-0x0;var _0x349c47=_0xc6ac[_0x152dda];return _0x349c47;};'use strict';var multer=require(_0xcc6a('0x0'));var util=require(_0xcc6a('0x1'));var path=require(_0xcc6a('0x2'));var timeout=require(_0xcc6a('0x3'));var express=require(_0xcc6a('0x4'));var router=express[_0xcc6a('0x5')]();var fs_extra=require(_0xcc6a('0x6'));var auth=require(_0xcc6a('0x7'));var interaction=require(_0xcc6a('0x8'));var config=require(_0xcc6a('0x9'));var controller=require(_0xcc6a('0xa'));router[_0xcc6a('0xb')]('/',auth[_0xcc6a('0xc')](),controller[_0xcc6a('0xd')]);router['get'](_0xcc6a('0xe'),auth[_0xcc6a('0xc')](),controller[_0xcc6a('0xf')]);router['get'](_0xcc6a('0x10'),auth[_0xcc6a('0xc')](),controller[_0xcc6a('0x11')]);router[_0xcc6a('0x12')]('/',auth[_0xcc6a('0xc')](),controller['create']);router[_0xcc6a('0x13')](_0xcc6a('0x10'),auth[_0xcc6a('0xc')](),controller['update']);router[_0xcc6a('0x14')](_0xcc6a('0x10'),auth[_0xcc6a('0xc')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.attributes.js b/server/api/integrationReport/integrationReport.attributes.js index f1f728f..c561d45 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 _0xcc21=['RECEIVED','FAILED','sequelize','exports','STRING','DATE','INTEGER','BOOLEAN','TEXT','ENUM','SENT'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xcc21,0xde));var _0x1cc2=function(_0x1fd2e6,_0x319411){_0x1fd2e6=_0x1fd2e6-0x0;var _0x38284b=_0xcc21[_0x1fd2e6];return _0x38284b;};'use strict';var Sequelize=require(_0x1cc2('0x0'));module[_0x1cc2('0x1')]={'integration':{'type':Sequelize['STRING']},'eventChannel':{'type':Sequelize[_0x1cc2('0x2')]},'exitStatus':{'type':Sequelize[_0x1cc2('0x2')]},'ticketId':{'type':Sequelize[_0x1cc2('0x2')]},'integrationId':{'type':Sequelize['INTEGER']},'contacts':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x1cc2('0x2')]},'calleridnum':{'type':Sequelize[_0x1cc2('0x2')]},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x1cc2('0x2')]},'interface':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x1cc2('0x2')]},'agentcalledAt':{'type':Sequelize[_0x1cc2('0x3')]},'agentconnectAt':{'type':Sequelize['DATE']},'holdtime':{'type':Sequelize[_0x1cc2('0x4')]},'agentcomplete':{'type':Sequelize[_0x1cc2('0x5')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize['DATE']},'talktime':{'type':Sequelize[_0x1cc2('0x4')]},'agentacw':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'acwtime':{'type':Sequelize['INTEGER']},'reason':{'type':Sequelize['STRING']},'agentringnoanswer':{'type':Sequelize[_0x1cc2('0x5')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize['DATE']},'agentdump':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0x1cc2('0x3')]},'lastevent':{'type':Sequelize[_0x1cc2('0x2')]},'channel':{'type':Sequelize[_0x1cc2('0x2')]},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize[_0x1cc2('0x2')]},'connectedlinenum':{'type':Sequelize[_0x1cc2('0x2')]},'connectedlinename':{'type':Sequelize[_0x1cc2('0x2')]},'language':{'type':Sequelize[_0x1cc2('0x2')]},'accountcode':{'type':Sequelize[_0x1cc2('0x2')]},'context':{'type':Sequelize[_0x1cc2('0x2')]},'exten':{'type':Sequelize[_0x1cc2('0x2')]},'priority':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize[_0x1cc2('0x2')]},'destchannelstate':{'type':Sequelize[_0x1cc2('0x4')]},'destchannelstatedesc':{'type':Sequelize[_0x1cc2('0x2')]},'destcalleridnum':{'type':Sequelize[_0x1cc2('0x2')]},'destcalleridname':{'type':Sequelize[_0x1cc2('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0x1cc2('0x2')]},'destconnectedlinename':{'type':Sequelize[_0x1cc2('0x2')]},'destlanguage':{'type':Sequelize['STRING']},'destaccountcode':{'type':Sequelize[_0x1cc2('0x2')]},'destcontext':{'type':Sequelize[_0x1cc2('0x2')]},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize['STRING']},'destuniqueid':{'type':Sequelize[_0x1cc2('0x2')]},'messageId':{'type':Sequelize[_0x1cc2('0x2')]},'inReplyTo':{'type':Sequelize[_0x1cc2('0x2')]},'subject':{'type':Sequelize[_0x1cc2('0x2')]},'from':{'type':Sequelize[_0x1cc2('0x2')]},'to':{'type':Sequelize[_0x1cc2('0x2')]},'cc':{'type':Sequelize[_0x1cc2('0x2')]},'attachment':{'type':Sequelize['TEXT']},'html':{'type':Sequelize[_0x1cc2('0x6')]},'text':{'type':Sequelize[_0x1cc2('0x6')]},'status':{'type':Sequelize[_0x1cc2('0x7')](_0x1cc2('0x8'),'SENDING',_0x1cc2('0x9'),_0x1cc2('0xa'))},'url':{'type':Sequelize[_0x1cc2('0x2')]},'app':{'type':Sequelize[_0x1cc2('0x2')]},'appdata':{'type':Sequelize[_0x1cc2('0x2')]},'projectId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x481f=['exports','STRING','INTEGER','DATE','BOOLEAN','TEXT','SENT','SENDING','RECEIVED','FAILED','sequelize'];(function(_0x335d12,_0x4c9a5c){var _0x2723d2=function(_0x749bc1){while(--_0x749bc1){_0x335d12['push'](_0x335d12['shift']());}};_0x2723d2(++_0x4c9a5c);}(_0x481f,0x18b));var _0xf481=function(_0x2ae618,_0x3a6493){_0x2ae618=_0x2ae618-0x0;var _0x68a1ce=_0x481f[_0x2ae618];return _0x68a1ce;};'use strict';var Sequelize=require(_0xf481('0x0'));module[_0xf481('0x1')]={'integration':{'type':Sequelize['STRING']},'eventChannel':{'type':Sequelize[_0xf481('0x2')]},'exitStatus':{'type':Sequelize[_0xf481('0x2')]},'ticketId':{'type':Sequelize[_0xf481('0x2')]},'integrationId':{'type':Sequelize[_0xf481('0x3')]},'contacts':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0xf481('0x2')]},'calleridname':{'type':Sequelize[_0xf481('0x2')]},'queue':{'type':Sequelize[_0xf481('0x2')]},'interface':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0xf481('0x2')]},'agentcalledAt':{'type':Sequelize[_0xf481('0x4')]},'agentconnectAt':{'type':Sequelize[_0xf481('0x4')]},'holdtime':{'type':Sequelize[_0xf481('0x3')]},'agentcomplete':{'type':Sequelize[_0xf481('0x5')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize['DATE']},'talktime':{'type':Sequelize[_0xf481('0x3')]},'agentacw':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'acwtime':{'type':Sequelize[_0xf481('0x3')]},'reason':{'type':Sequelize['STRING']},'agentringnoanswer':{'type':Sequelize[_0xf481('0x5')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize['DATE']},'agentdump':{'type':Sequelize[_0xf481('0x5')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0xf481('0x4')]},'lastevent':{'type':Sequelize[_0xf481('0x2')]},'channel':{'type':Sequelize[_0xf481('0x2')]},'channelstate':{'type':Sequelize[_0xf481('0x3')]},'channelstatedesc':{'type':Sequelize[_0xf481('0x2')]},'connectedlinenum':{'type':Sequelize[_0xf481('0x2')]},'connectedlinename':{'type':Sequelize[_0xf481('0x2')]},'language':{'type':Sequelize[_0xf481('0x2')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0xf481('0x2')]},'exten':{'type':Sequelize[_0xf481('0x2')]},'priority':{'type':Sequelize[_0xf481('0x2')]},'destchannel':{'type':Sequelize[_0xf481('0x2')]},'destchannelstate':{'type':Sequelize[_0xf481('0x3')]},'destchannelstatedesc':{'type':Sequelize[_0xf481('0x2')]},'destcalleridnum':{'type':Sequelize['STRING']},'destcalleridname':{'type':Sequelize[_0xf481('0x2')]},'destconnectedlinenum':{'type':Sequelize['STRING']},'destconnectedlinename':{'type':Sequelize[_0xf481('0x2')]},'destlanguage':{'type':Sequelize[_0xf481('0x2')]},'destaccountcode':{'type':Sequelize['STRING']},'destcontext':{'type':Sequelize[_0xf481('0x2')]},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize['STRING']},'destuniqueid':{'type':Sequelize['STRING']},'messageId':{'type':Sequelize[_0xf481('0x2')]},'inReplyTo':{'type':Sequelize[_0xf481('0x2')]},'subject':{'type':Sequelize[_0xf481('0x2')]},'from':{'type':Sequelize['STRING']},'to':{'type':Sequelize[_0xf481('0x2')]},'cc':{'type':Sequelize['STRING']},'attachment':{'type':Sequelize[_0xf481('0x6')]},'html':{'type':Sequelize[_0xf481('0x6')]},'text':{'type':Sequelize[_0xf481('0x6')]},'status':{'type':Sequelize['ENUM'](_0xf481('0x7'),_0xf481('0x8'),_0xf481('0x9'),_0xf481('0xa'))},'url':{'type':Sequelize[_0xf481('0x2')]},'app':{'type':Sequelize[_0xf481('0x2')]},'appdata':{'type':Sequelize[_0xf481('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 0d29859..4e2d56a 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 _0x0a33=['../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/license/util','../../mysqldb','sendStatus','status','end','json','limit','undefined','count','offset','Content-Range','save','update','then','destroy','error','stack','name','send','index','IntegrationReport','fieldName','type','key','model','map','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','rawAttributes','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis'];(function(_0x4164d5,_0x24d015){var _0x5231a2=function(_0x25fc6a){while(--_0x25fc6a){_0x4164d5['push'](_0x4164d5['shift']());}};_0x5231a2(++_0x24d015);}(_0x0a33,0x83));var _0x30a3=function(_0x403c20,_0x4a7b99){_0x403c20=_0x403c20-0x0;var _0x2b271a=_0x0a33[_0x403c20];return _0x2b271a;};'use strict';var emlformat=require(_0x30a3('0x0'));var rimraf=require(_0x30a3('0x1'));var zipdir=require(_0x30a3('0x2'));var jsonpatch=require(_0x30a3('0x3'));var rp=require(_0x30a3('0x4'));var moment=require('moment');var BPromise=require(_0x30a3('0x5'));var Mustache=require(_0x30a3('0x6'));var util=require(_0x30a3('0x7'));var path=require(_0x30a3('0x8'));var sox=require(_0x30a3('0x9'));var csv=require(_0x30a3('0xa'));var ejs=require(_0x30a3('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x30a3('0xc'));var squel=require(_0x30a3('0xd'));var crypto=require(_0x30a3('0xe'));var jsforce=require(_0x30a3('0xf'));var deskjs=require(_0x30a3('0x10'));var toCsv=require(_0x30a3('0xa'));var querystring=require('querystring');var Papa=require(_0x30a3('0x11'));var Redis=require(_0x30a3('0x12'));var authService=require(_0x30a3('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x30a3('0x14'));var logger=require(_0x30a3('0x15'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x30a3('0x16'));var db=require(_0x30a3('0x17'))['db'];function respondWithStatusCode(_0x28a96e,_0x40ee9b){_0x40ee9b=_0x40ee9b||0xcc;return function(_0x20aeb2){if(_0x20aeb2){return _0x28a96e[_0x30a3('0x18')](_0x40ee9b);}return _0x28a96e[_0x30a3('0x19')](_0x40ee9b)[_0x30a3('0x1a')]();};}function respondWithResult(_0x3b7317,_0x999b8e){_0x999b8e=_0x999b8e||0xc8;return function(_0x375df5){if(_0x375df5){return _0x3b7317[_0x30a3('0x19')](_0x999b8e)[_0x30a3('0x1b')](_0x375df5);}};}function respondWithFilteredResult(_0x36466a,_0xd4e2ff){return function(_0x44946e){if(_0x44946e){var _0x5cb9b9=typeof _0xd4e2ff['offset']==='undefined'&&typeof _0xd4e2ff[_0x30a3('0x1c')]===_0x30a3('0x1d');var _0x5a7206=_0x44946e[_0x30a3('0x1e')];var _0x58212d=_0x5cb9b9?0x0:_0xd4e2ff[_0x30a3('0x1f')];var _0x1da07e=_0x5cb9b9?_0x44946e[_0x30a3('0x1e')]:_0xd4e2ff['offset']+_0xd4e2ff['limit'];var _0x30a54f;if(_0x1da07e>=_0x5a7206){_0x1da07e=_0x5a7206;_0x30a54f=0xc8;}else{_0x30a54f=0xce;}_0x36466a[_0x30a3('0x19')](_0x30a54f);return _0x36466a['set'](_0x30a3('0x20'),_0x58212d+'-'+_0x1da07e+'/'+_0x5a7206)[_0x30a3('0x1b')](_0x44946e);}return null;};}function patchUpdates(_0x59f21c){return function(_0x29c127){try{jsonpatch['apply'](_0x29c127,_0x59f21c,!![]);}catch(_0x1bb723){return BPromise['reject'](_0x1bb723);}return _0x29c127[_0x30a3('0x21')]();};}function saveUpdates(_0x58a6ea,_0x4da3ed){return function(_0x3047f5){if(_0x3047f5){return _0x3047f5[_0x30a3('0x22')](_0x58a6ea)[_0x30a3('0x23')](function(_0x1176ab){return _0x1176ab;});}return null;};}function removeEntity(_0x493530,_0x5bcf88){return function(_0x266dd9){if(_0x266dd9){return _0x266dd9[_0x30a3('0x24')]()['then'](function(){_0x493530[_0x30a3('0x19')](0xcc)[_0x30a3('0x1a')]();});}};}function handleEntityNotFound(_0x253684,_0x78fa7e){return function(_0x1db526){if(!_0x1db526){_0x253684[_0x30a3('0x18')](0x194);}return _0x1db526;};}function handleError(_0x5a5e90,_0x36dcc4){_0x36dcc4=_0x36dcc4||0x1f4;return function(_0x36c789){logger[_0x30a3('0x25')](_0x36c789[_0x30a3('0x26')]);if(_0x36c789[_0x30a3('0x27')]){delete _0x36c789[_0x30a3('0x27')];}_0x5a5e90[_0x30a3('0x19')](_0x36dcc4)[_0x30a3('0x28')](_0x36c789);};}exports[_0x30a3('0x29')]=function(_0x4b88ae,_0x49f405){var _0x5d1247={},_0xd2cfef={},_0x139147={'count':0x0,'rows':[]};var _0x58c566=_['map'](db[_0x30a3('0x2a')]['rawAttributes'],function(_0x5be1e0){return{'name':_0x5be1e0[_0x30a3('0x2b')],'type':_0x5be1e0[_0x30a3('0x2c')][_0x30a3('0x2d')]};});_0xd2cfef[_0x30a3('0x2e')]=_[_0x30a3('0x2f')](_0x58c566,_0x30a3('0x27'));_0xd2cfef[_0x30a3('0x30')]=_[_0x30a3('0x31')](_0x4b88ae['query']);_0xd2cfef[_0x30a3('0x32')]=_['intersection'](_0xd2cfef[_0x30a3('0x2e')],_0xd2cfef['query']);_0x5d1247[_0x30a3('0x33')]=_[_0x30a3('0x34')](_0xd2cfef[_0x30a3('0x2e')],qs[_0x30a3('0x35')](_0x4b88ae['query'][_0x30a3('0x35')]));_0x5d1247[_0x30a3('0x33')]=_0x5d1247[_0x30a3('0x33')][_0x30a3('0x36')]?_0x5d1247[_0x30a3('0x33')]:_0xd2cfef['model'];if(!_0x4b88ae[_0x30a3('0x30')][_0x30a3('0x37')](_0x30a3('0x38'))){_0x5d1247[_0x30a3('0x1c')]=qs['limit'](_0x4b88ae[_0x30a3('0x30')][_0x30a3('0x1c')]);_0x5d1247['offset']=qs[_0x30a3('0x1f')](_0x4b88ae[_0x30a3('0x30')][_0x30a3('0x1f')]);}_0x5d1247['order']=qs[_0x30a3('0x39')](_0x4b88ae[_0x30a3('0x30')][_0x30a3('0x39')]);_0x5d1247[_0x30a3('0x3a')]=qs['filters'](_[_0x30a3('0x3b')](_0x4b88ae[_0x30a3('0x30')],_0xd2cfef[_0x30a3('0x32')]),_0x58c566);if(_0x4b88ae[_0x30a3('0x30')][_0x30a3('0x3c')]){_0x5d1247[_0x30a3('0x3a')]=_[_0x30a3('0x3d')](_0x5d1247[_0x30a3('0x3a')],{'$or':_[_0x30a3('0x2f')](_0x58c566,function(_0x40a4e7){if(_0x40a4e7[_0x30a3('0x2c')]!==_0x30a3('0x3e')){var _0x468a52={};_0x468a52[_0x40a4e7[_0x30a3('0x27')]]={'$like':'%'+_0x4b88ae['query'][_0x30a3('0x3c')]+'%'};return _0x468a52;}})});}_0x5d1247=_['merge']({},_0x5d1247,_0x4b88ae[_0x30a3('0x3f')]);var _0x138c49={'where':_0x5d1247[_0x30a3('0x3a')]};return db['IntegrationReport'][_0x30a3('0x1e')](_0x138c49)[_0x30a3('0x23')](function(_0x3f1233){_0x139147['count']=_0x3f1233;if(_0x4b88ae[_0x30a3('0x30')][_0x30a3('0x40')]){_0x5d1247[_0x30a3('0x41')]=[{'all':!![]}];}return db[_0x30a3('0x2a')]['findAll'](_0x5d1247);})['then'](function(_0x2fc83d){_0x139147[_0x30a3('0x42')]=_0x2fc83d;return _0x139147;})[_0x30a3('0x23')](respondWithFilteredResult(_0x49f405,_0x5d1247))[_0x30a3('0x43')](handleError(_0x49f405,null));};exports[_0x30a3('0x44')]=function(_0x1e473a,_0x10031f){var _0x594884={'raw':![],'where':{'id':_0x1e473a[_0x30a3('0x45')]['id']}},_0x1ed12b={};_0x1ed12b[_0x30a3('0x2e')]=_[_0x30a3('0x31')](db[_0x30a3('0x2a')][_0x30a3('0x46')]);_0x1ed12b[_0x30a3('0x30')]=_[_0x30a3('0x31')](_0x1e473a['query']);_0x1ed12b[_0x30a3('0x32')]=_[_0x30a3('0x34')](_0x1ed12b[_0x30a3('0x2e')],_0x1ed12b[_0x30a3('0x30')]);_0x594884[_0x30a3('0x33')]=_[_0x30a3('0x34')](_0x1ed12b[_0x30a3('0x2e')],qs[_0x30a3('0x35')](_0x1e473a[_0x30a3('0x30')][_0x30a3('0x35')]));_0x594884[_0x30a3('0x33')]=_0x594884[_0x30a3('0x33')][_0x30a3('0x36')]?_0x594884[_0x30a3('0x33')]:_0x1ed12b[_0x30a3('0x2e')];if(_0x1e473a['query'][_0x30a3('0x40')]){_0x594884[_0x30a3('0x41')]=[{'all':!![]}];}_0x594884=_[_0x30a3('0x3d')]({},_0x594884,_0x1e473a[_0x30a3('0x3f')]);return db['IntegrationReport'][_0x30a3('0x47')](_0x594884)[_0x30a3('0x23')](handleEntityNotFound(_0x10031f,null))['then'](respondWithResult(_0x10031f,null))[_0x30a3('0x43')](handleError(_0x10031f,null));};exports[_0x30a3('0x48')]=function(_0x547b76,_0x574ae6){return db[_0x30a3('0x2a')][_0x30a3('0x48')](_0x547b76[_0x30a3('0x49')],{})[_0x30a3('0x23')](respondWithResult(_0x574ae6,0xc9))['catch'](handleError(_0x574ae6,null));};exports['update']=function(_0x4a1479,_0x27cc5e){if(_0x4a1479['body']['id']){delete _0x4a1479[_0x30a3('0x49')]['id'];}return db[_0x30a3('0x2a')][_0x30a3('0x47')]({'where':{'id':_0x4a1479[_0x30a3('0x45')]['id']}})[_0x30a3('0x23')](handleEntityNotFound(_0x27cc5e,null))[_0x30a3('0x23')](saveUpdates(_0x4a1479[_0x30a3('0x49')],null))[_0x30a3('0x23')](respondWithResult(_0x27cc5e,null))[_0x30a3('0x43')](handleError(_0x27cc5e,null));};exports['destroy']=function(_0xc9fd36,_0x1e30d5){return db[_0x30a3('0x2a')][_0x30a3('0x47')]({'where':{'id':_0xc9fd36[_0x30a3('0x45')]['id']}})[_0x30a3('0x23')](handleEntityNotFound(_0x1e30d5,null))[_0x30a3('0x23')](removeEntity(_0x1e30d5,null))[_0x30a3('0x43')](handleError(_0x1e30d5,null));};exports[_0x30a3('0x4a')]=function(_0x93b327,_0x429dee){return db['IntegrationReport'][_0x30a3('0x4a')]()[_0x30a3('0x23')](respondWithResult(_0x429dee,null))[_0x30a3('0x43')](handleError(_0x429dee,null));}; \ No newline at end of file +var _0x0396=['index','map','IntegrationReport','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','order','sort','where','pick','merge','VIRTUAL','filter','findAll','rows','catch','show','params','includeAll','include','find','create','body','update','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','limit','offset','count','set','Content-Range','apply','reject','save','then','end','error','name','send'];(function(_0x1ac595,_0x5d2081){var _0x455fff=function(_0x3043ee){while(--_0x3043ee){_0x1ac595['push'](_0x1ac595['shift']());}};_0x455fff(++_0x5d2081);}(_0x0396,0x104));var _0x6039=function(_0x32d457,_0x1a39c9){_0x32d457=_0x32d457-0x0;var _0x338386=_0x0396[_0x32d457];return _0x338386;};'use strict';var emlformat=require(_0x6039('0x0'));var rimraf=require(_0x6039('0x1'));var zipdir=require(_0x6039('0x2'));var jsonpatch=require(_0x6039('0x3'));var rp=require('request-promise');var moment=require(_0x6039('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x6039('0x5'));var util=require(_0x6039('0x6'));var path=require(_0x6039('0x7'));var sox=require(_0x6039('0x8'));var csv=require(_0x6039('0x9'));var ejs=require(_0x6039('0xa'));var fs=require('fs');var fs_extra=require(_0x6039('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x6039('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x6039('0x9'));var querystring=require(_0x6039('0xd'));var Papa=require(_0x6039('0xe'));var Redis=require('ioredis');var authService=require(_0x6039('0xf'));var qs=require(_0x6039('0x10'));var as=require(_0x6039('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x6039('0x12'))(_0x6039('0x13'));var utils=require('../../config/utils');var config=require(_0x6039('0x14'));var licenseUtil=require(_0x6039('0x15'));var db=require(_0x6039('0x16'))['db'];function respondWithStatusCode(_0x2bce89,_0x22cc38){_0x22cc38=_0x22cc38||0xcc;return function(_0x45ab94){if(_0x45ab94){return _0x2bce89[_0x6039('0x17')](_0x22cc38);}return _0x2bce89[_0x6039('0x18')](_0x22cc38)['end']();};}function respondWithResult(_0x1376b7,_0x39aabc){_0x39aabc=_0x39aabc||0xc8;return function(_0x2cb247){if(_0x2cb247){return _0x1376b7[_0x6039('0x18')](_0x39aabc)[_0x6039('0x19')](_0x2cb247);}};}function respondWithFilteredResult(_0x7ea6a2,_0x197545){return function(_0x5640cf){if(_0x5640cf){var _0x326bc5=typeof _0x197545['offset']===_0x6039('0x1a')&&typeof _0x197545[_0x6039('0x1b')]==='undefined';var _0x2a7347=_0x5640cf['count'];var _0x1d7943=_0x326bc5?0x0:_0x197545[_0x6039('0x1c')];var _0x1637ae=_0x326bc5?_0x5640cf[_0x6039('0x1d')]:_0x197545['offset']+_0x197545[_0x6039('0x1b')];var _0x1bc74f;if(_0x1637ae>=_0x2a7347){_0x1637ae=_0x2a7347;_0x1bc74f=0xc8;}else{_0x1bc74f=0xce;}_0x7ea6a2[_0x6039('0x18')](_0x1bc74f);return _0x7ea6a2[_0x6039('0x1e')](_0x6039('0x1f'),_0x1d7943+'-'+_0x1637ae+'/'+_0x2a7347)['json'](_0x5640cf);}return null;};}function patchUpdates(_0x494aea){return function(_0x4b1d28){try{jsonpatch[_0x6039('0x20')](_0x4b1d28,_0x494aea,!![]);}catch(_0x4ca7f2){return BPromise[_0x6039('0x21')](_0x4ca7f2);}return _0x4b1d28[_0x6039('0x22')]();};}function saveUpdates(_0x200aab,_0x1d53e5){return function(_0x1bc987){if(_0x1bc987){return _0x1bc987['update'](_0x200aab)[_0x6039('0x23')](function(_0xd2466c){return _0xd2466c;});}return null;};}function removeEntity(_0x59c78c,_0x2f79cd){return function(_0x32042b){if(_0x32042b){return _0x32042b['destroy']()['then'](function(){_0x59c78c['status'](0xcc)[_0x6039('0x24')]();});}};}function handleEntityNotFound(_0x2ee30b,_0x543da9){return function(_0x49d09b){if(!_0x49d09b){_0x2ee30b[_0x6039('0x17')](0x194);}return _0x49d09b;};}function handleError(_0x252ab5,_0x5a173a){_0x5a173a=_0x5a173a||0x1f4;return function(_0x21e735){logger[_0x6039('0x25')](_0x21e735['stack']);if(_0x21e735[_0x6039('0x26')]){delete _0x21e735[_0x6039('0x26')];}_0x252ab5[_0x6039('0x18')](_0x5a173a)[_0x6039('0x27')](_0x21e735);};}exports[_0x6039('0x28')]=function(_0x23be31,_0x3997bc){var _0x4cf2d3={},_0x48d5c8={},_0x1faf53={'count':0x0,'rows':[]};var _0x5334e5=_[_0x6039('0x29')](db[_0x6039('0x2a')][_0x6039('0x2b')],function(_0x9ccde7){return{'name':_0x9ccde7[_0x6039('0x2c')],'type':_0x9ccde7[_0x6039('0x2d')][_0x6039('0x2e')]};});_0x48d5c8[_0x6039('0x2f')]=_[_0x6039('0x29')](_0x5334e5,_0x6039('0x26'));_0x48d5c8[_0x6039('0x30')]=_[_0x6039('0x31')](_0x23be31[_0x6039('0x30')]);_0x48d5c8[_0x6039('0x32')]=_['intersection'](_0x48d5c8[_0x6039('0x2f')],_0x48d5c8[_0x6039('0x30')]);_0x4cf2d3[_0x6039('0x33')]=_[_0x6039('0x34')](_0x48d5c8[_0x6039('0x2f')],qs[_0x6039('0x35')](_0x23be31[_0x6039('0x30')][_0x6039('0x35')]));_0x4cf2d3['attributes']=_0x4cf2d3[_0x6039('0x33')][_0x6039('0x36')]?_0x4cf2d3[_0x6039('0x33')]:_0x48d5c8[_0x6039('0x2f')];if(!_0x23be31[_0x6039('0x30')]['hasOwnProperty']('nolimit')){_0x4cf2d3[_0x6039('0x1b')]=qs[_0x6039('0x1b')](_0x23be31[_0x6039('0x30')][_0x6039('0x1b')]);_0x4cf2d3[_0x6039('0x1c')]=qs[_0x6039('0x1c')](_0x23be31[_0x6039('0x30')][_0x6039('0x1c')]);}_0x4cf2d3[_0x6039('0x37')]=qs['sort'](_0x23be31[_0x6039('0x30')][_0x6039('0x38')]);_0x4cf2d3[_0x6039('0x39')]=qs[_0x6039('0x32')](_[_0x6039('0x3a')](_0x23be31['query'],_0x48d5c8[_0x6039('0x32')]),_0x5334e5);if(_0x23be31[_0x6039('0x30')]['filter']){_0x4cf2d3[_0x6039('0x39')]=_[_0x6039('0x3b')](_0x4cf2d3['where'],{'$or':_[_0x6039('0x29')](_0x5334e5,function(_0x50a1a6){if(_0x50a1a6[_0x6039('0x2d')]!==_0x6039('0x3c')){var _0x4d85e6={};_0x4d85e6[_0x50a1a6[_0x6039('0x26')]]={'$like':'%'+_0x23be31['query'][_0x6039('0x3d')]+'%'};return _0x4d85e6;}})});}_0x4cf2d3=_[_0x6039('0x3b')]({},_0x4cf2d3,_0x23be31['options']);var _0x3fcb81={'where':_0x4cf2d3[_0x6039('0x39')]};return db[_0x6039('0x2a')]['count'](_0x3fcb81)['then'](function(_0x2a1542){_0x1faf53[_0x6039('0x1d')]=_0x2a1542;if(_0x23be31[_0x6039('0x30')]['includeAll']){_0x4cf2d3['include']=[{'all':!![]}];}return db[_0x6039('0x2a')][_0x6039('0x3e')](_0x4cf2d3);})[_0x6039('0x23')](function(_0xc8bb67){_0x1faf53[_0x6039('0x3f')]=_0xc8bb67;return _0x1faf53;})['then'](respondWithFilteredResult(_0x3997bc,_0x4cf2d3))[_0x6039('0x40')](handleError(_0x3997bc,null));};exports[_0x6039('0x41')]=function(_0x41e7f5,_0x21b0ce){var _0x55fd43={'raw':![],'where':{'id':_0x41e7f5[_0x6039('0x42')]['id']}},_0x1993a5={};_0x1993a5[_0x6039('0x2f')]=_['keys'](db[_0x6039('0x2a')][_0x6039('0x2b')]);_0x1993a5['query']=_[_0x6039('0x31')](_0x41e7f5[_0x6039('0x30')]);_0x1993a5['filters']=_[_0x6039('0x34')](_0x1993a5['model'],_0x1993a5[_0x6039('0x30')]);_0x55fd43[_0x6039('0x33')]=_[_0x6039('0x34')](_0x1993a5[_0x6039('0x2f')],qs['fields'](_0x41e7f5[_0x6039('0x30')][_0x6039('0x35')]));_0x55fd43[_0x6039('0x33')]=_0x55fd43[_0x6039('0x33')][_0x6039('0x36')]?_0x55fd43[_0x6039('0x33')]:_0x1993a5[_0x6039('0x2f')];if(_0x41e7f5[_0x6039('0x30')][_0x6039('0x43')]){_0x55fd43[_0x6039('0x44')]=[{'all':!![]}];}_0x55fd43=_[_0x6039('0x3b')]({},_0x55fd43,_0x41e7f5['options']);return db[_0x6039('0x2a')][_0x6039('0x45')](_0x55fd43)[_0x6039('0x23')](handleEntityNotFound(_0x21b0ce,null))[_0x6039('0x23')](respondWithResult(_0x21b0ce,null))[_0x6039('0x40')](handleError(_0x21b0ce,null));};exports[_0x6039('0x46')]=function(_0xe4f65c,_0x5ed74c){return db['IntegrationReport'][_0x6039('0x46')](_0xe4f65c[_0x6039('0x47')],{})['then'](respondWithResult(_0x5ed74c,0xc9))['catch'](handleError(_0x5ed74c,null));};exports[_0x6039('0x48')]=function(_0x283caf,_0x18889a){if(_0x283caf[_0x6039('0x47')]['id']){delete _0x283caf[_0x6039('0x47')]['id'];}return db[_0x6039('0x2a')][_0x6039('0x45')]({'where':{'id':_0x283caf['params']['id']}})[_0x6039('0x23')](handleEntityNotFound(_0x18889a,null))['then'](saveUpdates(_0x283caf[_0x6039('0x47')],null))[_0x6039('0x23')](respondWithResult(_0x18889a,null))[_0x6039('0x40')](handleError(_0x18889a,null));};exports[_0x6039('0x49')]=function(_0x4ea86f,_0x4ea77b){return db[_0x6039('0x2a')][_0x6039('0x45')]({'where':{'id':_0x4ea86f[_0x6039('0x42')]['id']}})[_0x6039('0x23')](handleEntityNotFound(_0x4ea77b,null))[_0x6039('0x23')](removeEntity(_0x4ea77b,null))[_0x6039('0x40')](handleError(_0x4ea77b,null));};exports[_0x6039('0x4a')]=function(_0x3a132a,_0x236efc){return db[_0x6039('0x2a')][_0x6039('0x4a')]()[_0x6039('0x23')](respondWithResult(_0x236efc,null))[_0x6039('0x40')](handleError(_0x236efc,null));}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.model.js b/server/api/integrationReport/integrationReport.model.js index 358f70a..c82fdd6 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 _0xd726=['bluebird','request-promise','path','rimraf','define','IntegrationReport','lodash','util','moment'];(function(_0x29977b,_0x3f0995){var _0x31cda3=function(_0x32515a){while(--_0x32515a){_0x29977b['push'](_0x29977b['shift']());}};_0x31cda3(++_0x3f0995);}(_0xd726,0x16e));var _0x6d72=function(_0x12bf77,_0x5c8357){_0x12bf77=_0x12bf77-0x0;var _0x3f18b0=_0xd726[_0x12bf77];return _0x3f18b0;};'use strict';var _=require(_0x6d72('0x0'));var util=require(_0x6d72('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x6d72('0x2'));var BPromise=require(_0x6d72('0x3'));var rp=require(_0x6d72('0x4'));var fs=require('fs');var path=require(_0x6d72('0x5'));var rimraf=require(_0x6d72('0x6'));var config=require('../../config/environment');var attributes=require('./integrationReport.attributes');module['exports']=function(_0x55663a,_0x38aaef){return _0x55663a[_0x6d72('0x7')](_0x6d72('0x8'),attributes,{'tableName':'report_integration','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbaae=['lodash','util','api','moment','bluebird','request-promise','../../config/environment','./integrationReport.attributes','exports','define','IntegrationReport','report_integration'];(function(_0x108b66,_0x46f926){var _0x3e3e81=function(_0x9387c){while(--_0x9387c){_0x108b66['push'](_0x108b66['shift']());}};_0x3e3e81(++_0x46f926);}(_0xbaae,0xd8));var _0xebaa=function(_0x4b6750,_0x4b7cf1){_0x4b6750=_0x4b6750-0x0;var _0x4f32a6=_0xbaae[_0x4b6750];return _0x4f32a6;};'use strict';var _=require(_0xebaa('0x0'));var util=require(_0xebaa('0x1'));var logger=require('../../config/logger')(_0xebaa('0x2'));var moment=require(_0xebaa('0x3'));var BPromise=require(_0xebaa('0x4'));var rp=require(_0xebaa('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xebaa('0x6'));var attributes=require(_0xebaa('0x7'));module[_0xebaa('0x8')]=function(_0x5cbc56,_0x569c53){return _0x5cbc56[_0xebaa('0x9')](_0xebaa('0xa'),attributes,{'tableName':_0xebaa('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.rpc.js b/server/api/integrationReport/integrationReport.rpc.js index 357d211..bfa4917 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 _0x4819=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','IntegrationReport,\x20%s,\x20%s','debug','IntegrationReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','util','moment'];(function(_0x256d80,_0x5c90c5){var _0x2b1742=function(_0x3c6360){while(--_0x3c6360){_0x256d80['push'](_0x256d80['shift']());}};_0x2b1742(++_0x5c90c5);}(_0x4819,0xcd));var _0x9481=function(_0x1786e0,_0x19dc8c){_0x1786e0=_0x1786e0-0x0;var _0x4a6229=_0x4819[_0x1786e0];return _0x4a6229;};'use strict';var _=require('lodash');var util=require(_0x9481('0x0'));var moment=require(_0x9481('0x1'));var BPromise=require(_0x9481('0x2'));var rs=require(_0x9481('0x3'));var fs=require('fs');var Redis=require(_0x9481('0x4'));var db=require(_0x9481('0x5'))['db'];var utils=require(_0x9481('0x6'));var logger=require(_0x9481('0x7'))(_0x9481('0x8'));var config=require(_0x9481('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x9481('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x54cc78,_0x14e05a,_0x6c6a08){return new BPromise(function(_0x27c033,_0x3278ff){return client[_0x9481('0xb')](_0x54cc78,_0x6c6a08)['then'](function(_0x1818cf){logger['info'](_0x9481('0xc'),_0x14e05a,'request\x20sent');logger[_0x9481('0xd')](_0x9481('0xe'),_0x14e05a,_0x9481('0xf'),JSON[_0x9481('0x10')](_0x1818cf));if(_0x1818cf[_0x9481('0x11')]){if(_0x1818cf[_0x9481('0x11')][_0x9481('0x12')]===0x1f4){logger[_0x9481('0x11')](_0x9481('0xc'),_0x14e05a,_0x1818cf['error']['message']);return _0x3278ff(_0x1818cf[_0x9481('0x11')][_0x9481('0x13')]);}logger[_0x9481('0x11')](_0x9481('0xc'),_0x14e05a,_0x1818cf[_0x9481('0x11')][_0x9481('0x13')]);return _0x27c033(_0x1818cf[_0x9481('0x11')]['message']);}else{logger[_0x9481('0x14')](_0x9481('0xc'),_0x14e05a,'request\x20sent');_0x27c033(_0x1818cf[_0x9481('0x15')]['message']);}})[_0x9481('0x16')](function(_0x7a2ac8){logger[_0x9481('0x11')](_0x9481('0xc'),_0x14e05a,_0x7a2ac8);_0x3278ff(_0x7a2ac8);});});} \ No newline at end of file +var _0x7a54=['info','IntegrationReport,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x7a54,0x106));var _0x47a5=function(_0x5ed305,_0x54abda){_0x5ed305=_0x5ed305-0x0;var _0x15a480=_0x7a54[_0x5ed305];return _0x15a480;};'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')]('IntegrationReport,\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/interval/index.js b/server/api/interval/index.js index 2ddaa6a..bb0be0e 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 _0x8c8b=['post','create','addInterval','/:id/sub_intervals/create_many','addIntervals','update','delete','destroy','exports','multer','connect-timeout','express','Router','fs-extra','../../config/environment','./interval.controller','get','isAuthenticated','index','/:id','show','/:id/sub_intervals','getIntervals'];(function(_0x65181,_0x5877f4){var _0xf3bd5d=function(_0x9341e8){while(--_0x9341e8){_0x65181['push'](_0x65181['shift']());}};_0xf3bd5d(++_0x5877f4);}(_0x8c8b,0x106));var _0xb8c8=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x8c8b[_0x2641f9];return _0x585741;};'use strict';var multer=require(_0xb8c8('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xb8c8('0x1'));var express=require(_0xb8c8('0x2'));var router=express[_0xb8c8('0x3')]();var fs_extra=require(_0xb8c8('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xb8c8('0x5'));var controller=require(_0xb8c8('0x6'));router[_0xb8c8('0x7')]('/',auth[_0xb8c8('0x8')](),controller[_0xb8c8('0x9')]);router[_0xb8c8('0x7')](_0xb8c8('0xa'),auth[_0xb8c8('0x8')](),controller[_0xb8c8('0xb')]);router[_0xb8c8('0x7')](_0xb8c8('0xc'),auth['isAuthenticated'](),controller[_0xb8c8('0xd')]);router[_0xb8c8('0xe')]('/',auth[_0xb8c8('0x8')](),controller[_0xb8c8('0xf')]);router[_0xb8c8('0xe')](_0xb8c8('0xc'),auth[_0xb8c8('0x8')](),controller[_0xb8c8('0x10')]);router[_0xb8c8('0xe')](_0xb8c8('0x11'),auth[_0xb8c8('0x8')](),controller[_0xb8c8('0x12')]);router['put'](_0xb8c8('0xa'),auth['isAuthenticated'](),controller[_0xb8c8('0x13')]);router[_0xb8c8('0x14')]('/:id',auth[_0xb8c8('0x8')](),controller[_0xb8c8('0x15')]);module[_0xb8c8('0x16')]=router; \ No newline at end of file +var _0x57c2=['destroy','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','index','/:id','show','get','/:id/sub_intervals','isAuthenticated','create','post','addIntervals','put','update','delete'];(function(_0x55f240,_0x53fea3){var _0x4c49c2=function(_0x13ba05){while(--_0x13ba05){_0x55f240['push'](_0x55f240['shift']());}};_0x4c49c2(++_0x53fea3);}(_0x57c2,0x113));var _0x257c=function(_0x2a4634,_0x2d39b2){_0x2a4634=_0x2a4634-0x0;var _0x10e952=_0x57c2[_0x2a4634];return _0x10e952;};'use strict';var multer=require(_0x257c('0x0'));var util=require('util');var path=require(_0x257c('0x1'));var timeout=require(_0x257c('0x2'));var express=require(_0x257c('0x3'));var router=express['Router']();var fs_extra=require(_0x257c('0x4'));var auth=require(_0x257c('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x257c('0x6'));var controller=require('./interval.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x257c('0x7')]);router['get'](_0x257c('0x8'),auth['isAuthenticated'](),controller[_0x257c('0x9')]);router[_0x257c('0xa')](_0x257c('0xb'),auth['isAuthenticated'](),controller['getIntervals']);router['post']('/',auth[_0x257c('0xc')](),controller[_0x257c('0xd')]);router[_0x257c('0xe')](_0x257c('0xb'),auth[_0x257c('0xc')](),controller['addInterval']);router[_0x257c('0xe')]('/:id/sub_intervals/create_many',auth[_0x257c('0xc')](),controller[_0x257c('0xf')]);router[_0x257c('0x10')](_0x257c('0x8'),auth['isAuthenticated'](),controller[_0x257c('0x11')]);router[_0x257c('0x12')]('/:id',auth[_0x257c('0xc')](),controller[_0x257c('0x13')]);module[_0x257c('0x14')]=router; \ No newline at end of file diff --git a/server/api/interval/interval.attributes.js b/server/api/interval/interval.attributes.js index 5bfc04c..6d43d50 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 _0x12ff=['sequelize','exports','STRING'];(function(_0x158a58,_0x28e8e7){var _0x4935d9=function(_0x1e698c){while(--_0x1e698c){_0x158a58['push'](_0x158a58['shift']());}};_0x4935d9(++_0x28e8e7);}(_0x12ff,0x144));var _0xf12f=function(_0x1b7a99,_0x33a762){_0x1b7a99=_0x1b7a99-0x0;var _0x14f74e=_0x12ff[_0x1b7a99];return _0x14f74e;};'use strict';var Sequelize=require(_0xf12f('0x0'));module[_0xf12f('0x1')]={'name':{'type':Sequelize[_0xf12f('0x2')]},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize['STRING'],'allowNull':!![]}}; \ No newline at end of file +var _0x7b0e=['sequelize','exports','STRING'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7b0e,0x117));var _0xe7b0=function(_0x28cf98,_0x4ed326){_0x28cf98=_0x28cf98-0x0;var _0x196c5e=_0x7b0e[_0x28cf98];return _0x196c5e;};'use strict';var Sequelize=require(_0xe7b0('0x0'));module[_0xe7b0('0x1')]={'name':{'type':Sequelize[_0xe7b0('0x2')]},'description':{'type':Sequelize[_0xe7b0('0x2')]},'interval':{'type':Sequelize[_0xe7b0('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 453f548..655ff3c 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 _0xeeb1=['order','sort','pick','filter','merge','VIRTUAL','options','where','include','findAll','includeAll','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','params','addInterval','getIntervals','findOne','sequelize','transaction','IntervalId','bulkCreate','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/extensions/rewrite','status','end','json','offset','undefined','count','set','Content-Range','apply','reject','save','update','destroy','then','get','Intervals','UserProfileResource','sendStatus','error','stack','name','send','index','map','Interval','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0xeeb1,0x132));var _0x1eeb=function(_0x2f3be2,_0x224419){_0x2f3be2=_0x2f3be2-0x0;var _0x4cf7b0=_0xeeb1[_0x2f3be2];return _0x4cf7b0;};'use strict';var emlformat=require(_0x1eeb('0x0'));var rimraf=require(_0x1eeb('0x1'));var zipdir=require(_0x1eeb('0x2'));var jsonpatch=require(_0x1eeb('0x3'));var rp=require(_0x1eeb('0x4'));var moment=require('moment');var BPromise=require(_0x1eeb('0x5'));var Mustache=require(_0x1eeb('0x6'));var util=require(_0x1eeb('0x7'));var path=require('path');var sox=require(_0x1eeb('0x8'));var csv=require(_0x1eeb('0x9'));var ejs=require(_0x1eeb('0xa'));var fs=require('fs');var fs_extra=require(_0x1eeb('0xb'));var _=require(_0x1eeb('0xc'));var squel=require('squel');var crypto=require(_0x1eeb('0xd'));var jsforce=require(_0x1eeb('0xe'));var deskjs=require(_0x1eeb('0xf'));var toCsv=require(_0x1eeb('0x9'));var querystring=require('querystring');var Papa=require(_0x1eeb('0x10'));var Redis=require(_0x1eeb('0x11'));var authService=require(_0x1eeb('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x1eeb('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x1eeb('0x14'))(_0x1eeb('0x15'));var utils=require(_0x1eeb('0x16'));var config=require(_0x1eeb('0x17'));var licenseUtil=require(_0x1eeb('0x18'));var db=require(_0x1eeb('0x19'))['db'];var extensions=require(_0x1eeb('0x1a'));function respondWithStatusCode(_0x1e9f1d,_0x5b63f2){_0x5b63f2=_0x5b63f2||0xcc;return function(_0x28e188){if(_0x28e188){return _0x1e9f1d['sendStatus'](_0x5b63f2);}return _0x1e9f1d[_0x1eeb('0x1b')](_0x5b63f2)[_0x1eeb('0x1c')]();};}function respondWithResult(_0x5bc59d,_0x20cee8){_0x20cee8=_0x20cee8||0xc8;return function(_0x9ee3a6){if(_0x9ee3a6){return _0x5bc59d[_0x1eeb('0x1b')](_0x20cee8)[_0x1eeb('0x1d')](_0x9ee3a6);}};}function respondWithFilteredResult(_0x232299,_0x583128){return function(_0x58ac0d){if(_0x58ac0d){var _0x468ff1=typeof _0x583128[_0x1eeb('0x1e')]===_0x1eeb('0x1f')&&typeof _0x583128['limit']===_0x1eeb('0x1f');var _0x44518c=_0x58ac0d[_0x1eeb('0x20')];var _0xe0e2d9=_0x468ff1?0x0:_0x583128[_0x1eeb('0x1e')];var _0x2f755b=_0x468ff1?_0x58ac0d[_0x1eeb('0x20')]:_0x583128[_0x1eeb('0x1e')]+_0x583128['limit'];var _0x2333b6;if(_0x2f755b>=_0x44518c){_0x2f755b=_0x44518c;_0x2333b6=0xc8;}else{_0x2333b6=0xce;}_0x232299[_0x1eeb('0x1b')](_0x2333b6);return _0x232299[_0x1eeb('0x21')](_0x1eeb('0x22'),_0xe0e2d9+'-'+_0x2f755b+'/'+_0x44518c)[_0x1eeb('0x1d')](_0x58ac0d);}return null;};}function patchUpdates(_0x3d5f5f){return function(_0x5db227){try{jsonpatch[_0x1eeb('0x23')](_0x5db227,_0x3d5f5f,!![]);}catch(_0x590335){return BPromise[_0x1eeb('0x24')](_0x590335);}return _0x5db227[_0x1eeb('0x25')]();};}function saveUpdates(_0x26791c,_0x3fd92c){return function(_0x312ec7){if(_0x312ec7){return _0x312ec7[_0x1eeb('0x26')](_0x26791c)['then'](function(_0x2f64a0){return _0x2f64a0;});}return null;};}function removeEntity(_0x5bafa0,_0xd0ddde){return function(_0x3d699d){if(_0x3d699d){return _0x3d699d[_0x1eeb('0x27')]()[_0x1eeb('0x28')](function(){var _0x1b2d4a=_0x3d699d[_0x1eeb('0x29')]({'plain':!![]});var _0x48e644=_0x1eeb('0x2a');return db[_0x1eeb('0x2b')][_0x1eeb('0x27')]({'where':{'type':_0x48e644,'resourceId':_0x1b2d4a['id']}})[_0x1eeb('0x28')](function(){return _0x3d699d;});})[_0x1eeb('0x28')](function(){_0x5bafa0['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4061f3,_0x1eef15){return function(_0x466bc2){if(!_0x466bc2){_0x4061f3[_0x1eeb('0x2c')](0x194);}return _0x466bc2;};}function handleError(_0x1d00eb,_0x4efd4d){_0x4efd4d=_0x4efd4d||0x1f4;return function(_0x3b0994){logger[_0x1eeb('0x2d')](_0x3b0994[_0x1eeb('0x2e')]);if(_0x3b0994[_0x1eeb('0x2f')]){delete _0x3b0994[_0x1eeb('0x2f')];}_0x1d00eb['status'](_0x4efd4d)[_0x1eeb('0x30')](_0x3b0994);};}exports[_0x1eeb('0x31')]=function(_0x4924ee,_0xcebf93){var _0x4ea612={},_0x16504f={},_0x1a1ca8={'count':0x0,'rows':[]};var _0x2d1953=_[_0x1eeb('0x32')](db[_0x1eeb('0x33')][_0x1eeb('0x34')],function(_0x900816){return{'name':_0x900816[_0x1eeb('0x35')],'type':_0x900816[_0x1eeb('0x36')]['key']};});_0x16504f[_0x1eeb('0x37')]=_[_0x1eeb('0x32')](_0x2d1953,'name');_0x16504f[_0x1eeb('0x38')]=_[_0x1eeb('0x39')](_0x4924ee[_0x1eeb('0x38')]);_0x16504f[_0x1eeb('0x3a')]=_[_0x1eeb('0x3b')](_0x16504f[_0x1eeb('0x37')],_0x16504f[_0x1eeb('0x38')]);_0x4ea612[_0x1eeb('0x3c')]=_['intersection'](_0x16504f[_0x1eeb('0x37')],qs[_0x1eeb('0x3d')](_0x4924ee[_0x1eeb('0x38')][_0x1eeb('0x3d')]));_0x4ea612[_0x1eeb('0x3c')]=_0x4ea612[_0x1eeb('0x3c')][_0x1eeb('0x3e')]?_0x4ea612[_0x1eeb('0x3c')]:_0x16504f[_0x1eeb('0x37')];if(!_0x4924ee[_0x1eeb('0x38')][_0x1eeb('0x3f')](_0x1eeb('0x40'))){_0x4ea612[_0x1eeb('0x41')]=qs[_0x1eeb('0x41')](_0x4924ee[_0x1eeb('0x38')]['limit']);_0x4ea612[_0x1eeb('0x1e')]=qs[_0x1eeb('0x1e')](_0x4924ee[_0x1eeb('0x38')][_0x1eeb('0x1e')]);}_0x4ea612[_0x1eeb('0x42')]=qs['sort'](_0x4924ee[_0x1eeb('0x38')][_0x1eeb('0x43')]);_0x4ea612['where']=qs[_0x1eeb('0x3a')](_[_0x1eeb('0x44')](_0x4924ee[_0x1eeb('0x38')],_0x16504f[_0x1eeb('0x3a')]),_0x2d1953);if(_0x4924ee['query'][_0x1eeb('0x45')]){_0x4ea612['where']=_[_0x1eeb('0x46')](_0x4ea612['where'],{'$or':_[_0x1eeb('0x32')](_0x2d1953,function(_0x7f8fe7){if(_0x7f8fe7[_0x1eeb('0x36')]!==_0x1eeb('0x47')){var _0x208ad5={};_0x208ad5[_0x7f8fe7[_0x1eeb('0x2f')]]={'$like':'%'+_0x4924ee[_0x1eeb('0x38')][_0x1eeb('0x45')]+'%'};return _0x208ad5;}})});}_0x4ea612=_[_0x1eeb('0x46')]({},_0x4ea612,_0x4924ee[_0x1eeb('0x48')]);var _0x1aa678={'where':_0x4ea612[_0x1eeb('0x49')]};return db[_0x1eeb('0x33')][_0x1eeb('0x20')](_0x1aa678)[_0x1eeb('0x28')](function(_0x2b173c){_0x1a1ca8[_0x1eeb('0x20')]=_0x2b173c;if(_0x4924ee[_0x1eeb('0x38')]['includeAll']){_0x4ea612[_0x1eeb('0x4a')]=[{'all':!![]}];}return db[_0x1eeb('0x33')][_0x1eeb('0x4b')](_0x4ea612);})['then'](function(_0x3b97b1){_0x1a1ca8['rows']=_0x3b97b1;return _0x1a1ca8;})[_0x1eeb('0x28')](respondWithFilteredResult(_0xcebf93,_0x4ea612))['catch'](handleError(_0xcebf93,null));};exports['show']=function(_0x42bf3b,_0x15e34a){var _0x965d8c={'raw':!![],'where':{'id':_0x42bf3b['params']['id']}},_0x39d30f={};_0x39d30f[_0x1eeb('0x37')]=_[_0x1eeb('0x39')](db['Interval'][_0x1eeb('0x34')]);_0x39d30f['query']=_['keys'](_0x42bf3b[_0x1eeb('0x38')]);_0x39d30f[_0x1eeb('0x3a')]=_[_0x1eeb('0x3b')](_0x39d30f[_0x1eeb('0x37')],_0x39d30f['query']);_0x965d8c[_0x1eeb('0x3c')]=_['intersection'](_0x39d30f[_0x1eeb('0x37')],qs[_0x1eeb('0x3d')](_0x42bf3b[_0x1eeb('0x38')]['fields']));_0x965d8c['attributes']=_0x965d8c[_0x1eeb('0x3c')][_0x1eeb('0x3e')]?_0x965d8c[_0x1eeb('0x3c')]:_0x39d30f['model'];if(_0x42bf3b[_0x1eeb('0x38')][_0x1eeb('0x4c')]){_0x965d8c[_0x1eeb('0x4a')]=[{'all':!![]}];}_0x965d8c=_[_0x1eeb('0x46')]({},_0x965d8c,_0x42bf3b[_0x1eeb('0x48')]);return db[_0x1eeb('0x33')][_0x1eeb('0x4d')](_0x965d8c)['then'](handleEntityNotFound(_0x15e34a,null))[_0x1eeb('0x28')](respondWithResult(_0x15e34a,null))[_0x1eeb('0x4e')](handleError(_0x15e34a,null));};exports['create']=function(_0x40c486,_0x342db1){return db[_0x1eeb('0x33')][_0x1eeb('0x4f')](_0x40c486[_0x1eeb('0x50')],{})['then'](function(_0x33a0c4){var _0x2e2d89=_0x40c486[_0x1eeb('0x51')]['get']({'plain':!![]});if(!_0x2e2d89)throw new Error(_0x1eeb('0x52'));if(_0x2e2d89[_0x1eeb('0x53')]===_0x1eeb('0x51')){var _0x26ee31=_0x33a0c4[_0x1eeb('0x29')]({'plain':!![]});var _0x57cf13=_0x1eeb('0x2a');return db[_0x1eeb('0x54')][_0x1eeb('0x4d')]({'where':{'name':_0x57cf13,'userProfileId':_0x2e2d89['userProfileId']},'raw':!![]})[_0x1eeb('0x28')](function(_0x1ffa75){if(_0x1ffa75&&_0x1ffa75['autoAssociation']===0x0){return db[_0x1eeb('0x2b')]['create']({'name':_0x26ee31['name'],'resourceId':_0x26ee31['id'],'type':_0x1ffa75[_0x1eeb('0x2f')],'sectionId':_0x1ffa75['id']},{})[_0x1eeb('0x28')](function(){return _0x33a0c4;});}else{return _0x33a0c4;}})[_0x1eeb('0x4e')](function(_0x1e435a){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1e435a);throw _0x1e435a;});}return _0x33a0c4;})[_0x1eeb('0x28')](respondWithResult(_0x342db1,0xc9))[_0x1eeb('0x4e')](handleError(_0x342db1,null));};exports[_0x1eeb('0x26')]=function(_0x1fa355,_0x5dae4a){if(_0x1fa355[_0x1eeb('0x50')]['id']){delete _0x1fa355[_0x1eeb('0x50')]['id'];}return db[_0x1eeb('0x33')][_0x1eeb('0x4d')]({'where':{'id':_0x1fa355['params']['id']}})['then'](handleEntityNotFound(_0x5dae4a,null))[_0x1eeb('0x28')](saveUpdates(_0x1fa355[_0x1eeb('0x50')],null))[_0x1eeb('0x28')](respondWithResult(_0x5dae4a,null))['catch'](handleError(_0x5dae4a,null));};exports[_0x1eeb('0x27')]=function(_0x2a5504,_0x18dd99){return db[_0x1eeb('0x33')][_0x1eeb('0x4d')]({'where':{'id':_0x2a5504[_0x1eeb('0x55')]['id']}})[_0x1eeb('0x28')](handleEntityNotFound(_0x18dd99,null))[_0x1eeb('0x28')](removeEntity(_0x18dd99,null))[_0x1eeb('0x4e')](handleError(_0x18dd99,null));};exports[_0x1eeb('0x56')]=function(_0xc51692,_0xd2bad9,_0x4093c6){if(_0xc51692[_0x1eeb('0x50')]['id']){delete _0xc51692[_0x1eeb('0x50')]['id'];}return db[_0x1eeb('0x33')]['find']({'where':{'id':_0xc51692['params']['id']}})[_0x1eeb('0x28')](handleEntityNotFound(_0xd2bad9,null))[_0x1eeb('0x28')](function(_0x5a2105){if(_0x5a2105){_0xc51692['body']['IntervalId']=_0x5a2105['id'];return db[_0x1eeb('0x33')]['create'](_0xc51692[_0x1eeb('0x50')]);}})[_0x1eeb('0x28')](respondWithResult(_0xd2bad9,null))[_0x1eeb('0x4e')](handleError(_0xd2bad9,null));};exports[_0x1eeb('0x57')]=function(_0x30a1e9,_0x5dc7d5,_0x597e1b){var _0x259ede={};var _0x371733={};var _0x37363a;var _0x365d75;return db[_0x1eeb('0x33')][_0x1eeb('0x58')]({'where':{'id':_0x30a1e9[_0x1eeb('0x55')]['id']}})[_0x1eeb('0x28')](handleEntityNotFound(_0x5dc7d5,null))[_0x1eeb('0x28')](function(_0x64b8e4){if(_0x64b8e4){_0x37363a=_0x64b8e4;_0x371733['model']=_[_0x1eeb('0x39')](db['Interval'][_0x1eeb('0x34')]);_0x371733[_0x1eeb('0x38')]=_[_0x1eeb('0x39')](_0x30a1e9[_0x1eeb('0x38')]);_0x371733[_0x1eeb('0x3a')]=_[_0x1eeb('0x3b')](_0x371733[_0x1eeb('0x37')],_0x371733[_0x1eeb('0x38')]);_0x259ede[_0x1eeb('0x3c')]=_[_0x1eeb('0x3b')](_0x371733['model'],qs['fields'](_0x30a1e9[_0x1eeb('0x38')]['fields']));_0x259ede[_0x1eeb('0x3c')]=_0x259ede[_0x1eeb('0x3c')][_0x1eeb('0x3e')]?_0x259ede[_0x1eeb('0x3c')]:_0x371733[_0x1eeb('0x37')];_0x259ede['order']=qs[_0x1eeb('0x43')](_0x30a1e9['query'][_0x1eeb('0x43')]);_0x259ede[_0x1eeb('0x49')]=qs[_0x1eeb('0x3a')](_[_0x1eeb('0x44')](_0x30a1e9[_0x1eeb('0x38')],_0x371733[_0x1eeb('0x3a')]));if(_0x30a1e9[_0x1eeb('0x38')]['filter']){_0x259ede['where']=_['merge'](_0x259ede['where'],{'$or':_[_0x1eeb('0x32')](_0x259ede['attributes'],function(_0x27786e){var _0x4f14fe={};_0x4f14fe[_0x27786e]={'$like':'%'+_0x30a1e9['query'][_0x1eeb('0x45')]+'%'};return _0x4f14fe;})});}_0x259ede=_['merge']({},_0x259ede,_0x30a1e9[_0x1eeb('0x48')]);return _0x37363a[_0x1eeb('0x57')](_0x259ede);}})[_0x1eeb('0x28')](function(_0x518035){if(_0x518035){_0x365d75=_0x518035['length'];if(!_0x30a1e9[_0x1eeb('0x38')][_0x1eeb('0x3f')](_0x1eeb('0x40'))){_0x259ede[_0x1eeb('0x41')]=qs['limit'](_0x30a1e9[_0x1eeb('0x38')][_0x1eeb('0x41')]);_0x259ede[_0x1eeb('0x1e')]=qs[_0x1eeb('0x1e')](_0x30a1e9[_0x1eeb('0x38')][_0x1eeb('0x1e')]);}return _0x37363a[_0x1eeb('0x57')](_0x259ede);}})['then'](function(_0x4ae464){if(_0x4ae464){return _0x4ae464?{'count':_0x365d75,'rows':_0x4ae464}:null;}})[_0x1eeb('0x28')](respondWithResult(_0x5dc7d5,null))['catch'](handleError(_0x5dc7d5,null));};exports['addIntervals']=function(_0x4088a7,_0x5596d0,_0x5b17f3){return db[_0x1eeb('0x33')][_0x1eeb('0x58')]({'where':{'id':_0x4088a7[_0x1eeb('0x55')]['id']}})[_0x1eeb('0x28')](handleEntityNotFound(_0x5596d0,null))[_0x1eeb('0x28')](function(_0x2a8918){if(_0x2a8918){return db[_0x1eeb('0x59')][_0x1eeb('0x5a')](function(_0x576869){return db[_0x1eeb('0x33')][_0x1eeb('0x27')]({'where':{'IntervalId':_0x4088a7[_0x1eeb('0x55')]['id']},'transaction':_0x576869})[_0x1eeb('0x28')](function(_0x292dd8){var _0x5f4461=_[_0x1eeb('0x32')](_0x4088a7[_0x1eeb('0x50')],function(_0x265ef2){delete _0x265ef2['id'];_0x265ef2[_0x1eeb('0x5b')]=_0x4088a7[_0x1eeb('0x55')]['id'];return _0x265ef2;});return db[_0x1eeb('0x33')][_0x1eeb('0x5c')](_0x5f4461,{'transaction':_0x576869});});})['then'](function(){return db[_0x1eeb('0x33')]['findAll']({'where':{'IntervalId':_0x4088a7[_0x1eeb('0x55')]['id']}});});}})[_0x1eeb('0x28')](respondWithResult(_0x5596d0,null))[_0x1eeb('0x4e')](handleError(_0x5596d0,null));}; \ No newline at end of file +var _0x78b0=['desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../components/extensions/rewrite','sendStatus','status','undefined','limit','count','offset','set','Content-Range','json','apply','reject','save','update','destroy','then','get','UserProfileResource','error','stack','name','index','map','Interval','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filter','merge','rows','catch','length','includeAll','include','options','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Intervals','UserProfileSection','userProfileId','autoAssociation','body','params','addInterval','order','getIntervals','findOne','sequelize','IntervalId','bulkCreate','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce'];(function(_0x3c632d,_0x45d356){var _0x2cda06=function(_0x5a2893){while(--_0x5a2893){_0x3c632d['push'](_0x3c632d['shift']());}};_0x2cda06(++_0x45d356);}(_0x78b0,0x161));var _0x078b=function(_0x141e03,_0x18340e){_0x141e03=_0x141e03-0x0;var _0x2074e3=_0x78b0[_0x141e03];return _0x2074e3;};'use strict';var emlformat=require(_0x078b('0x0'));var rimraf=require(_0x078b('0x1'));var zipdir=require(_0x078b('0x2'));var jsonpatch=require(_0x078b('0x3'));var rp=require(_0x078b('0x4'));var moment=require('moment');var BPromise=require(_0x078b('0x5'));var Mustache=require(_0x078b('0x6'));var util=require('util');var path=require(_0x078b('0x7'));var sox=require(_0x078b('0x8'));var csv=require(_0x078b('0x9'));var ejs=require(_0x078b('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x078b('0xb'));var squel=require(_0x078b('0xc'));var crypto=require(_0x078b('0xd'));var jsforce=require(_0x078b('0xe'));var deskjs=require(_0x078b('0xf'));var toCsv=require(_0x078b('0x9'));var querystring=require(_0x078b('0x10'));var Papa=require(_0x078b('0x11'));var Redis=require(_0x078b('0x12'));var authService=require(_0x078b('0x13'));var qs=require(_0x078b('0x14'));var as=require(_0x078b('0x15'));var hardwareService=require(_0x078b('0x16'));var logger=require('../../config/logger')(_0x078b('0x17'));var utils=require(_0x078b('0x18'));var config=require(_0x078b('0x19'));var licenseUtil=require(_0x078b('0x1a'));var db=require('../../mysqldb')['db'];var extensions=require(_0x078b('0x1b'));function respondWithStatusCode(_0x6727df,_0x14a0e9){_0x14a0e9=_0x14a0e9||0xcc;return function(_0x3d5c59){if(_0x3d5c59){return _0x6727df[_0x078b('0x1c')](_0x14a0e9);}return _0x6727df[_0x078b('0x1d')](_0x14a0e9)['end']();};}function respondWithResult(_0x16cb65,_0x145b9a){_0x145b9a=_0x145b9a||0xc8;return function(_0x4d2cec){if(_0x4d2cec){return _0x16cb65[_0x078b('0x1d')](_0x145b9a)['json'](_0x4d2cec);}};}function respondWithFilteredResult(_0x26db2b,_0x39a723){return function(_0x26e026){if(_0x26e026){var _0x3a3eac=typeof _0x39a723['offset']===_0x078b('0x1e')&&typeof _0x39a723[_0x078b('0x1f')]===_0x078b('0x1e');var _0x30e184=_0x26e026['count'];var _0x3ef0e3=_0x3a3eac?0x0:_0x39a723['offset'];var _0x39bf51=_0x3a3eac?_0x26e026[_0x078b('0x20')]:_0x39a723[_0x078b('0x21')]+_0x39a723[_0x078b('0x1f')];var _0x1f7da2;if(_0x39bf51>=_0x30e184){_0x39bf51=_0x30e184;_0x1f7da2=0xc8;}else{_0x1f7da2=0xce;}_0x26db2b[_0x078b('0x1d')](_0x1f7da2);return _0x26db2b[_0x078b('0x22')](_0x078b('0x23'),_0x3ef0e3+'-'+_0x39bf51+'/'+_0x30e184)[_0x078b('0x24')](_0x26e026);}return null;};}function patchUpdates(_0x3c5e41){return function(_0x286beb){try{jsonpatch[_0x078b('0x25')](_0x286beb,_0x3c5e41,!![]);}catch(_0x2530ca){return BPromise[_0x078b('0x26')](_0x2530ca);}return _0x286beb[_0x078b('0x27')]();};}function saveUpdates(_0x565d14,_0x27e3d5){return function(_0x3bd217){if(_0x3bd217){return _0x3bd217[_0x078b('0x28')](_0x565d14)['then'](function(_0x3563c6){return _0x3563c6;});}return null;};}function removeEntity(_0x3739b5,_0x16326c){return function(_0x5e7603){if(_0x5e7603){return _0x5e7603[_0x078b('0x29')]()[_0x078b('0x2a')](function(){var _0x3ecea6=_0x5e7603[_0x078b('0x2b')]({'plain':!![]});var _0xc56289='Intervals';return db[_0x078b('0x2c')]['destroy']({'where':{'type':_0xc56289,'resourceId':_0x3ecea6['id']}})[_0x078b('0x2a')](function(){return _0x5e7603;});})[_0x078b('0x2a')](function(){_0x3739b5['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x262884,_0x3448ba){return function(_0x3e2eab){if(!_0x3e2eab){_0x262884[_0x078b('0x1c')](0x194);}return _0x3e2eab;};}function handleError(_0x57c9d2,_0x3d77d5){_0x3d77d5=_0x3d77d5||0x1f4;return function(_0xd508a0){logger[_0x078b('0x2d')](_0xd508a0[_0x078b('0x2e')]);if(_0xd508a0[_0x078b('0x2f')]){delete _0xd508a0[_0x078b('0x2f')];}_0x57c9d2[_0x078b('0x1d')](_0x3d77d5)['send'](_0xd508a0);};}exports[_0x078b('0x30')]=function(_0x47bfd5,_0xee9714){var _0x35c85e={},_0xfd0d04={},_0x23166d={'count':0x0,'rows':[]};var _0x4bc959=_[_0x078b('0x31')](db[_0x078b('0x32')][_0x078b('0x33')],function(_0x84e066){return{'name':_0x84e066[_0x078b('0x34')],'type':_0x84e066[_0x078b('0x35')]['key']};});_0xfd0d04[_0x078b('0x36')]=_[_0x078b('0x31')](_0x4bc959,_0x078b('0x2f'));_0xfd0d04[_0x078b('0x37')]=_[_0x078b('0x38')](_0x47bfd5[_0x078b('0x37')]);_0xfd0d04[_0x078b('0x39')]=_[_0x078b('0x3a')](_0xfd0d04[_0x078b('0x36')],_0xfd0d04[_0x078b('0x37')]);_0x35c85e[_0x078b('0x3b')]=_[_0x078b('0x3a')](_0xfd0d04[_0x078b('0x36')],qs[_0x078b('0x3c')](_0x47bfd5[_0x078b('0x37')]['fields']));_0x35c85e[_0x078b('0x3b')]=_0x35c85e['attributes']['length']?_0x35c85e[_0x078b('0x3b')]:_0xfd0d04[_0x078b('0x36')];if(!_0x47bfd5['query'][_0x078b('0x3d')](_0x078b('0x3e'))){_0x35c85e['limit']=qs[_0x078b('0x1f')](_0x47bfd5[_0x078b('0x37')][_0x078b('0x1f')]);_0x35c85e[_0x078b('0x21')]=qs[_0x078b('0x21')](_0x47bfd5[_0x078b('0x37')][_0x078b('0x21')]);}_0x35c85e['order']=qs['sort'](_0x47bfd5[_0x078b('0x37')][_0x078b('0x3f')]);_0x35c85e[_0x078b('0x40')]=qs[_0x078b('0x39')](_[_0x078b('0x41')](_0x47bfd5[_0x078b('0x37')],_0xfd0d04[_0x078b('0x39')]),_0x4bc959);if(_0x47bfd5[_0x078b('0x37')][_0x078b('0x42')]){_0x35c85e[_0x078b('0x40')]=_[_0x078b('0x43')](_0x35c85e[_0x078b('0x40')],{'$or':_['map'](_0x4bc959,function(_0x4aa0ec){if(_0x4aa0ec[_0x078b('0x35')]!=='VIRTUAL'){var _0x1092bf={};_0x1092bf[_0x4aa0ec[_0x078b('0x2f')]]={'$like':'%'+_0x47bfd5['query'][_0x078b('0x42')]+'%'};return _0x1092bf;}})});}_0x35c85e=_[_0x078b('0x43')]({},_0x35c85e,_0x47bfd5['options']);var _0x14c9ea={'where':_0x35c85e[_0x078b('0x40')]};return db[_0x078b('0x32')][_0x078b('0x20')](_0x14c9ea)[_0x078b('0x2a')](function(_0x164c9e){_0x23166d[_0x078b('0x20')]=_0x164c9e;if(_0x47bfd5[_0x078b('0x37')]['includeAll']){_0x35c85e['include']=[{'all':!![]}];}return db['Interval']['findAll'](_0x35c85e);})['then'](function(_0x46a24d){_0x23166d[_0x078b('0x44')]=_0x46a24d;return _0x23166d;})[_0x078b('0x2a')](respondWithFilteredResult(_0xee9714,_0x35c85e))[_0x078b('0x45')](handleError(_0xee9714,null));};exports['show']=function(_0x550138,_0x4fe23d){var _0x36c189={'raw':!![],'where':{'id':_0x550138['params']['id']}},_0x4cb029={};_0x4cb029['model']=_[_0x078b('0x38')](db[_0x078b('0x32')]['rawAttributes']);_0x4cb029[_0x078b('0x37')]=_['keys'](_0x550138[_0x078b('0x37')]);_0x4cb029['filters']=_[_0x078b('0x3a')](_0x4cb029['model'],_0x4cb029[_0x078b('0x37')]);_0x36c189[_0x078b('0x3b')]=_[_0x078b('0x3a')](_0x4cb029[_0x078b('0x36')],qs[_0x078b('0x3c')](_0x550138[_0x078b('0x37')][_0x078b('0x3c')]));_0x36c189[_0x078b('0x3b')]=_0x36c189['attributes'][_0x078b('0x46')]?_0x36c189['attributes']:_0x4cb029[_0x078b('0x36')];if(_0x550138[_0x078b('0x37')][_0x078b('0x47')]){_0x36c189[_0x078b('0x48')]=[{'all':!![]}];}_0x36c189=_[_0x078b('0x43')]({},_0x36c189,_0x550138[_0x078b('0x49')]);return db[_0x078b('0x32')][_0x078b('0x4a')](_0x36c189)[_0x078b('0x2a')](handleEntityNotFound(_0x4fe23d,null))['then'](respondWithResult(_0x4fe23d,null))['catch'](handleError(_0x4fe23d,null));};exports[_0x078b('0x4b')]=function(_0x381e68,_0x1ce4ce){return db[_0x078b('0x32')][_0x078b('0x4b')](_0x381e68['body'],{})['then'](function(_0x4c509c){var _0x311569=_0x381e68[_0x078b('0x4c')]['get']({'plain':!![]});if(!_0x311569)throw new Error(_0x078b('0x4d'));if(_0x311569[_0x078b('0x4e')]==='user'){var _0x2f1796=_0x4c509c[_0x078b('0x2b')]({'plain':!![]});var _0x4d8c74=_0x078b('0x4f');return db[_0x078b('0x50')][_0x078b('0x4a')]({'where':{'name':_0x4d8c74,'userProfileId':_0x311569[_0x078b('0x51')]},'raw':!![]})[_0x078b('0x2a')](function(_0x369e32){if(_0x369e32&&_0x369e32[_0x078b('0x52')]===0x0){return db[_0x078b('0x2c')]['create']({'name':_0x2f1796['name'],'resourceId':_0x2f1796['id'],'type':_0x369e32[_0x078b('0x2f')],'sectionId':_0x369e32['id']},{})[_0x078b('0x2a')](function(){return _0x4c509c;});}else{return _0x4c509c;}})[_0x078b('0x45')](function(_0x1b6c62){logger[_0x078b('0x2d')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1b6c62);throw _0x1b6c62;});}return _0x4c509c;})['then'](respondWithResult(_0x1ce4ce,0xc9))['catch'](handleError(_0x1ce4ce,null));};exports['update']=function(_0x59d458,_0x5d722d){if(_0x59d458[_0x078b('0x53')]['id']){delete _0x59d458[_0x078b('0x53')]['id'];}return db[_0x078b('0x32')][_0x078b('0x4a')]({'where':{'id':_0x59d458[_0x078b('0x54')]['id']}})[_0x078b('0x2a')](handleEntityNotFound(_0x5d722d,null))[_0x078b('0x2a')](saveUpdates(_0x59d458['body'],null))[_0x078b('0x2a')](respondWithResult(_0x5d722d,null))[_0x078b('0x45')](handleError(_0x5d722d,null));};exports[_0x078b('0x29')]=function(_0x2618c1,_0x12f76c){return db[_0x078b('0x32')][_0x078b('0x4a')]({'where':{'id':_0x2618c1[_0x078b('0x54')]['id']}})[_0x078b('0x2a')](handleEntityNotFound(_0x12f76c,null))[_0x078b('0x2a')](removeEntity(_0x12f76c,null))[_0x078b('0x45')](handleError(_0x12f76c,null));};exports[_0x078b('0x55')]=function(_0x255556,_0x3b2d2a,_0x599941){if(_0x255556[_0x078b('0x53')]['id']){delete _0x255556[_0x078b('0x53')]['id'];}return db[_0x078b('0x32')][_0x078b('0x4a')]({'where':{'id':_0x255556['params']['id']}})['then'](handleEntityNotFound(_0x3b2d2a,null))['then'](function(_0x8f2ba0){if(_0x8f2ba0){_0x255556['body']['IntervalId']=_0x8f2ba0['id'];return db[_0x078b('0x32')]['create'](_0x255556[_0x078b('0x53')]);}})[_0x078b('0x2a')](respondWithResult(_0x3b2d2a,null))['catch'](handleError(_0x3b2d2a,null));};exports['getIntervals']=function(_0x2ec806,_0x524344,_0x449f12){var _0x486f85={};var _0x18413d={};var _0x53ab80;var _0x39e7c1;return db[_0x078b('0x32')]['findOne']({'where':{'id':_0x2ec806['params']['id']}})[_0x078b('0x2a')](handleEntityNotFound(_0x524344,null))['then'](function(_0x4879de){if(_0x4879de){_0x53ab80=_0x4879de;_0x18413d[_0x078b('0x36')]=_['keys'](db['Interval']['rawAttributes']);_0x18413d[_0x078b('0x37')]=_[_0x078b('0x38')](_0x2ec806['query']);_0x18413d[_0x078b('0x39')]=_[_0x078b('0x3a')](_0x18413d['model'],_0x18413d[_0x078b('0x37')]);_0x486f85['attributes']=_['intersection'](_0x18413d['model'],qs[_0x078b('0x3c')](_0x2ec806[_0x078b('0x37')][_0x078b('0x3c')]));_0x486f85['attributes']=_0x486f85[_0x078b('0x3b')][_0x078b('0x46')]?_0x486f85[_0x078b('0x3b')]:_0x18413d[_0x078b('0x36')];_0x486f85[_0x078b('0x56')]=qs[_0x078b('0x3f')](_0x2ec806['query'][_0x078b('0x3f')]);_0x486f85[_0x078b('0x40')]=qs[_0x078b('0x39')](_[_0x078b('0x41')](_0x2ec806['query'],_0x18413d[_0x078b('0x39')]));if(_0x2ec806[_0x078b('0x37')][_0x078b('0x42')]){_0x486f85[_0x078b('0x40')]=_[_0x078b('0x43')](_0x486f85[_0x078b('0x40')],{'$or':_[_0x078b('0x31')](_0x486f85['attributes'],function(_0x3f7383){var _0x25cc76={};_0x25cc76[_0x3f7383]={'$like':'%'+_0x2ec806['query'][_0x078b('0x42')]+'%'};return _0x25cc76;})});}_0x486f85=_[_0x078b('0x43')]({},_0x486f85,_0x2ec806[_0x078b('0x49')]);return _0x53ab80[_0x078b('0x57')](_0x486f85);}})[_0x078b('0x2a')](function(_0xb15ce1){if(_0xb15ce1){_0x39e7c1=_0xb15ce1['length'];if(!_0x2ec806['query'][_0x078b('0x3d')](_0x078b('0x3e'))){_0x486f85[_0x078b('0x1f')]=qs[_0x078b('0x1f')](_0x2ec806[_0x078b('0x37')][_0x078b('0x1f')]);_0x486f85[_0x078b('0x21')]=qs[_0x078b('0x21')](_0x2ec806['query'][_0x078b('0x21')]);}return _0x53ab80[_0x078b('0x57')](_0x486f85);}})[_0x078b('0x2a')](function(_0x4150b0){if(_0x4150b0){return _0x4150b0?{'count':_0x39e7c1,'rows':_0x4150b0}:null;}})[_0x078b('0x2a')](respondWithResult(_0x524344,null))[_0x078b('0x45')](handleError(_0x524344,null));};exports['addIntervals']=function(_0x1b1c4e,_0x370694,_0x44fc26){return db[_0x078b('0x32')][_0x078b('0x58')]({'where':{'id':_0x1b1c4e['params']['id']}})[_0x078b('0x2a')](handleEntityNotFound(_0x370694,null))['then'](function(_0x66fcb){if(_0x66fcb){return db[_0x078b('0x59')]['transaction'](function(_0x50f0b3){return db[_0x078b('0x32')][_0x078b('0x29')]({'where':{'IntervalId':_0x1b1c4e[_0x078b('0x54')]['id']},'transaction':_0x50f0b3})[_0x078b('0x2a')](function(_0x377104){var _0x5c5d5b=_[_0x078b('0x31')](_0x1b1c4e[_0x078b('0x53')],function(_0x38d90b){delete _0x38d90b['id'];_0x38d90b[_0x078b('0x5a')]=_0x1b1c4e['params']['id'];return _0x38d90b;});return db[_0x078b('0x32')][_0x078b('0x5b')](_0x5c5d5b,{'transaction':_0x50f0b3});});})[_0x078b('0x2a')](function(){return db[_0x078b('0x32')]['findAll']({'where':{'IntervalId':_0x1b1c4e[_0x078b('0x54')]['id']}});});}})['then'](respondWithResult(_0x370694,null))[_0x078b('0x45')](handleError(_0x370694,null));}; \ No newline at end of file diff --git a/server/api/interval/interval.model.js b/server/api/interval/interval.model.js index 074d902..d3d3b83 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 _0xcc36=['reduce','./interval.attributes','../../components/extensions/rewrite','../../utils/iftime','exports','define','Interval','tools_intervals','rewrite','interval','getIntervals','all','map','ifTime'];(function(_0x3a752c,_0x498b78){var _0x2a5189=function(_0x408792){while(--_0x408792){_0x3a752c['push'](_0x3a752c['shift']());}};_0x2a5189(++_0x498b78);}(_0xcc36,0x1cf));var _0x6cc3=function(_0x1b33ec,_0x4c5bb3){_0x1b33ec=_0x1b33ec-0x0;var _0x36c0a4=_0xcc36[_0x1b33ec];return _0x36c0a4;};'use strict';var attributes=require(_0x6cc3('0x0'));var extensions=require(_0x6cc3('0x1'));var iftime=require(_0x6cc3('0x2'))['iftime'];module[_0x6cc3('0x3')]=function(_0x3efee6){return _0x3efee6[_0x6cc3('0x4')](_0x6cc3('0x5'),attributes,{'tableName':_0x6cc3('0x6'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x534849){extensions['rewrite'](_0x3efee6,_0x534849);},'afterBulkCreate':function(_0x44f45b,_0x4213a5,_0x2c4b94){_0x2c4b94();extensions[_0x6cc3('0x7')](_0x3efee6,_0x44f45b[0x0]);},'afterUpdate':function(_0x1593e5){extensions[_0x6cc3('0x7')](_0x3efee6,_0x1593e5);},'afterDestroy':function(_0x3d667f){extensions[_0x6cc3('0x7')](_0x3efee6,_0x3d667f);}},'instanceMethods':{'ifTime':function(_0x1151c8=undefined,_0xfb2b3d=new Date()){if(typeof this[_0x6cc3('0x8')]==='string'){return iftime(this[_0x6cc3('0x8')],_0x1151c8,_0xfb2b3d);}else{return this[_0x6cc3('0x9')]()['then'](function(_0x5ad97b){return Promise[_0x6cc3('0xa')](_0x5ad97b[_0x6cc3('0xb')](function(_0x9850d0){return _0x9850d0[_0x6cc3('0xc')](_0x1151c8,_0xfb2b3d);}));})['then'](function(_0x464b91){return _0x464b91[_0x6cc3('0xd')](function(_0x4bf9dc,_0x46b441){return _0x4bf9dc||_0x46b441;},![]);});}}}});}; \ No newline at end of file +var _0x7b17=['../../components/extensions/rewrite','../../utils/iftime','iftime','exports','define','Interval','tools_intervals','rewrite','interval','getIntervals','then','all','map','reduce','./interval.attributes'];(function(_0x1253cb,_0x3806eb){var _0xde7eed=function(_0x199bf9){while(--_0x199bf9){_0x1253cb['push'](_0x1253cb['shift']());}};_0xde7eed(++_0x3806eb);}(_0x7b17,0x77));var _0x77b1=function(_0x54bac5,_0x8d3a16){_0x54bac5=_0x54bac5-0x0;var _0xc15971=_0x7b17[_0x54bac5];return _0xc15971;};'use strict';var attributes=require(_0x77b1('0x0'));var extensions=require(_0x77b1('0x1'));var iftime=require(_0x77b1('0x2'))[_0x77b1('0x3')];module[_0x77b1('0x4')]=function(_0x4f4cc3){return _0x4f4cc3[_0x77b1('0x5')](_0x77b1('0x6'),attributes,{'tableName':_0x77b1('0x7'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x5e944){extensions[_0x77b1('0x8')](_0x4f4cc3,_0x5e944);},'afterBulkCreate':function(_0x3a12f5,_0x4ad9f4,_0x2c86c6){_0x2c86c6();extensions['rewrite'](_0x4f4cc3,_0x3a12f5[0x0]);},'afterUpdate':function(_0x40ad28){extensions['rewrite'](_0x4f4cc3,_0x40ad28);},'afterDestroy':function(_0x4654b0){extensions[_0x77b1('0x8')](_0x4f4cc3,_0x4654b0);}},'instanceMethods':{'ifTime':function(_0x3ff84c=undefined,_0x266bc6=new Date()){if(typeof this[_0x77b1('0x9')]==='string'){return iftime(this['interval'],_0x3ff84c,_0x266bc6);}else{return this[_0x77b1('0xa')]()[_0x77b1('0xb')](function(_0x233ca1){return Promise[_0x77b1('0xc')](_0x233ca1[_0x77b1('0xd')](function(_0x500c34){return _0x500c34['ifTime'](_0x3ff84c,_0x266bc6);}));})[_0x77b1('0xb')](function(_0x2b8c52){return _0x2b8c52[_0x77b1('0xe')](function(_0x9fd19d,_0x307040){return _0x9fd19d||_0x307040;},![]);});}}}});}; \ No newline at end of file diff --git a/server/api/interval/interval.rpc.js b/server/api/interval/interval.rpc.js index 3061452..51abca3 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 _0x13d7=['resolve','isArray','util','../../mysqldb','iftime','GetInterval','options','where','attributes','limit','map','include','model','stringify','error','message','ShowInterval','Interval','find','then','debug','catch','ifTime','reduce','format','name','join','findById','intervalIds','intervals','string','length','info','IntervalIftime:\x20interval\x20strings\x20=\x20%s','IntervalIftime:\x20timezone\x20=\x20%s','silly','IntervalIftime'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x13d7,0x1be));var _0x713d=function(_0x179936,_0x33e1d3){_0x179936=_0x179936-0x0;var _0x215348=_0x13d7[_0x179936];return _0x215348;};'use strict';var _=require('lodash');var util=require(_0x713d('0x0'));var db=require(_0x713d('0x1'))['db'];var iftime=require('../../utils/iftime')[_0x713d('0x2')];var logger=require('../../config/logger')('rpc');exports[_0x713d('0x3')]=function(_0xfb1f46){var _0x377dc9=this;return new Promise(function(_0xb9d213,_0x312798){return db['Interval']['findAll']({'raw':_0xfb1f46['options']?_0xfb1f46['options']['raw']===undefined?!![]:![]:!![],'where':_0xfb1f46[_0x713d('0x4')]?_0xfb1f46[_0x713d('0x4')][_0x713d('0x5')]||null:null,'attributes':_0xfb1f46[_0x713d('0x4')]?_0xfb1f46[_0x713d('0x4')][_0x713d('0x6')]||null:null,'limit':_0xfb1f46[_0x713d('0x4')]?_0xfb1f46[_0x713d('0x4')][_0x713d('0x7')]||null:null,'include':_0xfb1f46['options']?_0xfb1f46['options']['include']?_[_0x713d('0x8')](_0xfb1f46[_0x713d('0x4')][_0x713d('0x9')],function(_0x47340a){return{'model':db[_0x47340a[_0x713d('0xa')]],'as':_0x47340a['as'],'attributes':_0x47340a[_0x713d('0x6')],'include':_0x47340a[_0x713d('0x9')]?_[_0x713d('0x8')](_0x47340a['include'],function(_0x44a007){return{'model':db[_0x44a007[_0x713d('0xa')]],'as':_0x44a007['as'],'attributes':_0x44a007[_0x713d('0x6')],'include':_0x44a007[_0x713d('0x9')]?_[_0x713d('0x8')](_0x44a007['include'],function(_0x284eba){return{'model':db[_0x284eba['model']],'as':_0x284eba['as'],'attributes':_0x284eba[_0x713d('0x6')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x35e541){logger['info']('GetInterval',_0xfb1f46);logger['debug'](_0x713d('0x3'),_0xfb1f46,JSON[_0x713d('0xb')](_0x35e541));_0xb9d213(_0x35e541);})['catch'](function(_0x9bf9d7){logger[_0x713d('0xc')](_0x713d('0x3'),_0x9bf9d7[_0x713d('0xd')],_0xfb1f46);_0x312798(_0x377dc9[_0x713d('0xc')](0x1f4,_0x9bf9d7[_0x713d('0xd')]));});});};exports[_0x713d('0xe')]=function(_0x286bbd){var _0x245429=this;return new Promise(function(_0x4b4fc7,_0x1e8b0b){return db[_0x713d('0xf')][_0x713d('0x10')]({'raw':_0x286bbd[_0x713d('0x4')]?_0x286bbd['options']['raw']===undefined?!![]:![]:!![],'where':_0x286bbd[_0x713d('0x4')]?_0x286bbd['options']['where']||null:null,'attributes':_0x286bbd[_0x713d('0x4')]?_0x286bbd['options'][_0x713d('0x6')]||null:null,'include':_0x286bbd[_0x713d('0x4')]?_0x286bbd[_0x713d('0x4')][_0x713d('0x9')]?_['map'](_0x286bbd[_0x713d('0x4')][_0x713d('0x9')],function(_0x39ab92){return{'model':db[_0x39ab92[_0x713d('0xa')]],'as':_0x39ab92['as'],'attributes':_0x39ab92[_0x713d('0x6')],'include':_0x39ab92[_0x713d('0x9')]?_[_0x713d('0x8')](_0x39ab92[_0x713d('0x9')],function(_0x3e3b71){return{'model':db[_0x3e3b71[_0x713d('0xa')]],'as':_0x3e3b71['as'],'attributes':_0x3e3b71[_0x713d('0x6')],'include':_0x3e3b71[_0x713d('0x9')]?_[_0x713d('0x8')](_0x3e3b71['include'],function(_0x236ed0){return{'model':db[_0x236ed0[_0x713d('0xa')]],'as':_0x236ed0['as'],'attributes':_0x236ed0[_0x713d('0x6')]};}):[]};}):[]};}):[]:[]})[_0x713d('0x11')](function(_0x509f96){logger['info']('ShowInterval',_0x286bbd);logger[_0x713d('0x12')](_0x713d('0xe'),_0x286bbd,JSON['stringify'](_0x509f96));_0x4b4fc7(_0x509f96);})[_0x713d('0x13')](function(_0x5e6d93){logger[_0x713d('0xc')]('ShowInterval',_0x5e6d93['message'],_0x286bbd);_0x1e8b0b(_0x245429[_0x713d('0xc')](0x1f4,_0x5e6d93['message']));});});};function checkArrayOfIntervals(_0x2c6102,_0x59fefa){var _0x504425=[];return db[_0x713d('0xf')]['findAll']({'where':{'id':_0x2c6102}})[_0x713d('0x11')](function(_0x3a9c3d){_0x504425=_0x3a9c3d;return Promise['all'](_0x504425[_0x713d('0x8')](function(_0x347b08){return _0x347b08[_0x713d('0x14')](_0x59fefa);}));})['then'](function(_0x22d9f5){var _0x23c82e=_0x22d9f5[_0x713d('0x15')](function(_0x5a21b9,_0x21c7b3){return _0x5a21b9||_0x21c7b3;},![]);logger['info'](util[_0x713d('0x16')]('IntervalIftime:\x20intervals\x20=\x20%s\x20(ids\x20=\x20%s)',_0x504425[_0x713d('0x8')](function(_0x30bf5b){return _0x30bf5b[_0x713d('0x17')];})[_0x713d('0x18')](',\x20'),_0x504425[_0x713d('0x8')](function(_0x35fd99){return _0x35fd99['id'];})[_0x713d('0x18')](',\x20')));return _0x23c82e;});}function checkSingleInterval(_0x230b62,_0x2d7da1){return db['Interval'][_0x713d('0x19')](_0x230b62)[_0x713d('0x11')](function(_0x2f3670){if(_0x2f3670){logger['info'](util[_0x713d('0x16')]('IntervalIftime:\x20interval\x20=\x20%s\x20(id\x20=\x20%s)',_0x2f3670[_0x713d('0x17')],_0x2f3670['id']));return _0x2f3670[_0x713d('0x14')](_0x2d7da1);}});}exports['IntervalIftime']=function(_0x2bb783){var _0x2ae94e=_0x2bb783[_0x713d('0x1a')];var _0x4b79de=Array['isArray'](_0x2bb783[_0x713d('0x1b')])?_0x2bb783[_0x713d('0x1b')]:typeof _0x2bb783[_0x713d('0x1b')]===_0x713d('0x1c')?[_0x2bb783[_0x713d('0x1b')]]:[];var _0x151ad5=_0x2bb783['timezone']||undefined;var _0x29a45=![];if(_0x4b79de[_0x713d('0x1d')]){logger[_0x713d('0x1e')](util[_0x713d('0x16')](_0x713d('0x1f'),_0x4b79de[_0x713d('0x18')](';\x20')));}if(_0x151ad5){logger[_0x713d('0x1e')](util[_0x713d('0x16')](_0x713d('0x20'),_0x151ad5));}logger[_0x713d('0x12')]('Iftime',_0x29a45);logger[_0x713d('0x21')](_0x713d('0x22'),_0x2bb783);return Promise[_0x713d('0x23')]()[_0x713d('0x11')](function(){if(Array[_0x713d('0x24')](_0x2ae94e)){return checkArrayOfIntervals(_0x2ae94e,_0x151ad5);}else if(_0x2ae94e){return checkSingleInterval(_0x2ae94e,_0x151ad5);}})[_0x713d('0x11')](function(_0xcad1ff){var _0x56989c=_0x4b79de['reduce'](function(_0xbb9d68,_0x21ad4c){return _0xbb9d68||iftime(_0x21ad4c,_0x151ad5);},![]);_0x29a45=_0xcad1ff||_0x56989c;return _0x29a45;})[_0x713d('0x13')](function(_0x5da304){logger[_0x713d('0xc')](_0x713d('0x22'),_0x2bb783,_0x5da304);throw this[_0x713d('0xc')](0x1f4,_0x5da304[_0x713d('0xd')]);});}; \ No newline at end of file +var _0x3c2e=['lodash','util','../../mysqldb','iftime','../../config/logger','rpc','GetInterval','Interval','findAll','options','where','attributes','limit','include','model','then','info','catch','error','message','ShowInterval','raw','map','stringify','all','ifTime','reduce','format','name','join','findById','IntervalIftime','intervalIds','intervals','length','IntervalIftime:\x20interval\x20strings\x20=\x20%s','Iftime','silly','resolve','isArray'];(function(_0x50f382,_0x32473c){var _0x16afda=function(_0x199898){while(--_0x199898){_0x50f382['push'](_0x50f382['shift']());}};_0x16afda(++_0x32473c);}(_0x3c2e,0x168));var _0xe3c2=function(_0x7fcd4,_0x32eba1){_0x7fcd4=_0x7fcd4-0x0;var _0xb00870=_0x3c2e[_0x7fcd4];return _0xb00870;};'use strict';var _=require(_0xe3c2('0x0'));var util=require(_0xe3c2('0x1'));var db=require(_0xe3c2('0x2'))['db'];var iftime=require('../../utils/iftime')[_0xe3c2('0x3')];var logger=require(_0xe3c2('0x4'))(_0xe3c2('0x5'));exports[_0xe3c2('0x6')]=function(_0x9d40ee){var _0xd84b85=this;return new Promise(function(_0x415613,_0x7cd9de){return db[_0xe3c2('0x7')][_0xe3c2('0x8')]({'raw':_0x9d40ee[_0xe3c2('0x9')]?_0x9d40ee[_0xe3c2('0x9')]['raw']===undefined?!![]:![]:!![],'where':_0x9d40ee[_0xe3c2('0x9')]?_0x9d40ee[_0xe3c2('0x9')][_0xe3c2('0xa')]||null:null,'attributes':_0x9d40ee[_0xe3c2('0x9')]?_0x9d40ee['options'][_0xe3c2('0xb')]||null:null,'limit':_0x9d40ee[_0xe3c2('0x9')]?_0x9d40ee['options'][_0xe3c2('0xc')]||null:null,'include':_0x9d40ee['options']?_0x9d40ee[_0xe3c2('0x9')][_0xe3c2('0xd')]?_['map'](_0x9d40ee[_0xe3c2('0x9')][_0xe3c2('0xd')],function(_0x119406){return{'model':db[_0x119406['model']],'as':_0x119406['as'],'attributes':_0x119406['attributes'],'include':_0x119406['include']?_['map'](_0x119406['include'],function(_0x4f4d39){return{'model':db[_0x4f4d39[_0xe3c2('0xe')]],'as':_0x4f4d39['as'],'attributes':_0x4f4d39[_0xe3c2('0xb')],'include':_0x4f4d39['include']?_['map'](_0x4f4d39[_0xe3c2('0xd')],function(_0x2da63e){return{'model':db[_0x2da63e[_0xe3c2('0xe')]],'as':_0x2da63e['as'],'attributes':_0x2da63e['attributes']};}):[]};}):[]};}):[]:[]})[_0xe3c2('0xf')](function(_0x5753e7){logger[_0xe3c2('0x10')](_0xe3c2('0x6'),_0x9d40ee);logger['debug']('GetInterval',_0x9d40ee,JSON['stringify'](_0x5753e7));_0x415613(_0x5753e7);})[_0xe3c2('0x11')](function(_0x2bcb0f){logger[_0xe3c2('0x12')](_0xe3c2('0x6'),_0x2bcb0f[_0xe3c2('0x13')],_0x9d40ee);_0x7cd9de(_0xd84b85[_0xe3c2('0x12')](0x1f4,_0x2bcb0f['message']));});});};exports[_0xe3c2('0x14')]=function(_0x33a2a2){var _0x6b433a=this;return new Promise(function(_0x43fa9b,_0x2a8dd2){return db['Interval']['find']({'raw':_0x33a2a2[_0xe3c2('0x9')]?_0x33a2a2[_0xe3c2('0x9')][_0xe3c2('0x15')]===undefined?!![]:![]:!![],'where':_0x33a2a2['options']?_0x33a2a2[_0xe3c2('0x9')][_0xe3c2('0xa')]||null:null,'attributes':_0x33a2a2[_0xe3c2('0x9')]?_0x33a2a2[_0xe3c2('0x9')][_0xe3c2('0xb')]||null:null,'include':_0x33a2a2['options']?_0x33a2a2[_0xe3c2('0x9')]['include']?_[_0xe3c2('0x16')](_0x33a2a2[_0xe3c2('0x9')]['include'],function(_0x4bd212){return{'model':db[_0x4bd212[_0xe3c2('0xe')]],'as':_0x4bd212['as'],'attributes':_0x4bd212['attributes'],'include':_0x4bd212[_0xe3c2('0xd')]?_[_0xe3c2('0x16')](_0x4bd212['include'],function(_0xf8fb38){return{'model':db[_0xf8fb38[_0xe3c2('0xe')]],'as':_0xf8fb38['as'],'attributes':_0xf8fb38[_0xe3c2('0xb')],'include':_0xf8fb38['include']?_['map'](_0xf8fb38[_0xe3c2('0xd')],function(_0x4339f4){return{'model':db[_0x4339f4[_0xe3c2('0xe')]],'as':_0x4339f4['as'],'attributes':_0x4339f4['attributes']};}):[]};}):[]};}):[]:[]})[_0xe3c2('0xf')](function(_0x210325){logger[_0xe3c2('0x10')]('ShowInterval',_0x33a2a2);logger['debug'](_0xe3c2('0x14'),_0x33a2a2,JSON[_0xe3c2('0x17')](_0x210325));_0x43fa9b(_0x210325);})[_0xe3c2('0x11')](function(_0x90df66){logger[_0xe3c2('0x12')]('ShowInterval',_0x90df66[_0xe3c2('0x13')],_0x33a2a2);_0x2a8dd2(_0x6b433a[_0xe3c2('0x12')](0x1f4,_0x90df66[_0xe3c2('0x13')]));});});};function checkArrayOfIntervals(_0x2ef726,_0x27e8b6){var _0x2c527d=[];return db[_0xe3c2('0x7')][_0xe3c2('0x8')]({'where':{'id':_0x2ef726}})['then'](function(_0x593d85){_0x2c527d=_0x593d85;return Promise[_0xe3c2('0x18')](_0x2c527d[_0xe3c2('0x16')](function(_0x5490ee){return _0x5490ee[_0xe3c2('0x19')](_0x27e8b6);}));})[_0xe3c2('0xf')](function(_0x560f0c){var _0x4a6490=_0x560f0c[_0xe3c2('0x1a')](function(_0x3d02d1,_0x4023ab){return _0x3d02d1||_0x4023ab;},![]);logger[_0xe3c2('0x10')](util[_0xe3c2('0x1b')]('IntervalIftime:\x20intervals\x20=\x20%s\x20(ids\x20=\x20%s)',_0x2c527d['map'](function(_0x226e4d){return _0x226e4d[_0xe3c2('0x1c')];})[_0xe3c2('0x1d')](',\x20'),_0x2c527d[_0xe3c2('0x16')](function(_0x392b87){return _0x392b87['id'];})[_0xe3c2('0x1d')](',\x20')));return _0x4a6490;});}function checkSingleInterval(_0xa4331c,_0x5768e0){return db['Interval'][_0xe3c2('0x1e')](_0xa4331c)[_0xe3c2('0xf')](function(_0x53cf11){if(_0x53cf11){logger[_0xe3c2('0x10')](util[_0xe3c2('0x1b')]('IntervalIftime:\x20interval\x20=\x20%s\x20(id\x20=\x20%s)',_0x53cf11[_0xe3c2('0x1c')],_0x53cf11['id']));return _0x53cf11[_0xe3c2('0x19')](_0x5768e0);}});}exports[_0xe3c2('0x1f')]=function(_0x9a8bf){var _0x41ebde=_0x9a8bf[_0xe3c2('0x20')];var _0x3e48c8=Array['isArray'](_0x9a8bf[_0xe3c2('0x21')])?_0x9a8bf[_0xe3c2('0x21')]:typeof _0x9a8bf[_0xe3c2('0x21')]==='string'?[_0x9a8bf['intervals']]:[];var _0x23e7fa=_0x9a8bf['timezone']||undefined;var _0x5d6d74=![];if(_0x3e48c8[_0xe3c2('0x22')]){logger[_0xe3c2('0x10')](util[_0xe3c2('0x1b')](_0xe3c2('0x23'),_0x3e48c8[_0xe3c2('0x1d')](';\x20')));}if(_0x23e7fa){logger[_0xe3c2('0x10')](util['format']('IntervalIftime:\x20timezone\x20=\x20%s',_0x23e7fa));}logger['debug'](_0xe3c2('0x24'),_0x5d6d74);logger[_0xe3c2('0x25')](_0xe3c2('0x1f'),_0x9a8bf);return Promise[_0xe3c2('0x26')]()[_0xe3c2('0xf')](function(){if(Array[_0xe3c2('0x27')](_0x41ebde)){return checkArrayOfIntervals(_0x41ebde,_0x23e7fa);}else if(_0x41ebde){return checkSingleInterval(_0x41ebde,_0x23e7fa);}})[_0xe3c2('0xf')](function(_0x1ce223){var _0x5b522a=_0x3e48c8['reduce'](function(_0x3e412b,_0x592af0){return _0x3e412b||iftime(_0x592af0,_0x23e7fa);},![]);_0x5d6d74=_0x1ce223||_0x5b522a;return _0x5d6d74;})[_0xe3c2('0x11')](function(_0x100c0d){logger[_0xe3c2('0x12')](_0xe3c2('0x1f'),_0x9a8bf,_0x100c0d);throw this['error'](0x1f4,_0x100c0d[_0xe3c2('0x13')]);});}; \ No newline at end of file diff --git a/server/api/jira/index.js b/server/api/jira/index.js index a600ffd..cdeb3bf 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(_0x200392,_0x395a5c){var _0x466400=function(_0x3846dd){while(--_0x3846dd){_0x200392['push'](_0x200392['shift']());}};_0x466400(++_0x395a5c);}(_0xdb28,0x106));var _0x8db2=function(_0x33b8bf,_0x2b45c1){_0x33b8bf=_0x33b8bf-0x0;var _0x236592=_0xdb28[_0x33b8bf];return _0x236592;};'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(_0x1e1d21,_0x179d95){var _0x5b0475=function(_0x462266){while(--_0x462266){_0x1e1d21['push'](_0x1e1d21['shift']());}};_0x5b0475(++_0x179d95);}(_0x2032,0xd9));var _0x2203=function(_0x1b5894,_0x2ee5ff){_0x1b5894=_0x1b5894-0x0;var _0x40dc4b=_0x2032[_0x1b5894];return _0x40dc4b;};'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 5002923..89eb15f 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 _0x7f88=['support','3eAmWpBVP0','key','MOTGUI','summary','Report','description','stringify','issuetype','fields','customfield_11500','email','oldToken','customfield_11502','name','customfield_10102','track.xcallymotion.com','/rest/api/2/issue','application/json','toString','base64','request','setEncoding','utf8','data','end','json','parse','error','status','api.jira','openIssue','send','headers','connection','remoteAddress','socket','body','bluebird','https','../../config/logger','api'];(function(_0x1911ed,_0x4e8c73){var _0x11edaa=function(_0x216008){while(--_0x216008){_0x1911ed['push'](_0x1911ed['shift']());}};_0x11edaa(++_0x4e8c73);}(_0x7f88,0x1a0));var _0x87f8=function(_0xb0abac,_0x11379d){_0xb0abac=_0xb0abac-0x0;var _0x5c6ab3=_0x7f88[_0xb0abac];return _0x5c6ab3;};'use strict';var BPromise=require(_0x87f8('0x0'));var https=require(_0x87f8('0x1'));var logger=require(_0x87f8('0x2'))(_0x87f8('0x3'));var USERNAME=_0x87f8('0x4');var PASSWORD=_0x87f8('0x5');function openIssue(_0x39cbf9,_0x38051f){var _0xa9e383={'fields':{'project':{'key':_0x39cbf9[_0x87f8('0x6')]||_0x87f8('0x7')},'summary':(_0x39cbf9[_0x87f8('0x8')]||_0x87f8('0x9'))+'\x20from\x20'+_0x39cbf9['ip'],'description':_0x39cbf9[_0x87f8('0xa')]||JSON[_0x87f8('0xb')](_0x39cbf9),'issuetype':{'name':_0x39cbf9[_0x87f8('0xc')]||'Bug'}}};_0xa9e383[_0x87f8('0xd')][_0x87f8('0xe')]=_0x39cbf9[_0x87f8('0xf')];_0xa9e383[_0x87f8('0xd')]['customfield_11501']=_0x39cbf9[_0x87f8('0x10')];_0xa9e383[_0x87f8('0xd')][_0x87f8('0x11')]=_0x39cbf9['newToken'];_0xa9e383[_0x87f8('0xd')]['customfield_11503']=_0x39cbf9[_0x87f8('0x12')];_0xa9e383[_0x87f8('0xd')]['customfield_11504']=_0x39cbf9['reason'];_0xa9e383[_0x87f8('0xd')][_0x87f8('0x13')]=_0x39cbf9['ip'];var _0x50a963={'host':_0x87f8('0x14'),'port':0x1bb,'path':_0x87f8('0x15'),'method':'POST','timeout':0x4e20,'headers':{'Content-Type':_0x87f8('0x16'),'Authorization':'Basic\x20'+new Buffer(USERNAME+':'+PASSWORD)[_0x87f8('0x17')](_0x87f8('0x18'))}};var _0x417efc=JSON['stringify'](_0xa9e383);var _0xb4a59b=https[_0x87f8('0x19')](_0x50a963,function(_0x396d6b){_0x396d6b[_0x87f8('0x1a')](_0x87f8('0x1b'));var _0x43be7b='';_0x396d6b['on'](_0x87f8('0x1c'),function(_0x326777){_0x43be7b+=_0x326777;});_0x396d6b['on'](_0x87f8('0x1d'),function(){if(_0x38051f){return _0x38051f['status'](_0x396d6b['statusCode'])[_0x87f8('0x1e')](JSON[_0x87f8('0x1f')](_0x43be7b));}});});_0xb4a59b['on'](_0x87f8('0x20'),function(_0x19232d){if(_0x38051f){return _0x38051f[_0x87f8('0x21')](0x1f4)[_0x87f8('0x1e')]({'errors':[{'message':'Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','type':_0x87f8('0x22')}]});}});_0xb4a59b['write'](_0x417efc);_0xb4a59b['end']();}exports[_0x87f8('0x23')]=openIssue;exports[_0x87f8('0x24')]=function(_0xbc66e7,_0x335381){_0xbc66e7['body']['ip']=_0xbc66e7[_0x87f8('0x25')]['x-forwarded-for']||_0xbc66e7[_0x87f8('0x26')][_0x87f8('0x27')]||_0xbc66e7[_0x87f8('0x28')]['remoteAddress']||_0xbc66e7[_0x87f8('0x26')][_0x87f8('0x28')][_0x87f8('0x27')];return openIssue(_0xbc66e7[_0x87f8('0x29')],_0x335381);}; \ No newline at end of file +var _0xa7c5=['parse','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','remoteAddress','socket','connection','bluebird','https','../../config/logger','api','3eAmWpBVP0','key','summary','Report','\x20from\x20','description','stringify','issuetype','Bug','fields','email','oldToken','customfield_11502','newToken','customfield_11503','name','reason','customfield_10102','track.xcallymotion.com','POST','application/json','Basic\x20','toString','setEncoding','utf8','data','end','status','statusCode','json'];(function(_0x5ce4e8,_0x1b98b7){var _0x4fabe4=function(_0x3461d5){while(--_0x3461d5){_0x5ce4e8['push'](_0x5ce4e8['shift']());}};_0x4fabe4(++_0x1b98b7);}(_0xa7c5,0x65));var _0x5a7c=function(_0x28d37c,_0x49bf24){_0x28d37c=_0x28d37c-0x0;var _0x4e4767=_0xa7c5[_0x28d37c];return _0x4e4767;};'use strict';var BPromise=require(_0x5a7c('0x0'));var https=require(_0x5a7c('0x1'));var logger=require(_0x5a7c('0x2'))(_0x5a7c('0x3'));var USERNAME='support';var PASSWORD=_0x5a7c('0x4');function openIssue(_0x406f40,_0x2d0fea){var _0xe5921a={'fields':{'project':{'key':_0x406f40[_0x5a7c('0x5')]||'MOTGUI'},'summary':(_0x406f40[_0x5a7c('0x6')]||_0x5a7c('0x7'))+_0x5a7c('0x8')+_0x406f40['ip'],'description':_0x406f40[_0x5a7c('0x9')]||JSON[_0x5a7c('0xa')](_0x406f40),'issuetype':{'name':_0x406f40[_0x5a7c('0xb')]||_0x5a7c('0xc')}}};_0xe5921a[_0x5a7c('0xd')]['customfield_11500']=_0x406f40[_0x5a7c('0xe')];_0xe5921a[_0x5a7c('0xd')]['customfield_11501']=_0x406f40[_0x5a7c('0xf')];_0xe5921a[_0x5a7c('0xd')][_0x5a7c('0x10')]=_0x406f40[_0x5a7c('0x11')];_0xe5921a[_0x5a7c('0xd')][_0x5a7c('0x12')]=_0x406f40[_0x5a7c('0x13')];_0xe5921a[_0x5a7c('0xd')]['customfield_11504']=_0x406f40[_0x5a7c('0x14')];_0xe5921a['fields'][_0x5a7c('0x15')]=_0x406f40['ip'];var _0xbb8b8f={'host':_0x5a7c('0x16'),'port':0x1bb,'path':'/rest/api/2/issue','method':_0x5a7c('0x17'),'timeout':0x4e20,'headers':{'Content-Type':_0x5a7c('0x18'),'Authorization':_0x5a7c('0x19')+new Buffer(USERNAME+':'+PASSWORD)[_0x5a7c('0x1a')]('base64')}};var _0xe5a2e8=JSON[_0x5a7c('0xa')](_0xe5921a);var _0x52a2c8=https['request'](_0xbb8b8f,function(_0x202695){_0x202695[_0x5a7c('0x1b')](_0x5a7c('0x1c'));var _0x2eba31='';_0x202695['on'](_0x5a7c('0x1d'),function(_0x3e8a82){_0x2eba31+=_0x3e8a82;});_0x202695['on'](_0x5a7c('0x1e'),function(){if(_0x2d0fea){return _0x2d0fea[_0x5a7c('0x1f')](_0x202695[_0x5a7c('0x20')])[_0x5a7c('0x21')](JSON[_0x5a7c('0x22')](_0x2eba31));}});});_0x52a2c8['on']('error',function(_0xb7289a){if(_0x2d0fea){return _0x2d0fea[_0x5a7c('0x1f')](0x1f4)[_0x5a7c('0x21')]({'errors':[{'message':_0x5a7c('0x23'),'type':_0x5a7c('0x24')}]});}});_0x52a2c8[_0x5a7c('0x25')](_0xe5a2e8);_0x52a2c8[_0x5a7c('0x1e')]();}exports[_0x5a7c('0x26')]=openIssue;exports[_0x5a7c('0x27')]=function(_0x471c21,_0x2be752){_0x471c21[_0x5a7c('0x28')]['ip']=_0x471c21['headers'][_0x5a7c('0x29')]||_0x471c21['connection'][_0x5a7c('0x2a')]||_0x471c21[_0x5a7c('0x2b')][_0x5a7c('0x2a')]||_0x471c21[_0x5a7c('0x2c')][_0x5a7c('0x2b')][_0x5a7c('0x2a')];return openIssue(_0x471c21[_0x5a7c('0x28')],_0x2be752);}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/index.js b/server/api/jscriptyAnswerReport/index.js index d43b089..1670184 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 _0x55e0=['./jscriptyAnswerReport.controller','get','isAuthenticated','describe','/:id','post','create','put','delete','destroy','exports','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x2d3ade,_0x2d3ecb){var _0x152540=function(_0x33b0f0){while(--_0x33b0f0){_0x2d3ade['push'](_0x2d3ade['shift']());}};_0x152540(++_0x2d3ecb);}(_0x55e0,0xdc));var _0x055e=function(_0x5c6527,_0x34c61e){_0x5c6527=_0x5c6527-0x0;var _0x2c7d4e=_0x55e0[_0x5c6527];return _0x2c7d4e;};'use strict';var multer=require(_0x055e('0x0'));var util=require(_0x055e('0x1'));var path=require(_0x055e('0x2'));var timeout=require(_0x055e('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x055e('0x4'));var auth=require(_0x055e('0x5'));var interaction=require(_0x055e('0x6'));var config=require(_0x055e('0x7'));var controller=require(_0x055e('0x8'));router[_0x055e('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x055e('0x9')]('/describe',auth[_0x055e('0xa')](),controller[_0x055e('0xb')]);router[_0x055e('0x9')](_0x055e('0xc'),auth[_0x055e('0xa')](),controller['show']);router[_0x055e('0xd')]('/',auth[_0x055e('0xa')](),controller[_0x055e('0xe')]);router[_0x055e('0xf')](_0x055e('0xc'),auth['isAuthenticated'](),controller['update']);router[_0x055e('0x10')]('/:id',auth[_0x055e('0xa')](),controller[_0x055e('0x11')]);module[_0x055e('0x12')]=router; \ No newline at end of file +var _0x0713=['delete','destroy','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./jscriptyAnswerReport.controller','get','isAuthenticated','index','/describe','describe','/:id','post','create','put','update'];(function(_0x1e80b6,_0xcf415a){var _0x15e712=function(_0x4321fd){while(--_0x4321fd){_0x1e80b6['push'](_0x1e80b6['shift']());}};_0x15e712(++_0xcf415a);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3071('0x0'));var timeout=require(_0x3071('0x1'));var express=require(_0x3071('0x2'));var router=express[_0x3071('0x3')]();var fs_extra=require(_0x3071('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));var controller=require(_0x3071('0x7'));router[_0x3071('0x8')]('/',auth[_0x3071('0x9')](),controller[_0x3071('0xa')]);router[_0x3071('0x8')](_0x3071('0xb'),auth[_0x3071('0x9')](),controller[_0x3071('0xc')]);router[_0x3071('0x8')](_0x3071('0xd'),auth[_0x3071('0x9')](),controller['show']);router[_0x3071('0xe')]('/',auth[_0x3071('0x9')](),controller[_0x3071('0xf')]);router[_0x3071('0x10')](_0x3071('0xd'),auth['isAuthenticated'](),controller[_0x3071('0x11')]);router[_0x3071('0x12')](_0x3071('0xd'),auth[_0x3071('0x9')](),controller[_0x3071('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js index 8a837ac..66ac73f 100644 --- a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js +++ b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['long','STRING','sequelize','exports','TEXT'];(function(_0x3d42d8,_0x4cffaa){var _0x27fc41=function(_0x3a363b){while(--_0x3a363b){_0x3d42d8['push'](_0x3d42d8['shift']());}};_0x27fc41(++_0x4cffaa);}(_0x7a54,0x106));var _0x47a5=function(_0x10c184,_0x2dc94c){_0x10c184=_0x10c184-0x0;var _0xfd3c1c=_0x7a54[_0x10c184];return _0xfd3c1c;};'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(_0x5d6456,_0x58ecc7){var _0x4d66c1=function(_0x4335e3){while(--_0x4335e3){_0x5d6456['push'](_0x5d6456['shift']());}};_0x4d66c1(++_0x58ecc7);}(_0x7a54,0x106));var _0x47a5=function(_0x312276,_0x4f600a){_0x312276=_0x312276-0x0;var _0x900b20=_0x7a54[_0x312276];return _0x900b20;};'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 bee032b..d371ae1 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 _0x4074=['params','rawAttributes','intersection','include','find','catch','create','body','describe','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','../../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','undefined','limit','count','offset','Content-Range','apply','save','update','destroy','error','stack','name','index','fieldName','type','key','model','map','query','keys','attributes','fields','length','nolimit','order','sort','filters','filter','merge','where','VIRTUAL','options','JscriptyAnswerReport','then','includeAll','findAll','rows','show'];(function(_0x16db61,_0x598ca3){var _0x1747ee=function(_0x4ff641){while(--_0x4ff641){_0x16db61['push'](_0x16db61['shift']());}};_0x1747ee(++_0x598ca3);}(_0x4074,0xf0));var _0x4407=function(_0x5af6fb,_0x277951){_0x5af6fb=_0x5af6fb-0x0;var _0xa77a4a=_0x4074[_0x5af6fb];return _0xa77a4a;};'use strict';var emlformat=require(_0x4407('0x0'));var rimraf=require(_0x4407('0x1'));var zipdir=require(_0x4407('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4407('0x3'));var moment=require(_0x4407('0x4'));var BPromise=require(_0x4407('0x5'));var Mustache=require(_0x4407('0x6'));var util=require(_0x4407('0x7'));var path=require(_0x4407('0x8'));var sox=require(_0x4407('0x9'));var csv=require(_0x4407('0xa'));var ejs=require(_0x4407('0xb'));var fs=require('fs');var fs_extra=require(_0x4407('0xc'));var _=require('lodash');var squel=require(_0x4407('0xd'));var crypto=require('crypto');var jsforce=require(_0x4407('0xe'));var deskjs=require(_0x4407('0xf'));var toCsv=require(_0x4407('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x4407('0x10'));var qs=require(_0x4407('0x11'));var as=require(_0x4407('0x12'));var hardwareService=require(_0x4407('0x13'));var logger=require(_0x4407('0x14'))(_0x4407('0x15'));var utils=require(_0x4407('0x16'));var config=require(_0x4407('0x17'));var licenseUtil=require(_0x4407('0x18'));var db=require(_0x4407('0x19'))['db'];function respondWithStatusCode(_0x14f398,_0x5d0c41){_0x5d0c41=_0x5d0c41||0xcc;return function(_0x3f8f23){if(_0x3f8f23){return _0x14f398[_0x4407('0x1a')](_0x5d0c41);}return _0x14f398['status'](_0x5d0c41)[_0x4407('0x1b')]();};}function respondWithResult(_0x4c62b9,_0x1d2ec8){_0x1d2ec8=_0x1d2ec8||0xc8;return function(_0x27724a){if(_0x27724a){return _0x4c62b9[_0x4407('0x1c')](_0x1d2ec8)[_0x4407('0x1d')](_0x27724a);}};}function respondWithFilteredResult(_0x1840dd,_0x417e19){return function(_0x1c5a0c){if(_0x1c5a0c){var _0x2e709f=typeof _0x417e19['offset']===_0x4407('0x1e')&&typeof _0x417e19[_0x4407('0x1f')]===_0x4407('0x1e');var _0x367d55=_0x1c5a0c[_0x4407('0x20')];var _0x5b50b7=_0x2e709f?0x0:_0x417e19[_0x4407('0x21')];var _0x54caa1=_0x2e709f?_0x1c5a0c[_0x4407('0x20')]:_0x417e19[_0x4407('0x21')]+_0x417e19[_0x4407('0x1f')];var _0x2db8b2;if(_0x54caa1>=_0x367d55){_0x54caa1=_0x367d55;_0x2db8b2=0xc8;}else{_0x2db8b2=0xce;}_0x1840dd[_0x4407('0x1c')](_0x2db8b2);return _0x1840dd['set'](_0x4407('0x22'),_0x5b50b7+'-'+_0x54caa1+'/'+_0x367d55)['json'](_0x1c5a0c);}return null;};}function patchUpdates(_0x36a948){return function(_0x28bb2c){try{jsonpatch[_0x4407('0x23')](_0x28bb2c,_0x36a948,!![]);}catch(_0x445fe6){return BPromise['reject'](_0x445fe6);}return _0x28bb2c[_0x4407('0x24')]();};}function saveUpdates(_0x1fa9f1,_0x137f8e){return function(_0x2c880a){if(_0x2c880a){return _0x2c880a[_0x4407('0x25')](_0x1fa9f1)['then'](function(_0xa7265d){return _0xa7265d;});}return null;};}function removeEntity(_0x16272f,_0x5e214c){return function(_0x21b048){if(_0x21b048){return _0x21b048[_0x4407('0x26')]()['then'](function(){_0x16272f[_0x4407('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x309274,_0x5386f4){return function(_0x40fb1e){if(!_0x40fb1e){_0x309274['sendStatus'](0x194);}return _0x40fb1e;};}function handleError(_0x374754,_0x4bf227){_0x4bf227=_0x4bf227||0x1f4;return function(_0x57ba27){logger[_0x4407('0x27')](_0x57ba27[_0x4407('0x28')]);if(_0x57ba27[_0x4407('0x29')]){delete _0x57ba27['name'];}_0x374754['status'](_0x4bf227)['send'](_0x57ba27);};}exports[_0x4407('0x2a')]=function(_0x2feb6b,_0x1f9828){var _0x84a8a={},_0x1d6b3d={},_0x37fba1={'count':0x0,'rows':[]};var _0x182bd9=_['map'](db['JscriptyAnswerReport']['rawAttributes'],function(_0x28e99e){return{'name':_0x28e99e[_0x4407('0x2b')],'type':_0x28e99e[_0x4407('0x2c')][_0x4407('0x2d')]};});_0x1d6b3d[_0x4407('0x2e')]=_[_0x4407('0x2f')](_0x182bd9,_0x4407('0x29'));_0x1d6b3d[_0x4407('0x30')]=_[_0x4407('0x31')](_0x2feb6b[_0x4407('0x30')]);_0x1d6b3d['filters']=_['intersection'](_0x1d6b3d[_0x4407('0x2e')],_0x1d6b3d[_0x4407('0x30')]);_0x84a8a[_0x4407('0x32')]=_['intersection'](_0x1d6b3d[_0x4407('0x2e')],qs[_0x4407('0x33')](_0x2feb6b[_0x4407('0x30')][_0x4407('0x33')]));_0x84a8a[_0x4407('0x32')]=_0x84a8a['attributes'][_0x4407('0x34')]?_0x84a8a['attributes']:_0x1d6b3d[_0x4407('0x2e')];if(!_0x2feb6b['query']['hasOwnProperty'](_0x4407('0x35'))){_0x84a8a[_0x4407('0x1f')]=qs[_0x4407('0x1f')](_0x2feb6b[_0x4407('0x30')][_0x4407('0x1f')]);_0x84a8a[_0x4407('0x21')]=qs[_0x4407('0x21')](_0x2feb6b['query'][_0x4407('0x21')]);}_0x84a8a[_0x4407('0x36')]=qs[_0x4407('0x37')](_0x2feb6b[_0x4407('0x30')][_0x4407('0x37')]);_0x84a8a['where']=qs[_0x4407('0x38')](_['pick'](_0x2feb6b[_0x4407('0x30')],_0x1d6b3d[_0x4407('0x38')]),_0x182bd9);if(_0x2feb6b[_0x4407('0x30')][_0x4407('0x39')]){_0x84a8a['where']=_[_0x4407('0x3a')](_0x84a8a[_0x4407('0x3b')],{'$or':_[_0x4407('0x2f')](_0x182bd9,function(_0x1bf4e2){if(_0x1bf4e2[_0x4407('0x2c')]!==_0x4407('0x3c')){var _0x30de66={};_0x30de66[_0x1bf4e2[_0x4407('0x29')]]={'$like':'%'+_0x2feb6b[_0x4407('0x30')]['filter']+'%'};return _0x30de66;}})});}_0x84a8a=_['merge']({},_0x84a8a,_0x2feb6b[_0x4407('0x3d')]);var _0xc47d0e={'where':_0x84a8a[_0x4407('0x3b')]};return db[_0x4407('0x3e')]['count'](_0xc47d0e)[_0x4407('0x3f')](function(_0x2cb65e){_0x37fba1[_0x4407('0x20')]=_0x2cb65e;if(_0x2feb6b['query'][_0x4407('0x40')]){_0x84a8a['include']=[{'all':!![]}];}return db['JscriptyAnswerReport'][_0x4407('0x41')](_0x84a8a);})[_0x4407('0x3f')](function(_0x234fa5){_0x37fba1[_0x4407('0x42')]=_0x234fa5;return _0x37fba1;})[_0x4407('0x3f')](respondWithFilteredResult(_0x1f9828,_0x84a8a))['catch'](handleError(_0x1f9828,null));};exports[_0x4407('0x43')]=function(_0xf79768,_0x819b8b){var _0x15ba7b={'raw':!![],'where':{'id':_0xf79768[_0x4407('0x44')]['id']}},_0x5b41cf={};_0x5b41cf[_0x4407('0x2e')]=_[_0x4407('0x31')](db[_0x4407('0x3e')][_0x4407('0x45')]);_0x5b41cf['query']=_[_0x4407('0x31')](_0xf79768['query']);_0x5b41cf['filters']=_[_0x4407('0x46')](_0x5b41cf[_0x4407('0x2e')],_0x5b41cf['query']);_0x15ba7b[_0x4407('0x32')]=_[_0x4407('0x46')](_0x5b41cf[_0x4407('0x2e')],qs[_0x4407('0x33')](_0xf79768['query'][_0x4407('0x33')]));_0x15ba7b[_0x4407('0x32')]=_0x15ba7b[_0x4407('0x32')][_0x4407('0x34')]?_0x15ba7b[_0x4407('0x32')]:_0x5b41cf['model'];if(_0xf79768[_0x4407('0x30')][_0x4407('0x40')]){_0x15ba7b[_0x4407('0x47')]=[{'all':!![]}];}_0x15ba7b=_[_0x4407('0x3a')]({},_0x15ba7b,_0xf79768[_0x4407('0x3d')]);return db['JscriptyAnswerReport'][_0x4407('0x48')](_0x15ba7b)[_0x4407('0x3f')](handleEntityNotFound(_0x819b8b,null))[_0x4407('0x3f')](respondWithResult(_0x819b8b,null))[_0x4407('0x49')](handleError(_0x819b8b,null));};exports['create']=function(_0x18ff16,_0x2b18b8){return db['JscriptyAnswerReport'][_0x4407('0x4a')](_0x18ff16[_0x4407('0x4b')],{})['then'](respondWithResult(_0x2b18b8,0xc9))[_0x4407('0x49')](handleError(_0x2b18b8,null));};exports[_0x4407('0x25')]=function(_0x5ea36,_0x4fbc1f){if(_0x5ea36[_0x4407('0x4b')]['id']){delete _0x5ea36['body']['id'];}return db['JscriptyAnswerReport'][_0x4407('0x48')]({'where':{'id':_0x5ea36[_0x4407('0x44')]['id']}})['then'](handleEntityNotFound(_0x4fbc1f,null))[_0x4407('0x3f')](saveUpdates(_0x5ea36[_0x4407('0x4b')],null))[_0x4407('0x3f')](respondWithResult(_0x4fbc1f,null))[_0x4407('0x49')](handleError(_0x4fbc1f,null));};exports[_0x4407('0x26')]=function(_0x5a2c2b,_0x39865e){return db[_0x4407('0x3e')][_0x4407('0x48')]({'where':{'id':_0x5a2c2b[_0x4407('0x44')]['id']}})[_0x4407('0x3f')](handleEntityNotFound(_0x39865e,null))[_0x4407('0x3f')](removeEntity(_0x39865e,null))[_0x4407('0x49')](handleError(_0x39865e,null));};exports[_0x4407('0x4c')]=function(_0xd1dd66,_0x55f0ef){return db[_0x4407('0x3e')]['describe']()[_0x4407('0x3f')](respondWithResult(_0x55f0ef,null))[_0x4407('0x49')](handleError(_0x55f0ef,null));}; \ No newline at end of file +var _0x5292=['rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','length','attributes','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','findAll','rows','catch','params','fields','options','find','create','body','describe','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','sox','lodash','squel','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','limit','count','Content-Range','reject','save','update','then','destroy','error','stack','name','send','index','JscriptyAnswerReport'];(function(_0x4e676e,_0x2a7c6d){var _0x336a3c=function(_0x4767c4){while(--_0x4767c4){_0x4e676e['push'](_0x4e676e['shift']());}};_0x336a3c(++_0x2a7c6d);}(_0x5292,0xf7));var _0x2529=function(_0x2795dd,_0x157893){_0x2795dd=_0x2795dd-0x0;var _0x30f875=_0x5292[_0x2795dd];return _0x30f875;};'use strict';var emlformat=require(_0x2529('0x0'));var rimraf=require(_0x2529('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2529('0x2'));var rp=require('request-promise');var moment=require(_0x2529('0x3'));var BPromise=require(_0x2529('0x4'));var Mustache=require(_0x2529('0x5'));var util=require(_0x2529('0x6'));var path=require('path');var sox=require(_0x2529('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x2529('0x8'));var squel=require(_0x2529('0x9'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x2529('0xa'));var toCsv=require(_0x2529('0xb'));var querystring=require('querystring');var Papa=require(_0x2529('0xc'));var Redis=require(_0x2529('0xd'));var authService=require(_0x2529('0xe'));var qs=require(_0x2529('0xf'));var as=require(_0x2529('0x10'));var hardwareService=require(_0x2529('0x11'));var logger=require(_0x2529('0x12'))(_0x2529('0x13'));var utils=require('../../config/utils');var config=require(_0x2529('0x14'));var licenseUtil=require(_0x2529('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xe333c9,_0x23bfaf){_0x23bfaf=_0x23bfaf||0xcc;return function(_0x149692){if(_0x149692){return _0xe333c9[_0x2529('0x16')](_0x23bfaf);}return _0xe333c9[_0x2529('0x17')](_0x23bfaf)[_0x2529('0x18')]();};}function respondWithResult(_0x3f3b40,_0x5245cf){_0x5245cf=_0x5245cf||0xc8;return function(_0x101668){if(_0x101668){return _0x3f3b40[_0x2529('0x17')](_0x5245cf)[_0x2529('0x19')](_0x101668);}};}function respondWithFilteredResult(_0x19e4bf,_0x1cc716){return function(_0x2598a1){if(_0x2598a1){var _0x1a1ccc=typeof _0x1cc716[_0x2529('0x1a')]==='undefined'&&typeof _0x1cc716[_0x2529('0x1b')]==='undefined';var _0x337720=_0x2598a1[_0x2529('0x1c')];var _0x89be58=_0x1a1ccc?0x0:_0x1cc716['offset'];var _0x5b4d0d=_0x1a1ccc?_0x2598a1[_0x2529('0x1c')]:_0x1cc716[_0x2529('0x1a')]+_0x1cc716[_0x2529('0x1b')];var _0x37204a;if(_0x5b4d0d>=_0x337720){_0x5b4d0d=_0x337720;_0x37204a=0xc8;}else{_0x37204a=0xce;}_0x19e4bf[_0x2529('0x17')](_0x37204a);return _0x19e4bf['set'](_0x2529('0x1d'),_0x89be58+'-'+_0x5b4d0d+'/'+_0x337720)[_0x2529('0x19')](_0x2598a1);}return null;};}function patchUpdates(_0x1ca15f){return function(_0xeff5a6){try{jsonpatch['apply'](_0xeff5a6,_0x1ca15f,!![]);}catch(_0x1fa873){return BPromise[_0x2529('0x1e')](_0x1fa873);}return _0xeff5a6[_0x2529('0x1f')]();};}function saveUpdates(_0x5b4760,_0x3d5d17){return function(_0x3f57da){if(_0x3f57da){return _0x3f57da[_0x2529('0x20')](_0x5b4760)[_0x2529('0x21')](function(_0x5540e4){return _0x5540e4;});}return null;};}function removeEntity(_0x2736f6,_0x2d0c6d){return function(_0x400a01){if(_0x400a01){return _0x400a01[_0x2529('0x22')]()[_0x2529('0x21')](function(){_0x2736f6[_0x2529('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5539ef,_0x856e50){return function(_0x40f42b){if(!_0x40f42b){_0x5539ef[_0x2529('0x16')](0x194);}return _0x40f42b;};}function handleError(_0x431c40,_0x24418a){_0x24418a=_0x24418a||0x1f4;return function(_0x2a8371){logger[_0x2529('0x23')](_0x2a8371[_0x2529('0x24')]);if(_0x2a8371[_0x2529('0x25')]){delete _0x2a8371[_0x2529('0x25')];}_0x431c40['status'](_0x24418a)[_0x2529('0x26')](_0x2a8371);};}exports[_0x2529('0x27')]=function(_0x4dd0fb,_0x1822ce){var _0x3c46c6={},_0x5bea2d={},_0x17bcbd={'count':0x0,'rows':[]};var _0x1d7e98=_['map'](db[_0x2529('0x28')][_0x2529('0x29')],function(_0x4a18f6){return{'name':_0x4a18f6[_0x2529('0x2a')],'type':_0x4a18f6[_0x2529('0x2b')][_0x2529('0x2c')]};});_0x5bea2d[_0x2529('0x2d')]=_[_0x2529('0x2e')](_0x1d7e98,'name');_0x5bea2d[_0x2529('0x2f')]=_[_0x2529('0x30')](_0x4dd0fb[_0x2529('0x2f')]);_0x5bea2d[_0x2529('0x31')]=_[_0x2529('0x32')](_0x5bea2d[_0x2529('0x2d')],_0x5bea2d[_0x2529('0x2f')]);_0x3c46c6['attributes']=_['intersection'](_0x5bea2d[_0x2529('0x2d')],qs['fields'](_0x4dd0fb[_0x2529('0x2f')]['fields']));_0x3c46c6['attributes']=_0x3c46c6['attributes'][_0x2529('0x33')]?_0x3c46c6[_0x2529('0x34')]:_0x5bea2d[_0x2529('0x2d')];if(!_0x4dd0fb['query'][_0x2529('0x35')]('nolimit')){_0x3c46c6['limit']=qs['limit'](_0x4dd0fb[_0x2529('0x2f')][_0x2529('0x1b')]);_0x3c46c6[_0x2529('0x1a')]=qs[_0x2529('0x1a')](_0x4dd0fb[_0x2529('0x2f')][_0x2529('0x1a')]);}_0x3c46c6[_0x2529('0x36')]=qs[_0x2529('0x37')](_0x4dd0fb[_0x2529('0x2f')][_0x2529('0x37')]);_0x3c46c6[_0x2529('0x38')]=qs[_0x2529('0x31')](_[_0x2529('0x39')](_0x4dd0fb['query'],_0x5bea2d['filters']),_0x1d7e98);if(_0x4dd0fb[_0x2529('0x2f')][_0x2529('0x3a')]){_0x3c46c6['where']=_[_0x2529('0x3b')](_0x3c46c6[_0x2529('0x38')],{'$or':_[_0x2529('0x2e')](_0x1d7e98,function(_0x1b1f81){if(_0x1b1f81[_0x2529('0x2b')]!==_0x2529('0x3c')){var _0x1b8226={};_0x1b8226[_0x1b1f81['name']]={'$like':'%'+_0x4dd0fb[_0x2529('0x2f')][_0x2529('0x3a')]+'%'};return _0x1b8226;}})});}_0x3c46c6=_[_0x2529('0x3b')]({},_0x3c46c6,_0x4dd0fb['options']);var _0x1393b7={'where':_0x3c46c6[_0x2529('0x38')]};return db[_0x2529('0x28')][_0x2529('0x1c')](_0x1393b7)[_0x2529('0x21')](function(_0x33acbf){_0x17bcbd[_0x2529('0x1c')]=_0x33acbf;if(_0x4dd0fb[_0x2529('0x2f')][_0x2529('0x3d')]){_0x3c46c6['include']=[{'all':!![]}];}return db[_0x2529('0x28')][_0x2529('0x3e')](_0x3c46c6);})[_0x2529('0x21')](function(_0x3b4e47){_0x17bcbd[_0x2529('0x3f')]=_0x3b4e47;return _0x17bcbd;})[_0x2529('0x21')](respondWithFilteredResult(_0x1822ce,_0x3c46c6))[_0x2529('0x40')](handleError(_0x1822ce,null));};exports['show']=function(_0x8ced2e,_0x33a13e){var _0x3f76e8={'raw':!![],'where':{'id':_0x8ced2e[_0x2529('0x41')]['id']}},_0x2aaecb={};_0x2aaecb['model']=_[_0x2529('0x30')](db[_0x2529('0x28')][_0x2529('0x29')]);_0x2aaecb[_0x2529('0x2f')]=_[_0x2529('0x30')](_0x8ced2e[_0x2529('0x2f')]);_0x2aaecb['filters']=_['intersection'](_0x2aaecb['model'],_0x2aaecb['query']);_0x3f76e8[_0x2529('0x34')]=_['intersection'](_0x2aaecb[_0x2529('0x2d')],qs[_0x2529('0x42')](_0x8ced2e[_0x2529('0x2f')][_0x2529('0x42')]));_0x3f76e8[_0x2529('0x34')]=_0x3f76e8['attributes'][_0x2529('0x33')]?_0x3f76e8['attributes']:_0x2aaecb[_0x2529('0x2d')];if(_0x8ced2e['query'][_0x2529('0x3d')]){_0x3f76e8['include']=[{'all':!![]}];}_0x3f76e8=_[_0x2529('0x3b')]({},_0x3f76e8,_0x8ced2e[_0x2529('0x43')]);return db['JscriptyAnswerReport'][_0x2529('0x44')](_0x3f76e8)['then'](handleEntityNotFound(_0x33a13e,null))[_0x2529('0x21')](respondWithResult(_0x33a13e,null))[_0x2529('0x40')](handleError(_0x33a13e,null));};exports[_0x2529('0x45')]=function(_0x3c6d79,_0xdc4bef){return db[_0x2529('0x28')][_0x2529('0x45')](_0x3c6d79[_0x2529('0x46')],{})[_0x2529('0x21')](respondWithResult(_0xdc4bef,0xc9))['catch'](handleError(_0xdc4bef,null));};exports['update']=function(_0x5e72d1,_0x37a23a){if(_0x5e72d1[_0x2529('0x46')]['id']){delete _0x5e72d1[_0x2529('0x46')]['id'];}return db['JscriptyAnswerReport']['find']({'where':{'id':_0x5e72d1[_0x2529('0x41')]['id']}})['then'](handleEntityNotFound(_0x37a23a,null))[_0x2529('0x21')](saveUpdates(_0x5e72d1[_0x2529('0x46')],null))[_0x2529('0x21')](respondWithResult(_0x37a23a,null))[_0x2529('0x40')](handleError(_0x37a23a,null));};exports[_0x2529('0x22')]=function(_0x196ee8,_0x4583ba){return db[_0x2529('0x28')]['find']({'where':{'id':_0x196ee8['params']['id']}})[_0x2529('0x21')](handleEntityNotFound(_0x4583ba,null))[_0x2529('0x21')](removeEntity(_0x4583ba,null))[_0x2529('0x40')](handleError(_0x4583ba,null));};exports[_0x2529('0x47')]=function(_0x1f76d3,_0x3ac799){return db[_0x2529('0x28')][_0x2529('0x47')]()[_0x2529('0x21')](respondWithResult(_0x3ac799,null))[_0x2529('0x40')](handleError(_0x3ac799,null));}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js index b96f91d..d9af702 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 _0xff0e=['request-promise','rimraf','../../config/environment','exports','define','lodash','util','../../config/logger','api','bluebird'];(function(_0x50e6d7,_0x64c311){var _0x3df90e=function(_0x379bde){while(--_0x379bde){_0x50e6d7['push'](_0x50e6d7['shift']());}};_0x3df90e(++_0x64c311);}(_0xff0e,0x18b));var _0xeff0=function(_0x1732db,_0x2e22e9){_0x1732db=_0x1732db-0x0;var _0x3698b0=_0xff0e[_0x1732db];return _0x3698b0;};'use strict';var _=require(_0xeff0('0x0'));var util=require(_0xeff0('0x1'));var logger=require(_0xeff0('0x2'))(_0xeff0('0x3'));var moment=require('moment');var BPromise=require(_0xeff0('0x4'));var rp=require(_0xeff0('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xeff0('0x6'));var config=require(_0xeff0('0x7'));var attributes=require('./jscriptyAnswerReport.attributes');module[_0xeff0('0x8')]=function(_0x2ee5cf,_0x4e2587){return _0x2ee5cf[_0xeff0('0x9')]('JscriptyAnswerReport',attributes,{'tableName':'report_jscripty_answers','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe4e7=['define','JscriptyAnswerReport','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./jscriptyAnswerReport.attributes'];(function(_0x4c8c4d,_0x170fc3){var _0x7c72d2=function(_0x249fd1){while(--_0x249fd1){_0x4c8c4d['push'](_0x4c8c4d['shift']());}};_0x7c72d2(++_0x170fc3);}(_0xe4e7,0xc2));var _0x7e4e=function(_0x4aa222,_0x103892){_0x4aa222=_0x4aa222-0x0;var _0x3e9fc0=_0xe4e7[_0x4aa222];return _0x3e9fc0;};'use strict';var _=require(_0x7e4e('0x0'));var util=require(_0x7e4e('0x1'));var logger=require(_0x7e4e('0x2'))('api');var moment=require(_0x7e4e('0x3'));var BPromise=require(_0x7e4e('0x4'));var rp=require(_0x7e4e('0x5'));var fs=require('fs');var path=require(_0x7e4e('0x6'));var rimraf=require(_0x7e4e('0x7'));var config=require(_0x7e4e('0x8'));var attributes=require(_0x7e4e('0x9'));module['exports']=function(_0x322c3d,_0xf85713){return _0x322c3d[_0x7e4e('0xa')](_0x7e4e('0xb'),attributes,{'tableName':'report_jscripty_answers','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.rpc.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.rpc.js index 23569da..3c550a7 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 _0xcd9f=['http','request','info','request\x20sent','error','code','JscriptyAnswerReport,\x20%s,\x20%s','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','client'];(function(_0x4e0ada,_0x38dadd){var _0xcea372=function(_0x19b418){while(--_0x19b418){_0x4e0ada['push'](_0x4e0ada['shift']());}};_0xcea372(++_0x38dadd);}(_0xcd9f,0xa2));var _0xfcd9=function(_0x110494,_0x2e9593){_0x110494=_0x110494-0x0;var _0x63952c=_0xcd9f[_0x110494];return _0x63952c;};'use strict';var _=require(_0xfcd9('0x0'));var util=require('util');var moment=require(_0xfcd9('0x1'));var BPromise=require(_0xfcd9('0x2'));var rs=require(_0xfcd9('0x3'));var fs=require('fs');var Redis=require(_0xfcd9('0x4'));var db=require(_0xfcd9('0x5'))['db'];var utils=require(_0xfcd9('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0xfcd9('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xfcd9('0x8')][_0xfcd9('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x34e7f2,_0x54e134,_0x4d3aae){return new BPromise(function(_0x15e5c3,_0x556615){return client[_0xfcd9('0xa')](_0x34e7f2,_0x4d3aae)['then'](function(_0x38503b){logger[_0xfcd9('0xb')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x54e134,_0xfcd9('0xc'));logger['debug']('JscriptyAnswerReport,\x20%s,\x20%s,\x20%s',_0x54e134,'request\x20sent',JSON['stringify'](_0x38503b));if(_0x38503b['error']){if(_0x38503b[_0xfcd9('0xd')][_0xfcd9('0xe')]===0x1f4){logger[_0xfcd9('0xd')](_0xfcd9('0xf'),_0x54e134,_0x38503b[_0xfcd9('0xd')][_0xfcd9('0x10')]);return _0x556615(_0x38503b[_0xfcd9('0xd')][_0xfcd9('0x10')]);}logger[_0xfcd9('0xd')](_0xfcd9('0xf'),_0x54e134,_0x38503b[_0xfcd9('0xd')][_0xfcd9('0x10')]);return _0x15e5c3(_0x38503b[_0xfcd9('0xd')][_0xfcd9('0x10')]);}else{logger[_0xfcd9('0xb')](_0xfcd9('0xf'),_0x54e134,_0xfcd9('0xc'));_0x15e5c3(_0x38503b[_0xfcd9('0x11')][_0xfcd9('0x10')]);}})[_0xfcd9('0x12')](function(_0x59cf96){logger[_0xfcd9('0xd')](_0xfcd9('0xf'),_0x54e134,_0x59cf96);_0x556615(_0x59cf96);});});} \ No newline at end of file +var _0xb39f=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','info','JscriptyAnswerReport,\x20%s,\x20%s','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','util','moment','bluebird'];(function(_0x7d3a7c,_0x2968e3){var _0x3edd2d=function(_0xebec05){while(--_0xebec05){_0x7d3a7c['push'](_0x7d3a7c['shift']());}};_0x3edd2d(++_0x2968e3);}(_0xb39f,0x1b5));var _0xfb39=function(_0x48dea8,_0x329bda){_0x48dea8=_0x48dea8-0x0;var _0x4bccd9=_0xb39f[_0x48dea8];return _0x4bccd9;};'use strict';var _=require(_0xfb39('0x0'));var util=require(_0xfb39('0x1'));var moment=require(_0xfb39('0x2'));var BPromise=require(_0xfb39('0x3'));var rs=require(_0xfb39('0x4'));var fs=require('fs');var Redis=require(_0xfb39('0x5'));var db=require(_0xfb39('0x6'))['db'];var utils=require(_0xfb39('0x7'));var logger=require(_0xfb39('0x8'))(_0xfb39('0x9'));var config=require('../../config/environment');var jayson=require(_0xfb39('0xa'));var client=jayson[_0xfb39('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4c59b3,_0x45f0ea,_0x314f4b){return new BPromise(function(_0x5a3973,_0x36a1cb){return client['request'](_0x4c59b3,_0x314f4b)['then'](function(_0x3293e8){logger[_0xfb39('0xc')](_0xfb39('0xd'),_0x45f0ea,'request\x20sent');logger['debug'](_0xfb39('0xe'),_0x45f0ea,_0xfb39('0xf'),JSON[_0xfb39('0x10')](_0x3293e8));if(_0x3293e8[_0xfb39('0x11')]){if(_0x3293e8[_0xfb39('0x11')][_0xfb39('0x12')]===0x1f4){logger[_0xfb39('0x11')](_0xfb39('0xd'),_0x45f0ea,_0x3293e8[_0xfb39('0x11')]['message']);return _0x36a1cb(_0x3293e8['error'][_0xfb39('0x13')]);}logger[_0xfb39('0x11')](_0xfb39('0xd'),_0x45f0ea,_0x3293e8['error'][_0xfb39('0x13')]);return _0x5a3973(_0x3293e8[_0xfb39('0x11')][_0xfb39('0x13')]);}else{logger['info'](_0xfb39('0xd'),_0x45f0ea,'request\x20sent');_0x5a3973(_0x3293e8['result'][_0xfb39('0x13')]);}})[_0xfb39('0x14')](function(_0x16d62a){logger[_0xfb39('0x11')](_0xfb39('0xd'),_0x45f0ea,_0x16d62a);_0x36a1cb(_0x16d62a);});});} \ No newline at end of file diff --git a/server/api/jscriptyProject/index.js b/server/api/jscriptyProject/index.js index 7634cc3..130783c 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 _0xcb14=['/:id/answers','getAnswers','30s','getSummary','post','/:id/clone','clone','put','update','delete','destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./jscriptyProject.controller','get','isAuthenticated','index','/:id','show','getSessions'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xcb14,0x10f));var _0x4cb1=function(_0x52b993,_0x13ef76){_0x52b993=_0x52b993-0x0;var _0x1ac4ff=_0xcb14[_0x52b993];return _0x1ac4ff;};'use strict';var multer=require(_0x4cb1('0x0'));var util=require(_0x4cb1('0x1'));var path=require(_0x4cb1('0x2'));var timeout=require(_0x4cb1('0x3'));var express=require(_0x4cb1('0x4'));var router=express[_0x4cb1('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x4cb1('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x4cb1('0x7'));var controller=require(_0x4cb1('0x8'));router[_0x4cb1('0x9')]('/',auth[_0x4cb1('0xa')](),controller[_0x4cb1('0xb')]);router['get'](_0x4cb1('0xc'),auth[_0x4cb1('0xa')](),controller[_0x4cb1('0xd')]);router[_0x4cb1('0x9')]('/:id/sessions',auth[_0x4cb1('0xa')](),controller[_0x4cb1('0xe')]);router['get'](_0x4cb1('0xf'),auth[_0x4cb1('0xa')](),controller[_0x4cb1('0x10')]);router[_0x4cb1('0x9')]('/:id/summary',auth[_0x4cb1('0xa')](),timeout(_0x4cb1('0x11')),controller[_0x4cb1('0x12')]);router[_0x4cb1('0x13')]('/',auth[_0x4cb1('0xa')](),controller['create']);router[_0x4cb1('0x13')](_0x4cb1('0x14'),auth[_0x4cb1('0xa')](),controller[_0x4cb1('0x15')]);router[_0x4cb1('0x16')]('/:id',auth[_0x4cb1('0xa')](),controller[_0x4cb1('0x17')]);router[_0x4cb1('0x18')]('/:id',auth[_0x4cb1('0xa')](),controller[_0x4cb1('0x19')]);module['exports']=router; \ No newline at end of file +var _0x6ccb=['isAuthenticated','show','/:id/sessions','/:id/summary','30s','getSummary','post','create','/:id/clone','clone','put','/:id','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','index','get'];(function(_0x31494e,_0x399c31){var _0x5145d6=function(_0x5acc71){while(--_0x5acc71){_0x31494e['push'](_0x31494e['shift']());}};_0x5145d6(++_0x399c31);}(_0x6ccb,0x1c0));var _0xb6cc=function(_0x41037f,_0x435ff5){_0x41037f=_0x41037f-0x0;var _0x22fa8e=_0x6ccb[_0x41037f];return _0x22fa8e;};'use strict';var multer=require(_0xb6cc('0x0'));var util=require('util');var path=require(_0xb6cc('0x1'));var timeout=require(_0xb6cc('0x2'));var express=require(_0xb6cc('0x3'));var router=express[_0xb6cc('0x4')]();var fs_extra=require(_0xb6cc('0x5'));var auth=require(_0xb6cc('0x6'));var interaction=require(_0xb6cc('0x7'));var config=require(_0xb6cc('0x8'));var controller=require('./jscriptyProject.controller');router['get']('/',auth['isAuthenticated'](),controller[_0xb6cc('0x9')]);router[_0xb6cc('0xa')]('/:id',auth[_0xb6cc('0xb')](),controller[_0xb6cc('0xc')]);router['get'](_0xb6cc('0xd'),auth[_0xb6cc('0xb')](),controller['getSessions']);router[_0xb6cc('0xa')]('/:id/answers',auth[_0xb6cc('0xb')](),controller['getAnswers']);router[_0xb6cc('0xa')](_0xb6cc('0xe'),auth[_0xb6cc('0xb')](),timeout(_0xb6cc('0xf')),controller[_0xb6cc('0x10')]);router[_0xb6cc('0x11')]('/',auth[_0xb6cc('0xb')](),controller[_0xb6cc('0x12')]);router['post'](_0xb6cc('0x13'),auth['isAuthenticated'](),controller[_0xb6cc('0x14')]);router[_0xb6cc('0x15')](_0xb6cc('0x16'),auth[_0xb6cc('0xb')](),controller[_0xb6cc('0x17')]);router[_0xb6cc('0x18')]('/:id',auth['isAuthenticated'](),controller[_0xb6cc('0x19')]);module[_0xb6cc('0x1a')]=router; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.attributes.js b/server/api/jscriptyProject/jscriptyProject.attributes.js index 1656049..743ae38 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 _0xe26c=['getDataValue','description','BOOLEAN','lodash','util','exports','STRING','name','TEXT','long','isObjectLike','setDataValue','stringify','isString','formData','format','{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}'];(function(_0x16d1e3,_0x54cf8b){var _0x3c0592=function(_0x31c7f4){while(--_0x31c7f4){_0x16d1e3['push'](_0x16d1e3['shift']());}};_0x3c0592(++_0x54cf8b);}(_0xe26c,0x146));var _0xce26=function(_0x29b4ff,_0x16b0de){_0x29b4ff=_0x29b4ff-0x0;var _0x2c383f=_0xe26c[_0x29b4ff];return _0x2c383f;};'use strict';var Sequelize=require('sequelize');var _=require(_0xce26('0x0'));var util=require(_0xce26('0x1'));module[_0xce26('0x2')]={'name':{'type':Sequelize[_0xce26('0x3')],'unique':_0xce26('0x4')},'description':{'type':Sequelize[_0xce26('0x3')]},'formData':{'type':Sequelize[_0xce26('0x5')](_0xce26('0x6')),'set':function(_0x2e2509){if(_[_0xce26('0x7')](_0x2e2509)){this[_0xce26('0x8')]('formData',JSON[_0xce26('0x9')](_0x2e2509));}else if(_[_0xce26('0xa')](_0x2e2509)){this[_0xce26('0x8')](_0xce26('0xb'),_0x2e2509);}else{this[_0xce26('0x8')](_0xce26('0xb'),util[_0xce26('0xc')](_0xce26('0xd'),this[_0xce26('0xe')](_0xce26('0x4'))||'',this[_0xce26('0xe')](_0xce26('0xf'))||''));}}},'enableUncompleteSave':{'type':Sequelize[_0xce26('0x10')],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0xce26('0x10')],'defaultValue':![]}}; \ No newline at end of file +var _0x9836=['lodash','util','name','STRING','TEXT','long','isObjectLike','setDataValue','formData','stringify','isString','{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}','getDataValue','description','BOOLEAN','sequelize'];(function(_0x463143,_0x144cf9){var _0x86eb52=function(_0x538e1f){while(--_0x538e1f){_0x463143['push'](_0x463143['shift']());}};_0x86eb52(++_0x144cf9);}(_0x9836,0x1cf));var _0x6983=function(_0x2d2e0d,_0x2bf907){_0x2d2e0d=_0x2d2e0d-0x0;var _0x103367=_0x9836[_0x2d2e0d];return _0x103367;};'use strict';var Sequelize=require(_0x6983('0x0'));var _=require(_0x6983('0x1'));var util=require(_0x6983('0x2'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0x6983('0x3')},'description':{'type':Sequelize[_0x6983('0x4')]},'formData':{'type':Sequelize[_0x6983('0x5')](_0x6983('0x6')),'set':function(_0x4c2faf){if(_[_0x6983('0x7')](_0x4c2faf)){this[_0x6983('0x8')](_0x6983('0x9'),JSON[_0x6983('0xa')](_0x4c2faf));}else if(_[_0x6983('0xb')](_0x4c2faf)){this['setDataValue'](_0x6983('0x9'),_0x4c2faf);}else{this[_0x6983('0x8')](_0x6983('0x9'),util['format'](_0x6983('0xc'),this['getDataValue'](_0x6983('0x3'))||'',this[_0x6983('0xd')](_0x6983('0xe'))||''));}}},'enableUncompleteSave':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0x6983('0xf')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.controller.js b/server/api/jscriptyProject/jscriptyProject.controller.js index 3194aae..a0e774c 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 _0xb240=['/tmp/Jscripty_Project_%d_Summary_%s.csv','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','UserProfileResource','error','stack','name','send','index','map','JscriptyProject','rawAttributes','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','include','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','get','Projects','UserProfileSection','userProfileId','autoAssociation','clone','createdAt','updatedAt','omit','role','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getSessions','findOne','ProjectId','JscriptySessionReport','getAnswers','JscriptyAnswerReport','number','fromCharCode','apply','toString','indexOf','replace','getSummary','starttime','parse','startTime','JscriptyQuestionReport','-createdAt','questionId','question','format','SessionId','answer','push','isEmpty','writeFileSync','Content-disposition','attachment;\x20filename=','Jscripty_Project_%d_Summary_%s.csv','Content-type','text/csv','download'];(function(_0x2427a3,_0x109751){var _0x50b56e=function(_0x5e3cb6){while(--_0x5e3cb6){_0x2427a3['push'](_0x2427a3['shift']());}};_0x50b56e(++_0x109751);}(_0xb240,0x7e));var _0x0b24=function(_0x3bc243,_0x1115b9){_0x3bc243=_0x3bc243-0x0;var _0x396460=_0xb240[_0x3bc243];return _0x396460;};'use strict';var emlformat=require(_0x0b24('0x0'));var rimraf=require(_0x0b24('0x1'));var zipdir=require(_0x0b24('0x2'));var jsonpatch=require(_0x0b24('0x3'));var rp=require(_0x0b24('0x4'));var moment=require(_0x0b24('0x5'));var BPromise=require(_0x0b24('0x6'));var Mustache=require(_0x0b24('0x7'));var util=require(_0x0b24('0x8'));var path=require('path');var sox=require(_0x0b24('0x9'));var csv=require(_0x0b24('0xa'));var ejs=require(_0x0b24('0xb'));var fs=require('fs');var fs_extra=require(_0x0b24('0xc'));var _=require(_0x0b24('0xd'));var squel=require('squel');var crypto=require(_0x0b24('0xe'));var jsforce=require(_0x0b24('0xf'));var deskjs=require(_0x0b24('0x10'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0b24('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x0b24('0x12'));var as=require(_0x0b24('0x13'));var hardwareService=require(_0x0b24('0x14'));var logger=require(_0x0b24('0x15'))(_0x0b24('0x16'));var utils=require(_0x0b24('0x17'));var config=require(_0x0b24('0x18'));var licenseUtil=require(_0x0b24('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x46957d,_0x2381a1){_0x2381a1=_0x2381a1||0xcc;return function(_0x4bb796){if(_0x4bb796){return _0x46957d[_0x0b24('0x1a')](_0x2381a1);}return _0x46957d[_0x0b24('0x1b')](_0x2381a1)[_0x0b24('0x1c')]();};}function respondWithResult(_0x452889,_0x5dc21f){_0x5dc21f=_0x5dc21f||0xc8;return function(_0x4b60fc){if(_0x4b60fc){return _0x452889['status'](_0x5dc21f)['json'](_0x4b60fc);}};}function respondWithFilteredResult(_0x2ea61f,_0x1aae67){return function(_0x459bb1){if(_0x459bb1){var _0x5c2ee7=typeof _0x1aae67[_0x0b24('0x1d')]===_0x0b24('0x1e')&&typeof _0x1aae67[_0x0b24('0x1f')]===_0x0b24('0x1e');var _0xa28e7e=_0x459bb1[_0x0b24('0x20')];var _0x5518a5=_0x5c2ee7?0x0:_0x1aae67[_0x0b24('0x1d')];var _0x1d619f=_0x5c2ee7?_0x459bb1['count']:_0x1aae67[_0x0b24('0x1d')]+_0x1aae67['limit'];var _0x5b395f;if(_0x1d619f>=_0xa28e7e){_0x1d619f=_0xa28e7e;_0x5b395f=0xc8;}else{_0x5b395f=0xce;}_0x2ea61f[_0x0b24('0x1b')](_0x5b395f);return _0x2ea61f[_0x0b24('0x21')](_0x0b24('0x22'),_0x5518a5+'-'+_0x1d619f+'/'+_0xa28e7e)['json'](_0x459bb1);}return null;};}function patchUpdates(_0x2fec2b){return function(_0x3c0260){try{jsonpatch['apply'](_0x3c0260,_0x2fec2b,!![]);}catch(_0x20c5d5){return BPromise[_0x0b24('0x23')](_0x20c5d5);}return _0x3c0260[_0x0b24('0x24')]();};}function saveUpdates(_0x1e1746,_0x46124d){return function(_0x3302e4){if(_0x3302e4){return _0x3302e4[_0x0b24('0x25')](_0x1e1746)[_0x0b24('0x26')](function(_0x454500){return _0x454500;});}return null;};}function removeEntity(_0x59483c,_0x55ae1c){return function(_0x1f88cf){if(_0x1f88cf){return _0x1f88cf[_0x0b24('0x27')]()[_0x0b24('0x26')](function(){var _0xc93a22=_0x1f88cf['get']({'plain':!![]});var _0x294d39='Projects';return db[_0x0b24('0x28')][_0x0b24('0x27')]({'where':{'type':_0x294d39,'resourceId':_0xc93a22['id']}})[_0x0b24('0x26')](function(){return _0x1f88cf;});})[_0x0b24('0x26')](function(){_0x59483c[_0x0b24('0x1b')](0xcc)[_0x0b24('0x1c')]();});}};}function handleEntityNotFound(_0x26fd02,_0x3af4d0){return function(_0x1a40e7){if(!_0x1a40e7){_0x26fd02[_0x0b24('0x1a')](0x194);}return _0x1a40e7;};}function handleError(_0x1d5fd5,_0x9c9873){_0x9c9873=_0x9c9873||0x1f4;return function(_0xd47f05){logger[_0x0b24('0x29')](_0xd47f05[_0x0b24('0x2a')]);if(_0xd47f05[_0x0b24('0x2b')]){delete _0xd47f05[_0x0b24('0x2b')];}_0x1d5fd5[_0x0b24('0x1b')](_0x9c9873)[_0x0b24('0x2c')](_0xd47f05);};}exports[_0x0b24('0x2d')]=function(_0x4a5b53,_0x27c7d9){var _0x5be1ad={},_0x3b4d80={},_0x3b2487={'count':0x0,'rows':[]};var _0x5508da=_[_0x0b24('0x2e')](db[_0x0b24('0x2f')][_0x0b24('0x30')],function(_0x872e26){return{'name':_0x872e26['fieldName'],'type':_0x872e26[_0x0b24('0x31')][_0x0b24('0x32')]};});_0x3b4d80['model']=_[_0x0b24('0x2e')](_0x5508da,_0x0b24('0x2b'));_0x3b4d80[_0x0b24('0x33')]=_[_0x0b24('0x34')](_0x4a5b53[_0x0b24('0x33')]);_0x3b4d80[_0x0b24('0x35')]=_[_0x0b24('0x36')](_0x3b4d80[_0x0b24('0x37')],_0x3b4d80[_0x0b24('0x33')]);_0x5be1ad[_0x0b24('0x38')]=_['intersection'](_0x3b4d80[_0x0b24('0x37')],qs[_0x0b24('0x39')](_0x4a5b53[_0x0b24('0x33')]['fields']));_0x5be1ad[_0x0b24('0x38')]=_0x5be1ad[_0x0b24('0x38')][_0x0b24('0x3a')]?_0x5be1ad[_0x0b24('0x38')]:_0x3b4d80['model'];if(!_0x4a5b53[_0x0b24('0x33')][_0x0b24('0x3b')](_0x0b24('0x3c'))){_0x5be1ad[_0x0b24('0x1f')]=qs[_0x0b24('0x1f')](_0x4a5b53[_0x0b24('0x33')][_0x0b24('0x1f')]);_0x5be1ad[_0x0b24('0x1d')]=qs[_0x0b24('0x1d')](_0x4a5b53[_0x0b24('0x33')][_0x0b24('0x1d')]);}_0x5be1ad[_0x0b24('0x3d')]=qs[_0x0b24('0x3e')](_0x4a5b53[_0x0b24('0x33')][_0x0b24('0x3e')]);_0x5be1ad[_0x0b24('0x3f')]=qs[_0x0b24('0x35')](_[_0x0b24('0x40')](_0x4a5b53[_0x0b24('0x33')],_0x3b4d80[_0x0b24('0x35')]),_0x5508da);if(_0x4a5b53[_0x0b24('0x33')][_0x0b24('0x41')]){_0x5be1ad[_0x0b24('0x3f')]=_[_0x0b24('0x42')](_0x5be1ad['where'],{'$or':_[_0x0b24('0x2e')](_0x5508da,function(_0x1d887a){if(_0x1d887a[_0x0b24('0x31')]!==_0x0b24('0x43')){var _0x383d77={};_0x383d77[_0x1d887a[_0x0b24('0x2b')]]={'$like':'%'+_0x4a5b53[_0x0b24('0x33')][_0x0b24('0x41')]+'%'};return _0x383d77;}})});}_0x5be1ad=_[_0x0b24('0x42')]({},_0x5be1ad,_0x4a5b53[_0x0b24('0x44')]);var _0x53a721={'where':_0x5be1ad[_0x0b24('0x3f')]};return db['JscriptyProject'][_0x0b24('0x20')](_0x53a721)[_0x0b24('0x26')](function(_0x3e3972){_0x3b2487['count']=_0x3e3972;if(_0x4a5b53['query'][_0x0b24('0x45')]){_0x5be1ad['include']=[{'all':!![]}];}return db[_0x0b24('0x2f')][_0x0b24('0x46')](_0x5be1ad);})[_0x0b24('0x26')](function(_0x5153bd){_0x3b2487[_0x0b24('0x47')]=_0x5153bd;return _0x3b2487;})['then'](respondWithFilteredResult(_0x27c7d9,_0x5be1ad))[_0x0b24('0x48')](handleError(_0x27c7d9,null));};exports[_0x0b24('0x49')]=function(_0x5cd950,_0x4bc6f6){var _0x2984d0={'raw':![],'where':{'id':_0x5cd950[_0x0b24('0x4a')]['id']}},_0x4d373f={};_0x4d373f[_0x0b24('0x37')]=_[_0x0b24('0x34')](db[_0x0b24('0x2f')][_0x0b24('0x30')]);_0x4d373f[_0x0b24('0x33')]=_[_0x0b24('0x34')](_0x5cd950['query']);_0x4d373f[_0x0b24('0x35')]=_[_0x0b24('0x36')](_0x4d373f[_0x0b24('0x37')],_0x4d373f['query']);_0x2984d0[_0x0b24('0x38')]=_['intersection'](_0x4d373f[_0x0b24('0x37')],qs[_0x0b24('0x39')](_0x5cd950[_0x0b24('0x33')]['fields']));_0x2984d0['attributes']=_0x2984d0[_0x0b24('0x38')][_0x0b24('0x3a')]?_0x2984d0[_0x0b24('0x38')]:_0x4d373f[_0x0b24('0x37')];if(_0x5cd950['query'][_0x0b24('0x45')]){_0x2984d0[_0x0b24('0x4b')]=[{'all':!![]}];}_0x2984d0=_[_0x0b24('0x42')]({},_0x2984d0,_0x5cd950[_0x0b24('0x44')]);return db[_0x0b24('0x2f')][_0x0b24('0x4c')](_0x2984d0)[_0x0b24('0x26')](handleEntityNotFound(_0x4bc6f6,null))[_0x0b24('0x26')](respondWithResult(_0x4bc6f6,null))[_0x0b24('0x48')](handleError(_0x4bc6f6,null));};exports[_0x0b24('0x4d')]=function(_0x5b1e28,_0xbf9e7f){return db[_0x0b24('0x2f')]['create'](_0x5b1e28[_0x0b24('0x4e')],{})[_0x0b24('0x26')](function(_0x556e00){var _0x4508b9=_0x5b1e28['user']['get']({'plain':!![]});if(!_0x4508b9)throw new Error(_0x0b24('0x4f'));if(_0x4508b9['role']===_0x0b24('0x50')){var _0x3e790b=_0x556e00[_0x0b24('0x51')]({'plain':!![]});var _0x5a9762=_0x0b24('0x52');return db[_0x0b24('0x53')][_0x0b24('0x4c')]({'where':{'name':_0x5a9762,'userProfileId':_0x4508b9[_0x0b24('0x54')]},'raw':!![]})['then'](function(_0x136928){if(_0x136928&&_0x136928[_0x0b24('0x55')]===0x0){return db[_0x0b24('0x28')][_0x0b24('0x4d')]({'name':_0x3e790b[_0x0b24('0x2b')],'resourceId':_0x3e790b['id'],'type':_0x136928[_0x0b24('0x2b')],'sectionId':_0x136928['id']},{})['then'](function(){return _0x556e00;});}else{return _0x556e00;}})[_0x0b24('0x48')](function(_0xcae01c){logger[_0x0b24('0x29')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xcae01c);throw _0xcae01c;});}return _0x556e00;})[_0x0b24('0x26')](respondWithResult(_0xbf9e7f,0xc9))['catch'](handleError(_0xbf9e7f,null));};exports[_0x0b24('0x56')]=function(_0x1142ed,_0x40d5f5){var _0x185ec6={'where':{'id':_0x1142ed['params']['id']}},_0x43ab99={};_0x43ab99['model']=_[_0x0b24('0x34')](db[_0x0b24('0x2f')][_0x0b24('0x30')]);_0x185ec6['attributes']=_[_0x0b24('0x36')](_0x43ab99[_0x0b24('0x37')],qs[_0x0b24('0x39')](_0x1142ed[_0x0b24('0x33')][_0x0b24('0x39')]));_0x185ec6['attributes']=_0x185ec6[_0x0b24('0x38')][_0x0b24('0x3a')]?_0x185ec6[_0x0b24('0x38')]:_0x43ab99['model'];if(_0x1142ed[_0x0b24('0x33')][_0x0b24('0x45')]){_0x185ec6[_0x0b24('0x4b')]=[{'all':!![]}];}_0x185ec6=_[_0x0b24('0x42')]({},_0x185ec6,_0x1142ed[_0x0b24('0x44')]);return db[_0x0b24('0x2f')]['find'](_0x185ec6)[_0x0b24('0x26')](handleEntityNotFound(_0x40d5f5,null))['then'](function(_0x17f3f1){if(_0x17f3f1){var _0x18fabe=_0x17f3f1['get']({'plain':!![]});_0x18fabe=qs['omit'](_0x18fabe,['id',_0x0b24('0x57'),_0x0b24('0x58')]);_0x1142ed['body']=_[_0x0b24('0x59')](_0x1142ed['body'],['id',_0x0b24('0x57'),'updatedAt']);return db[_0x0b24('0x2f')][_0x0b24('0x4d')](_['merge'](_0x18fabe,_0x1142ed[_0x0b24('0x4e')]),{'include':_0x1142ed[_0x0b24('0x33')][_0x0b24('0x45')]?[{'all':!![]}]:undefined})[_0x0b24('0x26')](function(_0x62ec5d){var _0x33e8de=_0x1142ed['user']['get']({'plain':!![]});if(!_0x33e8de)throw new Error(_0x0b24('0x4f'));if(_0x33e8de[_0x0b24('0x5a')]===_0x0b24('0x50')){var _0x4248aa=_0x62ec5d[_0x0b24('0x51')]({'plain':!![]});var _0x1bb687=_0x0b24('0x52');return db['UserProfileSection'][_0x0b24('0x4c')]({'where':{'name':_0x1bb687,'userProfileId':_0x33e8de[_0x0b24('0x54')]},'raw':!![]})[_0x0b24('0x26')](function(_0x2cabb8){if(_0x2cabb8&&_0x2cabb8['autoAssociation']===0x0){return db['UserProfileResource'][_0x0b24('0x4d')]({'name':_0x4248aa[_0x0b24('0x2b')],'resourceId':_0x4248aa['id'],'type':_0x2cabb8[_0x0b24('0x2b')],'sectionId':_0x2cabb8['id']},{})[_0x0b24('0x26')](function(){return _0x62ec5d;});}else{return _0x62ec5d;}})[_0x0b24('0x48')](function(_0x12cf6d){logger[_0x0b24('0x29')](_0x0b24('0x5b'),_0x12cf6d);throw _0x12cf6d;});}return _0x62ec5d;});}})[_0x0b24('0x26')](respondWithResult(_0x40d5f5,0xc9))[_0x0b24('0x48')](handleError(_0x40d5f5,null));};exports[_0x0b24('0x25')]=function(_0x49b9ac,_0x114b12){if(_0x49b9ac[_0x0b24('0x4e')]['id']){delete _0x49b9ac[_0x0b24('0x4e')]['id'];}return db[_0x0b24('0x2f')][_0x0b24('0x4c')]({'where':{'id':_0x49b9ac[_0x0b24('0x4a')]['id']}})[_0x0b24('0x26')](handleEntityNotFound(_0x114b12,null))[_0x0b24('0x26')](saveUpdates(_0x49b9ac['body'],null))[_0x0b24('0x26')](respondWithResult(_0x114b12,null))['catch'](handleError(_0x114b12,null));};exports[_0x0b24('0x27')]=function(_0x5b754c,_0x4c1928){return db[_0x0b24('0x2f')][_0x0b24('0x4c')]({'where':{'id':_0x5b754c['params']['id']}})['then'](handleEntityNotFound(_0x4c1928,null))[_0x0b24('0x26')](removeEntity(_0x4c1928,null))[_0x0b24('0x48')](handleError(_0x4c1928,null));};exports[_0x0b24('0x5c')]=function(_0xcd72db,_0x1dc8f1,_0x4c4fed){var _0x3e8568={'raw':!![],'where':{}};var _0x1b43b7={};var _0x5dd846={'count':0x0,'rows':[]};return db['JscriptyProject'][_0x0b24('0x5d')]({'where':{'id':_0xcd72db['params']['id']}})[_0x0b24('0x26')](handleEntityNotFound(_0x1dc8f1,null))[_0x0b24('0x26')](function(_0x359120){if(_0x359120){_0x1b43b7[_0x0b24('0x37')]=_[_0x0b24('0x34')](db['JscriptySessionReport'][_0x0b24('0x30')]);_0x1b43b7['query']=_['keys'](_0xcd72db[_0x0b24('0x33')]);_0x1b43b7['filters']=_['intersection'](_0x1b43b7[_0x0b24('0x37')],_0x1b43b7[_0x0b24('0x33')]);_0x3e8568[_0x0b24('0x38')]=_['intersection'](_0x1b43b7[_0x0b24('0x37')],qs[_0x0b24('0x39')](_0xcd72db[_0x0b24('0x33')][_0x0b24('0x39')]));_0x3e8568[_0x0b24('0x38')]=_0x3e8568[_0x0b24('0x38')]['length']?_0x3e8568['attributes']:_0x1b43b7[_0x0b24('0x37')];if(!_0xcd72db[_0x0b24('0x33')][_0x0b24('0x3b')](_0x0b24('0x3c'))){_0x3e8568[_0x0b24('0x1f')]=qs[_0x0b24('0x1f')](_0xcd72db[_0x0b24('0x33')][_0x0b24('0x1f')]);_0x3e8568[_0x0b24('0x1d')]=qs[_0x0b24('0x1d')](_0xcd72db[_0x0b24('0x33')][_0x0b24('0x1d')]);}_0x3e8568[_0x0b24('0x3d')]=qs[_0x0b24('0x3e')](_0xcd72db['query'][_0x0b24('0x3e')]);_0x3e8568[_0x0b24('0x3f')]=qs[_0x0b24('0x35')](_[_0x0b24('0x40')](_0xcd72db[_0x0b24('0x33')],_0x1b43b7[_0x0b24('0x35')]));_0x3e8568['where'][_0x0b24('0x5e')]=_0x359120['id'];if(_0xcd72db['query'][_0x0b24('0x41')]){_0x3e8568[_0x0b24('0x3f')]=_[_0x0b24('0x42')](_0x3e8568['where'],{'$or':_['map'](_0x3e8568[_0x0b24('0x38')],function(_0x5a4d99){var _0x11e42a={};_0x11e42a[_0x5a4d99]={'$like':'%'+_0xcd72db[_0x0b24('0x33')]['filter']+'%'};return _0x11e42a;})});}_0x3e8568=_[_0x0b24('0x42')]({},_0x3e8568,_0xcd72db['options']);return db['JscriptySessionReport'][_0x0b24('0x20')]({'where':_0x3e8568[_0x0b24('0x3f')]})[_0x0b24('0x26')](function(_0x2c1ff5){_0x5dd846[_0x0b24('0x20')]=_0x2c1ff5;if(_0xcd72db[_0x0b24('0x33')]['includeAll']){_0x3e8568['include']=[{'all':!![]}];}return db[_0x0b24('0x5f')][_0x0b24('0x46')](_0x3e8568);})['then'](function(_0x28b4fc){_0x5dd846[_0x0b24('0x47')]=_0x28b4fc;return _0x5dd846;});}})[_0x0b24('0x26')](respondWithFilteredResult(_0x1dc8f1,_0x3e8568))['catch'](handleError(_0x1dc8f1,null));};exports[_0x0b24('0x60')]=function(_0x33b85a,_0x5e77ac,_0x3fc8cf){var _0xcc015b={'raw':!![],'where':{}};var _0x21c974={};var _0x30698e={'count':0x0,'rows':[]};return db[_0x0b24('0x2f')][_0x0b24('0x5d')]({'where':{'id':_0x33b85a[_0x0b24('0x4a')]['id']}})[_0x0b24('0x26')](handleEntityNotFound(_0x5e77ac,null))['then'](function(_0xaae528){if(_0xaae528){_0x21c974['model']=_[_0x0b24('0x34')](db[_0x0b24('0x61')]['rawAttributes']);_0x21c974[_0x0b24('0x33')]=_[_0x0b24('0x34')](_0x33b85a['query']);_0x21c974[_0x0b24('0x35')]=_[_0x0b24('0x36')](_0x21c974['model'],_0x21c974['query']);_0xcc015b[_0x0b24('0x38')]=_[_0x0b24('0x36')](_0x21c974[_0x0b24('0x37')],qs[_0x0b24('0x39')](_0x33b85a[_0x0b24('0x33')][_0x0b24('0x39')]));_0xcc015b['attributes']=_0xcc015b[_0x0b24('0x38')]['length']?_0xcc015b['attributes']:_0x21c974[_0x0b24('0x37')];if(!_0x33b85a[_0x0b24('0x33')][_0x0b24('0x3b')](_0x0b24('0x3c'))){_0xcc015b[_0x0b24('0x1f')]=qs[_0x0b24('0x1f')](_0x33b85a[_0x0b24('0x33')][_0x0b24('0x1f')]);_0xcc015b[_0x0b24('0x1d')]=qs[_0x0b24('0x1d')](_0x33b85a['query'][_0x0b24('0x1d')]);}_0xcc015b['order']=qs[_0x0b24('0x3e')](_0x33b85a['query'][_0x0b24('0x3e')]);_0xcc015b[_0x0b24('0x3f')]=qs[_0x0b24('0x35')](_['pick'](_0x33b85a[_0x0b24('0x33')],_0x21c974[_0x0b24('0x35')]));_0xcc015b[_0x0b24('0x3f')][_0x0b24('0x5e')]=_0xaae528['id'];if(_0x33b85a[_0x0b24('0x33')][_0x0b24('0x41')]){_0xcc015b[_0x0b24('0x3f')]=_[_0x0b24('0x42')](_0xcc015b[_0x0b24('0x3f')],{'$or':_[_0x0b24('0x2e')](_0xcc015b[_0x0b24('0x38')],function(_0x1eb14a){var _0x274451={};_0x274451[_0x1eb14a]={'$like':'%'+_0x33b85a[_0x0b24('0x33')][_0x0b24('0x41')]+'%'};return _0x274451;})});}_0xcc015b=_[_0x0b24('0x42')]({},_0xcc015b,_0x33b85a[_0x0b24('0x44')]);return db[_0x0b24('0x61')][_0x0b24('0x20')]({'where':_0xcc015b[_0x0b24('0x3f')]})[_0x0b24('0x26')](function(_0x18317c){_0x30698e[_0x0b24('0x20')]=_0x18317c;if(_0x33b85a[_0x0b24('0x33')][_0x0b24('0x45')]){_0xcc015b[_0x0b24('0x4b')]=[{'all':!![]}];}return db[_0x0b24('0x61')][_0x0b24('0x46')](_0xcc015b);})['then'](function(_0x444c17){_0x30698e[_0x0b24('0x47')]=_0x444c17;return _0x30698e;});}})['then'](respondWithFilteredResult(_0x5e77ac,_0xcc015b))['catch'](handleError(_0x5e77ac,null));};function char(_0x1c2fce){return _0x0b24('0x62')===typeof _0x1c2fce?String[_0x0b24('0x63')][_0x0b24('0x64')](null,arguments):_0x1c2fce;}function needsEncapsulation(_0x5f10eb){return!!_0x5f10eb&&(_0x5f10eb[_0x0b24('0x65')]()[_0x0b24('0x66')](char(0xd))>=0x0||_0x5f10eb[_0x0b24('0x65')]()[_0x0b24('0x66')](char(0xa))>=0x0||_0x5f10eb['toString']()[_0x0b24('0x66')](char(0x2c))>=0x0||_0x5f10eb['toString']()[_0x0b24('0x66')](char(0x22))>=0x0);}function encapsulate(_0x5649ac){var _0x178a20=char(0x22),_0x5b693d='\x5c'+char(0x22),_0x38a32d=_0x5649ac[_0x0b24('0x65')]()[_0x0b24('0x67')](new RegExp(_0x178a20,'g'),_0x5b693d);return _0x178a20+_0x38a32d+_0x178a20;}exports[_0x0b24('0x68')]=function(_0x555171,_0xc29c7d,_0x4abf45){var _0x2b8c24,_0x44074c;var _0x1c1904={'where':{'ProjectId':_0x555171[_0x0b24('0x4a')]['id']}};if(_0x555171[_0x0b24('0x33')]['startTime']){_0x1c1904[_0x0b24('0x3f')][_0x0b24('0x69')]=JSON[_0x0b24('0x6a')](_0x555171[_0x0b24('0x33')][_0x0b24('0x6b')]);}return db[_0x0b24('0x5f')][_0x0b24('0x46')](_0x1c1904)['then'](handleEntityNotFound(_0xc29c7d,null))['then'](function(_0x598a9c){if(_0x598a9c){_0x2b8c24=_0x598a9c;return db[_0x0b24('0x6c')][_0x0b24('0x46')]({'where':{'SessionId':{'$in':_[_0x0b24('0x2e')](_0x2b8c24,'id')},'ProjectId':_0x555171[_0x0b24('0x4a')]['id']},'order':_0x0b24('0x6d')});}})['then'](handleEntityNotFound(_0xc29c7d,null))[_0x0b24('0x26')](function(_0x55ded7){if(_0x55ded7){_0x44074c=_0x55ded7;var _0x566977={};for(var _0x4f5fc8=0x0,_0x2e7c1f=_0x44074c[_0x0b24('0x3a')];_0x4f5fc8<_0x2e7c1f;_0x4f5fc8++){if(!_0x566977['hasOwnProperty'](_0x44074c[_0x4f5fc8]['questionId'])){_0x566977[_0x44074c[_0x4f5fc8][_0x0b24('0x6e')]]=needsEncapsulation(_0x44074c[_0x4f5fc8][_0x0b24('0x6f')])?encapsulate(_0x44074c[_0x4f5fc8][_0x0b24('0x6f')]):_0x44074c[_0x4f5fc8][_0x0b24('0x6f')];}}var _0x254d22=[],_0x482cc6={};for(var _0x53ae0b=0x0,_0x345309=_0x2b8c24[_0x0b24('0x3a')];_0x53ae0b<_0x345309;_0x53ae0b++){_0x482cc6={'ProjectId':_0x555171[_0x0b24('0x4a')]['id'],'SessionId':_0x2b8c24[_0x53ae0b]['id'],'StartTime':moment(_0x2b8c24[_0x53ae0b][_0x0b24('0x69')])[_0x0b24('0x70')]('YYYY-MM-DD\x20HH:mm:ss')};for(var _0x5b0e62=0x0,_0x4a4243=_0x44074c[_0x0b24('0x3a')];_0x5b0e62<_0x4a4243;_0x5b0e62++){if(_0x44074c[_0x5b0e62][_0x0b24('0x71')]==_0x2b8c24[_0x53ae0b]['id']&&_0x566977['hasOwnProperty'](_0x44074c[_0x5b0e62][_0x0b24('0x6e')])){_0x482cc6[_0x566977[_0x44074c[_0x5b0e62][_0x0b24('0x6e')]]]=_0x44074c[_0x5b0e62][_0x0b24('0x72')];}}for(var _0x37ebce in _0x566977){if(!_0x482cc6[_0x0b24('0x3b')](_0x566977[_0x37ebce])){_0x482cc6[_0x566977[_0x37ebce]]=null;}}_0x254d22[_0x0b24('0x73')](_0x482cc6);}return _0x254d22;}})['then'](function(_0x3f5aa7){if(!_[_0x0b24('0x74')](_0x3f5aa7)){var _0x444d50=toCsv(_0x3f5aa7);var _0x40378b=Date['now']();fs[_0x0b24('0x75')](util['format']('/tmp/Jscripty_Project_%d_Summary_%s.csv',_0x555171[_0x0b24('0x4a')]['id'],_0x40378b),_0x444d50);_0xc29c7d['setHeader'](_0x0b24('0x76'),_0x0b24('0x77')+util[_0x0b24('0x70')](_0x0b24('0x78'),_0x555171['params']['id'],_0x40378b));_0xc29c7d['setHeader'](_0x0b24('0x79'),_0x0b24('0x7a'));return _0xc29c7d[_0x0b24('0x7b')](util[_0x0b24('0x70')](_0x0b24('0x7c'),_0x555171['params']['id'],_0x40378b));}else{return _0xc29c7d['sendStatus'](0xcc);}})['catch'](handleError(_0xc29c7d,null));}; \ No newline at end of file +var _0xaec5=['findOne','hasOwnProperty','order','ProjectId','findAll','JscriptyAnswerReport','fromCharCode','apply','toString','indexOf','replace','getSummary','starttime','parse','startTime','JscriptySessionReport','JscriptyQuestionReport','-createdAt','questionId','question','YYYY-MM-DD\x20HH:mm:ss','answer','push','now','writeFileSync','/tmp/Jscripty_Project_%d_Summary_%s.csv','setHeader','attachment;\x20filename=','Jscripty_Project_%d_Summary_%s.csv','text/csv','download','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','lodash','squel','crypto','jsforce','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','save','update','then','destroy','get','Projects','UserProfileResource','name','index','map','JscriptyProject','rawAttributes','fieldName','model','query','keys','filters','intersection','fields','attributes','nolimit','sort','pick','where','merge','type','VIRTUAL','filter','options','includeAll','include','rows','catch','params','length','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','createdAt','omit','updatedAt','autoAssociation','getSessions'];(function(_0x25248b,_0x3c8491){var _0x509939=function(_0x457a27){while(--_0x457a27){_0x25248b['push'](_0x25248b['shift']());}};_0x509939(++_0x3c8491);}(_0xaec5,0x92));var _0x5aec=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xaec5[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x5aec('0x0'));var rimraf=require(_0x5aec('0x1'));var zipdir=require(_0x5aec('0x2'));var jsonpatch=require(_0x5aec('0x3'));var rp=require(_0x5aec('0x4'));var moment=require(_0x5aec('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x5aec('0x6'));var util=require(_0x5aec('0x7'));var path=require(_0x5aec('0x8'));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(_0x5aec('0x9'));var squel=require(_0x5aec('0xa'));var crypto=require(_0x5aec('0xb'));var jsforce=require(_0x5aec('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x5aec('0xd'));var querystring=require(_0x5aec('0xe'));var Papa=require('papaparse');var Redis=require(_0x5aec('0xf'));var authService=require(_0x5aec('0x10'));var qs=require(_0x5aec('0x11'));var as=require(_0x5aec('0x12'));var hardwareService=require(_0x5aec('0x13'));var logger=require(_0x5aec('0x14'))(_0x5aec('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x5aec('0x16'));var db=require(_0x5aec('0x17'))['db'];function respondWithStatusCode(_0x11e7ed,_0xfd051e){_0xfd051e=_0xfd051e||0xcc;return function(_0x300ae8){if(_0x300ae8){return _0x11e7ed[_0x5aec('0x18')](_0xfd051e);}return _0x11e7ed[_0x5aec('0x19')](_0xfd051e)[_0x5aec('0x1a')]();};}function respondWithResult(_0x2ea084,_0x3e9026){_0x3e9026=_0x3e9026||0xc8;return function(_0x229950){if(_0x229950){return _0x2ea084['status'](_0x3e9026)[_0x5aec('0x1b')](_0x229950);}};}function respondWithFilteredResult(_0x4101d7,_0x526340){return function(_0x6e35b7){if(_0x6e35b7){var _0x51cc5b=typeof _0x526340[_0x5aec('0x1c')]===_0x5aec('0x1d')&&typeof _0x526340[_0x5aec('0x1e')]===_0x5aec('0x1d');var _0x589fab=_0x6e35b7[_0x5aec('0x1f')];var _0x2c32bf=_0x51cc5b?0x0:_0x526340[_0x5aec('0x1c')];var _0x4518c9=_0x51cc5b?_0x6e35b7[_0x5aec('0x1f')]:_0x526340['offset']+_0x526340[_0x5aec('0x1e')];var _0x35eacf;if(_0x4518c9>=_0x589fab){_0x4518c9=_0x589fab;_0x35eacf=0xc8;}else{_0x35eacf=0xce;}_0x4101d7['status'](_0x35eacf);return _0x4101d7[_0x5aec('0x20')]('Content-Range',_0x2c32bf+'-'+_0x4518c9+'/'+_0x589fab)[_0x5aec('0x1b')](_0x6e35b7);}return null;};}function patchUpdates(_0x24368b){return function(_0x47785f){try{jsonpatch['apply'](_0x47785f,_0x24368b,!![]);}catch(_0x45810c){return BPromise['reject'](_0x45810c);}return _0x47785f[_0x5aec('0x21')]();};}function saveUpdates(_0x5641f1,_0x1048e5){return function(_0xb95cb3){if(_0xb95cb3){return _0xb95cb3[_0x5aec('0x22')](_0x5641f1)[_0x5aec('0x23')](function(_0x54e71f){return _0x54e71f;});}return null;};}function removeEntity(_0x52a98c,_0x3da833){return function(_0x33269){if(_0x33269){return _0x33269[_0x5aec('0x24')]()['then'](function(){var _0x5aee09=_0x33269[_0x5aec('0x25')]({'plain':!![]});var _0x5c30c0=_0x5aec('0x26');return db[_0x5aec('0x27')][_0x5aec('0x24')]({'where':{'type':_0x5c30c0,'resourceId':_0x5aee09['id']}})['then'](function(){return _0x33269;});})[_0x5aec('0x23')](function(){_0x52a98c[_0x5aec('0x19')](0xcc)[_0x5aec('0x1a')]();});}};}function handleEntityNotFound(_0x804d7,_0xe7e06e){return function(_0x2fea8b){if(!_0x2fea8b){_0x804d7[_0x5aec('0x18')](0x194);}return _0x2fea8b;};}function handleError(_0x4fb6f1,_0x27563c){_0x27563c=_0x27563c||0x1f4;return function(_0x3124c4){logger['error'](_0x3124c4['stack']);if(_0x3124c4[_0x5aec('0x28')]){delete _0x3124c4[_0x5aec('0x28')];}_0x4fb6f1['status'](_0x27563c)['send'](_0x3124c4);};}exports[_0x5aec('0x29')]=function(_0x5da377,_0x5bdc6f){var _0x2c4b3e={},_0x37e76a={},_0x64f7ed={'count':0x0,'rows':[]};var _0xf74789=_[_0x5aec('0x2a')](db[_0x5aec('0x2b')][_0x5aec('0x2c')],function(_0x3a07f3){return{'name':_0x3a07f3[_0x5aec('0x2d')],'type':_0x3a07f3['type']['key']};});_0x37e76a[_0x5aec('0x2e')]=_[_0x5aec('0x2a')](_0xf74789,_0x5aec('0x28'));_0x37e76a[_0x5aec('0x2f')]=_[_0x5aec('0x30')](_0x5da377[_0x5aec('0x2f')]);_0x37e76a[_0x5aec('0x31')]=_['intersection'](_0x37e76a[_0x5aec('0x2e')],_0x37e76a[_0x5aec('0x2f')]);_0x2c4b3e['attributes']=_[_0x5aec('0x32')](_0x37e76a[_0x5aec('0x2e')],qs['fields'](_0x5da377[_0x5aec('0x2f')][_0x5aec('0x33')]));_0x2c4b3e[_0x5aec('0x34')]=_0x2c4b3e[_0x5aec('0x34')]['length']?_0x2c4b3e[_0x5aec('0x34')]:_0x37e76a['model'];if(!_0x5da377[_0x5aec('0x2f')]['hasOwnProperty'](_0x5aec('0x35'))){_0x2c4b3e[_0x5aec('0x1e')]=qs[_0x5aec('0x1e')](_0x5da377[_0x5aec('0x2f')][_0x5aec('0x1e')]);_0x2c4b3e[_0x5aec('0x1c')]=qs[_0x5aec('0x1c')](_0x5da377[_0x5aec('0x2f')][_0x5aec('0x1c')]);}_0x2c4b3e['order']=qs['sort'](_0x5da377[_0x5aec('0x2f')][_0x5aec('0x36')]);_0x2c4b3e['where']=qs[_0x5aec('0x31')](_[_0x5aec('0x37')](_0x5da377[_0x5aec('0x2f')],_0x37e76a[_0x5aec('0x31')]),_0xf74789);if(_0x5da377[_0x5aec('0x2f')]['filter']){_0x2c4b3e[_0x5aec('0x38')]=_[_0x5aec('0x39')](_0x2c4b3e[_0x5aec('0x38')],{'$or':_['map'](_0xf74789,function(_0x598927){if(_0x598927[_0x5aec('0x3a')]!==_0x5aec('0x3b')){var _0x2e0c38={};_0x2e0c38[_0x598927[_0x5aec('0x28')]]={'$like':'%'+_0x5da377['query'][_0x5aec('0x3c')]+'%'};return _0x2e0c38;}})});}_0x2c4b3e=_[_0x5aec('0x39')]({},_0x2c4b3e,_0x5da377[_0x5aec('0x3d')]);var _0x44b7ee={'where':_0x2c4b3e[_0x5aec('0x38')]};return db[_0x5aec('0x2b')]['count'](_0x44b7ee)[_0x5aec('0x23')](function(_0x23d9dc){_0x64f7ed[_0x5aec('0x1f')]=_0x23d9dc;if(_0x5da377[_0x5aec('0x2f')][_0x5aec('0x3e')]){_0x2c4b3e[_0x5aec('0x3f')]=[{'all':!![]}];}return db[_0x5aec('0x2b')]['findAll'](_0x2c4b3e);})[_0x5aec('0x23')](function(_0x4bde73){_0x64f7ed[_0x5aec('0x40')]=_0x4bde73;return _0x64f7ed;})[_0x5aec('0x23')](respondWithFilteredResult(_0x5bdc6f,_0x2c4b3e))[_0x5aec('0x41')](handleError(_0x5bdc6f,null));};exports['show']=function(_0x271afa,_0xffa56e){var _0x4367c0={'raw':![],'where':{'id':_0x271afa[_0x5aec('0x42')]['id']}},_0x4ea488={};_0x4ea488[_0x5aec('0x2e')]=_['keys'](db[_0x5aec('0x2b')][_0x5aec('0x2c')]);_0x4ea488[_0x5aec('0x2f')]=_[_0x5aec('0x30')](_0x271afa[_0x5aec('0x2f')]);_0x4ea488[_0x5aec('0x31')]=_['intersection'](_0x4ea488[_0x5aec('0x2e')],_0x4ea488['query']);_0x4367c0[_0x5aec('0x34')]=_['intersection'](_0x4ea488[_0x5aec('0x2e')],qs[_0x5aec('0x33')](_0x271afa[_0x5aec('0x2f')][_0x5aec('0x33')]));_0x4367c0[_0x5aec('0x34')]=_0x4367c0['attributes'][_0x5aec('0x43')]?_0x4367c0[_0x5aec('0x34')]:_0x4ea488['model'];if(_0x271afa[_0x5aec('0x2f')][_0x5aec('0x3e')]){_0x4367c0[_0x5aec('0x3f')]=[{'all':!![]}];}_0x4367c0=_[_0x5aec('0x39')]({},_0x4367c0,_0x271afa[_0x5aec('0x3d')]);return db[_0x5aec('0x2b')][_0x5aec('0x44')](_0x4367c0)[_0x5aec('0x23')](handleEntityNotFound(_0xffa56e,null))[_0x5aec('0x23')](respondWithResult(_0xffa56e,null))['catch'](handleError(_0xffa56e,null));};exports['create']=function(_0x2f69f2,_0x10269d){return db['JscriptyProject'][_0x5aec('0x45')](_0x2f69f2[_0x5aec('0x46')],{})[_0x5aec('0x23')](function(_0x2bc944){var _0x2b6ebe=_0x2f69f2[_0x5aec('0x47')]['get']({'plain':!![]});if(!_0x2b6ebe)throw new Error(_0x5aec('0x48'));if(_0x2b6ebe[_0x5aec('0x49')]===_0x5aec('0x47')){var _0x2d76ce=_0x2bc944[_0x5aec('0x25')]({'plain':!![]});var _0x3b0c37=_0x5aec('0x26');return db[_0x5aec('0x4a')][_0x5aec('0x44')]({'where':{'name':_0x3b0c37,'userProfileId':_0x2b6ebe[_0x5aec('0x4b')]},'raw':!![]})[_0x5aec('0x23')](function(_0xeb171c){if(_0xeb171c&&_0xeb171c['autoAssociation']===0x0){return db[_0x5aec('0x27')][_0x5aec('0x45')]({'name':_0x2d76ce[_0x5aec('0x28')],'resourceId':_0x2d76ce['id'],'type':_0xeb171c['name'],'sectionId':_0xeb171c['id']},{})['then'](function(){return _0x2bc944;});}else{return _0x2bc944;}})[_0x5aec('0x41')](function(_0x5e4071){logger[_0x5aec('0x4c')](_0x5aec('0x4d'),_0x5e4071);throw _0x5e4071;});}return _0x2bc944;})['then'](respondWithResult(_0x10269d,0xc9))['catch'](handleError(_0x10269d,null));};exports[_0x5aec('0x4e')]=function(_0x1c991f,_0x1c6537){var _0x209ade={'where':{'id':_0x1c991f[_0x5aec('0x42')]['id']}},_0x1abb60={};_0x1abb60[_0x5aec('0x2e')]=_[_0x5aec('0x30')](db['JscriptyProject'][_0x5aec('0x2c')]);_0x209ade[_0x5aec('0x34')]=_[_0x5aec('0x32')](_0x1abb60[_0x5aec('0x2e')],qs[_0x5aec('0x33')](_0x1c991f['query']['fields']));_0x209ade[_0x5aec('0x34')]=_0x209ade[_0x5aec('0x34')]['length']?_0x209ade[_0x5aec('0x34')]:_0x1abb60[_0x5aec('0x2e')];if(_0x1c991f['query'][_0x5aec('0x3e')]){_0x209ade[_0x5aec('0x3f')]=[{'all':!![]}];}_0x209ade=_[_0x5aec('0x39')]({},_0x209ade,_0x1c991f['options']);return db['JscriptyProject']['find'](_0x209ade)['then'](handleEntityNotFound(_0x1c6537,null))['then'](function(_0x49bf52){if(_0x49bf52){var _0x289af0=_0x49bf52[_0x5aec('0x25')]({'plain':!![]});_0x289af0=qs['omit'](_0x289af0,['id',_0x5aec('0x4f'),'updatedAt']);_0x1c991f['body']=_[_0x5aec('0x50')](_0x1c991f[_0x5aec('0x46')],['id','createdAt',_0x5aec('0x51')]);return db[_0x5aec('0x2b')]['create'](_[_0x5aec('0x39')](_0x289af0,_0x1c991f[_0x5aec('0x46')]),{'include':_0x1c991f[_0x5aec('0x2f')][_0x5aec('0x3e')]?[{'all':!![]}]:undefined})[_0x5aec('0x23')](function(_0x3dd518){var _0x15f52c=_0x1c991f[_0x5aec('0x47')][_0x5aec('0x25')]({'plain':!![]});if(!_0x15f52c)throw new Error(_0x5aec('0x48'));if(_0x15f52c[_0x5aec('0x49')]===_0x5aec('0x47')){var _0x2a17c2=_0x3dd518[_0x5aec('0x25')]({'plain':!![]});var _0x1bc74c='Projects';return db[_0x5aec('0x4a')][_0x5aec('0x44')]({'where':{'name':_0x1bc74c,'userProfileId':_0x15f52c[_0x5aec('0x4b')]},'raw':!![]})[_0x5aec('0x23')](function(_0x3f3dbe){if(_0x3f3dbe&&_0x3f3dbe[_0x5aec('0x52')]===0x0){return db[_0x5aec('0x27')][_0x5aec('0x45')]({'name':_0x2a17c2[_0x5aec('0x28')],'resourceId':_0x2a17c2['id'],'type':_0x3f3dbe[_0x5aec('0x28')],'sectionId':_0x3f3dbe['id']},{})[_0x5aec('0x23')](function(){return _0x3dd518;});}else{return _0x3dd518;}})[_0x5aec('0x41')](function(_0x5f4206){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5f4206);throw _0x5f4206;});}return _0x3dd518;});}})['then'](respondWithResult(_0x1c6537,0xc9))[_0x5aec('0x41')](handleError(_0x1c6537,null));};exports[_0x5aec('0x22')]=function(_0x5d0795,_0x328f79){if(_0x5d0795[_0x5aec('0x46')]['id']){delete _0x5d0795[_0x5aec('0x46')]['id'];}return db[_0x5aec('0x2b')]['find']({'where':{'id':_0x5d0795[_0x5aec('0x42')]['id']}})[_0x5aec('0x23')](handleEntityNotFound(_0x328f79,null))['then'](saveUpdates(_0x5d0795[_0x5aec('0x46')],null))[_0x5aec('0x23')](respondWithResult(_0x328f79,null))[_0x5aec('0x41')](handleError(_0x328f79,null));};exports[_0x5aec('0x24')]=function(_0x505dc1,_0x580826){return db[_0x5aec('0x2b')]['find']({'where':{'id':_0x505dc1[_0x5aec('0x42')]['id']}})[_0x5aec('0x23')](handleEntityNotFound(_0x580826,null))[_0x5aec('0x23')](removeEntity(_0x580826,null))[_0x5aec('0x41')](handleError(_0x580826,null));};exports[_0x5aec('0x53')]=function(_0x42b2b7,_0x58fc5d,_0x10e9f0){var _0x1a0c5d={'raw':!![],'where':{}};var _0x2671ba={};var _0x26da0f={'count':0x0,'rows':[]};return db[_0x5aec('0x2b')][_0x5aec('0x54')]({'where':{'id':_0x42b2b7[_0x5aec('0x42')]['id']}})[_0x5aec('0x23')](handleEntityNotFound(_0x58fc5d,null))[_0x5aec('0x23')](function(_0x41795a){if(_0x41795a){_0x2671ba['model']=_[_0x5aec('0x30')](db['JscriptySessionReport'][_0x5aec('0x2c')]);_0x2671ba[_0x5aec('0x2f')]=_[_0x5aec('0x30')](_0x42b2b7['query']);_0x2671ba[_0x5aec('0x31')]=_[_0x5aec('0x32')](_0x2671ba[_0x5aec('0x2e')],_0x2671ba['query']);_0x1a0c5d[_0x5aec('0x34')]=_[_0x5aec('0x32')](_0x2671ba[_0x5aec('0x2e')],qs[_0x5aec('0x33')](_0x42b2b7[_0x5aec('0x2f')][_0x5aec('0x33')]));_0x1a0c5d[_0x5aec('0x34')]=_0x1a0c5d['attributes'][_0x5aec('0x43')]?_0x1a0c5d[_0x5aec('0x34')]:_0x2671ba[_0x5aec('0x2e')];if(!_0x42b2b7[_0x5aec('0x2f')][_0x5aec('0x55')](_0x5aec('0x35'))){_0x1a0c5d[_0x5aec('0x1e')]=qs[_0x5aec('0x1e')](_0x42b2b7[_0x5aec('0x2f')]['limit']);_0x1a0c5d['offset']=qs[_0x5aec('0x1c')](_0x42b2b7[_0x5aec('0x2f')][_0x5aec('0x1c')]);}_0x1a0c5d[_0x5aec('0x56')]=qs[_0x5aec('0x36')](_0x42b2b7[_0x5aec('0x2f')][_0x5aec('0x36')]);_0x1a0c5d[_0x5aec('0x38')]=qs[_0x5aec('0x31')](_[_0x5aec('0x37')](_0x42b2b7['query'],_0x2671ba[_0x5aec('0x31')]));_0x1a0c5d[_0x5aec('0x38')][_0x5aec('0x57')]=_0x41795a['id'];if(_0x42b2b7[_0x5aec('0x2f')][_0x5aec('0x3c')]){_0x1a0c5d[_0x5aec('0x38')]=_[_0x5aec('0x39')](_0x1a0c5d[_0x5aec('0x38')],{'$or':_[_0x5aec('0x2a')](_0x1a0c5d[_0x5aec('0x34')],function(_0x5f5c13){var _0x555730={};_0x555730[_0x5f5c13]={'$like':'%'+_0x42b2b7['query'][_0x5aec('0x3c')]+'%'};return _0x555730;})});}_0x1a0c5d=_[_0x5aec('0x39')]({},_0x1a0c5d,_0x42b2b7['options']);return db['JscriptySessionReport']['count']({'where':_0x1a0c5d[_0x5aec('0x38')]})[_0x5aec('0x23')](function(_0x2b6b20){_0x26da0f[_0x5aec('0x1f')]=_0x2b6b20;if(_0x42b2b7[_0x5aec('0x2f')][_0x5aec('0x3e')]){_0x1a0c5d['include']=[{'all':!![]}];}return db['JscriptySessionReport'][_0x5aec('0x58')](_0x1a0c5d);})[_0x5aec('0x23')](function(_0x920c47){_0x26da0f[_0x5aec('0x40')]=_0x920c47;return _0x26da0f;});}})[_0x5aec('0x23')](respondWithFilteredResult(_0x58fc5d,_0x1a0c5d))['catch'](handleError(_0x58fc5d,null));};exports['getAnswers']=function(_0x470c8c,_0x491a99,_0x413fba){var _0x3443d7={'raw':!![],'where':{}};var _0x3835ca={};var _0x382b52={'count':0x0,'rows':[]};return db[_0x5aec('0x2b')]['findOne']({'where':{'id':_0x470c8c[_0x5aec('0x42')]['id']}})[_0x5aec('0x23')](handleEntityNotFound(_0x491a99,null))[_0x5aec('0x23')](function(_0x2198ed){if(_0x2198ed){_0x3835ca[_0x5aec('0x2e')]=_[_0x5aec('0x30')](db[_0x5aec('0x59')][_0x5aec('0x2c')]);_0x3835ca[_0x5aec('0x2f')]=_[_0x5aec('0x30')](_0x470c8c[_0x5aec('0x2f')]);_0x3835ca[_0x5aec('0x31')]=_[_0x5aec('0x32')](_0x3835ca[_0x5aec('0x2e')],_0x3835ca[_0x5aec('0x2f')]);_0x3443d7[_0x5aec('0x34')]=_[_0x5aec('0x32')](_0x3835ca[_0x5aec('0x2e')],qs['fields'](_0x470c8c[_0x5aec('0x2f')][_0x5aec('0x33')]));_0x3443d7['attributes']=_0x3443d7['attributes']['length']?_0x3443d7[_0x5aec('0x34')]:_0x3835ca['model'];if(!_0x470c8c['query'][_0x5aec('0x55')](_0x5aec('0x35'))){_0x3443d7[_0x5aec('0x1e')]=qs[_0x5aec('0x1e')](_0x470c8c[_0x5aec('0x2f')][_0x5aec('0x1e')]);_0x3443d7[_0x5aec('0x1c')]=qs['offset'](_0x470c8c[_0x5aec('0x2f')][_0x5aec('0x1c')]);}_0x3443d7[_0x5aec('0x56')]=qs[_0x5aec('0x36')](_0x470c8c[_0x5aec('0x2f')][_0x5aec('0x36')]);_0x3443d7[_0x5aec('0x38')]=qs[_0x5aec('0x31')](_['pick'](_0x470c8c[_0x5aec('0x2f')],_0x3835ca[_0x5aec('0x31')]));_0x3443d7[_0x5aec('0x38')][_0x5aec('0x57')]=_0x2198ed['id'];if(_0x470c8c['query'][_0x5aec('0x3c')]){_0x3443d7[_0x5aec('0x38')]=_[_0x5aec('0x39')](_0x3443d7[_0x5aec('0x38')],{'$or':_[_0x5aec('0x2a')](_0x3443d7['attributes'],function(_0x5b47f6){var _0x266563={};_0x266563[_0x5b47f6]={'$like':'%'+_0x470c8c[_0x5aec('0x2f')][_0x5aec('0x3c')]+'%'};return _0x266563;})});}_0x3443d7=_[_0x5aec('0x39')]({},_0x3443d7,_0x470c8c[_0x5aec('0x3d')]);return db[_0x5aec('0x59')][_0x5aec('0x1f')]({'where':_0x3443d7[_0x5aec('0x38')]})[_0x5aec('0x23')](function(_0x5e546d){_0x382b52[_0x5aec('0x1f')]=_0x5e546d;if(_0x470c8c[_0x5aec('0x2f')][_0x5aec('0x3e')]){_0x3443d7['include']=[{'all':!![]}];}return db[_0x5aec('0x59')]['findAll'](_0x3443d7);})[_0x5aec('0x23')](function(_0x452577){_0x382b52[_0x5aec('0x40')]=_0x452577;return _0x382b52;});}})[_0x5aec('0x23')](respondWithFilteredResult(_0x491a99,_0x3443d7))[_0x5aec('0x41')](handleError(_0x491a99,null));};function char(_0x4e722a){return'number'===typeof _0x4e722a?String[_0x5aec('0x5a')][_0x5aec('0x5b')](null,arguments):_0x4e722a;}function needsEncapsulation(_0x420e9f){return!!_0x420e9f&&(_0x420e9f[_0x5aec('0x5c')]()[_0x5aec('0x5d')](char(0xd))>=0x0||_0x420e9f[_0x5aec('0x5c')]()['indexOf'](char(0xa))>=0x0||_0x420e9f[_0x5aec('0x5c')]()[_0x5aec('0x5d')](char(0x2c))>=0x0||_0x420e9f[_0x5aec('0x5c')]()[_0x5aec('0x5d')](char(0x22))>=0x0);}function encapsulate(_0x55463b){var _0xd2b075=char(0x22),_0x502e48='\x5c'+char(0x22),_0x5612ff=_0x55463b[_0x5aec('0x5c')]()[_0x5aec('0x5e')](new RegExp(_0xd2b075,'g'),_0x502e48);return _0xd2b075+_0x5612ff+_0xd2b075;}exports[_0x5aec('0x5f')]=function(_0x413155,_0x41d8f8,_0x356bd0){var _0x342f51,_0x2d28fe;var _0x347f92={'where':{'ProjectId':_0x413155[_0x5aec('0x42')]['id']}};if(_0x413155[_0x5aec('0x2f')]['startTime']){_0x347f92[_0x5aec('0x38')][_0x5aec('0x60')]=JSON[_0x5aec('0x61')](_0x413155[_0x5aec('0x2f')][_0x5aec('0x62')]);}return db[_0x5aec('0x63')][_0x5aec('0x58')](_0x347f92)[_0x5aec('0x23')](handleEntityNotFound(_0x41d8f8,null))[_0x5aec('0x23')](function(_0x4b4722){if(_0x4b4722){_0x342f51=_0x4b4722;return db[_0x5aec('0x64')]['findAll']({'where':{'SessionId':{'$in':_['map'](_0x342f51,'id')},'ProjectId':_0x413155[_0x5aec('0x42')]['id']},'order':_0x5aec('0x65')});}})[_0x5aec('0x23')](handleEntityNotFound(_0x41d8f8,null))[_0x5aec('0x23')](function(_0x1b437b){if(_0x1b437b){_0x2d28fe=_0x1b437b;var _0x10453f={};for(var _0x193ad0=0x0,_0x46952f=_0x2d28fe['length'];_0x193ad0<_0x46952f;_0x193ad0++){if(!_0x10453f[_0x5aec('0x55')](_0x2d28fe[_0x193ad0][_0x5aec('0x66')])){_0x10453f[_0x2d28fe[_0x193ad0][_0x5aec('0x66')]]=needsEncapsulation(_0x2d28fe[_0x193ad0][_0x5aec('0x67')])?encapsulate(_0x2d28fe[_0x193ad0][_0x5aec('0x67')]):_0x2d28fe[_0x193ad0][_0x5aec('0x67')];}}var _0x324acd=[],_0x363de6={};for(var _0xa8638c=0x0,_0x560ddb=_0x342f51['length'];_0xa8638c<_0x560ddb;_0xa8638c++){_0x363de6={'ProjectId':_0x413155['params']['id'],'SessionId':_0x342f51[_0xa8638c]['id'],'StartTime':moment(_0x342f51[_0xa8638c]['starttime'])['format'](_0x5aec('0x68'))};for(var _0x395de4=0x0,_0xe07822=_0x2d28fe[_0x5aec('0x43')];_0x395de4<_0xe07822;_0x395de4++){if(_0x2d28fe[_0x395de4]['SessionId']==_0x342f51[_0xa8638c]['id']&&_0x10453f[_0x5aec('0x55')](_0x2d28fe[_0x395de4][_0x5aec('0x66')])){_0x363de6[_0x10453f[_0x2d28fe[_0x395de4][_0x5aec('0x66')]]]=_0x2d28fe[_0x395de4][_0x5aec('0x69')];}}for(var _0x38bc70 in _0x10453f){if(!_0x363de6[_0x5aec('0x55')](_0x10453f[_0x38bc70])){_0x363de6[_0x10453f[_0x38bc70]]=null;}}_0x324acd[_0x5aec('0x6a')](_0x363de6);}return _0x324acd;}})[_0x5aec('0x23')](function(_0xbc1707){if(!_['isEmpty'](_0xbc1707)){var _0x406065=toCsv(_0xbc1707);var _0x100627=Date[_0x5aec('0x6b')]();fs[_0x5aec('0x6c')](util['format'](_0x5aec('0x6d'),_0x413155['params']['id'],_0x100627),_0x406065);_0x41d8f8[_0x5aec('0x6e')]('Content-disposition',_0x5aec('0x6f')+util['format'](_0x5aec('0x70'),_0x413155[_0x5aec('0x42')]['id'],_0x100627));_0x41d8f8[_0x5aec('0x6e')]('Content-type',_0x5aec('0x71'));return _0x41d8f8[_0x5aec('0x72')](util['format'](_0x5aec('0x6d'),_0x413155[_0x5aec('0x42')]['id'],_0x100627));}else{return _0x41d8f8[_0x5aec('0x18')](0xcc);}})[_0x5aec('0x41')](handleError(_0x41d8f8,null));}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.model.js b/server/api/jscriptyProject/jscriptyProject.model.js index 0d76c1e..d5a531a 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 _0x02a7=['jscripty_projects','util','moment','bluebird','request-promise','path','rimraf','../../config/environment','./jscriptyProject.attributes','define','JscriptyProject'];(function(_0x1477ef,_0x54a5d6){var _0x164acd=function(_0x139149){while(--_0x139149){_0x1477ef['push'](_0x1477ef['shift']());}};_0x164acd(++_0x54a5d6);}(_0x02a7,0x7a));var _0x702a=function(_0x2df5f8,_0x95e563){_0x2df5f8=_0x2df5f8-0x0;var _0x430988=_0x02a7[_0x2df5f8];return _0x430988;};'use strict';var _=require('lodash');var util=require(_0x702a('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x702a('0x1'));var BPromise=require(_0x702a('0x2'));var rp=require(_0x702a('0x3'));var fs=require('fs');var path=require(_0x702a('0x4'));var rimraf=require(_0x702a('0x5'));var config=require(_0x702a('0x6'));var attributes=require(_0x702a('0x7'));module['exports']=function(_0x1bcfe5,_0x5b7d8c){return _0x1bcfe5[_0x702a('0x8')](_0x702a('0x9'),attributes,{'tableName':_0x702a('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x82f5=['api','moment','path','rimraf','../../config/environment','./jscriptyProject.attributes','exports','JscriptyProject','lodash','util','../../config/logger'];(function(_0x548200,_0x3241b8){var _0x1a6d74=function(_0x412f84){while(--_0x412f84){_0x548200['push'](_0x548200['shift']());}};_0x1a6d74(++_0x3241b8);}(_0x82f5,0x15d));var _0x582f=function(_0x2381e5,_0x44e53c){_0x2381e5=_0x2381e5-0x0;var _0x3ca4df=_0x82f5[_0x2381e5];return _0x3ca4df;};'use strict';var _=require(_0x582f('0x0'));var util=require(_0x582f('0x1'));var logger=require(_0x582f('0x2'))(_0x582f('0x3'));var moment=require(_0x582f('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x582f('0x5'));var rimraf=require(_0x582f('0x6'));var config=require(_0x582f('0x7'));var attributes=require(_0x582f('0x8'));module[_0x582f('0x9')]=function(_0x15d332,_0x459755){return _0x15d332['define'](_0x582f('0xa'),attributes,{'tableName':'jscripty_projects','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 13801e9..7f23f96 100644 --- a/server/api/jscriptyProject/jscriptyProject.rpc.js +++ b/server/api/jscriptyProject/jscriptyProject.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x70e0=['code','JscriptyProject,\x20%s,\x20%s','message','result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','request','then','info','debug','JscriptyProject,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x16c60f,_0x518ed4){var _0xdb92f5=function(_0x59bc47){while(--_0x59bc47){_0x16c60f['push'](_0x16c60f['shift']());}};_0xdb92f5(++_0x518ed4);}(_0x70e0,0x17b));var _0x070e=function(_0xd7febc,_0x47c598){_0xd7febc=_0xd7febc-0x0;var _0x4e7d8e=_0x70e0[_0xd7febc];return _0x4e7d8e;};'use strict';var _=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var moment=require(_0x070e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x070e('0x3'));var db=require(_0x070e('0x4'))['db'];var utils=require(_0x070e('0x5'));var logger=require(_0x070e('0x6'))('rpc');var config=require(_0x070e('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x070e('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x56e420,_0x5032e5,_0x35ab0c){return new BPromise(function(_0x1e11f0,_0x604664){return client[_0x070e('0x9')](_0x56e420,_0x35ab0c)[_0x070e('0xa')](function(_0x68a09e){logger[_0x070e('0xb')]('JscriptyProject,\x20%s,\x20%s',_0x5032e5,'request\x20sent');logger[_0x070e('0xc')](_0x070e('0xd'),_0x5032e5,_0x070e('0xe'),JSON[_0x070e('0xf')](_0x68a09e));if(_0x68a09e[_0x070e('0x10')]){if(_0x68a09e[_0x070e('0x10')][_0x070e('0x11')]===0x1f4){logger[_0x070e('0x10')](_0x070e('0x12'),_0x5032e5,_0x68a09e[_0x070e('0x10')][_0x070e('0x13')]);return _0x604664(_0x68a09e['error']['message']);}logger[_0x070e('0x10')]('JscriptyProject,\x20%s,\x20%s',_0x5032e5,_0x68a09e['error']['message']);return _0x1e11f0(_0x68a09e[_0x070e('0x10')][_0x070e('0x13')]);}else{logger['info']('JscriptyProject,\x20%s,\x20%s',_0x5032e5,_0x070e('0xe'));_0x1e11f0(_0x68a09e[_0x070e('0x14')][_0x070e('0x13')]);}})[_0x070e('0x15')](function(_0x5bc71e){logger['error'](_0x070e('0x12'),_0x5032e5,_0x5bc71e);_0x604664(_0x5bc71e);});});} \ No newline at end of file +var _0x0713=['JscriptyProject,\x20%s,\x20%s','request\x20sent','debug','JscriptyProject,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x45d640,_0x5e5d37){var _0x1a15f8=function(_0x46fd3f){while(--_0x46fd3f){_0x45d640['push'](_0x45d640['shift']());}};_0x1a15f8(++_0x5e5d37);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x3071('0x0'));var BPromise=require(_0x3071('0x1'));var rs=require(_0x3071('0x2'));var fs=require('fs');var Redis=require(_0x3071('0x3'));var db=require(_0x3071('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x3071('0x5'))(_0x3071('0x6'));var config=require(_0x3071('0x7'));var jayson=require(_0x3071('0x8'));var client=jayson[_0x3071('0x9')][_0x3071('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1d3dd6,_0x2f1e87,_0xbd737f){return new BPromise(function(_0x22274c,_0x3e9a5e){return client[_0x3071('0xb')](_0x1d3dd6,_0xbd737f)[_0x3071('0xc')](function(_0x4a36ec){logger[_0x3071('0xd')](_0x3071('0xe'),_0x2f1e87,_0x3071('0xf'));logger[_0x3071('0x10')](_0x3071('0x11'),_0x2f1e87,'request\x20sent',JSON[_0x3071('0x12')](_0x4a36ec));if(_0x4a36ec[_0x3071('0x13')]){if(_0x4a36ec[_0x3071('0x13')][_0x3071('0x14')]===0x1f4){logger[_0x3071('0x13')]('JscriptyProject,\x20%s,\x20%s',_0x2f1e87,_0x4a36ec['error'][_0x3071('0x15')]);return _0x3e9a5e(_0x4a36ec['error'][_0x3071('0x15')]);}logger[_0x3071('0x13')]('JscriptyProject,\x20%s,\x20%s',_0x2f1e87,_0x4a36ec[_0x3071('0x13')]['message']);return _0x22274c(_0x4a36ec[_0x3071('0x13')][_0x3071('0x15')]);}else{logger[_0x3071('0xd')](_0x3071('0xe'),_0x2f1e87,_0x3071('0xf'));_0x22274c(_0x4a36ec[_0x3071('0x16')][_0x3071('0x15')]);}})[_0x3071('0x17')](function(_0x21aad3){logger[_0x3071('0x13')]('JscriptyProject,\x20%s,\x20%s',_0x2f1e87,_0x21aad3);_0x3e9a5e(_0x21aad3);});});} \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/index.js b/server/api/jscriptyQuestionReport/index.js index b206691..6923966 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 _0xbfff=['isAuthenticated','index','/describe','describe','/:id','create','put','update','delete','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./jscriptyQuestionReport.controller','get'];(function(_0xc51a9f,_0x32f733){var _0x52f703=function(_0x1fe12d){while(--_0x1fe12d){_0xc51a9f['push'](_0xc51a9f['shift']());}};_0x52f703(++_0x32f733);}(_0xbfff,0x1b9));var _0xfbff=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xbfff[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xfbff('0x0'));var util=require('util');var path=require(_0xfbff('0x1'));var timeout=require(_0xfbff('0x2'));var express=require(_0xfbff('0x3'));var router=express['Router']();var fs_extra=require(_0xfbff('0x4'));var auth=require(_0xfbff('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xfbff('0x6'));var controller=require(_0xfbff('0x7'));router[_0xfbff('0x8')]('/',auth[_0xfbff('0x9')](),controller[_0xfbff('0xa')]);router[_0xfbff('0x8')](_0xfbff('0xb'),auth['isAuthenticated'](),controller[_0xfbff('0xc')]);router[_0xfbff('0x8')](_0xfbff('0xd'),auth[_0xfbff('0x9')](),controller['show']);router['post']('/',auth[_0xfbff('0x9')](),controller[_0xfbff('0xe')]);router[_0xfbff('0xf')](_0xfbff('0xd'),auth['isAuthenticated'](),controller[_0xfbff('0x10')]);router[_0xfbff('0x11')]('/:id',auth[_0xfbff('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x5ca4=['fs-extra','../../components/interaction/service','../../config/environment','get','index','/describe','isAuthenticated','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0x43a615,_0x20760f){var _0x5e8822=function(_0x3d5596){while(--_0x3d5596){_0x43a615['push'](_0x43a615['shift']());}};_0x5e8822(++_0x20760f);}(_0x5ca4,0x175));var _0x45ca=function(_0x11067f,_0x377fe9){_0x11067f=_0x11067f-0x0;var _0x805eb1=_0x5ca4[_0x11067f];return _0x805eb1;};'use strict';var multer=require(_0x45ca('0x0'));var util=require(_0x45ca('0x1'));var path=require(_0x45ca('0x2'));var timeout=require(_0x45ca('0x3'));var express=require(_0x45ca('0x4'));var router=express['Router']();var fs_extra=require(_0x45ca('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x45ca('0x6'));var config=require(_0x45ca('0x7'));var controller=require('./jscriptyQuestionReport.controller');router[_0x45ca('0x8')]('/',auth['isAuthenticated'](),controller[_0x45ca('0x9')]);router[_0x45ca('0x8')](_0x45ca('0xa'),auth[_0x45ca('0xb')](),controller['describe']);router[_0x45ca('0x8')](_0x45ca('0xc'),auth[_0x45ca('0xb')](),controller[_0x45ca('0xd')]);router[_0x45ca('0xe')]('/',auth[_0x45ca('0xb')](),controller[_0x45ca('0xf')]);router[_0x45ca('0x10')](_0x45ca('0xc'),auth['isAuthenticated'](),controller[_0x45ca('0x11')]);router[_0x45ca('0x12')](_0x45ca('0xc'),auth[_0x45ca('0xb')](),controller[_0x45ca('0x13')]);module[_0x45ca('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 f1accd3..8952c61 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(_0x88cd7b,_0x4c884c){var _0x56fcc8=function(_0x513b3d){while(--_0x513b3d){_0x88cd7b['push'](_0x88cd7b['shift']());}};_0x56fcc8(++_0x4c884c);}(_0x7a54,0x106));var _0x47a5=function(_0x4596c5,_0x11bafb){_0x4596c5=_0x4596c5-0x0;var _0x3bc0db=_0x7a54[_0x4596c5];return _0x3bc0db;};'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(_0x88cd7b,_0x4c884c){var _0x56fcc8=function(_0x513b3d){while(--_0x513b3d){_0x88cd7b['push'](_0x88cd7b['shift']());}};_0x56fcc8(++_0x4c884c);}(_0x7a54,0x106));var _0x47a5=function(_0x3eccff,_0xb28ddd){_0x3eccff=_0x3eccff-0x0;var _0x1e02fe=_0x7a54[_0x3eccff];return _0x1e02fe;};'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 b545532..1ac2f1c 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 _0xbd1d=['../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','offset','limit','undefined','count','set','Content-Range','json','apply','save','update','then','name','map','JscriptyQuestionReport','rawAttributes','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','type','VIRTUAL','options','includeAll','include','findAll','rows','show','params','find','catch','create','body','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service'];(function(_0x2d8fc2,_0x1c461d){var _0x3a9e53=function(_0x18941c){while(--_0x18941c){_0x2d8fc2['push'](_0x2d8fc2['shift']());}};_0x3a9e53(++_0x1c461d);}(_0xbd1d,0x7c));var _0xdbd1=function(_0xfd794c,_0x542ed3){_0xfd794c=_0xfd794c-0x0;var _0x27a4a5=_0xbd1d[_0xfd794c];return _0x27a4a5;};'use strict';var emlformat=require(_0xdbd1('0x0'));var rimraf=require(_0xdbd1('0x1'));var zipdir=require(_0xdbd1('0x2'));var jsonpatch=require(_0xdbd1('0x3'));var rp=require(_0xdbd1('0x4'));var moment=require(_0xdbd1('0x5'));var BPromise=require(_0xdbd1('0x6'));var Mustache=require('mustache');var util=require(_0xdbd1('0x7'));var path=require(_0xdbd1('0x8'));var sox=require(_0xdbd1('0x9'));var csv=require(_0xdbd1('0xa'));var ejs=require(_0xdbd1('0xb'));var fs=require('fs');var fs_extra=require(_0xdbd1('0xc'));var _=require(_0xdbd1('0xd'));var squel=require(_0xdbd1('0xe'));var crypto=require(_0xdbd1('0xf'));var jsforce=require('jsforce');var deskjs=require(_0xdbd1('0x10'));var toCsv=require(_0xdbd1('0xa'));var querystring=require(_0xdbd1('0x11'));var Papa=require('papaparse');var Redis=require(_0xdbd1('0x12'));var authService=require(_0xdbd1('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xdbd1('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xdbd1('0x15'))(_0xdbd1('0x16'));var utils=require(_0xdbd1('0x17'));var config=require(_0xdbd1('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xdbd1('0x19'))['db'];function respondWithStatusCode(_0x372504,_0xd3ab1e){_0xd3ab1e=_0xd3ab1e||0xcc;return function(_0x12458f){if(_0x12458f){return _0x372504['sendStatus'](_0xd3ab1e);}return _0x372504[_0xdbd1('0x1a')](_0xd3ab1e)[_0xdbd1('0x1b')]();};}function respondWithResult(_0x17a5e6,_0x4a3240){_0x4a3240=_0x4a3240||0xc8;return function(_0x3cc948){if(_0x3cc948){return _0x17a5e6[_0xdbd1('0x1a')](_0x4a3240)['json'](_0x3cc948);}};}function respondWithFilteredResult(_0x3e7775,_0x4023e0){return function(_0x331e8c){if(_0x331e8c){var _0x31c824=typeof _0x4023e0[_0xdbd1('0x1c')]==='undefined'&&typeof _0x4023e0[_0xdbd1('0x1d')]===_0xdbd1('0x1e');var _0x1a9df1=_0x331e8c[_0xdbd1('0x1f')];var _0x4f2ce8=_0x31c824?0x0:_0x4023e0[_0xdbd1('0x1c')];var _0x2bb1f5=_0x31c824?_0x331e8c[_0xdbd1('0x1f')]:_0x4023e0[_0xdbd1('0x1c')]+_0x4023e0['limit'];var _0x145373;if(_0x2bb1f5>=_0x1a9df1){_0x2bb1f5=_0x1a9df1;_0x145373=0xc8;}else{_0x145373=0xce;}_0x3e7775['status'](_0x145373);return _0x3e7775[_0xdbd1('0x20')](_0xdbd1('0x21'),_0x4f2ce8+'-'+_0x2bb1f5+'/'+_0x1a9df1)[_0xdbd1('0x22')](_0x331e8c);}return null;};}function patchUpdates(_0x69eda9){return function(_0x4d1505){try{jsonpatch[_0xdbd1('0x23')](_0x4d1505,_0x69eda9,!![]);}catch(_0xd31b62){return BPromise['reject'](_0xd31b62);}return _0x4d1505[_0xdbd1('0x24')]();};}function saveUpdates(_0x1bef8b,_0x3e5d78){return function(_0x4d2e16){if(_0x4d2e16){return _0x4d2e16[_0xdbd1('0x25')](_0x1bef8b)[_0xdbd1('0x26')](function(_0x296300){return _0x296300;});}return null;};}function removeEntity(_0x51d32f,_0x44fa9f){return function(_0x2cad21){if(_0x2cad21){return _0x2cad21['destroy']()[_0xdbd1('0x26')](function(){_0x51d32f[_0xdbd1('0x1a')](0xcc)[_0xdbd1('0x1b')]();});}};}function handleEntityNotFound(_0x3c54a3,_0x4214c3){return function(_0xf36820){if(!_0xf36820){_0x3c54a3['sendStatus'](0x194);}return _0xf36820;};}function handleError(_0x5923d3,_0x299f10){_0x299f10=_0x299f10||0x1f4;return function(_0x217c23){logger['error'](_0x217c23['stack']);if(_0x217c23[_0xdbd1('0x27')]){delete _0x217c23[_0xdbd1('0x27')];}_0x5923d3[_0xdbd1('0x1a')](_0x299f10)['send'](_0x217c23);};}exports['index']=function(_0x39d261,_0xa8b65d){var _0x53448d={},_0x312f96={},_0x17a217={'count':0x0,'rows':[]};var _0x4a071e=_[_0xdbd1('0x28')](db[_0xdbd1('0x29')][_0xdbd1('0x2a')],function(_0x1e77eb){return{'name':_0x1e77eb['fieldName'],'type':_0x1e77eb['type']['key']};});_0x312f96[_0xdbd1('0x2b')]=_[_0xdbd1('0x28')](_0x4a071e,_0xdbd1('0x27'));_0x312f96[_0xdbd1('0x2c')]=_[_0xdbd1('0x2d')](_0x39d261[_0xdbd1('0x2c')]);_0x312f96[_0xdbd1('0x2e')]=_[_0xdbd1('0x2f')](_0x312f96[_0xdbd1('0x2b')],_0x312f96[_0xdbd1('0x2c')]);_0x53448d[_0xdbd1('0x30')]=_[_0xdbd1('0x2f')](_0x312f96[_0xdbd1('0x2b')],qs[_0xdbd1('0x31')](_0x39d261[_0xdbd1('0x2c')][_0xdbd1('0x31')]));_0x53448d[_0xdbd1('0x30')]=_0x53448d[_0xdbd1('0x30')][_0xdbd1('0x32')]?_0x53448d[_0xdbd1('0x30')]:_0x312f96[_0xdbd1('0x2b')];if(!_0x39d261[_0xdbd1('0x2c')][_0xdbd1('0x33')](_0xdbd1('0x34'))){_0x53448d[_0xdbd1('0x1d')]=qs[_0xdbd1('0x1d')](_0x39d261['query'][_0xdbd1('0x1d')]);_0x53448d[_0xdbd1('0x1c')]=qs['offset'](_0x39d261[_0xdbd1('0x2c')][_0xdbd1('0x1c')]);}_0x53448d[_0xdbd1('0x35')]=qs[_0xdbd1('0x36')](_0x39d261['query']['sort']);_0x53448d[_0xdbd1('0x37')]=qs[_0xdbd1('0x2e')](_['pick'](_0x39d261[_0xdbd1('0x2c')],_0x312f96['filters']),_0x4a071e);if(_0x39d261[_0xdbd1('0x2c')][_0xdbd1('0x38')]){_0x53448d[_0xdbd1('0x37')]=_['merge'](_0x53448d[_0xdbd1('0x37')],{'$or':_[_0xdbd1('0x28')](_0x4a071e,function(_0x4b38c7){if(_0x4b38c7[_0xdbd1('0x39')]!==_0xdbd1('0x3a')){var _0x185306={};_0x185306[_0x4b38c7['name']]={'$like':'%'+_0x39d261[_0xdbd1('0x2c')][_0xdbd1('0x38')]+'%'};return _0x185306;}})});}_0x53448d=_['merge']({},_0x53448d,_0x39d261[_0xdbd1('0x3b')]);var _0x21fcca={'where':_0x53448d[_0xdbd1('0x37')]};return db[_0xdbd1('0x29')]['count'](_0x21fcca)['then'](function(_0x410a33){_0x17a217['count']=_0x410a33;if(_0x39d261[_0xdbd1('0x2c')][_0xdbd1('0x3c')]){_0x53448d[_0xdbd1('0x3d')]=[{'all':!![]}];}return db[_0xdbd1('0x29')][_0xdbd1('0x3e')](_0x53448d);})['then'](function(_0x532ee1){_0x17a217[_0xdbd1('0x3f')]=_0x532ee1;return _0x17a217;})[_0xdbd1('0x26')](respondWithFilteredResult(_0xa8b65d,_0x53448d))['catch'](handleError(_0xa8b65d,null));};exports[_0xdbd1('0x40')]=function(_0x29496a,_0x5f3526){var _0x1412dd={'raw':!![],'where':{'id':_0x29496a[_0xdbd1('0x41')]['id']}},_0x297ba8={};_0x297ba8['model']=_[_0xdbd1('0x2d')](db['JscriptyQuestionReport'][_0xdbd1('0x2a')]);_0x297ba8['query']=_['keys'](_0x29496a[_0xdbd1('0x2c')]);_0x297ba8['filters']=_[_0xdbd1('0x2f')](_0x297ba8['model'],_0x297ba8['query']);_0x1412dd[_0xdbd1('0x30')]=_[_0xdbd1('0x2f')](_0x297ba8[_0xdbd1('0x2b')],qs[_0xdbd1('0x31')](_0x29496a['query'][_0xdbd1('0x31')]));_0x1412dd[_0xdbd1('0x30')]=_0x1412dd[_0xdbd1('0x30')][_0xdbd1('0x32')]?_0x1412dd[_0xdbd1('0x30')]:_0x297ba8['model'];if(_0x29496a['query'][_0xdbd1('0x3c')]){_0x1412dd[_0xdbd1('0x3d')]=[{'all':!![]}];}_0x1412dd=_['merge']({},_0x1412dd,_0x29496a[_0xdbd1('0x3b')]);return db[_0xdbd1('0x29')][_0xdbd1('0x42')](_0x1412dd)[_0xdbd1('0x26')](handleEntityNotFound(_0x5f3526,null))[_0xdbd1('0x26')](respondWithResult(_0x5f3526,null))[_0xdbd1('0x43')](handleError(_0x5f3526,null));};exports[_0xdbd1('0x44')]=function(_0x20fa88,_0x461c3a){return db[_0xdbd1('0x29')][_0xdbd1('0x44')](_0x20fa88[_0xdbd1('0x45')],{})['then'](respondWithResult(_0x461c3a,0xc9))[_0xdbd1('0x43')](handleError(_0x461c3a,null));};exports[_0xdbd1('0x25')]=function(_0x3042f1,_0x402d22){if(_0x3042f1[_0xdbd1('0x45')]['id']){delete _0x3042f1[_0xdbd1('0x45')]['id'];}return db[_0xdbd1('0x29')][_0xdbd1('0x42')]({'where':{'id':_0x3042f1['params']['id']}})['then'](handleEntityNotFound(_0x402d22,null))[_0xdbd1('0x26')](saveUpdates(_0x3042f1[_0xdbd1('0x45')],null))['then'](respondWithResult(_0x402d22,null))['catch'](handleError(_0x402d22,null));};exports[_0xdbd1('0x46')]=function(_0x5a5bd6,_0x5b418f){return db[_0xdbd1('0x29')][_0xdbd1('0x42')]({'where':{'id':_0x5a5bd6[_0xdbd1('0x41')]['id']}})['then'](handleEntityNotFound(_0x5b418f,null))[_0xdbd1('0x26')](removeEntity(_0x5b418f,null))['catch'](handleError(_0x5b418f,null));};exports[_0xdbd1('0x47')]=function(_0x339227,_0x4ff4a9){return db[_0xdbd1('0x29')][_0xdbd1('0x47')]()[_0xdbd1('0x26')](respondWithResult(_0x4ff4a9,null))[_0xdbd1('0x43')](handleError(_0x4ff4a9,null));}; \ No newline at end of file +var _0xaf74=['nolimit','order','sort','where','filter','options','includeAll','include','findAll','show','params','keys','merge','find','catch','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','path','ejs','lodash','squel','desk.js','to-csv','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','offset','undefined','limit','count','set','json','apply','reject','update','then','destroy','error','stack','name','send','index','map','JscriptyQuestionReport','rawAttributes','type','model','filters','intersection','attributes','fields','query','length','hasOwnProperty'];(function(_0xc8fedf,_0x252f3a){var _0x269088=function(_0x599564){while(--_0x599564){_0xc8fedf['push'](_0xc8fedf['shift']());}};_0x269088(++_0x252f3a);}(_0xaf74,0x166));var _0x4af7=function(_0x42d2ad,_0x2b85d1){_0x42d2ad=_0x42d2ad-0x0;var _0x33d2ba=_0xaf74[_0x42d2ad];return _0x33d2ba;};'use strict';var emlformat=require(_0x4af7('0x0'));var rimraf=require(_0x4af7('0x1'));var zipdir=require(_0x4af7('0x2'));var jsonpatch=require(_0x4af7('0x3'));var rp=require(_0x4af7('0x4'));var moment=require(_0x4af7('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x4af7('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x4af7('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4af7('0x8'));var squel=require(_0x4af7('0x9'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x4af7('0xa'));var toCsv=require(_0x4af7('0xb'));var querystring=require(_0x4af7('0xc'));var Papa=require('papaparse');var Redis=require(_0x4af7('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x4af7('0xe'));var as=require(_0x4af7('0xf'));var hardwareService=require(_0x4af7('0x10'));var logger=require('../../config/logger')('api');var utils=require(_0x4af7('0x11'));var config=require(_0x4af7('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0x4af7('0x13'))['db'];function respondWithStatusCode(_0xe6c464,_0x420f58){_0x420f58=_0x420f58||0xcc;return function(_0x5222ab){if(_0x5222ab){return _0xe6c464[_0x4af7('0x14')](_0x420f58);}return _0xe6c464[_0x4af7('0x15')](_0x420f58)['end']();};}function respondWithResult(_0x468fc0,_0x455178){_0x455178=_0x455178||0xc8;return function(_0x37f1c6){if(_0x37f1c6){return _0x468fc0['status'](_0x455178)['json'](_0x37f1c6);}};}function respondWithFilteredResult(_0x18305d,_0x31e9f9){return function(_0x262049){if(_0x262049){var _0x68f1f3=typeof _0x31e9f9[_0x4af7('0x16')]===_0x4af7('0x17')&&typeof _0x31e9f9[_0x4af7('0x18')]===_0x4af7('0x17');var _0x3fbdfe=_0x262049['count'];var _0x26a265=_0x68f1f3?0x0:_0x31e9f9[_0x4af7('0x16')];var _0x3b208e=_0x68f1f3?_0x262049[_0x4af7('0x19')]:_0x31e9f9[_0x4af7('0x16')]+_0x31e9f9[_0x4af7('0x18')];var _0x55e81e;if(_0x3b208e>=_0x3fbdfe){_0x3b208e=_0x3fbdfe;_0x55e81e=0xc8;}else{_0x55e81e=0xce;}_0x18305d[_0x4af7('0x15')](_0x55e81e);return _0x18305d[_0x4af7('0x1a')]('Content-Range',_0x26a265+'-'+_0x3b208e+'/'+_0x3fbdfe)[_0x4af7('0x1b')](_0x262049);}return null;};}function patchUpdates(_0x1ee164){return function(_0x5c9409){try{jsonpatch[_0x4af7('0x1c')](_0x5c9409,_0x1ee164,!![]);}catch(_0x400d95){return BPromise[_0x4af7('0x1d')](_0x400d95);}return _0x5c9409['save']();};}function saveUpdates(_0x2fa889,_0x43b1c3){return function(_0x1a6887){if(_0x1a6887){return _0x1a6887[_0x4af7('0x1e')](_0x2fa889)[_0x4af7('0x1f')](function(_0x16b3cb){return _0x16b3cb;});}return null;};}function removeEntity(_0x55fc33,_0x2804c3){return function(_0x228bac){if(_0x228bac){return _0x228bac[_0x4af7('0x20')]()['then'](function(){_0x55fc33[_0x4af7('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x517750,_0x53cfba){return function(_0x317baa){if(!_0x317baa){_0x517750[_0x4af7('0x14')](0x194);}return _0x317baa;};}function handleError(_0x58cef8,_0x5e491c){_0x5e491c=_0x5e491c||0x1f4;return function(_0x6dd3f1){logger[_0x4af7('0x21')](_0x6dd3f1[_0x4af7('0x22')]);if(_0x6dd3f1['name']){delete _0x6dd3f1[_0x4af7('0x23')];}_0x58cef8['status'](_0x5e491c)[_0x4af7('0x24')](_0x6dd3f1);};}exports[_0x4af7('0x25')]=function(_0x288444,_0x9c747e){var _0x3e8c03={},_0x22bfd8={},_0x43f6a7={'count':0x0,'rows':[]};var _0x55c01b=_[_0x4af7('0x26')](db[_0x4af7('0x27')][_0x4af7('0x28')],function(_0xec3cef){return{'name':_0xec3cef['fieldName'],'type':_0xec3cef[_0x4af7('0x29')]['key']};});_0x22bfd8[_0x4af7('0x2a')]=_[_0x4af7('0x26')](_0x55c01b,'name');_0x22bfd8['query']=_['keys'](_0x288444['query']);_0x22bfd8[_0x4af7('0x2b')]=_[_0x4af7('0x2c')](_0x22bfd8[_0x4af7('0x2a')],_0x22bfd8['query']);_0x3e8c03[_0x4af7('0x2d')]=_[_0x4af7('0x2c')](_0x22bfd8[_0x4af7('0x2a')],qs[_0x4af7('0x2e')](_0x288444[_0x4af7('0x2f')][_0x4af7('0x2e')]));_0x3e8c03['attributes']=_0x3e8c03[_0x4af7('0x2d')][_0x4af7('0x30')]?_0x3e8c03[_0x4af7('0x2d')]:_0x22bfd8[_0x4af7('0x2a')];if(!_0x288444['query'][_0x4af7('0x31')](_0x4af7('0x32'))){_0x3e8c03[_0x4af7('0x18')]=qs[_0x4af7('0x18')](_0x288444[_0x4af7('0x2f')]['limit']);_0x3e8c03[_0x4af7('0x16')]=qs['offset'](_0x288444['query']['offset']);}_0x3e8c03[_0x4af7('0x33')]=qs[_0x4af7('0x34')](_0x288444[_0x4af7('0x2f')]['sort']);_0x3e8c03[_0x4af7('0x35')]=qs[_0x4af7('0x2b')](_['pick'](_0x288444[_0x4af7('0x2f')],_0x22bfd8[_0x4af7('0x2b')]),_0x55c01b);if(_0x288444['query']['filter']){_0x3e8c03[_0x4af7('0x35')]=_['merge'](_0x3e8c03[_0x4af7('0x35')],{'$or':_[_0x4af7('0x26')](_0x55c01b,function(_0x541c23){if(_0x541c23[_0x4af7('0x29')]!=='VIRTUAL'){var _0x246045={};_0x246045[_0x541c23[_0x4af7('0x23')]]={'$like':'%'+_0x288444[_0x4af7('0x2f')][_0x4af7('0x36')]+'%'};return _0x246045;}})});}_0x3e8c03=_['merge']({},_0x3e8c03,_0x288444[_0x4af7('0x37')]);var _0x32d94e={'where':_0x3e8c03[_0x4af7('0x35')]};return db[_0x4af7('0x27')]['count'](_0x32d94e)[_0x4af7('0x1f')](function(_0x1a93cc){_0x43f6a7[_0x4af7('0x19')]=_0x1a93cc;if(_0x288444['query'][_0x4af7('0x38')]){_0x3e8c03[_0x4af7('0x39')]=[{'all':!![]}];}return db['JscriptyQuestionReport'][_0x4af7('0x3a')](_0x3e8c03);})['then'](function(_0x1f67f2){_0x43f6a7['rows']=_0x1f67f2;return _0x43f6a7;})['then'](respondWithFilteredResult(_0x9c747e,_0x3e8c03))['catch'](handleError(_0x9c747e,null));};exports[_0x4af7('0x3b')]=function(_0xfaec,_0x93b154){var _0x49575a={'raw':!![],'where':{'id':_0xfaec[_0x4af7('0x3c')]['id']}},_0x7dc650={};_0x7dc650[_0x4af7('0x2a')]=_[_0x4af7('0x3d')](db[_0x4af7('0x27')][_0x4af7('0x28')]);_0x7dc650[_0x4af7('0x2f')]=_[_0x4af7('0x3d')](_0xfaec[_0x4af7('0x2f')]);_0x7dc650[_0x4af7('0x2b')]=_[_0x4af7('0x2c')](_0x7dc650['model'],_0x7dc650[_0x4af7('0x2f')]);_0x49575a['attributes']=_[_0x4af7('0x2c')](_0x7dc650[_0x4af7('0x2a')],qs['fields'](_0xfaec['query'][_0x4af7('0x2e')]));_0x49575a['attributes']=_0x49575a[_0x4af7('0x2d')][_0x4af7('0x30')]?_0x49575a[_0x4af7('0x2d')]:_0x7dc650[_0x4af7('0x2a')];if(_0xfaec[_0x4af7('0x2f')]['includeAll']){_0x49575a[_0x4af7('0x39')]=[{'all':!![]}];}_0x49575a=_[_0x4af7('0x3e')]({},_0x49575a,_0xfaec['options']);return db['JscriptyQuestionReport'][_0x4af7('0x3f')](_0x49575a)[_0x4af7('0x1f')](handleEntityNotFound(_0x93b154,null))['then'](respondWithResult(_0x93b154,null))[_0x4af7('0x40')](handleError(_0x93b154,null));};exports[_0x4af7('0x41')]=function(_0x17c086,_0x2a4991){return db[_0x4af7('0x27')][_0x4af7('0x41')](_0x17c086['body'],{})[_0x4af7('0x1f')](respondWithResult(_0x2a4991,0xc9))[_0x4af7('0x40')](handleError(_0x2a4991,null));};exports[_0x4af7('0x1e')]=function(_0x116297,_0x557bad){if(_0x116297['body']['id']){delete _0x116297[_0x4af7('0x42')]['id'];}return db['JscriptyQuestionReport'][_0x4af7('0x3f')]({'where':{'id':_0x116297['params']['id']}})[_0x4af7('0x1f')](handleEntityNotFound(_0x557bad,null))[_0x4af7('0x1f')](saveUpdates(_0x116297['body'],null))[_0x4af7('0x1f')](respondWithResult(_0x557bad,null))[_0x4af7('0x40')](handleError(_0x557bad,null));};exports['destroy']=function(_0x295b8b,_0x5e3a6b){return db[_0x4af7('0x27')]['find']({'where':{'id':_0x295b8b[_0x4af7('0x3c')]['id']}})[_0x4af7('0x1f')](handleEntityNotFound(_0x5e3a6b,null))[_0x4af7('0x1f')](removeEntity(_0x5e3a6b,null))[_0x4af7('0x40')](handleError(_0x5e3a6b,null));};exports[_0x4af7('0x43')]=function(_0x93ce3,_0xca7e30){return db['JscriptyQuestionReport']['describe']()['then'](respondWithResult(_0xca7e30,null))['catch'](handleError(_0xca7e30,null));}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js index 39d09ff..657cdb4 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 _0x8cdb=['lodash','util','moment','request-promise','rimraf','../../config/environment','./jscriptyQuestionReport.attributes','define','JscriptyQuestionReport','report_jscripty_questions'];(function(_0x2fc5db,_0x2253b1){var _0x1ef11b=function(_0x2846a5){while(--_0x2846a5){_0x2fc5db['push'](_0x2fc5db['shift']());}};_0x1ef11b(++_0x2253b1);}(_0x8cdb,0x82));var _0xb8cd=function(_0x237766,_0x1f1bd6){_0x237766=_0x237766-0x0;var _0x5a538a=_0x8cdb[_0x237766];return _0x5a538a;};'use strict';var _=require(_0xb8cd('0x0'));var util=require(_0xb8cd('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xb8cd('0x2'));var BPromise=require('bluebird');var rp=require(_0xb8cd('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb8cd('0x4'));var config=require(_0xb8cd('0x5'));var attributes=require(_0xb8cd('0x6'));module['exports']=function(_0x180043,_0x35d893){return _0x180043[_0xb8cd('0x7')](_0xb8cd('0x8'),attributes,{'tableName':_0xb8cd('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x531a=['api','moment','bluebird','path','rimraf','../../config/environment','./jscriptyQuestionReport.attributes','exports','JscriptyQuestionReport','report_jscripty_questions','lodash','util','../../config/logger'];(function(_0x1b73ab,_0x1f30de){var _0x3dbad6=function(_0x190652){while(--_0x190652){_0x1b73ab['push'](_0x1b73ab['shift']());}};_0x3dbad6(++_0x1f30de);}(_0x531a,0x11b));var _0xa531=function(_0x2ab350,_0x32859f){_0x2ab350=_0x2ab350-0x0;var _0x4acac=_0x531a[_0x2ab350];return _0x4acac;};'use strict';var _=require(_0xa531('0x0'));var util=require(_0xa531('0x1'));var logger=require(_0xa531('0x2'))(_0xa531('0x3'));var moment=require(_0xa531('0x4'));var BPromise=require(_0xa531('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa531('0x6'));var rimraf=require(_0xa531('0x7'));var config=require(_0xa531('0x8'));var attributes=require(_0xa531('0x9'));module[_0xa531('0xa')]=function(_0x499873,_0x5150b2){return _0x499873['define'](_0xa531('0xb'),attributes,{'tableName':_0xa531('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 90fe454..cfe3bbf 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 _0x46c1=['client','http','request','info','JscriptyQuestionReport,\x20%s,\x20%s','request\x20sent','debug','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0xc1005a,_0x7c33ed){var _0x3deb10=function(_0x2e4bcb){while(--_0x2e4bcb){_0xc1005a['push'](_0xc1005a['shift']());}};_0x3deb10(++_0x7c33ed);}(_0x46c1,0x7a));var _0x146c=function(_0xb4bc0f,_0x1614bf){_0xb4bc0f=_0xb4bc0f-0x0;var _0x5a0505=_0x46c1[_0xb4bc0f];return _0x5a0505;};'use strict';var _=require(_0x146c('0x0'));var util=require(_0x146c('0x1'));var moment=require('moment');var BPromise=require(_0x146c('0x2'));var rs=require(_0x146c('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x146c('0x4'))['db'];var utils=require(_0x146c('0x5'));var logger=require(_0x146c('0x6'))(_0x146c('0x7'));var config=require(_0x146c('0x8'));var jayson=require(_0x146c('0x9'));var client=jayson[_0x146c('0xa')][_0x146c('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3ded39,_0x6eb957,_0x255047){return new BPromise(function(_0x51fb42,_0x557302){return client[_0x146c('0xc')](_0x3ded39,_0x255047)['then'](function(_0x4d2004){logger[_0x146c('0xd')](_0x146c('0xe'),_0x6eb957,_0x146c('0xf'));logger[_0x146c('0x10')](_0x146c('0x11'),_0x6eb957,'request\x20sent',JSON[_0x146c('0x12')](_0x4d2004));if(_0x4d2004['error']){if(_0x4d2004[_0x146c('0x13')]['code']===0x1f4){logger[_0x146c('0x13')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x6eb957,_0x4d2004[_0x146c('0x13')][_0x146c('0x14')]);return _0x557302(_0x4d2004['error'][_0x146c('0x14')]);}logger[_0x146c('0x13')](_0x146c('0xe'),_0x6eb957,_0x4d2004[_0x146c('0x13')][_0x146c('0x14')]);return _0x51fb42(_0x4d2004[_0x146c('0x13')][_0x146c('0x14')]);}else{logger[_0x146c('0xd')](_0x146c('0xe'),_0x6eb957,'request\x20sent');_0x51fb42(_0x4d2004['result'][_0x146c('0x14')]);}})[_0x146c('0x15')](function(_0x3b0360){logger[_0x146c('0x13')](_0x146c('0xe'),_0x6eb957,_0x3b0360);_0x557302(_0x3b0360);});});} \ No newline at end of file +var _0xf673=['code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','JscriptyQuestionReport,\x20%s,\x20%s','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','request\x20sent','error'];(function(_0x15fb0b,_0x44b92d){var _0x423f50=function(_0x32b8c5){while(--_0x32b8c5){_0x15fb0b['push'](_0x15fb0b['shift']());}};_0x423f50(++_0x44b92d);}(_0xf673,0x190));var _0x3f67=function(_0x5ff517,_0x3e4ee0){_0x5ff517=_0x5ff517-0x0;var _0x19a245=_0xf673[_0x5ff517];return _0x19a245;};'use strict';var _=require(_0x3f67('0x0'));var util=require(_0x3f67('0x1'));var moment=require(_0x3f67('0x2'));var BPromise=require('bluebird');var rs=require(_0x3f67('0x3'));var fs=require('fs');var Redis=require(_0x3f67('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x3f67('0x5'));var logger=require(_0x3f67('0x6'))(_0x3f67('0x7'));var config=require(_0x3f67('0x8'));var jayson=require(_0x3f67('0x9'));var client=jayson[_0x3f67('0xa')][_0x3f67('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x244c27,_0x57c547,_0xa79837){return new BPromise(function(_0x29bd5b,_0x55c439){return client['request'](_0x244c27,_0xa79837)[_0x3f67('0xc')](function(_0x21faa6){logger[_0x3f67('0xd')](_0x3f67('0xe'),_0x57c547,'request\x20sent');logger['debug'](_0x3f67('0xf'),_0x57c547,_0x3f67('0x10'),JSON['stringify'](_0x21faa6));if(_0x21faa6[_0x3f67('0x11')]){if(_0x21faa6[_0x3f67('0x11')][_0x3f67('0x12')]===0x1f4){logger['error'](_0x3f67('0xe'),_0x57c547,_0x21faa6['error'][_0x3f67('0x13')]);return _0x55c439(_0x21faa6[_0x3f67('0x11')][_0x3f67('0x13')]);}logger[_0x3f67('0x11')](_0x3f67('0xe'),_0x57c547,_0x21faa6[_0x3f67('0x11')]['message']);return _0x29bd5b(_0x21faa6[_0x3f67('0x11')]['message']);}else{logger[_0x3f67('0xd')](_0x3f67('0xe'),_0x57c547,_0x3f67('0x10'));_0x29bd5b(_0x21faa6[_0x3f67('0x14')]['message']);}})[_0x3f67('0x15')](function(_0x4d30f6){logger['error'](_0x3f67('0xe'),_0x57c547,_0x4d30f6);_0x55c439(_0x4d30f6);});});} \ No newline at end of file diff --git a/server/api/jscriptySessionReport/index.js b/server/api/jscriptySessionReport/index.js index 180436b..04a78f1 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 _0xf097=['/describe','describe','/:id','isAuthenticated','show','/:id/questions','post','create','put','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptySessionReport.controller','get','index'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf097,0x105));var _0x7f09=function(_0x31f800,_0x567886){_0x31f800=_0x31f800-0x0;var _0x75c97a=_0xf097[_0x31f800];return _0x75c97a;};'use strict';var multer=require(_0x7f09('0x0'));var util=require(_0x7f09('0x1'));var path=require(_0x7f09('0x2'));var timeout=require(_0x7f09('0x3'));var express=require(_0x7f09('0x4'));var router=express['Router']();var fs_extra=require(_0x7f09('0x5'));var auth=require(_0x7f09('0x6'));var interaction=require(_0x7f09('0x7'));var config=require(_0x7f09('0x8'));var controller=require(_0x7f09('0x9'));router[_0x7f09('0xa')]('/',auth['isAuthenticated'](),controller[_0x7f09('0xb')]);router[_0x7f09('0xa')](_0x7f09('0xc'),auth['isAuthenticated'](),controller[_0x7f09('0xd')]);router[_0x7f09('0xa')](_0x7f09('0xe'),auth[_0x7f09('0xf')](),controller[_0x7f09('0x10')]);router[_0x7f09('0xa')](_0x7f09('0x11'),auth[_0x7f09('0xf')](),controller['getQuestions']);router[_0x7f09('0x12')]('/',auth[_0x7f09('0xf')](),controller[_0x7f09('0x13')]);router[_0x7f09('0x14')](_0x7f09('0xe'),auth[_0x7f09('0xf')](),controller['update']);router['delete']('/:id',auth[_0x7f09('0xf')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x67d4=['show','/:id/questions','getQuestions','post','create','put','delete','/:id','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptySessionReport.controller','get','isAuthenticated','index','describe'];(function(_0x8e59a4,_0x5a18a2){var _0x4f5f2d=function(_0x5b5363){while(--_0x5b5363){_0x8e59a4['push'](_0x8e59a4['shift']());}};_0x4f5f2d(++_0x5a18a2);}(_0x67d4,0x6a));var _0x467d=function(_0x53870d,_0x1c4e87){_0x53870d=_0x53870d-0x0;var _0x481096=_0x67d4[_0x53870d];return _0x481096;};'use strict';var multer=require(_0x467d('0x0'));var util=require('util');var path=require(_0x467d('0x1'));var timeout=require(_0x467d('0x2'));var express=require(_0x467d('0x3'));var router=express[_0x467d('0x4')]();var fs_extra=require(_0x467d('0x5'));var auth=require(_0x467d('0x6'));var interaction=require(_0x467d('0x7'));var config=require(_0x467d('0x8'));var controller=require(_0x467d('0x9'));router[_0x467d('0xa')]('/',auth[_0x467d('0xb')](),controller[_0x467d('0xc')]);router['get']('/describe',auth[_0x467d('0xb')](),controller[_0x467d('0xd')]);router[_0x467d('0xa')]('/:id',auth[_0x467d('0xb')](),controller[_0x467d('0xe')]);router[_0x467d('0xa')](_0x467d('0xf'),auth[_0x467d('0xb')](),controller[_0x467d('0x10')]);router[_0x467d('0x11')]('/',auth[_0x467d('0xb')](),controller[_0x467d('0x12')]);router[_0x467d('0x13')]('/:id',auth[_0x467d('0xb')](),controller['update']);router[_0x467d('0x14')](_0x467d('0x15'),auth['isAuthenticated'](),controller[_0x467d('0x16')]);module[_0x467d('0x17')]=router; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js b/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js index deaa48d..10707ee 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 _0x2178=['moment','exports','DATE','starttime','setDataValue','format','YYYY-MM-DD\x20HH:mm:ss','STRING'];(function(_0x41bf04,_0x47c75b){var _0x233862=function(_0x1ccd6f){while(--_0x1ccd6f){_0x41bf04['push'](_0x41bf04['shift']());}};_0x233862(++_0x47c75b);}(_0x2178,0x1b0));var _0x8217=function(_0x45ce30,_0x2b5ec7){_0x45ce30=_0x45ce30-0x0;var _0x2eeafb=_0x2178[_0x45ce30];return _0x2eeafb;};'use strict';var moment=require(_0x8217('0x0'));var Sequelize=require('sequelize');module[_0x8217('0x1')]={'starttime':{'type':Sequelize[_0x8217('0x2')],'set':function(_0x450e40){this['setDataValue'](_0x8217('0x3'),_0x450e40);this[_0x8217('0x4')]('endtime',moment()[_0x8217('0x5')](_0x8217('0x6')));}},'endtime':{'type':Sequelize[_0x8217('0x2')]},'membername':{'type':Sequelize[_0x8217('0x7')]},'projectname':{'type':Sequelize[_0x8217('0x7')]},'queue':{'type':Sequelize[_0x8217('0x7')]},'uniqueid':{'type':Sequelize[_0x8217('0x7')]},'calleridname':{'type':Sequelize[_0x8217('0x7')]},'calleridnum':{'type':Sequelize[_0x8217('0x7')]},'completed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x7aa0=['starttime','setDataValue','endtime','format','YYYY-MM-DD\x20HH:mm:ss','STRING','BOOLEAN','moment','sequelize','exports','DATE'];(function(_0x462a4f,_0x1e644e){var _0x36b938=function(_0x2fc8af){while(--_0x2fc8af){_0x462a4f['push'](_0x462a4f['shift']());}};_0x36b938(++_0x1e644e);}(_0x7aa0,0xa1));var _0x07aa=function(_0x37253f,_0x4cc2a7){_0x37253f=_0x37253f-0x0;var _0x5f1783=_0x7aa0[_0x37253f];return _0x5f1783;};'use strict';var moment=require(_0x07aa('0x0'));var Sequelize=require(_0x07aa('0x1'));module[_0x07aa('0x2')]={'starttime':{'type':Sequelize[_0x07aa('0x3')],'set':function(_0x5edbb2){this['setDataValue'](_0x07aa('0x4'),_0x5edbb2);this[_0x07aa('0x5')](_0x07aa('0x6'),moment()[_0x07aa('0x7')](_0x07aa('0x8')));}},'endtime':{'type':Sequelize[_0x07aa('0x3')]},'membername':{'type':Sequelize['STRING']},'projectname':{'type':Sequelize[_0x07aa('0x9')]},'queue':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x07aa('0x9')]},'calleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x07aa('0x9')]},'completed':{'type':Sequelize[_0x07aa('0xa')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.controller.js b/server/api/jscriptySessionReport/jscriptySessionReport.controller.js index ea15fc3..4b1cebd 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 _0xf4bb=['papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','offset','undefined','limit','count','set','Content-Range','json','reject','save','then','sendStatus','error','name','send','index','map','JscriptySessionReport','rawAttributes','type','key','model','query','keys','intersection','attributes','fields','length','nolimit','sort','filters','pick','filter','merge','where','options','includeAll','findAll','params','find','catch','body','destroy','describe','getQuestions','findOne','JscriptyQuestionReport','order','include','rows','rimraf','zip-dir','request-promise','moment','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xf4bb,0x165));var _0xbf4b=function(_0x4baae2,_0x487ab6){_0x4baae2=_0x4baae2-0x0;var _0x1a2285=_0xf4bb[_0x4baae2];return _0x1a2285;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xbf4b('0x0'));var zipdir=require(_0xbf4b('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xbf4b('0x2'));var moment=require(_0xbf4b('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0xbf4b('0x4'));var sox=require(_0xbf4b('0x5'));var csv=require(_0xbf4b('0x6'));var ejs=require(_0xbf4b('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xbf4b('0x8'));var squel=require(_0xbf4b('0x9'));var crypto=require(_0xbf4b('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xbf4b('0xb'));var toCsv=require(_0xbf4b('0x6'));var querystring=require(_0xbf4b('0xc'));var Papa=require(_0xbf4b('0xd'));var Redis=require(_0xbf4b('0xe'));var authService=require(_0xbf4b('0xf'));var qs=require(_0xbf4b('0x10'));var as=require(_0xbf4b('0x11'));var hardwareService=require(_0xbf4b('0x12'));var logger=require('../../config/logger')('api');var utils=require(_0xbf4b('0x13'));var config=require(_0xbf4b('0x14'));var licenseUtil=require(_0xbf4b('0x15'));var db=require(_0xbf4b('0x16'))['db'];function respondWithStatusCode(_0x434ec3,_0x29dc90){_0x29dc90=_0x29dc90||0xcc;return function(_0x15a02a){if(_0x15a02a){return _0x434ec3['sendStatus'](_0x29dc90);}return _0x434ec3[_0xbf4b('0x17')](_0x29dc90)[_0xbf4b('0x18')]();};}function respondWithResult(_0x2ee864,_0x2b8151){_0x2b8151=_0x2b8151||0xc8;return function(_0xa5d818){if(_0xa5d818){return _0x2ee864[_0xbf4b('0x17')](_0x2b8151)['json'](_0xa5d818);}};}function respondWithFilteredResult(_0x4ff406,_0x1bed98){return function(_0x13974b){if(_0x13974b){var _0x263fc0=typeof _0x1bed98[_0xbf4b('0x19')]===_0xbf4b('0x1a')&&typeof _0x1bed98[_0xbf4b('0x1b')]===_0xbf4b('0x1a');var _0x1607cf=_0x13974b[_0xbf4b('0x1c')];var _0x1fba5f=_0x263fc0?0x0:_0x1bed98[_0xbf4b('0x19')];var _0x482698=_0x263fc0?_0x13974b[_0xbf4b('0x1c')]:_0x1bed98['offset']+_0x1bed98[_0xbf4b('0x1b')];var _0x2f4723;if(_0x482698>=_0x1607cf){_0x482698=_0x1607cf;_0x2f4723=0xc8;}else{_0x2f4723=0xce;}_0x4ff406[_0xbf4b('0x17')](_0x2f4723);return _0x4ff406[_0xbf4b('0x1d')](_0xbf4b('0x1e'),_0x1fba5f+'-'+_0x482698+'/'+_0x1607cf)[_0xbf4b('0x1f')](_0x13974b);}return null;};}function patchUpdates(_0x212e01){return function(_0x4d24ca){try{jsonpatch['apply'](_0x4d24ca,_0x212e01,!![]);}catch(_0x54e7a6){return BPromise[_0xbf4b('0x20')](_0x54e7a6);}return _0x4d24ca[_0xbf4b('0x21')]();};}function saveUpdates(_0x4e4992,_0x18a9f7){return function(_0x228b25){if(_0x228b25){return _0x228b25['update'](_0x4e4992)[_0xbf4b('0x22')](function(_0x59dda5){return _0x59dda5;});}return null;};}function removeEntity(_0x8db155,_0x100198){return function(_0x4612a4){if(_0x4612a4){return _0x4612a4['destroy']()[_0xbf4b('0x22')](function(){_0x8db155[_0xbf4b('0x17')](0xcc)[_0xbf4b('0x18')]();});}};}function handleEntityNotFound(_0x2b6c27,_0x164f91){return function(_0x3c3f8e){if(!_0x3c3f8e){_0x2b6c27[_0xbf4b('0x23')](0x194);}return _0x3c3f8e;};}function handleError(_0x27fef2,_0x1ddd28){_0x1ddd28=_0x1ddd28||0x1f4;return function(_0x548d02){logger[_0xbf4b('0x24')](_0x548d02['stack']);if(_0x548d02[_0xbf4b('0x25')]){delete _0x548d02['name'];}_0x27fef2[_0xbf4b('0x17')](_0x1ddd28)[_0xbf4b('0x26')](_0x548d02);};}exports[_0xbf4b('0x27')]=function(_0x146229,_0x324a3b){var _0x25e1cd={},_0x49adf7={},_0x3c70f7={'count':0x0,'rows':[]};var _0x202af0=_[_0xbf4b('0x28')](db[_0xbf4b('0x29')][_0xbf4b('0x2a')],function(_0x181032){return{'name':_0x181032['fieldName'],'type':_0x181032[_0xbf4b('0x2b')][_0xbf4b('0x2c')]};});_0x49adf7[_0xbf4b('0x2d')]=_[_0xbf4b('0x28')](_0x202af0,_0xbf4b('0x25'));_0x49adf7[_0xbf4b('0x2e')]=_[_0xbf4b('0x2f')](_0x146229[_0xbf4b('0x2e')]);_0x49adf7['filters']=_[_0xbf4b('0x30')](_0x49adf7[_0xbf4b('0x2d')],_0x49adf7['query']);_0x25e1cd[_0xbf4b('0x31')]=_[_0xbf4b('0x30')](_0x49adf7[_0xbf4b('0x2d')],qs[_0xbf4b('0x32')](_0x146229['query'][_0xbf4b('0x32')]));_0x25e1cd[_0xbf4b('0x31')]=_0x25e1cd[_0xbf4b('0x31')][_0xbf4b('0x33')]?_0x25e1cd[_0xbf4b('0x31')]:_0x49adf7[_0xbf4b('0x2d')];if(!_0x146229[_0xbf4b('0x2e')]['hasOwnProperty'](_0xbf4b('0x34'))){_0x25e1cd[_0xbf4b('0x1b')]=qs[_0xbf4b('0x1b')](_0x146229[_0xbf4b('0x2e')][_0xbf4b('0x1b')]);_0x25e1cd['offset']=qs[_0xbf4b('0x19')](_0x146229[_0xbf4b('0x2e')][_0xbf4b('0x19')]);}_0x25e1cd['order']=qs[_0xbf4b('0x35')](_0x146229[_0xbf4b('0x2e')][_0xbf4b('0x35')]);_0x25e1cd['where']=qs[_0xbf4b('0x36')](_[_0xbf4b('0x37')](_0x146229['query'],_0x49adf7[_0xbf4b('0x36')]),_0x202af0);if(_0x146229[_0xbf4b('0x2e')][_0xbf4b('0x38')]){_0x25e1cd['where']=_[_0xbf4b('0x39')](_0x25e1cd[_0xbf4b('0x3a')],{'$or':_[_0xbf4b('0x28')](_0x202af0,function(_0x4f6106){if(_0x4f6106['type']!=='VIRTUAL'){var _0x979a41={};_0x979a41[_0x4f6106[_0xbf4b('0x25')]]={'$like':'%'+_0x146229[_0xbf4b('0x2e')]['filter']+'%'};return _0x979a41;}})});}_0x25e1cd=_[_0xbf4b('0x39')]({},_0x25e1cd,_0x146229[_0xbf4b('0x3b')]);var _0x4de848={'where':_0x25e1cd[_0xbf4b('0x3a')]};return db[_0xbf4b('0x29')][_0xbf4b('0x1c')](_0x4de848)['then'](function(_0x4a43c3){_0x3c70f7[_0xbf4b('0x1c')]=_0x4a43c3;if(_0x146229[_0xbf4b('0x2e')][_0xbf4b('0x3c')]){_0x25e1cd['include']=[{'all':!![]}];}return db[_0xbf4b('0x29')][_0xbf4b('0x3d')](_0x25e1cd);})[_0xbf4b('0x22')](function(_0x4fff25){_0x3c70f7['rows']=_0x4fff25;return _0x3c70f7;})[_0xbf4b('0x22')](respondWithFilteredResult(_0x324a3b,_0x25e1cd))['catch'](handleError(_0x324a3b,null));};exports['show']=function(_0x4f4f8c,_0x4e7ec7){var _0x4d8bc6={'raw':!![],'where':{'id':_0x4f4f8c[_0xbf4b('0x3e')]['id']}},_0x5de729={};_0x5de729[_0xbf4b('0x2d')]=_[_0xbf4b('0x2f')](db[_0xbf4b('0x29')]['rawAttributes']);_0x5de729[_0xbf4b('0x2e')]=_[_0xbf4b('0x2f')](_0x4f4f8c[_0xbf4b('0x2e')]);_0x5de729[_0xbf4b('0x36')]=_[_0xbf4b('0x30')](_0x5de729[_0xbf4b('0x2d')],_0x5de729[_0xbf4b('0x2e')]);_0x4d8bc6[_0xbf4b('0x31')]=_[_0xbf4b('0x30')](_0x5de729[_0xbf4b('0x2d')],qs[_0xbf4b('0x32')](_0x4f4f8c[_0xbf4b('0x2e')][_0xbf4b('0x32')]));_0x4d8bc6['attributes']=_0x4d8bc6['attributes'][_0xbf4b('0x33')]?_0x4d8bc6['attributes']:_0x5de729['model'];if(_0x4f4f8c[_0xbf4b('0x2e')]['includeAll']){_0x4d8bc6['include']=[{'all':!![]}];}_0x4d8bc6=_['merge']({},_0x4d8bc6,_0x4f4f8c[_0xbf4b('0x3b')]);return db[_0xbf4b('0x29')][_0xbf4b('0x3f')](_0x4d8bc6)[_0xbf4b('0x22')](handleEntityNotFound(_0x4e7ec7,null))[_0xbf4b('0x22')](respondWithResult(_0x4e7ec7,null))[_0xbf4b('0x40')](handleError(_0x4e7ec7,null));};exports['create']=function(_0x13290d,_0xfb3c7b){return db['JscriptySessionReport']['create'](_0x13290d[_0xbf4b('0x41')],{})['then'](respondWithResult(_0xfb3c7b,0xc9))[_0xbf4b('0x40')](handleError(_0xfb3c7b,null));};exports['update']=function(_0x2366e3,_0x2d473f){if(_0x2366e3['body']['id']){delete _0x2366e3['body']['id'];}return db[_0xbf4b('0x29')]['find']({'where':{'id':_0x2366e3[_0xbf4b('0x3e')]['id']}})[_0xbf4b('0x22')](handleEntityNotFound(_0x2d473f,null))['then'](saveUpdates(_0x2366e3[_0xbf4b('0x41')],null))[_0xbf4b('0x22')](respondWithResult(_0x2d473f,null))[_0xbf4b('0x40')](handleError(_0x2d473f,null));};exports[_0xbf4b('0x42')]=function(_0x524c19,_0x206346){return db[_0xbf4b('0x29')][_0xbf4b('0x3f')]({'where':{'id':_0x524c19[_0xbf4b('0x3e')]['id']}})[_0xbf4b('0x22')](handleEntityNotFound(_0x206346,null))['then'](removeEntity(_0x206346,null))['catch'](handleError(_0x206346,null));};exports[_0xbf4b('0x43')]=function(_0x3bb225,_0x43d57f){return db[_0xbf4b('0x29')][_0xbf4b('0x43')]()[_0xbf4b('0x22')](respondWithResult(_0x43d57f,null))[_0xbf4b('0x40')](handleError(_0x43d57f,null));};exports[_0xbf4b('0x44')]=function(_0x3d5d1a,_0x3239ae,_0x471253){var _0x4779b6={'raw':!![],'where':{}};var _0x5068cc={};var _0x31b933={'count':0x0,'rows':[]};return db['JscriptySessionReport'][_0xbf4b('0x45')]({'where':{'id':_0x3d5d1a['params']['id']}})[_0xbf4b('0x22')](handleEntityNotFound(_0x3239ae,null))[_0xbf4b('0x22')](function(_0x49d4a1){if(_0x49d4a1){_0x5068cc[_0xbf4b('0x2d')]=_[_0xbf4b('0x2f')](db[_0xbf4b('0x46')][_0xbf4b('0x2a')]);_0x5068cc['query']=_['keys'](_0x3d5d1a['query']);_0x5068cc[_0xbf4b('0x36')]=_[_0xbf4b('0x30')](_0x5068cc[_0xbf4b('0x2d')],_0x5068cc[_0xbf4b('0x2e')]);_0x4779b6[_0xbf4b('0x31')]=_[_0xbf4b('0x30')](_0x5068cc['model'],qs[_0xbf4b('0x32')](_0x3d5d1a[_0xbf4b('0x2e')][_0xbf4b('0x32')]));_0x4779b6[_0xbf4b('0x31')]=_0x4779b6[_0xbf4b('0x31')][_0xbf4b('0x33')]?_0x4779b6[_0xbf4b('0x31')]:_0x5068cc[_0xbf4b('0x2d')];if(!_0x3d5d1a[_0xbf4b('0x2e')]['hasOwnProperty'](_0xbf4b('0x34'))){_0x4779b6['limit']=qs[_0xbf4b('0x1b')](_0x3d5d1a[_0xbf4b('0x2e')][_0xbf4b('0x1b')]);_0x4779b6[_0xbf4b('0x19')]=qs['offset'](_0x3d5d1a[_0xbf4b('0x2e')][_0xbf4b('0x19')]);}_0x4779b6[_0xbf4b('0x47')]=qs[_0xbf4b('0x35')](_0x3d5d1a[_0xbf4b('0x2e')][_0xbf4b('0x35')]);_0x4779b6['where']=qs[_0xbf4b('0x36')](_['pick'](_0x3d5d1a[_0xbf4b('0x2e')],_0x5068cc[_0xbf4b('0x36')]));_0x4779b6['where']['SessionId']=_0x49d4a1['id'];if(_0x3d5d1a['query']['filter']){_0x4779b6[_0xbf4b('0x3a')]=_['merge'](_0x4779b6[_0xbf4b('0x3a')],{'$or':_[_0xbf4b('0x28')](_0x4779b6[_0xbf4b('0x31')],function(_0xfc8bf){var _0x2bd2b7={};_0x2bd2b7[_0xfc8bf]={'$like':'%'+_0x3d5d1a['query']['filter']+'%'};return _0x2bd2b7;})});}_0x4779b6=_[_0xbf4b('0x39')]({},_0x4779b6,_0x3d5d1a[_0xbf4b('0x3b')]);return db[_0xbf4b('0x46')][_0xbf4b('0x1c')]({'where':_0x4779b6['where']})[_0xbf4b('0x22')](function(_0x12d501){_0x31b933[_0xbf4b('0x1c')]=_0x12d501;if(_0x3d5d1a[_0xbf4b('0x2e')][_0xbf4b('0x3c')]){_0x4779b6[_0xbf4b('0x48')]=[{'all':!![]}];}return db[_0xbf4b('0x46')][_0xbf4b('0x3d')](_0x4779b6);})[_0xbf4b('0x22')](function(_0x37b21a){_0x31b933[_0xbf4b('0x49')]=_0x37b21a;return _0x31b933;});}})[_0xbf4b('0x22')](respondWithFilteredResult(_0x3239ae,_0x4779b6))[_0xbf4b('0x40')](handleError(_0x3239ae,null));}; \ No newline at end of file +var _0x5b38=['sort','SessionId','filter','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','crypto','desk.js','querystring','papaparse','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','reject','save','update','then','destroy','error','stack','name','index','map','rawAttributes','fieldName','type','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','filters','pick','merge','where','VIRTUAL','includeAll','include','JscriptySessionReport','findAll','rows','show','params','options','find','catch','create','body','describe','getQuestions','JscriptyQuestionReport'];(function(_0xbc9e92,_0x42b470){var _0x3010f2=function(_0x258d03){while(--_0x258d03){_0xbc9e92['push'](_0xbc9e92['shift']());}};_0x3010f2(++_0x42b470);}(_0x5b38,0x137));var _0x85b3=function(_0x46361e,_0x243aaf){_0x46361e=_0x46361e-0x0;var _0x14e302=_0x5b38[_0x46361e];return _0x14e302;};'use strict';var emlformat=require(_0x85b3('0x0'));var rimraf=require(_0x85b3('0x1'));var zipdir=require(_0x85b3('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x85b3('0x3'));var moment=require(_0x85b3('0x4'));var BPromise=require(_0x85b3('0x5'));var Mustache=require(_0x85b3('0x6'));var util=require(_0x85b3('0x7'));var path=require('path');var sox=require(_0x85b3('0x8'));var csv=require(_0x85b3('0x9'));var ejs=require(_0x85b3('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x85b3('0xb'));var squel=require('squel');var crypto=require(_0x85b3('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x85b3('0xd'));var toCsv=require(_0x85b3('0x9'));var querystring=require(_0x85b3('0xe'));var Papa=require(_0x85b3('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x85b3('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x85b3('0x11'))(_0x85b3('0x12'));var utils=require(_0x85b3('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x85b3('0x14'));var db=require(_0x85b3('0x15'))['db'];function respondWithStatusCode(_0x1e62f4,_0x330407){_0x330407=_0x330407||0xcc;return function(_0x3741d4){if(_0x3741d4){return _0x1e62f4[_0x85b3('0x16')](_0x330407);}return _0x1e62f4[_0x85b3('0x17')](_0x330407)[_0x85b3('0x18')]();};}function respondWithResult(_0x1ac078,_0x4cffde){_0x4cffde=_0x4cffde||0xc8;return function(_0x3bc230){if(_0x3bc230){return _0x1ac078[_0x85b3('0x17')](_0x4cffde)[_0x85b3('0x19')](_0x3bc230);}};}function respondWithFilteredResult(_0x38c838,_0x550bc7){return function(_0x38b118){if(_0x38b118){var _0x576d0c=typeof _0x550bc7[_0x85b3('0x1a')]===_0x85b3('0x1b')&&typeof _0x550bc7['limit']===_0x85b3('0x1b');var _0x4922fe=_0x38b118[_0x85b3('0x1c')];var _0x149b04=_0x576d0c?0x0:_0x550bc7[_0x85b3('0x1a')];var _0x5ed250=_0x576d0c?_0x38b118[_0x85b3('0x1c')]:_0x550bc7[_0x85b3('0x1a')]+_0x550bc7[_0x85b3('0x1d')];var _0x15d92b;if(_0x5ed250>=_0x4922fe){_0x5ed250=_0x4922fe;_0x15d92b=0xc8;}else{_0x15d92b=0xce;}_0x38c838[_0x85b3('0x17')](_0x15d92b);return _0x38c838[_0x85b3('0x1e')]('Content-Range',_0x149b04+'-'+_0x5ed250+'/'+_0x4922fe)[_0x85b3('0x19')](_0x38b118);}return null;};}function patchUpdates(_0x12edee){return function(_0x7bc4ac){try{jsonpatch['apply'](_0x7bc4ac,_0x12edee,!![]);}catch(_0x26899b){return BPromise[_0x85b3('0x1f')](_0x26899b);}return _0x7bc4ac[_0x85b3('0x20')]();};}function saveUpdates(_0xb4f2d3,_0x2bcbda){return function(_0x404868){if(_0x404868){return _0x404868[_0x85b3('0x21')](_0xb4f2d3)[_0x85b3('0x22')](function(_0x1f8a7){return _0x1f8a7;});}return null;};}function removeEntity(_0x1d915e,_0x514d94){return function(_0xe42a91){if(_0xe42a91){return _0xe42a91[_0x85b3('0x23')]()[_0x85b3('0x22')](function(){_0x1d915e[_0x85b3('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x42db71,_0x3033b5){return function(_0x523e94){if(!_0x523e94){_0x42db71[_0x85b3('0x16')](0x194);}return _0x523e94;};}function handleError(_0x2763d3,_0x19745a){_0x19745a=_0x19745a||0x1f4;return function(_0x52db23){logger[_0x85b3('0x24')](_0x52db23[_0x85b3('0x25')]);if(_0x52db23[_0x85b3('0x26')]){delete _0x52db23[_0x85b3('0x26')];}_0x2763d3[_0x85b3('0x17')](_0x19745a)['send'](_0x52db23);};}exports[_0x85b3('0x27')]=function(_0x1391f9,_0x4b7472){var _0x3474df={},_0x40a2ef={},_0x258e88={'count':0x0,'rows':[]};var _0x3dbf13=_[_0x85b3('0x28')](db['JscriptySessionReport'][_0x85b3('0x29')],function(_0x427bd0){return{'name':_0x427bd0[_0x85b3('0x2a')],'type':_0x427bd0[_0x85b3('0x2b')]['key']};});_0x40a2ef[_0x85b3('0x2c')]=_[_0x85b3('0x28')](_0x3dbf13,_0x85b3('0x26'));_0x40a2ef[_0x85b3('0x2d')]=_[_0x85b3('0x2e')](_0x1391f9['query']);_0x40a2ef['filters']=_[_0x85b3('0x2f')](_0x40a2ef[_0x85b3('0x2c')],_0x40a2ef['query']);_0x3474df[_0x85b3('0x30')]=_['intersection'](_0x40a2ef[_0x85b3('0x2c')],qs[_0x85b3('0x31')](_0x1391f9['query'][_0x85b3('0x31')]));_0x3474df[_0x85b3('0x30')]=_0x3474df['attributes'][_0x85b3('0x32')]?_0x3474df['attributes']:_0x40a2ef[_0x85b3('0x2c')];if(!_0x1391f9[_0x85b3('0x2d')][_0x85b3('0x33')](_0x85b3('0x34'))){_0x3474df[_0x85b3('0x1d')]=qs[_0x85b3('0x1d')](_0x1391f9['query'][_0x85b3('0x1d')]);_0x3474df[_0x85b3('0x1a')]=qs[_0x85b3('0x1a')](_0x1391f9[_0x85b3('0x2d')]['offset']);}_0x3474df[_0x85b3('0x35')]=qs['sort'](_0x1391f9[_0x85b3('0x2d')]['sort']);_0x3474df['where']=qs[_0x85b3('0x36')](_[_0x85b3('0x37')](_0x1391f9[_0x85b3('0x2d')],_0x40a2ef[_0x85b3('0x36')]),_0x3dbf13);if(_0x1391f9['query']['filter']){_0x3474df['where']=_[_0x85b3('0x38')](_0x3474df[_0x85b3('0x39')],{'$or':_[_0x85b3('0x28')](_0x3dbf13,function(_0x23404e){if(_0x23404e['type']!==_0x85b3('0x3a')){var _0x524e73={};_0x524e73[_0x23404e[_0x85b3('0x26')]]={'$like':'%'+_0x1391f9[_0x85b3('0x2d')]['filter']+'%'};return _0x524e73;}})});}_0x3474df=_[_0x85b3('0x38')]({},_0x3474df,_0x1391f9['options']);var _0x1f7bbe={'where':_0x3474df[_0x85b3('0x39')]};return db['JscriptySessionReport'][_0x85b3('0x1c')](_0x1f7bbe)['then'](function(_0x20b8cc){_0x258e88['count']=_0x20b8cc;if(_0x1391f9[_0x85b3('0x2d')][_0x85b3('0x3b')]){_0x3474df[_0x85b3('0x3c')]=[{'all':!![]}];}return db[_0x85b3('0x3d')][_0x85b3('0x3e')](_0x3474df);})[_0x85b3('0x22')](function(_0x5eadba){_0x258e88[_0x85b3('0x3f')]=_0x5eadba;return _0x258e88;})['then'](respondWithFilteredResult(_0x4b7472,_0x3474df))['catch'](handleError(_0x4b7472,null));};exports[_0x85b3('0x40')]=function(_0x33819a,_0x319b04){var _0x89f05e={'raw':!![],'where':{'id':_0x33819a[_0x85b3('0x41')]['id']}},_0x385d1d={};_0x385d1d['model']=_[_0x85b3('0x2e')](db[_0x85b3('0x3d')][_0x85b3('0x29')]);_0x385d1d['query']=_[_0x85b3('0x2e')](_0x33819a['query']);_0x385d1d[_0x85b3('0x36')]=_['intersection'](_0x385d1d['model'],_0x385d1d[_0x85b3('0x2d')]);_0x89f05e[_0x85b3('0x30')]=_[_0x85b3('0x2f')](_0x385d1d['model'],qs[_0x85b3('0x31')](_0x33819a['query']['fields']));_0x89f05e[_0x85b3('0x30')]=_0x89f05e['attributes'][_0x85b3('0x32')]?_0x89f05e[_0x85b3('0x30')]:_0x385d1d['model'];if(_0x33819a['query'][_0x85b3('0x3b')]){_0x89f05e[_0x85b3('0x3c')]=[{'all':!![]}];}_0x89f05e=_[_0x85b3('0x38')]({},_0x89f05e,_0x33819a[_0x85b3('0x42')]);return db[_0x85b3('0x3d')][_0x85b3('0x43')](_0x89f05e)[_0x85b3('0x22')](handleEntityNotFound(_0x319b04,null))[_0x85b3('0x22')](respondWithResult(_0x319b04,null))[_0x85b3('0x44')](handleError(_0x319b04,null));};exports[_0x85b3('0x45')]=function(_0x53f890,_0x231d88){return db[_0x85b3('0x3d')][_0x85b3('0x45')](_0x53f890[_0x85b3('0x46')],{})[_0x85b3('0x22')](respondWithResult(_0x231d88,0xc9))[_0x85b3('0x44')](handleError(_0x231d88,null));};exports[_0x85b3('0x21')]=function(_0x1b9b37,_0xbe00cb){if(_0x1b9b37[_0x85b3('0x46')]['id']){delete _0x1b9b37['body']['id'];}return db[_0x85b3('0x3d')][_0x85b3('0x43')]({'where':{'id':_0x1b9b37[_0x85b3('0x41')]['id']}})[_0x85b3('0x22')](handleEntityNotFound(_0xbe00cb,null))['then'](saveUpdates(_0x1b9b37[_0x85b3('0x46')],null))[_0x85b3('0x22')](respondWithResult(_0xbe00cb,null))[_0x85b3('0x44')](handleError(_0xbe00cb,null));};exports[_0x85b3('0x23')]=function(_0x17cf41,_0x5b050d){return db[_0x85b3('0x3d')][_0x85b3('0x43')]({'where':{'id':_0x17cf41[_0x85b3('0x41')]['id']}})[_0x85b3('0x22')](handleEntityNotFound(_0x5b050d,null))[_0x85b3('0x22')](removeEntity(_0x5b050d,null))[_0x85b3('0x44')](handleError(_0x5b050d,null));};exports[_0x85b3('0x47')]=function(_0x4dc5db,_0x321608){return db[_0x85b3('0x3d')]['describe']()[_0x85b3('0x22')](respondWithResult(_0x321608,null))[_0x85b3('0x44')](handleError(_0x321608,null));};exports[_0x85b3('0x48')]=function(_0xa62cac,_0x5b72db,_0x4de417){var _0xc5bdc7={'raw':!![],'where':{}};var _0x401c67={};var _0x4fc0f4={'count':0x0,'rows':[]};return db['JscriptySessionReport']['findOne']({'where':{'id':_0xa62cac[_0x85b3('0x41')]['id']}})[_0x85b3('0x22')](handleEntityNotFound(_0x5b72db,null))[_0x85b3('0x22')](function(_0x5e2e47){if(_0x5e2e47){_0x401c67[_0x85b3('0x2c')]=_[_0x85b3('0x2e')](db[_0x85b3('0x49')][_0x85b3('0x29')]);_0x401c67[_0x85b3('0x2d')]=_['keys'](_0xa62cac[_0x85b3('0x2d')]);_0x401c67['filters']=_[_0x85b3('0x2f')](_0x401c67[_0x85b3('0x2c')],_0x401c67[_0x85b3('0x2d')]);_0xc5bdc7[_0x85b3('0x30')]=_['intersection'](_0x401c67[_0x85b3('0x2c')],qs[_0x85b3('0x31')](_0xa62cac['query'][_0x85b3('0x31')]));_0xc5bdc7[_0x85b3('0x30')]=_0xc5bdc7['attributes']['length']?_0xc5bdc7['attributes']:_0x401c67[_0x85b3('0x2c')];if(!_0xa62cac[_0x85b3('0x2d')][_0x85b3('0x33')]('nolimit')){_0xc5bdc7['limit']=qs[_0x85b3('0x1d')](_0xa62cac['query']['limit']);_0xc5bdc7[_0x85b3('0x1a')]=qs['offset'](_0xa62cac[_0x85b3('0x2d')][_0x85b3('0x1a')]);}_0xc5bdc7['order']=qs[_0x85b3('0x4a')](_0xa62cac[_0x85b3('0x2d')]['sort']);_0xc5bdc7[_0x85b3('0x39')]=qs[_0x85b3('0x36')](_[_0x85b3('0x37')](_0xa62cac[_0x85b3('0x2d')],_0x401c67[_0x85b3('0x36')]));_0xc5bdc7[_0x85b3('0x39')][_0x85b3('0x4b')]=_0x5e2e47['id'];if(_0xa62cac[_0x85b3('0x2d')]['filter']){_0xc5bdc7['where']=_[_0x85b3('0x38')](_0xc5bdc7['where'],{'$or':_[_0x85b3('0x28')](_0xc5bdc7['attributes'],function(_0x455b47){var _0x3e5006={};_0x3e5006[_0x455b47]={'$like':'%'+_0xa62cac[_0x85b3('0x2d')][_0x85b3('0x4c')]+'%'};return _0x3e5006;})});}_0xc5bdc7=_['merge']({},_0xc5bdc7,_0xa62cac[_0x85b3('0x42')]);return db['JscriptyQuestionReport']['count']({'where':_0xc5bdc7[_0x85b3('0x39')]})['then'](function(_0x5901b2){_0x4fc0f4[_0x85b3('0x1c')]=_0x5901b2;if(_0xa62cac['query']['includeAll']){_0xc5bdc7[_0x85b3('0x3c')]=[{'all':!![]}];}return db[_0x85b3('0x49')]['findAll'](_0xc5bdc7);})[_0x85b3('0x22')](function(_0x3e9963){_0x4fc0f4[_0x85b3('0x3f')]=_0x3e9963;return _0x4fc0f4;});}})[_0x85b3('0x22')](respondWithFilteredResult(_0x5b72db,_0xc5bdc7))[_0x85b3('0x44')](handleError(_0x5b72db,null));}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.model.js b/server/api/jscriptySessionReport/jscriptySessionReport.model.js index 7e9dbd7..cfd46af 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 _0x4fb4=['./jscriptySessionReport.attributes','exports','define','JscriptySessionReport','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x16d10f,_0x2ba2d5){var _0x50c823=function(_0x44e43f){while(--_0x44e43f){_0x16d10f['push'](_0x16d10f['shift']());}};_0x50c823(++_0x2ba2d5);}(_0x4fb4,0x190));var _0x44fb=function(_0x5ca75e,_0x2395f2){_0x5ca75e=_0x5ca75e-0x0;var _0x270cfb=_0x4fb4[_0x5ca75e];return _0x270cfb;};'use strict';var _=require('lodash');var util=require(_0x44fb('0x0'));var logger=require(_0x44fb('0x1'))(_0x44fb('0x2'));var moment=require(_0x44fb('0x3'));var BPromise=require(_0x44fb('0x4'));var rp=require(_0x44fb('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x44fb('0x6'));var config=require(_0x44fb('0x7'));var attributes=require(_0x44fb('0x8'));module[_0x44fb('0x9')]=function(_0x375d33,_0x173e70){return _0x375d33[_0x44fb('0xa')](_0x44fb('0xb'),attributes,{'tableName':'report_jscripty_sessions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x038b=['report_jscripty_sessions','util','../../config/logger','api','bluebird','path','rimraf','./jscriptySessionReport.attributes','exports','define','JscriptySessionReport'];(function(_0x32ab8d,_0x25bfc6){var _0x27953b=function(_0xf7bbfe){while(--_0xf7bbfe){_0x32ab8d['push'](_0x32ab8d['shift']());}};_0x27953b(++_0x25bfc6);}(_0x038b,0x114));var _0xb038=function(_0x20af90,_0x48e126){_0x20af90=_0x20af90-0x0;var _0x292fa2=_0x038b[_0x20af90];return _0x292fa2;};'use strict';var _=require('lodash');var util=require(_0xb038('0x0'));var logger=require(_0xb038('0x1'))(_0xb038('0x2'));var moment=require('moment');var BPromise=require(_0xb038('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb038('0x4'));var rimraf=require(_0xb038('0x5'));var config=require('../../config/environment');var attributes=require(_0xb038('0x6'));module[_0xb038('0x7')]=function(_0x4fe092,_0x54e1e7){return _0x4fe092[_0xb038('0x8')](_0xb038('0x9'),attributes,{'tableName':_0xb038('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.rpc.js b/server/api/jscriptySessionReport/jscriptySessionReport.rpc.js index d50773c..f8b6715 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 _0x4e2e=['../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','JscriptySessionReport,\x20%s,\x20%s','request\x20sent','JscriptySessionReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x1f9bc9,_0x321bd6){var _0x643523=function(_0x49ece8){while(--_0x49ece8){_0x1f9bc9['push'](_0x1f9bc9['shift']());}};_0x643523(++_0x321bd6);}(_0x4e2e,0x1f2));var _0xe4e2=function(_0x3411de,_0x21665b){_0x3411de=_0x3411de-0x0;var _0x247fa0=_0x4e2e[_0x3411de];return _0x247fa0;};'use strict';var _=require('lodash');var util=require(_0xe4e2('0x0'));var moment=require(_0xe4e2('0x1'));var BPromise=require(_0xe4e2('0x2'));var rs=require(_0xe4e2('0x3'));var fs=require('fs');var Redis=require(_0xe4e2('0x4'));var db=require(_0xe4e2('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xe4e2('0x6'))(_0xe4e2('0x7'));var config=require(_0xe4e2('0x8'));var jayson=require(_0xe4e2('0x9'));var client=jayson['client'][_0xe4e2('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x36b1c6,_0x1c4e64,_0x125338){return new BPromise(function(_0x956c75,_0x27304b){return client[_0xe4e2('0xb')](_0x36b1c6,_0x125338)[_0xe4e2('0xc')](function(_0x4912da){logger[_0xe4e2('0xd')](_0xe4e2('0xe'),_0x1c4e64,_0xe4e2('0xf'));logger['debug'](_0xe4e2('0x10'),_0x1c4e64,_0xe4e2('0xf'),JSON[_0xe4e2('0x11')](_0x4912da));if(_0x4912da[_0xe4e2('0x12')]){if(_0x4912da[_0xe4e2('0x12')]['code']===0x1f4){logger[_0xe4e2('0x12')](_0xe4e2('0xe'),_0x1c4e64,_0x4912da[_0xe4e2('0x12')][_0xe4e2('0x13')]);return _0x27304b(_0x4912da['error'][_0xe4e2('0x13')]);}logger[_0xe4e2('0x12')](_0xe4e2('0xe'),_0x1c4e64,_0x4912da[_0xe4e2('0x12')][_0xe4e2('0x13')]);return _0x956c75(_0x4912da['error']['message']);}else{logger[_0xe4e2('0xd')](_0xe4e2('0xe'),_0x1c4e64,_0xe4e2('0xf'));_0x956c75(_0x4912da[_0xe4e2('0x14')][_0xe4e2('0x13')]);}})['catch'](function(_0x754778){logger[_0xe4e2('0x12')](_0xe4e2('0xe'),_0x1c4e64,_0x754778);_0x27304b(_0x754778);});});} \ No newline at end of file +var _0x9582=['error','code','message','info','result','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','JscriptySessionReport,\x20%s,\x20%s','debug','JscriptySessionReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x4d99b0,_0x1f7565){var _0x57ad78=function(_0x21f1a5){while(--_0x21f1a5){_0x4d99b0['push'](_0x4d99b0['shift']());}};_0x57ad78(++_0x1f7565);}(_0x9582,0x95));var _0x2958=function(_0x12d042,_0x3316d5){_0x12d042=_0x12d042-0x0;var _0x57f951=_0x9582[_0x12d042];return _0x57f951;};'use strict';var _=require(_0x2958('0x0'));var util=require(_0x2958('0x1'));var moment=require(_0x2958('0x2'));var BPromise=require(_0x2958('0x3'));var rs=require(_0x2958('0x4'));var fs=require('fs');var Redis=require(_0x2958('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x2958('0x6'));var logger=require(_0x2958('0x7'))(_0x2958('0x8'));var config=require(_0x2958('0x9'));var jayson=require(_0x2958('0xa'));var client=jayson[_0x2958('0xb')][_0x2958('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x309525,_0xa385ec,_0x2e571b){return new BPromise(function(_0x56ca85,_0x5ec1b3){return client[_0x2958('0xd')](_0x309525,_0x2e571b)['then'](function(_0x10db1e){logger['info'](_0x2958('0xe'),_0xa385ec,'request\x20sent');logger[_0x2958('0xf')](_0x2958('0x10'),_0xa385ec,_0x2958('0x11'),JSON[_0x2958('0x12')](_0x10db1e));if(_0x10db1e[_0x2958('0x13')]){if(_0x10db1e['error'][_0x2958('0x14')]===0x1f4){logger[_0x2958('0x13')](_0x2958('0xe'),_0xa385ec,_0x10db1e[_0x2958('0x13')][_0x2958('0x15')]);return _0x5ec1b3(_0x10db1e[_0x2958('0x13')][_0x2958('0x15')]);}logger[_0x2958('0x13')]('JscriptySessionReport,\x20%s,\x20%s',_0xa385ec,_0x10db1e[_0x2958('0x13')][_0x2958('0x15')]);return _0x56ca85(_0x10db1e['error']['message']);}else{logger[_0x2958('0x16')](_0x2958('0xe'),_0xa385ec,'request\x20sent');_0x56ca85(_0x10db1e[_0x2958('0x17')]['message']);}})['catch'](function(_0x429d42){logger[_0x2958('0x13')]('JscriptySessionReport,\x20%s,\x20%s',_0xa385ec,_0x429d42);_0x5ec1b3(_0x429d42);});});} \ No newline at end of file diff --git a/server/api/license/index.js b/server/api/license/index.js index c13845f..5bebd74 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 _0x8f04=['../../components/interaction/service','../../config/environment','get','index','put','isAuthenticated','update','exports','multer','util','connect-timeout','express','fs-extra','../../components/auth/service'];(function(_0x289e48,_0x2fe387){var _0x56d497=function(_0x2abb13){while(--_0x2abb13){_0x289e48['push'](_0x289e48['shift']());}};_0x56d497(++_0x2fe387);}(_0x8f04,0xda));var _0x48f0=function(_0x1e6f26,_0x27d992){_0x1e6f26=_0x1e6f26-0x0;var _0x4820f9=_0x8f04[_0x1e6f26];return _0x4820f9;};'use strict';var multer=require(_0x48f0('0x0'));var util=require(_0x48f0('0x1'));var path=require('path');var timeout=require(_0x48f0('0x2'));var express=require(_0x48f0('0x3'));var router=express['Router']();var fs_extra=require(_0x48f0('0x4'));var auth=require(_0x48f0('0x5'));var interaction=require(_0x48f0('0x6'));var config=require(_0x48f0('0x7'));var controller=require('./license.controller');router[_0x48f0('0x8')]('/',controller[_0x48f0('0x9')]);router[_0x48f0('0xa')]('/:id',auth[_0x48f0('0xb')](),controller[_0x48f0('0xc')]);router[_0x48f0('0x8')]('/download_log_file',auth[_0x48f0('0xb')](),controller['downloadLogFile']);module[_0x48f0('0xd')]=router; \ No newline at end of file +var _0x12f5=['get','index','put','/:id','isAuthenticated','update','/download_log_file','downloadLogFile','exports','util','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x2b434d,_0x58c6f7){var _0x29e492=function(_0x27ef49){while(--_0x27ef49){_0x2b434d['push'](_0x2b434d['shift']());}};_0x29e492(++_0x58c6f7);}(_0x12f5,0x171));var _0x512f=function(_0x465a0c,_0x19d4d5){_0x465a0c=_0x465a0c-0x0;var _0x1e202e=_0x12f5[_0x465a0c];return _0x1e202e;};'use strict';var multer=require('multer');var util=require(_0x512f('0x0'));var path=require(_0x512f('0x1'));var timeout=require('connect-timeout');var express=require(_0x512f('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x512f('0x3'));var interaction=require(_0x512f('0x4'));var config=require(_0x512f('0x5'));var controller=require('./license.controller');router[_0x512f('0x6')]('/',controller[_0x512f('0x7')]);router[_0x512f('0x8')](_0x512f('0x9'),auth[_0x512f('0xa')](),controller[_0x512f('0xb')]);router[_0x512f('0x6')](_0x512f('0xc'),auth[_0x512f('0xa')](),controller[_0x512f('0xd')]);module[_0x512f('0xe')]=router; \ No newline at end of file diff --git a/server/api/license/license.attributes.js b/server/api/license/license.attributes.js index 910308f..0791dfc 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 _0xfd5c=['sequelize','exports','STRING'];(function(_0x4ae6ef,_0xc2af80){var _0x3cbb4e=function(_0x569ad5){while(--_0x569ad5){_0x4ae6ef['push'](_0x4ae6ef['shift']());}};_0x3cbb4e(++_0xc2af80);}(_0xfd5c,0x19e));var _0xcfd5=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xfd5c[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xcfd5('0x0'));module[_0xcfd5('0x1')]={'license':{'type':Sequelize['TEXT']},'data1':{'type':Sequelize[_0xcfd5('0x2')]},'data2':{'type':Sequelize['STRING']},'chatLicenseExceeded':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x9fa9=['INTEGER','exports','TEXT','STRING'];(function(_0x2f375c,_0x534764){var _0x22c4f8=function(_0x20bec3){while(--_0x20bec3){_0x2f375c['push'](_0x2f375c['shift']());}};_0x22c4f8(++_0x534764);}(_0x9fa9,0x195));var _0x99fa=function(_0x599c3e,_0x28796c){_0x599c3e=_0x599c3e-0x0;var _0x244fe6=_0x9fa9[_0x599c3e];return _0x244fe6;};'use strict';var Sequelize=require('sequelize');module[_0x99fa('0x0')]={'license':{'type':Sequelize[_0x99fa('0x1')]},'data1':{'type':Sequelize[_0x99fa('0x2')]},'data2':{'type':Sequelize[_0x99fa('0x2')]},'chatLicenseExceeded':{'type':Sequelize[_0x99fa('0x3')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/license/license.controller.js b/server/api/license/license.controller.js index 50051a0..3cf2f3a 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 _0x430a=['json','offset','undefined','count','limit','Content-Range','apply','reject','save','update','destroy','then','error','stack','name','send','../../config/license/util','License','query','keys','filters','model','attributes','fields','length','merge','options','getLicense','catch','body','params','get','checkLicense','key','downloadLogFile','log','xcally','setHeader','attachment;\x20filename=','set','Content-Type','download','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status'];(function(_0x37c9e6,_0x3233d7){var _0x54c830=function(_0x5aa834){while(--_0x5aa834){_0x37c9e6['push'](_0x37c9e6['shift']());}};_0x54c830(++_0x3233d7);}(_0x430a,0x1e0));var _0xa430=function(_0x20c4fe,_0x308afc){_0x20c4fe=_0x20c4fe-0x0;var _0x585c12=_0x430a[_0x20c4fe];return _0x585c12;};'use strict';var emlformat=require(_0xa430('0x0'));var rimraf=require(_0xa430('0x1'));var zipdir=require(_0xa430('0x2'));var jsonpatch=require(_0xa430('0x3'));var rp=require(_0xa430('0x4'));var moment=require(_0xa430('0x5'));var BPromise=require(_0xa430('0x6'));var Mustache=require(_0xa430('0x7'));var util=require('util');var path=require(_0xa430('0x8'));var sox=require(_0xa430('0x9'));var csv=require(_0xa430('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xa430('0xb'));var _=require(_0xa430('0xc'));var squel=require(_0xa430('0xd'));var crypto=require('crypto');var jsforce=require(_0xa430('0xe'));var deskjs=require(_0xa430('0xf'));var toCsv=require('to-csv');var querystring=require(_0xa430('0x10'));var Papa=require(_0xa430('0x11'));var Redis=require(_0xa430('0x12'));var authService=require(_0xa430('0x13'));var qs=require(_0xa430('0x14'));var as=require(_0xa430('0x15'));var hardwareService=require(_0xa430('0x16'));var logger=require(_0xa430('0x17'))(_0xa430('0x18'));var utils=require(_0xa430('0x19'));var config=require(_0xa430('0x1a'));var licenseUtil=require('../../config/license/util');var db=require(_0xa430('0x1b'))['db'];function respondWithStatusCode(_0x59229c,_0x1321b0){_0x1321b0=_0x1321b0||0xcc;return function(_0x587364){if(_0x587364){return _0x59229c[_0xa430('0x1c')](_0x1321b0);}return _0x59229c['status'](_0x1321b0)[_0xa430('0x1d')]();};}function respondWithResult(_0x3759b3,_0x297acb){_0x297acb=_0x297acb||0xc8;return function(_0x174c22){if(_0x174c22){return _0x3759b3[_0xa430('0x1e')](_0x297acb)[_0xa430('0x1f')](_0x174c22);}};}function respondWithFilteredResult(_0x261a65,_0x304da2){return function(_0xb64f18){if(_0xb64f18){var _0x4099ca=typeof _0x304da2[_0xa430('0x20')]===_0xa430('0x21')&&typeof _0x304da2['limit']==='undefined';var _0x461f3f=_0xb64f18[_0xa430('0x22')];var _0x5a6f12=_0x4099ca?0x0:_0x304da2[_0xa430('0x20')];var _0x42074e=_0x4099ca?_0xb64f18[_0xa430('0x22')]:_0x304da2[_0xa430('0x20')]+_0x304da2[_0xa430('0x23')];var _0x1ab432;if(_0x42074e>=_0x461f3f){_0x42074e=_0x461f3f;_0x1ab432=0xc8;}else{_0x1ab432=0xce;}_0x261a65[_0xa430('0x1e')](_0x1ab432);return _0x261a65['set'](_0xa430('0x24'),_0x5a6f12+'-'+_0x42074e+'/'+_0x461f3f)[_0xa430('0x1f')](_0xb64f18);}return null;};}function patchUpdates(_0x178961){return function(_0x582b1d){try{jsonpatch[_0xa430('0x25')](_0x582b1d,_0x178961,!![]);}catch(_0x9dc384){return BPromise[_0xa430('0x26')](_0x9dc384);}return _0x582b1d[_0xa430('0x27')]();};}function saveUpdates(_0xb7ee05,_0x5a0eeb){return function(_0x5eb86c){if(_0x5eb86c){return _0x5eb86c[_0xa430('0x28')](_0xb7ee05)['then'](function(_0x22ca96){return _0x22ca96;});}return null;};}function removeEntity(_0x4f4c8c,_0x139091){return function(_0x190674){if(_0x190674){return _0x190674[_0xa430('0x29')]()[_0xa430('0x2a')](function(){_0x4f4c8c[_0xa430('0x1e')](0xcc)[_0xa430('0x1d')]();});}};}function handleEntityNotFound(_0x540a5c,_0x54b6eb){return function(_0x12d137){if(!_0x12d137){_0x540a5c['sendStatus'](0x194);}return _0x12d137;};}function handleError(_0xd18735,_0x3bb78f){_0x3bb78f=_0x3bb78f||0x1f4;return function(_0x552fb4){logger[_0xa430('0x2b')](_0x552fb4[_0xa430('0x2c')]);if(_0x552fb4[_0xa430('0x2d')]){delete _0x552fb4['name'];}_0xd18735[_0xa430('0x1e')](_0x3bb78f)[_0xa430('0x2e')](_0x552fb4);};}var utilLicense=require(_0xa430('0x2f'));exports['index']=function(_0x4181f7,_0x4ffbea){var _0x12d6bc={'raw':!![],'where':{'id':0x1}},_0x3d1666={};_0x3d1666['model']=_['keys'](db[_0xa430('0x30')]['rawAttributes']);_0x3d1666[_0xa430('0x31')]=_[_0xa430('0x32')](_0x4181f7[_0xa430('0x31')]);_0x3d1666[_0xa430('0x33')]=_['intersection'](_0x3d1666[_0xa430('0x34')],_0x3d1666[_0xa430('0x31')]);_0x12d6bc[_0xa430('0x35')]=_['intersection'](_0x3d1666[_0xa430('0x34')],qs[_0xa430('0x36')](_0x4181f7[_0xa430('0x31')][_0xa430('0x36')]));_0x12d6bc[_0xa430('0x35')]=_0x12d6bc[_0xa430('0x35')][_0xa430('0x37')]?_0x12d6bc[_0xa430('0x35')]:_0x3d1666[_0xa430('0x34')];_0x12d6bc=_[_0xa430('0x38')]({},_0x12d6bc,_0x4181f7[_0xa430('0x39')]);return utilLicense[_0xa430('0x3a')](_0x12d6bc)['then'](respondWithResult(_0x4ffbea,null))[_0xa430('0x3b')](handleError(_0x4ffbea,null));};exports['update']=function(_0x8dbb9a,_0x40fad7){if(_0x8dbb9a[_0xa430('0x3c')]['id']){delete _0x8dbb9a['body']['id'];}return db[_0xa430('0x30')]['find']({'where':{'id':_0x8dbb9a[_0xa430('0x3d')]['id']}})['then'](handleEntityNotFound(_0x40fad7,null))[_0xa430('0x2a')](function(_0x4f1d9e){var _0x3c844e=_0x4f1d9e[_0xa430('0x3e')]({'plain':!![]});return utilLicense[_0xa430('0x3f')](_0x3c844e,_0x8dbb9a[_0xa430('0x3c')][_0xa430('0x40')]);})[_0xa430('0x2a')](function(_0x40b7af){if(!_0x40b7af['demo']){return saveUpdates(_0x8dbb9a[_0xa430('0x3c')],null);}return _0x40b7af;})['then'](respondWithResult(_0x40fad7,null))['catch'](handleError(_0x40fad7,null));};exports[_0xa430('0x41')]=function(_0x57ae56,_0xb350ec){var _0x4b1c0f='license-info.log';var _0x672ed4=path['join']('/var',_0xa430('0x42'),_0xa430('0x43'),_0x4b1c0f);_0xb350ec[_0xa430('0x44')]('Content-disposition',_0xa430('0x45')+_0x4b1c0f);_0xb350ec[_0xa430('0x46')](_0xa430('0x47'),'text/plain');_0xb350ec[_0xa430('0x48')](_0x672ed4);}; \ No newline at end of file +var _0x71e7=['download','eml-format','zip-dir','request-promise','moment','bluebird','mustache','path','to-csv','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','count','limit','set','apply','reject','update','then','destroy','end','error','name','send','index','model','keys','License','rawAttributes','query','attributes','intersection','fields','length','merge','options','getLicense','catch','body','get','key','demo','downloadLogFile','license-info.log','join','/var','log','setHeader','Content-Type','text/plain'];(function(_0x4591db,_0x24c100){var _0x244255=function(_0x1c3a71){while(--_0x1c3a71){_0x4591db['push'](_0x4591db['shift']());}};_0x244255(++_0x24c100);}(_0x71e7,0x14b));var _0x771e=function(_0x1bea9e,_0x258985){_0x1bea9e=_0x1bea9e-0x0;var _0xafd9be=_0x71e7[_0x1bea9e];return _0xafd9be;};'use strict';var emlformat=require(_0x771e('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x771e('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x771e('0x2'));var moment=require(_0x771e('0x3'));var BPromise=require(_0x771e('0x4'));var Mustache=require(_0x771e('0x5'));var util=require('util');var path=require(_0x771e('0x6'));var sox=require('sox');var csv=require(_0x771e('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x771e('0x8'));var squel=require(_0x771e('0x9'));var crypto=require(_0x771e('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x771e('0xb'));var toCsv=require(_0x771e('0x7'));var querystring=require('querystring');var Papa=require(_0x771e('0xc'));var Redis=require(_0x771e('0xd'));var authService=require(_0x771e('0xe'));var qs=require(_0x771e('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x771e('0x10'));var logger=require(_0x771e('0x11'))('api');var utils=require(_0x771e('0x12'));var config=require(_0x771e('0x13'));var licenseUtil=require(_0x771e('0x14'));var db=require(_0x771e('0x15'))['db'];function respondWithStatusCode(_0x265581,_0x17660d){_0x17660d=_0x17660d||0xcc;return function(_0xe68376){if(_0xe68376){return _0x265581[_0x771e('0x16')](_0x17660d);}return _0x265581[_0x771e('0x17')](_0x17660d)['end']();};}function respondWithResult(_0x363f18,_0x11004f){_0x11004f=_0x11004f||0xc8;return function(_0x50f0e6){if(_0x50f0e6){return _0x363f18[_0x771e('0x17')](_0x11004f)[_0x771e('0x18')](_0x50f0e6);}};}function respondWithFilteredResult(_0x259f42,_0xe3e628){return function(_0x1f658f){if(_0x1f658f){var _0x1ef3bf=typeof _0xe3e628[_0x771e('0x19')]===_0x771e('0x1a')&&typeof _0xe3e628['limit']===_0x771e('0x1a');var _0x143ad5=_0x1f658f[_0x771e('0x1b')];var _0x19e37d=_0x1ef3bf?0x0:_0xe3e628[_0x771e('0x19')];var _0xdf6ae4=_0x1ef3bf?_0x1f658f[_0x771e('0x1b')]:_0xe3e628[_0x771e('0x19')]+_0xe3e628[_0x771e('0x1c')];var _0x28a3d1;if(_0xdf6ae4>=_0x143ad5){_0xdf6ae4=_0x143ad5;_0x28a3d1=0xc8;}else{_0x28a3d1=0xce;}_0x259f42[_0x771e('0x17')](_0x28a3d1);return _0x259f42[_0x771e('0x1d')]('Content-Range',_0x19e37d+'-'+_0xdf6ae4+'/'+_0x143ad5)[_0x771e('0x18')](_0x1f658f);}return null;};}function patchUpdates(_0x112fea){return function(_0xa26e06){try{jsonpatch[_0x771e('0x1e')](_0xa26e06,_0x112fea,!![]);}catch(_0x1c5128){return BPromise[_0x771e('0x1f')](_0x1c5128);}return _0xa26e06['save']();};}function saveUpdates(_0x586918,_0x1bc4b6){return function(_0x389fe9){if(_0x389fe9){return _0x389fe9[_0x771e('0x20')](_0x586918)[_0x771e('0x21')](function(_0x17e1c6){return _0x17e1c6;});}return null;};}function removeEntity(_0x541521,_0x3a816e){return function(_0x5bfbdf){if(_0x5bfbdf){return _0x5bfbdf[_0x771e('0x22')]()[_0x771e('0x21')](function(){_0x541521[_0x771e('0x17')](0xcc)[_0x771e('0x23')]();});}};}function handleEntityNotFound(_0x468fb7,_0x2515df){return function(_0x1e6c74){if(!_0x1e6c74){_0x468fb7[_0x771e('0x16')](0x194);}return _0x1e6c74;};}function handleError(_0x16ebcd,_0x207467){_0x207467=_0x207467||0x1f4;return function(_0x2dcd6b){logger[_0x771e('0x24')](_0x2dcd6b['stack']);if(_0x2dcd6b[_0x771e('0x25')]){delete _0x2dcd6b['name'];}_0x16ebcd['status'](_0x207467)[_0x771e('0x26')](_0x2dcd6b);};}var utilLicense=require(_0x771e('0x14'));exports[_0x771e('0x27')]=function(_0x5973a9,_0x1bb8cc){var _0x3a1d6f={'raw':!![],'where':{'id':0x1}},_0x4575db={};_0x4575db[_0x771e('0x28')]=_[_0x771e('0x29')](db[_0x771e('0x2a')][_0x771e('0x2b')]);_0x4575db[_0x771e('0x2c')]=_[_0x771e('0x29')](_0x5973a9[_0x771e('0x2c')]);_0x4575db['filters']=_['intersection'](_0x4575db[_0x771e('0x28')],_0x4575db['query']);_0x3a1d6f[_0x771e('0x2d')]=_[_0x771e('0x2e')](_0x4575db[_0x771e('0x28')],qs[_0x771e('0x2f')](_0x5973a9[_0x771e('0x2c')][_0x771e('0x2f')]));_0x3a1d6f['attributes']=_0x3a1d6f[_0x771e('0x2d')][_0x771e('0x30')]?_0x3a1d6f['attributes']:_0x4575db['model'];_0x3a1d6f=_[_0x771e('0x31')]({},_0x3a1d6f,_0x5973a9[_0x771e('0x32')]);return utilLicense[_0x771e('0x33')](_0x3a1d6f)[_0x771e('0x21')](respondWithResult(_0x1bb8cc,null))[_0x771e('0x34')](handleError(_0x1bb8cc,null));};exports[_0x771e('0x20')]=function(_0x425907,_0x63ccb){if(_0x425907[_0x771e('0x35')]['id']){delete _0x425907[_0x771e('0x35')]['id'];}return db[_0x771e('0x2a')]['find']({'where':{'id':_0x425907['params']['id']}})[_0x771e('0x21')](handleEntityNotFound(_0x63ccb,null))[_0x771e('0x21')](function(_0x4728f1){var _0x2581b6=_0x4728f1[_0x771e('0x36')]({'plain':!![]});return utilLicense['checkLicense'](_0x2581b6,_0x425907['body'][_0x771e('0x37')]);})[_0x771e('0x21')](function(_0x1a3255){if(!_0x1a3255[_0x771e('0x38')]){return saveUpdates(_0x425907[_0x771e('0x35')],null);}return _0x1a3255;})[_0x771e('0x21')](respondWithResult(_0x63ccb,null))[_0x771e('0x34')](handleError(_0x63ccb,null));};exports[_0x771e('0x39')]=function(_0x39d78c,_0x1da293){var _0x587f13=_0x771e('0x3a');var _0x576924=path[_0x771e('0x3b')](_0x771e('0x3c'),_0x771e('0x3d'),'xcally',_0x587f13);_0x1da293[_0x771e('0x3e')]('Content-disposition','attachment;\x20filename='+_0x587f13);_0x1da293[_0x771e('0x1d')](_0x771e('0x3f'),_0x771e('0x40'));_0x1da293[_0x771e('0x41')](_0x576924);}; \ No newline at end of file diff --git a/server/api/license/license.model.js b/server/api/license/license.model.js index 60b9ecd..f7b0d96 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 _0x79d2=['rimraf','../../config/environment','exports','define','License','license','lodash','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x49b207,_0x408ade){var _0x2dc8fa=function(_0x150975){while(--_0x150975){_0x49b207['push'](_0x49b207['shift']());}};_0x2dc8fa(++_0x408ade);}(_0x79d2,0xc9));var _0x279d=function(_0xf3ae5e,_0x385757){_0xf3ae5e=_0xf3ae5e-0x0;var _0x353c92=_0x79d2[_0xf3ae5e];return _0x353c92;};'use strict';var _=require(_0x279d('0x0'));var util=require('util');var logger=require(_0x279d('0x1'))(_0x279d('0x2'));var moment=require(_0x279d('0x3'));var BPromise=require(_0x279d('0x4'));var rp=require(_0x279d('0x5'));var fs=require('fs');var path=require(_0x279d('0x6'));var rimraf=require(_0x279d('0x7'));var config=require(_0x279d('0x8'));var attributes=require('./license.attributes');module[_0x279d('0x9')]=function(_0x396d9a,_0x507316){return _0x396d9a[_0x279d('0xa')](_0x279d('0xb'),attributes,{'tableName':_0x279d('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb460=['request-promise','path','rimraf','../../config/environment','./license.attributes','exports','define','License','license','lodash','util','../../config/logger','moment'];(function(_0x107581,_0x395d26){var _0x24ca48=function(_0x49f5a6){while(--_0x49f5a6){_0x107581['push'](_0x107581['shift']());}};_0x24ca48(++_0x395d26);}(_0xb460,0x1a9));var _0x0b46=function(_0x448510,_0x16fa6c){_0x448510=_0x448510-0x0;var _0x552a06=_0xb460[_0x448510];return _0x552a06;};'use strict';var _=require(_0x0b46('0x0'));var util=require(_0x0b46('0x1'));var logger=require(_0x0b46('0x2'))('api');var moment=require(_0x0b46('0x3'));var BPromise=require('bluebird');var rp=require(_0x0b46('0x4'));var fs=require('fs');var path=require(_0x0b46('0x5'));var rimraf=require(_0x0b46('0x6'));var config=require(_0x0b46('0x7'));var attributes=require(_0x0b46('0x8'));module[_0x0b46('0x9')]=function(_0x2455f0,_0x5f4592){return _0x2455f0[_0x0b46('0xa')](_0x0b46('0xb'),attributes,{'tableName':_0x0b46('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/license/license.rpc.js b/server/api/license/license.rpc.js index 6a3d4d6..3e90c02 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 _0x4957=['debug','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','http','request','then','info','License,\x20%s,\x20%s','request\x20sent'];(function(_0x2c97a9,_0xd6a400){var _0x26b5aa=function(_0x3c5cf7){while(--_0x3c5cf7){_0x2c97a9['push'](_0x2c97a9['shift']());}};_0x26b5aa(++_0xd6a400);}(_0x4957,0xbf));var _0x7495=function(_0x29db36,_0x410ae9){_0x29db36=_0x29db36-0x0;var _0x234e87=_0x4957[_0x29db36];return _0x234e87;};'use strict';var _=require(_0x7495('0x0'));var util=require(_0x7495('0x1'));var moment=require(_0x7495('0x2'));var BPromise=require(_0x7495('0x3'));var rs=require(_0x7495('0x4'));var fs=require('fs');var Redis=require(_0x7495('0x5'));var db=require(_0x7495('0x6'))['db'];var utils=require(_0x7495('0x7'));var logger=require('../../config/logger')(_0x7495('0x8'));var config=require('../../config/environment');var jayson=require(_0x7495('0x9'));var client=jayson['client'][_0x7495('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x25cf5d,_0x9e9134,_0x388d51){return new BPromise(function(_0x513aae,_0x4af3f5){return client[_0x7495('0xb')](_0x25cf5d,_0x388d51)[_0x7495('0xc')](function(_0x1ff1f5){logger[_0x7495('0xd')](_0x7495('0xe'),_0x9e9134,_0x7495('0xf'));logger[_0x7495('0x10')]('License,\x20%s,\x20%s,\x20%s',_0x9e9134,_0x7495('0xf'),JSON[_0x7495('0x11')](_0x1ff1f5));if(_0x1ff1f5[_0x7495('0x12')]){if(_0x1ff1f5['error'][_0x7495('0x13')]===0x1f4){logger[_0x7495('0x12')](_0x7495('0xe'),_0x9e9134,_0x1ff1f5['error']['message']);return _0x4af3f5(_0x1ff1f5[_0x7495('0x12')][_0x7495('0x14')]);}logger['error'](_0x7495('0xe'),_0x9e9134,_0x1ff1f5[_0x7495('0x12')][_0x7495('0x14')]);return _0x513aae(_0x1ff1f5[_0x7495('0x12')]['message']);}else{logger[_0x7495('0xd')](_0x7495('0xe'),_0x9e9134,_0x7495('0xf'));_0x513aae(_0x1ff1f5[_0x7495('0x15')][_0x7495('0x14')]);}})[_0x7495('0x16')](function(_0x5e5c4b){logger['error'](_0x7495('0xe'),_0x9e9134,_0x5e5c4b);_0x4af3f5(_0x5e5c4b);});});} \ No newline at end of file +var _0x4f84=['info','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','License,\x20%s,\x20%s','debug','License,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message'];(function(_0x2bf081,_0x23ca2f){var _0x19dbb0=function(_0x123f1d){while(--_0x123f1d){_0x2bf081['push'](_0x2bf081['shift']());}};_0x19dbb0(++_0x23ca2f);}(_0x4f84,0x1a3));var _0x44f8=function(_0x293caa,_0x10c8a3){_0x293caa=_0x293caa-0x0;var _0x5ec971=_0x4f84[_0x293caa];return _0x5ec971;};'use strict';var _=require(_0x44f8('0x0'));var util=require(_0x44f8('0x1'));var moment=require(_0x44f8('0x2'));var BPromise=require(_0x44f8('0x3'));var rs=require(_0x44f8('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x44f8('0x5'))['db'];var utils=require(_0x44f8('0x6'));var logger=require(_0x44f8('0x7'))(_0x44f8('0x8'));var config=require(_0x44f8('0x9'));var jayson=require(_0x44f8('0xa'));var client=jayson[_0x44f8('0xb')][_0x44f8('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x178b6b,_0x672a1c,_0x1974a6){return new BPromise(function(_0x167914,_0x24b5bf){return client[_0x44f8('0xd')](_0x178b6b,_0x1974a6)[_0x44f8('0xe')](function(_0x558c06){logger['info'](_0x44f8('0xf'),_0x672a1c,'request\x20sent');logger[_0x44f8('0x10')](_0x44f8('0x11'),_0x672a1c,_0x44f8('0x12'),JSON[_0x44f8('0x13')](_0x558c06));if(_0x558c06[_0x44f8('0x14')]){if(_0x558c06[_0x44f8('0x14')][_0x44f8('0x15')]===0x1f4){logger['error'](_0x44f8('0xf'),_0x672a1c,_0x558c06[_0x44f8('0x14')][_0x44f8('0x16')]);return _0x24b5bf(_0x558c06[_0x44f8('0x14')][_0x44f8('0x16')]);}logger[_0x44f8('0x14')]('License,\x20%s,\x20%s',_0x672a1c,_0x558c06[_0x44f8('0x14')][_0x44f8('0x16')]);return _0x167914(_0x558c06['error']['message']);}else{logger[_0x44f8('0x17')](_0x44f8('0xf'),_0x672a1c,_0x44f8('0x12'));_0x167914(_0x558c06[_0x44f8('0x18')][_0x44f8('0x16')]);}})[_0x44f8('0x19')](function(_0x59785f){logger['error'](_0x44f8('0xf'),_0x672a1c,_0x59785f);_0x24b5bf(_0x59785f);});});} \ No newline at end of file diff --git a/server/api/mailAccount/index.js b/server/api/mailAccount/index.js index a511ad5..1d93b04 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 _0x9159=['path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./mailAccount.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/in_servers','getImap','/:id/out_servers','getSmtp','/:id/interactions','getInteractions','getApplications','getMessages','/:id/verify','verifySmtp','/:id/users','getAgents','post','create','addImap','addSmtp','addInteraction','/:id/applications','addApplications','/:id/send','send','addAgents','put','update','delete','removeAnswers','destroy','removeAgents','exports','multer','util'];(function(_0x449796,_0x143ded){var _0x435666=function(_0x3522ab){while(--_0x3522ab){_0x449796['push'](_0x449796['shift']());}};_0x435666(++_0x143ded);}(_0x9159,0x155));var _0x9915=function(_0x1597e2,_0x388d3e){_0x1597e2=_0x1597e2-0x0;var _0x4c8c0a=_0x9159[_0x1597e2];return _0x4c8c0a;};'use strict';var multer=require(_0x9915('0x0'));var util=require(_0x9915('0x1'));var path=require(_0x9915('0x2'));var timeout=require(_0x9915('0x3'));var express=require(_0x9915('0x4'));var router=express[_0x9915('0x5')]();var fs_extra=require(_0x9915('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x9915('0x7'));var config=require('../../config/environment');var controller=require(_0x9915('0x8'));router[_0x9915('0x9')]('/',auth[_0x9915('0xa')](),controller[_0x9915('0xb')]);router['get'](_0x9915('0xc'),auth[_0x9915('0xa')](),controller[_0x9915('0xd')]);router[_0x9915('0x9')](_0x9915('0xe'),auth[_0x9915('0xa')](),controller[_0x9915('0xf')]);router['get'](_0x9915('0x10'),auth[_0x9915('0xa')](),controller[_0x9915('0x11')]);router[_0x9915('0x9')](_0x9915('0x12'),auth[_0x9915('0xa')](),controller[_0x9915('0x13')]);router[_0x9915('0x9')](_0x9915('0x14'),auth[_0x9915('0xa')](),controller[_0x9915('0x15')]);router[_0x9915('0x9')](_0x9915('0x16'),auth['isAuthenticated'](),controller[_0x9915('0x17')]);router[_0x9915('0x9')](_0x9915('0x18'),auth['isAuthenticated'](),controller[_0x9915('0x19')]);router['get']('/:id/applications',auth[_0x9915('0xa')](),controller[_0x9915('0x1a')]);router['get']('/:id/messages',auth[_0x9915('0xa')](),controller[_0x9915('0x1b')]);router['get'](_0x9915('0x1c'),auth[_0x9915('0xa')](),controller[_0x9915('0x1d')]);router[_0x9915('0x9')](_0x9915('0x1e'),auth[_0x9915('0xa')](),controller[_0x9915('0x1f')]);router[_0x9915('0x20')](_0x9915('0x10'),auth[_0x9915('0xa')](),controller['addDisposition']);router[_0x9915('0x20')](_0x9915('0x12'),auth['isAuthenticated'](),controller['addAnswer']);router['post']('/',auth['isAuthenticated'](),controller[_0x9915('0x21')]);router['post'](_0x9915('0x14'),auth[_0x9915('0xa')](),controller[_0x9915('0x22')]);router[_0x9915('0x20')](_0x9915('0x16'),auth[_0x9915('0xa')](),controller[_0x9915('0x23')]);router[_0x9915('0x20')](_0x9915('0x18'),auth[_0x9915('0xa')](),controller[_0x9915('0x24')]);router[_0x9915('0x20')](_0x9915('0x25'),auth[_0x9915('0xa')](),controller[_0x9915('0x26')]);router['post'](_0x9915('0x27'),auth[_0x9915('0xa')](),controller[_0x9915('0x28')]);router['post']('/:id/users',auth[_0x9915('0xa')](),controller[_0x9915('0x29')]);router[_0x9915('0x2a')]('/:id',auth[_0x9915('0xa')](),controller[_0x9915('0x2b')]);router[_0x9915('0x2c')](_0x9915('0x10'),auth['isAuthenticated'](),controller['removeDispositions']);router[_0x9915('0x2c')](_0x9915('0x12'),auth[_0x9915('0xa')](),controller[_0x9915('0x2d')]);router[_0x9915('0x2c')](_0x9915('0x14'),auth[_0x9915('0xa')](),controller['removeImap']);router['delete'](_0x9915('0x16'),auth[_0x9915('0xa')](),controller['removeSmtp']);router[_0x9915('0x2c')]('/:id',auth['isAuthenticated'](),controller[_0x9915('0x2e')]);router[_0x9915('0x2c')](_0x9915('0x1e'),auth[_0x9915('0xa')](),controller[_0x9915('0x2f')]);module[_0x9915('0x30')]=router; \ No newline at end of file +var _0x2e23=['/:id/interactions','getInteractions','/:id/messages','getMessages','/:id/verify','verifySmtp','/:id/users','getAgents','addDisposition','post','addAnswer','addImap','addInteraction','/:id/applications','/:id/send','send','delete','removeAnswers','removeImap','removeSmtp','/:id','destroy','exports','multer','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./mailAccount.controller','get','/describe','isAuthenticated','describe','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/in_servers','/:id/out_servers','getSmtp'];(function(_0x3ad08b,_0x356065){var _0xc01bd6=function(_0x2ee436){while(--_0x2ee436){_0x3ad08b['push'](_0x3ad08b['shift']());}};_0xc01bd6(++_0x356065);}(_0x2e23,0x6b));var _0x32e2=function(_0x15bc81,_0x4d4f77){_0x15bc81=_0x15bc81-0x0;var _0x59440e=_0x2e23[_0x15bc81];return _0x59440e;};'use strict';var multer=require(_0x32e2('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x32e2('0x1'));var express=require(_0x32e2('0x2'));var router=express['Router']();var fs_extra=require(_0x32e2('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x32e2('0x4'));var config=require(_0x32e2('0x5'));var controller=require(_0x32e2('0x6'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x32e2('0x7')](_0x32e2('0x8'),auth[_0x32e2('0x9')](),controller[_0x32e2('0xa')]);router[_0x32e2('0x7')]('/:id',auth[_0x32e2('0x9')](),controller[_0x32e2('0xb')]);router[_0x32e2('0x7')](_0x32e2('0xc'),auth['isAuthenticated'](),controller[_0x32e2('0xd')]);router[_0x32e2('0x7')](_0x32e2('0xe'),auth[_0x32e2('0x9')](),controller[_0x32e2('0xf')]);router[_0x32e2('0x7')](_0x32e2('0x10'),auth[_0x32e2('0x9')](),controller['getImap']);router[_0x32e2('0x7')](_0x32e2('0x11'),auth[_0x32e2('0x9')](),controller[_0x32e2('0x12')]);router['get'](_0x32e2('0x13'),auth[_0x32e2('0x9')](),controller[_0x32e2('0x14')]);router[_0x32e2('0x7')]('/:id/applications',auth['isAuthenticated'](),controller['getApplications']);router[_0x32e2('0x7')](_0x32e2('0x15'),auth['isAuthenticated'](),controller[_0x32e2('0x16')]);router['get'](_0x32e2('0x17'),auth['isAuthenticated'](),controller[_0x32e2('0x18')]);router[_0x32e2('0x7')](_0x32e2('0x19'),auth[_0x32e2('0x9')](),controller[_0x32e2('0x1a')]);router['post'](_0x32e2('0xc'),auth['isAuthenticated'](),controller[_0x32e2('0x1b')]);router[_0x32e2('0x1c')](_0x32e2('0xe'),auth[_0x32e2('0x9')](),controller[_0x32e2('0x1d')]);router[_0x32e2('0x1c')]('/',auth[_0x32e2('0x9')](),controller['create']);router[_0x32e2('0x1c')](_0x32e2('0x10'),auth[_0x32e2('0x9')](),controller[_0x32e2('0x1e')]);router[_0x32e2('0x1c')](_0x32e2('0x11'),auth[_0x32e2('0x9')](),controller['addSmtp']);router['post'](_0x32e2('0x13'),auth[_0x32e2('0x9')](),controller[_0x32e2('0x1f')]);router[_0x32e2('0x1c')](_0x32e2('0x20'),auth[_0x32e2('0x9')](),controller['addApplications']);router['post'](_0x32e2('0x21'),auth[_0x32e2('0x9')](),controller[_0x32e2('0x22')]);router[_0x32e2('0x1c')]('/:id/users',auth[_0x32e2('0x9')](),controller['addAgents']);router['put']('/:id',auth[_0x32e2('0x9')](),controller['update']);router[_0x32e2('0x23')](_0x32e2('0xc'),auth[_0x32e2('0x9')](),controller['removeDispositions']);router['delete'](_0x32e2('0xe'),auth[_0x32e2('0x9')](),controller[_0x32e2('0x24')]);router['delete'](_0x32e2('0x10'),auth[_0x32e2('0x9')](),controller[_0x32e2('0x25')]);router[_0x32e2('0x23')](_0x32e2('0x11'),auth[_0x32e2('0x9')](),controller[_0x32e2('0x26')]);router['delete'](_0x32e2('0x27'),auth['isAuthenticated'](),controller[_0x32e2('0x28')]);router[_0x32e2('0x23')]('/:id/users',auth[_0x32e2('0x9')](),controller['removeAgents']);module[_0x32e2('0x29')]=router; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.attributes.js b/server/api/mailAccount/mailAccount.attributes.js index 0937e7c..a69b17e 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 _0x46a1=['setDataValue','sequelize','exports','STRING','BOOLEAN','TEXT','Arial,Helvetica,sans-serif','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','mandatoryDisposition','ENUM','gmail','hotmail','yahoo','getDataValue','provider','custom'];(function(_0x3bd22e,_0x50cba6){var _0x4b9f28=function(_0x51efb7){while(--_0x51efb7){_0x3bd22e['push'](_0x3bd22e['shift']());}};_0x4b9f28(++_0x50cba6);}(_0x46a1,0xe5));var _0x146a=function(_0x799323,_0x1cbc70){_0x799323=_0x799323-0x0;var _0x27de39=_0x46a1[_0x799323];return _0x27de39;};'use strict';var Sequelize=require(_0x146a('0x0'));module[_0x146a('0x1')]={'description':{'type':Sequelize[_0x146a('0x2')]},'name':{'type':Sequelize[_0x146a('0x2')],'allowNull':![]},'service':{'type':Sequelize[_0x146a('0x3')],'defaultValue':![]},'email':{'type':Sequelize[_0x146a('0x2')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0x146a('0x3')],'defaultValue':!![]},'key':{'type':Sequelize[_0x146a('0x2')],'allowNull':![]},'template':{'type':Sequelize[_0x146a('0x4')]},'markAsUnread':{'type':Sequelize[_0x146a('0x3')],'defaultValue':![]},'fontFamily':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x146a('0x5')},'fontSize':{'type':Sequelize['INTEGER'](0x2)['UNSIGNED'],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0x146a('0x4')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}';}},'notificationSound':{'type':Sequelize[_0x146a('0x3')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x146a('0x3')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x146a('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x146a('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x146a('0x3')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x146a('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x146a('0x6')],'allowNull':!![],'defaultValue':null,'comment':_0x146a('0x7')},'mandatoryDisposition':{'type':Sequelize[_0x146a('0x3')],'defaultValue':![],'comment':_0x146a('0x8'),'set':function(_0x129bf9){if(!_0x129bf9)this['setDataValue'](_0x146a('0x9'),null);this['setDataValue'](_0x146a('0xa'),_0x129bf9);}},'provider':{'type':Sequelize[_0x146a('0xb')](_0x146a('0xc'),_0x146a('0xd'),_0x146a('0xe'),'outlook365'),'defaultValue':null,'get':function(){if(!this[_0x146a('0xf')](_0x146a('0x10')))return _0x146a('0x11');return this[_0x146a('0xf')](_0x146a('0x10'));},'set':function(_0x64d1f0){if(_0x64d1f0===_0x146a('0x11'))_0x64d1f0=null;return this[_0x146a('0x12')](_0x146a('0x10'),_0x64d1f0);}}}; \ No newline at end of file +var _0xd43c=['mandatoryDisposition','gmail','hotmail','yahoo','getDataValue','provider','custom','sequelize','STRING','BOOLEAN','TEXT','Arial,Helvetica,sans-serif','INTEGER','UNSIGNED','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}','setDataValue'];(function(_0x48e1ec,_0x35f468){var _0x3b33eb=function(_0x507bf9){while(--_0x507bf9){_0x48e1ec['push'](_0x48e1ec['shift']());}};_0x3b33eb(++_0x35f468);}(_0xd43c,0xf7));var _0xcd43=function(_0x1c4e37,_0x166cab){_0x1c4e37=_0x1c4e37-0x0;var _0x20406e=_0xd43c[_0x1c4e37];return _0x20406e;};'use strict';var Sequelize=require(_0xcd43('0x0'));module['exports']={'description':{'type':Sequelize[_0xcd43('0x1')]},'name':{'type':Sequelize[_0xcd43('0x1')],'allowNull':![]},'service':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'email':{'type':Sequelize[_0xcd43('0x1')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0xcd43('0x2')],'defaultValue':!![]},'key':{'type':Sequelize[_0xcd43('0x1')],'allowNull':![]},'template':{'type':Sequelize[_0xcd43('0x3')]},'markAsUnread':{'type':Sequelize[_0xcd43('0x2')],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0xcd43('0x1')],'allowNull':![],'defaultValue':_0xcd43('0x4')},'fontSize':{'type':Sequelize[_0xcd43('0x5')](0x2)[_0xcd43('0x6')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0xcd43('0x3')],'defaultValue':function(){return _0xcd43('0x7');}},'notificationSound':{'type':Sequelize[_0xcd43('0x2')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xcd43('0x2')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xcd43('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0xcd43('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xcd43('0x2')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xcd43('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xcd43('0x2')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xcd43('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xcd43('0x5')],'allowNull':!![],'defaultValue':null,'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0xcd43('0x2')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x4edf74){if(!_0x4edf74)this['setDataValue']('mandatoryDispositionPauseId',null);this[_0xcd43('0x8')](_0xcd43('0x9'),_0x4edf74);}},'provider':{'type':Sequelize['ENUM'](_0xcd43('0xa'),_0xcd43('0xb'),_0xcd43('0xc'),'outlook365'),'defaultValue':null,'get':function(){if(!this[_0xcd43('0xd')](_0xcd43('0xe')))return _0xcd43('0xf');return this[_0xcd43('0xd')]('provider');},'set':function(_0x2d0cfa){if(_0x2d0cfa===_0xcd43('0xf'))_0x2d0cfa=null;return this[_0xcd43('0x8')](_0xcd43('0xe'),_0x2d0cfa);}}}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.controller.js b/server/api/mailAccount/mailAccount.controller.js index 98426fb..2338bc7 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 _0x8606=['status','end','json','offset','limit','undefined','count','set','Content-Range','update','destroy','get','MailAccounts','stack','name','send','gmail','imap.gmail.com','yahoo','imap.mail.yahoo.com','hotmail','imap-mail.outlook.com','outlook.office365.com','smtp.gmail.com','smtp.mail.yahoo.com','smtp-mail.outlook.com','smtp.office365.com','Unknown\x20email\x20service\x20provider','user','username','password','pass','modernAuthentication','CloudProviderId','host','port','secure','service','authentication','Imap','Smtp','index','MailServerIn','MailServerOut','Pause','mandatoryDispositionPause','map','MailAccount','rawAttributes','type','key','model','query','keys','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','pick','filters','merge','VIRTUAL','options','includeAll','findAll','show','params','include','find','body','provider','Mail\x20Account\x20not\x20found','describe','addDisposition','MailAccountId','Disposition','getDispositions','findOne','length','filter','rows','removeDispositions','ids','CannedAnswer','create','getAnswers','removeAnswers','custom','email','active','description','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','getImap','setImap','getSmtp','addSmtp','removeSmtp','setSmtp','addInteraction','MailInteraction','omit','getInteractions','CmContact','Contact','User','Owner','internal','color','tag','addApplications','sequelize','READ_COMMITTED','MailApplication','findAndCountAll','priority','finally','getApplications','MailMessage','YYYY-MM-DD\x20HH:mm:ss','inlineCss','true','split','CmList','List','Contacts','updatedAt','Smtp\x20configuration\x20not\x20found','isNil','from','format','%s\x20<%s>','attachments','join','server/files/attachments','basename','SendMail','sendMail','List\x20not\x20found','ListId','subject','attach','out','messageId','Interaction','Messages','getSmtpOptions','VerifySmtp','ValidationError','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','addAgents','spread','emit','userMailAccount:save','removeAgents','isArray','userMailAccount:remove','getAgents','moment','bluebird','path','lodash','juice','ioredis','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./mailAccount.socket','register','jayson/promise','client','request','then','info','MailAccount,\x20%s,\x20%s','request\x20sent','MailAccount,\x20%s,\x20%s,\x20%s','error','code','message','catch','sendStatus'];(function(_0x1329f0,_0x28e343){var _0x1c7c61=function(_0x3f6348){while(--_0x3f6348){_0x1329f0['push'](_0x1329f0['shift']());}};_0x1c7c61(++_0x28e343);}(_0x8606,0xa5));var _0x6860=function(_0x4cee17,_0xda2b5){_0x4cee17=_0x4cee17-0x0;var _0x1d3b07=_0x8606[_0x4cee17];return _0x1d3b07;};'use strict';var moment=require(_0x6860('0x0'));var BPromise=require(_0x6860('0x1'));var util=require('util');var path=require(_0x6860('0x2'));var _=require(_0x6860('0x3'));var juice=require(_0x6860('0x4'));var Redis=require(_0x6860('0x5'));var qs=require('../../components/parsers/qs');var logger=require(_0x6860('0x6'))(_0x6860('0x7'));var config=require(_0x6860('0x8'));var db=require(_0x6860('0x9'))['db'];config[_0x6860('0xa')]=_[_0x6860('0xb')](config[_0x6860('0xa')],{'host':_0x6860('0xc'),'port':0x18eb});var socket=require(_0x6860('0xd'))(new Redis(config[_0x6860('0xa')]));require(_0x6860('0xe'))[_0x6860('0xf')](socket);var jayson=require(_0x6860('0x10'));var client=jayson[_0x6860('0x11')]['http']({'port':0x232b});function respondWithRpcPromise(_0x30c417,_0x3f8acd,_0x4976fb,_0x178995){return new BPromise(function(_0x35ff29,_0x228bc2){var _0x39f279=_0x178995||client;return _0x39f279[_0x6860('0x12')](_0x30c417,_0x4976fb)[_0x6860('0x13')](function(_0x41799d){logger[_0x6860('0x14')](_0x6860('0x15'),_0x3f8acd,_0x6860('0x16'));logger['debug'](_0x6860('0x17'),_0x3f8acd,_0x6860('0x16'),JSON['stringify'](_0x41799d));if(_0x41799d[_0x6860('0x18')]){if(_0x41799d[_0x6860('0x18')][_0x6860('0x19')]===0x1f4){logger[_0x6860('0x18')](_0x6860('0x15'),_0x3f8acd,_0x41799d[_0x6860('0x18')]['message']);return _0x228bc2(_0x41799d[_0x6860('0x18')][_0x6860('0x1a')]);}logger['error'](_0x6860('0x15'),_0x3f8acd,_0x41799d[_0x6860('0x18')]['message']);return _0x35ff29(_0x41799d[_0x6860('0x18')][_0x6860('0x1a')]);}else{logger[_0x6860('0x14')](_0x6860('0x15'),_0x3f8acd,'request\x20sent');_0x35ff29(_0x41799d['result'][_0x6860('0x1a')]);}})[_0x6860('0x1b')](function(_0x29cd5f){logger[_0x6860('0x18')]('MailAccount,\x20%s,\x20%s',_0x3f8acd,_0x29cd5f);_0x228bc2(_0x29cd5f);});});}function respondWithStatusCode(_0x36bbfd,_0x395a9f){_0x395a9f=_0x395a9f||0xcc;return function(_0x591a7b){if(_0x591a7b){return _0x36bbfd[_0x6860('0x1c')](_0x395a9f);}return _0x36bbfd[_0x6860('0x1d')](_0x395a9f)[_0x6860('0x1e')]();};}function respondWithResult(_0x37f73d,_0x37b735){_0x37b735=_0x37b735||0xc8;return function(_0x2d75a4){if(_0x2d75a4){return _0x37f73d[_0x6860('0x1d')](_0x37b735)[_0x6860('0x1f')](_0x2d75a4);}};}function respondWithFilteredResult(_0x5390b4,_0x4b4b97){return function(_0x187801){if(_0x187801){var _0x38fc26=typeof _0x4b4b97[_0x6860('0x20')]==='undefined'&&typeof _0x4b4b97[_0x6860('0x21')]===_0x6860('0x22');var _0x4e4bff=_0x187801[_0x6860('0x23')];var _0x2d8c35=_0x38fc26?0x0:_0x4b4b97['offset'];var _0x3926a5=_0x38fc26?_0x187801[_0x6860('0x23')]:_0x4b4b97['offset']+_0x4b4b97[_0x6860('0x21')];var _0x16a4fd;if(_0x3926a5>=_0x4e4bff){_0x3926a5=_0x4e4bff;_0x16a4fd=0xc8;}else{_0x16a4fd=0xce;}_0x5390b4[_0x6860('0x1d')](_0x16a4fd);return _0x5390b4[_0x6860('0x24')](_0x6860('0x25'),_0x2d8c35+'-'+_0x3926a5+'/'+_0x4e4bff)[_0x6860('0x1f')](_0x187801);}return null;};}function saveUpdates(_0x19b268){return function(_0x2ec067){if(_0x2ec067){return _0x2ec067[_0x6860('0x26')](_0x19b268)['then'](function(_0x325966){return _0x325966;});}return null;};}function removeEntity(_0x276587){return function(_0xd53f06){if(_0xd53f06){return _0xd53f06[_0x6860('0x27')]()[_0x6860('0x13')](function(){var _0x31ba6c=_0xd53f06[_0x6860('0x28')]({'plain':!![]});var _0x347365=_0x6860('0x29');return db['UserProfileResource'][_0x6860('0x27')]({'where':{'type':_0x347365,'resourceId':_0x31ba6c['id']}})[_0x6860('0x13')](function(){return _0xd53f06;});})['then'](function(){_0x276587['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x187e8e){return function(_0x57bada){if(!_0x57bada){_0x187e8e[_0x6860('0x1c')](0x194);}return _0x57bada;};}function handleError(_0x31ac7c,_0x4fab87){_0x4fab87=_0x4fab87||0x1f4;return function(_0x20a509){logger[_0x6860('0x18')](_0x20a509[_0x6860('0x2a')]);if(_0x20a509[_0x6860('0x2b')]){delete _0x20a509['name'];}_0x31ac7c[_0x6860('0x1d')](_0x4fab87)[_0x6860('0x2c')](_0x20a509);};}function getImapHost(_0xee4861){switch(_0xee4861){case _0x6860('0x2d'):return _0x6860('0x2e');case _0x6860('0x2f'):return _0x6860('0x30');case _0x6860('0x31'):return _0x6860('0x32');case'outlook365':return _0x6860('0x33');}throw new Error('Unknown\x20email\x20service\x20provider',_0xee4861);}function getSmtpHost(_0x3840ca){switch(_0x3840ca){case _0x6860('0x2d'):return _0x6860('0x34');case _0x6860('0x2f'):return _0x6860('0x35');case _0x6860('0x31'):return _0x6860('0x36');case'outlook365':return _0x6860('0x37');}throw new Error(_0x6860('0x38'),_0x3840ca);}function getAuthenticationOptions(_0x4e0122,_0x24ce57){var _0x2d3177={};var _0x70a080={};if(_0x4e0122){_0x2d3177['user']=_0x70a080[_0x6860('0x39')]=_0x24ce57[_0x6860('0x3a')];_0x2d3177[_0x6860('0x3b')]=_0x70a080[_0x6860('0x3c')]=_0x24ce57[_0x6860('0x3b')];if(_0x24ce57['modernAuthentication']){_0x2d3177[_0x6860('0x3d')]=_0x70a080[_0x6860('0x3d')]=!![];_0x2d3177[_0x6860('0x3e')]=_0x70a080[_0x6860('0x3e')]=_0x24ce57[_0x6860('0x3e')];_0x2d3177[_0x6860('0x3b')]=_0x70a080[_0x6860('0x3c')]=null;}else{_0x2d3177[_0x6860('0x3e')]=_0x70a080[_0x6860('0x3e')]=null;}_0x2d3177[_0x6860('0x3f')]=getImapHost(_0x4e0122);_0x2d3177[_0x6860('0x40')]=0x3e1;_0x70a080['host']=getSmtpHost(_0x4e0122);_0x70a080[_0x6860('0x40')]=0x24b;_0x70a080[_0x6860('0x41')]=![];_0x2d3177['service']=_0x70a080[_0x6860('0x42')]=null;}else{if(_0x24ce57[_0x6860('0x43')]){_0x2d3177[_0x6860('0x39')]=_0x70a080[_0x6860('0x39')]=_0x24ce57[_0x6860('0x3a')];_0x2d3177['password']=_0x70a080[_0x6860('0x3c')]=_0x24ce57[_0x6860('0x3b')];}else{_0x2d3177[_0x6860('0x43')]=_0x70a080['authentication']=![];_0x2d3177[_0x6860('0x39')]=_0x70a080['user']=null;_0x2d3177[_0x6860('0x3b')]=_0x70a080[_0x6860('0x3c')]=null;}_0x2d3177[_0x6860('0x3f')]=_0x24ce57['Imap']['host'];_0x2d3177[_0x6860('0x40')]=_0x24ce57[_0x6860('0x44')][_0x6860('0x40')];_0x70a080[_0x6860('0x3f')]=_0x24ce57[_0x6860('0x45')][_0x6860('0x3f')];_0x70a080['port']=_0x24ce57[_0x6860('0x45')]['port'];}return{'Imap':_0x2d3177,'Smtp':_0x70a080};}exports[_0x6860('0x46')]=function(_0x5e2400,_0xb9ac72){var _0x1b9251={'include':[{'model':db[_0x6860('0x47')],'as':_0x6860('0x44')},{'model':db[_0x6860('0x48')],'as':_0x6860('0x45')},{'model':db[_0x6860('0x49')],'as':_0x6860('0x4a')}]},_0x474973={},_0x5a3a6b={'count':0x0,'rows':[]};var _0x583f92=_[_0x6860('0x4b')](db[_0x6860('0x4c')][_0x6860('0x4d')],function(_0x37d975){return{'name':_0x37d975['fieldName'],'type':_0x37d975[_0x6860('0x4e')][_0x6860('0x4f')]};});_0x474973[_0x6860('0x50')]=_[_0x6860('0x4b')](_0x583f92,_0x6860('0x2b'));_0x474973[_0x6860('0x51')]=_[_0x6860('0x52')](_0x5e2400['query']);_0x474973['filters']=_['intersection'](_0x474973[_0x6860('0x50')],_0x474973[_0x6860('0x51')]);_0x1b9251[_0x6860('0x53')]=_[_0x6860('0x54')](_0x474973[_0x6860('0x50')],qs[_0x6860('0x55')](_0x5e2400[_0x6860('0x51')][_0x6860('0x55')]));_0x1b9251['attributes']=_0x1b9251[_0x6860('0x53')]['length']?_0x1b9251['attributes']:_0x474973[_0x6860('0x50')];if(!_0x5e2400[_0x6860('0x51')][_0x6860('0x56')](_0x6860('0x57'))){_0x1b9251[_0x6860('0x21')]=qs[_0x6860('0x21')](_0x5e2400[_0x6860('0x51')][_0x6860('0x21')]);_0x1b9251[_0x6860('0x20')]=qs[_0x6860('0x20')](_0x5e2400['query'][_0x6860('0x20')]);}_0x1b9251[_0x6860('0x58')]=qs['sort'](_0x5e2400[_0x6860('0x51')][_0x6860('0x59')]);_0x1b9251[_0x6860('0x5a')]=qs['filters'](_[_0x6860('0x5b')](_0x5e2400[_0x6860('0x51')],_0x474973[_0x6860('0x5c')]),_0x583f92);if(_0x5e2400[_0x6860('0x51')]['filter']){_0x1b9251[_0x6860('0x5a')]=_[_0x6860('0x5d')](_0x1b9251['where'],{'$or':_['map'](_0x583f92,function(_0x33604d){if(_0x33604d['type']!==_0x6860('0x5e')){var _0x330689={};_0x330689[_0x33604d['name']]={'$like':'%'+_0x5e2400['query']['filter']+'%'};return _0x330689;}})});}_0x1b9251=_[_0x6860('0x5d')]({},_0x1b9251,_0x5e2400[_0x6860('0x5f')]);var _0x4bab39={'where':_0x1b9251[_0x6860('0x5a')]};return db[_0x6860('0x4c')][_0x6860('0x23')](_0x4bab39)[_0x6860('0x13')](function(_0x1b7f70){_0x5a3a6b[_0x6860('0x23')]=_0x1b7f70;if(_0x5e2400['query'][_0x6860('0x60')]){_0x1b9251['include']=[{'all':!![]}];}return db[_0x6860('0x4c')][_0x6860('0x61')](_0x1b9251);})[_0x6860('0x13')](function(_0x2fcf19){_0x5a3a6b['rows']=_0x2fcf19;return _0x5a3a6b;})[_0x6860('0x13')](respondWithFilteredResult(_0xb9ac72,_0x1b9251))[_0x6860('0x1b')](handleError(_0xb9ac72,null));};exports[_0x6860('0x62')]=function(_0x53bd92,_0x578cf2){var _0x4d13bc={'raw':![],'where':{'id':_0x53bd92[_0x6860('0x63')]['id']},'include':[{'model':db['MailServerIn'],'as':'Imap'},{'model':db[_0x6860('0x48')],'as':_0x6860('0x45')},{'model':db[_0x6860('0x49')],'as':_0x6860('0x4a')}]},_0x23dc2a={};_0x23dc2a[_0x6860('0x50')]=_['keys'](db[_0x6860('0x4c')][_0x6860('0x4d')]);_0x23dc2a['query']=_[_0x6860('0x52')](_0x53bd92[_0x6860('0x51')]);_0x23dc2a[_0x6860('0x5c')]=_[_0x6860('0x54')](_0x23dc2a['model'],_0x23dc2a[_0x6860('0x51')]);_0x4d13bc[_0x6860('0x53')]=_[_0x6860('0x54')](_0x23dc2a[_0x6860('0x50')],qs[_0x6860('0x55')](_0x53bd92[_0x6860('0x51')]['fields']));_0x4d13bc[_0x6860('0x53')]=_0x4d13bc[_0x6860('0x53')]['length']?_0x4d13bc[_0x6860('0x53')]:_0x23dc2a[_0x6860('0x50')];if(_0x53bd92['query']['includeAll']){_0x4d13bc[_0x6860('0x64')]=[{'all':!![]}];}_0x4d13bc=_['merge']({},_0x4d13bc,_0x53bd92[_0x6860('0x5f')]);return db['MailAccount'][_0x6860('0x65')](_0x4d13bc)[_0x6860('0x13')](handleEntityNotFound(_0x578cf2,null))[_0x6860('0x13')](respondWithResult(_0x578cf2,null))['catch'](handleError(_0x578cf2,null));};exports[_0x6860('0x26')]=function(_0x3a570c,_0x2896e9){if(_0x3a570c[_0x6860('0x66')]['id']){delete _0x3a570c['body']['id'];}var _0x276948=_0x3a570c[_0x6860('0x66')][_0x6860('0x67')]==='custom'?null:_0x3a570c[_0x6860('0x66')][_0x6860('0x67')];var _0x181b56=_0x3a570c[_0x6860('0x66')][_0x6860('0x44')]||{};var _0x2eeb48=_0x3a570c[_0x6860('0x66')][_0x6860('0x45')]||{};if(_0x276948){_0x181b56[_0x6860('0x3f')]=getImapHost(_0x276948);_0x181b56[_0x6860('0x40')]=0x3e1;_0x2eeb48[_0x6860('0x3f')]=getSmtpHost(_0x276948);_0x2eeb48[_0x6860('0x40')]=0x24b;_0x2eeb48['secure']=![];}if(_0x2eeb48['modernAuthentication']){_0x2eeb48['secure']=![];}else{_0x2eeb48[_0x6860('0x3e')]=null;}if(!_0x181b56[_0x6860('0x3d')])_0x181b56[_0x6860('0x3e')]=null;_0x3a570c['body'][_0x6860('0x44')]=_0x181b56;_0x3a570c[_0x6860('0x66')][_0x6860('0x45')]=_0x2eeb48;return db['MailAccount'][_0x6860('0x65')]({'where':{'id':_0x3a570c[_0x6860('0x63')]['id']},'include':[{'model':db[_0x6860('0x47')],'as':_0x6860('0x44')},{'model':db[_0x6860('0x48')],'as':_0x6860('0x45')},{'model':db[_0x6860('0x49')],'as':_0x6860('0x4a')}]})[_0x6860('0x13')](handleEntityNotFound(_0x2896e9,null))[_0x6860('0x13')](function(_0x4473ab){if(!_0x4473ab)throw new Error(_0x6860('0x68'));if(_0x4473ab[_0x6860('0x42')])delete _0x3a570c[_0x6860('0x66')][_0x6860('0x44')];return _0x4473ab;})[_0x6860('0x13')](saveUpdates(_0x3a570c[_0x6860('0x66')],null))['then'](function(_0x35cb99){if(!_0x3a570c['body']['Imap'])return _0x35cb99;return db[_0x6860('0x47')][_0x6860('0x26')](_0x3a570c[_0x6860('0x66')][_0x6860('0x44')],{'where':{'MailAccountId':_0x35cb99['id']}})[_0x6860('0x13')](function(){return _0x35cb99;});})[_0x6860('0x13')](function(_0x2c0bc9){if(!_0x3a570c[_0x6860('0x66')][_0x6860('0x45')])return _0x2c0bc9;return db[_0x6860('0x48')][_0x6860('0x26')](_0x3a570c[_0x6860('0x66')]['Smtp'],{'where':{'MailAccountId':_0x2c0bc9['id']}})[_0x6860('0x13')](function(){return _0x2c0bc9;});})['then'](respondWithResult(_0x2896e9,null))[_0x6860('0x1b')](handleError(_0x2896e9,null));};exports['describe']=function(_0x4a56cd,_0x3df45e){return db[_0x6860('0x4c')][_0x6860('0x69')]()[_0x6860('0x13')](respondWithResult(_0x3df45e,null))[_0x6860('0x1b')](handleError(_0x3df45e,null));};exports[_0x6860('0x6a')]=function(_0x565f2e,_0x3902d2){if(_0x565f2e[_0x6860('0x66')]['id']){delete _0x565f2e[_0x6860('0x66')]['id'];}return db[_0x6860('0x4c')]['find']({'where':{'id':_0x565f2e['params']['id']}})[_0x6860('0x13')](handleEntityNotFound(_0x3902d2,null))[_0x6860('0x13')](function(_0x56f5bb){if(_0x56f5bb){_0x565f2e['body'][_0x6860('0x6b')]=_0x56f5bb['id'];return db[_0x6860('0x6c')]['create'](_0x565f2e['body']);}})['then'](respondWithResult(_0x3902d2,null))[_0x6860('0x1b')](handleError(_0x3902d2,null));};exports[_0x6860('0x6d')]=function(_0x384a32,_0x17e3bc){var _0x320662={'raw':![],'where':{}};var _0x44f724={};var _0x5708da={'count':0x0,'rows':[]};return db[_0x6860('0x4c')][_0x6860('0x6e')]({'where':{'id':_0x384a32[_0x6860('0x63')]['id']}})[_0x6860('0x13')](handleEntityNotFound(_0x17e3bc,null))['then'](function(_0x4d4d51){if(_0x4d4d51){_0x44f724[_0x6860('0x50')]=_[_0x6860('0x52')](db[_0x6860('0x6c')][_0x6860('0x4d')]);_0x44f724[_0x6860('0x51')]=_['keys'](_0x384a32[_0x6860('0x51')]);_0x44f724[_0x6860('0x5c')]=_['intersection'](_0x44f724[_0x6860('0x50')],_0x44f724[_0x6860('0x51')]);_0x320662[_0x6860('0x53')]=_[_0x6860('0x54')](_0x44f724[_0x6860('0x50')],qs['fields'](_0x384a32[_0x6860('0x51')][_0x6860('0x55')]));_0x320662[_0x6860('0x53')]=_0x320662[_0x6860('0x53')][_0x6860('0x6f')]?_0x320662[_0x6860('0x53')]:_0x44f724['model'];if(!_0x384a32['query']['hasOwnProperty']('nolimit')){_0x320662['limit']=qs[_0x6860('0x21')](_0x384a32[_0x6860('0x51')][_0x6860('0x21')]);_0x320662[_0x6860('0x20')]=qs[_0x6860('0x20')](_0x384a32[_0x6860('0x51')][_0x6860('0x20')]);}_0x320662[_0x6860('0x58')]=qs[_0x6860('0x59')](_0x384a32[_0x6860('0x51')]['sort']);_0x320662[_0x6860('0x5a')]=qs['filters'](_['pick'](_0x384a32[_0x6860('0x51')],_0x44f724[_0x6860('0x5c')]));_0x320662['where']['MailAccountId']=_0x4d4d51['id'];if(_0x384a32[_0x6860('0x51')][_0x6860('0x70')]){_0x320662['where']=_[_0x6860('0x5d')](_0x320662[_0x6860('0x5a')],{'$or':_[_0x6860('0x4b')](_0x320662['attributes'],function(_0x2c446f){var _0x52abb5={};_0x52abb5[_0x2c446f]={'$like':'%'+_0x384a32[_0x6860('0x51')][_0x6860('0x70')]+'%'};return _0x52abb5;})});}_0x320662=_[_0x6860('0x5d')]({},_0x320662,_0x384a32[_0x6860('0x5f')]);return db[_0x6860('0x6c')][_0x6860('0x23')]({'where':_0x320662[_0x6860('0x5a')]})[_0x6860('0x13')](function(_0x25da5e){_0x5708da['count']=_0x25da5e;if(_0x384a32[_0x6860('0x51')][_0x6860('0x60')]){_0x320662[_0x6860('0x64')]=[{'all':!![]}];}return db[_0x6860('0x6c')]['findAll'](_0x320662);})[_0x6860('0x13')](function(_0x3fbaaa){_0x5708da[_0x6860('0x71')]=_0x3fbaaa;return _0x5708da;});}})['then'](respondWithFilteredResult(_0x17e3bc,_0x320662))[_0x6860('0x1b')](handleError(_0x17e3bc,null));};exports[_0x6860('0x72')]=function(_0x48a83d,_0x278b13){return db['MailAccount'][_0x6860('0x65')]({'where':{'id':_0x48a83d['params']['id']}})['then'](handleEntityNotFound(_0x278b13,null))[_0x6860('0x13')](function(_0x207b5e){if(_0x207b5e){return _0x207b5e[_0x6860('0x72')](_0x48a83d[_0x6860('0x51')][_0x6860('0x73')]);}})[_0x6860('0x13')](respondWithStatusCode(_0x278b13,null))[_0x6860('0x1b')](handleError(_0x278b13,null));};exports['addAnswer']=function(_0x24557e,_0x491225){if(_0x24557e[_0x6860('0x66')]['id']){delete _0x24557e[_0x6860('0x66')]['id'];}return db[_0x6860('0x4c')]['find']({'where':{'id':_0x24557e[_0x6860('0x63')]['id']}})[_0x6860('0x13')](handleEntityNotFound(_0x491225,null))[_0x6860('0x13')](function(_0x4c63d1){if(_0x4c63d1){_0x24557e[_0x6860('0x66')]['MailAccountId']=_0x4c63d1['id'];return db[_0x6860('0x74')][_0x6860('0x75')](_0x24557e[_0x6860('0x66')]);}})[_0x6860('0x13')](respondWithResult(_0x491225,null))[_0x6860('0x1b')](handleError(_0x491225,null));};exports[_0x6860('0x76')]=function(_0x1f7cd5,_0x5f5724){var _0x368a7a={'raw':![],'where':{}};var _0x498cb4={};var _0x2ec95e={'count':0x0,'rows':[]};return db[_0x6860('0x4c')][_0x6860('0x6e')]({'where':{'id':_0x1f7cd5[_0x6860('0x63')]['id']}})['then'](handleEntityNotFound(_0x5f5724,null))[_0x6860('0x13')](function(_0x3022ea){if(_0x3022ea){_0x498cb4['model']=_['keys'](db[_0x6860('0x74')][_0x6860('0x4d')]);_0x498cb4['query']=_[_0x6860('0x52')](_0x1f7cd5[_0x6860('0x51')]);_0x498cb4[_0x6860('0x5c')]=_[_0x6860('0x54')](_0x498cb4[_0x6860('0x50')],_0x498cb4[_0x6860('0x51')]);_0x368a7a['attributes']=_[_0x6860('0x54')](_0x498cb4[_0x6860('0x50')],qs['fields'](_0x1f7cd5[_0x6860('0x51')][_0x6860('0x55')]));_0x368a7a[_0x6860('0x53')]=_0x368a7a[_0x6860('0x53')][_0x6860('0x6f')]?_0x368a7a['attributes']:_0x498cb4['model'];if(!_0x1f7cd5[_0x6860('0x51')][_0x6860('0x56')](_0x6860('0x57'))){_0x368a7a[_0x6860('0x21')]=qs[_0x6860('0x21')](_0x1f7cd5[_0x6860('0x51')][_0x6860('0x21')]);_0x368a7a[_0x6860('0x20')]=qs[_0x6860('0x20')](_0x1f7cd5[_0x6860('0x51')]['offset']);}_0x368a7a['order']=qs['sort'](_0x1f7cd5[_0x6860('0x51')][_0x6860('0x59')]);_0x368a7a[_0x6860('0x5a')]=qs[_0x6860('0x5c')](_[_0x6860('0x5b')](_0x1f7cd5[_0x6860('0x51')],_0x498cb4['filters']));_0x368a7a['where'][_0x6860('0x6b')]=_0x3022ea['id'];if(_0x1f7cd5[_0x6860('0x51')][_0x6860('0x70')]){_0x368a7a[_0x6860('0x5a')]=_[_0x6860('0x5d')](_0x368a7a[_0x6860('0x5a')],{'$or':_[_0x6860('0x4b')](_0x368a7a[_0x6860('0x53')],function(_0x179b6e){var _0x37e05e={};_0x37e05e[_0x179b6e]={'$like':'%'+_0x1f7cd5[_0x6860('0x51')][_0x6860('0x70')]+'%'};return _0x37e05e;})});}_0x368a7a=_[_0x6860('0x5d')]({},_0x368a7a,_0x1f7cd5[_0x6860('0x5f')]);return db['CannedAnswer'][_0x6860('0x23')]({'where':_0x368a7a['where']})[_0x6860('0x13')](function(_0x523952){_0x2ec95e[_0x6860('0x23')]=_0x523952;if(_0x1f7cd5['query']['includeAll']){_0x368a7a[_0x6860('0x64')]=[{'all':!![]}];}return db[_0x6860('0x74')]['findAll'](_0x368a7a);})[_0x6860('0x13')](function(_0xa696fd){_0x2ec95e[_0x6860('0x71')]=_0xa696fd;return _0x2ec95e;});}})['then'](respondWithFilteredResult(_0x5f5724,_0x368a7a))['catch'](handleError(_0x5f5724,null));};exports[_0x6860('0x77')]=function(_0x29a262,_0xa232fd){return db['MailAccount']['find']({'where':{'id':_0x29a262['params']['id']}})['then'](handleEntityNotFound(_0xa232fd,null))[_0x6860('0x13')](function(_0x2693f0){if(_0x2693f0){return _0x2693f0['removeAnswers'](_0x29a262[_0x6860('0x51')]['ids']);}})[_0x6860('0x13')](respondWithStatusCode(_0xa232fd,null))[_0x6860('0x1b')](handleError(_0xa232fd,null));};exports[_0x6860('0x75')]=function(_0x51a106,_0x2e199d){var _0x3e0c55={'name':_0x51a106[_0x6860('0x66')]['name'],'key':_0x51a106[_0x6860('0x66')][_0x6860('0x4f')],'provider':_0x51a106[_0x6860('0x66')][_0x6860('0x67')]===_0x6860('0x78')?null:_0x51a106[_0x6860('0x66')]['provider'],'email':_0x51a106[_0x6860('0x66')][_0x6860('0x79')],'ListId':_0x51a106[_0x6860('0x66')]['ListId'],'active':!_['isNil'](_0x51a106[_0x6860('0x66')][_0x6860('0x7a')])?_0x51a106[_0x6860('0x66')][_0x6860('0x7a')]:!![],'description':_0x51a106[_0x6860('0x66')][_0x6860('0x7b')]||null};var _0x1c2c42=getAuthenticationOptions(_0x3e0c55[_0x6860('0x67')],_0x51a106[_0x6860('0x66')]);_0x3e0c55[_0x6860('0x44')]=_0x1c2c42[_0x6860('0x44')];_0x3e0c55[_0x6860('0x45')]=_0x1c2c42[_0x6860('0x45')];return db[_0x6860('0x4c')][_0x6860('0x75')](_0x3e0c55,{'include':[{'model':db['MailServerOut'],'as':_0x6860('0x45')},{'model':db[_0x6860('0x47')],'as':_0x6860('0x44')}]})['then'](function(_0x134139){var _0x10ef3a=_0x51a106[_0x6860('0x39')][_0x6860('0x28')]({'plain':!![]});if(!_0x10ef3a)throw new Error(_0x6860('0x7c'));if(_0x10ef3a['role']==='user'){var _0x3f4c13=_0x134139[_0x6860('0x28')]({'plain':!![]});return db[_0x6860('0x7d')]['find']({'where':{'name':_0x6860('0x29'),'userProfileId':_0x10ef3a[_0x6860('0x7e')]},'raw':!![]})[_0x6860('0x13')](function(_0x2940ae){if(_0x2940ae&&_0x2940ae[_0x6860('0x7f')]===0x0){return db[_0x6860('0x80')]['create']({'name':_0x3f4c13['name'],'resourceId':_0x3f4c13['id'],'type':_0x2940ae[_0x6860('0x2b')],'sectionId':_0x2940ae['id']},{})[_0x6860('0x13')](function(){return _0x134139;});}else{return _0x134139;}})[_0x6860('0x1b')](function(_0x5a878e){logger[_0x6860('0x18')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5a878e);throw _0x5a878e;});}return _0x134139;})[_0x6860('0x13')](respondWithResult(_0x2e199d,0xc9))[_0x6860('0x1b')](handleError(_0x2e199d,null));};exports['getImap']=function(_0x242386,_0x485dd9){return db[_0x6860('0x4c')][_0x6860('0x6e')]({'where':{'id':_0x242386['params']['id']}})[_0x6860('0x13')](handleEntityNotFound(_0x485dd9,null))[_0x6860('0x13')](function(_0x26f09d){if(_0x26f09d){return _0x26f09d[_0x6860('0x81')]();}return null;})[_0x6860('0x13')](respondWithResult(_0x485dd9,null))[_0x6860('0x1b')](handleError(_0x485dd9,null));};exports['addImap']=function(_0x223d6e,_0x1c8488){if(_0x223d6e[_0x6860('0x66')]['id']){delete _0x223d6e[_0x6860('0x66')]['id'];}return db['MailAccount'][_0x6860('0x65')]({'where':{'id':_0x223d6e[_0x6860('0x63')]['id']}})[_0x6860('0x13')](handleEntityNotFound(_0x1c8488,null))[_0x6860('0x13')](function(_0x5725c9){if(_0x5725c9){_0x223d6e[_0x6860('0x66')][_0x6860('0x6b')]=_0x5725c9['id'];return db['MailServerIn'][_0x6860('0x75')](_0x223d6e[_0x6860('0x66')]);}})[_0x6860('0x13')](respondWithResult(_0x1c8488,null))[_0x6860('0x1b')](handleError(_0x1c8488,null));};exports['removeImap']=function(_0x19ebd2,_0x327a15){return db[_0x6860('0x4c')][_0x6860('0x6e')]({'where':{'id':_0x19ebd2[_0x6860('0x63')]['id']}})['then'](handleEntityNotFound(_0x327a15,null))[_0x6860('0x13')](function(_0x6248ad){if(_0x6248ad){return _0x6248ad[_0x6860('0x82')](null);}return null;})[_0x6860('0x13')](respondWithStatusCode(_0x327a15,null))[_0x6860('0x1b')](handleError(_0x327a15,null));};exports[_0x6860('0x83')]=function(_0x40adac,_0x37adc1){return db['MailAccount'][_0x6860('0x6e')]({'where':{'id':_0x40adac[_0x6860('0x63')]['id']}})[_0x6860('0x13')](handleEntityNotFound(_0x37adc1,null))[_0x6860('0x13')](function(_0x18ff7e){if(_0x18ff7e){return _0x18ff7e[_0x6860('0x83')]();}return null;})[_0x6860('0x13')](respondWithResult(_0x37adc1,null))[_0x6860('0x1b')](handleError(_0x37adc1,null));};exports[_0x6860('0x84')]=function(_0x32f958,_0x18947b){if(_0x32f958[_0x6860('0x66')]['id']){delete _0x32f958[_0x6860('0x66')]['id'];}return db[_0x6860('0x4c')][_0x6860('0x65')]({'where':{'id':_0x32f958[_0x6860('0x63')]['id']}})[_0x6860('0x13')](handleEntityNotFound(_0x18947b,null))['then'](function(_0x252012){if(_0x252012){_0x32f958[_0x6860('0x66')][_0x6860('0x6b')]=_0x252012['id'];return db[_0x6860('0x48')]['create'](_0x32f958[_0x6860('0x66')]);}})[_0x6860('0x13')](respondWithResult(_0x18947b,null))[_0x6860('0x1b')](handleError(_0x18947b,null));};exports[_0x6860('0x85')]=function(_0x527711,_0x4cc73f){return db[_0x6860('0x4c')][_0x6860('0x6e')]({'where':{'id':_0x527711[_0x6860('0x63')]['id']}})[_0x6860('0x13')](handleEntityNotFound(_0x4cc73f,null))[_0x6860('0x13')](function(_0xb6c9b8){if(_0xb6c9b8){return _0xb6c9b8[_0x6860('0x86')](null);}return null;})[_0x6860('0x13')](respondWithStatusCode(_0x4cc73f,null))[_0x6860('0x1b')](handleError(_0x4cc73f,null));};exports[_0x6860('0x87')]=function(_0x545f70,_0x3850a0){return db[_0x6860('0x88')]['find']({'where':{'id':_0x545f70['params']['id']}})[_0x6860('0x13')](handleEntityNotFound(_0x3850a0,null))[_0x6860('0x13')](function(_0x2ad0a5){if(_0x2ad0a5){return _0x2ad0a5['addInteraction'](_0x545f70[_0x6860('0x66')][_0x6860('0x73')],_[_0x6860('0x89')](_0x545f70[_0x6860('0x66')],[_0x6860('0x73'),'id'])||{});}})['then'](respondWithResult(_0x3850a0,null))[_0x6860('0x1b')](handleError(_0x3850a0,null));};exports[_0x6860('0x8a')]=function(_0x1555eb,_0x20fc62){var _0x21745d={'raw':![],'where':{}};var _0x3f1671={};var _0x1d2d37={'count':0x0,'rows':[]};return db[_0x6860('0x4c')]['findOne']({'where':{'id':_0x1555eb[_0x6860('0x63')]['id']}})[_0x6860('0x13')](handleEntityNotFound(_0x20fc62,null))[_0x6860('0x13')](function(_0x14aab4){if(_0x14aab4){_0x3f1671[_0x6860('0x50')]=_['keys'](db[_0x6860('0x88')][_0x6860('0x4d')]);_0x3f1671[_0x6860('0x51')]=_[_0x6860('0x52')](_0x1555eb[_0x6860('0x51')]);_0x3f1671['filters']=_['intersection'](_0x3f1671[_0x6860('0x50')],_0x3f1671[_0x6860('0x51')]);_0x21745d[_0x6860('0x53')]=_[_0x6860('0x54')](_0x3f1671['model'],qs[_0x6860('0x55')](_0x1555eb['query'][_0x6860('0x55')]));_0x21745d['attributes']=_0x21745d[_0x6860('0x53')]['length']?_0x21745d[_0x6860('0x53')]:_0x3f1671['model'];if(!_0x1555eb[_0x6860('0x51')][_0x6860('0x56')]('nolimit')){_0x21745d[_0x6860('0x21')]=qs[_0x6860('0x21')](_0x1555eb['query'][_0x6860('0x21')]);_0x21745d[_0x6860('0x20')]=qs[_0x6860('0x20')](_0x1555eb[_0x6860('0x51')][_0x6860('0x20')]);}_0x21745d[_0x6860('0x58')]=qs[_0x6860('0x59')](_0x1555eb['query'][_0x6860('0x59')]);_0x21745d['where']=qs[_0x6860('0x5c')](_[_0x6860('0x5b')](_0x1555eb[_0x6860('0x51')],_0x3f1671[_0x6860('0x5c')]));_0x21745d[_0x6860('0x5a')][_0x6860('0x6b')]=_0x14aab4['id'];if(_0x1555eb[_0x6860('0x51')][_0x6860('0x70')]){_0x21745d[_0x6860('0x5a')]=_[_0x6860('0x5d')](_0x21745d[_0x6860('0x5a')],{'$or':_[_0x6860('0x4b')](_0x21745d['attributes'],function(_0x19a284){var _0x11169a={};_0x11169a[_0x19a284]={'$like':'%'+_0x1555eb['query'][_0x6860('0x70')]+'%'};return _0x11169a;})});}_0x21745d=_['merge']({},_0x21745d,_0x1555eb['options']);return db['MailInteraction'][_0x6860('0x23')]({'where':_0x21745d[_0x6860('0x5a')]})[_0x6860('0x13')](function(_0x549da9){_0x1d2d37['count']=_0x549da9;if(_0x1555eb[_0x6860('0x51')][_0x6860('0x60')]){_0x21745d['include']=[{'model':db[_0x6860('0x8b')],'as':_0x6860('0x8c'),'required':![]},{'model':db[_0x6860('0x8d')],'as':_0x6860('0x8e'),'attributes':[_0x6860('0x2b'),'fullname',_0x6860('0x8f')],'required':![]},{'model':db['Tag'],'as':'Tags','attributes':['id',_0x6860('0x2b'),_0x6860('0x90')],'where':_0x1555eb[_0x6860('0x51')]['tag']?{'id':_0x1555eb[_0x6860('0x51')][_0x6860('0x91')]}:undefined,'required':_0x1555eb[_0x6860('0x51')][_0x6860('0x91')]?!![]:![]}];}return db['MailInteraction']['findAll'](_0x21745d);})['then'](function(_0x699c03){_0x1d2d37[_0x6860('0x71')]=_0x699c03;return _0x1d2d37;});}})[_0x6860('0x13')](respondWithFilteredResult(_0x20fc62,_0x21745d))[_0x6860('0x1b')](handleError(_0x20fc62,null));};exports[_0x6860('0x92')]=function addApplications(_0x2dec0c,_0x50b51f){var _0x3c0b07=_0x2dec0c[_0x6860('0x63')]['id'];var _0x488640=_0x2dec0c[_0x6860('0x66')];var _0x2204e4=0xc8;var _0x5bd97e=null;return db[_0x6860('0x93')]['transaction']({'isolationLevel':db['sequelize']['Transaction']['ISOLATION_LEVELS'][_0x6860('0x94')]},function(_0x4ec1e4){return db[_0x6860('0x4c')][_0x6860('0x6e')]({'where':{'id':_0x3c0b07},'transaction':_0x4ec1e4})['then'](function(_0x2b4d89){if(_0x2b4d89){return db['MailApplication'][_0x6860('0x27')]({'where':{'MailAccountId':_0x3c0b07},'transaction':_0x4ec1e4})[_0x6860('0x13')](function(){var _0x118a65=_[_0x6860('0x4b')](_0x488640,function(_0x4f24a2){_0x4f24a2[_0x6860('0x6b')]=_0x3c0b07;return _0x4f24a2;});return db['MailApplication']['bulkCreate'](_0x118a65,{'transaction':_0x4ec1e4});});}else{_0x2204e4=0x194;_0x5bd97e=[];}});})[_0x6860('0x13')](function(){if(_0x2204e4!==0x194){return db[_0x6860('0x95')][_0x6860('0x96')]({'where':{'MailAccountId':_0x3c0b07},'order':_0x6860('0x97')})[_0x6860('0x13')](function(_0x177ea9){_0x5bd97e=_0x177ea9;});}})[_0x6860('0x1b')](function(_0x1a5cc1){_0x2204e4=0x1f4;logger['error'](_0x1a5cc1['stack']);if(_0x1a5cc1[_0x6860('0x2b')]){delete _0x1a5cc1[_0x6860('0x2b')];}_0x5bd97e=_0x1a5cc1;})[_0x6860('0x98')](function(){if(_0x5bd97e===null){_0x50b51f[_0x6860('0x1c')](_0x2204e4);}else{if(_0x2204e4===0x1f4){_0x50b51f[_0x6860('0x1d')](_0x2204e4)['send'](_0x5bd97e);}else{_0x50b51f[_0x6860('0x1d')](_0x2204e4)['json'](_0x5bd97e);}}});};exports[_0x6860('0x99')]=function(_0x17e3b4,_0x45d7c7){var _0x4b9895={};var _0x16a394={};var _0x29e204;var _0x1e300d;return db[_0x6860('0x4c')][_0x6860('0x6e')]({'where':{'id':_0x17e3b4[_0x6860('0x63')]['id']}})[_0x6860('0x13')](handleEntityNotFound(_0x45d7c7,null))[_0x6860('0x13')](function(_0x3b7622){if(_0x3b7622){_0x29e204=_0x3b7622;_0x16a394[_0x6860('0x50')]=_[_0x6860('0x52')](db[_0x6860('0x95')]['rawAttributes']);_0x16a394[_0x6860('0x51')]=_[_0x6860('0x52')](_0x17e3b4[_0x6860('0x51')]);_0x16a394[_0x6860('0x5c')]=_[_0x6860('0x54')](_0x16a394[_0x6860('0x50')],_0x16a394[_0x6860('0x51')]);_0x4b9895[_0x6860('0x53')]=_[_0x6860('0x54')](_0x16a394[_0x6860('0x50')],qs[_0x6860('0x55')](_0x17e3b4['query'][_0x6860('0x55')]));_0x4b9895['attributes']=_0x4b9895[_0x6860('0x53')][_0x6860('0x6f')]?_0x4b9895['attributes']:_0x16a394[_0x6860('0x50')];_0x4b9895[_0x6860('0x58')]=qs[_0x6860('0x59')](_0x17e3b4[_0x6860('0x51')][_0x6860('0x59')]);_0x4b9895['where']=qs['filters'](_[_0x6860('0x5b')](_0x17e3b4[_0x6860('0x51')],_0x16a394[_0x6860('0x5c')]));if(_0x17e3b4[_0x6860('0x51')][_0x6860('0x70')]){_0x4b9895[_0x6860('0x5a')]=_['merge'](_0x4b9895[_0x6860('0x5a')],{'$or':_[_0x6860('0x4b')](_0x4b9895[_0x6860('0x53')],function(_0x241104){var _0x55f563={};_0x55f563[_0x241104]={'$like':'%'+_0x17e3b4[_0x6860('0x51')][_0x6860('0x70')]+'%'};return _0x55f563;})});}_0x4b9895=_[_0x6860('0x5d')]({},_0x4b9895,_0x17e3b4[_0x6860('0x5f')]);return _0x29e204[_0x6860('0x99')](_0x4b9895);}})[_0x6860('0x13')](function(_0x545f91){if(_0x545f91){_0x1e300d=_0x545f91[_0x6860('0x6f')];if(!_0x17e3b4['query'][_0x6860('0x56')](_0x6860('0x57'))){_0x4b9895[_0x6860('0x21')]=qs[_0x6860('0x21')](_0x17e3b4['query'][_0x6860('0x21')]);_0x4b9895[_0x6860('0x20')]=qs[_0x6860('0x20')](_0x17e3b4[_0x6860('0x51')][_0x6860('0x20')]);}return _0x29e204[_0x6860('0x99')](_0x4b9895);}})[_0x6860('0x13')](function(_0x208bcb){if(_0x208bcb){return _0x208bcb?{'count':_0x1e300d,'rows':_0x208bcb}:null;}})[_0x6860('0x13')](respondWithResult(_0x45d7c7,null))[_0x6860('0x1b')](handleError(_0x45d7c7,null));};exports['getMessages']=function(_0x2e6146,_0x2bfea3){var _0xcfdcdc={'raw':!![],'where':{}};var _0x47021e={};var _0x342784={'count':0x0,'rows':[]};return db[_0x6860('0x4c')][_0x6860('0x6e')]({'where':{'id':_0x2e6146['params']['id']}})['then'](handleEntityNotFound(_0x2bfea3,null))[_0x6860('0x13')](function(_0x400245){if(_0x400245){_0x47021e[_0x6860('0x50')]=_[_0x6860('0x52')](db[_0x6860('0x9a')][_0x6860('0x4d')]);_0x47021e[_0x6860('0x51')]=_['keys'](_0x2e6146[_0x6860('0x51')]);_0x47021e[_0x6860('0x5c')]=_[_0x6860('0x54')](_0x47021e[_0x6860('0x50')],_0x47021e[_0x6860('0x51')]);_0xcfdcdc[_0x6860('0x53')]=_[_0x6860('0x54')](_0x47021e[_0x6860('0x50')],qs['fields'](_0x2e6146[_0x6860('0x51')][_0x6860('0x55')]));_0xcfdcdc[_0x6860('0x53')]=_0xcfdcdc[_0x6860('0x53')][_0x6860('0x6f')]?_0xcfdcdc['attributes']:_0x47021e[_0x6860('0x50')];if(!_0x2e6146[_0x6860('0x51')][_0x6860('0x56')](_0x6860('0x57'))){_0xcfdcdc[_0x6860('0x21')]=qs['limit'](_0x2e6146['query'][_0x6860('0x21')]);_0xcfdcdc[_0x6860('0x20')]=qs[_0x6860('0x20')](_0x2e6146['query'][_0x6860('0x20')]);}_0xcfdcdc[_0x6860('0x58')]=qs['sort'](_0x2e6146[_0x6860('0x51')]['sort']);_0xcfdcdc['where']=qs['filters'](_[_0x6860('0x5b')](_0x2e6146[_0x6860('0x51')],_0x47021e[_0x6860('0x5c')]));_0xcfdcdc[_0x6860('0x5a')][_0x6860('0x6b')]=_0x400245['id'];if(_0x2e6146[_0x6860('0x51')][_0x6860('0x70')]){_0xcfdcdc[_0x6860('0x5a')]=_[_0x6860('0x5d')](_0xcfdcdc[_0x6860('0x5a')],{'$or':_[_0x6860('0x4b')](_0xcfdcdc[_0x6860('0x53')],function(_0x3af513){var _0x5ab899={};_0x5ab899[_0x3af513]={'$like':'%'+_0x2e6146[_0x6860('0x51')][_0x6860('0x70')]+'%'};return _0x5ab899;})});}if(_0x2e6146['query']['$gte']){var _0x23d994=_0x2e6146[_0x6860('0x51')]['$gte']['split'](',');var _0x14237d={};_0x14237d[_0x23d994[0x0]]={'$gte':moment(_0x23d994[0x1])['format'](_0x6860('0x9b'))};_0xcfdcdc[_0x6860('0x5a')]=_['merge'](_0xcfdcdc[_0x6860('0x5a')],_0x14237d);}_0xcfdcdc=_['merge']({},_0xcfdcdc,_0x2e6146['options']);return db[_0x6860('0x9a')]['count']({'where':_0xcfdcdc[_0x6860('0x5a')]})[_0x6860('0x13')](function(_0x355925){_0x342784['count']=_0x355925;if(_0x2e6146[_0x6860('0x51')][_0x6860('0x60')]){_0xcfdcdc[_0x6860('0x64')]=[{'all':!![]}];}return db[_0x6860('0x9a')][_0x6860('0x61')](_0xcfdcdc);})[_0x6860('0x13')](function(_0x537c1a){if(_0x2e6146[_0x6860('0x51')][_0x6860('0x9c')]===_0x6860('0x9d')){for(var _0x10e71e=0x0;_0x10e71e<_0x537c1a['length'];_0x10e71e++){_0x537c1a[_0x10e71e][_0x6860('0x66')]=juice(_0x537c1a[_0x10e71e][_0x6860('0x66')]);}}_0x342784[_0x6860('0x71')]=_0x537c1a;return _0x342784;});}})[_0x6860('0x13')](respondWithFilteredResult(_0x2bfea3,_0xcfdcdc))[_0x6860('0x1b')](handleError(_0x2bfea3,null));};exports[_0x6860('0x2c')]=function(_0x1ced2f,_0x3cadc8){var _0x3b74a4,_0x54e354={},_0x281217;if(_0x1ced2f[_0x6860('0x66')]['to']){_0x281217=_0x1ced2f[_0x6860('0x66')]['to'][_0x6860('0x9e')](',')[0x0];}return db[_0x6860('0x4c')][_0x6860('0x65')]({'where':{'id':_0x1ced2f[_0x6860('0x63')]['id']},'include':[{'model':db[_0x6860('0x9f')],'as':_0x6860('0xa0'),'include':[{'model':db[_0x6860('0x8b')],'as':_0x6860('0xa1'),'where':{'email':_0x281217},'limit':0x1,'order':[[_0x6860('0xa2'),'DESC']]}]},{'model':db['MailServerOut'],'as':_0x6860('0x45'),'raw':!![],'include':[{'model':db['CloudProvider'],'as':'CloudProvider','raw':!![]}]}]})[_0x6860('0x13')](handleEntityNotFound(_0x3cadc8,null))[_0x6860('0x13')](function(_0x285bb0){if(!_0x285bb0)return;_0x3b74a4=_0x285bb0;if(!_0x285bb0['Smtp'])throw new Error(_0x6860('0xa3'));if(_[_0x6860('0xa4')](_0x1ced2f[_0x6860('0x66')]['from'])){_0x1ced2f[_0x6860('0x66')][_0x6860('0xa5')]=util[_0x6860('0xa6')](_0x6860('0xa7'),_0x285bb0[_0x6860('0x2b')],_0x285bb0[_0x6860('0x79')]||_0x285bb0['Smtp']['user']);}if(_0x1ced2f[_0x6860('0x66')][_0x6860('0xa8')]&&_0x1ced2f[_0x6860('0x66')][_0x6860('0xa8')]['length']){for(var _0x3dfd49=0x0;_0x3dfd49<_0x1ced2f[_0x6860('0x66')][_0x6860('0xa8')]['length'];_0x3dfd49+=0x1){_0x1ced2f[_0x6860('0x66')][_0x6860('0xa8')][_0x3dfd49]={'filename':_0x1ced2f[_0x6860('0x66')]['attachments'][_0x3dfd49][_0x6860('0x2b')],'path':path[_0x6860('0xa9')](config['root'],_0x6860('0xaa'),_0x1ced2f[_0x6860('0x66')][_0x6860('0xa8')][_0x3dfd49][_0x6860('0xab')])};}}var _0x16e19d=_0x285bb0['getSmtpOptions']();return respondWithRpcPromise(_0x6860('0xac'),_0x6860('0xad'),{'account':_0x16e19d,'message':_0x1ced2f[_0x6860('0x66')]});})[_0x6860('0x13')](function(_0x50bb63){if(!_0x50bb63)return;_0x54e354=_0x50bb63;if(!_0x3b74a4[_0x6860('0xa0')])throw new Error(_0x6860('0xae'));if(_0x3b74a4[_0x6860('0xa0')]['Contacts'][_0x6860('0x6f')])return _0x3b74a4[_0x6860('0xa0')][_0x6860('0xa1')][0x0];return db[_0x6860('0x8b')][_0x6860('0x75')](_[_0x6860('0xb')](_0x1ced2f[_0x6860('0x66')],{'firstName':_0x1ced2f[_0x6860('0x66')]['to'],'email':_0x1ced2f[_0x6860('0x66')]['to'],'phone':_0x1ced2f[_0x6860('0x66')]['to'],'ListId':_0x3b74a4[_0x6860('0xaf')]}));})[_0x6860('0x13')](function(_0x3b65dd){if(!_0x3b65dd)return;var _0xa960dc={'UserId':_0x1ced2f[_0x6860('0x39')]['id'],'ContactId':_0x3b65dd['id'],'MailAccountId':_0x3b74a4['id'],'inReplyTo':_0x54e354['messageId'],'to':_0x1ced2f[_0x6860('0x66')][_0x6860('0xa5')],'cc':_0x1ced2f[_0x6860('0x66')]['cc'],'subject':_0x1ced2f[_0x6860('0x66')][_0x6860('0xb0')],'attach':_0x1ced2f[_0x6860('0x66')][_0x6860('0xb1')],'firstMsgDirection':_0x6860('0xb2'),'lastMsgAt':moment()[_0x6860('0xa6')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':'out','Messages':[_[_0x6860('0x5d')](_0x1ced2f[_0x6860('0x66')],{'messageId':_0x54e354[_0x6860('0xb3')],'sentAt':moment()[_0x6860('0xa6')]('YYYY-MM-DD\x20HH:mm:ss'),'read':!![],'MailAccountId':_0x3b74a4['id'],'UserId':_0x1ced2f[_0x6860('0x39')]['id'],'ContactId':_0x3b65dd['id']})]};if(_0x1ced2f[_0x6860('0x66')][_0x6860('0xb4')]){_0xa960dc=_[_0x6860('0x5d')](_0xa960dc,_0x1ced2f['body'][_0x6860('0xb4')]);}return db[_0x6860('0x88')][_0x6860('0x75')](_0xa960dc,{'include':[{'model':db[_0x6860('0x9a')],'as':_0x6860('0xb5')}]});})[_0x6860('0x13')](respondWithResult(_0x3cadc8,null))['catch'](handleError(_0x3cadc8,null));};exports['verifySmtp']=function(_0x5cbcea,_0x5efaa8){return db[_0x6860('0x4c')][_0x6860('0x65')]({'where':{'id':_0x5cbcea[_0x6860('0x63')]['id']},'include':[{'model':db[_0x6860('0x48')],'as':_0x6860('0x45'),'raw':!![],'include':[{'model':db['CloudProvider'],'as':'CloudProvider','raw':!![]}]}]})[_0x6860('0x13')](handleEntityNotFound(_0x5efaa8,null))[_0x6860('0x13')](function(_0x444f67){if(!_0x444f67['Smtp'])return;var _0x21c4f8=_0x444f67[_0x6860('0xb6')]();return respondWithRpcPromise(_0x6860('0xb7'),'verifySmtp',{'account':_0x21c4f8});})[_0x6860('0x13')](respondWithResult(_0x5efaa8,null))['catch'](handleError(_0x5efaa8,null));};exports['destroy']=function(_0x28fbb7,_0xa59cec){return db['MailAccount'][_0x6860('0x65')]({'where':{'id':_0x28fbb7[_0x6860('0x63')]['id']}})[_0x6860('0x13')](handleEntityNotFound(_0xa59cec,null))[_0x6860('0x13')](function(_0x5c5e16){if(_0x5c5e16&&_0x5c5e16[_0x6860('0x42')]){throw new db['Sequelize'][(_0x6860('0xb8'))](_0x6860('0xb9'));}return _0x5c5e16;})[_0x6860('0x13')](removeEntity(_0xa59cec,null))[_0x6860('0x1b')](handleError(_0xa59cec,null));};exports[_0x6860('0xba')]=function(_0x34eb75,_0x316b32){return db['MailAccount'][_0x6860('0x65')]({'where':{'id':_0x34eb75['params']['id']}})[_0x6860('0x13')](handleEntityNotFound(_0x316b32,null))[_0x6860('0x13')](function(_0x5946f3){if(_0x5946f3){return _0x5946f3[_0x6860('0xba')](_0x34eb75[_0x6860('0x66')][_0x6860('0x73')],_[_0x6860('0x89')](_0x34eb75['body'],['ids','id'])||{})[_0x6860('0xbb')](function(_0x2d0064){for(var _0x839903=0x0;_0x839903<_0x34eb75[_0x6860('0x66')][_0x6860('0x73')][_0x6860('0x6f')];_0x839903+=0x1){socket[_0x6860('0xbc')](_0x6860('0xbd'),{'UserId':Number(_0x34eb75[_0x6860('0x66')][_0x6860('0x73')][_0x839903]),'MailAccountId':Number(_0x34eb75[_0x6860('0x63')]['id'])});}return _0x2d0064;});}})[_0x6860('0x13')](respondWithResult(_0x316b32,null))['catch'](handleError(_0x316b32,null));};exports[_0x6860('0xbe')]=function(_0x303aa2,_0x1262ea){return db[_0x6860('0x4c')][_0x6860('0x65')]({'where':{'id':_0x303aa2[_0x6860('0x63')]['id']}})[_0x6860('0x13')](handleEntityNotFound(_0x1262ea,null))[_0x6860('0x13')](function(_0x65e066){if(_0x65e066){return _0x65e066[_0x6860('0xbe')](_0x303aa2[_0x6860('0x51')][_0x6860('0x73')])[_0x6860('0x13')](function(){if(_[_0x6860('0xbf')](_0x303aa2[_0x6860('0x51')][_0x6860('0x73')])){for(var _0x413769=0x0;_0x413769<_0x303aa2['query'][_0x6860('0x73')][_0x6860('0x6f')];_0x413769+=0x1){socket[_0x6860('0xbc')]('userMailAccount:remove',{'UserId':Number(_0x303aa2[_0x6860('0x51')][_0x6860('0x73')][_0x413769]),'MailAccountId':Number(_0x303aa2['params']['id'])});}}else{socket[_0x6860('0xbc')](_0x6860('0xc0'),{'UserId':Number(_0x303aa2['query'][_0x6860('0x73')]),'MailAccountId':Number(_0x303aa2[_0x6860('0x63')]['id'])});}});}})['then'](respondWithStatusCode(_0x1262ea,null))['catch'](handleError(_0x1262ea,null));};exports[_0x6860('0xc1')]=function(_0x2163b5,_0x4feffa){var _0x362f47={};var _0x8a3acd={};var _0x2c9802;var _0x458892;return db['MailAccount']['findOne']({'where':{'id':_0x2163b5[_0x6860('0x63')]['id']}})[_0x6860('0x13')](handleEntityNotFound(_0x4feffa,null))[_0x6860('0x13')](function(_0xa06eaa){if(_0xa06eaa){_0x2c9802=_0xa06eaa;_0x8a3acd[_0x6860('0x50')]=_['keys'](db[_0x6860('0x8d')][_0x6860('0x4d')]);_0x8a3acd['query']=_['keys'](_0x2163b5['query']);_0x8a3acd[_0x6860('0x5c')]=_[_0x6860('0x54')](_0x8a3acd[_0x6860('0x50')],_0x8a3acd['query']);_0x362f47['attributes']=_[_0x6860('0x54')](_0x8a3acd[_0x6860('0x50')],qs['fields'](_0x2163b5['query'][_0x6860('0x55')]));_0x362f47[_0x6860('0x53')]=_0x362f47[_0x6860('0x53')][_0x6860('0x6f')]?_0x362f47[_0x6860('0x53')]:_0x8a3acd[_0x6860('0x50')];_0x362f47[_0x6860('0x58')]=qs[_0x6860('0x59')](_0x2163b5[_0x6860('0x51')][_0x6860('0x59')]);_0x362f47[_0x6860('0x5a')]=qs[_0x6860('0x5c')](_[_0x6860('0x5b')](_0x2163b5['query'],_0x8a3acd[_0x6860('0x5c')]));if(_0x2163b5[_0x6860('0x51')][_0x6860('0x70')]){_0x362f47['where']=_[_0x6860('0x5d')](_0x362f47[_0x6860('0x5a')],{'$or':_[_0x6860('0x4b')](_0x362f47[_0x6860('0x53')],function(_0x503303){var _0x47c150={};_0x47c150[_0x503303]={'$like':'%'+_0x2163b5[_0x6860('0x51')]['filter']+'%'};return _0x47c150;})});}_0x362f47=_[_0x6860('0x5d')]({},_0x362f47,_0x2163b5[_0x6860('0x5f')]);return _0x2c9802[_0x6860('0xc1')](_0x362f47);}})[_0x6860('0x13')](function(_0x46f9a2){if(_0x46f9a2){_0x458892=_0x46f9a2['length'];if(!_0x2163b5['query'][_0x6860('0x56')](_0x6860('0x57'))){_0x362f47['limit']=qs[_0x6860('0x21')](_0x2163b5[_0x6860('0x51')][_0x6860('0x21')]);_0x362f47[_0x6860('0x20')]=qs[_0x6860('0x20')](_0x2163b5[_0x6860('0x51')]['offset']);}return _0x2c9802[_0x6860('0xc1')](_0x362f47);}})[_0x6860('0x13')](function(_0x1de938){if(_0x1de938){return _0x1de938?{'count':_0x458892,'rows':_0x1de938}:null;}})[_0x6860('0x13')](respondWithResult(_0x4feffa,null))[_0x6860('0x1b')](handleError(_0x4feffa,null));}; \ No newline at end of file +var _0x5917=['fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','options','includeAll','findAll','show','params','rawAttributes','include','find','body','provider','custom','Mail\x20Account\x20not\x20found','describe','addDisposition','MailAccountId','Disposition','create','getDispositions','findOne','pick','rows','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','email','ListId','isNil','active','description','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getImap','addImap','removeImap','setImap','getSmtp','addSmtp','removeSmtp','setSmtp','addInteraction','MailInteraction','omit','getInteractions','CmContact','Contact','fullname','Tag','Tags','color','tag','addApplications','sequelize','transaction','READ_COMMITTED','MailApplication','destroy','findAndCountAll','priority','finally','getApplications','MailMessage','$gte','split','YYYY-MM-DD\x20HH:mm:ss','inlineCss','CmList','List','Contacts','DESC','Smtp\x20configuration\x20not\x20found','from','format','%s\x20<%s>','attachments','join','root','getSmtpOptions','SendMail','sendMail','List\x20not\x20found','messageId','subject','attach','out','verifySmtp','CloudProvider','VerifySmtp','Sequelize','ValidationError','addAgents','spread','emit','userMailAccount:save','removeAgents','userMailAccount:remove','getAgents','moment','util','path','lodash','juice','ioredis','../../components/parsers/qs','../../config/logger','../../config/environment','defaults','redis','localhost','socket.io-emitter','./mailAccount.socket','register','client','then','info','MailAccount,\x20%s,\x20%s','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','status','end','json','offset','undefined','limit','count','set','update','get','MailAccounts','sendStatus','stack','name','send','gmail','yahoo','imap.mail.yahoo.com','imap-mail.outlook.com','outlook365','outlook.office365.com','Unknown\x20email\x20service\x20provider','smtp.mail.yahoo.com','hotmail','smtp-mail.outlook.com','smtp.office365.com','user','username','pass','modernAuthentication','CloudProviderId','password','host','port','secure','service','authentication','Imap','Smtp','index','MailServerIn','MailServerOut','Pause','mandatoryDispositionPause','map','MailAccount','fieldName','model','query','keys','attributes','intersection'];(function(_0x45f951,_0x2750c8){var _0x24756c=function(_0x31c931){while(--_0x31c931){_0x45f951['push'](_0x45f951['shift']());}};_0x24756c(++_0x2750c8);}(_0x5917,0x134));var _0x7591=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x5917[_0x2dafbe];return _0x58a45a;};'use strict';var moment=require(_0x7591('0x0'));var BPromise=require('bluebird');var util=require(_0x7591('0x1'));var path=require(_0x7591('0x2'));var _=require(_0x7591('0x3'));var juice=require(_0x7591('0x4'));var Redis=require(_0x7591('0x5'));var qs=require(_0x7591('0x6'));var logger=require(_0x7591('0x7'))('api');var config=require(_0x7591('0x8'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x7591('0x9')](config[_0x7591('0xa')],{'host':_0x7591('0xb'),'port':0x18eb});var socket=require(_0x7591('0xc'))(new Redis(config[_0x7591('0xa')]));require(_0x7591('0xd'))[_0x7591('0xe')](socket);var jayson=require('jayson/promise');var client=jayson[_0x7591('0xf')]['http']({'port':0x232b});function respondWithRpcPromise(_0x6fb551,_0x1f6ad9,_0x31b068,_0x10e261){return new BPromise(function(_0x4b2575,_0xb0abb9){var _0x4ef15d=_0x10e261||client;return _0x4ef15d['request'](_0x6fb551,_0x31b068)[_0x7591('0x10')](function(_0x2e31e5){logger[_0x7591('0x11')](_0x7591('0x12'),_0x1f6ad9,_0x7591('0x13'));logger[_0x7591('0x14')](_0x7591('0x15'),_0x1f6ad9,'request\x20sent',JSON[_0x7591('0x16')](_0x2e31e5));if(_0x2e31e5[_0x7591('0x17')]){if(_0x2e31e5[_0x7591('0x17')][_0x7591('0x18')]===0x1f4){logger[_0x7591('0x17')](_0x7591('0x12'),_0x1f6ad9,_0x2e31e5[_0x7591('0x17')][_0x7591('0x19')]);return _0xb0abb9(_0x2e31e5[_0x7591('0x17')]['message']);}logger[_0x7591('0x17')]('MailAccount,\x20%s,\x20%s',_0x1f6ad9,_0x2e31e5['error']['message']);return _0x4b2575(_0x2e31e5['error'][_0x7591('0x19')]);}else{logger[_0x7591('0x11')](_0x7591('0x12'),_0x1f6ad9,_0x7591('0x13'));_0x4b2575(_0x2e31e5[_0x7591('0x1a')]['message']);}})[_0x7591('0x1b')](function(_0x2bdcb6){logger[_0x7591('0x17')](_0x7591('0x12'),_0x1f6ad9,_0x2bdcb6);_0xb0abb9(_0x2bdcb6);});});}function respondWithStatusCode(_0x56c27d,_0x270985){_0x270985=_0x270985||0xcc;return function(_0xabc50e){if(_0xabc50e){return _0x56c27d['sendStatus'](_0x270985);}return _0x56c27d[_0x7591('0x1c')](_0x270985)[_0x7591('0x1d')]();};}function respondWithResult(_0x45fbee,_0x5bf7a2){_0x5bf7a2=_0x5bf7a2||0xc8;return function(_0x22a59e){if(_0x22a59e){return _0x45fbee[_0x7591('0x1c')](_0x5bf7a2)[_0x7591('0x1e')](_0x22a59e);}};}function respondWithFilteredResult(_0x3e5ab2,_0x2dbda5){return function(_0xd4d48f){if(_0xd4d48f){var _0x41d2b8=typeof _0x2dbda5[_0x7591('0x1f')]===_0x7591('0x20')&&typeof _0x2dbda5[_0x7591('0x21')]===_0x7591('0x20');var _0x401535=_0xd4d48f[_0x7591('0x22')];var _0x1fc2f7=_0x41d2b8?0x0:_0x2dbda5[_0x7591('0x1f')];var _0x200719=_0x41d2b8?_0xd4d48f[_0x7591('0x22')]:_0x2dbda5[_0x7591('0x1f')]+_0x2dbda5[_0x7591('0x21')];var _0xad8992;if(_0x200719>=_0x401535){_0x200719=_0x401535;_0xad8992=0xc8;}else{_0xad8992=0xce;}_0x3e5ab2['status'](_0xad8992);return _0x3e5ab2[_0x7591('0x23')]('Content-Range',_0x1fc2f7+'-'+_0x200719+'/'+_0x401535)[_0x7591('0x1e')](_0xd4d48f);}return null;};}function saveUpdates(_0x3c211c){return function(_0x31515e){if(_0x31515e){return _0x31515e[_0x7591('0x24')](_0x3c211c)[_0x7591('0x10')](function(_0x39462b){return _0x39462b;});}return null;};}function removeEntity(_0x2544d4){return function(_0x53a44c){if(_0x53a44c){return _0x53a44c['destroy']()['then'](function(){var _0x4cb9e1=_0x53a44c[_0x7591('0x25')]({'plain':!![]});var _0x22100b=_0x7591('0x26');return db['UserProfileResource']['destroy']({'where':{'type':_0x22100b,'resourceId':_0x4cb9e1['id']}})[_0x7591('0x10')](function(){return _0x53a44c;});})['then'](function(){_0x2544d4['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x18d59b){return function(_0x448c4a){if(!_0x448c4a){_0x18d59b[_0x7591('0x27')](0x194);}return _0x448c4a;};}function handleError(_0x1d794b,_0xce33d6){_0xce33d6=_0xce33d6||0x1f4;return function(_0x4e084c){logger['error'](_0x4e084c[_0x7591('0x28')]);if(_0x4e084c['name']){delete _0x4e084c[_0x7591('0x29')];}_0x1d794b[_0x7591('0x1c')](_0xce33d6)[_0x7591('0x2a')](_0x4e084c);};}function getImapHost(_0x47603b){switch(_0x47603b){case _0x7591('0x2b'):return'imap.gmail.com';case _0x7591('0x2c'):return _0x7591('0x2d');case'hotmail':return _0x7591('0x2e');case _0x7591('0x2f'):return _0x7591('0x30');}throw new Error(_0x7591('0x31'),_0x47603b);}function getSmtpHost(_0x5b87be){switch(_0x5b87be){case _0x7591('0x2b'):return'smtp.gmail.com';case _0x7591('0x2c'):return _0x7591('0x32');case _0x7591('0x33'):return _0x7591('0x34');case'outlook365':return _0x7591('0x35');}throw new Error(_0x7591('0x31'),_0x5b87be);}function getAuthenticationOptions(_0x260b37,_0x2e745a){var _0x256f84={};var _0x6ac984={};if(_0x260b37){_0x256f84[_0x7591('0x36')]=_0x6ac984[_0x7591('0x36')]=_0x2e745a[_0x7591('0x37')];_0x256f84['password']=_0x6ac984[_0x7591('0x38')]=_0x2e745a['password'];if(_0x2e745a['modernAuthentication']){_0x256f84[_0x7591('0x39')]=_0x6ac984[_0x7591('0x39')]=!![];_0x256f84[_0x7591('0x3a')]=_0x6ac984[_0x7591('0x3a')]=_0x2e745a['CloudProviderId'];_0x256f84[_0x7591('0x3b')]=_0x6ac984['pass']=null;}else{_0x256f84[_0x7591('0x3a')]=_0x6ac984['CloudProviderId']=null;}_0x256f84['host']=getImapHost(_0x260b37);_0x256f84['port']=0x3e1;_0x6ac984[_0x7591('0x3c')]=getSmtpHost(_0x260b37);_0x6ac984[_0x7591('0x3d')]=0x24b;_0x6ac984[_0x7591('0x3e')]=![];_0x256f84[_0x7591('0x3f')]=_0x6ac984[_0x7591('0x3f')]=null;}else{if(_0x2e745a[_0x7591('0x40')]){_0x256f84[_0x7591('0x36')]=_0x6ac984['user']=_0x2e745a[_0x7591('0x37')];_0x256f84['password']=_0x6ac984[_0x7591('0x38')]=_0x2e745a[_0x7591('0x3b')];}else{_0x256f84[_0x7591('0x40')]=_0x6ac984[_0x7591('0x40')]=![];_0x256f84['user']=_0x6ac984[_0x7591('0x36')]=null;_0x256f84['password']=_0x6ac984[_0x7591('0x38')]=null;}_0x256f84['host']=_0x2e745a['Imap']['host'];_0x256f84[_0x7591('0x3d')]=_0x2e745a[_0x7591('0x41')][_0x7591('0x3d')];_0x6ac984['host']=_0x2e745a['Smtp'][_0x7591('0x3c')];_0x6ac984[_0x7591('0x3d')]=_0x2e745a[_0x7591('0x42')][_0x7591('0x3d')];}return{'Imap':_0x256f84,'Smtp':_0x6ac984};}exports[_0x7591('0x43')]=function(_0x3a44be,_0x5dff84){var _0x42afc5={'include':[{'model':db[_0x7591('0x44')],'as':_0x7591('0x41')},{'model':db[_0x7591('0x45')],'as':_0x7591('0x42')},{'model':db[_0x7591('0x46')],'as':_0x7591('0x47')}]},_0x36b2c2={},_0x1991fd={'count':0x0,'rows':[]};var _0x12f6e8=_[_0x7591('0x48')](db[_0x7591('0x49')]['rawAttributes'],function(_0x33a145){return{'name':_0x33a145[_0x7591('0x4a')],'type':_0x33a145['type']['key']};});_0x36b2c2[_0x7591('0x4b')]=_[_0x7591('0x48')](_0x12f6e8,_0x7591('0x29'));_0x36b2c2[_0x7591('0x4c')]=_[_0x7591('0x4d')](_0x3a44be[_0x7591('0x4c')]);_0x36b2c2['filters']=_['intersection'](_0x36b2c2[_0x7591('0x4b')],_0x36b2c2[_0x7591('0x4c')]);_0x42afc5[_0x7591('0x4e')]=_[_0x7591('0x4f')](_0x36b2c2[_0x7591('0x4b')],qs[_0x7591('0x50')](_0x3a44be[_0x7591('0x4c')]['fields']));_0x42afc5[_0x7591('0x4e')]=_0x42afc5['attributes'][_0x7591('0x51')]?_0x42afc5[_0x7591('0x4e')]:_0x36b2c2[_0x7591('0x4b')];if(!_0x3a44be[_0x7591('0x4c')][_0x7591('0x52')](_0x7591('0x53'))){_0x42afc5[_0x7591('0x21')]=qs['limit'](_0x3a44be[_0x7591('0x4c')][_0x7591('0x21')]);_0x42afc5[_0x7591('0x1f')]=qs[_0x7591('0x1f')](_0x3a44be['query'][_0x7591('0x1f')]);}_0x42afc5[_0x7591('0x54')]=qs['sort'](_0x3a44be[_0x7591('0x4c')][_0x7591('0x55')]);_0x42afc5[_0x7591('0x56')]=qs[_0x7591('0x57')](_['pick'](_0x3a44be['query'],_0x36b2c2[_0x7591('0x57')]),_0x12f6e8);if(_0x3a44be['query'][_0x7591('0x58')]){_0x42afc5['where']=_[_0x7591('0x59')](_0x42afc5[_0x7591('0x56')],{'$or':_['map'](_0x12f6e8,function(_0x359ac9){if(_0x359ac9['type']!==_0x7591('0x5a')){var _0x26dff1={};_0x26dff1[_0x359ac9[_0x7591('0x29')]]={'$like':'%'+_0x3a44be[_0x7591('0x4c')]['filter']+'%'};return _0x26dff1;}})});}_0x42afc5=_[_0x7591('0x59')]({},_0x42afc5,_0x3a44be[_0x7591('0x5b')]);var _0x2dfd37={'where':_0x42afc5[_0x7591('0x56')]};return db[_0x7591('0x49')][_0x7591('0x22')](_0x2dfd37)[_0x7591('0x10')](function(_0x514a83){_0x1991fd[_0x7591('0x22')]=_0x514a83;if(_0x3a44be['query'][_0x7591('0x5c')]){_0x42afc5['include']=[{'all':!![]}];}return db[_0x7591('0x49')][_0x7591('0x5d')](_0x42afc5);})[_0x7591('0x10')](function(_0x54f4a2){_0x1991fd['rows']=_0x54f4a2;return _0x1991fd;})[_0x7591('0x10')](respondWithFilteredResult(_0x5dff84,_0x42afc5))[_0x7591('0x1b')](handleError(_0x5dff84,null));};exports[_0x7591('0x5e')]=function(_0x286dd7,_0x41e150){var _0x53ea94={'raw':![],'where':{'id':_0x286dd7[_0x7591('0x5f')]['id']},'include':[{'model':db[_0x7591('0x44')],'as':'Imap'},{'model':db[_0x7591('0x45')],'as':_0x7591('0x42')},{'model':db[_0x7591('0x46')],'as':_0x7591('0x47')}]},_0xa86bc2={};_0xa86bc2[_0x7591('0x4b')]=_[_0x7591('0x4d')](db[_0x7591('0x49')][_0x7591('0x60')]);_0xa86bc2[_0x7591('0x4c')]=_['keys'](_0x286dd7[_0x7591('0x4c')]);_0xa86bc2[_0x7591('0x57')]=_[_0x7591('0x4f')](_0xa86bc2[_0x7591('0x4b')],_0xa86bc2['query']);_0x53ea94[_0x7591('0x4e')]=_[_0x7591('0x4f')](_0xa86bc2['model'],qs[_0x7591('0x50')](_0x286dd7[_0x7591('0x4c')][_0x7591('0x50')]));_0x53ea94['attributes']=_0x53ea94[_0x7591('0x4e')][_0x7591('0x51')]?_0x53ea94[_0x7591('0x4e')]:_0xa86bc2[_0x7591('0x4b')];if(_0x286dd7[_0x7591('0x4c')][_0x7591('0x5c')]){_0x53ea94[_0x7591('0x61')]=[{'all':!![]}];}_0x53ea94=_['merge']({},_0x53ea94,_0x286dd7[_0x7591('0x5b')]);return db[_0x7591('0x49')][_0x7591('0x62')](_0x53ea94)[_0x7591('0x10')](handleEntityNotFound(_0x41e150,null))[_0x7591('0x10')](respondWithResult(_0x41e150,null))[_0x7591('0x1b')](handleError(_0x41e150,null));};exports['update']=function(_0x2c02bf,_0x3230ae){if(_0x2c02bf['body']['id']){delete _0x2c02bf[_0x7591('0x63')]['id'];}var _0xa29abc=_0x2c02bf[_0x7591('0x63')][_0x7591('0x64')]===_0x7591('0x65')?null:_0x2c02bf[_0x7591('0x63')][_0x7591('0x64')];var _0x430823=_0x2c02bf['body'][_0x7591('0x41')]||{};var _0x381893=_0x2c02bf[_0x7591('0x63')]['Smtp']||{};if(_0xa29abc){_0x430823['host']=getImapHost(_0xa29abc);_0x430823[_0x7591('0x3d')]=0x3e1;_0x381893[_0x7591('0x3c')]=getSmtpHost(_0xa29abc);_0x381893[_0x7591('0x3d')]=0x24b;_0x381893[_0x7591('0x3e')]=![];}if(_0x381893[_0x7591('0x39')]){_0x381893['secure']=![];}else{_0x381893[_0x7591('0x3a')]=null;}if(!_0x430823[_0x7591('0x39')])_0x430823['CloudProviderId']=null;_0x2c02bf[_0x7591('0x63')][_0x7591('0x41')]=_0x430823;_0x2c02bf[_0x7591('0x63')][_0x7591('0x42')]=_0x381893;return db[_0x7591('0x49')]['find']({'where':{'id':_0x2c02bf[_0x7591('0x5f')]['id']},'include':[{'model':db[_0x7591('0x44')],'as':'Imap'},{'model':db[_0x7591('0x45')],'as':_0x7591('0x42')},{'model':db[_0x7591('0x46')],'as':'mandatoryDispositionPause'}]})[_0x7591('0x10')](handleEntityNotFound(_0x3230ae,null))[_0x7591('0x10')](function(_0x4c5375){if(!_0x4c5375)throw new Error(_0x7591('0x66'));if(_0x4c5375[_0x7591('0x3f')])delete _0x2c02bf[_0x7591('0x63')]['Imap'];return _0x4c5375;})[_0x7591('0x10')](saveUpdates(_0x2c02bf[_0x7591('0x63')],null))['then'](function(_0xb3b3e4){if(!_0x2c02bf[_0x7591('0x63')][_0x7591('0x41')])return _0xb3b3e4;return db[_0x7591('0x44')]['update'](_0x2c02bf[_0x7591('0x63')][_0x7591('0x41')],{'where':{'MailAccountId':_0xb3b3e4['id']}})[_0x7591('0x10')](function(){return _0xb3b3e4;});})[_0x7591('0x10')](function(_0x554eaa){if(!_0x2c02bf['body'][_0x7591('0x42')])return _0x554eaa;return db[_0x7591('0x45')][_0x7591('0x24')](_0x2c02bf[_0x7591('0x63')]['Smtp'],{'where':{'MailAccountId':_0x554eaa['id']}})['then'](function(){return _0x554eaa;});})[_0x7591('0x10')](respondWithResult(_0x3230ae,null))['catch'](handleError(_0x3230ae,null));};exports[_0x7591('0x67')]=function(_0x59636b,_0x58daa4){return db[_0x7591('0x49')]['describe']()[_0x7591('0x10')](respondWithResult(_0x58daa4,null))[_0x7591('0x1b')](handleError(_0x58daa4,null));};exports[_0x7591('0x68')]=function(_0x1ffd1e,_0x4d6b14){if(_0x1ffd1e[_0x7591('0x63')]['id']){delete _0x1ffd1e[_0x7591('0x63')]['id'];}return db[_0x7591('0x49')][_0x7591('0x62')]({'where':{'id':_0x1ffd1e[_0x7591('0x5f')]['id']}})[_0x7591('0x10')](handleEntityNotFound(_0x4d6b14,null))[_0x7591('0x10')](function(_0x3f2972){if(_0x3f2972){_0x1ffd1e[_0x7591('0x63')][_0x7591('0x69')]=_0x3f2972['id'];return db[_0x7591('0x6a')][_0x7591('0x6b')](_0x1ffd1e[_0x7591('0x63')]);}})[_0x7591('0x10')](respondWithResult(_0x4d6b14,null))[_0x7591('0x1b')](handleError(_0x4d6b14,null));};exports[_0x7591('0x6c')]=function(_0x161975,_0x247371){var _0x3c3644={'raw':![],'where':{}};var _0x516d4f={};var _0x4ec6a6={'count':0x0,'rows':[]};return db['MailAccount'][_0x7591('0x6d')]({'where':{'id':_0x161975['params']['id']}})[_0x7591('0x10')](handleEntityNotFound(_0x247371,null))['then'](function(_0x131e77){if(_0x131e77){_0x516d4f[_0x7591('0x4b')]=_[_0x7591('0x4d')](db[_0x7591('0x6a')]['rawAttributes']);_0x516d4f['query']=_[_0x7591('0x4d')](_0x161975[_0x7591('0x4c')]);_0x516d4f[_0x7591('0x57')]=_[_0x7591('0x4f')](_0x516d4f['model'],_0x516d4f[_0x7591('0x4c')]);_0x3c3644[_0x7591('0x4e')]=_[_0x7591('0x4f')](_0x516d4f[_0x7591('0x4b')],qs['fields'](_0x161975['query']['fields']));_0x3c3644[_0x7591('0x4e')]=_0x3c3644['attributes'][_0x7591('0x51')]?_0x3c3644[_0x7591('0x4e')]:_0x516d4f[_0x7591('0x4b')];if(!_0x161975['query'][_0x7591('0x52')]('nolimit')){_0x3c3644[_0x7591('0x21')]=qs['limit'](_0x161975[_0x7591('0x4c')][_0x7591('0x21')]);_0x3c3644[_0x7591('0x1f')]=qs['offset'](_0x161975['query']['offset']);}_0x3c3644[_0x7591('0x54')]=qs[_0x7591('0x55')](_0x161975[_0x7591('0x4c')][_0x7591('0x55')]);_0x3c3644[_0x7591('0x56')]=qs[_0x7591('0x57')](_[_0x7591('0x6e')](_0x161975[_0x7591('0x4c')],_0x516d4f[_0x7591('0x57')]));_0x3c3644['where'][_0x7591('0x69')]=_0x131e77['id'];if(_0x161975['query'][_0x7591('0x58')]){_0x3c3644[_0x7591('0x56')]=_[_0x7591('0x59')](_0x3c3644[_0x7591('0x56')],{'$or':_[_0x7591('0x48')](_0x3c3644[_0x7591('0x4e')],function(_0x20593a){var _0x3cfc21={};_0x3cfc21[_0x20593a]={'$like':'%'+_0x161975[_0x7591('0x4c')][_0x7591('0x58')]+'%'};return _0x3cfc21;})});}_0x3c3644=_[_0x7591('0x59')]({},_0x3c3644,_0x161975[_0x7591('0x5b')]);return db['Disposition'][_0x7591('0x22')]({'where':_0x3c3644[_0x7591('0x56')]})[_0x7591('0x10')](function(_0x4fd68f){_0x4ec6a6[_0x7591('0x22')]=_0x4fd68f;if(_0x161975[_0x7591('0x4c')][_0x7591('0x5c')]){_0x3c3644[_0x7591('0x61')]=[{'all':!![]}];}return db['Disposition'][_0x7591('0x5d')](_0x3c3644);})[_0x7591('0x10')](function(_0x2f69c5){_0x4ec6a6[_0x7591('0x6f')]=_0x2f69c5;return _0x4ec6a6;});}})[_0x7591('0x10')](respondWithFilteredResult(_0x247371,_0x3c3644))[_0x7591('0x1b')](handleError(_0x247371,null));};exports[_0x7591('0x70')]=function(_0x33fe0c,_0x3c49bb){return db[_0x7591('0x49')][_0x7591('0x62')]({'where':{'id':_0x33fe0c[_0x7591('0x5f')]['id']}})[_0x7591('0x10')](handleEntityNotFound(_0x3c49bb,null))[_0x7591('0x10')](function(_0x5f4a0e){if(_0x5f4a0e){return _0x5f4a0e[_0x7591('0x70')](_0x33fe0c['query'][_0x7591('0x71')]);}})[_0x7591('0x10')](respondWithStatusCode(_0x3c49bb,null))[_0x7591('0x1b')](handleError(_0x3c49bb,null));};exports[_0x7591('0x72')]=function(_0xf974dd,_0x11cf41){if(_0xf974dd['body']['id']){delete _0xf974dd[_0x7591('0x63')]['id'];}return db[_0x7591('0x49')][_0x7591('0x62')]({'where':{'id':_0xf974dd['params']['id']}})[_0x7591('0x10')](handleEntityNotFound(_0x11cf41,null))[_0x7591('0x10')](function(_0x2fde82){if(_0x2fde82){_0xf974dd[_0x7591('0x63')]['MailAccountId']=_0x2fde82['id'];return db[_0x7591('0x73')][_0x7591('0x6b')](_0xf974dd['body']);}})[_0x7591('0x10')](respondWithResult(_0x11cf41,null))['catch'](handleError(_0x11cf41,null));};exports[_0x7591('0x74')]=function(_0x1b9acd,_0x265e00){var _0x336069={'raw':![],'where':{}};var _0x2fbc1c={};var _0x126731={'count':0x0,'rows':[]};return db['MailAccount'][_0x7591('0x6d')]({'where':{'id':_0x1b9acd[_0x7591('0x5f')]['id']}})[_0x7591('0x10')](handleEntityNotFound(_0x265e00,null))[_0x7591('0x10')](function(_0x3ebf89){if(_0x3ebf89){_0x2fbc1c[_0x7591('0x4b')]=_['keys'](db[_0x7591('0x73')][_0x7591('0x60')]);_0x2fbc1c['query']=_[_0x7591('0x4d')](_0x1b9acd[_0x7591('0x4c')]);_0x2fbc1c[_0x7591('0x57')]=_[_0x7591('0x4f')](_0x2fbc1c[_0x7591('0x4b')],_0x2fbc1c[_0x7591('0x4c')]);_0x336069[_0x7591('0x4e')]=_[_0x7591('0x4f')](_0x2fbc1c[_0x7591('0x4b')],qs[_0x7591('0x50')](_0x1b9acd['query']['fields']));_0x336069['attributes']=_0x336069[_0x7591('0x4e')]['length']?_0x336069[_0x7591('0x4e')]:_0x2fbc1c[_0x7591('0x4b')];if(!_0x1b9acd[_0x7591('0x4c')][_0x7591('0x52')](_0x7591('0x53'))){_0x336069['limit']=qs['limit'](_0x1b9acd['query']['limit']);_0x336069[_0x7591('0x1f')]=qs['offset'](_0x1b9acd[_0x7591('0x4c')][_0x7591('0x1f')]);}_0x336069['order']=qs[_0x7591('0x55')](_0x1b9acd['query'][_0x7591('0x55')]);_0x336069[_0x7591('0x56')]=qs[_0x7591('0x57')](_[_0x7591('0x6e')](_0x1b9acd[_0x7591('0x4c')],_0x2fbc1c[_0x7591('0x57')]));_0x336069[_0x7591('0x56')][_0x7591('0x69')]=_0x3ebf89['id'];if(_0x1b9acd[_0x7591('0x4c')][_0x7591('0x58')]){_0x336069['where']=_[_0x7591('0x59')](_0x336069[_0x7591('0x56')],{'$or':_['map'](_0x336069[_0x7591('0x4e')],function(_0x8b283b){var _0x203d03={};_0x203d03[_0x8b283b]={'$like':'%'+_0x1b9acd['query']['filter']+'%'};return _0x203d03;})});}_0x336069=_[_0x7591('0x59')]({},_0x336069,_0x1b9acd[_0x7591('0x5b')]);return db['CannedAnswer'][_0x7591('0x22')]({'where':_0x336069[_0x7591('0x56')]})[_0x7591('0x10')](function(_0x1ca8ae){_0x126731[_0x7591('0x22')]=_0x1ca8ae;if(_0x1b9acd[_0x7591('0x4c')][_0x7591('0x5c')]){_0x336069[_0x7591('0x61')]=[{'all':!![]}];}return db[_0x7591('0x73')][_0x7591('0x5d')](_0x336069);})['then'](function(_0x43d372){_0x126731[_0x7591('0x6f')]=_0x43d372;return _0x126731;});}})[_0x7591('0x10')](respondWithFilteredResult(_0x265e00,_0x336069))[_0x7591('0x1b')](handleError(_0x265e00,null));};exports[_0x7591('0x75')]=function(_0x49e4cf,_0x38f5bb){return db[_0x7591('0x49')][_0x7591('0x62')]({'where':{'id':_0x49e4cf[_0x7591('0x5f')]['id']}})[_0x7591('0x10')](handleEntityNotFound(_0x38f5bb,null))[_0x7591('0x10')](function(_0x144ff8){if(_0x144ff8){return _0x144ff8['removeAnswers'](_0x49e4cf[_0x7591('0x4c')]['ids']);}})[_0x7591('0x10')](respondWithStatusCode(_0x38f5bb,null))['catch'](handleError(_0x38f5bb,null));};exports['create']=function(_0x2f469d,_0x23f546){var _0x1bdeca={'name':_0x2f469d['body'][_0x7591('0x29')],'key':_0x2f469d[_0x7591('0x63')]['key'],'provider':_0x2f469d[_0x7591('0x63')][_0x7591('0x64')]===_0x7591('0x65')?null:_0x2f469d[_0x7591('0x63')]['provider'],'email':_0x2f469d[_0x7591('0x63')][_0x7591('0x76')],'ListId':_0x2f469d[_0x7591('0x63')][_0x7591('0x77')],'active':!_[_0x7591('0x78')](_0x2f469d[_0x7591('0x63')]['active'])?_0x2f469d[_0x7591('0x63')][_0x7591('0x79')]:!![],'description':_0x2f469d['body'][_0x7591('0x7a')]||null};var _0x42d4fe=getAuthenticationOptions(_0x1bdeca[_0x7591('0x64')],_0x2f469d[_0x7591('0x63')]);_0x1bdeca[_0x7591('0x41')]=_0x42d4fe[_0x7591('0x41')];_0x1bdeca['Smtp']=_0x42d4fe[_0x7591('0x42')];return db['MailAccount'][_0x7591('0x6b')](_0x1bdeca,{'include':[{'model':db[_0x7591('0x45')],'as':_0x7591('0x42')},{'model':db[_0x7591('0x44')],'as':'Imap'}]})[_0x7591('0x10')](function(_0x8935b4){var _0x5b4157=_0x2f469d['user']['get']({'plain':!![]});if(!_0x5b4157)throw new Error(_0x7591('0x7b'));if(_0x5b4157[_0x7591('0x7c')]===_0x7591('0x36')){var _0x2ab3b7=_0x8935b4[_0x7591('0x25')]({'plain':!![]});return db[_0x7591('0x7d')][_0x7591('0x62')]({'where':{'name':_0x7591('0x26'),'userProfileId':_0x5b4157[_0x7591('0x7e')]},'raw':!![]})[_0x7591('0x10')](function(_0x3c6737){if(_0x3c6737&&_0x3c6737[_0x7591('0x7f')]===0x0){return db['UserProfileResource'][_0x7591('0x6b')]({'name':_0x2ab3b7[_0x7591('0x29')],'resourceId':_0x2ab3b7['id'],'type':_0x3c6737[_0x7591('0x29')],'sectionId':_0x3c6737['id']},{})[_0x7591('0x10')](function(){return _0x8935b4;});}else{return _0x8935b4;}})['catch'](function(_0x36eaf7){logger[_0x7591('0x17')](_0x7591('0x80'),_0x36eaf7);throw _0x36eaf7;});}return _0x8935b4;})[_0x7591('0x10')](respondWithResult(_0x23f546,0xc9))['catch'](handleError(_0x23f546,null));};exports['getImap']=function(_0x43962e,_0x1609e0){return db[_0x7591('0x49')][_0x7591('0x6d')]({'where':{'id':_0x43962e[_0x7591('0x5f')]['id']}})[_0x7591('0x10')](handleEntityNotFound(_0x1609e0,null))[_0x7591('0x10')](function(_0x2beb28){if(_0x2beb28){return _0x2beb28[_0x7591('0x81')]();}return null;})[_0x7591('0x10')](respondWithResult(_0x1609e0,null))[_0x7591('0x1b')](handleError(_0x1609e0,null));};exports[_0x7591('0x82')]=function(_0x13c17c,_0x39b8e6){if(_0x13c17c['body']['id']){delete _0x13c17c['body']['id'];}return db[_0x7591('0x49')][_0x7591('0x62')]({'where':{'id':_0x13c17c['params']['id']}})[_0x7591('0x10')](handleEntityNotFound(_0x39b8e6,null))['then'](function(_0x5b70f9){if(_0x5b70f9){_0x13c17c['body'][_0x7591('0x69')]=_0x5b70f9['id'];return db[_0x7591('0x44')]['create'](_0x13c17c['body']);}})['then'](respondWithResult(_0x39b8e6,null))[_0x7591('0x1b')](handleError(_0x39b8e6,null));};exports[_0x7591('0x83')]=function(_0xf0b016,_0x45facf){return db['MailAccount'][_0x7591('0x6d')]({'where':{'id':_0xf0b016[_0x7591('0x5f')]['id']}})[_0x7591('0x10')](handleEntityNotFound(_0x45facf,null))[_0x7591('0x10')](function(_0x1f5b71){if(_0x1f5b71){return _0x1f5b71[_0x7591('0x84')](null);}return null;})[_0x7591('0x10')](respondWithStatusCode(_0x45facf,null))['catch'](handleError(_0x45facf,null));};exports[_0x7591('0x85')]=function(_0x23179b,_0x4909bb){return db['MailAccount'][_0x7591('0x6d')]({'where':{'id':_0x23179b[_0x7591('0x5f')]['id']}})['then'](handleEntityNotFound(_0x4909bb,null))['then'](function(_0x2f90ec){if(_0x2f90ec){return _0x2f90ec['getSmtp']();}return null;})[_0x7591('0x10')](respondWithResult(_0x4909bb,null))[_0x7591('0x1b')](handleError(_0x4909bb,null));};exports[_0x7591('0x86')]=function(_0x17a69c,_0x2890de){if(_0x17a69c[_0x7591('0x63')]['id']){delete _0x17a69c[_0x7591('0x63')]['id'];}return db[_0x7591('0x49')][_0x7591('0x62')]({'where':{'id':_0x17a69c[_0x7591('0x5f')]['id']}})[_0x7591('0x10')](handleEntityNotFound(_0x2890de,null))[_0x7591('0x10')](function(_0x3108b0){if(_0x3108b0){_0x17a69c[_0x7591('0x63')][_0x7591('0x69')]=_0x3108b0['id'];return db['MailServerOut'][_0x7591('0x6b')](_0x17a69c[_0x7591('0x63')]);}})[_0x7591('0x10')](respondWithResult(_0x2890de,null))['catch'](handleError(_0x2890de,null));};exports[_0x7591('0x87')]=function(_0x192771,_0x270653){return db[_0x7591('0x49')][_0x7591('0x6d')]({'where':{'id':_0x192771['params']['id']}})[_0x7591('0x10')](handleEntityNotFound(_0x270653,null))['then'](function(_0x3a071b){if(_0x3a071b){return _0x3a071b[_0x7591('0x88')](null);}return null;})[_0x7591('0x10')](respondWithStatusCode(_0x270653,null))[_0x7591('0x1b')](handleError(_0x270653,null));};exports[_0x7591('0x89')]=function(_0x1de0eb,_0x4a044b){return db[_0x7591('0x8a')]['find']({'where':{'id':_0x1de0eb['params']['id']}})[_0x7591('0x10')](handleEntityNotFound(_0x4a044b,null))[_0x7591('0x10')](function(_0x249ecf){if(_0x249ecf){return _0x249ecf[_0x7591('0x89')](_0x1de0eb[_0x7591('0x63')][_0x7591('0x71')],_[_0x7591('0x8b')](_0x1de0eb['body'],['ids','id'])||{});}})['then'](respondWithResult(_0x4a044b,null))['catch'](handleError(_0x4a044b,null));};exports[_0x7591('0x8c')]=function(_0x497e7b,_0x4ec008){var _0x1be924={'raw':![],'where':{}};var _0x3601c3={};var _0x53a355={'count':0x0,'rows':[]};return db[_0x7591('0x49')][_0x7591('0x6d')]({'where':{'id':_0x497e7b[_0x7591('0x5f')]['id']}})[_0x7591('0x10')](handleEntityNotFound(_0x4ec008,null))['then'](function(_0x1c1b55){if(_0x1c1b55){_0x3601c3['model']=_[_0x7591('0x4d')](db[_0x7591('0x8a')][_0x7591('0x60')]);_0x3601c3[_0x7591('0x4c')]=_[_0x7591('0x4d')](_0x497e7b[_0x7591('0x4c')]);_0x3601c3[_0x7591('0x57')]=_[_0x7591('0x4f')](_0x3601c3[_0x7591('0x4b')],_0x3601c3[_0x7591('0x4c')]);_0x1be924[_0x7591('0x4e')]=_[_0x7591('0x4f')](_0x3601c3[_0x7591('0x4b')],qs[_0x7591('0x50')](_0x497e7b[_0x7591('0x4c')][_0x7591('0x50')]));_0x1be924['attributes']=_0x1be924[_0x7591('0x4e')]['length']?_0x1be924['attributes']:_0x3601c3[_0x7591('0x4b')];if(!_0x497e7b[_0x7591('0x4c')][_0x7591('0x52')](_0x7591('0x53'))){_0x1be924['limit']=qs[_0x7591('0x21')](_0x497e7b[_0x7591('0x4c')]['limit']);_0x1be924[_0x7591('0x1f')]=qs[_0x7591('0x1f')](_0x497e7b['query'][_0x7591('0x1f')]);}_0x1be924[_0x7591('0x54')]=qs[_0x7591('0x55')](_0x497e7b[_0x7591('0x4c')]['sort']);_0x1be924[_0x7591('0x56')]=qs[_0x7591('0x57')](_[_0x7591('0x6e')](_0x497e7b[_0x7591('0x4c')],_0x3601c3[_0x7591('0x57')]));_0x1be924['where'][_0x7591('0x69')]=_0x1c1b55['id'];if(_0x497e7b[_0x7591('0x4c')][_0x7591('0x58')]){_0x1be924[_0x7591('0x56')]=_[_0x7591('0x59')](_0x1be924['where'],{'$or':_[_0x7591('0x48')](_0x1be924[_0x7591('0x4e')],function(_0xa0b386){var _0x5a3531={};_0x5a3531[_0xa0b386]={'$like':'%'+_0x497e7b[_0x7591('0x4c')]['filter']+'%'};return _0x5a3531;})});}_0x1be924=_[_0x7591('0x59')]({},_0x1be924,_0x497e7b[_0x7591('0x5b')]);return db['MailInteraction'][_0x7591('0x22')]({'where':_0x1be924[_0x7591('0x56')]})[_0x7591('0x10')](function(_0x298779){_0x53a355['count']=_0x298779;if(_0x497e7b['query'][_0x7591('0x5c')]){_0x1be924[_0x7591('0x61')]=[{'model':db[_0x7591('0x8d')],'as':_0x7591('0x8e'),'required':![]},{'model':db['User'],'as':'Owner','attributes':[_0x7591('0x29'),_0x7591('0x8f'),'internal'],'required':![]},{'model':db[_0x7591('0x90')],'as':_0x7591('0x91'),'attributes':['id',_0x7591('0x29'),_0x7591('0x92')],'where':_0x497e7b['query'][_0x7591('0x93')]?{'id':_0x497e7b[_0x7591('0x4c')][_0x7591('0x93')]}:undefined,'required':_0x497e7b[_0x7591('0x4c')][_0x7591('0x93')]?!![]:![]}];}return db[_0x7591('0x8a')]['findAll'](_0x1be924);})['then'](function(_0x11048e){_0x53a355[_0x7591('0x6f')]=_0x11048e;return _0x53a355;});}})[_0x7591('0x10')](respondWithFilteredResult(_0x4ec008,_0x1be924))[_0x7591('0x1b')](handleError(_0x4ec008,null));};exports[_0x7591('0x94')]=function addApplications(_0x3b01bd,_0x4cdaa9){var _0x5dbcbb=_0x3b01bd[_0x7591('0x5f')]['id'];var _0x4538e3=_0x3b01bd[_0x7591('0x63')];var _0x4da7d1=0xc8;var _0x1757a3=null;return db[_0x7591('0x95')][_0x7591('0x96')]({'isolationLevel':db[_0x7591('0x95')]['Transaction']['ISOLATION_LEVELS'][_0x7591('0x97')]},function(_0x598a4a){return db[_0x7591('0x49')]['findOne']({'where':{'id':_0x5dbcbb},'transaction':_0x598a4a})[_0x7591('0x10')](function(_0x12a6f2){if(_0x12a6f2){return db[_0x7591('0x98')][_0x7591('0x99')]({'where':{'MailAccountId':_0x5dbcbb},'transaction':_0x598a4a})[_0x7591('0x10')](function(){var _0x5977f2=_['map'](_0x4538e3,function(_0x5cabf1){_0x5cabf1[_0x7591('0x69')]=_0x5dbcbb;return _0x5cabf1;});return db[_0x7591('0x98')]['bulkCreate'](_0x5977f2,{'transaction':_0x598a4a});});}else{_0x4da7d1=0x194;_0x1757a3=[];}});})['then'](function(){if(_0x4da7d1!==0x194){return db['MailApplication'][_0x7591('0x9a')]({'where':{'MailAccountId':_0x5dbcbb},'order':_0x7591('0x9b')})[_0x7591('0x10')](function(_0x2a9d66){_0x1757a3=_0x2a9d66;});}})['catch'](function(_0x155af3){_0x4da7d1=0x1f4;logger[_0x7591('0x17')](_0x155af3[_0x7591('0x28')]);if(_0x155af3[_0x7591('0x29')]){delete _0x155af3[_0x7591('0x29')];}_0x1757a3=_0x155af3;})[_0x7591('0x9c')](function(){if(_0x1757a3===null){_0x4cdaa9[_0x7591('0x27')](_0x4da7d1);}else{if(_0x4da7d1===0x1f4){_0x4cdaa9[_0x7591('0x1c')](_0x4da7d1)[_0x7591('0x2a')](_0x1757a3);}else{_0x4cdaa9[_0x7591('0x1c')](_0x4da7d1)[_0x7591('0x1e')](_0x1757a3);}}});};exports[_0x7591('0x9d')]=function(_0x5535b6,_0xcd00d7){var _0x5c6b55={};var _0x3dec2c={};var _0xe2af5e;var _0x5e490c;return db[_0x7591('0x49')][_0x7591('0x6d')]({'where':{'id':_0x5535b6['params']['id']}})[_0x7591('0x10')](handleEntityNotFound(_0xcd00d7,null))[_0x7591('0x10')](function(_0x1a0d57){if(_0x1a0d57){_0xe2af5e=_0x1a0d57;_0x3dec2c[_0x7591('0x4b')]=_[_0x7591('0x4d')](db[_0x7591('0x98')][_0x7591('0x60')]);_0x3dec2c['query']=_['keys'](_0x5535b6[_0x7591('0x4c')]);_0x3dec2c[_0x7591('0x57')]=_[_0x7591('0x4f')](_0x3dec2c['model'],_0x3dec2c[_0x7591('0x4c')]);_0x5c6b55[_0x7591('0x4e')]=_[_0x7591('0x4f')](_0x3dec2c[_0x7591('0x4b')],qs[_0x7591('0x50')](_0x5535b6[_0x7591('0x4c')][_0x7591('0x50')]));_0x5c6b55[_0x7591('0x4e')]=_0x5c6b55[_0x7591('0x4e')]['length']?_0x5c6b55[_0x7591('0x4e')]:_0x3dec2c[_0x7591('0x4b')];_0x5c6b55[_0x7591('0x54')]=qs[_0x7591('0x55')](_0x5535b6[_0x7591('0x4c')][_0x7591('0x55')]);_0x5c6b55[_0x7591('0x56')]=qs[_0x7591('0x57')](_[_0x7591('0x6e')](_0x5535b6[_0x7591('0x4c')],_0x3dec2c[_0x7591('0x57')]));if(_0x5535b6[_0x7591('0x4c')][_0x7591('0x58')]){_0x5c6b55[_0x7591('0x56')]=_['merge'](_0x5c6b55[_0x7591('0x56')],{'$or':_[_0x7591('0x48')](_0x5c6b55['attributes'],function(_0x8be4e7){var _0x10d65d={};_0x10d65d[_0x8be4e7]={'$like':'%'+_0x5535b6[_0x7591('0x4c')]['filter']+'%'};return _0x10d65d;})});}_0x5c6b55=_['merge']({},_0x5c6b55,_0x5535b6[_0x7591('0x5b')]);return _0xe2af5e[_0x7591('0x9d')](_0x5c6b55);}})[_0x7591('0x10')](function(_0x37fdba){if(_0x37fdba){_0x5e490c=_0x37fdba[_0x7591('0x51')];if(!_0x5535b6[_0x7591('0x4c')][_0x7591('0x52')](_0x7591('0x53'))){_0x5c6b55['limit']=qs[_0x7591('0x21')](_0x5535b6['query']['limit']);_0x5c6b55[_0x7591('0x1f')]=qs[_0x7591('0x1f')](_0x5535b6[_0x7591('0x4c')][_0x7591('0x1f')]);}return _0xe2af5e['getApplications'](_0x5c6b55);}})[_0x7591('0x10')](function(_0x19cb68){if(_0x19cb68){return _0x19cb68?{'count':_0x5e490c,'rows':_0x19cb68}:null;}})['then'](respondWithResult(_0xcd00d7,null))['catch'](handleError(_0xcd00d7,null));};exports['getMessages']=function(_0x51eba1,_0x2d807d){var _0x19a18a={'raw':!![],'where':{}};var _0x72978f={};var _0xa1e7b={'count':0x0,'rows':[]};return db[_0x7591('0x49')][_0x7591('0x6d')]({'where':{'id':_0x51eba1[_0x7591('0x5f')]['id']}})[_0x7591('0x10')](handleEntityNotFound(_0x2d807d,null))['then'](function(_0xa0feb8){if(_0xa0feb8){_0x72978f['model']=_[_0x7591('0x4d')](db[_0x7591('0x9e')]['rawAttributes']);_0x72978f[_0x7591('0x4c')]=_[_0x7591('0x4d')](_0x51eba1['query']);_0x72978f['filters']=_[_0x7591('0x4f')](_0x72978f[_0x7591('0x4b')],_0x72978f[_0x7591('0x4c')]);_0x19a18a[_0x7591('0x4e')]=_[_0x7591('0x4f')](_0x72978f[_0x7591('0x4b')],qs[_0x7591('0x50')](_0x51eba1[_0x7591('0x4c')][_0x7591('0x50')]));_0x19a18a['attributes']=_0x19a18a[_0x7591('0x4e')]['length']?_0x19a18a[_0x7591('0x4e')]:_0x72978f[_0x7591('0x4b')];if(!_0x51eba1[_0x7591('0x4c')][_0x7591('0x52')](_0x7591('0x53'))){_0x19a18a[_0x7591('0x21')]=qs[_0x7591('0x21')](_0x51eba1[_0x7591('0x4c')][_0x7591('0x21')]);_0x19a18a[_0x7591('0x1f')]=qs['offset'](_0x51eba1[_0x7591('0x4c')][_0x7591('0x1f')]);}_0x19a18a['order']=qs[_0x7591('0x55')](_0x51eba1[_0x7591('0x4c')]['sort']);_0x19a18a[_0x7591('0x56')]=qs[_0x7591('0x57')](_[_0x7591('0x6e')](_0x51eba1[_0x7591('0x4c')],_0x72978f[_0x7591('0x57')]));_0x19a18a[_0x7591('0x56')][_0x7591('0x69')]=_0xa0feb8['id'];if(_0x51eba1[_0x7591('0x4c')][_0x7591('0x58')]){_0x19a18a[_0x7591('0x56')]=_[_0x7591('0x59')](_0x19a18a['where'],{'$or':_[_0x7591('0x48')](_0x19a18a[_0x7591('0x4e')],function(_0x9429f9){var _0x477118={};_0x477118[_0x9429f9]={'$like':'%'+_0x51eba1[_0x7591('0x4c')][_0x7591('0x58')]+'%'};return _0x477118;})});}if(_0x51eba1['query'][_0x7591('0x9f')]){var _0x3a412d=_0x51eba1[_0x7591('0x4c')][_0x7591('0x9f')][_0x7591('0xa0')](',');var _0x7461b={};_0x7461b[_0x3a412d[0x0]]={'$gte':moment(_0x3a412d[0x1])['format'](_0x7591('0xa1'))};_0x19a18a[_0x7591('0x56')]=_[_0x7591('0x59')](_0x19a18a[_0x7591('0x56')],_0x7461b);}_0x19a18a=_['merge']({},_0x19a18a,_0x51eba1['options']);return db['MailMessage'][_0x7591('0x22')]({'where':_0x19a18a[_0x7591('0x56')]})[_0x7591('0x10')](function(_0x4775c6){_0xa1e7b[_0x7591('0x22')]=_0x4775c6;if(_0x51eba1[_0x7591('0x4c')]['includeAll']){_0x19a18a[_0x7591('0x61')]=[{'all':!![]}];}return db[_0x7591('0x9e')]['findAll'](_0x19a18a);})['then'](function(_0x3f9a5c){if(_0x51eba1[_0x7591('0x4c')][_0x7591('0xa2')]==='true'){for(var _0x1434c3=0x0;_0x1434c3<_0x3f9a5c[_0x7591('0x51')];_0x1434c3++){_0x3f9a5c[_0x1434c3][_0x7591('0x63')]=juice(_0x3f9a5c[_0x1434c3][_0x7591('0x63')]);}}_0xa1e7b[_0x7591('0x6f')]=_0x3f9a5c;return _0xa1e7b;});}})[_0x7591('0x10')](respondWithFilteredResult(_0x2d807d,_0x19a18a))['catch'](handleError(_0x2d807d,null));};exports[_0x7591('0x2a')]=function(_0x428167,_0x3efbf2){var _0x111c5a,_0x5c29b7={},_0x579af5;if(_0x428167[_0x7591('0x63')]['to']){_0x579af5=_0x428167[_0x7591('0x63')]['to'][_0x7591('0xa0')](',')[0x0];}return db[_0x7591('0x49')][_0x7591('0x62')]({'where':{'id':_0x428167[_0x7591('0x5f')]['id']},'include':[{'model':db[_0x7591('0xa3')],'as':_0x7591('0xa4'),'include':[{'model':db[_0x7591('0x8d')],'as':_0x7591('0xa5'),'where':{'email':_0x579af5},'limit':0x1,'order':[['updatedAt',_0x7591('0xa6')]]}]},{'model':db[_0x7591('0x45')],'as':_0x7591('0x42'),'raw':!![],'include':[{'model':db['CloudProvider'],'as':'CloudProvider','raw':!![]}]}]})[_0x7591('0x10')](handleEntityNotFound(_0x3efbf2,null))['then'](function(_0x451840){if(!_0x451840)return;_0x111c5a=_0x451840;if(!_0x451840[_0x7591('0x42')])throw new Error(_0x7591('0xa7'));if(_[_0x7591('0x78')](_0x428167[_0x7591('0x63')][_0x7591('0xa8')])){_0x428167[_0x7591('0x63')]['from']=util[_0x7591('0xa9')](_0x7591('0xaa'),_0x451840['name'],_0x451840[_0x7591('0x76')]||_0x451840[_0x7591('0x42')][_0x7591('0x36')]);}if(_0x428167[_0x7591('0x63')][_0x7591('0xab')]&&_0x428167[_0x7591('0x63')][_0x7591('0xab')][_0x7591('0x51')]){for(var _0x58388c=0x0;_0x58388c<_0x428167[_0x7591('0x63')][_0x7591('0xab')][_0x7591('0x51')];_0x58388c+=0x1){_0x428167[_0x7591('0x63')][_0x7591('0xab')][_0x58388c]={'filename':_0x428167[_0x7591('0x63')][_0x7591('0xab')][_0x58388c][_0x7591('0x29')],'path':path[_0x7591('0xac')](config[_0x7591('0xad')],'server/files/attachments',_0x428167['body'][_0x7591('0xab')][_0x58388c]['basename'])};}}var _0xe41d50=_0x451840[_0x7591('0xae')]();return respondWithRpcPromise(_0x7591('0xaf'),_0x7591('0xb0'),{'account':_0xe41d50,'message':_0x428167[_0x7591('0x63')]});})[_0x7591('0x10')](function(_0x5382a5){if(!_0x5382a5)return;_0x5c29b7=_0x5382a5;if(!_0x111c5a[_0x7591('0xa4')])throw new Error(_0x7591('0xb1'));if(_0x111c5a[_0x7591('0xa4')]['Contacts']['length'])return _0x111c5a[_0x7591('0xa4')]['Contacts'][0x0];return db[_0x7591('0x8d')][_0x7591('0x6b')](_[_0x7591('0x9')](_0x428167[_0x7591('0x63')],{'firstName':_0x428167[_0x7591('0x63')]['to'],'email':_0x428167[_0x7591('0x63')]['to'],'phone':_0x428167[_0x7591('0x63')]['to'],'ListId':_0x111c5a[_0x7591('0x77')]}));})[_0x7591('0x10')](function(_0x52d747){if(!_0x52d747)return;var _0x347001={'UserId':_0x428167[_0x7591('0x36')]['id'],'ContactId':_0x52d747['id'],'MailAccountId':_0x111c5a['id'],'inReplyTo':_0x5c29b7[_0x7591('0xb2')],'to':_0x428167[_0x7591('0x63')]['from'],'cc':_0x428167[_0x7591('0x63')]['cc'],'subject':_0x428167[_0x7591('0x63')][_0x7591('0xb3')],'attach':_0x428167[_0x7591('0x63')][_0x7591('0xb4')],'firstMsgDirection':_0x7591('0xb5'),'lastMsgAt':moment()[_0x7591('0xa9')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':_0x7591('0xb5'),'Messages':[_[_0x7591('0x59')](_0x428167[_0x7591('0x63')],{'messageId':_0x5c29b7[_0x7591('0xb2')],'sentAt':moment()['format'](_0x7591('0xa1')),'read':!![],'MailAccountId':_0x111c5a['id'],'UserId':_0x428167[_0x7591('0x36')]['id'],'ContactId':_0x52d747['id']})]};if(_0x428167[_0x7591('0x63')]['Interaction']){_0x347001=_['merge'](_0x347001,_0x428167[_0x7591('0x63')]['Interaction']);}return db['MailInteraction'][_0x7591('0x6b')](_0x347001,{'include':[{'model':db[_0x7591('0x9e')],'as':'Messages'}]});})[_0x7591('0x10')](respondWithResult(_0x3efbf2,null))['catch'](handleError(_0x3efbf2,null));};exports[_0x7591('0xb6')]=function(_0xb0c61b,_0x16f012){return db[_0x7591('0x49')][_0x7591('0x62')]({'where':{'id':_0xb0c61b[_0x7591('0x5f')]['id']},'include':[{'model':db[_0x7591('0x45')],'as':_0x7591('0x42'),'raw':!![],'include':[{'model':db[_0x7591('0xb7')],'as':_0x7591('0xb7'),'raw':!![]}]}]})['then'](handleEntityNotFound(_0x16f012,null))['then'](function(_0xe521f8){if(!_0xe521f8[_0x7591('0x42')])return;var _0x3bc641=_0xe521f8[_0x7591('0xae')]();return respondWithRpcPromise(_0x7591('0xb8'),_0x7591('0xb6'),{'account':_0x3bc641});})[_0x7591('0x10')](respondWithResult(_0x16f012,null))['catch'](handleError(_0x16f012,null));};exports[_0x7591('0x99')]=function(_0x27e818,_0x5bdb83){return db['MailAccount']['find']({'where':{'id':_0x27e818[_0x7591('0x5f')]['id']}})[_0x7591('0x10')](handleEntityNotFound(_0x5bdb83,null))['then'](function(_0x204bd4){if(_0x204bd4&&_0x204bd4[_0x7591('0x3f')]){throw new db[(_0x7591('0xb9'))][(_0x7591('0xba'))]('You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account');}return _0x204bd4;})[_0x7591('0x10')](removeEntity(_0x5bdb83,null))[_0x7591('0x1b')](handleError(_0x5bdb83,null));};exports['addAgents']=function(_0x36d52a,_0x594060){return db[_0x7591('0x49')][_0x7591('0x62')]({'where':{'id':_0x36d52a[_0x7591('0x5f')]['id']}})[_0x7591('0x10')](handleEntityNotFound(_0x594060,null))[_0x7591('0x10')](function(_0x11a94a){if(_0x11a94a){return _0x11a94a[_0x7591('0xbb')](_0x36d52a[_0x7591('0x63')][_0x7591('0x71')],_[_0x7591('0x8b')](_0x36d52a[_0x7591('0x63')],[_0x7591('0x71'),'id'])||{})[_0x7591('0xbc')](function(_0xf9e6c6){for(var _0x3880b5=0x0;_0x3880b5<_0x36d52a[_0x7591('0x63')]['ids'][_0x7591('0x51')];_0x3880b5+=0x1){socket[_0x7591('0xbd')](_0x7591('0xbe'),{'UserId':Number(_0x36d52a[_0x7591('0x63')][_0x7591('0x71')][_0x3880b5]),'MailAccountId':Number(_0x36d52a[_0x7591('0x5f')]['id'])});}return _0xf9e6c6;});}})['then'](respondWithResult(_0x594060,null))[_0x7591('0x1b')](handleError(_0x594060,null));};exports[_0x7591('0xbf')]=function(_0x3fee8d,_0x2bd33d){return db[_0x7591('0x49')][_0x7591('0x62')]({'where':{'id':_0x3fee8d[_0x7591('0x5f')]['id']}})[_0x7591('0x10')](handleEntityNotFound(_0x2bd33d,null))[_0x7591('0x10')](function(_0x432e79){if(_0x432e79){return _0x432e79[_0x7591('0xbf')](_0x3fee8d['query'][_0x7591('0x71')])['then'](function(){if(_['isArray'](_0x3fee8d['query'][_0x7591('0x71')])){for(var _0x3a3e0f=0x0;_0x3a3e0f<_0x3fee8d[_0x7591('0x4c')][_0x7591('0x71')][_0x7591('0x51')];_0x3a3e0f+=0x1){socket[_0x7591('0xbd')](_0x7591('0xc0'),{'UserId':Number(_0x3fee8d[_0x7591('0x4c')][_0x7591('0x71')][_0x3a3e0f]),'MailAccountId':Number(_0x3fee8d['params']['id'])});}}else{socket[_0x7591('0xbd')](_0x7591('0xc0'),{'UserId':Number(_0x3fee8d[_0x7591('0x4c')][_0x7591('0x71')]),'MailAccountId':Number(_0x3fee8d[_0x7591('0x5f')]['id'])});}});}})['then'](respondWithStatusCode(_0x2bd33d,null))[_0x7591('0x1b')](handleError(_0x2bd33d,null));};exports[_0x7591('0xc1')]=function(_0xd400d3,_0x24d79b){var _0x3d3770={};var _0x1604ac={};var _0x5d9167;var _0x555bad;return db['MailAccount']['findOne']({'where':{'id':_0xd400d3[_0x7591('0x5f')]['id']}})[_0x7591('0x10')](handleEntityNotFound(_0x24d79b,null))['then'](function(_0x100936){if(_0x100936){_0x5d9167=_0x100936;_0x1604ac[_0x7591('0x4b')]=_[_0x7591('0x4d')](db['User']['rawAttributes']);_0x1604ac[_0x7591('0x4c')]=_['keys'](_0xd400d3[_0x7591('0x4c')]);_0x1604ac[_0x7591('0x57')]=_[_0x7591('0x4f')](_0x1604ac[_0x7591('0x4b')],_0x1604ac[_0x7591('0x4c')]);_0x3d3770[_0x7591('0x4e')]=_[_0x7591('0x4f')](_0x1604ac[_0x7591('0x4b')],qs[_0x7591('0x50')](_0xd400d3[_0x7591('0x4c')][_0x7591('0x50')]));_0x3d3770['attributes']=_0x3d3770['attributes'][_0x7591('0x51')]?_0x3d3770[_0x7591('0x4e')]:_0x1604ac[_0x7591('0x4b')];_0x3d3770['order']=qs[_0x7591('0x55')](_0xd400d3['query']['sort']);_0x3d3770[_0x7591('0x56')]=qs[_0x7591('0x57')](_['pick'](_0xd400d3[_0x7591('0x4c')],_0x1604ac[_0x7591('0x57')]));if(_0xd400d3[_0x7591('0x4c')][_0x7591('0x58')]){_0x3d3770[_0x7591('0x56')]=_[_0x7591('0x59')](_0x3d3770[_0x7591('0x56')],{'$or':_['map'](_0x3d3770[_0x7591('0x4e')],function(_0x55af5d){var _0x1a5376={};_0x1a5376[_0x55af5d]={'$like':'%'+_0xd400d3[_0x7591('0x4c')]['filter']+'%'};return _0x1a5376;})});}_0x3d3770=_[_0x7591('0x59')]({},_0x3d3770,_0xd400d3[_0x7591('0x5b')]);return _0x5d9167[_0x7591('0xc1')](_0x3d3770);}})['then'](function(_0x1d99f7){if(_0x1d99f7){_0x555bad=_0x1d99f7[_0x7591('0x51')];if(!_0xd400d3[_0x7591('0x4c')][_0x7591('0x52')](_0x7591('0x53'))){_0x3d3770['limit']=qs['limit'](_0xd400d3[_0x7591('0x4c')][_0x7591('0x21')]);_0x3d3770[_0x7591('0x1f')]=qs[_0x7591('0x1f')](_0xd400d3[_0x7591('0x4c')][_0x7591('0x1f')]);}return _0x5d9167[_0x7591('0xc1')](_0x3d3770);}})['then'](function(_0x4989dd){if(_0x4989dd){return _0x4989dd?{'count':_0x555bad,'rows':_0x4989dd}:null;}})[_0x7591('0x10')](respondWithResult(_0x24d79b,null))[_0x7591('0x1b')](handleError(_0x24d79b,null));}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.events.js b/server/api/mailAccount/mailAccount.events.js index daeef4b..0c2466f 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 _0x9a18=['exports','events','MailAccount','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook'];(function(_0x40220a,_0x22feb1){var _0x3903cc=function(_0x33a296){while(--_0x33a296){_0x40220a['push'](_0x40220a['shift']());}};_0x3903cc(++_0x22feb1);}(_0x9a18,0x187));var _0x89a1=function(_0x528fbc,_0x5261de){_0x528fbc=_0x528fbc-0x0;var _0xe5ddd1=_0x9a18[_0x528fbc];return _0xe5ddd1;};'use strict';var EventEmitter=require(_0x89a1('0x0'));var MailAccount=require('../../mysqldb')['db'][_0x89a1('0x1')];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0x89a1('0x2')](0x0);var events={'afterCreate':_0x89a1('0x3'),'afterUpdate':_0x89a1('0x4'),'afterDestroy':_0x89a1('0x5')};function emitEvent(_0x48a67a){return function(_0x33e91b,_0x2b7678,_0x287f38){MailAccountEvents[_0x89a1('0x6')](_0x48a67a+':'+_0x33e91b['id'],_0x33e91b);MailAccountEvents[_0x89a1('0x6')](_0x48a67a,_0x33e91b);_0x287f38(null);};}for(var e in events){if(events[_0x89a1('0x7')](e)){var event=events[e];MailAccount[_0x89a1('0x8')](e,emitEvent(event));}}module[_0x89a1('0x9')]=MailAccountEvents; \ No newline at end of file +var _0x36e0=['save','update','emit','hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners'];(function(_0x488ebd,_0x157586){var _0x70c90b=function(_0x4d7b57){while(--_0x4d7b57){_0x488ebd['push'](_0x488ebd['shift']());}};_0x70c90b(++_0x157586);}(_0x36e0,0x15c));var _0x036e=function(_0x5e9a13,_0x22e47a){_0x5e9a13=_0x5e9a13-0x0;var _0x329c2a=_0x36e0[_0x5e9a13];return _0x329c2a;};'use strict';var EventEmitter=require(_0x036e('0x0'));var MailAccount=require(_0x036e('0x1'))['db']['MailAccount'];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0x036e('0x2')](0x0);var events={'afterCreate':_0x036e('0x3'),'afterUpdate':_0x036e('0x4'),'afterDestroy':'remove'};function emitEvent(_0x2ef73c){return function(_0x400837,_0x4f9d06,_0xac7036){MailAccountEvents[_0x036e('0x5')](_0x2ef73c+':'+_0x400837['id'],_0x400837);MailAccountEvents[_0x036e('0x5')](_0x2ef73c,_0x400837);_0xac7036(null);};}for(var e in events){if(events[_0x036e('0x6')](e)){var event=events[e];MailAccount[_0x036e('0x7')](e,emitEvent(event));}}module[_0x036e('0x8')]=MailAccountEvents; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.model.js b/server/api/mailAccount/mailAccount.model.js index fb4d6ee..ef9f79e 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 _0xc7e6=['exports','mail_accounts','provider','custom','Smtp','host','secure','authentication','modernAuthentication','Cloud\x20Provider\x20configuration\x20not\x20found','auth','user','data5','pass','./mailAccount.attributes'];(function(_0x11a69f,_0x1aeee9){var _0x2e8af4=function(_0x27e9d0){while(--_0x27e9d0){_0x11a69f['push'](_0x11a69f['shift']());}};_0x2e8af4(++_0x1aeee9);}(_0xc7e6,0x1a3));var _0x6c7e=function(_0x4ede04,_0x58132b){_0x4ede04=_0x4ede04-0x0;var _0x49ccfc=_0xc7e6[_0x4ede04];return _0x49ccfc;};'use strict';var attributes=require(_0x6c7e('0x0'));module[_0x6c7e('0x1')]=function(_0x31dfe6){return _0x31dfe6['define']('MailAccount',attributes,{'tableName':_0x6c7e('0x2'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getSmtpOptions':function(){var _0x314a23=this;var _0x2d38d5={'id':_0x314a23['id'],'tls':{'rejectUnauthorized':![]}};if(_0x314a23[_0x6c7e('0x3')]!==_0x6c7e('0x4')){_0x2d38d5['service']=_0x314a23['provider'];}else{_0x2d38d5['host']=_0x314a23[_0x6c7e('0x5')][_0x6c7e('0x6')];_0x2d38d5['port']=_0x314a23[_0x6c7e('0x5')]['port'];_0x2d38d5['secure']=_0x314a23[_0x6c7e('0x5')][_0x6c7e('0x7')];}if(_0x314a23[_0x6c7e('0x5')][_0x6c7e('0x8')]){if(_0x314a23[_0x6c7e('0x5')][_0x6c7e('0x9')]){if(!_0x314a23[_0x6c7e('0x5')]['CloudProvider'])throw new Error(_0x6c7e('0xa'));_0x2d38d5[_0x6c7e('0xb')]={'type':'OAuth2','user':_0x314a23['Smtp'][_0x6c7e('0xc')],'accessToken':_0x314a23[_0x6c7e('0x5')]['CloudProvider'][_0x6c7e('0xd')]};}else{_0x2d38d5['auth']={'user':_0x314a23[_0x6c7e('0x5')]['user'],'pass':_0x314a23[_0x6c7e('0x5')][_0x6c7e('0xe')]};}}return _0x2d38d5;}}});}; \ No newline at end of file +var _0x4b7b=['user','data5','auth','pass','./mailAccount.attributes','exports','define','MailAccount','provider','custom','service','host','Smtp','port','secure','CloudProvider','Cloud\x20Provider\x20configuration\x20not\x20found','OAuth2'];(function(_0x3ebe5f,_0x2add53){var _0x51ebc9=function(_0xa653f0){while(--_0xa653f0){_0x3ebe5f['push'](_0x3ebe5f['shift']());}};_0x51ebc9(++_0x2add53);}(_0x4b7b,0x136));var _0xb4b7=function(_0x3be189,_0x233297){_0x3be189=_0x3be189-0x0;var _0x1a9d84=_0x4b7b[_0x3be189];return _0x1a9d84;};'use strict';var attributes=require(_0xb4b7('0x0'));module[_0xb4b7('0x1')]=function(_0x2d4c16){return _0x2d4c16[_0xb4b7('0x2')](_0xb4b7('0x3'),attributes,{'tableName':'mail_accounts','paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getSmtpOptions':function(){var _0x5444a5=this;var _0x1ed76e={'id':_0x5444a5['id'],'tls':{'rejectUnauthorized':![]}};if(_0x5444a5[_0xb4b7('0x4')]!==_0xb4b7('0x5')){_0x1ed76e[_0xb4b7('0x6')]=_0x5444a5[_0xb4b7('0x4')];}else{_0x1ed76e[_0xb4b7('0x7')]=_0x5444a5[_0xb4b7('0x8')][_0xb4b7('0x7')];_0x1ed76e[_0xb4b7('0x9')]=_0x5444a5[_0xb4b7('0x8')]['port'];_0x1ed76e[_0xb4b7('0xa')]=_0x5444a5[_0xb4b7('0x8')]['secure'];}if(_0x5444a5[_0xb4b7('0x8')]['authentication']){if(_0x5444a5[_0xb4b7('0x8')]['modernAuthentication']){if(!_0x5444a5[_0xb4b7('0x8')][_0xb4b7('0xb')])throw new Error(_0xb4b7('0xc'));_0x1ed76e['auth']={'type':_0xb4b7('0xd'),'user':_0x5444a5[_0xb4b7('0x8')][_0xb4b7('0xe')],'accessToken':_0x5444a5['Smtp'][_0xb4b7('0xb')][_0xb4b7('0xf')]};}else{_0x1ed76e[_0xb4b7('0x10')]={'user':_0x5444a5['Smtp'][_0xb4b7('0xe')],'pass':_0x5444a5[_0xb4b7('0x8')][_0xb4b7('0x11')]};}}return _0x1ed76e;}}});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.rpc.js b/server/api/mailAccount/mailAccount.rpc.js index 2c2495a..51ea651 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 _0x723e=['List','Applications','applications','list','orderBy','asc','autoclose','length','close','*,*,*,*','create','List\x20not\x20found','messageId','generate','subject','attach','format','YYYY-MM-DD\x20HH:mm:ss','MailInteraction','Messages','inReplyTo','update','interaction','created','contact','attachments','originTo','originCc','bcc','ChatWebsiteId','originChannel','Email','ChatOfflineMessageId','Attachment','Attachments','UserId','User','name','unshift','agent','waitForTheAssignedAgent','queueId','Start','startRouting','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./mailAccount.socket','register','request','then','MailAccount,\x20%s,\x20%s','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','error','message','info','result','catch','GetMailAccount','findAll','options','raw','where','attributes','limit','include','map','model','MailAccount','find','smtp','setDataValue','smtpOptions','getSmtpOptions','ShowMailAccount','stringify','body','mail','difference','keys','createdAt','ListId','isNil','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','account','CmList','CmContact','Contacts','updatedAt','DESC','MailApplication','MailServerOut','CloudProvider'];(function(_0x347c23,_0x594d48){var _0x11c554=function(_0x1bc8a4){while(--_0x1bc8a4){_0x347c23['push'](_0x347c23['shift']());}};_0x11c554(++_0x594d48);}(_0x723e,0x179));var _0xe723=function(_0x9c3c56,_0x169b56){_0x9c3c56=_0x9c3c56-0x0;var _0x2dd782=_0x723e[_0x9c3c56];return _0x2dd782;};'use strict';var _=require('lodash');var moment=require(_0xe723('0x0'));var BPromise=require(_0xe723('0x1'));var rs=require(_0xe723('0x2'));var Redis=require(_0xe723('0x3'));var db=require(_0xe723('0x4'))['db'];var logger=require(_0xe723('0x5'))(_0xe723('0x6'));var config=require(_0xe723('0x7'));var jayson=require(_0xe723('0x8'));var client=jayson[_0xe723('0x9')]['http']({'port':0x232c});config[_0xe723('0xa')]=_[_0xe723('0xb')](config[_0xe723('0xa')],{'host':_0xe723('0xc'),'port':0x18eb});var socket=require(_0xe723('0xd'))(new Redis(config[_0xe723('0xa')]));require(_0xe723('0xe'))[_0xe723('0xf')](socket);function respondWithRpcPromise(_0x4a6983,_0x380444,_0x270346){return new BPromise(function(_0x34831f,_0x5a43fb){return client[_0xe723('0x10')](_0x4a6983,_0x270346)[_0xe723('0x11')](function(_0xcf68e2){logger['info'](_0xe723('0x12'),_0x380444,_0xe723('0x13'));logger[_0xe723('0x14')](_0xe723('0x15'),_0x380444,_0xe723('0x13'),JSON['stringify'](_0xcf68e2));if(_0xcf68e2[_0xe723('0x16')]){if(_0xcf68e2['error']['code']===0x1f4){logger['error']('MailAccount,\x20%s,\x20%s',_0x380444,_0xcf68e2[_0xe723('0x16')][_0xe723('0x17')]);return _0x5a43fb(_0xcf68e2[_0xe723('0x16')][_0xe723('0x17')]);}logger[_0xe723('0x16')]('MailAccount,\x20%s,\x20%s',_0x380444,_0xcf68e2[_0xe723('0x16')][_0xe723('0x17')]);return _0x34831f(_0xcf68e2[_0xe723('0x16')][_0xe723('0x17')]);}else{logger[_0xe723('0x18')](_0xe723('0x12'),_0x380444,_0xe723('0x13'));_0x34831f(_0xcf68e2[_0xe723('0x19')][_0xe723('0x17')]);}})[_0xe723('0x1a')](function(_0x2057d7){logger[_0xe723('0x16')](_0xe723('0x12'),_0x380444,_0x2057d7);_0x5a43fb(_0x2057d7);});});}exports[_0xe723('0x1b')]=function(_0x5e8a90){var _0x5b2308=this;return new Promise(function(_0x31c839,_0x1ed6fb){return db['MailAccount'][_0xe723('0x1c')]({'raw':_0x5e8a90[_0xe723('0x1d')]?_0x5e8a90['options'][_0xe723('0x1e')]===undefined?!![]:![]:!![],'where':_0x5e8a90['options']?_0x5e8a90[_0xe723('0x1d')][_0xe723('0x1f')]||null:null,'attributes':_0x5e8a90[_0xe723('0x1d')]?_0x5e8a90[_0xe723('0x1d')][_0xe723('0x20')]||null:null,'limit':_0x5e8a90[_0xe723('0x1d')]?_0x5e8a90[_0xe723('0x1d')][_0xe723('0x21')]||null:null,'include':_0x5e8a90[_0xe723('0x1d')]?_0x5e8a90[_0xe723('0x1d')][_0xe723('0x22')]?_[_0xe723('0x23')](_0x5e8a90['options'][_0xe723('0x22')],function(_0x59f095){return{'model':db[_0x59f095[_0xe723('0x24')]],'as':_0x59f095['as'],'attributes':_0x59f095[_0xe723('0x20')],'include':_0x59f095[_0xe723('0x22')]?_[_0xe723('0x23')](_0x59f095[_0xe723('0x22')],function(_0x598f15){return{'model':db[_0x598f15[_0xe723('0x24')]],'as':_0x598f15['as'],'attributes':_0x598f15['attributes'],'include':_0x598f15['include']?_[_0xe723('0x23')](_0x598f15['include'],function(_0x3e6bc0){return{'model':db[_0x3e6bc0[_0xe723('0x24')]],'as':_0x3e6bc0['as'],'attributes':_0x3e6bc0[_0xe723('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1edbb2){logger[_0xe723('0x18')]('GetMailAccount',_0x5e8a90);logger[_0xe723('0x14')]('GetMailAccount',_0x5e8a90,JSON['stringify'](_0x1edbb2));_0x31c839(_0x1edbb2);})[_0xe723('0x1a')](function(_0x2c2240){logger[_0xe723('0x16')](_0xe723('0x1b'),_0x2c2240['message'],_0x5e8a90);_0x1ed6fb(_0x5b2308['error'](0x1f4,_0x2c2240[_0xe723('0x17')]));});});};exports['ShowMailAccount']=function(_0x3855c7){var _0x318f7f=this;return new Promise(function(_0x398054,_0xb91a9c){return db[_0xe723('0x25')][_0xe723('0x26')]({'raw':_0x3855c7[_0xe723('0x1d')]?_0x3855c7[_0xe723('0x1d')][_0xe723('0x1e')]===undefined?!![]:![]:!![],'where':_0x3855c7[_0xe723('0x1d')]?_0x3855c7[_0xe723('0x1d')][_0xe723('0x1f')]||null:null,'attributes':_0x3855c7[_0xe723('0x1d')]?_0x3855c7[_0xe723('0x1d')]['attributes']||null:null,'include':_0x3855c7[_0xe723('0x1d')]?_0x3855c7['options'][_0xe723('0x22')]?_[_0xe723('0x23')](_0x3855c7['options']['include'],function(_0x2f1940){return{'model':db[_0x2f1940[_0xe723('0x24')]],'as':_0x2f1940['as'],'attributes':_0x2f1940[_0xe723('0x20')],'include':_0x2f1940[_0xe723('0x22')]?_[_0xe723('0x23')](_0x2f1940[_0xe723('0x22')],function(_0x5122da){return{'model':db[_0x5122da[_0xe723('0x24')]],'as':_0x5122da['as'],'attributes':_0x5122da[_0xe723('0x20')],'include':_0x5122da[_0xe723('0x22')]?_[_0xe723('0x23')](_0x5122da[_0xe723('0x22')],function(_0x37bb5d){return{'model':db[_0x37bb5d[_0xe723('0x24')]],'as':_0x37bb5d['as'],'attributes':_0x37bb5d[_0xe723('0x20')]};}):[]};}):[]};}):[]:[]})[_0xe723('0x11')](function(_0x3dca81){if(_0x3855c7[_0xe723('0x1d')][_0xe723('0x27')]===!![])_0x3dca81[_0xe723('0x28')](_0xe723('0x29'),_0x3dca81[_0xe723('0x2a')]());logger[_0xe723('0x18')]('ShowMailAccount',_0x3855c7);logger[_0xe723('0x14')](_0xe723('0x2b'),_0x3855c7,JSON[_0xe723('0x2c')](_0x3dca81));_0x398054(_0x3dca81);})[_0xe723('0x1a')](function(_0x5325a5){logger['error'](_0xe723('0x2b'),_0x5325a5[_0xe723('0x17')],_0x3855c7);_0xb91a9c(_0x318f7f[_0xe723('0x16')](0x1f4,_0x5325a5[_0xe723('0x17')]));});});};exports['NotifyMailAccount']=function(_0x5d5f24){var _0x314551=this;return new Promise(function(_0x2f1618,_0x24909){var _0x245512={'body':_0x5d5f24[_0xe723('0x2d')],'channel':_0xe723('0x2e')};var _0x471843=_[_0xe723('0x2f')](_[_0xe723('0x30')](db['CmContact']['rawAttributes']),[_0xe723('0x31'),'updatedAt','CompanyId',_0xe723('0x32')]);var _0x55530b=![];if(_0x5d5f24[_0xe723('0x2d')]['id']){delete _0x5d5f24[_0xe723('0x2d')]['id'];}if(_[_0xe723('0x33')](_0x5d5f24[_0xe723('0x2d')][_0xe723('0x34')])){return _0x24909(_0x314551[_0xe723('0x16')](0x1f4,_0xe723('0x35')));}if(_['isNil'](_0x5d5f24['body'][_0xe723('0x2d')])||_0x5d5f24['body'][_0xe723('0x2d')]===''){return _0x24909(_0x314551['error'](0x1f4,_0xe723('0x36')));}if(_[_0xe723('0x33')](_0x5d5f24[_0xe723('0x2d')][_0xe723('0x37')])){return _0x24909(_0x314551[_0xe723('0x16')](0x1f4,_0xe723('0x38')+_0x471843));}if(!_[_0xe723('0x39')](_0x471843,_0x5d5f24[_0xe723('0x2d')][_0xe723('0x37')])){return _0x24909(_0x314551['error'](0x1f4,'mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x471843));}var _0x1824b6={};_0x1824b6[_0x5d5f24[_0xe723('0x2d')][_0xe723('0x37')]]=_0x5d5f24['body']['from'];return db['MailAccount'][_0xe723('0x26')]({'where':{'id':_0x5d5f24[_0xe723('0x3a')]['id']},'include':[{'model':db[_0xe723('0x3b')],'as':'List','include':[{'model':db[_0xe723('0x3c')],'as':_0xe723('0x3d'),'where':_0x1824b6,'limit':0x1,'order':[[_0xe723('0x3e'),_0xe723('0x3f')]]}]},{'model':db[_0xe723('0x40')],'as':'Applications'},{'model':db[_0xe723('0x41')],'as':'Smtp','include':[{'model':db[_0xe723('0x42')],'as':'CloudProvider'}]}]})['then'](function(_0x1590fe){if(_0x1590fe&&_0x1590fe[_0xe723('0x43')]){var _0x22a1d3=_0x1590fe['get']({'plain':!![]});_0x245512[_0xe723('0x3a')]=_['omit'](_0x22a1d3,[_0xe723('0x44'),_0xe723('0x43')]);_0x245512[_0xe723('0x3a')][_0xe723('0x29')]=_0x1590fe[_0xe723('0x2a')]();_0x245512[_0xe723('0x45')]=_0x22a1d3[_0xe723('0x44')];_0x245512[_0xe723('0x46')]=_0x22a1d3[_0xe723('0x43')];_0x245512['applications']=_[_0xe723('0x47')](_0x245512[_0xe723('0x45')],['priority'],[_0xe723('0x48')]);if(_0x245512[_0xe723('0x3a')]&&_0x245512['account'][_0xe723('0x49')]){_0x245512['applications']['push']({'id':0x0,'priority':_0x245512[_0xe723('0x45')][_0xe723('0x4a')]+0x1,'app':_0xe723('0x4b'),'appdata':_0xe723('0x49'),'interval':_0xe723('0x4c')});}if(_0x245512['account'][_0xe723('0x44')]){delete _0x245512[_0xe723('0x3a')][_0xe723('0x44')];}if(_0x245512[_0xe723('0x3a')][_0xe723('0x43')]){delete _0x245512[_0xe723('0x3a')][_0xe723('0x43')];}if(_0x22a1d3[_0xe723('0x43')][_0xe723('0x3d')][_0xe723('0x4a')]){return _0x22a1d3['List'][_0xe723('0x3d')][0x0];}var _0x10fb8a=_[_0xe723('0xb')](_0x5d5f24[_0xe723('0x2d')],{'firstName':_0x5d5f24['body'][_0xe723('0x34')],'ListId':_0x22a1d3[_0xe723('0x32')]});_0x10fb8a[_0x5d5f24['body'][_0xe723('0x37')]]=_0x5d5f24[_0xe723('0x2d')][_0xe723('0x34')];return db[_0xe723('0x3c')][_0xe723('0x4d')](_0x10fb8a);}else{throw new Error(_0xe723('0x4e'));}})['then'](function(_0x3a3dd7){_0x245512['contact']=_0x3a3dd7;if(_0x3a3dd7){if(!_0x5d5f24['body'][_0xe723('0x17')]['messageId']){_0x5d5f24[_0xe723('0x2d')][_0xe723('0x17')][_0xe723('0x4f')]=rs[_0xe723('0x50')]()+'\x20'+_0x5d5f24[_0xe723('0x2d')]['message'][_0xe723('0x34')];}var _0x43faea={'ContactId':_0x3a3dd7['id'],'MailAccountId':_0x5d5f24[_0xe723('0x3a')]['id'],'inReplyTo':_0x5d5f24['body']['message'][_0xe723('0x4f')],'to':_0x5d5f24[_0xe723('0x2d')][_0xe723('0x17')]['from'],'cc':_0x5d5f24[_0xe723('0x2d')][_0xe723('0x17')]['cc'],'subject':_0x5d5f24['body']['message'][_0xe723('0x51')],'attach':_0x5d5f24[_0xe723('0x2d')][_0xe723('0x17')][_0xe723('0x52')],'lastMsgAt':moment()[_0xe723('0x53')](_0xe723('0x54')),'lastMsgDirection':'in'};return db[_0xe723('0x55')]['find']({'where':{'closed':![],'MailAccountId':_0x5d5f24['account']['id']},'include':[{'model':db['MailMessage'],'as':_0xe723('0x56'),'attributes':[_0xe723('0x4f')],'where':{'messageId':_0x5d5f24['body'][_0xe723('0x17')][_0xe723('0x57')]}}]})[_0xe723('0x11')](function(_0x4e9777){if(_0x4e9777){return[_0x4e9777,![]];}return db['MailInteraction'][_0xe723('0x4d')](_0x43faea)[_0xe723('0x11')](function(_0x2463c3){return[_0x2463c3,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})['spread'](function(_0x2d0ab5,_0x5b24a6){if(_0x2d0ab5){_0x55530b=_0x5b24a6;if(!_0x5b24a6){return _0x2d0ab5[_0xe723('0x58')]({'inReplyTo':_0x5d5f24[_0xe723('0x2d')][_0xe723('0x17')][_0xe723('0x4f')],'to':_0x5d5f24[_0xe723('0x2d')][_0xe723('0x17')][_0xe723('0x34')],'cc':_0x5d5f24[_0xe723('0x2d')][_0xe723('0x17')]['cc'],'subject':_0x5d5f24['body'][_0xe723('0x17')][_0xe723('0x51')],'attach':_0x2d0ab5[_0xe723('0x52')]?_0x2d0ab5[_0xe723('0x52')]:_0x5d5f24[_0xe723('0x2d')][_0xe723('0x17')]['attach'],'substatus':null,'substatusAt':moment()[_0xe723('0x53')](_0xe723('0x54')),'lastMsgAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':'in'});}else{return _0x2d0ab5;}}})[_0xe723('0x11')](function(_0x2d5721){_0x245512[_0xe723('0x59')]=_0x2d5721['get']({'plain':!![]});_0x245512['interaction'][_0xe723('0x5a')]=_0x55530b;return db['MailMessage'][_0xe723('0x4d')]({'body':_0x5d5f24[_0xe723('0x2d')][_0xe723('0x2d')],'MailAccountId':_0x5d5f24[_0xe723('0x3a')]['id'],'MailInteractionId':_0x2d5721['id'],'direction':'in','ContactId':_0x245512[_0xe723('0x5b')]['id'],'messageId':_0x5d5f24['body']['message'][_0xe723('0x4f')],'from':_0x5d5f24[_0xe723('0x2d')][_0xe723('0x17')]['from'],'to':_0x5d5f24[_0xe723('0x2d')]['message']['to'],'cc':_0x5d5f24['body'][_0xe723('0x17')]['cc'],'subject':_0x5d5f24[_0xe723('0x2d')][_0xe723('0x17')][_0xe723('0x51')],'attach':_0x5d5f24[_0xe723('0x2d')][_0xe723('0x17')]['attach'],'Attachments':_0x5d5f24[_0xe723('0x2d')]['message'][_0xe723('0x5c')],'originTo':_0x5d5f24[_0xe723('0x2d')]['message'][_0xe723('0x5d')],'originCc':_0x5d5f24[_0xe723('0x2d')][_0xe723('0x17')][_0xe723('0x5e')],'bcc':_0x5d5f24[_0xe723('0x2d')][_0xe723('0x17')][_0xe723('0x5f')],'ChatWebsiteId':_0x5d5f24[_0xe723('0x2d')][_0xe723('0x17')][_0xe723('0x60')]||null,'originChannel':_0x5d5f24[_0xe723('0x2d')][_0xe723('0x17')][_0xe723('0x61')]||_0xe723('0x62'),'ChatOfflineMessageId':_0x5d5f24[_0xe723('0x2d')]['message'][_0xe723('0x63')]||null},{'include':[{'model':db[_0xe723('0x64')],'as':_0xe723('0x65')}]});})['then'](function(_0x330ab0){_0x245512[_0xe723('0x17')]=_0x330ab0;if(!_0x245512[_0xe723('0x59')][_0xe723('0x66')]){return;}return db[_0xe723('0x67')][_0xe723('0x26')]({'attributes':['id',_0xe723('0x68')],'where':{'id':_0x245512[_0xe723('0x59')][_0xe723('0x66')]}});})[_0xe723('0x11')](function(_0x5dc44a){if(_0x5dc44a){_0x245512[_0xe723('0x45')][_0xe723('0x69')]({'id':0x0,'priority':0x0,'app':_0xe723('0x6a'),'appdata':_0x5dc44a[_0xe723('0x68')]+','+(_0x245512[_0xe723('0x3a')][_0xe723('0x6b')]||0xa),'interval':'*,*,*,*'});}if(!_0x245512[_0xe723('0x59')][_0xe723('0x6c')]){return;}return db['MailQueue']['find']({'attributes':['id',_0xe723('0x68')],'where':{'id':_0x245512[_0xe723('0x59')]['queueId']}});})[_0xe723('0x11')](function(_0x1993d1){if(_0x1993d1){_0x245512['applications']['unshift']({'id':0x0,'priority':0x1,'app':'queue','appdata':_0x1993d1[_0xe723('0x68')]+','+(_0x245512['account']['waitForTheAssignedQueue']||0x12c),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0xe723('0x6d'),_0xe723('0x6e'),_0x245512);})[_0xe723('0x11')](function(_0x296bf1){_0x2f1618(_0x296bf1);})[_0xe723('0x1a')](function(_0x42d66a){_0x24909(_0x314551[_0xe723('0x16')](0x1f4,_0x42d66a['message']));});});}; \ No newline at end of file +var _0x4317=['name','agent','waitForTheAssignedAgent','queueId','MailQueue','unshift','queue','waitForTheAssignedQueue','startRouting','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','defaults','redis','localhost','socket.io-emitter','./mailAccount.socket','register','request','then','info','MailAccount,\x20%s,\x20%s','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','GetMailAccount','findAll','options','raw','attributes','limit','include','map','model','catch','find','where','smtp','setDataValue','ShowMailAccount','NotifyMailAccount','body','mail','keys','rawAttributes','createdAt','CompanyId','ListId','isNil','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey','CmList','List','CmContact','Contacts','updatedAt','Applications','MailServerOut','Smtp','CloudProvider','get','account','omit','applications','list','orderBy','priority','asc','autoclose','push','length','*,*,*,*','create','List\x20not\x20found','generate','messageId','subject','format','YYYY-MM-DD\x20HH:mm:ss','MailInteraction','MailMessage','Messages','inReplyTo','Contact\x20not\x20found','spread','update','attach','interaction','created','contact','attachments','originTo','originCc','bcc','ChatWebsiteId','originChannel','Email','ChatOfflineMessageId','Attachment','Attachments','UserId','User'];(function(_0x32c03a,_0x4f76d4){var _0x301d53=function(_0x2ff3bb){while(--_0x2ff3bb){_0x32c03a['push'](_0x32c03a['shift']());}};_0x301d53(++_0x4f76d4);}(_0x4317,0x7c));var _0x7431=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x4317[_0x3947c9];return _0x2e7871;};'use strict';var _=require('lodash');var moment=require(_0x7431('0x0'));var BPromise=require(_0x7431('0x1'));var rs=require(_0x7431('0x2'));var Redis=require('ioredis');var db=require(_0x7431('0x3'))['db'];var logger=require(_0x7431('0x4'))(_0x7431('0x5'));var config=require(_0x7431('0x6'));var jayson=require(_0x7431('0x7'));var client=jayson[_0x7431('0x8')]['http']({'port':0x232c});config['redis']=_[_0x7431('0x9')](config[_0x7431('0xa')],{'host':_0x7431('0xb'),'port':0x18eb});var socket=require(_0x7431('0xc'))(new Redis(config[_0x7431('0xa')]));require(_0x7431('0xd'))[_0x7431('0xe')](socket);function respondWithRpcPromise(_0x2294b8,_0xccbaee,_0xcf3ea4){return new BPromise(function(_0x9a8b79,_0x13bf7b){return client[_0x7431('0xf')](_0x2294b8,_0xcf3ea4)[_0x7431('0x10')](function(_0x216897){logger[_0x7431('0x11')](_0x7431('0x12'),_0xccbaee,_0x7431('0x13'));logger[_0x7431('0x14')](_0x7431('0x15'),_0xccbaee,_0x7431('0x13'),JSON[_0x7431('0x16')](_0x216897));if(_0x216897[_0x7431('0x17')]){if(_0x216897[_0x7431('0x17')]['code']===0x1f4){logger[_0x7431('0x17')](_0x7431('0x12'),_0xccbaee,_0x216897[_0x7431('0x17')]['message']);return _0x13bf7b(_0x216897[_0x7431('0x17')][_0x7431('0x18')]);}logger[_0x7431('0x17')]('MailAccount,\x20%s,\x20%s',_0xccbaee,_0x216897[_0x7431('0x17')]['message']);return _0x9a8b79(_0x216897['error']['message']);}else{logger[_0x7431('0x11')](_0x7431('0x12'),_0xccbaee,_0x7431('0x13'));_0x9a8b79(_0x216897[_0x7431('0x19')]['message']);}})['catch'](function(_0x167238){logger[_0x7431('0x17')](_0x7431('0x12'),_0xccbaee,_0x167238);_0x13bf7b(_0x167238);});});}exports[_0x7431('0x1a')]=function(_0x1e7fdf){var _0x409c6c=this;return new Promise(function(_0x488e1a,_0x563c0a){return db['MailAccount'][_0x7431('0x1b')]({'raw':_0x1e7fdf[_0x7431('0x1c')]?_0x1e7fdf['options'][_0x7431('0x1d')]===undefined?!![]:![]:!![],'where':_0x1e7fdf[_0x7431('0x1c')]?_0x1e7fdf[_0x7431('0x1c')]['where']||null:null,'attributes':_0x1e7fdf[_0x7431('0x1c')]?_0x1e7fdf[_0x7431('0x1c')][_0x7431('0x1e')]||null:null,'limit':_0x1e7fdf[_0x7431('0x1c')]?_0x1e7fdf['options'][_0x7431('0x1f')]||null:null,'include':_0x1e7fdf[_0x7431('0x1c')]?_0x1e7fdf[_0x7431('0x1c')][_0x7431('0x20')]?_[_0x7431('0x21')](_0x1e7fdf[_0x7431('0x1c')][_0x7431('0x20')],function(_0x183e53){return{'model':db[_0x183e53[_0x7431('0x22')]],'as':_0x183e53['as'],'attributes':_0x183e53[_0x7431('0x1e')],'include':_0x183e53[_0x7431('0x20')]?_[_0x7431('0x21')](_0x183e53['include'],function(_0x43116e){return{'model':db[_0x43116e['model']],'as':_0x43116e['as'],'attributes':_0x43116e['attributes'],'include':_0x43116e[_0x7431('0x20')]?_[_0x7431('0x21')](_0x43116e['include'],function(_0x3052fc){return{'model':db[_0x3052fc[_0x7431('0x22')]],'as':_0x3052fc['as'],'attributes':_0x3052fc[_0x7431('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x7431('0x10')](function(_0x30e63f){logger[_0x7431('0x11')](_0x7431('0x1a'),_0x1e7fdf);logger[_0x7431('0x14')](_0x7431('0x1a'),_0x1e7fdf,JSON[_0x7431('0x16')](_0x30e63f));_0x488e1a(_0x30e63f);})[_0x7431('0x23')](function(_0xa63228){logger['error'](_0x7431('0x1a'),_0xa63228[_0x7431('0x18')],_0x1e7fdf);_0x563c0a(_0x409c6c[_0x7431('0x17')](0x1f4,_0xa63228[_0x7431('0x18')]));});});};exports['ShowMailAccount']=function(_0x2e3d64){var _0x27d324=this;return new Promise(function(_0x3e3fe6,_0x516dc1){return db['MailAccount'][_0x7431('0x24')]({'raw':_0x2e3d64['options']?_0x2e3d64['options'][_0x7431('0x1d')]===undefined?!![]:![]:!![],'where':_0x2e3d64['options']?_0x2e3d64[_0x7431('0x1c')][_0x7431('0x25')]||null:null,'attributes':_0x2e3d64['options']?_0x2e3d64[_0x7431('0x1c')][_0x7431('0x1e')]||null:null,'include':_0x2e3d64['options']?_0x2e3d64[_0x7431('0x1c')][_0x7431('0x20')]?_[_0x7431('0x21')](_0x2e3d64[_0x7431('0x1c')][_0x7431('0x20')],function(_0x4d2be3){return{'model':db[_0x4d2be3[_0x7431('0x22')]],'as':_0x4d2be3['as'],'attributes':_0x4d2be3['attributes'],'include':_0x4d2be3[_0x7431('0x20')]?_[_0x7431('0x21')](_0x4d2be3[_0x7431('0x20')],function(_0x524de5){return{'model':db[_0x524de5[_0x7431('0x22')]],'as':_0x524de5['as'],'attributes':_0x524de5[_0x7431('0x1e')],'include':_0x524de5[_0x7431('0x20')]?_[_0x7431('0x21')](_0x524de5[_0x7431('0x20')],function(_0x316e0c){return{'model':db[_0x316e0c[_0x7431('0x22')]],'as':_0x316e0c['as'],'attributes':_0x316e0c[_0x7431('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x7431('0x10')](function(_0xfde13f){if(_0x2e3d64[_0x7431('0x1c')][_0x7431('0x26')]===!![])_0xfde13f[_0x7431('0x27')]('smtpOptions',_0xfde13f['getSmtpOptions']());logger[_0x7431('0x11')](_0x7431('0x28'),_0x2e3d64);logger['debug']('ShowMailAccount',_0x2e3d64,JSON[_0x7431('0x16')](_0xfde13f));_0x3e3fe6(_0xfde13f);})[_0x7431('0x23')](function(_0x273bb8){logger[_0x7431('0x17')](_0x7431('0x28'),_0x273bb8[_0x7431('0x18')],_0x2e3d64);_0x516dc1(_0x27d324['error'](0x1f4,_0x273bb8['message']));});});};exports[_0x7431('0x29')]=function(_0x4330e5){var _0x13d903=this;return new Promise(function(_0x53dba5,_0x4fe1d7){var _0x178fc6={'body':_0x4330e5[_0x7431('0x2a')],'channel':_0x7431('0x2b')};var _0x12feb1=_['difference'](_[_0x7431('0x2c')](db['CmContact'][_0x7431('0x2d')]),[_0x7431('0x2e'),'updatedAt',_0x7431('0x2f'),_0x7431('0x30')]);var _0x32589c=![];if(_0x4330e5['body']['id']){delete _0x4330e5[_0x7431('0x2a')]['id'];}if(_[_0x7431('0x31')](_0x4330e5['body'][_0x7431('0x32')])){return _0x4fe1d7(_0x13d903[_0x7431('0x17')](0x1f4,_0x7431('0x33')));}if(_[_0x7431('0x31')](_0x4330e5['body'][_0x7431('0x2a')])||_0x4330e5['body']['body']===''){return _0x4fe1d7(_0x13d903[_0x7431('0x17')](0x1f4,_0x7431('0x34')));}if(_[_0x7431('0x31')](_0x4330e5['body']['mapKey'])){return _0x4fe1d7(_0x13d903[_0x7431('0x17')](0x1f4,_0x7431('0x35')+_0x12feb1));}if(!_['includes'](_0x12feb1,_0x4330e5[_0x7431('0x2a')][_0x7431('0x36')])){return _0x4fe1d7(_0x13d903['error'](0x1f4,'mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x12feb1));}var _0x119608={};_0x119608[_0x4330e5['body'][_0x7431('0x36')]]=_0x4330e5[_0x7431('0x2a')][_0x7431('0x32')];return db['MailAccount'][_0x7431('0x24')]({'where':{'id':_0x4330e5['account']['id']},'include':[{'model':db[_0x7431('0x37')],'as':_0x7431('0x38'),'include':[{'model':db[_0x7431('0x39')],'as':_0x7431('0x3a'),'where':_0x119608,'limit':0x1,'order':[[_0x7431('0x3b'),'DESC']]}]},{'model':db['MailApplication'],'as':_0x7431('0x3c')},{'model':db[_0x7431('0x3d')],'as':_0x7431('0x3e'),'include':[{'model':db[_0x7431('0x3f')],'as':_0x7431('0x3f')}]}]})[_0x7431('0x10')](function(_0x6f7b4){if(_0x6f7b4&&_0x6f7b4['List']){var _0x43ebe4=_0x6f7b4[_0x7431('0x40')]({'plain':!![]});_0x178fc6[_0x7431('0x41')]=_[_0x7431('0x42')](_0x43ebe4,[_0x7431('0x3c'),'List']);_0x178fc6[_0x7431('0x41')]['smtpOptions']=_0x6f7b4['getSmtpOptions']();_0x178fc6[_0x7431('0x43')]=_0x43ebe4[_0x7431('0x3c')];_0x178fc6[_0x7431('0x44')]=_0x43ebe4[_0x7431('0x38')];_0x178fc6[_0x7431('0x43')]=_[_0x7431('0x45')](_0x178fc6['applications'],[_0x7431('0x46')],[_0x7431('0x47')]);if(_0x178fc6['account']&&_0x178fc6[_0x7431('0x41')][_0x7431('0x48')]){_0x178fc6[_0x7431('0x43')][_0x7431('0x49')]({'id':0x0,'priority':_0x178fc6['applications'][_0x7431('0x4a')]+0x1,'app':'close','appdata':'autoclose','interval':_0x7431('0x4b')});}if(_0x178fc6[_0x7431('0x41')][_0x7431('0x3c')]){delete _0x178fc6[_0x7431('0x41')][_0x7431('0x3c')];}if(_0x178fc6[_0x7431('0x41')][_0x7431('0x38')]){delete _0x178fc6['account'][_0x7431('0x38')];}if(_0x43ebe4[_0x7431('0x38')]['Contacts'][_0x7431('0x4a')]){return _0x43ebe4[_0x7431('0x38')]['Contacts'][0x0];}var _0x840001=_[_0x7431('0x9')](_0x4330e5[_0x7431('0x2a')],{'firstName':_0x4330e5['body']['from'],'ListId':_0x43ebe4[_0x7431('0x30')]});_0x840001[_0x4330e5[_0x7431('0x2a')][_0x7431('0x36')]]=_0x4330e5['body'][_0x7431('0x32')];return db[_0x7431('0x39')][_0x7431('0x4c')](_0x840001);}else{throw new Error(_0x7431('0x4d'));}})[_0x7431('0x10')](function(_0x39e2aa){_0x178fc6['contact']=_0x39e2aa;if(_0x39e2aa){if(!_0x4330e5['body'][_0x7431('0x18')]['messageId']){_0x4330e5[_0x7431('0x2a')][_0x7431('0x18')]['messageId']=rs[_0x7431('0x4e')]()+'\x20'+_0x4330e5[_0x7431('0x2a')]['message']['from'];}var _0x12cb28={'ContactId':_0x39e2aa['id'],'MailAccountId':_0x4330e5[_0x7431('0x41')]['id'],'inReplyTo':_0x4330e5[_0x7431('0x2a')][_0x7431('0x18')][_0x7431('0x4f')],'to':_0x4330e5[_0x7431('0x2a')][_0x7431('0x18')][_0x7431('0x32')],'cc':_0x4330e5['body']['message']['cc'],'subject':_0x4330e5['body']['message'][_0x7431('0x50')],'attach':_0x4330e5[_0x7431('0x2a')][_0x7431('0x18')]['attach'],'lastMsgAt':moment()[_0x7431('0x51')](_0x7431('0x52')),'lastMsgDirection':'in'};return db[_0x7431('0x53')][_0x7431('0x24')]({'where':{'closed':![],'MailAccountId':_0x4330e5[_0x7431('0x41')]['id']},'include':[{'model':db[_0x7431('0x54')],'as':_0x7431('0x55'),'attributes':[_0x7431('0x4f')],'where':{'messageId':_0x4330e5['body'][_0x7431('0x18')][_0x7431('0x56')]}}]})['then'](function(_0x5db955){if(_0x5db955){return[_0x5db955,![]];}return db['MailInteraction'][_0x7431('0x4c')](_0x12cb28)[_0x7431('0x10')](function(_0x52b2e8){return[_0x52b2e8,!![]];});});}else{throw new Error(_0x7431('0x57'));}})[_0x7431('0x58')](function(_0x3d26be,_0x5109ee){if(_0x3d26be){_0x32589c=_0x5109ee;if(!_0x5109ee){return _0x3d26be[_0x7431('0x59')]({'inReplyTo':_0x4330e5[_0x7431('0x2a')][_0x7431('0x18')][_0x7431('0x4f')],'to':_0x4330e5[_0x7431('0x2a')][_0x7431('0x18')]['from'],'cc':_0x4330e5[_0x7431('0x2a')]['message']['cc'],'subject':_0x4330e5[_0x7431('0x2a')][_0x7431('0x18')][_0x7431('0x50')],'attach':_0x3d26be[_0x7431('0x5a')]?_0x3d26be['attach']:_0x4330e5[_0x7431('0x2a')][_0x7431('0x18')][_0x7431('0x5a')],'substatus':null,'substatusAt':moment()[_0x7431('0x51')](_0x7431('0x52')),'lastMsgAt':moment()[_0x7431('0x51')](_0x7431('0x52')),'lastMsgDirection':'in'});}else{return _0x3d26be;}}})[_0x7431('0x10')](function(_0x2f24f1){_0x178fc6[_0x7431('0x5b')]=_0x2f24f1[_0x7431('0x40')]({'plain':!![]});_0x178fc6[_0x7431('0x5b')][_0x7431('0x5c')]=_0x32589c;return db[_0x7431('0x54')][_0x7431('0x4c')]({'body':_0x4330e5[_0x7431('0x2a')][_0x7431('0x2a')],'MailAccountId':_0x4330e5[_0x7431('0x41')]['id'],'MailInteractionId':_0x2f24f1['id'],'direction':'in','ContactId':_0x178fc6[_0x7431('0x5d')]['id'],'messageId':_0x4330e5[_0x7431('0x2a')][_0x7431('0x18')][_0x7431('0x4f')],'from':_0x4330e5[_0x7431('0x2a')][_0x7431('0x18')][_0x7431('0x32')],'to':_0x4330e5['body'][_0x7431('0x18')]['to'],'cc':_0x4330e5[_0x7431('0x2a')][_0x7431('0x18')]['cc'],'subject':_0x4330e5[_0x7431('0x2a')][_0x7431('0x18')][_0x7431('0x50')],'attach':_0x4330e5[_0x7431('0x2a')][_0x7431('0x18')][_0x7431('0x5a')],'Attachments':_0x4330e5[_0x7431('0x2a')]['message'][_0x7431('0x5e')],'originTo':_0x4330e5[_0x7431('0x2a')][_0x7431('0x18')][_0x7431('0x5f')],'originCc':_0x4330e5[_0x7431('0x2a')][_0x7431('0x18')][_0x7431('0x60')],'bcc':_0x4330e5['body'][_0x7431('0x18')][_0x7431('0x61')],'ChatWebsiteId':_0x4330e5[_0x7431('0x2a')][_0x7431('0x18')][_0x7431('0x62')]||null,'originChannel':_0x4330e5['body'][_0x7431('0x18')][_0x7431('0x63')]||_0x7431('0x64'),'ChatOfflineMessageId':_0x4330e5[_0x7431('0x2a')]['message'][_0x7431('0x65')]||null},{'include':[{'model':db[_0x7431('0x66')],'as':_0x7431('0x67')}]});})['then'](function(_0x25695b){_0x178fc6[_0x7431('0x18')]=_0x25695b;if(!_0x178fc6[_0x7431('0x5b')][_0x7431('0x68')]){return;}return db[_0x7431('0x69')][_0x7431('0x24')]({'attributes':['id',_0x7431('0x6a')],'where':{'id':_0x178fc6['interaction'][_0x7431('0x68')]}});})[_0x7431('0x10')](function(_0x3071bb){if(_0x3071bb){_0x178fc6[_0x7431('0x43')]['unshift']({'id':0x0,'priority':0x0,'app':_0x7431('0x6b'),'appdata':_0x3071bb[_0x7431('0x6a')]+','+(_0x178fc6['account'][_0x7431('0x6c')]||0xa),'interval':_0x7431('0x4b')});}if(!_0x178fc6[_0x7431('0x5b')][_0x7431('0x6d')]){return;}return db[_0x7431('0x6e')][_0x7431('0x24')]({'attributes':['id',_0x7431('0x6a')],'where':{'id':_0x178fc6[_0x7431('0x5b')][_0x7431('0x6d')]}});})[_0x7431('0x10')](function(_0x4f9001){if(_0x4f9001){_0x178fc6[_0x7431('0x43')][_0x7431('0x6f')]({'id':0x0,'priority':0x1,'app':_0x7431('0x70'),'appdata':_0x4f9001['name']+','+(_0x178fc6[_0x7431('0x41')][_0x7431('0x71')]||0x12c),'interval':_0x7431('0x4b')});}return respondWithRpcPromise('Start',_0x7431('0x72'),_0x178fc6);})[_0x7431('0x10')](function(_0x39ce1b){_0x53dba5(_0x39ce1b);})[_0x7431('0x23')](function(_0x10d474){_0x4fe1d7(_0x13d903[_0x7431('0x17')](0x1f4,_0x10d474[_0x7431('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.socket.js b/server/api/mailAccount/mailAccount.socket.js index 49e586d..607b1bc 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 _0x0f19=['removeListener','register','length','./mailAccount.events','save','remove'];(function(_0x322548,_0x15266a){var _0x94e920=function(_0x5996b8){while(--_0x5996b8){_0x322548['push'](_0x322548['shift']());}};_0x94e920(++_0x15266a);}(_0x0f19,0xf3));var _0x90f1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0f19[_0x3dd15e];return _0x231fd0;};'use strict';var MailAccountEvents=require(_0x90f1('0x0'));var events=[_0x90f1('0x1'),_0x90f1('0x2'),'update'];function createListener(_0xb585a2,_0x3c9632){return function(_0x549e5c){_0x3c9632['emit'](_0xb585a2,_0x549e5c);};}function removeListener(_0x16cf66,_0x5dc5dc){return function(){MailAccountEvents[_0x90f1('0x3')](_0x16cf66,_0x5dc5dc);};}exports[_0x90f1('0x4')]=function(_0x162220){for(var _0x5525d5=0x0,_0x4a57ae=events[_0x90f1('0x5')];_0x5525d5<_0x4a57ae;_0x5525d5++){var _0x519c56=events[_0x5525d5];var _0x4156c2=createListener('mailAccount:'+_0x519c56,_0x162220);MailAccountEvents['on'](_0x519c56,_0x4156c2);}}; \ No newline at end of file +var _0xc54c=['./mailAccount.events','remove','emit','register','length','mailAccount:'];(function(_0x342700,_0x569f75){var _0x53406f=function(_0x3b3c32){while(--_0x3b3c32){_0x342700['push'](_0x342700['shift']());}};_0x53406f(++_0x569f75);}(_0xc54c,0x1c2));var _0xcc54=function(_0x10852d,_0x4cdcc6){_0x10852d=_0x10852d-0x0;var _0x13a8d6=_0xc54c[_0x10852d];return _0x13a8d6;};'use strict';var MailAccountEvents=require(_0xcc54('0x0'));var events=['save',_0xcc54('0x1'),'update'];function createListener(_0x3295a2,_0x5e8e5b){return function(_0x12c235){_0x5e8e5b[_0xcc54('0x2')](_0x3295a2,_0x12c235);};}function removeListener(_0x5cace5,_0x41da53){return function(){MailAccountEvents['removeListener'](_0x5cace5,_0x41da53);};}exports[_0xcc54('0x3')]=function(_0xe3c555){for(var _0x3b80c9=0x0,_0x5badee=events[_0xcc54('0x4')];_0x3b80c9<_0x5badee;_0x3b80c9++){var _0x35f3ab=events[_0x3b80c9];var _0x15fb3b=createListener(_0xcc54('0x5')+_0x35f3ab,_0xe3c555);MailAccountEvents['on'](_0x35f3ab,_0x15fb3b);}}; \ No newline at end of file diff --git a/server/api/mailApplication/index.js b/server/api/mailApplication/index.js index 409f251..effcec1 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 _0xc025=['destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./mailApplication.controller','get','/:id','isAuthenticated','put','update','delete'];(function(_0xffc5a3,_0x39e49f){var _0xca5b3=function(_0x22d031){while(--_0x22d031){_0xffc5a3['push'](_0xffc5a3['shift']());}};_0xca5b3(++_0x39e49f);}(_0xc025,0xe2));var _0x5c02=function(_0x57cb38,_0x377f1c){_0x57cb38=_0x57cb38-0x0;var _0x56af6c=_0xc025[_0x57cb38];return _0x56af6c;};'use strict';var multer=require('multer');var util=require(_0x5c02('0x0'));var path=require(_0x5c02('0x1'));var timeout=require(_0x5c02('0x2'));var express=require(_0x5c02('0x3'));var router=express[_0x5c02('0x4')]();var fs_extra=require(_0x5c02('0x5'));var auth=require(_0x5c02('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x5c02('0x7'));router[_0x5c02('0x8')](_0x5c02('0x9'),auth[_0x5c02('0xa')](),controller['show']);router[_0x5c02('0xb')](_0x5c02('0x9'),auth['isAuthenticated'](),controller[_0x5c02('0xc')]);router[_0x5c02('0xd')](_0x5c02('0x9'),auth[_0x5c02('0xa')](),controller[_0x5c02('0xe')]);module[_0x5c02('0xf')]=router; \ No newline at end of file +var _0x372e=['util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailApplication.controller','get','/:id','show','put','isAuthenticated','update','delete','multer'];(function(_0x275293,_0x31bf61){var _0x539b28=function(_0x36e11c){while(--_0x36e11c){_0x275293['push'](_0x275293['shift']());}};_0x539b28(++_0x31bf61);}(_0x372e,0x1df));var _0xe372=function(_0x645525,_0x143bfb){_0x645525=_0x645525-0x0;var _0x2a1af3=_0x372e[_0x645525];return _0x2a1af3;};'use strict';var multer=require(_0xe372('0x0'));var util=require(_0xe372('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xe372('0x2'));var router=express[_0xe372('0x3')]();var fs_extra=require(_0xe372('0x4'));var auth=require(_0xe372('0x5'));var interaction=require(_0xe372('0x6'));var config=require(_0xe372('0x7'));var controller=require(_0xe372('0x8'));router[_0xe372('0x9')](_0xe372('0xa'),auth['isAuthenticated'](),controller[_0xe372('0xb')]);router[_0xe372('0xc')](_0xe372('0xa'),auth[_0xe372('0xd')](),controller[_0xe372('0xe')]);router[_0xe372('0xf')](_0xe372('0xa'),auth[_0xe372('0xd')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.attributes.js b/server/api/mailApplication/mailApplication.attributes.js index a99b215..307b52e 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 _0x0e73=['noop','TEXT','sequelize','INTEGER','STRING'];(function(_0x5ba24b,_0x4ae1a5){var _0x39d28c=function(_0x367ef5){while(--_0x367ef5){_0x5ba24b['push'](_0x5ba24b['shift']());}};_0x39d28c(++_0x4ae1a5);}(_0x0e73,0x110));var _0x30e7=function(_0x5bf601,_0x8fb76d){_0x5bf601=_0x5bf601-0x0;var _0x4ea9b6=_0x0e73[_0x5bf601];return _0x4ea9b6;};'use strict';var Sequelize=require(_0x30e7('0x0'));module['exports']={'priority':{'type':Sequelize[_0x30e7('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x30e7('0x2')],'allowNull':![],'defaultValue':_0x30e7('0x3')},'appdata':{'type':Sequelize[_0x30e7('0x4')]()},'description':{'type':Sequelize[_0x30e7('0x2')]},'interval':{'type':Sequelize[_0x30e7('0x2')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0x7bca=['exports','INTEGER','STRING','noop','TEXT'];(function(_0x24d24e,_0x4e17a4){var _0x20e068=function(_0x48d5e5){while(--_0x48d5e5){_0x24d24e['push'](_0x24d24e['shift']());}};_0x20e068(++_0x4e17a4);}(_0x7bca,0x163));var _0xa7bc=function(_0x5a7b40,_0x585230){_0x5a7b40=_0x5a7b40-0x0;var _0x463559=_0x7bca[_0x5a7b40];return _0x463559;};'use strict';var Sequelize=require('sequelize');module[_0xa7bc('0x0')]={'priority':{'type':Sequelize[_0xa7bc('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0xa7bc('0x2')],'allowNull':![],'defaultValue':_0xa7bc('0x3')},'appdata':{'type':Sequelize[_0xa7bc('0x4')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0xa7bc('0x2')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.controller.js b/server/api/mailApplication/mailApplication.controller.js index e580bd4..024187c 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 _0xaa88=['limit','count','set','apply','reject','then','stack','name','send','params','model','keys','MailApplication','query','filters','intersection','attributes','fields','length','include','merge','options','find','update','body','catch','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xaa88,0x137));var _0x8aa8=function(_0x38eb23,_0x196e8b){_0x38eb23=_0x38eb23-0x0;var _0x48506a=_0xaa88[_0x38eb23];return _0x48506a;};'use strict';var emlformat=require(_0x8aa8('0x0'));var rimraf=require(_0x8aa8('0x1'));var zipdir=require(_0x8aa8('0x2'));var jsonpatch=require(_0x8aa8('0x3'));var rp=require('request-promise');var moment=require(_0x8aa8('0x4'));var BPromise=require(_0x8aa8('0x5'));var Mustache=require(_0x8aa8('0x6'));var util=require(_0x8aa8('0x7'));var path=require(_0x8aa8('0x8'));var sox=require(_0x8aa8('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8aa8('0xa'));var _=require('lodash');var squel=require(_0x8aa8('0xb'));var crypto=require(_0x8aa8('0xc'));var jsforce=require(_0x8aa8('0xd'));var deskjs=require(_0x8aa8('0xe'));var toCsv=require('to-csv');var querystring=require(_0x8aa8('0xf'));var Papa=require(_0x8aa8('0x10'));var Redis=require(_0x8aa8('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x8aa8('0x12'));var as=require(_0x8aa8('0x13'));var hardwareService=require(_0x8aa8('0x14'));var logger=require(_0x8aa8('0x15'))('api');var utils=require(_0x8aa8('0x16'));var config=require(_0x8aa8('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x8aa8('0x18'))['db'];function respondWithStatusCode(_0xa691d6,_0x28132f){_0x28132f=_0x28132f||0xcc;return function(_0x535aa0){if(_0x535aa0){return _0xa691d6[_0x8aa8('0x19')](_0x28132f);}return _0xa691d6[_0x8aa8('0x1a')](_0x28132f)[_0x8aa8('0x1b')]();};}function respondWithResult(_0x4b686e,_0x391642){_0x391642=_0x391642||0xc8;return function(_0x4af534){if(_0x4af534){return _0x4b686e['status'](_0x391642)[_0x8aa8('0x1c')](_0x4af534);}};}function respondWithFilteredResult(_0x200662,_0xae81a0){return function(_0xa6c2af){if(_0xa6c2af){var _0x42a6a4=typeof _0xae81a0[_0x8aa8('0x1d')]===_0x8aa8('0x1e')&&typeof _0xae81a0[_0x8aa8('0x1f')]===_0x8aa8('0x1e');var _0x4e8ce3=_0xa6c2af['count'];var _0x2c1b9a=_0x42a6a4?0x0:_0xae81a0['offset'];var _0x557adc=_0x42a6a4?_0xa6c2af[_0x8aa8('0x20')]:_0xae81a0['offset']+_0xae81a0[_0x8aa8('0x1f')];var _0x41092b;if(_0x557adc>=_0x4e8ce3){_0x557adc=_0x4e8ce3;_0x41092b=0xc8;}else{_0x41092b=0xce;}_0x200662[_0x8aa8('0x1a')](_0x41092b);return _0x200662[_0x8aa8('0x21')]('Content-Range',_0x2c1b9a+'-'+_0x557adc+'/'+_0x4e8ce3)[_0x8aa8('0x1c')](_0xa6c2af);}return null;};}function patchUpdates(_0x36c445){return function(_0x2825fd){try{jsonpatch[_0x8aa8('0x22')](_0x2825fd,_0x36c445,!![]);}catch(_0x4c754e){return BPromise[_0x8aa8('0x23')](_0x4c754e);}return _0x2825fd['save']();};}function saveUpdates(_0x26cf63,_0x4cc455){return function(_0x1fdadd){if(_0x1fdadd){return _0x1fdadd['update'](_0x26cf63)[_0x8aa8('0x24')](function(_0x557e4e){return _0x557e4e;});}return null;};}function removeEntity(_0x65945b,_0x40adb5){return function(_0x3ca7dc){if(_0x3ca7dc){return _0x3ca7dc['destroy']()[_0x8aa8('0x24')](function(){_0x65945b[_0x8aa8('0x1a')](0xcc)[_0x8aa8('0x1b')]();});}};}function handleEntityNotFound(_0x547a7b,_0x57acd2){return function(_0x2d1508){if(!_0x2d1508){_0x547a7b[_0x8aa8('0x19')](0x194);}return _0x2d1508;};}function handleError(_0x2f91f3,_0x3a3c7a){_0x3a3c7a=_0x3a3c7a||0x1f4;return function(_0x24143e){logger['error'](_0x24143e[_0x8aa8('0x25')]);if(_0x24143e['name']){delete _0x24143e[_0x8aa8('0x26')];}_0x2f91f3[_0x8aa8('0x1a')](_0x3a3c7a)[_0x8aa8('0x27')](_0x24143e);};}exports['show']=function(_0x4c5c5c,_0x10810d){var _0x5e96c9={'raw':!![],'where':{'id':_0x4c5c5c[_0x8aa8('0x28')]['id']}},_0x385208={};_0x385208[_0x8aa8('0x29')]=_[_0x8aa8('0x2a')](db[_0x8aa8('0x2b')]['rawAttributes']);_0x385208[_0x8aa8('0x2c')]=_[_0x8aa8('0x2a')](_0x4c5c5c['query']);_0x385208[_0x8aa8('0x2d')]=_[_0x8aa8('0x2e')](_0x385208[_0x8aa8('0x29')],_0x385208['query']);_0x5e96c9[_0x8aa8('0x2f')]=_[_0x8aa8('0x2e')](_0x385208[_0x8aa8('0x29')],qs[_0x8aa8('0x30')](_0x4c5c5c[_0x8aa8('0x2c')][_0x8aa8('0x30')]));_0x5e96c9[_0x8aa8('0x2f')]=_0x5e96c9[_0x8aa8('0x2f')][_0x8aa8('0x31')]?_0x5e96c9[_0x8aa8('0x2f')]:_0x385208[_0x8aa8('0x29')];if(_0x4c5c5c['query']['includeAll']){_0x5e96c9[_0x8aa8('0x32')]=[{'all':!![]}];}_0x5e96c9=_[_0x8aa8('0x33')]({},_0x5e96c9,_0x4c5c5c[_0x8aa8('0x34')]);return db[_0x8aa8('0x2b')][_0x8aa8('0x35')](_0x5e96c9)[_0x8aa8('0x24')](handleEntityNotFound(_0x10810d,null))['then'](respondWithResult(_0x10810d,null))['catch'](handleError(_0x10810d,null));};exports[_0x8aa8('0x36')]=function(_0x5755b5,_0x24997c){if(_0x5755b5[_0x8aa8('0x37')]['id']){delete _0x5755b5[_0x8aa8('0x37')]['id'];}return db['MailApplication'][_0x8aa8('0x35')]({'where':{'id':_0x5755b5[_0x8aa8('0x28')]['id']}})[_0x8aa8('0x24')](handleEntityNotFound(_0x24997c,null))['then'](saveUpdates(_0x5755b5['body'],null))[_0x8aa8('0x24')](respondWithResult(_0x24997c,null))[_0x8aa8('0x38')](handleError(_0x24997c,null));};exports['destroy']=function(_0x24eb18,_0x2e1f52){return db['MailApplication'][_0x8aa8('0x35')]({'where':{'id':_0x24eb18['params']['id']}})['then'](handleEntityNotFound(_0x2e1f52,null))[_0x8aa8('0x24')](removeEntity(_0x2e1f52,null))['catch'](handleError(_0x2e1f52,null));}; \ No newline at end of file +var _0xd8b0=['attributes','length','include','merge','find','catch','body','params','eml-format','rimraf','moment','bluebird','mustache','util','path','ejs','fs-extra','lodash','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','apply','save','update','then','destroy','error','name','show','model','MailApplication','query','keys','intersection','fields'];(function(_0x2ec477,_0x1e155a){var _0x23f196=function(_0x3c3f74){while(--_0x3c3f74){_0x2ec477['push'](_0x2ec477['shift']());}};_0x23f196(++_0x1e155a);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var emlformat=require(_0x0d8b('0x0'));var rimraf=require(_0x0d8b('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x0d8b('0x2'));var BPromise=require(_0x0d8b('0x3'));var Mustache=require(_0x0d8b('0x4'));var util=require(_0x0d8b('0x5'));var path=require(_0x0d8b('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x0d8b('0x7'));var fs=require('fs');var fs_extra=require(_0x0d8b('0x8'));var _=require(_0x0d8b('0x9'));var squel=require('squel');var crypto=require(_0x0d8b('0xa'));var jsforce=require(_0x0d8b('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x0d8b('0xc'));var querystring=require(_0x0d8b('0xd'));var Papa=require(_0x0d8b('0xe'));var Redis=require(_0x0d8b('0xf'));var authService=require(_0x0d8b('0x10'));var qs=require(_0x0d8b('0x11'));var as=require(_0x0d8b('0x12'));var hardwareService=require(_0x0d8b('0x13'));var logger=require('../../config/logger')(_0x0d8b('0x14'));var utils=require('../../config/utils');var config=require(_0x0d8b('0x15'));var licenseUtil=require(_0x0d8b('0x16'));var db=require(_0x0d8b('0x17'))['db'];function respondWithStatusCode(_0x92cdd8,_0x35a07b){_0x35a07b=_0x35a07b||0xcc;return function(_0x32bb1a){if(_0x32bb1a){return _0x92cdd8[_0x0d8b('0x18')](_0x35a07b);}return _0x92cdd8[_0x0d8b('0x19')](_0x35a07b)[_0x0d8b('0x1a')]();};}function respondWithResult(_0x2ce75e,_0x5ad086){_0x5ad086=_0x5ad086||0xc8;return function(_0xe65334){if(_0xe65334){return _0x2ce75e[_0x0d8b('0x19')](_0x5ad086)[_0x0d8b('0x1b')](_0xe65334);}};}function respondWithFilteredResult(_0x4f6f21,_0x23eb7b){return function(_0xa86349){if(_0xa86349){var _0x17f7df=typeof _0x23eb7b[_0x0d8b('0x1c')]===_0x0d8b('0x1d')&&typeof _0x23eb7b['limit']===_0x0d8b('0x1d');var _0x4586c2=_0xa86349[_0x0d8b('0x1e')];var _0x5fecbd=_0x17f7df?0x0:_0x23eb7b[_0x0d8b('0x1c')];var _0x18dd2d=_0x17f7df?_0xa86349[_0x0d8b('0x1e')]:_0x23eb7b[_0x0d8b('0x1c')]+_0x23eb7b['limit'];var _0x27512e;if(_0x18dd2d>=_0x4586c2){_0x18dd2d=_0x4586c2;_0x27512e=0xc8;}else{_0x27512e=0xce;}_0x4f6f21[_0x0d8b('0x19')](_0x27512e);return _0x4f6f21[_0x0d8b('0x1f')](_0x0d8b('0x20'),_0x5fecbd+'-'+_0x18dd2d+'/'+_0x4586c2)[_0x0d8b('0x1b')](_0xa86349);}return null;};}function patchUpdates(_0x5b709c){return function(_0x393beb){try{jsonpatch[_0x0d8b('0x21')](_0x393beb,_0x5b709c,!![]);}catch(_0x50ec1e){return BPromise['reject'](_0x50ec1e);}return _0x393beb[_0x0d8b('0x22')]();};}function saveUpdates(_0x54a9a7,_0x56c729){return function(_0x5527d8){if(_0x5527d8){return _0x5527d8[_0x0d8b('0x23')](_0x54a9a7)[_0x0d8b('0x24')](function(_0x214778){return _0x214778;});}return null;};}function removeEntity(_0x38efc8,_0x221071){return function(_0x2c64e2){if(_0x2c64e2){return _0x2c64e2[_0x0d8b('0x25')]()[_0x0d8b('0x24')](function(){_0x38efc8[_0x0d8b('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0xe8bbee,_0x4463ee){return function(_0x5363e3){if(!_0x5363e3){_0xe8bbee[_0x0d8b('0x18')](0x194);}return _0x5363e3;};}function handleError(_0x4a0ae4,_0x3dd149){_0x3dd149=_0x3dd149||0x1f4;return function(_0x234bdd){logger[_0x0d8b('0x26')](_0x234bdd['stack']);if(_0x234bdd['name']){delete _0x234bdd[_0x0d8b('0x27')];}_0x4a0ae4[_0x0d8b('0x19')](_0x3dd149)['send'](_0x234bdd);};}exports[_0x0d8b('0x28')]=function(_0x59aa83,_0x1b2b59){var _0x4b59e5={'raw':!![],'where':{'id':_0x59aa83['params']['id']}},_0x97050a={};_0x97050a[_0x0d8b('0x29')]=_['keys'](db[_0x0d8b('0x2a')]['rawAttributes']);_0x97050a[_0x0d8b('0x2b')]=_[_0x0d8b('0x2c')](_0x59aa83[_0x0d8b('0x2b')]);_0x97050a['filters']=_['intersection'](_0x97050a['model'],_0x97050a[_0x0d8b('0x2b')]);_0x4b59e5['attributes']=_[_0x0d8b('0x2d')](_0x97050a['model'],qs['fields'](_0x59aa83[_0x0d8b('0x2b')][_0x0d8b('0x2e')]));_0x4b59e5[_0x0d8b('0x2f')]=_0x4b59e5[_0x0d8b('0x2f')][_0x0d8b('0x30')]?_0x4b59e5[_0x0d8b('0x2f')]:_0x97050a[_0x0d8b('0x29')];if(_0x59aa83[_0x0d8b('0x2b')]['includeAll']){_0x4b59e5[_0x0d8b('0x31')]=[{'all':!![]}];}_0x4b59e5=_[_0x0d8b('0x32')]({},_0x4b59e5,_0x59aa83['options']);return db[_0x0d8b('0x2a')][_0x0d8b('0x33')](_0x4b59e5)[_0x0d8b('0x24')](handleEntityNotFound(_0x1b2b59,null))['then'](respondWithResult(_0x1b2b59,null))[_0x0d8b('0x34')](handleError(_0x1b2b59,null));};exports[_0x0d8b('0x23')]=function(_0x206157,_0x31ceba){if(_0x206157[_0x0d8b('0x35')]['id']){delete _0x206157['body']['id'];}return db[_0x0d8b('0x2a')][_0x0d8b('0x33')]({'where':{'id':_0x206157['params']['id']}})[_0x0d8b('0x24')](handleEntityNotFound(_0x31ceba,null))[_0x0d8b('0x24')](saveUpdates(_0x206157[_0x0d8b('0x35')],null))[_0x0d8b('0x24')](respondWithResult(_0x31ceba,null))[_0x0d8b('0x34')](handleError(_0x31ceba,null));};exports['destroy']=function(_0x497a71,_0x41b4f9){return db['MailApplication']['find']({'where':{'id':_0x497a71[_0x0d8b('0x36')]['id']}})[_0x0d8b('0x24')](handleEntityNotFound(_0x41b4f9,null))[_0x0d8b('0x24')](removeEntity(_0x41b4f9,null))[_0x0d8b('0x34')](handleError(_0x41b4f9,null));}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.model.js b/server/api/mailApplication/mailApplication.model.js index a9a288b..ca222c7 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 _0x3c9b=['utf8mb4_unicode_ci','lodash','../../config/logger','api','bluebird','request-promise','path','./mailApplication.attributes','exports','define','MailApplication','mail_applications','utf8mb4'];(function(_0x21aec3,_0x5c97e9){var _0x288bbc=function(_0x2283fe){while(--_0x2283fe){_0x21aec3['push'](_0x21aec3['shift']());}};_0x288bbc(++_0x5c97e9);}(_0x3c9b,0x105));var _0xb3c9=function(_0x3ca96a,_0x3efc44){_0x3ca96a=_0x3ca96a-0x0;var _0x438fe1=_0x3c9b[_0x3ca96a];return _0x438fe1;};'use strict';var _=require(_0xb3c9('0x0'));var util=require('util');var logger=require(_0xb3c9('0x1'))(_0xb3c9('0x2'));var moment=require('moment');var BPromise=require(_0xb3c9('0x3'));var rp=require(_0xb3c9('0x4'));var fs=require('fs');var path=require(_0xb3c9('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xb3c9('0x6'));module[_0xb3c9('0x7')]=function(_0x271ff1,_0xbae567){return _0x271ff1[_0xb3c9('0x8')](_0xb3c9('0x9'),attributes,{'tableName':_0xb3c9('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xb3c9('0xb'),'collate':_0xb3c9('0xc')});}; \ No newline at end of file +var _0xd4bc=['mail_applications','utf8mb4','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./mailApplication.attributes','exports','define','MailApplication'];(function(_0x263a2f,_0x1e81e3){var _0x8020e8=function(_0x39f91a){while(--_0x39f91a){_0x263a2f['push'](_0x263a2f['shift']());}};_0x8020e8(++_0x1e81e3);}(_0xd4bc,0x197));var _0xcd4b=function(_0x4fa291,_0x56e289){_0x4fa291=_0x4fa291-0x0;var _0x506d9b=_0xd4bc[_0x4fa291];return _0x506d9b;};'use strict';var _=require(_0xcd4b('0x0'));var util=require(_0xcd4b('0x1'));var logger=require(_0xcd4b('0x2'))(_0xcd4b('0x3'));var moment=require(_0xcd4b('0x4'));var BPromise=require('bluebird');var rp=require(_0xcd4b('0x5'));var fs=require('fs');var path=require(_0xcd4b('0x6'));var rimraf=require(_0xcd4b('0x7'));var config=require(_0xcd4b('0x8'));var attributes=require(_0xcd4b('0x9'));module[_0xcd4b('0xa')]=function(_0x2ff4a6,_0x1e5837){return _0x2ff4a6[_0xcd4b('0xb')](_0xcd4b('0xc'),attributes,{'tableName':_0xcd4b('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xcd4b('0xe'),'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 fb42edd..cda30a2 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 _0xd0ee=['error','code','message','MailApplication,\x20%s,\x20%s','info','UpdateMailApplication','MailApplication','update','options','raw','limit','then','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','request\x20sent','debug','MailApplication,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x5c8a68,_0x495158){var _0x11697a=function(_0x1a9695){while(--_0x1a9695){_0x5c8a68['push'](_0x5c8a68['shift']());}};_0x11697a(++_0x495158);}(_0xd0ee,0x12f));var _0xed0e=function(_0x3fe5c9,_0x28befd){_0x3fe5c9=_0x3fe5c9-0x0;var _0x42adee=_0xd0ee[_0x3fe5c9];return _0x42adee;};'use strict';var _=require(_0xed0e('0x0'));var util=require(_0xed0e('0x1'));var moment=require(_0xed0e('0x2'));var BPromise=require(_0xed0e('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xed0e('0x4'));var db=require(_0xed0e('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xed0e('0x6'));var config=require(_0xed0e('0x7'));var jayson=require(_0xed0e('0x8'));var client=jayson[_0xed0e('0x9')][_0xed0e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x53fc31,_0x455c9e,_0x4eec05){return new BPromise(function(_0x295a00,_0x3015cd){return client[_0xed0e('0xb')](_0x53fc31,_0x4eec05)['then'](function(_0x5b11ad){logger['info']('MailApplication,\x20%s,\x20%s',_0x455c9e,_0xed0e('0xc'));logger[_0xed0e('0xd')](_0xed0e('0xe'),_0x455c9e,_0xed0e('0xc'),JSON[_0xed0e('0xf')](_0x5b11ad));if(_0x5b11ad[_0xed0e('0x10')]){if(_0x5b11ad[_0xed0e('0x10')][_0xed0e('0x11')]===0x1f4){logger['error']('MailApplication,\x20%s,\x20%s',_0x455c9e,_0x5b11ad[_0xed0e('0x10')]['message']);return _0x3015cd(_0x5b11ad[_0xed0e('0x10')][_0xed0e('0x12')]);}logger['error'](_0xed0e('0x13'),_0x455c9e,_0x5b11ad[_0xed0e('0x10')][_0xed0e('0x12')]);return _0x295a00(_0x5b11ad['error'][_0xed0e('0x12')]);}else{logger[_0xed0e('0x14')]('MailApplication,\x20%s,\x20%s',_0x455c9e,'request\x20sent');_0x295a00(_0x5b11ad['result'][_0xed0e('0x12')]);}})['catch'](function(_0x285f06){logger[_0xed0e('0x10')](_0xed0e('0x13'),_0x455c9e,_0x285f06);_0x3015cd(_0x285f06);});});}exports[_0xed0e('0x15')]=function(_0x5c412e){var _0xf15aa5=this;return new Promise(function(_0x5ecd6c,_0x514afe){return db[_0xed0e('0x16')][_0xed0e('0x17')](_0x5c412e['body'],{'raw':_0x5c412e[_0xed0e('0x18')]?_0x5c412e[_0xed0e('0x18')][_0xed0e('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5c412e[_0xed0e('0x18')]?_0x5c412e[_0xed0e('0x18')]['where']||null:null,'attributes':_0x5c412e['options']?_0x5c412e[_0xed0e('0x18')]['attributes']||null:null,'limit':_0x5c412e[_0xed0e('0x18')]?_0x5c412e['options'][_0xed0e('0x1a')]||null:null})[_0xed0e('0x1b')](function(_0x5ed521){logger['info'](_0xed0e('0x15'),_0x5c412e);logger['debug'](_0xed0e('0x15'),_0x5c412e,JSON['stringify'](_0x5ed521));_0x5ecd6c(_0x5ed521);})[_0xed0e('0x1c')](function(_0x202aa0){logger[_0xed0e('0x10')]('UpdateMailApplication',_0x202aa0['message'],_0x5c412e);_0x514afe(_0xf15aa5[_0xed0e('0x10')](0x1f4,_0x202aa0[_0xed0e('0x12')]));});});}; \ No newline at end of file +var _0xbc54=['code','message','catch','UpdateMailApplication','MailApplication','update','options','raw','attributes','limit','debug','lodash','moment','bluebird','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','then','info','MailApplication,\x20%s,\x20%s','request\x20sent','MailApplication,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x1a0daa,_0x2a4634){var _0x1dbe15=function(_0xa8ab22){while(--_0xa8ab22){_0x1a0daa['push'](_0x1a0daa['shift']());}};_0x1dbe15(++_0x2a4634);}(_0xbc54,0xeb));var _0x4bc5=function(_0xac51b0,_0x435d3a){_0xac51b0=_0xac51b0-0x0;var _0x25d43b=_0xbc54[_0xac51b0];return _0x25d43b;};'use strict';var _=require(_0x4bc5('0x0'));var util=require('util');var moment=require(_0x4bc5('0x1'));var BPromise=require(_0x4bc5('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4bc5('0x3'))['db'];var utils=require(_0x4bc5('0x4'));var logger=require('../../config/logger')(_0x4bc5('0x5'));var config=require('../../config/environment');var jayson=require(_0x4bc5('0x6'));var client=jayson[_0x4bc5('0x7')][_0x4bc5('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x66991f,_0x3e7d8f,_0x5da458){return new BPromise(function(_0x1330c2,_0x322868){return client[_0x4bc5('0x9')](_0x66991f,_0x5da458)[_0x4bc5('0xa')](function(_0x489462){logger[_0x4bc5('0xb')](_0x4bc5('0xc'),_0x3e7d8f,_0x4bc5('0xd'));logger['debug'](_0x4bc5('0xe'),_0x3e7d8f,_0x4bc5('0xd'),JSON[_0x4bc5('0xf')](_0x489462));if(_0x489462[_0x4bc5('0x10')]){if(_0x489462[_0x4bc5('0x10')][_0x4bc5('0x11')]===0x1f4){logger[_0x4bc5('0x10')](_0x4bc5('0xc'),_0x3e7d8f,_0x489462['error'][_0x4bc5('0x12')]);return _0x322868(_0x489462[_0x4bc5('0x10')][_0x4bc5('0x12')]);}logger[_0x4bc5('0x10')]('MailApplication,\x20%s,\x20%s',_0x3e7d8f,_0x489462[_0x4bc5('0x10')]['message']);return _0x1330c2(_0x489462['error'][_0x4bc5('0x12')]);}else{logger[_0x4bc5('0xb')](_0x4bc5('0xc'),_0x3e7d8f,'request\x20sent');_0x1330c2(_0x489462['result']['message']);}})[_0x4bc5('0x13')](function(_0x36f5dd){logger[_0x4bc5('0x10')](_0x4bc5('0xc'),_0x3e7d8f,_0x36f5dd);_0x322868(_0x36f5dd);});});}exports[_0x4bc5('0x14')]=function(_0x5d836e){var _0xc62fb7=this;return new Promise(function(_0x4e2bec,_0x29a636){return db[_0x4bc5('0x15')][_0x4bc5('0x16')](_0x5d836e['body'],{'raw':_0x5d836e[_0x4bc5('0x17')]?_0x5d836e[_0x4bc5('0x17')][_0x4bc5('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5d836e[_0x4bc5('0x17')]?_0x5d836e[_0x4bc5('0x17')]['where']||null:null,'attributes':_0x5d836e[_0x4bc5('0x17')]?_0x5d836e[_0x4bc5('0x17')][_0x4bc5('0x19')]||null:null,'limit':_0x5d836e[_0x4bc5('0x17')]?_0x5d836e[_0x4bc5('0x17')][_0x4bc5('0x1a')]||null:null})['then'](function(_0x271ef1){logger['info'](_0x4bc5('0x14'),_0x5d836e);logger[_0x4bc5('0x1b')]('UpdateMailApplication',_0x5d836e,JSON[_0x4bc5('0xf')](_0x271ef1));_0x4e2bec(_0x271ef1);})[_0x4bc5('0x13')](function(_0x1bc731){logger['error'](_0x4bc5('0x14'),_0x1bc731['message'],_0x5d836e);_0x29a636(_0xc62fb7['error'](0x1f4,_0x1bc731[_0x4bc5('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/index.js b/server/api/mailInteraction/index.js index 8130fcd..d75a705 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 _0xaa46=['exports','express','../../components/auth/service','../../components/interaction/service','get','index','describe','/:id','show','isAuthenticated','getMessages','post','/:id/messages','addMessage','/:id/tags','mailinteraction:addtags','addTags','put','tracked','mail','update','delete','mailinteraction:destroy','destroy','removeTags'];(function(_0x3234d5,_0x5d1d26){var _0x852f37=function(_0x174442){while(--_0x174442){_0x3234d5['push'](_0x3234d5['shift']());}};_0x852f37(++_0x5d1d26);}(_0xaa46,0x12d));var _0x6aa4=function(_0x499aab,_0x79ef10){_0x499aab=_0x499aab-0x0;var _0x1174b1=_0xaa46[_0x499aab];return _0x1174b1;};'use strict';var express=require(_0x6aa4('0x0'));var router=express['Router']();var auth=require(_0x6aa4('0x1'));var interaction=require(_0x6aa4('0x2'));var controller=require('./mailInteraction.controller');router[_0x6aa4('0x3')]('/',auth['isAuthenticated'](),controller[_0x6aa4('0x4')]);router[_0x6aa4('0x3')]('/describe',auth['isAuthenticated'](),controller[_0x6aa4('0x5')]);router[_0x6aa4('0x3')](_0x6aa4('0x6'),auth['isAuthenticated'](),controller[_0x6aa4('0x7')]);router[_0x6aa4('0x3')]('/:id/messages',auth[_0x6aa4('0x8')](),controller[_0x6aa4('0x9')]);router[_0x6aa4('0x3')]('/:id/download',auth[_0x6aa4('0x8')](),controller['download']);router[_0x6aa4('0xa')]('/',auth['isAuthenticated'](),controller['create']);router[_0x6aa4('0xa')](_0x6aa4('0xb'),auth[_0x6aa4('0x8')](),controller[_0x6aa4('0xc')]);router[_0x6aa4('0xa')](_0x6aa4('0xd'),auth[_0x6aa4('0x8')](),interaction['tracked']('mail',_0x6aa4('0xe')),controller[_0x6aa4('0xf')]);router[_0x6aa4('0x10')](_0x6aa4('0x6'),auth['isAuthenticated'](),interaction[_0x6aa4('0x11')](_0x6aa4('0x12'),'mailinteraction:update'),controller[_0x6aa4('0x13')]);router[_0x6aa4('0x14')]('/:id',auth[_0x6aa4('0x8')](),interaction[_0x6aa4('0x11')](_0x6aa4('0x12'),_0x6aa4('0x15')),controller[_0x6aa4('0x16')]);router[_0x6aa4('0x14')](_0x6aa4('0xd'),auth[_0x6aa4('0x8')](),controller[_0x6aa4('0x17')]);module[_0x6aa4('0x18')]=router; \ No newline at end of file +var _0x5b05=['delete','mailinteraction:destroy','removeTags','exports','express','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/describe','show','getMessages','/:id/download','download','post','/:id/messages','addMessage','/:id/tags','tracked','mail','mailinteraction:addtags','mailinteraction:update','update'];(function(_0x22551e,_0x5772eb){var _0x63f68c=function(_0x3369f8){while(--_0x3369f8){_0x22551e['push'](_0x22551e['shift']());}};_0x63f68c(++_0x5772eb);}(_0x5b05,0xe5));var _0x55b0=function(_0x3d1f0f,_0x589ead){_0x3d1f0f=_0x3d1f0f-0x0;var _0x79eca3=_0x5b05[_0x3d1f0f];return _0x79eca3;};'use strict';var express=require(_0x55b0('0x0'));var router=express[_0x55b0('0x1')]();var auth=require(_0x55b0('0x2'));var interaction=require(_0x55b0('0x3'));var controller=require('./mailInteraction.controller');router[_0x55b0('0x4')]('/',auth[_0x55b0('0x5')](),controller[_0x55b0('0x6')]);router[_0x55b0('0x4')](_0x55b0('0x7'),auth['isAuthenticated'](),controller['describe']);router[_0x55b0('0x4')]('/:id',auth[_0x55b0('0x5')](),controller[_0x55b0('0x8')]);router[_0x55b0('0x4')]('/:id/messages',auth[_0x55b0('0x5')](),controller[_0x55b0('0x9')]);router['get'](_0x55b0('0xa'),auth[_0x55b0('0x5')](),controller[_0x55b0('0xb')]);router[_0x55b0('0xc')]('/',auth['isAuthenticated'](),controller['create']);router[_0x55b0('0xc')](_0x55b0('0xd'),auth[_0x55b0('0x5')](),controller[_0x55b0('0xe')]);router[_0x55b0('0xc')](_0x55b0('0xf'),auth[_0x55b0('0x5')](),interaction[_0x55b0('0x10')](_0x55b0('0x11'),_0x55b0('0x12')),controller['addTags']);router['put']('/:id',auth[_0x55b0('0x5')](),interaction[_0x55b0('0x10')](_0x55b0('0x11'),_0x55b0('0x13')),controller[_0x55b0('0x14')]);router[_0x55b0('0x15')]('/:id',auth[_0x55b0('0x5')](),interaction[_0x55b0('0x10')](_0x55b0('0x11'),_0x55b0('0x16')),controller['destroy']);router[_0x55b0('0x15')]('/:id/tags',auth['isAuthenticated'](),controller[_0x55b0('0x17')]);module[_0x55b0('0x18')]=router; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.attributes.js b/server/api/mailInteraction/mailInteraction.attributes.js index 72aa52b..e66374b 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 _0x1607=['DATE','STRING','TEXT','long','ENUM','out','INTEGER','sequelize','iconv','exports','BOOLEAN'];(function(_0x2b4411,_0x2625ed){var _0x8e41ef=function(_0x2aa8c1){while(--_0x2aa8c1){_0x2b4411['push'](_0x2b4411['shift']());}};_0x8e41ef(++_0x2625ed);}(_0x1607,0x75));var _0x7160=function(_0x54262a,_0x338649){_0x54262a=_0x54262a-0x0;var _0x342e2f=_0x1607[_0x54262a];return _0x342e2f;};'use strict';var Sequelize=require(_0x7160('0x0'));var iconv=require(_0x7160('0x1'));module[_0x7160('0x2')]={'closed':{'type':Sequelize[_0x7160('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x7160('0x4')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x7160('0x5')]},'note':{'type':Sequelize[_0x7160('0x5')]},'inReplyTo':{'type':Sequelize['STRING'](0x1fe)},'to':{'type':Sequelize[_0x7160('0x5')]},'cc':{'type':Sequelize[_0x7160('0x6')](_0x7160('0x7'))},'subject':{'type':Sequelize[_0x7160('0x6')]()},'attach':{'type':Sequelize[_0x7160('0x3')],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0x7160('0x4')]},'substatus':{'type':Sequelize[_0x7160('0x5')](0x3c)},'substatusAt':{'type':Sequelize[_0x7160('0x4')]},'firstMsgDirection':{'type':Sequelize[_0x7160('0x8')]('in',_0x7160('0x9')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x7160('0x4')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0x7160('0x9')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueId':{'type':Sequelize[_0x7160('0xa')]}}; \ No newline at end of file +var _0x2f7b=['exports','STRING','TEXT','BOOLEAN','DATE','ENUM','out','sequelize','iconv'];(function(_0x4034c2,_0x3253e5){var _0x1cc244=function(_0x409dd0){while(--_0x409dd0){_0x4034c2['push'](_0x4034c2['shift']());}};_0x1cc244(++_0x3253e5);}(_0x2f7b,0x8e));var _0xb2f7=function(_0x2bd5b0,_0x3470ed){_0x2bd5b0=_0x2bd5b0-0x0;var _0x13f4d0=_0x2f7b[_0x2bd5b0];return _0x13f4d0;};'use strict';var Sequelize=require(_0xb2f7('0x0'));var iconv=require(_0xb2f7('0x1'));module[_0xb2f7('0x2')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0xb2f7('0x3')]},'secondDisposition':{'type':Sequelize[_0xb2f7('0x3')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0xb2f7('0x3')]},'inReplyTo':{'type':Sequelize[_0xb2f7('0x3')](0x1fe)},'to':{'type':Sequelize[_0xb2f7('0x3')]},'cc':{'type':Sequelize[_0xb2f7('0x4')]('long')},'subject':{'type':Sequelize[_0xb2f7('0x4')]()},'attach':{'type':Sequelize[_0xb2f7('0x5')],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0xb2f7('0x6')]},'substatus':{'type':Sequelize[_0xb2f7('0x3')](0x3c)},'substatusAt':{'type':Sequelize[_0xb2f7('0x6')]},'firstMsgDirection':{'type':Sequelize[_0xb2f7('0x7')]('in',_0xb2f7('0x8')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xb2f7('0x6')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0xb2f7('0x8')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0xb2f7('0x5')],'defaultValue':![]},'queueId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.controller.js b/server/api/mailInteraction/mailInteraction.controller.js index a7c3deb..1b42bcf 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 _0xf4d2=['bcc','headers','Bcc','Attachments','basename','type','build','writeFileSync','message%d.eml','unlinkSync','eml-format','rimraf','moment','bluebird','util','juice','ioredis','../../components/interaction/service','../../components/parsers/qs','api','../../config/environment','html-entities','defaults','redis','localhost','socket.io-emitter','./mailInteraction.socket','register','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','update','then','destroy','stack','name','send','index','map','MailInteraction','rawAttributes','getOptions','mail','query','user','catch','show','params','model','filters','attributes','intersection','length','includeAll','include','merge','options','find','create','body','describe','addMessage','MailMessage','ids','omit','getMessages','findOne','keys','fields','order','sort','where','pick','filter','$gte','format','YYYY-MM-DD\x20HH:mm:ss','findAll','rows','addTags','Tag','color','emit','mailInteractionTags:save','removeTags','download','unix','toString','root','server','files','tmp','join','transcript-%d-%s.zip','push','createdAt','Messages','get','mkdirSync','each','from','missing.recipient@your.company.com','decode'];(function(_0xf79bae,_0x263b2a){var _0x5d2cb7=function(_0x27c86b){while(--_0x27c86b){_0xf79bae['push'](_0xf79bae['shift']());}};_0x5d2cb7(++_0x263b2a);}(_0xf4d2,0x78));var _0x2f4d=function(_0xbb25f,_0x4d988b){_0xbb25f=_0xbb25f-0x0;var _0xf9e79c=_0xf4d2[_0xbb25f];return _0xf9e79c;};'use strict';var emlformat=require(_0x2f4d('0x0'));var rimraf=require(_0x2f4d('0x1'));var zipdir=require('zip-dir');var moment=require(_0x2f4d('0x2'));var BPromise=require(_0x2f4d('0x3'));var util=require(_0x2f4d('0x4'));var path=require('path');var fs=require('fs');var _=require('lodash');var juice=require(_0x2f4d('0x5'));var Redis=require(_0x2f4d('0x6'));var interaction=require(_0x2f4d('0x7'));var qs=require(_0x2f4d('0x8'));var logger=require('../../config/logger')(_0x2f4d('0x9'));var config=require(_0x2f4d('0xa'));var db=require('../../mysqldb')['db'];var htmlEntities=require(_0x2f4d('0xb'));config['redis']=_[_0x2f4d('0xc')](config[_0x2f4d('0xd')],{'host':_0x2f4d('0xe'),'port':0x18eb});var socket=require(_0x2f4d('0xf'))(new Redis(config[_0x2f4d('0xd')]));require(_0x2f4d('0x10'))[_0x2f4d('0x11')](socket);function respondWithStatusCode(_0x49878e,_0x55b845){_0x55b845=_0x55b845||0xcc;return function(_0x319c7){if(_0x319c7){return _0x49878e[_0x2f4d('0x12')](_0x55b845);}return _0x49878e[_0x2f4d('0x13')](_0x55b845)[_0x2f4d('0x14')]();};}function respondWithResult(_0x57cf0d,_0x4ded13){_0x4ded13=_0x4ded13||0xc8;return function(_0x5ea910){if(_0x5ea910){return _0x57cf0d['status'](_0x4ded13)[_0x2f4d('0x15')](_0x5ea910);}};}function respondWithFilteredResult(_0x3b560d,_0x46737e){return function(_0x1b4b7f){if(_0x1b4b7f){var _0x2385ef=typeof _0x46737e[_0x2f4d('0x16')]===_0x2f4d('0x17')&&typeof _0x46737e['limit']===_0x2f4d('0x17');var _0x53d1f5=_0x1b4b7f['count'];var _0xc75384=_0x2385ef?0x0:_0x46737e['offset'];var _0xa02a7=_0x2385ef?_0x1b4b7f[_0x2f4d('0x18')]:_0x46737e[_0x2f4d('0x16')]+_0x46737e[_0x2f4d('0x19')];var _0x360ba7;if(_0xa02a7>=_0x53d1f5){_0xa02a7=_0x53d1f5;_0x360ba7=0xc8;}else{_0x360ba7=0xce;}_0x3b560d[_0x2f4d('0x13')](_0x360ba7);return _0x3b560d[_0x2f4d('0x1a')](_0x2f4d('0x1b'),_0xc75384+'-'+_0xa02a7+'/'+_0x53d1f5)['json'](_0x1b4b7f);}return null;};}function saveUpdates(_0x768713){return function(_0x3336f8){if(_0x3336f8){return _0x3336f8[_0x2f4d('0x1c')](_0x768713)[_0x2f4d('0x1d')](function(_0x529b16){return _0x529b16;});}return null;};}function removeEntity(_0x10a18c){return function(_0x537afe){if(_0x537afe){return _0x537afe[_0x2f4d('0x1e')]()['then'](function(){_0x10a18c['status'](0xcc)[_0x2f4d('0x14')]();});}};}function handleEntityNotFound(_0x4f5ab5){return function(_0x385841){if(!_0x385841){_0x4f5ab5['sendStatus'](0x194);}return _0x385841;};}function handleError(_0x622d00,_0x35e4cf){_0x35e4cf=_0x35e4cf||0x1f4;return function(_0x3178bd){logger['error'](_0x3178bd[_0x2f4d('0x1f')]);if(_0x3178bd[_0x2f4d('0x20')]){delete _0x3178bd[_0x2f4d('0x20')];}_0x622d00[_0x2f4d('0x13')](_0x35e4cf)[_0x2f4d('0x21')](_0x3178bd);};}exports[_0x2f4d('0x22')]=function(_0x52cab2,_0x319f93){var _0x1b4b44={};var _0x143a48=_[_0x2f4d('0x23')](db[_0x2f4d('0x24')][_0x2f4d('0x25')],function(_0x5f1ccc){return{'name':_0x5f1ccc['fieldName'],'type':_0x5f1ccc['type']['key']};});_0x1b4b44=qs[_0x2f4d('0x26')](_0x143a48,_0x52cab2);return interaction['findAll'](_0x2f4d('0x27'),_0x52cab2[_0x2f4d('0x28')],_0x52cab2[_0x2f4d('0x29')],_0x1b4b44,_0x143a48)[_0x2f4d('0x1d')](respondWithFilteredResult(_0x319f93,_0x1b4b44))[_0x2f4d('0x2a')](handleError(_0x319f93,null));};exports[_0x2f4d('0x2b')]=function(_0x22c594,_0x579c8f){var _0xe374be={'raw':![],'where':{'id':_0x22c594[_0x2f4d('0x2c')]['id']}},_0x12d3a2={};_0x12d3a2[_0x2f4d('0x2d')]=_['keys'](db[_0x2f4d('0x24')][_0x2f4d('0x25')]);_0x12d3a2['query']=_['keys'](_0x22c594[_0x2f4d('0x28')]);_0x12d3a2[_0x2f4d('0x2e')]=_['intersection'](_0x12d3a2[_0x2f4d('0x2d')],_0x12d3a2['query']);_0xe374be[_0x2f4d('0x2f')]=_[_0x2f4d('0x30')](_0x12d3a2['model'],qs['fields'](_0x22c594[_0x2f4d('0x28')]['fields']));_0xe374be['attributes']=_0xe374be[_0x2f4d('0x2f')][_0x2f4d('0x31')]?_0xe374be[_0x2f4d('0x2f')]:_0x12d3a2[_0x2f4d('0x2d')];if(_0x22c594[_0x2f4d('0x28')][_0x2f4d('0x32')]){_0xe374be[_0x2f4d('0x33')]=[{'all':!![]}];}_0xe374be=_[_0x2f4d('0x34')]({},_0xe374be,_0x22c594[_0x2f4d('0x35')]);return db[_0x2f4d('0x24')][_0x2f4d('0x36')](_0xe374be)[_0x2f4d('0x1d')](handleEntityNotFound(_0x579c8f,null))[_0x2f4d('0x1d')](respondWithResult(_0x579c8f,null))[_0x2f4d('0x2a')](handleError(_0x579c8f,null));};exports[_0x2f4d('0x37')]=function(_0x396202,_0x3dedc9){return db[_0x2f4d('0x24')]['create'](_0x396202['body'],{})[_0x2f4d('0x1d')](respondWithResult(_0x3dedc9,0xc9))[_0x2f4d('0x2a')](handleError(_0x3dedc9,null));};exports['update']=function(_0x24ead2,_0x38993c){if(_0x24ead2[_0x2f4d('0x38')]['id']){delete _0x24ead2[_0x2f4d('0x38')]['id'];}return db[_0x2f4d('0x24')][_0x2f4d('0x36')]({'where':{'id':_0x24ead2[_0x2f4d('0x2c')]['id']}})[_0x2f4d('0x1d')](handleEntityNotFound(_0x38993c,null))['then'](saveUpdates(_0x24ead2['body'],null))[_0x2f4d('0x1d')](respondWithResult(_0x38993c,null))['catch'](handleError(_0x38993c,null));};exports[_0x2f4d('0x1e')]=function(_0x22d515,_0x536a60){return db[_0x2f4d('0x24')][_0x2f4d('0x36')]({'where':{'id':_0x22d515[_0x2f4d('0x2c')]['id']}})[_0x2f4d('0x1d')](handleEntityNotFound(_0x536a60,null))[_0x2f4d('0x1d')](removeEntity(_0x536a60,null))['catch'](handleError(_0x536a60,null));};exports[_0x2f4d('0x39')]=function(_0x18bc99,_0x4220f9){return db[_0x2f4d('0x24')][_0x2f4d('0x39')]()[_0x2f4d('0x1d')](respondWithResult(_0x4220f9,null))[_0x2f4d('0x2a')](handleError(_0x4220f9,null));};exports[_0x2f4d('0x3a')]=function(_0x5aab2c,_0x5214a7){return db[_0x2f4d('0x3b')]['find']({'where':{'id':_0x5aab2c[_0x2f4d('0x2c')]['id']}})[_0x2f4d('0x1d')](handleEntityNotFound(_0x5214a7,null))['then'](function(_0x32524b){if(_0x32524b){return _0x32524b['addMessage'](_0x5aab2c[_0x2f4d('0x38')][_0x2f4d('0x3c')],_[_0x2f4d('0x3d')](_0x5aab2c[_0x2f4d('0x38')],['ids','id'])||{});}})[_0x2f4d('0x1d')](respondWithResult(_0x5214a7,null))['catch'](handleError(_0x5214a7,null));};exports[_0x2f4d('0x3e')]=function(_0x9a8eed,_0x5924d1){var _0xd3ca4d={'raw':![],'where':{}};var _0x387c96={};var _0x5a2c5c={'count':0x0,'rows':[]};return db[_0x2f4d('0x24')][_0x2f4d('0x3f')]({'where':{'id':_0x9a8eed[_0x2f4d('0x2c')]['id']}})['then'](handleEntityNotFound(_0x5924d1,null))[_0x2f4d('0x1d')](function(_0x193678){if(_0x193678){_0x387c96[_0x2f4d('0x2d')]=_['keys'](db[_0x2f4d('0x3b')]['rawAttributes']);_0x387c96[_0x2f4d('0x28')]=_[_0x2f4d('0x40')](_0x9a8eed[_0x2f4d('0x28')]);_0x387c96['filters']=_[_0x2f4d('0x30')](_0x387c96[_0x2f4d('0x2d')],_0x387c96[_0x2f4d('0x28')]);_0xd3ca4d[_0x2f4d('0x2f')]=_[_0x2f4d('0x30')](_0x387c96['model'],qs[_0x2f4d('0x41')](_0x9a8eed[_0x2f4d('0x28')][_0x2f4d('0x41')]));_0xd3ca4d[_0x2f4d('0x2f')]=_0xd3ca4d[_0x2f4d('0x2f')][_0x2f4d('0x31')]?_0xd3ca4d[_0x2f4d('0x2f')]:_0x387c96['model'];if(!_0x9a8eed[_0x2f4d('0x28')]['hasOwnProperty']('nolimit')){_0xd3ca4d[_0x2f4d('0x19')]=qs[_0x2f4d('0x19')](_0x9a8eed['query'][_0x2f4d('0x19')]);_0xd3ca4d[_0x2f4d('0x16')]=qs[_0x2f4d('0x16')](_0x9a8eed[_0x2f4d('0x28')][_0x2f4d('0x16')]);}_0xd3ca4d[_0x2f4d('0x42')]=qs[_0x2f4d('0x43')](_0x9a8eed['query'][_0x2f4d('0x43')]);_0xd3ca4d[_0x2f4d('0x44')]=qs[_0x2f4d('0x2e')](_[_0x2f4d('0x45')](_0x9a8eed[_0x2f4d('0x28')],_0x387c96['filters']));_0xd3ca4d[_0x2f4d('0x44')]['MailInteractionId']=_0x193678['id'];if(_0x9a8eed[_0x2f4d('0x28')][_0x2f4d('0x46')]){_0xd3ca4d[_0x2f4d('0x44')]=_[_0x2f4d('0x34')](_0xd3ca4d[_0x2f4d('0x44')],{'$or':_[_0x2f4d('0x23')](_0xd3ca4d['attributes'],function(_0x3e8a97){var _0x5c709c={};_0x5c709c[_0x3e8a97]={'$like':'%'+_0x9a8eed[_0x2f4d('0x28')][_0x2f4d('0x46')]+'%'};return _0x5c709c;})});}if(_0x9a8eed[_0x2f4d('0x28')][_0x2f4d('0x47')]){var _0x20f1d2=_0x9a8eed[_0x2f4d('0x28')][_0x2f4d('0x47')]['split'](',');var _0xc98817={};_0xc98817[_0x20f1d2[0x0]]={'$gte':moment(_0x20f1d2[0x1])[_0x2f4d('0x48')](_0x2f4d('0x49'))};_0xd3ca4d[_0x2f4d('0x44')]=_[_0x2f4d('0x34')](_0xd3ca4d['where'],_0xc98817);}_0xd3ca4d=_['merge']({},_0xd3ca4d,_0x9a8eed[_0x2f4d('0x35')]);return db[_0x2f4d('0x3b')][_0x2f4d('0x18')]({'where':_0xd3ca4d['where']})[_0x2f4d('0x1d')](function(_0x32175f){_0x5a2c5c[_0x2f4d('0x18')]=_0x32175f;if(_0x9a8eed['query'][_0x2f4d('0x32')]){_0xd3ca4d[_0x2f4d('0x33')]=[{'all':!![]}];}return db[_0x2f4d('0x3b')][_0x2f4d('0x4a')](_0xd3ca4d);})[_0x2f4d('0x1d')](function(_0x18fd65){if(_0x9a8eed[_0x2f4d('0x28')]['inlineCss']==='true'){for(var _0x59ef81=0x0;_0x59ef81<_0x18fd65[_0x2f4d('0x31')];_0x59ef81++){_0x18fd65[_0x59ef81]['body']=juice(_0x18fd65[_0x59ef81][_0x2f4d('0x38')]);}}_0x5a2c5c[_0x2f4d('0x4b')]=_0x18fd65;return _0x5a2c5c;});}})[_0x2f4d('0x1d')](respondWithFilteredResult(_0x5924d1,_0xd3ca4d))[_0x2f4d('0x2a')](handleError(_0x5924d1,null));};exports[_0x2f4d('0x4c')]=function(_0x287a38,_0x1d7136){return db['MailInteraction']['find']({'where':{'id':_0x287a38[_0x2f4d('0x2c')]['id']}})[_0x2f4d('0x1d')](handleEntityNotFound(_0x1d7136,null))[_0x2f4d('0x1d')](function(_0x1475b6){if(_0x1475b6){return _0x1475b6['setTags'](_0x287a38[_0x2f4d('0x38')]['ids'],_[_0x2f4d('0x3d')](_0x287a38['body'],[_0x2f4d('0x3c'),'id'])||{})['spread'](function(){return db[_0x2f4d('0x4d')][_0x2f4d('0x4a')]({'attributes':['id',_0x2f4d('0x20'),_0x2f4d('0x4e')],'where':{'id':_0x287a38[_0x2f4d('0x38')][_0x2f4d('0x3c')]}});})[_0x2f4d('0x1d')](function(_0x5bec21){socket[_0x2f4d('0x4f')](_0x2f4d('0x50'),{'id':Number(_0x287a38['params']['id']),'tags':_0x5bec21||[]});return{'id':Number(_0x287a38[_0x2f4d('0x2c')]['id']),'tags':_0x5bec21||[]};});}})[_0x2f4d('0x1d')](respondWithResult(_0x1d7136,null))[_0x2f4d('0x2a')](handleError(_0x1d7136,null));};exports['removeTags']=function(_0x398102,_0x18d188){return db[_0x2f4d('0x24')]['find']({'where':{'id':_0x398102[_0x2f4d('0x2c')]['id']}})[_0x2f4d('0x1d')](handleEntityNotFound(_0x18d188,null))['then'](function(_0xc0ebc3){if(_0xc0ebc3){return _0xc0ebc3[_0x2f4d('0x51')](_0x398102[_0x2f4d('0x28')][_0x2f4d('0x3c')]);}})[_0x2f4d('0x1d')](respondWithStatusCode(_0x18d188,null))['catch'](handleError(_0x18d188,null));};exports[_0x2f4d('0x52')]=function(_0x4b6824,_0x52d7bb){var _0x158cc8=moment()[_0x2f4d('0x53')]()[_0x2f4d('0x54')]();var _0xd30d21=path['join'](config[_0x2f4d('0x55')],_0x2f4d('0x56'),_0x2f4d('0x57'),_0x2f4d('0x58'));var _0x598ce3=path[_0x2f4d('0x59')](config[_0x2f4d('0x55')],_0x2f4d('0x56'),_0x2f4d('0x57'),'attachments');var _0x3c3e30=path[_0x2f4d('0x59')](_0xd30d21,_0x158cc8);var _0x4be56b=util[_0x2f4d('0x48')](_0x2f4d('0x5a'),_0x4b6824[_0x2f4d('0x2c')]['id'],_0x158cc8);var _0x3ad5aa=path[_0x2f4d('0x59')](_0xd30d21,_0x4be56b);var _0x5e92f3=[];if(_0x4b6824[_0x2f4d('0x28')]['attachments']){_0x5e92f3[_0x2f4d('0x5b')]({'model':db['Attachment'],'as':'Attachments','raw':!![]});}var _0xdde44a=[{'model':db[_0x2f4d('0x3b')],'as':'Messages','attributes':['id',_0x2f4d('0x38'),'from','to','cc','bcc','subject',_0x2f4d('0x5c')],'where':{'secret':![]},'order':qs[_0x2f4d('0x43')]('id'),'include':_0x5e92f3}];return db[_0x2f4d('0x24')]['find']({'where':{'id':_0x4b6824[_0x2f4d('0x2c')]['id']},'include':_0xdde44a})[_0x2f4d('0x1d')](handleEntityNotFound(_0x52d7bb,null))[_0x2f4d('0x1d')](function(_0x57f9ac){if(_0x57f9ac&&_0x57f9ac[_0x2f4d('0x5d')]){var _0x31c2c1=_0x57f9ac[_0x2f4d('0x5e')]({'plain':!![]});fs[_0x2f4d('0x5f')](_0x3c3e30);return BPromise[_0x2f4d('0x60')](_0x31c2c1[_0x2f4d('0x5d')],function(_0x5f47c2,_0xdd069e){var _0x602403={'from':_0x5f47c2[_0x2f4d('0x61')],'to':_0x5f47c2['to']||_0x2f4d('0x62'),'subject':_0x5f47c2['subject'],'html':htmlEntities[_0x2f4d('0x63')](_0x5f47c2[_0x2f4d('0x38')]),'headers':{'Date':moment(_0x5f47c2['createdAt'])[_0x2f4d('0x48')]('ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ')},'attachments':[]};if(_0x5f47c2['cc']){_0x602403['headers']['Cc']=_0x5f47c2['cc'];}if(_0x5f47c2[_0x2f4d('0x64')]){_0x602403[_0x2f4d('0x65')][_0x2f4d('0x66')]=_0x5f47c2[_0x2f4d('0x64')];}return new BPromise(function(_0x360b61,_0x7b39eb){if(_0x5f47c2[_0x2f4d('0x67')]){for(var _0x14821a=0x0;_0x14821a<_0x5f47c2['Attachments'][_0x2f4d('0x31')];_0x14821a++){var _0x77a824=_0x5f47c2[_0x2f4d('0x67')][_0x14821a];var _0x339c13=path[_0x2f4d('0x59')](_0x598ce3,_0x77a824[_0x2f4d('0x68')]);if(fs['existsSync'](_0x339c13)){_0x602403['attachments'][_0x2f4d('0x5b')]({'name':_0x77a824[_0x2f4d('0x20')],'contentType':_0x77a824[_0x2f4d('0x69')],'data':fs['readFileSync'](_0x339c13)});}}}emlformat[_0x2f4d('0x6a')](_0x602403,function(_0xe3b79a,_0x13dced){if(_0xe3b79a)return _0x7b39eb(_0xe3b79a);fs[_0x2f4d('0x6b')](path[_0x2f4d('0x59')](_0x3c3e30,util[_0x2f4d('0x48')](_0x2f4d('0x6c'),_0xdd069e)),_0x13dced);return _0x360b61(_0x13dced);});});})[_0x2f4d('0x1d')](function(){return new BPromise(function(_0xedd213,_0xad7b29){zipdir(_0x3c3e30,{'saveTo':_0x3ad5aa},function(_0x400e3e,_0x173141){if(_0x400e3e)return _0xad7b29(_0x400e3e);return _0xedd213(_0x173141);});})[_0x2f4d('0x1d')](function(){return new BPromise(function(_0x29bd40,_0xb1848){rimraf(_0x3c3e30,function(_0x578d52){if(_0x578d52)_0xb1848(_0x578d52);return _0x29bd40();});});})['then'](function(){return _0x52d7bb[_0x2f4d('0x52')](_0x3ad5aa,_0x4be56b,function(_0x4ec167){if(!_0x4ec167)fs[_0x2f4d('0x6d')](_0x3ad5aa);});});});}else{return _0x52d7bb[_0x2f4d('0x12')](0xc8);}})[_0x2f4d('0x2a')](handleError(_0x52d7bb,null));}; \ No newline at end of file +var _0xfbcd=['catch','show','keys','MailInteraction','query','filters','intersection','fields','attributes','length','model','includeAll','include','merge','find','create','body','params','describe','addMessage','MailMessage','ids','omit','findOne','hasOwnProperty','nolimit','order','sort','where','pick','MailInteractionId','filter','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','options','true','rows','addTags','setTags','Tag','mailInteractionTags:save','removeTags','download','unix','root','files','tmp','server','attachments','join','transcript-%d-%s.zip','push','Attachment','Attachments','from','Messages','get','missing.recipient@your.company.com','subject','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Bcc','bcc','basename','existsSync','writeFileSync','message%d.eml','unlinkSync','eml-format','zip-dir','util','path','lodash','ioredis','../../components/interaction/service','../../config/environment','html-entities','redis','localhost','./mailInteraction.socket','register','sendStatus','end','status','json','limit','count','offset','set','Content-Range','update','then','destroy','error','name','send','map','rawAttributes','fieldName','type','key','getOptions','findAll','mail','user'];(function(_0xb3275c,_0x2623c3){var _0x58e50b=function(_0x2303a3){while(--_0x2303a3){_0xb3275c['push'](_0xb3275c['shift']());}};_0x58e50b(++_0x2623c3);}(_0xfbcd,0x11c));var _0xdfbc=function(_0x597775,_0x12141b){_0x597775=_0x597775-0x0;var _0xd92b5=_0xfbcd[_0x597775];return _0xd92b5;};'use strict';var emlformat=require(_0xdfbc('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xdfbc('0x1'));var moment=require('moment');var BPromise=require('bluebird');var util=require(_0xdfbc('0x2'));var path=require(_0xdfbc('0x3'));var fs=require('fs');var _=require(_0xdfbc('0x4'));var juice=require('juice');var Redis=require(_0xdfbc('0x5'));var interaction=require(_0xdfbc('0x6'));var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')('api');var config=require(_0xdfbc('0x7'));var db=require('../../mysqldb')['db'];var htmlEntities=require(_0xdfbc('0x8'));config['redis']=_['defaults'](config[_0xdfbc('0x9')],{'host':_0xdfbc('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xdfbc('0xb'))[_0xdfbc('0xc')](socket);function respondWithStatusCode(_0x19f556,_0x16ab42){_0x16ab42=_0x16ab42||0xcc;return function(_0xed3b8d){if(_0xed3b8d){return _0x19f556[_0xdfbc('0xd')](_0x16ab42);}return _0x19f556['status'](_0x16ab42)[_0xdfbc('0xe')]();};}function respondWithResult(_0x831b02,_0x49e570){_0x49e570=_0x49e570||0xc8;return function(_0x267dec){if(_0x267dec){return _0x831b02[_0xdfbc('0xf')](_0x49e570)[_0xdfbc('0x10')](_0x267dec);}};}function respondWithFilteredResult(_0x38e15d,_0x14cca5){return function(_0x4f7360){if(_0x4f7360){var _0x2c00e1=typeof _0x14cca5['offset']==='undefined'&&typeof _0x14cca5[_0xdfbc('0x11')]==='undefined';var _0xa07cf5=_0x4f7360[_0xdfbc('0x12')];var _0x4dbacf=_0x2c00e1?0x0:_0x14cca5[_0xdfbc('0x13')];var _0xdeaf46=_0x2c00e1?_0x4f7360[_0xdfbc('0x12')]:_0x14cca5[_0xdfbc('0x13')]+_0x14cca5['limit'];var _0x266797;if(_0xdeaf46>=_0xa07cf5){_0xdeaf46=_0xa07cf5;_0x266797=0xc8;}else{_0x266797=0xce;}_0x38e15d[_0xdfbc('0xf')](_0x266797);return _0x38e15d[_0xdfbc('0x14')](_0xdfbc('0x15'),_0x4dbacf+'-'+_0xdeaf46+'/'+_0xa07cf5)['json'](_0x4f7360);}return null;};}function saveUpdates(_0x25951f){return function(_0x1c604f){if(_0x1c604f){return _0x1c604f[_0xdfbc('0x16')](_0x25951f)[_0xdfbc('0x17')](function(_0x26ca6a){return _0x26ca6a;});}return null;};}function removeEntity(_0x15640e){return function(_0x632b47){if(_0x632b47){return _0x632b47[_0xdfbc('0x18')]()[_0xdfbc('0x17')](function(){_0x15640e[_0xdfbc('0xf')](0xcc)[_0xdfbc('0xe')]();});}};}function handleEntityNotFound(_0x7f2690){return function(_0x456e75){if(!_0x456e75){_0x7f2690[_0xdfbc('0xd')](0x194);}return _0x456e75;};}function handleError(_0x5c92be,_0x583c5e){_0x583c5e=_0x583c5e||0x1f4;return function(_0x41adc2){logger[_0xdfbc('0x19')](_0x41adc2['stack']);if(_0x41adc2[_0xdfbc('0x1a')]){delete _0x41adc2[_0xdfbc('0x1a')];}_0x5c92be['status'](_0x583c5e)[_0xdfbc('0x1b')](_0x41adc2);};}exports['index']=function(_0x44ec03,_0x56fa3a){var _0x26f986={};var _0x50c051=_[_0xdfbc('0x1c')](db['MailInteraction'][_0xdfbc('0x1d')],function(_0x399851){return{'name':_0x399851[_0xdfbc('0x1e')],'type':_0x399851[_0xdfbc('0x1f')][_0xdfbc('0x20')]};});_0x26f986=qs[_0xdfbc('0x21')](_0x50c051,_0x44ec03);return interaction[_0xdfbc('0x22')](_0xdfbc('0x23'),_0x44ec03['query'],_0x44ec03[_0xdfbc('0x24')],_0x26f986,_0x50c051)[_0xdfbc('0x17')](respondWithFilteredResult(_0x56fa3a,_0x26f986))[_0xdfbc('0x25')](handleError(_0x56fa3a,null));};exports[_0xdfbc('0x26')]=function(_0x3bebe2,_0x4e4ec9){var _0x5b57d2={'raw':![],'where':{'id':_0x3bebe2['params']['id']}},_0x395c40={};_0x395c40['model']=_[_0xdfbc('0x27')](db[_0xdfbc('0x28')][_0xdfbc('0x1d')]);_0x395c40['query']=_[_0xdfbc('0x27')](_0x3bebe2[_0xdfbc('0x29')]);_0x395c40[_0xdfbc('0x2a')]=_['intersection'](_0x395c40['model'],_0x395c40[_0xdfbc('0x29')]);_0x5b57d2['attributes']=_[_0xdfbc('0x2b')](_0x395c40['model'],qs[_0xdfbc('0x2c')](_0x3bebe2[_0xdfbc('0x29')][_0xdfbc('0x2c')]));_0x5b57d2['attributes']=_0x5b57d2[_0xdfbc('0x2d')][_0xdfbc('0x2e')]?_0x5b57d2[_0xdfbc('0x2d')]:_0x395c40[_0xdfbc('0x2f')];if(_0x3bebe2['query'][_0xdfbc('0x30')]){_0x5b57d2[_0xdfbc('0x31')]=[{'all':!![]}];}_0x5b57d2=_[_0xdfbc('0x32')]({},_0x5b57d2,_0x3bebe2['options']);return db[_0xdfbc('0x28')][_0xdfbc('0x33')](_0x5b57d2)['then'](handleEntityNotFound(_0x4e4ec9,null))[_0xdfbc('0x17')](respondWithResult(_0x4e4ec9,null))[_0xdfbc('0x25')](handleError(_0x4e4ec9,null));};exports[_0xdfbc('0x34')]=function(_0x5e9d5f,_0x2bd094){return db[_0xdfbc('0x28')][_0xdfbc('0x34')](_0x5e9d5f['body'],{})[_0xdfbc('0x17')](respondWithResult(_0x2bd094,0xc9))[_0xdfbc('0x25')](handleError(_0x2bd094,null));};exports[_0xdfbc('0x16')]=function(_0x21fc92,_0x4de379){if(_0x21fc92[_0xdfbc('0x35')]['id']){delete _0x21fc92[_0xdfbc('0x35')]['id'];}return db[_0xdfbc('0x28')][_0xdfbc('0x33')]({'where':{'id':_0x21fc92[_0xdfbc('0x36')]['id']}})['then'](handleEntityNotFound(_0x4de379,null))['then'](saveUpdates(_0x21fc92['body'],null))[_0xdfbc('0x17')](respondWithResult(_0x4de379,null))['catch'](handleError(_0x4de379,null));};exports[_0xdfbc('0x18')]=function(_0x5da9a2,_0x3867f8){return db[_0xdfbc('0x28')][_0xdfbc('0x33')]({'where':{'id':_0x5da9a2[_0xdfbc('0x36')]['id']}})[_0xdfbc('0x17')](handleEntityNotFound(_0x3867f8,null))[_0xdfbc('0x17')](removeEntity(_0x3867f8,null))[_0xdfbc('0x25')](handleError(_0x3867f8,null));};exports[_0xdfbc('0x37')]=function(_0xec601c,_0x521386){return db['MailInteraction'][_0xdfbc('0x37')]()[_0xdfbc('0x17')](respondWithResult(_0x521386,null))[_0xdfbc('0x25')](handleError(_0x521386,null));};exports[_0xdfbc('0x38')]=function(_0x194dc4,_0xa8bc3d){return db[_0xdfbc('0x39')][_0xdfbc('0x33')]({'where':{'id':_0x194dc4['params']['id']}})['then'](handleEntityNotFound(_0xa8bc3d,null))['then'](function(_0xb3e7c0){if(_0xb3e7c0){return _0xb3e7c0['addMessage'](_0x194dc4[_0xdfbc('0x35')][_0xdfbc('0x3a')],_[_0xdfbc('0x3b')](_0x194dc4['body'],[_0xdfbc('0x3a'),'id'])||{});}})['then'](respondWithResult(_0xa8bc3d,null))['catch'](handleError(_0xa8bc3d,null));};exports['getMessages']=function(_0x332e87,_0x3190e7){var _0x367aa5={'raw':![],'where':{}};var _0x3f7c38={};var _0x192a20={'count':0x0,'rows':[]};return db[_0xdfbc('0x28')][_0xdfbc('0x3c')]({'where':{'id':_0x332e87[_0xdfbc('0x36')]['id']}})[_0xdfbc('0x17')](handleEntityNotFound(_0x3190e7,null))[_0xdfbc('0x17')](function(_0x275ea7){if(_0x275ea7){_0x3f7c38[_0xdfbc('0x2f')]=_[_0xdfbc('0x27')](db['MailMessage']['rawAttributes']);_0x3f7c38[_0xdfbc('0x29')]=_[_0xdfbc('0x27')](_0x332e87[_0xdfbc('0x29')]);_0x3f7c38[_0xdfbc('0x2a')]=_[_0xdfbc('0x2b')](_0x3f7c38[_0xdfbc('0x2f')],_0x3f7c38[_0xdfbc('0x29')]);_0x367aa5[_0xdfbc('0x2d')]=_[_0xdfbc('0x2b')](_0x3f7c38[_0xdfbc('0x2f')],qs[_0xdfbc('0x2c')](_0x332e87[_0xdfbc('0x29')][_0xdfbc('0x2c')]));_0x367aa5[_0xdfbc('0x2d')]=_0x367aa5[_0xdfbc('0x2d')]['length']?_0x367aa5[_0xdfbc('0x2d')]:_0x3f7c38[_0xdfbc('0x2f')];if(!_0x332e87['query'][_0xdfbc('0x3d')](_0xdfbc('0x3e'))){_0x367aa5[_0xdfbc('0x11')]=qs[_0xdfbc('0x11')](_0x332e87['query']['limit']);_0x367aa5[_0xdfbc('0x13')]=qs[_0xdfbc('0x13')](_0x332e87[_0xdfbc('0x29')][_0xdfbc('0x13')]);}_0x367aa5[_0xdfbc('0x3f')]=qs[_0xdfbc('0x40')](_0x332e87[_0xdfbc('0x29')][_0xdfbc('0x40')]);_0x367aa5[_0xdfbc('0x41')]=qs['filters'](_[_0xdfbc('0x42')](_0x332e87[_0xdfbc('0x29')],_0x3f7c38[_0xdfbc('0x2a')]));_0x367aa5[_0xdfbc('0x41')][_0xdfbc('0x43')]=_0x275ea7['id'];if(_0x332e87[_0xdfbc('0x29')][_0xdfbc('0x44')]){_0x367aa5['where']=_[_0xdfbc('0x32')](_0x367aa5[_0xdfbc('0x41')],{'$or':_[_0xdfbc('0x1c')](_0x367aa5[_0xdfbc('0x2d')],function(_0x5cecb8){var _0x25cfec={};_0x25cfec[_0x5cecb8]={'$like':'%'+_0x332e87[_0xdfbc('0x29')][_0xdfbc('0x44')]+'%'};return _0x25cfec;})});}if(_0x332e87['query'][_0xdfbc('0x45')]){var _0x13aeb3=_0x332e87[_0xdfbc('0x29')][_0xdfbc('0x45')][_0xdfbc('0x46')](',');var _0x4e3690={};_0x4e3690[_0x13aeb3[0x0]]={'$gte':moment(_0x13aeb3[0x1])[_0xdfbc('0x47')](_0xdfbc('0x48'))};_0x367aa5['where']=_[_0xdfbc('0x32')](_0x367aa5['where'],_0x4e3690);}_0x367aa5=_[_0xdfbc('0x32')]({},_0x367aa5,_0x332e87[_0xdfbc('0x49')]);return db[_0xdfbc('0x39')][_0xdfbc('0x12')]({'where':_0x367aa5[_0xdfbc('0x41')]})[_0xdfbc('0x17')](function(_0x44b569){_0x192a20['count']=_0x44b569;if(_0x332e87['query'][_0xdfbc('0x30')]){_0x367aa5[_0xdfbc('0x31')]=[{'all':!![]}];}return db[_0xdfbc('0x39')]['findAll'](_0x367aa5);})['then'](function(_0x4b2e31){if(_0x332e87[_0xdfbc('0x29')]['inlineCss']===_0xdfbc('0x4a')){for(var _0x554b53=0x0;_0x554b53<_0x4b2e31[_0xdfbc('0x2e')];_0x554b53++){_0x4b2e31[_0x554b53][_0xdfbc('0x35')]=juice(_0x4b2e31[_0x554b53][_0xdfbc('0x35')]);}}_0x192a20[_0xdfbc('0x4b')]=_0x4b2e31;return _0x192a20;});}})[_0xdfbc('0x17')](respondWithFilteredResult(_0x3190e7,_0x367aa5))[_0xdfbc('0x25')](handleError(_0x3190e7,null));};exports[_0xdfbc('0x4c')]=function(_0x30700c,_0x24a55d){return db[_0xdfbc('0x28')][_0xdfbc('0x33')]({'where':{'id':_0x30700c[_0xdfbc('0x36')]['id']}})[_0xdfbc('0x17')](handleEntityNotFound(_0x24a55d,null))[_0xdfbc('0x17')](function(_0x49146c){if(_0x49146c){return _0x49146c[_0xdfbc('0x4d')](_0x30700c['body'][_0xdfbc('0x3a')],_[_0xdfbc('0x3b')](_0x30700c[_0xdfbc('0x35')],[_0xdfbc('0x3a'),'id'])||{})['spread'](function(){return db[_0xdfbc('0x4e')]['findAll']({'attributes':['id',_0xdfbc('0x1a'),'color'],'where':{'id':_0x30700c[_0xdfbc('0x35')][_0xdfbc('0x3a')]}});})[_0xdfbc('0x17')](function(_0x2b096f){socket['emit'](_0xdfbc('0x4f'),{'id':Number(_0x30700c[_0xdfbc('0x36')]['id']),'tags':_0x2b096f||[]});return{'id':Number(_0x30700c[_0xdfbc('0x36')]['id']),'tags':_0x2b096f||[]};});}})['then'](respondWithResult(_0x24a55d,null))[_0xdfbc('0x25')](handleError(_0x24a55d,null));};exports[_0xdfbc('0x50')]=function(_0x8819b4,_0x46ca46){return db[_0xdfbc('0x28')]['find']({'where':{'id':_0x8819b4['params']['id']}})[_0xdfbc('0x17')](handleEntityNotFound(_0x46ca46,null))[_0xdfbc('0x17')](function(_0x2141d6){if(_0x2141d6){return _0x2141d6[_0xdfbc('0x50')](_0x8819b4['query']['ids']);}})[_0xdfbc('0x17')](respondWithStatusCode(_0x46ca46,null))[_0xdfbc('0x25')](handleError(_0x46ca46,null));};exports[_0xdfbc('0x51')]=function(_0x3053a7,_0x20117b){var _0x313746=moment()[_0xdfbc('0x52')]()['toString']();var _0x566fb5=path['join'](config[_0xdfbc('0x53')],'server',_0xdfbc('0x54'),_0xdfbc('0x55'));var _0x8e48e2=path['join'](config[_0xdfbc('0x53')],_0xdfbc('0x56'),_0xdfbc('0x54'),_0xdfbc('0x57'));var _0x5b643b=path[_0xdfbc('0x58')](_0x566fb5,_0x313746);var _0x9d7677=util[_0xdfbc('0x47')](_0xdfbc('0x59'),_0x3053a7[_0xdfbc('0x36')]['id'],_0x313746);var _0x633d1a=path[_0xdfbc('0x58')](_0x566fb5,_0x9d7677);var _0x351fc7=[];if(_0x3053a7[_0xdfbc('0x29')][_0xdfbc('0x57')]){_0x351fc7[_0xdfbc('0x5a')]({'model':db[_0xdfbc('0x5b')],'as':_0xdfbc('0x5c'),'raw':!![]});}var _0x12a9e0=[{'model':db[_0xdfbc('0x39')],'as':'Messages','attributes':['id',_0xdfbc('0x35'),_0xdfbc('0x5d'),'to','cc','bcc','subject','createdAt'],'where':{'secret':![]},'order':qs[_0xdfbc('0x40')]('id'),'include':_0x351fc7}];return db[_0xdfbc('0x28')]['find']({'where':{'id':_0x3053a7[_0xdfbc('0x36')]['id']},'include':_0x12a9e0})[_0xdfbc('0x17')](handleEntityNotFound(_0x20117b,null))[_0xdfbc('0x17')](function(_0xffeed0){if(_0xffeed0&&_0xffeed0[_0xdfbc('0x5e')]){var _0x4686e7=_0xffeed0[_0xdfbc('0x5f')]({'plain':!![]});fs['mkdirSync'](_0x5b643b);return BPromise['each'](_0x4686e7[_0xdfbc('0x5e')],function(_0x452571,_0x4fbbeb){var _0x19f45d={'from':_0x452571[_0xdfbc('0x5d')],'to':_0x452571['to']||_0xdfbc('0x60'),'subject':_0x452571[_0xdfbc('0x61')],'html':htmlEntities['decode'](_0x452571[_0xdfbc('0x35')]),'headers':{'Date':moment(_0x452571['createdAt'])[_0xdfbc('0x47')](_0xdfbc('0x62'))},'attachments':[]};if(_0x452571['cc']){_0x19f45d['headers']['Cc']=_0x452571['cc'];}if(_0x452571['bcc']){_0x19f45d[_0xdfbc('0x63')][_0xdfbc('0x64')]=_0x452571[_0xdfbc('0x65')];}return new BPromise(function(_0x43198b,_0x2410ba){if(_0x452571[_0xdfbc('0x5c')]){for(var _0x534437=0x0;_0x534437<_0x452571[_0xdfbc('0x5c')]['length'];_0x534437++){var _0x4e7bd2=_0x452571[_0xdfbc('0x5c')][_0x534437];var _0xa7118e=path['join'](_0x8e48e2,_0x4e7bd2[_0xdfbc('0x66')]);if(fs[_0xdfbc('0x67')](_0xa7118e)){_0x19f45d[_0xdfbc('0x57')][_0xdfbc('0x5a')]({'name':_0x4e7bd2[_0xdfbc('0x1a')],'contentType':_0x4e7bd2[_0xdfbc('0x1f')],'data':fs['readFileSync'](_0xa7118e)});}}}emlformat['build'](_0x19f45d,function(_0x307250,_0xec5770){if(_0x307250)return _0x2410ba(_0x307250);fs[_0xdfbc('0x68')](path[_0xdfbc('0x58')](_0x5b643b,util['format'](_0xdfbc('0x69'),_0x4fbbeb)),_0xec5770);return _0x43198b(_0xec5770);});});})[_0xdfbc('0x17')](function(){return new BPromise(function(_0x19b8e,_0x27fc70){zipdir(_0x5b643b,{'saveTo':_0x633d1a},function(_0x473166,_0x431370){if(_0x473166)return _0x27fc70(_0x473166);return _0x19b8e(_0x431370);});})[_0xdfbc('0x17')](function(){return new BPromise(function(_0x1ad416,_0x2211c9){rimraf(_0x5b643b,function(_0x299c67){if(_0x299c67)_0x2211c9(_0x299c67);return _0x1ad416();});});})[_0xdfbc('0x17')](function(){return _0x20117b[_0xdfbc('0x51')](_0x633d1a,_0x9d7677,function(_0x53475b){if(!_0x53475b)fs[_0xdfbc('0x6a')](_0x633d1a);});});});}else{return _0x20117b[_0xdfbc('0xd')](0xc8);}})[_0xdfbc('0x25')](handleError(_0x20117b,null));}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.events.js b/server/api/mailInteraction/mailInteraction.events.js index 9f5a055..ab56921 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 _0x0d82=['MailInteraction','setMaxListeners','save','remove','getUsers','then','setDataValue','unreadMessages','length','emit','hook','exports'];(function(_0x28aebb,_0x25ddee){var _0x282e8e=function(_0xf1cf70){while(--_0xf1cf70){_0x28aebb['push'](_0x28aebb['shift']());}};_0x282e8e(++_0x25ddee);}(_0x0d82,0x1bc));var _0x20d8=function(_0x273c39,_0x1052e6){_0x273c39=_0x273c39-0x0;var _0x46d6b5=_0x0d82[_0x273c39];return _0x46d6b5;};'use strict';var EventEmitter=require('events');var MailInteraction=require('../../mysqldb')['db'][_0x20d8('0x0')];var MailMessage=require('../../mysqldb')['db']['MailMessage'];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0x20d8('0x1')](0x0);var events={'afterCreate':_0x20d8('0x2'),'afterUpdate':'update','afterDestroy':_0x20d8('0x3')};function emitEvent(_0x3e2324){return function(_0x294fc6,_0x371851,_0xd05948){_0x294fc6[_0x20d8('0x4')]({'attributes':['id'],'raw':!![]})[_0x20d8('0x5')](function(_0x2c8bc9){_0x294fc6[_0x20d8('0x6')]('Users',_0x2c8bc9['map'](function(_0x45c1e6){return{'id':_0x45c1e6['id']};}));return MailMessage['findAll']({'where':{'MailInteractionId':_0x294fc6['id'],'direction':'in','read':![]},'raw':!![]});})[_0x20d8('0x5')](function(_0x5566cb){_0x294fc6[_0x20d8('0x6')](_0x20d8('0x7'),_0x5566cb[_0x20d8('0x8')]);MailInteractionEvents['emit'](_0x3e2324+':'+_0x294fc6['id'],_0x294fc6);MailInteractionEvents[_0x20d8('0x9')](_0x3e2324,_0x294fc6);_0xd05948(null);})['catch'](_0xd05948(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailInteraction[_0x20d8('0xa')](e,emitEvent(event));}}module[_0x20d8('0xb')]=MailInteractionEvents; \ No newline at end of file +var _0x17d1=['../../mysqldb','MailMessage','setMaxListeners','save','update','remove','getUsers','then','setDataValue','Users','map','findAll','emit','hook','exports'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x17d1,0x1c2));var _0x117d=function(_0x7fb67e,_0x4ddffc){_0x7fb67e=_0x7fb67e-0x0;var _0x274ccc=_0x17d1[_0x7fb67e];return _0x274ccc;};'use strict';var EventEmitter=require('events');var MailInteraction=require(_0x117d('0x0'))['db']['MailInteraction'];var MailMessage=require(_0x117d('0x0'))['db'][_0x117d('0x1')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0x117d('0x2')](0x0);var events={'afterCreate':_0x117d('0x3'),'afterUpdate':_0x117d('0x4'),'afterDestroy':_0x117d('0x5')};function emitEvent(_0x1f3f40){return function(_0x242976,_0x82e12e,_0x5d0472){_0x242976[_0x117d('0x6')]({'attributes':['id'],'raw':!![]})[_0x117d('0x7')](function(_0x4e204b){_0x242976[_0x117d('0x8')](_0x117d('0x9'),_0x4e204b[_0x117d('0xa')](function(_0x34599b){return{'id':_0x34599b['id']};}));return MailMessage[_0x117d('0xb')]({'where':{'MailInteractionId':_0x242976['id'],'direction':'in','read':![]},'raw':!![]});})[_0x117d('0x7')](function(_0x1cfcfa){_0x242976[_0x117d('0x8')]('unreadMessages',_0x1cfcfa['length']);MailInteractionEvents[_0x117d('0xc')](_0x1f3f40+':'+_0x242976['id'],_0x242976);MailInteractionEvents[_0x117d('0xc')](_0x1f3f40,_0x242976);_0x5d0472(null);})['catch'](_0x5d0472(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailInteraction[_0x117d('0xd')](e,emitEvent(event));}}module[_0x117d('0xe')]=MailInteractionEvents; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.model.js b/server/api/mailInteraction/mailInteraction.model.js index d135eca..8b95d8d 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 _0x3e79=['moment','bluebird','rimraf','../../config/environment','./mailInteraction.attributes','MailInteraction','mail_interactions','fti_mail_interactions','substatus','format','YYYY-MM-DD\x20HH:mm:ss','closedAt','closed','substatusAt','get','MailMessage','update','then','utf8mb4_unicode_ci','lodash','util','../../config/logger','api'];(function(_0x2ace13,_0x4a1699){var _0x28d0ef=function(_0x45e027){while(--_0x45e027){_0x2ace13['push'](_0x2ace13['shift']());}};_0x28d0ef(++_0x4a1699);}(_0x3e79,0x19a));var _0x93e7=function(_0x1db76,_0x1e047c){_0x1db76=_0x1db76-0x0;var _0x49f54d=_0x3e79[_0x1db76];return _0x49f54d;};'use strict';var _=require(_0x93e7('0x0'));var util=require(_0x93e7('0x1'));var logger=require(_0x93e7('0x2'))(_0x93e7('0x3'));var moment=require(_0x93e7('0x4'));var BPromise=require(_0x93e7('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x93e7('0x6'));var config=require(_0x93e7('0x7'));var attributes=require(_0x93e7('0x8'));module['exports']=function(_0x268c36,_0x2caa75){return _0x268c36['define'](_0x93e7('0x9'),attributes,{'tableName':_0x93e7('0xa'),'paranoid':![],'indexes':[{'name':_0x93e7('0xb'),'fields':['subject','to'],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x1fd7ed,_0x5626ee,_0x4dfca8){if(_0x1fd7ed[_0x93e7('0xc')]){_0x1fd7ed['substatusAt']=moment()[_0x93e7('0xd')](_0x93e7('0xe'));}if(_0x1fd7ed['closed']){_0x1fd7ed[_0x93e7('0xf')]=moment()[_0x93e7('0xd')]('YYYY-MM-DD\x20HH:mm:ss');}_0x4dfca8(null,_0x5626ee);},'beforeUpdate':function(_0x40f0b6,_0x5a882e,_0x1d716d){if(_0x40f0b6['changed'](_0x93e7('0xc'))){_0x40f0b6['substatusAt']=_0x40f0b6['substatus']?moment()[_0x93e7('0xd')](_0x93e7('0xe')):null;}if(_0x40f0b6['changed'](_0x93e7('0x10'))){_0x40f0b6[_0x93e7('0xf')]=moment()['format'](_0x93e7('0xe'));_0x40f0b6[_0x93e7('0xc')]=null;_0x40f0b6[_0x93e7('0x11')]=null;}_0x1d716d(null,_0x40f0b6);},'afterUpdate':function(_0x45a2f0,_0x2ebcb3,_0x5e5436){var _0x4e2d6e=_0x268c36['models'];var _0x3d53d3=_0x45a2f0[_0x93e7('0x12')]({'plain':!![]});if(_0x3d53d3[_0x93e7('0x10')]){return _0x4e2d6e[_0x93e7('0x13')][_0x93e7('0x14')]({'read':!![]},{'where':{'MailInteractionId':_0x3d53d3['id']}})[_0x93e7('0x15')](function(){_0x5e5436();})['catch'](function(_0x85ea1f){_0x5e5436(_0x85ea1f);});}else{_0x5e5436();}}},'charset':'utf8mb4','collate':_0x93e7('0x16')});}; \ No newline at end of file +var _0x07d6=['fti_mail_interactions','subject','FULLTEXT','substatusAt','format','changed','substatus','YYYY-MM-DD\x20HH:mm:ss','closed','closedAt','models','get','MailMessage','catch','utf8mb4','util','../../config/logger','moment','request-promise','path','rimraf','../../config/environment','./mailInteraction.attributes','define','MailInteraction','mail_interactions'];(function(_0x28d26f,_0x5581e2){var _0x2e8185=function(_0x2b7193){while(--_0x2b7193){_0x28d26f['push'](_0x28d26f['shift']());}};_0x2e8185(++_0x5581e2);}(_0x07d6,0x12d));var _0x607d=function(_0x3f43ef,_0x4c2ba9){_0x3f43ef=_0x3f43ef-0x0;var _0x20af43=_0x07d6[_0x3f43ef];return _0x20af43;};'use strict';var _=require('lodash');var util=require(_0x607d('0x0'));var logger=require(_0x607d('0x1'))('api');var moment=require(_0x607d('0x2'));var BPromise=require('bluebird');var rp=require(_0x607d('0x3'));var fs=require('fs');var path=require(_0x607d('0x4'));var rimraf=require(_0x607d('0x5'));var config=require(_0x607d('0x6'));var attributes=require(_0x607d('0x7'));module['exports']=function(_0x901224,_0x1d837f){return _0x901224[_0x607d('0x8')](_0x607d('0x9'),attributes,{'tableName':_0x607d('0xa'),'paranoid':![],'indexes':[{'name':_0x607d('0xb'),'fields':[_0x607d('0xc'),'to'],'type':_0x607d('0xd')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x1858a6,_0x47522e,_0x3ca499){if(_0x1858a6['substatus']){_0x1858a6[_0x607d('0xe')]=moment()[_0x607d('0xf')]('YYYY-MM-DD\x20HH:mm:ss');}if(_0x1858a6['closed']){_0x1858a6['closedAt']=moment()[_0x607d('0xf')]('YYYY-MM-DD\x20HH:mm:ss');}_0x3ca499(null,_0x47522e);},'beforeUpdate':function(_0x305957,_0x263391,_0xaf253e){if(_0x305957[_0x607d('0x10')](_0x607d('0x11'))){_0x305957[_0x607d('0xe')]=_0x305957[_0x607d('0x11')]?moment()[_0x607d('0xf')](_0x607d('0x12')):null;}if(_0x305957[_0x607d('0x10')](_0x607d('0x13'))){_0x305957[_0x607d('0x14')]=moment()[_0x607d('0xf')](_0x607d('0x12'));_0x305957['substatus']=null;_0x305957[_0x607d('0xe')]=null;}_0xaf253e(null,_0x305957);},'afterUpdate':function(_0x303cd5,_0x28520a,_0xe42c7b){var _0x3e5333=_0x901224[_0x607d('0x15')];var _0x3bfa12=_0x303cd5[_0x607d('0x16')]({'plain':!![]});if(_0x3bfa12[_0x607d('0x13')]){return _0x3e5333[_0x607d('0x17')]['update']({'read':!![]},{'where':{'MailInteractionId':_0x3bfa12['id']}})['then'](function(){_0xe42c7b();})[_0x607d('0x18')](function(_0x13e910){_0xe42c7b(_0x13e910);});}else{_0xe42c7b();}}},'charset':_0x607d('0x19'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.rpc.js b/server/api/mailInteraction/mailInteraction.rpc.js index 5455898..2bb575b 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 _0x33de=['body','options','raw','where','attributes','limit','AddTagsToMailInteraction','find','addTags','spread','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','redis','localhost','./mailInteraction.socket','then','info','MailInteraction,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','UpdateMailInteraction','MailInteraction','update'];(function(_0x5513cf,_0x226a41){var _0x35d40d=function(_0x421f46){while(--_0x421f46){_0x5513cf['push'](_0x5513cf['shift']());}};_0x35d40d(++_0x226a41);}(_0x33de,0x14b));var _0xe33d=function(_0x19a7cb,_0x1384f7){_0x19a7cb=_0x19a7cb-0x0;var _0x455ed2=_0x33de[_0x19a7cb];return _0x455ed2;};'use strict';var _=require(_0xe33d('0x0'));var util=require(_0xe33d('0x1'));var moment=require(_0xe33d('0x2'));var BPromise=require(_0xe33d('0x3'));var rs=require(_0xe33d('0x4'));var fs=require('fs');var Redis=require(_0xe33d('0x5'));var db=require(_0xe33d('0x6'))['db'];var utils=require(_0xe33d('0x7'));var logger=require(_0xe33d('0x8'))(_0xe33d('0x9'));var config=require(_0xe33d('0xa'));var jayson=require('jayson/promise');var client=jayson[_0xe33d('0xb')]['http']({'port':0x232a});config[_0xe33d('0xc')]=_['defaults'](config['redis'],{'host':_0xe33d('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xe33d('0xc')]));require(_0xe33d('0xe'))['register'](socket);function respondWithRpcPromise(_0x5c81b3,_0x489cde,_0x5a858c){return new BPromise(function(_0x530f6a,_0x54544e){return client['request'](_0x5c81b3,_0x5a858c)[_0xe33d('0xf')](function(_0x4da3c3){logger[_0xe33d('0x10')](_0xe33d('0x11'),_0x489cde,'request\x20sent');logger[_0xe33d('0x12')]('MailInteraction,\x20%s,\x20%s,\x20%s',_0x489cde,_0xe33d('0x13'),JSON[_0xe33d('0x14')](_0x4da3c3));if(_0x4da3c3[_0xe33d('0x15')]){if(_0x4da3c3[_0xe33d('0x15')][_0xe33d('0x16')]===0x1f4){logger[_0xe33d('0x15')](_0xe33d('0x11'),_0x489cde,_0x4da3c3[_0xe33d('0x15')][_0xe33d('0x17')]);return _0x54544e(_0x4da3c3[_0xe33d('0x15')][_0xe33d('0x17')]);}logger[_0xe33d('0x15')](_0xe33d('0x11'),_0x489cde,_0x4da3c3[_0xe33d('0x15')]['message']);return _0x530f6a(_0x4da3c3['error'][_0xe33d('0x17')]);}else{logger['info'](_0xe33d('0x11'),_0x489cde,'request\x20sent');_0x530f6a(_0x4da3c3[_0xe33d('0x18')][_0xe33d('0x17')]);}})[_0xe33d('0x19')](function(_0x2b96c4){logger[_0xe33d('0x15')](_0xe33d('0x11'),_0x489cde,_0x2b96c4);_0x54544e(_0x2b96c4);});});}exports[_0xe33d('0x1a')]=function(_0x422af9){var _0x4db3bd=this;return new Promise(function(_0x2e8dec,_0x3eab67){return db[_0xe33d('0x1b')][_0xe33d('0x1c')](_0x422af9[_0xe33d('0x1d')],{'raw':_0x422af9['options']?_0x422af9[_0xe33d('0x1e')][_0xe33d('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x422af9[_0xe33d('0x1e')]?_0x422af9[_0xe33d('0x1e')][_0xe33d('0x20')]||null:null,'attributes':_0x422af9['options']?_0x422af9[_0xe33d('0x1e')][_0xe33d('0x21')]||null:null,'limit':_0x422af9[_0xe33d('0x1e')]?_0x422af9[_0xe33d('0x1e')][_0xe33d('0x22')]||null:null})[_0xe33d('0xf')](function(_0x48dfe2){logger[_0xe33d('0x10')](_0xe33d('0x1a'),_0x422af9);logger[_0xe33d('0x12')](_0xe33d('0x1a'),_0x422af9,JSON[_0xe33d('0x14')](_0x48dfe2));_0x2e8dec(_0x48dfe2);})[_0xe33d('0x19')](function(_0x3e1afb){logger[_0xe33d('0x15')](_0xe33d('0x1a'),_0x3e1afb[_0xe33d('0x17')],_0x422af9);_0x3eab67(_0x4db3bd[_0xe33d('0x15')](0x1f4,_0x3e1afb[_0xe33d('0x17')]));});});};exports[_0xe33d('0x23')]=function(_0x2b515f){return new Promise(function(_0x2070da,_0x133d54){return db[_0xe33d('0x1b')][_0xe33d('0x24')]({'where':_0x2b515f[_0xe33d('0x1e')]?_0x2b515f[_0xe33d('0x1e')]['where']||null:null})[_0xe33d('0xf')](function(_0x4fd5cb){if(_0x4fd5cb){return _0x4fd5cb[_0xe33d('0x25')](_0x2b515f['body']['ids'],_['omit'](_0x2b515f['body'],['ids','id'])||{});}})[_0xe33d('0x26')](function(_0xeb8313){logger[_0xe33d('0x10')](_0xe33d('0x27'),_0x2b515f);logger[_0xe33d('0x12')](_0xe33d('0x27'),_0x2b515f,JSON[_0xe33d('0x14')](_0xeb8313));_0x2070da(_0xeb8313);})[_0xe33d('0x19')](function(_0x4cba46){logger[_0xe33d('0x15')](_0xe33d('0x27'),_0x4cba46[_0xe33d('0x17')],_0x2b515f);_0x133d54(_this[_0xe33d('0x15')](0x1f4,_0x4cba46[_0xe33d('0x17')]));});});}; \ No newline at end of file +var _0x7fd6=['catch','UpdateMailInteraction','update','body','options','raw','where','attributes','MailInteraction','find','addTags','ids','omit','spread','AddTags','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','redis','defaults','localhost','socket.io-emitter','./mailInteraction.socket','register','request','then','info','MailInteraction,\x20%s,\x20%s','request\x20sent','debug','MailInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0x3afc31,_0x2456dd){var _0x2f5885=function(_0x3d84e0){while(--_0x3d84e0){_0x3afc31['push'](_0x3afc31['shift']());}};_0x2f5885(++_0x2456dd);}(_0x7fd6,0x157));var _0x67fd=function(_0x37cc11,_0x2194c1){_0x37cc11=_0x37cc11-0x0;var _0x4f10e4=_0x7fd6[_0x37cc11];return _0x4f10e4;};'use strict';var _=require(_0x67fd('0x0'));var util=require('util');var moment=require(_0x67fd('0x1'));var BPromise=require(_0x67fd('0x2'));var rs=require(_0x67fd('0x3'));var fs=require('fs');var Redis=require(_0x67fd('0x4'));var db=require(_0x67fd('0x5'))['db'];var utils=require(_0x67fd('0x6'));var logger=require('../../config/logger')(_0x67fd('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});config[_0x67fd('0x8')]=_[_0x67fd('0x9')](config[_0x67fd('0x8')],{'host':_0x67fd('0xa'),'port':0x18eb});var socket=require(_0x67fd('0xb'))(new Redis(config[_0x67fd('0x8')]));require(_0x67fd('0xc'))[_0x67fd('0xd')](socket);function respondWithRpcPromise(_0x5c64a6,_0x25ce35,_0xf35a50){return new BPromise(function(_0xb7abc,_0x65f39c){return client[_0x67fd('0xe')](_0x5c64a6,_0xf35a50)[_0x67fd('0xf')](function(_0x5cb377){logger[_0x67fd('0x10')](_0x67fd('0x11'),_0x25ce35,_0x67fd('0x12'));logger[_0x67fd('0x13')](_0x67fd('0x14'),_0x25ce35,_0x67fd('0x12'),JSON[_0x67fd('0x15')](_0x5cb377));if(_0x5cb377[_0x67fd('0x16')]){if(_0x5cb377[_0x67fd('0x16')][_0x67fd('0x17')]===0x1f4){logger[_0x67fd('0x16')]('MailInteraction,\x20%s,\x20%s',_0x25ce35,_0x5cb377[_0x67fd('0x16')][_0x67fd('0x18')]);return _0x65f39c(_0x5cb377[_0x67fd('0x16')][_0x67fd('0x18')]);}logger['error'](_0x67fd('0x11'),_0x25ce35,_0x5cb377[_0x67fd('0x16')]['message']);return _0xb7abc(_0x5cb377[_0x67fd('0x16')][_0x67fd('0x18')]);}else{logger[_0x67fd('0x10')](_0x67fd('0x11'),_0x25ce35,_0x67fd('0x12'));_0xb7abc(_0x5cb377[_0x67fd('0x19')][_0x67fd('0x18')]);}})[_0x67fd('0x1a')](function(_0x575fa2){logger[_0x67fd('0x16')]('MailInteraction,\x20%s,\x20%s',_0x25ce35,_0x575fa2);_0x65f39c(_0x575fa2);});});}exports[_0x67fd('0x1b')]=function(_0x4e9fa7){var _0x271c26=this;return new Promise(function(_0x9b7393,_0x118169){return db['MailInteraction'][_0x67fd('0x1c')](_0x4e9fa7[_0x67fd('0x1d')],{'raw':_0x4e9fa7['options']?_0x4e9fa7[_0x67fd('0x1e')][_0x67fd('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4e9fa7[_0x67fd('0x1e')]?_0x4e9fa7[_0x67fd('0x1e')][_0x67fd('0x20')]||null:null,'attributes':_0x4e9fa7[_0x67fd('0x1e')]?_0x4e9fa7[_0x67fd('0x1e')][_0x67fd('0x21')]||null:null,'limit':_0x4e9fa7[_0x67fd('0x1e')]?_0x4e9fa7[_0x67fd('0x1e')]['limit']||null:null})[_0x67fd('0xf')](function(_0x2b2190){logger['info']('UpdateMailInteraction',_0x4e9fa7);logger[_0x67fd('0x13')](_0x67fd('0x1b'),_0x4e9fa7,JSON[_0x67fd('0x15')](_0x2b2190));_0x9b7393(_0x2b2190);})[_0x67fd('0x1a')](function(_0x43aee0){logger[_0x67fd('0x16')]('UpdateMailInteraction',_0x43aee0[_0x67fd('0x18')],_0x4e9fa7);_0x118169(_0x271c26[_0x67fd('0x16')](0x1f4,_0x43aee0[_0x67fd('0x18')]));});});};exports['AddTagsToMailInteraction']=function(_0x4ffe92){return new Promise(function(_0x142920,_0x3b3393){return db[_0x67fd('0x22')][_0x67fd('0x23')]({'where':_0x4ffe92[_0x67fd('0x1e')]?_0x4ffe92[_0x67fd('0x1e')]['where']||null:null})[_0x67fd('0xf')](function(_0x559fdb){if(_0x559fdb){return _0x559fdb[_0x67fd('0x24')](_0x4ffe92[_0x67fd('0x1d')][_0x67fd('0x25')],_[_0x67fd('0x26')](_0x4ffe92['body'],['ids','id'])||{});}})[_0x67fd('0x27')](function(_0x4d629e){logger[_0x67fd('0x10')]('AddTags',_0x4ffe92);logger['debug'](_0x67fd('0x28'),_0x4ffe92,JSON[_0x67fd('0x15')](_0x4d629e));_0x142920(_0x4d629e);})[_0x67fd('0x1a')](function(_0x1c1ccf){logger[_0x67fd('0x16')](_0x67fd('0x28'),_0x1c1ccf[_0x67fd('0x18')],_0x4ffe92);_0x3b3393(_this['error'](0x1f4,_0x1c1ccf['message']));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.socket.js b/server/api/mailInteraction/mailInteraction.socket.js index c7f946d..0b9fafc 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 _0xf6c1=['removeListener','mailInteraction:','./mailInteraction.events','save','emit'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xf6c1,0x192));var _0x1f6c=function(_0x4e5470,_0x3a0507){_0x4e5470=_0x4e5470-0x0;var _0x2249a2=_0xf6c1[_0x4e5470];return _0x2249a2;};'use strict';var MailInteractionEvents=require(_0x1f6c('0x0'));var events=[_0x1f6c('0x1'),'remove','update'];function createListener(_0x28a64b,_0x3c5c50){return function(_0xcf68b5){_0x3c5c50[_0x1f6c('0x2')](_0x28a64b,_0xcf68b5);};}function removeListener(_0x1bbd19,_0x59d82b){return function(){MailInteractionEvents[_0x1f6c('0x3')](_0x1bbd19,_0x59d82b);};}exports['register']=function(_0x177c6c){for(var _0x370a1c=0x0,_0x4b4f64=events['length'];_0x370a1c<_0x4b4f64;_0x370a1c++){var _0x3046af=events[_0x370a1c];var _0x32bb77=createListener(_0x1f6c('0x4')+_0x3046af,_0x177c6c);MailInteractionEvents['on'](_0x3046af,_0x32bb77);}}; \ No newline at end of file +var _0x2600=['./mailInteraction.events','remove','update','emit','removeListener','register','length'];(function(_0x38eb23,_0x196e8b){var _0x48506a=function(_0x36edb0){while(--_0x36edb0){_0x38eb23['push'](_0x38eb23['shift']());}};_0x48506a(++_0x196e8b);}(_0x2600,0xe0));var _0x0260=function(_0x290b3b,_0x4e6213){_0x290b3b=_0x290b3b-0x0;var _0x49dfc2=_0x2600[_0x290b3b];return _0x49dfc2;};'use strict';var MailInteractionEvents=require(_0x0260('0x0'));var events=['save',_0x0260('0x1'),_0x0260('0x2')];function createListener(_0x1e1abd,_0x35c62c){return function(_0x5133ee){_0x35c62c[_0x0260('0x3')](_0x1e1abd,_0x5133ee);};}function removeListener(_0x3616f7,_0x50773a){return function(){MailInteractionEvents[_0x0260('0x4')](_0x3616f7,_0x50773a);};}exports[_0x0260('0x5')]=function(_0x2e7793){for(var _0x44788a=0x0,_0x10b73d=events[_0x0260('0x6')];_0x44788a<_0x10b73d;_0x44788a++){var _0x312e16=events[_0x44788a];var _0x4cca76=createListener('mailInteraction:'+_0x312e16,_0x2e7793);MailInteractionEvents['on'](_0x312e16,_0x4cca76);}}; \ No newline at end of file diff --git a/server/api/mailMessage/index.js b/server/api/mailMessage/index.js index dc47017..165449f 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 _0x8bc8=['Router','./mailMessage.controller','isAuthenticated','get','/describe','describe','show','/:id/download','download','post','tracked','mail','mailmessage:create','create','/:id','update','put','/:id/reject','delete','destroy','exports','multer','util','path','connect-timeout'];(function(_0x334d1e,_0x28a488){var _0x3b33ba=function(_0x25afca){while(--_0x25afca){_0x334d1e['push'](_0x334d1e['shift']());}};_0x3b33ba(++_0x28a488);}(_0x8bc8,0xc4));var _0x88bc=function(_0x418ca7,_0x2f4468){_0x418ca7=_0x418ca7-0x0;var _0x235d6a=_0x8bc8[_0x418ca7];return _0x235d6a;};'use strict';var multer=require(_0x88bc('0x0'));var util=require(_0x88bc('0x1'));var path=require(_0x88bc('0x2'));var timeout=require(_0x88bc('0x3'));var express=require('express');var router=express[_0x88bc('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(_0x88bc('0x5'));router['get']('/',auth[_0x88bc('0x6')](),controller['index']);router[_0x88bc('0x7')](_0x88bc('0x8'),auth[_0x88bc('0x6')](),controller[_0x88bc('0x9')]);router[_0x88bc('0x7')]('/:id',auth[_0x88bc('0x6')](),controller[_0x88bc('0xa')]);router['get'](_0x88bc('0xb'),auth[_0x88bc('0x6')](),controller[_0x88bc('0xc')]);router[_0x88bc('0xd')]('/',auth[_0x88bc('0x6')](),interaction[_0x88bc('0xe')](_0x88bc('0xf'),_0x88bc('0x10')),controller[_0x88bc('0x11')]);router['put'](_0x88bc('0x12'),auth[_0x88bc('0x6')](),controller[_0x88bc('0x13')]);router[_0x88bc('0x14')]('/:id/accept',auth['isAuthenticated'](),controller['accept']);router[_0x88bc('0x14')](_0x88bc('0x15'),auth['isAuthenticated'](),controller['reject']);router[_0x88bc('0x16')]('/:id',auth[_0x88bc('0x6')](),controller[_0x88bc('0x17')]);module[_0x88bc('0x18')]=router; \ No newline at end of file +var _0xe9f9=['../../components/interaction/service','./mailMessage.controller','get','index','/describe','isAuthenticated','describe','/:id','show','/:id/download','post','tracked','mailmessage:create','create','put','update','/:id/accept','/:id/reject','reject','delete','exports','multer','path','connect-timeout','express','Router','fs-extra'];(function(_0x5eb22e,_0x27cbac){var _0x27fed5=function(_0x565467){while(--_0x565467){_0x5eb22e['push'](_0x5eb22e['shift']());}};_0x27fed5(++_0x27cbac);}(_0xe9f9,0x174));var _0x9e9f=function(_0x42d4db,_0xe5a183){_0x42d4db=_0x42d4db-0x0;var _0x76b8ea=_0xe9f9[_0x42d4db];return _0x76b8ea;};'use strict';var multer=require(_0x9e9f('0x0'));var util=require('util');var path=require(_0x9e9f('0x1'));var timeout=require(_0x9e9f('0x2'));var express=require(_0x9e9f('0x3'));var router=express[_0x9e9f('0x4')]();var fs_extra=require(_0x9e9f('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x9e9f('0x6'));var config=require('../../config/environment');var controller=require(_0x9e9f('0x7'));router[_0x9e9f('0x8')]('/',auth['isAuthenticated'](),controller[_0x9e9f('0x9')]);router['get'](_0x9e9f('0xa'),auth[_0x9e9f('0xb')](),controller[_0x9e9f('0xc')]);router['get'](_0x9e9f('0xd'),auth[_0x9e9f('0xb')](),controller[_0x9e9f('0xe')]);router[_0x9e9f('0x8')](_0x9e9f('0xf'),auth[_0x9e9f('0xb')](),controller['download']);router[_0x9e9f('0x10')]('/',auth[_0x9e9f('0xb')](),interaction[_0x9e9f('0x11')]('mail',_0x9e9f('0x12')),controller[_0x9e9f('0x13')]);router[_0x9e9f('0x14')](_0x9e9f('0xd'),auth[_0x9e9f('0xb')](),controller[_0x9e9f('0x15')]);router[_0x9e9f('0x14')](_0x9e9f('0x16'),auth[_0x9e9f('0xb')](),controller['accept']);router['put'](_0x9e9f('0x17'),auth[_0x9e9f('0xb')](),controller[_0x9e9f('0x18')]);router[_0x9e9f('0x19')](_0x9e9f('0xd'),auth[_0x9e9f('0xb')](),controller['destroy']);module[_0x9e9f('0x1a')]=router; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.attributes.js b/server/api/mailMessage/mailMessage.attributes.js index eb5b4a4..7552ccd 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 _0x90e0=['exports','TEXT','long','medium','BOOLEAN','ENUM','out','DATE','INTEGER','Chat','Email','lodash'];(function(_0x284240,_0x555b56){var _0x390667=function(_0x409454){while(--_0x409454){_0x284240['push'](_0x284240['shift']());}};_0x390667(++_0x555b56);}(_0x90e0,0xe3));var _0x090e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x90e0[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');var _=require(_0x090e('0x0'));module[_0x090e('0x1')]={'body':{'type':Sequelize[_0x090e('0x2')](_0x090e('0x3')),'allowNull':![]},'plainBody':{'type':Sequelize[_0x090e('0x2')](_0x090e('0x4'))},'read':{'type':Sequelize[_0x090e('0x5')],'defaultValue':![]},'direction':{'type':Sequelize[_0x090e('0x6')]('in',_0x090e('0x7')),'defaultValue':_0x090e('0x7'),'allowNull':![]},'messageId':{'type':Sequelize['STRING'](0x1fe)},'from':{'type':Sequelize['STRING']},'to':{'type':Sequelize['TEXT']('long')},'cc':{'type':Sequelize[_0x090e('0x2')](_0x090e('0x3'))},'bcc':{'type':Sequelize[_0x090e('0x2')](_0x090e('0x3'))},'subject':{'type':Sequelize[_0x090e('0x2')]},'sentAt':{'type':Sequelize[_0x090e('0x8')]},'attach':{'type':Sequelize[_0x090e('0x9')],'defaultValue':0x0},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'readAt':{'type':Sequelize[_0x090e('0x8')]},'originTo':{'type':Sequelize[_0x090e('0x2')](_0x090e('0x3'))},'originCc':{'type':Sequelize[_0x090e('0x2')](_0x090e('0x3'))},'originChannel':{'type':Sequelize[_0x090e('0x6')]('Email',_0x090e('0xa')),'defaultValue':_0x090e('0xb'),'allowNull':![]}}; \ No newline at end of file +var _0x72de=['exports','TEXT','medium','out','STRING','long','DATE','BOOLEAN','Email'];(function(_0x558615,_0x1eb496){var _0x1e032a=function(_0x538f1d){while(--_0x538f1d){_0x558615['push'](_0x558615['shift']());}};_0x1e032a(++_0x1eb496);}(_0x72de,0x99));var _0xe72d=function(_0x15ef85,_0x32e885){_0x15ef85=_0x15ef85-0x0;var _0x3de475=_0x72de[_0x15ef85];return _0x3de475;};'use strict';var Sequelize=require('sequelize');var _=require('lodash');module[_0xe72d('0x0')]={'body':{'type':Sequelize[_0xe72d('0x1')]('long'),'allowNull':![]},'plainBody':{'type':Sequelize['TEXT'](_0xe72d('0x2'))},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0xe72d('0x3')),'defaultValue':_0xe72d('0x3'),'allowNull':![]},'messageId':{'type':Sequelize[_0xe72d('0x4')](0x1fe)},'from':{'type':Sequelize[_0xe72d('0x4')]},'to':{'type':Sequelize[_0xe72d('0x1')](_0xe72d('0x5'))},'cc':{'type':Sequelize['TEXT'](_0xe72d('0x5'))},'bcc':{'type':Sequelize['TEXT'](_0xe72d('0x5'))},'subject':{'type':Sequelize['TEXT']},'sentAt':{'type':Sequelize[_0xe72d('0x6')]},'attach':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'secret':{'type':Sequelize[_0xe72d('0x7')],'defaultValue':![]},'readAt':{'type':Sequelize[_0xe72d('0x6')]},'originTo':{'type':Sequelize[_0xe72d('0x1')]('long')},'originCc':{'type':Sequelize[_0xe72d('0x1')](_0xe72d('0x5'))},'originChannel':{'type':Sequelize['ENUM'](_0xe72d('0x8'),'Chat'),'defaultValue':_0xe72d('0x8'),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.controller.js b/server/api/mailMessage/mailMessage.controller.js index f55e9b0..c90135e 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 _0x7b08=['redis','defaults','localhost','socket.io-emitter','html-entities','./mailMessage.socket','register','jayson/promise','client','http','request','then','info','stringify','error','code','message','MailMessage,\x20%s,\x20%s','request\x20sent','result','offset','undefined','count','status','end','sendStatus','stack','name','index','map','MailMessage','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','sort','where','pick','filter','merge','VIRTUAL','include','rows','catch','show','params','includeAll','options','find','body','destroy','describe','create','direction','out','secret','split','MailAccount','findOne','MailAccountId','CmList','CmContact','Contacts','DESC','MailServerOut','Smtp','CloudProvider','attachments','join','root','server/files/attachments','List','ListId','SendMail','sendMail','update','format','accept','mail','read','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','MailInteraction','MailInteractionId','isNil','read1stAt','role','interaction','null','AcceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','Sequelize','SELECT','contact','email','internal','manual','interface','SIP/%s','channel','event','fromString','EventManager','reject','[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','sequelize','User','fullname','download','unix','toString','tmp','server','files','message-%s.eml','from','bcc','subject','createdAt','Attachment','Attachments','decode','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Bcc','push','readFileSync','build','writeFileSync','unlinkSync','eml-format','moment','bluebird','util','path','ioredis','html-to-text','../../components/parsers/qs','../../config/logger','api','../../config/environment'];(function(_0x1be0fe,_0x3bf372){var _0x508b01=function(_0x4f4678){while(--_0x4f4678){_0x1be0fe['push'](_0x1be0fe['shift']());}};_0x508b01(++_0x3bf372);}(_0x7b08,0x131));var _0x87b0=function(_0x51c3d6,_0x590080){_0x51c3d6=_0x51c3d6-0x0;var _0x6d59d6=_0x7b08[_0x51c3d6];return _0x6d59d6;};'use strict';var emlformat=require(_0x87b0('0x0'));var moment=require(_0x87b0('0x1'));var BPromise=require(_0x87b0('0x2'));var util=require(_0x87b0('0x3'));var path=require(_0x87b0('0x4'));var fs=require('fs');var _=require('lodash');var Redis=require(_0x87b0('0x5'));var htmlToText=require(_0x87b0('0x6'));var qs=require(_0x87b0('0x7'));var logger=require(_0x87b0('0x8'))(_0x87b0('0x9'));var interaction_log=require(_0x87b0('0x8'))('mail-interactions');var config=require(_0x87b0('0xa'));var db=require('../../mysqldb')['db'];config[_0x87b0('0xb')]=_[_0x87b0('0xc')](config[_0x87b0('0xb')],{'host':_0x87b0('0xd'),'port':0x18eb});var socket=require(_0x87b0('0xe'))(new Redis(config['redis']));var htmlEntities=require(_0x87b0('0xf'));require(_0x87b0('0x10'))[_0x87b0('0x11')](socket);var jayson=require(_0x87b0('0x12'));var client=jayson[_0x87b0('0x13')][_0x87b0('0x14')]({'port':0x232c});var client9003=jayson['client']['http']({'port':0x232b});var client9002=jayson[_0x87b0('0x13')][_0x87b0('0x14')]({'port':0x232a});function respondWithRpcPromise(_0x4d81e8,_0x435922,_0x3a32c,_0x1fce80){return new BPromise(function(_0x23fd7a,_0x138adb){var _0x361e80=_0x1fce80||client;return _0x361e80[_0x87b0('0x15')](_0x4d81e8,_0x3a32c)[_0x87b0('0x16')](function(_0x488d8d){logger[_0x87b0('0x17')]('MailMessage,\x20%s,\x20%s',_0x435922,'request\x20sent');logger['debug']('MailMessage,\x20%s,\x20%s,\x20%s',_0x435922,'request\x20sent',JSON[_0x87b0('0x18')](_0x488d8d));if(_0x488d8d[_0x87b0('0x19')]){if(_0x488d8d[_0x87b0('0x19')][_0x87b0('0x1a')]===0x1f4){logger[_0x87b0('0x19')]('MailMessage,\x20%s,\x20%s',_0x435922,_0x488d8d[_0x87b0('0x19')][_0x87b0('0x1b')]);return _0x138adb(_0x488d8d['error'][_0x87b0('0x1b')]);}logger[_0x87b0('0x19')](_0x87b0('0x1c'),_0x435922,_0x488d8d['error'][_0x87b0('0x1b')]);return _0x23fd7a(_0x488d8d['error'][_0x87b0('0x1b')]);}else{logger['info'](_0x87b0('0x1c'),_0x435922,_0x87b0('0x1d'));_0x23fd7a(_0x488d8d[_0x87b0('0x1e')]['message']);}})['catch'](function(_0x5ecd9e){logger[_0x87b0('0x19')](_0x87b0('0x1c'),_0x435922,_0x5ecd9e);_0x138adb(_0x5ecd9e);});});}function respondWithResult(_0x581e47,_0x2a7310){_0x2a7310=_0x2a7310||0xc8;return function(_0x2be17e){if(_0x2be17e){return _0x581e47['status'](_0x2a7310)['json'](_0x2be17e);}};}function respondWithFilteredResult(_0x962ca7,_0x22f916){return function(_0x218080){if(_0x218080){var _0x2d6062=typeof _0x22f916[_0x87b0('0x1f')]==='undefined'&&typeof _0x22f916['limit']===_0x87b0('0x20');var _0x3be2c2=_0x218080[_0x87b0('0x21')];var _0x9b4bfe=_0x2d6062?0x0:_0x22f916[_0x87b0('0x1f')];var _0x48576d=_0x2d6062?_0x218080[_0x87b0('0x21')]:_0x22f916['offset']+_0x22f916['limit'];var _0xcdb983;if(_0x48576d>=_0x3be2c2){_0x48576d=_0x3be2c2;_0xcdb983=0xc8;}else{_0xcdb983=0xce;}_0x962ca7[_0x87b0('0x22')](_0xcdb983);return _0x962ca7['set']('Content-Range',_0x9b4bfe+'-'+_0x48576d+'/'+_0x3be2c2)['json'](_0x218080);}return null;};}function saveUpdates(_0x8fa621){return function(_0x514a25){if(_0x514a25){return _0x514a25['update'](_0x8fa621)['then'](function(_0x3d932e){return _0x3d932e;});}return null;};}function removeEntity(_0x3fb0a4){return function(_0x43f487){if(_0x43f487){return _0x43f487['destroy']()[_0x87b0('0x16')](function(){_0x3fb0a4[_0x87b0('0x22')](0xcc)[_0x87b0('0x23')]();});}};}function handleEntityNotFound(_0x35e076){return function(_0xf024f3){if(!_0xf024f3){_0x35e076[_0x87b0('0x24')](0x194);}return _0xf024f3;};}function handleError(_0x47bcf2,_0x287984){_0x287984=_0x287984||0x1f4;return function(_0xcab5a2){logger[_0x87b0('0x19')](_0xcab5a2[_0x87b0('0x25')]);if(_0xcab5a2[_0x87b0('0x26')]){delete _0xcab5a2[_0x87b0('0x26')];}_0x47bcf2[_0x87b0('0x22')](_0x287984)['send'](_0xcab5a2);};}exports[_0x87b0('0x27')]=function(_0xf1fb90,_0x129b20){var _0x1032f7={},_0x10f19e={},_0x4d971a={'count':0x0,'rows':[]};var _0x5c72f3=_[_0x87b0('0x28')](db[_0x87b0('0x29')][_0x87b0('0x2a')],function(_0x31ddb2){return{'name':_0x31ddb2[_0x87b0('0x2b')],'type':_0x31ddb2[_0x87b0('0x2c')][_0x87b0('0x2d')]};});_0x10f19e[_0x87b0('0x2e')]=_['map'](_0x5c72f3,_0x87b0('0x26'));_0x10f19e[_0x87b0('0x2f')]=_[_0x87b0('0x30')](_0xf1fb90[_0x87b0('0x2f')]);_0x10f19e[_0x87b0('0x31')]=_[_0x87b0('0x32')](_0x10f19e[_0x87b0('0x2e')],_0x10f19e[_0x87b0('0x2f')]);_0x1032f7[_0x87b0('0x33')]=_[_0x87b0('0x32')](_0x10f19e['model'],qs[_0x87b0('0x34')](_0xf1fb90[_0x87b0('0x2f')][_0x87b0('0x34')]));_0x1032f7[_0x87b0('0x33')]=_0x1032f7[_0x87b0('0x33')][_0x87b0('0x35')]?_0x1032f7['attributes']:_0x10f19e[_0x87b0('0x2e')];if(!_0xf1fb90['query'][_0x87b0('0x36')](_0x87b0('0x37'))){_0x1032f7[_0x87b0('0x38')]=qs[_0x87b0('0x38')](_0xf1fb90['query'][_0x87b0('0x38')]);_0x1032f7[_0x87b0('0x1f')]=qs[_0x87b0('0x1f')](_0xf1fb90[_0x87b0('0x2f')][_0x87b0('0x1f')]);}_0x1032f7['order']=qs[_0x87b0('0x39')](_0xf1fb90[_0x87b0('0x2f')][_0x87b0('0x39')]);_0x1032f7[_0x87b0('0x3a')]=qs[_0x87b0('0x31')](_[_0x87b0('0x3b')](_0xf1fb90[_0x87b0('0x2f')],_0x10f19e[_0x87b0('0x31')]),_0x5c72f3);if(_0xf1fb90[_0x87b0('0x2f')][_0x87b0('0x3c')]){_0x1032f7[_0x87b0('0x3a')]=_[_0x87b0('0x3d')](_0x1032f7[_0x87b0('0x3a')],{'$or':_[_0x87b0('0x28')](_0x5c72f3,function(_0x6d6496){if(_0x6d6496[_0x87b0('0x2c')]!==_0x87b0('0x3e')){var _0x58b42d={};_0x58b42d[_0x6d6496[_0x87b0('0x26')]]={'$like':'%'+_0xf1fb90[_0x87b0('0x2f')][_0x87b0('0x3c')]+'%'};return _0x58b42d;}})});}_0x1032f7=_['merge']({},_0x1032f7,_0xf1fb90['options']);var _0x30000f={'where':_0x1032f7[_0x87b0('0x3a')]};return db[_0x87b0('0x29')]['count'](_0x30000f)['then'](function(_0x37efec){_0x4d971a[_0x87b0('0x21')]=_0x37efec;if(_0xf1fb90[_0x87b0('0x2f')]['includeAll']){_0x1032f7[_0x87b0('0x3f')]=[{'all':!![]}];}return db[_0x87b0('0x29')]['findAll'](_0x1032f7);})['then'](function(_0x565493){_0x4d971a[_0x87b0('0x40')]=_0x565493;return _0x4d971a;})[_0x87b0('0x16')](respondWithFilteredResult(_0x129b20,_0x1032f7))[_0x87b0('0x41')](handleError(_0x129b20,null));};exports[_0x87b0('0x42')]=function(_0x261fa1,_0x38ef46){var _0x3d9e47={'raw':!![],'where':{'id':_0x261fa1[_0x87b0('0x43')]['id']}},_0x1c7906={};_0x1c7906[_0x87b0('0x2e')]=_[_0x87b0('0x30')](db[_0x87b0('0x29')][_0x87b0('0x2a')]);_0x1c7906[_0x87b0('0x2f')]=_[_0x87b0('0x30')](_0x261fa1[_0x87b0('0x2f')]);_0x1c7906[_0x87b0('0x31')]=_[_0x87b0('0x32')](_0x1c7906['model'],_0x1c7906[_0x87b0('0x2f')]);_0x3d9e47[_0x87b0('0x33')]=_[_0x87b0('0x32')](_0x1c7906['model'],qs[_0x87b0('0x34')](_0x261fa1[_0x87b0('0x2f')][_0x87b0('0x34')]));_0x3d9e47[_0x87b0('0x33')]=_0x3d9e47[_0x87b0('0x33')][_0x87b0('0x35')]?_0x3d9e47['attributes']:_0x1c7906['model'];if(_0x261fa1[_0x87b0('0x2f')][_0x87b0('0x44')]){_0x3d9e47[_0x87b0('0x3f')]=[{'all':!![]}];}_0x3d9e47=_['merge']({},_0x3d9e47,_0x261fa1[_0x87b0('0x45')]);return db[_0x87b0('0x29')][_0x87b0('0x46')](_0x3d9e47)[_0x87b0('0x16')](handleEntityNotFound(_0x38ef46,null))[_0x87b0('0x16')](respondWithResult(_0x38ef46,null))[_0x87b0('0x41')](handleError(_0x38ef46,null));};exports['update']=function(_0x811dbb,_0xae3d74){if(_0x811dbb[_0x87b0('0x47')]['id']){delete _0x811dbb['body']['id'];}return db[_0x87b0('0x29')]['find']({'where':{'id':_0x811dbb['params']['id']}})[_0x87b0('0x16')](handleEntityNotFound(_0xae3d74,null))[_0x87b0('0x16')](saveUpdates(_0x811dbb[_0x87b0('0x47')],null))[_0x87b0('0x16')](respondWithResult(_0xae3d74,null))[_0x87b0('0x41')](handleError(_0xae3d74,null));};exports[_0x87b0('0x48')]=function(_0x1a9c71,_0x264b09){return db[_0x87b0('0x29')][_0x87b0('0x46')]({'where':{'id':_0x1a9c71[_0x87b0('0x43')]['id']}})['then'](handleEntityNotFound(_0x264b09,null))[_0x87b0('0x16')](removeEntity(_0x264b09,null))[_0x87b0('0x41')](handleError(_0x264b09,null));};exports[_0x87b0('0x49')]=function(_0x1b1e54,_0x217936){return db[_0x87b0('0x29')][_0x87b0('0x49')]()[_0x87b0('0x16')](respondWithResult(_0x217936,null))[_0x87b0('0x41')](handleError(_0x217936,null));};exports[_0x87b0('0x4a')]=function(_0x29d8e3,_0x532987){return db[_0x87b0('0x29')]['create'](_0x29d8e3['body'])[_0x87b0('0x16')](function(_0x315640){if(_0x315640){if(_0x315640[_0x87b0('0x4b')]===_0x87b0('0x4c')&&!_0x315640[_0x87b0('0x4d')]){var _0x109827,_0x5ecf58,_0x407a8c;if(_0x29d8e3[_0x87b0('0x47')]['to']){_0x5ecf58=_0x29d8e3[_0x87b0('0x47')]['to'][_0x87b0('0x4e')](',')[0x0];}return db[_0x87b0('0x4f')][_0x87b0('0x50')]({'where':{'id':_0x315640[_0x87b0('0x51')]},'include':[{'model':db[_0x87b0('0x52')],'as':'List','include':[{'model':db[_0x87b0('0x53')],'as':_0x87b0('0x54'),'where':{'email':_0x5ecf58},'limit':0x1,'order':[['updatedAt',_0x87b0('0x55')]]}]},{'model':db[_0x87b0('0x56')],'as':_0x87b0('0x57'),'raw':!![],'include':[{'model':db[_0x87b0('0x58')],'as':_0x87b0('0x58'),'raw':!![]}]}]})[_0x87b0('0x16')](function(_0x5d67bf){_0x109827=_0x5d67bf;if(!_0x109827||!_0x109827[_0x87b0('0x57')])return;var _0x1e36b1=_0x109827['getSmtpOptions']();if(_0x29d8e3[_0x87b0('0x47')][_0x87b0('0x59')]&&_0x29d8e3[_0x87b0('0x47')]['attachments'][_0x87b0('0x35')]){for(var _0x5cf3d7=0x0;_0x5cf3d7<_0x29d8e3[_0x87b0('0x47')][_0x87b0('0x59')][_0x87b0('0x35')];_0x5cf3d7+=0x1){_0x29d8e3[_0x87b0('0x47')][_0x87b0('0x59')][_0x5cf3d7]={'filename':_0x29d8e3[_0x87b0('0x47')][_0x87b0('0x59')][_0x5cf3d7][_0x87b0('0x26')],'path':path[_0x87b0('0x5a')](config[_0x87b0('0x5b')],_0x87b0('0x5c'),_0x29d8e3['body'][_0x87b0('0x59')][_0x5cf3d7]['basename'])};}}_0x407a8c={'account':_0x1e36b1,'message':_0x29d8e3['body']};return;})[_0x87b0('0x16')](function(){if(_0x109827['List']){if(_0x109827['List'][_0x87b0('0x54')][_0x87b0('0x35')]){return _0x109827[_0x87b0('0x5d')][_0x87b0('0x54')][0x0];}else{return db['CmContact']['create'](_['defaults'](_0x29d8e3['body'],{'firstName':_0x29d8e3['body']['to'],'email':_0x29d8e3[_0x87b0('0x47')]['to'],'phone':_0x29d8e3[_0x87b0('0x47')]['to'],'ListId':_0x109827[_0x87b0('0x5e')]}));}}else{throw new Error('List\x20not\x20found');}})[_0x87b0('0x16')](function(){if(_0x407a8c){return respondWithRpcPromise(_0x87b0('0x5f'),_0x87b0('0x60'),_0x407a8c,client9003)[_0x87b0('0x16')](function(_0x3879a5){return _0x315640[_0x87b0('0x61')]({'read':!![],'messageId':_0x3879a5['messageId'],'sentAt':moment()[_0x87b0('0x62')]('YYYY-MM-DD\x20HH:mm:ss')});})[_0x87b0('0x41')](function(_0x4aaa4c){logger[_0x87b0('0x19')]('%s',JSON[_0x87b0('0x18')](_0x4aaa4c));return _0x315640;});}return _0x315640;});}return _0x315640;}})[_0x87b0('0x16')](respondWithResult(_0x532987,0xc9))[_0x87b0('0x41')](handleError(_0x532987,null));};exports[_0x87b0('0x63')]=function(_0x3ab9a4,_0x4c6d32){var _0xbd73a6={'agent':{},'channel':_0x87b0('0x64')};if(_0x3ab9a4[_0x87b0('0x47')]['id']){delete _0x3ab9a4[_0x87b0('0x47')]['id'];}_0x3ab9a4['body'][_0x87b0('0x65')]=!![];_0x3ab9a4[_0x87b0('0x47')][_0x87b0('0x66')]=moment()[_0x87b0('0x62')](_0x87b0('0x67'));_0x3ab9a4['body'][_0x87b0('0x68')]=_0x3ab9a4['body'][_0x87b0('0x68')]||_0x3ab9a4[_0x87b0('0x69')]['id'];_0xbd73a6[_0x87b0('0x6a')]['id']=_0x3ab9a4[_0x87b0('0x47')][_0x87b0('0x68')];return db['MailMessage'][_0x87b0('0x46')]({'where':{'id':_0x3ab9a4[_0x87b0('0x43')]['id'],'UserId':null}})[_0x87b0('0x16')](handleEntityNotFound(_0x4c6d32,null))[_0x87b0('0x16')](saveUpdates(_0x3ab9a4[_0x87b0('0x47')],null))['then'](function(_0x15e5c5){if(_0x15e5c5){_0xbd73a6[_0x87b0('0x1b')]=_0x15e5c5[_0x87b0('0x6b')]({'plain':!![]});return db[_0x87b0('0x6c')][_0x87b0('0x46')]({'where':{'id':_0x15e5c5[_0x87b0('0x6d')]}});}return null;})['then'](handleEntityNotFound(_0x4c6d32,null))['then'](function(_0x4979bf){if(_0x4979bf){return _0x4979bf[_0x87b0('0x61')]({'UserId':_0x3ab9a4['body'][_0x87b0('0x68')],'read1stAt':_[_0x87b0('0x6e')](_0x4979bf[_0x87b0('0x6f')])?moment()[_0x87b0('0x62')](_0x87b0('0x67')):undefined});}return null;})[_0x87b0('0x16')](function(_0x2a9a32){if(_0x2a9a32){_0xbd73a6['interaction']=_0x2a9a32[_0x87b0('0x6b')]({'plain':!![]});interaction_log[_0x87b0('0x17')]('[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x3ab9a4['user']['id'],_0x3ab9a4[_0x87b0('0x69')][_0x87b0('0x26')],_0x3ab9a4[_0x87b0('0x69')][_0x87b0('0x70')],_0xbd73a6[_0x87b0('0x71')]['id'],_0x3ab9a4[_0x87b0('0x47')]?JSON[_0x87b0('0x18')](_0x3ab9a4[_0x87b0('0x47')]):_0x87b0('0x72'));return respondWithRpcPromise(_0x87b0('0x73'),'acceptMessage',_0xbd73a6);}return null;})[_0x87b0('0x16')](function(_0x5004de){var _0x411367=_0x87b0('0x74')+_0x5004de['message'][_0x87b0('0x75')];return db['sequelize'][_0x87b0('0x2f')](_0x411367,{'type':db[_0x87b0('0x76')]['QueryTypes'][_0x87b0('0x77')],'raw':!![]})[_0x87b0('0x16')](function(_0x3c6a88){return _0x3c6a88;});})['then'](function(_0x26b950){if(_0x26b950){_0xbd73a6[_0x87b0('0x1b')][_0x87b0('0x78')]=_0x26b950[0x0];if(!_0x3ab9a4['body'][_0x87b0('0x68')])return;return db['User'][_0x87b0('0x46')]({'where':{'id':_0x3ab9a4[_0x87b0('0x47')][_0x87b0('0x68')],'role':'agent'},'attributes':['id',_0x87b0('0x26'),'fullname',_0x87b0('0x79'),_0x87b0('0x7a')],'raw':!![]});}return null;})['then'](function(_0x4d4c51){if(!_0x4d4c51)return null;_0xbd73a6[_0x87b0('0x1b')]['agent']=_0x4d4c51;return _0xbd73a6;})[_0x87b0('0x16')](function(_0x4a1488){if(_0x4a1488){if(_0x3ab9a4[_0x87b0('0x47')][_0x87b0('0x7b')]){_0xbd73a6[_0x87b0('0x1b')][_0x87b0('0x7c')]=util['format'](_0x87b0('0x7d'),_0x3ab9a4[_0x87b0('0x69')]['name']);_0xbd73a6['message'][_0x87b0('0x7e')]=_0xbd73a6['channel'];_0xbd73a6[_0x87b0('0x1b')]['motionChannel']=_0xbd73a6[_0x87b0('0x7e')];_0xbd73a6[_0x87b0('0x1b')][_0x87b0('0x7f')]=_0x87b0('0x63');_0xbd73a6['message'][_0x87b0('0x47')]=htmlToText[_0x87b0('0x80')](_0xbd73a6[_0x87b0('0x1b')][_0x87b0('0x47')]);return respondWithRpcPromise(_0x87b0('0x81'),'EventManager',{'event':'acceptmessage','message':_0xbd73a6[_0x87b0('0x1b')]},client9002)[_0x87b0('0x16')](function(){return _0xbd73a6;});}return _0xbd73a6;}return null;})[_0x87b0('0x16')](respondWithResult(_0x4c6d32,null))[_0x87b0('0x41')](handleError(_0x4c6d32,null));};exports[_0x87b0('0x82')]=function(_0x5ba3eb,_0x6c90ce){var _0x27e6fc={'agent':{},'channel':'mail'};if(_0x5ba3eb['body']['id']){delete _0x5ba3eb[_0x87b0('0x47')]['id'];}_0x5ba3eb[_0x87b0('0x47')][_0x87b0('0x68')]=_0x5ba3eb[_0x87b0('0x47')]['UserId']||_0x5ba3eb['user']['id'];_0x27e6fc[_0x87b0('0x6a')]['id']=_0x5ba3eb[_0x87b0('0x47')][_0x87b0('0x68')];return db[_0x87b0('0x29')][_0x87b0('0x46')]({'where':{'id':_0x5ba3eb['params']['id'],'UserId':null}})[_0x87b0('0x16')](handleEntityNotFound(_0x6c90ce,null))[_0x87b0('0x16')](function(_0x3ffc2a){if(_0x3ffc2a){_0x27e6fc[_0x87b0('0x1b')]=_0x3ffc2a['get']({'plain':!![]});return db[_0x87b0('0x6c')]['find']({'where':{'id':_0x3ffc2a[_0x87b0('0x6d')]}});}return null;})[_0x87b0('0x16')](handleEntityNotFound(_0x6c90ce,null))[_0x87b0('0x16')](function(_0x5d2cbe){if(_0x5d2cbe){_0x27e6fc[_0x87b0('0x71')]=_0x5d2cbe[_0x87b0('0x6b')]({'plain':!![]});interaction_log[_0x87b0('0x17')](_0x87b0('0x83'),_0x5ba3eb[_0x87b0('0x69')]['id'],_0x5ba3eb[_0x87b0('0x69')]['name'],_0x5ba3eb['user'][_0x87b0('0x70')],_0x27e6fc[_0x87b0('0x71')]['id'],_0x5ba3eb[_0x87b0('0x47')]?JSON[_0x87b0('0x18')](_0x5ba3eb[_0x87b0('0x47')]):_0x87b0('0x72'));return respondWithRpcPromise(_0x87b0('0x84'),'rejectMessage',_0x27e6fc);}return null;})[_0x87b0('0x16')](function(_0x23307e){var _0x3d1083=_0x87b0('0x74')+_0x23307e['message'][_0x87b0('0x75')];return db[_0x87b0('0x85')][_0x87b0('0x2f')](_0x3d1083,{'type':db[_0x87b0('0x76')]['QueryTypes'][_0x87b0('0x77')],'raw':!![]})[_0x87b0('0x16')](function(_0x53cd5e){return _0x53cd5e;});})[_0x87b0('0x16')](function(_0x16da81){if(_0x16da81){_0x27e6fc[_0x87b0('0x1b')][_0x87b0('0x78')]=_0x16da81[0x0];if(!_0x5ba3eb['body'][_0x87b0('0x68')])return;return db[_0x87b0('0x86')]['find']({'where':{'id':_0x5ba3eb[_0x87b0('0x47')][_0x87b0('0x68')],'role':_0x87b0('0x6a')},'attributes':['id','name',_0x87b0('0x87'),_0x87b0('0x79'),'internal'],'raw':!![]});}return null;})[_0x87b0('0x16')](function(_0x24e571){if(!_0x24e571)return null;_0x27e6fc[_0x87b0('0x1b')]['agent']=_0x24e571;return _0x27e6fc;})[_0x87b0('0x16')](function(_0x559c5b){if(_0x559c5b){_0x559c5b[_0x87b0('0x1b')][_0x87b0('0x7c')]=util[_0x87b0('0x62')](_0x87b0('0x7d'),_0x5ba3eb[_0x87b0('0x69')][_0x87b0('0x26')]);_0x559c5b[_0x87b0('0x1b')]['channel']=_0x27e6fc[_0x87b0('0x7e')];_0x559c5b[_0x87b0('0x1b')]['motionChannel']=_0x27e6fc[_0x87b0('0x7e')];_0x559c5b[_0x87b0('0x1b')]['event']=_0x87b0('0x82');_0x559c5b[_0x87b0('0x1b')]['body']=htmlToText[_0x87b0('0x80')](_0x27e6fc[_0x87b0('0x1b')][_0x87b0('0x47')]);respondWithRpcPromise(_0x87b0('0x81'),_0x87b0('0x81'),{'event':'rejectmessage','message':_0x559c5b[_0x87b0('0x1b')]},client9002);return _0x27e6fc;}return null;})[_0x87b0('0x16')](respondWithResult(_0x6c90ce,null))[_0x87b0('0x41')](handleError(_0x6c90ce,null));};exports[_0x87b0('0x88')]=function(_0x444ecc,_0x9320c3){var _0x47c360=moment()[_0x87b0('0x89')]()[_0x87b0('0x8a')]();var _0x484724=path[_0x87b0('0x5a')](config[_0x87b0('0x5b')],'server','files',_0x87b0('0x8b'));var _0x33e965=path['join'](config['root'],_0x87b0('0x8c'),_0x87b0('0x8d'),_0x87b0('0x59'));var _0x16f9d1=util[_0x87b0('0x62')](_0x87b0('0x8e'),_0x47c360);return db['MailMessage'][_0x87b0('0x46')]({'where':{'id':_0x444ecc[_0x87b0('0x43')]['id']},'attributes':['id',_0x87b0('0x47'),_0x87b0('0x8f'),'to','cc',_0x87b0('0x90'),_0x87b0('0x91'),_0x87b0('0x92')],'include':_0x444ecc[_0x87b0('0x2f')][_0x87b0('0x59')]?[{'model':db[_0x87b0('0x93')],'as':_0x87b0('0x94')}]:undefined})[_0x87b0('0x16')](handleEntityNotFound(_0x9320c3,null))[_0x87b0('0x16')](function(_0x3dc3ab){if(_0x3dc3ab){var _0x1930a3=_0x3dc3ab;var _0x18da91={'from':_0x1930a3[_0x87b0('0x8f')],'to':_0x1930a3['to'],'subject':_0x1930a3['subject'],'html':htmlEntities[_0x87b0('0x95')](_0x1930a3[_0x87b0('0x47')]),'headers':{'Date':moment(_0x1930a3[_0x87b0('0x92')])[_0x87b0('0x62')](_0x87b0('0x96'))},'attachments':[]};if(_0x3dc3ab['cc']){_0x18da91[_0x87b0('0x97')]['Cc']=_0x3dc3ab['cc'];}if(_0x3dc3ab[_0x87b0('0x90')]){_0x18da91[_0x87b0('0x97')][_0x87b0('0x98')]=_0x3dc3ab[_0x87b0('0x90')];}return new BPromise(function(_0x56aa3a,_0x297de0){if(_0x3dc3ab[_0x87b0('0x94')]){for(var _0xbffce5=0x0;_0xbffce5<_0x3dc3ab[_0x87b0('0x94')]['length'];_0xbffce5++){var _0x2aae07=_0x3dc3ab[_0x87b0('0x94')][_0xbffce5];var _0x27aa79=path['join'](_0x33e965,_0x2aae07['basename']);if(fs['existsSync'](_0x27aa79)){_0x18da91['attachments'][_0x87b0('0x99')]({'name':_0x2aae07[_0x87b0('0x26')],'contentType':_0x2aae07['type'],'data':fs[_0x87b0('0x9a')](_0x27aa79)});}}}emlformat[_0x87b0('0x9b')](_0x18da91,function(_0x323bd6,_0x2ebcb2){if(_0x323bd6)return _0x297de0(_0x323bd6);fs[_0x87b0('0x9c')](path[_0x87b0('0x5a')](_0x484724,_0x16f9d1),_0x2ebcb2);return _0x56aa3a(_0x2ebcb2);});});}})[_0x87b0('0x16')](function(_0x28bcf8){if(_0x28bcf8){return _0x9320c3[_0x87b0('0x88')](path[_0x87b0('0x5a')](_0x484724,_0x16f9d1),_0x16f9d1,function(_0x42c685){if(!_0x42c685)fs[_0x87b0('0x9d')](path[_0x87b0('0x5a')](_0x484724,_0x16f9d1));});}})[_0x87b0('0x41')](handleError(_0x9320c3,null));}; \ No newline at end of file +var _0xe9bd=['socket.io-emitter','html-entities','./mailMessage.socket','register','jayson/promise','client','http','request','then','MailMessage,\x20%s,\x20%s','request\x20sent','MailMessage,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','status','json','offset','count','limit','set','Content-Range','update','end','sendStatus','stack','name','send','index','map','MailMessage','rawAttributes','fieldName','type','model','query','keys','filters','attributes','intersection','fields','hasOwnProperty','sort','pick','filter','where','merge','options','includeAll','include','findAll','show','params','find','body','describe','create','direction','out','secret','split','MailAccount','findOne','MailAccountId','CmList','List','CmContact','Contacts','updatedAt','DESC','MailServerOut','Smtp','attachments','length','join','root','basename','ListId','List\x20not\x20found','SendMail','sendMail','YYYY-MM-DD\x20HH:mm:ss','stringify','accept','mail','read','format','UserId','get','MailInteraction','MailInteractionId','isNil','read1stAt','interaction','[MAILMESSAGE: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','sequelize','Sequelize','SELECT','contact','email','agent','manual','interface','SIP/%s','channel','event','fromString','EventManager','acceptmessage','reject','[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','User','fullname','internal','motionChannel','download','unix','toString','tmp','files','from','bcc','subject','createdAt','Attachments','decode','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Bcc','existsSync','readFileSync','build','writeFileSync','unlinkSync','eml-format','moment','path','lodash','ioredis','html-to-text','../../components/parsers/qs','../../config/logger','api','mail-interactions','../../config/environment','../../mysqldb','defaults','redis','localhost'];(function(_0xd050c6,_0x58ffb4){var _0x7278a=function(_0x16d03e){while(--_0x16d03e){_0xd050c6['push'](_0xd050c6['shift']());}};_0x7278a(++_0x58ffb4);}(_0xe9bd,0x1ce));var _0xde9b=function(_0x451451,_0xe3c88f){_0x451451=_0x451451-0x0;var _0x48110a=_0xe9bd[_0x451451];return _0x48110a;};'use strict';var emlformat=require(_0xde9b('0x0'));var moment=require(_0xde9b('0x1'));var BPromise=require('bluebird');var util=require('util');var path=require(_0xde9b('0x2'));var fs=require('fs');var _=require(_0xde9b('0x3'));var Redis=require(_0xde9b('0x4'));var htmlToText=require(_0xde9b('0x5'));var qs=require(_0xde9b('0x6'));var logger=require(_0xde9b('0x7'))(_0xde9b('0x8'));var interaction_log=require('../../config/logger')(_0xde9b('0x9'));var config=require(_0xde9b('0xa'));var db=require(_0xde9b('0xb'))['db'];config['redis']=_[_0xde9b('0xc')](config[_0xde9b('0xd')],{'host':_0xde9b('0xe'),'port':0x18eb});var socket=require(_0xde9b('0xf'))(new Redis(config['redis']));var htmlEntities=require(_0xde9b('0x10'));require(_0xde9b('0x11'))[_0xde9b('0x12')](socket);var jayson=require(_0xde9b('0x13'));var client=jayson[_0xde9b('0x14')][_0xde9b('0x15')]({'port':0x232c});var client9003=jayson['client'][_0xde9b('0x15')]({'port':0x232b});var client9002=jayson[_0xde9b('0x14')][_0xde9b('0x15')]({'port':0x232a});function respondWithRpcPromise(_0x495f47,_0x49f499,_0xeb8af4,_0x3c4083){return new BPromise(function(_0x2c2fd6,_0x39d0fb){var _0x2f0202=_0x3c4083||client;return _0x2f0202[_0xde9b('0x16')](_0x495f47,_0xeb8af4)[_0xde9b('0x17')](function(_0x843ebb){logger['info'](_0xde9b('0x18'),_0x49f499,_0xde9b('0x19'));logger['debug'](_0xde9b('0x1a'),_0x49f499,'request\x20sent',JSON['stringify'](_0x843ebb));if(_0x843ebb[_0xde9b('0x1b')]){if(_0x843ebb[_0xde9b('0x1b')][_0xde9b('0x1c')]===0x1f4){logger[_0xde9b('0x1b')](_0xde9b('0x18'),_0x49f499,_0x843ebb['error']['message']);return _0x39d0fb(_0x843ebb['error'][_0xde9b('0x1d')]);}logger[_0xde9b('0x1b')](_0xde9b('0x18'),_0x49f499,_0x843ebb[_0xde9b('0x1b')]['message']);return _0x2c2fd6(_0x843ebb[_0xde9b('0x1b')][_0xde9b('0x1d')]);}else{logger[_0xde9b('0x1e')]('MailMessage,\x20%s,\x20%s',_0x49f499,_0xde9b('0x19'));_0x2c2fd6(_0x843ebb[_0xde9b('0x1f')][_0xde9b('0x1d')]);}})[_0xde9b('0x20')](function(_0x2bc9c3){logger[_0xde9b('0x1b')](_0xde9b('0x18'),_0x49f499,_0x2bc9c3);_0x39d0fb(_0x2bc9c3);});});}function respondWithResult(_0x46fe6e,_0x2cb073){_0x2cb073=_0x2cb073||0xc8;return function(_0x1d9a16){if(_0x1d9a16){return _0x46fe6e[_0xde9b('0x21')](_0x2cb073)[_0xde9b('0x22')](_0x1d9a16);}};}function respondWithFilteredResult(_0x27ee7c,_0xca25b9){return function(_0x361f94){if(_0x361f94){var _0x40d1c5=typeof _0xca25b9[_0xde9b('0x23')]==='undefined'&&typeof _0xca25b9['limit']==='undefined';var _0x4e2be4=_0x361f94[_0xde9b('0x24')];var _0x3e018b=_0x40d1c5?0x0:_0xca25b9[_0xde9b('0x23')];var _0x1bd57b=_0x40d1c5?_0x361f94[_0xde9b('0x24')]:_0xca25b9[_0xde9b('0x23')]+_0xca25b9[_0xde9b('0x25')];var _0xe8b23;if(_0x1bd57b>=_0x4e2be4){_0x1bd57b=_0x4e2be4;_0xe8b23=0xc8;}else{_0xe8b23=0xce;}_0x27ee7c[_0xde9b('0x21')](_0xe8b23);return _0x27ee7c[_0xde9b('0x26')](_0xde9b('0x27'),_0x3e018b+'-'+_0x1bd57b+'/'+_0x4e2be4)['json'](_0x361f94);}return null;};}function saveUpdates(_0x114317){return function(_0x15b6de){if(_0x15b6de){return _0x15b6de[_0xde9b('0x28')](_0x114317)[_0xde9b('0x17')](function(_0xf6a384){return _0xf6a384;});}return null;};}function removeEntity(_0x3d84bd){return function(_0x16a07e){if(_0x16a07e){return _0x16a07e['destroy']()['then'](function(){_0x3d84bd['status'](0xcc)[_0xde9b('0x29')]();});}};}function handleEntityNotFound(_0x13c80f){return function(_0x283dbe){if(!_0x283dbe){_0x13c80f[_0xde9b('0x2a')](0x194);}return _0x283dbe;};}function handleError(_0x2f7e74,_0x16d613){_0x16d613=_0x16d613||0x1f4;return function(_0x2ec78b){logger[_0xde9b('0x1b')](_0x2ec78b[_0xde9b('0x2b')]);if(_0x2ec78b['name']){delete _0x2ec78b[_0xde9b('0x2c')];}_0x2f7e74[_0xde9b('0x21')](_0x16d613)[_0xde9b('0x2d')](_0x2ec78b);};}exports[_0xde9b('0x2e')]=function(_0x1e7c17,_0x190b62){var _0x5ab0cd={},_0x15b3c9={},_0x1bce67={'count':0x0,'rows':[]};var _0x517a9e=_[_0xde9b('0x2f')](db[_0xde9b('0x30')][_0xde9b('0x31')],function(_0x3b62c3){return{'name':_0x3b62c3[_0xde9b('0x32')],'type':_0x3b62c3[_0xde9b('0x33')]['key']};});_0x15b3c9[_0xde9b('0x34')]=_[_0xde9b('0x2f')](_0x517a9e,_0xde9b('0x2c'));_0x15b3c9[_0xde9b('0x35')]=_[_0xde9b('0x36')](_0x1e7c17['query']);_0x15b3c9[_0xde9b('0x37')]=_['intersection'](_0x15b3c9[_0xde9b('0x34')],_0x15b3c9[_0xde9b('0x35')]);_0x5ab0cd[_0xde9b('0x38')]=_[_0xde9b('0x39')](_0x15b3c9[_0xde9b('0x34')],qs[_0xde9b('0x3a')](_0x1e7c17['query'][_0xde9b('0x3a')]));_0x5ab0cd['attributes']=_0x5ab0cd[_0xde9b('0x38')]['length']?_0x5ab0cd[_0xde9b('0x38')]:_0x15b3c9[_0xde9b('0x34')];if(!_0x1e7c17[_0xde9b('0x35')][_0xde9b('0x3b')]('nolimit')){_0x5ab0cd[_0xde9b('0x25')]=qs[_0xde9b('0x25')](_0x1e7c17[_0xde9b('0x35')][_0xde9b('0x25')]);_0x5ab0cd[_0xde9b('0x23')]=qs[_0xde9b('0x23')](_0x1e7c17['query'][_0xde9b('0x23')]);}_0x5ab0cd['order']=qs[_0xde9b('0x3c')](_0x1e7c17['query']['sort']);_0x5ab0cd['where']=qs[_0xde9b('0x37')](_[_0xde9b('0x3d')](_0x1e7c17['query'],_0x15b3c9[_0xde9b('0x37')]),_0x517a9e);if(_0x1e7c17[_0xde9b('0x35')][_0xde9b('0x3e')]){_0x5ab0cd[_0xde9b('0x3f')]=_[_0xde9b('0x40')](_0x5ab0cd[_0xde9b('0x3f')],{'$or':_[_0xde9b('0x2f')](_0x517a9e,function(_0x5f3f79){if(_0x5f3f79[_0xde9b('0x33')]!=='VIRTUAL'){var _0x32cb78={};_0x32cb78[_0x5f3f79['name']]={'$like':'%'+_0x1e7c17[_0xde9b('0x35')][_0xde9b('0x3e')]+'%'};return _0x32cb78;}})});}_0x5ab0cd=_[_0xde9b('0x40')]({},_0x5ab0cd,_0x1e7c17[_0xde9b('0x41')]);var _0x4999b7={'where':_0x5ab0cd['where']};return db[_0xde9b('0x30')]['count'](_0x4999b7)[_0xde9b('0x17')](function(_0x1fb915){_0x1bce67[_0xde9b('0x24')]=_0x1fb915;if(_0x1e7c17[_0xde9b('0x35')][_0xde9b('0x42')]){_0x5ab0cd[_0xde9b('0x43')]=[{'all':!![]}];}return db[_0xde9b('0x30')][_0xde9b('0x44')](_0x5ab0cd);})[_0xde9b('0x17')](function(_0x1dc099){_0x1bce67['rows']=_0x1dc099;return _0x1bce67;})[_0xde9b('0x17')](respondWithFilteredResult(_0x190b62,_0x5ab0cd))[_0xde9b('0x20')](handleError(_0x190b62,null));};exports[_0xde9b('0x45')]=function(_0x45dbb4,_0xf9d020){var _0x2b2cb3={'raw':!![],'where':{'id':_0x45dbb4[_0xde9b('0x46')]['id']}},_0x2f3123={};_0x2f3123[_0xde9b('0x34')]=_[_0xde9b('0x36')](db['MailMessage'][_0xde9b('0x31')]);_0x2f3123[_0xde9b('0x35')]=_['keys'](_0x45dbb4['query']);_0x2f3123[_0xde9b('0x37')]=_[_0xde9b('0x39')](_0x2f3123[_0xde9b('0x34')],_0x2f3123[_0xde9b('0x35')]);_0x2b2cb3[_0xde9b('0x38')]=_[_0xde9b('0x39')](_0x2f3123[_0xde9b('0x34')],qs[_0xde9b('0x3a')](_0x45dbb4[_0xde9b('0x35')][_0xde9b('0x3a')]));_0x2b2cb3[_0xde9b('0x38')]=_0x2b2cb3[_0xde9b('0x38')]['length']?_0x2b2cb3[_0xde9b('0x38')]:_0x2f3123[_0xde9b('0x34')];if(_0x45dbb4['query'][_0xde9b('0x42')]){_0x2b2cb3['include']=[{'all':!![]}];}_0x2b2cb3=_[_0xde9b('0x40')]({},_0x2b2cb3,_0x45dbb4[_0xde9b('0x41')]);return db[_0xde9b('0x30')][_0xde9b('0x47')](_0x2b2cb3)['then'](handleEntityNotFound(_0xf9d020,null))[_0xde9b('0x17')](respondWithResult(_0xf9d020,null))['catch'](handleError(_0xf9d020,null));};exports['update']=function(_0x237081,_0x4972e6){if(_0x237081[_0xde9b('0x48')]['id']){delete _0x237081[_0xde9b('0x48')]['id'];}return db[_0xde9b('0x30')]['find']({'where':{'id':_0x237081[_0xde9b('0x46')]['id']}})[_0xde9b('0x17')](handleEntityNotFound(_0x4972e6,null))[_0xde9b('0x17')](saveUpdates(_0x237081['body'],null))[_0xde9b('0x17')](respondWithResult(_0x4972e6,null))['catch'](handleError(_0x4972e6,null));};exports['destroy']=function(_0x3e962b,_0x5a2d3e){return db['MailMessage'][_0xde9b('0x47')]({'where':{'id':_0x3e962b[_0xde9b('0x46')]['id']}})['then'](handleEntityNotFound(_0x5a2d3e,null))['then'](removeEntity(_0x5a2d3e,null))[_0xde9b('0x20')](handleError(_0x5a2d3e,null));};exports[_0xde9b('0x49')]=function(_0x593551,_0x543437){return db[_0xde9b('0x30')][_0xde9b('0x49')]()[_0xde9b('0x17')](respondWithResult(_0x543437,null))[_0xde9b('0x20')](handleError(_0x543437,null));};exports[_0xde9b('0x4a')]=function(_0x1eb0b6,_0x81adc){return db['MailMessage']['create'](_0x1eb0b6[_0xde9b('0x48')])[_0xde9b('0x17')](function(_0x3fc186){if(_0x3fc186){if(_0x3fc186[_0xde9b('0x4b')]===_0xde9b('0x4c')&&!_0x3fc186[_0xde9b('0x4d')]){var _0xfd39a8,_0x1ca959,_0x40aa13;if(_0x1eb0b6[_0xde9b('0x48')]['to']){_0x1ca959=_0x1eb0b6[_0xde9b('0x48')]['to'][_0xde9b('0x4e')](',')[0x0];}return db[_0xde9b('0x4f')][_0xde9b('0x50')]({'where':{'id':_0x3fc186[_0xde9b('0x51')]},'include':[{'model':db[_0xde9b('0x52')],'as':_0xde9b('0x53'),'include':[{'model':db[_0xde9b('0x54')],'as':_0xde9b('0x55'),'where':{'email':_0x1ca959},'limit':0x1,'order':[[_0xde9b('0x56'),_0xde9b('0x57')]]}]},{'model':db[_0xde9b('0x58')],'as':_0xde9b('0x59'),'raw':!![],'include':[{'model':db['CloudProvider'],'as':'CloudProvider','raw':!![]}]}]})['then'](function(_0x325ece){_0xfd39a8=_0x325ece;if(!_0xfd39a8||!_0xfd39a8[_0xde9b('0x59')])return;var _0x37b528=_0xfd39a8['getSmtpOptions']();if(_0x1eb0b6[_0xde9b('0x48')][_0xde9b('0x5a')]&&_0x1eb0b6['body'][_0xde9b('0x5a')][_0xde9b('0x5b')]){for(var _0x457f53=0x0;_0x457f53<_0x1eb0b6['body'][_0xde9b('0x5a')][_0xde9b('0x5b')];_0x457f53+=0x1){_0x1eb0b6['body'][_0xde9b('0x5a')][_0x457f53]={'filename':_0x1eb0b6['body'][_0xde9b('0x5a')][_0x457f53]['name'],'path':path[_0xde9b('0x5c')](config[_0xde9b('0x5d')],'server/files/attachments',_0x1eb0b6['body'][_0xde9b('0x5a')][_0x457f53][_0xde9b('0x5e')])};}}_0x40aa13={'account':_0x37b528,'message':_0x1eb0b6[_0xde9b('0x48')]};return;})[_0xde9b('0x17')](function(){if(_0xfd39a8[_0xde9b('0x53')]){if(_0xfd39a8['List'][_0xde9b('0x55')][_0xde9b('0x5b')]){return _0xfd39a8[_0xde9b('0x53')][_0xde9b('0x55')][0x0];}else{return db[_0xde9b('0x54')]['create'](_['defaults'](_0x1eb0b6[_0xde9b('0x48')],{'firstName':_0x1eb0b6[_0xde9b('0x48')]['to'],'email':_0x1eb0b6[_0xde9b('0x48')]['to'],'phone':_0x1eb0b6[_0xde9b('0x48')]['to'],'ListId':_0xfd39a8[_0xde9b('0x5f')]}));}}else{throw new Error(_0xde9b('0x60'));}})['then'](function(){if(_0x40aa13){return respondWithRpcPromise(_0xde9b('0x61'),_0xde9b('0x62'),_0x40aa13,client9003)[_0xde9b('0x17')](function(_0x4358c4){return _0x3fc186['update']({'read':!![],'messageId':_0x4358c4['messageId'],'sentAt':moment()['format'](_0xde9b('0x63'))});})[_0xde9b('0x20')](function(_0x279d8e){logger[_0xde9b('0x1b')]('%s',JSON[_0xde9b('0x64')](_0x279d8e));return _0x3fc186;});}return _0x3fc186;});}return _0x3fc186;}})[_0xde9b('0x17')](respondWithResult(_0x81adc,0xc9))[_0xde9b('0x20')](handleError(_0x81adc,null));};exports[_0xde9b('0x65')]=function(_0x3870db,_0x57bddf){var _0x23fdc7={'agent':{},'channel':_0xde9b('0x66')};if(_0x3870db['body']['id']){delete _0x3870db['body']['id'];}_0x3870db[_0xde9b('0x48')][_0xde9b('0x67')]=!![];_0x3870db[_0xde9b('0x48')]['readAt']=moment()[_0xde9b('0x68')](_0xde9b('0x63'));_0x3870db[_0xde9b('0x48')][_0xde9b('0x69')]=_0x3870db['body'][_0xde9b('0x69')]||_0x3870db['user']['id'];_0x23fdc7['agent']['id']=_0x3870db[_0xde9b('0x48')][_0xde9b('0x69')];return db[_0xde9b('0x30')][_0xde9b('0x47')]({'where':{'id':_0x3870db[_0xde9b('0x46')]['id'],'UserId':null}})[_0xde9b('0x17')](handleEntityNotFound(_0x57bddf,null))[_0xde9b('0x17')](saveUpdates(_0x3870db['body'],null))[_0xde9b('0x17')](function(_0x58b9d2){if(_0x58b9d2){_0x23fdc7['message']=_0x58b9d2[_0xde9b('0x6a')]({'plain':!![]});return db[_0xde9b('0x6b')][_0xde9b('0x47')]({'where':{'id':_0x58b9d2[_0xde9b('0x6c')]}});}return null;})[_0xde9b('0x17')](handleEntityNotFound(_0x57bddf,null))[_0xde9b('0x17')](function(_0x37bf3f){if(_0x37bf3f){return _0x37bf3f[_0xde9b('0x28')]({'UserId':_0x3870db['body'][_0xde9b('0x69')],'read1stAt':_[_0xde9b('0x6d')](_0x37bf3f[_0xde9b('0x6e')])?moment()[_0xde9b('0x68')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})['then'](function(_0x55dacd){if(_0x55dacd){_0x23fdc7[_0xde9b('0x6f')]=_0x55dacd[_0xde9b('0x6a')]({'plain':!![]});interaction_log[_0xde9b('0x1e')](_0xde9b('0x70'),_0x3870db[_0xde9b('0x71')]['id'],_0x3870db[_0xde9b('0x71')][_0xde9b('0x2c')],_0x3870db[_0xde9b('0x71')][_0xde9b('0x72')],_0x23fdc7[_0xde9b('0x6f')]['id'],_0x3870db[_0xde9b('0x48')]?JSON[_0xde9b('0x64')](_0x3870db[_0xde9b('0x48')]):_0xde9b('0x73'));return respondWithRpcPromise('AcceptMessage',_0xde9b('0x74'),_0x23fdc7);}return null;})[_0xde9b('0x17')](function(_0x5911ef){var _0x45b250=_0xde9b('0x75')+_0x5911ef[_0xde9b('0x1d')][_0xde9b('0x76')];return db[_0xde9b('0x77')][_0xde9b('0x35')](_0x45b250,{'type':db[_0xde9b('0x78')]['QueryTypes'][_0xde9b('0x79')],'raw':!![]})[_0xde9b('0x17')](function(_0x4df348){return _0x4df348;});})['then'](function(_0x4ada32){if(_0x4ada32){_0x23fdc7['message'][_0xde9b('0x7a')]=_0x4ada32[0x0];if(!_0x3870db['body']['UserId'])return;return db['User'][_0xde9b('0x47')]({'where':{'id':_0x3870db[_0xde9b('0x48')][_0xde9b('0x69')],'role':'agent'},'attributes':['id',_0xde9b('0x2c'),'fullname',_0xde9b('0x7b'),'internal'],'raw':!![]});}return null;})[_0xde9b('0x17')](function(_0x264516){if(!_0x264516)return null;_0x23fdc7['message'][_0xde9b('0x7c')]=_0x264516;return _0x23fdc7;})[_0xde9b('0x17')](function(_0x188fff){if(_0x188fff){if(_0x3870db[_0xde9b('0x48')][_0xde9b('0x7d')]){_0x23fdc7[_0xde9b('0x1d')][_0xde9b('0x7e')]=util['format'](_0xde9b('0x7f'),_0x3870db[_0xde9b('0x71')][_0xde9b('0x2c')]);_0x23fdc7['message'][_0xde9b('0x80')]=_0x23fdc7[_0xde9b('0x80')];_0x23fdc7[_0xde9b('0x1d')]['motionChannel']=_0x23fdc7[_0xde9b('0x80')];_0x23fdc7[_0xde9b('0x1d')][_0xde9b('0x81')]=_0xde9b('0x65');_0x23fdc7['message'][_0xde9b('0x48')]=htmlToText[_0xde9b('0x82')](_0x23fdc7['message'][_0xde9b('0x48')]);return respondWithRpcPromise(_0xde9b('0x83'),'EventManager',{'event':_0xde9b('0x84'),'message':_0x23fdc7['message']},client9002)[_0xde9b('0x17')](function(){return _0x23fdc7;});}return _0x23fdc7;}return null;})[_0xde9b('0x17')](respondWithResult(_0x57bddf,null))['catch'](handleError(_0x57bddf,null));};exports[_0xde9b('0x85')]=function(_0x4bf18b,_0x178c79){var _0x1dff77={'agent':{},'channel':_0xde9b('0x66')};if(_0x4bf18b[_0xde9b('0x48')]['id']){delete _0x4bf18b['body']['id'];}_0x4bf18b[_0xde9b('0x48')][_0xde9b('0x69')]=_0x4bf18b[_0xde9b('0x48')][_0xde9b('0x69')]||_0x4bf18b['user']['id'];_0x1dff77[_0xde9b('0x7c')]['id']=_0x4bf18b['body'][_0xde9b('0x69')];return db['MailMessage'][_0xde9b('0x47')]({'where':{'id':_0x4bf18b['params']['id'],'UserId':null}})[_0xde9b('0x17')](handleEntityNotFound(_0x178c79,null))['then'](function(_0x4caa66){if(_0x4caa66){_0x1dff77[_0xde9b('0x1d')]=_0x4caa66[_0xde9b('0x6a')]({'plain':!![]});return db[_0xde9b('0x6b')]['find']({'where':{'id':_0x4caa66[_0xde9b('0x6c')]}});}return null;})[_0xde9b('0x17')](handleEntityNotFound(_0x178c79,null))[_0xde9b('0x17')](function(_0x5c0000){if(_0x5c0000){_0x1dff77[_0xde9b('0x6f')]=_0x5c0000[_0xde9b('0x6a')]({'plain':!![]});interaction_log[_0xde9b('0x1e')](_0xde9b('0x86'),_0x4bf18b[_0xde9b('0x71')]['id'],_0x4bf18b['user'][_0xde9b('0x2c')],_0x4bf18b[_0xde9b('0x71')][_0xde9b('0x72')],_0x1dff77[_0xde9b('0x6f')]['id'],_0x4bf18b[_0xde9b('0x48')]?JSON[_0xde9b('0x64')](_0x4bf18b[_0xde9b('0x48')]):_0xde9b('0x73'));return respondWithRpcPromise(_0xde9b('0x87'),'rejectMessage',_0x1dff77);}return null;})[_0xde9b('0x17')](function(_0x209a50){var _0x35f6e9=_0xde9b('0x75')+_0x209a50[_0xde9b('0x1d')][_0xde9b('0x76')];return db['sequelize'][_0xde9b('0x35')](_0x35f6e9,{'type':db[_0xde9b('0x78')]['QueryTypes'][_0xde9b('0x79')],'raw':!![]})[_0xde9b('0x17')](function(_0x550364){return _0x550364;});})['then'](function(_0x34393c){if(_0x34393c){_0x1dff77[_0xde9b('0x1d')]['contact']=_0x34393c[0x0];if(!_0x4bf18b[_0xde9b('0x48')][_0xde9b('0x69')])return;return db[_0xde9b('0x88')]['find']({'where':{'id':_0x4bf18b[_0xde9b('0x48')][_0xde9b('0x69')],'role':_0xde9b('0x7c')},'attributes':['id',_0xde9b('0x2c'),_0xde9b('0x89'),_0xde9b('0x7b'),_0xde9b('0x8a')],'raw':!![]});}return null;})[_0xde9b('0x17')](function(_0xbdc25d){if(!_0xbdc25d)return null;_0x1dff77[_0xde9b('0x1d')][_0xde9b('0x7c')]=_0xbdc25d;return _0x1dff77;})[_0xde9b('0x17')](function(_0x509714){if(_0x509714){_0x509714['message']['interface']=util['format']('SIP/%s',_0x4bf18b['user']['name']);_0x509714[_0xde9b('0x1d')]['channel']=_0x1dff77[_0xde9b('0x80')];_0x509714[_0xde9b('0x1d')][_0xde9b('0x8b')]=_0x1dff77[_0xde9b('0x80')];_0x509714[_0xde9b('0x1d')]['event']=_0xde9b('0x85');_0x509714['message'][_0xde9b('0x48')]=htmlToText[_0xde9b('0x82')](_0x1dff77[_0xde9b('0x1d')][_0xde9b('0x48')]);respondWithRpcPromise(_0xde9b('0x83'),_0xde9b('0x83'),{'event':'rejectmessage','message':_0x509714[_0xde9b('0x1d')]},client9002);return _0x1dff77;}return null;})[_0xde9b('0x17')](respondWithResult(_0x178c79,null))['catch'](handleError(_0x178c79,null));};exports[_0xde9b('0x8c')]=function(_0x44506c,_0x1b2f5c){var _0x58d692=moment()[_0xde9b('0x8d')]()[_0xde9b('0x8e')]();var _0x110483=path[_0xde9b('0x5c')](config[_0xde9b('0x5d')],'server','files',_0xde9b('0x8f'));var _0x591d1c=path['join'](config[_0xde9b('0x5d')],'server',_0xde9b('0x90'),_0xde9b('0x5a'));var _0x4f2df1=util[_0xde9b('0x68')]('message-%s.eml',_0x58d692);return db[_0xde9b('0x30')][_0xde9b('0x47')]({'where':{'id':_0x44506c['params']['id']},'attributes':['id',_0xde9b('0x48'),_0xde9b('0x91'),'to','cc',_0xde9b('0x92'),_0xde9b('0x93'),_0xde9b('0x94')],'include':_0x44506c['query'][_0xde9b('0x5a')]?[{'model':db['Attachment'],'as':_0xde9b('0x95')}]:undefined})[_0xde9b('0x17')](handleEntityNotFound(_0x1b2f5c,null))[_0xde9b('0x17')](function(_0x3b3994){if(_0x3b3994){var _0x52c1b0=_0x3b3994;var _0xaf3461={'from':_0x52c1b0[_0xde9b('0x91')],'to':_0x52c1b0['to'],'subject':_0x52c1b0[_0xde9b('0x93')],'html':htmlEntities[_0xde9b('0x96')](_0x52c1b0[_0xde9b('0x48')]),'headers':{'Date':moment(_0x52c1b0[_0xde9b('0x94')])[_0xde9b('0x68')](_0xde9b('0x97'))},'attachments':[]};if(_0x3b3994['cc']){_0xaf3461['headers']['Cc']=_0x3b3994['cc'];}if(_0x3b3994['bcc']){_0xaf3461[_0xde9b('0x98')][_0xde9b('0x99')]=_0x3b3994[_0xde9b('0x92')];}return new BPromise(function(_0x488c60,_0x5330dd){if(_0x3b3994[_0xde9b('0x95')]){for(var _0x5cc902=0x0;_0x5cc902<_0x3b3994['Attachments'][_0xde9b('0x5b')];_0x5cc902++){var _0x245f20=_0x3b3994[_0xde9b('0x95')][_0x5cc902];var _0x4a4d01=path[_0xde9b('0x5c')](_0x591d1c,_0x245f20[_0xde9b('0x5e')]);if(fs[_0xde9b('0x9a')](_0x4a4d01)){_0xaf3461[_0xde9b('0x5a')]['push']({'name':_0x245f20['name'],'contentType':_0x245f20[_0xde9b('0x33')],'data':fs[_0xde9b('0x9b')](_0x4a4d01)});}}}emlformat[_0xde9b('0x9c')](_0xaf3461,function(_0x2acbbc,_0x2f47fc){if(_0x2acbbc)return _0x5330dd(_0x2acbbc);fs[_0xde9b('0x9d')](path['join'](_0x110483,_0x4f2df1),_0x2f47fc);return _0x488c60(_0x2f47fc);});});}})[_0xde9b('0x17')](function(_0x5ae2ce){if(_0x5ae2ce){return _0x1b2f5c[_0xde9b('0x8c')](path[_0xde9b('0x5c')](_0x110483,_0x4f2df1),_0x4f2df1,function(_0x13aaca){if(!_0x13aaca)fs[_0xde9b('0x9e')](path[_0xde9b('0x5c')](_0x110483,_0x4f2df1));});}})['catch'](handleError(_0x1b2f5c,null));}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.events.js b/server/api/mailMessage/mailMessage.events.js index 51a2792..689bdac 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 _0x4aa7=['MailMessage','setMaxListeners','save','update','remove','emit','exports','../../mysqldb'];(function(_0x5a4e82,_0x22e4b7){var _0x536af9=function(_0x45a484){while(--_0x45a484){_0x5a4e82['push'](_0x5a4e82['shift']());}};_0x536af9(++_0x22e4b7);}(_0x4aa7,0x14f));var _0x74aa=function(_0x3ce6b2,_0x1fc0b0){_0x3ce6b2=_0x3ce6b2-0x0;var _0x98a558=_0x4aa7[_0x3ce6b2];return _0x98a558;};'use strict';var EventEmitter=require('events');var MailMessage=require(_0x74aa('0x0'))['db'][_0x74aa('0x1')];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0x74aa('0x2')](0x0);var events={'afterCreate':_0x74aa('0x3'),'afterUpdate':_0x74aa('0x4'),'afterDestroy':_0x74aa('0x5')};function emitEvent(_0x64ec4b){return function(_0x1851b6,_0x5ad9ee,_0x368835){MailMessageEvents[_0x74aa('0x6')](_0x64ec4b+':'+_0x1851b6['id'],_0x1851b6);MailMessageEvents['emit'](_0x64ec4b,_0x1851b6);_0x368835(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailMessage['hook'](e,emitEvent(event));}}module[_0x74aa('0x7')]=MailMessageEvents; \ No newline at end of file +var _0x5da4=['save','update','emit','hook','exports','events','../../mysqldb','MailMessage','setMaxListeners'];(function(_0x2d7fbe,_0x44b669){var _0x3a93ac=function(_0x101520){while(--_0x101520){_0x2d7fbe['push'](_0x2d7fbe['shift']());}};_0x3a93ac(++_0x44b669);}(_0x5da4,0xa7));var _0x45da=function(_0x422905,_0x3bce3a){_0x422905=_0x422905-0x0;var _0x33dc6c=_0x5da4[_0x422905];return _0x33dc6c;};'use strict';var EventEmitter=require(_0x45da('0x0'));var MailMessage=require(_0x45da('0x1'))['db'][_0x45da('0x2')];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0x45da('0x3')](0x0);var events={'afterCreate':_0x45da('0x4'),'afterUpdate':_0x45da('0x5'),'afterDestroy':'remove'};function emitEvent(_0x445fb4){return function(_0x43b603,_0x4a5933,_0x40dd1b){MailMessageEvents['emit'](_0x445fb4+':'+_0x43b603['id'],_0x43b603);MailMessageEvents[_0x45da('0x6')](_0x445fb4,_0x43b603);_0x40dd1b(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailMessage[_0x45da('0x7')](e,emitEvent(event));}}module[_0x45da('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 83330f2..87ba7a1 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 _0xdac3=['path','./mailMessage.attributes','exports','define','MailMessage','mail_messages','messageId','fti_mail_messages','plainBody','FULLTEXT','body','fromString','get','direction','out','secret','isNil','UserId','findOne','then','update','createdAt','toLowerCase','catch','error','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','bluebird'];(function(_0x4aac5a,_0x15b04c){var _0x42e7bc=function(_0x1da766){while(--_0x1da766){_0x4aac5a['push'](_0x4aac5a['shift']());}};_0x42e7bc(++_0x15b04c);}(_0xdac3,0x1db));var _0x3dac=function(_0x1d03f1,_0x7f2edf){_0x1d03f1=_0x1d03f1-0x0;var _0x40c77e=_0xdac3[_0x1d03f1];return _0x40c77e;};'use strict';var _=require(_0x3dac('0x0'));var util=require(_0x3dac('0x1'));var logger=require(_0x3dac('0x2'))(_0x3dac('0x3'));var moment=require('moment');var BPromise=require(_0x3dac('0x4'));var rp=require('request-promise');var htmlToText=require('html-to-text');var fs=require('fs');var path=require(_0x3dac('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x3dac('0x6'));module[_0x3dac('0x7')]=function(_0x171f4d,_0x4cc640){return _0x171f4d[_0x3dac('0x8')](_0x3dac('0x9'),attributes,{'tableName':_0x3dac('0xa'),'paranoid':![],'indexes':[{'name':_0x3dac('0xb'),'fields':[_0x3dac('0xb')]},{'name':_0x3dac('0xc'),'fields':[_0x3dac('0xd'),'subject'],'type':_0x3dac('0xe')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x5e8fed,_0x206b6b,_0x363c0e){if(_0x5e8fed[_0x3dac('0xf')]){_0x5e8fed[_0x3dac('0xd')]=htmlToText[_0x3dac('0x10')](_0x5e8fed[_0x3dac('0xf')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x363c0e(null,_0x206b6b);},'afterCreate':function(_0x2ea8e2,_0x2829bd,_0x2d1644){var _0x16d66e=_0x171f4d['models'];var _0x3ce309=_0x2ea8e2[_0x3dac('0x11')]({'plain':!![]});if(_0x3ce309[_0x3dac('0x12')]['toLowerCase']()==='in'||_0x3ce309[_0x3dac('0x12')]['toLowerCase']()===_0x3dac('0x13')&&!_0x3ce309[_0x3dac('0x14')]&&!_[_0x3dac('0x15')](_0x3ce309[_0x3dac('0x16')])){_0x16d66e['MailInteraction'][_0x3dac('0x17')]({'where':{'id':_0x3ce309['MailInteractionId']}})[_0x3dac('0x18')](function(_0xe567b6){if(_0xe567b6){_0xe567b6[_0x3dac('0x19')]({'lastMsgAt':_0x3ce309[_0x3dac('0x1a')],'lastMsgDirection':_0x3ce309[_0x3dac('0x12')][_0x3dac('0x1b')]()});}})[_0x3dac('0x1c')](function(_0x3695fc){console[_0x3dac('0x1d')](_0x3695fc);});}_0x2d1644();}},'charset':_0x3dac('0x1e'),'collate':_0x3dac('0x1f')});}; \ No newline at end of file +var _0x7224=['findOne','catch','error','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','html-to-text','rimraf','exports','define','MailMessage','messageId','fti_mail_messages','plainBody','subject','body','fromString','get','direction','toLowerCase','out','secret','UserId','MailInteraction'];(function(_0x445114,_0x1598ee){var _0x597164=function(_0x1c9b8a){while(--_0x1c9b8a){_0x445114['push'](_0x445114['shift']());}};_0x597164(++_0x1598ee);}(_0x7224,0xb9));var _0x4722=function(_0x3b7113,_0x2f92c8){_0x3b7113=_0x3b7113-0x0;var _0x35096c=_0x7224[_0x3b7113];return _0x35096c;};'use strict';var _=require(_0x4722('0x0'));var util=require(_0x4722('0x1'));var logger=require(_0x4722('0x2'))(_0x4722('0x3'));var moment=require(_0x4722('0x4'));var BPromise=require(_0x4722('0x5'));var rp=require(_0x4722('0x6'));var htmlToText=require(_0x4722('0x7'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4722('0x8'));var config=require('../../config/environment');var attributes=require('./mailMessage.attributes');module[_0x4722('0x9')]=function(_0x23e146,_0x389846){return _0x23e146[_0x4722('0xa')](_0x4722('0xb'),attributes,{'tableName':'mail_messages','paranoid':![],'indexes':[{'name':'messageId','fields':[_0x4722('0xc')]},{'name':_0x4722('0xd'),'fields':[_0x4722('0xe'),_0x4722('0xf')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x5a7c79,_0x423271,_0x40a028){if(_0x5a7c79[_0x4722('0x10')]){_0x5a7c79[_0x4722('0xe')]=htmlToText[_0x4722('0x11')](_0x5a7c79[_0x4722('0x10')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x40a028(null,_0x423271);},'afterCreate':function(_0x243381,_0x4f7dc0,_0x17c42a){var _0x2ca3bc=_0x23e146['models'];var _0x525d66=_0x243381[_0x4722('0x12')]({'plain':!![]});if(_0x525d66[_0x4722('0x13')]['toLowerCase']()==='in'||_0x525d66['direction'][_0x4722('0x14')]()===_0x4722('0x15')&&!_0x525d66[_0x4722('0x16')]&&!_['isNil'](_0x525d66[_0x4722('0x17')])){_0x2ca3bc[_0x4722('0x18')][_0x4722('0x19')]({'where':{'id':_0x525d66['MailInteractionId']}})['then'](function(_0x32d071){if(_0x32d071){_0x32d071['update']({'lastMsgAt':_0x525d66['createdAt'],'lastMsgDirection':_0x525d66['direction'][_0x4722('0x14')]()});}})[_0x4722('0x1a')](function(_0xe740fc){console[_0x4722('0x1b')](_0xe740fc);});}_0x17c42a();}},'charset':_0x4722('0x1c'),'collate':_0x4722('0x1d')});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.rpc.js b/server/api/mailMessage/mailMessage.rpc.js index 6981fc7..7589ea9 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 _0xfcbb=['catch','CreateMailMessage','body','options','raw','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','redis','defaults','localhost','socket.io-emitter','./mailMessage.socket','register','request','then','MailMessage,\x20%s,\x20%s','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result'];(function(_0x2c2756,_0xb17e2a){var _0x10d3ae=function(_0x2a8a20){while(--_0x2a8a20){_0x2c2756['push'](_0x2c2756['shift']());}};_0x10d3ae(++_0xb17e2a);}(_0xfcbb,0x10d));var _0xbfcb=function(_0x167fb3,_0x594755){_0x167fb3=_0x167fb3-0x0;var _0x198223=_0xfcbb[_0x167fb3];return _0x198223;};'use strict';var _=require(_0xbfcb('0x0'));var util=require(_0xbfcb('0x1'));var moment=require(_0xbfcb('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbfcb('0x3'));var db=require(_0xbfcb('0x4'))['db'];var utils=require(_0xbfcb('0x5'));var logger=require(_0xbfcb('0x6'))(_0xbfcb('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xbfcb('0x8')][_0xbfcb('0x9')]({'port':0x232a});config[_0xbfcb('0xa')]=_[_0xbfcb('0xb')](config[_0xbfcb('0xa')],{'host':_0xbfcb('0xc'),'port':0x18eb});var socket=require(_0xbfcb('0xd'))(new Redis(config['redis']));require(_0xbfcb('0xe'))[_0xbfcb('0xf')](socket);function respondWithRpcPromise(_0x346685,_0x52b2f8,_0x2c72f3){return new BPromise(function(_0x3d01fa,_0x3e735a){return client[_0xbfcb('0x10')](_0x346685,_0x2c72f3)[_0xbfcb('0x11')](function(_0x1fad67){logger['info'](_0xbfcb('0x12'),_0x52b2f8,_0xbfcb('0x13'));logger[_0xbfcb('0x14')](_0xbfcb('0x15'),_0x52b2f8,'request\x20sent',JSON[_0xbfcb('0x16')](_0x1fad67));if(_0x1fad67['error']){if(_0x1fad67[_0xbfcb('0x17')][_0xbfcb('0x18')]===0x1f4){logger[_0xbfcb('0x17')](_0xbfcb('0x12'),_0x52b2f8,_0x1fad67[_0xbfcb('0x17')][_0xbfcb('0x19')]);return _0x3e735a(_0x1fad67[_0xbfcb('0x17')][_0xbfcb('0x19')]);}logger[_0xbfcb('0x17')](_0xbfcb('0x12'),_0x52b2f8,_0x1fad67[_0xbfcb('0x17')][_0xbfcb('0x19')]);return _0x3d01fa(_0x1fad67[_0xbfcb('0x17')][_0xbfcb('0x19')]);}else{logger[_0xbfcb('0x1a')](_0xbfcb('0x12'),_0x52b2f8,_0xbfcb('0x13'));_0x3d01fa(_0x1fad67[_0xbfcb('0x1b')][_0xbfcb('0x19')]);}})[_0xbfcb('0x1c')](function(_0xccd6ff){logger[_0xbfcb('0x17')]('MailMessage,\x20%s,\x20%s',_0x52b2f8,_0xccd6ff);_0x3e735a(_0xccd6ff);});});}exports[_0xbfcb('0x1d')]=function(_0x37263b){var _0x54ec7a=this;return new Promise(function(_0xa3c089,_0x1a7225){return db['MailMessage']['create'](_0x37263b[_0xbfcb('0x1e')],{'raw':_0x37263b[_0xbfcb('0x1f')]?_0x37263b[_0xbfcb('0x1f')][_0xbfcb('0x20')]===undefined?!![]:![]:!![]})[_0xbfcb('0x11')](function(_0x56c158){logger[_0xbfcb('0x1a')](_0xbfcb('0x1d'),_0x37263b);logger[_0xbfcb('0x14')](_0xbfcb('0x1d'),_0x37263b,JSON[_0xbfcb('0x16')](_0x56c158));_0xa3c089(_0x56c158);})[_0xbfcb('0x1c')](function(_0x69c8e9){logger[_0xbfcb('0x17')](_0xbfcb('0x1d'),_0x69c8e9[_0xbfcb('0x19')],_0x37263b);_0x1a7225(_0x54ec7a[_0xbfcb('0x17')](0x1f4,_0x69c8e9[_0xbfcb('0x19')]));});});}; \ No newline at end of file +var _0x1893=['result','MailMessage','body','options','CreateMailMessage','debug','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','register','then','info','MailMessage,\x20%s,\x20%s','request\x20sent','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x4a0bac,_0x3dd32b){var _0x48458a=function(_0x1941a0){while(--_0x1941a0){_0x4a0bac['push'](_0x4a0bac['shift']());}};_0x48458a(++_0x3dd32b);}(_0x1893,0xa2));var _0x3189=function(_0x5b3496,_0x31c442){_0x5b3496=_0x5b3496-0x0;var _0x216727=_0x1893[_0x5b3496];return _0x216727;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x3189('0x0'));var BPromise=require(_0x3189('0x1'));var rs=require(_0x3189('0x2'));var fs=require('fs');var Redis=require(_0x3189('0x3'));var db=require(_0x3189('0x4'))['db'];var utils=require(_0x3189('0x5'));var logger=require(_0x3189('0x6'))('rpc');var config=require(_0x3189('0x7'));var jayson=require(_0x3189('0x8'));var client=jayson[_0x3189('0x9')][_0x3189('0xa')]({'port':0x232a});config[_0x3189('0xb')]=_[_0x3189('0xc')](config[_0x3189('0xb')],{'host':_0x3189('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x3189('0xb')]));require('./mailMessage.socket')[_0x3189('0xe')](socket);function respondWithRpcPromise(_0x4ac683,_0x3ec9d0,_0x33cdfb){return new BPromise(function(_0xca480c,_0x176799){return client['request'](_0x4ac683,_0x33cdfb)[_0x3189('0xf')](function(_0x149428){logger[_0x3189('0x10')](_0x3189('0x11'),_0x3ec9d0,_0x3189('0x12'));logger['debug'](_0x3189('0x13'),_0x3ec9d0,_0x3189('0x12'),JSON[_0x3189('0x14')](_0x149428));if(_0x149428[_0x3189('0x15')]){if(_0x149428[_0x3189('0x15')][_0x3189('0x16')]===0x1f4){logger[_0x3189('0x15')](_0x3189('0x11'),_0x3ec9d0,_0x149428['error'][_0x3189('0x17')]);return _0x176799(_0x149428[_0x3189('0x15')][_0x3189('0x17')]);}logger[_0x3189('0x15')]('MailMessage,\x20%s,\x20%s',_0x3ec9d0,_0x149428[_0x3189('0x15')]['message']);return _0xca480c(_0x149428['error'][_0x3189('0x17')]);}else{logger['info'](_0x3189('0x11'),_0x3ec9d0,_0x3189('0x12'));_0xca480c(_0x149428[_0x3189('0x18')][_0x3189('0x17')]);}})['catch'](function(_0xd3d5a){logger[_0x3189('0x15')](_0x3189('0x11'),_0x3ec9d0,_0xd3d5a);_0x176799(_0xd3d5a);});});}exports['CreateMailMessage']=function(_0x561265){var _0xb0e89b=this;return new Promise(function(_0x306ed3,_0x2c1e59){return db[_0x3189('0x19')]['create'](_0x561265[_0x3189('0x1a')],{'raw':_0x561265[_0x3189('0x1b')]?_0x561265[_0x3189('0x1b')]['raw']===undefined?!![]:![]:!![]})[_0x3189('0xf')](function(_0x47abb4){logger[_0x3189('0x10')](_0x3189('0x1c'),_0x561265);logger[_0x3189('0x1d')](_0x3189('0x1c'),_0x561265,JSON[_0x3189('0x14')](_0x47abb4));_0x306ed3(_0x47abb4);})[_0x3189('0x1e')](function(_0x5a08dc){logger['error'](_0x3189('0x1c'),_0x5a08dc[_0x3189('0x17')],_0x561265);_0x2c1e59(_0xb0e89b[_0x3189('0x15')](0x1f4,_0x5a08dc[_0x3189('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.socket.js b/server/api/mailMessage/mailMessage.socket.js index b61b99c..d986716 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 _0x9643=['remove','update','emit','register','length','./mailMessage.events'];(function(_0x32fc6d,_0xa1cfe9){var _0x45eb18=function(_0xc5588d){while(--_0xc5588d){_0x32fc6d['push'](_0x32fc6d['shift']());}};_0x45eb18(++_0xa1cfe9);}(_0x9643,0x119));var _0x3964=function(_0x1b9ff4,_0x29bea7){_0x1b9ff4=_0x1b9ff4-0x0;var _0x25ed26=_0x9643[_0x1b9ff4];return _0x25ed26;};'use strict';var MailMessageEvents=require(_0x3964('0x0'));var events=['save',_0x3964('0x1'),_0x3964('0x2')];function createListener(_0x23a8e4,_0x59d292){return function(_0x462333){_0x59d292[_0x3964('0x3')](_0x23a8e4,_0x462333);};}function removeListener(_0x564ec8,_0x49a8a2){return function(){MailMessageEvents['removeListener'](_0x564ec8,_0x49a8a2);};}exports[_0x3964('0x4')]=function(_0x20a2b6){for(var _0x296b6a=0x0,_0x4a264a=events[_0x3964('0x5')];_0x296b6a<_0x4a264a;_0x296b6a++){var _0x2406a4=events[_0x296b6a];var _0x53c312=createListener('mailMessage:'+_0x2406a4,_0x20a2b6);MailMessageEvents['on'](_0x2406a4,_0x53c312);}}; \ No newline at end of file +var _0xbc5e=['mailMessage:','./mailMessage.events','save','remove','update','removeListener','length'];(function(_0x544d5c,_0x5197d2){var _0x347a47=function(_0x5d645a){while(--_0x5d645a){_0x544d5c['push'](_0x544d5c['shift']());}};_0x347a47(++_0x5197d2);}(_0xbc5e,0xda));var _0xebc5=function(_0x44a232,_0x1d4edb){_0x44a232=_0x44a232-0x0;var _0x582519=_0xbc5e[_0x44a232];return _0x582519;};'use strict';var MailMessageEvents=require(_0xebc5('0x0'));var events=[_0xebc5('0x1'),_0xebc5('0x2'),_0xebc5('0x3')];function createListener(_0x5a6b82,_0x1238a7){return function(_0x916e8){_0x1238a7['emit'](_0x5a6b82,_0x916e8);};}function removeListener(_0xfdeee0,_0x37c47d){return function(){MailMessageEvents[_0xebc5('0x4')](_0xfdeee0,_0x37c47d);};}exports['register']=function(_0x1d4bf2){for(var _0x34a53a=0x0,_0x4cc601=events[_0xebc5('0x5')];_0x34a53a<_0x4cc601;_0x34a53a++){var _0x5a5990=events[_0x34a53a];var _0x2416da=createListener(_0xebc5('0x6')+_0x5a5990,_0x1d4bf2);MailMessageEvents['on'](_0x5a5990,_0x2416da);}}; \ No newline at end of file diff --git a/server/api/mailQueue/index.js b/server/api/mailQueue/index.js index 54cf3e4..a934790 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 _0xbd0d=['isAuthenticated','index','get','/describe','describe','show','getMembers','getTeams','/:id/users','create','post','addTeams','/:id','update','delete','destroy','removeTeams','removeAgents','exports','multer','util','connect-timeout','express','Router','../../components/interaction/service','./mailQueue.controller'];(function(_0x39bfb6,_0x4272c8){var _0x23fef9=function(_0x5f83c1){while(--_0x5f83c1){_0x39bfb6['push'](_0x39bfb6['shift']());}};_0x23fef9(++_0x4272c8);}(_0xbd0d,0x1b3));var _0xdbd0=function(_0xe446b9,_0x4b27df){_0xe446b9=_0xe446b9-0x0;var _0xb77c67=_0xbd0d[_0xe446b9];return _0xb77c67;};'use strict';var multer=require(_0xdbd0('0x0'));var util=require(_0xdbd0('0x1'));var path=require('path');var timeout=require(_0xdbd0('0x2'));var express=require(_0xdbd0('0x3'));var router=express[_0xdbd0('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xdbd0('0x5'));var config=require('../../config/environment');var controller=require(_0xdbd0('0x6'));router['get']('/',auth[_0xdbd0('0x7')](),controller[_0xdbd0('0x8')]);router[_0xdbd0('0x9')](_0xdbd0('0xa'),auth['isAuthenticated'](),controller[_0xdbd0('0xb')]);router[_0xdbd0('0x9')]('/:id',auth[_0xdbd0('0x7')](),controller[_0xdbd0('0xc')]);router[_0xdbd0('0x9')]('/:id/members',auth[_0xdbd0('0x7')](),controller[_0xdbd0('0xd')]);router[_0xdbd0('0x9')]('/:id/teams',auth[_0xdbd0('0x7')](),controller[_0xdbd0('0xe')]);router[_0xdbd0('0x9')](_0xdbd0('0xf'),auth[_0xdbd0('0x7')](),controller['getAgents']);router['post']('/',auth[_0xdbd0('0x7')](),controller[_0xdbd0('0x10')]);router[_0xdbd0('0x11')]('/:id/teams',auth['isAuthenticated'](),controller[_0xdbd0('0x12')]);router[_0xdbd0('0x11')](_0xdbd0('0xf'),auth[_0xdbd0('0x7')](),controller['addAgents']);router['put'](_0xdbd0('0x13'),auth['isAuthenticated'](),controller[_0xdbd0('0x14')]);router[_0xdbd0('0x15')](_0xdbd0('0x13'),auth[_0xdbd0('0x7')](),controller[_0xdbd0('0x16')]);router[_0xdbd0('0x15')]('/:id/teams',auth[_0xdbd0('0x7')](),controller[_0xdbd0('0x17')]);router[_0xdbd0('0x15')](_0xdbd0('0xf'),auth[_0xdbd0('0x7')](),controller[_0xdbd0('0x18')]);module[_0xdbd0('0x19')]=router; \ No newline at end of file +var _0xb86a=['getTeams','getAgents','post','addTeams','/:id/users','addAgents','put','update','delete','removeTeams','removeAgents','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','describe','/:id','show','/:id/members','getMembers','/:id/teams'];(function(_0x3c0ee3,_0xc2af81){var _0xc41e7=function(_0x23bccd){while(--_0x23bccd){_0x3c0ee3['push'](_0x3c0ee3['shift']());}};_0xc41e7(++_0xc2af81);}(_0xb86a,0x11a));var _0xab86=function(_0x51020b,_0x38c2c7){_0x51020b=_0x51020b-0x0;var _0x371e47=_0xb86a[_0x51020b];return _0x371e47;};'use strict';var multer=require(_0xab86('0x0'));var util=require(_0xab86('0x1'));var path=require(_0xab86('0x2'));var timeout=require(_0xab86('0x3'));var express=require(_0xab86('0x4'));var router=express[_0xab86('0x5')]();var fs_extra=require(_0xab86('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xab86('0x7'));var config=require(_0xab86('0x8'));var controller=require('./mailQueue.controller');router[_0xab86('0x9')]('/',auth[_0xab86('0xa')](),controller['index']);router[_0xab86('0x9')](_0xab86('0xb'),auth[_0xab86('0xa')](),controller[_0xab86('0xc')]);router['get'](_0xab86('0xd'),auth[_0xab86('0xa')](),controller[_0xab86('0xe')]);router[_0xab86('0x9')](_0xab86('0xf'),auth[_0xab86('0xa')](),controller[_0xab86('0x10')]);router[_0xab86('0x9')](_0xab86('0x11'),auth[_0xab86('0xa')](),controller[_0xab86('0x12')]);router[_0xab86('0x9')]('/:id/users',auth[_0xab86('0xa')](),controller[_0xab86('0x13')]);router[_0xab86('0x14')]('/',auth[_0xab86('0xa')](),controller['create']);router['post'](_0xab86('0x11'),auth[_0xab86('0xa')](),controller[_0xab86('0x15')]);router[_0xab86('0x14')](_0xab86('0x16'),auth[_0xab86('0xa')](),controller[_0xab86('0x17')]);router[_0xab86('0x18')]('/:id',auth[_0xab86('0xa')](),controller[_0xab86('0x19')]);router[_0xab86('0x1a')](_0xab86('0xd'),auth['isAuthenticated'](),controller['destroy']);router[_0xab86('0x1a')](_0xab86('0x11'),auth['isAuthenticated'](),controller[_0xab86('0x1b')]);router[_0xab86('0x1a')](_0xab86('0x16'),auth[_0xab86('0xa')](),controller[_0xab86('0x1c')]);module[_0xab86('0x1d')]=router; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.attributes.js b/server/api/mailQueue/mailQueue.attributes.js index 83d7a10..b27279c 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 _0x50ee=['name','beepall','roundrobin','sequelize','exports','STRING'];(function(_0x15c3df,_0x530c8d){var _0x51f259=function(_0x19b945){while(--_0x19b945){_0x15c3df['push'](_0x15c3df['shift']());}};_0x51f259(++_0x530c8d);}(_0x50ee,0x117));var _0xe50e=function(_0x52e68e,_0x309912){_0x52e68e=_0x52e68e-0x0;var _0x3211a4=_0x50ee[_0x52e68e];return _0x3211a4;};'use strict';var Sequelize=require(_0xe50e('0x0'));module[_0xe50e('0x1')]={'name':{'type':Sequelize[_0xe50e('0x2')],'unique':_0xe50e('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xe50e('0x2')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM']('rrmemory',_0xe50e('0x4'),_0xe50e('0x5'))}}; \ No newline at end of file +var _0x2dc1=['rrmemory','beepall','sequelize','exports','STRING','INTEGER','ENUM'];(function(_0x27a16c,_0x5965b0){var _0x435335=function(_0x17584f){while(--_0x17584f){_0x27a16c['push'](_0x27a16c['shift']());}};_0x435335(++_0x5965b0);}(_0x2dc1,0x6b));var _0x12dc=function(_0x53c2ff,_0x5bbf5a){_0x53c2ff=_0x53c2ff-0x0;var _0x1dfddd=_0x2dc1[_0x53c2ff];return _0x1dfddd;};'use strict';var Sequelize=require(_0x12dc('0x0'));module[_0x12dc('0x1')]={'name':{'type':Sequelize[_0x12dc('0x2')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0x12dc('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x12dc('0x4')](_0x12dc('0x5'),_0x12dc('0x6'),'roundrobin')}}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.controller.js b/server/api/mailQueue/mailQueue.controller.js index 3f8d4fe..048b2d6 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 _0x4f28=['name','send','index','map','rawAttributes','fieldName','where','MailQueue','include','findAll','rows','catch','show','model','keys','query','filters','intersection','fields','attributes','includeAll','merge','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','MailQueues','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','params','UserMailQueue','length','hasOwnProperty','nolimit','order','sort','pick','MailQueueId','User','findAndCountAll','agent','createdAt','format','%s/%s','SIP','mailPause','updatedAt','getTeams','Team','filter','addTeams','ids','Agents','online','voicePause','interface','flatMap','sequelize','transaction','each','findOrCreate','userMailQueue:save','removeTeams','select','field','tq.TeamId','from','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','MailQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','every','includes','all','union','compact','emit','addAgents','omit','spread','removeAgents','userMailQueue:remove','getAgents','bluebird','util','lodash','squel','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./mailQueue.socket','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','update','then','destroy','error'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x4f28,0xd7));var _0x84f2=function(_0x433a86,_0x175b5c){_0x433a86=_0x433a86-0x0;var _0x23000c=_0x4f28[_0x433a86];return _0x23000c;};'use strict';var BPromise=require(_0x84f2('0x0'));var util=require(_0x84f2('0x1'));var _=require(_0x84f2('0x2'));var squel=require(_0x84f2('0x3'));var Redis=require('ioredis');var qs=require(_0x84f2('0x4'));var logger=require(_0x84f2('0x5'))(_0x84f2('0x6'));var config=require(_0x84f2('0x7'));var db=require(_0x84f2('0x8'))['db'];config[_0x84f2('0x9')]=_['defaults'](config['redis'],{'host':_0x84f2('0xa'),'port':0x18eb});var socket=require(_0x84f2('0xb'))(new Redis(config[_0x84f2('0x9')]));require(_0x84f2('0xc'))['register'](socket);function respondWithStatusCode(_0x4e8599,_0x1e5024){_0x1e5024=_0x1e5024||0xcc;return function(_0x178f39){if(_0x178f39){return _0x4e8599[_0x84f2('0xd')](_0x1e5024);}return _0x4e8599[_0x84f2('0xe')](_0x1e5024)[_0x84f2('0xf')]();};}function respondWithResult(_0x4ffc6d,_0x54d640){_0x54d640=_0x54d640||0xc8;return function(_0x3c6eb1){if(_0x3c6eb1){return _0x4ffc6d['status'](_0x54d640)[_0x84f2('0x10')](_0x3c6eb1);}};}function respondWithFilteredResult(_0xe95066,_0x7d1323){return function(_0x5d692f){if(_0x5d692f){var _0x439229=typeof _0x7d1323['offset']===_0x84f2('0x11')&&typeof _0x7d1323[_0x84f2('0x12')]===_0x84f2('0x11');var _0x1c9be6=_0x5d692f[_0x84f2('0x13')];var _0x575dbb=_0x439229?0x0:_0x7d1323[_0x84f2('0x14')];var _0x239928=_0x439229?_0x5d692f[_0x84f2('0x13')]:_0x7d1323[_0x84f2('0x14')]+_0x7d1323[_0x84f2('0x12')];var _0x28b20d;if(_0x239928>=_0x1c9be6){_0x239928=_0x1c9be6;_0x28b20d=0xc8;}else{_0x28b20d=0xce;}_0xe95066[_0x84f2('0xe')](_0x28b20d);return _0xe95066[_0x84f2('0x15')](_0x84f2('0x16'),_0x575dbb+'-'+_0x239928+'/'+_0x1c9be6)['json'](_0x5d692f);}return null;};}function saveUpdates(_0x4718a3){return function(_0xe4eead){if(_0xe4eead){return _0xe4eead[_0x84f2('0x17')](_0x4718a3)[_0x84f2('0x18')](function(_0x5c03b8){return _0x5c03b8;});}return null;};}function removeEntity(_0x506716){return function(_0x3179e2){if(_0x3179e2){return _0x3179e2[_0x84f2('0x19')]()[_0x84f2('0x18')](function(){var _0x43b768=_0x3179e2['get']({'plain':!![]});var _0x576789='MailQueues';return db['UserProfileResource'][_0x84f2('0x19')]({'where':{'type':_0x576789,'resourceId':_0x43b768['id']}})[_0x84f2('0x18')](function(){return _0x3179e2;});})[_0x84f2('0x18')](function(){_0x506716[_0x84f2('0xe')](0xcc)[_0x84f2('0xf')]();});}};}function handleEntityNotFound(_0x5b4b0e){return function(_0x34b6b2){if(!_0x34b6b2){_0x5b4b0e[_0x84f2('0xd')](0x194);}return _0x34b6b2;};}function handleError(_0x91fcf7,_0x4a458c){_0x4a458c=_0x4a458c||0x1f4;return function(_0x9dcef8){logger[_0x84f2('0x1a')](_0x9dcef8['stack']);if(_0x9dcef8['name']){delete _0x9dcef8[_0x84f2('0x1b')];}_0x91fcf7[_0x84f2('0xe')](_0x4a458c)[_0x84f2('0x1c')](_0x9dcef8);};}exports[_0x84f2('0x1d')]=function(_0x1d7f25,_0x50f1ef){var _0x582d9f={};var _0x1589c7={'count':0x0,'rows':[]};var _0x317913=_[_0x84f2('0x1e')](db['MailQueue'][_0x84f2('0x1f')],function(_0x4769d5){return{'name':_0x4769d5[_0x84f2('0x20')],'type':_0x4769d5['type']['key']};});_0x582d9f=qs['getOptions'](_0x317913,_0x1d7f25);var _0x4ff773={'where':_0x582d9f[_0x84f2('0x21')]};return db[_0x84f2('0x22')][_0x84f2('0x13')](_0x4ff773)[_0x84f2('0x18')](function(_0xcd5b52){_0x1589c7['count']=_0xcd5b52;_0x582d9f['include']=qs[_0x84f2('0x23')](_0x1d7f25['query']);return db[_0x84f2('0x22')][_0x84f2('0x24')](_0x582d9f);})[_0x84f2('0x18')](function(_0x5d00aa){_0x1589c7[_0x84f2('0x25')]=_0x5d00aa;return _0x1589c7;})[_0x84f2('0x18')](respondWithFilteredResult(_0x50f1ef,_0x582d9f))[_0x84f2('0x26')](handleError(_0x50f1ef,null));};exports[_0x84f2('0x27')]=function(_0x2c87fb,_0x5d6e04){var _0x480f6b={'raw':!![],'where':{'id':_0x2c87fb['params']['id']}},_0x1d13e3={};_0x1d13e3[_0x84f2('0x28')]=_[_0x84f2('0x29')](db[_0x84f2('0x22')][_0x84f2('0x1f')]);_0x1d13e3['query']=_['keys'](_0x2c87fb[_0x84f2('0x2a')]);_0x1d13e3[_0x84f2('0x2b')]=_[_0x84f2('0x2c')](_0x1d13e3['model'],_0x1d13e3[_0x84f2('0x2a')]);_0x480f6b['attributes']=_[_0x84f2('0x2c')](_0x1d13e3[_0x84f2('0x28')],qs[_0x84f2('0x2d')](_0x2c87fb[_0x84f2('0x2a')][_0x84f2('0x2d')]));_0x480f6b[_0x84f2('0x2e')]=_0x480f6b[_0x84f2('0x2e')]['length']?_0x480f6b[_0x84f2('0x2e')]:_0x1d13e3['model'];if(_0x2c87fb[_0x84f2('0x2a')][_0x84f2('0x2f')]){_0x480f6b[_0x84f2('0x23')]=[{'all':!![]}];}_0x480f6b=_[_0x84f2('0x30')]({},_0x480f6b,_0x2c87fb[_0x84f2('0x31')]);return db[_0x84f2('0x22')][_0x84f2('0x32')](_0x480f6b)[_0x84f2('0x18')](handleEntityNotFound(_0x5d6e04,null))[_0x84f2('0x18')](respondWithResult(_0x5d6e04,null))[_0x84f2('0x26')](handleError(_0x5d6e04,null));};exports[_0x84f2('0x33')]=function(_0x434ac8,_0x49af6b){return db[_0x84f2('0x22')]['create'](_0x434ac8[_0x84f2('0x34')],{})[_0x84f2('0x18')](function(_0xfdd4cc){var _0xa2f94=_0x434ac8[_0x84f2('0x35')]['get']({'plain':!![]});if(!_0xa2f94)throw new Error(_0x84f2('0x36'));if(_0xa2f94[_0x84f2('0x37')]===_0x84f2('0x35')){var _0x4af9db=_0xfdd4cc[_0x84f2('0x38')]({'plain':!![]});var _0x1551ba=_0x84f2('0x39');return db['UserProfileSection'][_0x84f2('0x32')]({'where':{'name':_0x1551ba,'userProfileId':_0xa2f94[_0x84f2('0x3a')]},'raw':!![]})[_0x84f2('0x18')](function(_0x215242){if(_0x215242&&_0x215242['autoAssociation']===0x0){return db['UserProfileResource'][_0x84f2('0x33')]({'name':_0x4af9db['name'],'resourceId':_0x4af9db['id'],'type':_0x215242['name'],'sectionId':_0x215242['id']},{})['then'](function(){return _0xfdd4cc;});}else{return _0xfdd4cc;}})[_0x84f2('0x26')](function(_0x7952fb){logger[_0x84f2('0x1a')](_0x84f2('0x3b'),_0x7952fb);throw _0x7952fb;});}return _0xfdd4cc;})[_0x84f2('0x18')](respondWithResult(_0x49af6b,0xc9))[_0x84f2('0x26')](handleError(_0x49af6b,null));};exports[_0x84f2('0x17')]=function(_0x593c16,_0x3a59c6){if(_0x593c16[_0x84f2('0x34')]['id']){delete _0x593c16[_0x84f2('0x34')]['id'];}return db[_0x84f2('0x22')][_0x84f2('0x32')]({'where':{'id':_0x593c16['params']['id']}})[_0x84f2('0x18')](handleEntityNotFound(_0x3a59c6,null))['then'](saveUpdates(_0x593c16[_0x84f2('0x34')],null))[_0x84f2('0x18')](respondWithResult(_0x3a59c6,null))[_0x84f2('0x26')](handleError(_0x3a59c6,null));};exports[_0x84f2('0x19')]=function(_0x5f17a5,_0x335f24){return db['MailQueue'][_0x84f2('0x32')]({'where':{'id':_0x5f17a5['params']['id']}})[_0x84f2('0x18')](handleEntityNotFound(_0x335f24,null))[_0x84f2('0x18')](removeEntity(_0x335f24,null))[_0x84f2('0x26')](handleError(_0x335f24,null));};exports['describe']=function(_0x2fe77d,_0x4e4897){return db['MailQueue'][_0x84f2('0x3c')]()[_0x84f2('0x18')](respondWithResult(_0x4e4897,null))[_0x84f2('0x26')](handleError(_0x4e4897,null));};exports[_0x84f2('0x3d')]=function(_0x4a7cbb,_0x13c459){var _0x60dbab={'raw':!![],'where':{}},_0x40232a={},_0x53f2a7;return db[_0x84f2('0x22')][_0x84f2('0x3e')]({'where':{'id':_0x4a7cbb[_0x84f2('0x3f')]['id']}})[_0x84f2('0x18')](handleEntityNotFound(_0x13c459,null))[_0x84f2('0x18')](function(_0x58b474){if(_0x58b474){_0x53f2a7=_0x58b474[_0x84f2('0x38')]({'plain':!![]});_0x40232a[_0x84f2('0x28')]=_[_0x84f2('0x29')](db[_0x84f2('0x40')][_0x84f2('0x1f')]);_0x40232a[_0x84f2('0x2a')]=_['keys'](_0x4a7cbb[_0x84f2('0x2a')]);_0x40232a['filters']=_[_0x84f2('0x2c')](_0x40232a[_0x84f2('0x28')],_0x40232a[_0x84f2('0x2a')]);_0x60dbab['attributes']=_['intersection'](_0x40232a['model'],qs['fields'](_0x4a7cbb[_0x84f2('0x2a')]['fields']));_0x60dbab[_0x84f2('0x2e')]=_0x60dbab[_0x84f2('0x2e')][_0x84f2('0x41')]?_0x60dbab['attributes']:_0x40232a['model'];if(!_0x4a7cbb[_0x84f2('0x2a')][_0x84f2('0x42')](_0x84f2('0x43'))){_0x60dbab[_0x84f2('0x12')]=qs[_0x84f2('0x12')](_0x4a7cbb[_0x84f2('0x2a')]['limit']);_0x60dbab[_0x84f2('0x14')]=qs[_0x84f2('0x14')](_0x4a7cbb[_0x84f2('0x2a')][_0x84f2('0x14')]);}_0x60dbab[_0x84f2('0x44')]=qs['sort'](_0x4a7cbb[_0x84f2('0x2a')][_0x84f2('0x45')]);_0x60dbab[_0x84f2('0x21')]=qs[_0x84f2('0x2b')](_[_0x84f2('0x46')](_0x4a7cbb[_0x84f2('0x2a')],_0x40232a[_0x84f2('0x2b')]));_0x60dbab[_0x84f2('0x21')][_0x84f2('0x47')]=_0x58b474['id'];if(_0x4a7cbb[_0x84f2('0x2a')]['filter']){_0x60dbab[_0x84f2('0x21')]=_[_0x84f2('0x30')](_0x60dbab[_0x84f2('0x21')],{'$or':_[_0x84f2('0x1e')](_0x60dbab[_0x84f2('0x2e')],function(_0x4b8b3c){var _0x33118b={};_0x33118b[_0x4b8b3c]={'$like':'%'+_0x4a7cbb[_0x84f2('0x2a')]['filter']+'%'};return _0x33118b;})});}_0x60dbab=_[_0x84f2('0x30')]({},_0x60dbab,_0x4a7cbb['options']);return db[_0x84f2('0x40')][_0x84f2('0x24')](_0x60dbab);}})[_0x84f2('0x18')](function(_0x1fa4f7){if(_0x1fa4f7){return db[_0x84f2('0x48')][_0x84f2('0x49')]({'where':{'id':_[_0x84f2('0x1e')](_0x1fa4f7,'UserId'),'role':_0x84f2('0x4a')},'attributes':['id',_0x84f2('0x1b'),'mailPause','updatedAt',_0x84f2('0x4b')]});}})[_0x84f2('0x18')](function(_0x19cb49){if(_0x19cb49){return{'count':_0x19cb49[_0x84f2('0x13')],'rows':_['map'](_0x19cb49[_0x84f2('0x25')],function(_0x1ad507){return{'membername':_0x1ad507[_0x84f2('0x1b')],'UserId':_0x1ad507['id'],'queue_name':_0x53f2a7[_0x84f2('0x1b')],'MailQueueId':_0x53f2a7['id'],'interface':util[_0x84f2('0x4c')](_0x84f2('0x4d'),_0x84f2('0x4e'),_0x1ad507['name']),'penalty':0x0,'paused':_0x1ad507[_0x84f2('0x4f')],'createdAt':_0x1ad507[_0x84f2('0x4b')],'updatedAt':_0x1ad507[_0x84f2('0x50')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x84f2('0x18')](respondWithFilteredResult(_0x13c459,_0x60dbab))[_0x84f2('0x26')](handleError(_0x13c459,null));};exports[_0x84f2('0x51')]=function(_0x4b6f82,_0x31bb35){var _0x5a5d68={};var _0x22fff3={};var _0x4c374d;var _0x3bd026;return db[_0x84f2('0x22')][_0x84f2('0x3e')]({'where':{'id':_0x4b6f82[_0x84f2('0x3f')]['id']}})[_0x84f2('0x18')](handleEntityNotFound(_0x31bb35,null))[_0x84f2('0x18')](function(_0x3fdc66){if(_0x3fdc66){_0x4c374d=_0x3fdc66;_0x22fff3['model']=_[_0x84f2('0x29')](db[_0x84f2('0x52')][_0x84f2('0x1f')]);_0x22fff3[_0x84f2('0x2a')]=_[_0x84f2('0x29')](_0x4b6f82[_0x84f2('0x2a')]);_0x22fff3[_0x84f2('0x2b')]=_[_0x84f2('0x2c')](_0x22fff3[_0x84f2('0x28')],_0x22fff3[_0x84f2('0x2a')]);_0x5a5d68[_0x84f2('0x2e')]=_['intersection'](_0x22fff3[_0x84f2('0x28')],qs[_0x84f2('0x2d')](_0x4b6f82[_0x84f2('0x2a')][_0x84f2('0x2d')]));_0x5a5d68['attributes']=_0x5a5d68[_0x84f2('0x2e')][_0x84f2('0x41')]?_0x5a5d68[_0x84f2('0x2e')]:_0x22fff3[_0x84f2('0x28')];_0x5a5d68['order']=qs[_0x84f2('0x45')](_0x4b6f82[_0x84f2('0x2a')][_0x84f2('0x45')]);_0x5a5d68['where']=qs[_0x84f2('0x2b')](_['pick'](_0x4b6f82[_0x84f2('0x2a')],_0x22fff3[_0x84f2('0x2b')]));if(_0x4b6f82[_0x84f2('0x2a')][_0x84f2('0x53')]){_0x5a5d68[_0x84f2('0x21')]=_[_0x84f2('0x30')](_0x5a5d68[_0x84f2('0x21')],{'$or':_[_0x84f2('0x1e')](_0x5a5d68['attributes'],function(_0x104396){var _0x3ae33e={};_0x3ae33e[_0x104396]={'$like':'%'+_0x4b6f82['query'][_0x84f2('0x53')]+'%'};return _0x3ae33e;})});}_0x5a5d68=_[_0x84f2('0x30')]({},_0x5a5d68,_0x4b6f82['options']);return _0x4c374d[_0x84f2('0x51')](_0x5a5d68);}})['then'](function(_0x2d0fe1){if(_0x2d0fe1){_0x3bd026=_0x2d0fe1[_0x84f2('0x41')];if(!_0x4b6f82[_0x84f2('0x2a')][_0x84f2('0x42')](_0x84f2('0x43'))){_0x5a5d68['limit']=qs['limit'](_0x4b6f82[_0x84f2('0x2a')][_0x84f2('0x12')]);_0x5a5d68['offset']=qs[_0x84f2('0x14')](_0x4b6f82[_0x84f2('0x2a')]['offset']);}return _0x4c374d[_0x84f2('0x51')](_0x5a5d68);}})['then'](function(_0x292f63){if(_0x292f63){return _0x292f63?{'count':_0x3bd026,'rows':_0x292f63}:null;}})['then'](respondWithResult(_0x31bb35,null))[_0x84f2('0x26')](handleError(_0x31bb35,null));};exports[_0x84f2('0x54')]=function(_0xefca1c,_0x2cc2dc){var _0x466c0d=_0xefca1c['body'][_0x84f2('0x55')];return db[_0x84f2('0x52')][_0x84f2('0x24')]({'where':{'id':_0x466c0d},'attributes':['id'],'include':[{'model':db['User'],'as':_0x84f2('0x56'),'attributes':['id','name',_0x84f2('0x57'),_0x84f2('0x58'),_0x84f2('0x59')],'raw':!![]}]})[_0x84f2('0x18')](function(_0x49674a){if(_0x49674a){var _0x4b3691=_[_0x84f2('0x5a')](_0x49674a,function(_0x428ccc){var _0x2a46aa=_0x428ccc[_0x84f2('0x38')]({'plain':!![]});return _0x2a46aa[_0x84f2('0x56')];});return db['MailQueue']['find']({'where':{'id':_0xefca1c[_0x84f2('0x3f')]['id']}})[_0x84f2('0x18')](function(_0x593d6e){return db[_0x84f2('0x5b')][_0x84f2('0x5c')](function(_0x4e8273){return _0x593d6e[_0x84f2('0x54')](_0x466c0d,{'transaction':_0x4e8273})[_0x84f2('0x18')](function(){return BPromise[_0x84f2('0x5d')](_0x4b3691,function(_0xe165d){return db['UserMailQueue'][_0x84f2('0x5e')]({'where':{'UserId':_0xe165d['id'],'MailQueueId':_0xefca1c[_0x84f2('0x3f')]['id']},'transaction':_0x4e8273});});})[_0x84f2('0x18')](function(){_0x4b3691['forEach'](function(_0x5320d3){socket['emit'](_0x84f2('0x5f'),{'UserId':_0x5320d3['id'],'MailQueueId':_0x593d6e['id']});});});});});}})['then'](respondWithStatusCode(_0x2cc2dc,null))[_0x84f2('0x26')](handleError(_0x2cc2dc,null));};exports[_0x84f2('0x60')]=function(_0x167841,_0x2f48e3){return db[_0x84f2('0x52')][_0x84f2('0x24')]({'where':{'id':_0x167841['query'][_0x84f2('0x55')]},'attributes':['id'],'include':[{'model':db[_0x84f2('0x48')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x84f2('0x18')](handleEntityNotFound(_0x2f48e3,null))[_0x84f2('0x18')](function(_0x3b9071){var _0x5e27f7=_[_0x84f2('0x1e')](_0x3b9071,'id');var _0x44964c=[];var _0x21ab09=[];var _0x9852fa=squel[_0x84f2('0x61')]();_0x9852fa[_0x84f2('0x62')](_0x84f2('0x63'))[_0x84f2('0x64')]('team_has_mail_queues','tq')[_0x84f2('0x65')](_0x84f2('0x66'),'ut',_0x84f2('0x67'))[_0x84f2('0x21')](_0x84f2('0x68'),_0x167841['params']['id']);for(var _0x1b5479=0x0;_0x1b5479<_0x3b9071[_0x84f2('0x41')];_0x1b5479+=0x1){let _0x1389c5=_0x3b9071[_0x1b5479];for(var _0x3120ca=0x0;_0x3120ca<_0x1389c5[_0x84f2('0x56')]['length'];_0x3120ca+=0x1){let _0x1f13c5=_0x1389c5['Agents'][_0x3120ca];var _0x50f718=_0x9852fa[_0x84f2('0x69')]();_0x50f718[_0x84f2('0x21')](_0x84f2('0x6a'),_0x1f13c5['id']);_0x21ab09[_0x84f2('0x6b')](db['sequelize'][_0x84f2('0x2a')](_0x50f718[_0x84f2('0x6c')](),{'type':db[_0x84f2('0x5b')]['QueryTypes']['SELECT']})[_0x84f2('0x18')](function(_0x25251b){if(_0x25251b[_0x84f2('0x41')]===0x1){return _0x1f13c5['id'];}else{var _0x5f1c4b=_[_0x84f2('0x6d')](_[_0x84f2('0x1e')](_0x25251b,'TeamId'),function(_0x37a1e1){return _[_0x84f2('0x6e')](_0x5e27f7,_0x37a1e1);});if(_0x5f1c4b){return _0x1f13c5['id'];}}}));}}return BPromise[_0x84f2('0x6f')](_0x21ab09)['then'](function(_0x4dfe62){_0x44964c=_(_0x44964c)[_0x84f2('0x70')](_0x4dfe62)[_0x84f2('0x71')]()['value']();return db['MailQueue']['find']({'where':{'id':_0x167841[_0x84f2('0x3f')]['id']}})[_0x84f2('0x18')](function(_0x45e038){return db[_0x84f2('0x5b')][_0x84f2('0x5c')](function(_0x1bc674){return _0x45e038[_0x84f2('0x60')](_0x167841[_0x84f2('0x2a')][_0x84f2('0x55')],{'transaction':_0x1bc674})[_0x84f2('0x18')](function(){if(!_['isEmpty'](_0x44964c)){return _0x45e038['removeAgents'](_0x44964c,{'transaction':_0x1bc674});}})['then'](function(){_0x44964c['forEach'](function(_0x14f4ee){socket[_0x84f2('0x72')]('userMailQueue:remove',{'UserId':_0x14f4ee,'MailQueueId':_0x45e038['id']});});});});});});})[_0x84f2('0x18')](respondWithStatusCode(_0x2f48e3,null))[_0x84f2('0x26')](handleError(_0x2f48e3,null));};exports[_0x84f2('0x73')]=function(_0x5a69a4,_0x18e286){return db[_0x84f2('0x22')][_0x84f2('0x32')]({'where':{'id':_0x5a69a4[_0x84f2('0x3f')]['id']}})[_0x84f2('0x18')](handleEntityNotFound(_0x18e286,null))[_0x84f2('0x18')](function(_0x1507c6){if(_0x1507c6){return _0x1507c6[_0x84f2('0x73')](_0x5a69a4[_0x84f2('0x34')][_0x84f2('0x55')],_[_0x84f2('0x74')](_0x5a69a4[_0x84f2('0x34')],[_0x84f2('0x55'),'id'])||{})[_0x84f2('0x75')](function(_0x737b4a){for(var _0x35b5d1=0x0;_0x35b5d1<_0x5a69a4[_0x84f2('0x34')]['ids']['length'];_0x35b5d1+=0x1){socket[_0x84f2('0x72')](_0x84f2('0x5f'),{'UserId':Number(_0x5a69a4['body']['ids'][_0x35b5d1]),'MailQueueId':Number(_0x5a69a4[_0x84f2('0x3f')]['id'])});}return _0x737b4a;});}})[_0x84f2('0x18')](respondWithResult(_0x18e286,null))[_0x84f2('0x26')](handleError(_0x18e286,null));};exports['removeAgents']=function(_0x34cd75,_0x3273b8){return db[_0x84f2('0x22')]['find']({'where':{'id':_0x34cd75[_0x84f2('0x3f')]['id']}})['then'](handleEntityNotFound(_0x3273b8,null))['then'](function(_0x5b151c){if(_0x5b151c){return _0x5b151c[_0x84f2('0x76')](_0x34cd75[_0x84f2('0x2a')][_0x84f2('0x55')])[_0x84f2('0x18')](function(){if(_['isArray'](_0x34cd75[_0x84f2('0x2a')][_0x84f2('0x55')])){for(var _0x42bbf7=0x0;_0x42bbf7<_0x34cd75[_0x84f2('0x2a')][_0x84f2('0x55')][_0x84f2('0x41')];_0x42bbf7+=0x1){socket[_0x84f2('0x72')](_0x84f2('0x77'),{'UserId':Number(_0x34cd75['query'][_0x84f2('0x55')][_0x42bbf7]),'MailQueueId':Number(_0x34cd75['params']['id'])});}}else{socket[_0x84f2('0x72')](_0x84f2('0x77'),{'UserId':Number(_0x34cd75[_0x84f2('0x2a')][_0x84f2('0x55')]),'MailQueueId':Number(_0x34cd75[_0x84f2('0x3f')]['id'])});}});}})[_0x84f2('0x18')](respondWithStatusCode(_0x3273b8,null))['catch'](handleError(_0x3273b8,null));};exports[_0x84f2('0x78')]=function(_0x3e4768,_0x10dc70){var _0x1868c9={};var _0x42c5e5={};var _0x373616;var _0x46a427;return db[_0x84f2('0x22')][_0x84f2('0x3e')]({'where':{'id':_0x3e4768[_0x84f2('0x3f')]['id']}})[_0x84f2('0x18')](handleEntityNotFound(_0x10dc70,null))[_0x84f2('0x18')](function(_0x105d8a){if(_0x105d8a){_0x373616=_0x105d8a;_0x42c5e5['model']=_[_0x84f2('0x29')](db[_0x84f2('0x48')][_0x84f2('0x1f')]);_0x42c5e5[_0x84f2('0x2a')]=_[_0x84f2('0x29')](_0x3e4768[_0x84f2('0x2a')]);_0x42c5e5[_0x84f2('0x2b')]=_['intersection'](_0x42c5e5[_0x84f2('0x28')],_0x42c5e5[_0x84f2('0x2a')]);_0x1868c9['attributes']=_[_0x84f2('0x2c')](_0x42c5e5[_0x84f2('0x28')],qs[_0x84f2('0x2d')](_0x3e4768['query']['fields']));_0x1868c9[_0x84f2('0x2e')]=_0x1868c9[_0x84f2('0x2e')]['length']?_0x1868c9[_0x84f2('0x2e')]:_0x42c5e5[_0x84f2('0x28')];_0x1868c9['order']=qs[_0x84f2('0x45')](_0x3e4768['query'][_0x84f2('0x45')]);_0x1868c9['where']=qs[_0x84f2('0x2b')](_['pick'](_0x3e4768[_0x84f2('0x2a')],_0x42c5e5[_0x84f2('0x2b')]));if(_0x3e4768['query'][_0x84f2('0x53')]){_0x1868c9[_0x84f2('0x21')]=_['merge'](_0x1868c9[_0x84f2('0x21')],{'$or':_[_0x84f2('0x1e')](_0x1868c9[_0x84f2('0x2e')],function(_0x5af138){var _0x4792f1={};_0x4792f1[_0x5af138]={'$like':'%'+_0x3e4768[_0x84f2('0x2a')][_0x84f2('0x53')]+'%'};return _0x4792f1;})});}_0x1868c9=_[_0x84f2('0x30')]({},_0x1868c9,_0x3e4768['options']);return _0x373616[_0x84f2('0x78')](_0x1868c9);}})[_0x84f2('0x18')](function(_0xd637e2){if(_0xd637e2){_0x46a427=_0xd637e2['length'];if(!_0x3e4768[_0x84f2('0x2a')][_0x84f2('0x42')](_0x84f2('0x43'))){_0x1868c9[_0x84f2('0x12')]=qs['limit'](_0x3e4768['query'][_0x84f2('0x12')]);_0x1868c9[_0x84f2('0x14')]=qs[_0x84f2('0x14')](_0x3e4768[_0x84f2('0x2a')][_0x84f2('0x14')]);}return _0x373616[_0x84f2('0x78')](_0x1868c9);}})[_0x84f2('0x18')](function(_0x3dfe63){if(_0x3dfe63){return _0x3dfe63?{'count':_0x46a427,'rows':_0x3dfe63}:null;}})[_0x84f2('0x18')](respondWithResult(_0x10dc70,null))[_0x84f2('0x26')](handleError(_0x10dc70,null));}; \ No newline at end of file +var _0x41e8=['then','destroy','get','MailQueues','UserProfileResource','sendStatus','error','stack','name','index','map','MailQueue','rawAttributes','fieldName','type','key','getOptions','where','include','findAll','rows','catch','show','model','keys','query','filters','intersection','fields','attributes','length','includeAll','merge','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','UserMailQueue','hasOwnProperty','order','sort','pick','MailQueueId','filter','options','UserId','agent','createdAt','%s/%s','SIP','mailPause','updatedAt','getTeams','findOne','Team','nolimit','addTeams','User','Agents','online','voicePause','flatMap','sequelize','transaction','each','findOrCreate','emit','removeTeams','select','tq.TeamId','from','team_has_mail_queues','user_has_teams','MailQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','TeamId','includes','union','compact','value','ids','isEmpty','removeAgents','forEach','userMailQueue:remove','addAgents','omit','userMailQueue:save','isArray','getAgents','bluebird','util','lodash','squel','ioredis','../../components/parsers/qs','../../config/environment','redis','defaults','socket.io-emitter','./mailQueue.socket','register','status','end','offset','undefined','limit','count','set','Content-Range','update'];(function(_0x394576,_0x5d447b){var _0x3dbf0b=function(_0x5a602a){while(--_0x5a602a){_0x394576['push'](_0x394576['shift']());}};_0x3dbf0b(++_0x5d447b);}(_0x41e8,0x15c));var _0x841e=function(_0x297fd3,_0x115406){_0x297fd3=_0x297fd3-0x0;var _0x2af381=_0x41e8[_0x297fd3];return _0x2af381;};'use strict';var BPromise=require(_0x841e('0x0'));var util=require(_0x841e('0x1'));var _=require(_0x841e('0x2'));var squel=require(_0x841e('0x3'));var Redis=require(_0x841e('0x4'));var qs=require(_0x841e('0x5'));var logger=require('../../config/logger')('api');var config=require(_0x841e('0x6'));var db=require('../../mysqldb')['db'];config[_0x841e('0x7')]=_[_0x841e('0x8')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x841e('0x9'))(new Redis(config[_0x841e('0x7')]));require(_0x841e('0xa'))[_0x841e('0xb')](socket);function respondWithStatusCode(_0x1410be,_0x4224ec){_0x4224ec=_0x4224ec||0xcc;return function(_0x52ce59){if(_0x52ce59){return _0x1410be['sendStatus'](_0x4224ec);}return _0x1410be[_0x841e('0xc')](_0x4224ec)[_0x841e('0xd')]();};}function respondWithResult(_0x25b1a2,_0x57c072){_0x57c072=_0x57c072||0xc8;return function(_0x59f0d6){if(_0x59f0d6){return _0x25b1a2[_0x841e('0xc')](_0x57c072)['json'](_0x59f0d6);}};}function respondWithFilteredResult(_0x55b2c8,_0xa90021){return function(_0x5dc0c0){if(_0x5dc0c0){var _0xf2e746=typeof _0xa90021[_0x841e('0xe')]===_0x841e('0xf')&&typeof _0xa90021[_0x841e('0x10')]===_0x841e('0xf');var _0x25f52c=_0x5dc0c0[_0x841e('0x11')];var _0x5ae059=_0xf2e746?0x0:_0xa90021['offset'];var _0x4a7c88=_0xf2e746?_0x5dc0c0[_0x841e('0x11')]:_0xa90021[_0x841e('0xe')]+_0xa90021['limit'];var _0x113dd0;if(_0x4a7c88>=_0x25f52c){_0x4a7c88=_0x25f52c;_0x113dd0=0xc8;}else{_0x113dd0=0xce;}_0x55b2c8[_0x841e('0xc')](_0x113dd0);return _0x55b2c8[_0x841e('0x12')](_0x841e('0x13'),_0x5ae059+'-'+_0x4a7c88+'/'+_0x25f52c)['json'](_0x5dc0c0);}return null;};}function saveUpdates(_0x1e43bd){return function(_0x9f3403){if(_0x9f3403){return _0x9f3403[_0x841e('0x14')](_0x1e43bd)[_0x841e('0x15')](function(_0x2b85fa){return _0x2b85fa;});}return null;};}function removeEntity(_0x5b188b){return function(_0xec3317){if(_0xec3317){return _0xec3317[_0x841e('0x16')]()['then'](function(){var _0x34c6a6=_0xec3317[_0x841e('0x17')]({'plain':!![]});var _0x32ec31=_0x841e('0x18');return db[_0x841e('0x19')][_0x841e('0x16')]({'where':{'type':_0x32ec31,'resourceId':_0x34c6a6['id']}})[_0x841e('0x15')](function(){return _0xec3317;});})[_0x841e('0x15')](function(){_0x5b188b[_0x841e('0xc')](0xcc)['end']();});}};}function handleEntityNotFound(_0x9aff4){return function(_0x50fc8a){if(!_0x50fc8a){_0x9aff4[_0x841e('0x1a')](0x194);}return _0x50fc8a;};}function handleError(_0x40ad09,_0x46c938){_0x46c938=_0x46c938||0x1f4;return function(_0x8e8459){logger[_0x841e('0x1b')](_0x8e8459[_0x841e('0x1c')]);if(_0x8e8459[_0x841e('0x1d')]){delete _0x8e8459[_0x841e('0x1d')];}_0x40ad09[_0x841e('0xc')](_0x46c938)['send'](_0x8e8459);};}exports[_0x841e('0x1e')]=function(_0x3da6c5,_0x5f1371){var _0x55da2d={};var _0x9ffffc={'count':0x0,'rows':[]};var _0x10b354=_[_0x841e('0x1f')](db[_0x841e('0x20')][_0x841e('0x21')],function(_0x3c55a1){return{'name':_0x3c55a1[_0x841e('0x22')],'type':_0x3c55a1[_0x841e('0x23')][_0x841e('0x24')]};});_0x55da2d=qs[_0x841e('0x25')](_0x10b354,_0x3da6c5);var _0x30a446={'where':_0x55da2d[_0x841e('0x26')]};return db[_0x841e('0x20')]['count'](_0x30a446)['then'](function(_0x495daa){_0x9ffffc[_0x841e('0x11')]=_0x495daa;_0x55da2d[_0x841e('0x27')]=qs[_0x841e('0x27')](_0x3da6c5['query']);return db['MailQueue'][_0x841e('0x28')](_0x55da2d);})[_0x841e('0x15')](function(_0x44a979){_0x9ffffc[_0x841e('0x29')]=_0x44a979;return _0x9ffffc;})[_0x841e('0x15')](respondWithFilteredResult(_0x5f1371,_0x55da2d))[_0x841e('0x2a')](handleError(_0x5f1371,null));};exports[_0x841e('0x2b')]=function(_0x2c4e20,_0x38f9b9){var _0x301442={'raw':!![],'where':{'id':_0x2c4e20['params']['id']}},_0x338766={};_0x338766[_0x841e('0x2c')]=_[_0x841e('0x2d')](db['MailQueue']['rawAttributes']);_0x338766[_0x841e('0x2e')]=_['keys'](_0x2c4e20[_0x841e('0x2e')]);_0x338766[_0x841e('0x2f')]=_[_0x841e('0x30')](_0x338766[_0x841e('0x2c')],_0x338766['query']);_0x301442['attributes']=_[_0x841e('0x30')](_0x338766[_0x841e('0x2c')],qs[_0x841e('0x31')](_0x2c4e20[_0x841e('0x2e')][_0x841e('0x31')]));_0x301442[_0x841e('0x32')]=_0x301442[_0x841e('0x32')][_0x841e('0x33')]?_0x301442[_0x841e('0x32')]:_0x338766[_0x841e('0x2c')];if(_0x2c4e20['query'][_0x841e('0x34')]){_0x301442[_0x841e('0x27')]=[{'all':!![]}];}_0x301442=_[_0x841e('0x35')]({},_0x301442,_0x2c4e20['options']);return db[_0x841e('0x20')][_0x841e('0x36')](_0x301442)[_0x841e('0x15')](handleEntityNotFound(_0x38f9b9,null))[_0x841e('0x15')](respondWithResult(_0x38f9b9,null))[_0x841e('0x2a')](handleError(_0x38f9b9,null));};exports[_0x841e('0x37')]=function(_0x5dd1f4,_0x2f1955){return db[_0x841e('0x20')][_0x841e('0x37')](_0x5dd1f4[_0x841e('0x38')],{})[_0x841e('0x15')](function(_0x27e1d8){var _0x381ea7=_0x5dd1f4[_0x841e('0x39')]['get']({'plain':!![]});if(!_0x381ea7)throw new Error(_0x841e('0x3a'));if(_0x381ea7['role']===_0x841e('0x39')){var _0x44123d=_0x27e1d8[_0x841e('0x17')]({'plain':!![]});var _0x19a0cf='MailQueues';return db[_0x841e('0x3b')][_0x841e('0x36')]({'where':{'name':_0x19a0cf,'userProfileId':_0x381ea7[_0x841e('0x3c')]},'raw':!![]})[_0x841e('0x15')](function(_0x2a2644){if(_0x2a2644&&_0x2a2644[_0x841e('0x3d')]===0x0){return db[_0x841e('0x19')][_0x841e('0x37')]({'name':_0x44123d[_0x841e('0x1d')],'resourceId':_0x44123d['id'],'type':_0x2a2644[_0x841e('0x1d')],'sectionId':_0x2a2644['id']},{})[_0x841e('0x15')](function(){return _0x27e1d8;});}else{return _0x27e1d8;}})[_0x841e('0x2a')](function(_0x359f40){logger[_0x841e('0x1b')](_0x841e('0x3e'),_0x359f40);throw _0x359f40;});}return _0x27e1d8;})[_0x841e('0x15')](respondWithResult(_0x2f1955,0xc9))[_0x841e('0x2a')](handleError(_0x2f1955,null));};exports[_0x841e('0x14')]=function(_0x587bfb,_0xe87ba){if(_0x587bfb[_0x841e('0x38')]['id']){delete _0x587bfb[_0x841e('0x38')]['id'];}return db['MailQueue'][_0x841e('0x36')]({'where':{'id':_0x587bfb['params']['id']}})[_0x841e('0x15')](handleEntityNotFound(_0xe87ba,null))[_0x841e('0x15')](saveUpdates(_0x587bfb[_0x841e('0x38')],null))[_0x841e('0x15')](respondWithResult(_0xe87ba,null))[_0x841e('0x2a')](handleError(_0xe87ba,null));};exports[_0x841e('0x16')]=function(_0x2d1568,_0x5ece00){return db[_0x841e('0x20')][_0x841e('0x36')]({'where':{'id':_0x2d1568[_0x841e('0x3f')]['id']}})['then'](handleEntityNotFound(_0x5ece00,null))[_0x841e('0x15')](removeEntity(_0x5ece00,null))[_0x841e('0x2a')](handleError(_0x5ece00,null));};exports[_0x841e('0x40')]=function(_0x381557,_0x2b35f5){return db[_0x841e('0x20')][_0x841e('0x40')]()[_0x841e('0x15')](respondWithResult(_0x2b35f5,null))[_0x841e('0x2a')](handleError(_0x2b35f5,null));};exports['getMembers']=function(_0x52184d,_0x48317c){var _0x17d9b6={'raw':!![],'where':{}},_0x5ed348={},_0x4046c0;return db[_0x841e('0x20')]['findOne']({'where':{'id':_0x52184d[_0x841e('0x3f')]['id']}})[_0x841e('0x15')](handleEntityNotFound(_0x48317c,null))['then'](function(_0x2d9b24){if(_0x2d9b24){_0x4046c0=_0x2d9b24[_0x841e('0x17')]({'plain':!![]});_0x5ed348['model']=_[_0x841e('0x2d')](db[_0x841e('0x41')]['rawAttributes']);_0x5ed348[_0x841e('0x2e')]=_['keys'](_0x52184d[_0x841e('0x2e')]);_0x5ed348[_0x841e('0x2f')]=_['intersection'](_0x5ed348[_0x841e('0x2c')],_0x5ed348[_0x841e('0x2e')]);_0x17d9b6[_0x841e('0x32')]=_[_0x841e('0x30')](_0x5ed348[_0x841e('0x2c')],qs[_0x841e('0x31')](_0x52184d[_0x841e('0x2e')][_0x841e('0x31')]));_0x17d9b6[_0x841e('0x32')]=_0x17d9b6[_0x841e('0x32')][_0x841e('0x33')]?_0x17d9b6['attributes']:_0x5ed348[_0x841e('0x2c')];if(!_0x52184d['query'][_0x841e('0x42')]('nolimit')){_0x17d9b6[_0x841e('0x10')]=qs[_0x841e('0x10')](_0x52184d[_0x841e('0x2e')][_0x841e('0x10')]);_0x17d9b6[_0x841e('0xe')]=qs[_0x841e('0xe')](_0x52184d['query'][_0x841e('0xe')]);}_0x17d9b6[_0x841e('0x43')]=qs[_0x841e('0x44')](_0x52184d[_0x841e('0x2e')][_0x841e('0x44')]);_0x17d9b6[_0x841e('0x26')]=qs[_0x841e('0x2f')](_[_0x841e('0x45')](_0x52184d[_0x841e('0x2e')],_0x5ed348['filters']));_0x17d9b6[_0x841e('0x26')][_0x841e('0x46')]=_0x2d9b24['id'];if(_0x52184d[_0x841e('0x2e')][_0x841e('0x47')]){_0x17d9b6[_0x841e('0x26')]=_['merge'](_0x17d9b6[_0x841e('0x26')],{'$or':_[_0x841e('0x1f')](_0x17d9b6[_0x841e('0x32')],function(_0x1a52a1){var _0x4965c8={};_0x4965c8[_0x1a52a1]={'$like':'%'+_0x52184d[_0x841e('0x2e')]['filter']+'%'};return _0x4965c8;})});}_0x17d9b6=_[_0x841e('0x35')]({},_0x17d9b6,_0x52184d[_0x841e('0x48')]);return db[_0x841e('0x41')][_0x841e('0x28')](_0x17d9b6);}})[_0x841e('0x15')](function(_0x42fd44){if(_0x42fd44){return db['User']['findAndCountAll']({'where':{'id':_[_0x841e('0x1f')](_0x42fd44,_0x841e('0x49')),'role':_0x841e('0x4a')},'attributes':['id',_0x841e('0x1d'),'mailPause','updatedAt',_0x841e('0x4b')]});}})[_0x841e('0x15')](function(_0x24a68f){if(_0x24a68f){return{'count':_0x24a68f[_0x841e('0x11')],'rows':_[_0x841e('0x1f')](_0x24a68f['rows'],function(_0x2a9ea8){return{'membername':_0x2a9ea8['name'],'UserId':_0x2a9ea8['id'],'queue_name':_0x4046c0[_0x841e('0x1d')],'MailQueueId':_0x4046c0['id'],'interface':util['format'](_0x841e('0x4c'),_0x841e('0x4d'),_0x2a9ea8[_0x841e('0x1d')]),'penalty':0x0,'paused':_0x2a9ea8[_0x841e('0x4e')],'createdAt':_0x2a9ea8[_0x841e('0x4b')],'updatedAt':_0x2a9ea8[_0x841e('0x4f')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x841e('0x15')](respondWithFilteredResult(_0x48317c,_0x17d9b6))[_0x841e('0x2a')](handleError(_0x48317c,null));};exports[_0x841e('0x50')]=function(_0x108920,_0x365ecb){var _0x2873b0={};var _0x5953c2={};var _0x580204;var _0x3c76dc;return db['MailQueue'][_0x841e('0x51')]({'where':{'id':_0x108920['params']['id']}})[_0x841e('0x15')](handleEntityNotFound(_0x365ecb,null))[_0x841e('0x15')](function(_0xd43fff){if(_0xd43fff){_0x580204=_0xd43fff;_0x5953c2['model']=_['keys'](db[_0x841e('0x52')][_0x841e('0x21')]);_0x5953c2[_0x841e('0x2e')]=_[_0x841e('0x2d')](_0x108920[_0x841e('0x2e')]);_0x5953c2['filters']=_[_0x841e('0x30')](_0x5953c2[_0x841e('0x2c')],_0x5953c2[_0x841e('0x2e')]);_0x2873b0[_0x841e('0x32')]=_['intersection'](_0x5953c2[_0x841e('0x2c')],qs[_0x841e('0x31')](_0x108920[_0x841e('0x2e')][_0x841e('0x31')]));_0x2873b0['attributes']=_0x2873b0['attributes'][_0x841e('0x33')]?_0x2873b0[_0x841e('0x32')]:_0x5953c2['model'];_0x2873b0[_0x841e('0x43')]=qs[_0x841e('0x44')](_0x108920[_0x841e('0x2e')][_0x841e('0x44')]);_0x2873b0[_0x841e('0x26')]=qs[_0x841e('0x2f')](_['pick'](_0x108920[_0x841e('0x2e')],_0x5953c2[_0x841e('0x2f')]));if(_0x108920[_0x841e('0x2e')][_0x841e('0x47')]){_0x2873b0[_0x841e('0x26')]=_[_0x841e('0x35')](_0x2873b0[_0x841e('0x26')],{'$or':_[_0x841e('0x1f')](_0x2873b0['attributes'],function(_0x342da4){var _0x8f4018={};_0x8f4018[_0x342da4]={'$like':'%'+_0x108920[_0x841e('0x2e')][_0x841e('0x47')]+'%'};return _0x8f4018;})});}_0x2873b0=_['merge']({},_0x2873b0,_0x108920[_0x841e('0x48')]);return _0x580204[_0x841e('0x50')](_0x2873b0);}})[_0x841e('0x15')](function(_0x5054c1){if(_0x5054c1){_0x3c76dc=_0x5054c1[_0x841e('0x33')];if(!_0x108920[_0x841e('0x2e')][_0x841e('0x42')](_0x841e('0x53'))){_0x2873b0[_0x841e('0x10')]=qs['limit'](_0x108920[_0x841e('0x2e')][_0x841e('0x10')]);_0x2873b0['offset']=qs[_0x841e('0xe')](_0x108920[_0x841e('0x2e')][_0x841e('0xe')]);}return _0x580204[_0x841e('0x50')](_0x2873b0);}})[_0x841e('0x15')](function(_0x3ad9a9){if(_0x3ad9a9){return _0x3ad9a9?{'count':_0x3c76dc,'rows':_0x3ad9a9}:null;}})[_0x841e('0x15')](respondWithResult(_0x365ecb,null))[_0x841e('0x2a')](handleError(_0x365ecb,null));};exports[_0x841e('0x54')]=function(_0x42097f,_0x5bc732){var _0x232e1b=_0x42097f[_0x841e('0x38')]['ids'];return db[_0x841e('0x52')][_0x841e('0x28')]({'where':{'id':_0x232e1b},'attributes':['id'],'include':[{'model':db[_0x841e('0x55')],'as':_0x841e('0x56'),'attributes':['id',_0x841e('0x1d'),_0x841e('0x57'),_0x841e('0x58'),'interface'],'raw':!![]}]})[_0x841e('0x15')](function(_0xe8e548){if(_0xe8e548){var _0x3d55bf=_[_0x841e('0x59')](_0xe8e548,function(_0x12159f){var _0x5c35cf=_0x12159f[_0x841e('0x17')]({'plain':!![]});return _0x5c35cf[_0x841e('0x56')];});return db[_0x841e('0x20')][_0x841e('0x36')]({'where':{'id':_0x42097f[_0x841e('0x3f')]['id']}})[_0x841e('0x15')](function(_0x5310b0){return db[_0x841e('0x5a')][_0x841e('0x5b')](function(_0x5ee4e4){return _0x5310b0[_0x841e('0x54')](_0x232e1b,{'transaction':_0x5ee4e4})[_0x841e('0x15')](function(){return BPromise[_0x841e('0x5c')](_0x3d55bf,function(_0x290da3){return db[_0x841e('0x41')][_0x841e('0x5d')]({'where':{'UserId':_0x290da3['id'],'MailQueueId':_0x42097f[_0x841e('0x3f')]['id']},'transaction':_0x5ee4e4});});})[_0x841e('0x15')](function(){_0x3d55bf['forEach'](function(_0x306563){socket[_0x841e('0x5e')]('userMailQueue:save',{'UserId':_0x306563['id'],'MailQueueId':_0x5310b0['id']});});});});});}})[_0x841e('0x15')](respondWithStatusCode(_0x5bc732,null))[_0x841e('0x2a')](handleError(_0x5bc732,null));};exports[_0x841e('0x5f')]=function(_0xabc068,_0x9f1eba){return db[_0x841e('0x52')][_0x841e('0x28')]({'where':{'id':_0xabc068['query']['ids']},'attributes':['id'],'include':[{'model':db[_0x841e('0x55')],'as':_0x841e('0x56'),'attributes':['id'],'raw':!![]}]})[_0x841e('0x15')](handleEntityNotFound(_0x9f1eba,null))[_0x841e('0x15')](function(_0x41c3dd){var _0x510d55=_[_0x841e('0x1f')](_0x41c3dd,'id');var _0x73944f=[];var _0x23504e=[];var _0x3bf29b=squel[_0x841e('0x60')]();_0x3bf29b['field'](_0x841e('0x61'))[_0x841e('0x62')](_0x841e('0x63'),'tq')['join'](_0x841e('0x64'),'ut','ut.TeamId\x20=\x20tq.TeamId')['where'](_0x841e('0x65'),_0xabc068[_0x841e('0x3f')]['id']);for(var _0x5dc64f=0x0;_0x5dc64f<_0x41c3dd[_0x841e('0x33')];_0x5dc64f+=0x1){let _0x2c0c2e=_0x41c3dd[_0x5dc64f];for(var _0x297883=0x0;_0x297883<_0x2c0c2e[_0x841e('0x56')][_0x841e('0x33')];_0x297883+=0x1){let _0x5bfb86=_0x2c0c2e['Agents'][_0x297883];var _0x30f8d5=_0x3bf29b[_0x841e('0x66')]();_0x30f8d5['where'](_0x841e('0x67'),_0x5bfb86['id']);_0x23504e[_0x841e('0x68')](db['sequelize']['query'](_0x30f8d5[_0x841e('0x69')](),{'type':db[_0x841e('0x5a')][_0x841e('0x6a')][_0x841e('0x6b')]})['then'](function(_0x1cc70e){if(_0x1cc70e[_0x841e('0x33')]===0x1){return _0x5bfb86['id'];}else{var _0x10095d=_['every'](_['map'](_0x1cc70e,_0x841e('0x6c')),function(_0xa1388d){return _[_0x841e('0x6d')](_0x510d55,_0xa1388d);});if(_0x10095d){return _0x5bfb86['id'];}}}));}}return BPromise['all'](_0x23504e)['then'](function(_0x1e0dcb){_0x73944f=_(_0x73944f)[_0x841e('0x6e')](_0x1e0dcb)[_0x841e('0x6f')]()[_0x841e('0x70')]();return db[_0x841e('0x20')][_0x841e('0x36')]({'where':{'id':_0xabc068['params']['id']}})[_0x841e('0x15')](function(_0xf9c353){return db[_0x841e('0x5a')]['transaction'](function(_0x54b855){return _0xf9c353[_0x841e('0x5f')](_0xabc068[_0x841e('0x2e')][_0x841e('0x71')],{'transaction':_0x54b855})[_0x841e('0x15')](function(){if(!_[_0x841e('0x72')](_0x73944f)){return _0xf9c353[_0x841e('0x73')](_0x73944f,{'transaction':_0x54b855});}})[_0x841e('0x15')](function(){_0x73944f[_0x841e('0x74')](function(_0x23cfbb){socket[_0x841e('0x5e')](_0x841e('0x75'),{'UserId':_0x23cfbb,'MailQueueId':_0xf9c353['id']});});});});});});})[_0x841e('0x15')](respondWithStatusCode(_0x9f1eba,null))[_0x841e('0x2a')](handleError(_0x9f1eba,null));};exports[_0x841e('0x76')]=function(_0x520ab3,_0x50e94c){return db[_0x841e('0x20')][_0x841e('0x36')]({'where':{'id':_0x520ab3[_0x841e('0x3f')]['id']}})[_0x841e('0x15')](handleEntityNotFound(_0x50e94c,null))['then'](function(_0x515632){if(_0x515632){return _0x515632[_0x841e('0x76')](_0x520ab3[_0x841e('0x38')][_0x841e('0x71')],_[_0x841e('0x77')](_0x520ab3[_0x841e('0x38')],['ids','id'])||{})['spread'](function(_0x2cc750){for(var _0x5f1ddd=0x0;_0x5f1ddd<_0x520ab3['body']['ids']['length'];_0x5f1ddd+=0x1){socket[_0x841e('0x5e')](_0x841e('0x78'),{'UserId':Number(_0x520ab3[_0x841e('0x38')][_0x841e('0x71')][_0x5f1ddd]),'MailQueueId':Number(_0x520ab3['params']['id'])});}return _0x2cc750;});}})[_0x841e('0x15')](respondWithResult(_0x50e94c,null))[_0x841e('0x2a')](handleError(_0x50e94c,null));};exports[_0x841e('0x73')]=function(_0x463f10,_0x3b7121){return db[_0x841e('0x20')][_0x841e('0x36')]({'where':{'id':_0x463f10[_0x841e('0x3f')]['id']}})[_0x841e('0x15')](handleEntityNotFound(_0x3b7121,null))[_0x841e('0x15')](function(_0x515349){if(_0x515349){return _0x515349[_0x841e('0x73')](_0x463f10[_0x841e('0x2e')]['ids'])['then'](function(){if(_[_0x841e('0x79')](_0x463f10[_0x841e('0x2e')][_0x841e('0x71')])){for(var _0x497b07=0x0;_0x497b07<_0x463f10[_0x841e('0x2e')][_0x841e('0x71')][_0x841e('0x33')];_0x497b07+=0x1){socket[_0x841e('0x5e')]('userMailQueue:remove',{'UserId':Number(_0x463f10[_0x841e('0x2e')][_0x841e('0x71')][_0x497b07]),'MailQueueId':Number(_0x463f10['params']['id'])});}}else{socket[_0x841e('0x5e')](_0x841e('0x75'),{'UserId':Number(_0x463f10[_0x841e('0x2e')][_0x841e('0x71')]),'MailQueueId':Number(_0x463f10['params']['id'])});}});}})[_0x841e('0x15')](respondWithStatusCode(_0x3b7121,null))[_0x841e('0x2a')](handleError(_0x3b7121,null));};exports[_0x841e('0x7a')]=function(_0x803f9c,_0x45b423){var _0x538a1f={};var _0x1c85bc={};var _0x6ec0d0;var _0x6504b7;return db['MailQueue']['findOne']({'where':{'id':_0x803f9c[_0x841e('0x3f')]['id']}})['then'](handleEntityNotFound(_0x45b423,null))[_0x841e('0x15')](function(_0x351493){if(_0x351493){_0x6ec0d0=_0x351493;_0x1c85bc[_0x841e('0x2c')]=_[_0x841e('0x2d')](db[_0x841e('0x55')][_0x841e('0x21')]);_0x1c85bc['query']=_['keys'](_0x803f9c[_0x841e('0x2e')]);_0x1c85bc[_0x841e('0x2f')]=_[_0x841e('0x30')](_0x1c85bc[_0x841e('0x2c')],_0x1c85bc[_0x841e('0x2e')]);_0x538a1f['attributes']=_[_0x841e('0x30')](_0x1c85bc['model'],qs[_0x841e('0x31')](_0x803f9c['query']['fields']));_0x538a1f[_0x841e('0x32')]=_0x538a1f[_0x841e('0x32')][_0x841e('0x33')]?_0x538a1f['attributes']:_0x1c85bc['model'];_0x538a1f[_0x841e('0x43')]=qs[_0x841e('0x44')](_0x803f9c['query'][_0x841e('0x44')]);_0x538a1f[_0x841e('0x26')]=qs[_0x841e('0x2f')](_[_0x841e('0x45')](_0x803f9c[_0x841e('0x2e')],_0x1c85bc[_0x841e('0x2f')]));if(_0x803f9c[_0x841e('0x2e')]['filter']){_0x538a1f[_0x841e('0x26')]=_[_0x841e('0x35')](_0x538a1f[_0x841e('0x26')],{'$or':_[_0x841e('0x1f')](_0x538a1f[_0x841e('0x32')],function(_0xd35ba7){var _0x240813={};_0x240813[_0xd35ba7]={'$like':'%'+_0x803f9c['query'][_0x841e('0x47')]+'%'};return _0x240813;})});}_0x538a1f=_[_0x841e('0x35')]({},_0x538a1f,_0x803f9c['options']);return _0x6ec0d0[_0x841e('0x7a')](_0x538a1f);}})[_0x841e('0x15')](function(_0x39e5a4){if(_0x39e5a4){_0x6504b7=_0x39e5a4[_0x841e('0x33')];if(!_0x803f9c[_0x841e('0x2e')][_0x841e('0x42')](_0x841e('0x53'))){_0x538a1f[_0x841e('0x10')]=qs[_0x841e('0x10')](_0x803f9c[_0x841e('0x2e')][_0x841e('0x10')]);_0x538a1f[_0x841e('0xe')]=qs[_0x841e('0xe')](_0x803f9c[_0x841e('0x2e')][_0x841e('0xe')]);}return _0x6ec0d0['getAgents'](_0x538a1f);}})['then'](function(_0x3b6e96){if(_0x3b6e96){return _0x3b6e96?{'count':_0x6504b7,'rows':_0x3b6e96}:null;}})[_0x841e('0x15')](respondWithResult(_0x45b423,null))['catch'](handleError(_0x45b423,null));}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.events.js b/server/api/mailQueue/mailQueue.events.js index 5101adb..712dc79 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 _0x0f0a=['events','../../mysqldb','setMaxListeners','save','update','emit'];(function(_0x38065f,_0x241cf4){var _0x2d546f=function(_0xb61491){while(--_0xb61491){_0x38065f['push'](_0x38065f['shift']());}};_0x2d546f(++_0x241cf4);}(_0x0f0a,0x96));var _0xa0f0=function(_0x459bc1,_0x57866f){_0x459bc1=_0x459bc1-0x0;var _0x4d16ce=_0x0f0a[_0x459bc1];return _0x4d16ce;};'use strict';var EventEmitter=require(_0xa0f0('0x0'));var MailQueue=require(_0xa0f0('0x1'))['db']['MailQueue'];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0xa0f0('0x2')](0x0);var events={'afterCreate':_0xa0f0('0x3'),'afterUpdate':_0xa0f0('0x4'),'afterDestroy':'remove'};function emitEvent(_0x2b20c3){return function(_0x105f46,_0x40e3c7,_0x416bb0){MailQueueEvents[_0xa0f0('0x5')](_0x2b20c3+':'+_0x105f46['id'],_0x105f46);MailQueueEvents[_0xa0f0('0x5')](_0x2b20c3,_0x105f46);_0x416bb0(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailQueue['hook'](e,emitEvent(event));}}module['exports']=MailQueueEvents; \ No newline at end of file +var _0xe11a=['events','../../mysqldb','MailQueue','setMaxListeners','save','update','emit','hasOwnProperty','hook'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe11a,0x105));var _0xae11=function(_0x2c6a5d,_0x2b9bf6){_0x2c6a5d=_0x2c6a5d-0x0;var _0x51a19a=_0xe11a[_0x2c6a5d];return _0x51a19a;};'use strict';var EventEmitter=require(_0xae11('0x0'));var MailQueue=require(_0xae11('0x1'))['db'][_0xae11('0x2')];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0xae11('0x3')](0x0);var events={'afterCreate':_0xae11('0x4'),'afterUpdate':_0xae11('0x5'),'afterDestroy':'remove'};function emitEvent(_0x2a093c){return function(_0x1e931c,_0x12ceab,_0x10080e){MailQueueEvents[_0xae11('0x6')](_0x2a093c+':'+_0x1e931c['id'],_0x1e931c);MailQueueEvents[_0xae11('0x6')](_0x2a093c,_0x1e931c);_0x10080e(null);};}for(var e in events){if(events[_0xae11('0x7')](e)){var event=events[e];MailQueue[_0xae11('0x8')](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 b43c184..326a9d1 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 _0x6279=['../../config/environment','mail_queues','lodash','util','api','bluebird','path','rimraf'];(function(_0x4e0a8f,_0x418168){var _0xeaff5b=function(_0xfa0aba){while(--_0xfa0aba){_0x4e0a8f['push'](_0x4e0a8f['shift']());}};_0xeaff5b(++_0x418168);}(_0x6279,0x1ca));var _0x9627=function(_0x316371,_0x3c225f){_0x316371=_0x316371-0x0;var _0x576f72=_0x6279[_0x316371];return _0x576f72;};'use strict';var _=require(_0x9627('0x0'));var util=require(_0x9627('0x1'));var logger=require('../../config/logger')(_0x9627('0x2'));var moment=require('moment');var BPromise=require(_0x9627('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9627('0x4'));var rimraf=require(_0x9627('0x5'));var config=require(_0x9627('0x6'));var attributes=require('./mailQueue.attributes');module['exports']=function(_0x42f8d4,_0x240b1d){return _0x42f8d4['define']('MailQueue',attributes,{'tableName':_0x9627('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x89d5=['lodash','util','api','moment','request-promise','path','../../config/environment','./mailQueue.attributes','exports','define','MailQueue','mail_queues'];(function(_0x4997f9,_0x832b9a){var _0x488b9b=function(_0x6ab118){while(--_0x6ab118){_0x4997f9['push'](_0x4997f9['shift']());}};_0x488b9b(++_0x832b9a);}(_0x89d5,0xb4));var _0x589d=function(_0x49ca18,_0x5e6d05){_0x49ca18=_0x49ca18-0x0;var _0x145d54=_0x89d5[_0x49ca18];return _0x145d54;};'use strict';var _=require(_0x589d('0x0'));var util=require(_0x589d('0x1'));var logger=require('../../config/logger')(_0x589d('0x2'));var moment=require(_0x589d('0x3'));var BPromise=require('bluebird');var rp=require(_0x589d('0x4'));var fs=require('fs');var path=require(_0x589d('0x5'));var rimraf=require('rimraf');var config=require(_0x589d('0x6'));var attributes=require(_0x589d('0x7'));module[_0x589d('0x8')]=function(_0x3a6197,_0x5c8f67){return _0x3a6197[_0x589d('0x9')](_0x589d('0xa'),attributes,{'tableName':_0x589d('0xb'),'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 454a00d..1e0f0dc 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 _0x652b=['../../config/utils','../../config/logger','rpc','client','defaults','localhost','socket.io-emitter','redis','./mailQueue.socket','register','request','then','info','MailQueue,\x20%s,\x20%s','request\x20sent','MailQueue,\x20%s,\x20%s,\x20%s','error','message','GetMailQueue','MailQueue','findAll','options','include','map','model','attributes','stringify','catch','ShowMailQueue','find','where','debug','lodash','util','moment','randomstring'];(function(_0x311666,_0x17b07d){var _0x2bc692=function(_0x200073){while(--_0x200073){_0x311666['push'](_0x311666['shift']());}};_0x2bc692(++_0x17b07d);}(_0x652b,0x68));var _0xb652=function(_0x57975f,_0x388556){_0x57975f=_0x57975f-0x0;var _0x4793b8=_0x652b[_0x57975f];return _0x4793b8;};'use strict';var _=require(_0xb652('0x0'));var util=require(_0xb652('0x1'));var moment=require(_0xb652('0x2'));var BPromise=require('bluebird');var rs=require(_0xb652('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xb652('0x4'));var logger=require(_0xb652('0x5'))(_0xb652('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xb652('0x7')]['http']({'port':0x232a});config['redis']=_[_0xb652('0x8')](config['redis'],{'host':_0xb652('0x9'),'port':0x18eb});var socket=require(_0xb652('0xa'))(new Redis(config[_0xb652('0xb')]));require(_0xb652('0xc'))[_0xb652('0xd')](socket);function respondWithRpcPromise(_0x374775,_0x4b6c18,_0x47eec5){return new BPromise(function(_0x368635,_0x1ebe2b){return client[_0xb652('0xe')](_0x374775,_0x47eec5)[_0xb652('0xf')](function(_0x5d347c){logger[_0xb652('0x10')](_0xb652('0x11'),_0x4b6c18,_0xb652('0x12'));logger['debug'](_0xb652('0x13'),_0x4b6c18,_0xb652('0x12'),JSON['stringify'](_0x5d347c));if(_0x5d347c['error']){if(_0x5d347c['error']['code']===0x1f4){logger[_0xb652('0x14')]('MailQueue,\x20%s,\x20%s',_0x4b6c18,_0x5d347c[_0xb652('0x14')][_0xb652('0x15')]);return _0x1ebe2b(_0x5d347c[_0xb652('0x14')]['message']);}logger[_0xb652('0x14')](_0xb652('0x11'),_0x4b6c18,_0x5d347c[_0xb652('0x14')][_0xb652('0x15')]);return _0x368635(_0x5d347c['error'][_0xb652('0x15')]);}else{logger[_0xb652('0x10')](_0xb652('0x11'),_0x4b6c18,_0xb652('0x12'));_0x368635(_0x5d347c['result'][_0xb652('0x15')]);}})['catch'](function(_0xa6ed9b){logger[_0xb652('0x14')](_0xb652('0x11'),_0x4b6c18,_0xa6ed9b);_0x1ebe2b(_0xa6ed9b);});});}exports[_0xb652('0x16')]=function(_0x58ee68){var _0x1de010=this;return new Promise(function(_0x3fb9c2,_0x3fc43e){return db[_0xb652('0x17')][_0xb652('0x18')]({'raw':_0x58ee68[_0xb652('0x19')]?_0x58ee68['options']['raw']===undefined?!![]:![]:!![],'where':_0x58ee68[_0xb652('0x19')]?_0x58ee68[_0xb652('0x19')]['where']||null:null,'attributes':_0x58ee68['options']?_0x58ee68[_0xb652('0x19')]['attributes']||null:null,'limit':_0x58ee68[_0xb652('0x19')]?_0x58ee68[_0xb652('0x19')]['limit']||null:null,'include':_0x58ee68['options']?_0x58ee68[_0xb652('0x19')][_0xb652('0x1a')]?_[_0xb652('0x1b')](_0x58ee68[_0xb652('0x19')][_0xb652('0x1a')],function(_0x2f7186){return{'model':db[_0x2f7186[_0xb652('0x1c')]],'as':_0x2f7186['as'],'attributes':_0x2f7186[_0xb652('0x1d')],'include':_0x2f7186['include']?_['map'](_0x2f7186['include'],function(_0x1f169a){return{'model':db[_0x1f169a['model']],'as':_0x1f169a['as'],'attributes':_0x1f169a[_0xb652('0x1d')],'include':_0x1f169a['include']?_[_0xb652('0x1b')](_0x1f169a[_0xb652('0x1a')],function(_0x3b74eb){return{'model':db[_0x3b74eb[_0xb652('0x1c')]],'as':_0x3b74eb['as'],'attributes':_0x3b74eb[_0xb652('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x459c03){logger['info'](_0xb652('0x16'),_0x58ee68);logger['debug'](_0xb652('0x16'),_0x58ee68,JSON[_0xb652('0x1e')](_0x459c03));_0x3fb9c2(_0x459c03);})[_0xb652('0x1f')](function(_0x39de0d){logger[_0xb652('0x14')](_0xb652('0x16'),_0x39de0d[_0xb652('0x15')],_0x58ee68);_0x3fc43e(_0x1de010[_0xb652('0x14')](0x1f4,_0x39de0d[_0xb652('0x15')]));});});};exports[_0xb652('0x20')]=function(_0x30c001){var _0x4a557a=this;return new Promise(function(_0x22a2f5,_0x30f3ee){return db[_0xb652('0x17')][_0xb652('0x21')]({'raw':_0x30c001[_0xb652('0x19')]?_0x30c001[_0xb652('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x30c001[_0xb652('0x19')]?_0x30c001[_0xb652('0x19')][_0xb652('0x22')]||null:null,'attributes':_0x30c001[_0xb652('0x19')]?_0x30c001[_0xb652('0x19')][_0xb652('0x1d')]||null:null,'include':_0x30c001[_0xb652('0x19')]?_0x30c001[_0xb652('0x19')][_0xb652('0x1a')]?_[_0xb652('0x1b')](_0x30c001['options'][_0xb652('0x1a')],function(_0x4d8d82){return{'model':db[_0x4d8d82['model']],'as':_0x4d8d82['as'],'attributes':_0x4d8d82['attributes'],'include':_0x4d8d82[_0xb652('0x1a')]?_[_0xb652('0x1b')](_0x4d8d82[_0xb652('0x1a')],function(_0x4f17fd){return{'model':db[_0x4f17fd[_0xb652('0x1c')]],'as':_0x4f17fd['as'],'attributes':_0x4f17fd['attributes'],'include':_0x4f17fd[_0xb652('0x1a')]?_['map'](_0x4f17fd[_0xb652('0x1a')],function(_0x5895a0){return{'model':db[_0x5895a0[_0xb652('0x1c')]],'as':_0x5895a0['as'],'attributes':_0x5895a0[_0xb652('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xb652('0xf')](function(_0x2b9d61){logger['info'](_0xb652('0x20'),_0x30c001);logger[_0xb652('0x23')](_0xb652('0x20'),_0x30c001,JSON[_0xb652('0x1e')](_0x2b9d61));_0x22a2f5(_0x2b9d61);})['catch'](function(_0x3164f4){logger[_0xb652('0x14')]('ShowMailQueue',_0x3164f4[_0xb652('0x15')],_0x30c001);_0x30f3ee(_0x4a557a['error'](0x1f4,_0x3164f4['message']));});});}; \ No newline at end of file +var _0x2eab=['rpc','client','http','redis','localhost','socket.io-emitter','./mailQueue.socket','then','info','MailQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','GetMailQueue','MailQueue','options','raw','where','attributes','limit','include','map','model','catch','ShowMailQueue','find','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils'];(function(_0x6cf19c,_0x2f3f02){var _0xce14f3=function(_0x474587){while(--_0x474587){_0x6cf19c['push'](_0x6cf19c['shift']());}};_0xce14f3(++_0x2f3f02);}(_0x2eab,0x8d));var _0xb2ea=function(_0x52e610,_0x2a8101){_0x52e610=_0x52e610-0x0;var _0x10fe6e=_0x2eab[_0x52e610];return _0x10fe6e;};'use strict';var _=require(_0xb2ea('0x0'));var util=require(_0xb2ea('0x1'));var moment=require(_0xb2ea('0x2'));var BPromise=require(_0xb2ea('0x3'));var rs=require(_0xb2ea('0x4'));var fs=require('fs');var Redis=require(_0xb2ea('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xb2ea('0x6'));var logger=require('../../config/logger')(_0xb2ea('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xb2ea('0x8')][_0xb2ea('0x9')]({'port':0x232a});config[_0xb2ea('0xa')]=_['defaults'](config[_0xb2ea('0xa')],{'host':_0xb2ea('0xb'),'port':0x18eb});var socket=require(_0xb2ea('0xc'))(new Redis(config[_0xb2ea('0xa')]));require(_0xb2ea('0xd'))['register'](socket);function respondWithRpcPromise(_0x6af7c6,_0x24af6f,_0xe08dec){return new BPromise(function(_0x1af8ad,_0x43a85a){return client['request'](_0x6af7c6,_0xe08dec)[_0xb2ea('0xe')](function(_0x4c10ab){logger[_0xb2ea('0xf')](_0xb2ea('0x10'),_0x24af6f,_0xb2ea('0x11'));logger[_0xb2ea('0x12')]('MailQueue,\x20%s,\x20%s,\x20%s',_0x24af6f,'request\x20sent',JSON[_0xb2ea('0x13')](_0x4c10ab));if(_0x4c10ab[_0xb2ea('0x14')]){if(_0x4c10ab['error'][_0xb2ea('0x15')]===0x1f4){logger['error'](_0xb2ea('0x10'),_0x24af6f,_0x4c10ab[_0xb2ea('0x14')][_0xb2ea('0x16')]);return _0x43a85a(_0x4c10ab['error'][_0xb2ea('0x16')]);}logger[_0xb2ea('0x14')](_0xb2ea('0x10'),_0x24af6f,_0x4c10ab[_0xb2ea('0x14')]['message']);return _0x1af8ad(_0x4c10ab[_0xb2ea('0x14')][_0xb2ea('0x16')]);}else{logger['info'](_0xb2ea('0x10'),_0x24af6f,_0xb2ea('0x11'));_0x1af8ad(_0x4c10ab[_0xb2ea('0x17')][_0xb2ea('0x16')]);}})['catch'](function(_0x16217a){logger[_0xb2ea('0x14')]('MailQueue,\x20%s,\x20%s',_0x24af6f,_0x16217a);_0x43a85a(_0x16217a);});});}exports[_0xb2ea('0x18')]=function(_0x19d0a1){var _0x6fc2c3=this;return new Promise(function(_0x2cd8f7,_0xa5cacd){return db[_0xb2ea('0x19')]['findAll']({'raw':_0x19d0a1[_0xb2ea('0x1a')]?_0x19d0a1['options'][_0xb2ea('0x1b')]===undefined?!![]:![]:!![],'where':_0x19d0a1['options']?_0x19d0a1['options'][_0xb2ea('0x1c')]||null:null,'attributes':_0x19d0a1[_0xb2ea('0x1a')]?_0x19d0a1['options'][_0xb2ea('0x1d')]||null:null,'limit':_0x19d0a1['options']?_0x19d0a1['options'][_0xb2ea('0x1e')]||null:null,'include':_0x19d0a1['options']?_0x19d0a1[_0xb2ea('0x1a')][_0xb2ea('0x1f')]?_[_0xb2ea('0x20')](_0x19d0a1['options'][_0xb2ea('0x1f')],function(_0xaeda58){return{'model':db[_0xaeda58[_0xb2ea('0x21')]],'as':_0xaeda58['as'],'attributes':_0xaeda58[_0xb2ea('0x1d')],'include':_0xaeda58['include']?_[_0xb2ea('0x20')](_0xaeda58['include'],function(_0x4c2903){return{'model':db[_0x4c2903[_0xb2ea('0x21')]],'as':_0x4c2903['as'],'attributes':_0x4c2903[_0xb2ea('0x1d')],'include':_0x4c2903[_0xb2ea('0x1f')]?_[_0xb2ea('0x20')](_0x4c2903[_0xb2ea('0x1f')],function(_0x2d3776){return{'model':db[_0x2d3776[_0xb2ea('0x21')]],'as':_0x2d3776['as'],'attributes':_0x2d3776[_0xb2ea('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xb2ea('0xe')](function(_0x16c5b7){logger[_0xb2ea('0xf')](_0xb2ea('0x18'),_0x19d0a1);logger['debug'](_0xb2ea('0x18'),_0x19d0a1,JSON[_0xb2ea('0x13')](_0x16c5b7));_0x2cd8f7(_0x16c5b7);})[_0xb2ea('0x22')](function(_0xcfb360){logger[_0xb2ea('0x14')](_0xb2ea('0x18'),_0xcfb360[_0xb2ea('0x16')],_0x19d0a1);_0xa5cacd(_0x6fc2c3[_0xb2ea('0x14')](0x1f4,_0xcfb360[_0xb2ea('0x16')]));});});};exports[_0xb2ea('0x23')]=function(_0x37394c){var _0x354ba6=this;return new Promise(function(_0x5e82b6,_0x2127da){return db[_0xb2ea('0x19')][_0xb2ea('0x24')]({'raw':_0x37394c[_0xb2ea('0x1a')]?_0x37394c['options']['raw']===undefined?!![]:![]:!![],'where':_0x37394c[_0xb2ea('0x1a')]?_0x37394c[_0xb2ea('0x1a')][_0xb2ea('0x1c')]||null:null,'attributes':_0x37394c[_0xb2ea('0x1a')]?_0x37394c[_0xb2ea('0x1a')][_0xb2ea('0x1d')]||null:null,'include':_0x37394c['options']?_0x37394c[_0xb2ea('0x1a')][_0xb2ea('0x1f')]?_[_0xb2ea('0x20')](_0x37394c[_0xb2ea('0x1a')]['include'],function(_0x282be8){return{'model':db[_0x282be8[_0xb2ea('0x21')]],'as':_0x282be8['as'],'attributes':_0x282be8[_0xb2ea('0x1d')],'include':_0x282be8[_0xb2ea('0x1f')]?_[_0xb2ea('0x20')](_0x282be8[_0xb2ea('0x1f')],function(_0x4b8094){return{'model':db[_0x4b8094[_0xb2ea('0x21')]],'as':_0x4b8094['as'],'attributes':_0x4b8094[_0xb2ea('0x1d')],'include':_0x4b8094[_0xb2ea('0x1f')]?_[_0xb2ea('0x20')](_0x4b8094['include'],function(_0x4ef332){return{'model':db[_0x4ef332[_0xb2ea('0x21')]],'as':_0x4ef332['as'],'attributes':_0x4ef332[_0xb2ea('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4cfdc4){logger[_0xb2ea('0xf')]('ShowMailQueue',_0x37394c);logger[_0xb2ea('0x12')](_0xb2ea('0x23'),_0x37394c,JSON[_0xb2ea('0x13')](_0x4cfdc4));_0x5e82b6(_0x4cfdc4);})['catch'](function(_0x2a5a65){logger[_0xb2ea('0x14')](_0xb2ea('0x23'),_0x2a5a65[_0xb2ea('0x16')],_0x37394c);_0x2127da(_0x354ba6[_0xb2ea('0x14')](0x1f4,_0x2a5a65['message']));});});}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.socket.js b/server/api/mailQueue/mailQueue.socket.js index 16e30e4..bb8c28e 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 _0xf263=['emit','removeListener','mailQueue:','./mailQueue.events','remove','update'];(function(_0x5c3c0b,_0x4ee35e){var _0x52ecd2=function(_0x3cf575){while(--_0x3cf575){_0x5c3c0b['push'](_0x5c3c0b['shift']());}};_0x52ecd2(++_0x4ee35e);}(_0xf263,0x141));var _0x3f26=function(_0x3b76f7,_0x566c53){_0x3b76f7=_0x3b76f7-0x0;var _0x43984e=_0xf263[_0x3b76f7];return _0x43984e;};'use strict';var MailQueueEvents=require(_0x3f26('0x0'));var events=['save',_0x3f26('0x1'),_0x3f26('0x2')];function createListener(_0x3d5fc5,_0xbfe52e){return function(_0x5bdc34){_0xbfe52e[_0x3f26('0x3')](_0x3d5fc5,_0x5bdc34);};}function removeListener(_0x339e00,_0x1f71b1){return function(){MailQueueEvents[_0x3f26('0x4')](_0x339e00,_0x1f71b1);};}exports['register']=function(_0x1c4702){for(var _0xede9da=0x0,_0xee877a=events['length'];_0xede9da<_0xee877a;_0xede9da++){var _0x19eb2e=events[_0xede9da];var _0x204c72=createListener(_0x3f26('0x5')+_0x19eb2e,_0x1c4702);MailQueueEvents['on'](_0x19eb2e,_0x204c72);}}; \ No newline at end of file +var _0x5e68=['./mailQueue.events','save','remove','update','removeListener','register','length','mailQueue:'];(function(_0x35da42,_0x5c2610){var _0x370035=function(_0x546db5){while(--_0x546db5){_0x35da42['push'](_0x35da42['shift']());}};_0x370035(++_0x5c2610);}(_0x5e68,0x140));var _0x85e6=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x5e68[_0x432682];return _0x463d05;};'use strict';var MailQueueEvents=require(_0x85e6('0x0'));var events=[_0x85e6('0x1'),_0x85e6('0x2'),_0x85e6('0x3')];function createListener(_0x5d3707,_0x41b1ce){return function(_0x2b6f40){_0x41b1ce['emit'](_0x5d3707,_0x2b6f40);};}function removeListener(_0x52a5ed,_0x49a7fa){return function(){MailQueueEvents[_0x85e6('0x4')](_0x52a5ed,_0x49a7fa);};}exports[_0x85e6('0x5')]=function(_0x2fa28a){for(var _0x3df397=0x0,_0x5c828b=events[_0x85e6('0x6')];_0x3df397<_0x5c828b;_0x3df397++){var _0x2bd9ff=events[_0x3df397];var _0x37229e=createListener(_0x85e6('0x7')+_0x2bd9ff,_0x2fa28a);MailQueueEvents['on'](_0x2bd9ff,_0x37229e);}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/index.js b/server/api/mailQueueReport/index.js index 127ad60..99a2f10 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 _0x5eb7=['Router','fs-extra','../../components/interaction/service','../../config/environment','./mailQueueReport.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports','util','path','connect-timeout','express'];(function(_0x246804,_0x4ade0c){var _0x46a37=function(_0x57ef0b){while(--_0x57ef0b){_0x246804['push'](_0x246804['shift']());}};_0x46a37(++_0x4ade0c);}(_0x5eb7,0xf8));var _0x75eb=function(_0xb24a3e,_0x4a3594){_0xb24a3e=_0xb24a3e-0x0;var _0x4038d7=_0x5eb7[_0xb24a3e];return _0x4038d7;};'use strict';var multer=require('multer');var util=require(_0x75eb('0x0'));var path=require(_0x75eb('0x1'));var timeout=require(_0x75eb('0x2'));var express=require(_0x75eb('0x3'));var router=express[_0x75eb('0x4')]();var fs_extra=require(_0x75eb('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x75eb('0x6'));var config=require(_0x75eb('0x7'));var controller=require(_0x75eb('0x8'));router[_0x75eb('0x9')]('/',auth[_0x75eb('0xa')](),controller[_0x75eb('0xb')]);router[_0x75eb('0x9')]('/describe',auth[_0x75eb('0xa')](),controller['describe']);router[_0x75eb('0x9')](_0x75eb('0xc'),auth['isAuthenticated'](),controller[_0x75eb('0xd')]);router[_0x75eb('0xe')]('/',auth[_0x75eb('0xa')](),controller[_0x75eb('0xf')]);router[_0x75eb('0x10')](_0x75eb('0xc'),auth[_0x75eb('0xa')](),controller[_0x75eb('0x11')]);router[_0x75eb('0x12')](_0x75eb('0xc'),auth[_0x75eb('0xa')](),controller[_0x75eb('0x13')]);module[_0x75eb('0x14')]=router; \ No newline at end of file +var _0x5dad=['index','/describe','describe','/:id','show','post','put','update','delete','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./mailQueueReport.controller','get','isAuthenticated'];(function(_0x267da8,_0x4895a9){var _0x29cfd0=function(_0x5dfafd){while(--_0x5dfafd){_0x267da8['push'](_0x267da8['shift']());}};_0x29cfd0(++_0x4895a9);}(_0x5dad,0x15e));var _0xd5da=function(_0x62daf8,_0x25a16e){_0x62daf8=_0x62daf8-0x0;var _0x15b34c=_0x5dad[_0x62daf8];return _0x15b34c;};'use strict';var multer=require('multer');var util=require(_0xd5da('0x0'));var path=require(_0xd5da('0x1'));var timeout=require(_0xd5da('0x2'));var express=require(_0xd5da('0x3'));var router=express[_0xd5da('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xd5da('0x5'));var interaction=require(_0xd5da('0x6'));var config=require('../../config/environment');var controller=require(_0xd5da('0x7'));router[_0xd5da('0x8')]('/',auth[_0xd5da('0x9')](),controller[_0xd5da('0xa')]);router[_0xd5da('0x8')](_0xd5da('0xb'),auth[_0xd5da('0x9')](),controller[_0xd5da('0xc')]);router[_0xd5da('0x8')](_0xd5da('0xd'),auth[_0xd5da('0x9')](),controller[_0xd5da('0xe')]);router[_0xd5da('0xf')]('/',auth[_0xd5da('0x9')](),controller['create']);router[_0xd5da('0x10')]('/:id',auth[_0xd5da('0x9')](),controller[_0xd5da('0x11')]);router[_0xd5da('0x12')]('/:id',auth[_0xd5da('0x9')](),controller['destroy']);module[_0xd5da('0x13')]=router; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.attributes.js b/server/api/mailQueueReport/mailQueueReport.attributes.js index b6f432d..8408e5d 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 _0x7671=['DATE','moment','sequelize','exports','STRING'];(function(_0x32f7d7,_0x54231b){var _0x133d09=function(_0x41a7ab){while(--_0x41a7ab){_0x32f7d7['push'](_0x32f7d7['shift']());}};_0x133d09(++_0x54231b);}(_0x7671,0xec));var _0x1767=function(_0x594f70,_0x379643){_0x594f70=_0x594f70-0x0;var _0x41d23c=_0x7671[_0x594f70];return _0x41d23c;};'use strict';var moment=require(_0x1767('0x0'));var Sequelize=require(_0x1767('0x1'));module[_0x1767('0x2')]={'uniqueid':{'type':Sequelize[_0x1767('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0x1767('0x3')]},'joinAt':{'type':Sequelize[_0x1767('0x4')]},'leaveAt':{'type':Sequelize[_0x1767('0x4')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x1767('0x4')]},'reason':{'type':Sequelize[_0x1767('0x3')]}}; \ No newline at end of file +var _0xf589=['DATE','moment','sequelize','STRING'];(function(_0x2eff9,_0xb5e45b){var _0x5c87e3=function(_0x239249){while(--_0x239249){_0x2eff9['push'](_0x2eff9['shift']());}};_0x5c87e3(++_0xb5e45b);}(_0xf589,0xe1));var _0x9f58=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0xf589[_0x6131cd];return _0x47e916;};'use strict';var moment=require(_0x9f58('0x0'));var Sequelize=require(_0x9f58('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0x9f58('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x9f58('0x2')]},'joinAt':{'type':Sequelize[_0x9f58('0x3')]},'leaveAt':{'type':Sequelize[_0x9f58('0x3')]},'acceptAt':{'type':Sequelize[_0x9f58('0x3')]},'exitAt':{'type':Sequelize[_0x9f58('0x3')]},'reason':{'type':Sequelize[_0x9f58('0x2')]}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.controller.js b/server/api/mailQueueReport/mailQueueReport.controller.js index 246ec83..a42ef95 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 _0x66fa=['end','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','rawAttributes','type','key','map','query','keys','intersection','attributes','fields','length','model','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','VIRTUAL','includeAll','include','MailQueueReport','findAll','rows','catch','merge','options','find','create','body','params','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','ioredis','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util'];(function(_0x2bf141,_0x31eac7){var _0x48277b=function(_0x9fe560){while(--_0x9fe560){_0x2bf141['push'](_0x2bf141['shift']());}};_0x48277b(++_0x31eac7);}(_0x66fa,0x117));var _0xa66f=function(_0x533b54,_0x37cb25){_0x533b54=_0x533b54-0x0;var _0x117228=_0x66fa[_0x533b54];return _0x117228;};'use strict';var emlformat=require(_0xa66f('0x0'));var rimraf=require(_0xa66f('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa66f('0x2'));var rp=require(_0xa66f('0x3'));var moment=require(_0xa66f('0x4'));var BPromise=require(_0xa66f('0x5'));var Mustache=require(_0xa66f('0x6'));var util=require(_0xa66f('0x7'));var path=require(_0xa66f('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xa66f('0x9'));var fs=require('fs');var fs_extra=require(_0xa66f('0xa'));var _=require(_0xa66f('0xb'));var squel=require(_0xa66f('0xc'));var crypto=require(_0xa66f('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xa66f('0xe'));var toCsv=require('to-csv');var querystring=require(_0xa66f('0xf'));var Papa=require('papaparse');var Redis=require(_0xa66f('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa66f('0x11'));var logger=require(_0xa66f('0x12'))('api');var utils=require(_0xa66f('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0xa66f('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x251189,_0x14af70){_0x14af70=_0x14af70||0xcc;return function(_0xca12f8){if(_0xca12f8){return _0x251189['sendStatus'](_0x14af70);}return _0x251189['status'](_0x14af70)[_0xa66f('0x15')]();};}function respondWithResult(_0x4e09cf,_0x528427){_0x528427=_0x528427||0xc8;return function(_0x5a7b16){if(_0x5a7b16){return _0x4e09cf[_0xa66f('0x16')](_0x528427)[_0xa66f('0x17')](_0x5a7b16);}};}function respondWithFilteredResult(_0x267129,_0x236d64){return function(_0xd348f9){if(_0xd348f9){var _0x567d4f=typeof _0x236d64['offset']===_0xa66f('0x18')&&typeof _0x236d64[_0xa66f('0x19')]===_0xa66f('0x18');var _0x403f4d=_0xd348f9['count'];var _0x1cbe64=_0x567d4f?0x0:_0x236d64['offset'];var _0x4a28d4=_0x567d4f?_0xd348f9[_0xa66f('0x1a')]:_0x236d64[_0xa66f('0x1b')]+_0x236d64[_0xa66f('0x19')];var _0x355ddc;if(_0x4a28d4>=_0x403f4d){_0x4a28d4=_0x403f4d;_0x355ddc=0xc8;}else{_0x355ddc=0xce;}_0x267129[_0xa66f('0x16')](_0x355ddc);return _0x267129[_0xa66f('0x1c')](_0xa66f('0x1d'),_0x1cbe64+'-'+_0x4a28d4+'/'+_0x403f4d)[_0xa66f('0x17')](_0xd348f9);}return null;};}function patchUpdates(_0x2033a4){return function(_0x2d9602){try{jsonpatch[_0xa66f('0x1e')](_0x2d9602,_0x2033a4,!![]);}catch(_0xbba376){return BPromise[_0xa66f('0x1f')](_0xbba376);}return _0x2d9602[_0xa66f('0x20')]();};}function saveUpdates(_0x82924d,_0x5cd613){return function(_0x27f570){if(_0x27f570){return _0x27f570[_0xa66f('0x21')](_0x82924d)[_0xa66f('0x22')](function(_0x37ee13){return _0x37ee13;});}return null;};}function removeEntity(_0x5cbd82,_0x337602){return function(_0x473822){if(_0x473822){return _0x473822[_0xa66f('0x23')]()[_0xa66f('0x22')](function(){_0x5cbd82['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0xed98b9,_0x598942){return function(_0x3a3e4f){if(!_0x3a3e4f){_0xed98b9[_0xa66f('0x24')](0x194);}return _0x3a3e4f;};}function handleError(_0x384164,_0x57da7f){_0x57da7f=_0x57da7f||0x1f4;return function(_0x4683c7){logger[_0xa66f('0x25')](_0x4683c7[_0xa66f('0x26')]);if(_0x4683c7[_0xa66f('0x27')]){delete _0x4683c7[_0xa66f('0x27')];}_0x384164[_0xa66f('0x16')](_0x57da7f)[_0xa66f('0x28')](_0x4683c7);};}exports[_0xa66f('0x29')]=function(_0x20ee67,_0x117d03){var _0x45f71c={},_0x63650b={},_0x42b966={'count':0x0,'rows':[]};var _0xeeb22e=_['map'](db['MailQueueReport'][_0xa66f('0x2a')],function(_0x27ceae){return{'name':_0x27ceae['fieldName'],'type':_0x27ceae[_0xa66f('0x2b')][_0xa66f('0x2c')]};});_0x63650b['model']=_[_0xa66f('0x2d')](_0xeeb22e,_0xa66f('0x27'));_0x63650b[_0xa66f('0x2e')]=_[_0xa66f('0x2f')](_0x20ee67[_0xa66f('0x2e')]);_0x63650b['filters']=_[_0xa66f('0x30')](_0x63650b['model'],_0x63650b[_0xa66f('0x2e')]);_0x45f71c[_0xa66f('0x31')]=_[_0xa66f('0x30')](_0x63650b['model'],qs[_0xa66f('0x32')](_0x20ee67[_0xa66f('0x2e')]['fields']));_0x45f71c[_0xa66f('0x31')]=_0x45f71c[_0xa66f('0x31')][_0xa66f('0x33')]?_0x45f71c[_0xa66f('0x31')]:_0x63650b[_0xa66f('0x34')];if(!_0x20ee67[_0xa66f('0x2e')][_0xa66f('0x35')](_0xa66f('0x36'))){_0x45f71c[_0xa66f('0x19')]=qs[_0xa66f('0x19')](_0x20ee67['query'][_0xa66f('0x19')]);_0x45f71c['offset']=qs[_0xa66f('0x1b')](_0x20ee67[_0xa66f('0x2e')][_0xa66f('0x1b')]);}_0x45f71c[_0xa66f('0x37')]=qs[_0xa66f('0x38')](_0x20ee67[_0xa66f('0x2e')][_0xa66f('0x38')]);_0x45f71c[_0xa66f('0x39')]=qs['filters'](_[_0xa66f('0x3a')](_0x20ee67['query'],_0x63650b[_0xa66f('0x3b')]),_0xeeb22e);if(_0x20ee67[_0xa66f('0x2e')][_0xa66f('0x3c')]){_0x45f71c['where']=_['merge'](_0x45f71c[_0xa66f('0x39')],{'$or':_[_0xa66f('0x2d')](_0xeeb22e,function(_0x20b07e){if(_0x20b07e[_0xa66f('0x2b')]!==_0xa66f('0x3d')){var _0x581dca={};_0x581dca[_0x20b07e['name']]={'$like':'%'+_0x20ee67['query'][_0xa66f('0x3c')]+'%'};return _0x581dca;}})});}_0x45f71c=_['merge']({},_0x45f71c,_0x20ee67['options']);var _0x5bf856={'where':_0x45f71c[_0xa66f('0x39')]};return db['MailQueueReport'][_0xa66f('0x1a')](_0x5bf856)[_0xa66f('0x22')](function(_0x23a546){_0x42b966[_0xa66f('0x1a')]=_0x23a546;if(_0x20ee67[_0xa66f('0x2e')][_0xa66f('0x3e')]){_0x45f71c[_0xa66f('0x3f')]=[{'all':!![]}];}return db[_0xa66f('0x40')][_0xa66f('0x41')](_0x45f71c);})[_0xa66f('0x22')](function(_0x3a7929){_0x42b966[_0xa66f('0x42')]=_0x3a7929;return _0x42b966;})[_0xa66f('0x22')](respondWithFilteredResult(_0x117d03,_0x45f71c))[_0xa66f('0x43')](handleError(_0x117d03,null));};exports['show']=function(_0x36037c,_0x25c2cb){var _0x58c1f2={'raw':!![],'where':{'id':_0x36037c['params']['id']}},_0x248587={};_0x248587[_0xa66f('0x34')]=_[_0xa66f('0x2f')](db['MailQueueReport'][_0xa66f('0x2a')]);_0x248587[_0xa66f('0x2e')]=_[_0xa66f('0x2f')](_0x36037c['query']);_0x248587[_0xa66f('0x3b')]=_['intersection'](_0x248587[_0xa66f('0x34')],_0x248587[_0xa66f('0x2e')]);_0x58c1f2[_0xa66f('0x31')]=_[_0xa66f('0x30')](_0x248587[_0xa66f('0x34')],qs[_0xa66f('0x32')](_0x36037c[_0xa66f('0x2e')]['fields']));_0x58c1f2[_0xa66f('0x31')]=_0x58c1f2[_0xa66f('0x31')][_0xa66f('0x33')]?_0x58c1f2[_0xa66f('0x31')]:_0x248587[_0xa66f('0x34')];if(_0x36037c['query']['includeAll']){_0x58c1f2[_0xa66f('0x3f')]=[{'all':!![]}];}_0x58c1f2=_[_0xa66f('0x44')]({},_0x58c1f2,_0x36037c[_0xa66f('0x45')]);return db[_0xa66f('0x40')][_0xa66f('0x46')](_0x58c1f2)[_0xa66f('0x22')](handleEntityNotFound(_0x25c2cb,null))['then'](respondWithResult(_0x25c2cb,null))[_0xa66f('0x43')](handleError(_0x25c2cb,null));};exports[_0xa66f('0x47')]=function(_0x3f9cdd,_0x5651e9){return db['MailQueueReport'][_0xa66f('0x47')](_0x3f9cdd[_0xa66f('0x48')],{})[_0xa66f('0x22')](respondWithResult(_0x5651e9,0xc9))['catch'](handleError(_0x5651e9,null));};exports['update']=function(_0x52054e,_0x19e7ce){if(_0x52054e[_0xa66f('0x48')]['id']){delete _0x52054e[_0xa66f('0x48')]['id'];}return db[_0xa66f('0x40')][_0xa66f('0x46')]({'where':{'id':_0x52054e[_0xa66f('0x49')]['id']}})[_0xa66f('0x22')](handleEntityNotFound(_0x19e7ce,null))[_0xa66f('0x22')](saveUpdates(_0x52054e['body'],null))[_0xa66f('0x22')](respondWithResult(_0x19e7ce,null))[_0xa66f('0x43')](handleError(_0x19e7ce,null));};exports[_0xa66f('0x23')]=function(_0x393755,_0x11597b){return db[_0xa66f('0x40')]['find']({'where':{'id':_0x393755[_0xa66f('0x49')]['id']}})[_0xa66f('0x22')](handleEntityNotFound(_0x11597b,null))[_0xa66f('0x22')](removeEntity(_0x11597b,null))[_0xa66f('0x43')](handleError(_0x11597b,null));};exports[_0xa66f('0x4a')]=function(_0x5d77d1,_0x389b9a){return db['MailQueueReport'][_0xa66f('0x4a')]()['then'](respondWithResult(_0x389b9a,null))['catch'](handleError(_0x389b9a,null));}; \ No newline at end of file +var _0x7b84=['sendStatus','status','end','json','offset','undefined','count','Content-Range','reject','save','then','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','where','pick','merge','VIRTUAL','filter','MailQueueReport','includeAll','findAll','rows','catch','show','params','include','options','create','body','update','find','describe','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','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb'];(function(_0x5b14ff,_0xf4601f){var _0x4ae554=function(_0x2c922b){while(--_0x2c922b){_0x5b14ff['push'](_0x5b14ff['shift']());}};_0x4ae554(++_0xf4601f);}(_0x7b84,0x17c));var _0x47b8=function(_0x3cf73f,_0x110c25){_0x3cf73f=_0x3cf73f-0x0;var _0x233fd2=_0x7b84[_0x3cf73f];return _0x233fd2;};'use strict';var emlformat=require(_0x47b8('0x0'));var rimraf=require(_0x47b8('0x1'));var zipdir=require(_0x47b8('0x2'));var jsonpatch=require(_0x47b8('0x3'));var rp=require(_0x47b8('0x4'));var moment=require(_0x47b8('0x5'));var BPromise=require(_0x47b8('0x6'));var Mustache=require('mustache');var util=require(_0x47b8('0x7'));var path=require(_0x47b8('0x8'));var sox=require(_0x47b8('0x9'));var csv=require(_0x47b8('0xa'));var ejs=require(_0x47b8('0xb'));var fs=require('fs');var fs_extra=require(_0x47b8('0xc'));var _=require('lodash');var squel=require(_0x47b8('0xd'));var crypto=require(_0x47b8('0xe'));var jsforce=require(_0x47b8('0xf'));var deskjs=require(_0x47b8('0x10'));var toCsv=require(_0x47b8('0xa'));var querystring=require(_0x47b8('0x11'));var Papa=require(_0x47b8('0x12'));var Redis=require(_0x47b8('0x13'));var authService=require(_0x47b8('0x14'));var qs=require(_0x47b8('0x15'));var as=require(_0x47b8('0x16'));var hardwareService=require(_0x47b8('0x17'));var logger=require(_0x47b8('0x18'))(_0x47b8('0x19'));var utils=require(_0x47b8('0x1a'));var config=require(_0x47b8('0x1b'));var licenseUtil=require(_0x47b8('0x1c'));var db=require(_0x47b8('0x1d'))['db'];function respondWithStatusCode(_0x25a224,_0x289ac7){_0x289ac7=_0x289ac7||0xcc;return function(_0x1edb4b){if(_0x1edb4b){return _0x25a224[_0x47b8('0x1e')](_0x289ac7);}return _0x25a224[_0x47b8('0x1f')](_0x289ac7)[_0x47b8('0x20')]();};}function respondWithResult(_0x173015,_0x223121){_0x223121=_0x223121||0xc8;return function(_0xf66dd6){if(_0xf66dd6){return _0x173015['status'](_0x223121)[_0x47b8('0x21')](_0xf66dd6);}};}function respondWithFilteredResult(_0x340da0,_0x3e760a){return function(_0x1217a4){if(_0x1217a4){var _0x34d5a5=typeof _0x3e760a[_0x47b8('0x22')]===_0x47b8('0x23')&&typeof _0x3e760a['limit']===_0x47b8('0x23');var _0x5c2b2c=_0x1217a4['count'];var _0x4f7317=_0x34d5a5?0x0:_0x3e760a[_0x47b8('0x22')];var _0x36faf1=_0x34d5a5?_0x1217a4[_0x47b8('0x24')]:_0x3e760a['offset']+_0x3e760a['limit'];var _0x4f6716;if(_0x36faf1>=_0x5c2b2c){_0x36faf1=_0x5c2b2c;_0x4f6716=0xc8;}else{_0x4f6716=0xce;}_0x340da0[_0x47b8('0x1f')](_0x4f6716);return _0x340da0['set'](_0x47b8('0x25'),_0x4f7317+'-'+_0x36faf1+'/'+_0x5c2b2c)[_0x47b8('0x21')](_0x1217a4);}return null;};}function patchUpdates(_0x303f19){return function(_0xfccf56){try{jsonpatch['apply'](_0xfccf56,_0x303f19,!![]);}catch(_0xc20df1){return BPromise[_0x47b8('0x26')](_0xc20df1);}return _0xfccf56[_0x47b8('0x27')]();};}function saveUpdates(_0x2f75d2,_0x168cde){return function(_0x232708){if(_0x232708){return _0x232708['update'](_0x2f75d2)[_0x47b8('0x28')](function(_0x2a22e3){return _0x2a22e3;});}return null;};}function removeEntity(_0x5301f8,_0x22e7dd){return function(_0x247429){if(_0x247429){return _0x247429[_0x47b8('0x29')]()[_0x47b8('0x28')](function(){_0x5301f8['status'](0xcc)[_0x47b8('0x20')]();});}};}function handleEntityNotFound(_0x332c23,_0x319d17){return function(_0x3e3de0){if(!_0x3e3de0){_0x332c23[_0x47b8('0x1e')](0x194);}return _0x3e3de0;};}function handleError(_0xbf5ce9,_0x40918f){_0x40918f=_0x40918f||0x1f4;return function(_0x568c1e){logger[_0x47b8('0x2a')](_0x568c1e[_0x47b8('0x2b')]);if(_0x568c1e['name']){delete _0x568c1e[_0x47b8('0x2c')];}_0xbf5ce9[_0x47b8('0x1f')](_0x40918f)[_0x47b8('0x2d')](_0x568c1e);};}exports[_0x47b8('0x2e')]=function(_0x4da0e0,_0x162d96){var _0x5c347f={},_0x2c89fc={},_0x2255ab={'count':0x0,'rows':[]};var _0x33e653=_[_0x47b8('0x2f')](db['MailQueueReport'][_0x47b8('0x30')],function(_0x264dd9){return{'name':_0x264dd9[_0x47b8('0x31')],'type':_0x264dd9[_0x47b8('0x32')][_0x47b8('0x33')]};});_0x2c89fc[_0x47b8('0x34')]=_['map'](_0x33e653,'name');_0x2c89fc['query']=_[_0x47b8('0x35')](_0x4da0e0[_0x47b8('0x36')]);_0x2c89fc[_0x47b8('0x37')]=_['intersection'](_0x2c89fc['model'],_0x2c89fc['query']);_0x5c347f['attributes']=_[_0x47b8('0x38')](_0x2c89fc[_0x47b8('0x34')],qs[_0x47b8('0x39')](_0x4da0e0[_0x47b8('0x36')][_0x47b8('0x39')]));_0x5c347f[_0x47b8('0x3a')]=_0x5c347f[_0x47b8('0x3a')][_0x47b8('0x3b')]?_0x5c347f[_0x47b8('0x3a')]:_0x2c89fc['model'];if(!_0x4da0e0['query'][_0x47b8('0x3c')](_0x47b8('0x3d'))){_0x5c347f['limit']=qs['limit'](_0x4da0e0[_0x47b8('0x36')][_0x47b8('0x3e')]);_0x5c347f[_0x47b8('0x22')]=qs['offset'](_0x4da0e0[_0x47b8('0x36')][_0x47b8('0x22')]);}_0x5c347f['order']=qs['sort'](_0x4da0e0['query']['sort']);_0x5c347f[_0x47b8('0x3f')]=qs[_0x47b8('0x37')](_[_0x47b8('0x40')](_0x4da0e0[_0x47b8('0x36')],_0x2c89fc[_0x47b8('0x37')]),_0x33e653);if(_0x4da0e0[_0x47b8('0x36')]['filter']){_0x5c347f['where']=_[_0x47b8('0x41')](_0x5c347f[_0x47b8('0x3f')],{'$or':_[_0x47b8('0x2f')](_0x33e653,function(_0x4a9ed6){if(_0x4a9ed6['type']!==_0x47b8('0x42')){var _0x2c89bc={};_0x2c89bc[_0x4a9ed6['name']]={'$like':'%'+_0x4da0e0[_0x47b8('0x36')][_0x47b8('0x43')]+'%'};return _0x2c89bc;}})});}_0x5c347f=_['merge']({},_0x5c347f,_0x4da0e0['options']);var _0x493b69={'where':_0x5c347f['where']};return db[_0x47b8('0x44')][_0x47b8('0x24')](_0x493b69)[_0x47b8('0x28')](function(_0x28cf2c){_0x2255ab[_0x47b8('0x24')]=_0x28cf2c;if(_0x4da0e0['query'][_0x47b8('0x45')]){_0x5c347f['include']=[{'all':!![]}];}return db[_0x47b8('0x44')][_0x47b8('0x46')](_0x5c347f);})[_0x47b8('0x28')](function(_0x5bede8){_0x2255ab[_0x47b8('0x47')]=_0x5bede8;return _0x2255ab;})[_0x47b8('0x28')](respondWithFilteredResult(_0x162d96,_0x5c347f))[_0x47b8('0x48')](handleError(_0x162d96,null));};exports[_0x47b8('0x49')]=function(_0x3eaf01,_0x15b9a1){var _0x2d2971={'raw':!![],'where':{'id':_0x3eaf01[_0x47b8('0x4a')]['id']}},_0x569d29={};_0x569d29['model']=_[_0x47b8('0x35')](db[_0x47b8('0x44')][_0x47b8('0x30')]);_0x569d29[_0x47b8('0x36')]=_[_0x47b8('0x35')](_0x3eaf01[_0x47b8('0x36')]);_0x569d29['filters']=_['intersection'](_0x569d29[_0x47b8('0x34')],_0x569d29[_0x47b8('0x36')]);_0x2d2971[_0x47b8('0x3a')]=_['intersection'](_0x569d29[_0x47b8('0x34')],qs['fields'](_0x3eaf01[_0x47b8('0x36')][_0x47b8('0x39')]));_0x2d2971[_0x47b8('0x3a')]=_0x2d2971[_0x47b8('0x3a')][_0x47b8('0x3b')]?_0x2d2971['attributes']:_0x569d29[_0x47b8('0x34')];if(_0x3eaf01[_0x47b8('0x36')][_0x47b8('0x45')]){_0x2d2971[_0x47b8('0x4b')]=[{'all':!![]}];}_0x2d2971=_[_0x47b8('0x41')]({},_0x2d2971,_0x3eaf01[_0x47b8('0x4c')]);return db[_0x47b8('0x44')]['find'](_0x2d2971)[_0x47b8('0x28')](handleEntityNotFound(_0x15b9a1,null))['then'](respondWithResult(_0x15b9a1,null))[_0x47b8('0x48')](handleError(_0x15b9a1,null));};exports[_0x47b8('0x4d')]=function(_0x4a46eb,_0x132e9a){return db[_0x47b8('0x44')][_0x47b8('0x4d')](_0x4a46eb[_0x47b8('0x4e')],{})[_0x47b8('0x28')](respondWithResult(_0x132e9a,0xc9))[_0x47b8('0x48')](handleError(_0x132e9a,null));};exports[_0x47b8('0x4f')]=function(_0x381d3a,_0x4ad8a8){if(_0x381d3a[_0x47b8('0x4e')]['id']){delete _0x381d3a[_0x47b8('0x4e')]['id'];}return db[_0x47b8('0x44')]['find']({'where':{'id':_0x381d3a[_0x47b8('0x4a')]['id']}})[_0x47b8('0x28')](handleEntityNotFound(_0x4ad8a8,null))[_0x47b8('0x28')](saveUpdates(_0x381d3a[_0x47b8('0x4e')],null))['then'](respondWithResult(_0x4ad8a8,null))[_0x47b8('0x48')](handleError(_0x4ad8a8,null));};exports[_0x47b8('0x29')]=function(_0x51ac62,_0x270054){return db[_0x47b8('0x44')][_0x47b8('0x50')]({'where':{'id':_0x51ac62['params']['id']}})[_0x47b8('0x28')](handleEntityNotFound(_0x270054,null))['then'](removeEntity(_0x270054,null))[_0x47b8('0x48')](handleError(_0x270054,null));};exports['describe']=function(_0x2a03c2,_0x498512){return db[_0x47b8('0x44')][_0x47b8('0x51')]()[_0x47b8('0x28')](respondWithResult(_0x498512,null))[_0x47b8('0x48')](handleError(_0x498512,null));}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.model.js b/server/api/mailQueueReport/mailQueueReport.model.js index efae914..5131433 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 _0x2d8b=['./mailQueueReport.attributes','exports','define','MailQueueReport','uniqueid','api','moment','request-promise','rimraf','../../config/environment'];(function(_0x438912,_0x3f7f74){var _0x18112f=function(_0x1b8ac9){while(--_0x1b8ac9){_0x438912['push'](_0x438912['shift']());}};_0x18112f(++_0x3f7f74);}(_0x2d8b,0x13b));var _0xb2d8=function(_0x2b6b57,_0xda3e1a){_0x2b6b57=_0x2b6b57-0x0;var _0x3470b6=_0x2d8b[_0x2b6b57];return _0x3470b6;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0xb2d8('0x0'));var moment=require(_0xb2d8('0x1'));var BPromise=require('bluebird');var rp=require(_0xb2d8('0x2'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb2d8('0x3'));var config=require(_0xb2d8('0x4'));var attributes=require(_0xb2d8('0x5'));module[_0xb2d8('0x6')]=function(_0x3c12c2,_0xe9ec34){return _0x3c12c2[_0xb2d8('0x7')](_0xb2d8('0x8'),attributes,{'tableName':'report_mail_queue','paranoid':![],'indexes':[{'name':_0xb2d8('0x9'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x256e=['uniqueid','lodash','util','../../config/logger','api','bluebird','request-promise','path','./mailQueueReport.attributes','exports','define','MailQueueReport','report_mail_queue'];(function(_0x10c4d6,_0x1cd56c){var _0x3a4a5f=function(_0x18c39f){while(--_0x18c39f){_0x10c4d6['push'](_0x10c4d6['shift']());}};_0x3a4a5f(++_0x1cd56c);}(_0x256e,0x105));var _0xe256=function(_0x427b91,_0x2ea30f){_0x427b91=_0x427b91-0x0;var _0x31d379=_0x256e[_0x427b91];return _0x31d379;};'use strict';var _=require(_0xe256('0x0'));var util=require(_0xe256('0x1'));var logger=require(_0xe256('0x2'))(_0xe256('0x3'));var moment=require('moment');var BPromise=require(_0xe256('0x4'));var rp=require(_0xe256('0x5'));var fs=require('fs');var path=require(_0xe256('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xe256('0x7'));module[_0xe256('0x8')]=function(_0x288393,_0x1e6928){return _0x288393[_0xe256('0x9')](_0xe256('0xa'),attributes,{'tableName':_0xe256('0xb'),'paranoid':![],'indexes':[{'name':_0xe256('0xc'),'fields':[_0xe256('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 f7c9349..dcd2590 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(_0x56adb2,_0x5ca06d){var _0x3e24b7=function(_0x208aac){while(--_0x208aac){_0x56adb2['push'](_0x56adb2['shift']());}};_0x3e24b7(++_0x5ca06d);}(_0x326f,0xd1));var _0xf326=function(_0x36b6cc,_0x299ee4){_0x36b6cc=_0x36b6cc-0x0;var _0x393f5a=_0x326f[_0x36b6cc];return _0x393f5a;};'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 _0xadb5=['MailQueueReport,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','CreateMailQueueReport','create','options','raw','debug','MailQueueReport','body','attributes','limit','UpdateMailQueueReport','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info'];(function(_0x3cfbec,_0x15c105){var _0x41116e=function(_0x577550){while(--_0x577550){_0x3cfbec['push'](_0x3cfbec['shift']());}};_0x41116e(++_0x15c105);}(_0xadb5,0xad));var _0x5adb=function(_0x56d0f8,_0x42a4db){_0x56d0f8=_0x56d0f8-0x0;var _0x413416=_0xadb5[_0x56d0f8];return _0x413416;};'use strict';var _=require('lodash');var util=require(_0x5adb('0x0'));var moment=require('moment');var BPromise=require(_0x5adb('0x1'));var rs=require(_0x5adb('0x2'));var fs=require('fs');var Redis=require(_0x5adb('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x5adb('0x4'));var logger=require(_0x5adb('0x5'))(_0x5adb('0x6'));var config=require('../../config/environment');var jayson=require(_0x5adb('0x7'));var client=jayson[_0x5adb('0x8')][_0x5adb('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3213e8,_0xdf3776,_0x353885){return new BPromise(function(_0x47228a,_0x6d1b45){return client[_0x5adb('0xa')](_0x3213e8,_0x353885)[_0x5adb('0xb')](function(_0x34f59d){logger[_0x5adb('0xc')](_0x5adb('0xd'),_0xdf3776,_0x5adb('0xe'));logger['debug']('MailQueueReport,\x20%s,\x20%s,\x20%s',_0xdf3776,_0x5adb('0xe'),JSON[_0x5adb('0xf')](_0x34f59d));if(_0x34f59d[_0x5adb('0x10')]){if(_0x34f59d['error'][_0x5adb('0x11')]===0x1f4){logger['error'](_0x5adb('0xd'),_0xdf3776,_0x34f59d['error'][_0x5adb('0x12')]);return _0x6d1b45(_0x34f59d[_0x5adb('0x10')][_0x5adb('0x12')]);}logger['error'](_0x5adb('0xd'),_0xdf3776,_0x34f59d[_0x5adb('0x10')][_0x5adb('0x12')]);return _0x47228a(_0x34f59d['error'][_0x5adb('0x12')]);}else{logger['info'](_0x5adb('0xd'),_0xdf3776,_0x5adb('0xe'));_0x47228a(_0x34f59d[_0x5adb('0x13')][_0x5adb('0x12')]);}})[_0x5adb('0x14')](function(_0x39d24d){logger[_0x5adb('0x10')](_0x5adb('0xd'),_0xdf3776,_0x39d24d);_0x6d1b45(_0x39d24d);});});}exports[_0x5adb('0x15')]=function(_0x529b65){var _0x3fff62=this;return new Promise(function(_0x5de028,_0x1d9e86){return db['MailQueueReport'][_0x5adb('0x16')](_0x529b65['body'],{'raw':_0x529b65['options']?_0x529b65[_0x5adb('0x17')][_0x5adb('0x18')]===undefined?!![]:![]:!![]})[_0x5adb('0xb')](function(_0x1fd4a7){logger[_0x5adb('0xc')]('CreateMailQueueReport',_0x529b65);logger[_0x5adb('0x19')]('CreateMailQueueReport',_0x529b65,JSON['stringify'](_0x1fd4a7));_0x5de028(_0x1fd4a7);})[_0x5adb('0x14')](function(_0x379b33){logger[_0x5adb('0x10')](_0x5adb('0x15'),_0x379b33[_0x5adb('0x12')],_0x529b65);_0x1d9e86(_0x3fff62[_0x5adb('0x10')](0x1f4,_0x379b33[_0x5adb('0x12')]));});});};exports['UpdateMailQueueReport']=function(_0x4b1957){var _0x373cc3=this;return new Promise(function(_0x3220cd,_0x3839fb){return db[_0x5adb('0x1a')]['update'](_0x4b1957[_0x5adb('0x1b')],{'raw':_0x4b1957[_0x5adb('0x17')]?_0x4b1957['options'][_0x5adb('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4b1957[_0x5adb('0x17')]?_0x4b1957[_0x5adb('0x17')]['where']||null:null,'attributes':_0x4b1957[_0x5adb('0x17')]?_0x4b1957[_0x5adb('0x17')][_0x5adb('0x1c')]||null:null,'limit':_0x4b1957[_0x5adb('0x17')]?_0x4b1957[_0x5adb('0x17')][_0x5adb('0x1d')]||null:null})['then'](function(_0x49992e){logger['info'](_0x5adb('0x1e'),_0x4b1957);logger[_0x5adb('0x19')](_0x5adb('0x1e'),_0x4b1957,JSON[_0x5adb('0xf')](_0x49992e));_0x3220cd(_0x49992e);})[_0x5adb('0x14')](function(_0x4de310){logger[_0x5adb('0x10')](_0x5adb('0x1e'),_0x4de310[_0x5adb('0x12')],_0x4b1957);_0x3839fb(_0x373cc3[_0x5adb('0x10')](0x1f4,_0x4de310[_0x5adb('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/mailServerIn/index.js b/server/api/mailServerIn/index.js index f1f6afc..389f0ca 100644 --- a/server/api/mailServerIn/index.js +++ b/server/api/mailServerIn/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x4e1104,_0xd6d1a5){var _0x57b6ae=function(_0x518897){while(--_0x518897){_0x4e1104['push'](_0x4e1104['shift']());}};_0x57b6ae(++_0xd6d1a5);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x576d8a,_0x2d7bde){_0x576d8a=_0x576d8a-0x0;var _0x3dc3ef=_0xcb91[_0x576d8a];return _0x3dc3ef;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');module[_0x1cb9('0x6')]=router; \ No newline at end of file +var _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x5d014a,_0x4aba87){var _0x5d05da=function(_0x208f3b){while(--_0x208f3b){_0x5d014a['push'](_0x5d014a['shift']());}};_0x5d05da(++_0x4aba87);}(_0x70e0,0x17b));var _0x070e=function(_0x587c72,_0xeab0a0){_0x587c72=_0x587c72-0x0;var _0x477474=_0x70e0[_0x587c72];return _0x477474;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');module[_0x070e('0x7')]=router; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.attributes.js b/server/api/mailServerIn/mailServerIn.attributes.js index d328bd8..ea6e461 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 _0x7f32=['STRING','BOOLEAN','INTEGER','INBOX','sequelize','exports'];(function(_0x19a55d,_0x13c587){var _0x577370=function(_0x275408){while(--_0x275408){_0x19a55d['push'](_0x19a55d['shift']());}};_0x577370(++_0x13c587);}(_0x7f32,0x9a));var _0x27f3=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7f32[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x27f3('0x0'));module[_0x27f3('0x1')]={'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0x27f3('0x2')]},'authentication':{'type':Sequelize[_0x27f3('0x3')],'defaultValue':!![]},'user':{'type':Sequelize[_0x27f3('0x2')]},'password':{'type':Sequelize[_0x27f3('0x2')]},'port':{'type':Sequelize[_0x27f3('0x4')]},'tls':{'type':Sequelize[_0x27f3('0x3')],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0x27f3('0x2')],'defaultValue':_0x27f3('0x5')},'connTimeout':{'type':Sequelize[_0x27f3('0x4')],'defaultValue':0xa},'authTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'service':{'type':Sequelize[_0x27f3('0x2')]},'modernAuthentication':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x0ae9=['INBOX','sequelize','STRING','BOOLEAN','INTEGER'];(function(_0x2984d0,_0x1a7211){var _0x2885f2=function(_0x42f3da){while(--_0x42f3da){_0x2984d0['push'](_0x2984d0['shift']());}};_0x2885f2(++_0x1a7211);}(_0x0ae9,0x105));var _0x90ae=function(_0x6752b9,_0x1e20d8){_0x6752b9=_0x6752b9-0x0;var _0x1382ac=_0x0ae9[_0x6752b9];return _0x1382ac;};'use strict';var Sequelize=require(_0x90ae('0x0'));module['exports']={'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0x90ae('0x1')]},'authentication':{'type':Sequelize[_0x90ae('0x2')],'defaultValue':!![]},'user':{'type':Sequelize[_0x90ae('0x1')]},'password':{'type':Sequelize[_0x90ae('0x1')]},'port':{'type':Sequelize[_0x90ae('0x3')]},'tls':{'type':Sequelize[_0x90ae('0x2')],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0x90ae('0x1')],'defaultValue':_0x90ae('0x4')},'connTimeout':{'type':Sequelize[_0x90ae('0x3')],'defaultValue':0xa},'authTimeout':{'type':Sequelize[_0x90ae('0x3')],'defaultValue':0x5},'service':{'type':Sequelize[_0x90ae('0x1')]},'modernAuthentication':{'type':Sequelize[_0x90ae('0x2')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.model.js b/server/api/mailServerIn/mailServerIn.model.js index 9e67c2e..f255665 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 _0xad55=['bluebird','request-promise','../../config/environment','MailServerIn','mail_servers_in','lodash','util','api'];(function(_0x11dbc2,_0x14e0a8){var _0xefee44=function(_0x1b02d5){while(--_0x1b02d5){_0x11dbc2['push'](_0x11dbc2['shift']());}};_0xefee44(++_0x14e0a8);}(_0xad55,0x1ad));var _0x5ad5=function(_0x597a71,_0x87ba50){_0x597a71=_0x597a71-0x0;var _0x181220=_0xad55[_0x597a71];return _0x181220;};'use strict';var _=require(_0x5ad5('0x0'));var util=require(_0x5ad5('0x1'));var logger=require('../../config/logger')(_0x5ad5('0x2'));var moment=require('moment');var BPromise=require(_0x5ad5('0x3'));var rp=require(_0x5ad5('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x5ad5('0x5'));var attributes=require('./mailServerIn.attributes');module['exports']=function(_0x3fa40d,_0x1715a0){return _0x3fa40d['define'](_0x5ad5('0x6'),attributes,{'tableName':_0x5ad5('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe44e=['api','moment','path','./mailServerIn.attributes','MailServerIn','mail_servers_in','lodash'];(function(_0x508bcf,_0x26d03d){var _0x386240=function(_0x7a6f08){while(--_0x7a6f08){_0x508bcf['push'](_0x508bcf['shift']());}};_0x386240(++_0x26d03d);}(_0xe44e,0x18e));var _0xee44=function(_0x144349,_0x2e2512){_0x144349=_0x144349-0x0;var _0x52bb84=_0xe44e[_0x144349];return _0x52bb84;};'use strict';var _=require(_0xee44('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xee44('0x1'));var moment=require(_0xee44('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xee44('0x3'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xee44('0x4'));module['exports']=function(_0xfa122f,_0x36d9a7){return _0xfa122f['define'](_0xee44('0x5'),attributes,{'tableName':_0xee44('0x6'),'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 6b8f1f1..4874a89 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 _0x9756=['lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','then','info','MailServerIn,\x20%s,\x20%s','debug','MailServerIn,\x20%s,\x20%s,\x20%s','error','message','request\x20sent','result','catch','MailServerIn','findAll','options','raw','where','attributes','include','map','model','GetMailServerIn','stringify'];(function(_0xf89c3,_0x351bf1){var _0x274fc8=function(_0x5e0c91){while(--_0x5e0c91){_0xf89c3['push'](_0xf89c3['shift']());}};_0x274fc8(++_0x351bf1);}(_0x9756,0x108));var _0x6975=function(_0x3070dc,_0x40cf11){_0x3070dc=_0x3070dc-0x0;var _0x431489=_0x9756[_0x3070dc];return _0x431489;};'use strict';var _=require(_0x6975('0x0'));var util=require(_0x6975('0x1'));var moment=require(_0x6975('0x2'));var BPromise=require(_0x6975('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6975('0x4'));var db=require(_0x6975('0x5'))['db'];var utils=require(_0x6975('0x6'));var logger=require(_0x6975('0x7'))(_0x6975('0x8'));var config=require('../../config/environment');var jayson=require(_0x6975('0x9'));var client=jayson[_0x6975('0xa')][_0x6975('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5708aa,_0x404da8,_0x5bdf17){return new BPromise(function(_0x5a3ac7,_0x4c1bd2){return client['request'](_0x5708aa,_0x5bdf17)[_0x6975('0xc')](function(_0x3901cc){logger[_0x6975('0xd')](_0x6975('0xe'),_0x404da8,'request\x20sent');logger[_0x6975('0xf')](_0x6975('0x10'),_0x404da8,'request\x20sent',JSON['stringify'](_0x3901cc));if(_0x3901cc[_0x6975('0x11')]){if(_0x3901cc[_0x6975('0x11')]['code']===0x1f4){logger[_0x6975('0x11')](_0x6975('0xe'),_0x404da8,_0x3901cc[_0x6975('0x11')][_0x6975('0x12')]);return _0x4c1bd2(_0x3901cc[_0x6975('0x11')][_0x6975('0x12')]);}logger[_0x6975('0x11')]('MailServerIn,\x20%s,\x20%s',_0x404da8,_0x3901cc['error'][_0x6975('0x12')]);return _0x5a3ac7(_0x3901cc['error'][_0x6975('0x12')]);}else{logger[_0x6975('0xd')]('MailServerIn,\x20%s,\x20%s',_0x404da8,_0x6975('0x13'));_0x5a3ac7(_0x3901cc[_0x6975('0x14')][_0x6975('0x12')]);}})[_0x6975('0x15')](function(_0x1f86a5){logger[_0x6975('0x11')](_0x6975('0xe'),_0x404da8,_0x1f86a5);_0x4c1bd2(_0x1f86a5);});});}exports['GetMailServerIn']=function(_0x470121){var _0x3699b7=this;return new Promise(function(_0x4c1754,_0x1093c1){return db[_0x6975('0x16')][_0x6975('0x17')]({'raw':_0x470121['options']?_0x470121[_0x6975('0x18')][_0x6975('0x19')]===undefined?!![]:![]:!![],'where':_0x470121[_0x6975('0x18')]?_0x470121['options'][_0x6975('0x1a')]||null:null,'attributes':_0x470121[_0x6975('0x18')]?_0x470121[_0x6975('0x18')][_0x6975('0x1b')]||null:null,'limit':_0x470121[_0x6975('0x18')]?_0x470121[_0x6975('0x18')]['limit']||null:null,'include':_0x470121['options']?_0x470121['options'][_0x6975('0x1c')]?_[_0x6975('0x1d')](_0x470121[_0x6975('0x18')][_0x6975('0x1c')],function(_0x13e398){return{'model':db[_0x13e398[_0x6975('0x1e')]],'as':_0x13e398['as'],'attributes':_0x13e398['attributes'],'include':_0x13e398[_0x6975('0x1c')]?_[_0x6975('0x1d')](_0x13e398[_0x6975('0x1c')],function(_0x2bbbcc){return{'model':db[_0x2bbbcc[_0x6975('0x1e')]],'as':_0x2bbbcc['as'],'attributes':_0x2bbbcc[_0x6975('0x1b')],'include':_0x2bbbcc['include']?_[_0x6975('0x1d')](_0x2bbbcc[_0x6975('0x1c')],function(_0x43423e){return{'model':db[_0x43423e[_0x6975('0x1e')]],'as':_0x43423e['as'],'attributes':_0x43423e['attributes']};}):[]};}):[]};}):[]:[]})[_0x6975('0xc')](function(_0x2d7cb2){logger['info'](_0x6975('0x1f'),_0x470121);logger[_0x6975('0xf')]('GetMailServerIn',_0x470121,JSON[_0x6975('0x20')](_0x2d7cb2));_0x4c1754(_0x2d7cb2);})[_0x6975('0x15')](function(_0x29400b){logger['error'](_0x6975('0x1f'),_0x29400b['message'],_0x470121);_0x1093c1(_0x3699b7[_0x6975('0x11')](0x1f4,_0x29400b[_0x6975('0x12')]));});});}; \ No newline at end of file +var _0x928c=['bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','MailServerIn,\x20%s,\x20%s','request\x20sent','MailServerIn,\x20%s,\x20%s,\x20%s','error','message','result','catch','GetMailServerIn','MailServerIn','options','raw','where','limit','include','model','attributes','map','debug','stringify','moment'];(function(_0x39792c,_0x68ed5f){var _0x2657c1=function(_0x2ff0af){while(--_0x2ff0af){_0x39792c['push'](_0x39792c['shift']());}};_0x2657c1(++_0x68ed5f);}(_0x928c,0x17f));var _0xc928=function(_0x2df386,_0x44a917){_0x2df386=_0x2df386-0x0;var _0x46862a=_0x928c[_0x2df386];return _0x46862a;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xc928('0x0'));var BPromise=require(_0xc928('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc928('0x2'));var db=require(_0xc928('0x3'))['db'];var utils=require(_0xc928('0x4'));var logger=require(_0xc928('0x5'))(_0xc928('0x6'));var config=require('../../config/environment');var jayson=require(_0xc928('0x7'));var client=jayson[_0xc928('0x8')][_0xc928('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4ff9e6,_0x4fd2a0,_0x5e433b){return new BPromise(function(_0x445248,_0x4270ab){return client[_0xc928('0xa')](_0x4ff9e6,_0x5e433b)[_0xc928('0xb')](function(_0x421f1b){logger[_0xc928('0xc')](_0xc928('0xd'),_0x4fd2a0,_0xc928('0xe'));logger['debug'](_0xc928('0xf'),_0x4fd2a0,_0xc928('0xe'),JSON['stringify'](_0x421f1b));if(_0x421f1b['error']){if(_0x421f1b[_0xc928('0x10')]['code']===0x1f4){logger[_0xc928('0x10')]('MailServerIn,\x20%s,\x20%s',_0x4fd2a0,_0x421f1b[_0xc928('0x10')][_0xc928('0x11')]);return _0x4270ab(_0x421f1b['error'][_0xc928('0x11')]);}logger[_0xc928('0x10')]('MailServerIn,\x20%s,\x20%s',_0x4fd2a0,_0x421f1b[_0xc928('0x10')][_0xc928('0x11')]);return _0x445248(_0x421f1b[_0xc928('0x10')][_0xc928('0x11')]);}else{logger[_0xc928('0xc')](_0xc928('0xd'),_0x4fd2a0,'request\x20sent');_0x445248(_0x421f1b[_0xc928('0x12')][_0xc928('0x11')]);}})[_0xc928('0x13')](function(_0x6cc463){logger[_0xc928('0x10')](_0xc928('0xd'),_0x4fd2a0,_0x6cc463);_0x4270ab(_0x6cc463);});});}exports[_0xc928('0x14')]=function(_0x3206ae){var _0x3f858d=this;return new Promise(function(_0x456dc3,_0x16485d){return db[_0xc928('0x15')]['findAll']({'raw':_0x3206ae[_0xc928('0x16')]?_0x3206ae[_0xc928('0x16')][_0xc928('0x17')]===undefined?!![]:![]:!![],'where':_0x3206ae[_0xc928('0x16')]?_0x3206ae['options'][_0xc928('0x18')]||null:null,'attributes':_0x3206ae[_0xc928('0x16')]?_0x3206ae[_0xc928('0x16')]['attributes']||null:null,'limit':_0x3206ae['options']?_0x3206ae[_0xc928('0x16')][_0xc928('0x19')]||null:null,'include':_0x3206ae[_0xc928('0x16')]?_0x3206ae[_0xc928('0x16')]['include']?_['map'](_0x3206ae[_0xc928('0x16')][_0xc928('0x1a')],function(_0x3ce74d){return{'model':db[_0x3ce74d[_0xc928('0x1b')]],'as':_0x3ce74d['as'],'attributes':_0x3ce74d[_0xc928('0x1c')],'include':_0x3ce74d['include']?_[_0xc928('0x1d')](_0x3ce74d[_0xc928('0x1a')],function(_0x2ac3c7){return{'model':db[_0x2ac3c7['model']],'as':_0x2ac3c7['as'],'attributes':_0x2ac3c7['attributes'],'include':_0x2ac3c7[_0xc928('0x1a')]?_[_0xc928('0x1d')](_0x2ac3c7['include'],function(_0x3d8f30){return{'model':db[_0x3d8f30[_0xc928('0x1b')]],'as':_0x3d8f30['as'],'attributes':_0x3d8f30[_0xc928('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xc928('0xb')](function(_0x58b20b){logger[_0xc928('0xc')](_0xc928('0x14'),_0x3206ae);logger[_0xc928('0x1e')](_0xc928('0x14'),_0x3206ae,JSON[_0xc928('0x1f')](_0x58b20b));_0x456dc3(_0x58b20b);})[_0xc928('0x13')](function(_0x9deef4){logger[_0xc928('0x10')](_0xc928('0x14'),_0x9deef4[_0xc928('0x11')],_0x3206ae);_0x16485d(_0x3f858d[_0xc928('0x10')](0x1f4,_0x9deef4[_0xc928('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/mailServerOut/index.js b/server/api/mailServerOut/index.js index f7e8d87..0e6acd5 100644 --- a/server/api/mailServerOut/index.js +++ b/server/api/mailServerOut/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['index','/:id','isAuthenticated','post','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailServerOut.controller','get'];(function(_0x47b58b,_0x41a189){var _0x46bebe=function(_0x22bbfa){while(--_0x22bbfa){_0x47b58b['push'](_0x47b58b['shift']());}};_0x46bebe(++_0x41a189);}(_0x7a54,0x106));var _0x47a5=function(_0x158097,_0x1ac853){_0x158097=_0x158097-0x0;var _0xc8171e=_0x7a54[_0x158097];return _0xc8171e;};'use strict';var multer=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var path=require(_0x47a5('0x2'));var timeout=require('connect-timeout');var express=require(_0x47a5('0x3'));var router=express[_0x47a5('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x47a5('0x5'));var interaction=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var controller=require(_0x47a5('0x8'));router[_0x47a5('0x9')]('/',auth['isAuthenticated'](),controller[_0x47a5('0xa')]);router['get'](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller['show']);router[_0x47a5('0xd')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller['update']);router[_0x47a5('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x47a5('0xf')]);module[_0x47a5('0x10')]=router; \ No newline at end of file +var _0x9957=['multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./mailServerOut.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports'];(function(_0x21aec3,_0x5c97e9){var _0x288bbc=function(_0x2283fe){while(--_0x2283fe){_0x21aec3['push'](_0x21aec3['shift']());}};_0x288bbc(++_0x5c97e9);}(_0x9957,0x93));var _0x7995=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x9957[_0x1ac595];return _0x455fff;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0xe')]('/',auth['isAuthenticated'](),controller[_0x7995('0xf')]);router[_0x7995('0x10')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x11')]);router[_0x7995('0x12')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0x13')]);module[_0x7995('0x14')]=router; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.attributes.js b/server/api/mailServerOut/mailServerOut.attributes.js index 53c7020..dec2261 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 _0x2032=['BOOLEAN','exports','STRING','INTEGER'];(function(_0x633e46,_0x541f6b){var _0x353960=function(_0x3585c1){while(--_0x3585c1){_0x633e46['push'](_0x633e46['shift']());}};_0x353960(++_0x541f6b);}(_0x2032,0xd9));var _0x2203=function(_0x5b6110,_0x1fd1c9){_0x5b6110=_0x5b6110-0x0;var _0x5064a4=_0x2032[_0x5b6110];return _0x5064a4;};'use strict';var Sequelize=require('sequelize');module[_0x2203('0x0')]={'description':{'type':Sequelize[_0x2203('0x1')]},'host':{'type':Sequelize[_0x2203('0x1')]},'user':{'type':Sequelize['STRING']},'pass':{'type':Sequelize[_0x2203('0x1')]},'port':{'type':Sequelize[_0x2203('0x2')]},'secure':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'service':{'type':Sequelize[_0x2203('0x1')]},'authentication':{'type':Sequelize[_0x2203('0x3')],'defaultValue':!![]},'modernAuthentication':{'type':Sequelize[_0x2203('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0x0abf=['sequelize','STRING','INTEGER','BOOLEAN'];(function(_0x2bc270,_0x5041bd){var _0x3b2ff6=function(_0x50849c){while(--_0x50849c){_0x2bc270['push'](_0x2bc270['shift']());}};_0x3b2ff6(++_0x5041bd);}(_0x0abf,0xe8));var _0xf0ab=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x0abf[_0x3947c9];return _0x2e7871;};'use strict';var Sequelize=require(_0xf0ab('0x0'));module['exports']={'description':{'type':Sequelize[_0xf0ab('0x1')]},'host':{'type':Sequelize[_0xf0ab('0x1')]},'user':{'type':Sequelize['STRING']},'pass':{'type':Sequelize['STRING']},'port':{'type':Sequelize[_0xf0ab('0x2')]},'secure':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'service':{'type':Sequelize[_0xf0ab('0x1')]},'authentication':{'type':Sequelize[_0xf0ab('0x3')],'defaultValue':!![]},'modernAuthentication':{'type':Sequelize[_0xf0ab('0x3')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.controller.js b/server/api/mailServerOut/mailServerOut.controller.js index 7c2c4cc..74a0f68 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 _0xcae8=['querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','undefined','count','offset','limit','Content-Range','reject','update','then','destroy','sendStatus','error','name','send','index','map','MailServerOut','rawAttributes','fieldName','key','keys','query','filters','model','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','type','options','includeAll','include','findAll','catch','show','params','intersection','find','create','body','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js'];(function(_0x4add39,_0x2c9474){var _0x393bd1=function(_0x38ff29){while(--_0x38ff29){_0x4add39['push'](_0x4add39['shift']());}};_0x393bd1(++_0x2c9474);}(_0xcae8,0xcf));var _0x8cae=function(_0xd31621,_0x17b567){_0xd31621=_0xd31621-0x0;var _0x2e7ac0=_0xcae8[_0xd31621];return _0x2e7ac0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8cae('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8cae('0x1'));var rp=require(_0x8cae('0x2'));var moment=require(_0x8cae('0x3'));var BPromise=require(_0x8cae('0x4'));var Mustache=require(_0x8cae('0x5'));var util=require('util');var path=require(_0x8cae('0x6'));var sox=require(_0x8cae('0x7'));var csv=require(_0x8cae('0x8'));var ejs=require(_0x8cae('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x8cae('0xa'));var squel=require(_0x8cae('0xb'));var crypto=require(_0x8cae('0xc'));var jsforce=require(_0x8cae('0xd'));var deskjs=require(_0x8cae('0xe'));var toCsv=require('to-csv');var querystring=require(_0x8cae('0xf'));var Papa=require(_0x8cae('0x10'));var Redis=require(_0x8cae('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x8cae('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8cae('0x13'));var logger=require(_0x8cae('0x14'))(_0x8cae('0x15'));var utils=require(_0x8cae('0x16'));var config=require(_0x8cae('0x17'));var licenseUtil=require(_0x8cae('0x18'));var db=require(_0x8cae('0x19'))['db'];function respondWithStatusCode(_0x3df5e8,_0x8bd9d8){_0x8bd9d8=_0x8bd9d8||0xcc;return function(_0xb4bc0e){if(_0xb4bc0e){return _0x3df5e8['sendStatus'](_0x8bd9d8);}return _0x3df5e8[_0x8cae('0x1a')](_0x8bd9d8)[_0x8cae('0x1b')]();};}function respondWithResult(_0x35577f,_0x1fb56a){_0x1fb56a=_0x1fb56a||0xc8;return function(_0x2e13eb){if(_0x2e13eb){return _0x35577f[_0x8cae('0x1a')](_0x1fb56a)[_0x8cae('0x1c')](_0x2e13eb);}};}function respondWithFilteredResult(_0x54dba7,_0x4519c2){return function(_0x25f50b){if(_0x25f50b){var _0x542ca8=typeof _0x4519c2['offset']===_0x8cae('0x1d')&&typeof _0x4519c2['limit']===_0x8cae('0x1d');var _0x4398d2=_0x25f50b[_0x8cae('0x1e')];var _0x361835=_0x542ca8?0x0:_0x4519c2['offset'];var _0x3c1d0b=_0x542ca8?_0x25f50b[_0x8cae('0x1e')]:_0x4519c2[_0x8cae('0x1f')]+_0x4519c2[_0x8cae('0x20')];var _0x461917;if(_0x3c1d0b>=_0x4398d2){_0x3c1d0b=_0x4398d2;_0x461917=0xc8;}else{_0x461917=0xce;}_0x54dba7['status'](_0x461917);return _0x54dba7['set'](_0x8cae('0x21'),_0x361835+'-'+_0x3c1d0b+'/'+_0x4398d2)['json'](_0x25f50b);}return null;};}function patchUpdates(_0x48186d){return function(_0x4cc3cb){try{jsonpatch['apply'](_0x4cc3cb,_0x48186d,!![]);}catch(_0x1bb6a9){return BPromise[_0x8cae('0x22')](_0x1bb6a9);}return _0x4cc3cb['save']();};}function saveUpdates(_0x8da8ac,_0x277897){return function(_0x1ac465){if(_0x1ac465){return _0x1ac465[_0x8cae('0x23')](_0x8da8ac)[_0x8cae('0x24')](function(_0x491790){return _0x491790;});}return null;};}function removeEntity(_0x3eac40,_0x872d56){return function(_0xd76900){if(_0xd76900){return _0xd76900[_0x8cae('0x25')]()[_0x8cae('0x24')](function(){_0x3eac40[_0x8cae('0x1a')](0xcc)[_0x8cae('0x1b')]();});}};}function handleEntityNotFound(_0x7d0fb1,_0x637eae){return function(_0x18e42e){if(!_0x18e42e){_0x7d0fb1[_0x8cae('0x26')](0x194);}return _0x18e42e;};}function handleError(_0x569e5,_0x3d432a){_0x3d432a=_0x3d432a||0x1f4;return function(_0x34268b){logger[_0x8cae('0x27')](_0x34268b['stack']);if(_0x34268b[_0x8cae('0x28')]){delete _0x34268b[_0x8cae('0x28')];}_0x569e5[_0x8cae('0x1a')](_0x3d432a)[_0x8cae('0x29')](_0x34268b);};}exports[_0x8cae('0x2a')]=function(_0x4393fd,_0x361928){var _0x73baf5={},_0x8df7a0={},_0x87ac5={'count':0x0,'rows':[]};var _0x3fd556=_[_0x8cae('0x2b')](db[_0x8cae('0x2c')][_0x8cae('0x2d')],function(_0x25aade){return{'name':_0x25aade[_0x8cae('0x2e')],'type':_0x25aade['type'][_0x8cae('0x2f')]};});_0x8df7a0['model']=_[_0x8cae('0x2b')](_0x3fd556,'name');_0x8df7a0['query']=_[_0x8cae('0x30')](_0x4393fd[_0x8cae('0x31')]);_0x8df7a0[_0x8cae('0x32')]=_['intersection'](_0x8df7a0['model'],_0x8df7a0[_0x8cae('0x31')]);_0x73baf5['attributes']=_['intersection'](_0x8df7a0[_0x8cae('0x33')],qs['fields'](_0x4393fd['query'][_0x8cae('0x34')]));_0x73baf5[_0x8cae('0x35')]=_0x73baf5[_0x8cae('0x35')][_0x8cae('0x36')]?_0x73baf5[_0x8cae('0x35')]:_0x8df7a0[_0x8cae('0x33')];if(!_0x4393fd[_0x8cae('0x31')][_0x8cae('0x37')](_0x8cae('0x38'))){_0x73baf5['limit']=qs[_0x8cae('0x20')](_0x4393fd[_0x8cae('0x31')][_0x8cae('0x20')]);_0x73baf5[_0x8cae('0x1f')]=qs[_0x8cae('0x1f')](_0x4393fd[_0x8cae('0x31')][_0x8cae('0x1f')]);}_0x73baf5['order']=qs[_0x8cae('0x39')](_0x4393fd[_0x8cae('0x31')]['sort']);_0x73baf5[_0x8cae('0x3a')]=qs[_0x8cae('0x32')](_[_0x8cae('0x3b')](_0x4393fd['query'],_0x8df7a0['filters']),_0x3fd556);if(_0x4393fd[_0x8cae('0x31')][_0x8cae('0x3c')]){_0x73baf5['where']=_[_0x8cae('0x3d')](_0x73baf5[_0x8cae('0x3a')],{'$or':_[_0x8cae('0x2b')](_0x3fd556,function(_0x1296b8){if(_0x1296b8[_0x8cae('0x3e')]!=='VIRTUAL'){var _0x4cac27={};_0x4cac27[_0x1296b8[_0x8cae('0x28')]]={'$like':'%'+_0x4393fd[_0x8cae('0x31')][_0x8cae('0x3c')]+'%'};return _0x4cac27;}})});}_0x73baf5=_[_0x8cae('0x3d')]({},_0x73baf5,_0x4393fd[_0x8cae('0x3f')]);var _0x54e97f={'where':_0x73baf5[_0x8cae('0x3a')]};return db[_0x8cae('0x2c')][_0x8cae('0x1e')](_0x54e97f)[_0x8cae('0x24')](function(_0x479f64){_0x87ac5[_0x8cae('0x1e')]=_0x479f64;if(_0x4393fd[_0x8cae('0x31')][_0x8cae('0x40')]){_0x73baf5[_0x8cae('0x41')]=[{'all':!![]}];}return db[_0x8cae('0x2c')][_0x8cae('0x42')](_0x73baf5);})['then'](function(_0x26ce2c){_0x87ac5['rows']=_0x26ce2c;return _0x87ac5;})[_0x8cae('0x24')](respondWithFilteredResult(_0x361928,_0x73baf5))[_0x8cae('0x43')](handleError(_0x361928,null));};exports[_0x8cae('0x44')]=function(_0x550567,_0xd32fc5){var _0x491a76={'raw':!![],'where':{'id':_0x550567[_0x8cae('0x45')]['id']}},_0x117ce1={};_0x117ce1[_0x8cae('0x33')]=_[_0x8cae('0x30')](db[_0x8cae('0x2c')][_0x8cae('0x2d')]);_0x117ce1[_0x8cae('0x31')]=_[_0x8cae('0x30')](_0x550567['query']);_0x117ce1['filters']=_[_0x8cae('0x46')](_0x117ce1[_0x8cae('0x33')],_0x117ce1[_0x8cae('0x31')]);_0x491a76['attributes']=_[_0x8cae('0x46')](_0x117ce1[_0x8cae('0x33')],qs[_0x8cae('0x34')](_0x550567[_0x8cae('0x31')]['fields']));_0x491a76[_0x8cae('0x35')]=_0x491a76[_0x8cae('0x35')][_0x8cae('0x36')]?_0x491a76[_0x8cae('0x35')]:_0x117ce1[_0x8cae('0x33')];if(_0x550567[_0x8cae('0x31')][_0x8cae('0x40')]){_0x491a76[_0x8cae('0x41')]=[{'all':!![]}];}_0x491a76=_[_0x8cae('0x3d')]({},_0x491a76,_0x550567[_0x8cae('0x3f')]);return db[_0x8cae('0x2c')][_0x8cae('0x47')](_0x491a76)[_0x8cae('0x24')](handleEntityNotFound(_0xd32fc5,null))[_0x8cae('0x24')](respondWithResult(_0xd32fc5,null))[_0x8cae('0x43')](handleError(_0xd32fc5,null));};exports['create']=function(_0x1af5d2,_0x590970){return db[_0x8cae('0x2c')][_0x8cae('0x48')](_0x1af5d2[_0x8cae('0x49')],{})[_0x8cae('0x24')](respondWithResult(_0x590970,0xc9))['catch'](handleError(_0x590970,null));};exports[_0x8cae('0x23')]=function(_0x50048f,_0x3117a4){if(_0x50048f[_0x8cae('0x49')]['id']){delete _0x50048f[_0x8cae('0x49')]['id'];}return db[_0x8cae('0x2c')][_0x8cae('0x47')]({'where':{'id':_0x50048f['params']['id']}})[_0x8cae('0x24')](handleEntityNotFound(_0x3117a4,null))[_0x8cae('0x24')](saveUpdates(_0x50048f[_0x8cae('0x49')],null))[_0x8cae('0x24')](respondWithResult(_0x3117a4,null))[_0x8cae('0x43')](handleError(_0x3117a4,null));};exports[_0x8cae('0x25')]=function(_0xc3fe9b,_0x17336e){return db['MailServerOut'][_0x8cae('0x47')]({'where':{'id':_0xc3fe9b[_0x8cae('0x45')]['id']}})[_0x8cae('0x24')](handleEntityNotFound(_0x17336e,null))[_0x8cae('0x24')](removeEntity(_0x17336e,null))[_0x8cae('0x43')](handleError(_0x17336e,null));}; \ No newline at end of file +var _0x8305=['../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','reject','then','destroy','error','stack','name','send','index','map','MailServerOut','type','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','filter','where','merge','options','includeAll','include','findAll','rows','catch','find','create','body','update','params','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x4cba05,_0x403f45){var _0x262468=function(_0x27ff63){while(--_0x27ff63){_0x4cba05['push'](_0x4cba05['shift']());}};_0x262468(++_0x403f45);}(_0x8305,0xbf));var _0x5830=function(_0x49584d,_0x1ec19d){_0x49584d=_0x49584d-0x0;var _0x1959db=_0x8305[_0x49584d];return _0x1959db;};'use strict';var emlformat=require(_0x5830('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x5830('0x1'));var jsonpatch=require(_0x5830('0x2'));var rp=require(_0x5830('0x3'));var moment=require(_0x5830('0x4'));var BPromise=require(_0x5830('0x5'));var Mustache=require(_0x5830('0x6'));var util=require(_0x5830('0x7'));var path=require(_0x5830('0x8'));var sox=require(_0x5830('0x9'));var csv=require(_0x5830('0xa'));var ejs=require(_0x5830('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x5830('0xc'));var crypto=require('crypto');var jsforce=require(_0x5830('0xd'));var deskjs=require(_0x5830('0xe'));var toCsv=require(_0x5830('0xa'));var querystring=require('querystring');var Papa=require(_0x5830('0xf'));var Redis=require(_0x5830('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x5830('0x11'));var as=require(_0x5830('0x12'));var hardwareService=require(_0x5830('0x13'));var logger=require(_0x5830('0x14'))(_0x5830('0x15'));var utils=require('../../config/utils');var config=require(_0x5830('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x5830('0x17'))['db'];function respondWithStatusCode(_0x24a5fb,_0x218f6b){_0x218f6b=_0x218f6b||0xcc;return function(_0x1ddec7){if(_0x1ddec7){return _0x24a5fb[_0x5830('0x18')](_0x218f6b);}return _0x24a5fb[_0x5830('0x19')](_0x218f6b)[_0x5830('0x1a')]();};}function respondWithResult(_0x15f186,_0xecdd02){_0xecdd02=_0xecdd02||0xc8;return function(_0x8c7b30){if(_0x8c7b30){return _0x15f186[_0x5830('0x19')](_0xecdd02)[_0x5830('0x1b')](_0x8c7b30);}};}function respondWithFilteredResult(_0x3fcc94,_0x4c8598){return function(_0x5c4b1a){if(_0x5c4b1a){var _0x24a00c=typeof _0x4c8598[_0x5830('0x1c')]===_0x5830('0x1d')&&typeof _0x4c8598[_0x5830('0x1e')]==='undefined';var _0x298bfb=_0x5c4b1a[_0x5830('0x1f')];var _0x5e0a52=_0x24a00c?0x0:_0x4c8598[_0x5830('0x1c')];var _0x20483d=_0x24a00c?_0x5c4b1a[_0x5830('0x1f')]:_0x4c8598[_0x5830('0x1c')]+_0x4c8598['limit'];var _0x42f9d2;if(_0x20483d>=_0x298bfb){_0x20483d=_0x298bfb;_0x42f9d2=0xc8;}else{_0x42f9d2=0xce;}_0x3fcc94[_0x5830('0x19')](_0x42f9d2);return _0x3fcc94[_0x5830('0x20')]('Content-Range',_0x5e0a52+'-'+_0x20483d+'/'+_0x298bfb)[_0x5830('0x1b')](_0x5c4b1a);}return null;};}function patchUpdates(_0x1d2f1c){return function(_0x5b28f5){try{jsonpatch['apply'](_0x5b28f5,_0x1d2f1c,!![]);}catch(_0x1327a5){return BPromise[_0x5830('0x21')](_0x1327a5);}return _0x5b28f5['save']();};}function saveUpdates(_0xf16bb2,_0x2a1a3e){return function(_0x3b1bb2){if(_0x3b1bb2){return _0x3b1bb2['update'](_0xf16bb2)[_0x5830('0x22')](function(_0x4f99eb){return _0x4f99eb;});}return null;};}function removeEntity(_0x429071,_0x3729b9){return function(_0x1a176f){if(_0x1a176f){return _0x1a176f[_0x5830('0x23')]()['then'](function(){_0x429071[_0x5830('0x19')](0xcc)[_0x5830('0x1a')]();});}};}function handleEntityNotFound(_0x492712,_0x59bd1a){return function(_0x229795){if(!_0x229795){_0x492712['sendStatus'](0x194);}return _0x229795;};}function handleError(_0x5ac6fe,_0x167cec){_0x167cec=_0x167cec||0x1f4;return function(_0x5ca2c2){logger[_0x5830('0x24')](_0x5ca2c2[_0x5830('0x25')]);if(_0x5ca2c2[_0x5830('0x26')]){delete _0x5ca2c2[_0x5830('0x26')];}_0x5ac6fe[_0x5830('0x19')](_0x167cec)[_0x5830('0x27')](_0x5ca2c2);};}exports[_0x5830('0x28')]=function(_0x19771d,_0x6916da){var _0x3cb48c={},_0x1247fe={},_0x3b4b0c={'count':0x0,'rows':[]};var _0x4423cc=_[_0x5830('0x29')](db[_0x5830('0x2a')]['rawAttributes'],function(_0x6d8d92){return{'name':_0x6d8d92['fieldName'],'type':_0x6d8d92[_0x5830('0x2b')]['key']};});_0x1247fe[_0x5830('0x2c')]=_['map'](_0x4423cc,'name');_0x1247fe[_0x5830('0x2d')]=_[_0x5830('0x2e')](_0x19771d['query']);_0x1247fe[_0x5830('0x2f')]=_[_0x5830('0x30')](_0x1247fe[_0x5830('0x2c')],_0x1247fe[_0x5830('0x2d')]);_0x3cb48c['attributes']=_[_0x5830('0x30')](_0x1247fe[_0x5830('0x2c')],qs[_0x5830('0x31')](_0x19771d[_0x5830('0x2d')][_0x5830('0x31')]));_0x3cb48c[_0x5830('0x32')]=_0x3cb48c[_0x5830('0x32')][_0x5830('0x33')]?_0x3cb48c[_0x5830('0x32')]:_0x1247fe['model'];if(!_0x19771d[_0x5830('0x2d')][_0x5830('0x34')](_0x5830('0x35'))){_0x3cb48c[_0x5830('0x1e')]=qs[_0x5830('0x1e')](_0x19771d[_0x5830('0x2d')][_0x5830('0x1e')]);_0x3cb48c[_0x5830('0x1c')]=qs['offset'](_0x19771d[_0x5830('0x2d')][_0x5830('0x1c')]);}_0x3cb48c[_0x5830('0x36')]=qs[_0x5830('0x37')](_0x19771d[_0x5830('0x2d')][_0x5830('0x37')]);_0x3cb48c['where']=qs[_0x5830('0x2f')](_['pick'](_0x19771d[_0x5830('0x2d')],_0x1247fe['filters']),_0x4423cc);if(_0x19771d['query'][_0x5830('0x38')]){_0x3cb48c['where']=_['merge'](_0x3cb48c[_0x5830('0x39')],{'$or':_['map'](_0x4423cc,function(_0x182bc8){if(_0x182bc8[_0x5830('0x2b')]!=='VIRTUAL'){var _0x3bf0c4={};_0x3bf0c4[_0x182bc8[_0x5830('0x26')]]={'$like':'%'+_0x19771d[_0x5830('0x2d')][_0x5830('0x38')]+'%'};return _0x3bf0c4;}})});}_0x3cb48c=_[_0x5830('0x3a')]({},_0x3cb48c,_0x19771d[_0x5830('0x3b')]);var _0x31882d={'where':_0x3cb48c['where']};return db['MailServerOut'][_0x5830('0x1f')](_0x31882d)[_0x5830('0x22')](function(_0x3d4016){_0x3b4b0c['count']=_0x3d4016;if(_0x19771d[_0x5830('0x2d')][_0x5830('0x3c')]){_0x3cb48c[_0x5830('0x3d')]=[{'all':!![]}];}return db[_0x5830('0x2a')][_0x5830('0x3e')](_0x3cb48c);})[_0x5830('0x22')](function(_0x1a6760){_0x3b4b0c[_0x5830('0x3f')]=_0x1a6760;return _0x3b4b0c;})[_0x5830('0x22')](respondWithFilteredResult(_0x6916da,_0x3cb48c))[_0x5830('0x40')](handleError(_0x6916da,null));};exports['show']=function(_0x352f09,_0x5efec7){var _0x96d0b0={'raw':!![],'where':{'id':_0x352f09['params']['id']}},_0x3ab6dd={};_0x3ab6dd[_0x5830('0x2c')]=_['keys'](db['MailServerOut']['rawAttributes']);_0x3ab6dd[_0x5830('0x2d')]=_[_0x5830('0x2e')](_0x352f09[_0x5830('0x2d')]);_0x3ab6dd[_0x5830('0x2f')]=_[_0x5830('0x30')](_0x3ab6dd[_0x5830('0x2c')],_0x3ab6dd[_0x5830('0x2d')]);_0x96d0b0[_0x5830('0x32')]=_['intersection'](_0x3ab6dd[_0x5830('0x2c')],qs[_0x5830('0x31')](_0x352f09[_0x5830('0x2d')][_0x5830('0x31')]));_0x96d0b0[_0x5830('0x32')]=_0x96d0b0[_0x5830('0x32')][_0x5830('0x33')]?_0x96d0b0['attributes']:_0x3ab6dd[_0x5830('0x2c')];if(_0x352f09[_0x5830('0x2d')]['includeAll']){_0x96d0b0[_0x5830('0x3d')]=[{'all':!![]}];}_0x96d0b0=_[_0x5830('0x3a')]({},_0x96d0b0,_0x352f09[_0x5830('0x3b')]);return db[_0x5830('0x2a')][_0x5830('0x41')](_0x96d0b0)['then'](handleEntityNotFound(_0x5efec7,null))[_0x5830('0x22')](respondWithResult(_0x5efec7,null))['catch'](handleError(_0x5efec7,null));};exports[_0x5830('0x42')]=function(_0x1f212e,_0x113b5b){return db['MailServerOut']['create'](_0x1f212e[_0x5830('0x43')],{})[_0x5830('0x22')](respondWithResult(_0x113b5b,0xc9))[_0x5830('0x40')](handleError(_0x113b5b,null));};exports[_0x5830('0x44')]=function(_0x569527,_0x5ca919){if(_0x569527[_0x5830('0x43')]['id']){delete _0x569527['body']['id'];}return db[_0x5830('0x2a')][_0x5830('0x41')]({'where':{'id':_0x569527[_0x5830('0x45')]['id']}})['then'](handleEntityNotFound(_0x5ca919,null))[_0x5830('0x22')](saveUpdates(_0x569527[_0x5830('0x43')],null))[_0x5830('0x22')](respondWithResult(_0x5ca919,null))[_0x5830('0x40')](handleError(_0x5ca919,null));};exports[_0x5830('0x23')]=function(_0x4a5d23,_0x5101b0){return db[_0x5830('0x2a')]['find']({'where':{'id':_0x4a5d23[_0x5830('0x45')]['id']}})['then'](handleEntityNotFound(_0x5101b0,null))['then'](removeEntity(_0x5101b0,null))[_0x5830('0x40')](handleError(_0x5101b0,null));}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.model.js b/server/api/mailServerOut/mailServerOut.model.js index a292c85..1b01c15 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 _0x46c7=['../../config/environment','./mailServerOut.attributes','MailServerOut','mail_servers_out','lodash','util','../../config/logger','moment','request-promise','path','rimraf'];(function(_0x3f2ecf,_0x4ccad6){var _0xa6dd7e=function(_0x5e04c3){while(--_0x5e04c3){_0x3f2ecf['push'](_0x3f2ecf['shift']());}};_0xa6dd7e(++_0x4ccad6);}(_0x46c7,0x138));var _0x746c=function(_0x4792c8,_0x5158a1){_0x4792c8=_0x4792c8-0x0;var _0x35edb1=_0x46c7[_0x4792c8];return _0x35edb1;};'use strict';var _=require(_0x746c('0x0'));var util=require(_0x746c('0x1'));var logger=require(_0x746c('0x2'))('api');var moment=require(_0x746c('0x3'));var BPromise=require('bluebird');var rp=require(_0x746c('0x4'));var fs=require('fs');var path=require(_0x746c('0x5'));var rimraf=require(_0x746c('0x6'));var config=require(_0x746c('0x7'));var attributes=require(_0x746c('0x8'));module['exports']=function(_0x585360,_0x4b00b4){return _0x585360['define'](_0x746c('0x9'),attributes,{'tableName':_0x746c('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcd9e=['./mailServerOut.attributes','exports','define','mail_servers_out','lodash','../../config/logger','api','moment','request-promise','path','rimraf'];(function(_0x36f47c,_0x38ef4d){var _0x296c55=function(_0x403eec){while(--_0x403eec){_0x36f47c['push'](_0x36f47c['shift']());}};_0x296c55(++_0x38ef4d);}(_0xcd9e,0x164));var _0xecd9=function(_0x31d36d,_0x3e6cda){_0x31d36d=_0x31d36d-0x0;var _0x201d22=_0xcd9e[_0x31d36d];return _0x201d22;};'use strict';var _=require(_0xecd9('0x0'));var util=require('util');var logger=require(_0xecd9('0x1'))(_0xecd9('0x2'));var moment=require(_0xecd9('0x3'));var BPromise=require('bluebird');var rp=require(_0xecd9('0x4'));var fs=require('fs');var path=require(_0xecd9('0x5'));var rimraf=require(_0xecd9('0x6'));var config=require('../../config/environment');var attributes=require(_0xecd9('0x7'));module[_0xecd9('0x8')]=function(_0x9f8629,_0x550a8){return _0x9f8629[_0xecd9('0x9')]('MailServerOut',attributes,{'tableName':_0xecd9('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 2c24415..38e6b20 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 _0xadb5=['error','code','message','result','catch','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','MailServerOut,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x50514b,_0x83db65){var _0x5d8587=function(_0x327ba5){while(--_0x327ba5){_0x50514b['push'](_0x50514b['shift']());}};_0x5d8587(++_0x83db65);}(_0xadb5,0xad));var _0x5adb=function(_0x152b2c,_0x432f2e){_0x152b2c=_0x152b2c-0x0;var _0x4d13c1=_0xadb5[_0x152b2c];return _0x4d13c1;};'use strict';var _=require('lodash');var util=require(_0x5adb('0x0'));var moment=require('moment');var BPromise=require(_0x5adb('0x1'));var rs=require(_0x5adb('0x2'));var fs=require('fs');var Redis=require(_0x5adb('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x5adb('0x4'));var logger=require(_0x5adb('0x5'))(_0x5adb('0x6'));var config=require('../../config/environment');var jayson=require(_0x5adb('0x7'));var client=jayson[_0x5adb('0x8')][_0x5adb('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3213e8,_0xdf3776,_0x353885){return new BPromise(function(_0x47228a,_0x6d1b45){return client[_0x5adb('0xa')](_0x3213e8,_0x353885)[_0x5adb('0xb')](function(_0x34f59d){logger[_0x5adb('0xc')](_0x5adb('0xd'),_0xdf3776,_0x5adb('0xe'));logger['debug']('MailServerOut,\x20%s,\x20%s,\x20%s',_0xdf3776,_0x5adb('0xe'),JSON[_0x5adb('0xf')](_0x34f59d));if(_0x34f59d[_0x5adb('0x10')]){if(_0x34f59d['error'][_0x5adb('0x11')]===0x1f4){logger['error'](_0x5adb('0xd'),_0xdf3776,_0x34f59d['error'][_0x5adb('0x12')]);return _0x6d1b45(_0x34f59d[_0x5adb('0x10')][_0x5adb('0x12')]);}logger['error'](_0x5adb('0xd'),_0xdf3776,_0x34f59d[_0x5adb('0x10')][_0x5adb('0x12')]);return _0x47228a(_0x34f59d['error'][_0x5adb('0x12')]);}else{logger['info'](_0x5adb('0xd'),_0xdf3776,_0x5adb('0xe'));_0x47228a(_0x34f59d[_0x5adb('0x13')][_0x5adb('0x12')]);}})[_0x5adb('0x14')](function(_0x39d24d){logger[_0x5adb('0x10')](_0x5adb('0xd'),_0xdf3776,_0x39d24d);_0x6d1b45(_0x39d24d);});});} \ No newline at end of file +var _0x5f2f=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','info','MailServerOut,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch'];(function(_0x2c7530,_0x4fdd68){var _0x20ed3c=function(_0x242175){while(--_0x242175){_0x2c7530['push'](_0x2c7530['shift']());}};_0x20ed3c(++_0x4fdd68);}(_0x5f2f,0x73));var _0xf5f2=function(_0x4d20c8,_0x28d948){_0x4d20c8=_0x4d20c8-0x0;var _0x324c4d=_0x5f2f[_0x4d20c8];return _0x324c4d;};'use strict';var _=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var moment=require(_0xf5f2('0x2'));var BPromise=require(_0xf5f2('0x3'));var rs=require(_0xf5f2('0x4'));var fs=require('fs');var Redis=require(_0xf5f2('0x5'));var db=require(_0xf5f2('0x6'))['db'];var utils=require(_0xf5f2('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0xf5f2('0x8'));var jayson=require(_0xf5f2('0x9'));var client=jayson[_0xf5f2('0xa')][_0xf5f2('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3133bc,_0x473100,_0x5907aa){return new BPromise(function(_0x466882,_0x46cd9c){return client[_0xf5f2('0xc')](_0x3133bc,_0x5907aa)['then'](function(_0x375da4){logger[_0xf5f2('0xd')](_0xf5f2('0xe'),_0x473100,'request\x20sent');logger[_0xf5f2('0xf')]('MailServerOut,\x20%s,\x20%s,\x20%s',_0x473100,'request\x20sent',JSON[_0xf5f2('0x10')](_0x375da4));if(_0x375da4[_0xf5f2('0x11')]){if(_0x375da4['error'][_0xf5f2('0x12')]===0x1f4){logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0x375da4[_0xf5f2('0x11')][_0xf5f2('0x13')]);return _0x46cd9c(_0x375da4[_0xf5f2('0x11')]['message']);}logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0x375da4[_0xf5f2('0x11')][_0xf5f2('0x13')]);return _0x466882(_0x375da4[_0xf5f2('0x11')]['message']);}else{logger[_0xf5f2('0xd')](_0xf5f2('0xe'),_0x473100,_0xf5f2('0x14'));_0x466882(_0x375da4[_0xf5f2('0x15')][_0xf5f2('0x13')]);}})[_0xf5f2('0x16')](function(_0xdb61b3){logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0xdb61b3);_0x46cd9c(_0xdb61b3);});});} \ No newline at end of file diff --git a/server/api/mailSubstatus/index.js b/server/api/mailSubstatus/index.js index 8a736d6..e8202b2 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 _0x5219=['destroy','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailSubstatus.controller','get','isAuthenticated','index','/describe','describe','/:id','show','create','put','delete'];(function(_0xbced6b,_0x3aa946){var _0x22e543=function(_0x10609e){while(--_0x10609e){_0xbced6b['push'](_0xbced6b['shift']());}};_0x22e543(++_0x3aa946);}(_0x5219,0x17d));var _0x9521=function(_0x561aeb,_0x50082a){_0x561aeb=_0x561aeb-0x0;var _0x2d036e=_0x5219[_0x561aeb];return _0x2d036e;};'use strict';var multer=require(_0x9521('0x0'));var util=require('util');var path=require(_0x9521('0x1'));var timeout=require(_0x9521('0x2'));var express=require('express');var router=express[_0x9521('0x3')]();var fs_extra=require(_0x9521('0x4'));var auth=require(_0x9521('0x5'));var interaction=require(_0x9521('0x6'));var config=require(_0x9521('0x7'));var controller=require(_0x9521('0x8'));router[_0x9521('0x9')]('/',auth[_0x9521('0xa')](),controller[_0x9521('0xb')]);router['get'](_0x9521('0xc'),auth['isAuthenticated'](),controller[_0x9521('0xd')]);router['get'](_0x9521('0xe'),auth['isAuthenticated'](),controller[_0x9521('0xf')]);router['post']('/',auth[_0x9521('0xa')](),controller[_0x9521('0x10')]);router[_0x9521('0x11')](_0x9521('0xe'),auth[_0x9521('0xa')](),controller['update']);router[_0x9521('0x12')](_0x9521('0xe'),auth['isAuthenticated'](),controller[_0x9521('0x13')]);module['exports']=router; \ No newline at end of file +var _0x9fd8=['update','delete','destroy','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailSubstatus.controller','get','isAuthenticated','index','/describe','/:id','show','post','put'];(function(_0x1c1501,_0x14f4a6){var _0x4bebd6=function(_0x3ce79f){while(--_0x3ce79f){_0x1c1501['push'](_0x1c1501['shift']());}};_0x4bebd6(++_0x14f4a6);}(_0x9fd8,0x12f));var _0x89fd=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x9fd8[_0x1facfa];return _0x9ec701;};'use strict';var multer=require('multer');var util=require(_0x89fd('0x0'));var path=require(_0x89fd('0x1'));var timeout=require('connect-timeout');var express=require(_0x89fd('0x2'));var router=express[_0x89fd('0x3')]();var fs_extra=require(_0x89fd('0x4'));var auth=require(_0x89fd('0x5'));var interaction=require(_0x89fd('0x6'));var config=require(_0x89fd('0x7'));var controller=require(_0x89fd('0x8'));router[_0x89fd('0x9')]('/',auth[_0x89fd('0xa')](),controller[_0x89fd('0xb')]);router['get'](_0x89fd('0xc'),auth['isAuthenticated'](),controller['describe']);router[_0x89fd('0x9')](_0x89fd('0xd'),auth['isAuthenticated'](),controller[_0x89fd('0xe')]);router[_0x89fd('0xf')]('/',auth[_0x89fd('0xa')](),controller['create']);router[_0x89fd('0x10')]('/:id',auth['isAuthenticated'](),controller[_0x89fd('0x11')]);router[_0x89fd('0x12')]('/:id',auth[_0x89fd('0xa')](),controller[_0x89fd('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.attributes.js b/server/api/mailSubstatus/mailSubstatus.attributes.js index 0158bd4..7066032 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 _0xa1f6=['name','sequelize','exports','STRING'];(function(_0x1cdb2d,_0x8f1f76){var _0x4dafe3=function(_0xec694e){while(--_0xec694e){_0x1cdb2d['push'](_0x1cdb2d['shift']());}};_0x4dafe3(++_0x8f1f76);}(_0xa1f6,0x19d));var _0x6a1f=function(_0x1486e5,_0x39684f){_0x1486e5=_0x1486e5-0x0;var _0x29d89b=_0xa1f6[_0x1486e5];return _0x29d89b;};'use strict';var Sequelize=require(_0x6a1f('0x0'));module[_0x6a1f('0x1')]={'name':{'type':Sequelize[_0x6a1f('0x2')],'unique':_0x6a1f('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x6a1f('0x2')]}}; \ No newline at end of file +var _0x02a7=['exports','STRING'];(function(_0x59616b,_0x38e534){var _0x5c4523=function(_0x166f2e){while(--_0x166f2e){_0x59616b['push'](_0x59616b['shift']());}};_0x5c4523(++_0x38e534);}(_0x02a7,0x7a));var _0x702a=function(_0x73495b,_0x20b4ca){_0x73495b=_0x73495b-0x0;var _0x49d548=_0x02a7[_0x73495b];return _0x49d548;};'use strict';var Sequelize=require('sequelize');module[_0x702a('0x0')]={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x702a('0x1')]}}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.controller.js b/server/api/mailSubstatus/mailSubstatus.controller.js index 051b402..5659303 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 _0x46d9=['offset','undefined','count','apply','reject','update','then','error','stack','name','send','index','MailSubstatus','rawAttributes','fieldName','type','key','model','map','keys','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','filters','pick','filter','merge','options','includeAll','findAll','catch','params','include','find','create','body','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end'];(function(_0x57b432,_0x1589a0){var _0x2edf2a=function(_0x20edfc){while(--_0x20edfc){_0x57b432['push'](_0x57b432['shift']());}};_0x2edf2a(++_0x1589a0);}(_0x46d9,0xc4));var _0x946d=function(_0x5e9142,_0x29abc0){_0x5e9142=_0x5e9142-0x0;var _0x4763e2=_0x46d9[_0x5e9142];return _0x4763e2;};'use strict';var emlformat=require(_0x946d('0x0'));var rimraf=require(_0x946d('0x1'));var zipdir=require(_0x946d('0x2'));var jsonpatch=require(_0x946d('0x3'));var rp=require(_0x946d('0x4'));var moment=require('moment');var BPromise=require(_0x946d('0x5'));var Mustache=require(_0x946d('0x6'));var util=require(_0x946d('0x7'));var path=require(_0x946d('0x8'));var sox=require(_0x946d('0x9'));var csv=require(_0x946d('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x946d('0xb'));var _=require(_0x946d('0xc'));var squel=require(_0x946d('0xd'));var crypto=require(_0x946d('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x946d('0xf'));var toCsv=require('to-csv');var querystring=require(_0x946d('0x10'));var Papa=require(_0x946d('0x11'));var Redis=require(_0x946d('0x12'));var authService=require(_0x946d('0x13'));var qs=require(_0x946d('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x946d('0x15'))(_0x946d('0x16'));var utils=require(_0x946d('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x946d('0x18'));var db=require(_0x946d('0x19'))['db'];function respondWithStatusCode(_0x4258a0,_0x557b1b){_0x557b1b=_0x557b1b||0xcc;return function(_0x1100cb){if(_0x1100cb){return _0x4258a0[_0x946d('0x1a')](_0x557b1b);}return _0x4258a0[_0x946d('0x1b')](_0x557b1b)[_0x946d('0x1c')]();};}function respondWithResult(_0x361d6d,_0x2e068b){_0x2e068b=_0x2e068b||0xc8;return function(_0x2b5381){if(_0x2b5381){return _0x361d6d['status'](_0x2e068b)['json'](_0x2b5381);}};}function respondWithFilteredResult(_0x236758,_0x40c9d6){return function(_0x1d6dba){if(_0x1d6dba){var _0x4b3f86=typeof _0x40c9d6[_0x946d('0x1d')]==='undefined'&&typeof _0x40c9d6['limit']===_0x946d('0x1e');var _0x5d6392=_0x1d6dba[_0x946d('0x1f')];var _0x12b87a=_0x4b3f86?0x0:_0x40c9d6[_0x946d('0x1d')];var _0x5f4849=_0x4b3f86?_0x1d6dba['count']:_0x40c9d6['offset']+_0x40c9d6['limit'];var _0x57e1dc;if(_0x5f4849>=_0x5d6392){_0x5f4849=_0x5d6392;_0x57e1dc=0xc8;}else{_0x57e1dc=0xce;}_0x236758[_0x946d('0x1b')](_0x57e1dc);return _0x236758['set']('Content-Range',_0x12b87a+'-'+_0x5f4849+'/'+_0x5d6392)['json'](_0x1d6dba);}return null;};}function patchUpdates(_0x228e76){return function(_0x367dc2){try{jsonpatch[_0x946d('0x20')](_0x367dc2,_0x228e76,!![]);}catch(_0xf563ac){return BPromise[_0x946d('0x21')](_0xf563ac);}return _0x367dc2['save']();};}function saveUpdates(_0x49d9ec,_0x4052a7){return function(_0x366ff3){if(_0x366ff3){return _0x366ff3[_0x946d('0x22')](_0x49d9ec)['then'](function(_0x1bc435){return _0x1bc435;});}return null;};}function removeEntity(_0x1c6520,_0x3eec0f){return function(_0x34051f){if(_0x34051f){return _0x34051f['destroy']()[_0x946d('0x23')](function(){_0x1c6520[_0x946d('0x1b')](0xcc)[_0x946d('0x1c')]();});}};}function handleEntityNotFound(_0x216e10,_0x430a9c){return function(_0x465c2d){if(!_0x465c2d){_0x216e10[_0x946d('0x1a')](0x194);}return _0x465c2d;};}function handleError(_0x3ba1b1,_0x19d424){_0x19d424=_0x19d424||0x1f4;return function(_0x5ba5e1){logger[_0x946d('0x24')](_0x5ba5e1[_0x946d('0x25')]);if(_0x5ba5e1[_0x946d('0x26')]){delete _0x5ba5e1[_0x946d('0x26')];}_0x3ba1b1[_0x946d('0x1b')](_0x19d424)[_0x946d('0x27')](_0x5ba5e1);};}exports[_0x946d('0x28')]=function(_0x7cc0,_0x18f2d5){var _0x503ef6={},_0x64ad19={},_0x5a1c0b={'count':0x0,'rows':[]};var _0x18cbf9=_['map'](db[_0x946d('0x29')][_0x946d('0x2a')],function(_0x156736){return{'name':_0x156736[_0x946d('0x2b')],'type':_0x156736[_0x946d('0x2c')][_0x946d('0x2d')]};});_0x64ad19[_0x946d('0x2e')]=_[_0x946d('0x2f')](_0x18cbf9,_0x946d('0x26'));_0x64ad19['query']=_[_0x946d('0x30')](_0x7cc0['query']);_0x64ad19['filters']=_[_0x946d('0x31')](_0x64ad19[_0x946d('0x2e')],_0x64ad19[_0x946d('0x32')]);_0x503ef6[_0x946d('0x33')]=_[_0x946d('0x31')](_0x64ad19['model'],qs[_0x946d('0x34')](_0x7cc0[_0x946d('0x32')]['fields']));_0x503ef6['attributes']=_0x503ef6[_0x946d('0x33')][_0x946d('0x35')]?_0x503ef6[_0x946d('0x33')]:_0x64ad19[_0x946d('0x2e')];if(!_0x7cc0[_0x946d('0x32')][_0x946d('0x36')](_0x946d('0x37'))){_0x503ef6[_0x946d('0x38')]=qs['limit'](_0x7cc0[_0x946d('0x32')]['limit']);_0x503ef6[_0x946d('0x1d')]=qs[_0x946d('0x1d')](_0x7cc0[_0x946d('0x32')][_0x946d('0x1d')]);}_0x503ef6[_0x946d('0x39')]=qs[_0x946d('0x3a')](_0x7cc0[_0x946d('0x32')][_0x946d('0x3a')]);_0x503ef6[_0x946d('0x3b')]=qs[_0x946d('0x3c')](_[_0x946d('0x3d')](_0x7cc0[_0x946d('0x32')],_0x64ad19[_0x946d('0x3c')]),_0x18cbf9);if(_0x7cc0[_0x946d('0x32')][_0x946d('0x3e')]){_0x503ef6[_0x946d('0x3b')]=_[_0x946d('0x3f')](_0x503ef6[_0x946d('0x3b')],{'$or':_[_0x946d('0x2f')](_0x18cbf9,function(_0x2cf1ff){if(_0x2cf1ff[_0x946d('0x2c')]!=='VIRTUAL'){var _0x34eb2c={};_0x34eb2c[_0x2cf1ff['name']]={'$like':'%'+_0x7cc0[_0x946d('0x32')][_0x946d('0x3e')]+'%'};return _0x34eb2c;}})});}_0x503ef6=_[_0x946d('0x3f')]({},_0x503ef6,_0x7cc0[_0x946d('0x40')]);var _0x593083={'where':_0x503ef6[_0x946d('0x3b')]};return db[_0x946d('0x29')]['count'](_0x593083)[_0x946d('0x23')](function(_0x405299){_0x5a1c0b[_0x946d('0x1f')]=_0x405299;if(_0x7cc0[_0x946d('0x32')][_0x946d('0x41')]){_0x503ef6['include']=[{'all':!![]}];}return db[_0x946d('0x29')][_0x946d('0x42')](_0x503ef6);})[_0x946d('0x23')](function(_0x1d4850){_0x5a1c0b['rows']=_0x1d4850;return _0x5a1c0b;})[_0x946d('0x23')](respondWithFilteredResult(_0x18f2d5,_0x503ef6))[_0x946d('0x43')](handleError(_0x18f2d5,null));};exports['show']=function(_0x51bfd3,_0x12de7a){var _0x46f80f={'raw':!![],'where':{'id':_0x51bfd3[_0x946d('0x44')]['id']}},_0x13fe87={};_0x13fe87[_0x946d('0x2e')]=_['keys'](db['MailSubstatus']['rawAttributes']);_0x13fe87[_0x946d('0x32')]=_[_0x946d('0x30')](_0x51bfd3[_0x946d('0x32')]);_0x13fe87[_0x946d('0x3c')]=_[_0x946d('0x31')](_0x13fe87['model'],_0x13fe87['query']);_0x46f80f[_0x946d('0x33')]=_['intersection'](_0x13fe87[_0x946d('0x2e')],qs[_0x946d('0x34')](_0x51bfd3[_0x946d('0x32')][_0x946d('0x34')]));_0x46f80f[_0x946d('0x33')]=_0x46f80f['attributes'][_0x946d('0x35')]?_0x46f80f[_0x946d('0x33')]:_0x13fe87[_0x946d('0x2e')];if(_0x51bfd3[_0x946d('0x32')][_0x946d('0x41')]){_0x46f80f[_0x946d('0x45')]=[{'all':!![]}];}_0x46f80f=_[_0x946d('0x3f')]({},_0x46f80f,_0x51bfd3[_0x946d('0x40')]);return db['MailSubstatus'][_0x946d('0x46')](_0x46f80f)[_0x946d('0x23')](handleEntityNotFound(_0x12de7a,null))[_0x946d('0x23')](respondWithResult(_0x12de7a,null))[_0x946d('0x43')](handleError(_0x12de7a,null));};exports['create']=function(_0x39294f,_0x35f25e){return db['MailSubstatus'][_0x946d('0x47')](_0x39294f['body'],{})[_0x946d('0x23')](respondWithResult(_0x35f25e,0xc9))[_0x946d('0x43')](handleError(_0x35f25e,null));};exports['update']=function(_0x11a63b,_0x462e86){if(_0x11a63b['body']['id']){delete _0x11a63b[_0x946d('0x48')]['id'];}return db[_0x946d('0x29')]['find']({'where':{'id':_0x11a63b[_0x946d('0x44')]['id']}})[_0x946d('0x23')](handleEntityNotFound(_0x462e86,null))[_0x946d('0x23')](saveUpdates(_0x11a63b['body'],null))['then'](respondWithResult(_0x462e86,null))[_0x946d('0x43')](handleError(_0x462e86,null));};exports[_0x946d('0x49')]=function(_0x3be90b,_0x2030f8){return db[_0x946d('0x29')][_0x946d('0x46')]({'where':{'id':_0x3be90b[_0x946d('0x44')]['id']}})[_0x946d('0x23')](handleEntityNotFound(_0x2030f8,null))[_0x946d('0x23')](removeEntity(_0x2030f8,null))[_0x946d('0x43')](handleError(_0x2030f8,null));};exports[_0x946d('0x4a')]=function(_0x94347b,_0x4ca4eb){return db['MailSubstatus'][_0x946d('0x4a')]()[_0x946d('0x23')](respondWithResult(_0x4ca4eb,null))[_0x946d('0x43')](handleError(_0x4ca4eb,null));}; \ No newline at end of file +var _0x7e19=['destroy','error','stack','name','send','index','MailSubstatus','rawAttributes','fieldName','type','key','map','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','findAll','rows','catch','show','options','find','create','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then'];(function(_0x236c67,_0x28b77e){var _0x19e4fb=function(_0x7cffa2){while(--_0x7cffa2){_0x236c67['push'](_0x236c67['shift']());}};_0x19e4fb(++_0x28b77e);}(_0x7e19,0x76));var _0x97e1=function(_0x332bba,_0x5616ba){_0x332bba=_0x332bba-0x0;var _0x40747e=_0x7e19[_0x332bba];return _0x40747e;};'use strict';var emlformat=require(_0x97e1('0x0'));var rimraf=require(_0x97e1('0x1'));var zipdir=require(_0x97e1('0x2'));var jsonpatch=require(_0x97e1('0x3'));var rp=require('request-promise');var moment=require(_0x97e1('0x4'));var BPromise=require(_0x97e1('0x5'));var Mustache=require(_0x97e1('0x6'));var util=require(_0x97e1('0x7'));var path=require(_0x97e1('0x8'));var sox=require(_0x97e1('0x9'));var csv=require(_0x97e1('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x97e1('0xb'));var _=require(_0x97e1('0xc'));var squel=require(_0x97e1('0xd'));var crypto=require(_0x97e1('0xe'));var jsforce=require(_0x97e1('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x97e1('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x97e1('0x10'));var qs=require(_0x97e1('0x11'));var as=require(_0x97e1('0x12'));var hardwareService=require(_0x97e1('0x13'));var logger=require(_0x97e1('0x14'))('api');var utils=require(_0x97e1('0x15'));var config=require(_0x97e1('0x16'));var licenseUtil=require(_0x97e1('0x17'));var db=require(_0x97e1('0x18'))['db'];function respondWithStatusCode(_0x522bdc,_0x5c2f14){_0x5c2f14=_0x5c2f14||0xcc;return function(_0x4f0aa6){if(_0x4f0aa6){return _0x522bdc[_0x97e1('0x19')](_0x5c2f14);}return _0x522bdc[_0x97e1('0x1a')](_0x5c2f14)[_0x97e1('0x1b')]();};}function respondWithResult(_0x1b5f2a,_0x5c13ac){_0x5c13ac=_0x5c13ac||0xc8;return function(_0x41dce6){if(_0x41dce6){return _0x1b5f2a[_0x97e1('0x1a')](_0x5c13ac)[_0x97e1('0x1c')](_0x41dce6);}};}function respondWithFilteredResult(_0x21ad6b,_0x519a4d){return function(_0x3a1dc1){if(_0x3a1dc1){var _0x39edf5=typeof _0x519a4d[_0x97e1('0x1d')]===_0x97e1('0x1e')&&typeof _0x519a4d['limit']===_0x97e1('0x1e');var _0x3c7f24=_0x3a1dc1[_0x97e1('0x1f')];var _0x5344b5=_0x39edf5?0x0:_0x519a4d[_0x97e1('0x1d')];var _0x11e145=_0x39edf5?_0x3a1dc1[_0x97e1('0x1f')]:_0x519a4d['offset']+_0x519a4d[_0x97e1('0x20')];var _0x2b1a7d;if(_0x11e145>=_0x3c7f24){_0x11e145=_0x3c7f24;_0x2b1a7d=0xc8;}else{_0x2b1a7d=0xce;}_0x21ad6b[_0x97e1('0x1a')](_0x2b1a7d);return _0x21ad6b[_0x97e1('0x21')](_0x97e1('0x22'),_0x5344b5+'-'+_0x11e145+'/'+_0x3c7f24)[_0x97e1('0x1c')](_0x3a1dc1);}return null;};}function patchUpdates(_0x15c616){return function(_0x2ac5c2){try{jsonpatch[_0x97e1('0x23')](_0x2ac5c2,_0x15c616,!![]);}catch(_0x2dcdc3){return BPromise[_0x97e1('0x24')](_0x2dcdc3);}return _0x2ac5c2[_0x97e1('0x25')]();};}function saveUpdates(_0x1e4fee,_0x2c247d){return function(_0x555930){if(_0x555930){return _0x555930[_0x97e1('0x26')](_0x1e4fee)[_0x97e1('0x27')](function(_0x16b6d5){return _0x16b6d5;});}return null;};}function removeEntity(_0x2efc08,_0x57f902){return function(_0x4e5944){if(_0x4e5944){return _0x4e5944[_0x97e1('0x28')]()[_0x97e1('0x27')](function(){_0x2efc08[_0x97e1('0x1a')](0xcc)[_0x97e1('0x1b')]();});}};}function handleEntityNotFound(_0x30a5ee,_0x276f3c){return function(_0x3f00f6){if(!_0x3f00f6){_0x30a5ee['sendStatus'](0x194);}return _0x3f00f6;};}function handleError(_0x32124b,_0x2e3e76){_0x2e3e76=_0x2e3e76||0x1f4;return function(_0x752d61){logger[_0x97e1('0x29')](_0x752d61[_0x97e1('0x2a')]);if(_0x752d61[_0x97e1('0x2b')]){delete _0x752d61[_0x97e1('0x2b')];}_0x32124b[_0x97e1('0x1a')](_0x2e3e76)[_0x97e1('0x2c')](_0x752d61);};}exports[_0x97e1('0x2d')]=function(_0x5e14c9,_0x196644){var _0x56c10b={},_0x41fe21={},_0x2f97b8={'count':0x0,'rows':[]};var _0x570aed=_['map'](db[_0x97e1('0x2e')][_0x97e1('0x2f')],function(_0x47798d){return{'name':_0x47798d[_0x97e1('0x30')],'type':_0x47798d[_0x97e1('0x31')][_0x97e1('0x32')]};});_0x41fe21['model']=_[_0x97e1('0x33')](_0x570aed,_0x97e1('0x2b'));_0x41fe21[_0x97e1('0x34')]=_[_0x97e1('0x35')](_0x5e14c9['query']);_0x41fe21[_0x97e1('0x36')]=_[_0x97e1('0x37')](_0x41fe21[_0x97e1('0x38')],_0x41fe21[_0x97e1('0x34')]);_0x56c10b['attributes']=_[_0x97e1('0x37')](_0x41fe21[_0x97e1('0x38')],qs[_0x97e1('0x39')](_0x5e14c9[_0x97e1('0x34')][_0x97e1('0x39')]));_0x56c10b[_0x97e1('0x3a')]=_0x56c10b[_0x97e1('0x3a')][_0x97e1('0x3b')]?_0x56c10b[_0x97e1('0x3a')]:_0x41fe21[_0x97e1('0x38')];if(!_0x5e14c9['query'][_0x97e1('0x3c')](_0x97e1('0x3d'))){_0x56c10b[_0x97e1('0x20')]=qs[_0x97e1('0x20')](_0x5e14c9[_0x97e1('0x34')][_0x97e1('0x20')]);_0x56c10b[_0x97e1('0x1d')]=qs[_0x97e1('0x1d')](_0x5e14c9[_0x97e1('0x34')]['offset']);}_0x56c10b[_0x97e1('0x3e')]=qs['sort'](_0x5e14c9[_0x97e1('0x34')][_0x97e1('0x3f')]);_0x56c10b[_0x97e1('0x40')]=qs[_0x97e1('0x36')](_[_0x97e1('0x41')](_0x5e14c9['query'],_0x41fe21[_0x97e1('0x36')]),_0x570aed);if(_0x5e14c9[_0x97e1('0x34')]['filter']){_0x56c10b['where']=_[_0x97e1('0x42')](_0x56c10b[_0x97e1('0x40')],{'$or':_[_0x97e1('0x33')](_0x570aed,function(_0x5b109b){if(_0x5b109b['type']!==_0x97e1('0x43')){var _0x28c13c={};_0x28c13c[_0x5b109b[_0x97e1('0x2b')]]={'$like':'%'+_0x5e14c9[_0x97e1('0x34')][_0x97e1('0x44')]+'%'};return _0x28c13c;}})});}_0x56c10b=_['merge']({},_0x56c10b,_0x5e14c9['options']);var _0x2870b5={'where':_0x56c10b[_0x97e1('0x40')]};return db['MailSubstatus'][_0x97e1('0x1f')](_0x2870b5)[_0x97e1('0x27')](function(_0x439390){_0x2f97b8['count']=_0x439390;if(_0x5e14c9[_0x97e1('0x34')]['includeAll']){_0x56c10b['include']=[{'all':!![]}];}return db['MailSubstatus'][_0x97e1('0x45')](_0x56c10b);})[_0x97e1('0x27')](function(_0x4f4d19){_0x2f97b8[_0x97e1('0x46')]=_0x4f4d19;return _0x2f97b8;})[_0x97e1('0x27')](respondWithFilteredResult(_0x196644,_0x56c10b))[_0x97e1('0x47')](handleError(_0x196644,null));};exports[_0x97e1('0x48')]=function(_0x1036b3,_0x501bd6){var _0x1b1c8a={'raw':!![],'where':{'id':_0x1036b3['params']['id']}},_0x2ad628={};_0x2ad628[_0x97e1('0x38')]=_[_0x97e1('0x35')](db[_0x97e1('0x2e')][_0x97e1('0x2f')]);_0x2ad628['query']=_['keys'](_0x1036b3[_0x97e1('0x34')]);_0x2ad628[_0x97e1('0x36')]=_[_0x97e1('0x37')](_0x2ad628['model'],_0x2ad628[_0x97e1('0x34')]);_0x1b1c8a[_0x97e1('0x3a')]=_[_0x97e1('0x37')](_0x2ad628[_0x97e1('0x38')],qs[_0x97e1('0x39')](_0x1036b3[_0x97e1('0x34')][_0x97e1('0x39')]));_0x1b1c8a[_0x97e1('0x3a')]=_0x1b1c8a[_0x97e1('0x3a')][_0x97e1('0x3b')]?_0x1b1c8a[_0x97e1('0x3a')]:_0x2ad628[_0x97e1('0x38')];if(_0x1036b3[_0x97e1('0x34')]['includeAll']){_0x1b1c8a['include']=[{'all':!![]}];}_0x1b1c8a=_['merge']({},_0x1b1c8a,_0x1036b3[_0x97e1('0x49')]);return db[_0x97e1('0x2e')][_0x97e1('0x4a')](_0x1b1c8a)[_0x97e1('0x27')](handleEntityNotFound(_0x501bd6,null))[_0x97e1('0x27')](respondWithResult(_0x501bd6,null))[_0x97e1('0x47')](handleError(_0x501bd6,null));};exports[_0x97e1('0x4b')]=function(_0x13ea8b,_0x48715d){return db[_0x97e1('0x2e')][_0x97e1('0x4b')](_0x13ea8b[_0x97e1('0x4c')],{})[_0x97e1('0x27')](respondWithResult(_0x48715d,0xc9))['catch'](handleError(_0x48715d,null));};exports[_0x97e1('0x26')]=function(_0x328ae0,_0x55d043){if(_0x328ae0[_0x97e1('0x4c')]['id']){delete _0x328ae0[_0x97e1('0x4c')]['id'];}return db[_0x97e1('0x2e')]['find']({'where':{'id':_0x328ae0[_0x97e1('0x4d')]['id']}})[_0x97e1('0x27')](handleEntityNotFound(_0x55d043,null))[_0x97e1('0x27')](saveUpdates(_0x328ae0[_0x97e1('0x4c')],null))[_0x97e1('0x27')](respondWithResult(_0x55d043,null))[_0x97e1('0x47')](handleError(_0x55d043,null));};exports['destroy']=function(_0xa725a2,_0x42d864){return db[_0x97e1('0x2e')]['find']({'where':{'id':_0xa725a2[_0x97e1('0x4d')]['id']}})[_0x97e1('0x27')](handleEntityNotFound(_0x42d864,null))[_0x97e1('0x27')](removeEntity(_0x42d864,null))[_0x97e1('0x47')](handleError(_0x42d864,null));};exports[_0x97e1('0x4e')]=function(_0x4041ce,_0x366755){return db[_0x97e1('0x2e')][_0x97e1('0x4e')]()[_0x97e1('0x27')](respondWithResult(_0x366755,null))[_0x97e1('0x47')](handleError(_0x366755,null));}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.events.js b/server/api/mailSubstatus/mailSubstatus.events.js index 785858a..a51e31a 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 _0x71c6=['emit','hasOwnProperty','hook','exports','events','MailSubstatus','setMaxListeners','update'];(function(_0x44a72d,_0x3b4c6c){var _0x515d3c=function(_0x2177a4){while(--_0x2177a4){_0x44a72d['push'](_0x44a72d['shift']());}};_0x515d3c(++_0x3b4c6c);}(_0x71c6,0x14c));var _0x671c=function(_0x289747,_0x2af673){_0x289747=_0x289747-0x0;var _0x106987=_0x71c6[_0x289747];return _0x106987;};'use strict';var EventEmitter=require(_0x671c('0x0'));var MailSubstatus=require('../../mysqldb')['db'][_0x671c('0x1')];var MailSubstatusEvents=new EventEmitter();MailSubstatusEvents[_0x671c('0x2')](0x0);var events={'afterUpdate':_0x671c('0x3')};function emitEvent(_0xb0300c){return function(_0x1f5381,_0xc64b46,_0x2693c7){MailSubstatusEvents['emit'](_0xb0300c+':'+_0x1f5381['id'],_0x1f5381);MailSubstatusEvents[_0x671c('0x4')](_0xb0300c,_0x1f5381);_0x2693c7(null);};}for(var e in events){if(events[_0x671c('0x5')](e)){var event=events[e];MailSubstatus[_0x671c('0x6')](e,emitEvent(event));}}module[_0x671c('0x7')]=MailSubstatusEvents; \ No newline at end of file +var _0x78ae=['MailSubstatus','setMaxListeners','update','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0xd2e6bd,_0x558a85){var _0x50028b=function(_0x2221b1){while(--_0x2221b1){_0xd2e6bd['push'](_0xd2e6bd['shift']());}};_0x50028b(++_0x558a85);}(_0x78ae,0xb2));var _0xe78a=function(_0x5eb180,_0x127912){_0x5eb180=_0x5eb180-0x0;var _0xc5f79c=_0x78ae[_0x5eb180];return _0xc5f79c;};'use strict';var EventEmitter=require(_0xe78a('0x0'));var MailSubstatus=require(_0xe78a('0x1'))['db'][_0xe78a('0x2')];var MailSubstatusEvents=new EventEmitter();MailSubstatusEvents[_0xe78a('0x3')](0x0);var events={'afterUpdate':_0xe78a('0x4')};function emitEvent(_0x2483d4){return function(_0x408f14,_0x5cfa6b,_0x1739f9){MailSubstatusEvents[_0xe78a('0x5')](_0x2483d4+':'+_0x408f14['id'],_0x408f14);MailSubstatusEvents['emit'](_0x2483d4,_0x408f14);_0x1739f9(null);};}for(var e in events){if(events[_0xe78a('0x6')](e)){var event=events[e];MailSubstatus[_0xe78a('0x7')](e,emitEvent(event));}}module[_0xe78a('0x8')]=MailSubstatusEvents; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.model.js b/server/api/mailSubstatus/mailSubstatus.model.js index 41b7d8b..c30bb6e 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 _0xa365=['then','catch','./mailSubstatus.attributes','exports','models','define','MailSubstatus','mail_substatuses','Condition','update','_previousDataValues','name'];(function(_0x10f6e8,_0x351db6){var _0x35bb3c=function(_0x30a39b){while(--_0x30a39b){_0x10f6e8['push'](_0x10f6e8['shift']());}};_0x35bb3c(++_0x351db6);}(_0xa365,0x1d6));var _0x5a36=function(_0xe798c,_0xc970b5){_0xe798c=_0xe798c-0x0;var _0xe121b5=_0xa365[_0xe798c];return _0xe121b5;};'use strict';var attributes=require(_0x5a36('0x0'));module[_0x5a36('0x1')]=function(_0x45882e){var _0x37c368=_0x45882e[_0x5a36('0x2')];return _0x45882e[_0x5a36('0x3')](_0x5a36('0x4'),attributes,{'tableName':_0x5a36('0x5'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterUpdate':function(_0x59a4bd,_0x568c3b,_0x860172){return _0x37c368[_0x5a36('0x6')][_0x5a36('0x7')]({'value':_0x59a4bd['name']},{'where':{'field':'mailSubstatus','value':_0x59a4bd[_0x5a36('0x8')][_0x5a36('0x9')]}})[_0x5a36('0xa')](function(){_0x860172();})[_0x5a36('0xb')](function(_0x3097ee){_0x860172(_0x3097ee);});}}});}; \ No newline at end of file +var _0xdab6=['models','define','MailSubstatus','Condition','update','name','mailSubstatus','then','catch','./mailSubstatus.attributes','exports'];(function(_0x1cd51f,_0x297954){var _0x54208a=function(_0x33fbf7){while(--_0x33fbf7){_0x1cd51f['push'](_0x1cd51f['shift']());}};_0x54208a(++_0x297954);}(_0xdab6,0x153));var _0x6dab=function(_0x338f23,_0x4baf56){_0x338f23=_0x338f23-0x0;var _0x11a457=_0xdab6[_0x338f23];return _0x11a457;};'use strict';var attributes=require(_0x6dab('0x0'));module[_0x6dab('0x1')]=function(_0x15d9ea){var _0x3347ca=_0x15d9ea[_0x6dab('0x2')];return _0x15d9ea[_0x6dab('0x3')](_0x6dab('0x4'),attributes,{'tableName':'mail_substatuses','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterUpdate':function(_0x2de437,_0xac13e5,_0x325eb6){return _0x3347ca[_0x6dab('0x5')][_0x6dab('0x6')]({'value':_0x2de437[_0x6dab('0x7')]},{'where':{'field':_0x6dab('0x8'),'value':_0x2de437['_previousDataValues'][_0x6dab('0x7')]}})[_0x6dab('0x9')](function(){_0x325eb6();})[_0x6dab('0xa')](function(_0x734e8b){_0x325eb6(_0x734e8b);});}}});}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.rpc.js b/server/api/mailSubstatus/mailSubstatus.rpc.js index a02cfce..3ef05c8 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 _0x7816=['jayson/promise','client','http','then','info','MailSubstatus,\x20%s,\x20%s','request\x20sent','MailSubstatus,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0xddc012,_0x5cf07a){var _0x395581=function(_0x483e9d){while(--_0x483e9d){_0xddc012['push'](_0xddc012['shift']());}};_0x395581(++_0x5cf07a);}(_0x7816,0x166));var _0x6781=function(_0x38c74e,_0x1090b3){_0x38c74e=_0x38c74e-0x0;var _0x758e83=_0x7816[_0x38c74e];return _0x758e83;};'use strict';var _=require(_0x6781('0x0'));var util=require(_0x6781('0x1'));var moment=require(_0x6781('0x2'));var BPromise=require(_0x6781('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6781('0x4'));var db=require(_0x6781('0x5'))['db'];var utils=require(_0x6781('0x6'));var logger=require(_0x6781('0x7'))(_0x6781('0x8'));var config=require(_0x6781('0x9'));var jayson=require(_0x6781('0xa'));var client=jayson[_0x6781('0xb')][_0x6781('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x3e11f6,_0x570b,_0x4bf43c){return new BPromise(function(_0x21cc12,_0x1a7593){return client['request'](_0x3e11f6,_0x4bf43c)[_0x6781('0xd')](function(_0x2ed3f5){logger[_0x6781('0xe')](_0x6781('0xf'),_0x570b,_0x6781('0x10'));logger['debug'](_0x6781('0x11'),_0x570b,_0x6781('0x10'),JSON[_0x6781('0x12')](_0x2ed3f5));if(_0x2ed3f5[_0x6781('0x13')]){if(_0x2ed3f5[_0x6781('0x13')]['code']===0x1f4){logger['error'](_0x6781('0xf'),_0x570b,_0x2ed3f5['error'][_0x6781('0x14')]);return _0x1a7593(_0x2ed3f5['error']['message']);}logger[_0x6781('0x13')]('MailSubstatus,\x20%s,\x20%s',_0x570b,_0x2ed3f5[_0x6781('0x13')][_0x6781('0x14')]);return _0x21cc12(_0x2ed3f5[_0x6781('0x13')][_0x6781('0x14')]);}else{logger['info']('MailSubstatus,\x20%s,\x20%s',_0x570b,_0x6781('0x10'));_0x21cc12(_0x2ed3f5[_0x6781('0x15')][_0x6781('0x14')]);}})[_0x6781('0x16')](function(_0x2b4393){logger[_0x6781('0x13')]('MailSubstatus,\x20%s,\x20%s',_0x570b,_0x2b4393);_0x1a7593(_0x2b4393);});});} \ No newline at end of file +var _0xbb33=['error','message','result','lodash','moment','bluebird','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','MailSubstatus,\x20%s,\x20%s','debug','MailSubstatus,\x20%s,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x1d1963,_0x32cc0e){var _0x3f58bb=function(_0x514823){while(--_0x514823){_0x1d1963['push'](_0x1d1963['shift']());}};_0x3f58bb(++_0x32cc0e);}(_0xbb33,0x8f));var _0x3bb3=function(_0x3b4756,_0x3ee9b7){_0x3b4756=_0x3b4756-0x0;var _0x3ce1a5=_0xbb33[_0x3b4756];return _0x3ce1a5;};'use strict';var _=require(_0x3bb3('0x0'));var util=require('util');var moment=require(_0x3bb3('0x1'));var BPromise=require(_0x3bb3('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3bb3('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x3bb3('0x4'))(_0x3bb3('0x5'));var config=require(_0x3bb3('0x6'));var jayson=require(_0x3bb3('0x7'));var client=jayson['client'][_0x3bb3('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1e2923,_0x840d50,_0x195b55){return new BPromise(function(_0x1744f6,_0x4e833d){return client[_0x3bb3('0x9')](_0x1e2923,_0x195b55)[_0x3bb3('0xa')](function(_0x5f0a79){logger[_0x3bb3('0xb')](_0x3bb3('0xc'),_0x840d50,'request\x20sent');logger[_0x3bb3('0xd')](_0x3bb3('0xe'),_0x840d50,_0x3bb3('0xf'),JSON[_0x3bb3('0x10')](_0x5f0a79));if(_0x5f0a79[_0x3bb3('0x11')]){if(_0x5f0a79[_0x3bb3('0x11')]['code']===0x1f4){logger['error'](_0x3bb3('0xc'),_0x840d50,_0x5f0a79[_0x3bb3('0x11')][_0x3bb3('0x12')]);return _0x4e833d(_0x5f0a79[_0x3bb3('0x11')][_0x3bb3('0x12')]);}logger[_0x3bb3('0x11')](_0x3bb3('0xc'),_0x840d50,_0x5f0a79[_0x3bb3('0x11')][_0x3bb3('0x12')]);return _0x1744f6(_0x5f0a79[_0x3bb3('0x11')][_0x3bb3('0x12')]);}else{logger[_0x3bb3('0xb')]('MailSubstatus,\x20%s,\x20%s',_0x840d50,_0x3bb3('0xf'));_0x1744f6(_0x5f0a79[_0x3bb3('0x13')][_0x3bb3('0x12')]);}})['catch'](function(_0x2274cb){logger[_0x3bb3('0x11')](_0x3bb3('0xc'),_0x840d50,_0x2274cb);_0x4e833d(_0x2274cb);});});} \ No newline at end of file diff --git a/server/api/mailTransferReport/index.js b/server/api/mailTransferReport/index.js index ef65df2..7280dc1 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 _0xfaf8=['../../config/environment','./mailTransferReport.controller','get','isAuthenticated','/describe','/:id','show','post','create','put','update','delete','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x3f7177,_0x3c7b79){var _0x5889ff=function(_0x5b0dac){while(--_0x5b0dac){_0x3f7177['push'](_0x3f7177['shift']());}};_0x5889ff(++_0x3c7b79);}(_0xfaf8,0x1ed));var _0x8faf=function(_0x4d3ba9,_0x2c3527){_0x4d3ba9=_0x4d3ba9-0x0;var _0x37bca8=_0xfaf8[_0x4d3ba9];return _0x37bca8;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x8faf('0x0'));var timeout=require(_0x8faf('0x1'));var express=require(_0x8faf('0x2'));var router=express[_0x8faf('0x3')]();var fs_extra=require(_0x8faf('0x4'));var auth=require(_0x8faf('0x5'));var interaction=require(_0x8faf('0x6'));var config=require(_0x8faf('0x7'));var controller=require(_0x8faf('0x8'));router[_0x8faf('0x9')]('/',auth[_0x8faf('0xa')](),controller['index']);router['get'](_0x8faf('0xb'),auth[_0x8faf('0xa')](),controller['describe']);router[_0x8faf('0x9')](_0x8faf('0xc'),auth[_0x8faf('0xa')](),controller[_0x8faf('0xd')]);router[_0x8faf('0xe')]('/',auth[_0x8faf('0xa')](),controller[_0x8faf('0xf')]);router[_0x8faf('0x10')](_0x8faf('0xc'),auth['isAuthenticated'](),controller[_0x8faf('0x11')]);router[_0x8faf('0x12')](_0x8faf('0xc'),auth['isAuthenticated'](),controller['destroy']);module[_0x8faf('0x13')]=router; \ No newline at end of file +var _0xa9c6=['../../components/auth/service','../../components/interaction/service','./mailTransferReport.controller','get','isAuthenticated','/describe','describe','/:id','show','post','create','put','destroy','exports','path','express','Router','fs-extra'];(function(_0x35e647,_0x52c47e){var _0x58c907=function(_0x4b3dad){while(--_0x4b3dad){_0x35e647['push'](_0x35e647['shift']());}};_0x58c907(++_0x52c47e);}(_0xa9c6,0xb0));var _0x6a9c=function(_0x25d98a,_0x5be971){_0x25d98a=_0x25d98a-0x0;var _0x2f4c5b=_0xa9c6[_0x25d98a];return _0x2f4c5b;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x6a9c('0x0'));var timeout=require('connect-timeout');var express=require(_0x6a9c('0x1'));var router=express[_0x6a9c('0x2')]();var fs_extra=require(_0x6a9c('0x3'));var auth=require(_0x6a9c('0x4'));var interaction=require(_0x6a9c('0x5'));var config=require('../../config/environment');var controller=require(_0x6a9c('0x6'));router[_0x6a9c('0x7')]('/',auth[_0x6a9c('0x8')](),controller['index']);router['get'](_0x6a9c('0x9'),auth[_0x6a9c('0x8')](),controller[_0x6a9c('0xa')]);router[_0x6a9c('0x7')](_0x6a9c('0xb'),auth[_0x6a9c('0x8')](),controller[_0x6a9c('0xc')]);router[_0x6a9c('0xd')]('/',auth['isAuthenticated'](),controller[_0x6a9c('0xe')]);router[_0x6a9c('0xf')](_0x6a9c('0xb'),auth[_0x6a9c('0x8')](),controller['update']);router['delete'](_0x6a9c('0xb'),auth[_0x6a9c('0x8')](),controller[_0x6a9c('0x10')]);module[_0x6a9c('0x11')]=router; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.attributes.js b/server/api/mailTransferReport/mailTransferReport.attributes.js index de4f268..4165aec 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 _0xaa88=['account','agent','queue','DATE','NOW','moment','sequelize','exports','STRING'];(function(_0x312602,_0x48b89a){var _0x1d58f9=function(_0x2b857f){while(--_0x2b857f){_0x312602['push'](_0x312602['shift']());}};_0x1d58f9(++_0x48b89a);}(_0xaa88,0x137));var _0x8aa8=function(_0x16d10f,_0x2ba2d5){_0x16d10f=_0x16d10f-0x0;var _0x50c823=_0xaa88[_0x16d10f];return _0x50c823;};'use strict';var moment=require(_0x8aa8('0x0'));var Sequelize=require(_0x8aa8('0x1'));module[_0x8aa8('0x2')]={'uniqueid':{'type':Sequelize[_0x8aa8('0x3')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x8aa8('0x4'),_0x8aa8('0x5'),_0x8aa8('0x6')),'allowNull':![],'defaultValue':_0x8aa8('0x6')},'transferredAt':{'type':Sequelize[_0x8aa8('0x7')],'allowNull':![],'defaultValue':Sequelize[_0x8aa8('0x8')]}}; \ No newline at end of file +var _0x34e8=['queue','DATE','NOW','moment','sequelize','exports','STRING','account','agent'];(function(_0x4664db,_0x1de672){var _0x5615b4=function(_0x54fb5a){while(--_0x54fb5a){_0x4664db['push'](_0x4664db['shift']());}};_0x5615b4(++_0x1de672);}(_0x34e8,0x12c));var _0x834e=function(_0x90e3e3,_0x16ad09){_0x90e3e3=_0x90e3e3-0x0;var _0x53f867=_0x34e8[_0x90e3e3];return _0x53f867;};'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/mailTransferReport/mailTransferReport.controller.js b/server/api/mailTransferReport/mailTransferReport.controller.js index fc58673..db7fa43 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 _0xe6da=['update','destroy','then','name','send','map','fieldName','key','model','query','keys','filters','intersection','attributes','hasOwnProperty','nolimit','order','sort','filter','merge','type','VIRTUAL','options','includeAll','MailTransferReport','findAll','catch','show','fields','include','find','create','body','params','rimraf','request-promise','util','path','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','limit','undefined','count','apply','reject','save'];(function(_0xf2076b,_0x3b7d60){var _0x3c24a8=function(_0x275685){while(--_0x275685){_0xf2076b['push'](_0xf2076b['shift']());}};_0x3c24a8(++_0x3b7d60);}(_0xe6da,0x19c));var _0xae6d=function(_0x2db5cc,_0x18623b){_0x2db5cc=_0x2db5cc-0x0;var _0xde0b21=_0xe6da[_0x2db5cc];return _0xde0b21;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xae6d('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xae6d('0x1'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xae6d('0x2'));var path=require(_0xae6d('0x3'));var sox=require('sox');var csv=require(_0xae6d('0x4'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xae6d('0x5'));var _=require('lodash');var squel=require(_0xae6d('0x6'));var crypto=require(_0xae6d('0x7'));var jsforce=require(_0xae6d('0x8'));var deskjs=require(_0xae6d('0x9'));var toCsv=require(_0xae6d('0x4'));var querystring=require(_0xae6d('0xa'));var Papa=require(_0xae6d('0xb'));var Redis=require('ioredis');var authService=require(_0xae6d('0xc'));var qs=require('../../components/parsers/qs');var as=require(_0xae6d('0xd'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xae6d('0xe'))(_0xae6d('0xf'));var utils=require('../../config/utils');var config=require(_0xae6d('0x10'));var licenseUtil=require(_0xae6d('0x11'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x17e5ce,_0x2fd3dc){_0x2fd3dc=_0x2fd3dc||0xcc;return function(_0x1ca1dc){if(_0x1ca1dc){return _0x17e5ce[_0xae6d('0x12')](_0x2fd3dc);}return _0x17e5ce[_0xae6d('0x13')](_0x2fd3dc)[_0xae6d('0x14')]();};}function respondWithResult(_0x2d9be4,_0x5077fb){_0x5077fb=_0x5077fb||0xc8;return function(_0x40e923){if(_0x40e923){return _0x2d9be4['status'](_0x5077fb)[_0xae6d('0x15')](_0x40e923);}};}function respondWithFilteredResult(_0x44a3d7,_0xc6b301){return function(_0x281d39){if(_0x281d39){var _0x128417=typeof _0xc6b301[_0xae6d('0x16')]==='undefined'&&typeof _0xc6b301[_0xae6d('0x17')]===_0xae6d('0x18');var _0x2704ca=_0x281d39['count'];var _0x1579c2=_0x128417?0x0:_0xc6b301['offset'];var _0x440fd6=_0x128417?_0x281d39[_0xae6d('0x19')]:_0xc6b301[_0xae6d('0x16')]+_0xc6b301['limit'];var _0x9bde08;if(_0x440fd6>=_0x2704ca){_0x440fd6=_0x2704ca;_0x9bde08=0xc8;}else{_0x9bde08=0xce;}_0x44a3d7[_0xae6d('0x13')](_0x9bde08);return _0x44a3d7['set']('Content-Range',_0x1579c2+'-'+_0x440fd6+'/'+_0x2704ca)[_0xae6d('0x15')](_0x281d39);}return null;};}function patchUpdates(_0x4cdfd8){return function(_0x5ea660){try{jsonpatch[_0xae6d('0x1a')](_0x5ea660,_0x4cdfd8,!![]);}catch(_0xc4f552){return BPromise[_0xae6d('0x1b')](_0xc4f552);}return _0x5ea660[_0xae6d('0x1c')]();};}function saveUpdates(_0x509191,_0x483b96){return function(_0x3d5b13){if(_0x3d5b13){return _0x3d5b13[_0xae6d('0x1d')](_0x509191)['then'](function(_0x1d5cda){return _0x1d5cda;});}return null;};}function removeEntity(_0x37bbe3,_0x520328){return function(_0x578463){if(_0x578463){return _0x578463[_0xae6d('0x1e')]()[_0xae6d('0x1f')](function(){_0x37bbe3[_0xae6d('0x13')](0xcc)[_0xae6d('0x14')]();});}};}function handleEntityNotFound(_0x394d06,_0x1f0847){return function(_0x3a8579){if(!_0x3a8579){_0x394d06[_0xae6d('0x12')](0x194);}return _0x3a8579;};}function handleError(_0x8b2501,_0x24d0ab){_0x24d0ab=_0x24d0ab||0x1f4;return function(_0x51dbe9){logger['error'](_0x51dbe9['stack']);if(_0x51dbe9['name']){delete _0x51dbe9[_0xae6d('0x20')];}_0x8b2501[_0xae6d('0x13')](_0x24d0ab)[_0xae6d('0x21')](_0x51dbe9);};}exports['index']=function(_0x19058c,_0x2d0dbe){var _0x1b3ea2={},_0x1d4dec={},_0x410e4f={'count':0x0,'rows':[]};var _0x3bb625=_[_0xae6d('0x22')](db['MailTransferReport']['rawAttributes'],function(_0x5c1927){return{'name':_0x5c1927[_0xae6d('0x23')],'type':_0x5c1927['type'][_0xae6d('0x24')]};});_0x1d4dec[_0xae6d('0x25')]=_[_0xae6d('0x22')](_0x3bb625,_0xae6d('0x20'));_0x1d4dec[_0xae6d('0x26')]=_[_0xae6d('0x27')](_0x19058c[_0xae6d('0x26')]);_0x1d4dec[_0xae6d('0x28')]=_[_0xae6d('0x29')](_0x1d4dec[_0xae6d('0x25')],_0x1d4dec[_0xae6d('0x26')]);_0x1b3ea2[_0xae6d('0x2a')]=_[_0xae6d('0x29')](_0x1d4dec[_0xae6d('0x25')],qs['fields'](_0x19058c['query']['fields']));_0x1b3ea2[_0xae6d('0x2a')]=_0x1b3ea2[_0xae6d('0x2a')]['length']?_0x1b3ea2[_0xae6d('0x2a')]:_0x1d4dec[_0xae6d('0x25')];if(!_0x19058c[_0xae6d('0x26')][_0xae6d('0x2b')](_0xae6d('0x2c'))){_0x1b3ea2['limit']=qs[_0xae6d('0x17')](_0x19058c[_0xae6d('0x26')]['limit']);_0x1b3ea2[_0xae6d('0x16')]=qs['offset'](_0x19058c[_0xae6d('0x26')][_0xae6d('0x16')]);}_0x1b3ea2[_0xae6d('0x2d')]=qs['sort'](_0x19058c['query'][_0xae6d('0x2e')]);_0x1b3ea2['where']=qs[_0xae6d('0x28')](_['pick'](_0x19058c['query'],_0x1d4dec[_0xae6d('0x28')]),_0x3bb625);if(_0x19058c['query'][_0xae6d('0x2f')]){_0x1b3ea2['where']=_[_0xae6d('0x30')](_0x1b3ea2['where'],{'$or':_['map'](_0x3bb625,function(_0x2f450e){if(_0x2f450e[_0xae6d('0x31')]!==_0xae6d('0x32')){var _0x5dfa51={};_0x5dfa51[_0x2f450e[_0xae6d('0x20')]]={'$like':'%'+_0x19058c['query'][_0xae6d('0x2f')]+'%'};return _0x5dfa51;}})});}_0x1b3ea2=_[_0xae6d('0x30')]({},_0x1b3ea2,_0x19058c[_0xae6d('0x33')]);var _0x5866a6={'where':_0x1b3ea2['where']};return db['MailTransferReport'][_0xae6d('0x19')](_0x5866a6)[_0xae6d('0x1f')](function(_0x54ebee){_0x410e4f[_0xae6d('0x19')]=_0x54ebee;if(_0x19058c['query'][_0xae6d('0x34')]){_0x1b3ea2['include']=[{'all':!![]}];}return db[_0xae6d('0x35')][_0xae6d('0x36')](_0x1b3ea2);})[_0xae6d('0x1f')](function(_0x5a2bad){_0x410e4f['rows']=_0x5a2bad;return _0x410e4f;})[_0xae6d('0x1f')](respondWithFilteredResult(_0x2d0dbe,_0x1b3ea2))[_0xae6d('0x37')](handleError(_0x2d0dbe,null));};exports[_0xae6d('0x38')]=function(_0x1fa1b2,_0x992df){var _0x44fdf9={'raw':!![],'where':{'id':_0x1fa1b2['params']['id']}},_0x482ece={};_0x482ece[_0xae6d('0x25')]=_['keys'](db[_0xae6d('0x35')]['rawAttributes']);_0x482ece[_0xae6d('0x26')]=_[_0xae6d('0x27')](_0x1fa1b2[_0xae6d('0x26')]);_0x482ece[_0xae6d('0x28')]=_['intersection'](_0x482ece[_0xae6d('0x25')],_0x482ece[_0xae6d('0x26')]);_0x44fdf9[_0xae6d('0x2a')]=_[_0xae6d('0x29')](_0x482ece[_0xae6d('0x25')],qs[_0xae6d('0x39')](_0x1fa1b2[_0xae6d('0x26')][_0xae6d('0x39')]));_0x44fdf9[_0xae6d('0x2a')]=_0x44fdf9[_0xae6d('0x2a')]['length']?_0x44fdf9['attributes']:_0x482ece[_0xae6d('0x25')];if(_0x1fa1b2[_0xae6d('0x26')][_0xae6d('0x34')]){_0x44fdf9[_0xae6d('0x3a')]=[{'all':!![]}];}_0x44fdf9=_[_0xae6d('0x30')]({},_0x44fdf9,_0x1fa1b2[_0xae6d('0x33')]);return db[_0xae6d('0x35')][_0xae6d('0x3b')](_0x44fdf9)[_0xae6d('0x1f')](handleEntityNotFound(_0x992df,null))[_0xae6d('0x1f')](respondWithResult(_0x992df,null))[_0xae6d('0x37')](handleError(_0x992df,null));};exports['create']=function(_0x4f94f4,_0x4de859){return db[_0xae6d('0x35')][_0xae6d('0x3c')](_0x4f94f4[_0xae6d('0x3d')],{})['then'](respondWithResult(_0x4de859,0xc9))['catch'](handleError(_0x4de859,null));};exports[_0xae6d('0x1d')]=function(_0x23191c,_0x2dec2d){if(_0x23191c[_0xae6d('0x3d')]['id']){delete _0x23191c[_0xae6d('0x3d')]['id'];}return db['MailTransferReport'][_0xae6d('0x3b')]({'where':{'id':_0x23191c[_0xae6d('0x3e')]['id']}})[_0xae6d('0x1f')](handleEntityNotFound(_0x2dec2d,null))[_0xae6d('0x1f')](saveUpdates(_0x23191c[_0xae6d('0x3d')],null))[_0xae6d('0x1f')](respondWithResult(_0x2dec2d,null))[_0xae6d('0x37')](handleError(_0x2dec2d,null));};exports[_0xae6d('0x1e')]=function(_0x1f4032,_0x4d3714){return db[_0xae6d('0x35')][_0xae6d('0x3b')]({'where':{'id':_0x1f4032['params']['id']}})[_0xae6d('0x1f')](handleEntityNotFound(_0x4d3714,null))[_0xae6d('0x1f')](removeEntity(_0x4d3714,null))[_0xae6d('0x37')](handleError(_0x4d3714,null));};exports['describe']=function(_0x5aad3b,_0x536f9f){return db[_0xae6d('0x35')]['describe']()['then'](respondWithResult(_0x536f9f,null))[_0xae6d('0x37')](handleError(_0x536f9f,null));}; \ No newline at end of file +var _0x64fe=['rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','index','map','MailTransferReport','rawAttributes','fieldName','key','keys','query','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','find','create','body','params','describe','eml-format'];(function(_0x55ffc6,_0x2cfe0b){var _0x5e7fa5=function(_0x52c64c){while(--_0x52c64c){_0x55ffc6['push'](_0x55ffc6['shift']());}};_0x5e7fa5(++_0x2cfe0b);}(_0x64fe,0xf8));var _0xe64f=function(_0x31cb5f,_0x2df766){_0x31cb5f=_0x31cb5f-0x0;var _0x586042=_0x64fe[_0x31cb5f];return _0x586042;};'use strict';var emlformat=require(_0xe64f('0x0'));var rimraf=require(_0xe64f('0x1'));var zipdir=require(_0xe64f('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe64f('0x3'));var moment=require(_0xe64f('0x4'));var BPromise=require(_0xe64f('0x5'));var Mustache=require(_0xe64f('0x6'));var util=require(_0xe64f('0x7'));var path=require(_0xe64f('0x8'));var sox=require(_0xe64f('0x9'));var csv=require(_0xe64f('0xa'));var ejs=require(_0xe64f('0xb'));var fs=require('fs');var fs_extra=require(_0xe64f('0xc'));var _=require(_0xe64f('0xd'));var squel=require(_0xe64f('0xe'));var crypto=require(_0xe64f('0xf'));var jsforce=require(_0xe64f('0x10'));var deskjs=require(_0xe64f('0x11'));var toCsv=require(_0xe64f('0xa'));var querystring=require(_0xe64f('0x12'));var Papa=require(_0xe64f('0x13'));var Redis=require('ioredis');var authService=require(_0xe64f('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0xe64f('0x15'));var hardwareService=require(_0xe64f('0x16'));var logger=require('../../config/logger')(_0xe64f('0x17'));var utils=require(_0xe64f('0x18'));var config=require(_0xe64f('0x19'));var licenseUtil=require(_0xe64f('0x1a'));var db=require(_0xe64f('0x1b'))['db'];function respondWithStatusCode(_0x5e0d55,_0x155981){_0x155981=_0x155981||0xcc;return function(_0xcd38cc){if(_0xcd38cc){return _0x5e0d55[_0xe64f('0x1c')](_0x155981);}return _0x5e0d55[_0xe64f('0x1d')](_0x155981)[_0xe64f('0x1e')]();};}function respondWithResult(_0x5f226b,_0xfa2a0e){_0xfa2a0e=_0xfa2a0e||0xc8;return function(_0x2c9280){if(_0x2c9280){return _0x5f226b[_0xe64f('0x1d')](_0xfa2a0e)[_0xe64f('0x1f')](_0x2c9280);}};}function respondWithFilteredResult(_0x3f7cd5,_0xb84eef){return function(_0x4f2e4a){if(_0x4f2e4a){var _0x31f11c=typeof _0xb84eef[_0xe64f('0x20')]===_0xe64f('0x21')&&typeof _0xb84eef['limit']===_0xe64f('0x21');var _0xc51a17=_0x4f2e4a[_0xe64f('0x22')];var _0x14ca0d=_0x31f11c?0x0:_0xb84eef[_0xe64f('0x20')];var _0x4d1e45=_0x31f11c?_0x4f2e4a[_0xe64f('0x22')]:_0xb84eef['offset']+_0xb84eef[_0xe64f('0x23')];var _0x22460a;if(_0x4d1e45>=_0xc51a17){_0x4d1e45=_0xc51a17;_0x22460a=0xc8;}else{_0x22460a=0xce;}_0x3f7cd5[_0xe64f('0x1d')](_0x22460a);return _0x3f7cd5[_0xe64f('0x24')](_0xe64f('0x25'),_0x14ca0d+'-'+_0x4d1e45+'/'+_0xc51a17)[_0xe64f('0x1f')](_0x4f2e4a);}return null;};}function patchUpdates(_0x226aa0){return function(_0xaed612){try{jsonpatch[_0xe64f('0x26')](_0xaed612,_0x226aa0,!![]);}catch(_0x5b55f2){return BPromise[_0xe64f('0x27')](_0x5b55f2);}return _0xaed612[_0xe64f('0x28')]();};}function saveUpdates(_0x1f3543,_0xe2a1ee){return function(_0x2e2fb6){if(_0x2e2fb6){return _0x2e2fb6[_0xe64f('0x29')](_0x1f3543)[_0xe64f('0x2a')](function(_0xe9f824){return _0xe9f824;});}return null;};}function removeEntity(_0x14401b,_0x31131f){return function(_0x30818a){if(_0x30818a){return _0x30818a[_0xe64f('0x2b')]()[_0xe64f('0x2a')](function(){_0x14401b[_0xe64f('0x1d')](0xcc)[_0xe64f('0x1e')]();});}};}function handleEntityNotFound(_0x29c217,_0x5ac4f9){return function(_0x53f32c){if(!_0x53f32c){_0x29c217[_0xe64f('0x1c')](0x194);}return _0x53f32c;};}function handleError(_0x333bf8,_0x6b0c1f){_0x6b0c1f=_0x6b0c1f||0x1f4;return function(_0x351a60){logger['error'](_0x351a60[_0xe64f('0x2c')]);if(_0x351a60[_0xe64f('0x2d')]){delete _0x351a60[_0xe64f('0x2d')];}_0x333bf8[_0xe64f('0x1d')](_0x6b0c1f)[_0xe64f('0x2e')](_0x351a60);};}exports[_0xe64f('0x2f')]=function(_0x4f50fb,_0x2d8704){var _0x2dff5c={},_0x19dc64={},_0x4c8677={'count':0x0,'rows':[]};var _0x3844c8=_[_0xe64f('0x30')](db[_0xe64f('0x31')][_0xe64f('0x32')],function(_0x19ebbb){return{'name':_0x19ebbb[_0xe64f('0x33')],'type':_0x19ebbb['type'][_0xe64f('0x34')]};});_0x19dc64['model']=_[_0xe64f('0x30')](_0x3844c8,_0xe64f('0x2d'));_0x19dc64['query']=_[_0xe64f('0x35')](_0x4f50fb[_0xe64f('0x36')]);_0x19dc64[_0xe64f('0x37')]=_['intersection'](_0x19dc64[_0xe64f('0x38')],_0x19dc64[_0xe64f('0x36')]);_0x2dff5c[_0xe64f('0x39')]=_[_0xe64f('0x3a')](_0x19dc64[_0xe64f('0x38')],qs[_0xe64f('0x3b')](_0x4f50fb[_0xe64f('0x36')]['fields']));_0x2dff5c[_0xe64f('0x39')]=_0x2dff5c[_0xe64f('0x39')][_0xe64f('0x3c')]?_0x2dff5c['attributes']:_0x19dc64[_0xe64f('0x38')];if(!_0x4f50fb[_0xe64f('0x36')][_0xe64f('0x3d')](_0xe64f('0x3e'))){_0x2dff5c[_0xe64f('0x23')]=qs[_0xe64f('0x23')](_0x4f50fb[_0xe64f('0x36')][_0xe64f('0x23')]);_0x2dff5c[_0xe64f('0x20')]=qs['offset'](_0x4f50fb[_0xe64f('0x36')][_0xe64f('0x20')]);}_0x2dff5c[_0xe64f('0x3f')]=qs[_0xe64f('0x40')](_0x4f50fb[_0xe64f('0x36')][_0xe64f('0x40')]);_0x2dff5c[_0xe64f('0x41')]=qs[_0xe64f('0x37')](_[_0xe64f('0x42')](_0x4f50fb[_0xe64f('0x36')],_0x19dc64['filters']),_0x3844c8);if(_0x4f50fb[_0xe64f('0x36')][_0xe64f('0x43')]){_0x2dff5c['where']=_[_0xe64f('0x44')](_0x2dff5c[_0xe64f('0x41')],{'$or':_['map'](_0x3844c8,function(_0x2ef6d5){if(_0x2ef6d5[_0xe64f('0x45')]!==_0xe64f('0x46')){var _0x38ea78={};_0x38ea78[_0x2ef6d5[_0xe64f('0x2d')]]={'$like':'%'+_0x4f50fb[_0xe64f('0x36')][_0xe64f('0x43')]+'%'};return _0x38ea78;}})});}_0x2dff5c=_[_0xe64f('0x44')]({},_0x2dff5c,_0x4f50fb[_0xe64f('0x47')]);var _0xf679ee={'where':_0x2dff5c['where']};return db[_0xe64f('0x31')][_0xe64f('0x22')](_0xf679ee)['then'](function(_0x198c76){_0x4c8677[_0xe64f('0x22')]=_0x198c76;if(_0x4f50fb[_0xe64f('0x36')][_0xe64f('0x48')]){_0x2dff5c[_0xe64f('0x49')]=[{'all':!![]}];}return db['MailTransferReport'][_0xe64f('0x4a')](_0x2dff5c);})[_0xe64f('0x2a')](function(_0x2e8d73){_0x4c8677[_0xe64f('0x4b')]=_0x2e8d73;return _0x4c8677;})['then'](respondWithFilteredResult(_0x2d8704,_0x2dff5c))[_0xe64f('0x4c')](handleError(_0x2d8704,null));};exports[_0xe64f('0x4d')]=function(_0x47d981,_0x9324d3){var _0x54eb57={'raw':!![],'where':{'id':_0x47d981['params']['id']}},_0x215fc2={};_0x215fc2[_0xe64f('0x38')]=_[_0xe64f('0x35')](db[_0xe64f('0x31')][_0xe64f('0x32')]);_0x215fc2[_0xe64f('0x36')]=_[_0xe64f('0x35')](_0x47d981[_0xe64f('0x36')]);_0x215fc2['filters']=_[_0xe64f('0x3a')](_0x215fc2[_0xe64f('0x38')],_0x215fc2['query']);_0x54eb57[_0xe64f('0x39')]=_[_0xe64f('0x3a')](_0x215fc2[_0xe64f('0x38')],qs[_0xe64f('0x3b')](_0x47d981[_0xe64f('0x36')][_0xe64f('0x3b')]));_0x54eb57[_0xe64f('0x39')]=_0x54eb57[_0xe64f('0x39')][_0xe64f('0x3c')]?_0x54eb57[_0xe64f('0x39')]:_0x215fc2[_0xe64f('0x38')];if(_0x47d981[_0xe64f('0x36')][_0xe64f('0x48')]){_0x54eb57[_0xe64f('0x49')]=[{'all':!![]}];}_0x54eb57=_[_0xe64f('0x44')]({},_0x54eb57,_0x47d981['options']);return db[_0xe64f('0x31')][_0xe64f('0x4e')](_0x54eb57)[_0xe64f('0x2a')](handleEntityNotFound(_0x9324d3,null))[_0xe64f('0x2a')](respondWithResult(_0x9324d3,null))[_0xe64f('0x4c')](handleError(_0x9324d3,null));};exports['create']=function(_0xcd9ed9,_0x582f7e){return db[_0xe64f('0x31')][_0xe64f('0x4f')](_0xcd9ed9['body'],{})[_0xe64f('0x2a')](respondWithResult(_0x582f7e,0xc9))['catch'](handleError(_0x582f7e,null));};exports[_0xe64f('0x29')]=function(_0xf28f1a,_0x3b2907){if(_0xf28f1a[_0xe64f('0x50')]['id']){delete _0xf28f1a[_0xe64f('0x50')]['id'];}return db[_0xe64f('0x31')]['find']({'where':{'id':_0xf28f1a[_0xe64f('0x51')]['id']}})[_0xe64f('0x2a')](handleEntityNotFound(_0x3b2907,null))[_0xe64f('0x2a')](saveUpdates(_0xf28f1a[_0xe64f('0x50')],null))[_0xe64f('0x2a')](respondWithResult(_0x3b2907,null))[_0xe64f('0x4c')](handleError(_0x3b2907,null));};exports[_0xe64f('0x2b')]=function(_0x3b41bf,_0x38ffd6){return db[_0xe64f('0x31')][_0xe64f('0x4e')]({'where':{'id':_0x3b41bf['params']['id']}})[_0xe64f('0x2a')](handleEntityNotFound(_0x38ffd6,null))[_0xe64f('0x2a')](removeEntity(_0x38ffd6,null))[_0xe64f('0x4c')](handleError(_0x38ffd6,null));};exports[_0xe64f('0x52')]=function(_0x15a793,_0x36e729){return db['MailTransferReport'][_0xe64f('0x52')]()[_0xe64f('0x2a')](respondWithResult(_0x36e729,null))[_0xe64f('0x4c')](handleError(_0x36e729,null));}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.model.js b/server/api/mailTransferReport/mailTransferReport.model.js index ab6b76c..4aa87b7 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 _0x0763=['exports','define','MailTransferReport','report_mail_transfer','uniqueid','lodash','../../config/logger','api','bluebird','request-promise','path','rimraf','./mailTransferReport.attributes'];(function(_0x24534a,_0x3638a8){var _0x58d2b5=function(_0x447ae0){while(--_0x447ae0){_0x24534a['push'](_0x24534a['shift']());}};_0x58d2b5(++_0x3638a8);}(_0x0763,0x87));var _0x3076=function(_0x28b4cd,_0x573ff1){_0x28b4cd=_0x28b4cd-0x0;var _0x4229cc=_0x0763[_0x28b4cd];return _0x4229cc;};'use strict';var _=require(_0x3076('0x0'));var util=require('util');var logger=require(_0x3076('0x1'))(_0x3076('0x2'));var moment=require('moment');var BPromise=require(_0x3076('0x3'));var rp=require(_0x3076('0x4'));var fs=require('fs');var path=require(_0x3076('0x5'));var rimraf=require(_0x3076('0x6'));var config=require('../../config/environment');var attributes=require(_0x3076('0x7'));module[_0x3076('0x8')]=function(_0x1ce2ff,_0x1b5f4e){return _0x1ce2ff[_0x3076('0x9')](_0x3076('0xa'),attributes,{'tableName':_0x3076('0xb'),'paranoid':![],'indexes':[{'name':_0x3076('0xc'),'fields':[_0x3076('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x2e3d=['api','moment','bluebird','request-promise','path','rimraf','./mailTransferReport.attributes','exports','MailTransferReport','uniqueid','lodash','util','../../config/logger'];(function(_0x495569,_0x5e6eab){var _0x46286b=function(_0x33a218){while(--_0x33a218){_0x495569['push'](_0x495569['shift']());}};_0x46286b(++_0x5e6eab);}(_0x2e3d,0x8c));var _0xd2e3=function(_0x1f15d0,_0x5979f4){_0x1f15d0=_0x1f15d0-0x0;var _0x9200ae=_0x2e3d[_0x1f15d0];return _0x9200ae;};'use strict';var _=require(_0xd2e3('0x0'));var util=require(_0xd2e3('0x1'));var logger=require(_0xd2e3('0x2'))(_0xd2e3('0x3'));var moment=require(_0xd2e3('0x4'));var BPromise=require(_0xd2e3('0x5'));var rp=require(_0xd2e3('0x6'));var fs=require('fs');var path=require(_0xd2e3('0x7'));var rimraf=require(_0xd2e3('0x8'));var config=require('../../config/environment');var attributes=require(_0xd2e3('0x9'));module[_0xd2e3('0xa')]=function(_0x2ea6e2,_0x3da0e9){return _0x2ea6e2['define'](_0xd2e3('0xb'),attributes,{'tableName':'report_mail_transfer','paranoid':![],'indexes':[{'name':_0xd2e3('0xc'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.rpc.js b/server/api/mailTransferReport/mailTransferReport.rpc.js index 372912d..857b8f7 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 _0x1c55=['jayson/promise','client','http','request','then','MailTransferReport,\x20%s,\x20%s','request\x20sent','debug','MailTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment'];(function(_0x521930,_0x2db99){var _0x340de4=function(_0x4fe715){while(--_0x4fe715){_0x521930['push'](_0x521930['shift']());}};_0x340de4(++_0x2db99);}(_0x1c55,0x15f));var _0x51c5=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x1c55[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x51c5('0x0'));var util=require(_0x51c5('0x1'));var moment=require(_0x51c5('0x2'));var BPromise=require(_0x51c5('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x51c5('0x4'));var db=require(_0x51c5('0x5'))['db'];var utils=require(_0x51c5('0x6'));var logger=require(_0x51c5('0x7'))('rpc');var config=require(_0x51c5('0x8'));var jayson=require(_0x51c5('0x9'));var client=jayson[_0x51c5('0xa')][_0x51c5('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x54316e,_0x144c9a,_0x2f398a){return new BPromise(function(_0x325142,_0x525ccd){return client[_0x51c5('0xc')](_0x54316e,_0x2f398a)[_0x51c5('0xd')](function(_0x541310){logger['info'](_0x51c5('0xe'),_0x144c9a,_0x51c5('0xf'));logger[_0x51c5('0x10')](_0x51c5('0x11'),_0x144c9a,_0x51c5('0xf'),JSON[_0x51c5('0x12')](_0x541310));if(_0x541310['error']){if(_0x541310[_0x51c5('0x13')][_0x51c5('0x14')]===0x1f4){logger[_0x51c5('0x13')](_0x51c5('0xe'),_0x144c9a,_0x541310['error']['message']);return _0x525ccd(_0x541310[_0x51c5('0x13')][_0x51c5('0x15')]);}logger[_0x51c5('0x13')]('MailTransferReport,\x20%s,\x20%s',_0x144c9a,_0x541310['error'][_0x51c5('0x15')]);return _0x325142(_0x541310[_0x51c5('0x13')][_0x51c5('0x15')]);}else{logger[_0x51c5('0x16')](_0x51c5('0xe'),_0x144c9a,'request\x20sent');_0x325142(_0x541310[_0x51c5('0x17')][_0x51c5('0x15')]);}})['catch'](function(_0x24a953){logger[_0x51c5('0x13')](_0x51c5('0xe'),_0x144c9a,_0x24a953);_0x525ccd(_0x24a953);});});} \ No newline at end of file +var _0xbd2a=['randomstring','ioredis','../../config/utils','rpc','then','request\x20sent','debug','stringify','error','code','MailTransferReport,\x20%s,\x20%s','message','info','result','lodash','util','moment','bluebird'];(function(_0xd4cee4,_0x587f80){var _0x3bc2e4=function(_0x36676c){while(--_0x36676c){_0xd4cee4['push'](_0xd4cee4['shift']());}};_0x3bc2e4(++_0x587f80);}(_0xbd2a,0x1ac));var _0xabd2=function(_0xcaee61,_0x185703){_0xcaee61=_0xcaee61-0x0;var _0x3bf0d8=_0xbd2a[_0xcaee61];return _0x3bf0d8;};'use strict';var _=require(_0xabd2('0x0'));var util=require(_0xabd2('0x1'));var moment=require(_0xabd2('0x2'));var BPromise=require(_0xabd2('0x3'));var rs=require(_0xabd2('0x4'));var fs=require('fs');var Redis=require(_0xabd2('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xabd2('0x6'));var logger=require('../../config/logger')(_0xabd2('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x15adec,_0x22ff1e,_0x4a4801){return new BPromise(function(_0x417340,_0x2f6b65){return client['request'](_0x15adec,_0x4a4801)[_0xabd2('0x8')](function(_0x3ea576){logger['info']('MailTransferReport,\x20%s,\x20%s',_0x22ff1e,_0xabd2('0x9'));logger[_0xabd2('0xa')]('MailTransferReport,\x20%s,\x20%s,\x20%s',_0x22ff1e,_0xabd2('0x9'),JSON[_0xabd2('0xb')](_0x3ea576));if(_0x3ea576['error']){if(_0x3ea576[_0xabd2('0xc')][_0xabd2('0xd')]===0x1f4){logger['error'](_0xabd2('0xe'),_0x22ff1e,_0x3ea576[_0xabd2('0xc')][_0xabd2('0xf')]);return _0x2f6b65(_0x3ea576[_0xabd2('0xc')]['message']);}logger[_0xabd2('0xc')](_0xabd2('0xe'),_0x22ff1e,_0x3ea576[_0xabd2('0xc')]['message']);return _0x417340(_0x3ea576['error'][_0xabd2('0xf')]);}else{logger[_0xabd2('0x10')](_0xabd2('0xe'),_0x22ff1e,_0xabd2('0x9'));_0x417340(_0x3ea576[_0xabd2('0x11')][_0xabd2('0xf')]);}})['catch'](function(_0x4053f5){logger[_0xabd2('0xc')](_0xabd2('0xe'),_0x22ff1e,_0x4053f5);_0x2f6b65(_0x4053f5);});});} \ No newline at end of file diff --git a/server/api/memberReport/index.js b/server/api/memberReport/index.js index a70d71b..552e594 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 _0x15ec=['path','connect-timeout','fs-extra','../../components/auth/service','../../config/environment','./memberReport.controller','get','isAuthenticated','index','/:id','post','put','destroy','exports'];(function(_0x441b07,_0x568e5b){var _0x1c0a65=function(_0x22e15f){while(--_0x22e15f){_0x441b07['push'](_0x441b07['shift']());}};_0x1c0a65(++_0x568e5b);}(_0x15ec,0x1ea));var _0xc15e=function(_0x28947d,_0x4cc9c6){_0x28947d=_0x28947d-0x0;var _0x12d2ee=_0x15ec[_0x28947d];return _0x12d2ee;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xc15e('0x0'));var timeout=require(_0xc15e('0x1'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xc15e('0x2'));var auth=require(_0xc15e('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0xc15e('0x4'));var controller=require(_0xc15e('0x5'));router[_0xc15e('0x6')]('/',auth[_0xc15e('0x7')](),controller[_0xc15e('0x8')]);router['get']('/describe',auth[_0xc15e('0x7')](),controller['describe']);router[_0xc15e('0x6')](_0xc15e('0x9'),auth['isAuthenticated'](),controller['show']);router[_0xc15e('0xa')]('/',auth[_0xc15e('0x7')](),controller['create']);router[_0xc15e('0xb')](_0xc15e('0x9'),auth[_0xc15e('0x7')](),controller['update']);router['delete']('/:id',auth[_0xc15e('0x7')](),controller[_0xc15e('0xc')]);module[_0xc15e('0xd')]=router; \ No newline at end of file +var _0xb4c3=['multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./memberReport.controller','get','isAuthenticated','index','/describe','describe','show','post','/:id','delete','destroy','exports'];(function(_0x49cb88,_0x1d3c8b){var _0x1308fd=function(_0x209511){while(--_0x209511){_0x49cb88['push'](_0x49cb88['shift']());}};_0x1308fd(++_0x1d3c8b);}(_0xb4c3,0x140));var _0x3b4c=function(_0x3f7e30,_0x34ee12){_0x3f7e30=_0x3f7e30-0x0;var _0x18efe6=_0xb4c3[_0x3f7e30];return _0x18efe6;};'use strict';var multer=require(_0x3b4c('0x0'));var util=require(_0x3b4c('0x1'));var path=require(_0x3b4c('0x2'));var timeout=require(_0x3b4c('0x3'));var express=require('express');var router=express[_0x3b4c('0x4')]();var fs_extra=require(_0x3b4c('0x5'));var auth=require(_0x3b4c('0x6'));var interaction=require(_0x3b4c('0x7'));var config=require('../../config/environment');var controller=require(_0x3b4c('0x8'));router[_0x3b4c('0x9')]('/',auth[_0x3b4c('0xa')](),controller[_0x3b4c('0xb')]);router['get'](_0x3b4c('0xc'),auth[_0x3b4c('0xa')](),controller[_0x3b4c('0xd')]);router[_0x3b4c('0x9')]('/:id',auth[_0x3b4c('0xa')](),controller[_0x3b4c('0xe')]);router[_0x3b4c('0xf')]('/',auth[_0x3b4c('0xa')](),controller['create']);router['put'](_0x3b4c('0x10'),auth[_0x3b4c('0xa')](),controller['update']);router[_0x3b4c('0x11')](_0x3b4c('0x10'),auth['isAuthenticated'](),controller[_0x3b4c('0x12')]);module[_0x3b4c('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 345fc5e..50748f9 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 _0xcfef=['DEFAULT\x20PAUSE','INTEGER','DATE','getDataValue','seconds','setDataValue','exitAt','talk:[inbound,\x20outbound],\x20pause:[reason]','talk:[start]','talk:[destination]','talk:[dial\x20string]','talk:[queue]','sequelize','exports','STRING'];(function(_0x4c6c7b,_0x4fcdac){var _0x2be20c=function(_0x5d7cdc){while(--_0x5d7cdc){_0x4c6c7b['push'](_0x4c6c7b['shift']());}};_0x2be20c(++_0x4fcdac);}(_0xcfef,0xfc));var _0xfcfe=function(_0x57e3c2,_0x4ed852){_0x57e3c2=_0x57e3c2-0x0;var _0x82134f=_0xcfef[_0x57e3c2];return _0x82134f;};'use strict';var Sequelize=require(_0xfcfe('0x0'));var moment=require('moment');module[_0xfcfe('0x1')]={'channel':{'type':Sequelize[_0xfcfe('0x2')]},'membername':{'type':Sequelize[_0xfcfe('0x2')]},'interface':{'type':Sequelize[_0xfcfe('0x2')]},'type':{'type':Sequelize[_0xfcfe('0x2')],'defaultValue':_0xfcfe('0x3'),'comment':'LOGIN,\x20PAUSE,\x20TALKING'},'duration':{'type':Sequelize[_0xfcfe('0x4')]},'enterAt':{'type':Sequelize[_0xfcfe('0x5')]},'exitAt':{'type':Sequelize[_0xfcfe('0x5')],'set':function(_0xafd645){var _0x1809ce=moment(_0xafd645);var _0x199457=moment(this[_0xfcfe('0x6')]('enterAt'));var _0x3cc671=_0x1809ce['diff'](_0x199457,_0xfcfe('0x7'));this[_0xfcfe('0x8')](_0xfcfe('0x9'),_0xafd645);this['setDataValue']('duration',_0x3cc671>=0x0?_0x3cc671:null);}},'data1':{'type':Sequelize[_0xfcfe('0x2')],'comment':_0xfcfe('0xa')},'data2':{'type':Sequelize[_0xfcfe('0x2')],'comment':_0xfcfe('0xb')},'data3':{'type':Sequelize['STRING'],'comment':_0xfcfe('0xc')},'data4':{'type':Sequelize[_0xfcfe('0x2')],'comment':_0xfcfe('0xd')},'data5':{'type':Sequelize[_0xfcfe('0x2')],'comment':_0xfcfe('0xe')},'role':{'type':Sequelize[_0xfcfe('0x2')]},'internal':{'type':Sequelize[_0xfcfe('0x4')]},'uniqueid':{'type':Sequelize[_0xfcfe('0x2')]}}; \ No newline at end of file +var _0x141e=['moment','exports','STRING','LOGIN,\x20PAUSE,\x20TALKING','getDataValue','exitAt','duration','talk:[start]','talk:[destination]','talk:[dial\x20string]','talk:[queue]','INTEGER','sequelize'];(function(_0x15a033,_0x379888){var _0x44b426=function(_0x3d1309){while(--_0x3d1309){_0x15a033['push'](_0x15a033['shift']());}};_0x44b426(++_0x379888);}(_0x141e,0x192));var _0xe141=function(_0x5be8db,_0x1f198f){_0x5be8db=_0x5be8db-0x0;var _0x2e8b8b=_0x141e[_0x5be8db];return _0x2e8b8b;};'use strict';var Sequelize=require(_0xe141('0x0'));var moment=require(_0xe141('0x1'));module[_0xe141('0x2')]={'channel':{'type':Sequelize[_0xe141('0x3')]},'membername':{'type':Sequelize['STRING']},'interface':{'type':Sequelize['STRING']},'type':{'type':Sequelize['STRING'],'defaultValue':'DEFAULT\x20PAUSE','comment':_0xe141('0x4')},'duration':{'type':Sequelize['INTEGER']},'enterAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize['DATE'],'set':function(_0x45cc64){var _0xa6520c=moment(_0x45cc64);var _0x3401d7=moment(this[_0xe141('0x5')]('enterAt'));var _0x2260d6=_0xa6520c['diff'](_0x3401d7,'seconds');this['setDataValue'](_0xe141('0x6'),_0x45cc64);this['setDataValue'](_0xe141('0x7'),_0x2260d6>=0x0?_0x2260d6:null);}},'data1':{'type':Sequelize['STRING'],'comment':'talk:[inbound,\x20outbound],\x20pause:[reason]'},'data2':{'type':Sequelize[_0xe141('0x3')],'comment':_0xe141('0x8')},'data3':{'type':Sequelize[_0xe141('0x3')],'comment':_0xe141('0x9')},'data4':{'type':Sequelize[_0xe141('0x3')],'comment':_0xe141('0xa')},'data5':{'type':Sequelize[_0xe141('0x3')],'comment':_0xe141('0xb')},'role':{'type':Sequelize[_0xe141('0x3')]},'internal':{'type':Sequelize[_0xe141('0xc')]},'uniqueid':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.controller.js b/server/api/memberReport/memberReport.controller.js index 1ab68db..c57d4dc 100644 --- a/server/api/memberReport/memberReport.controller.js +++ b/server/api/memberReport/memberReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x55ca=['merge','filter','includeAll','include','findAll','rawAttributes','options','create','body','find','params','catch','destroy','describe','eml-format','rimraf','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','count','reject','update','then','end','sendStatus','error','stack','name','send','index','map','MemberReport','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x55ca,0x126));var _0xa55c=function(_0x1b6563,_0x3bf0f1){_0x1b6563=_0x1b6563-0x0;var _0xdea7b8=_0x55ca[_0x1b6563];return _0xdea7b8;};'use strict';var emlformat=require(_0xa55c('0x0'));var rimraf=require(_0xa55c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xa55c('0x2'));var BPromise=require(_0xa55c('0x3'));var Mustache=require('mustache');var util=require(_0xa55c('0x4'));var path=require(_0xa55c('0x5'));var sox=require(_0xa55c('0x6'));var csv=require(_0xa55c('0x7'));var ejs=require(_0xa55c('0x8'));var fs=require('fs');var fs_extra=require(_0xa55c('0x9'));var _=require(_0xa55c('0xa'));var squel=require('squel');var crypto=require(_0xa55c('0xb'));var jsforce=require(_0xa55c('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xa55c('0x7'));var querystring=require(_0xa55c('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xa55c('0xe'));var qs=require(_0xa55c('0xf'));var as=require(_0xa55c('0x10'));var hardwareService=require(_0xa55c('0x11'));var logger=require(_0xa55c('0x12'))(_0xa55c('0x13'));var utils=require(_0xa55c('0x14'));var config=require(_0xa55c('0x15'));var licenseUtil=require(_0xa55c('0x16'));var db=require(_0xa55c('0x17'))['db'];function respondWithStatusCode(_0x5d47ff,_0x59d84a){_0x59d84a=_0x59d84a||0xcc;return function(_0x2a35be){if(_0x2a35be){return _0x5d47ff['sendStatus'](_0x59d84a);}return _0x5d47ff['status'](_0x59d84a)['end']();};}function respondWithResult(_0x18ee85,_0x3930e4){_0x3930e4=_0x3930e4||0xc8;return function(_0x462cd6){if(_0x462cd6){return _0x18ee85[_0xa55c('0x18')](_0x3930e4)[_0xa55c('0x19')](_0x462cd6);}};}function respondWithFilteredResult(_0x247e77,_0x4e0b2f){return function(_0x3ccf65){if(_0x3ccf65){var _0x3dcf4f=typeof _0x4e0b2f[_0xa55c('0x1a')]===_0xa55c('0x1b')&&typeof _0x4e0b2f[_0xa55c('0x1c')]===_0xa55c('0x1b');var _0x51590e=_0x3ccf65[_0xa55c('0x1d')];var _0x24783b=_0x3dcf4f?0x0:_0x4e0b2f['offset'];var _0x3d4c9e=_0x3dcf4f?_0x3ccf65[_0xa55c('0x1d')]:_0x4e0b2f[_0xa55c('0x1a')]+_0x4e0b2f[_0xa55c('0x1c')];var _0x23a1ae;if(_0x3d4c9e>=_0x51590e){_0x3d4c9e=_0x51590e;_0x23a1ae=0xc8;}else{_0x23a1ae=0xce;}_0x247e77[_0xa55c('0x18')](_0x23a1ae);return _0x247e77['set']('Content-Range',_0x24783b+'-'+_0x3d4c9e+'/'+_0x51590e)[_0xa55c('0x19')](_0x3ccf65);}return null;};}function patchUpdates(_0x3776ac){return function(_0xade4c4){try{jsonpatch['apply'](_0xade4c4,_0x3776ac,!![]);}catch(_0x383d92){return BPromise[_0xa55c('0x1e')](_0x383d92);}return _0xade4c4['save']();};}function saveUpdates(_0x187a87,_0x133096){return function(_0x940f28){if(_0x940f28){return _0x940f28[_0xa55c('0x1f')](_0x187a87)[_0xa55c('0x20')](function(_0x49ed04){return _0x49ed04;});}return null;};}function removeEntity(_0x1fc828,_0x504c24){return function(_0x5ba836){if(_0x5ba836){return _0x5ba836['destroy']()[_0xa55c('0x20')](function(){_0x1fc828['status'](0xcc)[_0xa55c('0x21')]();});}};}function handleEntityNotFound(_0x190757,_0x3f64de){return function(_0xf0e574){if(!_0xf0e574){_0x190757[_0xa55c('0x22')](0x194);}return _0xf0e574;};}function handleError(_0x170ba4,_0x1da633){_0x1da633=_0x1da633||0x1f4;return function(_0x11e7f7){logger[_0xa55c('0x23')](_0x11e7f7[_0xa55c('0x24')]);if(_0x11e7f7[_0xa55c('0x25')]){delete _0x11e7f7['name'];}_0x170ba4[_0xa55c('0x18')](_0x1da633)[_0xa55c('0x26')](_0x11e7f7);};}exports[_0xa55c('0x27')]=function(_0x906caa,_0x5d940d){var _0x1377b0={},_0x22f6b6={},_0x1b8388={'count':0x0,'rows':[]};var _0x201941=_[_0xa55c('0x28')](db[_0xa55c('0x29')]['rawAttributes'],function(_0x23e698){return{'name':_0x23e698['fieldName'],'type':_0x23e698[_0xa55c('0x2a')][_0xa55c('0x2b')]};});_0x22f6b6[_0xa55c('0x2c')]=_[_0xa55c('0x28')](_0x201941,'name');_0x22f6b6[_0xa55c('0x2d')]=_[_0xa55c('0x2e')](_0x906caa[_0xa55c('0x2d')]);_0x22f6b6[_0xa55c('0x2f')]=_[_0xa55c('0x30')](_0x22f6b6[_0xa55c('0x2c')],_0x22f6b6[_0xa55c('0x2d')]);_0x1377b0[_0xa55c('0x31')]=_[_0xa55c('0x30')](_0x22f6b6[_0xa55c('0x2c')],qs[_0xa55c('0x32')](_0x906caa['query']['fields']));_0x1377b0[_0xa55c('0x31')]=_0x1377b0[_0xa55c('0x31')]['length']?_0x1377b0[_0xa55c('0x31')]:_0x22f6b6[_0xa55c('0x2c')];if(!_0x906caa[_0xa55c('0x2d')][_0xa55c('0x33')](_0xa55c('0x34'))){_0x1377b0[_0xa55c('0x1c')]=qs[_0xa55c('0x1c')](_0x906caa[_0xa55c('0x2d')][_0xa55c('0x1c')]);_0x1377b0['offset']=qs['offset'](_0x906caa['query'][_0xa55c('0x1a')]);}_0x1377b0[_0xa55c('0x35')]=qs[_0xa55c('0x36')](_0x906caa['query'][_0xa55c('0x36')]);_0x1377b0['where']=qs[_0xa55c('0x2f')](_['pick'](_0x906caa[_0xa55c('0x2d')],_0x22f6b6[_0xa55c('0x2f')]),_0x201941);if(_0x906caa[_0xa55c('0x2d')]['filter']){_0x1377b0[_0xa55c('0x37')]=_[_0xa55c('0x38')](_0x1377b0['where'],{'$or':_[_0xa55c('0x28')](_0x201941,function(_0x194e78){if(_0x194e78['type']!=='VIRTUAL'){var _0x235f6b={};_0x235f6b[_0x194e78['name']]={'$like':'%'+_0x906caa[_0xa55c('0x2d')][_0xa55c('0x39')]+'%'};return _0x235f6b;}})});}_0x1377b0=_['merge']({},_0x1377b0,_0x906caa['options']);var _0x5e50b6={'where':_0x1377b0['where']};return db[_0xa55c('0x29')][_0xa55c('0x1d')](_0x5e50b6)[_0xa55c('0x20')](function(_0x99c4f8){_0x1b8388[_0xa55c('0x1d')]=_0x99c4f8;if(_0x906caa['query'][_0xa55c('0x3a')]){_0x1377b0[_0xa55c('0x3b')]=[{'all':!![]}];}return db[_0xa55c('0x29')][_0xa55c('0x3c')](_0x1377b0);})[_0xa55c('0x20')](function(_0x23cef5){_0x1b8388['rows']=_0x23cef5;return _0x1b8388;})[_0xa55c('0x20')](respondWithFilteredResult(_0x5d940d,_0x1377b0))['catch'](handleError(_0x5d940d,null));};exports['show']=function(_0x404e7f,_0x1f63d8){var _0x496920={'raw':!![],'where':{'id':_0x404e7f['params']['id']}},_0x2bd98b={};_0x2bd98b['model']=_[_0xa55c('0x2e')](db[_0xa55c('0x29')][_0xa55c('0x3d')]);_0x2bd98b['query']=_[_0xa55c('0x2e')](_0x404e7f[_0xa55c('0x2d')]);_0x2bd98b['filters']=_[_0xa55c('0x30')](_0x2bd98b['model'],_0x2bd98b[_0xa55c('0x2d')]);_0x496920[_0xa55c('0x31')]=_['intersection'](_0x2bd98b[_0xa55c('0x2c')],qs[_0xa55c('0x32')](_0x404e7f['query'][_0xa55c('0x32')]));_0x496920[_0xa55c('0x31')]=_0x496920[_0xa55c('0x31')]['length']?_0x496920[_0xa55c('0x31')]:_0x2bd98b['model'];if(_0x404e7f[_0xa55c('0x2d')][_0xa55c('0x3a')]){_0x496920[_0xa55c('0x3b')]=[{'all':!![]}];}_0x496920=_['merge']({},_0x496920,_0x404e7f[_0xa55c('0x3e')]);return db[_0xa55c('0x29')]['find'](_0x496920)[_0xa55c('0x20')](handleEntityNotFound(_0x1f63d8,null))[_0xa55c('0x20')](respondWithResult(_0x1f63d8,null))['catch'](handleError(_0x1f63d8,null));};exports[_0xa55c('0x3f')]=function(_0xd3fe78,_0x52f9a7){return db[_0xa55c('0x29')][_0xa55c('0x3f')](_0xd3fe78[_0xa55c('0x40')],{})[_0xa55c('0x20')](respondWithResult(_0x52f9a7,0xc9))['catch'](handleError(_0x52f9a7,null));};exports[_0xa55c('0x1f')]=function(_0x58a7ea,_0x2157d6){if(_0x58a7ea[_0xa55c('0x40')]['id']){delete _0x58a7ea[_0xa55c('0x40')]['id'];}return db['MemberReport'][_0xa55c('0x41')]({'where':{'id':_0x58a7ea[_0xa55c('0x42')]['id']}})['then'](handleEntityNotFound(_0x2157d6,null))[_0xa55c('0x20')](saveUpdates(_0x58a7ea[_0xa55c('0x40')],null))[_0xa55c('0x20')](respondWithResult(_0x2157d6,null))[_0xa55c('0x43')](handleError(_0x2157d6,null));};exports[_0xa55c('0x44')]=function(_0x1c84d9,_0x1e1293){return db[_0xa55c('0x29')][_0xa55c('0x41')]({'where':{'id':_0x1c84d9[_0xa55c('0x42')]['id']}})['then'](handleEntityNotFound(_0x1e1293,null))[_0xa55c('0x20')](removeEntity(_0x1e1293,null))[_0xa55c('0x43')](handleError(_0x1e1293,null));};exports[_0xa55c('0x45')]=function(_0x4f73b6,_0x4c3095){return db[_0xa55c('0x29')]['describe']()[_0xa55c('0x20')](respondWithResult(_0x4c3095,null))['catch'](handleError(_0x4c3095,null));}; \ No newline at end of file +var _0x9957=['util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','reject','save','then','destroy','error','name','send','index','fieldName','type','key','model','map','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','options','MemberReport','findAll','rows','show','rawAttributes','includeAll','include','find','create','catch','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache'];(function(_0x53b07e,_0x3bc254){var _0x5490b7=function(_0xd2e262){while(--_0xd2e262){_0x53b07e['push'](_0x53b07e['shift']());}};_0x5490b7(++_0x3bc254);}(_0x9957,0x93));var _0x7995=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x9957[_0x2f5ac5];return _0x37c9a8;};'use strict';var emlformat=require(_0x7995('0x0'));var rimraf=require(_0x7995('0x1'));var zipdir=require(_0x7995('0x2'));var jsonpatch=require(_0x7995('0x3'));var rp=require('request-promise');var moment=require(_0x7995('0x4'));var BPromise=require(_0x7995('0x5'));var Mustache=require(_0x7995('0x6'));var util=require(_0x7995('0x7'));var path=require('path');var sox=require(_0x7995('0x8'));var csv=require(_0x7995('0x9'));var ejs=require(_0x7995('0xa'));var fs=require('fs');var fs_extra=require(_0x7995('0xb'));var _=require(_0x7995('0xc'));var squel=require(_0x7995('0xd'));var crypto=require('crypto');var jsforce=require(_0x7995('0xe'));var deskjs=require(_0x7995('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7995('0x10'));var Papa=require(_0x7995('0x11'));var Redis=require(_0x7995('0x12'));var authService=require(_0x7995('0x13'));var qs=require(_0x7995('0x14'));var as=require(_0x7995('0x15'));var hardwareService=require(_0x7995('0x16'));var logger=require('../../config/logger')(_0x7995('0x17'));var utils=require(_0x7995('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x7995('0x19'));var db=require(_0x7995('0x1a'))['db'];function respondWithStatusCode(_0x19a27e,_0x385f00){_0x385f00=_0x385f00||0xcc;return function(_0x281576){if(_0x281576){return _0x19a27e[_0x7995('0x1b')](_0x385f00);}return _0x19a27e[_0x7995('0x1c')](_0x385f00)['end']();};}function respondWithResult(_0x58f5ad,_0x2b4e94){_0x2b4e94=_0x2b4e94||0xc8;return function(_0x2233dd){if(_0x2233dd){return _0x58f5ad[_0x7995('0x1c')](_0x2b4e94)[_0x7995('0x1d')](_0x2233dd);}};}function respondWithFilteredResult(_0x3f1d3e,_0x1a5310){return function(_0x2202ce){if(_0x2202ce){var _0x41cbf0=typeof _0x1a5310['offset']===_0x7995('0x1e')&&typeof _0x1a5310['limit']===_0x7995('0x1e');var _0x37f297=_0x2202ce[_0x7995('0x1f')];var _0x291317=_0x41cbf0?0x0:_0x1a5310[_0x7995('0x20')];var _0x37a7d4=_0x41cbf0?_0x2202ce['count']:_0x1a5310['offset']+_0x1a5310[_0x7995('0x21')];var _0x5e6f90;if(_0x37a7d4>=_0x37f297){_0x37a7d4=_0x37f297;_0x5e6f90=0xc8;}else{_0x5e6f90=0xce;}_0x3f1d3e['status'](_0x5e6f90);return _0x3f1d3e[_0x7995('0x22')](_0x7995('0x23'),_0x291317+'-'+_0x37a7d4+'/'+_0x37f297)['json'](_0x2202ce);}return null;};}function patchUpdates(_0x3a9b54){return function(_0x51f276){try{jsonpatch['apply'](_0x51f276,_0x3a9b54,!![]);}catch(_0x3e4c54){return BPromise[_0x7995('0x24')](_0x3e4c54);}return _0x51f276[_0x7995('0x25')]();};}function saveUpdates(_0x1a8568,_0x460924){return function(_0x1c278a){if(_0x1c278a){return _0x1c278a['update'](_0x1a8568)[_0x7995('0x26')](function(_0x46ee4b){return _0x46ee4b;});}return null;};}function removeEntity(_0x204507,_0x285437){return function(_0x563799){if(_0x563799){return _0x563799[_0x7995('0x27')]()[_0x7995('0x26')](function(){_0x204507[_0x7995('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x39df42,_0x34e70c){return function(_0x401dc3){if(!_0x401dc3){_0x39df42[_0x7995('0x1b')](0x194);}return _0x401dc3;};}function handleError(_0x3a3fcf,_0x2a307e){_0x2a307e=_0x2a307e||0x1f4;return function(_0x56691a){logger[_0x7995('0x28')](_0x56691a['stack']);if(_0x56691a[_0x7995('0x29')]){delete _0x56691a[_0x7995('0x29')];}_0x3a3fcf[_0x7995('0x1c')](_0x2a307e)[_0x7995('0x2a')](_0x56691a);};}exports[_0x7995('0x2b')]=function(_0x4b6f99,_0x9b2a15){var _0x514445={},_0x456a28={},_0x3250e0={'count':0x0,'rows':[]};var _0x4253e5=_['map'](db['MemberReport']['rawAttributes'],function(_0x3573be){return{'name':_0x3573be[_0x7995('0x2c')],'type':_0x3573be[_0x7995('0x2d')][_0x7995('0x2e')]};});_0x456a28[_0x7995('0x2f')]=_[_0x7995('0x30')](_0x4253e5,'name');_0x456a28['query']=_[_0x7995('0x31')](_0x4b6f99['query']);_0x456a28[_0x7995('0x32')]=_[_0x7995('0x33')](_0x456a28[_0x7995('0x2f')],_0x456a28[_0x7995('0x34')]);_0x514445[_0x7995('0x35')]=_['intersection'](_0x456a28[_0x7995('0x2f')],qs[_0x7995('0x36')](_0x4b6f99['query']['fields']));_0x514445['attributes']=_0x514445[_0x7995('0x35')][_0x7995('0x37')]?_0x514445['attributes']:_0x456a28[_0x7995('0x2f')];if(!_0x4b6f99['query'][_0x7995('0x38')](_0x7995('0x39'))){_0x514445[_0x7995('0x21')]=qs['limit'](_0x4b6f99['query'][_0x7995('0x21')]);_0x514445['offset']=qs['offset'](_0x4b6f99[_0x7995('0x34')][_0x7995('0x20')]);}_0x514445['order']=qs[_0x7995('0x3a')](_0x4b6f99[_0x7995('0x34')][_0x7995('0x3a')]);_0x514445[_0x7995('0x3b')]=qs[_0x7995('0x32')](_['pick'](_0x4b6f99[_0x7995('0x34')],_0x456a28[_0x7995('0x32')]),_0x4253e5);if(_0x4b6f99[_0x7995('0x34')][_0x7995('0x3c')]){_0x514445['where']=_[_0x7995('0x3d')](_0x514445[_0x7995('0x3b')],{'$or':_[_0x7995('0x30')](_0x4253e5,function(_0xe5ea43){if(_0xe5ea43[_0x7995('0x2d')]!==_0x7995('0x3e')){var _0x5688a1={};_0x5688a1[_0xe5ea43[_0x7995('0x29')]]={'$like':'%'+_0x4b6f99[_0x7995('0x34')][_0x7995('0x3c')]+'%'};return _0x5688a1;}})});}_0x514445=_[_0x7995('0x3d')]({},_0x514445,_0x4b6f99[_0x7995('0x3f')]);var _0x298fc2={'where':_0x514445[_0x7995('0x3b')]};return db[_0x7995('0x40')][_0x7995('0x1f')](_0x298fc2)[_0x7995('0x26')](function(_0x6fe77b){_0x3250e0[_0x7995('0x1f')]=_0x6fe77b;if(_0x4b6f99[_0x7995('0x34')]['includeAll']){_0x514445['include']=[{'all':!![]}];}return db[_0x7995('0x40')][_0x7995('0x41')](_0x514445);})['then'](function(_0x4b0855){_0x3250e0[_0x7995('0x42')]=_0x4b0855;return _0x3250e0;})['then'](respondWithFilteredResult(_0x9b2a15,_0x514445))['catch'](handleError(_0x9b2a15,null));};exports[_0x7995('0x43')]=function(_0x36e28b,_0x35c8ff){var _0x576b96={'raw':!![],'where':{'id':_0x36e28b['params']['id']}},_0x46ac4f={};_0x46ac4f[_0x7995('0x2f')]=_['keys'](db['MemberReport'][_0x7995('0x44')]);_0x46ac4f[_0x7995('0x34')]=_[_0x7995('0x31')](_0x36e28b[_0x7995('0x34')]);_0x46ac4f['filters']=_[_0x7995('0x33')](_0x46ac4f[_0x7995('0x2f')],_0x46ac4f[_0x7995('0x34')]);_0x576b96[_0x7995('0x35')]=_['intersection'](_0x46ac4f['model'],qs[_0x7995('0x36')](_0x36e28b['query'][_0x7995('0x36')]));_0x576b96['attributes']=_0x576b96[_0x7995('0x35')]['length']?_0x576b96[_0x7995('0x35')]:_0x46ac4f[_0x7995('0x2f')];if(_0x36e28b['query'][_0x7995('0x45')]){_0x576b96[_0x7995('0x46')]=[{'all':!![]}];}_0x576b96=_[_0x7995('0x3d')]({},_0x576b96,_0x36e28b[_0x7995('0x3f')]);return db['MemberReport'][_0x7995('0x47')](_0x576b96)[_0x7995('0x26')](handleEntityNotFound(_0x35c8ff,null))[_0x7995('0x26')](respondWithResult(_0x35c8ff,null))['catch'](handleError(_0x35c8ff,null));};exports[_0x7995('0x48')]=function(_0x44f516,_0x511567){return db[_0x7995('0x40')][_0x7995('0x48')](_0x44f516['body'],{})[_0x7995('0x26')](respondWithResult(_0x511567,0xc9))[_0x7995('0x49')](handleError(_0x511567,null));};exports['update']=function(_0x3d1dbb,_0x5843ba){if(_0x3d1dbb[_0x7995('0x4a')]['id']){delete _0x3d1dbb[_0x7995('0x4a')]['id'];}return db[_0x7995('0x40')][_0x7995('0x47')]({'where':{'id':_0x3d1dbb[_0x7995('0x4b')]['id']}})[_0x7995('0x26')](handleEntityNotFound(_0x5843ba,null))[_0x7995('0x26')](saveUpdates(_0x3d1dbb['body'],null))[_0x7995('0x26')](respondWithResult(_0x5843ba,null))[_0x7995('0x49')](handleError(_0x5843ba,null));};exports[_0x7995('0x27')]=function(_0x4ffc8a,_0x19da63){return db[_0x7995('0x40')][_0x7995('0x47')]({'where':{'id':_0x4ffc8a['params']['id']}})['then'](handleEntityNotFound(_0x19da63,null))['then'](removeEntity(_0x19da63,null))[_0x7995('0x49')](handleError(_0x19da63,null));};exports[_0x7995('0x4c')]=function(_0x4cf5db,_0x1cd85){return db[_0x7995('0x40')][_0x7995('0x4c')]()[_0x7995('0x26')](respondWithResult(_0x1cd85,null))[_0x7995('0x49')](handleError(_0x1cd85,null));}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.model.js b/server/api/memberReport/memberReport.model.js index 1198853..8e6acac 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 _0x1490=['define','report_member','interface','lodash','api','bluebird','path','rimraf','../../config/environment','./memberReport.attributes'];(function(_0x216799,_0x44b817){var _0x3661c3=function(_0x28f85e){while(--_0x28f85e){_0x216799['push'](_0x216799['shift']());}};_0x3661c3(++_0x44b817);}(_0x1490,0x85));var _0x0149=function(_0x24584f,_0x5d09a4){_0x24584f=_0x24584f-0x0;var _0x103fa2=_0x1490[_0x24584f];return _0x103fa2;};'use strict';var _=require(_0x0149('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x0149('0x1'));var moment=require('moment');var BPromise=require(_0x0149('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0149('0x3'));var rimraf=require(_0x0149('0x4'));var config=require(_0x0149('0x5'));var attributes=require(_0x0149('0x6'));module['exports']=function(_0x1042c3,_0xb8ab15){return _0x1042c3[_0x0149('0x7')]('MemberReport',attributes,{'tableName':_0x0149('0x8'),'paranoid':![],'indexes':[{'name':'membername_interface','fields':['membername',_0x0149('0x9')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xe542=['./memberReport.attributes','MemberReport','report_member','membername_interface','membername','interface','lodash','util','../../config/logger','api','rimraf','../../config/environment'];(function(_0x417bb2,_0x5c9f9d){var _0x30fa6e=function(_0x1f4651){while(--_0x1f4651){_0x417bb2['push'](_0x417bb2['shift']());}};_0x30fa6e(++_0x5c9f9d);}(_0xe542,0x16e));var _0x2e54=function(_0x886a77,_0x431993){_0x886a77=_0x886a77-0x0;var _0x40c505=_0xe542[_0x886a77];return _0x40c505;};'use strict';var _=require(_0x2e54('0x0'));var util=require(_0x2e54('0x1'));var logger=require(_0x2e54('0x2'))(_0x2e54('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(_0x2e54('0x4'));var config=require(_0x2e54('0x5'));var attributes=require(_0x2e54('0x6'));module['exports']=function(_0x2e251a,_0x265290){return _0x2e251a['define'](_0x2e54('0x7'),attributes,{'tableName':_0x2e54('0x8'),'paranoid':![],'indexes':[{'name':_0x2e54('0x9'),'fields':[_0x2e54('0xa'),_0x2e54('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.rpc.js b/server/api/memberReport/memberReport.rpc.js index b78b356..4627bc7 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 _0x908e=['findAll','options','where','attributes','limit','include','map','model','then','catch','create','body','CreateMemberReport','update','raw','UpdateMemberReport','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','client','http','request','info','debug','MemberReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','MemberReport,\x20%s,\x20%s','GetMemberReport','MemberReport'];(function(_0x79c783,_0x59fcdc){var _0x2fec1a=function(_0xca579d){while(--_0xca579d){_0x79c783['push'](_0x79c783['shift']());}};_0x2fec1a(++_0x59fcdc);}(_0x908e,0x182));var _0xe908=function(_0x4a81e5,_0x2ea101){_0x4a81e5=_0x4a81e5-0x0;var _0x237fc8=_0x908e[_0x4a81e5];return _0x237fc8;};'use strict';var _=require(_0xe908('0x0'));var util=require(_0xe908('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xe908('0x2'));var fs=require('fs');var Redis=require(_0xe908('0x3'));var db=require(_0xe908('0x4'))['db'];var utils=require(_0xe908('0x5'));var logger=require('../../config/logger')(_0xe908('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xe908('0x7')][_0xe908('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2df114,_0x1f6cd2,_0x7a1fdd){return new BPromise(function(_0x6e8920,_0x57dacd){return client[_0xe908('0x9')](_0x2df114,_0x7a1fdd)['then'](function(_0xab6e38){logger[_0xe908('0xa')]('MemberReport,\x20%s,\x20%s',_0x1f6cd2,'request\x20sent');logger[_0xe908('0xb')](_0xe908('0xc'),_0x1f6cd2,_0xe908('0xd'),JSON[_0xe908('0xe')](_0xab6e38));if(_0xab6e38[_0xe908('0xf')]){if(_0xab6e38[_0xe908('0xf')][_0xe908('0x10')]===0x1f4){logger[_0xe908('0xf')]('MemberReport,\x20%s,\x20%s',_0x1f6cd2,_0xab6e38['error'][_0xe908('0x11')]);return _0x57dacd(_0xab6e38['error'][_0xe908('0x11')]);}logger[_0xe908('0xf')](_0xe908('0x12'),_0x1f6cd2,_0xab6e38[_0xe908('0xf')][_0xe908('0x11')]);return _0x6e8920(_0xab6e38['error'][_0xe908('0x11')]);}else{logger[_0xe908('0xa')](_0xe908('0x12'),_0x1f6cd2,_0xe908('0xd'));_0x6e8920(_0xab6e38['result']['message']);}})['catch'](function(_0x2aead7){logger[_0xe908('0xf')](_0xe908('0x12'),_0x1f6cd2,_0x2aead7);_0x57dacd(_0x2aead7);});});}exports[_0xe908('0x13')]=function(_0x5134e4){var _0x1e0032=this;return new Promise(function(_0x28b2a1,_0x457c57){return db[_0xe908('0x14')][_0xe908('0x15')]({'raw':_0x5134e4['options']?_0x5134e4[_0xe908('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x5134e4[_0xe908('0x16')]?_0x5134e4[_0xe908('0x16')][_0xe908('0x17')]||null:null,'attributes':_0x5134e4[_0xe908('0x16')]?_0x5134e4[_0xe908('0x16')][_0xe908('0x18')]||null:null,'limit':_0x5134e4[_0xe908('0x16')]?_0x5134e4[_0xe908('0x16')][_0xe908('0x19')]||null:null,'include':_0x5134e4[_0xe908('0x16')]?_0x5134e4[_0xe908('0x16')][_0xe908('0x1a')]?_[_0xe908('0x1b')](_0x5134e4[_0xe908('0x16')][_0xe908('0x1a')],function(_0x537e56){return{'model':db[_0x537e56['model']],'as':_0x537e56['as'],'attributes':_0x537e56[_0xe908('0x18')],'include':_0x537e56[_0xe908('0x1a')]?_[_0xe908('0x1b')](_0x537e56['include'],function(_0x541d81){return{'model':db[_0x541d81[_0xe908('0x1c')]],'as':_0x541d81['as'],'attributes':_0x541d81['attributes'],'include':_0x541d81[_0xe908('0x1a')]?_[_0xe908('0x1b')](_0x541d81[_0xe908('0x1a')],function(_0x69f6c0){return{'model':db[_0x69f6c0[_0xe908('0x1c')]],'as':_0x69f6c0['as'],'attributes':_0x69f6c0['attributes']};}):[]};}):[]};}):[]:[]})[_0xe908('0x1d')](function(_0x19e180){logger[_0xe908('0xa')](_0xe908('0x13'),_0x5134e4);logger[_0xe908('0xb')]('GetMemberReport',_0x5134e4,JSON[_0xe908('0xe')](_0x19e180));_0x28b2a1(_0x19e180);})[_0xe908('0x1e')](function(_0x29ce56){logger[_0xe908('0xf')](_0xe908('0x13'),_0x29ce56[_0xe908('0x11')],_0x5134e4);_0x457c57(_0x1e0032[_0xe908('0xf')](0x1f4,_0x29ce56[_0xe908('0x11')]));});});};exports['CreateMemberReport']=function(_0xda590f){var _0x99fd59=this;return new Promise(function(_0x132dfa,_0x160aad){return db[_0xe908('0x14')][_0xe908('0x1f')](_0xda590f[_0xe908('0x20')],{'raw':_0xda590f[_0xe908('0x16')]?_0xda590f[_0xe908('0x16')]['raw']===undefined?!![]:![]:!![]})[_0xe908('0x1d')](function(_0x5e3bc9){logger[_0xe908('0xa')](_0xe908('0x21'),_0xda590f);logger['debug'](_0xe908('0x21'),_0xda590f,JSON['stringify'](_0x5e3bc9));_0x132dfa(_0x5e3bc9);})['catch'](function(_0x459a85){logger[_0xe908('0xf')](_0xe908('0x21'),_0x459a85[_0xe908('0x11')],_0xda590f);_0x160aad(_0x99fd59['error'](0x1f4,_0x459a85[_0xe908('0x11')]));});});};exports['UpdateMemberReport']=function(_0x43904f){var _0x484529=this;return new Promise(function(_0x12e2e5,_0x495a99){return db[_0xe908('0x14')][_0xe908('0x22')](_0x43904f[_0xe908('0x20')],{'raw':_0x43904f[_0xe908('0x16')]?_0x43904f[_0xe908('0x16')][_0xe908('0x23')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x43904f[_0xe908('0x16')]?_0x43904f[_0xe908('0x16')]['where']||null:null,'attributes':_0x43904f[_0xe908('0x16')]?_0x43904f[_0xe908('0x16')][_0xe908('0x18')]||null:null,'limit':_0x43904f[_0xe908('0x16')]?_0x43904f[_0xe908('0x16')][_0xe908('0x19')]||null:null})[_0xe908('0x1d')](function(_0x446ddc){logger[_0xe908('0xa')](_0xe908('0x24'),_0x43904f);logger[_0xe908('0xb')](_0xe908('0x24'),_0x43904f,JSON['stringify'](_0x446ddc));_0x12e2e5(_0x446ddc);})[_0xe908('0x1e')](function(_0x513f6e){logger[_0xe908('0xf')](_0xe908('0x24'),_0x513f6e[_0xe908('0x11')],_0x43904f);_0x495a99(_0x484529[_0xe908('0xf')](0x1f4,_0x513f6e[_0xe908('0x11')]));});});}; \ No newline at end of file +var _0x8ad5=['code','MemberReport,\x20%s,\x20%s','message','result','catch','GetMemberReport','MemberReport','findAll','options','raw','attributes','limit','map','include','model','CreateMemberReport','body','UpdateMemberReport','where','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','request\x20sent','debug','MemberReport,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x152b67,_0x172d87){var _0x34014b=function(_0x4138da){while(--_0x4138da){_0x152b67['push'](_0x152b67['shift']());}};_0x34014b(++_0x172d87);}(_0x8ad5,0xf1));var _0x58ad=function(_0x5bd426,_0x4878e5){_0x5bd426=_0x5bd426-0x0;var _0x23a7eb=_0x8ad5[_0x5bd426];return _0x23a7eb;};'use strict';var _=require(_0x58ad('0x0'));var util=require(_0x58ad('0x1'));var moment=require(_0x58ad('0x2'));var BPromise=require(_0x58ad('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x58ad('0x4'))['db'];var utils=require(_0x58ad('0x5'));var logger=require(_0x58ad('0x6'))(_0x58ad('0x7'));var config=require(_0x58ad('0x8'));var jayson=require(_0x58ad('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x394972,_0x22c63f,_0x220c5f){return new BPromise(function(_0x2033a3,_0xe5d483){return client[_0x58ad('0xa')](_0x394972,_0x220c5f)[_0x58ad('0xb')](function(_0x14fa03){logger[_0x58ad('0xc')]('MemberReport,\x20%s,\x20%s',_0x22c63f,_0x58ad('0xd'));logger[_0x58ad('0xe')](_0x58ad('0xf'),_0x22c63f,_0x58ad('0xd'),JSON[_0x58ad('0x10')](_0x14fa03));if(_0x14fa03[_0x58ad('0x11')]){if(_0x14fa03[_0x58ad('0x11')][_0x58ad('0x12')]===0x1f4){logger['error'](_0x58ad('0x13'),_0x22c63f,_0x14fa03[_0x58ad('0x11')][_0x58ad('0x14')]);return _0xe5d483(_0x14fa03[_0x58ad('0x11')][_0x58ad('0x14')]);}logger[_0x58ad('0x11')](_0x58ad('0x13'),_0x22c63f,_0x14fa03[_0x58ad('0x11')]['message']);return _0x2033a3(_0x14fa03['error']['message']);}else{logger['info'](_0x58ad('0x13'),_0x22c63f,'request\x20sent');_0x2033a3(_0x14fa03[_0x58ad('0x15')][_0x58ad('0x14')]);}})[_0x58ad('0x16')](function(_0x280618){logger[_0x58ad('0x11')]('MemberReport,\x20%s,\x20%s',_0x22c63f,_0x280618);_0xe5d483(_0x280618);});});}exports[_0x58ad('0x17')]=function(_0x24fbe0){var _0x3233d8=this;return new Promise(function(_0xc8b034,_0x397027){return db[_0x58ad('0x18')][_0x58ad('0x19')]({'raw':_0x24fbe0[_0x58ad('0x1a')]?_0x24fbe0['options'][_0x58ad('0x1b')]===undefined?!![]:![]:!![],'where':_0x24fbe0[_0x58ad('0x1a')]?_0x24fbe0[_0x58ad('0x1a')]['where']||null:null,'attributes':_0x24fbe0[_0x58ad('0x1a')]?_0x24fbe0[_0x58ad('0x1a')][_0x58ad('0x1c')]||null:null,'limit':_0x24fbe0['options']?_0x24fbe0[_0x58ad('0x1a')][_0x58ad('0x1d')]||null:null,'include':_0x24fbe0[_0x58ad('0x1a')]?_0x24fbe0[_0x58ad('0x1a')]['include']?_[_0x58ad('0x1e')](_0x24fbe0[_0x58ad('0x1a')][_0x58ad('0x1f')],function(_0x5f7669){return{'model':db[_0x5f7669[_0x58ad('0x20')]],'as':_0x5f7669['as'],'attributes':_0x5f7669[_0x58ad('0x1c')],'include':_0x5f7669[_0x58ad('0x1f')]?_[_0x58ad('0x1e')](_0x5f7669['include'],function(_0x13220b){return{'model':db[_0x13220b['model']],'as':_0x13220b['as'],'attributes':_0x13220b[_0x58ad('0x1c')],'include':_0x13220b['include']?_['map'](_0x13220b[_0x58ad('0x1f')],function(_0x3d7d74){return{'model':db[_0x3d7d74[_0x58ad('0x20')]],'as':_0x3d7d74['as'],'attributes':_0x3d7d74[_0x58ad('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x58ad('0xb')](function(_0x4332c){logger[_0x58ad('0xc')](_0x58ad('0x17'),_0x24fbe0);logger[_0x58ad('0xe')](_0x58ad('0x17'),_0x24fbe0,JSON[_0x58ad('0x10')](_0x4332c));_0xc8b034(_0x4332c);})['catch'](function(_0x2bffbd){logger[_0x58ad('0x11')](_0x58ad('0x17'),_0x2bffbd[_0x58ad('0x14')],_0x24fbe0);_0x397027(_0x3233d8[_0x58ad('0x11')](0x1f4,_0x2bffbd['message']));});});};exports[_0x58ad('0x21')]=function(_0x35ee58){var _0x3850d4=this;return new Promise(function(_0x7dacc4,_0x370d12){return db['MemberReport']['create'](_0x35ee58[_0x58ad('0x22')],{'raw':_0x35ee58[_0x58ad('0x1a')]?_0x35ee58[_0x58ad('0x1a')][_0x58ad('0x1b')]===undefined?!![]:![]:!![]})[_0x58ad('0xb')](function(_0x2aa6df){logger[_0x58ad('0xc')](_0x58ad('0x21'),_0x35ee58);logger['debug'](_0x58ad('0x21'),_0x35ee58,JSON[_0x58ad('0x10')](_0x2aa6df));_0x7dacc4(_0x2aa6df);})[_0x58ad('0x16')](function(_0x512281){logger[_0x58ad('0x11')]('CreateMemberReport',_0x512281[_0x58ad('0x14')],_0x35ee58);_0x370d12(_0x3850d4[_0x58ad('0x11')](0x1f4,_0x512281['message']));});});};exports[_0x58ad('0x23')]=function(_0x305c1f){var _0x4b0d2d=this;return new Promise(function(_0x4caf7b,_0x1d6ddd){return db[_0x58ad('0x18')]['update'](_0x305c1f[_0x58ad('0x22')],{'raw':_0x305c1f['options']?_0x305c1f['options'][_0x58ad('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x305c1f[_0x58ad('0x1a')]?_0x305c1f[_0x58ad('0x1a')][_0x58ad('0x24')]||null:null,'attributes':_0x305c1f[_0x58ad('0x1a')]?_0x305c1f['options'][_0x58ad('0x1c')]||null:null,'limit':_0x305c1f[_0x58ad('0x1a')]?_0x305c1f[_0x58ad('0x1a')][_0x58ad('0x1d')]||null:null})[_0x58ad('0xb')](function(_0x572a61){logger[_0x58ad('0xc')](_0x58ad('0x23'),_0x305c1f);logger[_0x58ad('0xe')]('UpdateMemberReport',_0x305c1f,JSON['stringify'](_0x572a61));_0x4caf7b(_0x572a61);})['catch'](function(_0x9693ee){logger['error'](_0x58ad('0x23'),_0x9693ee[_0x58ad('0x14')],_0x305c1f);_0x1d6ddd(_0x4b0d2d[_0x58ad('0x11')](0x1f4,_0x9693ee[_0x58ad('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/migration/index.js b/server/api/migration/index.js index afc7913..d7445f8 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 _0x943a=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./migration.controller','get','index','exports','multer','util','path'];(function(_0x58fbb5,_0x3d0990){var _0x3db1e3=function(_0x417efb){while(--_0x417efb){_0x58fbb5['push'](_0x58fbb5['shift']());}};_0x3db1e3(++_0x3d0990);}(_0x943a,0x1aa));var _0xa943=function(_0xe0e597,_0x415663){_0xe0e597=_0xe0e597-0x0;var _0x1e09a6=_0x943a[_0xe0e597];return _0x1e09a6;};'use strict';var multer=require(_0xa943('0x0'));var util=require(_0xa943('0x1'));var path=require(_0xa943('0x2'));var timeout=require(_0xa943('0x3'));var express=require(_0xa943('0x4'));var router=express[_0xa943('0x5')]();var fs_extra=require(_0xa943('0x6'));var auth=require(_0xa943('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0xa943('0x8'));var controller=require(_0xa943('0x9'));router[_0xa943('0xa')]('/',controller[_0xa943('0xb')]);module[_0xa943('0xc')]=router; \ No newline at end of file +var _0x9f82=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./migration.controller','get','index','exports'];(function(_0x4dfa20,_0x35afb5){var _0x146afc=function(_0x5a4344){while(--_0x5a4344){_0x4dfa20['push'](_0x4dfa20['shift']());}};_0x146afc(++_0x35afb5);}(_0x9f82,0x111));var _0x29f8=function(_0x13e741,_0x5d3c24){_0x13e741=_0x13e741-0x0;var _0x3f8bb3=_0x9f82[_0x13e741];return _0x3f8bb3;};'use strict';var multer=require('multer');var util=require(_0x29f8('0x0'));var path=require(_0x29f8('0x1'));var timeout=require(_0x29f8('0x2'));var express=require(_0x29f8('0x3'));var router=express[_0x29f8('0x4')]();var fs_extra=require(_0x29f8('0x5'));var auth=require(_0x29f8('0x6'));var interaction=require(_0x29f8('0x7'));var config=require(_0x29f8('0x8'));var controller=require(_0x29f8('0x9'));router[_0x29f8('0xa')]('/',controller[_0x29f8('0xb')]);module[_0x29f8('0xc')]=router; \ No newline at end of file diff --git a/server/api/migration/migration.attributes.js b/server/api/migration/migration.attributes.js index 33daebf..ae33331 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 _0xd5be=['STRING','sequelize','exports'];(function(_0x2e6562,_0x5733c9){var _0x1dbc84=function(_0x305c28){while(--_0x305c28){_0x2e6562['push'](_0x2e6562['shift']());}};_0x1dbc84(++_0x5733c9);}(_0xd5be,0xa6));var _0xed5b=function(_0x3b0c9d,_0x3ddeb5){_0x3b0c9d=_0x3b0c9d-0x0;var _0xcfc8d7=_0xd5be[_0x3b0c9d];return _0xcfc8d7;};'use strict';var Sequelize=require(_0xed5b('0x0'));module[_0xed5b('0x1')]={'version':{'type':Sequelize[_0xed5b('0x2')],'unique':'version'}}; \ No newline at end of file +var _0xe7f0=['sequelize','version'];(function(_0x26abd4,_0x422bfc){var _0x458578=function(_0xfcb055){while(--_0xfcb055){_0x26abd4['push'](_0x26abd4['shift']());}};_0x458578(++_0x422bfc);}(_0xe7f0,0x122));var _0x0e7f=function(_0x36103d,_0x3453b9){_0x36103d=_0x36103d-0x0;var _0x4edadd=_0xe7f0[_0x36103d];return _0x4edadd;};'use strict';var Sequelize=require(_0x0e7f('0x0'));module['exports']={'version':{'type':Sequelize['STRING'],'unique':_0x0e7f('0x1')}}; \ No newline at end of file diff --git a/server/api/migration/migration.controller.js b/server/api/migration/migration.controller.js index fa8717a..0f5aded 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 _0x248b=['map','Migration','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','rows','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','update','then','destroy','end','error','name','send','index'];(function(_0xd038ec,_0x1d14b1){var _0xc3fec=function(_0x51a09f){while(--_0x51a09f){_0xd038ec['push'](_0xd038ec['shift']());}};_0xc3fec(++_0x1d14b1);}(_0x248b,0x167));var _0xb248=function(_0x43e7d8,_0x12f692){_0x43e7d8=_0x43e7d8-0x0;var _0x24bb71=_0x248b[_0x43e7d8];return _0x24bb71;};'use strict';var emlformat=require(_0xb248('0x0'));var rimraf=require(_0xb248('0x1'));var zipdir=require(_0xb248('0x2'));var jsonpatch=require(_0xb248('0x3'));var rp=require('request-promise');var moment=require(_0xb248('0x4'));var BPromise=require(_0xb248('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0xb248('0x6'));var sox=require(_0xb248('0x7'));var csv=require(_0xb248('0x8'));var ejs=require(_0xb248('0x9'));var fs=require('fs');var fs_extra=require(_0xb248('0xa'));var _=require(_0xb248('0xb'));var squel=require(_0xb248('0xc'));var crypto=require(_0xb248('0xd'));var jsforce=require(_0xb248('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xb248('0xf'));var Redis=require(_0xb248('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xb248('0x11'));var as=require(_0xb248('0x12'));var hardwareService=require(_0xb248('0x13'));var logger=require(_0xb248('0x14'))(_0xb248('0x15'));var utils=require(_0xb248('0x16'));var config=require(_0xb248('0x17'));var licenseUtil=require(_0xb248('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x515636,_0x3419fe){_0x3419fe=_0x3419fe||0xcc;return function(_0x512ab0){if(_0x512ab0){return _0x515636['sendStatus'](_0x3419fe);}return _0x515636[_0xb248('0x19')](_0x3419fe)['end']();};}function respondWithResult(_0x461dd2,_0x5d7609){_0x5d7609=_0x5d7609||0xc8;return function(_0x13618d){if(_0x13618d){return _0x461dd2['status'](_0x5d7609)[_0xb248('0x1a')](_0x13618d);}};}function respondWithFilteredResult(_0x51d727,_0x43171e){return function(_0x42ceaf){if(_0x42ceaf){var _0x566e4e=typeof _0x43171e[_0xb248('0x1b')]==='undefined'&&typeof _0x43171e[_0xb248('0x1c')]===_0xb248('0x1d');var _0x25036d=_0x42ceaf[_0xb248('0x1e')];var _0x199560=_0x566e4e?0x0:_0x43171e[_0xb248('0x1b')];var _0x1960ba=_0x566e4e?_0x42ceaf[_0xb248('0x1e')]:_0x43171e[_0xb248('0x1b')]+_0x43171e['limit'];var _0x5a385a;if(_0x1960ba>=_0x25036d){_0x1960ba=_0x25036d;_0x5a385a=0xc8;}else{_0x5a385a=0xce;}_0x51d727['status'](_0x5a385a);return _0x51d727[_0xb248('0x1f')](_0xb248('0x20'),_0x199560+'-'+_0x1960ba+'/'+_0x25036d)['json'](_0x42ceaf);}return null;};}function patchUpdates(_0x3b33dd){return function(_0x325f04){try{jsonpatch[_0xb248('0x21')](_0x325f04,_0x3b33dd,!![]);}catch(_0x20df7b){return BPromise[_0xb248('0x22')](_0x20df7b);}return _0x325f04['save']();};}function saveUpdates(_0x39364b,_0x569d5c){return function(_0x159e6f){if(_0x159e6f){return _0x159e6f[_0xb248('0x23')](_0x39364b)[_0xb248('0x24')](function(_0x38d992){return _0x38d992;});}return null;};}function removeEntity(_0x4567e6,_0x1462ed){return function(_0x3d5a5d){if(_0x3d5a5d){return _0x3d5a5d[_0xb248('0x25')]()[_0xb248('0x24')](function(){_0x4567e6[_0xb248('0x19')](0xcc)[_0xb248('0x26')]();});}};}function handleEntityNotFound(_0x581e28,_0x4e6eea){return function(_0x3787d6){if(!_0x3787d6){_0x581e28['sendStatus'](0x194);}return _0x3787d6;};}function handleError(_0x137ba1,_0x38d49c){_0x38d49c=_0x38d49c||0x1f4;return function(_0x90bd35){logger[_0xb248('0x27')](_0x90bd35['stack']);if(_0x90bd35[_0xb248('0x28')]){delete _0x90bd35[_0xb248('0x28')];}_0x137ba1[_0xb248('0x19')](_0x38d49c)[_0xb248('0x29')](_0x90bd35);};}exports[_0xb248('0x2a')]=function(_0x7797aa,_0xa734d3){var _0xd23a06={},_0x3e7d1d={},_0x2e6437={'count':0x0,'rows':[]};var _0x12f53a=_[_0xb248('0x2b')](db[_0xb248('0x2c')][_0xb248('0x2d')],function(_0x9315e1){return{'name':_0x9315e1[_0xb248('0x2e')],'type':_0x9315e1[_0xb248('0x2f')][_0xb248('0x30')]};});_0x3e7d1d[_0xb248('0x31')]=_[_0xb248('0x2b')](_0x12f53a,_0xb248('0x28'));_0x3e7d1d['query']=_[_0xb248('0x32')](_0x7797aa[_0xb248('0x33')]);_0x3e7d1d[_0xb248('0x34')]=_[_0xb248('0x35')](_0x3e7d1d[_0xb248('0x31')],_0x3e7d1d['query']);_0xd23a06[_0xb248('0x36')]=_[_0xb248('0x35')](_0x3e7d1d['model'],qs['fields'](_0x7797aa[_0xb248('0x33')]['fields']));_0xd23a06['attributes']=_0xd23a06['attributes'][_0xb248('0x37')]?_0xd23a06[_0xb248('0x36')]:_0x3e7d1d[_0xb248('0x31')];if(!_0x7797aa[_0xb248('0x33')][_0xb248('0x38')]('nolimit')){_0xd23a06[_0xb248('0x1c')]=qs[_0xb248('0x1c')](_0x7797aa['query'][_0xb248('0x1c')]);_0xd23a06[_0xb248('0x1b')]=qs[_0xb248('0x1b')](_0x7797aa[_0xb248('0x33')][_0xb248('0x1b')]);}_0xd23a06[_0xb248('0x39')]=qs['sort'](_0x7797aa[_0xb248('0x33')][_0xb248('0x3a')]);_0xd23a06[_0xb248('0x3b')]=qs['filters'](_[_0xb248('0x3c')](_0x7797aa['query'],_0x3e7d1d[_0xb248('0x34')]),_0x12f53a);if(_0x7797aa[_0xb248('0x33')][_0xb248('0x3d')]){_0xd23a06['where']=_[_0xb248('0x3e')](_0xd23a06[_0xb248('0x3b')],{'$or':_[_0xb248('0x2b')](_0x12f53a,function(_0x19d1ee){if(_0x19d1ee[_0xb248('0x2f')]!==_0xb248('0x3f')){var _0x3b7ed1={};_0x3b7ed1[_0x19d1ee['name']]={'$like':'%'+_0x7797aa['query'][_0xb248('0x3d')]+'%'};return _0x3b7ed1;}})});}_0xd23a06=_[_0xb248('0x3e')]({},_0xd23a06,_0x7797aa[_0xb248('0x40')]);var _0x3c4bcf={'where':_0xd23a06[_0xb248('0x3b')]};return db['Migration'][_0xb248('0x1e')](_0x3c4bcf)['then'](function(_0x22decd){_0x2e6437[_0xb248('0x1e')]=_0x22decd;if(_0x7797aa['query'][_0xb248('0x41')]){_0xd23a06['include']=[{'all':!![]}];}return db[_0xb248('0x2c')]['findAll'](_0xd23a06);})[_0xb248('0x24')](function(_0x1b280c){_0x2e6437[_0xb248('0x42')]=_0x1b280c;return _0x2e6437;})[_0xb248('0x24')](respondWithFilteredResult(_0xa734d3,_0xd23a06))['catch'](handleError(_0xa734d3,null));}; \ No newline at end of file +var _0x35b4=['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','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','error','stack','name','index','map','Migration','rawAttributes','key','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filter','merge','type','includeAll','include','findAll','rows','catch','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','fs-extra'];(function(_0x2616cd,_0x6b2d90){var _0x4e1fcb=function(_0x2562cb){while(--_0x2562cb){_0x2616cd['push'](_0x2616cd['shift']());}};_0x4e1fcb(++_0x6b2d90);}(_0x35b4,0x14e));var _0x435b=function(_0x5f513c,_0x100e31){_0x5f513c=_0x5f513c-0x0;var _0xa9dc8f=_0x35b4[_0x5f513c];return _0xa9dc8f;};'use strict';var emlformat=require(_0x435b('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x435b('0x1'));var jsonpatch=require(_0x435b('0x2'));var rp=require(_0x435b('0x3'));var moment=require('moment');var BPromise=require(_0x435b('0x4'));var Mustache=require(_0x435b('0x5'));var util=require('util');var path=require(_0x435b('0x6'));var sox=require(_0x435b('0x7'));var csv=require(_0x435b('0x8'));var ejs=require(_0x435b('0x9'));var fs=require('fs');var fs_extra=require(_0x435b('0xa'));var _=require(_0x435b('0xb'));var squel=require(_0x435b('0xc'));var crypto=require(_0x435b('0xd'));var jsforce=require(_0x435b('0xe'));var deskjs=require(_0x435b('0xf'));var toCsv=require(_0x435b('0x8'));var querystring=require(_0x435b('0x10'));var Papa=require(_0x435b('0x11'));var Redis=require(_0x435b('0x12'));var authService=require(_0x435b('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x435b('0x14'));var hardwareService=require(_0x435b('0x15'));var logger=require(_0x435b('0x16'))(_0x435b('0x17'));var utils=require('../../config/utils');var config=require(_0x435b('0x18'));var licenseUtil=require(_0x435b('0x19'));var db=require(_0x435b('0x1a'))['db'];function respondWithStatusCode(_0x2853ab,_0x160174){_0x160174=_0x160174||0xcc;return function(_0x58b643){if(_0x58b643){return _0x2853ab[_0x435b('0x1b')](_0x160174);}return _0x2853ab[_0x435b('0x1c')](_0x160174)[_0x435b('0x1d')]();};}function respondWithResult(_0x144539,_0x2837f2){_0x2837f2=_0x2837f2||0xc8;return function(_0xc97186){if(_0xc97186){return _0x144539['status'](_0x2837f2)['json'](_0xc97186);}};}function respondWithFilteredResult(_0x3bda64,_0x526236){return function(_0x22dd37){if(_0x22dd37){var _0x5b3968=typeof _0x526236[_0x435b('0x1e')]===_0x435b('0x1f')&&typeof _0x526236[_0x435b('0x20')]==='undefined';var _0x5e726b=_0x22dd37[_0x435b('0x21')];var _0x4822b9=_0x5b3968?0x0:_0x526236[_0x435b('0x1e')];var _0x568665=_0x5b3968?_0x22dd37[_0x435b('0x21')]:_0x526236[_0x435b('0x1e')]+_0x526236[_0x435b('0x20')];var _0x5c7e77;if(_0x568665>=_0x5e726b){_0x568665=_0x5e726b;_0x5c7e77=0xc8;}else{_0x5c7e77=0xce;}_0x3bda64['status'](_0x5c7e77);return _0x3bda64[_0x435b('0x22')](_0x435b('0x23'),_0x4822b9+'-'+_0x568665+'/'+_0x5e726b)['json'](_0x22dd37);}return null;};}function patchUpdates(_0xfcb005){return function(_0x1eeb37){try{jsonpatch[_0x435b('0x24')](_0x1eeb37,_0xfcb005,!![]);}catch(_0x377f93){return BPromise[_0x435b('0x25')](_0x377f93);}return _0x1eeb37[_0x435b('0x26')]();};}function saveUpdates(_0x2141a3,_0x45895c){return function(_0x252e53){if(_0x252e53){return _0x252e53[_0x435b('0x27')](_0x2141a3)[_0x435b('0x28')](function(_0x53715b){return _0x53715b;});}return null;};}function removeEntity(_0x38acdd,_0x5bb74a){return function(_0x2aff9c){if(_0x2aff9c){return _0x2aff9c['destroy']()[_0x435b('0x28')](function(){_0x38acdd['status'](0xcc)[_0x435b('0x1d')]();});}};}function handleEntityNotFound(_0x38a600,_0x381d69){return function(_0xf1c5a0){if(!_0xf1c5a0){_0x38a600[_0x435b('0x1b')](0x194);}return _0xf1c5a0;};}function handleError(_0x4b3643,_0x306846){_0x306846=_0x306846||0x1f4;return function(_0x86e22a){logger[_0x435b('0x29')](_0x86e22a[_0x435b('0x2a')]);if(_0x86e22a['name']){delete _0x86e22a[_0x435b('0x2b')];}_0x4b3643[_0x435b('0x1c')](_0x306846)['send'](_0x86e22a);};}exports[_0x435b('0x2c')]=function(_0x2c0f06,_0x2a61d3){var _0x54a8f7={},_0x54160={},_0x4811a5={'count':0x0,'rows':[]};var _0x32cad3=_[_0x435b('0x2d')](db[_0x435b('0x2e')][_0x435b('0x2f')],function(_0x4cd768){return{'name':_0x4cd768['fieldName'],'type':_0x4cd768['type'][_0x435b('0x30')]};});_0x54160['model']=_[_0x435b('0x2d')](_0x32cad3,_0x435b('0x2b'));_0x54160[_0x435b('0x31')]=_[_0x435b('0x32')](_0x2c0f06[_0x435b('0x31')]);_0x54160[_0x435b('0x33')]=_[_0x435b('0x34')](_0x54160[_0x435b('0x35')],_0x54160[_0x435b('0x31')]);_0x54a8f7[_0x435b('0x36')]=_['intersection'](_0x54160[_0x435b('0x35')],qs[_0x435b('0x37')](_0x2c0f06[_0x435b('0x31')]['fields']));_0x54a8f7[_0x435b('0x36')]=_0x54a8f7[_0x435b('0x36')]['length']?_0x54a8f7[_0x435b('0x36')]:_0x54160[_0x435b('0x35')];if(!_0x2c0f06['query'][_0x435b('0x38')](_0x435b('0x39'))){_0x54a8f7['limit']=qs[_0x435b('0x20')](_0x2c0f06['query'][_0x435b('0x20')]);_0x54a8f7[_0x435b('0x1e')]=qs[_0x435b('0x1e')](_0x2c0f06['query']['offset']);}_0x54a8f7['order']=qs[_0x435b('0x3a')](_0x2c0f06[_0x435b('0x31')]['sort']);_0x54a8f7[_0x435b('0x3b')]=qs[_0x435b('0x33')](_[_0x435b('0x3c')](_0x2c0f06['query'],_0x54160[_0x435b('0x33')]),_0x32cad3);if(_0x2c0f06[_0x435b('0x31')][_0x435b('0x3d')]){_0x54a8f7[_0x435b('0x3b')]=_[_0x435b('0x3e')](_0x54a8f7['where'],{'$or':_[_0x435b('0x2d')](_0x32cad3,function(_0x3453c5){if(_0x3453c5[_0x435b('0x3f')]!=='VIRTUAL'){var _0x97f1be={};_0x97f1be[_0x3453c5[_0x435b('0x2b')]]={'$like':'%'+_0x2c0f06[_0x435b('0x31')][_0x435b('0x3d')]+'%'};return _0x97f1be;}})});}_0x54a8f7=_[_0x435b('0x3e')]({},_0x54a8f7,_0x2c0f06['options']);var _0x286637={'where':_0x54a8f7['where']};return db[_0x435b('0x2e')][_0x435b('0x21')](_0x286637)[_0x435b('0x28')](function(_0x55dd19){_0x4811a5[_0x435b('0x21')]=_0x55dd19;if(_0x2c0f06['query'][_0x435b('0x40')]){_0x54a8f7[_0x435b('0x41')]=[{'all':!![]}];}return db[_0x435b('0x2e')][_0x435b('0x42')](_0x54a8f7);})['then'](function(_0x262f28){_0x4811a5[_0x435b('0x43')]=_0x262f28;return _0x4811a5;})['then'](respondWithFilteredResult(_0x2a61d3,_0x54a8f7))[_0x435b('0x44')](handleError(_0x2a61d3,null));}; \ No newline at end of file diff --git a/server/api/migration/migration.model.js b/server/api/migration/migration.model.js index e2641e6..08fe09c 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 _0x273f=['moment','bluebird','request-promise','rimraf','../../config/environment','./migration.attributes','exports','define','migrations','lodash','util','api'];(function(_0x1dbb4a,_0x2a2803){var _0x537b13=function(_0x2c45e1){while(--_0x2c45e1){_0x1dbb4a['push'](_0x1dbb4a['shift']());}};_0x537b13(++_0x2a2803);}(_0x273f,0xd5));var _0xf273=function(_0x434d98,_0xf8b99b){_0x434d98=_0x434d98-0x0;var _0x206138=_0x273f[_0x434d98];return _0x206138;};'use strict';var _=require(_0xf273('0x0'));var util=require(_0xf273('0x1'));var logger=require('../../config/logger')(_0xf273('0x2'));var moment=require(_0xf273('0x3'));var BPromise=require(_0xf273('0x4'));var rp=require(_0xf273('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf273('0x6'));var config=require(_0xf273('0x7'));var attributes=require(_0xf273('0x8'));module[_0xf273('0x9')]=function(_0x23616f,_0x392788){return _0x23616f[_0xf273('0xa')]('Migration',attributes,{'tableName':_0xf273('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcb55=['util','../../config/logger','bluebird','request-promise','path','../../config/environment','./migration.attributes','exports','define','Migration','migrations','lodash'];(function(_0x2283dc,_0x2fcfc5){var _0x16db90=function(_0x376c35){while(--_0x376c35){_0x2283dc['push'](_0x2283dc['shift']());}};_0x16db90(++_0x2fcfc5);}(_0xcb55,0x1a3));var _0x5cb5=function(_0x4e65b9,_0x1b4c3e){_0x4e65b9=_0x4e65b9-0x0;var _0xedcb74=_0xcb55[_0x4e65b9];return _0xedcb74;};'use strict';var _=require(_0x5cb5('0x0'));var util=require(_0x5cb5('0x1'));var logger=require(_0x5cb5('0x2'))('api');var moment=require('moment');var BPromise=require(_0x5cb5('0x3'));var rp=require(_0x5cb5('0x4'));var fs=require('fs');var path=require(_0x5cb5('0x5'));var rimraf=require('rimraf');var config=require(_0x5cb5('0x6'));var attributes=require(_0x5cb5('0x7'));module[_0x5cb5('0x8')]=function(_0x4e53e5,_0x40aadb){return _0x4e53e5[_0x5cb5('0x9')](_0x5cb5('0xa'),attributes,{'tableName':_0x5cb5('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/migration/migration.rpc.js b/server/api/migration/migration.rpc.js index fcf4409..1844e01 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 _0x14b7=['then','info','Migration,\x20%s,\x20%s','request\x20sent','Migration,\x20%s,\x20%s,\x20%s','error','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x14b7,0x144));var _0x714b=function(_0x368c85,_0x586b0a){_0x368c85=_0x368c85-0x0;var _0x3477c2=_0x14b7[_0x368c85];return _0x3477c2;};'use strict';var _=require(_0x714b('0x0'));var util=require(_0x714b('0x1'));var moment=require(_0x714b('0x2'));var BPromise=require(_0x714b('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x714b('0x4'));var db=require(_0x714b('0x5'))['db'];var utils=require(_0x714b('0x6'));var logger=require(_0x714b('0x7'))(_0x714b('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x714b('0x9')][_0x714b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2a0a91,_0x5ee9a5,_0x39b5e4){return new BPromise(function(_0x26489c,_0x53f14c){return client[_0x714b('0xb')](_0x2a0a91,_0x39b5e4)[_0x714b('0xc')](function(_0x50dab0){logger[_0x714b('0xd')](_0x714b('0xe'),_0x5ee9a5,_0x714b('0xf'));logger['debug'](_0x714b('0x10'),_0x5ee9a5,'request\x20sent',JSON['stringify'](_0x50dab0));if(_0x50dab0[_0x714b('0x11')]){if(_0x50dab0[_0x714b('0x11')]['code']===0x1f4){logger[_0x714b('0x11')](_0x714b('0xe'),_0x5ee9a5,_0x50dab0[_0x714b('0x11')][_0x714b('0x12')]);return _0x53f14c(_0x50dab0['error'][_0x714b('0x12')]);}logger['error'](_0x714b('0xe'),_0x5ee9a5,_0x50dab0[_0x714b('0x11')][_0x714b('0x12')]);return _0x26489c(_0x50dab0[_0x714b('0x11')][_0x714b('0x12')]);}else{logger[_0x714b('0xd')](_0x714b('0xe'),_0x5ee9a5,_0x714b('0xf'));_0x26489c(_0x50dab0[_0x714b('0x13')][_0x714b('0x12')]);}})[_0x714b('0x14')](function(_0x1d81b3){logger['error'](_0x714b('0xe'),_0x5ee9a5,_0x1d81b3);_0x53f14c(_0x1d81b3);});});} \ No newline at end of file +var _0xbbfa=['Migration,\x20%s,\x20%s,\x20%s','error','code','Migration,\x20%s,\x20%s','message','catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','request\x20sent'];(function(_0x2e35f7,_0x3e0691){var _0x37ca08=function(_0x1be895){while(--_0x1be895){_0x2e35f7['push'](_0x2e35f7['shift']());}};_0x37ca08(++_0x3e0691);}(_0xbbfa,0x1e9));var _0xabbf=function(_0x23f8d2,_0x301fec){_0x23f8d2=_0x23f8d2-0x0;var _0x5d174b=_0xbbfa[_0x23f8d2];return _0x5d174b;};'use strict';var _=require(_0xabbf('0x0'));var util=require('util');var moment=require(_0xabbf('0x1'));var BPromise=require('bluebird');var rs=require(_0xabbf('0x2'));var fs=require('fs');var Redis=require(_0xabbf('0x3'));var db=require(_0xabbf('0x4'))['db'];var utils=require(_0xabbf('0x5'));var logger=require(_0xabbf('0x6'))(_0xabbf('0x7'));var config=require(_0xabbf('0x8'));var jayson=require(_0xabbf('0x9'));var client=jayson[_0xabbf('0xa')][_0xabbf('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x45b7d6,_0x58f0a8,_0x5b471b){return new BPromise(function(_0x536a4c,_0x1380cd){return client[_0xabbf('0xc')](_0x45b7d6,_0x5b471b)['then'](function(_0x5f35ee){logger[_0xabbf('0xd')]('Migration,\x20%s,\x20%s',_0x58f0a8,_0xabbf('0xe'));logger['debug'](_0xabbf('0xf'),_0x58f0a8,'request\x20sent',JSON['stringify'](_0x5f35ee));if(_0x5f35ee[_0xabbf('0x10')]){if(_0x5f35ee[_0xabbf('0x10')][_0xabbf('0x11')]===0x1f4){logger[_0xabbf('0x10')](_0xabbf('0x12'),_0x58f0a8,_0x5f35ee[_0xabbf('0x10')][_0xabbf('0x13')]);return _0x1380cd(_0x5f35ee[_0xabbf('0x10')][_0xabbf('0x13')]);}logger['error'](_0xabbf('0x12'),_0x58f0a8,_0x5f35ee['error'][_0xabbf('0x13')]);return _0x536a4c(_0x5f35ee['error'][_0xabbf('0x13')]);}else{logger[_0xabbf('0xd')](_0xabbf('0x12'),_0x58f0a8,_0xabbf('0xe'));_0x536a4c(_0x5f35ee['result'][_0xabbf('0x13')]);}})[_0xabbf('0x14')](function(_0x31245d){logger[_0xabbf('0x10')](_0xabbf('0x12'),_0x58f0a8,_0x31245d);_0x1380cd(_0x31245d);});});} \ No newline at end of file diff --git a/server/api/network/index.js b/server/api/network/index.js index 6aacd10..7572411 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 _0x649f=['update','destroy','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./network.controller','get','isAuthenticated','index','show','post','put','/:id'];(function(_0x2d435b,_0x1943f6){var _0x10ff4d=function(_0x5142c6){while(--_0x5142c6){_0x2d435b['push'](_0x2d435b['shift']());}};_0x10ff4d(++_0x1943f6);}(_0x649f,0x93));var _0xf649=function(_0x1573ea,_0x434f02){_0x1573ea=_0x1573ea-0x0;var _0x51c0e2=_0x649f[_0x1573ea];return _0x51c0e2;};'use strict';var multer=require(_0xf649('0x0'));var util=require(_0xf649('0x1'));var path=require(_0xf649('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xf649('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xf649('0x4'));var interaction=require(_0xf649('0x5'));var config=require(_0xf649('0x6'));var controller=require(_0xf649('0x7'));router[_0xf649('0x8')]('/',auth[_0xf649('0x9')](),controller[_0xf649('0xa')]);router[_0xf649('0x8')]('/:id',auth['isAuthenticated'](),controller[_0xf649('0xb')]);router[_0xf649('0xc')]('/',auth[_0xf649('0x9')](),controller['create']);router[_0xf649('0xd')](_0xf649('0xe'),auth[_0xf649('0x9')](),controller[_0xf649('0xf')]);router['delete'](_0xf649('0xe'),auth[_0xf649('0x9')](),controller[_0xf649('0x10')]);module[_0xf649('0x11')]=router; \ No newline at end of file +var _0xea4e=['fs-extra','../../components/auth/service','../../config/environment','./network.controller','get','isAuthenticated','index','/:id','show','put','update','delete','destroy','multer','express'];(function(_0x559fbe,_0x165810){var _0x1e8dcf=function(_0x6545d6){while(--_0x6545d6){_0x559fbe['push'](_0x559fbe['shift']());}};_0x1e8dcf(++_0x165810);}(_0xea4e,0x10c));var _0xeea4=function(_0x9e55f6,_0x5df434){_0x9e55f6=_0x9e55f6-0x0;var _0x220e55=_0xea4e[_0x9e55f6];return _0x220e55;};'use strict';var multer=require(_0xeea4('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0xeea4('0x1'));var router=express['Router']();var fs_extra=require(_0xeea4('0x2'));var auth=require(_0xeea4('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0xeea4('0x4'));var controller=require(_0xeea4('0x5'));router[_0xeea4('0x6')]('/',auth[_0xeea4('0x7')](),controller[_0xeea4('0x8')]);router[_0xeea4('0x6')](_0xeea4('0x9'),auth[_0xeea4('0x7')](),controller[_0xeea4('0xa')]);router['post']('/',auth[_0xeea4('0x7')](),controller['create']);router[_0xeea4('0xb')](_0xeea4('0x9'),auth[_0xeea4('0x7')](),controller[_0xeea4('0xc')]);router[_0xeea4('0xd')](_0xeea4('0x9'),auth[_0xeea4('0x7')](),controller[_0xeea4('0xe')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/network/network.attributes.js b/server/api/network/network.attributes.js index 2ecdf44..d1c3009 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 _0x7ec6=['localnet','stun','turn','exports','ENUM'];(function(_0x3f9044,_0x37a904){var _0x2988dd=function(_0x447542){while(--_0x447542){_0x3f9044['push'](_0x3f9044['shift']());}};_0x2988dd(++_0x37a904);}(_0x7ec6,0x102));var _0x67ec=function(_0xe2b8fc,_0x3ec76a){_0xe2b8fc=_0xe2b8fc-0x0;var _0x1bfefb=_0x7ec6[_0xe2b8fc];return _0x1bfefb;};'use strict';var Sequelize=require('sequelize');module[_0x67ec('0x0')]={'type':{'type':Sequelize[_0x67ec('0x1')](_0x67ec('0x2'),'externip',_0x67ec('0x3'),_0x67ec('0x4'))},'value':{'type':Sequelize['STRING']},'username':{'type':Sequelize['STRING']},'password':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xe61a=['turn','STRING','exports','ENUM','externip'];(function(_0x1bb812,_0x23eacc){var _0x372adb=function(_0x5ad456){while(--_0x5ad456){_0x1bb812['push'](_0x1bb812['shift']());}};_0x372adb(++_0x23eacc);}(_0xe61a,0x10b));var _0xae61=function(_0x2ded38,_0x25837d){_0x2ded38=_0x2ded38-0x0;var _0x5d1a45=_0xe61a[_0x2ded38];return _0x5d1a45;};'use strict';var Sequelize=require('sequelize');module[_0xae61('0x0')]={'type':{'type':Sequelize[_0xae61('0x1')]('localnet',_0xae61('0x2'),'stun',_0xae61('0x3'))},'value':{'type':Sequelize[_0xae61('0x4')]},'username':{'type':Sequelize[_0xae61('0x4')]},'password':{'type':Sequelize[_0xae61('0x4')]}}; \ No newline at end of file diff --git a/server/api/network/network.controller.js b/server/api/network/network.controller.js index 7f9bc02..bff1ace 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 _0x50e2=['VIRTUAL','options','includeAll','findAll','rows','show','params','include','find','body','toUpperCase','STUN','readFileSync','join','root','server/files/templates/stun_multiple.ejs','utf8','render','writeFileSync','/etc/asterisk/stun_xcally.conf','create','TURN','server/files/templates/turn_multiple.ejs','Reload','res_stun_monitor.so','server/files/templates/network.ejs','format','/etc/asterisk/sip_xcally_%s.conf','toLowerCase','chan_sip.so','/etc/asterisk/turn_xcally.conf','util','path','ejs','lodash','../../config/logger','api','../../config/environment','../../mysqldb','jayson/promise','client','request','info','Network,\x20%s,\x20%s','request\x20sent','debug','Network,\x20%s,\x20%s,\x20%s','error','code','message','catch','json','limit','undefined','count','offset','status','set','Content-Range','update','then','destroy','end','stack','name','send','map','Network','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x50e2,0x1cd));var _0x250e=function(_0x19b3f8,_0x150751){_0x19b3f8=_0x19b3f8-0x0;var _0x22c3a1=_0x50e2[_0x19b3f8];return _0x22c3a1;};'use strict';var util=require(_0x250e('0x0'));var path=require(_0x250e('0x1'));var ejs=require(_0x250e('0x2'));var fs=require('fs');var _=require(_0x250e('0x3'));var qs=require('../../components/parsers/qs');var logger=require(_0x250e('0x4'))(_0x250e('0x5'));var config=require(_0x250e('0x6'));var db=require(_0x250e('0x7'))['db'];var jayson=require(_0x250e('0x8'));var client=jayson[_0x250e('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1ce580,_0x5ca90c,_0x3c0c57,_0x3c35ea){return new Promise(function(_0x39fcf7,_0x4aae21){var _0x5f2073=_0x3c35ea||client;return _0x5f2073[_0x250e('0xa')](_0x1ce580,_0x3c0c57)['then'](function(_0x27cb0f){logger[_0x250e('0xb')](_0x250e('0xc'),_0x5ca90c,_0x250e('0xd'));logger[_0x250e('0xe')](_0x250e('0xf'),_0x5ca90c,'request\x20sent',JSON['stringify'](_0x27cb0f));if(_0x27cb0f[_0x250e('0x10')]){if(_0x27cb0f[_0x250e('0x10')][_0x250e('0x11')]===0x1f4){logger[_0x250e('0x10')](_0x250e('0xc'),_0x5ca90c,_0x27cb0f['error'][_0x250e('0x12')]);return _0x4aae21(_0x27cb0f[_0x250e('0x10')][_0x250e('0x12')]);}logger[_0x250e('0x10')](_0x250e('0xc'),_0x5ca90c,_0x27cb0f[_0x250e('0x10')][_0x250e('0x12')]);return _0x39fcf7(_0x27cb0f[_0x250e('0x10')][_0x250e('0x12')]);}else{logger[_0x250e('0xb')](_0x250e('0xc'),_0x5ca90c,_0x250e('0xd'));_0x39fcf7(_0x27cb0f['result'][_0x250e('0x12')]);}})[_0x250e('0x13')](function(_0x28e0be){logger['error'](_0x250e('0xc'),_0x5ca90c,_0x28e0be);_0x4aae21(_0x28e0be);});});}function respondWithResult(_0x19c4ca,_0x5bfd08){_0x5bfd08=_0x5bfd08||0xc8;return function(_0x2b85bb){if(_0x2b85bb){return _0x19c4ca['status'](_0x5bfd08)[_0x250e('0x14')](_0x2b85bb);}};}function respondWithFilteredResult(_0x18da1c,_0x38ce96){return function(_0xabdb6a){if(_0xabdb6a){var _0xe096a8=typeof _0x38ce96['offset']==='undefined'&&typeof _0x38ce96[_0x250e('0x15')]===_0x250e('0x16');var _0x22308c=_0xabdb6a[_0x250e('0x17')];var _0x42cb7e=_0xe096a8?0x0:_0x38ce96[_0x250e('0x18')];var _0x19c0fe=_0xe096a8?_0xabdb6a[_0x250e('0x17')]:_0x38ce96[_0x250e('0x18')]+_0x38ce96[_0x250e('0x15')];var _0x576407;if(_0x19c0fe>=_0x22308c){_0x19c0fe=_0x22308c;_0x576407=0xc8;}else{_0x576407=0xce;}_0x18da1c[_0x250e('0x19')](_0x576407);return _0x18da1c[_0x250e('0x1a')](_0x250e('0x1b'),_0x42cb7e+'-'+_0x19c0fe+'/'+_0x22308c)[_0x250e('0x14')](_0xabdb6a);}return null;};}function saveUpdates(_0x195b48){return function(_0x42891c){if(_0x42891c){return _0x42891c[_0x250e('0x1c')](_0x195b48)[_0x250e('0x1d')](function(_0x3b429e){return _0x3b429e;});}return null;};}function removeEntity(_0x130cc8){return function(_0x354ed6){if(_0x354ed6){return _0x354ed6[_0x250e('0x1e')]()[_0x250e('0x1d')](function(){_0x130cc8['status'](0xcc)[_0x250e('0x1f')]();});}};}function handleEntityNotFound(_0x28804c){return function(_0x2258e4){if(!_0x2258e4){_0x28804c['sendStatus'](0x194);}return _0x2258e4;};}function handleError(_0x189ed1,_0x13b7d0){_0x13b7d0=_0x13b7d0||0x1f4;return function(_0x4230db){logger['error'](_0x4230db[_0x250e('0x20')]);if(_0x4230db[_0x250e('0x21')]){delete _0x4230db[_0x250e('0x21')];}_0x189ed1[_0x250e('0x19')](_0x13b7d0)[_0x250e('0x22')](_0x4230db);};}exports['index']=function(_0x5aa3f7,_0x1fd9a2){var _0x5a042f={},_0x4b77d0={},_0x920d6e={'count':0x0,'rows':[]};var _0x22145b=_[_0x250e('0x23')](db[_0x250e('0x24')][_0x250e('0x25')],function(_0xd10cc4){return{'name':_0xd10cc4[_0x250e('0x26')],'type':_0xd10cc4[_0x250e('0x27')][_0x250e('0x28')]};});_0x4b77d0['model']=_[_0x250e('0x23')](_0x22145b,_0x250e('0x21'));_0x4b77d0[_0x250e('0x29')]=_[_0x250e('0x2a')](_0x5aa3f7[_0x250e('0x29')]);_0x4b77d0[_0x250e('0x2b')]=_[_0x250e('0x2c')](_0x4b77d0[_0x250e('0x2d')],_0x4b77d0[_0x250e('0x29')]);_0x5a042f[_0x250e('0x2e')]=_[_0x250e('0x2c')](_0x4b77d0[_0x250e('0x2d')],qs['fields'](_0x5aa3f7[_0x250e('0x29')][_0x250e('0x2f')]));_0x5a042f[_0x250e('0x2e')]=_0x5a042f[_0x250e('0x2e')][_0x250e('0x30')]?_0x5a042f[_0x250e('0x2e')]:_0x4b77d0[_0x250e('0x2d')];if(!_0x5aa3f7[_0x250e('0x29')][_0x250e('0x31')](_0x250e('0x32'))){_0x5a042f[_0x250e('0x15')]=qs[_0x250e('0x15')](_0x5aa3f7[_0x250e('0x29')][_0x250e('0x15')]);_0x5a042f[_0x250e('0x18')]=qs['offset'](_0x5aa3f7[_0x250e('0x29')]['offset']);}_0x5a042f['order']=qs[_0x250e('0x33')](_0x5aa3f7[_0x250e('0x29')][_0x250e('0x33')]);_0x5a042f[_0x250e('0x34')]=qs[_0x250e('0x2b')](_['pick'](_0x5aa3f7[_0x250e('0x29')],_0x4b77d0['filters']),_0x22145b);if(_0x5aa3f7[_0x250e('0x29')][_0x250e('0x35')]){_0x5a042f[_0x250e('0x34')]=_[_0x250e('0x36')](_0x5a042f['where'],{'$or':_[_0x250e('0x23')](_0x22145b,function(_0x59fd58){if(_0x59fd58[_0x250e('0x27')]!==_0x250e('0x37')){var _0x3cc175={};_0x3cc175[_0x59fd58['name']]={'$like':'%'+_0x5aa3f7[_0x250e('0x29')][_0x250e('0x35')]+'%'};return _0x3cc175;}})});}_0x5a042f=_[_0x250e('0x36')]({},_0x5a042f,_0x5aa3f7[_0x250e('0x38')]);var _0x501f54={'where':_0x5a042f['where']};return db[_0x250e('0x24')][_0x250e('0x17')](_0x501f54)[_0x250e('0x1d')](function(_0x34bc2e){_0x920d6e['count']=_0x34bc2e;if(_0x5aa3f7['query'][_0x250e('0x39')]){_0x5a042f['include']=[{'all':!![]}];}return db[_0x250e('0x24')][_0x250e('0x3a')](_0x5a042f);})[_0x250e('0x1d')](function(_0x41cfd7){_0x920d6e[_0x250e('0x3b')]=_0x41cfd7;return _0x920d6e;})[_0x250e('0x1d')](respondWithFilteredResult(_0x1fd9a2,_0x5a042f))[_0x250e('0x13')](handleError(_0x1fd9a2,null));};exports[_0x250e('0x3c')]=function(_0x6816cc,_0x1f1d26){var _0x3a22b5={'raw':!![],'where':{'id':_0x6816cc[_0x250e('0x3d')]['id']}},_0x76bb67={};_0x76bb67['model']=_[_0x250e('0x2a')](db[_0x250e('0x24')][_0x250e('0x25')]);_0x76bb67[_0x250e('0x29')]=_['keys'](_0x6816cc['query']);_0x76bb67[_0x250e('0x2b')]=_['intersection'](_0x76bb67['model'],_0x76bb67['query']);_0x3a22b5['attributes']=_[_0x250e('0x2c')](_0x76bb67[_0x250e('0x2d')],qs[_0x250e('0x2f')](_0x6816cc['query'][_0x250e('0x2f')]));_0x3a22b5['attributes']=_0x3a22b5[_0x250e('0x2e')][_0x250e('0x30')]?_0x3a22b5[_0x250e('0x2e')]:_0x76bb67[_0x250e('0x2d')];if(_0x6816cc[_0x250e('0x29')][_0x250e('0x39')]){_0x3a22b5[_0x250e('0x3e')]=[{'all':!![]}];}_0x3a22b5=_['merge']({},_0x3a22b5,_0x6816cc[_0x250e('0x38')]);return db[_0x250e('0x24')][_0x250e('0x3f')](_0x3a22b5)['then'](handleEntityNotFound(_0x1f1d26,null))[_0x250e('0x1d')](respondWithResult(_0x1f1d26,null))[_0x250e('0x13')](handleError(_0x1f1d26,null));};exports['create']=function(_0x1fa718,_0x549252){var _0x32d6be;return db[_0x250e('0x24')]['create'](_0x1fa718[_0x250e('0x40')],{'raw':!![]})[_0x250e('0x1d')](function(_0x424bf3){_0x32d6be=_0x424bf3;return db[_0x250e('0x24')][_0x250e('0x3a')]({'where':{'type':_0x1fa718[_0x250e('0x40')]['type']},'raw':!![]});})[_0x250e('0x1d')](function(_0x1becd4){if(_0x32d6be[_0x250e('0x27')][_0x250e('0x41')]()==_0x250e('0x42')){var _0x35d545=fs[_0x250e('0x43')](path[_0x250e('0x44')](config[_0x250e('0x45')],_0x250e('0x46')),_0x250e('0x47'));var _0x299b13=ejs[_0x250e('0x48')](_0x35d545,{'networks':_0x1becd4||[]});fs[_0x250e('0x49')](_0x250e('0x4a'),_0x299b13);return respondWithRpcPromise('Reload',_0x250e('0x4b'),{'module':'res_stun_monitor.so'});}else if(_0x32d6be[_0x250e('0x27')][_0x250e('0x41')]()==_0x250e('0x4c')){var _0xb7abbf=fs[_0x250e('0x43')](path['join'](config[_0x250e('0x45')],_0x250e('0x4d')),_0x250e('0x47'));var _0x232248=ejs[_0x250e('0x48')](_0xb7abbf,{'networks':_0x1becd4||[]});fs[_0x250e('0x49')]('/etc/asterisk/turn_xcally.conf',_0x232248);return respondWithRpcPromise(_0x250e('0x4e'),_0x250e('0x4b'),{'module':_0x250e('0x4f')});}else{var _0x41b682=fs[_0x250e('0x43')](path['join'](config[_0x250e('0x45')],_0x250e('0x50')),_0x250e('0x47'));var _0x296451=ejs[_0x250e('0x48')](_0x41b682,{'networks':_0x1becd4||[]});fs['writeFileSync'](util[_0x250e('0x51')](_0x250e('0x52'),_0x1fa718[_0x250e('0x40')][_0x250e('0x27')][_0x250e('0x53')]()),_0x296451);return respondWithRpcPromise(_0x250e('0x4e'),'create',{'module':_0x250e('0x54')});}})[_0x250e('0x1d')](function(){return _0x32d6be;})['then'](respondWithResult(_0x549252,0xc9))[_0x250e('0x13')](handleError(_0x549252,null));};exports['update']=function(_0x59fbaf,_0x7fd944){var _0x5b23db;return db[_0x250e('0x24')][_0x250e('0x3f')]({'where':{'id':_0x59fbaf[_0x250e('0x3d')]['id']}})[_0x250e('0x1d')](handleEntityNotFound(_0x7fd944,null))['then'](saveUpdates(_0x59fbaf[_0x250e('0x40')],null))[_0x250e('0x1d')](function(_0x43f60d){if(_0x43f60d){_0x5b23db=_0x43f60d;return db[_0x250e('0x24')][_0x250e('0x3a')]({'where':{'type':_0x5b23db[_0x250e('0x27')]},'raw':!![]});}return null;})[_0x250e('0x1d')](function(_0x170946){if(_0x5b23db['type'][_0x250e('0x41')]()=='STUN'){var _0x5e416b=fs[_0x250e('0x43')](path[_0x250e('0x44')](config[_0x250e('0x45')],'server/files/templates/stun_multiple.ejs'),_0x250e('0x47'));var _0x3e303a=ejs[_0x250e('0x48')](_0x5e416b,{'networks':_0x170946||[]});fs[_0x250e('0x49')](_0x250e('0x4a'),_0x3e303a);return respondWithRpcPromise(_0x250e('0x4e'),_0x250e('0x1c'),{'module':'res_stun_monitor.so'});}else if(_0x5b23db[_0x250e('0x27')][_0x250e('0x41')]()==_0x250e('0x4c')){var _0x55e83f=fs[_0x250e('0x43')](path['join'](config[_0x250e('0x45')],_0x250e('0x4d')),_0x250e('0x47'));var _0x21d702=ejs['render'](_0x55e83f,{'networks':_0x170946||[]});fs['writeFileSync'](_0x250e('0x55'),_0x21d702);return respondWithRpcPromise(_0x250e('0x4e'),_0x250e('0x1c'),{'module':_0x250e('0x4f')});}else{var _0x133282=fs[_0x250e('0x43')](path[_0x250e('0x44')](config[_0x250e('0x45')],_0x250e('0x50')),_0x250e('0x47'));var _0xe8a7be=ejs[_0x250e('0x48')](_0x133282,{'networks':_0x170946||[]});fs[_0x250e('0x49')](util[_0x250e('0x51')](_0x250e('0x52'),_0x59fbaf[_0x250e('0x40')][_0x250e('0x27')]['toLowerCase']()),_0xe8a7be);return respondWithRpcPromise('Reload',_0x250e('0x1c'),{'module':_0x250e('0x54')});}})['then'](function(_0x2f43f0){if(_0x2f43f0){return _0x5b23db;}return null;})[_0x250e('0x1d')](respondWithResult(_0x7fd944,null))['catch'](handleError(_0x7fd944,null));};exports['destroy']=function(_0xacd764,_0x48147f){var _0x188c06;return db[_0x250e('0x24')]['find']({'where':{'id':_0xacd764[_0x250e('0x3d')]['id']}})['then'](function(_0x4546f3){_0x188c06=_0x4546f3;return _0x4546f3;})[_0x250e('0x1d')](handleEntityNotFound(_0x48147f,null))['then'](removeEntity(_0x48147f,null))['then'](function(){if(_0x188c06){return db[_0x250e('0x24')][_0x250e('0x3a')]({'where':{'type':_0x188c06['type']},'raw':!![]});}})[_0x250e('0x1d')](function(_0x123407){if(_0x188c06[_0x250e('0x27')][_0x250e('0x41')]()=='STUN'){var _0x59bf8a=fs[_0x250e('0x43')](path['join'](config[_0x250e('0x45')],'server/files/templates/stun_multiple.ejs'),_0x250e('0x47'));var _0x57a9d2=ejs[_0x250e('0x48')](_0x59bf8a,{'networks':_0x123407||[]});fs[_0x250e('0x49')](_0x250e('0x4a'),_0x57a9d2);return respondWithRpcPromise('Reload',_0x250e('0x1e'),{'module':'res_stun_monitor.so'});}else if(_0x188c06[_0x250e('0x27')][_0x250e('0x41')]()==_0x250e('0x4c')){var _0x57d674=fs['readFileSync'](path['join'](config[_0x250e('0x45')],'server/files/templates/turn_multiple.ejs'),'utf8');var _0x376956=ejs[_0x250e('0x48')](_0x57d674,{'networks':_0x123407||[]});fs[_0x250e('0x49')](_0x250e('0x55'),_0x376956);return respondWithRpcPromise(_0x250e('0x4e'),_0x250e('0x1e'),{'module':_0x250e('0x4f')});}else{var _0x51352e=fs[_0x250e('0x43')](path['join'](config['root'],_0x250e('0x50')),_0x250e('0x47'));var _0x112a68=ejs[_0x250e('0x48')](_0x51352e,{'networks':_0x123407||[]});fs[_0x250e('0x49')](util['format'](_0x250e('0x52'),_0x188c06[_0x250e('0x27')][_0x250e('0x53')]()),_0x112a68);return respondWithRpcPromise(_0x250e('0x4e'),_0x250e('0x1e'),{'module':_0x250e('0x54')});}})[_0x250e('0x13')](handleError(_0x48147f,null));}; \ No newline at end of file +var _0xe3a7=['params','intersection','include','find','create','body','root','server/files/templates/stun_multiple.ejs','utf8','render','writeFileSync','Reload','res_stun_monitor.so','toUpperCase','TURN','readFileSync','join','server/files/templates/turn_multiple.ejs','/etc/asterisk/turn_xcally.conf','server/files/templates/network.ejs','format','/etc/asterisk/sip_xcally_%s.conf','chan_sip.so','/etc/asterisk/stun_xcally.conf','toLowerCase','STUN','util','path','ejs','lodash','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','jayson/promise','client','then','info','Network,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','status','offset','undefined','limit','count','Content-Range','json','update','destroy','end','name','send','index','map','rawAttributes','fieldName','type','key','model','query','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','Network','includeAll','findAll','rows','show'];(function(_0x546e00,_0x3526d9){var _0xb68b71=function(_0xbfa4e4){while(--_0xbfa4e4){_0x546e00['push'](_0x546e00['shift']());}};_0xb68b71(++_0x3526d9);}(_0xe3a7,0x11c));var _0x7e3a=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0xe3a7[_0x3b380d];return _0x54502b;};'use strict';var util=require(_0x7e3a('0x0'));var path=require(_0x7e3a('0x1'));var ejs=require(_0x7e3a('0x2'));var fs=require('fs');var _=require(_0x7e3a('0x3'));var qs=require(_0x7e3a('0x4'));var logger=require(_0x7e3a('0x5'))(_0x7e3a('0x6'));var config=require(_0x7e3a('0x7'));var db=require(_0x7e3a('0x8'))['db'];var jayson=require(_0x7e3a('0x9'));var client=jayson[_0x7e3a('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x27a41b,_0xe252fe,_0x47f016,_0x174b7f){return new Promise(function(_0x50b649,_0x30eabb){var _0x507dfb=_0x174b7f||client;return _0x507dfb['request'](_0x27a41b,_0x47f016)[_0x7e3a('0xb')](function(_0x116adc){logger[_0x7e3a('0xc')](_0x7e3a('0xd'),_0xe252fe,_0x7e3a('0xe'));logger[_0x7e3a('0xf')]('Network,\x20%s,\x20%s,\x20%s',_0xe252fe,'request\x20sent',JSON[_0x7e3a('0x10')](_0x116adc));if(_0x116adc[_0x7e3a('0x11')]){if(_0x116adc[_0x7e3a('0x11')]['code']===0x1f4){logger[_0x7e3a('0x11')]('Network,\x20%s,\x20%s',_0xe252fe,_0x116adc[_0x7e3a('0x11')][_0x7e3a('0x12')]);return _0x30eabb(_0x116adc[_0x7e3a('0x11')]['message']);}logger[_0x7e3a('0x11')]('Network,\x20%s,\x20%s',_0xe252fe,_0x116adc[_0x7e3a('0x11')]['message']);return _0x50b649(_0x116adc[_0x7e3a('0x11')]['message']);}else{logger[_0x7e3a('0xc')](_0x7e3a('0xd'),_0xe252fe,_0x7e3a('0xe'));_0x50b649(_0x116adc[_0x7e3a('0x13')][_0x7e3a('0x12')]);}})[_0x7e3a('0x14')](function(_0x596414){logger[_0x7e3a('0x11')](_0x7e3a('0xd'),_0xe252fe,_0x596414);_0x30eabb(_0x596414);});});}function respondWithResult(_0x47b912,_0x197768){_0x197768=_0x197768||0xc8;return function(_0x4fcc38){if(_0x4fcc38){return _0x47b912[_0x7e3a('0x15')](_0x197768)['json'](_0x4fcc38);}};}function respondWithFilteredResult(_0x4bd52d,_0x14fd9d){return function(_0x4a9630){if(_0x4a9630){var _0x4a83f3=typeof _0x14fd9d[_0x7e3a('0x16')]===_0x7e3a('0x17')&&typeof _0x14fd9d[_0x7e3a('0x18')]===_0x7e3a('0x17');var _0x155a0d=_0x4a9630['count'];var _0x3b99f2=_0x4a83f3?0x0:_0x14fd9d[_0x7e3a('0x16')];var _0x165b06=_0x4a83f3?_0x4a9630[_0x7e3a('0x19')]:_0x14fd9d[_0x7e3a('0x16')]+_0x14fd9d[_0x7e3a('0x18')];var _0x378c16;if(_0x165b06>=_0x155a0d){_0x165b06=_0x155a0d;_0x378c16=0xc8;}else{_0x378c16=0xce;}_0x4bd52d[_0x7e3a('0x15')](_0x378c16);return _0x4bd52d['set'](_0x7e3a('0x1a'),_0x3b99f2+'-'+_0x165b06+'/'+_0x155a0d)[_0x7e3a('0x1b')](_0x4a9630);}return null;};}function saveUpdates(_0x2c5b23){return function(_0x2b26f9){if(_0x2b26f9){return _0x2b26f9[_0x7e3a('0x1c')](_0x2c5b23)[_0x7e3a('0xb')](function(_0x4691d3){return _0x4691d3;});}return null;};}function removeEntity(_0x516da2){return function(_0xa82f84){if(_0xa82f84){return _0xa82f84[_0x7e3a('0x1d')]()[_0x7e3a('0xb')](function(){_0x516da2[_0x7e3a('0x15')](0xcc)[_0x7e3a('0x1e')]();});}};}function handleEntityNotFound(_0x2b950f){return function(_0x35a1e9){if(!_0x35a1e9){_0x2b950f['sendStatus'](0x194);}return _0x35a1e9;};}function handleError(_0x59a494,_0x398204){_0x398204=_0x398204||0x1f4;return function(_0x41bde6){logger[_0x7e3a('0x11')](_0x41bde6['stack']);if(_0x41bde6[_0x7e3a('0x1f')]){delete _0x41bde6['name'];}_0x59a494['status'](_0x398204)[_0x7e3a('0x20')](_0x41bde6);};}exports[_0x7e3a('0x21')]=function(_0x199d21,_0xfb5caa){var _0x119b12={},_0x322c3d={},_0xf33653={'count':0x0,'rows':[]};var _0x3c46b8=_[_0x7e3a('0x22')](db['Network'][_0x7e3a('0x23')],function(_0x305fb3){return{'name':_0x305fb3[_0x7e3a('0x24')],'type':_0x305fb3[_0x7e3a('0x25')][_0x7e3a('0x26')]};});_0x322c3d[_0x7e3a('0x27')]=_['map'](_0x3c46b8,_0x7e3a('0x1f'));_0x322c3d[_0x7e3a('0x28')]=_['keys'](_0x199d21[_0x7e3a('0x28')]);_0x322c3d[_0x7e3a('0x29')]=_['intersection'](_0x322c3d['model'],_0x322c3d[_0x7e3a('0x28')]);_0x119b12[_0x7e3a('0x2a')]=_['intersection'](_0x322c3d[_0x7e3a('0x27')],qs[_0x7e3a('0x2b')](_0x199d21[_0x7e3a('0x28')][_0x7e3a('0x2b')]));_0x119b12[_0x7e3a('0x2a')]=_0x119b12[_0x7e3a('0x2a')][_0x7e3a('0x2c')]?_0x119b12[_0x7e3a('0x2a')]:_0x322c3d[_0x7e3a('0x27')];if(!_0x199d21[_0x7e3a('0x28')][_0x7e3a('0x2d')](_0x7e3a('0x2e'))){_0x119b12['limit']=qs[_0x7e3a('0x18')](_0x199d21[_0x7e3a('0x28')][_0x7e3a('0x18')]);_0x119b12['offset']=qs[_0x7e3a('0x16')](_0x199d21[_0x7e3a('0x28')][_0x7e3a('0x16')]);}_0x119b12[_0x7e3a('0x2f')]=qs['sort'](_0x199d21[_0x7e3a('0x28')][_0x7e3a('0x30')]);_0x119b12['where']=qs['filters'](_[_0x7e3a('0x31')](_0x199d21['query'],_0x322c3d[_0x7e3a('0x29')]),_0x3c46b8);if(_0x199d21['query'][_0x7e3a('0x32')]){_0x119b12[_0x7e3a('0x33')]=_[_0x7e3a('0x34')](_0x119b12[_0x7e3a('0x33')],{'$or':_[_0x7e3a('0x22')](_0x3c46b8,function(_0x529aaf){if(_0x529aaf[_0x7e3a('0x25')]!==_0x7e3a('0x35')){var _0x49a641={};_0x49a641[_0x529aaf[_0x7e3a('0x1f')]]={'$like':'%'+_0x199d21[_0x7e3a('0x28')]['filter']+'%'};return _0x49a641;}})});}_0x119b12=_['merge']({},_0x119b12,_0x199d21[_0x7e3a('0x36')]);var _0x375f2c={'where':_0x119b12[_0x7e3a('0x33')]};return db[_0x7e3a('0x37')][_0x7e3a('0x19')](_0x375f2c)[_0x7e3a('0xb')](function(_0x5d6e24){_0xf33653[_0x7e3a('0x19')]=_0x5d6e24;if(_0x199d21[_0x7e3a('0x28')][_0x7e3a('0x38')]){_0x119b12['include']=[{'all':!![]}];}return db[_0x7e3a('0x37')][_0x7e3a('0x39')](_0x119b12);})[_0x7e3a('0xb')](function(_0x1f02db){_0xf33653[_0x7e3a('0x3a')]=_0x1f02db;return _0xf33653;})['then'](respondWithFilteredResult(_0xfb5caa,_0x119b12))['catch'](handleError(_0xfb5caa,null));};exports[_0x7e3a('0x3b')]=function(_0x5a761d,_0x58cb89){var _0xb4a323={'raw':!![],'where':{'id':_0x5a761d[_0x7e3a('0x3c')]['id']}},_0x47278c={};_0x47278c['model']=_['keys'](db['Network']['rawAttributes']);_0x47278c[_0x7e3a('0x28')]=_['keys'](_0x5a761d['query']);_0x47278c[_0x7e3a('0x29')]=_[_0x7e3a('0x3d')](_0x47278c[_0x7e3a('0x27')],_0x47278c[_0x7e3a('0x28')]);_0xb4a323[_0x7e3a('0x2a')]=_['intersection'](_0x47278c[_0x7e3a('0x27')],qs['fields'](_0x5a761d[_0x7e3a('0x28')][_0x7e3a('0x2b')]));_0xb4a323[_0x7e3a('0x2a')]=_0xb4a323['attributes'][_0x7e3a('0x2c')]?_0xb4a323[_0x7e3a('0x2a')]:_0x47278c[_0x7e3a('0x27')];if(_0x5a761d['query'][_0x7e3a('0x38')]){_0xb4a323[_0x7e3a('0x3e')]=[{'all':!![]}];}_0xb4a323=_[_0x7e3a('0x34')]({},_0xb4a323,_0x5a761d[_0x7e3a('0x36')]);return db[_0x7e3a('0x37')][_0x7e3a('0x3f')](_0xb4a323)[_0x7e3a('0xb')](handleEntityNotFound(_0x58cb89,null))[_0x7e3a('0xb')](respondWithResult(_0x58cb89,null))['catch'](handleError(_0x58cb89,null));};exports[_0x7e3a('0x40')]=function(_0x4b63e4,_0x528d5b){var _0x5cf004;return db[_0x7e3a('0x37')][_0x7e3a('0x40')](_0x4b63e4['body'],{'raw':!![]})[_0x7e3a('0xb')](function(_0x605b5){_0x5cf004=_0x605b5;return db[_0x7e3a('0x37')][_0x7e3a('0x39')]({'where':{'type':_0x4b63e4[_0x7e3a('0x41')][_0x7e3a('0x25')]},'raw':!![]});})[_0x7e3a('0xb')](function(_0x149a73){if(_0x5cf004['type']['toUpperCase']()=='STUN'){var _0x2b7df8=fs['readFileSync'](path['join'](config[_0x7e3a('0x42')],_0x7e3a('0x43')),_0x7e3a('0x44'));var _0xa6e7f2=ejs[_0x7e3a('0x45')](_0x2b7df8,{'networks':_0x149a73||[]});fs[_0x7e3a('0x46')]('/etc/asterisk/stun_xcally.conf',_0xa6e7f2);return respondWithRpcPromise(_0x7e3a('0x47'),_0x7e3a('0x40'),{'module':_0x7e3a('0x48')});}else if(_0x5cf004[_0x7e3a('0x25')][_0x7e3a('0x49')]()==_0x7e3a('0x4a')){var _0x10dd2b=fs[_0x7e3a('0x4b')](path[_0x7e3a('0x4c')](config[_0x7e3a('0x42')],_0x7e3a('0x4d')),_0x7e3a('0x44'));var _0x5230c3=ejs['render'](_0x10dd2b,{'networks':_0x149a73||[]});fs[_0x7e3a('0x46')](_0x7e3a('0x4e'),_0x5230c3);return respondWithRpcPromise(_0x7e3a('0x47'),'create',{'module':_0x7e3a('0x48')});}else{var _0x5ba166=fs['readFileSync'](path[_0x7e3a('0x4c')](config[_0x7e3a('0x42')],_0x7e3a('0x4f')),_0x7e3a('0x44'));var _0x1c1c12=ejs[_0x7e3a('0x45')](_0x5ba166,{'networks':_0x149a73||[]});fs[_0x7e3a('0x46')](util[_0x7e3a('0x50')](_0x7e3a('0x51'),_0x4b63e4[_0x7e3a('0x41')][_0x7e3a('0x25')]['toLowerCase']()),_0x1c1c12);return respondWithRpcPromise('Reload',_0x7e3a('0x40'),{'module':_0x7e3a('0x52')});}})[_0x7e3a('0xb')](function(){return _0x5cf004;})['then'](respondWithResult(_0x528d5b,0xc9))[_0x7e3a('0x14')](handleError(_0x528d5b,null));};exports['update']=function(_0x2dc326,_0x4207f2){var _0x212bdf;return db['Network']['find']({'where':{'id':_0x2dc326[_0x7e3a('0x3c')]['id']}})[_0x7e3a('0xb')](handleEntityNotFound(_0x4207f2,null))[_0x7e3a('0xb')](saveUpdates(_0x2dc326['body'],null))['then'](function(_0x2f2001){if(_0x2f2001){_0x212bdf=_0x2f2001;return db[_0x7e3a('0x37')][_0x7e3a('0x39')]({'where':{'type':_0x212bdf[_0x7e3a('0x25')]},'raw':!![]});}return null;})[_0x7e3a('0xb')](function(_0xbdaedb){if(_0x212bdf['type'][_0x7e3a('0x49')]()=='STUN'){var _0x26dab0=fs[_0x7e3a('0x4b')](path[_0x7e3a('0x4c')](config[_0x7e3a('0x42')],_0x7e3a('0x43')),_0x7e3a('0x44'));var _0xa6e482=ejs['render'](_0x26dab0,{'networks':_0xbdaedb||[]});fs[_0x7e3a('0x46')](_0x7e3a('0x53'),_0xa6e482);return respondWithRpcPromise(_0x7e3a('0x47'),_0x7e3a('0x1c'),{'module':_0x7e3a('0x48')});}else if(_0x212bdf[_0x7e3a('0x25')][_0x7e3a('0x49')]()=='TURN'){var _0x40d0f3=fs[_0x7e3a('0x4b')](path['join'](config[_0x7e3a('0x42')],_0x7e3a('0x4d')),_0x7e3a('0x44'));var _0x2c6e6b=ejs['render'](_0x40d0f3,{'networks':_0xbdaedb||[]});fs['writeFileSync'](_0x7e3a('0x4e'),_0x2c6e6b);return respondWithRpcPromise(_0x7e3a('0x47'),_0x7e3a('0x1c'),{'module':_0x7e3a('0x48')});}else{var _0x7bba51=fs[_0x7e3a('0x4b')](path['join'](config[_0x7e3a('0x42')],_0x7e3a('0x4f')),_0x7e3a('0x44'));var _0x5b2541=ejs[_0x7e3a('0x45')](_0x7bba51,{'networks':_0xbdaedb||[]});fs[_0x7e3a('0x46')](util['format'](_0x7e3a('0x51'),_0x2dc326[_0x7e3a('0x41')][_0x7e3a('0x25')][_0x7e3a('0x54')]()),_0x5b2541);return respondWithRpcPromise(_0x7e3a('0x47'),'update',{'module':_0x7e3a('0x52')});}})[_0x7e3a('0xb')](function(_0x31075a){if(_0x31075a){return _0x212bdf;}return null;})[_0x7e3a('0xb')](respondWithResult(_0x4207f2,null))[_0x7e3a('0x14')](handleError(_0x4207f2,null));};exports[_0x7e3a('0x1d')]=function(_0x2ab4be,_0x56170f){var _0x50025b;return db[_0x7e3a('0x37')]['find']({'where':{'id':_0x2ab4be[_0x7e3a('0x3c')]['id']}})['then'](function(_0x4a2dcb){_0x50025b=_0x4a2dcb;return _0x4a2dcb;})[_0x7e3a('0xb')](handleEntityNotFound(_0x56170f,null))[_0x7e3a('0xb')](removeEntity(_0x56170f,null))[_0x7e3a('0xb')](function(){if(_0x50025b){return db[_0x7e3a('0x37')][_0x7e3a('0x39')]({'where':{'type':_0x50025b['type']},'raw':!![]});}})['then'](function(_0x55c1df){if(_0x50025b[_0x7e3a('0x25')][_0x7e3a('0x49')]()==_0x7e3a('0x55')){var _0xc96cda=fs[_0x7e3a('0x4b')](path[_0x7e3a('0x4c')](config['root'],_0x7e3a('0x43')),'utf8');var _0x5bc1da=ejs[_0x7e3a('0x45')](_0xc96cda,{'networks':_0x55c1df||[]});fs['writeFileSync'](_0x7e3a('0x53'),_0x5bc1da);return respondWithRpcPromise(_0x7e3a('0x47'),_0x7e3a('0x1d'),{'module':'res_stun_monitor.so'});}else if(_0x50025b[_0x7e3a('0x25')][_0x7e3a('0x49')]()==_0x7e3a('0x4a')){var _0x538656=fs[_0x7e3a('0x4b')](path[_0x7e3a('0x4c')](config[_0x7e3a('0x42')],_0x7e3a('0x4d')),_0x7e3a('0x44'));var _0x155809=ejs[_0x7e3a('0x45')](_0x538656,{'networks':_0x55c1df||[]});fs[_0x7e3a('0x46')]('/etc/asterisk/turn_xcally.conf',_0x155809);return respondWithRpcPromise(_0x7e3a('0x47'),_0x7e3a('0x1d'),{'module':_0x7e3a('0x48')});}else{var _0x2932dc=fs['readFileSync'](path[_0x7e3a('0x4c')](config[_0x7e3a('0x42')],_0x7e3a('0x4f')),_0x7e3a('0x44'));var _0x274291=ejs['render'](_0x2932dc,{'networks':_0x55c1df||[]});fs['writeFileSync'](util[_0x7e3a('0x50')](_0x7e3a('0x51'),_0x50025b[_0x7e3a('0x25')][_0x7e3a('0x54')]()),_0x274291);return respondWithRpcPromise('Reload',_0x7e3a('0x1d'),{'module':_0x7e3a('0x52')});}})[_0x7e3a('0x14')](handleError(_0x56170f,null));}; \ No newline at end of file diff --git a/server/api/network/network.model.js b/server/api/network/network.model.js index cc64421..47ccfb9 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 _0x7794=['moment','request-promise','path','../../config/environment','define','network','util','../../config/logger','api'];(function(_0x4a53d,_0x58a95e){var _0x27410e=function(_0x38fc90){while(--_0x38fc90){_0x4a53d['push'](_0x4a53d['shift']());}};_0x27410e(++_0x58a95e);}(_0x7794,0x7b));var _0x4779=function(_0x4aada5,_0x565010){_0x4aada5=_0x4aada5-0x0;var _0x57e70f=_0x7794[_0x4aada5];return _0x57e70f;};'use strict';var _=require('lodash');var util=require(_0x4779('0x0'));var logger=require(_0x4779('0x1'))(_0x4779('0x2'));var moment=require(_0x4779('0x3'));var BPromise=require('bluebird');var rp=require(_0x4779('0x4'));var fs=require('fs');var path=require(_0x4779('0x5'));var rimraf=require('rimraf');var config=require(_0x4779('0x6'));var attributes=require('./network.attributes');module['exports']=function(_0x53fd58,_0x45cd71){return _0x53fd58[_0x4779('0x7')]('Network',attributes,{'tableName':_0x4779('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x073e=['rimraf','../../config/environment','define','Network','network','lodash','util','../../config/logger','api','path'];(function(_0x3c9e09,_0x1bd0eb){var _0x55cb86=function(_0x520d0f){while(--_0x520d0f){_0x3c9e09['push'](_0x3c9e09['shift']());}};_0x55cb86(++_0x1bd0eb);}(_0x073e,0x181));var _0xe073=function(_0x2b7b04,_0x5491aa){_0x2b7b04=_0x2b7b04-0x0;var _0x4b0728=_0x073e[_0x2b7b04];return _0x4b0728;};'use strict';var _=require(_0xe073('0x0'));var util=require(_0xe073('0x1'));var logger=require(_0xe073('0x2'))(_0xe073('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xe073('0x4'));var rimraf=require(_0xe073('0x5'));var config=require(_0xe073('0x6'));var attributes=require('./network.attributes');module['exports']=function(_0x4bc6b3,_0x45995e){return _0x4bc6b3[_0xe073('0x7')](_0xe073('0x8'),attributes,{'tableName':_0xe073('0x9'),'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 1837a7d..fdb16f4 100644 --- a/server/api/network/network.rpc.js +++ b/server/api/network/network.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['info','Network,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x7a54,0x106));var _0x47a5=function(_0x2f6285,_0x1264de){_0x2f6285=_0x2f6285-0x0;var _0x59c97a=_0x7a54[_0x2f6285];return _0x59c97a;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('Network,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});} \ No newline at end of file +var _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(_0x39a15d,_0x316506){var _0x4b2bb9=function(_0x3d1292){while(--_0x3d1292){_0x39a15d['push'](_0x39a15d['shift']());}};_0x4b2bb9(++_0x316506);}(_0x9957,0x93));var _0x7995=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x9957[_0x14add3];return _0x4a174f;};'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 087482f..4d59fc7 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 _0x440d=['./openchannelAccount.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','getAgents','post','addDisposition','addAnswer','/:id/notify','notify','/:id/applications','addApplications','addAgents','/:id/send','put','update','destroy','delete','removeDispositions','removeAnswers','/:id/users','removeAgents','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x37296b,_0x2e9820){var _0x561567=function(_0x18d20a){while(--_0x18d20a){_0x37296b['push'](_0x37296b['shift']());}};_0x561567(++_0x2e9820);}(_0x440d,0xbf));var _0xd440=function(_0x53b67d,_0x251707){_0x53b67d=_0x53b67d-0x0;var _0xff73e7=_0x440d[_0x53b67d];return _0xff73e7;};'use strict';var multer=require(_0xd440('0x0'));var util=require('util');var path=require(_0xd440('0x1'));var timeout=require(_0xd440('0x2'));var express=require(_0xd440('0x3'));var router=express[_0xd440('0x4')]();var fs_extra=require(_0xd440('0x5'));var auth=require(_0xd440('0x6'));var interaction=require(_0xd440('0x7'));var config=require(_0xd440('0x8'));var controller=require(_0xd440('0x9'));router[_0xd440('0xa')]('/',auth[_0xd440('0xb')](),controller[_0xd440('0xc')]);router[_0xd440('0xa')](_0xd440('0xd'),auth[_0xd440('0xb')](),controller[_0xd440('0xe')]);router[_0xd440('0xa')](_0xd440('0xf'),auth['isAuthenticated'](),controller[_0xd440('0x10')]);router['get'](_0xd440('0x11'),auth[_0xd440('0xb')](),controller[_0xd440('0x12')]);router[_0xd440('0xa')](_0xd440('0x13'),auth[_0xd440('0xb')](),controller[_0xd440('0x14')]);router['get']('/:id/applications',auth[_0xd440('0xb')](),controller['getApplications']);router[_0xd440('0xa')]('/:id/interactions',auth[_0xd440('0xb')](),controller['getInteractions']);router[_0xd440('0xa')]('/:id/users',auth[_0xd440('0xb')](),controller[_0xd440('0x15')]);router[_0xd440('0x16')]('/',auth[_0xd440('0xb')](),controller['create']);router['post'](_0xd440('0x11'),auth['isAuthenticated'](),controller[_0xd440('0x17')]);router[_0xd440('0x16')](_0xd440('0x13'),auth[_0xd440('0xb')](),controller[_0xd440('0x18')]);router['post'](_0xd440('0x19'),controller[_0xd440('0x1a')]);router['post'](_0xd440('0x1b'),auth[_0xd440('0xb')](),controller[_0xd440('0x1c')]);router[_0xd440('0x16')]('/:id/users',auth['isAuthenticated'](),controller[_0xd440('0x1d')]);router[_0xd440('0x16')](_0xd440('0x1e'),auth[_0xd440('0xb')](),controller['send']);router[_0xd440('0x1f')]('/:id',auth[_0xd440('0xb')](),controller[_0xd440('0x20')]);router['delete'](_0xd440('0xf'),auth[_0xd440('0xb')](),controller[_0xd440('0x21')]);router[_0xd440('0x22')](_0xd440('0x11'),auth[_0xd440('0xb')](),controller[_0xd440('0x23')]);router[_0xd440('0x22')](_0xd440('0x13'),auth[_0xd440('0xb')](),controller[_0xd440('0x24')]);router[_0xd440('0x22')](_0xd440('0x25'),auth['isAuthenticated'](),controller[_0xd440('0x26')]);module[_0xd440('0x27')]=router; \ No newline at end of file +var _0xd41b=['show','/:id/dispositions','getDispositions','getAnswers','/:id/applications','/:id/users','getAgents','post','create','addDisposition','/:id/canned_answers','addAnswer','/:id/notify','notify','put','/:id','delete','destroy','removeDispositions','removeAnswers','removeAgents','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./openchannelAccount.controller','isAuthenticated','index','get','describe'];(function(_0x2b10c6,_0x185590){var _0x3789d2=function(_0x272987){while(--_0x272987){_0x2b10c6['push'](_0x2b10c6['shift']());}};_0x3789d2(++_0x185590);}(_0xd41b,0x148));var _0xbd41=function(_0x3f75ce,_0x3092a0){_0x3f75ce=_0x3f75ce-0x0;var _0x34eb22=_0xd41b[_0x3f75ce];return _0x34eb22;};'use strict';var multer=require(_0xbd41('0x0'));var util=require(_0xbd41('0x1'));var path=require('path');var timeout=require(_0xbd41('0x2'));var express=require(_0xbd41('0x3'));var router=express[_0xbd41('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xbd41('0x5'));var interaction=require(_0xbd41('0x6'));var config=require('../../config/environment');var controller=require(_0xbd41('0x7'));router['get']('/',auth[_0xbd41('0x8')](),controller[_0xbd41('0x9')]);router[_0xbd41('0xa')]('/describe',auth['isAuthenticated'](),controller[_0xbd41('0xb')]);router['get']('/:id',auth[_0xbd41('0x8')](),controller[_0xbd41('0xc')]);router[_0xbd41('0xa')](_0xbd41('0xd'),auth[_0xbd41('0x8')](),controller[_0xbd41('0xe')]);router[_0xbd41('0xa')]('/:id/canned_answers',auth[_0xbd41('0x8')](),controller[_0xbd41('0xf')]);router[_0xbd41('0xa')](_0xbd41('0x10'),auth[_0xbd41('0x8')](),controller['getApplications']);router[_0xbd41('0xa')]('/:id/interactions',auth[_0xbd41('0x8')](),controller['getInteractions']);router['get'](_0xbd41('0x11'),auth[_0xbd41('0x8')](),controller[_0xbd41('0x12')]);router[_0xbd41('0x13')]('/',auth['isAuthenticated'](),controller[_0xbd41('0x14')]);router['post'](_0xbd41('0xd'),auth['isAuthenticated'](),controller[_0xbd41('0x15')]);router['post'](_0xbd41('0x16'),auth['isAuthenticated'](),controller[_0xbd41('0x17')]);router[_0xbd41('0x13')](_0xbd41('0x18'),controller[_0xbd41('0x19')]);router['post'](_0xbd41('0x10'),auth[_0xbd41('0x8')](),controller['addApplications']);router[_0xbd41('0x13')](_0xbd41('0x11'),auth[_0xbd41('0x8')](),controller['addAgents']);router[_0xbd41('0x13')]('/:id/send',auth[_0xbd41('0x8')](),controller['send']);router[_0xbd41('0x1a')](_0xbd41('0x1b'),auth[_0xbd41('0x8')](),controller['update']);router[_0xbd41('0x1c')]('/:id',auth[_0xbd41('0x8')](),controller[_0xbd41('0x1d')]);router['delete'](_0xbd41('0xd'),auth['isAuthenticated'](),controller[_0xbd41('0x1e')]);router['delete'](_0xbd41('0x16'),auth[_0xbd41('0x8')](),controller[_0xbd41('0x1f')]);router['delete'](_0xbd41('0x11'),auth[_0xbd41('0x8')](),controller[_0xbd41('0x20')]);module[_0xbd41('0x21')]=router; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.attributes.js b/server/api/openchannelAccount/openchannelAccount.attributes.js index 7d948a4..a64d807 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 _0xb153=['BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDisposition','sequelize','exports','STRING'];(function(_0xab599b,_0x399edb){var _0x2fd99d=function(_0x4f7f4f){while(--_0x4f7f4f){_0xab599b['push'](_0xab599b['shift']());}};_0x2fd99d(++_0x399edb);}(_0xb153,0x84));var _0x3b15=function(_0x199e69,_0x444567){_0x199e69=_0x199e69-0x0;var _0x4dbd91=_0xb153[_0x199e69];return _0x4dbd91;};'use strict';var Sequelize=require(_0x3b15('0x0'));var rs=require('randomstring');module[_0x3b15('0x1')]={'name':{'type':Sequelize[_0x3b15('0x2')],'unique':'name','allowNull':![]},'description':{'type':Sequelize[_0x3b15('0x2')]},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs['generate']();}},'replyUri':{'type':Sequelize[_0x3b15('0x2')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0x3b15('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[_0x3b15('0x3')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x3b15('0x3')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x3b15('0x4')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0x3b15('0x2')]},'queueTransfer':{'type':Sequelize[_0x3b15('0x3')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x3b15('0x4')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x3b15('0x4')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':null,'comment':_0x3b15('0x5')},'mandatoryDisposition':{'type':Sequelize[_0x3b15('0x3')],'defaultValue':![],'comment':_0x3b15('0x6'),'set':function(_0x392044){if(!_0x392044)this[_0x3b15('0x7')]('mandatoryDispositionPauseId',null);this[_0x3b15('0x7')](_0x3b15('0x8'),_0x392044);}}}; \ No newline at end of file +var _0x6df7=['INTEGER','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDisposition','sequelize','randomstring','exports','STRING','generate','TEXT','BOOLEAN'];(function(_0x4fbc43,_0x4800c6){var _0x4f4e22=function(_0x40fa0c){while(--_0x40fa0c){_0x4fbc43['push'](_0x4fbc43['shift']());}};_0x4f4e22(++_0x4800c6);}(_0x6df7,0x138));var _0x76df=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x6df7[_0x17d9e3];return _0x14192d;};'use strict';var Sequelize=require(_0x76df('0x0'));var rs=require(_0x76df('0x1'));module[_0x76df('0x2')]={'name':{'type':Sequelize[_0x76df('0x3')],'unique':'name','allowNull':![]},'description':{'type':Sequelize[_0x76df('0x3')]},'token':{'type':Sequelize[_0x76df('0x3')],'defaultValue':function(){return rs[_0x76df('0x4')]();}},'replyUri':{'type':Sequelize['STRING'],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0x76df('0x3')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x76df('0x5')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0x76df('0x6')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x76df('0x6')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x76df('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0x76df('0x3')]},'queueTransfer':{'type':Sequelize[_0x76df('0x6')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x76df('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x76df('0x6')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x76df('0x7')],'allowNull':!![],'defaultValue':null,'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x76df('0x6')],'defaultValue':![],'comment':_0x76df('0x8'),'set':function(_0x4ff306){if(!_0x4ff306)this[_0x76df('0x9')]('mandatoryDispositionPauseId',null);this[_0x76df('0x9')](_0x76df('0xa'),_0x4ff306);}}}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.controller.js b/server/api/openchannelAccount/openchannelAccount.controller.js index eddc0c0..0f9837e 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 _0xe353=['priority','finally','getApplications','Contact','Owner','fullname','internal','Tag','Tags','color','tag','addAgents','omit','spread','emit','userOpenchannelAccount:save','removeAgents','userOpenchannelAccount:remove','getAgents','out','OpenchannelMessage','Messages','dataValues','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','jsforce','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','defaults','redis','./openchannelAccount.socket','register','jayson/promise','client','http','request','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','sendStatus','end','status','offset','undefined','limit','count','json','apply','reject','save','update','then','destroy','OpenchannelAccounts','UserProfileResource','stack','name','send','index','Pause','OpenchannelAccount','rawAttributes','type','key','query','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','filter','map','VIRTUAL','merge','options','include','findAll','rows','show','params','mandatoryDispositionPause','keys','includeAll','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','find','autoAssociation','describe','OpenchannelAccountId','Disposition','getDispositions','findOne','order','pick','removeDispositions','ids','addAnswer','getAnswers','CannedAnswer','removeAnswers','notify','CmContact','Sequelize','difference','createdAt','updatedAt','ListId','isNil','from','ValidationError','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','Contacts','DESC','OpenchannelApplication','Applications','List','account','applications','list','orderBy','firstName','lastName','threadId','OpenchannelInteraction','externalUrl','ContactId','contact','messageId','interaction','created','autoclose','push','close','unmanaged','*,*,*,*','AttachmentId','UserId','User','agent','waitForTheAssignedAgent','OpenchannelQueue','queueId','unshift','queue','waitForTheAssignedQueue','Start','startRouting','EventManager','addApplications','sequelize','Transaction','ISOLATION_LEVELS','READ_COMMITTED','bulkCreate'];(function(_0x2d103e,_0x5ce2e4){var _0x4ac7c9=function(_0x989d02){while(--_0x989d02){_0x2d103e['push'](_0x2d103e['shift']());}};_0x4ac7c9(++_0x5ce2e4);}(_0xe353,0xdc));var _0x3e35=function(_0x122096,_0x60c295){_0x122096=_0x122096-0x0;var _0x3d1966=_0xe353[_0x122096];return _0x3d1966;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3e35('0x0'));var zipdir=require(_0x3e35('0x1'));var jsonpatch=require(_0x3e35('0x2'));var rp=require(_0x3e35('0x3'));var moment=require(_0x3e35('0x4'));var BPromise=require(_0x3e35('0x5'));var Mustache=require(_0x3e35('0x6'));var util=require(_0x3e35('0x7'));var path=require(_0x3e35('0x8'));var sox=require(_0x3e35('0x9'));var csv=require(_0x3e35('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3e35('0xb'));var _=require(_0x3e35('0xc'));var squel=require(_0x3e35('0xd'));var crypto=require('crypto');var jsforce=require(_0x3e35('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x3e35('0xa'));var querystring=require(_0x3e35('0xf'));var Papa=require(_0x3e35('0x10'));var Redis=require(_0x3e35('0x11'));var authService=require(_0x3e35('0x12'));var qs=require(_0x3e35('0x13'));var as=require(_0x3e35('0x14'));var hardwareService=require(_0x3e35('0x15'));var logger=require(_0x3e35('0x16'))('api');var utils=require(_0x3e35('0x17'));var config=require(_0x3e35('0x18'));var licenseUtil=require(_0x3e35('0x19'));var db=require(_0x3e35('0x1a'))['db'];config['redis']=_[_0x3e35('0x1b')](config[_0x3e35('0x1c')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x3e35('0x1c')]));require(_0x3e35('0x1d'))[_0x3e35('0x1e')](socket);var jayson=require(_0x3e35('0x1f'));var client=jayson[_0x3e35('0x20')][_0x3e35('0x21')]({'port':0x232c});var client9002=jayson['client'][_0x3e35('0x21')]({'port':0x232a});function respondWithRpcPromise(_0x5ab566,_0x171970,_0x50af2d,_0x419c92){return new BPromise(function(_0x296938,_0x261e73){var _0x2b098a=_0x419c92||client;return _0x2b098a[_0x3e35('0x22')](_0x5ab566,_0x50af2d)['then'](function(_0x167531){logger[_0x3e35('0x23')](_0x3e35('0x24'),_0x171970,_0x3e35('0x25'));logger['debug'](_0x3e35('0x26'),_0x171970,'request\x20sent',JSON[_0x3e35('0x27')](_0x167531));if(_0x167531[_0x3e35('0x28')]){if(_0x167531[_0x3e35('0x28')][_0x3e35('0x29')]===0x1f4){logger['error'](_0x3e35('0x24'),_0x171970,_0x167531[_0x3e35('0x28')]['message']);return _0x261e73(_0x167531[_0x3e35('0x28')]['message']);}logger[_0x3e35('0x28')]('OpenchannelAccount,\x20%s,\x20%s',_0x171970,_0x167531['error'][_0x3e35('0x2a')]);return _0x296938(_0x167531[_0x3e35('0x28')][_0x3e35('0x2a')]);}else{logger[_0x3e35('0x23')]('OpenchannelAccount,\x20%s,\x20%s',_0x171970,_0x3e35('0x25'));_0x296938(_0x167531['result'][_0x3e35('0x2a')]);}})[_0x3e35('0x2b')](function(_0xdf7d26){logger[_0x3e35('0x28')](_0x3e35('0x24'),_0x171970,_0xdf7d26);_0x261e73(_0xdf7d26);});});}function respondWithStatusCode(_0x3c72e9,_0xe3d663){_0xe3d663=_0xe3d663||0xcc;return function(_0x396c00){if(_0x396c00){return _0x3c72e9[_0x3e35('0x2c')](_0xe3d663);}return _0x3c72e9['status'](_0xe3d663)[_0x3e35('0x2d')]();};}function respondWithResult(_0xbbe636,_0x2b4d25){_0x2b4d25=_0x2b4d25||0xc8;return function(_0x3101fb){if(_0x3101fb){return _0xbbe636[_0x3e35('0x2e')](_0x2b4d25)['json'](_0x3101fb);}};}function respondWithFilteredResult(_0x2ab680,_0x138ee3){return function(_0x2139b7){if(_0x2139b7){var _0x3e2581=typeof _0x138ee3[_0x3e35('0x2f')]===_0x3e35('0x30')&&typeof _0x138ee3[_0x3e35('0x31')]==='undefined';var _0x2e19ce=_0x2139b7[_0x3e35('0x32')];var _0x23dc0c=_0x3e2581?0x0:_0x138ee3['offset'];var _0x4097e5=_0x3e2581?_0x2139b7[_0x3e35('0x32')]:_0x138ee3['offset']+_0x138ee3[_0x3e35('0x31')];var _0x3948e0;if(_0x4097e5>=_0x2e19ce){_0x4097e5=_0x2e19ce;_0x3948e0=0xc8;}else{_0x3948e0=0xce;}_0x2ab680['status'](_0x3948e0);return _0x2ab680['set']('Content-Range',_0x23dc0c+'-'+_0x4097e5+'/'+_0x2e19ce)[_0x3e35('0x33')](_0x2139b7);}return null;};}function patchUpdates(_0x48e55e){return function(_0x10a705){try{jsonpatch[_0x3e35('0x34')](_0x10a705,_0x48e55e,!![]);}catch(_0x279b50){return BPromise[_0x3e35('0x35')](_0x279b50);}return _0x10a705[_0x3e35('0x36')]();};}function saveUpdates(_0x190b12,_0x260c58){return function(_0x46ec31){if(_0x46ec31){return _0x46ec31[_0x3e35('0x37')](_0x190b12)[_0x3e35('0x38')](function(_0x5d6afe){return _0x5d6afe;});}return null;};}function removeEntity(_0x853b2c,_0x24393c){return function(_0x16866f){if(_0x16866f){return _0x16866f[_0x3e35('0x39')]()[_0x3e35('0x38')](function(){var _0x43a084=_0x16866f['get']({'plain':!![]});var _0x500b43=_0x3e35('0x3a');return db[_0x3e35('0x3b')][_0x3e35('0x39')]({'where':{'type':_0x500b43,'resourceId':_0x43a084['id']}})[_0x3e35('0x38')](function(){return _0x16866f;});})['then'](function(){_0x853b2c[_0x3e35('0x2e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3c1b88,_0x261160){return function(_0x2babe5){if(!_0x2babe5){_0x3c1b88[_0x3e35('0x2c')](0x194);}return _0x2babe5;};}function handleError(_0x4b602e,_0xe6b444){_0xe6b444=_0xe6b444||0x1f4;return function(_0x590e77){logger['error'](_0x590e77[_0x3e35('0x3c')]);if(_0x590e77[_0x3e35('0x3d')]){delete _0x590e77['name'];}_0x4b602e[_0x3e35('0x2e')](_0xe6b444)[_0x3e35('0x3e')](_0x590e77);};}exports[_0x3e35('0x3f')]=function(_0x3f99d9,_0x3a56a8){var _0x5de5d8={'include':[{'model':db[_0x3e35('0x40')],'as':'mandatoryDispositionPause'}]},_0x18c02a={},_0xb2d0ca={'count':0x0,'rows':[]};var _0x85b8=_['map'](db[_0x3e35('0x41')][_0x3e35('0x42')],function(_0xc31aea){return{'name':_0xc31aea['fieldName'],'type':_0xc31aea[_0x3e35('0x43')][_0x3e35('0x44')]};});_0x18c02a['model']=_['map'](_0x85b8,_0x3e35('0x3d'));_0x18c02a[_0x3e35('0x45')]=_['keys'](_0x3f99d9[_0x3e35('0x45')]);_0x18c02a[_0x3e35('0x46')]=_['intersection'](_0x18c02a[_0x3e35('0x47')],_0x18c02a['query']);_0x5de5d8[_0x3e35('0x48')]=_[_0x3e35('0x49')](_0x18c02a[_0x3e35('0x47')],qs['fields'](_0x3f99d9[_0x3e35('0x45')][_0x3e35('0x4a')]));_0x5de5d8[_0x3e35('0x48')]=_0x5de5d8[_0x3e35('0x48')][_0x3e35('0x4b')]?_0x5de5d8[_0x3e35('0x48')]:_0x18c02a[_0x3e35('0x47')];if(!_0x3f99d9[_0x3e35('0x45')][_0x3e35('0x4c')](_0x3e35('0x4d'))){_0x5de5d8[_0x3e35('0x31')]=qs['limit'](_0x3f99d9['query'][_0x3e35('0x31')]);_0x5de5d8[_0x3e35('0x2f')]=qs['offset'](_0x3f99d9[_0x3e35('0x45')][_0x3e35('0x2f')]);}_0x5de5d8['order']=qs[_0x3e35('0x4e')](_0x3f99d9[_0x3e35('0x45')]['sort']);_0x5de5d8[_0x3e35('0x4f')]=qs[_0x3e35('0x46')](_['pick'](_0x3f99d9[_0x3e35('0x45')],_0x18c02a[_0x3e35('0x46')]),_0x85b8);if(_0x3f99d9[_0x3e35('0x45')][_0x3e35('0x50')]){_0x5de5d8['where']=_['merge'](_0x5de5d8['where'],{'$or':_[_0x3e35('0x51')](_0x85b8,function(_0x330320){if(_0x330320[_0x3e35('0x43')]!==_0x3e35('0x52')){var _0x39a5d8={};_0x39a5d8[_0x330320[_0x3e35('0x3d')]]={'$like':'%'+_0x3f99d9[_0x3e35('0x45')][_0x3e35('0x50')]+'%'};return _0x39a5d8;}})});}_0x5de5d8=_[_0x3e35('0x53')]({},_0x5de5d8,_0x3f99d9[_0x3e35('0x54')]);var _0x1b714c={'where':_0x5de5d8['where']};return db[_0x3e35('0x41')][_0x3e35('0x32')](_0x1b714c)[_0x3e35('0x38')](function(_0x2d8159){_0xb2d0ca[_0x3e35('0x32')]=_0x2d8159;if(_0x3f99d9[_0x3e35('0x45')]['includeAll']){_0x5de5d8[_0x3e35('0x55')]=[{'all':!![]}];}return db[_0x3e35('0x41')][_0x3e35('0x56')](_0x5de5d8);})[_0x3e35('0x38')](function(_0x26d668){_0xb2d0ca[_0x3e35('0x57')]=_0x26d668;return _0xb2d0ca;})[_0x3e35('0x38')](respondWithFilteredResult(_0x3a56a8,_0x5de5d8))[_0x3e35('0x2b')](handleError(_0x3a56a8,null));};exports[_0x3e35('0x58')]=function(_0x5083eb,_0x43fd8e){var _0x149625={'raw':![],'where':{'id':_0x5083eb[_0x3e35('0x59')]['id']},'include':[{'model':db[_0x3e35('0x40')],'as':_0x3e35('0x5a')}]},_0x30a550={};_0x30a550['model']=_[_0x3e35('0x5b')](db[_0x3e35('0x41')][_0x3e35('0x42')]);_0x30a550[_0x3e35('0x45')]=_['keys'](_0x5083eb[_0x3e35('0x45')]);_0x30a550[_0x3e35('0x46')]=_['intersection'](_0x30a550[_0x3e35('0x47')],_0x30a550[_0x3e35('0x45')]);_0x149625[_0x3e35('0x48')]=_[_0x3e35('0x49')](_0x30a550[_0x3e35('0x47')],qs[_0x3e35('0x4a')](_0x5083eb[_0x3e35('0x45')][_0x3e35('0x4a')]));_0x149625[_0x3e35('0x48')]=_0x149625[_0x3e35('0x48')][_0x3e35('0x4b')]?_0x149625[_0x3e35('0x48')]:_0x30a550['model'];if(_0x5083eb[_0x3e35('0x45')][_0x3e35('0x5c')]){_0x149625[_0x3e35('0x55')]=[{'all':!![]}];}_0x149625=_[_0x3e35('0x53')]({},_0x149625,_0x5083eb[_0x3e35('0x54')]);return db[_0x3e35('0x41')]['find'](_0x149625)[_0x3e35('0x38')](handleEntityNotFound(_0x43fd8e,null))['then'](respondWithResult(_0x43fd8e,null))['catch'](handleError(_0x43fd8e,null));};exports[_0x3e35('0x5d')]=function(_0x2361f4,_0x48e7c5){return db['OpenchannelAccount'][_0x3e35('0x5d')](_0x2361f4[_0x3e35('0x5e')],{})['then'](function(_0xc91bae){var _0x56d72b=_0x2361f4['user'][_0x3e35('0x5f')]({'plain':!![]});if(!_0x56d72b)throw new Error(_0x3e35('0x60'));if(_0x56d72b[_0x3e35('0x61')]===_0x3e35('0x62')){var _0x4036dc=_0xc91bae[_0x3e35('0x5f')]({'plain':!![]});var _0x51b1cc='OpenchannelAccounts';return db[_0x3e35('0x63')][_0x3e35('0x64')]({'where':{'name':_0x51b1cc,'userProfileId':_0x56d72b['userProfileId']},'raw':!![]})[_0x3e35('0x38')](function(_0x50e0ec){if(_0x50e0ec&&_0x50e0ec[_0x3e35('0x65')]===0x0){return db['UserProfileResource']['create']({'name':_0x4036dc['name'],'resourceId':_0x4036dc['id'],'type':_0x50e0ec[_0x3e35('0x3d')],'sectionId':_0x50e0ec['id']},{})[_0x3e35('0x38')](function(){return _0xc91bae;});}else{return _0xc91bae;}})[_0x3e35('0x2b')](function(_0x5c51c2){logger[_0x3e35('0x28')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5c51c2);throw _0x5c51c2;});}return _0xc91bae;})[_0x3e35('0x38')](respondWithResult(_0x48e7c5,0xc9))['catch'](handleError(_0x48e7c5,null));};exports[_0x3e35('0x37')]=function(_0x8300fb,_0x224a04){if(_0x8300fb[_0x3e35('0x5e')]['id']){delete _0x8300fb[_0x3e35('0x5e')]['id'];}return db[_0x3e35('0x41')][_0x3e35('0x64')]({'where':{'id':_0x8300fb['params']['id']},'include':[{'model':db['Pause'],'as':_0x3e35('0x5a')}]})[_0x3e35('0x38')](handleEntityNotFound(_0x224a04,null))['then'](saveUpdates(_0x8300fb[_0x3e35('0x5e')],null))[_0x3e35('0x38')](respondWithResult(_0x224a04,null))[_0x3e35('0x2b')](handleError(_0x224a04,null));};exports[_0x3e35('0x39')]=function(_0x43b8b5,_0x57ea22){return db[_0x3e35('0x41')][_0x3e35('0x64')]({'where':{'id':_0x43b8b5[_0x3e35('0x59')]['id']}})['then'](handleEntityNotFound(_0x57ea22,null))[_0x3e35('0x38')](removeEntity(_0x57ea22,null))['catch'](handleError(_0x57ea22,null));};exports[_0x3e35('0x66')]=function(_0xc90fbe,_0x4cbc04){return db[_0x3e35('0x41')]['describe']()[_0x3e35('0x38')](respondWithResult(_0x4cbc04,null))['catch'](handleError(_0x4cbc04,null));};exports['addDisposition']=function(_0x148b13,_0x46bb91,_0x59e613){if(_0x148b13[_0x3e35('0x5e')]['id']){delete _0x148b13[_0x3e35('0x5e')]['id'];}return db[_0x3e35('0x41')][_0x3e35('0x64')]({'where':{'id':_0x148b13[_0x3e35('0x59')]['id']}})['then'](handleEntityNotFound(_0x46bb91,null))['then'](function(_0x426530){if(_0x426530){_0x148b13[_0x3e35('0x5e')][_0x3e35('0x67')]=_0x426530['id'];return db[_0x3e35('0x68')][_0x3e35('0x5d')](_0x148b13['body']);}})[_0x3e35('0x38')](respondWithResult(_0x46bb91,null))['catch'](handleError(_0x46bb91,null));};exports[_0x3e35('0x69')]=function(_0x450daa,_0x572e6f,_0xd98b15){var _0x37e607={'raw':![],'where':{}};var _0x56443f={};var _0x2b4df0={'count':0x0,'rows':[]};return db['OpenchannelAccount'][_0x3e35('0x6a')]({'where':{'id':_0x450daa[_0x3e35('0x59')]['id']}})[_0x3e35('0x38')](handleEntityNotFound(_0x572e6f,null))[_0x3e35('0x38')](function(_0x2599a4){if(_0x2599a4){_0x56443f[_0x3e35('0x47')]=_[_0x3e35('0x5b')](db[_0x3e35('0x68')][_0x3e35('0x42')]);_0x56443f[_0x3e35('0x45')]=_[_0x3e35('0x5b')](_0x450daa[_0x3e35('0x45')]);_0x56443f['filters']=_[_0x3e35('0x49')](_0x56443f[_0x3e35('0x47')],_0x56443f['query']);_0x37e607[_0x3e35('0x48')]=_['intersection'](_0x56443f[_0x3e35('0x47')],qs[_0x3e35('0x4a')](_0x450daa[_0x3e35('0x45')][_0x3e35('0x4a')]));_0x37e607[_0x3e35('0x48')]=_0x37e607[_0x3e35('0x48')][_0x3e35('0x4b')]?_0x37e607[_0x3e35('0x48')]:_0x56443f[_0x3e35('0x47')];if(!_0x450daa[_0x3e35('0x45')]['hasOwnProperty'](_0x3e35('0x4d'))){_0x37e607[_0x3e35('0x31')]=qs[_0x3e35('0x31')](_0x450daa[_0x3e35('0x45')]['limit']);_0x37e607['offset']=qs[_0x3e35('0x2f')](_0x450daa[_0x3e35('0x45')][_0x3e35('0x2f')]);}_0x37e607[_0x3e35('0x6b')]=qs[_0x3e35('0x4e')](_0x450daa['query']['sort']);_0x37e607[_0x3e35('0x4f')]=qs[_0x3e35('0x46')](_[_0x3e35('0x6c')](_0x450daa[_0x3e35('0x45')],_0x56443f[_0x3e35('0x46')]));_0x37e607['where'][_0x3e35('0x67')]=_0x2599a4['id'];if(_0x450daa[_0x3e35('0x45')][_0x3e35('0x50')]){_0x37e607[_0x3e35('0x4f')]=_[_0x3e35('0x53')](_0x37e607[_0x3e35('0x4f')],{'$or':_[_0x3e35('0x51')](_0x37e607[_0x3e35('0x48')],function(_0x4c13ff){var _0x4b23c6={};_0x4b23c6[_0x4c13ff]={'$like':'%'+_0x450daa[_0x3e35('0x45')][_0x3e35('0x50')]+'%'};return _0x4b23c6;})});}_0x37e607=_[_0x3e35('0x53')]({},_0x37e607,_0x450daa[_0x3e35('0x54')]);return db[_0x3e35('0x68')][_0x3e35('0x32')]({'where':_0x37e607[_0x3e35('0x4f')]})[_0x3e35('0x38')](function(_0x32237a){_0x2b4df0[_0x3e35('0x32')]=_0x32237a;if(_0x450daa['query'][_0x3e35('0x5c')]){_0x37e607[_0x3e35('0x55')]=[{'all':!![]}];}return db[_0x3e35('0x68')][_0x3e35('0x56')](_0x37e607);})[_0x3e35('0x38')](function(_0x2d132a){_0x2b4df0[_0x3e35('0x57')]=_0x2d132a;return _0x2b4df0;});}})['then'](respondWithFilteredResult(_0x572e6f,_0x37e607))[_0x3e35('0x2b')](handleError(_0x572e6f,null));};exports[_0x3e35('0x6d')]=function(_0x375e51,_0x4b4d72,_0xe5915b){return db[_0x3e35('0x41')][_0x3e35('0x64')]({'where':{'id':_0x375e51[_0x3e35('0x59')]['id']}})[_0x3e35('0x38')](handleEntityNotFound(_0x4b4d72,null))[_0x3e35('0x38')](function(_0x34e733){if(_0x34e733){return _0x34e733[_0x3e35('0x6d')](_0x375e51[_0x3e35('0x45')][_0x3e35('0x6e')]);}})['then'](respondWithStatusCode(_0x4b4d72,null))[_0x3e35('0x2b')](handleError(_0x4b4d72,null));};exports[_0x3e35('0x6f')]=function(_0x5e3be8,_0x34714c,_0x23c665){if(_0x5e3be8[_0x3e35('0x5e')]['id']){delete _0x5e3be8['body']['id'];}return db[_0x3e35('0x41')]['find']({'where':{'id':_0x5e3be8[_0x3e35('0x59')]['id']}})[_0x3e35('0x38')](handleEntityNotFound(_0x34714c,null))[_0x3e35('0x38')](function(_0x54ad70){if(_0x54ad70){_0x5e3be8[_0x3e35('0x5e')]['OpenchannelAccountId']=_0x54ad70['id'];return db['CannedAnswer'][_0x3e35('0x5d')](_0x5e3be8['body']);}})[_0x3e35('0x38')](respondWithResult(_0x34714c,null))['catch'](handleError(_0x34714c,null));};exports[_0x3e35('0x70')]=function(_0x5abd87,_0x2379c2,_0x4ffd57){var _0x4da24f={'raw':![],'where':{}};var _0x5d99ff={};var _0x433e8c={'count':0x0,'rows':[]};return db[_0x3e35('0x41')]['findOne']({'where':{'id':_0x5abd87[_0x3e35('0x59')]['id']}})[_0x3e35('0x38')](handleEntityNotFound(_0x2379c2,null))[_0x3e35('0x38')](function(_0x5bf8a2){if(_0x5bf8a2){_0x5d99ff[_0x3e35('0x47')]=_[_0x3e35('0x5b')](db[_0x3e35('0x71')][_0x3e35('0x42')]);_0x5d99ff[_0x3e35('0x45')]=_['keys'](_0x5abd87['query']);_0x5d99ff[_0x3e35('0x46')]=_['intersection'](_0x5d99ff[_0x3e35('0x47')],_0x5d99ff['query']);_0x4da24f[_0x3e35('0x48')]=_[_0x3e35('0x49')](_0x5d99ff[_0x3e35('0x47')],qs[_0x3e35('0x4a')](_0x5abd87['query'][_0x3e35('0x4a')]));_0x4da24f[_0x3e35('0x48')]=_0x4da24f[_0x3e35('0x48')][_0x3e35('0x4b')]?_0x4da24f[_0x3e35('0x48')]:_0x5d99ff['model'];if(!_0x5abd87[_0x3e35('0x45')]['hasOwnProperty'](_0x3e35('0x4d'))){_0x4da24f['limit']=qs[_0x3e35('0x31')](_0x5abd87[_0x3e35('0x45')][_0x3e35('0x31')]);_0x4da24f[_0x3e35('0x2f')]=qs[_0x3e35('0x2f')](_0x5abd87['query'][_0x3e35('0x2f')]);}_0x4da24f[_0x3e35('0x6b')]=qs[_0x3e35('0x4e')](_0x5abd87[_0x3e35('0x45')][_0x3e35('0x4e')]);_0x4da24f['where']=qs[_0x3e35('0x46')](_[_0x3e35('0x6c')](_0x5abd87[_0x3e35('0x45')],_0x5d99ff[_0x3e35('0x46')]));_0x4da24f[_0x3e35('0x4f')][_0x3e35('0x67')]=_0x5bf8a2['id'];if(_0x5abd87[_0x3e35('0x45')]['filter']){_0x4da24f[_0x3e35('0x4f')]=_[_0x3e35('0x53')](_0x4da24f['where'],{'$or':_['map'](_0x4da24f[_0x3e35('0x48')],function(_0x1d760b){var _0xf6c5a1={};_0xf6c5a1[_0x1d760b]={'$like':'%'+_0x5abd87['query'][_0x3e35('0x50')]+'%'};return _0xf6c5a1;})});}_0x4da24f=_[_0x3e35('0x53')]({},_0x4da24f,_0x5abd87[_0x3e35('0x54')]);return db[_0x3e35('0x71')][_0x3e35('0x32')]({'where':_0x4da24f[_0x3e35('0x4f')]})['then'](function(_0x103ee6){_0x433e8c['count']=_0x103ee6;if(_0x5abd87[_0x3e35('0x45')][_0x3e35('0x5c')]){_0x4da24f[_0x3e35('0x55')]=[{'all':!![]}];}return db[_0x3e35('0x71')][_0x3e35('0x56')](_0x4da24f);})[_0x3e35('0x38')](function(_0x438707){_0x433e8c['rows']=_0x438707;return _0x433e8c;});}})[_0x3e35('0x38')](respondWithFilteredResult(_0x2379c2,_0x4da24f))['catch'](handleError(_0x2379c2,null));};exports[_0x3e35('0x72')]=function(_0x1c4372,_0x59894f,_0x35a14c){return db[_0x3e35('0x41')][_0x3e35('0x64')]({'where':{'id':_0x1c4372[_0x3e35('0x59')]['id']}})[_0x3e35('0x38')](handleEntityNotFound(_0x59894f,null))['then'](function(_0x496f10){if(_0x496f10){return _0x496f10['removeAnswers'](_0x1c4372['query']['ids']);}})[_0x3e35('0x38')](respondWithStatusCode(_0x59894f,null))[_0x3e35('0x2b')](handleError(_0x59894f,null));};exports[_0x3e35('0x73')]=function(_0x48dfb0,_0x530c3a,_0x16bac5){var _0x334d15={'body':_0x48dfb0[_0x3e35('0x5e')],'channel':'openchannel'};var _0x265ab9=[];var _0xbd04f3=[];var _0x5b4b72={};var _0x17670a=![];return db[_0x3e35('0x74')][_0x3e35('0x66')]()[_0x3e35('0x38')](function(_0x302737){if(!_0x302737){throw new db[(_0x3e35('0x75'))]['ValidationError']('no\x20available\x20attributes');}_0x265ab9=_[_0x3e35('0x76')](_[_0x3e35('0x5b')](_0x302737),[_0x3e35('0x77'),_0x3e35('0x78')]);_0xbd04f3=_[_0x3e35('0x76')](_[_0x3e35('0x5b')](_0x302737),[_0x3e35('0x77'),_0x3e35('0x78'),'CompanyId',_0x3e35('0x79')]);if(_0x48dfb0[_0x3e35('0x5e')]['id']){delete _0x48dfb0[_0x3e35('0x5e')]['id'];}if(_[_0x3e35('0x7a')](_0x48dfb0['body'][_0x3e35('0x7b')])){throw new db[(_0x3e35('0x75'))][(_0x3e35('0x7c'))]('from\x20is\x20mandatory');}if(_[_0x3e35('0x7a')](_0x48dfb0[_0x3e35('0x5e')][_0x3e35('0x5e')])||_0x48dfb0['body'][_0x3e35('0x5e')]===''){throw new db[(_0x3e35('0x75'))][(_0x3e35('0x7c'))](_0x3e35('0x7d'));}if(_['isNil'](_0x48dfb0[_0x3e35('0x5e')][_0x3e35('0x7e')])){throw new db[(_0x3e35('0x75'))]['ValidationError'](_0x3e35('0x7f')+_0xbd04f3);}if(!_[_0x3e35('0x80')](_0xbd04f3,_0x48dfb0[_0x3e35('0x5e')][_0x3e35('0x7e')])){throw new db[(_0x3e35('0x75'))][(_0x3e35('0x7c'))](_0x3e35('0x81')+_0xbd04f3);}_0x5b4b72[_0x48dfb0[_0x3e35('0x5e')][_0x3e35('0x7e')]]=_0x48dfb0[_0x3e35('0x5e')]['from'];})[_0x3e35('0x38')](function(){return db[_0x3e35('0x41')][_0x3e35('0x64')]({'where':{'id':_0x48dfb0[_0x3e35('0x59')]['id']},'include':[{'model':db[_0x3e35('0x82')],'as':'List','include':[{'model':db[_0x3e35('0x74')],'as':_0x3e35('0x83'),'where':_0x5b4b72,'limit':0x1,'order':[['updatedAt',_0x3e35('0x84')]]}]},{'model':db[_0x3e35('0x85')],'as':_0x3e35('0x86')}]});})[_0x3e35('0x38')](handleEntityNotFound(_0x530c3a,null))[_0x3e35('0x38')](function(_0x395fda){if(_0x395fda&&_0x395fda[_0x3e35('0x87')]){_0x334d15[_0x3e35('0x88')]=_0x395fda;_0x334d15[_0x3e35('0x89')]=_0x395fda['Applications'];_0x334d15[_0x3e35('0x8a')]=_0x395fda['List'];_0x334d15['applications']=_[_0x3e35('0x8b')](_0x334d15[_0x3e35('0x89')],['priority'],['asc']);if(_0x334d15[_0x3e35('0x88')][_0x3e35('0x86')]){delete _0x334d15[_0x3e35('0x88')][_0x3e35('0x86')];}if(_0x334d15[_0x3e35('0x88')][_0x3e35('0x87')]&&_0x334d15[_0x3e35('0x88')][_0x3e35('0x87')]['Contacts']['length']){return _0x334d15[_0x3e35('0x88')][_0x3e35('0x87')][_0x3e35('0x83')][0x0];}var _0x1e2f2a=_[_0x3e35('0x1b')](_0x48dfb0[_0x3e35('0x5e')],{'firstName':_0x48dfb0['body'][_0x3e35('0x7b')],'ListId':_0x395fda[_0x3e35('0x79')]});_0x1e2f2a[_0x48dfb0[_0x3e35('0x5e')][_0x3e35('0x7e')]]=_0x48dfb0['body'][_0x3e35('0x7b')];return db[_0x3e35('0x74')]['create'](_0x1e2f2a,{'fields':_0x265ab9,'raw':!![]});}})[_0x3e35('0x38')](handleEntityNotFound(_0x530c3a,null))['then'](function(_0x14339a){_0x334d15['contact']=_0x14339a;if(_0x14339a){var _0x4894bc={'ContactId':_0x14339a['id'],'OpenchannelAccountId':_0x48dfb0['params']['id'],'from':(_0x14339a[_0x3e35('0x8c')]||'')+'\x20'+(_0x14339a[_0x3e35('0x8d')]||'')};var _0x387f12={'OpenchannelAccountId':_0x48dfb0['params']['id'],'closed':![]};if(_0x48dfb0[_0x3e35('0x5e')][_0x3e35('0x8e')]){_0x387f12[_0x3e35('0x8e')]=_0x48dfb0[_0x3e35('0x5e')][_0x3e35('0x8e')];return db[_0x3e35('0x8f')][_0x3e35('0x64')]({'where':_0x387f12})[_0x3e35('0x38')](function(_0x54e58a){if(_0x54e58a){return[_0x54e58a,![]];}_0x4894bc[_0x3e35('0x8e')]=_0x48dfb0[_0x3e35('0x5e')]['threadId'];_0x4894bc[_0x3e35('0x90')]=_0x48dfb0[_0x3e35('0x5e')][_0x3e35('0x90')];return db['OpenchannelInteraction'][_0x3e35('0x5d')](_0x4894bc)['then'](function(_0x51bf3f){return[_0x51bf3f,!![]];});});}else{_0x387f12[_0x3e35('0x8e')]=null;}_0x387f12[_0x3e35('0x91')]=_0x14339a['id'];return db[_0x3e35('0x8f')][_0x3e35('0x64')]({'where':_0x387f12})[_0x3e35('0x38')](function(_0x1972fa){if(_0x1972fa){return[_0x1972fa,![]];}return db[_0x3e35('0x8f')][_0x3e35('0x5d')](_0x4894bc)[_0x3e35('0x38')](function(_0x487ea3){return[_0x487ea3,!![]];});});}})['spread'](function(_0x39d16b,_0xc270de){if(_0x39d16b){_0x17670a=_0xc270de;if(!_0xc270de){var _0x2a98c4={'from':(_0x334d15[_0x3e35('0x92')][_0x3e35('0x8c')]||'')+'\x20'+(_0x334d15[_0x3e35('0x92')][_0x3e35('0x8d')]||'')};if(_0x48dfb0[_0x3e35('0x5e')][_0x3e35('0x8e')]&&_0x48dfb0[_0x3e35('0x5e')][_0x3e35('0x93')]&&_0x48dfb0[_0x3e35('0x5e')][_0x3e35('0x8e')]!=_0x48dfb0[_0x3e35('0x5e')][_0x3e35('0x93')]){_0x2a98c4[_0x3e35('0x8e')]=_0x48dfb0[_0x3e35('0x5e')][_0x3e35('0x93')];}return _0x39d16b[_0x3e35('0x37')](_0x2a98c4);}else{return _0x39d16b;}}})[_0x3e35('0x38')](function(_0x23718c){_0x334d15['interaction']=_0x23718c[_0x3e35('0x5f')]({'plain':!![]});_0x334d15[_0x3e35('0x94')]['created']=_0x17670a;if(_0x334d15['interaction'][_0x3e35('0x95')]){if(_0x334d15[_0x3e35('0x88')][_0x3e35('0x96')]){_0x334d15[_0x3e35('0x89')][_0x3e35('0x97')]({'id':0x0,'priority':_0x334d15[_0x3e35('0x89')][_0x3e35('0x4b')]+0x1,'app':_0x3e35('0x98'),'appdata':_0x3e35('0x99'),'interval':_0x3e35('0x9a')});}}return db['OpenchannelMessage']['create']({'body':_0x48dfb0[_0x3e35('0x5e')]['body'],'OpenchannelAccountId':_0x48dfb0[_0x3e35('0x59')]['id'],'OpenchannelInteractionId':_0x23718c['id'],'direction':'in','ContactId':_0x334d15[_0x3e35('0x92')]['id'],'AttachmentId':_0x48dfb0['body'][_0x3e35('0x9b')]});})[_0x3e35('0x38')](function(_0x58a1d8){_0x334d15[_0x3e35('0x2a')]=_0x58a1d8;if(!_0x334d15[_0x3e35('0x94')][_0x3e35('0x9c')])return;return db[_0x3e35('0x9d')][_0x3e35('0x64')]({'attributes':['id',_0x3e35('0x3d')],'where':{'id':_0x334d15[_0x3e35('0x94')]['UserId']}});})[_0x3e35('0x38')](function(_0x4c6147){if(_0x4c6147){_0x334d15[_0x3e35('0x89')]['unshift']({'id':0x0,'priority':0x0,'app':_0x3e35('0x9e'),'appdata':_0x4c6147[_0x3e35('0x3d')]+','+(_0x334d15[_0x3e35('0x88')][_0x3e35('0x9f')]||0xa),'interval':_0x3e35('0x9a')});}if(!_0x334d15[_0x3e35('0x94')]['queueId'])return;return db[_0x3e35('0xa0')]['find']({'attributes':['id',_0x3e35('0x3d')],'where':{'id':_0x334d15[_0x3e35('0x94')][_0x3e35('0xa1')]}});})['then'](function(_0x240168){if(_0x240168){_0x334d15[_0x3e35('0x89')][_0x3e35('0xa2')]({'id':0x0,'priority':0x1,'app':_0x3e35('0xa3'),'appdata':_0x240168[_0x3e35('0x3d')]+','+(_0x334d15['account'][_0x3e35('0xa4')]||0x12c),'interval':_0x3e35('0x9a')});}return respondWithRpcPromise(_0x3e35('0xa5'),_0x3e35('0xa6'),_0x334d15);})[_0x3e35('0x38')](function(_0x3103f9){respondWithRpcPromise(_0x3e35('0xa7'),'EventManager',{'event':'notify','message':_0x3103f9},client9002);return _0x3103f9;})['then'](respondWithResult(_0x530c3a,null))[_0x3e35('0x2b')](handleError(_0x530c3a,null));};exports[_0x3e35('0xa8')]=function(_0x1b2ea6,_0x1bc3e0){var _0x1b5832=_0x1b2ea6[_0x3e35('0x59')]['id'];var _0x19dc3c=_0x1b2ea6[_0x3e35('0x5e')];var _0x5aff82=0xc8;var _0x33ec66=null;return db[_0x3e35('0xa9')]['transaction']({'isolationLevel':db[_0x3e35('0xa9')][_0x3e35('0xaa')][_0x3e35('0xab')][_0x3e35('0xac')]},function(_0x52e56d){return db[_0x3e35('0x41')]['findOne']({'where':{'id':_0x1b5832},'transaction':_0x52e56d})[_0x3e35('0x38')](function(_0x120b03){if(_0x120b03){return db['OpenchannelApplication'][_0x3e35('0x39')]({'where':{'OpenchannelAccountId':_0x1b5832},'transaction':_0x52e56d})[_0x3e35('0x38')](function(){var _0x3175e2=_['map'](_0x19dc3c,function(_0x2b88b6){_0x2b88b6[_0x3e35('0x67')]=_0x1b5832;return _0x2b88b6;});return db[_0x3e35('0x85')][_0x3e35('0xad')](_0x3175e2,{'transaction':_0x52e56d});});}else{_0x5aff82=0x194;_0x33ec66=[];}});})[_0x3e35('0x38')](function(){if(_0x5aff82!==0x194){return db[_0x3e35('0x85')]['findAndCountAll']({'where':{'OpenchannelAccountId':_0x1b5832},'order':_0x3e35('0xae')})[_0x3e35('0x38')](function(_0x4894ad){_0x33ec66=_0x4894ad;});}})[_0x3e35('0x2b')](function(_0x143225){_0x5aff82=0x1f4;logger[_0x3e35('0x28')](_0x143225['stack']);if(_0x143225[_0x3e35('0x3d')]){delete _0x143225[_0x3e35('0x3d')];}_0x33ec66=_0x143225;})[_0x3e35('0xaf')](function(){if(_0x33ec66===null){_0x1bc3e0[_0x3e35('0x2c')](_0x5aff82);}else{if(_0x5aff82===0x1f4){_0x1bc3e0[_0x3e35('0x2e')](_0x5aff82)[_0x3e35('0x3e')](_0x33ec66);}else{_0x1bc3e0[_0x3e35('0x2e')](_0x5aff82)[_0x3e35('0x33')](_0x33ec66);}}});};exports[_0x3e35('0xb0')]=function(_0xe3eb7e,_0x3f39ab,_0x2691a2){var _0x2f17c5={};var _0x361567={};var _0x13d775;var _0x23f3a5;return db[_0x3e35('0x41')][_0x3e35('0x6a')]({'where':{'id':_0xe3eb7e[_0x3e35('0x59')]['id']}})['then'](handleEntityNotFound(_0x3f39ab,null))[_0x3e35('0x38')](function(_0x3499eb){if(_0x3499eb){_0x13d775=_0x3499eb;_0x361567['model']=_[_0x3e35('0x5b')](db[_0x3e35('0x85')]['rawAttributes']);_0x361567[_0x3e35('0x45')]=_[_0x3e35('0x5b')](_0xe3eb7e[_0x3e35('0x45')]);_0x361567[_0x3e35('0x46')]=_['intersection'](_0x361567['model'],_0x361567['query']);_0x2f17c5[_0x3e35('0x48')]=_[_0x3e35('0x49')](_0x361567[_0x3e35('0x47')],qs['fields'](_0xe3eb7e['query'][_0x3e35('0x4a')]));_0x2f17c5[_0x3e35('0x48')]=_0x2f17c5[_0x3e35('0x48')][_0x3e35('0x4b')]?_0x2f17c5[_0x3e35('0x48')]:_0x361567[_0x3e35('0x47')];_0x2f17c5[_0x3e35('0x6b')]=qs[_0x3e35('0x4e')](_0xe3eb7e['query'][_0x3e35('0x4e')]);_0x2f17c5[_0x3e35('0x4f')]=qs[_0x3e35('0x46')](_['pick'](_0xe3eb7e['query'],_0x361567[_0x3e35('0x46')]));if(_0xe3eb7e[_0x3e35('0x45')][_0x3e35('0x50')]){_0x2f17c5[_0x3e35('0x4f')]=_[_0x3e35('0x53')](_0x2f17c5[_0x3e35('0x4f')],{'$or':_[_0x3e35('0x51')](_0x2f17c5[_0x3e35('0x48')],function(_0xb27d39){var _0x4c86b0={};_0x4c86b0[_0xb27d39]={'$like':'%'+_0xe3eb7e['query'][_0x3e35('0x50')]+'%'};return _0x4c86b0;})});}_0x2f17c5=_[_0x3e35('0x53')]({},_0x2f17c5,_0xe3eb7e[_0x3e35('0x54')]);return _0x13d775[_0x3e35('0xb0')](_0x2f17c5);}})[_0x3e35('0x38')](function(_0x127068){if(_0x127068){_0x23f3a5=_0x127068[_0x3e35('0x4b')];if(!_0xe3eb7e['query'][_0x3e35('0x4c')](_0x3e35('0x4d'))){_0x2f17c5[_0x3e35('0x31')]=qs['limit'](_0xe3eb7e['query'][_0x3e35('0x31')]);_0x2f17c5[_0x3e35('0x2f')]=qs['offset'](_0xe3eb7e['query']['offset']);}return _0x13d775[_0x3e35('0xb0')](_0x2f17c5);}})['then'](function(_0x1a6c19){if(_0x1a6c19){return _0x1a6c19?{'count':_0x23f3a5,'rows':_0x1a6c19}:null;}})[_0x3e35('0x38')](respondWithResult(_0x3f39ab,null))[_0x3e35('0x2b')](handleError(_0x3f39ab,null));};exports['getInteractions']=function(_0x17a3fb,_0xb538fb,_0x4d7754){var _0x545359={'raw':![],'where':{}};var _0x16d2cf={};var _0x309d03={'count':0x0,'rows':[]};return db[_0x3e35('0x41')][_0x3e35('0x6a')]({'where':{'id':_0x17a3fb[_0x3e35('0x59')]['id']}})[_0x3e35('0x38')](handleEntityNotFound(_0xb538fb,null))[_0x3e35('0x38')](function(_0x277f1b){if(_0x277f1b){_0x16d2cf[_0x3e35('0x47')]=_[_0x3e35('0x5b')](db[_0x3e35('0x8f')][_0x3e35('0x42')]);_0x16d2cf[_0x3e35('0x45')]=_[_0x3e35('0x5b')](_0x17a3fb['query']);_0x16d2cf[_0x3e35('0x46')]=_['intersection'](_0x16d2cf[_0x3e35('0x47')],_0x16d2cf[_0x3e35('0x45')]);_0x545359[_0x3e35('0x48')]=_[_0x3e35('0x49')](_0x16d2cf[_0x3e35('0x47')],qs[_0x3e35('0x4a')](_0x17a3fb[_0x3e35('0x45')]['fields']));_0x545359[_0x3e35('0x48')]=_0x545359['attributes'][_0x3e35('0x4b')]?_0x545359['attributes']:_0x16d2cf[_0x3e35('0x47')];if(!_0x17a3fb[_0x3e35('0x45')][_0x3e35('0x4c')]('nolimit')){_0x545359[_0x3e35('0x31')]=qs[_0x3e35('0x31')](_0x17a3fb[_0x3e35('0x45')][_0x3e35('0x31')]);_0x545359[_0x3e35('0x2f')]=qs[_0x3e35('0x2f')](_0x17a3fb[_0x3e35('0x45')][_0x3e35('0x2f')]);}_0x545359['order']=qs[_0x3e35('0x4e')](_0x17a3fb[_0x3e35('0x45')][_0x3e35('0x4e')]);_0x545359[_0x3e35('0x4f')]=qs[_0x3e35('0x46')](_[_0x3e35('0x6c')](_0x17a3fb['query'],_0x16d2cf[_0x3e35('0x46')]));_0x545359['where'][_0x3e35('0x67')]=_0x277f1b['id'];if(_0x17a3fb['query'][_0x3e35('0x50')]){_0x545359[_0x3e35('0x4f')]=_['merge'](_0x545359[_0x3e35('0x4f')],{'$or':_[_0x3e35('0x51')](_0x545359[_0x3e35('0x48')],function(_0x40c81a){var _0x24d758={};_0x24d758[_0x40c81a]={'$like':'%'+_0x17a3fb[_0x3e35('0x45')][_0x3e35('0x50')]+'%'};return _0x24d758;})});}_0x545359=_[_0x3e35('0x53')]({},_0x545359,_0x17a3fb[_0x3e35('0x54')]);return db['OpenchannelInteraction'][_0x3e35('0x32')]({'where':_0x545359[_0x3e35('0x4f')]})[_0x3e35('0x38')](function(_0x52746d){_0x309d03[_0x3e35('0x32')]=_0x52746d;if(_0x17a3fb[_0x3e35('0x45')][_0x3e35('0x5c')]){_0x545359[_0x3e35('0x55')]=[{'model':db[_0x3e35('0x74')],'as':_0x3e35('0xb1'),'required':![]},{'model':db['User'],'as':_0x3e35('0xb2'),'attributes':[_0x3e35('0x3d'),_0x3e35('0xb3'),_0x3e35('0xb4')],'required':![]},{'model':db[_0x3e35('0xb5')],'as':_0x3e35('0xb6'),'attributes':['id','name',_0x3e35('0xb7')],'where':_0x17a3fb[_0x3e35('0x45')][_0x3e35('0xb8')]?{'id':_0x17a3fb[_0x3e35('0x45')][_0x3e35('0xb8')]}:undefined,'required':_0x17a3fb[_0x3e35('0x45')]['tag']?!![]:![]}];}return db['OpenchannelInteraction'][_0x3e35('0x56')](_0x545359);})[_0x3e35('0x38')](function(_0x2a675c){_0x309d03[_0x3e35('0x57')]=_0x2a675c;return _0x309d03;});}})[_0x3e35('0x38')](respondWithFilteredResult(_0xb538fb,_0x545359))[_0x3e35('0x2b')](handleError(_0xb538fb,null));};exports[_0x3e35('0xb9')]=function(_0x6cf676,_0x599fd2,_0xb2c8e6){return db['OpenchannelAccount'][_0x3e35('0x64')]({'where':{'id':_0x6cf676[_0x3e35('0x59')]['id']}})[_0x3e35('0x38')](handleEntityNotFound(_0x599fd2,null))[_0x3e35('0x38')](function(_0x289994){if(_0x289994){return _0x289994[_0x3e35('0xb9')](_0x6cf676[_0x3e35('0x5e')][_0x3e35('0x6e')],_[_0x3e35('0xba')](_0x6cf676[_0x3e35('0x5e')],[_0x3e35('0x6e'),'id'])||{})[_0x3e35('0xbb')](function(_0x3320fe){for(var _0x5a89f6=0x0;_0x5a89f6<_0x6cf676[_0x3e35('0x5e')][_0x3e35('0x6e')][_0x3e35('0x4b')];_0x5a89f6+=0x1){socket[_0x3e35('0xbc')](_0x3e35('0xbd'),{'UserId':Number(_0x6cf676[_0x3e35('0x5e')][_0x3e35('0x6e')][_0x5a89f6]),'OpenchannelAccountId':Number(_0x6cf676[_0x3e35('0x59')]['id'])});}return _0x3320fe;});}})['then'](respondWithResult(_0x599fd2,null))[_0x3e35('0x2b')](handleError(_0x599fd2,null));};exports[_0x3e35('0xbe')]=function(_0x647512,_0x7d586a,_0x354be8){return db[_0x3e35('0x41')][_0x3e35('0x64')]({'where':{'id':_0x647512[_0x3e35('0x59')]['id']}})[_0x3e35('0x38')](handleEntityNotFound(_0x7d586a,null))[_0x3e35('0x38')](function(_0x5eab0a){if(_0x5eab0a){return _0x5eab0a['removeAgents'](_0x647512[_0x3e35('0x45')][_0x3e35('0x6e')])[_0x3e35('0x38')](function(){if(_['isArray'](_0x647512['query'][_0x3e35('0x6e')])){for(var _0x16de86=0x0;_0x16de86<_0x647512[_0x3e35('0x45')][_0x3e35('0x6e')][_0x3e35('0x4b')];_0x16de86+=0x1){socket[_0x3e35('0xbc')](_0x3e35('0xbf'),{'UserId':Number(_0x647512[_0x3e35('0x45')]['ids'][_0x16de86]),'OpenchannelAccountId':Number(_0x647512[_0x3e35('0x59')]['id'])});}}else{socket[_0x3e35('0xbc')](_0x3e35('0xbf'),{'UserId':Number(_0x647512[_0x3e35('0x45')]['ids']),'OpenchannelAccountId':Number(_0x647512[_0x3e35('0x59')]['id'])});}});}})[_0x3e35('0x38')](respondWithStatusCode(_0x7d586a,null))['catch'](handleError(_0x7d586a,null));};exports[_0x3e35('0xc0')]=function(_0x54497f,_0x36c77d,_0x485058){var _0x33639a={};var _0x5e07d2={};var _0x4c8df5;var _0x567a79;return db[_0x3e35('0x41')][_0x3e35('0x6a')]({'where':{'id':_0x54497f['params']['id']}})['then'](handleEntityNotFound(_0x36c77d,null))[_0x3e35('0x38')](function(_0x2d4ba0){if(_0x2d4ba0){_0x4c8df5=_0x2d4ba0;_0x5e07d2[_0x3e35('0x47')]=_['keys'](db['User'][_0x3e35('0x42')]);_0x5e07d2[_0x3e35('0x45')]=_[_0x3e35('0x5b')](_0x54497f[_0x3e35('0x45')]);_0x5e07d2[_0x3e35('0x46')]=_['intersection'](_0x5e07d2[_0x3e35('0x47')],_0x5e07d2['query']);_0x33639a[_0x3e35('0x48')]=_[_0x3e35('0x49')](_0x5e07d2[_0x3e35('0x47')],qs['fields'](_0x54497f['query']['fields']));_0x33639a[_0x3e35('0x48')]=_0x33639a[_0x3e35('0x48')][_0x3e35('0x4b')]?_0x33639a[_0x3e35('0x48')]:_0x5e07d2[_0x3e35('0x47')];_0x33639a[_0x3e35('0x6b')]=qs[_0x3e35('0x4e')](_0x54497f[_0x3e35('0x45')][_0x3e35('0x4e')]);_0x33639a[_0x3e35('0x4f')]=qs['filters'](_[_0x3e35('0x6c')](_0x54497f[_0x3e35('0x45')],_0x5e07d2[_0x3e35('0x46')]));if(_0x54497f[_0x3e35('0x45')][_0x3e35('0x50')]){_0x33639a['where']=_[_0x3e35('0x53')](_0x33639a['where'],{'$or':_['map'](_0x33639a[_0x3e35('0x48')],function(_0x4ad611){var _0x32d7f7={};_0x32d7f7[_0x4ad611]={'$like':'%'+_0x54497f[_0x3e35('0x45')][_0x3e35('0x50')]+'%'};return _0x32d7f7;})});}_0x33639a=_[_0x3e35('0x53')]({},_0x33639a,_0x54497f[_0x3e35('0x54')]);return _0x4c8df5[_0x3e35('0xc0')](_0x33639a);}})['then'](function(_0x56a296){if(_0x56a296){_0x567a79=_0x56a296['length'];if(!_0x54497f['query']['hasOwnProperty']('nolimit')){_0x33639a[_0x3e35('0x31')]=qs[_0x3e35('0x31')](_0x54497f[_0x3e35('0x45')][_0x3e35('0x31')]);_0x33639a[_0x3e35('0x2f')]=qs['offset'](_0x54497f['query'][_0x3e35('0x2f')]);}return _0x4c8df5[_0x3e35('0xc0')](_0x33639a);}})['then'](function(_0x26bd34){if(_0x26bd34){return _0x26bd34?{'count':_0x567a79,'rows':_0x26bd34}:null;}})[_0x3e35('0x38')](respondWithResult(_0x36c77d,null))['catch'](handleError(_0x36c77d,null));};exports['send']=function(_0x41a3dd,_0x16bd9e,_0x598a9e){var _0x4c72ef,_0x5f0ff9,_0x4a920a;if(_[_0x3e35('0x7a')](_0x41a3dd['body'][_0x3e35('0x5e')])||_0x41a3dd[_0x3e35('0x5e')][_0x3e35('0x5e')]===''){throw new db[(_0x3e35('0x75'))][(_0x3e35('0x7c'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x3e35('0x7a')](_0x41a3dd[_0x3e35('0x5e')]['to'])){}_0x4c72ef=_0x41a3dd['body']['to'];return db[_0x3e35('0x41')]['findOne']({'where':{'id':_0x41a3dd[_0x3e35('0x59')]['id']}})['then'](handleEntityNotFound(_0x16bd9e,null))[_0x3e35('0x38')](function(_0x902e7a){if(_0x902e7a){return db[_0x3e35('0x41')]['find']({'where':{'id':_0x902e7a['id']},'include':[{'model':db[_0x3e35('0x82')],'as':_0x3e35('0x87'),'include':[{'model':db['CmContact'],'as':_0x3e35('0x83'),'where':{[_0x902e7a[_0x3e35('0x7e')]]:_0x4c72ef},'limit':0x1,'order':[[_0x3e35('0x78'),_0x3e35('0x84')]]}]}]})[_0x3e35('0x38')](handleEntityNotFound(_0x16bd9e,null))[_0x3e35('0x38')](function(_0x37bff5){if(_0x37bff5&&_0x37bff5[_0x3e35('0x87')]){_0x5f0ff9=_0x37bff5[_0x3e35('0x5f')]({'plain':!![]});if(_0x5f0ff9['List']&&_0x5f0ff9[_0x3e35('0x87')][_0x3e35('0x83')][_0x3e35('0x4b')]){return _0x5f0ff9[_0x3e35('0x87')][_0x3e35('0x83')][0x0];}return db['CmContact'][_0x3e35('0x5d')](_[_0x3e35('0x1b')](_0x41a3dd['body'],{'firstName':_0x4c72ef,[_0x37bff5[_0x3e35('0x7e')]]:_0x4c72ef,'phone':_0x4c72ef,'ListId':_0x5f0ff9['ListId']}));}})[_0x3e35('0x38')](handleEntityNotFound(_0x16bd9e,null))[_0x3e35('0x38')](function(_0x3746b9){if(_0x3746b9){_0x4a920a=_0x3746b9;return db[_0x3e35('0x8f')][_0x3e35('0x64')]({'where':{'ContactId':_0x4a920a['id'],'closed':![],'OpenchannelAccountId':_0x5f0ff9['id']}})[_0x3e35('0x38')](function(_0x2d2e13){if(_0x2d2e13){return[_0x2d2e13,![]];}return db[_0x3e35('0x8f')][_0x3e35('0x5d')]({'UserId':_0x41a3dd[_0x3e35('0x62')]['id'],'ContactId':_0x4a920a['id'],'OpenchannelAccountId':_0x5f0ff9['id'],'lastMsgDirection':_0x3e35('0xc1'),'firstMsgDirection':_0x3e35('0xc1'),'Messages':[_[_0x3e35('0x53')](_0x41a3dd[_0x3e35('0x5e')],{'read':![],'body':_0x41a3dd[_0x3e35('0x5e')][_0x3e35('0x5e')],'OpenchannelAccountId':_0x5f0ff9['id'],'UserId':_0x41a3dd['user']['id'],'ContactId':_0x4a920a['id']})]},{'include':[{'model':db[_0x3e35('0xc2')],'as':_0x3e35('0xc3')}]})[_0x3e35('0x38')](function(_0x42e918){return[_0x42e918,!![]];});});}})['spread'](function(_0x550788,_0x47817c){if(_0x47817c){return _0x550788;}return db[_0x3e35('0xc2')][_0x3e35('0x5d')](_['merge'](_0x41a3dd[_0x3e35('0x5e')],{'read':![],'body':_0x41a3dd['body'][_0x3e35('0x5e')],'OpenchannelAccountId':_0x5f0ff9['id'],'OpenchannelInteractionId':_0x550788['id'],'UserId':_0x41a3dd[_0x3e35('0x62')]['id'],'ContactId':_0x4a920a['id']}))[_0x3e35('0x38')](function(_0x140468){_0x550788[_0x3e35('0xc4')][_0x3e35('0xc3')]=[];_0x550788[_0x3e35('0xc4')][_0x3e35('0xc3')]['push'](_0x140468[_0x3e35('0xc4')]);return _0x550788;});});}})[_0x3e35('0x38')](respondWithResult(_0x16bd9e,null))['catch'](handleError(_0x16bd9e,null));}; \ No newline at end of file +var _0x8991=['OpenchannelMessage','UserId','User','unshift','waitForTheAssignedAgent','OpenchannelQueue','queue','waitForTheAssignedQueue','Start','startRouting','EventManager','notify','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','findOne','bulkCreate','findAndCountAll','finally','getApplications','rawAttributes','getInteractions','Contact','Owner','fullname','internal','Tag','Tags','tag','addAgents','emit','userOpenchannelAccount:save','removeAgents','isArray','userOpenchannelAccount:remove','getAgents','CmList','out','Messages','dataValues','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','defaults','redis','socket.io-emitter','./openchannelAccount.socket','register','client','http','then','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','destroy','get','OpenchannelAccounts','end','stack','name','send','Pause','map','fieldName','key','model','query','filters','intersection','attributes','fields','nolimit','order','sort','where','merge','type','VIRTUAL','filter','OpenchannelAccount','include','findAll','rows','catch','show','params','mandatoryDispositionPause','keys','includeAll','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','describe','addDisposition','OpenchannelAccountId','Disposition','getDispositions','length','hasOwnProperty','pick','options','removeDispositions','ids','addAnswer','CannedAnswer','removeAnswers','openchannel','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','createdAt','updatedAt','difference','CompanyId','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','from','List','Contacts','DESC','OpenchannelApplication','Applications','account','applications','list','orderBy','priority','ListId','contact','firstName','threadId','OpenchannelInteraction','externalUrl','ContactId','spread','messageId','interaction','created','push','close','unmanaged','*,*,*,*'];(function(_0x4f9b18,_0x2cb5ca){var _0x29f20c=function(_0x268b3d){while(--_0x268b3d){_0x4f9b18['push'](_0x4f9b18['shift']());}};_0x29f20c(++_0x2cb5ca);}(_0x8991,0x1b0));var _0x1899=function(_0x42bfb7,_0x25a3ec){_0x42bfb7=_0x42bfb7-0x0;var _0x5c497d=_0x8991[_0x42bfb7];return _0x5c497d;};'use strict';var emlformat=require(_0x1899('0x0'));var rimraf=require(_0x1899('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x1899('0x2'));var moment=require(_0x1899('0x3'));var BPromise=require(_0x1899('0x4'));var Mustache=require(_0x1899('0x5'));var util=require(_0x1899('0x6'));var path=require(_0x1899('0x7'));var sox=require(_0x1899('0x8'));var csv=require(_0x1899('0x9'));var ejs=require(_0x1899('0xa'));var fs=require('fs');var fs_extra=require(_0x1899('0xb'));var _=require(_0x1899('0xc'));var squel=require(_0x1899('0xd'));var crypto=require(_0x1899('0xe'));var jsforce=require(_0x1899('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x1899('0x9'));var querystring=require(_0x1899('0x10'));var Papa=require('papaparse');var Redis=require(_0x1899('0x11'));var authService=require(_0x1899('0x12'));var qs=require(_0x1899('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1899('0x14'));var logger=require(_0x1899('0x15'))(_0x1899('0x16'));var utils=require(_0x1899('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x1899('0x18'))['db'];config['redis']=_[_0x1899('0x19')](config[_0x1899('0x1a')],{'host':'localhost','port':0x18eb});var socket=require(_0x1899('0x1b'))(new Redis(config[_0x1899('0x1a')]));require(_0x1899('0x1c'))[_0x1899('0x1d')](socket);var jayson=require('jayson/promise');var client=jayson[_0x1899('0x1e')][_0x1899('0x1f')]({'port':0x232c});var client9002=jayson[_0x1899('0x1e')][_0x1899('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x245c55,_0x29c778,_0xf3a0b8,_0x482764){return new BPromise(function(_0x5ba31b,_0x56e781){var _0x31330f=_0x482764||client;return _0x31330f['request'](_0x245c55,_0xf3a0b8)[_0x1899('0x20')](function(_0x5ee432){logger[_0x1899('0x21')](_0x1899('0x22'),_0x29c778,_0x1899('0x23'));logger[_0x1899('0x24')](_0x1899('0x25'),_0x29c778,_0x1899('0x23'),JSON[_0x1899('0x26')](_0x5ee432));if(_0x5ee432[_0x1899('0x27')]){if(_0x5ee432[_0x1899('0x27')][_0x1899('0x28')]===0x1f4){logger[_0x1899('0x27')]('OpenchannelAccount,\x20%s,\x20%s',_0x29c778,_0x5ee432[_0x1899('0x27')][_0x1899('0x29')]);return _0x56e781(_0x5ee432['error'][_0x1899('0x29')]);}logger[_0x1899('0x27')]('OpenchannelAccount,\x20%s,\x20%s',_0x29c778,_0x5ee432[_0x1899('0x27')][_0x1899('0x29')]);return _0x5ba31b(_0x5ee432[_0x1899('0x27')]['message']);}else{logger[_0x1899('0x21')](_0x1899('0x22'),_0x29c778,_0x1899('0x23'));_0x5ba31b(_0x5ee432[_0x1899('0x2a')][_0x1899('0x29')]);}})['catch'](function(_0x569c4b){logger[_0x1899('0x27')](_0x1899('0x22'),_0x29c778,_0x569c4b);_0x56e781(_0x569c4b);});});}function respondWithStatusCode(_0x28ca90,_0xbb935f){_0xbb935f=_0xbb935f||0xcc;return function(_0x3730ed){if(_0x3730ed){return _0x28ca90[_0x1899('0x2b')](_0xbb935f);}return _0x28ca90[_0x1899('0x2c')](_0xbb935f)['end']();};}function respondWithResult(_0x2aa9c1,_0x109581){_0x109581=_0x109581||0xc8;return function(_0x556ff2){if(_0x556ff2){return _0x2aa9c1[_0x1899('0x2c')](_0x109581)[_0x1899('0x2d')](_0x556ff2);}};}function respondWithFilteredResult(_0x52be21,_0x55d2f9){return function(_0x809138){if(_0x809138){var _0x286dc8=typeof _0x55d2f9['offset']===_0x1899('0x2e')&&typeof _0x55d2f9[_0x1899('0x2f')]===_0x1899('0x2e');var _0x2dddae=_0x809138[_0x1899('0x30')];var _0x4dc9fd=_0x286dc8?0x0:_0x55d2f9[_0x1899('0x31')];var _0x2e4adb=_0x286dc8?_0x809138[_0x1899('0x30')]:_0x55d2f9[_0x1899('0x31')]+_0x55d2f9['limit'];var _0x25aa07;if(_0x2e4adb>=_0x2dddae){_0x2e4adb=_0x2dddae;_0x25aa07=0xc8;}else{_0x25aa07=0xce;}_0x52be21['status'](_0x25aa07);return _0x52be21[_0x1899('0x32')](_0x1899('0x33'),_0x4dc9fd+'-'+_0x2e4adb+'/'+_0x2dddae)[_0x1899('0x2d')](_0x809138);}return null;};}function patchUpdates(_0x1d9682){return function(_0x38d0b8){try{jsonpatch[_0x1899('0x34')](_0x38d0b8,_0x1d9682,!![]);}catch(_0x1c89dc){return BPromise[_0x1899('0x35')](_0x1c89dc);}return _0x38d0b8[_0x1899('0x36')]();};}function saveUpdates(_0x36ea00,_0x3473e9){return function(_0x1d5a5e){if(_0x1d5a5e){return _0x1d5a5e[_0x1899('0x37')](_0x36ea00)[_0x1899('0x20')](function(_0x82bf77){return _0x82bf77;});}return null;};}function removeEntity(_0x4a7a31,_0x5d45ba){return function(_0x5e0055){if(_0x5e0055){return _0x5e0055[_0x1899('0x38')]()['then'](function(){var _0x5a3215=_0x5e0055[_0x1899('0x39')]({'plain':!![]});var _0x3dff05=_0x1899('0x3a');return db['UserProfileResource']['destroy']({'where':{'type':_0x3dff05,'resourceId':_0x5a3215['id']}})['then'](function(){return _0x5e0055;});})['then'](function(){_0x4a7a31[_0x1899('0x2c')](0xcc)[_0x1899('0x3b')]();});}};}function handleEntityNotFound(_0x25eb23,_0x10d9e1){return function(_0x45f054){if(!_0x45f054){_0x25eb23['sendStatus'](0x194);}return _0x45f054;};}function handleError(_0x3e0432,_0xa9c8c0){_0xa9c8c0=_0xa9c8c0||0x1f4;return function(_0x2160a5){logger[_0x1899('0x27')](_0x2160a5[_0x1899('0x3c')]);if(_0x2160a5[_0x1899('0x3d')]){delete _0x2160a5['name'];}_0x3e0432['status'](_0xa9c8c0)[_0x1899('0x3e')](_0x2160a5);};}exports['index']=function(_0x599c7a,_0x81c10c){var _0x4fdfc3={'include':[{'model':db[_0x1899('0x3f')],'as':'mandatoryDispositionPause'}]},_0x221bad={},_0x202116={'count':0x0,'rows':[]};var _0x578f52=_[_0x1899('0x40')](db['OpenchannelAccount']['rawAttributes'],function(_0x3c4fc8){return{'name':_0x3c4fc8[_0x1899('0x41')],'type':_0x3c4fc8['type'][_0x1899('0x42')]};});_0x221bad[_0x1899('0x43')]=_[_0x1899('0x40')](_0x578f52,'name');_0x221bad[_0x1899('0x44')]=_['keys'](_0x599c7a[_0x1899('0x44')]);_0x221bad[_0x1899('0x45')]=_[_0x1899('0x46')](_0x221bad[_0x1899('0x43')],_0x221bad[_0x1899('0x44')]);_0x4fdfc3[_0x1899('0x47')]=_[_0x1899('0x46')](_0x221bad[_0x1899('0x43')],qs[_0x1899('0x48')](_0x599c7a[_0x1899('0x44')][_0x1899('0x48')]));_0x4fdfc3[_0x1899('0x47')]=_0x4fdfc3['attributes']['length']?_0x4fdfc3[_0x1899('0x47')]:_0x221bad[_0x1899('0x43')];if(!_0x599c7a[_0x1899('0x44')]['hasOwnProperty'](_0x1899('0x49'))){_0x4fdfc3[_0x1899('0x2f')]=qs[_0x1899('0x2f')](_0x599c7a[_0x1899('0x44')][_0x1899('0x2f')]);_0x4fdfc3['offset']=qs[_0x1899('0x31')](_0x599c7a[_0x1899('0x44')]['offset']);}_0x4fdfc3[_0x1899('0x4a')]=qs[_0x1899('0x4b')](_0x599c7a[_0x1899('0x44')][_0x1899('0x4b')]);_0x4fdfc3[_0x1899('0x4c')]=qs[_0x1899('0x45')](_['pick'](_0x599c7a[_0x1899('0x44')],_0x221bad[_0x1899('0x45')]),_0x578f52);if(_0x599c7a[_0x1899('0x44')]['filter']){_0x4fdfc3[_0x1899('0x4c')]=_[_0x1899('0x4d')](_0x4fdfc3[_0x1899('0x4c')],{'$or':_[_0x1899('0x40')](_0x578f52,function(_0x55324c){if(_0x55324c[_0x1899('0x4e')]!==_0x1899('0x4f')){var _0x353de4={};_0x353de4[_0x55324c['name']]={'$like':'%'+_0x599c7a[_0x1899('0x44')][_0x1899('0x50')]+'%'};return _0x353de4;}})});}_0x4fdfc3=_[_0x1899('0x4d')]({},_0x4fdfc3,_0x599c7a['options']);var _0x1e1342={'where':_0x4fdfc3[_0x1899('0x4c')]};return db[_0x1899('0x51')][_0x1899('0x30')](_0x1e1342)[_0x1899('0x20')](function(_0x1c1bd5){_0x202116['count']=_0x1c1bd5;if(_0x599c7a[_0x1899('0x44')]['includeAll']){_0x4fdfc3[_0x1899('0x52')]=[{'all':!![]}];}return db[_0x1899('0x51')][_0x1899('0x53')](_0x4fdfc3);})['then'](function(_0x4f4c31){_0x202116[_0x1899('0x54')]=_0x4f4c31;return _0x202116;})[_0x1899('0x20')](respondWithFilteredResult(_0x81c10c,_0x4fdfc3))[_0x1899('0x55')](handleError(_0x81c10c,null));};exports[_0x1899('0x56')]=function(_0x342d67,_0x118d47){var _0x46f3f0={'raw':![],'where':{'id':_0x342d67[_0x1899('0x57')]['id']},'include':[{'model':db[_0x1899('0x3f')],'as':_0x1899('0x58')}]},_0x75ed38={};_0x75ed38[_0x1899('0x43')]=_['keys'](db[_0x1899('0x51')]['rawAttributes']);_0x75ed38[_0x1899('0x44')]=_[_0x1899('0x59')](_0x342d67['query']);_0x75ed38[_0x1899('0x45')]=_[_0x1899('0x46')](_0x75ed38[_0x1899('0x43')],_0x75ed38[_0x1899('0x44')]);_0x46f3f0[_0x1899('0x47')]=_['intersection'](_0x75ed38[_0x1899('0x43')],qs['fields'](_0x342d67[_0x1899('0x44')]['fields']));_0x46f3f0['attributes']=_0x46f3f0[_0x1899('0x47')]['length']?_0x46f3f0[_0x1899('0x47')]:_0x75ed38[_0x1899('0x43')];if(_0x342d67['query'][_0x1899('0x5a')]){_0x46f3f0[_0x1899('0x52')]=[{'all':!![]}];}_0x46f3f0=_[_0x1899('0x4d')]({},_0x46f3f0,_0x342d67['options']);return db['OpenchannelAccount']['find'](_0x46f3f0)['then'](handleEntityNotFound(_0x118d47,null))[_0x1899('0x20')](respondWithResult(_0x118d47,null))[_0x1899('0x55')](handleError(_0x118d47,null));};exports['create']=function(_0x585efd,_0x27b076){return db[_0x1899('0x51')][_0x1899('0x5b')](_0x585efd[_0x1899('0x5c')],{})[_0x1899('0x20')](function(_0x8f7234){var _0x35d82f=_0x585efd[_0x1899('0x5d')][_0x1899('0x39')]({'plain':!![]});if(!_0x35d82f)throw new Error(_0x1899('0x5e'));if(_0x35d82f['role']===_0x1899('0x5d')){var _0x15d439=_0x8f7234['get']({'plain':!![]});var _0x983a42=_0x1899('0x3a');return db[_0x1899('0x5f')]['find']({'where':{'name':_0x983a42,'userProfileId':_0x35d82f['userProfileId']},'raw':!![]})[_0x1899('0x20')](function(_0x5b59db){if(_0x5b59db&&_0x5b59db['autoAssociation']===0x0){return db[_0x1899('0x60')][_0x1899('0x5b')]({'name':_0x15d439[_0x1899('0x3d')],'resourceId':_0x15d439['id'],'type':_0x5b59db['name'],'sectionId':_0x5b59db['id']},{})['then'](function(){return _0x8f7234;});}else{return _0x8f7234;}})[_0x1899('0x55')](function(_0x53e546){logger[_0x1899('0x27')](_0x1899('0x61'),_0x53e546);throw _0x53e546;});}return _0x8f7234;})[_0x1899('0x20')](respondWithResult(_0x27b076,0xc9))['catch'](handleError(_0x27b076,null));};exports['update']=function(_0x3d26d0,_0x4b0082){if(_0x3d26d0[_0x1899('0x5c')]['id']){delete _0x3d26d0[_0x1899('0x5c')]['id'];}return db[_0x1899('0x51')]['find']({'where':{'id':_0x3d26d0['params']['id']},'include':[{'model':db['Pause'],'as':_0x1899('0x58')}]})['then'](handleEntityNotFound(_0x4b0082,null))[_0x1899('0x20')](saveUpdates(_0x3d26d0[_0x1899('0x5c')],null))['then'](respondWithResult(_0x4b0082,null))[_0x1899('0x55')](handleError(_0x4b0082,null));};exports['destroy']=function(_0x2c3794,_0xf4db8a){return db[_0x1899('0x51')][_0x1899('0x62')]({'where':{'id':_0x2c3794['params']['id']}})['then'](handleEntityNotFound(_0xf4db8a,null))[_0x1899('0x20')](removeEntity(_0xf4db8a,null))[_0x1899('0x55')](handleError(_0xf4db8a,null));};exports[_0x1899('0x63')]=function(_0x12040c,_0x39381d){return db[_0x1899('0x51')][_0x1899('0x63')]()[_0x1899('0x20')](respondWithResult(_0x39381d,null))[_0x1899('0x55')](handleError(_0x39381d,null));};exports[_0x1899('0x64')]=function(_0x3422b8,_0x4797c3,_0x1da291){if(_0x3422b8['body']['id']){delete _0x3422b8[_0x1899('0x5c')]['id'];}return db[_0x1899('0x51')]['find']({'where':{'id':_0x3422b8['params']['id']}})[_0x1899('0x20')](handleEntityNotFound(_0x4797c3,null))[_0x1899('0x20')](function(_0x5543bd){if(_0x5543bd){_0x3422b8[_0x1899('0x5c')][_0x1899('0x65')]=_0x5543bd['id'];return db[_0x1899('0x66')]['create'](_0x3422b8['body']);}})[_0x1899('0x20')](respondWithResult(_0x4797c3,null))[_0x1899('0x55')](handleError(_0x4797c3,null));};exports[_0x1899('0x67')]=function(_0x3aa72e,_0x44eb1d,_0x5c7e22){var _0x5c4aa7={'raw':![],'where':{}};var _0x3c2484={};var _0x18181b={'count':0x0,'rows':[]};return db['OpenchannelAccount']['findOne']({'where':{'id':_0x3aa72e[_0x1899('0x57')]['id']}})[_0x1899('0x20')](handleEntityNotFound(_0x44eb1d,null))[_0x1899('0x20')](function(_0x4f64e0){if(_0x4f64e0){_0x3c2484[_0x1899('0x43')]=_[_0x1899('0x59')](db[_0x1899('0x66')]['rawAttributes']);_0x3c2484[_0x1899('0x44')]=_[_0x1899('0x59')](_0x3aa72e['query']);_0x3c2484[_0x1899('0x45')]=_[_0x1899('0x46')](_0x3c2484['model'],_0x3c2484[_0x1899('0x44')]);_0x5c4aa7[_0x1899('0x47')]=_[_0x1899('0x46')](_0x3c2484[_0x1899('0x43')],qs[_0x1899('0x48')](_0x3aa72e[_0x1899('0x44')]['fields']));_0x5c4aa7[_0x1899('0x47')]=_0x5c4aa7[_0x1899('0x47')][_0x1899('0x68')]?_0x5c4aa7[_0x1899('0x47')]:_0x3c2484[_0x1899('0x43')];if(!_0x3aa72e[_0x1899('0x44')][_0x1899('0x69')](_0x1899('0x49'))){_0x5c4aa7[_0x1899('0x2f')]=qs['limit'](_0x3aa72e['query'][_0x1899('0x2f')]);_0x5c4aa7[_0x1899('0x31')]=qs[_0x1899('0x31')](_0x3aa72e[_0x1899('0x44')]['offset']);}_0x5c4aa7['order']=qs[_0x1899('0x4b')](_0x3aa72e['query'][_0x1899('0x4b')]);_0x5c4aa7[_0x1899('0x4c')]=qs[_0x1899('0x45')](_[_0x1899('0x6a')](_0x3aa72e[_0x1899('0x44')],_0x3c2484[_0x1899('0x45')]));_0x5c4aa7[_0x1899('0x4c')][_0x1899('0x65')]=_0x4f64e0['id'];if(_0x3aa72e[_0x1899('0x44')][_0x1899('0x50')]){_0x5c4aa7[_0x1899('0x4c')]=_['merge'](_0x5c4aa7['where'],{'$or':_[_0x1899('0x40')](_0x5c4aa7[_0x1899('0x47')],function(_0x74b8ee){var _0x3a1a74={};_0x3a1a74[_0x74b8ee]={'$like':'%'+_0x3aa72e['query'][_0x1899('0x50')]+'%'};return _0x3a1a74;})});}_0x5c4aa7=_[_0x1899('0x4d')]({},_0x5c4aa7,_0x3aa72e[_0x1899('0x6b')]);return db[_0x1899('0x66')]['count']({'where':_0x5c4aa7[_0x1899('0x4c')]})[_0x1899('0x20')](function(_0x4730c2){_0x18181b[_0x1899('0x30')]=_0x4730c2;if(_0x3aa72e[_0x1899('0x44')][_0x1899('0x5a')]){_0x5c4aa7['include']=[{'all':!![]}];}return db[_0x1899('0x66')][_0x1899('0x53')](_0x5c4aa7);})[_0x1899('0x20')](function(_0x4444ab){_0x18181b[_0x1899('0x54')]=_0x4444ab;return _0x18181b;});}})[_0x1899('0x20')](respondWithFilteredResult(_0x44eb1d,_0x5c4aa7))[_0x1899('0x55')](handleError(_0x44eb1d,null));};exports[_0x1899('0x6c')]=function(_0x25195a,_0x23f0e3,_0x2673e7){return db['OpenchannelAccount'][_0x1899('0x62')]({'where':{'id':_0x25195a[_0x1899('0x57')]['id']}})[_0x1899('0x20')](handleEntityNotFound(_0x23f0e3,null))[_0x1899('0x20')](function(_0x275199){if(_0x275199){return _0x275199[_0x1899('0x6c')](_0x25195a['query'][_0x1899('0x6d')]);}})[_0x1899('0x20')](respondWithStatusCode(_0x23f0e3,null))[_0x1899('0x55')](handleError(_0x23f0e3,null));};exports[_0x1899('0x6e')]=function(_0x10fad9,_0x19e5cf,_0x5d90a9){if(_0x10fad9[_0x1899('0x5c')]['id']){delete _0x10fad9[_0x1899('0x5c')]['id'];}return db[_0x1899('0x51')][_0x1899('0x62')]({'where':{'id':_0x10fad9[_0x1899('0x57')]['id']}})[_0x1899('0x20')](handleEntityNotFound(_0x19e5cf,null))[_0x1899('0x20')](function(_0x58beab){if(_0x58beab){_0x10fad9[_0x1899('0x5c')]['OpenchannelAccountId']=_0x58beab['id'];return db[_0x1899('0x6f')][_0x1899('0x5b')](_0x10fad9[_0x1899('0x5c')]);}})['then'](respondWithResult(_0x19e5cf,null))[_0x1899('0x55')](handleError(_0x19e5cf,null));};exports['getAnswers']=function(_0xc1bc7,_0x29d0f3,_0x3b7bf8){var _0x5def50={'raw':![],'where':{}};var _0x4851a1={};var _0x40b019={'count':0x0,'rows':[]};return db[_0x1899('0x51')]['findOne']({'where':{'id':_0xc1bc7[_0x1899('0x57')]['id']}})[_0x1899('0x20')](handleEntityNotFound(_0x29d0f3,null))[_0x1899('0x20')](function(_0x201821){if(_0x201821){_0x4851a1[_0x1899('0x43')]=_['keys'](db[_0x1899('0x6f')]['rawAttributes']);_0x4851a1[_0x1899('0x44')]=_[_0x1899('0x59')](_0xc1bc7[_0x1899('0x44')]);_0x4851a1[_0x1899('0x45')]=_[_0x1899('0x46')](_0x4851a1[_0x1899('0x43')],_0x4851a1[_0x1899('0x44')]);_0x5def50[_0x1899('0x47')]=_['intersection'](_0x4851a1[_0x1899('0x43')],qs[_0x1899('0x48')](_0xc1bc7[_0x1899('0x44')][_0x1899('0x48')]));_0x5def50[_0x1899('0x47')]=_0x5def50['attributes']['length']?_0x5def50[_0x1899('0x47')]:_0x4851a1[_0x1899('0x43')];if(!_0xc1bc7[_0x1899('0x44')]['hasOwnProperty']('nolimit')){_0x5def50[_0x1899('0x2f')]=qs[_0x1899('0x2f')](_0xc1bc7[_0x1899('0x44')][_0x1899('0x2f')]);_0x5def50[_0x1899('0x31')]=qs[_0x1899('0x31')](_0xc1bc7[_0x1899('0x44')][_0x1899('0x31')]);}_0x5def50['order']=qs[_0x1899('0x4b')](_0xc1bc7[_0x1899('0x44')][_0x1899('0x4b')]);_0x5def50['where']=qs[_0x1899('0x45')](_[_0x1899('0x6a')](_0xc1bc7[_0x1899('0x44')],_0x4851a1[_0x1899('0x45')]));_0x5def50['where'][_0x1899('0x65')]=_0x201821['id'];if(_0xc1bc7[_0x1899('0x44')][_0x1899('0x50')]){_0x5def50[_0x1899('0x4c')]=_[_0x1899('0x4d')](_0x5def50[_0x1899('0x4c')],{'$or':_['map'](_0x5def50[_0x1899('0x47')],function(_0x128bad){var _0x5301af={};_0x5301af[_0x128bad]={'$like':'%'+_0xc1bc7[_0x1899('0x44')][_0x1899('0x50')]+'%'};return _0x5301af;})});}_0x5def50=_[_0x1899('0x4d')]({},_0x5def50,_0xc1bc7[_0x1899('0x6b')]);return db[_0x1899('0x6f')][_0x1899('0x30')]({'where':_0x5def50[_0x1899('0x4c')]})['then'](function(_0x2e38b8){_0x40b019[_0x1899('0x30')]=_0x2e38b8;if(_0xc1bc7[_0x1899('0x44')][_0x1899('0x5a')]){_0x5def50[_0x1899('0x52')]=[{'all':!![]}];}return db[_0x1899('0x6f')][_0x1899('0x53')](_0x5def50);})[_0x1899('0x20')](function(_0xd250d7){_0x40b019[_0x1899('0x54')]=_0xd250d7;return _0x40b019;});}})['then'](respondWithFilteredResult(_0x29d0f3,_0x5def50))[_0x1899('0x55')](handleError(_0x29d0f3,null));};exports['removeAnswers']=function(_0x43474e,_0x502a10,_0x128ad0){return db[_0x1899('0x51')][_0x1899('0x62')]({'where':{'id':_0x43474e[_0x1899('0x57')]['id']}})[_0x1899('0x20')](handleEntityNotFound(_0x502a10,null))['then'](function(_0x4e3db2){if(_0x4e3db2){return _0x4e3db2[_0x1899('0x70')](_0x43474e[_0x1899('0x44')][_0x1899('0x6d')]);}})[_0x1899('0x20')](respondWithStatusCode(_0x502a10,null))['catch'](handleError(_0x502a10,null));};exports['notify']=function(_0x966cd5,_0x13bc6d,_0x8277c3){var _0x36a431={'body':_0x966cd5['body'],'channel':_0x1899('0x71')};var _0x434665=[];var _0x342b99=[];var _0x557e4a={};var _0x3db663=![];return db[_0x1899('0x72')][_0x1899('0x63')]()[_0x1899('0x20')](function(_0x15ba90){if(!_0x15ba90){throw new db[(_0x1899('0x73'))][(_0x1899('0x74'))](_0x1899('0x75'));}_0x434665=_['difference'](_[_0x1899('0x59')](_0x15ba90),[_0x1899('0x76'),_0x1899('0x77')]);_0x342b99=_[_0x1899('0x78')](_[_0x1899('0x59')](_0x15ba90),[_0x1899('0x76'),_0x1899('0x77'),_0x1899('0x79'),'ListId']);if(_0x966cd5['body']['id']){delete _0x966cd5[_0x1899('0x5c')]['id'];}if(_[_0x1899('0x7a')](_0x966cd5[_0x1899('0x5c')]['from'])){throw new db[(_0x1899('0x73'))][(_0x1899('0x74'))]('from\x20is\x20mandatory');}if(_[_0x1899('0x7a')](_0x966cd5[_0x1899('0x5c')][_0x1899('0x5c')])||_0x966cd5['body'][_0x1899('0x5c')]===''){throw new db[(_0x1899('0x73'))]['ValidationError'](_0x1899('0x7b'));}if(_[_0x1899('0x7a')](_0x966cd5[_0x1899('0x5c')][_0x1899('0x7c')])){throw new db[(_0x1899('0x73'))][(_0x1899('0x74'))](_0x1899('0x7d')+_0x342b99);}if(!_[_0x1899('0x7e')](_0x342b99,_0x966cd5[_0x1899('0x5c')][_0x1899('0x7c')])){throw new db['Sequelize'][(_0x1899('0x74'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x342b99);}_0x557e4a[_0x966cd5[_0x1899('0x5c')]['mapKey']]=_0x966cd5['body'][_0x1899('0x7f')];})[_0x1899('0x20')](function(){return db['OpenchannelAccount'][_0x1899('0x62')]({'where':{'id':_0x966cd5[_0x1899('0x57')]['id']},'include':[{'model':db['CmList'],'as':_0x1899('0x80'),'include':[{'model':db[_0x1899('0x72')],'as':_0x1899('0x81'),'where':_0x557e4a,'limit':0x1,'order':[[_0x1899('0x77'),_0x1899('0x82')]]}]},{'model':db[_0x1899('0x83')],'as':_0x1899('0x84')}]});})['then'](handleEntityNotFound(_0x13bc6d,null))[_0x1899('0x20')](function(_0x1873a9){if(_0x1873a9&&_0x1873a9[_0x1899('0x80')]){_0x36a431[_0x1899('0x85')]=_0x1873a9;_0x36a431[_0x1899('0x86')]=_0x1873a9[_0x1899('0x84')];_0x36a431[_0x1899('0x87')]=_0x1873a9[_0x1899('0x80')];_0x36a431[_0x1899('0x86')]=_[_0x1899('0x88')](_0x36a431[_0x1899('0x86')],[_0x1899('0x89')],['asc']);if(_0x36a431[_0x1899('0x85')][_0x1899('0x84')]){delete _0x36a431[_0x1899('0x85')][_0x1899('0x84')];}if(_0x36a431['account'][_0x1899('0x80')]&&_0x36a431['account'][_0x1899('0x80')][_0x1899('0x81')]['length']){return _0x36a431[_0x1899('0x85')][_0x1899('0x80')]['Contacts'][0x0];}var _0x30f339=_[_0x1899('0x19')](_0x966cd5[_0x1899('0x5c')],{'firstName':_0x966cd5['body'][_0x1899('0x7f')],'ListId':_0x1873a9[_0x1899('0x8a')]});_0x30f339[_0x966cd5[_0x1899('0x5c')][_0x1899('0x7c')]]=_0x966cd5['body'][_0x1899('0x7f')];return db['CmContact'][_0x1899('0x5b')](_0x30f339,{'fields':_0x434665,'raw':!![]});}})['then'](handleEntityNotFound(_0x13bc6d,null))[_0x1899('0x20')](function(_0x5220ab){_0x36a431[_0x1899('0x8b')]=_0x5220ab;if(_0x5220ab){var _0x578852={'ContactId':_0x5220ab['id'],'OpenchannelAccountId':_0x966cd5[_0x1899('0x57')]['id'],'from':(_0x5220ab[_0x1899('0x8c')]||'')+'\x20'+(_0x5220ab['lastName']||'')};var _0x2b1070={'OpenchannelAccountId':_0x966cd5[_0x1899('0x57')]['id'],'closed':![]};if(_0x966cd5['body'][_0x1899('0x8d')]){_0x2b1070[_0x1899('0x8d')]=_0x966cd5[_0x1899('0x5c')][_0x1899('0x8d')];return db[_0x1899('0x8e')][_0x1899('0x62')]({'where':_0x2b1070})[_0x1899('0x20')](function(_0x4dd235){if(_0x4dd235){return[_0x4dd235,![]];}_0x578852[_0x1899('0x8d')]=_0x966cd5[_0x1899('0x5c')][_0x1899('0x8d')];_0x578852[_0x1899('0x8f')]=_0x966cd5[_0x1899('0x5c')][_0x1899('0x8f')];return db[_0x1899('0x8e')]['create'](_0x578852)[_0x1899('0x20')](function(_0x41722c){return[_0x41722c,!![]];});});}else{_0x2b1070[_0x1899('0x8d')]=null;}_0x2b1070[_0x1899('0x90')]=_0x5220ab['id'];return db[_0x1899('0x8e')][_0x1899('0x62')]({'where':_0x2b1070})[_0x1899('0x20')](function(_0x3a0d56){if(_0x3a0d56){return[_0x3a0d56,![]];}return db[_0x1899('0x8e')]['create'](_0x578852)[_0x1899('0x20')](function(_0x4cd845){return[_0x4cd845,!![]];});});}})[_0x1899('0x91')](function(_0x5accc7,_0x924f19){if(_0x5accc7){_0x3db663=_0x924f19;if(!_0x924f19){var _0x18017b={'from':(_0x36a431[_0x1899('0x8b')][_0x1899('0x8c')]||'')+'\x20'+(_0x36a431[_0x1899('0x8b')]['lastName']||'')};if(_0x966cd5[_0x1899('0x5c')]['threadId']&&_0x966cd5['body']['messageId']&&_0x966cd5[_0x1899('0x5c')][_0x1899('0x8d')]!=_0x966cd5[_0x1899('0x5c')]['messageId']){_0x18017b['threadId']=_0x966cd5['body'][_0x1899('0x92')];}return _0x5accc7[_0x1899('0x37')](_0x18017b);}else{return _0x5accc7;}}})[_0x1899('0x20')](function(_0x5b8cf4){_0x36a431[_0x1899('0x93')]=_0x5b8cf4['get']({'plain':!![]});_0x36a431[_0x1899('0x93')][_0x1899('0x94')]=_0x3db663;if(_0x36a431[_0x1899('0x93')][_0x1899('0x94')]){if(_0x36a431[_0x1899('0x85')]['autoclose']){_0x36a431['applications'][_0x1899('0x95')]({'id':0x0,'priority':_0x36a431[_0x1899('0x86')][_0x1899('0x68')]+0x1,'app':_0x1899('0x96'),'appdata':_0x1899('0x97'),'interval':_0x1899('0x98')});}}return db[_0x1899('0x99')]['create']({'body':_0x966cd5[_0x1899('0x5c')]['body'],'OpenchannelAccountId':_0x966cd5[_0x1899('0x57')]['id'],'OpenchannelInteractionId':_0x5b8cf4['id'],'direction':'in','ContactId':_0x36a431[_0x1899('0x8b')]['id'],'AttachmentId':_0x966cd5[_0x1899('0x5c')]['AttachmentId']});})[_0x1899('0x20')](function(_0x44b210){_0x36a431[_0x1899('0x29')]=_0x44b210;if(!_0x36a431[_0x1899('0x93')][_0x1899('0x9a')])return;return db[_0x1899('0x9b')][_0x1899('0x62')]({'attributes':['id',_0x1899('0x3d')],'where':{'id':_0x36a431[_0x1899('0x93')][_0x1899('0x9a')]}});})[_0x1899('0x20')](function(_0x17cb1b){if(_0x17cb1b){_0x36a431[_0x1899('0x86')][_0x1899('0x9c')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x17cb1b[_0x1899('0x3d')]+','+(_0x36a431['account'][_0x1899('0x9d')]||0xa),'interval':'*,*,*,*'});}if(!_0x36a431['interaction']['queueId'])return;return db[_0x1899('0x9e')][_0x1899('0x62')]({'attributes':['id','name'],'where':{'id':_0x36a431[_0x1899('0x93')]['queueId']}});})[_0x1899('0x20')](function(_0x329956){if(_0x329956){_0x36a431[_0x1899('0x86')][_0x1899('0x9c')]({'id':0x0,'priority':0x1,'app':_0x1899('0x9f'),'appdata':_0x329956[_0x1899('0x3d')]+','+(_0x36a431[_0x1899('0x85')][_0x1899('0xa0')]||0x12c),'interval':_0x1899('0x98')});}return respondWithRpcPromise(_0x1899('0xa1'),_0x1899('0xa2'),_0x36a431);})[_0x1899('0x20')](function(_0x576d25){respondWithRpcPromise(_0x1899('0xa3'),'EventManager',{'event':_0x1899('0xa4'),'message':_0x576d25},client9002);return _0x576d25;})[_0x1899('0x20')](respondWithResult(_0x13bc6d,null))[_0x1899('0x55')](handleError(_0x13bc6d,null));};exports['addApplications']=function(_0x37db22,_0x4ff896){var _0x1bb97c=_0x37db22['params']['id'];var _0x21ccbc=_0x37db22[_0x1899('0x5c')];var _0x2ab991=0xc8;var _0x1386dc=null;return db[_0x1899('0xa5')][_0x1899('0xa6')]({'isolationLevel':db['sequelize'][_0x1899('0xa7')][_0x1899('0xa8')][_0x1899('0xa9')]},function(_0xd26015){return db['OpenchannelAccount'][_0x1899('0xaa')]({'where':{'id':_0x1bb97c},'transaction':_0xd26015})[_0x1899('0x20')](function(_0x114d76){if(_0x114d76){return db[_0x1899('0x83')][_0x1899('0x38')]({'where':{'OpenchannelAccountId':_0x1bb97c},'transaction':_0xd26015})[_0x1899('0x20')](function(){var _0x46bbb6=_[_0x1899('0x40')](_0x21ccbc,function(_0x3f2648){_0x3f2648[_0x1899('0x65')]=_0x1bb97c;return _0x3f2648;});return db[_0x1899('0x83')][_0x1899('0xab')](_0x46bbb6,{'transaction':_0xd26015});});}else{_0x2ab991=0x194;_0x1386dc=[];}});})[_0x1899('0x20')](function(){if(_0x2ab991!==0x194){return db[_0x1899('0x83')][_0x1899('0xac')]({'where':{'OpenchannelAccountId':_0x1bb97c},'order':'priority'})[_0x1899('0x20')](function(_0x2ce01e){_0x1386dc=_0x2ce01e;});}})[_0x1899('0x55')](function(_0x24679c){_0x2ab991=0x1f4;logger[_0x1899('0x27')](_0x24679c[_0x1899('0x3c')]);if(_0x24679c[_0x1899('0x3d')]){delete _0x24679c[_0x1899('0x3d')];}_0x1386dc=_0x24679c;})[_0x1899('0xad')](function(){if(_0x1386dc===null){_0x4ff896[_0x1899('0x2b')](_0x2ab991);}else{if(_0x2ab991===0x1f4){_0x4ff896[_0x1899('0x2c')](_0x2ab991)[_0x1899('0x3e')](_0x1386dc);}else{_0x4ff896[_0x1899('0x2c')](_0x2ab991)[_0x1899('0x2d')](_0x1386dc);}}});};exports[_0x1899('0xae')]=function(_0xd150a6,_0x2a93f6,_0x45d2bb){var _0x14eb51={};var _0x23c465={};var _0x5649ab;var _0x50304b;return db['OpenchannelAccount'][_0x1899('0xaa')]({'where':{'id':_0xd150a6[_0x1899('0x57')]['id']}})[_0x1899('0x20')](handleEntityNotFound(_0x2a93f6,null))[_0x1899('0x20')](function(_0x145882){if(_0x145882){_0x5649ab=_0x145882;_0x23c465[_0x1899('0x43')]=_[_0x1899('0x59')](db[_0x1899('0x83')][_0x1899('0xaf')]);_0x23c465[_0x1899('0x44')]=_['keys'](_0xd150a6[_0x1899('0x44')]);_0x23c465[_0x1899('0x45')]=_[_0x1899('0x46')](_0x23c465['model'],_0x23c465[_0x1899('0x44')]);_0x14eb51[_0x1899('0x47')]=_[_0x1899('0x46')](_0x23c465[_0x1899('0x43')],qs[_0x1899('0x48')](_0xd150a6[_0x1899('0x44')]['fields']));_0x14eb51[_0x1899('0x47')]=_0x14eb51[_0x1899('0x47')][_0x1899('0x68')]?_0x14eb51[_0x1899('0x47')]:_0x23c465[_0x1899('0x43')];_0x14eb51['order']=qs[_0x1899('0x4b')](_0xd150a6['query'][_0x1899('0x4b')]);_0x14eb51[_0x1899('0x4c')]=qs[_0x1899('0x45')](_['pick'](_0xd150a6[_0x1899('0x44')],_0x23c465[_0x1899('0x45')]));if(_0xd150a6[_0x1899('0x44')][_0x1899('0x50')]){_0x14eb51[_0x1899('0x4c')]=_['merge'](_0x14eb51['where'],{'$or':_[_0x1899('0x40')](_0x14eb51[_0x1899('0x47')],function(_0xd48d02){var _0x5ea3a7={};_0x5ea3a7[_0xd48d02]={'$like':'%'+_0xd150a6[_0x1899('0x44')]['filter']+'%'};return _0x5ea3a7;})});}_0x14eb51=_[_0x1899('0x4d')]({},_0x14eb51,_0xd150a6[_0x1899('0x6b')]);return _0x5649ab['getApplications'](_0x14eb51);}})[_0x1899('0x20')](function(_0x3ecab2){if(_0x3ecab2){_0x50304b=_0x3ecab2[_0x1899('0x68')];if(!_0xd150a6['query'][_0x1899('0x69')](_0x1899('0x49'))){_0x14eb51[_0x1899('0x2f')]=qs[_0x1899('0x2f')](_0xd150a6['query'][_0x1899('0x2f')]);_0x14eb51['offset']=qs[_0x1899('0x31')](_0xd150a6['query'][_0x1899('0x31')]);}return _0x5649ab[_0x1899('0xae')](_0x14eb51);}})[_0x1899('0x20')](function(_0x4a4cc5){if(_0x4a4cc5){return _0x4a4cc5?{'count':_0x50304b,'rows':_0x4a4cc5}:null;}})[_0x1899('0x20')](respondWithResult(_0x2a93f6,null))[_0x1899('0x55')](handleError(_0x2a93f6,null));};exports[_0x1899('0xb0')]=function(_0x4bcb0c,_0x538557,_0x5531aa){var _0x46a978={'raw':![],'where':{}};var _0xe07879={};var _0x294219={'count':0x0,'rows':[]};return db[_0x1899('0x51')][_0x1899('0xaa')]({'where':{'id':_0x4bcb0c[_0x1899('0x57')]['id']}})[_0x1899('0x20')](handleEntityNotFound(_0x538557,null))['then'](function(_0x1e2b59){if(_0x1e2b59){_0xe07879['model']=_[_0x1899('0x59')](db[_0x1899('0x8e')][_0x1899('0xaf')]);_0xe07879[_0x1899('0x44')]=_[_0x1899('0x59')](_0x4bcb0c[_0x1899('0x44')]);_0xe07879[_0x1899('0x45')]=_[_0x1899('0x46')](_0xe07879[_0x1899('0x43')],_0xe07879[_0x1899('0x44')]);_0x46a978[_0x1899('0x47')]=_[_0x1899('0x46')](_0xe07879[_0x1899('0x43')],qs[_0x1899('0x48')](_0x4bcb0c[_0x1899('0x44')][_0x1899('0x48')]));_0x46a978[_0x1899('0x47')]=_0x46a978[_0x1899('0x47')][_0x1899('0x68')]?_0x46a978[_0x1899('0x47')]:_0xe07879[_0x1899('0x43')];if(!_0x4bcb0c[_0x1899('0x44')][_0x1899('0x69')](_0x1899('0x49'))){_0x46a978[_0x1899('0x2f')]=qs[_0x1899('0x2f')](_0x4bcb0c[_0x1899('0x44')][_0x1899('0x2f')]);_0x46a978['offset']=qs[_0x1899('0x31')](_0x4bcb0c[_0x1899('0x44')][_0x1899('0x31')]);}_0x46a978[_0x1899('0x4a')]=qs['sort'](_0x4bcb0c['query']['sort']);_0x46a978[_0x1899('0x4c')]=qs[_0x1899('0x45')](_['pick'](_0x4bcb0c[_0x1899('0x44')],_0xe07879[_0x1899('0x45')]));_0x46a978['where'][_0x1899('0x65')]=_0x1e2b59['id'];if(_0x4bcb0c['query'][_0x1899('0x50')]){_0x46a978[_0x1899('0x4c')]=_['merge'](_0x46a978[_0x1899('0x4c')],{'$or':_['map'](_0x46a978[_0x1899('0x47')],function(_0x1d2ebf){var _0x5e207c={};_0x5e207c[_0x1d2ebf]={'$like':'%'+_0x4bcb0c[_0x1899('0x44')]['filter']+'%'};return _0x5e207c;})});}_0x46a978=_[_0x1899('0x4d')]({},_0x46a978,_0x4bcb0c[_0x1899('0x6b')]);return db['OpenchannelInteraction']['count']({'where':_0x46a978[_0x1899('0x4c')]})['then'](function(_0x58b741){_0x294219['count']=_0x58b741;if(_0x4bcb0c['query'][_0x1899('0x5a')]){_0x46a978[_0x1899('0x52')]=[{'model':db[_0x1899('0x72')],'as':_0x1899('0xb1'),'required':![]},{'model':db[_0x1899('0x9b')],'as':_0x1899('0xb2'),'attributes':[_0x1899('0x3d'),_0x1899('0xb3'),_0x1899('0xb4')],'required':![]},{'model':db[_0x1899('0xb5')],'as':_0x1899('0xb6'),'attributes':['id',_0x1899('0x3d'),'color'],'where':_0x4bcb0c[_0x1899('0x44')][_0x1899('0xb7')]?{'id':_0x4bcb0c[_0x1899('0x44')][_0x1899('0xb7')]}:undefined,'required':_0x4bcb0c[_0x1899('0x44')]['tag']?!![]:![]}];}return db['OpenchannelInteraction'][_0x1899('0x53')](_0x46a978);})[_0x1899('0x20')](function(_0x496e84){_0x294219['rows']=_0x496e84;return _0x294219;});}})[_0x1899('0x20')](respondWithFilteredResult(_0x538557,_0x46a978))[_0x1899('0x55')](handleError(_0x538557,null));};exports[_0x1899('0xb8')]=function(_0x15a5be,_0x39a11a,_0x31083a){return db[_0x1899('0x51')][_0x1899('0x62')]({'where':{'id':_0x15a5be[_0x1899('0x57')]['id']}})['then'](handleEntityNotFound(_0x39a11a,null))['then'](function(_0x162375){if(_0x162375){return _0x162375[_0x1899('0xb8')](_0x15a5be['body'][_0x1899('0x6d')],_['omit'](_0x15a5be['body'],[_0x1899('0x6d'),'id'])||{})[_0x1899('0x91')](function(_0x44e4cc){for(var _0x4c8233=0x0;_0x4c8233<_0x15a5be[_0x1899('0x5c')]['ids']['length'];_0x4c8233+=0x1){socket[_0x1899('0xb9')](_0x1899('0xba'),{'UserId':Number(_0x15a5be[_0x1899('0x5c')]['ids'][_0x4c8233]),'OpenchannelAccountId':Number(_0x15a5be[_0x1899('0x57')]['id'])});}return _0x44e4cc;});}})[_0x1899('0x20')](respondWithResult(_0x39a11a,null))['catch'](handleError(_0x39a11a,null));};exports[_0x1899('0xbb')]=function(_0x81597f,_0x25197a,_0x3e241c){return db[_0x1899('0x51')][_0x1899('0x62')]({'where':{'id':_0x81597f['params']['id']}})[_0x1899('0x20')](handleEntityNotFound(_0x25197a,null))[_0x1899('0x20')](function(_0x35c6cf){if(_0x35c6cf){return _0x35c6cf['removeAgents'](_0x81597f[_0x1899('0x44')][_0x1899('0x6d')])['then'](function(){if(_[_0x1899('0xbc')](_0x81597f[_0x1899('0x44')]['ids'])){for(var _0x2a9b9a=0x0;_0x2a9b9a<_0x81597f[_0x1899('0x44')]['ids'][_0x1899('0x68')];_0x2a9b9a+=0x1){socket[_0x1899('0xb9')](_0x1899('0xbd'),{'UserId':Number(_0x81597f[_0x1899('0x44')][_0x1899('0x6d')][_0x2a9b9a]),'OpenchannelAccountId':Number(_0x81597f['params']['id'])});}}else{socket['emit'](_0x1899('0xbd'),{'UserId':Number(_0x81597f[_0x1899('0x44')][_0x1899('0x6d')]),'OpenchannelAccountId':Number(_0x81597f['params']['id'])});}});}})['then'](respondWithStatusCode(_0x25197a,null))[_0x1899('0x55')](handleError(_0x25197a,null));};exports['getAgents']=function(_0x3b20a9,_0x44010e,_0x36609f){var _0x3d6bbd={};var _0x2c479b={};var _0x4e6307;var _0x22737d;return db['OpenchannelAccount']['findOne']({'where':{'id':_0x3b20a9[_0x1899('0x57')]['id']}})[_0x1899('0x20')](handleEntityNotFound(_0x44010e,null))['then'](function(_0x2c8bf8){if(_0x2c8bf8){_0x4e6307=_0x2c8bf8;_0x2c479b[_0x1899('0x43')]=_[_0x1899('0x59')](db[_0x1899('0x9b')][_0x1899('0xaf')]);_0x2c479b[_0x1899('0x44')]=_[_0x1899('0x59')](_0x3b20a9[_0x1899('0x44')]);_0x2c479b[_0x1899('0x45')]=_['intersection'](_0x2c479b['model'],_0x2c479b['query']);_0x3d6bbd[_0x1899('0x47')]=_[_0x1899('0x46')](_0x2c479b[_0x1899('0x43')],qs[_0x1899('0x48')](_0x3b20a9[_0x1899('0x44')][_0x1899('0x48')]));_0x3d6bbd[_0x1899('0x47')]=_0x3d6bbd['attributes'][_0x1899('0x68')]?_0x3d6bbd[_0x1899('0x47')]:_0x2c479b[_0x1899('0x43')];_0x3d6bbd[_0x1899('0x4a')]=qs['sort'](_0x3b20a9[_0x1899('0x44')][_0x1899('0x4b')]);_0x3d6bbd[_0x1899('0x4c')]=qs[_0x1899('0x45')](_['pick'](_0x3b20a9['query'],_0x2c479b[_0x1899('0x45')]));if(_0x3b20a9['query'][_0x1899('0x50')]){_0x3d6bbd[_0x1899('0x4c')]=_[_0x1899('0x4d')](_0x3d6bbd[_0x1899('0x4c')],{'$or':_['map'](_0x3d6bbd[_0x1899('0x47')],function(_0x59b8eb){var _0x3738ed={};_0x3738ed[_0x59b8eb]={'$like':'%'+_0x3b20a9['query'][_0x1899('0x50')]+'%'};return _0x3738ed;})});}_0x3d6bbd=_[_0x1899('0x4d')]({},_0x3d6bbd,_0x3b20a9[_0x1899('0x6b')]);return _0x4e6307[_0x1899('0xbe')](_0x3d6bbd);}})['then'](function(_0x18d5ca){if(_0x18d5ca){_0x22737d=_0x18d5ca['length'];if(!_0x3b20a9['query'][_0x1899('0x69')]('nolimit')){_0x3d6bbd[_0x1899('0x2f')]=qs[_0x1899('0x2f')](_0x3b20a9[_0x1899('0x44')][_0x1899('0x2f')]);_0x3d6bbd[_0x1899('0x31')]=qs[_0x1899('0x31')](_0x3b20a9['query'][_0x1899('0x31')]);}return _0x4e6307[_0x1899('0xbe')](_0x3d6bbd);}})['then'](function(_0x224040){if(_0x224040){return _0x224040?{'count':_0x22737d,'rows':_0x224040}:null;}})[_0x1899('0x20')](respondWithResult(_0x44010e,null))['catch'](handleError(_0x44010e,null));};exports[_0x1899('0x3e')]=function(_0x3fa6e1,_0x5857d6,_0x54ab46){var _0x6826f1,_0x43a2f5,_0x1a7f33;if(_['isNil'](_0x3fa6e1[_0x1899('0x5c')]['body'])||_0x3fa6e1[_0x1899('0x5c')][_0x1899('0x5c')]===''){throw new db[(_0x1899('0x73'))]['ValidationError'](_0x1899('0x7b'));}if(_[_0x1899('0x7a')](_0x3fa6e1[_0x1899('0x5c')]['to'])){}_0x6826f1=_0x3fa6e1[_0x1899('0x5c')]['to'];return db[_0x1899('0x51')][_0x1899('0xaa')]({'where':{'id':_0x3fa6e1[_0x1899('0x57')]['id']}})['then'](handleEntityNotFound(_0x5857d6,null))[_0x1899('0x20')](function(_0x14d0fb){if(_0x14d0fb){return db[_0x1899('0x51')][_0x1899('0x62')]({'where':{'id':_0x14d0fb['id']},'include':[{'model':db[_0x1899('0xbf')],'as':'List','include':[{'model':db['CmContact'],'as':_0x1899('0x81'),'where':{[_0x14d0fb['mapKey']]:_0x6826f1},'limit':0x1,'order':[[_0x1899('0x77'),_0x1899('0x82')]]}]}]})[_0x1899('0x20')](handleEntityNotFound(_0x5857d6,null))['then'](function(_0x15b0d9){if(_0x15b0d9&&_0x15b0d9[_0x1899('0x80')]){_0x43a2f5=_0x15b0d9[_0x1899('0x39')]({'plain':!![]});if(_0x43a2f5[_0x1899('0x80')]&&_0x43a2f5['List'][_0x1899('0x81')][_0x1899('0x68')]){return _0x43a2f5[_0x1899('0x80')]['Contacts'][0x0];}return db[_0x1899('0x72')][_0x1899('0x5b')](_['defaults'](_0x3fa6e1[_0x1899('0x5c')],{'firstName':_0x6826f1,[_0x15b0d9[_0x1899('0x7c')]]:_0x6826f1,'phone':_0x6826f1,'ListId':_0x43a2f5[_0x1899('0x8a')]}));}})[_0x1899('0x20')](handleEntityNotFound(_0x5857d6,null))[_0x1899('0x20')](function(_0xfe533){if(_0xfe533){_0x1a7f33=_0xfe533;return db['OpenchannelInteraction'][_0x1899('0x62')]({'where':{'ContactId':_0x1a7f33['id'],'closed':![],'OpenchannelAccountId':_0x43a2f5['id']}})[_0x1899('0x20')](function(_0x26c66e){if(_0x26c66e){return[_0x26c66e,![]];}return db[_0x1899('0x8e')][_0x1899('0x5b')]({'UserId':_0x3fa6e1['user']['id'],'ContactId':_0x1a7f33['id'],'OpenchannelAccountId':_0x43a2f5['id'],'lastMsgDirection':_0x1899('0xc0'),'firstMsgDirection':_0x1899('0xc0'),'Messages':[_[_0x1899('0x4d')](_0x3fa6e1[_0x1899('0x5c')],{'read':![],'body':_0x3fa6e1['body'][_0x1899('0x5c')],'OpenchannelAccountId':_0x43a2f5['id'],'UserId':_0x3fa6e1[_0x1899('0x5d')]['id'],'ContactId':_0x1a7f33['id']})]},{'include':[{'model':db[_0x1899('0x99')],'as':_0x1899('0xc1')}]})[_0x1899('0x20')](function(_0x31c99c){return[_0x31c99c,!![]];});});}})['spread'](function(_0x4d9247,_0x34faf2){if(_0x34faf2){return _0x4d9247;}return db[_0x1899('0x99')][_0x1899('0x5b')](_[_0x1899('0x4d')](_0x3fa6e1[_0x1899('0x5c')],{'read':![],'body':_0x3fa6e1[_0x1899('0x5c')]['body'],'OpenchannelAccountId':_0x43a2f5['id'],'OpenchannelInteractionId':_0x4d9247['id'],'UserId':_0x3fa6e1[_0x1899('0x5d')]['id'],'ContactId':_0x1a7f33['id']}))[_0x1899('0x20')](function(_0x32e735){_0x4d9247[_0x1899('0xc2')][_0x1899('0xc1')]=[];_0x4d9247[_0x1899('0xc2')][_0x1899('0xc1')][_0x1899('0x95')](_0x32e735['dataValues']);return _0x4d9247;});});}})['then'](respondWithResult(_0x5857d6,null))['catch'](handleError(_0x5857d6,null));}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.events.js b/server/api/openchannelAccount/openchannelAccount.events.js index f972013..9b80cdf 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 _0x9c44=['save','update','remove','emit','hasOwnProperty','hook','exports','OpenchannelAccount','setMaxListeners'];(function(_0xed13f6,_0x536086){var _0x44ad3c=function(_0x52f20d){while(--_0x52f20d){_0xed13f6['push'](_0xed13f6['shift']());}};_0x44ad3c(++_0x536086);}(_0x9c44,0x178));var _0x49c4=function(_0x1d9aa0,_0x272488){_0x1d9aa0=_0x1d9aa0-0x0;var _0x226868=_0x9c44[_0x1d9aa0];return _0x226868;};'use strict';var EventEmitter=require('events');var OpenchannelAccount=require('../../mysqldb')['db'][_0x49c4('0x0')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents[_0x49c4('0x1')](0x0);var events={'afterCreate':_0x49c4('0x2'),'afterUpdate':_0x49c4('0x3'),'afterDestroy':_0x49c4('0x4')};function emitEvent(_0x2ad237){return function(_0x4e0313,_0x4941f1,_0x41a183){OpenchannelAccountEvents['emit'](_0x2ad237+':'+_0x4e0313['id'],_0x4e0313);OpenchannelAccountEvents[_0x49c4('0x5')](_0x2ad237,_0x4e0313);_0x41a183(null);};}for(var e in events){if(events[_0x49c4('0x6')](e)){var event=events[e];OpenchannelAccount[_0x49c4('0x7')](e,emitEvent(event));}}module[_0x49c4('0x8')]=OpenchannelAccountEvents; \ No newline at end of file +var _0xf109=['OpenchannelAccount','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0xec0833,_0x1b4e39){var _0x166af1=function(_0x59ec7d){while(--_0x59ec7d){_0xec0833['push'](_0xec0833['shift']());}};_0x166af1(++_0x1b4e39);}(_0xf109,0xce));var _0x9f10=function(_0x44946b,_0xf874ec){_0x44946b=_0x44946b-0x0;var _0x249bc4=_0xf109[_0x44946b];return _0x249bc4;};'use strict';var EventEmitter=require(_0x9f10('0x0'));var OpenchannelAccount=require(_0x9f10('0x1'))['db'][_0x9f10('0x2')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x9f10('0x3')};function emitEvent(_0x74f517){return function(_0x74d0ee,_0x26f01c,_0x4027f4){OpenchannelAccountEvents[_0x9f10('0x4')](_0x74f517+':'+_0x74d0ee['id'],_0x74d0ee);OpenchannelAccountEvents[_0x9f10('0x4')](_0x74f517,_0x74d0ee);_0x4027f4(null);};}for(var e in events){if(events[_0x9f10('0x5')](e)){var event=events[e];OpenchannelAccount[_0x9f10('0x6')](e,emitEvent(event));}}module[_0x9f10('0x7')]=OpenchannelAccountEvents; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.model.js b/server/api/openchannelAccount/openchannelAccount.model.js index 664a933..ad38860 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(_0x3a9f59,_0x133571){var _0x182887=function(_0x5b3fa7){while(--_0x5b3fa7){_0x3a9f59['push'](_0x3a9f59['shift']());}};_0x182887(++_0x133571);}(_0xa9e0,0x123));var _0x0a9e=function(_0x934425,_0x5af72f){_0x934425=_0x934425-0x0;var _0x31d596=_0xa9e0[_0x934425];return _0x31d596;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var 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(_0x3d8824,_0x4a1799){var _0x411e2c=function(_0x1baeb3){while(--_0x1baeb3){_0x3d8824['push'](_0x3d8824['shift']());}};_0x411e2c(++_0x4a1799);}(_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 diff --git a/server/api/openchannelAccount/openchannelAccount.rpc.js b/server/api/openchannelAccount/openchannelAccount.rpc.js index 98ed3ce..4d9c4d9 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 _0x7be1=['../../config/logger','client','http','defaults','redis','localhost','socket.io-emitter','./openchannelAccount.socket','request','then','info','request\x20sent','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','OpenchannelAccount,\x20%s,\x20%s','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x2ef8f1,_0x1280a3){var _0x17498d=function(_0xd20876){while(--_0xd20876){_0x2ef8f1['push'](_0x2ef8f1['shift']());}};_0x17498d(++_0x1280a3);}(_0x7be1,0x165));var _0x17be=function(_0x12f59c,_0x13d956){_0x12f59c=_0x12f59c-0x0;var _0x2db43e=_0x7be1[_0x12f59c];return _0x2db43e;};'use strict';var _=require(_0x17be('0x0'));var util=require(_0x17be('0x1'));var moment=require(_0x17be('0x2'));var BPromise=require('bluebird');var rs=require(_0x17be('0x3'));var fs=require('fs');var Redis=require(_0x17be('0x4'));var db=require(_0x17be('0x5'))['db'];var utils=require(_0x17be('0x6'));var logger=require(_0x17be('0x7'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x17be('0x8')][_0x17be('0x9')]({'port':0x232a});config['redis']=_[_0x17be('0xa')](config[_0x17be('0xb')],{'host':_0x17be('0xc'),'port':0x18eb});var socket=require(_0x17be('0xd'))(new Redis(config[_0x17be('0xb')]));require(_0x17be('0xe'))['register'](socket);function respondWithRpcPromise(_0x41e383,_0x589cdb,_0x3d23c3){return new BPromise(function(_0x2c276e,_0x520a49){return client[_0x17be('0xf')](_0x41e383,_0x3d23c3)[_0x17be('0x10')](function(_0x1ee322){logger[_0x17be('0x11')]('OpenchannelAccount,\x20%s,\x20%s',_0x589cdb,_0x17be('0x12'));logger['debug'](_0x17be('0x13'),_0x589cdb,'request\x20sent',JSON[_0x17be('0x14')](_0x1ee322));if(_0x1ee322[_0x17be('0x15')]){if(_0x1ee322[_0x17be('0x15')][_0x17be('0x16')]===0x1f4){logger[_0x17be('0x15')]('OpenchannelAccount,\x20%s,\x20%s',_0x589cdb,_0x1ee322[_0x17be('0x15')]['message']);return _0x520a49(_0x1ee322['error'][_0x17be('0x17')]);}logger['error'](_0x17be('0x18'),_0x589cdb,_0x1ee322['error'][_0x17be('0x17')]);return _0x2c276e(_0x1ee322[_0x17be('0x15')]['message']);}else{logger[_0x17be('0x11')]('OpenchannelAccount,\x20%s,\x20%s',_0x589cdb,_0x17be('0x12'));_0x2c276e(_0x1ee322['result'][_0x17be('0x17')]);}})[_0x17be('0x19')](function(_0x416f81){logger[_0x17be('0x15')](_0x17be('0x18'),_0x589cdb,_0x416f81);_0x520a49(_0x416f81);});});} \ No newline at end of file +var _0xd523=['info','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','defaults','redis','localhost','socket.io-emitter','./openchannelAccount.socket','register','request','then','OpenchannelAccount,\x20%s,\x20%s','OpenchannelAccount,\x20%s,\x20%s,\x20%s','request\x20sent','code','error','message'];(function(_0x504cd4,_0x41ce57){var _0x402687=function(_0x2fabae){while(--_0x2fabae){_0x504cd4['push'](_0x504cd4['shift']());}};_0x402687(++_0x41ce57);}(_0xd523,0x153));var _0x3d52=function(_0x648186,_0x27de97){_0x648186=_0x648186-0x0;var _0x50e46c=_0xd523[_0x648186];return _0x50e46c;};'use strict';var _=require(_0x3d52('0x0'));var util=require(_0x3d52('0x1'));var moment=require(_0x3d52('0x2'));var BPromise=require(_0x3d52('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3d52('0x4'));var db=require(_0x3d52('0x5'))['db'];var utils=require(_0x3d52('0x6'));var logger=require('../../config/logger')(_0x3d52('0x7'));var config=require(_0x3d52('0x8'));var jayson=require(_0x3d52('0x9'));var client=jayson[_0x3d52('0xa')]['http']({'port':0x232a});config['redis']=_[_0x3d52('0xb')](config[_0x3d52('0xc')],{'host':_0x3d52('0xd'),'port':0x18eb});var socket=require(_0x3d52('0xe'))(new Redis(config[_0x3d52('0xc')]));require(_0x3d52('0xf'))[_0x3d52('0x10')](socket);function respondWithRpcPromise(_0x2d966e,_0x30ee09,_0x4a5a9a){return new BPromise(function(_0x46c2e6,_0x873de6){return client[_0x3d52('0x11')](_0x2d966e,_0x4a5a9a)[_0x3d52('0x12')](function(_0x2675d2){logger['info'](_0x3d52('0x13'),_0x30ee09,'request\x20sent');logger['debug'](_0x3d52('0x14'),_0x30ee09,_0x3d52('0x15'),JSON['stringify'](_0x2675d2));if(_0x2675d2['error']){if(_0x2675d2['error'][_0x3d52('0x16')]===0x1f4){logger[_0x3d52('0x17')](_0x3d52('0x13'),_0x30ee09,_0x2675d2[_0x3d52('0x17')][_0x3d52('0x18')]);return _0x873de6(_0x2675d2[_0x3d52('0x17')][_0x3d52('0x18')]);}logger[_0x3d52('0x17')](_0x3d52('0x13'),_0x30ee09,_0x2675d2[_0x3d52('0x17')][_0x3d52('0x18')]);return _0x46c2e6(_0x2675d2[_0x3d52('0x17')][_0x3d52('0x18')]);}else{logger[_0x3d52('0x19')](_0x3d52('0x13'),_0x30ee09,'request\x20sent');_0x46c2e6(_0x2675d2[_0x3d52('0x1a')][_0x3d52('0x18')]);}})[_0x3d52('0x1b')](function(_0x54a514){logger[_0x3d52('0x17')](_0x3d52('0x13'),_0x30ee09,_0x54a514);_0x873de6(_0x54a514);});});} \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.socket.js b/server/api/openchannelAccount/openchannelAccount.socket.js index 61c3984..f51b9fb 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 _0xadec=['./openchannelAccount.events','save','remove','update','removeListener','length'];(function(_0x48ef95,_0x341a8a){var _0x40a225=function(_0x2aecb5){while(--_0x2aecb5){_0x48ef95['push'](_0x48ef95['shift']());}};_0x40a225(++_0x341a8a);}(_0xadec,0x156));var _0xcade=function(_0x22799d,_0x46b4bf){_0x22799d=_0x22799d-0x0;var _0x152e2c=_0xadec[_0x22799d];return _0x152e2c;};'use strict';var OpenchannelAccountEvents=require(_0xcade('0x0'));var events=[_0xcade('0x1'),_0xcade('0x2'),_0xcade('0x3')];function createListener(_0x35756e,_0x5b1f75){return function(_0x55ad3c){_0x5b1f75['emit'](_0x35756e,_0x55ad3c);};}function removeListener(_0x475533,_0x875b81){return function(){OpenchannelAccountEvents[_0xcade('0x4')](_0x475533,_0x875b81);};}exports['register']=function(_0x4da887){for(var _0x5c8b77=0x0,_0x51d665=events[_0xcade('0x5')];_0x5c8b77<_0x51d665;_0x5c8b77++){var _0x4c36e8=events[_0x5c8b77];var _0x625da7=createListener('openchannelAccount:'+_0x4c36e8,_0x4da887);OpenchannelAccountEvents['on'](_0x4c36e8,_0x625da7);}}; \ No newline at end of file +var _0x86dd=['update','emit','removeListener','register','save'];(function(_0x47b15f,_0x103e93){var _0x55bf25=function(_0x51fe7f){while(--_0x51fe7f){_0x47b15f['push'](_0x47b15f['shift']());}};_0x55bf25(++_0x103e93);}(_0x86dd,0x1ee));var _0xd86d=function(_0x36332a,_0x496406){_0x36332a=_0x36332a-0x0;var _0xee06cd=_0x86dd[_0x36332a];return _0xee06cd;};'use strict';var OpenchannelAccountEvents=require('./openchannelAccount.events');var events=[_0xd86d('0x0'),'remove',_0xd86d('0x1')];function createListener(_0x2cb4b4,_0x287d1d){return function(_0x217373){_0x287d1d[_0xd86d('0x2')](_0x2cb4b4,_0x217373);};}function removeListener(_0x30a31c,_0x2e82a9){return function(){OpenchannelAccountEvents[_0xd86d('0x3')](_0x30a31c,_0x2e82a9);};}exports[_0xd86d('0x4')]=function(_0x1d5ffc){for(var _0x3b13f9=0x0,_0x4274f8=events['length'];_0x3b13f9<_0x4274f8;_0x3b13f9++){var _0x341335=events[_0x3b13f9];var _0xfcba94=createListener('openchannelAccount:'+_0x341335,_0x1d5ffc);OpenchannelAccountEvents['on'](_0x341335,_0xfcba94);}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/index.js b/server/api/openchannelApplication/index.js index 092ff4a..6dfa945 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 _0x836f=['connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./openchannelApplication.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','destroy','exports','multer','path'];(function(_0x4e0f5e,_0x3a8646){var _0x12c18b=function(_0xfc782e){while(--_0xfc782e){_0x4e0f5e['push'](_0x4e0f5e['shift']());}};_0x12c18b(++_0x3a8646);}(_0x836f,0x141));var _0xf836=function(_0x5cd73c,_0x5ec62c){_0x5cd73c=_0x5cd73c-0x0;var _0x696a36=_0x836f[_0x5cd73c];return _0x696a36;};'use strict';var multer=require(_0xf836('0x0'));var util=require('util');var path=require(_0xf836('0x1'));var timeout=require(_0xf836('0x2'));var express=require('express');var router=express[_0xf836('0x3')]();var fs_extra=require(_0xf836('0x4'));var auth=require(_0xf836('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xf836('0x6'));var controller=require(_0xf836('0x7'));router[_0xf836('0x8')]('/',auth[_0xf836('0x9')](),controller[_0xf836('0xa')]);router[_0xf836('0x8')](_0xf836('0xb'),auth[_0xf836('0x9')](),controller[_0xf836('0xc')]);router[_0xf836('0xd')]('/',auth['isAuthenticated'](),controller[_0xf836('0xe')]);router[_0xf836('0xf')](_0xf836('0xb'),auth[_0xf836('0x9')](),controller[_0xf836('0x10')]);router['delete'](_0xf836('0xb'),auth['isAuthenticated'](),controller[_0xf836('0x11')]);module[_0xf836('0x12')]=router; \ No newline at end of file +var _0x80d8=['get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./openchannelApplication.controller'];(function(_0x59f46a,_0x3e44de){var _0x3608fb=function(_0x5d0b24){while(--_0x5d0b24){_0x59f46a['push'](_0x59f46a['shift']());}};_0x3608fb(++_0x3e44de);}(_0x80d8,0x1ef));var _0x880d=function(_0x5eaa6a,_0x41d4f9){_0x5eaa6a=_0x5eaa6a-0x0;var _0x332a98=_0x80d8[_0x5eaa6a];return _0x332a98;};'use strict';var multer=require(_0x880d('0x0'));var util=require(_0x880d('0x1'));var path=require(_0x880d('0x2'));var timeout=require(_0x880d('0x3'));var express=require('express');var router=express[_0x880d('0x4')]();var fs_extra=require(_0x880d('0x5'));var auth=require(_0x880d('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x880d('0x7'));var controller=require(_0x880d('0x8'));router[_0x880d('0x9')]('/',auth[_0x880d('0xa')](),controller[_0x880d('0xb')]);router[_0x880d('0x9')](_0x880d('0xc'),auth['isAuthenticated'](),controller[_0x880d('0xd')]);router[_0x880d('0xe')]('/',auth[_0x880d('0xa')](),controller[_0x880d('0xf')]);router[_0x880d('0x10')](_0x880d('0xc'),auth[_0x880d('0xa')](),controller[_0x880d('0x11')]);router[_0x880d('0x12')]('/:id',auth[_0x880d('0xa')](),controller[_0x880d('0x13')]);module[_0x880d('0x14')]=router; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.attributes.js b/server/api/openchannelApplication/openchannelApplication.attributes.js index 12cad7e..b65b4ac 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 _0xe3b4=['TEXT','*,*,*,*','sequelize','STRING','noop'];(function(_0x11b55e,_0x47f1ff){var _0x268a13=function(_0x3dc694){while(--_0x3dc694){_0x11b55e['push'](_0x11b55e['shift']());}};_0x268a13(++_0x47f1ff);}(_0xe3b4,0x142));var _0x4e3b=function(_0x2c6429,_0x522155){_0x2c6429=_0x2c6429-0x0;var _0x526165=_0xe3b4[_0x2c6429];return _0x526165;};'use strict';var Sequelize=require(_0x4e3b('0x0'));module['exports']={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x4e3b('0x1')],'allowNull':![],'defaultValue':_0x4e3b('0x2')},'appdata':{'type':Sequelize[_0x4e3b('0x3')]()},'description':{'type':Sequelize[_0x4e3b('0x1')]},'interval':{'type':Sequelize[_0x4e3b('0x1')],'defaultValue':_0x4e3b('0x4')}}; \ No newline at end of file +var _0x46ba=['exports','INTEGER','STRING','noop','*,*,*,*'];(function(_0x48e2ea,_0x4105df){var _0x85f652=function(_0x28a14a){while(--_0x28a14a){_0x48e2ea['push'](_0x48e2ea['shift']());}};_0x85f652(++_0x4105df);}(_0x46ba,0x8c));var _0xa46b=function(_0x607e6a,_0x1c9331){_0x607e6a=_0x607e6a-0x0;var _0x214d70=_0x46ba[_0x607e6a];return _0x214d70;};'use strict';var Sequelize=require('sequelize');module[_0xa46b('0x0')]={'priority':{'type':Sequelize[_0xa46b('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0xa46b('0x2')],'allowNull':![],'defaultValue':_0xa46b('0x3')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0xa46b('0x2')]},'interval':{'type':Sequelize[_0xa46b('0x2')],'defaultValue':_0xa46b('0x4')}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.controller.js b/server/api/openchannelApplication/openchannelApplication.controller.js index d8d62ba..f810a58 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 _0xccc8=['OpenchannelApplication','rawAttributes','fieldName','type','model','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','VIRTUAL','merge','options','includeAll','include','findAll','catch','show','params','keys','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','end','error','stack','name','send','map'];(function(_0x2a0444,_0x243b7b){var _0x2ffd90=function(_0x562429){while(--_0x562429){_0x2a0444['push'](_0x2a0444['shift']());}};_0x2ffd90(++_0x243b7b);}(_0xccc8,0x147));var _0x8ccc=function(_0x5712f8,_0x17156b){_0x5712f8=_0x5712f8-0x0;var _0x14a364=_0xccc8[_0x5712f8];return _0x14a364;};'use strict';var emlformat=require(_0x8ccc('0x0'));var rimraf=require(_0x8ccc('0x1'));var zipdir=require(_0x8ccc('0x2'));var jsonpatch=require(_0x8ccc('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x8ccc('0x4'));var util=require(_0x8ccc('0x5'));var path=require(_0x8ccc('0x6'));var sox=require(_0x8ccc('0x7'));var csv=require(_0x8ccc('0x8'));var ejs=require(_0x8ccc('0x9'));var fs=require('fs');var fs_extra=require(_0x8ccc('0xa'));var _=require(_0x8ccc('0xb'));var squel=require('squel');var crypto=require(_0x8ccc('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x8ccc('0xd'));var toCsv=require(_0x8ccc('0x8'));var querystring=require('querystring');var Papa=require(_0x8ccc('0xe'));var Redis=require(_0x8ccc('0xf'));var authService=require(_0x8ccc('0x10'));var qs=require(_0x8ccc('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x8ccc('0x12'))(_0x8ccc('0x13'));var utils=require(_0x8ccc('0x14'));var config=require(_0x8ccc('0x15'));var licenseUtil=require(_0x8ccc('0x16'));var db=require(_0x8ccc('0x17'))['db'];function respondWithStatusCode(_0x4881de,_0x3dfcda){_0x3dfcda=_0x3dfcda||0xcc;return function(_0x568821){if(_0x568821){return _0x4881de[_0x8ccc('0x18')](_0x3dfcda);}return _0x4881de[_0x8ccc('0x19')](_0x3dfcda)['end']();};}function respondWithResult(_0x6f2abd,_0x575855){_0x575855=_0x575855||0xc8;return function(_0x1ebb85){if(_0x1ebb85){return _0x6f2abd[_0x8ccc('0x19')](_0x575855)['json'](_0x1ebb85);}};}function respondWithFilteredResult(_0x532887,_0x347bda){return function(_0x4e002d){if(_0x4e002d){var _0x46eed3=typeof _0x347bda[_0x8ccc('0x1a')]===_0x8ccc('0x1b')&&typeof _0x347bda[_0x8ccc('0x1c')]===_0x8ccc('0x1b');var _0x4071e4=_0x4e002d[_0x8ccc('0x1d')];var _0x598253=_0x46eed3?0x0:_0x347bda['offset'];var _0x416fce=_0x46eed3?_0x4e002d['count']:_0x347bda[_0x8ccc('0x1a')]+_0x347bda[_0x8ccc('0x1c')];var _0x3f5fc0;if(_0x416fce>=_0x4071e4){_0x416fce=_0x4071e4;_0x3f5fc0=0xc8;}else{_0x3f5fc0=0xce;}_0x532887[_0x8ccc('0x19')](_0x3f5fc0);return _0x532887[_0x8ccc('0x1e')](_0x8ccc('0x1f'),_0x598253+'-'+_0x416fce+'/'+_0x4071e4)['json'](_0x4e002d);}return null;};}function patchUpdates(_0x4f2577){return function(_0x3c6ff0){try{jsonpatch[_0x8ccc('0x20')](_0x3c6ff0,_0x4f2577,!![]);}catch(_0x161c5a){return BPromise['reject'](_0x161c5a);}return _0x3c6ff0[_0x8ccc('0x21')]();};}function saveUpdates(_0x1d0506,_0x3203d4){return function(_0x3a5e5b){if(_0x3a5e5b){return _0x3a5e5b[_0x8ccc('0x22')](_0x1d0506)[_0x8ccc('0x23')](function(_0x57a9ab){return _0x57a9ab;});}return null;};}function removeEntity(_0x58a7a3,_0x224363){return function(_0x4a080d){if(_0x4a080d){return _0x4a080d[_0x8ccc('0x24')]()['then'](function(){_0x58a7a3[_0x8ccc('0x19')](0xcc)[_0x8ccc('0x25')]();});}};}function handleEntityNotFound(_0x45819f,_0x39e100){return function(_0x227131){if(!_0x227131){_0x45819f[_0x8ccc('0x18')](0x194);}return _0x227131;};}function handleError(_0x4bbc99,_0x2e51e8){_0x2e51e8=_0x2e51e8||0x1f4;return function(_0x4d1a16){logger[_0x8ccc('0x26')](_0x4d1a16[_0x8ccc('0x27')]);if(_0x4d1a16[_0x8ccc('0x28')]){delete _0x4d1a16['name'];}_0x4bbc99['status'](_0x2e51e8)[_0x8ccc('0x29')](_0x4d1a16);};}exports['index']=function(_0x30b386,_0xb287c8){var _0x55f360={},_0x209dc5={},_0x22a08a={'count':0x0,'rows':[]};var _0x1a799e=_[_0x8ccc('0x2a')](db[_0x8ccc('0x2b')][_0x8ccc('0x2c')],function(_0x1b48bc){return{'name':_0x1b48bc[_0x8ccc('0x2d')],'type':_0x1b48bc[_0x8ccc('0x2e')]['key']};});_0x209dc5[_0x8ccc('0x2f')]=_[_0x8ccc('0x2a')](_0x1a799e,_0x8ccc('0x28'));_0x209dc5[_0x8ccc('0x30')]=_['keys'](_0x30b386['query']);_0x209dc5['filters']=_['intersection'](_0x209dc5['model'],_0x209dc5['query']);_0x55f360[_0x8ccc('0x31')]=_[_0x8ccc('0x32')](_0x209dc5[_0x8ccc('0x2f')],qs[_0x8ccc('0x33')](_0x30b386[_0x8ccc('0x30')]['fields']));_0x55f360['attributes']=_0x55f360[_0x8ccc('0x31')][_0x8ccc('0x34')]?_0x55f360[_0x8ccc('0x31')]:_0x209dc5[_0x8ccc('0x2f')];if(!_0x30b386[_0x8ccc('0x30')][_0x8ccc('0x35')](_0x8ccc('0x36'))){_0x55f360[_0x8ccc('0x1c')]=qs[_0x8ccc('0x1c')](_0x30b386[_0x8ccc('0x30')][_0x8ccc('0x1c')]);_0x55f360[_0x8ccc('0x1a')]=qs[_0x8ccc('0x1a')](_0x30b386[_0x8ccc('0x30')][_0x8ccc('0x1a')]);}_0x55f360[_0x8ccc('0x37')]=qs[_0x8ccc('0x38')](_0x30b386[_0x8ccc('0x30')]['sort']);_0x55f360['where']=qs[_0x8ccc('0x39')](_[_0x8ccc('0x3a')](_0x30b386[_0x8ccc('0x30')],_0x209dc5['filters']),_0x1a799e);if(_0x30b386[_0x8ccc('0x30')][_0x8ccc('0x3b')]){_0x55f360[_0x8ccc('0x3c')]=_['merge'](_0x55f360[_0x8ccc('0x3c')],{'$or':_[_0x8ccc('0x2a')](_0x1a799e,function(_0x4c11c9){if(_0x4c11c9['type']!==_0x8ccc('0x3d')){var _0xd55e45={};_0xd55e45[_0x4c11c9[_0x8ccc('0x28')]]={'$like':'%'+_0x30b386[_0x8ccc('0x30')]['filter']+'%'};return _0xd55e45;}})});}_0x55f360=_[_0x8ccc('0x3e')]({},_0x55f360,_0x30b386[_0x8ccc('0x3f')]);var _0xc8f47f={'where':_0x55f360[_0x8ccc('0x3c')]};return db[_0x8ccc('0x2b')]['count'](_0xc8f47f)[_0x8ccc('0x23')](function(_0x1fe7f3){_0x22a08a['count']=_0x1fe7f3;if(_0x30b386[_0x8ccc('0x30')][_0x8ccc('0x40')]){_0x55f360[_0x8ccc('0x41')]=[{'all':!![]}];}return db[_0x8ccc('0x2b')][_0x8ccc('0x42')](_0x55f360);})[_0x8ccc('0x23')](function(_0x1e216e){_0x22a08a['rows']=_0x1e216e;return _0x22a08a;})[_0x8ccc('0x23')](respondWithFilteredResult(_0xb287c8,_0x55f360))[_0x8ccc('0x43')](handleError(_0xb287c8,null));};exports[_0x8ccc('0x44')]=function(_0x32e061,_0x7d0660){var _0x4f40e1={'raw':!![],'where':{'id':_0x32e061[_0x8ccc('0x45')]['id']}},_0x1ba676={};_0x1ba676[_0x8ccc('0x2f')]=_[_0x8ccc('0x46')](db[_0x8ccc('0x2b')][_0x8ccc('0x2c')]);_0x1ba676[_0x8ccc('0x30')]=_[_0x8ccc('0x46')](_0x32e061[_0x8ccc('0x30')]);_0x1ba676[_0x8ccc('0x39')]=_[_0x8ccc('0x32')](_0x1ba676['model'],_0x1ba676[_0x8ccc('0x30')]);_0x4f40e1['attributes']=_[_0x8ccc('0x32')](_0x1ba676[_0x8ccc('0x2f')],qs['fields'](_0x32e061[_0x8ccc('0x30')][_0x8ccc('0x33')]));_0x4f40e1[_0x8ccc('0x31')]=_0x4f40e1[_0x8ccc('0x31')]['length']?_0x4f40e1[_0x8ccc('0x31')]:_0x1ba676[_0x8ccc('0x2f')];if(_0x32e061[_0x8ccc('0x30')][_0x8ccc('0x40')]){_0x4f40e1[_0x8ccc('0x41')]=[{'all':!![]}];}_0x4f40e1=_[_0x8ccc('0x3e')]({},_0x4f40e1,_0x32e061['options']);return db[_0x8ccc('0x2b')][_0x8ccc('0x47')](_0x4f40e1)[_0x8ccc('0x23')](handleEntityNotFound(_0x7d0660,null))[_0x8ccc('0x23')](respondWithResult(_0x7d0660,null))[_0x8ccc('0x43')](handleError(_0x7d0660,null));};exports['create']=function(_0x52f8f7,_0x182759){return db[_0x8ccc('0x2b')][_0x8ccc('0x48')](_0x52f8f7[_0x8ccc('0x49')],{})['then'](respondWithResult(_0x182759,0xc9))[_0x8ccc('0x43')](handleError(_0x182759,null));};exports['update']=function(_0xb4aa85,_0x15b21a){if(_0xb4aa85[_0x8ccc('0x49')]['id']){delete _0xb4aa85[_0x8ccc('0x49')]['id'];}return db[_0x8ccc('0x2b')][_0x8ccc('0x47')]({'where':{'id':_0xb4aa85[_0x8ccc('0x45')]['id']}})['then'](handleEntityNotFound(_0x15b21a,null))['then'](saveUpdates(_0xb4aa85['body'],null))[_0x8ccc('0x23')](respondWithResult(_0x15b21a,null))['catch'](handleError(_0x15b21a,null));};exports[_0x8ccc('0x24')]=function(_0x38be81,_0x5e5c43){return db[_0x8ccc('0x2b')][_0x8ccc('0x47')]({'where':{'id':_0x38be81[_0x8ccc('0x45')]['id']}})[_0x8ccc('0x23')](handleEntityNotFound(_0x5e5c43,null))['then'](removeEntity(_0x5e5c43,null))['catch'](handleError(_0x5e5c43,null));}; \ No newline at end of file +var _0x6b88=['ejs','fs-extra','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','end','status','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','OpenchannelApplication','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','options','includeAll','include','findAll','show','params','merge','catch','create','body','find','eml-format','rimraf','moment','bluebird','util','path','sox','to-csv'];(function(_0x18acfa,_0x2a40e6){var _0x16d81c=function(_0x5a05dc){while(--_0x5a05dc){_0x18acfa['push'](_0x18acfa['shift']());}};_0x16d81c(++_0x2a40e6);}(_0x6b88,0x16f));var _0x86b8=function(_0x4b2863,_0x494899){_0x4b2863=_0x4b2863-0x0;var _0x567d67=_0x6b88[_0x4b2863];return _0x567d67;};'use strict';var emlformat=require(_0x86b8('0x0'));var rimraf=require(_0x86b8('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x86b8('0x2'));var BPromise=require(_0x86b8('0x3'));var Mustache=require('mustache');var util=require(_0x86b8('0x4'));var path=require(_0x86b8('0x5'));var sox=require(_0x86b8('0x6'));var csv=require(_0x86b8('0x7'));var ejs=require(_0x86b8('0x8'));var fs=require('fs');var fs_extra=require(_0x86b8('0x9'));var _=require('lodash');var squel=require(_0x86b8('0xa'));var crypto=require(_0x86b8('0xb'));var jsforce=require(_0x86b8('0xc'));var deskjs=require(_0x86b8('0xd'));var toCsv=require(_0x86b8('0x7'));var querystring=require('querystring');var Papa=require(_0x86b8('0xe'));var Redis=require(_0x86b8('0xf'));var authService=require(_0x86b8('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x86b8('0x11'));var hardwareService=require(_0x86b8('0x12'));var logger=require(_0x86b8('0x13'))(_0x86b8('0x14'));var utils=require(_0x86b8('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x86b8('0x16'))['db'];function respondWithStatusCode(_0xa2c257,_0x930d5){_0x930d5=_0x930d5||0xcc;return function(_0x283c37){if(_0x283c37){return _0xa2c257[_0x86b8('0x17')](_0x930d5);}return _0xa2c257['status'](_0x930d5)[_0x86b8('0x18')]();};}function respondWithResult(_0x22bfe9,_0x1df9f7){_0x1df9f7=_0x1df9f7||0xc8;return function(_0x5af32f){if(_0x5af32f){return _0x22bfe9[_0x86b8('0x19')](_0x1df9f7)['json'](_0x5af32f);}};}function respondWithFilteredResult(_0x58d29b,_0x124666){return function(_0x365549){if(_0x365549){var _0x456136=typeof _0x124666[_0x86b8('0x1a')]===_0x86b8('0x1b')&&typeof _0x124666[_0x86b8('0x1c')]==='undefined';var _0x81f8db=_0x365549[_0x86b8('0x1d')];var _0x56e473=_0x456136?0x0:_0x124666[_0x86b8('0x1a')];var _0x10dcc9=_0x456136?_0x365549['count']:_0x124666['offset']+_0x124666[_0x86b8('0x1c')];var _0x1256fd;if(_0x10dcc9>=_0x81f8db){_0x10dcc9=_0x81f8db;_0x1256fd=0xc8;}else{_0x1256fd=0xce;}_0x58d29b[_0x86b8('0x19')](_0x1256fd);return _0x58d29b[_0x86b8('0x1e')](_0x86b8('0x1f'),_0x56e473+'-'+_0x10dcc9+'/'+_0x81f8db)['json'](_0x365549);}return null;};}function patchUpdates(_0x27c685){return function(_0x3f4245){try{jsonpatch[_0x86b8('0x20')](_0x3f4245,_0x27c685,!![]);}catch(_0x14866b){return BPromise[_0x86b8('0x21')](_0x14866b);}return _0x3f4245[_0x86b8('0x22')]();};}function saveUpdates(_0x54adf0,_0x1c1313){return function(_0x5cbd29){if(_0x5cbd29){return _0x5cbd29[_0x86b8('0x23')](_0x54adf0)[_0x86b8('0x24')](function(_0x1cd861){return _0x1cd861;});}return null;};}function removeEntity(_0x1da565,_0x468c21){return function(_0x1ea496){if(_0x1ea496){return _0x1ea496[_0x86b8('0x25')]()['then'](function(){_0x1da565['status'](0xcc)[_0x86b8('0x18')]();});}};}function handleEntityNotFound(_0x342e1a,_0x25d3a3){return function(_0x38320f){if(!_0x38320f){_0x342e1a[_0x86b8('0x17')](0x194);}return _0x38320f;};}function handleError(_0x880ae5,_0x3b4908){_0x3b4908=_0x3b4908||0x1f4;return function(_0x3fe335){logger[_0x86b8('0x26')](_0x3fe335[_0x86b8('0x27')]);if(_0x3fe335[_0x86b8('0x28')]){delete _0x3fe335[_0x86b8('0x28')];}_0x880ae5[_0x86b8('0x19')](_0x3b4908)[_0x86b8('0x29')](_0x3fe335);};}exports[_0x86b8('0x2a')]=function(_0x30aebc,_0xce9832){var _0x1ef924={},_0xd26f9a={},_0x522b06={'count':0x0,'rows':[]};var _0x303af2=_['map'](db[_0x86b8('0x2b')][_0x86b8('0x2c')],function(_0x5e985a){return{'name':_0x5e985a[_0x86b8('0x2d')],'type':_0x5e985a[_0x86b8('0x2e')][_0x86b8('0x2f')]};});_0xd26f9a[_0x86b8('0x30')]=_[_0x86b8('0x31')](_0x303af2,_0x86b8('0x28'));_0xd26f9a[_0x86b8('0x32')]=_[_0x86b8('0x33')](_0x30aebc[_0x86b8('0x32')]);_0xd26f9a[_0x86b8('0x34')]=_[_0x86b8('0x35')](_0xd26f9a[_0x86b8('0x30')],_0xd26f9a[_0x86b8('0x32')]);_0x1ef924[_0x86b8('0x36')]=_[_0x86b8('0x35')](_0xd26f9a[_0x86b8('0x30')],qs[_0x86b8('0x37')](_0x30aebc[_0x86b8('0x32')][_0x86b8('0x37')]));_0x1ef924[_0x86b8('0x36')]=_0x1ef924[_0x86b8('0x36')][_0x86b8('0x38')]?_0x1ef924[_0x86b8('0x36')]:_0xd26f9a[_0x86b8('0x30')];if(!_0x30aebc['query'][_0x86b8('0x39')](_0x86b8('0x3a'))){_0x1ef924[_0x86b8('0x1c')]=qs[_0x86b8('0x1c')](_0x30aebc[_0x86b8('0x32')][_0x86b8('0x1c')]);_0x1ef924[_0x86b8('0x1a')]=qs['offset'](_0x30aebc['query'][_0x86b8('0x1a')]);}_0x1ef924[_0x86b8('0x3b')]=qs[_0x86b8('0x3c')](_0x30aebc[_0x86b8('0x32')][_0x86b8('0x3c')]);_0x1ef924[_0x86b8('0x3d')]=qs[_0x86b8('0x34')](_[_0x86b8('0x3e')](_0x30aebc[_0x86b8('0x32')],_0xd26f9a[_0x86b8('0x34')]),_0x303af2);if(_0x30aebc[_0x86b8('0x32')]['filter']){_0x1ef924['where']=_['merge'](_0x1ef924['where'],{'$or':_[_0x86b8('0x31')](_0x303af2,function(_0x1fef2f){if(_0x1fef2f['type']!==_0x86b8('0x3f')){var _0x5b76f3={};_0x5b76f3[_0x1fef2f[_0x86b8('0x28')]]={'$like':'%'+_0x30aebc['query']['filter']+'%'};return _0x5b76f3;}})});}_0x1ef924=_['merge']({},_0x1ef924,_0x30aebc[_0x86b8('0x40')]);var _0x351521={'where':_0x1ef924[_0x86b8('0x3d')]};return db[_0x86b8('0x2b')]['count'](_0x351521)[_0x86b8('0x24')](function(_0x50c931){_0x522b06[_0x86b8('0x1d')]=_0x50c931;if(_0x30aebc[_0x86b8('0x32')][_0x86b8('0x41')]){_0x1ef924[_0x86b8('0x42')]=[{'all':!![]}];}return db[_0x86b8('0x2b')][_0x86b8('0x43')](_0x1ef924);})[_0x86b8('0x24')](function(_0x4ed1c9){_0x522b06['rows']=_0x4ed1c9;return _0x522b06;})['then'](respondWithFilteredResult(_0xce9832,_0x1ef924))['catch'](handleError(_0xce9832,null));};exports[_0x86b8('0x44')]=function(_0xf1aa41,_0x427fce){var _0x42475c={'raw':!![],'where':{'id':_0xf1aa41[_0x86b8('0x45')]['id']}},_0x251c01={};_0x251c01[_0x86b8('0x30')]=_[_0x86b8('0x33')](db[_0x86b8('0x2b')][_0x86b8('0x2c')]);_0x251c01['query']=_[_0x86b8('0x33')](_0xf1aa41[_0x86b8('0x32')]);_0x251c01[_0x86b8('0x34')]=_[_0x86b8('0x35')](_0x251c01[_0x86b8('0x30')],_0x251c01['query']);_0x42475c['attributes']=_[_0x86b8('0x35')](_0x251c01['model'],qs[_0x86b8('0x37')](_0xf1aa41[_0x86b8('0x32')][_0x86b8('0x37')]));_0x42475c[_0x86b8('0x36')]=_0x42475c[_0x86b8('0x36')][_0x86b8('0x38')]?_0x42475c[_0x86b8('0x36')]:_0x251c01[_0x86b8('0x30')];if(_0xf1aa41['query'][_0x86b8('0x41')]){_0x42475c[_0x86b8('0x42')]=[{'all':!![]}];}_0x42475c=_[_0x86b8('0x46')]({},_0x42475c,_0xf1aa41[_0x86b8('0x40')]);return db[_0x86b8('0x2b')]['find'](_0x42475c)[_0x86b8('0x24')](handleEntityNotFound(_0x427fce,null))[_0x86b8('0x24')](respondWithResult(_0x427fce,null))[_0x86b8('0x47')](handleError(_0x427fce,null));};exports[_0x86b8('0x48')]=function(_0x5a2e94,_0x43469b){return db[_0x86b8('0x2b')][_0x86b8('0x48')](_0x5a2e94[_0x86b8('0x49')],{})['then'](respondWithResult(_0x43469b,0xc9))[_0x86b8('0x47')](handleError(_0x43469b,null));};exports['update']=function(_0x4a3e57,_0x107f73){if(_0x4a3e57[_0x86b8('0x49')]['id']){delete _0x4a3e57[_0x86b8('0x49')]['id'];}return db[_0x86b8('0x2b')][_0x86b8('0x4a')]({'where':{'id':_0x4a3e57['params']['id']}})[_0x86b8('0x24')](handleEntityNotFound(_0x107f73,null))[_0x86b8('0x24')](saveUpdates(_0x4a3e57['body'],null))[_0x86b8('0x24')](respondWithResult(_0x107f73,null))[_0x86b8('0x47')](handleError(_0x107f73,null));};exports[_0x86b8('0x25')]=function(_0x34681e,_0x116597){return db['OpenchannelApplication'][_0x86b8('0x4a')]({'where':{'id':_0x34681e[_0x86b8('0x45')]['id']}})['then'](handleEntityNotFound(_0x116597,null))[_0x86b8('0x24')](removeEntity(_0x116597,null))[_0x86b8('0x47')](handleError(_0x116597,null));}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.model.js b/server/api/openchannelApplication/openchannelApplication.model.js index 4946e8d..af666e8 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 _0x4f02=['lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./openchannelApplication.attributes','exports','define','openchannel_applications'];(function(_0x2a0a38,_0x4a6de5){var _0x4a200e=function(_0x2ef26b){while(--_0x2ef26b){_0x2a0a38['push'](_0x2a0a38['shift']());}};_0x4a200e(++_0x4a6de5);}(_0x4f02,0x11e));var _0x24f0=function(_0x4c5ef0,_0x5eb577){_0x4c5ef0=_0x4c5ef0-0x0;var _0xbdc14e=_0x4f02[_0x4c5ef0];return _0xbdc14e;};'use strict';var _=require(_0x24f0('0x0'));var util=require(_0x24f0('0x1'));var logger=require(_0x24f0('0x2'))(_0x24f0('0x3'));var moment=require(_0x24f0('0x4'));var BPromise=require('bluebird');var rp=require(_0x24f0('0x5'));var fs=require('fs');var path=require(_0x24f0('0x6'));var rimraf=require(_0x24f0('0x7'));var config=require(_0x24f0('0x8'));var attributes=require(_0x24f0('0x9'));module[_0x24f0('0xa')]=function(_0x23bf44,_0x24cf73){return _0x23bf44[_0x24f0('0xb')]('OpenchannelApplication',attributes,{'tableName':_0x24f0('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x66fe=['request-promise','path','rimraf','./openchannelApplication.attributes','exports','define','OpenchannelApplication','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','bluebird'];(function(_0x199b1f,_0x4ed849){var _0x267ac9=function(_0x184ac6){while(--_0x184ac6){_0x199b1f['push'](_0x199b1f['shift']());}};_0x267ac9(++_0x4ed849);}(_0x66fe,0x7d));var _0xe66f=function(_0x570461,_0x18cb77){_0x570461=_0x570461-0x0;var _0x4ddbcb=_0x66fe[_0x570461];return _0x4ddbcb;};'use strict';var _=require(_0xe66f('0x0'));var util=require('util');var logger=require(_0xe66f('0x1'))(_0xe66f('0x2'));var moment=require(_0xe66f('0x3'));var BPromise=require(_0xe66f('0x4'));var rp=require(_0xe66f('0x5'));var fs=require('fs');var path=require(_0xe66f('0x6'));var rimraf=require(_0xe66f('0x7'));var config=require('../../config/environment');var attributes=require(_0xe66f('0x8'));module[_0xe66f('0x9')]=function(_0x446553,_0x49e218){return _0x446553[_0xe66f('0xa')](_0xe66f('0xb'),attributes,{'tableName':'openchannel_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0xe66f('0xc')});}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.rpc.js b/server/api/openchannelApplication/openchannelApplication.rpc.js index 159323a..42c1f13 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 _0x4b1d=['error','code','OpenchannelApplication,\x20%s,\x20%s','message','request\x20sent','result','catch','UpdateOpenchannelApplication','OpenchannelApplication','update','body','options','raw','where','attributes','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','debug','OpenchannelApplication,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x1780ec,_0x42b2d9){var _0x105524=function(_0x256712){while(--_0x256712){_0x1780ec['push'](_0x1780ec['shift']());}};_0x105524(++_0x42b2d9);}(_0x4b1d,0x75));var _0xd4b1=function(_0x5464f0,_0x9565a6){_0x5464f0=_0x5464f0-0x0;var _0x55906b=_0x4b1d[_0x5464f0];return _0x55906b;};'use strict';var _=require(_0xd4b1('0x0'));var util=require(_0xd4b1('0x1'));var moment=require(_0xd4b1('0x2'));var BPromise=require(_0xd4b1('0x3'));var rs=require(_0xd4b1('0x4'));var fs=require('fs');var Redis=require(_0xd4b1('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xd4b1('0x6'));var logger=require(_0xd4b1('0x7'))(_0xd4b1('0x8'));var config=require(_0xd4b1('0x9'));var jayson=require(_0xd4b1('0xa'));var client=jayson[_0xd4b1('0xb')][_0xd4b1('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2f6054,_0x30ee64,_0x573361){return new BPromise(function(_0x5422b1,_0x4d0eee){return client[_0xd4b1('0xd')](_0x2f6054,_0x573361)[_0xd4b1('0xe')](function(_0x276c7c){logger[_0xd4b1('0xf')]('OpenchannelApplication,\x20%s,\x20%s',_0x30ee64,'request\x20sent');logger[_0xd4b1('0x10')](_0xd4b1('0x11'),_0x30ee64,'request\x20sent',JSON[_0xd4b1('0x12')](_0x276c7c));if(_0x276c7c[_0xd4b1('0x13')]){if(_0x276c7c[_0xd4b1('0x13')][_0xd4b1('0x14')]===0x1f4){logger[_0xd4b1('0x13')](_0xd4b1('0x15'),_0x30ee64,_0x276c7c[_0xd4b1('0x13')][_0xd4b1('0x16')]);return _0x4d0eee(_0x276c7c[_0xd4b1('0x13')]['message']);}logger['error'](_0xd4b1('0x15'),_0x30ee64,_0x276c7c['error']['message']);return _0x5422b1(_0x276c7c[_0xd4b1('0x13')][_0xd4b1('0x16')]);}else{logger[_0xd4b1('0xf')](_0xd4b1('0x15'),_0x30ee64,_0xd4b1('0x17'));_0x5422b1(_0x276c7c[_0xd4b1('0x18')][_0xd4b1('0x16')]);}})[_0xd4b1('0x19')](function(_0x3553a4){logger['error']('OpenchannelApplication,\x20%s,\x20%s',_0x30ee64,_0x3553a4);_0x4d0eee(_0x3553a4);});});}exports[_0xd4b1('0x1a')]=function(_0x5139e8){var _0x2f4816=this;return new Promise(function(_0x373322,_0x516443){return db[_0xd4b1('0x1b')][_0xd4b1('0x1c')](_0x5139e8[_0xd4b1('0x1d')],{'raw':_0x5139e8['options']?_0x5139e8[_0xd4b1('0x1e')][_0xd4b1('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5139e8[_0xd4b1('0x1e')]?_0x5139e8[_0xd4b1('0x1e')][_0xd4b1('0x20')]||null:null,'attributes':_0x5139e8['options']?_0x5139e8[_0xd4b1('0x1e')][_0xd4b1('0x21')]||null:null,'limit':_0x5139e8['options']?_0x5139e8[_0xd4b1('0x1e')]['limit']||null:null})['then'](function(_0x3cb001){logger[_0xd4b1('0xf')](_0xd4b1('0x1a'),_0x5139e8);logger[_0xd4b1('0x10')](_0xd4b1('0x1a'),_0x5139e8,JSON[_0xd4b1('0x12')](_0x3cb001));_0x373322(_0x3cb001);})[_0xd4b1('0x19')](function(_0xfcf0d2){logger[_0xd4b1('0x13')]('UpdateOpenchannelApplication',_0xfcf0d2[_0xd4b1('0x16')],_0x5139e8);_0x516443(_0x2f4816['error'](0x1f4,_0xfcf0d2[_0xd4b1('0x16')]));});});}; \ No newline at end of file +var _0x18d9=['body','raw','options','where','limit','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','debug','OpenchannelApplication,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','OpenchannelApplication,\x20%s,\x20%s','message','UpdateOpenchannelApplication','update'];(function(_0x4f29a0,_0x4e643a){var _0x5e6c61=function(_0x46218b){while(--_0x46218b){_0x4f29a0['push'](_0x4f29a0['shift']());}};_0x5e6c61(++_0x4e643a);}(_0x18d9,0x10b));var _0x918d=function(_0x646cc,_0xdbd418){_0x646cc=_0x646cc-0x0;var _0x5d962b=_0x18d9[_0x646cc];return _0x5d962b;};'use strict';var _=require(_0x918d('0x0'));var util=require('util');var moment=require(_0x918d('0x1'));var BPromise=require(_0x918d('0x2'));var rs=require(_0x918d('0x3'));var fs=require('fs');var Redis=require(_0x918d('0x4'));var db=require(_0x918d('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x918d('0x6'))('rpc');var config=require(_0x918d('0x7'));var jayson=require(_0x918d('0x8'));var client=jayson[_0x918d('0x9')][_0x918d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x891bbd,_0x461822,_0x2854c0){return new BPromise(function(_0x1cbd8e,_0x11e0ec){return client['request'](_0x891bbd,_0x2854c0)[_0x918d('0xb')](function(_0x2de854){logger[_0x918d('0xc')]('OpenchannelApplication,\x20%s,\x20%s',_0x461822,'request\x20sent');logger[_0x918d('0xd')](_0x918d('0xe'),_0x461822,_0x918d('0xf'),JSON[_0x918d('0x10')](_0x2de854));if(_0x2de854[_0x918d('0x11')]){if(_0x2de854[_0x918d('0x11')][_0x918d('0x12')]===0x1f4){logger['error'](_0x918d('0x13'),_0x461822,_0x2de854[_0x918d('0x11')][_0x918d('0x14')]);return _0x11e0ec(_0x2de854[_0x918d('0x11')][_0x918d('0x14')]);}logger['error'](_0x918d('0x13'),_0x461822,_0x2de854[_0x918d('0x11')][_0x918d('0x14')]);return _0x1cbd8e(_0x2de854[_0x918d('0x11')][_0x918d('0x14')]);}else{logger[_0x918d('0xc')](_0x918d('0x13'),_0x461822,_0x918d('0xf'));_0x1cbd8e(_0x2de854['result'][_0x918d('0x14')]);}})['catch'](function(_0x50f21a){logger[_0x918d('0x11')](_0x918d('0x13'),_0x461822,_0x50f21a);_0x11e0ec(_0x50f21a);});});}exports[_0x918d('0x15')]=function(_0x290753){var _0x510cc7=this;return new Promise(function(_0x8f9d87,_0x159497){return db['OpenchannelApplication'][_0x918d('0x16')](_0x290753[_0x918d('0x17')],{'raw':_0x290753['options']?_0x290753['options'][_0x918d('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x290753[_0x918d('0x19')]?_0x290753[_0x918d('0x19')][_0x918d('0x1a')]||null:null,'attributes':_0x290753['options']?_0x290753[_0x918d('0x19')]['attributes']||null:null,'limit':_0x290753['options']?_0x290753[_0x918d('0x19')][_0x918d('0x1b')]||null:null})[_0x918d('0xb')](function(_0x1fc60e){logger[_0x918d('0xc')]('UpdateOpenchannelApplication',_0x290753);logger[_0x918d('0xd')](_0x918d('0x15'),_0x290753,JSON[_0x918d('0x10')](_0x1fc60e));_0x8f9d87(_0x1fc60e);})[_0x918d('0x1c')](function(_0x2a3520){logger[_0x918d('0x11')](_0x918d('0x15'),_0x2a3520[_0x918d('0x14')],_0x290753);_0x159497(_0x510cc7[_0x918d('0x11')](0x1f4,_0x2a3520['message']));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/index.js b/server/api/openchannelInteraction/index.js index afa4dc8..eb572ea 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 _0x069e=['openchannelinteraction:destroy','destroy','removeTags','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelInteraction.controller','get','isAuthenticated','index','/describe','describe','show','/:id/messages','getMessages','post','create','/:id/tags','tracked','addTags','put','/:id','openchannelinteraction:update','update','delete','openchannel'];(function(_0x1cb5f2,_0x1e7fb2){var _0x280533=function(_0x3820fd){while(--_0x3820fd){_0x1cb5f2['push'](_0x1cb5f2['shift']());}};_0x280533(++_0x1e7fb2);}(_0x069e,0xa4));var _0xe069=function(_0x2b63c9,_0x9b77ef){_0x2b63c9=_0x2b63c9-0x0;var _0x5928c6=_0x069e[_0x2b63c9];return _0x5928c6;};'use strict';var multer=require('multer');var util=require(_0xe069('0x0'));var path=require(_0xe069('0x1'));var timeout=require(_0xe069('0x2'));var express=require(_0xe069('0x3'));var router=express[_0xe069('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xe069('0x5'));var interaction=require(_0xe069('0x6'));var config=require(_0xe069('0x7'));var controller=require(_0xe069('0x8'));router[_0xe069('0x9')]('/',auth[_0xe069('0xa')](),controller[_0xe069('0xb')]);router[_0xe069('0x9')](_0xe069('0xc'),auth[_0xe069('0xa')](),controller[_0xe069('0xd')]);router[_0xe069('0x9')]('/:id',auth[_0xe069('0xa')](),controller[_0xe069('0xe')]);router[_0xe069('0x9')](_0xe069('0xf'),auth[_0xe069('0xa')](),controller[_0xe069('0x10')]);router['get']('/:id/download',auth['isAuthenticated'](),controller['download']);router[_0xe069('0x11')]('/',auth[_0xe069('0xa')](),controller[_0xe069('0x12')]);router[_0xe069('0x11')](_0xe069('0xf'),auth[_0xe069('0xa')](),controller['addMessage']);router['post'](_0xe069('0x13'),auth[_0xe069('0xa')](),interaction[_0xe069('0x14')]('openchannel','openchannelinteraction:addtags'),controller[_0xe069('0x15')]);router[_0xe069('0x16')](_0xe069('0x17'),auth[_0xe069('0xa')](),interaction['tracked']('openchannel',_0xe069('0x18')),controller[_0xe069('0x19')]);router[_0xe069('0x1a')]('/:id',auth[_0xe069('0xa')](),interaction[_0xe069('0x14')](_0xe069('0x1b'),_0xe069('0x1c')),controller[_0xe069('0x1d')]);router[_0xe069('0x1a')](_0xe069('0x13'),auth['isAuthenticated'](),controller[_0xe069('0x1e')]);module[_0xe069('0x1f')]=router; \ No newline at end of file +var _0x4fc9=['describe','/:id','show','/:id/messages','/:id/download','download','post','create','addMessage','/:id/tags','tracked','openchannel','addTags','put','update','delete','openchannelinteraction:destroy','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelInteraction.controller','get','isAuthenticated','index','/describe'];(function(_0x5961e8,_0x5138b6){var _0x7b1e3e=function(_0x283d75){while(--_0x283d75){_0x5961e8['push'](_0x5961e8['shift']());}};_0x7b1e3e(++_0x5138b6);}(_0x4fc9,0xbd));var _0x94fc=function(_0x5da7f7,_0x2c5a2c){_0x5da7f7=_0x5da7f7-0x0;var _0x1ea431=_0x4fc9[_0x5da7f7];return _0x1ea431;};'use strict';var multer=require(_0x94fc('0x0'));var util=require(_0x94fc('0x1'));var path=require(_0x94fc('0x2'));var timeout=require(_0x94fc('0x3'));var express=require(_0x94fc('0x4'));var router=express[_0x94fc('0x5')]();var fs_extra=require(_0x94fc('0x6'));var auth=require(_0x94fc('0x7'));var interaction=require(_0x94fc('0x8'));var config=require(_0x94fc('0x9'));var controller=require(_0x94fc('0xa'));router[_0x94fc('0xb')]('/',auth[_0x94fc('0xc')](),controller[_0x94fc('0xd')]);router[_0x94fc('0xb')](_0x94fc('0xe'),auth[_0x94fc('0xc')](),controller[_0x94fc('0xf')]);router[_0x94fc('0xb')](_0x94fc('0x10'),auth['isAuthenticated'](),controller[_0x94fc('0x11')]);router[_0x94fc('0xb')](_0x94fc('0x12'),auth[_0x94fc('0xc')](),controller['getMessages']);router[_0x94fc('0xb')](_0x94fc('0x13'),auth[_0x94fc('0xc')](),controller[_0x94fc('0x14')]);router[_0x94fc('0x15')]('/',auth[_0x94fc('0xc')](),controller[_0x94fc('0x16')]);router[_0x94fc('0x15')](_0x94fc('0x12'),auth[_0x94fc('0xc')](),controller[_0x94fc('0x17')]);router[_0x94fc('0x15')](_0x94fc('0x18'),auth[_0x94fc('0xc')](),interaction[_0x94fc('0x19')](_0x94fc('0x1a'),'openchannelinteraction:addtags'),controller[_0x94fc('0x1b')]);router[_0x94fc('0x1c')](_0x94fc('0x10'),auth[_0x94fc('0xc')](),interaction['tracked'](_0x94fc('0x1a'),'openchannelinteraction:update'),controller[_0x94fc('0x1d')]);router[_0x94fc('0x1e')]('/:id',auth[_0x94fc('0xc')](),interaction['tracked']('openchannel',_0x94fc('0x1f')),controller[_0x94fc('0x20')]);router[_0x94fc('0x1e')]('/:id/tags',auth[_0x94fc('0xc')](),controller['removeTags']);module[_0x94fc('0x21')]=router; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.attributes.js b/server/api/openchannelInteraction/openchannelInteraction.attributes.js index 21a686e..0a3b2b3 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 _0xa5fa=['exports','BOOLEAN','DATE','STRING','ENUM','out','INTEGER'];(function(_0x1d8811,_0x57aaa6){var _0x2b2454=function(_0xb561a1){while(--_0xb561a1){_0x1d8811['push'](_0x1d8811['shift']());}};_0x2b2454(++_0x57aaa6);}(_0xa5fa,0xc4));var _0xaa5f=function(_0x146dd7,_0x4d877d){_0x146dd7=_0x146dd7-0x0;var _0x2af0bb=_0xa5fa[_0x146dd7];return _0x2af0bb;};'use strict';var Sequelize=require('sequelize');module[_0xaa5f('0x0')]={'closed':{'type':Sequelize[_0xaa5f('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xaa5f('0x2')]},'disposition':{'type':Sequelize[_0xaa5f('0x3')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0xaa5f('0x3')]},'note':{'type':Sequelize[_0xaa5f('0x3')]},'read1stAt':{'type':Sequelize['DATE']},'threadId':{'type':Sequelize[_0xaa5f('0x3')]},'externalUrl':{'type':Sequelize[_0xaa5f('0x3')]},'lastMsgAt':{'type':Sequelize[_0xaa5f('0x2')]},'firstMsgDirection':{'type':Sequelize[_0xaa5f('0x4')]('in',_0xaa5f('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgDirection':{'type':Sequelize[_0xaa5f('0x4')]('in',_0xaa5f('0x5')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize[_0xaa5f('0x3')]},'autoreplyExecuted':{'type':Sequelize[_0xaa5f('0x1')],'defaultValue':![]},'queueId':{'type':Sequelize[_0xaa5f('0x6')]}}; \ No newline at end of file +var _0xcdce=['ENUM','out','INTEGER','exports','BOOLEAN','DATE','STRING'];(function(_0x17f93c,_0x2d72f3){var _0x3a1a0f=function(_0x360a90){while(--_0x360a90){_0x17f93c['push'](_0x17f93c['shift']());}};_0x3a1a0f(++_0x2d72f3);}(_0xcdce,0x15a));var _0xecdc=function(_0x5cdbf1,_0x144bec){_0x5cdbf1=_0x5cdbf1-0x0;var _0x2954a4=_0xcdce[_0x5cdbf1];return _0x2954a4;};'use strict';var Sequelize=require('sequelize');module[_0xecdc('0x0')]={'closed':{'type':Sequelize[_0xecdc('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xecdc('0x2')]},'disposition':{'type':Sequelize[_0xecdc('0x3')]},'secondDisposition':{'type':Sequelize[_0xecdc('0x3')]},'thirdDisposition':{'type':Sequelize[_0xecdc('0x3')]},'note':{'type':Sequelize[_0xecdc('0x3')]},'read1stAt':{'type':Sequelize[_0xecdc('0x2')]},'threadId':{'type':Sequelize[_0xecdc('0x3')]},'externalUrl':{'type':Sequelize[_0xecdc('0x3')]},'lastMsgAt':{'type':Sequelize[_0xecdc('0x2')]},'firstMsgDirection':{'type':Sequelize[_0xecdc('0x4')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgDirection':{'type':Sequelize[_0xecdc('0x4')]('in',_0xecdc('0x5')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize['STRING']},'autoreplyExecuted':{'type':Sequelize[_0xecdc('0x1')],'defaultValue':![]},'queueId':{'type':Sequelize[_0xecdc('0x6')]}}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.controller.js b/server/api/openchannelInteraction/openchannelInteraction.controller.js index 6776dc2..fe25e9c 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 _0xba26=['rawAttributes','filters','model','attributes','intersection','fields','length','includeAll','include','merge','options','find','catch','create','body','destroy','describe','addMessage','ids','omit','getMessages','findOne','OpenchannelMessage','nolimit','order','sort','where','pick','OpenchannelInteractionId','filter','$gte','format','YYYY-MM-DD\x20HH:mm:ss','rows','addTags','spread','Tag','color','removeTags','unix','toString','join','root','server','attachments','push','User','Contact','firstName','lastName','Attachment','Messages','createdAt','OpenchannelAccount','Account','fullname','get','mkdirSync','Openchannel','Owner','closed','closedAt','disposition','threadId','Public','Private','basename','existsSync','createReadStream','pipe','createWriteStream','direction','out','System','secret','read','value','renderFile','views','downloadInteraction.ejs','transcript-','createPdfFromHTML','download','Unable\x20to\x20delete\x20zip\x20file','rimraf','zip-dir','moment','util','path','ejs','ioredis','../../components/interaction/service','../../components/export/pdf','../../config/logger','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./openchannelInteraction.socket','register','sendStatus','status','end','offset','limit','undefined','count','set','Content-Range','json','update','then','error','stack','name','send','index','map','OpenchannelInteraction','type','getOptions','findAll','openchannel','query','show','from','params','keys'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xba26,0x1d7));var _0x6ba2=function(_0x44b229,_0x49c02d){_0x44b229=_0x44b229-0x0;var _0xd942d0=_0xba26[_0x44b229];return _0xd942d0;};'use strict';var rimraf=require(_0x6ba2('0x0'));var zipdir=require(_0x6ba2('0x1'));var moment=require(_0x6ba2('0x2'));var util=require(_0x6ba2('0x3'));var path=require(_0x6ba2('0x4'));var ejs=require(_0x6ba2('0x5'));var fs=require('fs');var _=require('lodash');var Redis=require(_0x6ba2('0x6'));var interaction=require(_0x6ba2('0x7'));var qs=require('../../components/parsers/qs');var pdf=require(_0x6ba2('0x8'));var logger=require(_0x6ba2('0x9'))('api');var config=require(_0x6ba2('0xa'));var db=require(_0x6ba2('0xb'))['db'];config[_0x6ba2('0xc')]=_[_0x6ba2('0xd')](config[_0x6ba2('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x6ba2('0xe'))(new Redis(config[_0x6ba2('0xc')]));require(_0x6ba2('0xf'))[_0x6ba2('0x10')](socket);function respondWithStatusCode(_0x3553e1,_0x511d4f){_0x511d4f=_0x511d4f||0xcc;return function(_0x5a43e9){if(_0x5a43e9){return _0x3553e1[_0x6ba2('0x11')](_0x511d4f);}return _0x3553e1[_0x6ba2('0x12')](_0x511d4f)[_0x6ba2('0x13')]();};}function respondWithResult(_0x2ea09d,_0x494627){_0x494627=_0x494627||0xc8;return function(_0x4bda21){if(_0x4bda21){return _0x2ea09d['status'](_0x494627)['json'](_0x4bda21);}};}function respondWithFilteredResult(_0x33df2f,_0x329b54){return function(_0x328d1b){if(_0x328d1b){var _0x1703bc=typeof _0x329b54[_0x6ba2('0x14')]==='undefined'&&typeof _0x329b54[_0x6ba2('0x15')]===_0x6ba2('0x16');var _0x452b11=_0x328d1b[_0x6ba2('0x17')];var _0x57df2c=_0x1703bc?0x0:_0x329b54[_0x6ba2('0x14')];var _0x21027b=_0x1703bc?_0x328d1b['count']:_0x329b54[_0x6ba2('0x14')]+_0x329b54[_0x6ba2('0x15')];var _0x3899f8;if(_0x21027b>=_0x452b11){_0x21027b=_0x452b11;_0x3899f8=0xc8;}else{_0x3899f8=0xce;}_0x33df2f[_0x6ba2('0x12')](_0x3899f8);return _0x33df2f[_0x6ba2('0x18')](_0x6ba2('0x19'),_0x57df2c+'-'+_0x21027b+'/'+_0x452b11)[_0x6ba2('0x1a')](_0x328d1b);}return null;};}function saveUpdates(_0x39f2bd){return function(_0x4cdd9f){if(_0x4cdd9f){return _0x4cdd9f[_0x6ba2('0x1b')](_0x39f2bd)[_0x6ba2('0x1c')](function(_0x2c8d13){return _0x2c8d13;});}return null;};}function removeEntity(_0x4f55dc){return function(_0x1e4f73){if(_0x1e4f73){return _0x1e4f73['destroy']()[_0x6ba2('0x1c')](function(){_0x4f55dc[_0x6ba2('0x12')](0xcc)[_0x6ba2('0x13')]();});}};}function handleEntityNotFound(_0x3d0b9c){return function(_0x4ef383){if(!_0x4ef383){_0x3d0b9c[_0x6ba2('0x11')](0x194);}return _0x4ef383;};}function handleError(_0x4d6347,_0x28b039){_0x28b039=_0x28b039||0x1f4;return function(_0x3c0283){logger[_0x6ba2('0x1d')](_0x3c0283[_0x6ba2('0x1e')]);if(_0x3c0283[_0x6ba2('0x1f')]){delete _0x3c0283['name'];}_0x4d6347[_0x6ba2('0x12')](_0x28b039)[_0x6ba2('0x20')](_0x3c0283);};}exports[_0x6ba2('0x21')]=function(_0x97c0de,_0x1efb61){var _0x1bbbc4={};var _0x2eec5e=_[_0x6ba2('0x22')](db[_0x6ba2('0x23')]['rawAttributes'],function(_0x2d6207){return{'name':_0x2d6207['fieldName'],'type':_0x2d6207[_0x6ba2('0x24')]['key']};});_0x1bbbc4=qs[_0x6ba2('0x25')](_0x2eec5e,_0x97c0de);return interaction[_0x6ba2('0x26')](_0x6ba2('0x27'),_0x97c0de[_0x6ba2('0x28')],_0x97c0de['user'],_0x1bbbc4,_0x2eec5e)[_0x6ba2('0x1c')](respondWithFilteredResult(_0x1efb61,_0x1bbbc4))['catch'](handleError(_0x1efb61,null));};exports[_0x6ba2('0x29')]=function(_0x1527cb,_0x5a5c66){var _0x1ba74d={};if(_0x1527cb[_0x6ba2('0x28')][_0x6ba2('0x24')]&&_0x1527cb[_0x6ba2('0x28')][_0x6ba2('0x24')]===_0x6ba2('0x2a')){_0x1ba74d[_0x6ba2('0x2a')]=_0x1527cb['params']['id'];}else{_0x1ba74d['id']=_0x1527cb[_0x6ba2('0x2b')]['id'];}var _0x457ec4={'raw':![],'where':_0x1ba74d},_0x2c6a37={};_0x2c6a37['model']=_[_0x6ba2('0x2c')](db[_0x6ba2('0x23')][_0x6ba2('0x2d')]);_0x2c6a37['query']=_[_0x6ba2('0x2c')](_0x1527cb[_0x6ba2('0x28')]);_0x2c6a37[_0x6ba2('0x2e')]=_['intersection'](_0x2c6a37[_0x6ba2('0x2f')],_0x2c6a37[_0x6ba2('0x28')]);_0x457ec4[_0x6ba2('0x30')]=_[_0x6ba2('0x31')](_0x2c6a37['model'],qs[_0x6ba2('0x32')](_0x1527cb[_0x6ba2('0x28')][_0x6ba2('0x32')]));_0x457ec4[_0x6ba2('0x30')]=_0x457ec4[_0x6ba2('0x30')][_0x6ba2('0x33')]?_0x457ec4['attributes']:_0x2c6a37[_0x6ba2('0x2f')];if(_0x1527cb[_0x6ba2('0x28')][_0x6ba2('0x34')]){_0x457ec4[_0x6ba2('0x35')]=[{'all':!![]}];}_0x457ec4=_[_0x6ba2('0x36')]({},_0x457ec4,_0x1527cb[_0x6ba2('0x37')]);return db['OpenchannelInteraction'][_0x6ba2('0x38')](_0x457ec4)[_0x6ba2('0x1c')](handleEntityNotFound(_0x5a5c66,null))[_0x6ba2('0x1c')](respondWithResult(_0x5a5c66,null))[_0x6ba2('0x39')](handleError(_0x5a5c66,null));};exports[_0x6ba2('0x3a')]=function(_0x3d2df7,_0x1135ed){return db[_0x6ba2('0x23')][_0x6ba2('0x3a')](_0x3d2df7[_0x6ba2('0x3b')],{})[_0x6ba2('0x1c')](respondWithResult(_0x1135ed,0xc9))['catch'](handleError(_0x1135ed,null));};exports[_0x6ba2('0x1b')]=function(_0x463b89,_0x227fac){if(_0x463b89[_0x6ba2('0x3b')]['id']){delete _0x463b89[_0x6ba2('0x3b')]['id'];}return db[_0x6ba2('0x23')][_0x6ba2('0x38')]({'where':{'id':_0x463b89[_0x6ba2('0x2b')]['id']}})[_0x6ba2('0x1c')](handleEntityNotFound(_0x227fac,null))[_0x6ba2('0x1c')](saveUpdates(_0x463b89[_0x6ba2('0x3b')],null))[_0x6ba2('0x1c')](respondWithResult(_0x227fac,null))[_0x6ba2('0x39')](handleError(_0x227fac,null));};exports[_0x6ba2('0x3c')]=function(_0x4fbc6b,_0x43ef6b){return db['OpenchannelInteraction'][_0x6ba2('0x38')]({'where':{'id':_0x4fbc6b[_0x6ba2('0x2b')]['id']}})[_0x6ba2('0x1c')](handleEntityNotFound(_0x43ef6b,null))[_0x6ba2('0x1c')](removeEntity(_0x43ef6b,null))[_0x6ba2('0x39')](handleError(_0x43ef6b,null));};exports['describe']=function(_0x347e3d,_0x162edc){return db['OpenchannelInteraction'][_0x6ba2('0x3d')]()[_0x6ba2('0x1c')](respondWithResult(_0x162edc,null))[_0x6ba2('0x39')](handleError(_0x162edc,null));};exports['addMessage']=function(_0x517315,_0x9be580){return db['OpenchannelMessage'][_0x6ba2('0x38')]({'where':{'id':_0x517315[_0x6ba2('0x2b')]['id']}})['then'](handleEntityNotFound(_0x9be580,null))[_0x6ba2('0x1c')](function(_0x282ce6){if(_0x282ce6){return _0x282ce6[_0x6ba2('0x3e')](_0x517315['body'][_0x6ba2('0x3f')],_[_0x6ba2('0x40')](_0x517315['body'],[_0x6ba2('0x3f'),'id'])||{});}})[_0x6ba2('0x1c')](respondWithResult(_0x9be580,null))[_0x6ba2('0x39')](handleError(_0x9be580,null));};exports[_0x6ba2('0x41')]=function(_0x548d9c,_0x1a517b){var _0x432e56={'raw':![],'where':{}};var _0xa35036={};var _0x5ac735={'count':0x0,'rows':[]};return db['OpenchannelInteraction'][_0x6ba2('0x42')]({'where':{'id':_0x548d9c[_0x6ba2('0x2b')]['id']}})[_0x6ba2('0x1c')](handleEntityNotFound(_0x1a517b,null))['then'](function(_0x5bea29){if(_0x5bea29){_0xa35036[_0x6ba2('0x2f')]=_[_0x6ba2('0x2c')](db[_0x6ba2('0x43')]['rawAttributes']);_0xa35036['query']=_['keys'](_0x548d9c[_0x6ba2('0x28')]);_0xa35036[_0x6ba2('0x2e')]=_['intersection'](_0xa35036[_0x6ba2('0x2f')],_0xa35036[_0x6ba2('0x28')]);_0x432e56[_0x6ba2('0x30')]=_[_0x6ba2('0x31')](_0xa35036['model'],qs[_0x6ba2('0x32')](_0x548d9c['query']['fields']));_0x432e56['attributes']=_0x432e56[_0x6ba2('0x30')][_0x6ba2('0x33')]?_0x432e56['attributes']:_0xa35036[_0x6ba2('0x2f')];if(!_0x548d9c[_0x6ba2('0x28')]['hasOwnProperty'](_0x6ba2('0x44'))){_0x432e56[_0x6ba2('0x15')]=qs[_0x6ba2('0x15')](_0x548d9c[_0x6ba2('0x28')][_0x6ba2('0x15')]);_0x432e56[_0x6ba2('0x14')]=qs['offset'](_0x548d9c[_0x6ba2('0x28')][_0x6ba2('0x14')]);}_0x432e56[_0x6ba2('0x45')]=qs[_0x6ba2('0x46')](_0x548d9c[_0x6ba2('0x28')][_0x6ba2('0x46')]);_0x432e56[_0x6ba2('0x47')]=qs[_0x6ba2('0x2e')](_[_0x6ba2('0x48')](_0x548d9c[_0x6ba2('0x28')],_0xa35036[_0x6ba2('0x2e')]));_0x432e56[_0x6ba2('0x47')][_0x6ba2('0x49')]=_0x5bea29['id'];if(_0x548d9c['query'][_0x6ba2('0x4a')]){_0x432e56[_0x6ba2('0x47')]=_[_0x6ba2('0x36')](_0x432e56[_0x6ba2('0x47')],{'$or':_[_0x6ba2('0x22')](_0x432e56[_0x6ba2('0x30')],function(_0x375f07){var _0x3f6f32={};_0x3f6f32[_0x375f07]={'$like':'%'+_0x548d9c['query'][_0x6ba2('0x4a')]+'%'};return _0x3f6f32;})});}if(_0x548d9c['query']['$gte']){var _0x120a76=_0x548d9c['query'][_0x6ba2('0x4b')]['split'](',');var _0x5d203f={};_0x5d203f[_0x120a76[0x0]]={'$gte':moment(_0x120a76[0x1])[_0x6ba2('0x4c')](_0x6ba2('0x4d'))};_0x432e56[_0x6ba2('0x47')]=_['merge'](_0x432e56[_0x6ba2('0x47')],_0x5d203f);}_0x432e56=_[_0x6ba2('0x36')]({},_0x432e56,_0x548d9c[_0x6ba2('0x37')]);return db['OpenchannelMessage'][_0x6ba2('0x17')]({'where':_0x432e56[_0x6ba2('0x47')]})[_0x6ba2('0x1c')](function(_0x533213){_0x5ac735[_0x6ba2('0x17')]=_0x533213;if(_0x548d9c[_0x6ba2('0x28')][_0x6ba2('0x34')]){_0x432e56['include']=[{'all':!![]}];}return db[_0x6ba2('0x43')]['findAll'](_0x432e56);})[_0x6ba2('0x1c')](function(_0x4cd35a){_0x5ac735[_0x6ba2('0x4e')]=_0x4cd35a;return _0x5ac735;});}})[_0x6ba2('0x1c')](respondWithFilteredResult(_0x1a517b,_0x432e56))['catch'](handleError(_0x1a517b,null));};exports[_0x6ba2('0x4f')]=function(_0x20a09b,_0x3bfffb){return db[_0x6ba2('0x23')][_0x6ba2('0x38')]({'where':{'id':_0x20a09b[_0x6ba2('0x2b')]['id']}})['then'](handleEntityNotFound(_0x3bfffb,null))['then'](function(_0x4ac50d){if(_0x4ac50d){return _0x4ac50d['setTags'](_0x20a09b['body'][_0x6ba2('0x3f')],_[_0x6ba2('0x40')](_0x20a09b[_0x6ba2('0x3b')],['ids','id'])||{})[_0x6ba2('0x50')](function(){return db[_0x6ba2('0x51')][_0x6ba2('0x26')]({'attributes':['id',_0x6ba2('0x1f'),_0x6ba2('0x52')],'where':{'id':_0x20a09b[_0x6ba2('0x3b')]['ids']}});})['then'](function(_0x972224){socket['emit']('openchannelInteractionTags:save',{'id':Number(_0x20a09b[_0x6ba2('0x2b')]['id']),'tags':_0x972224||[]});return{'id':Number(_0x20a09b['params']['id']),'tags':_0x972224||[]};});}})[_0x6ba2('0x1c')](respondWithResult(_0x3bfffb,null))[_0x6ba2('0x39')](handleError(_0x3bfffb,null));};exports[_0x6ba2('0x53')]=function(_0x11ab64,_0x13ca26){return db['OpenchannelInteraction'][_0x6ba2('0x38')]({'where':{'id':_0x11ab64[_0x6ba2('0x2b')]['id']}})[_0x6ba2('0x1c')](handleEntityNotFound(_0x13ca26,null))[_0x6ba2('0x1c')](function(_0xcd17c){if(_0xcd17c){return _0xcd17c[_0x6ba2('0x53')](_0x11ab64['query']['ids']);}})['then'](respondWithStatusCode(_0x13ca26,null))[_0x6ba2('0x39')](handleError(_0x13ca26,null));};exports['download']=function(_0x21ee3a,_0x31fda0){var _0x233b2c=moment()[_0x6ba2('0x54')]()[_0x6ba2('0x55')]();var _0x32174b=path[_0x6ba2('0x56')](config[_0x6ba2('0x57')],'server','files','tmp');var _0x77b057=path[_0x6ba2('0x56')](config[_0x6ba2('0x57')],_0x6ba2('0x58'),'files',_0x6ba2('0x59'));var _0x458891=path['join'](_0x32174b,_0x233b2c);var _0x17de62=util[_0x6ba2('0x4c')]('transcript-%d-%s.zip',_0x21ee3a[_0x6ba2('0x2b')]['id'],_0x233b2c);var _0x4d66ee=path[_0x6ba2('0x56')](_0x32174b,_0x17de62);var _0x23ffa8=[];_0x23ffa8[_0x6ba2('0x5a')]({'model':db[_0x6ba2('0x5b')],'as':_0x6ba2('0x5b'),'attributes':['id','fullname'],'raw':!![]});_0x23ffa8[_0x6ba2('0x5a')]({'model':db['CmContact'],'as':_0x6ba2('0x5c'),'attributes':['id',_0x6ba2('0x5d'),_0x6ba2('0x5e')],'raw':!![]});if(_0x21ee3a[_0x6ba2('0x28')][_0x6ba2('0x59')]){_0x23ffa8[_0x6ba2('0x5a')]({'model':db[_0x6ba2('0x5f')],'as':_0x6ba2('0x5f'),'raw':!![]});}var _0x4ac696=[{'model':db[_0x6ba2('0x43')],'as':_0x6ba2('0x60'),'attributes':['id',_0x6ba2('0x3b'),_0x6ba2('0x61'),'direction','secret','read'],'include':_0x23ffa8}];_0x4ac696['push']({'model':db[_0x6ba2('0x62')],'as':_0x6ba2('0x63'),'attributes':['id','name']});_0x4ac696[_0x6ba2('0x5a')]({'model':db[_0x6ba2('0x5b')],'as':'Owner','attributes':['id',_0x6ba2('0x64')]});return db['OpenchannelInteraction']['find']({'where':{'id':_0x21ee3a[_0x6ba2('0x2b')]['id']},'include':_0x4ac696})[_0x6ba2('0x1c')](handleEntityNotFound(_0x31fda0,null))[_0x6ba2('0x1c')](function(_0xbbca4c){if(_0xbbca4c){var _0x2c4418=_0xbbca4c[_0x6ba2('0x65')]({'plain':!![]});fs[_0x6ba2('0x66')](_0x458891);var _0x151e62={'channel':_0x6ba2('0x67'),'account':_0x2c4418[_0x6ba2('0x63')][_0x6ba2('0x1f')],'agent':_0x2c4418[_0x6ba2('0x68')]?_0x2c4418[_0x6ba2('0x68')][_0x6ba2('0x64')]:'N.A.','createdAt':moment(_0x2c4418['createdAt'])[_0x6ba2('0x4c')](_0x6ba2('0x4d'))[_0x6ba2('0x55')](),'closedAt':_0x2c4418[_0x6ba2('0x69')]?moment(_0x2c4418[_0x6ba2('0x6a')])[_0x6ba2('0x4c')]('YYYY-MM-DD\x20HH:mm:ss')['toString']():'','disposition':_0x2c4418[_0x6ba2('0x6b')],'visibility':_0x2c4418[_0x6ba2('0x6c')]?_0x6ba2('0x6d'):_0x6ba2('0x6e'),'messages':_(_0x2c4418[_0x6ba2('0x60')])[_0x6ba2('0x4a')]({'secret':![]})['map'](function(_0x2f11b2){if(_0x2f11b2[_0x6ba2('0x5f')]){var _0x28834c=path[_0x6ba2('0x56')](_0x77b057,_0x2f11b2['Attachment'][_0x6ba2('0x6f')]);if(fs[_0x6ba2('0x70')](_0x28834c)){fs[_0x6ba2('0x71')](_0x28834c)[_0x6ba2('0x72')](fs[_0x6ba2('0x73')](path[_0x6ba2('0x56')](_0x458891,_0x2f11b2[_0x6ba2('0x5f')][_0x6ba2('0x6f')])));}}return{'date':moment(_0x2f11b2['createdAt'])[_0x6ba2('0x4c')](_0x6ba2('0x4d'))['toString'](),'sender':_0x2f11b2[_0x6ba2('0x74')]===_0x6ba2('0x75')?_0x2f11b2[_0x6ba2('0x5b')]?_0x2f11b2[_0x6ba2('0x5b')][_0x6ba2('0x64')]:_0x6ba2('0x76'):_0x2f11b2[_0x6ba2('0x5c')][_0x6ba2('0x5d')]+(_0x2f11b2[_0x6ba2('0x5c')][_0x6ba2('0x5e')]?'\x20'+_0x2f11b2[_0x6ba2('0x5c')][_0x6ba2('0x5e')]:''),'body':_0x2f11b2['Attachment']?_0x2f11b2[_0x6ba2('0x5f')][_0x6ba2('0x6f')]:_0x2f11b2['body'],'direction':_0x2f11b2[_0x6ba2('0x74')]===_0x6ba2('0x75')?'A':'C','secret':_0x2f11b2[_0x6ba2('0x77')],'read':_0x2f11b2[_0x6ba2('0x78')],'attachment':_0x2f11b2['Attachment']};})[_0x6ba2('0x79')]()};return ejs[_0x6ba2('0x7a')](path[_0x6ba2('0x56')](config[_0x6ba2('0x57')],_0x6ba2('0x58'),_0x6ba2('0x7b'),_0x6ba2('0x7c')),{'interaction':_0x151e62})[_0x6ba2('0x1c')](function(_0x14aeb7){var _0x3b425a=path['join'](_0x458891,_0x6ba2('0x7d')+_0x2c4418['id']+'-'+_0x233b2c+'.pdf');var _0x4fb4b5={'path':_0x3b425a,'channel':'Openchannel','interactionId':_0x2c4418['id']};return pdf[_0x6ba2('0x7e')](_0x14aeb7,_0x4fb4b5);})['then'](function(){return new Promise(function(_0xb8870f,_0x36074b){zipdir(_0x458891,{'saveTo':_0x4d66ee},function(_0x444b83,_0x376930){if(_0x444b83)return _0x36074b(_0x444b83);return _0xb8870f(_0x376930);});})[_0x6ba2('0x1c')](function(){return new Promise(function(_0x2fcbbc,_0x4b8f17){rimraf(_0x458891,function(_0x169a70){if(_0x169a70)_0x4b8f17(_0x169a70);return _0x2fcbbc();});});})[_0x6ba2('0x1c')](function(){return _0x31fda0[_0x6ba2('0x7f')](_0x4d66ee,_0x17de62,function(_0xa21248){if(_0xa21248){logger['error'](_0x6ba2('0x80'),_0xa21248);}else{fs['unlinkSync'](_0x4d66ee);}});});});}else{return _0x31fda0[_0x6ba2('0x11')](0xc8);}})['catch'](handleError(_0x31fda0,null));}; \ No newline at end of file +var _0x9f02=['join','files','tmp','root','server','attachments','format','transcript-%d-%s.zip','push','User','fullname','Contact','firstName','lastName','Attachment','Messages','direction','secret','read','OpenchannelAccount','Owner','mkdirSync','N.A.','toString','closedAt','disposition','Private','basename','existsSync','createReadStream','createWriteStream','createdAt','YYYY-MM-DD\x20HH:mm:ss','out','renderFile','views','downloadInteraction.ejs','transcript-','.pdf','Openchannel','createPdfFromHTML','Unable\x20to\x20delete\x20zip\x20file','sendStatus','rimraf','zip-dir','moment','util','path','ejs','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','status','end','offset','undefined','limit','count','set','Content-Range','json','update','destroy','then','error','stack','send','index','map','OpenchannelInteraction','rawAttributes','fieldName','type','key','getOptions','query','show','from','params','model','keys','filters','intersection','attributes','fields','length','merge','catch','create','body','find','describe','addMessage','OpenchannelMessage','omit','ids','getMessages','findOne','hasOwnProperty','nolimit','order','sort','pick','where','filter','$gte','options','includeAll','include','findAll','rows','addTags','setTags','Tag','name','color','openchannelInteractionTags:save','removeTags','download'];(function(_0x324d59,_0x2f67bc){var _0x468e7e=function(_0x510f1f){while(--_0x510f1f){_0x324d59['push'](_0x324d59['shift']());}};_0x468e7e(++_0x2f67bc);}(_0x9f02,0x129));var _0x29f0=function(_0x370673,_0x5c3cca){_0x370673=_0x370673-0x0;var _0x54995e=_0x9f02[_0x370673];return _0x54995e;};'use strict';var rimraf=require(_0x29f0('0x0'));var zipdir=require(_0x29f0('0x1'));var moment=require(_0x29f0('0x2'));var util=require(_0x29f0('0x3'));var path=require(_0x29f0('0x4'));var ejs=require(_0x29f0('0x5'));var fs=require('fs');var _=require(_0x29f0('0x6'));var Redis=require(_0x29f0('0x7'));var interaction=require(_0x29f0('0x8'));var qs=require(_0x29f0('0x9'));var pdf=require('../../components/export/pdf');var logger=require(_0x29f0('0xa'))(_0x29f0('0xb'));var config=require(_0x29f0('0xc'));var db=require(_0x29f0('0xd'))['db'];config[_0x29f0('0xe')]=_['defaults'](config[_0x29f0('0xe')],{'host':_0x29f0('0xf'),'port':0x18eb});var socket=require(_0x29f0('0x10'))(new Redis(config[_0x29f0('0xe')]));require('./openchannelInteraction.socket')['register'](socket);function respondWithStatusCode(_0x4213f8,_0x822ce9){_0x822ce9=_0x822ce9||0xcc;return function(_0x2c0a49){if(_0x2c0a49){return _0x4213f8['sendStatus'](_0x822ce9);}return _0x4213f8[_0x29f0('0x11')](_0x822ce9)[_0x29f0('0x12')]();};}function respondWithResult(_0x13830c,_0x4ebe34){_0x4ebe34=_0x4ebe34||0xc8;return function(_0x4ea84d){if(_0x4ea84d){return _0x13830c[_0x29f0('0x11')](_0x4ebe34)['json'](_0x4ea84d);}};}function respondWithFilteredResult(_0x17b2db,_0x36af2d){return function(_0xc7fd45){if(_0xc7fd45){var _0x1cfa31=typeof _0x36af2d[_0x29f0('0x13')]===_0x29f0('0x14')&&typeof _0x36af2d[_0x29f0('0x15')]===_0x29f0('0x14');var _0x3d01f8=_0xc7fd45[_0x29f0('0x16')];var _0x459a19=_0x1cfa31?0x0:_0x36af2d[_0x29f0('0x13')];var _0x4f7a4c=_0x1cfa31?_0xc7fd45['count']:_0x36af2d['offset']+_0x36af2d[_0x29f0('0x15')];var _0x5601e6;if(_0x4f7a4c>=_0x3d01f8){_0x4f7a4c=_0x3d01f8;_0x5601e6=0xc8;}else{_0x5601e6=0xce;}_0x17b2db['status'](_0x5601e6);return _0x17b2db[_0x29f0('0x17')](_0x29f0('0x18'),_0x459a19+'-'+_0x4f7a4c+'/'+_0x3d01f8)[_0x29f0('0x19')](_0xc7fd45);}return null;};}function saveUpdates(_0x491403){return function(_0x3937cd){if(_0x3937cd){return _0x3937cd[_0x29f0('0x1a')](_0x491403)['then'](function(_0x45e22d){return _0x45e22d;});}return null;};}function removeEntity(_0x1be6ac){return function(_0x1eb35e){if(_0x1eb35e){return _0x1eb35e[_0x29f0('0x1b')]()[_0x29f0('0x1c')](function(){_0x1be6ac[_0x29f0('0x11')](0xcc)[_0x29f0('0x12')]();});}};}function handleEntityNotFound(_0x4150f5){return function(_0x42e95c){if(!_0x42e95c){_0x4150f5['sendStatus'](0x194);}return _0x42e95c;};}function handleError(_0xe9f0a1,_0xe23aea){_0xe23aea=_0xe23aea||0x1f4;return function(_0x51bb4a){logger[_0x29f0('0x1d')](_0x51bb4a[_0x29f0('0x1e')]);if(_0x51bb4a['name']){delete _0x51bb4a['name'];}_0xe9f0a1[_0x29f0('0x11')](_0xe23aea)[_0x29f0('0x1f')](_0x51bb4a);};}exports[_0x29f0('0x20')]=function(_0x57ccb6,_0x7b6fb9){var _0x5890a2={};var _0x9b364f=_[_0x29f0('0x21')](db[_0x29f0('0x22')][_0x29f0('0x23')],function(_0x30f0e7){return{'name':_0x30f0e7[_0x29f0('0x24')],'type':_0x30f0e7[_0x29f0('0x25')][_0x29f0('0x26')]};});_0x5890a2=qs[_0x29f0('0x27')](_0x9b364f,_0x57ccb6);return interaction['findAll']('openchannel',_0x57ccb6[_0x29f0('0x28')],_0x57ccb6['user'],_0x5890a2,_0x9b364f)[_0x29f0('0x1c')](respondWithFilteredResult(_0x7b6fb9,_0x5890a2))['catch'](handleError(_0x7b6fb9,null));};exports[_0x29f0('0x29')]=function(_0x226d8c,_0xef0954){var _0x37c614={};if(_0x226d8c[_0x29f0('0x28')][_0x29f0('0x25')]&&_0x226d8c[_0x29f0('0x28')]['type']===_0x29f0('0x2a')){_0x37c614['from']=_0x226d8c['params']['id'];}else{_0x37c614['id']=_0x226d8c[_0x29f0('0x2b')]['id'];}var _0x497262={'raw':![],'where':_0x37c614},_0x450b52={};_0x450b52[_0x29f0('0x2c')]=_[_0x29f0('0x2d')](db[_0x29f0('0x22')][_0x29f0('0x23')]);_0x450b52[_0x29f0('0x28')]=_[_0x29f0('0x2d')](_0x226d8c[_0x29f0('0x28')]);_0x450b52[_0x29f0('0x2e')]=_[_0x29f0('0x2f')](_0x450b52[_0x29f0('0x2c')],_0x450b52[_0x29f0('0x28')]);_0x497262[_0x29f0('0x30')]=_[_0x29f0('0x2f')](_0x450b52[_0x29f0('0x2c')],qs[_0x29f0('0x31')](_0x226d8c[_0x29f0('0x28')]['fields']));_0x497262[_0x29f0('0x30')]=_0x497262[_0x29f0('0x30')][_0x29f0('0x32')]?_0x497262['attributes']:_0x450b52['model'];if(_0x226d8c[_0x29f0('0x28')]['includeAll']){_0x497262['include']=[{'all':!![]}];}_0x497262=_[_0x29f0('0x33')]({},_0x497262,_0x226d8c['options']);return db[_0x29f0('0x22')]['find'](_0x497262)['then'](handleEntityNotFound(_0xef0954,null))[_0x29f0('0x1c')](respondWithResult(_0xef0954,null))[_0x29f0('0x34')](handleError(_0xef0954,null));};exports[_0x29f0('0x35')]=function(_0x5a56de,_0x25dee7){return db[_0x29f0('0x22')][_0x29f0('0x35')](_0x5a56de[_0x29f0('0x36')],{})['then'](respondWithResult(_0x25dee7,0xc9))[_0x29f0('0x34')](handleError(_0x25dee7,null));};exports[_0x29f0('0x1a')]=function(_0x1f98b1,_0x542a34){if(_0x1f98b1['body']['id']){delete _0x1f98b1['body']['id'];}return db[_0x29f0('0x22')][_0x29f0('0x37')]({'where':{'id':_0x1f98b1[_0x29f0('0x2b')]['id']}})['then'](handleEntityNotFound(_0x542a34,null))[_0x29f0('0x1c')](saveUpdates(_0x1f98b1[_0x29f0('0x36')],null))[_0x29f0('0x1c')](respondWithResult(_0x542a34,null))[_0x29f0('0x34')](handleError(_0x542a34,null));};exports[_0x29f0('0x1b')]=function(_0x29f88a,_0x3abc25){return db[_0x29f0('0x22')][_0x29f0('0x37')]({'where':{'id':_0x29f88a[_0x29f0('0x2b')]['id']}})[_0x29f0('0x1c')](handleEntityNotFound(_0x3abc25,null))[_0x29f0('0x1c')](removeEntity(_0x3abc25,null))[_0x29f0('0x34')](handleError(_0x3abc25,null));};exports[_0x29f0('0x38')]=function(_0x3b2178,_0xea1af2){return db['OpenchannelInteraction']['describe']()[_0x29f0('0x1c')](respondWithResult(_0xea1af2,null))[_0x29f0('0x34')](handleError(_0xea1af2,null));};exports[_0x29f0('0x39')]=function(_0x48f085,_0x261b32){return db[_0x29f0('0x3a')][_0x29f0('0x37')]({'where':{'id':_0x48f085[_0x29f0('0x2b')]['id']}})[_0x29f0('0x1c')](handleEntityNotFound(_0x261b32,null))[_0x29f0('0x1c')](function(_0x5d0330){if(_0x5d0330){return _0x5d0330[_0x29f0('0x39')](_0x48f085['body']['ids'],_[_0x29f0('0x3b')](_0x48f085['body'],[_0x29f0('0x3c'),'id'])||{});}})[_0x29f0('0x1c')](respondWithResult(_0x261b32,null))['catch'](handleError(_0x261b32,null));};exports[_0x29f0('0x3d')]=function(_0x4bd2cb,_0x48a308){var _0x3d0663={'raw':![],'where':{}};var _0x55b9c7={};var _0x5daf35={'count':0x0,'rows':[]};return db['OpenchannelInteraction'][_0x29f0('0x3e')]({'where':{'id':_0x4bd2cb[_0x29f0('0x2b')]['id']}})[_0x29f0('0x1c')](handleEntityNotFound(_0x48a308,null))['then'](function(_0x1e005a){if(_0x1e005a){_0x55b9c7[_0x29f0('0x2c')]=_[_0x29f0('0x2d')](db['OpenchannelMessage'][_0x29f0('0x23')]);_0x55b9c7[_0x29f0('0x28')]=_[_0x29f0('0x2d')](_0x4bd2cb[_0x29f0('0x28')]);_0x55b9c7[_0x29f0('0x2e')]=_[_0x29f0('0x2f')](_0x55b9c7[_0x29f0('0x2c')],_0x55b9c7['query']);_0x3d0663[_0x29f0('0x30')]=_[_0x29f0('0x2f')](_0x55b9c7['model'],qs[_0x29f0('0x31')](_0x4bd2cb[_0x29f0('0x28')][_0x29f0('0x31')]));_0x3d0663['attributes']=_0x3d0663[_0x29f0('0x30')][_0x29f0('0x32')]?_0x3d0663[_0x29f0('0x30')]:_0x55b9c7[_0x29f0('0x2c')];if(!_0x4bd2cb[_0x29f0('0x28')][_0x29f0('0x3f')](_0x29f0('0x40'))){_0x3d0663[_0x29f0('0x15')]=qs['limit'](_0x4bd2cb[_0x29f0('0x28')][_0x29f0('0x15')]);_0x3d0663['offset']=qs['offset'](_0x4bd2cb[_0x29f0('0x28')][_0x29f0('0x13')]);}_0x3d0663[_0x29f0('0x41')]=qs[_0x29f0('0x42')](_0x4bd2cb[_0x29f0('0x28')][_0x29f0('0x42')]);_0x3d0663['where']=qs[_0x29f0('0x2e')](_[_0x29f0('0x43')](_0x4bd2cb[_0x29f0('0x28')],_0x55b9c7['filters']));_0x3d0663[_0x29f0('0x44')]['OpenchannelInteractionId']=_0x1e005a['id'];if(_0x4bd2cb[_0x29f0('0x28')][_0x29f0('0x45')]){_0x3d0663[_0x29f0('0x44')]=_['merge'](_0x3d0663[_0x29f0('0x44')],{'$or':_[_0x29f0('0x21')](_0x3d0663[_0x29f0('0x30')],function(_0x514b02){var _0x2b4a8c={};_0x2b4a8c[_0x514b02]={'$like':'%'+_0x4bd2cb[_0x29f0('0x28')]['filter']+'%'};return _0x2b4a8c;})});}if(_0x4bd2cb['query']['$gte']){var _0x3292e6=_0x4bd2cb[_0x29f0('0x28')][_0x29f0('0x46')]['split'](',');var _0x5c6345={};_0x5c6345[_0x3292e6[0x0]]={'$gte':moment(_0x3292e6[0x1])['format']('YYYY-MM-DD\x20HH:mm:ss')};_0x3d0663['where']=_[_0x29f0('0x33')](_0x3d0663[_0x29f0('0x44')],_0x5c6345);}_0x3d0663=_[_0x29f0('0x33')]({},_0x3d0663,_0x4bd2cb[_0x29f0('0x47')]);return db['OpenchannelMessage']['count']({'where':_0x3d0663[_0x29f0('0x44')]})['then'](function(_0x5c57b0){_0x5daf35[_0x29f0('0x16')]=_0x5c57b0;if(_0x4bd2cb[_0x29f0('0x28')][_0x29f0('0x48')]){_0x3d0663[_0x29f0('0x49')]=[{'all':!![]}];}return db[_0x29f0('0x3a')][_0x29f0('0x4a')](_0x3d0663);})[_0x29f0('0x1c')](function(_0x5a21e8){_0x5daf35[_0x29f0('0x4b')]=_0x5a21e8;return _0x5daf35;});}})[_0x29f0('0x1c')](respondWithFilteredResult(_0x48a308,_0x3d0663))['catch'](handleError(_0x48a308,null));};exports[_0x29f0('0x4c')]=function(_0xc07dbf,_0x2b4f65){return db[_0x29f0('0x22')][_0x29f0('0x37')]({'where':{'id':_0xc07dbf[_0x29f0('0x2b')]['id']}})[_0x29f0('0x1c')](handleEntityNotFound(_0x2b4f65,null))[_0x29f0('0x1c')](function(_0x16872d){if(_0x16872d){return _0x16872d[_0x29f0('0x4d')](_0xc07dbf['body']['ids'],_[_0x29f0('0x3b')](_0xc07dbf[_0x29f0('0x36')],[_0x29f0('0x3c'),'id'])||{})['spread'](function(){return db[_0x29f0('0x4e')]['findAll']({'attributes':['id',_0x29f0('0x4f'),_0x29f0('0x50')],'where':{'id':_0xc07dbf[_0x29f0('0x36')]['ids']}});})[_0x29f0('0x1c')](function(_0x56e91a){socket['emit'](_0x29f0('0x51'),{'id':Number(_0xc07dbf[_0x29f0('0x2b')]['id']),'tags':_0x56e91a||[]});return{'id':Number(_0xc07dbf[_0x29f0('0x2b')]['id']),'tags':_0x56e91a||[]};});}})['then'](respondWithResult(_0x2b4f65,null))['catch'](handleError(_0x2b4f65,null));};exports[_0x29f0('0x52')]=function(_0x38a3b4,_0xda31db){return db[_0x29f0('0x22')][_0x29f0('0x37')]({'where':{'id':_0x38a3b4[_0x29f0('0x2b')]['id']}})[_0x29f0('0x1c')](handleEntityNotFound(_0xda31db,null))[_0x29f0('0x1c')](function(_0x21ab2f){if(_0x21ab2f){return _0x21ab2f[_0x29f0('0x52')](_0x38a3b4['query'][_0x29f0('0x3c')]);}})[_0x29f0('0x1c')](respondWithStatusCode(_0xda31db,null))[_0x29f0('0x34')](handleError(_0xda31db,null));};exports[_0x29f0('0x53')]=function(_0x58666d,_0xb22cfe){var _0x3a5de8=moment()['unix']()['toString']();var _0x53e1c0=path[_0x29f0('0x54')](config['root'],'server',_0x29f0('0x55'),_0x29f0('0x56'));var _0x807a3c=path['join'](config[_0x29f0('0x57')],_0x29f0('0x58'),_0x29f0('0x55'),_0x29f0('0x59'));var _0x70ccbc=path[_0x29f0('0x54')](_0x53e1c0,_0x3a5de8);var _0x3b47e7=util[_0x29f0('0x5a')](_0x29f0('0x5b'),_0x58666d[_0x29f0('0x2b')]['id'],_0x3a5de8);var _0x100d87=path[_0x29f0('0x54')](_0x53e1c0,_0x3b47e7);var _0x2d0648=[];_0x2d0648[_0x29f0('0x5c')]({'model':db[_0x29f0('0x5d')],'as':_0x29f0('0x5d'),'attributes':['id',_0x29f0('0x5e')],'raw':!![]});_0x2d0648[_0x29f0('0x5c')]({'model':db['CmContact'],'as':_0x29f0('0x5f'),'attributes':['id',_0x29f0('0x60'),_0x29f0('0x61')],'raw':!![]});if(_0x58666d[_0x29f0('0x28')][_0x29f0('0x59')]){_0x2d0648[_0x29f0('0x5c')]({'model':db[_0x29f0('0x62')],'as':_0x29f0('0x62'),'raw':!![]});}var _0x5bf67c=[{'model':db['OpenchannelMessage'],'as':_0x29f0('0x63'),'attributes':['id',_0x29f0('0x36'),'createdAt',_0x29f0('0x64'),_0x29f0('0x65'),_0x29f0('0x66')],'include':_0x2d0648}];_0x5bf67c[_0x29f0('0x5c')]({'model':db[_0x29f0('0x67')],'as':'Account','attributes':['id',_0x29f0('0x4f')]});_0x5bf67c['push']({'model':db['User'],'as':_0x29f0('0x68'),'attributes':['id',_0x29f0('0x5e')]});return db['OpenchannelInteraction'][_0x29f0('0x37')]({'where':{'id':_0x58666d[_0x29f0('0x2b')]['id']},'include':_0x5bf67c})[_0x29f0('0x1c')](handleEntityNotFound(_0xb22cfe,null))[_0x29f0('0x1c')](function(_0x27e702){if(_0x27e702){var _0x1ca61a=_0x27e702['get']({'plain':!![]});fs[_0x29f0('0x69')](_0x70ccbc);var _0x2c9cc4={'channel':'Openchannel','account':_0x1ca61a['Account'][_0x29f0('0x4f')],'agent':_0x1ca61a['Owner']?_0x1ca61a['Owner'][_0x29f0('0x5e')]:_0x29f0('0x6a'),'createdAt':moment(_0x1ca61a['createdAt'])[_0x29f0('0x5a')]('YYYY-MM-DD\x20HH:mm:ss')[_0x29f0('0x6b')](),'closedAt':_0x1ca61a['closed']?moment(_0x1ca61a[_0x29f0('0x6c')])['format']('YYYY-MM-DD\x20HH:mm:ss')[_0x29f0('0x6b')]():'','disposition':_0x1ca61a[_0x29f0('0x6d')],'visibility':_0x1ca61a['threadId']?'Public':_0x29f0('0x6e'),'messages':_(_0x1ca61a[_0x29f0('0x63')])[_0x29f0('0x45')]({'secret':![]})[_0x29f0('0x21')](function(_0x200821){if(_0x200821[_0x29f0('0x62')]){var _0x16c070=path[_0x29f0('0x54')](_0x807a3c,_0x200821[_0x29f0('0x62')][_0x29f0('0x6f')]);if(fs[_0x29f0('0x70')](_0x16c070)){fs[_0x29f0('0x71')](_0x16c070)['pipe'](fs[_0x29f0('0x72')](path['join'](_0x70ccbc,_0x200821[_0x29f0('0x62')][_0x29f0('0x6f')])));}}return{'date':moment(_0x200821[_0x29f0('0x73')])[_0x29f0('0x5a')](_0x29f0('0x74'))[_0x29f0('0x6b')](),'sender':_0x200821[_0x29f0('0x64')]==='out'?_0x200821[_0x29f0('0x5d')]?_0x200821[_0x29f0('0x5d')][_0x29f0('0x5e')]:'System':_0x200821[_0x29f0('0x5f')]['firstName']+(_0x200821[_0x29f0('0x5f')]['lastName']?'\x20'+_0x200821['Contact']['lastName']:''),'body':_0x200821[_0x29f0('0x62')]?_0x200821['Attachment'][_0x29f0('0x6f')]:_0x200821[_0x29f0('0x36')],'direction':_0x200821[_0x29f0('0x64')]===_0x29f0('0x75')?'A':'C','secret':_0x200821['secret'],'read':_0x200821[_0x29f0('0x66')],'attachment':_0x200821[_0x29f0('0x62')]};})['value']()};return ejs[_0x29f0('0x76')](path[_0x29f0('0x54')](config['root'],'server',_0x29f0('0x77'),_0x29f0('0x78')),{'interaction':_0x2c9cc4})[_0x29f0('0x1c')](function(_0x182d06){var _0x3969ff=path['join'](_0x70ccbc,_0x29f0('0x79')+_0x1ca61a['id']+'-'+_0x3a5de8+_0x29f0('0x7a'));var _0x42120f={'path':_0x3969ff,'channel':_0x29f0('0x7b'),'interactionId':_0x1ca61a['id']};return pdf[_0x29f0('0x7c')](_0x182d06,_0x42120f);})['then'](function(){return new Promise(function(_0x11ff06,_0x53b946){zipdir(_0x70ccbc,{'saveTo':_0x100d87},function(_0x3ae781,_0x93b43f){if(_0x3ae781)return _0x53b946(_0x3ae781);return _0x11ff06(_0x93b43f);});})['then'](function(){return new Promise(function(_0x2c8ae5,_0x4e9901){rimraf(_0x70ccbc,function(_0x167e58){if(_0x167e58)_0x4e9901(_0x167e58);return _0x2c8ae5();});});})[_0x29f0('0x1c')](function(){return _0xb22cfe[_0x29f0('0x53')](_0x100d87,_0x3b47e7,function(_0xe59c5f){if(_0xe59c5f){logger[_0x29f0('0x1d')](_0x29f0('0x7d'),_0xe59c5f);}else{fs['unlinkSync'](_0x100d87);}});});});}else{return _0xb22cfe[_0x29f0('0x7e')](0xc8);}})['catch'](handleError(_0xb22cfe,null));}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.events.js b/server/api/openchannelInteraction/openchannelInteraction.events.js index 37e5239..bc25f00 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 _0xc463=['findAll','emit','catch','hasOwnProperty','hook','exports','events','../../mysqldb','OpenchannelInteraction','OpenchannelMessage','save','update','remove','getUsers','then','setDataValue','Users','map'];(function(_0x56916d,_0x37b935){var _0x2b7f1f=function(_0x206eb1){while(--_0x206eb1){_0x56916d['push'](_0x56916d['shift']());}};_0x2b7f1f(++_0x37b935);}(_0xc463,0xba));var _0x3c46=function(_0x4e5e92,_0x4e657e){_0x4e5e92=_0x4e5e92-0x0;var _0x486c68=_0xc463[_0x4e5e92];return _0x486c68;};'use strict';var EventEmitter=require(_0x3c46('0x0'));var OpenchannelInteraction=require(_0x3c46('0x1'))['db'][_0x3c46('0x2')];var OpenchannelMessage=require(_0x3c46('0x1'))['db'][_0x3c46('0x3')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x3c46('0x4'),'afterUpdate':_0x3c46('0x5'),'afterDestroy':_0x3c46('0x6')};function emitEvent(_0xad1fc8){return function(_0x566789,_0x58dd61,_0x267046){_0x566789[_0x3c46('0x7')]({'attributes':['id'],'raw':!![]})[_0x3c46('0x8')](function(_0x334ac8){_0x566789[_0x3c46('0x9')](_0x3c46('0xa'),_0x334ac8[_0x3c46('0xb')](function(_0x5f3886){return{'id':_0x5f3886['id']};}));return OpenchannelMessage[_0x3c46('0xc')]({'where':{'OpenchannelInteractionId':_0x566789['id'],'direction':'in','read':![]},'raw':!![]});})[_0x3c46('0x8')](function(_0x934d2f){_0x566789[_0x3c46('0x9')]('unreadMessages',_0x934d2f['length']);OpenchannelInteractionEvents['emit'](_0xad1fc8+':'+_0x566789['id'],_0x566789);OpenchannelInteractionEvents[_0x3c46('0xd')](_0xad1fc8,_0x566789);_0x267046(null);})[_0x3c46('0xe')](_0x267046(null));};}for(var e in events){if(events[_0x3c46('0xf')](e)){var event=events[e];OpenchannelInteraction[_0x3c46('0x10')](e,emitEvent(event));}}module[_0x3c46('0x11')]=OpenchannelInteractionEvents; \ No newline at end of file +var _0xf25b=['then','setDataValue','map','unreadMessages','length','emit','catch','hasOwnProperty','hook','exports','events','OpenchannelInteraction','../../mysqldb','OpenchannelMessage','setMaxListeners','save','update','getUsers'];(function(_0x149eb7,_0x11536f){var _0x11cf29=function(_0x40b944){while(--_0x40b944){_0x149eb7['push'](_0x149eb7['shift']());}};_0x11cf29(++_0x11536f);}(_0xf25b,0x184));var _0xbf25=function(_0x5efc44,_0x263bd7){_0x5efc44=_0x5efc44-0x0;var _0x2c857a=_0xf25b[_0x5efc44];return _0x2c857a;};'use strict';var EventEmitter=require(_0xbf25('0x0'));var OpenchannelInteraction=require('../../mysqldb')['db'][_0xbf25('0x1')];var OpenchannelMessage=require(_0xbf25('0x2'))['db'][_0xbf25('0x3')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0xbf25('0x4')](0x0);var events={'afterCreate':_0xbf25('0x5'),'afterUpdate':_0xbf25('0x6'),'afterDestroy':'remove'};function emitEvent(_0xd12881){return function(_0x23419c,_0x5281f9,_0x398a7b){_0x23419c[_0xbf25('0x7')]({'attributes':['id'],'raw':!![]})[_0xbf25('0x8')](function(_0x33abba){_0x23419c[_0xbf25('0x9')]('Users',_0x33abba[_0xbf25('0xa')](function(_0x2caf82){return{'id':_0x2caf82['id']};}));return OpenchannelMessage['findAll']({'where':{'OpenchannelInteractionId':_0x23419c['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x1e65d0){_0x23419c[_0xbf25('0x9')](_0xbf25('0xb'),_0x1e65d0[_0xbf25('0xc')]);OpenchannelInteractionEvents['emit'](_0xd12881+':'+_0x23419c['id'],_0x23419c);OpenchannelInteractionEvents[_0xbf25('0xd')](_0xd12881,_0x23419c);_0x398a7b(null);})[_0xbf25('0xe')](_0x398a7b(null));};}for(var e in events){if(events[_0xbf25('0xf')](e)){var event=events[e];OpenchannelInteraction[_0xbf25('0x10')](e,emitEvent(event));}}module[_0xbf25('0x11')]=OpenchannelInteractionEvents; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.model.js b/server/api/openchannelInteraction/openchannelInteraction.model.js index fdb679f..11dad3f 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 _0x8f61=['./openchannelInteraction.attributes','exports','define','OpenchannelInteraction','openchannel_interactions','utf8mb4','utf8mb4_unicode_ci','changed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment'];(function(_0xcd5721,_0x112284){var _0x46e84a=function(_0x1b82ac){while(--_0x1b82ac){_0xcd5721['push'](_0xcd5721['shift']());}};_0x46e84a(++_0x112284);}(_0x8f61,0x13b));var _0x18f6=function(_0x194058,_0x5c6092){_0x194058=_0x194058-0x0;var _0x2c76a1=_0x8f61[_0x194058];return _0x2c76a1;};'use strict';var _=require('lodash');var util=require(_0x18f6('0x0'));var logger=require(_0x18f6('0x1'))(_0x18f6('0x2'));var moment=require(_0x18f6('0x3'));var BPromise=require(_0x18f6('0x4'));var rp=require(_0x18f6('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x18f6('0x6'));var config=require(_0x18f6('0x7'));var attributes=require(_0x18f6('0x8'));module[_0x18f6('0x9')]=function(_0x4f838c,_0x3c14d3){return _0x4f838c[_0x18f6('0xa')](_0x18f6('0xb'),attributes,{'tableName':_0x18f6('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x18f6('0xd'),'collate':_0x18f6('0xe'),'hooks':{'beforeUpdate':function(_0x2e92ac,_0x54b78f,_0x5d3bff){if(_0x2e92ac[_0x18f6('0xf')]('closed')){_0x2e92ac[_0x18f6('0x10')]=moment()[_0x18f6('0x11')](_0x18f6('0x12'));}_0x5d3bff(null,_0x2e92ac);}}});}; \ No newline at end of file +var _0x7fcb=['api','moment','bluebird','../../config/environment','./openchannelInteraction.attributes','exports','define','OpenchannelInteraction','openchannel_interactions','utf8mb4','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger'];(function(_0xa87ba9,_0x235dc4){var _0x100167=function(_0x463a76){while(--_0x463a76){_0xa87ba9['push'](_0xa87ba9['shift']());}};_0x100167(++_0x235dc4);}(_0x7fcb,0xd5));var _0xb7fc=function(_0x42e7ce,_0x375d2e){_0x42e7ce=_0x42e7ce-0x0;var _0x3d5428=_0x7fcb[_0x42e7ce];return _0x3d5428;};'use strict';var _=require(_0xb7fc('0x0'));var util=require(_0xb7fc('0x1'));var logger=require(_0xb7fc('0x2'))(_0xb7fc('0x3'));var moment=require(_0xb7fc('0x4'));var BPromise=require(_0xb7fc('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xb7fc('0x6'));var attributes=require(_0xb7fc('0x7'));module[_0xb7fc('0x8')]=function(_0x1cb6c1,_0x34c0ee){return _0x1cb6c1[_0xb7fc('0x9')](_0xb7fc('0xa'),attributes,{'tableName':_0xb7fc('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xb7fc('0xc'),'collate':'utf8mb4_unicode_ci','hooks':{'beforeUpdate':function(_0x1abbda,_0x128325,_0x43506e){if(_0x1abbda[_0xb7fc('0xd')](_0xb7fc('0xe'))){_0x1abbda[_0xb7fc('0xf')]=moment()[_0xb7fc('0x10')](_0xb7fc('0x11'));}_0x43506e(null,_0x1abbda);}}});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.rpc.js b/server/api/openchannelInteraction/openchannelInteraction.rpc.js index 7288da5..c17d192 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 _0x18fa=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','defaults','socket.io-emitter','./openchannelInteraction.socket','register','request','then','info','OpenchannelInteraction,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','catch','UpdateOpenchannelInteraction','OpenchannelInteraction','body','options','raw','where','attributes','find','addTags','omit','ids','spread','AddTags','lodash','util'];(function(_0x5f3f88,_0x562baf){var _0xd08119=function(_0x42dbf7){while(--_0x42dbf7){_0x5f3f88['push'](_0x5f3f88['shift']());}};_0xd08119(++_0x562baf);}(_0x18fa,0x9a));var _0xa18f=function(_0x1e2ffc,_0x4b608e){_0x1e2ffc=_0x1e2ffc-0x0;var _0x327df6=_0x18fa[_0x1e2ffc];return _0x327df6;};'use strict';var _=require(_0xa18f('0x0'));var util=require(_0xa18f('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xa18f('0x2'));var fs=require('fs');var Redis=require(_0xa18f('0x3'));var db=require(_0xa18f('0x4'))['db'];var utils=require(_0xa18f('0x5'));var logger=require(_0xa18f('0x6'))('rpc');var config=require(_0xa18f('0x7'));var jayson=require(_0xa18f('0x8'));var client=jayson[_0xa18f('0x9')][_0xa18f('0xa')]({'port':0x232a});config['redis']=_[_0xa18f('0xb')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xa18f('0xc'))(new Redis(config['redis']));require(_0xa18f('0xd'))[_0xa18f('0xe')](socket);function respondWithRpcPromise(_0x4f14d0,_0x4c6083,_0x2e550a){return new BPromise(function(_0x3f74bd,_0x56f10a){return client[_0xa18f('0xf')](_0x4f14d0,_0x2e550a)[_0xa18f('0x10')](function(_0x37776c){logger[_0xa18f('0x11')](_0xa18f('0x12'),_0x4c6083,'request\x20sent');logger[_0xa18f('0x13')]('OpenchannelInteraction,\x20%s,\x20%s,\x20%s',_0x4c6083,'request\x20sent',JSON[_0xa18f('0x14')](_0x37776c));if(_0x37776c[_0xa18f('0x15')]){if(_0x37776c[_0xa18f('0x15')][_0xa18f('0x16')]===0x1f4){logger['error']('OpenchannelInteraction,\x20%s,\x20%s',_0x4c6083,_0x37776c[_0xa18f('0x15')][_0xa18f('0x17')]);return _0x56f10a(_0x37776c[_0xa18f('0x15')][_0xa18f('0x17')]);}logger[_0xa18f('0x15')](_0xa18f('0x12'),_0x4c6083,_0x37776c['error'][_0xa18f('0x17')]);return _0x3f74bd(_0x37776c['error'][_0xa18f('0x17')]);}else{logger[_0xa18f('0x11')](_0xa18f('0x12'),_0x4c6083,_0xa18f('0x18'));_0x3f74bd(_0x37776c['result']['message']);}})[_0xa18f('0x19')](function(_0x50184e){logger[_0xa18f('0x15')](_0xa18f('0x12'),_0x4c6083,_0x50184e);_0x56f10a(_0x50184e);});});}exports[_0xa18f('0x1a')]=function(_0x23d18a){var _0x22689b=this;return new Promise(function(_0x52b7e6,_0x45c22b){return db[_0xa18f('0x1b')]['update'](_0x23d18a[_0xa18f('0x1c')],{'raw':_0x23d18a[_0xa18f('0x1d')]?_0x23d18a[_0xa18f('0x1d')][_0xa18f('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x23d18a[_0xa18f('0x1d')]?_0x23d18a[_0xa18f('0x1d')][_0xa18f('0x1f')]||null:null,'attributes':_0x23d18a['options']?_0x23d18a['options'][_0xa18f('0x20')]||null:null,'limit':_0x23d18a[_0xa18f('0x1d')]?_0x23d18a['options']['limit']||null:null})['then'](function(_0x260900){logger[_0xa18f('0x11')](_0xa18f('0x1a'),_0x23d18a);logger[_0xa18f('0x13')](_0xa18f('0x1a'),_0x23d18a,JSON['stringify'](_0x260900));_0x52b7e6(_0x260900);})[_0xa18f('0x19')](function(_0x2668be){logger[_0xa18f('0x15')](_0xa18f('0x1a'),_0x2668be[_0xa18f('0x17')],_0x23d18a);_0x45c22b(_0x22689b[_0xa18f('0x15')](0x1f4,_0x2668be[_0xa18f('0x17')]));});});};exports['AddTagsToOpenchannelInteraction']=function(_0x4c480b){return new Promise(function(_0x39d9f0,_0x597e03){return db[_0xa18f('0x1b')][_0xa18f('0x21')]({'where':_0x4c480b['options']?_0x4c480b['options'][_0xa18f('0x1f')]||null:null})[_0xa18f('0x10')](function(_0x2b786b){if(_0x2b786b){return _0x2b786b[_0xa18f('0x22')](_0x4c480b[_0xa18f('0x1c')]['ids'],_[_0xa18f('0x23')](_0x4c480b[_0xa18f('0x1c')],[_0xa18f('0x24'),'id'])||{});}})[_0xa18f('0x25')](function(_0x4bcec1){logger['info'](_0xa18f('0x26'),_0x4c480b);logger[_0xa18f('0x13')](_0xa18f('0x26'),_0x4c480b,JSON[_0xa18f('0x14')](_0x4bcec1));_0x39d9f0(_0x4bcec1);})[_0xa18f('0x19')](function(_0x593ece){logger[_0xa18f('0x15')](_0xa18f('0x26'),_0x593ece[_0xa18f('0x17')],_0x4c480b);_0x597e03(_this[_0xa18f('0x15')](0x1f4,_0x593ece[_0xa18f('0x17')]));});});}; \ No newline at end of file +var _0x7855=['debug','stringify','error','code','message','result','catch','UpdateOpenchannelInteraction','OpenchannelInteraction','body','options','raw','find','where','addTags','ids','omit','spread','AddTags','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./openchannelInteraction.socket','register','then','info','OpenchannelInteraction,\x20%s,\x20%s','request\x20sent'];(function(_0x206de9,_0x5a909f){var _0x5e9fe2=function(_0x475b41){while(--_0x475b41){_0x206de9['push'](_0x206de9['shift']());}};_0x5e9fe2(++_0x5a909f);}(_0x7855,0x1c0));var _0x5785=function(_0x31065c,_0x3c6bdf){_0x31065c=_0x31065c-0x0;var _0xfee4a=_0x7855[_0x31065c];return _0xfee4a;};'use strict';var _=require('lodash');var util=require(_0x5785('0x0'));var moment=require(_0x5785('0x1'));var BPromise=require(_0x5785('0x2'));var rs=require(_0x5785('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5785('0x4'))['db'];var utils=require(_0x5785('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x5785('0x6'));var jayson=require(_0x5785('0x7'));var client=jayson[_0x5785('0x8')][_0x5785('0x9')]({'port':0x232a});config[_0x5785('0xa')]=_[_0x5785('0xb')](config[_0x5785('0xa')],{'host':_0x5785('0xc'),'port':0x18eb});var socket=require(_0x5785('0xd'))(new Redis(config[_0x5785('0xa')]));require(_0x5785('0xe'))[_0x5785('0xf')](socket);function respondWithRpcPromise(_0x29dce6,_0x142758,_0x275f99){return new BPromise(function(_0x58f850,_0x27a56b){return client['request'](_0x29dce6,_0x275f99)[_0x5785('0x10')](function(_0x2ad1cd){logger[_0x5785('0x11')](_0x5785('0x12'),_0x142758,_0x5785('0x13'));logger[_0x5785('0x14')]('OpenchannelInteraction,\x20%s,\x20%s,\x20%s',_0x142758,_0x5785('0x13'),JSON[_0x5785('0x15')](_0x2ad1cd));if(_0x2ad1cd[_0x5785('0x16')]){if(_0x2ad1cd['error'][_0x5785('0x17')]===0x1f4){logger[_0x5785('0x16')](_0x5785('0x12'),_0x142758,_0x2ad1cd[_0x5785('0x16')][_0x5785('0x18')]);return _0x27a56b(_0x2ad1cd['error'][_0x5785('0x18')]);}logger[_0x5785('0x16')](_0x5785('0x12'),_0x142758,_0x2ad1cd[_0x5785('0x16')][_0x5785('0x18')]);return _0x58f850(_0x2ad1cd[_0x5785('0x16')][_0x5785('0x18')]);}else{logger[_0x5785('0x11')](_0x5785('0x12'),_0x142758,_0x5785('0x13'));_0x58f850(_0x2ad1cd[_0x5785('0x19')][_0x5785('0x18')]);}})[_0x5785('0x1a')](function(_0x43a264){logger['error'](_0x5785('0x12'),_0x142758,_0x43a264);_0x27a56b(_0x43a264);});});}exports[_0x5785('0x1b')]=function(_0x691f1c){var _0x234185=this;return new Promise(function(_0x1f660c,_0xec16fc){return db[_0x5785('0x1c')]['update'](_0x691f1c[_0x5785('0x1d')],{'raw':_0x691f1c[_0x5785('0x1e')]?_0x691f1c[_0x5785('0x1e')][_0x5785('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x691f1c[_0x5785('0x1e')]?_0x691f1c['options']['where']||null:null,'attributes':_0x691f1c[_0x5785('0x1e')]?_0x691f1c[_0x5785('0x1e')]['attributes']||null:null,'limit':_0x691f1c['options']?_0x691f1c[_0x5785('0x1e')]['limit']||null:null})[_0x5785('0x10')](function(_0x1a36c6){logger[_0x5785('0x11')](_0x5785('0x1b'),_0x691f1c);logger[_0x5785('0x14')](_0x5785('0x1b'),_0x691f1c,JSON['stringify'](_0x1a36c6));_0x1f660c(_0x1a36c6);})[_0x5785('0x1a')](function(_0x16ec74){logger[_0x5785('0x16')](_0x5785('0x1b'),_0x16ec74['message'],_0x691f1c);_0xec16fc(_0x234185[_0x5785('0x16')](0x1f4,_0x16ec74['message']));});});};exports['AddTagsToOpenchannelInteraction']=function(_0x1eee26){return new Promise(function(_0x51601f,_0x5ef830){return db[_0x5785('0x1c')][_0x5785('0x20')]({'where':_0x1eee26['options']?_0x1eee26[_0x5785('0x1e')][_0x5785('0x21')]||null:null})[_0x5785('0x10')](function(_0x219669){if(_0x219669){return _0x219669[_0x5785('0x22')](_0x1eee26['body'][_0x5785('0x23')],_[_0x5785('0x24')](_0x1eee26[_0x5785('0x1d')],[_0x5785('0x23'),'id'])||{});}})[_0x5785('0x25')](function(_0x4cffc9){logger['info'](_0x5785('0x26'),_0x1eee26);logger[_0x5785('0x14')](_0x5785('0x26'),_0x1eee26,JSON[_0x5785('0x15')](_0x4cffc9));_0x51601f(_0x4cffc9);})['catch'](function(_0x2d55ce){logger[_0x5785('0x16')](_0x5785('0x26'),_0x2d55ce['message'],_0x1eee26);_0x5ef830(_this[_0x5785('0x16')](0x1f4,_0x2d55ce[_0x5785('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.socket.js b/server/api/openchannelInteraction/openchannelInteraction.socket.js index f0da7af..1948e8b 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 _0x2375=['length','./openchannelInteraction.events','save','update','emit','register'];(function(_0x50117e,_0x236f8c){var _0x57990d=function(_0x57a0bd){while(--_0x57a0bd){_0x50117e['push'](_0x50117e['shift']());}};_0x57990d(++_0x236f8c);}(_0x2375,0xb5));var _0x5237=function(_0x432fca,_0xb0b1b5){_0x432fca=_0x432fca-0x0;var _0x3adba4=_0x2375[_0x432fca];return _0x3adba4;};'use strict';var OpenchannelInteractionEvents=require(_0x5237('0x0'));var events=[_0x5237('0x1'),'remove',_0x5237('0x2')];function createListener(_0x388610,_0x220136){return function(_0x4b540a){_0x220136[_0x5237('0x3')](_0x388610,_0x4b540a);};}function removeListener(_0x76c5fb,_0x581bd2){return function(){OpenchannelInteractionEvents['removeListener'](_0x76c5fb,_0x581bd2);};}exports[_0x5237('0x4')]=function(_0x5ae3d1){for(var _0x20ad4a=0x0,_0x5e7cc1=events[_0x5237('0x5')];_0x20ad4a<_0x5e7cc1;_0x20ad4a++){var _0x4faf02=events[_0x20ad4a];var _0x503a56=createListener('openchannelInteraction:'+_0x4faf02,_0x5ae3d1);OpenchannelInteractionEvents['on'](_0x4faf02,_0x503a56);}}; \ No newline at end of file +var _0x5777=['remove','update','emit','openchannelInteraction:','save'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x5777,0x68));var _0x7577=function(_0x109613,_0x39a8b4){_0x109613=_0x109613-0x0;var _0x130272=_0x5777[_0x109613];return _0x130272;};'use strict';var OpenchannelInteractionEvents=require('./openchannelInteraction.events');var events=[_0x7577('0x0'),_0x7577('0x1'),_0x7577('0x2')];function createListener(_0x46e44f,_0x3b6422){return function(_0x31fdc3){_0x3b6422[_0x7577('0x3')](_0x46e44f,_0x31fdc3);};}function removeListener(_0x3a014a,_0x76b6d1){return function(){OpenchannelInteractionEvents['removeListener'](_0x3a014a,_0x76b6d1);};}exports['register']=function(_0x4aea82){for(var _0x3c17a3=0x0,_0x3d1dcd=events['length'];_0x3c17a3<_0x3d1dcd;_0x3c17a3++){var _0x5d6589=events[_0x3c17a3];var _0xb1b07c=createListener(_0x7577('0x4')+_0x5d6589,_0x4aea82);OpenchannelInteractionEvents['on'](_0x5d6589,_0xb1b07c);}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/index.js b/server/api/openchannelMessage/index.js index c63e85b..81e7896 100644 --- a/server/api/openchannelMessage/index.js +++ b/server/api/openchannelMessage/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcb91=['openchannelmessage:create','put','update','/:id/reject','reject','destroy','exports','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./openchannelMessage.controller','get','index','isAuthenticated','describe','/:id','post','tracked','openchannel'];(function(_0x3b0da2,_0x306d66){var _0x45a240=function(_0x557598){while(--_0x557598){_0x3b0da2['push'](_0x3b0da2['shift']());}};_0x45a240(++_0x306d66);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x5d8631,_0x44944b){_0x5d8631=_0x5d8631-0x0;var _0x34c15e=_0xcb91[_0x5d8631];return _0x34c15e;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');var controller=require(_0x1cb9('0x6'));router[_0x1cb9('0x7')]('/',auth['isAuthenticated'](),controller[_0x1cb9('0x8')]);router[_0x1cb9('0x7')]('/describe',auth[_0x1cb9('0x9')](),controller[_0x1cb9('0xa')]);router['get'](_0x1cb9('0xb'),auth['isAuthenticated'](),controller['show']);router[_0x1cb9('0xc')]('/',auth[_0x1cb9('0x9')](),interaction[_0x1cb9('0xd')](_0x1cb9('0xe'),_0x1cb9('0xf')),controller['create']);router[_0x1cb9('0x10')](_0x1cb9('0xb'),auth[_0x1cb9('0x9')](),controller[_0x1cb9('0x11')]);router[_0x1cb9('0x10')]('/:id/accept',auth['isAuthenticated'](),controller['accept']);router[_0x1cb9('0x10')](_0x1cb9('0x12'),auth[_0x1cb9('0x9')](),controller[_0x1cb9('0x13')]);router['delete'](_0x1cb9('0xb'),auth[_0x1cb9('0x9')](),controller[_0x1cb9('0x14')]);module[_0x1cb9('0x15')]=router; \ No newline at end of file +var _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(_0x369f62,_0x17a354){var _0x323a6d=function(_0x4fc5cf){while(--_0x4fc5cf){_0x369f62['push'](_0x369f62['shift']());}};_0x323a6d(++_0x17a354);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x134d5e,_0x2a47d8){_0x134d5e=_0x134d5e-0x0;var _0x1e166a=_0xcb91[_0x134d5e];return _0x1e166a;};'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 f844afa..e24ec3d 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 _0x97c1=['exports','medium','ENUM','out','DATE','STRING','sequelize'];(function(_0xa3d178,_0x5a7e2d){var _0x23a994=function(_0x8e60ea){while(--_0x8e60ea){_0xa3d178['push'](_0xa3d178['shift']());}};_0x23a994(++_0x5a7e2d);}(_0x97c1,0xdf));var _0x197c=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x97c1[_0x122ef9];return _0x42fba0;};'use strict';var Sequelize=require(_0x197c('0x0'));module[_0x197c('0x1')]={'body':{'type':Sequelize['TEXT'](_0x197c('0x2')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0x197c('0x3')]('in',_0x197c('0x4')),'defaultValue':_0x197c('0x4'),'allowNull':![]},'readAt':{'type':Sequelize[_0x197c('0x5')]},'providerName':{'type':Sequelize[_0x197c('0x6')]},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0xd4a2=['sequelize','medium','BOOLEAN','out','DATE','STRING','TEXT'];(function(_0x2a9f4,_0x25c14a){var _0x3c39e0=function(_0x3b8deb){while(--_0x3b8deb){_0x2a9f4['push'](_0x2a9f4['shift']());}};_0x3c39e0(++_0x25c14a);}(_0xd4a2,0x173));var _0x2d4a=function(_0x40a3c3,_0xe1111e){_0x40a3c3=_0x40a3c3-0x0;var _0x561c37=_0xd4a2[_0x40a3c3];return _0x561c37;};'use strict';var Sequelize=require(_0x2d4a('0x0'));module['exports']={'body':{'type':Sequelize['TEXT'](_0x2d4a('0x1')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'secret':{'type':Sequelize[_0x2d4a('0x2')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0x2d4a('0x3')),'defaultValue':'out','allowNull':![]},'readAt':{'type':Sequelize[_0x2d4a('0x4')]},'providerName':{'type':Sequelize[_0x2d4a('0x5')]},'providerResponse':{'type':Sequelize[_0x2d4a('0x6')]}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.controller.js b/server/api/openchannelMessage/openchannelMessage.controller.js index 0c0a7c4..9800fd7 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 _0x949a=['UserId','user','get','isNil','read1stAt','interaction','[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','SELECT','contact','User','agent','fullname','internal','interface','channel','motionChannel','event','EventManager','../../config/logger','OpenchannelInteraction','OpenchannelInteractionId','RejectMessage','rejectMessage','SIP/%s','rejectmessage','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','fs-extra','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/utils','../../config/license/util','../../mysqldb','defaults','localhost','redis','./openchannelMessage.socket','jayson/promise','client','http','request','then','info','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','sendStatus','status','end','json','limit','undefined','offset','set','Content-Range','apply','reject','save','update','stack','name','send','map','type','key','keys','filters','intersection','model','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','OpenchannelMessage','count','includeAll','include','findAll','rawAttributes','find','create','body','destroy','params','describe','openchannel-interactions','accept','openchannel','read','readAt','format'];(function(_0x5180f2,_0x4f173a){var _0x2019ef=function(_0x19d3b7){while(--_0x19d3b7){_0x5180f2['push'](_0x5180f2['shift']());}};_0x2019ef(++_0x4f173a);}(_0x949a,0x1a7));var _0xa949=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x949a[_0x122ef9];return _0x42fba0;};'use strict';var emlformat=require(_0xa949('0x0'));var rimraf=require(_0xa949('0x1'));var zipdir=require(_0xa949('0x2'));var jsonpatch=require(_0xa949('0x3'));var rp=require(_0xa949('0x4'));var moment=require(_0xa949('0x5'));var BPromise=require(_0xa949('0x6'));var Mustache=require(_0xa949('0x7'));var util=require(_0xa949('0x8'));var path=require(_0xa949('0x9'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xa949('0xa'));var fs=require('fs');var fs_extra=require(_0xa949('0xb'));var _=require(_0xa949('0xc'));var squel=require(_0xa949('0xd'));var crypto=require('crypto');var jsforce=require(_0xa949('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xa949('0xf'));var Papa=require(_0xa949('0x10'));var Redis=require(_0xa949('0x11'));var authService=require(_0xa949('0x12'));var qs=require(_0xa949('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0xa949('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xa949('0x15'));var db=require(_0xa949('0x16'))['db'];config['redis']=_[_0xa949('0x17')](config['redis'],{'host':_0xa949('0x18'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xa949('0x19')]));require(_0xa949('0x1a'))['register'](socket);var jayson=require(_0xa949('0x1b'));var client=jayson[_0xa949('0x1c')][_0xa949('0x1d')]({'port':0x232c});var client9002=jayson[_0xa949('0x1c')][_0xa949('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x5ab230,_0x46d1e0,_0x457ea0,_0xa890eb){return new BPromise(function(_0x20ade2,_0x19e72e){var _0x37e873=_0xa890eb||client;return _0x37e873[_0xa949('0x1e')](_0x5ab230,_0x457ea0)[_0xa949('0x1f')](function(_0x1b3b60){logger[_0xa949('0x20')](_0xa949('0x21'),_0x46d1e0,_0xa949('0x22'));logger[_0xa949('0x23')]('OpenchannelMessage,\x20%s,\x20%s,\x20%s',_0x46d1e0,_0xa949('0x22'),JSON[_0xa949('0x24')](_0x1b3b60));if(_0x1b3b60[_0xa949('0x25')]){if(_0x1b3b60['error'][_0xa949('0x26')]===0x1f4){logger['error'](_0xa949('0x21'),_0x46d1e0,_0x1b3b60[_0xa949('0x25')][_0xa949('0x27')]);return _0x19e72e(_0x1b3b60[_0xa949('0x25')][_0xa949('0x27')]);}logger['error'](_0xa949('0x21'),_0x46d1e0,_0x1b3b60[_0xa949('0x25')][_0xa949('0x27')]);return _0x20ade2(_0x1b3b60['error']['message']);}else{logger[_0xa949('0x20')]('OpenchannelMessage,\x20%s,\x20%s',_0x46d1e0,_0xa949('0x22'));_0x20ade2(_0x1b3b60[_0xa949('0x28')][_0xa949('0x27')]);}})[_0xa949('0x29')](function(_0xe3fecf){logger[_0xa949('0x25')]('OpenchannelMessage,\x20%s,\x20%s',_0x46d1e0,_0xe3fecf);_0x19e72e(_0xe3fecf);});});}function respondWithStatusCode(_0x5e9af7,_0x113c78){_0x113c78=_0x113c78||0xcc;return function(_0x33edeb){if(_0x33edeb){return _0x5e9af7[_0xa949('0x2a')](_0x113c78);}return _0x5e9af7[_0xa949('0x2b')](_0x113c78)[_0xa949('0x2c')]();};}function respondWithResult(_0x3acc6c,_0x235dc8){_0x235dc8=_0x235dc8||0xc8;return function(_0x1b0625){if(_0x1b0625){return _0x3acc6c['status'](_0x235dc8)[_0xa949('0x2d')](_0x1b0625);}};}function respondWithFilteredResult(_0x38a005,_0x25da3f){return function(_0x1a1bde){if(_0x1a1bde){var _0x364f62=typeof _0x25da3f['offset']==='undefined'&&typeof _0x25da3f[_0xa949('0x2e')]===_0xa949('0x2f');var _0x52674c=_0x1a1bde['count'];var _0x1080c0=_0x364f62?0x0:_0x25da3f['offset'];var _0x3b3cf3=_0x364f62?_0x1a1bde['count']:_0x25da3f[_0xa949('0x30')]+_0x25da3f[_0xa949('0x2e')];var _0x4adfde;if(_0x3b3cf3>=_0x52674c){_0x3b3cf3=_0x52674c;_0x4adfde=0xc8;}else{_0x4adfde=0xce;}_0x38a005[_0xa949('0x2b')](_0x4adfde);return _0x38a005[_0xa949('0x31')](_0xa949('0x32'),_0x1080c0+'-'+_0x3b3cf3+'/'+_0x52674c)[_0xa949('0x2d')](_0x1a1bde);}return null;};}function patchUpdates(_0x21b26c){return function(_0x22df26){try{jsonpatch[_0xa949('0x33')](_0x22df26,_0x21b26c,!![]);}catch(_0x210da8){return BPromise[_0xa949('0x34')](_0x210da8);}return _0x22df26[_0xa949('0x35')]();};}function saveUpdates(_0x268110,_0x513e56){return function(_0x348a19){if(_0x348a19){return _0x348a19[_0xa949('0x36')](_0x268110)[_0xa949('0x1f')](function(_0x409584){return _0x409584;});}return null;};}function removeEntity(_0x20078b,_0x2afb38){return function(_0x4791f0){if(_0x4791f0){return _0x4791f0['destroy']()[_0xa949('0x1f')](function(){_0x20078b['status'](0xcc)[_0xa949('0x2c')]();});}};}function handleEntityNotFound(_0xaf7a49,_0x311ee8){return function(_0x2373c0){if(!_0x2373c0){_0xaf7a49['sendStatus'](0x194);}return _0x2373c0;};}function handleError(_0x3526d0,_0x56d91d){_0x56d91d=_0x56d91d||0x1f4;return function(_0x37bc24){logger['error'](_0x37bc24[_0xa949('0x37')]);if(_0x37bc24[_0xa949('0x38')]){delete _0x37bc24['name'];}_0x3526d0[_0xa949('0x2b')](_0x56d91d)[_0xa949('0x39')](_0x37bc24);};}exports['index']=function(_0x52716c,_0x4d4ceb){var _0x2f894d={},_0x3e103b={},_0x262131={'count':0x0,'rows':[]};var _0x43c68a=_[_0xa949('0x3a')](db['OpenchannelMessage']['rawAttributes'],function(_0x6f923a){return{'name':_0x6f923a['fieldName'],'type':_0x6f923a[_0xa949('0x3b')][_0xa949('0x3c')]};});_0x3e103b['model']=_[_0xa949('0x3a')](_0x43c68a,_0xa949('0x38'));_0x3e103b['query']=_[_0xa949('0x3d')](_0x52716c['query']);_0x3e103b[_0xa949('0x3e')]=_[_0xa949('0x3f')](_0x3e103b[_0xa949('0x40')],_0x3e103b[_0xa949('0x41')]);_0x2f894d[_0xa949('0x42')]=_['intersection'](_0x3e103b[_0xa949('0x40')],qs[_0xa949('0x43')](_0x52716c[_0xa949('0x41')][_0xa949('0x43')]));_0x2f894d[_0xa949('0x42')]=_0x2f894d[_0xa949('0x42')][_0xa949('0x44')]?_0x2f894d[_0xa949('0x42')]:_0x3e103b[_0xa949('0x40')];if(!_0x52716c[_0xa949('0x41')][_0xa949('0x45')](_0xa949('0x46'))){_0x2f894d[_0xa949('0x2e')]=qs[_0xa949('0x2e')](_0x52716c[_0xa949('0x41')][_0xa949('0x2e')]);_0x2f894d[_0xa949('0x30')]=qs[_0xa949('0x30')](_0x52716c[_0xa949('0x41')][_0xa949('0x30')]);}_0x2f894d[_0xa949('0x47')]=qs[_0xa949('0x48')](_0x52716c['query']['sort']);_0x2f894d[_0xa949('0x49')]=qs['filters'](_[_0xa949('0x4a')](_0x52716c[_0xa949('0x41')],_0x3e103b[_0xa949('0x3e')]),_0x43c68a);if(_0x52716c['query'][_0xa949('0x4b')]){_0x2f894d[_0xa949('0x49')]=_[_0xa949('0x4c')](_0x2f894d[_0xa949('0x49')],{'$or':_['map'](_0x43c68a,function(_0x476903){if(_0x476903[_0xa949('0x3b')]!==_0xa949('0x4d')){var _0x5c88e0={};_0x5c88e0[_0x476903[_0xa949('0x38')]]={'$like':'%'+_0x52716c[_0xa949('0x41')][_0xa949('0x4b')]+'%'};return _0x5c88e0;}})});}_0x2f894d=_[_0xa949('0x4c')]({},_0x2f894d,_0x52716c[_0xa949('0x4e')]);var _0x507658={'where':_0x2f894d['where']};return db[_0xa949('0x4f')][_0xa949('0x50')](_0x507658)[_0xa949('0x1f')](function(_0xeeac9a){_0x262131['count']=_0xeeac9a;if(_0x52716c[_0xa949('0x41')][_0xa949('0x51')]){_0x2f894d[_0xa949('0x52')]=[{'all':!![]}];}return db[_0xa949('0x4f')][_0xa949('0x53')](_0x2f894d);})[_0xa949('0x1f')](function(_0x4e60ba){_0x262131['rows']=_0x4e60ba;return _0x262131;})[_0xa949('0x1f')](respondWithFilteredResult(_0x4d4ceb,_0x2f894d))['catch'](handleError(_0x4d4ceb,null));};exports['show']=function(_0x56a5cd,_0x11ff50){var _0x4e2f52={'raw':!![],'where':{'id':_0x56a5cd['params']['id']}},_0x1a6b21={};_0x1a6b21['model']=_['keys'](db['OpenchannelMessage'][_0xa949('0x54')]);_0x1a6b21[_0xa949('0x41')]=_[_0xa949('0x3d')](_0x56a5cd[_0xa949('0x41')]);_0x1a6b21[_0xa949('0x3e')]=_[_0xa949('0x3f')](_0x1a6b21[_0xa949('0x40')],_0x1a6b21[_0xa949('0x41')]);_0x4e2f52[_0xa949('0x42')]=_[_0xa949('0x3f')](_0x1a6b21[_0xa949('0x40')],qs['fields'](_0x56a5cd[_0xa949('0x41')][_0xa949('0x43')]));_0x4e2f52[_0xa949('0x42')]=_0x4e2f52[_0xa949('0x42')][_0xa949('0x44')]?_0x4e2f52[_0xa949('0x42')]:_0x1a6b21[_0xa949('0x40')];if(_0x56a5cd[_0xa949('0x41')][_0xa949('0x51')]){_0x4e2f52[_0xa949('0x52')]=[{'all':!![]}];}_0x4e2f52=_['merge']({},_0x4e2f52,_0x56a5cd[_0xa949('0x4e')]);return db['OpenchannelMessage'][_0xa949('0x55')](_0x4e2f52)[_0xa949('0x1f')](handleEntityNotFound(_0x11ff50,null))[_0xa949('0x1f')](respondWithResult(_0x11ff50,null))['catch'](handleError(_0x11ff50,null));};exports['create']=function(_0x504c07,_0x41c2a4){return db['OpenchannelMessage'][_0xa949('0x56')](_0x504c07[_0xa949('0x57')],{})[_0xa949('0x1f')](respondWithResult(_0x41c2a4,0xc9))[_0xa949('0x29')](handleError(_0x41c2a4,null));};exports['update']=function(_0xf6b268,_0x28d846){if(_0xf6b268[_0xa949('0x57')]['id']){delete _0xf6b268['body']['id'];}return db[_0xa949('0x4f')][_0xa949('0x55')]({'where':{'id':_0xf6b268['params']['id']}})[_0xa949('0x1f')](handleEntityNotFound(_0x28d846,null))[_0xa949('0x1f')](saveUpdates(_0xf6b268['body'],null))['then'](respondWithResult(_0x28d846,null))[_0xa949('0x29')](handleError(_0x28d846,null));};exports[_0xa949('0x58')]=function(_0x3fd4b2,_0x347809){return db[_0xa949('0x4f')]['find']({'where':{'id':_0x3fd4b2[_0xa949('0x59')]['id']}})[_0xa949('0x1f')](handleEntityNotFound(_0x347809,null))[_0xa949('0x1f')](removeEntity(_0x347809,null))['catch'](handleError(_0x347809,null));};exports[_0xa949('0x5a')]=function(_0x52e8ea,_0x420459){return db[_0xa949('0x4f')]['describe']()[_0xa949('0x1f')](respondWithResult(_0x420459,null))[_0xa949('0x29')](handleError(_0x420459,null));};var interaction_log=require('../../config/logger')(_0xa949('0x5b'));exports[_0xa949('0x5c')]=function(_0xf5f9cc,_0x3b35bc,_0x216908){var _0x21089c={'agent':{},'channel':_0xa949('0x5d')};if(_0xf5f9cc['body']['id']){delete _0xf5f9cc[_0xa949('0x57')]['id'];}_0xf5f9cc['body'][_0xa949('0x5e')]=!![];_0xf5f9cc[_0xa949('0x57')][_0xa949('0x5f')]=moment()[_0xa949('0x60')]('YYYY-MM-DD\x20HH:mm:ss');_0xf5f9cc[_0xa949('0x57')][_0xa949('0x61')]=_0xf5f9cc[_0xa949('0x57')][_0xa949('0x61')]||_0xf5f9cc[_0xa949('0x62')]['id'];_0x21089c['agent']['id']=_0xf5f9cc['body'][_0xa949('0x61')];return db[_0xa949('0x4f')][_0xa949('0x55')]({'where':{'id':_0xf5f9cc[_0xa949('0x59')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x3b35bc,null))[_0xa949('0x1f')](saveUpdates(_0xf5f9cc[_0xa949('0x57')],null))[_0xa949('0x1f')](function(_0x314ff4){if(_0x314ff4){_0x21089c[_0xa949('0x27')]=_0x314ff4[_0xa949('0x63')]({'plain':!![]});return db['OpenchannelInteraction'][_0xa949('0x55')]({'where':{'id':_0x314ff4['OpenchannelInteractionId']}});}return null;})[_0xa949('0x1f')](handleEntityNotFound(_0x3b35bc,null))[_0xa949('0x1f')](function(_0x5bad98){if(_0x5bad98){return _0x5bad98[_0xa949('0x36')]({'UserId':_0xf5f9cc[_0xa949('0x57')][_0xa949('0x61')],'read1stAt':_[_0xa949('0x64')](_0x5bad98[_0xa949('0x65')])?moment()[_0xa949('0x60')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0xa949('0x1f')](function(_0x5911ad){if(_0x5911ad){_0x21089c[_0xa949('0x66')]=_0x5911ad['get']({'plain':!![]});interaction_log[_0xa949('0x20')](_0xa949('0x67'),_0xf5f9cc[_0xa949('0x62')]['id'],_0xf5f9cc[_0xa949('0x62')][_0xa949('0x38')],_0xf5f9cc[_0xa949('0x62')][_0xa949('0x68')],_0x21089c[_0xa949('0x66')]['id'],_0xf5f9cc['body']?JSON[_0xa949('0x24')](_0xf5f9cc[_0xa949('0x57')]):_0xa949('0x69'));return respondWithRpcPromise('AcceptMessage',_0xa949('0x6a'),_0x21089c);}return null;})[_0xa949('0x1f')](function(_0x2acba7){var _0x3e496d=_0xa949('0x6b')+_0x2acba7[_0xa949('0x27')][_0xa949('0x6c')];return db[_0xa949('0x6d')]['query'](_0x3e496d,{'type':db[_0xa949('0x6e')][_0xa949('0x6f')][_0xa949('0x70')],'raw':!![]})[_0xa949('0x1f')](function(_0x27287c){return _0x27287c;});})[_0xa949('0x1f')](function(_0x3fbd5c){if(_0x3fbd5c){_0x21089c['message'][_0xa949('0x71')]=_0x3fbd5c[0x0];if(!_0xf5f9cc['body'][_0xa949('0x61')])return;return db[_0xa949('0x72')][_0xa949('0x55')]({'where':{'id':_0xf5f9cc[_0xa949('0x57')][_0xa949('0x61')],'role':_0xa949('0x73')},'attributes':['id',_0xa949('0x38'),_0xa949('0x74'),'email',_0xa949('0x75')],'raw':!![]});}return null;})[_0xa949('0x1f')](function(_0x151647){if(!_0x151647)return null;_0x21089c[_0xa949('0x27')][_0xa949('0x73')]=_0x151647;return _0x21089c;})[_0xa949('0x1f')](function(_0x621605){if(_0x621605){if(_0xf5f9cc[_0xa949('0x57')]['manual']){_0x21089c[_0xa949('0x27')][_0xa949('0x76')]=util['format']('SIP/%s',_0xf5f9cc['user'][_0xa949('0x38')]);_0x21089c[_0xa949('0x27')][_0xa949('0x77')]=_0x21089c['channel'];_0x21089c[_0xa949('0x27')][_0xa949('0x78')]=_0x21089c[_0xa949('0x77')];_0x21089c[_0xa949('0x27')][_0xa949('0x79')]=_0xa949('0x5c');return respondWithRpcPromise(_0xa949('0x7a'),'EventManager',{'event':'acceptmessage','message':_0x21089c[_0xa949('0x27')]},client9002)[_0xa949('0x1f')](function(){return _0x21089c;});}return _0x21089c;}return null;})[_0xa949('0x1f')](respondWithResult(_0x3b35bc,null))[_0xa949('0x29')](handleError(_0x3b35bc,null));};var interaction_log=require(_0xa949('0x7b'))(_0xa949('0x5b'));exports[_0xa949('0x34')]=function(_0x217a8c,_0x706d8b,_0x5c4b01){var _0x553c8f={'agent':{},'channel':_0xa949('0x5d')};if(_0x217a8c[_0xa949('0x57')]['id']){delete _0x217a8c['body']['id'];}_0x217a8c['body']['UserId']=_0x217a8c[_0xa949('0x57')][_0xa949('0x61')]||_0x217a8c[_0xa949('0x62')]['id'];_0x553c8f['agent']['id']=_0x217a8c[_0xa949('0x57')]['UserId'];return db[_0xa949('0x4f')][_0xa949('0x55')]({'where':{'id':_0x217a8c[_0xa949('0x59')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x706d8b,null))[_0xa949('0x1f')](function(_0x3cc612){if(_0x3cc612){_0x553c8f['message']=_0x3cc612[_0xa949('0x63')]({'plain':!![]});return db[_0xa949('0x7c')][_0xa949('0x55')]({'where':{'id':_0x3cc612[_0xa949('0x7d')]}});}return null;})['then'](handleEntityNotFound(_0x706d8b,null))['then'](function(_0x492eaa){if(_0x492eaa){_0x553c8f[_0xa949('0x66')]=_0x492eaa[_0xa949('0x63')]({'plain':!![]});interaction_log[_0xa949('0x20')]('[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x217a8c[_0xa949('0x62')]['id'],_0x217a8c['user']['name'],_0x217a8c[_0xa949('0x62')]['role'],_0x553c8f[_0xa949('0x66')]['id'],_0x217a8c['body']?JSON[_0xa949('0x24')](_0x217a8c[_0xa949('0x57')]):_0xa949('0x69'));return respondWithRpcPromise(_0xa949('0x7e'),_0xa949('0x7f'),_0x553c8f);}return null;})[_0xa949('0x1f')](function(_0x5949aa){var _0x307218=_0xa949('0x6b')+_0x5949aa['message'][_0xa949('0x6c')];return db['sequelize'][_0xa949('0x41')](_0x307218,{'type':db[_0xa949('0x6e')][_0xa949('0x6f')][_0xa949('0x70')],'raw':!![]})['then'](function(_0x45a871){return _0x45a871;});})[_0xa949('0x1f')](function(_0x26d733){if(_0x26d733){_0x553c8f[_0xa949('0x27')][_0xa949('0x71')]=_0x26d733[0x0];if(!_0x217a8c['body'][_0xa949('0x61')])return;return db[_0xa949('0x72')]['find']({'where':{'id':_0x217a8c[_0xa949('0x57')][_0xa949('0x61')],'role':_0xa949('0x73')},'attributes':['id',_0xa949('0x38'),'fullname','email','internal'],'raw':!![]});}return null;})[_0xa949('0x1f')](function(_0x248594){if(!_0x248594)return null;_0x553c8f[_0xa949('0x27')]['agent']=_0x248594;return _0x553c8f;})[_0xa949('0x1f')](function(_0x48b2fa){if(_0x48b2fa){_0x48b2fa[_0xa949('0x27')][_0xa949('0x76')]=util['format'](_0xa949('0x80'),_0x217a8c[_0xa949('0x62')][_0xa949('0x38')]);_0x48b2fa[_0xa949('0x27')]['channel']=_0x553c8f[_0xa949('0x77')];_0x48b2fa[_0xa949('0x27')][_0xa949('0x78')]=_0x553c8f[_0xa949('0x77')];_0x48b2fa[_0xa949('0x27')]['event']='reject';respondWithRpcPromise(_0xa949('0x7a'),_0xa949('0x7a'),{'event':_0xa949('0x81'),'message':_0x48b2fa[_0xa949('0x27')]},client9002);return _0x553c8f;}return null;})[_0xa949('0x1f')](respondWithResult(_0x706d8b,null))['catch'](handleError(_0x706d8b,null));}; \ No newline at end of file +var _0xa671=['count','set','reject','destroy','name','send','index','OpenchannelMessage','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','findAll','rows','show','params','includeAll','include','create','body','update','describe','accept','openchannel','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','find','get','OpenchannelInteraction','OpenchannelInteractionId','isNil','read1stAt','role','interaction','null','AcceptMessage','acceptMessage','ContactId','sequelize','Sequelize','QueryTypes','User','agent','fullname','email','internal','interface','SIP/%s','channel','motionChannel','EventManager','openchannel-interactions','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','SELECT','rejectmessage','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','redis','socket.io-emitter','./openchannelMessage.socket','register','jayson/promise','client','http','request','then','info','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','OpenchannelMessage,\x20%s,\x20%s','message','result','catch','sendStatus','end','status','json','offset','undefined','limit'];(function(_0x3bbde7,_0x344127){var _0x117992=function(_0x1d0170){while(--_0x1d0170){_0x3bbde7['push'](_0x3bbde7['shift']());}};_0x117992(++_0x344127);}(_0xa671,0x153));var _0x1a67=function(_0x18cf50,_0x3d88f9){_0x18cf50=_0x18cf50-0x0;var _0x408c31=_0xa671[_0x18cf50];return _0x408c31;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x1a67('0x0'));var zipdir=require(_0x1a67('0x1'));var jsonpatch=require(_0x1a67('0x2'));var rp=require(_0x1a67('0x3'));var moment=require(_0x1a67('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x1a67('0x5'));var util=require(_0x1a67('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x1a67('0x7'));var ejs=require(_0x1a67('0x8'));var fs=require('fs');var fs_extra=require(_0x1a67('0x9'));var _=require(_0x1a67('0xa'));var squel=require(_0x1a67('0xb'));var crypto=require(_0x1a67('0xc'));var jsforce=require(_0x1a67('0xd'));var deskjs=require(_0x1a67('0xe'));var toCsv=require(_0x1a67('0x7'));var querystring=require('querystring');var Papa=require(_0x1a67('0xf'));var Redis=require(_0x1a67('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x1a67('0x11'));var as=require(_0x1a67('0x12'));var hardwareService=require(_0x1a67('0x13'));var logger=require(_0x1a67('0x14'))('api');var utils=require(_0x1a67('0x15'));var config=require(_0x1a67('0x16'));var licenseUtil=require(_0x1a67('0x17'));var db=require('../../mysqldb')['db'];config[_0x1a67('0x18')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x1a67('0x19'))(new Redis(config[_0x1a67('0x18')]));require(_0x1a67('0x1a'))[_0x1a67('0x1b')](socket);var jayson=require(_0x1a67('0x1c'));var client=jayson[_0x1a67('0x1d')][_0x1a67('0x1e')]({'port':0x232c});var client9002=jayson['client'][_0x1a67('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x4c72b6,_0x23f20e,_0x5b1957,_0x411d1b){return new BPromise(function(_0x58096c,_0xffec2){var _0x1fb246=_0x411d1b||client;return _0x1fb246[_0x1a67('0x1f')](_0x4c72b6,_0x5b1957)[_0x1a67('0x20')](function(_0x2f0e4d){logger[_0x1a67('0x21')]('OpenchannelMessage,\x20%s,\x20%s',_0x23f20e,_0x1a67('0x22'));logger[_0x1a67('0x23')](_0x1a67('0x24'),_0x23f20e,'request\x20sent',JSON[_0x1a67('0x25')](_0x2f0e4d));if(_0x2f0e4d[_0x1a67('0x26')]){if(_0x2f0e4d[_0x1a67('0x26')][_0x1a67('0x27')]===0x1f4){logger['error'](_0x1a67('0x28'),_0x23f20e,_0x2f0e4d['error']['message']);return _0xffec2(_0x2f0e4d['error'][_0x1a67('0x29')]);}logger[_0x1a67('0x26')]('OpenchannelMessage,\x20%s,\x20%s',_0x23f20e,_0x2f0e4d[_0x1a67('0x26')][_0x1a67('0x29')]);return _0x58096c(_0x2f0e4d[_0x1a67('0x26')][_0x1a67('0x29')]);}else{logger[_0x1a67('0x21')](_0x1a67('0x28'),_0x23f20e,'request\x20sent');_0x58096c(_0x2f0e4d[_0x1a67('0x2a')][_0x1a67('0x29')]);}})[_0x1a67('0x2b')](function(_0x113beb){logger['error'](_0x1a67('0x28'),_0x23f20e,_0x113beb);_0xffec2(_0x113beb);});});}function respondWithStatusCode(_0x213825,_0x46f0ef){_0x46f0ef=_0x46f0ef||0xcc;return function(_0x307fc1){if(_0x307fc1){return _0x213825[_0x1a67('0x2c')](_0x46f0ef);}return _0x213825['status'](_0x46f0ef)[_0x1a67('0x2d')]();};}function respondWithResult(_0x39dba4,_0x365eca){_0x365eca=_0x365eca||0xc8;return function(_0x326bd3){if(_0x326bd3){return _0x39dba4[_0x1a67('0x2e')](_0x365eca)[_0x1a67('0x2f')](_0x326bd3);}};}function respondWithFilteredResult(_0xed79ad,_0x2c14ec){return function(_0x62e27){if(_0x62e27){var _0x2d9ea9=typeof _0x2c14ec[_0x1a67('0x30')]===_0x1a67('0x31')&&typeof _0x2c14ec[_0x1a67('0x32')]===_0x1a67('0x31');var _0x230adc=_0x62e27[_0x1a67('0x33')];var _0x57cc3f=_0x2d9ea9?0x0:_0x2c14ec[_0x1a67('0x30')];var _0x5ea1c6=_0x2d9ea9?_0x62e27[_0x1a67('0x33')]:_0x2c14ec[_0x1a67('0x30')]+_0x2c14ec[_0x1a67('0x32')];var _0x5b6eb9;if(_0x5ea1c6>=_0x230adc){_0x5ea1c6=_0x230adc;_0x5b6eb9=0xc8;}else{_0x5b6eb9=0xce;}_0xed79ad['status'](_0x5b6eb9);return _0xed79ad[_0x1a67('0x34')]('Content-Range',_0x57cc3f+'-'+_0x5ea1c6+'/'+_0x230adc)[_0x1a67('0x2f')](_0x62e27);}return null;};}function patchUpdates(_0x19292d){return function(_0x5488cc){try{jsonpatch['apply'](_0x5488cc,_0x19292d,!![]);}catch(_0x16ae80){return BPromise[_0x1a67('0x35')](_0x16ae80);}return _0x5488cc['save']();};}function saveUpdates(_0x2bfb0f,_0x23b810){return function(_0x22439c){if(_0x22439c){return _0x22439c['update'](_0x2bfb0f)[_0x1a67('0x20')](function(_0x3f19bb){return _0x3f19bb;});}return null;};}function removeEntity(_0x3400a5,_0x428ade){return function(_0x5b3dd8){if(_0x5b3dd8){return _0x5b3dd8[_0x1a67('0x36')]()['then'](function(){_0x3400a5[_0x1a67('0x2e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x339c6c,_0x310d04){return function(_0x98ed52){if(!_0x98ed52){_0x339c6c[_0x1a67('0x2c')](0x194);}return _0x98ed52;};}function handleError(_0x3dda59,_0x4f43ed){_0x4f43ed=_0x4f43ed||0x1f4;return function(_0x353564){logger['error'](_0x353564['stack']);if(_0x353564['name']){delete _0x353564[_0x1a67('0x37')];}_0x3dda59[_0x1a67('0x2e')](_0x4f43ed)[_0x1a67('0x38')](_0x353564);};}exports[_0x1a67('0x39')]=function(_0x4f5287,_0x221cca){var _0x4b24a5={},_0x2ba7f3={},_0x1e76c0={'count':0x0,'rows':[]};var _0x171946=_['map'](db[_0x1a67('0x3a')][_0x1a67('0x3b')],function(_0x12f01b){return{'name':_0x12f01b[_0x1a67('0x3c')],'type':_0x12f01b[_0x1a67('0x3d')][_0x1a67('0x3e')]};});_0x2ba7f3[_0x1a67('0x3f')]=_['map'](_0x171946,'name');_0x2ba7f3[_0x1a67('0x40')]=_[_0x1a67('0x41')](_0x4f5287[_0x1a67('0x40')]);_0x2ba7f3[_0x1a67('0x42')]=_['intersection'](_0x2ba7f3[_0x1a67('0x3f')],_0x2ba7f3[_0x1a67('0x40')]);_0x4b24a5[_0x1a67('0x43')]=_[_0x1a67('0x44')](_0x2ba7f3[_0x1a67('0x3f')],qs['fields'](_0x4f5287[_0x1a67('0x40')][_0x1a67('0x45')]));_0x4b24a5['attributes']=_0x4b24a5[_0x1a67('0x43')][_0x1a67('0x46')]?_0x4b24a5[_0x1a67('0x43')]:_0x2ba7f3[_0x1a67('0x3f')];if(!_0x4f5287[_0x1a67('0x40')]['hasOwnProperty'](_0x1a67('0x47'))){_0x4b24a5[_0x1a67('0x32')]=qs[_0x1a67('0x32')](_0x4f5287['query']['limit']);_0x4b24a5['offset']=qs[_0x1a67('0x30')](_0x4f5287[_0x1a67('0x40')][_0x1a67('0x30')]);}_0x4b24a5[_0x1a67('0x48')]=qs[_0x1a67('0x49')](_0x4f5287[_0x1a67('0x40')][_0x1a67('0x49')]);_0x4b24a5['where']=qs[_0x1a67('0x42')](_[_0x1a67('0x4a')](_0x4f5287['query'],_0x2ba7f3[_0x1a67('0x42')]),_0x171946);if(_0x4f5287[_0x1a67('0x40')][_0x1a67('0x4b')]){_0x4b24a5[_0x1a67('0x4c')]=_[_0x1a67('0x4d')](_0x4b24a5['where'],{'$or':_['map'](_0x171946,function(_0x37cf3c){if(_0x37cf3c[_0x1a67('0x3d')]!==_0x1a67('0x4e')){var _0x34e003={};_0x34e003[_0x37cf3c['name']]={'$like':'%'+_0x4f5287[_0x1a67('0x40')][_0x1a67('0x4b')]+'%'};return _0x34e003;}})});}_0x4b24a5=_[_0x1a67('0x4d')]({},_0x4b24a5,_0x4f5287[_0x1a67('0x4f')]);var _0x30abc4={'where':_0x4b24a5[_0x1a67('0x4c')]};return db[_0x1a67('0x3a')][_0x1a67('0x33')](_0x30abc4)['then'](function(_0x1a65f8){_0x1e76c0[_0x1a67('0x33')]=_0x1a65f8;if(_0x4f5287[_0x1a67('0x40')]['includeAll']){_0x4b24a5['include']=[{'all':!![]}];}return db[_0x1a67('0x3a')][_0x1a67('0x50')](_0x4b24a5);})[_0x1a67('0x20')](function(_0x5f169b){_0x1e76c0[_0x1a67('0x51')]=_0x5f169b;return _0x1e76c0;})[_0x1a67('0x20')](respondWithFilteredResult(_0x221cca,_0x4b24a5))[_0x1a67('0x2b')](handleError(_0x221cca,null));};exports[_0x1a67('0x52')]=function(_0x2aceff,_0x93cba4){var _0x521317={'raw':!![],'where':{'id':_0x2aceff[_0x1a67('0x53')]['id']}},_0x1e8d7e={};_0x1e8d7e[_0x1a67('0x3f')]=_[_0x1a67('0x41')](db['OpenchannelMessage']['rawAttributes']);_0x1e8d7e[_0x1a67('0x40')]=_[_0x1a67('0x41')](_0x2aceff[_0x1a67('0x40')]);_0x1e8d7e[_0x1a67('0x42')]=_[_0x1a67('0x44')](_0x1e8d7e[_0x1a67('0x3f')],_0x1e8d7e[_0x1a67('0x40')]);_0x521317[_0x1a67('0x43')]=_[_0x1a67('0x44')](_0x1e8d7e[_0x1a67('0x3f')],qs['fields'](_0x2aceff[_0x1a67('0x40')][_0x1a67('0x45')]));_0x521317[_0x1a67('0x43')]=_0x521317[_0x1a67('0x43')]['length']?_0x521317['attributes']:_0x1e8d7e[_0x1a67('0x3f')];if(_0x2aceff[_0x1a67('0x40')][_0x1a67('0x54')]){_0x521317[_0x1a67('0x55')]=[{'all':!![]}];}_0x521317=_[_0x1a67('0x4d')]({},_0x521317,_0x2aceff['options']);return db[_0x1a67('0x3a')]['find'](_0x521317)[_0x1a67('0x20')](handleEntityNotFound(_0x93cba4,null))[_0x1a67('0x20')](respondWithResult(_0x93cba4,null))[_0x1a67('0x2b')](handleError(_0x93cba4,null));};exports[_0x1a67('0x56')]=function(_0x538b6e,_0x5b194d){return db['OpenchannelMessage']['create'](_0x538b6e[_0x1a67('0x57')],{})[_0x1a67('0x20')](respondWithResult(_0x5b194d,0xc9))[_0x1a67('0x2b')](handleError(_0x5b194d,null));};exports[_0x1a67('0x58')]=function(_0x37aa83,_0xc96afa){if(_0x37aa83[_0x1a67('0x57')]['id']){delete _0x37aa83[_0x1a67('0x57')]['id'];}return db[_0x1a67('0x3a')]['find']({'where':{'id':_0x37aa83['params']['id']}})['then'](handleEntityNotFound(_0xc96afa,null))[_0x1a67('0x20')](saveUpdates(_0x37aa83[_0x1a67('0x57')],null))[_0x1a67('0x20')](respondWithResult(_0xc96afa,null))[_0x1a67('0x2b')](handleError(_0xc96afa,null));};exports[_0x1a67('0x36')]=function(_0x29998,_0x4c111d){return db[_0x1a67('0x3a')]['find']({'where':{'id':_0x29998[_0x1a67('0x53')]['id']}})[_0x1a67('0x20')](handleEntityNotFound(_0x4c111d,null))['then'](removeEntity(_0x4c111d,null))['catch'](handleError(_0x4c111d,null));};exports[_0x1a67('0x59')]=function(_0x12a6e4,_0x333dcc){return db['OpenchannelMessage']['describe']()[_0x1a67('0x20')](respondWithResult(_0x333dcc,null))[_0x1a67('0x2b')](handleError(_0x333dcc,null));};var interaction_log=require(_0x1a67('0x14'))('openchannel-interactions');exports[_0x1a67('0x5a')]=function(_0x379474,_0x52079a,_0x446fed){var _0xf7e27e={'agent':{},'channel':_0x1a67('0x5b')};if(_0x379474[_0x1a67('0x57')]['id']){delete _0x379474[_0x1a67('0x57')]['id'];}_0x379474[_0x1a67('0x57')][_0x1a67('0x5c')]=!![];_0x379474[_0x1a67('0x57')][_0x1a67('0x5d')]=moment()[_0x1a67('0x5e')](_0x1a67('0x5f'));_0x379474[_0x1a67('0x57')][_0x1a67('0x60')]=_0x379474[_0x1a67('0x57')][_0x1a67('0x60')]||_0x379474[_0x1a67('0x61')]['id'];_0xf7e27e['agent']['id']=_0x379474[_0x1a67('0x57')][_0x1a67('0x60')];return db[_0x1a67('0x3a')][_0x1a67('0x62')]({'where':{'id':_0x379474[_0x1a67('0x53')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x52079a,null))[_0x1a67('0x20')](saveUpdates(_0x379474[_0x1a67('0x57')],null))[_0x1a67('0x20')](function(_0x4f004e){if(_0x4f004e){_0xf7e27e[_0x1a67('0x29')]=_0x4f004e[_0x1a67('0x63')]({'plain':!![]});return db[_0x1a67('0x64')]['find']({'where':{'id':_0x4f004e[_0x1a67('0x65')]}});}return null;})[_0x1a67('0x20')](handleEntityNotFound(_0x52079a,null))[_0x1a67('0x20')](function(_0x13d511){if(_0x13d511){return _0x13d511[_0x1a67('0x58')]({'UserId':_0x379474['body'][_0x1a67('0x60')],'read1stAt':_[_0x1a67('0x66')](_0x13d511[_0x1a67('0x67')])?moment()[_0x1a67('0x5e')](_0x1a67('0x5f')):undefined});}return null;})[_0x1a67('0x20')](function(_0x433519){if(_0x433519){_0xf7e27e['interaction']=_0x433519[_0x1a67('0x63')]({'plain':!![]});interaction_log['info']('[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x379474['user']['id'],_0x379474[_0x1a67('0x61')][_0x1a67('0x37')],_0x379474['user'][_0x1a67('0x68')],_0xf7e27e[_0x1a67('0x69')]['id'],_0x379474[_0x1a67('0x57')]?JSON[_0x1a67('0x25')](_0x379474[_0x1a67('0x57')]):_0x1a67('0x6a'));return respondWithRpcPromise(_0x1a67('0x6b'),_0x1a67('0x6c'),_0xf7e27e);}return null;})['then'](function(_0x35fe52){var _0x46f8ca='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x35fe52[_0x1a67('0x29')][_0x1a67('0x6d')];return db[_0x1a67('0x6e')][_0x1a67('0x40')](_0x46f8ca,{'type':db[_0x1a67('0x6f')][_0x1a67('0x70')]['SELECT'],'raw':!![]})[_0x1a67('0x20')](function(_0x87fb2b){return _0x87fb2b;});})['then'](function(_0x4d170d){if(_0x4d170d){_0xf7e27e[_0x1a67('0x29')]['contact']=_0x4d170d[0x0];if(!_0x379474['body'][_0x1a67('0x60')])return;return db[_0x1a67('0x71')]['find']({'where':{'id':_0x379474['body'][_0x1a67('0x60')],'role':_0x1a67('0x72')},'attributes':['id',_0x1a67('0x37'),_0x1a67('0x73'),_0x1a67('0x74'),_0x1a67('0x75')],'raw':!![]});}return null;})[_0x1a67('0x20')](function(_0x33bc35){if(!_0x33bc35)return null;_0xf7e27e[_0x1a67('0x29')]['agent']=_0x33bc35;return _0xf7e27e;})['then'](function(_0x1f9131){if(_0x1f9131){if(_0x379474[_0x1a67('0x57')]['manual']){_0xf7e27e[_0x1a67('0x29')][_0x1a67('0x76')]=util[_0x1a67('0x5e')](_0x1a67('0x77'),_0x379474['user']['name']);_0xf7e27e[_0x1a67('0x29')][_0x1a67('0x78')]=_0xf7e27e['channel'];_0xf7e27e['message'][_0x1a67('0x79')]=_0xf7e27e[_0x1a67('0x78')];_0xf7e27e[_0x1a67('0x29')]['event']=_0x1a67('0x5a');return respondWithRpcPromise(_0x1a67('0x7a'),_0x1a67('0x7a'),{'event':'acceptmessage','message':_0xf7e27e[_0x1a67('0x29')]},client9002)[_0x1a67('0x20')](function(){return _0xf7e27e;});}return _0xf7e27e;}return null;})[_0x1a67('0x20')](respondWithResult(_0x52079a,null))['catch'](handleError(_0x52079a,null));};var interaction_log=require(_0x1a67('0x14'))(_0x1a67('0x7b'));exports[_0x1a67('0x35')]=function(_0x4f5c01,_0x4e0dc8,_0x3c55f7){var _0x2365d8={'agent':{},'channel':_0x1a67('0x5b')};if(_0x4f5c01[_0x1a67('0x57')]['id']){delete _0x4f5c01[_0x1a67('0x57')]['id'];}_0x4f5c01[_0x1a67('0x57')][_0x1a67('0x60')]=_0x4f5c01['body'][_0x1a67('0x60')]||_0x4f5c01[_0x1a67('0x61')]['id'];_0x2365d8['agent']['id']=_0x4f5c01[_0x1a67('0x57')][_0x1a67('0x60')];return db[_0x1a67('0x3a')][_0x1a67('0x62')]({'where':{'id':_0x4f5c01[_0x1a67('0x53')]['id'],'UserId':null}})[_0x1a67('0x20')](handleEntityNotFound(_0x4e0dc8,null))[_0x1a67('0x20')](function(_0x14550e){if(_0x14550e){_0x2365d8[_0x1a67('0x29')]=_0x14550e['get']({'plain':!![]});return db['OpenchannelInteraction'][_0x1a67('0x62')]({'where':{'id':_0x14550e[_0x1a67('0x65')]}});}return null;})['then'](handleEntityNotFound(_0x4e0dc8,null))[_0x1a67('0x20')](function(_0x4f7b69){if(_0x4f7b69){_0x2365d8[_0x1a67('0x69')]=_0x4f7b69[_0x1a67('0x63')]({'plain':!![]});interaction_log[_0x1a67('0x21')](_0x1a67('0x7c'),_0x4f5c01[_0x1a67('0x61')]['id'],_0x4f5c01['user'][_0x1a67('0x37')],_0x4f5c01[_0x1a67('0x61')][_0x1a67('0x68')],_0x2365d8['interaction']['id'],_0x4f5c01[_0x1a67('0x57')]?JSON['stringify'](_0x4f5c01['body']):_0x1a67('0x6a'));return respondWithRpcPromise(_0x1a67('0x7d'),_0x1a67('0x7e'),_0x2365d8);}return null;})['then'](function(_0x326466){var _0x3fed1c=_0x1a67('0x7f')+_0x326466['message']['ContactId'];return db[_0x1a67('0x6e')][_0x1a67('0x40')](_0x3fed1c,{'type':db[_0x1a67('0x6f')][_0x1a67('0x70')][_0x1a67('0x80')],'raw':!![]})[_0x1a67('0x20')](function(_0x3ca310){return _0x3ca310;});})[_0x1a67('0x20')](function(_0x3d3454){if(_0x3d3454){_0x2365d8[_0x1a67('0x29')]['contact']=_0x3d3454[0x0];if(!_0x4f5c01['body'][_0x1a67('0x60')])return;return db[_0x1a67('0x71')][_0x1a67('0x62')]({'where':{'id':_0x4f5c01[_0x1a67('0x57')][_0x1a67('0x60')],'role':_0x1a67('0x72')},'attributes':['id',_0x1a67('0x37'),_0x1a67('0x73'),'email',_0x1a67('0x75')],'raw':!![]});}return null;})[_0x1a67('0x20')](function(_0x29fcb9){if(!_0x29fcb9)return null;_0x2365d8[_0x1a67('0x29')][_0x1a67('0x72')]=_0x29fcb9;return _0x2365d8;})['then'](function(_0x1c7183){if(_0x1c7183){_0x1c7183[_0x1a67('0x29')]['interface']=util['format'](_0x1a67('0x77'),_0x4f5c01[_0x1a67('0x61')][_0x1a67('0x37')]);_0x1c7183[_0x1a67('0x29')][_0x1a67('0x78')]=_0x2365d8[_0x1a67('0x78')];_0x1c7183[_0x1a67('0x29')][_0x1a67('0x79')]=_0x2365d8['channel'];_0x1c7183[_0x1a67('0x29')]['event']=_0x1a67('0x35');respondWithRpcPromise('EventManager','EventManager',{'event':_0x1a67('0x81'),'message':_0x1c7183['message']},client9002);return _0x2365d8;}return null;})[_0x1a67('0x20')](respondWithResult(_0x4e0dc8,null))[_0x1a67('0x2b')](handleError(_0x4e0dc8,null));}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.events.js b/server/api/openchannelMessage/openchannelMessage.events.js index b12b431..ac41fe4 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 _0xe6d3=['../../mysqldb','setMaxListeners','update','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xe6d3,0x10d));var _0x3e6d=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0xe6d3[_0x6131cd];return _0x47e916;};'use strict';var EventEmitter=require(_0x3e6d('0x0'));var OpenchannelMessage=require(_0x3e6d('0x1'))['db']['OpenchannelMessage'];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0x3e6d('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x3e6d('0x3'),'afterDestroy':_0x3e6d('0x4')};function emitEvent(_0x2b83dc){return function(_0x14c37c,_0x44a63b,_0x3689f9){OpenchannelMessageEvents['emit'](_0x2b83dc+':'+_0x14c37c['id'],_0x14c37c);OpenchannelMessageEvents[_0x3e6d('0x5')](_0x2b83dc,_0x14c37c);_0x3689f9(null);};}for(var e in events){if(events[_0x3e6d('0x6')](e)){var event=events[e];OpenchannelMessage[_0x3e6d('0x7')](e,emitEvent(event));}}module[_0x3e6d('0x8')]=OpenchannelMessageEvents; \ No newline at end of file +var _0x3557=['setMaxListeners','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x23dfc5,_0x317332){var _0x2e2ef4=function(_0x3d1931){while(--_0x3d1931){_0x23dfc5['push'](_0x23dfc5['shift']());}};_0x2e2ef4(++_0x317332);}(_0x3557,0xc6));var _0x7355=function(_0x4ce1b9,_0x397a4b){_0x4ce1b9=_0x4ce1b9-0x0;var _0x2bb15d=_0x3557[_0x4ce1b9];return _0x2bb15d;};'use strict';var EventEmitter=require(_0x7355('0x0'));var OpenchannelMessage=require(_0x7355('0x1'))['db']['OpenchannelMessage'];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0x7355('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x7355('0x3')};function emitEvent(_0x477d8c){return function(_0x5b12c0,_0x52a811,_0x364c3a){OpenchannelMessageEvents[_0x7355('0x4')](_0x477d8c+':'+_0x5b12c0['id'],_0x5b12c0);OpenchannelMessageEvents[_0x7355('0x4')](_0x477d8c,_0x5b12c0);_0x364c3a(null);};}for(var e in events){if(events[_0x7355('0x5')](e)){var event=events[e];OpenchannelMessage[_0x7355('0x6')](e,emitEvent(event));}}module[_0x7355('0x7')]=OpenchannelMessageEvents; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.model.js b/server/api/openchannelMessage/openchannelMessage.model.js index 4468da7..8c76f7e 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 _0xe2eb=['exports','define','OpenchannelMessage','body','FULLTEXT','get','direction','toLowerCase','out','secret','isNil','UserId','findOne','then','update','createdAt','catch','describe','OpenchannelAccount','OpenchannelAccountId','OpenchannelInteraction','Interactions','CmContact','keys','replyUri','OpenchannelMessage,\x20%s,\x20%s','afterCreate','Forwarding\x20message\x20%d\x20to\x20%s','length','Interaction','omit','Contact','POST','method','GET','info','Message\x20%d\x20forwarded\x20to\x20%s','threadId','error','inspect','finally','utf8mb4_unicode_ci','lodash','api','moment','request-promise','rimraf','../../config/environment','./openchannelMessage.attributes'];(function(_0x50a291,_0x280e1f){var _0x564ed8=function(_0x3306d6){while(--_0x3306d6){_0x50a291['push'](_0x50a291['shift']());}};_0x564ed8(++_0x280e1f);}(_0xe2eb,0x181));var _0xbe2e=function(_0x11675b,_0xfd4f8c){_0x11675b=_0x11675b-0x0;var _0x11b08c=_0xe2eb[_0x11675b];return _0x11b08c;};'use strict';var _=require(_0xbe2e('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xbe2e('0x1'));var moment=require(_0xbe2e('0x2'));var BPromise=require('bluebird');var rp=require(_0xbe2e('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xbe2e('0x4'));var config=require(_0xbe2e('0x5'));var attributes=require(_0xbe2e('0x6'));module[_0xbe2e('0x7')]=function(_0x221233,_0x543ff0){return _0x221233[_0xbe2e('0x8')](_0xbe2e('0x9'),attributes,{'tableName':'openchannel_messages','paranoid':![],'indexes':[{'name':'fti_openchannel_messages','fields':[_0xbe2e('0xa')],'type':_0xbe2e('0xb')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x48b68a,_0x5afe5b,_0x4b5c32){var _0x1cbc37=_0x221233['models'];var _0x49c21d=_0x48b68a[_0xbe2e('0xc')]({'plain':!![]});if(_0x49c21d[_0xbe2e('0xd')]['toLowerCase']()==='in'||_0x49c21d[_0xbe2e('0xd')][_0xbe2e('0xe')]()===_0xbe2e('0xf')&&!_0x49c21d[_0xbe2e('0x10')]&&!_[_0xbe2e('0x11')](_0x49c21d[_0xbe2e('0x12')])){_0x1cbc37['OpenchannelInteraction'][_0xbe2e('0x13')]({'where':{'id':_0x49c21d['OpenchannelInteractionId']}})[_0xbe2e('0x14')](function(_0xce15c1){if(_0xce15c1){_0xce15c1[_0xbe2e('0x15')]({'lastMsgAt':_0x49c21d[_0xbe2e('0x16')],'lastMsgDirection':_0x49c21d['direction'][_0xbe2e('0xe')]()});}})[_0xbe2e('0x17')](function(_0x33d2bf){console['error'](_0x33d2bf);});}if(_0x49c21d[_0xbe2e('0xd')]===_0xbe2e('0xf')&&!_0x49c21d['secret']){var _0x4d0ba4;_0x1cbc37['CmContact'][_0xbe2e('0x18')]()[_0xbe2e('0x14')](function(_0x382f1c){return _0x1cbc37[_0xbe2e('0x19')]['find']({'where':{'id':_0x49c21d[_0xbe2e('0x1a')]},'include':[{'model':_0x1cbc37[_0xbe2e('0x1b')],'as':_0xbe2e('0x1c'),'where':{'id':_0x49c21d['OpenchannelInteractionId']},'limit':0x1,'include':[{'model':_0x1cbc37[_0xbe2e('0x1d')],'as':'Contact','attributes':_[_0xbe2e('0x1e')](_0x382f1c)}]}]});})[_0xbe2e('0x14')](function(_0x1a3fc7){_0x4d0ba4=_0x1a3fc7[_0xbe2e('0xc')]({'plain':!![]});if(_0x4d0ba4&&_0x4d0ba4[_0xbe2e('0x1f')]){logger['info'](_0xbe2e('0x20'),_0xbe2e('0x21'),util['format'](_0xbe2e('0x22'),_0x49c21d['id'],_0x4d0ba4['replyUri']));if(_0x4d0ba4[_0xbe2e('0x1c')]&&_0x4d0ba4[_0xbe2e('0x1c')][_0xbe2e('0x23')]){_0x49c21d[_0xbe2e('0x24')]=_[_0xbe2e('0x25')](_0x4d0ba4[_0xbe2e('0x1c')][0x0],_0xbe2e('0x26'));_0x49c21d['Contact']=_0x4d0ba4['Interactions'][0x0][_0xbe2e('0x26')];}var _0x5afe5b={'method':_0xbe2e('0x27'),'uri':encodeURI(_0x4d0ba4[_0xbe2e('0x1f')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0x5afe5b[_0xbe2e('0x28')]){case _0xbe2e('0x29'):_0x5afe5b['qs']=_0x49c21d;break;case _0xbe2e('0x27'):_0x5afe5b['body']=_0x49c21d;break;}return rp(_0x5afe5b)['then'](function(_0x140f65){logger[_0xbe2e('0x2a')](_0xbe2e('0x20'),_0xbe2e('0x21'),util['format'](_0xbe2e('0x2b'),_0x49c21d['id'],_0x4d0ba4['replyUri']));if(_0x140f65[_0xbe2e('0xa')][_0xbe2e('0x2c')]&&_0x140f65[_0xbe2e('0xa')][_0xbe2e('0x2c')]!=_0x49c21d['Interaction']['threadId']){return _0x1cbc37[_0xbe2e('0x1b')][_0xbe2e('0x15')]({'threadId':_0x140f65['body']['threadId']},{'where':{'id':_0x49c21d[_0xbe2e('0x24')]['id']}});}else{return;}})[_0xbe2e('0x14')](function(){return _0x48b68a[_0xbe2e('0x15')]({'read':!![]});})[_0xbe2e('0x17')](function(_0x5cc5a1){logger[_0xbe2e('0x2d')](_0xbe2e('0x20'),_0xbe2e('0x21'),util[_0xbe2e('0x2e')](_0x5cc5a1,{'showHidden':![],'depth':null}));_0x4b5c32();});}else{_0x4b5c32();}})[_0xbe2e('0x2f')](function(){_0x4b5c32();});}else{_0x4b5c32();}}},'charset':'utf8mb4','collate':_0xbe2e('0x30')});}; \ No newline at end of file +var _0x9677=['request-promise','path','rimraf','../../config/environment','define','OpenchannelMessage','openchannel_messages','fti_openchannel_messages','body','models','get','direction','out','secret','UserId','OpenchannelInteraction','findOne','toLowerCase','error','CmContact','then','OpenchannelAccount','find','OpenchannelAccountId','OpenchannelInteractionId','replyUri','info','OpenchannelMessage,\x20%s,\x20%s','afterCreate','format','Forwarding\x20message\x20%d\x20to\x20%s','Interactions','omit','Contact','method','GET','threadId','update','catch','inspect','utf8mb4','lodash','../../config/logger','bluebird'];(function(_0xac8859,_0x1c333e){var _0x550373=function(_0x1716d0){while(--_0x1716d0){_0xac8859['push'](_0xac8859['shift']());}};_0x550373(++_0x1c333e);}(_0x9677,0xad));var _0x7967=function(_0xa650d8,_0x6d01ef){_0xa650d8=_0xa650d8-0x0;var _0x79ce97=_0x9677[_0xa650d8];return _0x79ce97;};'use strict';var _=require(_0x7967('0x0'));var util=require('util');var logger=require(_0x7967('0x1'))('api');var moment=require('moment');var BPromise=require(_0x7967('0x2'));var rp=require(_0x7967('0x3'));var fs=require('fs');var path=require(_0x7967('0x4'));var rimraf=require(_0x7967('0x5'));var config=require(_0x7967('0x6'));var attributes=require('./openchannelMessage.attributes');module['exports']=function(_0x295d21,_0x3a2542){return _0x295d21[_0x7967('0x7')](_0x7967('0x8'),attributes,{'tableName':_0x7967('0x9'),'paranoid':![],'indexes':[{'name':_0x7967('0xa'),'fields':[_0x7967('0xb')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x52529d,_0x5481ab,_0x5166a0){var _0x2fca7d=_0x295d21[_0x7967('0xc')];var _0x187cdb=_0x52529d[_0x7967('0xd')]({'plain':!![]});if(_0x187cdb[_0x7967('0xe')]['toLowerCase']()==='in'||_0x187cdb[_0x7967('0xe')]['toLowerCase']()===_0x7967('0xf')&&!_0x187cdb[_0x7967('0x10')]&&!_['isNil'](_0x187cdb[_0x7967('0x11')])){_0x2fca7d[_0x7967('0x12')][_0x7967('0x13')]({'where':{'id':_0x187cdb['OpenchannelInteractionId']}})['then'](function(_0x53be3e){if(_0x53be3e){_0x53be3e['update']({'lastMsgAt':_0x187cdb['createdAt'],'lastMsgDirection':_0x187cdb[_0x7967('0xe')][_0x7967('0x14')]()});}})['catch'](function(_0x4fcc12){console[_0x7967('0x15')](_0x4fcc12);});}if(_0x187cdb[_0x7967('0xe')]===_0x7967('0xf')&&!_0x187cdb['secret']){var _0x571f85;_0x2fca7d[_0x7967('0x16')]['describe']()[_0x7967('0x17')](function(_0x32a250){return _0x2fca7d[_0x7967('0x18')][_0x7967('0x19')]({'where':{'id':_0x187cdb[_0x7967('0x1a')]},'include':[{'model':_0x2fca7d[_0x7967('0x12')],'as':'Interactions','where':{'id':_0x187cdb[_0x7967('0x1b')]},'limit':0x1,'include':[{'model':_0x2fca7d[_0x7967('0x16')],'as':'Contact','attributes':_['keys'](_0x32a250)}]}]});})[_0x7967('0x17')](function(_0x132226){_0x571f85=_0x132226[_0x7967('0xd')]({'plain':!![]});if(_0x571f85&&_0x571f85[_0x7967('0x1c')]){logger[_0x7967('0x1d')](_0x7967('0x1e'),_0x7967('0x1f'),util[_0x7967('0x20')](_0x7967('0x21'),_0x187cdb['id'],_0x571f85[_0x7967('0x1c')]));if(_0x571f85[_0x7967('0x22')]&&_0x571f85[_0x7967('0x22')]['length']){_0x187cdb['Interaction']=_[_0x7967('0x23')](_0x571f85[_0x7967('0x22')][0x0],_0x7967('0x24'));_0x187cdb[_0x7967('0x24')]=_0x571f85[_0x7967('0x22')][0x0][_0x7967('0x24')];}var _0x5481ab={'method':'POST','uri':encodeURI(_0x571f85[_0x7967('0x1c')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0x5481ab[_0x7967('0x25')]){case _0x7967('0x26'):_0x5481ab['qs']=_0x187cdb;break;case'POST':_0x5481ab[_0x7967('0xb')]=_0x187cdb;break;}return rp(_0x5481ab)['then'](function(_0x294377){logger[_0x7967('0x1d')](_0x7967('0x1e'),_0x7967('0x1f'),util['format']('Message\x20%d\x20forwarded\x20to\x20%s',_0x187cdb['id'],_0x571f85[_0x7967('0x1c')]));if(_0x294377[_0x7967('0xb')][_0x7967('0x27')]&&_0x294377['body'][_0x7967('0x27')]!=_0x187cdb['Interaction'][_0x7967('0x27')]){return _0x2fca7d['OpenchannelInteraction']['update']({'threadId':_0x294377['body'][_0x7967('0x27')]},{'where':{'id':_0x187cdb['Interaction']['id']}});}else{return;}})[_0x7967('0x17')](function(){return _0x52529d[_0x7967('0x28')]({'read':!![]});})[_0x7967('0x29')](function(_0x290832){logger[_0x7967('0x15')]('OpenchannelMessage,\x20%s,\x20%s',_0x7967('0x1f'),util[_0x7967('0x2a')](_0x290832,{'showHidden':![],'depth':null}));_0x5166a0();});}else{_0x5166a0();}})['finally'](function(){_0x5166a0();});}else{_0x5166a0();}}},'charset':_0x7967('0x2b'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.rpc.js b/server/api/openchannelMessage/openchannelMessage.rpc.js index dfb6a0c..b50ef5e 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(_0x22f99b,_0x2fb513){var _0x176c18=function(_0x2c744c){while(--_0x2c744c){_0x22f99b['push'](_0x22f99b['shift']());}};_0x176c18(++_0x2fb513);}(_0x7a54,0x106));var _0x47a5=function(_0x4fd15e,_0x37431b){_0x4fd15e=_0x4fd15e-0x0;var _0x35a446=_0x7a54[_0x4fd15e];return _0x35a446;};'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 _0x2ef3=['lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','redis','defaults','localhost','socket.io-emitter','./openchannelMessage.socket','register','request','then','OpenchannelMessage,\x20%s,\x20%s','debug','request\x20sent','stringify','code','error','message','result','catch','CreateOpenchannelMessage','create','options','info'];(function(_0x1dc98e,_0x47e503){var _0x48f6a3=function(_0x37697c){while(--_0x37697c){_0x1dc98e['push'](_0x1dc98e['shift']());}};_0x48f6a3(++_0x47e503);}(_0x2ef3,0xba));var _0x32ef=function(_0x3d159e,_0xdfe4aa){_0x3d159e=_0x3d159e-0x0;var _0x29e263=_0x2ef3[_0x3d159e];return _0x29e263;};'use strict';var _=require(_0x32ef('0x0'));var util=require(_0x32ef('0x1'));var moment=require(_0x32ef('0x2'));var BPromise=require(_0x32ef('0x3'));var rs=require(_0x32ef('0x4'));var fs=require('fs');var Redis=require(_0x32ef('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x32ef('0x6'));var logger=require(_0x32ef('0x7'))('rpc');var config=require(_0x32ef('0x8'));var jayson=require(_0x32ef('0x9'));var client=jayson['client']['http']({'port':0x232a});config[_0x32ef('0xa')]=_[_0x32ef('0xb')](config[_0x32ef('0xa')],{'host':_0x32ef('0xc'),'port':0x18eb});var socket=require(_0x32ef('0xd'))(new Redis(config[_0x32ef('0xa')]));require(_0x32ef('0xe'))[_0x32ef('0xf')](socket);function respondWithRpcPromise(_0x28275c,_0x77df79,_0x56eb42){return new BPromise(function(_0x5780e9,_0x401d0b){return client[_0x32ef('0x10')](_0x28275c,_0x56eb42)[_0x32ef('0x11')](function(_0x1499c2){logger['info'](_0x32ef('0x12'),_0x77df79,'request\x20sent');logger[_0x32ef('0x13')]('OpenchannelMessage,\x20%s,\x20%s,\x20%s',_0x77df79,_0x32ef('0x14'),JSON[_0x32ef('0x15')](_0x1499c2));if(_0x1499c2['error']){if(_0x1499c2['error'][_0x32ef('0x16')]===0x1f4){logger['error'](_0x32ef('0x12'),_0x77df79,_0x1499c2[_0x32ef('0x17')][_0x32ef('0x18')]);return _0x401d0b(_0x1499c2[_0x32ef('0x17')]['message']);}logger['error']('OpenchannelMessage,\x20%s,\x20%s',_0x77df79,_0x1499c2[_0x32ef('0x17')][_0x32ef('0x18')]);return _0x5780e9(_0x1499c2[_0x32ef('0x17')]['message']);}else{logger['info'](_0x32ef('0x12'),_0x77df79,_0x32ef('0x14'));_0x5780e9(_0x1499c2[_0x32ef('0x19')]['message']);}})[_0x32ef('0x1a')](function(_0x33e230){logger['error'](_0x32ef('0x12'),_0x77df79,_0x33e230);_0x401d0b(_0x33e230);});});}exports[_0x32ef('0x1b')]=function(_0x26aff3){var _0x251084=this;return new Promise(function(_0x445cda,_0x3aec05){return db['OpenchannelMessage'][_0x32ef('0x1c')](_0x26aff3['body'],{'raw':_0x26aff3[_0x32ef('0x1d')]?_0x26aff3[_0x32ef('0x1d')]['raw']===undefined?!![]:![]:!![]})[_0x32ef('0x11')](function(_0x97780){logger[_0x32ef('0x1e')]('CreateOpenchannelMessage',_0x26aff3);logger['debug'](_0x32ef('0x1b'),_0x26aff3,JSON[_0x32ef('0x15')](_0x97780));_0x445cda(_0x97780);})[_0x32ef('0x1a')](function(_0x478bef){logger['error'](_0x32ef('0x1b'),_0x478bef['message'],_0x26aff3);_0x3aec05(_0x251084['error'](0x1f4,_0x478bef[_0x32ef('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.socket.js b/server/api/openchannelMessage/openchannelMessage.socket.js index 59a44c1..ef30ad2 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 _0x9622=['register','length','openchannelMessage:','./openchannelMessage.events','save','remove'];(function(_0x11f048,_0x354699){var _0x1d6baa=function(_0x5cd15f){while(--_0x5cd15f){_0x11f048['push'](_0x11f048['shift']());}};_0x1d6baa(++_0x354699);}(_0x9622,0x8d));var _0x2962=function(_0x5b8a99,_0x2e0c12){_0x5b8a99=_0x5b8a99-0x0;var _0x31fa01=_0x9622[_0x5b8a99];return _0x31fa01;};'use strict';var OpenchannelMessageEvents=require(_0x2962('0x0'));var events=[_0x2962('0x1'),_0x2962('0x2'),'update'];function createListener(_0xbb1509,_0xe99a15){return function(_0x287a5b){_0xe99a15['emit'](_0xbb1509,_0x287a5b);};}function removeListener(_0x5ab38d,_0x59d192){return function(){OpenchannelMessageEvents['removeListener'](_0x5ab38d,_0x59d192);};}exports[_0x2962('0x3')]=function(_0x24fc5b){for(var _0x720485=0x0,_0x1581b9=events[_0x2962('0x4')];_0x720485<_0x1581b9;_0x720485++){var _0x199b86=events[_0x720485];var _0x51153c=createListener(_0x2962('0x5')+_0x199b86,_0x24fc5b);OpenchannelMessageEvents['on'](_0x199b86,_0x51153c);}}; \ No newline at end of file +var _0xaae7=['update','emit','removeListener','register','length','openchannelMessage:','./openchannelMessage.events','save','remove'];(function(_0x3d7365,_0x13ccfb){var _0x3d96ac=function(_0x24135e){while(--_0x24135e){_0x3d7365['push'](_0x3d7365['shift']());}};_0x3d96ac(++_0x13ccfb);}(_0xaae7,0xa8));var _0x7aae=function(_0x7c1ec5,_0xdb3636){_0x7c1ec5=_0x7c1ec5-0x0;var _0x4db0ab=_0xaae7[_0x7c1ec5];return _0x4db0ab;};'use strict';var OpenchannelMessageEvents=require(_0x7aae('0x0'));var events=[_0x7aae('0x1'),_0x7aae('0x2'),_0x7aae('0x3')];function createListener(_0x2f1385,_0x33d08f){return function(_0x499bc8){_0x33d08f[_0x7aae('0x4')](_0x2f1385,_0x499bc8);};}function removeListener(_0x5b321c,_0x48ca8a){return function(){OpenchannelMessageEvents[_0x7aae('0x5')](_0x5b321c,_0x48ca8a);};}exports[_0x7aae('0x6')]=function(_0x42e3d6){for(var _0x426b84=0x0,_0x3455c3=events[_0x7aae('0x7')];_0x426b84<_0x3455c3;_0x426b84++){var _0x29e4c6=events[_0x426b84];var _0x11d511=createListener(_0x7aae('0x8')+_0x29e4c6,_0x42e3d6);OpenchannelMessageEvents['on'](_0x29e4c6,_0x11d511);}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/index.js b/server/api/openchannelQueue/index.js index 4defc4e..0245860 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 _0x4d87=['multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./openchannelQueue.controller','get','index','isAuthenticated','describe','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','create','addTeams','post','addAgents','put','/:id','delete','removeAgents','exports'];(function(_0x332174,_0x500661){var _0x391fa4=function(_0x380304){while(--_0x380304){_0x332174['push'](_0x332174['shift']());}};_0x391fa4(++_0x500661);}(_0x4d87,0x1a4));var _0x74d8=function(_0x23f83b,_0x4fd76e){_0x23f83b=_0x23f83b-0x0;var _0x36a1d3=_0x4d87[_0x23f83b];return _0x36a1d3;};'use strict';var multer=require(_0x74d8('0x0'));var util=require(_0x74d8('0x1'));var path=require(_0x74d8('0x2'));var timeout=require(_0x74d8('0x3'));var express=require(_0x74d8('0x4'));var router=express[_0x74d8('0x5')]();var fs_extra=require(_0x74d8('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x74d8('0x7'));var config=require(_0x74d8('0x8'));var controller=require(_0x74d8('0x9'));router[_0x74d8('0xa')]('/',auth['isAuthenticated'](),controller[_0x74d8('0xb')]);router[_0x74d8('0xa')]('/describe',auth[_0x74d8('0xc')](),controller[_0x74d8('0xd')]);router[_0x74d8('0xa')]('/:id',auth['isAuthenticated'](),controller[_0x74d8('0xe')]);router[_0x74d8('0xa')](_0x74d8('0xf'),auth[_0x74d8('0xc')](),controller[_0x74d8('0x10')]);router[_0x74d8('0xa')](_0x74d8('0x11'),auth[_0x74d8('0xc')](),controller[_0x74d8('0x12')]);router[_0x74d8('0xa')](_0x74d8('0x13'),auth[_0x74d8('0xc')](),controller[_0x74d8('0x14')]);router['post']('/',auth[_0x74d8('0xc')](),controller[_0x74d8('0x15')]);router['post'](_0x74d8('0x11'),auth['isAuthenticated'](),controller[_0x74d8('0x16')]);router[_0x74d8('0x17')](_0x74d8('0x13'),auth[_0x74d8('0xc')](),controller[_0x74d8('0x18')]);router[_0x74d8('0x19')](_0x74d8('0x1a'),auth[_0x74d8('0xc')](),controller['update']);router[_0x74d8('0x1b')]('/:id',auth['isAuthenticated'](),controller['destroy']);router[_0x74d8('0x1b')]('/:id/teams',auth[_0x74d8('0xc')](),controller['removeTeams']);router[_0x74d8('0x1b')](_0x74d8('0x13'),auth[_0x74d8('0xc')](),controller[_0x74d8('0x1c')]);module[_0x74d8('0x1d')]=router; \ No newline at end of file +var _0xb2b7=['multer','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./openchannelQueue.controller','get','isAuthenticated','index','describe','/:id','show','/:id/members','/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams','addAgents','put','update','destroy','removeTeams','delete','exports'];(function(_0x2f3947,_0x2ee083){var _0x3e6ab7=function(_0x4057c0){while(--_0x4057c0){_0x2f3947['push'](_0x2f3947['shift']());}};_0x3e6ab7(++_0x2ee083);}(_0xb2b7,0x179));var _0x7b2b=function(_0x298aed,_0x4334ce){_0x298aed=_0x298aed-0x0;var _0x58edbc=_0xb2b7[_0x298aed];return _0x58edbc;};'use strict';var multer=require(_0x7b2b('0x0'));var util=require('util');var path=require(_0x7b2b('0x1'));var timeout=require(_0x7b2b('0x2'));var express=require(_0x7b2b('0x3'));var router=express[_0x7b2b('0x4')]();var fs_extra=require(_0x7b2b('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x7b2b('0x6'));var config=require('../../config/environment');var controller=require(_0x7b2b('0x7'));router[_0x7b2b('0x8')]('/',auth[_0x7b2b('0x9')](),controller[_0x7b2b('0xa')]);router[_0x7b2b('0x8')]('/describe',auth[_0x7b2b('0x9')](),controller[_0x7b2b('0xb')]);router[_0x7b2b('0x8')](_0x7b2b('0xc'),auth[_0x7b2b('0x9')](),controller[_0x7b2b('0xd')]);router['get'](_0x7b2b('0xe'),auth['isAuthenticated'](),controller['getMembers']);router[_0x7b2b('0x8')](_0x7b2b('0xf'),auth[_0x7b2b('0x9')](),controller[_0x7b2b('0x10')]);router[_0x7b2b('0x8')](_0x7b2b('0x11'),auth['isAuthenticated'](),controller[_0x7b2b('0x12')]);router[_0x7b2b('0x13')]('/',auth[_0x7b2b('0x9')](),controller[_0x7b2b('0x14')]);router[_0x7b2b('0x13')]('/:id/teams',auth['isAuthenticated'](),controller[_0x7b2b('0x15')]);router[_0x7b2b('0x13')]('/:id/users',auth['isAuthenticated'](),controller[_0x7b2b('0x16')]);router[_0x7b2b('0x17')]('/:id',auth['isAuthenticated'](),controller[_0x7b2b('0x18')]);router['delete']('/:id',auth[_0x7b2b('0x9')](),controller[_0x7b2b('0x19')]);router['delete'](_0x7b2b('0xf'),auth[_0x7b2b('0x9')](),controller[_0x7b2b('0x1a')]);router[_0x7b2b('0x1b')](_0x7b2b('0x11'),auth['isAuthenticated'](),controller['removeAgents']);module[_0x7b2b('0x1c')]=router; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.attributes.js b/server/api/openchannelQueue/openchannelQueue.attributes.js index de40bb5..006508c 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 _0x2264=['STRING','name','INTEGER','ENUM','rrmemory','roundrobin','sequelize','exports'];(function(_0x3780cb,_0x1f9f7f){var _0x457ad9=function(_0x722822){while(--_0x722822){_0x3780cb['push'](_0x3780cb['shift']());}};_0x457ad9(++_0x1f9f7f);}(_0x2264,0x1a6));var _0x4226=function(_0x28d345,_0x258c0a){_0x28d345=_0x28d345-0x0;var _0x412cd8=_0x2264[_0x28d345];return _0x412cd8;};'use strict';var Sequelize=require(_0x4226('0x0'));module[_0x4226('0x1')]={'name':{'type':Sequelize[_0x4226('0x2')],'unique':_0x4226('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x4226('0x2')]},'timeout':{'type':Sequelize[_0x4226('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x4226('0x5')](_0x4226('0x6'),'beepall',_0x4226('0x7'))}}; \ No newline at end of file +var _0xc893=['name','INTEGER','ENUM','rrmemory','sequelize','STRING'];(function(_0x4b8da0,_0x24a5c7){var _0xd8024=function(_0x4734dc){while(--_0x4734dc){_0x4b8da0['push'](_0x4b8da0['shift']());}};_0xd8024(++_0x24a5c7);}(_0xc893,0x7c));var _0x3c89=function(_0x5a18f2,_0x2286ad){_0x5a18f2=_0x5a18f2-0x0;var _0x542682=_0xc893[_0x5a18f2];return _0x542682;};'use strict';var Sequelize=require(_0x3c89('0x0'));module['exports']={'name':{'type':Sequelize[_0x3c89('0x1')],'unique':_0x3c89('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0x3c89('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x3c89('0x4')](_0x3c89('0x5'),'beepall','roundrobin')}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.controller.js b/server/api/openchannelQueue/openchannelQueue.controller.js index 6a41841..8fa00d7 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 _0x92f5=['nolimit','order','sort','where','pick','filter','merge','User','findAndCountAll','agent','openchannelPause','updatedAt','createdAt','rows','format','SIP','getTeams','hasOwnProperty','addTeams','ids','Team','flatMap','sequelize','transaction','each','findOrCreate','forEach','emit','userOpenchannelQueue:save','removeTeams','Agents','select','from','team_has_openchannel_queues','user_has_teams','OpenchannelQueueId\x20=\x20?','push','toString','SELECT','every','TeamId','includes','all','union','compact','value','isEmpty','removeAgents','userOpenchannelQueue:remove','omit','getAgents','bluebird','util','lodash','squel','ioredis','../../components/parsers/qs','api','../../config/environment','../../mysqldb','redis','defaults','localhost','./openchannelQueue.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','update','destroy','then','OpenchannelQueues','error','name','send','index','map','OpenchannelQueue','rawAttributes','fieldName','type','key','getOptions','include','findAll','catch','params','model','keys','query','filters','intersection','fields','attributes','length','includeAll','options','find','create','body','user','get','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','UserOpenchannelQueue'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x92f5,0xa6));var _0x592f=function(_0xc051b2,_0x3d6d9d){_0xc051b2=_0xc051b2-0x0;var _0x599dc2=_0x92f5[_0xc051b2];return _0x599dc2;};'use strict';var BPromise=require(_0x592f('0x0'));var util=require(_0x592f('0x1'));var _=require(_0x592f('0x2'));var squel=require(_0x592f('0x3'));var Redis=require(_0x592f('0x4'));var qs=require(_0x592f('0x5'));var logger=require('../../config/logger')(_0x592f('0x6'));var config=require(_0x592f('0x7'));var db=require(_0x592f('0x8'))['db'];config[_0x592f('0x9')]=_[_0x592f('0xa')](config[_0x592f('0x9')],{'host':_0x592f('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x592f('0x9')]));require(_0x592f('0xc'))[_0x592f('0xd')](socket);function respondWithStatusCode(_0x14ef3f,_0x49f303){_0x49f303=_0x49f303||0xcc;return function(_0x35cf4a){if(_0x35cf4a){return _0x14ef3f[_0x592f('0xe')](_0x49f303);}return _0x14ef3f[_0x592f('0xf')](_0x49f303)[_0x592f('0x10')]();};}function respondWithResult(_0x4be3d8,_0x3dd9d7){_0x3dd9d7=_0x3dd9d7||0xc8;return function(_0x40fd6){if(_0x40fd6){return _0x4be3d8[_0x592f('0xf')](_0x3dd9d7)[_0x592f('0x11')](_0x40fd6);}};}function respondWithFilteredResult(_0x4b2a8a,_0x7c43f3){return function(_0x364f3c){if(_0x364f3c){var _0x529bf0=typeof _0x7c43f3[_0x592f('0x12')]===_0x592f('0x13')&&typeof _0x7c43f3[_0x592f('0x14')]===_0x592f('0x13');var _0x4ca4ba=_0x364f3c[_0x592f('0x15')];var _0x22574e=_0x529bf0?0x0:_0x7c43f3[_0x592f('0x12')];var _0x3c0e8a=_0x529bf0?_0x364f3c['count']:_0x7c43f3[_0x592f('0x12')]+_0x7c43f3[_0x592f('0x14')];var _0xe8e6dd;if(_0x3c0e8a>=_0x4ca4ba){_0x3c0e8a=_0x4ca4ba;_0xe8e6dd=0xc8;}else{_0xe8e6dd=0xce;}_0x4b2a8a['status'](_0xe8e6dd);return _0x4b2a8a[_0x592f('0x16')]('Content-Range',_0x22574e+'-'+_0x3c0e8a+'/'+_0x4ca4ba)[_0x592f('0x11')](_0x364f3c);}return null;};}function saveUpdates(_0x4b9121){return function(_0x5ec784){if(_0x5ec784){return _0x5ec784[_0x592f('0x17')](_0x4b9121)['then'](function(_0x4b4fa7){return _0x4b4fa7;});}return null;};}function removeEntity(_0x4ce4b2){return function(_0x11d156){if(_0x11d156){return _0x11d156[_0x592f('0x18')]()[_0x592f('0x19')](function(){var _0x89cfed=_0x11d156['get']({'plain':!![]});var _0x2afffa=_0x592f('0x1a');return db['UserProfileResource']['destroy']({'where':{'type':_0x2afffa,'resourceId':_0x89cfed['id']}})[_0x592f('0x19')](function(){return _0x11d156;});})[_0x592f('0x19')](function(){_0x4ce4b2['status'](0xcc)[_0x592f('0x10')]();});}};}function handleEntityNotFound(_0x4cde10){return function(_0xdd16b6){if(!_0xdd16b6){_0x4cde10[_0x592f('0xe')](0x194);}return _0xdd16b6;};}function handleError(_0x241edc,_0x184cf2){_0x184cf2=_0x184cf2||0x1f4;return function(_0x1961f1){logger[_0x592f('0x1b')](_0x1961f1['stack']);if(_0x1961f1[_0x592f('0x1c')]){delete _0x1961f1[_0x592f('0x1c')];}_0x241edc['status'](_0x184cf2)[_0x592f('0x1d')](_0x1961f1);};}exports[_0x592f('0x1e')]=function(_0x2c3168,_0x243e97){var _0x334165={};var _0x1f7057={'count':0x0,'rows':[]};var _0x2a0710=_[_0x592f('0x1f')](db[_0x592f('0x20')][_0x592f('0x21')],function(_0x1dc966){return{'name':_0x1dc966[_0x592f('0x22')],'type':_0x1dc966[_0x592f('0x23')][_0x592f('0x24')]};});_0x334165=qs[_0x592f('0x25')](_0x2a0710,_0x2c3168);var _0xa32aed={'where':_0x334165['where']};return db[_0x592f('0x20')][_0x592f('0x15')](_0xa32aed)[_0x592f('0x19')](function(_0x36da45){_0x1f7057[_0x592f('0x15')]=_0x36da45;_0x334165[_0x592f('0x26')]=qs[_0x592f('0x26')](_0x2c3168['query']);return db['OpenchannelQueue'][_0x592f('0x27')](_0x334165);})['then'](function(_0x4b3666){_0x1f7057['rows']=_0x4b3666;return _0x1f7057;})[_0x592f('0x19')](respondWithFilteredResult(_0x243e97,_0x334165))[_0x592f('0x28')](handleError(_0x243e97,null));};exports['show']=function(_0x25977a,_0x2d440a){var _0x34d07c={'raw':!![],'where':{'id':_0x25977a[_0x592f('0x29')]['id']}},_0x1c1142={};_0x1c1142[_0x592f('0x2a')]=_[_0x592f('0x2b')](db[_0x592f('0x20')]['rawAttributes']);_0x1c1142[_0x592f('0x2c')]=_[_0x592f('0x2b')](_0x25977a['query']);_0x1c1142[_0x592f('0x2d')]=_[_0x592f('0x2e')](_0x1c1142[_0x592f('0x2a')],_0x1c1142['query']);_0x34d07c['attributes']=_[_0x592f('0x2e')](_0x1c1142[_0x592f('0x2a')],qs[_0x592f('0x2f')](_0x25977a[_0x592f('0x2c')][_0x592f('0x2f')]));_0x34d07c['attributes']=_0x34d07c[_0x592f('0x30')][_0x592f('0x31')]?_0x34d07c[_0x592f('0x30')]:_0x1c1142[_0x592f('0x2a')];if(_0x25977a[_0x592f('0x2c')][_0x592f('0x32')]){_0x34d07c[_0x592f('0x26')]=[{'all':!![]}];}_0x34d07c=_['merge']({},_0x34d07c,_0x25977a[_0x592f('0x33')]);return db[_0x592f('0x20')][_0x592f('0x34')](_0x34d07c)[_0x592f('0x19')](handleEntityNotFound(_0x2d440a,null))[_0x592f('0x19')](respondWithResult(_0x2d440a,null))[_0x592f('0x28')](handleError(_0x2d440a,null));};exports[_0x592f('0x35')]=function(_0x475c71,_0x3458d8){return db[_0x592f('0x20')][_0x592f('0x35')](_0x475c71[_0x592f('0x36')],{})[_0x592f('0x19')](function(_0x2c05d0){var _0x3f60e3=_0x475c71['user']['get']({'plain':!![]});if(!_0x3f60e3)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3f60e3['role']===_0x592f('0x37')){var _0x5c7583=_0x2c05d0[_0x592f('0x38')]({'plain':!![]});var _0x1c11c8=_0x592f('0x1a');return db[_0x592f('0x39')][_0x592f('0x34')]({'where':{'name':_0x1c11c8,'userProfileId':_0x3f60e3['userProfileId']},'raw':!![]})[_0x592f('0x19')](function(_0x2c3709){if(_0x2c3709&&_0x2c3709[_0x592f('0x3a')]===0x0){return db['UserProfileResource']['create']({'name':_0x5c7583['name'],'resourceId':_0x5c7583['id'],'type':_0x2c3709[_0x592f('0x1c')],'sectionId':_0x2c3709['id']},{})[_0x592f('0x19')](function(){return _0x2c05d0;});}else{return _0x2c05d0;}})[_0x592f('0x28')](function(_0x180013){logger[_0x592f('0x1b')](_0x592f('0x3b'),_0x180013);throw _0x180013;});}return _0x2c05d0;})[_0x592f('0x19')](respondWithResult(_0x3458d8,0xc9))['catch'](handleError(_0x3458d8,null));};exports['update']=function(_0x603ff2,_0x50c647){if(_0x603ff2[_0x592f('0x36')]['id']){delete _0x603ff2[_0x592f('0x36')]['id'];}return db['OpenchannelQueue'][_0x592f('0x34')]({'where':{'id':_0x603ff2['params']['id']}})[_0x592f('0x19')](handleEntityNotFound(_0x50c647,null))[_0x592f('0x19')](saveUpdates(_0x603ff2[_0x592f('0x36')],null))['then'](respondWithResult(_0x50c647,null))[_0x592f('0x28')](handleError(_0x50c647,null));};exports[_0x592f('0x18')]=function(_0xd08e00,_0x45e833){return db[_0x592f('0x20')][_0x592f('0x34')]({'where':{'id':_0xd08e00[_0x592f('0x29')]['id']}})[_0x592f('0x19')](handleEntityNotFound(_0x45e833,null))[_0x592f('0x19')](removeEntity(_0x45e833,null))[_0x592f('0x28')](handleError(_0x45e833,null));};exports['describe']=function(_0x42de8c,_0x1e8f6e){return db['OpenchannelQueue'][_0x592f('0x3c')]()[_0x592f('0x19')](respondWithResult(_0x1e8f6e,null))[_0x592f('0x28')](handleError(_0x1e8f6e,null));};exports[_0x592f('0x3d')]=function(_0x3f74b0,_0x3dd7a9){var _0x4bc1e={'raw':!![],'where':{}},_0x46557b={},_0x4d0be4;return db[_0x592f('0x20')][_0x592f('0x3e')]({'where':{'id':_0x3f74b0[_0x592f('0x29')]['id']}})[_0x592f('0x19')](handleEntityNotFound(_0x3dd7a9,null))['then'](function(_0x161ad3){if(_0x161ad3){_0x4d0be4=_0x161ad3[_0x592f('0x38')]({'plain':!![]});_0x46557b[_0x592f('0x2a')]=_[_0x592f('0x2b')](db[_0x592f('0x3f')][_0x592f('0x21')]);_0x46557b[_0x592f('0x2c')]=_['keys'](_0x3f74b0[_0x592f('0x2c')]);_0x46557b['filters']=_[_0x592f('0x2e')](_0x46557b[_0x592f('0x2a')],_0x46557b['query']);_0x4bc1e[_0x592f('0x30')]=_[_0x592f('0x2e')](_0x46557b['model'],qs[_0x592f('0x2f')](_0x3f74b0[_0x592f('0x2c')]['fields']));_0x4bc1e['attributes']=_0x4bc1e[_0x592f('0x30')][_0x592f('0x31')]?_0x4bc1e[_0x592f('0x30')]:_0x46557b[_0x592f('0x2a')];if(!_0x3f74b0[_0x592f('0x2c')]['hasOwnProperty'](_0x592f('0x40'))){_0x4bc1e['limit']=qs[_0x592f('0x14')](_0x3f74b0[_0x592f('0x2c')][_0x592f('0x14')]);_0x4bc1e[_0x592f('0x12')]=qs[_0x592f('0x12')](_0x3f74b0[_0x592f('0x2c')][_0x592f('0x12')]);}_0x4bc1e[_0x592f('0x41')]=qs[_0x592f('0x42')](_0x3f74b0[_0x592f('0x2c')][_0x592f('0x42')]);_0x4bc1e[_0x592f('0x43')]=qs[_0x592f('0x2d')](_[_0x592f('0x44')](_0x3f74b0[_0x592f('0x2c')],_0x46557b['filters']));_0x4bc1e[_0x592f('0x43')]['OpenchannelQueueId']=_0x161ad3['id'];if(_0x3f74b0['query'][_0x592f('0x45')]){_0x4bc1e[_0x592f('0x43')]=_[_0x592f('0x46')](_0x4bc1e[_0x592f('0x43')],{'$or':_[_0x592f('0x1f')](_0x4bc1e[_0x592f('0x30')],function(_0x5b0cd1){var _0x307d60={};_0x307d60[_0x5b0cd1]={'$like':'%'+_0x3f74b0[_0x592f('0x2c')][_0x592f('0x45')]+'%'};return _0x307d60;})});}_0x4bc1e=_[_0x592f('0x46')]({},_0x4bc1e,_0x3f74b0[_0x592f('0x33')]);return db[_0x592f('0x3f')][_0x592f('0x27')](_0x4bc1e);}})['then'](function(_0xeba10c){if(_0xeba10c){return db[_0x592f('0x47')][_0x592f('0x48')]({'where':{'id':_[_0x592f('0x1f')](_0xeba10c,'UserId'),'role':_0x592f('0x49')},'attributes':['id',_0x592f('0x1c'),_0x592f('0x4a'),_0x592f('0x4b'),_0x592f('0x4c')]});}})[_0x592f('0x19')](function(_0x51daa9){if(_0x51daa9){return{'count':_0x51daa9[_0x592f('0x15')],'rows':_[_0x592f('0x1f')](_0x51daa9[_0x592f('0x4d')],function(_0x54897b){return{'membername':_0x54897b[_0x592f('0x1c')],'UserId':_0x54897b['id'],'queue_name':_0x4d0be4[_0x592f('0x1c')],'OpenchannelQueueId':_0x4d0be4['id'],'interface':util[_0x592f('0x4e')]('%s/%s',_0x592f('0x4f'),_0x54897b[_0x592f('0x1c')]),'penalty':0x0,'paused':_0x54897b[_0x592f('0x4a')],'createdAt':_0x54897b[_0x592f('0x4c')],'updatedAt':_0x54897b[_0x592f('0x4b')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x592f('0x19')](respondWithFilteredResult(_0x3dd7a9,_0x4bc1e))['catch'](handleError(_0x3dd7a9,null));};exports['getTeams']=function(_0x446275,_0x861792){var _0x1f6553={};var _0x1cc360={};var _0x2a7cef;var _0x3732a9;return db[_0x592f('0x20')][_0x592f('0x3e')]({'where':{'id':_0x446275['params']['id']}})[_0x592f('0x19')](handleEntityNotFound(_0x861792,null))[_0x592f('0x19')](function(_0x5640ab){if(_0x5640ab){_0x2a7cef=_0x5640ab;_0x1cc360[_0x592f('0x2a')]=_[_0x592f('0x2b')](db['Team'][_0x592f('0x21')]);_0x1cc360[_0x592f('0x2c')]=_['keys'](_0x446275[_0x592f('0x2c')]);_0x1cc360['filters']=_[_0x592f('0x2e')](_0x1cc360[_0x592f('0x2a')],_0x1cc360[_0x592f('0x2c')]);_0x1f6553['attributes']=_[_0x592f('0x2e')](_0x1cc360[_0x592f('0x2a')],qs['fields'](_0x446275[_0x592f('0x2c')][_0x592f('0x2f')]));_0x1f6553[_0x592f('0x30')]=_0x1f6553[_0x592f('0x30')]['length']?_0x1f6553['attributes']:_0x1cc360[_0x592f('0x2a')];_0x1f6553[_0x592f('0x41')]=qs[_0x592f('0x42')](_0x446275['query'][_0x592f('0x42')]);_0x1f6553[_0x592f('0x43')]=qs[_0x592f('0x2d')](_[_0x592f('0x44')](_0x446275[_0x592f('0x2c')],_0x1cc360['filters']));if(_0x446275[_0x592f('0x2c')][_0x592f('0x45')]){_0x1f6553[_0x592f('0x43')]=_[_0x592f('0x46')](_0x1f6553[_0x592f('0x43')],{'$or':_[_0x592f('0x1f')](_0x1f6553[_0x592f('0x30')],function(_0x1d6363){var _0xf94579={};_0xf94579[_0x1d6363]={'$like':'%'+_0x446275[_0x592f('0x2c')][_0x592f('0x45')]+'%'};return _0xf94579;})});}_0x1f6553=_[_0x592f('0x46')]({},_0x1f6553,_0x446275['options']);return _0x2a7cef[_0x592f('0x50')](_0x1f6553);}})[_0x592f('0x19')](function(_0xa485fa){if(_0xa485fa){_0x3732a9=_0xa485fa['length'];if(!_0x446275[_0x592f('0x2c')][_0x592f('0x51')]('nolimit')){_0x1f6553[_0x592f('0x14')]=qs[_0x592f('0x14')](_0x446275[_0x592f('0x2c')][_0x592f('0x14')]);_0x1f6553[_0x592f('0x12')]=qs[_0x592f('0x12')](_0x446275[_0x592f('0x2c')]['offset']);}return _0x2a7cef['getTeams'](_0x1f6553);}})['then'](function(_0x199a75){if(_0x199a75){return _0x199a75?{'count':_0x3732a9,'rows':_0x199a75}:null;}})[_0x592f('0x19')](respondWithResult(_0x861792,null))[_0x592f('0x28')](handleError(_0x861792,null));};exports[_0x592f('0x52')]=function(_0x121d6d,_0x3b5b4c){var _0x5b5071=_0x121d6d['body'][_0x592f('0x53')];return db[_0x592f('0x54')]['findAll']({'where':{'id':_0x5b5071},'attributes':['id'],'include':[{'model':db[_0x592f('0x47')],'as':'Agents','attributes':['id','name','online','voicePause','interface'],'raw':!![]}]})['then'](function(_0x240323){if(_0x240323){var _0x19983d=_[_0x592f('0x55')](_0x240323,function(_0x625fa2){var _0x291cbc=_0x625fa2['get']({'plain':!![]});return _0x291cbc['Agents'];});return db[_0x592f('0x20')][_0x592f('0x34')]({'where':{'id':_0x121d6d['params']['id']}})[_0x592f('0x19')](function(_0x1b9a9b){return db[_0x592f('0x56')][_0x592f('0x57')](function(_0x26b0e0){return _0x1b9a9b[_0x592f('0x52')](_0x5b5071,{'transaction':_0x26b0e0})[_0x592f('0x19')](function(){return BPromise[_0x592f('0x58')](_0x19983d,function(_0x17509f){return db['UserOpenchannelQueue'][_0x592f('0x59')]({'where':{'UserId':_0x17509f['id'],'OpenchannelQueueId':_0x121d6d[_0x592f('0x29')]['id']},'transaction':_0x26b0e0});});})[_0x592f('0x19')](function(){_0x19983d[_0x592f('0x5a')](function(_0x513bce){socket[_0x592f('0x5b')](_0x592f('0x5c'),{'UserId':_0x513bce['id'],'OpenchannelQueueId':_0x1b9a9b['id']});});});});});}})[_0x592f('0x19')](respondWithStatusCode(_0x3b5b4c,null))[_0x592f('0x28')](handleError(_0x3b5b4c,null));};exports[_0x592f('0x5d')]=function(_0x1a81c8,_0x17eea8){return db[_0x592f('0x54')]['findAll']({'where':{'id':_0x1a81c8['query'][_0x592f('0x53')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0x592f('0x5e'),'attributes':['id'],'raw':!![]}]})[_0x592f('0x19')](handleEntityNotFound(_0x17eea8,null))[_0x592f('0x19')](function(_0x14ca39){var _0x17f1d1=_['map'](_0x14ca39,'id');var _0x2d1f40=[];var _0x122cda=[];var _0x3b9cf4=squel[_0x592f('0x5f')]();_0x3b9cf4['field']('tq.TeamId')[_0x592f('0x60')](_0x592f('0x61'),'tq')['join'](_0x592f('0x62'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0x592f('0x43')](_0x592f('0x63'),_0x1a81c8[_0x592f('0x29')]['id']);for(var _0x17de01=0x0;_0x17de01<_0x14ca39['length'];_0x17de01+=0x1){let _0x15071e=_0x14ca39[_0x17de01];for(var _0x1b94ec=0x0;_0x1b94ec<_0x15071e[_0x592f('0x5e')][_0x592f('0x31')];_0x1b94ec+=0x1){let _0x3f77b6=_0x15071e[_0x592f('0x5e')][_0x1b94ec];var _0x57a4ba=_0x3b9cf4['clone']();_0x57a4ba[_0x592f('0x43')]('ut.UserId\x20=\x20?',_0x3f77b6['id']);_0x122cda[_0x592f('0x64')](db[_0x592f('0x56')][_0x592f('0x2c')](_0x57a4ba[_0x592f('0x65')](),{'type':db['sequelize']['QueryTypes'][_0x592f('0x66')]})[_0x592f('0x19')](function(_0x10eb83){if(_0x10eb83['length']===0x1){return _0x3f77b6['id'];}else{var _0x534afc=_[_0x592f('0x67')](_['map'](_0x10eb83,_0x592f('0x68')),function(_0xcb29de){return _[_0x592f('0x69')](_0x17f1d1,_0xcb29de);});if(_0x534afc){return _0x3f77b6['id'];}}}));}}return BPromise[_0x592f('0x6a')](_0x122cda)[_0x592f('0x19')](function(_0x148c52){_0x2d1f40=_(_0x2d1f40)[_0x592f('0x6b')](_0x148c52)[_0x592f('0x6c')]()[_0x592f('0x6d')]();return db[_0x592f('0x20')][_0x592f('0x34')]({'where':{'id':_0x1a81c8['params']['id']}})[_0x592f('0x19')](function(_0x2fa547){return db[_0x592f('0x56')][_0x592f('0x57')](function(_0x3842b3){return _0x2fa547[_0x592f('0x5d')](_0x1a81c8[_0x592f('0x2c')][_0x592f('0x53')],{'transaction':_0x3842b3})[_0x592f('0x19')](function(){if(!_[_0x592f('0x6e')](_0x2d1f40)){return _0x2fa547[_0x592f('0x6f')](_0x2d1f40,{'transaction':_0x3842b3});}})['then'](function(){_0x2d1f40[_0x592f('0x5a')](function(_0x2cac33){socket[_0x592f('0x5b')](_0x592f('0x70'),{'UserId':_0x2cac33,'OpenchannelQueueId':_0x2fa547['id']});});});});});});})[_0x592f('0x19')](respondWithStatusCode(_0x17eea8,null))['catch'](handleError(_0x17eea8,null));};exports['addAgents']=function(_0x4608db,_0x3e69df){return db[_0x592f('0x20')][_0x592f('0x34')]({'where':{'id':_0x4608db[_0x592f('0x29')]['id']}})[_0x592f('0x19')](handleEntityNotFound(_0x3e69df,null))[_0x592f('0x19')](function(_0x42a12c){if(_0x42a12c){return _0x42a12c['addAgents'](_0x4608db[_0x592f('0x36')][_0x592f('0x53')],_[_0x592f('0x71')](_0x4608db[_0x592f('0x36')],[_0x592f('0x53'),'id'])||{})['spread'](function(_0x492f48){for(var _0x2f7b72=0x0;_0x2f7b72<_0x4608db[_0x592f('0x36')][_0x592f('0x53')][_0x592f('0x31')];_0x2f7b72+=0x1){socket[_0x592f('0x5b')](_0x592f('0x5c'),{'UserId':Number(_0x4608db[_0x592f('0x36')][_0x592f('0x53')][_0x2f7b72]),'OpenchannelQueueId':Number(_0x4608db[_0x592f('0x29')]['id'])});}return _0x492f48;});}})[_0x592f('0x19')](respondWithResult(_0x3e69df,null))[_0x592f('0x28')](handleError(_0x3e69df,null));};exports[_0x592f('0x6f')]=function(_0x252856,_0x85a5f3){return db[_0x592f('0x20')][_0x592f('0x34')]({'where':{'id':_0x252856['params']['id']}})[_0x592f('0x19')](handleEntityNotFound(_0x85a5f3,null))[_0x592f('0x19')](function(_0x5b0884){if(_0x5b0884){return _0x5b0884[_0x592f('0x6f')](_0x252856[_0x592f('0x2c')][_0x592f('0x53')])['then'](function(){if(_['isArray'](_0x252856[_0x592f('0x2c')][_0x592f('0x53')])){for(var _0x2fae2d=0x0;_0x2fae2d<_0x252856['query'][_0x592f('0x53')][_0x592f('0x31')];_0x2fae2d+=0x1){socket[_0x592f('0x5b')](_0x592f('0x70'),{'UserId':Number(_0x252856[_0x592f('0x2c')][_0x592f('0x53')][_0x2fae2d]),'OpenchannelQueueId':Number(_0x252856[_0x592f('0x29')]['id'])});}}else{socket[_0x592f('0x5b')]('userOpenchannelQueue:remove',{'UserId':Number(_0x252856[_0x592f('0x2c')][_0x592f('0x53')]),'OpenchannelQueueId':Number(_0x252856[_0x592f('0x29')]['id'])});}});}})[_0x592f('0x19')](respondWithStatusCode(_0x85a5f3,null))[_0x592f('0x28')](handleError(_0x85a5f3,null));};exports[_0x592f('0x72')]=function(_0x7fe1d9,_0x1cfc3f){var _0xc15445={};var _0x36381f={};var _0x50e51d;var _0x5c5414;return db[_0x592f('0x20')]['findOne']({'where':{'id':_0x7fe1d9[_0x592f('0x29')]['id']}})[_0x592f('0x19')](handleEntityNotFound(_0x1cfc3f,null))[_0x592f('0x19')](function(_0x2fc62a){if(_0x2fc62a){_0x50e51d=_0x2fc62a;_0x36381f[_0x592f('0x2a')]=_[_0x592f('0x2b')](db[_0x592f('0x47')][_0x592f('0x21')]);_0x36381f[_0x592f('0x2c')]=_[_0x592f('0x2b')](_0x7fe1d9[_0x592f('0x2c')]);_0x36381f[_0x592f('0x2d')]=_[_0x592f('0x2e')](_0x36381f['model'],_0x36381f[_0x592f('0x2c')]);_0xc15445[_0x592f('0x30')]=_[_0x592f('0x2e')](_0x36381f[_0x592f('0x2a')],qs[_0x592f('0x2f')](_0x7fe1d9['query'][_0x592f('0x2f')]));_0xc15445[_0x592f('0x30')]=_0xc15445['attributes'][_0x592f('0x31')]?_0xc15445['attributes']:_0x36381f[_0x592f('0x2a')];_0xc15445['order']=qs[_0x592f('0x42')](_0x7fe1d9[_0x592f('0x2c')][_0x592f('0x42')]);_0xc15445[_0x592f('0x43')]=qs[_0x592f('0x2d')](_[_0x592f('0x44')](_0x7fe1d9['query'],_0x36381f[_0x592f('0x2d')]));if(_0x7fe1d9[_0x592f('0x2c')]['filter']){_0xc15445[_0x592f('0x43')]=_['merge'](_0xc15445[_0x592f('0x43')],{'$or':_[_0x592f('0x1f')](_0xc15445[_0x592f('0x30')],function(_0x25c94f){var _0x37e103={};_0x37e103[_0x25c94f]={'$like':'%'+_0x7fe1d9[_0x592f('0x2c')][_0x592f('0x45')]+'%'};return _0x37e103;})});}_0xc15445=_['merge']({},_0xc15445,_0x7fe1d9[_0x592f('0x33')]);return _0x50e51d[_0x592f('0x72')](_0xc15445);}})[_0x592f('0x19')](function(_0x33ba51){if(_0x33ba51){_0x5c5414=_0x33ba51[_0x592f('0x31')];if(!_0x7fe1d9[_0x592f('0x2c')][_0x592f('0x51')]('nolimit')){_0xc15445[_0x592f('0x14')]=qs[_0x592f('0x14')](_0x7fe1d9[_0x592f('0x2c')][_0x592f('0x14')]);_0xc15445[_0x592f('0x12')]=qs[_0x592f('0x12')](_0x7fe1d9[_0x592f('0x2c')][_0x592f('0x12')]);}return _0x50e51d[_0x592f('0x72')](_0xc15445);}})['then'](function(_0xcb4c65){if(_0xcb4c65){return _0xcb4c65?{'count':_0x5c5414,'rows':_0xcb4c65}:null;}})[_0x592f('0x19')](respondWithResult(_0x1cfc3f,null))[_0x592f('0x28')](handleError(_0x1cfc3f,null));}; \ No newline at end of file +var _0x1c36=['rows','show','model','rawAttributes','keys','filters','intersection','attributes','fields','length','includeAll','merge','options','catch','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','params','describe','getMembers','findOne','hasOwnProperty','nolimit','order','sort','filter','User','agent','openchannelPause','updatedAt','createdAt','format','%s/%s','SIP','getTeams','pick','addTeams','Team','Agents','voicePause','interface','flatMap','sequelize','transaction','each','UserOpenchannelQueue','forEach','emit','userOpenchannelQueue:save','removeTeams','select','field','from','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','OpenchannelQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','every','includes','all','union','value','ids','isEmpty','removeAgents','addAgents','omit','spread','isArray','userOpenchannelQueue:remove','getAgents','bluebird','lodash','squel','ioredis','../../components/parsers/qs','../../config/environment','defaults','localhost','socket.io-emitter','redis','./openchannelQueue.socket','register','sendStatus','status','end','json','offset','undefined','limit','set','Content-Range','update','then','destroy','OpenchannelQueues','UserProfileResource','error','stack','name','send','index','map','where','OpenchannelQueue','count','include','query','findAll'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x1c36,0x1ba));var _0x61c3=function(_0x21549c,_0x6d64d1){_0x21549c=_0x21549c-0x0;var _0x426cbd=_0x1c36[_0x21549c];return _0x426cbd;};'use strict';var BPromise=require(_0x61c3('0x0'));var util=require('util');var _=require(_0x61c3('0x1'));var squel=require(_0x61c3('0x2'));var Redis=require(_0x61c3('0x3'));var qs=require(_0x61c3('0x4'));var logger=require('../../config/logger')('api');var config=require(_0x61c3('0x5'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x61c3('0x6')](config['redis'],{'host':_0x61c3('0x7'),'port':0x18eb});var socket=require(_0x61c3('0x8'))(new Redis(config[_0x61c3('0x9')]));require(_0x61c3('0xa'))[_0x61c3('0xb')](socket);function respondWithStatusCode(_0xf2df4f,_0x574477){_0x574477=_0x574477||0xcc;return function(_0x32c396){if(_0x32c396){return _0xf2df4f[_0x61c3('0xc')](_0x574477);}return _0xf2df4f[_0x61c3('0xd')](_0x574477)[_0x61c3('0xe')]();};}function respondWithResult(_0x1834ae,_0x3b3f7d){_0x3b3f7d=_0x3b3f7d||0xc8;return function(_0x29729d){if(_0x29729d){return _0x1834ae[_0x61c3('0xd')](_0x3b3f7d)[_0x61c3('0xf')](_0x29729d);}};}function respondWithFilteredResult(_0x4779b7,_0x373c93){return function(_0x16b19f){if(_0x16b19f){var _0x17c81c=typeof _0x373c93[_0x61c3('0x10')]===_0x61c3('0x11')&&typeof _0x373c93[_0x61c3('0x12')]==='undefined';var _0xb36c71=_0x16b19f['count'];var _0x3d9610=_0x17c81c?0x0:_0x373c93[_0x61c3('0x10')];var _0x21dbaf=_0x17c81c?_0x16b19f['count']:_0x373c93[_0x61c3('0x10')]+_0x373c93[_0x61c3('0x12')];var _0x3eed26;if(_0x21dbaf>=_0xb36c71){_0x21dbaf=_0xb36c71;_0x3eed26=0xc8;}else{_0x3eed26=0xce;}_0x4779b7['status'](_0x3eed26);return _0x4779b7[_0x61c3('0x13')](_0x61c3('0x14'),_0x3d9610+'-'+_0x21dbaf+'/'+_0xb36c71)[_0x61c3('0xf')](_0x16b19f);}return null;};}function saveUpdates(_0xa992b8){return function(_0x1de264){if(_0x1de264){return _0x1de264[_0x61c3('0x15')](_0xa992b8)[_0x61c3('0x16')](function(_0x4f3841){return _0x4f3841;});}return null;};}function removeEntity(_0x5a6168){return function(_0x514462){if(_0x514462){return _0x514462[_0x61c3('0x17')]()[_0x61c3('0x16')](function(){var _0x356d54=_0x514462['get']({'plain':!![]});var _0x110345=_0x61c3('0x18');return db[_0x61c3('0x19')][_0x61c3('0x17')]({'where':{'type':_0x110345,'resourceId':_0x356d54['id']}})[_0x61c3('0x16')](function(){return _0x514462;});})[_0x61c3('0x16')](function(){_0x5a6168[_0x61c3('0xd')](0xcc)[_0x61c3('0xe')]();});}};}function handleEntityNotFound(_0x5312dd){return function(_0x5b5ff1){if(!_0x5b5ff1){_0x5312dd[_0x61c3('0xc')](0x194);}return _0x5b5ff1;};}function handleError(_0x26a431,_0x11700c){_0x11700c=_0x11700c||0x1f4;return function(_0x51814e){logger[_0x61c3('0x1a')](_0x51814e[_0x61c3('0x1b')]);if(_0x51814e[_0x61c3('0x1c')]){delete _0x51814e[_0x61c3('0x1c')];}_0x26a431['status'](_0x11700c)[_0x61c3('0x1d')](_0x51814e);};}exports[_0x61c3('0x1e')]=function(_0x32369c,_0x1ae909){var _0x1c3df4={};var _0x1f85b9={'count':0x0,'rows':[]};var _0x2d3265=_[_0x61c3('0x1f')](db['OpenchannelQueue']['rawAttributes'],function(_0x30ac3d){return{'name':_0x30ac3d['fieldName'],'type':_0x30ac3d['type']['key']};});_0x1c3df4=qs['getOptions'](_0x2d3265,_0x32369c);var _0x33b12d={'where':_0x1c3df4[_0x61c3('0x20')]};return db[_0x61c3('0x21')]['count'](_0x33b12d)[_0x61c3('0x16')](function(_0x52dd61){_0x1f85b9[_0x61c3('0x22')]=_0x52dd61;_0x1c3df4['include']=qs[_0x61c3('0x23')](_0x32369c[_0x61c3('0x24')]);return db[_0x61c3('0x21')][_0x61c3('0x25')](_0x1c3df4);})['then'](function(_0xcdff94){_0x1f85b9[_0x61c3('0x26')]=_0xcdff94;return _0x1f85b9;})[_0x61c3('0x16')](respondWithFilteredResult(_0x1ae909,_0x1c3df4))['catch'](handleError(_0x1ae909,null));};exports[_0x61c3('0x27')]=function(_0x207ee6,_0x13ef84){var _0x8c4a2d={'raw':!![],'where':{'id':_0x207ee6['params']['id']}},_0x12a8b6={};_0x12a8b6[_0x61c3('0x28')]=_['keys'](db['OpenchannelQueue'][_0x61c3('0x29')]);_0x12a8b6['query']=_[_0x61c3('0x2a')](_0x207ee6[_0x61c3('0x24')]);_0x12a8b6[_0x61c3('0x2b')]=_[_0x61c3('0x2c')](_0x12a8b6[_0x61c3('0x28')],_0x12a8b6['query']);_0x8c4a2d[_0x61c3('0x2d')]=_['intersection'](_0x12a8b6[_0x61c3('0x28')],qs[_0x61c3('0x2e')](_0x207ee6[_0x61c3('0x24')]['fields']));_0x8c4a2d['attributes']=_0x8c4a2d[_0x61c3('0x2d')][_0x61c3('0x2f')]?_0x8c4a2d[_0x61c3('0x2d')]:_0x12a8b6[_0x61c3('0x28')];if(_0x207ee6[_0x61c3('0x24')][_0x61c3('0x30')]){_0x8c4a2d[_0x61c3('0x23')]=[{'all':!![]}];}_0x8c4a2d=_[_0x61c3('0x31')]({},_0x8c4a2d,_0x207ee6[_0x61c3('0x32')]);return db['OpenchannelQueue']['find'](_0x8c4a2d)[_0x61c3('0x16')](handleEntityNotFound(_0x13ef84,null))[_0x61c3('0x16')](respondWithResult(_0x13ef84,null))[_0x61c3('0x33')](handleError(_0x13ef84,null));};exports[_0x61c3('0x34')]=function(_0x3fc801,_0x3caa03){return db['OpenchannelQueue'][_0x61c3('0x34')](_0x3fc801[_0x61c3('0x35')],{})[_0x61c3('0x16')](function(_0x32a76d){var _0xa343a=_0x3fc801[_0x61c3('0x36')][_0x61c3('0x37')]({'plain':!![]});if(!_0xa343a)throw new Error(_0x61c3('0x38'));if(_0xa343a[_0x61c3('0x39')]===_0x61c3('0x36')){var _0x1d9c5b=_0x32a76d['get']({'plain':!![]});var _0x49e473='OpenchannelQueues';return db['UserProfileSection']['find']({'where':{'name':_0x49e473,'userProfileId':_0xa343a[_0x61c3('0x3a')]},'raw':!![]})[_0x61c3('0x16')](function(_0x46482b){if(_0x46482b&&_0x46482b['autoAssociation']===0x0){return db[_0x61c3('0x19')][_0x61c3('0x34')]({'name':_0x1d9c5b[_0x61c3('0x1c')],'resourceId':_0x1d9c5b['id'],'type':_0x46482b[_0x61c3('0x1c')],'sectionId':_0x46482b['id']},{})['then'](function(){return _0x32a76d;});}else{return _0x32a76d;}})[_0x61c3('0x33')](function(_0x582956){logger[_0x61c3('0x1a')](_0x61c3('0x3b'),_0x582956);throw _0x582956;});}return _0x32a76d;})['then'](respondWithResult(_0x3caa03,0xc9))[_0x61c3('0x33')](handleError(_0x3caa03,null));};exports[_0x61c3('0x15')]=function(_0x575257,_0x3c2291){if(_0x575257[_0x61c3('0x35')]['id']){delete _0x575257['body']['id'];}return db[_0x61c3('0x21')][_0x61c3('0x3c')]({'where':{'id':_0x575257[_0x61c3('0x3d')]['id']}})[_0x61c3('0x16')](handleEntityNotFound(_0x3c2291,null))[_0x61c3('0x16')](saveUpdates(_0x575257[_0x61c3('0x35')],null))[_0x61c3('0x16')](respondWithResult(_0x3c2291,null))[_0x61c3('0x33')](handleError(_0x3c2291,null));};exports[_0x61c3('0x17')]=function(_0x137ad1,_0x3cebb2){return db[_0x61c3('0x21')]['find']({'where':{'id':_0x137ad1[_0x61c3('0x3d')]['id']}})[_0x61c3('0x16')](handleEntityNotFound(_0x3cebb2,null))['then'](removeEntity(_0x3cebb2,null))[_0x61c3('0x33')](handleError(_0x3cebb2,null));};exports[_0x61c3('0x3e')]=function(_0x44fcb3,_0x13c2b5){return db[_0x61c3('0x21')]['describe']()[_0x61c3('0x16')](respondWithResult(_0x13c2b5,null))[_0x61c3('0x33')](handleError(_0x13c2b5,null));};exports[_0x61c3('0x3f')]=function(_0xa61d3c,_0x1ff060){var _0x4aa8c1={'raw':!![],'where':{}},_0x156454={},_0x53cec1;return db['OpenchannelQueue'][_0x61c3('0x40')]({'where':{'id':_0xa61d3c[_0x61c3('0x3d')]['id']}})[_0x61c3('0x16')](handleEntityNotFound(_0x1ff060,null))['then'](function(_0x3e053d){if(_0x3e053d){_0x53cec1=_0x3e053d[_0x61c3('0x37')]({'plain':!![]});_0x156454[_0x61c3('0x28')]=_[_0x61c3('0x2a')](db['UserOpenchannelQueue'][_0x61c3('0x29')]);_0x156454[_0x61c3('0x24')]=_[_0x61c3('0x2a')](_0xa61d3c['query']);_0x156454[_0x61c3('0x2b')]=_[_0x61c3('0x2c')](_0x156454['model'],_0x156454[_0x61c3('0x24')]);_0x4aa8c1[_0x61c3('0x2d')]=_[_0x61c3('0x2c')](_0x156454['model'],qs[_0x61c3('0x2e')](_0xa61d3c[_0x61c3('0x24')][_0x61c3('0x2e')]));_0x4aa8c1[_0x61c3('0x2d')]=_0x4aa8c1[_0x61c3('0x2d')][_0x61c3('0x2f')]?_0x4aa8c1[_0x61c3('0x2d')]:_0x156454['model'];if(!_0xa61d3c[_0x61c3('0x24')][_0x61c3('0x41')](_0x61c3('0x42'))){_0x4aa8c1[_0x61c3('0x12')]=qs[_0x61c3('0x12')](_0xa61d3c[_0x61c3('0x24')][_0x61c3('0x12')]);_0x4aa8c1[_0x61c3('0x10')]=qs['offset'](_0xa61d3c['query'][_0x61c3('0x10')]);}_0x4aa8c1[_0x61c3('0x43')]=qs['sort'](_0xa61d3c['query'][_0x61c3('0x44')]);_0x4aa8c1[_0x61c3('0x20')]=qs[_0x61c3('0x2b')](_['pick'](_0xa61d3c[_0x61c3('0x24')],_0x156454['filters']));_0x4aa8c1[_0x61c3('0x20')]['OpenchannelQueueId']=_0x3e053d['id'];if(_0xa61d3c['query'][_0x61c3('0x45')]){_0x4aa8c1[_0x61c3('0x20')]=_[_0x61c3('0x31')](_0x4aa8c1['where'],{'$or':_[_0x61c3('0x1f')](_0x4aa8c1['attributes'],function(_0x3b92fa){var _0x19405b={};_0x19405b[_0x3b92fa]={'$like':'%'+_0xa61d3c[_0x61c3('0x24')][_0x61c3('0x45')]+'%'};return _0x19405b;})});}_0x4aa8c1=_[_0x61c3('0x31')]({},_0x4aa8c1,_0xa61d3c[_0x61c3('0x32')]);return db['UserOpenchannelQueue']['findAll'](_0x4aa8c1);}})[_0x61c3('0x16')](function(_0x2e1cf8){if(_0x2e1cf8){return db[_0x61c3('0x46')]['findAndCountAll']({'where':{'id':_[_0x61c3('0x1f')](_0x2e1cf8,'UserId'),'role':_0x61c3('0x47')},'attributes':['id',_0x61c3('0x1c'),_0x61c3('0x48'),_0x61c3('0x49'),_0x61c3('0x4a')]});}})[_0x61c3('0x16')](function(_0x1dd467){if(_0x1dd467){return{'count':_0x1dd467[_0x61c3('0x22')],'rows':_['map'](_0x1dd467[_0x61c3('0x26')],function(_0x1a7573){return{'membername':_0x1a7573['name'],'UserId':_0x1a7573['id'],'queue_name':_0x53cec1['name'],'OpenchannelQueueId':_0x53cec1['id'],'interface':util[_0x61c3('0x4b')](_0x61c3('0x4c'),_0x61c3('0x4d'),_0x1a7573[_0x61c3('0x1c')]),'penalty':0x0,'paused':_0x1a7573[_0x61c3('0x48')],'createdAt':_0x1a7573[_0x61c3('0x4a')],'updatedAt':_0x1a7573['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x1ff060,_0x4aa8c1))[_0x61c3('0x33')](handleError(_0x1ff060,null));};exports[_0x61c3('0x4e')]=function(_0x26b404,_0x2fcb1a){var _0x5ee675={};var _0x535146={};var _0x43ae2a;var _0x3989d6;return db[_0x61c3('0x21')][_0x61c3('0x40')]({'where':{'id':_0x26b404[_0x61c3('0x3d')]['id']}})[_0x61c3('0x16')](handleEntityNotFound(_0x2fcb1a,null))[_0x61c3('0x16')](function(_0x303caa){if(_0x303caa){_0x43ae2a=_0x303caa;_0x535146[_0x61c3('0x28')]=_[_0x61c3('0x2a')](db['Team']['rawAttributes']);_0x535146[_0x61c3('0x24')]=_[_0x61c3('0x2a')](_0x26b404[_0x61c3('0x24')]);_0x535146[_0x61c3('0x2b')]=_['intersection'](_0x535146[_0x61c3('0x28')],_0x535146['query']);_0x5ee675[_0x61c3('0x2d')]=_['intersection'](_0x535146[_0x61c3('0x28')],qs[_0x61c3('0x2e')](_0x26b404[_0x61c3('0x24')][_0x61c3('0x2e')]));_0x5ee675[_0x61c3('0x2d')]=_0x5ee675['attributes'][_0x61c3('0x2f')]?_0x5ee675['attributes']:_0x535146[_0x61c3('0x28')];_0x5ee675['order']=qs[_0x61c3('0x44')](_0x26b404[_0x61c3('0x24')][_0x61c3('0x44')]);_0x5ee675['where']=qs[_0x61c3('0x2b')](_[_0x61c3('0x4f')](_0x26b404[_0x61c3('0x24')],_0x535146[_0x61c3('0x2b')]));if(_0x26b404['query'][_0x61c3('0x45')]){_0x5ee675['where']=_[_0x61c3('0x31')](_0x5ee675[_0x61c3('0x20')],{'$or':_['map'](_0x5ee675['attributes'],function(_0x56993a){var _0x297c90={};_0x297c90[_0x56993a]={'$like':'%'+_0x26b404[_0x61c3('0x24')][_0x61c3('0x45')]+'%'};return _0x297c90;})});}_0x5ee675=_[_0x61c3('0x31')]({},_0x5ee675,_0x26b404[_0x61c3('0x32')]);return _0x43ae2a[_0x61c3('0x4e')](_0x5ee675);}})[_0x61c3('0x16')](function(_0x1829a3){if(_0x1829a3){_0x3989d6=_0x1829a3[_0x61c3('0x2f')];if(!_0x26b404[_0x61c3('0x24')]['hasOwnProperty'](_0x61c3('0x42'))){_0x5ee675[_0x61c3('0x12')]=qs[_0x61c3('0x12')](_0x26b404['query'][_0x61c3('0x12')]);_0x5ee675[_0x61c3('0x10')]=qs[_0x61c3('0x10')](_0x26b404['query'][_0x61c3('0x10')]);}return _0x43ae2a[_0x61c3('0x4e')](_0x5ee675);}})[_0x61c3('0x16')](function(_0x26fec4){if(_0x26fec4){return _0x26fec4?{'count':_0x3989d6,'rows':_0x26fec4}:null;}})[_0x61c3('0x16')](respondWithResult(_0x2fcb1a,null))[_0x61c3('0x33')](handleError(_0x2fcb1a,null));};exports[_0x61c3('0x50')]=function(_0x4190bf,_0x1dab6e){var _0x545e59=_0x4190bf[_0x61c3('0x35')]['ids'];return db[_0x61c3('0x51')][_0x61c3('0x25')]({'where':{'id':_0x545e59},'attributes':['id'],'include':[{'model':db[_0x61c3('0x46')],'as':_0x61c3('0x52'),'attributes':['id','name','online',_0x61c3('0x53'),_0x61c3('0x54')],'raw':!![]}]})[_0x61c3('0x16')](function(_0x35330b){if(_0x35330b){var _0x46e4d8=_[_0x61c3('0x55')](_0x35330b,function(_0x303c13){var _0x4947c8=_0x303c13['get']({'plain':!![]});return _0x4947c8[_0x61c3('0x52')];});return db['OpenchannelQueue'][_0x61c3('0x3c')]({'where':{'id':_0x4190bf[_0x61c3('0x3d')]['id']}})[_0x61c3('0x16')](function(_0x1593d7){return db[_0x61c3('0x56')][_0x61c3('0x57')](function(_0x26cfe2){return _0x1593d7[_0x61c3('0x50')](_0x545e59,{'transaction':_0x26cfe2})[_0x61c3('0x16')](function(){return BPromise[_0x61c3('0x58')](_0x46e4d8,function(_0x526ea7){return db[_0x61c3('0x59')]['findOrCreate']({'where':{'UserId':_0x526ea7['id'],'OpenchannelQueueId':_0x4190bf[_0x61c3('0x3d')]['id']},'transaction':_0x26cfe2});});})[_0x61c3('0x16')](function(){_0x46e4d8[_0x61c3('0x5a')](function(_0x52bfeb){socket[_0x61c3('0x5b')](_0x61c3('0x5c'),{'UserId':_0x52bfeb['id'],'OpenchannelQueueId':_0x1593d7['id']});});});});});}})['then'](respondWithStatusCode(_0x1dab6e,null))['catch'](handleError(_0x1dab6e,null));};exports[_0x61c3('0x5d')]=function(_0x1df255,_0x25630b){return db[_0x61c3('0x51')][_0x61c3('0x25')]({'where':{'id':_0x1df255[_0x61c3('0x24')]['ids']},'attributes':['id'],'include':[{'model':db['User'],'as':_0x61c3('0x52'),'attributes':['id'],'raw':!![]}]})[_0x61c3('0x16')](handleEntityNotFound(_0x25630b,null))[_0x61c3('0x16')](function(_0x7e06f3){var _0x39f43a=_['map'](_0x7e06f3,'id');var _0x3c7b0f=[];var _0x21dae7=[];var _0x5df485=squel[_0x61c3('0x5e')]();_0x5df485[_0x61c3('0x5f')]('tq.TeamId')[_0x61c3('0x60')]('team_has_openchannel_queues','tq')[_0x61c3('0x61')](_0x61c3('0x62'),'ut',_0x61c3('0x63'))['where'](_0x61c3('0x64'),_0x1df255['params']['id']);for(var _0x5e53b5=0x0;_0x5e53b5<_0x7e06f3[_0x61c3('0x2f')];_0x5e53b5+=0x1){let _0x54b2fc=_0x7e06f3[_0x5e53b5];for(var _0x59e328=0x0;_0x59e328<_0x54b2fc['Agents']['length'];_0x59e328+=0x1){let _0x53c428=_0x54b2fc[_0x61c3('0x52')][_0x59e328];var _0x306fa4=_0x5df485[_0x61c3('0x65')]();_0x306fa4[_0x61c3('0x20')](_0x61c3('0x66'),_0x53c428['id']);_0x21dae7[_0x61c3('0x67')](db['sequelize'][_0x61c3('0x24')](_0x306fa4[_0x61c3('0x68')](),{'type':db[_0x61c3('0x56')][_0x61c3('0x69')]['SELECT']})['then'](function(_0x16bcbd){if(_0x16bcbd[_0x61c3('0x2f')]===0x1){return _0x53c428['id'];}else{var _0x1effbf=_[_0x61c3('0x6a')](_[_0x61c3('0x1f')](_0x16bcbd,'TeamId'),function(_0x5cfa6b){return _[_0x61c3('0x6b')](_0x39f43a,_0x5cfa6b);});if(_0x1effbf){return _0x53c428['id'];}}}));}}return BPromise[_0x61c3('0x6c')](_0x21dae7)[_0x61c3('0x16')](function(_0xb4661c){_0x3c7b0f=_(_0x3c7b0f)[_0x61c3('0x6d')](_0xb4661c)['compact']()[_0x61c3('0x6e')]();return db['OpenchannelQueue']['find']({'where':{'id':_0x1df255[_0x61c3('0x3d')]['id']}})[_0x61c3('0x16')](function(_0x56e161){return db[_0x61c3('0x56')][_0x61c3('0x57')](function(_0x35fdeb){return _0x56e161[_0x61c3('0x5d')](_0x1df255['query'][_0x61c3('0x6f')],{'transaction':_0x35fdeb})[_0x61c3('0x16')](function(){if(!_[_0x61c3('0x70')](_0x3c7b0f)){return _0x56e161[_0x61c3('0x71')](_0x3c7b0f,{'transaction':_0x35fdeb});}})[_0x61c3('0x16')](function(){_0x3c7b0f[_0x61c3('0x5a')](function(_0x589f9f){socket[_0x61c3('0x5b')]('userOpenchannelQueue:remove',{'UserId':_0x589f9f,'OpenchannelQueueId':_0x56e161['id']});});});});});});})[_0x61c3('0x16')](respondWithStatusCode(_0x25630b,null))[_0x61c3('0x33')](handleError(_0x25630b,null));};exports[_0x61c3('0x72')]=function(_0x205686,_0x23f118){return db[_0x61c3('0x21')][_0x61c3('0x3c')]({'where':{'id':_0x205686[_0x61c3('0x3d')]['id']}})[_0x61c3('0x16')](handleEntityNotFound(_0x23f118,null))[_0x61c3('0x16')](function(_0x563970){if(_0x563970){return _0x563970[_0x61c3('0x72')](_0x205686[_0x61c3('0x35')][_0x61c3('0x6f')],_[_0x61c3('0x73')](_0x205686[_0x61c3('0x35')],[_0x61c3('0x6f'),'id'])||{})[_0x61c3('0x74')](function(_0x15c650){for(var _0x51d1a0=0x0;_0x51d1a0<_0x205686[_0x61c3('0x35')]['ids']['length'];_0x51d1a0+=0x1){socket[_0x61c3('0x5b')](_0x61c3('0x5c'),{'UserId':Number(_0x205686[_0x61c3('0x35')][_0x61c3('0x6f')][_0x51d1a0]),'OpenchannelQueueId':Number(_0x205686['params']['id'])});}return _0x15c650;});}})[_0x61c3('0x16')](respondWithResult(_0x23f118,null))[_0x61c3('0x33')](handleError(_0x23f118,null));};exports[_0x61c3('0x71')]=function(_0x3f7b81,_0x31969d){return db[_0x61c3('0x21')][_0x61c3('0x3c')]({'where':{'id':_0x3f7b81['params']['id']}})['then'](handleEntityNotFound(_0x31969d,null))[_0x61c3('0x16')](function(_0x5dda6c){if(_0x5dda6c){return _0x5dda6c[_0x61c3('0x71')](_0x3f7b81[_0x61c3('0x24')]['ids'])[_0x61c3('0x16')](function(){if(_[_0x61c3('0x75')](_0x3f7b81[_0x61c3('0x24')][_0x61c3('0x6f')])){for(var _0x479331=0x0;_0x479331<_0x3f7b81[_0x61c3('0x24')][_0x61c3('0x6f')][_0x61c3('0x2f')];_0x479331+=0x1){socket[_0x61c3('0x5b')](_0x61c3('0x76'),{'UserId':Number(_0x3f7b81[_0x61c3('0x24')][_0x61c3('0x6f')][_0x479331]),'OpenchannelQueueId':Number(_0x3f7b81[_0x61c3('0x3d')]['id'])});}}else{socket[_0x61c3('0x5b')](_0x61c3('0x76'),{'UserId':Number(_0x3f7b81[_0x61c3('0x24')]['ids']),'OpenchannelQueueId':Number(_0x3f7b81[_0x61c3('0x3d')]['id'])});}});}})[_0x61c3('0x16')](respondWithStatusCode(_0x31969d,null))[_0x61c3('0x33')](handleError(_0x31969d,null));};exports[_0x61c3('0x77')]=function(_0x3cbb15,_0xe69527){var _0x30aaf8={};var _0x3d7097={};var _0x505f07;var _0x1de32d;return db[_0x61c3('0x21')]['findOne']({'where':{'id':_0x3cbb15[_0x61c3('0x3d')]['id']}})[_0x61c3('0x16')](handleEntityNotFound(_0xe69527,null))['then'](function(_0x5cfcd5){if(_0x5cfcd5){_0x505f07=_0x5cfcd5;_0x3d7097[_0x61c3('0x28')]=_[_0x61c3('0x2a')](db[_0x61c3('0x46')][_0x61c3('0x29')]);_0x3d7097['query']=_[_0x61c3('0x2a')](_0x3cbb15[_0x61c3('0x24')]);_0x3d7097[_0x61c3('0x2b')]=_[_0x61c3('0x2c')](_0x3d7097[_0x61c3('0x28')],_0x3d7097['query']);_0x30aaf8[_0x61c3('0x2d')]=_[_0x61c3('0x2c')](_0x3d7097[_0x61c3('0x28')],qs[_0x61c3('0x2e')](_0x3cbb15[_0x61c3('0x24')][_0x61c3('0x2e')]));_0x30aaf8[_0x61c3('0x2d')]=_0x30aaf8[_0x61c3('0x2d')][_0x61c3('0x2f')]?_0x30aaf8[_0x61c3('0x2d')]:_0x3d7097[_0x61c3('0x28')];_0x30aaf8[_0x61c3('0x43')]=qs[_0x61c3('0x44')](_0x3cbb15[_0x61c3('0x24')]['sort']);_0x30aaf8[_0x61c3('0x20')]=qs['filters'](_[_0x61c3('0x4f')](_0x3cbb15[_0x61c3('0x24')],_0x3d7097[_0x61c3('0x2b')]));if(_0x3cbb15['query'][_0x61c3('0x45')]){_0x30aaf8[_0x61c3('0x20')]=_[_0x61c3('0x31')](_0x30aaf8[_0x61c3('0x20')],{'$or':_[_0x61c3('0x1f')](_0x30aaf8[_0x61c3('0x2d')],function(_0x103be7){var _0x4bba6c={};_0x4bba6c[_0x103be7]={'$like':'%'+_0x3cbb15[_0x61c3('0x24')][_0x61c3('0x45')]+'%'};return _0x4bba6c;})});}_0x30aaf8=_[_0x61c3('0x31')]({},_0x30aaf8,_0x3cbb15[_0x61c3('0x32')]);return _0x505f07[_0x61c3('0x77')](_0x30aaf8);}})[_0x61c3('0x16')](function(_0x54c6b1){if(_0x54c6b1){_0x1de32d=_0x54c6b1[_0x61c3('0x2f')];if(!_0x3cbb15[_0x61c3('0x24')][_0x61c3('0x41')](_0x61c3('0x42'))){_0x30aaf8['limit']=qs[_0x61c3('0x12')](_0x3cbb15[_0x61c3('0x24')]['limit']);_0x30aaf8[_0x61c3('0x10')]=qs['offset'](_0x3cbb15[_0x61c3('0x24')][_0x61c3('0x10')]);}return _0x505f07[_0x61c3('0x77')](_0x30aaf8);}})[_0x61c3('0x16')](function(_0x4cba2d){if(_0x4cba2d){return _0x4cba2d?{'count':_0x1de32d,'rows':_0x4cba2d}:null;}})[_0x61c3('0x16')](respondWithResult(_0xe69527,null))['catch'](handleError(_0xe69527,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.events.js b/server/api/openchannelQueue/openchannelQueue.events.js index 89a8e47..f4ba28e 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 _0xfa07=['../../mysqldb','OpenchannelQueue','save','update','emit','hasOwnProperty','hook','events'];(function(_0x306d58,_0x4c64e4){var _0x24e44b=function(_0x3e61f8){while(--_0x3e61f8){_0x306d58['push'](_0x306d58['shift']());}};_0x24e44b(++_0x4c64e4);}(_0xfa07,0x177));var _0x7fa0=function(_0x5606a4,_0x4af49f){_0x5606a4=_0x5606a4-0x0;var _0x5e41d4=_0xfa07[_0x5606a4];return _0x5e41d4;};'use strict';var EventEmitter=require(_0x7fa0('0x0'));var OpenchannelQueue=require(_0x7fa0('0x1'))['db'][_0x7fa0('0x2')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x7fa0('0x3'),'afterUpdate':_0x7fa0('0x4'),'afterDestroy':'remove'};function emitEvent(_0x49c4fa){return function(_0x1ad4b0,_0x172ecb,_0x51fb31){OpenchannelQueueEvents[_0x7fa0('0x5')](_0x49c4fa+':'+_0x1ad4b0['id'],_0x1ad4b0);OpenchannelQueueEvents[_0x7fa0('0x5')](_0x49c4fa,_0x1ad4b0);_0x51fb31(null);};}for(var e in events){if(events[_0x7fa0('0x6')](e)){var event=events[e];OpenchannelQueue[_0x7fa0('0x7')](e,emitEvent(event));}}module['exports']=OpenchannelQueueEvents; \ No newline at end of file +var _0x96a5=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners','save','update','remove'];(function(_0x2fd772,_0x5b32d1){var _0x2a85c4=function(_0x31027f){while(--_0x31027f){_0x2fd772['push'](_0x2fd772['shift']());}};_0x2a85c4(++_0x5b32d1);}(_0x96a5,0xfe));var _0x596a=function(_0xdd84b6,_0x69948){_0xdd84b6=_0xdd84b6-0x0;var _0x4c3f03=_0x96a5[_0xdd84b6];return _0x4c3f03;};'use strict';var EventEmitter=require(_0x596a('0x0'));var OpenchannelQueue=require(_0x596a('0x1'))['db']['OpenchannelQueue'];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0x596a('0x2')](0x0);var events={'afterCreate':_0x596a('0x3'),'afterUpdate':_0x596a('0x4'),'afterDestroy':_0x596a('0x5')};function emitEvent(_0x35b36b){return function(_0x1fe885,_0x3c9bce,_0x2b8019){OpenchannelQueueEvents[_0x596a('0x6')](_0x35b36b+':'+_0x1fe885['id'],_0x1fe885);OpenchannelQueueEvents[_0x596a('0x6')](_0x35b36b,_0x1fe885);_0x2b8019(null);};}for(var e in events){if(events[_0x596a('0x7')](e)){var event=events[e];OpenchannelQueue[_0x596a('0x8')](e,emitEvent(event));}}module[_0x596a('0x9')]=OpenchannelQueueEvents; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.model.js b/server/api/openchannelQueue/openchannelQueue.model.js index 4a3a1d9..95fdd72 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 _0xf93d=['util','../../config/logger','api','moment','request-promise','rimraf','../../config/environment','./openchannelQueue.attributes','define','OpenchannelQueue','openchannel_queues','lodash'];(function(_0x1beef3,_0x57c4b8){var _0x5af964=function(_0x36f463){while(--_0x36f463){_0x1beef3['push'](_0x1beef3['shift']());}};_0x5af964(++_0x57c4b8);}(_0xf93d,0xd7));var _0xdf93=function(_0x30c870,_0x346044){_0x30c870=_0x30c870-0x0;var _0x319b25=_0xf93d[_0x30c870];return _0x319b25;};'use strict';var _=require(_0xdf93('0x0'));var util=require(_0xdf93('0x1'));var logger=require(_0xdf93('0x2'))(_0xdf93('0x3'));var moment=require(_0xdf93('0x4'));var BPromise=require('bluebird');var rp=require(_0xdf93('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xdf93('0x6'));var config=require(_0xdf93('0x7'));var attributes=require(_0xdf93('0x8'));module['exports']=function(_0x1f8811,_0x13dd09){return _0x1f8811[_0xdf93('0x9')](_0xdf93('0xa'),attributes,{'tableName':_0xdf93('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3072=['moment','request-promise','../../config/environment','./openchannelQueue.attributes','exports','openchannel_queues','lodash','util','../../config/logger','api'];(function(_0x8c6cae,_0x58059e){var _0x24f3df=function(_0x267382){while(--_0x267382){_0x8c6cae['push'](_0x8c6cae['shift']());}};_0x24f3df(++_0x58059e);}(_0x3072,0x88));var _0x2307=function(_0x30ad6b,_0x37b5d0){_0x30ad6b=_0x30ad6b-0x0;var _0x1382c0=_0x3072[_0x30ad6b];return _0x1382c0;};'use strict';var _=require(_0x2307('0x0'));var util=require(_0x2307('0x1'));var logger=require(_0x2307('0x2'))(_0x2307('0x3'));var moment=require(_0x2307('0x4'));var BPromise=require('bluebird');var rp=require(_0x2307('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x2307('0x6'));var attributes=require(_0x2307('0x7'));module[_0x2307('0x8')]=function(_0x113823,_0x100f52){return _0x113823['define']('OpenchannelQueue',attributes,{'tableName':_0x2307('0x9'),'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 27c77e4..a5e47a9 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 _0xaf2f=['raw','where','include','map','model','attributes','ShowOpenchannelQueue','OpenchannelQueue','find','debug','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./openchannelQueue.socket','register','request','then','OpenchannelQueue,\x20%s,\x20%s','request\x20sent','OpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','info','catch','GetOpenchannelQueue','findAll','options'];(function(_0x7179c2,_0x23058b){var _0x4ed026=function(_0xfebb42){while(--_0xfebb42){_0x7179c2['push'](_0x7179c2['shift']());}};_0x4ed026(++_0x23058b);}(_0xaf2f,0x17b));var _0xfaf2=function(_0x1145de,_0x54d2f6){_0x1145de=_0x1145de-0x0;var _0x4863b4=_0xaf2f[_0x1145de];return _0x4863b4;};'use strict';var _=require(_0xfaf2('0x0'));var util=require('util');var moment=require(_0xfaf2('0x1'));var BPromise=require(_0xfaf2('0x2'));var rs=require(_0xfaf2('0x3'));var fs=require('fs');var Redis=require(_0xfaf2('0x4'));var db=require(_0xfaf2('0x5'))['db'];var utils=require(_0xfaf2('0x6'));var logger=require(_0xfaf2('0x7'))(_0xfaf2('0x8'));var config=require(_0xfaf2('0x9'));var jayson=require(_0xfaf2('0xa'));var client=jayson[_0xfaf2('0xb')][_0xfaf2('0xc')]({'port':0x232a});config[_0xfaf2('0xd')]=_[_0xfaf2('0xe')](config['redis'],{'host':_0xfaf2('0xf'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xfaf2('0x10'))[_0xfaf2('0x11')](socket);function respondWithRpcPromise(_0x5e5107,_0x3b92a9,_0x15daf7){return new BPromise(function(_0x2a33b6,_0xc3e70a){return client[_0xfaf2('0x12')](_0x5e5107,_0x15daf7)[_0xfaf2('0x13')](function(_0x2a74be){logger['info'](_0xfaf2('0x14'),_0x3b92a9,_0xfaf2('0x15'));logger['debug'](_0xfaf2('0x16'),_0x3b92a9,_0xfaf2('0x15'),JSON[_0xfaf2('0x17')](_0x2a74be));if(_0x2a74be['error']){if(_0x2a74be[_0xfaf2('0x18')]['code']===0x1f4){logger[_0xfaf2('0x18')](_0xfaf2('0x14'),_0x3b92a9,_0x2a74be[_0xfaf2('0x18')]['message']);return _0xc3e70a(_0x2a74be[_0xfaf2('0x18')][_0xfaf2('0x19')]);}logger[_0xfaf2('0x18')](_0xfaf2('0x14'),_0x3b92a9,_0x2a74be[_0xfaf2('0x18')]['message']);return _0x2a33b6(_0x2a74be[_0xfaf2('0x18')][_0xfaf2('0x19')]);}else{logger[_0xfaf2('0x1a')](_0xfaf2('0x14'),_0x3b92a9,_0xfaf2('0x15'));_0x2a33b6(_0x2a74be['result'][_0xfaf2('0x19')]);}})[_0xfaf2('0x1b')](function(_0x59b9ba){logger['error'](_0xfaf2('0x14'),_0x3b92a9,_0x59b9ba);_0xc3e70a(_0x59b9ba);});});}exports[_0xfaf2('0x1c')]=function(_0x117e05){var _0x40472c=this;return new Promise(function(_0x22dd85,_0x1a441d){return db['OpenchannelQueue'][_0xfaf2('0x1d')]({'raw':_0x117e05[_0xfaf2('0x1e')]?_0x117e05[_0xfaf2('0x1e')][_0xfaf2('0x1f')]===undefined?!![]:![]:!![],'where':_0x117e05[_0xfaf2('0x1e')]?_0x117e05[_0xfaf2('0x1e')][_0xfaf2('0x20')]||null:null,'attributes':_0x117e05[_0xfaf2('0x1e')]?_0x117e05[_0xfaf2('0x1e')]['attributes']||null:null,'limit':_0x117e05[_0xfaf2('0x1e')]?_0x117e05[_0xfaf2('0x1e')]['limit']||null:null,'include':_0x117e05[_0xfaf2('0x1e')]?_0x117e05['options'][_0xfaf2('0x21')]?_[_0xfaf2('0x22')](_0x117e05[_0xfaf2('0x1e')][_0xfaf2('0x21')],function(_0x2c4a0c){return{'model':db[_0x2c4a0c[_0xfaf2('0x23')]],'as':_0x2c4a0c['as'],'attributes':_0x2c4a0c['attributes'],'include':_0x2c4a0c[_0xfaf2('0x21')]?_[_0xfaf2('0x22')](_0x2c4a0c['include'],function(_0x52cc36){return{'model':db[_0x52cc36[_0xfaf2('0x23')]],'as':_0x52cc36['as'],'attributes':_0x52cc36[_0xfaf2('0x24')],'include':_0x52cc36[_0xfaf2('0x21')]?_[_0xfaf2('0x22')](_0x52cc36[_0xfaf2('0x21')],function(_0x1e9bd4){return{'model':db[_0x1e9bd4[_0xfaf2('0x23')]],'as':_0x1e9bd4['as'],'attributes':_0x1e9bd4['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x3a6e78){logger['info']('GetOpenchannelQueue',_0x117e05);logger['debug'](_0xfaf2('0x1c'),_0x117e05,JSON['stringify'](_0x3a6e78));_0x22dd85(_0x3a6e78);})[_0xfaf2('0x1b')](function(_0x63d8d3){logger['error'](_0xfaf2('0x1c'),_0x63d8d3['message'],_0x117e05);_0x1a441d(_0x40472c[_0xfaf2('0x18')](0x1f4,_0x63d8d3[_0xfaf2('0x19')]));});});};exports[_0xfaf2('0x25')]=function(_0x42d434){var _0x2166dc=this;return new Promise(function(_0xb73eea,_0x1b585f){return db[_0xfaf2('0x26')][_0xfaf2('0x27')]({'raw':_0x42d434[_0xfaf2('0x1e')]?_0x42d434[_0xfaf2('0x1e')]['raw']===undefined?!![]:![]:!![],'where':_0x42d434['options']?_0x42d434['options'][_0xfaf2('0x20')]||null:null,'attributes':_0x42d434[_0xfaf2('0x1e')]?_0x42d434[_0xfaf2('0x1e')]['attributes']||null:null,'include':_0x42d434[_0xfaf2('0x1e')]?_0x42d434[_0xfaf2('0x1e')][_0xfaf2('0x21')]?_[_0xfaf2('0x22')](_0x42d434['options']['include'],function(_0x3e8c88){return{'model':db[_0x3e8c88['model']],'as':_0x3e8c88['as'],'attributes':_0x3e8c88[_0xfaf2('0x24')],'include':_0x3e8c88[_0xfaf2('0x21')]?_[_0xfaf2('0x22')](_0x3e8c88['include'],function(_0x1ab926){return{'model':db[_0x1ab926[_0xfaf2('0x23')]],'as':_0x1ab926['as'],'attributes':_0x1ab926[_0xfaf2('0x24')],'include':_0x1ab926[_0xfaf2('0x21')]?_['map'](_0x1ab926[_0xfaf2('0x21')],function(_0x3eb244){return{'model':db[_0x3eb244[_0xfaf2('0x23')]],'as':_0x3eb244['as'],'attributes':_0x3eb244[_0xfaf2('0x24')]};}):[]};}):[]};}):[]:[]})[_0xfaf2('0x13')](function(_0x2cee92){logger[_0xfaf2('0x1a')]('ShowOpenchannelQueue',_0x42d434);logger[_0xfaf2('0x28')]('ShowOpenchannelQueue',_0x42d434,JSON['stringify'](_0x2cee92));_0xb73eea(_0x2cee92);})[_0xfaf2('0x1b')](function(_0x5f229d){logger[_0xfaf2('0x18')](_0xfaf2('0x25'),_0x5f229d['message'],_0x42d434);_0x1b585f(_0x2166dc['error'](0x1f4,_0x5f229d[_0xfaf2('0x19')]));});});}; \ No newline at end of file +var _0x53ec=['request\x20sent','debug','OpenchannelQueue,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','GetOpenchannelQueue','options','raw','attributes','include','model','map','ShowOpenchannelQueue','OpenchannelQueue','find','where','info','stringify','lodash','util','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','socket.io-emitter','./openchannelQueue.socket','request','then','OpenchannelQueue,\x20%s,\x20%s'];(function(_0x16108a,_0x3fff24){var _0x205d37=function(_0x30d93a){while(--_0x30d93a){_0x16108a['push'](_0x16108a['shift']());}};_0x205d37(++_0x3fff24);}(_0x53ec,0x13d));var _0xc53e=function(_0x3e1fe8,_0x223c26){_0x3e1fe8=_0x3e1fe8-0x0;var _0x55d8e5=_0x53ec[_0x3e1fe8];return _0x55d8e5;};'use strict';var _=require(_0xc53e('0x0'));var util=require(_0xc53e('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xc53e('0x2'));var fs=require('fs');var Redis=require(_0xc53e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xc53e('0x4'));var logger=require(_0xc53e('0x5'))(_0xc53e('0x6'));var config=require(_0xc53e('0x7'));var jayson=require(_0xc53e('0x8'));var client=jayson['client'][_0xc53e('0x9')]({'port':0x232a});config['redis']=_['defaults'](config[_0xc53e('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0xc53e('0xb'))(new Redis(config[_0xc53e('0xa')]));require(_0xc53e('0xc'))['register'](socket);function respondWithRpcPromise(_0x48e9c2,_0x5a1f83,_0x362601){return new BPromise(function(_0x11f48a,_0x857a5f){return client[_0xc53e('0xd')](_0x48e9c2,_0x362601)[_0xc53e('0xe')](function(_0x485587){logger['info'](_0xc53e('0xf'),_0x5a1f83,_0xc53e('0x10'));logger[_0xc53e('0x11')](_0xc53e('0x12'),_0x5a1f83,'request\x20sent',JSON['stringify'](_0x485587));if(_0x485587['error']){if(_0x485587[_0xc53e('0x13')][_0xc53e('0x14')]===0x1f4){logger[_0xc53e('0x13')](_0xc53e('0xf'),_0x5a1f83,_0x485587[_0xc53e('0x13')][_0xc53e('0x15')]);return _0x857a5f(_0x485587[_0xc53e('0x13')][_0xc53e('0x15')]);}logger['error'](_0xc53e('0xf'),_0x5a1f83,_0x485587[_0xc53e('0x13')]['message']);return _0x11f48a(_0x485587[_0xc53e('0x13')][_0xc53e('0x15')]);}else{logger['info'](_0xc53e('0xf'),_0x5a1f83,_0xc53e('0x10'));_0x11f48a(_0x485587[_0xc53e('0x16')][_0xc53e('0x15')]);}})[_0xc53e('0x17')](function(_0x5a9f67){logger[_0xc53e('0x13')]('OpenchannelQueue,\x20%s,\x20%s',_0x5a1f83,_0x5a9f67);_0x857a5f(_0x5a9f67);});});}exports[_0xc53e('0x18')]=function(_0x3a207a){var _0x42b9b0=this;return new Promise(function(_0x50c47e,_0x3fab67){return db['OpenchannelQueue']['findAll']({'raw':_0x3a207a[_0xc53e('0x19')]?_0x3a207a['options'][_0xc53e('0x1a')]===undefined?!![]:![]:!![],'where':_0x3a207a['options']?_0x3a207a[_0xc53e('0x19')]['where']||null:null,'attributes':_0x3a207a[_0xc53e('0x19')]?_0x3a207a[_0xc53e('0x19')][_0xc53e('0x1b')]||null:null,'limit':_0x3a207a[_0xc53e('0x19')]?_0x3a207a[_0xc53e('0x19')]['limit']||null:null,'include':_0x3a207a[_0xc53e('0x19')]?_0x3a207a['options'][_0xc53e('0x1c')]?_['map'](_0x3a207a[_0xc53e('0x19')][_0xc53e('0x1c')],function(_0x396c9c){return{'model':db[_0x396c9c[_0xc53e('0x1d')]],'as':_0x396c9c['as'],'attributes':_0x396c9c[_0xc53e('0x1b')],'include':_0x396c9c['include']?_[_0xc53e('0x1e')](_0x396c9c[_0xc53e('0x1c')],function(_0x6897){return{'model':db[_0x6897[_0xc53e('0x1d')]],'as':_0x6897['as'],'attributes':_0x6897[_0xc53e('0x1b')],'include':_0x6897[_0xc53e('0x1c')]?_[_0xc53e('0x1e')](_0x6897[_0xc53e('0x1c')],function(_0x469657){return{'model':db[_0x469657[_0xc53e('0x1d')]],'as':_0x469657['as'],'attributes':_0x469657[_0xc53e('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xc53e('0xe')](function(_0x598987){logger['info'](_0xc53e('0x18'),_0x3a207a);logger['debug'](_0xc53e('0x18'),_0x3a207a,JSON['stringify'](_0x598987));_0x50c47e(_0x598987);})[_0xc53e('0x17')](function(_0x18fa6e){logger[_0xc53e('0x13')](_0xc53e('0x18'),_0x18fa6e['message'],_0x3a207a);_0x3fab67(_0x42b9b0[_0xc53e('0x13')](0x1f4,_0x18fa6e['message']));});});};exports[_0xc53e('0x1f')]=function(_0x580ba9){var _0x4baea9=this;return new Promise(function(_0x3047da,_0x37ae33){return db[_0xc53e('0x20')][_0xc53e('0x21')]({'raw':_0x580ba9['options']?_0x580ba9[_0xc53e('0x19')][_0xc53e('0x1a')]===undefined?!![]:![]:!![],'where':_0x580ba9[_0xc53e('0x19')]?_0x580ba9['options'][_0xc53e('0x22')]||null:null,'attributes':_0x580ba9[_0xc53e('0x19')]?_0x580ba9['options'][_0xc53e('0x1b')]||null:null,'include':_0x580ba9[_0xc53e('0x19')]?_0x580ba9['options'][_0xc53e('0x1c')]?_[_0xc53e('0x1e')](_0x580ba9[_0xc53e('0x19')]['include'],function(_0x36ac7d){return{'model':db[_0x36ac7d[_0xc53e('0x1d')]],'as':_0x36ac7d['as'],'attributes':_0x36ac7d[_0xc53e('0x1b')],'include':_0x36ac7d[_0xc53e('0x1c')]?_[_0xc53e('0x1e')](_0x36ac7d['include'],function(_0x2f16da){return{'model':db[_0x2f16da['model']],'as':_0x2f16da['as'],'attributes':_0x2f16da[_0xc53e('0x1b')],'include':_0x2f16da[_0xc53e('0x1c')]?_[_0xc53e('0x1e')](_0x2f16da[_0xc53e('0x1c')],function(_0x1a9345){return{'model':db[_0x1a9345[_0xc53e('0x1d')]],'as':_0x1a9345['as'],'attributes':_0x1a9345[_0xc53e('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xc53e('0xe')](function(_0x376b72){logger[_0xc53e('0x23')](_0xc53e('0x1f'),_0x580ba9);logger[_0xc53e('0x11')]('ShowOpenchannelQueue',_0x580ba9,JSON[_0xc53e('0x24')](_0x376b72));_0x3047da(_0x376b72);})[_0xc53e('0x17')](function(_0x1166d5){logger[_0xc53e('0x13')](_0xc53e('0x1f'),_0x1166d5[_0xc53e('0x15')],_0x580ba9);_0x37ae33(_0x4baea9['error'](0x1f4,_0x1166d5[_0xc53e('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.socket.js b/server/api/openchannelQueue/openchannelQueue.socket.js index b164b50..fee1bf0 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 _0xb3f2=['openchannelQueue:','./openchannelQueue.events','update','emit','removeListener','register'];(function(_0x465823,_0x14c09b){var _0x41ed37=function(_0x267380){while(--_0x267380){_0x465823['push'](_0x465823['shift']());}};_0x41ed37(++_0x14c09b);}(_0xb3f2,0x8b));var _0x2b3f=function(_0xc4001c,_0x1bf8f0){_0xc4001c=_0xc4001c-0x0;var _0x49f7bc=_0xb3f2[_0xc4001c];return _0x49f7bc;};'use strict';var OpenchannelQueueEvents=require(_0x2b3f('0x0'));var events=['save','remove',_0x2b3f('0x1')];function createListener(_0xc3088d,_0x293140){return function(_0x50826d){_0x293140[_0x2b3f('0x2')](_0xc3088d,_0x50826d);};}function removeListener(_0x36fab5,_0x2d9ebf){return function(){OpenchannelQueueEvents[_0x2b3f('0x3')](_0x36fab5,_0x2d9ebf);};}exports[_0x2b3f('0x4')]=function(_0x1b7802){for(var _0x25b9e1=0x0,_0x50cf07=events['length'];_0x25b9e1<_0x50cf07;_0x25b9e1++){var _0x2473f9=events[_0x25b9e1];var _0x44b1cd=createListener(_0x2b3f('0x5')+_0x2473f9,_0x1b7802);OpenchannelQueueEvents['on'](_0x2473f9,_0x44b1cd);}}; \ No newline at end of file +var _0x962b=['register','openchannelQueue:','./openchannelQueue.events','save','remove','update','emit','removeListener'];(function(_0x185a91,_0x2c3262){var _0x27b9f4=function(_0x4822cc){while(--_0x4822cc){_0x185a91['push'](_0x185a91['shift']());}};_0x27b9f4(++_0x2c3262);}(_0x962b,0xba));var _0xb962=function(_0x201ae1,_0x31c8b7){_0x201ae1=_0x201ae1-0x0;var _0x3635fd=_0x962b[_0x201ae1];return _0x3635fd;};'use strict';var OpenchannelQueueEvents=require(_0xb962('0x0'));var events=[_0xb962('0x1'),_0xb962('0x2'),_0xb962('0x3')];function createListener(_0x4d6e16,_0x5abe4b){return function(_0x51de2b){_0x5abe4b[_0xb962('0x4')](_0x4d6e16,_0x51de2b);};}function removeListener(_0x41cc1d,_0x5c76f7){return function(){OpenchannelQueueEvents[_0xb962('0x5')](_0x41cc1d,_0x5c76f7);};}exports[_0xb962('0x6')]=function(_0x1b5cc4){for(var _0x1f8202=0x0,_0x392434=events['length'];_0x1f8202<_0x392434;_0x1f8202++){var _0x48d2f6=events[_0x1f8202];var _0x109b50=createListener(_0xb962('0x7')+_0x48d2f6,_0x1b5cc4);OpenchannelQueueEvents['on'](_0x48d2f6,_0x109b50);}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/index.js b/server/api/openchannelQueueReport/index.js index fc33b40..750332d 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 _0x8f75=['create','put','/:id','destroy','exports','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./openchannelQueueReport.controller','get','isAuthenticated','index','/describe','describe'];(function(_0x2a2da5,_0x2d46fd){var _0x3e70a1=function(_0x401dca){while(--_0x401dca){_0x2a2da5['push'](_0x2a2da5['shift']());}};_0x3e70a1(++_0x2d46fd);}(_0x8f75,0x113));var _0x58f7=function(_0x98ce34,_0x30a2f6){_0x98ce34=_0x98ce34-0x0;var _0x571698=_0x8f75[_0x98ce34];return _0x571698;};'use strict';var multer=require(_0x58f7('0x0'));var util=require('util');var path=require(_0x58f7('0x1'));var timeout=require(_0x58f7('0x2'));var express=require('express');var router=express[_0x58f7('0x3')]();var fs_extra=require(_0x58f7('0x4'));var auth=require(_0x58f7('0x5'));var interaction=require(_0x58f7('0x6'));var config=require('../../config/environment');var controller=require(_0x58f7('0x7'));router[_0x58f7('0x8')]('/',auth[_0x58f7('0x9')](),controller[_0x58f7('0xa')]);router['get'](_0x58f7('0xb'),auth[_0x58f7('0x9')](),controller[_0x58f7('0xc')]);router[_0x58f7('0x8')]('/:id',auth[_0x58f7('0x9')](),controller['show']);router['post']('/',auth[_0x58f7('0x9')](),controller[_0x58f7('0xd')]);router[_0x58f7('0xe')](_0x58f7('0xf'),auth[_0x58f7('0x9')](),controller['update']);router['delete'](_0x58f7('0xf'),auth[_0x58f7('0x9')](),controller[_0x58f7('0x10')]);module[_0x58f7('0x11')]=router; \ No newline at end of file +var _0x1c3e=['update','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../config/environment','./openchannelQueueReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show'];(function(_0x21efbc,_0x232828){var _0x2e2730=function(_0x2d12f7){while(--_0x2d12f7){_0x21efbc['push'](_0x21efbc['shift']());}};_0x2e2730(++_0x232828);}(_0x1c3e,0x120));var _0xe1c3=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x1c3e[_0x432682];return _0x463d05;};'use strict';var multer=require(_0xe1c3('0x0'));var util=require(_0xe1c3('0x1'));var path=require(_0xe1c3('0x2'));var timeout=require(_0xe1c3('0x3'));var express=require(_0xe1c3('0x4'));var router=express[_0xe1c3('0x5')]();var fs_extra=require(_0xe1c3('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xe1c3('0x7'));var controller=require(_0xe1c3('0x8'));router[_0xe1c3('0x9')]('/',auth[_0xe1c3('0xa')](),controller[_0xe1c3('0xb')]);router[_0xe1c3('0x9')](_0xe1c3('0xc'),auth[_0xe1c3('0xa')](),controller[_0xe1c3('0xd')]);router[_0xe1c3('0x9')](_0xe1c3('0xe'),auth[_0xe1c3('0xa')](),controller[_0xe1c3('0xf')]);router['post']('/',auth[_0xe1c3('0xa')](),controller['create']);router['put']('/:id',auth[_0xe1c3('0xa')](),controller[_0xe1c3('0x10')]);router[_0xe1c3('0x11')](_0xe1c3('0xe'),auth['isAuthenticated'](),controller['destroy']);module[_0xe1c3('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 140a9ce..b48f7bd 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 _0xf613=['STRING','DATE','moment','sequelize','exports'];(function(_0x2f553e,_0x22a114){var _0x43dc2e=function(_0x58936b){while(--_0x58936b){_0x2f553e['push'](_0x2f553e['shift']());}};_0x43dc2e(++_0x22a114);}(_0xf613,0x70));var _0x3f61=function(_0x10603d,_0x5a0b7d){_0x10603d=_0x10603d-0x0;var _0x283020=_0xf613[_0x10603d];return _0x283020;};'use strict';var moment=require(_0x3f61('0x0'));var Sequelize=require(_0x3f61('0x1'));module[_0x3f61('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0x3f61('0x3')]},'joinAt':{'type':Sequelize[_0x3f61('0x4')]},'leaveAt':{'type':Sequelize[_0x3f61('0x4')]},'acceptAt':{'type':Sequelize[_0x3f61('0x4')]},'exitAt':{'type':Sequelize[_0x3f61('0x4')]},'reason':{'type':Sequelize[_0x3f61('0x3')]}}; \ No newline at end of file +var _0xa914=['DATE','moment','sequelize','exports','STRING'];(function(_0x3a3470,_0x55b861){var _0x356927=function(_0xfcae7){while(--_0xfcae7){_0x3a3470['push'](_0x3a3470['shift']());}};_0x356927(++_0x55b861);}(_0xa914,0xce));var _0x4a91=function(_0x1d79c3,_0x3992a9){_0x1d79c3=_0x1d79c3-0x0;var _0x5ed06c=_0xa914[_0x1d79c3];return _0x5ed06c;};'use strict';var moment=require(_0x4a91('0x0'));var Sequelize=require(_0x4a91('0x1'));module[_0x4a91('0x2')]={'uniqueid':{'type':Sequelize[_0x4a91('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0x4a91('0x3')]},'joinAt':{'type':Sequelize[_0x4a91('0x4')]},'leaveAt':{'type':Sequelize[_0x4a91('0x4')]},'acceptAt':{'type':Sequelize[_0x4a91('0x4')]},'exitAt':{'type':Sequelize[_0x4a91('0x4')]},'reason':{'type':Sequelize[_0x4a91('0x3')]}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.controller.js b/server/api/openchannelQueueReport/openchannelQueueReport.controller.js index ef2307d..c8cb892 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 _0xa4b2=['eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','sendStatus','status','json','undefined','limit','count','offset','Content-Range','then','destroy','error','stack','name','send','index','map','OpenchannelQueueReport','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','nolimit','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','show','options','find','catch','create','body','params','describe'];(function(_0x3740fe,_0x6c543c){var _0x55492b=function(_0x1f851f){while(--_0x1f851f){_0x3740fe['push'](_0x3740fe['shift']());}};_0x55492b(++_0x6c543c);}(_0xa4b2,0xd2));var _0x2a4b=function(_0x4eda47,_0x546eec){_0x4eda47=_0x4eda47-0x0;var _0x484724=_0xa4b2[_0x4eda47];return _0x484724;};'use strict';var emlformat=require(_0x2a4b('0x0'));var rimraf=require(_0x2a4b('0x1'));var zipdir=require(_0x2a4b('0x2'));var jsonpatch=require(_0x2a4b('0x3'));var rp=require(_0x2a4b('0x4'));var moment=require('moment');var BPromise=require(_0x2a4b('0x5'));var Mustache=require(_0x2a4b('0x6'));var util=require(_0x2a4b('0x7'));var path=require(_0x2a4b('0x8'));var sox=require(_0x2a4b('0x9'));var csv=require(_0x2a4b('0xa'));var ejs=require(_0x2a4b('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x2a4b('0xc'));var crypto=require(_0x2a4b('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x2a4b('0xa'));var querystring=require(_0x2a4b('0xe'));var Papa=require(_0x2a4b('0xf'));var Redis=require(_0x2a4b('0x10'));var authService=require(_0x2a4b('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x2a4b('0x12'));var hardwareService=require(_0x2a4b('0x13'));var logger=require('../../config/logger')(_0x2a4b('0x14'));var utils=require('../../config/utils');var config=require(_0x2a4b('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xd8c0c8,_0x5ba57a){_0x5ba57a=_0x5ba57a||0xcc;return function(_0x3e1615){if(_0x3e1615){return _0xd8c0c8[_0x2a4b('0x16')](_0x5ba57a);}return _0xd8c0c8['status'](_0x5ba57a)['end']();};}function respondWithResult(_0x1e8172,_0x11ad5d){_0x11ad5d=_0x11ad5d||0xc8;return function(_0x1c85ba){if(_0x1c85ba){return _0x1e8172[_0x2a4b('0x17')](_0x11ad5d)[_0x2a4b('0x18')](_0x1c85ba);}};}function respondWithFilteredResult(_0x2de0ed,_0x27378a){return function(_0x5c0b64){if(_0x5c0b64){var _0x4a4596=typeof _0x27378a['offset']===_0x2a4b('0x19')&&typeof _0x27378a[_0x2a4b('0x1a')]==='undefined';var _0x12a9b=_0x5c0b64[_0x2a4b('0x1b')];var _0x5b4d2b=_0x4a4596?0x0:_0x27378a[_0x2a4b('0x1c')];var _0x13de54=_0x4a4596?_0x5c0b64[_0x2a4b('0x1b')]:_0x27378a[_0x2a4b('0x1c')]+_0x27378a[_0x2a4b('0x1a')];var _0x4a005f;if(_0x13de54>=_0x12a9b){_0x13de54=_0x12a9b;_0x4a005f=0xc8;}else{_0x4a005f=0xce;}_0x2de0ed[_0x2a4b('0x17')](_0x4a005f);return _0x2de0ed['set'](_0x2a4b('0x1d'),_0x5b4d2b+'-'+_0x13de54+'/'+_0x12a9b)[_0x2a4b('0x18')](_0x5c0b64);}return null;};}function patchUpdates(_0x20c46b){return function(_0x1ada18){try{jsonpatch['apply'](_0x1ada18,_0x20c46b,!![]);}catch(_0x4fd8e6){return BPromise['reject'](_0x4fd8e6);}return _0x1ada18['save']();};}function saveUpdates(_0x4f336e,_0x1e4299){return function(_0x5e46e3){if(_0x5e46e3){return _0x5e46e3['update'](_0x4f336e)[_0x2a4b('0x1e')](function(_0x47b151){return _0x47b151;});}return null;};}function removeEntity(_0x15281b,_0x25f1f8){return function(_0x308098){if(_0x308098){return _0x308098[_0x2a4b('0x1f')]()[_0x2a4b('0x1e')](function(){_0x15281b['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0xbebfc5,_0x576a19){return function(_0x5a93ac){if(!_0x5a93ac){_0xbebfc5[_0x2a4b('0x16')](0x194);}return _0x5a93ac;};}function handleError(_0x33eb8b,_0x406639){_0x406639=_0x406639||0x1f4;return function(_0x1d45e0){logger[_0x2a4b('0x20')](_0x1d45e0[_0x2a4b('0x21')]);if(_0x1d45e0[_0x2a4b('0x22')]){delete _0x1d45e0[_0x2a4b('0x22')];}_0x33eb8b[_0x2a4b('0x17')](_0x406639)[_0x2a4b('0x23')](_0x1d45e0);};}exports[_0x2a4b('0x24')]=function(_0x4b2475,_0x1ec218){var _0x46d35d={},_0x7879da={},_0x3a7aea={'count':0x0,'rows':[]};var _0x4b3f15=_[_0x2a4b('0x25')](db[_0x2a4b('0x26')][_0x2a4b('0x27')],function(_0x189895){return{'name':_0x189895[_0x2a4b('0x28')],'type':_0x189895[_0x2a4b('0x29')][_0x2a4b('0x2a')]};});_0x7879da[_0x2a4b('0x2b')]=_[_0x2a4b('0x25')](_0x4b3f15,_0x2a4b('0x22'));_0x7879da['query']=_[_0x2a4b('0x2c')](_0x4b2475[_0x2a4b('0x2d')]);_0x7879da[_0x2a4b('0x2e')]=_[_0x2a4b('0x2f')](_0x7879da[_0x2a4b('0x2b')],_0x7879da[_0x2a4b('0x2d')]);_0x46d35d[_0x2a4b('0x30')]=_[_0x2a4b('0x2f')](_0x7879da[_0x2a4b('0x2b')],qs[_0x2a4b('0x31')](_0x4b2475[_0x2a4b('0x2d')][_0x2a4b('0x31')]));_0x46d35d[_0x2a4b('0x30')]=_0x46d35d[_0x2a4b('0x30')][_0x2a4b('0x32')]?_0x46d35d[_0x2a4b('0x30')]:_0x7879da[_0x2a4b('0x2b')];if(!_0x4b2475[_0x2a4b('0x2d')]['hasOwnProperty'](_0x2a4b('0x33'))){_0x46d35d[_0x2a4b('0x1a')]=qs[_0x2a4b('0x1a')](_0x4b2475[_0x2a4b('0x2d')][_0x2a4b('0x1a')]);_0x46d35d[_0x2a4b('0x1c')]=qs[_0x2a4b('0x1c')](_0x4b2475[_0x2a4b('0x2d')][_0x2a4b('0x1c')]);}_0x46d35d['order']=qs[_0x2a4b('0x34')](_0x4b2475[_0x2a4b('0x2d')]['sort']);_0x46d35d[_0x2a4b('0x35')]=qs[_0x2a4b('0x2e')](_[_0x2a4b('0x36')](_0x4b2475[_0x2a4b('0x2d')],_0x7879da[_0x2a4b('0x2e')]),_0x4b3f15);if(_0x4b2475[_0x2a4b('0x2d')][_0x2a4b('0x37')]){_0x46d35d[_0x2a4b('0x35')]=_[_0x2a4b('0x38')](_0x46d35d['where'],{'$or':_[_0x2a4b('0x25')](_0x4b3f15,function(_0x55fb80){if(_0x55fb80['type']!==_0x2a4b('0x39')){var _0x3d0ec9={};_0x3d0ec9[_0x55fb80[_0x2a4b('0x22')]]={'$like':'%'+_0x4b2475['query'][_0x2a4b('0x37')]+'%'};return _0x3d0ec9;}})});}_0x46d35d=_['merge']({},_0x46d35d,_0x4b2475['options']);var _0x17116d={'where':_0x46d35d[_0x2a4b('0x35')]};return db['OpenchannelQueueReport'][_0x2a4b('0x1b')](_0x17116d)[_0x2a4b('0x1e')](function(_0x23c863){_0x3a7aea[_0x2a4b('0x1b')]=_0x23c863;if(_0x4b2475['query'][_0x2a4b('0x3a')]){_0x46d35d[_0x2a4b('0x3b')]=[{'all':!![]}];}return db[_0x2a4b('0x26')][_0x2a4b('0x3c')](_0x46d35d);})[_0x2a4b('0x1e')](function(_0x29d347){_0x3a7aea[_0x2a4b('0x3d')]=_0x29d347;return _0x3a7aea;})[_0x2a4b('0x1e')](respondWithFilteredResult(_0x1ec218,_0x46d35d))['catch'](handleError(_0x1ec218,null));};exports[_0x2a4b('0x3e')]=function(_0x190aff,_0x3870f0){var _0x56bb82={'raw':!![],'where':{'id':_0x190aff['params']['id']}},_0x44f3ed={};_0x44f3ed[_0x2a4b('0x2b')]=_[_0x2a4b('0x2c')](db[_0x2a4b('0x26')][_0x2a4b('0x27')]);_0x44f3ed[_0x2a4b('0x2d')]=_[_0x2a4b('0x2c')](_0x190aff[_0x2a4b('0x2d')]);_0x44f3ed['filters']=_['intersection'](_0x44f3ed['model'],_0x44f3ed[_0x2a4b('0x2d')]);_0x56bb82[_0x2a4b('0x30')]=_[_0x2a4b('0x2f')](_0x44f3ed[_0x2a4b('0x2b')],qs[_0x2a4b('0x31')](_0x190aff['query']['fields']));_0x56bb82[_0x2a4b('0x30')]=_0x56bb82[_0x2a4b('0x30')][_0x2a4b('0x32')]?_0x56bb82['attributes']:_0x44f3ed[_0x2a4b('0x2b')];if(_0x190aff[_0x2a4b('0x2d')][_0x2a4b('0x3a')]){_0x56bb82[_0x2a4b('0x3b')]=[{'all':!![]}];}_0x56bb82=_['merge']({},_0x56bb82,_0x190aff[_0x2a4b('0x3f')]);return db['OpenchannelQueueReport'][_0x2a4b('0x40')](_0x56bb82)[_0x2a4b('0x1e')](handleEntityNotFound(_0x3870f0,null))[_0x2a4b('0x1e')](respondWithResult(_0x3870f0,null))[_0x2a4b('0x41')](handleError(_0x3870f0,null));};exports[_0x2a4b('0x42')]=function(_0x5e47a2,_0x35ce2e){return db[_0x2a4b('0x26')][_0x2a4b('0x42')](_0x5e47a2[_0x2a4b('0x43')],{})[_0x2a4b('0x1e')](respondWithResult(_0x35ce2e,0xc9))[_0x2a4b('0x41')](handleError(_0x35ce2e,null));};exports['update']=function(_0x555d1e,_0x25198b){if(_0x555d1e[_0x2a4b('0x43')]['id']){delete _0x555d1e[_0x2a4b('0x43')]['id'];}return db[_0x2a4b('0x26')]['find']({'where':{'id':_0x555d1e[_0x2a4b('0x44')]['id']}})[_0x2a4b('0x1e')](handleEntityNotFound(_0x25198b,null))[_0x2a4b('0x1e')](saveUpdates(_0x555d1e['body'],null))[_0x2a4b('0x1e')](respondWithResult(_0x25198b,null))[_0x2a4b('0x41')](handleError(_0x25198b,null));};exports[_0x2a4b('0x1f')]=function(_0x33310f,_0x2174eb){return db[_0x2a4b('0x26')]['find']({'where':{'id':_0x33310f[_0x2a4b('0x44')]['id']}})[_0x2a4b('0x1e')](handleEntityNotFound(_0x2174eb,null))['then'](removeEntity(_0x2174eb,null))[_0x2a4b('0x41')](handleError(_0x2174eb,null));};exports[_0x2a4b('0x45')]=function(_0x21b7a1,_0x36d420){return db['OpenchannelQueueReport'][_0x2a4b('0x45')]()[_0x2a4b('0x1e')](respondWithResult(_0x36d420,null))[_0x2a4b('0x41')](handleError(_0x36d420,null));}; \ No newline at end of file +var _0x8311=['keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','options','OpenchannelQueueReport','includeAll','include','findAll','catch','params','rawAttributes','length','merge','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','../../mysqldb','status','undefined','limit','count','offset','set','Content-Range','json','apply','reject','save','update','then','destroy','sendStatus','error','name','send','map','fieldName','type','model','query'];(function(_0x2fcc1e,_0x952ada){var _0x266401=function(_0x1c2cf4){while(--_0x1c2cf4){_0x2fcc1e['push'](_0x2fcc1e['shift']());}};_0x266401(++_0x952ada);}(_0x8311,0x1d0));var _0x1831=function(_0x3eda5d,_0x2320c4){_0x3eda5d=_0x3eda5d-0x0;var _0x5cdebc=_0x8311[_0x3eda5d];return _0x5cdebc;};'use strict';var emlformat=require(_0x1831('0x0'));var rimraf=require(_0x1831('0x1'));var zipdir=require(_0x1831('0x2'));var jsonpatch=require(_0x1831('0x3'));var rp=require(_0x1831('0x4'));var moment=require(_0x1831('0x5'));var BPromise=require(_0x1831('0x6'));var Mustache=require('mustache');var util=require(_0x1831('0x7'));var path=require('path');var sox=require(_0x1831('0x8'));var csv=require(_0x1831('0x9'));var ejs=require(_0x1831('0xa'));var fs=require('fs');var fs_extra=require(_0x1831('0xb'));var _=require(_0x1831('0xc'));var squel=require(_0x1831('0xd'));var crypto=require(_0x1831('0xe'));var jsforce=require(_0x1831('0xf'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x1831('0x10'));var Papa=require(_0x1831('0x11'));var Redis=require('ioredis');var authService=require(_0x1831('0x12'));var qs=require(_0x1831('0x13'));var as=require(_0x1831('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x1831('0x15'))('api');var utils=require('../../config/utils');var config=require(_0x1831('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x1831('0x17'))['db'];function respondWithStatusCode(_0x539d9d,_0x504dd2){_0x504dd2=_0x504dd2||0xcc;return function(_0xe89420){if(_0xe89420){return _0x539d9d['sendStatus'](_0x504dd2);}return _0x539d9d[_0x1831('0x18')](_0x504dd2)['end']();};}function respondWithResult(_0x56537a,_0x125592){_0x125592=_0x125592||0xc8;return function(_0x5d5d22){if(_0x5d5d22){return _0x56537a[_0x1831('0x18')](_0x125592)['json'](_0x5d5d22);}};}function respondWithFilteredResult(_0x42732b,_0x84fc15){return function(_0x17fbf1){if(_0x17fbf1){var _0x39aa5d=typeof _0x84fc15['offset']===_0x1831('0x19')&&typeof _0x84fc15[_0x1831('0x1a')]===_0x1831('0x19');var _0x24d8ef=_0x17fbf1[_0x1831('0x1b')];var _0x332b53=_0x39aa5d?0x0:_0x84fc15[_0x1831('0x1c')];var _0x36a3f6=_0x39aa5d?_0x17fbf1[_0x1831('0x1b')]:_0x84fc15['offset']+_0x84fc15[_0x1831('0x1a')];var _0x277db5;if(_0x36a3f6>=_0x24d8ef){_0x36a3f6=_0x24d8ef;_0x277db5=0xc8;}else{_0x277db5=0xce;}_0x42732b['status'](_0x277db5);return _0x42732b[_0x1831('0x1d')](_0x1831('0x1e'),_0x332b53+'-'+_0x36a3f6+'/'+_0x24d8ef)[_0x1831('0x1f')](_0x17fbf1);}return null;};}function patchUpdates(_0x5451d9){return function(_0x25731a){try{jsonpatch[_0x1831('0x20')](_0x25731a,_0x5451d9,!![]);}catch(_0x599fb9){return BPromise[_0x1831('0x21')](_0x599fb9);}return _0x25731a[_0x1831('0x22')]();};}function saveUpdates(_0x1744f7,_0x31ed){return function(_0x28ab84){if(_0x28ab84){return _0x28ab84[_0x1831('0x23')](_0x1744f7)[_0x1831('0x24')](function(_0x4bb16f){return _0x4bb16f;});}return null;};}function removeEntity(_0xd388b,_0x11047f){return function(_0x39c038){if(_0x39c038){return _0x39c038[_0x1831('0x25')]()[_0x1831('0x24')](function(){_0xd388b[_0x1831('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x38aebf,_0x3843b6){return function(_0x3cbe7c){if(!_0x3cbe7c){_0x38aebf[_0x1831('0x26')](0x194);}return _0x3cbe7c;};}function handleError(_0xe06cef,_0x2b9764){_0x2b9764=_0x2b9764||0x1f4;return function(_0x1365f2){logger[_0x1831('0x27')](_0x1365f2['stack']);if(_0x1365f2[_0x1831('0x28')]){delete _0x1365f2[_0x1831('0x28')];}_0xe06cef[_0x1831('0x18')](_0x2b9764)[_0x1831('0x29')](_0x1365f2);};}exports['index']=function(_0xf18daf,_0xaca43){var _0x28b0e4={},_0xd2f887={},_0x4adb49={'count':0x0,'rows':[]};var _0x29eb76=_[_0x1831('0x2a')](db['OpenchannelQueueReport']['rawAttributes'],function(_0x345b9b){return{'name':_0x345b9b[_0x1831('0x2b')],'type':_0x345b9b[_0x1831('0x2c')]['key']};});_0xd2f887[_0x1831('0x2d')]=_[_0x1831('0x2a')](_0x29eb76,_0x1831('0x28'));_0xd2f887[_0x1831('0x2e')]=_[_0x1831('0x2f')](_0xf18daf[_0x1831('0x2e')]);_0xd2f887[_0x1831('0x30')]=_[_0x1831('0x31')](_0xd2f887[_0x1831('0x2d')],_0xd2f887[_0x1831('0x2e')]);_0x28b0e4['attributes']=_[_0x1831('0x31')](_0xd2f887[_0x1831('0x2d')],qs[_0x1831('0x32')](_0xf18daf['query'][_0x1831('0x32')]));_0x28b0e4[_0x1831('0x33')]=_0x28b0e4[_0x1831('0x33')]['length']?_0x28b0e4[_0x1831('0x33')]:_0xd2f887['model'];if(!_0xf18daf[_0x1831('0x2e')][_0x1831('0x34')](_0x1831('0x35'))){_0x28b0e4[_0x1831('0x1a')]=qs[_0x1831('0x1a')](_0xf18daf[_0x1831('0x2e')][_0x1831('0x1a')]);_0x28b0e4[_0x1831('0x1c')]=qs['offset'](_0xf18daf[_0x1831('0x2e')][_0x1831('0x1c')]);}_0x28b0e4[_0x1831('0x36')]=qs[_0x1831('0x37')](_0xf18daf[_0x1831('0x2e')]['sort']);_0x28b0e4[_0x1831('0x38')]=qs['filters'](_[_0x1831('0x39')](_0xf18daf[_0x1831('0x2e')],_0xd2f887[_0x1831('0x30')]),_0x29eb76);if(_0xf18daf['query'][_0x1831('0x3a')]){_0x28b0e4[_0x1831('0x38')]=_['merge'](_0x28b0e4['where'],{'$or':_['map'](_0x29eb76,function(_0x42f5e2){if(_0x42f5e2['type']!=='VIRTUAL'){var _0x20af23={};_0x20af23[_0x42f5e2[_0x1831('0x28')]]={'$like':'%'+_0xf18daf['query']['filter']+'%'};return _0x20af23;}})});}_0x28b0e4=_['merge']({},_0x28b0e4,_0xf18daf[_0x1831('0x3b')]);var _0x14b9bf={'where':_0x28b0e4[_0x1831('0x38')]};return db[_0x1831('0x3c')][_0x1831('0x1b')](_0x14b9bf)[_0x1831('0x24')](function(_0x5e241e){_0x4adb49[_0x1831('0x1b')]=_0x5e241e;if(_0xf18daf[_0x1831('0x2e')][_0x1831('0x3d')]){_0x28b0e4[_0x1831('0x3e')]=[{'all':!![]}];}return db[_0x1831('0x3c')][_0x1831('0x3f')](_0x28b0e4);})[_0x1831('0x24')](function(_0x48cfdb){_0x4adb49['rows']=_0x48cfdb;return _0x4adb49;})[_0x1831('0x24')](respondWithFilteredResult(_0xaca43,_0x28b0e4))[_0x1831('0x40')](handleError(_0xaca43,null));};exports['show']=function(_0x1ca7b0,_0x431816){var _0x120dd8={'raw':!![],'where':{'id':_0x1ca7b0[_0x1831('0x41')]['id']}},_0x2d50d1={};_0x2d50d1[_0x1831('0x2d')]=_['keys'](db[_0x1831('0x3c')][_0x1831('0x42')]);_0x2d50d1['query']=_[_0x1831('0x2f')](_0x1ca7b0[_0x1831('0x2e')]);_0x2d50d1[_0x1831('0x30')]=_[_0x1831('0x31')](_0x2d50d1['model'],_0x2d50d1[_0x1831('0x2e')]);_0x120dd8[_0x1831('0x33')]=_[_0x1831('0x31')](_0x2d50d1['model'],qs[_0x1831('0x32')](_0x1ca7b0['query'][_0x1831('0x32')]));_0x120dd8[_0x1831('0x33')]=_0x120dd8[_0x1831('0x33')][_0x1831('0x43')]?_0x120dd8[_0x1831('0x33')]:_0x2d50d1['model'];if(_0x1ca7b0['query'][_0x1831('0x3d')]){_0x120dd8['include']=[{'all':!![]}];}_0x120dd8=_[_0x1831('0x44')]({},_0x120dd8,_0x1ca7b0[_0x1831('0x3b')]);return db[_0x1831('0x3c')][_0x1831('0x45')](_0x120dd8)[_0x1831('0x24')](handleEntityNotFound(_0x431816,null))[_0x1831('0x24')](respondWithResult(_0x431816,null))['catch'](handleError(_0x431816,null));};exports[_0x1831('0x46')]=function(_0x12f09e,_0x331810){return db[_0x1831('0x3c')][_0x1831('0x46')](_0x12f09e[_0x1831('0x47')],{})[_0x1831('0x24')](respondWithResult(_0x331810,0xc9))['catch'](handleError(_0x331810,null));};exports[_0x1831('0x23')]=function(_0x7a53c5,_0x51dd02){if(_0x7a53c5['body']['id']){delete _0x7a53c5[_0x1831('0x47')]['id'];}return db[_0x1831('0x3c')][_0x1831('0x45')]({'where':{'id':_0x7a53c5[_0x1831('0x41')]['id']}})[_0x1831('0x24')](handleEntityNotFound(_0x51dd02,null))['then'](saveUpdates(_0x7a53c5[_0x1831('0x47')],null))[_0x1831('0x24')](respondWithResult(_0x51dd02,null))[_0x1831('0x40')](handleError(_0x51dd02,null));};exports[_0x1831('0x25')]=function(_0x3e114e,_0x334f9d){return db['OpenchannelQueueReport'][_0x1831('0x45')]({'where':{'id':_0x3e114e[_0x1831('0x41')]['id']}})['then'](handleEntityNotFound(_0x334f9d,null))['then'](removeEntity(_0x334f9d,null))['catch'](handleError(_0x334f9d,null));};exports[_0x1831('0x48')]=function(_0x53f012,_0x2f3a07){return db['OpenchannelQueueReport'][_0x1831('0x48')]()[_0x1831('0x24')](respondWithResult(_0x2f3a07,null))[_0x1831('0x40')](handleError(_0x2f3a07,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.model.js b/server/api/openchannelQueueReport/openchannelQueueReport.model.js index 94071aa..0c4ac91 100644 --- a/server/api/openchannelQueueReport/openchannelQueueReport.model.js +++ b/server/api/openchannelQueueReport/openchannelQueueReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5fc3=['util','api','moment','bluebird','request-promise','path','../../config/environment','./openchannelQueueReport.attributes','exports','define','report_openchannel_queue','uniqueid','lodash'];(function(_0x139f6a,_0x2e6f1e){var _0x8f32c0=function(_0x18e274){while(--_0x18e274){_0x139f6a['push'](_0x139f6a['shift']());}};_0x8f32c0(++_0x2e6f1e);}(_0x5fc3,0xa8));var _0x35fc=function(_0x2f71f6,_0x3a1f4d){_0x2f71f6=_0x2f71f6-0x0;var _0x2b23ea=_0x5fc3[_0x2f71f6];return _0x2b23ea;};'use strict';var _=require(_0x35fc('0x0'));var util=require(_0x35fc('0x1'));var logger=require('../../config/logger')(_0x35fc('0x2'));var moment=require(_0x35fc('0x3'));var BPromise=require(_0x35fc('0x4'));var rp=require(_0x35fc('0x5'));var fs=require('fs');var path=require(_0x35fc('0x6'));var rimraf=require('rimraf');var config=require(_0x35fc('0x7'));var attributes=require(_0x35fc('0x8'));module[_0x35fc('0x9')]=function(_0x5b85ad,_0x5754be){return _0x5b85ad[_0x35fc('0xa')]('OpenchannelQueueReport',attributes,{'tableName':_0x35fc('0xb'),'paranoid':![],'indexes':[{'name':_0x35fc('0xc'),'fields':[_0x35fc('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x7a54=['report_openchannel_queue','uniqueid','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./openchannelQueueReport.attributes','exports','OpenchannelQueueReport'];(function(_0x2d576c,_0x1ae8f6){var _0x153cee=function(_0x4ab2fa){while(--_0x4ab2fa){_0x2d576c['push'](_0x2d576c['shift']());}};_0x153cee(++_0x1ae8f6);}(_0x7a54,0x106));var _0x47a5=function(_0x1182ab,_0x10bb6f){_0x1182ab=_0x1182ab-0x0;var _0x403bac=_0x7a54[_0x1182ab];return _0x403bac;};'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 diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js b/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js index 3c5d5ce..8caf86c 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 _0x7334=['jayson/promise','client','http','request','then','info','OpenchannelQueueReport,\x20%s,\x20%s','debug','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','CreateOpenchannelQueueReport','create','body','options','raw','catch','UpdateOpenchannelQueueReport','OpenchannelQueueReport','update','where','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x1d04b3,_0x2dfd11){var _0x1cf900=function(_0x34a7d9){while(--_0x34a7d9){_0x1d04b3['push'](_0x1d04b3['shift']());}};_0x1cf900(++_0x2dfd11);}(_0x7334,0x184));var _0x4733=function(_0x4fb4f5,_0x199d1b){_0x4fb4f5=_0x4fb4f5-0x0;var _0x5faf2c=_0x7334[_0x4fb4f5];return _0x5faf2c;};'use strict';var _=require(_0x4733('0x0'));var util=require(_0x4733('0x1'));var moment=require(_0x4733('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4733('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x4733('0x4'));var logger=require(_0x4733('0x5'))(_0x4733('0x6'));var config=require(_0x4733('0x7'));var jayson=require(_0x4733('0x8'));var client=jayson[_0x4733('0x9')][_0x4733('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x283754,_0x12cafa,_0x43d95c){return new BPromise(function(_0x8257cf,_0x3562b7){return client[_0x4733('0xb')](_0x283754,_0x43d95c)[_0x4733('0xc')](function(_0x2d5fde){logger[_0x4733('0xd')](_0x4733('0xe'),_0x12cafa,'request\x20sent');logger[_0x4733('0xf')](_0x4733('0x10'),_0x12cafa,'request\x20sent',JSON[_0x4733('0x11')](_0x2d5fde));if(_0x2d5fde['error']){if(_0x2d5fde[_0x4733('0x12')][_0x4733('0x13')]===0x1f4){logger[_0x4733('0x12')](_0x4733('0xe'),_0x12cafa,_0x2d5fde[_0x4733('0x12')][_0x4733('0x14')]);return _0x3562b7(_0x2d5fde[_0x4733('0x12')]['message']);}logger[_0x4733('0x12')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x12cafa,_0x2d5fde[_0x4733('0x12')][_0x4733('0x14')]);return _0x8257cf(_0x2d5fde[_0x4733('0x12')][_0x4733('0x14')]);}else{logger[_0x4733('0xd')](_0x4733('0xe'),_0x12cafa,_0x4733('0x15'));_0x8257cf(_0x2d5fde[_0x4733('0x16')][_0x4733('0x14')]);}})['catch'](function(_0x2c0031){logger[_0x4733('0x12')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x12cafa,_0x2c0031);_0x3562b7(_0x2c0031);});});}exports[_0x4733('0x17')]=function(_0x1d2fb6){var _0x2aa223=this;return new Promise(function(_0x384e0c,_0x579f67){return db['OpenchannelQueueReport'][_0x4733('0x18')](_0x1d2fb6[_0x4733('0x19')],{'raw':_0x1d2fb6['options']?_0x1d2fb6[_0x4733('0x1a')][_0x4733('0x1b')]===undefined?!![]:![]:!![]})[_0x4733('0xc')](function(_0x7a4e0){logger['info'](_0x4733('0x17'),_0x1d2fb6);logger[_0x4733('0xf')]('CreateOpenchannelQueueReport',_0x1d2fb6,JSON[_0x4733('0x11')](_0x7a4e0));_0x384e0c(_0x7a4e0);})[_0x4733('0x1c')](function(_0x478e34){logger[_0x4733('0x12')](_0x4733('0x17'),_0x478e34[_0x4733('0x14')],_0x1d2fb6);_0x579f67(_0x2aa223[_0x4733('0x12')](0x1f4,_0x478e34[_0x4733('0x14')]));});});};exports[_0x4733('0x1d')]=function(_0x180049){var _0x2bb78f=this;return new Promise(function(_0x523697,_0x3e6976){return db[_0x4733('0x1e')][_0x4733('0x1f')](_0x180049[_0x4733('0x19')],{'raw':_0x180049[_0x4733('0x1a')]?_0x180049[_0x4733('0x1a')][_0x4733('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x180049[_0x4733('0x1a')]?_0x180049[_0x4733('0x1a')][_0x4733('0x20')]||null:null,'attributes':_0x180049['options']?_0x180049[_0x4733('0x1a')]['attributes']||null:null,'limit':_0x180049['options']?_0x180049[_0x4733('0x1a')]['limit']||null:null})[_0x4733('0xc')](function(_0x479989){logger['info']('UpdateOpenchannelQueueReport',_0x180049);logger[_0x4733('0xf')](_0x4733('0x1d'),_0x180049,JSON[_0x4733('0x11')](_0x479989));_0x523697(_0x479989);})[_0x4733('0x1c')](function(_0x4fee4a){logger['error']('UpdateOpenchannelQueueReport',_0x4fee4a[_0x4733('0x14')],_0x180049);_0x3e6976(_0x2bb78f['error'](0x1f4,_0x4fee4a['message']));});});}; \ No newline at end of file +var _0xaa5e=['UpdateOpenchannelQueueReport','update','body','attributes','then','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','OpenchannelQueueReport,\x20%s,\x20%s','request\x20sent','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','OpenchannelQueueReport','create','options','raw','CreateOpenchannelQueueReport','debug','catch'];(function(_0x91b85b,_0x39f625){var _0x4d0549=function(_0x1b6cfc){while(--_0x1b6cfc){_0x91b85b['push'](_0x91b85b['shift']());}};_0x4d0549(++_0x39f625);}(_0xaa5e,0xa5));var _0xeaa5=function(_0x1c36b7,_0x17bf0){_0x1c36b7=_0x1c36b7-0x0;var _0x25360d=_0xaa5e[_0x1c36b7];return _0x25360d;};'use strict';var _=require(_0xeaa5('0x0'));var util=require(_0xeaa5('0x1'));var moment=require('moment');var BPromise=require(_0xeaa5('0x2'));var rs=require(_0xeaa5('0x3'));var fs=require('fs');var Redis=require(_0xeaa5('0x4'));var db=require(_0xeaa5('0x5'))['db'];var utils=require(_0xeaa5('0x6'));var logger=require('../../config/logger')(_0xeaa5('0x7'));var config=require(_0xeaa5('0x8'));var jayson=require(_0xeaa5('0x9'));var client=jayson[_0xeaa5('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4d405e,_0x2f9041,_0x2c9696){return new BPromise(function(_0x50cb62,_0x2e35c3){return client[_0xeaa5('0xb')](_0x4d405e,_0x2c9696)['then'](function(_0x2e9ca6){logger['info'](_0xeaa5('0xc'),_0x2f9041,_0xeaa5('0xd'));logger['debug'](_0xeaa5('0xe'),_0x2f9041,_0xeaa5('0xd'),JSON[_0xeaa5('0xf')](_0x2e9ca6));if(_0x2e9ca6[_0xeaa5('0x10')]){if(_0x2e9ca6[_0xeaa5('0x10')][_0xeaa5('0x11')]===0x1f4){logger[_0xeaa5('0x10')](_0xeaa5('0xc'),_0x2f9041,_0x2e9ca6[_0xeaa5('0x10')]['message']);return _0x2e35c3(_0x2e9ca6[_0xeaa5('0x10')][_0xeaa5('0x12')]);}logger[_0xeaa5('0x10')](_0xeaa5('0xc'),_0x2f9041,_0x2e9ca6[_0xeaa5('0x10')]['message']);return _0x50cb62(_0x2e9ca6[_0xeaa5('0x10')]['message']);}else{logger[_0xeaa5('0x13')](_0xeaa5('0xc'),_0x2f9041,_0xeaa5('0xd'));_0x50cb62(_0x2e9ca6['result'][_0xeaa5('0x12')]);}})['catch'](function(_0x44e4b4){logger[_0xeaa5('0x10')](_0xeaa5('0xc'),_0x2f9041,_0x44e4b4);_0x2e35c3(_0x44e4b4);});});}exports['CreateOpenchannelQueueReport']=function(_0x1877a6){var _0x50256a=this;return new Promise(function(_0x222da7,_0x85fb44){return db[_0xeaa5('0x14')][_0xeaa5('0x15')](_0x1877a6['body'],{'raw':_0x1877a6[_0xeaa5('0x16')]?_0x1877a6[_0xeaa5('0x16')][_0xeaa5('0x17')]===undefined?!![]:![]:!![]})['then'](function(_0x11ace2){logger[_0xeaa5('0x13')](_0xeaa5('0x18'),_0x1877a6);logger[_0xeaa5('0x19')](_0xeaa5('0x18'),_0x1877a6,JSON['stringify'](_0x11ace2));_0x222da7(_0x11ace2);})[_0xeaa5('0x1a')](function(_0x5f2d83){logger[_0xeaa5('0x10')](_0xeaa5('0x18'),_0x5f2d83[_0xeaa5('0x12')],_0x1877a6);_0x85fb44(_0x50256a[_0xeaa5('0x10')](0x1f4,_0x5f2d83[_0xeaa5('0x12')]));});});};exports[_0xeaa5('0x1b')]=function(_0x355dbd){var _0xee844c=this;return new Promise(function(_0xebce8c,_0x2c4003){return db[_0xeaa5('0x14')][_0xeaa5('0x1c')](_0x355dbd[_0xeaa5('0x1d')],{'raw':_0x355dbd[_0xeaa5('0x16')]?_0x355dbd[_0xeaa5('0x16')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x355dbd[_0xeaa5('0x16')]?_0x355dbd[_0xeaa5('0x16')]['where']||null:null,'attributes':_0x355dbd[_0xeaa5('0x16')]?_0x355dbd[_0xeaa5('0x16')][_0xeaa5('0x1e')]||null:null,'limit':_0x355dbd[_0xeaa5('0x16')]?_0x355dbd[_0xeaa5('0x16')]['limit']||null:null})[_0xeaa5('0x1f')](function(_0x592fe1){logger[_0xeaa5('0x13')](_0xeaa5('0x1b'),_0x355dbd);logger[_0xeaa5('0x19')](_0xeaa5('0x1b'),_0x355dbd,JSON[_0xeaa5('0xf')](_0x592fe1));_0xebce8c(_0x592fe1);})[_0xeaa5('0x1a')](function(_0x5121b6){logger[_0xeaa5('0x10')](_0xeaa5('0x1b'),_0x5121b6['message'],_0x355dbd);_0x2c4003(_0xee844c[_0xeaa5('0x10')](0x1f4,_0x5121b6['message']));});});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/index.js b/server/api/openchannelTransferReport/index.js index 07e61b7..7acc717 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 _0x6b65=['/describe','/:id','isAuthenticated','create','put','delete','destroy','exports','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./openchannelTransferReport.controller','get','index'];(function(_0x1a3f6b,_0x2c24f9){var _0x46b067=function(_0x2e92f6){while(--_0x2e92f6){_0x1a3f6b['push'](_0x1a3f6b['shift']());}};_0x46b067(++_0x2c24f9);}(_0x6b65,0x14c));var _0x56b6=function(_0x1651ca,_0x24e352){_0x1651ca=_0x1651ca-0x0;var _0x579fd2=_0x6b65[_0x1651ca];return _0x579fd2;};'use strict';var multer=require(_0x56b6('0x0'));var util=require('util');var path=require(_0x56b6('0x1'));var timeout=require('connect-timeout');var express=require(_0x56b6('0x2'));var router=express[_0x56b6('0x3')]();var fs_extra=require(_0x56b6('0x4'));var auth=require(_0x56b6('0x5'));var interaction=require(_0x56b6('0x6'));var config=require('../../config/environment');var controller=require(_0x56b6('0x7'));router[_0x56b6('0x8')]('/',auth['isAuthenticated'](),controller[_0x56b6('0x9')]);router[_0x56b6('0x8')](_0x56b6('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x56b6('0x8')](_0x56b6('0xb'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0x56b6('0xc')](),controller[_0x56b6('0xd')]);router[_0x56b6('0xe')]('/:id',auth[_0x56b6('0xc')](),controller['update']);router[_0x56b6('0xf')](_0x56b6('0xb'),auth[_0x56b6('0xc')](),controller[_0x56b6('0x10')]);module[_0x56b6('0x11')]=router; \ No newline at end of file +var _0xeecd=['update','delete','exports','multer','util','path','Router','./openchannelTransferReport.controller','get','isAuthenticated','index','/describe','describe','show','post','create','put','/:id'];(function(_0xb17137,_0x51d889){var _0x10d596=function(_0x1f78ef){while(--_0x1f78ef){_0xb17137['push'](_0xb17137['shift']());}};_0x10d596(++_0x51d889);}(_0xeecd,0x159));var _0xdeec=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xeecd[_0x14add3];return _0x4a174f;};'use strict';var multer=require(_0xdeec('0x0'));var util=require(_0xdeec('0x1'));var path=require(_0xdeec('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xdeec('0x3')]();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(_0xdeec('0x4'));router[_0xdeec('0x5')]('/',auth[_0xdeec('0x6')](),controller[_0xdeec('0x7')]);router[_0xdeec('0x5')](_0xdeec('0x8'),auth['isAuthenticated'](),controller[_0xdeec('0x9')]);router[_0xdeec('0x5')]('/:id',auth[_0xdeec('0x6')](),controller[_0xdeec('0xa')]);router[_0xdeec('0xb')]('/',auth[_0xdeec('0x6')](),controller[_0xdeec('0xc')]);router[_0xdeec('0xd')](_0xdeec('0xe'),auth[_0xdeec('0x6')](),controller[_0xdeec('0xf')]);router[_0xdeec('0x10')]('/:id',auth[_0xdeec('0x6')](),controller['destroy']);module[_0xdeec('0x11')]=router; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js b/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js index 0f8b580..cc41a53 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 _0xcb91=['STRING','ENUM','account','queue','NOW','exports'];(function(_0x1cd44f,_0x498c23){var _0x55765d=function(_0x5e585f){while(--_0x5e585f){_0x1cd44f['push'](_0x1cd44f['shift']());}};_0x55765d(++_0x498c23);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x5a2d3f,_0x27b04e){_0x5a2d3f=_0x5a2d3f-0x0;var _0x5c65d8=_0xcb91[_0x5a2d3f];return _0x5c65d8;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0x1cb9('0x0')]={'uniqueid':{'type':Sequelize[_0x1cb9('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x1cb9('0x2')](_0x1cb9('0x3'),'agent',_0x1cb9('0x4')),'allowNull':![],'defaultValue':_0x1cb9('0x4')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x1cb9('0x5')]}}; \ No newline at end of file +var _0xf3cd=['exports','STRING','ENUM','account','queue','DATE','moment','sequelize'];(function(_0x5ef77f,_0x24e148){var _0x7a34d6=function(_0x12e228){while(--_0x12e228){_0x5ef77f['push'](_0x5ef77f['shift']());}};_0x7a34d6(++_0x24e148);}(_0xf3cd,0xfe));var _0xdf3c=function(_0x4b174a,_0x33a017){_0x4b174a=_0x4b174a-0x0;var _0x3cd7bf=_0xf3cd[_0x4b174a];return _0x3cd7bf;};'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 diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.controller.js b/server/api/openchannelTransferReport/openchannelTransferReport.controller.js index 8f7ce0e..af1246e 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 _0x3764=['bluebird','mustache','util','path','sox','ejs','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','apply','reject','save','update','error','stack','name','map','rawAttributes','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','filter','where','merge','VIRTUAL','options','OpenchannelTransferReport','then','include','findAll','rows','catch','show','params','create','body','find','destroy','eml-format','rimraf','zip-dir','moment'];(function(_0x52c32b,_0x3cb433){var _0x214963=function(_0x193bbd){while(--_0x193bbd){_0x52c32b['push'](_0x52c32b['shift']());}};_0x214963(++_0x3cb433);}(_0x3764,0x124));var _0x4376=function(_0x534221,_0xb623fd){_0x534221=_0x534221-0x0;var _0x14817b=_0x3764[_0x534221];return _0x14817b;};'use strict';var emlformat=require(_0x4376('0x0'));var rimraf=require(_0x4376('0x1'));var zipdir=require(_0x4376('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x4376('0x3'));var BPromise=require(_0x4376('0x4'));var Mustache=require(_0x4376('0x5'));var util=require(_0x4376('0x6'));var path=require(_0x4376('0x7'));var sox=require(_0x4376('0x8'));var csv=require('to-csv');var ejs=require(_0x4376('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4376('0xa'));var squel=require('squel');var crypto=require(_0x4376('0xb'));var jsforce=require(_0x4376('0xc'));var deskjs=require(_0x4376('0xd'));var toCsv=require(_0x4376('0xe'));var querystring=require(_0x4376('0xf'));var Papa=require(_0x4376('0x10'));var Redis=require(_0x4376('0x11'));var authService=require(_0x4376('0x12'));var qs=require(_0x4376('0x13'));var as=require(_0x4376('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x4376('0x15'))(_0x4376('0x16'));var utils=require('../../config/utils');var config=require(_0x4376('0x17'));var licenseUtil=require(_0x4376('0x18'));var db=require(_0x4376('0x19'))['db'];function respondWithStatusCode(_0x8097ab,_0x4e297b){_0x4e297b=_0x4e297b||0xcc;return function(_0x511b82){if(_0x511b82){return _0x8097ab[_0x4376('0x1a')](_0x4e297b);}return _0x8097ab[_0x4376('0x1b')](_0x4e297b)[_0x4376('0x1c')]();};}function respondWithResult(_0xec172b,_0x7a4b52){_0x7a4b52=_0x7a4b52||0xc8;return function(_0x28b53d){if(_0x28b53d){return _0xec172b['status'](_0x7a4b52)[_0x4376('0x1d')](_0x28b53d);}};}function respondWithFilteredResult(_0x4ed011,_0x6672af){return function(_0x51ae9f){if(_0x51ae9f){var _0x5557ca=typeof _0x6672af['offset']===_0x4376('0x1e')&&typeof _0x6672af[_0x4376('0x1f')]==='undefined';var _0xbdd78e=_0x51ae9f[_0x4376('0x20')];var _0x41966f=_0x5557ca?0x0:_0x6672af[_0x4376('0x21')];var _0x3088cb=_0x5557ca?_0x51ae9f[_0x4376('0x20')]:_0x6672af[_0x4376('0x21')]+_0x6672af[_0x4376('0x1f')];var _0x16bdc4;if(_0x3088cb>=_0xbdd78e){_0x3088cb=_0xbdd78e;_0x16bdc4=0xc8;}else{_0x16bdc4=0xce;}_0x4ed011['status'](_0x16bdc4);return _0x4ed011['set']('Content-Range',_0x41966f+'-'+_0x3088cb+'/'+_0xbdd78e)[_0x4376('0x1d')](_0x51ae9f);}return null;};}function patchUpdates(_0x28b823){return function(_0x26f894){try{jsonpatch[_0x4376('0x22')](_0x26f894,_0x28b823,!![]);}catch(_0x498c4a){return BPromise[_0x4376('0x23')](_0x498c4a);}return _0x26f894[_0x4376('0x24')]();};}function saveUpdates(_0x2900fd,_0x4e2af3){return function(_0x58b314){if(_0x58b314){return _0x58b314[_0x4376('0x25')](_0x2900fd)['then'](function(_0x5d3660){return _0x5d3660;});}return null;};}function removeEntity(_0x59a9c1,_0x21594e){return function(_0x4d38a5){if(_0x4d38a5){return _0x4d38a5['destroy']()['then'](function(){_0x59a9c1[_0x4376('0x1b')](0xcc)[_0x4376('0x1c')]();});}};}function handleEntityNotFound(_0x7c11e5,_0x1ef3e9){return function(_0x411647){if(!_0x411647){_0x7c11e5[_0x4376('0x1a')](0x194);}return _0x411647;};}function handleError(_0x14380a,_0x8836f5){_0x8836f5=_0x8836f5||0x1f4;return function(_0x3cdf9c){logger[_0x4376('0x26')](_0x3cdf9c[_0x4376('0x27')]);if(_0x3cdf9c['name']){delete _0x3cdf9c[_0x4376('0x28')];}_0x14380a[_0x4376('0x1b')](_0x8836f5)['send'](_0x3cdf9c);};}exports['index']=function(_0x167498,_0x1b80cf){var _0x543dcc={},_0x2c5ed2={},_0x4cd439={'count':0x0,'rows':[]};var _0x2ec025=_[_0x4376('0x29')](db['OpenchannelTransferReport'][_0x4376('0x2a')],function(_0x4e0987){return{'name':_0x4e0987['fieldName'],'type':_0x4e0987[_0x4376('0x2b')][_0x4376('0x2c')]};});_0x2c5ed2[_0x4376('0x2d')]=_[_0x4376('0x29')](_0x2ec025,_0x4376('0x28'));_0x2c5ed2[_0x4376('0x2e')]=_[_0x4376('0x2f')](_0x167498[_0x4376('0x2e')]);_0x2c5ed2[_0x4376('0x30')]=_['intersection'](_0x2c5ed2['model'],_0x2c5ed2[_0x4376('0x2e')]);_0x543dcc[_0x4376('0x31')]=_[_0x4376('0x32')](_0x2c5ed2[_0x4376('0x2d')],qs['fields'](_0x167498['query'][_0x4376('0x33')]));_0x543dcc[_0x4376('0x31')]=_0x543dcc[_0x4376('0x31')][_0x4376('0x34')]?_0x543dcc[_0x4376('0x31')]:_0x2c5ed2[_0x4376('0x2d')];if(!_0x167498[_0x4376('0x2e')][_0x4376('0x35')](_0x4376('0x36'))){_0x543dcc[_0x4376('0x1f')]=qs[_0x4376('0x1f')](_0x167498[_0x4376('0x2e')][_0x4376('0x1f')]);_0x543dcc['offset']=qs[_0x4376('0x21')](_0x167498[_0x4376('0x2e')][_0x4376('0x21')]);}_0x543dcc[_0x4376('0x37')]=qs[_0x4376('0x38')](_0x167498['query']['sort']);_0x543dcc['where']=qs[_0x4376('0x30')](_['pick'](_0x167498[_0x4376('0x2e')],_0x2c5ed2[_0x4376('0x30')]),_0x2ec025);if(_0x167498[_0x4376('0x2e')][_0x4376('0x39')]){_0x543dcc[_0x4376('0x3a')]=_[_0x4376('0x3b')](_0x543dcc['where'],{'$or':_[_0x4376('0x29')](_0x2ec025,function(_0x5c9082){if(_0x5c9082[_0x4376('0x2b')]!==_0x4376('0x3c')){var _0xba5183={};_0xba5183[_0x5c9082[_0x4376('0x28')]]={'$like':'%'+_0x167498[_0x4376('0x2e')][_0x4376('0x39')]+'%'};return _0xba5183;}})});}_0x543dcc=_[_0x4376('0x3b')]({},_0x543dcc,_0x167498[_0x4376('0x3d')]);var _0xe21762={'where':_0x543dcc[_0x4376('0x3a')]};return db[_0x4376('0x3e')][_0x4376('0x20')](_0xe21762)[_0x4376('0x3f')](function(_0x34952f){_0x4cd439[_0x4376('0x20')]=_0x34952f;if(_0x167498['query']['includeAll']){_0x543dcc[_0x4376('0x40')]=[{'all':!![]}];}return db['OpenchannelTransferReport'][_0x4376('0x41')](_0x543dcc);})[_0x4376('0x3f')](function(_0x25bf2d){_0x4cd439[_0x4376('0x42')]=_0x25bf2d;return _0x4cd439;})['then'](respondWithFilteredResult(_0x1b80cf,_0x543dcc))[_0x4376('0x43')](handleError(_0x1b80cf,null));};exports[_0x4376('0x44')]=function(_0x5ae22d,_0x441d21){var _0x33d9fd={'raw':!![],'where':{'id':_0x5ae22d[_0x4376('0x45')]['id']}},_0x403df0={};_0x403df0[_0x4376('0x2d')]=_[_0x4376('0x2f')](db[_0x4376('0x3e')][_0x4376('0x2a')]);_0x403df0[_0x4376('0x2e')]=_[_0x4376('0x2f')](_0x5ae22d[_0x4376('0x2e')]);_0x403df0['filters']=_[_0x4376('0x32')](_0x403df0[_0x4376('0x2d')],_0x403df0[_0x4376('0x2e')]);_0x33d9fd['attributes']=_['intersection'](_0x403df0['model'],qs['fields'](_0x5ae22d[_0x4376('0x2e')]['fields']));_0x33d9fd[_0x4376('0x31')]=_0x33d9fd['attributes'][_0x4376('0x34')]?_0x33d9fd['attributes']:_0x403df0[_0x4376('0x2d')];if(_0x5ae22d[_0x4376('0x2e')]['includeAll']){_0x33d9fd[_0x4376('0x40')]=[{'all':!![]}];}_0x33d9fd=_[_0x4376('0x3b')]({},_0x33d9fd,_0x5ae22d['options']);return db[_0x4376('0x3e')]['find'](_0x33d9fd)['then'](handleEntityNotFound(_0x441d21,null))['then'](respondWithResult(_0x441d21,null))['catch'](handleError(_0x441d21,null));};exports['create']=function(_0x50b084,_0x2384c8){return db[_0x4376('0x3e')][_0x4376('0x46')](_0x50b084[_0x4376('0x47')],{})[_0x4376('0x3f')](respondWithResult(_0x2384c8,0xc9))[_0x4376('0x43')](handleError(_0x2384c8,null));};exports[_0x4376('0x25')]=function(_0x20aa97,_0x135799){if(_0x20aa97[_0x4376('0x47')]['id']){delete _0x20aa97['body']['id'];}return db[_0x4376('0x3e')][_0x4376('0x48')]({'where':{'id':_0x20aa97[_0x4376('0x45')]['id']}})['then'](handleEntityNotFound(_0x135799,null))[_0x4376('0x3f')](saveUpdates(_0x20aa97[_0x4376('0x47')],null))['then'](respondWithResult(_0x135799,null))[_0x4376('0x43')](handleError(_0x135799,null));};exports[_0x4376('0x49')]=function(_0x5ce526,_0x5b2feb){return db[_0x4376('0x3e')]['find']({'where':{'id':_0x5ce526[_0x4376('0x45')]['id']}})['then'](handleEntityNotFound(_0x5b2feb,null))['then'](removeEntity(_0x5b2feb,null))[_0x4376('0x43')](handleError(_0x5b2feb,null));};exports['describe']=function(_0x1c38ae,_0x7adfa4){return db[_0x4376('0x3e')]['describe']()[_0x4376('0x3f')](respondWithResult(_0x7adfa4,null))[_0x4376('0x43')](handleError(_0x7adfa4,null));}; \ No newline at end of file +var _0xe2bb=['end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','destroy','then','error','stack','name','index','map','OpenchannelTransferReport','rawAttributes','fieldName','type','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order','where','VIRTUAL','merge','options','includeAll','include','rows','params','find','create','body','catch','update','describe','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/license/util','../../mysqldb','status'];(function(_0x5028f0,_0x47fb90){var _0x2ba45b=function(_0x49411a){while(--_0x49411a){_0x5028f0['push'](_0x5028f0['shift']());}};_0x2ba45b(++_0x47fb90);}(_0xe2bb,0x13d));var _0xbe2b=function(_0x455730,_0x33a55f){_0x455730=_0x455730-0x0;var _0x43ca34=_0xe2bb[_0x455730];return _0x43ca34;};'use strict';var emlformat=require(_0xbe2b('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xbe2b('0x1'));var jsonpatch=require(_0xbe2b('0x2'));var rp=require(_0xbe2b('0x3'));var moment=require('moment');var BPromise=require(_0xbe2b('0x4'));var Mustache=require(_0xbe2b('0x5'));var util=require(_0xbe2b('0x6'));var path=require(_0xbe2b('0x7'));var sox=require(_0xbe2b('0x8'));var csv=require(_0xbe2b('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xbe2b('0xa'));var _=require(_0xbe2b('0xb'));var squel=require(_0xbe2b('0xc'));var crypto=require(_0xbe2b('0xd'));var jsforce=require(_0xbe2b('0xe'));var deskjs=require(_0xbe2b('0xf'));var toCsv=require('to-csv');var querystring=require(_0xbe2b('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xbe2b('0x11'));var hardwareService=require(_0xbe2b('0x12'));var logger=require(_0xbe2b('0x13'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xbe2b('0x14'));var db=require(_0xbe2b('0x15'))['db'];function respondWithStatusCode(_0x4573ac,_0x40c4b3){_0x40c4b3=_0x40c4b3||0xcc;return function(_0x1ca9fe){if(_0x1ca9fe){return _0x4573ac['sendStatus'](_0x40c4b3);}return _0x4573ac[_0xbe2b('0x16')](_0x40c4b3)[_0xbe2b('0x17')]();};}function respondWithResult(_0x67f399,_0x307d64){_0x307d64=_0x307d64||0xc8;return function(_0x2f584b){if(_0x2f584b){return _0x67f399[_0xbe2b('0x16')](_0x307d64)[_0xbe2b('0x18')](_0x2f584b);}};}function respondWithFilteredResult(_0x2dde47,_0x2141e5){return function(_0x2f1cd6){if(_0x2f1cd6){var _0x2baa86=typeof _0x2141e5[_0xbe2b('0x19')]===_0xbe2b('0x1a')&&typeof _0x2141e5[_0xbe2b('0x1b')]==='undefined';var _0x1493b4=_0x2f1cd6[_0xbe2b('0x1c')];var _0x5d3e63=_0x2baa86?0x0:_0x2141e5[_0xbe2b('0x19')];var _0x57cbb5=_0x2baa86?_0x2f1cd6[_0xbe2b('0x1c')]:_0x2141e5[_0xbe2b('0x19')]+_0x2141e5[_0xbe2b('0x1b')];var _0x2fad80;if(_0x57cbb5>=_0x1493b4){_0x57cbb5=_0x1493b4;_0x2fad80=0xc8;}else{_0x2fad80=0xce;}_0x2dde47[_0xbe2b('0x16')](_0x2fad80);return _0x2dde47['set'](_0xbe2b('0x1d'),_0x5d3e63+'-'+_0x57cbb5+'/'+_0x1493b4)[_0xbe2b('0x18')](_0x2f1cd6);}return null;};}function patchUpdates(_0x34dc12){return function(_0x54c1ed){try{jsonpatch[_0xbe2b('0x1e')](_0x54c1ed,_0x34dc12,!![]);}catch(_0x110ef3){return BPromise[_0xbe2b('0x1f')](_0x110ef3);}return _0x54c1ed[_0xbe2b('0x20')]();};}function saveUpdates(_0x28027e,_0x8ea87b){return function(_0x398379){if(_0x398379){return _0x398379['update'](_0x28027e)['then'](function(_0x2e1e32){return _0x2e1e32;});}return null;};}function removeEntity(_0x951438,_0x5b5bff){return function(_0x2fbbe9){if(_0x2fbbe9){return _0x2fbbe9[_0xbe2b('0x21')]()[_0xbe2b('0x22')](function(){_0x951438[_0xbe2b('0x16')](0xcc)[_0xbe2b('0x17')]();});}};}function handleEntityNotFound(_0x20856d,_0xeabafb){return function(_0x1ebece){if(!_0x1ebece){_0x20856d['sendStatus'](0x194);}return _0x1ebece;};}function handleError(_0x269525,_0x4fce85){_0x4fce85=_0x4fce85||0x1f4;return function(_0x3ff30d){logger[_0xbe2b('0x23')](_0x3ff30d[_0xbe2b('0x24')]);if(_0x3ff30d['name']){delete _0x3ff30d[_0xbe2b('0x25')];}_0x269525[_0xbe2b('0x16')](_0x4fce85)['send'](_0x3ff30d);};}exports[_0xbe2b('0x26')]=function(_0x4f89c4,_0xa1a7cc){var _0x3352d6={},_0xf06d53={},_0x34047c={'count':0x0,'rows':[]};var _0x3136ee=_[_0xbe2b('0x27')](db[_0xbe2b('0x28')][_0xbe2b('0x29')],function(_0x23a262){return{'name':_0x23a262[_0xbe2b('0x2a')],'type':_0x23a262[_0xbe2b('0x2b')]['key']};});_0xf06d53[_0xbe2b('0x2c')]=_[_0xbe2b('0x27')](_0x3136ee,'name');_0xf06d53[_0xbe2b('0x2d')]=_[_0xbe2b('0x2e')](_0x4f89c4[_0xbe2b('0x2d')]);_0xf06d53[_0xbe2b('0x2f')]=_[_0xbe2b('0x30')](_0xf06d53['model'],_0xf06d53[_0xbe2b('0x2d')]);_0x3352d6['attributes']=_[_0xbe2b('0x30')](_0xf06d53[_0xbe2b('0x2c')],qs['fields'](_0x4f89c4[_0xbe2b('0x2d')][_0xbe2b('0x31')]));_0x3352d6[_0xbe2b('0x32')]=_0x3352d6['attributes'][_0xbe2b('0x33')]?_0x3352d6[_0xbe2b('0x32')]:_0xf06d53['model'];if(!_0x4f89c4[_0xbe2b('0x2d')][_0xbe2b('0x34')]('nolimit')){_0x3352d6[_0xbe2b('0x1b')]=qs['limit'](_0x4f89c4['query']['limit']);_0x3352d6[_0xbe2b('0x19')]=qs[_0xbe2b('0x19')](_0x4f89c4[_0xbe2b('0x2d')][_0xbe2b('0x19')]);}_0x3352d6[_0xbe2b('0x35')]=qs['sort'](_0x4f89c4['query']['sort']);_0x3352d6['where']=qs[_0xbe2b('0x2f')](_['pick'](_0x4f89c4['query'],_0xf06d53[_0xbe2b('0x2f')]),_0x3136ee);if(_0x4f89c4[_0xbe2b('0x2d')]['filter']){_0x3352d6['where']=_['merge'](_0x3352d6[_0xbe2b('0x36')],{'$or':_[_0xbe2b('0x27')](_0x3136ee,function(_0x571d0d){if(_0x571d0d[_0xbe2b('0x2b')]!==_0xbe2b('0x37')){var _0x4dca36={};_0x4dca36[_0x571d0d[_0xbe2b('0x25')]]={'$like':'%'+_0x4f89c4[_0xbe2b('0x2d')]['filter']+'%'};return _0x4dca36;}})});}_0x3352d6=_[_0xbe2b('0x38')]({},_0x3352d6,_0x4f89c4[_0xbe2b('0x39')]);var _0x1155e4={'where':_0x3352d6[_0xbe2b('0x36')]};return db[_0xbe2b('0x28')][_0xbe2b('0x1c')](_0x1155e4)[_0xbe2b('0x22')](function(_0xc9ab9b){_0x34047c[_0xbe2b('0x1c')]=_0xc9ab9b;if(_0x4f89c4[_0xbe2b('0x2d')][_0xbe2b('0x3a')]){_0x3352d6[_0xbe2b('0x3b')]=[{'all':!![]}];}return db[_0xbe2b('0x28')]['findAll'](_0x3352d6);})['then'](function(_0x20a1bc){_0x34047c[_0xbe2b('0x3c')]=_0x20a1bc;return _0x34047c;})[_0xbe2b('0x22')](respondWithFilteredResult(_0xa1a7cc,_0x3352d6))['catch'](handleError(_0xa1a7cc,null));};exports['show']=function(_0x4b3219,_0x152165){var _0x3ddd70={'raw':!![],'where':{'id':_0x4b3219[_0xbe2b('0x3d')]['id']}},_0x44a3cd={};_0x44a3cd['model']=_[_0xbe2b('0x2e')](db[_0xbe2b('0x28')][_0xbe2b('0x29')]);_0x44a3cd[_0xbe2b('0x2d')]=_[_0xbe2b('0x2e')](_0x4b3219[_0xbe2b('0x2d')]);_0x44a3cd[_0xbe2b('0x2f')]=_[_0xbe2b('0x30')](_0x44a3cd[_0xbe2b('0x2c')],_0x44a3cd[_0xbe2b('0x2d')]);_0x3ddd70['attributes']=_[_0xbe2b('0x30')](_0x44a3cd[_0xbe2b('0x2c')],qs[_0xbe2b('0x31')](_0x4b3219[_0xbe2b('0x2d')][_0xbe2b('0x31')]));_0x3ddd70[_0xbe2b('0x32')]=_0x3ddd70[_0xbe2b('0x32')][_0xbe2b('0x33')]?_0x3ddd70[_0xbe2b('0x32')]:_0x44a3cd[_0xbe2b('0x2c')];if(_0x4b3219[_0xbe2b('0x2d')][_0xbe2b('0x3a')]){_0x3ddd70[_0xbe2b('0x3b')]=[{'all':!![]}];}_0x3ddd70=_[_0xbe2b('0x38')]({},_0x3ddd70,_0x4b3219[_0xbe2b('0x39')]);return db[_0xbe2b('0x28')][_0xbe2b('0x3e')](_0x3ddd70)[_0xbe2b('0x22')](handleEntityNotFound(_0x152165,null))[_0xbe2b('0x22')](respondWithResult(_0x152165,null))['catch'](handleError(_0x152165,null));};exports[_0xbe2b('0x3f')]=function(_0x570bf8,_0x2f3150){return db[_0xbe2b('0x28')]['create'](_0x570bf8[_0xbe2b('0x40')],{})['then'](respondWithResult(_0x2f3150,0xc9))[_0xbe2b('0x41')](handleError(_0x2f3150,null));};exports[_0xbe2b('0x42')]=function(_0x37e009,_0x510587){if(_0x37e009[_0xbe2b('0x40')]['id']){delete _0x37e009[_0xbe2b('0x40')]['id'];}return db['OpenchannelTransferReport']['find']({'where':{'id':_0x37e009[_0xbe2b('0x3d')]['id']}})[_0xbe2b('0x22')](handleEntityNotFound(_0x510587,null))[_0xbe2b('0x22')](saveUpdates(_0x37e009['body'],null))[_0xbe2b('0x22')](respondWithResult(_0x510587,null))['catch'](handleError(_0x510587,null));};exports[_0xbe2b('0x21')]=function(_0x64f421,_0x3bee45){return db[_0xbe2b('0x28')][_0xbe2b('0x3e')]({'where':{'id':_0x64f421[_0xbe2b('0x3d')]['id']}})['then'](handleEntityNotFound(_0x3bee45,null))[_0xbe2b('0x22')](removeEntity(_0x3bee45,null))[_0xbe2b('0x41')](handleError(_0x3bee45,null));};exports[_0xbe2b('0x43')]=function(_0x40a752,_0x2d135d){return db['OpenchannelTransferReport'][_0xbe2b('0x43')]()[_0xbe2b('0x22')](respondWithResult(_0x2d135d,null))[_0xbe2b('0x41')](handleError(_0x2d135d,null));}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.model.js b/server/api/openchannelTransferReport/openchannelTransferReport.model.js index 7ce7cec..a6f2ecb 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 _0x663a=['request-promise','path','rimraf','./openchannelTransferReport.attributes','exports','define','OpenchannelTransferReport','report_openchannel_transfer','lodash','util','../../config/logger','moment','bluebird'];(function(_0x452eef,_0x44ac48){var _0x362709=function(_0x9be0e9){while(--_0x9be0e9){_0x452eef['push'](_0x452eef['shift']());}};_0x362709(++_0x44ac48);}(_0x663a,0x1e9));var _0xa663=function(_0x27a159,_0x1fd3c9){_0x27a159=_0x27a159-0x0;var _0x1a8e9f=_0x663a[_0x27a159];return _0x1a8e9f;};'use strict';var _=require(_0xa663('0x0'));var util=require(_0xa663('0x1'));var logger=require(_0xa663('0x2'))('api');var moment=require(_0xa663('0x3'));var BPromise=require(_0xa663('0x4'));var rp=require(_0xa663('0x5'));var fs=require('fs');var path=require(_0xa663('0x6'));var rimraf=require(_0xa663('0x7'));var config=require('../../config/environment');var attributes=require(_0xa663('0x8'));module[_0xa663('0x9')]=function(_0x35740b,_0x2f5a2f){return _0x35740b[_0xa663('0xa')](_0xa663('0xb'),attributes,{'tableName':_0xa663('0xc'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x61f7=['./openchannelTransferReport.attributes','exports','OpenchannelTransferReport','report_openchannel_transfer','uniqueid','lodash','util','../../config/logger','api','moment','request-promise','rimraf','../../config/environment'];(function(_0x39979b,_0x2111f9){var _0x560b41=function(_0x859cc0){while(--_0x859cc0){_0x39979b['push'](_0x39979b['shift']());}};_0x560b41(++_0x2111f9);}(_0x61f7,0x18b));var _0x761f=function(_0x1e021e,_0x3a4df1){_0x1e021e=_0x1e021e-0x0;var _0x537dbd=_0x61f7[_0x1e021e];return _0x537dbd;};'use strict';var _=require(_0x761f('0x0'));var util=require(_0x761f('0x1'));var logger=require(_0x761f('0x2'))(_0x761f('0x3'));var moment=require(_0x761f('0x4'));var BPromise=require('bluebird');var rp=require(_0x761f('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x761f('0x6'));var config=require(_0x761f('0x7'));var attributes=require(_0x761f('0x8'));module[_0x761f('0x9')]=function(_0x4feda2,_0x1d90f2){return _0x4feda2['define'](_0x761f('0xa'),attributes,{'tableName':_0x761f('0xb'),'paranoid':![],'indexes':[{'name':_0x761f('0xc'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js b/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js index 47e8083..90a8d60 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 _0xeb5d=['then','info','OpenchannelTransferReport,\x20%s,\x20%s','request\x20sent','debug','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xeb5d,0x16b));var _0xdeb5=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0xeb5d[_0x40a045];return _0x1a687c;};'use strict';var _=require('lodash');var util=require(_0xdeb5('0x0'));var moment=require(_0xdeb5('0x1'));var BPromise=require(_0xdeb5('0x2'));var rs=require(_0xdeb5('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xdeb5('0x4'));var logger=require(_0xdeb5('0x5'))('rpc');var config=require(_0xdeb5('0x6'));var jayson=require(_0xdeb5('0x7'));var client=jayson[_0xdeb5('0x8')][_0xdeb5('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x120329,_0x12484b,_0x328d6b){return new BPromise(function(_0x35c086,_0x2c8509){return client[_0xdeb5('0xa')](_0x120329,_0x328d6b)[_0xdeb5('0xb')](function(_0x2114ba){logger[_0xdeb5('0xc')](_0xdeb5('0xd'),_0x12484b,_0xdeb5('0xe'));logger[_0xdeb5('0xf')](_0xdeb5('0x10'),_0x12484b,'request\x20sent',JSON[_0xdeb5('0x11')](_0x2114ba));if(_0x2114ba[_0xdeb5('0x12')]){if(_0x2114ba[_0xdeb5('0x12')][_0xdeb5('0x13')]===0x1f4){logger[_0xdeb5('0x12')](_0xdeb5('0xd'),_0x12484b,_0x2114ba[_0xdeb5('0x12')][_0xdeb5('0x14')]);return _0x2c8509(_0x2114ba['error'][_0xdeb5('0x14')]);}logger['error'](_0xdeb5('0xd'),_0x12484b,_0x2114ba[_0xdeb5('0x12')][_0xdeb5('0x14')]);return _0x35c086(_0x2114ba[_0xdeb5('0x12')][_0xdeb5('0x14')]);}else{logger['info'](_0xdeb5('0xd'),_0x12484b,_0xdeb5('0xe'));_0x35c086(_0x2114ba['result'][_0xdeb5('0x14')]);}})[_0xdeb5('0x15')](function(_0x3521b2){logger['error']('OpenchannelTransferReport,\x20%s,\x20%s',_0x12484b,_0x3521b2);_0x2c8509(_0x3521b2);});});} \ No newline at end of file +var _0x3595=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','then','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','OpenchannelTransferReport,\x20%s,\x20%s','message','info','result','lodash','util','moment'];(function(_0x51d71a,_0x596fda){var _0xff01f1=function(_0x30480f){while(--_0x30480f){_0x51d71a['push'](_0x51d71a['shift']());}};_0xff01f1(++_0x596fda);}(_0x3595,0x147));var _0x5359=function(_0x4e08a7,_0x2ee952){_0x4e08a7=_0x4e08a7-0x0;var _0x5c9b7d=_0x3595[_0x4e08a7];return _0x5c9b7d;};'use strict';var _=require(_0x5359('0x0'));var util=require(_0x5359('0x1'));var moment=require(_0x5359('0x2'));var BPromise=require('bluebird');var rs=require(_0x5359('0x3'));var fs=require('fs');var Redis=require(_0x5359('0x4'));var db=require(_0x5359('0x5'))['db'];var utils=require(_0x5359('0x6'));var logger=require(_0x5359('0x7'))(_0x5359('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x5359('0x9')][_0x5359('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1b6f48,_0x29a776,_0x39fcd8){return new BPromise(function(_0x51b2fb,_0x400db4){return client[_0x5359('0xb')](_0x1b6f48,_0x39fcd8)[_0x5359('0xc')](function(_0x15e2c6){logger['info']('OpenchannelTransferReport,\x20%s,\x20%s',_0x29a776,'request\x20sent');logger['debug'](_0x5359('0xd'),_0x29a776,_0x5359('0xe'),JSON[_0x5359('0xf')](_0x15e2c6));if(_0x15e2c6[_0x5359('0x10')]){if(_0x15e2c6[_0x5359('0x10')][_0x5359('0x11')]===0x1f4){logger[_0x5359('0x10')](_0x5359('0x12'),_0x29a776,_0x15e2c6[_0x5359('0x10')][_0x5359('0x13')]);return _0x400db4(_0x15e2c6[_0x5359('0x10')][_0x5359('0x13')]);}logger[_0x5359('0x10')](_0x5359('0x12'),_0x29a776,_0x15e2c6['error']['message']);return _0x51b2fb(_0x15e2c6[_0x5359('0x10')][_0x5359('0x13')]);}else{logger[_0x5359('0x14')](_0x5359('0x12'),_0x29a776,_0x5359('0xe'));_0x51b2fb(_0x15e2c6[_0x5359('0x15')]['message']);}})['catch'](function(_0x267d4c){logger[_0x5359('0x10')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x29a776,_0x267d4c);_0x400db4(_0x267d4c);});});} \ No newline at end of file diff --git a/server/api/pause/index.js b/server/api/pause/index.js index f83801d..46c97ea 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 _0x9010=['update','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./pause.controller','isAuthenticated','index','get','/:id','show','put'];(function(_0xbe200f,_0x4b50eb){var _0x192597=function(_0x106cfd){while(--_0x106cfd){_0xbe200f['push'](_0xbe200f['shift']());}};_0x192597(++_0x4b50eb);}(_0x9010,0xdf));var _0x0901=function(_0x3391cb,_0x9d79){_0x3391cb=_0x3391cb-0x0;var _0x363f39=_0x9010[_0x3391cb];return _0x363f39;};'use strict';var multer=require(_0x0901('0x0'));var util=require(_0x0901('0x1'));var path=require(_0x0901('0x2'));var timeout=require(_0x0901('0x3'));var express=require(_0x0901('0x4'));var router=express[_0x0901('0x5')]();var fs_extra=require(_0x0901('0x6'));var auth=require(_0x0901('0x7'));var interaction=require(_0x0901('0x8'));var config=require(_0x0901('0x9'));var controller=require(_0x0901('0xa'));router['get']('/',auth[_0x0901('0xb')](),controller[_0x0901('0xc')]);router[_0x0901('0xd')](_0x0901('0xe'),auth[_0x0901('0xb')](),controller[_0x0901('0xf')]);router['post']('/',auth[_0x0901('0xb')](),controller['create']);router[_0x0901('0x10')]('/:id',auth[_0x0901('0xb')](),controller[_0x0901('0x11')]);router[_0x0901('0x12')](_0x0901('0xe'),auth[_0x0901('0xb')](),controller[_0x0901('0x13')]);module['exports']=router; \ No newline at end of file +var _0x88ac=['../../config/environment','./pause.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports','multer','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x30712c,_0x92e797){var _0x5c66e1=function(_0x341d8d){while(--_0x341d8d){_0x30712c['push'](_0x30712c['shift']());}};_0x5c66e1(++_0x92e797);}(_0x88ac,0x72));var _0xc88a=function(_0x11eeda,_0x4a266f){_0x11eeda=_0x11eeda-0x0;var _0x385c89=_0x88ac[_0x11eeda];return _0x385c89;};'use strict';var multer=require(_0xc88a('0x0'));var util=require('util');var path=require(_0xc88a('0x1'));var timeout=require(_0xc88a('0x2'));var express=require('express');var router=express[_0xc88a('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xc88a('0x4'));var interaction=require(_0xc88a('0x5'));var config=require(_0xc88a('0x6'));var controller=require(_0xc88a('0x7'));router[_0xc88a('0x8')]('/',auth[_0xc88a('0x9')](),controller[_0xc88a('0xa')]);router[_0xc88a('0x8')](_0xc88a('0xb'),auth[_0xc88a('0x9')](),controller[_0xc88a('0xc')]);router[_0xc88a('0xd')]('/',auth[_0xc88a('0x9')](),controller[_0xc88a('0xe')]);router[_0xc88a('0xf')](_0xc88a('0xb'),auth[_0xc88a('0x9')](),controller[_0xc88a('0x10')]);router[_0xc88a('0x11')](_0xc88a('0xb'),auth['isAuthenticated'](),controller[_0xc88a('0x12')]);module[_0xc88a('0x13')]=router; \ No newline at end of file diff --git a/server/api/pause/pause.attributes.js b/server/api/pause/pause.attributes.js index df0c791..2633e04 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 _0xbf27=['exports','name','sequelize'];(function(_0x23a417,_0x56ff8e){var _0x3c1651=function(_0x3e2b19){while(--_0x3e2b19){_0x23a417['push'](_0x23a417['shift']());}};_0x3c1651(++_0x56ff8e);}(_0xbf27,0x71));var _0x7bf2=function(_0x15a205,_0x4b9022){_0x15a205=_0x15a205-0x0;var _0x51290a=_0xbf27[_0x15a205];return _0x51290a;};'use strict';var Sequelize=require(_0x7bf2('0x0'));module[_0x7bf2('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x7bf2('0x2'),'allowNull':![]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xba27=['name','exports','STRING'];(function(_0x437dcb,_0x4dce4c){var _0x420f5b=function(_0x1934aa){while(--_0x1934aa){_0x437dcb['push'](_0x437dcb['shift']());}};_0x420f5b(++_0x4dce4c);}(_0xba27,0x14b));var _0x7ba2=function(_0x26f169,_0x2d01b2){_0x26f169=_0x26f169-0x0;var _0x43aad9=_0xba27[_0x26f169];return _0x43aad9;};'use strict';var Sequelize=require('sequelize');module[_0x7ba2('0x0')]={'name':{'type':Sequelize[_0x7ba2('0x1')],'unique':_0x7ba2('0x2'),'allowNull':![]},'description':{'type':Sequelize[_0x7ba2('0x1')]}}; \ No newline at end of file diff --git a/server/api/pause/pause.controller.js b/server/api/pause/pause.controller.js index f001af7..2987496 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 _0x0c9a=['fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','name','includeAll','include','findAll','rows','catch','show','params','rawAttributes','intersection','merge','find','create','user','role','Pauses','UserProfileSection','userProfileId','body','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','count','limit','Content-Range','apply','reject','save','update','destroy','then','get','error','send','index','Pause','type','key','model','map','query','keys','filters','attributes'];(function(_0xde625e,_0x5d34ae){var _0x45cb9b=function(_0x1bf845){while(--_0x1bf845){_0xde625e['push'](_0xde625e['shift']());}};_0x45cb9b(++_0x5d34ae);}(_0x0c9a,0x16c));var _0xa0c9=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0c9a[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa0c9('0x0'));var zipdir=require(_0xa0c9('0x1'));var jsonpatch=require(_0xa0c9('0x2'));var rp=require(_0xa0c9('0x3'));var moment=require(_0xa0c9('0x4'));var BPromise=require(_0xa0c9('0x5'));var Mustache=require(_0xa0c9('0x6'));var util=require(_0xa0c9('0x7'));var path=require('path');var sox=require(_0xa0c9('0x8'));var csv=require('to-csv');var ejs=require(_0xa0c9('0x9'));var fs=require('fs');var fs_extra=require(_0xa0c9('0xa'));var _=require(_0xa0c9('0xb'));var squel=require(_0xa0c9('0xc'));var crypto=require(_0xa0c9('0xd'));var jsforce=require(_0xa0c9('0xe'));var deskjs=require(_0xa0c9('0xf'));var toCsv=require(_0xa0c9('0x10'));var querystring=require(_0xa0c9('0x11'));var Papa=require(_0xa0c9('0x12'));var Redis=require(_0xa0c9('0x13'));var authService=require(_0xa0c9('0x14'));var qs=require(_0xa0c9('0x15'));var as=require(_0xa0c9('0x16'));var hardwareService=require(_0xa0c9('0x17'));var logger=require('../../config/logger')(_0xa0c9('0x18'));var utils=require(_0xa0c9('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0xa0c9('0x1a'));var db=require(_0xa0c9('0x1b'))['db'];function respondWithStatusCode(_0x34dae1,_0x144c33){_0x144c33=_0x144c33||0xcc;return function(_0x40ce85){if(_0x40ce85){return _0x34dae1[_0xa0c9('0x1c')](_0x144c33);}return _0x34dae1['status'](_0x144c33)[_0xa0c9('0x1d')]();};}function respondWithResult(_0x301d33,_0x29783a){_0x29783a=_0x29783a||0xc8;return function(_0xf6965d){if(_0xf6965d){return _0x301d33[_0xa0c9('0x1e')](_0x29783a)[_0xa0c9('0x1f')](_0xf6965d);}};}function respondWithFilteredResult(_0x3ad833,_0x33e97a){return function(_0x1f7f8c){if(_0x1f7f8c){var _0x26673e=typeof _0x33e97a[_0xa0c9('0x20')]===_0xa0c9('0x21')&&typeof _0x33e97a['limit']===_0xa0c9('0x21');var _0xc79787=_0x1f7f8c[_0xa0c9('0x22')];var _0x4c5e73=_0x26673e?0x0:_0x33e97a[_0xa0c9('0x20')];var _0x140590=_0x26673e?_0x1f7f8c[_0xa0c9('0x22')]:_0x33e97a['offset']+_0x33e97a[_0xa0c9('0x23')];var _0x188917;if(_0x140590>=_0xc79787){_0x140590=_0xc79787;_0x188917=0xc8;}else{_0x188917=0xce;}_0x3ad833['status'](_0x188917);return _0x3ad833['set'](_0xa0c9('0x24'),_0x4c5e73+'-'+_0x140590+'/'+_0xc79787)[_0xa0c9('0x1f')](_0x1f7f8c);}return null;};}function patchUpdates(_0x3d16ae){return function(_0x462788){try{jsonpatch[_0xa0c9('0x25')](_0x462788,_0x3d16ae,!![]);}catch(_0x5884a5){return BPromise[_0xa0c9('0x26')](_0x5884a5);}return _0x462788[_0xa0c9('0x27')]();};}function saveUpdates(_0x197e1c,_0x40325a){return function(_0xdf46e1){if(_0xdf46e1){return _0xdf46e1[_0xa0c9('0x28')](_0x197e1c)['then'](function(_0x8f9b6d){return _0x8f9b6d;});}return null;};}function removeEntity(_0x3b8884,_0x3958d2){return function(_0x12a667){if(_0x12a667){return _0x12a667[_0xa0c9('0x29')]()[_0xa0c9('0x2a')](function(){var _0x4df0d1=_0x12a667[_0xa0c9('0x2b')]({'plain':!![]});var _0x3b9337='Pauses';return db['UserProfileResource'][_0xa0c9('0x29')]({'where':{'type':_0x3b9337,'resourceId':_0x4df0d1['id']}})[_0xa0c9('0x2a')](function(){return _0x12a667;});})['then'](function(){_0x3b8884[_0xa0c9('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0xb08a0c,_0x51aedb){return function(_0x4902d7){if(!_0x4902d7){_0xb08a0c[_0xa0c9('0x1c')](0x194);}return _0x4902d7;};}function handleError(_0x4c7c79,_0x243ed8){_0x243ed8=_0x243ed8||0x1f4;return function(_0x4cd43b){logger[_0xa0c9('0x2c')](_0x4cd43b['stack']);if(_0x4cd43b['name']){delete _0x4cd43b['name'];}_0x4c7c79['status'](_0x243ed8)[_0xa0c9('0x2d')](_0x4cd43b);};}exports[_0xa0c9('0x2e')]=function(_0x11c572,_0x5e1c6e){var _0x23ba0d={},_0x27324c={},_0x58ae8f={'count':0x0,'rows':[]};var _0x256b13=_['map'](db[_0xa0c9('0x2f')]['rawAttributes'],function(_0xade344){return{'name':_0xade344['fieldName'],'type':_0xade344[_0xa0c9('0x30')][_0xa0c9('0x31')]};});_0x27324c[_0xa0c9('0x32')]=_[_0xa0c9('0x33')](_0x256b13,'name');_0x27324c[_0xa0c9('0x34')]=_[_0xa0c9('0x35')](_0x11c572[_0xa0c9('0x34')]);_0x27324c[_0xa0c9('0x36')]=_['intersection'](_0x27324c[_0xa0c9('0x32')],_0x27324c[_0xa0c9('0x34')]);_0x23ba0d[_0xa0c9('0x37')]=_['intersection'](_0x27324c[_0xa0c9('0x32')],qs[_0xa0c9('0x38')](_0x11c572[_0xa0c9('0x34')][_0xa0c9('0x38')]));_0x23ba0d['attributes']=_0x23ba0d[_0xa0c9('0x37')][_0xa0c9('0x39')]?_0x23ba0d[_0xa0c9('0x37')]:_0x27324c['model'];if(!_0x11c572[_0xa0c9('0x34')][_0xa0c9('0x3a')](_0xa0c9('0x3b'))){_0x23ba0d['limit']=qs[_0xa0c9('0x23')](_0x11c572['query']['limit']);_0x23ba0d['offset']=qs[_0xa0c9('0x20')](_0x11c572[_0xa0c9('0x34')][_0xa0c9('0x20')]);}_0x23ba0d[_0xa0c9('0x3c')]=qs[_0xa0c9('0x3d')](_0x11c572['query'][_0xa0c9('0x3d')]);_0x23ba0d[_0xa0c9('0x3e')]=qs[_0xa0c9('0x36')](_[_0xa0c9('0x3f')](_0x11c572[_0xa0c9('0x34')],_0x27324c['filters']),_0x256b13);if(_0x11c572[_0xa0c9('0x34')][_0xa0c9('0x40')]){_0x23ba0d[_0xa0c9('0x3e')]=_['merge'](_0x23ba0d[_0xa0c9('0x3e')],{'$or':_[_0xa0c9('0x33')](_0x256b13,function(_0x4ee723){if(_0x4ee723[_0xa0c9('0x30')]!=='VIRTUAL'){var _0x2d3cc5={};_0x2d3cc5[_0x4ee723[_0xa0c9('0x41')]]={'$like':'%'+_0x11c572[_0xa0c9('0x34')][_0xa0c9('0x40')]+'%'};return _0x2d3cc5;}})});}_0x23ba0d=_['merge']({},_0x23ba0d,_0x11c572['options']);var _0x517c55={'where':_0x23ba0d['where']};return db['Pause'][_0xa0c9('0x22')](_0x517c55)['then'](function(_0x4f56d2){_0x58ae8f[_0xa0c9('0x22')]=_0x4f56d2;if(_0x11c572[_0xa0c9('0x34')][_0xa0c9('0x42')]){_0x23ba0d[_0xa0c9('0x43')]=[{'all':!![]}];}return db[_0xa0c9('0x2f')][_0xa0c9('0x44')](_0x23ba0d);})[_0xa0c9('0x2a')](function(_0x57d6b3){_0x58ae8f[_0xa0c9('0x45')]=_0x57d6b3;return _0x58ae8f;})[_0xa0c9('0x2a')](respondWithFilteredResult(_0x5e1c6e,_0x23ba0d))[_0xa0c9('0x46')](handleError(_0x5e1c6e,null));};exports[_0xa0c9('0x47')]=function(_0x59a836,_0x390cae){var _0x26fcc3={'raw':!![],'where':{'id':_0x59a836[_0xa0c9('0x48')]['id']}},_0x22589c={};_0x22589c['model']=_[_0xa0c9('0x35')](db['Pause'][_0xa0c9('0x49')]);_0x22589c[_0xa0c9('0x34')]=_[_0xa0c9('0x35')](_0x59a836[_0xa0c9('0x34')]);_0x22589c['filters']=_[_0xa0c9('0x4a')](_0x22589c[_0xa0c9('0x32')],_0x22589c[_0xa0c9('0x34')]);_0x26fcc3[_0xa0c9('0x37')]=_[_0xa0c9('0x4a')](_0x22589c[_0xa0c9('0x32')],qs[_0xa0c9('0x38')](_0x59a836[_0xa0c9('0x34')][_0xa0c9('0x38')]));_0x26fcc3[_0xa0c9('0x37')]=_0x26fcc3[_0xa0c9('0x37')]['length']?_0x26fcc3['attributes']:_0x22589c[_0xa0c9('0x32')];if(_0x59a836[_0xa0c9('0x34')]['includeAll']){_0x26fcc3[_0xa0c9('0x43')]=[{'all':!![]}];}_0x26fcc3=_[_0xa0c9('0x4b')]({},_0x26fcc3,_0x59a836['options']);return db[_0xa0c9('0x2f')][_0xa0c9('0x4c')](_0x26fcc3)['then'](handleEntityNotFound(_0x390cae,null))[_0xa0c9('0x2a')](respondWithResult(_0x390cae,null))[_0xa0c9('0x46')](handleError(_0x390cae,null));};exports['create']=function(_0x5632b9,_0x1d33fb){return db[_0xa0c9('0x2f')][_0xa0c9('0x4d')](_0x5632b9['body'],{})[_0xa0c9('0x2a')](function(_0x25021e){var _0x4a1db9=_0x5632b9[_0xa0c9('0x4e')][_0xa0c9('0x2b')]({'plain':!![]});if(!_0x4a1db9)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4a1db9[_0xa0c9('0x4f')]===_0xa0c9('0x4e')){var _0x2226ad=_0x25021e[_0xa0c9('0x2b')]({'plain':!![]});var _0x1c81a7=_0xa0c9('0x50');return db[_0xa0c9('0x51')]['find']({'where':{'name':_0x1c81a7,'userProfileId':_0x4a1db9[_0xa0c9('0x52')]},'raw':!![]})[_0xa0c9('0x2a')](function(_0x54e150){if(_0x54e150&&_0x54e150['autoAssociation']===0x0){return db['UserProfileResource'][_0xa0c9('0x4d')]({'name':_0x2226ad[_0xa0c9('0x41')],'resourceId':_0x2226ad['id'],'type':_0x54e150[_0xa0c9('0x41')],'sectionId':_0x54e150['id']},{})[_0xa0c9('0x2a')](function(){return _0x25021e;});}else{return _0x25021e;}})['catch'](function(_0xc34e09){logger[_0xa0c9('0x2c')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xc34e09);throw _0xc34e09;});}return _0x25021e;})[_0xa0c9('0x2a')](respondWithResult(_0x1d33fb,0xc9))[_0xa0c9('0x46')](handleError(_0x1d33fb,null));};exports[_0xa0c9('0x28')]=function(_0xaa8ba9,_0x279242){if(_0xaa8ba9[_0xa0c9('0x53')]['id']){delete _0xaa8ba9[_0xa0c9('0x53')]['id'];}return db[_0xa0c9('0x2f')][_0xa0c9('0x4c')]({'where':{'id':_0xaa8ba9[_0xa0c9('0x48')]['id']}})[_0xa0c9('0x2a')](handleEntityNotFound(_0x279242,null))[_0xa0c9('0x2a')](saveUpdates(_0xaa8ba9[_0xa0c9('0x53')],null))[_0xa0c9('0x2a')](respondWithResult(_0x279242,null))[_0xa0c9('0x46')](handleError(_0x279242,null));};exports[_0xa0c9('0x29')]=function(_0x54ca07,_0x575ed0){return db[_0xa0c9('0x2f')][_0xa0c9('0x4c')]({'where':{'id':_0x54ca07[_0xa0c9('0x48')]['id']}})[_0xa0c9('0x2a')](handleEntityNotFound(_0x575ed0,null))[_0xa0c9('0x2a')](removeEntity(_0x575ed0,null))[_0xa0c9('0x46')](handleError(_0x575ed0,null));}; \ No newline at end of file +var _0xb5d3=['../../mysqldb','sendStatus','status','end','json','limit','undefined','count','offset','Content-Range','apply','reject','save','then','destroy','get','Pauses','UserProfileResource','stack','name','send','index','map','Pause','rawAttributes','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','VIRTUAL','merge','options','includeAll','include','rows','catch','show','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment'];(function(_0x4c4037,_0x15054b){var _0x357862=function(_0x480015){while(--_0x480015){_0x4c4037['push'](_0x4c4037['shift']());}};_0x357862(++_0x15054b);}(_0xb5d3,0x128));var _0x3b5d=function(_0x64b31d,_0x393b36){_0x64b31d=_0x64b31d-0x0;var _0x42c45b=_0xb5d3[_0x64b31d];return _0x42c45b;};'use strict';var emlformat=require(_0x3b5d('0x0'));var rimraf=require(_0x3b5d('0x1'));var zipdir=require(_0x3b5d('0x2'));var jsonpatch=require(_0x3b5d('0x3'));var rp=require(_0x3b5d('0x4'));var moment=require(_0x3b5d('0x5'));var BPromise=require(_0x3b5d('0x6'));var Mustache=require(_0x3b5d('0x7'));var util=require('util');var path=require(_0x3b5d('0x8'));var sox=require(_0x3b5d('0x9'));var csv=require(_0x3b5d('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3b5d('0xb'));var _=require(_0x3b5d('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x3b5d('0xd'));var deskjs=require(_0x3b5d('0xe'));var toCsv=require(_0x3b5d('0xa'));var querystring=require(_0x3b5d('0xf'));var Papa=require(_0x3b5d('0x10'));var Redis=require(_0x3b5d('0x11'));var authService=require(_0x3b5d('0x12'));var qs=require(_0x3b5d('0x13'));var as=require(_0x3b5d('0x14'));var hardwareService=require(_0x3b5d('0x15'));var logger=require('../../config/logger')(_0x3b5d('0x16'));var utils=require('../../config/utils');var config=require(_0x3b5d('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x3b5d('0x18'))['db'];function respondWithStatusCode(_0x425408,_0x23ac46){_0x23ac46=_0x23ac46||0xcc;return function(_0x451c9d){if(_0x451c9d){return _0x425408[_0x3b5d('0x19')](_0x23ac46);}return _0x425408[_0x3b5d('0x1a')](_0x23ac46)[_0x3b5d('0x1b')]();};}function respondWithResult(_0x1e8d34,_0x50027a){_0x50027a=_0x50027a||0xc8;return function(_0x50d9d2){if(_0x50d9d2){return _0x1e8d34[_0x3b5d('0x1a')](_0x50027a)[_0x3b5d('0x1c')](_0x50d9d2);}};}function respondWithFilteredResult(_0x18f96c,_0x372070){return function(_0x22c9c8){if(_0x22c9c8){var _0x49fd98=typeof _0x372070['offset']==='undefined'&&typeof _0x372070[_0x3b5d('0x1d')]===_0x3b5d('0x1e');var _0x41e526=_0x22c9c8[_0x3b5d('0x1f')];var _0x2cb610=_0x49fd98?0x0:_0x372070[_0x3b5d('0x20')];var _0x3e46c6=_0x49fd98?_0x22c9c8[_0x3b5d('0x1f')]:_0x372070[_0x3b5d('0x20')]+_0x372070['limit'];var _0x2edab7;if(_0x3e46c6>=_0x41e526){_0x3e46c6=_0x41e526;_0x2edab7=0xc8;}else{_0x2edab7=0xce;}_0x18f96c[_0x3b5d('0x1a')](_0x2edab7);return _0x18f96c['set'](_0x3b5d('0x21'),_0x2cb610+'-'+_0x3e46c6+'/'+_0x41e526)[_0x3b5d('0x1c')](_0x22c9c8);}return null;};}function patchUpdates(_0x52fedc){return function(_0x254d24){try{jsonpatch[_0x3b5d('0x22')](_0x254d24,_0x52fedc,!![]);}catch(_0x2f392d){return BPromise[_0x3b5d('0x23')](_0x2f392d);}return _0x254d24[_0x3b5d('0x24')]();};}function saveUpdates(_0xc7273c,_0x14f16f){return function(_0x3f5c0c){if(_0x3f5c0c){return _0x3f5c0c['update'](_0xc7273c)[_0x3b5d('0x25')](function(_0x452ecc){return _0x452ecc;});}return null;};}function removeEntity(_0x4aa388,_0x30bd50){return function(_0x3a0f92){if(_0x3a0f92){return _0x3a0f92[_0x3b5d('0x26')]()['then'](function(){var _0x2c13e7=_0x3a0f92[_0x3b5d('0x27')]({'plain':!![]});var _0x229040=_0x3b5d('0x28');return db[_0x3b5d('0x29')][_0x3b5d('0x26')]({'where':{'type':_0x229040,'resourceId':_0x2c13e7['id']}})[_0x3b5d('0x25')](function(){return _0x3a0f92;});})[_0x3b5d('0x25')](function(){_0x4aa388['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x57d0c0,_0x3bc6d8){return function(_0x5563a8){if(!_0x5563a8){_0x57d0c0[_0x3b5d('0x19')](0x194);}return _0x5563a8;};}function handleError(_0x508574,_0x1cde7f){_0x1cde7f=_0x1cde7f||0x1f4;return function(_0x1b4f63){logger['error'](_0x1b4f63[_0x3b5d('0x2a')]);if(_0x1b4f63[_0x3b5d('0x2b')]){delete _0x1b4f63['name'];}_0x508574['status'](_0x1cde7f)[_0x3b5d('0x2c')](_0x1b4f63);};}exports[_0x3b5d('0x2d')]=function(_0xe03a02,_0x38e2bc){var _0x1a35be={},_0xc92c0c={},_0x35c538={'count':0x0,'rows':[]};var _0x16a56c=_[_0x3b5d('0x2e')](db[_0x3b5d('0x2f')][_0x3b5d('0x30')],function(_0x15c0ca){return{'name':_0x15c0ca['fieldName'],'type':_0x15c0ca[_0x3b5d('0x31')]['key']};});_0xc92c0c[_0x3b5d('0x32')]=_['map'](_0x16a56c,_0x3b5d('0x2b'));_0xc92c0c[_0x3b5d('0x33')]=_[_0x3b5d('0x34')](_0xe03a02[_0x3b5d('0x33')]);_0xc92c0c[_0x3b5d('0x35')]=_[_0x3b5d('0x36')](_0xc92c0c['model'],_0xc92c0c[_0x3b5d('0x33')]);_0x1a35be[_0x3b5d('0x37')]=_['intersection'](_0xc92c0c[_0x3b5d('0x32')],qs[_0x3b5d('0x38')](_0xe03a02[_0x3b5d('0x33')][_0x3b5d('0x38')]));_0x1a35be[_0x3b5d('0x37')]=_0x1a35be[_0x3b5d('0x37')][_0x3b5d('0x39')]?_0x1a35be[_0x3b5d('0x37')]:_0xc92c0c[_0x3b5d('0x32')];if(!_0xe03a02['query'][_0x3b5d('0x3a')](_0x3b5d('0x3b'))){_0x1a35be[_0x3b5d('0x1d')]=qs[_0x3b5d('0x1d')](_0xe03a02[_0x3b5d('0x33')][_0x3b5d('0x1d')]);_0x1a35be[_0x3b5d('0x20')]=qs[_0x3b5d('0x20')](_0xe03a02['query']['offset']);}_0x1a35be['order']=qs[_0x3b5d('0x3c')](_0xe03a02['query'][_0x3b5d('0x3c')]);_0x1a35be[_0x3b5d('0x3d')]=qs[_0x3b5d('0x35')](_['pick'](_0xe03a02[_0x3b5d('0x33')],_0xc92c0c[_0x3b5d('0x35')]),_0x16a56c);if(_0xe03a02['query'][_0x3b5d('0x3e')]){_0x1a35be[_0x3b5d('0x3d')]=_['merge'](_0x1a35be[_0x3b5d('0x3d')],{'$or':_[_0x3b5d('0x2e')](_0x16a56c,function(_0x4c7f02){if(_0x4c7f02[_0x3b5d('0x31')]!==_0x3b5d('0x3f')){var _0xdb023e={};_0xdb023e[_0x4c7f02[_0x3b5d('0x2b')]]={'$like':'%'+_0xe03a02[_0x3b5d('0x33')]['filter']+'%'};return _0xdb023e;}})});}_0x1a35be=_[_0x3b5d('0x40')]({},_0x1a35be,_0xe03a02[_0x3b5d('0x41')]);var _0x41af9f={'where':_0x1a35be['where']};return db[_0x3b5d('0x2f')]['count'](_0x41af9f)[_0x3b5d('0x25')](function(_0x3feb8f){_0x35c538[_0x3b5d('0x1f')]=_0x3feb8f;if(_0xe03a02[_0x3b5d('0x33')][_0x3b5d('0x42')]){_0x1a35be[_0x3b5d('0x43')]=[{'all':!![]}];}return db[_0x3b5d('0x2f')]['findAll'](_0x1a35be);})[_0x3b5d('0x25')](function(_0x371a3b){_0x35c538[_0x3b5d('0x44')]=_0x371a3b;return _0x35c538;})[_0x3b5d('0x25')](respondWithFilteredResult(_0x38e2bc,_0x1a35be))[_0x3b5d('0x45')](handleError(_0x38e2bc,null));};exports[_0x3b5d('0x46')]=function(_0xc16ef8,_0x42505f){var _0xc98a7b={'raw':!![],'where':{'id':_0xc16ef8['params']['id']}},_0xca8137={};_0xca8137[_0x3b5d('0x32')]=_[_0x3b5d('0x34')](db[_0x3b5d('0x2f')][_0x3b5d('0x30')]);_0xca8137['query']=_[_0x3b5d('0x34')](_0xc16ef8[_0x3b5d('0x33')]);_0xca8137[_0x3b5d('0x35')]=_[_0x3b5d('0x36')](_0xca8137['model'],_0xca8137[_0x3b5d('0x33')]);_0xc98a7b['attributes']=_[_0x3b5d('0x36')](_0xca8137[_0x3b5d('0x32')],qs[_0x3b5d('0x38')](_0xc16ef8['query'][_0x3b5d('0x38')]));_0xc98a7b[_0x3b5d('0x37')]=_0xc98a7b[_0x3b5d('0x37')]['length']?_0xc98a7b[_0x3b5d('0x37')]:_0xca8137[_0x3b5d('0x32')];if(_0xc16ef8[_0x3b5d('0x33')][_0x3b5d('0x42')]){_0xc98a7b[_0x3b5d('0x43')]=[{'all':!![]}];}_0xc98a7b=_[_0x3b5d('0x40')]({},_0xc98a7b,_0xc16ef8[_0x3b5d('0x41')]);return db[_0x3b5d('0x2f')][_0x3b5d('0x47')](_0xc98a7b)[_0x3b5d('0x25')](handleEntityNotFound(_0x42505f,null))[_0x3b5d('0x25')](respondWithResult(_0x42505f,null))[_0x3b5d('0x45')](handleError(_0x42505f,null));};exports[_0x3b5d('0x48')]=function(_0x1774ce,_0xf3319){return db[_0x3b5d('0x2f')]['create'](_0x1774ce['body'],{})['then'](function(_0x517e32){var _0x34efe8=_0x1774ce[_0x3b5d('0x49')][_0x3b5d('0x27')]({'plain':!![]});if(!_0x34efe8)throw new Error(_0x3b5d('0x4a'));if(_0x34efe8['role']===_0x3b5d('0x49')){var _0x51e2f9=_0x517e32[_0x3b5d('0x27')]({'plain':!![]});var _0x356daa=_0x3b5d('0x28');return db['UserProfileSection'][_0x3b5d('0x47')]({'where':{'name':_0x356daa,'userProfileId':_0x34efe8[_0x3b5d('0x4b')]},'raw':!![]})[_0x3b5d('0x25')](function(_0x502d92){if(_0x502d92&&_0x502d92['autoAssociation']===0x0){return db[_0x3b5d('0x29')][_0x3b5d('0x48')]({'name':_0x51e2f9['name'],'resourceId':_0x51e2f9['id'],'type':_0x502d92['name'],'sectionId':_0x502d92['id']},{})['then'](function(){return _0x517e32;});}else{return _0x517e32;}})[_0x3b5d('0x45')](function(_0x39e64e){logger[_0x3b5d('0x4c')](_0x3b5d('0x4d'),_0x39e64e);throw _0x39e64e;});}return _0x517e32;})[_0x3b5d('0x25')](respondWithResult(_0xf3319,0xc9))['catch'](handleError(_0xf3319,null));};exports['update']=function(_0x5dabfd,_0x2f569d){if(_0x5dabfd[_0x3b5d('0x4e')]['id']){delete _0x5dabfd['body']['id'];}return db[_0x3b5d('0x2f')][_0x3b5d('0x47')]({'where':{'id':_0x5dabfd['params']['id']}})['then'](handleEntityNotFound(_0x2f569d,null))[_0x3b5d('0x25')](saveUpdates(_0x5dabfd['body'],null))[_0x3b5d('0x25')](respondWithResult(_0x2f569d,null))[_0x3b5d('0x45')](handleError(_0x2f569d,null));};exports[_0x3b5d('0x26')]=function(_0x55949f,_0x257e35){return db[_0x3b5d('0x2f')]['find']({'where':{'id':_0x55949f[_0x3b5d('0x4f')]['id']}})[_0x3b5d('0x25')](handleEntityNotFound(_0x257e35,null))[_0x3b5d('0x25')](removeEntity(_0x257e35,null))['catch'](handleError(_0x257e35,null));}; \ No newline at end of file diff --git a/server/api/pause/pause.model.js b/server/api/pause/pause.model.js index aa8d064..ad17716 100644 --- a/server/api/pause/pause.model.js +++ b/server/api/pause/pause.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc4aa=['bluebird','../../config/environment','./pause.attributes','exports','define','Pause','tools_pauses','lodash','util','../../config/logger','api','moment'];(function(_0x2b4411,_0x2625ed){var _0x8e41ef=function(_0x2aa8c1){while(--_0x2aa8c1){_0x2b4411['push'](_0x2b4411['shift']());}};_0x8e41ef(++_0x2625ed);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x36c5b0,_0x5001da){_0x36c5b0=_0x36c5b0-0x0;var _0xf19333=_0xc4aa[_0x36c5b0];return _0xf19333;};'use strict';var _=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var logger=require(_0xac4a('0x2'))(_0xac4a('0x3'));var moment=require(_0xac4a('0x4'));var BPromise=require(_0xac4a('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xac4a('0x6'));var attributes=require(_0xac4a('0x7'));module[_0xac4a('0x8')]=function(_0x215f39,_0x96be2b){return _0x215f39[_0xac4a('0x9')](_0xac4a('0xa'),attributes,{'tableName':_0xac4a('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf494=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./pause.attributes','exports','define','lodash','util'];(function(_0x1382a2,_0x13ff8e){var _0xadaf54=function(_0x1f541a){while(--_0x1f541a){_0x1382a2['push'](_0x1382a2['shift']());}};_0xadaf54(++_0x13ff8e);}(_0xf494,0x1c6));var _0x4f49=function(_0x208ca4,_0x4a028c){_0x208ca4=_0x208ca4-0x0;var _0x5b299f=_0xf494[_0x208ca4];return _0x5b299f;};'use strict';var _=require(_0x4f49('0x0'));var util=require(_0x4f49('0x1'));var logger=require(_0x4f49('0x2'))('api');var moment=require(_0x4f49('0x3'));var BPromise=require(_0x4f49('0x4'));var rp=require(_0x4f49('0x5'));var fs=require('fs');var path=require(_0x4f49('0x6'));var rimraf=require(_0x4f49('0x7'));var config=require(_0x4f49('0x8'));var attributes=require(_0x4f49('0x9'));module[_0x4f49('0xa')]=function(_0xc5e778,_0x413530){return _0xc5e778[_0x4f49('0xb')]('Pause',attributes,{'tableName':'tools_pauses','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/pause/pause.rpc.js b/server/api/pause/pause.rpc.js index b166af2..58b4469 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(_0x1579d4,_0x50df08){var _0x189bc7=function(_0x9df317){while(--_0x9df317){_0x1579d4['push'](_0x1579d4['shift']());}};_0x189bc7(++_0x50df08);}(_0x7a54,0x106));var _0x47a5=function(_0x341661,_0x146b3b){_0x341661=_0x341661-0x0;var _0x35f88a=_0x7a54[_0x341661];return _0x35f88a;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('Pause,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});}exports['ShowPause']=function(_0x5247fd){var _0x423a81=this;return new Promise(function(_0xaf70a6,_0x2ce454){return db[_0x47a5('0x15')][_0x47a5('0x16')]({'raw':_0x5247fd[_0x47a5('0x17')]?_0x5247fd[_0x47a5('0x17')][_0x47a5('0x18')]===undefined?!![]:![]:!![],'where':_0x5247fd[_0x47a5('0x17')]?_0x5247fd['options'][_0x47a5('0x19')]||null:null,'attributes':_0x5247fd[_0x47a5('0x17')]?_0x5247fd['options'][_0x47a5('0x1a')]||null:null,'include':_0x5247fd[_0x47a5('0x17')]?_0x5247fd[_0x47a5('0x17')]['include']?_[_0x47a5('0x1b')](_0x5247fd[_0x47a5('0x17')][_0x47a5('0x1c')],function(_0x7a9f9e){return{'model':db[_0x7a9f9e['model']],'as':_0x7a9f9e['as'],'attributes':_0x7a9f9e[_0x47a5('0x1a')],'include':_0x7a9f9e[_0x47a5('0x1c')]?_['map'](_0x7a9f9e[_0x47a5('0x1c')],function(_0xc4cd63){return{'model':db[_0xc4cd63[_0x47a5('0x1d')]],'as':_0xc4cd63['as'],'attributes':_0xc4cd63[_0x47a5('0x1a')],'include':_0xc4cd63[_0x47a5('0x1c')]?_['map'](_0xc4cd63['include'],function(_0x136745){return{'model':db[_0x136745['model']],'as':_0x136745['as'],'attributes':_0x136745[_0x47a5('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x23cb77){logger[_0x47a5('0xb')](_0x47a5('0x1e'),_0x5247fd);logger[_0x47a5('0xd')](_0x47a5('0x1e'),_0x5247fd,JSON[_0x47a5('0xe')](_0x23cb77));_0xaf70a6(_0x23cb77);})[_0x47a5('0x14')](function(_0x136b14){logger[_0x47a5('0xf')](_0x47a5('0x1e'),_0x136b14[_0x47a5('0x11')],_0x5247fd);_0x2ce454(_0x423a81[_0x47a5('0xf')](0x1f4,_0x136b14[_0x47a5('0x11')]));});});}; \ No newline at end of file +var _0x7a54=['message','request\x20sent','result','catch','Pause','find','options','raw','where','attributes','map','include','model','ShowPause','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','Pause,\x20%s,\x20%s','debug','stringify','error','code'];(function(_0x117c6c,_0x4a1ef0){var _0xfddfd8=function(_0x31d0c1){while(--_0x31d0c1){_0x117c6c['push'](_0x117c6c['shift']());}};_0xfddfd8(++_0x4a1ef0);}(_0x7a54,0x106));var _0x47a5=function(_0x5a19f1,_0x332e5a){_0x5a19f1=_0x5a19f1-0x0;var _0x35e17a=_0x7a54[_0x5a19f1];return _0x35e17a;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('Pause,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});}exports['ShowPause']=function(_0x5247fd){var _0x423a81=this;return new Promise(function(_0xaf70a6,_0x2ce454){return db[_0x47a5('0x15')][_0x47a5('0x16')]({'raw':_0x5247fd[_0x47a5('0x17')]?_0x5247fd[_0x47a5('0x17')][_0x47a5('0x18')]===undefined?!![]:![]:!![],'where':_0x5247fd[_0x47a5('0x17')]?_0x5247fd['options'][_0x47a5('0x19')]||null:null,'attributes':_0x5247fd[_0x47a5('0x17')]?_0x5247fd['options'][_0x47a5('0x1a')]||null:null,'include':_0x5247fd[_0x47a5('0x17')]?_0x5247fd[_0x47a5('0x17')]['include']?_[_0x47a5('0x1b')](_0x5247fd[_0x47a5('0x17')][_0x47a5('0x1c')],function(_0x7a9f9e){return{'model':db[_0x7a9f9e['model']],'as':_0x7a9f9e['as'],'attributes':_0x7a9f9e[_0x47a5('0x1a')],'include':_0x7a9f9e[_0x47a5('0x1c')]?_['map'](_0x7a9f9e[_0x47a5('0x1c')],function(_0xc4cd63){return{'model':db[_0xc4cd63[_0x47a5('0x1d')]],'as':_0xc4cd63['as'],'attributes':_0xc4cd63[_0x47a5('0x1a')],'include':_0xc4cd63[_0x47a5('0x1c')]?_['map'](_0xc4cd63['include'],function(_0x136745){return{'model':db[_0x136745['model']],'as':_0x136745['as'],'attributes':_0x136745[_0x47a5('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x23cb77){logger[_0x47a5('0xb')](_0x47a5('0x1e'),_0x5247fd);logger[_0x47a5('0xd')](_0x47a5('0x1e'),_0x5247fd,JSON[_0x47a5('0xe')](_0x23cb77));_0xaf70a6(_0x23cb77);})[_0x47a5('0x14')](function(_0x136b14){logger[_0x47a5('0xf')](_0x47a5('0x1e'),_0x136b14[_0x47a5('0x11')],_0x5247fd);_0x2ce454(_0x423a81[_0x47a5('0xf')](0x1f4,_0x136b14[_0x47a5('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/plugin/index.js b/server/api/plugin/index.js index 206d281..f39db0a 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 _0xa41a=['util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./plugin.controller','isAuthenticated','index','webhookGet','get','show','/:id/download','download','diskStorage','join','root','originalname','replace','format','%s-%s%s','extname','now','post','file','upload','/webhook','webhookPost','put','/:id','update','delete','exports','multer'];(function(_0x3b231a,_0x53a00d){var _0x18d67a=function(_0x5e14c6){while(--_0x5e14c6){_0x3b231a['push'](_0x3b231a['shift']());}};_0x18d67a(++_0x53a00d);}(_0xa41a,0x6b));var _0xaa41=function(_0x2620a0,_0x2cf0fd){_0x2620a0=_0x2620a0-0x0;var _0x203f87=_0xa41a[_0x2620a0];return _0x203f87;};'use strict';var multer=require(_0xaa41('0x0'));var util=require(_0xaa41('0x1'));var path=require('path');var timeout=require(_0xaa41('0x2'));var express=require(_0xaa41('0x3'));var router=express[_0xaa41('0x4')]();var fs_extra=require(_0xaa41('0x5'));var auth=require(_0xaa41('0x6'));var interaction=require(_0xaa41('0x7'));var config=require(_0xaa41('0x8'));var controller=require(_0xaa41('0x9'));router['get']('/',auth[_0xaa41('0xa')](),controller[_0xaa41('0xb')]);router['get']('/webhook',controller[_0xaa41('0xc')]);router[_0xaa41('0xd')]('/:id',auth[_0xaa41('0xa')](),controller[_0xaa41('0xe')]);router[_0xaa41('0xd')](_0xaa41('0xf'),auth[_0xaa41('0xa')](),controller[_0xaa41('0x10')]);var upload=multer({'storage':multer[_0xaa41('0x11')]({'destination':function(_0x423a19,_0x1c291e,_0x5c9fc7){_0x5c9fc7(null,path[_0xaa41('0x12')](config[_0xaa41('0x13')],'server/files/plugins'));},'filename':function(_0x54827c,_0x1d0a54,_0x518b5b){_0x1d0a54[_0xaa41('0x14')]=_0x1d0a54[_0xaa41('0x14')][_0xaa41('0x15')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x518b5b(null,util[_0xaa41('0x16')](_0xaa41('0x17'),path['basename'](_0x1d0a54[_0xaa41('0x14')],path[_0xaa41('0x18')](_0x1d0a54[_0xaa41('0x14')])),Date[_0xaa41('0x19')](),path[_0xaa41('0x18')](_0x1d0a54[_0xaa41('0x14')])));}})});router[_0xaa41('0x1a')]('/',upload['single'](_0xaa41('0x1b')),controller[_0xaa41('0x1c')]);router[_0xaa41('0x1a')](_0xaa41('0x1d'),controller[_0xaa41('0x1e')]);router[_0xaa41('0x1f')](_0xaa41('0x20'),auth[_0xaa41('0xa')](),controller[_0xaa41('0x21')]);router['delete']('/:id',auth[_0xaa41('0xa')](),controller[_0xaa41('0x22')]);module[_0xaa41('0x23')]=router; \ No newline at end of file +var _0xd6d6=['path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./plugin.controller','get','index','/webhook','webhookGet','/:id','isAuthenticated','/:id/download','download','diskStorage','join','originalname','replace','format','%s-%s%s','extname','now','post','file','upload','put','update','exports','multer','util'];(function(_0x4664db,_0x1de672){var _0x5615b4=function(_0x54fb5a){while(--_0x54fb5a){_0x4664db['push'](_0x4664db['shift']());}};_0x5615b4(++_0x1de672);}(_0xd6d6,0xbe));var _0x6d6d=function(_0x35611a,_0x3293ab){_0x35611a=_0x35611a-0x0;var _0xeb0854=_0xd6d6[_0x35611a];return _0xeb0854;};'use strict';var multer=require(_0x6d6d('0x0'));var util=require(_0x6d6d('0x1'));var path=require(_0x6d6d('0x2'));var timeout=require(_0x6d6d('0x3'));var express=require('express');var router=express[_0x6d6d('0x4')]();var fs_extra=require(_0x6d6d('0x5'));var auth=require(_0x6d6d('0x6'));var interaction=require(_0x6d6d('0x7'));var config=require(_0x6d6d('0x8'));var controller=require(_0x6d6d('0x9'));router[_0x6d6d('0xa')]('/',auth['isAuthenticated'](),controller[_0x6d6d('0xb')]);router[_0x6d6d('0xa')](_0x6d6d('0xc'),controller[_0x6d6d('0xd')]);router[_0x6d6d('0xa')](_0x6d6d('0xe'),auth[_0x6d6d('0xf')](),controller['show']);router['get'](_0x6d6d('0x10'),auth[_0x6d6d('0xf')](),controller[_0x6d6d('0x11')]);var upload=multer({'storage':multer[_0x6d6d('0x12')]({'destination':function(_0xf84314,_0x576c88,_0x1f2b86){_0x1f2b86(null,path[_0x6d6d('0x13')](config['root'],'server/files/plugins'));},'filename':function(_0x176618,_0x32146d,_0xe61c36){_0x32146d[_0x6d6d('0x14')]=_0x32146d[_0x6d6d('0x14')][_0x6d6d('0x15')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0xe61c36(null,util[_0x6d6d('0x16')](_0x6d6d('0x17'),path['basename'](_0x32146d[_0x6d6d('0x14')],path[_0x6d6d('0x18')](_0x32146d[_0x6d6d('0x14')])),Date[_0x6d6d('0x19')](),path[_0x6d6d('0x18')](_0x32146d['originalname'])));}})});router[_0x6d6d('0x1a')]('/',upload['single'](_0x6d6d('0x1b')),controller[_0x6d6d('0x1c')]);router[_0x6d6d('0x1a')]('/webhook',controller['webhookPost']);router[_0x6d6d('0x1d')](_0x6d6d('0xe'),auth[_0x6d6d('0xf')](),controller[_0x6d6d('0x1e')]);router['delete']('/:id',auth[_0x6d6d('0xf')](),controller['delete']);module[_0x6d6d('0x1f')]=router; \ No newline at end of file diff --git a/server/api/plugin/plugin.attributes.js b/server/api/plugin/plugin.attributes.js index be50947..31289b5 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 _0x66f8=['agentOnly','always','never','Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.','sequelize','STRING','ENUM','script','TEXT','The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.','BOOLEAN','adminOnly'];(function(_0x57e467,_0x155fb3){var _0x3edd9d=function(_0x1153e7){while(--_0x1153e7){_0x57e467['push'](_0x57e467['shift']());}};_0x3edd9d(++_0x155fb3);}(_0x66f8,0x178));var _0x866f=function(_0x2e4493,_0x3971c4){_0x2e4493=_0x2e4493-0x0;var _0x55d50b=_0x66f8[_0x2e4493];return _0x55d50b;};'use strict';var Sequelize=require(_0x866f('0x0'));module['exports']={'name':{'type':Sequelize[_0x866f('0x1')]},'type':{'type':Sequelize[_0x866f('0x2')]('html',_0x866f('0x3'))},'description':{'type':Sequelize[_0x866f('0x4')]},'version':{'type':Sequelize['TEXT']},'path':{'type':Sequelize[_0x866f('0x1')],'comment':_0x866f('0x5')},'active':{'type':Sequelize[_0x866f('0x6')],'defaultValue':0x0,'comment':'Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.'},'sidebar':{'type':Sequelize[_0x866f('0x2')](_0x866f('0x7'),_0x866f('0x8'),_0x866f('0x9'),_0x866f('0xa')),'defaultValue':_0x866f('0x9'),'comment':_0x866f('0xb')},'icon':{'type':Sequelize['STRING']},'adminUrl':{'type':Sequelize[_0x866f('0x1')]},'agentUrl':{'type':Sequelize[_0x866f('0x1')]},'scriptName':{'type':Sequelize['STRING']},'scriptPath':{'type':Sequelize[_0x866f('0x1')]}}; \ No newline at end of file +var _0xdaf9=['Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.','sequelize','exports','STRING','html','TEXT','BOOLEAN','Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.','ENUM','adminOnly','never','always'];(function(_0x312e53,_0x7cc669){var _0x38ebd6=function(_0x1cf427){while(--_0x1cf427){_0x312e53['push'](_0x312e53['shift']());}};_0x38ebd6(++_0x7cc669);}(_0xdaf9,0xe5));var _0x9daf=function(_0x4a87a6,_0x52539b){_0x4a87a6=_0x4a87a6-0x0;var _0x735efb=_0xdaf9[_0x4a87a6];return _0x735efb;};'use strict';var Sequelize=require(_0x9daf('0x0'));module[_0x9daf('0x1')]={'name':{'type':Sequelize[_0x9daf('0x2')]},'type':{'type':Sequelize['ENUM'](_0x9daf('0x3'),'script')},'description':{'type':Sequelize[_0x9daf('0x4')]},'version':{'type':Sequelize[_0x9daf('0x4')]},'path':{'type':Sequelize[_0x9daf('0x2')],'comment':'The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.'},'active':{'type':Sequelize[_0x9daf('0x5')],'defaultValue':0x0,'comment':_0x9daf('0x6')},'sidebar':{'type':Sequelize[_0x9daf('0x7')](_0x9daf('0x8'),'agentOnly','always',_0x9daf('0x9')),'defaultValue':_0x9daf('0xa'),'comment':_0x9daf('0xb')},'icon':{'type':Sequelize[_0x9daf('0x2')]},'adminUrl':{'type':Sequelize[_0x9daf('0x2')]},'agentUrl':{'type':Sequelize[_0x9daf('0x2')]},'scriptName':{'type':Sequelize['STRING']},'scriptPath':{'type':Sequelize[_0x9daf('0x2')]}}; \ No newline at end of file diff --git a/server/api/plugin/plugin.controller.js b/server/api/plugin/plugin.controller.js index 93cada1..fca6e51 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 _0x7759=['options','includeAll','include','findAll','show','params','find','catch','join','server/files/plugins','format','basename','createWriteStream','zip','code','ENOENT','Sequelize','Error\x20while\x20generating\x20the\x20zip\x20archive','Error','glob','**/*','dirname','node_modules/**/*','finalize','existsSync','Plugin\x20not\x20found','download','%s.zip','unlinkSync','Download\x20completed','info','Temporary\x20file\x20removed','upload','file','filename','root','chmodSync','0777','readdirSync','Invalid\x20plugin\x20structure','lstatSync','isFile','isDirectory','some','manifest.json','Plugin\x20manifest\x20missing','readFileSync','parse','Invalid\x20manifest:\x20name\x20missing','Invalid\x20manifest:\x20type\x20missing','Invalid\x20manifest:\x20version\x20not\x20specified','Invalid\x20manifest:\x20parameters\x20missing','html','parameters','views','Invalid\x20manifest:\x20views\x20missing','admin','agent','Invalid\x20manifest:\x20no\x20view\x20specified','script','scriptName','scriptPath','Invalid\x20manifest:\x20script\x20path\x20missing','Invalid\x20manifest:\x20invalid\x20type','description','sidebar','always','icon','icon-apps','version','plugins','Warning:\x20admin\x20view\x20not\x20specified','Warning:\x20agent\x20view\x20not\x20specified','test','create','role','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','get','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','Zip\x20archive\x20removed','Extracted\x20folder\x20removed','webhookGet','resolve','\x27PATH\x27\x20parameter\x20not\x20specified','port','\x27PORT\x27\x20parameter\x20not\x20specified','hostname','http://localhost:','encoding','%s%s','headers','content-length','content-type','body','endsWith','statusCode','webhookPost','method','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','extract-zip','rimraf','archiver','ioredis','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','./plugin.socket','register','sendStatus','status','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','destroy','Plugins','UserProfileResource','end','error','stack','name','send','index','map','Plugin','rawAttributes','fieldName','type','key','query','keys','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','merge','filter'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7759,0x119));var _0x9775=function(_0x3616ac,_0x2d4902){_0x3616ac=_0x3616ac-0x0;var _0xe2f620=_0x7759[_0x3616ac];return _0xe2f620;};'use strict';var emlformat=require(_0x9775('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x9775('0x1'));var jsonpatch=require(_0x9775('0x2'));var rp=require(_0x9775('0x3'));var moment=require('moment');var BPromise=require(_0x9775('0x4'));var Mustache=require('mustache');var util=require(_0x9775('0x5'));var path=require(_0x9775('0x6'));var sox=require(_0x9775('0x7'));var csv=require(_0x9775('0x8'));var ejs=require(_0x9775('0x9'));var fs=require('fs');var fs_extra=require(_0x9775('0xa'));var _=require('lodash');var squel=require(_0x9775('0xb'));var crypto=require(_0x9775('0xc'));var jsforce=require(_0x9775('0xd'));var deskjs=require(_0x9775('0xe'));var toCsv=require(_0x9775('0x8'));var querystring=require(_0x9775('0xf'));var Papa=require(_0x9775('0x10'));var extract=require(_0x9775('0x11'));var rimraf=require(_0x9775('0x12'));var archiver=require(_0x9775('0x13'));var Redis=require(_0x9775('0x14'));var authService=require('../../components/auth/service');var qs=require(_0x9775('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9775('0x16'));var logger=require('../../config/logger')(_0x9775('0x17'));var utils=require(_0x9775('0x18'));var config=require(_0x9775('0x19'));var licenseUtil=require(_0x9775('0x1a'));var db=require(_0x9775('0x1b'))['db'];config[_0x9775('0x1c')]=_[_0x9775('0x1d')](config[_0x9775('0x1c')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x9775('0x1c')]));require(_0x9775('0x1e'))[_0x9775('0x1f')](socket);function respondWithStatusCode(_0x40abe8,_0x9cd004){_0x9cd004=_0x9cd004||0xcc;return function(_0x3828ad){if(_0x3828ad){return _0x40abe8[_0x9775('0x20')](_0x9cd004);}return _0x40abe8[_0x9775('0x21')](_0x9cd004)['end']();};}function respondWithResult(_0x362448,_0x445f91){_0x445f91=_0x445f91||0xc8;return function(_0x577434){if(_0x577434){return _0x362448[_0x9775('0x21')](_0x445f91)['json'](_0x577434);}};}function respondWithFilteredResult(_0x3cae2c,_0x197170){return function(_0x2169ea){if(_0x2169ea){var _0x5ee5d0=typeof _0x197170[_0x9775('0x22')]===_0x9775('0x23')&&typeof _0x197170[_0x9775('0x24')]===_0x9775('0x23');var _0x374966=_0x2169ea['count'];var _0x15d097=_0x5ee5d0?0x0:_0x197170[_0x9775('0x22')];var _0x706e68=_0x5ee5d0?_0x2169ea[_0x9775('0x25')]:_0x197170['offset']+_0x197170[_0x9775('0x24')];var _0x38a8be;if(_0x706e68>=_0x374966){_0x706e68=_0x374966;_0x38a8be=0xc8;}else{_0x38a8be=0xce;}_0x3cae2c['status'](_0x38a8be);return _0x3cae2c[_0x9775('0x26')](_0x9775('0x27'),_0x15d097+'-'+_0x706e68+'/'+_0x374966)[_0x9775('0x28')](_0x2169ea);}return null;};}function patchUpdates(_0x359017){return function(_0x44d1d0){try{jsonpatch[_0x9775('0x29')](_0x44d1d0,_0x359017,!![]);}catch(_0x2f53b6){return BPromise[_0x9775('0x2a')](_0x2f53b6);}return _0x44d1d0[_0x9775('0x2b')]();};}function saveUpdates(_0x28991c,_0x303aca){return function(_0x43c03e){if(_0x43c03e){return _0x43c03e[_0x9775('0x2c')](_0x28991c)[_0x9775('0x2d')](function(_0x428d7f){return _0x428d7f;});}return null;};}function removeEntity(_0x115149,_0x468c36){return function(_0x895cce){if(_0x895cce){return _0x895cce[_0x9775('0x2e')]()['then'](function(){var _0x5811a6=_0x895cce['get']({'plain':!![]});var _0x24a8b5=_0x9775('0x2f');return db[_0x9775('0x30')]['destroy']({'where':{'type':_0x24a8b5,'resourceId':_0x5811a6['id']}})[_0x9775('0x2d')](function(){return _0x895cce;});})[_0x9775('0x2d')](function(){_0x115149[_0x9775('0x21')](0xcc)[_0x9775('0x31')]();});}};}function handleEntityNotFound(_0xc1bb9b,_0x56f6e3){return function(_0x2902cf){if(!_0x2902cf){_0xc1bb9b[_0x9775('0x20')](0x194);}return _0x2902cf;};}function handleError(_0x10ab02,_0x4a5990){_0x4a5990=_0x4a5990||0x1f4;return function(_0xfdaa3c){logger[_0x9775('0x32')](_0xfdaa3c[_0x9775('0x33')]);if(_0xfdaa3c[_0x9775('0x34')]){delete _0xfdaa3c[_0x9775('0x34')];}_0x10ab02['status'](_0x4a5990)[_0x9775('0x35')](_0xfdaa3c);};}exports[_0x9775('0x36')]=function(_0x37701c,_0x133048){var _0x18295a={},_0x1680a4={},_0x71a1d={'count':0x0,'rows':[]};var _0x162244=_[_0x9775('0x37')](db[_0x9775('0x38')][_0x9775('0x39')],function(_0x15f5de){return{'name':_0x15f5de[_0x9775('0x3a')],'type':_0x15f5de[_0x9775('0x3b')][_0x9775('0x3c')]};});_0x1680a4['model']=_[_0x9775('0x37')](_0x162244,_0x9775('0x34'));_0x1680a4[_0x9775('0x3d')]=_[_0x9775('0x3e')](_0x37701c['query']);_0x1680a4['filters']=_['intersection'](_0x1680a4[_0x9775('0x3f')],_0x1680a4[_0x9775('0x3d')]);_0x18295a[_0x9775('0x40')]=_[_0x9775('0x41')](_0x1680a4[_0x9775('0x3f')],qs['fields'](_0x37701c[_0x9775('0x3d')][_0x9775('0x42')]));_0x18295a[_0x9775('0x40')]=_0x18295a[_0x9775('0x40')][_0x9775('0x43')]?_0x18295a[_0x9775('0x40')]:_0x1680a4[_0x9775('0x3f')];if(!_0x37701c['query'][_0x9775('0x44')](_0x9775('0x45'))){_0x18295a[_0x9775('0x24')]=qs[_0x9775('0x24')](_0x37701c[_0x9775('0x3d')][_0x9775('0x24')]);_0x18295a[_0x9775('0x22')]=qs[_0x9775('0x22')](_0x37701c['query']['offset']);}_0x18295a[_0x9775('0x46')]=qs['sort'](_0x37701c[_0x9775('0x3d')][_0x9775('0x47')]);_0x18295a[_0x9775('0x48')]=qs['filters'](_[_0x9775('0x49')](_0x37701c[_0x9775('0x3d')],_0x1680a4[_0x9775('0x4a')]),_0x162244);if(_0x37701c[_0x9775('0x3d')]['filter']){_0x18295a[_0x9775('0x48')]=_[_0x9775('0x4b')](_0x18295a['where'],{'$or':_[_0x9775('0x37')](_0x162244,function(_0x1beaac){if(_0x1beaac[_0x9775('0x3b')]!=='VIRTUAL'){var _0x476f6d={};_0x476f6d[_0x1beaac[_0x9775('0x34')]]={'$like':'%'+_0x37701c['query'][_0x9775('0x4c')]+'%'};return _0x476f6d;}})});}_0x18295a=_[_0x9775('0x4b')]({},_0x18295a,_0x37701c[_0x9775('0x4d')]);var _0x4e7c59={'where':_0x18295a[_0x9775('0x48')]};return db['Plugin'][_0x9775('0x25')](_0x4e7c59)[_0x9775('0x2d')](function(_0x5d533d){_0x71a1d['count']=_0x5d533d;if(_0x37701c[_0x9775('0x3d')][_0x9775('0x4e')]){_0x18295a[_0x9775('0x4f')]=[{'all':!![]}];}return db[_0x9775('0x38')][_0x9775('0x50')](_0x18295a);})[_0x9775('0x2d')](function(_0x33c336){_0x71a1d['rows']=_0x33c336;return _0x71a1d;})[_0x9775('0x2d')](respondWithFilteredResult(_0x133048,_0x18295a))['catch'](handleError(_0x133048,null));};exports[_0x9775('0x51')]=function(_0x54f4c4,_0x3f2cfd){var _0x5755f9={'raw':!![],'where':{'id':_0x54f4c4[_0x9775('0x52')]['id']}},_0x49135c={};_0x49135c[_0x9775('0x3f')]=_[_0x9775('0x3e')](db[_0x9775('0x38')]['rawAttributes']);_0x49135c[_0x9775('0x3d')]=_[_0x9775('0x3e')](_0x54f4c4[_0x9775('0x3d')]);_0x49135c[_0x9775('0x4a')]=_[_0x9775('0x41')](_0x49135c[_0x9775('0x3f')],_0x49135c[_0x9775('0x3d')]);_0x5755f9['attributes']=_['intersection'](_0x49135c['model'],qs[_0x9775('0x42')](_0x54f4c4[_0x9775('0x3d')]['fields']));_0x5755f9['attributes']=_0x5755f9[_0x9775('0x40')][_0x9775('0x43')]?_0x5755f9[_0x9775('0x40')]:_0x49135c[_0x9775('0x3f')];if(_0x54f4c4[_0x9775('0x3d')][_0x9775('0x4e')]){_0x5755f9['include']=[{'all':!![]}];}_0x5755f9=_['merge']({},_0x5755f9,_0x54f4c4[_0x9775('0x4d')]);return db[_0x9775('0x38')][_0x9775('0x53')](_0x5755f9)[_0x9775('0x2d')](handleEntityNotFound(_0x3f2cfd,null))[_0x9775('0x2d')](respondWithResult(_0x3f2cfd,null))[_0x9775('0x54')](handleError(_0x3f2cfd,null));};exports['download']=function(_0x357951,_0x206b59,_0x3dc7d7){return db[_0x9775('0x38')][_0x9775('0x53')]({'where':{'id':_0x357951['params']['id']},'attributes':['name',_0x9775('0x6')],'raw':!![]})[_0x9775('0x2d')](handleEntityNotFound(_0x206b59,null))[_0x9775('0x2d')](function(_0x12998d){if(_0x12998d){var _0x26e727=path[_0x9775('0x55')](config['root'],_0x9775('0x56'),util[_0x9775('0x57')]('%s.zip',path[_0x9775('0x58')](_0x12998d[_0x9775('0x6')])));var _0x48eced=fs[_0x9775('0x59')](_0x26e727);var _0x2e64ac=archiver(_0x9775('0x5a'),{'zlib':{'level':0x9}});_0x2e64ac['on']('warning',function(_0x272057){if(_0x272057[_0x9775('0x5b')]===_0x9775('0x5c')){logger['error'](_0x272057);}else{throw new db[(_0x9775('0x5d'))]['Error'](_0x9775('0x5e'));}});_0x2e64ac['on'](_0x9775('0x32'),function(_0x4481d4){throw new db[(_0x9775('0x5d'))][(_0x9775('0x5f'))](_0x9775('0x5e'));});_0x2e64ac['pipe'](_0x48eced);_0x2e64ac[_0x9775('0x60')](_0x9775('0x61'),{'cwd':path[_0x9775('0x55')](config['root'],'server/files/plugins',path[_0x9775('0x62')](_0x12998d[_0x9775('0x6')])),'ignore':[path[_0x9775('0x55')](path[_0x9775('0x58')](_0x12998d[_0x9775('0x6')]),_0x9775('0x63')),path['join'](path[_0x9775('0x58')](_0x12998d[_0x9775('0x6')]),'attachments/**/*')],'nodir':!![]})[_0x9775('0x64')]();_0x48eced['on']('close',function(){if(!fs[_0x9775('0x65')](_0x26e727)){throw new db['Sequelize'][(_0x9775('0x5f'))](_0x9775('0x66'));}return _0x206b59[_0x9775('0x67')](_0x26e727,util[_0x9775('0x57')](_0x9775('0x68'),path[_0x9775('0x58')](_0x12998d[_0x9775('0x6')])),function(_0x90649){if(_0x90649){throw new db[(_0x9775('0x5d'))]['Error']('Error\x20while\x20downloading\x20the\x20plugin');}fs[_0x9775('0x69')](_0x26e727);logger['info'](_0x9775('0x6a'));logger[_0x9775('0x6b')](_0x9775('0x6c'));});});}return null;})[_0x9775('0x54')](handleError(_0x206b59,null));};exports[_0x9775('0x6d')]=function(_0x2d84d2,_0x3d345a,_0x4b19cf){var _0xc7224b=path[_0x9775('0x58')](_0x2d84d2[_0x9775('0x6e')][_0x9775('0x6f')],path['extname'](_0x2d84d2['file'][_0x9775('0x6f')]));var _0x178aab=path[_0x9775('0x55')](config['root'],'server/files/plugins',_0x2d84d2[_0x9775('0x6e')]['filename']);var _0x52b9c4=path[_0x9775('0x55')](config[_0x9775('0x70')],'server/files/plugins',_0xc7224b);logger[_0x9775('0x6b')]('Plugin\x20upload\x20filepath:\x20%s',_0x178aab);logger['info']('Plugin\x20upload\x20destination:\x20%s',_0x52b9c4);try{fs[_0x9775('0x71')](_0x178aab,parseInt(_0x9775('0x72'),0x8));extract(_0x178aab,{'dir':_0x52b9c4},function(_0x5263b2){if(_0x5263b2){logger[_0x9775('0x32')](_0x5263b2);handleError(_0x5263b2,!![]);};var _0x45686a=fs[_0x9775('0x73')](_0x52b9c4);if(_0x45686a[_0x9775('0x43')]>0x1){removeReferences(_0x178aab,_0x52b9c4);logger[_0x9775('0x32')](_0x9775('0x74'));return _0x4b19cf(new Error('Invalid\x20plugin\x20structure'));}var _0x195862=fs[_0x9775('0x75')](path[_0x9775('0x55')](_0x52b9c4,_0x45686a[0x0]));if(_0x195862[_0x9775('0x76')]()){removeReferences(_0x178aab,_0x52b9c4);logger[_0x9775('0x32')](_0x9775('0x74'));return _0x4b19cf(new Error('Invalid\x20plugin\x20structure'));}if(_0x195862[_0x9775('0x77')]()){var _0x1dc66f=fs[_0x9775('0x73')](path['join'](_0x52b9c4,_0x45686a[0x0]));if(_0x1dc66f['length']===0x0){removeReferences(_0x178aab,_0x52b9c4);logger[_0x9775('0x32')](_0x9775('0x74'));return _0x4b19cf(new Error(_0x9775('0x74')));}var _0x4fa0b2=_0x1dc66f[_0x9775('0x78')](function(_0x3406bb){return _0x3406bb===_0x9775('0x79');});if(!_0x4fa0b2){return _0x4b19cf(new Error(_0x9775('0x7a')));}var _0x1b2548=fs[_0x9775('0x7b')](path[_0x9775('0x55')](_0x52b9c4,_0x45686a[0x0],_0x9775('0x79')));var _0x4e14dc=JSON[_0x9775('0x7c')](_0x1b2548);if(_0x9775('0x23')==typeof _0x4e14dc[_0x9775('0x34')]){return _0x4b19cf(new Error(_0x9775('0x7d')));}if(_0x9775('0x23')==typeof _0x4e14dc['type']){return _0x4b19cf(new Error(_0x9775('0x7e')));}if('undefined'==typeof _0x4e14dc['version']){return _0x4b19cf(new Error(_0x9775('0x7f')));}if(_0x9775('0x23')==typeof _0x4e14dc['parameters']){return _0x4b19cf(new Error(_0x9775('0x80')));}if(_0x4e14dc[_0x9775('0x3b')]===_0x9775('0x81')){if('undefined'==typeof _0x4e14dc[_0x9775('0x82')][_0x9775('0x83')]){return _0x4b19cf(new Error(_0x9775('0x84')));}if('undefined'==typeof _0x4e14dc['parameters'][_0x9775('0x83')][_0x9775('0x85')]&&_0x9775('0x23')==typeof _0x4e14dc['parameters']['views'][_0x9775('0x86')]){return _0x4b19cf(new Error(_0x9775('0x87')));}}else if(_0x4e14dc['type']===_0x9775('0x88')){if(_0x9775('0x23')==typeof _0x4e14dc[_0x9775('0x82')][_0x9775('0x89')]){return _0x4b19cf(new Error('Invalid\x20manifest:\x20script\x20name\x20missing'));}if(_0x9775('0x23')==typeof _0x4e14dc[_0x9775('0x82')][_0x9775('0x8a')]){return _0x4b19cf(new Error(_0x9775('0x8b')));}}else{return _0x4b19cf(new Error(_0x9775('0x8c')));}var _0x4a32f3=_0x4e14dc[_0x9775('0x34')];var _0x483cd9=_0x4e14dc[_0x9775('0x8d')];var _0x581224=_0x4e14dc[_0x9775('0x3b')];var _0x21414d=_0x4e14dc[_0x9775('0x8e')]?_0x4e14dc['sidebar']:_0x9775('0x8f');var _0xe51125=_0x4e14dc[_0x9775('0x90')]?_0x4e14dc[_0x9775('0x90')]:_0x9775('0x91');var _0x38860f='';var _0x556dea='';var _0x404d13='';var _0x2137d1='';var _0x59c299=_0x4e14dc[_0x9775('0x92')];if(_0x581224===_0x9775('0x81')){if(_0x9775('0x23')!=typeof _0x4e14dc[_0x9775('0x82')][_0x9775('0x83')][_0x9775('0x85')]){var _0x3686ac=_0x4e14dc['parameters'][_0x9775('0x83')][_0x9775('0x85')];if(!/^(f|ht)tps?:\/\//i['test'](_0x3686ac)){_0x38860f=path[_0x9775('0x55')](_0x9775('0x93'),_0xc7224b,_0x45686a[0x0],_0x3686ac);}else{_0x38860f=_0x3686ac;}}else{logger['info'](_0x9775('0x94'));}if('undefined'!=typeof _0x4e14dc[_0x9775('0x82')][_0x9775('0x83')]['agent']){var _0x44d8b8=_0x4e14dc[_0x9775('0x82')][_0x9775('0x83')]['agent'];if(!/^(f|ht)tps?:\/\//i['test'](_0x44d8b8)){_0x556dea=path[_0x9775('0x55')](_0x9775('0x93'),_0xc7224b,_0x45686a[0x0],_0x44d8b8);}else{_0x556dea=_0x44d8b8;}}else{logger[_0x9775('0x6b')](_0x9775('0x95'));}}else if(_0x581224===_0x9775('0x88')){_0x404d13=_0x4e14dc['parameters'][_0x9775('0x89')];_0x2137d1=_0x4e14dc['parameters'][_0x9775('0x8a')];if('undefined'!=typeof _0x4e14dc['parameters']['views']){if('undefined'!=typeof _0x4e14dc[_0x9775('0x82')][_0x9775('0x83')]['admin']){var _0x3686ac=_0x4e14dc[_0x9775('0x82')][_0x9775('0x83')][_0x9775('0x85')];if(!/^(f|ht)tps?:\/\//i[_0x9775('0x96')](_0x3686ac)){_0x38860f=path['join']('plugins',_0xc7224b,_0x45686a[0x0],_0x3686ac);}else{_0x38860f=_0x3686ac;}}if(_0x9775('0x23')!=typeof _0x4e14dc[_0x9775('0x82')][_0x9775('0x83')][_0x9775('0x86')]){var _0x44d8b8=_0x4e14dc[_0x9775('0x82')][_0x9775('0x83')]['agent'];if(!/^(f|ht)tps?:\/\//i[_0x9775('0x96')](_0x44d8b8)){_0x556dea=path['join']('plugins',_0xc7224b,_0x45686a[0x0],_0x44d8b8);}else{_0x556dea=_0x44d8b8;}}}}var _0x5b2029={'name':_0x4a32f3,'description':_0x483cd9,'path':path[_0x9775('0x55')](_0xc7224b,_0x45686a[0x0]),'type':_0x581224,'sidebar':_0x21414d,'icon':_0xe51125,'adminUrl':_0x38860f,'agentUrl':_0x556dea,'scriptName':_0x404d13,'scriptPath':_0x2137d1,'version':_0x59c299};removeReferences(_0x178aab,null);return db[_0x9775('0x38')][_0x9775('0x97')](_0x5b2029)[_0x9775('0x2d')](function(_0x24ad6d){var _0x2fc6e7={'role':_0x2d84d2['body'][_0x9775('0x98')],'userProfileId':_0x2d84d2['body'][_0x9775('0x99')]};if(!_0x2fc6e7)throw new Error(_0x9775('0x9a'));if(_0x2fc6e7[_0x9775('0x98')]===_0x9775('0x9b')){var _0x26a6ec=_0x24ad6d[_0x9775('0x9c')]({'plain':!![]});return db[_0x9775('0x9d')][_0x9775('0x53')]({'where':{'name':_0x9775('0x2f'),'userProfileId':_0x2fc6e7[_0x9775('0x99')]},'raw':!![]})['then'](function(_0x33123b){if(_0x33123b&&_0x33123b[_0x9775('0x9e')]===0x0){return db['UserProfileResource']['create']({'name':_0x26a6ec[_0x9775('0x34')],'resourceId':_0x26a6ec['id'],'type':_0x33123b[_0x9775('0x34')],'sectionId':_0x33123b['id']},{})['then'](function(){return _0x24ad6d;});}else{return _0x24ad6d;}})['catch'](function(_0x92d01f){logger[_0x9775('0x32')](_0x9775('0x9f'),_0x92d01f);throw _0x92d01f;});}return _0x24ad6d;})[_0x9775('0x2d')](respondWithResult(_0x3d345a,null))['catch'](handleError(_0x3d345a,null));}});}catch(_0x3716f0){_0x3d345a[_0x9775('0x21')](0x1f4)[_0x9775('0x35')](_0x3716f0);}};function removeReferences(_0x40b7f3,_0x3b819d){try{if(_0x40b7f3){fs['unlinkSync'](_0x40b7f3);logger[_0x9775('0x6b')](_0x9775('0xa0'));}if(_0x3b819d){rimraf(_0x3b819d,function(){});logger[_0x9775('0x6b')](_0x9775('0xa1'));}}catch(_0x3397ee){logger[_0x9775('0x32')](_0x3397ee);}}exports[_0x9775('0x2c')]=function(_0x565ddb,_0x1fbc2e,_0x4848f6){return db['Plugin']['find']({'where':{'id':_0x565ddb[_0x9775('0x52')]['id']}})[_0x9775('0x2d')](handleEntityNotFound(_0x1fbc2e,null))[_0x9775('0x2d')](saveUpdates(_0x565ddb['body'],null))[_0x9775('0x2d')](respondWithResult(_0x1fbc2e,null))[_0x9775('0x54')](handleError(_0x1fbc2e,null));};exports['delete']=function(_0x1362a1,_0x4790ed,_0x455d32){return db['Plugin']['find']({'where':{'id':_0x1362a1['params']['id']}})[_0x9775('0x2d')](function(_0x4b769c){if(_0x4b769c){return _0x4b769c[_0x9775('0x2e')]();}})[_0x9775('0x2d')](function(_0x353fc9){rimraf(path[_0x9775('0x55')](config['root'],'server/files/plugins',path['dirname'](_0x353fc9[_0x9775('0x6')])),function(){});return _0x353fc9;})[_0x9775('0x2d')](handleEntityNotFound(_0x4790ed,null))[_0x9775('0x2d')](respondWithStatusCode(_0x4790ed,null))[_0x9775('0x54')](handleError(_0x4790ed,null));};exports[_0x9775('0xa2')]=function(_0x4332dd,_0xe23bd2,_0x47dd54){return BPromise[_0x9775('0xa3')]()[_0x9775('0x2d')](function(){if(!_0x4332dd[_0x9775('0x3d')][_0x9775('0x6')]){throw new Error(_0x9775('0xa4'));}if(!_0x4332dd[_0x9775('0x3d')][_0x9775('0xa5')]){throw new Error(_0x9775('0xa6'));}var _0x23824c=_0x4332dd[_0x9775('0x3d')][_0x9775('0xa7')]?_0x4332dd['query'][_0x9775('0xa7')]+':'+_0x4332dd[_0x9775('0x3d')][_0x9775('0xa5')]:_0x9775('0xa8')+_0x4332dd[_0x9775('0x3d')][_0x9775('0xa5')];var _0x3da84b=_0x4332dd['query'][_0x9775('0x28')]?_0x4332dd[_0x9775('0x3d')][_0x9775('0x28')]:!![];var _0xd59f59=_0x4332dd[_0x9775('0x3d')][_0x9775('0xa9')]?_0x4332dd[_0x9775('0x3d')][_0x9775('0xa9')]:null;var _0x6c1afb={'method':_0x4332dd['method'],'uri':util[_0x9775('0x57')](_0x9775('0xaa'),_0x23824c,_0x4332dd['query'][_0x9775('0x6')]),'json':_0x3da84b,'resolveWithFullResponse':!![],'encoding':_0xd59f59,'qs':_0x4332dd[_0x9775('0x3d')]};if(_0x4332dd[_0x9775('0xab')]){_0x6c1afb[_0x9775('0xab')]=_0x4332dd[_0x9775('0xab')];if(_0x6c1afb[_0x9775('0xab')]['content-length']){delete _0x6c1afb[_0x9775('0xab')][_0x9775('0xac')];}}if(_0x6c1afb[_0x9775('0xab')][_0x9775('0xad')]){delete _0x6c1afb['headers']['content-type'];}return rp(_0x6c1afb);})[_0x9775('0x2d')](function(_0x5e872f){if(_0x5e872f){_0xe23bd2[_0x9775('0x26')](_0x5e872f[_0x9775('0xab')]);logger[_0x9775('0x6b')](_0x5e872f[_0x9775('0xae')]);if(_[_0x9775('0xaf')](_0x4332dd[_0x9775('0x3d')][_0x9775('0x6')],'download')&&_0x5e872f['statusCode']==0x1f4){return _0xe23bd2[_0x9775('0x20')](_0x5e872f[_0x9775('0xb0')]);}else{return _0xe23bd2[_0x9775('0x21')](_0x5e872f['statusCode'])[_0x9775('0x35')](_0x5e872f['body']);}}else{return _0xe23bd2[_0x9775('0x20')](0xc8);}})['catch'](handleError(_0xe23bd2,null));};exports[_0x9775('0xb1')]=function(_0x17c6a8,_0x565120,_0x348b31){return BPromise[_0x9775('0xa3')]()[_0x9775('0x2d')](function(){if(!_0x17c6a8[_0x9775('0x3d')][_0x9775('0x6')]){throw new Error(_0x9775('0xa4'));}if(!_0x17c6a8['query'][_0x9775('0xa5')]){throw new Error(_0x9775('0xa6'));}var _0x4e24b9=_0x17c6a8['query'][_0x9775('0xa7')]?_0x17c6a8[_0x9775('0x3d')][_0x9775('0xa7')]+':'+_0x17c6a8[_0x9775('0x3d')][_0x9775('0xa5')]:_0x9775('0xa8')+_0x17c6a8[_0x9775('0x3d')][_0x9775('0xa5')];var _0x514081=_0x17c6a8['query'][_0x9775('0x28')]?_0x17c6a8['query'][_0x9775('0x28')]:!![];var _0x2115a4=_0x17c6a8['query'][_0x9775('0xa9')]?_0x17c6a8[_0x9775('0x3d')]['encoding']:null;var _0x24cddf={'method':_0x17c6a8[_0x9775('0xb2')],'uri':util[_0x9775('0x57')](_0x9775('0xaa'),_0x4e24b9,_0x17c6a8[_0x9775('0x3d')][_0x9775('0x6')]),'json':_0x514081,'resolveWithFullResponse':!![],'encoding':_0x2115a4,'body':_0x17c6a8['body']};if(_0x17c6a8[_0x9775('0xab')]){_0x24cddf['headers']=_0x17c6a8['headers'];if(_0x24cddf[_0x9775('0xab')][_0x9775('0xac')]){delete _0x24cddf[_0x9775('0xab')]['content-length'];}}if(_0x24cddf[_0x9775('0xab')][_0x9775('0xad')]){delete _0x24cddf[_0x9775('0xab')]['content-type'];}return rp(_0x24cddf);})[_0x9775('0x2d')](function(_0x1f39e6){if(_0x1f39e6){_0x565120[_0x9775('0x26')](_0x1f39e6['headers']);logger[_0x9775('0x6b')](_0x1f39e6[_0x9775('0xae')]);return _0x565120[_0x9775('0x21')](_0x1f39e6['statusCode'])[_0x9775('0x35')](_0x1f39e6[_0x9775('0xae')]);}else{return _0x565120[_0x9775('0x20')](0xc8);}})[_0x9775('0x54')](handleError(_0x565120,null));}; \ No newline at end of file +var _0x187b=['Content-Range','apply','reject','save','update','then','destroy','get','error','name','send','index','map','Plugin','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','order','pick','filter','where','merge','VIRTUAL','options','include','findAll','show','params','keys','includeAll','catch','download','find','join','server/files/plugins','format','%s.zip','basename','warning','ENOENT','Sequelize','Error','Error\x20while\x20generating\x20the\x20zip\x20archive','pipe','**/*','root','node_modules/**/*','attachments/**/*','finalize','close','Plugin\x20not\x20found','Error\x20while\x20downloading\x20the\x20plugin','unlinkSync','info','Download\x20completed','upload','file','filename','extname','Plugin\x20upload\x20destination:\x20%s','readdirSync','Invalid\x20plugin\x20structure','isDirectory','manifest.json','Plugin\x20manifest\x20missing','readFileSync','Invalid\x20manifest:\x20name\x20missing','Invalid\x20manifest:\x20type\x20missing','Invalid\x20manifest:\x20version\x20not\x20specified','parameters','views','Invalid\x20manifest:\x20views\x20missing','admin','Invalid\x20manifest:\x20no\x20view\x20specified','scriptName','Invalid\x20manifest:\x20script\x20name\x20missing','scriptPath','Invalid\x20manifest:\x20invalid\x20type','sidebar','always','icon','icon-apps','test','plugins','Warning:\x20admin\x20view\x20not\x20specified','agent','create','body','role','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','Plugins','UserProfileResource','Zip\x20archive\x20removed','delete','dirname','webhookGet','resolve','port','\x27PORT\x27\x20parameter\x20not\x20specified','hostname','http://localhost:','encoding','%s%s','headers','content-length','content-type','endsWith','statusCode','\x27PATH\x27\x20parameter\x20not\x20specified','method','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','querystring','papaparse','extract-zip','archiver','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','localhost','./plugin.socket','register','sendStatus','status','end','json','undefined','limit','count','offset','set'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x187b,0x79));var _0xb187=function(_0x446ceb,_0x54aa4a){_0x446ceb=_0x446ceb-0x0;var _0x5d181d=_0x187b[_0x446ceb];return _0x5d181d;};'use strict';var emlformat=require(_0xb187('0x0'));var rimraf=require(_0xb187('0x1'));var zipdir=require(_0xb187('0x2'));var jsonpatch=require(_0xb187('0x3'));var rp=require(_0xb187('0x4'));var moment=require(_0xb187('0x5'));var BPromise=require(_0xb187('0x6'));var Mustache=require(_0xb187('0x7'));var util=require(_0xb187('0x8'));var path=require(_0xb187('0x9'));var sox=require(_0xb187('0xa'));var csv=require(_0xb187('0xb'));var ejs=require(_0xb187('0xc'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb187('0xd'));var squel=require(_0xb187('0xe'));var crypto=require('crypto');var jsforce=require(_0xb187('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xb187('0xb'));var querystring=require(_0xb187('0x10'));var Papa=require(_0xb187('0x11'));var extract=require(_0xb187('0x12'));var rimraf=require('rimraf');var archiver=require(_0xb187('0x13'));var Redis=require(_0xb187('0x14'));var authService=require(_0xb187('0x15'));var qs=require(_0xb187('0x16'));var as=require(_0xb187('0x17'));var hardwareService=require(_0xb187('0x18'));var logger=require(_0xb187('0x19'))(_0xb187('0x1a'));var utils=require(_0xb187('0x1b'));var config=require('../../config/environment');var licenseUtil=require(_0xb187('0x1c'));var db=require(_0xb187('0x1d'))['db'];config[_0xb187('0x1e')]=_['defaults'](config[_0xb187('0x1e')],{'host':_0xb187('0x1f'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xb187('0x1e')]));require(_0xb187('0x20'))[_0xb187('0x21')](socket);function respondWithStatusCode(_0x545559,_0x5ae5f5){_0x5ae5f5=_0x5ae5f5||0xcc;return function(_0x4152b4){if(_0x4152b4){return _0x545559[_0xb187('0x22')](_0x5ae5f5);}return _0x545559[_0xb187('0x23')](_0x5ae5f5)[_0xb187('0x24')]();};}function respondWithResult(_0x41eced,_0x1119cc){_0x1119cc=_0x1119cc||0xc8;return function(_0x10b44d){if(_0x10b44d){return _0x41eced[_0xb187('0x23')](_0x1119cc)[_0xb187('0x25')](_0x10b44d);}};}function respondWithFilteredResult(_0xc3eacf,_0x3de0d6){return function(_0x39fcaa){if(_0x39fcaa){var _0x2d263a=typeof _0x3de0d6['offset']===_0xb187('0x26')&&typeof _0x3de0d6[_0xb187('0x27')]===_0xb187('0x26');var _0x3ba637=_0x39fcaa[_0xb187('0x28')];var _0xc7c16c=_0x2d263a?0x0:_0x3de0d6[_0xb187('0x29')];var _0x2bc9f6=_0x2d263a?_0x39fcaa[_0xb187('0x28')]:_0x3de0d6['offset']+_0x3de0d6[_0xb187('0x27')];var _0x1f05c9;if(_0x2bc9f6>=_0x3ba637){_0x2bc9f6=_0x3ba637;_0x1f05c9=0xc8;}else{_0x1f05c9=0xce;}_0xc3eacf[_0xb187('0x23')](_0x1f05c9);return _0xc3eacf[_0xb187('0x2a')](_0xb187('0x2b'),_0xc7c16c+'-'+_0x2bc9f6+'/'+_0x3ba637)[_0xb187('0x25')](_0x39fcaa);}return null;};}function patchUpdates(_0x47316e){return function(_0x21a136){try{jsonpatch[_0xb187('0x2c')](_0x21a136,_0x47316e,!![]);}catch(_0x3c771d){return BPromise[_0xb187('0x2d')](_0x3c771d);}return _0x21a136[_0xb187('0x2e')]();};}function saveUpdates(_0x367fb5,_0x1af969){return function(_0x4b20eb){if(_0x4b20eb){return _0x4b20eb[_0xb187('0x2f')](_0x367fb5)[_0xb187('0x30')](function(_0x3931cc){return _0x3931cc;});}return null;};}function removeEntity(_0x49df0f,_0xf06baa){return function(_0x52d957){if(_0x52d957){return _0x52d957[_0xb187('0x31')]()[_0xb187('0x30')](function(){var _0x32d2ef=_0x52d957[_0xb187('0x32')]({'plain':!![]});var _0x18e700='Plugins';return db['UserProfileResource'][_0xb187('0x31')]({'where':{'type':_0x18e700,'resourceId':_0x32d2ef['id']}})[_0xb187('0x30')](function(){return _0x52d957;});})[_0xb187('0x30')](function(){_0x49df0f[_0xb187('0x23')](0xcc)['end']();});}};}function handleEntityNotFound(_0x45689c,_0x139a70){return function(_0x1c76c4){if(!_0x1c76c4){_0x45689c[_0xb187('0x22')](0x194);}return _0x1c76c4;};}function handleError(_0x32070d,_0x2c30bd){_0x2c30bd=_0x2c30bd||0x1f4;return function(_0x40ec9a){logger[_0xb187('0x33')](_0x40ec9a['stack']);if(_0x40ec9a['name']){delete _0x40ec9a[_0xb187('0x34')];}_0x32070d[_0xb187('0x23')](_0x2c30bd)[_0xb187('0x35')](_0x40ec9a);};}exports[_0xb187('0x36')]=function(_0x37639c,_0x2cc9e4){var _0x46f9f8={},_0xc6c2a4={},_0x114538={'count':0x0,'rows':[]};var _0x486585=_[_0xb187('0x37')](db[_0xb187('0x38')][_0xb187('0x39')],function(_0x44e5b7){return{'name':_0x44e5b7[_0xb187('0x3a')],'type':_0x44e5b7[_0xb187('0x3b')][_0xb187('0x3c')]};});_0xc6c2a4[_0xb187('0x3d')]=_[_0xb187('0x37')](_0x486585,'name');_0xc6c2a4[_0xb187('0x3e')]=_['keys'](_0x37639c[_0xb187('0x3e')]);_0xc6c2a4[_0xb187('0x3f')]=_[_0xb187('0x40')](_0xc6c2a4['model'],_0xc6c2a4['query']);_0x46f9f8[_0xb187('0x41')]=_[_0xb187('0x40')](_0xc6c2a4['model'],qs['fields'](_0x37639c[_0xb187('0x3e')][_0xb187('0x42')]));_0x46f9f8[_0xb187('0x41')]=_0x46f9f8[_0xb187('0x41')][_0xb187('0x43')]?_0x46f9f8['attributes']:_0xc6c2a4[_0xb187('0x3d')];if(!_0x37639c['query']['hasOwnProperty']('nolimit')){_0x46f9f8[_0xb187('0x27')]=qs[_0xb187('0x27')](_0x37639c[_0xb187('0x3e')][_0xb187('0x27')]);_0x46f9f8['offset']=qs['offset'](_0x37639c[_0xb187('0x3e')][_0xb187('0x29')]);}_0x46f9f8[_0xb187('0x44')]=qs['sort'](_0x37639c[_0xb187('0x3e')]['sort']);_0x46f9f8['where']=qs[_0xb187('0x3f')](_[_0xb187('0x45')](_0x37639c[_0xb187('0x3e')],_0xc6c2a4['filters']),_0x486585);if(_0x37639c[_0xb187('0x3e')][_0xb187('0x46')]){_0x46f9f8[_0xb187('0x47')]=_[_0xb187('0x48')](_0x46f9f8[_0xb187('0x47')],{'$or':_[_0xb187('0x37')](_0x486585,function(_0x598b24){if(_0x598b24['type']!==_0xb187('0x49')){var _0x4fbbb7={};_0x4fbbb7[_0x598b24[_0xb187('0x34')]]={'$like':'%'+_0x37639c[_0xb187('0x3e')]['filter']+'%'};return _0x4fbbb7;}})});}_0x46f9f8=_['merge']({},_0x46f9f8,_0x37639c[_0xb187('0x4a')]);var _0x3c89a3={'where':_0x46f9f8[_0xb187('0x47')]};return db[_0xb187('0x38')][_0xb187('0x28')](_0x3c89a3)['then'](function(_0x1f233a){_0x114538['count']=_0x1f233a;if(_0x37639c[_0xb187('0x3e')]['includeAll']){_0x46f9f8[_0xb187('0x4b')]=[{'all':!![]}];}return db['Plugin'][_0xb187('0x4c')](_0x46f9f8);})['then'](function(_0x536df9){_0x114538['rows']=_0x536df9;return _0x114538;})[_0xb187('0x30')](respondWithFilteredResult(_0x2cc9e4,_0x46f9f8))['catch'](handleError(_0x2cc9e4,null));};exports[_0xb187('0x4d')]=function(_0x3c9c1d,_0x5a81f3){var _0x2dc042={'raw':!![],'where':{'id':_0x3c9c1d[_0xb187('0x4e')]['id']}},_0x128b06={};_0x128b06[_0xb187('0x3d')]=_[_0xb187('0x4f')](db[_0xb187('0x38')][_0xb187('0x39')]);_0x128b06['query']=_[_0xb187('0x4f')](_0x3c9c1d[_0xb187('0x3e')]);_0x128b06[_0xb187('0x3f')]=_[_0xb187('0x40')](_0x128b06[_0xb187('0x3d')],_0x128b06['query']);_0x2dc042[_0xb187('0x41')]=_[_0xb187('0x40')](_0x128b06[_0xb187('0x3d')],qs[_0xb187('0x42')](_0x3c9c1d[_0xb187('0x3e')][_0xb187('0x42')]));_0x2dc042[_0xb187('0x41')]=_0x2dc042[_0xb187('0x41')]['length']?_0x2dc042[_0xb187('0x41')]:_0x128b06['model'];if(_0x3c9c1d['query'][_0xb187('0x50')]){_0x2dc042[_0xb187('0x4b')]=[{'all':!![]}];}_0x2dc042=_[_0xb187('0x48')]({},_0x2dc042,_0x3c9c1d[_0xb187('0x4a')]);return db[_0xb187('0x38')]['find'](_0x2dc042)['then'](handleEntityNotFound(_0x5a81f3,null))[_0xb187('0x30')](respondWithResult(_0x5a81f3,null))[_0xb187('0x51')](handleError(_0x5a81f3,null));};exports[_0xb187('0x52')]=function(_0x480154,_0x1064d6,_0x3a0a9f){return db['Plugin'][_0xb187('0x53')]({'where':{'id':_0x480154[_0xb187('0x4e')]['id']},'attributes':[_0xb187('0x34'),'path'],'raw':!![]})[_0xb187('0x30')](handleEntityNotFound(_0x1064d6,null))[_0xb187('0x30')](function(_0x1f5d51){if(_0x1f5d51){var _0x5dac49=path[_0xb187('0x54')](config['root'],_0xb187('0x55'),util[_0xb187('0x56')](_0xb187('0x57'),path[_0xb187('0x58')](_0x1f5d51[_0xb187('0x9')])));var _0x1e6b48=fs['createWriteStream'](_0x5dac49);var _0x4824a1=archiver('zip',{'zlib':{'level':0x9}});_0x4824a1['on'](_0xb187('0x59'),function(_0x4c3b0d){if(_0x4c3b0d['code']===_0xb187('0x5a')){logger[_0xb187('0x33')](_0x4c3b0d);}else{throw new db[(_0xb187('0x5b'))][(_0xb187('0x5c'))](_0xb187('0x5d'));}});_0x4824a1['on'](_0xb187('0x33'),function(_0x244f9c){throw new db[(_0xb187('0x5b'))][(_0xb187('0x5c'))](_0xb187('0x5d'));});_0x4824a1[_0xb187('0x5e')](_0x1e6b48);_0x4824a1['glob'](_0xb187('0x5f'),{'cwd':path[_0xb187('0x54')](config[_0xb187('0x60')],_0xb187('0x55'),path['dirname'](_0x1f5d51['path'])),'ignore':[path['join'](path[_0xb187('0x58')](_0x1f5d51['path']),_0xb187('0x61')),path[_0xb187('0x54')](path[_0xb187('0x58')](_0x1f5d51['path']),_0xb187('0x62'))],'nodir':!![]})[_0xb187('0x63')]();_0x1e6b48['on'](_0xb187('0x64'),function(){if(!fs['existsSync'](_0x5dac49)){throw new db[(_0xb187('0x5b'))][(_0xb187('0x5c'))](_0xb187('0x65'));}return _0x1064d6[_0xb187('0x52')](_0x5dac49,util['format']('%s.zip',path[_0xb187('0x58')](_0x1f5d51[_0xb187('0x9')])),function(_0x3097fe){if(_0x3097fe){throw new db['Sequelize'][(_0xb187('0x5c'))](_0xb187('0x66'));}fs[_0xb187('0x67')](_0x5dac49);logger[_0xb187('0x68')](_0xb187('0x69'));logger[_0xb187('0x68')]('Temporary\x20file\x20removed');});});}return null;})['catch'](handleError(_0x1064d6,null));};exports[_0xb187('0x6a')]=function(_0x372717,_0x21d06b,_0x6ac5fb){var _0x3e1d4f=path[_0xb187('0x58')](_0x372717[_0xb187('0x6b')][_0xb187('0x6c')],path[_0xb187('0x6d')](_0x372717[_0xb187('0x6b')]['filename']));var _0x4e9404=path[_0xb187('0x54')](config[_0xb187('0x60')],_0xb187('0x55'),_0x372717['file'][_0xb187('0x6c')]);var _0x9ce6b3=path['join'](config[_0xb187('0x60')],'server/files/plugins',_0x3e1d4f);logger['info']('Plugin\x20upload\x20filepath:\x20%s',_0x4e9404);logger[_0xb187('0x68')](_0xb187('0x6e'),_0x9ce6b3);try{fs['chmodSync'](_0x4e9404,parseInt('0777',0x8));extract(_0x4e9404,{'dir':_0x9ce6b3},function(_0x434b5a){if(_0x434b5a){logger[_0xb187('0x33')](_0x434b5a);handleError(_0x434b5a,!![]);};var _0x2e05a0=fs[_0xb187('0x6f')](_0x9ce6b3);if(_0x2e05a0[_0xb187('0x43')]>0x1){removeReferences(_0x4e9404,_0x9ce6b3);logger[_0xb187('0x33')]('Invalid\x20plugin\x20structure');return _0x6ac5fb(new Error(_0xb187('0x70')));}var _0x5e2394=fs['lstatSync'](path['join'](_0x9ce6b3,_0x2e05a0[0x0]));if(_0x5e2394['isFile']()){removeReferences(_0x4e9404,_0x9ce6b3);logger[_0xb187('0x33')](_0xb187('0x70'));return _0x6ac5fb(new Error(_0xb187('0x70')));}if(_0x5e2394[_0xb187('0x71')]()){var _0x58b7f7=fs[_0xb187('0x6f')](path[_0xb187('0x54')](_0x9ce6b3,_0x2e05a0[0x0]));if(_0x58b7f7[_0xb187('0x43')]===0x0){removeReferences(_0x4e9404,_0x9ce6b3);logger[_0xb187('0x33')](_0xb187('0x70'));return _0x6ac5fb(new Error(_0xb187('0x70')));}var _0x2cc00a=_0x58b7f7['some'](function(_0x4a9569){return _0x4a9569===_0xb187('0x72');});if(!_0x2cc00a){return _0x6ac5fb(new Error(_0xb187('0x73')));}var _0x1344e4=fs[_0xb187('0x74')](path[_0xb187('0x54')](_0x9ce6b3,_0x2e05a0[0x0],_0xb187('0x72')));var _0x163d55=JSON['parse'](_0x1344e4);if(_0xb187('0x26')==typeof _0x163d55['name']){return _0x6ac5fb(new Error(_0xb187('0x75')));}if(_0xb187('0x26')==typeof _0x163d55[_0xb187('0x3b')]){return _0x6ac5fb(new Error(_0xb187('0x76')));}if(_0xb187('0x26')==typeof _0x163d55['version']){return _0x6ac5fb(new Error(_0xb187('0x77')));}if(_0xb187('0x26')==typeof _0x163d55[_0xb187('0x78')]){return _0x6ac5fb(new Error('Invalid\x20manifest:\x20parameters\x20missing'));}if(_0x163d55[_0xb187('0x3b')]==='html'){if('undefined'==typeof _0x163d55[_0xb187('0x78')][_0xb187('0x79')]){return _0x6ac5fb(new Error(_0xb187('0x7a')));}if('undefined'==typeof _0x163d55[_0xb187('0x78')][_0xb187('0x79')][_0xb187('0x7b')]&&_0xb187('0x26')==typeof _0x163d55[_0xb187('0x78')]['views']['agent']){return _0x6ac5fb(new Error(_0xb187('0x7c')));}}else if(_0x163d55['type']==='script'){if('undefined'==typeof _0x163d55[_0xb187('0x78')][_0xb187('0x7d')]){return _0x6ac5fb(new Error(_0xb187('0x7e')));}if(_0xb187('0x26')==typeof _0x163d55[_0xb187('0x78')][_0xb187('0x7f')]){return _0x6ac5fb(new Error('Invalid\x20manifest:\x20script\x20path\x20missing'));}}else{return _0x6ac5fb(new Error(_0xb187('0x80')));}var _0x2904e2=_0x163d55[_0xb187('0x34')];var _0xf049a=_0x163d55['description'];var _0x4a250b=_0x163d55[_0xb187('0x3b')];var _0x4ef9f2=_0x163d55[_0xb187('0x81')]?_0x163d55[_0xb187('0x81')]:_0xb187('0x82');var _0x4f3aa2=_0x163d55[_0xb187('0x83')]?_0x163d55['icon']:_0xb187('0x84');var _0x4f2fc2='';var _0xc8e59c='';var _0x55ca40='';var _0x5303af='';var _0x38a305=_0x163d55['version'];if(_0x4a250b==='html'){if('undefined'!=typeof _0x163d55[_0xb187('0x78')][_0xb187('0x79')][_0xb187('0x7b')]){var _0x248b89=_0x163d55['parameters'][_0xb187('0x79')][_0xb187('0x7b')];if(!/^(f|ht)tps?:\/\//i[_0xb187('0x85')](_0x248b89)){_0x4f2fc2=path[_0xb187('0x54')](_0xb187('0x86'),_0x3e1d4f,_0x2e05a0[0x0],_0x248b89);}else{_0x4f2fc2=_0x248b89;}}else{logger[_0xb187('0x68')](_0xb187('0x87'));}if('undefined'!=typeof _0x163d55[_0xb187('0x78')][_0xb187('0x79')][_0xb187('0x88')]){var _0x360669=_0x163d55[_0xb187('0x78')]['views'][_0xb187('0x88')];if(!/^(f|ht)tps?:\/\//i[_0xb187('0x85')](_0x360669)){_0xc8e59c=path[_0xb187('0x54')]('plugins',_0x3e1d4f,_0x2e05a0[0x0],_0x360669);}else{_0xc8e59c=_0x360669;}}else{logger[_0xb187('0x68')]('Warning:\x20agent\x20view\x20not\x20specified');}}else if(_0x4a250b==='script'){_0x55ca40=_0x163d55['parameters']['scriptName'];_0x5303af=_0x163d55[_0xb187('0x78')]['scriptPath'];if(_0xb187('0x26')!=typeof _0x163d55[_0xb187('0x78')]['views']){if(_0xb187('0x26')!=typeof _0x163d55[_0xb187('0x78')][_0xb187('0x79')][_0xb187('0x7b')]){var _0x248b89=_0x163d55['parameters'][_0xb187('0x79')][_0xb187('0x7b')];if(!/^(f|ht)tps?:\/\//i['test'](_0x248b89)){_0x4f2fc2=path[_0xb187('0x54')]('plugins',_0x3e1d4f,_0x2e05a0[0x0],_0x248b89);}else{_0x4f2fc2=_0x248b89;}}if('undefined'!=typeof _0x163d55[_0xb187('0x78')][_0xb187('0x79')][_0xb187('0x88')]){var _0x360669=_0x163d55[_0xb187('0x78')][_0xb187('0x79')][_0xb187('0x88')];if(!/^(f|ht)tps?:\/\//i[_0xb187('0x85')](_0x360669)){_0xc8e59c=path[_0xb187('0x54')](_0xb187('0x86'),_0x3e1d4f,_0x2e05a0[0x0],_0x360669);}else{_0xc8e59c=_0x360669;}}}}var _0xe86c55={'name':_0x2904e2,'description':_0xf049a,'path':path[_0xb187('0x54')](_0x3e1d4f,_0x2e05a0[0x0]),'type':_0x4a250b,'sidebar':_0x4ef9f2,'icon':_0x4f3aa2,'adminUrl':_0x4f2fc2,'agentUrl':_0xc8e59c,'scriptName':_0x55ca40,'scriptPath':_0x5303af,'version':_0x38a305};removeReferences(_0x4e9404,null);return db[_0xb187('0x38')][_0xb187('0x89')](_0xe86c55)[_0xb187('0x30')](function(_0x20bec1){var _0x553f16={'role':_0x372717[_0xb187('0x8a')][_0xb187('0x8b')],'userProfileId':_0x372717[_0xb187('0x8a')][_0xb187('0x8c')]};if(!_0x553f16)throw new Error(_0xb187('0x8d'));if(_0x553f16[_0xb187('0x8b')]===_0xb187('0x8e')){var _0x3b5e56=_0x20bec1['get']({'plain':!![]});return db[_0xb187('0x8f')][_0xb187('0x53')]({'where':{'name':_0xb187('0x90'),'userProfileId':_0x553f16[_0xb187('0x8c')]},'raw':!![]})['then'](function(_0x303f28){if(_0x303f28&&_0x303f28['autoAssociation']===0x0){return db[_0xb187('0x91')][_0xb187('0x89')]({'name':_0x3b5e56['name'],'resourceId':_0x3b5e56['id'],'type':_0x303f28[_0xb187('0x34')],'sectionId':_0x303f28['id']},{})[_0xb187('0x30')](function(){return _0x20bec1;});}else{return _0x20bec1;}})[_0xb187('0x51')](function(_0x5d1c1d){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5d1c1d);throw _0x5d1c1d;});}return _0x20bec1;})[_0xb187('0x30')](respondWithResult(_0x21d06b,null))[_0xb187('0x51')](handleError(_0x21d06b,null));}});}catch(_0x3676e1){_0x21d06b[_0xb187('0x23')](0x1f4)[_0xb187('0x35')](_0x3676e1);}};function removeReferences(_0xdc2abc,_0x226414){try{if(_0xdc2abc){fs[_0xb187('0x67')](_0xdc2abc);logger[_0xb187('0x68')](_0xb187('0x92'));}if(_0x226414){rimraf(_0x226414,function(){});logger['info']('Extracted\x20folder\x20removed');}}catch(_0x26756e){logger[_0xb187('0x33')](_0x26756e);}}exports[_0xb187('0x2f')]=function(_0x275456,_0x2db85b,_0x25d9e2){return db[_0xb187('0x38')][_0xb187('0x53')]({'where':{'id':_0x275456['params']['id']}})['then'](handleEntityNotFound(_0x2db85b,null))[_0xb187('0x30')](saveUpdates(_0x275456[_0xb187('0x8a')],null))[_0xb187('0x30')](respondWithResult(_0x2db85b,null))[_0xb187('0x51')](handleError(_0x2db85b,null));};exports[_0xb187('0x93')]=function(_0x509191,_0x5d8ab9,_0x28e6b0){return db[_0xb187('0x38')][_0xb187('0x53')]({'where':{'id':_0x509191['params']['id']}})[_0xb187('0x30')](function(_0x14543a){if(_0x14543a){return _0x14543a['destroy']();}})[_0xb187('0x30')](function(_0x202751){rimraf(path['join'](config['root'],_0xb187('0x55'),path[_0xb187('0x94')](_0x202751[_0xb187('0x9')])),function(){});return _0x202751;})['then'](handleEntityNotFound(_0x5d8ab9,null))[_0xb187('0x30')](respondWithStatusCode(_0x5d8ab9,null))[_0xb187('0x51')](handleError(_0x5d8ab9,null));};exports[_0xb187('0x95')]=function(_0x5ab61f,_0x207d5a,_0x3845e6){return BPromise[_0xb187('0x96')]()[_0xb187('0x30')](function(){if(!_0x5ab61f['query'][_0xb187('0x9')]){throw new Error('\x27PATH\x27\x20parameter\x20not\x20specified');}if(!_0x5ab61f[_0xb187('0x3e')][_0xb187('0x97')]){throw new Error(_0xb187('0x98'));}var _0x315cc8=_0x5ab61f[_0xb187('0x3e')][_0xb187('0x99')]?_0x5ab61f[_0xb187('0x3e')][_0xb187('0x99')]+':'+_0x5ab61f[_0xb187('0x3e')][_0xb187('0x97')]:_0xb187('0x9a')+_0x5ab61f[_0xb187('0x3e')]['port'];var _0x48cd34=_0x5ab61f[_0xb187('0x3e')][_0xb187('0x25')]?_0x5ab61f['query'][_0xb187('0x25')]:!![];var _0x43dddd=_0x5ab61f[_0xb187('0x3e')][_0xb187('0x9b')]?_0x5ab61f[_0xb187('0x3e')]['encoding']:null;var _0x206154={'method':_0x5ab61f['method'],'uri':util['format'](_0xb187('0x9c'),_0x315cc8,_0x5ab61f['query']['path']),'json':_0x48cd34,'resolveWithFullResponse':!![],'encoding':_0x43dddd,'qs':_0x5ab61f['query']};if(_0x5ab61f[_0xb187('0x9d')]){_0x206154[_0xb187('0x9d')]=_0x5ab61f['headers'];if(_0x206154['headers'][_0xb187('0x9e')]){delete _0x206154['headers']['content-length'];}}if(_0x206154[_0xb187('0x9d')][_0xb187('0x9f')]){delete _0x206154[_0xb187('0x9d')]['content-type'];}return rp(_0x206154);})[_0xb187('0x30')](function(_0x4aeec5){if(_0x4aeec5){_0x207d5a[_0xb187('0x2a')](_0x4aeec5[_0xb187('0x9d')]);logger[_0xb187('0x68')](_0x4aeec5[_0xb187('0x8a')]);if(_[_0xb187('0xa0')](_0x5ab61f[_0xb187('0x3e')][_0xb187('0x9')],_0xb187('0x52'))&&_0x4aeec5[_0xb187('0xa1')]==0x1f4){return _0x207d5a['sendStatus'](_0x4aeec5[_0xb187('0xa1')]);}else{return _0x207d5a[_0xb187('0x23')](_0x4aeec5['statusCode'])[_0xb187('0x35')](_0x4aeec5[_0xb187('0x8a')]);}}else{return _0x207d5a[_0xb187('0x22')](0xc8);}})[_0xb187('0x51')](handleError(_0x207d5a,null));};exports['webhookPost']=function(_0x1770fa,_0x3b8d50,_0x5d6cd5){return BPromise[_0xb187('0x96')]()['then'](function(){if(!_0x1770fa[_0xb187('0x3e')][_0xb187('0x9')]){throw new Error(_0xb187('0xa2'));}if(!_0x1770fa['query'][_0xb187('0x97')]){throw new Error(_0xb187('0x98'));}var _0x48d9fc=_0x1770fa[_0xb187('0x3e')]['hostname']?_0x1770fa[_0xb187('0x3e')][_0xb187('0x99')]+':'+_0x1770fa[_0xb187('0x3e')][_0xb187('0x97')]:_0xb187('0x9a')+_0x1770fa[_0xb187('0x3e')]['port'];var _0x397855=_0x1770fa[_0xb187('0x3e')]['json']?_0x1770fa[_0xb187('0x3e')][_0xb187('0x25')]:!![];var _0x2dc309=_0x1770fa[_0xb187('0x3e')][_0xb187('0x9b')]?_0x1770fa[_0xb187('0x3e')][_0xb187('0x9b')]:null;var _0xd2232a={'method':_0x1770fa[_0xb187('0xa3')],'uri':util['format']('%s%s',_0x48d9fc,_0x1770fa[_0xb187('0x3e')][_0xb187('0x9')]),'json':_0x397855,'resolveWithFullResponse':!![],'encoding':_0x2dc309,'body':_0x1770fa[_0xb187('0x8a')]};if(_0x1770fa[_0xb187('0x9d')]){_0xd2232a['headers']=_0x1770fa[_0xb187('0x9d')];if(_0xd2232a[_0xb187('0x9d')]['content-length']){delete _0xd2232a[_0xb187('0x9d')][_0xb187('0x9e')];}}if(_0xd2232a[_0xb187('0x9d')][_0xb187('0x9f')]){delete _0xd2232a[_0xb187('0x9d')][_0xb187('0x9f')];}return rp(_0xd2232a);})[_0xb187('0x30')](function(_0x349866){if(_0x349866){_0x3b8d50[_0xb187('0x2a')](_0x349866['headers']);logger[_0xb187('0x68')](_0x349866[_0xb187('0x8a')]);return _0x3b8d50[_0xb187('0x23')](_0x349866[_0xb187('0xa1')])[_0xb187('0x35')](_0x349866[_0xb187('0x8a')]);}else{return _0x3b8d50['sendStatus'](0xc8);}})[_0xb187('0x51')](handleError(_0x3b8d50,null));}; \ No newline at end of file diff --git a/server/api/plugin/plugin.events.js b/server/api/plugin/plugin.events.js index af35b73..1959670 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 _0x67d1=['remove','emit','hook','../../mysqldb','Plugin','save','update'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x67d1,0xf1));var _0x167d=function(_0x413feb,_0x10477f){_0x413feb=_0x413feb-0x0;var _0x40ee88=_0x67d1[_0x413feb];return _0x40ee88;};'use strict';var EventEmitter=require('events');var Plugin=require(_0x167d('0x0'))['db'][_0x167d('0x1')];var PluginEvents=new EventEmitter();PluginEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x167d('0x2'),'afterUpdate':_0x167d('0x3'),'afterDestroy':_0x167d('0x4')};function emitEvent(_0x140f63){return function(_0x4e6fba,_0x3ab690,_0x1d3b56){PluginEvents[_0x167d('0x5')](_0x140f63+':'+_0x4e6fba['id'],_0x4e6fba);PluginEvents[_0x167d('0x5')](_0x140f63,_0x4e6fba);_0x1d3b56(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Plugin[_0x167d('0x6')](e,emitEvent(event));}}module['exports']=PluginEvents; \ No newline at end of file +var _0x36bb=['events','../../mysqldb','Plugin','save','update','remove','emit','hasOwnProperty','hook','exports'];(function(_0x248a73,_0x53533f){var _0x4b40c9=function(_0x381b10){while(--_0x381b10){_0x248a73['push'](_0x248a73['shift']());}};_0x4b40c9(++_0x53533f);}(_0x36bb,0xe6));var _0xb36b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x36bb[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require(_0xb36b('0x0'));var Plugin=require(_0xb36b('0x1'))['db'][_0xb36b('0x2')];var PluginEvents=new EventEmitter();PluginEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xb36b('0x3'),'afterUpdate':_0xb36b('0x4'),'afterDestroy':_0xb36b('0x5')};function emitEvent(_0x4003b8){return function(_0x311671,_0x3d57d7,_0x2bcc68){PluginEvents[_0xb36b('0x6')](_0x4003b8+':'+_0x311671['id'],_0x311671);PluginEvents[_0xb36b('0x6')](_0x4003b8,_0x311671);_0x2bcc68(null);};}for(var e in events){if(events[_0xb36b('0x7')](e)){var event=events[e];Plugin[_0xb36b('0x8')](e,emitEvent(event));}}module[_0xb36b('0x9')]=PluginEvents; \ No newline at end of file diff --git a/server/api/plugin/plugin.model.js b/server/api/plugin/plugin.model.js index 174f288..0084011 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 _0xfdf6=['request-promise','path','rimraf','../../config/environment','./plugin.attributes','exports','define','Plugin','lodash','util','api','moment','bluebird'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xfdf6,0x97));var _0x6fdf=function(_0x103cdc,_0x1bdc05){_0x103cdc=_0x103cdc-0x0;var _0x29826b=_0xfdf6[_0x103cdc];return _0x29826b;};'use strict';var _=require(_0x6fdf('0x0'));var util=require(_0x6fdf('0x1'));var logger=require('../../config/logger')(_0x6fdf('0x2'));var moment=require(_0x6fdf('0x3'));var BPromise=require(_0x6fdf('0x4'));var rp=require(_0x6fdf('0x5'));var fs=require('fs');var path=require(_0x6fdf('0x6'));var rimraf=require(_0x6fdf('0x7'));var config=require(_0x6fdf('0x8'));var attributes=require(_0x6fdf('0x9'));module[_0x6fdf('0xa')]=function(_0xc455cb,_0xf20758){return _0xc455cb[_0x6fdf('0xb')](_0x6fdf('0xc'),attributes,{'tableName':'plugins','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x65d3=['api','bluebird','path','../../config/environment','./plugin.attributes','exports','define','plugins','util','../../config/logger'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x65d3,0x134));var _0x365d=function(_0x5b7c64,_0x2f7c6d){_0x5b7c64=_0x5b7c64-0x0;var _0x455a9c=_0x65d3[_0x5b7c64];return _0x455a9c;};'use strict';var _=require('lodash');var util=require(_0x365d('0x0'));var logger=require(_0x365d('0x1'))(_0x365d('0x2'));var moment=require('moment');var BPromise=require(_0x365d('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x365d('0x4'));var rimraf=require('rimraf');var config=require(_0x365d('0x5'));var attributes=require(_0x365d('0x6'));module[_0x365d('0x7')]=function(_0x2c903f,_0x2cafd5){return _0x2c903f[_0x365d('0x8')]('Plugin',attributes,{'tableName':_0x365d('0x9'),'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 0f960ec..a3c6c43 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 _0x3c2b=['code','message','result','catch','CreatePlugin','create','body','raw','then','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','redis','defaults','register','request','info','Plugin,\x20%s,\x20%s','request\x20sent','debug','stringify','error'];(function(_0x221637,_0x42a5e0){var _0x11bf9e=function(_0xbc416e){while(--_0xbc416e){_0x221637['push'](_0x221637['shift']());}};_0x11bf9e(++_0x42a5e0);}(_0x3c2b,0x117));var _0xb3c2=function(_0x19e16f,_0x4a9324){_0x19e16f=_0x19e16f-0x0;var _0x242c29=_0x3c2b[_0x19e16f];return _0x242c29;};'use strict';var _=require(_0xb3c2('0x0'));var util=require(_0xb3c2('0x1'));var moment=require(_0xb3c2('0x2'));var BPromise=require(_0xb3c2('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb3c2('0x4'));var db=require(_0xb3c2('0x5'))['db'];var utils=require(_0xb3c2('0x6'));var logger=require(_0xb3c2('0x7'))(_0xb3c2('0x8'));var config=require('../../config/environment');var jayson=require(_0xb3c2('0x9'));var client=jayson['client'][_0xb3c2('0xa')]({'port':0x232a});config[_0xb3c2('0xb')]=_[_0xb3c2('0xc')](config[_0xb3c2('0xb')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xb3c2('0xb')]));require('./plugin.socket')[_0xb3c2('0xd')](socket);function respondWithRpcPromise(_0x17baec,_0x13f6ae,_0xf5b8c6){return new BPromise(function(_0x3b7d80,_0x2d5815){return client[_0xb3c2('0xe')](_0x17baec,_0xf5b8c6)['then'](function(_0x2f0aed){logger[_0xb3c2('0xf')](_0xb3c2('0x10'),_0x13f6ae,_0xb3c2('0x11'));logger[_0xb3c2('0x12')]('Plugin,\x20%s,\x20%s,\x20%s',_0x13f6ae,'request\x20sent',JSON[_0xb3c2('0x13')](_0x2f0aed));if(_0x2f0aed[_0xb3c2('0x14')]){if(_0x2f0aed[_0xb3c2('0x14')][_0xb3c2('0x15')]===0x1f4){logger[_0xb3c2('0x14')]('Plugin,\x20%s,\x20%s',_0x13f6ae,_0x2f0aed[_0xb3c2('0x14')][_0xb3c2('0x16')]);return _0x2d5815(_0x2f0aed[_0xb3c2('0x14')][_0xb3c2('0x16')]);}logger[_0xb3c2('0x14')]('Plugin,\x20%s,\x20%s',_0x13f6ae,_0x2f0aed[_0xb3c2('0x14')][_0xb3c2('0x16')]);return _0x3b7d80(_0x2f0aed[_0xb3c2('0x14')][_0xb3c2('0x16')]);}else{logger['info'](_0xb3c2('0x10'),_0x13f6ae,'request\x20sent');_0x3b7d80(_0x2f0aed[_0xb3c2('0x17')][_0xb3c2('0x16')]);}})[_0xb3c2('0x18')](function(_0x40e0ff){logger[_0xb3c2('0x14')](_0xb3c2('0x10'),_0x13f6ae,_0x40e0ff);_0x2d5815(_0x40e0ff);});});}exports[_0xb3c2('0x19')]=function(_0x112663){var _0x45cf5a=this;return new Promise(function(_0x46db38,_0x57b926){return db['Plugin'][_0xb3c2('0x1a')](_0x112663[_0xb3c2('0x1b')],{'raw':_0x112663['options']?_0x112663['options'][_0xb3c2('0x1c')]===undefined?!![]:![]:!![]})[_0xb3c2('0x1d')](function(_0x490818){logger[_0xb3c2('0xf')]('CreatePlugin',_0x112663);logger[_0xb3c2('0x12')](_0xb3c2('0x19'),_0x112663,JSON['stringify'](_0x490818));_0x46db38(_0x490818);})[_0xb3c2('0x18')](function(_0x301bc3){logger[_0xb3c2('0x14')]('CreatePlugin',_0x301bc3['message'],_0x112663);_0x57b926(_0x45cf5a[_0xb3c2('0x14')](0x1f4,_0x301bc3[_0xb3c2('0x16')]));});});}; \ No newline at end of file +var _0x53ff=['info','Plugin,\x20%s,\x20%s','request\x20sent','debug','Plugin,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreatePlugin','Plugin','create','body','options','raw','lodash','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','./plugin.socket','register','request','then'];(function(_0x5a3731,_0x49a0c9){var _0xbaf3d2=function(_0x24dd63){while(--_0x24dd63){_0x5a3731['push'](_0x5a3731['shift']());}};_0xbaf3d2(++_0x49a0c9);}(_0x53ff,0xb6));var _0xf53f=function(_0x7ad8b0,_0x1ae2a5){_0x7ad8b0=_0x7ad8b0-0x0;var _0x3311d8=_0x53ff[_0x7ad8b0];return _0x3311d8;};'use strict';var _=require(_0xf53f('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xf53f('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf53f('0x2'));var db=require(_0xf53f('0x3'))['db'];var utils=require(_0xf53f('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0xf53f('0x5'));var jayson=require(_0xf53f('0x6'));var client=jayson[_0xf53f('0x7')][_0xf53f('0x8')]({'port':0x232a});config['redis']=_[_0xf53f('0x9')](config[_0xf53f('0xa')],{'host':_0xf53f('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xf53f('0xc'))[_0xf53f('0xd')](socket);function respondWithRpcPromise(_0x200cfb,_0x48642f,_0x4dd6c3){return new BPromise(function(_0x21e5a0,_0x8d1c9f){return client[_0xf53f('0xe')](_0x200cfb,_0x4dd6c3)[_0xf53f('0xf')](function(_0x4fe54a){logger[_0xf53f('0x10')](_0xf53f('0x11'),_0x48642f,_0xf53f('0x12'));logger[_0xf53f('0x13')](_0xf53f('0x14'),_0x48642f,_0xf53f('0x12'),JSON[_0xf53f('0x15')](_0x4fe54a));if(_0x4fe54a[_0xf53f('0x16')]){if(_0x4fe54a[_0xf53f('0x16')][_0xf53f('0x17')]===0x1f4){logger[_0xf53f('0x16')](_0xf53f('0x11'),_0x48642f,_0x4fe54a[_0xf53f('0x16')]['message']);return _0x8d1c9f(_0x4fe54a['error']['message']);}logger['error'](_0xf53f('0x11'),_0x48642f,_0x4fe54a[_0xf53f('0x16')][_0xf53f('0x18')]);return _0x21e5a0(_0x4fe54a['error'][_0xf53f('0x18')]);}else{logger[_0xf53f('0x10')](_0xf53f('0x11'),_0x48642f,'request\x20sent');_0x21e5a0(_0x4fe54a[_0xf53f('0x19')]['message']);}})[_0xf53f('0x1a')](function(_0x771d9){logger[_0xf53f('0x16')]('Plugin,\x20%s,\x20%s',_0x48642f,_0x771d9);_0x8d1c9f(_0x771d9);});});}exports[_0xf53f('0x1b')]=function(_0x1c4054){var _0x504080=this;return new Promise(function(_0x5bd469,_0x2f5d06){return db[_0xf53f('0x1c')][_0xf53f('0x1d')](_0x1c4054[_0xf53f('0x1e')],{'raw':_0x1c4054[_0xf53f('0x1f')]?_0x1c4054[_0xf53f('0x1f')][_0xf53f('0x20')]===undefined?!![]:![]:!![]})[_0xf53f('0xf')](function(_0x2a24e3){logger[_0xf53f('0x10')]('CreatePlugin',_0x1c4054);logger['debug'](_0xf53f('0x1b'),_0x1c4054,JSON[_0xf53f('0x15')](_0x2a24e3));_0x5bd469(_0x2a24e3);})[_0xf53f('0x1a')](function(_0xf61c64){logger[_0xf53f('0x16')]('CreatePlugin',_0xf61c64['message'],_0x1c4054);_0x2f5d06(_0x504080[_0xf53f('0x16')](0x1f4,_0xf61c64[_0xf53f('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/plugin/plugin.socket.js b/server/api/plugin/plugin.socket.js index caebc28..6e0cf6c 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 _0x6ef9=['./plugin.events','remove','update','emit','register','length'];(function(_0x501401,_0x2d8737){var _0xfd0a47=function(_0x57decb){while(--_0x57decb){_0x501401['push'](_0x501401['shift']());}};_0xfd0a47(++_0x2d8737);}(_0x6ef9,0xba));var _0x96ef=function(_0x488ca1,_0xf6858e){_0x488ca1=_0x488ca1-0x0;var _0x4dd0a4=_0x6ef9[_0x488ca1];return _0x4dd0a4;};'use strict';var PluginEvents=require(_0x96ef('0x0'));var events=['save',_0x96ef('0x1'),_0x96ef('0x2')];function createListener(_0x2601b0,_0x84bb2){return function(_0xd40053){_0x84bb2[_0x96ef('0x3')](_0x2601b0,_0xd40053);};}function removeListener(_0x4f1f04,_0x55bea5){return function(){PluginEvents['removeListener'](_0x4f1f04,_0x55bea5);};}exports[_0x96ef('0x4')]=function(_0x46953f){for(var _0x22588d=0x0,_0x10c4cf=events[_0x96ef('0x5')];_0x22588d<_0x10c4cf;_0x22588d++){var _0x153821=events[_0x22588d];var _0x26d4f1=createListener('plugin:'+_0x153821,_0x46953f);PluginEvents['on'](_0x153821,_0x26d4f1);}}; \ No newline at end of file +var _0x8447=['removeListener','register','plugin:','./plugin.events','save','update'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x8447,0x18f));var _0x7844=function(_0x282641,_0x1adcc9){_0x282641=_0x282641-0x0;var _0x340e44=_0x8447[_0x282641];return _0x340e44;};'use strict';var PluginEvents=require(_0x7844('0x0'));var events=[_0x7844('0x1'),'remove',_0x7844('0x2')];function createListener(_0x21c8c5,_0x3448a4){return function(_0x4729ee){_0x3448a4['emit'](_0x21c8c5,_0x4729ee);};}function removeListener(_0x1b67db,_0x377c2d){return function(){PluginEvents[_0x7844('0x3')](_0x1b67db,_0x377c2d);};}exports[_0x7844('0x4')]=function(_0x476c56){for(var _0x34bcd5=0x0,_0x3647b7=events['length'];_0x34bcd5<_0x3647b7;_0x34bcd5++){var _0x1ebc40=events[_0x34bcd5];var _0x49b76b=createListener(_0x7844('0x5')+_0x1ebc40,_0x476c56);PluginEvents['on'](_0x1ebc40,_0x49b76b);}}; \ No newline at end of file diff --git a/server/api/pm2/index.js b/server/api/pm2/index.js index bc81064..6c18165 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(_0x4ab7d3,_0x4e5a5d){var _0x7877b6=function(_0x3b4e44){while(--_0x3b4e44){_0x4ab7d3['push'](_0x4ab7d3['shift']());}};_0x7877b6(++_0x4e5a5d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0xa9e0[_0x6c993a];return _0x27f547;};'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(_0x5a2ad9,_0x4530ac){var _0x24fb9a=function(_0x486d3b){while(--_0x486d3b){_0x5a2ad9['push'](_0x5a2ad9['shift']());}};_0x24fb9a(++_0x4530ac);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4243a3,_0x447337){_0x4243a3=_0x4243a3-0x0;var _0x1b2a33=_0xa9e0[_0x4243a3];return _0x1b2a33;};'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 b7bcee7..2bf51bf 100644 --- a/server/api/pm2/pm2.controller.js +++ b/server/api/pm2/pm2.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcb91=['describe','create','body','../../files/plugins','cwd','chdir','dirname','dump','Missing\x20name\x20and/or\x20path','update','restart','stop','hasOwnProperty','params','Unknown\x20status','destroy','delete','Unknown\x20id','../../config/logger','api','path','child_process','bluebird','sendStatus','json','name','status','send','npm\x20install','info','list','then','reject','express','length','catch','show'];(function(_0x4f2e4b,_0x2d084c){var _0x3afdbb=function(_0x14b574){while(--_0x14b574){_0x4f2e4b['push'](_0x4f2e4b['shift']());}};_0x3afdbb(++_0x2d084c);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x3ba924,_0x3b99f0){_0x3ba924=_0x3ba924-0x0;var _0x4cc1df=_0xcb91[_0x3ba924];return _0x4cc1df;};'use strict';var _=require('lodash');var pm2=require('../../config/pm2');var logger=require(_0x1cb9('0x0'))(_0x1cb9('0x1'));var path=require(_0x1cb9('0x2'));var exec=require(_0x1cb9('0x3'))['exec'];var BPromise=require(_0x1cb9('0x4'));function handleEntityNotFound(_0x2c17b8,_0x545a34){return function(_0x13d5fd){if(!_0x13d5fd){_0x2c17b8[_0x1cb9('0x5')](0x194);;}return _0x13d5fd;};}function respondWithResult(_0x53ffbd,_0x226b69){_0x226b69=_0x226b69||0xc8;return function(_0x3f7deb){if(_0x3f7deb){return _0x53ffbd['status'](_0x226b69)[_0x1cb9('0x6')](_0x3f7deb);}return null;};}function handleError(_0x12567c,_0x59d1be){_0x59d1be=_0x59d1be||0x1f4;return function(_0x3ae0f1){logger['error'](_0x3ae0f1['stack']);if(_0x3ae0f1[_0x1cb9('0x7')]){delete _0x3ae0f1[_0x1cb9('0x7')];}_0x12567c[_0x1cb9('0x8')](_0x59d1be)[_0x1cb9('0x9')](_0x3ae0f1);};}function execChildProcess(){return new BPromise(function(_0x2fc627,_0x50ce71){exec(_0x1cb9('0xa'),function(_0x44a6b4,_0x3af35f,_0x3fdd83){logger[_0x1cb9('0xb')](_0x3af35f);logger['info'](_0x3fdd83);if(_0x44a6b4){logger['error'](_0x44a6b4);return _0x50ce71(_0x44a6b4);}return _0x2fc627(_0x3af35f);});});}exports['index']=function(_0x358866,_0x282bc6){return pm2[_0x1cb9('0xc')]()[_0x1cb9('0xd')](function(_0x56884d){if(_0x56884d){var _0x397727=_[_0x1cb9('0xe')](_0x56884d,function(_0x1b3cd7){return _0x1b3cd7[_0x1cb9('0x7')]===_0x1cb9('0xf')||_0x1b3cd7['name']==='motion2';});return{'rows':_0x397727,'count':_0x397727[_0x1cb9('0x10')]};}return null;})[_0x1cb9('0xd')](respondWithResult(_0x282bc6,null))[_0x1cb9('0x11')](handleError(_0x282bc6,null));};exports[_0x1cb9('0x12')]=function(_0x3e21e0,_0xf22920){return pm2[_0x1cb9('0x13')](_0x3e21e0['params']['id'])['then'](respondWithResult(_0xf22920,null))[_0x1cb9('0xd')](handleEntityNotFound(_0xf22920,null))[_0x1cb9('0x11')](handleError(_0xf22920,null));};exports[_0x1cb9('0x14')]=function(_0x31481a,_0x280a84){if(_0x31481a[_0x1cb9('0x15')][_0x1cb9('0x7')]&&_0x31481a['body']['script']){var _0x1a5a72=path['join'](__dirname,_0x1cb9('0x16'),_0x31481a[_0x1cb9('0x15')]['script']);var _0x599275=process[_0x1cb9('0x17')]();process[_0x1cb9('0x18')](path[_0x1cb9('0x19')](_0x1a5a72));return execChildProcess()[_0x1cb9('0xd')](function(_0x45b8d3){process[_0x1cb9('0x18')](_0x599275);return pm2['start']({'name':_0x31481a['body'][_0x1cb9('0x7')],'script':_0x1a5a72});})['then'](function(_0x10a419){pm2[_0x1cb9('0x1a')]();return _0x10a419[0x0];})[_0x1cb9('0xd')](respondWithResult(_0x280a84,0xc9))[_0x1cb9('0x11')](handleError(_0x280a84,null));}else{return _0x280a84[_0x1cb9('0x8')](0x1f4)['send']({'message':_0x1cb9('0x1b')});}};exports[_0x1cb9('0x1c')]=function(_0x4c8d76,_0xd6891c){if(_0x4c8d76[_0x1cb9('0x15')]['id']){delete _0x4c8d76[_0x1cb9('0x15')]['id'];}var _0x1804fd={'online':_0x1cb9('0x1d'),'stopped':_0x1cb9('0x1e')};if(_0x1804fd[_0x1cb9('0x1f')](_0x4c8d76[_0x1cb9('0x15')][_0x1cb9('0x8')])){return pm2[_0x1804fd[_0x4c8d76[_0x1cb9('0x15')]['status']]](_0x4c8d76[_0x1cb9('0x20')]['id'])['then'](respondWithResult(_0xd6891c,0xc8))[_0x1cb9('0x11')](handleError(_0xd6891c,null));}else{return _0xd6891c['status'](0x1f4)[_0x1cb9('0x9')]({'message':_0x1cb9('0x21')});}};exports[_0x1cb9('0x22')]=function(_0x2038aa,_0x561d89){if(_0x2038aa[_0x1cb9('0x15')]['id']){delete _0x2038aa['body']['id'];}if(_0x2038aa[_0x1cb9('0x20')]['id']){return pm2[_0x1cb9('0x23')](_0x2038aa[_0x1cb9('0x20')]['id'])['then'](function(_0xae4c7a){pm2['dump']();return _0xae4c7a[0x0];})[_0x1cb9('0xd')](respondWithResult(_0x561d89,null))['catch'](handleError(_0x561d89,null));}else{return _0x561d89[_0x1cb9('0x8')](0x1f4)[_0x1cb9('0x9')]({'message':_0x1cb9('0x24')});}}; \ No newline at end of file +var _0x70e0=['dump','Missing\x20name\x20and/or\x20path','update','restart','stop','hasOwnProperty','status','destroy','delete','Unknown\x20id','lodash','../../config/pm2','../../config/logger','child_process','exec','bluebird','json','error','stack','name','send','npm\x20install','info','index','list','reject','motion2','length','then','describe','params','catch','create','body','join','../../files/plugins','script','cwd','chdir','dirname','start'];(function(_0x461236,_0x378759){var _0x4d791e=function(_0x1dc116){while(--_0x1dc116){_0x461236['push'](_0x461236['shift']());}};_0x4d791e(++_0x378759);}(_0x70e0,0x17b));var _0x070e=function(_0x4e3345,_0x4db8cb){_0x4e3345=_0x4e3345-0x0;var _0x31704f=_0x70e0[_0x4e3345];return _0x31704f;};'use strict';var _=require(_0x070e('0x0'));var pm2=require(_0x070e('0x1'));var logger=require(_0x070e('0x2'))('api');var path=require('path');var exec=require(_0x070e('0x3'))[_0x070e('0x4')];var BPromise=require(_0x070e('0x5'));function handleEntityNotFound(_0x2593e5,_0x5c90fc){return function(_0x7bce9b){if(!_0x7bce9b){_0x2593e5['sendStatus'](0x194);;}return _0x7bce9b;};}function respondWithResult(_0x46fe68,_0x4b041d){_0x4b041d=_0x4b041d||0xc8;return function(_0x56e420){if(_0x56e420){return _0x46fe68['status'](_0x4b041d)[_0x070e('0x6')](_0x56e420);}return null;};}function handleError(_0x1e11f0,_0x604664){_0x604664=_0x604664||0x1f4;return function(_0x2611e6){logger[_0x070e('0x7')](_0x2611e6[_0x070e('0x8')]);if(_0x2611e6[_0x070e('0x9')]){delete _0x2611e6['name'];}_0x1e11f0['status'](_0x604664)[_0x070e('0xa')](_0x2611e6);};}function execChildProcess(){return new BPromise(function(_0x2e3e5e,_0x12bb37){exec(_0x070e('0xb'),function(_0xa927a2,_0xffcdd6,_0x25cfe1){logger[_0x070e('0xc')](_0xffcdd6);logger[_0x070e('0xc')](_0x25cfe1);if(_0xa927a2){logger[_0x070e('0x7')](_0xa927a2);return _0x12bb37(_0xa927a2);}return _0x2e3e5e(_0xffcdd6);});});}exports[_0x070e('0xd')]=function(_0x52da3b,_0x5dca0f){return pm2[_0x070e('0xe')]()['then'](function(_0x4a33d2){if(_0x4a33d2){var _0x5bae0f=_[_0x070e('0xf')](_0x4a33d2,function(_0x14c3fd){return _0x14c3fd['name']==='express'||_0x14c3fd[_0x070e('0x9')]===_0x070e('0x10');});return{'rows':_0x5bae0f,'count':_0x5bae0f[_0x070e('0x11')]};}return null;})[_0x070e('0x12')](respondWithResult(_0x5dca0f,null))['catch'](handleError(_0x5dca0f,null));};exports['show']=function(_0x17e2e4,_0x2bd937){return pm2[_0x070e('0x13')](_0x17e2e4[_0x070e('0x14')]['id'])[_0x070e('0x12')](respondWithResult(_0x2bd937,null))['then'](handleEntityNotFound(_0x2bd937,null))[_0x070e('0x15')](handleError(_0x2bd937,null));};exports[_0x070e('0x16')]=function(_0x1ad3de,_0x3ea105){if(_0x1ad3de[_0x070e('0x17')]['name']&&_0x1ad3de['body']['script']){var _0x9907cf=path[_0x070e('0x18')](__dirname,_0x070e('0x19'),_0x1ad3de['body'][_0x070e('0x1a')]);var _0x5dc5d2=process[_0x070e('0x1b')]();process[_0x070e('0x1c')](path[_0x070e('0x1d')](_0x9907cf));return execChildProcess()[_0x070e('0x12')](function(_0x28a1c3){process[_0x070e('0x1c')](_0x5dc5d2);return pm2[_0x070e('0x1e')]({'name':_0x1ad3de[_0x070e('0x17')]['name'],'script':_0x9907cf});})[_0x070e('0x12')](function(_0x270061){pm2[_0x070e('0x1f')]();return _0x270061[0x0];})['then'](respondWithResult(_0x3ea105,0xc9))[_0x070e('0x15')](handleError(_0x3ea105,null));}else{return _0x3ea105['status'](0x1f4)['send']({'message':_0x070e('0x20')});}};exports[_0x070e('0x21')]=function(_0x41deb1,_0x1743cc){if(_0x41deb1[_0x070e('0x17')]['id']){delete _0x41deb1['body']['id'];}var _0x374c54={'online':_0x070e('0x22'),'stopped':_0x070e('0x23')};if(_0x374c54[_0x070e('0x24')](_0x41deb1[_0x070e('0x17')][_0x070e('0x25')])){return pm2[_0x374c54[_0x41deb1[_0x070e('0x17')][_0x070e('0x25')]]](_0x41deb1['params']['id'])[_0x070e('0x12')](respondWithResult(_0x1743cc,0xc8))[_0x070e('0x15')](handleError(_0x1743cc,null));}else{return _0x1743cc[_0x070e('0x25')](0x1f4)['send']({'message':'Unknown\x20status'});}};exports[_0x070e('0x26')]=function(_0x46065c,_0xa6c0ab){if(_0x46065c['body']['id']){delete _0x46065c[_0x070e('0x17')]['id'];}if(_0x46065c[_0x070e('0x14')]['id']){return pm2[_0x070e('0x27')](_0x46065c[_0x070e('0x14')]['id'])['then'](function(_0x5bf522){pm2['dump']();return _0x5bf522[0x0];})['then'](respondWithResult(_0xa6c0ab,null))[_0x070e('0x15')](handleError(_0xa6c0ab,null));}else{return _0xa6c0ab['status'](0x1f4)[_0x070e('0xa')]({'message':_0x070e('0x28')});}}; \ No newline at end of file diff --git a/server/api/realtime/index.js b/server/api/realtime/index.js index a4fc353..1e6d8bb 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 _0x2bce=['../../components/auth/service','./realtime.controller','get','/agents','isAuthenticated','getAgents','/queues'];(function(_0x58263f,_0x67699c){var _0x57790c=function(_0x13ca60){while(--_0x13ca60){_0x58263f['push'](_0x58263f['shift']());}};_0x57790c(++_0x67699c);}(_0x2bce,0xe7));var _0xe2bc=function(_0x4ca215,_0x114c54){_0x4ca215=_0x4ca215-0x0;var _0x563b1e=_0x2bce[_0x4ca215];return _0x563b1e;};'use strict';var express=require('express');var router=express['Router']();var auth=require(_0xe2bc('0x0'));var controller=require(_0xe2bc('0x1'));router[_0xe2bc('0x2')](_0xe2bc('0x3'),auth[_0xe2bc('0x4')](),controller[_0xe2bc('0x5')]);router[_0xe2bc('0x2')](_0xe2bc('0x6'),auth['isAuthenticated'](),controller['getQueues']);module['exports']=router; \ No newline at end of file +var _0x8c6d=['exports','../../components/auth/service','/agents','isAuthenticated','getAgents','get','/queues','getQueues'];(function(_0x327ec0,_0x5f7e24){var _0x36892f=function(_0x456073){while(--_0x456073){_0x327ec0['push'](_0x327ec0['shift']());}};_0x36892f(++_0x5f7e24);}(_0x8c6d,0x1d9));var _0xd8c6=function(_0x4150a0,_0x43e9d9){_0x4150a0=_0x4150a0-0x0;var _0x55cdf7=_0x8c6d[_0x4150a0];return _0x55cdf7;};'use strict';var express=require('express');var router=express['Router']();var auth=require(_0xd8c6('0x0'));var controller=require('./realtime.controller');router['get'](_0xd8c6('0x1'),auth[_0xd8c6('0x2')](),controller[_0xd8c6('0x3')]);router[_0xd8c6('0x4')](_0xd8c6('0x5'),auth[_0xd8c6('0x2')](),controller[_0xd8c6('0x6')]);module[_0xd8c6('0x7')]=router; \ No newline at end of file diff --git a/server/api/realtime/realtime.controller.js b/server/api/realtime/realtime.controller.js index e63dcbf..e696b35 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 _0xa9e0=['pause','resolve','then','channel','isValidChannel','format','Channel\x20parameter\x20%s\x20is\x20invalid','toLowerCase','sort','includes','globalStatus','validateSortParameter','getUpdatedSortOptions','fields','join','order','getAgentIdsByQueues','rows','getSortedAgentsIdsByStatus','getAgentIdsByStatus','map','User','rawAttributes','fieldName','type','key','role','agent','getOptions','raw','push','literal','FIELD(id,','forEach','*pause','Pause','merge','user','userProfileId','Agents','extraQueryConditions','assign','getResources','findAndCountAll','filterAgentAttributes','voice','talking','voiceStatus','Status','sortAgentsByStatus','pick','catch','getQueues','startCase','Queue','name','outbound','Queues','filter','UserProfile','lodash','util','../../components/realtime/agents','../../config/utils','../../errors/api','APIBadRequestError','handleError','offset','undefined','count','limit','json','getAgents','getChannels','query','globalStatusFilter','pauseTypeFilter'];(function(_0x1c3b6c,_0x2407ac){var _0x5463e5=function(_0x125cc1){while(--_0x125cc1){_0x1c3b6c['push'](_0x1c3b6c['shift']());}};_0x5463e5(++_0x2407ac);}(_0xa9e0,0x123));var _0x0a9e=function(_0x37c22c,_0x28a70d){_0x37c22c=_0x37c22c-0x0;var _0x119d79=_0xa9e0[_0x37c22c];return _0x119d79;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var rta=require(_0x0a9e('0x2'));var rtq=require('../../components/realtime/queues');var qs=require('../../components/parsers/qs');var utils=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var APIBadRequestError=require(_0x0a9e('0x4'))[_0x0a9e('0x5')];var APIHandleError=require(_0x0a9e('0x4'))[_0x0a9e('0x6')];function respondWithFilteredResult(_0x981158,_0x57b080){return function(_0x219af0){if(_0x219af0){var _0x441e3a=typeof _0x57b080[_0x0a9e('0x7')]==='undefined'&&typeof _0x57b080['limit']===_0x0a9e('0x8');var _0x56465b=_0x219af0['count'];var _0x39753a=_0x441e3a?0x0:_0x57b080[_0x0a9e('0x7')];var _0x307b3e=_0x441e3a?_0x219af0[_0x0a9e('0x9')]:_0x57b080[_0x0a9e('0x7')]+_0x57b080[_0x0a9e('0xa')];var _0x4a4c56;if(_0x307b3e>=_0x56465b){_0x307b3e=_0x56465b;_0x4a4c56=0xc8;}else{_0x4a4c56=0xce;}_0x981158['status'](_0x4a4c56);return _0x981158['set']('Content-Range',_0x39753a+'-'+_0x307b3e+'/'+_0x56465b)[_0x0a9e('0xb')](_0x219af0);}return null;};}exports[_0x0a9e('0xc')]=function(_0xd5b662,_0x26d672){var _0x32d742={'count':0x0,'rows':[]};var _0x69aeb7={};var _0x5db4b0;var _0x4283ce=utils[_0x0a9e('0xd')]();var _0x2b4227;var _0x281129;var _0x44dcfd=_0xd5b662[_0x0a9e('0xe')]['globalQueueFilter'];var _0x22dccb=_0xd5b662['query'][_0x0a9e('0xf')];var _0x519dfd=_0xd5b662[_0x0a9e('0xe')][_0x0a9e('0x10')];var _0x48f32d=_0x22dccb===_0x0a9e('0x11')||_0x22dccb==='*pause'?!![]:![];var _0x459eb1=[];var _0x478723;var _0x106033;Promise[_0x0a9e('0x12')]()[_0x0a9e('0x13')](function(){if(_0xd5b662[_0x0a9e('0xe')][_0x0a9e('0x14')]){if(!utils[_0x0a9e('0x15')](_0xd5b662[_0x0a9e('0xe')][_0x0a9e('0x14')])){throw new APIBadRequestError(util[_0x0a9e('0x16')](_0x0a9e('0x17'),_0xd5b662['query'][_0x0a9e('0x14')]));}_0x5db4b0=_0xd5b662[_0x0a9e('0xe')]['channel'][_0x0a9e('0x18')]();}if(!_0xd5b662['query']['sort']||!_0xd5b662[_0x0a9e('0xe')][_0x0a9e('0x19')][_0x0a9e('0x1a')](_0x0a9e('0x1b'))){_0xd5b662['query'][_0x0a9e('0x19')]=rta[_0x0a9e('0x1c')](_0xd5b662[_0x0a9e('0xe')][_0x0a9e('0x19')]);return;}var _0x370d86=rta[_0x0a9e('0x1d')](_0xd5b662[_0x0a9e('0xe')]['sort']);_0xd5b662['query'][_0x0a9e('0x19')]=_0x370d86[_0x0a9e('0x1e')][_0x0a9e('0x1f')](',');_0x478723=_0x370d86[_0x0a9e('0x20')];})['then'](function(){if(!_0x44dcfd){return[];}return rta[_0x0a9e('0x21')](_0x44dcfd,_0x5db4b0);})['then'](function(_0x45a1e7){_0x459eb1=_0x45a1e7;return rta['getRealtimeAgents']();})[_0x0a9e('0x13')](function(_0x34dc65){_0x281129=_0x34dc65[_0x0a9e('0x22')];if((!_0x22dccb||_0x48f32d)&&!_0x478723){return _0x459eb1;}if(_0x478723&&!_0x22dccb){return rta[_0x0a9e('0x23')](_0x281129,_0x459eb1,_0x478723);}else{return rta[_0x0a9e('0x24')](_0x281129,_0x459eb1,_0x22dccb);}})[_0x0a9e('0x13')](function(_0x11c3b6){_0x459eb1=_0x11c3b6;var _0x14de77=![];if(_0x459eb1['length']===0x0){if(_0x44dcfd||_0x22dccb){_0x14de77=!![];}if(_0x48f32d){_0x14de77=![];}}if(_0x14de77){return _0x32d742;}var _0x3652a7=_[_0x0a9e('0x25')](db[_0x0a9e('0x26')][_0x0a9e('0x27')],function(_0x5c877d){return{'name':_0x5c877d[_0x0a9e('0x28')],'type':_0x5c877d[_0x0a9e('0x29')][_0x0a9e('0x2a')]};});_0xd5b662[_0x0a9e('0xe')][_0x0a9e('0x2b')]=_0x0a9e('0x2c');_0x69aeb7=qs[_0x0a9e('0x2d')](_0x3652a7,_0xd5b662);_0x69aeb7[_0x0a9e('0x2e')]=!![];var _0x1dbde2=[];if(_0x459eb1['length']>0x0){_0x1dbde2[_0x0a9e('0x2f')]({'id':{'$in':_0x459eb1}});if(_0x478723&&!_0x22dccb){_0x106033=[db['sequelize'][_0x0a9e('0x30')](_0x0a9e('0x31')+_0x459eb1+')')];_0x69aeb7[_0x0a9e('0x20')]=_0x106033;}}if(_0x48f32d){_0x4283ce[_0x0a9e('0x32')](function(_0x25ce3a){var _0x5180f1=!![];if(_0x22dccb===_0x0a9e('0x33')&&_0x5db4b0!==_0x25ce3a){_0x5180f1=![];}_0x1dbde2[_0x0a9e('0x2f')]({[_0x25ce3a+_0x0a9e('0x34')]:_0x5180f1});});if(_0x519dfd){_0x1dbde2[_0x0a9e('0x2f')]({'pauseType':_0x519dfd});}}else if(_0x22dccb){_0x4283ce[_0x0a9e('0x32')](function(_0x409319){_0x1dbde2[_0x0a9e('0x2f')]({[_0x409319+_0x0a9e('0x34')]:![]});});}_0x69aeb7['where']=_[_0x0a9e('0x35')](_0x69aeb7['where'],{'$and':_0x1dbde2});if(_0xd5b662[_0x0a9e('0x36')][_0x0a9e('0x2b')]===_0x0a9e('0x36')){var _0x3f3d41={'params':{'id':_0xd5b662['user'][_0x0a9e('0x37')]},'query':{'section':_0x0a9e('0x38'),'role':_0x0a9e('0x2c'),'online':_0xd5b662[_0x0a9e('0xe')]['online']===!![]?!![]:![],'raw':!![],'ids':_0x459eb1,'customSorting':_0x106033}};if(_0x48f32d){_0x3f3d41['query'][_0x0a9e('0x39')]=_0x1dbde2;}_0x3f3d41['query']=Object[_0x0a9e('0x3a')](_0x3f3d41[_0x0a9e('0xe')],_0xd5b662[_0x0a9e('0xe')]);delete _0x3f3d41[_0x0a9e('0xe')]['id'];return db['UserProfile'][_0x0a9e('0x3b')](_0x3f3d41);}return db[_0x0a9e('0x26')][_0x0a9e('0x3c')](_0x69aeb7);})['then'](function(_0x1dbf74){_0x32d742[_0x0a9e('0x9')]=_0x1dbf74[_0x0a9e('0x9')];_0x2b4227=_0x1dbf74['rows'];return _0x2b4227['map'](function(_0x11b61d){var _0x40d766=_['find'](_0x281129,['id',_0x11b61d['id']]);if(_0x40d766){var _0x2b814e=rta[_0x0a9e('0x3d')](_0x40d766);_[_0x0a9e('0x35')](_0x11b61d,_0x2b814e);}_0x11b61d[_0x0a9e('0x1b')]=rta['getAgentStatus'](_0x11b61d);if(_0x11b61d['globalStatus'][_0x0a9e('0x1a')](_0x0a9e('0x11'))){_0x4283ce['forEach'](function(_0x183991){if(_0x11b61d[_0x183991+_0x0a9e('0x34')]){if(_0x183991===_0x0a9e('0x3e')){if(_0x11b61d['voiceStatus']!==_0x0a9e('0x3f')){_0x11b61d[_0x0a9e('0x40')]=_0x0a9e('0x11');}}else{_0x11b61d[_0x183991+_0x0a9e('0x41')]=_0x0a9e('0x11');}}});}return _0x11b61d;});})[_0x0a9e('0x13')](function(_0x2881b3){if(!_0x478723||_0x106033){return _0x2881b3;}return rta[_0x0a9e('0x42')](_0x2881b3,_0x478723);})[_0x0a9e('0x13')](function(_0x3da2cd){var _0x2c3711=null;if(_0xd5b662[_0x0a9e('0xe')][_0x0a9e('0x1e')]){var _0x11ca30=_0xd5b662[_0x0a9e('0xe')]['fields']['split'](',');_0x2c3711=_0x3da2cd[_0x0a9e('0x25')](function(_0xb3795a){return _[_0x0a9e('0x43')](_0xb3795a,_0x11ca30);});}_0x32d742[_0x0a9e('0x22')]=_0x2c3711||_0x3da2cd;return _0x32d742;})[_0x0a9e('0x13')](respondWithFilteredResult(_0x26d672,_0x69aeb7))[_0x0a9e('0x44')](APIHandleError(_0x26d672));};exports[_0x0a9e('0x45')]=function(_0x445e25,_0x432fcc){var _0x25c6e6={'count':0x0,'rows':[]};var _0x2c2cb0={};var _0x35ed4a;var _0x5026aa;var _0x117c99;Promise[_0x0a9e('0x12')]()[_0x0a9e('0x13')](function(){if(_0x445e25[_0x0a9e('0xe')][_0x0a9e('0x14')]){if(!utils[_0x0a9e('0x15')](_0x445e25[_0x0a9e('0xe')][_0x0a9e('0x14')])){throw new APIBadRequestError(util['format'](_0x0a9e('0x17'),_0x445e25['query'][_0x0a9e('0x14')]));}_0x35ed4a=_0x445e25[_0x0a9e('0xe')][_0x0a9e('0x14')]['toLowerCase']();}var _0x14bec2=_[_0x0a9e('0x46')](_0x35ed4a)+_0x0a9e('0x47');var _0x34aa5a=_[_0x0a9e('0x25')](db[_0x14bec2][_0x0a9e('0x27')],function(_0x45bf7f){return{'name':_0x45bf7f['fieldName'],'type':_0x45bf7f[_0x0a9e('0x29')][_0x0a9e('0x2a')]};});if(!_0x445e25[_0x0a9e('0xe')][_0x0a9e('0x1e')]){var _0x409789=['id',_0x0a9e('0x48')];if(_0x35ed4a===_0x0a9e('0x3e')){_0x409789[_0x0a9e('0x2f')](_0x0a9e('0x29'));if(_0x445e25['query'][_0x0a9e('0x29')]===_0x0a9e('0x49')){_0x409789['push'](['dialActive','dialMethod']);}}_0x445e25[_0x0a9e('0xe')][_0x0a9e('0x1e')]=_0x409789[_0x0a9e('0x1f')](',');}_0x2c2cb0=qs[_0x0a9e('0x2d')](_0x34aa5a,_0x445e25);if(_0x445e25[_0x0a9e('0x36')][_0x0a9e('0x2b')]===_0x0a9e('0x36')){var _0x375c18={'params':{'id':_0x445e25['user']['userProfileId']},'query':{'section':_0x35ed4a==='voice'&&_0x445e25[_0x0a9e('0xe')][_0x0a9e('0x29')]===_0x0a9e('0x49')?'QueueCampaigns':_[_0x0a9e('0x46')](_0x35ed4a)+_0x0a9e('0x4a'),'type':_0x445e25['query']['type'],'nolimit':!![],'sort':_0x0a9e('0x48'),'filter':_0x445e25['query'][_0x0a9e('0x4b')]}};_0x375c18['query']=Object[_0x0a9e('0x3a')](_0x375c18[_0x0a9e('0xe')],_0x445e25[_0x0a9e('0xe')]);delete _0x375c18['query']['id'];return db[_0x0a9e('0x4c')][_0x0a9e('0x3b')](_0x375c18);}return db[_0x14bec2]['findAndCountAll'](_0x2c2cb0);})['then'](function(_0x128aa6){_0x25c6e6[_0x0a9e('0x9')]=_0x128aa6['count'];_0x5026aa=_0x128aa6[_0x0a9e('0x22')];return rtq['getRealtimeQueues'](_0x445e25,_0x35ed4a);})[_0x0a9e('0x13')](function(_0x523cd2){_0x117c99=_0x523cd2[_0x0a9e('0x22')];return rtq['initializeQueues'](_0x5026aa,_0x117c99,_0x35ed4a,_0x445e25['query']['type']);})[_0x0a9e('0x13')](function(_0x47de4c){_0x25c6e6[_0x0a9e('0x22')]=_0x47de4c;return _0x25c6e6;})[_0x0a9e('0x13')](respondWithFilteredResult(_0x432fcc,_0x2c2cb0))[_0x0a9e('0x44')](APIHandleError(_0x432fcc));}; \ No newline at end of file +var _0xa9e0=['pause','resolve','then','channel','isValidChannel','format','Channel\x20parameter\x20%s\x20is\x20invalid','toLowerCase','sort','includes','globalStatus','validateSortParameter','getUpdatedSortOptions','fields','join','order','getAgentIdsByQueues','rows','getSortedAgentsIdsByStatus','getAgentIdsByStatus','map','User','rawAttributes','fieldName','type','key','role','agent','getOptions','raw','push','literal','FIELD(id,','forEach','*pause','Pause','merge','user','userProfileId','Agents','extraQueryConditions','assign','getResources','findAndCountAll','filterAgentAttributes','voice','talking','voiceStatus','Status','sortAgentsByStatus','pick','catch','getQueues','startCase','Queue','name','outbound','Queues','filter','UserProfile','lodash','util','../../components/realtime/agents','../../config/utils','../../errors/api','APIBadRequestError','handleError','offset','undefined','count','limit','json','getAgents','getChannels','query','globalStatusFilter','pauseTypeFilter'];(function(_0x2254f3,_0x36ed5c){var _0x2e3ec5=function(_0x1a2c51){while(--_0x1a2c51){_0x2254f3['push'](_0x2254f3['shift']());}};_0x2e3ec5(++_0x36ed5c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0xa9e0[_0x2f5ac5];return _0x37c9a8;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var rta=require(_0x0a9e('0x2'));var rtq=require('../../components/realtime/queues');var qs=require('../../components/parsers/qs');var utils=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var APIBadRequestError=require(_0x0a9e('0x4'))[_0x0a9e('0x5')];var APIHandleError=require(_0x0a9e('0x4'))[_0x0a9e('0x6')];function respondWithFilteredResult(_0x981158,_0x57b080){return function(_0x219af0){if(_0x219af0){var _0x441e3a=typeof _0x57b080[_0x0a9e('0x7')]==='undefined'&&typeof _0x57b080['limit']===_0x0a9e('0x8');var _0x56465b=_0x219af0['count'];var _0x39753a=_0x441e3a?0x0:_0x57b080[_0x0a9e('0x7')];var _0x307b3e=_0x441e3a?_0x219af0[_0x0a9e('0x9')]:_0x57b080[_0x0a9e('0x7')]+_0x57b080[_0x0a9e('0xa')];var _0x4a4c56;if(_0x307b3e>=_0x56465b){_0x307b3e=_0x56465b;_0x4a4c56=0xc8;}else{_0x4a4c56=0xce;}_0x981158['status'](_0x4a4c56);return _0x981158['set']('Content-Range',_0x39753a+'-'+_0x307b3e+'/'+_0x56465b)[_0x0a9e('0xb')](_0x219af0);}return null;};}exports[_0x0a9e('0xc')]=function(_0xd5b662,_0x26d672){var _0x32d742={'count':0x0,'rows':[]};var _0x69aeb7={};var _0x5db4b0;var _0x4283ce=utils[_0x0a9e('0xd')]();var _0x2b4227;var _0x281129;var _0x44dcfd=_0xd5b662[_0x0a9e('0xe')]['globalQueueFilter'];var _0x22dccb=_0xd5b662['query'][_0x0a9e('0xf')];var _0x519dfd=_0xd5b662[_0x0a9e('0xe')][_0x0a9e('0x10')];var _0x48f32d=_0x22dccb===_0x0a9e('0x11')||_0x22dccb==='*pause'?!![]:![];var _0x459eb1=[];var _0x478723;var _0x106033;Promise[_0x0a9e('0x12')]()[_0x0a9e('0x13')](function(){if(_0xd5b662[_0x0a9e('0xe')][_0x0a9e('0x14')]){if(!utils[_0x0a9e('0x15')](_0xd5b662[_0x0a9e('0xe')][_0x0a9e('0x14')])){throw new APIBadRequestError(util[_0x0a9e('0x16')](_0x0a9e('0x17'),_0xd5b662['query'][_0x0a9e('0x14')]));}_0x5db4b0=_0xd5b662[_0x0a9e('0xe')]['channel'][_0x0a9e('0x18')]();}if(!_0xd5b662['query']['sort']||!_0xd5b662[_0x0a9e('0xe')][_0x0a9e('0x19')][_0x0a9e('0x1a')](_0x0a9e('0x1b'))){_0xd5b662['query'][_0x0a9e('0x19')]=rta[_0x0a9e('0x1c')](_0xd5b662[_0x0a9e('0xe')][_0x0a9e('0x19')]);return;}var _0x370d86=rta[_0x0a9e('0x1d')](_0xd5b662[_0x0a9e('0xe')]['sort']);_0xd5b662['query'][_0x0a9e('0x19')]=_0x370d86[_0x0a9e('0x1e')][_0x0a9e('0x1f')](',');_0x478723=_0x370d86[_0x0a9e('0x20')];})['then'](function(){if(!_0x44dcfd){return[];}return rta[_0x0a9e('0x21')](_0x44dcfd,_0x5db4b0);})['then'](function(_0x45a1e7){_0x459eb1=_0x45a1e7;return rta['getRealtimeAgents']();})[_0x0a9e('0x13')](function(_0x34dc65){_0x281129=_0x34dc65[_0x0a9e('0x22')];if((!_0x22dccb||_0x48f32d)&&!_0x478723){return _0x459eb1;}if(_0x478723&&!_0x22dccb){return rta[_0x0a9e('0x23')](_0x281129,_0x459eb1,_0x478723);}else{return rta[_0x0a9e('0x24')](_0x281129,_0x459eb1,_0x22dccb);}})[_0x0a9e('0x13')](function(_0x11c3b6){_0x459eb1=_0x11c3b6;var _0x14de77=![];if(_0x459eb1['length']===0x0){if(_0x44dcfd||_0x22dccb){_0x14de77=!![];}if(_0x48f32d){_0x14de77=![];}}if(_0x14de77){return _0x32d742;}var _0x3652a7=_[_0x0a9e('0x25')](db[_0x0a9e('0x26')][_0x0a9e('0x27')],function(_0x5c877d){return{'name':_0x5c877d[_0x0a9e('0x28')],'type':_0x5c877d[_0x0a9e('0x29')][_0x0a9e('0x2a')]};});_0xd5b662[_0x0a9e('0xe')][_0x0a9e('0x2b')]=_0x0a9e('0x2c');_0x69aeb7=qs[_0x0a9e('0x2d')](_0x3652a7,_0xd5b662);_0x69aeb7[_0x0a9e('0x2e')]=!![];var _0x1dbde2=[];if(_0x459eb1['length']>0x0){_0x1dbde2[_0x0a9e('0x2f')]({'id':{'$in':_0x459eb1}});if(_0x478723&&!_0x22dccb){_0x106033=[db['sequelize'][_0x0a9e('0x30')](_0x0a9e('0x31')+_0x459eb1+')')];_0x69aeb7[_0x0a9e('0x20')]=_0x106033;}}if(_0x48f32d){_0x4283ce[_0x0a9e('0x32')](function(_0x25ce3a){var _0x5180f1=!![];if(_0x22dccb===_0x0a9e('0x33')&&_0x5db4b0!==_0x25ce3a){_0x5180f1=![];}_0x1dbde2[_0x0a9e('0x2f')]({[_0x25ce3a+_0x0a9e('0x34')]:_0x5180f1});});if(_0x519dfd){_0x1dbde2[_0x0a9e('0x2f')]({'pauseType':_0x519dfd});}}else if(_0x22dccb){_0x4283ce[_0x0a9e('0x32')](function(_0x409319){_0x1dbde2[_0x0a9e('0x2f')]({[_0x409319+_0x0a9e('0x34')]:![]});});}_0x69aeb7['where']=_[_0x0a9e('0x35')](_0x69aeb7['where'],{'$and':_0x1dbde2});if(_0xd5b662[_0x0a9e('0x36')][_0x0a9e('0x2b')]===_0x0a9e('0x36')){var _0x3f3d41={'params':{'id':_0xd5b662['user'][_0x0a9e('0x37')]},'query':{'section':_0x0a9e('0x38'),'role':_0x0a9e('0x2c'),'online':_0xd5b662[_0x0a9e('0xe')]['online']===!![]?!![]:![],'raw':!![],'ids':_0x459eb1,'customSorting':_0x106033}};if(_0x48f32d){_0x3f3d41['query'][_0x0a9e('0x39')]=_0x1dbde2;}_0x3f3d41['query']=Object[_0x0a9e('0x3a')](_0x3f3d41[_0x0a9e('0xe')],_0xd5b662[_0x0a9e('0xe')]);delete _0x3f3d41[_0x0a9e('0xe')]['id'];return db['UserProfile'][_0x0a9e('0x3b')](_0x3f3d41);}return db[_0x0a9e('0x26')][_0x0a9e('0x3c')](_0x69aeb7);})['then'](function(_0x1dbf74){_0x32d742[_0x0a9e('0x9')]=_0x1dbf74[_0x0a9e('0x9')];_0x2b4227=_0x1dbf74['rows'];return _0x2b4227['map'](function(_0x11b61d){var _0x40d766=_['find'](_0x281129,['id',_0x11b61d['id']]);if(_0x40d766){var _0x2b814e=rta[_0x0a9e('0x3d')](_0x40d766);_[_0x0a9e('0x35')](_0x11b61d,_0x2b814e);}_0x11b61d[_0x0a9e('0x1b')]=rta['getAgentStatus'](_0x11b61d);if(_0x11b61d['globalStatus'][_0x0a9e('0x1a')](_0x0a9e('0x11'))){_0x4283ce['forEach'](function(_0x183991){if(_0x11b61d[_0x183991+_0x0a9e('0x34')]){if(_0x183991===_0x0a9e('0x3e')){if(_0x11b61d['voiceStatus']!==_0x0a9e('0x3f')){_0x11b61d[_0x0a9e('0x40')]=_0x0a9e('0x11');}}else{_0x11b61d[_0x183991+_0x0a9e('0x41')]=_0x0a9e('0x11');}}});}return _0x11b61d;});})[_0x0a9e('0x13')](function(_0x2881b3){if(!_0x478723||_0x106033){return _0x2881b3;}return rta[_0x0a9e('0x42')](_0x2881b3,_0x478723);})[_0x0a9e('0x13')](function(_0x3da2cd){var _0x2c3711=null;if(_0xd5b662[_0x0a9e('0xe')][_0x0a9e('0x1e')]){var _0x11ca30=_0xd5b662[_0x0a9e('0xe')]['fields']['split'](',');_0x2c3711=_0x3da2cd[_0x0a9e('0x25')](function(_0xb3795a){return _[_0x0a9e('0x43')](_0xb3795a,_0x11ca30);});}_0x32d742[_0x0a9e('0x22')]=_0x2c3711||_0x3da2cd;return _0x32d742;})[_0x0a9e('0x13')](respondWithFilteredResult(_0x26d672,_0x69aeb7))[_0x0a9e('0x44')](APIHandleError(_0x26d672));};exports[_0x0a9e('0x45')]=function(_0x445e25,_0x432fcc){var _0x25c6e6={'count':0x0,'rows':[]};var _0x2c2cb0={};var _0x35ed4a;var _0x5026aa;var _0x117c99;Promise[_0x0a9e('0x12')]()[_0x0a9e('0x13')](function(){if(_0x445e25[_0x0a9e('0xe')][_0x0a9e('0x14')]){if(!utils[_0x0a9e('0x15')](_0x445e25[_0x0a9e('0xe')][_0x0a9e('0x14')])){throw new APIBadRequestError(util['format'](_0x0a9e('0x17'),_0x445e25['query'][_0x0a9e('0x14')]));}_0x35ed4a=_0x445e25[_0x0a9e('0xe')][_0x0a9e('0x14')]['toLowerCase']();}var _0x14bec2=_[_0x0a9e('0x46')](_0x35ed4a)+_0x0a9e('0x47');var _0x34aa5a=_[_0x0a9e('0x25')](db[_0x14bec2][_0x0a9e('0x27')],function(_0x45bf7f){return{'name':_0x45bf7f['fieldName'],'type':_0x45bf7f[_0x0a9e('0x29')][_0x0a9e('0x2a')]};});if(!_0x445e25[_0x0a9e('0xe')][_0x0a9e('0x1e')]){var _0x409789=['id',_0x0a9e('0x48')];if(_0x35ed4a===_0x0a9e('0x3e')){_0x409789[_0x0a9e('0x2f')](_0x0a9e('0x29'));if(_0x445e25['query'][_0x0a9e('0x29')]===_0x0a9e('0x49')){_0x409789['push'](['dialActive','dialMethod']);}}_0x445e25[_0x0a9e('0xe')][_0x0a9e('0x1e')]=_0x409789[_0x0a9e('0x1f')](',');}_0x2c2cb0=qs[_0x0a9e('0x2d')](_0x34aa5a,_0x445e25);if(_0x445e25[_0x0a9e('0x36')][_0x0a9e('0x2b')]===_0x0a9e('0x36')){var _0x375c18={'params':{'id':_0x445e25['user']['userProfileId']},'query':{'section':_0x35ed4a==='voice'&&_0x445e25[_0x0a9e('0xe')][_0x0a9e('0x29')]===_0x0a9e('0x49')?'QueueCampaigns':_[_0x0a9e('0x46')](_0x35ed4a)+_0x0a9e('0x4a'),'type':_0x445e25['query']['type'],'nolimit':!![],'sort':_0x0a9e('0x48'),'filter':_0x445e25['query'][_0x0a9e('0x4b')]}};_0x375c18['query']=Object[_0x0a9e('0x3a')](_0x375c18[_0x0a9e('0xe')],_0x445e25[_0x0a9e('0xe')]);delete _0x375c18['query']['id'];return db[_0x0a9e('0x4c')][_0x0a9e('0x3b')](_0x375c18);}return db[_0x14bec2]['findAndCountAll'](_0x2c2cb0);})['then'](function(_0x128aa6){_0x25c6e6[_0x0a9e('0x9')]=_0x128aa6['count'];_0x5026aa=_0x128aa6[_0x0a9e('0x22')];return rtq['getRealtimeQueues'](_0x445e25,_0x35ed4a);})[_0x0a9e('0x13')](function(_0x523cd2){_0x117c99=_0x523cd2[_0x0a9e('0x22')];return rtq['initializeQueues'](_0x5026aa,_0x117c99,_0x35ed4a,_0x445e25['query']['type']);})[_0x0a9e('0x13')](function(_0x47de4c){_0x25c6e6[_0x0a9e('0x22')]=_0x47de4c;return _0x25c6e6;})[_0x0a9e('0x13')](respondWithFilteredResult(_0x432fcc,_0x2c2cb0))[_0x0a9e('0x44')](APIHandleError(_0x432fcc));}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/index.js b/server/api/reportAgentPreview/index.js index b6ad4ac..eb6041e 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(_0x5bc440,_0x2b6060){var _0x422868=function(_0x49ef94){while(--_0x49ef94){_0x5bc440['push'](_0x5bc440['shift']());}};_0x422868(++_0x2b6060);}(_0xa9e0,0x123));var _0x0a9e=function(_0xa1e3e3,_0x29fe0e){_0xa1e3e3=_0xa1e3e3-0x0;var _0xc980e9=_0xa9e0[_0xa1e3e3];return _0xc980e9;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));module[_0x0a9e('0x7')]=router; \ No newline at end of file +var _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x245e0e,_0xcab6db){var _0xafcff4=function(_0x3ec00c){while(--_0x3ec00c){_0x245e0e['push'](_0x245e0e['shift']());}};_0xafcff4(++_0xcab6db);}(_0x9c44,0x178));var _0x49c4=function(_0x68c979,_0x431cff){_0x68c979=_0x68c979-0x0;var _0x4f0001=_0x9c44[_0x68c979];return _0x4f0001;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.attributes.js b/server/api/reportAgentPreview/reportAgentPreview.attributes.js index 27893d3..6c275e6 100644 --- a/server/api/reportAgentPreview/reportAgentPreview.attributes.js +++ b/server/api/reportAgentPreview/reportAgentPreview.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2bd8=['sequelize','INTEGER','STRING','DATE'];(function(_0x163038,_0x541512){var _0x41b32a=function(_0x3cd40c){while(--_0x3cd40c){_0x163038['push'](_0x163038['shift']());}};_0x41b32a(++_0x541512);}(_0x2bd8,0x130));var _0x82bd=function(_0x1c2ecf,_0x49be0d){_0x1c2ecf=_0x1c2ecf-0x0;var _0x27d1f5=_0x2bd8[_0x1c2ecf];return _0x27d1f5;};'use strict';var Sequelize=require(_0x82bd('0x0'));module['exports']={'state':{'type':Sequelize[_0x82bd('0x1')](0x2)},'statedesc':{'type':Sequelize[_0x82bd('0x2')]},'scheduledat':{'type':Sequelize[_0x82bd('0x3')]},'uniqueid':{'type':Sequelize[_0x82bd('0x2')]},'starttime':{'type':Sequelize[_0x82bd('0x3')]},'responsetime':{'type':Sequelize[_0x82bd('0x3')]},'ringtime':{'type':Sequelize[_0x82bd('0x1')],'defaultValue':0x0},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize[_0x82bd('0x2')]},'membername':{'type':Sequelize[_0x82bd('0x2')]}}; \ No newline at end of file +var _0x6c7b=['DATE','INTEGER','STRING','sequelize'];(function(_0x2084e0,_0x2a50ee){var _0x22625b=function(_0x5c6f96){while(--_0x5c6f96){_0x2084e0['push'](_0x2084e0['shift']());}};_0x22625b(++_0x2a50ee);}(_0x6c7b,0x10b));var _0xb6c7=function(_0x2cbdab,_0x3d0164){_0x2cbdab=_0x2cbdab-0x0;var _0x38ee3b=_0x6c7b[_0x2cbdab];return _0x38ee3b;};'use strict';var Sequelize=require(_0xb6c7('0x0'));module['exports']={'state':{'type':Sequelize['INTEGER'](0x2)},'statedesc':{'type':Sequelize['STRING']},'scheduledat':{'type':Sequelize[_0xb6c7('0x1')]},'uniqueid':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0xb6c7('0x1')]},'responsetime':{'type':Sequelize[_0xb6c7('0x1')]},'ringtime':{'type':Sequelize[_0xb6c7('0x2')],'defaultValue':0x0},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize[_0xb6c7('0x3')]},'membername':{'type':Sequelize[_0xb6c7('0x3')]}}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.model.js b/server/api/reportAgentPreview/reportAgentPreview.model.js index 94970d7..a3c2708 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 _0x5e76=['moment','bluebird','path','rimraf','../../config/environment','./reportAgentPreview.attributes','exports','define','ReportAgentPreview','lodash','util','../../config/logger','api'];(function(_0x1ed8d7,_0x53ff1f){var _0xbcdfc5=function(_0x58d9a5){while(--_0x58d9a5){_0x1ed8d7['push'](_0x1ed8d7['shift']());}};_0xbcdfc5(++_0x53ff1f);}(_0x5e76,0x18f));var _0x65e7=function(_0x9b9126,_0x2e7407){_0x9b9126=_0x9b9126-0x0;var _0x2aa64c=_0x5e76[_0x9b9126];return _0x2aa64c;};'use strict';var _=require(_0x65e7('0x0'));var util=require(_0x65e7('0x1'));var logger=require(_0x65e7('0x2'))(_0x65e7('0x3'));var moment=require(_0x65e7('0x4'));var BPromise=require(_0x65e7('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x65e7('0x6'));var rimraf=require(_0x65e7('0x7'));var config=require(_0x65e7('0x8'));var attributes=require(_0x65e7('0x9'));module[_0x65e7('0xa')]=function(_0x352001,_0x5e6277){return _0x352001[_0x65e7('0xb')](_0x65e7('0xc'),attributes,{'tableName':'report_agent_preview','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7c52=['rimraf','../../config/environment','./reportAgentPreview.attributes','exports','define','report_agent_preview','lodash','../../config/logger','api','moment','bluebird','path'];(function(_0x528ae6,_0x3edab8){var _0x6bf3ae=function(_0x59aa51){while(--_0x59aa51){_0x528ae6['push'](_0x528ae6['shift']());}};_0x6bf3ae(++_0x3edab8);}(_0x7c52,0x1ce));var _0x27c5=function(_0x1da1a7,_0x1be937){_0x1da1a7=_0x1da1a7-0x0;var _0x460192=_0x7c52[_0x1da1a7];return _0x460192;};'use strict';var _=require(_0x27c5('0x0'));var util=require('util');var logger=require(_0x27c5('0x1'))(_0x27c5('0x2'));var moment=require(_0x27c5('0x3'));var BPromise=require(_0x27c5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x27c5('0x5'));var rimraf=require(_0x27c5('0x6'));var config=require(_0x27c5('0x7'));var attributes=require(_0x27c5('0x8'));module[_0x27c5('0x9')]=function(_0x2635a4,_0x5d5778){return _0x2635a4[_0x27c5('0xa')]('ReportAgentPreview',attributes,{'tableName':_0x27c5('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 b6d5c7a..19c2b73 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 _0x68e3=['../../config/environment','jayson/promise','client','http','then','ReportAgentPreview,\x20%s,\x20%s','request\x20sent','debug','ReportAgentPreview,\x20%s,\x20%s,\x20%s','stringify','error','code','message','CreateReportAgentPreview','ReportAgentPreview','create','body','options','raw','info','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','rpc'];(function(_0x3892e4,_0x38bb84){var _0x4b3020=function(_0x449a22){while(--_0x449a22){_0x3892e4['push'](_0x3892e4['shift']());}};_0x4b3020(++_0x38bb84);}(_0x68e3,0x111));var _0x368e=function(_0x2a5db8,_0x1f3188){_0x2a5db8=_0x2a5db8-0x0;var _0x5ce985=_0x68e3[_0x2a5db8];return _0x5ce985;};'use strict';var _=require(_0x368e('0x0'));var util=require(_0x368e('0x1'));var moment=require(_0x368e('0x2'));var BPromise=require('bluebird');var rs=require(_0x368e('0x3'));var fs=require('fs');var Redis=require(_0x368e('0x4'));var db=require(_0x368e('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x368e('0x6'));var config=require(_0x368e('0x7'));var jayson=require(_0x368e('0x8'));var client=jayson[_0x368e('0x9')][_0x368e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x6eb21a,_0x111b76,_0x2256bd){return new BPromise(function(_0x49bbcd,_0x24399f){return client['request'](_0x6eb21a,_0x2256bd)[_0x368e('0xb')](function(_0x309ca4){logger['info'](_0x368e('0xc'),_0x111b76,_0x368e('0xd'));logger[_0x368e('0xe')](_0x368e('0xf'),_0x111b76,_0x368e('0xd'),JSON[_0x368e('0x10')](_0x309ca4));if(_0x309ca4[_0x368e('0x11')]){if(_0x309ca4[_0x368e('0x11')][_0x368e('0x12')]===0x1f4){logger[_0x368e('0x11')](_0x368e('0xc'),_0x111b76,_0x309ca4[_0x368e('0x11')][_0x368e('0x13')]);return _0x24399f(_0x309ca4[_0x368e('0x11')][_0x368e('0x13')]);}logger[_0x368e('0x11')](_0x368e('0xc'),_0x111b76,_0x309ca4[_0x368e('0x11')][_0x368e('0x13')]);return _0x49bbcd(_0x309ca4[_0x368e('0x11')]['message']);}else{logger['info']('ReportAgentPreview,\x20%s,\x20%s',_0x111b76,'request\x20sent');_0x49bbcd(_0x309ca4['result'][_0x368e('0x13')]);}})['catch'](function(_0x4bea6a){logger[_0x368e('0x11')](_0x368e('0xc'),_0x111b76,_0x4bea6a);_0x24399f(_0x4bea6a);});});}exports[_0x368e('0x14')]=function(_0x35f615){var _0x2475d8=this;return new Promise(function(_0x44d5be,_0x3e1a71){return db[_0x368e('0x15')][_0x368e('0x16')](_0x35f615[_0x368e('0x17')],{'raw':_0x35f615['options']?_0x35f615[_0x368e('0x18')][_0x368e('0x19')]===undefined?!![]:![]:!![]})[_0x368e('0xb')](function(_0x37b1b0){logger[_0x368e('0x1a')]('CreateReportAgentPreview',_0x35f615);logger[_0x368e('0xe')](_0x368e('0x14'),_0x35f615,JSON['stringify'](_0x37b1b0));_0x44d5be(_0x37b1b0);})[_0x368e('0x1b')](function(_0x3e7822){logger[_0x368e('0x11')]('CreateReportAgentPreview',_0x3e7822[_0x368e('0x13')],_0x35f615);_0x3e1a71(_0x2475d8['error'](0x1f4,_0x3e7822[_0x368e('0x13')]));});});}; \ No newline at end of file +var _0xe5c1=['message','result','catch','ReportAgentPreview','create','body','options','raw','CreateReportAgentPreview','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','info','ReportAgentPreview,\x20%s,\x20%s','debug','ReportAgentPreview,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x1730eb,_0x1c37b0){var _0x1074f6=function(_0x31e53f){while(--_0x31e53f){_0x1730eb['push'](_0x1730eb['shift']());}};_0x1074f6(++_0x1c37b0);}(_0xe5c1,0x1e9));var _0x1e5c=function(_0x16e287,_0x1219d3){_0x16e287=_0x16e287-0x0;var _0x3c9430=_0xe5c1[_0x16e287];return _0x3c9430;};'use strict';var _=require(_0x1e5c('0x0'));var util=require(_0x1e5c('0x1'));var moment=require(_0x1e5c('0x2'));var BPromise=require(_0x1e5c('0x3'));var rs=require(_0x1e5c('0x4'));var fs=require('fs');var Redis=require(_0x1e5c('0x5'));var db=require(_0x1e5c('0x6'))['db'];var utils=require(_0x1e5c('0x7'));var logger=require(_0x1e5c('0x8'))(_0x1e5c('0x9'));var config=require(_0x1e5c('0xa'));var jayson=require('jayson/promise');var client=jayson['client'][_0x1e5c('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1e89b5,_0x477c28,_0x58fc52){return new BPromise(function(_0x53dbfc,_0x4de9b6){return client[_0x1e5c('0xc')](_0x1e89b5,_0x58fc52)[_0x1e5c('0xd')](function(_0x10dbe5){logger[_0x1e5c('0xe')](_0x1e5c('0xf'),_0x477c28,'request\x20sent');logger[_0x1e5c('0x10')](_0x1e5c('0x11'),_0x477c28,_0x1e5c('0x12'),JSON[_0x1e5c('0x13')](_0x10dbe5));if(_0x10dbe5[_0x1e5c('0x14')]){if(_0x10dbe5[_0x1e5c('0x14')]['code']===0x1f4){logger[_0x1e5c('0x14')]('ReportAgentPreview,\x20%s,\x20%s',_0x477c28,_0x10dbe5[_0x1e5c('0x14')][_0x1e5c('0x15')]);return _0x4de9b6(_0x10dbe5['error']['message']);}logger[_0x1e5c('0x14')](_0x1e5c('0xf'),_0x477c28,_0x10dbe5[_0x1e5c('0x14')][_0x1e5c('0x15')]);return _0x53dbfc(_0x10dbe5[_0x1e5c('0x14')]['message']);}else{logger[_0x1e5c('0xe')](_0x1e5c('0xf'),_0x477c28,_0x1e5c('0x12'));_0x53dbfc(_0x10dbe5[_0x1e5c('0x16')][_0x1e5c('0x15')]);}})[_0x1e5c('0x17')](function(_0x53a0cc){logger[_0x1e5c('0x14')](_0x1e5c('0xf'),_0x477c28,_0x53a0cc);_0x4de9b6(_0x53a0cc);});});}exports['CreateReportAgentPreview']=function(_0x1fbfe1){var _0x10b6c=this;return new Promise(function(_0x214a79,_0x124078){return db[_0x1e5c('0x18')][_0x1e5c('0x19')](_0x1fbfe1[_0x1e5c('0x1a')],{'raw':_0x1fbfe1[_0x1e5c('0x1b')]?_0x1fbfe1['options'][_0x1e5c('0x1c')]===undefined?!![]:![]:!![]})[_0x1e5c('0xd')](function(_0xdfeb29){logger[_0x1e5c('0xe')]('CreateReportAgentPreview',_0x1fbfe1);logger['debug'](_0x1e5c('0x1d'),_0x1fbfe1,JSON[_0x1e5c('0x13')](_0xdfeb29));_0x214a79(_0xdfeb29);})[_0x1e5c('0x17')](function(_0x58eba8){logger[_0x1e5c('0x14')]('CreateReportAgentPreview',_0x58eba8[_0x1e5c('0x15')],_0x1fbfe1);_0x124078(_0x10b6c['error'](0x1f4,_0x58eba8[_0x1e5c('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/rpc/index.js b/server/api/rpc/index.js index 20e7c19..1a6e372 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 _0x0ae7=['/telephones','/trunks','campaigns','chatQueuesWaitingInteractions','/mail/queues/waitinginteractions','mailQueuesWaitingInteractions','/openchannel/queues/waitinginteractions','openchannelQueuesWaitingInteractions','openchannelQueuesIdWaitingInteractions','smsQueuesWaitingInteractions','/whatsapp/queues/waitinginteractions','whatsappQueuesWaitingInteractions','/mail/queues/:id/notify','queueNotify','mail','showMailQueues','post','/chat/queues/:id/notify','/chat/queues/:id','showChatQueues','/fax/queues/:id/notify','/fax/queues/:id','showFaxQueues','/sms/queues/:id/notify','sms','/whatsapp/queues/:id/notify','whatsapp','showSmsQueues','showWhatsappQueues','/agents/:id/notify','agentNotify','exports','util','path','express','Router','../../components/auth/service','./rpc.controller','/voice/channels','isAuthenticated','voiceChannels','/voice/channels/:uniqueid/mixmonitor','voiceChannelMixMonitor','voiceChannelStopMixMonitor','get','/chat/queues','mailQueues','/mail/accounts','mailAccounts','openchannelQueues','/sms/queues','smsQueues','/whatsapp/queues','whatsappQueues','/fax/queues','/voice/queues/preview/:id','voiceQueuesPreview','/voice/queues/channels','voiceQueuesChannels','/voice/queues/channels/:uniqueid/hangup','/voice/queues/channels/:uniqueid/redirect/:exten','voiceQueuesChannelRedirect','/voice/queues/:id','put','updateVoiceQueue','/outbound','outbound','outboundChannels','/agents','/agents/:id/capacity','agentCapacity'];(function(_0x466608,_0x21f975){var _0x1968e9=function(_0x1c27c9){while(--_0x1c27c9){_0x466608['push'](_0x466608['shift']());}};_0x1968e9(++_0x21f975);}(_0x0ae7,0xae));var _0x70ae=function(_0x4ae625,_0xf396d0){_0x4ae625=_0x4ae625-0x0;var _0x31accf=_0x0ae7[_0x4ae625];return _0x31accf;};'use strict';var multer=require('multer');var util=require(_0x70ae('0x0'));var path=require(_0x70ae('0x1'));var express=require(_0x70ae('0x2'));var router=express[_0x70ae('0x3')]();var auth=require(_0x70ae('0x4'));var controller=require(_0x70ae('0x5'));router['get'](_0x70ae('0x6'),auth[_0x70ae('0x7')](),controller[_0x70ae('0x8')]);router['get'](_0x70ae('0x9'),auth[_0x70ae('0x7')](),controller[_0x70ae('0xa')]);router['get']('/voice/channels/:uniqueid/stopmixmonitor',auth['isAuthenticated'](),controller[_0x70ae('0xb')]);router[_0x70ae('0xc')]('/voice/queues',auth[_0x70ae('0x7')](),controller['voiceQueues']);router[_0x70ae('0xc')](_0x70ae('0xd'),auth['isAuthenticated'](),controller['chatQueues']);router['get']('/mail/queues',auth['isAuthenticated'](),controller[_0x70ae('0xe')]);router['get'](_0x70ae('0xf'),auth[_0x70ae('0x7')](),controller[_0x70ae('0x10')]);router[_0x70ae('0xc')]('/openchannel/queues',auth[_0x70ae('0x7')](),controller[_0x70ae('0x11')]);router[_0x70ae('0xc')](_0x70ae('0x12'),auth[_0x70ae('0x7')](),controller[_0x70ae('0x13')]);router[_0x70ae('0xc')](_0x70ae('0x14'),auth[_0x70ae('0x7')](),controller[_0x70ae('0x15')]);router[_0x70ae('0xc')](_0x70ae('0x16'),auth[_0x70ae('0x7')](),controller['faxQueues']);router[_0x70ae('0xc')](_0x70ae('0x17'),auth[_0x70ae('0x7')](),controller[_0x70ae('0x18')]);router['get'](_0x70ae('0x19'),auth[_0x70ae('0x7')](),controller[_0x70ae('0x1a')]);router[_0x70ae('0xc')]('/voice/queues/channels/:uniqueid',auth[_0x70ae('0x7')](),controller['voiceQueuesChannel']);router[_0x70ae('0xc')](_0x70ae('0x1b'),auth[_0x70ae('0x7')](),controller['voiceQueuesChannelHangup']);router[_0x70ae('0xc')](_0x70ae('0x1c'),auth[_0x70ae('0x7')](),controller[_0x70ae('0x1d')]);router[_0x70ae('0xc')](_0x70ae('0x1e'),auth[_0x70ae('0x7')](),controller['showVoiceQueues']);router[_0x70ae('0x1f')](_0x70ae('0x1e'),auth[_0x70ae('0x7')](),controller[_0x70ae('0x20')]);router[_0x70ae('0xc')](_0x70ae('0x21'),auth[_0x70ae('0x7')](),controller[_0x70ae('0x22')]);router[_0x70ae('0xc')]('/outbound/channels',auth[_0x70ae('0x7')](),controller[_0x70ae('0x23')]);router[_0x70ae('0xc')](_0x70ae('0x24'),auth['isAuthenticated'](),controller['agents']);router['put'](_0x70ae('0x25'),auth[_0x70ae('0x7')](),controller[_0x70ae('0x26')]);router[_0x70ae('0xc')](_0x70ae('0x27'),auth[_0x70ae('0x7')](),controller['telephones']);router[_0x70ae('0xc')](_0x70ae('0x28'),auth[_0x70ae('0x7')](),controller['trunks']);router[_0x70ae('0xc')]('/campaigns',auth['isAuthenticated'](),controller[_0x70ae('0x29')]);router[_0x70ae('0xc')]('/fax/accounts',auth[_0x70ae('0x7')](),controller['faxAccounts']);router[_0x70ae('0xc')]('/chat/queues/waitinginteractions',auth[_0x70ae('0x7')](),controller[_0x70ae('0x2a')]);router['get'](_0x70ae('0x2b'),auth[_0x70ae('0x7')](),controller[_0x70ae('0x2c')]);router[_0x70ae('0xc')](_0x70ae('0x2d'),auth['isAuthenticated'](),controller[_0x70ae('0x2e')]);router['get']('/openchannel/queues/:id/waitinginteractions',auth[_0x70ae('0x7')](),controller[_0x70ae('0x2f')]);router[_0x70ae('0xc')]('/sms/queues/waitinginteractions',auth[_0x70ae('0x7')](),controller[_0x70ae('0x30')]);router[_0x70ae('0xc')](_0x70ae('0x31'),auth[_0x70ae('0x7')](),controller[_0x70ae('0x32')]);router[_0x70ae('0xc')]('/fax/queues/waitinginteractions',auth[_0x70ae('0x7')](),controller['faxQueuesWaitingInteractions']);router['post'](_0x70ae('0x33'),auth[_0x70ae('0x7')](),controller[_0x70ae('0x34')](_0x70ae('0x35')));router[_0x70ae('0xc')]('/mail/queues/:id',auth[_0x70ae('0x7')](),controller[_0x70ae('0x36')]);router[_0x70ae('0x37')](_0x70ae('0x38'),auth[_0x70ae('0x7')](),controller[_0x70ae('0x34')]('chat'));router[_0x70ae('0xc')](_0x70ae('0x39'),auth['isAuthenticated'](),controller[_0x70ae('0x3a')]);router[_0x70ae('0x37')](_0x70ae('0x3b'),auth['isAuthenticated'](),controller[_0x70ae('0x34')]('fax'));router[_0x70ae('0xc')](_0x70ae('0x3c'),auth['isAuthenticated'](),controller[_0x70ae('0x3d')]);router[_0x70ae('0x37')]('/openchannel/queues/:id/notify',auth[_0x70ae('0x7')](),controller[_0x70ae('0x34')]('openchannel'));router[_0x70ae('0xc')]('/openchannel/queues/:id',auth[_0x70ae('0x7')](),controller['showOpenchannelQueues']);router['post'](_0x70ae('0x3e'),auth[_0x70ae('0x7')](),controller[_0x70ae('0x34')](_0x70ae('0x3f')));router['post'](_0x70ae('0x40'),auth[_0x70ae('0x7')](),controller[_0x70ae('0x34')](_0x70ae('0x41')));router[_0x70ae('0xc')]('/sms/queues/:id',auth[_0x70ae('0x7')](),controller[_0x70ae('0x42')]);router['get']('/whatsapp/queues/:id',auth['isAuthenticated'](),controller[_0x70ae('0x43')]);router[_0x70ae('0x37')](_0x70ae('0x44'),auth[_0x70ae('0x7')](),controller[_0x70ae('0x45')]);module[_0x70ae('0x46')]=router; \ No newline at end of file +var _0xd247=['/voice/queues/preview/:id','voiceQueuesPreview','/voice/queues/channels','voiceQueuesChannels','/voice/queues/channels/:uniqueid','voiceQueuesChannel','showVoiceQueues','put','/voice/queues/:id','updateVoiceQueue','/outbound','outbound','agentCapacity','/telephones','telephones','trunks','/campaigns','campaigns','/fax/accounts','faxAccounts','/chat/queues/waitinginteractions','chatQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','/openchannel/queues/:id/waitinginteractions','openchannelQueuesIdWaitingInteractions','/sms/queues/waitinginteractions','/whatsapp/queues/waitinginteractions','whatsappQueuesWaitingInteractions','/fax/queues/waitinginteractions','faxQueuesWaitingInteractions','post','/mail/queues/:id/notify','queueNotify','mail','showMailQueues','/chat/queues/:id/notify','/chat/queues/:id','showChatQueues','fax','/fax/queues/:id','/openchannel/queues/:id/notify','openchannel','/openchannel/queues/:id','/sms/queues/:id/notify','/whatsapp/queues/:id/notify','whatsapp','showSmsQueues','showWhatsappQueues','/agents/:id/notify','agentNotify','exports','multer','path','express','Router','../../components/auth/service','./rpc.controller','get','voiceChannels','/voice/channels/:uniqueid/mixmonitor','isAuthenticated','/voice/channels/:uniqueid/stopmixmonitor','voiceChannelStopMixMonitor','chatQueues','/mail/accounts','mailAccounts','/openchannel/queues','openchannelQueues','/sms/queues','smsQueues','/whatsapp/queues','/fax/queues','faxQueues'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xd247,0x10e));var _0x7d24=function(_0x477fdb,_0x462b55){_0x477fdb=_0x477fdb-0x0;var _0x32beaf=_0xd247[_0x477fdb];return _0x32beaf;};'use strict';var multer=require(_0x7d24('0x0'));var util=require('util');var path=require(_0x7d24('0x1'));var express=require(_0x7d24('0x2'));var router=express[_0x7d24('0x3')]();var auth=require(_0x7d24('0x4'));var controller=require(_0x7d24('0x5'));router[_0x7d24('0x6')]('/voice/channels',auth['isAuthenticated'](),controller[_0x7d24('0x7')]);router[_0x7d24('0x6')](_0x7d24('0x8'),auth[_0x7d24('0x9')](),controller['voiceChannelMixMonitor']);router['get'](_0x7d24('0xa'),auth[_0x7d24('0x9')](),controller[_0x7d24('0xb')]);router[_0x7d24('0x6')]('/voice/queues',auth[_0x7d24('0x9')](),controller['voiceQueues']);router['get']('/chat/queues',auth['isAuthenticated'](),controller[_0x7d24('0xc')]);router['get']('/mail/queues',auth['isAuthenticated'](),controller['mailQueues']);router[_0x7d24('0x6')](_0x7d24('0xd'),auth[_0x7d24('0x9')](),controller[_0x7d24('0xe')]);router[_0x7d24('0x6')](_0x7d24('0xf'),auth[_0x7d24('0x9')](),controller[_0x7d24('0x10')]);router[_0x7d24('0x6')](_0x7d24('0x11'),auth[_0x7d24('0x9')](),controller[_0x7d24('0x12')]);router[_0x7d24('0x6')](_0x7d24('0x13'),auth[_0x7d24('0x9')](),controller['whatsappQueues']);router[_0x7d24('0x6')](_0x7d24('0x14'),auth[_0x7d24('0x9')](),controller[_0x7d24('0x15')]);router[_0x7d24('0x6')](_0x7d24('0x16'),auth[_0x7d24('0x9')](),controller[_0x7d24('0x17')]);router[_0x7d24('0x6')](_0x7d24('0x18'),auth[_0x7d24('0x9')](),controller[_0x7d24('0x19')]);router['get'](_0x7d24('0x1a'),auth[_0x7d24('0x9')](),controller[_0x7d24('0x1b')]);router['get']('/voice/queues/channels/:uniqueid/hangup',auth[_0x7d24('0x9')](),controller['voiceQueuesChannelHangup']);router[_0x7d24('0x6')]('/voice/queues/channels/:uniqueid/redirect/:exten',auth[_0x7d24('0x9')](),controller['voiceQueuesChannelRedirect']);router[_0x7d24('0x6')]('/voice/queues/:id',auth[_0x7d24('0x9')](),controller[_0x7d24('0x1c')]);router[_0x7d24('0x1d')](_0x7d24('0x1e'),auth[_0x7d24('0x9')](),controller[_0x7d24('0x1f')]);router[_0x7d24('0x6')](_0x7d24('0x20'),auth[_0x7d24('0x9')](),controller[_0x7d24('0x21')]);router[_0x7d24('0x6')]('/outbound/channels',auth[_0x7d24('0x9')](),controller['outboundChannels']);router[_0x7d24('0x6')]('/agents',auth['isAuthenticated'](),controller['agents']);router[_0x7d24('0x1d')]('/agents/:id/capacity',auth[_0x7d24('0x9')](),controller[_0x7d24('0x22')]);router['get'](_0x7d24('0x23'),auth[_0x7d24('0x9')](),controller[_0x7d24('0x24')]);router[_0x7d24('0x6')]('/trunks',auth[_0x7d24('0x9')](),controller[_0x7d24('0x25')]);router[_0x7d24('0x6')](_0x7d24('0x26'),auth['isAuthenticated'](),controller[_0x7d24('0x27')]);router[_0x7d24('0x6')](_0x7d24('0x28'),auth[_0x7d24('0x9')](),controller[_0x7d24('0x29')]);router[_0x7d24('0x6')](_0x7d24('0x2a'),auth[_0x7d24('0x9')](),controller[_0x7d24('0x2b')]);router[_0x7d24('0x6')]('/mail/queues/waitinginteractions',auth[_0x7d24('0x9')](),controller['mailQueuesWaitingInteractions']);router[_0x7d24('0x6')]('/openchannel/queues/waitinginteractions',auth[_0x7d24('0x9')](),controller[_0x7d24('0x2c')]);router[_0x7d24('0x6')](_0x7d24('0x2d'),auth[_0x7d24('0x9')](),controller[_0x7d24('0x2e')]);router['get'](_0x7d24('0x2f'),auth[_0x7d24('0x9')](),controller['smsQueuesWaitingInteractions']);router[_0x7d24('0x6')](_0x7d24('0x30'),auth[_0x7d24('0x9')](),controller[_0x7d24('0x31')]);router['get'](_0x7d24('0x32'),auth[_0x7d24('0x9')](),controller[_0x7d24('0x33')]);router[_0x7d24('0x34')](_0x7d24('0x35'),auth['isAuthenticated'](),controller[_0x7d24('0x36')](_0x7d24('0x37')));router[_0x7d24('0x6')]('/mail/queues/:id',auth[_0x7d24('0x9')](),controller[_0x7d24('0x38')]);router[_0x7d24('0x34')](_0x7d24('0x39'),auth[_0x7d24('0x9')](),controller['queueNotify']('chat'));router['get'](_0x7d24('0x3a'),auth[_0x7d24('0x9')](),controller[_0x7d24('0x3b')]);router['post']('/fax/queues/:id/notify',auth[_0x7d24('0x9')](),controller['queueNotify'](_0x7d24('0x3c')));router[_0x7d24('0x6')](_0x7d24('0x3d'),auth[_0x7d24('0x9')](),controller['showFaxQueues']);router['post'](_0x7d24('0x3e'),auth[_0x7d24('0x9')](),controller[_0x7d24('0x36')](_0x7d24('0x3f')));router[_0x7d24('0x6')](_0x7d24('0x40'),auth[_0x7d24('0x9')](),controller['showOpenchannelQueues']);router['post'](_0x7d24('0x41'),auth['isAuthenticated'](),controller[_0x7d24('0x36')]('sms'));router[_0x7d24('0x34')](_0x7d24('0x42'),auth[_0x7d24('0x9')](),controller['queueNotify'](_0x7d24('0x43')));router[_0x7d24('0x6')]('/sms/queues/:id',auth[_0x7d24('0x9')](),controller[_0x7d24('0x44')]);router['get']('/whatsapp/queues/:id',auth[_0x7d24('0x9')](),controller[_0x7d24('0x45')]);router[_0x7d24('0x34')](_0x7d24('0x46'),auth[_0x7d24('0x9')](),controller[_0x7d24('0x47')]);module[_0x7d24('0x48')]=router; \ No newline at end of file diff --git a/server/api/rpc/rpc.controller.js b/server/api/rpc/rpc.controller.js index afda156..e042ebd 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 _0xbe83=['mailQueuesWaitingInteractions','MailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','type','filter','value','indexOf','queue_id','whatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','queueNotify','Website','Queue','findOne','\x20Queue\x20not\x20found','Message','messageId','Interaction','Account','\x20Message\x20not\x20found','queue','MessageId','InteractionId','From','QueueId','TransferReport','Start','agentNotify','channel','capitalize','User','update','create','agentTransferTimeout','*,*,*,*','moment','util','../../mysqldb','jayson/promise','client','http','request','then','error','code','message','result','catch','status','stack','name','isNil','rows','find','voiceChannels','VoiceChannels','voiceChannelMixMonitor','VoiceChannelMixMonitor','merge','query','params','voiceChannelStopMixMonitor','VoiceChannelStopMixMonitor','voiceQueues','VoiceQueues','showVoiceQueues','updateVoiceQueue','UpdateVoiceQueue','voiceQueuesPreview','VoiceQueuesPreview','VoiceQueuesChannels','voiceQueuesChannel','VoiceQueuesChannel','voiceQueuesChannelHangup','VoiceQueuesChannelHangup','voiceQueuesChannelRedirect','VoiceQueuesChannelRedirect','outbound','Outbound','agents','Agents','agentCapacity','body','user','interaction','hasOwnProperty','MemberReport','findAll','INTERACTION','length','format','YYYY-MM-DD\x20HH:mm:ss','interface','SIP/%s','agent','internal','AgentCapacity','telephones','Telephones','campaigns','Campaigns','chatQueues','ChatQueues','mailQueues','MailQueues','showMailQueues','mailAccounts','MailAccounts','openchannelQueues','OpenchannelQueues','showOpenchannelQueues','smsQueues','SmsQueues','showSmsQueues','whatsappQueues','faxQueues','FaxQueues','showFaxQueues','faxAccounts','chatQueuesWaitingInteractions'];(function(_0x430285,_0x4c8e7c){var _0x3e9815=function(_0x4ec7c6){while(--_0x4ec7c6){_0x430285['push'](_0x430285['shift']());}};_0x3e9815(++_0x4c8e7c);}(_0xbe83,0x9d));var _0x3be8=function(_0x93e603,_0x1e82cc){_0x93e603=_0x93e603-0x0;var _0xf003fa=_0xbe83[_0x93e603];return _0xf003fa;};'use strict';var BPromise=require('bluebird');var moment=require(_0x3be8('0x0'));var _=require('lodash');var util=require(_0x3be8('0x1'));var db=require(_0x3be8('0x2'))['db'];var logger=require('../../config/logger')('api');var jayson=require(_0x3be8('0x3'));var amiClient=jayson[_0x3be8('0x4')][_0x3be8('0x5')]({'port':0x232a});var mailClient=jayson[_0x3be8('0x4')]['http']({'port':0x232b});var routingClient=jayson['client'][_0x3be8('0x5')]({'port':0x232c});function respondWithRpcPromise(_0x319450,_0x13314f,_0x26fbc5){return new BPromise(function(_0x4f9c9e,_0x274ca7){var _0x485d62=_0x26fbc5?_0x26fbc5:amiClient;return _0x485d62[_0x3be8('0x6')](_0x319450,_0x13314f)[_0x3be8('0x7')](function(_0x3c2ee6){if(_0x3c2ee6[_0x3be8('0x8')]){if(_0x3c2ee6[_0x3be8('0x8')][_0x3be8('0x9')]===0x1f4){return _0x274ca7(_0x3c2ee6[_0x3be8('0x8')]['message']);}return _0x4f9c9e(_0x3c2ee6['error'][_0x3be8('0xa')]);}else{_0x4f9c9e(_0x3c2ee6[_0x3be8('0xb')]);}})[_0x3be8('0xc')](function(_0x1128c5){_0x274ca7(_0x1128c5);});});}function respondWithResult(_0x2d4a57,_0x3fa7ba){_0x3fa7ba=_0x3fa7ba||0xc8;return function(_0x12619b){if(_0x12619b){return _0x2d4a57[_0x3be8('0xd')](_0x3fa7ba)['json'](_0x12619b);}return _0x2d4a57['sendStatus'](0x194);};}function handleError(_0xa2b3d1,_0x30aff3){_0x30aff3=_0x30aff3||0x1f4;return function(_0x5cf10e){logger[_0x3be8('0x8')](_0x5cf10e[_0x3be8('0xe')]);if(_0x5cf10e[_0x3be8('0xf')]){delete _0x5cf10e[_0x3be8('0xf')];}_0xa2b3d1[_0x3be8('0xd')](_0x30aff3)['send'](_0x5cf10e);};}function findById(_0x1e13be){return function(_0x491bc6){if(!_[_0x3be8('0x10')](_0x1e13be)&&!_[_0x3be8('0x10')](_0x491bc6)&&!_[_0x3be8('0x10')](_0x491bc6[_0x3be8('0x11')])){return _[_0x3be8('0x12')](_0x491bc6[_0x3be8('0x11')],function(_0x4e37f1){return _0x4e37f1['id']==_0x1e13be;});}return null;};}exports[_0x3be8('0x13')]=function(_0x2ca941,_0x5ed188){return respondWithRpcPromise(_0x3be8('0x14'),_0x2ca941['query'])[_0x3be8('0x7')](respondWithResult(_0x5ed188,null))['catch'](handleError(_0x5ed188,null));};exports[_0x3be8('0x15')]=function(_0x3cdca9,_0x4d7722){return respondWithRpcPromise(_0x3be8('0x16'),_[_0x3be8('0x17')](_0x3cdca9[_0x3be8('0x18')],_0x3cdca9[_0x3be8('0x19')]))[_0x3be8('0x7')](respondWithResult(_0x4d7722,null))['catch'](handleError(_0x4d7722,null));};exports[_0x3be8('0x1a')]=function(_0x3a4de0,_0x490172){return respondWithRpcPromise(_0x3be8('0x1b'),_['merge'](_0x3a4de0[_0x3be8('0x18')],_0x3a4de0[_0x3be8('0x19')]))[_0x3be8('0x7')](respondWithResult(_0x490172,null))[_0x3be8('0xc')](handleError(_0x490172,null));};exports[_0x3be8('0x1c')]=function(_0x2bd552,_0x2f0695){return respondWithRpcPromise(_0x3be8('0x1d'),_0x2bd552[_0x3be8('0x18')])['then'](respondWithResult(_0x2f0695,null))[_0x3be8('0xc')](handleError(_0x2f0695,null));};exports[_0x3be8('0x1e')]=function(_0x475b76,_0x4f86f6){return respondWithRpcPromise(_0x3be8('0x1d'),_0x475b76[_0x3be8('0x18')])[_0x3be8('0x7')](findById(_0x475b76['params']['id']))[_0x3be8('0x7')](respondWithResult(_0x4f86f6,null))[_0x3be8('0xc')](handleError(_0x4f86f6,null));};exports[_0x3be8('0x1f')]=function(_0x56e265,_0x547730){return respondWithRpcPromise(_0x3be8('0x20'),_[_0x3be8('0x17')](_0x56e265['body'],_0x56e265[_0x3be8('0x19')]))[_0x3be8('0x7')](respondWithResult(_0x547730,null))[_0x3be8('0xc')](handleError(_0x547730,null));};exports[_0x3be8('0x21')]=function(_0x6d7640,_0x3a1bea){return respondWithRpcPromise(_0x3be8('0x22'),_[_0x3be8('0x17')](_0x6d7640[_0x3be8('0x18')],_0x6d7640[_0x3be8('0x19')]))[_0x3be8('0x7')](respondWithResult(_0x3a1bea,null))['catch'](handleError(_0x3a1bea,null));};exports['voiceQueuesChannels']=function(_0x3e1a7d,_0x5f5ed4){return respondWithRpcPromise(_0x3be8('0x23'),_0x3e1a7d[_0x3be8('0x18')])[_0x3be8('0x7')](respondWithResult(_0x5f5ed4,null))[_0x3be8('0xc')](handleError(_0x5f5ed4,null));};exports[_0x3be8('0x24')]=function(_0x578c64,_0x58364a){return respondWithRpcPromise(_0x3be8('0x25'),_['merge'](_0x578c64[_0x3be8('0x18')],_0x578c64[_0x3be8('0x19')]))[_0x3be8('0x7')](respondWithResult(_0x58364a,null))[_0x3be8('0xc')](handleError(_0x58364a,null));};exports[_0x3be8('0x26')]=function(_0x1063bf,_0x3643e6){return respondWithRpcPromise(_0x3be8('0x27'),_[_0x3be8('0x17')](_0x1063bf['query'],_0x1063bf[_0x3be8('0x19')]))[_0x3be8('0x7')](respondWithResult(_0x3643e6,null))[_0x3be8('0xc')](handleError(_0x3643e6,null));};exports[_0x3be8('0x28')]=function(_0x433990,_0x5c6b2a){return respondWithRpcPromise(_0x3be8('0x29'),_[_0x3be8('0x17')](_0x433990['query'],_0x433990[_0x3be8('0x19')]))[_0x3be8('0x7')](respondWithResult(_0x5c6b2a,null))['catch'](handleError(_0x5c6b2a,null));};exports[_0x3be8('0x2a')]=function(_0x54f204,_0x977bf7){return respondWithRpcPromise(_0x3be8('0x2b'),_0x54f204['query'])[_0x3be8('0x7')](respondWithResult(_0x977bf7,null))['catch'](handleError(_0x977bf7,null));};exports['outboundChannels']=function(_0x24734c,_0x3f15e2){return respondWithRpcPromise('OutboundChannels',_0x24734c[_0x3be8('0x18')])[_0x3be8('0x7')](respondWithResult(_0x3f15e2,null))[_0x3be8('0xc')](handleError(_0x3f15e2,null));};exports[_0x3be8('0x2c')]=function(_0x4b302e,_0x2ec49b){var _0x2e068d;return respondWithRpcPromise(_0x3be8('0x2d'),_0x4b302e[_0x3be8('0x18')])['then'](function(_0x528b16){_0x2e068d=_0x528b16;return respondWithRpcPromise(_0x3be8('0x2d'),_0x4b302e[_0x3be8('0x18')],routingClient);})[_0x3be8('0x7')](function(_0xe323f2){return _[_0x3be8('0x17')]({},_0xe323f2,_0x2e068d);})[_0x3be8('0x7')](respondWithResult(_0x2ec49b,null))[_0x3be8('0xc')](handleError(_0x2ec49b,null));};exports[_0x3be8('0x2e')]=function(_0x34596b,_0x3f1d8d){if(_0x34596b[_0x3be8('0x2f')]&&_0x34596b[_0x3be8('0x2f')]['interaction']&&_0x34596b['user']&&_0x34596b[_0x3be8('0x30')][_0x3be8('0xf')]){for(var _0x227ad8 in _0x34596b[_0x3be8('0x2f')][_0x3be8('0x31')]){if(_0x34596b[_0x3be8('0x2f')][_0x3be8('0x31')][_0x3be8('0x32')](_0x227ad8)){db[_0x3be8('0x33')][_0x3be8('0x34')]({'where':{'channel':_0x227ad8,'membername':_0x34596b[_0x3be8('0x30')][_0x3be8('0xf')],'type':_0x3be8('0x35'),'exitAt':null,'uniqueid':_0x34596b[_0x3be8('0x2f')]['interaction'][_0x227ad8]&&_0x34596b[_0x3be8('0x2f')][_0x3be8('0x31')][_0x227ad8][_0x3be8('0x36')]?{'$notIn':_0x34596b[_0x3be8('0x2f')][_0x3be8('0x31')][_0x227ad8]}:{'$ne':null}}})[_0x3be8('0x7')](function(_0x918bb0){var _0x17a77b=moment()[_0x3be8('0x37')](_0x3be8('0x38'));for(var _0x1d4c98=0x0,_0x3536e2=_0x918bb0[_0x3be8('0x36')];_0x1d4c98<_0x3536e2;_0x1d4c98+=0x1){_0x918bb0[_0x1d4c98]['updateAttributes']({'exitAt':_0x17a77b});}});for(var _0x192ad9=0x0;_0x192ad9<_0x34596b['body'][_0x3be8('0x31')][_0x227ad8][_0x3be8('0x36')];_0x192ad9+=0x1){db[_0x3be8('0x33')]['findOrCreate']({'where':{'channel':_0x227ad8,'membername':_0x34596b[_0x3be8('0x30')][_0x3be8('0xf')],'type':'INTERACTION','uniqueid':_0x34596b[_0x3be8('0x2f')][_0x3be8('0x31')][_0x227ad8][_0x192ad9],'exitAt':null},'defaults':{'channel':_0x227ad8,'membername':_0x34596b[_0x3be8('0x30')][_0x3be8('0xf')],'interface':_['isNil'](_0x34596b[_0x3be8('0x30')][_0x3be8('0x39')])?util[_0x3be8('0x37')](_0x3be8('0x3a'),_0x34596b['user'][_0x3be8('0xf')]):_0x34596b['user']['interface'],'type':_0x3be8('0x35'),'enterAt':moment()[_0x3be8('0x37')]('YYYY-MM-DD\x20HH:mm:ss'),'role':_0x3be8('0x3b'),'internal':_0x34596b[_0x3be8('0x30')][_0x3be8('0x3c')],'uniqueid':_0x34596b['body']['interaction'][_0x227ad8][_0x192ad9]}});}}}}return respondWithRpcPromise(_0x3be8('0x3d'),{'id':_0x34596b[_0x3be8('0x19')]['id'],'capacity':_0x34596b[_0x3be8('0x2f')]['capacity']},routingClient)['then'](respondWithResult(_0x3f1d8d,null))[_0x3be8('0xc')](handleError(_0x3f1d8d,null));};exports[_0x3be8('0x3e')]=function(_0x166105,_0x2dbce5){return respondWithRpcPromise(_0x3be8('0x3f'),_0x166105[_0x3be8('0x18')])[_0x3be8('0x7')](respondWithResult(_0x2dbce5,null))[_0x3be8('0xc')](handleError(_0x2dbce5,null));};exports['trunks']=function(_0x3fb422,_0x26fb7c){return respondWithRpcPromise('Trunks',_0x3fb422[_0x3be8('0x18')])[_0x3be8('0x7')](respondWithResult(_0x26fb7c,null))['catch'](handleError(_0x26fb7c,null));};exports[_0x3be8('0x40')]=function(_0x189f6e,_0x3e566b){return respondWithRpcPromise(_0x3be8('0x41'),_0x189f6e[_0x3be8('0x18')])['then'](respondWithResult(_0x3e566b,null))['catch'](handleError(_0x3e566b,null));};exports[_0x3be8('0x42')]=function(_0xac07c4,_0x17774f){return respondWithRpcPromise('ChatQueues',_0xac07c4[_0x3be8('0x18')],routingClient)[_0x3be8('0x7')](respondWithResult(_0x17774f,null))['catch'](handleError(_0x17774f,null));};exports['showChatQueues']=function(_0x5891e5,_0x1d0b23){return respondWithRpcPromise(_0x3be8('0x43'),_0x5891e5[_0x3be8('0x18')],routingClient)[_0x3be8('0x7')](findById(_0x5891e5[_0x3be8('0x19')]['id']))[_0x3be8('0x7')](respondWithResult(_0x1d0b23,null))[_0x3be8('0xc')](handleError(_0x1d0b23,null));};exports[_0x3be8('0x44')]=function(_0x2aa3e5,_0x75df74){return respondWithRpcPromise(_0x3be8('0x45'),_0x2aa3e5[_0x3be8('0x18')],routingClient)['then'](respondWithResult(_0x75df74,null))[_0x3be8('0xc')](handleError(_0x75df74,null));};exports[_0x3be8('0x46')]=function(_0x4ce5d2,_0x4c4c6b){return respondWithRpcPromise(_0x3be8('0x45'),_0x4ce5d2['query'],routingClient)[_0x3be8('0x7')](findById(_0x4ce5d2['params']['id']))['then'](respondWithResult(_0x4c4c6b,null))[_0x3be8('0xc')](handleError(_0x4c4c6b,null));};exports[_0x3be8('0x47')]=function(_0x95047d,_0x4e7f38){return respondWithRpcPromise(_0x3be8('0x48'),_0x95047d[_0x3be8('0x18')],mailClient)[_0x3be8('0x7')](respondWithResult(_0x4e7f38,null))['catch'](handleError(_0x4e7f38,null));};exports[_0x3be8('0x49')]=function(_0x2a8e32,_0x56306e){return respondWithRpcPromise(_0x3be8('0x4a'),_0x2a8e32[_0x3be8('0x18')],routingClient)[_0x3be8('0x7')](respondWithResult(_0x56306e,null))[_0x3be8('0xc')](handleError(_0x56306e,null));};exports[_0x3be8('0x4b')]=function(_0xac228c,_0x5131f7){return respondWithRpcPromise(_0x3be8('0x4a'),_0xac228c[_0x3be8('0x18')],routingClient)[_0x3be8('0x7')](findById(_0xac228c[_0x3be8('0x19')]['id']))[_0x3be8('0x7')](respondWithResult(_0x5131f7,null))[_0x3be8('0xc')](handleError(_0x5131f7,null));};exports[_0x3be8('0x4c')]=function(_0x21beda,_0x2e1123){return respondWithRpcPromise(_0x3be8('0x4d'),_0x21beda['query'],routingClient)[_0x3be8('0x7')](respondWithResult(_0x2e1123,null))[_0x3be8('0xc')](handleError(_0x2e1123,null));};exports[_0x3be8('0x4e')]=function(_0x156b39,_0x28eef5){return respondWithRpcPromise(_0x3be8('0x4d'),_0x156b39[_0x3be8('0x18')],routingClient)[_0x3be8('0x7')](findById(_0x156b39[_0x3be8('0x19')]['id']))['then'](respondWithResult(_0x28eef5,null))[_0x3be8('0xc')](handleError(_0x28eef5,null));};exports[_0x3be8('0x4f')]=function(_0x1e3615,_0x1c6918){return respondWithRpcPromise('WhatsappQueues',_0x1e3615[_0x3be8('0x18')],routingClient)[_0x3be8('0x7')](respondWithResult(_0x1c6918,null))['catch'](handleError(_0x1c6918,null));};exports['showWhatsappQueues']=function(_0x49543c,_0x6cc1e9){return respondWithRpcPromise('WhatsappQueues',_0x49543c['query'],routingClient)[_0x3be8('0x7')](findById(_0x49543c['params']['id']))[_0x3be8('0x7')](respondWithResult(_0x6cc1e9,null))[_0x3be8('0xc')](handleError(_0x6cc1e9,null));};exports[_0x3be8('0x50')]=function(_0x467ae8,_0x1de928){return respondWithRpcPromise(_0x3be8('0x51'),_0x467ae8[_0x3be8('0x18')],routingClient)[_0x3be8('0x7')](respondWithResult(_0x1de928,null))['catch'](handleError(_0x1de928,null));};exports[_0x3be8('0x52')]=function(_0x3b7feb,_0x28b08c){return respondWithRpcPromise(_0x3be8('0x51'),_0x3b7feb[_0x3be8('0x18')],routingClient)[_0x3be8('0x7')](findById(_0x3b7feb[_0x3be8('0x19')]['id']))['then'](respondWithResult(_0x28b08c,null))[_0x3be8('0xc')](handleError(_0x28b08c,null));};exports[_0x3be8('0x53')]=function(_0x248ed1,_0xb6c547){return respondWithRpcPromise('FaxAccounts',_0x248ed1[_0x3be8('0x18')])[_0x3be8('0x7')](respondWithResult(_0xb6c547,null))['catch'](handleError(_0xb6c547,null));};exports[_0x3be8('0x54')]=function(_0x13e125,_0x5672a7){return respondWithRpcPromise('ChatQueuesWaitingInteractions',_0x13e125[_0x3be8('0x18')],routingClient)[_0x3be8('0x7')](respondWithResult(_0x5672a7,null))['catch'](handleError(_0x5672a7,null));};exports[_0x3be8('0x55')]=function(_0x46a18e,_0x32f301){return respondWithRpcPromise(_0x3be8('0x56'),_0x46a18e[_0x3be8('0x18')],routingClient)['then'](respondWithResult(_0x32f301,null))[_0x3be8('0xc')](handleError(_0x32f301,null));};exports[_0x3be8('0x57')]=function(_0x5eddae,_0x9f6c7b){return respondWithRpcPromise(_0x3be8('0x58'),_0x5eddae[_0x3be8('0x18')],routingClient)[_0x3be8('0x7')](respondWithResult(_0x9f6c7b,null))[_0x3be8('0xc')](handleError(_0x9f6c7b,null));};exports['openchannelQueuesIdWaitingInteractions']=function(_0x54277b,_0x2941ee){return respondWithRpcPromise(_0x3be8('0x58'),_0x54277b[_0x3be8('0x18')],routingClient)[_0x3be8('0x7')](function(_0x40bb53){if(_0x54277b[_0x3be8('0x18')][_0x3be8('0x59')]!==undefined){var _0x1a81a7=_(_0x40bb53[_0x3be8('0x11')])[_0x3be8('0x5a')]([_0x54277b[_0x3be8('0x18')][_0x3be8('0x59')],_0x54277b['params']['id']])['map']('queue_id')['uniq']()[_0x3be8('0x5b')]();return _0x40bb53['rows'][_0x3be8('0x5a')](function(_0x560bd8){return _0x1a81a7[_0x3be8('0x5c')](_0x560bd8[_0x3be8('0x5d')])>-0x1;});}else{return _0x40bb53[_0x3be8('0x11')][_0x3be8('0x5a')](function(_0x26eb05){return _0x26eb05['queue_id']===parseInt(_0x54277b['params']['id']);});}})[_0x3be8('0x7')](respondWithResult(_0x2941ee,null))[_0x3be8('0xc')](handleError(_0x2941ee,null));};exports['smsQueuesWaitingInteractions']=function(_0x3eae63,_0x5d15ad){return respondWithRpcPromise('SmsQueuesWaitingInteractions',_0x3eae63[_0x3be8('0x18')],routingClient)['then'](respondWithResult(_0x5d15ad,null))['catch'](handleError(_0x5d15ad,null));};exports[_0x3be8('0x5e')]=function(_0x58ec9a,_0x4c4c63){return respondWithRpcPromise('WhatsappQueuesWaitingInteractions',_0x58ec9a['query'],routingClient)[_0x3be8('0x7')](respondWithResult(_0x4c4c63,null))[_0x3be8('0xc')](handleError(_0x4c4c63,null));};exports[_0x3be8('0x5f')]=function(_0x21dba3,_0x28a059){return respondWithRpcPromise('FaxQueuesWaitingInteractions',_0x21dba3[_0x3be8('0x18')],routingClient)['then'](respondWithResult(_0x28a059,null))[_0x3be8('0xc')](handleError(_0x28a059,null));};exports[_0x3be8('0x60')]=function(_0x1090fa){return function(_0x324c29,_0x4c9c12){var _0x4444cf,_0x2c99bb;var _0x2c4e5d=_['capitalize'](_0x1090fa);var _0x5366ed=_0x1090fa==='chat'?_0x3be8('0x61'):'Account';return db[_0x2c4e5d+_0x3be8('0x62')][_0x3be8('0x63')]({'raw':!![],'where':{'id':_0x324c29['params']['id']}})[_0x3be8('0x7')](function(_0x56eb40){if(_[_0x3be8('0x10')](_0x56eb40)){throw new Error(_0x2c4e5d+_0x3be8('0x64'));}_0x4444cf=_0x56eb40;return db[_0x2c4e5d+_0x3be8('0x65')][_0x3be8('0x63')]({'where':{'id':_0x324c29[_0x3be8('0x2f')][_0x3be8('0x66')]},'include':[{'model':db[_0x2c4e5d+_0x3be8('0x67')],'as':'Interaction'},{'model':db[_0x2c4e5d+_0x5366ed],'as':_0x3be8('0x68')}]});})[_0x3be8('0x7')](function(_0x2d856c){if(_[_0x3be8('0x10')](_0x2d856c)){throw new Error(_0x2c4e5d+_0x3be8('0x69'));}_0x2c99bb=_0x2d856c;return _0x2d856c['update']({'read':0x0,'readAt':null,'UserId':null});})[_0x3be8('0x7')](function(){var _0x3e7f38={'uniqueid':_0x1090fa+'.'+_0x2c99bb['id']+'.'+_0x2c99bb['Interaction']['id'],'FromUserId':_0x324c29['user']['id'],'type':_0x3be8('0x6a')};_0x3e7f38[_0x2c4e5d+_0x3be8('0x6b')]=_0x2c99bb['id'];_0x3e7f38[_0x2c4e5d+_0x3be8('0x6c')]=_0x2c99bb[_0x3be8('0x67')]['id'];_0x3e7f38[_0x3be8('0x6d')+_0x2c4e5d+_0x5366ed+'Id']=_0x2c99bb[_0x3be8('0x68')]['id'];_0x3e7f38['To'+_0x2c4e5d+_0x3be8('0x6e')]=_0x4444cf['id'];return db[_0x2c4e5d+_0x3be8('0x6f')]['create'](_0x3e7f38);})[_0x3be8('0x7')](function(){return respondWithRpcPromise(_0x3be8('0x70'),{'channel':_0x1090fa,'interaction':_0x2c99bb[_0x3be8('0x67')],'message':_0x2c99bb,'account':_0x2c99bb[_0x3be8('0x68')],'applications':[{'id':0x0,'priority':0x1,'app':_0x3be8('0x6a'),'appdata':_0x4444cf[_0x3be8('0xf')]+','+(_0x2c99bb[_0x3be8('0x68')]['queueTransferTimeout']||0x12c),'interval':'*,*,*,*'}]},routingClient);})[_0x3be8('0x7')](respondWithResult(_0x4c9c12,null))[_0x3be8('0xc')](handleError(_0x4c9c12,null));};};exports[_0x3be8('0x71')]=function(_0x39d818,_0x349bf2){var _0x20ad0a,_0x333530;if(_[_0x3be8('0x10')](_0x39d818['body'][_0x3be8('0x72')])){throw new Error('Channel\x20field\x20is\x20mandatory');}var _0x14b065=_0x39d818['body'][_0x3be8('0x72')];var _0x5a3bce=_[_0x3be8('0x73')](_0x14b065);var _0x1455f=_0x14b065==='chat'?_0x3be8('0x61'):_0x3be8('0x68');return db[_0x3be8('0x74')][_0x3be8('0x63')]({'raw':!![],'where':{'id':_0x39d818[_0x3be8('0x19')]['id'],'role':_0x3be8('0x3b')}})[_0x3be8('0x7')](function(_0x2e2288){if(_['isNil'](_0x2e2288)){throw new Error('Agent\x20not\x20found');}_0x20ad0a=_0x2e2288;return db[_0x5a3bce+_0x3be8('0x65')][_0x3be8('0x63')]({'where':{'id':_0x39d818[_0x3be8('0x2f')]['messageId']},'include':[{'model':db[_0x5a3bce+_0x3be8('0x67')],'as':_0x3be8('0x67')},{'model':db[_0x5a3bce+_0x1455f],'as':_0x3be8('0x68')}]});})[_0x3be8('0x7')](function(_0x34c8dd){if(_[_0x3be8('0x10')](_0x34c8dd)){throw new Error(_0x5a3bce+_0x3be8('0x69'));}_0x333530=_0x34c8dd;return _0x34c8dd[_0x3be8('0x75')]({'read':0x0,'readAt':null,'UserId':null});})['then'](function(){var _0x4e398e={'uniqueid':_0x14b065+'.'+_0x333530['id']+'.'+_0x333530[_0x3be8('0x67')]['id'],'FromUserId':_0x39d818['user']['id'],'type':_0x3be8('0x3b'),'ToUserId':_0x20ad0a['id']};_0x4e398e[_0x5a3bce+_0x3be8('0x6b')]=_0x333530['id'];_0x4e398e[_0x5a3bce+_0x3be8('0x6c')]=_0x333530[_0x3be8('0x67')]['id'];_0x4e398e[_0x3be8('0x6d')+_0x5a3bce+_0x1455f+'Id']=_0x333530[_0x3be8('0x68')]['id'];return db[_0x5a3bce+_0x3be8('0x6f')][_0x3be8('0x76')](_0x4e398e);})[_0x3be8('0x7')](function(){return respondWithRpcPromise(_0x3be8('0x70'),{'channel':_0x14b065,'interaction':_0x333530[_0x3be8('0x67')],'message':_0x333530,'account':_0x333530[_0x3be8('0x68')],'applications':[{'id':0x0,'priority':0x1,'app':_0x3be8('0x3b'),'appdata':_0x20ad0a[_0x3be8('0xf')]+','+(_0x333530['Account'][_0x3be8('0x77')]||0x12c),'interval':_0x3be8('0x78')}]},routingClient);})[_0x3be8('0x7')](respondWithResult(_0x349bf2,null))[_0x3be8('0xc')](handleError(_0x349bf2,null));}; \ No newline at end of file +var _0xbaf0=['MailQueuesWaitingInteractions','openchannelQueuesIdWaitingInteractions','OpenchannelQueuesWaitingInteractions','type','filter','map','queue_id','value','indexOf','smsQueuesWaitingInteractions','WhatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','FaxQueuesWaitingInteractions','queueNotify','capitalize','chat','Queue','findOne','\x20Queue\x20not\x20found','Message','messageId','Interaction','Account','\x20Message\x20not\x20found','update','queue','From','QueueId','TransferReport','create','Start','queueTransferTimeout','*,*,*,*','agentNotify','channel','Channel\x20field\x20is\x20mandatory','Website','Agent\x20not\x20found','InteractionId','agentTransferTimeout','moment','lodash','util','../../mysqldb','../../config/logger','api','client','http','request','then','error','code','message','result','status','sendStatus','stack','name','isNil','rows','voiceChannels','VoiceChannels','catch','voiceChannelMixMonitor','VoiceChannelMixMonitor','merge','query','params','VoiceChannelStopMixMonitor','voiceQueues','VoiceQueues','showVoiceQueues','updateVoiceQueue','UpdateVoiceQueue','voiceQueuesPreview','VoiceQueuesPreview','voiceQueuesChannels','VoiceQueuesChannels','voiceQueuesChannel','voiceQueuesChannelHangup','VoiceQueuesChannelHangup','voiceQueuesChannelRedirect','VoiceQueuesChannelRedirect','Outbound','outboundChannels','OutboundChannels','agents','Agents','agentCapacity','body','interaction','user','hasOwnProperty','MemberReport','findAll','INTERACTION','length','format','YYYY-MM-DD\x20HH:mm:ss','updateAttributes','findOrCreate','interface','SIP/%s','agent','internal','AgentCapacity','capacity','telephones','Telephones','trunks','Campaigns','chatQueues','ChatQueues','showChatQueues','MailQueues','showMailQueues','mailAccounts','openchannelQueues','OpenchannelQueues','smsQueues','showSmsQueues','WhatsappQueues','showWhatsappQueues','faxQueues','showFaxQueues','FaxQueues','faxAccounts','FaxAccounts','mailQueuesWaitingInteractions'];(function(_0x410501,_0x3d953c){var _0x338ba3=function(_0xffc0b0){while(--_0xffc0b0){_0x410501['push'](_0x410501['shift']());}};_0x338ba3(++_0x3d953c);}(_0xbaf0,0x12a));var _0x0baf=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xbaf0[_0x501510];return _0x1e6ee5;};'use strict';var BPromise=require('bluebird');var moment=require(_0x0baf('0x0'));var _=require(_0x0baf('0x1'));var util=require(_0x0baf('0x2'));var db=require(_0x0baf('0x3'))['db'];var logger=require(_0x0baf('0x4'))(_0x0baf('0x5'));var jayson=require('jayson/promise');var amiClient=jayson[_0x0baf('0x6')][_0x0baf('0x7')]({'port':0x232a});var mailClient=jayson[_0x0baf('0x6')][_0x0baf('0x7')]({'port':0x232b});var routingClient=jayson[_0x0baf('0x6')][_0x0baf('0x7')]({'port':0x232c});function respondWithRpcPromise(_0x1a10b1,_0x2dcaac,_0x1d0a0d){return new BPromise(function(_0x5f5030,_0x11b947){var _0x5f20aa=_0x1d0a0d?_0x1d0a0d:amiClient;return _0x5f20aa[_0x0baf('0x8')](_0x1a10b1,_0x2dcaac)[_0x0baf('0x9')](function(_0x465528){if(_0x465528[_0x0baf('0xa')]){if(_0x465528[_0x0baf('0xa')][_0x0baf('0xb')]===0x1f4){return _0x11b947(_0x465528[_0x0baf('0xa')][_0x0baf('0xc')]);}return _0x5f5030(_0x465528[_0x0baf('0xa')][_0x0baf('0xc')]);}else{_0x5f5030(_0x465528[_0x0baf('0xd')]);}})['catch'](function(_0x5a53e2){_0x11b947(_0x5a53e2);});});}function respondWithResult(_0x465dd7,_0xe4378c){_0xe4378c=_0xe4378c||0xc8;return function(_0x5db689){if(_0x5db689){return _0x465dd7[_0x0baf('0xe')](_0xe4378c)['json'](_0x5db689);}return _0x465dd7[_0x0baf('0xf')](0x194);};}function handleError(_0x49e44b,_0x1c76a8){_0x1c76a8=_0x1c76a8||0x1f4;return function(_0x1f50c3){logger[_0x0baf('0xa')](_0x1f50c3[_0x0baf('0x10')]);if(_0x1f50c3[_0x0baf('0x11')]){delete _0x1f50c3[_0x0baf('0x11')];}_0x49e44b['status'](_0x1c76a8)['send'](_0x1f50c3);};}function findById(_0x2312c7){return function(_0x38395b){if(!_[_0x0baf('0x12')](_0x2312c7)&&!_[_0x0baf('0x12')](_0x38395b)&&!_[_0x0baf('0x12')](_0x38395b[_0x0baf('0x13')])){return _['find'](_0x38395b[_0x0baf('0x13')],function(_0xfbecec){return _0xfbecec['id']==_0x2312c7;});}return null;};}exports[_0x0baf('0x14')]=function(_0x3e9cb4,_0x47070d){return respondWithRpcPromise(_0x0baf('0x15'),_0x3e9cb4['query'])['then'](respondWithResult(_0x47070d,null))[_0x0baf('0x16')](handleError(_0x47070d,null));};exports[_0x0baf('0x17')]=function(_0x32e839,_0x1848e8){return respondWithRpcPromise(_0x0baf('0x18'),_[_0x0baf('0x19')](_0x32e839[_0x0baf('0x1a')],_0x32e839[_0x0baf('0x1b')]))[_0x0baf('0x9')](respondWithResult(_0x1848e8,null))[_0x0baf('0x16')](handleError(_0x1848e8,null));};exports['voiceChannelStopMixMonitor']=function(_0x334bd6,_0x482522){return respondWithRpcPromise(_0x0baf('0x1c'),_['merge'](_0x334bd6['query'],_0x334bd6[_0x0baf('0x1b')]))['then'](respondWithResult(_0x482522,null))['catch'](handleError(_0x482522,null));};exports[_0x0baf('0x1d')]=function(_0x27b59c,_0x34e264){return respondWithRpcPromise(_0x0baf('0x1e'),_0x27b59c[_0x0baf('0x1a')])['then'](respondWithResult(_0x34e264,null))[_0x0baf('0x16')](handleError(_0x34e264,null));};exports[_0x0baf('0x1f')]=function(_0x1ca35a,_0x366e71){return respondWithRpcPromise(_0x0baf('0x1e'),_0x1ca35a[_0x0baf('0x1a')])[_0x0baf('0x9')](findById(_0x1ca35a['params']['id']))[_0x0baf('0x9')](respondWithResult(_0x366e71,null))[_0x0baf('0x16')](handleError(_0x366e71,null));};exports[_0x0baf('0x20')]=function(_0x265915,_0x55c715){return respondWithRpcPromise(_0x0baf('0x21'),_[_0x0baf('0x19')](_0x265915['body'],_0x265915[_0x0baf('0x1b')]))[_0x0baf('0x9')](respondWithResult(_0x55c715,null))[_0x0baf('0x16')](handleError(_0x55c715,null));};exports[_0x0baf('0x22')]=function(_0xd14f0f,_0x366924){return respondWithRpcPromise(_0x0baf('0x23'),_['merge'](_0xd14f0f[_0x0baf('0x1a')],_0xd14f0f[_0x0baf('0x1b')]))[_0x0baf('0x9')](respondWithResult(_0x366924,null))[_0x0baf('0x16')](handleError(_0x366924,null));};exports[_0x0baf('0x24')]=function(_0x275ea1,_0x2fc983){return respondWithRpcPromise(_0x0baf('0x25'),_0x275ea1[_0x0baf('0x1a')])[_0x0baf('0x9')](respondWithResult(_0x2fc983,null))[_0x0baf('0x16')](handleError(_0x2fc983,null));};exports[_0x0baf('0x26')]=function(_0x45294a,_0x3a3353){return respondWithRpcPromise('VoiceQueuesChannel',_[_0x0baf('0x19')](_0x45294a['query'],_0x45294a[_0x0baf('0x1b')]))[_0x0baf('0x9')](respondWithResult(_0x3a3353,null))[_0x0baf('0x16')](handleError(_0x3a3353,null));};exports[_0x0baf('0x27')]=function(_0x5300a5,_0x1a2b03){return respondWithRpcPromise(_0x0baf('0x28'),_['merge'](_0x5300a5[_0x0baf('0x1a')],_0x5300a5[_0x0baf('0x1b')]))[_0x0baf('0x9')](respondWithResult(_0x1a2b03,null))[_0x0baf('0x16')](handleError(_0x1a2b03,null));};exports[_0x0baf('0x29')]=function(_0x1b0991,_0xe03d82){return respondWithRpcPromise(_0x0baf('0x2a'),_['merge'](_0x1b0991[_0x0baf('0x1a')],_0x1b0991[_0x0baf('0x1b')]))['then'](respondWithResult(_0xe03d82,null))[_0x0baf('0x16')](handleError(_0xe03d82,null));};exports['outbound']=function(_0x5c545f,_0x11bc49){return respondWithRpcPromise(_0x0baf('0x2b'),_0x5c545f['query'])['then'](respondWithResult(_0x11bc49,null))[_0x0baf('0x16')](handleError(_0x11bc49,null));};exports[_0x0baf('0x2c')]=function(_0x3412bc,_0xb2d9ab){return respondWithRpcPromise(_0x0baf('0x2d'),_0x3412bc[_0x0baf('0x1a')])[_0x0baf('0x9')](respondWithResult(_0xb2d9ab,null))[_0x0baf('0x16')](handleError(_0xb2d9ab,null));};exports[_0x0baf('0x2e')]=function(_0x36c6d2,_0x200864){var _0x148540;return respondWithRpcPromise(_0x0baf('0x2f'),_0x36c6d2[_0x0baf('0x1a')])['then'](function(_0x3573ce){_0x148540=_0x3573ce;return respondWithRpcPromise(_0x0baf('0x2f'),_0x36c6d2['query'],routingClient);})[_0x0baf('0x9')](function(_0x324369){return _[_0x0baf('0x19')]({},_0x324369,_0x148540);})[_0x0baf('0x9')](respondWithResult(_0x200864,null))[_0x0baf('0x16')](handleError(_0x200864,null));};exports[_0x0baf('0x30')]=function(_0x57b581,_0x23ad34){if(_0x57b581[_0x0baf('0x31')]&&_0x57b581['body'][_0x0baf('0x32')]&&_0x57b581[_0x0baf('0x33')]&&_0x57b581[_0x0baf('0x33')][_0x0baf('0x11')]){for(var _0x504031 in _0x57b581[_0x0baf('0x31')][_0x0baf('0x32')]){if(_0x57b581[_0x0baf('0x31')][_0x0baf('0x32')][_0x0baf('0x34')](_0x504031)){db[_0x0baf('0x35')][_0x0baf('0x36')]({'where':{'channel':_0x504031,'membername':_0x57b581[_0x0baf('0x33')][_0x0baf('0x11')],'type':_0x0baf('0x37'),'exitAt':null,'uniqueid':_0x57b581['body'][_0x0baf('0x32')][_0x504031]&&_0x57b581[_0x0baf('0x31')][_0x0baf('0x32')][_0x504031][_0x0baf('0x38')]?{'$notIn':_0x57b581[_0x0baf('0x31')]['interaction'][_0x504031]}:{'$ne':null}}})[_0x0baf('0x9')](function(_0x310240){var _0x27c3ee=moment()[_0x0baf('0x39')](_0x0baf('0x3a'));for(var _0x54ed41=0x0,_0x2a0924=_0x310240[_0x0baf('0x38')];_0x54ed41<_0x2a0924;_0x54ed41+=0x1){_0x310240[_0x54ed41][_0x0baf('0x3b')]({'exitAt':_0x27c3ee});}});for(var _0x1522b0=0x0;_0x1522b0<_0x57b581[_0x0baf('0x31')][_0x0baf('0x32')][_0x504031][_0x0baf('0x38')];_0x1522b0+=0x1){db['MemberReport'][_0x0baf('0x3c')]({'where':{'channel':_0x504031,'membername':_0x57b581[_0x0baf('0x33')][_0x0baf('0x11')],'type':'INTERACTION','uniqueid':_0x57b581[_0x0baf('0x31')][_0x0baf('0x32')][_0x504031][_0x1522b0],'exitAt':null},'defaults':{'channel':_0x504031,'membername':_0x57b581[_0x0baf('0x33')][_0x0baf('0x11')],'interface':_[_0x0baf('0x12')](_0x57b581[_0x0baf('0x33')][_0x0baf('0x3d')])?util['format'](_0x0baf('0x3e'),_0x57b581[_0x0baf('0x33')][_0x0baf('0x11')]):_0x57b581[_0x0baf('0x33')][_0x0baf('0x3d')],'type':_0x0baf('0x37'),'enterAt':moment()[_0x0baf('0x39')](_0x0baf('0x3a')),'role':_0x0baf('0x3f'),'internal':_0x57b581[_0x0baf('0x33')][_0x0baf('0x40')],'uniqueid':_0x57b581['body']['interaction'][_0x504031][_0x1522b0]}});}}}}return respondWithRpcPromise(_0x0baf('0x41'),{'id':_0x57b581[_0x0baf('0x1b')]['id'],'capacity':_0x57b581[_0x0baf('0x31')][_0x0baf('0x42')]},routingClient)[_0x0baf('0x9')](respondWithResult(_0x23ad34,null))[_0x0baf('0x16')](handleError(_0x23ad34,null));};exports[_0x0baf('0x43')]=function(_0x4b492c,_0x3fe534){return respondWithRpcPromise(_0x0baf('0x44'),_0x4b492c[_0x0baf('0x1a')])[_0x0baf('0x9')](respondWithResult(_0x3fe534,null))[_0x0baf('0x16')](handleError(_0x3fe534,null));};exports[_0x0baf('0x45')]=function(_0x5e1849,_0x3eebe5){return respondWithRpcPromise('Trunks',_0x5e1849[_0x0baf('0x1a')])['then'](respondWithResult(_0x3eebe5,null))[_0x0baf('0x16')](handleError(_0x3eebe5,null));};exports['campaigns']=function(_0x35b1a5,_0x4c035b){return respondWithRpcPromise(_0x0baf('0x46'),_0x35b1a5[_0x0baf('0x1a')])[_0x0baf('0x9')](respondWithResult(_0x4c035b,null))[_0x0baf('0x16')](handleError(_0x4c035b,null));};exports[_0x0baf('0x47')]=function(_0x576475,_0x21f179){return respondWithRpcPromise(_0x0baf('0x48'),_0x576475[_0x0baf('0x1a')],routingClient)[_0x0baf('0x9')](respondWithResult(_0x21f179,null))[_0x0baf('0x16')](handleError(_0x21f179,null));};exports[_0x0baf('0x49')]=function(_0x480834,_0x402f4d){return respondWithRpcPromise(_0x0baf('0x48'),_0x480834[_0x0baf('0x1a')],routingClient)[_0x0baf('0x9')](findById(_0x480834[_0x0baf('0x1b')]['id']))[_0x0baf('0x9')](respondWithResult(_0x402f4d,null))[_0x0baf('0x16')](handleError(_0x402f4d,null));};exports['mailQueues']=function(_0x48e855,_0x23f6ea){return respondWithRpcPromise(_0x0baf('0x4a'),_0x48e855[_0x0baf('0x1a')],routingClient)[_0x0baf('0x9')](respondWithResult(_0x23f6ea,null))[_0x0baf('0x16')](handleError(_0x23f6ea,null));};exports[_0x0baf('0x4b')]=function(_0xaa4293,_0x14a667){return respondWithRpcPromise(_0x0baf('0x4a'),_0xaa4293['query'],routingClient)[_0x0baf('0x9')](findById(_0xaa4293[_0x0baf('0x1b')]['id']))[_0x0baf('0x9')](respondWithResult(_0x14a667,null))[_0x0baf('0x16')](handleError(_0x14a667,null));};exports[_0x0baf('0x4c')]=function(_0xebfc0c,_0x26f5c9){return respondWithRpcPromise('MailAccounts',_0xebfc0c[_0x0baf('0x1a')],mailClient)[_0x0baf('0x9')](respondWithResult(_0x26f5c9,null))[_0x0baf('0x16')](handleError(_0x26f5c9,null));};exports[_0x0baf('0x4d')]=function(_0x1c7d88,_0x1a6d22){return respondWithRpcPromise(_0x0baf('0x4e'),_0x1c7d88[_0x0baf('0x1a')],routingClient)['then'](respondWithResult(_0x1a6d22,null))[_0x0baf('0x16')](handleError(_0x1a6d22,null));};exports['showOpenchannelQueues']=function(_0x3c00e7,_0x5f2fbe){return respondWithRpcPromise('OpenchannelQueues',_0x3c00e7[_0x0baf('0x1a')],routingClient)['then'](findById(_0x3c00e7[_0x0baf('0x1b')]['id']))[_0x0baf('0x9')](respondWithResult(_0x5f2fbe,null))['catch'](handleError(_0x5f2fbe,null));};exports[_0x0baf('0x4f')]=function(_0xfb6708,_0x156572){return respondWithRpcPromise('SmsQueues',_0xfb6708['query'],routingClient)[_0x0baf('0x9')](respondWithResult(_0x156572,null))[_0x0baf('0x16')](handleError(_0x156572,null));};exports[_0x0baf('0x50')]=function(_0x7f49e,_0x784e1a){return respondWithRpcPromise('SmsQueues',_0x7f49e[_0x0baf('0x1a')],routingClient)['then'](findById(_0x7f49e['params']['id']))['then'](respondWithResult(_0x784e1a,null))[_0x0baf('0x16')](handleError(_0x784e1a,null));};exports['whatsappQueues']=function(_0x4946d4,_0x11a81e){return respondWithRpcPromise(_0x0baf('0x51'),_0x4946d4[_0x0baf('0x1a')],routingClient)[_0x0baf('0x9')](respondWithResult(_0x11a81e,null))[_0x0baf('0x16')](handleError(_0x11a81e,null));};exports[_0x0baf('0x52')]=function(_0x4c05d6,_0xec3b32){return respondWithRpcPromise(_0x0baf('0x51'),_0x4c05d6[_0x0baf('0x1a')],routingClient)[_0x0baf('0x9')](findById(_0x4c05d6[_0x0baf('0x1b')]['id']))[_0x0baf('0x9')](respondWithResult(_0xec3b32,null))['catch'](handleError(_0xec3b32,null));};exports[_0x0baf('0x53')]=function(_0x468363,_0x29fd46){return respondWithRpcPromise('FaxQueues',_0x468363[_0x0baf('0x1a')],routingClient)[_0x0baf('0x9')](respondWithResult(_0x29fd46,null))[_0x0baf('0x16')](handleError(_0x29fd46,null));};exports[_0x0baf('0x54')]=function(_0x125906,_0x27a959){return respondWithRpcPromise(_0x0baf('0x55'),_0x125906['query'],routingClient)['then'](findById(_0x125906['params']['id']))[_0x0baf('0x9')](respondWithResult(_0x27a959,null))[_0x0baf('0x16')](handleError(_0x27a959,null));};exports[_0x0baf('0x56')]=function(_0x12b9b5,_0x3e65d4){return respondWithRpcPromise(_0x0baf('0x57'),_0x12b9b5['query'])['then'](respondWithResult(_0x3e65d4,null))[_0x0baf('0x16')](handleError(_0x3e65d4,null));};exports['chatQueuesWaitingInteractions']=function(_0x22cd07,_0x3e9b79){return respondWithRpcPromise('ChatQueuesWaitingInteractions',_0x22cd07[_0x0baf('0x1a')],routingClient)[_0x0baf('0x9')](respondWithResult(_0x3e9b79,null))[_0x0baf('0x16')](handleError(_0x3e9b79,null));};exports[_0x0baf('0x58')]=function(_0x115ff5,_0x33a5af){return respondWithRpcPromise(_0x0baf('0x59'),_0x115ff5[_0x0baf('0x1a')],routingClient)[_0x0baf('0x9')](respondWithResult(_0x33a5af,null))['catch'](handleError(_0x33a5af,null));};exports['openchannelQueuesWaitingInteractions']=function(_0x58a079,_0x493784){return respondWithRpcPromise('OpenchannelQueuesWaitingInteractions',_0x58a079[_0x0baf('0x1a')],routingClient)[_0x0baf('0x9')](respondWithResult(_0x493784,null))[_0x0baf('0x16')](handleError(_0x493784,null));};exports[_0x0baf('0x5a')]=function(_0x5093f5,_0x1be7f2){return respondWithRpcPromise(_0x0baf('0x5b'),_0x5093f5['query'],routingClient)['then'](function(_0x43aecd){if(_0x5093f5[_0x0baf('0x1a')][_0x0baf('0x5c')]!==undefined){var _0x442e5f=_(_0x43aecd[_0x0baf('0x13')])[_0x0baf('0x5d')]([_0x5093f5[_0x0baf('0x1a')][_0x0baf('0x5c')],_0x5093f5['params']['id']])[_0x0baf('0x5e')](_0x0baf('0x5f'))['uniq']()[_0x0baf('0x60')]();return _0x43aecd[_0x0baf('0x13')]['filter'](function(_0x97d385){return _0x442e5f[_0x0baf('0x61')](_0x97d385[_0x0baf('0x5f')])>-0x1;});}else{return _0x43aecd[_0x0baf('0x13')][_0x0baf('0x5d')](function(_0x4fc5af){return _0x4fc5af['queue_id']===parseInt(_0x5093f5[_0x0baf('0x1b')]['id']);});}})[_0x0baf('0x9')](respondWithResult(_0x1be7f2,null))['catch'](handleError(_0x1be7f2,null));};exports[_0x0baf('0x62')]=function(_0x59dad5,_0x21ad25){return respondWithRpcPromise('SmsQueuesWaitingInteractions',_0x59dad5[_0x0baf('0x1a')],routingClient)[_0x0baf('0x9')](respondWithResult(_0x21ad25,null))[_0x0baf('0x16')](handleError(_0x21ad25,null));};exports['whatsappQueuesWaitingInteractions']=function(_0x3c2bc1,_0x5008c5){return respondWithRpcPromise(_0x0baf('0x63'),_0x3c2bc1[_0x0baf('0x1a')],routingClient)[_0x0baf('0x9')](respondWithResult(_0x5008c5,null))[_0x0baf('0x16')](handleError(_0x5008c5,null));};exports[_0x0baf('0x64')]=function(_0x52e845,_0x866e6e){return respondWithRpcPromise(_0x0baf('0x65'),_0x52e845['query'],routingClient)[_0x0baf('0x9')](respondWithResult(_0x866e6e,null))[_0x0baf('0x16')](handleError(_0x866e6e,null));};exports[_0x0baf('0x66')]=function(_0x379c54){return function(_0x1cbbcc,_0x250df2){var _0xa4fd1b,_0x1cda78;var _0x44ef57=_[_0x0baf('0x67')](_0x379c54);var _0x3b7abf=_0x379c54===_0x0baf('0x68')?'Website':'Account';return db[_0x44ef57+_0x0baf('0x69')][_0x0baf('0x6a')]({'raw':!![],'where':{'id':_0x1cbbcc[_0x0baf('0x1b')]['id']}})['then'](function(_0x507783){if(_[_0x0baf('0x12')](_0x507783)){throw new Error(_0x44ef57+_0x0baf('0x6b'));}_0xa4fd1b=_0x507783;return db[_0x44ef57+_0x0baf('0x6c')][_0x0baf('0x6a')]({'where':{'id':_0x1cbbcc[_0x0baf('0x31')][_0x0baf('0x6d')]},'include':[{'model':db[_0x44ef57+_0x0baf('0x6e')],'as':_0x0baf('0x6e')},{'model':db[_0x44ef57+_0x3b7abf],'as':_0x0baf('0x6f')}]});})['then'](function(_0x1590a5){if(_[_0x0baf('0x12')](_0x1590a5)){throw new Error(_0x44ef57+_0x0baf('0x70'));}_0x1cda78=_0x1590a5;return _0x1590a5[_0x0baf('0x71')]({'read':0x0,'readAt':null,'UserId':null});})['then'](function(){var _0x5d26e6={'uniqueid':_0x379c54+'.'+_0x1cda78['id']+'.'+_0x1cda78['Interaction']['id'],'FromUserId':_0x1cbbcc[_0x0baf('0x33')]['id'],'type':_0x0baf('0x72')};_0x5d26e6[_0x44ef57+'MessageId']=_0x1cda78['id'];_0x5d26e6[_0x44ef57+'InteractionId']=_0x1cda78[_0x0baf('0x6e')]['id'];_0x5d26e6[_0x0baf('0x73')+_0x44ef57+_0x3b7abf+'Id']=_0x1cda78['Account']['id'];_0x5d26e6['To'+_0x44ef57+_0x0baf('0x74')]=_0xa4fd1b['id'];return db[_0x44ef57+_0x0baf('0x75')][_0x0baf('0x76')](_0x5d26e6);})[_0x0baf('0x9')](function(){return respondWithRpcPromise(_0x0baf('0x77'),{'channel':_0x379c54,'interaction':_0x1cda78[_0x0baf('0x6e')],'message':_0x1cda78,'account':_0x1cda78[_0x0baf('0x6f')],'applications':[{'id':0x0,'priority':0x1,'app':_0x0baf('0x72'),'appdata':_0xa4fd1b[_0x0baf('0x11')]+','+(_0x1cda78[_0x0baf('0x6f')][_0x0baf('0x78')]||0x12c),'interval':_0x0baf('0x79')}],'transfer':!![]},routingClient);})['then'](respondWithResult(_0x250df2,null))[_0x0baf('0x16')](handleError(_0x250df2,null));};};exports[_0x0baf('0x7a')]=function(_0x1e1adb,_0x3bd15b){var _0x3c37b4,_0x195303;if(_['isNil'](_0x1e1adb[_0x0baf('0x31')][_0x0baf('0x7b')])){throw new Error(_0x0baf('0x7c'));}var _0x457ae8=_0x1e1adb[_0x0baf('0x31')]['channel'];var _0x3761b5=_[_0x0baf('0x67')](_0x457ae8);var _0x2eae1b=_0x457ae8===_0x0baf('0x68')?_0x0baf('0x7d'):'Account';return db['User'][_0x0baf('0x6a')]({'raw':!![],'where':{'id':_0x1e1adb['params']['id'],'role':_0x0baf('0x3f')}})['then'](function(_0x32d8b6){if(_[_0x0baf('0x12')](_0x32d8b6)){throw new Error(_0x0baf('0x7e'));}_0x3c37b4=_0x32d8b6;return db[_0x3761b5+_0x0baf('0x6c')]['findOne']({'where':{'id':_0x1e1adb[_0x0baf('0x31')][_0x0baf('0x6d')]},'include':[{'model':db[_0x3761b5+_0x0baf('0x6e')],'as':'Interaction'},{'model':db[_0x3761b5+_0x2eae1b],'as':'Account'}]});})['then'](function(_0x4d4884){if(_[_0x0baf('0x12')](_0x4d4884)){throw new Error(_0x3761b5+_0x0baf('0x70'));}_0x195303=_0x4d4884;return _0x4d4884[_0x0baf('0x71')]({'read':0x0,'readAt':null,'UserId':null});})[_0x0baf('0x9')](function(){var _0x597830={'uniqueid':_0x457ae8+'.'+_0x195303['id']+'.'+_0x195303[_0x0baf('0x6e')]['id'],'FromUserId':_0x1e1adb[_0x0baf('0x33')]['id'],'type':_0x0baf('0x3f'),'ToUserId':_0x3c37b4['id']};_0x597830[_0x3761b5+'MessageId']=_0x195303['id'];_0x597830[_0x3761b5+_0x0baf('0x7f')]=_0x195303[_0x0baf('0x6e')]['id'];_0x597830['From'+_0x3761b5+_0x2eae1b+'Id']=_0x195303[_0x0baf('0x6f')]['id'];return db[_0x3761b5+'TransferReport'][_0x0baf('0x76')](_0x597830);})[_0x0baf('0x9')](function(){return respondWithRpcPromise(_0x0baf('0x77'),{'channel':_0x457ae8,'interaction':_0x195303[_0x0baf('0x6e')],'message':_0x195303,'account':_0x195303['Account'],'applications':[{'id':0x0,'priority':0x1,'app':'agent','appdata':_0x3c37b4[_0x0baf('0x11')]+','+(_0x195303['Account'][_0x0baf('0x80')]||0x12c),'interval':_0x0baf('0x79')}],'transfer':!![]},routingClient);})[_0x0baf('0x9')](respondWithResult(_0x3bd15b,null))[_0x0baf('0x16')](handleError(_0x3bd15b,null));}; \ No newline at end of file diff --git a/server/api/schedule/index.js b/server/api/schedule/index.js index b51774d..ca860ee 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 _0x659e=['express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./schedule.controller','get','index','isAuthenticated','show','/:id/run','run','create','/:id','update','delete','destroy','exports','multer','path','connect-timeout'];(function(_0x68fa8d,_0x520a22){var _0x2adb37=function(_0x49385b){while(--_0x49385b){_0x68fa8d['push'](_0x68fa8d['shift']());}};_0x2adb37(++_0x520a22);}(_0x659e,0x14d));var _0xe659=function(_0x51fae9,_0x437d16){_0x51fae9=_0x51fae9-0x0;var _0x3dde38=_0x659e[_0x51fae9];return _0x3dde38;};'use strict';var multer=require(_0xe659('0x0'));var util=require('util');var path=require(_0xe659('0x1'));var timeout=require(_0xe659('0x2'));var express=require(_0xe659('0x3'));var router=express[_0xe659('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xe659('0x5'));var interaction=require(_0xe659('0x6'));var config=require(_0xe659('0x7'));var controller=require(_0xe659('0x8'));router[_0xe659('0x9')]('/',auth['isAuthenticated'](),controller[_0xe659('0xa')]);router[_0xe659('0x9')]('/:id',auth[_0xe659('0xb')](),controller[_0xe659('0xc')]);router[_0xe659('0x9')](_0xe659('0xd'),auth['isAuthenticated'](),controller[_0xe659('0xe')]);router['post']('/',auth[_0xe659('0xb')](),controller[_0xe659('0xf')]);router['put'](_0xe659('0x10'),auth[_0xe659('0xb')](),controller[_0xe659('0x11')]);router[_0xe659('0x12')](_0xe659('0x10'),auth[_0xe659('0xb')](),controller[_0xe659('0x13')]);module[_0xe659('0x14')]=router; \ No newline at end of file +var _0x7b66=['show','/:id/run','run','post','create','put','update','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./schedule.controller','get','/:id','isAuthenticated'];(function(_0x4a83f4,_0x50f589){var _0x1fc810=function(_0xc651f9){while(--_0xc651f9){_0x4a83f4['push'](_0x4a83f4['shift']());}};_0x1fc810(++_0x50f589);}(_0x7b66,0x1d6));var _0x67b6=function(_0x3ab052,_0x46cb8e){_0x3ab052=_0x3ab052-0x0;var _0x2465be=_0x7b66[_0x3ab052];return _0x2465be;};'use strict';var multer=require(_0x67b6('0x0'));var util=require(_0x67b6('0x1'));var path=require(_0x67b6('0x2'));var timeout=require(_0x67b6('0x3'));var express=require(_0x67b6('0x4'));var router=express[_0x67b6('0x5')]();var fs_extra=require(_0x67b6('0x6'));var auth=require(_0x67b6('0x7'));var interaction=require(_0x67b6('0x8'));var config=require('../../config/environment');var controller=require(_0x67b6('0x9'));router[_0x67b6('0xa')]('/',auth['isAuthenticated'](),controller['index']);router[_0x67b6('0xa')](_0x67b6('0xb'),auth[_0x67b6('0xc')](),controller[_0x67b6('0xd')]);router[_0x67b6('0xa')](_0x67b6('0xe'),auth[_0x67b6('0xc')](),controller[_0x67b6('0xf')]);router[_0x67b6('0x10')]('/',auth[_0x67b6('0xc')](),controller[_0x67b6('0x11')]);router[_0x67b6('0x12')](_0x67b6('0xb'),auth['isAuthenticated'](),controller[_0x67b6('0x13')]);router['delete'](_0x67b6('0xb'),auth[_0x67b6('0xc')](),controller['destroy']);module[_0x67b6('0x14')]=router; \ No newline at end of file diff --git a/server/api/schedule/schedule.attributes.js b/server/api/schedule/schedule.attributes.js index e7f5c8d..83ebe0b 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 _0x008c=['INTEGER','years','days','hours','ENUM','xlsx','csv','custom','BOOLEAN','TEXT','sequelize','exports','STRING','0\x200\x20*\x20*\x20*','DATE'];(function(_0x3e6683,_0x553835){var _0x54c559=function(_0x34a764){while(--_0x34a764){_0x3e6683['push'](_0x3e6683['shift']());}};_0x54c559(++_0x553835);}(_0x008c,0x1db));var _0xc008=function(_0x26bafe,_0x13e506){_0x26bafe=_0x26bafe-0x0;var _0x307879=_0x008c[_0x26bafe];return _0x307879;};'use strict';var Sequelize=require(_0xc008('0x0'));module[_0xc008('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize['STRING']},'active':{'type':Sequelize['BOOLEAN'],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0xc008('0x2')],'allowNull':![],'defaultValue':_0xc008('0x3')},'startAt':{'type':Sequelize['DATE'],'allowNull':![]},'endAt':{'type':Sequelize[_0xc008('0x4')],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0xc008('0x5')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize['ENUM'](_0xc008('0x6'),'quarters','months','weeks',_0xc008('0x7'),_0xc008('0x8'),'minutes'),'allowNull':![],'defaultValue':'days'},'output':{'type':Sequelize[_0xc008('0x9')]('csv','pdf',_0xc008('0xa')),'allowNull':![],'defaultValue':_0xc008('0xb')},'type':{'type':Sequelize[_0xc008('0x9')]('custom','default'),'allowNull':![],'defaultValue':_0xc008('0xc')},'sendMail':{'type':Sequelize[_0xc008('0xd')],'defaultValue':![]},'email':{'type':Sequelize[_0xc008('0x2')]},'cc':{'type':Sequelize['TEXT']},'bcc':{'type':Sequelize[_0xc008('0xe')]},'sendIfEmpty':{'type':Sequelize[_0xc008('0xd')],'defaultValue':!![]}}; \ No newline at end of file +var _0x33d7=['sequelize','exports','STRING','BOOLEAN','0\x200\x20*\x20*\x20*','DATE','INTEGER','ENUM','years','quarters','weeks','days','csv','pdf','xlsx','custom','TEXT'];(function(_0x563546,_0x1a3d50){var _0x2c8e5f=function(_0x3cbda2){while(--_0x3cbda2){_0x563546['push'](_0x563546['shift']());}};_0x2c8e5f(++_0x1a3d50);}(_0x33d7,0x154));var _0x733d=function(_0x3ee6d9,_0x3f88b0){_0x3ee6d9=_0x3ee6d9-0x0;var _0x1aef96=_0x33d7[_0x3ee6d9];return _0x1aef96;};'use strict';var Sequelize=require(_0x733d('0x0'));module[_0x733d('0x1')]={'name':{'type':Sequelize[_0x733d('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x733d('0x2')]},'active':{'type':Sequelize[_0x733d('0x3')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x733d('0x4')},'startAt':{'type':Sequelize[_0x733d('0x5')],'allowNull':![]},'endAt':{'type':Sequelize[_0x733d('0x5')],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0x733d('0x6')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0x733d('0x7')](_0x733d('0x8'),_0x733d('0x9'),'months',_0x733d('0xa'),_0x733d('0xb'),'hours','minutes'),'allowNull':![],'defaultValue':_0x733d('0xb')},'output':{'type':Sequelize['ENUM'](_0x733d('0xc'),_0x733d('0xd'),_0x733d('0xe')),'allowNull':![],'defaultValue':'csv'},'type':{'type':Sequelize['ENUM'](_0x733d('0xf'),'default'),'allowNull':![],'defaultValue':_0x733d('0xf')},'sendMail':{'type':Sequelize[_0x733d('0x3')],'defaultValue':![]},'email':{'type':Sequelize[_0x733d('0x2')]},'cc':{'type':Sequelize['TEXT']},'bcc':{'type':Sequelize[_0x733d('0x10')]},'sendIfEmpty':{'type':Sequelize[_0x733d('0x3')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/schedule/schedule.controller.js b/server/api/schedule/schedule.controller.js index 21eff12..b0ab3b9 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 _0xb1e1=['VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','create','body','user','role','get','Scheduler','UserProfileSection','find','userProfileId','autoAssociation','error','run','../../config/schedule','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','apply','save','update','then','destroy','UserProfileResource','stack','name','index','map','Schedule','fieldName','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','merge','type'];(function(_0x2c4753,_0x13c421){var _0x56fd95=function(_0x2bedec){while(--_0x2bedec){_0x2c4753['push'](_0x2c4753['shift']());}};_0x56fd95(++_0x13c421);}(_0xb1e1,0x160));var _0x1b1e=function(_0x2aa221,_0x2bfa24){_0x2aa221=_0x2aa221-0x0;var _0x1bbeb9=_0xb1e1[_0x2aa221];return _0x1bbeb9;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x1b1e('0x0'));var jsonpatch=require(_0x1b1e('0x1'));var rp=require(_0x1b1e('0x2'));var moment=require('moment');var BPromise=require(_0x1b1e('0x3'));var Mustache=require('mustache');var util=require(_0x1b1e('0x4'));var path=require(_0x1b1e('0x5'));var sox=require(_0x1b1e('0x6'));var csv=require(_0x1b1e('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1b1e('0x8'));var _=require(_0x1b1e('0x9'));var squel=require(_0x1b1e('0xa'));var crypto=require(_0x1b1e('0xb'));var jsforce=require(_0x1b1e('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x1b1e('0x7'));var querystring=require(_0x1b1e('0xd'));var Papa=require('papaparse');var Redis=require(_0x1b1e('0xe'));var authService=require(_0x1b1e('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x1b1e('0x10'))(_0x1b1e('0x11'));var utils=require(_0x1b1e('0x12'));var config=require(_0x1b1e('0x13'));var licenseUtil=require(_0x1b1e('0x14'));var db=require(_0x1b1e('0x15'))['db'];function respondWithStatusCode(_0x51df65,_0x39a232){_0x39a232=_0x39a232||0xcc;return function(_0x16e200){if(_0x16e200){return _0x51df65[_0x1b1e('0x16')](_0x39a232);}return _0x51df65['status'](_0x39a232)[_0x1b1e('0x17')]();};}function respondWithResult(_0x446839,_0x19293d){_0x19293d=_0x19293d||0xc8;return function(_0x36c25b){if(_0x36c25b){return _0x446839[_0x1b1e('0x18')](_0x19293d)[_0x1b1e('0x19')](_0x36c25b);}};}function respondWithFilteredResult(_0x260329,_0x43d130){return function(_0xd6b4ea){if(_0xd6b4ea){var _0x1bc9b4=typeof _0x43d130[_0x1b1e('0x1a')]===_0x1b1e('0x1b')&&typeof _0x43d130[_0x1b1e('0x1c')]==='undefined';var _0x5d9c6f=_0xd6b4ea[_0x1b1e('0x1d')];var _0x4650a4=_0x1bc9b4?0x0:_0x43d130[_0x1b1e('0x1a')];var _0x229335=_0x1bc9b4?_0xd6b4ea['count']:_0x43d130[_0x1b1e('0x1a')]+_0x43d130['limit'];var _0xdc7fdf;if(_0x229335>=_0x5d9c6f){_0x229335=_0x5d9c6f;_0xdc7fdf=0xc8;}else{_0xdc7fdf=0xce;}_0x260329[_0x1b1e('0x18')](_0xdc7fdf);return _0x260329[_0x1b1e('0x1e')]('Content-Range',_0x4650a4+'-'+_0x229335+'/'+_0x5d9c6f)[_0x1b1e('0x19')](_0xd6b4ea);}return null;};}function patchUpdates(_0xa76582){return function(_0x33cc32){try{jsonpatch[_0x1b1e('0x1f')](_0x33cc32,_0xa76582,!![]);}catch(_0x26782f){return BPromise['reject'](_0x26782f);}return _0x33cc32[_0x1b1e('0x20')]();};}function saveUpdates(_0x176ca2,_0x159ecb){return function(_0x2606c6){if(_0x2606c6){return _0x2606c6[_0x1b1e('0x21')](_0x176ca2)[_0x1b1e('0x22')](function(_0x48843d){return _0x48843d;});}return null;};}function removeEntity(_0x4f045a,_0x2b583a){return function(_0x32199c){if(_0x32199c){return _0x32199c[_0x1b1e('0x23')]()['then'](function(){var _0x30387e=_0x32199c['get']({'plain':!![]});var _0x2419b6='Scheduler';return db[_0x1b1e('0x24')]['destroy']({'where':{'type':_0x2419b6,'resourceId':_0x30387e['id']}})[_0x1b1e('0x22')](function(){return _0x32199c;});})['then'](function(){_0x4f045a['status'](0xcc)[_0x1b1e('0x17')]();});}};}function handleEntityNotFound(_0x3092f4,_0x1de82f){return function(_0x204ffa){if(!_0x204ffa){_0x3092f4['sendStatus'](0x194);}return _0x204ffa;};}function handleError(_0x17aa60,_0x3e9c33){_0x3e9c33=_0x3e9c33||0x1f4;return function(_0x28c5f0){logger['error'](_0x28c5f0[_0x1b1e('0x25')]);if(_0x28c5f0[_0x1b1e('0x26')]){delete _0x28c5f0[_0x1b1e('0x26')];}_0x17aa60[_0x1b1e('0x18')](_0x3e9c33)['send'](_0x28c5f0);};}exports[_0x1b1e('0x27')]=function(_0x41edfb,_0x5272af){var _0xa366b6={},_0x322131={},_0xcab633={'count':0x0,'rows':[]};var _0x2dde58=_[_0x1b1e('0x28')](db[_0x1b1e('0x29')]['rawAttributes'],function(_0x4a46d1){return{'name':_0x4a46d1[_0x1b1e('0x2a')],'type':_0x4a46d1['type'][_0x1b1e('0x2b')]};});_0x322131[_0x1b1e('0x2c')]=_[_0x1b1e('0x28')](_0x2dde58,_0x1b1e('0x26'));_0x322131[_0x1b1e('0x2d')]=_[_0x1b1e('0x2e')](_0x41edfb['query']);_0x322131['filters']=_[_0x1b1e('0x2f')](_0x322131[_0x1b1e('0x2c')],_0x322131[_0x1b1e('0x2d')]);_0xa366b6['attributes']=_['intersection'](_0x322131['model'],qs[_0x1b1e('0x30')](_0x41edfb['query']['fields']));_0xa366b6[_0x1b1e('0x31')]=_0xa366b6[_0x1b1e('0x31')][_0x1b1e('0x32')]?_0xa366b6[_0x1b1e('0x31')]:_0x322131[_0x1b1e('0x2c')];if(!_0x41edfb['query'][_0x1b1e('0x33')](_0x1b1e('0x34'))){_0xa366b6[_0x1b1e('0x1c')]=qs[_0x1b1e('0x1c')](_0x41edfb[_0x1b1e('0x2d')]['limit']);_0xa366b6['offset']=qs['offset'](_0x41edfb[_0x1b1e('0x2d')][_0x1b1e('0x1a')]);}_0xa366b6['order']=qs[_0x1b1e('0x35')](_0x41edfb[_0x1b1e('0x2d')]['sort']);_0xa366b6[_0x1b1e('0x36')]=qs['filters'](_[_0x1b1e('0x37')](_0x41edfb[_0x1b1e('0x2d')],_0x322131['filters']),_0x2dde58);if(_0x41edfb[_0x1b1e('0x2d')]['filter']){_0xa366b6[_0x1b1e('0x36')]=_[_0x1b1e('0x38')](_0xa366b6[_0x1b1e('0x36')],{'$or':_['map'](_0x2dde58,function(_0xa88c0b){if(_0xa88c0b[_0x1b1e('0x39')]!==_0x1b1e('0x3a')){var _0x5c7bd4={};_0x5c7bd4[_0xa88c0b[_0x1b1e('0x26')]]={'$like':'%'+_0x41edfb['query'][_0x1b1e('0x3b')]+'%'};return _0x5c7bd4;}})});}_0xa366b6=_['merge']({},_0xa366b6,_0x41edfb[_0x1b1e('0x3c')]);var _0x2d3a3b={'where':_0xa366b6[_0x1b1e('0x36')]};return db[_0x1b1e('0x29')][_0x1b1e('0x1d')](_0x2d3a3b)[_0x1b1e('0x22')](function(_0x13ce17){_0xcab633[_0x1b1e('0x1d')]=_0x13ce17;if(_0x41edfb[_0x1b1e('0x2d')][_0x1b1e('0x3d')]){_0xa366b6[_0x1b1e('0x3e')]=[{'all':!![]}];}return db[_0x1b1e('0x29')][_0x1b1e('0x3f')](_0xa366b6);})[_0x1b1e('0x22')](function(_0x3648a6){_0xcab633[_0x1b1e('0x40')]=_0x3648a6;return _0xcab633;})[_0x1b1e('0x22')](respondWithFilteredResult(_0x5272af,_0xa366b6))[_0x1b1e('0x41')](handleError(_0x5272af,null));};exports[_0x1b1e('0x42')]=function(_0x129ff8,_0x3f4541){var _0x3c1d28={'raw':![],'where':{'id':_0x129ff8[_0x1b1e('0x43')]['id']}},_0x3c9b96={};_0x3c9b96['model']=_[_0x1b1e('0x2e')](db[_0x1b1e('0x29')][_0x1b1e('0x44')]);_0x3c9b96['query']=_[_0x1b1e('0x2e')](_0x129ff8[_0x1b1e('0x2d')]);_0x3c9b96['filters']=_['intersection'](_0x3c9b96[_0x1b1e('0x2c')],_0x3c9b96['query']);_0x3c1d28['attributes']=_[_0x1b1e('0x2f')](_0x3c9b96[_0x1b1e('0x2c')],qs[_0x1b1e('0x30')](_0x129ff8[_0x1b1e('0x2d')][_0x1b1e('0x30')]));_0x3c1d28['attributes']=_0x3c1d28[_0x1b1e('0x31')]['length']?_0x3c1d28[_0x1b1e('0x31')]:_0x3c9b96['model'];if(_0x129ff8['query'][_0x1b1e('0x3d')]){_0x3c1d28[_0x1b1e('0x3e')]=[{'all':!![]}];}_0x3c1d28=_['merge']({},_0x3c1d28,_0x129ff8[_0x1b1e('0x3c')]);return db[_0x1b1e('0x29')]['find'](_0x3c1d28)[_0x1b1e('0x22')](handleEntityNotFound(_0x3f4541,null))[_0x1b1e('0x22')](respondWithResult(_0x3f4541,null))[_0x1b1e('0x41')](handleError(_0x3f4541,null));};exports[_0x1b1e('0x45')]=function(_0x9e0f1b,_0x42adf3){return db[_0x1b1e('0x29')]['create'](_0x9e0f1b[_0x1b1e('0x46')],{})['then'](function(_0x44091b){var _0xf46491=_0x9e0f1b[_0x1b1e('0x47')]['get']({'plain':!![]});if(!_0xf46491)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xf46491[_0x1b1e('0x48')]==='user'){var _0x5951b2=_0x44091b[_0x1b1e('0x49')]({'plain':!![]});var _0x418fc2=_0x1b1e('0x4a');return db[_0x1b1e('0x4b')][_0x1b1e('0x4c')]({'where':{'name':_0x418fc2,'userProfileId':_0xf46491[_0x1b1e('0x4d')]},'raw':!![]})[_0x1b1e('0x22')](function(_0x3e447a){if(_0x3e447a&&_0x3e447a[_0x1b1e('0x4e')]===0x0){return db[_0x1b1e('0x24')][_0x1b1e('0x45')]({'name':_0x5951b2['name'],'resourceId':_0x5951b2['id'],'type':_0x3e447a[_0x1b1e('0x26')],'sectionId':_0x3e447a['id']},{})[_0x1b1e('0x22')](function(){return _0x44091b;});}else{return _0x44091b;}})[_0x1b1e('0x41')](function(_0x2b4739){logger[_0x1b1e('0x4f')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2b4739);throw _0x2b4739;});}return _0x44091b;})[_0x1b1e('0x22')](respondWithResult(_0x42adf3,0xc9))['catch'](handleError(_0x42adf3,null));};exports[_0x1b1e('0x21')]=function(_0x50c927,_0x25d0a1){if(_0x50c927[_0x1b1e('0x46')]['id']){delete _0x50c927['body']['id'];}return db[_0x1b1e('0x29')]['find']({'where':{'id':_0x50c927[_0x1b1e('0x43')]['id']}})[_0x1b1e('0x22')](handleEntityNotFound(_0x25d0a1,null))[_0x1b1e('0x22')](saveUpdates(_0x50c927['body'],null))[_0x1b1e('0x22')](respondWithResult(_0x25d0a1,null))[_0x1b1e('0x41')](handleError(_0x25d0a1,null));};exports['destroy']=function(_0x2d6697,_0x306370){return db[_0x1b1e('0x29')][_0x1b1e('0x4c')]({'where':{'id':_0x2d6697[_0x1b1e('0x43')]['id']}})[_0x1b1e('0x22')](handleEntityNotFound(_0x306370,null))[_0x1b1e('0x22')](removeEntity(_0x306370,null))[_0x1b1e('0x41')](handleError(_0x306370,null));};exports[_0x1b1e('0x50')]=function(_0x31994e,_0x16c670,_0x5ea51f){var _0x40be34=require(_0x1b1e('0x51'));return db['Schedule'][_0x1b1e('0x4c')]({'where':{'id':_0x31994e['params']['id']},'raw':!![]})[_0x1b1e('0x22')](handleEntityNotFound(_0x16c670,null))[_0x1b1e('0x22')](function(){_0x40be34['run'](_0x31994e[_0x1b1e('0x43')]['id']);})[_0x1b1e('0x22')](respondWithStatusCode(_0x16c670,null))['catch'](handleError(_0x16c670,null));}; \ No newline at end of file +var _0xdf94=['then','destroy','get','Scheduler','UserProfileResource','stack','name','send','index','Schedule','rawAttributes','fieldName','type','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','findAll','rows','catch','show','params','keys','include','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','../../config/schedule','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update'];(function(_0xc864d,_0x3443f2){var _0x4a1305=function(_0x162dd6){while(--_0x162dd6){_0xc864d['push'](_0xc864d['shift']());}};_0x4a1305(++_0x3443f2);}(_0xdf94,0x1d7));var _0x4df9=function(_0x5d44f8,_0x13d6ef){_0x5d44f8=_0x5d44f8-0x0;var _0xdc41ae=_0xdf94[_0x5d44f8];return _0xdc41ae;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x4df9('0x0'));var zipdir=require(_0x4df9('0x1'));var jsonpatch=require(_0x4df9('0x2'));var rp=require(_0x4df9('0x3'));var moment=require(_0x4df9('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x4df9('0x5'));var util=require(_0x4df9('0x6'));var path=require(_0x4df9('0x7'));var sox=require('sox');var csv=require(_0x4df9('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x4df9('0x9'));var crypto=require(_0x4df9('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x4df9('0xb'));var toCsv=require('to-csv');var querystring=require(_0x4df9('0xc'));var Papa=require(_0x4df9('0xd'));var Redis=require(_0x4df9('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x4df9('0xf'));var hardwareService=require(_0x4df9('0x10'));var logger=require('../../config/logger')('api');var utils=require(_0x4df9('0x11'));var config=require('../../config/environment');var licenseUtil=require(_0x4df9('0x12'));var db=require(_0x4df9('0x13'))['db'];function respondWithStatusCode(_0x50957f,_0x2d1fc2){_0x2d1fc2=_0x2d1fc2||0xcc;return function(_0x22dd23){if(_0x22dd23){return _0x50957f[_0x4df9('0x14')](_0x2d1fc2);}return _0x50957f[_0x4df9('0x15')](_0x2d1fc2)['end']();};}function respondWithResult(_0x277796,_0x53fed1){_0x53fed1=_0x53fed1||0xc8;return function(_0x11249a){if(_0x11249a){return _0x277796['status'](_0x53fed1)[_0x4df9('0x16')](_0x11249a);}};}function respondWithFilteredResult(_0xf851a4,_0x36a194){return function(_0x8efcbd){if(_0x8efcbd){var _0x213899=typeof _0x36a194[_0x4df9('0x17')]===_0x4df9('0x18')&&typeof _0x36a194['limit']===_0x4df9('0x18');var _0x3a4b37=_0x8efcbd[_0x4df9('0x19')];var _0x2b2fe3=_0x213899?0x0:_0x36a194[_0x4df9('0x17')];var _0x468ec4=_0x213899?_0x8efcbd[_0x4df9('0x19')]:_0x36a194[_0x4df9('0x17')]+_0x36a194[_0x4df9('0x1a')];var _0x335c93;if(_0x468ec4>=_0x3a4b37){_0x468ec4=_0x3a4b37;_0x335c93=0xc8;}else{_0x335c93=0xce;}_0xf851a4[_0x4df9('0x15')](_0x335c93);return _0xf851a4[_0x4df9('0x1b')](_0x4df9('0x1c'),_0x2b2fe3+'-'+_0x468ec4+'/'+_0x3a4b37)[_0x4df9('0x16')](_0x8efcbd);}return null;};}function patchUpdates(_0x18dcb1){return function(_0x388246){try{jsonpatch[_0x4df9('0x1d')](_0x388246,_0x18dcb1,!![]);}catch(_0x66ea1){return BPromise[_0x4df9('0x1e')](_0x66ea1);}return _0x388246[_0x4df9('0x1f')]();};}function saveUpdates(_0x2225da,_0x2aea3a){return function(_0x2b8812){if(_0x2b8812){return _0x2b8812[_0x4df9('0x20')](_0x2225da)[_0x4df9('0x21')](function(_0x575241){return _0x575241;});}return null;};}function removeEntity(_0x5fd917,_0x5d3488){return function(_0x55e50f){if(_0x55e50f){return _0x55e50f[_0x4df9('0x22')]()['then'](function(){var _0x24ab3d=_0x55e50f[_0x4df9('0x23')]({'plain':!![]});var _0x1ae429=_0x4df9('0x24');return db[_0x4df9('0x25')][_0x4df9('0x22')]({'where':{'type':_0x1ae429,'resourceId':_0x24ab3d['id']}})[_0x4df9('0x21')](function(){return _0x55e50f;});})[_0x4df9('0x21')](function(){_0x5fd917[_0x4df9('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x50bd4e,_0x1f346d){return function(_0x5996c0){if(!_0x5996c0){_0x50bd4e[_0x4df9('0x14')](0x194);}return _0x5996c0;};}function handleError(_0x27df48,_0x4438dd){_0x4438dd=_0x4438dd||0x1f4;return function(_0xa4d8c9){logger['error'](_0xa4d8c9[_0x4df9('0x26')]);if(_0xa4d8c9['name']){delete _0xa4d8c9[_0x4df9('0x27')];}_0x27df48[_0x4df9('0x15')](_0x4438dd)[_0x4df9('0x28')](_0xa4d8c9);};}exports[_0x4df9('0x29')]=function(_0x461c6b,_0x508643){var _0x1166a6={},_0x2ac13a={},_0x5afbcf={'count':0x0,'rows':[]};var _0x42d80e=_['map'](db[_0x4df9('0x2a')][_0x4df9('0x2b')],function(_0x5e6482){return{'name':_0x5e6482[_0x4df9('0x2c')],'type':_0x5e6482[_0x4df9('0x2d')]['key']};});_0x2ac13a[_0x4df9('0x2e')]=_[_0x4df9('0x2f')](_0x42d80e,_0x4df9('0x27'));_0x2ac13a['query']=_['keys'](_0x461c6b[_0x4df9('0x30')]);_0x2ac13a[_0x4df9('0x31')]=_[_0x4df9('0x32')](_0x2ac13a['model'],_0x2ac13a[_0x4df9('0x30')]);_0x1166a6[_0x4df9('0x33')]=_[_0x4df9('0x32')](_0x2ac13a[_0x4df9('0x2e')],qs['fields'](_0x461c6b[_0x4df9('0x30')][_0x4df9('0x34')]));_0x1166a6['attributes']=_0x1166a6[_0x4df9('0x33')][_0x4df9('0x35')]?_0x1166a6[_0x4df9('0x33')]:_0x2ac13a[_0x4df9('0x2e')];if(!_0x461c6b[_0x4df9('0x30')][_0x4df9('0x36')](_0x4df9('0x37'))){_0x1166a6[_0x4df9('0x1a')]=qs[_0x4df9('0x1a')](_0x461c6b[_0x4df9('0x30')][_0x4df9('0x1a')]);_0x1166a6['offset']=qs[_0x4df9('0x17')](_0x461c6b[_0x4df9('0x30')][_0x4df9('0x17')]);}_0x1166a6[_0x4df9('0x38')]=qs[_0x4df9('0x39')](_0x461c6b['query']['sort']);_0x1166a6[_0x4df9('0x3a')]=qs['filters'](_[_0x4df9('0x3b')](_0x461c6b[_0x4df9('0x30')],_0x2ac13a['filters']),_0x42d80e);if(_0x461c6b['query'][_0x4df9('0x3c')]){_0x1166a6[_0x4df9('0x3a')]=_['merge'](_0x1166a6[_0x4df9('0x3a')],{'$or':_[_0x4df9('0x2f')](_0x42d80e,function(_0x21901a){if(_0x21901a[_0x4df9('0x2d')]!==_0x4df9('0x3d')){var _0x1609b8={};_0x1609b8[_0x21901a[_0x4df9('0x27')]]={'$like':'%'+_0x461c6b[_0x4df9('0x30')][_0x4df9('0x3c')]+'%'};return _0x1609b8;}})});}_0x1166a6=_[_0x4df9('0x3e')]({},_0x1166a6,_0x461c6b[_0x4df9('0x3f')]);var _0x5d9cea={'where':_0x1166a6[_0x4df9('0x3a')]};return db['Schedule'][_0x4df9('0x19')](_0x5d9cea)[_0x4df9('0x21')](function(_0x1b3066){_0x5afbcf[_0x4df9('0x19')]=_0x1b3066;if(_0x461c6b[_0x4df9('0x30')][_0x4df9('0x40')]){_0x1166a6['include']=[{'all':!![]}];}return db[_0x4df9('0x2a')][_0x4df9('0x41')](_0x1166a6);})['then'](function(_0x11ba31){_0x5afbcf[_0x4df9('0x42')]=_0x11ba31;return _0x5afbcf;})[_0x4df9('0x21')](respondWithFilteredResult(_0x508643,_0x1166a6))[_0x4df9('0x43')](handleError(_0x508643,null));};exports[_0x4df9('0x44')]=function(_0x7f7216,_0x4eb1b3){var _0x1c7de2={'raw':![],'where':{'id':_0x7f7216[_0x4df9('0x45')]['id']}},_0x5b74cb={};_0x5b74cb[_0x4df9('0x2e')]=_[_0x4df9('0x46')](db[_0x4df9('0x2a')][_0x4df9('0x2b')]);_0x5b74cb[_0x4df9('0x30')]=_[_0x4df9('0x46')](_0x7f7216[_0x4df9('0x30')]);_0x5b74cb['filters']=_[_0x4df9('0x32')](_0x5b74cb[_0x4df9('0x2e')],_0x5b74cb[_0x4df9('0x30')]);_0x1c7de2[_0x4df9('0x33')]=_['intersection'](_0x5b74cb[_0x4df9('0x2e')],qs[_0x4df9('0x34')](_0x7f7216[_0x4df9('0x30')][_0x4df9('0x34')]));_0x1c7de2[_0x4df9('0x33')]=_0x1c7de2[_0x4df9('0x33')][_0x4df9('0x35')]?_0x1c7de2[_0x4df9('0x33')]:_0x5b74cb[_0x4df9('0x2e')];if(_0x7f7216[_0x4df9('0x30')][_0x4df9('0x40')]){_0x1c7de2[_0x4df9('0x47')]=[{'all':!![]}];}_0x1c7de2=_[_0x4df9('0x3e')]({},_0x1c7de2,_0x7f7216[_0x4df9('0x3f')]);return db[_0x4df9('0x2a')][_0x4df9('0x48')](_0x1c7de2)[_0x4df9('0x21')](handleEntityNotFound(_0x4eb1b3,null))[_0x4df9('0x21')](respondWithResult(_0x4eb1b3,null))[_0x4df9('0x43')](handleError(_0x4eb1b3,null));};exports[_0x4df9('0x49')]=function(_0x539896,_0x4640fc){return db[_0x4df9('0x2a')][_0x4df9('0x49')](_0x539896[_0x4df9('0x4a')],{})[_0x4df9('0x21')](function(_0x1c9bf0){var _0x2fc290=_0x539896['user'][_0x4df9('0x23')]({'plain':!![]});if(!_0x2fc290)throw new Error(_0x4df9('0x4b'));if(_0x2fc290[_0x4df9('0x4c')]===_0x4df9('0x4d')){var _0x24229c=_0x1c9bf0['get']({'plain':!![]});var _0x789475=_0x4df9('0x24');return db[_0x4df9('0x4e')][_0x4df9('0x48')]({'where':{'name':_0x789475,'userProfileId':_0x2fc290[_0x4df9('0x4f')]},'raw':!![]})[_0x4df9('0x21')](function(_0x217d84){if(_0x217d84&&_0x217d84[_0x4df9('0x50')]===0x0){return db['UserProfileResource'][_0x4df9('0x49')]({'name':_0x24229c[_0x4df9('0x27')],'resourceId':_0x24229c['id'],'type':_0x217d84[_0x4df9('0x27')],'sectionId':_0x217d84['id']},{})[_0x4df9('0x21')](function(){return _0x1c9bf0;});}else{return _0x1c9bf0;}})[_0x4df9('0x43')](function(_0x5d1775){logger[_0x4df9('0x51')](_0x4df9('0x52'),_0x5d1775);throw _0x5d1775;});}return _0x1c9bf0;})['then'](respondWithResult(_0x4640fc,0xc9))[_0x4df9('0x43')](handleError(_0x4640fc,null));};exports[_0x4df9('0x20')]=function(_0x38f233,_0x7a65f0){if(_0x38f233['body']['id']){delete _0x38f233[_0x4df9('0x4a')]['id'];}return db[_0x4df9('0x2a')][_0x4df9('0x48')]({'where':{'id':_0x38f233[_0x4df9('0x45')]['id']}})[_0x4df9('0x21')](handleEntityNotFound(_0x7a65f0,null))['then'](saveUpdates(_0x38f233[_0x4df9('0x4a')],null))[_0x4df9('0x21')](respondWithResult(_0x7a65f0,null))[_0x4df9('0x43')](handleError(_0x7a65f0,null));};exports[_0x4df9('0x22')]=function(_0x6343ce,_0x14c8b9){return db[_0x4df9('0x2a')][_0x4df9('0x48')]({'where':{'id':_0x6343ce['params']['id']}})[_0x4df9('0x21')](handleEntityNotFound(_0x14c8b9,null))[_0x4df9('0x21')](removeEntity(_0x14c8b9,null))[_0x4df9('0x43')](handleError(_0x14c8b9,null));};exports['run']=function(_0x5e07d8,_0x58d9f4,_0x1e0cb7){var _0x3a83fa=require(_0x4df9('0x53'));return db[_0x4df9('0x2a')]['find']({'where':{'id':_0x5e07d8[_0x4df9('0x45')]['id']},'raw':!![]})[_0x4df9('0x21')](handleEntityNotFound(_0x58d9f4,null))['then'](function(){_0x3a83fa['run'](_0x5e07d8['params']['id']);})['then'](respondWithStatusCode(_0x58d9f4,null))['catch'](handleError(_0x58d9f4,null));}; \ No newline at end of file diff --git a/server/api/schedule/schedule.model.js b/server/api/schedule/schedule.model.js index dbcceca..c3503e3 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 _0x585b=['path','rimraf','./schedule.attributes','exports','define','Schedule','tools_schedules','lodash','util','../../config/logger','moment','bluebird','request-promise'];(function(_0x2884f4,_0x4750f3){var _0x64b4ed=function(_0x565076){while(--_0x565076){_0x2884f4['push'](_0x2884f4['shift']());}};_0x64b4ed(++_0x4750f3);}(_0x585b,0x1db));var _0xb585=function(_0x525c7b,_0x488fcc){_0x525c7b=_0x525c7b-0x0;var _0x27b33e=_0x585b[_0x525c7b];return _0x27b33e;};'use strict';var _=require(_0xb585('0x0'));var util=require(_0xb585('0x1'));var logger=require(_0xb585('0x2'))('api');var moment=require(_0xb585('0x3'));var BPromise=require(_0xb585('0x4'));var rp=require(_0xb585('0x5'));var fs=require('fs');var path=require(_0xb585('0x6'));var rimraf=require(_0xb585('0x7'));var config=require('../../config/environment');var attributes=require(_0xb585('0x8'));module[_0xb585('0x9')]=function(_0x192154,_0x8cbb8c){return _0x192154[_0xb585('0xa')](_0xb585('0xb'),attributes,{'tableName':_0xb585('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8ef2=['path','define','Schedule','../../config/logger','api','moment','bluebird','request-promise'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x8ef2,0x1ab));var _0x28ef=function(_0x10b757,_0x3cf7ca){_0x10b757=_0x10b757-0x0;var _0x5fffd2=_0x8ef2[_0x10b757];return _0x5fffd2;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x28ef('0x0'))(_0x28ef('0x1'));var moment=require(_0x28ef('0x2'));var BPromise=require(_0x28ef('0x3'));var rp=require(_0x28ef('0x4'));var fs=require('fs');var path=require(_0x28ef('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./schedule.attributes');module['exports']=function(_0x244f6d,_0xec264d){return _0x244f6d[_0x28ef('0x6')](_0x28ef('0x7'),attributes,{'tableName':'tools_schedules','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/schedule/schedule.rpc.js b/server/api/schedule/schedule.rpc.js index 16aab25..603640f 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 _0xad22=['Schedule,\x20%s,\x20%s,\x20%s','stringify','error','Schedule,\x20%s,\x20%s','message','result','catch','lodash','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','info','request\x20sent','debug'];(function(_0x1cb77b,_0x5897fa){var _0x16296a=function(_0x5b0ce3){while(--_0x5b0ce3){_0x1cb77b['push'](_0x1cb77b['shift']());}};_0x16296a(++_0x5897fa);}(_0xad22,0x7f));var _0x2ad2=function(_0x18d5d7,_0x19074b){_0x18d5d7=_0x18d5d7-0x0;var _0x30a9ea=_0xad22[_0x18d5d7];return _0x30a9ea;};'use strict';var _=require(_0x2ad2('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x2ad2('0x1'));var rs=require(_0x2ad2('0x2'));var fs=require('fs');var Redis=require(_0x2ad2('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x2ad2('0x4'));var logger=require(_0x2ad2('0x5'))(_0x2ad2('0x6'));var config=require(_0x2ad2('0x7'));var jayson=require(_0x2ad2('0x8'));var client=jayson[_0x2ad2('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1475b8,_0x5a96b5,_0x5cf402){return new BPromise(function(_0x9fad56,_0x58757d){return client['request'](_0x1475b8,_0x5cf402)['then'](function(_0x571147){logger[_0x2ad2('0xa')]('Schedule,\x20%s,\x20%s',_0x5a96b5,_0x2ad2('0xb'));logger[_0x2ad2('0xc')](_0x2ad2('0xd'),_0x5a96b5,_0x2ad2('0xb'),JSON[_0x2ad2('0xe')](_0x571147));if(_0x571147['error']){if(_0x571147[_0x2ad2('0xf')]['code']===0x1f4){logger[_0x2ad2('0xf')](_0x2ad2('0x10'),_0x5a96b5,_0x571147[_0x2ad2('0xf')]['message']);return _0x58757d(_0x571147[_0x2ad2('0xf')][_0x2ad2('0x11')]);}logger['error'](_0x2ad2('0x10'),_0x5a96b5,_0x571147[_0x2ad2('0xf')][_0x2ad2('0x11')]);return _0x9fad56(_0x571147[_0x2ad2('0xf')]['message']);}else{logger['info'](_0x2ad2('0x10'),_0x5a96b5,_0x2ad2('0xb'));_0x9fad56(_0x571147[_0x2ad2('0x12')][_0x2ad2('0x11')]);}})[_0x2ad2('0x13')](function(_0x4bc6c0){logger['error'](_0x2ad2('0x10'),_0x5a96b5,_0x4bc6c0);_0x58757d(_0x4bc6c0);});});} \ No newline at end of file +var _0xa18a=['debug','Schedule,\x20%s,\x20%s,\x20%s','stringify','error','code','Schedule,\x20%s,\x20%s','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent'];(function(_0x211e6d,_0x51075e){var _0x485784=function(_0x49cf30){while(--_0x49cf30){_0x211e6d['push'](_0x211e6d['shift']());}};_0x485784(++_0x51075e);}(_0xa18a,0x1b2));var _0xaa18=function(_0x3832c1,_0x4dedcf){_0x3832c1=_0x3832c1-0x0;var _0x4d67a2=_0xa18a[_0x3832c1];return _0x4d67a2;};'use strict';var _=require(_0xaa18('0x0'));var util=require(_0xaa18('0x1'));var moment=require('moment');var BPromise=require(_0xaa18('0x2'));var rs=require(_0xaa18('0x3'));var fs=require('fs');var Redis=require(_0xaa18('0x4'));var db=require(_0xaa18('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xaa18('0x6'))(_0xaa18('0x7'));var config=require(_0xaa18('0x8'));var jayson=require(_0xaa18('0x9'));var client=jayson[_0xaa18('0xa')][_0xaa18('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2cb5ac,_0x3b7aa9,_0x410710){return new BPromise(function(_0x4fc415,_0x1a17cc){return client[_0xaa18('0xc')](_0x2cb5ac,_0x410710)[_0xaa18('0xd')](function(_0xc36573){logger[_0xaa18('0xe')]('Schedule,\x20%s,\x20%s',_0x3b7aa9,_0xaa18('0xf'));logger[_0xaa18('0x10')](_0xaa18('0x11'),_0x3b7aa9,_0xaa18('0xf'),JSON[_0xaa18('0x12')](_0xc36573));if(_0xc36573[_0xaa18('0x13')]){if(_0xc36573[_0xaa18('0x13')][_0xaa18('0x14')]===0x1f4){logger['error'](_0xaa18('0x15'),_0x3b7aa9,_0xc36573[_0xaa18('0x13')][_0xaa18('0x16')]);return _0x1a17cc(_0xc36573['error'][_0xaa18('0x16')]);}logger['error'](_0xaa18('0x15'),_0x3b7aa9,_0xc36573[_0xaa18('0x13')][_0xaa18('0x16')]);return _0x4fc415(_0xc36573[_0xaa18('0x13')]['message']);}else{logger['info'](_0xaa18('0x15'),_0x3b7aa9,_0xaa18('0xf'));_0x4fc415(_0xc36573[_0xaa18('0x17')][_0xaa18('0x16')]);}})[_0xaa18('0x18')](function(_0x19cc31){logger[_0xaa18('0x13')](_0xaa18('0x15'),_0x3b7aa9,_0x19cc31);_0x1a17cc(_0x19cc31);});});} \ No newline at end of file diff --git a/server/api/screenRecording/index.js b/server/api/screenRecording/index.js index ca5f6ea..da804df 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 _0x7afb=['/:id','update','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./screenRecording.controller','isAuthenticated','/describe','get','/:id/download','put'];(function(_0x5c8edb,_0x105253){var _0x5a1451=function(_0x5371f8){while(--_0x5371f8){_0x5c8edb['push'](_0x5c8edb['shift']());}};_0x5a1451(++_0x105253);}(_0x7afb,0x7c));var _0xb7af=function(_0x1f74be,_0x22747c){_0x1f74be=_0x1f74be-0x0;var _0x51c43f=_0x7afb[_0x1f74be];return _0x51c43f;};'use strict';var multer=require(_0xb7af('0x0'));var util=require(_0xb7af('0x1'));var path=require(_0xb7af('0x2'));var timeout=require(_0xb7af('0x3'));var express=require(_0xb7af('0x4'));var router=express[_0xb7af('0x5')]();var fs_extra=require(_0xb7af('0x6'));var auth=require(_0xb7af('0x7'));var interaction=require(_0xb7af('0x8'));var config=require(_0xb7af('0x9'));var controller=require(_0xb7af('0xa'));router['get']('/',auth[_0xb7af('0xb')](),controller['index']);router['get'](_0xb7af('0xc'),auth[_0xb7af('0xb')](),controller['describe']);router[_0xb7af('0xd')]('/:id',auth[_0xb7af('0xb')](),controller['show']);router['get'](_0xb7af('0xe'),auth[_0xb7af('0xb')](),controller['download']);router['post']('/',auth[_0xb7af('0xb')](),controller['create']);router[_0xb7af('0xf')](_0xb7af('0x10'),auth['isAuthenticated'](),controller[_0xb7af('0x11')]);router[_0xb7af('0x12')]('/:id',auth[_0xb7af('0xb')](),controller[_0xb7af('0x13')]);module['exports']=router; \ No newline at end of file +var _0x8ee2=['../../components/interaction/service','../../config/environment','./screenRecording.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','destroy','exports','multer','path','express','Router','fs-extra'];(function(_0x47c194,_0x3a9fef){var _0x15bbe1=function(_0x5f25e8){while(--_0x5f25e8){_0x47c194['push'](_0x47c194['shift']());}};_0x15bbe1(++_0x3a9fef);}(_0x8ee2,0xc3));var _0x28ee=function(_0x121297,_0x413baa){_0x121297=_0x121297-0x0;var _0x1a0a42=_0x8ee2[_0x121297];return _0x1a0a42;};'use strict';var multer=require(_0x28ee('0x0'));var util=require('util');var path=require(_0x28ee('0x1'));var timeout=require('connect-timeout');var express=require(_0x28ee('0x2'));var router=express[_0x28ee('0x3')]();var fs_extra=require(_0x28ee('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x28ee('0x5'));var config=require(_0x28ee('0x6'));var controller=require(_0x28ee('0x7'));router[_0x28ee('0x8')]('/',auth[_0x28ee('0x9')](),controller[_0x28ee('0xa')]);router[_0x28ee('0x8')](_0x28ee('0xb'),auth['isAuthenticated'](),controller[_0x28ee('0xc')]);router[_0x28ee('0x8')](_0x28ee('0xd'),auth[_0x28ee('0x9')](),controller[_0x28ee('0xe')]);router['get']('/:id/download',auth[_0x28ee('0x9')](),controller['download']);router[_0x28ee('0xf')]('/',auth[_0x28ee('0x9')](),controller[_0x28ee('0x10')]);router[_0x28ee('0x11')]('/:id',auth[_0x28ee('0x9')](),controller['update']);router['delete'](_0x28ee('0xd'),auth[_0x28ee('0x9')](),controller[_0x28ee('0x12')]);module[_0x28ee('0x13')]=router; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.attributes.js b/server/api/screenRecording/screenRecording.attributes.js index 2e812f4..5bbe714 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 _0xaa56=['../../config/environment','VIRTUAL','getDataValue','value','extname','STRING','replace','setDataValue','INTEGER','startedAt','subtract','closedAt','duration','DATE','format','MM-DD-YYYY\x20HH:mm','toString','createdAt','moment','path'];(function(_0x2434de,_0x4d7bbf){var _0x443fb1=function(_0x301d85){while(--_0x301d85){_0x2434de['push'](_0x2434de['shift']());}};_0x443fb1(++_0x4d7bbf);}(_0xaa56,0xc6));var _0x6aa5=function(_0xa30912,_0x264219){_0xa30912=_0xa30912-0x0;var _0x488a23=_0xaa56[_0xa30912];return _0x488a23;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x6aa5('0x0'));var path=require(_0x6aa5('0x1'));var config=require(_0x6aa5('0x2'));module['exports']={'format':{'type':Sequelize[_0x6aa5('0x3')],'get':function(){return this[_0x6aa5('0x4')](_0x6aa5('0x5'))?path[_0x6aa5('0x6')](this[_0x6aa5('0x4')]('value')):undefined;}},'interactionid':{'type':Sequelize[_0x6aa5('0x7')]},'channel':{'type':Sequelize['STRING']},'value':{'type':Sequelize[_0x6aa5('0x7')],'set':function(_0x20f6ba){var _0x5764dc=_0x20f6ba[_0x6aa5('0x8')](/\\/g,'/');this[_0x6aa5('0x9')](_0x6aa5('0x5'),_0x5764dc);}},'rating':{'type':Sequelize[_0x6aa5('0xa')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize[_0x6aa5('0xa')],'set':function(_0x3d50a0){this[_0x6aa5('0x9')](_0x6aa5('0xb'),moment()[_0x6aa5('0xc')](_0x3d50a0,'ms'));this[_0x6aa5('0x9')](_0x6aa5('0xd'),moment());this[_0x6aa5('0x9')](_0x6aa5('0xe'),_0x3d50a0);}},'startedAt':{'type':Sequelize[_0x6aa5('0xf')],'get':function(){return moment(this['getDataValue'](_0x6aa5('0xb')))[_0x6aa5('0x10')](_0x6aa5('0x11'))[_0x6aa5('0x12')]();}},'closedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this['getDataValue']('closedAt'))[_0x6aa5('0x10')](_0x6aa5('0x11'))[_0x6aa5('0x12')]();}},'createdAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0x6aa5('0x4')](_0x6aa5('0x13')))['format'](_0x6aa5('0x11'))[_0x6aa5('0x12')]();}},'updatedAt':{'type':Sequelize[_0x6aa5('0xf')],'get':function(){return moment(this[_0x6aa5('0x4')]('updatedAt'))['format'](_0x6aa5('0x11'))['toString']();}}}; \ No newline at end of file +var _0x3f2e=['startedAt','subtract','closedAt','duration','DATE','format','MM-DD-YYYY\x20HH:mm','toString','createdAt','updatedAt','sequelize','path','../../config/environment','exports','VIRTUAL','getDataValue','value','extname','STRING','setDataValue','INTEGER'];(function(_0x1ac595,_0x5d2081){var _0x455fff=function(_0x3043ee){while(--_0x3043ee){_0x1ac595['push'](_0x1ac595['shift']());}};_0x455fff(++_0x5d2081);}(_0x3f2e,0x9d));var _0xe3f2=function(_0x11df3e,_0x21249e){_0x11df3e=_0x11df3e-0x0;var _0x5139c4=_0x3f2e[_0x11df3e];return _0x5139c4;};'use strict';var Sequelize=require(_0xe3f2('0x0'));var moment=require('moment');var path=require(_0xe3f2('0x1'));var config=require(_0xe3f2('0x2'));module[_0xe3f2('0x3')]={'format':{'type':Sequelize[_0xe3f2('0x4')],'get':function(){return this[_0xe3f2('0x5')](_0xe3f2('0x6'))?path[_0xe3f2('0x7')](this['getDataValue'](_0xe3f2('0x6'))):undefined;}},'interactionid':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0xe3f2('0x8')]},'value':{'type':Sequelize[_0xe3f2('0x8')],'set':function(_0x4fc4d9){var _0x48aafe=_0x4fc4d9['replace'](/\\/g,'/');this[_0xe3f2('0x9')](_0xe3f2('0x6'),_0x48aafe);}},'rating':{'type':Sequelize[_0xe3f2('0xa')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize[_0xe3f2('0xa')],'set':function(_0x577609){this['setDataValue'](_0xe3f2('0xb'),moment()[_0xe3f2('0xc')](_0x577609,'ms'));this[_0xe3f2('0x9')](_0xe3f2('0xd'),moment());this[_0xe3f2('0x9')](_0xe3f2('0xe'),_0x577609);}},'startedAt':{'type':Sequelize[_0xe3f2('0xf')],'get':function(){return moment(this[_0xe3f2('0x5')](_0xe3f2('0xb')))[_0xe3f2('0x10')](_0xe3f2('0x11'))[_0xe3f2('0x12')]();}},'closedAt':{'type':Sequelize[_0xe3f2('0xf')],'get':function(){return moment(this['getDataValue'](_0xe3f2('0xd')))[_0xe3f2('0x10')](_0xe3f2('0x11'))['toString']();}},'createdAt':{'type':Sequelize['DATE'],'get':function(){return moment(this['getDataValue'](_0xe3f2('0x13')))['format'](_0xe3f2('0x11'))[_0xe3f2('0x12')]();}},'updatedAt':{'type':Sequelize[_0xe3f2('0xf')],'get':function(){return moment(this['getDataValue'](_0xe3f2('0x14')))[_0xe3f2('0x10')](_0xe3f2('0x11'))[_0xe3f2('0x12')]();}}}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.controller.js b/server/api/screenRecording/screenRecording.controller.js index 07ecc2a..cb65830 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 _0x4c4e=['findAll','rows','catch','params','keys','find','create','body','duration','createdAt','closedAt','describe','download','../../components/encryptor','uniqueid','value','join','root','server/files/screen_recordings','%s.cypher','existsSync','secrets','ValidationError','ScreenRecording\x20not\x20found','filename','extname','unlink','message','send','Not\x20found','isNil','info','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','destroy','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','then','sendStatus','name','index','map','ScreenRecording','rawAttributes','type','key','model','differenceBy','format','query','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick','merge','VIRTUAL','options','includeAll','include'];(function(_0x489b87,_0xd51c93){var _0x1823b6=function(_0x451c70){while(--_0x451c70){_0x489b87['push'](_0x489b87['shift']());}};_0x1823b6(++_0xd51c93);}(_0x4c4e,0x152));var _0xe4c4=function(_0x394a99,_0x26cb6a){_0x394a99=_0x394a99-0x0;var _0x269d9c=_0x4c4e[_0x394a99];return _0x269d9c;};'use strict';var emlformat=require(_0xe4c4('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xe4c4('0x1'));var jsonpatch=require(_0xe4c4('0x2'));var rp=require(_0xe4c4('0x3'));var moment=require('moment');var BPromise=require(_0xe4c4('0x4'));var Mustache=require(_0xe4c4('0x5'));var util=require(_0xe4c4('0x6'));var path=require('path');var sox=require(_0xe4c4('0x7'));var csv=require('to-csv');var ejs=require(_0xe4c4('0x8'));var fs=require('fs');var fs_extra=require(_0xe4c4('0x9'));var _=require(_0xe4c4('0xa'));var squel=require(_0xe4c4('0xb'));var crypto=require(_0xe4c4('0xc'));var jsforce=require(_0xe4c4('0xd'));var deskjs=require(_0xe4c4('0xe'));var toCsv=require(_0xe4c4('0xf'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xe4c4('0x10'));var authService=require(_0xe4c4('0x11'));var qs=require(_0xe4c4('0x12'));var as=require(_0xe4c4('0x13'));var hardwareService=require(_0xe4c4('0x14'));var logger=require(_0xe4c4('0x15'))('api');var utils=require(_0xe4c4('0x16'));var config=require(_0xe4c4('0x17'));var licenseUtil=require(_0xe4c4('0x18'));var db=require(_0xe4c4('0x19'))['db'];function respondWithStatusCode(_0x50bfab,_0x262083){_0x262083=_0x262083||0xcc;return function(_0x115802){if(_0x115802){return _0x50bfab['sendStatus'](_0x262083);}return _0x50bfab[_0xe4c4('0x1a')](_0x262083)[_0xe4c4('0x1b')]();};}function respondWithResult(_0x5aa89b,_0x42ce9e){_0x42ce9e=_0x42ce9e||0xc8;return function(_0x29766a){if(_0x29766a){return _0x5aa89b['status'](_0x42ce9e)[_0xe4c4('0x1c')](_0x29766a);}};}function respondWithFilteredResult(_0x465c9b,_0x26ea05){return function(_0x40a36e){if(_0x40a36e){var _0x19e59b=typeof _0x26ea05[_0xe4c4('0x1d')]===_0xe4c4('0x1e')&&typeof _0x26ea05[_0xe4c4('0x1f')]===_0xe4c4('0x1e');var _0x36b10c=_0x40a36e[_0xe4c4('0x20')];var _0x42242c=_0x19e59b?0x0:_0x26ea05[_0xe4c4('0x1d')];var _0x43a9ce=_0x19e59b?_0x40a36e[_0xe4c4('0x20')]:_0x26ea05['offset']+_0x26ea05[_0xe4c4('0x1f')];var _0x24f946;if(_0x43a9ce>=_0x36b10c){_0x43a9ce=_0x36b10c;_0x24f946=0xc8;}else{_0x24f946=0xce;}_0x465c9b[_0xe4c4('0x1a')](_0x24f946);return _0x465c9b[_0xe4c4('0x21')]('Content-Range',_0x42242c+'-'+_0x43a9ce+'/'+_0x36b10c)[_0xe4c4('0x1c')](_0x40a36e);}return null;};}function patchUpdates(_0x1cad5d){return function(_0x1727eb){try{jsonpatch[_0xe4c4('0x22')](_0x1727eb,_0x1cad5d,!![]);}catch(_0x2c5aea){return BPromise[_0xe4c4('0x23')](_0x2c5aea);}return _0x1727eb[_0xe4c4('0x24')]();};}function saveUpdates(_0x393c96,_0x21bbb1){return function(_0x1a7690){if(_0x1a7690){return _0x1a7690[_0xe4c4('0x25')](_0x393c96)[_0xe4c4('0x26')](function(_0x138ead){return _0x138ead;});}return null;};}function removeEntity(_0x1db719,_0x15873e){return function(_0x59498e){if(_0x59498e){return _0x59498e['destroy']()[_0xe4c4('0x26')](function(){_0x1db719['status'](0xcc)[_0xe4c4('0x1b')]();});}};}function handleEntityNotFound(_0x5374fd,_0x3adfcb){return function(_0x5efc4c){if(!_0x5efc4c){_0x5374fd[_0xe4c4('0x27')](0x194);}return _0x5efc4c;};}function handleError(_0x583393,_0xba53ef){_0xba53ef=_0xba53ef||0x1f4;return function(_0x4a0199){logger['error'](_0x4a0199['stack']);if(_0x4a0199['name']){delete _0x4a0199[_0xe4c4('0x28')];}_0x583393['status'](_0xba53ef)['send'](_0x4a0199);};}exports[_0xe4c4('0x29')]=function(_0x11deab,_0x4bb911){var _0x57ba43={},_0x7428ad={},_0x33de43={'count':0x0,'rows':[]};var _0x4aa6c1=_[_0xe4c4('0x2a')](db[_0xe4c4('0x2b')][_0xe4c4('0x2c')],function(_0x48060e){return{'name':_0x48060e['fieldName'],'type':_0x48060e[_0xe4c4('0x2d')][_0xe4c4('0x2e')]};});_0x7428ad[_0xe4c4('0x2f')]=_[_0xe4c4('0x30')](_['map'](_0x4aa6c1,'name'),[_0xe4c4('0x31')]);_0x7428ad[_0xe4c4('0x32')]=_['keys'](_0x11deab[_0xe4c4('0x32')]);_0x7428ad[_0xe4c4('0x33')]=_[_0xe4c4('0x34')](_0x7428ad['model'],_0x7428ad[_0xe4c4('0x32')]);_0x57ba43['attributes']=_[_0xe4c4('0x34')](_0x7428ad[_0xe4c4('0x2f')],qs[_0xe4c4('0x35')](_0x11deab[_0xe4c4('0x32')][_0xe4c4('0x35')]));_0x57ba43[_0xe4c4('0x36')]=_0x57ba43[_0xe4c4('0x36')][_0xe4c4('0x37')]?_0x57ba43[_0xe4c4('0x36')]:_0x7428ad[_0xe4c4('0x2f')];if(!_0x11deab[_0xe4c4('0x32')][_0xe4c4('0x38')]('nolimit')){_0x57ba43[_0xe4c4('0x1f')]=qs[_0xe4c4('0x1f')](_0x11deab[_0xe4c4('0x32')]['limit']);_0x57ba43[_0xe4c4('0x1d')]=qs[_0xe4c4('0x1d')](_0x11deab[_0xe4c4('0x32')]['offset']);}_0x57ba43[_0xe4c4('0x39')]=qs[_0xe4c4('0x3a')](_0x11deab[_0xe4c4('0x32')][_0xe4c4('0x3a')]);_0x57ba43[_0xe4c4('0x3b')]=qs[_0xe4c4('0x33')](_[_0xe4c4('0x3c')](_0x11deab[_0xe4c4('0x32')],_0x7428ad[_0xe4c4('0x33')]),_0x4aa6c1);if(_0x11deab[_0xe4c4('0x32')]['filter']){_0x57ba43[_0xe4c4('0x3b')]=_[_0xe4c4('0x3d')](_0x57ba43[_0xe4c4('0x3b')],{'$or':_[_0xe4c4('0x2a')](_0x4aa6c1,function(_0x4c5551){if(_0x4c5551[_0xe4c4('0x2d')]!==_0xe4c4('0x3e')){var _0x4e6bd9={};_0x4e6bd9[_0x4c5551[_0xe4c4('0x28')]]={'$like':'%'+_0x11deab[_0xe4c4('0x32')]['filter']+'%'};return _0x4e6bd9;}})});}_0x57ba43=_[_0xe4c4('0x3d')]({},_0x57ba43,_0x11deab[_0xe4c4('0x3f')]);var _0x127bcd={'where':_0x57ba43[_0xe4c4('0x3b')]};return db[_0xe4c4('0x2b')][_0xe4c4('0x20')](_0x127bcd)[_0xe4c4('0x26')](function(_0x43201e){_0x33de43[_0xe4c4('0x20')]=_0x43201e;if(_0x11deab[_0xe4c4('0x32')][_0xe4c4('0x40')]){_0x57ba43[_0xe4c4('0x41')]=[{'all':!![]}];}return db['ScreenRecording'][_0xe4c4('0x42')](_0x57ba43);})[_0xe4c4('0x26')](function(_0x2b306d){_0x33de43[_0xe4c4('0x43')]=_0x2b306d;return _0x33de43;})[_0xe4c4('0x26')](respondWithFilteredResult(_0x4bb911,_0x57ba43))[_0xe4c4('0x44')](handleError(_0x4bb911,null));};exports['show']=function(_0x312a49,_0x526bef){var _0xca07dc={'raw':![],'where':{'id':_0x312a49[_0xe4c4('0x45')]['id']}},_0x3c067a={};_0x3c067a[_0xe4c4('0x2f')]=_[_0xe4c4('0x46')](db['ScreenRecording']['rawAttributes']);_0x3c067a[_0xe4c4('0x32')]=_[_0xe4c4('0x46')](_0x312a49[_0xe4c4('0x32')]);_0x3c067a['filters']=_[_0xe4c4('0x34')](_0x3c067a[_0xe4c4('0x2f')],_0x3c067a[_0xe4c4('0x32')]);_0xca07dc[_0xe4c4('0x36')]=_['intersection'](_0x3c067a[_0xe4c4('0x2f')],qs[_0xe4c4('0x35')](_0x312a49[_0xe4c4('0x32')][_0xe4c4('0x35')]));_0xca07dc[_0xe4c4('0x36')]=_0xca07dc[_0xe4c4('0x36')][_0xe4c4('0x37')]?_0xca07dc[_0xe4c4('0x36')]:_0x3c067a[_0xe4c4('0x2f')];if(_0x312a49['query'][_0xe4c4('0x40')]){_0xca07dc['include']=[{'all':!![]}];}_0xca07dc=_[_0xe4c4('0x3d')]({},_0xca07dc,_0x312a49[_0xe4c4('0x3f')]);return db[_0xe4c4('0x2b')][_0xe4c4('0x47')](_0xca07dc)[_0xe4c4('0x26')](handleEntityNotFound(_0x526bef,null))[_0xe4c4('0x26')](respondWithResult(_0x526bef,null))[_0xe4c4('0x44')](handleError(_0x526bef,null));};exports[_0xe4c4('0x48')]=function(_0x36f8ad,_0x18fb82){return db[_0xe4c4('0x2b')][_0xe4c4('0x48')](_0x36f8ad[_0xe4c4('0x49')],{})[_0xe4c4('0x26')](respondWithResult(_0x18fb82,0xc9))['catch'](handleError(_0x18fb82,null));};exports['update']=function(_0xe0e351,_0x198961){if(_0xe0e351['body']['id']){delete _0xe0e351[_0xe4c4('0x49')]['id'];}delete _0xe0e351[_0xe4c4('0x49')][_0xe4c4('0x4a')];delete _0xe0e351[_0xe4c4('0x49')][_0xe4c4('0x4b')];delete _0xe0e351['body'][_0xe4c4('0x4c')];delete _0xe0e351[_0xe4c4('0x49')]['value'];return db[_0xe4c4('0x2b')][_0xe4c4('0x47')]({'where':{'id':_0xe0e351['params']['id']}})[_0xe4c4('0x26')](handleEntityNotFound(_0x198961,null))['then'](saveUpdates(_0xe0e351[_0xe4c4('0x49')],null))[_0xe4c4('0x26')](respondWithResult(_0x198961,null))[_0xe4c4('0x44')](handleError(_0x198961,null));};exports[_0xe4c4('0x4d')]=function(_0x12eaed,_0x525534){return db[_0xe4c4('0x2b')][_0xe4c4('0x4d')]()[_0xe4c4('0x26')](respondWithResult(_0x525534,null))[_0xe4c4('0x44')](handleError(_0x525534,null));};exports[_0xe4c4('0x4e')]=function(_0x32a50e,_0x3ddcbe,_0x3aa205){var _0x1a96ba=require(_0xe4c4('0x4f'));var _0x1fe354=![];var _0x1940e3={};if(_0x32a50e[_0xe4c4('0x32')][_0xe4c4('0x2d')]&&_0x32a50e[_0xe4c4('0x32')][_0xe4c4('0x2d')]==='uniqueid'){_0x1940e3[_0xe4c4('0x50')]=_0x32a50e[_0xe4c4('0x45')]['id'];}else{_0x1940e3['id']=_0x32a50e[_0xe4c4('0x45')]['id'];}return db['ScreenRecording'][_0xe4c4('0x47')]({'where':_0x1940e3,'attributes':['id',_0xe4c4('0x51')],'raw':!![]})[_0xe4c4('0x26')](handleEntityNotFound(_0x3ddcbe,null))['then'](function(_0x45f959){if(_0x45f959){var _0x485c50=path[_0xe4c4('0x52')](config[_0xe4c4('0x53')],_0xe4c4('0x54'),_0x45f959['value']);var _0x479361=util[_0xe4c4('0x31')](_0xe4c4('0x55'),_0x485c50);if(fs[_0xe4c4('0x56')](_0x479361)){_0x1fe354=!![];return _0x1a96ba['decryptFile'](_0x479361,_0x485c50,config[_0xe4c4('0x57')]['recording'])['then'](function(){return _0x45f959;});}return _0x45f959;}})['then'](function(_0x4e08ec){if(_0x4e08ec){var _0x1ca931=path[_0xe4c4('0x52')](config[_0xe4c4('0x53')],_0xe4c4('0x54'),_0x4e08ec[_0xe4c4('0x51')]);if(!fs[_0xe4c4('0x56')](_0x1ca931)){throw new db['Sequelize'][(_0xe4c4('0x58'))](_0xe4c4('0x59'));}if(_0x4e08ec[_0xe4c4('0x5a')]){return _0x3ddcbe[_0xe4c4('0x4e')](_0x1ca931,_0x4e08ec[_0xe4c4('0x5a')]+path[_0xe4c4('0x5b')](_0x1ca931),function(){if(_0x1fe354){fs['unlink'](_0x1ca931);}});}else{return _0x3ddcbe['download'](_0x1ca931,function(_0x27599b){if(_0x1fe354){fs[_0xe4c4('0x5c')](_0x1ca931);}});}}})[_0xe4c4('0x44')](function(_0x3c8e44){if(_0x3c8e44[_0xe4c4('0x5d')]===_0xe4c4('0x59')){_0x3ddcbe[_0xe4c4('0x1a')](0x194)[_0xe4c4('0x5e')](_0xe4c4('0x5f'));}else{return handleError(_0x3ddcbe,null);}});};exports['destroy']=function(_0x59f033,_0x5a4138){return db['ScreenRecording'][_0xe4c4('0x47')]({'where':{'id':_0x59f033[_0xe4c4('0x45')]['id']}})[_0xe4c4('0x26')](function(_0x58f2dd){if(_[_0xe4c4('0x60')](_0x58f2dd)){throw new ReferenceError('Entity\x20not\x20found');}return _0x58f2dd;})[_0xe4c4('0x26')](function(_0x56ead3){var _0x5d6c0a=path[_0xe4c4('0x52')](config[_0xe4c4('0x53')],_0xe4c4('0x54'),_0x56ead3['value']);logger['info']('cancellazione\x20fisica\x20documento\x20%s',_0x5d6c0a);if(!_[_0xe4c4('0x60')](_0x56ead3[_0xe4c4('0x51')])&&fs['existsSync'](_0x5d6c0a)){logger[_0xe4c4('0x61')](_0xe4c4('0x62')+_0x5d6c0a+_0xe4c4('0x63'));fs['unlinkSync'](_0x5d6c0a);}_0x5d6c0a=_0x5d6c0a+'.cypher';if(!_[_0xe4c4('0x60')](_0x56ead3[_0xe4c4('0x51')])&&fs[_0xe4c4('0x56')](_0x5d6c0a)){logger[_0xe4c4('0x61')](_0xe4c4('0x62')+_0x5d6c0a+_0xe4c4('0x63'));fs['unlinkSync'](_0x5d6c0a);}return _0x56ead3;})[_0xe4c4('0x26')](function(_0x1bddd5){if(!_0x1bddd5)throw new InternalError();return _0x1bddd5[_0xe4c4('0x64')]();})['then'](function(){_0x5a4138[_0xe4c4('0x1a')](0xcc)[_0xe4c4('0x1b')]();})[_0xe4c4('0x44')](handleError(_0x5a4138,null));}; \ No newline at end of file +var _0xee14=['path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','then','error','stack','name','send','map','rawAttributes','fieldName','type','key','model','differenceBy','format','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','ScreenRecording','includeAll','include','findAll','rows','catch','params','find','create','body','duration','describe','../../components/encryptor','uniqueid','value','server/files/screen_recordings','existsSync','decryptFile','secrets','recording','root','Sequelize','ValidationError','filename','download','unlink','ScreenRecording\x20not\x20found','isNil','Entity\x20not\x20found','join','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util'];(function(_0x1fbfc9,_0x52f08c){var _0x4c95e3=function(_0x4a0448){while(--_0x4a0448){_0x1fbfc9['push'](_0x1fbfc9['shift']());}};_0x4c95e3(++_0x52f08c);}(_0xee14,0x13a));var _0x4ee1=function(_0x490222,_0x1c44ba){_0x490222=_0x490222-0x0;var _0x23edaa=_0xee14[_0x490222];return _0x23edaa;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x4ee1('0x0'));var jsonpatch=require(_0x4ee1('0x1'));var rp=require(_0x4ee1('0x2'));var moment=require(_0x4ee1('0x3'));var BPromise=require(_0x4ee1('0x4'));var Mustache=require(_0x4ee1('0x5'));var util=require(_0x4ee1('0x6'));var path=require(_0x4ee1('0x7'));var sox=require(_0x4ee1('0x8'));var csv=require('to-csv');var ejs=require(_0x4ee1('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4ee1('0xa'));var squel=require(_0x4ee1('0xb'));var crypto=require(_0x4ee1('0xc'));var jsforce=require(_0x4ee1('0xd'));var deskjs=require(_0x4ee1('0xe'));var toCsv=require(_0x4ee1('0xf'));var querystring=require('querystring');var Papa=require(_0x4ee1('0x10'));var Redis=require(_0x4ee1('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x4ee1('0x12'));var as=require(_0x4ee1('0x13'));var hardwareService=require(_0x4ee1('0x14'));var logger=require(_0x4ee1('0x15'))('api');var utils=require(_0x4ee1('0x16'));var config=require(_0x4ee1('0x17'));var licenseUtil=require(_0x4ee1('0x18'));var db=require(_0x4ee1('0x19'))['db'];function respondWithStatusCode(_0x2f864e,_0x174427){_0x174427=_0x174427||0xcc;return function(_0x5616d6){if(_0x5616d6){return _0x2f864e[_0x4ee1('0x1a')](_0x174427);}return _0x2f864e[_0x4ee1('0x1b')](_0x174427)[_0x4ee1('0x1c')]();};}function respondWithResult(_0x24a915,_0x46d2c2){_0x46d2c2=_0x46d2c2||0xc8;return function(_0x1c342a){if(_0x1c342a){return _0x24a915[_0x4ee1('0x1b')](_0x46d2c2)[_0x4ee1('0x1d')](_0x1c342a);}};}function respondWithFilteredResult(_0xb7eafd,_0x4e3490){return function(_0x2f9194){if(_0x2f9194){var _0x38008f=typeof _0x4e3490[_0x4ee1('0x1e')]===_0x4ee1('0x1f')&&typeof _0x4e3490[_0x4ee1('0x20')]===_0x4ee1('0x1f');var _0x2eff91=_0x2f9194[_0x4ee1('0x21')];var _0x360056=_0x38008f?0x0:_0x4e3490[_0x4ee1('0x1e')];var _0x274de5=_0x38008f?_0x2f9194['count']:_0x4e3490[_0x4ee1('0x1e')]+_0x4e3490[_0x4ee1('0x20')];var _0x173388;if(_0x274de5>=_0x2eff91){_0x274de5=_0x2eff91;_0x173388=0xc8;}else{_0x173388=0xce;}_0xb7eafd[_0x4ee1('0x1b')](_0x173388);return _0xb7eafd[_0x4ee1('0x22')](_0x4ee1('0x23'),_0x360056+'-'+_0x274de5+'/'+_0x2eff91)['json'](_0x2f9194);}return null;};}function patchUpdates(_0x8a631f){return function(_0x333e96){try{jsonpatch[_0x4ee1('0x24')](_0x333e96,_0x8a631f,!![]);}catch(_0x3f0d59){return BPromise[_0x4ee1('0x25')](_0x3f0d59);}return _0x333e96[_0x4ee1('0x26')]();};}function saveUpdates(_0x328f21,_0x40fd98){return function(_0x1dc1a8){if(_0x1dc1a8){return _0x1dc1a8[_0x4ee1('0x27')](_0x328f21)['then'](function(_0x53d43f){return _0x53d43f;});}return null;};}function removeEntity(_0x14110c,_0x459e2e){return function(_0xaf87e7){if(_0xaf87e7){return _0xaf87e7[_0x4ee1('0x28')]()[_0x4ee1('0x29')](function(){_0x14110c[_0x4ee1('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5cc0b5,_0x442c71){return function(_0x28b7e1){if(!_0x28b7e1){_0x5cc0b5['sendStatus'](0x194);}return _0x28b7e1;};}function handleError(_0x35900d,_0x213db8){_0x213db8=_0x213db8||0x1f4;return function(_0x36654c){logger[_0x4ee1('0x2a')](_0x36654c[_0x4ee1('0x2b')]);if(_0x36654c[_0x4ee1('0x2c')]){delete _0x36654c[_0x4ee1('0x2c')];}_0x35900d['status'](_0x213db8)[_0x4ee1('0x2d')](_0x36654c);};}exports['index']=function(_0x4746c2,_0x4ec408){var _0x3dc870={},_0x1d91be={},_0x59a34e={'count':0x0,'rows':[]};var _0x13944c=_[_0x4ee1('0x2e')](db['ScreenRecording'][_0x4ee1('0x2f')],function(_0x5b3792){return{'name':_0x5b3792[_0x4ee1('0x30')],'type':_0x5b3792[_0x4ee1('0x31')][_0x4ee1('0x32')]};});_0x1d91be[_0x4ee1('0x33')]=_[_0x4ee1('0x34')](_['map'](_0x13944c,_0x4ee1('0x2c')),[_0x4ee1('0x35')]);_0x1d91be[_0x4ee1('0x36')]=_[_0x4ee1('0x37')](_0x4746c2[_0x4ee1('0x36')]);_0x1d91be[_0x4ee1('0x38')]=_['intersection'](_0x1d91be['model'],_0x1d91be[_0x4ee1('0x36')]);_0x3dc870[_0x4ee1('0x39')]=_[_0x4ee1('0x3a')](_0x1d91be['model'],qs[_0x4ee1('0x3b')](_0x4746c2[_0x4ee1('0x36')][_0x4ee1('0x3b')]));_0x3dc870[_0x4ee1('0x39')]=_0x3dc870[_0x4ee1('0x39')][_0x4ee1('0x3c')]?_0x3dc870[_0x4ee1('0x39')]:_0x1d91be[_0x4ee1('0x33')];if(!_0x4746c2[_0x4ee1('0x36')][_0x4ee1('0x3d')](_0x4ee1('0x3e'))){_0x3dc870[_0x4ee1('0x20')]=qs[_0x4ee1('0x20')](_0x4746c2['query'][_0x4ee1('0x20')]);_0x3dc870[_0x4ee1('0x1e')]=qs[_0x4ee1('0x1e')](_0x4746c2['query']['offset']);}_0x3dc870[_0x4ee1('0x3f')]=qs[_0x4ee1('0x40')](_0x4746c2[_0x4ee1('0x36')][_0x4ee1('0x40')]);_0x3dc870['where']=qs[_0x4ee1('0x38')](_[_0x4ee1('0x41')](_0x4746c2[_0x4ee1('0x36')],_0x1d91be[_0x4ee1('0x38')]),_0x13944c);if(_0x4746c2[_0x4ee1('0x36')][_0x4ee1('0x42')]){_0x3dc870[_0x4ee1('0x43')]=_[_0x4ee1('0x44')](_0x3dc870['where'],{'$or':_[_0x4ee1('0x2e')](_0x13944c,function(_0x1116b4){if(_0x1116b4[_0x4ee1('0x31')]!==_0x4ee1('0x45')){var _0x45bb22={};_0x45bb22[_0x1116b4[_0x4ee1('0x2c')]]={'$like':'%'+_0x4746c2['query'][_0x4ee1('0x42')]+'%'};return _0x45bb22;}})});}_0x3dc870=_[_0x4ee1('0x44')]({},_0x3dc870,_0x4746c2[_0x4ee1('0x46')]);var _0x333690={'where':_0x3dc870[_0x4ee1('0x43')]};return db[_0x4ee1('0x47')][_0x4ee1('0x21')](_0x333690)[_0x4ee1('0x29')](function(_0x23bb5f){_0x59a34e[_0x4ee1('0x21')]=_0x23bb5f;if(_0x4746c2[_0x4ee1('0x36')][_0x4ee1('0x48')]){_0x3dc870[_0x4ee1('0x49')]=[{'all':!![]}];}return db['ScreenRecording'][_0x4ee1('0x4a')](_0x3dc870);})[_0x4ee1('0x29')](function(_0x5ee7b4){_0x59a34e[_0x4ee1('0x4b')]=_0x5ee7b4;return _0x59a34e;})['then'](respondWithFilteredResult(_0x4ec408,_0x3dc870))[_0x4ee1('0x4c')](handleError(_0x4ec408,null));};exports['show']=function(_0x14c333,_0xc7580c){var _0x557126={'raw':![],'where':{'id':_0x14c333[_0x4ee1('0x4d')]['id']}},_0x25d683={};_0x25d683[_0x4ee1('0x33')]=_[_0x4ee1('0x37')](db['ScreenRecording'][_0x4ee1('0x2f')]);_0x25d683[_0x4ee1('0x36')]=_[_0x4ee1('0x37')](_0x14c333['query']);_0x25d683['filters']=_[_0x4ee1('0x3a')](_0x25d683[_0x4ee1('0x33')],_0x25d683[_0x4ee1('0x36')]);_0x557126[_0x4ee1('0x39')]=_[_0x4ee1('0x3a')](_0x25d683['model'],qs['fields'](_0x14c333[_0x4ee1('0x36')][_0x4ee1('0x3b')]));_0x557126[_0x4ee1('0x39')]=_0x557126[_0x4ee1('0x39')]['length']?_0x557126[_0x4ee1('0x39')]:_0x25d683[_0x4ee1('0x33')];if(_0x14c333['query'][_0x4ee1('0x48')]){_0x557126[_0x4ee1('0x49')]=[{'all':!![]}];}_0x557126=_[_0x4ee1('0x44')]({},_0x557126,_0x14c333[_0x4ee1('0x46')]);return db[_0x4ee1('0x47')][_0x4ee1('0x4e')](_0x557126)[_0x4ee1('0x29')](handleEntityNotFound(_0xc7580c,null))[_0x4ee1('0x29')](respondWithResult(_0xc7580c,null))[_0x4ee1('0x4c')](handleError(_0xc7580c,null));};exports['create']=function(_0x49b667,_0x1a972b){return db[_0x4ee1('0x47')][_0x4ee1('0x4f')](_0x49b667[_0x4ee1('0x50')],{})['then'](respondWithResult(_0x1a972b,0xc9))[_0x4ee1('0x4c')](handleError(_0x1a972b,null));};exports[_0x4ee1('0x27')]=function(_0x42dd8d,_0x2bc77f){if(_0x42dd8d[_0x4ee1('0x50')]['id']){delete _0x42dd8d['body']['id'];}delete _0x42dd8d[_0x4ee1('0x50')][_0x4ee1('0x51')];delete _0x42dd8d[_0x4ee1('0x50')]['createdAt'];delete _0x42dd8d[_0x4ee1('0x50')]['closedAt'];delete _0x42dd8d[_0x4ee1('0x50')]['value'];return db[_0x4ee1('0x47')]['find']({'where':{'id':_0x42dd8d[_0x4ee1('0x4d')]['id']}})['then'](handleEntityNotFound(_0x2bc77f,null))[_0x4ee1('0x29')](saveUpdates(_0x42dd8d[_0x4ee1('0x50')],null))[_0x4ee1('0x29')](respondWithResult(_0x2bc77f,null))['catch'](handleError(_0x2bc77f,null));};exports[_0x4ee1('0x52')]=function(_0x4118d7,_0xcdb873){return db[_0x4ee1('0x47')][_0x4ee1('0x52')]()[_0x4ee1('0x29')](respondWithResult(_0xcdb873,null))[_0x4ee1('0x4c')](handleError(_0xcdb873,null));};exports['download']=function(_0x4c4178,_0x1feb78,_0xcddc5d){var _0xf58cd8=require(_0x4ee1('0x53'));var _0x44e65f=![];var _0x31e82d={};if(_0x4c4178[_0x4ee1('0x36')][_0x4ee1('0x31')]&&_0x4c4178[_0x4ee1('0x36')][_0x4ee1('0x31')]===_0x4ee1('0x54')){_0x31e82d[_0x4ee1('0x54')]=_0x4c4178[_0x4ee1('0x4d')]['id'];}else{_0x31e82d['id']=_0x4c4178['params']['id'];}return db[_0x4ee1('0x47')]['find']({'where':_0x31e82d,'attributes':['id',_0x4ee1('0x55')],'raw':!![]})[_0x4ee1('0x29')](handleEntityNotFound(_0x1feb78,null))['then'](function(_0x1e0aac){if(_0x1e0aac){var _0x184e36=path['join'](config['root'],_0x4ee1('0x56'),_0x1e0aac['value']);var _0x1ce99e=util[_0x4ee1('0x35')]('%s.cypher',_0x184e36);if(fs[_0x4ee1('0x57')](_0x1ce99e)){_0x44e65f=!![];return _0xf58cd8[_0x4ee1('0x58')](_0x1ce99e,_0x184e36,config[_0x4ee1('0x59')][_0x4ee1('0x5a')])[_0x4ee1('0x29')](function(){return _0x1e0aac;});}return _0x1e0aac;}})[_0x4ee1('0x29')](function(_0x11f619){if(_0x11f619){var _0x5f5694=path['join'](config[_0x4ee1('0x5b')],_0x4ee1('0x56'),_0x11f619['value']);if(!fs[_0x4ee1('0x57')](_0x5f5694)){throw new db[(_0x4ee1('0x5c'))][(_0x4ee1('0x5d'))]('ScreenRecording\x20not\x20found');}if(_0x11f619[_0x4ee1('0x5e')]){return _0x1feb78['download'](_0x5f5694,_0x11f619[_0x4ee1('0x5e')]+path['extname'](_0x5f5694),function(){if(_0x44e65f){fs['unlink'](_0x5f5694);}});}else{return _0x1feb78[_0x4ee1('0x5f')](_0x5f5694,function(_0x16fcd0){if(_0x44e65f){fs[_0x4ee1('0x60')](_0x5f5694);}});}}})[_0x4ee1('0x4c')](function(_0x38e889){if(_0x38e889['message']===_0x4ee1('0x61')){_0x1feb78[_0x4ee1('0x1b')](0x194)[_0x4ee1('0x2d')]('Not\x20found');}else{return handleError(_0x1feb78,null);}});};exports[_0x4ee1('0x28')]=function(_0x109dc6,_0x3fdd61){return db[_0x4ee1('0x47')][_0x4ee1('0x4e')]({'where':{'id':_0x109dc6[_0x4ee1('0x4d')]['id']}})[_0x4ee1('0x29')](function(_0x20ca0b){if(_[_0x4ee1('0x62')](_0x20ca0b)){throw new ReferenceError(_0x4ee1('0x63'));}return _0x20ca0b;})[_0x4ee1('0x29')](function(_0x38e86f){var _0x5d396c=path[_0x4ee1('0x64')](config['root'],_0x4ee1('0x56'),_0x38e86f['value']);logger[_0x4ee1('0x65')](_0x4ee1('0x66'),_0x5d396c);if(!_[_0x4ee1('0x62')](_0x38e86f[_0x4ee1('0x55')])&&fs[_0x4ee1('0x57')](_0x5d396c)){logger[_0x4ee1('0x65')](_0x4ee1('0x67')+_0x5d396c+_0x4ee1('0x68'));fs[_0x4ee1('0x69')](_0x5d396c);}_0x5d396c=_0x5d396c+_0x4ee1('0x6a');if(!_[_0x4ee1('0x62')](_0x38e86f[_0x4ee1('0x55')])&&fs['existsSync'](_0x5d396c)){logger[_0x4ee1('0x65')](_0x4ee1('0x67')+_0x5d396c+_0x4ee1('0x68'));fs['unlinkSync'](_0x5d396c);}return _0x38e86f;})['then'](function(_0x40dac3){if(!_0x40dac3)throw new InternalError();return _0x40dac3[_0x4ee1('0x28')]();})['then'](function(){_0x3fdd61[_0x4ee1('0x1b')](0xcc)[_0x4ee1('0x1c')]();})[_0x4ee1('0x4c')](handleError(_0x3fdd61,null));}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.model.js b/server/api/screenRecording/screenRecording.model.js index 913f0fe..434b644 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 _0x0ac6=['screen_recordings','interactionid','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./screenRecording.attributes','exports','define','ScreenRecording'];(function(_0x4653d8,_0x122e74){var _0x3c67d9=function(_0x4b4c0c){while(--_0x4b4c0c){_0x4653d8['push'](_0x4653d8['shift']());}};_0x3c67d9(++_0x122e74);}(_0x0ac6,0x10c));var _0x60ac=function(_0x14935e,_0x2de650){_0x14935e=_0x14935e-0x0;var _0x15b3bc=_0x0ac6[_0x14935e];return _0x15b3bc;};'use strict';var _=require('lodash');var util=require(_0x60ac('0x0'));var logger=require(_0x60ac('0x1'))(_0x60ac('0x2'));var moment=require(_0x60ac('0x3'));var BPromise=require(_0x60ac('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x60ac('0x5'));var rimraf=require(_0x60ac('0x6'));var config=require(_0x60ac('0x7'));var attributes=require(_0x60ac('0x8'));module[_0x60ac('0x9')]=function(_0xe0a957,_0x5bc46e){return _0xe0a957[_0x60ac('0xa')](_0x60ac('0xb'),attributes,{'tableName':_0x60ac('0xc'),'paranoid':![],'indexes':[{'name':_0x60ac('0xd'),'fields':[_0x60ac('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xe8d5=['./screenRecording.attributes','exports','define','ScreenRecording','interactionid','lodash','../../config/logger','api','moment','request-promise','path','rimraf'];(function(_0x23e108,_0x4e056f){var _0x16bbd8=function(_0x41c4e7){while(--_0x41c4e7){_0x23e108['push'](_0x23e108['shift']());}};_0x16bbd8(++_0x4e056f);}(_0xe8d5,0x125));var _0x5e8d=function(_0x1d24eb,_0x12295b){_0x1d24eb=_0x1d24eb-0x0;var _0x1dc576=_0xe8d5[_0x1d24eb];return _0x1dc576;};'use strict';var _=require(_0x5e8d('0x0'));var util=require('util');var logger=require(_0x5e8d('0x1'))(_0x5e8d('0x2'));var moment=require(_0x5e8d('0x3'));var BPromise=require('bluebird');var rp=require(_0x5e8d('0x4'));var fs=require('fs');var path=require(_0x5e8d('0x5'));var rimraf=require(_0x5e8d('0x6'));var config=require('../../config/environment');var attributes=require(_0x5e8d('0x7'));module[_0x5e8d('0x8')]=function(_0x2c4773,_0x5983f4){return _0x2c4773[_0x5e8d('0x9')](_0x5e8d('0xa'),attributes,{'tableName':'screen_recordings','paranoid':![],'indexes':[{'name':_0x5e8d('0xb'),'fields':[_0x5e8d('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.rpc.js b/server/api/screenRecording/screenRecording.rpc.js index 98fb8db..1b964a1 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 _0x1aa3=['http','request','then','info','ScreenRecording,\x20%s,\x20%s','debug','ScreenRecording,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','util','moment','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise'];(function(_0x2d1f6e,_0x13fdc7){var _0x421074=function(_0x521ea){while(--_0x521ea){_0x2d1f6e['push'](_0x2d1f6e['shift']());}};_0x421074(++_0x13fdc7);}(_0x1aa3,0x103));var _0x31aa=function(_0x51f99e,_0x70684d){_0x51f99e=_0x51f99e-0x0;var _0x5b12cd=_0x1aa3[_0x51f99e];return _0x5b12cd;};'use strict';var _=require('lodash');var util=require(_0x31aa('0x0'));var moment=require(_0x31aa('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x31aa('0x2'))['db'];var utils=require(_0x31aa('0x3'));var logger=require(_0x31aa('0x4'))(_0x31aa('0x5'));var config=require('../../config/environment');var jayson=require(_0x31aa('0x6'));var client=jayson['client'][_0x31aa('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x209114,_0x30bfce,_0x42fcae){return new BPromise(function(_0x169aec,_0x250893){return client[_0x31aa('0x8')](_0x209114,_0x42fcae)[_0x31aa('0x9')](function(_0x2e25ce){logger[_0x31aa('0xa')](_0x31aa('0xb'),_0x30bfce,'request\x20sent');logger[_0x31aa('0xc')](_0x31aa('0xd'),_0x30bfce,'request\x20sent',JSON['stringify'](_0x2e25ce));if(_0x2e25ce['error']){if(_0x2e25ce['error'][_0x31aa('0xe')]===0x1f4){logger['error'](_0x31aa('0xb'),_0x30bfce,_0x2e25ce[_0x31aa('0xf')]['message']);return _0x250893(_0x2e25ce[_0x31aa('0xf')][_0x31aa('0x10')]);}logger[_0x31aa('0xf')]('ScreenRecording,\x20%s,\x20%s',_0x30bfce,_0x2e25ce[_0x31aa('0xf')][_0x31aa('0x10')]);return _0x169aec(_0x2e25ce[_0x31aa('0xf')]['message']);}else{logger[_0x31aa('0xa')](_0x31aa('0xb'),_0x30bfce,'request\x20sent');_0x169aec(_0x2e25ce[_0x31aa('0x11')][_0x31aa('0x10')]);}})[_0x31aa('0x12')](function(_0x11f852){logger[_0x31aa('0xf')](_0x31aa('0xb'),_0x30bfce,_0x11f852);_0x250893(_0x11f852);});});} \ No newline at end of file +var _0xfc0e=['ScreenRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','ScreenRecording,\x20%s,\x20%s','message','info','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request\x20sent','debug'];(function(_0x2f2036,_0x11175){var _0x3aaf7e=function(_0x20961b){while(--_0x20961b){_0x2f2036['push'](_0x2f2036['shift']());}};_0x3aaf7e(++_0x11175);}(_0xfc0e,0x1c1));var _0xefc0=function(_0x507ac5,_0x33aaee){_0x507ac5=_0x507ac5-0x0;var _0x12c1bc=_0xfc0e[_0x507ac5];return _0x12c1bc;};'use strict';var _=require(_0xefc0('0x0'));var util=require('util');var moment=require(_0xefc0('0x1'));var BPromise=require(_0xefc0('0x2'));var rs=require(_0xefc0('0x3'));var fs=require('fs');var Redis=require(_0xefc0('0x4'));var db=require(_0xefc0('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xefc0('0x6'))(_0xefc0('0x7'));var config=require('../../config/environment');var jayson=require(_0xefc0('0x8'));var client=jayson[_0xefc0('0x9')][_0xefc0('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2b2943,_0x514252,_0x4fc2eb){return new BPromise(function(_0x2c275f,_0x4110f6){return client['request'](_0x2b2943,_0x4fc2eb)['then'](function(_0x29bda5){logger['info']('ScreenRecording,\x20%s,\x20%s',_0x514252,_0xefc0('0xb'));logger[_0xefc0('0xc')](_0xefc0('0xd'),_0x514252,_0xefc0('0xb'),JSON[_0xefc0('0xe')](_0x29bda5));if(_0x29bda5['error']){if(_0x29bda5[_0xefc0('0xf')][_0xefc0('0x10')]===0x1f4){logger[_0xefc0('0xf')](_0xefc0('0x11'),_0x514252,_0x29bda5['error'][_0xefc0('0x12')]);return _0x4110f6(_0x29bda5[_0xefc0('0xf')][_0xefc0('0x12')]);}logger['error'](_0xefc0('0x11'),_0x514252,_0x29bda5[_0xefc0('0xf')]['message']);return _0x2c275f(_0x29bda5[_0xefc0('0xf')][_0xefc0('0x12')]);}else{logger[_0xefc0('0x13')](_0xefc0('0x11'),_0x514252,_0xefc0('0xb'));_0x2c275f(_0x29bda5[_0xefc0('0x14')][_0xefc0('0x12')]);}})[_0xefc0('0x15')](function(_0x472af2){logger[_0xefc0('0xf')](_0xefc0('0x11'),_0x514252,_0x472af2);_0x4110f6(_0x472af2);});});} \ No newline at end of file diff --git a/server/api/setting/index.js b/server/api/setting/index.js index b4c6532..dfb3d3a 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 _0xb549=['update','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','getDate','getLogo','/:id/logo_login','getLogoLogin','/:id/gdpr','gdpr','/:id/preferred','getPreferred','/:id/favicon','getFavicon','diskStorage','join','server/files/images/logos/','post','/:id/logo','single','file','addLogo','root','%s%s','extname','originalname','format','favicon','addFavicon','put','/:id','isAuthenticated'];(function(_0x379fc9,_0x4f747b){var _0x3e6a74=function(_0x151511){while(--_0x151511){_0x379fc9['push'](_0x379fc9['shift']());}};_0x3e6a74(++_0x4f747b);}(_0xb549,0x7d));var _0x9b54=function(_0xfb03ae,_0x517e03){_0xfb03ae=_0xfb03ae-0x0;var _0x5cd87f=_0xb549[_0xfb03ae];return _0x5cd87f;};'use strict';var multer=require(_0x9b54('0x0'));var util=require('util');var path=require(_0x9b54('0x1'));var timeout=require(_0x9b54('0x2'));var express=require(_0x9b54('0x3'));var router=express[_0x9b54('0x4')]();var fs_extra=require(_0x9b54('0x5'));var auth=require(_0x9b54('0x6'));var interaction=require(_0x9b54('0x7'));var config=require(_0x9b54('0x8'));var controller=require('./setting.controller');router[_0x9b54('0x9')]('/',auth['isAuthenticated'](),controller[_0x9b54('0xa')]);router[_0x9b54('0x9')]('/now',controller[_0x9b54('0xb')]);router[_0x9b54('0x9')]('/:id',controller['show']);router[_0x9b54('0x9')]('/:id/logo',controller[_0x9b54('0xc')]);router[_0x9b54('0x9')](_0x9b54('0xd'),controller[_0x9b54('0xe')]);router[_0x9b54('0x9')](_0x9b54('0xf'),controller[_0x9b54('0x10')]);router[_0x9b54('0x9')](_0x9b54('0x11'),controller[_0x9b54('0x12')]);router[_0x9b54('0x9')](_0x9b54('0x13'),controller[_0x9b54('0x14')]);var upload=multer({'storage':multer[_0x9b54('0x15')]({'destination':function(_0x45e9d5,_0x50b1e8,_0xc8b2fc){_0xc8b2fc(null,path[_0x9b54('0x16')](config['root'],_0x9b54('0x17')));},'filename':function(_0x32843b,_0xefcd55,_0x309755){_0x309755(null,util['format']('%s%s','logo',path['extname'](_0xefcd55['originalname'])));}})});router[_0x9b54('0x18')](_0x9b54('0x19'),upload[_0x9b54('0x1a')](_0x9b54('0x1b')),controller[_0x9b54('0x1c')]);var upload=multer({'storage':multer[_0x9b54('0x15')]({'destination':function(_0x1af6be,_0x388edd,_0x1faa03){_0x1faa03(null,path[_0x9b54('0x16')](config[_0x9b54('0x1d')],_0x9b54('0x17')));},'filename':function(_0x25638d,_0x51b7b4,_0xd03917){_0xd03917(null,util['format'](_0x9b54('0x1e'),'logologin',path[_0x9b54('0x1f')](_0x51b7b4[_0x9b54('0x20')])));}})});router[_0x9b54('0x18')](_0x9b54('0xd'),upload['single'](_0x9b54('0x1b')),controller['addLogoLogin']);var upload=multer({'storage':multer[_0x9b54('0x15')]({'destination':function(_0x53360a,_0x18c2d4,_0x415a7e){_0x415a7e(null,path[_0x9b54('0x16')](config['root'],_0x9b54('0x17')));},'filename':function(_0x1a2823,_0x22e1ce,_0x3914ac){_0x3914ac(null,util[_0x9b54('0x21')](_0x9b54('0x1e'),'preferred',path[_0x9b54('0x1f')](_0x22e1ce['originalname'])));}})});router[_0x9b54('0x18')](_0x9b54('0x11'),upload[_0x9b54('0x1a')](_0x9b54('0x1b')),controller['addPreferred']);var upload=multer({'storage':multer[_0x9b54('0x15')]({'destination':function(_0x1791df,_0x33198d,_0x20501d){_0x20501d(null,path[_0x9b54('0x16')](config[_0x9b54('0x1d')],_0x9b54('0x17')));},'filename':function(_0x2b0a41,_0x4f0b8c,_0x13e471){_0x13e471(null,util[_0x9b54('0x21')]('%s%s',_0x9b54('0x22'),path[_0x9b54('0x1f')](_0x4f0b8c[_0x9b54('0x20')])));}})});router[_0x9b54('0x18')](_0x9b54('0x13'),upload[_0x9b54('0x1a')](_0x9b54('0x1b')),controller[_0x9b54('0x23')]);router[_0x9b54('0x24')](_0x9b54('0x25'),auth[_0x9b54('0x26')](),controller[_0x9b54('0x27')]);module[_0x9b54('0x28')]=router; \ No newline at end of file +var _0x586f=['path','connect-timeout','../../components/auth/service','../../config/environment','./setting.controller','isAuthenticated','index','get','/now','getDate','show','/:id/logo','getLogo','/:id/logo_login','getLogoLogin','/:id/gdpr','gdpr','/:id/preferred','getPreferred','getFavicon','diskStorage','join','server/files/images/logos/','format','logo','extname','originalname','post','single','addLogo','%s%s','logologin','file','addLogoLogin','root','preferred','addPreferred','favicon','/:id/favicon','addFavicon','update','multer'];(function(_0x322962,_0x36266e){var _0x2de5ff=function(_0x26bc22){while(--_0x26bc22){_0x322962['push'](_0x322962['shift']());}};_0x2de5ff(++_0x36266e);}(_0x586f,0xa7));var _0xf586=function(_0x5db96a,_0x60039){_0x5db96a=_0x5db96a-0x0;var _0x13fdb0=_0x586f[_0x5db96a];return _0x13fdb0;};'use strict';var multer=require(_0xf586('0x0'));var util=require('util');var path=require(_0xf586('0x1'));var timeout=require(_0xf586('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xf586('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0xf586('0x4'));var controller=require(_0xf586('0x5'));router['get']('/',auth[_0xf586('0x6')](),controller[_0xf586('0x7')]);router[_0xf586('0x8')](_0xf586('0x9'),controller[_0xf586('0xa')]);router[_0xf586('0x8')]('/:id',controller[_0xf586('0xb')]);router['get'](_0xf586('0xc'),controller[_0xf586('0xd')]);router[_0xf586('0x8')](_0xf586('0xe'),controller[_0xf586('0xf')]);router[_0xf586('0x8')](_0xf586('0x10'),controller[_0xf586('0x11')]);router[_0xf586('0x8')](_0xf586('0x12'),controller[_0xf586('0x13')]);router[_0xf586('0x8')]('/:id/favicon',controller[_0xf586('0x14')]);var upload=multer({'storage':multer[_0xf586('0x15')]({'destination':function(_0x16fd3e,_0x465522,_0x3a2d0f){_0x3a2d0f(null,path[_0xf586('0x16')](config['root'],_0xf586('0x17')));},'filename':function(_0x264ac9,_0x276d18,_0x4ce144){_0x4ce144(null,util[_0xf586('0x18')]('%s%s',_0xf586('0x19'),path[_0xf586('0x1a')](_0x276d18[_0xf586('0x1b')])));}})});router[_0xf586('0x1c')](_0xf586('0xc'),upload[_0xf586('0x1d')]('file'),controller[_0xf586('0x1e')]);var upload=multer({'storage':multer[_0xf586('0x15')]({'destination':function(_0x48ed0,_0x43557b,_0x47af49){_0x47af49(null,path[_0xf586('0x16')](config['root'],_0xf586('0x17')));},'filename':function(_0x28e115,_0xbf6a4c,_0x210cb8){_0x210cb8(null,util[_0xf586('0x18')](_0xf586('0x1f'),_0xf586('0x20'),path[_0xf586('0x1a')](_0xbf6a4c['originalname'])));}})});router[_0xf586('0x1c')]('/:id/logo_login',upload[_0xf586('0x1d')](_0xf586('0x21')),controller[_0xf586('0x22')]);var upload=multer({'storage':multer[_0xf586('0x15')]({'destination':function(_0x3a5ddf,_0x1191ac,_0x3f0bf2){_0x3f0bf2(null,path[_0xf586('0x16')](config[_0xf586('0x23')],'server/files/images/logos/'));},'filename':function(_0x3b2bc2,_0x4bfdb4,_0xd917e3){_0xd917e3(null,util[_0xf586('0x18')]('%s%s',_0xf586('0x24'),path[_0xf586('0x1a')](_0x4bfdb4['originalname'])));}})});router[_0xf586('0x1c')]('/:id/preferred',upload[_0xf586('0x1d')](_0xf586('0x21')),controller[_0xf586('0x25')]);var upload=multer({'storage':multer[_0xf586('0x15')]({'destination':function(_0x46347d,_0xfaffa7,_0x571fee){_0x571fee(null,path[_0xf586('0x16')](config[_0xf586('0x23')],'server/files/images/logos/'));},'filename':function(_0x30f253,_0x5d2ac7,_0x5c869e){_0x5c869e(null,util[_0xf586('0x18')](_0xf586('0x1f'),_0xf586('0x26'),path[_0xf586('0x1a')](_0x5d2ac7[_0xf586('0x1b')])));}})});router[_0xf586('0x1c')](_0xf586('0x27'),upload[_0xf586('0x1d')]('file'),controller[_0xf586('0x28')]);router['put']('/:id',auth[_0xf586('0x6')](),controller[_0xf586('0x29')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/setting/setting.attributes.js b/server/api/setting/setting.attributes.js index 8a1119d..d81cc1f 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(_0x2ec7c1,_0x5ab32b){var _0x5d5ef1=function(_0x12812b){while(--_0x12812b){_0x2ec7c1['push'](_0x2ec7c1['shift']());}};_0x5d5ef1(++_0x5ab32b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3ce3c,_0x319337){_0x3ce3c=_0x3ce3c-0x0;var _0x55a2c9=_0xa9e0[_0x3ce3c];return _0x55a2c9;};'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(_0x565ad8,_0x3c40b8){var _0x50b54c=function(_0x58dc63){while(--_0x58dc63){_0x565ad8['push'](_0x565ad8['shift']());}};_0x50b54c(++_0x3c40b8);}(_0xa9e0,0x123));var _0x0a9e=function(_0x173d7e,_0x3242fd){_0x173d7e=_0x173d7e-0x0;var _0x2220d6=_0xa9e0[_0x173d7e];return _0x2220d6;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'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 952c77e..1ef70d9 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 _0xe8a4=['bluebird','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','http','request','then','Setting,\x20%s,\x20%s','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','sendStatus','end','json','undefined','limit','count','offset','save','destroy','status','stack','name','map','Setting','rawAttributes','fieldName','type','query','keys','filters','intersection','model','attributes','length','nolimit','order','sort','filter','where','merge','options','findAll','rows','catch','params','fields','includeAll','include','body','find','file','filename','loginLogo','getLogo','server/files/images/logos','logo','preferred','defaultLogo','defaultLoginLogo','defaultPreferred','defaultFavicon','existsSync','join','root','toLower','default','upperFirst','custom','Sequelize','ValidationError','\x20not\x20found','download','getLogoLogin','favicon','default_loginLogo.svg','gdpr','securePassword','addPreferred','getPreferred','getLicense','default_preferred.png','addFavicon','getFavicon','default_favicon.ico','getDate','utcOffset','YYYY-MM-DD\x20HH:mm:ss:SSS','send','eml-format','zip-dir','request-promise','moment'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0xe8a4,0x158));var _0x4e8a=function(_0x311c35,_0x534915){_0x311c35=_0x311c35-0x0;var _0x5cc50c=_0xe8a4[_0x311c35];return _0x5cc50c;};'use strict';var emlformat=require(_0x4e8a('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x4e8a('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4e8a('0x2'));var moment=require(_0x4e8a('0x3'));var BPromise=require(_0x4e8a('0x4'));var Mustache=require('mustache');var util=require(_0x4e8a('0x5'));var path=require(_0x4e8a('0x6'));var sox=require('sox');var csv=require(_0x4e8a('0x7'));var ejs=require(_0x4e8a('0x8'));var fs=require('fs');var fs_extra=require(_0x4e8a('0x9'));var _=require(_0x4e8a('0xa'));var squel=require(_0x4e8a('0xb'));var crypto=require(_0x4e8a('0xc'));var jsforce=require(_0x4e8a('0xd'));var deskjs=require(_0x4e8a('0xe'));var toCsv=require(_0x4e8a('0x7'));var querystring=require(_0x4e8a('0xf'));var Papa=require('papaparse');var Redis=require(_0x4e8a('0x10'));var authService=require(_0x4e8a('0x11'));var qs=require(_0x4e8a('0x12'));var as=require(_0x4e8a('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x4e8a('0x14'))(_0x4e8a('0x15'));var utils=require('../../config/utils');var config=require(_0x4e8a('0x16'));var licenseUtil=require(_0x4e8a('0x17'));var db=require(_0x4e8a('0x18'))['db'];var jayson=require(_0x4e8a('0x19'));var client=jayson['client'][_0x4e8a('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x4f04d5,_0x39be1d,_0x25a431,_0x4270fb){return new BPromise(function(_0x4e5e38,_0x6e7291){var _0x4d342c=_0x4270fb||client;return _0x4d342c[_0x4e8a('0x1b')](_0x4f04d5,_0x25a431)[_0x4e8a('0x1c')](function(_0x61acb9){logger['info'](_0x4e8a('0x1d'),_0x39be1d,_0x4e8a('0x1e'));logger[_0x4e8a('0x1f')](_0x4e8a('0x20'),_0x39be1d,'request\x20sent',JSON[_0x4e8a('0x21')](_0x61acb9));if(_0x61acb9['error']){if(_0x61acb9[_0x4e8a('0x22')][_0x4e8a('0x23')]===0x1f4){logger[_0x4e8a('0x22')](_0x4e8a('0x1d'),_0x39be1d,_0x61acb9[_0x4e8a('0x22')][_0x4e8a('0x24')]);return _0x6e7291(_0x61acb9[_0x4e8a('0x22')][_0x4e8a('0x24')]);}logger[_0x4e8a('0x22')]('Setting,\x20%s,\x20%s',_0x39be1d,_0x61acb9['error']['message']);return _0x4e5e38(_0x61acb9[_0x4e8a('0x22')][_0x4e8a('0x24')]);}else{logger[_0x4e8a('0x25')](_0x4e8a('0x1d'),_0x39be1d,_0x4e8a('0x1e'));_0x4e5e38(_0x61acb9['result']['message']);}})['catch'](function(_0x4955f9){logger[_0x4e8a('0x22')](_0x4e8a('0x1d'),_0x39be1d,_0x4955f9);_0x6e7291(_0x4955f9);});});}function respondWithStatusCode(_0x2a8948,_0x590b58){_0x590b58=_0x590b58||0xcc;return function(_0x1c2ce7){if(_0x1c2ce7){return _0x2a8948[_0x4e8a('0x26')](_0x590b58);}return _0x2a8948['status'](_0x590b58)[_0x4e8a('0x27')]();};}function respondWithResult(_0x3c80de,_0x50a80a){_0x50a80a=_0x50a80a||0xc8;return function(_0x1c6598){if(_0x1c6598){return _0x3c80de['status'](_0x50a80a)[_0x4e8a('0x28')](_0x1c6598);}};}function respondWithFilteredResult(_0x34b531,_0x3a9d32){return function(_0x690b4f){if(_0x690b4f){var _0x4a664f=typeof _0x3a9d32['offset']===_0x4e8a('0x29')&&typeof _0x3a9d32[_0x4e8a('0x2a')]==='undefined';var _0x3339ee=_0x690b4f['count'];var _0x1d22d5=_0x4a664f?0x0:_0x3a9d32['offset'];var _0x2d1e63=_0x4a664f?_0x690b4f[_0x4e8a('0x2b')]:_0x3a9d32[_0x4e8a('0x2c')]+_0x3a9d32[_0x4e8a('0x2a')];var _0x47190d;if(_0x2d1e63>=_0x3339ee){_0x2d1e63=_0x3339ee;_0x47190d=0xc8;}else{_0x47190d=0xce;}_0x34b531['status'](_0x47190d);return _0x34b531['set']('Content-Range',_0x1d22d5+'-'+_0x2d1e63+'/'+_0x3339ee)[_0x4e8a('0x28')](_0x690b4f);}return null;};}function patchUpdates(_0x2473b5){return function(_0x2a3703){try{jsonpatch['apply'](_0x2a3703,_0x2473b5,!![]);}catch(_0x3ebc0c){return BPromise['reject'](_0x3ebc0c);}return _0x2a3703[_0x4e8a('0x2d')]();};}function saveUpdates(_0x539b96,_0x4f8161){return function(_0x4c4c22){if(_0x4c4c22){return _0x4c4c22['update'](_0x539b96)[_0x4e8a('0x1c')](function(_0x3647df){return _0x3647df;});}return null;};}function removeEntity(_0x2177ed,_0x9331dd){return function(_0x2337ae){if(_0x2337ae){return _0x2337ae[_0x4e8a('0x2e')]()[_0x4e8a('0x1c')](function(){_0x2177ed[_0x4e8a('0x2f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x409fc8,_0x4b5f1e){return function(_0x3d9dd2){if(!_0x3d9dd2){_0x409fc8[_0x4e8a('0x26')](0x194);}return _0x3d9dd2;};}function handleError(_0x52ef06,_0x3fd5b9){_0x3fd5b9=_0x3fd5b9||0x1f4;return function(_0x5168b2){logger[_0x4e8a('0x22')](_0x5168b2[_0x4e8a('0x30')]);if(_0x5168b2[_0x4e8a('0x31')]){delete _0x5168b2[_0x4e8a('0x31')];}_0x52ef06['status'](_0x3fd5b9)['send'](_0x5168b2);};}exports['index']=function(_0x17340f,_0x5e79ea){var _0x4693ac={},_0xc4e355={},_0x37ca6e={'count':0x0,'rows':[]};var _0x5564df=_[_0x4e8a('0x32')](db[_0x4e8a('0x33')][_0x4e8a('0x34')],function(_0x297dfb){return{'name':_0x297dfb[_0x4e8a('0x35')],'type':_0x297dfb[_0x4e8a('0x36')]['key']};});_0xc4e355['model']=_['map'](_0x5564df,_0x4e8a('0x31'));_0xc4e355[_0x4e8a('0x37')]=_[_0x4e8a('0x38')](_0x17340f[_0x4e8a('0x37')]);_0xc4e355[_0x4e8a('0x39')]=_[_0x4e8a('0x3a')](_0xc4e355[_0x4e8a('0x3b')],_0xc4e355[_0x4e8a('0x37')]);_0x4693ac['attributes']=_['intersection'](_0xc4e355['model'],qs['fields'](_0x17340f[_0x4e8a('0x37')]['fields']));_0x4693ac[_0x4e8a('0x3c')]=_0x4693ac[_0x4e8a('0x3c')][_0x4e8a('0x3d')]?_0x4693ac['attributes']:_0xc4e355[_0x4e8a('0x3b')];if(!_0x17340f[_0x4e8a('0x37')]['hasOwnProperty'](_0x4e8a('0x3e'))){_0x4693ac[_0x4e8a('0x2a')]=qs['limit'](_0x17340f['query'][_0x4e8a('0x2a')]);_0x4693ac[_0x4e8a('0x2c')]=qs['offset'](_0x17340f[_0x4e8a('0x37')][_0x4e8a('0x2c')]);}_0x4693ac[_0x4e8a('0x3f')]=qs[_0x4e8a('0x40')](_0x17340f[_0x4e8a('0x37')][_0x4e8a('0x40')]);_0x4693ac['where']=qs[_0x4e8a('0x39')](_['pick'](_0x17340f[_0x4e8a('0x37')],_0xc4e355[_0x4e8a('0x39')]),_0x5564df);if(_0x17340f['query'][_0x4e8a('0x41')]){_0x4693ac[_0x4e8a('0x42')]=_[_0x4e8a('0x43')](_0x4693ac[_0x4e8a('0x42')],{'$or':_[_0x4e8a('0x32')](_0x5564df,function(_0x58916c){if(_0x58916c[_0x4e8a('0x36')]!=='VIRTUAL'){var _0x1309bd={};_0x1309bd[_0x58916c['name']]={'$like':'%'+_0x17340f[_0x4e8a('0x37')]['filter']+'%'};return _0x1309bd;}})});}_0x4693ac=_[_0x4e8a('0x43')]({},_0x4693ac,_0x17340f[_0x4e8a('0x44')]);var _0x1d92bb={'where':_0x4693ac['where']};return db[_0x4e8a('0x33')]['count'](_0x1d92bb)['then'](function(_0x3c700c){_0x37ca6e[_0x4e8a('0x2b')]=_0x3c700c;if(_0x17340f['query']['includeAll']){_0x4693ac['include']=[{'all':!![]}];}return db[_0x4e8a('0x33')][_0x4e8a('0x45')](_0x4693ac);})[_0x4e8a('0x1c')](function(_0x3a4f2b){_0x37ca6e[_0x4e8a('0x46')]=_0x3a4f2b;return _0x37ca6e;})['then'](respondWithFilteredResult(_0x5e79ea,_0x4693ac))[_0x4e8a('0x47')](handleError(_0x5e79ea,null));};exports['show']=function(_0x4c2c1b,_0xc0c96b){var _0xfeb06a={'raw':![],'where':{'id':_0x4c2c1b[_0x4e8a('0x48')]['id']}},_0x40b53f={};_0x40b53f[_0x4e8a('0x3b')]=_[_0x4e8a('0x38')](db[_0x4e8a('0x33')][_0x4e8a('0x34')]);_0x40b53f[_0x4e8a('0x37')]=_[_0x4e8a('0x38')](_0x4c2c1b[_0x4e8a('0x37')]);_0x40b53f[_0x4e8a('0x39')]=_['intersection'](_0x40b53f[_0x4e8a('0x3b')],_0x40b53f[_0x4e8a('0x37')]);_0xfeb06a['attributes']=_[_0x4e8a('0x3a')](_0x40b53f[_0x4e8a('0x3b')],qs[_0x4e8a('0x49')](_0x4c2c1b['query'][_0x4e8a('0x49')]));_0xfeb06a[_0x4e8a('0x3c')]=_0xfeb06a[_0x4e8a('0x3c')][_0x4e8a('0x3d')]?_0xfeb06a[_0x4e8a('0x3c')]:_0x40b53f['model'];if(_0x4c2c1b[_0x4e8a('0x37')][_0x4e8a('0x4a')]){_0xfeb06a[_0x4e8a('0x4b')]=[{'all':!![]}];}_0xfeb06a=_[_0x4e8a('0x43')]({},_0xfeb06a,_0x4c2c1b[_0x4e8a('0x44')]);return db[_0x4e8a('0x33')]['find'](_0xfeb06a)[_0x4e8a('0x1c')](handleEntityNotFound(_0xc0c96b,null))[_0x4e8a('0x1c')](respondWithResult(_0xc0c96b,null))[_0x4e8a('0x47')](handleError(_0xc0c96b,null));};exports['update']=function(_0x11ca60,_0x4515f5){if(_0x11ca60[_0x4e8a('0x4c')]['id']){delete _0x11ca60[_0x4e8a('0x4c')]['id'];}return db[_0x4e8a('0x33')][_0x4e8a('0x4d')]({'where':{'id':_0x11ca60[_0x4e8a('0x48')]['id']}})['then'](handleEntityNotFound(_0x4515f5,null))[_0x4e8a('0x1c')](saveUpdates(_0x11ca60[_0x4e8a('0x4c')],null))[_0x4e8a('0x1c')](respondWithResult(_0x4515f5,null))['catch'](handleError(_0x4515f5,null));};exports['addLogo']=function(_0x571ad7,_0x1ab43a,_0x1caa6d){if(_0x571ad7[_0x4e8a('0x4e')]&&_0x571ad7['file']['filename']){_0x571ad7[_0x4e8a('0x4c')]['logo']=_0x571ad7['file'][_0x4e8a('0x4f')];}return db[_0x4e8a('0x33')]['find']({'where':{'id':_0x571ad7[_0x4e8a('0x48')]['id']}})[_0x4e8a('0x1c')](handleEntityNotFound(_0x1ab43a,null))[_0x4e8a('0x1c')](saveUpdates(_0x571ad7[_0x4e8a('0x4c')],null))[_0x4e8a('0x1c')](respondWithResult(_0x1ab43a,null))[_0x4e8a('0x47')](handleError(_0x1ab43a,null));};exports['addLogoLogin']=function(_0x3d3a51,_0x234efe,_0xe91845){if(_0x3d3a51['file']&&_0x3d3a51['file'][_0x4e8a('0x4f')]){_0x3d3a51[_0x4e8a('0x4c')][_0x4e8a('0x50')]=_0x3d3a51[_0x4e8a('0x4e')][_0x4e8a('0x4f')];}return db[_0x4e8a('0x33')]['find']({'where':{'id':_0x3d3a51[_0x4e8a('0x48')]['id']}})['then'](handleEntityNotFound(_0x234efe,null))[_0x4e8a('0x1c')](saveUpdates(_0x3d3a51[_0x4e8a('0x4c')],null))[_0x4e8a('0x1c')](respondWithResult(_0x234efe,null))['catch'](handleError(_0x234efe,null));};var utilLicense=require('../../config/license/util');exports[_0x4e8a('0x51')]=function(_0x3b3f87,_0x5c1c44,_0x20fb1c){var _0x47857e=_0x4e8a('0x52');var _0x4b418b={'custom':![]};return utilLicense['getLicense']()['then'](function(_0x4aed87){if(_0x4aed87){_0x4b418b=_0x4aed87;}return db['Setting']['find']({'where':{'id':_0x3b3f87[_0x4e8a('0x48')]['id']},'attributes':[_0x4e8a('0x53'),_0x4e8a('0x50'),_0x4e8a('0x54'),'favicon',_0x4e8a('0x55'),_0x4e8a('0x56'),_0x4e8a('0x57'),_0x4e8a('0x58')],'raw':!![]});})[_0x4e8a('0x1c')](handleEntityNotFound(_0x5c1c44,null))[_0x4e8a('0x1c')](function(_0x1a807a){if(_0x1a807a){var _0x182c57=_0x1a807a['logo']&&fs[_0x4e8a('0x59')](path[_0x4e8a('0x5a')](config[_0x4e8a('0x5b')],_0x47857e,_[_0x4e8a('0x5c')](_0x1a807a[_0x4e8a('0x53')])))?path[_0x4e8a('0x5a')](config[_0x4e8a('0x5b')],_0x47857e,_['toLower'](_0x1a807a[_0x4e8a('0x53')])):path['join'](config['root'],_0x47857e,_[_0x4e8a('0x5c')]('default_logo.svg'));var _0x48be64=_0x4e8a('0x5d')+_[_0x4e8a('0x5e')](_0x4e8a('0x53'));if(_0x1a807a[_0x48be64]||!_0x4b418b[_0x4e8a('0x5f')]){_0x182c57=path[_0x4e8a('0x5a')](config[_0x4e8a('0x5b')],_0x47857e,_[_0x4e8a('0x5c')]('default_logo.svg'));}if(!fs[_0x4e8a('0x59')](_0x182c57)){throw new db[(_0x4e8a('0x60'))][(_0x4e8a('0x61'))](_[_0x4e8a('0x5e')](_0x4e8a('0x53'))+_0x4e8a('0x62'));}return _0x5c1c44[_0x4e8a('0x63')](_0x182c57);}})[_0x4e8a('0x47')](handleError(_0x5c1c44,null));};var utilLicense=require(_0x4e8a('0x17'));exports[_0x4e8a('0x64')]=function(_0x269e2f,_0x4d87ea,_0xd64425){var _0x5085d7='server/files/images/logos';var _0x272c72={'custom':![]};return utilLicense['getLicense']()['then'](function(_0x24d1cd){if(_0x24d1cd){_0x272c72=_0x24d1cd;}return db[_0x4e8a('0x33')][_0x4e8a('0x4d')]({'where':{'id':_0x269e2f['params']['id']},'attributes':[_0x4e8a('0x53'),'loginLogo',_0x4e8a('0x54'),_0x4e8a('0x65'),_0x4e8a('0x55'),'defaultLoginLogo',_0x4e8a('0x57'),_0x4e8a('0x58')],'raw':!![]});})[_0x4e8a('0x1c')](handleEntityNotFound(_0x4d87ea,null))[_0x4e8a('0x1c')](function(_0x5cdda){if(_0x5cdda){var _0x11db8f=_0x5cdda[_0x4e8a('0x50')]&&fs['existsSync'](path[_0x4e8a('0x5a')](config[_0x4e8a('0x5b')],_0x5085d7,_[_0x4e8a('0x5c')](_0x5cdda[_0x4e8a('0x50')])))?path[_0x4e8a('0x5a')](config[_0x4e8a('0x5b')],_0x5085d7,_['toLower'](_0x5cdda['loginLogo'])):path[_0x4e8a('0x5a')](config['root'],_0x5085d7,_[_0x4e8a('0x5c')](_0x4e8a('0x66')));var _0x3fd6e2=_0x4e8a('0x5d')+_[_0x4e8a('0x5e')]('loginLogo');if(_0x5cdda[_0x3fd6e2]||!_0x272c72[_0x4e8a('0x5f')]){_0x11db8f=path[_0x4e8a('0x5a')](config[_0x4e8a('0x5b')],_0x5085d7,_[_0x4e8a('0x5c')](_0x4e8a('0x66')));}if(!fs[_0x4e8a('0x59')](_0x11db8f)){throw new db['Sequelize'][(_0x4e8a('0x61'))](_[_0x4e8a('0x5e')](_0x4e8a('0x50'))+'\x20not\x20found');}return _0x4d87ea[_0x4e8a('0x63')](_0x11db8f);}})[_0x4e8a('0x47')](handleError(_0x4d87ea,null));};exports[_0x4e8a('0x67')]=function(_0x2a1bee,_0x36124d){return db[_0x4e8a('0x33')]['find']({'where':{'id':_0x2a1bee[_0x4e8a('0x48')]['id']},'attributes':[_0x4e8a('0x68')]})[_0x4e8a('0x1c')](respondWithResult(_0x36124d,null))[_0x4e8a('0x47')](handleError(_0x36124d,null));};exports[_0x4e8a('0x69')]=function(_0x4ea640,_0x340f39,_0x59c499){if(_0x4ea640[_0x4e8a('0x4e')]&&_0x4ea640[_0x4e8a('0x4e')][_0x4e8a('0x4f')]){_0x4ea640[_0x4e8a('0x4c')]['preferred']=_0x4ea640[_0x4e8a('0x4e')][_0x4e8a('0x4f')];}return db['Setting'][_0x4e8a('0x4d')]({'where':{'id':_0x4ea640[_0x4e8a('0x48')]['id']}})['then'](handleEntityNotFound(_0x340f39,null))[_0x4e8a('0x1c')](saveUpdates(_0x4ea640[_0x4e8a('0x4c')],null))['then'](respondWithResult(_0x340f39,null))[_0x4e8a('0x47')](handleError(_0x340f39,null));};var utilLicense=require(_0x4e8a('0x17'));exports[_0x4e8a('0x6a')]=function(_0x3a1902,_0xf8d79,_0x2047da){var _0x2b4220=_0x4e8a('0x52');var _0x52ef93={'custom':![]};return utilLicense[_0x4e8a('0x6b')]()['then'](function(_0x4feedd){if(_0x4feedd){_0x52ef93=_0x4feedd;}return db['Setting']['find']({'where':{'id':_0x3a1902[_0x4e8a('0x48')]['id']},'attributes':[_0x4e8a('0x53'),_0x4e8a('0x50'),_0x4e8a('0x54'),_0x4e8a('0x65'),'defaultLogo',_0x4e8a('0x56'),_0x4e8a('0x57'),_0x4e8a('0x58')],'raw':!![]});})[_0x4e8a('0x1c')](handleEntityNotFound(_0xf8d79,null))['then'](function(_0x20503a){if(_0x20503a){var _0x1f7929=_0x20503a[_0x4e8a('0x54')]&&fs[_0x4e8a('0x59')](path[_0x4e8a('0x5a')](config[_0x4e8a('0x5b')],_0x2b4220,_[_0x4e8a('0x5c')](_0x20503a['preferred'])))?path[_0x4e8a('0x5a')](config[_0x4e8a('0x5b')],_0x2b4220,_['toLower'](_0x20503a['preferred'])):path[_0x4e8a('0x5a')](config[_0x4e8a('0x5b')],_0x2b4220,_[_0x4e8a('0x5c')](_0x4e8a('0x6c')));var _0x1fbfcb=_0x4e8a('0x5d')+_[_0x4e8a('0x5e')](_0x4e8a('0x54'));if(_0x20503a[_0x1fbfcb]||!_0x52ef93[_0x4e8a('0x5f')]||!_0x52ef93[_0x4e8a('0x54')]){_0x1f7929=path[_0x4e8a('0x5a')](config[_0x4e8a('0x5b')],_0x2b4220,_[_0x4e8a('0x5c')]('default_preferred.png'));}if(!fs['existsSync'](_0x1f7929)){throw new db['Sequelize']['ValidationError'](_['upperFirst'](_0x4e8a('0x54'))+_0x4e8a('0x62'));}return _0xf8d79[_0x4e8a('0x63')](_0x1f7929);}})[_0x4e8a('0x47')](handleError(_0xf8d79,null));};exports[_0x4e8a('0x6d')]=function(_0xbc556b,_0x3f7720,_0x2f73e3){if(_0xbc556b[_0x4e8a('0x4e')]&&_0xbc556b['file']['filename']){_0xbc556b[_0x4e8a('0x4c')][_0x4e8a('0x65')]=_0xbc556b[_0x4e8a('0x4e')][_0x4e8a('0x4f')];}return db[_0x4e8a('0x33')][_0x4e8a('0x4d')]({'where':{'id':_0xbc556b[_0x4e8a('0x48')]['id']}})[_0x4e8a('0x1c')](handleEntityNotFound(_0x3f7720,null))[_0x4e8a('0x1c')](saveUpdates(_0xbc556b['body'],null))[_0x4e8a('0x1c')](respondWithResult(_0x3f7720,null))[_0x4e8a('0x47')](handleError(_0x3f7720,null));};var utilLicense=require(_0x4e8a('0x17'));exports[_0x4e8a('0x6e')]=function(_0x3fd30d,_0x10c80f,_0x2aaf19){var _0x36366e=_0x4e8a('0x52');var _0x19cd89={'custom':![]};return utilLicense[_0x4e8a('0x6b')]()[_0x4e8a('0x1c')](function(_0xd095e7){if(_0xd095e7){_0x19cd89=_0xd095e7;}return db[_0x4e8a('0x33')][_0x4e8a('0x4d')]({'where':{'id':_0x3fd30d[_0x4e8a('0x48')]['id']},'attributes':[_0x4e8a('0x53'),_0x4e8a('0x50'),_0x4e8a('0x54'),'favicon','defaultLogo',_0x4e8a('0x56'),_0x4e8a('0x57'),'defaultFavicon'],'raw':!![]});})[_0x4e8a('0x1c')](handleEntityNotFound(_0x10c80f,null))[_0x4e8a('0x1c')](function(_0x35a8bd){if(_0x35a8bd){var _0x63d11a=_0x35a8bd[_0x4e8a('0x65')]&&fs[_0x4e8a('0x59')](path[_0x4e8a('0x5a')](config['root'],_0x36366e,_['toLower'](_0x35a8bd[_0x4e8a('0x65')])))?path[_0x4e8a('0x5a')](config['root'],_0x36366e,_[_0x4e8a('0x5c')](_0x35a8bd['favicon'])):path['join'](config[_0x4e8a('0x5b')],_0x36366e,_['toLower'](_0x4e8a('0x6f')));var _0x5eeb9d=_0x4e8a('0x5d')+_['upperFirst'](_0x4e8a('0x65'));if(_0x35a8bd[_0x5eeb9d]||!_0x19cd89['custom']){_0x63d11a=path[_0x4e8a('0x5a')](config[_0x4e8a('0x5b')],_0x36366e,_[_0x4e8a('0x5c')](_0x4e8a('0x6f')));}if(!fs[_0x4e8a('0x59')](_0x63d11a)){throw new db[(_0x4e8a('0x60'))][(_0x4e8a('0x61'))](_['upperFirst'](_0x4e8a('0x65'))+_0x4e8a('0x62'));}return _0x10c80f[_0x4e8a('0x63')](_0x63d11a);}})['catch'](handleError(_0x10c80f,null));};exports[_0x4e8a('0x70')]=function(_0x4122e8,_0x18248e){var _0x1a245={'offset':moment()[_0x4e8a('0x71')]()};_0x1a245['now']=moment()['utcOffset'](_0x1a245[_0x4e8a('0x2c')])['format'](_0x4e8a('0x72'));return _0x18248e['status'](0xc8)[_0x4e8a('0x73')](_0x1a245);}; \ No newline at end of file +var _0x9c5e=['Sequelize','download','getLogoLogin','defaultLogo','defaultFavicon','default_loginLogo.svg','upperFirst','ValidationError','\x20not\x20found','gdpr','addPreferred','getPreferred','defaultPreferred','default_preferred.png','addFavicon','default_favicon.ico','getDate','utcOffset','now','format','YYYY-MM-DD\x20HH:mm:ss:SSS','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','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','client','request','info','Setting,\x20%s,\x20%s','request\x20sent','Setting,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','status','end','undefined','limit','count','offset','set','Content-Range','json','save','update','destroy','then','sendStatus','stack','name','send','index','map','Setting','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','include','findAll','rows','show','options','find','body','addLogo','file','filename','logo','addLogoLogin','loginLogo','params','../../config/license/util','getLogo','server/files/images/logos','getLicense','preferred','favicon','defaultLoginLogo','existsSync','join','toLower','root','default','custom'];(function(_0x2e6e7e,_0x310fe0){var _0x3a44a8=function(_0x3b4b14){while(--_0x3b4b14){_0x2e6e7e['push'](_0x2e6e7e['shift']());}};_0x3a44a8(++_0x310fe0);}(_0x9c5e,0x113));var _0xe9c5=function(_0x2283dc,_0x2fcfc5){_0x2283dc=_0x2283dc-0x0;var _0x16db90=_0x9c5e[_0x2283dc];return _0x16db90;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe9c5('0x0'));var zipdir=require(_0xe9c5('0x1'));var jsonpatch=require(_0xe9c5('0x2'));var rp=require(_0xe9c5('0x3'));var moment=require(_0xe9c5('0x4'));var BPromise=require(_0xe9c5('0x5'));var Mustache=require(_0xe9c5('0x6'));var util=require(_0xe9c5('0x7'));var path=require(_0xe9c5('0x8'));var sox=require(_0xe9c5('0x9'));var csv=require(_0xe9c5('0xa'));var ejs=require(_0xe9c5('0xb'));var fs=require('fs');var fs_extra=require(_0xe9c5('0xc'));var _=require(_0xe9c5('0xd'));var squel=require('squel');var crypto=require(_0xe9c5('0xe'));var jsforce=require(_0xe9c5('0xf'));var deskjs=require(_0xe9c5('0x10'));var toCsv=require('to-csv');var querystring=require(_0xe9c5('0x11'));var Papa=require(_0xe9c5('0x12'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xe9c5('0x13'));var as=require(_0xe9c5('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xe9c5('0x15'))(_0xe9c5('0x16'));var utils=require(_0xe9c5('0x17'));var config=require(_0xe9c5('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xe9c5('0x19'))['db'];var jayson=require(_0xe9c5('0x1a'));var client=jayson[_0xe9c5('0x1b')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1a6227,_0x47bb5b,_0x56e373,_0x41a97e){return new BPromise(function(_0x236cae,_0x41bbf6){var _0x1642ea=_0x41a97e||client;return _0x1642ea[_0xe9c5('0x1c')](_0x1a6227,_0x56e373)['then'](function(_0x3ab0f6){logger[_0xe9c5('0x1d')](_0xe9c5('0x1e'),_0x47bb5b,_0xe9c5('0x1f'));logger['debug'](_0xe9c5('0x20'),_0x47bb5b,'request\x20sent',JSON[_0xe9c5('0x21')](_0x3ab0f6));if(_0x3ab0f6[_0xe9c5('0x22')]){if(_0x3ab0f6[_0xe9c5('0x22')][_0xe9c5('0x23')]===0x1f4){logger[_0xe9c5('0x22')](_0xe9c5('0x1e'),_0x47bb5b,_0x3ab0f6[_0xe9c5('0x22')][_0xe9c5('0x24')]);return _0x41bbf6(_0x3ab0f6[_0xe9c5('0x22')][_0xe9c5('0x24')]);}logger[_0xe9c5('0x22')](_0xe9c5('0x1e'),_0x47bb5b,_0x3ab0f6[_0xe9c5('0x22')][_0xe9c5('0x24')]);return _0x236cae(_0x3ab0f6[_0xe9c5('0x22')][_0xe9c5('0x24')]);}else{logger['info'](_0xe9c5('0x1e'),_0x47bb5b,_0xe9c5('0x1f'));_0x236cae(_0x3ab0f6['result'][_0xe9c5('0x24')]);}})[_0xe9c5('0x25')](function(_0x573470){logger[_0xe9c5('0x22')](_0xe9c5('0x1e'),_0x47bb5b,_0x573470);_0x41bbf6(_0x573470);});});}function respondWithStatusCode(_0x4b0e7b,_0x3b3868){_0x3b3868=_0x3b3868||0xcc;return function(_0x22b3c2){if(_0x22b3c2){return _0x4b0e7b['sendStatus'](_0x3b3868);}return _0x4b0e7b[_0xe9c5('0x26')](_0x3b3868)[_0xe9c5('0x27')]();};}function respondWithResult(_0x292932,_0x50d56b){_0x50d56b=_0x50d56b||0xc8;return function(_0x235533){if(_0x235533){return _0x292932[_0xe9c5('0x26')](_0x50d56b)['json'](_0x235533);}};}function respondWithFilteredResult(_0x86f4eb,_0x3dfb51){return function(_0x1f3d17){if(_0x1f3d17){var _0x368c62=typeof _0x3dfb51['offset']===_0xe9c5('0x28')&&typeof _0x3dfb51[_0xe9c5('0x29')]===_0xe9c5('0x28');var _0x1fac39=_0x1f3d17[_0xe9c5('0x2a')];var _0x12b8fd=_0x368c62?0x0:_0x3dfb51[_0xe9c5('0x2b')];var _0x1790be=_0x368c62?_0x1f3d17[_0xe9c5('0x2a')]:_0x3dfb51[_0xe9c5('0x2b')]+_0x3dfb51['limit'];var _0x2b911f;if(_0x1790be>=_0x1fac39){_0x1790be=_0x1fac39;_0x2b911f=0xc8;}else{_0x2b911f=0xce;}_0x86f4eb[_0xe9c5('0x26')](_0x2b911f);return _0x86f4eb[_0xe9c5('0x2c')](_0xe9c5('0x2d'),_0x12b8fd+'-'+_0x1790be+'/'+_0x1fac39)[_0xe9c5('0x2e')](_0x1f3d17);}return null;};}function patchUpdates(_0x2ad675){return function(_0x99608c){try{jsonpatch['apply'](_0x99608c,_0x2ad675,!![]);}catch(_0xdc9204){return BPromise['reject'](_0xdc9204);}return _0x99608c[_0xe9c5('0x2f')]();};}function saveUpdates(_0x4ff34a,_0x54ef87){return function(_0x5b2116){if(_0x5b2116){return _0x5b2116[_0xe9c5('0x30')](_0x4ff34a)['then'](function(_0x1fb972){return _0x1fb972;});}return null;};}function removeEntity(_0x19b80c,_0x16ed85){return function(_0x3a5740){if(_0x3a5740){return _0x3a5740[_0xe9c5('0x31')]()[_0xe9c5('0x32')](function(){_0x19b80c[_0xe9c5('0x26')](0xcc)[_0xe9c5('0x27')]();});}};}function handleEntityNotFound(_0x136e5d,_0x2f181f){return function(_0x312637){if(!_0x312637){_0x136e5d[_0xe9c5('0x33')](0x194);}return _0x312637;};}function handleError(_0x2a5ddd,_0x374dcc){_0x374dcc=_0x374dcc||0x1f4;return function(_0x2a5aaa){logger[_0xe9c5('0x22')](_0x2a5aaa[_0xe9c5('0x34')]);if(_0x2a5aaa['name']){delete _0x2a5aaa[_0xe9c5('0x35')];}_0x2a5ddd[_0xe9c5('0x26')](_0x374dcc)[_0xe9c5('0x36')](_0x2a5aaa);};}exports[_0xe9c5('0x37')]=function(_0xe8fe31,_0x37e102){var _0x62f351={},_0x345dc2={},_0x41ef66={'count':0x0,'rows':[]};var _0x2e6d63=_[_0xe9c5('0x38')](db[_0xe9c5('0x39')][_0xe9c5('0x3a')],function(_0x347992){return{'name':_0x347992[_0xe9c5('0x3b')],'type':_0x347992[_0xe9c5('0x3c')][_0xe9c5('0x3d')]};});_0x345dc2[_0xe9c5('0x3e')]=_[_0xe9c5('0x38')](_0x2e6d63,'name');_0x345dc2[_0xe9c5('0x3f')]=_[_0xe9c5('0x40')](_0xe8fe31[_0xe9c5('0x3f')]);_0x345dc2[_0xe9c5('0x41')]=_['intersection'](_0x345dc2[_0xe9c5('0x3e')],_0x345dc2[_0xe9c5('0x3f')]);_0x62f351[_0xe9c5('0x42')]=_[_0xe9c5('0x43')](_0x345dc2['model'],qs[_0xe9c5('0x44')](_0xe8fe31['query'][_0xe9c5('0x44')]));_0x62f351['attributes']=_0x62f351[_0xe9c5('0x42')][_0xe9c5('0x45')]?_0x62f351[_0xe9c5('0x42')]:_0x345dc2[_0xe9c5('0x3e')];if(!_0xe8fe31[_0xe9c5('0x3f')][_0xe9c5('0x46')](_0xe9c5('0x47'))){_0x62f351[_0xe9c5('0x29')]=qs[_0xe9c5('0x29')](_0xe8fe31[_0xe9c5('0x3f')]['limit']);_0x62f351[_0xe9c5('0x2b')]=qs['offset'](_0xe8fe31['query'][_0xe9c5('0x2b')]);}_0x62f351[_0xe9c5('0x48')]=qs[_0xe9c5('0x49')](_0xe8fe31[_0xe9c5('0x3f')][_0xe9c5('0x49')]);_0x62f351[_0xe9c5('0x4a')]=qs['filters'](_[_0xe9c5('0x4b')](_0xe8fe31[_0xe9c5('0x3f')],_0x345dc2[_0xe9c5('0x41')]),_0x2e6d63);if(_0xe8fe31[_0xe9c5('0x3f')][_0xe9c5('0x4c')]){_0x62f351[_0xe9c5('0x4a')]=_['merge'](_0x62f351['where'],{'$or':_[_0xe9c5('0x38')](_0x2e6d63,function(_0x2bb809){if(_0x2bb809[_0xe9c5('0x3c')]!==_0xe9c5('0x4d')){var _0x34d927={};_0x34d927[_0x2bb809[_0xe9c5('0x35')]]={'$like':'%'+_0xe8fe31[_0xe9c5('0x3f')]['filter']+'%'};return _0x34d927;}})});}_0x62f351=_[_0xe9c5('0x4e')]({},_0x62f351,_0xe8fe31['options']);var _0x420591={'where':_0x62f351[_0xe9c5('0x4a')]};return db[_0xe9c5('0x39')]['count'](_0x420591)['then'](function(_0x3d4f6d){_0x41ef66[_0xe9c5('0x2a')]=_0x3d4f6d;if(_0xe8fe31[_0xe9c5('0x3f')]['includeAll']){_0x62f351[_0xe9c5('0x4f')]=[{'all':!![]}];}return db['Setting'][_0xe9c5('0x50')](_0x62f351);})['then'](function(_0x4ad840){_0x41ef66[_0xe9c5('0x51')]=_0x4ad840;return _0x41ef66;})['then'](respondWithFilteredResult(_0x37e102,_0x62f351))['catch'](handleError(_0x37e102,null));};exports[_0xe9c5('0x52')]=function(_0x489e51,_0x5351a6){var _0x1890c5={'raw':![],'where':{'id':_0x489e51['params']['id']}},_0x178901={};_0x178901[_0xe9c5('0x3e')]=_[_0xe9c5('0x40')](db[_0xe9c5('0x39')][_0xe9c5('0x3a')]);_0x178901['query']=_[_0xe9c5('0x40')](_0x489e51[_0xe9c5('0x3f')]);_0x178901[_0xe9c5('0x41')]=_[_0xe9c5('0x43')](_0x178901[_0xe9c5('0x3e')],_0x178901[_0xe9c5('0x3f')]);_0x1890c5['attributes']=_[_0xe9c5('0x43')](_0x178901[_0xe9c5('0x3e')],qs[_0xe9c5('0x44')](_0x489e51[_0xe9c5('0x3f')]['fields']));_0x1890c5[_0xe9c5('0x42')]=_0x1890c5[_0xe9c5('0x42')][_0xe9c5('0x45')]?_0x1890c5[_0xe9c5('0x42')]:_0x178901[_0xe9c5('0x3e')];if(_0x489e51[_0xe9c5('0x3f')]['includeAll']){_0x1890c5[_0xe9c5('0x4f')]=[{'all':!![]}];}_0x1890c5=_[_0xe9c5('0x4e')]({},_0x1890c5,_0x489e51[_0xe9c5('0x53')]);return db[_0xe9c5('0x39')][_0xe9c5('0x54')](_0x1890c5)[_0xe9c5('0x32')](handleEntityNotFound(_0x5351a6,null))[_0xe9c5('0x32')](respondWithResult(_0x5351a6,null))[_0xe9c5('0x25')](handleError(_0x5351a6,null));};exports[_0xe9c5('0x30')]=function(_0xc80e91,_0x54ebbb){if(_0xc80e91[_0xe9c5('0x55')]['id']){delete _0xc80e91[_0xe9c5('0x55')]['id'];}return db[_0xe9c5('0x39')][_0xe9c5('0x54')]({'where':{'id':_0xc80e91['params']['id']}})[_0xe9c5('0x32')](handleEntityNotFound(_0x54ebbb,null))[_0xe9c5('0x32')](saveUpdates(_0xc80e91['body'],null))[_0xe9c5('0x32')](respondWithResult(_0x54ebbb,null))[_0xe9c5('0x25')](handleError(_0x54ebbb,null));};exports[_0xe9c5('0x56')]=function(_0x52eca0,_0x2aaf59,_0x354d97){if(_0x52eca0['file']&&_0x52eca0[_0xe9c5('0x57')][_0xe9c5('0x58')]){_0x52eca0['body'][_0xe9c5('0x59')]=_0x52eca0[_0xe9c5('0x57')]['filename'];}return db[_0xe9c5('0x39')][_0xe9c5('0x54')]({'where':{'id':_0x52eca0['params']['id']}})[_0xe9c5('0x32')](handleEntityNotFound(_0x2aaf59,null))[_0xe9c5('0x32')](saveUpdates(_0x52eca0['body'],null))[_0xe9c5('0x32')](respondWithResult(_0x2aaf59,null))[_0xe9c5('0x25')](handleError(_0x2aaf59,null));};exports[_0xe9c5('0x5a')]=function(_0x29f5c0,_0x2b3d3f,_0x227f6c){if(_0x29f5c0[_0xe9c5('0x57')]&&_0x29f5c0[_0xe9c5('0x57')][_0xe9c5('0x58')]){_0x29f5c0['body'][_0xe9c5('0x5b')]=_0x29f5c0[_0xe9c5('0x57')][_0xe9c5('0x58')];}return db[_0xe9c5('0x39')][_0xe9c5('0x54')]({'where':{'id':_0x29f5c0[_0xe9c5('0x5c')]['id']}})[_0xe9c5('0x32')](handleEntityNotFound(_0x2b3d3f,null))['then'](saveUpdates(_0x29f5c0[_0xe9c5('0x55')],null))[_0xe9c5('0x32')](respondWithResult(_0x2b3d3f,null))[_0xe9c5('0x25')](handleError(_0x2b3d3f,null));};var utilLicense=require(_0xe9c5('0x5d'));exports[_0xe9c5('0x5e')]=function(_0x5ac1bf,_0x4cc2a2,_0x489100){var _0x1acf18=_0xe9c5('0x5f');var _0x5bc531={'custom':![]};return utilLicense[_0xe9c5('0x60')]()[_0xe9c5('0x32')](function(_0x14a112){if(_0x14a112){_0x5bc531=_0x14a112;}return db[_0xe9c5('0x39')][_0xe9c5('0x54')]({'where':{'id':_0x5ac1bf[_0xe9c5('0x5c')]['id']},'attributes':[_0xe9c5('0x59'),_0xe9c5('0x5b'),_0xe9c5('0x61'),_0xe9c5('0x62'),'defaultLogo',_0xe9c5('0x63'),'defaultPreferred','defaultFavicon'],'raw':!![]});})[_0xe9c5('0x32')](handleEntityNotFound(_0x4cc2a2,null))[_0xe9c5('0x32')](function(_0x49338e){if(_0x49338e){var _0x5141c3=_0x49338e[_0xe9c5('0x59')]&&fs[_0xe9c5('0x64')](path[_0xe9c5('0x65')](config['root'],_0x1acf18,_[_0xe9c5('0x66')](_0x49338e[_0xe9c5('0x59')])))?path[_0xe9c5('0x65')](config[_0xe9c5('0x67')],_0x1acf18,_[_0xe9c5('0x66')](_0x49338e[_0xe9c5('0x59')])):path[_0xe9c5('0x65')](config['root'],_0x1acf18,_[_0xe9c5('0x66')]('default_logo.svg'));var _0x1f373c=_0xe9c5('0x68')+_['upperFirst'](_0xe9c5('0x59'));if(_0x49338e[_0x1f373c]||!_0x5bc531[_0xe9c5('0x69')]){_0x5141c3=path[_0xe9c5('0x65')](config[_0xe9c5('0x67')],_0x1acf18,_[_0xe9c5('0x66')]('default_logo.svg'));}if(!fs[_0xe9c5('0x64')](_0x5141c3)){throw new db[(_0xe9c5('0x6a'))]['ValidationError'](_['upperFirst'](_0xe9c5('0x59'))+'\x20not\x20found');}return _0x4cc2a2[_0xe9c5('0x6b')](_0x5141c3);}})[_0xe9c5('0x25')](handleError(_0x4cc2a2,null));};var utilLicense=require(_0xe9c5('0x5d'));exports[_0xe9c5('0x6c')]=function(_0x5674f0,_0xf5f9ff,_0x44388e){var _0x4a28bf='server/files/images/logos';var _0x55c395={'custom':![]};return utilLicense[_0xe9c5('0x60')]()['then'](function(_0x4669a0){if(_0x4669a0){_0x55c395=_0x4669a0;}return db[_0xe9c5('0x39')][_0xe9c5('0x54')]({'where':{'id':_0x5674f0[_0xe9c5('0x5c')]['id']},'attributes':['logo',_0xe9c5('0x5b'),_0xe9c5('0x61'),_0xe9c5('0x62'),_0xe9c5('0x6d'),_0xe9c5('0x63'),'defaultPreferred',_0xe9c5('0x6e')],'raw':!![]});})[_0xe9c5('0x32')](handleEntityNotFound(_0xf5f9ff,null))['then'](function(_0x557db4){if(_0x557db4){var _0x24c8b1=_0x557db4[_0xe9c5('0x5b')]&&fs['existsSync'](path['join'](config[_0xe9c5('0x67')],_0x4a28bf,_[_0xe9c5('0x66')](_0x557db4['loginLogo'])))?path[_0xe9c5('0x65')](config['root'],_0x4a28bf,_[_0xe9c5('0x66')](_0x557db4['loginLogo'])):path[_0xe9c5('0x65')](config[_0xe9c5('0x67')],_0x4a28bf,_[_0xe9c5('0x66')](_0xe9c5('0x6f')));var _0x52bef2=_0xe9c5('0x68')+_[_0xe9c5('0x70')](_0xe9c5('0x5b'));if(_0x557db4[_0x52bef2]||!_0x55c395[_0xe9c5('0x69')]){_0x24c8b1=path['join'](config[_0xe9c5('0x67')],_0x4a28bf,_[_0xe9c5('0x66')](_0xe9c5('0x6f')));}if(!fs[_0xe9c5('0x64')](_0x24c8b1)){throw new db['Sequelize'][(_0xe9c5('0x71'))](_[_0xe9c5('0x70')]('loginLogo')+_0xe9c5('0x72'));}return _0xf5f9ff['download'](_0x24c8b1);}})[_0xe9c5('0x25')](handleError(_0xf5f9ff,null));};exports[_0xe9c5('0x73')]=function(_0x2a433d,_0x449449){return db[_0xe9c5('0x39')][_0xe9c5('0x54')]({'where':{'id':_0x2a433d[_0xe9c5('0x5c')]['id']},'attributes':['securePassword']})[_0xe9c5('0x32')](respondWithResult(_0x449449,null))[_0xe9c5('0x25')](handleError(_0x449449,null));};exports[_0xe9c5('0x74')]=function(_0x2c0f79,_0x316568,_0x57440f){if(_0x2c0f79[_0xe9c5('0x57')]&&_0x2c0f79[_0xe9c5('0x57')][_0xe9c5('0x58')]){_0x2c0f79[_0xe9c5('0x55')][_0xe9c5('0x61')]=_0x2c0f79[_0xe9c5('0x57')]['filename'];}return db[_0xe9c5('0x39')][_0xe9c5('0x54')]({'where':{'id':_0x2c0f79[_0xe9c5('0x5c')]['id']}})['then'](handleEntityNotFound(_0x316568,null))['then'](saveUpdates(_0x2c0f79[_0xe9c5('0x55')],null))[_0xe9c5('0x32')](respondWithResult(_0x316568,null))[_0xe9c5('0x25')](handleError(_0x316568,null));};var utilLicense=require(_0xe9c5('0x5d'));exports[_0xe9c5('0x75')]=function(_0x38bcc4,_0x5962c5,_0x589282){var _0x1a6229=_0xe9c5('0x5f');var _0x5095a1={'custom':![]};return utilLicense[_0xe9c5('0x60')]()[_0xe9c5('0x32')](function(_0x1f32e4){if(_0x1f32e4){_0x5095a1=_0x1f32e4;}return db['Setting'][_0xe9c5('0x54')]({'where':{'id':_0x38bcc4['params']['id']},'attributes':['logo',_0xe9c5('0x5b'),_0xe9c5('0x61'),'favicon',_0xe9c5('0x6d'),_0xe9c5('0x63'),_0xe9c5('0x76'),_0xe9c5('0x6e')],'raw':!![]});})[_0xe9c5('0x32')](handleEntityNotFound(_0x5962c5,null))['then'](function(_0x4d9c84){if(_0x4d9c84){var _0x7ca4ae=_0x4d9c84['preferred']&&fs[_0xe9c5('0x64')](path[_0xe9c5('0x65')](config['root'],_0x1a6229,_['toLower'](_0x4d9c84[_0xe9c5('0x61')])))?path[_0xe9c5('0x65')](config[_0xe9c5('0x67')],_0x1a6229,_[_0xe9c5('0x66')](_0x4d9c84[_0xe9c5('0x61')])):path[_0xe9c5('0x65')](config[_0xe9c5('0x67')],_0x1a6229,_[_0xe9c5('0x66')](_0xe9c5('0x77')));var _0x19213a=_0xe9c5('0x68')+_[_0xe9c5('0x70')](_0xe9c5('0x61'));if(_0x4d9c84[_0x19213a]||!_0x5095a1['custom']||!_0x5095a1[_0xe9c5('0x61')]){_0x7ca4ae=path[_0xe9c5('0x65')](config[_0xe9c5('0x67')],_0x1a6229,_['toLower'](_0xe9c5('0x77')));}if(!fs[_0xe9c5('0x64')](_0x7ca4ae)){throw new db['Sequelize'][(_0xe9c5('0x71'))](_[_0xe9c5('0x70')](_0xe9c5('0x61'))+_0xe9c5('0x72'));}return _0x5962c5[_0xe9c5('0x6b')](_0x7ca4ae);}})[_0xe9c5('0x25')](handleError(_0x5962c5,null));};exports[_0xe9c5('0x78')]=function(_0x307caa,_0x36d553,_0x20799a){if(_0x307caa[_0xe9c5('0x57')]&&_0x307caa[_0xe9c5('0x57')][_0xe9c5('0x58')]){_0x307caa[_0xe9c5('0x55')][_0xe9c5('0x62')]=_0x307caa[_0xe9c5('0x57')][_0xe9c5('0x58')];}return db[_0xe9c5('0x39')][_0xe9c5('0x54')]({'where':{'id':_0x307caa[_0xe9c5('0x5c')]['id']}})[_0xe9c5('0x32')](handleEntityNotFound(_0x36d553,null))[_0xe9c5('0x32')](saveUpdates(_0x307caa[_0xe9c5('0x55')],null))['then'](respondWithResult(_0x36d553,null))['catch'](handleError(_0x36d553,null));};var utilLicense=require(_0xe9c5('0x5d'));exports['getFavicon']=function(_0x4ced57,_0x32edf1,_0x5dc008){var _0x306dcc='server/files/images/logos';var _0x108dcd={'custom':![]};return utilLicense[_0xe9c5('0x60')]()[_0xe9c5('0x32')](function(_0x259fa5){if(_0x259fa5){_0x108dcd=_0x259fa5;}return db[_0xe9c5('0x39')][_0xe9c5('0x54')]({'where':{'id':_0x4ced57[_0xe9c5('0x5c')]['id']},'attributes':[_0xe9c5('0x59'),_0xe9c5('0x5b'),'preferred',_0xe9c5('0x62'),_0xe9c5('0x6d'),_0xe9c5('0x63'),_0xe9c5('0x76'),'defaultFavicon'],'raw':!![]});})['then'](handleEntityNotFound(_0x32edf1,null))['then'](function(_0x5d4f82){if(_0x5d4f82){var _0x36a568=_0x5d4f82[_0xe9c5('0x62')]&&fs[_0xe9c5('0x64')](path[_0xe9c5('0x65')](config['root'],_0x306dcc,_['toLower'](_0x5d4f82[_0xe9c5('0x62')])))?path[_0xe9c5('0x65')](config[_0xe9c5('0x67')],_0x306dcc,_['toLower'](_0x5d4f82[_0xe9c5('0x62')])):path[_0xe9c5('0x65')](config[_0xe9c5('0x67')],_0x306dcc,_[_0xe9c5('0x66')](_0xe9c5('0x79')));var _0x2ef52b='default'+_[_0xe9c5('0x70')](_0xe9c5('0x62'));if(_0x5d4f82[_0x2ef52b]||!_0x108dcd[_0xe9c5('0x69')]){_0x36a568=path[_0xe9c5('0x65')](config[_0xe9c5('0x67')],_0x306dcc,_['toLower'](_0xe9c5('0x79')));}if(!fs[_0xe9c5('0x64')](_0x36a568)){throw new db[(_0xe9c5('0x6a'))]['ValidationError'](_[_0xe9c5('0x70')]('favicon')+_0xe9c5('0x72'));}return _0x32edf1[_0xe9c5('0x6b')](_0x36a568);}})[_0xe9c5('0x25')](handleError(_0x32edf1,null));};exports[_0xe9c5('0x7a')]=function(_0x2f8777,_0x35547){var _0x386d82={'offset':moment()[_0xe9c5('0x7b')]()};_0x386d82[_0xe9c5('0x7c')]=moment()['utcOffset'](_0x386d82[_0xe9c5('0x2b')])[_0xe9c5('0x7d')](_0xe9c5('0x7e'));return _0x35547['status'](0xc8)[_0xe9c5('0x36')](_0x386d82);}; \ No newline at end of file diff --git a/server/api/setting/setting.model.js b/server/api/setting/setting.model.js index d7dd3c6..d2979f4 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 _0xedd9=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./setting.attributes','exports','Setting','util'];(function(_0x335ede,_0x4b6031){var _0x1366aa=function(_0x5a3552){while(--_0x5a3552){_0x335ede['push'](_0x335ede['shift']());}};_0x1366aa(++_0x4b6031);}(_0xedd9,0xfc));var _0x9edd=function(_0x4278f2,_0x35a90a){_0x4278f2=_0x4278f2-0x0;var _0x51f6fd=_0xedd9[_0x4278f2];return _0x51f6fd;};'use strict';var _=require('lodash');var util=require(_0x9edd('0x0'));var logger=require(_0x9edd('0x1'))(_0x9edd('0x2'));var moment=require(_0x9edd('0x3'));var BPromise=require(_0x9edd('0x4'));var rp=require(_0x9edd('0x5'));var fs=require('fs');var path=require(_0x9edd('0x6'));var rimraf=require(_0x9edd('0x7'));var config=require('../../config/environment');var attributes=require(_0x9edd('0x8'));module[_0x9edd('0x9')]=function(_0x268f9e,_0x34c1a7){return _0x268f9e['define'](_0x9edd('0xa'),attributes,{'tableName':'settings','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe14b=['bluebird','path','./setting.attributes','exports','define','Setting','settings','lodash','util','moment'];(function(_0x53a6ce,_0x32a352){var _0x41d59e=function(_0x1f5895){while(--_0x1f5895){_0x53a6ce['push'](_0x53a6ce['shift']());}};_0x41d59e(++_0x32a352);}(_0xe14b,0x93));var _0xbe14=function(_0x2747d5,_0x4d8719){_0x2747d5=_0x2747d5-0x0;var _0x264645=_0xe14b[_0x2747d5];return _0x264645;};'use strict';var _=require(_0xbe14('0x0'));var util=require(_0xbe14('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xbe14('0x2'));var BPromise=require(_0xbe14('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xbe14('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xbe14('0x5'));module[_0xbe14('0x6')]=function(_0x1fe204,_0x1ff100){return _0x1fe204[_0xbe14('0x7')](_0xbe14('0x8'),attributes,{'tableName':_0xbe14('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/setting/setting.rpc.js b/server/api/setting/setting.rpc.js index d1fff5d..5a42474 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 _0x94d1=['client','http','then','info','Setting,\x20%s,\x20%s','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','ShowSetting','Setting','options','where','attributes','map','include','model','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x1f5ab3,_0x2d2473){var _0x2bd0d7=function(_0x41c41b){while(--_0x41c41b){_0x1f5ab3['push'](_0x1f5ab3['shift']());}};_0x2bd0d7(++_0x2d2473);}(_0x94d1,0x1e3));var _0x194d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x94d1[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x194d('0x0'));var util=require(_0x194d('0x1'));var moment=require(_0x194d('0x2'));var BPromise=require(_0x194d('0x3'));var rs=require(_0x194d('0x4'));var fs=require('fs');var Redis=require(_0x194d('0x5'));var db=require(_0x194d('0x6'))['db'];var utils=require(_0x194d('0x7'));var logger=require(_0x194d('0x8'))(_0x194d('0x9'));var config=require(_0x194d('0xa'));var jayson=require(_0x194d('0xb'));var client=jayson[_0x194d('0xc')][_0x194d('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x2914ee,_0x4f0948,_0x33bf3e){return new BPromise(function(_0xf3ea4c,_0x1683ed){return client['request'](_0x2914ee,_0x33bf3e)[_0x194d('0xe')](function(_0x405a3e){logger[_0x194d('0xf')](_0x194d('0x10'),_0x4f0948,_0x194d('0x11'));logger[_0x194d('0x12')](_0x194d('0x13'),_0x4f0948,'request\x20sent',JSON['stringify'](_0x405a3e));if(_0x405a3e[_0x194d('0x14')]){if(_0x405a3e[_0x194d('0x14')][_0x194d('0x15')]===0x1f4){logger[_0x194d('0x14')](_0x194d('0x10'),_0x4f0948,_0x405a3e[_0x194d('0x14')]['message']);return _0x1683ed(_0x405a3e['error'][_0x194d('0x16')]);}logger[_0x194d('0x14')](_0x194d('0x10'),_0x4f0948,_0x405a3e[_0x194d('0x14')][_0x194d('0x16')]);return _0xf3ea4c(_0x405a3e[_0x194d('0x14')][_0x194d('0x16')]);}else{logger[_0x194d('0xf')](_0x194d('0x10'),_0x4f0948,'request\x20sent');_0xf3ea4c(_0x405a3e[_0x194d('0x17')]['message']);}})[_0x194d('0x18')](function(_0xcf891a){logger['error']('Setting,\x20%s,\x20%s',_0x4f0948,_0xcf891a);_0x1683ed(_0xcf891a);});});}exports[_0x194d('0x19')]=function(_0x34d7a0){var _0x512150=this;return new Promise(function(_0x487aaa,_0xb23652){return db[_0x194d('0x1a')]['find']({'raw':_0x34d7a0[_0x194d('0x1b')]?_0x34d7a0[_0x194d('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x34d7a0[_0x194d('0x1b')]?_0x34d7a0[_0x194d('0x1b')][_0x194d('0x1c')]||null:null,'attributes':_0x34d7a0[_0x194d('0x1b')]?_0x34d7a0[_0x194d('0x1b')][_0x194d('0x1d')]||null:null,'include':_0x34d7a0[_0x194d('0x1b')]?_0x34d7a0[_0x194d('0x1b')]['include']?_[_0x194d('0x1e')](_0x34d7a0[_0x194d('0x1b')][_0x194d('0x1f')],function(_0x57d1c0){return{'model':db[_0x57d1c0[_0x194d('0x20')]],'as':_0x57d1c0['as'],'attributes':_0x57d1c0[_0x194d('0x1d')],'include':_0x57d1c0[_0x194d('0x1f')]?_[_0x194d('0x1e')](_0x57d1c0[_0x194d('0x1f')],function(_0x252c7d){return{'model':db[_0x252c7d[_0x194d('0x20')]],'as':_0x252c7d['as'],'attributes':_0x252c7d[_0x194d('0x1d')],'include':_0x252c7d['include']?_['map'](_0x252c7d[_0x194d('0x1f')],function(_0x9ec5b4){return{'model':db[_0x9ec5b4[_0x194d('0x20')]],'as':_0x9ec5b4['as'],'attributes':_0x9ec5b4['attributes']};}):[]};}):[]};}):[]:[]})[_0x194d('0xe')](function(_0x2292d0){logger[_0x194d('0xf')]('ShowSetting',_0x34d7a0);logger[_0x194d('0x12')]('ShowSetting',_0x34d7a0,JSON['stringify'](_0x2292d0));_0x487aaa(_0x2292d0);})[_0x194d('0x18')](function(_0x41d086){logger[_0x194d('0x14')]('ShowSetting',_0x41d086['message'],_0x34d7a0);_0xb23652(_0x512150[_0x194d('0x14')](0x1f4,_0x41d086[_0x194d('0x16')]));});});}; \ No newline at end of file +var _0xc540=['../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','Setting,\x20%s,\x20%s,\x20%s','stringify','error','code','message','Setting,\x20%s,\x20%s','catch','ShowSetting','Setting','options','raw','where','attributes','include','map','model','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger'];(function(_0x5268ba,_0x1843e1){var _0x539d89=function(_0x5c9ced){while(--_0x5c9ced){_0x5268ba['push'](_0x5268ba['shift']());}};_0x539d89(++_0x1843e1);}(_0xc540,0x162));var _0x0c54=function(_0x1df409,_0x1c7d63){_0x1df409=_0x1df409-0x0;var _0x53e65d=_0xc540[_0x1df409];return _0x53e65d;};'use strict';var _=require('lodash');var util=require(_0x0c54('0x0'));var moment=require('moment');var BPromise=require(_0x0c54('0x1'));var rs=require(_0x0c54('0x2'));var fs=require('fs');var Redis=require(_0x0c54('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0c54('0x4'));var logger=require(_0x0c54('0x5'))('rpc');var config=require(_0x0c54('0x6'));var jayson=require(_0x0c54('0x7'));var client=jayson[_0x0c54('0x8')][_0x0c54('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x292ed5,_0x51d04a,_0x4f2a1a){return new BPromise(function(_0x569171,_0x2cc665){return client[_0x0c54('0xa')](_0x292ed5,_0x4f2a1a)[_0x0c54('0xb')](function(_0x3ea043){logger[_0x0c54('0xc')]('Setting,\x20%s,\x20%s',_0x51d04a,_0x0c54('0xd'));logger['debug'](_0x0c54('0xe'),_0x51d04a,'request\x20sent',JSON[_0x0c54('0xf')](_0x3ea043));if(_0x3ea043[_0x0c54('0x10')]){if(_0x3ea043[_0x0c54('0x10')][_0x0c54('0x11')]===0x1f4){logger[_0x0c54('0x10')]('Setting,\x20%s,\x20%s',_0x51d04a,_0x3ea043['error'][_0x0c54('0x12')]);return _0x2cc665(_0x3ea043[_0x0c54('0x10')][_0x0c54('0x12')]);}logger[_0x0c54('0x10')](_0x0c54('0x13'),_0x51d04a,_0x3ea043[_0x0c54('0x10')][_0x0c54('0x12')]);return _0x569171(_0x3ea043[_0x0c54('0x10')]['message']);}else{logger[_0x0c54('0xc')](_0x0c54('0x13'),_0x51d04a,_0x0c54('0xd'));_0x569171(_0x3ea043['result'][_0x0c54('0x12')]);}})[_0x0c54('0x14')](function(_0x49282b){logger[_0x0c54('0x10')](_0x0c54('0x13'),_0x51d04a,_0x49282b);_0x2cc665(_0x49282b);});});}exports[_0x0c54('0x15')]=function(_0x3cb404){var _0x36763b=this;return new Promise(function(_0x359fb0,_0x41716d){return db[_0x0c54('0x16')]['find']({'raw':_0x3cb404[_0x0c54('0x17')]?_0x3cb404['options'][_0x0c54('0x18')]===undefined?!![]:![]:!![],'where':_0x3cb404[_0x0c54('0x17')]?_0x3cb404[_0x0c54('0x17')][_0x0c54('0x19')]||null:null,'attributes':_0x3cb404[_0x0c54('0x17')]?_0x3cb404[_0x0c54('0x17')][_0x0c54('0x1a')]||null:null,'include':_0x3cb404[_0x0c54('0x17')]?_0x3cb404['options'][_0x0c54('0x1b')]?_[_0x0c54('0x1c')](_0x3cb404[_0x0c54('0x17')][_0x0c54('0x1b')],function(_0x1cd41c){return{'model':db[_0x1cd41c[_0x0c54('0x1d')]],'as':_0x1cd41c['as'],'attributes':_0x1cd41c[_0x0c54('0x1a')],'include':_0x1cd41c['include']?_['map'](_0x1cd41c[_0x0c54('0x1b')],function(_0x3f57b8){return{'model':db[_0x3f57b8[_0x0c54('0x1d')]],'as':_0x3f57b8['as'],'attributes':_0x3f57b8[_0x0c54('0x1a')],'include':_0x3f57b8[_0x0c54('0x1b')]?_[_0x0c54('0x1c')](_0x3f57b8[_0x0c54('0x1b')],function(_0x236c82){return{'model':db[_0x236c82['model']],'as':_0x236c82['as'],'attributes':_0x236c82[_0x0c54('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x0c54('0xb')](function(_0x1e5a3b){logger[_0x0c54('0xc')](_0x0c54('0x15'),_0x3cb404);logger['debug'](_0x0c54('0x15'),_0x3cb404,JSON[_0x0c54('0xf')](_0x1e5a3b));_0x359fb0(_0x1e5a3b);})[_0x0c54('0x14')](function(_0x4261fa){logger['error'](_0x0c54('0x15'),_0x4261fa[_0x0c54('0x12')],_0x3cb404);_0x41716d(_0x36763b[_0x0c54('0x10')](0x1f4,_0x4261fa[_0x0c54('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/index.js b/server/api/smsAccount/index.js index 0781245..7796e66 100644 --- a/server/api/smsAccount/index.js +++ b/server/api/smsAccount/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['getInteractions','/:id/status','statusGet','/:id/users','post','create','addAnswer','/:id/notify','notify','addApplications','send','status','addAgents','put','/:id','update','delete','destroy','/:id/canned_answers','removeAnswers','removeAgents','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsAccount.controller','get','index','/describe','isAuthenticated','/:id/dispositions','getDispositions','getAnswers','/:id/applications','getApplications'];(function(_0x98f01d,_0x30d607){var _0x509a4a=function(_0x3210dc){while(--_0x3210dc){_0x98f01d['push'](_0x98f01d['shift']());}};_0x509a4a(++_0x30d607);}(_0x7a54,0x106));var _0x47a5=function(_0x5bfd38,_0x15e2d2){_0x5bfd38=_0x5bfd38-0x0;var _0x5c61e0=_0x7a54[_0x5bfd38];return _0x5c61e0;};'use strict';var multer=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var path=require(_0x47a5('0x2'));var timeout=require('connect-timeout');var express=require(_0x47a5('0x3'));var router=express[_0x47a5('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x47a5('0x5'));var interaction=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var controller=require(_0x47a5('0x8'));router[_0x47a5('0x9')]('/',auth['isAuthenticated'](),controller[_0x47a5('0xa')]);router['get'](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller['describe']);router[_0x47a5('0x9')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x47a5('0x9')](_0x47a5('0xd'),auth['isAuthenticated'](),controller[_0x47a5('0xe')]);router['get']('/:id/canned_answers',auth[_0x47a5('0xc')](),controller[_0x47a5('0xf')]);router[_0x47a5('0x9')](_0x47a5('0x10'),auth[_0x47a5('0xc')](),controller[_0x47a5('0x11')]);router[_0x47a5('0x9')]('/:id/interactions',auth[_0x47a5('0xc')](),controller[_0x47a5('0x12')]);router[_0x47a5('0x9')](_0x47a5('0x13'),controller[_0x47a5('0x14')]);router[_0x47a5('0x9')](_0x47a5('0x15'),auth[_0x47a5('0xc')](),controller['getAgents']);router[_0x47a5('0x16')]('/',auth[_0x47a5('0xc')](),controller[_0x47a5('0x17')]);router[_0x47a5('0x16')](_0x47a5('0xd'),auth['isAuthenticated'](),controller['addDisposition']);router[_0x47a5('0x16')]('/:id/canned_answers',auth['isAuthenticated'](),controller[_0x47a5('0x18')]);router[_0x47a5('0x16')](_0x47a5('0x19'),controller[_0x47a5('0x1a')]);router[_0x47a5('0x16')](_0x47a5('0x10'),auth[_0x47a5('0xc')](),controller[_0x47a5('0x1b')]);router[_0x47a5('0x16')]('/:id/send',auth[_0x47a5('0xc')](),controller[_0x47a5('0x1c')]);router['post'](_0x47a5('0x13'),controller[_0x47a5('0x1d')]);router[_0x47a5('0x16')]('/:id/users',auth[_0x47a5('0xc')](),controller[_0x47a5('0x1e')]);router[_0x47a5('0x1f')](_0x47a5('0x20'),auth['isAuthenticated'](),controller[_0x47a5('0x21')]);router[_0x47a5('0x22')]('/:id',auth[_0x47a5('0xc')](),controller[_0x47a5('0x23')]);router[_0x47a5('0x22')](_0x47a5('0xd'),auth[_0x47a5('0xc')](),controller['removeDispositions']);router['delete'](_0x47a5('0x24'),auth['isAuthenticated'](),controller[_0x47a5('0x25')]);router['delete'](_0x47a5('0x15'),auth[_0x47a5('0xc')](),controller[_0x47a5('0x26')]);module[_0x47a5('0x27')]=router; \ No newline at end of file +var _0x7a54=['getInteractions','/:id/status','statusGet','/:id/users','post','create','addAnswer','/:id/notify','notify','addApplications','send','status','addAgents','put','/:id','update','delete','destroy','/:id/canned_answers','removeAnswers','removeAgents','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsAccount.controller','get','index','/describe','isAuthenticated','/:id/dispositions','getDispositions','getAnswers','/:id/applications','getApplications'];(function(_0x289c97,_0x483fdb){var _0x21b27b=function(_0x345c15){while(--_0x345c15){_0x289c97['push'](_0x289c97['shift']());}};_0x21b27b(++_0x483fdb);}(_0x7a54,0x106));var _0x47a5=function(_0x368392,_0x31cab9){_0x368392=_0x368392-0x0;var _0x5f32e8=_0x7a54[_0x368392];return _0x5f32e8;};'use strict';var multer=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var path=require(_0x47a5('0x2'));var timeout=require('connect-timeout');var express=require(_0x47a5('0x3'));var router=express[_0x47a5('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x47a5('0x5'));var interaction=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var controller=require(_0x47a5('0x8'));router[_0x47a5('0x9')]('/',auth['isAuthenticated'](),controller[_0x47a5('0xa')]);router['get'](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller['describe']);router[_0x47a5('0x9')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x47a5('0x9')](_0x47a5('0xd'),auth['isAuthenticated'](),controller[_0x47a5('0xe')]);router['get']('/:id/canned_answers',auth[_0x47a5('0xc')](),controller[_0x47a5('0xf')]);router[_0x47a5('0x9')](_0x47a5('0x10'),auth[_0x47a5('0xc')](),controller[_0x47a5('0x11')]);router[_0x47a5('0x9')]('/:id/interactions',auth[_0x47a5('0xc')](),controller[_0x47a5('0x12')]);router[_0x47a5('0x9')](_0x47a5('0x13'),controller[_0x47a5('0x14')]);router[_0x47a5('0x9')](_0x47a5('0x15'),auth[_0x47a5('0xc')](),controller['getAgents']);router[_0x47a5('0x16')]('/',auth[_0x47a5('0xc')](),controller[_0x47a5('0x17')]);router[_0x47a5('0x16')](_0x47a5('0xd'),auth['isAuthenticated'](),controller['addDisposition']);router[_0x47a5('0x16')]('/:id/canned_answers',auth['isAuthenticated'](),controller[_0x47a5('0x18')]);router[_0x47a5('0x16')](_0x47a5('0x19'),controller[_0x47a5('0x1a')]);router[_0x47a5('0x16')](_0x47a5('0x10'),auth[_0x47a5('0xc')](),controller[_0x47a5('0x1b')]);router[_0x47a5('0x16')]('/:id/send',auth[_0x47a5('0xc')](),controller[_0x47a5('0x1c')]);router['post'](_0x47a5('0x13'),controller[_0x47a5('0x1d')]);router[_0x47a5('0x16')]('/:id/users',auth[_0x47a5('0xc')](),controller[_0x47a5('0x1e')]);router[_0x47a5('0x1f')](_0x47a5('0x20'),auth['isAuthenticated'](),controller[_0x47a5('0x21')]);router[_0x47a5('0x22')]('/:id',auth[_0x47a5('0xc')](),controller[_0x47a5('0x23')]);router[_0x47a5('0x22')](_0x47a5('0xd'),auth[_0x47a5('0xc')](),controller['removeDispositions']);router['delete'](_0x47a5('0x24'),auth['isAuthenticated'](),controller[_0x47a5('0x25')]);router['delete'](_0x47a5('0x15'),auth[_0x47a5('0xc')](),controller[_0x47a5('0x26')]);module[_0x47a5('0x27')]=router; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.attributes.js b/server/api/smsAccount/smsAccount.attributes.js index a42aca9..07ab6ef 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 _0xff74=['exports','STRING','name','generate','ENUM','skebby','connectel','clicksend','plivo','clickatell','infobip','intelepeer','BOOLEAN','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','sequelize','randomstring'];(function(_0x476bf4,_0x2a3755){var _0x788ffe=function(_0x13fa11){while(--_0x13fa11){_0x476bf4['push'](_0x476bf4['shift']());}};_0x788ffe(++_0x2a3755);}(_0xff74,0x1a0));var _0x4ff7=function(_0x14cc99,_0x2388ac){_0x14cc99=_0x14cc99-0x0;var _0x1cba02=_0xff74[_0x14cc99];return _0x1cba02;};'use strict';var Sequelize=require(_0x4ff7('0x0'));var rs=require(_0x4ff7('0x1'));module[_0x4ff7('0x2')]={'name':{'type':Sequelize[_0x4ff7('0x3')],'unique':_0x4ff7('0x4'),'allowNull':![]},'key':{'type':Sequelize[_0x4ff7('0x3')],'allowNull':![]},'remote':{'type':Sequelize[_0x4ff7('0x3')],'allowNull':![]},'token':{'type':Sequelize[_0x4ff7('0x3')],'defaultValue':function(){return rs[_0x4ff7('0x5')]();}},'phone':{'type':Sequelize[_0x4ff7('0x3')]},'type':{'type':Sequelize[_0x4ff7('0x6')]('twilio',_0x4ff7('0x7'),_0x4ff7('0x8'),_0x4ff7('0x9'),_0x4ff7('0xa'),_0x4ff7('0xb'),'bandwidth','csc',_0x4ff7('0xc'),_0x4ff7('0xd'))},'accountSid':{'type':Sequelize[_0x4ff7('0x3')]},'authId':{'type':Sequelize[_0x4ff7('0x3')]},'authToken':{'type':Sequelize[_0x4ff7('0x3')]},'smsMethod':{'type':Sequelize[_0x4ff7('0x6')]('SI','TI','GP')},'username':{'type':Sequelize[_0x4ff7('0x3')]},'password':{'type':Sequelize[_0x4ff7('0x3')]},'apiKey':{'type':Sequelize[_0x4ff7('0x3')]},'applicationId':{'type':Sequelize[_0x4ff7('0x3')]},'accountId':{'type':Sequelize[_0x4ff7('0x3')]},'senderString':{'type':Sequelize[_0x4ff7('0x3')]},'deliveryReport':{'type':Sequelize[_0x4ff7('0xe')],'defaultValue':![]},'description':{'type':Sequelize[_0x4ff7('0x3')]},'notificationTemplate':{'type':Sequelize[_0x4ff7('0xf')],'defaultValue':function(){return _0x4ff7('0x10');}},'notificationSound':{'type':Sequelize[_0x4ff7('0xe')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x4ff7('0xe')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x4ff7('0x11')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x4ff7('0x11')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x4ff7('0xe')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x4ff7('0x11')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x4ff7('0xe')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0x4ff7('0x3')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0x4ff7('0x11')],'comment':_0x4ff7('0x12')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x4ff7('0x13'),'set':function(_0x375c03){if(!_0x375c03)this[_0x4ff7('0x14')](_0x4ff7('0x15'),null);this[_0x4ff7('0x14')]('mandatoryDisposition',_0x375c03);}}}; \ No newline at end of file +var _0x47dc=['randomstring','exports','STRING','skebby','connectel','clicksend','csc','infobip','BOOLEAN','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','INTEGER','setDataValue','mandatoryDisposition','sequelize'];(function(_0x4cc756,_0x455fdd){var _0x5738e3=function(_0x4fc566){while(--_0x4fc566){_0x4cc756['push'](_0x4cc756['shift']());}};_0x5738e3(++_0x455fdd);}(_0x47dc,0xfe));var _0xc47d=function(_0x5d12be,_0x257dea){_0x5d12be=_0x5d12be-0x0;var _0x467154=_0x47dc[_0x5d12be];return _0x467154;};'use strict';var Sequelize=require(_0xc47d('0x0'));var rs=require(_0xc47d('0x1'));module[_0xc47d('0x2')]={'name':{'type':Sequelize[_0xc47d('0x3')],'unique':'name','allowNull':![]},'key':{'type':Sequelize[_0xc47d('0x3')],'allowNull':![]},'remote':{'type':Sequelize[_0xc47d('0x3')],'allowNull':![]},'token':{'type':Sequelize[_0xc47d('0x3')],'defaultValue':function(){return rs['generate']();}},'phone':{'type':Sequelize[_0xc47d('0x3')]},'type':{'type':Sequelize['ENUM']('twilio',_0xc47d('0x4'),_0xc47d('0x5'),_0xc47d('0x6'),'plivo','clickatell','bandwidth',_0xc47d('0x7'),_0xc47d('0x8'),'intelepeer')},'accountSid':{'type':Sequelize[_0xc47d('0x3')]},'authId':{'type':Sequelize[_0xc47d('0x3')]},'authToken':{'type':Sequelize[_0xc47d('0x3')]},'smsMethod':{'type':Sequelize['ENUM']('SI','TI','GP')},'username':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0xc47d('0x3')]},'apiKey':{'type':Sequelize[_0xc47d('0x3')]},'applicationId':{'type':Sequelize[_0xc47d('0x3')]},'accountId':{'type':Sequelize['STRING']},'senderString':{'type':Sequelize[_0xc47d('0x3')]},'deliveryReport':{'type':Sequelize[_0xc47d('0x9')],'defaultValue':![]},'description':{'type':Sequelize[_0xc47d('0x3')]},'notificationTemplate':{'type':Sequelize[_0xc47d('0xa')],'defaultValue':function(){return _0xc47d('0xb');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xc47d('0x9')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0xc47d('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xc47d('0x9')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xc47d('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xc47d('0x9')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xc47d('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0xc47d('0x3')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0xc47d('0xc')],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0xc47d('0x9')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0xff1767){if(!_0xff1767)this[_0xc47d('0xd')]('mandatoryDispositionPauseId',null);this[_0xc47d('0xd')](_0xc47d('0xe'),_0xff1767);}}}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.controller.js b/server/api/smsAccount/smsAccount.controller.js index 3e9cf07..739cc30 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 _0xdf1d=['getDispositions','findOne','options','findAll','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','nolimit','removeAnswers','notify','sms','SmsApplication','Applications','account','applications','priority','asc','CmContact','describe','Sequelize','ValidationError','no\x20available\x20attributes','createdAt','difference','updatedAt','CompanyId','ListId','twilio','from','From','Body','skebby','text','connectel','clicksend','messageId','plivo','Text','results','csc','originatingAddress','segmentedMessage','clickatell','fromNumber','replyMessageId','bandwidth','intelepeer','from\x20is\x20mandatory','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','Contacts','DESC','list','omit','defaults','contact','SmsInteraction','spread','interaction','created','autoclose','push','close','unmanaged','*,*,*,*','ContactId','AttachmentId','UserId','User','unshift','agent','waitForTheAssignedAgent','queueId','SmsQueue','queue','Start','startRouting','receiveMessage','entity\x20found','SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s','text/xml','\x0a','json','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','bulkCreate','findAndCountAll','finally','getApplications','getInteractions','Owner','internal','Tag','Tags','color','tag','isNil','to\x20is\x20mandatory','List','dataValues','Messages','received\x20delivery\x20report\x20from','inspect','SmsMessage','skebby_dispatch_id','requestid','statusInt','message_id','infobip','groupName','redif','DELIVERED','error_code','DELIVERED_TO_GATEWAY','DELIVRD','ACCEPTD','statusGet','message-id','state','addAgents','emit','userSmsAccount:save','removeAgents','isArray','userSmsAccount:remove','getAgents','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','to-csv','fs-extra','lodash','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./smsAccount.socket','register','jayson/promise','client','http','then','info','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','sendStatus','status','end','offset','limit','undefined','count','Content-Range','update','destroy','get','UserProfileResource','stack','name','send','Pause','mandatoryDispositionPause','map','SmsAccount','rawAttributes','fieldName','type','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','filters','pick','filter','where','merge','VIRTUAL','includeAll','include','rows','show','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','SmsAccounts','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','addDisposition','SmsAccountId','Disposition'];(function(_0x1b40c5,_0x5426e2){var _0x112fd8=function(_0x8e364){while(--_0x8e364){_0x1b40c5['push'](_0x1b40c5['shift']());}};_0x112fd8(++_0x5426e2);}(_0xdf1d,0x171));var _0xddf1=function(_0x5608a3,_0x5b33c5){_0x5608a3=_0x5608a3-0x0;var _0x1ed50a=_0xdf1d[_0x5608a3];return _0x1ed50a;};'use strict';var emlformat=require(_0xddf1('0x0'));var rimraf=require(_0xddf1('0x1'));var zipdir=require(_0xddf1('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xddf1('0x3'));var moment=require(_0xddf1('0x4'));var BPromise=require(_0xddf1('0x5'));var Mustache=require(_0xddf1('0x6'));var util=require(_0xddf1('0x7'));var path=require(_0xddf1('0x8'));var sox=require('sox');var csv=require(_0xddf1('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xddf1('0xa'));var _=require(_0xddf1('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xddf1('0xc'));var toCsv=require(_0xddf1('0x9'));var querystring=require('querystring');var Papa=require(_0xddf1('0xd'));var Redis=require(_0xddf1('0xe'));var authService=require(_0xddf1('0xf'));var qs=require(_0xddf1('0x10'));var as=require(_0xddf1('0x11'));var hardwareService=require(_0xddf1('0x12'));var logger=require(_0xddf1('0x13'))(_0xddf1('0x14'));var utils=require('../../config/utils');var config=require(_0xddf1('0x15'));var licenseUtil=require(_0xddf1('0x16'));var db=require(_0xddf1('0x17'))['db'];config[_0xddf1('0x18')]=_['defaults'](config[_0xddf1('0x18')],{'host':_0xddf1('0x19'),'port':0x18eb});var socket=require(_0xddf1('0x1a'))(new Redis(config[_0xddf1('0x18')]));require(_0xddf1('0x1b'))[_0xddf1('0x1c')](socket);var jayson=require(_0xddf1('0x1d'));var client=jayson[_0xddf1('0x1e')][_0xddf1('0x1f')]({'port':0x232c});function respondWithRpcPromise(_0x6d21ad,_0x31bae7,_0x529dc9,_0x20ec94){return new BPromise(function(_0x206818,_0x330b86){var _0x17e72e=_0x20ec94||client;return _0x17e72e['request'](_0x6d21ad,_0x529dc9)[_0xddf1('0x20')](function(_0x33b324){logger[_0xddf1('0x21')](_0xddf1('0x22'),_0x31bae7,_0xddf1('0x23'));logger[_0xddf1('0x24')](_0xddf1('0x25'),_0x31bae7,_0xddf1('0x23'),JSON[_0xddf1('0x26')](_0x33b324));if(_0x33b324[_0xddf1('0x27')]){if(_0x33b324[_0xddf1('0x27')][_0xddf1('0x28')]===0x1f4){logger[_0xddf1('0x27')]('SmsAccount,\x20%s,\x20%s',_0x31bae7,_0x33b324[_0xddf1('0x27')][_0xddf1('0x29')]);return _0x330b86(_0x33b324[_0xddf1('0x27')][_0xddf1('0x29')]);}logger[_0xddf1('0x27')](_0xddf1('0x22'),_0x31bae7,_0x33b324[_0xddf1('0x27')]['message']);return _0x206818(_0x33b324[_0xddf1('0x27')]['message']);}else{logger['info']('SmsAccount,\x20%s,\x20%s',_0x31bae7,_0xddf1('0x23'));_0x206818(_0x33b324['result'][_0xddf1('0x29')]);}})[_0xddf1('0x2a')](function(_0x451852){logger[_0xddf1('0x27')](_0xddf1('0x22'),_0x31bae7,_0x451852);_0x330b86(_0x451852);});});}function respondWithStatusCode(_0x462213,_0x1466cc){_0x1466cc=_0x1466cc||0xcc;return function(_0x149ad3){if(_0x149ad3){return _0x462213[_0xddf1('0x2b')](_0x1466cc);}return _0x462213[_0xddf1('0x2c')](_0x1466cc)[_0xddf1('0x2d')]();};}function respondWithResult(_0x291b26,_0x4b83b5){_0x4b83b5=_0x4b83b5||0xc8;return function(_0xe7ebe){if(_0xe7ebe){return _0x291b26[_0xddf1('0x2c')](_0x4b83b5)['json'](_0xe7ebe);}};}function respondWithFilteredResult(_0x498e36,_0x24a83f){return function(_0x45a74d){if(_0x45a74d){var _0x354335=typeof _0x24a83f[_0xddf1('0x2e')]==='undefined'&&typeof _0x24a83f[_0xddf1('0x2f')]===_0xddf1('0x30');var _0x2c05c4=_0x45a74d[_0xddf1('0x31')];var _0x44d70e=_0x354335?0x0:_0x24a83f[_0xddf1('0x2e')];var _0x21749b=_0x354335?_0x45a74d[_0xddf1('0x31')]:_0x24a83f[_0xddf1('0x2e')]+_0x24a83f['limit'];var _0x5ed2d4;if(_0x21749b>=_0x2c05c4){_0x21749b=_0x2c05c4;_0x5ed2d4=0xc8;}else{_0x5ed2d4=0xce;}_0x498e36[_0xddf1('0x2c')](_0x5ed2d4);return _0x498e36['set'](_0xddf1('0x32'),_0x44d70e+'-'+_0x21749b+'/'+_0x2c05c4)['json'](_0x45a74d);}return null;};}function patchUpdates(_0x1e6ef6){return function(_0x569cef){try{jsonpatch['apply'](_0x569cef,_0x1e6ef6,!![]);}catch(_0x2bbef1){return BPromise['reject'](_0x2bbef1);}return _0x569cef['save']();};}function saveUpdates(_0x4f0d07,_0x4b77e1){return function(_0x176be0){if(_0x176be0){return _0x176be0[_0xddf1('0x33')](_0x4f0d07)['then'](function(_0x36d548){return _0x36d548;});}return null;};}function removeEntity(_0x2ad1bb,_0xdde1ba){return function(_0x5b944c){if(_0x5b944c){return _0x5b944c[_0xddf1('0x34')]()['then'](function(){var _0x3dcc2d=_0x5b944c[_0xddf1('0x35')]({'plain':!![]});var _0x4d5973='SmsAccounts';return db[_0xddf1('0x36')][_0xddf1('0x34')]({'where':{'type':_0x4d5973,'resourceId':_0x3dcc2d['id']}})[_0xddf1('0x20')](function(){return _0x5b944c;});})[_0xddf1('0x20')](function(){_0x2ad1bb['status'](0xcc)[_0xddf1('0x2d')]();});}};}function handleEntityNotFound(_0x27a261,_0x5256c4){return function(_0x38d898){if(!_0x38d898){_0x27a261[_0xddf1('0x2b')](0x194);}return _0x38d898;};}function handleError(_0x2cde1e,_0x46bf49){_0x46bf49=_0x46bf49||0x1f4;return function(_0x144530){logger[_0xddf1('0x27')](_0x144530[_0xddf1('0x37')]);if(_0x144530[_0xddf1('0x38')]){delete _0x144530['name'];}_0x2cde1e[_0xddf1('0x2c')](_0x46bf49)[_0xddf1('0x39')](_0x144530);};}exports['index']=function(_0x6a6538,_0xdfbe87){var _0x913faf={'include':[{'model':db[_0xddf1('0x3a')],'as':_0xddf1('0x3b')}]},_0x5bee71={},_0x57582b={'count':0x0,'rows':[]};var _0x2a2632=_[_0xddf1('0x3c')](db[_0xddf1('0x3d')][_0xddf1('0x3e')],function(_0x13965d){return{'name':_0x13965d[_0xddf1('0x3f')],'type':_0x13965d[_0xddf1('0x40')]['key']};});_0x5bee71['model']=_[_0xddf1('0x3c')](_0x2a2632,'name');_0x5bee71[_0xddf1('0x41')]=_[_0xddf1('0x42')](_0x6a6538[_0xddf1('0x41')]);_0x5bee71['filters']=_[_0xddf1('0x43')](_0x5bee71[_0xddf1('0x44')],_0x5bee71[_0xddf1('0x41')]);_0x913faf[_0xddf1('0x45')]=_[_0xddf1('0x43')](_0x5bee71['model'],qs[_0xddf1('0x46')](_0x6a6538[_0xddf1('0x41')][_0xddf1('0x46')]));_0x913faf[_0xddf1('0x45')]=_0x913faf['attributes'][_0xddf1('0x47')]?_0x913faf['attributes']:_0x5bee71['model'];if(!_0x6a6538[_0xddf1('0x41')][_0xddf1('0x48')]('nolimit')){_0x913faf['limit']=qs['limit'](_0x6a6538[_0xddf1('0x41')][_0xddf1('0x2f')]);_0x913faf[_0xddf1('0x2e')]=qs[_0xddf1('0x2e')](_0x6a6538[_0xddf1('0x41')][_0xddf1('0x2e')]);}_0x913faf[_0xddf1('0x49')]=qs[_0xddf1('0x4a')](_0x6a6538['query'][_0xddf1('0x4a')]);_0x913faf['where']=qs[_0xddf1('0x4b')](_[_0xddf1('0x4c')](_0x6a6538['query'],_0x5bee71[_0xddf1('0x4b')]),_0x2a2632);if(_0x6a6538['query'][_0xddf1('0x4d')]){_0x913faf[_0xddf1('0x4e')]=_[_0xddf1('0x4f')](_0x913faf[_0xddf1('0x4e')],{'$or':_['map'](_0x2a2632,function(_0x3fc0bc){if(_0x3fc0bc[_0xddf1('0x40')]!==_0xddf1('0x50')){var _0x584f01={};_0x584f01[_0x3fc0bc[_0xddf1('0x38')]]={'$like':'%'+_0x6a6538[_0xddf1('0x41')][_0xddf1('0x4d')]+'%'};return _0x584f01;}})});}_0x913faf=_[_0xddf1('0x4f')]({},_0x913faf,_0x6a6538['options']);var _0x4924f7={'where':_0x913faf[_0xddf1('0x4e')]};return db[_0xddf1('0x3d')][_0xddf1('0x31')](_0x4924f7)['then'](function(_0x27c443){_0x57582b['count']=_0x27c443;if(_0x6a6538[_0xddf1('0x41')][_0xddf1('0x51')]){_0x913faf[_0xddf1('0x52')]=[{'all':!![]}];}return db[_0xddf1('0x3d')]['findAll'](_0x913faf);})['then'](function(_0x62d4b8){_0x57582b[_0xddf1('0x53')]=_0x62d4b8;return _0x57582b;})[_0xddf1('0x20')](respondWithFilteredResult(_0xdfbe87,_0x913faf))[_0xddf1('0x2a')](handleError(_0xdfbe87,null));};exports[_0xddf1('0x54')]=function(_0x1408a7,_0x5df3c4){var _0x19a0df={'raw':![],'where':{'id':_0x1408a7['params']['id']},'include':[{'model':db['Pause'],'as':_0xddf1('0x3b')}]},_0x578927={};_0x578927[_0xddf1('0x44')]=_['keys'](db[_0xddf1('0x3d')][_0xddf1('0x3e')]);_0x578927[_0xddf1('0x41')]=_[_0xddf1('0x42')](_0x1408a7[_0xddf1('0x41')]);_0x578927[_0xddf1('0x4b')]=_[_0xddf1('0x43')](_0x578927[_0xddf1('0x44')],_0x578927[_0xddf1('0x41')]);_0x19a0df['attributes']=_[_0xddf1('0x43')](_0x578927[_0xddf1('0x44')],qs[_0xddf1('0x46')](_0x1408a7['query'][_0xddf1('0x46')]));_0x19a0df[_0xddf1('0x45')]=_0x19a0df['attributes'][_0xddf1('0x47')]?_0x19a0df[_0xddf1('0x45')]:_0x578927[_0xddf1('0x44')];if(_0x1408a7['query'][_0xddf1('0x51')]){_0x19a0df['include']=[{'all':!![]}];}_0x19a0df=_[_0xddf1('0x4f')]({},_0x19a0df,_0x1408a7['options']);return db[_0xddf1('0x3d')][_0xddf1('0x55')](_0x19a0df)[_0xddf1('0x20')](handleEntityNotFound(_0x5df3c4,null))[_0xddf1('0x20')](respondWithResult(_0x5df3c4,null))[_0xddf1('0x2a')](handleError(_0x5df3c4,null));};exports[_0xddf1('0x56')]=function(_0x371d0a,_0x2ffff4){return db[_0xddf1('0x3d')][_0xddf1('0x56')](_0x371d0a['body'],{})[_0xddf1('0x20')](function(_0x363cff){var _0x96c095=_0x371d0a['user'][_0xddf1('0x35')]({'plain':!![]});if(!_0x96c095)throw new Error(_0xddf1('0x57'));if(_0x96c095[_0xddf1('0x58')]===_0xddf1('0x59')){var _0x5063f1=_0x363cff[_0xddf1('0x35')]({'plain':!![]});var _0x519e6e=_0xddf1('0x5a');return db['UserProfileSection']['find']({'where':{'name':_0x519e6e,'userProfileId':_0x96c095[_0xddf1('0x5b')]},'raw':!![]})[_0xddf1('0x20')](function(_0x2743e9){if(_0x2743e9&&_0x2743e9[_0xddf1('0x5c')]===0x0){return db[_0xddf1('0x36')][_0xddf1('0x56')]({'name':_0x5063f1[_0xddf1('0x38')],'resourceId':_0x5063f1['id'],'type':_0x2743e9[_0xddf1('0x38')],'sectionId':_0x2743e9['id']},{})[_0xddf1('0x20')](function(){return _0x363cff;});}else{return _0x363cff;}})[_0xddf1('0x2a')](function(_0x2a1ad6){logger[_0xddf1('0x27')](_0xddf1('0x5d'),_0x2a1ad6);throw _0x2a1ad6;});}return _0x363cff;})[_0xddf1('0x20')](respondWithResult(_0x2ffff4,0xc9))[_0xddf1('0x2a')](handleError(_0x2ffff4,null));};exports['update']=function(_0x455853,_0x161794){if(_0x455853[_0xddf1('0x5e')]['id']){delete _0x455853[_0xddf1('0x5e')]['id'];}return db[_0xddf1('0x3d')][_0xddf1('0x55')]({'where':{'id':_0x455853['params']['id']},'include':[{'model':db['Pause'],'as':_0xddf1('0x3b')}]})['then'](handleEntityNotFound(_0x161794,null))[_0xddf1('0x20')](saveUpdates(_0x455853[_0xddf1('0x5e')],null))['then'](respondWithResult(_0x161794,null))['catch'](handleError(_0x161794,null));};exports[_0xddf1('0x34')]=function(_0x17b382,_0x179727){return db[_0xddf1('0x3d')]['find']({'where':{'id':_0x17b382[_0xddf1('0x5f')]['id']}})[_0xddf1('0x20')](handleEntityNotFound(_0x179727,null))[_0xddf1('0x20')](removeEntity(_0x179727,null))['catch'](handleError(_0x179727,null));};exports['describe']=function(_0x3cf974,_0xe42ec3){return db[_0xddf1('0x3d')]['describe']()[_0xddf1('0x20')](respondWithResult(_0xe42ec3,null))[_0xddf1('0x2a')](handleError(_0xe42ec3,null));};exports[_0xddf1('0x60')]=function(_0x44879f,_0x41b561,_0x25c8de){if(_0x44879f[_0xddf1('0x5e')]['id']){delete _0x44879f[_0xddf1('0x5e')]['id'];}return db[_0xddf1('0x3d')][_0xddf1('0x55')]({'where':{'id':_0x44879f[_0xddf1('0x5f')]['id']}})[_0xddf1('0x20')](handleEntityNotFound(_0x41b561,null))[_0xddf1('0x20')](function(_0x2e22fa){if(_0x2e22fa){_0x44879f[_0xddf1('0x5e')][_0xddf1('0x61')]=_0x2e22fa['id'];return db[_0xddf1('0x62')]['create'](_0x44879f[_0xddf1('0x5e')]);}})['then'](respondWithResult(_0x41b561,null))['catch'](handleError(_0x41b561,null));};exports[_0xddf1('0x63')]=function(_0x301243,_0x1b3fe3,_0x856c85){var _0x5593fa={'raw':![],'where':{}};var _0x533a8b={};var _0x570ad6={'count':0x0,'rows':[]};return db[_0xddf1('0x3d')][_0xddf1('0x64')]({'where':{'id':_0x301243[_0xddf1('0x5f')]['id']}})[_0xddf1('0x20')](handleEntityNotFound(_0x1b3fe3,null))['then'](function(_0x1cea70){if(_0x1cea70){_0x533a8b['model']=_[_0xddf1('0x42')](db[_0xddf1('0x62')]['rawAttributes']);_0x533a8b['query']=_[_0xddf1('0x42')](_0x301243['query']);_0x533a8b['filters']=_[_0xddf1('0x43')](_0x533a8b[_0xddf1('0x44')],_0x533a8b[_0xddf1('0x41')]);_0x5593fa['attributes']=_['intersection'](_0x533a8b[_0xddf1('0x44')],qs[_0xddf1('0x46')](_0x301243[_0xddf1('0x41')][_0xddf1('0x46')]));_0x5593fa[_0xddf1('0x45')]=_0x5593fa[_0xddf1('0x45')][_0xddf1('0x47')]?_0x5593fa[_0xddf1('0x45')]:_0x533a8b[_0xddf1('0x44')];if(!_0x301243[_0xddf1('0x41')][_0xddf1('0x48')]('nolimit')){_0x5593fa[_0xddf1('0x2f')]=qs['limit'](_0x301243[_0xddf1('0x41')][_0xddf1('0x2f')]);_0x5593fa[_0xddf1('0x2e')]=qs[_0xddf1('0x2e')](_0x301243['query'][_0xddf1('0x2e')]);}_0x5593fa[_0xddf1('0x49')]=qs[_0xddf1('0x4a')](_0x301243[_0xddf1('0x41')][_0xddf1('0x4a')]);_0x5593fa[_0xddf1('0x4e')]=qs[_0xddf1('0x4b')](_[_0xddf1('0x4c')](_0x301243[_0xddf1('0x41')],_0x533a8b[_0xddf1('0x4b')]));_0x5593fa[_0xddf1('0x4e')][_0xddf1('0x61')]=_0x1cea70['id'];if(_0x301243['query'][_0xddf1('0x4d')]){_0x5593fa[_0xddf1('0x4e')]=_[_0xddf1('0x4f')](_0x5593fa[_0xddf1('0x4e')],{'$or':_[_0xddf1('0x3c')](_0x5593fa[_0xddf1('0x45')],function(_0x381811){var _0x2484bb={};_0x2484bb[_0x381811]={'$like':'%'+_0x301243[_0xddf1('0x41')][_0xddf1('0x4d')]+'%'};return _0x2484bb;})});}_0x5593fa=_[_0xddf1('0x4f')]({},_0x5593fa,_0x301243[_0xddf1('0x65')]);return db[_0xddf1('0x62')][_0xddf1('0x31')]({'where':_0x5593fa[_0xddf1('0x4e')]})[_0xddf1('0x20')](function(_0x1d4606){_0x570ad6[_0xddf1('0x31')]=_0x1d4606;if(_0x301243[_0xddf1('0x41')][_0xddf1('0x51')]){_0x5593fa[_0xddf1('0x52')]=[{'all':!![]}];}return db[_0xddf1('0x62')][_0xddf1('0x66')](_0x5593fa);})[_0xddf1('0x20')](function(_0x42a0c9){_0x570ad6['rows']=_0x42a0c9;return _0x570ad6;});}})[_0xddf1('0x20')](respondWithFilteredResult(_0x1b3fe3,_0x5593fa))['catch'](handleError(_0x1b3fe3,null));};exports[_0xddf1('0x67')]=function(_0x26a90e,_0x5c5219,_0x19ec6b){return db['SmsAccount'][_0xddf1('0x55')]({'where':{'id':_0x26a90e['params']['id']}})['then'](handleEntityNotFound(_0x5c5219,null))[_0xddf1('0x20')](function(_0x51a103){if(_0x51a103){return _0x51a103['removeDispositions'](_0x26a90e[_0xddf1('0x41')][_0xddf1('0x68')]);}})[_0xddf1('0x20')](respondWithStatusCode(_0x5c5219,null))['catch'](handleError(_0x5c5219,null));};exports[_0xddf1('0x69')]=function(_0x5da7ca,_0x567213,_0x13cb29){if(_0x5da7ca[_0xddf1('0x5e')]['id']){delete _0x5da7ca[_0xddf1('0x5e')]['id'];}return db[_0xddf1('0x3d')][_0xddf1('0x55')]({'where':{'id':_0x5da7ca[_0xddf1('0x5f')]['id']}})[_0xddf1('0x20')](handleEntityNotFound(_0x567213,null))[_0xddf1('0x20')](function(_0x13b4e4){if(_0x13b4e4){_0x5da7ca['body']['SmsAccountId']=_0x13b4e4['id'];return db[_0xddf1('0x6a')][_0xddf1('0x56')](_0x5da7ca['body']);}})[_0xddf1('0x20')](respondWithResult(_0x567213,null))[_0xddf1('0x2a')](handleError(_0x567213,null));};exports[_0xddf1('0x6b')]=function(_0x1b7833,_0x3df146,_0x1f827a){var _0x57cce6={'raw':![],'where':{}};var _0x3b2159={};var _0x33df40={'count':0x0,'rows':[]};return db[_0xddf1('0x3d')][_0xddf1('0x64')]({'where':{'id':_0x1b7833['params']['id']}})[_0xddf1('0x20')](handleEntityNotFound(_0x3df146,null))[_0xddf1('0x20')](function(_0x478b9d){if(_0x478b9d){_0x3b2159[_0xddf1('0x44')]=_['keys'](db[_0xddf1('0x6a')][_0xddf1('0x3e')]);_0x3b2159[_0xddf1('0x41')]=_[_0xddf1('0x42')](_0x1b7833['query']);_0x3b2159['filters']=_[_0xddf1('0x43')](_0x3b2159['model'],_0x3b2159[_0xddf1('0x41')]);_0x57cce6[_0xddf1('0x45')]=_[_0xddf1('0x43')](_0x3b2159['model'],qs[_0xddf1('0x46')](_0x1b7833[_0xddf1('0x41')][_0xddf1('0x46')]));_0x57cce6[_0xddf1('0x45')]=_0x57cce6[_0xddf1('0x45')][_0xddf1('0x47')]?_0x57cce6['attributes']:_0x3b2159['model'];if(!_0x1b7833[_0xddf1('0x41')][_0xddf1('0x48')](_0xddf1('0x6c'))){_0x57cce6['limit']=qs[_0xddf1('0x2f')](_0x1b7833[_0xddf1('0x41')][_0xddf1('0x2f')]);_0x57cce6[_0xddf1('0x2e')]=qs[_0xddf1('0x2e')](_0x1b7833[_0xddf1('0x41')][_0xddf1('0x2e')]);}_0x57cce6['order']=qs[_0xddf1('0x4a')](_0x1b7833[_0xddf1('0x41')][_0xddf1('0x4a')]);_0x57cce6[_0xddf1('0x4e')]=qs[_0xddf1('0x4b')](_[_0xddf1('0x4c')](_0x1b7833[_0xddf1('0x41')],_0x3b2159[_0xddf1('0x4b')]));_0x57cce6['where'][_0xddf1('0x61')]=_0x478b9d['id'];if(_0x1b7833[_0xddf1('0x41')]['filter']){_0x57cce6[_0xddf1('0x4e')]=_[_0xddf1('0x4f')](_0x57cce6[_0xddf1('0x4e')],{'$or':_['map'](_0x57cce6['attributes'],function(_0x32e486){var _0x1582ea={};_0x1582ea[_0x32e486]={'$like':'%'+_0x1b7833[_0xddf1('0x41')]['filter']+'%'};return _0x1582ea;})});}_0x57cce6=_[_0xddf1('0x4f')]({},_0x57cce6,_0x1b7833[_0xddf1('0x65')]);return db[_0xddf1('0x6a')][_0xddf1('0x31')]({'where':_0x57cce6[_0xddf1('0x4e')]})[_0xddf1('0x20')](function(_0x58bf6e){_0x33df40[_0xddf1('0x31')]=_0x58bf6e;if(_0x1b7833['query'][_0xddf1('0x51')]){_0x57cce6['include']=[{'all':!![]}];}return db[_0xddf1('0x6a')][_0xddf1('0x66')](_0x57cce6);})[_0xddf1('0x20')](function(_0x72dedb){_0x33df40[_0xddf1('0x53')]=_0x72dedb;return _0x33df40;});}})[_0xddf1('0x20')](respondWithFilteredResult(_0x3df146,_0x57cce6))[_0xddf1('0x2a')](handleError(_0x3df146,null));};exports[_0xddf1('0x6d')]=function(_0x3569f7,_0x563ec1,_0x4afaa7){return db[_0xddf1('0x3d')]['find']({'where':{'id':_0x3569f7[_0xddf1('0x5f')]['id']}})['then'](handleEntityNotFound(_0x563ec1,null))[_0xddf1('0x20')](function(_0x5a4e0c){if(_0x5a4e0c){return _0x5a4e0c[_0xddf1('0x6d')](_0x3569f7[_0xddf1('0x41')][_0xddf1('0x68')]);}})['then'](respondWithStatusCode(_0x563ec1,null))[_0xddf1('0x2a')](handleError(_0x563ec1,null));};exports[_0xddf1('0x6e')]=function(_0x174659,_0xb3918c,_0x111193){var _0x470d6e={'channel':_0xddf1('0x6f')};var _0x2f5a34=[];var _0x12844f=[];var _0x166f3f={};return db['SmsAccount'][_0xddf1('0x55')]({'where':{'id':_0x174659[_0xddf1('0x5f')]['id']},'include':[{'model':db[_0xddf1('0x70')],'as':_0xddf1('0x71')}]})[_0xddf1('0x20')](handleEntityNotFound(_0xb3918c,null))[_0xddf1('0x20')](function(_0x25f0d1){_0x470d6e[_0xddf1('0x72')]=_0x25f0d1;_0x470d6e[_0xddf1('0x73')]=_['orderBy'](_0x25f0d1[_0xddf1('0x71')],[_0xddf1('0x74')],[_0xddf1('0x75')]);if(_0x470d6e[_0xddf1('0x72')]['Applications']){delete _0x470d6e['account'][_0xddf1('0x71')];}return db[_0xddf1('0x76')][_0xddf1('0x77')]();})['then'](function(_0x3f8fb8){if(!_0x3f8fb8){throw new db[(_0xddf1('0x78'))][(_0xddf1('0x79'))](_0xddf1('0x7a'));}_0x2f5a34=_['difference'](_[_0xddf1('0x42')](_0x3f8fb8),[_0xddf1('0x7b'),'updatedAt']);_0x12844f=_[_0xddf1('0x7c')](_['keys'](_0x3f8fb8),[_0xddf1('0x7b'),_0xddf1('0x7d'),_0xddf1('0x7e'),_0xddf1('0x7f')]);_0x470d6e['body']={'mapKey':'mobile'};if(_0x470d6e[_0xddf1('0x72')]['type']){switch(_0x470d6e['account']['type']){case _0xddf1('0x80'):_0x470d6e[_0xddf1('0x5e')][_0xddf1('0x81')]=_0x174659['body'][_0xddf1('0x82')];_0x470d6e['body'][_0xddf1('0x5e')]=_0x174659[_0xddf1('0x5e')][_0xddf1('0x83')];_0x470d6e['body']['messageId']=_0x174659[_0xddf1('0x5e')]['MessageSid'];break;case _0xddf1('0x84'):_0x470d6e[_0xddf1('0x5e')]['from']='+'+_0x174659[_0xddf1('0x5e')]['sender'];_0x470d6e[_0xddf1('0x5e')][_0xddf1('0x5e')]=_0x174659[_0xddf1('0x5e')][_0xddf1('0x85')];break;case _0xddf1('0x86'):_0x470d6e[_0xddf1('0x5e')]['from']=_0x174659[_0xddf1('0x5e')][_0xddf1('0x81')];_0x470d6e['body'][_0xddf1('0x5e')]=_0x174659[_0xddf1('0x5e')][_0xddf1('0x29')];break;case _0xddf1('0x87'):_0x470d6e['body'][_0xddf1('0x81')]=_0x174659[_0xddf1('0x5e')][_0xddf1('0x81')];_0x470d6e['body'][_0xddf1('0x5e')]=_0x174659['body'][_0xddf1('0x5e')];_0x470d6e[_0xddf1('0x5e')][_0xddf1('0x88')]=_0x174659[_0xddf1('0x5e')]['message_id'];break;case _0xddf1('0x89'):_0x470d6e[_0xddf1('0x5e')][_0xddf1('0x81')]=_0x174659[_0xddf1('0x5e')][_0xddf1('0x82')];_0x470d6e[_0xddf1('0x5e')][_0xddf1('0x5e')]=_0x174659[_0xddf1('0x5e')][_0xddf1('0x8a')];_0x470d6e[_0xddf1('0x5e')][_0xddf1('0x88')]=_0x174659[_0xddf1('0x5e')]['MessageUUID'];break;case'infobip':_0x470d6e[_0xddf1('0x5e')][_0xddf1('0x81')]='+'+_0x174659[_0xddf1('0x5e')][_0xddf1('0x8b')][0x0][_0xddf1('0x81')];_0x470d6e[_0xddf1('0x5e')][_0xddf1('0x5e')]=_0x174659[_0xddf1('0x5e')][_0xddf1('0x8b')][0x0]['text'];_0x470d6e['body']['messageId']=_0x174659[_0xddf1('0x5e')][_0xddf1('0x8b')][0x0][_0xddf1('0x88')];break;case _0xddf1('0x8c'):_0x470d6e[_0xddf1('0x5e')][_0xddf1('0x81')]=_0x174659[_0xddf1('0x5e')][_0xddf1('0x8d')];_0x470d6e[_0xddf1('0x5e')][_0xddf1('0x5e')]=_0x174659[_0xddf1('0x5e')][_0xddf1('0x8e')][_0xddf1('0x29')];break;case _0xddf1('0x8f'):_0x470d6e['body'][_0xddf1('0x81')]=_0x174659[_0xddf1('0x5e')][_0xddf1('0x90')];_0x470d6e['body'][_0xddf1('0x5e')]=_0x174659['body'][_0xddf1('0x85')];_0x470d6e['body'][_0xddf1('0x88')]=_0x174659['body'][_0xddf1('0x91')];break;case _0xddf1('0x92'):_0x470d6e['body'][_0xddf1('0x88')]=_0x174659[_0xddf1('0x5e')][0x0][_0xddf1('0x29')]['id'];_0x470d6e['body']['from']=_0x174659['body'][0x0]['message']['from'];_0x470d6e[_0xddf1('0x5e')][_0xddf1('0x5e')]=_0x174659['body'][0x0][_0xddf1('0x29')][_0xddf1('0x85')];break;case _0xddf1('0x93'):_0x470d6e[_0xddf1('0x5e')][_0xddf1('0x81')]=_0x174659[_0xddf1('0x5e')][_0xddf1('0x81')];_0x470d6e[_0xddf1('0x5e')][_0xddf1('0x5e')]=_0x174659['body'][_0xddf1('0x29')];_0x470d6e[_0xddf1('0x5e')][_0xddf1('0x88')]=_0x174659['body']['refid'];break;}}if(_0x470d6e[_0xddf1('0x5e')]['id']){delete _0x470d6e[_0xddf1('0x5e')]['id'];}if(_['isNil'](_0x470d6e[_0xddf1('0x5e')]['from'])){throw new db['Sequelize']['ValidationError'](_0xddf1('0x94'));}if(_['isNil'](_0x470d6e['body'][_0xddf1('0x5e')])||_0x470d6e[_0xddf1('0x5e')][_0xddf1('0x5e')]===''){throw new db[(_0xddf1('0x78'))]['ValidationError']('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_['isNil'](_0x470d6e[_0xddf1('0x5e')][_0xddf1('0x95')])){throw new db[(_0xddf1('0x78'))][(_0xddf1('0x79'))](_0xddf1('0x96')+_0x12844f);}if(!_[_0xddf1('0x97')](_0x12844f,_0x470d6e['body']['mapKey'])){throw new db[(_0xddf1('0x78'))][(_0xddf1('0x79'))](_0xddf1('0x98')+_0x12844f);}_0x166f3f[_0x470d6e['body']['mapKey']]=_0x470d6e[_0xddf1('0x5e')][_0xddf1('0x81')];return db[_0xddf1('0x99')]['find']({'where':{'id':_0x470d6e[_0xddf1('0x72')][_0xddf1('0x7f')]},'include':[{'model':db[_0xddf1('0x76')],'as':_0xddf1('0x9a'),'where':_0x166f3f,'limit':0x1,'order':[[_0xddf1('0x7d'),_0xddf1('0x9b')]]}]});})['then'](handleEntityNotFound(_0xb3918c,null))[_0xddf1('0x20')](function(_0x210412){if(_0x210412){_0x470d6e[_0xddf1('0x9c')]=_[_0xddf1('0x9d')](_0x210412,['Contacts']);if(_0x210412[_0xddf1('0x9a')]['length']){return _0x210412[_0xddf1('0x9a')][0x0];}var _0x3cf84e=_[_0xddf1('0x9e')](_0x470d6e[_0xddf1('0x5e')],{'firstName':_0x470d6e[_0xddf1('0x5e')]['from'],'ListId':_0x210412['id']});_0x3cf84e[_0x470d6e[_0xddf1('0x5e')][_0xddf1('0x95')]]=_0x470d6e[_0xddf1('0x5e')]['from'];return db[_0xddf1('0x76')][_0xddf1('0x56')](_0x3cf84e,{'fields':_0x2f5a34,'raw':!![]});}})['then'](handleEntityNotFound(_0xb3918c,null))[_0xddf1('0x20')](function(_0xfdbd15){if(_0xfdbd15){_0x470d6e[_0xddf1('0x9f')]=_0xfdbd15;var _0x8d38f8={'ContactId':_0xfdbd15['id'],'phone':_0x470d6e[_0xddf1('0x5e')][_0xddf1('0x81')],'SmsAccountId':_0x174659[_0xddf1('0x5f')]['id']};var _0x5a6da0={'ContactId':_0xfdbd15['id'],'SmsAccountId':_0x174659[_0xddf1('0x5f')]['id'],'closed':![]};return db['SmsInteraction'][_0xddf1('0x55')]({'where':_0x5a6da0})['then'](function(_0x3de86b){if(_0x3de86b){return[_0x3de86b,![]];}return db[_0xddf1('0xa0')][_0xddf1('0x56')](_0x8d38f8)[_0xddf1('0x20')](function(_0x781b25){return[_0x781b25,!![]];});});}})[_0xddf1('0xa1')](function(_0x5e35dc,_0x4e061e){_0x470d6e[_0xddf1('0xa2')]=_0x5e35dc[_0xddf1('0x35')]({'plain':!![]});_0x470d6e[_0xddf1('0xa2')][_0xddf1('0xa3')]=![];if(_0x4e061e){if(_0x470d6e['account'][_0xddf1('0xa4')]){_0x470d6e['applications'][_0xddf1('0xa5')]({'id':0x0,'priority':_0x470d6e[_0xddf1('0x73')]['length']+0x1,'app':_0xddf1('0xa6'),'appdata':_0xddf1('0xa7'),'interval':_0xddf1('0xa8')});}_0x470d6e[_0xddf1('0xa2')][_0xddf1('0xa3')]=!![];}return db['SmsMessage'][_0xddf1('0x56')]({'phone':_0x470d6e['body'][_0xddf1('0x81')],'messageId':_0x470d6e['body']['messageId'],'body':_0x470d6e[_0xddf1('0x5e')][_0xddf1('0x5e')],'SmsAccountId':_0x174659[_0xddf1('0x5f')]['id'],'SmsInteractionId':_0x5e35dc['id'],'direction':'in','ContactId':_0x5e35dc[_0xddf1('0xa9')],'AttachmentId':_0x470d6e[_0xddf1('0x5e')][_0xddf1('0xaa')]});})['then'](function(_0x1cae78){_0x470d6e['message']=_0x1cae78;if(!_0x470d6e[_0xddf1('0xa2')][_0xddf1('0xab')])return;return db[_0xddf1('0xac')]['find']({'attributes':['id',_0xddf1('0x38')],'where':{'id':_0x470d6e['interaction'][_0xddf1('0xab')]}});})[_0xddf1('0x20')](function(_0x198601){if(_0x198601){_0x470d6e[_0xddf1('0x73')][_0xddf1('0xad')]({'id':0x0,'priority':0x0,'app':_0xddf1('0xae'),'appdata':_0x198601[_0xddf1('0x38')]+','+(_0x470d6e['account'][_0xddf1('0xaf')]||0xa),'interval':_0xddf1('0xa8')});}if(!_0x470d6e[_0xddf1('0xa2')][_0xddf1('0xb0')])return;return db[_0xddf1('0xb1')][_0xddf1('0x55')]({'attributes':['id',_0xddf1('0x38')],'where':{'id':_0x470d6e[_0xddf1('0xa2')][_0xddf1('0xb0')]}});})[_0xddf1('0x20')](function(_0x5ea32e){if(_0x5ea32e){_0x470d6e['applications'][_0xddf1('0xad')]({'id':0x0,'priority':0x1,'app':_0xddf1('0xb2'),'appdata':_0x5ea32e[_0xddf1('0x38')]+','+(_0x470d6e[_0xddf1('0x72')]['waitForTheAssignedQueue']||0x12c),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0xddf1('0xb3'),_0xddf1('0xb4'),_0x470d6e);})[_0xddf1('0x20')](function(_0x3ccc48){if(_0x3ccc48){var _0x47f92c=0xc8;var _0x50aa46=_0xddf1('0xb5');logger[_0xddf1('0x21')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x50aa46,_0x47f92c,_0xddf1('0xb6'));logger['debug'](_0xddf1('0xb7'),_0x50aa46,_0x47f92c,_0xddf1('0xb6'),JSON[_0xddf1('0x26')](_0x3ccc48));if(_0x470d6e['account']['type']===_0xddf1('0x80')){return _0xb3918c[_0xddf1('0x2c')](_0x47f92c)['set']('Content-Type',_0xddf1('0xb8'))[_0xddf1('0x39')](_0xddf1('0xb9'));}else{return _0xb3918c[_0xddf1('0x2c')](_0x47f92c)[_0xddf1('0xba')](_0x3ccc48);}}})['catch'](handleError(_0xb3918c,null));};exports[_0xddf1('0xbb')]=function(_0x2c5cb4,_0x18a9ae){var _0x47413d=_0x2c5cb4[_0xddf1('0x5f')]['id'];var _0x56d4cc=_0x2c5cb4[_0xddf1('0x5e')];var _0x4be5be=0xc8;var _0xbb0e9d=null;return db[_0xddf1('0xbc')][_0xddf1('0xbd')]({'isolationLevel':db['sequelize'][_0xddf1('0xbe')][_0xddf1('0xbf')][_0xddf1('0xc0')]},function(_0x370107){return db[_0xddf1('0x3d')]['findOne']({'where':{'id':_0x47413d},'transaction':_0x370107})['then'](function(_0x25c5b0){if(_0x25c5b0){return db[_0xddf1('0x70')][_0xddf1('0x34')]({'where':{'SmsAccountId':_0x47413d},'transaction':_0x370107})[_0xddf1('0x20')](function(){var _0x1dc1cf=_[_0xddf1('0x3c')](_0x56d4cc,function(_0x39887a){_0x39887a[_0xddf1('0x61')]=_0x47413d;return _0x39887a;});return db[_0xddf1('0x70')][_0xddf1('0xc1')](_0x1dc1cf,{'transaction':_0x370107});});}else{_0x4be5be=0x194;_0xbb0e9d=[];}});})[_0xddf1('0x20')](function(){if(_0x4be5be!==0x194){return db[_0xddf1('0x70')][_0xddf1('0xc2')]({'where':{'SmsAccountId':_0x47413d},'order':_0xddf1('0x74')})[_0xddf1('0x20')](function(_0x3c59f6){_0xbb0e9d=_0x3c59f6;});}})[_0xddf1('0x2a')](function(_0x377953){_0x4be5be=0x1f4;logger[_0xddf1('0x27')](_0x377953[_0xddf1('0x37')]);if(_0x377953[_0xddf1('0x38')]){delete _0x377953[_0xddf1('0x38')];}_0xbb0e9d=_0x377953;})[_0xddf1('0xc3')](function(){if(_0xbb0e9d===null){_0x18a9ae[_0xddf1('0x2b')](_0x4be5be);}else{if(_0x4be5be===0x1f4){_0x18a9ae['status'](_0x4be5be)[_0xddf1('0x39')](_0xbb0e9d);}else{_0x18a9ae['status'](_0x4be5be)[_0xddf1('0xba')](_0xbb0e9d);}}});};exports['getApplications']=function(_0x5a7aca,_0x565463,_0x10c675){var _0xf10632={};var _0x3daf42={};var _0x4ce44b;var _0x554181;return db[_0xddf1('0x3d')][_0xddf1('0x64')]({'where':{'id':_0x5a7aca['params']['id']}})['then'](handleEntityNotFound(_0x565463,null))[_0xddf1('0x20')](function(_0x17ba32){if(_0x17ba32){_0x4ce44b=_0x17ba32;_0x3daf42[_0xddf1('0x44')]=_[_0xddf1('0x42')](db[_0xddf1('0x70')]['rawAttributes']);_0x3daf42['query']=_[_0xddf1('0x42')](_0x5a7aca[_0xddf1('0x41')]);_0x3daf42[_0xddf1('0x4b')]=_[_0xddf1('0x43')](_0x3daf42[_0xddf1('0x44')],_0x3daf42['query']);_0xf10632[_0xddf1('0x45')]=_[_0xddf1('0x43')](_0x3daf42[_0xddf1('0x44')],qs[_0xddf1('0x46')](_0x5a7aca['query'][_0xddf1('0x46')]));_0xf10632['attributes']=_0xf10632[_0xddf1('0x45')]['length']?_0xf10632[_0xddf1('0x45')]:_0x3daf42[_0xddf1('0x44')];_0xf10632['order']=qs[_0xddf1('0x4a')](_0x5a7aca['query'][_0xddf1('0x4a')]);_0xf10632['where']=qs['filters'](_[_0xddf1('0x4c')](_0x5a7aca['query'],_0x3daf42[_0xddf1('0x4b')]));if(_0x5a7aca[_0xddf1('0x41')][_0xddf1('0x4d')]){_0xf10632[_0xddf1('0x4e')]=_['merge'](_0xf10632['where'],{'$or':_[_0xddf1('0x3c')](_0xf10632[_0xddf1('0x45')],function(_0x3682ec){var _0x2c51f7={};_0x2c51f7[_0x3682ec]={'$like':'%'+_0x5a7aca['query'][_0xddf1('0x4d')]+'%'};return _0x2c51f7;})});}_0xf10632=_['merge']({},_0xf10632,_0x5a7aca['options']);return _0x4ce44b[_0xddf1('0xc4')](_0xf10632);}})['then'](function(_0x5bf808){if(_0x5bf808){_0x554181=_0x5bf808[_0xddf1('0x47')];if(!_0x5a7aca[_0xddf1('0x41')][_0xddf1('0x48')](_0xddf1('0x6c'))){_0xf10632['limit']=qs[_0xddf1('0x2f')](_0x5a7aca[_0xddf1('0x41')][_0xddf1('0x2f')]);_0xf10632[_0xddf1('0x2e')]=qs[_0xddf1('0x2e')](_0x5a7aca[_0xddf1('0x41')][_0xddf1('0x2e')]);}return _0x4ce44b[_0xddf1('0xc4')](_0xf10632);}})['then'](function(_0x3eb7b6){if(_0x3eb7b6){return _0x3eb7b6?{'count':_0x554181,'rows':_0x3eb7b6}:null;}})[_0xddf1('0x20')](respondWithResult(_0x565463,null))[_0xddf1('0x2a')](handleError(_0x565463,null));};exports[_0xddf1('0xc5')]=function(_0x213906,_0x571450,_0x4b99cf){var _0xb48f20={'raw':![],'where':{}};var _0x2c6b87={};var _0x250773={'count':0x0,'rows':[]};return db[_0xddf1('0x3d')][_0xddf1('0x64')]({'where':{'id':_0x213906[_0xddf1('0x5f')]['id']}})[_0xddf1('0x20')](handleEntityNotFound(_0x571450,null))[_0xddf1('0x20')](function(_0x335fe0){if(_0x335fe0){_0x2c6b87[_0xddf1('0x44')]=_['keys'](db[_0xddf1('0xa0')][_0xddf1('0x3e')]);_0x2c6b87[_0xddf1('0x41')]=_[_0xddf1('0x42')](_0x213906[_0xddf1('0x41')]);_0x2c6b87['filters']=_['intersection'](_0x2c6b87[_0xddf1('0x44')],_0x2c6b87[_0xddf1('0x41')]);_0xb48f20[_0xddf1('0x45')]=_['intersection'](_0x2c6b87[_0xddf1('0x44')],qs[_0xddf1('0x46')](_0x213906[_0xddf1('0x41')]['fields']));_0xb48f20[_0xddf1('0x45')]=_0xb48f20[_0xddf1('0x45')][_0xddf1('0x47')]?_0xb48f20[_0xddf1('0x45')]:_0x2c6b87[_0xddf1('0x44')];if(!_0x213906['query'][_0xddf1('0x48')](_0xddf1('0x6c'))){_0xb48f20['limit']=qs[_0xddf1('0x2f')](_0x213906[_0xddf1('0x41')][_0xddf1('0x2f')]);_0xb48f20['offset']=qs[_0xddf1('0x2e')](_0x213906['query'][_0xddf1('0x2e')]);}_0xb48f20[_0xddf1('0x49')]=qs[_0xddf1('0x4a')](_0x213906[_0xddf1('0x41')][_0xddf1('0x4a')]);_0xb48f20[_0xddf1('0x4e')]=qs[_0xddf1('0x4b')](_[_0xddf1('0x4c')](_0x213906[_0xddf1('0x41')],_0x2c6b87[_0xddf1('0x4b')]));_0xb48f20['where'][_0xddf1('0x61')]=_0x335fe0['id'];if(_0x213906[_0xddf1('0x41')][_0xddf1('0x4d')]){_0xb48f20[_0xddf1('0x4e')]=_[_0xddf1('0x4f')](_0xb48f20['where'],{'$or':_[_0xddf1('0x3c')](_0xb48f20[_0xddf1('0x45')],function(_0x1c7840){var _0x31a618={};_0x31a618[_0x1c7840]={'$like':'%'+_0x213906[_0xddf1('0x41')]['filter']+'%'};return _0x31a618;})});}_0xb48f20=_[_0xddf1('0x4f')]({},_0xb48f20,_0x213906[_0xddf1('0x65')]);return db['SmsInteraction'][_0xddf1('0x31')]({'where':_0xb48f20[_0xddf1('0x4e')]})[_0xddf1('0x20')](function(_0x19b0fc){_0x250773[_0xddf1('0x31')]=_0x19b0fc;if(_0x213906['query'][_0xddf1('0x51')]){_0xb48f20[_0xddf1('0x52')]=[{'model':db[_0xddf1('0x76')],'as':'Contact','required':![]},{'model':db['User'],'as':_0xddf1('0xc6'),'attributes':['name','fullname',_0xddf1('0xc7')],'required':![]},{'model':db[_0xddf1('0xc8')],'as':_0xddf1('0xc9'),'attributes':['id','name',_0xddf1('0xca')],'where':_0x213906[_0xddf1('0x41')]['tag']?{'id':_0x213906[_0xddf1('0x41')][_0xddf1('0xcb')]}:undefined,'required':_0x213906['query'][_0xddf1('0xcb')]?!![]:![]}];}return db[_0xddf1('0xa0')][_0xddf1('0x66')](_0xb48f20);})[_0xddf1('0x20')](function(_0x32e8ad){_0x250773[_0xddf1('0x53')]=_0x32e8ad;return _0x250773;});}})[_0xddf1('0x20')](respondWithFilteredResult(_0x571450,_0xb48f20))['catch'](handleError(_0x571450,null));};exports[_0xddf1('0x39')]=function(_0x3b2f7c,_0x21eeed,_0x536bd7){var _0x3652ba,_0x26362c,_0x30753a;if(_[_0xddf1('0xcc')](_0x3b2f7c[_0xddf1('0x5e')][_0xddf1('0x5e')])||_0x3b2f7c[_0xddf1('0x5e')][_0xddf1('0x5e')]===''){throw new db[(_0xddf1('0x78'))][(_0xddf1('0x79'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_['isNil'](_0x3b2f7c['body']['to'])){throw new db[(_0xddf1('0x78'))][(_0xddf1('0x79'))](_0xddf1('0xcd'));}_0x3652ba=_0x3b2f7c[_0xddf1('0x5e')]['to'];return db[_0xddf1('0x3d')][_0xddf1('0x55')]({'where':{'id':_0x3b2f7c[_0xddf1('0x5f')]['id']},'include':[{'model':db[_0xddf1('0x99')],'as':_0xddf1('0xce'),'include':[{'model':db[_0xddf1('0x76')],'as':_0xddf1('0x9a'),'where':{'mobile':_0x3652ba},'limit':0x1,'order':[['updatedAt',_0xddf1('0x9b')]]}]}]})[_0xddf1('0x20')](handleEntityNotFound(_0x21eeed,null))['then'](function(_0x423ded){if(_0x423ded&&_0x423ded[_0xddf1('0xce')]){_0x26362c=_0x423ded[_0xddf1('0x35')]({'plain':!![]});if(_0x26362c[_0xddf1('0xce')]&&_0x26362c[_0xddf1('0xce')][_0xddf1('0x9a')][_0xddf1('0x47')]){return _0x26362c[_0xddf1('0xce')][_0xddf1('0x9a')][0x0];}return db[_0xddf1('0x76')]['create'](_[_0xddf1('0x9e')](_0x3b2f7c['body'],{'firstName':_0x3652ba,'mobile':_0x3652ba,'phone':_0x3652ba,'ListId':_0x26362c[_0xddf1('0x7f')]}));}})[_0xddf1('0x20')](handleEntityNotFound(_0x21eeed,null))[_0xddf1('0x20')](function(_0x2fad2b){if(_0x2fad2b){_0x30753a=_0x2fad2b;return db[_0xddf1('0xa0')]['find']({'where':{'ContactId':_0x30753a['id'],'closed':![],'SmsAccountId':_0x26362c['id']}})[_0xddf1('0x20')](function(_0x3da391){if(_0x3da391){return[_0x3da391,![]];}return db[_0xddf1('0xa0')][_0xddf1('0x56')]({'UserId':_0x3b2f7c[_0xddf1('0x59')]['id'],'ContactId':_0x30753a['id'],'SmsAccountId':_0x26362c['id'],'phone':_0x3652ba,'firstMsgDirection':'out','Messages':[_[_0xddf1('0x4f')](_0x3b2f7c[_0xddf1('0x5e')],{'read':![],'body':_0x3b2f7c[_0xddf1('0x5e')]['body'],'phone':_0x3652ba,'SmsAccountId':_0x26362c['id'],'UserId':_0x3b2f7c[_0xddf1('0x59')]['id'],'ContactId':_0x30753a['id']})]},{'include':[{'model':db['SmsMessage'],'as':'Messages'}]})[_0xddf1('0x20')](function(_0x48d338){return[_0x48d338,!![]];});});}})[_0xddf1('0xa1')](function(_0x13b132,_0xfec982){if(_0xfec982){return _0x13b132;}return db['SmsMessage']['create'](_[_0xddf1('0x4f')](_0x3b2f7c[_0xddf1('0x5e')],{'read':![],'body':_0x3b2f7c[_0xddf1('0x5e')][_0xddf1('0x5e')],'phone':_0x3652ba,'SmsAccountId':_0x26362c['id'],'SmsInteractionId':_0x13b132['id'],'UserId':_0x3b2f7c[_0xddf1('0x59')]['id'],'ContactId':_0x30753a['id']}))[_0xddf1('0x20')](function(_0x3c731b){_0x13b132[_0xddf1('0xcf')][_0xddf1('0xd0')]=[];_0x13b132[_0xddf1('0xcf')][_0xddf1('0xd0')][_0xddf1('0xa5')](_0x3c731b[_0xddf1('0xcf')]);return _0x13b132;});})[_0xddf1('0x20')](respondWithResult(_0x21eeed,null))[_0xddf1('0x2a')](handleError(_0x21eeed,null));};exports[_0xddf1('0x2c')]=function(_0x10e3c5,_0x34ba23,_0x150345){if(_0x10e3c5[_0xddf1('0x5e')]['id']){delete _0x10e3c5[_0xddf1('0x5e')]['id'];}var _0x90510c,_0x2e50c2,_0x1b3a1f;return db[_0xddf1('0x3d')][_0xddf1('0x55')]({'where':{'id':_0x10e3c5['params']['id']}})[_0xddf1('0x20')](handleEntityNotFound(_0x34ba23,null))['then'](function(_0x33296c){if(_0x33296c){_0x1b3a1f=_0x33296c;logger[_0xddf1('0x24')](_0xddf1('0x25'),_0xddf1('0x2c'),_0xddf1('0xd1'),_0x33296c['type'],util[_0xddf1('0xd2')](_0x10e3c5[_0xddf1('0x5e')],{'showHidden':![],'depth':null}));switch(_0x33296c[_0xddf1('0x40')]){case'skebby':if(_0x10e3c5[_0xddf1('0x5e')]['skebby_dispatch_id']&&_0x10e3c5['body']['status']){_0x2e50c2=_0x10e3c5[_0xddf1('0x5e')]['status'];return db[_0xddf1('0xd3')]['find']({'where':{'messageId':_0x10e3c5[_0xddf1('0x5e')][_0xddf1('0xd4')]}});}break;case _0xddf1('0x86'):if(_0x10e3c5[_0xddf1('0x5e')][_0xddf1('0xd5')]&&_0x10e3c5['body'][_0xddf1('0xd6')]){_0x2e50c2=_0x10e3c5['body']['statusInt'];return db[_0xddf1('0xd3')][_0xddf1('0x55')]({'where':{'messageId':_0x10e3c5[_0xddf1('0x5e')][_0xddf1('0xd5')]}});}break;case _0xddf1('0x87'):if(_0x10e3c5[_0xddf1('0x5e')]['message_id']&&_0x10e3c5[_0xddf1('0x5e')]['status_code']){_0x2e50c2=_0x10e3c5['body']['status_code'];return db['SmsMessage'][_0xddf1('0x55')]({'where':{'messageId':_0x10e3c5[_0xddf1('0x5e')][_0xddf1('0xd7')]}});}break;case _0xddf1('0xd8'):var _0x485023=_0x10e3c5[_0xddf1('0x5e')][_0xddf1('0x8b')][0x0];if(_0x485023[_0xddf1('0x88')]&&_0x485023[_0xddf1('0x2c')][_0xddf1('0xd9')]==='DELIVERED'){_0x2e50c2=_0x485023[_0xddf1('0x2c')]['groupName'];return db[_0xddf1('0xd3')][_0xddf1('0x55')]({'where':{'messageId':_0x485023[_0xddf1('0x88')]}});}break;case _0xddf1('0x8f'):if(_0x10e3c5['body']['messageId']&&_0x10e3c5[_0xddf1('0x5e')][_0xddf1('0x2c')]){_0x2e50c2=_0x10e3c5['body'][_0xddf1('0x2c')];return db['SmsMessage']['find']({'where':{'messageId':_0x10e3c5[_0xddf1('0x5e')][_0xddf1('0x88')]}});}break;case _0xddf1('0x92'):if(_0x10e3c5['body'][0x0]['message']['id']){_0x2e50c2=_0x10e3c5[_0xddf1('0x5e')][0x0][_0xddf1('0x40')];return db[_0xddf1('0xd3')][_0xddf1('0x55')]({'where':{'messageId':_0x10e3c5[_0xddf1('0x5e')][0x0][_0xddf1('0x29')]['id']}});}break;case'intelepeer':if(_0x10e3c5[_0xddf1('0x5e')][_0xddf1('0xda')]&&_0x10e3c5['body']['status']){_0x2e50c2=_0x10e3c5[_0xddf1('0x5e')][_0xddf1('0x2c')];return db[_0xddf1('0xd3')][_0xddf1('0x55')]({'where':{'messageId':_0x10e3c5['body'][_0xddf1('0xda')]}});}break;}}})[_0xddf1('0x20')](handleEntityNotFound(_0x34ba23,null))[_0xddf1('0x20')](function(_0x232334){if(_0x232334){_0x90510c=_0x232334;switch(_0x1b3a1f[_0xddf1('0x40')]){case _0xddf1('0x84'):if(_0x2e50c2===_0xddf1('0xdb')){return _0x90510c[_0xddf1('0x33')]({'read':!![]});}else{logger[_0xddf1('0x27')](_0xddf1('0x25'),'status','skebby',util[_0xddf1('0xd2')](_0x10e3c5['body'],{'showHidden':![],'depth':null}));}break;case'connectel':if(_0x2e50c2==='1'){return _0x90510c[_0xddf1('0x33')]({'read':!![]});}else{logger[_0xddf1('0x27')]('SmsAccount,\x20%s,\x20%s,\x20%s','status','skebby',util[_0xddf1('0xd2')](_0x10e3c5[_0xddf1('0x5e')],{'showHidden':![],'depth':null}));}break;case _0xddf1('0x87'):if(!_0x10e3c5[_0xddf1('0x5e')][_0xddf1('0xdc')]&&_0x2e50c2>=0xc8&&_0x2e50c2<=0xce){return _0x90510c[_0xddf1('0x33')]({'read':!![]});}else{logger[_0xddf1('0x27')](_0xddf1('0x25'),_0xddf1('0x2c'),'clicksend',util[_0xddf1('0xd2')](_0x10e3c5[_0xddf1('0x5e')],{'showHidden':![],'depth':null}));}break;case _0xddf1('0xd8'):var _0x61db3e=_0x10e3c5['body'][_0xddf1('0x8b')][0x0];if(_0x61db3e['status'][_0xddf1('0xd9')]==='DELIVERED'){return _0x90510c[_0xddf1('0x33')]({'read':!![]});}else{logger[_0xddf1('0x27')](_0xddf1('0x25'),_0xddf1('0x2c'),'infobip',util[_0xddf1('0xd2')](_0x10e3c5[_0xddf1('0x5e')],{'showHidden':![],'depth':null}));}break;case'clickatell':if(_0x2e50c2==_0xddf1('0xdd')||_0x2e50c2=='RECEIVED_BY_RECIPIENT'){return _0x90510c[_0xddf1('0x33')]({'read':!![]});}else{logger['error'](_0xddf1('0x25'),_0xddf1('0x2c'),_0xddf1('0x8f'),util[_0xddf1('0xd2')](_0x10e3c5[_0xddf1('0x5e')],{'showHidden':![],'depth':null}));}break;case _0xddf1('0x92'):if(_0x2e50c2=='message-delivered'){return _0x90510c['update']({'read':!![]});}else{logger[_0xddf1('0x27')](_0xddf1('0x25'),'status','bandwidth',util[_0xddf1('0xd2')](_0x10e3c5[_0xddf1('0x5e')],{'showHidden':![],'depth':null}));}break;case _0xddf1('0x93'):if(_0x2e50c2===_0xddf1('0xde')||_0x2e50c2===_0xddf1('0xdf')){return _0x90510c[_0xddf1('0x33')]({'read':!![]});}else{logger[_0xddf1('0x27')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0xddf1('0x2c'),_0xddf1('0x93'),util['inspect'](_0x10e3c5[_0xddf1('0x5e')],{'showHidden':![],'depth':null}));}break;}return _0x90510c;}})[_0xddf1('0x20')](respondWithResult(_0x34ba23,null))[_0xddf1('0x2a')](handleError(_0x34ba23,null));};exports[_0xddf1('0xe0')]=function(_0x533247,_0x41d322,_0x5b70c5){var _0x33e0bb,_0x3b28e0,_0x2efb6a;return db[_0xddf1('0x3d')]['find']({'where':{'id':_0x533247[_0xddf1('0x5f')]['id']}})[_0xddf1('0x20')](handleEntityNotFound(_0x41d322,null))[_0xddf1('0x20')](function(_0x45af80){if(_0x45af80){_0x2efb6a=_0x45af80;logger[_0xddf1('0x24')](_0xddf1('0x25'),_0xddf1('0x2c'),'received\x20delivery\x20report\x20from',_0x45af80[_0xddf1('0x40')],util[_0xddf1('0xd2')](_0x533247[_0xddf1('0x41')],{'showHidden':![],'depth':null}));switch(_0x45af80[_0xddf1('0x40')]){case'csc':if(_0x533247[_0xddf1('0x41')][_0xddf1('0xe1')]&&_0x533247[_0xddf1('0x41')][_0xddf1('0xe2')]){_0x3b28e0=_0x533247[_0xddf1('0x41')]['state'];return db[_0xddf1('0xd3')]['find']({'where':{'messageId':_0x533247[_0xddf1('0x41')][_0xddf1('0xe1')]}});}break;}}})[_0xddf1('0x20')](handleEntityNotFound(_0x41d322,null))[_0xddf1('0x20')](function(_0x535f31){if(_0x535f31){_0x33e0bb=_0x535f31;switch(_0x2efb6a[_0xddf1('0x40')]){case _0xddf1('0x8c'):if(_0x3b28e0==='2'||_0x3b28e0==='6'){return _0x33e0bb[_0xddf1('0x33')]({'read':!![]});}else{logger[_0xddf1('0x27')](_0xddf1('0x25'),_0xddf1('0x2c'),_0xddf1('0x8c'),util[_0xddf1('0xd2')](_0x533247[_0xddf1('0x41')],{'showHidden':![],'depth':null}));};break;}return _0x33e0bb;}})[_0xddf1('0x20')](respondWithResult(_0x41d322,null))[_0xddf1('0x2a')](handleError(_0x41d322,null));};exports[_0xddf1('0xe3')]=function(_0x4946f4,_0xb9b2d5,_0x5951e9){return db[_0xddf1('0x3d')]['find']({'where':{'id':_0x4946f4[_0xddf1('0x5f')]['id']}})[_0xddf1('0x20')](handleEntityNotFound(_0xb9b2d5,null))[_0xddf1('0x20')](function(_0x320758){if(_0x320758){return _0x320758[_0xddf1('0xe3')](_0x4946f4['body'][_0xddf1('0x68')],_[_0xddf1('0x9d')](_0x4946f4[_0xddf1('0x5e')],[_0xddf1('0x68'),'id'])||{})['spread'](function(_0x5db259){for(var _0xde5c3=0x0;_0xde5c3<_0x4946f4[_0xddf1('0x5e')][_0xddf1('0x68')]['length'];_0xde5c3+=0x1){socket[_0xddf1('0xe4')](_0xddf1('0xe5'),{'UserId':Number(_0x4946f4[_0xddf1('0x5e')]['ids'][_0xde5c3]),'SmsAccountId':Number(_0x4946f4[_0xddf1('0x5f')]['id'])});}return _0x5db259;});}})[_0xddf1('0x20')](respondWithResult(_0xb9b2d5,null))[_0xddf1('0x2a')](handleError(_0xb9b2d5,null));};exports[_0xddf1('0xe6')]=function(_0x5538f8,_0x42ada9,_0x181a9f){return db[_0xddf1('0x3d')][_0xddf1('0x55')]({'where':{'id':_0x5538f8[_0xddf1('0x5f')]['id']}})[_0xddf1('0x20')](handleEntityNotFound(_0x42ada9,null))[_0xddf1('0x20')](function(_0x23545b){if(_0x23545b){return _0x23545b[_0xddf1('0xe6')](_0x5538f8[_0xddf1('0x41')][_0xddf1('0x68')])[_0xddf1('0x20')](function(){if(_[_0xddf1('0xe7')](_0x5538f8[_0xddf1('0x41')][_0xddf1('0x68')])){for(var _0x434dcc=0x0;_0x434dcc<_0x5538f8[_0xddf1('0x41')][_0xddf1('0x68')]['length'];_0x434dcc+=0x1){socket[_0xddf1('0xe4')]('userSmsAccount:remove',{'UserId':Number(_0x5538f8['query'][_0xddf1('0x68')][_0x434dcc]),'SmsAccountId':Number(_0x5538f8['params']['id'])});}}else{socket[_0xddf1('0xe4')](_0xddf1('0xe8'),{'UserId':Number(_0x5538f8[_0xddf1('0x41')][_0xddf1('0x68')]),'SmsAccountId':Number(_0x5538f8[_0xddf1('0x5f')]['id'])});}});}})[_0xddf1('0x20')](respondWithStatusCode(_0x42ada9,null))[_0xddf1('0x2a')](handleError(_0x42ada9,null));};exports[_0xddf1('0xe9')]=function(_0x32ce43,_0x151140,_0x13f34c){var _0x582ee9={};var _0x6c5752={};var _0x2f6d9e;var _0x1b8224;return db[_0xddf1('0x3d')][_0xddf1('0x64')]({'where':{'id':_0x32ce43[_0xddf1('0x5f')]['id']}})['then'](handleEntityNotFound(_0x151140,null))[_0xddf1('0x20')](function(_0x36379b){if(_0x36379b){_0x2f6d9e=_0x36379b;_0x6c5752['model']=_[_0xddf1('0x42')](db[_0xddf1('0xac')]['rawAttributes']);_0x6c5752['query']=_[_0xddf1('0x42')](_0x32ce43[_0xddf1('0x41')]);_0x6c5752[_0xddf1('0x4b')]=_['intersection'](_0x6c5752['model'],_0x6c5752[_0xddf1('0x41')]);_0x582ee9['attributes']=_['intersection'](_0x6c5752[_0xddf1('0x44')],qs[_0xddf1('0x46')](_0x32ce43[_0xddf1('0x41')]['fields']));_0x582ee9[_0xddf1('0x45')]=_0x582ee9[_0xddf1('0x45')]['length']?_0x582ee9[_0xddf1('0x45')]:_0x6c5752[_0xddf1('0x44')];_0x582ee9[_0xddf1('0x49')]=qs[_0xddf1('0x4a')](_0x32ce43['query']['sort']);_0x582ee9[_0xddf1('0x4e')]=qs[_0xddf1('0x4b')](_[_0xddf1('0x4c')](_0x32ce43[_0xddf1('0x41')],_0x6c5752[_0xddf1('0x4b')]));if(_0x32ce43[_0xddf1('0x41')]['filter']){_0x582ee9[_0xddf1('0x4e')]=_[_0xddf1('0x4f')](_0x582ee9[_0xddf1('0x4e')],{'$or':_['map'](_0x582ee9['attributes'],function(_0xfac752){var _0x440b3f={};_0x440b3f[_0xfac752]={'$like':'%'+_0x32ce43[_0xddf1('0x41')][_0xddf1('0x4d')]+'%'};return _0x440b3f;})});}_0x582ee9=_[_0xddf1('0x4f')]({},_0x582ee9,_0x32ce43[_0xddf1('0x65')]);return _0x2f6d9e[_0xddf1('0xe9')](_0x582ee9);}})[_0xddf1('0x20')](function(_0x264c5d){if(_0x264c5d){_0x1b8224=_0x264c5d[_0xddf1('0x47')];if(!_0x32ce43[_0xddf1('0x41')][_0xddf1('0x48')](_0xddf1('0x6c'))){_0x582ee9['limit']=qs['limit'](_0x32ce43[_0xddf1('0x41')][_0xddf1('0x2f')]);_0x582ee9[_0xddf1('0x2e')]=qs[_0xddf1('0x2e')](_0x32ce43[_0xddf1('0x41')][_0xddf1('0x2e')]);}return _0x2f6d9e['getAgents'](_0x582ee9);}})[_0xddf1('0x20')](function(_0x229203){if(_0x229203){return _0x229203?{'count':_0x1b8224,'rows':_0x229203}:null;}})[_0xddf1('0x20')](respondWithResult(_0x151140,null))[_0xddf1('0x2a')](handleError(_0x151140,null));}; \ No newline at end of file +var _0xa32e=['keys','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','findAll','show','params','include','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','SmsAccounts','UserProfileSection','find','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','findOne','Disposition','nolimit','rows','removeDispositions','ids','addAnswer','SmsAccountId','CannedAnswer','removeAnswers','sms','Applications','applications','orderBy','account','CmContact','Sequelize','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','mobile','from','messageId','MessageSid','skebby','text','clicksend','plivo','Text','MessageUUID','infobip','results','csc','segmentedMessage','clickatell','fromNumber','replyMessageId','intelepeer','refid','isNil','ValidationError','from\x20is\x20mandatory','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','Contacts','defaults','contact','SmsInteraction','interaction','created','autoclose','push','*,*,*,*','ContactId','AttachmentId','UserId','unshift','agent','waitForTheAssignedAgent','queueId','SmsQueue','queue','waitForTheAssignedQueue','receiveMessage','entity\x20found','twilio','set','Content-Type','text/xml','\x0a','addApplications','sequelize','transaction','ISOLATION_LEVELS','READ_COMMITTED','SmsApplication','priority','finally','getApplications','getInteractions','Contact','fullname','internal','Tag','Tags','color','tag','body\x20is\x20mandatory\x20and\x20not\x20empty','to\x20is\x20mandatory','DESC','List','SmsMessage','spread','dataValues','Messages','debug','inspect','skebby_dispatch_id','connectel','statusInt','requestid','message_id','status_code','groupName','DELIVERED','redif','error_code','DELIVERED_TO_GATEWAY','bandwidth','message-delivered','DELIVRD','ACCEPTD','statusGet','received\x20delivery\x20report\x20from','message-id','state','addAgents','omit','emit','userSmsAccount:save','removeAgents','isArray','userSmsAccount:remove','getAgents','User','eml-format','rimraf','zip-dir','fast-json-patch','moment','util','path','sox','to-csv','fs-extra','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','./smsAccount.socket','jayson/promise','http','request','then','info','SmsAccount,\x20%s,\x20%s','request\x20sent','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','sendStatus','status','end','offset','undefined','count','limit','json','reject','update','destroy','get','name','send','index','Pause','mandatoryDispositionPause','SmsAccount','rawAttributes','fieldName','type','model','map','query'];(function(_0xeab51d,_0x1bc23e){var _0x190c24=function(_0x2b7136){while(--_0x2b7136){_0xeab51d['push'](_0xeab51d['shift']());}};_0x190c24(++_0x1bc23e);}(_0xa32e,0x180));var _0xea32=function(_0x396d21,_0x4a093c){_0x396d21=_0x396d21-0x0;var _0x13554a=_0xa32e[_0x396d21];return _0x13554a;};'use strict';var emlformat=require(_0xea32('0x0'));var rimraf=require(_0xea32('0x1'));var zipdir=require(_0xea32('0x2'));var jsonpatch=require(_0xea32('0x3'));var rp=require('request-promise');var moment=require(_0xea32('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xea32('0x5'));var path=require(_0xea32('0x6'));var sox=require(_0xea32('0x7'));var csv=require(_0xea32('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xea32('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xea32('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xea32('0xb'));var toCsv=require('to-csv');var querystring=require(_0xea32('0xc'));var Papa=require(_0xea32('0xd'));var Redis=require(_0xea32('0xe'));var authService=require(_0xea32('0xf'));var qs=require(_0xea32('0x10'));var as=require(_0xea32('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xea32('0x12'));var utils=require(_0xea32('0x13'));var config=require(_0xea32('0x14'));var licenseUtil=require(_0xea32('0x15'));var db=require(_0xea32('0x16'))['db'];config[_0xea32('0x17')]=_['defaults'](config[_0xea32('0x17')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xea32('0x17')]));require(_0xea32('0x18'))['register'](socket);var jayson=require(_0xea32('0x19'));var client=jayson['client'][_0xea32('0x1a')]({'port':0x232c});function respondWithRpcPromise(_0x2a2e99,_0x34d2c6,_0x1b4eb4,_0x407b4f){return new BPromise(function(_0x56f08e,_0x2c946b){var _0x5b3904=_0x407b4f||client;return _0x5b3904[_0xea32('0x1b')](_0x2a2e99,_0x1b4eb4)[_0xea32('0x1c')](function(_0x212e5d){logger[_0xea32('0x1d')](_0xea32('0x1e'),_0x34d2c6,_0xea32('0x1f'));logger['debug'](_0xea32('0x20'),_0x34d2c6,_0xea32('0x1f'),JSON[_0xea32('0x21')](_0x212e5d));if(_0x212e5d[_0xea32('0x22')]){if(_0x212e5d[_0xea32('0x22')]['code']===0x1f4){logger[_0xea32('0x22')](_0xea32('0x1e'),_0x34d2c6,_0x212e5d[_0xea32('0x22')][_0xea32('0x23')]);return _0x2c946b(_0x212e5d[_0xea32('0x22')][_0xea32('0x23')]);}logger['error'](_0xea32('0x1e'),_0x34d2c6,_0x212e5d[_0xea32('0x22')][_0xea32('0x23')]);return _0x56f08e(_0x212e5d[_0xea32('0x22')]['message']);}else{logger[_0xea32('0x1d')]('SmsAccount,\x20%s,\x20%s',_0x34d2c6,_0xea32('0x1f'));_0x56f08e(_0x212e5d[_0xea32('0x24')]['message']);}})[_0xea32('0x25')](function(_0x43d928){logger[_0xea32('0x22')]('SmsAccount,\x20%s,\x20%s',_0x34d2c6,_0x43d928);_0x2c946b(_0x43d928);});});}function respondWithStatusCode(_0x266980,_0x2e68c7){_0x2e68c7=_0x2e68c7||0xcc;return function(_0x3bc121){if(_0x3bc121){return _0x266980[_0xea32('0x26')](_0x2e68c7);}return _0x266980[_0xea32('0x27')](_0x2e68c7)[_0xea32('0x28')]();};}function respondWithResult(_0x2ff2d8,_0x521037){_0x521037=_0x521037||0xc8;return function(_0x1bd2c3){if(_0x1bd2c3){return _0x2ff2d8['status'](_0x521037)['json'](_0x1bd2c3);}};}function respondWithFilteredResult(_0xa7e62a,_0x5cad5e){return function(_0x20c7e8){if(_0x20c7e8){var _0x28f892=typeof _0x5cad5e[_0xea32('0x29')]===_0xea32('0x2a')&&typeof _0x5cad5e['limit']==='undefined';var _0x41eb3b=_0x20c7e8[_0xea32('0x2b')];var _0x170e48=_0x28f892?0x0:_0x5cad5e['offset'];var _0x410369=_0x28f892?_0x20c7e8['count']:_0x5cad5e['offset']+_0x5cad5e[_0xea32('0x2c')];var _0x137a9d;if(_0x410369>=_0x41eb3b){_0x410369=_0x41eb3b;_0x137a9d=0xc8;}else{_0x137a9d=0xce;}_0xa7e62a[_0xea32('0x27')](_0x137a9d);return _0xa7e62a['set']('Content-Range',_0x170e48+'-'+_0x410369+'/'+_0x41eb3b)[_0xea32('0x2d')](_0x20c7e8);}return null;};}function patchUpdates(_0x5b372a){return function(_0x283e5a){try{jsonpatch['apply'](_0x283e5a,_0x5b372a,!![]);}catch(_0x16893e){return BPromise[_0xea32('0x2e')](_0x16893e);}return _0x283e5a['save']();};}function saveUpdates(_0x380ebe,_0x509b7e){return function(_0x1ce1a5){if(_0x1ce1a5){return _0x1ce1a5[_0xea32('0x2f')](_0x380ebe)[_0xea32('0x1c')](function(_0x28d67b){return _0x28d67b;});}return null;};}function removeEntity(_0x2f2196,_0x3130f6){return function(_0x3d102b){if(_0x3d102b){return _0x3d102b[_0xea32('0x30')]()[_0xea32('0x1c')](function(){var _0x149022=_0x3d102b[_0xea32('0x31')]({'plain':!![]});var _0x8e9dc2='SmsAccounts';return db['UserProfileResource'][_0xea32('0x30')]({'where':{'type':_0x8e9dc2,'resourceId':_0x149022['id']}})[_0xea32('0x1c')](function(){return _0x3d102b;});})[_0xea32('0x1c')](function(){_0x2f2196[_0xea32('0x27')](0xcc)[_0xea32('0x28')]();});}};}function handleEntityNotFound(_0xec0180,_0x487a5e){return function(_0x57c641){if(!_0x57c641){_0xec0180[_0xea32('0x26')](0x194);}return _0x57c641;};}function handleError(_0x5c5203,_0x5474a9){_0x5474a9=_0x5474a9||0x1f4;return function(_0x4f9bb6){logger[_0xea32('0x22')](_0x4f9bb6['stack']);if(_0x4f9bb6[_0xea32('0x32')]){delete _0x4f9bb6[_0xea32('0x32')];}_0x5c5203[_0xea32('0x27')](_0x5474a9)[_0xea32('0x33')](_0x4f9bb6);};}exports[_0xea32('0x34')]=function(_0x1d792b,_0x51216d){var _0x2e036a={'include':[{'model':db[_0xea32('0x35')],'as':_0xea32('0x36')}]},_0x57fd58={},_0x3a133a={'count':0x0,'rows':[]};var _0x1119a1=_['map'](db[_0xea32('0x37')][_0xea32('0x38')],function(_0x3b0689){return{'name':_0x3b0689[_0xea32('0x39')],'type':_0x3b0689[_0xea32('0x3a')]['key']};});_0x57fd58[_0xea32('0x3b')]=_[_0xea32('0x3c')](_0x1119a1,_0xea32('0x32'));_0x57fd58[_0xea32('0x3d')]=_[_0xea32('0x3e')](_0x1d792b[_0xea32('0x3d')]);_0x57fd58['filters']=_[_0xea32('0x3f')](_0x57fd58['model'],_0x57fd58[_0xea32('0x3d')]);_0x2e036a['attributes']=_['intersection'](_0x57fd58[_0xea32('0x3b')],qs[_0xea32('0x40')](_0x1d792b[_0xea32('0x3d')]['fields']));_0x2e036a['attributes']=_0x2e036a[_0xea32('0x41')][_0xea32('0x42')]?_0x2e036a[_0xea32('0x41')]:_0x57fd58[_0xea32('0x3b')];if(!_0x1d792b[_0xea32('0x3d')][_0xea32('0x43')]('nolimit')){_0x2e036a[_0xea32('0x2c')]=qs[_0xea32('0x2c')](_0x1d792b[_0xea32('0x3d')][_0xea32('0x2c')]);_0x2e036a[_0xea32('0x29')]=qs['offset'](_0x1d792b[_0xea32('0x3d')][_0xea32('0x29')]);}_0x2e036a[_0xea32('0x44')]=qs[_0xea32('0x45')](_0x1d792b[_0xea32('0x3d')][_0xea32('0x45')]);_0x2e036a[_0xea32('0x46')]=qs[_0xea32('0x47')](_[_0xea32('0x48')](_0x1d792b['query'],_0x57fd58['filters']),_0x1119a1);if(_0x1d792b['query'][_0xea32('0x49')]){_0x2e036a[_0xea32('0x46')]=_[_0xea32('0x4a')](_0x2e036a[_0xea32('0x46')],{'$or':_['map'](_0x1119a1,function(_0x5619cd){if(_0x5619cd[_0xea32('0x3a')]!==_0xea32('0x4b')){var _0xf16df3={};_0xf16df3[_0x5619cd[_0xea32('0x32')]]={'$like':'%'+_0x1d792b['query'][_0xea32('0x49')]+'%'};return _0xf16df3;}})});}_0x2e036a=_['merge']({},_0x2e036a,_0x1d792b[_0xea32('0x4c')]);var _0x21dd80={'where':_0x2e036a[_0xea32('0x46')]};return db[_0xea32('0x37')]['count'](_0x21dd80)[_0xea32('0x1c')](function(_0xb0dbf4){_0x3a133a[_0xea32('0x2b')]=_0xb0dbf4;if(_0x1d792b[_0xea32('0x3d')][_0xea32('0x4d')]){_0x2e036a['include']=[{'all':!![]}];}return db[_0xea32('0x37')][_0xea32('0x4e')](_0x2e036a);})[_0xea32('0x1c')](function(_0x389bda){_0x3a133a['rows']=_0x389bda;return _0x3a133a;})[_0xea32('0x1c')](respondWithFilteredResult(_0x51216d,_0x2e036a))[_0xea32('0x25')](handleError(_0x51216d,null));};exports[_0xea32('0x4f')]=function(_0x227377,_0x37b502){var _0x57e0b0={'raw':![],'where':{'id':_0x227377[_0xea32('0x50')]['id']},'include':[{'model':db['Pause'],'as':_0xea32('0x36')}]},_0x29eef2={};_0x29eef2[_0xea32('0x3b')]=_['keys'](db[_0xea32('0x37')]['rawAttributes']);_0x29eef2[_0xea32('0x3d')]=_[_0xea32('0x3e')](_0x227377[_0xea32('0x3d')]);_0x29eef2[_0xea32('0x47')]=_[_0xea32('0x3f')](_0x29eef2[_0xea32('0x3b')],_0x29eef2[_0xea32('0x3d')]);_0x57e0b0['attributes']=_[_0xea32('0x3f')](_0x29eef2[_0xea32('0x3b')],qs['fields'](_0x227377['query'][_0xea32('0x40')]));_0x57e0b0[_0xea32('0x41')]=_0x57e0b0[_0xea32('0x41')][_0xea32('0x42')]?_0x57e0b0['attributes']:_0x29eef2['model'];if(_0x227377['query']['includeAll']){_0x57e0b0[_0xea32('0x51')]=[{'all':!![]}];}_0x57e0b0=_[_0xea32('0x4a')]({},_0x57e0b0,_0x227377[_0xea32('0x4c')]);return db[_0xea32('0x37')]['find'](_0x57e0b0)[_0xea32('0x1c')](handleEntityNotFound(_0x37b502,null))[_0xea32('0x1c')](respondWithResult(_0x37b502,null))['catch'](handleError(_0x37b502,null));};exports['create']=function(_0x179ee0,_0x52d570){return db[_0xea32('0x37')][_0xea32('0x52')](_0x179ee0['body'],{})['then'](function(_0x927af8){var _0x2ab229=_0x179ee0['user'][_0xea32('0x31')]({'plain':!![]});if(!_0x2ab229)throw new Error(_0xea32('0x53'));if(_0x2ab229[_0xea32('0x54')]===_0xea32('0x55')){var _0x357bb6=_0x927af8[_0xea32('0x31')]({'plain':!![]});var _0x36919f=_0xea32('0x56');return db[_0xea32('0x57')][_0xea32('0x58')]({'where':{'name':_0x36919f,'userProfileId':_0x2ab229[_0xea32('0x59')]},'raw':!![]})[_0xea32('0x1c')](function(_0x163e13){if(_0x163e13&&_0x163e13['autoAssociation']===0x0){return db[_0xea32('0x5a')][_0xea32('0x52')]({'name':_0x357bb6['name'],'resourceId':_0x357bb6['id'],'type':_0x163e13[_0xea32('0x32')],'sectionId':_0x163e13['id']},{})[_0xea32('0x1c')](function(){return _0x927af8;});}else{return _0x927af8;}})[_0xea32('0x25')](function(_0x324744){logger[_0xea32('0x22')](_0xea32('0x5b'),_0x324744);throw _0x324744;});}return _0x927af8;})['then'](respondWithResult(_0x52d570,0xc9))[_0xea32('0x25')](handleError(_0x52d570,null));};exports['update']=function(_0xa6e0f5,_0x14e6e6){if(_0xa6e0f5[_0xea32('0x5c')]['id']){delete _0xa6e0f5[_0xea32('0x5c')]['id'];}return db[_0xea32('0x37')][_0xea32('0x58')]({'where':{'id':_0xa6e0f5['params']['id']},'include':[{'model':db['Pause'],'as':_0xea32('0x36')}]})[_0xea32('0x1c')](handleEntityNotFound(_0x14e6e6,null))[_0xea32('0x1c')](saveUpdates(_0xa6e0f5['body'],null))[_0xea32('0x1c')](respondWithResult(_0x14e6e6,null))[_0xea32('0x25')](handleError(_0x14e6e6,null));};exports['destroy']=function(_0x55277e,_0xd730bd){return db[_0xea32('0x37')]['find']({'where':{'id':_0x55277e[_0xea32('0x50')]['id']}})[_0xea32('0x1c')](handleEntityNotFound(_0xd730bd,null))[_0xea32('0x1c')](removeEntity(_0xd730bd,null))[_0xea32('0x25')](handleError(_0xd730bd,null));};exports[_0xea32('0x5d')]=function(_0x3596fb,_0x3a08fa){return db[_0xea32('0x37')]['describe']()[_0xea32('0x1c')](respondWithResult(_0x3a08fa,null))[_0xea32('0x25')](handleError(_0x3a08fa,null));};exports['addDisposition']=function(_0x2a1bbb,_0x4ddd6a,_0x546497){if(_0x2a1bbb[_0xea32('0x5c')]['id']){delete _0x2a1bbb[_0xea32('0x5c')]['id'];}return db[_0xea32('0x37')]['find']({'where':{'id':_0x2a1bbb[_0xea32('0x50')]['id']}})[_0xea32('0x1c')](handleEntityNotFound(_0x4ddd6a,null))[_0xea32('0x1c')](function(_0x53c219){if(_0x53c219){_0x2a1bbb[_0xea32('0x5c')]['SmsAccountId']=_0x53c219['id'];return db['Disposition'][_0xea32('0x52')](_0x2a1bbb[_0xea32('0x5c')]);}})[_0xea32('0x1c')](respondWithResult(_0x4ddd6a,null))[_0xea32('0x25')](handleError(_0x4ddd6a,null));};exports['getDispositions']=function(_0x2278a4,_0x30d6d0,_0x2f581f){var _0xc4cf1f={'raw':![],'where':{}};var _0x1edf88={};var _0x464f9c={'count':0x0,'rows':[]};return db[_0xea32('0x37')][_0xea32('0x5e')]({'where':{'id':_0x2278a4[_0xea32('0x50')]['id']}})[_0xea32('0x1c')](handleEntityNotFound(_0x30d6d0,null))[_0xea32('0x1c')](function(_0x36753c){if(_0x36753c){_0x1edf88[_0xea32('0x3b')]=_[_0xea32('0x3e')](db[_0xea32('0x5f')]['rawAttributes']);_0x1edf88['query']=_[_0xea32('0x3e')](_0x2278a4[_0xea32('0x3d')]);_0x1edf88[_0xea32('0x47')]=_[_0xea32('0x3f')](_0x1edf88[_0xea32('0x3b')],_0x1edf88[_0xea32('0x3d')]);_0xc4cf1f[_0xea32('0x41')]=_[_0xea32('0x3f')](_0x1edf88[_0xea32('0x3b')],qs[_0xea32('0x40')](_0x2278a4[_0xea32('0x3d')][_0xea32('0x40')]));_0xc4cf1f[_0xea32('0x41')]=_0xc4cf1f[_0xea32('0x41')][_0xea32('0x42')]?_0xc4cf1f[_0xea32('0x41')]:_0x1edf88[_0xea32('0x3b')];if(!_0x2278a4[_0xea32('0x3d')]['hasOwnProperty'](_0xea32('0x60'))){_0xc4cf1f[_0xea32('0x2c')]=qs[_0xea32('0x2c')](_0x2278a4[_0xea32('0x3d')]['limit']);_0xc4cf1f['offset']=qs[_0xea32('0x29')](_0x2278a4[_0xea32('0x3d')][_0xea32('0x29')]);}_0xc4cf1f[_0xea32('0x44')]=qs[_0xea32('0x45')](_0x2278a4[_0xea32('0x3d')]['sort']);_0xc4cf1f['where']=qs[_0xea32('0x47')](_[_0xea32('0x48')](_0x2278a4['query'],_0x1edf88[_0xea32('0x47')]));_0xc4cf1f[_0xea32('0x46')]['SmsAccountId']=_0x36753c['id'];if(_0x2278a4['query'][_0xea32('0x49')]){_0xc4cf1f['where']=_[_0xea32('0x4a')](_0xc4cf1f[_0xea32('0x46')],{'$or':_[_0xea32('0x3c')](_0xc4cf1f[_0xea32('0x41')],function(_0x3ce62b){var _0x19abe9={};_0x19abe9[_0x3ce62b]={'$like':'%'+_0x2278a4['query'][_0xea32('0x49')]+'%'};return _0x19abe9;})});}_0xc4cf1f=_[_0xea32('0x4a')]({},_0xc4cf1f,_0x2278a4[_0xea32('0x4c')]);return db[_0xea32('0x5f')][_0xea32('0x2b')]({'where':_0xc4cf1f[_0xea32('0x46')]})['then'](function(_0x4a168c){_0x464f9c[_0xea32('0x2b')]=_0x4a168c;if(_0x2278a4[_0xea32('0x3d')][_0xea32('0x4d')]){_0xc4cf1f[_0xea32('0x51')]=[{'all':!![]}];}return db[_0xea32('0x5f')][_0xea32('0x4e')](_0xc4cf1f);})[_0xea32('0x1c')](function(_0x4245cb){_0x464f9c[_0xea32('0x61')]=_0x4245cb;return _0x464f9c;});}})[_0xea32('0x1c')](respondWithFilteredResult(_0x30d6d0,_0xc4cf1f))[_0xea32('0x25')](handleError(_0x30d6d0,null));};exports[_0xea32('0x62')]=function(_0x4eb092,_0x37a39a,_0x507d33){return db[_0xea32('0x37')]['find']({'where':{'id':_0x4eb092[_0xea32('0x50')]['id']}})[_0xea32('0x1c')](handleEntityNotFound(_0x37a39a,null))['then'](function(_0x96621f){if(_0x96621f){return _0x96621f[_0xea32('0x62')](_0x4eb092[_0xea32('0x3d')][_0xea32('0x63')]);}})[_0xea32('0x1c')](respondWithStatusCode(_0x37a39a,null))[_0xea32('0x25')](handleError(_0x37a39a,null));};exports[_0xea32('0x64')]=function(_0x787c5f,_0x28c2d6,_0x58c380){if(_0x787c5f[_0xea32('0x5c')]['id']){delete _0x787c5f[_0xea32('0x5c')]['id'];}return db[_0xea32('0x37')][_0xea32('0x58')]({'where':{'id':_0x787c5f['params']['id']}})[_0xea32('0x1c')](handleEntityNotFound(_0x28c2d6,null))[_0xea32('0x1c')](function(_0x523e66){if(_0x523e66){_0x787c5f[_0xea32('0x5c')][_0xea32('0x65')]=_0x523e66['id'];return db[_0xea32('0x66')]['create'](_0x787c5f[_0xea32('0x5c')]);}})['then'](respondWithResult(_0x28c2d6,null))[_0xea32('0x25')](handleError(_0x28c2d6,null));};exports['getAnswers']=function(_0x263a33,_0x396560,_0x4f1acd){var _0x6c63e5={'raw':![],'where':{}};var _0x567c01={};var _0x186f50={'count':0x0,'rows':[]};return db[_0xea32('0x37')][_0xea32('0x5e')]({'where':{'id':_0x263a33['params']['id']}})[_0xea32('0x1c')](handleEntityNotFound(_0x396560,null))['then'](function(_0x214255){if(_0x214255){_0x567c01[_0xea32('0x3b')]=_[_0xea32('0x3e')](db['CannedAnswer'][_0xea32('0x38')]);_0x567c01['query']=_[_0xea32('0x3e')](_0x263a33[_0xea32('0x3d')]);_0x567c01[_0xea32('0x47')]=_[_0xea32('0x3f')](_0x567c01[_0xea32('0x3b')],_0x567c01[_0xea32('0x3d')]);_0x6c63e5[_0xea32('0x41')]=_[_0xea32('0x3f')](_0x567c01[_0xea32('0x3b')],qs['fields'](_0x263a33[_0xea32('0x3d')]['fields']));_0x6c63e5['attributes']=_0x6c63e5[_0xea32('0x41')][_0xea32('0x42')]?_0x6c63e5[_0xea32('0x41')]:_0x567c01['model'];if(!_0x263a33[_0xea32('0x3d')][_0xea32('0x43')]('nolimit')){_0x6c63e5[_0xea32('0x2c')]=qs[_0xea32('0x2c')](_0x263a33[_0xea32('0x3d')][_0xea32('0x2c')]);_0x6c63e5[_0xea32('0x29')]=qs[_0xea32('0x29')](_0x263a33[_0xea32('0x3d')]['offset']);}_0x6c63e5[_0xea32('0x44')]=qs[_0xea32('0x45')](_0x263a33['query'][_0xea32('0x45')]);_0x6c63e5['where']=qs[_0xea32('0x47')](_[_0xea32('0x48')](_0x263a33[_0xea32('0x3d')],_0x567c01[_0xea32('0x47')]));_0x6c63e5['where']['SmsAccountId']=_0x214255['id'];if(_0x263a33[_0xea32('0x3d')]['filter']){_0x6c63e5['where']=_[_0xea32('0x4a')](_0x6c63e5['where'],{'$or':_[_0xea32('0x3c')](_0x6c63e5['attributes'],function(_0x53179d){var _0x414b47={};_0x414b47[_0x53179d]={'$like':'%'+_0x263a33[_0xea32('0x3d')][_0xea32('0x49')]+'%'};return _0x414b47;})});}_0x6c63e5=_['merge']({},_0x6c63e5,_0x263a33['options']);return db['CannedAnswer'][_0xea32('0x2b')]({'where':_0x6c63e5['where']})[_0xea32('0x1c')](function(_0x27b6b5){_0x186f50[_0xea32('0x2b')]=_0x27b6b5;if(_0x263a33['query'][_0xea32('0x4d')]){_0x6c63e5['include']=[{'all':!![]}];}return db[_0xea32('0x66')]['findAll'](_0x6c63e5);})[_0xea32('0x1c')](function(_0x3da5ac){_0x186f50['rows']=_0x3da5ac;return _0x186f50;});}})[_0xea32('0x1c')](respondWithFilteredResult(_0x396560,_0x6c63e5))[_0xea32('0x25')](handleError(_0x396560,null));};exports[_0xea32('0x67')]=function(_0xd5a9d9,_0x133d3a,_0x1a0735){return db['SmsAccount'][_0xea32('0x58')]({'where':{'id':_0xd5a9d9['params']['id']}})['then'](handleEntityNotFound(_0x133d3a,null))[_0xea32('0x1c')](function(_0x4e511a){if(_0x4e511a){return _0x4e511a[_0xea32('0x67')](_0xd5a9d9[_0xea32('0x3d')][_0xea32('0x63')]);}})[_0xea32('0x1c')](respondWithStatusCode(_0x133d3a,null))[_0xea32('0x25')](handleError(_0x133d3a,null));};exports['notify']=function(_0x32c5f5,_0x492353,_0x252708){var _0x20c04e={'channel':_0xea32('0x68')};var _0x3a36af=[];var _0x323726=[];var _0x392cdf={};return db[_0xea32('0x37')][_0xea32('0x58')]({'where':{'id':_0x32c5f5[_0xea32('0x50')]['id']},'include':[{'model':db['SmsApplication'],'as':_0xea32('0x69')}]})[_0xea32('0x1c')](handleEntityNotFound(_0x492353,null))['then'](function(_0x1021cc){_0x20c04e['account']=_0x1021cc;_0x20c04e[_0xea32('0x6a')]=_[_0xea32('0x6b')](_0x1021cc[_0xea32('0x69')],['priority'],['asc']);if(_0x20c04e[_0xea32('0x6c')][_0xea32('0x69')]){delete _0x20c04e[_0xea32('0x6c')]['Applications'];}return db[_0xea32('0x6d')][_0xea32('0x5d')]();})[_0xea32('0x1c')](function(_0x6ff818){if(!_0x6ff818){throw new db[(_0xea32('0x6e'))]['ValidationError'](_0xea32('0x6f'));}_0x3a36af=_[_0xea32('0x70')](_[_0xea32('0x3e')](_0x6ff818),[_0xea32('0x71'),'updatedAt']);_0x323726=_['difference'](_[_0xea32('0x3e')](_0x6ff818),[_0xea32('0x71'),_0xea32('0x72'),_0xea32('0x73'),_0xea32('0x74')]);_0x20c04e[_0xea32('0x5c')]={'mapKey':_0xea32('0x75')};if(_0x20c04e[_0xea32('0x6c')][_0xea32('0x3a')]){switch(_0x20c04e[_0xea32('0x6c')][_0xea32('0x3a')]){case'twilio':_0x20c04e[_0xea32('0x5c')][_0xea32('0x76')]=_0x32c5f5[_0xea32('0x5c')]['From'];_0x20c04e[_0xea32('0x5c')]['body']=_0x32c5f5[_0xea32('0x5c')]['Body'];_0x20c04e[_0xea32('0x5c')][_0xea32('0x77')]=_0x32c5f5[_0xea32('0x5c')][_0xea32('0x78')];break;case _0xea32('0x79'):_0x20c04e[_0xea32('0x5c')][_0xea32('0x76')]='+'+_0x32c5f5[_0xea32('0x5c')]['sender'];_0x20c04e[_0xea32('0x5c')][_0xea32('0x5c')]=_0x32c5f5[_0xea32('0x5c')][_0xea32('0x7a')];break;case'connectel':_0x20c04e[_0xea32('0x5c')]['from']=_0x32c5f5[_0xea32('0x5c')]['from'];_0x20c04e[_0xea32('0x5c')][_0xea32('0x5c')]=_0x32c5f5[_0xea32('0x5c')]['message'];break;case _0xea32('0x7b'):_0x20c04e[_0xea32('0x5c')]['from']=_0x32c5f5[_0xea32('0x5c')][_0xea32('0x76')];_0x20c04e[_0xea32('0x5c')][_0xea32('0x5c')]=_0x32c5f5['body'][_0xea32('0x5c')];_0x20c04e['body'][_0xea32('0x77')]=_0x32c5f5['body']['message_id'];break;case _0xea32('0x7c'):_0x20c04e[_0xea32('0x5c')][_0xea32('0x76')]=_0x32c5f5[_0xea32('0x5c')]['From'];_0x20c04e[_0xea32('0x5c')][_0xea32('0x5c')]=_0x32c5f5[_0xea32('0x5c')][_0xea32('0x7d')];_0x20c04e[_0xea32('0x5c')][_0xea32('0x77')]=_0x32c5f5[_0xea32('0x5c')][_0xea32('0x7e')];break;case _0xea32('0x7f'):_0x20c04e[_0xea32('0x5c')][_0xea32('0x76')]='+'+_0x32c5f5[_0xea32('0x5c')][_0xea32('0x80')][0x0][_0xea32('0x76')];_0x20c04e[_0xea32('0x5c')][_0xea32('0x5c')]=_0x32c5f5[_0xea32('0x5c')][_0xea32('0x80')][0x0]['text'];_0x20c04e['body'][_0xea32('0x77')]=_0x32c5f5['body'][_0xea32('0x80')][0x0][_0xea32('0x77')];break;case _0xea32('0x81'):_0x20c04e[_0xea32('0x5c')]['from']=_0x32c5f5[_0xea32('0x5c')]['originatingAddress'];_0x20c04e[_0xea32('0x5c')][_0xea32('0x5c')]=_0x32c5f5[_0xea32('0x5c')][_0xea32('0x82')][_0xea32('0x23')];break;case _0xea32('0x83'):_0x20c04e[_0xea32('0x5c')]['from']=_0x32c5f5['body'][_0xea32('0x84')];_0x20c04e[_0xea32('0x5c')][_0xea32('0x5c')]=_0x32c5f5['body'][_0xea32('0x7a')];_0x20c04e[_0xea32('0x5c')]['messageId']=_0x32c5f5['body'][_0xea32('0x85')];break;case'bandwidth':_0x20c04e[_0xea32('0x5c')][_0xea32('0x77')]=_0x32c5f5[_0xea32('0x5c')][0x0][_0xea32('0x23')]['id'];_0x20c04e[_0xea32('0x5c')][_0xea32('0x76')]=_0x32c5f5[_0xea32('0x5c')][0x0]['message']['from'];_0x20c04e[_0xea32('0x5c')][_0xea32('0x5c')]=_0x32c5f5[_0xea32('0x5c')][0x0]['message'][_0xea32('0x7a')];break;case _0xea32('0x86'):_0x20c04e[_0xea32('0x5c')]['from']=_0x32c5f5[_0xea32('0x5c')]['from'];_0x20c04e[_0xea32('0x5c')][_0xea32('0x5c')]=_0x32c5f5[_0xea32('0x5c')][_0xea32('0x23')];_0x20c04e['body']['messageId']=_0x32c5f5[_0xea32('0x5c')][_0xea32('0x87')];break;}}if(_0x20c04e[_0xea32('0x5c')]['id']){delete _0x20c04e[_0xea32('0x5c')]['id'];}if(_[_0xea32('0x88')](_0x20c04e['body'][_0xea32('0x76')])){throw new db[(_0xea32('0x6e'))][(_0xea32('0x89'))](_0xea32('0x8a'));}if(_[_0xea32('0x88')](_0x20c04e[_0xea32('0x5c')][_0xea32('0x5c')])||_0x20c04e[_0xea32('0x5c')][_0xea32('0x5c')]===''){throw new db[(_0xea32('0x6e'))][(_0xea32('0x89'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0xea32('0x88')](_0x20c04e['body'][_0xea32('0x8b')])){throw new db['Sequelize']['ValidationError'](_0xea32('0x8c')+_0x323726);}if(!_[_0xea32('0x8d')](_0x323726,_0x20c04e[_0xea32('0x5c')][_0xea32('0x8b')])){throw new db[(_0xea32('0x6e'))][(_0xea32('0x89'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x323726);}_0x392cdf[_0x20c04e[_0xea32('0x5c')][_0xea32('0x8b')]]=_0x20c04e[_0xea32('0x5c')][_0xea32('0x76')];return db['CmList'][_0xea32('0x58')]({'where':{'id':_0x20c04e[_0xea32('0x6c')][_0xea32('0x74')]},'include':[{'model':db[_0xea32('0x6d')],'as':_0xea32('0x8e'),'where':_0x392cdf,'limit':0x1,'order':[[_0xea32('0x72'),'DESC']]}]});})['then'](handleEntityNotFound(_0x492353,null))[_0xea32('0x1c')](function(_0xffaa13){if(_0xffaa13){_0x20c04e['list']=_['omit'](_0xffaa13,[_0xea32('0x8e')]);if(_0xffaa13[_0xea32('0x8e')]['length']){return _0xffaa13[_0xea32('0x8e')][0x0];}var _0x19a853=_[_0xea32('0x8f')](_0x20c04e[_0xea32('0x5c')],{'firstName':_0x20c04e[_0xea32('0x5c')][_0xea32('0x76')],'ListId':_0xffaa13['id']});_0x19a853[_0x20c04e[_0xea32('0x5c')][_0xea32('0x8b')]]=_0x20c04e['body'][_0xea32('0x76')];return db['CmContact']['create'](_0x19a853,{'fields':_0x3a36af,'raw':!![]});}})[_0xea32('0x1c')](handleEntityNotFound(_0x492353,null))[_0xea32('0x1c')](function(_0x265a3f){if(_0x265a3f){_0x20c04e[_0xea32('0x90')]=_0x265a3f;var _0x19e813={'ContactId':_0x265a3f['id'],'phone':_0x20c04e[_0xea32('0x5c')]['from'],'SmsAccountId':_0x32c5f5['params']['id']};var _0x18ffee={'ContactId':_0x265a3f['id'],'SmsAccountId':_0x32c5f5['params']['id'],'closed':![]};return db[_0xea32('0x91')][_0xea32('0x58')]({'where':_0x18ffee})[_0xea32('0x1c')](function(_0x935528){if(_0x935528){return[_0x935528,![]];}return db[_0xea32('0x91')][_0xea32('0x52')](_0x19e813)[_0xea32('0x1c')](function(_0x46fadc){return[_0x46fadc,!![]];});});}})['spread'](function(_0x395ef3,_0x22dae8){_0x20c04e[_0xea32('0x92')]=_0x395ef3['get']({'plain':!![]});_0x20c04e[_0xea32('0x92')][_0xea32('0x93')]=![];if(_0x22dae8){if(_0x20c04e['account'][_0xea32('0x94')]){_0x20c04e[_0xea32('0x6a')][_0xea32('0x95')]({'id':0x0,'priority':_0x20c04e['applications'][_0xea32('0x42')]+0x1,'app':'close','appdata':'unmanaged','interval':_0xea32('0x96')});}_0x20c04e[_0xea32('0x92')][_0xea32('0x93')]=!![];}return db['SmsMessage']['create']({'phone':_0x20c04e[_0xea32('0x5c')][_0xea32('0x76')],'messageId':_0x20c04e['body'][_0xea32('0x77')],'body':_0x20c04e[_0xea32('0x5c')][_0xea32('0x5c')],'SmsAccountId':_0x32c5f5[_0xea32('0x50')]['id'],'SmsInteractionId':_0x395ef3['id'],'direction':'in','ContactId':_0x395ef3[_0xea32('0x97')],'AttachmentId':_0x20c04e[_0xea32('0x5c')][_0xea32('0x98')]});})['then'](function(_0x53653c){_0x20c04e[_0xea32('0x23')]=_0x53653c;if(!_0x20c04e[_0xea32('0x92')][_0xea32('0x99')])return;return db['User']['find']({'attributes':['id',_0xea32('0x32')],'where':{'id':_0x20c04e[_0xea32('0x92')][_0xea32('0x99')]}});})[_0xea32('0x1c')](function(_0x18f4cb){if(_0x18f4cb){_0x20c04e['applications'][_0xea32('0x9a')]({'id':0x0,'priority':0x0,'app':_0xea32('0x9b'),'appdata':_0x18f4cb[_0xea32('0x32')]+','+(_0x20c04e[_0xea32('0x6c')][_0xea32('0x9c')]||0xa),'interval':_0xea32('0x96')});}if(!_0x20c04e['interaction'][_0xea32('0x9d')])return;return db[_0xea32('0x9e')][_0xea32('0x58')]({'attributes':['id',_0xea32('0x32')],'where':{'id':_0x20c04e[_0xea32('0x92')][_0xea32('0x9d')]}});})[_0xea32('0x1c')](function(_0x27121e){if(_0x27121e){_0x20c04e[_0xea32('0x6a')]['unshift']({'id':0x0,'priority':0x1,'app':_0xea32('0x9f'),'appdata':_0x27121e[_0xea32('0x32')]+','+(_0x20c04e['account'][_0xea32('0xa0')]||0x12c),'interval':_0xea32('0x96')});}return respondWithRpcPromise('Start','startRouting',_0x20c04e);})[_0xea32('0x1c')](function(_0x42fe7e){if(_0x42fe7e){var _0x31a32c=0xc8;var _0x110965=_0xea32('0xa1');logger[_0xea32('0x1d')](_0xea32('0x20'),_0x110965,_0x31a32c,_0xea32('0xa2'));logger['debug']('SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s',_0x110965,_0x31a32c,'entity\x20found',JSON['stringify'](_0x42fe7e));if(_0x20c04e['account'][_0xea32('0x3a')]===_0xea32('0xa3')){return _0x492353[_0xea32('0x27')](_0x31a32c)[_0xea32('0xa4')](_0xea32('0xa5'),_0xea32('0xa6'))[_0xea32('0x33')](_0xea32('0xa7'));}else{return _0x492353['status'](_0x31a32c)[_0xea32('0x2d')](_0x42fe7e);}}})[_0xea32('0x25')](handleError(_0x492353,null));};exports[_0xea32('0xa8')]=function(_0x1c288e,_0x300bc8){var _0x4b0fb5=_0x1c288e['params']['id'];var _0x554c76=_0x1c288e[_0xea32('0x5c')];var _0x101cfb=0xc8;var _0x5a9c7d=null;return db[_0xea32('0xa9')][_0xea32('0xaa')]({'isolationLevel':db[_0xea32('0xa9')]['Transaction'][_0xea32('0xab')][_0xea32('0xac')]},function(_0xad1e7d){return db[_0xea32('0x37')][_0xea32('0x5e')]({'where':{'id':_0x4b0fb5},'transaction':_0xad1e7d})[_0xea32('0x1c')](function(_0x3f8137){if(_0x3f8137){return db[_0xea32('0xad')]['destroy']({'where':{'SmsAccountId':_0x4b0fb5},'transaction':_0xad1e7d})['then'](function(){var _0x1a29e7=_[_0xea32('0x3c')](_0x554c76,function(_0x231c8b){_0x231c8b[_0xea32('0x65')]=_0x4b0fb5;return _0x231c8b;});return db[_0xea32('0xad')]['bulkCreate'](_0x1a29e7,{'transaction':_0xad1e7d});});}else{_0x101cfb=0x194;_0x5a9c7d=[];}});})[_0xea32('0x1c')](function(){if(_0x101cfb!==0x194){return db[_0xea32('0xad')]['findAndCountAll']({'where':{'SmsAccountId':_0x4b0fb5},'order':_0xea32('0xae')})[_0xea32('0x1c')](function(_0x53e5b0){_0x5a9c7d=_0x53e5b0;});}})[_0xea32('0x25')](function(_0x681f51){_0x101cfb=0x1f4;logger[_0xea32('0x22')](_0x681f51['stack']);if(_0x681f51[_0xea32('0x32')]){delete _0x681f51['name'];}_0x5a9c7d=_0x681f51;})[_0xea32('0xaf')](function(){if(_0x5a9c7d===null){_0x300bc8[_0xea32('0x26')](_0x101cfb);}else{if(_0x101cfb===0x1f4){_0x300bc8[_0xea32('0x27')](_0x101cfb)[_0xea32('0x33')](_0x5a9c7d);}else{_0x300bc8[_0xea32('0x27')](_0x101cfb)[_0xea32('0x2d')](_0x5a9c7d);}}});};exports[_0xea32('0xb0')]=function(_0x19ab4a,_0x4b6dcc,_0x4c6647){var _0x179d3a={};var _0x58c2d2={};var _0xabda9f;var _0x13022a;return db[_0xea32('0x37')][_0xea32('0x5e')]({'where':{'id':_0x19ab4a[_0xea32('0x50')]['id']}})['then'](handleEntityNotFound(_0x4b6dcc,null))[_0xea32('0x1c')](function(_0x334daa){if(_0x334daa){_0xabda9f=_0x334daa;_0x58c2d2[_0xea32('0x3b')]=_[_0xea32('0x3e')](db['SmsApplication'][_0xea32('0x38')]);_0x58c2d2[_0xea32('0x3d')]=_[_0xea32('0x3e')](_0x19ab4a[_0xea32('0x3d')]);_0x58c2d2[_0xea32('0x47')]=_[_0xea32('0x3f')](_0x58c2d2['model'],_0x58c2d2['query']);_0x179d3a[_0xea32('0x41')]=_[_0xea32('0x3f')](_0x58c2d2[_0xea32('0x3b')],qs[_0xea32('0x40')](_0x19ab4a[_0xea32('0x3d')][_0xea32('0x40')]));_0x179d3a[_0xea32('0x41')]=_0x179d3a['attributes'][_0xea32('0x42')]?_0x179d3a['attributes']:_0x58c2d2[_0xea32('0x3b')];_0x179d3a[_0xea32('0x44')]=qs[_0xea32('0x45')](_0x19ab4a[_0xea32('0x3d')][_0xea32('0x45')]);_0x179d3a[_0xea32('0x46')]=qs['filters'](_[_0xea32('0x48')](_0x19ab4a[_0xea32('0x3d')],_0x58c2d2['filters']));if(_0x19ab4a['query'][_0xea32('0x49')]){_0x179d3a[_0xea32('0x46')]=_[_0xea32('0x4a')](_0x179d3a['where'],{'$or':_[_0xea32('0x3c')](_0x179d3a[_0xea32('0x41')],function(_0x175048){var _0x508192={};_0x508192[_0x175048]={'$like':'%'+_0x19ab4a[_0xea32('0x3d')][_0xea32('0x49')]+'%'};return _0x508192;})});}_0x179d3a=_[_0xea32('0x4a')]({},_0x179d3a,_0x19ab4a['options']);return _0xabda9f[_0xea32('0xb0')](_0x179d3a);}})[_0xea32('0x1c')](function(_0x194b88){if(_0x194b88){_0x13022a=_0x194b88[_0xea32('0x42')];if(!_0x19ab4a[_0xea32('0x3d')][_0xea32('0x43')]('nolimit')){_0x179d3a[_0xea32('0x2c')]=qs[_0xea32('0x2c')](_0x19ab4a['query'][_0xea32('0x2c')]);_0x179d3a[_0xea32('0x29')]=qs['offset'](_0x19ab4a[_0xea32('0x3d')][_0xea32('0x29')]);}return _0xabda9f[_0xea32('0xb0')](_0x179d3a);}})['then'](function(_0x319cf6){if(_0x319cf6){return _0x319cf6?{'count':_0x13022a,'rows':_0x319cf6}:null;}})[_0xea32('0x1c')](respondWithResult(_0x4b6dcc,null))[_0xea32('0x25')](handleError(_0x4b6dcc,null));};exports[_0xea32('0xb1')]=function(_0x16b616,_0x451b3b,_0x560066){var _0x3c7028={'raw':![],'where':{}};var _0x4841a2={};var _0x3e83dc={'count':0x0,'rows':[]};return db[_0xea32('0x37')]['findOne']({'where':{'id':_0x16b616[_0xea32('0x50')]['id']}})[_0xea32('0x1c')](handleEntityNotFound(_0x451b3b,null))[_0xea32('0x1c')](function(_0x241506){if(_0x241506){_0x4841a2[_0xea32('0x3b')]=_[_0xea32('0x3e')](db['SmsInteraction'][_0xea32('0x38')]);_0x4841a2['query']=_[_0xea32('0x3e')](_0x16b616[_0xea32('0x3d')]);_0x4841a2['filters']=_[_0xea32('0x3f')](_0x4841a2[_0xea32('0x3b')],_0x4841a2[_0xea32('0x3d')]);_0x3c7028[_0xea32('0x41')]=_[_0xea32('0x3f')](_0x4841a2['model'],qs[_0xea32('0x40')](_0x16b616[_0xea32('0x3d')][_0xea32('0x40')]));_0x3c7028['attributes']=_0x3c7028[_0xea32('0x41')][_0xea32('0x42')]?_0x3c7028[_0xea32('0x41')]:_0x4841a2[_0xea32('0x3b')];if(!_0x16b616[_0xea32('0x3d')]['hasOwnProperty']('nolimit')){_0x3c7028[_0xea32('0x2c')]=qs[_0xea32('0x2c')](_0x16b616['query'][_0xea32('0x2c')]);_0x3c7028[_0xea32('0x29')]=qs[_0xea32('0x29')](_0x16b616[_0xea32('0x3d')][_0xea32('0x29')]);}_0x3c7028[_0xea32('0x44')]=qs[_0xea32('0x45')](_0x16b616[_0xea32('0x3d')][_0xea32('0x45')]);_0x3c7028[_0xea32('0x46')]=qs[_0xea32('0x47')](_[_0xea32('0x48')](_0x16b616[_0xea32('0x3d')],_0x4841a2[_0xea32('0x47')]));_0x3c7028[_0xea32('0x46')][_0xea32('0x65')]=_0x241506['id'];if(_0x16b616[_0xea32('0x3d')][_0xea32('0x49')]){_0x3c7028[_0xea32('0x46')]=_[_0xea32('0x4a')](_0x3c7028[_0xea32('0x46')],{'$or':_[_0xea32('0x3c')](_0x3c7028[_0xea32('0x41')],function(_0x311569){var _0x4b3f2d={};_0x4b3f2d[_0x311569]={'$like':'%'+_0x16b616[_0xea32('0x3d')][_0xea32('0x49')]+'%'};return _0x4b3f2d;})});}_0x3c7028=_[_0xea32('0x4a')]({},_0x3c7028,_0x16b616[_0xea32('0x4c')]);return db[_0xea32('0x91')][_0xea32('0x2b')]({'where':_0x3c7028['where']})['then'](function(_0x1bb80b){_0x3e83dc[_0xea32('0x2b')]=_0x1bb80b;if(_0x16b616[_0xea32('0x3d')][_0xea32('0x4d')]){_0x3c7028['include']=[{'model':db[_0xea32('0x6d')],'as':_0xea32('0xb2'),'required':![]},{'model':db['User'],'as':'Owner','attributes':[_0xea32('0x32'),_0xea32('0xb3'),_0xea32('0xb4')],'required':![]},{'model':db[_0xea32('0xb5')],'as':_0xea32('0xb6'),'attributes':['id','name',_0xea32('0xb7')],'where':_0x16b616[_0xea32('0x3d')][_0xea32('0xb8')]?{'id':_0x16b616[_0xea32('0x3d')][_0xea32('0xb8')]}:undefined,'required':_0x16b616[_0xea32('0x3d')]['tag']?!![]:![]}];}return db['SmsInteraction'][_0xea32('0x4e')](_0x3c7028);})[_0xea32('0x1c')](function(_0x4632dd){_0x3e83dc[_0xea32('0x61')]=_0x4632dd;return _0x3e83dc;});}})[_0xea32('0x1c')](respondWithFilteredResult(_0x451b3b,_0x3c7028))[_0xea32('0x25')](handleError(_0x451b3b,null));};exports['send']=function(_0x162c06,_0x59d401,_0x26e0c7){var _0x2f78dc,_0x28a2fc,_0x3ffdf7;if(_['isNil'](_0x162c06['body'][_0xea32('0x5c')])||_0x162c06[_0xea32('0x5c')][_0xea32('0x5c')]===''){throw new db[(_0xea32('0x6e'))][(_0xea32('0x89'))](_0xea32('0xb9'));}if(_[_0xea32('0x88')](_0x162c06[_0xea32('0x5c')]['to'])){throw new db['Sequelize'][(_0xea32('0x89'))](_0xea32('0xba'));}_0x2f78dc=_0x162c06[_0xea32('0x5c')]['to'];return db[_0xea32('0x37')][_0xea32('0x58')]({'where':{'id':_0x162c06[_0xea32('0x50')]['id']},'include':[{'model':db['CmList'],'as':'List','include':[{'model':db[_0xea32('0x6d')],'as':_0xea32('0x8e'),'where':{'mobile':_0x2f78dc},'limit':0x1,'order':[['updatedAt',_0xea32('0xbb')]]}]}]})[_0xea32('0x1c')](handleEntityNotFound(_0x59d401,null))['then'](function(_0x347472){if(_0x347472&&_0x347472['List']){_0x28a2fc=_0x347472[_0xea32('0x31')]({'plain':!![]});if(_0x28a2fc[_0xea32('0xbc')]&&_0x28a2fc['List'][_0xea32('0x8e')][_0xea32('0x42')]){return _0x28a2fc[_0xea32('0xbc')][_0xea32('0x8e')][0x0];}return db[_0xea32('0x6d')][_0xea32('0x52')](_[_0xea32('0x8f')](_0x162c06[_0xea32('0x5c')],{'firstName':_0x2f78dc,'mobile':_0x2f78dc,'phone':_0x2f78dc,'ListId':_0x28a2fc[_0xea32('0x74')]}));}})[_0xea32('0x1c')](handleEntityNotFound(_0x59d401,null))[_0xea32('0x1c')](function(_0x571e42){if(_0x571e42){_0x3ffdf7=_0x571e42;return db[_0xea32('0x91')][_0xea32('0x58')]({'where':{'ContactId':_0x3ffdf7['id'],'closed':![],'SmsAccountId':_0x28a2fc['id']}})[_0xea32('0x1c')](function(_0x19264e){if(_0x19264e){return[_0x19264e,![]];}return db['SmsInteraction'][_0xea32('0x52')]({'UserId':_0x162c06[_0xea32('0x55')]['id'],'ContactId':_0x3ffdf7['id'],'SmsAccountId':_0x28a2fc['id'],'phone':_0x2f78dc,'firstMsgDirection':'out','Messages':[_[_0xea32('0x4a')](_0x162c06['body'],{'read':![],'body':_0x162c06['body'][_0xea32('0x5c')],'phone':_0x2f78dc,'SmsAccountId':_0x28a2fc['id'],'UserId':_0x162c06[_0xea32('0x55')]['id'],'ContactId':_0x3ffdf7['id']})]},{'include':[{'model':db[_0xea32('0xbd')],'as':'Messages'}]})['then'](function(_0x423c6b){return[_0x423c6b,!![]];});});}})[_0xea32('0xbe')](function(_0x299569,_0x3f011f){if(_0x3f011f){return _0x299569;}return db['SmsMessage'][_0xea32('0x52')](_[_0xea32('0x4a')](_0x162c06[_0xea32('0x5c')],{'read':![],'body':_0x162c06['body']['body'],'phone':_0x2f78dc,'SmsAccountId':_0x28a2fc['id'],'SmsInteractionId':_0x299569['id'],'UserId':_0x162c06[_0xea32('0x55')]['id'],'ContactId':_0x3ffdf7['id']}))[_0xea32('0x1c')](function(_0x17af23){_0x299569[_0xea32('0xbf')][_0xea32('0xc0')]=[];_0x299569[_0xea32('0xbf')][_0xea32('0xc0')]['push'](_0x17af23[_0xea32('0xbf')]);return _0x299569;});})['then'](respondWithResult(_0x59d401,null))[_0xea32('0x25')](handleError(_0x59d401,null));};exports[_0xea32('0x27')]=function(_0x1fd360,_0x724779,_0x357ccf){if(_0x1fd360[_0xea32('0x5c')]['id']){delete _0x1fd360[_0xea32('0x5c')]['id'];}var _0x1d0840,_0x454c33,_0x25d713;return db[_0xea32('0x37')][_0xea32('0x58')]({'where':{'id':_0x1fd360[_0xea32('0x50')]['id']}})['then'](handleEntityNotFound(_0x724779,null))[_0xea32('0x1c')](function(_0xf86797){if(_0xf86797){_0x25d713=_0xf86797;logger[_0xea32('0xc1')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0xea32('0x27'),'received\x20delivery\x20report\x20from',_0xf86797[_0xea32('0x3a')],util[_0xea32('0xc2')](_0x1fd360[_0xea32('0x5c')],{'showHidden':![],'depth':null}));switch(_0xf86797[_0xea32('0x3a')]){case _0xea32('0x79'):if(_0x1fd360[_0xea32('0x5c')][_0xea32('0xc3')]&&_0x1fd360[_0xea32('0x5c')][_0xea32('0x27')]){_0x454c33=_0x1fd360[_0xea32('0x5c')][_0xea32('0x27')];return db[_0xea32('0xbd')][_0xea32('0x58')]({'where':{'messageId':_0x1fd360['body'][_0xea32('0xc3')]}});}break;case _0xea32('0xc4'):if(_0x1fd360['body']['requestid']&&_0x1fd360[_0xea32('0x5c')][_0xea32('0xc5')]){_0x454c33=_0x1fd360[_0xea32('0x5c')][_0xea32('0xc5')];return db['SmsMessage'][_0xea32('0x58')]({'where':{'messageId':_0x1fd360[_0xea32('0x5c')][_0xea32('0xc6')]}});}break;case _0xea32('0x7b'):if(_0x1fd360['body'][_0xea32('0xc7')]&&_0x1fd360[_0xea32('0x5c')][_0xea32('0xc8')]){_0x454c33=_0x1fd360[_0xea32('0x5c')][_0xea32('0xc8')];return db[_0xea32('0xbd')][_0xea32('0x58')]({'where':{'messageId':_0x1fd360['body'][_0xea32('0xc7')]}});}break;case _0xea32('0x7f'):var _0x1a5ab1=_0x1fd360['body'][_0xea32('0x80')][0x0];if(_0x1a5ab1[_0xea32('0x77')]&&_0x1a5ab1[_0xea32('0x27')][_0xea32('0xc9')]===_0xea32('0xca')){_0x454c33=_0x1a5ab1[_0xea32('0x27')][_0xea32('0xc9')];return db[_0xea32('0xbd')]['find']({'where':{'messageId':_0x1a5ab1[_0xea32('0x77')]}});}break;case _0xea32('0x83'):if(_0x1fd360[_0xea32('0x5c')][_0xea32('0x77')]&&_0x1fd360[_0xea32('0x5c')][_0xea32('0x27')]){_0x454c33=_0x1fd360[_0xea32('0x5c')][_0xea32('0x27')];return db[_0xea32('0xbd')][_0xea32('0x58')]({'where':{'messageId':_0x1fd360[_0xea32('0x5c')][_0xea32('0x77')]}});}break;case'bandwidth':if(_0x1fd360[_0xea32('0x5c')][0x0][_0xea32('0x23')]['id']){_0x454c33=_0x1fd360[_0xea32('0x5c')][0x0][_0xea32('0x3a')];return db['SmsMessage'][_0xea32('0x58')]({'where':{'messageId':_0x1fd360[_0xea32('0x5c')][0x0][_0xea32('0x23')]['id']}});}break;case _0xea32('0x86'):if(_0x1fd360[_0xea32('0x5c')][_0xea32('0xcb')]&&_0x1fd360['body'][_0xea32('0x27')]){_0x454c33=_0x1fd360[_0xea32('0x5c')][_0xea32('0x27')];return db[_0xea32('0xbd')][_0xea32('0x58')]({'where':{'messageId':_0x1fd360['body'][_0xea32('0xcb')]}});}break;}}})[_0xea32('0x1c')](handleEntityNotFound(_0x724779,null))[_0xea32('0x1c')](function(_0x2581d7){if(_0x2581d7){_0x1d0840=_0x2581d7;switch(_0x25d713[_0xea32('0x3a')]){case'skebby':if(_0x454c33==='DELIVERED'){return _0x1d0840[_0xea32('0x2f')]({'read':!![]});}else{logger[_0xea32('0x22')](_0xea32('0x20'),'status','skebby',util[_0xea32('0xc2')](_0x1fd360[_0xea32('0x5c')],{'showHidden':![],'depth':null}));}break;case _0xea32('0xc4'):if(_0x454c33==='1'){return _0x1d0840[_0xea32('0x2f')]({'read':!![]});}else{logger[_0xea32('0x22')](_0xea32('0x20'),_0xea32('0x27'),_0xea32('0x79'),util[_0xea32('0xc2')](_0x1fd360[_0xea32('0x5c')],{'showHidden':![],'depth':null}));}break;case _0xea32('0x7b'):if(!_0x1fd360[_0xea32('0x5c')][_0xea32('0xcc')]&&_0x454c33>=0xc8&&_0x454c33<=0xce){return _0x1d0840[_0xea32('0x2f')]({'read':!![]});}else{logger[_0xea32('0x22')](_0xea32('0x20'),'status',_0xea32('0x7b'),util['inspect'](_0x1fd360['body'],{'showHidden':![],'depth':null}));}break;case _0xea32('0x7f'):var _0x19ed12=_0x1fd360[_0xea32('0x5c')][_0xea32('0x80')][0x0];if(_0x19ed12[_0xea32('0x27')]['groupName']===_0xea32('0xca')){return _0x1d0840[_0xea32('0x2f')]({'read':!![]});}else{logger[_0xea32('0x22')](_0xea32('0x20'),'status',_0xea32('0x7f'),util[_0xea32('0xc2')](_0x1fd360[_0xea32('0x5c')],{'showHidden':![],'depth':null}));}break;case _0xea32('0x83'):if(_0x454c33==_0xea32('0xcd')||_0x454c33=='RECEIVED_BY_RECIPIENT'){return _0x1d0840[_0xea32('0x2f')]({'read':!![]});}else{logger[_0xea32('0x22')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0xea32('0x27'),'clickatell',util[_0xea32('0xc2')](_0x1fd360[_0xea32('0x5c')],{'showHidden':![],'depth':null}));}break;case _0xea32('0xce'):if(_0x454c33==_0xea32('0xcf')){return _0x1d0840[_0xea32('0x2f')]({'read':!![]});}else{logger[_0xea32('0x22')](_0xea32('0x20'),_0xea32('0x27'),_0xea32('0xce'),util[_0xea32('0xc2')](_0x1fd360[_0xea32('0x5c')],{'showHidden':![],'depth':null}));}break;case _0xea32('0x86'):if(_0x454c33===_0xea32('0xd0')||_0x454c33===_0xea32('0xd1')){return _0x1d0840[_0xea32('0x2f')]({'read':!![]});}else{logger[_0xea32('0x22')]('SmsAccount,\x20%s,\x20%s,\x20%s','status',_0xea32('0x86'),util['inspect'](_0x1fd360[_0xea32('0x5c')],{'showHidden':![],'depth':null}));}break;}return _0x1d0840;}})[_0xea32('0x1c')](respondWithResult(_0x724779,null))[_0xea32('0x25')](handleError(_0x724779,null));};exports[_0xea32('0xd2')]=function(_0x2b6003,_0x22eefa,_0x1ba1c0){var _0x44055a,_0x4b1eb4,_0x2478b1;return db[_0xea32('0x37')][_0xea32('0x58')]({'where':{'id':_0x2b6003[_0xea32('0x50')]['id']}})[_0xea32('0x1c')](handleEntityNotFound(_0x22eefa,null))[_0xea32('0x1c')](function(_0x471693){if(_0x471693){_0x2478b1=_0x471693;logger[_0xea32('0xc1')](_0xea32('0x20'),_0xea32('0x27'),_0xea32('0xd3'),_0x471693[_0xea32('0x3a')],util[_0xea32('0xc2')](_0x2b6003['query'],{'showHidden':![],'depth':null}));switch(_0x471693[_0xea32('0x3a')]){case _0xea32('0x81'):if(_0x2b6003[_0xea32('0x3d')][_0xea32('0xd4')]&&_0x2b6003[_0xea32('0x3d')][_0xea32('0xd5')]){_0x4b1eb4=_0x2b6003[_0xea32('0x3d')]['state'];return db[_0xea32('0xbd')]['find']({'where':{'messageId':_0x2b6003[_0xea32('0x3d')][_0xea32('0xd4')]}});}break;}}})['then'](handleEntityNotFound(_0x22eefa,null))[_0xea32('0x1c')](function(_0x1aa81e){if(_0x1aa81e){_0x44055a=_0x1aa81e;switch(_0x2478b1[_0xea32('0x3a')]){case'csc':if(_0x4b1eb4==='2'||_0x4b1eb4==='6'){return _0x44055a[_0xea32('0x2f')]({'read':!![]});}else{logger[_0xea32('0x22')](_0xea32('0x20'),_0xea32('0x27'),_0xea32('0x81'),util[_0xea32('0xc2')](_0x2b6003[_0xea32('0x3d')],{'showHidden':![],'depth':null}));};break;}return _0x44055a;}})[_0xea32('0x1c')](respondWithResult(_0x22eefa,null))[_0xea32('0x25')](handleError(_0x22eefa,null));};exports[_0xea32('0xd6')]=function(_0x2e2e2f,_0x532775,_0x9da77f){return db['SmsAccount'][_0xea32('0x58')]({'where':{'id':_0x2e2e2f['params']['id']}})[_0xea32('0x1c')](handleEntityNotFound(_0x532775,null))[_0xea32('0x1c')](function(_0x6552d1){if(_0x6552d1){return _0x6552d1['addAgents'](_0x2e2e2f['body']['ids'],_[_0xea32('0xd7')](_0x2e2e2f[_0xea32('0x5c')],[_0xea32('0x63'),'id'])||{})[_0xea32('0xbe')](function(_0x35071e){for(var _0xa68654=0x0;_0xa68654<_0x2e2e2f[_0xea32('0x5c')][_0xea32('0x63')][_0xea32('0x42')];_0xa68654+=0x1){socket[_0xea32('0xd8')](_0xea32('0xd9'),{'UserId':Number(_0x2e2e2f[_0xea32('0x5c')][_0xea32('0x63')][_0xa68654]),'SmsAccountId':Number(_0x2e2e2f['params']['id'])});}return _0x35071e;});}})[_0xea32('0x1c')](respondWithResult(_0x532775,null))['catch'](handleError(_0x532775,null));};exports['removeAgents']=function(_0x17c60b,_0x162eb1,_0x4cb43d){return db['SmsAccount'][_0xea32('0x58')]({'where':{'id':_0x17c60b[_0xea32('0x50')]['id']}})[_0xea32('0x1c')](handleEntityNotFound(_0x162eb1,null))[_0xea32('0x1c')](function(_0x1ec0d0){if(_0x1ec0d0){return _0x1ec0d0[_0xea32('0xda')](_0x17c60b[_0xea32('0x3d')]['ids'])[_0xea32('0x1c')](function(){if(_[_0xea32('0xdb')](_0x17c60b[_0xea32('0x3d')]['ids'])){for(var _0x1266cb=0x0;_0x1266cb<_0x17c60b[_0xea32('0x3d')][_0xea32('0x63')][_0xea32('0x42')];_0x1266cb+=0x1){socket['emit']('userSmsAccount:remove',{'UserId':Number(_0x17c60b[_0xea32('0x3d')][_0xea32('0x63')][_0x1266cb]),'SmsAccountId':Number(_0x17c60b[_0xea32('0x50')]['id'])});}}else{socket[_0xea32('0xd8')](_0xea32('0xdc'),{'UserId':Number(_0x17c60b[_0xea32('0x3d')]['ids']),'SmsAccountId':Number(_0x17c60b[_0xea32('0x50')]['id'])});}});}})[_0xea32('0x1c')](respondWithStatusCode(_0x162eb1,null))['catch'](handleError(_0x162eb1,null));};exports[_0xea32('0xdd')]=function(_0x4f8f4c,_0x5287b0,_0x4acad7){var _0x1d38f9={};var _0x41277b={};var _0x27fbc5;var _0x5765c5;return db['SmsAccount'][_0xea32('0x5e')]({'where':{'id':_0x4f8f4c[_0xea32('0x50')]['id']}})[_0xea32('0x1c')](handleEntityNotFound(_0x5287b0,null))[_0xea32('0x1c')](function(_0x4cdfc1){if(_0x4cdfc1){_0x27fbc5=_0x4cdfc1;_0x41277b[_0xea32('0x3b')]=_[_0xea32('0x3e')](db[_0xea32('0xde')]['rawAttributes']);_0x41277b[_0xea32('0x3d')]=_['keys'](_0x4f8f4c[_0xea32('0x3d')]);_0x41277b[_0xea32('0x47')]=_[_0xea32('0x3f')](_0x41277b[_0xea32('0x3b')],_0x41277b[_0xea32('0x3d')]);_0x1d38f9[_0xea32('0x41')]=_['intersection'](_0x41277b[_0xea32('0x3b')],qs[_0xea32('0x40')](_0x4f8f4c[_0xea32('0x3d')]['fields']));_0x1d38f9[_0xea32('0x41')]=_0x1d38f9[_0xea32('0x41')][_0xea32('0x42')]?_0x1d38f9[_0xea32('0x41')]:_0x41277b[_0xea32('0x3b')];_0x1d38f9[_0xea32('0x44')]=qs[_0xea32('0x45')](_0x4f8f4c['query'][_0xea32('0x45')]);_0x1d38f9[_0xea32('0x46')]=qs[_0xea32('0x47')](_[_0xea32('0x48')](_0x4f8f4c[_0xea32('0x3d')],_0x41277b['filters']));if(_0x4f8f4c[_0xea32('0x3d')]['filter']){_0x1d38f9['where']=_[_0xea32('0x4a')](_0x1d38f9[_0xea32('0x46')],{'$or':_['map'](_0x1d38f9[_0xea32('0x41')],function(_0x52f508){var _0xb6dbc2={};_0xb6dbc2[_0x52f508]={'$like':'%'+_0x4f8f4c['query'][_0xea32('0x49')]+'%'};return _0xb6dbc2;})});}_0x1d38f9=_['merge']({},_0x1d38f9,_0x4f8f4c['options']);return _0x27fbc5[_0xea32('0xdd')](_0x1d38f9);}})['then'](function(_0x5308cd){if(_0x5308cd){_0x5765c5=_0x5308cd[_0xea32('0x42')];if(!_0x4f8f4c[_0xea32('0x3d')][_0xea32('0x43')]('nolimit')){_0x1d38f9[_0xea32('0x2c')]=qs['limit'](_0x4f8f4c[_0xea32('0x3d')][_0xea32('0x2c')]);_0x1d38f9['offset']=qs[_0xea32('0x29')](_0x4f8f4c[_0xea32('0x3d')][_0xea32('0x29')]);}return _0x27fbc5['getAgents'](_0x1d38f9);}})[_0xea32('0x1c')](function(_0x5b1a99){if(_0x5b1a99){return _0x5b1a99?{'count':_0x5765c5,'rows':_0x5b1a99}:null;}})['then'](respondWithResult(_0x5287b0,null))['catch'](handleError(_0x5287b0,null));}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.events.js b/server/api/smsAccount/smsAccount.events.js index 44734e8..933ff35 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 _0x7c94=['hook','exports','events','SmsAccount','setMaxListeners','update','remove'];(function(_0x413feb,_0x10477f){var _0x40ee88=function(_0x32a3f6){while(--_0x32a3f6){_0x413feb['push'](_0x413feb['shift']());}};_0x40ee88(++_0x10477f);}(_0x7c94,0x1de));var _0x47c9=function(_0x37a59a,_0x24f4fd){_0x37a59a=_0x37a59a-0x0;var _0x490f97=_0x7c94[_0x37a59a];return _0x490f97;};'use strict';var EventEmitter=require(_0x47c9('0x0'));var SmsAccount=require('../../mysqldb')['db'][_0x47c9('0x1')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0x47c9('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x47c9('0x3'),'afterDestroy':_0x47c9('0x4')};function emitEvent(_0x45b10b){return function(_0x38c33e,_0x32c7b1,_0x1e8277){SmsAccountEvents['emit'](_0x45b10b+':'+_0x38c33e['id'],_0x38c33e);SmsAccountEvents['emit'](_0x45b10b,_0x38c33e);_0x1e8277(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsAccount[_0x47c9('0x5')](e,emitEvent(event));}}module[_0x47c9('0x6')]=SmsAccountEvents; \ No newline at end of file +var _0xf604=['setMaxListeners','save','update','emit','hasOwnProperty','hook','events','../../mysqldb','SmsAccount'];(function(_0x5f0089,_0x227e2c){var _0x193892=function(_0x24051f){while(--_0x24051f){_0x5f0089['push'](_0x5f0089['shift']());}};_0x193892(++_0x227e2c);}(_0xf604,0x1a4));var _0x4f60=function(_0x206f02,_0x36f322){_0x206f02=_0x206f02-0x0;var _0x8a2663=_0xf604[_0x206f02];return _0x8a2663;};'use strict';var EventEmitter=require(_0x4f60('0x0'));var SmsAccount=require(_0x4f60('0x1'))['db'][_0x4f60('0x2')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0x4f60('0x3')](0x0);var events={'afterCreate':_0x4f60('0x4'),'afterUpdate':_0x4f60('0x5'),'afterDestroy':'remove'};function emitEvent(_0x514ef6){return function(_0x307fa8,_0x10c144,_0x2084ea){SmsAccountEvents[_0x4f60('0x6')](_0x514ef6+':'+_0x307fa8['id'],_0x307fa8);SmsAccountEvents[_0x4f60('0x6')](_0x514ef6,_0x307fa8);_0x2084ea(null);};}for(var e in events){if(events[_0x4f60('0x7')](e)){var event=events[e];SmsAccount[_0x4f60('0x8')](e,emitEvent(event));}}module['exports']=SmsAccountEvents; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.model.js b/server/api/smsAccount/smsAccount.model.js index c1a2132..42ef878 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 _0xbc0d=['util','bluebird','request-promise','path','rimraf','./smsAccount.attributes','exports','define','SmsAccount','sms_accounts','lodash'];(function(_0xed0e27,_0x3fc087){var _0x12a386=function(_0x2edb3e){while(--_0x2edb3e){_0xed0e27['push'](_0xed0e27['shift']());}};_0x12a386(++_0x3fc087);}(_0xbc0d,0x11d));var _0xdbc0=function(_0x4aa838,_0x4aa14f){_0x4aa838=_0x4aa838-0x0;var _0x3abff0=_0xbc0d[_0x4aa838];return _0x3abff0;};'use strict';var _=require(_0xdbc0('0x0'));var util=require(_0xdbc0('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xdbc0('0x2'));var rp=require(_0xdbc0('0x3'));var fs=require('fs');var path=require(_0xdbc0('0x4'));var rimraf=require(_0xdbc0('0x5'));var config=require('../../config/environment');var attributes=require(_0xdbc0('0x6'));module[_0xdbc0('0x7')]=function(_0x1e3e89,_0xec5312){return _0x1e3e89[_0xdbc0('0x8')](_0xdbc0('0x9'),attributes,{'tableName':_0xdbc0('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x44d9=['lodash','util','../../config/logger','api','moment','path','rimraf','./smsAccount.attributes','define','SmsAccount','sms_accounts'];(function(_0x2e6c19,_0x131233){var _0x52885d=function(_0x38f224){while(--_0x38f224){_0x2e6c19['push'](_0x2e6c19['shift']());}};_0x52885d(++_0x131233);}(_0x44d9,0x155));var _0x944d=function(_0x6e9211,_0x320422){_0x6e9211=_0x6e9211-0x0;var _0x448207=_0x44d9[_0x6e9211];return _0x448207;};'use strict';var _=require(_0x944d('0x0'));var util=require(_0x944d('0x1'));var logger=require(_0x944d('0x2'))(_0x944d('0x3'));var moment=require(_0x944d('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x944d('0x5'));var rimraf=require(_0x944d('0x6'));var config=require('../../config/environment');var attributes=require(_0x944d('0x7'));module['exports']=function(_0x2aed10,_0x377950){return _0x2aed10[_0x944d('0x8')](_0x944d('0x9'),attributes,{'tableName':_0x944d('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.rpc.js b/server/api/smsAccount/smsAccount.rpc.js index 61280a8..e2e7d37 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 _0x6fa2=['error','code','message','catch','ShowSmsAccount','SmsAccount','find','options','where','map','include','model','attributes','stringify','lodash','util','moment','randomstring','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./smsAccount.socket','register','request','then','info','SmsAccount,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x3bd09f,_0x177165){var _0x4ecce9=function(_0x41a69d){while(--_0x41a69d){_0x3bd09f['push'](_0x3bd09f['shift']());}};_0x4ecce9(++_0x177165);}(_0x6fa2,0x7a));var _0x26fa=function(_0x53ccf2,_0x13cb67){_0x53ccf2=_0x53ccf2-0x0;var _0x5a2964=_0x6fa2[_0x53ccf2];return _0x5a2964;};'use strict';var _=require(_0x26fa('0x0'));var util=require(_0x26fa('0x1'));var moment=require(_0x26fa('0x2'));var BPromise=require('bluebird');var rs=require(_0x26fa('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x26fa('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x26fa('0x5'))(_0x26fa('0x6'));var config=require('../../config/environment');var jayson=require(_0x26fa('0x7'));var client=jayson[_0x26fa('0x8')][_0x26fa('0x9')]({'port':0x232a});config['redis']=_[_0x26fa('0xa')](config[_0x26fa('0xb')],{'host':_0x26fa('0xc'),'port':0x18eb});var socket=require(_0x26fa('0xd'))(new Redis(config[_0x26fa('0xb')]));require(_0x26fa('0xe'))[_0x26fa('0xf')](socket);function respondWithRpcPromise(_0x567218,_0x4bee88,_0x33d56b){return new BPromise(function(_0x28a57a,_0x22164d){return client[_0x26fa('0x10')](_0x567218,_0x33d56b)[_0x26fa('0x11')](function(_0x303921){logger[_0x26fa('0x12')](_0x26fa('0x13'),_0x4bee88,_0x26fa('0x14'));logger[_0x26fa('0x15')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x4bee88,'request\x20sent',JSON['stringify'](_0x303921));if(_0x303921['error']){if(_0x303921[_0x26fa('0x16')][_0x26fa('0x17')]===0x1f4){logger['error'](_0x26fa('0x13'),_0x4bee88,_0x303921[_0x26fa('0x16')]['message']);return _0x22164d(_0x303921[_0x26fa('0x16')][_0x26fa('0x18')]);}logger[_0x26fa('0x16')](_0x26fa('0x13'),_0x4bee88,_0x303921['error'][_0x26fa('0x18')]);return _0x28a57a(_0x303921['error'][_0x26fa('0x18')]);}else{logger[_0x26fa('0x12')](_0x26fa('0x13'),_0x4bee88,_0x26fa('0x14'));_0x28a57a(_0x303921['result'][_0x26fa('0x18')]);}})[_0x26fa('0x19')](function(_0xba188){logger['error'](_0x26fa('0x13'),_0x4bee88,_0xba188);_0x22164d(_0xba188);});});}exports[_0x26fa('0x1a')]=function(_0x2b56da){var _0x40bffe=this;return new Promise(function(_0x791f72,_0x5bb8fd){return db[_0x26fa('0x1b')][_0x26fa('0x1c')]({'raw':_0x2b56da[_0x26fa('0x1d')]?_0x2b56da['options']['raw']===undefined?!![]:![]:!![],'where':_0x2b56da[_0x26fa('0x1d')]?_0x2b56da[_0x26fa('0x1d')][_0x26fa('0x1e')]||null:null,'attributes':_0x2b56da[_0x26fa('0x1d')]?_0x2b56da[_0x26fa('0x1d')]['attributes']||null:null,'include':_0x2b56da[_0x26fa('0x1d')]?_0x2b56da[_0x26fa('0x1d')]['include']?_[_0x26fa('0x1f')](_0x2b56da[_0x26fa('0x1d')][_0x26fa('0x20')],function(_0x315210){return{'model':db[_0x315210[_0x26fa('0x21')]],'as':_0x315210['as'],'attributes':_0x315210['attributes'],'include':_0x315210[_0x26fa('0x20')]?_['map'](_0x315210[_0x26fa('0x20')],function(_0x4eb324){return{'model':db[_0x4eb324[_0x26fa('0x21')]],'as':_0x4eb324['as'],'attributes':_0x4eb324[_0x26fa('0x22')],'include':_0x4eb324['include']?_[_0x26fa('0x1f')](_0x4eb324[_0x26fa('0x20')],function(_0x5f16c5){return{'model':db[_0x5f16c5['model']],'as':_0x5f16c5['as'],'attributes':_0x5f16c5[_0x26fa('0x22')]};}):[]};}):[]};}):[]:[]})[_0x26fa('0x11')](function(_0x1c4fd0){logger['info'](_0x26fa('0x1a'),_0x2b56da);logger[_0x26fa('0x15')](_0x26fa('0x1a'),_0x2b56da,JSON[_0x26fa('0x23')](_0x1c4fd0));_0x791f72(_0x1c4fd0);})[_0x26fa('0x19')](function(_0x70b220){logger[_0x26fa('0x16')](_0x26fa('0x1a'),_0x70b220[_0x26fa('0x18')],_0x2b56da);_0x5bb8fd(_0x40bffe[_0x26fa('0x16')](0x1f4,_0x70b220[_0x26fa('0x18')]));});});}; \ No newline at end of file +var _0x5a9b=['rpc','../../config/environment','http','defaults','redis','localhost','./smsAccount.socket','request','then','SmsAccount,\x20%s,\x20%s','request\x20sent','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','ShowSmsAccount','SmsAccount','find','options','raw','where','attributes','include','map','model','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x2f5ac5,_0x1ee939){var _0x37c9a8=function(_0x15031f){while(--_0x15031f){_0x2f5ac5['push'](_0x2f5ac5['shift']());}};_0x37c9a8(++_0x1ee939);}(_0x5a9b,0x157));var _0xb5a9=function(_0x59f4a5,_0x5d4944){_0x59f4a5=_0x59f4a5-0x0;var _0x38f1a7=_0x5a9b[_0x59f4a5];return _0x38f1a7;};'use strict';var _=require('lodash');var util=require(_0xb5a9('0x0'));var moment=require(_0xb5a9('0x1'));var BPromise=require(_0xb5a9('0x2'));var rs=require(_0xb5a9('0x3'));var fs=require('fs');var Redis=require(_0xb5a9('0x4'));var db=require(_0xb5a9('0x5'))['db'];var utils=require(_0xb5a9('0x6'));var logger=require('../../config/logger')(_0xb5a9('0x7'));var config=require(_0xb5a9('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0xb5a9('0x9')]({'port':0x232a});config['redis']=_[_0xb5a9('0xa')](config[_0xb5a9('0xb')],{'host':_0xb5a9('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xb5a9('0xb')]));require(_0xb5a9('0xd'))['register'](socket);function respondWithRpcPromise(_0x26de82,_0x51fca2,_0x32f46d){return new BPromise(function(_0x4281d0,_0x2b2b81){return client[_0xb5a9('0xe')](_0x26de82,_0x32f46d)[_0xb5a9('0xf')](function(_0x557393){logger['info'](_0xb5a9('0x10'),_0x51fca2,_0xb5a9('0x11'));logger['debug'](_0xb5a9('0x12'),_0x51fca2,_0xb5a9('0x11'),JSON[_0xb5a9('0x13')](_0x557393));if(_0x557393[_0xb5a9('0x14')]){if(_0x557393['error']['code']===0x1f4){logger['error']('SmsAccount,\x20%s,\x20%s',_0x51fca2,_0x557393[_0xb5a9('0x14')][_0xb5a9('0x15')]);return _0x2b2b81(_0x557393[_0xb5a9('0x14')][_0xb5a9('0x15')]);}logger[_0xb5a9('0x14')](_0xb5a9('0x10'),_0x51fca2,_0x557393['error']['message']);return _0x4281d0(_0x557393[_0xb5a9('0x14')][_0xb5a9('0x15')]);}else{logger[_0xb5a9('0x16')]('SmsAccount,\x20%s,\x20%s',_0x51fca2,_0xb5a9('0x11'));_0x4281d0(_0x557393[_0xb5a9('0x17')][_0xb5a9('0x15')]);}})[_0xb5a9('0x18')](function(_0x1ddf30){logger[_0xb5a9('0x14')](_0xb5a9('0x10'),_0x51fca2,_0x1ddf30);_0x2b2b81(_0x1ddf30);});});}exports[_0xb5a9('0x19')]=function(_0x4edeb8){var _0x545f50=this;return new Promise(function(_0x20a6d6,_0x42f49a){return db[_0xb5a9('0x1a')][_0xb5a9('0x1b')]({'raw':_0x4edeb8[_0xb5a9('0x1c')]?_0x4edeb8[_0xb5a9('0x1c')][_0xb5a9('0x1d')]===undefined?!![]:![]:!![],'where':_0x4edeb8[_0xb5a9('0x1c')]?_0x4edeb8['options'][_0xb5a9('0x1e')]||null:null,'attributes':_0x4edeb8[_0xb5a9('0x1c')]?_0x4edeb8['options'][_0xb5a9('0x1f')]||null:null,'include':_0x4edeb8['options']?_0x4edeb8[_0xb5a9('0x1c')][_0xb5a9('0x20')]?_[_0xb5a9('0x21')](_0x4edeb8['options'][_0xb5a9('0x20')],function(_0x53f98c){return{'model':db[_0x53f98c[_0xb5a9('0x22')]],'as':_0x53f98c['as'],'attributes':_0x53f98c[_0xb5a9('0x1f')],'include':_0x53f98c[_0xb5a9('0x20')]?_['map'](_0x53f98c[_0xb5a9('0x20')],function(_0x583706){return{'model':db[_0x583706['model']],'as':_0x583706['as'],'attributes':_0x583706[_0xb5a9('0x1f')],'include':_0x583706[_0xb5a9('0x20')]?_[_0xb5a9('0x21')](_0x583706[_0xb5a9('0x20')],function(_0x2086cf){return{'model':db[_0x2086cf[_0xb5a9('0x22')]],'as':_0x2086cf['as'],'attributes':_0x2086cf[_0xb5a9('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xb5a9('0xf')](function(_0x1cbb01){logger['info']('ShowSmsAccount',_0x4edeb8);logger['debug'](_0xb5a9('0x19'),_0x4edeb8,JSON['stringify'](_0x1cbb01));_0x20a6d6(_0x1cbb01);})[_0xb5a9('0x18')](function(_0x15e648){logger[_0xb5a9('0x14')](_0xb5a9('0x19'),_0x15e648[_0xb5a9('0x15')],_0x4edeb8);_0x42f49a(_0x545f50[_0xb5a9('0x14')](0x1f4,_0x15e648[_0xb5a9('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.socket.js b/server/api/smsAccount/smsAccount.socket.js index ef695f6..29cc429 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(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0xa9e0,0x123));var _0x0a9e=function(_0x25bea7,_0x49ab45){_0x25bea7=_0x25bea7-0x0;var _0x175952=_0xa9e0[_0x25bea7];return _0x175952;};'use strict';var SmsAccountEvents=require(_0x0a9e('0x0'));var events=[_0x0a9e('0x1'),_0x0a9e('0x2'),'update'];function createListener(_0x550fbc,_0x18d5c9){return function(_0x4ce2f1){_0x18d5c9[_0x0a9e('0x3')](_0x550fbc,_0x4ce2f1);};}function removeListener(_0x432180,_0x2ab90b){return function(){SmsAccountEvents[_0x0a9e('0x4')](_0x432180,_0x2ab90b);};}exports[_0x0a9e('0x5')]=function(_0x57b080){for(var _0x219af0=0x0,_0x441e3a=events[_0x0a9e('0x6')];_0x219af0<_0x441e3a;_0x219af0++){var _0x5f41ea=events[_0x219af0];var _0x503809=createListener(_0x0a9e('0x7')+_0x5f41ea,_0x57b080);SmsAccountEvents['on'](_0x5f41ea,_0x503809);}}; \ No newline at end of file +var _0xa9e0=['register','length','smsAccount:','./smsAccount.events','save','remove','emit','removeListener'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4baae2,_0x487ab6){_0x4baae2=_0x4baae2-0x0;var _0x1a2285=_0xa9e0[_0x4baae2];return _0x1a2285;};'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 5cb33a3..210dbdc 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(_0x2c6686,_0x99bdef){var _0x147bc6=function(_0x736ca6){while(--_0x736ca6){_0x2c6686['push'](_0x2c6686['shift']());}};_0x147bc6(++_0x99bdef);}(_0x55ca,0x126));var _0xa55c=function(_0x61bb05,_0x47421f){_0x61bb05=_0x61bb05-0x0;var _0x3ceb3e=_0x55ca[_0x61bb05];return _0x3ceb3e;};'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 _0x008c=['exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsApplication.controller','get','isAuthenticated','index','post','put','/:id'];(function(_0x30726d,_0x31ba2b){var _0x381a8d=function(_0x186093){while(--_0x186093){_0x30726d['push'](_0x30726d['shift']());}};_0x381a8d(++_0x31ba2b);}(_0x008c,0x188));var _0xc008=function(_0x40be1a,_0x13b843){_0x40be1a=_0x40be1a-0x0;var _0x4e6f36=_0x008c[_0x40be1a];return _0x4e6f36;};'use strict';var multer=require(_0xc008('0x0'));var util=require(_0xc008('0x1'));var path=require(_0xc008('0x2'));var timeout=require(_0xc008('0x3'));var express=require(_0xc008('0x4'));var router=express['Router']();var fs_extra=require(_0xc008('0x5'));var auth=require(_0xc008('0x6'));var interaction=require(_0xc008('0x7'));var config=require(_0xc008('0x8'));var controller=require(_0xc008('0x9'));router[_0xc008('0xa')]('/',auth[_0xc008('0xb')](),controller[_0xc008('0xc')]);router[_0xc008('0xa')]('/:id',auth[_0xc008('0xb')](),controller['show']);router[_0xc008('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0xc008('0xe')](_0xc008('0xf'),auth['isAuthenticated'](),controller['update']);router['delete'](_0xc008('0xf'),auth[_0xc008('0xb')](),controller['destroy']);module[_0xc008('0x10')]=router; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.attributes.js b/server/api/smsApplication/smsApplication.attributes.js index 543124a..c56f8bf 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 _0x4622=['sequelize','exports','INTEGER','STRING','noop','*,*,*,*'];(function(_0x5a776b,_0x46f785){var _0xbbef59=function(_0x38313e){while(--_0x38313e){_0x5a776b['push'](_0x5a776b['shift']());}};_0xbbef59(++_0x46f785);}(_0x4622,0x84));var _0x2462=function(_0x21549c,_0x6d64d1){_0x21549c=_0x21549c-0x0;var _0x426cbd=_0x4622[_0x21549c];return _0x426cbd;};'use strict';var Sequelize=require(_0x2462('0x0'));module[_0x2462('0x1')]={'priority':{'type':Sequelize[_0x2462('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x2462('0x3')],'allowNull':![],'defaultValue':_0x2462('0x4')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x2462('0x3')],'defaultValue':_0x2462('0x5')}}; \ No newline at end of file +var _0x8b79=['STRING','*,*,*,*','sequelize','INTEGER'];(function(_0x4add40,_0x4ef660){var _0x52a1de=function(_0x1af192){while(--_0x1af192){_0x4add40['push'](_0x4add40['shift']());}};_0x52a1de(++_0x4ef660);}(_0x8b79,0x182));var _0x98b7=function(_0x2e370b,_0x1e23dc){_0x2e370b=_0x2e370b-0x0;var _0x913368=_0x8b79[_0x2e370b];return _0x913368;};'use strict';var Sequelize=require(_0x98b7('0x0'));module['exports']={'priority':{'type':Sequelize[_0x98b7('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x98b7('0x2')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0x98b7('0x2')]},'interval':{'type':Sequelize[_0x98b7('0x2')],'defaultValue':_0x98b7('0x3')}}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.controller.js b/server/api/smsApplication/smsApplication.controller.js index 36f77a3..0bd95ac 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 _0x44d4=['update','then','end','error','stack','name','send','index','map','SmsApplication','rawAttributes','fieldName','type','query','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','offset','order','sort','where','filters','pick','filter','VIRTUAL','merge','options','includeAll','findAll','rows','catch','show','params','keys','include','find','create','body','eml-format','rimraf','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','limit','count','set','Content-Range','apply','reject','save'];(function(_0xb6e43,_0x1568fc){var _0x47c40f=function(_0x107786){while(--_0x107786){_0xb6e43['push'](_0xb6e43['shift']());}};_0x47c40f(++_0x1568fc);}(_0x44d4,0x1e0));var _0x444d=function(_0x254d93,_0x250b89){_0x254d93=_0x254d93-0x0;var _0x467a51=_0x44d4[_0x254d93];return _0x467a51;};'use strict';var emlformat=require(_0x444d('0x0'));var rimraf=require(_0x444d('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x444d('0x2'));var BPromise=require(_0x444d('0x3'));var Mustache=require(_0x444d('0x4'));var util=require(_0x444d('0x5'));var path=require('path');var sox=require(_0x444d('0x6'));var csv=require(_0x444d('0x7'));var ejs=require(_0x444d('0x8'));var fs=require('fs');var fs_extra=require(_0x444d('0x9'));var _=require(_0x444d('0xa'));var squel=require(_0x444d('0xb'));var crypto=require(_0x444d('0xc'));var jsforce=require(_0x444d('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x444d('0x7'));var querystring=require('querystring');var Papa=require(_0x444d('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x444d('0xf'));var hardwareService=require(_0x444d('0x10'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x444d('0x11'));var licenseUtil=require(_0x444d('0x12'));var db=require(_0x444d('0x13'))['db'];function respondWithStatusCode(_0x492724,_0x2506f4){_0x2506f4=_0x2506f4||0xcc;return function(_0x547a6a){if(_0x547a6a){return _0x492724[_0x444d('0x14')](_0x2506f4);}return _0x492724[_0x444d('0x15')](_0x2506f4)['end']();};}function respondWithResult(_0x362298,_0x3f9472){_0x3f9472=_0x3f9472||0xc8;return function(_0x43b4b7){if(_0x43b4b7){return _0x362298[_0x444d('0x15')](_0x3f9472)[_0x444d('0x16')](_0x43b4b7);}};}function respondWithFilteredResult(_0x2636db,_0x315abb){return function(_0x4f6b7c){if(_0x4f6b7c){var _0x148a9f=typeof _0x315abb['offset']===_0x444d('0x17')&&typeof _0x315abb[_0x444d('0x18')]===_0x444d('0x17');var _0x3e3b8c=_0x4f6b7c[_0x444d('0x19')];var _0x40ad8e=_0x148a9f?0x0:_0x315abb['offset'];var _0x3aee3d=_0x148a9f?_0x4f6b7c[_0x444d('0x19')]:_0x315abb['offset']+_0x315abb[_0x444d('0x18')];var _0x17de9e;if(_0x3aee3d>=_0x3e3b8c){_0x3aee3d=_0x3e3b8c;_0x17de9e=0xc8;}else{_0x17de9e=0xce;}_0x2636db['status'](_0x17de9e);return _0x2636db[_0x444d('0x1a')](_0x444d('0x1b'),_0x40ad8e+'-'+_0x3aee3d+'/'+_0x3e3b8c)['json'](_0x4f6b7c);}return null;};}function patchUpdates(_0x14c198){return function(_0x24ab7a){try{jsonpatch[_0x444d('0x1c')](_0x24ab7a,_0x14c198,!![]);}catch(_0x297207){return BPromise[_0x444d('0x1d')](_0x297207);}return _0x24ab7a[_0x444d('0x1e')]();};}function saveUpdates(_0x21aea0,_0x1163de){return function(_0x543b20){if(_0x543b20){return _0x543b20[_0x444d('0x1f')](_0x21aea0)['then'](function(_0x18644a){return _0x18644a;});}return null;};}function removeEntity(_0x2e09a7,_0x97b725){return function(_0x236aaf){if(_0x236aaf){return _0x236aaf['destroy']()[_0x444d('0x20')](function(){_0x2e09a7[_0x444d('0x15')](0xcc)[_0x444d('0x21')]();});}};}function handleEntityNotFound(_0x338e3d,_0x439df2){return function(_0x32a5e8){if(!_0x32a5e8){_0x338e3d[_0x444d('0x14')](0x194);}return _0x32a5e8;};}function handleError(_0x1b7f02,_0x35a905){_0x35a905=_0x35a905||0x1f4;return function(_0x4d4514){logger[_0x444d('0x22')](_0x4d4514[_0x444d('0x23')]);if(_0x4d4514[_0x444d('0x24')]){delete _0x4d4514['name'];}_0x1b7f02['status'](_0x35a905)[_0x444d('0x25')](_0x4d4514);};}exports[_0x444d('0x26')]=function(_0x2db231,_0x58fc95){var _0x418cfd={},_0x811b05={},_0x1b6ab3={'count':0x0,'rows':[]};var _0x40f55e=_[_0x444d('0x27')](db[_0x444d('0x28')][_0x444d('0x29')],function(_0x16cef4){return{'name':_0x16cef4[_0x444d('0x2a')],'type':_0x16cef4[_0x444d('0x2b')]['key']};});_0x811b05['model']=_['map'](_0x40f55e,_0x444d('0x24'));_0x811b05[_0x444d('0x2c')]=_['keys'](_0x2db231[_0x444d('0x2c')]);_0x811b05['filters']=_[_0x444d('0x2d')](_0x811b05[_0x444d('0x2e')],_0x811b05[_0x444d('0x2c')]);_0x418cfd[_0x444d('0x2f')]=_[_0x444d('0x2d')](_0x811b05[_0x444d('0x2e')],qs[_0x444d('0x30')](_0x2db231[_0x444d('0x2c')][_0x444d('0x30')]));_0x418cfd[_0x444d('0x2f')]=_0x418cfd[_0x444d('0x2f')][_0x444d('0x31')]?_0x418cfd[_0x444d('0x2f')]:_0x811b05[_0x444d('0x2e')];if(!_0x2db231[_0x444d('0x2c')][_0x444d('0x32')](_0x444d('0x33'))){_0x418cfd['limit']=qs[_0x444d('0x18')](_0x2db231[_0x444d('0x2c')][_0x444d('0x18')]);_0x418cfd['offset']=qs[_0x444d('0x34')](_0x2db231[_0x444d('0x2c')][_0x444d('0x34')]);}_0x418cfd[_0x444d('0x35')]=qs[_0x444d('0x36')](_0x2db231[_0x444d('0x2c')][_0x444d('0x36')]);_0x418cfd[_0x444d('0x37')]=qs[_0x444d('0x38')](_[_0x444d('0x39')](_0x2db231[_0x444d('0x2c')],_0x811b05[_0x444d('0x38')]),_0x40f55e);if(_0x2db231[_0x444d('0x2c')][_0x444d('0x3a')]){_0x418cfd[_0x444d('0x37')]=_['merge'](_0x418cfd['where'],{'$or':_[_0x444d('0x27')](_0x40f55e,function(_0x3a8a65){if(_0x3a8a65['type']!==_0x444d('0x3b')){var _0x548e2d={};_0x548e2d[_0x3a8a65[_0x444d('0x24')]]={'$like':'%'+_0x2db231['query'][_0x444d('0x3a')]+'%'};return _0x548e2d;}})});}_0x418cfd=_[_0x444d('0x3c')]({},_0x418cfd,_0x2db231[_0x444d('0x3d')]);var _0x4f08fe={'where':_0x418cfd['where']};return db[_0x444d('0x28')][_0x444d('0x19')](_0x4f08fe)[_0x444d('0x20')](function(_0xd58522){_0x1b6ab3[_0x444d('0x19')]=_0xd58522;if(_0x2db231[_0x444d('0x2c')][_0x444d('0x3e')]){_0x418cfd['include']=[{'all':!![]}];}return db['SmsApplication'][_0x444d('0x3f')](_0x418cfd);})[_0x444d('0x20')](function(_0x2c9c64){_0x1b6ab3[_0x444d('0x40')]=_0x2c9c64;return _0x1b6ab3;})['then'](respondWithFilteredResult(_0x58fc95,_0x418cfd))[_0x444d('0x41')](handleError(_0x58fc95,null));};exports[_0x444d('0x42')]=function(_0x3e824d,_0x55b1f4){var _0x14228b={'raw':!![],'where':{'id':_0x3e824d[_0x444d('0x43')]['id']}},_0x412b09={};_0x412b09[_0x444d('0x2e')]=_['keys'](db[_0x444d('0x28')][_0x444d('0x29')]);_0x412b09['query']=_[_0x444d('0x44')](_0x3e824d[_0x444d('0x2c')]);_0x412b09['filters']=_[_0x444d('0x2d')](_0x412b09['model'],_0x412b09[_0x444d('0x2c')]);_0x14228b[_0x444d('0x2f')]=_['intersection'](_0x412b09['model'],qs[_0x444d('0x30')](_0x3e824d[_0x444d('0x2c')]['fields']));_0x14228b[_0x444d('0x2f')]=_0x14228b['attributes'][_0x444d('0x31')]?_0x14228b[_0x444d('0x2f')]:_0x412b09[_0x444d('0x2e')];if(_0x3e824d[_0x444d('0x2c')][_0x444d('0x3e')]){_0x14228b[_0x444d('0x45')]=[{'all':!![]}];}_0x14228b=_[_0x444d('0x3c')]({},_0x14228b,_0x3e824d['options']);return db['SmsApplication'][_0x444d('0x46')](_0x14228b)[_0x444d('0x20')](handleEntityNotFound(_0x55b1f4,null))[_0x444d('0x20')](respondWithResult(_0x55b1f4,null))['catch'](handleError(_0x55b1f4,null));};exports['create']=function(_0x238bc0,_0x3f2230){return db[_0x444d('0x28')][_0x444d('0x47')](_0x238bc0['body'],{})[_0x444d('0x20')](respondWithResult(_0x3f2230,0xc9))[_0x444d('0x41')](handleError(_0x3f2230,null));};exports['update']=function(_0x1cc534,_0x2054c5){if(_0x1cc534[_0x444d('0x48')]['id']){delete _0x1cc534[_0x444d('0x48')]['id'];}return db[_0x444d('0x28')][_0x444d('0x46')]({'where':{'id':_0x1cc534[_0x444d('0x43')]['id']}})[_0x444d('0x20')](handleEntityNotFound(_0x2054c5,null))[_0x444d('0x20')](saveUpdates(_0x1cc534[_0x444d('0x48')],null))[_0x444d('0x20')](respondWithResult(_0x2054c5,null))[_0x444d('0x41')](handleError(_0x2054c5,null));};exports['destroy']=function(_0xde1d0e,_0x2ed70e){return db[_0x444d('0x28')][_0x444d('0x46')]({'where':{'id':_0xde1d0e[_0x444d('0x43')]['id']}})['then'](handleEntityNotFound(_0x2ed70e,null))['then'](removeEntity(_0x2ed70e,null))[_0x444d('0x41')](handleError(_0x2ed70e,null));}; \ No newline at end of file +var _0x94a8=['sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','show','params','rawAttributes','intersection','catch','create','body','find','destroy','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','squel','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','sendStatus','status','end','offset','undefined','count','limit','set','Content-Range','reject','update','then','error','name','send','SmsApplication','type','key','model','map','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit'];(function(_0x52b52b,_0x109b5e){var _0xe4a7cb=function(_0x4b693d){while(--_0x4b693d){_0x52b52b['push'](_0x52b52b['shift']());}};_0xe4a7cb(++_0x109b5e);}(_0x94a8,0x16c));var _0x894a=function(_0x2cf2e9,_0xd58ea1){_0x2cf2e9=_0x2cf2e9-0x0;var _0xd3670d=_0x94a8[_0x2cf2e9];return _0xd3670d;};'use strict';var emlformat=require(_0x894a('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x894a('0x1'));var jsonpatch=require(_0x894a('0x2'));var rp=require(_0x894a('0x3'));var moment=require(_0x894a('0x4'));var BPromise=require(_0x894a('0x5'));var Mustache=require(_0x894a('0x6'));var util=require('util');var path=require(_0x894a('0x7'));var sox=require(_0x894a('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x894a('0x9'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x894a('0xa'));var toCsv=require('to-csv');var querystring=require(_0x894a('0xb'));var Papa=require(_0x894a('0xc'));var Redis=require('ioredis');var authService=require(_0x894a('0xd'));var qs=require(_0x894a('0xe'));var as=require(_0x894a('0xf'));var hardwareService=require(_0x894a('0x10'));var logger=require(_0x894a('0x11'))(_0x894a('0x12'));var utils=require('../../config/utils');var config=require(_0x894a('0x13'));var licenseUtil=require(_0x894a('0x14'));var db=require(_0x894a('0x15'))['db'];function respondWithStatusCode(_0x304a8c,_0x5e0be8){_0x5e0be8=_0x5e0be8||0xcc;return function(_0x370bc6){if(_0x370bc6){return _0x304a8c[_0x894a('0x16')](_0x5e0be8);}return _0x304a8c[_0x894a('0x17')](_0x5e0be8)[_0x894a('0x18')]();};}function respondWithResult(_0x2907e2,_0x5dc327){_0x5dc327=_0x5dc327||0xc8;return function(_0x288323){if(_0x288323){return _0x2907e2[_0x894a('0x17')](_0x5dc327)['json'](_0x288323);}};}function respondWithFilteredResult(_0x51eaf8,_0x2a62a2){return function(_0x4244c6){if(_0x4244c6){var _0x3f318a=typeof _0x2a62a2[_0x894a('0x19')]===_0x894a('0x1a')&&typeof _0x2a62a2['limit']===_0x894a('0x1a');var _0x43e09d=_0x4244c6['count'];var _0x218eae=_0x3f318a?0x0:_0x2a62a2[_0x894a('0x19')];var _0x2713eb=_0x3f318a?_0x4244c6[_0x894a('0x1b')]:_0x2a62a2[_0x894a('0x19')]+_0x2a62a2[_0x894a('0x1c')];var _0x867562;if(_0x2713eb>=_0x43e09d){_0x2713eb=_0x43e09d;_0x867562=0xc8;}else{_0x867562=0xce;}_0x51eaf8[_0x894a('0x17')](_0x867562);return _0x51eaf8[_0x894a('0x1d')](_0x894a('0x1e'),_0x218eae+'-'+_0x2713eb+'/'+_0x43e09d)['json'](_0x4244c6);}return null;};}function patchUpdates(_0x2f7abc){return function(_0xfb7216){try{jsonpatch['apply'](_0xfb7216,_0x2f7abc,!![]);}catch(_0x36059f){return BPromise[_0x894a('0x1f')](_0x36059f);}return _0xfb7216['save']();};}function saveUpdates(_0x2ed35b,_0x50de63){return function(_0x17602a){if(_0x17602a){return _0x17602a[_0x894a('0x20')](_0x2ed35b)[_0x894a('0x21')](function(_0x33fcce){return _0x33fcce;});}return null;};}function removeEntity(_0x5eb2fc,_0x444fcf){return function(_0x18f9cb){if(_0x18f9cb){return _0x18f9cb['destroy']()[_0x894a('0x21')](function(){_0x5eb2fc[_0x894a('0x17')](0xcc)[_0x894a('0x18')]();});}};}function handleEntityNotFound(_0x5597d0,_0x48ef21){return function(_0x586106){if(!_0x586106){_0x5597d0[_0x894a('0x16')](0x194);}return _0x586106;};}function handleError(_0x4c6d3e,_0x14921b){_0x14921b=_0x14921b||0x1f4;return function(_0x161845){logger[_0x894a('0x22')](_0x161845['stack']);if(_0x161845[_0x894a('0x23')]){delete _0x161845['name'];}_0x4c6d3e[_0x894a('0x17')](_0x14921b)[_0x894a('0x24')](_0x161845);};}exports['index']=function(_0x16bfcb,_0x5dba76){var _0x215f86={},_0x56b382={},_0x167fc7={'count':0x0,'rows':[]};var _0x142aa9=_['map'](db[_0x894a('0x25')]['rawAttributes'],function(_0x4b67b1){return{'name':_0x4b67b1['fieldName'],'type':_0x4b67b1[_0x894a('0x26')][_0x894a('0x27')]};});_0x56b382[_0x894a('0x28')]=_[_0x894a('0x29')](_0x142aa9,_0x894a('0x23'));_0x56b382[_0x894a('0x2a')]=_[_0x894a('0x2b')](_0x16bfcb['query']);_0x56b382[_0x894a('0x2c')]=_['intersection'](_0x56b382[_0x894a('0x28')],_0x56b382[_0x894a('0x2a')]);_0x215f86[_0x894a('0x2d')]=_['intersection'](_0x56b382['model'],qs[_0x894a('0x2e')](_0x16bfcb[_0x894a('0x2a')]['fields']));_0x215f86[_0x894a('0x2d')]=_0x215f86[_0x894a('0x2d')][_0x894a('0x2f')]?_0x215f86[_0x894a('0x2d')]:_0x56b382[_0x894a('0x28')];if(!_0x16bfcb[_0x894a('0x2a')][_0x894a('0x30')](_0x894a('0x31'))){_0x215f86[_0x894a('0x1c')]=qs[_0x894a('0x1c')](_0x16bfcb[_0x894a('0x2a')][_0x894a('0x1c')]);_0x215f86[_0x894a('0x19')]=qs['offset'](_0x16bfcb[_0x894a('0x2a')][_0x894a('0x19')]);}_0x215f86['order']=qs['sort'](_0x16bfcb[_0x894a('0x2a')][_0x894a('0x32')]);_0x215f86[_0x894a('0x33')]=qs[_0x894a('0x2c')](_[_0x894a('0x34')](_0x16bfcb[_0x894a('0x2a')],_0x56b382[_0x894a('0x2c')]),_0x142aa9);if(_0x16bfcb[_0x894a('0x2a')][_0x894a('0x35')]){_0x215f86[_0x894a('0x33')]=_['merge'](_0x215f86['where'],{'$or':_[_0x894a('0x29')](_0x142aa9,function(_0x1d86bc){if(_0x1d86bc[_0x894a('0x26')]!=='VIRTUAL'){var _0xd67c16={};_0xd67c16[_0x1d86bc[_0x894a('0x23')]]={'$like':'%'+_0x16bfcb[_0x894a('0x2a')]['filter']+'%'};return _0xd67c16;}})});}_0x215f86=_[_0x894a('0x36')]({},_0x215f86,_0x16bfcb[_0x894a('0x37')]);var _0x19c8f4={'where':_0x215f86[_0x894a('0x33')]};return db[_0x894a('0x25')][_0x894a('0x1b')](_0x19c8f4)[_0x894a('0x21')](function(_0x28a576){_0x167fc7['count']=_0x28a576;if(_0x16bfcb['query'][_0x894a('0x38')]){_0x215f86[_0x894a('0x39')]=[{'all':!![]}];}return db['SmsApplication'][_0x894a('0x3a')](_0x215f86);})[_0x894a('0x21')](function(_0x8f41cd){_0x167fc7[_0x894a('0x3b')]=_0x8f41cd;return _0x167fc7;})[_0x894a('0x21')](respondWithFilteredResult(_0x5dba76,_0x215f86))['catch'](handleError(_0x5dba76,null));};exports[_0x894a('0x3c')]=function(_0x24c0a8,_0x5544bc){var _0x49041a={'raw':!![],'where':{'id':_0x24c0a8[_0x894a('0x3d')]['id']}},_0x1a0fce={};_0x1a0fce[_0x894a('0x28')]=_['keys'](db[_0x894a('0x25')][_0x894a('0x3e')]);_0x1a0fce['query']=_[_0x894a('0x2b')](_0x24c0a8[_0x894a('0x2a')]);_0x1a0fce[_0x894a('0x2c')]=_[_0x894a('0x3f')](_0x1a0fce[_0x894a('0x28')],_0x1a0fce[_0x894a('0x2a')]);_0x49041a[_0x894a('0x2d')]=_[_0x894a('0x3f')](_0x1a0fce[_0x894a('0x28')],qs[_0x894a('0x2e')](_0x24c0a8[_0x894a('0x2a')]['fields']));_0x49041a[_0x894a('0x2d')]=_0x49041a['attributes'][_0x894a('0x2f')]?_0x49041a[_0x894a('0x2d')]:_0x1a0fce[_0x894a('0x28')];if(_0x24c0a8[_0x894a('0x2a')]['includeAll']){_0x49041a[_0x894a('0x39')]=[{'all':!![]}];}_0x49041a=_[_0x894a('0x36')]({},_0x49041a,_0x24c0a8[_0x894a('0x37')]);return db[_0x894a('0x25')]['find'](_0x49041a)['then'](handleEntityNotFound(_0x5544bc,null))[_0x894a('0x21')](respondWithResult(_0x5544bc,null))[_0x894a('0x40')](handleError(_0x5544bc,null));};exports[_0x894a('0x41')]=function(_0xd2d6ce,_0x49fc86){return db[_0x894a('0x25')][_0x894a('0x41')](_0xd2d6ce['body'],{})[_0x894a('0x21')](respondWithResult(_0x49fc86,0xc9))['catch'](handleError(_0x49fc86,null));};exports[_0x894a('0x20')]=function(_0x186656,_0x3bb759){if(_0x186656[_0x894a('0x42')]['id']){delete _0x186656[_0x894a('0x42')]['id'];}return db[_0x894a('0x25')][_0x894a('0x43')]({'where':{'id':_0x186656[_0x894a('0x3d')]['id']}})[_0x894a('0x21')](handleEntityNotFound(_0x3bb759,null))[_0x894a('0x21')](saveUpdates(_0x186656[_0x894a('0x42')],null))[_0x894a('0x21')](respondWithResult(_0x3bb759,null))[_0x894a('0x40')](handleError(_0x3bb759,null));};exports[_0x894a('0x44')]=function(_0x4c2eb7,_0x10cd39){return db[_0x894a('0x25')][_0x894a('0x43')]({'where':{'id':_0x4c2eb7[_0x894a('0x3d')]['id']}})[_0x894a('0x21')](handleEntityNotFound(_0x10cd39,null))[_0x894a('0x21')](removeEntity(_0x10cd39,null))['catch'](handleError(_0x10cd39,null));}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.model.js b/server/api/smsApplication/smsApplication.model.js index c38a43d..f13638d 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 _0xcdbb=['path','rimraf','../../config/environment','./smsApplication.attributes','exports','define','SmsApplication','sms_applications','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x32be82,_0x21b592){var _0x35aa04=function(_0x3d59ca){while(--_0x3d59ca){_0x32be82['push'](_0x32be82['shift']());}};_0x35aa04(++_0x21b592);}(_0xcdbb,0x1f2));var _0xbcdb=function(_0x5c4c46,_0x12e564){_0x5c4c46=_0x5c4c46-0x0;var _0x318cb4=_0xcdbb[_0x5c4c46];return _0x318cb4;};'use strict';var _=require('lodash');var util=require(_0xbcdb('0x0'));var logger=require(_0xbcdb('0x1'))(_0xbcdb('0x2'));var moment=require(_0xbcdb('0x3'));var BPromise=require(_0xbcdb('0x4'));var rp=require(_0xbcdb('0x5'));var fs=require('fs');var path=require(_0xbcdb('0x6'));var rimraf=require(_0xbcdb('0x7'));var config=require(_0xbcdb('0x8'));var attributes=require(_0xbcdb('0x9'));module[_0xbcdb('0xa')]=function(_0x50c4b1,_0x5cd500){return _0x50c4b1[_0xbcdb('0xb')](_0xbcdb('0xc'),attributes,{'tableName':_0xbcdb('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x36f4=['../../config/logger','api','moment','bluebird','rimraf','../../config/environment','./smsApplication.attributes','exports','define','sms_applications','utf8mb4_unicode_ci','util'];(function(_0x2fceb3,_0x1e08ae){var _0x3624af=function(_0x171166){while(--_0x171166){_0x2fceb3['push'](_0x2fceb3['shift']());}};_0x3624af(++_0x1e08ae);}(_0x36f4,0xb3));var _0x436f=function(_0x2cb345,_0x15d1f0){_0x2cb345=_0x2cb345-0x0;var _0x2ac76c=_0x36f4[_0x2cb345];return _0x2ac76c;};'use strict';var _=require('lodash');var util=require(_0x436f('0x0'));var logger=require(_0x436f('0x1'))(_0x436f('0x2'));var moment=require(_0x436f('0x3'));var BPromise=require(_0x436f('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x436f('0x5'));var config=require(_0x436f('0x6'));var attributes=require(_0x436f('0x7'));module[_0x436f('0x8')]=function(_0x59cfcf,_0x5f31ff){return _0x59cfcf[_0x436f('0x9')]('SmsApplication',attributes,{'tableName':_0x436f('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x436f('0xb')});}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.rpc.js b/server/api/smsApplication/smsApplication.rpc.js index b9d6ffd..cbb47a1 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 _0x677a=['message','info','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','SmsApplication,\x20%s,\x20%s','request\x20sent','SmsApplication,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x94399f,_0x2bbab2){var _0x5ef877=function(_0x16e247){while(--_0x16e247){_0x94399f['push'](_0x94399f['shift']());}};_0x5ef877(++_0x2bbab2);}(_0x677a,0xd6));var _0xa677=function(_0x14874c,_0x245bda){_0x14874c=_0x14874c-0x0;var _0x262d3a=_0x677a[_0x14874c];return _0x262d3a;};'use strict';var _=require(_0xa677('0x0'));var util=require('util');var moment=require(_0xa677('0x1'));var BPromise=require(_0xa677('0x2'));var rs=require(_0xa677('0x3'));var fs=require('fs');var Redis=require(_0xa677('0x4'));var db=require(_0xa677('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xa677('0x6'))(_0xa677('0x7'));var config=require(_0xa677('0x8'));var jayson=require(_0xa677('0x9'));var client=jayson[_0xa677('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x303092,_0x1c997f,_0x130b66){return new BPromise(function(_0x10fb5e,_0x568910){return client['request'](_0x303092,_0x130b66)['then'](function(_0x43d392){logger['info'](_0xa677('0xb'),_0x1c997f,_0xa677('0xc'));logger['debug'](_0xa677('0xd'),_0x1c997f,_0xa677('0xc'),JSON[_0xa677('0xe')](_0x43d392));if(_0x43d392[_0xa677('0xf')]){if(_0x43d392['error'][_0xa677('0x10')]===0x1f4){logger[_0xa677('0xf')](_0xa677('0xb'),_0x1c997f,_0x43d392[_0xa677('0xf')]['message']);return _0x568910(_0x43d392[_0xa677('0xf')]['message']);}logger[_0xa677('0xf')](_0xa677('0xb'),_0x1c997f,_0x43d392[_0xa677('0xf')][_0xa677('0x11')]);return _0x10fb5e(_0x43d392[_0xa677('0xf')][_0xa677('0x11')]);}else{logger[_0xa677('0x12')](_0xa677('0xb'),_0x1c997f,_0xa677('0xc'));_0x10fb5e(_0x43d392[_0xa677('0x13')][_0xa677('0x11')]);}})[_0xa677('0x14')](function(_0x37316c){logger[_0xa677('0xf')]('SmsApplication,\x20%s,\x20%s',_0x1c997f,_0x37316c);_0x568910(_0x37316c);});});} \ No newline at end of file +var _0x1775=['stringify','error','code','SmsApplication,\x20%s,\x20%s','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','debug','SmsApplication,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x377023,_0x35328a){var _0x83b351=function(_0x569bd9){while(--_0x569bd9){_0x377023['push'](_0x377023['shift']());}};_0x83b351(++_0x35328a);}(_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')]('SmsApplication,\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);});});} \ No newline at end of file diff --git a/server/api/smsInteraction/index.js b/server/api/smsInteraction/index.js index 80af1dc..ba00ad5 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 _0x7708=['removeTags','exports','multer','util','connect-timeout','../../components/interaction/service','../../config/environment','get','index','/describe','isAuthenticated','describe','/:id','show','/:id/messages','getMessages','/:id/download','post','create','addMessage','/:id/tags','tracked','sms','addTags','put','delete'];(function(_0x46e3d4,_0x34069a){var _0x20a524=function(_0x18a7dc){while(--_0x18a7dc){_0x46e3d4['push'](_0x46e3d4['shift']());}};_0x20a524(++_0x34069a);}(_0x7708,0x188));var _0x8770=function(_0x4bb66f,_0x3cd682){_0x4bb66f=_0x4bb66f-0x0;var _0xf2772f=_0x7708[_0x4bb66f];return _0xf2772f;};'use strict';var multer=require(_0x8770('0x0'));var util=require(_0x8770('0x1'));var path=require('path');var timeout=require(_0x8770('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x8770('0x3'));var config=require(_0x8770('0x4'));var controller=require('./smsInteraction.controller');router[_0x8770('0x5')]('/',auth['isAuthenticated'](),controller[_0x8770('0x6')]);router[_0x8770('0x5')](_0x8770('0x7'),auth[_0x8770('0x8')](),controller[_0x8770('0x9')]);router[_0x8770('0x5')](_0x8770('0xa'),auth['isAuthenticated'](),controller[_0x8770('0xb')]);router[_0x8770('0x5')](_0x8770('0xc'),auth['isAuthenticated'](),controller[_0x8770('0xd')]);router[_0x8770('0x5')](_0x8770('0xe'),auth[_0x8770('0x8')](),controller['download']);router[_0x8770('0xf')]('/',auth[_0x8770('0x8')](),controller[_0x8770('0x10')]);router['post'](_0x8770('0xc'),auth[_0x8770('0x8')](),controller[_0x8770('0x11')]);router[_0x8770('0xf')](_0x8770('0x12'),auth[_0x8770('0x8')](),interaction[_0x8770('0x13')](_0x8770('0x14'),'smsinteraction:addtags'),controller[_0x8770('0x15')]);router[_0x8770('0x16')]('/:id',auth[_0x8770('0x8')](),interaction['tracked'](_0x8770('0x14'),'smsinteraction:update'),controller['update']);router['delete'](_0x8770('0xa'),auth[_0x8770('0x8')](),interaction[_0x8770('0x13')](_0x8770('0x14'),'smsinteraction:destroy'),controller['destroy']);router[_0x8770('0x17')](_0x8770('0x12'),auth[_0x8770('0x8')](),controller[_0x8770('0x18')]);module[_0x8770('0x19')]=router; \ No newline at end of file +var _0x6cb4=['./smsInteraction.controller','isAuthenticated','get','/describe','describe','/:id','show','getMessages','/:id/download','create','post','/:id/messages','/:id/tags','tracked','sms','smsinteraction:addtags','addTags','put','smsinteraction:update','delete','smsinteraction:destroy','destroy','removeTags','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x2a8eca,_0x2390c2){var _0x3ec4b9=function(_0x2d3651){while(--_0x2d3651){_0x2a8eca['push'](_0x2a8eca['shift']());}};_0x3ec4b9(++_0x2390c2);}(_0x6cb4,0xff));var _0x46cb=function(_0x1a65b1,_0xba7520){_0x1a65b1=_0x1a65b1-0x0;var _0x3b86a6=_0x6cb4[_0x1a65b1];return _0x3b86a6;};'use strict';var multer=require(_0x46cb('0x0'));var util=require(_0x46cb('0x1'));var path=require(_0x46cb('0x2'));var timeout=require(_0x46cb('0x3'));var express=require(_0x46cb('0x4'));var router=express[_0x46cb('0x5')]();var fs_extra=require(_0x46cb('0x6'));var auth=require(_0x46cb('0x7'));var interaction=require(_0x46cb('0x8'));var config=require('../../config/environment');var controller=require(_0x46cb('0x9'));router['get']('/',auth[_0x46cb('0xa')](),controller['index']);router[_0x46cb('0xb')](_0x46cb('0xc'),auth[_0x46cb('0xa')](),controller[_0x46cb('0xd')]);router[_0x46cb('0xb')](_0x46cb('0xe'),auth['isAuthenticated'](),controller[_0x46cb('0xf')]);router[_0x46cb('0xb')]('/:id/messages',auth[_0x46cb('0xa')](),controller[_0x46cb('0x10')]);router['get'](_0x46cb('0x11'),auth[_0x46cb('0xa')](),controller['download']);router['post']('/',auth['isAuthenticated'](),controller[_0x46cb('0x12')]);router[_0x46cb('0x13')](_0x46cb('0x14'),auth[_0x46cb('0xa')](),controller['addMessage']);router[_0x46cb('0x13')](_0x46cb('0x15'),auth[_0x46cb('0xa')](),interaction[_0x46cb('0x16')](_0x46cb('0x17'),_0x46cb('0x18')),controller[_0x46cb('0x19')]);router[_0x46cb('0x1a')](_0x46cb('0xe'),auth[_0x46cb('0xa')](),interaction[_0x46cb('0x16')]('sms',_0x46cb('0x1b')),controller['update']);router[_0x46cb('0x1c')]('/:id',auth['isAuthenticated'](),interaction['tracked'](_0x46cb('0x17'),_0x46cb('0x1d')),controller[_0x46cb('0x1e')]);router[_0x46cb('0x1c')](_0x46cb('0x15'),auth[_0x46cb('0xa')](),controller[_0x46cb('0x1f')]);module[_0x46cb('0x20')]=router; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.attributes.js b/server/api/smsInteraction/smsInteraction.attributes.js index 0e4aaa2..643ef67 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 _0xa3e8=['exports','DATE','STRING','out','ENUM','BOOLEAN','INTEGER','sequelize','moment'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa3e8,0x127));var _0x8a3e=function(_0x5e676d,_0xb9f623){_0x5e676d=_0x5e676d-0x0;var _0x4de7dd=_0xa3e8[_0x5e676d];return _0x4de7dd;};'use strict';var Sequelize=require(_0x8a3e('0x0'));var moment=require(_0x8a3e('0x1'));module[_0x8a3e('0x2')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x8a3e('0x3')]},'disposition':{'type':Sequelize[_0x8a3e('0x4')]},'secondDisposition':{'type':Sequelize[_0x8a3e('0x4')]},'thirdDisposition':{'type':Sequelize[_0x8a3e('0x4')]},'note':{'type':Sequelize[_0x8a3e('0x4')]},'phone':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0x8a3e('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x8a3e('0x3')]},'lastMsgDirection':{'type':Sequelize[_0x8a3e('0x6')]('in','out'),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x8a3e('0x7')],'defaultValue':![]},'queueId':{'type':Sequelize[_0x8a3e('0x8')]}}; \ No newline at end of file +var _0x6df9=['moment','BOOLEAN','STRING','DATE','out','INTEGER','sequelize'];(function(_0x525838,_0x4afad4){var _0x4d6645=function(_0x4d2921){while(--_0x4d2921){_0x525838['push'](_0x525838['shift']());}};_0x4d6645(++_0x4afad4);}(_0x6df9,0x84));var _0x96df=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x6df9[_0x397e5f];return _0x5302b8;};'use strict';var Sequelize=require(_0x96df('0x0'));var moment=require(_0x96df('0x1'));module['exports']={'closed':{'type':Sequelize[_0x96df('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x96df('0x3')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x96df('0x3')]},'phone':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0x96df('0x4')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0x96df('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x96df('0x4')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0x96df('0x5')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x96df('0x2')],'defaultValue':![]},'queueId':{'type':Sequelize[_0x96df('0x6')]}}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.controller.js b/server/api/smsInteraction/smsInteraction.controller.js index 9aa6a2d..65d8a6d 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 _0xd609=['join','User','fullname','push','CmContact','Contact','lastName','createdAt','direction','secret','SmsAccount','Owner','get','Sms','Account','N.A.','YYYY-MM-DD\x20HH:mm:ss','closedAt','disposition','Messages','out','System','firstName','value','renderFile','views','downloadInteraction.ejs','.pdf','createPdfFromHTML','log','err','rimraf','zip-dir','bluebird','ejs','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','./smsInteraction.socket','register','sendStatus','offset','limit','count','status','set','Content-Range','json','update','then','stack','name','send','index','map','SmsInteraction','rawAttributes','fieldName','type','key','getOptions','findAll','sms','query','user','catch','show','params','model','keys','filters','intersection','attributes','fields','length','includeAll','include','merge','options','find','body','destroy','describe','SmsMessage','addMessage','ids','getMessages','findOne','nolimit','order','sort','where','pick','filter','$gte','format','rows','addTags','setTags','spread','Tag','color','smsInteractionTags:save','removeTags','download','unix','toString','root','server','files','tmp','transcript-%d-%s.zip'];(function(_0x27a550,_0x34f870){var _0x103438=function(_0x720be8){while(--_0x720be8){_0x27a550['push'](_0x27a550['shift']());}};_0x103438(++_0x34f870);}(_0xd609,0x184));var _0x9d60=function(_0x34b50a,_0x5eec80){_0x34b50a=_0x34b50a-0x0;var _0x1e692b=_0xd609[_0x34b50a];return _0x1e692b;};'use strict';var rimraf=require(_0x9d60('0x0'));var zipdir=require(_0x9d60('0x1'));var moment=require('moment');var BPromise=require(_0x9d60('0x2'));var util=require('util');var path=require('path');var ejs=require(_0x9d60('0x3'));var fs=require('fs');var _=require(_0x9d60('0x4'));var Redis=require(_0x9d60('0x5'));var interaction=require(_0x9d60('0x6'));var qs=require(_0x9d60('0x7'));var pdf=require('../../components/export/pdf');var logger=require(_0x9d60('0x8'))(_0x9d60('0x9'));var config=require(_0x9d60('0xa'));var db=require(_0x9d60('0xb'))['db'];config[_0x9d60('0xc')]=_[_0x9d60('0xd')](config[_0x9d60('0xc')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x9d60('0xc')]));require(_0x9d60('0xe'))[_0x9d60('0xf')](socket);function respondWithStatusCode(_0x4b57af,_0x4b16a1){_0x4b16a1=_0x4b16a1||0xcc;return function(_0x2de4ea){if(_0x2de4ea){return _0x4b57af[_0x9d60('0x10')](_0x4b16a1);}return _0x4b57af['status'](_0x4b16a1)['end']();};}function respondWithResult(_0x5cc0e5,_0x5c9dd6){_0x5c9dd6=_0x5c9dd6||0xc8;return function(_0x1703ee){if(_0x1703ee){return _0x5cc0e5['status'](_0x5c9dd6)['json'](_0x1703ee);}};}function respondWithFilteredResult(_0x47bfc5,_0x2dc3b0){return function(_0x1f1ee9){if(_0x1f1ee9){var _0xba0d69=typeof _0x2dc3b0[_0x9d60('0x11')]==='undefined'&&typeof _0x2dc3b0[_0x9d60('0x12')]==='undefined';var _0x237067=_0x1f1ee9[_0x9d60('0x13')];var _0x1f157e=_0xba0d69?0x0:_0x2dc3b0['offset'];var _0x5041db=_0xba0d69?_0x1f1ee9[_0x9d60('0x13')]:_0x2dc3b0[_0x9d60('0x11')]+_0x2dc3b0['limit'];var _0x3787a3;if(_0x5041db>=_0x237067){_0x5041db=_0x237067;_0x3787a3=0xc8;}else{_0x3787a3=0xce;}_0x47bfc5[_0x9d60('0x14')](_0x3787a3);return _0x47bfc5[_0x9d60('0x15')](_0x9d60('0x16'),_0x1f157e+'-'+_0x5041db+'/'+_0x237067)[_0x9d60('0x17')](_0x1f1ee9);}return null;};}function saveUpdates(_0x5f2b1d){return function(_0x5c83e9){if(_0x5c83e9){return _0x5c83e9[_0x9d60('0x18')](_0x5f2b1d)[_0x9d60('0x19')](function(_0x3870dd){return _0x3870dd;});}return null;};}function removeEntity(_0x4e7a1c){return function(_0x144062){if(_0x144062){return _0x144062['destroy']()[_0x9d60('0x19')](function(){_0x4e7a1c['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4c5fc0){return function(_0x43de97){if(!_0x43de97){_0x4c5fc0['sendStatus'](0x194);}return _0x43de97;};}function handleError(_0x544918,_0x575e24){_0x575e24=_0x575e24||0x1f4;return function(_0x1d6b02){logger['error'](_0x1d6b02[_0x9d60('0x1a')]);if(_0x1d6b02['name']){delete _0x1d6b02[_0x9d60('0x1b')];}_0x544918[_0x9d60('0x14')](_0x575e24)[_0x9d60('0x1c')](_0x1d6b02);};}exports[_0x9d60('0x1d')]=function(_0x5cd7b6,_0x420580){var _0xcfe926={};var _0x5db34a=_[_0x9d60('0x1e')](db[_0x9d60('0x1f')][_0x9d60('0x20')],function(_0x4a92ae){return{'name':_0x4a92ae[_0x9d60('0x21')],'type':_0x4a92ae[_0x9d60('0x22')][_0x9d60('0x23')]};});_0xcfe926=qs[_0x9d60('0x24')](_0x5db34a,_0x5cd7b6);return interaction[_0x9d60('0x25')](_0x9d60('0x26'),_0x5cd7b6[_0x9d60('0x27')],_0x5cd7b6[_0x9d60('0x28')],_0xcfe926,_0x5db34a)[_0x9d60('0x19')](respondWithFilteredResult(_0x420580,_0xcfe926))[_0x9d60('0x29')](handleError(_0x420580,null));};exports[_0x9d60('0x2a')]=function(_0x2d6460,_0x5ce64a){var _0x493305={'raw':![],'where':{'id':_0x2d6460[_0x9d60('0x2b')]['id']}},_0x477050={};_0x477050[_0x9d60('0x2c')]=_[_0x9d60('0x2d')](db['SmsInteraction'][_0x9d60('0x20')]);_0x477050[_0x9d60('0x27')]=_['keys'](_0x2d6460[_0x9d60('0x27')]);_0x477050[_0x9d60('0x2e')]=_[_0x9d60('0x2f')](_0x477050[_0x9d60('0x2c')],_0x477050[_0x9d60('0x27')]);_0x493305[_0x9d60('0x30')]=_[_0x9d60('0x2f')](_0x477050[_0x9d60('0x2c')],qs[_0x9d60('0x31')](_0x2d6460['query'][_0x9d60('0x31')]));_0x493305[_0x9d60('0x30')]=_0x493305[_0x9d60('0x30')][_0x9d60('0x32')]?_0x493305[_0x9d60('0x30')]:_0x477050[_0x9d60('0x2c')];if(_0x2d6460['query'][_0x9d60('0x33')]){_0x493305[_0x9d60('0x34')]=[{'all':!![]}];}_0x493305=_[_0x9d60('0x35')]({},_0x493305,_0x2d6460[_0x9d60('0x36')]);return db[_0x9d60('0x1f')][_0x9d60('0x37')](_0x493305)['then'](handleEntityNotFound(_0x5ce64a,null))[_0x9d60('0x19')](respondWithResult(_0x5ce64a,null))[_0x9d60('0x29')](handleError(_0x5ce64a,null));};exports['create']=function(_0x34e28e,_0x21059e){return db['SmsInteraction']['create'](_0x34e28e[_0x9d60('0x38')],{})[_0x9d60('0x19')](respondWithResult(_0x21059e,0xc9))['catch'](handleError(_0x21059e,null));};exports[_0x9d60('0x18')]=function(_0x494bfb,_0x18e2b0){if(_0x494bfb['body']['id']){delete _0x494bfb[_0x9d60('0x38')]['id'];}return db[_0x9d60('0x1f')]['find']({'where':{'id':_0x494bfb['params']['id']}})[_0x9d60('0x19')](handleEntityNotFound(_0x18e2b0,null))[_0x9d60('0x19')](saveUpdates(_0x494bfb[_0x9d60('0x38')],null))[_0x9d60('0x19')](respondWithResult(_0x18e2b0,null))[_0x9d60('0x29')](handleError(_0x18e2b0,null));};exports[_0x9d60('0x39')]=function(_0x51ee8e,_0x3bb53d){return db[_0x9d60('0x1f')][_0x9d60('0x37')]({'where':{'id':_0x51ee8e['params']['id']}})['then'](handleEntityNotFound(_0x3bb53d,null))[_0x9d60('0x19')](removeEntity(_0x3bb53d,null))[_0x9d60('0x29')](handleError(_0x3bb53d,null));};exports[_0x9d60('0x3a')]=function(_0x247cfd,_0x5d211e){return db[_0x9d60('0x1f')]['describe']()[_0x9d60('0x19')](respondWithResult(_0x5d211e,null))[_0x9d60('0x29')](handleError(_0x5d211e,null));};exports['addMessage']=function(_0x598572,_0x498161){return db[_0x9d60('0x3b')][_0x9d60('0x37')]({'where':{'id':_0x598572[_0x9d60('0x2b')]['id']}})[_0x9d60('0x19')](handleEntityNotFound(_0x498161,null))[_0x9d60('0x19')](function(_0x42378f){if(_0x42378f){return _0x42378f[_0x9d60('0x3c')](_0x598572[_0x9d60('0x38')][_0x9d60('0x3d')],_['omit'](_0x598572[_0x9d60('0x38')],['ids','id'])||{});}})[_0x9d60('0x19')](respondWithResult(_0x498161,null))[_0x9d60('0x29')](handleError(_0x498161,null));};exports[_0x9d60('0x3e')]=function(_0x414d38,_0x512d58){var _0x29a2ab={'raw':![],'where':{}};var _0x2b782c={};var _0x2dfd72={'count':0x0,'rows':[]};return db[_0x9d60('0x1f')][_0x9d60('0x3f')]({'where':{'id':_0x414d38[_0x9d60('0x2b')]['id']}})[_0x9d60('0x19')](handleEntityNotFound(_0x512d58,null))[_0x9d60('0x19')](function(_0x288520){if(_0x288520){_0x2b782c['model']=_[_0x9d60('0x2d')](db[_0x9d60('0x3b')]['rawAttributes']);_0x2b782c[_0x9d60('0x27')]=_[_0x9d60('0x2d')](_0x414d38[_0x9d60('0x27')]);_0x2b782c['filters']=_[_0x9d60('0x2f')](_0x2b782c[_0x9d60('0x2c')],_0x2b782c['query']);_0x29a2ab[_0x9d60('0x30')]=_[_0x9d60('0x2f')](_0x2b782c[_0x9d60('0x2c')],qs[_0x9d60('0x31')](_0x414d38[_0x9d60('0x27')][_0x9d60('0x31')]));_0x29a2ab[_0x9d60('0x30')]=_0x29a2ab['attributes'][_0x9d60('0x32')]?_0x29a2ab['attributes']:_0x2b782c[_0x9d60('0x2c')];if(!_0x414d38['query']['hasOwnProperty'](_0x9d60('0x40'))){_0x29a2ab[_0x9d60('0x12')]=qs['limit'](_0x414d38['query'][_0x9d60('0x12')]);_0x29a2ab[_0x9d60('0x11')]=qs[_0x9d60('0x11')](_0x414d38[_0x9d60('0x27')]['offset']);}_0x29a2ab[_0x9d60('0x41')]=qs[_0x9d60('0x42')](_0x414d38[_0x9d60('0x27')][_0x9d60('0x42')]);_0x29a2ab[_0x9d60('0x43')]=qs[_0x9d60('0x2e')](_[_0x9d60('0x44')](_0x414d38[_0x9d60('0x27')],_0x2b782c['filters']));_0x29a2ab[_0x9d60('0x43')]['SmsInteractionId']=_0x288520['id'];if(_0x414d38[_0x9d60('0x27')][_0x9d60('0x45')]){_0x29a2ab[_0x9d60('0x43')]=_[_0x9d60('0x35')](_0x29a2ab[_0x9d60('0x43')],{'$or':_[_0x9d60('0x1e')](_0x29a2ab['attributes'],function(_0x4d0ca1){var _0x37ade6={};_0x37ade6[_0x4d0ca1]={'$like':'%'+_0x414d38[_0x9d60('0x27')][_0x9d60('0x45')]+'%'};return _0x37ade6;})});}if(_0x414d38[_0x9d60('0x27')][_0x9d60('0x46')]){var _0x109245=_0x414d38['query'][_0x9d60('0x46')]['split'](',');var _0x1b8a97={};_0x1b8a97[_0x109245[0x0]]={'$gte':moment(_0x109245[0x1])[_0x9d60('0x47')]('YYYY-MM-DD\x20HH:mm:ss')};_0x29a2ab[_0x9d60('0x43')]=_[_0x9d60('0x35')](_0x29a2ab[_0x9d60('0x43')],_0x1b8a97);}_0x29a2ab=_['merge']({},_0x29a2ab,_0x414d38['options']);return db[_0x9d60('0x3b')][_0x9d60('0x13')]({'where':_0x29a2ab[_0x9d60('0x43')]})[_0x9d60('0x19')](function(_0x210803){_0x2dfd72[_0x9d60('0x13')]=_0x210803;if(_0x414d38['query'][_0x9d60('0x33')]){_0x29a2ab[_0x9d60('0x34')]=[{'all':!![]}];}return db[_0x9d60('0x3b')][_0x9d60('0x25')](_0x29a2ab);})[_0x9d60('0x19')](function(_0x22bfb4){_0x2dfd72[_0x9d60('0x48')]=_0x22bfb4;return _0x2dfd72;});}})[_0x9d60('0x19')](respondWithFilteredResult(_0x512d58,_0x29a2ab))[_0x9d60('0x29')](handleError(_0x512d58,null));};exports[_0x9d60('0x49')]=function(_0x3dca1d,_0xb33bde){return db['SmsInteraction']['find']({'where':{'id':_0x3dca1d[_0x9d60('0x2b')]['id']}})[_0x9d60('0x19')](handleEntityNotFound(_0xb33bde,null))[_0x9d60('0x19')](function(_0x1e4f44){if(_0x1e4f44){return _0x1e4f44[_0x9d60('0x4a')](_0x3dca1d[_0x9d60('0x38')][_0x9d60('0x3d')],_['omit'](_0x3dca1d[_0x9d60('0x38')],[_0x9d60('0x3d'),'id'])||{})[_0x9d60('0x4b')](function(){return db[_0x9d60('0x4c')][_0x9d60('0x25')]({'attributes':['id',_0x9d60('0x1b'),_0x9d60('0x4d')],'where':{'id':_0x3dca1d[_0x9d60('0x38')][_0x9d60('0x3d')]}});})['then'](function(_0xaf3ccf){socket['emit'](_0x9d60('0x4e'),{'id':Number(_0x3dca1d['params']['id']),'tags':_0xaf3ccf||[]});return{'id':Number(_0x3dca1d[_0x9d60('0x2b')]['id']),'tags':_0xaf3ccf||[]};});}})['then'](respondWithResult(_0xb33bde,null))[_0x9d60('0x29')](handleError(_0xb33bde,null));};exports[_0x9d60('0x4f')]=function(_0x53d8ef,_0x169136){return db[_0x9d60('0x1f')][_0x9d60('0x37')]({'where':{'id':_0x53d8ef[_0x9d60('0x2b')]['id']}})[_0x9d60('0x19')](handleEntityNotFound(_0x169136,null))[_0x9d60('0x19')](function(_0x3537d2){if(_0x3537d2){return _0x3537d2['removeTags'](_0x53d8ef[_0x9d60('0x27')][_0x9d60('0x3d')]);}})[_0x9d60('0x19')](respondWithStatusCode(_0x169136,null))[_0x9d60('0x29')](handleError(_0x169136,null));};exports[_0x9d60('0x50')]=function(_0x5483ba,_0x54c23b){var _0x531da7=moment()[_0x9d60('0x51')]()[_0x9d60('0x52')]();var _0x3ecff7=path['join'](config[_0x9d60('0x53')],_0x9d60('0x54'),_0x9d60('0x55'),_0x9d60('0x56'));var _0x453f2c=path['join'](_0x3ecff7,_0x531da7);var _0x5cf6e6=util[_0x9d60('0x47')](_0x9d60('0x57'),_0x5483ba[_0x9d60('0x2b')]['id'],_0x531da7);var _0x535438=path[_0x9d60('0x58')](_0x3ecff7,_0x5cf6e6);var _0x252d85=[];_0x252d85['push']({'model':db[_0x9d60('0x59')],'as':_0x9d60('0x59'),'attributes':['id',_0x9d60('0x5a')],'raw':!![]});_0x252d85[_0x9d60('0x5b')]({'model':db[_0x9d60('0x5c')],'as':_0x9d60('0x5d'),'attributes':['id','firstName',_0x9d60('0x5e')],'raw':!![]});var _0x4d41df=[{'model':db[_0x9d60('0x3b')],'as':'Messages','attributes':['id',_0x9d60('0x38'),_0x9d60('0x5f'),_0x9d60('0x60'),_0x9d60('0x61'),'read'],'include':_0x252d85}];_0x4d41df[_0x9d60('0x5b')]({'model':db[_0x9d60('0x62')],'as':'Account','attributes':['id',_0x9d60('0x1b')]});_0x4d41df[_0x9d60('0x5b')]({'model':db[_0x9d60('0x59')],'as':_0x9d60('0x63'),'attributes':['id',_0x9d60('0x5a')]});return db[_0x9d60('0x1f')][_0x9d60('0x37')]({'where':{'id':_0x5483ba[_0x9d60('0x2b')]['id']},'include':_0x4d41df})['then'](handleEntityNotFound(_0x54c23b,null))['then'](function(_0xc9bcf4){if(_0xc9bcf4){var _0x7f4d55=_0xc9bcf4[_0x9d60('0x64')]({'plain':!![]});fs['mkdirSync'](_0x453f2c);var _0x3650ee={'channel':_0x9d60('0x65'),'account':_0x7f4d55[_0x9d60('0x66')][_0x9d60('0x1b')],'agent':_0x7f4d55[_0x9d60('0x63')]?_0x7f4d55[_0x9d60('0x63')][_0x9d60('0x5a')]:_0x9d60('0x67'),'createdAt':moment(_0x7f4d55[_0x9d60('0x5f')])[_0x9d60('0x47')](_0x9d60('0x68'))[_0x9d60('0x52')](),'closedAt':_0x7f4d55['closed']?moment(_0x7f4d55[_0x9d60('0x69')])[_0x9d60('0x47')](_0x9d60('0x68'))['toString']():'','disposition':_0x7f4d55[_0x9d60('0x6a')],'messages':_(_0x7f4d55[_0x9d60('0x6b')])[_0x9d60('0x45')]({'secret':![]})[_0x9d60('0x1e')](function(_0x44c19d){return{'date':moment(_0x44c19d[_0x9d60('0x5f')])[_0x9d60('0x47')](_0x9d60('0x68'))[_0x9d60('0x52')](),'sender':_0x44c19d[_0x9d60('0x60')]===_0x9d60('0x6c')?_0x44c19d[_0x9d60('0x59')]?_0x44c19d['User'][_0x9d60('0x5a')]:_0x9d60('0x6d'):_0x44c19d[_0x9d60('0x5d')][_0x9d60('0x6e')]+(_0x44c19d[_0x9d60('0x5d')][_0x9d60('0x5e')]?'\x20'+_0x44c19d['Contact'][_0x9d60('0x5e')]:''),'body':_0x44c19d[_0x9d60('0x38')],'direction':_0x44c19d['direction']===_0x9d60('0x6c')?'A':'C','secret':_0x44c19d[_0x9d60('0x61')],'read':_0x44c19d['read']};})[_0x9d60('0x6f')]()};return ejs[_0x9d60('0x70')](path[_0x9d60('0x58')](config[_0x9d60('0x53')],_0x9d60('0x54'),_0x9d60('0x71'),_0x9d60('0x72')),{'interaction':_0x3650ee})[_0x9d60('0x19')](function(_0x415df9){var _0x48b989=path[_0x9d60('0x58')](_0x453f2c,'transcript-'+_0x7f4d55['id']+'-'+_0x531da7+_0x9d60('0x73'));var _0x3a8159={'path':_0x48b989,'channel':_0x9d60('0x65'),'interactionId':_0x7f4d55['id']};return pdf[_0x9d60('0x74')](_0x415df9,_0x3a8159);})['then'](function(){return new BPromise(function(_0x50d54a,_0x563b72){zipdir(_0x453f2c,{'saveTo':_0x535438},function(_0x32abcc,_0x1adbf9){if(_0x32abcc)return _0x563b72(_0x32abcc);return _0x50d54a(_0x1adbf9);});})[_0x9d60('0x19')](function(){return new BPromise(function(_0x551580,_0x26bd36){rimraf(_0x453f2c,function(_0x557085){if(_0x557085)_0x26bd36(_0x557085);return _0x551580();});});})[_0x9d60('0x19')](function(){return _0x54c23b[_0x9d60('0x50')](_0x535438,_0x5cf6e6,function(_0x394497){if(_0x394497){console[_0x9d60('0x75')](_0x9d60('0x76'),_0x394497);}else{fs['unlinkSync'](_0x535438);}});});});}else{return _0x54c23b[_0x9d60('0x10')](0xc8);}})[_0x9d60('0x29')](handleError(_0x54c23b,null));}; \ No newline at end of file +var _0x5e52=['filter','out','Contact','lastName','value','renderFile','downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML','log','err','unlinkSync','moment','bluebird','util','path','ejs','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','../../config/logger','api','../../config/environment','../../mysqldb','redis','localhost','./smsInteraction.socket','register','status','end','json','offset','undefined','limit','count','set','Content-Range','then','sendStatus','error','stack','name','send','index','map','rawAttributes','fieldName','type','getOptions','findAll','user','catch','show','params','model','keys','query','filters','intersection','attributes','fields','length','include','options','SmsInteraction','find','create','body','destroy','describe','addMessage','SmsMessage','omit','ids','getMessages','findOne','nolimit','sort','where','pick','SmsInteractionId','$gte','split','format','merge','includeAll','rows','addTags','color','emit','smsInteractionTags:save','removeTags','download','unix','toString','join','root','server','files','tmp','transcript-%d-%s.zip','push','User','fullname','CmContact','firstName','Messages','direction','secret','read','SmsAccount','Account','Owner','get','mkdirSync','Sms','N.A.','createdAt','closed','YYYY-MM-DD\x20HH:mm:ss','disposition'];(function(_0x513aa5,_0x1fba79){var _0x1a1a7c=function(_0x240e3f){while(--_0x240e3f){_0x513aa5['push'](_0x513aa5['shift']());}};_0x1a1a7c(++_0x1fba79);}(_0x5e52,0x105));var _0x25e5=function(_0x5e7e4c,_0x4cf045){_0x5e7e4c=_0x5e7e4c-0x0;var _0x4a2530=_0x5e52[_0x5e7e4c];return _0x4a2530;};'use strict';var rimraf=require('rimraf');var zipdir=require('zip-dir');var moment=require(_0x25e5('0x0'));var BPromise=require(_0x25e5('0x1'));var util=require(_0x25e5('0x2'));var path=require(_0x25e5('0x3'));var ejs=require(_0x25e5('0x4'));var fs=require('fs');var _=require(_0x25e5('0x5'));var Redis=require(_0x25e5('0x6'));var interaction=require(_0x25e5('0x7'));var qs=require(_0x25e5('0x8'));var pdf=require(_0x25e5('0x9'));var logger=require(_0x25e5('0xa'))(_0x25e5('0xb'));var config=require(_0x25e5('0xc'));var db=require(_0x25e5('0xd'))['db'];config[_0x25e5('0xe')]=_['defaults'](config['redis'],{'host':_0x25e5('0xf'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x25e5('0xe')]));require(_0x25e5('0x10'))[_0x25e5('0x11')](socket);function respondWithStatusCode(_0x30fcbe,_0x13b1c1){_0x13b1c1=_0x13b1c1||0xcc;return function(_0x8f21e1){if(_0x8f21e1){return _0x30fcbe['sendStatus'](_0x13b1c1);}return _0x30fcbe[_0x25e5('0x12')](_0x13b1c1)[_0x25e5('0x13')]();};}function respondWithResult(_0x5b6b39,_0x361722){_0x361722=_0x361722||0xc8;return function(_0x1eca30){if(_0x1eca30){return _0x5b6b39['status'](_0x361722)[_0x25e5('0x14')](_0x1eca30);}};}function respondWithFilteredResult(_0x1927a7,_0xe78421){return function(_0x4136b5){if(_0x4136b5){var _0x22c549=typeof _0xe78421[_0x25e5('0x15')]===_0x25e5('0x16')&&typeof _0xe78421[_0x25e5('0x17')]===_0x25e5('0x16');var _0x1e5c8e=_0x4136b5[_0x25e5('0x18')];var _0x1d7510=_0x22c549?0x0:_0xe78421[_0x25e5('0x15')];var _0x2a6dfb=_0x22c549?_0x4136b5[_0x25e5('0x18')]:_0xe78421[_0x25e5('0x15')]+_0xe78421[_0x25e5('0x17')];var _0x42b954;if(_0x2a6dfb>=_0x1e5c8e){_0x2a6dfb=_0x1e5c8e;_0x42b954=0xc8;}else{_0x42b954=0xce;}_0x1927a7[_0x25e5('0x12')](_0x42b954);return _0x1927a7[_0x25e5('0x19')](_0x25e5('0x1a'),_0x1d7510+'-'+_0x2a6dfb+'/'+_0x1e5c8e)[_0x25e5('0x14')](_0x4136b5);}return null;};}function saveUpdates(_0x5a5406){return function(_0x1757a1){if(_0x1757a1){return _0x1757a1['update'](_0x5a5406)['then'](function(_0x175948){return _0x175948;});}return null;};}function removeEntity(_0x31f41e){return function(_0x4e9bbd){if(_0x4e9bbd){return _0x4e9bbd['destroy']()[_0x25e5('0x1b')](function(){_0x31f41e[_0x25e5('0x12')](0xcc)[_0x25e5('0x13')]();});}};}function handleEntityNotFound(_0x6048b3){return function(_0x23dcf1){if(!_0x23dcf1){_0x6048b3[_0x25e5('0x1c')](0x194);}return _0x23dcf1;};}function handleError(_0x5fb5f,_0x16970b){_0x16970b=_0x16970b||0x1f4;return function(_0x78e2b5){logger[_0x25e5('0x1d')](_0x78e2b5[_0x25e5('0x1e')]);if(_0x78e2b5[_0x25e5('0x1f')]){delete _0x78e2b5['name'];}_0x5fb5f[_0x25e5('0x12')](_0x16970b)[_0x25e5('0x20')](_0x78e2b5);};}exports[_0x25e5('0x21')]=function(_0x2c14af,_0x587f87){var _0x7503f9={};var _0x406196=_[_0x25e5('0x22')](db['SmsInteraction'][_0x25e5('0x23')],function(_0x4921bc){return{'name':_0x4921bc[_0x25e5('0x24')],'type':_0x4921bc[_0x25e5('0x25')]['key']};});_0x7503f9=qs[_0x25e5('0x26')](_0x406196,_0x2c14af);return interaction[_0x25e5('0x27')]('sms',_0x2c14af['query'],_0x2c14af[_0x25e5('0x28')],_0x7503f9,_0x406196)['then'](respondWithFilteredResult(_0x587f87,_0x7503f9))[_0x25e5('0x29')](handleError(_0x587f87,null));};exports[_0x25e5('0x2a')]=function(_0x395280,_0x1867b3){var _0x44a345={'raw':![],'where':{'id':_0x395280[_0x25e5('0x2b')]['id']}},_0xe6403a={};_0xe6403a[_0x25e5('0x2c')]=_[_0x25e5('0x2d')](db['SmsInteraction'][_0x25e5('0x23')]);_0xe6403a[_0x25e5('0x2e')]=_[_0x25e5('0x2d')](_0x395280[_0x25e5('0x2e')]);_0xe6403a[_0x25e5('0x2f')]=_[_0x25e5('0x30')](_0xe6403a['model'],_0xe6403a[_0x25e5('0x2e')]);_0x44a345[_0x25e5('0x31')]=_[_0x25e5('0x30')](_0xe6403a[_0x25e5('0x2c')],qs[_0x25e5('0x32')](_0x395280[_0x25e5('0x2e')][_0x25e5('0x32')]));_0x44a345[_0x25e5('0x31')]=_0x44a345[_0x25e5('0x31')][_0x25e5('0x33')]?_0x44a345['attributes']:_0xe6403a[_0x25e5('0x2c')];if(_0x395280['query']['includeAll']){_0x44a345[_0x25e5('0x34')]=[{'all':!![]}];}_0x44a345=_['merge']({},_0x44a345,_0x395280[_0x25e5('0x35')]);return db[_0x25e5('0x36')][_0x25e5('0x37')](_0x44a345)[_0x25e5('0x1b')](handleEntityNotFound(_0x1867b3,null))[_0x25e5('0x1b')](respondWithResult(_0x1867b3,null))[_0x25e5('0x29')](handleError(_0x1867b3,null));};exports[_0x25e5('0x38')]=function(_0x3f67ad,_0x57cab7){return db[_0x25e5('0x36')][_0x25e5('0x38')](_0x3f67ad[_0x25e5('0x39')],{})[_0x25e5('0x1b')](respondWithResult(_0x57cab7,0xc9))[_0x25e5('0x29')](handleError(_0x57cab7,null));};exports['update']=function(_0xe0d97,_0x3c96e8){if(_0xe0d97[_0x25e5('0x39')]['id']){delete _0xe0d97[_0x25e5('0x39')]['id'];}return db['SmsInteraction'][_0x25e5('0x37')]({'where':{'id':_0xe0d97[_0x25e5('0x2b')]['id']}})[_0x25e5('0x1b')](handleEntityNotFound(_0x3c96e8,null))[_0x25e5('0x1b')](saveUpdates(_0xe0d97[_0x25e5('0x39')],null))['then'](respondWithResult(_0x3c96e8,null))['catch'](handleError(_0x3c96e8,null));};exports[_0x25e5('0x3a')]=function(_0x1894c0,_0x18c918){return db[_0x25e5('0x36')][_0x25e5('0x37')]({'where':{'id':_0x1894c0[_0x25e5('0x2b')]['id']}})['then'](handleEntityNotFound(_0x18c918,null))['then'](removeEntity(_0x18c918,null))[_0x25e5('0x29')](handleError(_0x18c918,null));};exports[_0x25e5('0x3b')]=function(_0x577245,_0x1d4b94){return db[_0x25e5('0x36')][_0x25e5('0x3b')]()[_0x25e5('0x1b')](respondWithResult(_0x1d4b94,null))[_0x25e5('0x29')](handleError(_0x1d4b94,null));};exports[_0x25e5('0x3c')]=function(_0x5e3bfd,_0x520218){return db[_0x25e5('0x3d')][_0x25e5('0x37')]({'where':{'id':_0x5e3bfd[_0x25e5('0x2b')]['id']}})['then'](handleEntityNotFound(_0x520218,null))['then'](function(_0x664d52){if(_0x664d52){return _0x664d52[_0x25e5('0x3c')](_0x5e3bfd[_0x25e5('0x39')]['ids'],_[_0x25e5('0x3e')](_0x5e3bfd[_0x25e5('0x39')],[_0x25e5('0x3f'),'id'])||{});}})['then'](respondWithResult(_0x520218,null))['catch'](handleError(_0x520218,null));};exports[_0x25e5('0x40')]=function(_0x2d61a0,_0x38c559){var _0x37ca75={'raw':![],'where':{}};var _0x297df0={};var _0x52587a={'count':0x0,'rows':[]};return db[_0x25e5('0x36')][_0x25e5('0x41')]({'where':{'id':_0x2d61a0[_0x25e5('0x2b')]['id']}})[_0x25e5('0x1b')](handleEntityNotFound(_0x38c559,null))['then'](function(_0x4127a9){if(_0x4127a9){_0x297df0[_0x25e5('0x2c')]=_[_0x25e5('0x2d')](db[_0x25e5('0x3d')][_0x25e5('0x23')]);_0x297df0['query']=_[_0x25e5('0x2d')](_0x2d61a0[_0x25e5('0x2e')]);_0x297df0[_0x25e5('0x2f')]=_[_0x25e5('0x30')](_0x297df0[_0x25e5('0x2c')],_0x297df0[_0x25e5('0x2e')]);_0x37ca75['attributes']=_['intersection'](_0x297df0[_0x25e5('0x2c')],qs[_0x25e5('0x32')](_0x2d61a0['query'][_0x25e5('0x32')]));_0x37ca75[_0x25e5('0x31')]=_0x37ca75[_0x25e5('0x31')][_0x25e5('0x33')]?_0x37ca75[_0x25e5('0x31')]:_0x297df0['model'];if(!_0x2d61a0[_0x25e5('0x2e')]['hasOwnProperty'](_0x25e5('0x42'))){_0x37ca75[_0x25e5('0x17')]=qs[_0x25e5('0x17')](_0x2d61a0['query'][_0x25e5('0x17')]);_0x37ca75[_0x25e5('0x15')]=qs[_0x25e5('0x15')](_0x2d61a0[_0x25e5('0x2e')][_0x25e5('0x15')]);}_0x37ca75['order']=qs[_0x25e5('0x43')](_0x2d61a0[_0x25e5('0x2e')]['sort']);_0x37ca75[_0x25e5('0x44')]=qs['filters'](_[_0x25e5('0x45')](_0x2d61a0[_0x25e5('0x2e')],_0x297df0[_0x25e5('0x2f')]));_0x37ca75['where'][_0x25e5('0x46')]=_0x4127a9['id'];if(_0x2d61a0[_0x25e5('0x2e')]['filter']){_0x37ca75[_0x25e5('0x44')]=_['merge'](_0x37ca75[_0x25e5('0x44')],{'$or':_['map'](_0x37ca75['attributes'],function(_0x47693f){var _0x4a89d2={};_0x4a89d2[_0x47693f]={'$like':'%'+_0x2d61a0[_0x25e5('0x2e')]['filter']+'%'};return _0x4a89d2;})});}if(_0x2d61a0[_0x25e5('0x2e')][_0x25e5('0x47')]){var _0x344ab5=_0x2d61a0[_0x25e5('0x2e')]['$gte'][_0x25e5('0x48')](',');var _0x55dc1b={};_0x55dc1b[_0x344ab5[0x0]]={'$gte':moment(_0x344ab5[0x1])[_0x25e5('0x49')]('YYYY-MM-DD\x20HH:mm:ss')};_0x37ca75[_0x25e5('0x44')]=_[_0x25e5('0x4a')](_0x37ca75['where'],_0x55dc1b);}_0x37ca75=_['merge']({},_0x37ca75,_0x2d61a0[_0x25e5('0x35')]);return db[_0x25e5('0x3d')][_0x25e5('0x18')]({'where':_0x37ca75[_0x25e5('0x44')]})[_0x25e5('0x1b')](function(_0x4ac419){_0x52587a['count']=_0x4ac419;if(_0x2d61a0[_0x25e5('0x2e')][_0x25e5('0x4b')]){_0x37ca75[_0x25e5('0x34')]=[{'all':!![]}];}return db[_0x25e5('0x3d')][_0x25e5('0x27')](_0x37ca75);})['then'](function(_0x1cce91){_0x52587a[_0x25e5('0x4c')]=_0x1cce91;return _0x52587a;});}})[_0x25e5('0x1b')](respondWithFilteredResult(_0x38c559,_0x37ca75))['catch'](handleError(_0x38c559,null));};exports[_0x25e5('0x4d')]=function(_0x2bc914,_0x47a32e){return db['SmsInteraction'][_0x25e5('0x37')]({'where':{'id':_0x2bc914[_0x25e5('0x2b')]['id']}})[_0x25e5('0x1b')](handleEntityNotFound(_0x47a32e,null))[_0x25e5('0x1b')](function(_0x268649){if(_0x268649){return _0x268649['setTags'](_0x2bc914[_0x25e5('0x39')]['ids'],_[_0x25e5('0x3e')](_0x2bc914[_0x25e5('0x39')],[_0x25e5('0x3f'),'id'])||{})['spread'](function(){return db['Tag']['findAll']({'attributes':['id',_0x25e5('0x1f'),_0x25e5('0x4e')],'where':{'id':_0x2bc914[_0x25e5('0x39')][_0x25e5('0x3f')]}});})[_0x25e5('0x1b')](function(_0x2984ca){socket[_0x25e5('0x4f')](_0x25e5('0x50'),{'id':Number(_0x2bc914[_0x25e5('0x2b')]['id']),'tags':_0x2984ca||[]});return{'id':Number(_0x2bc914[_0x25e5('0x2b')]['id']),'tags':_0x2984ca||[]};});}})[_0x25e5('0x1b')](respondWithResult(_0x47a32e,null))[_0x25e5('0x29')](handleError(_0x47a32e,null));};exports[_0x25e5('0x51')]=function(_0x3b1293,_0x5cdad5){return db[_0x25e5('0x36')][_0x25e5('0x37')]({'where':{'id':_0x3b1293[_0x25e5('0x2b')]['id']}})[_0x25e5('0x1b')](handleEntityNotFound(_0x5cdad5,null))[_0x25e5('0x1b')](function(_0x30976a){if(_0x30976a){return _0x30976a[_0x25e5('0x51')](_0x3b1293[_0x25e5('0x2e')][_0x25e5('0x3f')]);}})[_0x25e5('0x1b')](respondWithStatusCode(_0x5cdad5,null))[_0x25e5('0x29')](handleError(_0x5cdad5,null));};exports[_0x25e5('0x52')]=function(_0x49ea17,_0x35b833){var _0x5b4615=moment()[_0x25e5('0x53')]()[_0x25e5('0x54')]();var _0x14107f=path[_0x25e5('0x55')](config[_0x25e5('0x56')],_0x25e5('0x57'),_0x25e5('0x58'),_0x25e5('0x59'));var _0x3e0139=path[_0x25e5('0x55')](_0x14107f,_0x5b4615);var _0x4941fc=util[_0x25e5('0x49')](_0x25e5('0x5a'),_0x49ea17['params']['id'],_0x5b4615);var _0x34cd2b=path[_0x25e5('0x55')](_0x14107f,_0x4941fc);var _0x58adf7=[];_0x58adf7[_0x25e5('0x5b')]({'model':db[_0x25e5('0x5c')],'as':_0x25e5('0x5c'),'attributes':['id',_0x25e5('0x5d')],'raw':!![]});_0x58adf7['push']({'model':db[_0x25e5('0x5e')],'as':'Contact','attributes':['id',_0x25e5('0x5f'),'lastName'],'raw':!![]});var _0x4d8687=[{'model':db['SmsMessage'],'as':_0x25e5('0x60'),'attributes':['id',_0x25e5('0x39'),'createdAt',_0x25e5('0x61'),_0x25e5('0x62'),_0x25e5('0x63')],'include':_0x58adf7}];_0x4d8687[_0x25e5('0x5b')]({'model':db[_0x25e5('0x64')],'as':_0x25e5('0x65'),'attributes':['id',_0x25e5('0x1f')]});_0x4d8687[_0x25e5('0x5b')]({'model':db[_0x25e5('0x5c')],'as':_0x25e5('0x66'),'attributes':['id',_0x25e5('0x5d')]});return db[_0x25e5('0x36')][_0x25e5('0x37')]({'where':{'id':_0x49ea17[_0x25e5('0x2b')]['id']},'include':_0x4d8687})['then'](handleEntityNotFound(_0x35b833,null))[_0x25e5('0x1b')](function(_0x2f9329){if(_0x2f9329){var _0x23669b=_0x2f9329[_0x25e5('0x67')]({'plain':!![]});fs[_0x25e5('0x68')](_0x3e0139);var _0x19828f={'channel':_0x25e5('0x69'),'account':_0x23669b[_0x25e5('0x65')][_0x25e5('0x1f')],'agent':_0x23669b[_0x25e5('0x66')]?_0x23669b['Owner'][_0x25e5('0x5d')]:_0x25e5('0x6a'),'createdAt':moment(_0x23669b[_0x25e5('0x6b')])[_0x25e5('0x49')]('YYYY-MM-DD\x20HH:mm:ss')[_0x25e5('0x54')](),'closedAt':_0x23669b[_0x25e5('0x6c')]?moment(_0x23669b['closedAt'])['format'](_0x25e5('0x6d'))['toString']():'','disposition':_0x23669b[_0x25e5('0x6e')],'messages':_(_0x23669b[_0x25e5('0x60')])[_0x25e5('0x6f')]({'secret':![]})[_0x25e5('0x22')](function(_0x16d35e){return{'date':moment(_0x16d35e['createdAt'])['format'](_0x25e5('0x6d'))['toString'](),'sender':_0x16d35e[_0x25e5('0x61')]===_0x25e5('0x70')?_0x16d35e['User']?_0x16d35e[_0x25e5('0x5c')][_0x25e5('0x5d')]:'System':_0x16d35e[_0x25e5('0x71')][_0x25e5('0x5f')]+(_0x16d35e[_0x25e5('0x71')]['lastName']?'\x20'+_0x16d35e[_0x25e5('0x71')][_0x25e5('0x72')]:''),'body':_0x16d35e['body'],'direction':_0x16d35e[_0x25e5('0x61')]===_0x25e5('0x70')?'A':'C','secret':_0x16d35e[_0x25e5('0x62')],'read':_0x16d35e['read']};})[_0x25e5('0x73')]()};return ejs[_0x25e5('0x74')](path[_0x25e5('0x55')](config[_0x25e5('0x56')],'server','views',_0x25e5('0x75')),{'interaction':_0x19828f})['then'](function(_0x8d79ae){var _0x57434e=path[_0x25e5('0x55')](_0x3e0139,_0x25e5('0x76')+_0x23669b['id']+'-'+_0x5b4615+_0x25e5('0x77'));var _0x1c926d={'path':_0x57434e,'channel':'Sms','interactionId':_0x23669b['id']};return pdf[_0x25e5('0x78')](_0x8d79ae,_0x1c926d);})[_0x25e5('0x1b')](function(){return new BPromise(function(_0x5b5aad,_0x1e74ee){zipdir(_0x3e0139,{'saveTo':_0x34cd2b},function(_0x2f9bef,_0xd2f34e){if(_0x2f9bef)return _0x1e74ee(_0x2f9bef);return _0x5b5aad(_0xd2f34e);});})['then'](function(){return new BPromise(function(_0x53e19f,_0x1f8e48){rimraf(_0x3e0139,function(_0x5a3bff){if(_0x5a3bff)_0x1f8e48(_0x5a3bff);return _0x53e19f();});});})[_0x25e5('0x1b')](function(){return _0x35b833[_0x25e5('0x52')](_0x34cd2b,_0x4941fc,function(_0x4d61cc){if(_0x4d61cc){console[_0x25e5('0x79')](_0x25e5('0x7a'),_0x4d61cc);}else{fs[_0x25e5('0x7b')](_0x34cd2b);}});});});}else{return _0x35b833[_0x25e5('0x1c')](0xc8);}})[_0x25e5('0x29')](handleError(_0x35b833,null));}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.events.js b/server/api/smsInteraction/smsInteraction.events.js index 52284d9..1f41c46 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 _0x065e=['emit','catch','hasOwnProperty','events','SmsMessage','setMaxListeners','save','getUsers','then','setDataValue','map','findAll','unreadMessages','length'];(function(_0x47ee7b,_0x2e40d5){var _0x17a0c1=function(_0x4da29b){while(--_0x4da29b){_0x47ee7b['push'](_0x47ee7b['shift']());}};_0x17a0c1(++_0x2e40d5);}(_0x065e,0x1a7));var _0xe065=function(_0x53bcf9,_0xea72ef){_0x53bcf9=_0x53bcf9-0x0;var _0x1365a6=_0x065e[_0x53bcf9];return _0x1365a6;};'use strict';var EventEmitter=require(_0xe065('0x0'));var SmsInteraction=require('../../mysqldb')['db']['SmsInteraction'];var SmsMessage=require('../../mysqldb')['db'][_0xe065('0x1')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0xe065('0x2')](0x0);var events={'afterCreate':_0xe065('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x4610a3){return function(_0x2f90aa,_0x5b099e,_0x10b45f){_0x2f90aa[_0xe065('0x4')]({'attributes':['id'],'raw':!![]})[_0xe065('0x5')](function(_0x52403a){_0x2f90aa[_0xe065('0x6')]('Users',_0x52403a[_0xe065('0x7')](function(_0x2f072e){return{'id':_0x2f072e['id']};}));return SmsMessage[_0xe065('0x8')]({'where':{'SmsInteractionId':_0x2f90aa['id'],'direction':'in','read':![]},'raw':!![]});})[_0xe065('0x5')](function(_0x85001e){_0x2f90aa['setDataValue'](_0xe065('0x9'),_0x85001e[_0xe065('0xa')]);SmsInteractionEvents[_0xe065('0xb')](_0x4610a3+':'+_0x2f90aa['id'],_0x2f90aa);SmsInteractionEvents[_0xe065('0xb')](_0x4610a3,_0x2f90aa);_0x10b45f(null);})[_0xe065('0xc')](_0x10b45f(null));};}for(var e in events){if(events[_0xe065('0xd')](e)){var event=events[e];SmsInteraction['hook'](e,emitEvent(event));}}module['exports']=SmsInteractionEvents; \ No newline at end of file +var _0x02ce=['setDataValue','unreadMessages','length','emit','catch','hasOwnProperty','hook','exports','events','../../mysqldb','SmsInteraction','SmsMessage','save','update','remove','getUsers','then','Users','map','findAll'];(function(_0xe5c15e,_0x5989c9){var _0x518c37=function(_0x7fcc22){while(--_0x7fcc22){_0xe5c15e['push'](_0xe5c15e['shift']());}};_0x518c37(++_0x5989c9);}(_0x02ce,0x1ac));var _0xe02c=function(_0x4cdab2,_0x59093e){_0x4cdab2=_0x4cdab2-0x0;var _0x52a581=_0x02ce[_0x4cdab2];return _0x52a581;};'use strict';var EventEmitter=require(_0xe02c('0x0'));var SmsInteraction=require(_0xe02c('0x1'))['db'][_0xe02c('0x2')];var SmsMessage=require('../../mysqldb')['db'][_0xe02c('0x3')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xe02c('0x4'),'afterUpdate':_0xe02c('0x5'),'afterDestroy':_0xe02c('0x6')};function emitEvent(_0xf4b764){return function(_0x41b41c,_0x229653,_0x3f7436){_0x41b41c[_0xe02c('0x7')]({'attributes':['id'],'raw':!![]})[_0xe02c('0x8')](function(_0x4fecb3){_0x41b41c['setDataValue'](_0xe02c('0x9'),_0x4fecb3[_0xe02c('0xa')](function(_0x469932){return{'id':_0x469932['id']};}));return SmsMessage[_0xe02c('0xb')]({'where':{'SmsInteractionId':_0x41b41c['id'],'direction':'in','read':![]},'raw':!![]});})[_0xe02c('0x8')](function(_0x18a398){_0x41b41c[_0xe02c('0xc')](_0xe02c('0xd'),_0x18a398[_0xe02c('0xe')]);SmsInteractionEvents[_0xe02c('0xf')](_0xf4b764+':'+_0x41b41c['id'],_0x41b41c);SmsInteractionEvents[_0xe02c('0xf')](_0xf4b764,_0x41b41c);_0x3f7436(null);})[_0xe02c('0x10')](_0x3f7436(null));};}for(var e in events){if(events[_0xe02c('0x11')](e)){var event=events[e];SmsInteraction[_0xe02c('0x12')](e,emitEvent(event));}}module[_0xe02c('0x13')]=SmsInteractionEvents; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.model.js b/server/api/smsInteraction/smsInteraction.model.js index b4bda83..68673f6 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 _0x1d1b=['define','sms_interactions','changed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','moment','bluebird','request-promise','path','../../config/environment','./smsInteraction.attributes'];(function(_0x1e39f6,_0x40a8e9){var _0x431259=function(_0xecce3a){while(--_0xecce3a){_0x1e39f6['push'](_0x1e39f6['shift']());}};_0x431259(++_0x40a8e9);}(_0x1d1b,0x141));var _0xb1d1=function(_0x56b90e,_0x1a71c8){_0x56b90e=_0x56b90e-0x0;var _0x1b42d6=_0x1d1b[_0x56b90e];return _0x1b42d6;};'use strict';var _=require(_0xb1d1('0x0'));var util=require(_0xb1d1('0x1'));var logger=require(_0xb1d1('0x2'))('api');var moment=require(_0xb1d1('0x3'));var BPromise=require(_0xb1d1('0x4'));var rp=require(_0xb1d1('0x5'));var fs=require('fs');var path=require(_0xb1d1('0x6'));var rimraf=require('rimraf');var config=require(_0xb1d1('0x7'));var attributes=require(_0xb1d1('0x8'));module['exports']=function(_0x503648,_0x12dffa){return _0x503648[_0xb1d1('0x9')]('SmsInteraction',attributes,{'tableName':_0xb1d1('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x343ac3,_0x3f2aea,_0x4fef4d){if(_0x343ac3[_0xb1d1('0xb')]('closed')){_0x343ac3[_0xb1d1('0xc')]=moment()[_0xb1d1('0xd')](_0xb1d1('0xe'));}_0x4fef4d(null,_0x343ac3);}}});}; \ No newline at end of file +var _0x3958=['path','rimraf','../../config/environment','./smsInteraction.attributes','exports','SmsInteraction','changed','closed','closedAt','YYYY-MM-DD\x20HH:mm:ss','lodash','../../config/logger','api','moment','request-promise'];(function(_0x45598f,_0x1649ec){var _0x517e2b=function(_0xd0990e){while(--_0xd0990e){_0x45598f['push'](_0x45598f['shift']());}};_0x517e2b(++_0x1649ec);}(_0x3958,0x64));var _0x8395=function(_0x1d5299,_0x599477){_0x1d5299=_0x1d5299-0x0;var _0x3c6a79=_0x3958[_0x1d5299];return _0x3c6a79;};'use strict';var _=require(_0x8395('0x0'));var util=require('util');var logger=require(_0x8395('0x1'))(_0x8395('0x2'));var moment=require(_0x8395('0x3'));var BPromise=require('bluebird');var rp=require(_0x8395('0x4'));var fs=require('fs');var path=require(_0x8395('0x5'));var rimraf=require(_0x8395('0x6'));var config=require(_0x8395('0x7'));var attributes=require(_0x8395('0x8'));module[_0x8395('0x9')]=function(_0xf38428,_0x320720){return _0xf38428['define'](_0x8395('0xa'),attributes,{'tableName':'sms_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x2a082a,_0x2d75a2,_0x35faea){if(_0x2a082a[_0x8395('0xb')](_0x8395('0xc'))){_0x2a082a[_0x8395('0xd')]=moment()['format'](_0x8395('0xe'));}_0x35faea(null,_0x2a082a);}}});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.rpc.js b/server/api/smsInteraction/smsInteraction.rpc.js index 2198fc2..2f4893a 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 _0x92fa=['lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','redis','defaults','localhost','./smsInteraction.socket','register','request','then','info','debug','SmsInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','SmsInteraction,\x20%s,\x20%s','message','result','catch','UpdateSmsInteraction','SmsInteraction','update','body','options','where','attributes','limit','AddTagsToSmsInteraction','addTags','ids','omit','spread','AddTags','stringify'];(function(_0x19edef,_0x51f611){var _0x336c95=function(_0x4b92f3){while(--_0x4b92f3){_0x19edef['push'](_0x19edef['shift']());}};_0x336c95(++_0x51f611);}(_0x92fa,0x1ae));var _0xa92f=function(_0x36d086,_0x49a157){_0x36d086=_0x36d086-0x0;var _0x3f2c1f=_0x92fa[_0x36d086];return _0x3f2c1f;};'use strict';var _=require(_0xa92f('0x0'));var util=require(_0xa92f('0x1'));var moment=require('moment');var BPromise=require(_0xa92f('0x2'));var rs=require(_0xa92f('0x3'));var fs=require('fs');var Redis=require(_0xa92f('0x4'));var db=require(_0xa92f('0x5'))['db'];var utils=require(_0xa92f('0x6'));var logger=require(_0xa92f('0x7'))(_0xa92f('0x8'));var config=require(_0xa92f('0x9'));var jayson=require(_0xa92f('0xa'));var client=jayson['client']['http']({'port':0x232a});config[_0xa92f('0xb')]=_[_0xa92f('0xc')](config[_0xa92f('0xb')],{'host':_0xa92f('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xa92f('0xb')]));require(_0xa92f('0xe'))[_0xa92f('0xf')](socket);function respondWithRpcPromise(_0x370b07,_0x468267,_0x239114){return new BPromise(function(_0x5f34f2,_0x5f6816){return client[_0xa92f('0x10')](_0x370b07,_0x239114)[_0xa92f('0x11')](function(_0x5d6289){logger[_0xa92f('0x12')]('SmsInteraction,\x20%s,\x20%s',_0x468267,'request\x20sent');logger[_0xa92f('0x13')](_0xa92f('0x14'),_0x468267,_0xa92f('0x15'),JSON['stringify'](_0x5d6289));if(_0x5d6289['error']){if(_0x5d6289[_0xa92f('0x16')][_0xa92f('0x17')]===0x1f4){logger[_0xa92f('0x16')](_0xa92f('0x18'),_0x468267,_0x5d6289[_0xa92f('0x16')]['message']);return _0x5f6816(_0x5d6289[_0xa92f('0x16')][_0xa92f('0x19')]);}logger['error']('SmsInteraction,\x20%s,\x20%s',_0x468267,_0x5d6289[_0xa92f('0x16')][_0xa92f('0x19')]);return _0x5f34f2(_0x5d6289['error'][_0xa92f('0x19')]);}else{logger['info']('SmsInteraction,\x20%s,\x20%s',_0x468267,_0xa92f('0x15'));_0x5f34f2(_0x5d6289[_0xa92f('0x1a')][_0xa92f('0x19')]);}})[_0xa92f('0x1b')](function(_0x3f584e){logger[_0xa92f('0x16')](_0xa92f('0x18'),_0x468267,_0x3f584e);_0x5f6816(_0x3f584e);});});}exports[_0xa92f('0x1c')]=function(_0x5bd832){var _0x2ddb3f=this;return new Promise(function(_0x5273e0,_0x9909aa){return db[_0xa92f('0x1d')][_0xa92f('0x1e')](_0x5bd832[_0xa92f('0x1f')],{'raw':_0x5bd832['options']?_0x5bd832[_0xa92f('0x20')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5bd832['options']?_0x5bd832[_0xa92f('0x20')][_0xa92f('0x21')]||null:null,'attributes':_0x5bd832[_0xa92f('0x20')]?_0x5bd832[_0xa92f('0x20')][_0xa92f('0x22')]||null:null,'limit':_0x5bd832[_0xa92f('0x20')]?_0x5bd832[_0xa92f('0x20')][_0xa92f('0x23')]||null:null})['then'](function(_0x3bb233){logger[_0xa92f('0x12')](_0xa92f('0x1c'),_0x5bd832);logger[_0xa92f('0x13')](_0xa92f('0x1c'),_0x5bd832,JSON['stringify'](_0x3bb233));_0x5273e0(_0x3bb233);})[_0xa92f('0x1b')](function(_0x451b73){logger['error'](_0xa92f('0x1c'),_0x451b73[_0xa92f('0x19')],_0x5bd832);_0x9909aa(_0x2ddb3f['error'](0x1f4,_0x451b73[_0xa92f('0x19')]));});});};exports[_0xa92f('0x24')]=function(_0x40dc95){return new Promise(function(_0x1d4a2c,_0x18e4e8){return db[_0xa92f('0x1d')]['find']({'where':_0x40dc95[_0xa92f('0x20')]?_0x40dc95[_0xa92f('0x20')][_0xa92f('0x21')]||null:null})[_0xa92f('0x11')](function(_0xe40ded){if(_0xe40ded){return _0xe40ded[_0xa92f('0x25')](_0x40dc95[_0xa92f('0x1f')][_0xa92f('0x26')],_[_0xa92f('0x27')](_0x40dc95['body'],[_0xa92f('0x26'),'id'])||{});}})[_0xa92f('0x28')](function(_0x2f5a17){logger['info']('AddTags',_0x40dc95);logger[_0xa92f('0x13')](_0xa92f('0x29'),_0x40dc95,JSON[_0xa92f('0x2a')](_0x2f5a17));_0x1d4a2c(_0x2f5a17);})[_0xa92f('0x1b')](function(_0x1efbf0){logger[_0xa92f('0x16')](_0xa92f('0x29'),_0x1efbf0[_0xa92f('0x19')],_0x40dc95);_0x18e4e8(_this[_0xa92f('0x16')](0x1f4,_0x1efbf0['message']));});});}; \ No newline at end of file +var _0xe64c=['addTags','ids','spread','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','redis','defaults','localhost','socket.io-emitter','./smsInteraction.socket','register','request','then','info','debug','SmsInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','SmsInteraction,\x20%s,\x20%s','message','result','catch','SmsInteraction','update','body','options','where','attributes','limit','UpdateSmsInteraction','stringify','AddTagsToSmsInteraction','find'];(function(_0x4be3ec,_0x218441){var _0x44b79f=function(_0x56d3c1){while(--_0x56d3c1){_0x4be3ec['push'](_0x4be3ec['shift']());}};_0x44b79f(++_0x218441);}(_0xe64c,0x187));var _0xce64=function(_0x4f7003,_0x39ed50){_0x4f7003=_0x4f7003-0x0;var _0x12597f=_0xe64c[_0x4f7003];return _0x12597f;};'use strict';var _=require(_0xce64('0x0'));var util=require(_0xce64('0x1'));var moment=require(_0xce64('0x2'));var BPromise=require(_0xce64('0x3'));var rs=require(_0xce64('0x4'));var fs=require('fs');var Redis=require(_0xce64('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xce64('0x6'));var logger=require(_0xce64('0x7'))('rpc');var config=require(_0xce64('0x8'));var jayson=require(_0xce64('0x9'));var client=jayson['client']['http']({'port':0x232a});config[_0xce64('0xa')]=_[_0xce64('0xb')](config['redis'],{'host':_0xce64('0xc'),'port':0x18eb});var socket=require(_0xce64('0xd'))(new Redis(config[_0xce64('0xa')]));require(_0xce64('0xe'))[_0xce64('0xf')](socket);function respondWithRpcPromise(_0x51689f,_0x19c246,_0x28cd6e){return new BPromise(function(_0x355720,_0x1e13c7){return client[_0xce64('0x10')](_0x51689f,_0x28cd6e)[_0xce64('0x11')](function(_0x443e72){logger[_0xce64('0x12')]('SmsInteraction,\x20%s,\x20%s',_0x19c246,'request\x20sent');logger[_0xce64('0x13')](_0xce64('0x14'),_0x19c246,_0xce64('0x15'),JSON['stringify'](_0x443e72));if(_0x443e72[_0xce64('0x16')]){if(_0x443e72[_0xce64('0x16')][_0xce64('0x17')]===0x1f4){logger['error'](_0xce64('0x18'),_0x19c246,_0x443e72[_0xce64('0x16')][_0xce64('0x19')]);return _0x1e13c7(_0x443e72[_0xce64('0x16')][_0xce64('0x19')]);}logger['error']('SmsInteraction,\x20%s,\x20%s',_0x19c246,_0x443e72[_0xce64('0x16')][_0xce64('0x19')]);return _0x355720(_0x443e72[_0xce64('0x16')][_0xce64('0x19')]);}else{logger[_0xce64('0x12')]('SmsInteraction,\x20%s,\x20%s',_0x19c246,_0xce64('0x15'));_0x355720(_0x443e72[_0xce64('0x1a')][_0xce64('0x19')]);}})[_0xce64('0x1b')](function(_0x3e6a7b){logger[_0xce64('0x16')](_0xce64('0x18'),_0x19c246,_0x3e6a7b);_0x1e13c7(_0x3e6a7b);});});}exports['UpdateSmsInteraction']=function(_0x1de040){var _0x375535=this;return new Promise(function(_0x597c8,_0x1c2598){return db[_0xce64('0x1c')][_0xce64('0x1d')](_0x1de040[_0xce64('0x1e')],{'raw':_0x1de040[_0xce64('0x1f')]?_0x1de040['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1de040['options']?_0x1de040[_0xce64('0x1f')][_0xce64('0x20')]||null:null,'attributes':_0x1de040['options']?_0x1de040['options'][_0xce64('0x21')]||null:null,'limit':_0x1de040[_0xce64('0x1f')]?_0x1de040['options'][_0xce64('0x22')]||null:null})['then'](function(_0x5c7e64){logger['info'](_0xce64('0x23'),_0x1de040);logger[_0xce64('0x13')](_0xce64('0x23'),_0x1de040,JSON[_0xce64('0x24')](_0x5c7e64));_0x597c8(_0x5c7e64);})[_0xce64('0x1b')](function(_0x3491cb){logger[_0xce64('0x16')](_0xce64('0x23'),_0x3491cb['message'],_0x1de040);_0x1c2598(_0x375535[_0xce64('0x16')](0x1f4,_0x3491cb['message']));});});};exports[_0xce64('0x25')]=function(_0x40be12){return new Promise(function(_0x3481f0,_0x3ed14a){return db[_0xce64('0x1c')][_0xce64('0x26')]({'where':_0x40be12[_0xce64('0x1f')]?_0x40be12[_0xce64('0x1f')]['where']||null:null})[_0xce64('0x11')](function(_0x5481eb){if(_0x5481eb){return _0x5481eb[_0xce64('0x27')](_0x40be12[_0xce64('0x1e')][_0xce64('0x28')],_['omit'](_0x40be12[_0xce64('0x1e')],[_0xce64('0x28'),'id'])||{});}})[_0xce64('0x29')](function(_0x2194a2){logger[_0xce64('0x12')]('AddTags',_0x40be12);logger[_0xce64('0x13')](_0xce64('0x2a'),_0x40be12,JSON[_0xce64('0x24')](_0x2194a2));_0x3481f0(_0x2194a2);})[_0xce64('0x1b')](function(_0x19f681){logger[_0xce64('0x16')](_0xce64('0x2a'),_0x19f681[_0xce64('0x19')],_0x40be12);_0x3ed14a(_this[_0xce64('0x16')](0x1f4,_0x19f681['message']));});});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.socket.js b/server/api/smsInteraction/smsInteraction.socket.js index 96cc100..12e4daf 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 _0x3fc9=['removeListener','register','length','./smsInteraction.events','save','update'];(function(_0x57fd40,_0x9de24f){var _0x52bb76=function(_0x55f232){while(--_0x55f232){_0x57fd40['push'](_0x57fd40['shift']());}};_0x52bb76(++_0x9de24f);}(_0x3fc9,0x9f));var _0x93fc=function(_0x687ce7,_0x39db4f){_0x687ce7=_0x687ce7-0x0;var _0x8bb835=_0x3fc9[_0x687ce7];return _0x8bb835;};'use strict';var SmsInteractionEvents=require(_0x93fc('0x0'));var events=[_0x93fc('0x1'),'remove',_0x93fc('0x2')];function createListener(_0x2b708e,_0x1ae014){return function(_0x32b78c){_0x1ae014['emit'](_0x2b708e,_0x32b78c);};}function removeListener(_0x46d87c,_0x1ab774){return function(){SmsInteractionEvents[_0x93fc('0x3')](_0x46d87c,_0x1ab774);};}exports[_0x93fc('0x4')]=function(_0x35fb8b){for(var _0x34f599=0x0,_0x3e8ffb=events[_0x93fc('0x5')];_0x34f599<_0x3e8ffb;_0x34f599++){var _0x5d3d9c=events[_0x34f599];var _0x3719d9=createListener('smsInteraction:'+_0x5d3d9c,_0x35fb8b);SmsInteractionEvents['on'](_0x5d3d9c,_0x3719d9);}}; \ No newline at end of file +var _0x8817=['./smsInteraction.events','remove','update','emit','removeListener','register','length','smsInteraction:'];(function(_0x2db8ec,_0x24a75b){var _0x11fdc7=function(_0x58a9b7){while(--_0x58a9b7){_0x2db8ec['push'](_0x2db8ec['shift']());}};_0x11fdc7(++_0x24a75b);}(_0x8817,0xc0));var _0x7881=function(_0x492156,_0x42ef81){_0x492156=_0x492156-0x0;var _0xbaed83=_0x8817[_0x492156];return _0xbaed83;};'use strict';var SmsInteractionEvents=require(_0x7881('0x0'));var events=['save',_0x7881('0x1'),_0x7881('0x2')];function createListener(_0x262eb7,_0x298a59){return function(_0x48e78d){_0x298a59[_0x7881('0x3')](_0x262eb7,_0x48e78d);};}function removeListener(_0x115341,_0x136739){return function(){SmsInteractionEvents[_0x7881('0x4')](_0x115341,_0x136739);};}exports[_0x7881('0x5')]=function(_0x2d8f3e){for(var _0x31c70f=0x0,_0x36b6fb=events[_0x7881('0x6')];_0x31c70f<_0x36b6fb;_0x31c70f++){var _0x1aa931=events[_0x31c70f];var _0x282a73=createListener(_0x7881('0x7')+_0x1aa931,_0x2d8f3e);SmsInteractionEvents['on'](_0x1aa931,_0x282a73);}}; \ No newline at end of file diff --git a/server/api/smsMessage/index.js b/server/api/smsMessage/index.js index 54200be..e2d6d8c 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 _0xa8fd=['/:id/reject','reject','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','post','tracked','sms','smsmessage:create','/:id/status','status','put','/:id/accept'];(function(_0x39c920,_0x70a7ee){var _0x585efe=function(_0x5b7ca6){while(--_0x5b7ca6){_0x39c920['push'](_0x39c920['shift']());}};_0x585efe(++_0x70a7ee);}(_0xa8fd,0x69));var _0xda8f=function(_0x11e6d5,_0x4f072b){_0x11e6d5=_0x11e6d5-0x0;var _0x44708f=_0xa8fd[_0x11e6d5];return _0x44708f;};'use strict';var multer=require('multer');var util=require(_0xda8f('0x0'));var path=require(_0xda8f('0x1'));var timeout=require(_0xda8f('0x2'));var express=require(_0xda8f('0x3'));var router=express[_0xda8f('0x4')]();var fs_extra=require(_0xda8f('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xda8f('0x6'));var config=require(_0xda8f('0x7'));var controller=require('./smsMessage.controller');router[_0xda8f('0x8')]('/',auth[_0xda8f('0x9')](),controller[_0xda8f('0xa')]);router[_0xda8f('0x8')]('/describe',auth[_0xda8f('0x9')](),controller['describe']);router['get'](_0xda8f('0xb'),auth[_0xda8f('0x9')](),controller['show']);router[_0xda8f('0xc')]('/',auth[_0xda8f('0x9')](),interaction[_0xda8f('0xd')](_0xda8f('0xe'),_0xda8f('0xf')),controller['create']);router[_0xda8f('0xc')](_0xda8f('0x10'),controller[_0xda8f('0x11')]);router[_0xda8f('0x12')](_0xda8f('0xb'),auth[_0xda8f('0x9')](),controller['update']);router[_0xda8f('0x12')](_0xda8f('0x13'),auth[_0xda8f('0x9')](),controller['accept']);router[_0xda8f('0x12')](_0xda8f('0x14'),auth[_0xda8f('0x9')](),controller[_0xda8f('0x15')]);router[_0xda8f('0x16')](_0xda8f('0xb'),auth[_0xda8f('0x9')](),controller[_0xda8f('0x17')]);module[_0xda8f('0x18')]=router; \ No newline at end of file +var _0x5b0f=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/describe','describe','show','post','tracked','sms','smsmessage:create','create','/:id/status','status','put','/:id','/:id/accept','/:id/reject','reject','destroy','exports','util','connect-timeout'];(function(_0x2b8c77,_0x4d0fb0){var _0x3288a9=function(_0x42ada2){while(--_0x42ada2){_0x2b8c77['push'](_0x2b8c77['shift']());}};_0x3288a9(++_0x4d0fb0);}(_0x5b0f,0xde));var _0xf5b0=function(_0xe1fcfb,_0x24fcee){_0xe1fcfb=_0xe1fcfb-0x0;var _0x21528f=_0x5b0f[_0xe1fcfb];return _0x21528f;};'use strict';var multer=require('multer');var util=require(_0xf5b0('0x0'));var path=require('path');var timeout=require(_0xf5b0('0x1'));var express=require(_0xf5b0('0x2'));var router=express[_0xf5b0('0x3')]();var fs_extra=require(_0xf5b0('0x4'));var auth=require(_0xf5b0('0x5'));var interaction=require(_0xf5b0('0x6'));var config=require(_0xf5b0('0x7'));var controller=require('./smsMessage.controller');router['get']('/',auth[_0xf5b0('0x8')](),controller[_0xf5b0('0x9')]);router[_0xf5b0('0xa')](_0xf5b0('0xb'),auth['isAuthenticated'](),controller[_0xf5b0('0xc')]);router[_0xf5b0('0xa')]('/:id',auth[_0xf5b0('0x8')](),controller[_0xf5b0('0xd')]);router[_0xf5b0('0xe')]('/',auth['isAuthenticated'](),interaction[_0xf5b0('0xf')](_0xf5b0('0x10'),_0xf5b0('0x11')),controller[_0xf5b0('0x12')]);router['post'](_0xf5b0('0x13'),controller[_0xf5b0('0x14')]);router[_0xf5b0('0x15')](_0xf5b0('0x16'),auth[_0xf5b0('0x8')](),controller['update']);router[_0xf5b0('0x15')](_0xf5b0('0x17'),auth[_0xf5b0('0x8')](),controller['accept']);router['put'](_0xf5b0('0x18'),auth[_0xf5b0('0x8')](),controller[_0xf5b0('0x19')]);router['delete'](_0xf5b0('0x16'),auth[_0xf5b0('0x8')](),controller[_0xf5b0('0x1a')]);module[_0xf5b0('0x1b')]=router; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.attributes.js b/server/api/smsMessage/smsMessage.attributes.js index bc40e3c..15d1370 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 _0x255c=['DATE','sequelize','exports','BOOLEAN','ENUM','STRING'];(function(_0x17aa3e,_0x3a128b){var _0x124b1d=function(_0x43d94b){while(--_0x43d94b){_0x17aa3e['push'](_0x17aa3e['shift']());}};_0x124b1d(++_0x3a128b);}(_0x255c,0xfd));var _0xc255=function(_0xf9da0b,_0x2e3ee9){_0xf9da0b=_0xf9da0b-0x0;var _0xe5c7c7=_0x255c[_0xf9da0b];return _0xe5c7c7;};'use strict';var Sequelize=require(_0xc255('0x0'));module[_0xc255('0x1')]={'body':{'type':Sequelize['TEXT']('medium'),'allowNull':![]},'read':{'type':Sequelize[_0xc255('0x2')],'defaultValue':![]},'direction':{'type':Sequelize[_0xc255('0x3')]('in','out'),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize['STRING'](0xbe)},'phone':{'type':Sequelize[_0xc255('0x4')]},'readAt':{'type':Sequelize[_0xc255('0x5')]},'secret':{'type':Sequelize[_0xc255('0x2')],'defaultValue':![]},'providerName':{'type':Sequelize[_0xc255('0x4')]},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0xb1ed=['BOOLEAN','TEXT','ENUM','out','STRING','DATE'];(function(_0x3feaf7,_0x5474f8){var _0x548ebf=function(_0x58af2f){while(--_0x58af2f){_0x3feaf7['push'](_0x3feaf7['shift']());}};_0x548ebf(++_0x5474f8);}(_0xb1ed,0x8b));var _0xdb1e=function(_0x56f0b2,_0xdcf225){_0x56f0b2=_0x56f0b2-0x0;var _0x194f36=_0xb1ed[_0x56f0b2];return _0x194f36;};'use strict';var Sequelize=require('sequelize');module['exports']={'body':{'type':Sequelize[_0xdb1e('0x0')]('medium'),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0xdb1e('0x1')]('in',_0xdb1e('0x2')),'defaultValue':_0xdb1e('0x2'),'allowNull':![]},'messageId':{'type':Sequelize[_0xdb1e('0x3')](0xbe)},'phone':{'type':Sequelize[_0xdb1e('0x3')]},'readAt':{'type':Sequelize[_0xdb1e('0x4')]},'secret':{'type':Sequelize[_0xdb1e('0x5')],'defaultValue':![]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0xdb1e('0x0')]}}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.controller.js b/server/api/smsMessage/smsMessage.controller.js index 0bb144d..61ae9b9 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 _0x6dc0=['Sequelize','QueryTypes','SELECT','contact','User','email','internal','manual','interface','SIP/%s','channel','motionChannel','event','EventManager','acceptmessage','SmsInteraction','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','sequelize','fullname','rejectmessage','SmsAccountId','received\x20delivery\x20report\x20from','MessageSid','messageId','SmsAccount,\x20%s,\x20%s,\x20%s','twilio','plivo','MessageUUID','indexOf','delivered','Status','inspect','infobip','results','groupName','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','localhost','register','jayson/promise','client','http','request','info','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','error','code','message','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','end','stack','send','index','map','SmsMessage','rawAttributes','fieldName','type','key','model','name','query','keys','filters','intersection','attributes','fields','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','findAll','rows','include','find','catch','create','body','describe','sms-interactions','accept','sms','readAt','format','UserId','user','agent','params','get','SmsInteractionId','read1stAt','YYYY-MM-DD\x20HH:mm:ss','interaction','[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','stringify','null','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId'];(function(_0xe0cc29,_0x438420){var _0x3ca3e2=function(_0x2efca0){while(--_0x2efca0){_0xe0cc29['push'](_0xe0cc29['shift']());}};_0x3ca3e2(++_0x438420);}(_0x6dc0,0xb6));var _0x06dc=function(_0x5ac194,_0x22d75b){_0x5ac194=_0x5ac194-0x0;var _0xd7816c=_0x6dc0[_0x5ac194];return _0xd7816c;};'use strict';var emlformat=require(_0x06dc('0x0'));var rimraf=require(_0x06dc('0x1'));var zipdir=require(_0x06dc('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x06dc('0x3'));var moment=require(_0x06dc('0x4'));var BPromise=require(_0x06dc('0x5'));var Mustache=require(_0x06dc('0x6'));var util=require('util');var path=require(_0x06dc('0x7'));var sox=require(_0x06dc('0x8'));var csv=require('to-csv');var ejs=require(_0x06dc('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x06dc('0xa'));var squel=require(_0x06dc('0xb'));var crypto=require(_0x06dc('0xc'));var jsforce=require(_0x06dc('0xd'));var deskjs=require(_0x06dc('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x06dc('0xf'));var authService=require(_0x06dc('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x06dc('0x11'));var hardwareService=require(_0x06dc('0x12'));var logger=require(_0x06dc('0x13'))(_0x06dc('0x14'));var utils=require('../../config/utils');var config=require(_0x06dc('0x15'));var licenseUtil=require(_0x06dc('0x16'));var db=require('../../mysqldb')['db'];config['redis']=_['defaults'](config['redis'],{'host':_0x06dc('0x17'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./smsMessage.socket')[_0x06dc('0x18')](socket);var jayson=require(_0x06dc('0x19'));var client=jayson[_0x06dc('0x1a')]['http']({'port':0x232c});var client9002=jayson[_0x06dc('0x1a')][_0x06dc('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x145a07,_0x3da2c5,_0x58dc33,_0x17411e){return new BPromise(function(_0x30c1c5,_0x1d5e6b){var _0x2478b9=_0x17411e||client;return _0x2478b9[_0x06dc('0x1c')](_0x145a07,_0x58dc33)['then'](function(_0x1daaa8){logger[_0x06dc('0x1d')](_0x06dc('0x1e'),_0x3da2c5,_0x06dc('0x1f'));logger[_0x06dc('0x20')](_0x06dc('0x21'),_0x3da2c5,'request\x20sent',JSON['stringify'](_0x1daaa8));if(_0x1daaa8[_0x06dc('0x22')]){if(_0x1daaa8['error'][_0x06dc('0x23')]===0x1f4){logger['error'](_0x06dc('0x1e'),_0x3da2c5,_0x1daaa8[_0x06dc('0x22')][_0x06dc('0x24')]);return _0x1d5e6b(_0x1daaa8[_0x06dc('0x22')][_0x06dc('0x24')]);}logger[_0x06dc('0x22')]('SmsMessage,\x20%s,\x20%s',_0x3da2c5,_0x1daaa8['error'][_0x06dc('0x24')]);return _0x30c1c5(_0x1daaa8[_0x06dc('0x22')]['message']);}else{logger[_0x06dc('0x1d')]('SmsMessage,\x20%s,\x20%s',_0x3da2c5,'request\x20sent');_0x30c1c5(_0x1daaa8['result']['message']);}})['catch'](function(_0xd3e42b){logger['error'](_0x06dc('0x1e'),_0x3da2c5,_0xd3e42b);_0x1d5e6b(_0xd3e42b);});});}function respondWithStatusCode(_0x56819b,_0x52afcf){_0x52afcf=_0x52afcf||0xcc;return function(_0xa85ffc){if(_0xa85ffc){return _0x56819b[_0x06dc('0x25')](_0x52afcf);}return _0x56819b['status'](_0x52afcf)['end']();};}function respondWithResult(_0x263b5c,_0x4e3362){_0x4e3362=_0x4e3362||0xc8;return function(_0x36c138){if(_0x36c138){return _0x263b5c[_0x06dc('0x26')](_0x4e3362)[_0x06dc('0x27')](_0x36c138);}};}function respondWithFilteredResult(_0xfd5611,_0x1d98b8){return function(_0x31f5cd){if(_0x31f5cd){var _0x164554=typeof _0x1d98b8[_0x06dc('0x28')]===_0x06dc('0x29')&&typeof _0x1d98b8[_0x06dc('0x2a')]===_0x06dc('0x29');var _0x285bb4=_0x31f5cd[_0x06dc('0x2b')];var _0x560d80=_0x164554?0x0:_0x1d98b8['offset'];var _0x138e6b=_0x164554?_0x31f5cd[_0x06dc('0x2b')]:_0x1d98b8[_0x06dc('0x28')]+_0x1d98b8[_0x06dc('0x2a')];var _0x289861;if(_0x138e6b>=_0x285bb4){_0x138e6b=_0x285bb4;_0x289861=0xc8;}else{_0x289861=0xce;}_0xfd5611[_0x06dc('0x26')](_0x289861);return _0xfd5611[_0x06dc('0x2c')](_0x06dc('0x2d'),_0x560d80+'-'+_0x138e6b+'/'+_0x285bb4)[_0x06dc('0x27')](_0x31f5cd);}return null;};}function patchUpdates(_0x389198){return function(_0x5eb996){try{jsonpatch[_0x06dc('0x2e')](_0x5eb996,_0x389198,!![]);}catch(_0x261c91){return BPromise[_0x06dc('0x2f')](_0x261c91);}return _0x5eb996[_0x06dc('0x30')]();};}function saveUpdates(_0x237d67,_0x4acc38){return function(_0x428a33){if(_0x428a33){return _0x428a33[_0x06dc('0x31')](_0x237d67)[_0x06dc('0x32')](function(_0x58ff88){return _0x58ff88;});}return null;};}function removeEntity(_0x363901,_0x123361){return function(_0x5ca682){if(_0x5ca682){return _0x5ca682[_0x06dc('0x33')]()[_0x06dc('0x32')](function(){_0x363901['status'](0xcc)[_0x06dc('0x34')]();});}};}function handleEntityNotFound(_0x361452,_0x15a02c){return function(_0x185e43){if(!_0x185e43){_0x361452[_0x06dc('0x25')](0x194);}return _0x185e43;};}function handleError(_0x400692,_0x44adce){_0x44adce=_0x44adce||0x1f4;return function(_0x47287b){logger[_0x06dc('0x22')](_0x47287b[_0x06dc('0x35')]);if(_0x47287b['name']){delete _0x47287b['name'];}_0x400692['status'](_0x44adce)[_0x06dc('0x36')](_0x47287b);};}exports[_0x06dc('0x37')]=function(_0x1bd2c9,_0xb03418){var _0x511ba9={},_0x51709b={},_0x525595={'count':0x0,'rows':[]};var _0x2580be=_[_0x06dc('0x38')](db[_0x06dc('0x39')][_0x06dc('0x3a')],function(_0xe65d69){return{'name':_0xe65d69[_0x06dc('0x3b')],'type':_0xe65d69[_0x06dc('0x3c')][_0x06dc('0x3d')]};});_0x51709b[_0x06dc('0x3e')]=_[_0x06dc('0x38')](_0x2580be,_0x06dc('0x3f'));_0x51709b[_0x06dc('0x40')]=_[_0x06dc('0x41')](_0x1bd2c9[_0x06dc('0x40')]);_0x51709b[_0x06dc('0x42')]=_[_0x06dc('0x43')](_0x51709b[_0x06dc('0x3e')],_0x51709b[_0x06dc('0x40')]);_0x511ba9[_0x06dc('0x44')]=_['intersection'](_0x51709b['model'],qs[_0x06dc('0x45')](_0x1bd2c9[_0x06dc('0x40')][_0x06dc('0x45')]));_0x511ba9[_0x06dc('0x44')]=_0x511ba9[_0x06dc('0x44')]['length']?_0x511ba9[_0x06dc('0x44')]:_0x51709b[_0x06dc('0x3e')];if(!_0x1bd2c9[_0x06dc('0x40')]['hasOwnProperty'](_0x06dc('0x46'))){_0x511ba9[_0x06dc('0x2a')]=qs['limit'](_0x1bd2c9[_0x06dc('0x40')][_0x06dc('0x2a')]);_0x511ba9[_0x06dc('0x28')]=qs[_0x06dc('0x28')](_0x1bd2c9['query']['offset']);}_0x511ba9[_0x06dc('0x47')]=qs[_0x06dc('0x48')](_0x1bd2c9[_0x06dc('0x40')]['sort']);_0x511ba9[_0x06dc('0x49')]=qs[_0x06dc('0x42')](_[_0x06dc('0x4a')](_0x1bd2c9[_0x06dc('0x40')],_0x51709b[_0x06dc('0x42')]),_0x2580be);if(_0x1bd2c9['query'][_0x06dc('0x4b')]){_0x511ba9['where']=_['merge'](_0x511ba9[_0x06dc('0x49')],{'$or':_[_0x06dc('0x38')](_0x2580be,function(_0x36dcfc){if(_0x36dcfc[_0x06dc('0x3c')]!==_0x06dc('0x4c')){var _0x4e316d={};_0x4e316d[_0x36dcfc[_0x06dc('0x3f')]]={'$like':'%'+_0x1bd2c9[_0x06dc('0x40')][_0x06dc('0x4b')]+'%'};return _0x4e316d;}})});}_0x511ba9=_[_0x06dc('0x4d')]({},_0x511ba9,_0x1bd2c9[_0x06dc('0x4e')]);var _0x1536d3={'where':_0x511ba9[_0x06dc('0x49')]};return db[_0x06dc('0x39')][_0x06dc('0x2b')](_0x1536d3)[_0x06dc('0x32')](function(_0x3680ad){_0x525595['count']=_0x3680ad;if(_0x1bd2c9[_0x06dc('0x40')][_0x06dc('0x4f')]){_0x511ba9['include']=[{'all':!![]}];}return db[_0x06dc('0x39')][_0x06dc('0x50')](_0x511ba9);})[_0x06dc('0x32')](function(_0x5a3d9d){_0x525595[_0x06dc('0x51')]=_0x5a3d9d;return _0x525595;})[_0x06dc('0x32')](respondWithFilteredResult(_0xb03418,_0x511ba9))['catch'](handleError(_0xb03418,null));};exports['show']=function(_0x5a7b20,_0x65fd04){var _0x401edc={'raw':!![],'where':{'id':_0x5a7b20['params']['id']}},_0x471d1e={};_0x471d1e['model']=_[_0x06dc('0x41')](db[_0x06dc('0x39')][_0x06dc('0x3a')]);_0x471d1e[_0x06dc('0x40')]=_[_0x06dc('0x41')](_0x5a7b20['query']);_0x471d1e[_0x06dc('0x42')]=_[_0x06dc('0x43')](_0x471d1e[_0x06dc('0x3e')],_0x471d1e['query']);_0x401edc[_0x06dc('0x44')]=_[_0x06dc('0x43')](_0x471d1e[_0x06dc('0x3e')],qs[_0x06dc('0x45')](_0x5a7b20[_0x06dc('0x40')][_0x06dc('0x45')]));_0x401edc[_0x06dc('0x44')]=_0x401edc[_0x06dc('0x44')]['length']?_0x401edc[_0x06dc('0x44')]:_0x471d1e['model'];if(_0x5a7b20[_0x06dc('0x40')]['includeAll']){_0x401edc[_0x06dc('0x52')]=[{'all':!![]}];}_0x401edc=_['merge']({},_0x401edc,_0x5a7b20[_0x06dc('0x4e')]);return db[_0x06dc('0x39')][_0x06dc('0x53')](_0x401edc)[_0x06dc('0x32')](handleEntityNotFound(_0x65fd04,null))[_0x06dc('0x32')](respondWithResult(_0x65fd04,null))[_0x06dc('0x54')](handleError(_0x65fd04,null));};exports[_0x06dc('0x55')]=function(_0x5545db,_0x2c692e){return db[_0x06dc('0x39')][_0x06dc('0x55')](_0x5545db['body'],{})['then'](respondWithResult(_0x2c692e,0xc9))[_0x06dc('0x54')](handleError(_0x2c692e,null));};exports[_0x06dc('0x31')]=function(_0x42fcbf,_0x4bebbc){if(_0x42fcbf[_0x06dc('0x56')]['id']){delete _0x42fcbf[_0x06dc('0x56')]['id'];}return db[_0x06dc('0x39')][_0x06dc('0x53')]({'where':{'id':_0x42fcbf['params']['id']}})[_0x06dc('0x32')](handleEntityNotFound(_0x4bebbc,null))[_0x06dc('0x32')](saveUpdates(_0x42fcbf[_0x06dc('0x56')],null))[_0x06dc('0x32')](respondWithResult(_0x4bebbc,null))[_0x06dc('0x54')](handleError(_0x4bebbc,null));};exports[_0x06dc('0x33')]=function(_0x31b371,_0x72c52f){return db[_0x06dc('0x39')][_0x06dc('0x53')]({'where':{'id':_0x31b371['params']['id']}})[_0x06dc('0x32')](handleEntityNotFound(_0x72c52f,null))[_0x06dc('0x32')](removeEntity(_0x72c52f,null))[_0x06dc('0x54')](handleError(_0x72c52f,null));};exports['describe']=function(_0x5336d2,_0x1cfacd){return db[_0x06dc('0x39')][_0x06dc('0x57')]()[_0x06dc('0x32')](respondWithResult(_0x1cfacd,null))[_0x06dc('0x54')](handleError(_0x1cfacd,null));};var interaction_log=require(_0x06dc('0x13'))(_0x06dc('0x58'));exports[_0x06dc('0x59')]=function(_0x1589dd,_0x45cf22,_0x155cfa){var _0x2fddb8={'agent':{},'channel':_0x06dc('0x5a')};if(_0x1589dd['body']['id']){delete _0x1589dd['body']['id'];}_0x1589dd[_0x06dc('0x56')]['read']=!![];_0x1589dd[_0x06dc('0x56')][_0x06dc('0x5b')]=moment()[_0x06dc('0x5c')]('YYYY-MM-DD\x20HH:mm:ss');_0x1589dd[_0x06dc('0x56')][_0x06dc('0x5d')]=_0x1589dd[_0x06dc('0x56')][_0x06dc('0x5d')]||_0x1589dd[_0x06dc('0x5e')]['id'];_0x2fddb8[_0x06dc('0x5f')]['id']=_0x1589dd[_0x06dc('0x56')]['UserId'];return db[_0x06dc('0x39')]['find']({'where':{'id':_0x1589dd[_0x06dc('0x60')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x45cf22,null))[_0x06dc('0x32')](saveUpdates(_0x1589dd[_0x06dc('0x56')],null))['then'](function(_0x2fb1ac){if(_0x2fb1ac){_0x2fddb8['message']=_0x2fb1ac[_0x06dc('0x61')]({'plain':!![]});return db['SmsInteraction']['find']({'where':{'id':_0x2fb1ac[_0x06dc('0x62')]}});}return null;})['then'](handleEntityNotFound(_0x45cf22,null))[_0x06dc('0x32')](function(_0x1a359b){if(_0x1a359b){return _0x1a359b[_0x06dc('0x31')]({'UserId':_0x1589dd[_0x06dc('0x56')][_0x06dc('0x5d')],'read1stAt':_['isNil'](_0x1a359b[_0x06dc('0x63')])?moment()[_0x06dc('0x5c')](_0x06dc('0x64')):undefined});}return null;})[_0x06dc('0x32')](function(_0x18b99c){if(_0x18b99c){_0x2fddb8[_0x06dc('0x65')]=_0x18b99c[_0x06dc('0x61')]({'plain':!![]});interaction_log['info'](_0x06dc('0x66'),_0x1589dd[_0x06dc('0x5e')]['id'],_0x1589dd[_0x06dc('0x5e')]['name'],_0x1589dd[_0x06dc('0x5e')][_0x06dc('0x67')],_0x2fddb8[_0x06dc('0x65')]['id'],_0x1589dd['body']?JSON[_0x06dc('0x68')](_0x1589dd['body']):_0x06dc('0x69'));return respondWithRpcPromise('AcceptMessage','acceptMessage',_0x2fddb8);}return null;})[_0x06dc('0x32')](function(_0x563eec){var _0x599c73=_0x06dc('0x6a')+_0x563eec['message'][_0x06dc('0x6b')];return db['sequelize']['query'](_0x599c73,{'type':db[_0x06dc('0x6c')][_0x06dc('0x6d')][_0x06dc('0x6e')],'raw':!![]})[_0x06dc('0x32')](function(_0x5046bb){return _0x5046bb;});})[_0x06dc('0x32')](function(_0x58d74a){if(_0x58d74a){_0x2fddb8[_0x06dc('0x24')][_0x06dc('0x6f')]=_0x58d74a[0x0];if(!_0x1589dd[_0x06dc('0x56')]['UserId'])return;return db[_0x06dc('0x70')]['find']({'where':{'id':_0x1589dd[_0x06dc('0x56')][_0x06dc('0x5d')],'role':_0x06dc('0x5f')},'attributes':['id',_0x06dc('0x3f'),'fullname',_0x06dc('0x71'),_0x06dc('0x72')],'raw':!![]});}return null;})[_0x06dc('0x32')](function(_0x4a040a){if(!_0x4a040a)return null;_0x2fddb8[_0x06dc('0x24')][_0x06dc('0x5f')]=_0x4a040a;return _0x2fddb8;})[_0x06dc('0x32')](function(_0x437776){if(_0x437776){if(_0x1589dd[_0x06dc('0x56')][_0x06dc('0x73')]){_0x2fddb8[_0x06dc('0x24')][_0x06dc('0x74')]=util[_0x06dc('0x5c')](_0x06dc('0x75'),_0x1589dd['user'][_0x06dc('0x3f')]);_0x2fddb8[_0x06dc('0x24')][_0x06dc('0x76')]=_0x2fddb8[_0x06dc('0x76')];_0x2fddb8[_0x06dc('0x24')][_0x06dc('0x77')]=_0x2fddb8[_0x06dc('0x76')];_0x2fddb8[_0x06dc('0x24')][_0x06dc('0x78')]=_0x06dc('0x59');return respondWithRpcPromise(_0x06dc('0x79'),_0x06dc('0x79'),{'event':_0x06dc('0x7a'),'message':_0x2fddb8[_0x06dc('0x24')]},client9002)[_0x06dc('0x32')](function(){return _0x2fddb8;});}return _0x2fddb8;}return null;})[_0x06dc('0x32')](respondWithResult(_0x45cf22,null))[_0x06dc('0x54')](handleError(_0x45cf22,null));};var interaction_log=require(_0x06dc('0x13'))(_0x06dc('0x58'));exports[_0x06dc('0x2f')]=function(_0x2b18a3,_0x41eb9c,_0x4e1cb0){var _0x51461f={'agent':{},'channel':'sms'};if(_0x2b18a3[_0x06dc('0x56')]['id']){delete _0x2b18a3[_0x06dc('0x56')]['id'];}_0x2b18a3[_0x06dc('0x56')]['UserId']=_0x2b18a3[_0x06dc('0x56')][_0x06dc('0x5d')]||_0x2b18a3[_0x06dc('0x5e')]['id'];_0x51461f[_0x06dc('0x5f')]['id']=_0x2b18a3[_0x06dc('0x56')]['UserId'];return db[_0x06dc('0x39')][_0x06dc('0x53')]({'where':{'id':_0x2b18a3[_0x06dc('0x60')]['id'],'UserId':null}})[_0x06dc('0x32')](handleEntityNotFound(_0x41eb9c,null))[_0x06dc('0x32')](function(_0x3ff649){if(_0x3ff649){_0x51461f[_0x06dc('0x24')]=_0x3ff649[_0x06dc('0x61')]({'plain':!![]});return db[_0x06dc('0x7b')][_0x06dc('0x53')]({'where':{'id':_0x3ff649[_0x06dc('0x62')]}});}return null;})[_0x06dc('0x32')](handleEntityNotFound(_0x41eb9c,null))['then'](function(_0x403780){if(_0x403780){_0x51461f['interaction']=_0x403780[_0x06dc('0x61')]({'plain':!![]});interaction_log[_0x06dc('0x1d')](_0x06dc('0x7c'),_0x2b18a3[_0x06dc('0x5e')]['id'],_0x2b18a3['user'][_0x06dc('0x3f')],_0x2b18a3[_0x06dc('0x5e')][_0x06dc('0x67')],_0x51461f['interaction']['id'],_0x2b18a3['body']?JSON[_0x06dc('0x68')](_0x2b18a3[_0x06dc('0x56')]):'null');return respondWithRpcPromise(_0x06dc('0x7d'),_0x06dc('0x7e'),_0x51461f);}return null;})[_0x06dc('0x32')](function(_0x510c34){var _0x1d0663='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x510c34[_0x06dc('0x24')][_0x06dc('0x6b')];return db[_0x06dc('0x7f')]['query'](_0x1d0663,{'type':db[_0x06dc('0x6c')][_0x06dc('0x6d')][_0x06dc('0x6e')],'raw':!![]})[_0x06dc('0x32')](function(_0xac40e0){return _0xac40e0;});})['then'](function(_0x291a5a){if(_0x291a5a){_0x51461f[_0x06dc('0x24')][_0x06dc('0x6f')]=_0x291a5a[0x0];if(!_0x2b18a3['body'][_0x06dc('0x5d')])return;return db[_0x06dc('0x70')][_0x06dc('0x53')]({'where':{'id':_0x2b18a3[_0x06dc('0x56')][_0x06dc('0x5d')],'role':_0x06dc('0x5f')},'attributes':['id',_0x06dc('0x3f'),_0x06dc('0x80'),_0x06dc('0x71'),_0x06dc('0x72')],'raw':!![]});}return null;})[_0x06dc('0x32')](function(_0x59ed3f){if(!_0x59ed3f)return null;_0x51461f['message']['agent']=_0x59ed3f;return _0x51461f;})[_0x06dc('0x32')](function(_0x2d93c9){if(_0x2d93c9){_0x2d93c9['message']['interface']=util[_0x06dc('0x5c')](_0x06dc('0x75'),_0x2b18a3[_0x06dc('0x5e')]['name']);_0x2d93c9['message'][_0x06dc('0x76')]=_0x51461f[_0x06dc('0x76')];_0x2d93c9[_0x06dc('0x24')]['motionChannel']=_0x51461f[_0x06dc('0x76')];_0x2d93c9[_0x06dc('0x24')][_0x06dc('0x78')]='reject';respondWithRpcPromise(_0x06dc('0x79'),_0x06dc('0x79'),{'event':_0x06dc('0x81'),'message':_0x2d93c9[_0x06dc('0x24')]},client9002);return _0x51461f;}return null;})[_0x06dc('0x32')](respondWithResult(_0x41eb9c,null))[_0x06dc('0x54')](handleError(_0x41eb9c,null));};exports[_0x06dc('0x26')]=function(_0x3a2e67,_0x4b179b,_0x2deacb){if(_0x3a2e67['body']['id']){delete _0x3a2e67[_0x06dc('0x56')]['id'];}var _0x13e808;return db['SmsMessage']['find']({'where':{'id':_0x3a2e67[_0x06dc('0x60')]['id']}})[_0x06dc('0x32')](handleEntityNotFound(_0x4b179b,null))[_0x06dc('0x32')](function(_0x1a83fc){if(_0x1a83fc){_0x13e808=_0x1a83fc;return db['SmsAccount'][_0x06dc('0x53')]({'where':{'id':_0x1a83fc[_0x06dc('0x82')]}});}})[_0x06dc('0x32')](handleEntityNotFound(_0x4b179b,null))['then'](function(_0xb04541){if(_0xb04541){logger['debug'](_0x06dc('0x21'),_0x06dc('0x26'),_0x06dc('0x83'),_0xb04541[_0x06dc('0x3c')],util['inspect'](_0x3a2e67[_0x06dc('0x56')],{'showHidden':![],'depth':null}));switch(_0xb04541['type']){case'twilio':if(_0x3a2e67['body']['MessageSid']&&_0x3a2e67[_0x06dc('0x56')][_0x06dc('0x84')]===_0x13e808[_0x06dc('0x85')]){return _0x13e808[_0x06dc('0x31')]({'read':!![]});}else{logger[_0x06dc('0x22')](_0x06dc('0x86'),_0x06dc('0x26'),_0x06dc('0x87'),util['inspect'](_0x3a2e67[_0x06dc('0x56')],{'showHidden':![],'depth':null}));}break;case _0x06dc('0x88'):if(_0x3a2e67['body'][_0x06dc('0x89')]&&_0x3a2e67[_0x06dc('0x56')]['MessageUUID']===_0x13e808['messageId']&&_[_0x06dc('0x8a')](['sent',_0x06dc('0x8b')],_0x3a2e67['body'][_0x06dc('0x8c')])>=0x0){return _0x13e808[_0x06dc('0x31')]({'read':!![]});}else{logger['error'](_0x06dc('0x86'),_0x06dc('0x26'),'plivio',util[_0x06dc('0x8d')](_0x3a2e67[_0x06dc('0x56')],{'showHidden':![],'depth':null}));}break;case _0x06dc('0x8e'):var _0x252aa4=_0x3a2e67[_0x06dc('0x56')][_0x06dc('0x8f')][0x0];if(_0x252aa4['status'][_0x06dc('0x90')]==='DELIVERED'){return _0x13e808[_0x06dc('0x31')]({'read':!![]});}else{logger[_0x06dc('0x22')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x06dc('0x26'),_0x06dc('0x8e'),util[_0x06dc('0x8d')](_0x3a2e67[_0x06dc('0x56')],{'showHidden':![],'depth':null}));}break;}return _0x13e808;}})[_0x06dc('0x32')](respondWithResult(_0x4b179b,null))['catch'](handleError(_0x4b179b,null));}; \ No newline at end of file +var _0xaf79=['include','rows','show','params','includeAll','create','body','find','destroy','describe','sms-interactions','sms','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','agent','get','SmsInteraction','SmsInteractionId','isNil','interaction','[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','null','AcceptMessage','acceptMessage','ContactId','QueryTypes','contact','User','fullname','email','internal','manual','interface','SIP/%s','channel','motionChannel','event','accept','EventManager','acceptmessage','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','RejectMessage','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','Sequelize','SELECT','SmsAccount','SmsAccountId','received\x20delivery\x20report\x20from','inspect','twilio','MessageSid','messageId','SmsAccount,\x20%s,\x20%s,\x20%s','plivo','MessageUUID','indexOf','sent','delivered','Status','plivio','infobip','results','groupName','DELIVERED','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./smsMessage.socket','register','jayson/promise','client','http','request','then','info','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','stack','name','send','index','map','SmsMessage','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filter','merge','type','VIRTUAL','options'];(function(_0x6c0603,_0x127f82){var _0x4ca675=function(_0x4643f7){while(--_0x4643f7){_0x6c0603['push'](_0x6c0603['shift']());}};_0x4ca675(++_0x127f82);}(_0xaf79,0xe4));var _0x9af7=function(_0x12c0fe,_0x469071){_0x12c0fe=_0x12c0fe-0x0;var _0x33333f=_0xaf79[_0x12c0fe];return _0x33333f;};'use strict';var emlformat=require(_0x9af7('0x0'));var rimraf=require(_0x9af7('0x1'));var zipdir=require(_0x9af7('0x2'));var jsonpatch=require(_0x9af7('0x3'));var rp=require(_0x9af7('0x4'));var moment=require(_0x9af7('0x5'));var BPromise=require(_0x9af7('0x6'));var Mustache=require(_0x9af7('0x7'));var util=require(_0x9af7('0x8'));var path=require(_0x9af7('0x9'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9af7('0xa'));var _=require(_0x9af7('0xb'));var squel=require(_0x9af7('0xc'));var crypto=require(_0x9af7('0xd'));var jsforce=require(_0x9af7('0xe'));var deskjs=require(_0x9af7('0xf'));var toCsv=require(_0x9af7('0x10'));var querystring=require(_0x9af7('0x11'));var Papa=require(_0x9af7('0x12'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x9af7('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9af7('0x14'));var logger=require(_0x9af7('0x15'))(_0x9af7('0x16'));var utils=require(_0x9af7('0x17'));var config=require(_0x9af7('0x18'));var licenseUtil=require(_0x9af7('0x19'));var db=require('../../mysqldb')['db'];config[_0x9af7('0x1a')]=_[_0x9af7('0x1b')](config[_0x9af7('0x1a')],{'host':_0x9af7('0x1c'),'port':0x18eb});var socket=require(_0x9af7('0x1d'))(new Redis(config[_0x9af7('0x1a')]));require(_0x9af7('0x1e'))[_0x9af7('0x1f')](socket);var jayson=require(_0x9af7('0x20'));var client=jayson[_0x9af7('0x21')][_0x9af7('0x22')]({'port':0x232c});var client9002=jayson[_0x9af7('0x21')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1ff2f5,_0x10d96b,_0x48feb1,_0x372991){return new BPromise(function(_0x1a6312,_0x336625){var _0x4de57f=_0x372991||client;return _0x4de57f[_0x9af7('0x23')](_0x1ff2f5,_0x48feb1)[_0x9af7('0x24')](function(_0xe74d23){logger[_0x9af7('0x25')](_0x9af7('0x26'),_0x10d96b,_0x9af7('0x27'));logger[_0x9af7('0x28')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x10d96b,'request\x20sent',JSON[_0x9af7('0x29')](_0xe74d23));if(_0xe74d23[_0x9af7('0x2a')]){if(_0xe74d23[_0x9af7('0x2a')][_0x9af7('0x2b')]===0x1f4){logger[_0x9af7('0x2a')](_0x9af7('0x26'),_0x10d96b,_0xe74d23[_0x9af7('0x2a')][_0x9af7('0x2c')]);return _0x336625(_0xe74d23[_0x9af7('0x2a')][_0x9af7('0x2c')]);}logger[_0x9af7('0x2a')](_0x9af7('0x26'),_0x10d96b,_0xe74d23[_0x9af7('0x2a')][_0x9af7('0x2c')]);return _0x1a6312(_0xe74d23[_0x9af7('0x2a')][_0x9af7('0x2c')]);}else{logger[_0x9af7('0x25')]('SmsMessage,\x20%s,\x20%s',_0x10d96b,_0x9af7('0x27'));_0x1a6312(_0xe74d23['result']['message']);}})[_0x9af7('0x2d')](function(_0x1b5b50){logger[_0x9af7('0x2a')]('SmsMessage,\x20%s,\x20%s',_0x10d96b,_0x1b5b50);_0x336625(_0x1b5b50);});});}function respondWithStatusCode(_0x148d09,_0x521260){_0x521260=_0x521260||0xcc;return function(_0x6626bf){if(_0x6626bf){return _0x148d09[_0x9af7('0x2e')](_0x521260);}return _0x148d09['status'](_0x521260)[_0x9af7('0x2f')]();};}function respondWithResult(_0x2a0bc5,_0x7f3c6e){_0x7f3c6e=_0x7f3c6e||0xc8;return function(_0x3201c4){if(_0x3201c4){return _0x2a0bc5[_0x9af7('0x30')](_0x7f3c6e)[_0x9af7('0x31')](_0x3201c4);}};}function respondWithFilteredResult(_0x28f3c1,_0x1fed7e){return function(_0x5c29b9){if(_0x5c29b9){var _0x4fb57f=typeof _0x1fed7e[_0x9af7('0x32')]===_0x9af7('0x33')&&typeof _0x1fed7e[_0x9af7('0x34')]==='undefined';var _0xc5e9de=_0x5c29b9[_0x9af7('0x35')];var _0x881bbe=_0x4fb57f?0x0:_0x1fed7e[_0x9af7('0x32')];var _0x210f8f=_0x4fb57f?_0x5c29b9[_0x9af7('0x35')]:_0x1fed7e['offset']+_0x1fed7e['limit'];var _0x321bc9;if(_0x210f8f>=_0xc5e9de){_0x210f8f=_0xc5e9de;_0x321bc9=0xc8;}else{_0x321bc9=0xce;}_0x28f3c1[_0x9af7('0x30')](_0x321bc9);return _0x28f3c1[_0x9af7('0x36')](_0x9af7('0x37'),_0x881bbe+'-'+_0x210f8f+'/'+_0xc5e9de)[_0x9af7('0x31')](_0x5c29b9);}return null;};}function patchUpdates(_0x4dc32a){return function(_0x516b6c){try{jsonpatch[_0x9af7('0x38')](_0x516b6c,_0x4dc32a,!![]);}catch(_0x27b102){return BPromise[_0x9af7('0x39')](_0x27b102);}return _0x516b6c[_0x9af7('0x3a')]();};}function saveUpdates(_0x6f65c6,_0x37922d){return function(_0x41fd58){if(_0x41fd58){return _0x41fd58[_0x9af7('0x3b')](_0x6f65c6)[_0x9af7('0x24')](function(_0x4f07e2){return _0x4f07e2;});}return null;};}function removeEntity(_0x39a0b7,_0x51434c){return function(_0x11e486){if(_0x11e486){return _0x11e486['destroy']()['then'](function(){_0x39a0b7['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x5d80cd,_0xcbb171){return function(_0x557920){if(!_0x557920){_0x5d80cd[_0x9af7('0x2e')](0x194);}return _0x557920;};}function handleError(_0x58e382,_0x5806c7){_0x5806c7=_0x5806c7||0x1f4;return function(_0xc06b27){logger[_0x9af7('0x2a')](_0xc06b27[_0x9af7('0x3c')]);if(_0xc06b27[_0x9af7('0x3d')]){delete _0xc06b27['name'];}_0x58e382[_0x9af7('0x30')](_0x5806c7)[_0x9af7('0x3e')](_0xc06b27);};}exports[_0x9af7('0x3f')]=function(_0xb0debc,_0x3d7079){var _0x30447d={},_0x59630f={},_0x3e076e={'count':0x0,'rows':[]};var _0x511225=_[_0x9af7('0x40')](db[_0x9af7('0x41')][_0x9af7('0x42')],function(_0x20da0b){return{'name':_0x20da0b[_0x9af7('0x43')],'type':_0x20da0b['type'][_0x9af7('0x44')]};});_0x59630f[_0x9af7('0x45')]=_['map'](_0x511225,_0x9af7('0x3d'));_0x59630f[_0x9af7('0x46')]=_[_0x9af7('0x47')](_0xb0debc[_0x9af7('0x46')]);_0x59630f[_0x9af7('0x48')]=_[_0x9af7('0x49')](_0x59630f[_0x9af7('0x45')],_0x59630f[_0x9af7('0x46')]);_0x30447d[_0x9af7('0x4a')]=_[_0x9af7('0x49')](_0x59630f[_0x9af7('0x45')],qs['fields'](_0xb0debc[_0x9af7('0x46')][_0x9af7('0x4b')]));_0x30447d['attributes']=_0x30447d[_0x9af7('0x4a')][_0x9af7('0x4c')]?_0x30447d[_0x9af7('0x4a')]:_0x59630f[_0x9af7('0x45')];if(!_0xb0debc[_0x9af7('0x46')][_0x9af7('0x4d')]('nolimit')){_0x30447d[_0x9af7('0x34')]=qs[_0x9af7('0x34')](_0xb0debc[_0x9af7('0x46')]['limit']);_0x30447d['offset']=qs[_0x9af7('0x32')](_0xb0debc[_0x9af7('0x46')][_0x9af7('0x32')]);}_0x30447d[_0x9af7('0x4e')]=qs[_0x9af7('0x4f')](_0xb0debc[_0x9af7('0x46')][_0x9af7('0x4f')]);_0x30447d[_0x9af7('0x50')]=qs[_0x9af7('0x48')](_['pick'](_0xb0debc[_0x9af7('0x46')],_0x59630f[_0x9af7('0x48')]),_0x511225);if(_0xb0debc[_0x9af7('0x46')][_0x9af7('0x51')]){_0x30447d['where']=_[_0x9af7('0x52')](_0x30447d[_0x9af7('0x50')],{'$or':_[_0x9af7('0x40')](_0x511225,function(_0x453c6e){if(_0x453c6e[_0x9af7('0x53')]!==_0x9af7('0x54')){var _0x5c2e92={};_0x5c2e92[_0x453c6e['name']]={'$like':'%'+_0xb0debc[_0x9af7('0x46')]['filter']+'%'};return _0x5c2e92;}})});}_0x30447d=_[_0x9af7('0x52')]({},_0x30447d,_0xb0debc[_0x9af7('0x55')]);var _0x41f758={'where':_0x30447d[_0x9af7('0x50')]};return db['SmsMessage'][_0x9af7('0x35')](_0x41f758)[_0x9af7('0x24')](function(_0x4d9268){_0x3e076e[_0x9af7('0x35')]=_0x4d9268;if(_0xb0debc['query']['includeAll']){_0x30447d[_0x9af7('0x56')]=[{'all':!![]}];}return db[_0x9af7('0x41')]['findAll'](_0x30447d);})['then'](function(_0x361ca7){_0x3e076e[_0x9af7('0x57')]=_0x361ca7;return _0x3e076e;})[_0x9af7('0x24')](respondWithFilteredResult(_0x3d7079,_0x30447d))['catch'](handleError(_0x3d7079,null));};exports[_0x9af7('0x58')]=function(_0x300f55,_0x5678df){var _0x1ebd1c={'raw':!![],'where':{'id':_0x300f55[_0x9af7('0x59')]['id']}},_0x3e91e2={};_0x3e91e2[_0x9af7('0x45')]=_[_0x9af7('0x47')](db[_0x9af7('0x41')][_0x9af7('0x42')]);_0x3e91e2[_0x9af7('0x46')]=_[_0x9af7('0x47')](_0x300f55[_0x9af7('0x46')]);_0x3e91e2[_0x9af7('0x48')]=_[_0x9af7('0x49')](_0x3e91e2['model'],_0x3e91e2[_0x9af7('0x46')]);_0x1ebd1c[_0x9af7('0x4a')]=_[_0x9af7('0x49')](_0x3e91e2[_0x9af7('0x45')],qs[_0x9af7('0x4b')](_0x300f55[_0x9af7('0x46')]['fields']));_0x1ebd1c[_0x9af7('0x4a')]=_0x1ebd1c[_0x9af7('0x4a')][_0x9af7('0x4c')]?_0x1ebd1c[_0x9af7('0x4a')]:_0x3e91e2['model'];if(_0x300f55[_0x9af7('0x46')][_0x9af7('0x5a')]){_0x1ebd1c[_0x9af7('0x56')]=[{'all':!![]}];}_0x1ebd1c=_['merge']({},_0x1ebd1c,_0x300f55[_0x9af7('0x55')]);return db['SmsMessage']['find'](_0x1ebd1c)[_0x9af7('0x24')](handleEntityNotFound(_0x5678df,null))[_0x9af7('0x24')](respondWithResult(_0x5678df,null))[_0x9af7('0x2d')](handleError(_0x5678df,null));};exports[_0x9af7('0x5b')]=function(_0x352d13,_0x489f6b){return db[_0x9af7('0x41')][_0x9af7('0x5b')](_0x352d13[_0x9af7('0x5c')],{})[_0x9af7('0x24')](respondWithResult(_0x489f6b,0xc9))['catch'](handleError(_0x489f6b,null));};exports[_0x9af7('0x3b')]=function(_0x5506b1,_0x5c94e3){if(_0x5506b1[_0x9af7('0x5c')]['id']){delete _0x5506b1[_0x9af7('0x5c')]['id'];}return db[_0x9af7('0x41')][_0x9af7('0x5d')]({'where':{'id':_0x5506b1[_0x9af7('0x59')]['id']}})[_0x9af7('0x24')](handleEntityNotFound(_0x5c94e3,null))[_0x9af7('0x24')](saveUpdates(_0x5506b1[_0x9af7('0x5c')],null))[_0x9af7('0x24')](respondWithResult(_0x5c94e3,null))[_0x9af7('0x2d')](handleError(_0x5c94e3,null));};exports[_0x9af7('0x5e')]=function(_0x17ccc0,_0x641e59){return db[_0x9af7('0x41')][_0x9af7('0x5d')]({'where':{'id':_0x17ccc0[_0x9af7('0x59')]['id']}})[_0x9af7('0x24')](handleEntityNotFound(_0x641e59,null))[_0x9af7('0x24')](removeEntity(_0x641e59,null))['catch'](handleError(_0x641e59,null));};exports[_0x9af7('0x5f')]=function(_0x4f8add,_0x4add0a){return db[_0x9af7('0x41')][_0x9af7('0x5f')]()[_0x9af7('0x24')](respondWithResult(_0x4add0a,null))['catch'](handleError(_0x4add0a,null));};var interaction_log=require(_0x9af7('0x15'))(_0x9af7('0x60'));exports['accept']=function(_0x4edc28,_0x815543,_0xc78e73){var _0x5cc96b={'agent':{},'channel':_0x9af7('0x61')};if(_0x4edc28[_0x9af7('0x5c')]['id']){delete _0x4edc28[_0x9af7('0x5c')]['id'];}_0x4edc28[_0x9af7('0x5c')][_0x9af7('0x62')]=!![];_0x4edc28['body'][_0x9af7('0x63')]=moment()[_0x9af7('0x64')](_0x9af7('0x65'));_0x4edc28[_0x9af7('0x5c')][_0x9af7('0x66')]=_0x4edc28['body'][_0x9af7('0x66')]||_0x4edc28['user']['id'];_0x5cc96b[_0x9af7('0x67')]['id']=_0x4edc28[_0x9af7('0x5c')]['UserId'];return db['SmsMessage'][_0x9af7('0x5d')]({'where':{'id':_0x4edc28[_0x9af7('0x59')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x815543,null))['then'](saveUpdates(_0x4edc28['body'],null))['then'](function(_0x18732c){if(_0x18732c){_0x5cc96b['message']=_0x18732c[_0x9af7('0x68')]({'plain':!![]});return db[_0x9af7('0x69')][_0x9af7('0x5d')]({'where':{'id':_0x18732c[_0x9af7('0x6a')]}});}return null;})['then'](handleEntityNotFound(_0x815543,null))[_0x9af7('0x24')](function(_0x12f004){if(_0x12f004){return _0x12f004[_0x9af7('0x3b')]({'UserId':_0x4edc28[_0x9af7('0x5c')][_0x9af7('0x66')],'read1stAt':_[_0x9af7('0x6b')](_0x12f004['read1stAt'])?moment()['format'](_0x9af7('0x65')):undefined});}return null;})['then'](function(_0x55210f){if(_0x55210f){_0x5cc96b[_0x9af7('0x6c')]=_0x55210f[_0x9af7('0x68')]({'plain':!![]});interaction_log[_0x9af7('0x25')](_0x9af7('0x6d'),_0x4edc28[_0x9af7('0x6e')]['id'],_0x4edc28[_0x9af7('0x6e')]['name'],_0x4edc28['user']['role'],_0x5cc96b[_0x9af7('0x6c')]['id'],_0x4edc28['body']?JSON[_0x9af7('0x29')](_0x4edc28['body']):_0x9af7('0x6f'));return respondWithRpcPromise(_0x9af7('0x70'),_0x9af7('0x71'),_0x5cc96b);}return null;})[_0x9af7('0x24')](function(_0x1ad49d){var _0x5c1216='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x1ad49d['message'][_0x9af7('0x72')];return db['sequelize'][_0x9af7('0x46')](_0x5c1216,{'type':db['Sequelize'][_0x9af7('0x73')]['SELECT'],'raw':!![]})[_0x9af7('0x24')](function(_0x1ef49f){return _0x1ef49f;});})['then'](function(_0x97bf5f){if(_0x97bf5f){_0x5cc96b[_0x9af7('0x2c')][_0x9af7('0x74')]=_0x97bf5f[0x0];if(!_0x4edc28[_0x9af7('0x5c')][_0x9af7('0x66')])return;return db[_0x9af7('0x75')][_0x9af7('0x5d')]({'where':{'id':_0x4edc28[_0x9af7('0x5c')]['UserId'],'role':_0x9af7('0x67')},'attributes':['id',_0x9af7('0x3d'),_0x9af7('0x76'),_0x9af7('0x77'),_0x9af7('0x78')],'raw':!![]});}return null;})[_0x9af7('0x24')](function(_0x76fbb6){if(!_0x76fbb6)return null;_0x5cc96b[_0x9af7('0x2c')]['agent']=_0x76fbb6;return _0x5cc96b;})[_0x9af7('0x24')](function(_0xd96003){if(_0xd96003){if(_0x4edc28[_0x9af7('0x5c')][_0x9af7('0x79')]){_0x5cc96b[_0x9af7('0x2c')][_0x9af7('0x7a')]=util[_0x9af7('0x64')](_0x9af7('0x7b'),_0x4edc28[_0x9af7('0x6e')][_0x9af7('0x3d')]);_0x5cc96b[_0x9af7('0x2c')]['channel']=_0x5cc96b[_0x9af7('0x7c')];_0x5cc96b[_0x9af7('0x2c')][_0x9af7('0x7d')]=_0x5cc96b['channel'];_0x5cc96b[_0x9af7('0x2c')][_0x9af7('0x7e')]=_0x9af7('0x7f');return respondWithRpcPromise(_0x9af7('0x80'),_0x9af7('0x80'),{'event':_0x9af7('0x81'),'message':_0x5cc96b[_0x9af7('0x2c')]},client9002)[_0x9af7('0x24')](function(){return _0x5cc96b;});}return _0x5cc96b;}return null;})[_0x9af7('0x24')](respondWithResult(_0x815543,null))[_0x9af7('0x2d')](handleError(_0x815543,null));};var interaction_log=require(_0x9af7('0x15'))(_0x9af7('0x60'));exports[_0x9af7('0x39')]=function(_0x3595db,_0x900d27,_0x59790b){var _0x5678da={'agent':{},'channel':'sms'};if(_0x3595db[_0x9af7('0x5c')]['id']){delete _0x3595db['body']['id'];}_0x3595db['body'][_0x9af7('0x66')]=_0x3595db[_0x9af7('0x5c')]['UserId']||_0x3595db[_0x9af7('0x6e')]['id'];_0x5678da['agent']['id']=_0x3595db['body'][_0x9af7('0x66')];return db['SmsMessage'][_0x9af7('0x5d')]({'where':{'id':_0x3595db[_0x9af7('0x59')]['id'],'UserId':null}})[_0x9af7('0x24')](handleEntityNotFound(_0x900d27,null))[_0x9af7('0x24')](function(_0xab2b08){if(_0xab2b08){_0x5678da[_0x9af7('0x2c')]=_0xab2b08[_0x9af7('0x68')]({'plain':!![]});return db[_0x9af7('0x69')][_0x9af7('0x5d')]({'where':{'id':_0xab2b08[_0x9af7('0x6a')]}});}return null;})['then'](handleEntityNotFound(_0x900d27,null))[_0x9af7('0x24')](function(_0x227753){if(_0x227753){_0x5678da['interaction']=_0x227753[_0x9af7('0x68')]({'plain':!![]});interaction_log['info'](_0x9af7('0x82'),_0x3595db[_0x9af7('0x6e')]['id'],_0x3595db[_0x9af7('0x6e')][_0x9af7('0x3d')],_0x3595db[_0x9af7('0x6e')][_0x9af7('0x83')],_0x5678da[_0x9af7('0x6c')]['id'],_0x3595db[_0x9af7('0x5c')]?JSON[_0x9af7('0x29')](_0x3595db[_0x9af7('0x5c')]):_0x9af7('0x6f'));return respondWithRpcPromise(_0x9af7('0x84'),_0x9af7('0x85'),_0x5678da);}return null;})[_0x9af7('0x24')](function(_0x7b8658){var _0x91c4b3=_0x9af7('0x86')+_0x7b8658[_0x9af7('0x2c')][_0x9af7('0x72')];return db[_0x9af7('0x87')][_0x9af7('0x46')](_0x91c4b3,{'type':db[_0x9af7('0x88')][_0x9af7('0x73')][_0x9af7('0x89')],'raw':!![]})[_0x9af7('0x24')](function(_0x58574b){return _0x58574b;});})[_0x9af7('0x24')](function(_0x2bc9c1){if(_0x2bc9c1){_0x5678da['message'][_0x9af7('0x74')]=_0x2bc9c1[0x0];if(!_0x3595db[_0x9af7('0x5c')][_0x9af7('0x66')])return;return db[_0x9af7('0x75')][_0x9af7('0x5d')]({'where':{'id':_0x3595db[_0x9af7('0x5c')]['UserId'],'role':'agent'},'attributes':['id',_0x9af7('0x3d'),_0x9af7('0x76'),'email',_0x9af7('0x78')],'raw':!![]});}return null;})[_0x9af7('0x24')](function(_0x5d3bbb){if(!_0x5d3bbb)return null;_0x5678da[_0x9af7('0x2c')]['agent']=_0x5d3bbb;return _0x5678da;})[_0x9af7('0x24')](function(_0x4725c1){if(_0x4725c1){_0x4725c1['message']['interface']=util[_0x9af7('0x64')](_0x9af7('0x7b'),_0x3595db[_0x9af7('0x6e')]['name']);_0x4725c1[_0x9af7('0x2c')][_0x9af7('0x7c')]=_0x5678da[_0x9af7('0x7c')];_0x4725c1[_0x9af7('0x2c')][_0x9af7('0x7d')]=_0x5678da[_0x9af7('0x7c')];_0x4725c1[_0x9af7('0x2c')][_0x9af7('0x7e')]=_0x9af7('0x39');respondWithRpcPromise(_0x9af7('0x80'),_0x9af7('0x80'),{'event':'rejectmessage','message':_0x4725c1[_0x9af7('0x2c')]},client9002);return _0x5678da;}return null;})[_0x9af7('0x24')](respondWithResult(_0x900d27,null))[_0x9af7('0x2d')](handleError(_0x900d27,null));};exports[_0x9af7('0x30')]=function(_0x1c4be4,_0x150eea,_0x151405){if(_0x1c4be4['body']['id']){delete _0x1c4be4[_0x9af7('0x5c')]['id'];}var _0x6c1d27;return db[_0x9af7('0x41')][_0x9af7('0x5d')]({'where':{'id':_0x1c4be4[_0x9af7('0x59')]['id']}})[_0x9af7('0x24')](handleEntityNotFound(_0x150eea,null))[_0x9af7('0x24')](function(_0x1c0f74){if(_0x1c0f74){_0x6c1d27=_0x1c0f74;return db[_0x9af7('0x8a')]['find']({'where':{'id':_0x1c0f74[_0x9af7('0x8b')]}});}})[_0x9af7('0x24')](handleEntityNotFound(_0x150eea,null))[_0x9af7('0x24')](function(_0x25b7f1){if(_0x25b7f1){logger[_0x9af7('0x28')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x9af7('0x30'),_0x9af7('0x8c'),_0x25b7f1[_0x9af7('0x53')],util[_0x9af7('0x8d')](_0x1c4be4[_0x9af7('0x5c')],{'showHidden':![],'depth':null}));switch(_0x25b7f1[_0x9af7('0x53')]){case _0x9af7('0x8e'):if(_0x1c4be4['body'][_0x9af7('0x8f')]&&_0x1c4be4[_0x9af7('0x5c')]['MessageSid']===_0x6c1d27[_0x9af7('0x90')]){return _0x6c1d27[_0x9af7('0x3b')]({'read':!![]});}else{logger[_0x9af7('0x2a')](_0x9af7('0x91'),_0x9af7('0x30'),_0x9af7('0x8e'),util[_0x9af7('0x8d')](_0x1c4be4[_0x9af7('0x5c')],{'showHidden':![],'depth':null}));}break;case _0x9af7('0x92'):if(_0x1c4be4[_0x9af7('0x5c')][_0x9af7('0x93')]&&_0x1c4be4[_0x9af7('0x5c')][_0x9af7('0x93')]===_0x6c1d27['messageId']&&_[_0x9af7('0x94')]([_0x9af7('0x95'),_0x9af7('0x96')],_0x1c4be4['body'][_0x9af7('0x97')])>=0x0){return _0x6c1d27[_0x9af7('0x3b')]({'read':!![]});}else{logger['error'](_0x9af7('0x91'),'status',_0x9af7('0x98'),util['inspect'](_0x1c4be4[_0x9af7('0x5c')],{'showHidden':![],'depth':null}));}break;case _0x9af7('0x99'):var _0xcf6b04=_0x1c4be4[_0x9af7('0x5c')][_0x9af7('0x9a')][0x0];if(_0xcf6b04[_0x9af7('0x30')][_0x9af7('0x9b')]===_0x9af7('0x9c')){return _0x6c1d27[_0x9af7('0x3b')]({'read':!![]});}else{logger[_0x9af7('0x2a')](_0x9af7('0x91'),_0x9af7('0x30'),_0x9af7('0x99'),util[_0x9af7('0x8d')](_0x1c4be4[_0x9af7('0x5c')],{'showHidden':![],'depth':null}));}break;}return _0x6c1d27;}})[_0x9af7('0x24')](respondWithResult(_0x150eea,null))[_0x9af7('0x2d')](handleError(_0x150eea,null));}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.events.js b/server/api/smsMessage/smsMessage.events.js index d47c941..52e74ff 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 _0xc3b8=['setMaxListeners','save','update','remove','emit','hook','exports','events'];(function(_0x372057,_0x5d9ced){var _0x3e91e3=function(_0x13c8c7){while(--_0x13c8c7){_0x372057['push'](_0x372057['shift']());}};_0x3e91e3(++_0x5d9ced);}(_0xc3b8,0x14f));var _0x8c3b=function(_0x3358ae,_0x4a85d4){_0x3358ae=_0x3358ae-0x0;var _0x3514eb=_0xc3b8[_0x3358ae];return _0x3514eb;};'use strict';var EventEmitter=require(_0x8c3b('0x0'));var SmsMessage=require('../../mysqldb')['db']['SmsMessage'];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0x8c3b('0x1')](0x0);var events={'afterCreate':_0x8c3b('0x2'),'afterUpdate':_0x8c3b('0x3'),'afterDestroy':_0x8c3b('0x4')};function emitEvent(_0x3f5a46){return function(_0x51cc8b,_0x5a2fd6,_0x5d3c18){SmsMessageEvents[_0x8c3b('0x5')](_0x3f5a46+':'+_0x51cc8b['id'],_0x51cc8b);SmsMessageEvents[_0x8c3b('0x5')](_0x3f5a46,_0x51cc8b);_0x5d3c18(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsMessage[_0x8c3b('0x6')](e,emitEvent(event));}}module[_0x8c3b('0x7')]=SmsMessageEvents; \ No newline at end of file +var _0xb8f4=['SmsMessage','save','update','remove','emit','hook','exports','../../mysqldb'];(function(_0x404a11,_0x5d5647){var _0x471865=function(_0x2e3bc8){while(--_0x2e3bc8){_0x404a11['push'](_0x404a11['shift']());}};_0x471865(++_0x5d5647);}(_0xb8f4,0x11f));var _0x4b8f=function(_0x1fd5f5,_0x36b4ec){_0x1fd5f5=_0x1fd5f5-0x0;var _0x3f2e69=_0xb8f4[_0x1fd5f5];return _0x3f2e69;};'use strict';var EventEmitter=require('events');var SmsMessage=require(_0x4b8f('0x0'))['db'][_0x4b8f('0x1')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x4b8f('0x2'),'afterUpdate':_0x4b8f('0x3'),'afterDestroy':_0x4b8f('0x4')};function emitEvent(_0x28d263){return function(_0x48215c,_0x160a94,_0x1cfa0e){SmsMessageEvents[_0x4b8f('0x5')](_0x28d263+':'+_0x48215c['id'],_0x48215c);SmsMessageEvents['emit'](_0x28d263,_0x48215c);_0x1cfa0e(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsMessage[_0x4b8f('0x6')](e,emitEvent(event));}}module[_0x4b8f('0x7')]=SmsMessageEvents; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.model.js b/server/api/smsMessage/smsMessage.model.js index 72b40c1..ac14238 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 _0xee26=['UserId','SmsInteraction','findOne','SmsInteractionId','then','update','createdAt','toLowerCase','catch','SmsAccount','find','type','twilio','accountSid','phone','messages','create','/api/sms/messages/','/status?token=','token','sid','SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','inspect','error','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','skebby','username','smsMethod','sender','login?username=','password','GET','split','sms','POST','user_key','session_key','total_sent','read','Missing\x20parameters:\x20username,\x20password','connectel','authToken','senderString','https://smsapi.connectel.se/api/v2/send/','requestid','clicksend','xCALLY\x20Motion','format','%s:%s','https://rest.clicksend.com/v3/sms/send','Basic\x20%s','base64','http_code','data','queued_count','head','message_id','deliveryReport','clickSend','plivo','https://api.plivo.com/v1/Account/%s/Message/','message_uuid','Missing\x20parameters:\x20authId,\x20authToken','infobip','baseUrl','/auth/1/session','application/json','IBSSO\x20','Missing\x20parameters:\x20base_url','csc','crypto','login','text','keys','sort','length','apiKey','createHash','hex','id_sms','https://platform.clickatell.com/messages','uuid','UTF-8','apiMessageId','clickatell','Missing\x20parameters:\x20apiKey','https://messaging.bandwidth.com/api/v2/users/','accountId','/messages','applicationId','toString','bandwidth','intelepeer','https://api.intelepeer.com/_rest/v4/app/sms/send','Bearer\x20','code','https://api.intelepeer.com/_rest/v4/app/sms/mdr','message','status','refid','finally','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','path','./smsMessage.attributes','exports','define','SmsMessage','sms_messages','messageId','fti_sms_messages','body','FULLTEXT','direction','out','isNil'];(function(_0x1554f2,_0x3cb0c7){var _0x55a958=function(_0x4b0aee){while(--_0x4b0aee){_0x1554f2['push'](_0x1554f2['shift']());}};_0x55a958(++_0x3cb0c7);}(_0xee26,0x67));var _0x6ee2=function(_0x160ee8,_0x60f2a5){_0x160ee8=_0x160ee8-0x0;var _0x3d4e80=_0xee26[_0x160ee8];return _0x3d4e80;};'use strict';var _=require(_0x6ee2('0x0'));var util=require('util');var logger=require(_0x6ee2('0x1'))(_0x6ee2('0x2'));var moment=require(_0x6ee2('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x6ee2('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x6ee2('0x5'));module[_0x6ee2('0x6')]=function(_0x2f637e,_0xe4b99a){return _0x2f637e[_0x6ee2('0x7')](_0x6ee2('0x8'),attributes,{'tableName':_0x6ee2('0x9'),'paranoid':![],'indexes':[{'name':_0x6ee2('0xa'),'fields':[_0x6ee2('0xa')]},{'name':_0x6ee2('0xb'),'fields':[_0x6ee2('0xc')],'type':_0x6ee2('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x449bdb,_0x3afd37,_0x1d3cce){var _0x52aa70=_0x2f637e['models'];var _0xcbbbda=_0x449bdb['get']({'plain':!![]});if(_0xcbbbda[_0x6ee2('0xe')]['toLowerCase']()==='in'||_0xcbbbda[_0x6ee2('0xe')]['toLowerCase']()===_0x6ee2('0xf')&&!_0xcbbbda['secret']&&!_[_0x6ee2('0x10')](_0xcbbbda[_0x6ee2('0x11')])&&!_[_0x6ee2('0x10')](_0xcbbbda['SmsInteractionId'])){_0x52aa70[_0x6ee2('0x12')][_0x6ee2('0x13')]({'where':{'id':_0xcbbbda[_0x6ee2('0x14')]}})[_0x6ee2('0x15')](function(_0x125d48){if(_0x125d48){_0x125d48[_0x6ee2('0x16')]({'lastMsgAt':_0xcbbbda[_0x6ee2('0x17')],'lastMsgDirection':_0xcbbbda[_0x6ee2('0xe')][_0x6ee2('0x18')]()});}})[_0x6ee2('0x19')](function(_0x10b421){console['error'](_0x10b421);});}if(_0xcbbbda[_0x6ee2('0xe')]===_0x6ee2('0xf')&&!_0xcbbbda['secret']){var _0x2f68fb;_0x52aa70[_0x6ee2('0x1a')][_0x6ee2('0x1b')]({'where':{'id':_0xcbbbda['SmsAccountId']},'raw':!![]})[_0x6ee2('0x15')](function(_0x3995c6){_0x2f68fb=_0x3995c6;if(_0x2f68fb&&_0x2f68fb[_0x6ee2('0x1c')]){switch(_0x2f68fb[_0x6ee2('0x1c')]){case _0x6ee2('0x1d'):var _0x51b0b4=require(_0x6ee2('0x1d'));if(_0x2f68fb[_0x6ee2('0x1e')]&&_0x2f68fb['authToken']&&_0x2f68fb[_0x6ee2('0x1f')]){var _0x3028f4=new _0x51b0b4(_0x2f68fb['accountSid'],_0x2f68fb['authToken']);_0x3028f4[_0x6ee2('0x20')][_0x6ee2('0x21')]({'body':_0xcbbbda[_0x6ee2('0xc')],'to':_0xcbbbda[_0x6ee2('0x1f')],'from':_0x2f68fb[_0x6ee2('0x1f')],'statusCallback':_0x2f68fb['remote']+_0x6ee2('0x22')+_0xcbbbda['id']+_0x6ee2('0x23')+_0x2f68fb[_0x6ee2('0x24')]})[_0x6ee2('0x15')](function(_0x3fe9bc){if(_0x3fe9bc[_0x6ee2('0x25')]){return _0x449bdb['update']({'messageId':_0x3fe9bc['sid']});}})[_0x6ee2('0x19')](function(_0x2d01d5){logger['error'](_0x6ee2('0x26'),_0x6ee2('0x27'),'twilio',util[_0x6ee2('0x28')](_0x2d01d5,{'showHidden':![],'depth':null}));});}else{logger[_0x6ee2('0x29')](_0x6ee2('0x26'),'afterCreate',_0x6ee2('0x1d'),_0x6ee2('0x2a'));}break;case _0x6ee2('0x2b'):var _0x402db2='https://api.skebby.it/API/v1.0/REST/';if(_0x2f68fb[_0x6ee2('0x2c')]&&_0x2f68fb['password']){var _0x21d464={'recipient':[_0xcbbbda['phone']],'message':_0xcbbbda[_0x6ee2('0xc')],'message_type':_0x2f68fb[_0x6ee2('0x2d')]};if(_0x2f68fb['smsMethod']&&_0x2f68fb['smsMethod']!=='SI'){_0x21d464[_0x6ee2('0x2e')]=_0x2f68fb[_0x6ee2('0x1f')];}var _0x17722={'url':_0x402db2+_0x6ee2('0x2f')+_0x2f68fb['username']+'&password='+_0x2f68fb[_0x6ee2('0x30')],'method':_0x6ee2('0x31')};rp(_0x17722)[_0x6ee2('0x15')](function(_0x46813f){var _0x25903c=_0x46813f[_0x6ee2('0x32')](';');var _0x1d5ad2={'user_key':_0x25903c[0x0],'session_key':_0x25903c[0x1]};_0x17722={'url':_0x402db2+_0x6ee2('0x33'),'method':_0x6ee2('0x34'),'headers':{'user_key':_0x1d5ad2[_0x6ee2('0x35')],'Session_key':_0x1d5ad2[_0x6ee2('0x36')]},'json':!![],'body':_0x21d464};return rp(_0x17722);})['then'](function(_0x4122c0){if(_0x4122c0[_0x6ee2('0x37')]>=0x1){var _0x413d45={'messageId':_0x4122c0['internal_order_id']};if(_0x2f68fb[_0x6ee2('0x2d')]!=='GP'||!_0x2f68fb['deliveryReport']){_0x413d45[_0x6ee2('0x38')]=!![];}return _0x449bdb[_0x6ee2('0x16')](_0x413d45);}else{return logger['error'](_0x6ee2('0x26'),_0x6ee2('0x27'),_0x6ee2('0x2b'),util[_0x6ee2('0x28')](_0x4122c0,{'showHidden':![],'depth':null}));}})[_0x6ee2('0x19')](function(_0x27cf19){return logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x6ee2('0x27'),_0x6ee2('0x2b'),util[_0x6ee2('0x28')](_0x27cf19,{'showHidden':![],'depth':null}));});}else{logger[_0x6ee2('0x29')](_0x6ee2('0x26'),'afterCreate',_0x6ee2('0x2b'),_0x6ee2('0x39'));}break;case _0x6ee2('0x3a'):if(_0x2f68fb[_0x6ee2('0x3b')]){var _0x485d75={'recipient':_0xcbbbda[_0x6ee2('0x1f')],'message':_0xcbbbda[_0x6ee2('0xc')],'sender':_0x2f68fb[_0x6ee2('0x3c')]||_0x2f68fb[_0x6ee2('0x1f')],'authorization':_0x2f68fb['authToken']};var _0x3afd37={'method':'POST','uri':_0x6ee2('0x3d'),'body':_0x485d75,'json':!![]};rp(_0x3afd37)[_0x6ee2('0x15')](function(_0x491f76){var _0x11c408={'messageId':_0x491f76[_0x6ee2('0x3e')]};if(!_0x2f68fb['deliveryReport']){_0x11c408[_0x6ee2('0x38')]=!![];}return _0x449bdb[_0x6ee2('0x16')](_0x11c408);})[_0x6ee2('0x19')](function(_0x55aaaf){logger[_0x6ee2('0x29')](_0x6ee2('0x26'),'afterCreate',_0x6ee2('0x3a'),util[_0x6ee2('0x28')](_0x55aaaf,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x6ee2('0x26'),_0x6ee2('0x27'),_0x6ee2('0x3a'),'Missing\x20parameters:\x20authToken');}break;case _0x6ee2('0x3f'):if(_0x2f68fb[_0x6ee2('0x2c')]&&_0x2f68fb[_0x6ee2('0x30')]){var _0x485d75={'messages':[{'source':_0x6ee2('0x40'),'to':_0xcbbbda[_0x6ee2('0x1f')],'body':_0xcbbbda[_0x6ee2('0xc')],'from':_0x2f68fb[_0x6ee2('0x3c')]||_0x2f68fb[_0x6ee2('0x1f')]}]};var _0x12d42e=util[_0x6ee2('0x41')](_0x6ee2('0x42'),_0x2f68fb['username'],_0x2f68fb[_0x6ee2('0x30')]);var _0x3afd37={'method':_0x6ee2('0x34'),'uri':_0x6ee2('0x43'),'body':_0x485d75,'headers':{'Authorization':util['format'](_0x6ee2('0x44'),new Buffer(_0x12d42e)['toString'](_0x6ee2('0x45')))},'json':!![]};rp(_0x3afd37)['then'](function(_0x3fb0e2){if(_0x3fb0e2['http_code']>=0xc8&&_0x3fb0e2[_0x6ee2('0x46')]<=0xce){if(_0x3fb0e2[_0x6ee2('0x47')]&&_0x3fb0e2[_0x6ee2('0x47')][_0x6ee2('0x48')]>0x0){var _0x1515bc=_[_0x6ee2('0x49')](_0x3fb0e2[_0x6ee2('0x47')]['messages']);var _0x452842={'messageId':_0x1515bc[_0x6ee2('0x4a')]};if(!_0x2f68fb[_0x6ee2('0x4b')]){_0x452842['read']=!![];}return _0x449bdb[_0x6ee2('0x16')](_0x452842);}else{logger[_0x6ee2('0x29')](_0x6ee2('0x26'),'afterCreate','clickSend',util['inspect'](_0x3fb0e2,{'showHidden':![],'depth':null}));}}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x6ee2('0x27'),'clickSend',util[_0x6ee2('0x28')](_0x3fb0e2,{'showHidden':![],'depth':null}));}})[_0x6ee2('0x19')](function(_0x1eaf09){logger[_0x6ee2('0x29')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x6ee2('0x27'),_0x6ee2('0x4c'),util['inspect'](_0x1eaf09,{'showHidden':![],'depth':null}));});}else{logger[_0x6ee2('0x29')](_0x6ee2('0x26'),'afterCreate',_0x6ee2('0x4c'),_0x6ee2('0x39'));}break;case _0x6ee2('0x4d'):if(_0x2f68fb['authId']&&_0x2f68fb[_0x6ee2('0x3b')]){var _0x485d75={'dst':_0xcbbbda['phone'],'text':_0xcbbbda[_0x6ee2('0xc')],'src':_0x2f68fb[_0x6ee2('0x3c')]||_0x2f68fb[_0x6ee2('0x1f')],'url':_0x2f68fb['remote']+_0x6ee2('0x22')+_0xcbbbda['id']+'/status?token='+_0x2f68fb[_0x6ee2('0x24')]};var _0x12d42e=util[_0x6ee2('0x41')](_0x6ee2('0x42'),_0x2f68fb['authId'],_0x2f68fb[_0x6ee2('0x3b')]);var _0x3afd37={'method':'POST','uri':util[_0x6ee2('0x41')](_0x6ee2('0x4e'),_0x2f68fb['authId']),'body':_0x485d75,'headers':{'Authorization':util[_0x6ee2('0x41')](_0x6ee2('0x44'),new Buffer(_0x12d42e)['toString'](_0x6ee2('0x45')))},'json':!![]};rp(_0x3afd37)[_0x6ee2('0x15')](function(_0x128f72){var _0x544a43={'messageId':_0x128f72[_0x6ee2('0x4f')][0x0]};return _0x449bdb[_0x6ee2('0x16')](_0x544a43);})['catch'](function(_0x31f26f){logger[_0x6ee2('0x29')](_0x6ee2('0x26'),_0x6ee2('0x27'),_0x6ee2('0x4d'),util[_0x6ee2('0x28')](_0x31f26f,{'showHidden':![],'depth':null}));});}else{logger[_0x6ee2('0x29')](_0x6ee2('0x26'),_0x6ee2('0x27'),_0x6ee2('0x4d'),_0x6ee2('0x50'));}break;case _0x6ee2('0x51'):if(_0x2f68fb[_0x6ee2('0x2c')]&&_0x2f68fb[_0x6ee2('0x30')]){if(_0x2f68fb['baseUrl']){var _0x129a87={'method':_0x6ee2('0x34'),'uri':_0x2f68fb[_0x6ee2('0x52')]+_0x6ee2('0x53'),'body':{'username':_0x2f68fb[_0x6ee2('0x2c')],'password':_0x2f68fb['password']},'json':!![]};return rp(_0x129a87)['then'](function(_0x46e7f0){var _0x540dca={'method':_0x6ee2('0x34'),'uri':_0x2f68fb[_0x6ee2('0x52')]+'/sms/2/text/advanced','body':{'messages':[{'from':_0x2f68fb[_0x6ee2('0x1f')],'destinations':[{'to':_0xcbbbda[_0x6ee2('0x1f')]}],'text':_0xcbbbda[_0x6ee2('0xc')],'notifyUrl':_0x2f68fb['remote']+_0x6ee2('0x22')+_0xcbbbda['id']+'/status?token='+_0x2f68fb[_0x6ee2('0x24')],'notifyContentType':_0x6ee2('0x54'),'callbackData':_0x2f68fb[_0x6ee2('0x1f')]+';'+_0xcbbbda[_0x6ee2('0xc')]}]},'headers':{'Authorization':_0x6ee2('0x55')+_0x46e7f0[_0x6ee2('0x24')]},'json':!![]};return rp(_0x540dca)['then'](function(_0x220eb4){if(_0x220eb4[_0x6ee2('0x20')]){var _0x28e51b={'messageId':_0x220eb4[_0x6ee2('0x20')][0x0]['messageId']};if(!_0x2f68fb[_0x6ee2('0x4b')]){_0x28e51b[_0x6ee2('0x38')]=!![];}return _0x449bdb[_0x6ee2('0x16')](_0x28e51b);}else{return logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','infobip',util[_0x6ee2('0x28')](_0x220eb4,{'showHidden':![],'depth':null}));}});})[_0x6ee2('0x19')](function(_0x205a7f){return logger[_0x6ee2('0x29')](_0x6ee2('0x26'),_0x6ee2('0x27'),'infobip',util['inspect'](_0x205a7f,{'showHidden':![],'depth':null}));});}else{logger[_0x6ee2('0x29')](_0x6ee2('0x26'),_0x6ee2('0x27'),_0x6ee2('0x51'),_0x6ee2('0x56'));}}else{logger[_0x6ee2('0x29')](_0x6ee2('0x26'),'afterCreate',_0x6ee2('0x51'),_0x6ee2('0x39'));}break;case _0x6ee2('0x57'):var _0x6a5b9a=require(_0x6ee2('0x58'));if(_0x2f68fb['apiKey']){var _0x562689={};_0x562689[_0x6ee2('0x59')]=_0x2f68fb['username'];_0x562689[_0x6ee2('0x1f')]=_0xcbbbda[_0x6ee2('0x1f')];_0x562689[_0x6ee2('0x2e')]=_0x2f68fb[_0x6ee2('0x1f')];_0x562689[_0x6ee2('0x5a')]=_0xcbbbda[_0x6ee2('0xc')];_0x562689['timestamp']=+new Date();var _0x5544ce='';var _0x2e2b81='';var _0x594832=Object[_0x6ee2('0x5b')](_0x562689);_0x594832[_0x6ee2('0x5c')]();for(var _0x42652c=0x0;_0x42652c<_0x594832[_0x6ee2('0x5d')];_0x42652c++){if(_0x5544ce!=''){_0x5544ce+='&';}_0x5544ce+=_0x594832[_0x42652c]+'='+encodeURIComponent(_0x562689[_0x594832[_0x42652c]]);_0x2e2b81+=_0x562689[_0x594832[_0x42652c]];}_0x2e2b81+=_0x2f68fb[_0x6ee2('0x5e')];_0x2e2b81=_0x6a5b9a[_0x6ee2('0x5f')]('md5')[_0x6ee2('0x16')](_0x2e2b81)['digest'](_0x6ee2('0x60'));if(_0x5544ce!==''){_0x5544ce+='&';}_0x5544ce+='signature='+_0x2e2b81;var _0x17722={'method':_0x6ee2('0x31'),'uri':_0x2f68fb['baseUrl']+'/external/get/send.php?'+_0x5544ce,'json':!![]};return rp(_0x17722)[_0x6ee2('0x15')](function(_0x1bc431){var _0x41728e=Object[_0x6ee2('0x5b')](_0x1bc431);if(_0x1bc431[_0x41728e[0x0]][_0x6ee2('0x29')]&&parseInt(_0x1bc431[_0x41728e[0x0]][_0x6ee2('0x29')])===0x0){var _0x13ad07={'messageId':_0x1bc431[_0x41728e[0x0]][_0x6ee2('0x61')]};if(!_0x2f68fb['deliveryReport']){_0x13ad07['read']=!![];}return _0x449bdb[_0x6ee2('0x16')](_0x13ad07);}else{return logger[_0x6ee2('0x29')](_0x6ee2('0x26'),'afterCreate',_0x6ee2('0x57'),util[_0x6ee2('0x28')](_0x1bc431[_0x6ee2('0x29')],{'showHidden':![],'depth':null}));}})[_0x6ee2('0x19')](function(_0x42af39){return logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x6ee2('0x27'),'csc',util[_0x6ee2('0x28')](_0x42af39,{'showHidden':![],'depth':null}));});}else{logger[_0x6ee2('0x29')](_0x6ee2('0x26'),_0x6ee2('0x27'),'csc','Missing\x20parameters:\x20apiKey');}break;case'clickatell':if(_0x2f68fb[_0x6ee2('0x5e')]){var _0x5ca059={'method':_0x6ee2('0x34'),'uri':_0x6ee2('0x62'),'headers':{'Authorization':_0x2f68fb['apiKey']},'body':{'content':_0xcbbbda['body'],'to':[_0xcbbbda[_0x6ee2('0x1f')]],'from':_0x2f68fb[_0x6ee2('0x1f')],'binary':![],'clientMessageId':_0x6ee2('0x63'),'charset':_0x6ee2('0x64')},'json':!![]};rp(_0x5ca059)[_0x6ee2('0x15')](function(_0x59b1d3){if(!_0x59b1d3[_0x6ee2('0x29')]){var _0x230580={'messageId':_0x59b1d3[_0x6ee2('0x20')][0x0][_0x6ee2('0x65')]};if(!_0x2f68fb[_0x6ee2('0x4b')]){_0x230580['read']=!![];}return _0x449bdb[_0x6ee2('0x16')](_0x230580);}else{return logger[_0x6ee2('0x29')](_0x6ee2('0x26'),'afterCreate','clickatell',util[_0x6ee2('0x28')](_0x59b1d3[_0x6ee2('0x29')],{'showHidden':![],'depth':null}));}})[_0x6ee2('0x19')](function(_0x684b39){return logger[_0x6ee2('0x29')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x6ee2('0x27'),_0x6ee2('0x66'),util[_0x6ee2('0x28')](_0x684b39,{'showHidden':![],'depth':null}));});}else{logger[_0x6ee2('0x29')](_0x6ee2('0x26'),_0x6ee2('0x27'),'clickatell',_0x6ee2('0x67'));}break;case'bandwidth':if(_0x2f68fb[_0x6ee2('0x2c')]&&_0x2f68fb['password']){var _0x12d42e=util[_0x6ee2('0x41')](_0x6ee2('0x42'),_0x2f68fb[_0x6ee2('0x2c')],_0x2f68fb[_0x6ee2('0x30')]);var _0x3afd37={'method':_0x6ee2('0x34'),'uri':_0x6ee2('0x68')+_0x2f68fb[_0x6ee2('0x69')]+_0x6ee2('0x6a'),'body':{'to':[_0xcbbbda[_0x6ee2('0x1f')]],'text':_0xcbbbda[_0x6ee2('0xc')],'from':_0x2f68fb[_0x6ee2('0x1f')],'applicationId':_0x2f68fb[_0x6ee2('0x6b')]},'headers':{'Authorization':util['format'](_0x6ee2('0x44'),new Buffer(_0x12d42e)[_0x6ee2('0x6c')]('base64'))},'json':!![]};rp(_0x3afd37)['then'](function(_0x1e090b){if(_0x1e090b['id']){var _0x5e69b4={'messageId':_0x1e090b['id']};return _0x449bdb['update'](_0x5e69b4);}else{logger[_0x6ee2('0x29')](_0x6ee2('0x26'),'afterCreate',_0x6ee2('0x6d'),util['inspect'](_0x1e090b,{'showHidden':![],'depth':null}));}})[_0x6ee2('0x19')](function(_0x67d8c7){logger[_0x6ee2('0x29')](_0x6ee2('0x26'),_0x6ee2('0x27'),'bandwidth',util[_0x6ee2('0x28')](_0x67d8c7,{'showHidden':![],'depth':null}));});}else{logger[_0x6ee2('0x29')](_0x6ee2('0x26'),_0x6ee2('0x27'),_0x6ee2('0x6d'),_0x6ee2('0x39'));}break;case _0x6ee2('0x6e'):if(_0x2f68fb[_0x6ee2('0x5e')]){var _0x1d2ee5={};var _0x17722={'method':_0x6ee2('0x34'),'uri':_0x6ee2('0x6f'),'headers':{'Authorization':_0x6ee2('0x70')+_0x2f68fb[_0x6ee2('0x5e')],'Content-Type':'application/json'},'body':{'from':_0x2f68fb[_0x6ee2('0x1f')],'to':_0xcbbbda[_0x6ee2('0x1f')],'text':_0xcbbbda[_0x6ee2('0xc')]},'json':!![]};return rp(_0x17722)[_0x6ee2('0x15')](function(_0x414d89){if(_0x414d89[_0x6ee2('0x71')]==0xca){_0x1d2ee5['message']=_0x414d89;var _0x5fb92d={'method':_0x6ee2('0x34'),'uri':_0x6ee2('0x72'),'headers':{'Authorization':'Bearer\x20'+_0x2f68fb['apiKey'],'Content-Type':_0x6ee2('0x54')},'body':{'refid':_0x1d2ee5[_0x6ee2('0x73')]['refid']},'json':!![]};return rp(_0x5fb92d)['then'](function(_0x5a70a9){_0x1d2ee5[_0x6ee2('0x74')]=_0x5a70a9;var _0x16484e={'messageId':_0x1d2ee5[_0x6ee2('0x73')][_0x6ee2('0x75')],'read':!![]};return _0x449bdb[_0x6ee2('0x16')](_0x16484e);});}else{return logger[_0x6ee2('0x29')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x6ee2('0x6e'),util[_0x6ee2('0x28')](_0x414d89,{'showHidden':![],'depth':null}));}})[_0x6ee2('0x19')](function(_0xc55741){return logger[_0x6ee2('0x29')](_0x6ee2('0x26'),_0x6ee2('0x27'),_0x6ee2('0x6e'),util['inspect'](_0xc55741,{'showHidden':![],'depth':null}));});}else{return logger[_0x6ee2('0x29')](_0x6ee2('0x26'),_0x6ee2('0x27'),_0x6ee2('0x6e'),'Token\x20not\x20received');}break;}}})[_0x6ee2('0x76')](function(){_0x1d3cce();});}else{_0x1d3cce();}}},'charset':'utf8mb4','collate':_0x6ee2('0x77')});}; \ No newline at end of file +var _0x96f1=['data','head','message_id','clickSend','plivo','authId','/status?token=','%s:%s','https://api.plivo.com/v1/Account/%s/Message/','Basic\x20%s','Missing\x20parameters:\x20authId,\x20authToken','infobip','baseUrl','/sms/2/text/advanced','application/json','IBSSO\x20','Missing\x20parameters:\x20base_url','crypto','apiKey','keys','sort','length','createHash','hex','signature=','id_sms','csc','clickatell','https://platform.clickatell.com/messages','uuid','apiMessageId','Missing\x20parameters:\x20apiKey','accountId','/messages','bandwidth','intelepeer','https://api.intelepeer.com/_rest/v4/app/sms/send','code','message','https://api.intelepeer.com/_rest/v4/app/sms/mdr','Bearer\x20','status','Token\x20not\x20received','finally','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','moment','bluebird','path','../../config/environment','./smsMessage.attributes','exports','define','SmsMessage','messageId','fti_sms_messages','body','FULLTEXT','get','toLowerCase','direction','isNil','UserId','SmsInteractionId','findOne','then','createdAt','catch','out','secret','find','SmsAccountId','type','twilio','accountSid','phone','authToken','messages','create','remote','/api/sms/messages/','token','sid','error','afterCreate','inspect','SmsMessage,\x20%s,\x20%s,\x20%s','skebby','username','smsMethod','sender','login?username=','password','GET','split','POST','session_key','total_sent','internal_order_id','deliveryReport','read','update','Missing\x20parameters:\x20username,\x20password','connectel','requestid','clicksend','xCALLY\x20Motion','senderString','https://rest.clicksend.com/v3/sms/send','format','toString','base64','http_code'];(function(_0x30a9a5,_0x5aa213){var _0x493ed3=function(_0x496669){while(--_0x496669){_0x30a9a5['push'](_0x30a9a5['shift']());}};_0x493ed3(++_0x5aa213);}(_0x96f1,0xa1));var _0x196f=function(_0x35505f,_0x54cea0){_0x35505f=_0x35505f-0x0;var _0x37e24e=_0x96f1[_0x35505f];return _0x37e24e;};'use strict';var _=require(_0x196f('0x0'));var util=require('util');var logger=require(_0x196f('0x1'))('api');var moment=require(_0x196f('0x2'));var BPromise=require(_0x196f('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x196f('0x4'));var rimraf=require('rimraf');var config=require(_0x196f('0x5'));var attributes=require(_0x196f('0x6'));module[_0x196f('0x7')]=function(_0x1ab7cf,_0x5c3655){return _0x1ab7cf[_0x196f('0x8')](_0x196f('0x9'),attributes,{'tableName':'sms_messages','paranoid':![],'indexes':[{'name':_0x196f('0xa'),'fields':['messageId']},{'name':_0x196f('0xb'),'fields':[_0x196f('0xc')],'type':_0x196f('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x5d3032,_0x2231c8,_0x1da487){var _0x51e86a=_0x1ab7cf['models'];var _0x5f472d=_0x5d3032[_0x196f('0xe')]({'plain':!![]});if(_0x5f472d['direction'][_0x196f('0xf')]()==='in'||_0x5f472d[_0x196f('0x10')]['toLowerCase']()==='out'&&!_0x5f472d['secret']&&!_[_0x196f('0x11')](_0x5f472d[_0x196f('0x12')])&&!_[_0x196f('0x11')](_0x5f472d[_0x196f('0x13')])){_0x51e86a['SmsInteraction'][_0x196f('0x14')]({'where':{'id':_0x5f472d['SmsInteractionId']}})[_0x196f('0x15')](function(_0x304c4c){if(_0x304c4c){_0x304c4c['update']({'lastMsgAt':_0x5f472d[_0x196f('0x16')],'lastMsgDirection':_0x5f472d['direction']['toLowerCase']()});}})[_0x196f('0x17')](function(_0x16e769){console['error'](_0x16e769);});}if(_0x5f472d[_0x196f('0x10')]===_0x196f('0x18')&&!_0x5f472d[_0x196f('0x19')]){var _0x4ebe6b;_0x51e86a['SmsAccount'][_0x196f('0x1a')]({'where':{'id':_0x5f472d[_0x196f('0x1b')]},'raw':!![]})[_0x196f('0x15')](function(_0x1bf1bd){_0x4ebe6b=_0x1bf1bd;if(_0x4ebe6b&&_0x4ebe6b['type']){switch(_0x4ebe6b[_0x196f('0x1c')]){case'twilio':var _0x4a1703=require(_0x196f('0x1d'));if(_0x4ebe6b[_0x196f('0x1e')]&&_0x4ebe6b['authToken']&&_0x4ebe6b[_0x196f('0x1f')]){var _0xeac588=new _0x4a1703(_0x4ebe6b['accountSid'],_0x4ebe6b[_0x196f('0x20')]);_0xeac588[_0x196f('0x21')][_0x196f('0x22')]({'body':_0x5f472d[_0x196f('0xc')],'to':_0x5f472d[_0x196f('0x1f')],'from':_0x4ebe6b[_0x196f('0x1f')],'statusCallback':_0x4ebe6b[_0x196f('0x23')]+_0x196f('0x24')+_0x5f472d['id']+'/status?token='+_0x4ebe6b[_0x196f('0x25')]})[_0x196f('0x15')](function(_0x46a436){if(_0x46a436['sid']){return _0x5d3032['update']({'messageId':_0x46a436[_0x196f('0x26')]});}})[_0x196f('0x17')](function(_0x5c53e3){logger[_0x196f('0x27')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x196f('0x28'),_0x196f('0x1d'),util[_0x196f('0x29')](_0x5c53e3,{'showHidden':![],'depth':null}));});}else{logger[_0x196f('0x27')](_0x196f('0x2a'),_0x196f('0x28'),'twilio','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken');}break;case _0x196f('0x2b'):var _0x2b4574='https://api.skebby.it/API/v1.0/REST/';if(_0x4ebe6b[_0x196f('0x2c')]&&_0x4ebe6b['password']){var _0x2c25bd={'recipient':[_0x5f472d[_0x196f('0x1f')]],'message':_0x5f472d['body'],'message_type':_0x4ebe6b['smsMethod']};if(_0x4ebe6b[_0x196f('0x2d')]&&_0x4ebe6b['smsMethod']!=='SI'){_0x2c25bd[_0x196f('0x2e')]=_0x4ebe6b[_0x196f('0x1f')];}var _0x1d9347={'url':_0x2b4574+_0x196f('0x2f')+_0x4ebe6b[_0x196f('0x2c')]+'&password='+_0x4ebe6b[_0x196f('0x30')],'method':_0x196f('0x31')};rp(_0x1d9347)[_0x196f('0x15')](function(_0x1c1b6c){var _0x2ae825=_0x1c1b6c[_0x196f('0x32')](';');var _0x394ee3={'user_key':_0x2ae825[0x0],'session_key':_0x2ae825[0x1]};_0x1d9347={'url':_0x2b4574+'sms','method':_0x196f('0x33'),'headers':{'user_key':_0x394ee3['user_key'],'Session_key':_0x394ee3[_0x196f('0x34')]},'json':!![],'body':_0x2c25bd};return rp(_0x1d9347);})[_0x196f('0x15')](function(_0x18e8da){if(_0x18e8da[_0x196f('0x35')]>=0x1){var _0x5ba21e={'messageId':_0x18e8da[_0x196f('0x36')]};if(_0x4ebe6b[_0x196f('0x2d')]!=='GP'||!_0x4ebe6b[_0x196f('0x37')]){_0x5ba21e[_0x196f('0x38')]=!![];}return _0x5d3032[_0x196f('0x39')](_0x5ba21e);}else{return logger[_0x196f('0x27')](_0x196f('0x2a'),_0x196f('0x28'),_0x196f('0x2b'),util[_0x196f('0x29')](_0x18e8da,{'showHidden':![],'depth':null}));}})['catch'](function(_0x9a7884){return logger[_0x196f('0x27')](_0x196f('0x2a'),'afterCreate',_0x196f('0x2b'),util[_0x196f('0x29')](_0x9a7884,{'showHidden':![],'depth':null}));});}else{logger[_0x196f('0x27')](_0x196f('0x2a'),_0x196f('0x28'),_0x196f('0x2b'),_0x196f('0x3a'));}break;case _0x196f('0x3b'):if(_0x4ebe6b['authToken']){var _0x17dc47={'recipient':_0x5f472d[_0x196f('0x1f')],'message':_0x5f472d['body'],'sender':_0x4ebe6b['senderString']||_0x4ebe6b[_0x196f('0x1f')],'authorization':_0x4ebe6b[_0x196f('0x20')]};var _0x2231c8={'method':_0x196f('0x33'),'uri':'https://smsapi.connectel.se/api/v2/send/','body':_0x17dc47,'json':!![]};rp(_0x2231c8)[_0x196f('0x15')](function(_0x41c678){var _0x1a2c5f={'messageId':_0x41c678[_0x196f('0x3c')]};if(!_0x4ebe6b[_0x196f('0x37')]){_0x1a2c5f[_0x196f('0x38')]=!![];}return _0x5d3032['update'](_0x1a2c5f);})['catch'](function(_0x5850f8){logger[_0x196f('0x27')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x196f('0x3b'),util[_0x196f('0x29')](_0x5850f8,{'showHidden':![],'depth':null}));});}else{logger[_0x196f('0x27')](_0x196f('0x2a'),'afterCreate',_0x196f('0x3b'),'Missing\x20parameters:\x20authToken');}break;case _0x196f('0x3d'):if(_0x4ebe6b[_0x196f('0x2c')]&&_0x4ebe6b['password']){var _0x17dc47={'messages':[{'source':_0x196f('0x3e'),'to':_0x5f472d['phone'],'body':_0x5f472d[_0x196f('0xc')],'from':_0x4ebe6b[_0x196f('0x3f')]||_0x4ebe6b[_0x196f('0x1f')]}]};var _0x305570=util['format']('%s:%s',_0x4ebe6b[_0x196f('0x2c')],_0x4ebe6b[_0x196f('0x30')]);var _0x2231c8={'method':'POST','uri':_0x196f('0x40'),'body':_0x17dc47,'headers':{'Authorization':util[_0x196f('0x41')]('Basic\x20%s',new Buffer(_0x305570)[_0x196f('0x42')](_0x196f('0x43')))},'json':!![]};rp(_0x2231c8)[_0x196f('0x15')](function(_0x3f7e91){if(_0x3f7e91[_0x196f('0x44')]>=0xc8&&_0x3f7e91[_0x196f('0x44')]<=0xce){if(_0x3f7e91[_0x196f('0x45')]&&_0x3f7e91['data']['queued_count']>0x0){var _0x4baa50=_[_0x196f('0x46')](_0x3f7e91[_0x196f('0x45')]['messages']);var _0x2f25c1={'messageId':_0x4baa50[_0x196f('0x47')]};if(!_0x4ebe6b[_0x196f('0x37')]){_0x2f25c1[_0x196f('0x38')]=!![];}return _0x5d3032[_0x196f('0x39')](_0x2f25c1);}else{logger[_0x196f('0x27')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x196f('0x28'),_0x196f('0x48'),util[_0x196f('0x29')](_0x3f7e91,{'showHidden':![],'depth':null}));}}else{logger[_0x196f('0x27')](_0x196f('0x2a'),_0x196f('0x28'),'clickSend',util['inspect'](_0x3f7e91,{'showHidden':![],'depth':null}));}})[_0x196f('0x17')](function(_0x499f14){logger[_0x196f('0x27')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x196f('0x28'),_0x196f('0x48'),util[_0x196f('0x29')](_0x499f14,{'showHidden':![],'depth':null}));});}else{logger[_0x196f('0x27')](_0x196f('0x2a'),_0x196f('0x28'),_0x196f('0x48'),_0x196f('0x3a'));}break;case _0x196f('0x49'):if(_0x4ebe6b[_0x196f('0x4a')]&&_0x4ebe6b[_0x196f('0x20')]){var _0x17dc47={'dst':_0x5f472d[_0x196f('0x1f')],'text':_0x5f472d[_0x196f('0xc')],'src':_0x4ebe6b[_0x196f('0x3f')]||_0x4ebe6b[_0x196f('0x1f')],'url':_0x4ebe6b[_0x196f('0x23')]+_0x196f('0x24')+_0x5f472d['id']+_0x196f('0x4b')+_0x4ebe6b['token']};var _0x305570=util[_0x196f('0x41')](_0x196f('0x4c'),_0x4ebe6b['authId'],_0x4ebe6b[_0x196f('0x20')]);var _0x2231c8={'method':'POST','uri':util['format'](_0x196f('0x4d'),_0x4ebe6b[_0x196f('0x4a')]),'body':_0x17dc47,'headers':{'Authorization':util[_0x196f('0x41')](_0x196f('0x4e'),new Buffer(_0x305570)[_0x196f('0x42')](_0x196f('0x43')))},'json':!![]};rp(_0x2231c8)[_0x196f('0x15')](function(_0x53a381){var _0x2f90a2={'messageId':_0x53a381['message_uuid'][0x0]};return _0x5d3032[_0x196f('0x39')](_0x2f90a2);})[_0x196f('0x17')](function(_0x417b21){logger[_0x196f('0x27')](_0x196f('0x2a'),_0x196f('0x28'),_0x196f('0x49'),util[_0x196f('0x29')](_0x417b21,{'showHidden':![],'depth':null}));});}else{logger[_0x196f('0x27')](_0x196f('0x2a'),_0x196f('0x28'),_0x196f('0x49'),_0x196f('0x4f'));}break;case _0x196f('0x50'):if(_0x4ebe6b[_0x196f('0x2c')]&&_0x4ebe6b['password']){if(_0x4ebe6b[_0x196f('0x51')]){var _0x350b00={'method':'POST','uri':_0x4ebe6b[_0x196f('0x51')]+'/auth/1/session','body':{'username':_0x4ebe6b[_0x196f('0x2c')],'password':_0x4ebe6b[_0x196f('0x30')]},'json':!![]};return rp(_0x350b00)[_0x196f('0x15')](function(_0x2e3c8b){var _0x248c71={'method':_0x196f('0x33'),'uri':_0x4ebe6b['baseUrl']+_0x196f('0x52'),'body':{'messages':[{'from':_0x4ebe6b[_0x196f('0x1f')],'destinations':[{'to':_0x5f472d[_0x196f('0x1f')]}],'text':_0x5f472d[_0x196f('0xc')],'notifyUrl':_0x4ebe6b[_0x196f('0x23')]+_0x196f('0x24')+_0x5f472d['id']+_0x196f('0x4b')+_0x4ebe6b[_0x196f('0x25')],'notifyContentType':_0x196f('0x53'),'callbackData':_0x4ebe6b['phone']+';'+_0x5f472d['body']}]},'headers':{'Authorization':_0x196f('0x54')+_0x2e3c8b[_0x196f('0x25')]},'json':!![]};return rp(_0x248c71)[_0x196f('0x15')](function(_0x42d420){if(_0x42d420[_0x196f('0x21')]){var _0x24b1ed={'messageId':_0x42d420[_0x196f('0x21')][0x0][_0x196f('0xa')]};if(!_0x4ebe6b[_0x196f('0x37')]){_0x24b1ed['read']=!![];}return _0x5d3032['update'](_0x24b1ed);}else{return logger[_0x196f('0x27')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x196f('0x28'),_0x196f('0x50'),util[_0x196f('0x29')](_0x42d420,{'showHidden':![],'depth':null}));}});})['catch'](function(_0x2c881e){return logger[_0x196f('0x27')](_0x196f('0x2a'),_0x196f('0x28'),_0x196f('0x50'),util[_0x196f('0x29')](_0x2c881e,{'showHidden':![],'depth':null}));});}else{logger[_0x196f('0x27')](_0x196f('0x2a'),_0x196f('0x28'),_0x196f('0x50'),_0x196f('0x55'));}}else{logger['error'](_0x196f('0x2a'),'afterCreate',_0x196f('0x50'),_0x196f('0x3a'));}break;case'csc':var _0x337a34=require(_0x196f('0x56'));if(_0x4ebe6b[_0x196f('0x57')]){var _0x225a12={};_0x225a12['login']=_0x4ebe6b[_0x196f('0x2c')];_0x225a12[_0x196f('0x1f')]=_0x5f472d[_0x196f('0x1f')];_0x225a12[_0x196f('0x2e')]=_0x4ebe6b[_0x196f('0x1f')];_0x225a12['text']=_0x5f472d['body'];_0x225a12['timestamp']=+new Date();var _0x3cd4f8='';var _0x234c51='';var _0x2cf4ed=Object[_0x196f('0x58')](_0x225a12);_0x2cf4ed[_0x196f('0x59')]();for(var _0x267517=0x0;_0x267517<_0x2cf4ed[_0x196f('0x5a')];_0x267517++){if(_0x3cd4f8!=''){_0x3cd4f8+='&';}_0x3cd4f8+=_0x2cf4ed[_0x267517]+'='+encodeURIComponent(_0x225a12[_0x2cf4ed[_0x267517]]);_0x234c51+=_0x225a12[_0x2cf4ed[_0x267517]];}_0x234c51+=_0x4ebe6b[_0x196f('0x57')];_0x234c51=_0x337a34[_0x196f('0x5b')]('md5')['update'](_0x234c51)['digest'](_0x196f('0x5c'));if(_0x3cd4f8!==''){_0x3cd4f8+='&';}_0x3cd4f8+=_0x196f('0x5d')+_0x234c51;var _0x1d9347={'method':'GET','uri':_0x4ebe6b[_0x196f('0x51')]+'/external/get/send.php?'+_0x3cd4f8,'json':!![]};return rp(_0x1d9347)['then'](function(_0x3cd92a){var _0x38887e=Object[_0x196f('0x58')](_0x3cd92a);if(_0x3cd92a[_0x38887e[0x0]][_0x196f('0x27')]&&parseInt(_0x3cd92a[_0x38887e[0x0]][_0x196f('0x27')])===0x0){var _0x37e4ae={'messageId':_0x3cd92a[_0x38887e[0x0]][_0x196f('0x5e')]};if(!_0x4ebe6b[_0x196f('0x37')]){_0x37e4ae[_0x196f('0x38')]=!![];}return _0x5d3032[_0x196f('0x39')](_0x37e4ae);}else{return logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x196f('0x5f'),util[_0x196f('0x29')](_0x3cd92a['error'],{'showHidden':![],'depth':null}));}})[_0x196f('0x17')](function(_0x4052b6){return logger['error'](_0x196f('0x2a'),_0x196f('0x28'),'csc',util[_0x196f('0x29')](_0x4052b6,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x196f('0x2a'),_0x196f('0x28'),'csc','Missing\x20parameters:\x20apiKey');}break;case _0x196f('0x60'):if(_0x4ebe6b[_0x196f('0x57')]){var _0x4118d6={'method':_0x196f('0x33'),'uri':_0x196f('0x61'),'headers':{'Authorization':_0x4ebe6b[_0x196f('0x57')]},'body':{'content':_0x5f472d[_0x196f('0xc')],'to':[_0x5f472d['phone']],'from':_0x4ebe6b[_0x196f('0x1f')],'binary':![],'clientMessageId':_0x196f('0x62'),'charset':'UTF-8'},'json':!![]};rp(_0x4118d6)[_0x196f('0x15')](function(_0x2db46d){if(!_0x2db46d['error']){var _0x43a9e7={'messageId':_0x2db46d[_0x196f('0x21')][0x0][_0x196f('0x63')]};if(!_0x4ebe6b['deliveryReport']){_0x43a9e7[_0x196f('0x38')]=!![];}return _0x5d3032[_0x196f('0x39')](_0x43a9e7);}else{return logger[_0x196f('0x27')](_0x196f('0x2a'),_0x196f('0x28'),_0x196f('0x60'),util[_0x196f('0x29')](_0x2db46d[_0x196f('0x27')],{'showHidden':![],'depth':null}));}})[_0x196f('0x17')](function(_0x63190){return logger[_0x196f('0x27')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x196f('0x60'),util['inspect'](_0x63190,{'showHidden':![],'depth':null}));});}else{logger[_0x196f('0x27')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x196f('0x28'),_0x196f('0x60'),_0x196f('0x64'));}break;case'bandwidth':if(_0x4ebe6b[_0x196f('0x2c')]&&_0x4ebe6b[_0x196f('0x30')]){var _0x305570=util[_0x196f('0x41')]('%s:%s',_0x4ebe6b[_0x196f('0x2c')],_0x4ebe6b[_0x196f('0x30')]);var _0x2231c8={'method':_0x196f('0x33'),'uri':'https://messaging.bandwidth.com/api/v2/users/'+_0x4ebe6b[_0x196f('0x65')]+_0x196f('0x66'),'body':{'to':[_0x5f472d['phone']],'text':_0x5f472d[_0x196f('0xc')],'from':_0x4ebe6b['phone'],'applicationId':_0x4ebe6b['applicationId']},'headers':{'Authorization':util[_0x196f('0x41')](_0x196f('0x4e'),new Buffer(_0x305570)[_0x196f('0x42')](_0x196f('0x43')))},'json':!![]};rp(_0x2231c8)[_0x196f('0x15')](function(_0x5cd30c){if(_0x5cd30c['id']){var _0x5cfa94={'messageId':_0x5cd30c['id']};return _0x5d3032[_0x196f('0x39')](_0x5cfa94);}else{logger['error'](_0x196f('0x2a'),_0x196f('0x28'),_0x196f('0x67'),util[_0x196f('0x29')](_0x5cd30c,{'showHidden':![],'depth':null}));}})[_0x196f('0x17')](function(_0x3312b0){logger['error'](_0x196f('0x2a'),_0x196f('0x28'),_0x196f('0x67'),util['inspect'](_0x3312b0,{'showHidden':![],'depth':null}));});}else{logger[_0x196f('0x27')](_0x196f('0x2a'),'afterCreate',_0x196f('0x67'),_0x196f('0x3a'));}break;case _0x196f('0x68'):if(_0x4ebe6b[_0x196f('0x57')]){var _0x457c08={};var _0x1d9347={'method':_0x196f('0x33'),'uri':_0x196f('0x69'),'headers':{'Authorization':'Bearer\x20'+_0x4ebe6b[_0x196f('0x57')],'Content-Type':'application/json'},'body':{'from':_0x4ebe6b[_0x196f('0x1f')],'to':_0x5f472d['phone'],'text':_0x5f472d[_0x196f('0xc')]},'json':!![]};return rp(_0x1d9347)[_0x196f('0x15')](function(_0x1a925b){if(_0x1a925b[_0x196f('0x6a')]==0xca){_0x457c08[_0x196f('0x6b')]=_0x1a925b;var _0x50e5fe={'method':_0x196f('0x33'),'uri':_0x196f('0x6c'),'headers':{'Authorization':_0x196f('0x6d')+_0x4ebe6b[_0x196f('0x57')],'Content-Type':'application/json'},'body':{'refid':_0x457c08[_0x196f('0x6b')]['refid']},'json':!![]};return rp(_0x50e5fe)[_0x196f('0x15')](function(_0x5d82ff){_0x457c08[_0x196f('0x6e')]=_0x5d82ff;var _0x4aef62={'messageId':_0x457c08['message']['refid'],'read':!![]};return _0x5d3032[_0x196f('0x39')](_0x4aef62);});}else{return logger[_0x196f('0x27')](_0x196f('0x2a'),'afterCreate',_0x196f('0x68'),util[_0x196f('0x29')](_0x1a925b,{'showHidden':![],'depth':null}));}})[_0x196f('0x17')](function(_0x574d7d){return logger['error'](_0x196f('0x2a'),'afterCreate','intelepeer',util['inspect'](_0x574d7d,{'showHidden':![],'depth':null}));});}else{return logger[_0x196f('0x27')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x196f('0x68'),_0x196f('0x6f'));}break;}}})[_0x196f('0x70')](function(){_0x1da487();});}else{_0x1da487();}}},'charset':_0x196f('0x71'),'collate':_0x196f('0x72')});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.rpc.js b/server/api/smsMessage/smsMessage.rpc.js index d721420..c30d84f 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 _0x725c=['../../config/logger','rpc','../../config/environment','jayson/promise','redis','localhost','socket.io-emitter','./smsMessage.socket','then','info','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','CreateSmsMessage','SmsMessage','body','options','raw','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x18d63d,_0x3c7505){var _0x3fc4d3=function(_0x139485){while(--_0x139485){_0x18d63d['push'](_0x18d63d['shift']());}};_0x3fc4d3(++_0x3c7505);}(_0x725c,0x180));var _0xc725=function(_0x268fdd,_0x46b228){_0x268fdd=_0x268fdd-0x0;var _0x5ce50c=_0x725c[_0x268fdd];return _0x5ce50c;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xc725('0x0'));var BPromise=require(_0xc725('0x1'));var rs=require(_0xc725('0x2'));var fs=require('fs');var Redis=require(_0xc725('0x3'));var db=require(_0xc725('0x4'))['db'];var utils=require(_0xc725('0x5'));var logger=require(_0xc725('0x6'))(_0xc725('0x7'));var config=require(_0xc725('0x8'));var jayson=require(_0xc725('0x9'));var client=jayson['client']['http']({'port':0x232a});config[_0xc725('0xa')]=_['defaults'](config['redis'],{'host':_0xc725('0xb'),'port':0x18eb});var socket=require(_0xc725('0xc'))(new Redis(config[_0xc725('0xa')]));require(_0xc725('0xd'))['register'](socket);function respondWithRpcPromise(_0x1aa02d,_0x102b93,_0x4c4ba1){return new BPromise(function(_0x3551d1,_0x292bd9){return client['request'](_0x1aa02d,_0x4c4ba1)[_0xc725('0xe')](function(_0x208a64){logger[_0xc725('0xf')](_0xc725('0x10'),_0x102b93,_0xc725('0x11'));logger[_0xc725('0x12')](_0xc725('0x13'),_0x102b93,_0xc725('0x11'),JSON[_0xc725('0x14')](_0x208a64));if(_0x208a64[_0xc725('0x15')]){if(_0x208a64['error'][_0xc725('0x16')]===0x1f4){logger[_0xc725('0x15')]('SmsMessage,\x20%s,\x20%s',_0x102b93,_0x208a64[_0xc725('0x15')][_0xc725('0x17')]);return _0x292bd9(_0x208a64[_0xc725('0x15')][_0xc725('0x17')]);}logger[_0xc725('0x15')](_0xc725('0x10'),_0x102b93,_0x208a64[_0xc725('0x15')][_0xc725('0x17')]);return _0x3551d1(_0x208a64[_0xc725('0x15')][_0xc725('0x17')]);}else{logger[_0xc725('0xf')](_0xc725('0x10'),_0x102b93,_0xc725('0x11'));_0x3551d1(_0x208a64['result'][_0xc725('0x17')]);}})[_0xc725('0x18')](function(_0x932377){logger[_0xc725('0x15')](_0xc725('0x10'),_0x102b93,_0x932377);_0x292bd9(_0x932377);});});}exports[_0xc725('0x19')]=function(_0x4d67bc){var _0x3ced07=this;return new Promise(function(_0x27ac4d,_0x1d826f){return db[_0xc725('0x1a')]['create'](_0x4d67bc[_0xc725('0x1b')],{'raw':_0x4d67bc['options']?_0x4d67bc[_0xc725('0x1c')][_0xc725('0x1d')]===undefined?!![]:![]:!![]})['then'](function(_0x2f45c9){logger['info'](_0xc725('0x19'),_0x4d67bc);logger[_0xc725('0x12')]('CreateSmsMessage',_0x4d67bc,JSON[_0xc725('0x14')](_0x2f45c9));_0x27ac4d(_0x2f45c9);})[_0xc725('0x18')](function(_0x147366){logger[_0xc725('0x15')](_0xc725('0x19'),_0x147366[_0xc725('0x17')],_0x4d67bc);_0x1d826f(_0x3ced07[_0xc725('0x15')](0x1f4,_0x147366[_0xc725('0x17')]));});});}; \ No newline at end of file +var _0x2fb1=['http','redis','defaults','localhost','socket.io-emitter','./smsMessage.socket','register','request','info','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','SmsMessage,\x20%s,\x20%s','message','result','catch','CreateSmsMessage','SmsMessage','options','raw','then','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x53758c,_0x3f5260){var _0x297de2=function(_0x20e632){while(--_0x20e632){_0x53758c['push'](_0x53758c['shift']());}};_0x297de2(++_0x3f5260);}(_0x2fb1,0x105));var _0x12fb=function(_0x557b76,_0x4fde98){_0x557b76=_0x557b76-0x0;var _0x27ab4f=_0x2fb1[_0x557b76];return _0x27ab4f;};'use strict';var _=require('lodash');var util=require(_0x12fb('0x0'));var moment=require(_0x12fb('0x1'));var BPromise=require(_0x12fb('0x2'));var rs=require(_0x12fb('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x12fb('0x4'))['db'];var utils=require(_0x12fb('0x5'));var logger=require(_0x12fb('0x6'))(_0x12fb('0x7'));var config=require(_0x12fb('0x8'));var jayson=require(_0x12fb('0x9'));var client=jayson[_0x12fb('0xa')][_0x12fb('0xb')]({'port':0x232a});config[_0x12fb('0xc')]=_[_0x12fb('0xd')](config[_0x12fb('0xc')],{'host':_0x12fb('0xe'),'port':0x18eb});var socket=require(_0x12fb('0xf'))(new Redis(config[_0x12fb('0xc')]));require(_0x12fb('0x10'))[_0x12fb('0x11')](socket);function respondWithRpcPromise(_0x10aef3,_0x410249,_0x2df64b){return new BPromise(function(_0x2e47a7,_0xb0501f){return client[_0x12fb('0x12')](_0x10aef3,_0x2df64b)['then'](function(_0x13915b){logger[_0x12fb('0x13')]('SmsMessage,\x20%s,\x20%s',_0x410249,_0x12fb('0x14'));logger[_0x12fb('0x15')](_0x12fb('0x16'),_0x410249,_0x12fb('0x14'),JSON[_0x12fb('0x17')](_0x13915b));if(_0x13915b[_0x12fb('0x18')]){if(_0x13915b[_0x12fb('0x18')]['code']===0x1f4){logger[_0x12fb('0x18')](_0x12fb('0x19'),_0x410249,_0x13915b[_0x12fb('0x18')]['message']);return _0xb0501f(_0x13915b[_0x12fb('0x18')][_0x12fb('0x1a')]);}logger[_0x12fb('0x18')](_0x12fb('0x19'),_0x410249,_0x13915b[_0x12fb('0x18')][_0x12fb('0x1a')]);return _0x2e47a7(_0x13915b[_0x12fb('0x18')][_0x12fb('0x1a')]);}else{logger[_0x12fb('0x13')](_0x12fb('0x19'),_0x410249,_0x12fb('0x14'));_0x2e47a7(_0x13915b[_0x12fb('0x1b')][_0x12fb('0x1a')]);}})[_0x12fb('0x1c')](function(_0x554e13){logger[_0x12fb('0x18')](_0x12fb('0x19'),_0x410249,_0x554e13);_0xb0501f(_0x554e13);});});}exports[_0x12fb('0x1d')]=function(_0x5574a1){var _0x11ac72=this;return new Promise(function(_0xf1eea4,_0x1f4b95){return db[_0x12fb('0x1e')]['create'](_0x5574a1['body'],{'raw':_0x5574a1['options']?_0x5574a1[_0x12fb('0x1f')][_0x12fb('0x20')]===undefined?!![]:![]:!![]})[_0x12fb('0x21')](function(_0x24b5e0){logger[_0x12fb('0x13')]('CreateSmsMessage',_0x5574a1);logger[_0x12fb('0x15')]('CreateSmsMessage',_0x5574a1,JSON[_0x12fb('0x17')](_0x24b5e0));_0xf1eea4(_0x24b5e0);})['catch'](function(_0x1c0822){logger[_0x12fb('0x18')](_0x12fb('0x1d'),_0x1c0822['message'],_0x5574a1);_0x1f4b95(_0x11ac72['error'](0x1f4,_0x1c0822['message']));});});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.socket.js b/server/api/smsMessage/smsMessage.socket.js index cd0cc34..4729bff 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 _0xa366=['length','smsMessage:','./smsMessage.events','remove','emit','removeListener'];(function(_0x521f96,_0x2561cf){var _0x299995=function(_0x1299b5){while(--_0x1299b5){_0x521f96['push'](_0x521f96['shift']());}};_0x299995(++_0x2561cf);}(_0xa366,0x194));var _0x6a36=function(_0x379245,_0x32a201){_0x379245=_0x379245-0x0;var _0x4711b5=_0xa366[_0x379245];return _0x4711b5;};'use strict';var SmsMessageEvents=require(_0x6a36('0x0'));var events=['save',_0x6a36('0x1'),'update'];function createListener(_0x357353,_0x390f12){return function(_0x832ace){_0x390f12[_0x6a36('0x2')](_0x357353,_0x832ace);};}function removeListener(_0x57f505,_0x22434c){return function(){SmsMessageEvents[_0x6a36('0x3')](_0x57f505,_0x22434c);};}exports['register']=function(_0xbc641f){for(var _0x539e72=0x0,_0x3efdbd=events[_0x6a36('0x4')];_0x539e72<_0x3efdbd;_0x539e72++){var _0x38b806=events[_0x539e72];var _0x41fcb1=createListener(_0x6a36('0x5')+_0x38b806,_0xbc641f);SmsMessageEvents['on'](_0x38b806,_0x41fcb1);}}; \ No newline at end of file +var _0x0c29=['removeListener','length','./smsMessage.events','save','update','emit'];(function(_0x15802c,_0x240be6){var _0x33d406=function(_0x5d8478){while(--_0x5d8478){_0x15802c['push'](_0x15802c['shift']());}};_0x33d406(++_0x240be6);}(_0x0c29,0xe0));var _0x90c2=function(_0x45346d,_0xffd56b){_0x45346d=_0x45346d-0x0;var _0x5ce7ca=_0x0c29[_0x45346d];return _0x5ce7ca;};'use strict';var SmsMessageEvents=require(_0x90c2('0x0'));var events=[_0x90c2('0x1'),'remove',_0x90c2('0x2')];function createListener(_0x450f90,_0x5838ab){return function(_0x4fd0db){_0x5838ab[_0x90c2('0x3')](_0x450f90,_0x4fd0db);};}function removeListener(_0x47879b,_0x2fee3a){return function(){SmsMessageEvents[_0x90c2('0x4')](_0x47879b,_0x2fee3a);};}exports['register']=function(_0x302d60){for(var _0x53a969=0x0,_0x516b32=events[_0x90c2('0x5')];_0x53a969<_0x516b32;_0x53a969++){var _0x149c15=events[_0x53a969];var _0x3ee8b4=createListener('smsMessage:'+_0x149c15,_0x302d60);SmsMessageEvents['on'](_0x149c15,_0x3ee8b4);}}; \ No newline at end of file diff --git a/server/api/smsQueue/index.js b/server/api/smsQueue/index.js index b2466f7..cb83704 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 _0x5a5c=['multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsQueue.controller','get','index','/describe','isAuthenticated','/:id','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','create','addAgents','put','update','delete','destroy','removeTeams','removeAgents','exports'];(function(_0x1df477,_0x283d12){var _0x1854bd=function(_0x465b68){while(--_0x465b68){_0x1df477['push'](_0x1df477['shift']());}};_0x1854bd(++_0x283d12);}(_0x5a5c,0xe0));var _0xc5a5=function(_0x2d8fc2,_0x1c461d){_0x2d8fc2=_0x2d8fc2-0x0;var _0x3a9e53=_0x5a5c[_0x2d8fc2];return _0x3a9e53;};'use strict';var multer=require(_0xc5a5('0x0'));var util=require(_0xc5a5('0x1'));var path=require(_0xc5a5('0x2'));var timeout=require(_0xc5a5('0x3'));var express=require(_0xc5a5('0x4'));var router=express[_0xc5a5('0x5')]();var fs_extra=require(_0xc5a5('0x6'));var auth=require(_0xc5a5('0x7'));var interaction=require(_0xc5a5('0x8'));var config=require(_0xc5a5('0x9'));var controller=require(_0xc5a5('0xa'));router[_0xc5a5('0xb')]('/',auth['isAuthenticated'](),controller[_0xc5a5('0xc')]);router['get'](_0xc5a5('0xd'),auth[_0xc5a5('0xe')](),controller['describe']);router['get'](_0xc5a5('0xf'),auth['isAuthenticated'](),controller['show']);router[_0xc5a5('0xb')](_0xc5a5('0x10'),auth[_0xc5a5('0xe')](),controller[_0xc5a5('0x11')]);router[_0xc5a5('0xb')](_0xc5a5('0x12'),auth[_0xc5a5('0xe')](),controller[_0xc5a5('0x13')]);router[_0xc5a5('0xb')](_0xc5a5('0x14'),auth[_0xc5a5('0xe')](),controller[_0xc5a5('0x15')]);router[_0xc5a5('0x16')]('/',auth[_0xc5a5('0xe')](),controller[_0xc5a5('0x17')]);router[_0xc5a5('0x16')](_0xc5a5('0x12'),auth[_0xc5a5('0xe')](),controller['addTeams']);router['post'](_0xc5a5('0x14'),auth[_0xc5a5('0xe')](),controller[_0xc5a5('0x18')]);router[_0xc5a5('0x19')](_0xc5a5('0xf'),auth['isAuthenticated'](),controller[_0xc5a5('0x1a')]);router[_0xc5a5('0x1b')](_0xc5a5('0xf'),auth[_0xc5a5('0xe')](),controller[_0xc5a5('0x1c')]);router[_0xc5a5('0x1b')](_0xc5a5('0x12'),auth[_0xc5a5('0xe')](),controller[_0xc5a5('0x1d')]);router[_0xc5a5('0x1b')]('/:id/users',auth[_0xc5a5('0xe')](),controller[_0xc5a5('0x1e')]);module[_0xc5a5('0x1f')]=router; \ No newline at end of file +var _0x0969=['./smsQueue.controller','index','get','/describe','isAuthenticated','show','getMembers','/:id/teams','getTeams','/:id/users','post','create','addAgents','put','/:id','update','delete','removeAgents','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x470e67,_0x4a596d){var _0x28bbde=function(_0x1bbf56){while(--_0x1bbf56){_0x470e67['push'](_0x470e67['shift']());}};_0x28bbde(++_0x4a596d);}(_0x0969,0x10f));var _0x9096=function(_0x187ee1,_0x3fd1e6){_0x187ee1=_0x187ee1-0x0;var _0x388160=_0x0969[_0x187ee1];return _0x388160;};'use strict';var multer=require(_0x9096('0x0'));var util=require(_0x9096('0x1'));var path=require('path');var timeout=require(_0x9096('0x2'));var express=require(_0x9096('0x3'));var router=express[_0x9096('0x4')]();var fs_extra=require(_0x9096('0x5'));var auth=require(_0x9096('0x6'));var interaction=require(_0x9096('0x7'));var config=require(_0x9096('0x8'));var controller=require(_0x9096('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0x9096('0xa')]);router[_0x9096('0xb')](_0x9096('0xc'),auth[_0x9096('0xd')](),controller['describe']);router[_0x9096('0xb')]('/:id',auth[_0x9096('0xd')](),controller[_0x9096('0xe')]);router[_0x9096('0xb')]('/:id/members',auth[_0x9096('0xd')](),controller[_0x9096('0xf')]);router[_0x9096('0xb')](_0x9096('0x10'),auth['isAuthenticated'](),controller[_0x9096('0x11')]);router[_0x9096('0xb')](_0x9096('0x12'),auth['isAuthenticated'](),controller['getAgents']);router[_0x9096('0x13')]('/',auth[_0x9096('0xd')](),controller[_0x9096('0x14')]);router[_0x9096('0x13')](_0x9096('0x10'),auth[_0x9096('0xd')](),controller['addTeams']);router['post']('/:id/users',auth[_0x9096('0xd')](),controller[_0x9096('0x15')]);router[_0x9096('0x16')](_0x9096('0x17'),auth[_0x9096('0xd')](),controller[_0x9096('0x18')]);router[_0x9096('0x19')]('/:id',auth[_0x9096('0xd')](),controller['destroy']);router['delete'](_0x9096('0x10'),auth[_0x9096('0xd')](),controller['removeTeams']);router['delete'](_0x9096('0x12'),auth[_0x9096('0xd')](),controller[_0x9096('0x1a')]);module[_0x9096('0x1b')]=router; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.attributes.js b/server/api/smsQueue/smsQueue.attributes.js index 73fa721..a0ca7ff 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 _0x20c1=['exports','STRING','name','INTEGER','ENUM','rrmemory','beepall','roundrobin','sequelize'];(function(_0x4051be,_0x4e30dc){var _0x10d8e5=function(_0x1ae1c2){while(--_0x1ae1c2){_0x4051be['push'](_0x4051be['shift']());}};_0x10d8e5(++_0x4e30dc);}(_0x20c1,0xd7));var _0x120c=function(_0x16d1fa,_0x523fce){_0x16d1fa=_0x16d1fa-0x0;var _0x4e3d7f=_0x20c1[_0x16d1fa];return _0x4e3d7f;};'use strict';var Sequelize=require(_0x120c('0x0'));module[_0x120c('0x1')]={'name':{'type':Sequelize[_0x120c('0x2')],'unique':_0x120c('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x120c('0x2')]},'timeout':{'type':Sequelize[_0x120c('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x120c('0x5')](_0x120c('0x6'),_0x120c('0x7'),_0x120c('0x8'))}}; \ No newline at end of file +var _0xe550=['rrmemory','roundrobin','sequelize','exports','STRING','name','INTEGER','ENUM'];(function(_0xbf3369,_0x53c50a){var _0x4d35ce=function(_0x100c4f){while(--_0x100c4f){_0xbf3369['push'](_0xbf3369['shift']());}};_0x4d35ce(++_0x53c50a);}(_0xe550,0x18a));var _0x0e55=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xe550[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0x0e55('0x0'));module[_0x0e55('0x1')]={'name':{'type':Sequelize[_0x0e55('0x2')],'unique':_0x0e55('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x0e55('0x2')]},'timeout':{'type':Sequelize[_0x0e55('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x0e55('0x5')](_0x0e55('0x6'),'beepall',_0x0e55('0x7'))}}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.controller.js b/server/api/smsQueue/smsQueue.controller.js index 82ae689..a417e45 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 _0x0b0e=['userSmsQueue:save','removeTeams','select','field','tq.TeamId','from','team_has_sms_queues','join','clone','ut.UserId\x20=\x20?','push','QueryTypes','every','TeamId','union','value','removeAgents','forEach','userSmsQueue:remove','addAgents','omit','spread','isArray','getAgents','hasOwnProperty','bluebird','lodash','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','status','end','json','offset','undefined','limit','count','set','update','SmsQueues','destroy','then','error','stack','name','send','SmsQueue','fieldName','type','key','getOptions','include','query','findAll','rows','show','model','keys','rawAttributes','filters','intersection','attributes','fields','length','includeAll','merge','options','find','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','create','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','params','nolimit','order','sort','where','SmsQueueId','filter','map','UserSmsQueue','User','findAndCountAll','UserId','agent','smsPause','updatedAt','createdAt','%s/%s','SIP','findOne','Team','pick','getTeams','ids','Agents','online','voicePause','interface','flatMap','sequelize','transaction','each','emit'];(function(_0x3a6efd,_0x2a5102){var _0x487b9a=function(_0x104f89){while(--_0x104f89){_0x3a6efd['push'](_0x3a6efd['shift']());}};_0x487b9a(++_0x2a5102);}(_0x0b0e,0x187));var _0xe0b0=function(_0x280ae7,_0x456fb1){_0x280ae7=_0x280ae7-0x0;var _0x418b9e=_0x0b0e[_0x280ae7];return _0x418b9e;};'use strict';var BPromise=require(_0xe0b0('0x0'));var util=require('util');var _=require(_0xe0b0('0x1'));var squel=require('squel');var Redis=require(_0xe0b0('0x2'));var qs=require(_0xe0b0('0x3'));var logger=require(_0xe0b0('0x4'))(_0xe0b0('0x5'));var config=require(_0xe0b0('0x6'));var db=require(_0xe0b0('0x7'))['db'];config[_0xe0b0('0x8')]=_[_0xe0b0('0x9')](config[_0xe0b0('0x8')],{'host':_0xe0b0('0xa'),'port':0x18eb});var socket=require(_0xe0b0('0xb'))(new Redis(config['redis']));require('./smsQueue.socket')[_0xe0b0('0xc')](socket);function respondWithStatusCode(_0x435060,_0xc4a085){_0xc4a085=_0xc4a085||0xcc;return function(_0x2ac27e){if(_0x2ac27e){return _0x435060['sendStatus'](_0xc4a085);}return _0x435060[_0xe0b0('0xd')](_0xc4a085)[_0xe0b0('0xe')]();};}function respondWithResult(_0x553d4f,_0x1fef28){_0x1fef28=_0x1fef28||0xc8;return function(_0x2f32b6){if(_0x2f32b6){return _0x553d4f['status'](_0x1fef28)[_0xe0b0('0xf')](_0x2f32b6);}};}function respondWithFilteredResult(_0x2cdad2,_0x39b1c2){return function(_0x585615){if(_0x585615){var _0x3068c0=typeof _0x39b1c2[_0xe0b0('0x10')]===_0xe0b0('0x11')&&typeof _0x39b1c2[_0xe0b0('0x12')]===_0xe0b0('0x11');var _0x4d2bf7=_0x585615[_0xe0b0('0x13')];var _0x154de6=_0x3068c0?0x0:_0x39b1c2[_0xe0b0('0x10')];var _0x24babd=_0x3068c0?_0x585615[_0xe0b0('0x13')]:_0x39b1c2['offset']+_0x39b1c2[_0xe0b0('0x12')];var _0x5adb01;if(_0x24babd>=_0x4d2bf7){_0x24babd=_0x4d2bf7;_0x5adb01=0xc8;}else{_0x5adb01=0xce;}_0x2cdad2[_0xe0b0('0xd')](_0x5adb01);return _0x2cdad2[_0xe0b0('0x14')]('Content-Range',_0x154de6+'-'+_0x24babd+'/'+_0x4d2bf7)[_0xe0b0('0xf')](_0x585615);}return null;};}function saveUpdates(_0x4a4cc0){return function(_0x2d6fb6){if(_0x2d6fb6){return _0x2d6fb6[_0xe0b0('0x15')](_0x4a4cc0)['then'](function(_0x54a3eb){return _0x54a3eb;});}return null;};}function removeEntity(_0x46bb44){return function(_0x50a441){if(_0x50a441){return _0x50a441['destroy']()['then'](function(){var _0x1920ee=_0x50a441['get']({'plain':!![]});var _0x52598b=_0xe0b0('0x16');return db['UserProfileResource'][_0xe0b0('0x17')]({'where':{'type':_0x52598b,'resourceId':_0x1920ee['id']}})['then'](function(){return _0x50a441;});})[_0xe0b0('0x18')](function(){_0x46bb44[_0xe0b0('0xd')](0xcc)[_0xe0b0('0xe')]();});}};}function handleEntityNotFound(_0x310a6d){return function(_0x2cf6a1){if(!_0x2cf6a1){_0x310a6d['sendStatus'](0x194);}return _0x2cf6a1;};}function handleError(_0x4cae54,_0x2fa820){_0x2fa820=_0x2fa820||0x1f4;return function(_0x5512bb){logger[_0xe0b0('0x19')](_0x5512bb[_0xe0b0('0x1a')]);if(_0x5512bb['name']){delete _0x5512bb[_0xe0b0('0x1b')];}_0x4cae54['status'](_0x2fa820)[_0xe0b0('0x1c')](_0x5512bb);};}exports['index']=function(_0x28586d,_0x576352){var _0x3e5c88={};var _0x4de537={'count':0x0,'rows':[]};var _0x4700cc=_['map'](db[_0xe0b0('0x1d')]['rawAttributes'],function(_0x362aba){return{'name':_0x362aba[_0xe0b0('0x1e')],'type':_0x362aba[_0xe0b0('0x1f')][_0xe0b0('0x20')]};});_0x3e5c88=qs[_0xe0b0('0x21')](_0x4700cc,_0x28586d);var _0x10745d={'where':_0x3e5c88['where']};return db[_0xe0b0('0x1d')][_0xe0b0('0x13')](_0x10745d)['then'](function(_0x15e13b){_0x4de537[_0xe0b0('0x13')]=_0x15e13b;_0x3e5c88[_0xe0b0('0x22')]=qs[_0xe0b0('0x22')](_0x28586d[_0xe0b0('0x23')]);return db[_0xe0b0('0x1d')][_0xe0b0('0x24')](_0x3e5c88);})['then'](function(_0x1854b8){_0x4de537[_0xe0b0('0x25')]=_0x1854b8;return _0x4de537;})['then'](respondWithFilteredResult(_0x576352,_0x3e5c88))['catch'](handleError(_0x576352,null));};exports[_0xe0b0('0x26')]=function(_0x33e672,_0x422575){var _0x3f81d5={'raw':!![],'where':{'id':_0x33e672['params']['id']}},_0x2ab1b1={};_0x2ab1b1[_0xe0b0('0x27')]=_[_0xe0b0('0x28')](db[_0xe0b0('0x1d')][_0xe0b0('0x29')]);_0x2ab1b1[_0xe0b0('0x23')]=_['keys'](_0x33e672[_0xe0b0('0x23')]);_0x2ab1b1[_0xe0b0('0x2a')]=_[_0xe0b0('0x2b')](_0x2ab1b1[_0xe0b0('0x27')],_0x2ab1b1[_0xe0b0('0x23')]);_0x3f81d5[_0xe0b0('0x2c')]=_[_0xe0b0('0x2b')](_0x2ab1b1[_0xe0b0('0x27')],qs[_0xe0b0('0x2d')](_0x33e672[_0xe0b0('0x23')][_0xe0b0('0x2d')]));_0x3f81d5[_0xe0b0('0x2c')]=_0x3f81d5[_0xe0b0('0x2c')][_0xe0b0('0x2e')]?_0x3f81d5[_0xe0b0('0x2c')]:_0x2ab1b1['model'];if(_0x33e672[_0xe0b0('0x23')][_0xe0b0('0x2f')]){_0x3f81d5[_0xe0b0('0x22')]=[{'all':!![]}];}_0x3f81d5=_[_0xe0b0('0x30')]({},_0x3f81d5,_0x33e672[_0xe0b0('0x31')]);return db[_0xe0b0('0x1d')][_0xe0b0('0x32')](_0x3f81d5)['then'](handleEntityNotFound(_0x422575,null))['then'](respondWithResult(_0x422575,null))['catch'](handleError(_0x422575,null));};exports['create']=function(_0x26137c,_0xc3d967){return db[_0xe0b0('0x1d')]['create'](_0x26137c[_0xe0b0('0x33')],{})[_0xe0b0('0x18')](function(_0x1cd705){var _0x297c64=_0x26137c['user'][_0xe0b0('0x34')]({'plain':!![]});if(!_0x297c64)throw new Error(_0xe0b0('0x35'));if(_0x297c64[_0xe0b0('0x36')]===_0xe0b0('0x37')){var _0x4265e3=_0x1cd705[_0xe0b0('0x34')]({'plain':!![]});var _0x8b745=_0xe0b0('0x16');return db[_0xe0b0('0x38')]['find']({'where':{'name':_0x8b745,'userProfileId':_0x297c64[_0xe0b0('0x39')]},'raw':!![]})['then'](function(_0x34178d){if(_0x34178d&&_0x34178d[_0xe0b0('0x3a')]===0x0){return db[_0xe0b0('0x3b')][_0xe0b0('0x3c')]({'name':_0x4265e3['name'],'resourceId':_0x4265e3['id'],'type':_0x34178d[_0xe0b0('0x1b')],'sectionId':_0x34178d['id']},{})[_0xe0b0('0x18')](function(){return _0x1cd705;});}else{return _0x1cd705;}})[_0xe0b0('0x3d')](function(_0x402a0e){logger[_0xe0b0('0x19')](_0xe0b0('0x3e'),_0x402a0e);throw _0x402a0e;});}return _0x1cd705;})[_0xe0b0('0x18')](respondWithResult(_0xc3d967,0xc9))[_0xe0b0('0x3d')](handleError(_0xc3d967,null));};exports['update']=function(_0x2aad80,_0x309bbf){if(_0x2aad80['body']['id']){delete _0x2aad80['body']['id'];}return db[_0xe0b0('0x1d')][_0xe0b0('0x32')]({'where':{'id':_0x2aad80['params']['id']}})[_0xe0b0('0x18')](handleEntityNotFound(_0x309bbf,null))[_0xe0b0('0x18')](saveUpdates(_0x2aad80[_0xe0b0('0x33')],null))[_0xe0b0('0x18')](respondWithResult(_0x309bbf,null))[_0xe0b0('0x3d')](handleError(_0x309bbf,null));};exports['destroy']=function(_0x5d2fa2,_0x51c580){return db[_0xe0b0('0x1d')][_0xe0b0('0x32')]({'where':{'id':_0x5d2fa2['params']['id']}})[_0xe0b0('0x18')](handleEntityNotFound(_0x51c580,null))[_0xe0b0('0x18')](removeEntity(_0x51c580,null))[_0xe0b0('0x3d')](handleError(_0x51c580,null));};exports[_0xe0b0('0x3f')]=function(_0x16ccca,_0x5c6f94){return db['SmsQueue'][_0xe0b0('0x3f')]()[_0xe0b0('0x18')](respondWithResult(_0x5c6f94,null))[_0xe0b0('0x3d')](handleError(_0x5c6f94,null));};exports[_0xe0b0('0x40')]=function(_0x1bf77d,_0x575c7d){var _0x3b1474={'raw':!![],'where':{}},_0x11d4fd={},_0x534340;return db['SmsQueue']['findOne']({'where':{'id':_0x1bf77d[_0xe0b0('0x41')]['id']}})[_0xe0b0('0x18')](handleEntityNotFound(_0x575c7d,null))[_0xe0b0('0x18')](function(_0x364877){if(_0x364877){_0x534340=_0x364877['get']({'plain':!![]});_0x11d4fd[_0xe0b0('0x27')]=_[_0xe0b0('0x28')](db['UserSmsQueue']['rawAttributes']);_0x11d4fd[_0xe0b0('0x23')]=_[_0xe0b0('0x28')](_0x1bf77d['query']);_0x11d4fd[_0xe0b0('0x2a')]=_[_0xe0b0('0x2b')](_0x11d4fd['model'],_0x11d4fd['query']);_0x3b1474[_0xe0b0('0x2c')]=_['intersection'](_0x11d4fd[_0xe0b0('0x27')],qs[_0xe0b0('0x2d')](_0x1bf77d[_0xe0b0('0x23')][_0xe0b0('0x2d')]));_0x3b1474[_0xe0b0('0x2c')]=_0x3b1474[_0xe0b0('0x2c')]['length']?_0x3b1474['attributes']:_0x11d4fd[_0xe0b0('0x27')];if(!_0x1bf77d['query']['hasOwnProperty'](_0xe0b0('0x42'))){_0x3b1474[_0xe0b0('0x12')]=qs['limit'](_0x1bf77d['query'][_0xe0b0('0x12')]);_0x3b1474[_0xe0b0('0x10')]=qs[_0xe0b0('0x10')](_0x1bf77d[_0xe0b0('0x23')][_0xe0b0('0x10')]);}_0x3b1474[_0xe0b0('0x43')]=qs[_0xe0b0('0x44')](_0x1bf77d['query'][_0xe0b0('0x44')]);_0x3b1474['where']=qs[_0xe0b0('0x2a')](_['pick'](_0x1bf77d['query'],_0x11d4fd[_0xe0b0('0x2a')]));_0x3b1474[_0xe0b0('0x45')][_0xe0b0('0x46')]=_0x364877['id'];if(_0x1bf77d[_0xe0b0('0x23')][_0xe0b0('0x47')]){_0x3b1474[_0xe0b0('0x45')]=_[_0xe0b0('0x30')](_0x3b1474[_0xe0b0('0x45')],{'$or':_[_0xe0b0('0x48')](_0x3b1474['attributes'],function(_0x253ab0){var _0x57ccc9={};_0x57ccc9[_0x253ab0]={'$like':'%'+_0x1bf77d[_0xe0b0('0x23')][_0xe0b0('0x47')]+'%'};return _0x57ccc9;})});}_0x3b1474=_[_0xe0b0('0x30')]({},_0x3b1474,_0x1bf77d[_0xe0b0('0x31')]);return db[_0xe0b0('0x49')][_0xe0b0('0x24')](_0x3b1474);}})['then'](function(_0x1a057c){if(_0x1a057c){return db[_0xe0b0('0x4a')][_0xe0b0('0x4b')]({'where':{'id':_[_0xe0b0('0x48')](_0x1a057c,_0xe0b0('0x4c')),'role':_0xe0b0('0x4d')},'attributes':['id',_0xe0b0('0x1b'),_0xe0b0('0x4e'),_0xe0b0('0x4f'),_0xe0b0('0x50')]});}})[_0xe0b0('0x18')](function(_0x18ab99){if(_0x18ab99){return{'count':_0x18ab99[_0xe0b0('0x13')],'rows':_[_0xe0b0('0x48')](_0x18ab99[_0xe0b0('0x25')],function(_0x34c642){return{'membername':_0x34c642[_0xe0b0('0x1b')],'UserId':_0x34c642['id'],'queue_name':_0x534340[_0xe0b0('0x1b')],'SmsQueueId':_0x534340['id'],'interface':util['format'](_0xe0b0('0x51'),_0xe0b0('0x52'),_0x34c642[_0xe0b0('0x1b')]),'penalty':0x0,'paused':_0x34c642[_0xe0b0('0x4e')],'createdAt':_0x34c642[_0xe0b0('0x50')],'updatedAt':_0x34c642[_0xe0b0('0x4f')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xe0b0('0x18')](respondWithFilteredResult(_0x575c7d,_0x3b1474))['catch'](handleError(_0x575c7d,null));};exports['getTeams']=function(_0x139014,_0x2a0415){var _0x157556={};var _0x47ecc1={};var _0x117d20;var _0x13fb4b;return db[_0xe0b0('0x1d')][_0xe0b0('0x53')]({'where':{'id':_0x139014[_0xe0b0('0x41')]['id']}})['then'](handleEntityNotFound(_0x2a0415,null))[_0xe0b0('0x18')](function(_0x242120){if(_0x242120){_0x117d20=_0x242120;_0x47ecc1[_0xe0b0('0x27')]=_['keys'](db[_0xe0b0('0x54')][_0xe0b0('0x29')]);_0x47ecc1['query']=_[_0xe0b0('0x28')](_0x139014['query']);_0x47ecc1['filters']=_[_0xe0b0('0x2b')](_0x47ecc1['model'],_0x47ecc1['query']);_0x157556[_0xe0b0('0x2c')]=_[_0xe0b0('0x2b')](_0x47ecc1[_0xe0b0('0x27')],qs[_0xe0b0('0x2d')](_0x139014['query'][_0xe0b0('0x2d')]));_0x157556[_0xe0b0('0x2c')]=_0x157556[_0xe0b0('0x2c')][_0xe0b0('0x2e')]?_0x157556[_0xe0b0('0x2c')]:_0x47ecc1[_0xe0b0('0x27')];_0x157556[_0xe0b0('0x43')]=qs[_0xe0b0('0x44')](_0x139014['query']['sort']);_0x157556[_0xe0b0('0x45')]=qs[_0xe0b0('0x2a')](_[_0xe0b0('0x55')](_0x139014['query'],_0x47ecc1['filters']));if(_0x139014[_0xe0b0('0x23')][_0xe0b0('0x47')]){_0x157556['where']=_['merge'](_0x157556[_0xe0b0('0x45')],{'$or':_[_0xe0b0('0x48')](_0x157556[_0xe0b0('0x2c')],function(_0x29175a){var _0x3b263f={};_0x3b263f[_0x29175a]={'$like':'%'+_0x139014[_0xe0b0('0x23')][_0xe0b0('0x47')]+'%'};return _0x3b263f;})});}_0x157556=_[_0xe0b0('0x30')]({},_0x157556,_0x139014['options']);return _0x117d20[_0xe0b0('0x56')](_0x157556);}})[_0xe0b0('0x18')](function(_0x1673bc){if(_0x1673bc){_0x13fb4b=_0x1673bc['length'];if(!_0x139014['query']['hasOwnProperty']('nolimit')){_0x157556['limit']=qs['limit'](_0x139014[_0xe0b0('0x23')]['limit']);_0x157556['offset']=qs[_0xe0b0('0x10')](_0x139014[_0xe0b0('0x23')][_0xe0b0('0x10')]);}return _0x117d20[_0xe0b0('0x56')](_0x157556);}})[_0xe0b0('0x18')](function(_0xd0629e){if(_0xd0629e){return _0xd0629e?{'count':_0x13fb4b,'rows':_0xd0629e}:null;}})[_0xe0b0('0x18')](respondWithResult(_0x2a0415,null))[_0xe0b0('0x3d')](handleError(_0x2a0415,null));};exports['addTeams']=function(_0x3097fb,_0x5da8fd){var _0x86e90=_0x3097fb[_0xe0b0('0x33')][_0xe0b0('0x57')];return db[_0xe0b0('0x54')][_0xe0b0('0x24')]({'where':{'id':_0x86e90},'attributes':['id'],'include':[{'model':db['User'],'as':_0xe0b0('0x58'),'attributes':['id','name',_0xe0b0('0x59'),_0xe0b0('0x5a'),_0xe0b0('0x5b')],'raw':!![]}]})[_0xe0b0('0x18')](function(_0x4a78f8){if(_0x4a78f8){var _0x311f79=_[_0xe0b0('0x5c')](_0x4a78f8,function(_0x49deef){var _0x4cf60a=_0x49deef[_0xe0b0('0x34')]({'plain':!![]});return _0x4cf60a[_0xe0b0('0x58')];});return db[_0xe0b0('0x1d')][_0xe0b0('0x32')]({'where':{'id':_0x3097fb[_0xe0b0('0x41')]['id']}})[_0xe0b0('0x18')](function(_0x34f4ff){return db[_0xe0b0('0x5d')][_0xe0b0('0x5e')](function(_0x24571b){return _0x34f4ff['addTeams'](_0x86e90,{'transaction':_0x24571b})['then'](function(){return BPromise[_0xe0b0('0x5f')](_0x311f79,function(_0x4880d5){return db['UserSmsQueue']['findOrCreate']({'where':{'UserId':_0x4880d5['id'],'SmsQueueId':_0x3097fb['params']['id']},'transaction':_0x24571b});});})[_0xe0b0('0x18')](function(){_0x311f79['forEach'](function(_0x654d2b){socket[_0xe0b0('0x60')](_0xe0b0('0x61'),{'UserId':_0x654d2b['id'],'SmsQueueId':_0x34f4ff['id']});});});});});}})[_0xe0b0('0x18')](respondWithStatusCode(_0x5da8fd,null))['catch'](handleError(_0x5da8fd,null));};exports[_0xe0b0('0x62')]=function(_0x948708,_0x5a0817){return db[_0xe0b0('0x54')][_0xe0b0('0x24')]({'where':{'id':_0x948708[_0xe0b0('0x23')][_0xe0b0('0x57')]},'attributes':['id'],'include':[{'model':db[_0xe0b0('0x4a')],'as':'Agents','attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x5a0817,null))['then'](function(_0x545694){var _0x5c258b=_[_0xe0b0('0x48')](_0x545694,'id');var _0x567e1a=[];var _0x3c09af=[];var _0x5f4aaf=squel[_0xe0b0('0x63')]();_0x5f4aaf[_0xe0b0('0x64')](_0xe0b0('0x65'))[_0xe0b0('0x66')](_0xe0b0('0x67'),'tq')[_0xe0b0('0x68')]('user_has_teams','ut','ut.TeamId\x20=\x20tq.TeamId')['where']('SmsQueueId\x20=\x20?',_0x948708[_0xe0b0('0x41')]['id']);for(var _0x261381=0x0;_0x261381<_0x545694[_0xe0b0('0x2e')];_0x261381+=0x1){let _0x4377f7=_0x545694[_0x261381];for(var _0x2c1149=0x0;_0x2c1149<_0x4377f7['Agents'][_0xe0b0('0x2e')];_0x2c1149+=0x1){let _0x39a07b=_0x4377f7[_0xe0b0('0x58')][_0x2c1149];var _0xc6090e=_0x5f4aaf[_0xe0b0('0x69')]();_0xc6090e[_0xe0b0('0x45')](_0xe0b0('0x6a'),_0x39a07b['id']);_0x3c09af[_0xe0b0('0x6b')](db[_0xe0b0('0x5d')]['query'](_0xc6090e['toString'](),{'type':db[_0xe0b0('0x5d')][_0xe0b0('0x6c')]['SELECT']})[_0xe0b0('0x18')](function(_0x4593f1){if(_0x4593f1[_0xe0b0('0x2e')]===0x1){return _0x39a07b['id'];}else{var _0x3fcffd=_[_0xe0b0('0x6d')](_[_0xe0b0('0x48')](_0x4593f1,_0xe0b0('0x6e')),function(_0xc8eba3){return _['includes'](_0x5c258b,_0xc8eba3);});if(_0x3fcffd){return _0x39a07b['id'];}}}));}}return BPromise['all'](_0x3c09af)['then'](function(_0xc19743){_0x567e1a=_(_0x567e1a)[_0xe0b0('0x6f')](_0xc19743)['compact']()[_0xe0b0('0x70')]();return db[_0xe0b0('0x1d')][_0xe0b0('0x32')]({'where':{'id':_0x948708[_0xe0b0('0x41')]['id']}})['then'](function(_0x56c4b9){return db['sequelize'][_0xe0b0('0x5e')](function(_0x266835){return _0x56c4b9['removeTeams'](_0x948708[_0xe0b0('0x23')][_0xe0b0('0x57')],{'transaction':_0x266835})['then'](function(){if(!_['isEmpty'](_0x567e1a)){return _0x56c4b9[_0xe0b0('0x71')](_0x567e1a,{'transaction':_0x266835});}})['then'](function(){_0x567e1a[_0xe0b0('0x72')](function(_0x5f06c0){socket[_0xe0b0('0x60')](_0xe0b0('0x73'),{'UserId':_0x5f06c0,'SmsQueueId':_0x56c4b9['id']});});});});});});})[_0xe0b0('0x18')](respondWithStatusCode(_0x5a0817,null))[_0xe0b0('0x3d')](handleError(_0x5a0817,null));};exports[_0xe0b0('0x74')]=function(_0x1ec7c2,_0x434dfa){return db[_0xe0b0('0x1d')][_0xe0b0('0x32')]({'where':{'id':_0x1ec7c2['params']['id']}})[_0xe0b0('0x18')](handleEntityNotFound(_0x434dfa,null))[_0xe0b0('0x18')](function(_0x2b40eb){if(_0x2b40eb){return _0x2b40eb['addAgents'](_0x1ec7c2[_0xe0b0('0x33')]['ids'],_[_0xe0b0('0x75')](_0x1ec7c2[_0xe0b0('0x33')],['ids','id'])||{})[_0xe0b0('0x76')](function(_0x4e4b45){for(var _0x528932=0x0;_0x528932<_0x1ec7c2[_0xe0b0('0x33')]['ids']['length'];_0x528932+=0x1){socket[_0xe0b0('0x60')](_0xe0b0('0x61'),{'UserId':Number(_0x1ec7c2[_0xe0b0('0x33')][_0xe0b0('0x57')][_0x528932]),'SmsQueueId':Number(_0x1ec7c2[_0xe0b0('0x41')]['id'])});}return _0x4e4b45;});}})[_0xe0b0('0x18')](respondWithResult(_0x434dfa,null))['catch'](handleError(_0x434dfa,null));};exports[_0xe0b0('0x71')]=function(_0x4609d5,_0x421b3b){return db['SmsQueue'][_0xe0b0('0x32')]({'where':{'id':_0x4609d5[_0xe0b0('0x41')]['id']}})['then'](handleEntityNotFound(_0x421b3b,null))['then'](function(_0x33f89a){if(_0x33f89a){return _0x33f89a['removeAgents'](_0x4609d5[_0xe0b0('0x23')][_0xe0b0('0x57')])[_0xe0b0('0x18')](function(){if(_[_0xe0b0('0x77')](_0x4609d5[_0xe0b0('0x23')][_0xe0b0('0x57')])){for(var _0x3d70d7=0x0;_0x3d70d7<_0x4609d5['query'][_0xe0b0('0x57')][_0xe0b0('0x2e')];_0x3d70d7+=0x1){socket[_0xe0b0('0x60')](_0xe0b0('0x73'),{'UserId':Number(_0x4609d5[_0xe0b0('0x23')]['ids'][_0x3d70d7]),'SmsQueueId':Number(_0x4609d5['params']['id'])});}}else{socket[_0xe0b0('0x60')](_0xe0b0('0x73'),{'UserId':Number(_0x4609d5[_0xe0b0('0x23')][_0xe0b0('0x57')]),'SmsQueueId':Number(_0x4609d5[_0xe0b0('0x41')]['id'])});}});}})[_0xe0b0('0x18')](respondWithStatusCode(_0x421b3b,null))[_0xe0b0('0x3d')](handleError(_0x421b3b,null));};exports[_0xe0b0('0x78')]=function(_0x932e,_0x1b3f4d){var _0x4fe048={};var _0xac45e6={};var _0x401c4b;var _0x3e18a3;return db[_0xe0b0('0x1d')]['findOne']({'where':{'id':_0x932e[_0xe0b0('0x41')]['id']}})[_0xe0b0('0x18')](handleEntityNotFound(_0x1b3f4d,null))[_0xe0b0('0x18')](function(_0x116c16){if(_0x116c16){_0x401c4b=_0x116c16;_0xac45e6[_0xe0b0('0x27')]=_['keys'](db[_0xe0b0('0x4a')]['rawAttributes']);_0xac45e6[_0xe0b0('0x23')]=_[_0xe0b0('0x28')](_0x932e[_0xe0b0('0x23')]);_0xac45e6[_0xe0b0('0x2a')]=_[_0xe0b0('0x2b')](_0xac45e6['model'],_0xac45e6['query']);_0x4fe048[_0xe0b0('0x2c')]=_['intersection'](_0xac45e6[_0xe0b0('0x27')],qs['fields'](_0x932e[_0xe0b0('0x23')][_0xe0b0('0x2d')]));_0x4fe048[_0xe0b0('0x2c')]=_0x4fe048[_0xe0b0('0x2c')][_0xe0b0('0x2e')]?_0x4fe048[_0xe0b0('0x2c')]:_0xac45e6[_0xe0b0('0x27')];_0x4fe048['order']=qs['sort'](_0x932e[_0xe0b0('0x23')][_0xe0b0('0x44')]);_0x4fe048[_0xe0b0('0x45')]=qs[_0xe0b0('0x2a')](_[_0xe0b0('0x55')](_0x932e[_0xe0b0('0x23')],_0xac45e6[_0xe0b0('0x2a')]));if(_0x932e[_0xe0b0('0x23')][_0xe0b0('0x47')]){_0x4fe048[_0xe0b0('0x45')]=_['merge'](_0x4fe048['where'],{'$or':_[_0xe0b0('0x48')](_0x4fe048[_0xe0b0('0x2c')],function(_0x187465){var _0x3f9e6b={};_0x3f9e6b[_0x187465]={'$like':'%'+_0x932e[_0xe0b0('0x23')][_0xe0b0('0x47')]+'%'};return _0x3f9e6b;})});}_0x4fe048=_[_0xe0b0('0x30')]({},_0x4fe048,_0x932e['options']);return _0x401c4b['getAgents'](_0x4fe048);}})[_0xe0b0('0x18')](function(_0x1ea4d5){if(_0x1ea4d5){_0x3e18a3=_0x1ea4d5[_0xe0b0('0x2e')];if(!_0x932e[_0xe0b0('0x23')][_0xe0b0('0x79')](_0xe0b0('0x42'))){_0x4fe048[_0xe0b0('0x12')]=qs[_0xe0b0('0x12')](_0x932e[_0xe0b0('0x23')][_0xe0b0('0x12')]);_0x4fe048['offset']=qs[_0xe0b0('0x10')](_0x932e[_0xe0b0('0x23')]['offset']);}return _0x401c4b[_0xe0b0('0x78')](_0x4fe048);}})[_0xe0b0('0x18')](function(_0x3615f9){if(_0x3615f9){return _0x3615f9?{'count':_0x3e18a3,'rows':_0x3615f9}:null;}})[_0xe0b0('0x18')](respondWithResult(_0x1b3f4d,null))[_0xe0b0('0x3d')](handleError(_0x1b3f4d,null));}; \ No newline at end of file +var _0x7a54=['transaction','addTeams','each','findOrCreate','userSmsQueue:save','removeTeams','Team','select','field','from','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','SmsQueueId\x20=\x20?','QueryTypes','SELECT','every','includes','all','compact','isEmpty','forEach','userSmsQueue:remove','addAgents','omit','emit','removeAgents','isArray','getAgents','bluebird','util','lodash','ioredis','../../components/parsers/qs','api','../../config/environment','../../mysqldb','redis','defaults','localhost','./smsQueue.socket','status','end','json','offset','undefined','count','set','Content-Range','update','destroy','then','get','SmsQueues','UserProfileResource','error','name','send','index','map','rawAttributes','fieldName','type','key','getOptions','where','SmsQueue','include','rows','catch','show','params','model','query','intersection','fields','attributes','includeAll','merge','options','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','getMembers','findOne','UserSmsQueue','length','hasOwnProperty','limit','order','sort','filters','pick','filter','User','UserId','createdAt','format','%s/%s','smsPause','getTeams','keys','nolimit','ids','findAll','Agents','online','voicePause','interface','flatMap','sequelize'];(function(_0x4474ea,_0x46a29d){var _0x5aae20=function(_0x29cec7){while(--_0x29cec7){_0x4474ea['push'](_0x4474ea['shift']());}};_0x5aae20(++_0x46a29d);}(_0x7a54,0x106));var _0x47a5=function(_0x625e14,_0x563431){_0x625e14=_0x625e14-0x0;var _0x105943=_0x7a54[_0x625e14];return _0x105943;};'use strict';var BPromise=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var _=require(_0x47a5('0x2'));var squel=require('squel');var Redis=require(_0x47a5('0x3'));var qs=require(_0x47a5('0x4'));var logger=require('../../config/logger')(_0x47a5('0x5'));var config=require(_0x47a5('0x6'));var db=require(_0x47a5('0x7'))['db'];config[_0x47a5('0x8')]=_[_0x47a5('0x9')](config['redis'],{'host':_0x47a5('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x47a5('0x8')]));require(_0x47a5('0xb'))['register'](socket);function respondWithStatusCode(_0x194fb0,_0x5077f3){_0x5077f3=_0x5077f3||0xcc;return function(_0x5d90b3){if(_0x5d90b3){return _0x194fb0['sendStatus'](_0x5077f3);}return _0x194fb0[_0x47a5('0xc')](_0x5077f3)[_0x47a5('0xd')]();};}function respondWithResult(_0x5e31dd,_0x2eb0dd){_0x2eb0dd=_0x2eb0dd||0xc8;return function(_0x49e844){if(_0x49e844){return _0x5e31dd['status'](_0x2eb0dd)[_0x47a5('0xe')](_0x49e844);}};}function respondWithFilteredResult(_0x69e4d4,_0x2f399b){return function(_0x250fad){if(_0x250fad){var _0xd612dd=typeof _0x2f399b[_0x47a5('0xf')]===_0x47a5('0x10')&&typeof _0x2f399b['limit']===_0x47a5('0x10');var _0x221b54=_0x250fad[_0x47a5('0x11')];var _0x711793=_0xd612dd?0x0:_0x2f399b[_0x47a5('0xf')];var _0x620ee9=_0xd612dd?_0x250fad[_0x47a5('0x11')]:_0x2f399b[_0x47a5('0xf')]+_0x2f399b['limit'];var _0x362359;if(_0x620ee9>=_0x221b54){_0x620ee9=_0x221b54;_0x362359=0xc8;}else{_0x362359=0xce;}_0x69e4d4[_0x47a5('0xc')](_0x362359);return _0x69e4d4[_0x47a5('0x12')](_0x47a5('0x13'),_0x711793+'-'+_0x620ee9+'/'+_0x221b54)[_0x47a5('0xe')](_0x250fad);}return null;};}function saveUpdates(_0x574af6){return function(_0x549de3){if(_0x549de3){return _0x549de3[_0x47a5('0x14')](_0x574af6)['then'](function(_0x5247fd){return _0x5247fd;});}return null;};}function removeEntity(_0x423a81){return function(_0xaf70a6){if(_0xaf70a6){return _0xaf70a6[_0x47a5('0x15')]()[_0x47a5('0x16')](function(){var _0x477b1d=_0xaf70a6[_0x47a5('0x17')]({'plain':!![]});var _0x2763d6=_0x47a5('0x18');return db[_0x47a5('0x19')]['destroy']({'where':{'type':_0x2763d6,'resourceId':_0x477b1d['id']}})[_0x47a5('0x16')](function(){return _0xaf70a6;});})[_0x47a5('0x16')](function(){_0x423a81['status'](0xcc)[_0x47a5('0xd')]();});}};}function handleEntityNotFound(_0x1f03f7){return function(_0x36874d){if(!_0x36874d){_0x1f03f7['sendStatus'](0x194);}return _0x36874d;};}function handleError(_0xb8ae6c,_0x2f142b){_0x2f142b=_0x2f142b||0x1f4;return function(_0x23db32){logger[_0x47a5('0x1a')](_0x23db32['stack']);if(_0x23db32[_0x47a5('0x1b')]){delete _0x23db32[_0x47a5('0x1b')];}_0xb8ae6c['status'](_0x2f142b)[_0x47a5('0x1c')](_0x23db32);};}exports[_0x47a5('0x1d')]=function(_0x4437f1,_0x129ce5){var _0x3abd6a={};var _0x50bf17={'count':0x0,'rows':[]};var _0x53078a=_[_0x47a5('0x1e')](db['SmsQueue'][_0x47a5('0x1f')],function(_0x5b6c4e){return{'name':_0x5b6c4e[_0x47a5('0x20')],'type':_0x5b6c4e[_0x47a5('0x21')][_0x47a5('0x22')]};});_0x3abd6a=qs[_0x47a5('0x23')](_0x53078a,_0x4437f1);var _0x21f296={'where':_0x3abd6a[_0x47a5('0x24')]};return db[_0x47a5('0x25')][_0x47a5('0x11')](_0x21f296)[_0x47a5('0x16')](function(_0x361bfa){_0x50bf17[_0x47a5('0x11')]=_0x361bfa;_0x3abd6a[_0x47a5('0x26')]=qs[_0x47a5('0x26')](_0x4437f1['query']);return db[_0x47a5('0x25')]['findAll'](_0x3abd6a);})[_0x47a5('0x16')](function(_0x9ac908){_0x50bf17[_0x47a5('0x27')]=_0x9ac908;return _0x50bf17;})['then'](respondWithFilteredResult(_0x129ce5,_0x3abd6a))[_0x47a5('0x28')](handleError(_0x129ce5,null));};exports[_0x47a5('0x29')]=function(_0x39b50b,_0x1f1c68){var _0x51cc81={'raw':!![],'where':{'id':_0x39b50b[_0x47a5('0x2a')]['id']}},_0x50d875={};_0x50d875[_0x47a5('0x2b')]=_['keys'](db['SmsQueue'][_0x47a5('0x1f')]);_0x50d875[_0x47a5('0x2c')]=_['keys'](_0x39b50b[_0x47a5('0x2c')]);_0x50d875['filters']=_[_0x47a5('0x2d')](_0x50d875[_0x47a5('0x2b')],_0x50d875['query']);_0x51cc81['attributes']=_[_0x47a5('0x2d')](_0x50d875['model'],qs[_0x47a5('0x2e')](_0x39b50b[_0x47a5('0x2c')][_0x47a5('0x2e')]));_0x51cc81['attributes']=_0x51cc81[_0x47a5('0x2f')]['length']?_0x51cc81['attributes']:_0x50d875[_0x47a5('0x2b')];if(_0x39b50b['query'][_0x47a5('0x30')]){_0x51cc81['include']=[{'all':!![]}];}_0x51cc81=_[_0x47a5('0x31')]({},_0x51cc81,_0x39b50b[_0x47a5('0x32')]);return db[_0x47a5('0x25')][_0x47a5('0x33')](_0x51cc81)[_0x47a5('0x16')](handleEntityNotFound(_0x1f1c68,null))[_0x47a5('0x16')](respondWithResult(_0x1f1c68,null))[_0x47a5('0x28')](handleError(_0x1f1c68,null));};exports[_0x47a5('0x34')]=function(_0x1a0d23,_0x4caed5){return db[_0x47a5('0x25')][_0x47a5('0x34')](_0x1a0d23['body'],{})[_0x47a5('0x16')](function(_0x2bf53d){var _0x1d4348=_0x1a0d23['user'][_0x47a5('0x17')]({'plain':!![]});if(!_0x1d4348)throw new Error(_0x47a5('0x35'));if(_0x1d4348['role']===_0x47a5('0x36')){var _0x19218a=_0x2bf53d['get']({'plain':!![]});var _0x55c5eb='SmsQueues';return db[_0x47a5('0x37')]['find']({'where':{'name':_0x55c5eb,'userProfileId':_0x1d4348[_0x47a5('0x38')]},'raw':!![]})[_0x47a5('0x16')](function(_0x301a85){if(_0x301a85&&_0x301a85[_0x47a5('0x39')]===0x0){return db[_0x47a5('0x19')][_0x47a5('0x34')]({'name':_0x19218a[_0x47a5('0x1b')],'resourceId':_0x19218a['id'],'type':_0x301a85[_0x47a5('0x1b')],'sectionId':_0x301a85['id']},{})[_0x47a5('0x16')](function(){return _0x2bf53d;});}else{return _0x2bf53d;}})[_0x47a5('0x28')](function(_0x280500){logger[_0x47a5('0x1a')](_0x47a5('0x3a'),_0x280500);throw _0x280500;});}return _0x2bf53d;})['then'](respondWithResult(_0x4caed5,0xc9))[_0x47a5('0x28')](handleError(_0x4caed5,null));};exports[_0x47a5('0x14')]=function(_0x331474,_0x23bd8d){if(_0x331474['body']['id']){delete _0x331474[_0x47a5('0x3b')]['id'];}return db['SmsQueue']['find']({'where':{'id':_0x331474['params']['id']}})['then'](handleEntityNotFound(_0x23bd8d,null))[_0x47a5('0x16')](saveUpdates(_0x331474['body'],null))[_0x47a5('0x16')](respondWithResult(_0x23bd8d,null))[_0x47a5('0x28')](handleError(_0x23bd8d,null));};exports[_0x47a5('0x15')]=function(_0x494526,_0x3805fd){return db[_0x47a5('0x25')]['find']({'where':{'id':_0x494526['params']['id']}})[_0x47a5('0x16')](handleEntityNotFound(_0x3805fd,null))['then'](removeEntity(_0x3805fd,null))[_0x47a5('0x28')](handleError(_0x3805fd,null));};exports[_0x47a5('0x3c')]=function(_0x188614,_0xd75ca3){return db[_0x47a5('0x25')][_0x47a5('0x3c')]()[_0x47a5('0x16')](respondWithResult(_0xd75ca3,null))[_0x47a5('0x28')](handleError(_0xd75ca3,null));};exports[_0x47a5('0x3d')]=function(_0x162fa0,_0x24ecb1){var _0x3c3ebf={'raw':!![],'where':{}},_0xe28d76={},_0x3574d4;return db[_0x47a5('0x25')][_0x47a5('0x3e')]({'where':{'id':_0x162fa0['params']['id']}})[_0x47a5('0x16')](handleEntityNotFound(_0x24ecb1,null))[_0x47a5('0x16')](function(_0x49eab1){if(_0x49eab1){_0x3574d4=_0x49eab1['get']({'plain':!![]});_0xe28d76[_0x47a5('0x2b')]=_['keys'](db[_0x47a5('0x3f')][_0x47a5('0x1f')]);_0xe28d76['query']=_['keys'](_0x162fa0[_0x47a5('0x2c')]);_0xe28d76['filters']=_[_0x47a5('0x2d')](_0xe28d76[_0x47a5('0x2b')],_0xe28d76[_0x47a5('0x2c')]);_0x3c3ebf[_0x47a5('0x2f')]=_[_0x47a5('0x2d')](_0xe28d76[_0x47a5('0x2b')],qs[_0x47a5('0x2e')](_0x162fa0['query']['fields']));_0x3c3ebf[_0x47a5('0x2f')]=_0x3c3ebf[_0x47a5('0x2f')][_0x47a5('0x40')]?_0x3c3ebf[_0x47a5('0x2f')]:_0xe28d76[_0x47a5('0x2b')];if(!_0x162fa0[_0x47a5('0x2c')][_0x47a5('0x41')]('nolimit')){_0x3c3ebf[_0x47a5('0x42')]=qs[_0x47a5('0x42')](_0x162fa0[_0x47a5('0x2c')]['limit']);_0x3c3ebf[_0x47a5('0xf')]=qs['offset'](_0x162fa0[_0x47a5('0x2c')][_0x47a5('0xf')]);}_0x3c3ebf[_0x47a5('0x43')]=qs[_0x47a5('0x44')](_0x162fa0['query'][_0x47a5('0x44')]);_0x3c3ebf[_0x47a5('0x24')]=qs[_0x47a5('0x45')](_[_0x47a5('0x46')](_0x162fa0[_0x47a5('0x2c')],_0xe28d76[_0x47a5('0x45')]));_0x3c3ebf[_0x47a5('0x24')]['SmsQueueId']=_0x49eab1['id'];if(_0x162fa0[_0x47a5('0x2c')][_0x47a5('0x47')]){_0x3c3ebf[_0x47a5('0x24')]=_[_0x47a5('0x31')](_0x3c3ebf[_0x47a5('0x24')],{'$or':_[_0x47a5('0x1e')](_0x3c3ebf['attributes'],function(_0x1ad6a9){var _0x245a15={};_0x245a15[_0x1ad6a9]={'$like':'%'+_0x162fa0[_0x47a5('0x2c')]['filter']+'%'};return _0x245a15;})});}_0x3c3ebf=_[_0x47a5('0x31')]({},_0x3c3ebf,_0x162fa0[_0x47a5('0x32')]);return db[_0x47a5('0x3f')]['findAll'](_0x3c3ebf);}})['then'](function(_0x274e38){if(_0x274e38){return db[_0x47a5('0x48')]['findAndCountAll']({'where':{'id':_['map'](_0x274e38,_0x47a5('0x49')),'role':'agent'},'attributes':['id',_0x47a5('0x1b'),'smsPause','updatedAt',_0x47a5('0x4a')]});}})[_0x47a5('0x16')](function(_0x53eedf){if(_0x53eedf){return{'count':_0x53eedf[_0x47a5('0x11')],'rows':_[_0x47a5('0x1e')](_0x53eedf['rows'],function(_0x5b6127){return{'membername':_0x5b6127[_0x47a5('0x1b')],'UserId':_0x5b6127['id'],'queue_name':_0x3574d4[_0x47a5('0x1b')],'SmsQueueId':_0x3574d4['id'],'interface':util[_0x47a5('0x4b')](_0x47a5('0x4c'),'SIP',_0x5b6127[_0x47a5('0x1b')]),'penalty':0x0,'paused':_0x5b6127[_0x47a5('0x4d')],'createdAt':_0x5b6127[_0x47a5('0x4a')],'updatedAt':_0x5b6127['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0x47a5('0x16')](respondWithFilteredResult(_0x24ecb1,_0x3c3ebf))['catch'](handleError(_0x24ecb1,null));};exports[_0x47a5('0x4e')]=function(_0x470da6,_0x943a15){var _0x1c485b={};var _0x3603b7={};var _0x4966af;var _0x144af9;return db['SmsQueue']['findOne']({'where':{'id':_0x470da6['params']['id']}})['then'](handleEntityNotFound(_0x943a15,null))[_0x47a5('0x16')](function(_0x6cd4ea){if(_0x6cd4ea){_0x4966af=_0x6cd4ea;_0x3603b7[_0x47a5('0x2b')]=_['keys'](db['Team'][_0x47a5('0x1f')]);_0x3603b7[_0x47a5('0x2c')]=_[_0x47a5('0x4f')](_0x470da6[_0x47a5('0x2c')]);_0x3603b7[_0x47a5('0x45')]=_['intersection'](_0x3603b7[_0x47a5('0x2b')],_0x3603b7['query']);_0x1c485b[_0x47a5('0x2f')]=_[_0x47a5('0x2d')](_0x3603b7['model'],qs[_0x47a5('0x2e')](_0x470da6[_0x47a5('0x2c')][_0x47a5('0x2e')]));_0x1c485b[_0x47a5('0x2f')]=_0x1c485b[_0x47a5('0x2f')][_0x47a5('0x40')]?_0x1c485b[_0x47a5('0x2f')]:_0x3603b7[_0x47a5('0x2b')];_0x1c485b['order']=qs[_0x47a5('0x44')](_0x470da6[_0x47a5('0x2c')][_0x47a5('0x44')]);_0x1c485b[_0x47a5('0x24')]=qs[_0x47a5('0x45')](_['pick'](_0x470da6[_0x47a5('0x2c')],_0x3603b7[_0x47a5('0x45')]));if(_0x470da6[_0x47a5('0x2c')][_0x47a5('0x47')]){_0x1c485b[_0x47a5('0x24')]=_[_0x47a5('0x31')](_0x1c485b[_0x47a5('0x24')],{'$or':_[_0x47a5('0x1e')](_0x1c485b[_0x47a5('0x2f')],function(_0x44cb90){var _0x1d56f3={};_0x1d56f3[_0x44cb90]={'$like':'%'+_0x470da6[_0x47a5('0x2c')][_0x47a5('0x47')]+'%'};return _0x1d56f3;})});}_0x1c485b=_[_0x47a5('0x31')]({},_0x1c485b,_0x470da6[_0x47a5('0x32')]);return _0x4966af['getTeams'](_0x1c485b);}})[_0x47a5('0x16')](function(_0x284fb8){if(_0x284fb8){_0x144af9=_0x284fb8[_0x47a5('0x40')];if(!_0x470da6['query'][_0x47a5('0x41')](_0x47a5('0x50'))){_0x1c485b[_0x47a5('0x42')]=qs[_0x47a5('0x42')](_0x470da6['query'][_0x47a5('0x42')]);_0x1c485b['offset']=qs[_0x47a5('0xf')](_0x470da6['query'][_0x47a5('0xf')]);}return _0x4966af['getTeams'](_0x1c485b);}})[_0x47a5('0x16')](function(_0x2f27c3){if(_0x2f27c3){return _0x2f27c3?{'count':_0x144af9,'rows':_0x2f27c3}:null;}})[_0x47a5('0x16')](respondWithResult(_0x943a15,null))['catch'](handleError(_0x943a15,null));};exports['addTeams']=function(_0x4b8084,_0x4164a3){var _0x2b1303=_0x4b8084[_0x47a5('0x3b')][_0x47a5('0x51')];return db['Team'][_0x47a5('0x52')]({'where':{'id':_0x2b1303},'attributes':['id'],'include':[{'model':db[_0x47a5('0x48')],'as':_0x47a5('0x53'),'attributes':['id',_0x47a5('0x1b'),_0x47a5('0x54'),_0x47a5('0x55'),_0x47a5('0x56')],'raw':!![]}]})[_0x47a5('0x16')](function(_0x4618a0){if(_0x4618a0){var _0xc69a68=_[_0x47a5('0x57')](_0x4618a0,function(_0x463e5e){var _0x49d3dc=_0x463e5e[_0x47a5('0x17')]({'plain':!![]});return _0x49d3dc['Agents'];});return db[_0x47a5('0x25')][_0x47a5('0x33')]({'where':{'id':_0x4b8084[_0x47a5('0x2a')]['id']}})[_0x47a5('0x16')](function(_0x40e584){return db[_0x47a5('0x58')][_0x47a5('0x59')](function(_0x448981){return _0x40e584[_0x47a5('0x5a')](_0x2b1303,{'transaction':_0x448981})[_0x47a5('0x16')](function(){return BPromise[_0x47a5('0x5b')](_0xc69a68,function(_0x1f07ac){return db[_0x47a5('0x3f')][_0x47a5('0x5c')]({'where':{'UserId':_0x1f07ac['id'],'SmsQueueId':_0x4b8084[_0x47a5('0x2a')]['id']},'transaction':_0x448981});});})['then'](function(){_0xc69a68['forEach'](function(_0x5ccc89){socket['emit'](_0x47a5('0x5d'),{'UserId':_0x5ccc89['id'],'SmsQueueId':_0x40e584['id']});});});});});}})[_0x47a5('0x16')](respondWithStatusCode(_0x4164a3,null))['catch'](handleError(_0x4164a3,null));};exports[_0x47a5('0x5e')]=function(_0x44dda2,_0x1baa5a){return db[_0x47a5('0x5f')][_0x47a5('0x52')]({'where':{'id':_0x44dda2[_0x47a5('0x2c')][_0x47a5('0x51')]},'attributes':['id'],'include':[{'model':db[_0x47a5('0x48')],'as':_0x47a5('0x53'),'attributes':['id'],'raw':!![]}]})[_0x47a5('0x16')](handleEntityNotFound(_0x1baa5a,null))[_0x47a5('0x16')](function(_0x5e5f16){var _0x18fa31=_[_0x47a5('0x1e')](_0x5e5f16,'id');var _0x420671=[];var _0x4f35ff=[];var _0x340846=squel[_0x47a5('0x60')]();_0x340846[_0x47a5('0x61')]('tq.TeamId')[_0x47a5('0x62')]('team_has_sms_queues','tq')['join'](_0x47a5('0x63'),'ut',_0x47a5('0x64'))[_0x47a5('0x24')](_0x47a5('0x65'),_0x44dda2[_0x47a5('0x2a')]['id']);for(var _0xea50f3=0x0;_0xea50f3<_0x5e5f16['length'];_0xea50f3+=0x1){let _0x592322=_0x5e5f16[_0xea50f3];for(var _0x3e0dbd=0x0;_0x3e0dbd<_0x592322['Agents'][_0x47a5('0x40')];_0x3e0dbd+=0x1){let _0x3fffd1=_0x592322[_0x47a5('0x53')][_0x3e0dbd];var _0xb16bdd=_0x340846['clone']();_0xb16bdd[_0x47a5('0x24')]('ut.UserId\x20=\x20?',_0x3fffd1['id']);_0x4f35ff['push'](db[_0x47a5('0x58')][_0x47a5('0x2c')](_0xb16bdd['toString'](),{'type':db[_0x47a5('0x58')][_0x47a5('0x66')][_0x47a5('0x67')]})['then'](function(_0x280372){if(_0x280372['length']===0x1){return _0x3fffd1['id'];}else{var _0x2307da=_[_0x47a5('0x68')](_[_0x47a5('0x1e')](_0x280372,'TeamId'),function(_0x2e0af1){return _[_0x47a5('0x69')](_0x18fa31,_0x2e0af1);});if(_0x2307da){return _0x3fffd1['id'];}}}));}}return BPromise[_0x47a5('0x6a')](_0x4f35ff)['then'](function(_0x3525e7){_0x420671=_(_0x420671)['union'](_0x3525e7)[_0x47a5('0x6b')]()['value']();return db[_0x47a5('0x25')][_0x47a5('0x33')]({'where':{'id':_0x44dda2[_0x47a5('0x2a')]['id']}})[_0x47a5('0x16')](function(_0x51738b){return db[_0x47a5('0x58')][_0x47a5('0x59')](function(_0x23c393){return _0x51738b[_0x47a5('0x5e')](_0x44dda2[_0x47a5('0x2c')]['ids'],{'transaction':_0x23c393})['then'](function(){if(!_[_0x47a5('0x6c')](_0x420671)){return _0x51738b['removeAgents'](_0x420671,{'transaction':_0x23c393});}})[_0x47a5('0x16')](function(){_0x420671[_0x47a5('0x6d')](function(_0x216402){socket['emit'](_0x47a5('0x6e'),{'UserId':_0x216402,'SmsQueueId':_0x51738b['id']});});});});});});})[_0x47a5('0x16')](respondWithStatusCode(_0x1baa5a,null))['catch'](handleError(_0x1baa5a,null));};exports[_0x47a5('0x6f')]=function(_0x8a9dea,_0x19acfa){return db[_0x47a5('0x25')]['find']({'where':{'id':_0x8a9dea['params']['id']}})[_0x47a5('0x16')](handleEntityNotFound(_0x19acfa,null))[_0x47a5('0x16')](function(_0x48e7f3){if(_0x48e7f3){return _0x48e7f3[_0x47a5('0x6f')](_0x8a9dea[_0x47a5('0x3b')]['ids'],_[_0x47a5('0x70')](_0x8a9dea[_0x47a5('0x3b')],[_0x47a5('0x51'),'id'])||{})['spread'](function(_0x3f2ad9){for(var _0x59b4a5=0x0;_0x59b4a5<_0x8a9dea[_0x47a5('0x3b')]['ids'][_0x47a5('0x40')];_0x59b4a5+=0x1){socket[_0x47a5('0x71')]('userSmsQueue:save',{'UserId':Number(_0x8a9dea[_0x47a5('0x3b')]['ids'][_0x59b4a5]),'SmsQueueId':Number(_0x8a9dea[_0x47a5('0x2a')]['id'])});}return _0x3f2ad9;});}})[_0x47a5('0x16')](respondWithResult(_0x19acfa,null))[_0x47a5('0x28')](handleError(_0x19acfa,null));};exports[_0x47a5('0x72')]=function(_0x49b76a,_0x3eb5c1){return db['SmsQueue']['find']({'where':{'id':_0x49b76a[_0x47a5('0x2a')]['id']}})[_0x47a5('0x16')](handleEntityNotFound(_0x3eb5c1,null))[_0x47a5('0x16')](function(_0x96fb22){if(_0x96fb22){return _0x96fb22[_0x47a5('0x72')](_0x49b76a['query'][_0x47a5('0x51')])[_0x47a5('0x16')](function(){if(_[_0x47a5('0x73')](_0x49b76a[_0x47a5('0x2c')]['ids'])){for(var _0x240db9=0x0;_0x240db9<_0x49b76a['query'][_0x47a5('0x51')][_0x47a5('0x40')];_0x240db9+=0x1){socket[_0x47a5('0x71')](_0x47a5('0x6e'),{'UserId':Number(_0x49b76a[_0x47a5('0x2c')][_0x47a5('0x51')][_0x240db9]),'SmsQueueId':Number(_0x49b76a[_0x47a5('0x2a')]['id'])});}}else{socket[_0x47a5('0x71')](_0x47a5('0x6e'),{'UserId':Number(_0x49b76a['query'][_0x47a5('0x51')]),'SmsQueueId':Number(_0x49b76a[_0x47a5('0x2a')]['id'])});}});}})['then'](respondWithStatusCode(_0x3eb5c1,null))[_0x47a5('0x28')](handleError(_0x3eb5c1,null));};exports[_0x47a5('0x74')]=function(_0x6d6a5,_0x5b85cd){var _0x4bf1f5={};var _0x126bb1={};var _0x3d7371;var _0x47fbb6;return db['SmsQueue'][_0x47a5('0x3e')]({'where':{'id':_0x6d6a5[_0x47a5('0x2a')]['id']}})['then'](handleEntityNotFound(_0x5b85cd,null))[_0x47a5('0x16')](function(_0x269ff6){if(_0x269ff6){_0x3d7371=_0x269ff6;_0x126bb1['model']=_[_0x47a5('0x4f')](db[_0x47a5('0x48')][_0x47a5('0x1f')]);_0x126bb1[_0x47a5('0x2c')]=_[_0x47a5('0x4f')](_0x6d6a5[_0x47a5('0x2c')]);_0x126bb1['filters']=_['intersection'](_0x126bb1['model'],_0x126bb1[_0x47a5('0x2c')]);_0x4bf1f5[_0x47a5('0x2f')]=_['intersection'](_0x126bb1[_0x47a5('0x2b')],qs[_0x47a5('0x2e')](_0x6d6a5[_0x47a5('0x2c')][_0x47a5('0x2e')]));_0x4bf1f5[_0x47a5('0x2f')]=_0x4bf1f5['attributes'][_0x47a5('0x40')]?_0x4bf1f5['attributes']:_0x126bb1['model'];_0x4bf1f5['order']=qs[_0x47a5('0x44')](_0x6d6a5['query'][_0x47a5('0x44')]);_0x4bf1f5[_0x47a5('0x24')]=qs[_0x47a5('0x45')](_['pick'](_0x6d6a5[_0x47a5('0x2c')],_0x126bb1[_0x47a5('0x45')]));if(_0x6d6a5[_0x47a5('0x2c')][_0x47a5('0x47')]){_0x4bf1f5[_0x47a5('0x24')]=_['merge'](_0x4bf1f5[_0x47a5('0x24')],{'$or':_[_0x47a5('0x1e')](_0x4bf1f5['attributes'],function(_0x42ba59){var _0x419870={};_0x419870[_0x42ba59]={'$like':'%'+_0x6d6a5[_0x47a5('0x2c')][_0x47a5('0x47')]+'%'};return _0x419870;})});}_0x4bf1f5=_[_0x47a5('0x31')]({},_0x4bf1f5,_0x6d6a5[_0x47a5('0x32')]);return _0x3d7371['getAgents'](_0x4bf1f5);}})[_0x47a5('0x16')](function(_0x2e418d){if(_0x2e418d){_0x47fbb6=_0x2e418d['length'];if(!_0x6d6a5[_0x47a5('0x2c')][_0x47a5('0x41')](_0x47a5('0x50'))){_0x4bf1f5[_0x47a5('0x42')]=qs['limit'](_0x6d6a5['query']['limit']);_0x4bf1f5['offset']=qs[_0x47a5('0xf')](_0x6d6a5[_0x47a5('0x2c')][_0x47a5('0xf')]);}return _0x3d7371[_0x47a5('0x74')](_0x4bf1f5);}})[_0x47a5('0x16')](function(_0x6bc37b){if(_0x6bc37b){return _0x6bc37b?{'count':_0x47fbb6,'rows':_0x6bc37b}:null;}})[_0x47a5('0x16')](respondWithResult(_0x5b85cd,null))[_0x47a5('0x28')](handleError(_0x5b85cd,null));}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.events.js b/server/api/smsQueue/smsQueue.events.js index e05465e..c0249ed 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 _0x082b=['events','../../mysqldb','SmsQueue','setMaxListeners','update','remove','emit','hook'];(function(_0xd197e2,_0x31e432){var _0x554589=function(_0x2c9884){while(--_0x2c9884){_0xd197e2['push'](_0xd197e2['shift']());}};_0x554589(++_0x31e432);}(_0x082b,0x78));var _0xb082=function(_0x48686d,_0x3e1a3f){_0x48686d=_0x48686d-0x0;var _0x1e696e=_0x082b[_0x48686d];return _0x1e696e;};'use strict';var EventEmitter=require(_0xb082('0x0'));var SmsQueue=require(_0xb082('0x1'))['db'][_0xb082('0x2')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0xb082('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xb082('0x4'),'afterDestroy':_0xb082('0x5')};function emitEvent(_0x16b8c6){return function(_0x2a59a3,_0x266e01,_0x12ddf9){SmsQueueEvents[_0xb082('0x6')](_0x16b8c6+':'+_0x2a59a3['id'],_0x2a59a3);SmsQueueEvents[_0xb082('0x6')](_0x16b8c6,_0x2a59a3);_0x12ddf9(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsQueue[_0xb082('0x7')](e,emitEvent(event));}}module['exports']=SmsQueueEvents; \ No newline at end of file +var _0xb16e=['save','update','emit','hasOwnProperty','hook','exports','../../mysqldb','SmsQueue'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0xb16e,0x14e));var _0xeb16=function(_0x5a6644,_0x45d612){_0x5a6644=_0x5a6644-0x0;var _0x3a2a5d=_0xb16e[_0x5a6644];return _0x3a2a5d;};'use strict';var EventEmitter=require('events');var SmsQueue=require(_0xeb16('0x0'))['db'][_0xeb16('0x1')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xeb16('0x2'),'afterUpdate':_0xeb16('0x3'),'afterDestroy':'remove'};function emitEvent(_0x4bd57c){return function(_0x106d8f,_0x3a0f9a,_0x431b54){SmsQueueEvents['emit'](_0x4bd57c+':'+_0x106d8f['id'],_0x106d8f);SmsQueueEvents[_0xeb16('0x4')](_0x4bd57c,_0x106d8f);_0x431b54(null);};}for(var e in events){if(events[_0xeb16('0x5')](e)){var event=events[e];SmsQueue[_0xeb16('0x6')](e,emitEvent(event));}}module[_0xeb16('0x7')]=SmsQueueEvents; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.model.js b/server/api/smsQueue/smsQueue.model.js index df29cea..bddab8a 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 _0xd421=['SmsQueue','sms_queues','lodash','util','api','moment','bluebird','request-promise','path','../../config/environment','./smsQueue.attributes','define'];(function(_0x204967,_0x50bb66){var _0x31fca9=function(_0x1f2262){while(--_0x1f2262){_0x204967['push'](_0x204967['shift']());}};_0x31fca9(++_0x50bb66);}(_0xd421,0x10a));var _0x1d42=function(_0x6e5c53,_0x1212a4){_0x6e5c53=_0x6e5c53-0x0;var _0x49b50a=_0xd421[_0x6e5c53];return _0x49b50a;};'use strict';var _=require(_0x1d42('0x0'));var util=require(_0x1d42('0x1'));var logger=require('../../config/logger')(_0x1d42('0x2'));var moment=require(_0x1d42('0x3'));var BPromise=require(_0x1d42('0x4'));var rp=require(_0x1d42('0x5'));var fs=require('fs');var path=require(_0x1d42('0x6'));var rimraf=require('rimraf');var config=require(_0x1d42('0x7'));var attributes=require(_0x1d42('0x8'));module['exports']=function(_0x1a76dc,_0x1bfdcb){return _0x1a76dc[_0x1d42('0x9')](_0x1d42('0xa'),attributes,{'tableName':_0x1d42('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x434f=['define','SmsQueue','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports'];(function(_0x47a472,_0x40f1d9){var _0x2ce58a=function(_0x14834d){while(--_0x14834d){_0x47a472['push'](_0x47a472['shift']());}};_0x2ce58a(++_0x40f1d9);}(_0x434f,0x120));var _0xf434=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x434f[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xf434('0x0'));var util=require(_0xf434('0x1'));var logger=require(_0xf434('0x2'))(_0xf434('0x3'));var moment=require(_0xf434('0x4'));var BPromise=require(_0xf434('0x5'));var rp=require(_0xf434('0x6'));var fs=require('fs');var path=require(_0xf434('0x7'));var rimraf=require(_0xf434('0x8'));var config=require(_0xf434('0x9'));var attributes=require('./smsQueue.attributes');module[_0xf434('0xa')]=function(_0xb282b7,_0x465732){return _0xb282b7[_0xf434('0xb')](_0xf434('0xc'),attributes,{'tableName':'sms_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.rpc.js b/server/api/smsQueue/smsQueue.rpc.js index 68c0c0a..3383bca 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 _0x212a=['findAll','options','raw','attributes','limit','include','map','model','then','ShowSmsQueue','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','register','request','info','SmsQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','GetSmsQueue','SmsQueue'];(function(_0x187e82,_0x5254eb){var _0x58625e=function(_0x59d14d){while(--_0x59d14d){_0x187e82['push'](_0x187e82['shift']());}};_0x58625e(++_0x5254eb);}(_0x212a,0x1a1));var _0xa212=function(_0x46698a,_0x8de1e4){_0x46698a=_0x46698a-0x0;var _0x356db0=_0x212a[_0x46698a];return _0x356db0;};'use strict';var _=require(_0xa212('0x0'));var util=require(_0xa212('0x1'));var moment=require('moment');var BPromise=require(_0xa212('0x2'));var rs=require(_0xa212('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa212('0x4'))['db'];var utils=require(_0xa212('0x5'));var logger=require(_0xa212('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0xa212('0x7'));var client=jayson['client'][_0xa212('0x8')]({'port':0x232a});config[_0xa212('0x9')]=_[_0xa212('0xa')](config['redis'],{'host':_0xa212('0xb'),'port':0x18eb});var socket=require(_0xa212('0xc'))(new Redis(config[_0xa212('0x9')]));require('./smsQueue.socket')[_0xa212('0xd')](socket);function respondWithRpcPromise(_0x2e0ac5,_0x11951e,_0x1dabb0){return new BPromise(function(_0x4a850e,_0x4f034d){return client[_0xa212('0xe')](_0x2e0ac5,_0x1dabb0)['then'](function(_0x1ea7ec){logger[_0xa212('0xf')](_0xa212('0x10'),_0x11951e,_0xa212('0x11'));logger[_0xa212('0x12')]('SmsQueue,\x20%s,\x20%s,\x20%s',_0x11951e,_0xa212('0x11'),JSON[_0xa212('0x13')](_0x1ea7ec));if(_0x1ea7ec[_0xa212('0x14')]){if(_0x1ea7ec[_0xa212('0x14')][_0xa212('0x15')]===0x1f4){logger[_0xa212('0x14')](_0xa212('0x10'),_0x11951e,_0x1ea7ec['error'][_0xa212('0x16')]);return _0x4f034d(_0x1ea7ec[_0xa212('0x14')][_0xa212('0x16')]);}logger[_0xa212('0x14')](_0xa212('0x10'),_0x11951e,_0x1ea7ec['error'][_0xa212('0x16')]);return _0x4a850e(_0x1ea7ec[_0xa212('0x14')][_0xa212('0x16')]);}else{logger[_0xa212('0xf')](_0xa212('0x10'),_0x11951e,_0xa212('0x11'));_0x4a850e(_0x1ea7ec[_0xa212('0x17')][_0xa212('0x16')]);}})[_0xa212('0x18')](function(_0x36942b){logger['error'](_0xa212('0x10'),_0x11951e,_0x36942b);_0x4f034d(_0x36942b);});});}exports[_0xa212('0x19')]=function(_0x337a64){var _0x3051e1=this;return new Promise(function(_0x2c7db6,_0x47429b){return db[_0xa212('0x1a')][_0xa212('0x1b')]({'raw':_0x337a64[_0xa212('0x1c')]?_0x337a64[_0xa212('0x1c')][_0xa212('0x1d')]===undefined?!![]:![]:!![],'where':_0x337a64['options']?_0x337a64[_0xa212('0x1c')]['where']||null:null,'attributes':_0x337a64[_0xa212('0x1c')]?_0x337a64[_0xa212('0x1c')][_0xa212('0x1e')]||null:null,'limit':_0x337a64[_0xa212('0x1c')]?_0x337a64['options'][_0xa212('0x1f')]||null:null,'include':_0x337a64['options']?_0x337a64[_0xa212('0x1c')][_0xa212('0x20')]?_[_0xa212('0x21')](_0x337a64[_0xa212('0x1c')][_0xa212('0x20')],function(_0x9bf3fe){return{'model':db[_0x9bf3fe[_0xa212('0x22')]],'as':_0x9bf3fe['as'],'attributes':_0x9bf3fe['attributes'],'include':_0x9bf3fe[_0xa212('0x20')]?_[_0xa212('0x21')](_0x9bf3fe[_0xa212('0x20')],function(_0x4bf2ab){return{'model':db[_0x4bf2ab[_0xa212('0x22')]],'as':_0x4bf2ab['as'],'attributes':_0x4bf2ab[_0xa212('0x1e')],'include':_0x4bf2ab[_0xa212('0x20')]?_[_0xa212('0x21')](_0x4bf2ab['include'],function(_0x38847b){return{'model':db[_0x38847b[_0xa212('0x22')]],'as':_0x38847b['as'],'attributes':_0x38847b[_0xa212('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xa212('0x23')](function(_0x407758){logger['info'](_0xa212('0x19'),_0x337a64);logger[_0xa212('0x12')](_0xa212('0x19'),_0x337a64,JSON[_0xa212('0x13')](_0x407758));_0x2c7db6(_0x407758);})['catch'](function(_0xb7b7ae){logger['error'](_0xa212('0x19'),_0xb7b7ae['message'],_0x337a64);_0x47429b(_0x3051e1[_0xa212('0x14')](0x1f4,_0xb7b7ae[_0xa212('0x16')]));});});};exports['ShowSmsQueue']=function(_0x56afce){var _0x5c9fa5=this;return new Promise(function(_0x584b40,_0x54362b){return db[_0xa212('0x1a')]['find']({'raw':_0x56afce[_0xa212('0x1c')]?_0x56afce[_0xa212('0x1c')][_0xa212('0x1d')]===undefined?!![]:![]:!![],'where':_0x56afce['options']?_0x56afce[_0xa212('0x1c')]['where']||null:null,'attributes':_0x56afce[_0xa212('0x1c')]?_0x56afce[_0xa212('0x1c')]['attributes']||null:null,'include':_0x56afce[_0xa212('0x1c')]?_0x56afce[_0xa212('0x1c')][_0xa212('0x20')]?_['map'](_0x56afce['options'][_0xa212('0x20')],function(_0x5e432d){return{'model':db[_0x5e432d['model']],'as':_0x5e432d['as'],'attributes':_0x5e432d[_0xa212('0x1e')],'include':_0x5e432d[_0xa212('0x20')]?_[_0xa212('0x21')](_0x5e432d[_0xa212('0x20')],function(_0x6cf046){return{'model':db[_0x6cf046[_0xa212('0x22')]],'as':_0x6cf046['as'],'attributes':_0x6cf046[_0xa212('0x1e')],'include':_0x6cf046['include']?_[_0xa212('0x21')](_0x6cf046[_0xa212('0x20')],function(_0x412ed2){return{'model':db[_0x412ed2[_0xa212('0x22')]],'as':_0x412ed2['as'],'attributes':_0x412ed2['attributes']};}):[]};}):[]};}):[]:[]})[_0xa212('0x23')](function(_0x30281a){logger[_0xa212('0xf')](_0xa212('0x24'),_0x56afce);logger['debug'](_0xa212('0x24'),_0x56afce,JSON[_0xa212('0x13')](_0x30281a));_0x584b40(_0x30281a);})[_0xa212('0x18')](function(_0x3938a3){logger['error'](_0xa212('0x24'),_0x3938a3[_0xa212('0x16')],_0x56afce);_0x54362b(_0x5c9fa5[_0xa212('0x14')](0x1f4,_0x3938a3[_0xa212('0x16')]));});});}; \ No newline at end of file +var _0x9e70=['find','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','http','redis','defaults','localhost','socket.io-emitter','./smsQueue.socket','register','request','then','info','SmsQueue,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','GetSmsQueue','options','raw','where','attributes','limit','include','map','model','debug','ShowSmsQueue','SmsQueue'];(function(_0xd1d19a,_0x1933f0){var _0x52a79d=function(_0x5199e2){while(--_0x5199e2){_0xd1d19a['push'](_0xd1d19a['shift']());}};_0x52a79d(++_0x1933f0);}(_0x9e70,0x1af));var _0x09e7=function(_0x9a5bba,_0x4758db){_0x9a5bba=_0x9a5bba-0x0;var _0x5bbc01=_0x9e70[_0x9a5bba];return _0x5bbc01;};'use strict';var _=require(_0x09e7('0x0'));var util=require(_0x09e7('0x1'));var moment=require(_0x09e7('0x2'));var BPromise=require('bluebird');var rs=require(_0x09e7('0x3'));var fs=require('fs');var Redis=require(_0x09e7('0x4'));var db=require(_0x09e7('0x5'))['db'];var utils=require(_0x09e7('0x6'));var logger=require('../../config/logger')(_0x09e7('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x09e7('0x8')]({'port':0x232a});config[_0x09e7('0x9')]=_[_0x09e7('0xa')](config['redis'],{'host':_0x09e7('0xb'),'port':0x18eb});var socket=require(_0x09e7('0xc'))(new Redis(config[_0x09e7('0x9')]));require(_0x09e7('0xd'))[_0x09e7('0xe')](socket);function respondWithRpcPromise(_0xfcfe70,_0x11b8e2,_0x383b7c){return new BPromise(function(_0x5f4e45,_0x1efa19){return client[_0x09e7('0xf')](_0xfcfe70,_0x383b7c)[_0x09e7('0x10')](function(_0x1cf811){logger[_0x09e7('0x11')](_0x09e7('0x12'),_0x11b8e2,'request\x20sent');logger['debug']('SmsQueue,\x20%s,\x20%s,\x20%s',_0x11b8e2,_0x09e7('0x13'),JSON[_0x09e7('0x14')](_0x1cf811));if(_0x1cf811[_0x09e7('0x15')]){if(_0x1cf811['error'][_0x09e7('0x16')]===0x1f4){logger[_0x09e7('0x15')](_0x09e7('0x12'),_0x11b8e2,_0x1cf811['error'][_0x09e7('0x17')]);return _0x1efa19(_0x1cf811['error']['message']);}logger[_0x09e7('0x15')](_0x09e7('0x12'),_0x11b8e2,_0x1cf811[_0x09e7('0x15')]['message']);return _0x5f4e45(_0x1cf811['error'][_0x09e7('0x17')]);}else{logger['info'](_0x09e7('0x12'),_0x11b8e2,_0x09e7('0x13'));_0x5f4e45(_0x1cf811[_0x09e7('0x18')]['message']);}})['catch'](function(_0x413680){logger[_0x09e7('0x15')]('SmsQueue,\x20%s,\x20%s',_0x11b8e2,_0x413680);_0x1efa19(_0x413680);});});}exports[_0x09e7('0x19')]=function(_0x31bf4f){var _0x1e49c4=this;return new Promise(function(_0x3aaaa0,_0x4e34b6){return db['SmsQueue']['findAll']({'raw':_0x31bf4f['options']?_0x31bf4f[_0x09e7('0x1a')][_0x09e7('0x1b')]===undefined?!![]:![]:!![],'where':_0x31bf4f[_0x09e7('0x1a')]?_0x31bf4f['options'][_0x09e7('0x1c')]||null:null,'attributes':_0x31bf4f[_0x09e7('0x1a')]?_0x31bf4f['options'][_0x09e7('0x1d')]||null:null,'limit':_0x31bf4f[_0x09e7('0x1a')]?_0x31bf4f[_0x09e7('0x1a')][_0x09e7('0x1e')]||null:null,'include':_0x31bf4f['options']?_0x31bf4f[_0x09e7('0x1a')][_0x09e7('0x1f')]?_['map'](_0x31bf4f[_0x09e7('0x1a')][_0x09e7('0x1f')],function(_0x3ba2de){return{'model':db[_0x3ba2de['model']],'as':_0x3ba2de['as'],'attributes':_0x3ba2de[_0x09e7('0x1d')],'include':_0x3ba2de[_0x09e7('0x1f')]?_[_0x09e7('0x20')](_0x3ba2de[_0x09e7('0x1f')],function(_0x3f0662){return{'model':db[_0x3f0662[_0x09e7('0x21')]],'as':_0x3f0662['as'],'attributes':_0x3f0662[_0x09e7('0x1d')],'include':_0x3f0662['include']?_['map'](_0x3f0662[_0x09e7('0x1f')],function(_0x477346){return{'model':db[_0x477346[_0x09e7('0x21')]],'as':_0x477346['as'],'attributes':_0x477346[_0x09e7('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x09e7('0x10')](function(_0x440e72){logger[_0x09e7('0x11')](_0x09e7('0x19'),_0x31bf4f);logger[_0x09e7('0x22')](_0x09e7('0x19'),_0x31bf4f,JSON[_0x09e7('0x14')](_0x440e72));_0x3aaaa0(_0x440e72);})['catch'](function(_0x310346){logger[_0x09e7('0x15')]('GetSmsQueue',_0x310346[_0x09e7('0x17')],_0x31bf4f);_0x4e34b6(_0x1e49c4[_0x09e7('0x15')](0x1f4,_0x310346[_0x09e7('0x17')]));});});};exports[_0x09e7('0x23')]=function(_0x31b070){var _0x443860=this;return new Promise(function(_0x149639,_0x961966){return db[_0x09e7('0x24')][_0x09e7('0x25')]({'raw':_0x31b070[_0x09e7('0x1a')]?_0x31b070[_0x09e7('0x1a')][_0x09e7('0x1b')]===undefined?!![]:![]:!![],'where':_0x31b070[_0x09e7('0x1a')]?_0x31b070['options']['where']||null:null,'attributes':_0x31b070[_0x09e7('0x1a')]?_0x31b070['options']['attributes']||null:null,'include':_0x31b070[_0x09e7('0x1a')]?_0x31b070[_0x09e7('0x1a')][_0x09e7('0x1f')]?_[_0x09e7('0x20')](_0x31b070[_0x09e7('0x1a')][_0x09e7('0x1f')],function(_0x291896){return{'model':db[_0x291896[_0x09e7('0x21')]],'as':_0x291896['as'],'attributes':_0x291896[_0x09e7('0x1d')],'include':_0x291896[_0x09e7('0x1f')]?_[_0x09e7('0x20')](_0x291896['include'],function(_0x1d0b2e){return{'model':db[_0x1d0b2e[_0x09e7('0x21')]],'as':_0x1d0b2e['as'],'attributes':_0x1d0b2e[_0x09e7('0x1d')],'include':_0x1d0b2e['include']?_['map'](_0x1d0b2e['include'],function(_0x5e8793){return{'model':db[_0x5e8793[_0x09e7('0x21')]],'as':_0x5e8793['as'],'attributes':_0x5e8793[_0x09e7('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x09e7('0x10')](function(_0x59b918){logger[_0x09e7('0x11')](_0x09e7('0x23'),_0x31b070);logger[_0x09e7('0x22')](_0x09e7('0x23'),_0x31b070,JSON['stringify'](_0x59b918));_0x149639(_0x59b918);})[_0x09e7('0x26')](function(_0x4d3e45){logger[_0x09e7('0x15')](_0x09e7('0x23'),_0x4d3e45[_0x09e7('0x17')],_0x31b070);_0x961966(_0x443860[_0x09e7('0x15')](0x1f4,_0x4d3e45[_0x09e7('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.socket.js b/server/api/smsQueue/smsQueue.socket.js index 0e48f24..0815d3f 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 _0xf81d=['save','remove','update','emit','length','./smsQueue.events'];(function(_0xc54c54,_0x59053b){var _0x476786=function(_0x2d6a30){while(--_0x2d6a30){_0xc54c54['push'](_0xc54c54['shift']());}};_0x476786(++_0x59053b);}(_0xf81d,0xdd));var _0xdf81=function(_0x2b10c0,_0x59d077){_0x2b10c0=_0x2b10c0-0x0;var _0xbfb816=_0xf81d[_0x2b10c0];return _0xbfb816;};'use strict';var SmsQueueEvents=require(_0xdf81('0x0'));var events=[_0xdf81('0x1'),_0xdf81('0x2'),_0xdf81('0x3')];function createListener(_0xab7e99,_0x2e66f0){return function(_0x2ba194){_0x2e66f0[_0xdf81('0x4')](_0xab7e99,_0x2ba194);};}function removeListener(_0x5ba82f,_0x2f7659){return function(){SmsQueueEvents['removeListener'](_0x5ba82f,_0x2f7659);};}exports['register']=function(_0x45bc4b){for(var _0x2234dd=0x0,_0x47dbb2=events[_0xdf81('0x5')];_0x2234dd<_0x47dbb2;_0x2234dd++){var _0x3f33bb=events[_0x2234dd];var _0x1c17bf=createListener('smsQueue:'+_0x3f33bb,_0x45bc4b);SmsQueueEvents['on'](_0x3f33bb,_0x1c17bf);}}; \ No newline at end of file +var _0xc1fb=['./smsQueue.events','save','remove','emit','removeListener'];(function(_0x398e07,_0x35db57){var _0x17d57f=function(_0x77123){while(--_0x77123){_0x398e07['push'](_0x398e07['shift']());}};_0x17d57f(++_0x35db57);}(_0xc1fb,0x7d));var _0xbc1f=function(_0x4695ba,_0x5a7f2a){_0x4695ba=_0x4695ba-0x0;var _0x524b7d=_0xc1fb[_0x4695ba];return _0x524b7d;};'use strict';var SmsQueueEvents=require(_0xbc1f('0x0'));var events=[_0xbc1f('0x1'),_0xbc1f('0x2'),'update'];function createListener(_0x4d72fd,_0xa856f0){return function(_0x3719a3){_0xa856f0[_0xbc1f('0x3')](_0x4d72fd,_0x3719a3);};}function removeListener(_0x1feda1,_0x2d0428){return function(){SmsQueueEvents[_0xbc1f('0x4')](_0x1feda1,_0x2d0428);};}exports['register']=function(_0x4f59c0){for(var _0x3c146a=0x0,_0x367506=events['length'];_0x3c146a<_0x367506;_0x3c146a++){var _0xc263e=events[_0x3c146a];var _0x1a93e6=createListener('smsQueue:'+_0xc263e,_0x4f59c0);SmsQueueEvents['on'](_0xc263e,_0x1a93e6);}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/index.js b/server/api/smsQueueReport/index.js index b5a166a..aa62b7a 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 _0x971d=['describe','/:id','post','create','put','update','delete','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsQueueReport.controller','get','isAuthenticated','index','/describe'];(function(_0x2d12b8,_0x29c46d){var _0x11a143=function(_0x449bbc){while(--_0x449bbc){_0x2d12b8['push'](_0x2d12b8['shift']());}};_0x11a143(++_0x29c46d);}(_0x971d,0xc5));var _0xd971=function(_0x319c52,_0x338316){_0x319c52=_0x319c52-0x0;var _0x164ab7=_0x971d[_0x319c52];return _0x164ab7;};'use strict';var multer=require(_0xd971('0x0'));var util=require(_0xd971('0x1'));var path=require(_0xd971('0x2'));var timeout=require(_0xd971('0x3'));var express=require('express');var router=express[_0xd971('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xd971('0x5'));var interaction=require(_0xd971('0x6'));var config=require(_0xd971('0x7'));var controller=require(_0xd971('0x8'));router[_0xd971('0x9')]('/',auth[_0xd971('0xa')](),controller[_0xd971('0xb')]);router[_0xd971('0x9')](_0xd971('0xc'),auth[_0xd971('0xa')](),controller[_0xd971('0xd')]);router['get'](_0xd971('0xe'),auth[_0xd971('0xa')](),controller['show']);router[_0xd971('0xf')]('/',auth[_0xd971('0xa')](),controller[_0xd971('0x10')]);router[_0xd971('0x11')]('/:id',auth['isAuthenticated'](),controller[_0xd971('0x12')]);router[_0xd971('0x13')](_0xd971('0xe'),auth[_0xd971('0xa')](),controller['destroy']);module[_0xd971('0x14')]=router; \ No newline at end of file +var _0xbeea=['create','put','update','delete','destroy','exports','multer','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./smsQueueReport.controller','get','isAuthenticated','/describe','show','post'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0xbeea,0xb1));var _0xabee=function(_0x317412,_0xd00b08){_0x317412=_0x317412-0x0;var _0x904316=_0xbeea[_0x317412];return _0x904316;};'use strict';var multer=require(_0xabee('0x0'));var util=require('util');var path=require(_0xabee('0x1'));var timeout=require(_0xabee('0x2'));var express=require(_0xabee('0x3'));var router=express['Router']();var fs_extra=require(_0xabee('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xabee('0x5'));var config=require(_0xabee('0x6'));var controller=require(_0xabee('0x7'));router[_0xabee('0x8')]('/',auth[_0xabee('0x9')](),controller['index']);router['get'](_0xabee('0xa'),auth[_0xabee('0x9')](),controller['describe']);router[_0xabee('0x8')]('/:id',auth[_0xabee('0x9')](),controller[_0xabee('0xb')]);router[_0xabee('0xc')]('/',auth[_0xabee('0x9')](),controller[_0xabee('0xd')]);router[_0xabee('0xe')]('/:id',auth[_0xabee('0x9')](),controller[_0xabee('0xf')]);router[_0xabee('0x10')]('/:id',auth[_0xabee('0x9')](),controller[_0xabee('0x11')]);module[_0xabee('0x12')]=router; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.attributes.js b/server/api/smsQueueReport/smsQueueReport.attributes.js index 9e62a2d..a97aede 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 _0x6cd3=['sequelize','exports','DATE'];(function(_0x14a8d5,_0x17b15c){var _0x3a7c52=function(_0x2c1ec7){while(--_0x2c1ec7){_0x14a8d5['push'](_0x14a8d5['shift']());}};_0x3a7c52(++_0x17b15c);}(_0x6cd3,0x1a1));var _0x36cd=function(_0xf51c06,_0x388e5b){_0xf51c06=_0xf51c06-0x0;var _0x1d5420=_0x6cd3[_0xf51c06];return _0x1d5420;};'use strict';var moment=require('moment');var Sequelize=require(_0x36cd('0x0'));module[_0x36cd('0x1')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x36cd('0x2')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0x36cd('0x2')]},'exitAt':{'type':Sequelize[_0x36cd('0x2')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x64d4=['exports','DATE','STRING','moment','sequelize'];(function(_0x23282f,_0x39e993){var _0x542bdb=function(_0x37da02){while(--_0x37da02){_0x23282f['push'](_0x23282f['shift']());}};_0x542bdb(++_0x39e993);}(_0x64d4,0x94));var _0x464d=function(_0x1e4a5f,_0x5781a0){_0x1e4a5f=_0x1e4a5f-0x0;var _0x30047e=_0x64d4[_0x1e4a5f];return _0x30047e;};'use strict';var moment=require(_0x464d('0x0'));var Sequelize=require(_0x464d('0x1'));module[_0x464d('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x464d('0x3')]},'leaveAt':{'type':Sequelize[_0x464d('0x3')]},'acceptAt':{'type':Sequelize[_0x464d('0x3')]},'exitAt':{'type':Sequelize[_0x464d('0x3')]},'reason':{'type':Sequelize[_0x464d('0x4')]}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.controller.js b/server/api/smsQueueReport/smsQueueReport.controller.js index 040ac90..28e8f2c 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 _0x890b=['reject','update','then','error','stack','name','send','index','fieldName','type','key','map','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','options','includeAll','include','SmsQueueReport','findAll','catch','show','params','rawAttributes','find','create','body','destroy','describe','eml-format','zip-dir','fast-json-patch','bluebird','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply'];(function(_0x1b2255,_0x3de34f){var _0x33e57d=function(_0x2f9cce){while(--_0x2f9cce){_0x1b2255['push'](_0x1b2255['shift']());}};_0x33e57d(++_0x3de34f);}(_0x890b,0x76));var _0xb890=function(_0x359c35,_0x4be680){_0x359c35=_0x359c35-0x0;var _0x816092=_0x890b[_0x359c35];return _0x816092;};'use strict';var emlformat=require(_0xb890('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xb890('0x1'));var jsonpatch=require(_0xb890('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xb890('0x3'));var Mustache=require('mustache');var util=require(_0xb890('0x4'));var path=require(_0xb890('0x5'));var sox=require('sox');var csv=require(_0xb890('0x6'));var ejs=require(_0xb890('0x7'));var fs=require('fs');var fs_extra=require(_0xb890('0x8'));var _=require(_0xb890('0x9'));var squel=require(_0xb890('0xa'));var crypto=require(_0xb890('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xb890('0xc'));var toCsv=require(_0xb890('0x6'));var querystring=require(_0xb890('0xd'));var Papa=require(_0xb890('0xe'));var Redis=require(_0xb890('0xf'));var authService=require(_0xb890('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xb890('0x11'));var hardwareService=require(_0xb890('0x12'));var logger=require(_0xb890('0x13'))(_0xb890('0x14'));var utils=require(_0xb890('0x15'));var config=require(_0xb890('0x16'));var licenseUtil=require(_0xb890('0x17'));var db=require(_0xb890('0x18'))['db'];function respondWithStatusCode(_0x1948e5,_0x401e47){_0x401e47=_0x401e47||0xcc;return function(_0x4ebcf0){if(_0x4ebcf0){return _0x1948e5[_0xb890('0x19')](_0x401e47);}return _0x1948e5[_0xb890('0x1a')](_0x401e47)['end']();};}function respondWithResult(_0x1187e6,_0x1dd730){_0x1dd730=_0x1dd730||0xc8;return function(_0x89ff77){if(_0x89ff77){return _0x1187e6[_0xb890('0x1a')](_0x1dd730)[_0xb890('0x1b')](_0x89ff77);}};}function respondWithFilteredResult(_0x4ce5ae,_0x361334){return function(_0x626036){if(_0x626036){var _0x141717=typeof _0x361334[_0xb890('0x1c')]===_0xb890('0x1d')&&typeof _0x361334[_0xb890('0x1e')]==='undefined';var _0x5478bf=_0x626036[_0xb890('0x1f')];var _0x39cccc=_0x141717?0x0:_0x361334[_0xb890('0x1c')];var _0x52ff6a=_0x141717?_0x626036[_0xb890('0x1f')]:_0x361334[_0xb890('0x1c')]+_0x361334[_0xb890('0x1e')];var _0x281df5;if(_0x52ff6a>=_0x5478bf){_0x52ff6a=_0x5478bf;_0x281df5=0xc8;}else{_0x281df5=0xce;}_0x4ce5ae[_0xb890('0x1a')](_0x281df5);return _0x4ce5ae['set'](_0xb890('0x20'),_0x39cccc+'-'+_0x52ff6a+'/'+_0x5478bf)[_0xb890('0x1b')](_0x626036);}return null;};}function patchUpdates(_0x57d3e8){return function(_0x5236a4){try{jsonpatch[_0xb890('0x21')](_0x5236a4,_0x57d3e8,!![]);}catch(_0x30b410){return BPromise[_0xb890('0x22')](_0x30b410);}return _0x5236a4['save']();};}function saveUpdates(_0x4a38aa,_0x399627){return function(_0x1f847b){if(_0x1f847b){return _0x1f847b[_0xb890('0x23')](_0x4a38aa)[_0xb890('0x24')](function(_0x32d986){return _0x32d986;});}return null;};}function removeEntity(_0x381521,_0x52273f){return function(_0x2a34bd){if(_0x2a34bd){return _0x2a34bd['destroy']()[_0xb890('0x24')](function(){_0x381521[_0xb890('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x9412f,_0x4c8462){return function(_0x786321){if(!_0x786321){_0x9412f[_0xb890('0x19')](0x194);}return _0x786321;};}function handleError(_0x44fe45,_0xf10ce7){_0xf10ce7=_0xf10ce7||0x1f4;return function(_0x1abe66){logger[_0xb890('0x25')](_0x1abe66[_0xb890('0x26')]);if(_0x1abe66[_0xb890('0x27')]){delete _0x1abe66[_0xb890('0x27')];}_0x44fe45[_0xb890('0x1a')](_0xf10ce7)[_0xb890('0x28')](_0x1abe66);};}exports[_0xb890('0x29')]=function(_0x5db907,_0x354999){var _0x2f0981={},_0x52c951={},_0x33e056={'count':0x0,'rows':[]};var _0x91c488=_['map'](db['SmsQueueReport']['rawAttributes'],function(_0x3854fb){return{'name':_0x3854fb[_0xb890('0x2a')],'type':_0x3854fb[_0xb890('0x2b')][_0xb890('0x2c')]};});_0x52c951['model']=_[_0xb890('0x2d')](_0x91c488,_0xb890('0x27'));_0x52c951[_0xb890('0x2e')]=_[_0xb890('0x2f')](_0x5db907[_0xb890('0x2e')]);_0x52c951[_0xb890('0x30')]=_[_0xb890('0x31')](_0x52c951[_0xb890('0x32')],_0x52c951[_0xb890('0x2e')]);_0x2f0981['attributes']=_[_0xb890('0x31')](_0x52c951['model'],qs[_0xb890('0x33')](_0x5db907[_0xb890('0x2e')][_0xb890('0x33')]));_0x2f0981[_0xb890('0x34')]=_0x2f0981[_0xb890('0x34')][_0xb890('0x35')]?_0x2f0981[_0xb890('0x34')]:_0x52c951[_0xb890('0x32')];if(!_0x5db907[_0xb890('0x2e')][_0xb890('0x36')](_0xb890('0x37'))){_0x2f0981['limit']=qs[_0xb890('0x1e')](_0x5db907[_0xb890('0x2e')][_0xb890('0x1e')]);_0x2f0981[_0xb890('0x1c')]=qs['offset'](_0x5db907[_0xb890('0x2e')][_0xb890('0x1c')]);}_0x2f0981[_0xb890('0x38')]=qs[_0xb890('0x39')](_0x5db907[_0xb890('0x2e')][_0xb890('0x39')]);_0x2f0981['where']=qs[_0xb890('0x30')](_[_0xb890('0x3a')](_0x5db907[_0xb890('0x2e')],_0x52c951[_0xb890('0x30')]),_0x91c488);if(_0x5db907['query'][_0xb890('0x3b')]){_0x2f0981[_0xb890('0x3c')]=_[_0xb890('0x3d')](_0x2f0981[_0xb890('0x3c')],{'$or':_['map'](_0x91c488,function(_0x18aacc){if(_0x18aacc['type']!=='VIRTUAL'){var _0x430d63={};_0x430d63[_0x18aacc[_0xb890('0x27')]]={'$like':'%'+_0x5db907[_0xb890('0x2e')]['filter']+'%'};return _0x430d63;}})});}_0x2f0981=_[_0xb890('0x3d')]({},_0x2f0981,_0x5db907[_0xb890('0x3e')]);var _0x59cbcf={'where':_0x2f0981[_0xb890('0x3c')]};return db['SmsQueueReport']['count'](_0x59cbcf)[_0xb890('0x24')](function(_0x5e72ed){_0x33e056['count']=_0x5e72ed;if(_0x5db907['query'][_0xb890('0x3f')]){_0x2f0981[_0xb890('0x40')]=[{'all':!![]}];}return db[_0xb890('0x41')][_0xb890('0x42')](_0x2f0981);})[_0xb890('0x24')](function(_0x414b63){_0x33e056['rows']=_0x414b63;return _0x33e056;})['then'](respondWithFilteredResult(_0x354999,_0x2f0981))[_0xb890('0x43')](handleError(_0x354999,null));};exports[_0xb890('0x44')]=function(_0x6c906a,_0xa0dd4f){var _0x185c87={'raw':!![],'where':{'id':_0x6c906a[_0xb890('0x45')]['id']}},_0x28fce0={};_0x28fce0['model']=_[_0xb890('0x2f')](db[_0xb890('0x41')][_0xb890('0x46')]);_0x28fce0[_0xb890('0x2e')]=_[_0xb890('0x2f')](_0x6c906a[_0xb890('0x2e')]);_0x28fce0[_0xb890('0x30')]=_['intersection'](_0x28fce0[_0xb890('0x32')],_0x28fce0['query']);_0x185c87[_0xb890('0x34')]=_['intersection'](_0x28fce0[_0xb890('0x32')],qs[_0xb890('0x33')](_0x6c906a[_0xb890('0x2e')]['fields']));_0x185c87[_0xb890('0x34')]=_0x185c87[_0xb890('0x34')][_0xb890('0x35')]?_0x185c87[_0xb890('0x34')]:_0x28fce0[_0xb890('0x32')];if(_0x6c906a[_0xb890('0x2e')]['includeAll']){_0x185c87[_0xb890('0x40')]=[{'all':!![]}];}_0x185c87=_[_0xb890('0x3d')]({},_0x185c87,_0x6c906a[_0xb890('0x3e')]);return db[_0xb890('0x41')][_0xb890('0x47')](_0x185c87)['then'](handleEntityNotFound(_0xa0dd4f,null))['then'](respondWithResult(_0xa0dd4f,null))[_0xb890('0x43')](handleError(_0xa0dd4f,null));};exports[_0xb890('0x48')]=function(_0x479514,_0x18f093){return db['SmsQueueReport'][_0xb890('0x48')](_0x479514['body'],{})[_0xb890('0x24')](respondWithResult(_0x18f093,0xc9))[_0xb890('0x43')](handleError(_0x18f093,null));};exports[_0xb890('0x23')]=function(_0x17595a,_0x258ed4){if(_0x17595a['body']['id']){delete _0x17595a[_0xb890('0x49')]['id'];}return db[_0xb890('0x41')][_0xb890('0x47')]({'where':{'id':_0x17595a['params']['id']}})[_0xb890('0x24')](handleEntityNotFound(_0x258ed4,null))[_0xb890('0x24')](saveUpdates(_0x17595a[_0xb890('0x49')],null))[_0xb890('0x24')](respondWithResult(_0x258ed4,null))['catch'](handleError(_0x258ed4,null));};exports[_0xb890('0x4a')]=function(_0x5277ec,_0x354f28){return db[_0xb890('0x41')][_0xb890('0x47')]({'where':{'id':_0x5277ec[_0xb890('0x45')]['id']}})[_0xb890('0x24')](handleEntityNotFound(_0x354f28,null))[_0xb890('0x24')](removeEntity(_0x354f28,null))[_0xb890('0x43')](handleError(_0x354f28,null));};exports[_0xb890('0x4b')]=function(_0x43920b,_0x318f15){return db['SmsQueueReport'][_0xb890('0x4b')]()['then'](respondWithResult(_0x318f15,null))[_0xb890('0x43')](handleError(_0x318f15,null));}; \ No newline at end of file +var _0x6737=['fieldName','type','key','query','keys','intersection','model','attributes','fields','hasOwnProperty','nolimit','sort','filters','where','merge','filter','options','includeAll','include','findAll','rows','catch','show','params','create','body','update','find','describe','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','offset','undefined','limit','count','set','apply','reject','save','then','destroy','stack','name','send','index','map','SmsQueueReport','rawAttributes'];(function(_0x577e13,_0xc2c054){var _0x13a973=function(_0x517cc9){while(--_0x517cc9){_0x577e13['push'](_0x577e13['shift']());}};_0x13a973(++_0xc2c054);}(_0x6737,0xaf));var _0x7673=function(_0x58a47d,_0x225912){_0x58a47d=_0x58a47d-0x0;var _0x1124cd=_0x6737[_0x58a47d];return _0x1124cd;};'use strict';var emlformat=require(_0x7673('0x0'));var rimraf=require(_0x7673('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x7673('0x2'));var moment=require(_0x7673('0x3'));var BPromise=require(_0x7673('0x4'));var Mustache=require(_0x7673('0x5'));var util=require(_0x7673('0x6'));var path=require(_0x7673('0x7'));var sox=require(_0x7673('0x8'));var csv=require('to-csv');var ejs=require(_0x7673('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7673('0xa'));var squel=require(_0x7673('0xb'));var crypto=require('crypto');var jsforce=require(_0x7673('0xc'));var deskjs=require(_0x7673('0xd'));var toCsv=require(_0x7673('0xe'));var querystring=require(_0x7673('0xf'));var Papa=require('papaparse');var Redis=require(_0x7673('0x10'));var authService=require(_0x7673('0x11'));var qs=require(_0x7673('0x12'));var as=require(_0x7673('0x13'));var hardwareService=require(_0x7673('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0x7673('0x15'));var config=require(_0x7673('0x16'));var licenseUtil=require(_0x7673('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4d5502,_0x381070){_0x381070=_0x381070||0xcc;return function(_0x1b4899){if(_0x1b4899){return _0x4d5502[_0x7673('0x18')](_0x381070);}return _0x4d5502[_0x7673('0x19')](_0x381070)[_0x7673('0x1a')]();};}function respondWithResult(_0x11e618,_0x3ade58){_0x3ade58=_0x3ade58||0xc8;return function(_0x10d626){if(_0x10d626){return _0x11e618['status'](_0x3ade58)['json'](_0x10d626);}};}function respondWithFilteredResult(_0x3a7837,_0x1ee508){return function(_0x477a18){if(_0x477a18){var _0x50b2b0=typeof _0x1ee508[_0x7673('0x1b')]===_0x7673('0x1c')&&typeof _0x1ee508[_0x7673('0x1d')]===_0x7673('0x1c');var _0x130715=_0x477a18['count'];var _0x169ad7=_0x50b2b0?0x0:_0x1ee508[_0x7673('0x1b')];var _0x13fc9b=_0x50b2b0?_0x477a18[_0x7673('0x1e')]:_0x1ee508[_0x7673('0x1b')]+_0x1ee508[_0x7673('0x1d')];var _0x2658c5;if(_0x13fc9b>=_0x130715){_0x13fc9b=_0x130715;_0x2658c5=0xc8;}else{_0x2658c5=0xce;}_0x3a7837[_0x7673('0x19')](_0x2658c5);return _0x3a7837[_0x7673('0x1f')]('Content-Range',_0x169ad7+'-'+_0x13fc9b+'/'+_0x130715)['json'](_0x477a18);}return null;};}function patchUpdates(_0x1c6b95){return function(_0x74feae){try{jsonpatch[_0x7673('0x20')](_0x74feae,_0x1c6b95,!![]);}catch(_0x2043a8){return BPromise[_0x7673('0x21')](_0x2043a8);}return _0x74feae[_0x7673('0x22')]();};}function saveUpdates(_0x5aebf2,_0x118521){return function(_0x430e7e){if(_0x430e7e){return _0x430e7e['update'](_0x5aebf2)[_0x7673('0x23')](function(_0x75be5d){return _0x75be5d;});}return null;};}function removeEntity(_0x4f8a6b,_0x32c623){return function(_0x45000c){if(_0x45000c){return _0x45000c[_0x7673('0x24')]()[_0x7673('0x23')](function(){_0x4f8a6b[_0x7673('0x19')](0xcc)[_0x7673('0x1a')]();});}};}function handleEntityNotFound(_0x3215f7,_0x491cab){return function(_0x53eda3){if(!_0x53eda3){_0x3215f7[_0x7673('0x18')](0x194);}return _0x53eda3;};}function handleError(_0x51bfbd,_0x11dd82){_0x11dd82=_0x11dd82||0x1f4;return function(_0x2bc8ee){logger['error'](_0x2bc8ee[_0x7673('0x25')]);if(_0x2bc8ee[_0x7673('0x26')]){delete _0x2bc8ee[_0x7673('0x26')];}_0x51bfbd[_0x7673('0x19')](_0x11dd82)[_0x7673('0x27')](_0x2bc8ee);};}exports[_0x7673('0x28')]=function(_0x1c89a6,_0x4144ea){var _0x5aab5a={},_0x27dde6={},_0x646053={'count':0x0,'rows':[]};var _0x643a60=_[_0x7673('0x29')](db[_0x7673('0x2a')][_0x7673('0x2b')],function(_0x2969c0){return{'name':_0x2969c0[_0x7673('0x2c')],'type':_0x2969c0[_0x7673('0x2d')][_0x7673('0x2e')]};});_0x27dde6['model']=_['map'](_0x643a60,_0x7673('0x26'));_0x27dde6[_0x7673('0x2f')]=_[_0x7673('0x30')](_0x1c89a6[_0x7673('0x2f')]);_0x27dde6['filters']=_[_0x7673('0x31')](_0x27dde6[_0x7673('0x32')],_0x27dde6[_0x7673('0x2f')]);_0x5aab5a[_0x7673('0x33')]=_[_0x7673('0x31')](_0x27dde6['model'],qs[_0x7673('0x34')](_0x1c89a6[_0x7673('0x2f')][_0x7673('0x34')]));_0x5aab5a['attributes']=_0x5aab5a[_0x7673('0x33')]['length']?_0x5aab5a[_0x7673('0x33')]:_0x27dde6[_0x7673('0x32')];if(!_0x1c89a6['query'][_0x7673('0x35')](_0x7673('0x36'))){_0x5aab5a[_0x7673('0x1d')]=qs[_0x7673('0x1d')](_0x1c89a6[_0x7673('0x2f')][_0x7673('0x1d')]);_0x5aab5a[_0x7673('0x1b')]=qs['offset'](_0x1c89a6[_0x7673('0x2f')]['offset']);}_0x5aab5a['order']=qs['sort'](_0x1c89a6[_0x7673('0x2f')][_0x7673('0x37')]);_0x5aab5a['where']=qs[_0x7673('0x38')](_['pick'](_0x1c89a6[_0x7673('0x2f')],_0x27dde6[_0x7673('0x38')]),_0x643a60);if(_0x1c89a6[_0x7673('0x2f')]['filter']){_0x5aab5a[_0x7673('0x39')]=_[_0x7673('0x3a')](_0x5aab5a['where'],{'$or':_[_0x7673('0x29')](_0x643a60,function(_0x214c1a){if(_0x214c1a[_0x7673('0x2d')]!=='VIRTUAL'){var _0x43fc6f={};_0x43fc6f[_0x214c1a['name']]={'$like':'%'+_0x1c89a6[_0x7673('0x2f')][_0x7673('0x3b')]+'%'};return _0x43fc6f;}})});}_0x5aab5a=_[_0x7673('0x3a')]({},_0x5aab5a,_0x1c89a6[_0x7673('0x3c')]);var _0x2f7ebb={'where':_0x5aab5a[_0x7673('0x39')]};return db[_0x7673('0x2a')][_0x7673('0x1e')](_0x2f7ebb)['then'](function(_0x4fcd86){_0x646053[_0x7673('0x1e')]=_0x4fcd86;if(_0x1c89a6[_0x7673('0x2f')][_0x7673('0x3d')]){_0x5aab5a[_0x7673('0x3e')]=[{'all':!![]}];}return db['SmsQueueReport'][_0x7673('0x3f')](_0x5aab5a);})[_0x7673('0x23')](function(_0x3fc47e){_0x646053[_0x7673('0x40')]=_0x3fc47e;return _0x646053;})[_0x7673('0x23')](respondWithFilteredResult(_0x4144ea,_0x5aab5a))[_0x7673('0x41')](handleError(_0x4144ea,null));};exports[_0x7673('0x42')]=function(_0x4f6a24,_0x58739a){var _0x45e787={'raw':!![],'where':{'id':_0x4f6a24[_0x7673('0x43')]['id']}},_0x1b8370={};_0x1b8370[_0x7673('0x32')]=_['keys'](db[_0x7673('0x2a')][_0x7673('0x2b')]);_0x1b8370[_0x7673('0x2f')]=_[_0x7673('0x30')](_0x4f6a24[_0x7673('0x2f')]);_0x1b8370[_0x7673('0x38')]=_[_0x7673('0x31')](_0x1b8370[_0x7673('0x32')],_0x1b8370[_0x7673('0x2f')]);_0x45e787['attributes']=_[_0x7673('0x31')](_0x1b8370['model'],qs[_0x7673('0x34')](_0x4f6a24[_0x7673('0x2f')][_0x7673('0x34')]));_0x45e787[_0x7673('0x33')]=_0x45e787['attributes']['length']?_0x45e787[_0x7673('0x33')]:_0x1b8370[_0x7673('0x32')];if(_0x4f6a24['query'][_0x7673('0x3d')]){_0x45e787['include']=[{'all':!![]}];}_0x45e787=_[_0x7673('0x3a')]({},_0x45e787,_0x4f6a24['options']);return db['SmsQueueReport']['find'](_0x45e787)[_0x7673('0x23')](handleEntityNotFound(_0x58739a,null))[_0x7673('0x23')](respondWithResult(_0x58739a,null))['catch'](handleError(_0x58739a,null));};exports[_0x7673('0x44')]=function(_0x388ae9,_0x4147c2){return db[_0x7673('0x2a')][_0x7673('0x44')](_0x388ae9[_0x7673('0x45')],{})['then'](respondWithResult(_0x4147c2,0xc9))['catch'](handleError(_0x4147c2,null));};exports[_0x7673('0x46')]=function(_0x4356d9,_0x5426d2){if(_0x4356d9[_0x7673('0x45')]['id']){delete _0x4356d9[_0x7673('0x45')]['id'];}return db[_0x7673('0x2a')]['find']({'where':{'id':_0x4356d9['params']['id']}})[_0x7673('0x23')](handleEntityNotFound(_0x5426d2,null))[_0x7673('0x23')](saveUpdates(_0x4356d9[_0x7673('0x45')],null))[_0x7673('0x23')](respondWithResult(_0x5426d2,null))[_0x7673('0x41')](handleError(_0x5426d2,null));};exports[_0x7673('0x24')]=function(_0x42210c,_0x20de2a){return db[_0x7673('0x2a')][_0x7673('0x47')]({'where':{'id':_0x42210c['params']['id']}})[_0x7673('0x23')](handleEntityNotFound(_0x20de2a,null))[_0x7673('0x23')](removeEntity(_0x20de2a,null))[_0x7673('0x41')](handleError(_0x20de2a,null));};exports[_0x7673('0x48')]=function(_0x403517,_0x101082){return db[_0x7673('0x2a')][_0x7673('0x48')]()[_0x7673('0x23')](respondWithResult(_0x101082,null))[_0x7673('0x41')](handleError(_0x101082,null));}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.model.js b/server/api/smsQueueReport/smsQueueReport.model.js index 9978ddb..dbdddcc 100644 --- a/server/api/smsQueueReport/smsQueueReport.model.js +++ b/server/api/smsQueueReport/smsQueueReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['define','SmsQueueReport','uniqueid','lodash','util','../../config/logger','bluebird','path','rimraf','../../config/environment','./smsQueueReport.attributes','exports'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xa9e0[_0x19e35c];return _0x3e1fe8;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));module[_0x0a9e('0x8')]=function(_0x57b080,_0x219af0){return _0x57b080[_0x0a9e('0x9')](_0x0a9e('0xa'),attributes,{'tableName':'report_sms_queue','paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x0a9e('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xd8b0=['define','report_sms_queue','uniqueid','lodash','util','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x367fb2,_0x51c67a){var _0x281962=function(_0x18bae1){while(--_0x18bae1){_0x367fb2['push'](_0x367fb2['shift']());}};_0x281962(++_0x51c67a);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x0d8b('0x2'));var rp=require(_0x0d8b('0x3'));var fs=require('fs');var path=require(_0x0d8b('0x4'));var rimraf=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var attributes=require('./smsQueueReport.attributes');module['exports']=function(_0x3f8b6f,_0x227c63){return _0x3f8b6f[_0x0d8b('0x7')]('SmsQueueReport',attributes,{'tableName':_0x0d8b('0x8'),'paranoid':![],'indexes':[{'name':_0x0d8b('0x9'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.rpc.js b/server/api/smsQueueReport/smsQueueReport.rpc.js index b24a84d..4f88293 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 _0x640f=['jayson/promise','client','http','request','then','info','SmsQueueReport,\x20%s,\x20%s','request\x20sent','debug','SmsQueueReport,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','CreateSmsQueueReport','SmsQueueReport','create','options','raw','stringify','UpdateSmsQueueReport','update','body','where','attributes','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x3c4087,_0x5c764b){var _0x23ad1f=function(_0x39bf1c){while(--_0x39bf1c){_0x3c4087['push'](_0x3c4087['shift']());}};_0x23ad1f(++_0x5c764b);}(_0x640f,0x1ca));var _0xf640=function(_0x23290f,_0x26ef9d){_0x23290f=_0x23290f-0x0;var _0x2b340b=_0x640f[_0x23290f];return _0x2b340b;};'use strict';var _=require(_0xf640('0x0'));var util=require(_0xf640('0x1'));var moment=require(_0xf640('0x2'));var BPromise=require(_0xf640('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf640('0x4'));var db=require(_0xf640('0x5'))['db'];var utils=require(_0xf640('0x6'));var logger=require(_0xf640('0x7'))(_0xf640('0x8'));var config=require(_0xf640('0x9'));var jayson=require(_0xf640('0xa'));var client=jayson[_0xf640('0xb')][_0xf640('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x11b7f3,_0x13d287,_0x21a964){return new BPromise(function(_0x2fbf41,_0x51950){return client[_0xf640('0xd')](_0x11b7f3,_0x21a964)[_0xf640('0xe')](function(_0x419d2e){logger[_0xf640('0xf')](_0xf640('0x10'),_0x13d287,_0xf640('0x11'));logger[_0xf640('0x12')](_0xf640('0x13'),_0x13d287,_0xf640('0x11'),JSON['stringify'](_0x419d2e));if(_0x419d2e[_0xf640('0x14')]){if(_0x419d2e[_0xf640('0x14')][_0xf640('0x15')]===0x1f4){logger['error']('SmsQueueReport,\x20%s,\x20%s',_0x13d287,_0x419d2e[_0xf640('0x14')]['message']);return _0x51950(_0x419d2e[_0xf640('0x14')][_0xf640('0x16')]);}logger[_0xf640('0x14')](_0xf640('0x10'),_0x13d287,_0x419d2e[_0xf640('0x14')]['message']);return _0x2fbf41(_0x419d2e[_0xf640('0x14')][_0xf640('0x16')]);}else{logger[_0xf640('0xf')](_0xf640('0x10'),_0x13d287,_0xf640('0x11'));_0x2fbf41(_0x419d2e[_0xf640('0x17')][_0xf640('0x16')]);}})[_0xf640('0x18')](function(_0x59fd2c){logger['error'](_0xf640('0x10'),_0x13d287,_0x59fd2c);_0x51950(_0x59fd2c);});});}exports[_0xf640('0x19')]=function(_0x5d9d63){var _0xb5385f=this;return new Promise(function(_0xa403ab,_0x5b5195){return db[_0xf640('0x1a')][_0xf640('0x1b')](_0x5d9d63['body'],{'raw':_0x5d9d63[_0xf640('0x1c')]?_0x5d9d63[_0xf640('0x1c')][_0xf640('0x1d')]===undefined?!![]:![]:!![]})['then'](function(_0x2592d1){logger[_0xf640('0xf')](_0xf640('0x19'),_0x5d9d63);logger[_0xf640('0x12')](_0xf640('0x19'),_0x5d9d63,JSON[_0xf640('0x1e')](_0x2592d1));_0xa403ab(_0x2592d1);})[_0xf640('0x18')](function(_0x51e988){logger[_0xf640('0x14')](_0xf640('0x19'),_0x51e988[_0xf640('0x16')],_0x5d9d63);_0x5b5195(_0xb5385f[_0xf640('0x14')](0x1f4,_0x51e988[_0xf640('0x16')]));});});};exports[_0xf640('0x1f')]=function(_0x579bc7){var _0x47341d=this;return new Promise(function(_0x22a001,_0xbaabf5){return db[_0xf640('0x1a')][_0xf640('0x20')](_0x579bc7[_0xf640('0x21')],{'raw':_0x579bc7[_0xf640('0x1c')]?_0x579bc7[_0xf640('0x1c')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x579bc7[_0xf640('0x1c')]?_0x579bc7[_0xf640('0x1c')][_0xf640('0x22')]||null:null,'attributes':_0x579bc7[_0xf640('0x1c')]?_0x579bc7[_0xf640('0x1c')][_0xf640('0x23')]||null:null,'limit':_0x579bc7[_0xf640('0x1c')]?_0x579bc7[_0xf640('0x1c')]['limit']||null:null})['then'](function(_0x40b32c){logger[_0xf640('0xf')](_0xf640('0x1f'),_0x579bc7);logger[_0xf640('0x12')](_0xf640('0x1f'),_0x579bc7,JSON[_0xf640('0x1e')](_0x40b32c));_0x22a001(_0x40b32c);})[_0xf640('0x18')](function(_0x5becb6){logger[_0xf640('0x14')](_0xf640('0x1f'),_0x5becb6['message'],_0x579bc7);_0xbaabf5(_0x47341d[_0xf640('0x14')](0x1f4,_0x5becb6[_0xf640('0x16')]));});});}; \ No newline at end of file +var _0x4706=['body','where','attributes','limit','debug','catch','lodash','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','request','then','info','SmsQueueReport,\x20%s,\x20%s','request\x20sent','SmsQueueReport,\x20%s,\x20%s,\x20%s','error','code','message','result','CreateSmsQueueReport','SmsQueueReport','create','options','raw','stringify','UpdateSmsQueueReport','update'];(function(_0x494d1f,_0x3f72ff){var _0x457b6e=function(_0x38cb16){while(--_0x38cb16){_0x494d1f['push'](_0x494d1f['shift']());}};_0x457b6e(++_0x3f72ff);}(_0x4706,0x10e));var _0x6470=function(_0x2150cd,_0x7f1553){_0x2150cd=_0x2150cd-0x0;var _0x411a35=_0x4706[_0x2150cd];return _0x411a35;};'use strict';var _=require(_0x6470('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x6470('0x1'));var rs=require(_0x6470('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6470('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x6470('0x4'))(_0x6470('0x5'));var config=require(_0x6470('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x6470('0x7')][_0x6470('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x457fbd,_0x511bcd,_0x360046){return new BPromise(function(_0x18c64c,_0x428b2b){return client[_0x6470('0x9')](_0x457fbd,_0x360046)[_0x6470('0xa')](function(_0x591b6b){logger[_0x6470('0xb')](_0x6470('0xc'),_0x511bcd,_0x6470('0xd'));logger['debug'](_0x6470('0xe'),_0x511bcd,_0x6470('0xd'),JSON['stringify'](_0x591b6b));if(_0x591b6b[_0x6470('0xf')]){if(_0x591b6b[_0x6470('0xf')][_0x6470('0x10')]===0x1f4){logger[_0x6470('0xf')](_0x6470('0xc'),_0x511bcd,_0x591b6b[_0x6470('0xf')][_0x6470('0x11')]);return _0x428b2b(_0x591b6b['error'][_0x6470('0x11')]);}logger['error'](_0x6470('0xc'),_0x511bcd,_0x591b6b[_0x6470('0xf')]['message']);return _0x18c64c(_0x591b6b[_0x6470('0xf')][_0x6470('0x11')]);}else{logger[_0x6470('0xb')](_0x6470('0xc'),_0x511bcd,_0x6470('0xd'));_0x18c64c(_0x591b6b[_0x6470('0x12')][_0x6470('0x11')]);}})['catch'](function(_0x4def6c){logger['error']('SmsQueueReport,\x20%s,\x20%s',_0x511bcd,_0x4def6c);_0x428b2b(_0x4def6c);});});}exports[_0x6470('0x13')]=function(_0x15fd99){var _0x45a113=this;return new Promise(function(_0x227114,_0x197657){return db[_0x6470('0x14')][_0x6470('0x15')](_0x15fd99['body'],{'raw':_0x15fd99[_0x6470('0x16')]?_0x15fd99[_0x6470('0x16')][_0x6470('0x17')]===undefined?!![]:![]:!![]})[_0x6470('0xa')](function(_0xca1780){logger['info'](_0x6470('0x13'),_0x15fd99);logger['debug']('CreateSmsQueueReport',_0x15fd99,JSON[_0x6470('0x18')](_0xca1780));_0x227114(_0xca1780);})['catch'](function(_0x59d25b){logger['error']('CreateSmsQueueReport',_0x59d25b[_0x6470('0x11')],_0x15fd99);_0x197657(_0x45a113[_0x6470('0xf')](0x1f4,_0x59d25b[_0x6470('0x11')]));});});};exports[_0x6470('0x19')]=function(_0x33161e){var _0x3ebc66=this;return new Promise(function(_0x27ca9a,_0x34c7b7){return db[_0x6470('0x14')][_0x6470('0x1a')](_0x33161e[_0x6470('0x1b')],{'raw':_0x33161e[_0x6470('0x16')]?_0x33161e[_0x6470('0x16')][_0x6470('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x33161e['options']?_0x33161e[_0x6470('0x16')][_0x6470('0x1c')]||null:null,'attributes':_0x33161e['options']?_0x33161e[_0x6470('0x16')][_0x6470('0x1d')]||null:null,'limit':_0x33161e[_0x6470('0x16')]?_0x33161e['options'][_0x6470('0x1e')]||null:null})[_0x6470('0xa')](function(_0x55291a){logger['info'](_0x6470('0x19'),_0x33161e);logger[_0x6470('0x1f')](_0x6470('0x19'),_0x33161e,JSON[_0x6470('0x18')](_0x55291a));_0x27ca9a(_0x55291a);})[_0x6470('0x20')](function(_0x2c90c8){logger[_0x6470('0xf')](_0x6470('0x19'),_0x2c90c8[_0x6470('0x11')],_0x33161e);_0x34c7b7(_0x3ebc66[_0x6470('0xf')](0x1f4,_0x2c90c8[_0x6470('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/index.js b/server/api/smsTransferReport/index.js index b4c6d29..f59be94 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 _0x9b67=['../../components/auth/service','./smsTransferReport.controller','get','isAuthenticated','index','/describe','/:id','show','post','create','put','destroy','multer','util','path','connect-timeout','express','fs-extra'];(function(_0x2a4b13,_0x4b941b){var _0x3413d6=function(_0x4a0ea6){while(--_0x4a0ea6){_0x2a4b13['push'](_0x2a4b13['shift']());}};_0x3413d6(++_0x4b941b);}(_0x9b67,0xf6));var _0x79b6=function(_0x20fd50,_0xff60e2){_0x20fd50=_0x20fd50-0x0;var _0x370362=_0x9b67[_0x20fd50];return _0x370362;};'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 +var _0xfd87=['delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsTransferReport.controller','isAuthenticated','index','/describe','describe','get','/:id','show','post'];(function(_0x429003,_0x3508da){var _0x3cc0d9=function(_0x1bc27c){while(--_0x1bc27c){_0x429003['push'](_0x429003['shift']());}};_0x3cc0d9(++_0x3508da);}(_0xfd87,0x80));var _0x7fd8=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xfd87[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x7fd8('0x0'));var util=require(_0x7fd8('0x1'));var path=require(_0x7fd8('0x2'));var timeout=require(_0x7fd8('0x3'));var express=require(_0x7fd8('0x4'));var router=express[_0x7fd8('0x5')]();var fs_extra=require(_0x7fd8('0x6'));var auth=require(_0x7fd8('0x7'));var interaction=require(_0x7fd8('0x8'));var config=require(_0x7fd8('0x9'));var controller=require(_0x7fd8('0xa'));router['get']('/',auth[_0x7fd8('0xb')](),controller[_0x7fd8('0xc')]);router['get'](_0x7fd8('0xd'),auth[_0x7fd8('0xb')](),controller[_0x7fd8('0xe')]);router[_0x7fd8('0xf')](_0x7fd8('0x10'),auth['isAuthenticated'](),controller[_0x7fd8('0x11')]);router[_0x7fd8('0x12')]('/',auth[_0x7fd8('0xb')](),controller['create']);router['put']('/:id',auth[_0x7fd8('0xb')](),controller['update']);router[_0x7fd8('0x13')](_0x7fd8('0x10'),auth[_0x7fd8('0xb')](),controller['destroy']);module[_0x7fd8('0x14')]=router; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.attributes.js b/server/api/smsTransferReport/smsTransferReport.attributes.js index 9f1fc3b..a328b69 100644 --- a/server/api/smsTransferReport/smsTransferReport.attributes.js +++ b/server/api/smsTransferReport/smsTransferReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xaa88=['account','agent','queue','DATE','NOW','moment','sequelize','exports','STRING'];(function(_0x237602,_0x4311af){var _0x2052cc=function(_0x5c7ee0){while(--_0x5c7ee0){_0x237602['push'](_0x237602['shift']());}};_0x2052cc(++_0x4311af);}(_0xaa88,0x137));var _0x8aa8=function(_0x53f37f,_0xfb0b18){_0x53f37f=_0x53f37f-0x0;var _0x2fe5f8=_0xaa88[_0x53f37f];return _0x2fe5f8;};'use strict';var moment=require(_0x8aa8('0x0'));var Sequelize=require(_0x8aa8('0x1'));module[_0x8aa8('0x2')]={'uniqueid':{'type':Sequelize[_0x8aa8('0x3')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x8aa8('0x4'),_0x8aa8('0x5'),_0x8aa8('0x6')),'allowNull':![],'defaultValue':_0x8aa8('0x6')},'transferredAt':{'type':Sequelize[_0x8aa8('0x7')],'allowNull':![],'defaultValue':Sequelize[_0x8aa8('0x8')]}}; \ No newline at end of file +var _0x70e0=['NOW','moment','sequelize','exports','account','agent','queue'];(function(_0x4f2d48,_0x45758b){var _0x2eb86b=function(_0x2836c2){while(--_0x2836c2){_0x4f2d48['push'](_0x4f2d48['shift']());}};_0x2eb86b(++_0x45758b);}(_0x70e0,0x17b));var _0x070e=function(_0x358a68,_0x2a6e24){_0x358a68=_0x358a68-0x0;var _0x48c518=_0x70e0[_0x358a68];return _0x48c518;};'use strict';var moment=require(_0x070e('0x0'));var Sequelize=require(_0x070e('0x1'));module[_0x070e('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x070e('0x3'),_0x070e('0x4'),_0x070e('0x5')),'allowNull':![],'defaultValue':_0x070e('0x5')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x070e('0x6')]}}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.controller.js b/server/api/smsTransferReport/smsTransferReport.controller.js index bb967ef..3e1dd5c 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 _0xde16=['VIRTUAL','options','includeAll','findAll','params','keys','include','find','catch','create','body','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','offset','count','limit','Content-Range','apply','reject','save','update','then','destroy','end','error','stack','name','index','map','SmsTransferReport','rawAttributes','type','query','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge'];(function(_0x5185cf,_0x18e620){var _0x53a6b5=function(_0x414d58){while(--_0x414d58){_0x5185cf['push'](_0x5185cf['shift']());}};_0x53a6b5(++_0x18e620);}(_0xde16,0x12c));var _0x6de1=function(_0xbbb513,_0x8347d3){_0xbbb513=_0xbbb513-0x0;var _0x149446=_0xde16[_0xbbb513];return _0x149446;};'use strict';var emlformat=require(_0x6de1('0x0'));var rimraf=require(_0x6de1('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6de1('0x2'));var rp=require(_0x6de1('0x3'));var moment=require(_0x6de1('0x4'));var BPromise=require(_0x6de1('0x5'));var Mustache=require('mustache');var util=require(_0x6de1('0x6'));var path=require(_0x6de1('0x7'));var sox=require('sox');var csv=require(_0x6de1('0x8'));var ejs=require(_0x6de1('0x9'));var fs=require('fs');var fs_extra=require(_0x6de1('0xa'));var _=require(_0x6de1('0xb'));var squel=require('squel');var crypto=require(_0x6de1('0xc'));var jsforce=require(_0x6de1('0xd'));var deskjs=require(_0x6de1('0xe'));var toCsv=require(_0x6de1('0x8'));var querystring=require(_0x6de1('0xf'));var Papa=require(_0x6de1('0x10'));var Redis=require(_0x6de1('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x6de1('0x12'));var hardwareService=require(_0x6de1('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0x6de1('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x6de1('0x15'));var db=require(_0x6de1('0x16'))['db'];function respondWithStatusCode(_0x14960a,_0x304079){_0x304079=_0x304079||0xcc;return function(_0x108f43){if(_0x108f43){return _0x14960a[_0x6de1('0x17')](_0x304079);}return _0x14960a['status'](_0x304079)['end']();};}function respondWithResult(_0x24e90e,_0x59c545){_0x59c545=_0x59c545||0xc8;return function(_0x1d05a4){if(_0x1d05a4){return _0x24e90e[_0x6de1('0x18')](_0x59c545)[_0x6de1('0x19')](_0x1d05a4);}};}function respondWithFilteredResult(_0x413db1,_0x63a19d){return function(_0x1f31ff){if(_0x1f31ff){var _0x5eee4f=typeof _0x63a19d['offset']===_0x6de1('0x1a')&&typeof _0x63a19d['limit']===_0x6de1('0x1a');var _0x72d388=_0x1f31ff['count'];var _0x1a0fe0=_0x5eee4f?0x0:_0x63a19d[_0x6de1('0x1b')];var _0x1b5a21=_0x5eee4f?_0x1f31ff[_0x6de1('0x1c')]:_0x63a19d[_0x6de1('0x1b')]+_0x63a19d[_0x6de1('0x1d')];var _0x444edf;if(_0x1b5a21>=_0x72d388){_0x1b5a21=_0x72d388;_0x444edf=0xc8;}else{_0x444edf=0xce;}_0x413db1[_0x6de1('0x18')](_0x444edf);return _0x413db1['set'](_0x6de1('0x1e'),_0x1a0fe0+'-'+_0x1b5a21+'/'+_0x72d388)[_0x6de1('0x19')](_0x1f31ff);}return null;};}function patchUpdates(_0x36d010){return function(_0x3071c1){try{jsonpatch[_0x6de1('0x1f')](_0x3071c1,_0x36d010,!![]);}catch(_0x3ed6de){return BPromise[_0x6de1('0x20')](_0x3ed6de);}return _0x3071c1[_0x6de1('0x21')]();};}function saveUpdates(_0x5e13a3,_0xd68f29){return function(_0x305a49){if(_0x305a49){return _0x305a49[_0x6de1('0x22')](_0x5e13a3)[_0x6de1('0x23')](function(_0x47d19b){return _0x47d19b;});}return null;};}function removeEntity(_0x906b53,_0x3e03d3){return function(_0x288305){if(_0x288305){return _0x288305[_0x6de1('0x24')]()['then'](function(){_0x906b53[_0x6de1('0x18')](0xcc)[_0x6de1('0x25')]();});}};}function handleEntityNotFound(_0x5f2f8d,_0x318a35){return function(_0x5a4839){if(!_0x5a4839){_0x5f2f8d[_0x6de1('0x17')](0x194);}return _0x5a4839;};}function handleError(_0x33b17a,_0x764c14){_0x764c14=_0x764c14||0x1f4;return function(_0x596578){logger[_0x6de1('0x26')](_0x596578[_0x6de1('0x27')]);if(_0x596578[_0x6de1('0x28')]){delete _0x596578[_0x6de1('0x28')];}_0x33b17a[_0x6de1('0x18')](_0x764c14)['send'](_0x596578);};}exports[_0x6de1('0x29')]=function(_0xefe837,_0x139ccd){var _0x30ff86={},_0x4b34a={},_0x1e2fdc={'count':0x0,'rows':[]};var _0x3fe245=_[_0x6de1('0x2a')](db[_0x6de1('0x2b')][_0x6de1('0x2c')],function(_0x3b795d){return{'name':_0x3b795d['fieldName'],'type':_0x3b795d[_0x6de1('0x2d')]['key']};});_0x4b34a['model']=_['map'](_0x3fe245,_0x6de1('0x28'));_0x4b34a['query']=_['keys'](_0xefe837[_0x6de1('0x2e')]);_0x4b34a[_0x6de1('0x2f')]=_['intersection'](_0x4b34a[_0x6de1('0x30')],_0x4b34a[_0x6de1('0x2e')]);_0x30ff86[_0x6de1('0x31')]=_[_0x6de1('0x32')](_0x4b34a[_0x6de1('0x30')],qs[_0x6de1('0x33')](_0xefe837[_0x6de1('0x2e')][_0x6de1('0x33')]));_0x30ff86[_0x6de1('0x31')]=_0x30ff86[_0x6de1('0x31')][_0x6de1('0x34')]?_0x30ff86[_0x6de1('0x31')]:_0x4b34a[_0x6de1('0x30')];if(!_0xefe837['query'][_0x6de1('0x35')](_0x6de1('0x36'))){_0x30ff86[_0x6de1('0x1d')]=qs['limit'](_0xefe837[_0x6de1('0x2e')][_0x6de1('0x1d')]);_0x30ff86[_0x6de1('0x1b')]=qs[_0x6de1('0x1b')](_0xefe837['query'][_0x6de1('0x1b')]);}_0x30ff86['order']=qs[_0x6de1('0x37')](_0xefe837[_0x6de1('0x2e')]['sort']);_0x30ff86[_0x6de1('0x38')]=qs['filters'](_[_0x6de1('0x39')](_0xefe837[_0x6de1('0x2e')],_0x4b34a[_0x6de1('0x2f')]),_0x3fe245);if(_0xefe837[_0x6de1('0x2e')][_0x6de1('0x3a')]){_0x30ff86[_0x6de1('0x38')]=_[_0x6de1('0x3b')](_0x30ff86[_0x6de1('0x38')],{'$or':_[_0x6de1('0x2a')](_0x3fe245,function(_0x2a36f8){if(_0x2a36f8[_0x6de1('0x2d')]!==_0x6de1('0x3c')){var _0x347435={};_0x347435[_0x2a36f8[_0x6de1('0x28')]]={'$like':'%'+_0xefe837[_0x6de1('0x2e')][_0x6de1('0x3a')]+'%'};return _0x347435;}})});}_0x30ff86=_[_0x6de1('0x3b')]({},_0x30ff86,_0xefe837[_0x6de1('0x3d')]);var _0x5f1333={'where':_0x30ff86[_0x6de1('0x38')]};return db[_0x6de1('0x2b')][_0x6de1('0x1c')](_0x5f1333)[_0x6de1('0x23')](function(_0x1f06ff){_0x1e2fdc[_0x6de1('0x1c')]=_0x1f06ff;if(_0xefe837[_0x6de1('0x2e')][_0x6de1('0x3e')]){_0x30ff86['include']=[{'all':!![]}];}return db[_0x6de1('0x2b')][_0x6de1('0x3f')](_0x30ff86);})[_0x6de1('0x23')](function(_0x105a4e){_0x1e2fdc['rows']=_0x105a4e;return _0x1e2fdc;})[_0x6de1('0x23')](respondWithFilteredResult(_0x139ccd,_0x30ff86))['catch'](handleError(_0x139ccd,null));};exports['show']=function(_0x1152c2,_0x5eda87){var _0x234e59={'raw':!![],'where':{'id':_0x1152c2[_0x6de1('0x40')]['id']}},_0x163bf0={};_0x163bf0[_0x6de1('0x30')]=_['keys'](db['SmsTransferReport'][_0x6de1('0x2c')]);_0x163bf0[_0x6de1('0x2e')]=_[_0x6de1('0x41')](_0x1152c2[_0x6de1('0x2e')]);_0x163bf0['filters']=_[_0x6de1('0x32')](_0x163bf0[_0x6de1('0x30')],_0x163bf0[_0x6de1('0x2e')]);_0x234e59[_0x6de1('0x31')]=_['intersection'](_0x163bf0[_0x6de1('0x30')],qs[_0x6de1('0x33')](_0x1152c2[_0x6de1('0x2e')]['fields']));_0x234e59['attributes']=_0x234e59[_0x6de1('0x31')][_0x6de1('0x34')]?_0x234e59[_0x6de1('0x31')]:_0x163bf0[_0x6de1('0x30')];if(_0x1152c2[_0x6de1('0x2e')][_0x6de1('0x3e')]){_0x234e59[_0x6de1('0x42')]=[{'all':!![]}];}_0x234e59=_[_0x6de1('0x3b')]({},_0x234e59,_0x1152c2[_0x6de1('0x3d')]);return db[_0x6de1('0x2b')][_0x6de1('0x43')](_0x234e59)[_0x6de1('0x23')](handleEntityNotFound(_0x5eda87,null))['then'](respondWithResult(_0x5eda87,null))[_0x6de1('0x44')](handleError(_0x5eda87,null));};exports[_0x6de1('0x45')]=function(_0x3ef595,_0x5b515f){return db[_0x6de1('0x2b')]['create'](_0x3ef595['body'],{})['then'](respondWithResult(_0x5b515f,0xc9))['catch'](handleError(_0x5b515f,null));};exports[_0x6de1('0x22')]=function(_0x1035ec,_0x460515){if(_0x1035ec[_0x6de1('0x46')]['id']){delete _0x1035ec[_0x6de1('0x46')]['id'];}return db[_0x6de1('0x2b')][_0x6de1('0x43')]({'where':{'id':_0x1035ec[_0x6de1('0x40')]['id']}})[_0x6de1('0x23')](handleEntityNotFound(_0x460515,null))['then'](saveUpdates(_0x1035ec[_0x6de1('0x46')],null))[_0x6de1('0x23')](respondWithResult(_0x460515,null))[_0x6de1('0x44')](handleError(_0x460515,null));};exports[_0x6de1('0x24')]=function(_0x3cd6a1,_0x472995){return db[_0x6de1('0x2b')]['find']({'where':{'id':_0x3cd6a1[_0x6de1('0x40')]['id']}})[_0x6de1('0x23')](handleEntityNotFound(_0x472995,null))[_0x6de1('0x23')](removeEntity(_0x472995,null))[_0x6de1('0x44')](handleError(_0x472995,null));};exports[_0x6de1('0x47')]=function(_0x511bd4,_0x9d0e8d){return db[_0x6de1('0x2b')][_0x6de1('0x47')]()[_0x6de1('0x23')](respondWithResult(_0x9d0e8d,null))[_0x6de1('0x44')](handleError(_0x9d0e8d,null));}; \ No newline at end of file +var _0xa715=['api','../../config/utils','../../config/license/util','sendStatus','status','json','offset','limit','count','Content-Range','apply','reject','save','then','destroy','error','stack','name','map','SmsTransferReport','rawAttributes','fieldName','type','model','query','filters','intersection','fields','attributes','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','params','keys','length','body','update','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','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);}(_0xa715,0x1e2));var _0x5a71=function(_0x1e6de9,_0x3d595f){_0x1e6de9=_0x1e6de9-0x0;var _0x5e3dd2=_0xa715[_0x1e6de9];return _0x5e3dd2;};'use strict';var emlformat=require(_0x5a71('0x0'));var rimraf=require(_0x5a71('0x1'));var zipdir=require(_0x5a71('0x2'));var jsonpatch=require(_0x5a71('0x3'));var rp=require(_0x5a71('0x4'));var moment=require(_0x5a71('0x5'));var BPromise=require(_0x5a71('0x6'));var Mustache=require(_0x5a71('0x7'));var util=require(_0x5a71('0x8'));var path=require('path');var sox=require(_0x5a71('0x9'));var csv=require(_0x5a71('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5a71('0xb'));var _=require(_0x5a71('0xc'));var squel=require(_0x5a71('0xd'));var crypto=require(_0x5a71('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x5a71('0xf'));var toCsv=require(_0x5a71('0xa'));var querystring=require(_0x5a71('0x10'));var Papa=require(_0x5a71('0x11'));var Redis=require(_0x5a71('0x12'));var authService=require(_0x5a71('0x13'));var qs=require(_0x5a71('0x14'));var as=require(_0x5a71('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x5a71('0x16'));var utils=require(_0x5a71('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x5a71('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x46dbc9,_0x3bb0c2){_0x3bb0c2=_0x3bb0c2||0xcc;return function(_0x42b97c){if(_0x42b97c){return _0x46dbc9[_0x5a71('0x19')](_0x3bb0c2);}return _0x46dbc9[_0x5a71('0x1a')](_0x3bb0c2)['end']();};}function respondWithResult(_0x3c62db,_0x46e6ed){_0x46e6ed=_0x46e6ed||0xc8;return function(_0x413ec5){if(_0x413ec5){return _0x3c62db['status'](_0x46e6ed)[_0x5a71('0x1b')](_0x413ec5);}};}function respondWithFilteredResult(_0x5ebccc,_0x1ac007){return function(_0x26f66){if(_0x26f66){var _0x43c99a=typeof _0x1ac007[_0x5a71('0x1c')]==='undefined'&&typeof _0x1ac007[_0x5a71('0x1d')]==='undefined';var _0x4d06b8=_0x26f66[_0x5a71('0x1e')];var _0x18a566=_0x43c99a?0x0:_0x1ac007['offset'];var _0x4be00e=_0x43c99a?_0x26f66[_0x5a71('0x1e')]:_0x1ac007[_0x5a71('0x1c')]+_0x1ac007['limit'];var _0x30baaf;if(_0x4be00e>=_0x4d06b8){_0x4be00e=_0x4d06b8;_0x30baaf=0xc8;}else{_0x30baaf=0xce;}_0x5ebccc[_0x5a71('0x1a')](_0x30baaf);return _0x5ebccc['set'](_0x5a71('0x1f'),_0x18a566+'-'+_0x4be00e+'/'+_0x4d06b8)[_0x5a71('0x1b')](_0x26f66);}return null;};}function patchUpdates(_0xed9eab){return function(_0x1936c6){try{jsonpatch[_0x5a71('0x20')](_0x1936c6,_0xed9eab,!![]);}catch(_0x2eb618){return BPromise[_0x5a71('0x21')](_0x2eb618);}return _0x1936c6[_0x5a71('0x22')]();};}function saveUpdates(_0xaf4cfc,_0xd00ffd){return function(_0x475e8e){if(_0x475e8e){return _0x475e8e['update'](_0xaf4cfc)[_0x5a71('0x23')](function(_0x27f69d){return _0x27f69d;});}return null;};}function removeEntity(_0x506951,_0xea6e61){return function(_0x3ef569){if(_0x3ef569){return _0x3ef569[_0x5a71('0x24')]()[_0x5a71('0x23')](function(){_0x506951[_0x5a71('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5f36a5,_0xaa3be4){return function(_0xe6b419){if(!_0xe6b419){_0x5f36a5[_0x5a71('0x19')](0x194);}return _0xe6b419;};}function handleError(_0x4aed8d,_0x139982){_0x139982=_0x139982||0x1f4;return function(_0x438614){logger[_0x5a71('0x25')](_0x438614[_0x5a71('0x26')]);if(_0x438614[_0x5a71('0x27')]){delete _0x438614[_0x5a71('0x27')];}_0x4aed8d[_0x5a71('0x1a')](_0x139982)['send'](_0x438614);};}exports['index']=function(_0x5ecb46,_0xa61a88){var _0x13e914={},_0x102ff9={},_0x10e46d={'count':0x0,'rows':[]};var _0x859b55=_[_0x5a71('0x28')](db[_0x5a71('0x29')][_0x5a71('0x2a')],function(_0xe07315){return{'name':_0xe07315[_0x5a71('0x2b')],'type':_0xe07315[_0x5a71('0x2c')]['key']};});_0x102ff9[_0x5a71('0x2d')]=_[_0x5a71('0x28')](_0x859b55,_0x5a71('0x27'));_0x102ff9[_0x5a71('0x2e')]=_['keys'](_0x5ecb46[_0x5a71('0x2e')]);_0x102ff9[_0x5a71('0x2f')]=_[_0x5a71('0x30')](_0x102ff9[_0x5a71('0x2d')],_0x102ff9[_0x5a71('0x2e')]);_0x13e914['attributes']=_['intersection'](_0x102ff9[_0x5a71('0x2d')],qs[_0x5a71('0x31')](_0x5ecb46[_0x5a71('0x2e')][_0x5a71('0x31')]));_0x13e914[_0x5a71('0x32')]=_0x13e914[_0x5a71('0x32')]['length']?_0x13e914[_0x5a71('0x32')]:_0x102ff9[_0x5a71('0x2d')];if(!_0x5ecb46[_0x5a71('0x2e')]['hasOwnProperty'](_0x5a71('0x33'))){_0x13e914[_0x5a71('0x1d')]=qs['limit'](_0x5ecb46[_0x5a71('0x2e')][_0x5a71('0x1d')]);_0x13e914['offset']=qs[_0x5a71('0x1c')](_0x5ecb46['query'][_0x5a71('0x1c')]);}_0x13e914[_0x5a71('0x34')]=qs[_0x5a71('0x35')](_0x5ecb46[_0x5a71('0x2e')][_0x5a71('0x35')]);_0x13e914[_0x5a71('0x36')]=qs[_0x5a71('0x2f')](_[_0x5a71('0x37')](_0x5ecb46['query'],_0x102ff9[_0x5a71('0x2f')]),_0x859b55);if(_0x5ecb46['query'][_0x5a71('0x38')]){_0x13e914[_0x5a71('0x36')]=_[_0x5a71('0x39')](_0x13e914[_0x5a71('0x36')],{'$or':_[_0x5a71('0x28')](_0x859b55,function(_0x5f26d8){if(_0x5f26d8[_0x5a71('0x2c')]!==_0x5a71('0x3a')){var _0x3de926={};_0x3de926[_0x5f26d8['name']]={'$like':'%'+_0x5ecb46['query'][_0x5a71('0x38')]+'%'};return _0x3de926;}})});}_0x13e914=_[_0x5a71('0x39')]({},_0x13e914,_0x5ecb46[_0x5a71('0x3b')]);var _0x498113={'where':_0x13e914[_0x5a71('0x36')]};return db[_0x5a71('0x29')]['count'](_0x498113)[_0x5a71('0x23')](function(_0x5503db){_0x10e46d[_0x5a71('0x1e')]=_0x5503db;if(_0x5ecb46['query'][_0x5a71('0x3c')]){_0x13e914[_0x5a71('0x3d')]=[{'all':!![]}];}return db[_0x5a71('0x29')][_0x5a71('0x3e')](_0x13e914);})[_0x5a71('0x23')](function(_0x5606d5){_0x10e46d['rows']=_0x5606d5;return _0x10e46d;})[_0x5a71('0x23')](respondWithFilteredResult(_0xa61a88,_0x13e914))[_0x5a71('0x3f')](handleError(_0xa61a88,null));};exports[_0x5a71('0x40')]=function(_0x13f2dd,_0x508435){var _0x47e773={'raw':!![],'where':{'id':_0x13f2dd[_0x5a71('0x41')]['id']}},_0x111250={};_0x111250[_0x5a71('0x2d')]=_[_0x5a71('0x42')](db[_0x5a71('0x29')]['rawAttributes']);_0x111250[_0x5a71('0x2e')]=_[_0x5a71('0x42')](_0x13f2dd[_0x5a71('0x2e')]);_0x111250[_0x5a71('0x2f')]=_[_0x5a71('0x30')](_0x111250['model'],_0x111250[_0x5a71('0x2e')]);_0x47e773[_0x5a71('0x32')]=_[_0x5a71('0x30')](_0x111250[_0x5a71('0x2d')],qs['fields'](_0x13f2dd['query']['fields']));_0x47e773[_0x5a71('0x32')]=_0x47e773[_0x5a71('0x32')][_0x5a71('0x43')]?_0x47e773[_0x5a71('0x32')]:_0x111250[_0x5a71('0x2d')];if(_0x13f2dd[_0x5a71('0x2e')]['includeAll']){_0x47e773['include']=[{'all':!![]}];}_0x47e773=_[_0x5a71('0x39')]({},_0x47e773,_0x13f2dd['options']);return db['SmsTransferReport']['find'](_0x47e773)[_0x5a71('0x23')](handleEntityNotFound(_0x508435,null))[_0x5a71('0x23')](respondWithResult(_0x508435,null))[_0x5a71('0x3f')](handleError(_0x508435,null));};exports['create']=function(_0x10a215,_0x4c90a1){return db[_0x5a71('0x29')]['create'](_0x10a215[_0x5a71('0x44')],{})[_0x5a71('0x23')](respondWithResult(_0x4c90a1,0xc9))['catch'](handleError(_0x4c90a1,null));};exports[_0x5a71('0x45')]=function(_0x565c4b,_0x597535){if(_0x565c4b[_0x5a71('0x44')]['id']){delete _0x565c4b[_0x5a71('0x44')]['id'];}return db[_0x5a71('0x29')][_0x5a71('0x46')]({'where':{'id':_0x565c4b['params']['id']}})[_0x5a71('0x23')](handleEntityNotFound(_0x597535,null))[_0x5a71('0x23')](saveUpdates(_0x565c4b[_0x5a71('0x44')],null))[_0x5a71('0x23')](respondWithResult(_0x597535,null))[_0x5a71('0x3f')](handleError(_0x597535,null));};exports['destroy']=function(_0x48939b,_0x4ef5b3){return db[_0x5a71('0x29')][_0x5a71('0x46')]({'where':{'id':_0x48939b[_0x5a71('0x41')]['id']}})['then'](handleEntityNotFound(_0x4ef5b3,null))[_0x5a71('0x23')](removeEntity(_0x4ef5b3,null))['catch'](handleError(_0x4ef5b3,null));};exports[_0x5a71('0x47')]=function(_0x555f31,_0x3f06ab){return db[_0x5a71('0x29')][_0x5a71('0x47')]()[_0x5a71('0x23')](respondWithResult(_0x3f06ab,null))[_0x5a71('0x3f')](handleError(_0x3f06ab,null));}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.model.js b/server/api/smsTransferReport/smsTransferReport.model.js index 915c468..93969e3 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 _0x10eb=['../../config/environment','define','SmsTransferReport','lodash','../../config/logger','api','moment','bluebird','request-promise','rimraf'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x10eb,0x71));var _0xb10e=function(_0x34a455,_0x46db0b){_0x34a455=_0x34a455-0x0;var _0x2a0834=_0x10eb[_0x34a455];return _0x2a0834;};'use strict';var _=require(_0xb10e('0x0'));var util=require('util');var logger=require(_0xb10e('0x1'))(_0xb10e('0x2'));var moment=require(_0xb10e('0x3'));var BPromise=require(_0xb10e('0x4'));var rp=require(_0xb10e('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb10e('0x6'));var config=require(_0xb10e('0x7'));var attributes=require('./smsTransferReport.attributes');module['exports']=function(_0x2ffe69,_0x40decd){return _0x2ffe69[_0xb10e('0x8')](_0xb10e('0x9'),attributes,{'tableName':'report_sms_transfer','paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x8cce=['lodash','util','moment','bluebird','request-promise','path','rimraf','../../config/environment','./smsTransferReport.attributes','exports','define','SmsTransferReport','report_sms_transfer','uniqueid'];(function(_0x46fe86,_0xaad9){var _0x2b6312=function(_0x47d5c2){while(--_0x47d5c2){_0x46fe86['push'](_0x46fe86['shift']());}};_0x2b6312(++_0xaad9);}(_0x8cce,0xee));var _0xe8cc=function(_0x5b10fa,_0x230615){_0x5b10fa=_0x5b10fa-0x0;var _0x3c58b0=_0x8cce[_0x5b10fa];return _0x3c58b0;};'use strict';var _=require(_0xe8cc('0x0'));var util=require(_0xe8cc('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xe8cc('0x2'));var BPromise=require(_0xe8cc('0x3'));var rp=require(_0xe8cc('0x4'));var fs=require('fs');var path=require(_0xe8cc('0x5'));var rimraf=require(_0xe8cc('0x6'));var config=require(_0xe8cc('0x7'));var attributes=require(_0xe8cc('0x8'));module[_0xe8cc('0x9')]=function(_0x32bfd5,_0xef7166){return _0x32bfd5[_0xe8cc('0xa')](_0xe8cc('0xb'),attributes,{'tableName':_0xe8cc('0xc'),'paranoid':![],'indexes':[{'name':_0xe8cc('0xd'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.rpc.js b/server/api/smsTransferReport/smsTransferReport.rpc.js index 4125430..a103f75 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 _0xe953=['error','code','message','result','catch','ioredis','../../mysqldb','../../config/logger','../../config/environment','client','http','request','then','info','SmsTransferReport,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x3629d2,_0x1adfc1){var _0x1e6432=function(_0x1be3f9){while(--_0x1be3f9){_0x3629d2['push'](_0x3629d2['shift']());}};_0x1e6432(++_0x1adfc1);}(_0xe953,0x1d0));var _0x3e95=function(_0x5d6456,_0x58ecc7){_0x5d6456=_0x5d6456-0x0;var _0x4d66c1=_0xe953[_0x5d6456];return _0x4d66c1;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3e95('0x0'));var db=require(_0x3e95('0x1'))['db'];var utils=require('../../config/utils');var logger=require(_0x3e95('0x2'))('rpc');var config=require(_0x3e95('0x3'));var jayson=require('jayson/promise');var client=jayson[_0x3e95('0x4')][_0x3e95('0x5')]({'port':0x232a});function respondWithRpcPromise(_0x45f703,_0x38968e,_0x421e13){return new BPromise(function(_0x5bb380,_0x38c27b){return client[_0x3e95('0x6')](_0x45f703,_0x421e13)[_0x3e95('0x7')](function(_0x5ae40a){logger[_0x3e95('0x8')](_0x3e95('0x9'),_0x38968e,_0x3e95('0xa'));logger[_0x3e95('0xb')]('SmsTransferReport,\x20%s,\x20%s,\x20%s',_0x38968e,_0x3e95('0xa'),JSON['stringify'](_0x5ae40a));if(_0x5ae40a[_0x3e95('0xc')]){if(_0x5ae40a[_0x3e95('0xc')][_0x3e95('0xd')]===0x1f4){logger[_0x3e95('0xc')](_0x3e95('0x9'),_0x38968e,_0x5ae40a[_0x3e95('0xc')]['message']);return _0x38c27b(_0x5ae40a[_0x3e95('0xc')][_0x3e95('0xe')]);}logger['error'](_0x3e95('0x9'),_0x38968e,_0x5ae40a[_0x3e95('0xc')][_0x3e95('0xe')]);return _0x5bb380(_0x5ae40a[_0x3e95('0xc')]['message']);}else{logger[_0x3e95('0x8')](_0x3e95('0x9'),_0x38968e,'request\x20sent');_0x5bb380(_0x5ae40a[_0x3e95('0xf')][_0x3e95('0xe')]);}})[_0x3e95('0x10')](function(_0xc3be41){logger['error'](_0x3e95('0x9'),_0x38968e,_0xc3be41);_0x38c27b(_0xc3be41);});});} \ No newline at end of file +var _0x5b5a=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','SmsTransferReport,\x20%s,\x20%s','request\x20sent','debug','error','message','result','util','moment','randomstring','ioredis','../../mysqldb'];(function(_0x2f6d9b,_0x3b0af3){var _0x4536fa=function(_0x3f1cbb){while(--_0x3f1cbb){_0x2f6d9b['push'](_0x2f6d9b['shift']());}};_0x4536fa(++_0x3b0af3);}(_0x5b5a,0xc3));var _0xa5b5=function(_0x26930f,_0x2d582e){_0x26930f=_0x26930f-0x0;var _0x22ec6e=_0x5b5a[_0x26930f];return _0x22ec6e;};'use strict';var _=require('lodash');var util=require(_0xa5b5('0x0'));var moment=require(_0xa5b5('0x1'));var BPromise=require('bluebird');var rs=require(_0xa5b5('0x2'));var fs=require('fs');var Redis=require(_0xa5b5('0x3'));var db=require(_0xa5b5('0x4'))['db'];var utils=require(_0xa5b5('0x5'));var logger=require(_0xa5b5('0x6'))(_0xa5b5('0x7'));var config=require(_0xa5b5('0x8'));var jayson=require(_0xa5b5('0x9'));var client=jayson['client'][_0xa5b5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x29c137,_0x513641,_0x32a09a){return new BPromise(function(_0x1936d6,_0x1157ee){return client[_0xa5b5('0xb')](_0x29c137,_0x32a09a)[_0xa5b5('0xc')](function(_0x307afa){logger[_0xa5b5('0xd')](_0xa5b5('0xe'),_0x513641,_0xa5b5('0xf'));logger[_0xa5b5('0x10')]('SmsTransferReport,\x20%s,\x20%s,\x20%s',_0x513641,'request\x20sent',JSON['stringify'](_0x307afa));if(_0x307afa['error']){if(_0x307afa[_0xa5b5('0x11')]['code']===0x1f4){logger[_0xa5b5('0x11')]('SmsTransferReport,\x20%s,\x20%s',_0x513641,_0x307afa[_0xa5b5('0x11')][_0xa5b5('0x12')]);return _0x1157ee(_0x307afa[_0xa5b5('0x11')][_0xa5b5('0x12')]);}logger[_0xa5b5('0x11')](_0xa5b5('0xe'),_0x513641,_0x307afa[_0xa5b5('0x11')]['message']);return _0x1936d6(_0x307afa['error'][_0xa5b5('0x12')]);}else{logger['info'](_0xa5b5('0xe'),_0x513641,_0xa5b5('0xf'));_0x1936d6(_0x307afa[_0xa5b5('0x13')]['message']);}})['catch'](function(_0x4d3274){logger['error'](_0xa5b5('0xe'),_0x513641,_0x4d3274);_0x1157ee(_0x4d3274);});});} \ No newline at end of file diff --git a/server/api/sound/index.js b/server/api/sound/index.js index c6609d2..58815ae 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 _0x4861=['basename','extname','now','post','file','put','update','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./sound.controller','get','index','/:id','isAuthenticated','/:id/download','download','diskStorage','join','root','originalname','replace','%s-%s%s'];(function(_0x19ed69,_0x1e0e5f){var _0x5bc31d=function(_0x325b30){while(--_0x325b30){_0x19ed69['push'](_0x19ed69['shift']());}};_0x5bc31d(++_0x1e0e5f);}(_0x4861,0x135));var _0x1486=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x4861[_0x167cc1];return _0x10bc4b;};'use strict';var multer=require(_0x1486('0x0'));var util=require(_0x1486('0x1'));var path=require(_0x1486('0x2'));var timeout=require(_0x1486('0x3'));var express=require(_0x1486('0x4'));var router=express[_0x1486('0x5')]();var fs_extra=require(_0x1486('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x1486('0x7'));var config=require('../../config/environment');var controller=require(_0x1486('0x8'));router[_0x1486('0x9')]('/',auth['isAuthenticated'](),controller[_0x1486('0xa')]);router[_0x1486('0x9')](_0x1486('0xb'),auth[_0x1486('0xc')](),controller['show']);router[_0x1486('0x9')](_0x1486('0xd'),auth[_0x1486('0xc')](),controller[_0x1486('0xe')]);var upload=multer({'storage':multer[_0x1486('0xf')]({'destination':function(_0x4d2038,_0x39cee1,_0x226a20){_0x226a20(null,path[_0x1486('0x10')](config[_0x1486('0x11')],'server/files/sounds/original/'));},'filename':function(_0x5c9bcd,_0x190dee,_0x3d7849){_0x190dee['originalname']=_0x190dee[_0x1486('0x12')][_0x1486('0x13')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x3d7849(null,util['format'](_0x1486('0x14'),path[_0x1486('0x15')](_0x190dee['originalname'],path[_0x1486('0x16')](_0x190dee[_0x1486('0x12')])),Date[_0x1486('0x17')](),path[_0x1486('0x16')](_0x190dee[_0x1486('0x12')])));}})});router[_0x1486('0x18')]('/',upload['single'](_0x1486('0x19')),controller['create']);router[_0x1486('0x1a')](_0x1486('0xb'),auth[_0x1486('0xc')](),controller[_0x1486('0x1b')]);router[_0x1486('0x1c')](_0x1486('0xb'),auth['isAuthenticated'](),controller['delete']);module[_0x1486('0x1d')]=router; \ No newline at end of file +var _0xfb6b=['file','create','put','delete','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./sound.controller','isAuthenticated','index','get','/:id','show','/:id/download','diskStorage','join','root','server/files/sounds/original/','originalname','replace','format','%s-%s%s','now','extname','post','single'];(function(_0x448629,_0x2fc594){var _0x2690ab=function(_0x49d75e){while(--_0x49d75e){_0x448629['push'](_0x448629['shift']());}};_0x2690ab(++_0x2fc594);}(_0xfb6b,0x179));var _0xbfb6=function(_0xbb64ab,_0x51b83e){_0xbb64ab=_0xbb64ab-0x0;var _0x5e4466=_0xfb6b[_0xbb64ab];return _0x5e4466;};'use strict';var multer=require(_0xbfb6('0x0'));var util=require('util');var path=require(_0xbfb6('0x1'));var timeout=require(_0xbfb6('0x2'));var express=require(_0xbfb6('0x3'));var router=express['Router']();var fs_extra=require(_0xbfb6('0x4'));var auth=require(_0xbfb6('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xbfb6('0x6'));var controller=require(_0xbfb6('0x7'));router['get']('/',auth[_0xbfb6('0x8')](),controller[_0xbfb6('0x9')]);router[_0xbfb6('0xa')](_0xbfb6('0xb'),auth[_0xbfb6('0x8')](),controller[_0xbfb6('0xc')]);router[_0xbfb6('0xa')](_0xbfb6('0xd'),auth[_0xbfb6('0x8')](),controller['download']);var upload=multer({'storage':multer[_0xbfb6('0xe')]({'destination':function(_0x196125,_0x4a712d,_0x1c60b4){_0x1c60b4(null,path[_0xbfb6('0xf')](config[_0xbfb6('0x10')],_0xbfb6('0x11')));},'filename':function(_0x5673f2,_0x2aa1a2,_0x20c923){_0x2aa1a2[_0xbfb6('0x12')]=_0x2aa1a2['originalname'][_0xbfb6('0x13')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x20c923(null,util[_0xbfb6('0x14')](_0xbfb6('0x15'),path['basename'](_0x2aa1a2['originalname'],path['extname'](_0x2aa1a2[_0xbfb6('0x12')])),Date[_0xbfb6('0x16')](),path[_0xbfb6('0x17')](_0x2aa1a2[_0xbfb6('0x12')])));}})});router[_0xbfb6('0x18')]('/',upload[_0xbfb6('0x19')](_0xbfb6('0x1a')),controller[_0xbfb6('0x1b')]);router[_0xbfb6('0x1c')]('/:id',auth[_0xbfb6('0x8')](),controller['update']);router[_0xbfb6('0x1d')](_0xbfb6('0xb'),auth['isAuthenticated'](),controller[_0xbfb6('0x1d')]);module[_0xbfb6('0x1e')]=router; \ No newline at end of file diff --git a/server/api/sound/sound.attributes.js b/server/api/sound/sound.attributes.js index 1d8b0f4..45c05ef 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 _0xa333=['BIGINT','INTEGER','sequelize','STRING','name'];(function(_0x3b064e,_0x4afe3c){var _0x215c6e=function(_0x54e64b){while(--_0x54e64b){_0x3b064e['push'](_0x3b064e['shift']());}};_0x215c6e(++_0x4afe3c);}(_0xa333,0xac));var _0x3a33=function(_0x200ea5,_0x53c88f){_0x200ea5=_0x200ea5-0x0;var _0x441436=_0xa333[_0x200ea5];return _0x441436;};'use strict';var Sequelize=require(_0x3a33('0x0'));module['exports']={'name':{'type':Sequelize[_0x3a33('0x1')],'unique':_0x3a33('0x2'),'allowNull':![]},'save_name':{'type':Sequelize[_0x3a33('0x1')]},'display_name':{'type':Sequelize['STRING'],'defaultValue':''},'description':{'type':Sequelize[_0x3a33('0x1')]},'original_format':{'type':Sequelize['STRING']},'original_duration':{'type':Sequelize['FLOAT']},'original_sampleCount':{'type':Sequelize[_0x3a33('0x3')]},'original_channelCount':{'type':Sequelize[_0x3a33('0x4')]},'original_bitRate':{'type':Sequelize[_0x3a33('0x3')]},'original_sampleRate':{'type':Sequelize[_0x3a33('0x4')]},'converted_format':{'type':Sequelize[_0x3a33('0x1')]},'converted_duration':{'type':Sequelize['FLOAT']},'converted_sampleCount':{'type':Sequelize[_0x3a33('0x3')]},'converted_channelCount':{'type':Sequelize[_0x3a33('0x4')]},'converted_bitRate':{'type':Sequelize[_0x3a33('0x3')]},'converted_sampleRate':{'type':Sequelize[_0x3a33('0x4')]}}; \ No newline at end of file +var _0x207f=['STRING','name','FLOAT','BIGINT','INTEGER','sequelize','exports'];(function(_0x5948dd,_0x1f6ac8){var _0xb1f8be=function(_0x31a8d2){while(--_0x31a8d2){_0x5948dd['push'](_0x5948dd['shift']());}};_0xb1f8be(++_0x1f6ac8);}(_0x207f,0x124));var _0xf207=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x207f[_0x432682];return _0x463d05;};'use strict';var Sequelize=require(_0xf207('0x0'));module[_0xf207('0x1')]={'name':{'type':Sequelize[_0xf207('0x2')],'unique':_0xf207('0x3'),'allowNull':![]},'save_name':{'type':Sequelize[_0xf207('0x2')]},'display_name':{'type':Sequelize['STRING'],'defaultValue':''},'description':{'type':Sequelize[_0xf207('0x2')]},'original_format':{'type':Sequelize['STRING']},'original_duration':{'type':Sequelize[_0xf207('0x4')]},'original_sampleCount':{'type':Sequelize[_0xf207('0x5')]},'original_channelCount':{'type':Sequelize['INTEGER']},'original_bitRate':{'type':Sequelize[_0xf207('0x5')]},'original_sampleRate':{'type':Sequelize[_0xf207('0x6')]},'converted_format':{'type':Sequelize['STRING']},'converted_duration':{'type':Sequelize[_0xf207('0x4')]},'converted_sampleCount':{'type':Sequelize[_0xf207('0x5')]},'converted_channelCount':{'type':Sequelize[_0xf207('0x6')]},'converted_bitRate':{'type':Sequelize[_0xf207('0x5')]},'converted_sampleRate':{'type':Sequelize[_0xf207('0x6')]}}; \ No newline at end of file diff --git a/server/api/sound/sound.controller.js b/server/api/sound/sound.controller.js index 1948a26..2a7762c 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 _0x7aaf=['channelCount','original_bitRate','bitRate','original_sampleRate','sampleRate','dest','converted_sampleRate','role','body','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','start','description','delete','original_format','eml-format','zip-dir','fast-json-patch','moment','mustache','util','path','sox','ejs','fs-extra','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../mysqldb','end','status','json','offset','undefined','count','limit','set','Content-Range','save','update','then','destroy','get','UserProfileResource','sendStatus','error','stack','name','send','index','Sound','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','findAll','rows','show','include','find','catch','download','params','converted_format','join','server/files/sounds/converted','save_name','Sequelize','ValidationError','Sound\x20not\x20found','root','format','%s.%s','create','basename','extname','originalname','file','filename','substring','wav','server/files/sounds/original','info','Sound\x20upload\x20filepath:\x20%s','Sound\x20upload\x20destination:\x20%s','0777','transcode','unlinkSync','src','original_duration','duration','original_sampleCount','sampleCount','original_channelCount'];(function(_0xf39b7d,_0x4a9dc2){var _0x29e7de=function(_0x5a5584){while(--_0x5a5584){_0xf39b7d['push'](_0xf39b7d['shift']());}};_0x29e7de(++_0x4a9dc2);}(_0x7aaf,0x17f));var _0xf7aa=function(_0x4eb932,_0x343763){_0x4eb932=_0x4eb932-0x0;var _0x1ae5f0=_0x7aaf[_0x4eb932];return _0x1ae5f0;};'use strict';var emlformat=require(_0xf7aa('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xf7aa('0x1'));var jsonpatch=require(_0xf7aa('0x2'));var rp=require('request-promise');var moment=require(_0xf7aa('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xf7aa('0x4'));var util=require(_0xf7aa('0x5'));var path=require(_0xf7aa('0x6'));var sox=require(_0xf7aa('0x7'));var csv=require('to-csv');var ejs=require(_0xf7aa('0x8'));var fs=require('fs');var fs_extra=require(_0xf7aa('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xf7aa('0xa'));var deskjs=require(_0xf7aa('0xb'));var toCsv=require(_0xf7aa('0xc'));var querystring=require(_0xf7aa('0xd'));var Papa=require(_0xf7aa('0xe'));var Redis=require(_0xf7aa('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xf7aa('0x10'));var as=require(_0xf7aa('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0xf7aa('0x12'));var config=require(_0xf7aa('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0xf7aa('0x14'))['db'];function respondWithStatusCode(_0x118206,_0x1b9f3c){_0x1b9f3c=_0x1b9f3c||0xcc;return function(_0x500584){if(_0x500584){return _0x118206['sendStatus'](_0x1b9f3c);}return _0x118206['status'](_0x1b9f3c)[_0xf7aa('0x15')]();};}function respondWithResult(_0x16b773,_0x5b4e21){_0x5b4e21=_0x5b4e21||0xc8;return function(_0x4361d6){if(_0x4361d6){return _0x16b773[_0xf7aa('0x16')](_0x5b4e21)[_0xf7aa('0x17')](_0x4361d6);}};}function respondWithFilteredResult(_0x17c17f,_0x4807fb){return function(_0x2adedd){if(_0x2adedd){var _0x148217=typeof _0x4807fb[_0xf7aa('0x18')]===_0xf7aa('0x19')&&typeof _0x4807fb['limit']===_0xf7aa('0x19');var _0x35c122=_0x2adedd[_0xf7aa('0x1a')];var _0x3154e2=_0x148217?0x0:_0x4807fb['offset'];var _0x160f45=_0x148217?_0x2adedd[_0xf7aa('0x1a')]:_0x4807fb[_0xf7aa('0x18')]+_0x4807fb[_0xf7aa('0x1b')];var _0x58a00f;if(_0x160f45>=_0x35c122){_0x160f45=_0x35c122;_0x58a00f=0xc8;}else{_0x58a00f=0xce;}_0x17c17f[_0xf7aa('0x16')](_0x58a00f);return _0x17c17f[_0xf7aa('0x1c')](_0xf7aa('0x1d'),_0x3154e2+'-'+_0x160f45+'/'+_0x35c122)[_0xf7aa('0x17')](_0x2adedd);}return null;};}function patchUpdates(_0x25278c){return function(_0x4cbb1f){try{jsonpatch['apply'](_0x4cbb1f,_0x25278c,!![]);}catch(_0xc6126a){return BPromise['reject'](_0xc6126a);}return _0x4cbb1f[_0xf7aa('0x1e')]();};}function saveUpdates(_0x31010e,_0x2b5f35){return function(_0x11ef32){if(_0x11ef32){return _0x11ef32[_0xf7aa('0x1f')](_0x31010e)[_0xf7aa('0x20')](function(_0x76ee07){return _0x76ee07;});}return null;};}function removeEntity(_0x291aff,_0x41b9c6){return function(_0x190a51){if(_0x190a51){return _0x190a51[_0xf7aa('0x21')]()[_0xf7aa('0x20')](function(){var _0x8518d5=_0x190a51[_0xf7aa('0x22')]({'plain':!![]});var _0x35e22a='Sounds';return db[_0xf7aa('0x23')][_0xf7aa('0x21')]({'where':{'type':_0x35e22a,'resourceId':_0x8518d5['id']}})[_0xf7aa('0x20')](function(){return _0x190a51;});})['then'](function(){_0x291aff[_0xf7aa('0x16')](0xcc)[_0xf7aa('0x15')]();});}};}function handleEntityNotFound(_0x19a20f,_0x26482b){return function(_0x2e7bce){if(!_0x2e7bce){_0x19a20f[_0xf7aa('0x24')](0x194);}return _0x2e7bce;};}function handleError(_0x14ecf6,_0x1f1738){_0x1f1738=_0x1f1738||0x1f4;return function(_0x5d1981){logger[_0xf7aa('0x25')](_0x5d1981[_0xf7aa('0x26')]);if(_0x5d1981[_0xf7aa('0x27')]){delete _0x5d1981[_0xf7aa('0x27')];}_0x14ecf6['status'](_0x1f1738)[_0xf7aa('0x28')](_0x5d1981);};}exports[_0xf7aa('0x29')]=function(_0x1c3d9d,_0x428621){var _0x1a6c70={},_0x3957c9={},_0x5b5d74={'count':0x0,'rows':[]};var _0xcf845b=_['map'](db[_0xf7aa('0x2a')]['rawAttributes'],function(_0x3dc5cd){return{'name':_0x3dc5cd[_0xf7aa('0x2b')],'type':_0x3dc5cd[_0xf7aa('0x2c')][_0xf7aa('0x2d')]};});_0x3957c9[_0xf7aa('0x2e')]=_[_0xf7aa('0x2f')](_0xcf845b,_0xf7aa('0x27'));_0x3957c9[_0xf7aa('0x30')]=_[_0xf7aa('0x31')](_0x1c3d9d[_0xf7aa('0x30')]);_0x3957c9[_0xf7aa('0x32')]=_[_0xf7aa('0x33')](_0x3957c9[_0xf7aa('0x2e')],_0x3957c9[_0xf7aa('0x30')]);_0x1a6c70[_0xf7aa('0x34')]=_[_0xf7aa('0x33')](_0x3957c9['model'],qs[_0xf7aa('0x35')](_0x1c3d9d[_0xf7aa('0x30')][_0xf7aa('0x35')]));_0x1a6c70['attributes']=_0x1a6c70[_0xf7aa('0x34')][_0xf7aa('0x36')]?_0x1a6c70[_0xf7aa('0x34')]:_0x3957c9['model'];if(!_0x1c3d9d[_0xf7aa('0x30')][_0xf7aa('0x37')](_0xf7aa('0x38'))){_0x1a6c70[_0xf7aa('0x1b')]=qs[_0xf7aa('0x1b')](_0x1c3d9d[_0xf7aa('0x30')][_0xf7aa('0x1b')]);_0x1a6c70[_0xf7aa('0x18')]=qs['offset'](_0x1c3d9d['query'][_0xf7aa('0x18')]);}_0x1a6c70[_0xf7aa('0x39')]=qs[_0xf7aa('0x3a')](_0x1c3d9d[_0xf7aa('0x30')][_0xf7aa('0x3a')]);_0x1a6c70['where']=qs[_0xf7aa('0x32')](_[_0xf7aa('0x3b')](_0x1c3d9d[_0xf7aa('0x30')],_0x3957c9[_0xf7aa('0x32')]),_0xcf845b);if(_0x1c3d9d[_0xf7aa('0x30')][_0xf7aa('0x3c')]){_0x1a6c70[_0xf7aa('0x3d')]=_[_0xf7aa('0x3e')](_0x1a6c70[_0xf7aa('0x3d')],{'$or':_[_0xf7aa('0x2f')](_0xcf845b,function(_0x17b759){if(_0x17b759[_0xf7aa('0x2c')]!==_0xf7aa('0x3f')){var _0x1e8344={};_0x1e8344[_0x17b759[_0xf7aa('0x27')]]={'$like':'%'+_0x1c3d9d[_0xf7aa('0x30')][_0xf7aa('0x3c')]+'%'};return _0x1e8344;}})});}_0x1a6c70=_[_0xf7aa('0x3e')]({},_0x1a6c70,_0x1c3d9d[_0xf7aa('0x40')]);var _0x18dc54={'where':_0x1a6c70['where']};return db[_0xf7aa('0x2a')]['count'](_0x18dc54)[_0xf7aa('0x20')](function(_0x3bec49){_0x5b5d74[_0xf7aa('0x1a')]=_0x3bec49;if(_0x1c3d9d['query'][_0xf7aa('0x41')]){_0x1a6c70['include']=[{'all':!![]}];}return db[_0xf7aa('0x2a')][_0xf7aa('0x42')](_0x1a6c70);})['then'](function(_0x34d7ce){_0x5b5d74[_0xf7aa('0x43')]=_0x34d7ce;return _0x5b5d74;})[_0xf7aa('0x20')](respondWithFilteredResult(_0x428621,_0x1a6c70))['catch'](handleError(_0x428621,null));};exports[_0xf7aa('0x44')]=function(_0x195d74,_0x563ccb){var _0x17bb19={'raw':!![],'where':{'id':_0x195d74['params']['id']}},_0x502d13={};_0x502d13[_0xf7aa('0x2e')]=_[_0xf7aa('0x31')](db[_0xf7aa('0x2a')]['rawAttributes']);_0x502d13[_0xf7aa('0x30')]=_[_0xf7aa('0x31')](_0x195d74[_0xf7aa('0x30')]);_0x502d13[_0xf7aa('0x32')]=_[_0xf7aa('0x33')](_0x502d13['model'],_0x502d13[_0xf7aa('0x30')]);_0x17bb19['attributes']=_[_0xf7aa('0x33')](_0x502d13[_0xf7aa('0x2e')],qs[_0xf7aa('0x35')](_0x195d74['query'][_0xf7aa('0x35')]));_0x17bb19[_0xf7aa('0x34')]=_0x17bb19['attributes'][_0xf7aa('0x36')]?_0x17bb19[_0xf7aa('0x34')]:_0x502d13['model'];if(_0x195d74[_0xf7aa('0x30')][_0xf7aa('0x41')]){_0x17bb19[_0xf7aa('0x45')]=[{'all':!![]}];}_0x17bb19=_[_0xf7aa('0x3e')]({},_0x17bb19,_0x195d74[_0xf7aa('0x40')]);return db[_0xf7aa('0x2a')][_0xf7aa('0x46')](_0x17bb19)[_0xf7aa('0x20')](handleEntityNotFound(_0x563ccb,null))['then'](respondWithResult(_0x563ccb,null))[_0xf7aa('0x47')](handleError(_0x563ccb,null));};exports[_0xf7aa('0x48')]=function(_0x48808f,_0x46a265,_0x3099c6){return db['Sound'][_0xf7aa('0x46')]({'where':{'id':_0x48808f[_0xf7aa('0x49')]['id']},'attributes':['name','save_name',_0xf7aa('0x4a')],'raw':!![]})[_0xf7aa('0x20')](handleEntityNotFound(_0x46a265,null))['then'](function(_0x4f45c7){if(_0x4f45c7){if(!fs['existsSync'](path[_0xf7aa('0x4b')](config['root'],_0xf7aa('0x4c'),_0x4f45c7[_0xf7aa('0x4d')]+'.'+_0x4f45c7[_0xf7aa('0x4a')]))){throw new db[(_0xf7aa('0x4e'))][(_0xf7aa('0x4f'))](_0xf7aa('0x50'));}return _0x46a265[_0xf7aa('0x48')](path['join'](config[_0xf7aa('0x51')],_0xf7aa('0x4c'),util[_0xf7aa('0x52')](_0xf7aa('0x53'),_0x4f45c7[_0xf7aa('0x4d')],_0x4f45c7[_0xf7aa('0x4a')])),util[_0xf7aa('0x52')](_0xf7aa('0x53'),_0x4f45c7[_0xf7aa('0x27')],_0x4f45c7[_0xf7aa('0x4a')]));}return null;})[_0xf7aa('0x47')](handleError(_0x46a265,null));};exports[_0xf7aa('0x54')]=function(_0x5084bb,_0xed34e5,_0xe450a6){var _0x2e1bae={'name':path[_0xf7aa('0x55')](_0x5084bb['file']['originalname'],path[_0xf7aa('0x56')](_0x5084bb['file'][_0xf7aa('0x57')])),'save_name':path[_0xf7aa('0x55')](_0x5084bb[_0xf7aa('0x58')][_0xf7aa('0x59')],path['extname'](_0x5084bb[_0xf7aa('0x58')]['filename'])),'original_format':path[_0xf7aa('0x56')](_0x5084bb[_0xf7aa('0x58')][_0xf7aa('0x57')])[_0xf7aa('0x5a')](0x1),'converted_format':_0xf7aa('0x5b')};var _0x1b7ca8=path[_0xf7aa('0x4b')](config[_0xf7aa('0x51')],_0xf7aa('0x5c'),_0x5084bb['file'][_0xf7aa('0x59')]);var _0x2f522c=path[_0xf7aa('0x4b')](config[_0xf7aa('0x51')],_0xf7aa('0x4c'),util[_0xf7aa('0x52')]('%s.%s',path[_0xf7aa('0x55')](_0x5084bb[_0xf7aa('0x58')]['filename'],path[_0xf7aa('0x56')](_0x5084bb['file'][_0xf7aa('0x59')])),_0x2e1bae[_0xf7aa('0x4a')]));logger[_0xf7aa('0x5d')](_0xf7aa('0x5e'),_0x1b7ca8);logger[_0xf7aa('0x5d')](_0xf7aa('0x5f'),_0x2f522c);try{fs['chmodSync'](_0x1b7ca8,parseInt(_0xf7aa('0x60'),0x8));var _0x409a59=sox[_0xf7aa('0x61')](_0x1b7ca8,_0x2f522c,{'sampleRate':0x1f40,'format':_0xf7aa('0x5b'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x409a59['on'](_0xf7aa('0x25'),function(_0x28ee60){fs[_0xf7aa('0x62')](_0x1b7ca8);_0xed34e5[_0xf7aa('0x16')](0x1f4)[_0xf7aa('0x28')](_0x28ee60);});_0x409a59['on'](_0xf7aa('0x63'),function(_0x40ab62){_0x2e1bae[_0xf7aa('0x64')]=isNaN(_0x40ab62[_0xf7aa('0x65')])?null:_0x40ab62[_0xf7aa('0x65')]*0x3e8;_0x2e1bae[_0xf7aa('0x66')]=isNaN(_0x40ab62[_0xf7aa('0x67')])?null:_0x40ab62[_0xf7aa('0x67')];_0x2e1bae[_0xf7aa('0x68')]=isNaN(_0x40ab62[_0xf7aa('0x69')])?null:_0x40ab62['channelCount'];_0x2e1bae[_0xf7aa('0x6a')]=isNaN(_0x40ab62[_0xf7aa('0x6b')])?null:_0x40ab62[_0xf7aa('0x6b')];_0x2e1bae[_0xf7aa('0x6c')]=isNaN(_0x40ab62[_0xf7aa('0x6d')])?null:_0x40ab62[_0xf7aa('0x6d')];});_0x409a59['on'](_0xf7aa('0x6e'),function(_0x411601){_0x2e1bae['converted_duration']=isNaN(_0x411601[_0xf7aa('0x65')])?null:_0x411601['duration']*0x3e8;_0x2e1bae['converted_sampleCount']=isNaN(_0x411601[_0xf7aa('0x67')])?null:_0x411601['sampleCount'];_0x2e1bae['converted_channelCount']=isNaN(_0x411601[_0xf7aa('0x69')])?null:_0x411601[_0xf7aa('0x69')];_0x2e1bae['converted_bitRate']=isNaN(_0x411601[_0xf7aa('0x6b')])?null:_0x411601[_0xf7aa('0x6b')];_0x2e1bae[_0xf7aa('0x6f')]=isNaN(_0x411601[_0xf7aa('0x6d')])?null:_0x411601['sampleRate'];});_0x409a59['on']('end',function(){fs['chmodSync'](_0x2f522c,parseInt(_0xf7aa('0x60'),0x8));return db[_0xf7aa('0x2a')][_0xf7aa('0x54')](_0x2e1bae)[_0xf7aa('0x20')](function(_0x268607){var _0x5821db={'role':_0x5084bb['body'][_0xf7aa('0x70')],'userProfileId':_0x5084bb[_0xf7aa('0x71')][_0xf7aa('0x72')]};if(!_0x5821db)throw new Error(_0xf7aa('0x73'));if(_0x5821db['role']==='user'){var _0x1eb48e=_0x268607['get']({'plain':!![]});return db[_0xf7aa('0x74')]['find']({'where':{'name':'Sounds','userProfileId':_0x5821db['userProfileId']},'raw':!![]})[_0xf7aa('0x20')](function(_0xa648cb){if(_0xa648cb&&_0xa648cb['autoAssociation']===0x0){return db[_0xf7aa('0x23')][_0xf7aa('0x54')]({'name':_0x1eb48e[_0xf7aa('0x27')],'resourceId':_0x1eb48e['id'],'type':_0xa648cb[_0xf7aa('0x27')],'sectionId':_0xa648cb['id']},{})[_0xf7aa('0x20')](function(){return _0x268607;});}else{return _0x268607;}})[_0xf7aa('0x47')](function(_0x3cc87b){logger['error'](_0xf7aa('0x75'),_0x3cc87b);throw _0x3cc87b;});}return _0x268607;})['then'](respondWithResult(_0xed34e5,null))['catch'](handleError(_0xed34e5,null));});_0x409a59[_0xf7aa('0x76')]();}catch(_0x4d3452){_0xed34e5['status'](0x1f4)[_0xf7aa('0x28')](_0x4d3452);}};exports[_0xf7aa('0x1f')]=function(_0x45d427,_0xba3ce2,_0x56295d){return db['Sound'][_0xf7aa('0x46')]({'where':{'id':_0x45d427[_0xf7aa('0x49')]['id']}})['then'](handleEntityNotFound(_0xba3ce2,null))['then'](saveUpdates(_[_0xf7aa('0x3b')](_0x45d427[_0xf7aa('0x71')],[_0xf7aa('0x27'),_0xf7aa('0x77')]),null))[_0xf7aa('0x20')](respondWithResult(_0xba3ce2,null))[_0xf7aa('0x47')](handleError(_0xba3ce2,null));};exports[_0xf7aa('0x78')]=function(_0x3b4fb2,_0x5e8a42,_0x361d00){return db[_0xf7aa('0x2a')][_0xf7aa('0x46')]({'where':{'id':_0x3b4fb2[_0xf7aa('0x49')]['id']}})[_0xf7aa('0x20')](function(_0x666c59){if(_0x666c59){return _0x666c59[_0xf7aa('0x21')]();}})[_0xf7aa('0x20')](function(_0x19caee){var _0x2a73d1=path[_0xf7aa('0x4b')](config[_0xf7aa('0x51')],'server/files/sounds/original',util[_0xf7aa('0x52')](_0xf7aa('0x53'),_0x19caee['save_name'],_0x19caee[_0xf7aa('0x79')]));var _0x5d5206=path[_0xf7aa('0x4b')](config[_0xf7aa('0x51')],'server/files/sounds/converted',util[_0xf7aa('0x52')](_0xf7aa('0x53'),_0x19caee[_0xf7aa('0x4d')],_0x19caee['converted_format']));fs['unlinkSync'](_0x2a73d1);fs[_0xf7aa('0x62')](_0x5d5206);return _0x19caee;})[_0xf7aa('0x20')](function(_0x5456f4){if(_0x5456f4){return _0x5e8a42[_0xf7aa('0x16')](0xcc)[_0xf7aa('0x15')]();}})[_0xf7aa('0x20')](handleEntityNotFound(_0x5e8a42,null))[_0xf7aa('0x47')](handleError(_0x5e8a42,null));}; \ No newline at end of file +var _0xaccb=['length','download','find','save_name','existsSync','root','server/files/sounds/converted','converted_format','Sequelize','Sound\x20not\x20found','join','format','%s.%s','basename','file','originalname','filename','extname','substring','wav','info','Sound\x20upload\x20filepath:\x20%s','Sound\x20upload\x20destination:\x20%s','0777','transcode','unlinkSync','src','original_duration','original_sampleCount','sampleCount','channelCount','original_bitRate','bitRate','sampleRate','dest','converted_duration','converted_sampleCount','converted_channelCount','converted_bitRate','converted_sampleRate','create','body','role','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','Sounds','autoAssociation','start','description','delete','server/files/sounds/original','original_format','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','count','limit','set','Content-Range','json','apply','reject','save','update','then','get','UserProfileResource','destroy','error','stack','name','send','index','Sound','rawAttributes','fieldName','type','key','filters','intersection','model','query','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','map','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','keys'];(function(_0x483181,_0x1496ec){var _0x4f274f=function(_0x5d47a5){while(--_0x5d47a5){_0x483181['push'](_0x483181['shift']());}};_0x4f274f(++_0x1496ec);}(_0xaccb,0x1c2));var _0xbacc=function(_0x4567d3,_0x3114e1){_0x4567d3=_0x4567d3-0x0;var _0x2b3dae=_0xaccb[_0x4567d3];return _0x2b3dae;};'use strict';var emlformat=require(_0xbacc('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xbacc('0x1'));var jsonpatch=require(_0xbacc('0x2'));var rp=require(_0xbacc('0x3'));var moment=require(_0xbacc('0x4'));var BPromise=require(_0xbacc('0x5'));var Mustache=require(_0xbacc('0x6'));var util=require(_0xbacc('0x7'));var path=require(_0xbacc('0x8'));var sox=require(_0xbacc('0x9'));var csv=require(_0xbacc('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xbacc('0xb'));var _=require(_0xbacc('0xc'));var squel=require(_0xbacc('0xd'));var crypto=require('crypto');var jsforce=require(_0xbacc('0xe'));var deskjs=require(_0xbacc('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xbacc('0x10'));var Redis=require('ioredis');var authService=require(_0xbacc('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xbacc('0x12'));var hardwareService=require(_0xbacc('0x13'));var logger=require(_0xbacc('0x14'))(_0xbacc('0x15'));var utils=require('../../config/utils');var config=require(_0xbacc('0x16'));var licenseUtil=require(_0xbacc('0x17'));var db=require(_0xbacc('0x18'))['db'];function respondWithStatusCode(_0x39c0ce,_0x8b111){_0x8b111=_0x8b111||0xcc;return function(_0x4b6b38){if(_0x4b6b38){return _0x39c0ce[_0xbacc('0x19')](_0x8b111);}return _0x39c0ce[_0xbacc('0x1a')](_0x8b111)[_0xbacc('0x1b')]();};}function respondWithResult(_0x23bbc7,_0x593af8){_0x593af8=_0x593af8||0xc8;return function(_0x2ff0b1){if(_0x2ff0b1){return _0x23bbc7[_0xbacc('0x1a')](_0x593af8)['json'](_0x2ff0b1);}};}function respondWithFilteredResult(_0x24f0ad,_0x17f00f){return function(_0x1c5043){if(_0x1c5043){var _0xd9e78f=typeof _0x17f00f[_0xbacc('0x1c')]==='undefined'&&typeof _0x17f00f['limit']===_0xbacc('0x1d');var _0x24763a=_0x1c5043[_0xbacc('0x1e')];var _0x4dbd1a=_0xd9e78f?0x0:_0x17f00f[_0xbacc('0x1c')];var _0x298a33=_0xd9e78f?_0x1c5043[_0xbacc('0x1e')]:_0x17f00f['offset']+_0x17f00f[_0xbacc('0x1f')];var _0x4ecce0;if(_0x298a33>=_0x24763a){_0x298a33=_0x24763a;_0x4ecce0=0xc8;}else{_0x4ecce0=0xce;}_0x24f0ad[_0xbacc('0x1a')](_0x4ecce0);return _0x24f0ad[_0xbacc('0x20')](_0xbacc('0x21'),_0x4dbd1a+'-'+_0x298a33+'/'+_0x24763a)[_0xbacc('0x22')](_0x1c5043);}return null;};}function patchUpdates(_0x50311e){return function(_0x4f93c2){try{jsonpatch[_0xbacc('0x23')](_0x4f93c2,_0x50311e,!![]);}catch(_0x294002){return BPromise[_0xbacc('0x24')](_0x294002);}return _0x4f93c2[_0xbacc('0x25')]();};}function saveUpdates(_0x1fdccb,_0x198df8){return function(_0x44c710){if(_0x44c710){return _0x44c710[_0xbacc('0x26')](_0x1fdccb)[_0xbacc('0x27')](function(_0xd61cd9){return _0xd61cd9;});}return null;};}function removeEntity(_0x4d268f,_0x126ba0){return function(_0x48e8e2){if(_0x48e8e2){return _0x48e8e2['destroy']()[_0xbacc('0x27')](function(){var _0x49d5aa=_0x48e8e2[_0xbacc('0x28')]({'plain':!![]});var _0x26a999='Sounds';return db[_0xbacc('0x29')][_0xbacc('0x2a')]({'where':{'type':_0x26a999,'resourceId':_0x49d5aa['id']}})[_0xbacc('0x27')](function(){return _0x48e8e2;});})[_0xbacc('0x27')](function(){_0x4d268f[_0xbacc('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x42a411,_0x130137){return function(_0x56e7a4){if(!_0x56e7a4){_0x42a411['sendStatus'](0x194);}return _0x56e7a4;};}function handleError(_0x2e667f,_0x1aa2a1){_0x1aa2a1=_0x1aa2a1||0x1f4;return function(_0x22d475){logger[_0xbacc('0x2b')](_0x22d475[_0xbacc('0x2c')]);if(_0x22d475[_0xbacc('0x2d')]){delete _0x22d475[_0xbacc('0x2d')];}_0x2e667f[_0xbacc('0x1a')](_0x1aa2a1)[_0xbacc('0x2e')](_0x22d475);};}exports[_0xbacc('0x2f')]=function(_0x54c5bf,_0x53b088){var _0x30d841={},_0x402ee7={},_0x4aedc0={'count':0x0,'rows':[]};var _0x27c3d2=_['map'](db[_0xbacc('0x30')][_0xbacc('0x31')],function(_0x1f3cf0){return{'name':_0x1f3cf0[_0xbacc('0x32')],'type':_0x1f3cf0[_0xbacc('0x33')][_0xbacc('0x34')]};});_0x402ee7['model']=_['map'](_0x27c3d2,_0xbacc('0x2d'));_0x402ee7['query']=_['keys'](_0x54c5bf['query']);_0x402ee7[_0xbacc('0x35')]=_[_0xbacc('0x36')](_0x402ee7[_0xbacc('0x37')],_0x402ee7[_0xbacc('0x38')]);_0x30d841[_0xbacc('0x39')]=_[_0xbacc('0x36')](_0x402ee7[_0xbacc('0x37')],qs[_0xbacc('0x3a')](_0x54c5bf[_0xbacc('0x38')]['fields']));_0x30d841[_0xbacc('0x39')]=_0x30d841['attributes']['length']?_0x30d841[_0xbacc('0x39')]:_0x402ee7[_0xbacc('0x37')];if(!_0x54c5bf[_0xbacc('0x38')][_0xbacc('0x3b')](_0xbacc('0x3c'))){_0x30d841[_0xbacc('0x1f')]=qs[_0xbacc('0x1f')](_0x54c5bf[_0xbacc('0x38')][_0xbacc('0x1f')]);_0x30d841[_0xbacc('0x1c')]=qs[_0xbacc('0x1c')](_0x54c5bf[_0xbacc('0x38')][_0xbacc('0x1c')]);}_0x30d841[_0xbacc('0x3d')]=qs['sort'](_0x54c5bf[_0xbacc('0x38')][_0xbacc('0x3e')]);_0x30d841[_0xbacc('0x3f')]=qs[_0xbacc('0x35')](_[_0xbacc('0x40')](_0x54c5bf['query'],_0x402ee7[_0xbacc('0x35')]),_0x27c3d2);if(_0x54c5bf[_0xbacc('0x38')][_0xbacc('0x41')]){_0x30d841[_0xbacc('0x3f')]=_[_0xbacc('0x42')](_0x30d841[_0xbacc('0x3f')],{'$or':_[_0xbacc('0x43')](_0x27c3d2,function(_0x3d9d77){if(_0x3d9d77[_0xbacc('0x33')]!==_0xbacc('0x44')){var _0x51ca23={};_0x51ca23[_0x3d9d77[_0xbacc('0x2d')]]={'$like':'%'+_0x54c5bf[_0xbacc('0x38')][_0xbacc('0x41')]+'%'};return _0x51ca23;}})});}_0x30d841=_[_0xbacc('0x42')]({},_0x30d841,_0x54c5bf[_0xbacc('0x45')]);var _0x5f5c43={'where':_0x30d841[_0xbacc('0x3f')]};return db[_0xbacc('0x30')]['count'](_0x5f5c43)[_0xbacc('0x27')](function(_0x1139df){_0x4aedc0[_0xbacc('0x1e')]=_0x1139df;if(_0x54c5bf[_0xbacc('0x38')][_0xbacc('0x46')]){_0x30d841[_0xbacc('0x47')]=[{'all':!![]}];}return db[_0xbacc('0x30')][_0xbacc('0x48')](_0x30d841);})[_0xbacc('0x27')](function(_0x544023){_0x4aedc0[_0xbacc('0x49')]=_0x544023;return _0x4aedc0;})[_0xbacc('0x27')](respondWithFilteredResult(_0x53b088,_0x30d841))[_0xbacc('0x4a')](handleError(_0x53b088,null));};exports[_0xbacc('0x4b')]=function(_0x57b033,_0x256e72){var _0xf7b4ee={'raw':!![],'where':{'id':_0x57b033[_0xbacc('0x4c')]['id']}},_0xcf505b={};_0xcf505b[_0xbacc('0x37')]=_['keys'](db[_0xbacc('0x30')]['rawAttributes']);_0xcf505b[_0xbacc('0x38')]=_[_0xbacc('0x4d')](_0x57b033[_0xbacc('0x38')]);_0xcf505b[_0xbacc('0x35')]=_[_0xbacc('0x36')](_0xcf505b[_0xbacc('0x37')],_0xcf505b[_0xbacc('0x38')]);_0xf7b4ee[_0xbacc('0x39')]=_[_0xbacc('0x36')](_0xcf505b[_0xbacc('0x37')],qs[_0xbacc('0x3a')](_0x57b033['query'][_0xbacc('0x3a')]));_0xf7b4ee['attributes']=_0xf7b4ee[_0xbacc('0x39')][_0xbacc('0x4e')]?_0xf7b4ee[_0xbacc('0x39')]:_0xcf505b['model'];if(_0x57b033[_0xbacc('0x38')][_0xbacc('0x46')]){_0xf7b4ee[_0xbacc('0x47')]=[{'all':!![]}];}_0xf7b4ee=_[_0xbacc('0x42')]({},_0xf7b4ee,_0x57b033[_0xbacc('0x45')]);return db[_0xbacc('0x30')]['find'](_0xf7b4ee)[_0xbacc('0x27')](handleEntityNotFound(_0x256e72,null))['then'](respondWithResult(_0x256e72,null))[_0xbacc('0x4a')](handleError(_0x256e72,null));};exports[_0xbacc('0x4f')]=function(_0x38ea44,_0x4dffa7,_0x38e735){return db[_0xbacc('0x30')][_0xbacc('0x50')]({'where':{'id':_0x38ea44[_0xbacc('0x4c')]['id']},'attributes':[_0xbacc('0x2d'),_0xbacc('0x51'),'converted_format'],'raw':!![]})[_0xbacc('0x27')](handleEntityNotFound(_0x4dffa7,null))[_0xbacc('0x27')](function(_0x1e0bb6){if(_0x1e0bb6){if(!fs[_0xbacc('0x52')](path['join'](config[_0xbacc('0x53')],_0xbacc('0x54'),_0x1e0bb6[_0xbacc('0x51')]+'.'+_0x1e0bb6[_0xbacc('0x55')]))){throw new db[(_0xbacc('0x56'))]['ValidationError'](_0xbacc('0x57'));}return _0x4dffa7['download'](path[_0xbacc('0x58')](config['root'],_0xbacc('0x54'),util[_0xbacc('0x59')](_0xbacc('0x5a'),_0x1e0bb6[_0xbacc('0x51')],_0x1e0bb6[_0xbacc('0x55')])),util[_0xbacc('0x59')]('%s.%s',_0x1e0bb6[_0xbacc('0x2d')],_0x1e0bb6['converted_format']));}return null;})[_0xbacc('0x4a')](handleError(_0x4dffa7,null));};exports['create']=function(_0x5cf087,_0x5b8c56,_0x200138){var _0x4599ed={'name':path[_0xbacc('0x5b')](_0x5cf087[_0xbacc('0x5c')][_0xbacc('0x5d')],path['extname'](_0x5cf087[_0xbacc('0x5c')]['originalname'])),'save_name':path['basename'](_0x5cf087['file'][_0xbacc('0x5e')],path[_0xbacc('0x5f')](_0x5cf087[_0xbacc('0x5c')][_0xbacc('0x5e')])),'original_format':path[_0xbacc('0x5f')](_0x5cf087['file'][_0xbacc('0x5d')])[_0xbacc('0x60')](0x1),'converted_format':_0xbacc('0x61')};var _0x2436a9=path['join'](config[_0xbacc('0x53')],'server/files/sounds/original',_0x5cf087['file'][_0xbacc('0x5e')]);var _0x54f729=path[_0xbacc('0x58')](config['root'],'server/files/sounds/converted',util['format'](_0xbacc('0x5a'),path[_0xbacc('0x5b')](_0x5cf087[_0xbacc('0x5c')][_0xbacc('0x5e')],path['extname'](_0x5cf087['file'][_0xbacc('0x5e')])),_0x4599ed['converted_format']));logger[_0xbacc('0x62')](_0xbacc('0x63'),_0x2436a9);logger[_0xbacc('0x62')](_0xbacc('0x64'),_0x54f729);try{fs['chmodSync'](_0x2436a9,parseInt(_0xbacc('0x65'),0x8));var _0x59cc79=sox[_0xbacc('0x66')](_0x2436a9,_0x54f729,{'sampleRate':0x1f40,'format':_0xbacc('0x61'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x59cc79['on'](_0xbacc('0x2b'),function(_0x363c6f){fs[_0xbacc('0x67')](_0x2436a9);_0x5b8c56[_0xbacc('0x1a')](0x1f4)[_0xbacc('0x2e')](_0x363c6f);});_0x59cc79['on'](_0xbacc('0x68'),function(_0x3708d3){_0x4599ed[_0xbacc('0x69')]=isNaN(_0x3708d3['duration'])?null:_0x3708d3['duration']*0x3e8;_0x4599ed[_0xbacc('0x6a')]=isNaN(_0x3708d3[_0xbacc('0x6b')])?null:_0x3708d3[_0xbacc('0x6b')];_0x4599ed['original_channelCount']=isNaN(_0x3708d3['channelCount'])?null:_0x3708d3[_0xbacc('0x6c')];_0x4599ed[_0xbacc('0x6d')]=isNaN(_0x3708d3[_0xbacc('0x6e')])?null:_0x3708d3[_0xbacc('0x6e')];_0x4599ed['original_sampleRate']=isNaN(_0x3708d3['sampleRate'])?null:_0x3708d3[_0xbacc('0x6f')];});_0x59cc79['on'](_0xbacc('0x70'),function(_0x1c9eac){_0x4599ed[_0xbacc('0x71')]=isNaN(_0x1c9eac['duration'])?null:_0x1c9eac['duration']*0x3e8;_0x4599ed[_0xbacc('0x72')]=isNaN(_0x1c9eac[_0xbacc('0x6b')])?null:_0x1c9eac['sampleCount'];_0x4599ed[_0xbacc('0x73')]=isNaN(_0x1c9eac[_0xbacc('0x6c')])?null:_0x1c9eac[_0xbacc('0x6c')];_0x4599ed[_0xbacc('0x74')]=isNaN(_0x1c9eac['bitRate'])?null:_0x1c9eac[_0xbacc('0x6e')];_0x4599ed[_0xbacc('0x75')]=isNaN(_0x1c9eac[_0xbacc('0x6f')])?null:_0x1c9eac[_0xbacc('0x6f')];});_0x59cc79['on']('end',function(){fs['chmodSync'](_0x54f729,parseInt('0777',0x8));return db[_0xbacc('0x30')][_0xbacc('0x76')](_0x4599ed)[_0xbacc('0x27')](function(_0x59db4e){var _0x457103={'role':_0x5cf087[_0xbacc('0x77')][_0xbacc('0x78')],'userProfileId':_0x5cf087[_0xbacc('0x77')][_0xbacc('0x79')]};if(!_0x457103)throw new Error(_0xbacc('0x7a'));if(_0x457103[_0xbacc('0x78')]===_0xbacc('0x7b')){var _0x3cfd0b=_0x59db4e[_0xbacc('0x28')]({'plain':!![]});return db[_0xbacc('0x7c')][_0xbacc('0x50')]({'where':{'name':_0xbacc('0x7d'),'userProfileId':_0x457103['userProfileId']},'raw':!![]})['then'](function(_0x5e987c){if(_0x5e987c&&_0x5e987c[_0xbacc('0x7e')]===0x0){return db[_0xbacc('0x29')][_0xbacc('0x76')]({'name':_0x3cfd0b[_0xbacc('0x2d')],'resourceId':_0x3cfd0b['id'],'type':_0x5e987c['name'],'sectionId':_0x5e987c['id']},{})[_0xbacc('0x27')](function(){return _0x59db4e;});}else{return _0x59db4e;}})['catch'](function(_0x346a4a){logger[_0xbacc('0x2b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x346a4a);throw _0x346a4a;});}return _0x59db4e;})['then'](respondWithResult(_0x5b8c56,null))[_0xbacc('0x4a')](handleError(_0x5b8c56,null));});_0x59cc79[_0xbacc('0x7f')]();}catch(_0x4c6994){_0x5b8c56[_0xbacc('0x1a')](0x1f4)['send'](_0x4c6994);}};exports[_0xbacc('0x26')]=function(_0x11e503,_0x58dfc3,_0x55ff6b){return db[_0xbacc('0x30')]['find']({'where':{'id':_0x11e503[_0xbacc('0x4c')]['id']}})[_0xbacc('0x27')](handleEntityNotFound(_0x58dfc3,null))[_0xbacc('0x27')](saveUpdates(_[_0xbacc('0x40')](_0x11e503[_0xbacc('0x77')],[_0xbacc('0x2d'),_0xbacc('0x80')]),null))[_0xbacc('0x27')](respondWithResult(_0x58dfc3,null))[_0xbacc('0x4a')](handleError(_0x58dfc3,null));};exports[_0xbacc('0x81')]=function(_0x202ca2,_0x10a731,_0x2fa710){return db['Sound'][_0xbacc('0x50')]({'where':{'id':_0x202ca2[_0xbacc('0x4c')]['id']}})['then'](function(_0x59e3f7){if(_0x59e3f7){return _0x59e3f7[_0xbacc('0x2a')]();}})[_0xbacc('0x27')](function(_0x1dd930){var _0x5892c5=path[_0xbacc('0x58')](config['root'],_0xbacc('0x82'),util['format']('%s.%s',_0x1dd930[_0xbacc('0x51')],_0x1dd930[_0xbacc('0x83')]));var _0x1da6d0=path['join'](config[_0xbacc('0x53')],_0xbacc('0x54'),util[_0xbacc('0x59')]('%s.%s',_0x1dd930[_0xbacc('0x51')],_0x1dd930[_0xbacc('0x55')]));fs[_0xbacc('0x67')](_0x5892c5);fs['unlinkSync'](_0x1da6d0);return _0x1dd930;})[_0xbacc('0x27')](function(_0x46a40e){if(_0x46a40e){return _0x10a731['status'](0xcc)[_0xbacc('0x1b')]();}})['then'](handleEntityNotFound(_0x10a731,null))['catch'](handleError(_0x10a731,null));}; \ No newline at end of file diff --git a/server/api/sound/sound.model.js b/server/api/sound/sound.model.js index 0269528..4c6a4a1 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 _0x5f40=['tools_sounds','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./sound.attributes','exports','define','Sound'];(function(_0x29d94e,_0xf386d6){var _0x106237=function(_0x327501){while(--_0x327501){_0x29d94e['push'](_0x29d94e['shift']());}};_0x106237(++_0xf386d6);}(_0x5f40,0x1e2));var _0x05f4=function(_0x2aca13,_0xfa6316){_0x2aca13=_0x2aca13-0x0;var _0x391311=_0x5f40[_0x2aca13];return _0x391311;};'use strict';var _=require('lodash');var util=require(_0x05f4('0x0'));var logger=require(_0x05f4('0x1'))(_0x05f4('0x2'));var moment=require('moment');var BPromise=require(_0x05f4('0x3'));var rp=require(_0x05f4('0x4'));var fs=require('fs');var path=require(_0x05f4('0x5'));var rimraf=require(_0x05f4('0x6'));var config=require(_0x05f4('0x7'));var attributes=require(_0x05f4('0x8'));module[_0x05f4('0x9')]=function(_0x30b992,_0x6f90d5){return _0x30b992[_0x05f4('0xa')](_0x05f4('0xb'),attributes,{'tableName':_0x05f4('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb13a=['api','moment','bluebird','request-promise','path','rimraf','define','Sound','lodash','util'];(function(_0x5be8a0,_0x5f18ae){var _0x1ce890=function(_0xfb7e75){while(--_0xfb7e75){_0x5be8a0['push'](_0x5be8a0['shift']());}};_0x1ce890(++_0x5f18ae);}(_0xb13a,0x12a));var _0xab13=function(_0x561e7b,_0x4bcd2e){_0x561e7b=_0x561e7b-0x0;var _0x5851ed=_0xb13a[_0x561e7b];return _0x5851ed;};'use strict';var _=require(_0xab13('0x0'));var util=require(_0xab13('0x1'));var logger=require('../../config/logger')(_0xab13('0x2'));var moment=require(_0xab13('0x3'));var BPromise=require(_0xab13('0x4'));var rp=require(_0xab13('0x5'));var fs=require('fs');var path=require(_0xab13('0x6'));var rimraf=require(_0xab13('0x7'));var config=require('../../config/environment');var attributes=require('./sound.attributes');module['exports']=function(_0x1a6488,_0x55b3f6){return _0x1a6488[_0xab13('0x8')](_0xab13('0x9'),attributes,{'tableName':'tools_sounds','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/sound/sound.rpc.js b/server/api/sound/sound.rpc.js index 3639aac..f4b25c6 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 _0x029a=['find','options','where','include','map','attributes','model','then','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','request','info','request\x20sent','debug','stringify','error','Sound,\x20%s,\x20%s','message','result','ShowSound'];(function(_0x41dfa4,_0x1947ae){var _0x30f737=function(_0x268c36){while(--_0x268c36){_0x41dfa4['push'](_0x41dfa4['shift']());}};_0x30f737(++_0x1947ae);}(_0x029a,0x7d));var _0xa029=function(_0x9c91b4,_0x444e64){_0x9c91b4=_0x9c91b4-0x0;var _0x4be2ab=_0x029a[_0x9c91b4];return _0x4be2ab;};'use strict';var _=require(_0xa029('0x0'));var util=require(_0xa029('0x1'));var moment=require(_0xa029('0x2'));var BPromise=require(_0xa029('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa029('0x4'));var db=require(_0xa029('0x5'))['db'];var utils=require(_0xa029('0x6'));var logger=require('../../config/logger')(_0xa029('0x7'));var config=require('../../config/environment');var jayson=require(_0xa029('0x8'));var client=jayson[_0xa029('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2a1654,_0x26780e,_0x54bb68){return new BPromise(function(_0x39c83e,_0x157c6c){return client[_0xa029('0xa')](_0x2a1654,_0x54bb68)['then'](function(_0x376191){logger[_0xa029('0xb')]('Sound,\x20%s,\x20%s',_0x26780e,_0xa029('0xc'));logger[_0xa029('0xd')]('Sound,\x20%s,\x20%s,\x20%s',_0x26780e,_0xa029('0xc'),JSON[_0xa029('0xe')](_0x376191));if(_0x376191[_0xa029('0xf')]){if(_0x376191[_0xa029('0xf')]['code']===0x1f4){logger[_0xa029('0xf')](_0xa029('0x10'),_0x26780e,_0x376191[_0xa029('0xf')][_0xa029('0x11')]);return _0x157c6c(_0x376191[_0xa029('0xf')][_0xa029('0x11')]);}logger[_0xa029('0xf')]('Sound,\x20%s,\x20%s',_0x26780e,_0x376191[_0xa029('0xf')]['message']);return _0x39c83e(_0x376191[_0xa029('0xf')][_0xa029('0x11')]);}else{logger[_0xa029('0xb')]('Sound,\x20%s,\x20%s',_0x26780e,_0xa029('0xc'));_0x39c83e(_0x376191[_0xa029('0x12')][_0xa029('0x11')]);}})['catch'](function(_0x5e30bc){logger['error'](_0xa029('0x10'),_0x26780e,_0x5e30bc);_0x157c6c(_0x5e30bc);});});}exports[_0xa029('0x13')]=function(_0x5ae691){var _0x58d82b=this;return new Promise(function(_0x2109db,_0x60cb35){return db['Sound'][_0xa029('0x14')]({'raw':_0x5ae691['options']?_0x5ae691[_0xa029('0x15')]['raw']===undefined?!![]:![]:!![],'where':_0x5ae691['options']?_0x5ae691[_0xa029('0x15')][_0xa029('0x16')]||null:null,'attributes':_0x5ae691['options']?_0x5ae691[_0xa029('0x15')]['attributes']||null:null,'include':_0x5ae691[_0xa029('0x15')]?_0x5ae691[_0xa029('0x15')][_0xa029('0x17')]?_[_0xa029('0x18')](_0x5ae691[_0xa029('0x15')][_0xa029('0x17')],function(_0x2b3c1f){return{'model':db[_0x2b3c1f['model']],'as':_0x2b3c1f['as'],'attributes':_0x2b3c1f[_0xa029('0x19')],'include':_0x2b3c1f['include']?_[_0xa029('0x18')](_0x2b3c1f[_0xa029('0x17')],function(_0x583849){return{'model':db[_0x583849[_0xa029('0x1a')]],'as':_0x583849['as'],'attributes':_0x583849[_0xa029('0x19')],'include':_0x583849['include']?_['map'](_0x583849['include'],function(_0x57ca79){return{'model':db[_0x57ca79[_0xa029('0x1a')]],'as':_0x57ca79['as'],'attributes':_0x57ca79[_0xa029('0x19')]};}):[]};}):[]};}):[]:[]})[_0xa029('0x1b')](function(_0x2cbb14){logger['info'](_0xa029('0x13'),_0x5ae691);logger['debug'](_0xa029('0x13'),_0x5ae691,JSON[_0xa029('0xe')](_0x2cbb14));_0x2109db(_0x2cbb14);})[_0xa029('0x1c')](function(_0x1e739d){logger[_0xa029('0xf')](_0xa029('0x13'),_0x1e739d[_0xa029('0x11')],_0x5ae691);_0x60cb35(_0x58d82b[_0xa029('0xf')](0x1f4,_0x1e739d[_0xa029('0x11')]));});});}; \ No newline at end of file +var _0x5cff=['model','ShowSound','util','moment','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','then','info','request\x20sent','debug','Sound,\x20%s,\x20%s,\x20%s','stringify','error','message','Sound,\x20%s,\x20%s','catch','Sound','options','raw','where','attributes','include','map'];(function(_0x25a1f2,_0x42813f){var _0x3e596d=function(_0x5b7fe6){while(--_0x5b7fe6){_0x25a1f2['push'](_0x25a1f2['shift']());}};_0x3e596d(++_0x42813f);}(_0x5cff,0x107));var _0xf5cf=function(_0x308eb3,_0x4bc21b){_0x308eb3=_0x308eb3-0x0;var _0x2fbf0a=_0x5cff[_0x308eb3];return _0x2fbf0a;};'use strict';var _=require('lodash');var util=require(_0xf5cf('0x0'));var moment=require(_0xf5cf('0x1'));var BPromise=require('bluebird');var rs=require(_0xf5cf('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf5cf('0x3'))['db'];var utils=require(_0xf5cf('0x4'));var logger=require('../../config/logger')(_0xf5cf('0x5'));var config=require(_0xf5cf('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xf5cf('0x7')][_0xf5cf('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x36e2f7,_0x14de82,_0x47d518){return new BPromise(function(_0x1eb3df,_0x2c570b){return client[_0xf5cf('0x9')](_0x36e2f7,_0x47d518)[_0xf5cf('0xa')](function(_0x449c1d){logger[_0xf5cf('0xb')]('Sound,\x20%s,\x20%s',_0x14de82,_0xf5cf('0xc'));logger[_0xf5cf('0xd')](_0xf5cf('0xe'),_0x14de82,_0xf5cf('0xc'),JSON[_0xf5cf('0xf')](_0x449c1d));if(_0x449c1d[_0xf5cf('0x10')]){if(_0x449c1d[_0xf5cf('0x10')]['code']===0x1f4){logger[_0xf5cf('0x10')]('Sound,\x20%s,\x20%s',_0x14de82,_0x449c1d['error'][_0xf5cf('0x11')]);return _0x2c570b(_0x449c1d[_0xf5cf('0x10')][_0xf5cf('0x11')]);}logger['error'](_0xf5cf('0x12'),_0x14de82,_0x449c1d[_0xf5cf('0x10')][_0xf5cf('0x11')]);return _0x1eb3df(_0x449c1d['error'][_0xf5cf('0x11')]);}else{logger[_0xf5cf('0xb')](_0xf5cf('0x12'),_0x14de82,_0xf5cf('0xc'));_0x1eb3df(_0x449c1d['result'][_0xf5cf('0x11')]);}})[_0xf5cf('0x13')](function(_0x2bddf6){logger['error'](_0xf5cf('0x12'),_0x14de82,_0x2bddf6);_0x2c570b(_0x2bddf6);});});}exports['ShowSound']=function(_0x457834){var _0x137d55=this;return new Promise(function(_0xc02938,_0x4a5465){return db[_0xf5cf('0x14')]['find']({'raw':_0x457834[_0xf5cf('0x15')]?_0x457834[_0xf5cf('0x15')][_0xf5cf('0x16')]===undefined?!![]:![]:!![],'where':_0x457834[_0xf5cf('0x15')]?_0x457834[_0xf5cf('0x15')][_0xf5cf('0x17')]||null:null,'attributes':_0x457834[_0xf5cf('0x15')]?_0x457834['options'][_0xf5cf('0x18')]||null:null,'include':_0x457834[_0xf5cf('0x15')]?_0x457834[_0xf5cf('0x15')][_0xf5cf('0x19')]?_[_0xf5cf('0x1a')](_0x457834[_0xf5cf('0x15')][_0xf5cf('0x19')],function(_0x230e04){return{'model':db[_0x230e04['model']],'as':_0x230e04['as'],'attributes':_0x230e04[_0xf5cf('0x18')],'include':_0x230e04[_0xf5cf('0x19')]?_[_0xf5cf('0x1a')](_0x230e04['include'],function(_0x5573c4){return{'model':db[_0x5573c4[_0xf5cf('0x1b')]],'as':_0x5573c4['as'],'attributes':_0x5573c4['attributes'],'include':_0x5573c4[_0xf5cf('0x19')]?_['map'](_0x5573c4[_0xf5cf('0x19')],function(_0x12026d){return{'model':db[_0x12026d['model']],'as':_0x12026d['as'],'attributes':_0x12026d[_0xf5cf('0x18')]};}):[]};}):[]};}):[]:[]})[_0xf5cf('0xa')](function(_0x5ec7d1){logger[_0xf5cf('0xb')](_0xf5cf('0x1c'),_0x457834);logger[_0xf5cf('0xd')](_0xf5cf('0x1c'),_0x457834,JSON[_0xf5cf('0xf')](_0x5ec7d1));_0xc02938(_0x5ec7d1);})[_0xf5cf('0x13')](function(_0x1a081d){logger[_0xf5cf('0x10')](_0xf5cf('0x1c'),_0x1a081d[_0xf5cf('0x11')],_0x457834);_0x4a5465(_0x137d55[_0xf5cf('0x10')](0x1f4,_0x1a081d[_0xf5cf('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/squareMessage/index.js b/server/api/squareMessage/index.js index d0b5d9f..3349bdf 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(_0x2acd8b,_0x3184b3){var _0x35d63f=function(_0xf54d4){while(--_0xf54d4){_0x2acd8b['push'](_0x2acd8b['shift']());}};_0x35d63f(++_0x3184b3);}(_0x2032,0xd9));var _0x2203=function(_0x3371ff,_0x53b9a7){_0x3371ff=_0x3371ff-0x0;var _0x3894f5=_0x2032[_0x3371ff];return _0x3894f5;};'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 _0xbaf0=['connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./squareMessage.controller','get','isAuthenticated','index','/:id','post','create','put','update','delete','destroy','exports','util','path'];(function(_0x187386,_0x4f7e7c){var _0x513a62=function(_0x33da76){while(--_0x33da76){_0x187386['push'](_0x187386['shift']());}};_0x513a62(++_0x4f7e7c);}(_0xbaf0,0x12a));var _0x0baf=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xbaf0[_0x1facfa];return _0x9ec701;};'use strict';var multer=require('multer');var util=require(_0x0baf('0x0'));var path=require(_0x0baf('0x1'));var timeout=require(_0x0baf('0x2'));var express=require(_0x0baf('0x3'));var router=express[_0x0baf('0x4')]();var fs_extra=require(_0x0baf('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x0baf('0x6'));var config=require(_0x0baf('0x7'));var controller=require(_0x0baf('0x8'));router[_0x0baf('0x9')]('/',auth[_0x0baf('0xa')](),controller[_0x0baf('0xb')]);router[_0x0baf('0x9')](_0x0baf('0xc'),auth[_0x0baf('0xa')](),controller['show']);router[_0x0baf('0xd')]('/',auth['isAuthenticated'](),controller[_0x0baf('0xe')]);router[_0x0baf('0xf')](_0x0baf('0xc'),auth[_0x0baf('0xa')](),controller[_0x0baf('0x10')]);router[_0x0baf('0x11')](_0x0baf('0xc'),auth[_0x0baf('0xa')](),controller[_0x0baf('0x12')]);module[_0x0baf('0x13')]=router; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.attributes.js b/server/api/squareMessage/squareMessage.attributes.js index fffd4d4..e855e1f 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 _0x46d0=['ENUM','out','sequelize','STRING','TEXT','medium'];(function(_0x3b50f4,_0x3de17b){var _0xe2acb0=function(_0x3e127f){while(--_0x3e127f){_0x3b50f4['push'](_0x3b50f4['shift']());}};_0xe2acb0(++_0x3de17b);}(_0x46d0,0x110));var _0x046d=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x46d0[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require(_0x046d('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x046d('0x1')]},'body':{'type':Sequelize[_0x046d('0x2')](_0x046d('0x3')),'allowNull':![]},'direction':{'type':Sequelize[_0x046d('0x4')]('in','out'),'defaultValue':_0x046d('0x5'),'allowNull':![]},'providerName':{'type':Sequelize[_0x046d('0x1')]},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0x8798=['ENUM','out','TEXT','sequelize','exports','STRING'];(function(_0x3c99f5,_0x3c4b1a){var _0x3b958e=function(_0x18d09d){while(--_0x18d09d){_0x3c99f5['push'](_0x3c99f5['shift']());}};_0x3b958e(++_0x3c4b1a);}(_0x8798,0xcf));var _0x8879=function(_0x7c7e48,_0x2549f4){_0x7c7e48=_0x7c7e48-0x0;var _0x28c9d0=_0x8798[_0x7c7e48];return _0x28c9d0;};'use strict';var Sequelize=require(_0x8879('0x0'));module[_0x8879('0x1')]={'uniqueid':{'type':Sequelize[_0x8879('0x2')]},'body':{'type':Sequelize['TEXT']('medium'),'allowNull':![]},'direction':{'type':Sequelize[_0x8879('0x3')]('in','out'),'defaultValue':_0x8879('0x4'),'allowNull':![]},'providerName':{'type':Sequelize[_0x8879('0x2')]},'providerResponse':{'type':Sequelize[_0x8879('0x5')]}}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.controller.js b/server/api/squareMessage/squareMessage.controller.js index 7acd05c..997c926 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 _0x32b6=['sort','where','filter','merge','VIRTUAL','options','includeAll','rows','show','params','include','catch','create','body','find','eml-format','rimraf','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','count','limit','set','Content-Range','save','update','then','destroy','sendStatus','error','stack','name','send','index','map','SquareMessage','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x32b6,0x1d1));var _0x632b=function(_0xd00880,_0x5e0fa1){_0xd00880=_0xd00880-0x0;var _0x5887d7=_0x32b6[_0xd00880];return _0x5887d7;};'use strict';var emlformat=require(_0x632b('0x0'));var rimraf=require(_0x632b('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x632b('0x2'));var rp=require(_0x632b('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x632b('0x4'));var util=require(_0x632b('0x5'));var path=require(_0x632b('0x6'));var sox=require(_0x632b('0x7'));var csv=require(_0x632b('0x8'));var ejs=require(_0x632b('0x9'));var fs=require('fs');var fs_extra=require(_0x632b('0xa'));var _=require(_0x632b('0xb'));var squel=require(_0x632b('0xc'));var crypto=require(_0x632b('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x632b('0xe'));var toCsv=require(_0x632b('0x8'));var querystring=require(_0x632b('0xf'));var Papa=require(_0x632b('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x632b('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x632b('0x12'))(_0x632b('0x13'));var utils=require(_0x632b('0x14'));var config=require(_0x632b('0x15'));var licenseUtil=require(_0x632b('0x16'));var db=require(_0x632b('0x17'))['db'];function respondWithStatusCode(_0xe81378,_0x3d8bed){_0x3d8bed=_0x3d8bed||0xcc;return function(_0x22c182){if(_0x22c182){return _0xe81378['sendStatus'](_0x3d8bed);}return _0xe81378[_0x632b('0x18')](_0x3d8bed)[_0x632b('0x19')]();};}function respondWithResult(_0x9246a6,_0x5a97da){_0x5a97da=_0x5a97da||0xc8;return function(_0x721883){if(_0x721883){return _0x9246a6[_0x632b('0x18')](_0x5a97da)[_0x632b('0x1a')](_0x721883);}};}function respondWithFilteredResult(_0x17ff9b,_0x40d410){return function(_0x21cdd3){if(_0x21cdd3){var _0x4efe39=typeof _0x40d410[_0x632b('0x1b')]==='undefined'&&typeof _0x40d410['limit']===_0x632b('0x1c');var _0x5afa1e=_0x21cdd3[_0x632b('0x1d')];var _0x3bb27f=_0x4efe39?0x0:_0x40d410[_0x632b('0x1b')];var _0x51c894=_0x4efe39?_0x21cdd3[_0x632b('0x1d')]:_0x40d410[_0x632b('0x1b')]+_0x40d410[_0x632b('0x1e')];var _0x3683e4;if(_0x51c894>=_0x5afa1e){_0x51c894=_0x5afa1e;_0x3683e4=0xc8;}else{_0x3683e4=0xce;}_0x17ff9b['status'](_0x3683e4);return _0x17ff9b[_0x632b('0x1f')](_0x632b('0x20'),_0x3bb27f+'-'+_0x51c894+'/'+_0x5afa1e)['json'](_0x21cdd3);}return null;};}function patchUpdates(_0x116f62){return function(_0x50b930){try{jsonpatch['apply'](_0x50b930,_0x116f62,!![]);}catch(_0x1b1092){return BPromise['reject'](_0x1b1092);}return _0x50b930[_0x632b('0x21')]();};}function saveUpdates(_0x1c4530,_0x2a6833){return function(_0x540bfb){if(_0x540bfb){return _0x540bfb[_0x632b('0x22')](_0x1c4530)[_0x632b('0x23')](function(_0x59d83a){return _0x59d83a;});}return null;};}function removeEntity(_0x1db8f5,_0x379dc2){return function(_0x30ffb9){if(_0x30ffb9){return _0x30ffb9[_0x632b('0x24')]()[_0x632b('0x23')](function(){_0x1db8f5[_0x632b('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5e7b20,_0x11fe61){return function(_0x4d3a70){if(!_0x4d3a70){_0x5e7b20[_0x632b('0x25')](0x194);}return _0x4d3a70;};}function handleError(_0x954fa0,_0x5d6855){_0x5d6855=_0x5d6855||0x1f4;return function(_0x273e89){logger[_0x632b('0x26')](_0x273e89[_0x632b('0x27')]);if(_0x273e89[_0x632b('0x28')]){delete _0x273e89[_0x632b('0x28')];}_0x954fa0[_0x632b('0x18')](_0x5d6855)[_0x632b('0x29')](_0x273e89);};}exports[_0x632b('0x2a')]=function(_0x33a625,_0x4f8410){var _0x1bb484={},_0x35348e={},_0x1819fa={'count':0x0,'rows':[]};var _0x3999aa=_[_0x632b('0x2b')](db[_0x632b('0x2c')][_0x632b('0x2d')],function(_0x417d62){return{'name':_0x417d62[_0x632b('0x2e')],'type':_0x417d62[_0x632b('0x2f')][_0x632b('0x30')]};});_0x35348e[_0x632b('0x31')]=_[_0x632b('0x2b')](_0x3999aa,_0x632b('0x28'));_0x35348e[_0x632b('0x32')]=_[_0x632b('0x33')](_0x33a625[_0x632b('0x32')]);_0x35348e[_0x632b('0x34')]=_[_0x632b('0x35')](_0x35348e[_0x632b('0x31')],_0x35348e['query']);_0x1bb484[_0x632b('0x36')]=_[_0x632b('0x35')](_0x35348e[_0x632b('0x31')],qs[_0x632b('0x37')](_0x33a625['query'][_0x632b('0x37')]));_0x1bb484['attributes']=_0x1bb484[_0x632b('0x36')][_0x632b('0x38')]?_0x1bb484['attributes']:_0x35348e[_0x632b('0x31')];if(!_0x33a625[_0x632b('0x32')][_0x632b('0x39')](_0x632b('0x3a'))){_0x1bb484[_0x632b('0x1e')]=qs[_0x632b('0x1e')](_0x33a625[_0x632b('0x32')][_0x632b('0x1e')]);_0x1bb484['offset']=qs['offset'](_0x33a625[_0x632b('0x32')][_0x632b('0x1b')]);}_0x1bb484[_0x632b('0x3b')]=qs[_0x632b('0x3c')](_0x33a625[_0x632b('0x32')][_0x632b('0x3c')]);_0x1bb484[_0x632b('0x3d')]=qs[_0x632b('0x34')](_['pick'](_0x33a625['query'],_0x35348e[_0x632b('0x34')]),_0x3999aa);if(_0x33a625['query'][_0x632b('0x3e')]){_0x1bb484[_0x632b('0x3d')]=_[_0x632b('0x3f')](_0x1bb484[_0x632b('0x3d')],{'$or':_[_0x632b('0x2b')](_0x3999aa,function(_0x38266c){if(_0x38266c[_0x632b('0x2f')]!==_0x632b('0x40')){var _0x2730c2={};_0x2730c2[_0x38266c[_0x632b('0x28')]]={'$like':'%'+_0x33a625[_0x632b('0x32')][_0x632b('0x3e')]+'%'};return _0x2730c2;}})});}_0x1bb484=_[_0x632b('0x3f')]({},_0x1bb484,_0x33a625[_0x632b('0x41')]);var _0x13beaa={'where':_0x1bb484[_0x632b('0x3d')]};return db[_0x632b('0x2c')]['count'](_0x13beaa)['then'](function(_0x58e3cc){_0x1819fa['count']=_0x58e3cc;if(_0x33a625['query'][_0x632b('0x42')]){_0x1bb484['include']=[{'all':!![]}];}return db['SquareMessage']['findAll'](_0x1bb484);})[_0x632b('0x23')](function(_0x4490d4){_0x1819fa[_0x632b('0x43')]=_0x4490d4;return _0x1819fa;})[_0x632b('0x23')](respondWithFilteredResult(_0x4f8410,_0x1bb484))['catch'](handleError(_0x4f8410,null));};exports[_0x632b('0x44')]=function(_0x238297,_0x387fce){var _0x4dbe4b={'raw':!![],'where':{'id':_0x238297[_0x632b('0x45')]['id']}},_0x15bb30={};_0x15bb30[_0x632b('0x31')]=_[_0x632b('0x33')](db[_0x632b('0x2c')][_0x632b('0x2d')]);_0x15bb30['query']=_[_0x632b('0x33')](_0x238297[_0x632b('0x32')]);_0x15bb30[_0x632b('0x34')]=_[_0x632b('0x35')](_0x15bb30['model'],_0x15bb30['query']);_0x4dbe4b[_0x632b('0x36')]=_[_0x632b('0x35')](_0x15bb30[_0x632b('0x31')],qs[_0x632b('0x37')](_0x238297[_0x632b('0x32')][_0x632b('0x37')]));_0x4dbe4b['attributes']=_0x4dbe4b[_0x632b('0x36')][_0x632b('0x38')]?_0x4dbe4b[_0x632b('0x36')]:_0x15bb30[_0x632b('0x31')];if(_0x238297[_0x632b('0x32')][_0x632b('0x42')]){_0x4dbe4b[_0x632b('0x46')]=[{'all':!![]}];}_0x4dbe4b=_[_0x632b('0x3f')]({},_0x4dbe4b,_0x238297['options']);return db[_0x632b('0x2c')]['find'](_0x4dbe4b)[_0x632b('0x23')](handleEntityNotFound(_0x387fce,null))['then'](respondWithResult(_0x387fce,null))[_0x632b('0x47')](handleError(_0x387fce,null));};exports[_0x632b('0x48')]=function(_0x16dfc7,_0x2c4561){return db[_0x632b('0x2c')]['create'](_0x16dfc7[_0x632b('0x49')],{})[_0x632b('0x23')](respondWithResult(_0x2c4561,0xc9))[_0x632b('0x47')](handleError(_0x2c4561,null));};exports['update']=function(_0x253aec,_0x16eb80){if(_0x253aec[_0x632b('0x49')]['id']){delete _0x253aec[_0x632b('0x49')]['id'];}return db[_0x632b('0x2c')]['find']({'where':{'id':_0x253aec[_0x632b('0x45')]['id']}})['then'](handleEntityNotFound(_0x16eb80,null))[_0x632b('0x23')](saveUpdates(_0x253aec[_0x632b('0x49')],null))[_0x632b('0x23')](respondWithResult(_0x16eb80,null))[_0x632b('0x47')](handleError(_0x16eb80,null));};exports[_0x632b('0x24')]=function(_0x52785a,_0x4c9b4e){return db[_0x632b('0x2c')][_0x632b('0x4a')]({'where':{'id':_0x52785a[_0x632b('0x45')]['id']}})[_0x632b('0x23')](handleEntityNotFound(_0x4c9b4e,null))[_0x632b('0x23')](removeEntity(_0x4c9b4e,null))[_0x632b('0x47')](handleError(_0x4c9b4e,null));}; \ No newline at end of file +var _0x3f77=['find','catch','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','destroy','then','error','stack','name','send','index','map','SquareMessage','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','show','params','rawAttributes'];(function(_0x2c7618,_0x26be9c){var _0x5ce3f0=function(_0x1837b3){while(--_0x1837b3){_0x2c7618['push'](_0x2c7618['shift']());}};_0x5ce3f0(++_0x26be9c);}(_0x3f77,0xa0));var _0x73f7=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3f77[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x73f7('0x0'));var rimraf=require(_0x73f7('0x1'));var zipdir=require(_0x73f7('0x2'));var jsonpatch=require(_0x73f7('0x3'));var rp=require(_0x73f7('0x4'));var moment=require('moment');var BPromise=require(_0x73f7('0x5'));var Mustache=require(_0x73f7('0x6'));var util=require(_0x73f7('0x7'));var path=require(_0x73f7('0x8'));var sox=require('sox');var csv=require(_0x73f7('0x9'));var ejs=require(_0x73f7('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x73f7('0xb'));var crypto=require(_0x73f7('0xc'));var jsforce=require(_0x73f7('0xd'));var deskjs=require(_0x73f7('0xe'));var toCsv=require(_0x73f7('0x9'));var querystring=require(_0x73f7('0xf'));var Papa=require('papaparse');var Redis=require(_0x73f7('0x10'));var authService=require(_0x73f7('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x73f7('0x12'));var hardwareService=require(_0x73f7('0x13'));var logger=require(_0x73f7('0x14'))(_0x73f7('0x15'));var utils=require(_0x73f7('0x16'));var config=require(_0x73f7('0x17'));var licenseUtil=require(_0x73f7('0x18'));var db=require(_0x73f7('0x19'))['db'];function respondWithStatusCode(_0x586205,_0x3f9683){_0x3f9683=_0x3f9683||0xcc;return function(_0x35b5ec){if(_0x35b5ec){return _0x586205[_0x73f7('0x1a')](_0x3f9683);}return _0x586205[_0x73f7('0x1b')](_0x3f9683)[_0x73f7('0x1c')]();};}function respondWithResult(_0x1ba096,_0x48b81c){_0x48b81c=_0x48b81c||0xc8;return function(_0x5920ce){if(_0x5920ce){return _0x1ba096[_0x73f7('0x1b')](_0x48b81c)[_0x73f7('0x1d')](_0x5920ce);}};}function respondWithFilteredResult(_0x531125,_0x457444){return function(_0x5f3d20){if(_0x5f3d20){var _0x33add7=typeof _0x457444[_0x73f7('0x1e')]===_0x73f7('0x1f')&&typeof _0x457444['limit']===_0x73f7('0x1f');var _0x4efefe=_0x5f3d20[_0x73f7('0x20')];var _0x1f77b4=_0x33add7?0x0:_0x457444[_0x73f7('0x1e')];var _0x2e0b5d=_0x33add7?_0x5f3d20['count']:_0x457444[_0x73f7('0x1e')]+_0x457444[_0x73f7('0x21')];var _0x4d29b3;if(_0x2e0b5d>=_0x4efefe){_0x2e0b5d=_0x4efefe;_0x4d29b3=0xc8;}else{_0x4d29b3=0xce;}_0x531125[_0x73f7('0x1b')](_0x4d29b3);return _0x531125[_0x73f7('0x22')](_0x73f7('0x23'),_0x1f77b4+'-'+_0x2e0b5d+'/'+_0x4efefe)[_0x73f7('0x1d')](_0x5f3d20);}return null;};}function patchUpdates(_0x2642e5){return function(_0x395a47){try{jsonpatch[_0x73f7('0x24')](_0x395a47,_0x2642e5,!![]);}catch(_0x3f956a){return BPromise[_0x73f7('0x25')](_0x3f956a);}return _0x395a47[_0x73f7('0x26')]();};}function saveUpdates(_0x22741d,_0x42508c){return function(_0x4fdfe3){if(_0x4fdfe3){return _0x4fdfe3[_0x73f7('0x27')](_0x22741d)['then'](function(_0x2d9e76){return _0x2d9e76;});}return null;};}function removeEntity(_0x33b38b,_0x181319){return function(_0x59622a){if(_0x59622a){return _0x59622a[_0x73f7('0x28')]()[_0x73f7('0x29')](function(){_0x33b38b['status'](0xcc)[_0x73f7('0x1c')]();});}};}function handleEntityNotFound(_0x5a661d,_0x145b7d){return function(_0x14c1c8){if(!_0x14c1c8){_0x5a661d[_0x73f7('0x1a')](0x194);}return _0x14c1c8;};}function handleError(_0x29db80,_0x165ce9){_0x165ce9=_0x165ce9||0x1f4;return function(_0x389b03){logger[_0x73f7('0x2a')](_0x389b03[_0x73f7('0x2b')]);if(_0x389b03['name']){delete _0x389b03[_0x73f7('0x2c')];}_0x29db80[_0x73f7('0x1b')](_0x165ce9)[_0x73f7('0x2d')](_0x389b03);};}exports[_0x73f7('0x2e')]=function(_0x4318e1,_0x25445e){var _0x4a7517={},_0x1988cd={},_0xa59252={'count':0x0,'rows':[]};var _0x229eb8=_[_0x73f7('0x2f')](db[_0x73f7('0x30')]['rawAttributes'],function(_0xe4d0ab){return{'name':_0xe4d0ab[_0x73f7('0x31')],'type':_0xe4d0ab[_0x73f7('0x32')][_0x73f7('0x33')]};});_0x1988cd['model']=_[_0x73f7('0x2f')](_0x229eb8,_0x73f7('0x2c'));_0x1988cd[_0x73f7('0x34')]=_[_0x73f7('0x35')](_0x4318e1[_0x73f7('0x34')]);_0x1988cd[_0x73f7('0x36')]=_[_0x73f7('0x37')](_0x1988cd[_0x73f7('0x38')],_0x1988cd[_0x73f7('0x34')]);_0x4a7517[_0x73f7('0x39')]=_[_0x73f7('0x37')](_0x1988cd[_0x73f7('0x38')],qs[_0x73f7('0x3a')](_0x4318e1['query'][_0x73f7('0x3a')]));_0x4a7517[_0x73f7('0x39')]=_0x4a7517[_0x73f7('0x39')][_0x73f7('0x3b')]?_0x4a7517[_0x73f7('0x39')]:_0x1988cd[_0x73f7('0x38')];if(!_0x4318e1['query'][_0x73f7('0x3c')]('nolimit')){_0x4a7517[_0x73f7('0x21')]=qs[_0x73f7('0x21')](_0x4318e1[_0x73f7('0x34')]['limit']);_0x4a7517[_0x73f7('0x1e')]=qs[_0x73f7('0x1e')](_0x4318e1['query'][_0x73f7('0x1e')]);}_0x4a7517[_0x73f7('0x3d')]=qs['sort'](_0x4318e1['query'][_0x73f7('0x3e')]);_0x4a7517[_0x73f7('0x3f')]=qs[_0x73f7('0x36')](_[_0x73f7('0x40')](_0x4318e1['query'],_0x1988cd[_0x73f7('0x36')]),_0x229eb8);if(_0x4318e1['query'][_0x73f7('0x41')]){_0x4a7517['where']=_['merge'](_0x4a7517[_0x73f7('0x3f')],{'$or':_['map'](_0x229eb8,function(_0x21e0a8){if(_0x21e0a8[_0x73f7('0x32')]!=='VIRTUAL'){var _0x3a20a1={};_0x3a20a1[_0x21e0a8[_0x73f7('0x2c')]]={'$like':'%'+_0x4318e1[_0x73f7('0x34')][_0x73f7('0x41')]+'%'};return _0x3a20a1;}})});}_0x4a7517=_[_0x73f7('0x42')]({},_0x4a7517,_0x4318e1[_0x73f7('0x43')]);var _0x257bc3={'where':_0x4a7517[_0x73f7('0x3f')]};return db[_0x73f7('0x30')]['count'](_0x257bc3)[_0x73f7('0x29')](function(_0xc03662){_0xa59252['count']=_0xc03662;if(_0x4318e1[_0x73f7('0x34')][_0x73f7('0x44')]){_0x4a7517[_0x73f7('0x45')]=[{'all':!![]}];}return db['SquareMessage'][_0x73f7('0x46')](_0x4a7517);})[_0x73f7('0x29')](function(_0xe6e888){_0xa59252['rows']=_0xe6e888;return _0xa59252;})[_0x73f7('0x29')](respondWithFilteredResult(_0x25445e,_0x4a7517))['catch'](handleError(_0x25445e,null));};exports[_0x73f7('0x47')]=function(_0x409bbc,_0x297e4f){var _0x3efaf4={'raw':!![],'where':{'id':_0x409bbc[_0x73f7('0x48')]['id']}},_0x3fde05={};_0x3fde05[_0x73f7('0x38')]=_[_0x73f7('0x35')](db[_0x73f7('0x30')][_0x73f7('0x49')]);_0x3fde05[_0x73f7('0x34')]=_[_0x73f7('0x35')](_0x409bbc[_0x73f7('0x34')]);_0x3fde05[_0x73f7('0x36')]=_['intersection'](_0x3fde05[_0x73f7('0x38')],_0x3fde05[_0x73f7('0x34')]);_0x3efaf4['attributes']=_[_0x73f7('0x37')](_0x3fde05['model'],qs[_0x73f7('0x3a')](_0x409bbc[_0x73f7('0x34')]['fields']));_0x3efaf4[_0x73f7('0x39')]=_0x3efaf4[_0x73f7('0x39')][_0x73f7('0x3b')]?_0x3efaf4[_0x73f7('0x39')]:_0x3fde05[_0x73f7('0x38')];if(_0x409bbc['query']['includeAll']){_0x3efaf4[_0x73f7('0x45')]=[{'all':!![]}];}_0x3efaf4=_['merge']({},_0x3efaf4,_0x409bbc[_0x73f7('0x43')]);return db['SquareMessage'][_0x73f7('0x4a')](_0x3efaf4)['then'](handleEntityNotFound(_0x297e4f,null))[_0x73f7('0x29')](respondWithResult(_0x297e4f,null))[_0x73f7('0x4b')](handleError(_0x297e4f,null));};exports[_0x73f7('0x4c')]=function(_0x1115d3,_0x347382){return db['SquareMessage'][_0x73f7('0x4c')](_0x1115d3[_0x73f7('0x4d')],{})[_0x73f7('0x29')](respondWithResult(_0x347382,0xc9))[_0x73f7('0x4b')](handleError(_0x347382,null));};exports[_0x73f7('0x27')]=function(_0x53c1a9,_0x3c2496){if(_0x53c1a9[_0x73f7('0x4d')]['id']){delete _0x53c1a9[_0x73f7('0x4d')]['id'];}return db[_0x73f7('0x30')]['find']({'where':{'id':_0x53c1a9[_0x73f7('0x48')]['id']}})[_0x73f7('0x29')](handleEntityNotFound(_0x3c2496,null))['then'](saveUpdates(_0x53c1a9[_0x73f7('0x4d')],null))[_0x73f7('0x29')](respondWithResult(_0x3c2496,null))['catch'](handleError(_0x3c2496,null));};exports['destroy']=function(_0x2fed40,_0x3304b8){return db[_0x73f7('0x30')][_0x73f7('0x4a')]({'where':{'id':_0x2fed40[_0x73f7('0x48')]['id']}})[_0x73f7('0x29')](handleEntityNotFound(_0x3304b8,null))[_0x73f7('0x29')](removeEntity(_0x3304b8,null))['catch'](handleError(_0x3304b8,null));}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.model.js b/server/api/squareMessage/squareMessage.model.js index ef7dd8f..145c131 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 _0x4b43=['square_messages','util','../../config/logger','moment','request-promise','../../config/environment','./squareMessage.attributes','exports','define','SquareMessage'];(function(_0x10b8cc,_0x1c33ee){var _0x247fe6=function(_0x21c190){while(--_0x21c190){_0x10b8cc['push'](_0x10b8cc['shift']());}};_0x247fe6(++_0x1c33ee);}(_0x4b43,0xab));var _0x34b4=function(_0x400481,_0x3101d5){_0x400481=_0x400481-0x0;var _0x262b3c=_0x4b43[_0x400481];return _0x262b3c;};'use strict';var _=require('lodash');var util=require(_0x34b4('0x0'));var logger=require(_0x34b4('0x1'))('api');var moment=require(_0x34b4('0x2'));var BPromise=require('bluebird');var rp=require(_0x34b4('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x34b4('0x4'));var attributes=require(_0x34b4('0x5'));module[_0x34b4('0x6')]=function(_0x5bef7d,_0x3d86a6){return _0x5bef7d[_0x34b4('0x7')](_0x34b4('0x8'),attributes,{'tableName':_0x34b4('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd97f=['rimraf','../../config/environment','./squareMessage.attributes','exports','define','SquareMessage','square_messages','lodash','util','api','request-promise','path'];(function(_0x51020b,_0x38c2c7){var _0x371e47=function(_0x2a538f){while(--_0x2a538f){_0x51020b['push'](_0x51020b['shift']());}};_0x371e47(++_0x38c2c7);}(_0xd97f,0x1ab));var _0xfd97=function(_0x3efb9b,_0x43b6e8){_0x3efb9b=_0x3efb9b-0x0;var _0xaaa508=_0xd97f[_0x3efb9b];return _0xaaa508;};'use strict';var _=require(_0xfd97('0x0'));var util=require(_0xfd97('0x1'));var logger=require('../../config/logger')(_0xfd97('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xfd97('0x3'));var fs=require('fs');var path=require(_0xfd97('0x4'));var rimraf=require(_0xfd97('0x5'));var config=require(_0xfd97('0x6'));var attributes=require(_0xfd97('0x7'));module[_0xfd97('0x8')]=function(_0xc4ce9b,_0x424eba){return _0xc4ce9b[_0xfd97('0x9')](_0xfd97('0xa'),attributes,{'tableName':_0xfd97('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.rpc.js b/server/api/squareMessage/squareMessage.rpc.js index f57f078..68a0ea5 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 _0x0e1e=['debug','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','then','info','SquareMessage,\x20%s,\x20%s','request\x20sent','SquareMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','CreateSquareMessage','SquareMessage','create','body','options'];(function(_0x4b055c,_0x4b870b){var _0x4b62bb=function(_0x4884c2){while(--_0x4884c2){_0x4b055c['push'](_0x4b055c['shift']());}};_0x4b62bb(++_0x4b870b);}(_0x0e1e,0x10f));var _0xe0e1=function(_0x3a96ca,_0x599d1b){_0x3a96ca=_0x3a96ca-0x0;var _0x52f475=_0x0e1e[_0x3a96ca];return _0x52f475;};'use strict';var _=require(_0xe0e1('0x0'));var util=require(_0xe0e1('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xe0e1('0x2'));var fs=require('fs');var Redis=require(_0xe0e1('0x3'));var db=require(_0xe0e1('0x4'))['db'];var utils=require(_0xe0e1('0x5'));var logger=require(_0xe0e1('0x6'))(_0xe0e1('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xe0e1('0x8')][_0xe0e1('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x366fda,_0x300ff4,_0x467603){return new BPromise(function(_0x41a926,_0x12cc6a){return client[_0xe0e1('0xa')](_0x366fda,_0x467603)[_0xe0e1('0xb')](function(_0x2c9fd6){logger[_0xe0e1('0xc')](_0xe0e1('0xd'),_0x300ff4,_0xe0e1('0xe'));logger['debug'](_0xe0e1('0xf'),_0x300ff4,_0xe0e1('0xe'),JSON[_0xe0e1('0x10')](_0x2c9fd6));if(_0x2c9fd6[_0xe0e1('0x11')]){if(_0x2c9fd6['error'][_0xe0e1('0x12')]===0x1f4){logger['error']('SquareMessage,\x20%s,\x20%s',_0x300ff4,_0x2c9fd6[_0xe0e1('0x11')][_0xe0e1('0x13')]);return _0x12cc6a(_0x2c9fd6[_0xe0e1('0x11')][_0xe0e1('0x13')]);}logger['error'](_0xe0e1('0xd'),_0x300ff4,_0x2c9fd6[_0xe0e1('0x11')][_0xe0e1('0x13')]);return _0x41a926(_0x2c9fd6['error'][_0xe0e1('0x13')]);}else{logger['info'](_0xe0e1('0xd'),_0x300ff4,_0xe0e1('0xe'));_0x41a926(_0x2c9fd6['result']['message']);}})[_0xe0e1('0x14')](function(_0x3f29fe){logger[_0xe0e1('0x11')](_0xe0e1('0xd'),_0x300ff4,_0x3f29fe);_0x12cc6a(_0x3f29fe);});});}exports[_0xe0e1('0x15')]=function(_0x5ea93c){var _0x43cc4c=this;return new Promise(function(_0x4a5683,_0x93d5ef){return db[_0xe0e1('0x16')][_0xe0e1('0x17')](_0x5ea93c[_0xe0e1('0x18')],{'raw':_0x5ea93c[_0xe0e1('0x19')]?_0x5ea93c[_0xe0e1('0x19')]['raw']===undefined?!![]:![]:!![]})[_0xe0e1('0xb')](function(_0x4a3a64){logger[_0xe0e1('0xc')]('CreateSquareMessage',_0x5ea93c);logger[_0xe0e1('0x1a')](_0xe0e1('0x15'),_0x5ea93c,JSON[_0xe0e1('0x10')](_0x4a3a64));_0x4a5683(_0x4a3a64);})[_0xe0e1('0x14')](function(_0xa64e20){logger['error'](_0xe0e1('0x15'),_0xa64e20[_0xe0e1('0x13')],_0x5ea93c);_0x93d5ef(_0x43cc4c[_0xe0e1('0x11')](0x1f4,_0xa64e20['message']));});});}; \ No newline at end of file +var _0x2938=['../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','then','info','request\x20sent','SquareMessage,\x20%s,\x20%s,\x20%s','error','message','SquareMessage,\x20%s,\x20%s','result','catch','CreateSquareMessage','body','options','raw','debug','stringify','lodash','util','bluebird','ioredis'];(function(_0x17f9b8,_0x579c3e){var _0x43e7e6=function(_0x29d37d){while(--_0x29d37d){_0x17f9b8['push'](_0x17f9b8['shift']());}};_0x43e7e6(++_0x579c3e);}(_0x2938,0xe6));var _0x8293=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x2938[_0x397e5f];return _0x5302b8;};'use strict';var _=require(_0x8293('0x0'));var util=require(_0x8293('0x1'));var moment=require('moment');var BPromise=require(_0x8293('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8293('0x3'));var db=require(_0x8293('0x4'))['db'];var utils=require(_0x8293('0x5'));var logger=require(_0x8293('0x6'))('rpc');var config=require(_0x8293('0x7'));var jayson=require(_0x8293('0x8'));var client=jayson[_0x8293('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1f92f2,_0x5b82cd,_0x3f3ec5){return new BPromise(function(_0x31221b,_0x41a880){return client[_0x8293('0xa')](_0x1f92f2,_0x3f3ec5)[_0x8293('0xb')](function(_0x440d2c){logger[_0x8293('0xc')]('SquareMessage,\x20%s,\x20%s',_0x5b82cd,_0x8293('0xd'));logger['debug'](_0x8293('0xe'),_0x5b82cd,_0x8293('0xd'),JSON['stringify'](_0x440d2c));if(_0x440d2c[_0x8293('0xf')]){if(_0x440d2c['error']['code']===0x1f4){logger[_0x8293('0xf')]('SquareMessage,\x20%s,\x20%s',_0x5b82cd,_0x440d2c['error'][_0x8293('0x10')]);return _0x41a880(_0x440d2c[_0x8293('0xf')][_0x8293('0x10')]);}logger[_0x8293('0xf')](_0x8293('0x11'),_0x5b82cd,_0x440d2c[_0x8293('0xf')][_0x8293('0x10')]);return _0x31221b(_0x440d2c['error'][_0x8293('0x10')]);}else{logger['info'](_0x8293('0x11'),_0x5b82cd,_0x8293('0xd'));_0x31221b(_0x440d2c[_0x8293('0x12')][_0x8293('0x10')]);}})[_0x8293('0x13')](function(_0x1886ad){logger['error'](_0x8293('0x11'),_0x5b82cd,_0x1886ad);_0x41a880(_0x1886ad);});});}exports[_0x8293('0x14')]=function(_0x153524){var _0xb9d728=this;return new Promise(function(_0x4b8f10,_0xc155c7){return db['SquareMessage']['create'](_0x153524[_0x8293('0x15')],{'raw':_0x153524[_0x8293('0x16')]?_0x153524['options'][_0x8293('0x17')]===undefined?!![]:![]:!![]})[_0x8293('0xb')](function(_0x18ec67){logger[_0x8293('0xc')]('CreateSquareMessage',_0x153524);logger[_0x8293('0x18')](_0x8293('0x14'),_0x153524,JSON[_0x8293('0x19')](_0x18ec67));_0x4b8f10(_0x18ec67);})[_0x8293('0x13')](function(_0x1db657){logger[_0x8293('0xf')](_0x8293('0x14'),_0x1db657[_0x8293('0x10')],_0x153524);_0xc155c7(_0xb9d728[_0x8293('0xf')](0x1f4,_0x1db657[_0x8293('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/squareOdbc/index.js b/server/api/squareOdbc/index.js index 1b986fe..f9ae9c3 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 _0x69f1=['isAuthenticated','index','/:id','show','/:id/test','15s','test','post','delete','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareOdbc.controller','get'];(function(_0x838813,_0x448f0f){var _0x2bd32d=function(_0x57b589){while(--_0x57b589){_0x838813['push'](_0x838813['shift']());}};_0x2bd32d(++_0x448f0f);}(_0x69f1,0x1c3));var _0x169f=function(_0x34ab95,_0x2ac862){_0x34ab95=_0x34ab95-0x0;var _0x2eaccd=_0x69f1[_0x34ab95];return _0x2eaccd;};'use strict';var multer=require(_0x169f('0x0'));var util=require(_0x169f('0x1'));var path=require(_0x169f('0x2'));var timeout=require(_0x169f('0x3'));var express=require('express');var router=express[_0x169f('0x4')]();var fs_extra=require(_0x169f('0x5'));var auth=require(_0x169f('0x6'));var interaction=require(_0x169f('0x7'));var config=require(_0x169f('0x8'));var controller=require(_0x169f('0x9'));router[_0x169f('0xa')]('/',auth[_0x169f('0xb')](),controller[_0x169f('0xc')]);router[_0x169f('0xa')](_0x169f('0xd'),auth[_0x169f('0xb')](),controller[_0x169f('0xe')]);router[_0x169f('0xa')](_0x169f('0xf'),auth[_0x169f('0xb')](),timeout(_0x169f('0x10')),controller[_0x169f('0x11')]);router[_0x169f('0x12')]('/',auth[_0x169f('0xb')](),controller['create']);router['put'](_0x169f('0xd'),auth[_0x169f('0xb')](),controller['update']);router[_0x169f('0x13')](_0x169f('0xd'),auth['isAuthenticated'](),controller['destroy']);module[_0x169f('0x14')]=router; \ No newline at end of file +var _0xd1e8=['exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareOdbc.controller','isAuthenticated','index','get','show','/:id/test','15s','test','create','put','/:id','delete'];(function(_0x2af2f9,_0x5bd215){var _0x527f4a=function(_0x2253f1){while(--_0x2253f1){_0x2af2f9['push'](_0x2af2f9['shift']());}};_0x527f4a(++_0x5bd215);}(_0xd1e8,0x1a3));var _0x8d1e=function(_0x3a5eb3,_0x346050){_0x3a5eb3=_0x3a5eb3-0x0;var _0x4d2e43=_0xd1e8[_0x3a5eb3];return _0x4d2e43;};'use strict';var multer=require('multer');var util=require(_0x8d1e('0x0'));var path=require(_0x8d1e('0x1'));var timeout=require(_0x8d1e('0x2'));var express=require(_0x8d1e('0x3'));var router=express[_0x8d1e('0x4')]();var fs_extra=require(_0x8d1e('0x5'));var auth=require(_0x8d1e('0x6'));var interaction=require(_0x8d1e('0x7'));var config=require(_0x8d1e('0x8'));var controller=require(_0x8d1e('0x9'));router['get']('/',auth[_0x8d1e('0xa')](),controller[_0x8d1e('0xb')]);router[_0x8d1e('0xc')]('/:id',auth[_0x8d1e('0xa')](),controller[_0x8d1e('0xd')]);router[_0x8d1e('0xc')](_0x8d1e('0xe'),auth[_0x8d1e('0xa')](),timeout(_0x8d1e('0xf')),controller[_0x8d1e('0x10')]);router['post']('/',auth[_0x8d1e('0xa')](),controller[_0x8d1e('0x11')]);router[_0x8d1e('0x12')](_0x8d1e('0x13'),auth[_0x8d1e('0xa')](),controller['update']);router[_0x8d1e('0x14')]('/:id',auth[_0x8d1e('0xa')](),controller['destroy']);module[_0x8d1e('0x15')]=router; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.attributes.js b/server/api/squareOdbc/squareOdbc.attributes.js index 172314a..5d6acd1 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 _0xf049=['exports','name','STRING','sequelize'];(function(_0x4d3222,_0x32f709){var _0x3aba50=function(_0xb9ed3b){while(--_0xb9ed3b){_0x4d3222['push'](_0x4d3222['shift']());}};_0x3aba50(++_0x32f709);}(_0xf049,0xa7));var _0x9f04=function(_0x27ba56,_0x46f4f1){_0x27ba56=_0x27ba56-0x0;var _0x1be04e=_0xf049[_0x27ba56];return _0x1be04e;};'use strict';var Sequelize=require(_0x9f04('0x0'));module[_0x9f04('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x9f04('0x2'),'allowNull':![]},'dsn':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x9f04('0x3')]}}; \ No newline at end of file +var _0xb7c7=['STRING','name'];(function(_0x28947d,_0x4cc9c6){var _0x12d2ee=function(_0x3f38fc){while(--_0x3f38fc){_0x28947d['push'](_0x28947d['shift']());}};_0x12d2ee(++_0x4cc9c6);}(_0xb7c7,0xef));var _0x7b7c=function(_0x3e0dc4,_0x13971b){_0x3e0dc4=_0x3e0dc4-0x0;var _0x586111=_0xb7c7[_0x3e0dc4];return _0x586111;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0x7b7c('0x0'),'allowNull':![]},'dsn':{'type':Sequelize[_0x7b7c('0x1')]},'description':{'type':Sequelize[_0x7b7c('0x1')]}}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.controller.js b/server/api/squareOdbc/squareOdbc.controller.js index eb557b3..d05f4f5 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 _0x8640=['index','map','SquareOdbc','fieldName','type','key','model','query','filters','intersection','fields','attributes','nolimit','order','sort','pick','filter','merge','where','VIRTUAL','options','include','findAll','show','params','keys','rawAttributes','length','includeAll','find','create','body','user','get','role','UserProfileSection','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','catch','test','dsn','odbc','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/license/util','../../mysqldb','status','end','json','undefined','limit','count','offset','Content-Range','apply','reject','save','update','then','destroy','ODBC','error','stack','name','send'];(function(_0xff6cdf,_0x2c0585){var _0x125037=function(_0x15c39e){while(--_0x15c39e){_0xff6cdf['push'](_0xff6cdf['shift']());}};_0x125037(++_0x2c0585);}(_0x8640,0x1c9));var _0x0864=function(_0xcaf3bf,_0x213580){_0xcaf3bf=_0xcaf3bf-0x0;var _0x45c7f2=_0x8640[_0xcaf3bf];return _0x45c7f2;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x0864('0x0'));var jsonpatch=require(_0x0864('0x1'));var rp=require(_0x0864('0x2'));var moment=require(_0x0864('0x3'));var BPromise=require(_0x0864('0x4'));var Mustache=require(_0x0864('0x5'));var util=require(_0x0864('0x6'));var path=require(_0x0864('0x7'));var sox=require(_0x0864('0x8'));var csv=require(_0x0864('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0864('0xa'));var _=require(_0x0864('0xb'));var squel=require(_0x0864('0xc'));var crypto=require(_0x0864('0xd'));var jsforce=require(_0x0864('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x0864('0x9'));var querystring=require('querystring');var Papa=require(_0x0864('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x0864('0x10'));var as=require(_0x0864('0x11'));var hardwareService=require(_0x0864('0x12'));var logger=require('../../config/logger')('api');var utils=require(_0x0864('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x0864('0x14'));var db=require(_0x0864('0x15'))['db'];function respondWithStatusCode(_0xde3343,_0x4ea35e){_0x4ea35e=_0x4ea35e||0xcc;return function(_0x14a19d){if(_0x14a19d){return _0xde3343['sendStatus'](_0x4ea35e);}return _0xde3343[_0x0864('0x16')](_0x4ea35e)[_0x0864('0x17')]();};}function respondWithResult(_0x509368,_0x2be0cd){_0x2be0cd=_0x2be0cd||0xc8;return function(_0x17aeea){if(_0x17aeea){return _0x509368[_0x0864('0x16')](_0x2be0cd)[_0x0864('0x18')](_0x17aeea);}};}function respondWithFilteredResult(_0x415f67,_0x1b1e2d){return function(_0x8b17c6){if(_0x8b17c6){var _0x60ca1d=typeof _0x1b1e2d['offset']===_0x0864('0x19')&&typeof _0x1b1e2d[_0x0864('0x1a')]===_0x0864('0x19');var _0x5c3626=_0x8b17c6[_0x0864('0x1b')];var _0xa205f5=_0x60ca1d?0x0:_0x1b1e2d[_0x0864('0x1c')];var _0x4107cf=_0x60ca1d?_0x8b17c6['count']:_0x1b1e2d[_0x0864('0x1c')]+_0x1b1e2d['limit'];var _0x42fc55;if(_0x4107cf>=_0x5c3626){_0x4107cf=_0x5c3626;_0x42fc55=0xc8;}else{_0x42fc55=0xce;}_0x415f67[_0x0864('0x16')](_0x42fc55);return _0x415f67['set'](_0x0864('0x1d'),_0xa205f5+'-'+_0x4107cf+'/'+_0x5c3626)[_0x0864('0x18')](_0x8b17c6);}return null;};}function patchUpdates(_0x26b4f8){return function(_0x48f544){try{jsonpatch[_0x0864('0x1e')](_0x48f544,_0x26b4f8,!![]);}catch(_0x5ed823){return BPromise[_0x0864('0x1f')](_0x5ed823);}return _0x48f544[_0x0864('0x20')]();};}function saveUpdates(_0x581bc3,_0x450b97){return function(_0x54ab7b){if(_0x54ab7b){return _0x54ab7b[_0x0864('0x21')](_0x581bc3)[_0x0864('0x22')](function(_0x44e5a0){return _0x44e5a0;});}return null;};}function removeEntity(_0x190f57,_0x361ad2){return function(_0x5abfa5){if(_0x5abfa5){return _0x5abfa5[_0x0864('0x23')]()[_0x0864('0x22')](function(){var _0x27bd8a=_0x5abfa5['get']({'plain':!![]});var _0x30a3fa=_0x0864('0x24');return db['UserProfileResource'][_0x0864('0x23')]({'where':{'type':_0x30a3fa,'resourceId':_0x27bd8a['id']}})['then'](function(){return _0x5abfa5;});})['then'](function(){_0x190f57[_0x0864('0x16')](0xcc)[_0x0864('0x17')]();});}};}function handleEntityNotFound(_0x2948eb,_0x3ef70f){return function(_0x3134f6){if(!_0x3134f6){_0x2948eb['sendStatus'](0x194);}return _0x3134f6;};}function handleError(_0x70fa81,_0x4ae8cc){_0x4ae8cc=_0x4ae8cc||0x1f4;return function(_0xdac18e){logger[_0x0864('0x25')](_0xdac18e[_0x0864('0x26')]);if(_0xdac18e['name']){delete _0xdac18e[_0x0864('0x27')];}_0x70fa81[_0x0864('0x16')](_0x4ae8cc)[_0x0864('0x28')](_0xdac18e);};}exports[_0x0864('0x29')]=function(_0x23a78e,_0x8674ed){var _0x50569a={},_0x2322ed={},_0x44c18d={'count':0x0,'rows':[]};var _0x52f677=_[_0x0864('0x2a')](db[_0x0864('0x2b')]['rawAttributes'],function(_0xc3dd12){return{'name':_0xc3dd12[_0x0864('0x2c')],'type':_0xc3dd12[_0x0864('0x2d')][_0x0864('0x2e')]};});_0x2322ed[_0x0864('0x2f')]=_['map'](_0x52f677,_0x0864('0x27'));_0x2322ed[_0x0864('0x30')]=_['keys'](_0x23a78e[_0x0864('0x30')]);_0x2322ed[_0x0864('0x31')]=_[_0x0864('0x32')](_0x2322ed['model'],_0x2322ed[_0x0864('0x30')]);_0x50569a['attributes']=_[_0x0864('0x32')](_0x2322ed[_0x0864('0x2f')],qs[_0x0864('0x33')](_0x23a78e['query'][_0x0864('0x33')]));_0x50569a[_0x0864('0x34')]=_0x50569a[_0x0864('0x34')]['length']?_0x50569a[_0x0864('0x34')]:_0x2322ed[_0x0864('0x2f')];if(!_0x23a78e['query']['hasOwnProperty'](_0x0864('0x35'))){_0x50569a[_0x0864('0x1a')]=qs['limit'](_0x23a78e[_0x0864('0x30')][_0x0864('0x1a')]);_0x50569a[_0x0864('0x1c')]=qs[_0x0864('0x1c')](_0x23a78e[_0x0864('0x30')][_0x0864('0x1c')]);}_0x50569a[_0x0864('0x36')]=qs[_0x0864('0x37')](_0x23a78e['query'][_0x0864('0x37')]);_0x50569a['where']=qs[_0x0864('0x31')](_[_0x0864('0x38')](_0x23a78e['query'],_0x2322ed[_0x0864('0x31')]),_0x52f677);if(_0x23a78e[_0x0864('0x30')][_0x0864('0x39')]){_0x50569a['where']=_[_0x0864('0x3a')](_0x50569a[_0x0864('0x3b')],{'$or':_[_0x0864('0x2a')](_0x52f677,function(_0x26c1c7){if(_0x26c1c7[_0x0864('0x2d')]!==_0x0864('0x3c')){var _0x406e43={};_0x406e43[_0x26c1c7['name']]={'$like':'%'+_0x23a78e[_0x0864('0x30')][_0x0864('0x39')]+'%'};return _0x406e43;}})});}_0x50569a=_[_0x0864('0x3a')]({},_0x50569a,_0x23a78e[_0x0864('0x3d')]);var _0x4870f6={'where':_0x50569a['where']};return db[_0x0864('0x2b')][_0x0864('0x1b')](_0x4870f6)[_0x0864('0x22')](function(_0x4d7a01){_0x44c18d[_0x0864('0x1b')]=_0x4d7a01;if(_0x23a78e[_0x0864('0x30')]['includeAll']){_0x50569a[_0x0864('0x3e')]=[{'all':!![]}];}return db[_0x0864('0x2b')][_0x0864('0x3f')](_0x50569a);})[_0x0864('0x22')](function(_0x421611){_0x44c18d['rows']=_0x421611;return _0x44c18d;})['then'](respondWithFilteredResult(_0x8674ed,_0x50569a))['catch'](handleError(_0x8674ed,null));};exports[_0x0864('0x40')]=function(_0x9794be,_0x23d379){var _0x5b2f97={'raw':!![],'where':{'id':_0x9794be[_0x0864('0x41')]['id']}},_0x199eae={};_0x199eae[_0x0864('0x2f')]=_[_0x0864('0x42')](db[_0x0864('0x2b')][_0x0864('0x43')]);_0x199eae[_0x0864('0x30')]=_['keys'](_0x9794be[_0x0864('0x30')]);_0x199eae[_0x0864('0x31')]=_['intersection'](_0x199eae[_0x0864('0x2f')],_0x199eae[_0x0864('0x30')]);_0x5b2f97[_0x0864('0x34')]=_['intersection'](_0x199eae[_0x0864('0x2f')],qs[_0x0864('0x33')](_0x9794be['query']['fields']));_0x5b2f97[_0x0864('0x34')]=_0x5b2f97['attributes'][_0x0864('0x44')]?_0x5b2f97[_0x0864('0x34')]:_0x199eae['model'];if(_0x9794be['query'][_0x0864('0x45')]){_0x5b2f97[_0x0864('0x3e')]=[{'all':!![]}];}_0x5b2f97=_[_0x0864('0x3a')]({},_0x5b2f97,_0x9794be[_0x0864('0x3d')]);return db[_0x0864('0x2b')][_0x0864('0x46')](_0x5b2f97)[_0x0864('0x22')](handleEntityNotFound(_0x23d379,null))['then'](respondWithResult(_0x23d379,null))['catch'](handleError(_0x23d379,null));};exports[_0x0864('0x47')]=function(_0x30daa0,_0x1e92b5){return db['SquareOdbc']['create'](_0x30daa0[_0x0864('0x48')],{})['then'](function(_0x3c7a80){var _0x2df8b6=_0x30daa0[_0x0864('0x49')][_0x0864('0x4a')]({'plain':!![]});if(!_0x2df8b6)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2df8b6[_0x0864('0x4b')]==='user'){var _0x32ae48=_0x3c7a80[_0x0864('0x4a')]({'plain':!![]});var _0x59b25e=_0x0864('0x24');return db[_0x0864('0x4c')][_0x0864('0x46')]({'where':{'name':_0x59b25e,'userProfileId':_0x2df8b6['userProfileId']},'raw':!![]})[_0x0864('0x22')](function(_0x536fde){if(_0x536fde&&_0x536fde['autoAssociation']===0x0){return db[_0x0864('0x4d')]['create']({'name':_0x32ae48[_0x0864('0x27')],'resourceId':_0x32ae48['id'],'type':_0x536fde[_0x0864('0x27')],'sectionId':_0x536fde['id']},{})[_0x0864('0x22')](function(){return _0x3c7a80;});}else{return _0x3c7a80;}})['catch'](function(_0x6d497d){logger[_0x0864('0x25')](_0x0864('0x4e'),_0x6d497d);throw _0x6d497d;});}return _0x3c7a80;})[_0x0864('0x22')](respondWithResult(_0x1e92b5,0xc9))['catch'](handleError(_0x1e92b5,null));};exports[_0x0864('0x21')]=function(_0x1c4bd4,_0x31ee1d){if(_0x1c4bd4[_0x0864('0x48')]['id']){delete _0x1c4bd4[_0x0864('0x48')]['id'];}return db[_0x0864('0x2b')]['find']({'where':{'id':_0x1c4bd4['params']['id']}})[_0x0864('0x22')](handleEntityNotFound(_0x31ee1d,null))[_0x0864('0x22')](saveUpdates(_0x1c4bd4[_0x0864('0x48')],null))[_0x0864('0x22')](respondWithResult(_0x31ee1d,null))[_0x0864('0x4f')](handleError(_0x31ee1d,null));};exports[_0x0864('0x23')]=function(_0x119810,_0x24dc4b){return db['SquareOdbc']['find']({'where':{'id':_0x119810[_0x0864('0x41')]['id']}})[_0x0864('0x22')](handleEntityNotFound(_0x24dc4b,null))[_0x0864('0x22')](removeEntity(_0x24dc4b,null))['catch'](handleError(_0x24dc4b,null));};exports[_0x0864('0x50')]=function(_0x29d530,_0x3b6fc5,_0x47d6b9){var _0x5a2741;return db[_0x0864('0x2b')][_0x0864('0x46')]({'where':{'id':_0x29d530['params']['id']},'attributes':['id',_0x0864('0x51')]})['then'](handleEntityNotFound(_0x3b6fc5,null))['then'](function(_0x1f3f12){if(_0x1f3f12){var _0x3e19c3=require(_0x0864('0x52'))();_0x3e19c3['openSync'](_0x1f3f12[_0x0864('0x51')]);_0x3e19c3['closeSync']();return _0x1f3f12;}})[_0x0864('0x22')](respondWithResult(_0x3b6fc5,null))[_0x0864('0x4f')](handleError(_0x3b6fc5,null));}; \ No newline at end of file +var _0xeccf=['api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','destroy','ODBC','UserProfileResource','error','name','index','map','SquareOdbc','rawAttributes','fieldName','model','query','keys','filters','attributes','fields','length','hasOwnProperty','order','sort','pick','filter','where','type','VIRTUAL','merge','include','catch','params','intersection','create','body','user','get','role','UserProfileSection','find','userProfileId','autoAssociation','test','dsn','odbc','openSync','closeSync','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger'];(function(_0x5e31e2,_0x273090){var _0x294e2c=function(_0x20ab82){while(--_0x20ab82){_0x5e31e2['push'](_0x5e31e2['shift']());}};_0x294e2c(++_0x273090);}(_0xeccf,0x1ed));var _0xfecc=function(_0x4f5567,_0x41d109){_0x4f5567=_0x4f5567-0x0;var _0x5c5bce=_0xeccf[_0x4f5567];return _0x5c5bce;};'use strict';var emlformat=require(_0xfecc('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xfecc('0x1'));var jsonpatch=require(_0xfecc('0x2'));var rp=require(_0xfecc('0x3'));var moment=require(_0xfecc('0x4'));var BPromise=require(_0xfecc('0x5'));var Mustache=require(_0xfecc('0x6'));var util=require(_0xfecc('0x7'));var path=require('path');var sox=require(_0xfecc('0x8'));var csv=require(_0xfecc('0x9'));var ejs=require(_0xfecc('0xa'));var fs=require('fs');var fs_extra=require(_0xfecc('0xb'));var _=require(_0xfecc('0xc'));var squel=require(_0xfecc('0xd'));var crypto=require(_0xfecc('0xe'));var jsforce=require(_0xfecc('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xfecc('0x9'));var querystring=require(_0xfecc('0x10'));var Papa=require(_0xfecc('0x11'));var Redis=require(_0xfecc('0x12'));var authService=require(_0xfecc('0x13'));var qs=require(_0xfecc('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xfecc('0x15'));var logger=require(_0xfecc('0x16'))(_0xfecc('0x17'));var utils=require(_0xfecc('0x18'));var config=require(_0xfecc('0x19'));var licenseUtil=require(_0xfecc('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2a3eb6,_0x49a0eb){_0x49a0eb=_0x49a0eb||0xcc;return function(_0x59ef9){if(_0x59ef9){return _0x2a3eb6[_0xfecc('0x1b')](_0x49a0eb);}return _0x2a3eb6[_0xfecc('0x1c')](_0x49a0eb)[_0xfecc('0x1d')]();};}function respondWithResult(_0x1f09c5,_0xef80ca){_0xef80ca=_0xef80ca||0xc8;return function(_0x3be54e){if(_0x3be54e){return _0x1f09c5[_0xfecc('0x1c')](_0xef80ca)['json'](_0x3be54e);}};}function respondWithFilteredResult(_0x488f18,_0x1af8e4){return function(_0x5d4822){if(_0x5d4822){var _0x4efe76=typeof _0x1af8e4[_0xfecc('0x1e')]===_0xfecc('0x1f')&&typeof _0x1af8e4[_0xfecc('0x20')]===_0xfecc('0x1f');var _0x391dfc=_0x5d4822[_0xfecc('0x21')];var _0x551342=_0x4efe76?0x0:_0x1af8e4[_0xfecc('0x1e')];var _0x227b4f=_0x4efe76?_0x5d4822[_0xfecc('0x21')]:_0x1af8e4['offset']+_0x1af8e4['limit'];var _0xa6bcbd;if(_0x227b4f>=_0x391dfc){_0x227b4f=_0x391dfc;_0xa6bcbd=0xc8;}else{_0xa6bcbd=0xce;}_0x488f18[_0xfecc('0x1c')](_0xa6bcbd);return _0x488f18[_0xfecc('0x22')](_0xfecc('0x23'),_0x551342+'-'+_0x227b4f+'/'+_0x391dfc)[_0xfecc('0x24')](_0x5d4822);}return null;};}function patchUpdates(_0x5bfeac){return function(_0x295fce){try{jsonpatch[_0xfecc('0x25')](_0x295fce,_0x5bfeac,!![]);}catch(_0x14811e){return BPromise[_0xfecc('0x26')](_0x14811e);}return _0x295fce[_0xfecc('0x27')]();};}function saveUpdates(_0x5fd6f8,_0x415063){return function(_0x4a4809){if(_0x4a4809){return _0x4a4809[_0xfecc('0x28')](_0x5fd6f8)[_0xfecc('0x29')](function(_0x4cc0f2){return _0x4cc0f2;});}return null;};}function removeEntity(_0xc6665c,_0x36f6d3){return function(_0x31cc82){if(_0x31cc82){return _0x31cc82[_0xfecc('0x2a')]()[_0xfecc('0x29')](function(){var _0x5cc63f=_0x31cc82['get']({'plain':!![]});var _0x5917be=_0xfecc('0x2b');return db[_0xfecc('0x2c')][_0xfecc('0x2a')]({'where':{'type':_0x5917be,'resourceId':_0x5cc63f['id']}})[_0xfecc('0x29')](function(){return _0x31cc82;});})['then'](function(){_0xc6665c['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x407f82,_0x540caf){return function(_0x1fc5e2){if(!_0x1fc5e2){_0x407f82[_0xfecc('0x1b')](0x194);}return _0x1fc5e2;};}function handleError(_0x5d49a7,_0x19d966){_0x19d966=_0x19d966||0x1f4;return function(_0xfdb854){logger[_0xfecc('0x2d')](_0xfdb854['stack']);if(_0xfdb854[_0xfecc('0x2e')]){delete _0xfdb854[_0xfecc('0x2e')];}_0x5d49a7[_0xfecc('0x1c')](_0x19d966)['send'](_0xfdb854);};}exports[_0xfecc('0x2f')]=function(_0x16f374,_0x2aacbb){var _0x272487={},_0x447321={},_0x2be189={'count':0x0,'rows':[]};var _0x53016a=_[_0xfecc('0x30')](db[_0xfecc('0x31')][_0xfecc('0x32')],function(_0x59a0b2){return{'name':_0x59a0b2[_0xfecc('0x33')],'type':_0x59a0b2['type']['key']};});_0x447321[_0xfecc('0x34')]=_[_0xfecc('0x30')](_0x53016a,_0xfecc('0x2e'));_0x447321[_0xfecc('0x35')]=_[_0xfecc('0x36')](_0x16f374[_0xfecc('0x35')]);_0x447321[_0xfecc('0x37')]=_['intersection'](_0x447321[_0xfecc('0x34')],_0x447321[_0xfecc('0x35')]);_0x272487[_0xfecc('0x38')]=_['intersection'](_0x447321['model'],qs['fields'](_0x16f374['query'][_0xfecc('0x39')]));_0x272487['attributes']=_0x272487['attributes'][_0xfecc('0x3a')]?_0x272487['attributes']:_0x447321['model'];if(!_0x16f374[_0xfecc('0x35')][_0xfecc('0x3b')]('nolimit')){_0x272487[_0xfecc('0x20')]=qs[_0xfecc('0x20')](_0x16f374[_0xfecc('0x35')][_0xfecc('0x20')]);_0x272487[_0xfecc('0x1e')]=qs['offset'](_0x16f374[_0xfecc('0x35')][_0xfecc('0x1e')]);}_0x272487[_0xfecc('0x3c')]=qs[_0xfecc('0x3d')](_0x16f374['query'][_0xfecc('0x3d')]);_0x272487['where']=qs['filters'](_[_0xfecc('0x3e')](_0x16f374[_0xfecc('0x35')],_0x447321[_0xfecc('0x37')]),_0x53016a);if(_0x16f374[_0xfecc('0x35')][_0xfecc('0x3f')]){_0x272487[_0xfecc('0x40')]=_['merge'](_0x272487[_0xfecc('0x40')],{'$or':_[_0xfecc('0x30')](_0x53016a,function(_0x385004){if(_0x385004[_0xfecc('0x41')]!==_0xfecc('0x42')){var _0x1dc232={};_0x1dc232[_0x385004['name']]={'$like':'%'+_0x16f374[_0xfecc('0x35')][_0xfecc('0x3f')]+'%'};return _0x1dc232;}})});}_0x272487=_[_0xfecc('0x43')]({},_0x272487,_0x16f374['options']);var _0x409a3d={'where':_0x272487[_0xfecc('0x40')]};return db[_0xfecc('0x31')][_0xfecc('0x21')](_0x409a3d)[_0xfecc('0x29')](function(_0xd7c9e2){_0x2be189[_0xfecc('0x21')]=_0xd7c9e2;if(_0x16f374['query']['includeAll']){_0x272487[_0xfecc('0x44')]=[{'all':!![]}];}return db[_0xfecc('0x31')]['findAll'](_0x272487);})[_0xfecc('0x29')](function(_0x4fd194){_0x2be189['rows']=_0x4fd194;return _0x2be189;})[_0xfecc('0x29')](respondWithFilteredResult(_0x2aacbb,_0x272487))[_0xfecc('0x45')](handleError(_0x2aacbb,null));};exports['show']=function(_0x1a5deb,_0x2231c2){var _0x4a3bb5={'raw':!![],'where':{'id':_0x1a5deb[_0xfecc('0x46')]['id']}},_0x675f01={};_0x675f01[_0xfecc('0x34')]=_[_0xfecc('0x36')](db[_0xfecc('0x31')][_0xfecc('0x32')]);_0x675f01[_0xfecc('0x35')]=_[_0xfecc('0x36')](_0x1a5deb[_0xfecc('0x35')]);_0x675f01['filters']=_[_0xfecc('0x47')](_0x675f01[_0xfecc('0x34')],_0x675f01[_0xfecc('0x35')]);_0x4a3bb5['attributes']=_[_0xfecc('0x47')](_0x675f01['model'],qs[_0xfecc('0x39')](_0x1a5deb['query'][_0xfecc('0x39')]));_0x4a3bb5['attributes']=_0x4a3bb5[_0xfecc('0x38')]['length']?_0x4a3bb5[_0xfecc('0x38')]:_0x675f01['model'];if(_0x1a5deb[_0xfecc('0x35')]['includeAll']){_0x4a3bb5[_0xfecc('0x44')]=[{'all':!![]}];}_0x4a3bb5=_[_0xfecc('0x43')]({},_0x4a3bb5,_0x1a5deb['options']);return db['SquareOdbc']['find'](_0x4a3bb5)[_0xfecc('0x29')](handleEntityNotFound(_0x2231c2,null))[_0xfecc('0x29')](respondWithResult(_0x2231c2,null))[_0xfecc('0x45')](handleError(_0x2231c2,null));};exports[_0xfecc('0x48')]=function(_0x209ebd,_0x4fb7e1){return db[_0xfecc('0x31')][_0xfecc('0x48')](_0x209ebd[_0xfecc('0x49')],{})['then'](function(_0x54830b){var _0x426ec0=_0x209ebd[_0xfecc('0x4a')][_0xfecc('0x4b')]({'plain':!![]});if(!_0x426ec0)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x426ec0[_0xfecc('0x4c')]===_0xfecc('0x4a')){var _0xaa8d05=_0x54830b[_0xfecc('0x4b')]({'plain':!![]});var _0x556d83='ODBC';return db[_0xfecc('0x4d')][_0xfecc('0x4e')]({'where':{'name':_0x556d83,'userProfileId':_0x426ec0[_0xfecc('0x4f')]},'raw':!![]})['then'](function(_0x45744a){if(_0x45744a&&_0x45744a[_0xfecc('0x50')]===0x0){return db[_0xfecc('0x2c')][_0xfecc('0x48')]({'name':_0xaa8d05[_0xfecc('0x2e')],'resourceId':_0xaa8d05['id'],'type':_0x45744a[_0xfecc('0x2e')],'sectionId':_0x45744a['id']},{})[_0xfecc('0x29')](function(){return _0x54830b;});}else{return _0x54830b;}})['catch'](function(_0x2e60b6){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2e60b6);throw _0x2e60b6;});}return _0x54830b;})[_0xfecc('0x29')](respondWithResult(_0x4fb7e1,0xc9))[_0xfecc('0x45')](handleError(_0x4fb7e1,null));};exports[_0xfecc('0x28')]=function(_0x3fe85e,_0x447737){if(_0x3fe85e[_0xfecc('0x49')]['id']){delete _0x3fe85e[_0xfecc('0x49')]['id'];}return db[_0xfecc('0x31')][_0xfecc('0x4e')]({'where':{'id':_0x3fe85e[_0xfecc('0x46')]['id']}})[_0xfecc('0x29')](handleEntityNotFound(_0x447737,null))[_0xfecc('0x29')](saveUpdates(_0x3fe85e[_0xfecc('0x49')],null))[_0xfecc('0x29')](respondWithResult(_0x447737,null))[_0xfecc('0x45')](handleError(_0x447737,null));};exports[_0xfecc('0x2a')]=function(_0x11e110,_0x47ca4b){return db['SquareOdbc'][_0xfecc('0x4e')]({'where':{'id':_0x11e110[_0xfecc('0x46')]['id']}})[_0xfecc('0x29')](handleEntityNotFound(_0x47ca4b,null))[_0xfecc('0x29')](removeEntity(_0x47ca4b,null))[_0xfecc('0x45')](handleError(_0x47ca4b,null));};exports[_0xfecc('0x51')]=function(_0x31ba75,_0x204b7a,_0x1e6bc4){var _0x2ae10d;return db[_0xfecc('0x31')][_0xfecc('0x4e')]({'where':{'id':_0x31ba75[_0xfecc('0x46')]['id']},'attributes':['id',_0xfecc('0x52')]})[_0xfecc('0x29')](handleEntityNotFound(_0x204b7a,null))[_0xfecc('0x29')](function(_0x504c1d){if(_0x504c1d){var _0x5c7202=require(_0xfecc('0x53'))();_0x5c7202[_0xfecc('0x54')](_0x504c1d[_0xfecc('0x52')]);_0x5c7202[_0xfecc('0x55')]();return _0x504c1d;}})[_0xfecc('0x29')](respondWithResult(_0x204b7a,null))['catch'](handleError(_0x204b7a,null));}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.model.js b/server/api/squareOdbc/squareOdbc.model.js index 2611df8..10f2cd6 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 _0x7507=['request-promise','path','../../config/environment','./squareOdbc.attributes','define','SquareOdbc','square_odbc','lodash','util','moment','bluebird'];(function(_0x273f50,_0x5aba63){var _0x57a338=function(_0x2df8ae){while(--_0x2df8ae){_0x273f50['push'](_0x273f50['shift']());}};_0x57a338(++_0x5aba63);}(_0x7507,0x13b));var _0x7750=function(_0x36eb2a,_0x44924c){_0x36eb2a=_0x36eb2a-0x0;var _0x564ace=_0x7507[_0x36eb2a];return _0x564ace;};'use strict';var _=require(_0x7750('0x0'));var util=require(_0x7750('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x7750('0x2'));var BPromise=require(_0x7750('0x3'));var rp=require(_0x7750('0x4'));var fs=require('fs');var path=require(_0x7750('0x5'));var rimraf=require('rimraf');var config=require(_0x7750('0x6'));var attributes=require(_0x7750('0x7'));module['exports']=function(_0x46f784,_0x3334cb){return _0x46f784[_0x7750('0x8')](_0x7750('0x9'),attributes,{'tableName':_0x7750('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb897=['../../config/logger','moment','bluebird','request-promise','path','rimraf','./squareOdbc.attributes','SquareOdbc','square_odbc','lodash','util'];(function(_0x55251a,_0x2aa2eb){var _0x1e3831=function(_0x2fdb1b){while(--_0x2fdb1b){_0x55251a['push'](_0x55251a['shift']());}};_0x1e3831(++_0x2aa2eb);}(_0xb897,0x195));var _0x7b89=function(_0x24237f,_0x4cf32c){_0x24237f=_0x24237f-0x0;var _0x48298e=_0xb897[_0x24237f];return _0x48298e;};'use strict';var _=require(_0x7b89('0x0'));var util=require(_0x7b89('0x1'));var logger=require(_0x7b89('0x2'))('api');var moment=require(_0x7b89('0x3'));var BPromise=require(_0x7b89('0x4'));var rp=require(_0x7b89('0x5'));var fs=require('fs');var path=require(_0x7b89('0x6'));var rimraf=require(_0x7b89('0x7'));var config=require('../../config/environment');var attributes=require(_0x7b89('0x8'));module['exports']=function(_0x150a56,_0x48d154){return _0x150a56['define'](_0x7b89('0x9'),attributes,{'tableName':_0x7b89('0xa'),'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 621cd2a..7c6d0d0 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 _0x7b55=['code','message','info','result','catch','ShowSquareOdbc','SquareOdbc','find','options','where','attributes','map','include','model','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','request','then','SquareOdbc,\x20%s,\x20%s','request\x20sent','debug','stringify','error'];(function(_0x2e8779,_0xe1bba0){var _0x544c67=function(_0x6e4a23){while(--_0x6e4a23){_0x2e8779['push'](_0x2e8779['shift']());}};_0x544c67(++_0xe1bba0);}(_0x7b55,0x18e));var _0x57b5=function(_0x1ea927,_0x363b63){_0x1ea927=_0x1ea927-0x0;var _0x1ed72f=_0x7b55[_0x1ea927];return _0x1ed72f;};'use strict';var _=require(_0x57b5('0x0'));var util=require(_0x57b5('0x1'));var moment=require(_0x57b5('0x2'));var BPromise=require(_0x57b5('0x3'));var rs=require(_0x57b5('0x4'));var fs=require('fs');var Redis=require(_0x57b5('0x5'));var db=require(_0x57b5('0x6'))['db'];var utils=require(_0x57b5('0x7'));var logger=require(_0x57b5('0x8'))(_0x57b5('0x9'));var config=require(_0x57b5('0xa'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x530e8e,_0x3d8895,_0x51b4af){return new BPromise(function(_0x564643,_0x2391ea){return client[_0x57b5('0xb')](_0x530e8e,_0x51b4af)[_0x57b5('0xc')](function(_0x1a5ef9){logger['info'](_0x57b5('0xd'),_0x3d8895,_0x57b5('0xe'));logger[_0x57b5('0xf')]('SquareOdbc,\x20%s,\x20%s,\x20%s',_0x3d8895,'request\x20sent',JSON[_0x57b5('0x10')](_0x1a5ef9));if(_0x1a5ef9['error']){if(_0x1a5ef9[_0x57b5('0x11')][_0x57b5('0x12')]===0x1f4){logger[_0x57b5('0x11')](_0x57b5('0xd'),_0x3d8895,_0x1a5ef9[_0x57b5('0x11')]['message']);return _0x2391ea(_0x1a5ef9[_0x57b5('0x11')][_0x57b5('0x13')]);}logger[_0x57b5('0x11')](_0x57b5('0xd'),_0x3d8895,_0x1a5ef9[_0x57b5('0x11')][_0x57b5('0x13')]);return _0x564643(_0x1a5ef9[_0x57b5('0x11')][_0x57b5('0x13')]);}else{logger[_0x57b5('0x14')]('SquareOdbc,\x20%s,\x20%s',_0x3d8895,_0x57b5('0xe'));_0x564643(_0x1a5ef9[_0x57b5('0x15')]['message']);}})[_0x57b5('0x16')](function(_0x726845){logger['error'](_0x57b5('0xd'),_0x3d8895,_0x726845);_0x2391ea(_0x726845);});});}exports[_0x57b5('0x17')]=function(_0x1545d1){var _0x4003a7=this;return new Promise(function(_0x437dd5,_0x536860){return db[_0x57b5('0x18')][_0x57b5('0x19')]({'raw':_0x1545d1[_0x57b5('0x1a')]?_0x1545d1['options']['raw']===undefined?!![]:![]:!![],'where':_0x1545d1[_0x57b5('0x1a')]?_0x1545d1['options'][_0x57b5('0x1b')]||null:null,'attributes':_0x1545d1[_0x57b5('0x1a')]?_0x1545d1[_0x57b5('0x1a')][_0x57b5('0x1c')]||null:null,'include':_0x1545d1[_0x57b5('0x1a')]?_0x1545d1[_0x57b5('0x1a')]['include']?_[_0x57b5('0x1d')](_0x1545d1['options'][_0x57b5('0x1e')],function(_0x49f8be){return{'model':db[_0x49f8be[_0x57b5('0x1f')]],'as':_0x49f8be['as'],'attributes':_0x49f8be[_0x57b5('0x1c')],'include':_0x49f8be[_0x57b5('0x1e')]?_['map'](_0x49f8be[_0x57b5('0x1e')],function(_0x4af31d){return{'model':db[_0x4af31d['model']],'as':_0x4af31d['as'],'attributes':_0x4af31d[_0x57b5('0x1c')],'include':_0x4af31d['include']?_[_0x57b5('0x1d')](_0x4af31d['include'],function(_0x5353e1){return{'model':db[_0x5353e1[_0x57b5('0x1f')]],'as':_0x5353e1['as'],'attributes':_0x5353e1['attributes']};}):[]};}):[]};}):[]:[]})[_0x57b5('0xc')](function(_0x18070a){logger[_0x57b5('0x14')](_0x57b5('0x17'),_0x1545d1);logger['debug'](_0x57b5('0x17'),_0x1545d1,JSON[_0x57b5('0x10')](_0x18070a));_0x437dd5(_0x18070a);})['catch'](function(_0x16c83b){logger['error'](_0x57b5('0x17'),_0x16c83b[_0x57b5('0x13')],_0x1545d1);_0x536860(_0x4003a7[_0x57b5('0x11')](0x1f4,_0x16c83b[_0x57b5('0x13')]));});});}; \ No newline at end of file +var _0xbae1=['raw','attributes','include','map','model','debug','catch','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','SquareOdbc,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','ShowSquareOdbc','SquareOdbc','find','options'];(function(_0x173f10,_0x35db61){var _0x53142d=function(_0x37bbef){while(--_0x37bbef){_0x173f10['push'](_0x173f10['shift']());}};_0x53142d(++_0x35db61);}(_0xbae1,0x1b9));var _0x1bae=function(_0x29a986,_0x18d77d){_0x29a986=_0x29a986-0x0;var _0xd4a8a4=_0xbae1[_0x29a986];return _0xd4a8a4;};'use strict';var _=require(_0x1bae('0x0'));var util=require('util');var moment=require(_0x1bae('0x1'));var BPromise=require(_0x1bae('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1bae('0x3'));var db=require(_0x1bae('0x4'))['db'];var utils=require(_0x1bae('0x5'));var logger=require(_0x1bae('0x6'))(_0x1bae('0x7'));var config=require(_0x1bae('0x8'));var jayson=require(_0x1bae('0x9'));var client=jayson[_0x1bae('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x30d3ea,_0x5d1ad5,_0x4fc14a){return new BPromise(function(_0x4763c3,_0x3ed6c8){return client[_0x1bae('0xb')](_0x30d3ea,_0x4fc14a)[_0x1bae('0xc')](function(_0x51e156){logger[_0x1bae('0xd')](_0x1bae('0xe'),_0x5d1ad5,_0x1bae('0xf'));logger['debug']('SquareOdbc,\x20%s,\x20%s,\x20%s',_0x5d1ad5,_0x1bae('0xf'),JSON[_0x1bae('0x10')](_0x51e156));if(_0x51e156[_0x1bae('0x11')]){if(_0x51e156[_0x1bae('0x11')][_0x1bae('0x12')]===0x1f4){logger['error'](_0x1bae('0xe'),_0x5d1ad5,_0x51e156[_0x1bae('0x11')][_0x1bae('0x13')]);return _0x3ed6c8(_0x51e156[_0x1bae('0x11')][_0x1bae('0x13')]);}logger[_0x1bae('0x11')]('SquareOdbc,\x20%s,\x20%s',_0x5d1ad5,_0x51e156['error']['message']);return _0x4763c3(_0x51e156['error']['message']);}else{logger[_0x1bae('0xd')](_0x1bae('0xe'),_0x5d1ad5,_0x1bae('0xf'));_0x4763c3(_0x51e156['result']['message']);}})['catch'](function(_0x4860d5){logger[_0x1bae('0x11')](_0x1bae('0xe'),_0x5d1ad5,_0x4860d5);_0x3ed6c8(_0x4860d5);});});}exports[_0x1bae('0x14')]=function(_0x16f30e){var _0x49712b=this;return new Promise(function(_0x40329f,_0x1285de){return db[_0x1bae('0x15')][_0x1bae('0x16')]({'raw':_0x16f30e[_0x1bae('0x17')]?_0x16f30e[_0x1bae('0x17')][_0x1bae('0x18')]===undefined?!![]:![]:!![],'where':_0x16f30e[_0x1bae('0x17')]?_0x16f30e[_0x1bae('0x17')]['where']||null:null,'attributes':_0x16f30e[_0x1bae('0x17')]?_0x16f30e[_0x1bae('0x17')][_0x1bae('0x19')]||null:null,'include':_0x16f30e[_0x1bae('0x17')]?_0x16f30e[_0x1bae('0x17')][_0x1bae('0x1a')]?_[_0x1bae('0x1b')](_0x16f30e[_0x1bae('0x17')][_0x1bae('0x1a')],function(_0x518902){return{'model':db[_0x518902['model']],'as':_0x518902['as'],'attributes':_0x518902[_0x1bae('0x19')],'include':_0x518902['include']?_['map'](_0x518902['include'],function(_0x201353){return{'model':db[_0x201353[_0x1bae('0x1c')]],'as':_0x201353['as'],'attributes':_0x201353[_0x1bae('0x19')],'include':_0x201353[_0x1bae('0x1a')]?_[_0x1bae('0x1b')](_0x201353['include'],function(_0x157376){return{'model':db[_0x157376[_0x1bae('0x1c')]],'as':_0x157376['as'],'attributes':_0x157376[_0x1bae('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3dac11){logger[_0x1bae('0xd')](_0x1bae('0x14'),_0x16f30e);logger[_0x1bae('0x1d')](_0x1bae('0x14'),_0x16f30e,JSON[_0x1bae('0x10')](_0x3dac11));_0x40329f(_0x3dac11);})[_0x1bae('0x1e')](function(_0x5c9ee9){logger[_0x1bae('0x11')](_0x1bae('0x14'),_0x5c9ee9[_0x1bae('0x13')],_0x16f30e);_0x1285de(_0x49712b[_0x1bae('0x11')](0x1f4,_0x5c9ee9[_0x1bae('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/index.js b/server/api/squareProject/index.js index a6718ef..34cb9a6 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 _0x03c9=['Router','fs-extra','../../components/interaction/service','../../config/environment','./squareProject.controller','isAuthenticated','index','get','/:id','show','post','create','put','update','delete','exports','express'];(function(_0x4d674b,_0x176474){var _0x535a1f=function(_0xac7726){while(--_0xac7726){_0x4d674b['push'](_0x4d674b['shift']());}};_0x535a1f(++_0x176474);}(_0x03c9,0x1ec));var _0x903c=function(_0x4e13fb,_0x54d644){_0x4e13fb=_0x4e13fb-0x0;var _0xf7b9e7=_0x03c9[_0x4e13fb];return _0xf7b9e7;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x903c('0x0'));var router=express[_0x903c('0x1')]();var fs_extra=require(_0x903c('0x2'));var auth=require('../../components/auth/service');var interaction=require(_0x903c('0x3'));var config=require(_0x903c('0x4'));var controller=require(_0x903c('0x5'));router['get']('/',auth[_0x903c('0x6')](),controller[_0x903c('0x7')]);router[_0x903c('0x8')](_0x903c('0x9'),auth[_0x903c('0x6')](),controller[_0x903c('0xa')]);router[_0x903c('0xb')]('/',auth[_0x903c('0x6')](),controller[_0x903c('0xc')]);router[_0x903c('0xd')](_0x903c('0x9'),auth[_0x903c('0x6')](),controller[_0x903c('0xe')]);router[_0x903c('0xf')](_0x903c('0x9'),auth['isAuthenticated'](),controller['destroy']);module[_0x903c('0x10')]=router; \ No newline at end of file +var _0x7cb5=['destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareProject.controller','get','isAuthenticated','index','/:id','show','post','update','delete'];(function(_0x34bc30,_0x177cb0){var _0x5706de=function(_0x535a8c){while(--_0x535a8c){_0x34bc30['push'](_0x34bc30['shift']());}};_0x5706de(++_0x177cb0);}(_0x7cb5,0x12e));var _0x57cb=function(_0x7a04c8,_0x455129){_0x7a04c8=_0x7a04c8-0x0;var _0x2dfe0f=_0x7cb5[_0x7a04c8];return _0x2dfe0f;};'use strict';var multer=require('multer');var util=require(_0x57cb('0x0'));var path=require(_0x57cb('0x1'));var timeout=require(_0x57cb('0x2'));var express=require(_0x57cb('0x3'));var router=express[_0x57cb('0x4')]();var fs_extra=require(_0x57cb('0x5'));var auth=require(_0x57cb('0x6'));var interaction=require(_0x57cb('0x7'));var config=require(_0x57cb('0x8'));var controller=require(_0x57cb('0x9'));router[_0x57cb('0xa')]('/',auth[_0x57cb('0xb')](),controller[_0x57cb('0xc')]);router['get'](_0x57cb('0xd'),auth[_0x57cb('0xb')](),controller[_0x57cb('0xe')]);router[_0x57cb('0xf')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x57cb('0xd'),auth[_0x57cb('0xb')](),controller[_0x57cb('0x10')]);router[_0x57cb('0x11')](_0x57cb('0xd'),auth[_0x57cb('0xb')](),controller[_0x57cb('0x12')]);module[_0x57cb('0x13')]=router; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.attributes.js b/server/api/squareProject/squareProject.attributes.js index 911c8f7..9421530 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 _0xf1c6=['production','DATE','sequelize','exports','STRING','name','TEXT','BLOB','getDataValue','preproduction','long'];(function(_0x127d71,_0x4df9d6){var _0x134f1b=function(_0x31f397){while(--_0x31f397){_0x127d71['push'](_0x127d71['shift']());}};_0x134f1b(++_0x4df9d6);}(_0xf1c6,0xf4));var _0x6f1c=function(_0xede5dc,_0x45f3ee){_0xede5dc=_0xede5dc-0x0;var _0x29c46e=_0xf1c6[_0xede5dc];return _0x29c46e;};'use strict';var Sequelize=require(_0x6f1c('0x0'));module[_0x6f1c('0x1')]={'name':{'type':Sequelize[_0x6f1c('0x2')],'unique':_0x6f1c('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0x6f1c('0x2')]},'notes':{'type':Sequelize[_0x6f1c('0x4')]},'preproduction':{'type':Sequelize[_0x6f1c('0x5')]('long'),'get':function(){if(this[_0x6f1c('0x6')](_0x6f1c('0x7'))){return this[_0x6f1c('0x6')](_0x6f1c('0x7'))['toString']('utf8');}}},'production':{'type':Sequelize[_0x6f1c('0x5')](_0x6f1c('0x8')),'get':function(){if(this[_0x6f1c('0x6')](_0x6f1c('0x9'))){return this[_0x6f1c('0x6')](_0x6f1c('0x9'))['toString']('utf8');}}},'savedAt':{'type':Sequelize[_0x6f1c('0xa')]},'publishedAt':{'type':Sequelize[_0x6f1c('0xa')]}}; \ No newline at end of file +var _0xcd15=['exports','STRING','name','TEXT','BLOB','long','getDataValue','preproduction','toString','utf8','production','DATE','sequelize'];(function(_0x1876c7,_0x379202){var _0x2b9572=function(_0x9bf2ff){while(--_0x9bf2ff){_0x1876c7['push'](_0x1876c7['shift']());}};_0x2b9572(++_0x379202);}(_0xcd15,0xf6));var _0x5cd1=function(_0x1ff2ec,_0x386e86){_0x1ff2ec=_0x1ff2ec-0x0;var _0x405683=_0xcd15[_0x1ff2ec];return _0x405683;};'use strict';var Sequelize=require(_0x5cd1('0x0'));module[_0x5cd1('0x1')]={'name':{'type':Sequelize[_0x5cd1('0x2')],'unique':_0x5cd1('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0x5cd1('0x2')]},'notes':{'type':Sequelize[_0x5cd1('0x4')]},'preproduction':{'type':Sequelize[_0x5cd1('0x5')](_0x5cd1('0x6')),'get':function(){if(this['getDataValue']('preproduction')){return this[_0x5cd1('0x7')](_0x5cd1('0x8'))[_0x5cd1('0x9')](_0x5cd1('0xa'));}}},'production':{'type':Sequelize[_0x5cd1('0x5')](_0x5cd1('0x6')),'get':function(){if(this[_0x5cd1('0x7')](_0x5cd1('0xb'))){return this[_0x5cd1('0x7')](_0x5cd1('0xb'))['toString'](_0x5cd1('0xa'));}}},'savedAt':{'type':Sequelize['DATE']},'publishedAt':{'type':Sequelize[_0x5cd1('0xc')]}}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.controller.js b/server/api/squareProject/squareProject.controller.js index d38fc40..8644a15 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 _0x154d=['agi','stringify','destroy','lodash','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','redis','defaults','localhost','socket.io-emitter','register','json','offset','limit','undefined','count','status','Content-Range','then','get','SquareProjects','UserProfileResource','publish','end','stack','send','index','map','SquareProject','type','key','model','name','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','merge','where','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','rawAttributes','include','find','create','user','role','UserProfileSection','autoAssociation','error','update','body'];(function(_0x215eaa,_0xd7abf6){var _0x4de0d2=function(_0x2fdc03){while(--_0x2fdc03){_0x215eaa['push'](_0x215eaa['shift']());}};_0x4de0d2(++_0xd7abf6);}(_0x154d,0x11b));var _0xd154=function(_0x9a2e76,_0x361e3b){_0x9a2e76=_0x9a2e76-0x0;var _0xe0fb41=_0x154d[_0x9a2e76];return _0xe0fb41;};'use strict';var _=require(_0xd154('0x0'));var Redis=require(_0xd154('0x1'));var qs=require(_0xd154('0x2'));var logger=require(_0xd154('0x3'))(_0xd154('0x4'));var config=require(_0xd154('0x5'));var db=require('../../mysqldb')['db'];config[_0xd154('0x6')]=_[_0xd154('0x7')](config['redis'],{'host':_0xd154('0x8'),'port':0x18eb});var socket=require(_0xd154('0x9'))(new Redis(config[_0xd154('0x6')]));require('./squareProject.socket')[_0xd154('0xa')](socket);function respondWithResult(_0x291df5,_0x1b209b){_0x1b209b=_0x1b209b||0xc8;return function(_0x21a24c){if(_0x21a24c){return _0x291df5['status'](_0x1b209b)[_0xd154('0xb')](_0x21a24c);}};}function respondWithFilteredResult(_0x3e5c50,_0x26500c){return function(_0x1aeaad){if(_0x1aeaad){var _0x2d2930=typeof _0x26500c[_0xd154('0xc')]==='undefined'&&typeof _0x26500c[_0xd154('0xd')]===_0xd154('0xe');var _0x32d57e=_0x1aeaad[_0xd154('0xf')];var _0x5eddf3=_0x2d2930?0x0:_0x26500c['offset'];var _0x1c4b8a=_0x2d2930?_0x1aeaad[_0xd154('0xf')]:_0x26500c[_0xd154('0xc')]+_0x26500c[_0xd154('0xd')];var _0x3d94f5;if(_0x1c4b8a>=_0x32d57e){_0x1c4b8a=_0x32d57e;_0x3d94f5=0xc8;}else{_0x3d94f5=0xce;}_0x3e5c50[_0xd154('0x10')](_0x3d94f5);return _0x3e5c50['set'](_0xd154('0x11'),_0x5eddf3+'-'+_0x1c4b8a+'/'+_0x32d57e)['json'](_0x1aeaad);}return null;};}function saveUpdates(_0x3d69fd){return function(_0x56a69a){if(_0x56a69a){return _0x56a69a['update'](_0x3d69fd)[_0xd154('0x12')](function(_0x5d8d64){return _0x5d8d64;});}return null;};}function removeEntity(_0x23d4da){return function(_0x3c68b2){if(_0x3c68b2){return _0x3c68b2['destroy']()['then'](function(){var _0x5ec596=_0x3c68b2[_0xd154('0x13')]({'plain':!![]});var _0x9f96b1=_0xd154('0x14');return db[_0xd154('0x15')]['destroy']({'where':{'type':_0x9f96b1,'resourceId':_0x5ec596['id']}})[_0xd154('0x12')](function(){return _0x3c68b2;});})['then'](function(){var _0x3e381c=new Redis(config[_0xd154('0x6')]);_0x3e381c[_0xd154('0x16')]('agi',JSON['stringify']({'id':_0x3c68b2['id'],'deleted':!![]}));})[_0xd154('0x12')](function(){_0x23d4da[_0xd154('0x10')](0xcc)[_0xd154('0x17')]();});}};}function handleEntityNotFound(_0x58553b){return function(_0x418009){if(!_0x418009){_0x58553b['sendStatus'](0x194);}return _0x418009;};}function handleError(_0x3ea899,_0xf22047){_0xf22047=_0xf22047||0x1f4;return function(_0x5f19b0){logger['error'](_0x5f19b0[_0xd154('0x18')]);if(_0x5f19b0['name']){delete _0x5f19b0['name'];}_0x3ea899['status'](_0xf22047)[_0xd154('0x19')](_0x5f19b0);};}exports[_0xd154('0x1a')]=function(_0x39ae1d,_0x5b0ae6){var _0x4b93a8={},_0x3df052={},_0xc7df0f={'count':0x0,'rows':[]};var _0x4e6b22=_[_0xd154('0x1b')](db[_0xd154('0x1c')]['rawAttributes'],function(_0x2d0ee2){return{'name':_0x2d0ee2['fieldName'],'type':_0x2d0ee2[_0xd154('0x1d')][_0xd154('0x1e')]};});_0x3df052[_0xd154('0x1f')]=_[_0xd154('0x1b')](_0x4e6b22,_0xd154('0x20'));_0x3df052[_0xd154('0x21')]=_[_0xd154('0x22')](_0x39ae1d['query']);_0x3df052[_0xd154('0x23')]=_[_0xd154('0x24')](_0x3df052[_0xd154('0x1f')],_0x3df052[_0xd154('0x21')]);_0x4b93a8['attributes']=_['intersection'](_0x3df052[_0xd154('0x1f')],qs[_0xd154('0x25')](_0x39ae1d['query'][_0xd154('0x25')]));_0x4b93a8['attributes']=_0x4b93a8[_0xd154('0x26')][_0xd154('0x27')]?_0x4b93a8[_0xd154('0x26')]:_0x3df052[_0xd154('0x1f')];if(!_0x39ae1d[_0xd154('0x21')][_0xd154('0x28')](_0xd154('0x29'))){_0x4b93a8[_0xd154('0xd')]=qs['limit'](_0x39ae1d[_0xd154('0x21')][_0xd154('0xd')]);_0x4b93a8['offset']=qs[_0xd154('0xc')](_0x39ae1d[_0xd154('0x21')][_0xd154('0xc')]);}_0x4b93a8[_0xd154('0x2a')]=qs['sort'](_0x39ae1d[_0xd154('0x21')][_0xd154('0x2b')]);_0x4b93a8['where']=qs[_0xd154('0x23')](_[_0xd154('0x2c')](_0x39ae1d[_0xd154('0x21')],_0x3df052[_0xd154('0x23')]),_0x4e6b22);if(_0x39ae1d[_0xd154('0x21')][_0xd154('0x2d')]){_0x4b93a8['where']=_[_0xd154('0x2e')](_0x4b93a8[_0xd154('0x2f')],{'$or':_[_0xd154('0x1b')](_0x4e6b22,function(_0x2435dd){if(_0x2435dd[_0xd154('0x1d')]!==_0xd154('0x30')){var _0x143416={};_0x143416[_0x2435dd[_0xd154('0x20')]]={'$like':'%'+_0x39ae1d[_0xd154('0x21')][_0xd154('0x2d')]+'%'};return _0x143416;}})});}_0x4b93a8=_[_0xd154('0x2e')]({},_0x4b93a8,_0x39ae1d[_0xd154('0x31')]);var _0x17d41c={'where':_0x4b93a8[_0xd154('0x2f')]};return db[_0xd154('0x1c')][_0xd154('0xf')](_0x17d41c)[_0xd154('0x12')](function(_0x196a6e){_0xc7df0f[_0xd154('0xf')]=_0x196a6e;if(_0x39ae1d[_0xd154('0x21')][_0xd154('0x32')]){_0x4b93a8['include']=[{'all':!![]}];}return db[_0xd154('0x1c')][_0xd154('0x33')](_0x4b93a8);})[_0xd154('0x12')](function(_0x3def04){_0xc7df0f[_0xd154('0x34')]=_0x3def04;return _0xc7df0f;})[_0xd154('0x12')](respondWithFilteredResult(_0x5b0ae6,_0x4b93a8))[_0xd154('0x35')](handleError(_0x5b0ae6,null));};exports[_0xd154('0x36')]=function(_0xa8fc3f,_0x113523){var _0x5b70a6={'raw':![],'where':{'id':_0xa8fc3f[_0xd154('0x37')]['id']}},_0x8266d3={};_0x8266d3[_0xd154('0x1f')]=_['keys'](db['SquareProject'][_0xd154('0x38')]);_0x8266d3[_0xd154('0x21')]=_[_0xd154('0x22')](_0xa8fc3f[_0xd154('0x21')]);_0x8266d3['filters']=_[_0xd154('0x24')](_0x8266d3[_0xd154('0x1f')],_0x8266d3[_0xd154('0x21')]);_0x5b70a6[_0xd154('0x26')]=_['intersection'](_0x8266d3[_0xd154('0x1f')],qs['fields'](_0xa8fc3f[_0xd154('0x21')][_0xd154('0x25')]));_0x5b70a6[_0xd154('0x26')]=_0x5b70a6[_0xd154('0x26')][_0xd154('0x27')]?_0x5b70a6['attributes']:_0x8266d3[_0xd154('0x1f')];if(_0xa8fc3f[_0xd154('0x21')]['includeAll']){_0x5b70a6[_0xd154('0x39')]=[{'all':!![]}];}_0x5b70a6=_['merge']({},_0x5b70a6,_0xa8fc3f[_0xd154('0x31')]);return db['SquareProject'][_0xd154('0x3a')](_0x5b70a6)['then'](handleEntityNotFound(_0x113523,null))[_0xd154('0x12')](respondWithResult(_0x113523,null))['catch'](handleError(_0x113523,null));};exports[_0xd154('0x3b')]=function(_0x46a9b4,_0x2512f6){return db[_0xd154('0x1c')][_0xd154('0x3b')](_0x46a9b4['body'],{})['then'](function(_0x4db98f){var _0x56bdf8=_0x46a9b4[_0xd154('0x3c')][_0xd154('0x13')]({'plain':!![]});if(!_0x56bdf8)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x56bdf8[_0xd154('0x3d')]===_0xd154('0x3c')){var _0x54bcbe=_0x4db98f[_0xd154('0x13')]({'plain':!![]});var _0x307485=_0xd154('0x14');return db[_0xd154('0x3e')]['find']({'where':{'name':_0x307485,'userProfileId':_0x56bdf8['userProfileId']},'raw':!![]})[_0xd154('0x12')](function(_0x5caef8){if(_0x5caef8&&_0x5caef8[_0xd154('0x3f')]===0x0){return db[_0xd154('0x15')][_0xd154('0x3b')]({'name':_0x54bcbe[_0xd154('0x20')],'resourceId':_0x54bcbe['id'],'type':_0x5caef8['name'],'sectionId':_0x5caef8['id']},{})[_0xd154('0x12')](function(){return _0x4db98f;});}else{return _0x4db98f;}})[_0xd154('0x35')](function(_0x11830d){logger[_0xd154('0x40')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x11830d);throw _0x11830d;});}return _0x4db98f;})[_0xd154('0x12')](respondWithResult(_0x2512f6,0xc9))['catch'](handleError(_0x2512f6,null));};exports[_0xd154('0x41')]=function(_0x3403d9,_0x27a858){if(_0x3403d9[_0xd154('0x42')]['id']){delete _0x3403d9[_0xd154('0x42')]['id'];}return db[_0xd154('0x1c')][_0xd154('0x3a')]({'where':{'id':_0x3403d9[_0xd154('0x37')]['id']}})[_0xd154('0x12')](handleEntityNotFound(_0x27a858,null))[_0xd154('0x12')](saveUpdates(_0x3403d9['body'],null))[_0xd154('0x12')](function(_0xe804ec){if(!_0xe804ec)return;var _0x4e7113=_0xe804ec[_0xd154('0x13')]({'plain':!![]});return _0x4e7113;})[_0xd154('0x12')](function(_0x1c592e){var _0x468827=new Redis(config['redis']);_0x468827[_0xd154('0x16')](_0xd154('0x43'),JSON[_0xd154('0x44')](_[_0xd154('0x2c')](_0x1c592e,['id','name','production'])));return _0x1c592e;})[_0xd154('0x12')](respondWithResult(_0x27a858,null))['catch'](handleError(_0x27a858,null));};exports[_0xd154('0x45')]=function(_0x98430e,_0x3c3482){return db[_0xd154('0x1c')][_0xd154('0x3a')]({'where':{'id':_0x98430e[_0xd154('0x37')]['id']}})[_0xd154('0x12')](handleEntityNotFound(_0x3c3482,null))[_0xd154('0x12')](removeEntity(_0x3c3482,null))[_0xd154('0x35')](handleError(_0x3c3482,null));}; \ No newline at end of file +var _0x1e22=['filters','filter','where','merge','includeAll','include','findAll','rows','catch','show','params','options','find','create','user','role','SquareProjects','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','publish','stringify','production','lodash','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./squareProject.socket','register','status','json','offset','undefined','limit','count','set','Content-Range','update','then','destroy','get','UserProfileResource','agi','end','sendStatus','error','stack','name','send','index','map','SquareProject','type','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort'];(function(_0x1c7a3a,_0x8e73d0){var _0x3eeec7=function(_0x176ad9){while(--_0x176ad9){_0x1c7a3a['push'](_0x1c7a3a['shift']());}};_0x3eeec7(++_0x8e73d0);}(_0x1e22,0x13d));var _0x21e2=function(_0x55e839,_0x3b5345){_0x55e839=_0x55e839-0x0;var _0x39c61a=_0x1e22[_0x55e839];return _0x39c61a;};'use strict';var _=require(_0x21e2('0x0'));var Redis=require(_0x21e2('0x1'));var qs=require(_0x21e2('0x2'));var logger=require(_0x21e2('0x3'))(_0x21e2('0x4'));var config=require(_0x21e2('0x5'));var db=require(_0x21e2('0x6'))['db'];config['redis']=_[_0x21e2('0x7')](config[_0x21e2('0x8')],{'host':_0x21e2('0x9'),'port':0x18eb});var socket=require(_0x21e2('0xa'))(new Redis(config['redis']));require(_0x21e2('0xb'))[_0x21e2('0xc')](socket);function respondWithResult(_0x2bf24b,_0x2f5272){_0x2f5272=_0x2f5272||0xc8;return function(_0x5128d9){if(_0x5128d9){return _0x2bf24b[_0x21e2('0xd')](_0x2f5272)[_0x21e2('0xe')](_0x5128d9);}};}function respondWithFilteredResult(_0x1f2156,_0x3a6533){return function(_0x517701){if(_0x517701){var _0x1b6b1f=typeof _0x3a6533[_0x21e2('0xf')]===_0x21e2('0x10')&&typeof _0x3a6533[_0x21e2('0x11')]===_0x21e2('0x10');var _0x26dd0f=_0x517701[_0x21e2('0x12')];var _0xcf60d2=_0x1b6b1f?0x0:_0x3a6533[_0x21e2('0xf')];var _0x14f743=_0x1b6b1f?_0x517701['count']:_0x3a6533['offset']+_0x3a6533['limit'];var _0x55483f;if(_0x14f743>=_0x26dd0f){_0x14f743=_0x26dd0f;_0x55483f=0xc8;}else{_0x55483f=0xce;}_0x1f2156[_0x21e2('0xd')](_0x55483f);return _0x1f2156[_0x21e2('0x13')](_0x21e2('0x14'),_0xcf60d2+'-'+_0x14f743+'/'+_0x26dd0f)['json'](_0x517701);}return null;};}function saveUpdates(_0x530bd1){return function(_0x18973f){if(_0x18973f){return _0x18973f[_0x21e2('0x15')](_0x530bd1)[_0x21e2('0x16')](function(_0x17cd1f){return _0x17cd1f;});}return null;};}function removeEntity(_0xe573de){return function(_0x538fad){if(_0x538fad){return _0x538fad[_0x21e2('0x17')]()[_0x21e2('0x16')](function(){var _0xc32730=_0x538fad[_0x21e2('0x18')]({'plain':!![]});var _0x41c8e4='SquareProjects';return db[_0x21e2('0x19')]['destroy']({'where':{'type':_0x41c8e4,'resourceId':_0xc32730['id']}})['then'](function(){return _0x538fad;});})[_0x21e2('0x16')](function(){var _0x4213a9=new Redis(config['redis']);_0x4213a9['publish'](_0x21e2('0x1a'),JSON['stringify']({'id':_0x538fad['id'],'deleted':!![]}));})[_0x21e2('0x16')](function(){_0xe573de['status'](0xcc)[_0x21e2('0x1b')]();});}};}function handleEntityNotFound(_0x24ea74){return function(_0x5e5d20){if(!_0x5e5d20){_0x24ea74[_0x21e2('0x1c')](0x194);}return _0x5e5d20;};}function handleError(_0x462cef,_0x2d9856){_0x2d9856=_0x2d9856||0x1f4;return function(_0x3a0036){logger[_0x21e2('0x1d')](_0x3a0036[_0x21e2('0x1e')]);if(_0x3a0036[_0x21e2('0x1f')]){delete _0x3a0036[_0x21e2('0x1f')];}_0x462cef['status'](_0x2d9856)[_0x21e2('0x20')](_0x3a0036);};}exports[_0x21e2('0x21')]=function(_0x13786a,_0x1cb915){var _0xeeecb9={},_0xfe9b76={},_0x1225f2={'count':0x0,'rows':[]};var _0x300980=_[_0x21e2('0x22')](db[_0x21e2('0x23')]['rawAttributes'],function(_0x45680c){return{'name':_0x45680c['fieldName'],'type':_0x45680c[_0x21e2('0x24')]['key']};});_0xfe9b76[_0x21e2('0x25')]=_[_0x21e2('0x22')](_0x300980,'name');_0xfe9b76[_0x21e2('0x26')]=_[_0x21e2('0x27')](_0x13786a[_0x21e2('0x26')]);_0xfe9b76['filters']=_[_0x21e2('0x28')](_0xfe9b76[_0x21e2('0x25')],_0xfe9b76[_0x21e2('0x26')]);_0xeeecb9['attributes']=_[_0x21e2('0x28')](_0xfe9b76[_0x21e2('0x25')],qs[_0x21e2('0x29')](_0x13786a[_0x21e2('0x26')][_0x21e2('0x29')]));_0xeeecb9[_0x21e2('0x2a')]=_0xeeecb9[_0x21e2('0x2a')][_0x21e2('0x2b')]?_0xeeecb9[_0x21e2('0x2a')]:_0xfe9b76[_0x21e2('0x25')];if(!_0x13786a[_0x21e2('0x26')][_0x21e2('0x2c')](_0x21e2('0x2d'))){_0xeeecb9[_0x21e2('0x11')]=qs['limit'](_0x13786a[_0x21e2('0x26')]['limit']);_0xeeecb9['offset']=qs[_0x21e2('0xf')](_0x13786a['query'][_0x21e2('0xf')]);}_0xeeecb9[_0x21e2('0x2e')]=qs[_0x21e2('0x2f')](_0x13786a[_0x21e2('0x26')][_0x21e2('0x2f')]);_0xeeecb9['where']=qs['filters'](_['pick'](_0x13786a['query'],_0xfe9b76[_0x21e2('0x30')]),_0x300980);if(_0x13786a[_0x21e2('0x26')][_0x21e2('0x31')]){_0xeeecb9[_0x21e2('0x32')]=_[_0x21e2('0x33')](_0xeeecb9['where'],{'$or':_[_0x21e2('0x22')](_0x300980,function(_0xdef74e){if(_0xdef74e[_0x21e2('0x24')]!=='VIRTUAL'){var _0x55fcb3={};_0x55fcb3[_0xdef74e['name']]={'$like':'%'+_0x13786a[_0x21e2('0x26')][_0x21e2('0x31')]+'%'};return _0x55fcb3;}})});}_0xeeecb9=_[_0x21e2('0x33')]({},_0xeeecb9,_0x13786a['options']);var _0x2289ed={'where':_0xeeecb9[_0x21e2('0x32')]};return db[_0x21e2('0x23')][_0x21e2('0x12')](_0x2289ed)[_0x21e2('0x16')](function(_0x8410be){_0x1225f2[_0x21e2('0x12')]=_0x8410be;if(_0x13786a['query'][_0x21e2('0x34')]){_0xeeecb9[_0x21e2('0x35')]=[{'all':!![]}];}return db[_0x21e2('0x23')][_0x21e2('0x36')](_0xeeecb9);})[_0x21e2('0x16')](function(_0x5ab62f){_0x1225f2[_0x21e2('0x37')]=_0x5ab62f;return _0x1225f2;})[_0x21e2('0x16')](respondWithFilteredResult(_0x1cb915,_0xeeecb9))[_0x21e2('0x38')](handleError(_0x1cb915,null));};exports[_0x21e2('0x39')]=function(_0x1a4b84,_0x40f418){var _0x57dff1={'raw':![],'where':{'id':_0x1a4b84[_0x21e2('0x3a')]['id']}},_0x3c7842={};_0x3c7842[_0x21e2('0x25')]=_[_0x21e2('0x27')](db[_0x21e2('0x23')]['rawAttributes']);_0x3c7842[_0x21e2('0x26')]=_[_0x21e2('0x27')](_0x1a4b84['query']);_0x3c7842[_0x21e2('0x30')]=_[_0x21e2('0x28')](_0x3c7842[_0x21e2('0x25')],_0x3c7842[_0x21e2('0x26')]);_0x57dff1['attributes']=_[_0x21e2('0x28')](_0x3c7842[_0x21e2('0x25')],qs['fields'](_0x1a4b84[_0x21e2('0x26')][_0x21e2('0x29')]));_0x57dff1['attributes']=_0x57dff1[_0x21e2('0x2a')][_0x21e2('0x2b')]?_0x57dff1[_0x21e2('0x2a')]:_0x3c7842[_0x21e2('0x25')];if(_0x1a4b84[_0x21e2('0x26')][_0x21e2('0x34')]){_0x57dff1[_0x21e2('0x35')]=[{'all':!![]}];}_0x57dff1=_[_0x21e2('0x33')]({},_0x57dff1,_0x1a4b84[_0x21e2('0x3b')]);return db[_0x21e2('0x23')][_0x21e2('0x3c')](_0x57dff1)[_0x21e2('0x16')](handleEntityNotFound(_0x40f418,null))['then'](respondWithResult(_0x40f418,null))[_0x21e2('0x38')](handleError(_0x40f418,null));};exports[_0x21e2('0x3d')]=function(_0x1686b5,_0x25ad96){return db['SquareProject'][_0x21e2('0x3d')](_0x1686b5['body'],{})[_0x21e2('0x16')](function(_0x29eb02){var _0x15e5a4=_0x1686b5[_0x21e2('0x3e')][_0x21e2('0x18')]({'plain':!![]});if(!_0x15e5a4)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x15e5a4[_0x21e2('0x3f')]===_0x21e2('0x3e')){var _0x26d88d=_0x29eb02['get']({'plain':!![]});var _0x3d66e7=_0x21e2('0x40');return db[_0x21e2('0x41')][_0x21e2('0x3c')]({'where':{'name':_0x3d66e7,'userProfileId':_0x15e5a4[_0x21e2('0x42')]},'raw':!![]})[_0x21e2('0x16')](function(_0x287848){if(_0x287848&&_0x287848[_0x21e2('0x43')]===0x0){return db[_0x21e2('0x19')][_0x21e2('0x3d')]({'name':_0x26d88d[_0x21e2('0x1f')],'resourceId':_0x26d88d['id'],'type':_0x287848[_0x21e2('0x1f')],'sectionId':_0x287848['id']},{})[_0x21e2('0x16')](function(){return _0x29eb02;});}else{return _0x29eb02;}})[_0x21e2('0x38')](function(_0x38cf34){logger[_0x21e2('0x1d')](_0x21e2('0x44'),_0x38cf34);throw _0x38cf34;});}return _0x29eb02;})[_0x21e2('0x16')](respondWithResult(_0x25ad96,0xc9))[_0x21e2('0x38')](handleError(_0x25ad96,null));};exports[_0x21e2('0x15')]=function(_0x5caf0e,_0x4dea48){if(_0x5caf0e[_0x21e2('0x45')]['id']){delete _0x5caf0e[_0x21e2('0x45')]['id'];}return db['SquareProject']['find']({'where':{'id':_0x5caf0e[_0x21e2('0x3a')]['id']}})[_0x21e2('0x16')](handleEntityNotFound(_0x4dea48,null))[_0x21e2('0x16')](saveUpdates(_0x5caf0e[_0x21e2('0x45')],null))[_0x21e2('0x16')](function(_0x25e065){if(!_0x25e065)return;var _0xd7f5d3=_0x25e065[_0x21e2('0x18')]({'plain':!![]});return _0xd7f5d3;})[_0x21e2('0x16')](function(_0x42b918){var _0x31871e=new Redis(config[_0x21e2('0x8')]);_0x31871e[_0x21e2('0x46')](_0x21e2('0x1a'),JSON[_0x21e2('0x47')](_['pick'](_0x42b918,['id','name',_0x21e2('0x48')])));return _0x42b918;})['then'](respondWithResult(_0x4dea48,null))[_0x21e2('0x38')](handleError(_0x4dea48,null));};exports[_0x21e2('0x17')]=function(_0xf438d3,_0x43aca3){return db['SquareProject'][_0x21e2('0x3c')]({'where':{'id':_0xf438d3[_0x21e2('0x3a')]['id']}})[_0x21e2('0x16')](handleEntityNotFound(_0x43aca3,null))['then'](removeEntity(_0x43aca3,null))['catch'](handleError(_0x43aca3,null));}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.events.js b/server/api/squareProject/squareProject.events.js index 13293d5..0d25829 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 _0x295a=['emit','hook','exports','setMaxListeners','save','update','remove'];(function(_0x41b2df,_0x3e26b4){var _0x433e30=function(_0x17265c){while(--_0x17265c){_0x41b2df['push'](_0x41b2df['shift']());}};_0x433e30(++_0x3e26b4);}(_0x295a,0xe3));var _0xa295=function(_0x6e3db4,_0x816fef){_0x6e3db4=_0x6e3db4-0x0;var _0xdbc59e=_0x295a[_0x6e3db4];return _0xdbc59e;};'use strict';var EventEmitter=require('events');var SquareProject=require('../../mysqldb')['db']['SquareProject'];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0xa295('0x0')](0x0);var events={'afterCreate':_0xa295('0x1'),'afterUpdate':_0xa295('0x2'),'afterDestroy':_0xa295('0x3')};function emitEvent(_0x238ae5){return function(_0x2c360e,_0x1891ec,_0x6d3a9b){SquareProjectEvents[_0xa295('0x4')](_0x238ae5+':'+_0x2c360e['id'],_0x2c360e);SquareProjectEvents['emit'](_0x238ae5,_0x2c360e);_0x6d3a9b(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SquareProject[_0xa295('0x5')](e,emitEvent(event));}}module[_0xa295('0x6')]=SquareProjectEvents; \ No newline at end of file +var _0x9f17=['../../mysqldb','SquareProject','setMaxListeners','save','remove','emit','hook','exports','events'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x9f17,0x18b));var _0x79f1=function(_0x155fa7,_0x282870){_0x155fa7=_0x155fa7-0x0;var _0x4a73c9=_0x9f17[_0x155fa7];return _0x4a73c9;};'use strict';var EventEmitter=require(_0x79f1('0x0'));var SquareProject=require(_0x79f1('0x1'))['db'][_0x79f1('0x2')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0x79f1('0x3')](0x0);var events={'afterCreate':_0x79f1('0x4'),'afterUpdate':'update','afterDestroy':_0x79f1('0x5')};function emitEvent(_0x1fddb2){return function(_0x3583f8,_0x42447f,_0x1896a5){SquareProjectEvents['emit'](_0x1fddb2+':'+_0x3583f8['id'],_0x3583f8);SquareProjectEvents[_0x79f1('0x6')](_0x1fddb2,_0x3583f8);_0x1896a5(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SquareProject[_0x79f1('0x7')](e,emitEvent(event));}}module[_0x79f1('0x8')]=SquareProjectEvents; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.model.js b/server/api/squareProject/squareProject.model.js index 9773f7e..3c1d7d7 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 _0x5184=['YYYY-MM-DD\x20HH:mm:ss','changed','production','lodash','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./squareProject.attributes','define','preproduction','savedAt','format'];(function(_0x2a8cb2,_0x39300a){var _0x4eb6d8=function(_0xacb732){while(--_0xacb732){_0x2a8cb2['push'](_0x2a8cb2['shift']());}};_0x4eb6d8(++_0x39300a);}(_0x5184,0xc3));var _0x4518=function(_0x102adf,_0x7e18fe){_0x102adf=_0x102adf-0x0;var _0x3f5508=_0x5184[_0x102adf];return _0x3f5508;};'use strict';var _=require(_0x4518('0x0'));var util=require('util');var logger=require(_0x4518('0x1'))('api');var moment=require(_0x4518('0x2'));var BPromise=require(_0x4518('0x3'));var rp=require(_0x4518('0x4'));var fs=require('fs');var path=require(_0x4518('0x5'));var rimraf=require(_0x4518('0x6'));var config=require(_0x4518('0x7'));var attributes=require(_0x4518('0x8'));module['exports']=function(_0x380884,_0xb8c2d7){return _0x380884[_0x4518('0x9')]('SquareProject',attributes,{'tableName':'square_projects','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x4ab8a5,_0x5133a7,_0x4db91d){if(_0x4ab8a5['changed'](_0x4518('0xa'))){_0x4ab8a5[_0x4518('0xb')]=moment()[_0x4518('0xc')](_0x4518('0xd'));}if(_0x4ab8a5[_0x4518('0xe')](_0x4518('0xf'))){_0x4ab8a5['publishedAt']=moment()[_0x4518('0xc')]('YYYY-MM-DD\x20HH:mm:ss');}_0x4db91d(null,_0x4ab8a5);}}});}; \ No newline at end of file +var _0x3b24=['define','SquareProject','changed','preproduction','savedAt','YYYY-MM-DD\x20HH:mm:ss','production','publishedAt','format','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','./squareProject.attributes','exports'];(function(_0x587b09,_0x35ab4b){var _0x5b0f9b=function(_0x9d27b5){while(--_0x9d27b5){_0x587b09['push'](_0x587b09['shift']());}};_0x5b0f9b(++_0x35ab4b);}(_0x3b24,0xed));var _0x43b2=function(_0x545026,_0x22d9c5){_0x545026=_0x545026-0x0;var _0x1220e0=_0x3b24[_0x545026];return _0x1220e0;};'use strict';var _=require(_0x43b2('0x0'));var util=require(_0x43b2('0x1'));var logger=require(_0x43b2('0x2'))(_0x43b2('0x3'));var moment=require(_0x43b2('0x4'));var BPromise=require('bluebird');var rp=require(_0x43b2('0x5'));var fs=require('fs');var path=require(_0x43b2('0x6'));var rimraf=require(_0x43b2('0x7'));var config=require('../../config/environment');var attributes=require(_0x43b2('0x8'));module[_0x43b2('0x9')]=function(_0x4b1840,_0x4fb131){return _0x4b1840[_0x43b2('0xa')](_0x43b2('0xb'),attributes,{'tableName':'square_projects','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x2d652c,_0x2a6c14,_0x5709d8){if(_0x2d652c[_0x43b2('0xc')](_0x43b2('0xd'))){_0x2d652c[_0x43b2('0xe')]=moment()['format'](_0x43b2('0xf'));}if(_0x2d652c[_0x43b2('0xc')](_0x43b2('0x10'))){_0x2d652c[_0x43b2('0x11')]=moment()[_0x43b2('0x12')]('YYYY-MM-DD\x20HH:mm:ss');}_0x5709d8(null,_0x2d652c);}}});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.rpc.js b/server/api/squareProject/squareProject.rpc.js index 01527bf..762fdbe 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 _0x8efb=['socket.io-emitter','register','GetSquareProjects','findAll','options','raw','attributes','limit','map','model','include','then','info','catch','error','message','ShowSquareProject','SquareProject','find','where','stringify','lodash','ioredis','../../config/logger','../../config/environment','redis','defaults'];(function(_0x8ee4d,_0x47f1ca){var _0x1ff628=function(_0x2a8b87){while(--_0x2a8b87){_0x8ee4d['push'](_0x8ee4d['shift']());}};_0x1ff628(++_0x47f1ca);}(_0x8efb,0xed));var _0xb8ef=function(_0x30246e,_0x34e087){_0x30246e=_0x30246e-0x0;var _0x482cd4=_0x8efb[_0x30246e];return _0x482cd4;};'use strict';var _=require(_0xb8ef('0x0'));var Redis=require(_0xb8ef('0x1'));var db=require('../../mysqldb')['db'];var logger=require(_0xb8ef('0x2'))('rpc');var config=require(_0xb8ef('0x3'));config[_0xb8ef('0x4')]=_[_0xb8ef('0x5')](config[_0xb8ef('0x4')],{'host':'localhost','port':0x18eb});var socket=require(_0xb8ef('0x6'))(new Redis(config[_0xb8ef('0x4')]));require('./squareProject.socket')[_0xb8ef('0x7')](socket);exports[_0xb8ef('0x8')]=function(_0x52230a){var _0x532509=this;return new Promise(function(_0x18a0c8,_0x15be5b){return db['SquareProject'][_0xb8ef('0x9')]({'raw':_0x52230a['options']?_0x52230a[_0xb8ef('0xa')][_0xb8ef('0xb')]===undefined?!![]:![]:!![],'where':_0x52230a[_0xb8ef('0xa')]?_0x52230a['options']['where']||null:null,'attributes':_0x52230a[_0xb8ef('0xa')]?_0x52230a['options'][_0xb8ef('0xc')]||null:null,'limit':_0x52230a[_0xb8ef('0xa')]?_0x52230a['options'][_0xb8ef('0xd')]||null:null,'include':_0x52230a[_0xb8ef('0xa')]?_0x52230a[_0xb8ef('0xa')]['include']?_[_0xb8ef('0xe')](_0x52230a[_0xb8ef('0xa')]['include'],function(_0x57c52a){return{'model':db[_0x57c52a[_0xb8ef('0xf')]],'as':_0x57c52a['as'],'attributes':_0x57c52a[_0xb8ef('0xc')],'include':_0x57c52a[_0xb8ef('0x10')]?_[_0xb8ef('0xe')](_0x57c52a['include'],function(_0x4c1c24){return{'model':db[_0x4c1c24[_0xb8ef('0xf')]],'as':_0x4c1c24['as'],'attributes':_0x4c1c24['attributes'],'include':_0x4c1c24['include']?_[_0xb8ef('0xe')](_0x4c1c24[_0xb8ef('0x10')],function(_0x485dc6){return{'model':db[_0x485dc6[_0xb8ef('0xf')]],'as':_0x485dc6['as'],'attributes':_0x485dc6['attributes']};}):[]};}):[]};}):[]:[]})[_0xb8ef('0x11')](function(_0x109fd3){logger[_0xb8ef('0x12')](_0xb8ef('0x8'),_0x52230a);logger['debug'](_0xb8ef('0x8'),_0x52230a,JSON['stringify'](_0x109fd3));_0x18a0c8(_0x109fd3);})[_0xb8ef('0x13')](function(_0x2fb3fe){logger[_0xb8ef('0x14')](_0xb8ef('0x8'),_0x2fb3fe[_0xb8ef('0x15')],_0x52230a);_0x15be5b(_0x532509[_0xb8ef('0x14')](0x1f4,_0x2fb3fe[_0xb8ef('0x15')]));});});};exports[_0xb8ef('0x16')]=function(_0x484e70){var _0x1db100=this;return new Promise(function(_0x1205dc,_0x2b194f){return db[_0xb8ef('0x17')][_0xb8ef('0x18')]({'raw':_0x484e70[_0xb8ef('0xa')]?_0x484e70['options'][_0xb8ef('0xb')]===undefined?!![]:![]:!![],'where':_0x484e70[_0xb8ef('0xa')]?_0x484e70[_0xb8ef('0xa')][_0xb8ef('0x19')]||null:null,'attributes':_0x484e70[_0xb8ef('0xa')]?_0x484e70[_0xb8ef('0xa')]['attributes']||null:null,'include':_0x484e70['options']?_0x484e70[_0xb8ef('0xa')]['include']?_[_0xb8ef('0xe')](_0x484e70[_0xb8ef('0xa')]['include'],function(_0x5ad021){return{'model':db[_0x5ad021[_0xb8ef('0xf')]],'as':_0x5ad021['as'],'attributes':_0x5ad021[_0xb8ef('0xc')],'include':_0x5ad021['include']?_[_0xb8ef('0xe')](_0x5ad021[_0xb8ef('0x10')],function(_0x2431be){return{'model':db[_0x2431be[_0xb8ef('0xf')]],'as':_0x2431be['as'],'attributes':_0x2431be[_0xb8ef('0xc')],'include':_0x2431be[_0xb8ef('0x10')]?_['map'](_0x2431be[_0xb8ef('0x10')],function(_0x158e65){return{'model':db[_0x158e65[_0xb8ef('0xf')]],'as':_0x158e65['as'],'attributes':_0x158e65['attributes']};}):[]};}):[]};}):[]:[]})[_0xb8ef('0x11')](function(_0x1a726d){logger[_0xb8ef('0x12')]('ShowSquareProject',_0x484e70);logger['debug'](_0xb8ef('0x16'),_0x484e70,JSON[_0xb8ef('0x1a')](_0x1a726d));_0x1205dc(_0x1a726d);})[_0xb8ef('0x13')](function(_0x4cbbf5){logger[_0xb8ef('0x14')](_0xb8ef('0x16'),_0x4cbbf5[_0xb8ef('0x15')],_0x484e70);_0x2b194f(_0x1db100[_0xb8ef('0x14')](0x1f4,_0x4cbbf5[_0xb8ef('0x15')]));});});}; \ No newline at end of file +var _0x28fa=['options','where','attributes','include','map','model','then','info','debug','catch','message','error','ShowSquareProject','find','raw','stringify','ioredis','../../mysqldb','rpc','../../config/environment','redis','localhost','socket.io-emitter','GetSquareProjects','SquareProject','findAll'];(function(_0x1adb25,_0xca06ef){var _0x41444e=function(_0x37b451){while(--_0x37b451){_0x1adb25['push'](_0x1adb25['shift']());}};_0x41444e(++_0xca06ef);}(_0x28fa,0xc6));var _0xa28f=function(_0x3bac25,_0x5ae592){_0x3bac25=_0x3bac25-0x0;var _0x434676=_0x28fa[_0x3bac25];return _0x434676;};'use strict';var _=require('lodash');var Redis=require(_0xa28f('0x0'));var db=require(_0xa28f('0x1'))['db'];var logger=require('../../config/logger')(_0xa28f('0x2'));var config=require(_0xa28f('0x3'));config[_0xa28f('0x4')]=_['defaults'](config['redis'],{'host':_0xa28f('0x5'),'port':0x18eb});var socket=require(_0xa28f('0x6'))(new Redis(config[_0xa28f('0x4')]));require('./squareProject.socket')['register'](socket);exports[_0xa28f('0x7')]=function(_0x5d87ff){var _0x5c4580=this;return new Promise(function(_0x44633f,_0x553b1d){return db[_0xa28f('0x8')][_0xa28f('0x9')]({'raw':_0x5d87ff[_0xa28f('0xa')]?_0x5d87ff[_0xa28f('0xa')]['raw']===undefined?!![]:![]:!![],'where':_0x5d87ff['options']?_0x5d87ff[_0xa28f('0xa')][_0xa28f('0xb')]||null:null,'attributes':_0x5d87ff[_0xa28f('0xa')]?_0x5d87ff[_0xa28f('0xa')][_0xa28f('0xc')]||null:null,'limit':_0x5d87ff['options']?_0x5d87ff[_0xa28f('0xa')]['limit']||null:null,'include':_0x5d87ff[_0xa28f('0xa')]?_0x5d87ff['options'][_0xa28f('0xd')]?_[_0xa28f('0xe')](_0x5d87ff[_0xa28f('0xa')][_0xa28f('0xd')],function(_0xd90c53){return{'model':db[_0xd90c53[_0xa28f('0xf')]],'as':_0xd90c53['as'],'attributes':_0xd90c53[_0xa28f('0xc')],'include':_0xd90c53[_0xa28f('0xd')]?_['map'](_0xd90c53[_0xa28f('0xd')],function(_0x163187){return{'model':db[_0x163187[_0xa28f('0xf')]],'as':_0x163187['as'],'attributes':_0x163187['attributes'],'include':_0x163187[_0xa28f('0xd')]?_['map'](_0x163187[_0xa28f('0xd')],function(_0x40a705){return{'model':db[_0x40a705['model']],'as':_0x40a705['as'],'attributes':_0x40a705['attributes']};}):[]};}):[]};}):[]:[]})[_0xa28f('0x10')](function(_0x5f3925){logger[_0xa28f('0x11')](_0xa28f('0x7'),_0x5d87ff);logger[_0xa28f('0x12')](_0xa28f('0x7'),_0x5d87ff,JSON['stringify'](_0x5f3925));_0x44633f(_0x5f3925);})[_0xa28f('0x13')](function(_0x51aafc){logger['error'](_0xa28f('0x7'),_0x51aafc[_0xa28f('0x14')],_0x5d87ff);_0x553b1d(_0x5c4580[_0xa28f('0x15')](0x1f4,_0x51aafc['message']));});});};exports[_0xa28f('0x16')]=function(_0x1df4f0){var _0x2943bb=this;return new Promise(function(_0x3efc28,_0x158090){return db[_0xa28f('0x8')][_0xa28f('0x17')]({'raw':_0x1df4f0['options']?_0x1df4f0[_0xa28f('0xa')][_0xa28f('0x18')]===undefined?!![]:![]:!![],'where':_0x1df4f0[_0xa28f('0xa')]?_0x1df4f0['options'][_0xa28f('0xb')]||null:null,'attributes':_0x1df4f0[_0xa28f('0xa')]?_0x1df4f0['options'][_0xa28f('0xc')]||null:null,'include':_0x1df4f0[_0xa28f('0xa')]?_0x1df4f0[_0xa28f('0xa')][_0xa28f('0xd')]?_['map'](_0x1df4f0[_0xa28f('0xa')][_0xa28f('0xd')],function(_0x56d061){return{'model':db[_0x56d061[_0xa28f('0xf')]],'as':_0x56d061['as'],'attributes':_0x56d061['attributes'],'include':_0x56d061[_0xa28f('0xd')]?_[_0xa28f('0xe')](_0x56d061[_0xa28f('0xd')],function(_0x40d316){return{'model':db[_0x40d316[_0xa28f('0xf')]],'as':_0x40d316['as'],'attributes':_0x40d316[_0xa28f('0xc')],'include':_0x40d316[_0xa28f('0xd')]?_[_0xa28f('0xe')](_0x40d316[_0xa28f('0xd')],function(_0x28780c){return{'model':db[_0x28780c['model']],'as':_0x28780c['as'],'attributes':_0x28780c[_0xa28f('0xc')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4aa21d){logger['info'](_0xa28f('0x16'),_0x1df4f0);logger[_0xa28f('0x12')](_0xa28f('0x16'),_0x1df4f0,JSON[_0xa28f('0x19')](_0x4aa21d));_0x3efc28(_0x4aa21d);})[_0xa28f('0x13')](function(_0x52000b){logger[_0xa28f('0x15')](_0xa28f('0x16'),_0x52000b[_0xa28f('0x14')],_0x1df4f0);_0x158090(_0x2943bb['error'](0x1f4,_0x52000b[_0xa28f('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.socket.js b/server/api/squareProject/squareProject.socket.js index d58bed9..e4b38ac 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 _0xd528=['emit','removeListener','register','save','remove','update'];(function(_0x27ebe0,_0x3e2f13){var _0x23d72c=function(_0x444948){while(--_0x444948){_0x27ebe0['push'](_0x27ebe0['shift']());}};_0x23d72c(++_0x3e2f13);}(_0xd528,0xc3));var _0x8d52=function(_0x471c5e,_0x20aa5d){_0x471c5e=_0x471c5e-0x0;var _0x30c43a=_0xd528[_0x471c5e];return _0x30c43a;};'use strict';var SquareProjectEvents=require('./squareProject.events');var events=[_0x8d52('0x0'),_0x8d52('0x1'),_0x8d52('0x2')];function createListener(_0x5f2830,_0x535957){return function(_0x49e1bf){_0x535957[_0x8d52('0x3')](_0x5f2830,_0x49e1bf);};}function removeListener(_0x4ec8df,_0x3ea63e){return function(){SquareProjectEvents[_0x8d52('0x4')](_0x4ec8df,_0x3ea63e);};}exports[_0x8d52('0x5')]=function(_0xcd040){for(var _0x189391=0x0,_0x3e3541=events['length'];_0x189391<_0x3e3541;_0x189391++){var _0x1b5c70=events[_0x189391];var _0x246eb3=createListener('squareProject:'+_0x1b5c70,_0xcd040);SquareProjectEvents['on'](_0x1b5c70,_0x246eb3);}}; \ No newline at end of file +var _0x8074=['removeListener','register','update','emit'];(function(_0x5834bc,_0x3d4801){var _0x3e183a=function(_0x18b023){while(--_0x18b023){_0x5834bc['push'](_0x5834bc['shift']());}};_0x3e183a(++_0x3d4801);}(_0x8074,0x1b2));var _0x4807=function(_0x1f11e4,_0x46285f){_0x1f11e4=_0x1f11e4-0x0;var _0x41bc62=_0x8074[_0x1f11e4];return _0x41bc62;};'use strict';var SquareProjectEvents=require('./squareProject.events');var events=['save','remove',_0x4807('0x0')];function createListener(_0x3e66af,_0x590c93){return function(_0x3c47e8){_0x590c93[_0x4807('0x1')](_0x3e66af,_0x3c47e8);};}function removeListener(_0x90b1e8,_0x22d5ea){return function(){SquareProjectEvents[_0x4807('0x2')](_0x90b1e8,_0x22d5ea);};}exports[_0x4807('0x3')]=function(_0x7d8b78){for(var _0x4c329f=0x0,_0x3379d1=events['length'];_0x4c329f<_0x3379d1;_0x4c329f++){var _0x2b881d=events[_0x4c329f];var _0x580f24=createListener('squareProject:'+_0x2b881d,_0x7d8b78);SquareProjectEvents['on'](_0x2b881d,_0x580f24);}}; \ No newline at end of file diff --git a/server/api/squareRecording/index.js b/server/api/squareRecording/index.js index 11ae804..50562c1 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 _0x1261=['isAuthenticated','show','/:id/download','post','create','/:id','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareRecording.controller','index','get'];(function(_0x4b2b96,_0x3e322b){var _0xcd766a=function(_0x579b03){while(--_0x579b03){_0x4b2b96['push'](_0x4b2b96['shift']());}};_0xcd766a(++_0x3e322b);}(_0x1261,0x144));var _0x1126=function(_0x28c939,_0x110e29){_0x28c939=_0x28c939-0x0;var _0x527fe9=_0x1261[_0x28c939];return _0x527fe9;};'use strict';var multer=require('multer');var util=require(_0x1126('0x0'));var path=require(_0x1126('0x1'));var timeout=require(_0x1126('0x2'));var express=require(_0x1126('0x3'));var router=express[_0x1126('0x4')]();var fs_extra=require(_0x1126('0x5'));var auth=require(_0x1126('0x6'));var interaction=require(_0x1126('0x7'));var config=require(_0x1126('0x8'));var controller=require(_0x1126('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0x1126('0xa')]);router[_0x1126('0xb')]('/:id',auth[_0x1126('0xc')](),controller[_0x1126('0xd')]);router[_0x1126('0xb')](_0x1126('0xe'),auth[_0x1126('0xc')](),controller['download']);router[_0x1126('0xf')]('/',auth[_0x1126('0xc')](),controller[_0x1126('0x10')]);router['put'](_0x1126('0x11'),auth['isAuthenticated'](),controller['update']);router[_0x1126('0x12')]('/:id',auth[_0x1126('0xc')](),controller[_0x1126('0x13')]);module[_0x1126('0x14')]=router; \ No newline at end of file +var _0x5fab=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareRecording.controller','get','isAuthenticated','/:id','show','/:id/download','download','create','put','update','delete','destroy','multer','util','connect-timeout'];(function(_0x53148f,_0x49c20a){var _0x223cca=function(_0xd7e75a){while(--_0xd7e75a){_0x53148f['push'](_0x53148f['shift']());}};_0x223cca(++_0x49c20a);}(_0x5fab,0x177));var _0xb5fa=function(_0x36b5be,_0x25cbb9){_0x36b5be=_0x36b5be-0x0;var _0x186b09=_0x5fab[_0x36b5be];return _0x186b09;};'use strict';var multer=require(_0xb5fa('0x0'));var util=require(_0xb5fa('0x1'));var path=require('path');var timeout=require(_0xb5fa('0x2'));var express=require(_0xb5fa('0x3'));var router=express[_0xb5fa('0x4')]();var fs_extra=require(_0xb5fa('0x5'));var auth=require(_0xb5fa('0x6'));var interaction=require(_0xb5fa('0x7'));var config=require(_0xb5fa('0x8'));var controller=require(_0xb5fa('0x9'));router[_0xb5fa('0xa')]('/',auth[_0xb5fa('0xb')](),controller['index']);router['get'](_0xb5fa('0xc'),auth[_0xb5fa('0xb')](),controller[_0xb5fa('0xd')]);router['get'](_0xb5fa('0xe'),auth[_0xb5fa('0xb')](),controller[_0xb5fa('0xf')]);router['post']('/',auth['isAuthenticated'](),controller[_0xb5fa('0x10')]);router[_0xb5fa('0x11')](_0xb5fa('0xc'),auth[_0xb5fa('0xb')](),controller[_0xb5fa('0x12')]);router[_0xb5fa('0x13')](_0xb5fa('0xc'),auth[_0xb5fa('0xb')](),controller[_0xb5fa('0x14')]);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 ea6a9f1..1eacb5a 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 _0xb458=['sequelize','exports','STRING','VIRTUAL','getDataValue','substring','lastIndexOf'];(function(_0x24f827,_0x562d19){var _0x2ae659=function(_0x281702){while(--_0x281702){_0x24f827['push'](_0x24f827['shift']());}};_0x2ae659(++_0x562d19);}(_0xb458,0x103));var _0x8b45=function(_0x5b834d,_0x41719b){_0x5b834d=_0x5b834d-0x0;var _0x5af488=_0xb458[_0x5b834d];return _0x5af488;};'use strict';var Sequelize=require(_0x8b45('0x0'));module[_0x8b45('0x1')]={'uniqueid':{'type':Sequelize[_0x8b45('0x2')]},'callerid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x8b45('0x2')]},'extension':{'type':Sequelize[_0x8b45('0x2')]},'priority':{'type':Sequelize[_0x8b45('0x2')]},'accountcode':{'type':Sequelize[_0x8b45('0x2')]},'dnid':{'type':Sequelize['STRING']},'projectName':{'type':Sequelize[_0x8b45('0x2')]},'saveName':{'type':Sequelize['STRING']},'filename':{'type':Sequelize['STRING']},'savePath':{'type':Sequelize[_0x8b45('0x2')]},'format':{'type':Sequelize[_0x8b45('0x3')],'get':function(){var _0x2daa9a='';var _0x3a8ccb=this[_0x8b45('0x4')]('savePath');if(_0x3a8ccb){_0x2daa9a=_0x3a8ccb[_0x8b45('0x5')](_0x3a8ccb[_0x8b45('0x6')]('.'));}return _0x2daa9a;}}}; \ No newline at end of file +var _0x3eea=['getDataValue','substring','sequelize','STRING'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x3eea,0x1ca));var _0xa3ee=function(_0x4ae019,_0x1a1438){_0x4ae019=_0x4ae019-0x0;var _0x511530=_0x3eea[_0x4ae019];return _0x511530;};'use strict';var Sequelize=require(_0xa3ee('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0xa3ee('0x1')]},'callerid':{'type':Sequelize[_0xa3ee('0x1')]},'calleridname':{'type':Sequelize[_0xa3ee('0x1')]},'context':{'type':Sequelize[_0xa3ee('0x1')]},'extension':{'type':Sequelize[_0xa3ee('0x1')]},'priority':{'type':Sequelize[_0xa3ee('0x1')]},'accountcode':{'type':Sequelize[_0xa3ee('0x1')]},'dnid':{'type':Sequelize[_0xa3ee('0x1')]},'projectName':{'type':Sequelize[_0xa3ee('0x1')]},'saveName':{'type':Sequelize[_0xa3ee('0x1')]},'filename':{'type':Sequelize[_0xa3ee('0x1')]},'savePath':{'type':Sequelize['STRING']},'format':{'type':Sequelize['VIRTUAL'],'get':function(){var _0x4183ee='';var _0x4e4588=this[_0xa3ee('0x2')]('savePath');if(_0x4e4588){_0x4183ee=_0x4e4588[_0xa3ee('0x3')](_0x4e4588['lastIndexOf']('.'));}return _0x4183ee;}}}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.controller.js b/server/api/squareRecording/squareRecording.controller.js index 4e4841a..536763f 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 _0x9543=['options','SquareRecording','includeAll','findAll','params','find','catch','create','body','../../components/encryptor','uniqueid','format','existsSync','secrets','recording','savePath','Sequelize','ValidationError','SquareRecording\x20not\x20found','filename','extname','unlink','download','message','Not\x20found','isNil','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','unlinkSync','.cypher','end','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','fs-extra','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','save','update','then','destroy','error','stack','name','send','index','rawAttributes','type','model','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','query','order','sort','where','filters','filter','merge','map','VIRTUAL'];(function(_0x576319,_0x5471f9){var _0x34afc3=function(_0x192df8){while(--_0x192df8){_0x576319['push'](_0x576319['shift']());}};_0x34afc3(++_0x5471f9);}(_0x9543,0xe1));var _0x3954=function(_0x52ce2c,_0x51d527){_0x52ce2c=_0x52ce2c-0x0;var _0x292ab7=_0x9543[_0x52ce2c];return _0x292ab7;};'use strict';var emlformat=require(_0x3954('0x0'));var rimraf=require(_0x3954('0x1'));var zipdir=require(_0x3954('0x2'));var jsonpatch=require(_0x3954('0x3'));var rp=require(_0x3954('0x4'));var moment=require(_0x3954('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x3954('0x6'));var util=require(_0x3954('0x7'));var path=require(_0x3954('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3954('0x9'));var _=require('lodash');var squel=require(_0x3954('0xa'));var crypto=require(_0x3954('0xb'));var jsforce=require(_0x3954('0xc'));var deskjs=require(_0x3954('0xd'));var toCsv=require(_0x3954('0xe'));var querystring=require(_0x3954('0xf'));var Papa=require(_0x3954('0x10'));var Redis=require(_0x3954('0x11'));var authService=require(_0x3954('0x12'));var qs=require(_0x3954('0x13'));var as=require(_0x3954('0x14'));var hardwareService=require(_0x3954('0x15'));var logger=require(_0x3954('0x16'))(_0x3954('0x17'));var utils=require(_0x3954('0x18'));var config=require(_0x3954('0x19'));var licenseUtil=require(_0x3954('0x1a'));var db=require(_0x3954('0x1b'))['db'];function respondWithStatusCode(_0x2d2971,_0x4c0b00){_0x4c0b00=_0x4c0b00||0xcc;return function(_0x4f0e66){if(_0x4f0e66){return _0x2d2971[_0x3954('0x1c')](_0x4c0b00);}return _0x2d2971[_0x3954('0x1d')](_0x4c0b00)['end']();};}function respondWithResult(_0x33077c,_0x300ef4){_0x300ef4=_0x300ef4||0xc8;return function(_0x2b52eb){if(_0x2b52eb){return _0x33077c[_0x3954('0x1d')](_0x300ef4)[_0x3954('0x1e')](_0x2b52eb);}};}function respondWithFilteredResult(_0xc6208d,_0x1f8a2b){return function(_0x42a6e1){if(_0x42a6e1){var _0x500704=typeof _0x1f8a2b[_0x3954('0x1f')]===_0x3954('0x20')&&typeof _0x1f8a2b[_0x3954('0x21')]===_0x3954('0x20');var _0x5a6cf9=_0x42a6e1[_0x3954('0x22')];var _0x1b8128=_0x500704?0x0:_0x1f8a2b['offset'];var _0x27745e=_0x500704?_0x42a6e1[_0x3954('0x22')]:_0x1f8a2b[_0x3954('0x1f')]+_0x1f8a2b['limit'];var _0x5c2e3b;if(_0x27745e>=_0x5a6cf9){_0x27745e=_0x5a6cf9;_0x5c2e3b=0xc8;}else{_0x5c2e3b=0xce;}_0xc6208d['status'](_0x5c2e3b);return _0xc6208d['set']('Content-Range',_0x1b8128+'-'+_0x27745e+'/'+_0x5a6cf9)[_0x3954('0x1e')](_0x42a6e1);}return null;};}function patchUpdates(_0x490aec){return function(_0x15b6c9){try{jsonpatch['apply'](_0x15b6c9,_0x490aec,!![]);}catch(_0x475590){return BPromise['reject'](_0x475590);}return _0x15b6c9[_0x3954('0x23')]();};}function saveUpdates(_0x4e7f6b,_0x2867e7){return function(_0x224bbb){if(_0x224bbb){return _0x224bbb[_0x3954('0x24')](_0x4e7f6b)[_0x3954('0x25')](function(_0x16892d){return _0x16892d;});}return null;};}function removeEntity(_0x55dcd3,_0x3700c5){return function(_0x2ef3c5){if(_0x2ef3c5){return _0x2ef3c5[_0x3954('0x26')]()['then'](function(){_0x55dcd3[_0x3954('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2d0776,_0x5a6be3){return function(_0x42aaec){if(!_0x42aaec){_0x2d0776[_0x3954('0x1c')](0x194);}return _0x42aaec;};}function handleError(_0x12601f,_0x3d365a){_0x3d365a=_0x3d365a||0x1f4;return function(_0x3595f2){logger[_0x3954('0x27')](_0x3595f2[_0x3954('0x28')]);if(_0x3595f2['name']){delete _0x3595f2[_0x3954('0x29')];}_0x12601f[_0x3954('0x1d')](_0x3d365a)[_0x3954('0x2a')](_0x3595f2);};}exports[_0x3954('0x2b')]=function(_0x313228,_0x462cb6){var _0x31f66b={},_0x16eeb6={},_0x5622e8={'count':0x0,'rows':[]};var _0x7a173b=_['map'](db['SquareRecording'][_0x3954('0x2c')],function(_0x878cec){return{'name':_0x878cec['fieldName'],'type':_0x878cec[_0x3954('0x2d')]['key']};});_0x16eeb6[_0x3954('0x2e')]=_['map'](_0x7a173b,_0x3954('0x29'));_0x16eeb6['query']=_[_0x3954('0x2f')](_0x313228['query']);_0x16eeb6['filters']=_[_0x3954('0x30')](_0x16eeb6['model'],_0x16eeb6['query']);_0x31f66b['attributes']=_[_0x3954('0x30')](_0x16eeb6[_0x3954('0x2e')],qs['fields'](_0x313228['query'][_0x3954('0x31')]));_0x31f66b[_0x3954('0x32')]=_0x31f66b[_0x3954('0x32')][_0x3954('0x33')]?_0x31f66b['attributes']:_0x16eeb6['model'];if(!_0x313228['query'][_0x3954('0x34')](_0x3954('0x35'))){_0x31f66b[_0x3954('0x21')]=qs['limit'](_0x313228['query'][_0x3954('0x21')]);_0x31f66b[_0x3954('0x1f')]=qs[_0x3954('0x1f')](_0x313228[_0x3954('0x36')][_0x3954('0x1f')]);}_0x31f66b[_0x3954('0x37')]=qs[_0x3954('0x38')](_0x313228[_0x3954('0x36')]['sort']);_0x31f66b[_0x3954('0x39')]=qs[_0x3954('0x3a')](_['pick'](_0x313228['query'],_0x16eeb6[_0x3954('0x3a')]),_0x7a173b);if(_0x313228['query'][_0x3954('0x3b')]){_0x31f66b[_0x3954('0x39')]=_[_0x3954('0x3c')](_0x31f66b[_0x3954('0x39')],{'$or':_[_0x3954('0x3d')](_0x7a173b,function(_0x257904){if(_0x257904[_0x3954('0x2d')]!==_0x3954('0x3e')){var _0x408b19={};_0x408b19[_0x257904[_0x3954('0x29')]]={'$like':'%'+_0x313228[_0x3954('0x36')][_0x3954('0x3b')]+'%'};return _0x408b19;}})});}_0x31f66b=_[_0x3954('0x3c')]({},_0x31f66b,_0x313228[_0x3954('0x3f')]);var _0x1c06a9={'where':_0x31f66b[_0x3954('0x39')]};return db[_0x3954('0x40')][_0x3954('0x22')](_0x1c06a9)[_0x3954('0x25')](function(_0x200a29){_0x5622e8[_0x3954('0x22')]=_0x200a29;if(_0x313228[_0x3954('0x36')][_0x3954('0x41')]){_0x31f66b['include']=[{'all':!![]}];}return db[_0x3954('0x40')][_0x3954('0x42')](_0x31f66b);})[_0x3954('0x25')](function(_0x20b73f){_0x5622e8['rows']=_0x20b73f;return _0x5622e8;})[_0x3954('0x25')](respondWithFilteredResult(_0x462cb6,_0x31f66b))['catch'](handleError(_0x462cb6,null));};exports['show']=function(_0x342842,_0x516699){var _0xfb8810={'raw':!![],'where':{'id':_0x342842[_0x3954('0x43')]['id']}},_0x17c9db={};_0x17c9db['model']=_[_0x3954('0x2f')](db['SquareRecording'][_0x3954('0x2c')]);_0x17c9db[_0x3954('0x36')]=_[_0x3954('0x2f')](_0x342842[_0x3954('0x36')]);_0x17c9db[_0x3954('0x3a')]=_['intersection'](_0x17c9db[_0x3954('0x2e')],_0x17c9db[_0x3954('0x36')]);_0xfb8810[_0x3954('0x32')]=_[_0x3954('0x30')](_0x17c9db[_0x3954('0x2e')],qs[_0x3954('0x31')](_0x342842['query'][_0x3954('0x31')]));_0xfb8810['attributes']=_0xfb8810['attributes']['length']?_0xfb8810[_0x3954('0x32')]:_0x17c9db['model'];if(_0x342842[_0x3954('0x36')][_0x3954('0x41')]){_0xfb8810['include']=[{'all':!![]}];}_0xfb8810=_[_0x3954('0x3c')]({},_0xfb8810,_0x342842['options']);return db[_0x3954('0x40')][_0x3954('0x44')](_0xfb8810)[_0x3954('0x25')](handleEntityNotFound(_0x516699,null))[_0x3954('0x25')](respondWithResult(_0x516699,null))[_0x3954('0x45')](handleError(_0x516699,null));};exports[_0x3954('0x46')]=function(_0x40654f,_0x38d678){return db['SquareRecording'][_0x3954('0x46')](_0x40654f[_0x3954('0x47')],{})[_0x3954('0x25')](respondWithResult(_0x38d678,0xc9))[_0x3954('0x45')](handleError(_0x38d678,null));};exports[_0x3954('0x24')]=function(_0x28b9a9,_0x47de23){if(_0x28b9a9['body']['id']){delete _0x28b9a9[_0x3954('0x47')]['id'];}return db['SquareRecording'][_0x3954('0x44')]({'where':{'id':_0x28b9a9['params']['id']}})['then'](handleEntityNotFound(_0x47de23,null))[_0x3954('0x25')](saveUpdates(_0x28b9a9[_0x3954('0x47')],null))[_0x3954('0x25')](respondWithResult(_0x47de23,null))[_0x3954('0x45')](handleError(_0x47de23,null));};exports['download']=function(_0x1eda28,_0x3569ec,_0x48e917){var _0xb46343=require(_0x3954('0x48'));var _0x15a2a2=![];var _0x202618={};if(_0x1eda28['query']['type']&&_0x1eda28['query'][_0x3954('0x2d')]===_0x3954('0x49')){_0x202618['uniqueid']=_0x1eda28['params']['id'];}else{_0x202618['id']=_0x1eda28[_0x3954('0x43')]['id'];}return db[_0x3954('0x40')][_0x3954('0x44')]({'where':_0x202618,'attributes':['id','savePath','filename'],'raw':!![]})[_0x3954('0x25')](handleEntityNotFound(_0x3569ec,null))[_0x3954('0x25')](function(_0x342a56){if(_0x342a56){var _0x59abd9=_0x342a56['savePath'];var _0x2bce3b=util[_0x3954('0x4a')]('%s.cypher',_0x59abd9);if(fs[_0x3954('0x4b')](_0x2bce3b)){_0x15a2a2=!![];return _0xb46343['decryptFile'](_0x2bce3b,_0x59abd9,config[_0x3954('0x4c')][_0x3954('0x4d')])['then'](function(){return _0x342a56;});}return _0x342a56;}})['then'](function(_0x45b3e4){if(_0x45b3e4){var _0x46701b=_0x45b3e4[_0x3954('0x4e')];if(!fs[_0x3954('0x4b')](_0x46701b)){throw new db[(_0x3954('0x4f'))][(_0x3954('0x50'))](_0x3954('0x51'));}if(_0x45b3e4[_0x3954('0x52')]){return _0x3569ec['download'](_0x46701b,_0x45b3e4[_0x3954('0x52')]+path[_0x3954('0x53')](_0x46701b),function(){if(_0x15a2a2){fs[_0x3954('0x54')](_0x46701b);}});}else{return _0x3569ec[_0x3954('0x55')](_0x46701b,function(_0x42387e){if(_0x15a2a2){fs['unlink'](_0x46701b);}});}}})['catch'](function(_0x5a6eec){if(_0x5a6eec[_0x3954('0x56')]==='SquareRecording\x20not\x20found'){_0x3569ec[_0x3954('0x1d')](0x194)[_0x3954('0x2a')](_0x3954('0x57'));}else{return handleError(_0x3569ec,null);}});};exports[_0x3954('0x26')]=function(_0x2d1acc,_0x26237c){return db[_0x3954('0x40')][_0x3954('0x44')]({'where':{'id':_0x2d1acc[_0x3954('0x43')]['id']}})[_0x3954('0x25')](function(_0x423b1d){if(_[_0x3954('0x58')](_0x423b1d)){throw new ReferenceError(_0x3954('0x59'));}return _0x423b1d;})[_0x3954('0x25')](function(_0x4503db){var _0x337559=_0x4503db[_0x3954('0x4e')];logger[_0x3954('0x5a')](_0x3954('0x5b'),_0x337559);if(!_['isNil'](_0x4503db[_0x3954('0x4e')])&&fs['existsSync'](_0x337559)){logger['info'](_0x3954('0x5c')+_0x337559+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0x3954('0x5d')](_0x337559);}_0x337559=_0x337559+_0x3954('0x5e');if(!_[_0x3954('0x58')](_0x4503db[_0x3954('0x4e')])&&fs[_0x3954('0x4b')](_0x337559)){logger['info'](_0x3954('0x5c')+_0x337559+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0x3954('0x5d')](_0x337559);}return _0x4503db;})[_0x3954('0x25')](function(_0x5eabdf){if(!_0x5eabdf)throw new InternalError();return _0x5eabdf['destroy']();})[_0x3954('0x25')](function(){_0x26237c[_0x3954('0x1d')](0xcc)[_0x3954('0x5f')]();})[_0x3954('0x45')](handleError(_0x26237c,null));}; \ No newline at end of file +var _0xf509=['Not\x20found','destroy','isNil','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','fs-extra','lodash','crypto','jsforce','to-csv','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','end','status','offset','undefined','count','limit','set','json','then','error','stack','name','send','index','map','SquareRecording','rawAttributes','fieldName','key','model','query','keys','filters','attributes','fields','hasOwnProperty','nolimit','order','where','pick','filter','merge','type','VIRTUAL','options','includeAll','findAll','rows','show','params','intersection','length','find','catch','create','body','update','download','../../components/encryptor','uniqueid','savePath','format','%s.cypher','decryptFile','recording','existsSync','Sequelize','ValidationError','SquareRecording\x20not\x20found','filename','extname','unlink','message'];(function(_0x50c492,_0x5c1e67){var _0x3505a8=function(_0x2f7937){while(--_0x2f7937){_0x50c492['push'](_0x50c492['shift']());}};_0x3505a8(++_0x5c1e67);}(_0xf509,0xc9));var _0x9f50=function(_0x2cf2e9,_0xd58ea1){_0x2cf2e9=_0x2cf2e9-0x0;var _0xd3670d=_0xf509[_0x2cf2e9];return _0xd3670d;};'use strict';var emlformat=require(_0x9f50('0x0'));var rimraf=require(_0x9f50('0x1'));var zipdir=require(_0x9f50('0x2'));var jsonpatch=require(_0x9f50('0x3'));var rp=require(_0x9f50('0x4'));var moment=require(_0x9f50('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x9f50('0x6'));var util=require(_0x9f50('0x7'));var path=require(_0x9f50('0x8'));var sox=require(_0x9f50('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9f50('0xa'));var _=require(_0x9f50('0xb'));var squel=require('squel');var crypto=require(_0x9f50('0xc'));var jsforce=require(_0x9f50('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x9f50('0xe'));var querystring=require('querystring');var Papa=require(_0x9f50('0xf'));var Redis=require('ioredis');var authService=require(_0x9f50('0x10'));var qs=require(_0x9f50('0x11'));var as=require(_0x9f50('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9f50('0x13'))(_0x9f50('0x14'));var utils=require(_0x9f50('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x9f50('0x16'))['db'];function respondWithStatusCode(_0x404a0f,_0x445892){_0x445892=_0x445892||0xcc;return function(_0x2c0789){if(_0x2c0789){return _0x404a0f[_0x9f50('0x17')](_0x445892);}return _0x404a0f['status'](_0x445892)[_0x9f50('0x18')]();};}function respondWithResult(_0x3789ca,_0x41956f){_0x41956f=_0x41956f||0xc8;return function(_0x2712fc){if(_0x2712fc){return _0x3789ca[_0x9f50('0x19')](_0x41956f)['json'](_0x2712fc);}};}function respondWithFilteredResult(_0x583f26,_0xad06fe){return function(_0x117031){if(_0x117031){var _0xf8bb29=typeof _0xad06fe[_0x9f50('0x1a')]===_0x9f50('0x1b')&&typeof _0xad06fe['limit']==='undefined';var _0x1a63cf=_0x117031[_0x9f50('0x1c')];var _0x17d5d5=_0xf8bb29?0x0:_0xad06fe[_0x9f50('0x1a')];var _0x4e8c1e=_0xf8bb29?_0x117031['count']:_0xad06fe['offset']+_0xad06fe[_0x9f50('0x1d')];var _0x215bdc;if(_0x4e8c1e>=_0x1a63cf){_0x4e8c1e=_0x1a63cf;_0x215bdc=0xc8;}else{_0x215bdc=0xce;}_0x583f26[_0x9f50('0x19')](_0x215bdc);return _0x583f26[_0x9f50('0x1e')]('Content-Range',_0x17d5d5+'-'+_0x4e8c1e+'/'+_0x1a63cf)[_0x9f50('0x1f')](_0x117031);}return null;};}function patchUpdates(_0x336df3){return function(_0x518ff7){try{jsonpatch['apply'](_0x518ff7,_0x336df3,!![]);}catch(_0x27df94){return BPromise['reject'](_0x27df94);}return _0x518ff7['save']();};}function saveUpdates(_0x14f15e,_0x56f7b1){return function(_0x3dc295){if(_0x3dc295){return _0x3dc295['update'](_0x14f15e)[_0x9f50('0x20')](function(_0x3b0aef){return _0x3b0aef;});}return null;};}function removeEntity(_0x536710,_0x114014){return function(_0x3681c3){if(_0x3681c3){return _0x3681c3['destroy']()[_0x9f50('0x20')](function(){_0x536710[_0x9f50('0x19')](0xcc)[_0x9f50('0x18')]();});}};}function handleEntityNotFound(_0x17008b,_0x391fbd){return function(_0x33a6a6){if(!_0x33a6a6){_0x17008b['sendStatus'](0x194);}return _0x33a6a6;};}function handleError(_0x1f8c4d,_0x37e96b){_0x37e96b=_0x37e96b||0x1f4;return function(_0x2d058b){logger[_0x9f50('0x21')](_0x2d058b[_0x9f50('0x22')]);if(_0x2d058b[_0x9f50('0x23')]){delete _0x2d058b[_0x9f50('0x23')];}_0x1f8c4d[_0x9f50('0x19')](_0x37e96b)[_0x9f50('0x24')](_0x2d058b);};}exports[_0x9f50('0x25')]=function(_0x28352d,_0x156b0f){var _0x515997={},_0x54c6c1={},_0x14846b={'count':0x0,'rows':[]};var _0x2e8996=_[_0x9f50('0x26')](db[_0x9f50('0x27')][_0x9f50('0x28')],function(_0x4afea6){return{'name':_0x4afea6[_0x9f50('0x29')],'type':_0x4afea6['type'][_0x9f50('0x2a')]};});_0x54c6c1[_0x9f50('0x2b')]=_['map'](_0x2e8996,_0x9f50('0x23'));_0x54c6c1[_0x9f50('0x2c')]=_[_0x9f50('0x2d')](_0x28352d[_0x9f50('0x2c')]);_0x54c6c1[_0x9f50('0x2e')]=_['intersection'](_0x54c6c1[_0x9f50('0x2b')],_0x54c6c1[_0x9f50('0x2c')]);_0x515997[_0x9f50('0x2f')]=_['intersection'](_0x54c6c1['model'],qs[_0x9f50('0x30')](_0x28352d[_0x9f50('0x2c')]['fields']));_0x515997[_0x9f50('0x2f')]=_0x515997['attributes']['length']?_0x515997[_0x9f50('0x2f')]:_0x54c6c1['model'];if(!_0x28352d[_0x9f50('0x2c')][_0x9f50('0x31')](_0x9f50('0x32'))){_0x515997[_0x9f50('0x1d')]=qs['limit'](_0x28352d[_0x9f50('0x2c')]['limit']);_0x515997[_0x9f50('0x1a')]=qs['offset'](_0x28352d['query'][_0x9f50('0x1a')]);}_0x515997[_0x9f50('0x33')]=qs['sort'](_0x28352d[_0x9f50('0x2c')]['sort']);_0x515997[_0x9f50('0x34')]=qs[_0x9f50('0x2e')](_[_0x9f50('0x35')](_0x28352d[_0x9f50('0x2c')],_0x54c6c1[_0x9f50('0x2e')]),_0x2e8996);if(_0x28352d[_0x9f50('0x2c')][_0x9f50('0x36')]){_0x515997[_0x9f50('0x34')]=_[_0x9f50('0x37')](_0x515997['where'],{'$or':_[_0x9f50('0x26')](_0x2e8996,function(_0x2b4351){if(_0x2b4351[_0x9f50('0x38')]!==_0x9f50('0x39')){var _0xa24a4d={};_0xa24a4d[_0x2b4351[_0x9f50('0x23')]]={'$like':'%'+_0x28352d[_0x9f50('0x2c')]['filter']+'%'};return _0xa24a4d;}})});}_0x515997=_['merge']({},_0x515997,_0x28352d[_0x9f50('0x3a')]);var _0x42387f={'where':_0x515997['where']};return db[_0x9f50('0x27')][_0x9f50('0x1c')](_0x42387f)[_0x9f50('0x20')](function(_0x457086){_0x14846b[_0x9f50('0x1c')]=_0x457086;if(_0x28352d[_0x9f50('0x2c')][_0x9f50('0x3b')]){_0x515997['include']=[{'all':!![]}];}return db[_0x9f50('0x27')][_0x9f50('0x3c')](_0x515997);})[_0x9f50('0x20')](function(_0x273b16){_0x14846b[_0x9f50('0x3d')]=_0x273b16;return _0x14846b;})[_0x9f50('0x20')](respondWithFilteredResult(_0x156b0f,_0x515997))['catch'](handleError(_0x156b0f,null));};exports[_0x9f50('0x3e')]=function(_0xa7c698,_0xbf3b17){var _0x43cca5={'raw':!![],'where':{'id':_0xa7c698[_0x9f50('0x3f')]['id']}},_0x44c90a={};_0x44c90a['model']=_[_0x9f50('0x2d')](db[_0x9f50('0x27')][_0x9f50('0x28')]);_0x44c90a[_0x9f50('0x2c')]=_[_0x9f50('0x2d')](_0xa7c698[_0x9f50('0x2c')]);_0x44c90a[_0x9f50('0x2e')]=_[_0x9f50('0x40')](_0x44c90a[_0x9f50('0x2b')],_0x44c90a[_0x9f50('0x2c')]);_0x43cca5[_0x9f50('0x2f')]=_[_0x9f50('0x40')](_0x44c90a[_0x9f50('0x2b')],qs['fields'](_0xa7c698[_0x9f50('0x2c')][_0x9f50('0x30')]));_0x43cca5['attributes']=_0x43cca5[_0x9f50('0x2f')][_0x9f50('0x41')]?_0x43cca5['attributes']:_0x44c90a[_0x9f50('0x2b')];if(_0xa7c698[_0x9f50('0x2c')][_0x9f50('0x3b')]){_0x43cca5['include']=[{'all':!![]}];}_0x43cca5=_[_0x9f50('0x37')]({},_0x43cca5,_0xa7c698['options']);return db[_0x9f50('0x27')][_0x9f50('0x42')](_0x43cca5)[_0x9f50('0x20')](handleEntityNotFound(_0xbf3b17,null))[_0x9f50('0x20')](respondWithResult(_0xbf3b17,null))[_0x9f50('0x43')](handleError(_0xbf3b17,null));};exports['create']=function(_0x32f71a,_0x2956e4){return db[_0x9f50('0x27')][_0x9f50('0x44')](_0x32f71a[_0x9f50('0x45')],{})[_0x9f50('0x20')](respondWithResult(_0x2956e4,0xc9))[_0x9f50('0x43')](handleError(_0x2956e4,null));};exports[_0x9f50('0x46')]=function(_0x46f2a8,_0x41afee){if(_0x46f2a8[_0x9f50('0x45')]['id']){delete _0x46f2a8[_0x9f50('0x45')]['id'];}return db[_0x9f50('0x27')][_0x9f50('0x42')]({'where':{'id':_0x46f2a8['params']['id']}})[_0x9f50('0x20')](handleEntityNotFound(_0x41afee,null))[_0x9f50('0x20')](saveUpdates(_0x46f2a8[_0x9f50('0x45')],null))['then'](respondWithResult(_0x41afee,null))['catch'](handleError(_0x41afee,null));};exports[_0x9f50('0x47')]=function(_0x481139,_0x5d8311,_0x5edbdd){var _0x3ff599=require(_0x9f50('0x48'));var _0x4a213d=![];var _0x44fdd1={};if(_0x481139[_0x9f50('0x2c')]['type']&&_0x481139[_0x9f50('0x2c')]['type']===_0x9f50('0x49')){_0x44fdd1['uniqueid']=_0x481139[_0x9f50('0x3f')]['id'];}else{_0x44fdd1['id']=_0x481139[_0x9f50('0x3f')]['id'];}return db[_0x9f50('0x27')][_0x9f50('0x42')]({'where':_0x44fdd1,'attributes':['id',_0x9f50('0x4a'),'filename'],'raw':!![]})['then'](handleEntityNotFound(_0x5d8311,null))[_0x9f50('0x20')](function(_0x9391d4){if(_0x9391d4){var _0x1e59e6=_0x9391d4[_0x9f50('0x4a')];var _0x50d9a9=util[_0x9f50('0x4b')](_0x9f50('0x4c'),_0x1e59e6);if(fs['existsSync'](_0x50d9a9)){_0x4a213d=!![];return _0x3ff599[_0x9f50('0x4d')](_0x50d9a9,_0x1e59e6,config['secrets'][_0x9f50('0x4e')])[_0x9f50('0x20')](function(){return _0x9391d4;});}return _0x9391d4;}})[_0x9f50('0x20')](function(_0x8025a6){if(_0x8025a6){var _0x3714d7=_0x8025a6[_0x9f50('0x4a')];if(!fs[_0x9f50('0x4f')](_0x3714d7)){throw new db[(_0x9f50('0x50'))][(_0x9f50('0x51'))](_0x9f50('0x52'));}if(_0x8025a6[_0x9f50('0x53')]){return _0x5d8311[_0x9f50('0x47')](_0x3714d7,_0x8025a6[_0x9f50('0x53')]+path[_0x9f50('0x54')](_0x3714d7),function(){if(_0x4a213d){fs[_0x9f50('0x55')](_0x3714d7);}});}else{return _0x5d8311[_0x9f50('0x47')](_0x3714d7,function(_0x1b0c71){if(_0x4a213d){fs['unlink'](_0x3714d7);}});}}})[_0x9f50('0x43')](function(_0x5cf454){if(_0x5cf454[_0x9f50('0x56')]==='SquareRecording\x20not\x20found'){_0x5d8311[_0x9f50('0x19')](0x194)[_0x9f50('0x24')](_0x9f50('0x57'));}else{return handleError(_0x5d8311,null);}});};exports[_0x9f50('0x58')]=function(_0x9fafdf,_0x112ab3){return db[_0x9f50('0x27')][_0x9f50('0x42')]({'where':{'id':_0x9fafdf[_0x9f50('0x3f')]['id']}})['then'](function(_0x4e9ec7){if(_[_0x9f50('0x59')](_0x4e9ec7)){throw new ReferenceError(_0x9f50('0x5a'));}return _0x4e9ec7;})['then'](function(_0x31e9d2){var _0x3ae270=_0x31e9d2[_0x9f50('0x4a')];logger[_0x9f50('0x5b')](_0x9f50('0x5c'),_0x3ae270);if(!_[_0x9f50('0x59')](_0x31e9d2[_0x9f50('0x4a')])&&fs[_0x9f50('0x4f')](_0x3ae270)){logger[_0x9f50('0x5b')](_0x9f50('0x5d')+_0x3ae270+_0x9f50('0x5e'));fs[_0x9f50('0x5f')](_0x3ae270);}_0x3ae270=_0x3ae270+'.cypher';if(!_[_0x9f50('0x59')](_0x31e9d2[_0x9f50('0x4a')])&&fs[_0x9f50('0x4f')](_0x3ae270)){logger['info'](_0x9f50('0x5d')+_0x3ae270+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0x9f50('0x5f')](_0x3ae270);}return _0x31e9d2;})['then'](function(_0x53f65e){if(!_0x53f65e)throw new InternalError();return _0x53f65e['destroy']();})[_0x9f50('0x20')](function(){_0x112ab3['status'](0xcc)['end']();})['catch'](handleError(_0x112ab3,null));}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.model.js b/server/api/squareRecording/squareRecording.model.js index f9656f5..1cffb7b 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 _0x2015=['api','moment','bluebird','request-promise','path','../../config/environment','./squareRecording.attributes','exports','define','SquareRecording','square_recordings','lodash','util','../../config/logger'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x2015,0x193));var _0x5201=function(_0x21b9d1,_0x3b55f7){_0x21b9d1=_0x21b9d1-0x0;var _0x26362e=_0x2015[_0x21b9d1];return _0x26362e;};'use strict';var _=require(_0x5201('0x0'));var util=require(_0x5201('0x1'));var logger=require(_0x5201('0x2'))(_0x5201('0x3'));var moment=require(_0x5201('0x4'));var BPromise=require(_0x5201('0x5'));var rp=require(_0x5201('0x6'));var fs=require('fs');var path=require(_0x5201('0x7'));var rimraf=require('rimraf');var config=require(_0x5201('0x8'));var attributes=require(_0x5201('0x9'));module[_0x5201('0xa')]=function(_0x10e33b,_0xf013a){return _0x10e33b[_0x5201('0xb')](_0x5201('0xc'),attributes,{'tableName':_0x5201('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe0c1=['square_recordings','lodash','util','../../config/logger','api','moment','bluebird','request-promise','define','SquareRecording'];(function(_0x3d78d7,_0x44acea){var _0x4b6784=function(_0x284157){while(--_0x284157){_0x3d78d7['push'](_0x3d78d7['shift']());}};_0x4b6784(++_0x44acea);}(_0xe0c1,0x10f));var _0x1e0c=function(_0x3b95cb,_0x59071d){_0x3b95cb=_0x3b95cb-0x0;var _0x353129=_0xe0c1[_0x3b95cb];return _0x353129;};'use strict';var _=require(_0x1e0c('0x0'));var util=require(_0x1e0c('0x1'));var logger=require(_0x1e0c('0x2'))(_0x1e0c('0x3'));var moment=require(_0x1e0c('0x4'));var BPromise=require(_0x1e0c('0x5'));var rp=require(_0x1e0c('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./squareRecording.attributes');module['exports']=function(_0x57c88f,_0x935e3b){return _0x57c88f[_0x1e0c('0x7')](_0x1e0c('0x8'),attributes,{'tableName':_0x1e0c('0x9'),'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 b0a1c3d..02ee894 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 _0xc98b=['request','then','info','SquareRecording,\x20%s,\x20%s','request\x20sent','SquareRecording,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','SquareRecording','create','options','CreateSquareRecording','debug','stringify','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','client','http'];(function(_0x4fa63d,_0x4d5bca){var _0x4bd8bb=function(_0x37a2c9){while(--_0x37a2c9){_0x4fa63d['push'](_0x4fa63d['shift']());}};_0x4bd8bb(++_0x4d5bca);}(_0xc98b,0x1a6));var _0xbc98=function(_0x3e530f,_0x7ab0e3){_0x3e530f=_0x3e530f-0x0;var _0x58385e=_0xc98b[_0x3e530f];return _0x58385e;};'use strict';var _=require('lodash');var util=require(_0xbc98('0x0'));var moment=require(_0xbc98('0x1'));var BPromise=require(_0xbc98('0x2'));var rs=require(_0xbc98('0x3'));var fs=require('fs');var Redis=require(_0xbc98('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xbc98('0x5'));var logger=require(_0xbc98('0x6'))(_0xbc98('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xbc98('0x8')][_0xbc98('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x20b32a,_0x396b47,_0x174340){return new BPromise(function(_0x1fd46c,_0x4c8d11){return client[_0xbc98('0xa')](_0x20b32a,_0x174340)[_0xbc98('0xb')](function(_0x1bcf24){logger[_0xbc98('0xc')](_0xbc98('0xd'),_0x396b47,_0xbc98('0xe'));logger['debug'](_0xbc98('0xf'),_0x396b47,'request\x20sent',JSON['stringify'](_0x1bcf24));if(_0x1bcf24['error']){if(_0x1bcf24[_0xbc98('0x10')][_0xbc98('0x11')]===0x1f4){logger[_0xbc98('0x10')](_0xbc98('0xd'),_0x396b47,_0x1bcf24[_0xbc98('0x10')]['message']);return _0x4c8d11(_0x1bcf24[_0xbc98('0x10')][_0xbc98('0x12')]);}logger[_0xbc98('0x10')](_0xbc98('0xd'),_0x396b47,_0x1bcf24['error'][_0xbc98('0x12')]);return _0x1fd46c(_0x1bcf24[_0xbc98('0x10')][_0xbc98('0x12')]);}else{logger[_0xbc98('0xc')]('SquareRecording,\x20%s,\x20%s',_0x396b47,_0xbc98('0xe'));_0x1fd46c(_0x1bcf24[_0xbc98('0x13')]['message']);}})[_0xbc98('0x14')](function(_0x445eba){logger[_0xbc98('0x10')](_0xbc98('0xd'),_0x396b47,_0x445eba);_0x4c8d11(_0x445eba);});});}exports['CreateSquareRecording']=function(_0x2dc3ae){var _0x195f5e=this;return new Promise(function(_0x357a75,_0x52c7bc){return db[_0xbc98('0x15')][_0xbc98('0x16')](_0x2dc3ae['body'],{'raw':_0x2dc3ae[_0xbc98('0x17')]?_0x2dc3ae[_0xbc98('0x17')]['raw']===undefined?!![]:![]:!![]})[_0xbc98('0xb')](function(_0x2216a3){logger['info'](_0xbc98('0x18'),_0x2dc3ae);logger[_0xbc98('0x19')](_0xbc98('0x18'),_0x2dc3ae,JSON[_0xbc98('0x1a')](_0x2216a3));_0x357a75(_0x2216a3);})[_0xbc98('0x14')](function(_0x26ed9b){logger[_0xbc98('0x10')](_0xbc98('0x18'),_0x26ed9b[_0xbc98('0x12')],_0x2dc3ae);_0x52c7bc(_0x195f5e['error'](0x1f4,_0x26ed9b['message']));});});}; \ No newline at end of file +var _0x1bb0=['info','SquareRecording,\x20%s,\x20%s','error','code','message','result','catch','CreateSquareRecording','SquareRecording','create','body','options','raw','debug','stringify','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','then'];(function(_0x75f869,_0x3690d6){var _0x10af8b=function(_0x22d3ff){while(--_0x22d3ff){_0x75f869['push'](_0x75f869['shift']());}};_0x10af8b(++_0x3690d6);}(_0x1bb0,0x153));var _0x01bb=function(_0x1df141,_0x313333){_0x1df141=_0x1df141-0x0;var _0x3a6df6=_0x1bb0[_0x1df141];return _0x3a6df6;};'use strict';var _=require(_0x01bb('0x0'));var util=require(_0x01bb('0x1'));var moment=require('moment');var BPromise=require(_0x01bb('0x2'));var rs=require(_0x01bb('0x3'));var fs=require('fs');var Redis=require(_0x01bb('0x4'));var db=require(_0x01bb('0x5'))['db'];var utils=require(_0x01bb('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x01bb('0x7'));var jayson=require(_0x01bb('0x8'));var client=jayson[_0x01bb('0x9')][_0x01bb('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x199701,_0x3749f7,_0x2ab329){return new BPromise(function(_0x5b1d92,_0x8bc1e0){return client['request'](_0x199701,_0x2ab329)[_0x01bb('0xb')](function(_0x1ab394){logger[_0x01bb('0xc')](_0x01bb('0xd'),_0x3749f7,'request\x20sent');logger['debug']('SquareRecording,\x20%s,\x20%s,\x20%s',_0x3749f7,'request\x20sent',JSON['stringify'](_0x1ab394));if(_0x1ab394[_0x01bb('0xe')]){if(_0x1ab394[_0x01bb('0xe')][_0x01bb('0xf')]===0x1f4){logger[_0x01bb('0xe')](_0x01bb('0xd'),_0x3749f7,_0x1ab394[_0x01bb('0xe')][_0x01bb('0x10')]);return _0x8bc1e0(_0x1ab394['error'][_0x01bb('0x10')]);}logger[_0x01bb('0xe')](_0x01bb('0xd'),_0x3749f7,_0x1ab394[_0x01bb('0xe')]['message']);return _0x5b1d92(_0x1ab394[_0x01bb('0xe')][_0x01bb('0x10')]);}else{logger[_0x01bb('0xc')]('SquareRecording,\x20%s,\x20%s',_0x3749f7,'request\x20sent');_0x5b1d92(_0x1ab394[_0x01bb('0x11')][_0x01bb('0x10')]);}})[_0x01bb('0x12')](function(_0x4e6b89){logger[_0x01bb('0xe')]('SquareRecording,\x20%s,\x20%s',_0x3749f7,_0x4e6b89);_0x8bc1e0(_0x4e6b89);});});}exports[_0x01bb('0x13')]=function(_0x5c4388){var _0x354633=this;return new Promise(function(_0x5e13ec,_0x2f9674){return db[_0x01bb('0x14')][_0x01bb('0x15')](_0x5c4388[_0x01bb('0x16')],{'raw':_0x5c4388[_0x01bb('0x17')]?_0x5c4388[_0x01bb('0x17')][_0x01bb('0x18')]===undefined?!![]:![]:!![]})[_0x01bb('0xb')](function(_0x4777a7){logger[_0x01bb('0xc')](_0x01bb('0x13'),_0x5c4388);logger[_0x01bb('0x19')](_0x01bb('0x13'),_0x5c4388,JSON[_0x01bb('0x1a')](_0x4777a7));_0x5e13ec(_0x4777a7);})['catch'](function(_0x5e4934){logger[_0x01bb('0xe')](_0x01bb('0x13'),_0x5e4934[_0x01bb('0x10')],_0x5c4388);_0x2f9674(_0x354633[_0x01bb('0xe')](0x1f4,_0x5e4934[_0x01bb('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/squareReport/index.js b/server/api/squareReport/index.js index 4fa7f0d..c4d23cd 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 _0xb10b=['../../components/interaction/service','../../config/environment','./squareReport.controller','get','index','isAuthenticated','describe','/:id','show','post','update','destroy','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service'];(function(_0x1c1169,_0x12dd0a){var _0x3f1b35=function(_0x360868){while(--_0x360868){_0x1c1169['push'](_0x1c1169['shift']());}};_0x3f1b35(++_0x12dd0a);}(_0xb10b,0x12a));var _0xbb10=function(_0x5b6fd3,_0x4af8d4){_0x5b6fd3=_0x5b6fd3-0x0;var _0x75ef1e=_0xb10b[_0x5b6fd3];return _0x75ef1e;};'use strict';var multer=require(_0xbb10('0x0'));var util=require('util');var path=require(_0xbb10('0x1'));var timeout=require(_0xbb10('0x2'));var express=require(_0xbb10('0x3'));var router=express['Router']();var fs_extra=require(_0xbb10('0x4'));var auth=require(_0xbb10('0x5'));var interaction=require(_0xbb10('0x6'));var config=require(_0xbb10('0x7'));var controller=require(_0xbb10('0x8'));router[_0xbb10('0x9')]('/',auth['isAuthenticated'](),controller[_0xbb10('0xa')]);router[_0xbb10('0x9')]('/describe',auth[_0xbb10('0xb')](),controller[_0xbb10('0xc')]);router[_0xbb10('0x9')](_0xbb10('0xd'),auth[_0xbb10('0xb')](),controller[_0xbb10('0xe')]);router[_0xbb10('0xf')]('/',auth[_0xbb10('0xb')](),controller['create']);router['put'](_0xbb10('0xd'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x10')]);router['delete'](_0xbb10('0xd'),auth['isAuthenticated'](),controller[_0xbb10('0x11')]);module[_0xbb10('0x12')]=router; \ No newline at end of file +var _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(_0x5dd45e,_0x3af0fd){var _0x492e26=function(_0x590c74){while(--_0x590c74){_0x5dd45e['push'](_0x5dd45e['shift']());}};_0x492e26(++_0x3af0fd);}(_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 diff --git a/server/api/squareReport/squareReport.attributes.js b/server/api/squareReport/squareReport.attributes.js index cc69fdd..a864535 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 _0x56b1=['exports','STRING','DATE'];(function(_0x4cedb1,_0x20505d){var _0x1199e5=function(_0xc13726){while(--_0xc13726){_0x4cedb1['push'](_0x4cedb1['shift']());}};_0x1199e5(++_0x20505d);}(_0x56b1,0x8a));var _0x156b=function(_0x1eb2ac,_0x54e08c){_0x1eb2ac=_0x1eb2ac-0x0;var _0x95fda0=_0x56b1[_0x1eb2ac];return _0x95fda0;};'use strict';var Sequelize=require('sequelize');module[_0x156b('0x0')]={'network':{'type':Sequelize[_0x156b('0x1')]},'network_script':{'type':Sequelize[_0x156b('0x1')]},'request':{'type':Sequelize[_0x156b('0x1')]},'channel':{'type':Sequelize['STRING']},'language':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x156b('0x1')]},'uniqueid':{'type':Sequelize[_0x156b('0x1')]},'version':{'type':Sequelize[_0x156b('0x1')]},'callerid':{'type':Sequelize[_0x156b('0x1')]},'calleridname':{'type':Sequelize[_0x156b('0x1')]},'callingpres':{'type':Sequelize[_0x156b('0x1')]},'callingani2':{'type':Sequelize[_0x156b('0x1')]},'callington':{'type':Sequelize[_0x156b('0x1')]},'callingtns':{'type':Sequelize[_0x156b('0x1')]},'dnid':{'type':Sequelize[_0x156b('0x1')]},'rdnis':{'type':Sequelize[_0x156b('0x1')]},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize[_0x156b('0x1')]},'priority':{'type':Sequelize[_0x156b('0x1')]},'enhanced':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x156b('0x1')]},'threadid':{'type':Sequelize[_0x156b('0x1')]},'project_name':{'type':Sequelize[_0x156b('0x1')]},'joinAt':{'type':Sequelize[_0x156b('0x2')]},'leaveAt':{'type':Sequelize['DATE']},'bot':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x393a=['STRING','DATE','BOOLEAN','sequelize'];(function(_0x199572,_0x33e667){var _0x13cfa3=function(_0x53c075){while(--_0x53c075){_0x199572['push'](_0x199572['shift']());}};_0x13cfa3(++_0x33e667);}(_0x393a,0x173));var _0xa393=function(_0x514c5e,_0x8c0875){_0x514c5e=_0x514c5e-0x0;var _0x34c3e6=_0x393a[_0x514c5e];return _0x34c3e6;};'use strict';var Sequelize=require(_0xa393('0x0'));module['exports']={'network':{'type':Sequelize[_0xa393('0x1')]},'network_script':{'type':Sequelize[_0xa393('0x1')]},'request':{'type':Sequelize[_0xa393('0x1')]},'channel':{'type':Sequelize[_0xa393('0x1')]},'language':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xa393('0x1')]},'uniqueid':{'type':Sequelize['STRING']},'version':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0xa393('0x1')]},'calleridname':{'type':Sequelize[_0xa393('0x1')]},'callingpres':{'type':Sequelize['STRING']},'callingani2':{'type':Sequelize[_0xa393('0x1')]},'callington':{'type':Sequelize[_0xa393('0x1')]},'callingtns':{'type':Sequelize[_0xa393('0x1')]},'dnid':{'type':Sequelize[_0xa393('0x1')]},'rdnis':{'type':Sequelize[_0xa393('0x1')]},'context':{'type':Sequelize[_0xa393('0x1')]},'extension':{'type':Sequelize[_0xa393('0x1')]},'priority':{'type':Sequelize[_0xa393('0x1')]},'enhanced':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize['STRING']},'threadid':{'type':Sequelize[_0xa393('0x1')]},'project_name':{'type':Sequelize[_0xa393('0x1')]},'joinAt':{'type':Sequelize[_0xa393('0x2')]},'leaveAt':{'type':Sequelize['DATE']},'bot':{'type':Sequelize[_0xa393('0x3')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.controller.js b/server/api/squareReport/squareReport.controller.js index cb47567..e9639f2 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 _0x22c7=['options','find','create','body','catch','destroy','describe','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','to-csv','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','error','stack','name','send','index','map','SquareReport','rawAttributes','type','model','query','keys','filters','intersection','attributes','fields','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','show','params'];(function(_0x2aec52,_0x59d962){var _0x3b8835=function(_0x3e2604){while(--_0x3e2604){_0x2aec52['push'](_0x2aec52['shift']());}};_0x3b8835(++_0x59d962);}(_0x22c7,0x1d5));var _0x722c=function(_0xf8216,_0x161f73){_0xf8216=_0xf8216-0x0;var _0x21a513=_0x22c7[_0xf8216];return _0x21a513;};'use strict';var emlformat=require(_0x722c('0x0'));var rimraf=require(_0x722c('0x1'));var zipdir=require(_0x722c('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x722c('0x3'));var moment=require(_0x722c('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x722c('0x5'));var util=require(_0x722c('0x6'));var path=require(_0x722c('0x7'));var sox=require('sox');var csv=require(_0x722c('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x722c('0x9'));var _=require(_0x722c('0xa'));var squel=require(_0x722c('0xb'));var crypto=require(_0x722c('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x722c('0xd'));var toCsv=require(_0x722c('0x8'));var querystring=require(_0x722c('0xe'));var Papa=require(_0x722c('0xf'));var Redis=require(_0x722c('0x10'));var authService=require(_0x722c('0x11'));var qs=require(_0x722c('0x12'));var as=require(_0x722c('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x722c('0x14'))(_0x722c('0x15'));var utils=require(_0x722c('0x16'));var config=require(_0x722c('0x17'));var licenseUtil=require(_0x722c('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x561991,_0xc85de9){_0xc85de9=_0xc85de9||0xcc;return function(_0xe95eb5){if(_0xe95eb5){return _0x561991[_0x722c('0x19')](_0xc85de9);}return _0x561991['status'](_0xc85de9)[_0x722c('0x1a')]();};}function respondWithResult(_0x41e562,_0x5cb550){_0x5cb550=_0x5cb550||0xc8;return function(_0x39b38a){if(_0x39b38a){return _0x41e562[_0x722c('0x1b')](_0x5cb550)[_0x722c('0x1c')](_0x39b38a);}};}function respondWithFilteredResult(_0x3b1c3d,_0x1e818b){return function(_0xd31743){if(_0xd31743){var _0x2b35d6=typeof _0x1e818b[_0x722c('0x1d')]===_0x722c('0x1e')&&typeof _0x1e818b[_0x722c('0x1f')]===_0x722c('0x1e');var _0x116be0=_0xd31743['count'];var _0x439b86=_0x2b35d6?0x0:_0x1e818b[_0x722c('0x1d')];var _0x14e7ee=_0x2b35d6?_0xd31743[_0x722c('0x20')]:_0x1e818b[_0x722c('0x1d')]+_0x1e818b['limit'];var _0x2403c7;if(_0x14e7ee>=_0x116be0){_0x14e7ee=_0x116be0;_0x2403c7=0xc8;}else{_0x2403c7=0xce;}_0x3b1c3d[_0x722c('0x1b')](_0x2403c7);return _0x3b1c3d[_0x722c('0x21')](_0x722c('0x22'),_0x439b86+'-'+_0x14e7ee+'/'+_0x116be0)[_0x722c('0x1c')](_0xd31743);}return null;};}function patchUpdates(_0x1a82ae){return function(_0x3233f4){try{jsonpatch[_0x722c('0x23')](_0x3233f4,_0x1a82ae,!![]);}catch(_0x6f649c){return BPromise[_0x722c('0x24')](_0x6f649c);}return _0x3233f4[_0x722c('0x25')]();};}function saveUpdates(_0x36c17d,_0x25783d){return function(_0x2df959){if(_0x2df959){return _0x2df959[_0x722c('0x26')](_0x36c17d)['then'](function(_0x181de7){return _0x181de7;});}return null;};}function removeEntity(_0x298868,_0x38809a){return function(_0x3bf22c){if(_0x3bf22c){return _0x3bf22c['destroy']()[_0x722c('0x27')](function(){_0x298868[_0x722c('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x19d584,_0x2f197f){return function(_0x2cc495){if(!_0x2cc495){_0x19d584['sendStatus'](0x194);}return _0x2cc495;};}function handleError(_0x3e9ff8,_0x5435ce){_0x5435ce=_0x5435ce||0x1f4;return function(_0x1c0475){logger[_0x722c('0x28')](_0x1c0475[_0x722c('0x29')]);if(_0x1c0475[_0x722c('0x2a')]){delete _0x1c0475['name'];}_0x3e9ff8['status'](_0x5435ce)[_0x722c('0x2b')](_0x1c0475);};}exports[_0x722c('0x2c')]=function(_0x3e29cd,_0x5bcf30){var _0x562411={},_0xec3ea5={},_0x5719b0={'count':0x0,'rows':[]};var _0xf0efff=_[_0x722c('0x2d')](db[_0x722c('0x2e')][_0x722c('0x2f')],function(_0x413d5a){return{'name':_0x413d5a['fieldName'],'type':_0x413d5a[_0x722c('0x30')]['key']};});_0xec3ea5[_0x722c('0x31')]=_[_0x722c('0x2d')](_0xf0efff,_0x722c('0x2a'));_0xec3ea5[_0x722c('0x32')]=_[_0x722c('0x33')](_0x3e29cd['query']);_0xec3ea5[_0x722c('0x34')]=_[_0x722c('0x35')](_0xec3ea5[_0x722c('0x31')],_0xec3ea5['query']);_0x562411[_0x722c('0x36')]=_[_0x722c('0x35')](_0xec3ea5['model'],qs[_0x722c('0x37')](_0x3e29cd[_0x722c('0x32')][_0x722c('0x37')]));_0x562411[_0x722c('0x36')]=_0x562411[_0x722c('0x36')]['length']?_0x562411[_0x722c('0x36')]:_0xec3ea5['model'];if(!_0x3e29cd[_0x722c('0x32')]['hasOwnProperty'](_0x722c('0x38'))){_0x562411[_0x722c('0x1f')]=qs[_0x722c('0x1f')](_0x3e29cd[_0x722c('0x32')][_0x722c('0x1f')]);_0x562411['offset']=qs[_0x722c('0x1d')](_0x3e29cd[_0x722c('0x32')][_0x722c('0x1d')]);}_0x562411[_0x722c('0x39')]=qs[_0x722c('0x3a')](_0x3e29cd[_0x722c('0x32')][_0x722c('0x3a')]);_0x562411[_0x722c('0x3b')]=qs[_0x722c('0x34')](_[_0x722c('0x3c')](_0x3e29cd[_0x722c('0x32')],_0xec3ea5[_0x722c('0x34')]),_0xf0efff);if(_0x3e29cd[_0x722c('0x32')][_0x722c('0x3d')]){_0x562411[_0x722c('0x3b')]=_[_0x722c('0x3e')](_0x562411[_0x722c('0x3b')],{'$or':_[_0x722c('0x2d')](_0xf0efff,function(_0x2d11d1){if(_0x2d11d1[_0x722c('0x30')]!==_0x722c('0x3f')){var _0x2f9e3d={};_0x2f9e3d[_0x2d11d1['name']]={'$like':'%'+_0x3e29cd['query'][_0x722c('0x3d')]+'%'};return _0x2f9e3d;}})});}_0x562411=_[_0x722c('0x3e')]({},_0x562411,_0x3e29cd['options']);var _0x4afc06={'where':_0x562411[_0x722c('0x3b')]};return db['SquareReport'][_0x722c('0x20')](_0x4afc06)['then'](function(_0x3c8839){_0x5719b0[_0x722c('0x20')]=_0x3c8839;if(_0x3e29cd[_0x722c('0x32')][_0x722c('0x40')]){_0x562411[_0x722c('0x41')]=[{'all':!![]}];}return db[_0x722c('0x2e')][_0x722c('0x42')](_0x562411);})['then'](function(_0x599dfd){_0x5719b0[_0x722c('0x43')]=_0x599dfd;return _0x5719b0;})[_0x722c('0x27')](respondWithFilteredResult(_0x5bcf30,_0x562411))['catch'](handleError(_0x5bcf30,null));};exports[_0x722c('0x44')]=function(_0x24ece4,_0x41b49d){var _0x21af48={'raw':!![],'where':{'id':_0x24ece4[_0x722c('0x45')]['id']}},_0x25191c={};_0x25191c[_0x722c('0x31')]=_[_0x722c('0x33')](db['SquareReport']['rawAttributes']);_0x25191c['query']=_['keys'](_0x24ece4[_0x722c('0x32')]);_0x25191c[_0x722c('0x34')]=_[_0x722c('0x35')](_0x25191c[_0x722c('0x31')],_0x25191c[_0x722c('0x32')]);_0x21af48[_0x722c('0x36')]=_[_0x722c('0x35')](_0x25191c[_0x722c('0x31')],qs[_0x722c('0x37')](_0x24ece4[_0x722c('0x32')][_0x722c('0x37')]));_0x21af48[_0x722c('0x36')]=_0x21af48['attributes']['length']?_0x21af48['attributes']:_0x25191c[_0x722c('0x31')];if(_0x24ece4[_0x722c('0x32')][_0x722c('0x40')]){_0x21af48[_0x722c('0x41')]=[{'all':!![]}];}_0x21af48=_[_0x722c('0x3e')]({},_0x21af48,_0x24ece4[_0x722c('0x46')]);return db[_0x722c('0x2e')][_0x722c('0x47')](_0x21af48)[_0x722c('0x27')](handleEntityNotFound(_0x41b49d,null))[_0x722c('0x27')](respondWithResult(_0x41b49d,null))['catch'](handleError(_0x41b49d,null));};exports[_0x722c('0x48')]=function(_0x46bd55,_0x3a2118){return db[_0x722c('0x2e')][_0x722c('0x48')](_0x46bd55[_0x722c('0x49')],{})[_0x722c('0x27')](respondWithResult(_0x3a2118,0xc9))[_0x722c('0x4a')](handleError(_0x3a2118,null));};exports['update']=function(_0x3ae75a,_0x328614){if(_0x3ae75a[_0x722c('0x49')]['id']){delete _0x3ae75a[_0x722c('0x49')]['id'];}return db[_0x722c('0x2e')][_0x722c('0x47')]({'where':{'id':_0x3ae75a[_0x722c('0x45')]['id']}})['then'](handleEntityNotFound(_0x328614,null))[_0x722c('0x27')](saveUpdates(_0x3ae75a[_0x722c('0x49')],null))[_0x722c('0x27')](respondWithResult(_0x328614,null))[_0x722c('0x4a')](handleError(_0x328614,null));};exports[_0x722c('0x4b')]=function(_0x5e7d12,_0x20c07a){return db[_0x722c('0x2e')][_0x722c('0x47')]({'where':{'id':_0x5e7d12['params']['id']}})[_0x722c('0x27')](handleEntityNotFound(_0x20c07a,null))[_0x722c('0x27')](removeEntity(_0x20c07a,null))[_0x722c('0x4a')](handleError(_0x20c07a,null));};exports[_0x722c('0x4c')]=function(_0x28e96a,_0x4c7c2f){return db[_0x722c('0x2e')][_0x722c('0x4c')]()[_0x722c('0x27')](respondWithResult(_0x4c7c2f,null))[_0x722c('0x4a')](handleError(_0x4c7c2f,null));}; \ No newline at end of file +var _0xab46=['send','index','fieldName','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','type','VIRTUAL','merge','options','SquareReport','includeAll','include','rows','catch','find','create','body','params','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','lodash','crypto','desk.js','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','count','limit','Content-Range','apply','reject','save','update','then','destroy','name'];(function(_0x23d013,_0xf3e124){var _0x746063=function(_0x133212){while(--_0x133212){_0x23d013['push'](_0x23d013['shift']());}};_0x746063(++_0xf3e124);}(_0xab46,0x68));var _0x6ab4=function(_0x1e6659,_0x1f860c){_0x1e6659=_0x1e6659-0x0;var _0x4d16e4=_0xab46[_0x1e6659];return _0x4d16e4;};'use strict';var emlformat=require(_0x6ab4('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x6ab4('0x1'));var jsonpatch=require(_0x6ab4('0x2'));var rp=require(_0x6ab4('0x3'));var moment=require(_0x6ab4('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x6ab4('0x5'));var util=require(_0x6ab4('0x6'));var path=require(_0x6ab4('0x7'));var sox=require('sox');var csv=require(_0x6ab4('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x6ab4('0x9'));var squel=require('squel');var crypto=require(_0x6ab4('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x6ab4('0xb'));var toCsv=require(_0x6ab4('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x6ab4('0xc'));var authService=require(_0x6ab4('0xd'));var qs=require(_0x6ab4('0xe'));var as=require(_0x6ab4('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x6ab4('0x10'))(_0x6ab4('0x11'));var utils=require(_0x6ab4('0x12'));var config=require(_0x6ab4('0x13'));var licenseUtil=require(_0x6ab4('0x14'));var db=require(_0x6ab4('0x15'))['db'];function respondWithStatusCode(_0x514b80,_0x3dd703){_0x3dd703=_0x3dd703||0xcc;return function(_0x4b39c9){if(_0x4b39c9){return _0x514b80[_0x6ab4('0x16')](_0x3dd703);}return _0x514b80[_0x6ab4('0x17')](_0x3dd703)[_0x6ab4('0x18')]();};}function respondWithResult(_0xb8d1df,_0x383ec9){_0x383ec9=_0x383ec9||0xc8;return function(_0x86b021){if(_0x86b021){return _0xb8d1df[_0x6ab4('0x17')](_0x383ec9)[_0x6ab4('0x19')](_0x86b021);}};}function respondWithFilteredResult(_0x39c580,_0x2bd5a){return function(_0x39ea61){if(_0x39ea61){var _0x1e61e7=typeof _0x2bd5a[_0x6ab4('0x1a')]===_0x6ab4('0x1b')&&typeof _0x2bd5a['limit']==='undefined';var _0xa619e2=_0x39ea61[_0x6ab4('0x1c')];var _0x199a81=_0x1e61e7?0x0:_0x2bd5a[_0x6ab4('0x1a')];var _0x33ce7f=_0x1e61e7?_0x39ea61['count']:_0x2bd5a[_0x6ab4('0x1a')]+_0x2bd5a[_0x6ab4('0x1d')];var _0x32ce1f;if(_0x33ce7f>=_0xa619e2){_0x33ce7f=_0xa619e2;_0x32ce1f=0xc8;}else{_0x32ce1f=0xce;}_0x39c580[_0x6ab4('0x17')](_0x32ce1f);return _0x39c580['set'](_0x6ab4('0x1e'),_0x199a81+'-'+_0x33ce7f+'/'+_0xa619e2)[_0x6ab4('0x19')](_0x39ea61);}return null;};}function patchUpdates(_0x36fafd){return function(_0x2fe576){try{jsonpatch[_0x6ab4('0x1f')](_0x2fe576,_0x36fafd,!![]);}catch(_0x12a801){return BPromise[_0x6ab4('0x20')](_0x12a801);}return _0x2fe576[_0x6ab4('0x21')]();};}function saveUpdates(_0x432933,_0x264372){return function(_0x4cf51b){if(_0x4cf51b){return _0x4cf51b[_0x6ab4('0x22')](_0x432933)[_0x6ab4('0x23')](function(_0x1f9f20){return _0x1f9f20;});}return null;};}function removeEntity(_0x123d82,_0x39ad5a){return function(_0x11b7e2){if(_0x11b7e2){return _0x11b7e2[_0x6ab4('0x24')]()['then'](function(){_0x123d82[_0x6ab4('0x17')](0xcc)[_0x6ab4('0x18')]();});}};}function handleEntityNotFound(_0xac5831,_0x4db288){return function(_0x30e9cd){if(!_0x30e9cd){_0xac5831[_0x6ab4('0x16')](0x194);}return _0x30e9cd;};}function handleError(_0x2de84b,_0x1a4b48){_0x1a4b48=_0x1a4b48||0x1f4;return function(_0x56ddb9){logger['error'](_0x56ddb9['stack']);if(_0x56ddb9[_0x6ab4('0x25')]){delete _0x56ddb9[_0x6ab4('0x25')];}_0x2de84b[_0x6ab4('0x17')](_0x1a4b48)[_0x6ab4('0x26')](_0x56ddb9);};}exports[_0x6ab4('0x27')]=function(_0x217434,_0x105307){var _0x301253={},_0x465b01={},_0x19aea3={'count':0x0,'rows':[]};var _0x5ea985=_['map'](db['SquareReport']['rawAttributes'],function(_0x2149e2){return{'name':_0x2149e2[_0x6ab4('0x28')],'type':_0x2149e2['type'][_0x6ab4('0x29')]};});_0x465b01[_0x6ab4('0x2a')]=_[_0x6ab4('0x2b')](_0x5ea985,_0x6ab4('0x25'));_0x465b01[_0x6ab4('0x2c')]=_[_0x6ab4('0x2d')](_0x217434[_0x6ab4('0x2c')]);_0x465b01[_0x6ab4('0x2e')]=_[_0x6ab4('0x2f')](_0x465b01[_0x6ab4('0x2a')],_0x465b01[_0x6ab4('0x2c')]);_0x301253[_0x6ab4('0x30')]=_['intersection'](_0x465b01[_0x6ab4('0x2a')],qs[_0x6ab4('0x31')](_0x217434[_0x6ab4('0x2c')][_0x6ab4('0x31')]));_0x301253[_0x6ab4('0x30')]=_0x301253[_0x6ab4('0x30')][_0x6ab4('0x32')]?_0x301253[_0x6ab4('0x30')]:_0x465b01['model'];if(!_0x217434[_0x6ab4('0x2c')][_0x6ab4('0x33')](_0x6ab4('0x34'))){_0x301253['limit']=qs[_0x6ab4('0x1d')](_0x217434[_0x6ab4('0x2c')][_0x6ab4('0x1d')]);_0x301253['offset']=qs['offset'](_0x217434[_0x6ab4('0x2c')][_0x6ab4('0x1a')]);}_0x301253[_0x6ab4('0x35')]=qs['sort'](_0x217434['query'][_0x6ab4('0x36')]);_0x301253[_0x6ab4('0x37')]=qs[_0x6ab4('0x2e')](_[_0x6ab4('0x38')](_0x217434[_0x6ab4('0x2c')],_0x465b01['filters']),_0x5ea985);if(_0x217434[_0x6ab4('0x2c')]['filter']){_0x301253['where']=_['merge'](_0x301253[_0x6ab4('0x37')],{'$or':_[_0x6ab4('0x2b')](_0x5ea985,function(_0x854080){if(_0x854080[_0x6ab4('0x39')]!==_0x6ab4('0x3a')){var _0x286413={};_0x286413[_0x854080[_0x6ab4('0x25')]]={'$like':'%'+_0x217434[_0x6ab4('0x2c')]['filter']+'%'};return _0x286413;}})});}_0x301253=_[_0x6ab4('0x3b')]({},_0x301253,_0x217434[_0x6ab4('0x3c')]);var _0x23d663={'where':_0x301253[_0x6ab4('0x37')]};return db[_0x6ab4('0x3d')][_0x6ab4('0x1c')](_0x23d663)[_0x6ab4('0x23')](function(_0x12b97a){_0x19aea3['count']=_0x12b97a;if(_0x217434[_0x6ab4('0x2c')][_0x6ab4('0x3e')]){_0x301253[_0x6ab4('0x3f')]=[{'all':!![]}];}return db[_0x6ab4('0x3d')]['findAll'](_0x301253);})[_0x6ab4('0x23')](function(_0x57c0a4){_0x19aea3[_0x6ab4('0x40')]=_0x57c0a4;return _0x19aea3;})[_0x6ab4('0x23')](respondWithFilteredResult(_0x105307,_0x301253))[_0x6ab4('0x41')](handleError(_0x105307,null));};exports['show']=function(_0x4b2b8f,_0x19b227){var _0x517b10={'raw':!![],'where':{'id':_0x4b2b8f['params']['id']}},_0x139a85={};_0x139a85[_0x6ab4('0x2a')]=_[_0x6ab4('0x2d')](db['SquareReport']['rawAttributes']);_0x139a85[_0x6ab4('0x2c')]=_['keys'](_0x4b2b8f[_0x6ab4('0x2c')]);_0x139a85[_0x6ab4('0x2e')]=_[_0x6ab4('0x2f')](_0x139a85[_0x6ab4('0x2a')],_0x139a85[_0x6ab4('0x2c')]);_0x517b10['attributes']=_['intersection'](_0x139a85[_0x6ab4('0x2a')],qs[_0x6ab4('0x31')](_0x4b2b8f[_0x6ab4('0x2c')][_0x6ab4('0x31')]));_0x517b10['attributes']=_0x517b10[_0x6ab4('0x30')][_0x6ab4('0x32')]?_0x517b10[_0x6ab4('0x30')]:_0x139a85['model'];if(_0x4b2b8f[_0x6ab4('0x2c')][_0x6ab4('0x3e')]){_0x517b10[_0x6ab4('0x3f')]=[{'all':!![]}];}_0x517b10=_[_0x6ab4('0x3b')]({},_0x517b10,_0x4b2b8f[_0x6ab4('0x3c')]);return db['SquareReport'][_0x6ab4('0x42')](_0x517b10)['then'](handleEntityNotFound(_0x19b227,null))[_0x6ab4('0x23')](respondWithResult(_0x19b227,null))[_0x6ab4('0x41')](handleError(_0x19b227,null));};exports[_0x6ab4('0x43')]=function(_0x34ce2f,_0x2f752c){return db[_0x6ab4('0x3d')]['create'](_0x34ce2f[_0x6ab4('0x44')],{})[_0x6ab4('0x23')](respondWithResult(_0x2f752c,0xc9))[_0x6ab4('0x41')](handleError(_0x2f752c,null));};exports[_0x6ab4('0x22')]=function(_0x11bcac,_0x53ee83){if(_0x11bcac['body']['id']){delete _0x11bcac[_0x6ab4('0x44')]['id'];}return db[_0x6ab4('0x3d')][_0x6ab4('0x42')]({'where':{'id':_0x11bcac[_0x6ab4('0x45')]['id']}})['then'](handleEntityNotFound(_0x53ee83,null))[_0x6ab4('0x23')](saveUpdates(_0x11bcac[_0x6ab4('0x44')],null))[_0x6ab4('0x23')](respondWithResult(_0x53ee83,null))[_0x6ab4('0x41')](handleError(_0x53ee83,null));};exports[_0x6ab4('0x24')]=function(_0x1ca628,_0x41b57e){return db[_0x6ab4('0x3d')]['find']({'where':{'id':_0x1ca628[_0x6ab4('0x45')]['id']}})['then'](handleEntityNotFound(_0x41b57e,null))['then'](removeEntity(_0x41b57e,null))[_0x6ab4('0x41')](handleError(_0x41b57e,null));};exports[_0x6ab4('0x46')]=function(_0x3522f6,_0x588653){return db[_0x6ab4('0x3d')]['describe']()['then'](respondWithResult(_0x588653,null))[_0x6ab4('0x41')](handleError(_0x588653,null));}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.model.js b/server/api/squareReport/squareReport.model.js index f406f2e..c7908f2 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 _0x6634=['rimraf','../../config/environment','exports','define','report_square','uid_pname','uniqueid','project_name','leaveAt','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x465028,_0x4570ac){var _0xb783d4=function(_0x5458c5){while(--_0x5458c5){_0x465028['push'](_0x465028['shift']());}};_0xb783d4(++_0x4570ac);}(_0x6634,0xc9));var _0x4663=function(_0x17b3a0,_0x24e743){_0x17b3a0=_0x17b3a0-0x0;var _0x3bb234=_0x6634[_0x17b3a0];return _0x3bb234;};'use strict';var _=require(_0x4663('0x0'));var util=require(_0x4663('0x1'));var logger=require(_0x4663('0x2'))(_0x4663('0x3'));var moment=require(_0x4663('0x4'));var BPromise=require(_0x4663('0x5'));var rp=require(_0x4663('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4663('0x7'));var config=require(_0x4663('0x8'));var attributes=require('./squareReport.attributes');module[_0x4663('0x9')]=function(_0x50441f,_0x16914a){return _0x50441f[_0x4663('0xa')]('SquareReport',attributes,{'tableName':_0x4663('0xb'),'paranoid':![],'indexes':[{'name':_0x4663('0xc'),'fields':[_0x4663('0xd'),_0x4663('0xe')]},{'name':_0x4663('0xf'),'fields':['leaveAt']}],'timestamps':!![]});}; \ No newline at end of file +var _0xc417=['exports','define','report_square','uid_pname','uniqueid','project_name','leaveAt','lodash','util','../../config/logger','request-promise','rimraf','../../config/environment','./squareReport.attributes'];(function(_0x157535,_0x5b0a66){var _0x4ff41b=function(_0x253562){while(--_0x253562){_0x157535['push'](_0x157535['shift']());}};_0x4ff41b(++_0x5b0a66);}(_0xc417,0x1ab));var _0x7c41=function(_0x45be3f,_0xf6330a){_0x45be3f=_0x45be3f-0x0;var _0x2118fa=_0xc417[_0x45be3f];return _0x2118fa;};'use strict';var _=require(_0x7c41('0x0'));var util=require(_0x7c41('0x1'));var logger=require(_0x7c41('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x7c41('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7c41('0x4'));var config=require(_0x7c41('0x5'));var attributes=require(_0x7c41('0x6'));module[_0x7c41('0x7')]=function(_0x3b84ba,_0x83634){return _0x3b84ba[_0x7c41('0x8')]('SquareReport',attributes,{'tableName':_0x7c41('0x9'),'paranoid':![],'indexes':[{'name':_0x7c41('0xa'),'fields':[_0x7c41('0xb'),_0x7c41('0xc')]},{'name':_0x7c41('0xd'),'fields':[_0x7c41('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.rpc.js b/server/api/squareReport/squareReport.rpc.js index 6466f60..19b05ae 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 _0xcc20=['CreateSquareReport','SquareReport','create','options','raw','then','catch','update','where','limit','UpdateSquareReport','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','http','request','SquareReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0xcc20,0xeb));var _0x0cc2=function(_0x17f697,_0x3feea9){_0x17f697=_0x17f697-0x0;var _0x85fa16=_0xcc20[_0x17f697];return _0x85fa16;};'use strict';var _=require(_0x0cc2('0x0'));var util=require(_0x0cc2('0x1'));var moment=require(_0x0cc2('0x2'));var BPromise=require(_0x0cc2('0x3'));var rs=require(_0x0cc2('0x4'));var fs=require('fs');var Redis=require(_0x0cc2('0x5'));var db=require(_0x0cc2('0x6'))['db'];var utils=require(_0x0cc2('0x7'));var logger=require(_0x0cc2('0x8'))(_0x0cc2('0x9'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x0cc2('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x43b122,_0x156aaf,_0x8e753){return new BPromise(function(_0x4889d9,_0x4bca97){return client[_0x0cc2('0xb')](_0x43b122,_0x8e753)['then'](function(_0x503a97){logger['info'](_0x0cc2('0xc'),_0x156aaf,_0x0cc2('0xd'));logger[_0x0cc2('0xe')]('SquareReport,\x20%s,\x20%s,\x20%s',_0x156aaf,_0x0cc2('0xd'),JSON[_0x0cc2('0xf')](_0x503a97));if(_0x503a97[_0x0cc2('0x10')]){if(_0x503a97['error'][_0x0cc2('0x11')]===0x1f4){logger[_0x0cc2('0x10')](_0x0cc2('0xc'),_0x156aaf,_0x503a97[_0x0cc2('0x10')][_0x0cc2('0x12')]);return _0x4bca97(_0x503a97[_0x0cc2('0x10')]['message']);}logger[_0x0cc2('0x10')](_0x0cc2('0xc'),_0x156aaf,_0x503a97['error']['message']);return _0x4889d9(_0x503a97[_0x0cc2('0x10')][_0x0cc2('0x12')]);}else{logger[_0x0cc2('0x13')]('SquareReport,\x20%s,\x20%s',_0x156aaf,_0x0cc2('0xd'));_0x4889d9(_0x503a97[_0x0cc2('0x14')]['message']);}})['catch'](function(_0x20ba04){logger['error'](_0x0cc2('0xc'),_0x156aaf,_0x20ba04);_0x4bca97(_0x20ba04);});});}exports[_0x0cc2('0x15')]=function(_0x5ea1b1){var _0x2463a3=this;return new Promise(function(_0x4f5e52,_0x147a69){return db[_0x0cc2('0x16')][_0x0cc2('0x17')](_0x5ea1b1['body'],{'raw':_0x5ea1b1[_0x0cc2('0x18')]?_0x5ea1b1['options'][_0x0cc2('0x19')]===undefined?!![]:![]:!![]})[_0x0cc2('0x1a')](function(_0x104c1e){logger['info'](_0x0cc2('0x15'),_0x5ea1b1);logger['debug'](_0x0cc2('0x15'),_0x5ea1b1,JSON[_0x0cc2('0xf')](_0x104c1e));_0x4f5e52(_0x104c1e);})[_0x0cc2('0x1b')](function(_0x534ddb){logger[_0x0cc2('0x10')](_0x0cc2('0x15'),_0x534ddb['message'],_0x5ea1b1);_0x147a69(_0x2463a3['error'](0x1f4,_0x534ddb[_0x0cc2('0x12')]));});});};exports['UpdateSquareReport']=function(_0x4b8614){var _0x53ce2e=this;return new Promise(function(_0xc3c1ff,_0x1bbb56){return db[_0x0cc2('0x16')][_0x0cc2('0x1c')](_0x4b8614['body'],{'raw':_0x4b8614[_0x0cc2('0x18')]?_0x4b8614[_0x0cc2('0x18')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4b8614['options']?_0x4b8614[_0x0cc2('0x18')][_0x0cc2('0x1d')]||null:null,'attributes':_0x4b8614[_0x0cc2('0x18')]?_0x4b8614[_0x0cc2('0x18')]['attributes']||null:null,'limit':_0x4b8614[_0x0cc2('0x18')]?_0x4b8614['options'][_0x0cc2('0x1e')]||null:null})[_0x0cc2('0x1a')](function(_0x47ee29){logger['info']('UpdateSquareReport',_0x4b8614);logger[_0x0cc2('0xe')](_0x0cc2('0x1f'),_0x4b8614,JSON[_0x0cc2('0xf')](_0x47ee29));_0xc3c1ff(_0x47ee29);})[_0x0cc2('0x1b')](function(_0x405bab){logger[_0x0cc2('0x10')](_0x0cc2('0x1f'),_0x405bab[_0x0cc2('0x12')],_0x4b8614);_0x1bbb56(_0x53ce2e[_0x0cc2('0x10')](0x1f4,_0x405bab['message']));});});}; \ No newline at end of file +var _0x04ed=['where','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','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','SquareReport','create','body','options','raw','stringify','UpdateSquareReport','update'];(function(_0x36f437,_0xfdddc2){var _0x6b7944=function(_0x233dbc){while(--_0x233dbc){_0x36f437['push'](_0x36f437['shift']());}};_0x6b7944(++_0xfdddc2);}(_0x04ed,0x1e3));var _0xd04e=function(_0x47e70a,_0x1c3714){_0x47e70a=_0x47e70a-0x0;var _0x3a9900=_0x04ed[_0x47e70a];return _0x3a9900;};'use strict';var _=require(_0xd04e('0x0'));var util=require(_0xd04e('0x1'));var moment=require(_0xd04e('0x2'));var BPromise=require(_0xd04e('0x3'));var rs=require(_0xd04e('0x4'));var fs=require('fs');var Redis=require(_0xd04e('0x5'));var db=require(_0xd04e('0x6'))['db'];var utils=require(_0xd04e('0x7'));var logger=require(_0xd04e('0x8'))(_0xd04e('0x9'));var config=require(_0xd04e('0xa'));var jayson=require(_0xd04e('0xb'));var client=jayson[_0xd04e('0xc')][_0xd04e('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x38b1f1,_0x5e9cb6,_0x3734f1){return new BPromise(function(_0x1c0854,_0x37fe2a){return client[_0xd04e('0xe')](_0x38b1f1,_0x3734f1)[_0xd04e('0xf')](function(_0x1552af){logger[_0xd04e('0x10')](_0xd04e('0x11'),_0x5e9cb6,_0xd04e('0x12'));logger[_0xd04e('0x13')](_0xd04e('0x14'),_0x5e9cb6,_0xd04e('0x12'),JSON['stringify'](_0x1552af));if(_0x1552af[_0xd04e('0x15')]){if(_0x1552af[_0xd04e('0x15')][_0xd04e('0x16')]===0x1f4){logger[_0xd04e('0x15')](_0xd04e('0x11'),_0x5e9cb6,_0x1552af[_0xd04e('0x15')][_0xd04e('0x17')]);return _0x37fe2a(_0x1552af[_0xd04e('0x15')][_0xd04e('0x17')]);}logger['error'](_0xd04e('0x11'),_0x5e9cb6,_0x1552af[_0xd04e('0x15')][_0xd04e('0x17')]);return _0x1c0854(_0x1552af[_0xd04e('0x15')]['message']);}else{logger['info'](_0xd04e('0x11'),_0x5e9cb6,_0xd04e('0x12'));_0x1c0854(_0x1552af[_0xd04e('0x18')][_0xd04e('0x17')]);}})[_0xd04e('0x19')](function(_0x45a4e3){logger[_0xd04e('0x15')](_0xd04e('0x11'),_0x5e9cb6,_0x45a4e3);_0x37fe2a(_0x45a4e3);});});}exports[_0xd04e('0x1a')]=function(_0x7a0264){var _0x48e287=this;return new Promise(function(_0x230c95,_0x449604){return db[_0xd04e('0x1b')][_0xd04e('0x1c')](_0x7a0264[_0xd04e('0x1d')],{'raw':_0x7a0264[_0xd04e('0x1e')]?_0x7a0264[_0xd04e('0x1e')][_0xd04e('0x1f')]===undefined?!![]:![]:!![]})[_0xd04e('0xf')](function(_0x1dc0ed){logger[_0xd04e('0x10')](_0xd04e('0x1a'),_0x7a0264);logger[_0xd04e('0x13')](_0xd04e('0x1a'),_0x7a0264,JSON[_0xd04e('0x20')](_0x1dc0ed));_0x230c95(_0x1dc0ed);})[_0xd04e('0x19')](function(_0x3e0db9){logger[_0xd04e('0x15')](_0xd04e('0x1a'),_0x3e0db9[_0xd04e('0x17')],_0x7a0264);_0x449604(_0x48e287[_0xd04e('0x15')](0x1f4,_0x3e0db9['message']));});});};exports[_0xd04e('0x21')]=function(_0x5e58d7){var _0x27f8da=this;return new Promise(function(_0x4e6588,_0x35b7d7){return db[_0xd04e('0x1b')][_0xd04e('0x22')](_0x5e58d7[_0xd04e('0x1d')],{'raw':_0x5e58d7[_0xd04e('0x1e')]?_0x5e58d7[_0xd04e('0x1e')][_0xd04e('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5e58d7[_0xd04e('0x1e')]?_0x5e58d7['options'][_0xd04e('0x23')]||null:null,'attributes':_0x5e58d7[_0xd04e('0x1e')]?_0x5e58d7[_0xd04e('0x1e')]['attributes']||null:null,'limit':_0x5e58d7[_0xd04e('0x1e')]?_0x5e58d7[_0xd04e('0x1e')][_0xd04e('0x24')]||null:null})[_0xd04e('0xf')](function(_0x25da2d){logger[_0xd04e('0x10')]('UpdateSquareReport',_0x5e58d7);logger[_0xd04e('0x13')]('UpdateSquareReport',_0x5e58d7,JSON['stringify'](_0x25da2d));_0x4e6588(_0x25da2d);})[_0xd04e('0x19')](function(_0x2594a5){logger[_0xd04e('0x15')](_0xd04e('0x21'),_0x2594a5[_0xd04e('0x17')],_0x5e58d7);_0x35b7d7(_0x27f8da['error'](0x1f4,_0x2594a5[_0xd04e('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/squareReportDetail/index.js b/server/api/squareReportDetail/index.js index cc106d4..1475832 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 _0xec06=['update','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareReportDetail.controller','get','isAuthenticated','describe','/:id','show','post','create','put'];(function(_0x33ac75,_0x4953e3){var _0x34d5f2=function(_0x4c2b4a){while(--_0x4c2b4a){_0x33ac75['push'](_0x33ac75['shift']());}};_0x34d5f2(++_0x4953e3);}(_0xec06,0x191));var _0x6ec0=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xec06[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require(_0x6ec0('0x0'));var util=require(_0x6ec0('0x1'));var path=require(_0x6ec0('0x2'));var timeout=require(_0x6ec0('0x3'));var express=require(_0x6ec0('0x4'));var router=express[_0x6ec0('0x5')]();var fs_extra=require(_0x6ec0('0x6'));var auth=require(_0x6ec0('0x7'));var interaction=require(_0x6ec0('0x8'));var config=require(_0x6ec0('0x9'));var controller=require(_0x6ec0('0xa'));router[_0x6ec0('0xb')]('/',auth['isAuthenticated'](),controller['index']);router[_0x6ec0('0xb')]('/describe',auth[_0x6ec0('0xc')](),controller[_0x6ec0('0xd')]);router[_0x6ec0('0xb')](_0x6ec0('0xe'),auth[_0x6ec0('0xc')](),controller[_0x6ec0('0xf')]);router[_0x6ec0('0x10')]('/',auth[_0x6ec0('0xc')](),controller[_0x6ec0('0x11')]);router[_0x6ec0('0x12')](_0x6ec0('0xe'),auth[_0x6ec0('0xc')](),controller[_0x6ec0('0x13')]);router['delete']('/:id',auth[_0x6ec0('0xc')](),controller[_0x6ec0('0x14')]);module['exports']=router; \ No newline at end of file +var _0x02c1=['post','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./squareReportDetail.controller','isAuthenticated','index','get','/describe','describe','show'];(function(_0x41ec3b,_0x2593cd){var _0x51d99f=function(_0x48b3a7){while(--_0x48b3a7){_0x41ec3b['push'](_0x41ec3b['shift']());}};_0x51d99f(++_0x2593cd);}(_0x02c1,0xd8));var _0x102c=function(_0x28bb85,_0x23c20b){_0x28bb85=_0x28bb85-0x0;var _0x48a4eb=_0x02c1[_0x28bb85];return _0x48a4eb;};'use strict';var multer=require(_0x102c('0x0'));var util=require(_0x102c('0x1'));var path=require(_0x102c('0x2'));var timeout=require(_0x102c('0x3'));var express=require('express');var router=express[_0x102c('0x4')]();var fs_extra=require(_0x102c('0x5'));var auth=require(_0x102c('0x6'));var interaction=require(_0x102c('0x7'));var config=require('../../config/environment');var controller=require(_0x102c('0x8'));router['get']('/',auth[_0x102c('0x9')](),controller[_0x102c('0xa')]);router[_0x102c('0xb')](_0x102c('0xc'),auth[_0x102c('0x9')](),controller[_0x102c('0xd')]);router[_0x102c('0xb')]('/:id',auth[_0x102c('0x9')](),controller[_0x102c('0xe')]);router[_0x102c('0xf')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x102c('0x10'),auth[_0x102c('0x9')](),controller[_0x102c('0x11')]);router[_0x102c('0x12')](_0x102c('0x10'),auth[_0x102c('0x9')](),controller[_0x102c('0x13')]);module[_0x102c('0x14')]=router; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.attributes.js b/server/api/squareReportDetail/squareReportDetail.attributes.js index 96ae054..e6c99b2 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 _0xc548=['exports','STRING','TEXT','sequelize'];(function(_0x1765c7,_0x22ceef){var _0x4c3e15=function(_0x1fb824){while(--_0x1fb824){_0x1765c7['push'](_0x1765c7['shift']());}};_0x4c3e15(++_0x22ceef);}(_0xc548,0x97));var _0x8c54=function(_0x399378,_0x4fad17){_0x399378=_0x399378-0x0;var _0x4a6561=_0xc548[_0x399378];return _0x4a6561;};'use strict';var Sequelize=require(_0x8c54('0x0'));module[_0x8c54('0x1')]={'uniqueid':{'type':Sequelize[_0x8c54('0x2')]},'node':{'type':Sequelize[_0x8c54('0x2')]},'application':{'type':Sequelize[_0x8c54('0x2')]},'data':{'type':Sequelize[_0x8c54('0x3')]},'project_name':{'type':Sequelize[_0x8c54('0x2')]},'callerid':{'type':Sequelize[_0x8c54('0x2')]}}; \ No newline at end of file +var _0xe240=['STRING','sequelize','exports'];(function(_0x3015f9,_0x6eeb0d){var _0x3390b6=function(_0x4cff57){while(--_0x4cff57){_0x3015f9['push'](_0x3015f9['shift']());}};_0x3390b6(++_0x6eeb0d);}(_0xe240,0x16f));var _0x0e24=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0xe240[_0x42cae2];return _0x5f256f;};'use strict';var Sequelize=require(_0x0e24('0x0'));module[_0x0e24('0x1')]={'uniqueid':{'type':Sequelize['STRING']},'node':{'type':Sequelize[_0x0e24('0x2')]},'application':{'type':Sequelize['STRING']},'data':{'type':Sequelize['TEXT']},'project_name':{'type':Sequelize[_0x0e24('0x2')]},'callerid':{'type':Sequelize[_0x0e24('0x2')]}}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.controller.js b/server/api/squareReportDetail/squareReportDetail.controller.js index 39d747a..480cffd 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 _0x21fe=['destroy','error','name','send','index','map','SquareDetailsReport','rawAttributes','type','key','keys','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','merge','filter','include','findAll','rows','show','params','includeAll','options','find','catch','create','body','describe','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','ejs','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then'];(function(_0x55d358,_0x1f1a17){var _0xe191ff=function(_0x2bfeed){while(--_0x2bfeed){_0x55d358['push'](_0x55d358['shift']());}};_0xe191ff(++_0x1f1a17);}(_0x21fe,0x109));var _0xe21f=function(_0x9dadea,_0x2f4878){_0x9dadea=_0x9dadea-0x0;var _0x2700e9=_0x21fe[_0x9dadea];return _0x2700e9;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe21f('0x0'));var zipdir=require(_0xe21f('0x1'));var jsonpatch=require(_0xe21f('0x2'));var rp=require(_0xe21f('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xe21f('0x4'));var util=require(_0xe21f('0x5'));var path=require(_0xe21f('0x6'));var sox=require(_0xe21f('0x7'));var csv=require('to-csv');var ejs=require(_0xe21f('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xe21f('0x9'));var squel=require(_0xe21f('0xa'));var crypto=require('crypto');var jsforce=require(_0xe21f('0xb'));var deskjs=require(_0xe21f('0xc'));var toCsv=require(_0xe21f('0xd'));var querystring=require(_0xe21f('0xe'));var Papa=require(_0xe21f('0xf'));var Redis=require(_0xe21f('0x10'));var authService=require(_0xe21f('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xe21f('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xe21f('0x13'))(_0xe21f('0x14'));var utils=require(_0xe21f('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xe21f('0x16'));var db=require(_0xe21f('0x17'))['db'];function respondWithStatusCode(_0x20dc7b,_0x3ba0eb){_0x3ba0eb=_0x3ba0eb||0xcc;return function(_0x532425){if(_0x532425){return _0x20dc7b[_0xe21f('0x18')](_0x3ba0eb);}return _0x20dc7b[_0xe21f('0x19')](_0x3ba0eb)[_0xe21f('0x1a')]();};}function respondWithResult(_0x93a63d,_0x29ef09){_0x29ef09=_0x29ef09||0xc8;return function(_0x591085){if(_0x591085){return _0x93a63d[_0xe21f('0x19')](_0x29ef09)[_0xe21f('0x1b')](_0x591085);}};}function respondWithFilteredResult(_0x3fc896,_0x3ba183){return function(_0x29b0c2){if(_0x29b0c2){var _0x26fe37=typeof _0x3ba183['offset']===_0xe21f('0x1c')&&typeof _0x3ba183[_0xe21f('0x1d')]===_0xe21f('0x1c');var _0xf0ad55=_0x29b0c2[_0xe21f('0x1e')];var _0x3e0576=_0x26fe37?0x0:_0x3ba183[_0xe21f('0x1f')];var _0x122a24=_0x26fe37?_0x29b0c2[_0xe21f('0x1e')]:_0x3ba183['offset']+_0x3ba183[_0xe21f('0x1d')];var _0x2b3679;if(_0x122a24>=_0xf0ad55){_0x122a24=_0xf0ad55;_0x2b3679=0xc8;}else{_0x2b3679=0xce;}_0x3fc896[_0xe21f('0x19')](_0x2b3679);return _0x3fc896[_0xe21f('0x20')](_0xe21f('0x21'),_0x3e0576+'-'+_0x122a24+'/'+_0xf0ad55)['json'](_0x29b0c2);}return null;};}function patchUpdates(_0x24747b){return function(_0x4efa18){try{jsonpatch[_0xe21f('0x22')](_0x4efa18,_0x24747b,!![]);}catch(_0x523d83){return BPromise[_0xe21f('0x23')](_0x523d83);}return _0x4efa18[_0xe21f('0x24')]();};}function saveUpdates(_0x1b877c,_0x391ef7){return function(_0x4f1bfe){if(_0x4f1bfe){return _0x4f1bfe[_0xe21f('0x25')](_0x1b877c)[_0xe21f('0x26')](function(_0x31e32a){return _0x31e32a;});}return null;};}function removeEntity(_0x4c7645,_0x16e2d4){return function(_0x17814d){if(_0x17814d){return _0x17814d[_0xe21f('0x27')]()[_0xe21f('0x26')](function(){_0x4c7645[_0xe21f('0x19')](0xcc)[_0xe21f('0x1a')]();});}};}function handleEntityNotFound(_0x592978,_0x253d7b){return function(_0x2aa251){if(!_0x2aa251){_0x592978[_0xe21f('0x18')](0x194);}return _0x2aa251;};}function handleError(_0x4a0618,_0x2d96b1){_0x2d96b1=_0x2d96b1||0x1f4;return function(_0x4a5dd1){logger[_0xe21f('0x28')](_0x4a5dd1['stack']);if(_0x4a5dd1[_0xe21f('0x29')]){delete _0x4a5dd1['name'];}_0x4a0618[_0xe21f('0x19')](_0x2d96b1)[_0xe21f('0x2a')](_0x4a5dd1);};}exports[_0xe21f('0x2b')]=function(_0x3caf40,_0x3a1b5a){var _0x45c078={},_0x670799={},_0x53e731={'count':0x0,'rows':[]};var _0x5f4f31=_[_0xe21f('0x2c')](db[_0xe21f('0x2d')][_0xe21f('0x2e')],function(_0x25a946){return{'name':_0x25a946['fieldName'],'type':_0x25a946[_0xe21f('0x2f')][_0xe21f('0x30')]};});_0x670799['model']=_['map'](_0x5f4f31,_0xe21f('0x29'));_0x670799['query']=_[_0xe21f('0x31')](_0x3caf40[_0xe21f('0x32')]);_0x670799[_0xe21f('0x33')]=_[_0xe21f('0x34')](_0x670799['model'],_0x670799[_0xe21f('0x32')]);_0x45c078['attributes']=_[_0xe21f('0x34')](_0x670799[_0xe21f('0x35')],qs[_0xe21f('0x36')](_0x3caf40[_0xe21f('0x32')][_0xe21f('0x36')]));_0x45c078[_0xe21f('0x37')]=_0x45c078[_0xe21f('0x37')][_0xe21f('0x38')]?_0x45c078[_0xe21f('0x37')]:_0x670799[_0xe21f('0x35')];if(!_0x3caf40[_0xe21f('0x32')][_0xe21f('0x39')](_0xe21f('0x3a'))){_0x45c078[_0xe21f('0x1d')]=qs[_0xe21f('0x1d')](_0x3caf40[_0xe21f('0x32')]['limit']);_0x45c078[_0xe21f('0x1f')]=qs[_0xe21f('0x1f')](_0x3caf40[_0xe21f('0x32')][_0xe21f('0x1f')]);}_0x45c078[_0xe21f('0x3b')]=qs[_0xe21f('0x3c')](_0x3caf40['query'][_0xe21f('0x3c')]);_0x45c078[_0xe21f('0x3d')]=qs['filters'](_['pick'](_0x3caf40[_0xe21f('0x32')],_0x670799['filters']),_0x5f4f31);if(_0x3caf40[_0xe21f('0x32')]['filter']){_0x45c078['where']=_[_0xe21f('0x3e')](_0x45c078[_0xe21f('0x3d')],{'$or':_[_0xe21f('0x2c')](_0x5f4f31,function(_0x2b1ef1){if(_0x2b1ef1[_0xe21f('0x2f')]!=='VIRTUAL'){var _0x331c68={};_0x331c68[_0x2b1ef1[_0xe21f('0x29')]]={'$like':'%'+_0x3caf40[_0xe21f('0x32')][_0xe21f('0x3f')]+'%'};return _0x331c68;}})});}_0x45c078=_[_0xe21f('0x3e')]({},_0x45c078,_0x3caf40['options']);var _0x5e6367={'where':_0x45c078[_0xe21f('0x3d')]};return db['SquareDetailsReport'][_0xe21f('0x1e')](_0x5e6367)['then'](function(_0xd95ded){_0x53e731[_0xe21f('0x1e')]=_0xd95ded;if(_0x3caf40[_0xe21f('0x32')]['includeAll']){_0x45c078[_0xe21f('0x40')]=[{'all':!![]}];}return db[_0xe21f('0x2d')][_0xe21f('0x41')](_0x45c078);})[_0xe21f('0x26')](function(_0x1a4595){_0x53e731[_0xe21f('0x42')]=_0x1a4595;return _0x53e731;})['then'](respondWithFilteredResult(_0x3a1b5a,_0x45c078))['catch'](handleError(_0x3a1b5a,null));};exports[_0xe21f('0x43')]=function(_0x988549,_0xf2a3bf){var _0x1b211d={'raw':!![],'where':{'id':_0x988549[_0xe21f('0x44')]['id']}},_0x27f3f2={};_0x27f3f2[_0xe21f('0x35')]=_[_0xe21f('0x31')](db[_0xe21f('0x2d')][_0xe21f('0x2e')]);_0x27f3f2[_0xe21f('0x32')]=_[_0xe21f('0x31')](_0x988549[_0xe21f('0x32')]);_0x27f3f2[_0xe21f('0x33')]=_[_0xe21f('0x34')](_0x27f3f2['model'],_0x27f3f2[_0xe21f('0x32')]);_0x1b211d[_0xe21f('0x37')]=_['intersection'](_0x27f3f2['model'],qs[_0xe21f('0x36')](_0x988549[_0xe21f('0x32')][_0xe21f('0x36')]));_0x1b211d[_0xe21f('0x37')]=_0x1b211d[_0xe21f('0x37')][_0xe21f('0x38')]?_0x1b211d['attributes']:_0x27f3f2[_0xe21f('0x35')];if(_0x988549[_0xe21f('0x32')][_0xe21f('0x45')]){_0x1b211d[_0xe21f('0x40')]=[{'all':!![]}];}_0x1b211d=_[_0xe21f('0x3e')]({},_0x1b211d,_0x988549[_0xe21f('0x46')]);return db[_0xe21f('0x2d')][_0xe21f('0x47')](_0x1b211d)[_0xe21f('0x26')](handleEntityNotFound(_0xf2a3bf,null))['then'](respondWithResult(_0xf2a3bf,null))[_0xe21f('0x48')](handleError(_0xf2a3bf,null));};exports['create']=function(_0x2765c0,_0x14d408){return db['SquareDetailsReport'][_0xe21f('0x49')](_0x2765c0[_0xe21f('0x4a')],{})[_0xe21f('0x26')](respondWithResult(_0x14d408,0xc9))[_0xe21f('0x48')](handleError(_0x14d408,null));};exports[_0xe21f('0x25')]=function(_0x150d92,_0x11c97c){if(_0x150d92[_0xe21f('0x4a')]['id']){delete _0x150d92[_0xe21f('0x4a')]['id'];}return db[_0xe21f('0x2d')][_0xe21f('0x47')]({'where':{'id':_0x150d92['params']['id']}})[_0xe21f('0x26')](handleEntityNotFound(_0x11c97c,null))[_0xe21f('0x26')](saveUpdates(_0x150d92['body'],null))['then'](respondWithResult(_0x11c97c,null))[_0xe21f('0x48')](handleError(_0x11c97c,null));};exports[_0xe21f('0x27')]=function(_0x479627,_0x6a9cb9){return db[_0xe21f('0x2d')]['find']({'where':{'id':_0x479627[_0xe21f('0x44')]['id']}})[_0xe21f('0x26')](handleEntityNotFound(_0x6a9cb9,null))[_0xe21f('0x26')](removeEntity(_0x6a9cb9,null))['catch'](handleError(_0x6a9cb9,null));};exports[_0xe21f('0x4b')]=function(_0x41f9ac,_0x47ecbd){return db[_0xe21f('0x2d')][_0xe21f('0x4b')]()[_0xe21f('0x26')](respondWithResult(_0x47ecbd,null))[_0xe21f('0x48')](handleError(_0x47ecbd,null));}; \ No newline at end of file +var _0xb1d3=['jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','end','error','stack','name','send','index','map','SquareDetailsReport','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','findAll','show','params','rawAttributes','include','options','catch','create','body','find','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','ejs','fs-extra','lodash','crypto'];(function(_0x4baae2,_0x487ab6){var _0x1a2285=function(_0x1cea47){while(--_0x1cea47){_0x4baae2['push'](_0x4baae2['shift']());}};_0x1a2285(++_0x487ab6);}(_0xb1d3,0x8f));var _0x3b1d=function(_0x318632,_0x5c52f7){_0x318632=_0x318632-0x0;var _0x1a520b=_0xb1d3[_0x318632];return _0x1a520b;};'use strict';var emlformat=require(_0x3b1d('0x0'));var rimraf=require(_0x3b1d('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x3b1d('0x2'));var rp=require(_0x3b1d('0x3'));var moment=require(_0x3b1d('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x3b1d('0x5'));var util=require(_0x3b1d('0x6'));var path=require(_0x3b1d('0x7'));var sox=require(_0x3b1d('0x8'));var csv=require('to-csv');var ejs=require(_0x3b1d('0x9'));var fs=require('fs');var fs_extra=require(_0x3b1d('0xa'));var _=require(_0x3b1d('0xb'));var squel=require('squel');var crypto=require(_0x3b1d('0xc'));var jsforce=require(_0x3b1d('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x3b1d('0xe'));var querystring=require(_0x3b1d('0xf'));var Papa=require(_0x3b1d('0x10'));var Redis=require(_0x3b1d('0x11'));var authService=require(_0x3b1d('0x12'));var qs=require(_0x3b1d('0x13'));var as=require(_0x3b1d('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x3b1d('0x15'));var utils=require(_0x3b1d('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x3b1d('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3e6724,_0xc9d35b){_0xc9d35b=_0xc9d35b||0xcc;return function(_0x2f6aac){if(_0x2f6aac){return _0x3e6724[_0x3b1d('0x18')](_0xc9d35b);}return _0x3e6724['status'](_0xc9d35b)['end']();};}function respondWithResult(_0x42245e,_0x2cca5f){_0x2cca5f=_0x2cca5f||0xc8;return function(_0x577a3c){if(_0x577a3c){return _0x42245e[_0x3b1d('0x19')](_0x2cca5f)[_0x3b1d('0x1a')](_0x577a3c);}};}function respondWithFilteredResult(_0x57a9d0,_0x30cb96){return function(_0x59ec43){if(_0x59ec43){var _0x210799=typeof _0x30cb96[_0x3b1d('0x1b')]===_0x3b1d('0x1c')&&typeof _0x30cb96[_0x3b1d('0x1d')]===_0x3b1d('0x1c');var _0x3b6287=_0x59ec43[_0x3b1d('0x1e')];var _0xfabc1e=_0x210799?0x0:_0x30cb96[_0x3b1d('0x1b')];var _0x330dbc=_0x210799?_0x59ec43[_0x3b1d('0x1e')]:_0x30cb96[_0x3b1d('0x1b')]+_0x30cb96[_0x3b1d('0x1d')];var _0x59a28b;if(_0x330dbc>=_0x3b6287){_0x330dbc=_0x3b6287;_0x59a28b=0xc8;}else{_0x59a28b=0xce;}_0x57a9d0['status'](_0x59a28b);return _0x57a9d0[_0x3b1d('0x1f')](_0x3b1d('0x20'),_0xfabc1e+'-'+_0x330dbc+'/'+_0x3b6287)[_0x3b1d('0x1a')](_0x59ec43);}return null;};}function patchUpdates(_0x4758f8){return function(_0x319d18){try{jsonpatch[_0x3b1d('0x21')](_0x319d18,_0x4758f8,!![]);}catch(_0x2c8552){return BPromise['reject'](_0x2c8552);}return _0x319d18[_0x3b1d('0x22')]();};}function saveUpdates(_0x167950,_0x42274e){return function(_0x59a52f){if(_0x59a52f){return _0x59a52f[_0x3b1d('0x23')](_0x167950)[_0x3b1d('0x24')](function(_0x9976){return _0x9976;});}return null;};}function removeEntity(_0x186b27,_0x19164c){return function(_0x145049){if(_0x145049){return _0x145049[_0x3b1d('0x25')]()['then'](function(){_0x186b27['status'](0xcc)[_0x3b1d('0x26')]();});}};}function handleEntityNotFound(_0x210764,_0x3a2d26){return function(_0x2cd8f1){if(!_0x2cd8f1){_0x210764[_0x3b1d('0x18')](0x194);}return _0x2cd8f1;};}function handleError(_0x583176,_0x1b1fc3){_0x1b1fc3=_0x1b1fc3||0x1f4;return function(_0x159da8){logger[_0x3b1d('0x27')](_0x159da8[_0x3b1d('0x28')]);if(_0x159da8['name']){delete _0x159da8[_0x3b1d('0x29')];}_0x583176[_0x3b1d('0x19')](_0x1b1fc3)[_0x3b1d('0x2a')](_0x159da8);};}exports[_0x3b1d('0x2b')]=function(_0x2d2795,_0x4faf23){var _0x2d1c26={},_0x5ad1e4={},_0x43a33c={'count':0x0,'rows':[]};var _0x16df74=_[_0x3b1d('0x2c')](db[_0x3b1d('0x2d')]['rawAttributes'],function(_0x338f97){return{'name':_0x338f97[_0x3b1d('0x2e')],'type':_0x338f97[_0x3b1d('0x2f')][_0x3b1d('0x30')]};});_0x5ad1e4[_0x3b1d('0x31')]=_[_0x3b1d('0x2c')](_0x16df74,_0x3b1d('0x29'));_0x5ad1e4[_0x3b1d('0x32')]=_[_0x3b1d('0x33')](_0x2d2795[_0x3b1d('0x32')]);_0x5ad1e4[_0x3b1d('0x34')]=_[_0x3b1d('0x35')](_0x5ad1e4[_0x3b1d('0x31')],_0x5ad1e4['query']);_0x2d1c26[_0x3b1d('0x36')]=_[_0x3b1d('0x35')](_0x5ad1e4[_0x3b1d('0x31')],qs[_0x3b1d('0x37')](_0x2d2795[_0x3b1d('0x32')][_0x3b1d('0x37')]));_0x2d1c26[_0x3b1d('0x36')]=_0x2d1c26[_0x3b1d('0x36')][_0x3b1d('0x38')]?_0x2d1c26[_0x3b1d('0x36')]:_0x5ad1e4[_0x3b1d('0x31')];if(!_0x2d2795[_0x3b1d('0x32')][_0x3b1d('0x39')](_0x3b1d('0x3a'))){_0x2d1c26[_0x3b1d('0x1d')]=qs[_0x3b1d('0x1d')](_0x2d2795[_0x3b1d('0x32')]['limit']);_0x2d1c26[_0x3b1d('0x1b')]=qs['offset'](_0x2d2795[_0x3b1d('0x32')]['offset']);}_0x2d1c26[_0x3b1d('0x3b')]=qs[_0x3b1d('0x3c')](_0x2d2795[_0x3b1d('0x32')][_0x3b1d('0x3c')]);_0x2d1c26[_0x3b1d('0x3d')]=qs[_0x3b1d('0x34')](_[_0x3b1d('0x3e')](_0x2d2795[_0x3b1d('0x32')],_0x5ad1e4[_0x3b1d('0x34')]),_0x16df74);if(_0x2d2795['query'][_0x3b1d('0x3f')]){_0x2d1c26[_0x3b1d('0x3d')]=_[_0x3b1d('0x40')](_0x2d1c26[_0x3b1d('0x3d')],{'$or':_['map'](_0x16df74,function(_0x9773ea){if(_0x9773ea[_0x3b1d('0x2f')]!==_0x3b1d('0x41')){var _0xdd2f0={};_0xdd2f0[_0x9773ea[_0x3b1d('0x29')]]={'$like':'%'+_0x2d2795[_0x3b1d('0x32')][_0x3b1d('0x3f')]+'%'};return _0xdd2f0;}})});}_0x2d1c26=_[_0x3b1d('0x40')]({},_0x2d1c26,_0x2d2795['options']);var _0x451cc3={'where':_0x2d1c26[_0x3b1d('0x3d')]};return db[_0x3b1d('0x2d')][_0x3b1d('0x1e')](_0x451cc3)['then'](function(_0xf5c18e){_0x43a33c[_0x3b1d('0x1e')]=_0xf5c18e;if(_0x2d2795[_0x3b1d('0x32')][_0x3b1d('0x42')]){_0x2d1c26['include']=[{'all':!![]}];}return db[_0x3b1d('0x2d')][_0x3b1d('0x43')](_0x2d1c26);})[_0x3b1d('0x24')](function(_0x5ac6f5){_0x43a33c['rows']=_0x5ac6f5;return _0x43a33c;})[_0x3b1d('0x24')](respondWithFilteredResult(_0x4faf23,_0x2d1c26))['catch'](handleError(_0x4faf23,null));};exports[_0x3b1d('0x44')]=function(_0x22a25c,_0x6cb1f9){var _0x5d2204={'raw':!![],'where':{'id':_0x22a25c[_0x3b1d('0x45')]['id']}},_0x346a64={};_0x346a64[_0x3b1d('0x31')]=_[_0x3b1d('0x33')](db[_0x3b1d('0x2d')][_0x3b1d('0x46')]);_0x346a64[_0x3b1d('0x32')]=_[_0x3b1d('0x33')](_0x22a25c[_0x3b1d('0x32')]);_0x346a64['filters']=_[_0x3b1d('0x35')](_0x346a64[_0x3b1d('0x31')],_0x346a64[_0x3b1d('0x32')]);_0x5d2204[_0x3b1d('0x36')]=_[_0x3b1d('0x35')](_0x346a64[_0x3b1d('0x31')],qs[_0x3b1d('0x37')](_0x22a25c[_0x3b1d('0x32')][_0x3b1d('0x37')]));_0x5d2204['attributes']=_0x5d2204[_0x3b1d('0x36')][_0x3b1d('0x38')]?_0x5d2204[_0x3b1d('0x36')]:_0x346a64['model'];if(_0x22a25c[_0x3b1d('0x32')][_0x3b1d('0x42')]){_0x5d2204[_0x3b1d('0x47')]=[{'all':!![]}];}_0x5d2204=_[_0x3b1d('0x40')]({},_0x5d2204,_0x22a25c[_0x3b1d('0x48')]);return db['SquareDetailsReport']['find'](_0x5d2204)[_0x3b1d('0x24')](handleEntityNotFound(_0x6cb1f9,null))[_0x3b1d('0x24')](respondWithResult(_0x6cb1f9,null))[_0x3b1d('0x49')](handleError(_0x6cb1f9,null));};exports[_0x3b1d('0x4a')]=function(_0x2acfb4,_0xd672d5){return db[_0x3b1d('0x2d')]['create'](_0x2acfb4[_0x3b1d('0x4b')],{})[_0x3b1d('0x24')](respondWithResult(_0xd672d5,0xc9))[_0x3b1d('0x49')](handleError(_0xd672d5,null));};exports[_0x3b1d('0x23')]=function(_0x33398e,_0x548e39){if(_0x33398e['body']['id']){delete _0x33398e[_0x3b1d('0x4b')]['id'];}return db['SquareDetailsReport'][_0x3b1d('0x4c')]({'where':{'id':_0x33398e[_0x3b1d('0x45')]['id']}})[_0x3b1d('0x24')](handleEntityNotFound(_0x548e39,null))[_0x3b1d('0x24')](saveUpdates(_0x33398e[_0x3b1d('0x4b')],null))[_0x3b1d('0x24')](respondWithResult(_0x548e39,null))[_0x3b1d('0x49')](handleError(_0x548e39,null));};exports[_0x3b1d('0x25')]=function(_0xf61144,_0x1f3d91){return db[_0x3b1d('0x2d')][_0x3b1d('0x4c')]({'where':{'id':_0xf61144[_0x3b1d('0x45')]['id']}})[_0x3b1d('0x24')](handleEntityNotFound(_0x1f3d91,null))[_0x3b1d('0x24')](removeEntity(_0x1f3d91,null))[_0x3b1d('0x49')](handleError(_0x1f3d91,null));};exports[_0x3b1d('0x4d')]=function(_0x1678c3,_0x6e245c){return db['SquareDetailsReport'][_0x3b1d('0x4d')]()[_0x3b1d('0x24')](respondWithResult(_0x6e245c,null))[_0x3b1d('0x49')](handleError(_0x6e245c,null));}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.model.js b/server/api/squareReportDetail/squareReportDetail.model.js index d883df8..20f7327 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 _0xc463=['bluebird','request-promise','path','rimraf','define','lodash','util','../../config/logger','api','moment'];(function(_0x43cbe1,_0x4fc6d0){var _0x4ab06d=function(_0x520cc2){while(--_0x520cc2){_0x43cbe1['push'](_0x43cbe1['shift']());}};_0x4ab06d(++_0x4fc6d0);}(_0xc463,0x87));var _0x3c46=function(_0x5c92f7,_0x17381f){_0x5c92f7=_0x5c92f7-0x0;var _0x452cc1=_0xc463[_0x5c92f7];return _0x452cc1;};'use strict';var _=require(_0x3c46('0x0'));var util=require(_0x3c46('0x1'));var logger=require(_0x3c46('0x2'))(_0x3c46('0x3'));var moment=require(_0x3c46('0x4'));var BPromise=require(_0x3c46('0x5'));var rp=require(_0x3c46('0x6'));var fs=require('fs');var path=require(_0x3c46('0x7'));var rimraf=require(_0x3c46('0x8'));var config=require('../../config/environment');var attributes=require('./squareReportDetail.attributes');module['exports']=function(_0x2f9953,_0x3eb4c2){return _0x2f9953[_0x3c46('0x9')]('SquareDetailsReport',attributes,{'tableName':'report_square_details','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x705c=['define','SquareDetailsReport','report_square_details','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports'];(function(_0x1e9b82,_0x149177){var _0x4afca3=function(_0x489636){while(--_0x489636){_0x1e9b82['push'](_0x1e9b82['shift']());}};_0x4afca3(++_0x149177);}(_0x705c,0x1a3));var _0xc705=function(_0x5ce101,_0x38ff61){_0x5ce101=_0x5ce101-0x0;var _0x3bcb84=_0x705c[_0x5ce101];return _0x3bcb84;};'use strict';var _=require(_0xc705('0x0'));var util=require('util');var logger=require(_0xc705('0x1'))(_0xc705('0x2'));var moment=require(_0xc705('0x3'));var BPromise=require(_0xc705('0x4'));var rp=require(_0xc705('0x5'));var fs=require('fs');var path=require(_0xc705('0x6'));var rimraf=require(_0xc705('0x7'));var config=require(_0xc705('0x8'));var attributes=require('./squareReportDetail.attributes');module[_0xc705('0x9')]=function(_0x14ebab,_0x42174a){return _0x14ebab[_0xc705('0xa')](_0xc705('0xb'),attributes,{'tableName':_0xc705('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.rpc.js b/server/api/squareReportDetail/squareReportDetail.rpc.js index ad36c32..77f1f56 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 _0x5204=['util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','info','SquareDetailsReport,\x20%s,\x20%s','request\x20sent','debug','SquareDetailsReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateSquareDetailsReport','SquareDetailsReport','create','body','options','lodash'];(function(_0x57f27f,_0x2c6d8e){var _0x5f5ad0=function(_0x4dec5d){while(--_0x4dec5d){_0x57f27f['push'](_0x57f27f['shift']());}};_0x5f5ad0(++_0x2c6d8e);}(_0x5204,0xdf));var _0x4520=function(_0x57cbfb,_0x2de760){_0x57cbfb=_0x57cbfb-0x0;var _0x4cb933=_0x5204[_0x57cbfb];return _0x4cb933;};'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')]('CreateSquareDetailsReport',_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')]));});});}; \ No newline at end of file +var _0x93e6=['error','code','message','info','result','catch','CreateSquareDetailsReport','SquareDetailsReport','options','raw','stringify','lodash','bluebird','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','SquareDetailsReport,\x20%s,\x20%s','debug','request\x20sent'];(function(_0x3d43e3,_0x2a3110){var _0x4880c3=function(_0x271d6d){while(--_0x271d6d){_0x3d43e3['push'](_0x3d43e3['shift']());}};_0x4880c3(++_0x2a3110);}(_0x93e6,0x11e));var _0x693e=function(_0x186295,_0x9f2aa1){_0x186295=_0x186295-0x0;var _0x211029=_0x93e6[_0x186295];return _0x211029;};'use strict';var _=require(_0x693e('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x693e('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x693e('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x693e('0x3'));var logger=require(_0x693e('0x4'))(_0x693e('0x5'));var config=require('../../config/environment');var jayson=require(_0x693e('0x6'));var client=jayson[_0x693e('0x7')][_0x693e('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x520113,_0x577dcb,_0x57897c){return new BPromise(function(_0x155601,_0x4b30f6){return client[_0x693e('0x9')](_0x520113,_0x57897c)[_0x693e('0xa')](function(_0x14b901){logger['info'](_0x693e('0xb'),_0x577dcb,'request\x20sent');logger[_0x693e('0xc')]('SquareDetailsReport,\x20%s,\x20%s,\x20%s',_0x577dcb,_0x693e('0xd'),JSON['stringify'](_0x14b901));if(_0x14b901['error']){if(_0x14b901[_0x693e('0xe')][_0x693e('0xf')]===0x1f4){logger[_0x693e('0xe')](_0x693e('0xb'),_0x577dcb,_0x14b901['error'][_0x693e('0x10')]);return _0x4b30f6(_0x14b901[_0x693e('0xe')][_0x693e('0x10')]);}logger[_0x693e('0xe')](_0x693e('0xb'),_0x577dcb,_0x14b901[_0x693e('0xe')][_0x693e('0x10')]);return _0x155601(_0x14b901['error'][_0x693e('0x10')]);}else{logger[_0x693e('0x11')](_0x693e('0xb'),_0x577dcb,'request\x20sent');_0x155601(_0x14b901[_0x693e('0x12')][_0x693e('0x10')]);}})[_0x693e('0x13')](function(_0xb3a90a){logger[_0x693e('0xe')](_0x693e('0xb'),_0x577dcb,_0xb3a90a);_0x4b30f6(_0xb3a90a);});});}exports[_0x693e('0x14')]=function(_0x4f4264){var _0x593916=this;return new Promise(function(_0x5e842f,_0x149325){return db[_0x693e('0x15')]['create'](_0x4f4264['body'],{'raw':_0x4f4264[_0x693e('0x16')]?_0x4f4264[_0x693e('0x16')][_0x693e('0x17')]===undefined?!![]:![]:!![]})[_0x693e('0xa')](function(_0x49614c){logger[_0x693e('0x11')](_0x693e('0x14'),_0x4f4264);logger[_0x693e('0xc')]('CreateSquareDetailsReport',_0x4f4264,JSON[_0x693e('0x18')](_0x49614c));_0x5e842f(_0x49614c);})[_0x693e('0x13')](function(_0x569646){logger[_0x693e('0xe')](_0x693e('0x14'),_0x569646['message'],_0x4f4264);_0x149325(_0x593916[_0x693e('0xe')](0x1f4,_0x569646[_0x693e('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/system/index.js b/server/api/system/index.js index ba0b8ef..cbb02b3 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 _0x1465=['killProcess','exports','express','Router','../../components/auth/service','./system.controller','get','isAuthenticated','/process/:pid/kill'];(function(_0x21f88c,_0x3cc533){var _0x232aa6=function(_0x42de8a){while(--_0x42de8a){_0x21f88c['push'](_0x21f88c['shift']());}};_0x232aa6(++_0x3cc533);}(_0x1465,0x13d));var _0x5146=function(_0x2d34d6,_0x397ff9){_0x2d34d6=_0x2d34d6-0x0;var _0x1d3d12=_0x1465[_0x2d34d6];return _0x1d3d12;};'use strict';var express=require(_0x5146('0x0'));var router=express[_0x5146('0x1')]();var auth=require(_0x5146('0x2'));var controller=require(_0x5146('0x3'));router[_0x5146('0x4')]('/',auth[_0x5146('0x5')](),controller['index']);router[_0x5146('0x4')](_0x5146('0x6'),auth[_0x5146('0x5')](),controller[_0x5146('0x7')]);module[_0x5146('0x8')]=router; \ No newline at end of file +var _0xe2af=['Router','../../components/auth/service','get','isAuthenticated','/process/:pid/kill','killProcess','exports'];(function(_0x59a74c,_0x1df46b){var _0x10edf5=function(_0x461b1c){while(--_0x461b1c){_0x59a74c['push'](_0x59a74c['shift']());}};_0x10edf5(++_0x1df46b);}(_0xe2af,0xf5));var _0xfe2a=function(_0x991b1b,_0x41ffce){_0x991b1b=_0x991b1b-0x0;var _0x45e7ec=_0xe2af[_0x991b1b];return _0x45e7ec;};'use strict';var express=require('express');var router=express[_0xfe2a('0x0')]();var auth=require(_0xfe2a('0x1'));var controller=require('./system.controller');router[_0xfe2a('0x2')]('/',auth[_0xfe2a('0x3')](),controller['index']);router['get'](_0xfe2a('0x4'),auth[_0xfe2a('0x3')](),controller[_0xfe2a('0x5')]);module[_0xfe2a('0x6')]=router; \ No newline at end of file diff --git a/server/api/system/system.controller.js b/server/api/system/system.controller.js index bb7f325..6c81409 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 _0xbeb5=['Process\x20with\x20pid\x20%s\x20not\x20found!','pid','kill','Process\x20with\x20pid\x20%s\x20killed\x20correctly','killProcess','systeminformation','child_process','../../config/logger','api','bluebird','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','status','send','index','getAllData','json','catch','components/import/cm','format','ps\x20-p\x20%s\x20-ww\x20-o\x20args','params','then','split','indexOf'];(function(_0xa3354c,_0x4474ff){var _0x87333e=function(_0x52c8a0){while(--_0x52c8a0){_0xa3354c['push'](_0xa3354c['shift']());}};_0x87333e(++_0x4474ff);}(_0xbeb5,0x7d));var _0x5beb=function(_0x14d9b2,_0x5a34dd){_0x14d9b2=_0x14d9b2-0x0;var _0x17e8c7=_0xbeb5[_0x14d9b2];return _0x17e8c7;};'use strict';var info=require(_0x5beb('0x0'));var exec=require(_0x5beb('0x1'))['exec'];var logger=require(_0x5beb('0x2'))(_0x5beb('0x3'));var util=require('util');var BPromise=require(_0x5beb('0x4'));var _=require('lodash');function handleError(_0x2f88ed,_0x422e00,_0x132e48){_0x422e00=_0x422e00||0x1f4;return function(_0xcb4f79){logger['error'](_0x5beb('0x5'),_0x132e48,_0x422e00,util['inspect'](_0xcb4f79,{'showHidden':![],'depth':null}));delete _0xcb4f79['name'];_0x2f88ed[_0x5beb('0x6')](_0x422e00)[_0x5beb('0x7')](_0xcb4f79);};}exports[_0x5beb('0x8')]=function(_0x23f753,_0x2c86f9){return info[_0x5beb('0x9')]()['then'](function(_0x3792f1){return _0x2c86f9['status'](0xc8)[_0x5beb('0xa')](_0x3792f1);})[_0x5beb('0xb')](function(_0x432589){return _0x2c86f9['status'](0x1f4)[_0x5beb('0xa')](_0x432589);});};exports['killProcess']=function(_0x481e1f,_0x5a88f7){var _0x189b9c=[_0x5beb('0xc')];return new BPromise(function(_0x3afa10,_0x32a77d){return exec(util[_0x5beb('0xd')](_0x5beb('0xe'),_0x481e1f[_0x5beb('0xf')]['pid']),function(_0x17a7b5,_0x16a20b,_0x7e6046){if(_0x17a7b5){return _0x32a77d(_0x17a7b5);}return _0x3afa10(_0x16a20b);});})[_0x5beb('0x10')](function(_0x18cd37){var _0x2a10bf=![];var _0x319229=_0x18cd37[_0x5beb('0x11')](/\n/);for(var _0x6ab83e=0x0,_0x494d56=_0x189b9c['length'];_0x6ab83e<_0x494d56,_0x2a10bf===![];_0x6ab83e+=0x1){if(_0x18cd37[_0x5beb('0x12')](_0x189b9c[_0x6ab83e])>=0x0){_0x2a10bf=!![];}}if(!_0x2a10bf){throw new Error(util[_0x5beb('0xd')](_0x5beb('0x13'),_0x481e1f[_0x5beb('0xf')][_0x5beb('0x14')]));}process[_0x5beb('0x15')](_0x481e1f[_0x5beb('0xf')][_0x5beb('0x14')],'SIGINT');return _0x5a88f7['status'](0xc8)['json']({'message':util[_0x5beb('0xd')](_0x5beb('0x16'),_0x481e1f[_0x5beb('0xf')][_0x5beb('0x14')])});})[_0x5beb('0xb')](handleError(_0x5a88f7,null,_0x5beb('0x17')));}; \ No newline at end of file +var _0x1332=['status','json','catch','killProcess','components/import/cm','format','params','pid','then','split','length','indexOf','Process\x20with\x20pid\x20%s\x20not\x20found!','kill','SIGINT','Process\x20with\x20pid\x20%s\x20killed\x20correctly','child_process','../../config/logger','util','lodash','error','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','inspect','name','send','index','getAllData'];(function(_0x3984a6,_0x4adaba){var _0x2cc75f=function(_0x4a3849){while(--_0x4a3849){_0x3984a6['push'](_0x3984a6['shift']());}};_0x2cc75f(++_0x4adaba);}(_0x1332,0x97));var _0x2133=function(_0x4265a8,_0xeb4898){_0x4265a8=_0x4265a8-0x0;var _0x41ac66=_0x1332[_0x4265a8];return _0x41ac66;};'use strict';var info=require('systeminformation');var exec=require(_0x2133('0x0'))['exec'];var logger=require(_0x2133('0x1'))('api');var util=require(_0x2133('0x2'));var BPromise=require('bluebird');var _=require(_0x2133('0x3'));function handleError(_0x292417,_0x52970f,_0x7d4161){_0x52970f=_0x52970f||0x1f4;return function(_0x5bf4c4){logger[_0x2133('0x4')](_0x2133('0x5'),_0x7d4161,_0x52970f,util[_0x2133('0x6')](_0x5bf4c4,{'showHidden':![],'depth':null}));delete _0x5bf4c4[_0x2133('0x7')];_0x292417['status'](_0x52970f)[_0x2133('0x8')](_0x5bf4c4);};}exports[_0x2133('0x9')]=function(_0x53f274,_0x2f9d41){return info[_0x2133('0xa')]()['then'](function(_0x449a7c){return _0x2f9d41[_0x2133('0xb')](0xc8)[_0x2133('0xc')](_0x449a7c);})[_0x2133('0xd')](function(_0x54051c){return _0x2f9d41[_0x2133('0xb')](0x1f4)[_0x2133('0xc')](_0x54051c);});};exports[_0x2133('0xe')]=function(_0x403e75,_0x36428c){var _0x407825=[_0x2133('0xf')];return new BPromise(function(_0x250a13,_0x5cf980){return exec(util[_0x2133('0x10')]('ps\x20-p\x20%s\x20-ww\x20-o\x20args',_0x403e75[_0x2133('0x11')][_0x2133('0x12')]),function(_0x137478,_0x5bb22b,_0x4bd932){if(_0x137478){return _0x5cf980(_0x137478);}return _0x250a13(_0x5bb22b);});})[_0x2133('0x13')](function(_0x3d1b95){var _0x4d07dc=![];var _0x2573bc=_0x3d1b95[_0x2133('0x14')](/\n/);for(var _0x18c33b=0x0,_0x163c71=_0x407825[_0x2133('0x15')];_0x18c33b<_0x163c71,_0x4d07dc===![];_0x18c33b+=0x1){if(_0x3d1b95[_0x2133('0x16')](_0x407825[_0x18c33b])>=0x0){_0x4d07dc=!![];}}if(!_0x4d07dc){throw new Error(util[_0x2133('0x10')](_0x2133('0x17'),_0x403e75[_0x2133('0x11')][_0x2133('0x12')]));}process[_0x2133('0x18')](_0x403e75[_0x2133('0x11')][_0x2133('0x12')],_0x2133('0x19'));return _0x36428c[_0x2133('0xb')](0xc8)[_0x2133('0xc')]({'message':util[_0x2133('0x10')](_0x2133('0x1a'),_0x403e75[_0x2133('0x11')][_0x2133('0x12')])});})['catch'](handleError(_0x36428c,null,_0x2133('0xe')));}; \ No newline at end of file diff --git a/server/api/tag/index.js b/server/api/tag/index.js index 3184306..8fd27e3 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 _0x1730=['connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./tag.controller','get','index','/:id','show','post','isAuthenticated','create','put','update','delete','destroy','exports','util'];(function(_0x47f8d2,_0x4e6e1d){var _0x13557a=function(_0x85d906){while(--_0x85d906){_0x47f8d2['push'](_0x47f8d2['shift']());}};_0x13557a(++_0x4e6e1d);}(_0x1730,0x97));var _0x0173=function(_0x46e1a2,_0x461117){_0x46e1a2=_0x46e1a2-0x0;var _0x1f8a85=_0x1730[_0x46e1a2];return _0x1f8a85;};'use strict';var multer=require('multer');var util=require(_0x0173('0x0'));var path=require('path');var timeout=require(_0x0173('0x1'));var express=require('express');var router=express[_0x0173('0x2')]();var fs_extra=require(_0x0173('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x0173('0x4'));var config=require(_0x0173('0x5'));var controller=require(_0x0173('0x6'));router[_0x0173('0x7')]('/',auth['isAuthenticated'](),controller[_0x0173('0x8')]);router[_0x0173('0x7')](_0x0173('0x9'),auth['isAuthenticated'](),controller[_0x0173('0xa')]);router[_0x0173('0xb')]('/',auth[_0x0173('0xc')](),controller[_0x0173('0xd')]);router[_0x0173('0xe')](_0x0173('0x9'),auth[_0x0173('0xc')](),controller[_0x0173('0xf')]);router[_0x0173('0x10')](_0x0173('0x9'),auth[_0x0173('0xc')](),controller[_0x0173('0x11')]);module[_0x0173('0x12')]=router; \ No newline at end of file +var _0x7df3=['exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./tag.controller','get','index','/:id','show','post','isAuthenticated','create','put','update','delete','destroy'];(function(_0x1f045a,_0x2a12ea){var _0x22238b=function(_0x5aa2cd){while(--_0x5aa2cd){_0x1f045a['push'](_0x1f045a['shift']());}};_0x22238b(++_0x2a12ea);}(_0x7df3,0x109));var _0x37df=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x7df3[_0x4cf98e];return _0x1623ac;};'use strict';var multer=require(_0x37df('0x0'));var util=require(_0x37df('0x1'));var path=require('path');var timeout=require(_0x37df('0x2'));var express=require(_0x37df('0x3'));var router=express[_0x37df('0x4')]();var fs_extra=require(_0x37df('0x5'));var auth=require(_0x37df('0x6'));var interaction=require(_0x37df('0x7'));var config=require(_0x37df('0x8'));var controller=require(_0x37df('0x9'));router[_0x37df('0xa')]('/',auth['isAuthenticated'](),controller[_0x37df('0xb')]);router[_0x37df('0xa')](_0x37df('0xc'),auth['isAuthenticated'](),controller[_0x37df('0xd')]);router[_0x37df('0xe')]('/',auth[_0x37df('0xf')](),controller[_0x37df('0x10')]);router[_0x37df('0x11')]('/:id',auth[_0x37df('0xf')](),controller[_0x37df('0x12')]);router[_0x37df('0x13')](_0x37df('0xc'),auth[_0x37df('0xf')](),controller[_0x37df('0x14')]);module[_0x37df('0x15')]=router; \ No newline at end of file diff --git a/server/api/tag/tag.attributes.js b/server/api/tag/tag.attributes.js index f96fea5..7cb8e5d 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 _0x9861=['STRING','#0091EA','sequelize','name'];(function(_0x194303,_0x50e0ce){var _0x5f1198=function(_0xf369cf){while(--_0xf369cf){_0x194303['push'](_0x194303['shift']());}};_0x5f1198(++_0x50e0ce);}(_0x9861,0x176));var _0x1986=function(_0x554826,_0x196d2e){_0x554826=_0x554826-0x0;var _0x2528f7=_0x9861[_0x554826];return _0x2528f7;};'use strict';var Sequelize=require(_0x1986('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0x1986('0x1'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0x1986('0x2')],'defaultValue':_0x1986('0x3')},'description':{'type':Sequelize[_0x1986('0x2')]}}; \ No newline at end of file +var _0x8caf=['STRING','name','#0091EA','exports'];(function(_0x24371d,_0x22fff0){var _0x58f9e3=function(_0x4e40f0){while(--_0x4e40f0){_0x24371d['push'](_0x24371d['shift']());}};_0x58f9e3(++_0x22fff0);}(_0x8caf,0x1ab));var _0xf8ca=function(_0x1b1ed8,_0x2b0f38){_0x1b1ed8=_0x1b1ed8-0x0;var _0x33e1d6=_0x8caf[_0x1b1ed8];return _0x33e1d6;};'use strict';var Sequelize=require('sequelize');module[_0xf8ca('0x0')]={'name':{'type':Sequelize[_0xf8ca('0x1')],'unique':_0xf8ca('0x2'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0xf8ca('0x1')],'defaultValue':_0xf8ca('0x3')},'description':{'type':Sequelize[_0xf8ca('0x1')]}}; \ No newline at end of file diff --git a/server/api/tag/tag.controller.js b/server/api/tag/tag.controller.js index 3763f4b..b6c9868 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 _0xee24=['VIRTUAL','options','includeAll','include','rows','catch','show','params','find','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Tags','UserProfileSection','userProfileId','create','update','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','count','limit','set','apply','reject','save','then','destroy','get','UserProfileResource','stack','name','send','Tag','rawAttributes','type','key','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge'];(function(_0x4bed75,_0x211cc7){var _0x2dd8e8=function(_0x6369c7){while(--_0x6369c7){_0x4bed75['push'](_0x4bed75['shift']());}};_0x2dd8e8(++_0x211cc7);}(_0xee24,0x1a6));var _0x4ee2=function(_0xe63ca1,_0x38dbee){_0xe63ca1=_0xe63ca1-0x0;var _0x3a2983=_0xee24[_0xe63ca1];return _0x3a2983;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x4ee2('0x0'));var zipdir=require(_0x4ee2('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4ee2('0x2'));var moment=require(_0x4ee2('0x3'));var BPromise=require(_0x4ee2('0x4'));var Mustache=require(_0x4ee2('0x5'));var util=require('util');var path=require(_0x4ee2('0x6'));var sox=require(_0x4ee2('0x7'));var csv=require(_0x4ee2('0x8'));var ejs=require(_0x4ee2('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4ee2('0xa'));var squel=require(_0x4ee2('0xb'));var crypto=require(_0x4ee2('0xc'));var jsforce=require(_0x4ee2('0xd'));var deskjs=require(_0x4ee2('0xe'));var toCsv=require(_0x4ee2('0x8'));var querystring=require(_0x4ee2('0xf'));var Papa=require(_0x4ee2('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x4ee2('0x11'));var as=require(_0x4ee2('0x12'));var hardwareService=require(_0x4ee2('0x13'));var logger=require(_0x4ee2('0x14'))(_0x4ee2('0x15'));var utils=require('../../config/utils');var config=require(_0x4ee2('0x16'));var licenseUtil=require(_0x4ee2('0x17'));var db=require(_0x4ee2('0x18'))['db'];function respondWithStatusCode(_0x322780,_0x51f09d){_0x51f09d=_0x51f09d||0xcc;return function(_0x1f7125){if(_0x1f7125){return _0x322780[_0x4ee2('0x19')](_0x51f09d);}return _0x322780[_0x4ee2('0x1a')](_0x51f09d)[_0x4ee2('0x1b')]();};}function respondWithResult(_0x4f41cb,_0x481181){_0x481181=_0x481181||0xc8;return function(_0x2357c5){if(_0x2357c5){return _0x4f41cb[_0x4ee2('0x1a')](_0x481181)['json'](_0x2357c5);}};}function respondWithFilteredResult(_0x34dacb,_0x231d5){return function(_0x3c4279){if(_0x3c4279){var _0x1b95c5=typeof _0x231d5[_0x4ee2('0x1c')]===_0x4ee2('0x1d')&&typeof _0x231d5['limit']===_0x4ee2('0x1d');var _0xde92d=_0x3c4279[_0x4ee2('0x1e')];var _0x4aba2b=_0x1b95c5?0x0:_0x231d5[_0x4ee2('0x1c')];var _0xb8e027=_0x1b95c5?_0x3c4279[_0x4ee2('0x1e')]:_0x231d5[_0x4ee2('0x1c')]+_0x231d5[_0x4ee2('0x1f')];var _0x341ca3;if(_0xb8e027>=_0xde92d){_0xb8e027=_0xde92d;_0x341ca3=0xc8;}else{_0x341ca3=0xce;}_0x34dacb[_0x4ee2('0x1a')](_0x341ca3);return _0x34dacb[_0x4ee2('0x20')]('Content-Range',_0x4aba2b+'-'+_0xb8e027+'/'+_0xde92d)['json'](_0x3c4279);}return null;};}function patchUpdates(_0x33e66e){return function(_0x4901ff){try{jsonpatch[_0x4ee2('0x21')](_0x4901ff,_0x33e66e,!![]);}catch(_0x1d29bf){return BPromise[_0x4ee2('0x22')](_0x1d29bf);}return _0x4901ff[_0x4ee2('0x23')]();};}function saveUpdates(_0x4507d6,_0x53f246){return function(_0x1d5037){if(_0x1d5037){return _0x1d5037['update'](_0x4507d6)[_0x4ee2('0x24')](function(_0x3e6344){return _0x3e6344;});}return null;};}function removeEntity(_0x2560fe,_0x1f4f90){return function(_0x1ca982){if(_0x1ca982){return _0x1ca982[_0x4ee2('0x25')]()[_0x4ee2('0x24')](function(){var _0x581c75=_0x1ca982[_0x4ee2('0x26')]({'plain':!![]});var _0x5127b8='Tags';return db[_0x4ee2('0x27')][_0x4ee2('0x25')]({'where':{'type':_0x5127b8,'resourceId':_0x581c75['id']}})[_0x4ee2('0x24')](function(){return _0x1ca982;});})[_0x4ee2('0x24')](function(){_0x2560fe[_0x4ee2('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x50005e,_0x404fba){return function(_0x2a078f){if(!_0x2a078f){_0x50005e['sendStatus'](0x194);}return _0x2a078f;};}function handleError(_0x2fe02a,_0x5a052b){_0x5a052b=_0x5a052b||0x1f4;return function(_0x49b1be){logger['error'](_0x49b1be[_0x4ee2('0x28')]);if(_0x49b1be[_0x4ee2('0x29')]){delete _0x49b1be['name'];}_0x2fe02a[_0x4ee2('0x1a')](_0x5a052b)[_0x4ee2('0x2a')](_0x49b1be);};}exports['index']=function(_0xc7df80,_0x4bf072){var _0x239ab7={},_0x3a0881={},_0x1fea65={'count':0x0,'rows':[]};var _0x4da154=_['map'](db[_0x4ee2('0x2b')][_0x4ee2('0x2c')],function(_0x3ab2a1){return{'name':_0x3ab2a1['fieldName'],'type':_0x3ab2a1[_0x4ee2('0x2d')][_0x4ee2('0x2e')]};});_0x3a0881[_0x4ee2('0x2f')]=_[_0x4ee2('0x30')](_0x4da154,_0x4ee2('0x29'));_0x3a0881[_0x4ee2('0x31')]=_[_0x4ee2('0x32')](_0xc7df80[_0x4ee2('0x31')]);_0x3a0881[_0x4ee2('0x33')]=_[_0x4ee2('0x34')](_0x3a0881[_0x4ee2('0x2f')],_0x3a0881[_0x4ee2('0x31')]);_0x239ab7['attributes']=_[_0x4ee2('0x34')](_0x3a0881[_0x4ee2('0x2f')],qs['fields'](_0xc7df80[_0x4ee2('0x31')][_0x4ee2('0x35')]));_0x239ab7[_0x4ee2('0x36')]=_0x239ab7[_0x4ee2('0x36')][_0x4ee2('0x37')]?_0x239ab7[_0x4ee2('0x36')]:_0x3a0881[_0x4ee2('0x2f')];if(!_0xc7df80['query'][_0x4ee2('0x38')](_0x4ee2('0x39'))){_0x239ab7[_0x4ee2('0x1f')]=qs['limit'](_0xc7df80[_0x4ee2('0x31')]['limit']);_0x239ab7[_0x4ee2('0x1c')]=qs[_0x4ee2('0x1c')](_0xc7df80[_0x4ee2('0x31')][_0x4ee2('0x1c')]);}_0x239ab7[_0x4ee2('0x3a')]=qs[_0x4ee2('0x3b')](_0xc7df80['query']['sort']);_0x239ab7[_0x4ee2('0x3c')]=qs[_0x4ee2('0x33')](_[_0x4ee2('0x3d')](_0xc7df80[_0x4ee2('0x31')],_0x3a0881[_0x4ee2('0x33')]),_0x4da154);if(_0xc7df80[_0x4ee2('0x31')][_0x4ee2('0x3e')]){_0x239ab7[_0x4ee2('0x3c')]=_[_0x4ee2('0x3f')](_0x239ab7[_0x4ee2('0x3c')],{'$or':_['map'](_0x4da154,function(_0x492595){if(_0x492595[_0x4ee2('0x2d')]!==_0x4ee2('0x40')){var _0x1255ff={};_0x1255ff[_0x492595['name']]={'$like':'%'+_0xc7df80[_0x4ee2('0x31')][_0x4ee2('0x3e')]+'%'};return _0x1255ff;}})});}_0x239ab7=_[_0x4ee2('0x3f')]({},_0x239ab7,_0xc7df80[_0x4ee2('0x41')]);var _0x31901e={'where':_0x239ab7[_0x4ee2('0x3c')]};return db[_0x4ee2('0x2b')][_0x4ee2('0x1e')](_0x31901e)[_0x4ee2('0x24')](function(_0x2b099b){_0x1fea65['count']=_0x2b099b;if(_0xc7df80['query'][_0x4ee2('0x42')]){_0x239ab7[_0x4ee2('0x43')]=[{'all':!![]}];}return db[_0x4ee2('0x2b')]['findAll'](_0x239ab7);})[_0x4ee2('0x24')](function(_0x56fd09){_0x1fea65[_0x4ee2('0x44')]=_0x56fd09;return _0x1fea65;})['then'](respondWithFilteredResult(_0x4bf072,_0x239ab7))[_0x4ee2('0x45')](handleError(_0x4bf072,null));};exports[_0x4ee2('0x46')]=function(_0x41607a,_0x5bc5f3){var _0x58a5de={'raw':!![],'where':{'id':_0x41607a[_0x4ee2('0x47')]['id']}},_0x4e7a92={};_0x4e7a92[_0x4ee2('0x2f')]=_[_0x4ee2('0x32')](db[_0x4ee2('0x2b')]['rawAttributes']);_0x4e7a92[_0x4ee2('0x31')]=_[_0x4ee2('0x32')](_0x41607a['query']);_0x4e7a92[_0x4ee2('0x33')]=_['intersection'](_0x4e7a92['model'],_0x4e7a92[_0x4ee2('0x31')]);_0x58a5de['attributes']=_[_0x4ee2('0x34')](_0x4e7a92['model'],qs[_0x4ee2('0x35')](_0x41607a[_0x4ee2('0x31')][_0x4ee2('0x35')]));_0x58a5de['attributes']=_0x58a5de[_0x4ee2('0x36')][_0x4ee2('0x37')]?_0x58a5de[_0x4ee2('0x36')]:_0x4e7a92[_0x4ee2('0x2f')];if(_0x41607a[_0x4ee2('0x31')]['includeAll']){_0x58a5de[_0x4ee2('0x43')]=[{'all':!![]}];}_0x58a5de=_[_0x4ee2('0x3f')]({},_0x58a5de,_0x41607a['options']);return db['Tag'][_0x4ee2('0x48')](_0x58a5de)['then'](handleEntityNotFound(_0x5bc5f3,null))[_0x4ee2('0x24')](respondWithResult(_0x5bc5f3,null))[_0x4ee2('0x45')](handleError(_0x5bc5f3,null));};exports['create']=function(_0x43ca98,_0x2bf21a){return db[_0x4ee2('0x2b')]['create'](_0x43ca98[_0x4ee2('0x49')],{})[_0x4ee2('0x24')](function(_0x4f3fa6){var _0x5204b0=_0x43ca98['user']['get']({'plain':!![]});if(!_0x5204b0)throw new Error(_0x4ee2('0x4a'));if(_0x5204b0[_0x4ee2('0x4b')]==='user'){var _0x1379c0=_0x4f3fa6[_0x4ee2('0x26')]({'plain':!![]});var _0x391424=_0x4ee2('0x4c');return db[_0x4ee2('0x4d')][_0x4ee2('0x48')]({'where':{'name':_0x391424,'userProfileId':_0x5204b0[_0x4ee2('0x4e')]},'raw':!![]})['then'](function(_0x4498af){if(_0x4498af&&_0x4498af['autoAssociation']===0x0){return db[_0x4ee2('0x27')][_0x4ee2('0x4f')]({'name':_0x1379c0[_0x4ee2('0x29')],'resourceId':_0x1379c0['id'],'type':_0x4498af['name'],'sectionId':_0x4498af['id']},{})[_0x4ee2('0x24')](function(){return _0x4f3fa6;});}else{return _0x4f3fa6;}})[_0x4ee2('0x45')](function(_0x304d64){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x304d64);throw _0x304d64;});}return _0x4f3fa6;})[_0x4ee2('0x24')](respondWithResult(_0x2bf21a,0xc9))[_0x4ee2('0x45')](handleError(_0x2bf21a,null));};exports[_0x4ee2('0x50')]=function(_0x3df5b3,_0x5ee68c){if(_0x3df5b3[_0x4ee2('0x49')]['id']){delete _0x3df5b3[_0x4ee2('0x49')]['id'];}return db[_0x4ee2('0x2b')][_0x4ee2('0x48')]({'where':{'id':_0x3df5b3[_0x4ee2('0x47')]['id']}})[_0x4ee2('0x24')](handleEntityNotFound(_0x5ee68c,null))[_0x4ee2('0x24')](saveUpdates(_0x3df5b3[_0x4ee2('0x49')],null))[_0x4ee2('0x24')](respondWithResult(_0x5ee68c,null))[_0x4ee2('0x45')](handleError(_0x5ee68c,null));};exports[_0x4ee2('0x25')]=function(_0x1a1021,_0x58dac3){return db['Tag'][_0x4ee2('0x48')]({'where':{'id':_0x1a1021[_0x4ee2('0x47')]['id']}})[_0x4ee2('0x24')](handleEntityNotFound(_0x58dac3,null))['then'](removeEntity(_0x58dac3,null))['catch'](handleError(_0x58dac3,null));}; \ No newline at end of file +var _0x9b87=['end','offset','undefined','count','set','Content-Range','json','apply','reject','update','then','destroy','get','UserProfileResource','error','stack','name','send','map','Tag','key','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','sort','where','filters','pick','type','VIRTUAL','filter','merge','options','includeAll','findAll','rows','catch','show','keys','rawAttributes','include','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','Tags','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x9b87,0x8e));var _0x79b8=function(_0x2f3183,_0x5998a3){_0x2f3183=_0x2f3183-0x0;var _0x87492d=_0x9b87[_0x2f3183];return _0x87492d;};'use strict';var emlformat=require(_0x79b8('0x0'));var rimraf=require(_0x79b8('0x1'));var zipdir=require(_0x79b8('0x2'));var jsonpatch=require(_0x79b8('0x3'));var rp=require(_0x79b8('0x4'));var moment=require(_0x79b8('0x5'));var BPromise=require(_0x79b8('0x6'));var Mustache=require(_0x79b8('0x7'));var util=require(_0x79b8('0x8'));var path=require(_0x79b8('0x9'));var sox=require(_0x79b8('0xa'));var csv=require(_0x79b8('0xb'));var ejs=require(_0x79b8('0xc'));var fs=require('fs');var fs_extra=require(_0x79b8('0xd'));var _=require(_0x79b8('0xe'));var squel=require(_0x79b8('0xf'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x79b8('0x10'));var Papa=require(_0x79b8('0x11'));var Redis=require(_0x79b8('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x79b8('0x13'));var as=require(_0x79b8('0x14'));var hardwareService=require(_0x79b8('0x15'));var logger=require('../../config/logger')('api');var utils=require(_0x79b8('0x16'));var config=require(_0x79b8('0x17'));var licenseUtil=require(_0x79b8('0x18'));var db=require(_0x79b8('0x19'))['db'];function respondWithStatusCode(_0x21ad20,_0x33227b){_0x33227b=_0x33227b||0xcc;return function(_0x41095c){if(_0x41095c){return _0x21ad20[_0x79b8('0x1a')](_0x33227b);}return _0x21ad20[_0x79b8('0x1b')](_0x33227b)[_0x79b8('0x1c')]();};}function respondWithResult(_0x43ec09,_0x59e229){_0x59e229=_0x59e229||0xc8;return function(_0x150fb7){if(_0x150fb7){return _0x43ec09['status'](_0x59e229)['json'](_0x150fb7);}};}function respondWithFilteredResult(_0x3142e9,_0x21aae0){return function(_0x57a248){if(_0x57a248){var _0x5ddab5=typeof _0x21aae0[_0x79b8('0x1d')]==='undefined'&&typeof _0x21aae0['limit']===_0x79b8('0x1e');var _0x24c02f=_0x57a248[_0x79b8('0x1f')];var _0x2ae2d5=_0x5ddab5?0x0:_0x21aae0[_0x79b8('0x1d')];var _0x23d771=_0x5ddab5?_0x57a248['count']:_0x21aae0[_0x79b8('0x1d')]+_0x21aae0['limit'];var _0x53d386;if(_0x23d771>=_0x24c02f){_0x23d771=_0x24c02f;_0x53d386=0xc8;}else{_0x53d386=0xce;}_0x3142e9[_0x79b8('0x1b')](_0x53d386);return _0x3142e9[_0x79b8('0x20')](_0x79b8('0x21'),_0x2ae2d5+'-'+_0x23d771+'/'+_0x24c02f)[_0x79b8('0x22')](_0x57a248);}return null;};}function patchUpdates(_0x1e24cf){return function(_0x1e7507){try{jsonpatch[_0x79b8('0x23')](_0x1e7507,_0x1e24cf,!![]);}catch(_0x261c48){return BPromise[_0x79b8('0x24')](_0x261c48);}return _0x1e7507['save']();};}function saveUpdates(_0x3e9d83,_0x255207){return function(_0x4dbfcf){if(_0x4dbfcf){return _0x4dbfcf[_0x79b8('0x25')](_0x3e9d83)[_0x79b8('0x26')](function(_0x54c605){return _0x54c605;});}return null;};}function removeEntity(_0x28be4b,_0x4f543f){return function(_0x5e8228){if(_0x5e8228){return _0x5e8228[_0x79b8('0x27')]()[_0x79b8('0x26')](function(){var _0x262b48=_0x5e8228[_0x79b8('0x28')]({'plain':!![]});var _0x9deb6c='Tags';return db[_0x79b8('0x29')][_0x79b8('0x27')]({'where':{'type':_0x9deb6c,'resourceId':_0x262b48['id']}})[_0x79b8('0x26')](function(){return _0x5e8228;});})[_0x79b8('0x26')](function(){_0x28be4b['status'](0xcc)[_0x79b8('0x1c')]();});}};}function handleEntityNotFound(_0x2b6fad,_0x14a4d6){return function(_0x4aa92c){if(!_0x4aa92c){_0x2b6fad[_0x79b8('0x1a')](0x194);}return _0x4aa92c;};}function handleError(_0x4a4ef6,_0x43058e){_0x43058e=_0x43058e||0x1f4;return function(_0x2942e9){logger[_0x79b8('0x2a')](_0x2942e9[_0x79b8('0x2b')]);if(_0x2942e9['name']){delete _0x2942e9[_0x79b8('0x2c')];}_0x4a4ef6['status'](_0x43058e)[_0x79b8('0x2d')](_0x2942e9);};}exports['index']=function(_0x3b6a05,_0x1090d2){var _0x300755={},_0x55c631={},_0x1e03c1={'count':0x0,'rows':[]};var _0xc2decd=_[_0x79b8('0x2e')](db[_0x79b8('0x2f')]['rawAttributes'],function(_0x4cb644){return{'name':_0x4cb644['fieldName'],'type':_0x4cb644['type'][_0x79b8('0x30')]};});_0x55c631[_0x79b8('0x31')]=_['map'](_0xc2decd,_0x79b8('0x2c'));_0x55c631['query']=_['keys'](_0x3b6a05[_0x79b8('0x32')]);_0x55c631['filters']=_[_0x79b8('0x33')](_0x55c631[_0x79b8('0x31')],_0x55c631['query']);_0x300755[_0x79b8('0x34')]=_[_0x79b8('0x33')](_0x55c631[_0x79b8('0x31')],qs[_0x79b8('0x35')](_0x3b6a05[_0x79b8('0x32')][_0x79b8('0x35')]));_0x300755['attributes']=_0x300755[_0x79b8('0x34')][_0x79b8('0x36')]?_0x300755[_0x79b8('0x34')]:_0x55c631[_0x79b8('0x31')];if(!_0x3b6a05[_0x79b8('0x32')][_0x79b8('0x37')](_0x79b8('0x38'))){_0x300755[_0x79b8('0x39')]=qs[_0x79b8('0x39')](_0x3b6a05[_0x79b8('0x32')][_0x79b8('0x39')]);_0x300755['offset']=qs[_0x79b8('0x1d')](_0x3b6a05[_0x79b8('0x32')][_0x79b8('0x1d')]);}_0x300755['order']=qs[_0x79b8('0x3a')](_0x3b6a05[_0x79b8('0x32')][_0x79b8('0x3a')]);_0x300755[_0x79b8('0x3b')]=qs[_0x79b8('0x3c')](_[_0x79b8('0x3d')](_0x3b6a05['query'],_0x55c631[_0x79b8('0x3c')]),_0xc2decd);if(_0x3b6a05['query']['filter']){_0x300755[_0x79b8('0x3b')]=_['merge'](_0x300755['where'],{'$or':_[_0x79b8('0x2e')](_0xc2decd,function(_0x1f211a){if(_0x1f211a[_0x79b8('0x3e')]!==_0x79b8('0x3f')){var _0x43d795={};_0x43d795[_0x1f211a[_0x79b8('0x2c')]]={'$like':'%'+_0x3b6a05[_0x79b8('0x32')][_0x79b8('0x40')]+'%'};return _0x43d795;}})});}_0x300755=_[_0x79b8('0x41')]({},_0x300755,_0x3b6a05[_0x79b8('0x42')]);var _0x10f8e1={'where':_0x300755[_0x79b8('0x3b')]};return db[_0x79b8('0x2f')]['count'](_0x10f8e1)[_0x79b8('0x26')](function(_0x13b041){_0x1e03c1['count']=_0x13b041;if(_0x3b6a05[_0x79b8('0x32')][_0x79b8('0x43')]){_0x300755['include']=[{'all':!![]}];}return db[_0x79b8('0x2f')][_0x79b8('0x44')](_0x300755);})[_0x79b8('0x26')](function(_0x28d4e4){_0x1e03c1[_0x79b8('0x45')]=_0x28d4e4;return _0x1e03c1;})[_0x79b8('0x26')](respondWithFilteredResult(_0x1090d2,_0x300755))[_0x79b8('0x46')](handleError(_0x1090d2,null));};exports[_0x79b8('0x47')]=function(_0xb10351,_0x37ca43){var _0x31a1c1={'raw':!![],'where':{'id':_0xb10351['params']['id']}},_0x379217={};_0x379217['model']=_[_0x79b8('0x48')](db[_0x79b8('0x2f')][_0x79b8('0x49')]);_0x379217[_0x79b8('0x32')]=_['keys'](_0xb10351[_0x79b8('0x32')]);_0x379217[_0x79b8('0x3c')]=_[_0x79b8('0x33')](_0x379217[_0x79b8('0x31')],_0x379217['query']);_0x31a1c1[_0x79b8('0x34')]=_[_0x79b8('0x33')](_0x379217[_0x79b8('0x31')],qs[_0x79b8('0x35')](_0xb10351['query'][_0x79b8('0x35')]));_0x31a1c1[_0x79b8('0x34')]=_0x31a1c1[_0x79b8('0x34')][_0x79b8('0x36')]?_0x31a1c1[_0x79b8('0x34')]:_0x379217[_0x79b8('0x31')];if(_0xb10351['query'][_0x79b8('0x43')]){_0x31a1c1[_0x79b8('0x4a')]=[{'all':!![]}];}_0x31a1c1=_[_0x79b8('0x41')]({},_0x31a1c1,_0xb10351[_0x79b8('0x42')]);return db['Tag']['find'](_0x31a1c1)[_0x79b8('0x26')](handleEntityNotFound(_0x37ca43,null))[_0x79b8('0x26')](respondWithResult(_0x37ca43,null))[_0x79b8('0x46')](handleError(_0x37ca43,null));};exports[_0x79b8('0x4b')]=function(_0x32e7ea,_0x19272d){return db[_0x79b8('0x2f')][_0x79b8('0x4b')](_0x32e7ea[_0x79b8('0x4c')],{})['then'](function(_0x19ad75){var _0x374fe9=_0x32e7ea[_0x79b8('0x4d')]['get']({'plain':!![]});if(!_0x374fe9)throw new Error(_0x79b8('0x4e'));if(_0x374fe9['role']==='user'){var _0x24ebb2=_0x19ad75[_0x79b8('0x28')]({'plain':!![]});var _0x5b4d56=_0x79b8('0x4f');return db['UserProfileSection']['find']({'where':{'name':_0x5b4d56,'userProfileId':_0x374fe9[_0x79b8('0x50')]},'raw':!![]})[_0x79b8('0x26')](function(_0x14f722){if(_0x14f722&&_0x14f722[_0x79b8('0x51')]===0x0){return db[_0x79b8('0x29')][_0x79b8('0x4b')]({'name':_0x24ebb2[_0x79b8('0x2c')],'resourceId':_0x24ebb2['id'],'type':_0x14f722[_0x79b8('0x2c')],'sectionId':_0x14f722['id']},{})[_0x79b8('0x26')](function(){return _0x19ad75;});}else{return _0x19ad75;}})[_0x79b8('0x46')](function(_0x2455c6){logger[_0x79b8('0x2a')](_0x79b8('0x52'),_0x2455c6);throw _0x2455c6;});}return _0x19ad75;})[_0x79b8('0x26')](respondWithResult(_0x19272d,0xc9))['catch'](handleError(_0x19272d,null));};exports[_0x79b8('0x25')]=function(_0x16f272,_0x2eb440){if(_0x16f272[_0x79b8('0x4c')]['id']){delete _0x16f272['body']['id'];}return db['Tag'][_0x79b8('0x53')]({'where':{'id':_0x16f272[_0x79b8('0x54')]['id']}})[_0x79b8('0x26')](handleEntityNotFound(_0x2eb440,null))[_0x79b8('0x26')](saveUpdates(_0x16f272['body'],null))[_0x79b8('0x26')](respondWithResult(_0x2eb440,null))[_0x79b8('0x46')](handleError(_0x2eb440,null));};exports['destroy']=function(_0x8e0f70,_0x43efcf){return db[_0x79b8('0x2f')]['find']({'where':{'id':_0x8e0f70[_0x79b8('0x54')]['id']}})['then'](handleEntityNotFound(_0x43efcf,null))[_0x79b8('0x26')](removeEntity(_0x43efcf,null))[_0x79b8('0x46')](handleError(_0x43efcf,null));}; \ No newline at end of file diff --git a/server/api/tag/tag.model.js b/server/api/tag/tag.model.js index a35fcb6..0401556 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 _0xb3bf=['bluebird','request-promise','rimraf','../../config/environment','./tag.attributes','exports','define','Tag','tools_tags','util','../../config/logger','moment'];(function(_0x525af9,_0x4edd23){var _0x129fbf=function(_0x4f44fe){while(--_0x4f44fe){_0x525af9['push'](_0x525af9['shift']());}};_0x129fbf(++_0x4edd23);}(_0xb3bf,0x135));var _0xfb3b=function(_0x57c9c7,_0xb70a91){_0x57c9c7=_0x57c9c7-0x0;var _0x48ad8b=_0xb3bf[_0x57c9c7];return _0x48ad8b;};'use strict';var _=require('lodash');var util=require(_0xfb3b('0x0'));var logger=require(_0xfb3b('0x1'))('api');var moment=require(_0xfb3b('0x2'));var BPromise=require(_0xfb3b('0x3'));var rp=require(_0xfb3b('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xfb3b('0x5'));var config=require(_0xfb3b('0x6'));var attributes=require(_0xfb3b('0x7'));module[_0xfb3b('0x8')]=function(_0x1046e8,_0x18cded){return _0x1046e8[_0xfb3b('0x9')](_0xfb3b('0xa'),attributes,{'tableName':_0xfb3b('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x522b=['rimraf','../../config/environment','./tag.attributes','exports','define','Tag','tools_tags','lodash','util','../../config/logger','api','moment','bluebird','path'];(function(_0x11affa,_0x2d362e){var _0x1fcf40=function(_0x3c174){while(--_0x3c174){_0x11affa['push'](_0x11affa['shift']());}};_0x1fcf40(++_0x2d362e);}(_0x522b,0xf5));var _0xb522=function(_0x2b2c53,_0x4bcf9b){_0x2b2c53=_0x2b2c53-0x0;var _0x311ec2=_0x522b[_0x2b2c53];return _0x311ec2;};'use strict';var _=require(_0xb522('0x0'));var util=require(_0xb522('0x1'));var logger=require(_0xb522('0x2'))(_0xb522('0x3'));var moment=require(_0xb522('0x4'));var BPromise=require(_0xb522('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb522('0x6'));var rimraf=require(_0xb522('0x7'));var config=require(_0xb522('0x8'));var attributes=require(_0xb522('0x9'));module[_0xb522('0xa')]=function(_0x4374fd,_0xebe4ea){return _0x4374fd[_0xb522('0xb')](_0xb522('0xc'),attributes,{'tableName':_0xb522('0xd'),'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 bb515b8..703500f 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 _0x6f7f=['randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','then','info','Tag,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','Tag,\x20%s,\x20%s','result','util','moment','bluebird'];(function(_0x9dfc10,_0x19c2d5){var _0x4f938a=function(_0x12b1e5){while(--_0x12b1e5){_0x9dfc10['push'](_0x9dfc10['shift']());}};_0x4f938a(++_0x19c2d5);}(_0x6f7f,0x177));var _0xf6f7=function(_0x1f5f53,_0x550746){_0x1f5f53=_0x1f5f53-0x0;var _0x5a382f=_0x6f7f[_0x1f5f53];return _0x5a382f;};'use strict';var _=require('lodash');var util=require(_0xf6f7('0x0'));var moment=require(_0xf6f7('0x1'));var BPromise=require(_0xf6f7('0x2'));var rs=require(_0xf6f7('0x3'));var fs=require('fs');var Redis=require(_0xf6f7('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xf6f7('0x5'));var logger=require('../../config/logger')(_0xf6f7('0x6'));var config=require(_0xf6f7('0x7'));var jayson=require(_0xf6f7('0x8'));var client=jayson['client'][_0xf6f7('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x543eb3,_0x33a2b2,_0x3c641f){return new BPromise(function(_0xe86f3a,_0x279ed7){return client[_0xf6f7('0xa')](_0x543eb3,_0x3c641f)[_0xf6f7('0xb')](function(_0x506617){logger[_0xf6f7('0xc')]('Tag,\x20%s,\x20%s',_0x33a2b2,'request\x20sent');logger['debug'](_0xf6f7('0xd'),_0x33a2b2,_0xf6f7('0xe'),JSON[_0xf6f7('0xf')](_0x506617));if(_0x506617[_0xf6f7('0x10')]){if(_0x506617[_0xf6f7('0x10')][_0xf6f7('0x11')]===0x1f4){logger['error']('Tag,\x20%s,\x20%s',_0x33a2b2,_0x506617[_0xf6f7('0x10')][_0xf6f7('0x12')]);return _0x279ed7(_0x506617[_0xf6f7('0x10')][_0xf6f7('0x12')]);}logger['error']('Tag,\x20%s,\x20%s',_0x33a2b2,_0x506617[_0xf6f7('0x10')]['message']);return _0xe86f3a(_0x506617[_0xf6f7('0x10')]['message']);}else{logger[_0xf6f7('0xc')](_0xf6f7('0x13'),_0x33a2b2,_0xf6f7('0xe'));_0xe86f3a(_0x506617[_0xf6f7('0x14')][_0xf6f7('0x12')]);}})['catch'](function(_0x42aa26){logger[_0xf6f7('0x10')]('Tag,\x20%s,\x20%s',_0x33a2b2,_0x42aa26);_0x279ed7(_0x42aa26);});});} \ No newline at end of file +var _0xdd0c=['error','code','message','result','catch','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','Tag,\x20%s,\x20%s','request\x20sent','debug','Tag,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x3198ac,_0x2f0549){var _0x4f3446=function(_0x9eeb64){while(--_0x9eeb64){_0x3198ac['push'](_0x3198ac['shift']());}};_0x4f3446(++_0x2f0549);}(_0xdd0c,0x165));var _0xcdd0=function(_0x5d3e85,_0xd6f856){_0x5d3e85=_0x5d3e85-0x0;var _0x32f592=_0xdd0c[_0x5d3e85];return _0x32f592;};'use strict';var _=require('lodash');var util=require(_0xcdd0('0x0'));var moment=require(_0xcdd0('0x1'));var BPromise=require(_0xcdd0('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xcdd0('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xcdd0('0x4'));var logger=require(_0xcdd0('0x5'))(_0xcdd0('0x6'));var config=require(_0xcdd0('0x7'));var jayson=require(_0xcdd0('0x8'));var client=jayson['client'][_0xcdd0('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1b6f5d,_0x1fd3f6,_0x15c402){return new BPromise(function(_0x337496,_0x557a65){return client[_0xcdd0('0xa')](_0x1b6f5d,_0x15c402)['then'](function(_0x5db720){logger[_0xcdd0('0xb')](_0xcdd0('0xc'),_0x1fd3f6,_0xcdd0('0xd'));logger[_0xcdd0('0xe')](_0xcdd0('0xf'),_0x1fd3f6,_0xcdd0('0xd'),JSON[_0xcdd0('0x10')](_0x5db720));if(_0x5db720[_0xcdd0('0x11')]){if(_0x5db720[_0xcdd0('0x11')][_0xcdd0('0x12')]===0x1f4){logger['error']('Tag,\x20%s,\x20%s',_0x1fd3f6,_0x5db720[_0xcdd0('0x11')][_0xcdd0('0x13')]);return _0x557a65(_0x5db720['error'][_0xcdd0('0x13')]);}logger[_0xcdd0('0x11')]('Tag,\x20%s,\x20%s',_0x1fd3f6,_0x5db720[_0xcdd0('0x11')][_0xcdd0('0x13')]);return _0x337496(_0x5db720[_0xcdd0('0x11')][_0xcdd0('0x13')]);}else{logger[_0xcdd0('0xb')]('Tag,\x20%s,\x20%s',_0x1fd3f6,'request\x20sent');_0x337496(_0x5db720[_0xcdd0('0x14')][_0xcdd0('0x13')]);}})[_0xcdd0('0x15')](function(_0xf7af04){logger[_0xcdd0('0x11')](_0xcdd0('0xc'),_0x1fd3f6,_0xf7af04);_0x557a65(_0xf7af04);});});} \ No newline at end of file diff --git a/server/api/team/index.js b/server/api/team/index.js index 70c8bf3..10d6f2a 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(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1c546c,_0x5c57cb){_0x1c546c=_0x1c546c-0x0;var _0x2cc384=_0xa9e0[_0x1c546c];return _0x2cc384;};'use strict';var 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(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5b561d,_0x422b7c){_0x5b561d=_0x5b561d-0x0;var _0x431060=_0xa9e0[_0x5b561d];return _0x431060;};'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 491b451..400434f 100644 --- a/server/api/team/team.attributes.js +++ b/server/api/team/team.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['exports','sequelize'];(function(_0x161dd8,_0x46b6bd){var _0x3c0857=function(_0xe23956){while(--_0xe23956){_0x161dd8['push'](_0x161dd8['shift']());}};_0x3c0857(++_0x46b6bd);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0x0d8b('0x0'));module[_0x0d8b('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'name'},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xb10b=['name','sequelize','STRING'];(function(_0x1fc7b9,_0x2b0ebb){var _0x2534a4=function(_0x54b5af){while(--_0x54b5af){_0x1fc7b9['push'](_0x1fc7b9['shift']());}};_0x2534a4(++_0x2b0ebb);}(_0xb10b,0x12a));var _0xbb10=function(_0x4a0ca9,_0x2f952c){_0x4a0ca9=_0x4a0ca9-0x0;var _0x355a37=_0xb10b[_0x4a0ca9];return _0x355a37;};'use strict';var Sequelize=require(_0xbb10('0x0'));module['exports']={'name':{'type':Sequelize[_0xbb10('0x1')],'allowNull':![],'unique':_0xbb10('0x2')},'description':{'type':Sequelize[_0xbb10('0x1')]}}; \ No newline at end of file diff --git a/server/api/team/team.controller.js b/server/api/team/team.controller.js index df4d983..a71736b 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 _0x99eb=['request-promise','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','crypto','desk.js','to-csv','querystring','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','./team.socket','register','sendStatus','status','end','json','offset','undefined','count','limit','Content-Range','apply','reject','save','update','then','error','stack','name','send','index','rawAttributes','type','key','query','keys','filters','attributes','intersection','model','fields','length','hasOwnProperty','order','sort','where','merge','map','VIRTUAL','options','Team','includeAll','include','findAll','rows','catch','show','params','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Teams','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','destroy','sequelize','transaction','SELECT\x20UserId\x20FROM\x20user_has_teams\x20WHERE\x20TeamId\x20=\x20','Sequelize','QueryTypes','SELECT','UserId','SELECT\x20VoiceQueueId\x20FROM\x20team_has_voice_queues\x20WHERE\x20TeamId\x20=\x20','VoiceQueueId','UserVoiceQueue','SELECT\x20MailQueueId\x20FROM\x20team_has_mail_queues\x20WHERE\x20TeamId\x20=\x20','MailQueueId','UserMailQueue','SELECT\x20SmsQueueId\x20FROM\x20team_has_sms_queues\x20WHERE\x20TeamId\x20=\x20','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','UserOpenchannelQueue','SELECT\x20WhatsappQueueId\x20FROM\x20team_has_whatsapp_queues\x20WHERE\x20TeamId\x20=\x20','UserWhatsappQueue','UserVoicePrefix','getQueues','findOne','channel','isValidChannel','ValidationError','capitalize','toLowerCase','Queue','pick','Queues','addQueues','Unknown\x20channel','add','ids','addAgents','Voice','Mail','Sms','Fax','Openchannel','Whatsapp','penalty','QueueId','TeamVoiceQueue','User','findOrCreate','emit','Queue:save','online','voicePause','interface','UserVoiceQueueRt','upsert','isNil','SIP/%s','all','TeamVoicePrefix','spread','removeAgents','isArray','getAgents','eml-format','zip-dir'];(function(_0x5beda5,_0x18199a){var _0x3d79ee=function(_0x4bfd5d){while(--_0x4bfd5d){_0x5beda5['push'](_0x5beda5['shift']());}};_0x3d79ee(++_0x18199a);}(_0x99eb,0x1d2));var _0xb99e=function(_0x1405e9,_0x23d988){_0x1405e9=_0x1405e9-0x0;var _0x124ed4=_0x99eb[_0x1405e9];return _0x124ed4;};'use strict';var emlformat=require(_0xb99e('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xb99e('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb99e('0x2'));var moment=require('moment');var BPromise=require(_0xb99e('0x3'));var Mustache=require(_0xb99e('0x4'));var util=require(_0xb99e('0x5'));var path=require(_0xb99e('0x6'));var sox=require(_0xb99e('0x7'));var csv=require('to-csv');var ejs=require(_0xb99e('0x8'));var fs=require('fs');var fs_extra=require(_0xb99e('0x9'));var _=require(_0xb99e('0xa'));var squel=require('squel');var crypto=require(_0xb99e('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xb99e('0xc'));var toCsv=require(_0xb99e('0xd'));var querystring=require(_0xb99e('0xe'));var Papa=require('papaparse');var Redis=require(_0xb99e('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xb99e('0x10'));var as=require(_0xb99e('0x11'));var hardwareService=require(_0xb99e('0x12'));var logger=require(_0xb99e('0x13'))(_0xb99e('0x14'));var utils=require(_0xb99e('0x15'));var config=require(_0xb99e('0x16'));var licenseUtil=require(_0xb99e('0x17'));var db=require(_0xb99e('0x18'))['db'];config[_0xb99e('0x19')]=_[_0xb99e('0x1a')](config['redis'],{'host':_0xb99e('0x1b'),'port':0x18eb});var socket=require(_0xb99e('0x1c'))(new Redis(config[_0xb99e('0x19')]));require(_0xb99e('0x1d'))[_0xb99e('0x1e')](socket);function respondWithStatusCode(_0x5e3966,_0x26a947){_0x26a947=_0x26a947||0xcc;return function(_0x37ab90){if(_0x37ab90){return _0x5e3966[_0xb99e('0x1f')](_0x26a947);}return _0x5e3966[_0xb99e('0x20')](_0x26a947)[_0xb99e('0x21')]();};}function respondWithResult(_0x2dff24,_0x121cfd){_0x121cfd=_0x121cfd||0xc8;return function(_0x5219e4){if(_0x5219e4){return _0x2dff24[_0xb99e('0x20')](_0x121cfd)[_0xb99e('0x22')](_0x5219e4);}};}function respondWithFilteredResult(_0x1dadbe,_0x1c8964){return function(_0x41cdf4){if(_0x41cdf4){var _0x144ca4=typeof _0x1c8964[_0xb99e('0x23')]===_0xb99e('0x24')&&typeof _0x1c8964['limit']===_0xb99e('0x24');var _0x2c6f9b=_0x41cdf4[_0xb99e('0x25')];var _0x2a9ab4=_0x144ca4?0x0:_0x1c8964[_0xb99e('0x23')];var _0x1b05be=_0x144ca4?_0x41cdf4[_0xb99e('0x25')]:_0x1c8964[_0xb99e('0x23')]+_0x1c8964[_0xb99e('0x26')];var _0x2149cc;if(_0x1b05be>=_0x2c6f9b){_0x1b05be=_0x2c6f9b;_0x2149cc=0xc8;}else{_0x2149cc=0xce;}_0x1dadbe[_0xb99e('0x20')](_0x2149cc);return _0x1dadbe['set'](_0xb99e('0x27'),_0x2a9ab4+'-'+_0x1b05be+'/'+_0x2c6f9b)[_0xb99e('0x22')](_0x41cdf4);}return null;};}function patchUpdates(_0x40295e){return function(_0x2ad9cd){try{jsonpatch[_0xb99e('0x28')](_0x2ad9cd,_0x40295e,!![]);}catch(_0x5293fc){return BPromise[_0xb99e('0x29')](_0x5293fc);}return _0x2ad9cd[_0xb99e('0x2a')]();};}function saveUpdates(_0x50aed1,_0x5f04e4){return function(_0x242827){if(_0x242827){return _0x242827[_0xb99e('0x2b')](_0x50aed1)[_0xb99e('0x2c')](function(_0x595a69){return _0x595a69;});}return null;};}function handleEntityNotFound(_0x449ffd,_0x467efd){return function(_0x1abc8e){if(!_0x1abc8e){_0x449ffd[_0xb99e('0x1f')](0x194);}return _0x1abc8e;};}function handleError(_0x2cefc4,_0x18001b){_0x18001b=_0x18001b||0x1f4;return function(_0x2a27a4){logger[_0xb99e('0x2d')](_0x2a27a4[_0xb99e('0x2e')]);if(_0x2a27a4['name']){delete _0x2a27a4[_0xb99e('0x2f')];}_0x2cefc4['status'](_0x18001b)[_0xb99e('0x30')](_0x2a27a4);};}exports[_0xb99e('0x31')]=function(_0x31e1fc,_0x45e440){var _0xd3f741={},_0x4b6449={},_0x395d77={'count':0x0,'rows':[]};var _0x2c5a42=_['map'](db['Team'][_0xb99e('0x32')],function(_0x4af254){return{'name':_0x4af254['fieldName'],'type':_0x4af254[_0xb99e('0x33')][_0xb99e('0x34')]};});_0x4b6449['model']=_['map'](_0x2c5a42,_0xb99e('0x2f'));_0x4b6449[_0xb99e('0x35')]=_[_0xb99e('0x36')](_0x31e1fc[_0xb99e('0x35')]);_0x4b6449[_0xb99e('0x37')]=_['intersection'](_0x4b6449['model'],_0x4b6449['query']);_0xd3f741[_0xb99e('0x38')]=_[_0xb99e('0x39')](_0x4b6449[_0xb99e('0x3a')],qs[_0xb99e('0x3b')](_0x31e1fc[_0xb99e('0x35')][_0xb99e('0x3b')]));_0xd3f741[_0xb99e('0x38')]=_0xd3f741[_0xb99e('0x38')][_0xb99e('0x3c')]?_0xd3f741[_0xb99e('0x38')]:_0x4b6449[_0xb99e('0x3a')];if(!_0x31e1fc[_0xb99e('0x35')][_0xb99e('0x3d')]('nolimit')){_0xd3f741[_0xb99e('0x26')]=qs[_0xb99e('0x26')](_0x31e1fc[_0xb99e('0x35')][_0xb99e('0x26')]);_0xd3f741[_0xb99e('0x23')]=qs[_0xb99e('0x23')](_0x31e1fc[_0xb99e('0x35')]['offset']);}_0xd3f741[_0xb99e('0x3e')]=qs[_0xb99e('0x3f')](_0x31e1fc[_0xb99e('0x35')][_0xb99e('0x3f')]);_0xd3f741[_0xb99e('0x40')]=qs[_0xb99e('0x37')](_['pick'](_0x31e1fc[_0xb99e('0x35')],_0x4b6449[_0xb99e('0x37')]),_0x2c5a42);if(_0x31e1fc[_0xb99e('0x35')]['filter']){_0xd3f741[_0xb99e('0x40')]=_[_0xb99e('0x41')](_0xd3f741[_0xb99e('0x40')],{'$or':_[_0xb99e('0x42')](_0x2c5a42,function(_0x4b73a5){if(_0x4b73a5[_0xb99e('0x33')]!==_0xb99e('0x43')){var _0x54d480={};_0x54d480[_0x4b73a5['name']]={'$like':'%'+_0x31e1fc[_0xb99e('0x35')]['filter']+'%'};return _0x54d480;}})});}_0xd3f741=_['merge']({},_0xd3f741,_0x31e1fc[_0xb99e('0x44')]);var _0x1666b1={'where':_0xd3f741[_0xb99e('0x40')]};return db[_0xb99e('0x45')][_0xb99e('0x25')](_0x1666b1)[_0xb99e('0x2c')](function(_0x178b91){_0x395d77[_0xb99e('0x25')]=_0x178b91;if(_0x31e1fc['query'][_0xb99e('0x46')]){_0xd3f741[_0xb99e('0x47')]=[{'all':!![]}];}return db[_0xb99e('0x45')][_0xb99e('0x48')](_0xd3f741);})[_0xb99e('0x2c')](function(_0x4ec646){_0x395d77[_0xb99e('0x49')]=_0x4ec646;return _0x395d77;})['then'](respondWithFilteredResult(_0x45e440,_0xd3f741))[_0xb99e('0x4a')](handleError(_0x45e440,null));};exports[_0xb99e('0x4b')]=function(_0x12a2ad,_0x5609f8){var _0x2b43e0={'raw':![],'where':{'id':_0x12a2ad[_0xb99e('0x4c')]['id']}},_0x2c0369={};_0x2c0369['model']=_['keys'](db['Team'][_0xb99e('0x32')]);_0x2c0369[_0xb99e('0x35')]=_[_0xb99e('0x36')](_0x12a2ad[_0xb99e('0x35')]);_0x2c0369[_0xb99e('0x37')]=_[_0xb99e('0x39')](_0x2c0369[_0xb99e('0x3a')],_0x2c0369[_0xb99e('0x35')]);_0x2b43e0[_0xb99e('0x38')]=_[_0xb99e('0x39')](_0x2c0369[_0xb99e('0x3a')],qs[_0xb99e('0x3b')](_0x12a2ad['query'][_0xb99e('0x3b')]));_0x2b43e0['attributes']=_0x2b43e0[_0xb99e('0x38')]['length']?_0x2b43e0[_0xb99e('0x38')]:_0x2c0369[_0xb99e('0x3a')];if(_0x12a2ad[_0xb99e('0x35')][_0xb99e('0x46')]){_0x2b43e0[_0xb99e('0x47')]=[{'all':!![]}];}_0x2b43e0=_[_0xb99e('0x41')]({},_0x2b43e0,_0x12a2ad[_0xb99e('0x44')]);return db[_0xb99e('0x45')][_0xb99e('0x4d')](_0x2b43e0)['then'](handleEntityNotFound(_0x5609f8,null))[_0xb99e('0x2c')](respondWithResult(_0x5609f8,null))[_0xb99e('0x4a')](handleError(_0x5609f8,null));};exports['create']=function(_0x375893,_0x57374c){return db['Team'][_0xb99e('0x4e')](_0x375893[_0xb99e('0x4f')],{})[_0xb99e('0x2c')](function(_0x2b3325){var _0x433caf=_0x375893[_0xb99e('0x50')][_0xb99e('0x51')]({'plain':!![]});if(!_0x433caf)throw new Error(_0xb99e('0x52'));if(_0x433caf[_0xb99e('0x53')]==='user'){var _0x17f652=_0x2b3325[_0xb99e('0x51')]({'plain':!![]});var _0x250fba=_0xb99e('0x54');return db['UserProfileSection']['find']({'where':{'name':_0x250fba,'userProfileId':_0x433caf[_0xb99e('0x55')]},'raw':!![]})[_0xb99e('0x2c')](function(_0x10b67c){if(_0x10b67c&&_0x10b67c[_0xb99e('0x56')]===0x0){return db[_0xb99e('0x57')][_0xb99e('0x4e')]({'name':_0x17f652[_0xb99e('0x2f')],'resourceId':_0x17f652['id'],'type':_0x10b67c['name'],'sectionId':_0x10b67c['id']},{})[_0xb99e('0x2c')](function(){return _0x2b3325;});}else{return _0x2b3325;}})[_0xb99e('0x4a')](function(_0x351ac6){logger[_0xb99e('0x2d')](_0xb99e('0x58'),_0x351ac6);throw _0x351ac6;});}return _0x2b3325;})['then'](respondWithResult(_0x57374c,0xc9))[_0xb99e('0x4a')](handleError(_0x57374c,null));};exports[_0xb99e('0x2b')]=function(_0x4df6ed,_0xafebfc){if(_0x4df6ed[_0xb99e('0x4f')]['id']){delete _0x4df6ed['body']['id'];}return db[_0xb99e('0x45')]['find']({'where':{'id':_0x4df6ed[_0xb99e('0x4c')]['id']}})[_0xb99e('0x2c')](handleEntityNotFound(_0xafebfc,null))[_0xb99e('0x2c')](saveUpdates(_0x4df6ed[_0xb99e('0x4f')],null))['then'](respondWithResult(_0xafebfc,null))['catch'](handleError(_0xafebfc,null));};exports[_0xb99e('0x59')]=function(_0x17eb6e,_0x2eed3c){var _0x55a323=_0x17eb6e['params']['id'];var _0x10aebe=[];return db[_0xb99e('0x5a')][_0xb99e('0x5b')](function(_0x2d1c42){var _0x416127=_0xb99e('0x5c')+_0x55a323;return db[_0xb99e('0x5a')]['query'](_0x416127,{'type':db[_0xb99e('0x5d')][_0xb99e('0x5e')][_0xb99e('0x5f')],'raw':!![],'transaction':_0x2d1c42})[_0xb99e('0x2c')](function(_0x49931c){_0x10aebe=_[_0xb99e('0x42')](_0x49931c,function(_0x30da45){return Number(_0x30da45[_0xb99e('0x60')]);});})[_0xb99e('0x2c')](function(){var _0x512948=_0xb99e('0x61')+_0x55a323;return db['sequelize']['query'](_0x512948,{'type':db[_0xb99e('0x5d')][_0xb99e('0x5e')][_0xb99e('0x5f')],'raw':!![],'transaction':_0x2d1c42});})[_0xb99e('0x2c')](function(_0x1156d7){var _0x407b6b=_[_0xb99e('0x42')](_0x1156d7,function(_0x2e3361){return Number(_0x2e3361[_0xb99e('0x62')]);});return db[_0xb99e('0x63')]['destroy']({'where':{'UserId':{'$in':_0x10aebe},'VoiceQueueId':{'$in':_0x407b6b}},'transaction':_0x2d1c42});})[_0xb99e('0x2c')](function(){var _0x1a2767=_0xb99e('0x64')+_0x55a323;return db[_0xb99e('0x5a')]['query'](_0x1a2767,{'type':db[_0xb99e('0x5d')][_0xb99e('0x5e')]['SELECT'],'raw':!![],'transaction':_0x2d1c42});})[_0xb99e('0x2c')](function(_0x399238){var _0x580619=_['map'](_0x399238,function(_0x26a05a){return Number(_0x26a05a[_0xb99e('0x65')]);});return db[_0xb99e('0x66')][_0xb99e('0x59')]({'where':{'UserId':{'$in':_0x10aebe},'MailQueueId':{'$in':_0x580619}},'transaction':_0x2d1c42});})[_0xb99e('0x2c')](function(){var _0x35ae46=_0xb99e('0x67')+_0x55a323;return db[_0xb99e('0x5a')]['query'](_0x35ae46,{'type':db['Sequelize'][_0xb99e('0x5e')][_0xb99e('0x5f')],'raw':!![],'transaction':_0x2d1c42});})[_0xb99e('0x2c')](function(_0x3ad59b){var _0x519ad4=_[_0xb99e('0x42')](_0x3ad59b,function(_0x4c2d0b){return Number(_0x4c2d0b[_0xb99e('0x68')]);});return db[_0xb99e('0x69')]['destroy']({'where':{'UserId':{'$in':_0x10aebe},'SmsQueueId':{'$in':_0x519ad4}},'transaction':_0x2d1c42});})[_0xb99e('0x2c')](function(){var _0x4b4694=_0xb99e('0x6a')+_0x55a323;return db[_0xb99e('0x5a')][_0xb99e('0x35')](_0x4b4694,{'type':db[_0xb99e('0x5d')][_0xb99e('0x5e')]['SELECT'],'raw':!![],'transaction':_0x2d1c42});})[_0xb99e('0x2c')](function(_0x3e4775){var _0x2775c9=_['map'](_0x3e4775,function(_0x1bf3e2){return Number(_0x1bf3e2['ChatQueueId']);});return db[_0xb99e('0x6b')][_0xb99e('0x59')]({'where':{'UserId':{'$in':_0x10aebe},'ChatQueueId':{'$in':_0x2775c9}},'transaction':_0x2d1c42});})[_0xb99e('0x2c')](function(){var _0x21accd=_0xb99e('0x6c')+_0x55a323;return db['sequelize'][_0xb99e('0x35')](_0x21accd,{'type':db[_0xb99e('0x5d')][_0xb99e('0x5e')][_0xb99e('0x5f')],'raw':!![],'transaction':_0x2d1c42});})[_0xb99e('0x2c')](function(_0x652f0e){var _0x2889ed=_[_0xb99e('0x42')](_0x652f0e,function(_0x2669c4){return Number(_0x2669c4['FaxQueueId']);});return db[_0xb99e('0x6d')][_0xb99e('0x59')]({'where':{'UserId':{'$in':_0x10aebe},'FaxQueueId':{'$in':_0x2889ed}},'transaction':_0x2d1c42});})[_0xb99e('0x2c')](function(){var _0xc1f687=_0xb99e('0x6e')+_0x55a323;return db[_0xb99e('0x5a')][_0xb99e('0x35')](_0xc1f687,{'type':db[_0xb99e('0x5d')][_0xb99e('0x5e')][_0xb99e('0x5f')],'raw':!![],'transaction':_0x2d1c42});})[_0xb99e('0x2c')](function(_0x2c7c19){var _0x3f36dd=_[_0xb99e('0x42')](_0x2c7c19,function(_0x432887){return Number(_0x432887['OpenchannelQueueId']);});return db[_0xb99e('0x6f')][_0xb99e('0x59')]({'where':{'UserId':{'$in':_0x10aebe},'OpenchannelQueueId':{'$in':_0x3f36dd}},'transaction':_0x2d1c42});})['then'](function(){var _0x451a80=_0xb99e('0x70')+_0x55a323;return db[_0xb99e('0x5a')][_0xb99e('0x35')](_0x451a80,{'type':db[_0xb99e('0x5d')][_0xb99e('0x5e')][_0xb99e('0x5f')],'raw':!![],'transaction':_0x2d1c42});})[_0xb99e('0x2c')](function(_0x111e90){var _0x1d6bc4=_['map'](_0x111e90,function(_0x13cf24){return Number(_0x13cf24['WhatsappQueueId']);});return db[_0xb99e('0x71')][_0xb99e('0x59')]({'where':{'UserId':{'$in':_0x10aebe},'WhatsappQueueId':{'$in':_0x1d6bc4}},'transaction':_0x2d1c42});})[_0xb99e('0x2c')](function(){return db['TeamVoicePrefix'][_0xb99e('0x4d')]({'where':{'TeamId':_0x55a323}});})[_0xb99e('0x2c')](function(_0x2fb31b){if(_0x2fb31b===null){return;}return db[_0xb99e('0x72')][_0xb99e('0x59')]({'where':{'UserId':{'$in':_0x10aebe},'VoicePrefixId':_0x2fb31b['VoicePrefixId']},'transaction':_0x2d1c42});})['then'](function(){return db[_0xb99e('0x45')]['destroy']({'where':{'id':_0x55a323},'cascade':!![],'transaction':_0x2d1c42});})[_0xb99e('0x2c')](function(_0x41bb24){if(_0x41bb24===0x0){_0x2eed3c[_0xb99e('0x1f')](0x194);}else{return db['UserProfileResource'][_0xb99e('0x59')]({'where':{'type':_0xb99e('0x54'),'resourceId':_0x55a323},'cascade':!![],'transaction':_0x2d1c42})[_0xb99e('0x2c')](function(){_0x2eed3c[_0xb99e('0x20')](0xcc)['end']();});}})[_0xb99e('0x4a')](function(_0x2f1cdf){_0x2eed3c['status'](0x1f4)[_0xb99e('0x30')](_0x2f1cdf);});});};exports[_0xb99e('0x73')]=function(_0x433e52,_0x4d54eb,_0x529ad6){return db[_0xb99e('0x45')][_0xb99e('0x74')]({'where':{'id':_0x433e52[_0xb99e('0x4c')]['id']}})[_0xb99e('0x2c')](handleEntityNotFound(_0x4d54eb,null))[_0xb99e('0x2c')](function(_0x2c3d91){if(!_0x433e52[_0xb99e('0x35')][_0xb99e('0x75')]||!utils[_0xb99e('0x76')](_0x433e52['query']['channel'])){throw new db[(_0xb99e('0x5d'))][(_0xb99e('0x77'))]('Unknown\x20channel');}var _0x581dba={};var _0x152add={};_0x152add['model']=_['keys'](db[_[_0xb99e('0x78')](_0x433e52[_0xb99e('0x35')]['channel'][_0xb99e('0x79')]())+_0xb99e('0x7a')]['rawAttributes']);_0x152add['query']=_[_0xb99e('0x36')](_0x433e52[_0xb99e('0x35')]);_0x152add['filters']=_[_0xb99e('0x39')](_0x152add[_0xb99e('0x3a')],_0x152add[_0xb99e('0x35')]);_0x581dba[_0xb99e('0x38')]=_[_0xb99e('0x39')](_0x152add['model'],qs[_0xb99e('0x3b')](_0x433e52[_0xb99e('0x35')]['fields']));_0x581dba['attributes']=_0x581dba[_0xb99e('0x38')][_0xb99e('0x3c')]?_0x581dba['attributes']:_0x152add['model'];_0x581dba[_0xb99e('0x26')]=qs[_0xb99e('0x26')](_0x433e52[_0xb99e('0x35')][_0xb99e('0x26')]);_0x581dba[_0xb99e('0x23')]=qs['offset'](_0x433e52[_0xb99e('0x35')]['offset']);_0x581dba[_0xb99e('0x3e')]=qs[_0xb99e('0x3f')](_0x433e52['query'][_0xb99e('0x3f')]);_0x581dba['where']=qs[_0xb99e('0x37')](_[_0xb99e('0x7b')](_0x433e52[_0xb99e('0x35')],_0x152add[_0xb99e('0x37')]));_0x581dba=_[_0xb99e('0x41')]({},_0x581dba,_0x433e52[_0xb99e('0x44')]);return _0x2c3d91[_0xb99e('0x51')+_[_0xb99e('0x78')](_0x433e52['query'][_0xb99e('0x75')][_0xb99e('0x79')]())+_0xb99e('0x7c')](_0x581dba);})[_0xb99e('0x2c')](respondWithResult(_0x4d54eb,null))['catch'](handleError(_0x4d54eb,null));};exports[_0xb99e('0x7d')]=function(_0x1d46f1,_0x33f20b,_0x280488){return db[_0xb99e('0x45')]['findOne']({'where':{'id':_0x1d46f1[_0xb99e('0x4c')]['id']}})[_0xb99e('0x2c')](function(_0xd8e3fd){if(_0xd8e3fd){if(!_0x1d46f1['body'][_0xb99e('0x75')]||!utils[_0xb99e('0x76')](_0x1d46f1[_0xb99e('0x4f')][_0xb99e('0x75')])){throw new db[(_0xb99e('0x5d'))][(_0xb99e('0x77'))](_0xb99e('0x7e'));}return _0xd8e3fd[_0xb99e('0x7f')+_[_0xb99e('0x78')](_0x1d46f1['body'][_0xb99e('0x75')][_0xb99e('0x79')]())+_0xb99e('0x7c')](_0x1d46f1[_0xb99e('0x4f')][_0xb99e('0x80')]);}return null;})[_0xb99e('0x2c')](handleEntityNotFound(_0x33f20b,null))[_0xb99e('0x2c')](respondWithStatusCode(_0x33f20b,null))[_0xb99e('0x4a')](handleError(_0x33f20b,null));};exports['removeQueues']=function(_0x4aaa6a,_0x242dda,_0x2d1a67){return db[_0xb99e('0x45')]['findOne']({'where':{'id':_0x4aaa6a[_0xb99e('0x4c')]['id']}})[_0xb99e('0x2c')](function(_0x58601e){if(_0x58601e){if(!_0x4aaa6a[_0xb99e('0x35')][_0xb99e('0x75')]||!utils[_0xb99e('0x76')](_0x4aaa6a['query'][_0xb99e('0x75')])){throw new db[(_0xb99e('0x5d'))]['ValidationError'](_0xb99e('0x7e'));}return _0x58601e['remove'+_[_0xb99e('0x78')](_0x4aaa6a['query'][_0xb99e('0x75')]['toLowerCase']())+_0xb99e('0x7c')](_0x4aaa6a[_0xb99e('0x35')][_0xb99e('0x80')]);}return null;})[_0xb99e('0x2c')](handleEntityNotFound(_0x242dda,null))[_0xb99e('0x2c')](respondWithStatusCode(_0x242dda,null))[_0xb99e('0x4a')](handleError(_0x242dda,null));};exports[_0xb99e('0x81')]=function(_0x4a6cbb,_0x110a01){var _0x324231=_['isArray'](_0x4a6cbb[_0xb99e('0x4f')]['ids'])?_0x4a6cbb[_0xb99e('0x4f')][_0xb99e('0x80')]:[_0x4a6cbb[_0xb99e('0x4f')][_0xb99e('0x80')]];var _0x523337=_0x4a6cbb[_0xb99e('0x4c')]['id'];return db[_0xb99e('0x45')][_0xb99e('0x4d')]({'where':{'id':_0x523337}})[_0xb99e('0x2c')](handleEntityNotFound(_0x110a01,null))[_0xb99e('0x2c')](function(_0x2ea99e){if(_0x2ea99e){var _0x2d66d6=[_0xb99e('0x82'),'Chat',_0xb99e('0x83'),_0xb99e('0x84'),_0xb99e('0x85'),_0xb99e('0x86'),_0xb99e('0x87')];return db[_0xb99e('0x5a')][_0xb99e('0x5b')](function(_0x3eeb3c){var _0x2e64d5=_[_0xb99e('0x42')](_0x2d66d6,function(_0x3c68b3){var _0x3a644e={'attributes':['id',_0xb99e('0x2f')]};if(_0x3c68b3==='Voice'){_0x3a644e['through']={'attributes':[_0xb99e('0x88')]};}return _0x2ea99e[_0xb99e('0x51')+_0x3c68b3+_0xb99e('0x7c')](_0x3a644e)[_0xb99e('0x2c')](function(_0x172ea9){var _0x35b16e=_[_0xb99e('0x42')](_0x172ea9,function(_0x42cd66){var _0x43a123=_[_0xb99e('0x42')](_0x324231,function(_0x85ef89){var _0x24eb74={'where':{'UserId':_0x85ef89,[_0x3c68b3+_0xb99e('0x89')]:_0x42cd66['id']},'transaction':_0x3eeb3c};if(_0x3c68b3===_0xb99e('0x82')){_0x24eb74[_0xb99e('0x1a')]={'penalty':_0x42cd66[_0xb99e('0x8a')][_0xb99e('0x88')]};}return db[_0xb99e('0x8b')+_0x3c68b3+_0xb99e('0x7a')][_0xb99e('0x8c')](_0x24eb74)[_0xb99e('0x2c')](function(){socket[_0xb99e('0x8d')](_0xb99e('0x50')+_0x3c68b3+_0xb99e('0x8e'),{'UserId':_0x85ef89,[_0x3c68b3+_0xb99e('0x89')]:_0x42cd66['id']});if(_0x3c68b3!==_0xb99e('0x82')){return;}return db[_0xb99e('0x8b')][_0xb99e('0x48')]({'where':{'id':_0x324231,'online':0x1},'attributes':['id',_0xb99e('0x2f'),_0xb99e('0x8f'),_0xb99e('0x90'),_0xb99e('0x91')],'raw':!![]})['then'](function(_0x2b0dc1){var _0x42313f=_[_0xb99e('0x42')](_0x2b0dc1,function(_0x209785){return db[_0xb99e('0x92')][_0xb99e('0x93')]({'membername':_0x209785[_0xb99e('0x2f')],'UserId':_0x209785['id'],'queue_name':_0x42cd66[_0xb99e('0x2f')],'VoiceQueueId':_0x42cd66['id'],'interface':_[_0xb99e('0x94')](_0x209785[_0xb99e('0x91')])?util['format'](_0xb99e('0x95'),_0x209785[_0xb99e('0x2f')]):_0x209785['interface'],'paused':_0x209785[_0xb99e('0x90')]||![],'penalty':_0x42cd66[_0xb99e('0x8a')][_0xb99e('0x88')]},{'transaction':_0x3eeb3c});});return Promise[_0xb99e('0x96')](_0x42313f);});});});return Promise['all'](_0x43a123);});return Promise['all'](_0x35b16e);})[_0xb99e('0x2c')](function(){return db[_0xb99e('0x97')][_0xb99e('0x74')]({'where':{'teamId':_0x523337}})['then'](function(_0x42395f){if(_0x42395f){var _0x4af5f3=_['map'](_0x324231,function(_0x4ef808){db['UserVoicePrefix']['upsert']({'UserId':_0x4ef808,'VoicePrefixId':_0x42395f['VoicePrefixId']});});return Promise[_0xb99e('0x96')](_0x4af5f3);}});});});return Promise[_0xb99e('0x96')](_0x2e64d5)['then'](function(){return _0x2ea99e['addAgents'](_0x324231,{'transaction':_0x3eeb3c})[_0xb99e('0x98')](function(_0x16b5ef){return _0x16b5ef;});});});}})[_0xb99e('0x2c')](respondWithResult(_0x110a01,null))['catch'](handleError(_0x110a01,null));};exports[_0xb99e('0x99')]=function(_0x24e30b,_0x175e1e){var _0x4efb5b=_[_0xb99e('0x9a')](_0x24e30b[_0xb99e('0x35')][_0xb99e('0x80')])?_0x24e30b[_0xb99e('0x35')][_0xb99e('0x80')]:[_0x24e30b[_0xb99e('0x35')][_0xb99e('0x80')]];var _0x1f3e6c=_0x24e30b[_0xb99e('0x4c')]['id'];return db['Team'][_0xb99e('0x4d')]({'where':{'id':_0x1f3e6c}})[_0xb99e('0x2c')](handleEntityNotFound(_0x175e1e,null))['then'](function(_0x36cb7d){if(_0x36cb7d){var _0x17e717=['Voice','Chat',_0xb99e('0x83'),_0xb99e('0x84'),_0xb99e('0x85'),_0xb99e('0x86'),'Whatsapp'];return db['sequelize']['transaction'](function(_0xee62a8){var _0x54e5b6=_['map'](_0x17e717,function(_0x23a27e){var _0x16773a={'attributes':['id','name']};return _0x36cb7d[_0xb99e('0x51')+_0x23a27e+'Queues'](_0x16773a)[_0xb99e('0x2c')](function(_0x5e004e){var _0x3a2966=_[_0xb99e('0x42')](_0x5e004e,function(_0x215903){return _0x215903[_0xb99e('0x99')](_0x4efb5b,{'transaction':_0xee62a8})[_0xb99e('0x2c')](function(){var _0x255340=_[_0xb99e('0x42')](_0x4efb5b,function(_0x5a113c){socket[_0xb99e('0x8d')](_0xb99e('0x50')+_0x23a27e+'Queue:remove',{'UserId':Number(_0x5a113c),[_0x23a27e+_0xb99e('0x89')]:_0x215903['id']});if(_0x23a27e!==_0xb99e('0x82')){return;}return db[_0xb99e('0x92')][_0xb99e('0x59')]({'where':{'VoiceQueueId':_0x215903['id'],'UserId':_0x5a113c},'transaction':_0xee62a8});});return Promise[_0xb99e('0x96')](_0x255340);});});return Promise[_0xb99e('0x96')](_0x3a2966);});});return Promise['all'](_0x54e5b6)[_0xb99e('0x2c')](function(){return _0x36cb7d['removeAgents'](_0x4efb5b,{'transaction':_0xee62a8});})[_0xb99e('0x2c')](function(){return db[_0xb99e('0x97')][_0xb99e('0x74')]({'where':{'teamId':_0x1f3e6c}})[_0xb99e('0x2c')](function(_0x230113){if(_0x230113){var _0x3d392e=_[_0xb99e('0x42')](_0x4efb5b,function(_0x43e031){db[_0xb99e('0x72')]['destroy']({'where':{'UserId':_0x43e031,'VoicePrefixId':_0x230113['VoicePrefixId']}});});return Promise[_0xb99e('0x96')](_0x3d392e);}});});});}})[_0xb99e('0x2c')](respondWithStatusCode(_0x175e1e,null))[_0xb99e('0x4a')](handleError(_0x175e1e,null));};exports[_0xb99e('0x9b')]=function(_0x20386b,_0x4abe6b,_0x257ebc){var _0x3c6a08={};var _0x499309={};var _0x1bfe9c;var _0x11f34a;return db['Team']['findOne']({'where':{'id':_0x20386b[_0xb99e('0x4c')]['id']}})['then'](handleEntityNotFound(_0x4abe6b,null))[_0xb99e('0x2c')](function(_0x10d533){if(_0x10d533){_0x1bfe9c=_0x10d533;_0x499309[_0xb99e('0x3a')]=_['keys'](db[_0xb99e('0x8b')][_0xb99e('0x32')]);_0x499309[_0xb99e('0x35')]=_[_0xb99e('0x36')](_0x20386b[_0xb99e('0x35')]);_0x499309['filters']=_[_0xb99e('0x39')](_0x499309[_0xb99e('0x3a')],_0x499309['query']);_0x3c6a08[_0xb99e('0x38')]=_[_0xb99e('0x39')](_0x499309[_0xb99e('0x3a')],qs[_0xb99e('0x3b')](_0x20386b[_0xb99e('0x35')]['fields']));_0x3c6a08[_0xb99e('0x38')]=_0x3c6a08[_0xb99e('0x38')][_0xb99e('0x3c')]?_0x3c6a08['attributes']:_0x499309['model'];_0x3c6a08[_0xb99e('0x3e')]=qs[_0xb99e('0x3f')](_0x20386b[_0xb99e('0x35')][_0xb99e('0x3f')]);_0x3c6a08[_0xb99e('0x40')]=qs[_0xb99e('0x37')](_[_0xb99e('0x7b')](_0x20386b[_0xb99e('0x35')],_0x499309[_0xb99e('0x37')]));if(_0x20386b[_0xb99e('0x35')]['filter']){_0x3c6a08[_0xb99e('0x40')]=_[_0xb99e('0x41')](_0x3c6a08[_0xb99e('0x40')],{'$or':_[_0xb99e('0x42')](_0x3c6a08[_0xb99e('0x38')],function(_0x9c6269){var _0x260572={};_0x260572[_0x9c6269]={'$like':'%'+_0x20386b['query']['filter']+'%'};return _0x260572;})});}_0x3c6a08=_[_0xb99e('0x41')]({},_0x3c6a08,_0x20386b[_0xb99e('0x44')]);return _0x1bfe9c[_0xb99e('0x9b')](_0x3c6a08);}})[_0xb99e('0x2c')](function(_0x1bf2aa){if(_0x1bf2aa){_0x11f34a=_0x1bf2aa[_0xb99e('0x3c')];if(!_0x20386b[_0xb99e('0x35')]['hasOwnProperty']('nolimit')){_0x3c6a08['limit']=qs[_0xb99e('0x26')](_0x20386b[_0xb99e('0x35')][_0xb99e('0x26')]);_0x3c6a08[_0xb99e('0x23')]=qs[_0xb99e('0x23')](_0x20386b[_0xb99e('0x35')][_0xb99e('0x23')]);}return _0x1bfe9c[_0xb99e('0x9b')](_0x3c6a08);}})[_0xb99e('0x2c')](function(_0x41b59e){if(_0x41b59e){return _0x41b59e?{'count':_0x11f34a,'rows':_0x41b59e}:null;}})[_0xb99e('0x2c')](respondWithResult(_0x4abe6b,null))[_0xb99e('0x4a')](handleError(_0x4abe6b,null));}; \ No newline at end of file +var _0x1bd0=['capitalize','toLowerCase','sort','pick','Queues','addQueues','add','ids','removeQueues','findOne','remove','addAgents','isArray','Voice','Chat','Openchannel','Whatsapp','through','penalty','QueueId','TeamVoiceQueue','Queue','findOrCreate','Queue:save','voicePause','UserVoiceQueueRt','upsert','interface','all','spread','Mail','Sms','removeAgents','emit','Queue:remove','getAgents','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','querystring','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','./team.socket','register','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','sendStatus','error','name','send','map','Team','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','where','filter','merge','includeAll','findAll','show','params','keys','length','include','options','find','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','Teams','UserProfileSection','userProfileId','UserProfileResource','catch','destroy','sequelize','transaction','Sequelize','QueryTypes','SELECT','SELECT\x20VoiceQueueId\x20FROM\x20team_has_voice_queues\x20WHERE\x20TeamId\x20=\x20','VoiceQueueId','UserVoiceQueue','SELECT\x20MailQueueId\x20FROM\x20team_has_mail_queues\x20WHERE\x20TeamId\x20=\x20','MailQueueId','UserMailQueue','SELECT\x20SmsQueueId\x20FROM\x20team_has_sms_queues\x20WHERE\x20TeamId\x20=\x20','SmsQueueId','UserSmsQueue','SELECT\x20ChatQueueId\x20FROM\x20team_has_chat_queues\x20WHERE\x20TeamId\x20=\x20','ChatQueueId','UserChatQueue','FaxQueueId','UserFaxQueue','SELECT\x20OpenchannelQueueId\x20FROM\x20team_has_openchannel_queues\x20WHERE\x20TeamId\x20=\x20','OpenchannelQueueId','UserOpenchannelQueue','WhatsappQueueId','UserWhatsappQueue','TeamVoicePrefix','UserVoicePrefix','VoicePrefixId','getQueues','isValidChannel','channel','ValidationError','Unknown\x20channel'];(function(_0x460ade,_0x2f7635){var _0x353f20=function(_0x4cbd6a){while(--_0x4cbd6a){_0x460ade['push'](_0x460ade['shift']());}};_0x353f20(++_0x2f7635);}(_0x1bd0,0xbd));var _0x01bd=function(_0x5e2590,_0x5a6d7d){_0x5e2590=_0x5e2590-0x0;var _0x17aea4=_0x1bd0[_0x5e2590];return _0x17aea4;};'use strict';var emlformat=require(_0x01bd('0x0'));var rimraf=require(_0x01bd('0x1'));var zipdir=require(_0x01bd('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x01bd('0x3'));var moment=require('moment');var BPromise=require(_0x01bd('0x4'));var Mustache=require(_0x01bd('0x5'));var util=require(_0x01bd('0x6'));var path=require(_0x01bd('0x7'));var sox=require(_0x01bd('0x8'));var csv=require(_0x01bd('0x9'));var ejs=require(_0x01bd('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x01bd('0xb'));var squel=require(_0x01bd('0xc'));var crypto=require('crypto');var jsforce=require(_0x01bd('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x01bd('0x9'));var querystring=require(_0x01bd('0xe'));var Papa=require('papaparse');var Redis=require(_0x01bd('0xf'));var authService=require(_0x01bd('0x10'));var qs=require(_0x01bd('0x11'));var as=require(_0x01bd('0x12'));var hardwareService=require(_0x01bd('0x13'));var logger=require(_0x01bd('0x14'))('api');var utils=require(_0x01bd('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x01bd('0x16'));var db=require('../../mysqldb')['db'];config[_0x01bd('0x17')]=_[_0x01bd('0x18')](config[_0x01bd('0x17')],{'host':_0x01bd('0x19'),'port':0x18eb});var socket=require(_0x01bd('0x1a'))(new Redis(config[_0x01bd('0x17')]));require(_0x01bd('0x1b'))[_0x01bd('0x1c')](socket);function respondWithStatusCode(_0x174da8,_0x4d2e11){_0x4d2e11=_0x4d2e11||0xcc;return function(_0x127630){if(_0x127630){return _0x174da8['sendStatus'](_0x4d2e11);}return _0x174da8[_0x01bd('0x1d')](_0x4d2e11)[_0x01bd('0x1e')]();};}function respondWithResult(_0x581e07,_0x36f17a){_0x36f17a=_0x36f17a||0xc8;return function(_0x49e21f){if(_0x49e21f){return _0x581e07[_0x01bd('0x1d')](_0x36f17a)[_0x01bd('0x1f')](_0x49e21f);}};}function respondWithFilteredResult(_0x3b265f,_0x1f2413){return function(_0x7f912f){if(_0x7f912f){var _0x3de8ed=typeof _0x1f2413[_0x01bd('0x20')]===_0x01bd('0x21')&&typeof _0x1f2413[_0x01bd('0x22')]===_0x01bd('0x21');var _0x37a36f=_0x7f912f['count'];var _0x1d8350=_0x3de8ed?0x0:_0x1f2413[_0x01bd('0x20')];var _0x146339=_0x3de8ed?_0x7f912f[_0x01bd('0x23')]:_0x1f2413[_0x01bd('0x20')]+_0x1f2413[_0x01bd('0x22')];var _0x3e8ad8;if(_0x146339>=_0x37a36f){_0x146339=_0x37a36f;_0x3e8ad8=0xc8;}else{_0x3e8ad8=0xce;}_0x3b265f[_0x01bd('0x1d')](_0x3e8ad8);return _0x3b265f['set'](_0x01bd('0x24'),_0x1d8350+'-'+_0x146339+'/'+_0x37a36f)[_0x01bd('0x1f')](_0x7f912f);}return null;};}function patchUpdates(_0x45c25e){return function(_0x3537b1){try{jsonpatch[_0x01bd('0x25')](_0x3537b1,_0x45c25e,!![]);}catch(_0x37ed72){return BPromise[_0x01bd('0x26')](_0x37ed72);}return _0x3537b1[_0x01bd('0x27')]();};}function saveUpdates(_0x1acbca,_0x1e457f){return function(_0x10c011){if(_0x10c011){return _0x10c011[_0x01bd('0x28')](_0x1acbca)[_0x01bd('0x29')](function(_0x35fd02){return _0x35fd02;});}return null;};}function handleEntityNotFound(_0x3d0882,_0x4d6d68){return function(_0x3c4491){if(!_0x3c4491){_0x3d0882[_0x01bd('0x2a')](0x194);}return _0x3c4491;};}function handleError(_0x1e89ee,_0x4c77b6){_0x4c77b6=_0x4c77b6||0x1f4;return function(_0x224997){logger[_0x01bd('0x2b')](_0x224997['stack']);if(_0x224997['name']){delete _0x224997[_0x01bd('0x2c')];}_0x1e89ee[_0x01bd('0x1d')](_0x4c77b6)[_0x01bd('0x2d')](_0x224997);};}exports['index']=function(_0x415985,_0x3fd457){var _0x44443a={},_0x11707a={},_0x1da76f={'count':0x0,'rows':[]};var _0x54f724=_[_0x01bd('0x2e')](db[_0x01bd('0x2f')][_0x01bd('0x30')],function(_0x2f390a){return{'name':_0x2f390a[_0x01bd('0x31')],'type':_0x2f390a[_0x01bd('0x32')][_0x01bd('0x33')]};});_0x11707a[_0x01bd('0x34')]=_[_0x01bd('0x2e')](_0x54f724,'name');_0x11707a[_0x01bd('0x35')]=_['keys'](_0x415985[_0x01bd('0x35')]);_0x11707a[_0x01bd('0x36')]=_[_0x01bd('0x37')](_0x11707a[_0x01bd('0x34')],_0x11707a[_0x01bd('0x35')]);_0x44443a[_0x01bd('0x38')]=_[_0x01bd('0x37')](_0x11707a[_0x01bd('0x34')],qs[_0x01bd('0x39')](_0x415985[_0x01bd('0x35')]['fields']));_0x44443a[_0x01bd('0x38')]=_0x44443a[_0x01bd('0x38')]['length']?_0x44443a[_0x01bd('0x38')]:_0x11707a['model'];if(!_0x415985[_0x01bd('0x35')][_0x01bd('0x3a')](_0x01bd('0x3b'))){_0x44443a[_0x01bd('0x22')]=qs[_0x01bd('0x22')](_0x415985[_0x01bd('0x35')][_0x01bd('0x22')]);_0x44443a[_0x01bd('0x20')]=qs[_0x01bd('0x20')](_0x415985[_0x01bd('0x35')][_0x01bd('0x20')]);}_0x44443a[_0x01bd('0x3c')]=qs['sort'](_0x415985[_0x01bd('0x35')]['sort']);_0x44443a[_0x01bd('0x3d')]=qs['filters'](_['pick'](_0x415985[_0x01bd('0x35')],_0x11707a['filters']),_0x54f724);if(_0x415985[_0x01bd('0x35')][_0x01bd('0x3e')]){_0x44443a[_0x01bd('0x3d')]=_['merge'](_0x44443a[_0x01bd('0x3d')],{'$or':_[_0x01bd('0x2e')](_0x54f724,function(_0x3878ad){if(_0x3878ad[_0x01bd('0x32')]!=='VIRTUAL'){var _0x22de7d={};_0x22de7d[_0x3878ad['name']]={'$like':'%'+_0x415985[_0x01bd('0x35')][_0x01bd('0x3e')]+'%'};return _0x22de7d;}})});}_0x44443a=_[_0x01bd('0x3f')]({},_0x44443a,_0x415985['options']);var _0x58a00a={'where':_0x44443a[_0x01bd('0x3d')]};return db['Team'][_0x01bd('0x23')](_0x58a00a)['then'](function(_0x1de9f5){_0x1da76f[_0x01bd('0x23')]=_0x1de9f5;if(_0x415985[_0x01bd('0x35')][_0x01bd('0x40')]){_0x44443a['include']=[{'all':!![]}];}return db[_0x01bd('0x2f')][_0x01bd('0x41')](_0x44443a);})['then'](function(_0x41d7fb){_0x1da76f['rows']=_0x41d7fb;return _0x1da76f;})[_0x01bd('0x29')](respondWithFilteredResult(_0x3fd457,_0x44443a))['catch'](handleError(_0x3fd457,null));};exports[_0x01bd('0x42')]=function(_0x4041ee,_0x47a25b){var _0x45d12d={'raw':![],'where':{'id':_0x4041ee[_0x01bd('0x43')]['id']}},_0x4ff269={};_0x4ff269[_0x01bd('0x34')]=_[_0x01bd('0x44')](db['Team'][_0x01bd('0x30')]);_0x4ff269[_0x01bd('0x35')]=_[_0x01bd('0x44')](_0x4041ee[_0x01bd('0x35')]);_0x4ff269[_0x01bd('0x36')]=_['intersection'](_0x4ff269[_0x01bd('0x34')],_0x4ff269[_0x01bd('0x35')]);_0x45d12d[_0x01bd('0x38')]=_[_0x01bd('0x37')](_0x4ff269[_0x01bd('0x34')],qs[_0x01bd('0x39')](_0x4041ee[_0x01bd('0x35')][_0x01bd('0x39')]));_0x45d12d[_0x01bd('0x38')]=_0x45d12d[_0x01bd('0x38')][_0x01bd('0x45')]?_0x45d12d['attributes']:_0x4ff269[_0x01bd('0x34')];if(_0x4041ee[_0x01bd('0x35')][_0x01bd('0x40')]){_0x45d12d[_0x01bd('0x46')]=[{'all':!![]}];}_0x45d12d=_[_0x01bd('0x3f')]({},_0x45d12d,_0x4041ee[_0x01bd('0x47')]);return db['Team'][_0x01bd('0x48')](_0x45d12d)[_0x01bd('0x29')](handleEntityNotFound(_0x47a25b,null))[_0x01bd('0x29')](respondWithResult(_0x47a25b,null))['catch'](handleError(_0x47a25b,null));};exports[_0x01bd('0x49')]=function(_0x532ff4,_0x161edb){return db['Team']['create'](_0x532ff4[_0x01bd('0x4a')],{})[_0x01bd('0x29')](function(_0x156a6d){var _0x53cac6=_0x532ff4['user'][_0x01bd('0x4b')]({'plain':!![]});if(!_0x53cac6)throw new Error(_0x01bd('0x4c'));if(_0x53cac6[_0x01bd('0x4d')]===_0x01bd('0x4e')){var _0x333a07=_0x156a6d[_0x01bd('0x4b')]({'plain':!![]});var _0x17d00e=_0x01bd('0x4f');return db[_0x01bd('0x50')][_0x01bd('0x48')]({'where':{'name':_0x17d00e,'userProfileId':_0x53cac6[_0x01bd('0x51')]},'raw':!![]})[_0x01bd('0x29')](function(_0x234810){if(_0x234810&&_0x234810['autoAssociation']===0x0){return db[_0x01bd('0x52')][_0x01bd('0x49')]({'name':_0x333a07[_0x01bd('0x2c')],'resourceId':_0x333a07['id'],'type':_0x234810[_0x01bd('0x2c')],'sectionId':_0x234810['id']},{})[_0x01bd('0x29')](function(){return _0x156a6d;});}else{return _0x156a6d;}})[_0x01bd('0x53')](function(_0x2232c7){logger[_0x01bd('0x2b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2232c7);throw _0x2232c7;});}return _0x156a6d;})[_0x01bd('0x29')](respondWithResult(_0x161edb,0xc9))['catch'](handleError(_0x161edb,null));};exports[_0x01bd('0x28')]=function(_0x1ada3d,_0x242cc8){if(_0x1ada3d[_0x01bd('0x4a')]['id']){delete _0x1ada3d[_0x01bd('0x4a')]['id'];}return db['Team'][_0x01bd('0x48')]({'where':{'id':_0x1ada3d[_0x01bd('0x43')]['id']}})[_0x01bd('0x29')](handleEntityNotFound(_0x242cc8,null))[_0x01bd('0x29')](saveUpdates(_0x1ada3d[_0x01bd('0x4a')],null))[_0x01bd('0x29')](respondWithResult(_0x242cc8,null))[_0x01bd('0x53')](handleError(_0x242cc8,null));};exports[_0x01bd('0x54')]=function(_0x326664,_0x817702){var _0x4461e2=_0x326664[_0x01bd('0x43')]['id'];var _0x53cfba=[];return db[_0x01bd('0x55')][_0x01bd('0x56')](function(_0x45614e){var _0x38ff72='SELECT\x20UserId\x20FROM\x20user_has_teams\x20WHERE\x20TeamId\x20=\x20'+_0x4461e2;return db[_0x01bd('0x55')]['query'](_0x38ff72,{'type':db[_0x01bd('0x57')][_0x01bd('0x58')][_0x01bd('0x59')],'raw':!![],'transaction':_0x45614e})[_0x01bd('0x29')](function(_0x14ce4d){_0x53cfba=_[_0x01bd('0x2e')](_0x14ce4d,function(_0x3d170d){return Number(_0x3d170d['UserId']);});})[_0x01bd('0x29')](function(){var _0x5811e9=_0x01bd('0x5a')+_0x4461e2;return db[_0x01bd('0x55')][_0x01bd('0x35')](_0x5811e9,{'type':db[_0x01bd('0x57')][_0x01bd('0x58')][_0x01bd('0x59')],'raw':!![],'transaction':_0x45614e});})[_0x01bd('0x29')](function(_0x2d3363){var _0x3cdc62=_[_0x01bd('0x2e')](_0x2d3363,function(_0x19f41d){return Number(_0x19f41d[_0x01bd('0x5b')]);});return db[_0x01bd('0x5c')][_0x01bd('0x54')]({'where':{'UserId':{'$in':_0x53cfba},'VoiceQueueId':{'$in':_0x3cdc62}},'transaction':_0x45614e});})['then'](function(){var _0xdbc109=_0x01bd('0x5d')+_0x4461e2;return db[_0x01bd('0x55')][_0x01bd('0x35')](_0xdbc109,{'type':db['Sequelize'][_0x01bd('0x58')][_0x01bd('0x59')],'raw':!![],'transaction':_0x45614e});})[_0x01bd('0x29')](function(_0xf6e0fb){var _0x433c2b=_[_0x01bd('0x2e')](_0xf6e0fb,function(_0x4daabd){return Number(_0x4daabd[_0x01bd('0x5e')]);});return db[_0x01bd('0x5f')][_0x01bd('0x54')]({'where':{'UserId':{'$in':_0x53cfba},'MailQueueId':{'$in':_0x433c2b}},'transaction':_0x45614e});})['then'](function(){var _0x8fdd86=_0x01bd('0x60')+_0x4461e2;return db['sequelize'][_0x01bd('0x35')](_0x8fdd86,{'type':db[_0x01bd('0x57')][_0x01bd('0x58')]['SELECT'],'raw':!![],'transaction':_0x45614e});})[_0x01bd('0x29')](function(_0x1f607d){var _0x44e81a=_[_0x01bd('0x2e')](_0x1f607d,function(_0x387495){return Number(_0x387495[_0x01bd('0x61')]);});return db[_0x01bd('0x62')][_0x01bd('0x54')]({'where':{'UserId':{'$in':_0x53cfba},'SmsQueueId':{'$in':_0x44e81a}},'transaction':_0x45614e});})['then'](function(){var _0x5ce937=_0x01bd('0x63')+_0x4461e2;return db['sequelize']['query'](_0x5ce937,{'type':db[_0x01bd('0x57')][_0x01bd('0x58')]['SELECT'],'raw':!![],'transaction':_0x45614e});})[_0x01bd('0x29')](function(_0x3ba091){var _0x3df1ea=_['map'](_0x3ba091,function(_0xd10443){return Number(_0xd10443[_0x01bd('0x64')]);});return db[_0x01bd('0x65')]['destroy']({'where':{'UserId':{'$in':_0x53cfba},'ChatQueueId':{'$in':_0x3df1ea}},'transaction':_0x45614e});})[_0x01bd('0x29')](function(){var _0x3df31c='SELECT\x20FaxQueueId\x20FROM\x20team_has_fax_queues\x20WHERE\x20TeamId\x20=\x20'+_0x4461e2;return db[_0x01bd('0x55')]['query'](_0x3df31c,{'type':db['Sequelize'][_0x01bd('0x58')][_0x01bd('0x59')],'raw':!![],'transaction':_0x45614e});})[_0x01bd('0x29')](function(_0x27d594){var _0x93300=_[_0x01bd('0x2e')](_0x27d594,function(_0x4cad86){return Number(_0x4cad86[_0x01bd('0x66')]);});return db[_0x01bd('0x67')]['destroy']({'where':{'UserId':{'$in':_0x53cfba},'FaxQueueId':{'$in':_0x93300}},'transaction':_0x45614e});})[_0x01bd('0x29')](function(){var _0x59da5e=_0x01bd('0x68')+_0x4461e2;return db[_0x01bd('0x55')][_0x01bd('0x35')](_0x59da5e,{'type':db[_0x01bd('0x57')]['QueryTypes'][_0x01bd('0x59')],'raw':!![],'transaction':_0x45614e});})[_0x01bd('0x29')](function(_0xb5c5d8){var _0x4aca39=_[_0x01bd('0x2e')](_0xb5c5d8,function(_0x3937a2){return Number(_0x3937a2[_0x01bd('0x69')]);});return db[_0x01bd('0x6a')][_0x01bd('0x54')]({'where':{'UserId':{'$in':_0x53cfba},'OpenchannelQueueId':{'$in':_0x4aca39}},'transaction':_0x45614e});})[_0x01bd('0x29')](function(){var _0x3cace3='SELECT\x20WhatsappQueueId\x20FROM\x20team_has_whatsapp_queues\x20WHERE\x20TeamId\x20=\x20'+_0x4461e2;return db[_0x01bd('0x55')]['query'](_0x3cace3,{'type':db[_0x01bd('0x57')][_0x01bd('0x58')][_0x01bd('0x59')],'raw':!![],'transaction':_0x45614e});})[_0x01bd('0x29')](function(_0x23710e){var _0x3141a8=_[_0x01bd('0x2e')](_0x23710e,function(_0x32e508){return Number(_0x32e508[_0x01bd('0x6b')]);});return db[_0x01bd('0x6c')]['destroy']({'where':{'UserId':{'$in':_0x53cfba},'WhatsappQueueId':{'$in':_0x3141a8}},'transaction':_0x45614e});})[_0x01bd('0x29')](function(){return db[_0x01bd('0x6d')][_0x01bd('0x48')]({'where':{'TeamId':_0x4461e2}});})[_0x01bd('0x29')](function(_0x47f934){if(_0x47f934===null){return;}return db[_0x01bd('0x6e')][_0x01bd('0x54')]({'where':{'UserId':{'$in':_0x53cfba},'VoicePrefixId':_0x47f934[_0x01bd('0x6f')]},'transaction':_0x45614e});})[_0x01bd('0x29')](function(){return db['Team'][_0x01bd('0x54')]({'where':{'id':_0x4461e2},'cascade':!![],'transaction':_0x45614e});})[_0x01bd('0x29')](function(_0xe0b9f9){if(_0xe0b9f9===0x0){_0x817702[_0x01bd('0x2a')](0x194);}else{return db[_0x01bd('0x52')]['destroy']({'where':{'type':_0x01bd('0x4f'),'resourceId':_0x4461e2},'cascade':!![],'transaction':_0x45614e})[_0x01bd('0x29')](function(){_0x817702[_0x01bd('0x1d')](0xcc)['end']();});}})['catch'](function(_0x47a4bd){_0x817702[_0x01bd('0x1d')](0x1f4)['send'](_0x47a4bd);});});};exports[_0x01bd('0x70')]=function(_0x19d682,_0x5582cc,_0x2ed418){return db[_0x01bd('0x2f')]['findOne']({'where':{'id':_0x19d682[_0x01bd('0x43')]['id']}})[_0x01bd('0x29')](handleEntityNotFound(_0x5582cc,null))[_0x01bd('0x29')](function(_0x5ba656){if(!_0x19d682[_0x01bd('0x35')]['channel']||!utils[_0x01bd('0x71')](_0x19d682[_0x01bd('0x35')][_0x01bd('0x72')])){throw new db[(_0x01bd('0x57'))][(_0x01bd('0x73'))](_0x01bd('0x74'));}var _0x561bde={};var _0x20f2d0={};_0x20f2d0[_0x01bd('0x34')]=_[_0x01bd('0x44')](db[_[_0x01bd('0x75')](_0x19d682[_0x01bd('0x35')][_0x01bd('0x72')][_0x01bd('0x76')]())+'Queue'][_0x01bd('0x30')]);_0x20f2d0[_0x01bd('0x35')]=_[_0x01bd('0x44')](_0x19d682[_0x01bd('0x35')]);_0x20f2d0[_0x01bd('0x36')]=_[_0x01bd('0x37')](_0x20f2d0[_0x01bd('0x34')],_0x20f2d0[_0x01bd('0x35')]);_0x561bde[_0x01bd('0x38')]=_[_0x01bd('0x37')](_0x20f2d0['model'],qs[_0x01bd('0x39')](_0x19d682[_0x01bd('0x35')][_0x01bd('0x39')]));_0x561bde[_0x01bd('0x38')]=_0x561bde[_0x01bd('0x38')][_0x01bd('0x45')]?_0x561bde['attributes']:_0x20f2d0['model'];_0x561bde[_0x01bd('0x22')]=qs[_0x01bd('0x22')](_0x19d682['query']['limit']);_0x561bde[_0x01bd('0x20')]=qs[_0x01bd('0x20')](_0x19d682[_0x01bd('0x35')]['offset']);_0x561bde[_0x01bd('0x3c')]=qs['sort'](_0x19d682[_0x01bd('0x35')][_0x01bd('0x77')]);_0x561bde[_0x01bd('0x3d')]=qs['filters'](_[_0x01bd('0x78')](_0x19d682[_0x01bd('0x35')],_0x20f2d0[_0x01bd('0x36')]));_0x561bde=_['merge']({},_0x561bde,_0x19d682[_0x01bd('0x47')]);return _0x5ba656[_0x01bd('0x4b')+_[_0x01bd('0x75')](_0x19d682[_0x01bd('0x35')]['channel'][_0x01bd('0x76')]())+_0x01bd('0x79')](_0x561bde);})[_0x01bd('0x29')](respondWithResult(_0x5582cc,null))['catch'](handleError(_0x5582cc,null));};exports[_0x01bd('0x7a')]=function(_0x261066,_0x5bcdc5,_0x615176){return db[_0x01bd('0x2f')]['findOne']({'where':{'id':_0x261066['params']['id']}})[_0x01bd('0x29')](function(_0x19bd72){if(_0x19bd72){if(!_0x261066[_0x01bd('0x4a')]['channel']||!utils['isValidChannel'](_0x261066['body'][_0x01bd('0x72')])){throw new db[(_0x01bd('0x57'))]['ValidationError']('Unknown\x20channel');}return _0x19bd72[_0x01bd('0x7b')+_['capitalize'](_0x261066['body']['channel'][_0x01bd('0x76')]())+_0x01bd('0x79')](_0x261066[_0x01bd('0x4a')][_0x01bd('0x7c')]);}return null;})['then'](handleEntityNotFound(_0x5bcdc5,null))[_0x01bd('0x29')](respondWithStatusCode(_0x5bcdc5,null))[_0x01bd('0x53')](handleError(_0x5bcdc5,null));};exports[_0x01bd('0x7d')]=function(_0x29631c,_0x5f1b24,_0x5e7242){return db[_0x01bd('0x2f')][_0x01bd('0x7e')]({'where':{'id':_0x29631c[_0x01bd('0x43')]['id']}})[_0x01bd('0x29')](function(_0x80576c){if(_0x80576c){if(!_0x29631c[_0x01bd('0x35')]['channel']||!utils[_0x01bd('0x71')](_0x29631c[_0x01bd('0x35')][_0x01bd('0x72')])){throw new db['Sequelize'][(_0x01bd('0x73'))](_0x01bd('0x74'));}return _0x80576c[_0x01bd('0x7f')+_[_0x01bd('0x75')](_0x29631c[_0x01bd('0x35')][_0x01bd('0x72')][_0x01bd('0x76')]())+_0x01bd('0x79')](_0x29631c[_0x01bd('0x35')][_0x01bd('0x7c')]);}return null;})[_0x01bd('0x29')](handleEntityNotFound(_0x5f1b24,null))[_0x01bd('0x29')](respondWithStatusCode(_0x5f1b24,null))[_0x01bd('0x53')](handleError(_0x5f1b24,null));};exports[_0x01bd('0x80')]=function(_0x3f9816,_0x51c31f){var _0xfe6ecc=_[_0x01bd('0x81')](_0x3f9816[_0x01bd('0x4a')][_0x01bd('0x7c')])?_0x3f9816[_0x01bd('0x4a')][_0x01bd('0x7c')]:[_0x3f9816[_0x01bd('0x4a')][_0x01bd('0x7c')]];var _0x51e343=_0x3f9816['params']['id'];return db[_0x01bd('0x2f')][_0x01bd('0x48')]({'where':{'id':_0x51e343}})['then'](handleEntityNotFound(_0x51c31f,null))[_0x01bd('0x29')](function(_0x21787b){if(_0x21787b){var _0x5224a6=[_0x01bd('0x82'),_0x01bd('0x83'),'Mail','Sms','Fax',_0x01bd('0x84'),_0x01bd('0x85')];return db[_0x01bd('0x55')][_0x01bd('0x56')](function(_0x579e52){var _0x53eeb0=_[_0x01bd('0x2e')](_0x5224a6,function(_0x337af3){var _0x38e3bc={'attributes':['id',_0x01bd('0x2c')]};if(_0x337af3==='Voice'){_0x38e3bc[_0x01bd('0x86')]={'attributes':[_0x01bd('0x87')]};}return _0x21787b['get'+_0x337af3+'Queues'](_0x38e3bc)[_0x01bd('0x29')](function(_0x3d0455){var _0xd30175=_[_0x01bd('0x2e')](_0x3d0455,function(_0x261368){var _0xda91a1=_[_0x01bd('0x2e')](_0xfe6ecc,function(_0x36c46d){var _0x4a2abc={'where':{'UserId':_0x36c46d,[_0x337af3+_0x01bd('0x88')]:_0x261368['id']},'transaction':_0x579e52};if(_0x337af3===_0x01bd('0x82')){_0x4a2abc[_0x01bd('0x18')]={'penalty':_0x261368[_0x01bd('0x89')][_0x01bd('0x87')]};}return db['User'+_0x337af3+_0x01bd('0x8a')][_0x01bd('0x8b')](_0x4a2abc)[_0x01bd('0x29')](function(){socket['emit'](_0x01bd('0x4e')+_0x337af3+_0x01bd('0x8c'),{'UserId':_0x36c46d,[_0x337af3+'QueueId']:_0x261368['id']});if(_0x337af3!==_0x01bd('0x82')){return;}return db['User']['findAll']({'where':{'id':_0xfe6ecc,'online':0x1},'attributes':['id','name','online',_0x01bd('0x8d'),'interface'],'raw':!![]})[_0x01bd('0x29')](function(_0x247816){var _0x8b9ea0=_[_0x01bd('0x2e')](_0x247816,function(_0x293750){return db[_0x01bd('0x8e')][_0x01bd('0x8f')]({'membername':_0x293750['name'],'UserId':_0x293750['id'],'queue_name':_0x261368[_0x01bd('0x2c')],'VoiceQueueId':_0x261368['id'],'interface':_['isNil'](_0x293750[_0x01bd('0x90')])?util['format']('SIP/%s',_0x293750[_0x01bd('0x2c')]):_0x293750[_0x01bd('0x90')],'paused':_0x293750[_0x01bd('0x8d')]||![],'penalty':_0x261368[_0x01bd('0x89')]['penalty']},{'transaction':_0x579e52});});return Promise[_0x01bd('0x91')](_0x8b9ea0);});});});return Promise[_0x01bd('0x91')](_0xda91a1);});return Promise[_0x01bd('0x91')](_0xd30175);})[_0x01bd('0x29')](function(){return db[_0x01bd('0x6d')][_0x01bd('0x7e')]({'where':{'teamId':_0x51e343}})['then'](function(_0x4cec44){if(_0x4cec44){var _0x3ddfb7=_['map'](_0xfe6ecc,function(_0x31ff40){db['UserVoicePrefix'][_0x01bd('0x8f')]({'UserId':_0x31ff40,'VoicePrefixId':_0x4cec44['VoicePrefixId']});});return Promise['all'](_0x3ddfb7);}});});});return Promise[_0x01bd('0x91')](_0x53eeb0)[_0x01bd('0x29')](function(){return _0x21787b['addAgents'](_0xfe6ecc,{'transaction':_0x579e52})[_0x01bd('0x92')](function(_0xf8f0e){return _0xf8f0e;});});});}})[_0x01bd('0x29')](respondWithResult(_0x51c31f,null))[_0x01bd('0x53')](handleError(_0x51c31f,null));};exports['removeAgents']=function(_0x2f260e,_0x348b5c){var _0x2990c9=_[_0x01bd('0x81')](_0x2f260e[_0x01bd('0x35')][_0x01bd('0x7c')])?_0x2f260e[_0x01bd('0x35')][_0x01bd('0x7c')]:[_0x2f260e[_0x01bd('0x35')][_0x01bd('0x7c')]];var _0x591b6a=_0x2f260e['params']['id'];return db[_0x01bd('0x2f')][_0x01bd('0x48')]({'where':{'id':_0x591b6a}})[_0x01bd('0x29')](handleEntityNotFound(_0x348b5c,null))[_0x01bd('0x29')](function(_0x5195d4){if(_0x5195d4){var _0x5ed4e9=[_0x01bd('0x82'),'Chat',_0x01bd('0x93'),_0x01bd('0x94'),'Fax',_0x01bd('0x84'),_0x01bd('0x85')];return db['sequelize']['transaction'](function(_0x508b1b){var _0x209737=_[_0x01bd('0x2e')](_0x5ed4e9,function(_0x1a33ed){var _0xa2574a={'attributes':['id',_0x01bd('0x2c')]};return _0x5195d4[_0x01bd('0x4b')+_0x1a33ed+_0x01bd('0x79')](_0xa2574a)[_0x01bd('0x29')](function(_0x50484a){var _0x52d928=_[_0x01bd('0x2e')](_0x50484a,function(_0x4ad865){return _0x4ad865[_0x01bd('0x95')](_0x2990c9,{'transaction':_0x508b1b})[_0x01bd('0x29')](function(){var _0x5a26e7=_[_0x01bd('0x2e')](_0x2990c9,function(_0x181788){socket[_0x01bd('0x96')](_0x01bd('0x4e')+_0x1a33ed+_0x01bd('0x97'),{'UserId':Number(_0x181788),[_0x1a33ed+_0x01bd('0x88')]:_0x4ad865['id']});if(_0x1a33ed!==_0x01bd('0x82')){return;}return db[_0x01bd('0x8e')]['destroy']({'where':{'VoiceQueueId':_0x4ad865['id'],'UserId':_0x181788},'transaction':_0x508b1b});});return Promise[_0x01bd('0x91')](_0x5a26e7);});});return Promise['all'](_0x52d928);});});return Promise[_0x01bd('0x91')](_0x209737)[_0x01bd('0x29')](function(){return _0x5195d4['removeAgents'](_0x2990c9,{'transaction':_0x508b1b});})['then'](function(){return db[_0x01bd('0x6d')]['findOne']({'where':{'teamId':_0x591b6a}})[_0x01bd('0x29')](function(_0x2f6e22){if(_0x2f6e22){var _0x4ffc2e=_[_0x01bd('0x2e')](_0x2990c9,function(_0x11c805){db[_0x01bd('0x6e')][_0x01bd('0x54')]({'where':{'UserId':_0x11c805,'VoicePrefixId':_0x2f6e22['VoicePrefixId']}});});return Promise[_0x01bd('0x91')](_0x4ffc2e);}});});});}})[_0x01bd('0x29')](respondWithStatusCode(_0x348b5c,null))[_0x01bd('0x53')](handleError(_0x348b5c,null));};exports[_0x01bd('0x98')]=function(_0x42a77e,_0x52ecb9,_0x35d574){var _0x4d5c92={};var _0x412324={};var _0x3a1bfd;var _0xbb4f20;return db['Team'][_0x01bd('0x7e')]({'where':{'id':_0x42a77e['params']['id']}})[_0x01bd('0x29')](handleEntityNotFound(_0x52ecb9,null))['then'](function(_0x480b28){if(_0x480b28){_0x3a1bfd=_0x480b28;_0x412324[_0x01bd('0x34')]=_[_0x01bd('0x44')](db['User'][_0x01bd('0x30')]);_0x412324[_0x01bd('0x35')]=_['keys'](_0x42a77e[_0x01bd('0x35')]);_0x412324['filters']=_[_0x01bd('0x37')](_0x412324['model'],_0x412324['query']);_0x4d5c92[_0x01bd('0x38')]=_[_0x01bd('0x37')](_0x412324[_0x01bd('0x34')],qs['fields'](_0x42a77e[_0x01bd('0x35')][_0x01bd('0x39')]));_0x4d5c92[_0x01bd('0x38')]=_0x4d5c92[_0x01bd('0x38')]['length']?_0x4d5c92[_0x01bd('0x38')]:_0x412324[_0x01bd('0x34')];_0x4d5c92[_0x01bd('0x3c')]=qs[_0x01bd('0x77')](_0x42a77e['query'][_0x01bd('0x77')]);_0x4d5c92[_0x01bd('0x3d')]=qs[_0x01bd('0x36')](_[_0x01bd('0x78')](_0x42a77e['query'],_0x412324[_0x01bd('0x36')]));if(_0x42a77e['query'][_0x01bd('0x3e')]){_0x4d5c92[_0x01bd('0x3d')]=_['merge'](_0x4d5c92[_0x01bd('0x3d')],{'$or':_[_0x01bd('0x2e')](_0x4d5c92[_0x01bd('0x38')],function(_0x2c5a48){var _0x20eb0f={};_0x20eb0f[_0x2c5a48]={'$like':'%'+_0x42a77e['query'][_0x01bd('0x3e')]+'%'};return _0x20eb0f;})});}_0x4d5c92=_[_0x01bd('0x3f')]({},_0x4d5c92,_0x42a77e['options']);return _0x3a1bfd[_0x01bd('0x98')](_0x4d5c92);}})[_0x01bd('0x29')](function(_0x2b0ccd){if(_0x2b0ccd){_0xbb4f20=_0x2b0ccd[_0x01bd('0x45')];if(!_0x42a77e[_0x01bd('0x35')][_0x01bd('0x3a')](_0x01bd('0x3b'))){_0x4d5c92['limit']=qs[_0x01bd('0x22')](_0x42a77e['query'][_0x01bd('0x22')]);_0x4d5c92[_0x01bd('0x20')]=qs[_0x01bd('0x20')](_0x42a77e[_0x01bd('0x35')]['offset']);}return _0x3a1bfd[_0x01bd('0x98')](_0x4d5c92);}})[_0x01bd('0x29')](function(_0xc0712e){if(_0xc0712e){return _0xc0712e?{'count':_0xbb4f20,'rows':_0xc0712e}:null;}})['then'](respondWithResult(_0x52ecb9,null))[_0x01bd('0x53')](handleError(_0x52ecb9,null));}; \ No newline at end of file diff --git a/server/api/team/team.events.js b/server/api/team/team.events.js index 78b4e07..0498358 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 _0xd633=['Team','save','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x5d7696,_0x185685){var _0x39297c=function(_0x3bfb53){while(--_0x3bfb53){_0x5d7696['push'](_0x5d7696['shift']());}};_0x39297c(++_0x185685);}(_0xd633,0xb2));var _0x3d63=function(_0x241dca,_0x397ba1){_0x241dca=_0x241dca-0x0;var _0xb7bb8b=_0xd633[_0x241dca];return _0xb7bb8b;};'use strict';var EventEmitter=require(_0x3d63('0x0'));var Team=require(_0x3d63('0x1'))['db'][_0x3d63('0x2')];var TeamEvents=new EventEmitter();TeamEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x3d63('0x3'),'afterUpdate':'update','afterDestroy':_0x3d63('0x4')};function emitEvent(_0x1880c3){return function(_0x571a1f,_0x32096a,_0x2b3eb8){TeamEvents[_0x3d63('0x5')](_0x1880c3+':'+_0x571a1f['id'],_0x571a1f);TeamEvents['emit'](_0x1880c3,_0x571a1f);_0x2b3eb8(null);};}for(var e in events){if(events[_0x3d63('0x6')](e)){var event=events[e];Team[_0x3d63('0x7')](e,emitEvent(event));}}module[_0x3d63('0x8')]=TeamEvents; \ No newline at end of file +var _0x454c=['setMaxListeners','save','update','remove','emit','hasOwnProperty','../../mysqldb','Team'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x454c,0x136));var _0xc454=function(_0x1780f8,_0x11ba93){_0x1780f8=_0x1780f8-0x0;var _0x33a410=_0x454c[_0x1780f8];return _0x33a410;};'use strict';var EventEmitter=require('events');var Team=require(_0xc454('0x0'))['db'][_0xc454('0x1')];var TeamEvents=new EventEmitter();TeamEvents[_0xc454('0x2')](0x0);var events={'afterCreate':_0xc454('0x3'),'afterUpdate':_0xc454('0x4'),'afterDestroy':_0xc454('0x5')};function emitEvent(_0x3dfb5c){return function(_0x53b356,_0x3fb901,_0x237f40){TeamEvents[_0xc454('0x6')](_0x3dfb5c+':'+_0x53b356['id'],_0x53b356);TeamEvents[_0xc454('0x6')](_0x3dfb5c,_0x53b356);_0x237f40(null);};}for(var e in events){if(events[_0xc454('0x7')](e)){var event=events[e];Team['hook'](e,emitEvent(event));}}module['exports']=TeamEvents; \ No newline at end of file diff --git a/server/api/team/team.model.js b/server/api/team/team.model.js index cdc4365..928ec4d 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 _0x7ee4=['resolve','then','lodash','./team.attributes','get','map','setDataValue','channel','catch','exports','define','Team','teams','Chat','Fax','Mail','Openchannel','Voice','Whatsapp'];(function(_0x37bd26,_0x5ad346){var _0xe83dc4=function(_0x1ac229){while(--_0x1ac229){_0x37bd26['push'](_0x37bd26['shift']());}};_0xe83dc4(++_0x5ad346);}(_0x7ee4,0x87));var _0x47ee=function(_0xd9ab80,_0x1f1968){_0xd9ab80=_0xd9ab80-0x0;var _0x559fc7=_0x7ee4[_0xd9ab80];return _0x559fc7;};'use strict';var _=require(_0x47ee('0x0'));var attributes=require(_0x47ee('0x1'));function getQueuesByChannel(_0x9a4c6c,_0x2d3a97){var _0x763629=_0x47ee('0x2')+_0x2d3a97+'Queues';return _0x9a4c6c[_0x763629]()['then'](function(_0x55d3ae){return _[_0x47ee('0x3')](_0x55d3ae,function(_0x506434){_0x506434[_0x47ee('0x4')](_0x47ee('0x5'),_0x2d3a97);return _0x506434;});})[_0x47ee('0x6')](function(_0x5dcfca){throw _0x5dcfca;});}module[_0x47ee('0x7')]=function(_0x4cb6e8){return _0x4cb6e8[_0x47ee('0x8')](_0x47ee('0x9'),attributes,{'tableName':_0x47ee('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getAssociatedQueues':function(){var _0x57268c=this;var _0x383cc3=[_0x47ee('0xb'),_0x47ee('0xc'),_0x47ee('0xd'),_0x47ee('0xe'),'Sms',_0x47ee('0xf'),_0x47ee('0x10')];return Promise[_0x47ee('0x11')]()[_0x47ee('0x12')](function(){var _0x1d4187=_['map'](_0x383cc3,function(_0x9a4b09){return getQueuesByChannel(_0x57268c,_0x9a4b09);});return Promise['all'](_0x1d4187);})['catch'](function(_0x567a62){throw _0x567a62;});}}});}; \ No newline at end of file +var _0x5088=['Whatsapp','resolve','map','all','lodash','./team.attributes','get','Queues','then','setDataValue','catch','define','Team','Chat','Mail'];(function(_0x188691,_0x315a01){var _0x57543a=function(_0x4fccc5){while(--_0x4fccc5){_0x188691['push'](_0x188691['shift']());}};_0x57543a(++_0x315a01);}(_0x5088,0x7c));var _0x8508=function(_0xdb0cc5,_0x33653a){_0xdb0cc5=_0xdb0cc5-0x0;var _0x153aa=_0x5088[_0xdb0cc5];return _0x153aa;};'use strict';var _=require(_0x8508('0x0'));var attributes=require(_0x8508('0x1'));function getQueuesByChannel(_0x4c7611,_0x3e8517){var _0x1dda18=_0x8508('0x2')+_0x3e8517+_0x8508('0x3');return _0x4c7611[_0x1dda18]()[_0x8508('0x4')](function(_0x57cbdd){return _['map'](_0x57cbdd,function(_0x314e8f){_0x314e8f[_0x8508('0x5')]('channel',_0x3e8517);return _0x314e8f;});})[_0x8508('0x6')](function(_0x28e14b){throw _0x28e14b;});}module['exports']=function(_0x41b1a9){return _0x41b1a9[_0x8508('0x7')](_0x8508('0x8'),attributes,{'tableName':'teams','paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getAssociatedQueues':function(){var _0xa0353a=this;var _0x548a20=[_0x8508('0x9'),'Fax',_0x8508('0xa'),'Openchannel','Sms','Voice',_0x8508('0xb')];return Promise[_0x8508('0xc')]()['then'](function(){var _0x5e2471=_[_0x8508('0xd')](_0x548a20,function(_0x38b40c){return getQueuesByChannel(_0xa0353a,_0x38b40c);});return Promise[_0x8508('0xe')](_0x5e2471);})[_0x8508('0x6')](function(_0x4f9c32){throw _0x4f9c32;});}}});}; \ No newline at end of file diff --git a/server/api/team/team.rpc.js b/server/api/team/team.rpc.js index c228a95..921ec3b 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 _0x01a5=['message','request\x20sent','catch','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./team.socket','request','then','info','Team,\x20%s,\x20%s','debug','Team,\x20%s,\x20%s,\x20%s','error','code'];(function(_0x32e477,_0x4843d0){var _0x4e2533=function(_0x52d3fe){while(--_0x52d3fe){_0x32e477['push'](_0x32e477['shift']());}};_0x4e2533(++_0x4843d0);}(_0x01a5,0x162));var _0x501a=function(_0x83649,_0x2fc6fe){_0x83649=_0x83649-0x0;var _0x1db702=_0x01a5[_0x83649];return _0x1db702;};'use strict';var _=require(_0x501a('0x0'));var util=require(_0x501a('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x501a('0x2'));var fs=require('fs');var Redis=require(_0x501a('0x3'));var db=require(_0x501a('0x4'))['db'];var utils=require(_0x501a('0x5'));var logger=require(_0x501a('0x6'))(_0x501a('0x7'));var config=require(_0x501a('0x8'));var jayson=require(_0x501a('0x9'));var client=jayson['client'][_0x501a('0xa')]({'port':0x232a});config[_0x501a('0xb')]=_[_0x501a('0xc')](config['redis'],{'host':_0x501a('0xd'),'port':0x18eb});var socket=require(_0x501a('0xe'))(new Redis(config[_0x501a('0xb')]));require(_0x501a('0xf'))['register'](socket);function respondWithRpcPromise(_0xf73914,_0x28c154,_0x1a058a){return new BPromise(function(_0x507a46,_0x117a72){return client[_0x501a('0x10')](_0xf73914,_0x1a058a)[_0x501a('0x11')](function(_0x883def){logger[_0x501a('0x12')](_0x501a('0x13'),_0x28c154,'request\x20sent');logger[_0x501a('0x14')](_0x501a('0x15'),_0x28c154,'request\x20sent',JSON['stringify'](_0x883def));if(_0x883def[_0x501a('0x16')]){if(_0x883def[_0x501a('0x16')][_0x501a('0x17')]===0x1f4){logger[_0x501a('0x16')](_0x501a('0x13'),_0x28c154,_0x883def['error'][_0x501a('0x18')]);return _0x117a72(_0x883def[_0x501a('0x16')][_0x501a('0x18')]);}logger['error']('Team,\x20%s,\x20%s',_0x28c154,_0x883def['error']['message']);return _0x507a46(_0x883def[_0x501a('0x16')][_0x501a('0x18')]);}else{logger[_0x501a('0x12')](_0x501a('0x13'),_0x28c154,_0x501a('0x19'));_0x507a46(_0x883def['result']['message']);}})[_0x501a('0x1a')](function(_0x526617){logger[_0x501a('0x16')](_0x501a('0x13'),_0x28c154,_0x526617);_0x117a72(_0x526617);});});} \ No newline at end of file +var _0xfaaf=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','redis','localhost','socket.io-emitter','./team.socket','then','info','Team,\x20%s,\x20%s','request\x20sent','debug','Team,\x20%s,\x20%s,\x20%s','error','code','message','result'];(function(_0xff7324,_0x585b24){var _0x32af58=function(_0x2ee45f){while(--_0x2ee45f){_0xff7324['push'](_0xff7324['shift']());}};_0x32af58(++_0x585b24);}(_0xfaaf,0x11e));var _0xffaa=function(_0x158064,_0x1762ac){_0x158064=_0x158064-0x0;var _0x2e159b=_0xfaaf[_0x158064];return _0x2e159b;};'use strict';var _=require(_0xffaa('0x0'));var util=require(_0xffaa('0x1'));var moment=require(_0xffaa('0x2'));var BPromise=require(_0xffaa('0x3'));var rs=require(_0xffaa('0x4'));var fs=require('fs');var Redis=require(_0xffaa('0x5'));var db=require(_0xffaa('0x6'))['db'];var utils=require(_0xffaa('0x7'));var logger=require('../../config/logger')(_0xffaa('0x8'));var config=require(_0xffaa('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xffaa('0xa')][_0xffaa('0xb')]({'port':0x232a});config[_0xffaa('0xc')]=_['defaults'](config[_0xffaa('0xc')],{'host':_0xffaa('0xd'),'port':0x18eb});var socket=require(_0xffaa('0xe'))(new Redis(config['redis']));require(_0xffaa('0xf'))['register'](socket);function respondWithRpcPromise(_0x3957b7,_0x1b4dd2,_0x59cb5c){return new BPromise(function(_0x41a8e9,_0x4156cc){return client['request'](_0x3957b7,_0x59cb5c)[_0xffaa('0x10')](function(_0x2454cf){logger[_0xffaa('0x11')](_0xffaa('0x12'),_0x1b4dd2,_0xffaa('0x13'));logger[_0xffaa('0x14')](_0xffaa('0x15'),_0x1b4dd2,'request\x20sent',JSON['stringify'](_0x2454cf));if(_0x2454cf[_0xffaa('0x16')]){if(_0x2454cf[_0xffaa('0x16')][_0xffaa('0x17')]===0x1f4){logger['error'](_0xffaa('0x12'),_0x1b4dd2,_0x2454cf[_0xffaa('0x16')][_0xffaa('0x18')]);return _0x4156cc(_0x2454cf[_0xffaa('0x16')]['message']);}logger[_0xffaa('0x16')](_0xffaa('0x12'),_0x1b4dd2,_0x2454cf[_0xffaa('0x16')][_0xffaa('0x18')]);return _0x41a8e9(_0x2454cf['error']['message']);}else{logger[_0xffaa('0x11')](_0xffaa('0x12'),_0x1b4dd2,_0xffaa('0x13'));_0x41a8e9(_0x2454cf[_0xffaa('0x19')][_0xffaa('0x18')]);}})['catch'](function(_0x26610a){logger[_0xffaa('0x16')](_0xffaa('0x12'),_0x1b4dd2,_0x26610a);_0x4156cc(_0x26610a);});});} \ No newline at end of file diff --git a/server/api/team/team.socket.js b/server/api/team/team.socket.js index 32dcd06..5a10e93 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 _0x4205=['update','emit','removeListener','./team.events','remove'];(function(_0x37a074,_0x21a59f){var _0x4591ae=function(_0x4bbb48){while(--_0x4bbb48){_0x37a074['push'](_0x37a074['shift']());}};_0x4591ae(++_0x21a59f);}(_0x4205,0x1b6));var _0x5420=function(_0x713265,_0x504761){_0x713265=_0x713265-0x0;var _0x5b1687=_0x4205[_0x713265];return _0x5b1687;};'use strict';var TeamEvents=require(_0x5420('0x0'));var events=['save',_0x5420('0x1'),_0x5420('0x2')];function createListener(_0x2b7654,_0x1aebe5){return function(_0x4356a4){_0x1aebe5[_0x5420('0x3')](_0x2b7654,_0x4356a4);};}function removeListener(_0x470129,_0x4ae7c0){return function(){TeamEvents[_0x5420('0x4')](_0x470129,_0x4ae7c0);};}exports['register']=function(_0x3427be){for(var _0x1a850d=0x0,_0x376771=events['length'];_0x1a850d<_0x376771;_0x1a850d++){var _0x198c6a=events[_0x1a850d];var _0x3bd58e=createListener('team:'+_0x198c6a,_0x3427be);TeamEvents['on'](_0x198c6a,_0x3bd58e);}}; \ No newline at end of file +var _0xd757=['save','remove','update','emit','removeListener','register','length','team:','./team.events'];(function(_0x4cf98e,_0xba4b79){var _0x1623ac=function(_0x459bc0){while(--_0x459bc0){_0x4cf98e['push'](_0x4cf98e['shift']());}};_0x1623ac(++_0xba4b79);}(_0xd757,0x1e5));var _0x7d75=function(_0x65e5a8,_0x43e7d3){_0x65e5a8=_0x65e5a8-0x0;var _0x278583=_0xd757[_0x65e5a8];return _0x278583;};'use strict';var TeamEvents=require(_0x7d75('0x0'));var events=[_0x7d75('0x1'),_0x7d75('0x2'),_0x7d75('0x3')];function createListener(_0x479b13,_0x4edafa){return function(_0x379a63){_0x4edafa[_0x7d75('0x4')](_0x479b13,_0x379a63);};}function removeListener(_0x5e4a4c,_0xa7df66){return function(){TeamEvents[_0x7d75('0x5')](_0x5e4a4c,_0xa7df66);};}exports[_0x7d75('0x6')]=function(_0x52bb43){for(var _0x5d6128=0x0,_0x108c0d=events[_0x7d75('0x7')];_0x5d6128<_0x108c0d;_0x5d6128++){var _0x1cf272=events[_0x5d6128];var _0x276fb0=createListener(_0x7d75('0x8')+_0x1cf272,_0x52bb43);TeamEvents['on'](_0x1cf272,_0x276fb0);}}; \ No newline at end of file diff --git a/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js b/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js index de8dd50..0ce1d2b 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 _0x8ca7=['sequelize'];(function(_0x422905,_0x3bce3a){var _0x33dc6c=function(_0x4852c9){while(--_0x4852c9){_0x422905['push'](_0x422905['shift']());}};_0x33dc6c(++_0x3bce3a);}(_0x8ca7,0x9b));var _0x78ca=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8ca7[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x78ca('0x0'));module['exports']={'TeamId':{'type':Sequelize['INTEGER']},'VoicePrefixId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0xb49a=['exports','INTEGER','sequelize'];(function(_0x42245d,_0x51758f){var _0x4b211a=function(_0x2634e){while(--_0x2634e){_0x42245d['push'](_0x42245d['shift']());}};_0x4b211a(++_0x51758f);}(_0xb49a,0xfb));var _0xab49=function(_0x11e90b,_0x3ec29a){_0x11e90b=_0x11e90b-0x0;var _0x31452e=_0xb49a[_0x11e90b];return _0x31452e;};'use strict';var Sequelize=require(_0xab49('0x0'));module[_0xab49('0x1')]={'TeamId':{'type':Sequelize[_0xab49('0x2')]},'VoicePrefixId':{'type':Sequelize[_0xab49('0x2')]}}; \ No newline at end of file diff --git a/server/api/teamVoicePrefix/teamVoicePrefix.model.js b/server/api/teamVoicePrefix/teamVoicePrefix.model.js index c7b51df..e6fd697 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 _0x1e8c=['request-promise','rimraf','../../config/environment','./teamVoicePrefix.attributes','exports','TeamVoicePrefix','team_has_voice_prefixes','util','../../config/logger','api','moment','bluebird'];(function(_0x512ecf,_0x4d0b40){var _0x5f43bf=function(_0x1ddec0){while(--_0x1ddec0){_0x512ecf['push'](_0x512ecf['shift']());}};_0x5f43bf(++_0x4d0b40);}(_0x1e8c,0xd3));var _0xc1e8=function(_0x461c18,_0x5605b9){_0x461c18=_0x461c18-0x0;var _0x35501c=_0x1e8c[_0x461c18];return _0x35501c;};'use strict';var _=require('lodash');var util=require(_0xc1e8('0x0'));var logger=require(_0xc1e8('0x1'))(_0xc1e8('0x2'));var moment=require(_0xc1e8('0x3'));var BPromise=require(_0xc1e8('0x4'));var rp=require(_0xc1e8('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc1e8('0x6'));var config=require(_0xc1e8('0x7'));var attributes=require(_0xc1e8('0x8'));module[_0xc1e8('0x9')]=function(_0x2547e3,_0x18613e){return _0x2547e3['define'](_0xc1e8('0xa'),attributes,{'tableName':_0xc1e8('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7497=['util','../../config/logger','request-promise','path','../../config/environment','./teamVoicePrefix.attributes','exports','define','TeamVoicePrefix','team_has_voice_prefixes','lodash'];(function(_0x124373,_0x21929f){var _0x5ea136=function(_0x157bac){while(--_0x157bac){_0x124373['push'](_0x124373['shift']());}};_0x5ea136(++_0x21929f);}(_0x7497,0xd0));var _0x7749=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7497[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x7749('0x0'));var util=require(_0x7749('0x1'));var logger=require(_0x7749('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x7749('0x3'));var fs=require('fs');var path=require(_0x7749('0x4'));var rimraf=require('rimraf');var config=require(_0x7749('0x5'));var attributes=require(_0x7749('0x6'));module[_0x7749('0x7')]=function(_0x455d05,_0x289268){return _0x455d05[_0x7749('0x8')](_0x7749('0x9'),attributes,{'tableName':_0x7749('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/index.js b/server/api/teamVoiceQueue/index.js index 045db6b..93663de 100644 --- a/server/api/teamVoiceQueue/index.js +++ b/server/api/teamVoiceQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x6c79a9,_0x3218e7){var _0x1f80a9=function(_0x487fc6){while(--_0x487fc6){_0x6c79a9['push'](_0x6c79a9['shift']());}};_0x1f80a9(++_0x3218e7);}(_0xa9e0,0x123));var _0x0a9e=function(_0x298ed3,_0x4ab5e1){_0x298ed3=_0x298ed3-0x0;var _0x5aad28=_0xa9e0[_0x298ed3];return _0x5aad28;};'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(_0x25e03a,_0x3e4fa9){var _0x5528e2=function(_0x2146f4){while(--_0x2146f4){_0x25e03a['push'](_0x25e03a['shift']());}};_0x5528e2(++_0x3e4fa9);}(_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/teamVoiceQueue/teamVoiceQueue.attributes.js b/server/api/teamVoiceQueue/teamVoiceQueue.attributes.js index 780081b..574c7f5 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 _0x544f=['exports','INTEGER','sequelize'];(function(_0x429d05,_0x1a0422){var _0x3044e6=function(_0x4c0c19){while(--_0x4c0c19){_0x429d05['push'](_0x429d05['shift']());}};_0x3044e6(++_0x1a0422);}(_0x544f,0xbc));var _0xf544=function(_0x1b70e3,_0x3a15b1){_0x1b70e3=_0x1b70e3-0x0;var _0x1452ab=_0x544f[_0x1b70e3];return _0x1452ab;};'use strict';var Sequelize=require(_0xf544('0x0'));module[_0xf544('0x1')]={'penalty':{'type':Sequelize[_0xf544('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xe6f0=['INTEGER'];(function(_0x5998f4,_0x692111){var _0x67aa52=function(_0x153ad3){while(--_0x153ad3){_0x5998f4['push'](_0x5998f4['shift']());}};_0x67aa52(++_0x692111);}(_0xe6f0,0x10e));var _0x0e6f=function(_0x286819,_0x84199){_0x286819=_0x286819-0x0;var _0x29a0fe=_0xe6f0[_0x286819];return _0x29a0fe;};'use strict';var Sequelize=require('sequelize');module['exports']={'penalty':{'type':Sequelize[_0x0e6f('0x0')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/teamVoiceQueue.model.js b/server/api/teamVoiceQueue/teamVoiceQueue.model.js index 9d34188..d776699 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 _0x6726=['../../config/logger','moment','bluebird','path','../../config/environment','./teamVoiceQueue.attributes','exports','define','TeamVoiceQueue','team_has_voice_queues','util'];(function(_0x40c7,_0x25b2c2){var _0xa0733f=function(_0x5aa983){while(--_0x5aa983){_0x40c7['push'](_0x40c7['shift']());}};_0xa0733f(++_0x25b2c2);}(_0x6726,0xdb));var _0x6672=function(_0x9d1e6b,_0x3bdc22){_0x9d1e6b=_0x9d1e6b-0x0;var _0x2b3070=_0x6726[_0x9d1e6b];return _0x2b3070;};'use strict';var _=require('lodash');var util=require(_0x6672('0x0'));var logger=require(_0x6672('0x1'))('api');var moment=require(_0x6672('0x2'));var BPromise=require(_0x6672('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6672('0x4'));var rimraf=require('rimraf');var config=require(_0x6672('0x5'));var attributes=require(_0x6672('0x6'));module[_0x6672('0x7')]=function(_0x40ba7e,_0x5701b9){return _0x40ba7e[_0x6672('0x8')](_0x6672('0x9'),attributes,{'tableName':_0x6672('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa44a=['rimraf','exports','define','team_has_voice_queues','lodash','api','moment','bluebird','request-promise','path'];(function(_0x423e2d,_0x265e39){var _0x28b57d=function(_0x5692dd){while(--_0x5692dd){_0x423e2d['push'](_0x423e2d['shift']());}};_0x28b57d(++_0x265e39);}(_0xa44a,0x9a));var _0xaa44=function(_0x3421a2,_0x32d984){_0x3421a2=_0x3421a2-0x0;var _0x575600=_0xa44a[_0x3421a2];return _0x575600;};'use strict';var _=require(_0xaa44('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xaa44('0x1'));var moment=require(_0xaa44('0x2'));var BPromise=require(_0xaa44('0x3'));var rp=require(_0xaa44('0x4'));var fs=require('fs');var path=require(_0xaa44('0x5'));var rimraf=require(_0xaa44('0x6'));var config=require('../../config/environment');var attributes=require('./teamVoiceQueue.attributes');module[_0xaa44('0x7')]=function(_0x39a3f6,_0x4979e3){return _0x39a3f6[_0xaa44('0x8')]('TeamVoiceQueue',attributes,{'tableName':_0xaa44('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 33aeb1d..6b86db6 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 _0x20b4=['http','request','then','info','TeamVoiceQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client'];(function(_0x211ae7,_0x44a5dc){var _0x394899=function(_0x55cae7){while(--_0x55cae7){_0x211ae7['push'](_0x211ae7['shift']());}};_0x394899(++_0x44a5dc);}(_0x20b4,0x146));var _0x420b=function(_0x42b030,_0x252cb6){_0x42b030=_0x42b030-0x0;var _0x112303=_0x20b4[_0x42b030];return _0x112303;};'use strict';var _=require(_0x420b('0x0'));var util=require(_0x420b('0x1'));var moment=require(_0x420b('0x2'));var BPromise=require(_0x420b('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x420b('0x4'));var db=require(_0x420b('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x420b('0x6'))(_0x420b('0x7'));var config=require('../../config/environment');var jayson=require(_0x420b('0x8'));var client=jayson[_0x420b('0x9')][_0x420b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x226510,_0x2d4d4c,_0x2fe151){return new BPromise(function(_0x5e7b0d,_0x3d2241){return client[_0x420b('0xb')](_0x226510,_0x2fe151)[_0x420b('0xc')](function(_0x5c9b33){logger[_0x420b('0xd')](_0x420b('0xe'),_0x2d4d4c,_0x420b('0xf'));logger[_0x420b('0x10')]('TeamVoiceQueue,\x20%s,\x20%s,\x20%s',_0x2d4d4c,_0x420b('0xf'),JSON[_0x420b('0x11')](_0x5c9b33));if(_0x5c9b33[_0x420b('0x12')]){if(_0x5c9b33[_0x420b('0x12')][_0x420b('0x13')]===0x1f4){logger[_0x420b('0x12')](_0x420b('0xe'),_0x2d4d4c,_0x5c9b33[_0x420b('0x12')][_0x420b('0x14')]);return _0x3d2241(_0x5c9b33[_0x420b('0x12')][_0x420b('0x14')]);}logger[_0x420b('0x12')]('TeamVoiceQueue,\x20%s,\x20%s',_0x2d4d4c,_0x5c9b33[_0x420b('0x12')][_0x420b('0x14')]);return _0x5e7b0d(_0x5c9b33[_0x420b('0x12')][_0x420b('0x14')]);}else{logger['info'](_0x420b('0xe'),_0x2d4d4c,'request\x20sent');_0x5e7b0d(_0x5c9b33['result'][_0x420b('0x14')]);}})['catch'](function(_0x131976){logger['error'](_0x420b('0xe'),_0x2d4d4c,_0x131976);_0x3d2241(_0x131976);});});} \ No newline at end of file +var _0xaaff=['error','TeamVoiceQueue,\x20%s,\x20%s','message','result','catch','util','moment','bluebird','randomstring','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','then','request\x20sent','debug','TeamVoiceQueue,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x1a9656,_0x564c5b){var _0x77979a=function(_0x100c4f){while(--_0x100c4f){_0x1a9656['push'](_0x1a9656['shift']());}};_0x77979a(++_0x564c5b);}(_0xaaff,0xad));var _0xfaaf=function(_0xd511d,_0x3546b9){_0xd511d=_0xd511d-0x0;var _0x3f148e=_0xaaff[_0xd511d];return _0x3f148e;};'use strict';var _=require('lodash');var util=require(_0xfaaf('0x0'));var moment=require(_0xfaaf('0x1'));var BPromise=require(_0xfaaf('0x2'));var rs=require(_0xfaaf('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xfaaf('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xfaaf('0x5'));var config=require(_0xfaaf('0x6'));var jayson=require(_0xfaaf('0x7'));var client=jayson[_0xfaaf('0x8')][_0xfaaf('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x392c8c,_0x20bff4,_0x1fc27a){return new BPromise(function(_0x34e625,_0x357c64){return client[_0xfaaf('0xa')](_0x392c8c,_0x1fc27a)[_0xfaaf('0xb')](function(_0x3df5d5){logger['info']('TeamVoiceQueue,\x20%s,\x20%s',_0x20bff4,_0xfaaf('0xc'));logger[_0xfaaf('0xd')](_0xfaaf('0xe'),_0x20bff4,_0xfaaf('0xc'),JSON[_0xfaaf('0xf')](_0x3df5d5));if(_0x3df5d5[_0xfaaf('0x10')]){if(_0x3df5d5[_0xfaaf('0x10')]['code']===0x1f4){logger['error'](_0xfaaf('0x11'),_0x20bff4,_0x3df5d5[_0xfaaf('0x10')][_0xfaaf('0x12')]);return _0x357c64(_0x3df5d5[_0xfaaf('0x10')]['message']);}logger[_0xfaaf('0x10')](_0xfaaf('0x11'),_0x20bff4,_0x3df5d5[_0xfaaf('0x10')][_0xfaaf('0x12')]);return _0x34e625(_0x3df5d5[_0xfaaf('0x10')][_0xfaaf('0x12')]);}else{logger['info'](_0xfaaf('0x11'),_0x20bff4,_0xfaaf('0xc'));_0x34e625(_0x3df5d5[_0xfaaf('0x13')][_0xfaaf('0x12')]);}})[_0xfaaf('0x14')](function(_0x5566ea){logger[_0xfaaf('0x10')]('TeamVoiceQueue,\x20%s,\x20%s',_0x20bff4,_0x5566ea);_0x357c64(_0x5566ea);});});} \ No newline at end of file diff --git a/server/api/template/index.js b/server/api/template/index.js index 47770e8..e9a4664 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 _0xd663=['multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','show','post','isAuthenticated','create','put','/:id','delete','exports'];(function(_0x1545bc,_0x39ddbe){var _0x4d1858=function(_0x522e9b){while(--_0x522e9b){_0x1545bc['push'](_0x1545bc['shift']());}};_0x4d1858(++_0x39ddbe);}(_0xd663,0x1ed));var _0x3d66=function(_0x266c49,_0x2ccaec){_0x266c49=_0x266c49-0x0;var _0x299706=_0xd663[_0x266c49];return _0x299706;};'use strict';var multer=require(_0x3d66('0x0'));var util=require(_0x3d66('0x1'));var path=require('path');var timeout=require(_0x3d66('0x2'));var express=require(_0x3d66('0x3'));var router=express[_0x3d66('0x4')]();var fs_extra=require(_0x3d66('0x5'));var auth=require(_0x3d66('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x3d66('0x7'));var controller=require('./template.controller');router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x3d66('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x3d66('0x9')]);router[_0x3d66('0xa')]('/',auth[_0x3d66('0xb')](),controller[_0x3d66('0xc')]);router[_0x3d66('0xd')](_0x3d66('0xe'),auth[_0x3d66('0xb')](),controller['update']);router[_0x3d66('0xf')](_0x3d66('0xe'),auth[_0x3d66('0xb')](),controller['destroy']);module[_0x3d66('0x10')]=router; \ No newline at end of file +var _0xbd36=['util','path','Router','fs-extra','../../components/interaction/service','../../config/environment','./template.controller','get','index','/:id','isAuthenticated','show','post','update','delete','destroy','multer'];(function(_0x29ce4f,_0x691ee){var _0x8c2d3b=function(_0x4e8ff0){while(--_0x4e8ff0){_0x29ce4f['push'](_0x29ce4f['shift']());}};_0x8c2d3b(++_0x691ee);}(_0xbd36,0x65));var _0x6bd3=function(_0x550d12,_0x5384bd){_0x550d12=_0x550d12-0x0;var _0x12103d=_0xbd36[_0x550d12];return _0x12103d;};'use strict';var multer=require(_0x6bd3('0x0'));var util=require(_0x6bd3('0x1'));var path=require(_0x6bd3('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x6bd3('0x3')]();var fs_extra=require(_0x6bd3('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x6bd3('0x5'));var config=require(_0x6bd3('0x6'));var controller=require(_0x6bd3('0x7'));router[_0x6bd3('0x8')]('/',auth['isAuthenticated'](),controller[_0x6bd3('0x9')]);router[_0x6bd3('0x8')](_0x6bd3('0xa'),auth[_0x6bd3('0xb')](),controller[_0x6bd3('0xc')]);router[_0x6bd3('0xd')]('/',auth[_0x6bd3('0xb')](),controller['create']);router['put'](_0x6bd3('0xa'),auth['isAuthenticated'](),controller[_0x6bd3('0xe')]);router[_0x6bd3('0xf')](_0x6bd3('0xa'),auth[_0x6bd3('0xb')](),controller[_0x6bd3('0x10')]);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 b321c93..7effdbf 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 _0x0802=['exports','STRING','TEXT','sequelize'];(function(_0x253774,_0xc043ff){var _0x57b598=function(_0x5d1e12){while(--_0x5d1e12){_0x253774['push'](_0x253774['shift']());}};_0x57b598(++_0xc043ff);}(_0x0802,0x1af));var _0x2080=function(_0x56d793,_0x319830){_0x56d793=_0x56d793-0x0;var _0x16d972=_0x0802[_0x56d793];return _0x16d972;};'use strict';var Sequelize=require(_0x2080('0x0'));module[_0x2080('0x1')]={'name':{'type':Sequelize[_0x2080('0x2')]},'description':{'type':Sequelize[_0x2080('0x2')]},'html':{'type':Sequelize[_0x2080('0x3')]}}; \ No newline at end of file +var _0x0617=['STRING','TEXT','exports'];(function(_0x5af97c,_0x24a49f){var _0x3472ae=function(_0x54cdc3){while(--_0x54cdc3){_0x5af97c['push'](_0x5af97c['shift']());}};_0x3472ae(++_0x24a49f);}(_0x0617,0x1ee));var _0x7061=function(_0x1bd633,_0xd11a7f){_0x1bd633=_0x1bd633-0x0;var _0x30806c=_0x0617[_0x1bd633];return _0x30806c;};'use strict';var Sequelize=require('sequelize');module[_0x7061('0x0')]={'name':{'type':Sequelize[_0x7061('0x1')]},'description':{'type':Sequelize[_0x7061('0x1')]},'html':{'type':Sequelize[_0x7061('0x2')]}}; \ No newline at end of file diff --git a/server/api/template/template.controller.js b/server/api/template/template.controller.js index 2105a32..a6cc908 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 _0x9ed4=['catch','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','UserProfileSection','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../config/logger','../../config/license/util','../../mysqldb','status','undefined','limit','count','offset','Content-Range','json','apply','reject','save','update','destroy','Templates','then','sendStatus','error','name','send','index','map','Template','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','findAll','show','params','rawAttributes','include','find'];(function(_0x54edb1,_0x407378){var _0x53dedc=function(_0xb92772){while(--_0xb92772){_0x54edb1['push'](_0x54edb1['shift']());}};_0x53dedc(++_0x407378);}(_0x9ed4,0x152));var _0x49ed=function(_0x1016eb,_0x1429f9){_0x1016eb=_0x1016eb-0x0;var _0x5db53c=_0x9ed4[_0x1016eb];return _0x5db53c;};'use strict';var emlformat=require(_0x49ed('0x0'));var rimraf=require(_0x49ed('0x1'));var zipdir=require(_0x49ed('0x2'));var jsonpatch=require(_0x49ed('0x3'));var rp=require(_0x49ed('0x4'));var moment=require('moment');var BPromise=require(_0x49ed('0x5'));var Mustache=require(_0x49ed('0x6'));var util=require(_0x49ed('0x7'));var path=require(_0x49ed('0x8'));var sox=require(_0x49ed('0x9'));var csv=require(_0x49ed('0xa'));var ejs=require(_0x49ed('0xb'));var fs=require('fs');var fs_extra=require(_0x49ed('0xc'));var _=require(_0x49ed('0xd'));var squel=require(_0x49ed('0xe'));var crypto=require('crypto');var jsforce=require(_0x49ed('0xf'));var deskjs=require(_0x49ed('0x10'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x49ed('0x11'));var Redis=require(_0x49ed('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x49ed('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x49ed('0x14'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x49ed('0x15'));var db=require(_0x49ed('0x16'))['db'];function respondWithStatusCode(_0x36a375,_0x257345){_0x257345=_0x257345||0xcc;return function(_0x4010b9){if(_0x4010b9){return _0x36a375['sendStatus'](_0x257345);}return _0x36a375['status'](_0x257345)['end']();};}function respondWithResult(_0x211f52,_0x460a62){_0x460a62=_0x460a62||0xc8;return function(_0xd1d738){if(_0xd1d738){return _0x211f52[_0x49ed('0x17')](_0x460a62)['json'](_0xd1d738);}};}function respondWithFilteredResult(_0xd5669d,_0x56e394){return function(_0x132eef){if(_0x132eef){var _0x1285e7=typeof _0x56e394['offset']===_0x49ed('0x18')&&typeof _0x56e394[_0x49ed('0x19')]===_0x49ed('0x18');var _0x5e4302=_0x132eef[_0x49ed('0x1a')];var _0x57ce70=_0x1285e7?0x0:_0x56e394['offset'];var _0x15e037=_0x1285e7?_0x132eef['count']:_0x56e394[_0x49ed('0x1b')]+_0x56e394[_0x49ed('0x19')];var _0x42b583;if(_0x15e037>=_0x5e4302){_0x15e037=_0x5e4302;_0x42b583=0xc8;}else{_0x42b583=0xce;}_0xd5669d[_0x49ed('0x17')](_0x42b583);return _0xd5669d['set'](_0x49ed('0x1c'),_0x57ce70+'-'+_0x15e037+'/'+_0x5e4302)[_0x49ed('0x1d')](_0x132eef);}return null;};}function patchUpdates(_0x1707a3){return function(_0x3ddd0b){try{jsonpatch[_0x49ed('0x1e')](_0x3ddd0b,_0x1707a3,!![]);}catch(_0x4af24e){return BPromise[_0x49ed('0x1f')](_0x4af24e);}return _0x3ddd0b[_0x49ed('0x20')]();};}function saveUpdates(_0x259734,_0x588581){return function(_0x531761){if(_0x531761){return _0x531761[_0x49ed('0x21')](_0x259734)['then'](function(_0x535731){return _0x535731;});}return null;};}function removeEntity(_0x55d2df,_0x52fa4b){return function(_0x17dc31){if(_0x17dc31){return _0x17dc31[_0x49ed('0x22')]()['then'](function(){var _0xf7d966=_0x17dc31['get']({'plain':!![]});var _0x1e722d=_0x49ed('0x23');return db['UserProfileResource']['destroy']({'where':{'type':_0x1e722d,'resourceId':_0xf7d966['id']}})['then'](function(){return _0x17dc31;});})[_0x49ed('0x24')](function(){_0x55d2df['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x2a755a,_0x693bcf){return function(_0x407f46){if(!_0x407f46){_0x2a755a[_0x49ed('0x25')](0x194);}return _0x407f46;};}function handleError(_0x337027,_0x534de1){_0x534de1=_0x534de1||0x1f4;return function(_0x2fe34a){logger[_0x49ed('0x26')](_0x2fe34a['stack']);if(_0x2fe34a[_0x49ed('0x27')]){delete _0x2fe34a[_0x49ed('0x27')];}_0x337027[_0x49ed('0x17')](_0x534de1)[_0x49ed('0x28')](_0x2fe34a);};}exports[_0x49ed('0x29')]=function(_0x33ef22,_0x4a8604){var _0xa385b3={},_0x50d7b9={},_0x384893={'count':0x0,'rows':[]};var _0x44c37a=_[_0x49ed('0x2a')](db[_0x49ed('0x2b')]['rawAttributes'],function(_0x1fcd2e){return{'name':_0x1fcd2e[_0x49ed('0x2c')],'type':_0x1fcd2e['type'][_0x49ed('0x2d')]};});_0x50d7b9[_0x49ed('0x2e')]=_[_0x49ed('0x2a')](_0x44c37a,_0x49ed('0x27'));_0x50d7b9[_0x49ed('0x2f')]=_[_0x49ed('0x30')](_0x33ef22[_0x49ed('0x2f')]);_0x50d7b9[_0x49ed('0x31')]=_[_0x49ed('0x32')](_0x50d7b9[_0x49ed('0x2e')],_0x50d7b9['query']);_0xa385b3[_0x49ed('0x33')]=_[_0x49ed('0x32')](_0x50d7b9[_0x49ed('0x2e')],qs[_0x49ed('0x34')](_0x33ef22['query'][_0x49ed('0x34')]));_0xa385b3[_0x49ed('0x33')]=_0xa385b3[_0x49ed('0x33')][_0x49ed('0x35')]?_0xa385b3['attributes']:_0x50d7b9[_0x49ed('0x2e')];if(!_0x33ef22[_0x49ed('0x2f')][_0x49ed('0x36')](_0x49ed('0x37'))){_0xa385b3[_0x49ed('0x19')]=qs[_0x49ed('0x19')](_0x33ef22[_0x49ed('0x2f')]['limit']);_0xa385b3[_0x49ed('0x1b')]=qs[_0x49ed('0x1b')](_0x33ef22[_0x49ed('0x2f')]['offset']);}_0xa385b3[_0x49ed('0x38')]=qs['sort'](_0x33ef22[_0x49ed('0x2f')][_0x49ed('0x39')]);_0xa385b3[_0x49ed('0x3a')]=qs[_0x49ed('0x31')](_[_0x49ed('0x3b')](_0x33ef22[_0x49ed('0x2f')],_0x50d7b9[_0x49ed('0x31')]),_0x44c37a);if(_0x33ef22[_0x49ed('0x2f')][_0x49ed('0x3c')]){_0xa385b3[_0x49ed('0x3a')]=_[_0x49ed('0x3d')](_0xa385b3[_0x49ed('0x3a')],{'$or':_[_0x49ed('0x2a')](_0x44c37a,function(_0x52135b){if(_0x52135b[_0x49ed('0x3e')]!==_0x49ed('0x3f')){var _0x47bceb={};_0x47bceb[_0x52135b['name']]={'$like':'%'+_0x33ef22[_0x49ed('0x2f')][_0x49ed('0x3c')]+'%'};return _0x47bceb;}})});}_0xa385b3=_[_0x49ed('0x3d')]({},_0xa385b3,_0x33ef22[_0x49ed('0x40')]);var _0xc4a5b3={'where':_0xa385b3[_0x49ed('0x3a')]};return db['Template'][_0x49ed('0x1a')](_0xc4a5b3)[_0x49ed('0x24')](function(_0x5a641e){_0x384893[_0x49ed('0x1a')]=_0x5a641e;if(_0x33ef22[_0x49ed('0x2f')][_0x49ed('0x41')]){_0xa385b3['include']=[{'all':!![]}];}return db[_0x49ed('0x2b')][_0x49ed('0x42')](_0xa385b3);})[_0x49ed('0x24')](function(_0x39042f){_0x384893['rows']=_0x39042f;return _0x384893;})[_0x49ed('0x24')](respondWithFilteredResult(_0x4a8604,_0xa385b3))['catch'](handleError(_0x4a8604,null));};exports[_0x49ed('0x43')]=function(_0x519183,_0x259db2){var _0x3885ce={'raw':!![],'where':{'id':_0x519183[_0x49ed('0x44')]['id']}},_0x2e495d={};_0x2e495d[_0x49ed('0x2e')]=_[_0x49ed('0x30')](db[_0x49ed('0x2b')][_0x49ed('0x45')]);_0x2e495d[_0x49ed('0x2f')]=_[_0x49ed('0x30')](_0x519183[_0x49ed('0x2f')]);_0x2e495d['filters']=_[_0x49ed('0x32')](_0x2e495d[_0x49ed('0x2e')],_0x2e495d[_0x49ed('0x2f')]);_0x3885ce[_0x49ed('0x33')]=_[_0x49ed('0x32')](_0x2e495d[_0x49ed('0x2e')],qs[_0x49ed('0x34')](_0x519183['query']['fields']));_0x3885ce['attributes']=_0x3885ce['attributes']['length']?_0x3885ce[_0x49ed('0x33')]:_0x2e495d['model'];if(_0x519183[_0x49ed('0x2f')][_0x49ed('0x41')]){_0x3885ce[_0x49ed('0x46')]=[{'all':!![]}];}_0x3885ce=_[_0x49ed('0x3d')]({},_0x3885ce,_0x519183[_0x49ed('0x40')]);return db[_0x49ed('0x2b')][_0x49ed('0x47')](_0x3885ce)[_0x49ed('0x24')](handleEntityNotFound(_0x259db2,null))[_0x49ed('0x24')](respondWithResult(_0x259db2,null))[_0x49ed('0x48')](handleError(_0x259db2,null));};exports[_0x49ed('0x49')]=function(_0x3b5624,_0x2ea8c7){return db[_0x49ed('0x2b')][_0x49ed('0x49')](_0x3b5624['body'],{})[_0x49ed('0x24')](function(_0x545d89){var _0x4771f4=_0x3b5624[_0x49ed('0x4a')]['get']({'plain':!![]});if(!_0x4771f4)throw new Error(_0x49ed('0x4b'));if(_0x4771f4[_0x49ed('0x4c')]===_0x49ed('0x4a')){var _0x26b63a=_0x545d89[_0x49ed('0x4d')]({'plain':!![]});var _0x189c97='Templates';return db[_0x49ed('0x4e')][_0x49ed('0x47')]({'where':{'name':_0x189c97,'userProfileId':_0x4771f4['userProfileId']},'raw':!![]})[_0x49ed('0x24')](function(_0x4dc080){if(_0x4dc080&&_0x4dc080['autoAssociation']===0x0){return db[_0x49ed('0x4f')][_0x49ed('0x49')]({'name':_0x26b63a[_0x49ed('0x27')],'resourceId':_0x26b63a['id'],'type':_0x4dc080['name'],'sectionId':_0x4dc080['id']},{})[_0x49ed('0x24')](function(){return _0x545d89;});}else{return _0x545d89;}})[_0x49ed('0x48')](function(_0x2b6096){logger[_0x49ed('0x26')](_0x49ed('0x50'),_0x2b6096);throw _0x2b6096;});}return _0x545d89;})[_0x49ed('0x24')](respondWithResult(_0x2ea8c7,0xc9))[_0x49ed('0x48')](handleError(_0x2ea8c7,null));};exports[_0x49ed('0x21')]=function(_0x4b8ca5,_0x2b4067){if(_0x4b8ca5[_0x49ed('0x51')]['id']){delete _0x4b8ca5[_0x49ed('0x51')]['id'];}return db[_0x49ed('0x2b')][_0x49ed('0x47')]({'where':{'id':_0x4b8ca5[_0x49ed('0x44')]['id']}})[_0x49ed('0x24')](handleEntityNotFound(_0x2b4067,null))['then'](saveUpdates(_0x4b8ca5[_0x49ed('0x51')],null))[_0x49ed('0x24')](respondWithResult(_0x2b4067,null))[_0x49ed('0x48')](handleError(_0x2b4067,null));};exports['destroy']=function(_0x2f69e4,_0x28f710){return db[_0x49ed('0x2b')][_0x49ed('0x47')]({'where':{'id':_0x2f69e4[_0x49ed('0x44')]['id']}})[_0x49ed('0x24')](handleEntityNotFound(_0x28f710,null))[_0x49ed('0x24')](removeEntity(_0x28f710,null))[_0x49ed('0x48')](handleError(_0x28f710,null));}; \ No newline at end of file +var _0x3cda=['pick','VIRTUAL','filter','merge','options','includeAll','rows','show','keys','include','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','destroy','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','sox','ejs','fs-extra','lodash','squel','jsforce','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','end','json','offset','undefined','limit','count','status','set','Content-Range','apply','reject','save','then','get','Templates','UserProfileResource','error','stack','name','send','index','map','Template','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','length','nolimit','where'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x3cda,0xb8));var _0xa3cd=function(_0x36ae11,_0x4c334e){_0x36ae11=_0x36ae11-0x0;var _0x470b3d=_0x3cda[_0x36ae11];return _0x470b3d;};'use strict';var emlformat=require(_0xa3cd('0x0'));var rimraf=require(_0xa3cd('0x1'));var zipdir=require(_0xa3cd('0x2'));var jsonpatch=require(_0xa3cd('0x3'));var rp=require('request-promise');var moment=require(_0xa3cd('0x4'));var BPromise=require(_0xa3cd('0x5'));var Mustache=require(_0xa3cd('0x6'));var util=require('util');var path=require('path');var sox=require(_0xa3cd('0x7'));var csv=require('to-csv');var ejs=require(_0xa3cd('0x8'));var fs=require('fs');var fs_extra=require(_0xa3cd('0x9'));var _=require(_0xa3cd('0xa'));var squel=require(_0xa3cd('0xb'));var crypto=require('crypto');var jsforce=require(_0xa3cd('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xa3cd('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xa3cd('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0xa3cd('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa3cd('0x10'))(_0xa3cd('0x11'));var utils=require('../../config/utils');var config=require(_0xa3cd('0x12'));var licenseUtil=require(_0xa3cd('0x13'));var db=require(_0xa3cd('0x14'))['db'];function respondWithStatusCode(_0x4bf69f,_0x1d7c8c){_0x1d7c8c=_0x1d7c8c||0xcc;return function(_0x4602a8){if(_0x4602a8){return _0x4bf69f['sendStatus'](_0x1d7c8c);}return _0x4bf69f['status'](_0x1d7c8c)[_0xa3cd('0x15')]();};}function respondWithResult(_0x562cf7,_0x450a7e){_0x450a7e=_0x450a7e||0xc8;return function(_0x53ff52){if(_0x53ff52){return _0x562cf7['status'](_0x450a7e)[_0xa3cd('0x16')](_0x53ff52);}};}function respondWithFilteredResult(_0x10a447,_0x5f1a81){return function(_0x6bf34d){if(_0x6bf34d){var _0x40591b=typeof _0x5f1a81[_0xa3cd('0x17')]===_0xa3cd('0x18')&&typeof _0x5f1a81[_0xa3cd('0x19')]===_0xa3cd('0x18');var _0x50f9ac=_0x6bf34d['count'];var _0x145323=_0x40591b?0x0:_0x5f1a81['offset'];var _0x34f7a3=_0x40591b?_0x6bf34d[_0xa3cd('0x1a')]:_0x5f1a81[_0xa3cd('0x17')]+_0x5f1a81[_0xa3cd('0x19')];var _0x2922ba;if(_0x34f7a3>=_0x50f9ac){_0x34f7a3=_0x50f9ac;_0x2922ba=0xc8;}else{_0x2922ba=0xce;}_0x10a447[_0xa3cd('0x1b')](_0x2922ba);return _0x10a447[_0xa3cd('0x1c')](_0xa3cd('0x1d'),_0x145323+'-'+_0x34f7a3+'/'+_0x50f9ac)[_0xa3cd('0x16')](_0x6bf34d);}return null;};}function patchUpdates(_0x4f945f){return function(_0x3a2dac){try{jsonpatch[_0xa3cd('0x1e')](_0x3a2dac,_0x4f945f,!![]);}catch(_0x446697){return BPromise[_0xa3cd('0x1f')](_0x446697);}return _0x3a2dac[_0xa3cd('0x20')]();};}function saveUpdates(_0x29cf05,_0x16bdf7){return function(_0x10060c){if(_0x10060c){return _0x10060c['update'](_0x29cf05)['then'](function(_0x563133){return _0x563133;});}return null;};}function removeEntity(_0x4530c4,_0x225cec){return function(_0x442fb8){if(_0x442fb8){return _0x442fb8['destroy']()[_0xa3cd('0x21')](function(){var _0xf4720=_0x442fb8[_0xa3cd('0x22')]({'plain':!![]});var _0x33b25b=_0xa3cd('0x23');return db[_0xa3cd('0x24')]['destroy']({'where':{'type':_0x33b25b,'resourceId':_0xf4720['id']}})['then'](function(){return _0x442fb8;});})['then'](function(){_0x4530c4[_0xa3cd('0x1b')](0xcc)[_0xa3cd('0x15')]();});}};}function handleEntityNotFound(_0x4102b4,_0x456156){return function(_0x4021c4){if(!_0x4021c4){_0x4102b4['sendStatus'](0x194);}return _0x4021c4;};}function handleError(_0x378b78,_0x4a06dd){_0x4a06dd=_0x4a06dd||0x1f4;return function(_0x35124a){logger[_0xa3cd('0x25')](_0x35124a[_0xa3cd('0x26')]);if(_0x35124a[_0xa3cd('0x27')]){delete _0x35124a['name'];}_0x378b78[_0xa3cd('0x1b')](_0x4a06dd)[_0xa3cd('0x28')](_0x35124a);};}exports[_0xa3cd('0x29')]=function(_0x3e623d,_0x46d14c){var _0x5c7fb5={},_0x55ee00={},_0x6c64d={'count':0x0,'rows':[]};var _0x1e290c=_[_0xa3cd('0x2a')](db[_0xa3cd('0x2b')][_0xa3cd('0x2c')],function(_0x4fe276){return{'name':_0x4fe276[_0xa3cd('0x2d')],'type':_0x4fe276[_0xa3cd('0x2e')]['key']};});_0x55ee00[_0xa3cd('0x2f')]=_[_0xa3cd('0x2a')](_0x1e290c,'name');_0x55ee00[_0xa3cd('0x30')]=_['keys'](_0x3e623d[_0xa3cd('0x30')]);_0x55ee00[_0xa3cd('0x31')]=_[_0xa3cd('0x32')](_0x55ee00[_0xa3cd('0x2f')],_0x55ee00[_0xa3cd('0x30')]);_0x5c7fb5[_0xa3cd('0x33')]=_[_0xa3cd('0x32')](_0x55ee00['model'],qs[_0xa3cd('0x34')](_0x3e623d[_0xa3cd('0x30')][_0xa3cd('0x34')]));_0x5c7fb5[_0xa3cd('0x33')]=_0x5c7fb5[_0xa3cd('0x33')][_0xa3cd('0x35')]?_0x5c7fb5['attributes']:_0x55ee00[_0xa3cd('0x2f')];if(!_0x3e623d[_0xa3cd('0x30')]['hasOwnProperty'](_0xa3cd('0x36'))){_0x5c7fb5[_0xa3cd('0x19')]=qs[_0xa3cd('0x19')](_0x3e623d[_0xa3cd('0x30')][_0xa3cd('0x19')]);_0x5c7fb5[_0xa3cd('0x17')]=qs[_0xa3cd('0x17')](_0x3e623d[_0xa3cd('0x30')][_0xa3cd('0x17')]);}_0x5c7fb5['order']=qs['sort'](_0x3e623d[_0xa3cd('0x30')]['sort']);_0x5c7fb5[_0xa3cd('0x37')]=qs[_0xa3cd('0x31')](_[_0xa3cd('0x38')](_0x3e623d[_0xa3cd('0x30')],_0x55ee00['filters']),_0x1e290c);if(_0x3e623d[_0xa3cd('0x30')]['filter']){_0x5c7fb5['where']=_['merge'](_0x5c7fb5[_0xa3cd('0x37')],{'$or':_[_0xa3cd('0x2a')](_0x1e290c,function(_0x1a8c5d){if(_0x1a8c5d['type']!==_0xa3cd('0x39')){var _0x51592a={};_0x51592a[_0x1a8c5d[_0xa3cd('0x27')]]={'$like':'%'+_0x3e623d[_0xa3cd('0x30')][_0xa3cd('0x3a')]+'%'};return _0x51592a;}})});}_0x5c7fb5=_[_0xa3cd('0x3b')]({},_0x5c7fb5,_0x3e623d[_0xa3cd('0x3c')]);var _0x431077={'where':_0x5c7fb5[_0xa3cd('0x37')]};return db[_0xa3cd('0x2b')][_0xa3cd('0x1a')](_0x431077)['then'](function(_0x58384e){_0x6c64d[_0xa3cd('0x1a')]=_0x58384e;if(_0x3e623d['query'][_0xa3cd('0x3d')]){_0x5c7fb5['include']=[{'all':!![]}];}return db[_0xa3cd('0x2b')]['findAll'](_0x5c7fb5);})[_0xa3cd('0x21')](function(_0x8460b6){_0x6c64d[_0xa3cd('0x3e')]=_0x8460b6;return _0x6c64d;})[_0xa3cd('0x21')](respondWithFilteredResult(_0x46d14c,_0x5c7fb5))['catch'](handleError(_0x46d14c,null));};exports[_0xa3cd('0x3f')]=function(_0x3963f2,_0xcce476){var _0x4b6f72={'raw':!![],'where':{'id':_0x3963f2['params']['id']}},_0x223b30={};_0x223b30[_0xa3cd('0x2f')]=_[_0xa3cd('0x40')](db['Template'][_0xa3cd('0x2c')]);_0x223b30[_0xa3cd('0x30')]=_[_0xa3cd('0x40')](_0x3963f2['query']);_0x223b30[_0xa3cd('0x31')]=_[_0xa3cd('0x32')](_0x223b30[_0xa3cd('0x2f')],_0x223b30[_0xa3cd('0x30')]);_0x4b6f72['attributes']=_[_0xa3cd('0x32')](_0x223b30['model'],qs[_0xa3cd('0x34')](_0x3963f2[_0xa3cd('0x30')]['fields']));_0x4b6f72['attributes']=_0x4b6f72[_0xa3cd('0x33')][_0xa3cd('0x35')]?_0x4b6f72[_0xa3cd('0x33')]:_0x223b30['model'];if(_0x3963f2['query'][_0xa3cd('0x3d')]){_0x4b6f72[_0xa3cd('0x41')]=[{'all':!![]}];}_0x4b6f72=_['merge']({},_0x4b6f72,_0x3963f2[_0xa3cd('0x3c')]);return db['Template'][_0xa3cd('0x42')](_0x4b6f72)[_0xa3cd('0x21')](handleEntityNotFound(_0xcce476,null))['then'](respondWithResult(_0xcce476,null))[_0xa3cd('0x43')](handleError(_0xcce476,null));};exports[_0xa3cd('0x44')]=function(_0x15db62,_0x5184fd){return db[_0xa3cd('0x2b')][_0xa3cd('0x44')](_0x15db62[_0xa3cd('0x45')],{})[_0xa3cd('0x21')](function(_0x38f3ff){var _0x26c880=_0x15db62[_0xa3cd('0x46')][_0xa3cd('0x22')]({'plain':!![]});if(!_0x26c880)throw new Error(_0xa3cd('0x47'));if(_0x26c880[_0xa3cd('0x48')]===_0xa3cd('0x46')){var _0x3561b8=_0x38f3ff[_0xa3cd('0x22')]({'plain':!![]});var _0x2f3fde=_0xa3cd('0x23');return db[_0xa3cd('0x49')][_0xa3cd('0x42')]({'where':{'name':_0x2f3fde,'userProfileId':_0x26c880[_0xa3cd('0x4a')]},'raw':!![]})['then'](function(_0x29a028){if(_0x29a028&&_0x29a028[_0xa3cd('0x4b')]===0x0){return db[_0xa3cd('0x24')][_0xa3cd('0x44')]({'name':_0x3561b8['name'],'resourceId':_0x3561b8['id'],'type':_0x29a028['name'],'sectionId':_0x29a028['id']},{})[_0xa3cd('0x21')](function(){return _0x38f3ff;});}else{return _0x38f3ff;}})[_0xa3cd('0x43')](function(_0x4d694a){logger[_0xa3cd('0x25')](_0xa3cd('0x4c'),_0x4d694a);throw _0x4d694a;});}return _0x38f3ff;})[_0xa3cd('0x21')](respondWithResult(_0x5184fd,0xc9))['catch'](handleError(_0x5184fd,null));};exports[_0xa3cd('0x4d')]=function(_0x23bd34,_0x38edea){if(_0x23bd34[_0xa3cd('0x45')]['id']){delete _0x23bd34[_0xa3cd('0x45')]['id'];}return db[_0xa3cd('0x2b')]['find']({'where':{'id':_0x23bd34[_0xa3cd('0x4e')]['id']}})[_0xa3cd('0x21')](handleEntityNotFound(_0x38edea,null))['then'](saveUpdates(_0x23bd34[_0xa3cd('0x45')],null))['then'](respondWithResult(_0x38edea,null))['catch'](handleError(_0x38edea,null));};exports[_0xa3cd('0x4f')]=function(_0x49efb5,_0x532164){return db[_0xa3cd('0x2b')]['find']({'where':{'id':_0x49efb5[_0xa3cd('0x4e')]['id']}})[_0xa3cd('0x21')](handleEntityNotFound(_0x532164,null))['then'](removeEntity(_0x532164,null))[_0xa3cd('0x43')](handleError(_0x532164,null));}; \ No newline at end of file diff --git a/server/api/template/template.model.js b/server/api/template/template.model.js index 8cb8bcf..c228210 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 _0x147f=['./template.attributes','exports','define','Template','tools_templates','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x201d8e,_0x46f74b){var _0x403d73=function(_0x3dc76a){while(--_0x3dc76a){_0x201d8e['push'](_0x201d8e['shift']());}};_0x403d73(++_0x46f74b);}(_0x147f,0x19a));var _0xf147=function(_0xc4c7eb,_0x5768e1){_0xc4c7eb=_0xc4c7eb-0x0;var _0xcf775e=_0x147f[_0xc4c7eb];return _0xcf775e;};'use strict';var _=require(_0xf147('0x0'));var util=require(_0xf147('0x1'));var logger=require(_0xf147('0x2'))(_0xf147('0x3'));var moment=require(_0xf147('0x4'));var BPromise=require(_0xf147('0x5'));var rp=require(_0xf147('0x6'));var fs=require('fs');var path=require(_0xf147('0x7'));var rimraf=require(_0xf147('0x8'));var config=require(_0xf147('0x9'));var attributes=require(_0xf147('0xa'));module[_0xf147('0xb')]=function(_0x4920a2,_0x3f6259){return _0x4920a2[_0xf147('0xc')](_0xf147('0xd'),attributes,{'tableName':_0xf147('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9c2d=['tools_templates','util','api','moment','bluebird','path','rimraf','../../config/environment','exports','Template'];(function(_0x2d1fdb,_0x50d2de){var _0x19e74b=function(_0x30fee6){while(--_0x30fee6){_0x2d1fdb['push'](_0x2d1fdb['shift']());}};_0x19e74b(++_0x50d2de);}(_0x9c2d,0x1eb));var _0xd9c2=function(_0x3e1e53,_0x177e46){_0x3e1e53=_0x3e1e53-0x0;var _0x3ceb82=_0x9c2d[_0x3e1e53];return _0x3ceb82;};'use strict';var _=require('lodash');var util=require(_0xd9c2('0x0'));var logger=require('../../config/logger')(_0xd9c2('0x1'));var moment=require(_0xd9c2('0x2'));var BPromise=require(_0xd9c2('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd9c2('0x4'));var rimraf=require(_0xd9c2('0x5'));var config=require(_0xd9c2('0x6'));var attributes=require('./template.attributes');module[_0xd9c2('0x7')]=function(_0x4864cf,_0x56a174){return _0x4864cf['define'](_0xd9c2('0x8'),attributes,{'tableName':_0xd9c2('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 52088a5..501ce28 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 _0x871e=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','Template,\x20%s,\x20%s','request\x20sent','debug','Template,\x20%s,\x20%s,\x20%s','error','message','result','catch','GetTemplate','Template','findAll','options','raw','where','attributes','limit','include','map','model','stringify','lodash','util','bluebird','randomstring'];(function(_0x5c1e8e,_0x17f1ae){var _0x38d545=function(_0x48d1a9){while(--_0x48d1a9){_0x5c1e8e['push'](_0x5c1e8e['shift']());}};_0x38d545(++_0x17f1ae);}(_0x871e,0x65));var _0xe871=function(_0xabb8c0,_0x2bb6f2){_0xabb8c0=_0xabb8c0-0x0;var _0x244e48=_0x871e[_0xabb8c0];return _0x244e48;};'use strict';var _=require(_0xe871('0x0'));var util=require(_0xe871('0x1'));var moment=require('moment');var BPromise=require(_0xe871('0x2'));var rs=require(_0xe871('0x3'));var fs=require('fs');var Redis=require(_0xe871('0x4'));var db=require(_0xe871('0x5'))['db'];var utils=require(_0xe871('0x6'));var logger=require(_0xe871('0x7'))(_0xe871('0x8'));var config=require(_0xe871('0x9'));var jayson=require(_0xe871('0xa'));var client=jayson['client'][_0xe871('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1d2af4,_0x403e5b,_0x2fef70){return new BPromise(function(_0x4c4c52,_0x3b67b5){return client[_0xe871('0xc')](_0x1d2af4,_0x2fef70)[_0xe871('0xd')](function(_0x54787d){logger[_0xe871('0xe')](_0xe871('0xf'),_0x403e5b,_0xe871('0x10'));logger[_0xe871('0x11')](_0xe871('0x12'),_0x403e5b,_0xe871('0x10'),JSON['stringify'](_0x54787d));if(_0x54787d[_0xe871('0x13')]){if(_0x54787d['error']['code']===0x1f4){logger[_0xe871('0x13')](_0xe871('0xf'),_0x403e5b,_0x54787d['error'][_0xe871('0x14')]);return _0x3b67b5(_0x54787d[_0xe871('0x13')]['message']);}logger[_0xe871('0x13')](_0xe871('0xf'),_0x403e5b,_0x54787d[_0xe871('0x13')][_0xe871('0x14')]);return _0x4c4c52(_0x54787d['error']['message']);}else{logger[_0xe871('0xe')](_0xe871('0xf'),_0x403e5b,_0xe871('0x10'));_0x4c4c52(_0x54787d[_0xe871('0x15')][_0xe871('0x14')]);}})[_0xe871('0x16')](function(_0x21466d){logger['error'](_0xe871('0xf'),_0x403e5b,_0x21466d);_0x3b67b5(_0x21466d);});});}exports[_0xe871('0x17')]=function(_0x4c3f3b){var _0x310aa2=this;return new Promise(function(_0x24b0c3,_0x43d25d){return db[_0xe871('0x18')][_0xe871('0x19')]({'raw':_0x4c3f3b[_0xe871('0x1a')]?_0x4c3f3b[_0xe871('0x1a')][_0xe871('0x1b')]===undefined?!![]:![]:!![],'where':_0x4c3f3b['options']?_0x4c3f3b[_0xe871('0x1a')][_0xe871('0x1c')]||null:null,'attributes':_0x4c3f3b[_0xe871('0x1a')]?_0x4c3f3b['options'][_0xe871('0x1d')]||null:null,'limit':_0x4c3f3b[_0xe871('0x1a')]?_0x4c3f3b[_0xe871('0x1a')][_0xe871('0x1e')]||null:null,'include':_0x4c3f3b[_0xe871('0x1a')]?_0x4c3f3b['options'][_0xe871('0x1f')]?_[_0xe871('0x20')](_0x4c3f3b['options']['include'],function(_0x3d0bae){return{'model':db[_0x3d0bae[_0xe871('0x21')]],'as':_0x3d0bae['as'],'attributes':_0x3d0bae[_0xe871('0x1d')],'include':_0x3d0bae[_0xe871('0x1f')]?_[_0xe871('0x20')](_0x3d0bae['include'],function(_0x4e3015){return{'model':db[_0x4e3015[_0xe871('0x21')]],'as':_0x4e3015['as'],'attributes':_0x4e3015[_0xe871('0x1d')],'include':_0x4e3015['include']?_['map'](_0x4e3015[_0xe871('0x1f')],function(_0xf8ee0a){return{'model':db[_0xf8ee0a[_0xe871('0x21')]],'as':_0xf8ee0a['as'],'attributes':_0xf8ee0a[_0xe871('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xe871('0xd')](function(_0x400762){logger['info'](_0xe871('0x17'),_0x4c3f3b);logger[_0xe871('0x11')]('GetTemplate',_0x4c3f3b,JSON[_0xe871('0x22')](_0x400762));_0x24b0c3(_0x400762);})[_0xe871('0x16')](function(_0x56a676){logger['error'](_0xe871('0x17'),_0x56a676[_0xe871('0x14')],_0x4c3f3b);_0x43d25d(_0x310aa2[_0xe871('0x13')](0x1f4,_0x56a676['message']));});});}; \ No newline at end of file +var _0x7ee4=['code','Template,\x20%s,\x20%s','message','result','catch','GetTemplate','Template','findAll','options','where','attributes','limit','include','map','model','debug','stringify','util','moment','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','request\x20sent','Template,\x20%s,\x20%s,\x20%s','error'];(function(_0x5b2eec,_0x208553){var _0x2f73f9=function(_0x4087a1){while(--_0x4087a1){_0x5b2eec['push'](_0x5b2eec['shift']());}};_0x2f73f9(++_0x208553);}(_0x7ee4,0xac));var _0x47ee=function(_0x14a129,_0x319fc4){_0x14a129=_0x14a129-0x0;var _0x20d46d=_0x7ee4[_0x14a129];return _0x20d46d;};'use strict';var _=require('lodash');var util=require(_0x47ee('0x0'));var moment=require(_0x47ee('0x1'));var BPromise=require('bluebird');var rs=require(_0x47ee('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x47ee('0x3'));var logger=require(_0x47ee('0x4'))(_0x47ee('0x5'));var config=require(_0x47ee('0x6'));var jayson=require(_0x47ee('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x191da7,_0x1dce67,_0x5df172){return new BPromise(function(_0x419af6,_0x1989e3){return client[_0x47ee('0x8')](_0x191da7,_0x5df172)[_0x47ee('0x9')](function(_0x141d5c){logger[_0x47ee('0xa')]('Template,\x20%s,\x20%s',_0x1dce67,_0x47ee('0xb'));logger['debug'](_0x47ee('0xc'),_0x1dce67,'request\x20sent',JSON['stringify'](_0x141d5c));if(_0x141d5c['error']){if(_0x141d5c[_0x47ee('0xd')][_0x47ee('0xe')]===0x1f4){logger[_0x47ee('0xd')](_0x47ee('0xf'),_0x1dce67,_0x141d5c[_0x47ee('0xd')]['message']);return _0x1989e3(_0x141d5c[_0x47ee('0xd')][_0x47ee('0x10')]);}logger[_0x47ee('0xd')]('Template,\x20%s,\x20%s',_0x1dce67,_0x141d5c[_0x47ee('0xd')]['message']);return _0x419af6(_0x141d5c[_0x47ee('0xd')]['message']);}else{logger['info'](_0x47ee('0xf'),_0x1dce67,_0x47ee('0xb'));_0x419af6(_0x141d5c[_0x47ee('0x11')]['message']);}})[_0x47ee('0x12')](function(_0x4a1baf){logger[_0x47ee('0xd')](_0x47ee('0xf'),_0x1dce67,_0x4a1baf);_0x1989e3(_0x4a1baf);});});}exports[_0x47ee('0x13')]=function(_0x8a47ec){var _0x55a166=this;return new Promise(function(_0x2ae3e1,_0x5af995){return db[_0x47ee('0x14')][_0x47ee('0x15')]({'raw':_0x8a47ec[_0x47ee('0x16')]?_0x8a47ec[_0x47ee('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x8a47ec[_0x47ee('0x16')]?_0x8a47ec[_0x47ee('0x16')][_0x47ee('0x17')]||null:null,'attributes':_0x8a47ec[_0x47ee('0x16')]?_0x8a47ec[_0x47ee('0x16')][_0x47ee('0x18')]||null:null,'limit':_0x8a47ec[_0x47ee('0x16')]?_0x8a47ec['options'][_0x47ee('0x19')]||null:null,'include':_0x8a47ec[_0x47ee('0x16')]?_0x8a47ec[_0x47ee('0x16')][_0x47ee('0x1a')]?_[_0x47ee('0x1b')](_0x8a47ec['options'][_0x47ee('0x1a')],function(_0x26d84c){return{'model':db[_0x26d84c[_0x47ee('0x1c')]],'as':_0x26d84c['as'],'attributes':_0x26d84c['attributes'],'include':_0x26d84c[_0x47ee('0x1a')]?_['map'](_0x26d84c[_0x47ee('0x1a')],function(_0x2b8d39){return{'model':db[_0x2b8d39[_0x47ee('0x1c')]],'as':_0x2b8d39['as'],'attributes':_0x2b8d39[_0x47ee('0x18')],'include':_0x2b8d39[_0x47ee('0x1a')]?_[_0x47ee('0x1b')](_0x2b8d39[_0x47ee('0x1a')],function(_0x2a8c01){return{'model':db[_0x2a8c01[_0x47ee('0x1c')]],'as':_0x2a8c01['as'],'attributes':_0x2a8c01[_0x47ee('0x18')]};}):[]};}):[]};}):[]:[]})[_0x47ee('0x9')](function(_0x30798f){logger[_0x47ee('0xa')](_0x47ee('0x13'),_0x8a47ec);logger[_0x47ee('0x1d')](_0x47ee('0x13'),_0x8a47ec,JSON[_0x47ee('0x1e')](_0x30798f));_0x2ae3e1(_0x30798f);})[_0x47ee('0x12')](function(_0x273d25){logger[_0x47ee('0xd')](_0x47ee('0x13'),_0x273d25[_0x47ee('0x10')],_0x8a47ec);_0x5af995(_0x55a166[_0x47ee('0xd')](0x1f4,_0x273d25[_0x47ee('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/trigger/index.js b/server/api/trigger/index.js index ac3ff3e..63c6a95 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 _0x78ce=['get','isAuthenticated','index','/:id','show','/:id/any_conditions','getAnyConditions','getActions','create','/:id/all_conditions','addAllCondition','post','/:id/actions','addAction','put','update','delete','destroy','exports','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x999b85,_0x1edc2b){var _0x1d7124=function(_0x59cd29){while(--_0x59cd29){_0x999b85['push'](_0x999b85['shift']());}};_0x1d7124(++_0x1edc2b);}(_0x78ce,0x158));var _0xe78c=function(_0x33a694,_0x9b6640){_0x33a694=_0x33a694-0x0;var _0x41ff01=_0x78ce[_0x33a694];return _0x41ff01;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0xe78c('0x0'));var express=require(_0xe78c('0x1'));var router=express[_0xe78c('0x2')]();var fs_extra=require(_0xe78c('0x3'));var auth=require(_0xe78c('0x4'));var interaction=require(_0xe78c('0x5'));var config=require('../../config/environment');var controller=require('./trigger.controller');router[_0xe78c('0x6')]('/',auth[_0xe78c('0x7')](),controller[_0xe78c('0x8')]);router[_0xe78c('0x6')](_0xe78c('0x9'),auth[_0xe78c('0x7')](),controller[_0xe78c('0xa')]);router[_0xe78c('0x6')]('/:id/all_conditions',auth[_0xe78c('0x7')](),controller['getAllConditions']);router[_0xe78c('0x6')](_0xe78c('0xb'),auth[_0xe78c('0x7')](),controller[_0xe78c('0xc')]);router['get']('/:id/actions',auth[_0xe78c('0x7')](),controller[_0xe78c('0xd')]);router['post']('/',auth['isAuthenticated'](),controller[_0xe78c('0xe')]);router['post'](_0xe78c('0xf'),auth[_0xe78c('0x7')](),controller[_0xe78c('0x10')]);router[_0xe78c('0x11')](_0xe78c('0xb'),auth[_0xe78c('0x7')](),controller['addAnyCondition']);router[_0xe78c('0x11')](_0xe78c('0x12'),auth[_0xe78c('0x7')](),controller[_0xe78c('0x13')]);router[_0xe78c('0x14')](_0xe78c('0x9'),auth[_0xe78c('0x7')](),controller[_0xe78c('0x15')]);router[_0xe78c('0x16')](_0xe78c('0x9'),auth['isAuthenticated'](),controller[_0xe78c('0x17')]);module[_0xe78c('0x18')]=router; \ No newline at end of file +var _0xa7b0=['connect-timeout','express','Router','fs-extra','../../config/environment','./trigger.controller','index','get','/:id','isAuthenticated','show','getAllConditions','getAnyConditions','/:id/actions','getActions','post','create','/:id/all_conditions','addAllCondition','/:id/any_conditions','addAnyCondition','put','update','destroy','multer','util','path'];(function(_0x78cad1,_0xe4df2a){var _0x5409c7=function(_0x483f31){while(--_0x483f31){_0x78cad1['push'](_0x78cad1['shift']());}};_0x5409c7(++_0xe4df2a);}(_0xa7b0,0x1ad));var _0x0a7b=function(_0x2002b3,_0x11e91c){_0x2002b3=_0x2002b3-0x0;var _0x2756f0=_0xa7b0[_0x2002b3];return _0x2756f0;};'use strict';var multer=require(_0x0a7b('0x0'));var util=require(_0x0a7b('0x1'));var path=require(_0x0a7b('0x2'));var timeout=require(_0x0a7b('0x3'));var express=require(_0x0a7b('0x4'));var router=express[_0x0a7b('0x5')]();var fs_extra=require(_0x0a7b('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x0a7b('0x7'));var controller=require(_0x0a7b('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0x0a7b('0x9')]);router[_0x0a7b('0xa')](_0x0a7b('0xb'),auth[_0x0a7b('0xc')](),controller[_0x0a7b('0xd')]);router[_0x0a7b('0xa')]('/:id/all_conditions',auth[_0x0a7b('0xc')](),controller[_0x0a7b('0xe')]);router[_0x0a7b('0xa')]('/:id/any_conditions',auth[_0x0a7b('0xc')](),controller[_0x0a7b('0xf')]);router['get'](_0x0a7b('0x10'),auth[_0x0a7b('0xc')](),controller[_0x0a7b('0x11')]);router[_0x0a7b('0x12')]('/',auth['isAuthenticated'](),controller[_0x0a7b('0x13')]);router[_0x0a7b('0x12')](_0x0a7b('0x14'),auth[_0x0a7b('0xc')](),controller[_0x0a7b('0x15')]);router[_0x0a7b('0x12')](_0x0a7b('0x16'),auth[_0x0a7b('0xc')](),controller[_0x0a7b('0x17')]);router[_0x0a7b('0x12')](_0x0a7b('0x10'),auth[_0x0a7b('0xc')](),controller['addAction']);router[_0x0a7b('0x18')](_0x0a7b('0xb'),auth['isAuthenticated'](),controller[_0x0a7b('0x19')]);router['delete'](_0x0a7b('0xb'),auth['isAuthenticated'](),controller[_0x0a7b('0x1a')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/trigger/trigger.attributes.js b/server/api/trigger/trigger.attributes.js index 5bf8300..390d2c3 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 _0xf078=['STRING','exports'];(function(_0x230a51,_0x4aa0b5){var _0x3e5094=function(_0x3c54ae){while(--_0x3c54ae){_0x230a51['push'](_0x230a51['shift']());}};_0x3e5094(++_0x4aa0b5);}(_0xf078,0x153));var _0x8f07=function(_0x921877,_0x46ec69){_0x921877=_0x921877-0x0;var _0xfe0034=_0xf078[_0x921877];return _0xfe0034;};'use strict';var Sequelize=require('sequelize');module[_0x8f07('0x0')]={'name':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x8f07('0x1')]},'description':{'type':Sequelize[_0x8f07('0x1')]},'status':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x7291=['exports','STRING','BOOLEAN','sequelize'];(function(_0xaa1b3e,_0x47d976){var _0x454d7d=function(_0x575b32){while(--_0x575b32){_0xaa1b3e['push'](_0xaa1b3e['shift']());}};_0x454d7d(++_0x47d976);}(_0x7291,0x1a7));var _0x1729=function(_0x2d43b,_0x306e76){_0x2d43b=_0x2d43b-0x0;var _0x210c30=_0x7291[_0x2d43b];return _0x210c30;};'use strict';var Sequelize=require(_0x1729('0x0'));module[_0x1729('0x1')]={'name':{'type':Sequelize[_0x1729('0x2')]},'channel':{'type':Sequelize[_0x1729('0x2')]},'description':{'type':Sequelize[_0x1729('0x2')]},'status':{'type':Sequelize[_0x1729('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 a51a027..e000f1a 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 _0xe57e=['name','send','index','rawAttributes','type','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','Trigger','include','findAll','rows','catch','params','includeAll','find','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','addAllCondition','TriggerAllId','Condition','addAnyCondition','TriggerAnyId','getAllConditions','getAnyConditions','findOne','addAction','TriggerId','Action','getActions','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','to-csv','ejs','fs-extra','lodash','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','undefined','offset','count','set','Content-Range','json','apply','save','update','destroy','Triggers','UserProfileResource','then','error','stack'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xe57e,0x1bb));var _0xee57=function(_0x1cca07,_0x5c4635){_0x1cca07=_0x1cca07-0x0;var _0xc70b4a=_0xe57e[_0x1cca07];return _0xc70b4a;};'use strict';var emlformat=require(_0xee57('0x0'));var rimraf=require(_0xee57('0x1'));var zipdir=require(_0xee57('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xee57('0x3'));var moment=require('moment');var BPromise=require(_0xee57('0x4'));var Mustache=require(_0xee57('0x5'));var util=require(_0xee57('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0xee57('0x7'));var ejs=require(_0xee57('0x8'));var fs=require('fs');var fs_extra=require(_0xee57('0x9'));var _=require(_0xee57('0xa'));var squel=require('squel');var crypto=require(_0xee57('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xee57('0xc'));var toCsv=require(_0xee57('0x7'));var querystring=require(_0xee57('0xd'));var Papa=require('papaparse');var Redis=require(_0xee57('0xe'));var authService=require(_0xee57('0xf'));var qs=require(_0xee57('0x10'));var as=require(_0xee57('0x11'));var hardwareService=require(_0xee57('0x12'));var logger=require(_0xee57('0x13'))(_0xee57('0x14'));var utils=require(_0xee57('0x15'));var config=require(_0xee57('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xee57('0x17'))['db'];function respondWithStatusCode(_0x11e9ec,_0x484bd6){_0x484bd6=_0x484bd6||0xcc;return function(_0x24b7d5){if(_0x24b7d5){return _0x11e9ec[_0xee57('0x18')](_0x484bd6);}return _0x11e9ec[_0xee57('0x19')](_0x484bd6)[_0xee57('0x1a')]();};}function respondWithResult(_0x192798,_0x3a0445){_0x3a0445=_0x3a0445||0xc8;return function(_0x546e9d){if(_0x546e9d){return _0x192798[_0xee57('0x19')](_0x3a0445)['json'](_0x546e9d);}};}function respondWithFilteredResult(_0x9f85c3,_0x2add9e){return function(_0x3d070b){if(_0x3d070b){var _0x430c1e=typeof _0x2add9e['offset']===_0xee57('0x1b')&&typeof _0x2add9e['limit']==='undefined';var _0x4680d9=_0x3d070b['count'];var _0x100be3=_0x430c1e?0x0:_0x2add9e[_0xee57('0x1c')];var _0x4c2080=_0x430c1e?_0x3d070b[_0xee57('0x1d')]:_0x2add9e[_0xee57('0x1c')]+_0x2add9e['limit'];var _0x429f88;if(_0x4c2080>=_0x4680d9){_0x4c2080=_0x4680d9;_0x429f88=0xc8;}else{_0x429f88=0xce;}_0x9f85c3[_0xee57('0x19')](_0x429f88);return _0x9f85c3[_0xee57('0x1e')](_0xee57('0x1f'),_0x100be3+'-'+_0x4c2080+'/'+_0x4680d9)[_0xee57('0x20')](_0x3d070b);}return null;};}function patchUpdates(_0x235784){return function(_0x5f505b){try{jsonpatch[_0xee57('0x21')](_0x5f505b,_0x235784,!![]);}catch(_0x49e2c5){return BPromise['reject'](_0x49e2c5);}return _0x5f505b[_0xee57('0x22')]();};}function saveUpdates(_0x4841ed,_0xe90863){return function(_0x1fbdfa){if(_0x1fbdfa){return _0x1fbdfa[_0xee57('0x23')](_0x4841ed)['then'](function(_0x39ca6a){return _0x39ca6a;});}return null;};}function removeEntity(_0x3c2145,_0x52a5f6){return function(_0xff1afa){if(_0xff1afa){return _0xff1afa[_0xee57('0x24')]()['then'](function(){var _0xda50b9=_0xff1afa['get']({'plain':!![]});var _0x3bb017=_0xee57('0x25');return db[_0xee57('0x26')]['destroy']({'where':{'type':_0x3bb017,'resourceId':_0xda50b9['id']}})[_0xee57('0x27')](function(){return _0xff1afa;});})[_0xee57('0x27')](function(){_0x3c2145[_0xee57('0x19')](0xcc)[_0xee57('0x1a')]();});}};}function handleEntityNotFound(_0x3ac37b,_0x20366c){return function(_0x169bb1){if(!_0x169bb1){_0x3ac37b[_0xee57('0x18')](0x194);}return _0x169bb1;};}function handleError(_0x13ed38,_0x1e9dcd){_0x1e9dcd=_0x1e9dcd||0x1f4;return function(_0x2fbd45){logger[_0xee57('0x28')](_0x2fbd45[_0xee57('0x29')]);if(_0x2fbd45[_0xee57('0x2a')]){delete _0x2fbd45['name'];}_0x13ed38[_0xee57('0x19')](_0x1e9dcd)[_0xee57('0x2b')](_0x2fbd45);};}exports[_0xee57('0x2c')]=function(_0x7f5494,_0x301cf3){var _0x4c20d7={},_0x179afe={},_0x5efcbe={'count':0x0,'rows':[]};var _0xc00edd=_['map'](db['Trigger'][_0xee57('0x2d')],function(_0x404b86){return{'name':_0x404b86['fieldName'],'type':_0x404b86[_0xee57('0x2e')]['key']};});_0x179afe[_0xee57('0x2f')]=_[_0xee57('0x30')](_0xc00edd,_0xee57('0x2a'));_0x179afe[_0xee57('0x31')]=_[_0xee57('0x32')](_0x7f5494[_0xee57('0x31')]);_0x179afe[_0xee57('0x33')]=_[_0xee57('0x34')](_0x179afe[_0xee57('0x2f')],_0x179afe[_0xee57('0x31')]);_0x4c20d7[_0xee57('0x35')]=_[_0xee57('0x34')](_0x179afe['model'],qs[_0xee57('0x36')](_0x7f5494['query'][_0xee57('0x36')]));_0x4c20d7[_0xee57('0x35')]=_0x4c20d7[_0xee57('0x35')][_0xee57('0x37')]?_0x4c20d7[_0xee57('0x35')]:_0x179afe[_0xee57('0x2f')];if(!_0x7f5494[_0xee57('0x31')][_0xee57('0x38')](_0xee57('0x39'))){_0x4c20d7['limit']=qs[_0xee57('0x3a')](_0x7f5494[_0xee57('0x31')]['limit']);_0x4c20d7[_0xee57('0x1c')]=qs[_0xee57('0x1c')](_0x7f5494[_0xee57('0x31')]['offset']);}_0x4c20d7[_0xee57('0x3b')]=qs[_0xee57('0x3c')](_0x7f5494['query'][_0xee57('0x3c')]);_0x4c20d7[_0xee57('0x3d')]=qs['filters'](_[_0xee57('0x3e')](_0x7f5494['query'],_0x179afe[_0xee57('0x33')]),_0xc00edd);if(_0x7f5494[_0xee57('0x31')][_0xee57('0x3f')]){_0x4c20d7['where']=_[_0xee57('0x40')](_0x4c20d7[_0xee57('0x3d')],{'$or':_['map'](_0xc00edd,function(_0x3f426a){if(_0x3f426a[_0xee57('0x2e')]!==_0xee57('0x41')){var _0x547abc={};_0x547abc[_0x3f426a[_0xee57('0x2a')]]={'$like':'%'+_0x7f5494['query'][_0xee57('0x3f')]+'%'};return _0x547abc;}})});}_0x4c20d7=_[_0xee57('0x40')]({},_0x4c20d7,_0x7f5494[_0xee57('0x42')]);var _0x46b9b6={'where':_0x4c20d7['where']};return db[_0xee57('0x43')][_0xee57('0x1d')](_0x46b9b6)['then'](function(_0x2add40){_0x5efcbe[_0xee57('0x1d')]=_0x2add40;if(_0x7f5494[_0xee57('0x31')]['includeAll']){_0x4c20d7[_0xee57('0x44')]=[{'all':!![]}];}return db['Trigger'][_0xee57('0x45')](_0x4c20d7);})[_0xee57('0x27')](function(_0x32c8a2){_0x5efcbe[_0xee57('0x46')]=_0x32c8a2;return _0x5efcbe;})['then'](respondWithFilteredResult(_0x301cf3,_0x4c20d7))[_0xee57('0x47')](handleError(_0x301cf3,null));};exports['show']=function(_0x2ecb7b,_0x162390){var _0x50fa8a={'raw':![],'where':{'id':_0x2ecb7b[_0xee57('0x48')]['id']}},_0x281722={};_0x281722[_0xee57('0x2f')]=_[_0xee57('0x32')](db[_0xee57('0x43')][_0xee57('0x2d')]);_0x281722[_0xee57('0x31')]=_[_0xee57('0x32')](_0x2ecb7b[_0xee57('0x31')]);_0x281722['filters']=_[_0xee57('0x34')](_0x281722[_0xee57('0x2f')],_0x281722[_0xee57('0x31')]);_0x50fa8a['attributes']=_[_0xee57('0x34')](_0x281722[_0xee57('0x2f')],qs[_0xee57('0x36')](_0x2ecb7b['query']['fields']));_0x50fa8a['attributes']=_0x50fa8a['attributes'][_0xee57('0x37')]?_0x50fa8a[_0xee57('0x35')]:_0x281722[_0xee57('0x2f')];if(_0x2ecb7b['query'][_0xee57('0x49')]){_0x50fa8a[_0xee57('0x44')]=[{'all':!![]}];}_0x50fa8a=_['merge']({},_0x50fa8a,_0x2ecb7b[_0xee57('0x42')]);return db[_0xee57('0x43')][_0xee57('0x4a')](_0x50fa8a)[_0xee57('0x27')](handleEntityNotFound(_0x162390,null))[_0xee57('0x27')](respondWithResult(_0x162390,null))[_0xee57('0x47')](handleError(_0x162390,null));};exports[_0xee57('0x4b')]=function(_0x53b4a0,_0x4f4149){return db[_0xee57('0x43')][_0xee57('0x4b')](_0x53b4a0['body'],{})[_0xee57('0x27')](function(_0x40549c){var _0x14db72=_0x53b4a0[_0xee57('0x4c')][_0xee57('0x4d')]({'plain':!![]});if(!_0x14db72)throw new Error(_0xee57('0x4e'));if(_0x14db72[_0xee57('0x4f')]===_0xee57('0x4c')){var _0x11f63b=_0x40549c[_0xee57('0x4d')]({'plain':!![]});var _0x48d3e3=_0xee57('0x25');return db[_0xee57('0x50')][_0xee57('0x4a')]({'where':{'name':_0x48d3e3,'userProfileId':_0x14db72[_0xee57('0x51')]},'raw':!![]})[_0xee57('0x27')](function(_0xa2ba2e){if(_0xa2ba2e&&_0xa2ba2e[_0xee57('0x52')]===0x0){return db[_0xee57('0x26')][_0xee57('0x4b')]({'name':_0x11f63b['name'],'resourceId':_0x11f63b['id'],'type':_0xa2ba2e[_0xee57('0x2a')],'sectionId':_0xa2ba2e['id']},{})[_0xee57('0x27')](function(){return _0x40549c;});}else{return _0x40549c;}})[_0xee57('0x47')](function(_0x359e7e){logger[_0xee57('0x28')](_0xee57('0x53'),_0x359e7e);throw _0x359e7e;});}return _0x40549c;})[_0xee57('0x27')](respondWithResult(_0x4f4149,0xc9))['catch'](handleError(_0x4f4149,null));};exports[_0xee57('0x23')]=function(_0x173360,_0x4ccfc0){if(_0x173360['body']['id']){delete _0x173360[_0xee57('0x54')]['id'];}return db[_0xee57('0x43')]['find']({'where':{'id':_0x173360['params']['id']}})[_0xee57('0x27')](handleEntityNotFound(_0x4ccfc0,null))[_0xee57('0x27')](saveUpdates(_0x173360['body'],null))[_0xee57('0x27')](respondWithResult(_0x4ccfc0,null))['catch'](handleError(_0x4ccfc0,null));};exports['destroy']=function(_0x36c3e0,_0x3df70a){return db[_0xee57('0x43')][_0xee57('0x4a')]({'where':{'id':_0x36c3e0[_0xee57('0x48')]['id']}})[_0xee57('0x27')](handleEntityNotFound(_0x3df70a,null))[_0xee57('0x27')](removeEntity(_0x3df70a,null))[_0xee57('0x47')](handleError(_0x3df70a,null));};exports[_0xee57('0x55')]=function(_0x15e27c,_0x25e1a0,_0x152dd6){if(_0x15e27c[_0xee57('0x54')]['id']){delete _0x15e27c[_0xee57('0x54')]['id'];}return db[_0xee57('0x43')][_0xee57('0x4a')]({'where':{'id':_0x15e27c['params']['id']}})[_0xee57('0x27')](handleEntityNotFound(_0x25e1a0,null))[_0xee57('0x27')](function(_0xce679c){if(_0xce679c){_0x15e27c[_0xee57('0x54')][_0xee57('0x56')]=_0xce679c['id'];return db[_0xee57('0x57')][_0xee57('0x4b')](_0x15e27c[_0xee57('0x54')]);}})[_0xee57('0x27')](respondWithResult(_0x25e1a0,null))[_0xee57('0x47')](handleError(_0x25e1a0,null));};exports[_0xee57('0x58')]=function(_0x194587,_0x5ca140,_0x5ecfad){if(_0x194587[_0xee57('0x54')]['id']){delete _0x194587[_0xee57('0x54')]['id'];}return db[_0xee57('0x43')][_0xee57('0x4a')]({'where':{'id':_0x194587[_0xee57('0x48')]['id']}})[_0xee57('0x27')](handleEntityNotFound(_0x5ca140,null))['then'](function(_0x41a404){if(_0x41a404){_0x194587[_0xee57('0x54')][_0xee57('0x59')]=_0x41a404['id'];return db[_0xee57('0x57')][_0xee57('0x4b')](_0x194587[_0xee57('0x54')]);}})[_0xee57('0x27')](respondWithResult(_0x5ca140,null))[_0xee57('0x47')](handleError(_0x5ca140,null));};exports[_0xee57('0x5a')]=function(_0x297b4f,_0x1d209f,_0x256565){var _0x34e714={};var _0x58a6f0={};var _0x35ea81;var _0x594b66;return db[_0xee57('0x43')]['findOne']({'where':{'id':_0x297b4f[_0xee57('0x48')]['id']}})[_0xee57('0x27')](handleEntityNotFound(_0x1d209f,null))[_0xee57('0x27')](function(_0x237df9){if(_0x237df9){_0x35ea81=_0x237df9;_0x58a6f0[_0xee57('0x2f')]=_[_0xee57('0x32')](db[_0xee57('0x57')][_0xee57('0x2d')]);_0x58a6f0[_0xee57('0x31')]=_['keys'](_0x297b4f[_0xee57('0x31')]);_0x58a6f0[_0xee57('0x33')]=_['intersection'](_0x58a6f0['model'],_0x58a6f0[_0xee57('0x31')]);_0x34e714[_0xee57('0x35')]=_[_0xee57('0x34')](_0x58a6f0[_0xee57('0x2f')],qs['fields'](_0x297b4f[_0xee57('0x31')][_0xee57('0x36')]));_0x34e714[_0xee57('0x35')]=_0x34e714[_0xee57('0x35')][_0xee57('0x37')]?_0x34e714[_0xee57('0x35')]:_0x58a6f0['model'];_0x34e714[_0xee57('0x3b')]=qs[_0xee57('0x3c')](_0x297b4f[_0xee57('0x31')][_0xee57('0x3c')]);_0x34e714[_0xee57('0x3d')]=qs['filters'](_[_0xee57('0x3e')](_0x297b4f[_0xee57('0x31')],_0x58a6f0[_0xee57('0x33')]));if(_0x297b4f[_0xee57('0x31')][_0xee57('0x3f')]){_0x34e714[_0xee57('0x3d')]=_[_0xee57('0x40')](_0x34e714[_0xee57('0x3d')],{'$or':_[_0xee57('0x30')](_0x34e714['attributes'],function(_0x379654){var _0x5972ca={};_0x5972ca[_0x379654]={'$like':'%'+_0x297b4f[_0xee57('0x31')][_0xee57('0x3f')]+'%'};return _0x5972ca;})});}_0x34e714=_['merge']({},_0x34e714,_0x297b4f[_0xee57('0x42')]);return _0x35ea81[_0xee57('0x5a')](_0x34e714);}})['then'](function(_0x20f530){if(_0x20f530){_0x594b66=_0x20f530[_0xee57('0x37')];if(!_0x297b4f[_0xee57('0x31')]['hasOwnProperty'](_0xee57('0x39'))){_0x34e714[_0xee57('0x3a')]=qs[_0xee57('0x3a')](_0x297b4f[_0xee57('0x31')][_0xee57('0x3a')]);_0x34e714[_0xee57('0x1c')]=qs[_0xee57('0x1c')](_0x297b4f[_0xee57('0x31')][_0xee57('0x1c')]);}return _0x35ea81[_0xee57('0x5a')](_0x34e714);}})[_0xee57('0x27')](function(_0x2131f5){if(_0x2131f5){return _0x2131f5?{'count':_0x594b66,'rows':_0x2131f5}:null;}})[_0xee57('0x27')](respondWithResult(_0x1d209f,null))['catch'](handleError(_0x1d209f,null));};exports[_0xee57('0x5b')]=function(_0x52b490,_0x410f5b,_0x3f46fd){var _0x22d9aa={};var _0x1a7e50={};var _0x3f027d;var _0x570de5;return db[_0xee57('0x43')][_0xee57('0x5c')]({'where':{'id':_0x52b490[_0xee57('0x48')]['id']}})[_0xee57('0x27')](handleEntityNotFound(_0x410f5b,null))['then'](function(_0x18c4be){if(_0x18c4be){_0x3f027d=_0x18c4be;_0x1a7e50['model']=_['keys'](db[_0xee57('0x57')]['rawAttributes']);_0x1a7e50[_0xee57('0x31')]=_[_0xee57('0x32')](_0x52b490[_0xee57('0x31')]);_0x1a7e50[_0xee57('0x33')]=_[_0xee57('0x34')](_0x1a7e50['model'],_0x1a7e50[_0xee57('0x31')]);_0x22d9aa['attributes']=_['intersection'](_0x1a7e50['model'],qs['fields'](_0x52b490[_0xee57('0x31')][_0xee57('0x36')]));_0x22d9aa['attributes']=_0x22d9aa['attributes']['length']?_0x22d9aa[_0xee57('0x35')]:_0x1a7e50[_0xee57('0x2f')];_0x22d9aa[_0xee57('0x3b')]=qs[_0xee57('0x3c')](_0x52b490[_0xee57('0x31')]['sort']);_0x22d9aa[_0xee57('0x3d')]=qs['filters'](_[_0xee57('0x3e')](_0x52b490[_0xee57('0x31')],_0x1a7e50[_0xee57('0x33')]));if(_0x52b490[_0xee57('0x31')]['filter']){_0x22d9aa[_0xee57('0x3d')]=_[_0xee57('0x40')](_0x22d9aa[_0xee57('0x3d')],{'$or':_[_0xee57('0x30')](_0x22d9aa[_0xee57('0x35')],function(_0x5d0e16){var _0x3bf885={};_0x3bf885[_0x5d0e16]={'$like':'%'+_0x52b490[_0xee57('0x31')][_0xee57('0x3f')]+'%'};return _0x3bf885;})});}_0x22d9aa=_[_0xee57('0x40')]({},_0x22d9aa,_0x52b490['options']);return _0x3f027d[_0xee57('0x5b')](_0x22d9aa);}})[_0xee57('0x27')](function(_0x102480){if(_0x102480){_0x570de5=_0x102480['length'];if(!_0x52b490['query'][_0xee57('0x38')](_0xee57('0x39'))){_0x22d9aa['limit']=qs[_0xee57('0x3a')](_0x52b490[_0xee57('0x31')]['limit']);_0x22d9aa[_0xee57('0x1c')]=qs[_0xee57('0x1c')](_0x52b490[_0xee57('0x31')][_0xee57('0x1c')]);}return _0x3f027d[_0xee57('0x5b')](_0x22d9aa);}})[_0xee57('0x27')](function(_0x43a8c8){if(_0x43a8c8){return _0x43a8c8?{'count':_0x570de5,'rows':_0x43a8c8}:null;}})['then'](respondWithResult(_0x410f5b,null))[_0xee57('0x47')](handleError(_0x410f5b,null));};exports[_0xee57('0x5d')]=function(_0x22be85,_0x247b6a,_0x90ab83){if(_0x22be85[_0xee57('0x54')]['id']){delete _0x22be85['body']['id'];}return db[_0xee57('0x43')][_0xee57('0x4a')]({'where':{'id':_0x22be85[_0xee57('0x48')]['id']}})[_0xee57('0x27')](handleEntityNotFound(_0x247b6a,null))[_0xee57('0x27')](function(_0x4253b1){if(_0x4253b1){_0x22be85[_0xee57('0x54')][_0xee57('0x5e')]=_0x4253b1['id'];return db[_0xee57('0x5f')][_0xee57('0x4b')](_0x22be85[_0xee57('0x54')]);}})[_0xee57('0x27')](respondWithResult(_0x247b6a,null))[_0xee57('0x47')](handleError(_0x247b6a,null));};exports[_0xee57('0x60')]=function(_0x1d6405,_0x129738,_0x41a290){var _0x8d92b4={};var _0x59018b={};var _0x2927f8;var _0x2bbd61;return db[_0xee57('0x43')][_0xee57('0x5c')]({'where':{'id':_0x1d6405[_0xee57('0x48')]['id']}})[_0xee57('0x27')](handleEntityNotFound(_0x129738,null))[_0xee57('0x27')](function(_0xf8a65e){if(_0xf8a65e){_0x2927f8=_0xf8a65e;_0x59018b[_0xee57('0x2f')]=_[_0xee57('0x32')](db[_0xee57('0x5f')][_0xee57('0x2d')]);_0x59018b['query']=_[_0xee57('0x32')](_0x1d6405['query']);_0x59018b[_0xee57('0x33')]=_[_0xee57('0x34')](_0x59018b[_0xee57('0x2f')],_0x59018b[_0xee57('0x31')]);_0x8d92b4['attributes']=_['intersection'](_0x59018b['model'],qs[_0xee57('0x36')](_0x1d6405['query'][_0xee57('0x36')]));_0x8d92b4[_0xee57('0x35')]=_0x8d92b4[_0xee57('0x35')]['length']?_0x8d92b4['attributes']:_0x59018b[_0xee57('0x2f')];_0x8d92b4[_0xee57('0x3b')]=qs[_0xee57('0x3c')](_0x1d6405[_0xee57('0x31')][_0xee57('0x3c')]);_0x8d92b4['where']=qs[_0xee57('0x33')](_[_0xee57('0x3e')](_0x1d6405[_0xee57('0x31')],_0x59018b[_0xee57('0x33')]));if(_0x1d6405[_0xee57('0x31')][_0xee57('0x3f')]){_0x8d92b4[_0xee57('0x3d')]=_[_0xee57('0x40')](_0x8d92b4['where'],{'$or':_[_0xee57('0x30')](_0x8d92b4['attributes'],function(_0xca0a82){var _0x1b7dc0={};_0x1b7dc0[_0xca0a82]={'$like':'%'+_0x1d6405[_0xee57('0x31')]['filter']+'%'};return _0x1b7dc0;})});}_0x8d92b4=_['merge']({},_0x8d92b4,_0x1d6405[_0xee57('0x42')]);return _0x2927f8[_0xee57('0x60')](_0x8d92b4);}})[_0xee57('0x27')](function(_0x3f895c){if(_0x3f895c){_0x2bbd61=_0x3f895c['length'];if(!_0x1d6405['query']['hasOwnProperty']('nolimit')){_0x8d92b4[_0xee57('0x3a')]=qs['limit'](_0x1d6405[_0xee57('0x31')][_0xee57('0x3a')]);_0x8d92b4[_0xee57('0x1c')]=qs[_0xee57('0x1c')](_0x1d6405[_0xee57('0x31')][_0xee57('0x1c')]);}return _0x2927f8[_0xee57('0x60')](_0x8d92b4);}})[_0xee57('0x27')](function(_0x58f27d){if(_0x58f27d){return _0x58f27d?{'count':_0x2bbd61,'rows':_0x58f27d}:null;}})['then'](respondWithResult(_0x129738,null))[_0xee57('0x47')](handleError(_0x129738,null));}; \ No newline at end of file +var _0x23a3=['order','sort','where','pick','filter','merge','VIRTUAL','options','rows','catch','show','includeAll','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','TriggerAllId','Condition','addAnyCondition','TriggerAnyId','getAllConditions','getAnyConditions','findOne','addAction','TriggerId','Action','getActions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','sendStatus','status','end','json','limit','undefined','count','offset','set','apply','reject','update','destroy','get','Triggers','then','stack','name','send','index','map','Trigger','rawAttributes','type','key','model','keys','filters','attributes','intersection','query','fields','length','hasOwnProperty','nolimit'];(function(_0x395a88,_0x5a183a){var _0x35a044=function(_0x24829a){while(--_0x24829a){_0x395a88['push'](_0x395a88['shift']());}};_0x35a044(++_0x5a183a);}(_0x23a3,0x84));var _0x323a=function(_0x3c4047,_0x26c881){_0x3c4047=_0x3c4047-0x0;var _0xea78a2=_0x23a3[_0x3c4047];return _0xea78a2;};'use strict';var emlformat=require(_0x323a('0x0'));var rimraf=require(_0x323a('0x1'));var zipdir=require(_0x323a('0x2'));var jsonpatch=require(_0x323a('0x3'));var rp=require(_0x323a('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x323a('0x5'));var util=require('util');var path=require(_0x323a('0x6'));var sox=require(_0x323a('0x7'));var csv=require(_0x323a('0x8'));var ejs=require(_0x323a('0x9'));var fs=require('fs');var fs_extra=require(_0x323a('0xa'));var _=require(_0x323a('0xb'));var squel=require(_0x323a('0xc'));var crypto=require(_0x323a('0xd'));var jsforce=require(_0x323a('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x323a('0x8'));var querystring=require(_0x323a('0xf'));var Papa=require(_0x323a('0x10'));var Redis=require(_0x323a('0x11'));var authService=require(_0x323a('0x12'));var qs=require(_0x323a('0x13'));var as=require(_0x323a('0x14'));var hardwareService=require(_0x323a('0x15'));var logger=require(_0x323a('0x16'))('api');var utils=require(_0x323a('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x323a('0x18'))['db'];function respondWithStatusCode(_0x122462,_0x4dc274){_0x4dc274=_0x4dc274||0xcc;return function(_0x4697a3){if(_0x4697a3){return _0x122462[_0x323a('0x19')](_0x4dc274);}return _0x122462[_0x323a('0x1a')](_0x4dc274)[_0x323a('0x1b')]();};}function respondWithResult(_0x347e2b,_0x3b9236){_0x3b9236=_0x3b9236||0xc8;return function(_0x4d0cd5){if(_0x4d0cd5){return _0x347e2b['status'](_0x3b9236)[_0x323a('0x1c')](_0x4d0cd5);}};}function respondWithFilteredResult(_0x1ba0d2,_0x257f96){return function(_0x308d1e){if(_0x308d1e){var _0x38df4f=typeof _0x257f96['offset']==='undefined'&&typeof _0x257f96[_0x323a('0x1d')]===_0x323a('0x1e');var _0x4f28e8=_0x308d1e[_0x323a('0x1f')];var _0x1d432d=_0x38df4f?0x0:_0x257f96[_0x323a('0x20')];var _0x312370=_0x38df4f?_0x308d1e[_0x323a('0x1f')]:_0x257f96[_0x323a('0x20')]+_0x257f96[_0x323a('0x1d')];var _0x1c1d11;if(_0x312370>=_0x4f28e8){_0x312370=_0x4f28e8;_0x1c1d11=0xc8;}else{_0x1c1d11=0xce;}_0x1ba0d2[_0x323a('0x1a')](_0x1c1d11);return _0x1ba0d2[_0x323a('0x21')]('Content-Range',_0x1d432d+'-'+_0x312370+'/'+_0x4f28e8)[_0x323a('0x1c')](_0x308d1e);}return null;};}function patchUpdates(_0xb98e68){return function(_0x2fc7f6){try{jsonpatch[_0x323a('0x22')](_0x2fc7f6,_0xb98e68,!![]);}catch(_0x5b0ea9){return BPromise[_0x323a('0x23')](_0x5b0ea9);}return _0x2fc7f6['save']();};}function saveUpdates(_0x377d3c,_0x40d41a){return function(_0x305ac0){if(_0x305ac0){return _0x305ac0[_0x323a('0x24')](_0x377d3c)['then'](function(_0x1340aa){return _0x1340aa;});}return null;};}function removeEntity(_0x7f92f7,_0xa77adb){return function(_0x39a0bd){if(_0x39a0bd){return _0x39a0bd[_0x323a('0x25')]()['then'](function(){var _0x295e1c=_0x39a0bd[_0x323a('0x26')]({'plain':!![]});var _0x405672=_0x323a('0x27');return db['UserProfileResource'][_0x323a('0x25')]({'where':{'type':_0x405672,'resourceId':_0x295e1c['id']}})[_0x323a('0x28')](function(){return _0x39a0bd;});})[_0x323a('0x28')](function(){_0x7f92f7['status'](0xcc)[_0x323a('0x1b')]();});}};}function handleEntityNotFound(_0x55fe3d,_0x1b45a1){return function(_0x1db8aa){if(!_0x1db8aa){_0x55fe3d[_0x323a('0x19')](0x194);}return _0x1db8aa;};}function handleError(_0x3acd70,_0xd97319){_0xd97319=_0xd97319||0x1f4;return function(_0x3364b7){logger['error'](_0x3364b7[_0x323a('0x29')]);if(_0x3364b7['name']){delete _0x3364b7[_0x323a('0x2a')];}_0x3acd70[_0x323a('0x1a')](_0xd97319)[_0x323a('0x2b')](_0x3364b7);};}exports[_0x323a('0x2c')]=function(_0x584118,_0xb5420){var _0x4979e5={},_0x3f72e7={},_0x476949={'count':0x0,'rows':[]};var _0x590f00=_[_0x323a('0x2d')](db[_0x323a('0x2e')][_0x323a('0x2f')],function(_0x4de467){return{'name':_0x4de467['fieldName'],'type':_0x4de467[_0x323a('0x30')][_0x323a('0x31')]};});_0x3f72e7[_0x323a('0x32')]=_[_0x323a('0x2d')](_0x590f00,_0x323a('0x2a'));_0x3f72e7['query']=_[_0x323a('0x33')](_0x584118['query']);_0x3f72e7[_0x323a('0x34')]=_['intersection'](_0x3f72e7[_0x323a('0x32')],_0x3f72e7['query']);_0x4979e5[_0x323a('0x35')]=_[_0x323a('0x36')](_0x3f72e7[_0x323a('0x32')],qs['fields'](_0x584118[_0x323a('0x37')][_0x323a('0x38')]));_0x4979e5[_0x323a('0x35')]=_0x4979e5[_0x323a('0x35')][_0x323a('0x39')]?_0x4979e5[_0x323a('0x35')]:_0x3f72e7[_0x323a('0x32')];if(!_0x584118[_0x323a('0x37')][_0x323a('0x3a')](_0x323a('0x3b'))){_0x4979e5[_0x323a('0x1d')]=qs['limit'](_0x584118[_0x323a('0x37')][_0x323a('0x1d')]);_0x4979e5[_0x323a('0x20')]=qs[_0x323a('0x20')](_0x584118[_0x323a('0x37')]['offset']);}_0x4979e5[_0x323a('0x3c')]=qs[_0x323a('0x3d')](_0x584118['query'][_0x323a('0x3d')]);_0x4979e5[_0x323a('0x3e')]=qs['filters'](_[_0x323a('0x3f')](_0x584118['query'],_0x3f72e7[_0x323a('0x34')]),_0x590f00);if(_0x584118[_0x323a('0x37')][_0x323a('0x40')]){_0x4979e5[_0x323a('0x3e')]=_[_0x323a('0x41')](_0x4979e5['where'],{'$or':_[_0x323a('0x2d')](_0x590f00,function(_0x1f0bd3){if(_0x1f0bd3[_0x323a('0x30')]!==_0x323a('0x42')){var _0x7c052b={};_0x7c052b[_0x1f0bd3[_0x323a('0x2a')]]={'$like':'%'+_0x584118['query'][_0x323a('0x40')]+'%'};return _0x7c052b;}})});}_0x4979e5=_['merge']({},_0x4979e5,_0x584118[_0x323a('0x43')]);var _0x4d0409={'where':_0x4979e5[_0x323a('0x3e')]};return db['Trigger'][_0x323a('0x1f')](_0x4d0409)[_0x323a('0x28')](function(_0x4b2938){_0x476949['count']=_0x4b2938;if(_0x584118[_0x323a('0x37')]['includeAll']){_0x4979e5['include']=[{'all':!![]}];}return db[_0x323a('0x2e')]['findAll'](_0x4979e5);})[_0x323a('0x28')](function(_0x1e93c2){_0x476949[_0x323a('0x44')]=_0x1e93c2;return _0x476949;})[_0x323a('0x28')](respondWithFilteredResult(_0xb5420,_0x4979e5))[_0x323a('0x45')](handleError(_0xb5420,null));};exports[_0x323a('0x46')]=function(_0x4dcc75,_0x520724){var _0x2e4dd6={'raw':![],'where':{'id':_0x4dcc75['params']['id']}},_0x11c247={};_0x11c247[_0x323a('0x32')]=_[_0x323a('0x33')](db[_0x323a('0x2e')][_0x323a('0x2f')]);_0x11c247[_0x323a('0x37')]=_['keys'](_0x4dcc75[_0x323a('0x37')]);_0x11c247[_0x323a('0x34')]=_[_0x323a('0x36')](_0x11c247[_0x323a('0x32')],_0x11c247[_0x323a('0x37')]);_0x2e4dd6['attributes']=_[_0x323a('0x36')](_0x11c247[_0x323a('0x32')],qs[_0x323a('0x38')](_0x4dcc75[_0x323a('0x37')]['fields']));_0x2e4dd6[_0x323a('0x35')]=_0x2e4dd6[_0x323a('0x35')][_0x323a('0x39')]?_0x2e4dd6['attributes']:_0x11c247['model'];if(_0x4dcc75[_0x323a('0x37')][_0x323a('0x47')]){_0x2e4dd6[_0x323a('0x48')]=[{'all':!![]}];}_0x2e4dd6=_[_0x323a('0x41')]({},_0x2e4dd6,_0x4dcc75['options']);return db[_0x323a('0x2e')][_0x323a('0x49')](_0x2e4dd6)[_0x323a('0x28')](handleEntityNotFound(_0x520724,null))[_0x323a('0x28')](respondWithResult(_0x520724,null))[_0x323a('0x45')](handleError(_0x520724,null));};exports[_0x323a('0x4a')]=function(_0x14cd5c,_0x1bfcc9){return db[_0x323a('0x2e')][_0x323a('0x4a')](_0x14cd5c[_0x323a('0x4b')],{})[_0x323a('0x28')](function(_0x12bb60){var _0x566d9d=_0x14cd5c[_0x323a('0x4c')][_0x323a('0x26')]({'plain':!![]});if(!_0x566d9d)throw new Error(_0x323a('0x4d'));if(_0x566d9d[_0x323a('0x4e')]==='user'){var _0x4f612a=_0x12bb60[_0x323a('0x26')]({'plain':!![]});var _0x5cd868=_0x323a('0x27');return db[_0x323a('0x4f')][_0x323a('0x49')]({'where':{'name':_0x5cd868,'userProfileId':_0x566d9d[_0x323a('0x50')]},'raw':!![]})[_0x323a('0x28')](function(_0x32a28e){if(_0x32a28e&&_0x32a28e[_0x323a('0x51')]===0x0){return db[_0x323a('0x52')][_0x323a('0x4a')]({'name':_0x4f612a[_0x323a('0x2a')],'resourceId':_0x4f612a['id'],'type':_0x32a28e[_0x323a('0x2a')],'sectionId':_0x32a28e['id']},{})[_0x323a('0x28')](function(){return _0x12bb60;});}else{return _0x12bb60;}})['catch'](function(_0x4db18c){logger['error'](_0x323a('0x53'),_0x4db18c);throw _0x4db18c;});}return _0x12bb60;})['then'](respondWithResult(_0x1bfcc9,0xc9))['catch'](handleError(_0x1bfcc9,null));};exports[_0x323a('0x24')]=function(_0x63c6f5,_0x1b0fde){if(_0x63c6f5[_0x323a('0x4b')]['id']){delete _0x63c6f5[_0x323a('0x4b')]['id'];}return db[_0x323a('0x2e')][_0x323a('0x49')]({'where':{'id':_0x63c6f5[_0x323a('0x54')]['id']}})['then'](handleEntityNotFound(_0x1b0fde,null))[_0x323a('0x28')](saveUpdates(_0x63c6f5[_0x323a('0x4b')],null))[_0x323a('0x28')](respondWithResult(_0x1b0fde,null))[_0x323a('0x45')](handleError(_0x1b0fde,null));};exports[_0x323a('0x25')]=function(_0x372273,_0xd5b37f){return db[_0x323a('0x2e')][_0x323a('0x49')]({'where':{'id':_0x372273[_0x323a('0x54')]['id']}})['then'](handleEntityNotFound(_0xd5b37f,null))[_0x323a('0x28')](removeEntity(_0xd5b37f,null))[_0x323a('0x45')](handleError(_0xd5b37f,null));};exports['addAllCondition']=function(_0x425b95,_0x577f6f,_0x2792cb){if(_0x425b95[_0x323a('0x4b')]['id']){delete _0x425b95['body']['id'];}return db[_0x323a('0x2e')][_0x323a('0x49')]({'where':{'id':_0x425b95['params']['id']}})[_0x323a('0x28')](handleEntityNotFound(_0x577f6f,null))[_0x323a('0x28')](function(_0x127382){if(_0x127382){_0x425b95[_0x323a('0x4b')][_0x323a('0x55')]=_0x127382['id'];return db[_0x323a('0x56')][_0x323a('0x4a')](_0x425b95[_0x323a('0x4b')]);}})[_0x323a('0x28')](respondWithResult(_0x577f6f,null))[_0x323a('0x45')](handleError(_0x577f6f,null));};exports[_0x323a('0x57')]=function(_0x2a3c60,_0x4d11bd,_0x2a99cc){if(_0x2a3c60['body']['id']){delete _0x2a3c60[_0x323a('0x4b')]['id'];}return db[_0x323a('0x2e')]['find']({'where':{'id':_0x2a3c60[_0x323a('0x54')]['id']}})['then'](handleEntityNotFound(_0x4d11bd,null))['then'](function(_0x179a02){if(_0x179a02){_0x2a3c60['body'][_0x323a('0x58')]=_0x179a02['id'];return db['Condition']['create'](_0x2a3c60[_0x323a('0x4b')]);}})[_0x323a('0x28')](respondWithResult(_0x4d11bd,null))['catch'](handleError(_0x4d11bd,null));};exports['getAllConditions']=function(_0xd52dff,_0x3cffe9,_0x10270b){var _0x531f72={};var _0x549055={};var _0x288932;var _0x407e1a;return db[_0x323a('0x2e')]['findOne']({'where':{'id':_0xd52dff[_0x323a('0x54')]['id']}})[_0x323a('0x28')](handleEntityNotFound(_0x3cffe9,null))['then'](function(_0x13896c){if(_0x13896c){_0x288932=_0x13896c;_0x549055['model']=_['keys'](db[_0x323a('0x56')][_0x323a('0x2f')]);_0x549055[_0x323a('0x37')]=_['keys'](_0xd52dff[_0x323a('0x37')]);_0x549055[_0x323a('0x34')]=_[_0x323a('0x36')](_0x549055[_0x323a('0x32')],_0x549055[_0x323a('0x37')]);_0x531f72[_0x323a('0x35')]=_['intersection'](_0x549055[_0x323a('0x32')],qs[_0x323a('0x38')](_0xd52dff[_0x323a('0x37')]['fields']));_0x531f72[_0x323a('0x35')]=_0x531f72[_0x323a('0x35')][_0x323a('0x39')]?_0x531f72[_0x323a('0x35')]:_0x549055[_0x323a('0x32')];_0x531f72[_0x323a('0x3c')]=qs[_0x323a('0x3d')](_0xd52dff[_0x323a('0x37')][_0x323a('0x3d')]);_0x531f72[_0x323a('0x3e')]=qs[_0x323a('0x34')](_['pick'](_0xd52dff[_0x323a('0x37')],_0x549055[_0x323a('0x34')]));if(_0xd52dff['query'][_0x323a('0x40')]){_0x531f72[_0x323a('0x3e')]=_[_0x323a('0x41')](_0x531f72['where'],{'$or':_[_0x323a('0x2d')](_0x531f72[_0x323a('0x35')],function(_0x2e1145){var _0x4ef239={};_0x4ef239[_0x2e1145]={'$like':'%'+_0xd52dff[_0x323a('0x37')][_0x323a('0x40')]+'%'};return _0x4ef239;})});}_0x531f72=_['merge']({},_0x531f72,_0xd52dff['options']);return _0x288932['getAllConditions'](_0x531f72);}})['then'](function(_0x1648b1){if(_0x1648b1){_0x407e1a=_0x1648b1[_0x323a('0x39')];if(!_0xd52dff[_0x323a('0x37')][_0x323a('0x3a')](_0x323a('0x3b'))){_0x531f72['limit']=qs[_0x323a('0x1d')](_0xd52dff[_0x323a('0x37')][_0x323a('0x1d')]);_0x531f72[_0x323a('0x20')]=qs[_0x323a('0x20')](_0xd52dff[_0x323a('0x37')]['offset']);}return _0x288932[_0x323a('0x59')](_0x531f72);}})[_0x323a('0x28')](function(_0x167582){if(_0x167582){return _0x167582?{'count':_0x407e1a,'rows':_0x167582}:null;}})[_0x323a('0x28')](respondWithResult(_0x3cffe9,null))['catch'](handleError(_0x3cffe9,null));};exports[_0x323a('0x5a')]=function(_0x3a1770,_0x2d4739,_0x5a4151){var _0x5273f0={};var _0x548673={};var _0x145bbb;var _0x57028b;return db[_0x323a('0x2e')][_0x323a('0x5b')]({'where':{'id':_0x3a1770[_0x323a('0x54')]['id']}})[_0x323a('0x28')](handleEntityNotFound(_0x2d4739,null))[_0x323a('0x28')](function(_0x259467){if(_0x259467){_0x145bbb=_0x259467;_0x548673[_0x323a('0x32')]=_[_0x323a('0x33')](db['Condition']['rawAttributes']);_0x548673['query']=_[_0x323a('0x33')](_0x3a1770[_0x323a('0x37')]);_0x548673['filters']=_['intersection'](_0x548673[_0x323a('0x32')],_0x548673['query']);_0x5273f0[_0x323a('0x35')]=_[_0x323a('0x36')](_0x548673['model'],qs['fields'](_0x3a1770[_0x323a('0x37')][_0x323a('0x38')]));_0x5273f0[_0x323a('0x35')]=_0x5273f0[_0x323a('0x35')][_0x323a('0x39')]?_0x5273f0[_0x323a('0x35')]:_0x548673[_0x323a('0x32')];_0x5273f0['order']=qs[_0x323a('0x3d')](_0x3a1770['query'][_0x323a('0x3d')]);_0x5273f0['where']=qs[_0x323a('0x34')](_[_0x323a('0x3f')](_0x3a1770[_0x323a('0x37')],_0x548673[_0x323a('0x34')]));if(_0x3a1770[_0x323a('0x37')][_0x323a('0x40')]){_0x5273f0[_0x323a('0x3e')]=_[_0x323a('0x41')](_0x5273f0['where'],{'$or':_[_0x323a('0x2d')](_0x5273f0[_0x323a('0x35')],function(_0x485c22){var _0x43f671={};_0x43f671[_0x485c22]={'$like':'%'+_0x3a1770[_0x323a('0x37')][_0x323a('0x40')]+'%'};return _0x43f671;})});}_0x5273f0=_['merge']({},_0x5273f0,_0x3a1770[_0x323a('0x43')]);return _0x145bbb[_0x323a('0x5a')](_0x5273f0);}})[_0x323a('0x28')](function(_0xb292a0){if(_0xb292a0){_0x57028b=_0xb292a0[_0x323a('0x39')];if(!_0x3a1770[_0x323a('0x37')][_0x323a('0x3a')](_0x323a('0x3b'))){_0x5273f0[_0x323a('0x1d')]=qs[_0x323a('0x1d')](_0x3a1770[_0x323a('0x37')][_0x323a('0x1d')]);_0x5273f0[_0x323a('0x20')]=qs['offset'](_0x3a1770[_0x323a('0x37')][_0x323a('0x20')]);}return _0x145bbb[_0x323a('0x5a')](_0x5273f0);}})['then'](function(_0x2a64a9){if(_0x2a64a9){return _0x2a64a9?{'count':_0x57028b,'rows':_0x2a64a9}:null;}})[_0x323a('0x28')](respondWithResult(_0x2d4739,null))['catch'](handleError(_0x2d4739,null));};exports[_0x323a('0x5c')]=function(_0x17c706,_0x1d9ad3,_0x29dcef){if(_0x17c706[_0x323a('0x4b')]['id']){delete _0x17c706[_0x323a('0x4b')]['id'];}return db[_0x323a('0x2e')][_0x323a('0x49')]({'where':{'id':_0x17c706['params']['id']}})[_0x323a('0x28')](handleEntityNotFound(_0x1d9ad3,null))['then'](function(_0x54eff0){if(_0x54eff0){_0x17c706['body'][_0x323a('0x5d')]=_0x54eff0['id'];return db[_0x323a('0x5e')][_0x323a('0x4a')](_0x17c706[_0x323a('0x4b')]);}})['then'](respondWithResult(_0x1d9ad3,null))[_0x323a('0x45')](handleError(_0x1d9ad3,null));};exports['getActions']=function(_0xcffd4c,_0x42c6f4,_0x36a0b5){var _0x552c19={};var _0x30be2a={};var _0x2f4f22;var _0x470def;return db[_0x323a('0x2e')]['findOne']({'where':{'id':_0xcffd4c['params']['id']}})[_0x323a('0x28')](handleEntityNotFound(_0x42c6f4,null))[_0x323a('0x28')](function(_0x4af855){if(_0x4af855){_0x2f4f22=_0x4af855;_0x30be2a[_0x323a('0x32')]=_[_0x323a('0x33')](db[_0x323a('0x5e')][_0x323a('0x2f')]);_0x30be2a[_0x323a('0x37')]=_['keys'](_0xcffd4c[_0x323a('0x37')]);_0x30be2a['filters']=_[_0x323a('0x36')](_0x30be2a[_0x323a('0x32')],_0x30be2a[_0x323a('0x37')]);_0x552c19['attributes']=_[_0x323a('0x36')](_0x30be2a[_0x323a('0x32')],qs[_0x323a('0x38')](_0xcffd4c[_0x323a('0x37')][_0x323a('0x38')]));_0x552c19[_0x323a('0x35')]=_0x552c19[_0x323a('0x35')][_0x323a('0x39')]?_0x552c19['attributes']:_0x30be2a[_0x323a('0x32')];_0x552c19[_0x323a('0x3c')]=qs[_0x323a('0x3d')](_0xcffd4c[_0x323a('0x37')][_0x323a('0x3d')]);_0x552c19[_0x323a('0x3e')]=qs[_0x323a('0x34')](_['pick'](_0xcffd4c['query'],_0x30be2a['filters']));if(_0xcffd4c[_0x323a('0x37')]['filter']){_0x552c19[_0x323a('0x3e')]=_[_0x323a('0x41')](_0x552c19[_0x323a('0x3e')],{'$or':_[_0x323a('0x2d')](_0x552c19['attributes'],function(_0x5c1d94){var _0x6ba692={};_0x6ba692[_0x5c1d94]={'$like':'%'+_0xcffd4c[_0x323a('0x37')]['filter']+'%'};return _0x6ba692;})});}_0x552c19=_['merge']({},_0x552c19,_0xcffd4c['options']);return _0x2f4f22['getActions'](_0x552c19);}})[_0x323a('0x28')](function(_0x17f666){if(_0x17f666){_0x470def=_0x17f666['length'];if(!_0xcffd4c[_0x323a('0x37')][_0x323a('0x3a')](_0x323a('0x3b'))){_0x552c19[_0x323a('0x1d')]=qs[_0x323a('0x1d')](_0xcffd4c[_0x323a('0x37')][_0x323a('0x1d')]);_0x552c19['offset']=qs['offset'](_0xcffd4c[_0x323a('0x37')][_0x323a('0x20')]);}return _0x2f4f22[_0x323a('0x5f')](_0x552c19);}})[_0x323a('0x28')](function(_0x1d5da7){if(_0x1d5da7){return _0x1d5da7?{'count':_0x470def,'rows':_0x1d5da7}:null;}})[_0x323a('0x28')](respondWithResult(_0x42c6f4,null))['catch'](handleError(_0x42c6f4,null));}; \ No newline at end of file diff --git a/server/api/trigger/trigger.model.js b/server/api/trigger/trigger.model.js index 3e21ea2..08bee32 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 _0x8135=['moment','request-promise','path','rimraf','../../config/environment','./trigger.attributes','define','Trigger','tools_triggers','util','../../config/logger','api'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x8135,0x99));var _0x5813=function(_0x46c688,_0x32ee64){_0x46c688=_0x46c688-0x0;var _0x17b5d3=_0x8135[_0x46c688];return _0x17b5d3;};'use strict';var _=require('lodash');var util=require(_0x5813('0x0'));var logger=require(_0x5813('0x1'))(_0x5813('0x2'));var moment=require(_0x5813('0x3'));var BPromise=require('bluebird');var rp=require(_0x5813('0x4'));var fs=require('fs');var path=require(_0x5813('0x5'));var rimraf=require(_0x5813('0x6'));var config=require(_0x5813('0x7'));var attributes=require(_0x5813('0x8'));module['exports']=function(_0x57ac38,_0x27599d){return _0x57ac38[_0x5813('0x9')](_0x5813('0xa'),attributes,{'tableName':_0x5813('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6b19=['api','request-promise','path','rimraf','../../config/environment','./trigger.attributes','define','lodash','util'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x6b19,0xe8));var _0x96b1=function(_0x3ffb74,_0x436c05){_0x3ffb74=_0x3ffb74-0x0;var _0x455d34=_0x6b19[_0x3ffb74];return _0x455d34;};'use strict';var _=require(_0x96b1('0x0'));var util=require(_0x96b1('0x1'));var logger=require('../../config/logger')(_0x96b1('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x96b1('0x3'));var fs=require('fs');var path=require(_0x96b1('0x4'));var rimraf=require(_0x96b1('0x5'));var config=require(_0x96b1('0x6'));var attributes=require(_0x96b1('0x7'));module['exports']=function(_0x8b5ab8,_0x546193){return _0x8b5ab8[_0x96b1('0x8')]('Trigger',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 de39935..999eaa7 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 _0xc208=['error','message','result','catch','GetTrigger','Trigger','findAll','options','raw','where','limit','include','map','model','attributes','then','ShowTrigger','find','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','Trigger,\x20%s,\x20%s','debug','Trigger,\x20%s,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x55e66e,_0x2413f7){var _0x19f51e=function(_0x4d8184){while(--_0x4d8184){_0x55e66e['push'](_0x55e66e['shift']());}};_0x19f51e(++_0x2413f7);}(_0xc208,0xa2));var _0x8c20=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xc208[_0x2dafbe];return _0x58a45a;};'use strict';var _=require(_0x8c20('0x0'));var util=require(_0x8c20('0x1'));var moment=require('moment');var BPromise=require(_0x8c20('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8c20('0x3'));var db=require(_0x8c20('0x4'))['db'];var utils=require(_0x8c20('0x5'));var logger=require(_0x8c20('0x6'))(_0x8c20('0x7'));var config=require(_0x8c20('0x8'));var jayson=require(_0x8c20('0x9'));var client=jayson['client'][_0x8c20('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x133e4d,_0xab6920,_0x1f5fce){return new BPromise(function(_0xd33651,_0x10abea){return client[_0x8c20('0xb')](_0x133e4d,_0x1f5fce)['then'](function(_0x253ddd){logger[_0x8c20('0xc')](_0x8c20('0xd'),_0xab6920,'request\x20sent');logger[_0x8c20('0xe')](_0x8c20('0xf'),_0xab6920,_0x8c20('0x10'),JSON[_0x8c20('0x11')](_0x253ddd));if(_0x253ddd[_0x8c20('0x12')]){if(_0x253ddd[_0x8c20('0x12')]['code']===0x1f4){logger['error']('Trigger,\x20%s,\x20%s',_0xab6920,_0x253ddd[_0x8c20('0x12')][_0x8c20('0x13')]);return _0x10abea(_0x253ddd[_0x8c20('0x12')][_0x8c20('0x13')]);}logger['error'](_0x8c20('0xd'),_0xab6920,_0x253ddd[_0x8c20('0x12')][_0x8c20('0x13')]);return _0xd33651(_0x253ddd['error'][_0x8c20('0x13')]);}else{logger[_0x8c20('0xc')]('Trigger,\x20%s,\x20%s',_0xab6920,_0x8c20('0x10'));_0xd33651(_0x253ddd[_0x8c20('0x14')][_0x8c20('0x13')]);}})[_0x8c20('0x15')](function(_0x539e71){logger[_0x8c20('0x12')](_0x8c20('0xd'),_0xab6920,_0x539e71);_0x10abea(_0x539e71);});});}exports[_0x8c20('0x16')]=function(_0x1c6c98){var _0x2c0808=this;return new Promise(function(_0x1d40f5,_0x1b661f){return db[_0x8c20('0x17')][_0x8c20('0x18')]({'raw':_0x1c6c98['options']?_0x1c6c98[_0x8c20('0x19')][_0x8c20('0x1a')]===undefined?!![]:![]:!![],'where':_0x1c6c98[_0x8c20('0x19')]?_0x1c6c98[_0x8c20('0x19')][_0x8c20('0x1b')]||null:null,'attributes':_0x1c6c98[_0x8c20('0x19')]?_0x1c6c98[_0x8c20('0x19')]['attributes']||null:null,'limit':_0x1c6c98['options']?_0x1c6c98['options'][_0x8c20('0x1c')]||null:null,'include':_0x1c6c98[_0x8c20('0x19')]?_0x1c6c98[_0x8c20('0x19')][_0x8c20('0x1d')]?_[_0x8c20('0x1e')](_0x1c6c98[_0x8c20('0x19')][_0x8c20('0x1d')],function(_0x3e92b9){return{'model':db[_0x3e92b9[_0x8c20('0x1f')]],'as':_0x3e92b9['as'],'attributes':_0x3e92b9[_0x8c20('0x20')],'include':_0x3e92b9[_0x8c20('0x1d')]?_[_0x8c20('0x1e')](_0x3e92b9[_0x8c20('0x1d')],function(_0x1fe58d){return{'model':db[_0x1fe58d[_0x8c20('0x1f')]],'as':_0x1fe58d['as'],'attributes':_0x1fe58d[_0x8c20('0x20')],'include':_0x1fe58d[_0x8c20('0x1d')]?_[_0x8c20('0x1e')](_0x1fe58d['include'],function(_0xc8d972){return{'model':db[_0xc8d972['model']],'as':_0xc8d972['as'],'attributes':_0xc8d972['attributes']};}):[]};}):[]};}):[]:[]})[_0x8c20('0x21')](function(_0x2f2e99){logger[_0x8c20('0xc')](_0x8c20('0x16'),_0x1c6c98);logger[_0x8c20('0xe')](_0x8c20('0x16'),_0x1c6c98,JSON['stringify'](_0x2f2e99));_0x1d40f5(_0x2f2e99);})[_0x8c20('0x15')](function(_0x2d7b24){logger['error'](_0x8c20('0x16'),_0x2d7b24[_0x8c20('0x13')],_0x1c6c98);_0x1b661f(_0x2c0808[_0x8c20('0x12')](0x1f4,_0x2d7b24[_0x8c20('0x13')]));});});};exports[_0x8c20('0x22')]=function(_0x404d16){var _0x127dfe=this;return new Promise(function(_0xe259d5,_0x47cc5c){return db['Trigger'][_0x8c20('0x23')]({'raw':_0x404d16[_0x8c20('0x19')]?_0x404d16[_0x8c20('0x19')][_0x8c20('0x1a')]===undefined?!![]:![]:!![],'where':_0x404d16[_0x8c20('0x19')]?_0x404d16[_0x8c20('0x19')]['where']||null:null,'attributes':_0x404d16['options']?_0x404d16['options'][_0x8c20('0x20')]||null:null,'include':_0x404d16['options']?_0x404d16[_0x8c20('0x19')][_0x8c20('0x1d')]?_[_0x8c20('0x1e')](_0x404d16[_0x8c20('0x19')][_0x8c20('0x1d')],function(_0x4aeb61){return{'model':db[_0x4aeb61[_0x8c20('0x1f')]],'as':_0x4aeb61['as'],'attributes':_0x4aeb61[_0x8c20('0x20')],'include':_0x4aeb61[_0x8c20('0x1d')]?_[_0x8c20('0x1e')](_0x4aeb61[_0x8c20('0x1d')],function(_0x40a95e){return{'model':db[_0x40a95e[_0x8c20('0x1f')]],'as':_0x40a95e['as'],'attributes':_0x40a95e['attributes'],'include':_0x40a95e[_0x8c20('0x1d')]?_['map'](_0x40a95e[_0x8c20('0x1d')],function(_0x4a32f7){return{'model':db[_0x4a32f7['model']],'as':_0x4a32f7['as'],'attributes':_0x4a32f7[_0x8c20('0x20')]};}):[]};}):[]};}):[]:[]})[_0x8c20('0x21')](function(_0x543b73){logger[_0x8c20('0xc')](_0x8c20('0x22'),_0x404d16);logger[_0x8c20('0xe')]('ShowTrigger',_0x404d16,JSON['stringify'](_0x543b73));_0xe259d5(_0x543b73);})[_0x8c20('0x15')](function(_0xbb6cff){logger[_0x8c20('0x12')]('ShowTrigger',_0xbb6cff[_0x8c20('0x13')],_0x404d16);_0x47cc5c(_0x127dfe[_0x8c20('0x12')](0x1f4,_0xbb6cff[_0x8c20('0x13')]));});});}; \ No newline at end of file +var _0x190c=['lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','then','Trigger,\x20%s,\x20%s','request\x20sent','Trigger,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','GetTrigger','findAll','options','raw','where','include','map','model','attributes','ShowTrigger','find','debug'];(function(_0x4a453d,_0x3fdf57){var _0x2d4dda=function(_0x440db1){while(--_0x440db1){_0x4a453d['push'](_0x4a453d['shift']());}};_0x2d4dda(++_0x3fdf57);}(_0x190c,0xa5));var _0xc190=function(_0x52e68e,_0x309912){_0x52e68e=_0x52e68e-0x0;var _0x3211a4=_0x190c[_0x52e68e];return _0x3211a4;};'use strict';var _=require(_0xc190('0x0'));var util=require(_0xc190('0x1'));var moment=require(_0xc190('0x2'));var BPromise=require(_0xc190('0x3'));var rs=require(_0xc190('0x4'));var fs=require('fs');var Redis=require(_0xc190('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xc190('0x6'));var logger=require(_0xc190('0x7'))(_0xc190('0x8'));var config=require('../../config/environment');var jayson=require(_0xc190('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0xaad716,_0x4af6b0,_0x447c2f){return new BPromise(function(_0x1b5005,_0x52edb8){return client['request'](_0xaad716,_0x447c2f)[_0xc190('0xa')](function(_0xf352ea){logger['info'](_0xc190('0xb'),_0x4af6b0,_0xc190('0xc'));logger['debug'](_0xc190('0xd'),_0x4af6b0,_0xc190('0xc'),JSON[_0xc190('0xe')](_0xf352ea));if(_0xf352ea[_0xc190('0xf')]){if(_0xf352ea[_0xc190('0xf')][_0xc190('0x10')]===0x1f4){logger[_0xc190('0xf')](_0xc190('0xb'),_0x4af6b0,_0xf352ea[_0xc190('0xf')]['message']);return _0x52edb8(_0xf352ea[_0xc190('0xf')][_0xc190('0x11')]);}logger['error'](_0xc190('0xb'),_0x4af6b0,_0xf352ea[_0xc190('0xf')][_0xc190('0x11')]);return _0x1b5005(_0xf352ea['error'][_0xc190('0x11')]);}else{logger[_0xc190('0x12')](_0xc190('0xb'),_0x4af6b0,_0xc190('0xc'));_0x1b5005(_0xf352ea[_0xc190('0x13')]['message']);}})[_0xc190('0x14')](function(_0x16b70b){logger['error'](_0xc190('0xb'),_0x4af6b0,_0x16b70b);_0x52edb8(_0x16b70b);});});}exports[_0xc190('0x15')]=function(_0x3f0fac){var _0x4ecf35=this;return new Promise(function(_0x4ca9ce,_0x3f8455){return db['Trigger'][_0xc190('0x16')]({'raw':_0x3f0fac[_0xc190('0x17')]?_0x3f0fac['options'][_0xc190('0x18')]===undefined?!![]:![]:!![],'where':_0x3f0fac[_0xc190('0x17')]?_0x3f0fac[_0xc190('0x17')][_0xc190('0x19')]||null:null,'attributes':_0x3f0fac[_0xc190('0x17')]?_0x3f0fac[_0xc190('0x17')]['attributes']||null:null,'limit':_0x3f0fac[_0xc190('0x17')]?_0x3f0fac[_0xc190('0x17')]['limit']||null:null,'include':_0x3f0fac[_0xc190('0x17')]?_0x3f0fac[_0xc190('0x17')][_0xc190('0x1a')]?_[_0xc190('0x1b')](_0x3f0fac[_0xc190('0x17')][_0xc190('0x1a')],function(_0x52f4ea){return{'model':db[_0x52f4ea[_0xc190('0x1c')]],'as':_0x52f4ea['as'],'attributes':_0x52f4ea[_0xc190('0x1d')],'include':_0x52f4ea[_0xc190('0x1a')]?_[_0xc190('0x1b')](_0x52f4ea['include'],function(_0x232708){return{'model':db[_0x232708[_0xc190('0x1c')]],'as':_0x232708['as'],'attributes':_0x232708['attributes'],'include':_0x232708[_0xc190('0x1a')]?_[_0xc190('0x1b')](_0x232708[_0xc190('0x1a')],function(_0x4512fc){return{'model':db[_0x4512fc['model']],'as':_0x4512fc['as'],'attributes':_0x4512fc[_0xc190('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xc190('0xa')](function(_0x36e0b3){logger[_0xc190('0x12')](_0xc190('0x15'),_0x3f0fac);logger['debug'](_0xc190('0x15'),_0x3f0fac,JSON[_0xc190('0xe')](_0x36e0b3));_0x4ca9ce(_0x36e0b3);})['catch'](function(_0x23230c){logger[_0xc190('0xf')]('GetTrigger',_0x23230c['message'],_0x3f0fac);_0x3f8455(_0x4ecf35[_0xc190('0xf')](0x1f4,_0x23230c[_0xc190('0x11')]));});});};exports[_0xc190('0x1e')]=function(_0x484feb){var _0x14c7d8=this;return new Promise(function(_0x521759,_0x1a3f90){return db['Trigger'][_0xc190('0x1f')]({'raw':_0x484feb[_0xc190('0x17')]?_0x484feb['options'][_0xc190('0x18')]===undefined?!![]:![]:!![],'where':_0x484feb[_0xc190('0x17')]?_0x484feb['options'][_0xc190('0x19')]||null:null,'attributes':_0x484feb[_0xc190('0x17')]?_0x484feb['options'][_0xc190('0x1d')]||null:null,'include':_0x484feb[_0xc190('0x17')]?_0x484feb['options'][_0xc190('0x1a')]?_[_0xc190('0x1b')](_0x484feb[_0xc190('0x17')][_0xc190('0x1a')],function(_0x5d562f){return{'model':db[_0x5d562f[_0xc190('0x1c')]],'as':_0x5d562f['as'],'attributes':_0x5d562f['attributes'],'include':_0x5d562f[_0xc190('0x1a')]?_[_0xc190('0x1b')](_0x5d562f[_0xc190('0x1a')],function(_0x28effd){return{'model':db[_0x28effd[_0xc190('0x1c')]],'as':_0x28effd['as'],'attributes':_0x28effd['attributes'],'include':_0x28effd[_0xc190('0x1a')]?_[_0xc190('0x1b')](_0x28effd[_0xc190('0x1a')],function(_0x311bb5){return{'model':db[_0x311bb5['model']],'as':_0x311bb5['as'],'attributes':_0x311bb5['attributes']};}):[]};}):[]};}):[]:[]})[_0xc190('0xa')](function(_0x499943){logger[_0xc190('0x12')](_0xc190('0x1e'),_0x484feb);logger[_0xc190('0x20')]('ShowTrigger',_0x484feb,JSON['stringify'](_0x499943));_0x521759(_0x499943);})['catch'](function(_0x3d3b38){logger[_0xc190('0xf')](_0xc190('0x1e'),_0x3d3b38['message'],_0x484feb);_0x1a3f90(_0x14c7d8['error'](0x1f4,_0x3d3b38[_0xc190('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/trunk/index.js b/server/api/trunk/index.js index 469715f..72482b4 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 _0x66d6=['delete','destroy','exports','multer','path','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/:id','show','post','/:id/clone','clone','create'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x66d6,0x153));var _0x666d=function(_0x5497d3,_0x193adf){_0x5497d3=_0x5497d3-0x0;var _0x42f1ef=_0x66d6[_0x5497d3];return _0x42f1ef;};'use strict';var multer=require(_0x666d('0x0'));var util=require('util');var path=require(_0x666d('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x666d('0x2'));var interaction=require('../../components/interaction/service');var config=require(_0x666d('0x3'));var controller=require('./trunk.controller');router[_0x666d('0x4')]('/',auth[_0x666d('0x5')](),controller[_0x666d('0x6')]);router[_0x666d('0x4')](_0x666d('0x7'),auth[_0x666d('0x5')](),controller[_0x666d('0x8')]);router[_0x666d('0x9')](_0x666d('0xa'),auth[_0x666d('0x5')](),controller[_0x666d('0xb')]);router[_0x666d('0x9')]('/',auth['isAuthenticated'](),controller[_0x666d('0xc')]);router['put'](_0x666d('0x7'),auth[_0x666d('0x5')](),controller['update']);router[_0x666d('0xd')]('/:id',auth[_0x666d('0x5')](),controller[_0x666d('0xe')]);module[_0x666d('0xf')]=router; \ No newline at end of file +var _0x6450=['fs-extra','../../components/interaction/service','../../config/environment','./trunk.controller','get','isAuthenticated','index','/:id','show','post','/:id/clone','create','put','update','delete','exports','util','connect-timeout','express','Router'];(function(_0x4a5fbc,_0x518ede){var _0x4207c0=function(_0x3669e5){while(--_0x3669e5){_0x4a5fbc['push'](_0x4a5fbc['shift']());}};_0x4207c0(++_0x518ede);}(_0x6450,0x88));var _0x0645=function(_0x15866e,_0x1eafc3){_0x15866e=_0x15866e-0x0;var _0x56a44c=_0x6450[_0x15866e];return _0x56a44c;};'use strict';var multer=require('multer');var util=require(_0x0645('0x0'));var path=require('path');var timeout=require(_0x0645('0x1'));var express=require(_0x0645('0x2'));var router=express[_0x0645('0x3')]();var fs_extra=require(_0x0645('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x0645('0x5'));var config=require(_0x0645('0x6'));var controller=require(_0x0645('0x7'));router[_0x0645('0x8')]('/',auth[_0x0645('0x9')](),controller[_0x0645('0xa')]);router[_0x0645('0x8')](_0x0645('0xb'),auth[_0x0645('0x9')](),controller[_0x0645('0xc')]);router[_0x0645('0xd')](_0x0645('0xe'),auth['isAuthenticated'](),controller['clone']);router['post']('/',auth[_0x0645('0x9')](),controller[_0x0645('0xf')]);router[_0x0645('0x10')](_0x0645('0xb'),auth[_0x0645('0x9')](),controller[_0x0645('0x11')]);router[_0x0645('0x12')](_0x0645('0xb'),auth[_0x0645('0x9')](),controller['destroy']);module[_0x0645('0x13')]=router; \ No newline at end of file diff --git a/server/api/trunk/trunk.attributes.js b/server/api/trunk/trunk.attributes.js index 9e35ce3..a76e5bf 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 _0x9b55=['String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','allow','ulaw;alaw;gsm','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]','port,invite','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','INTEGER','\x22\x22\x20<>','always','originate','uac','uas','pai','passive','nonat','update,nonat','sequelize','exports','STRING','name','ENUM','peer','from-voip-provider','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','PROHIB_NOT_SCREENED','PROHIB_FAILED_SCREEN','PROHIB','transport','join','getDataValue','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','info','auto','rfc2833','yes','update','outgoing','force_rport,comedia','setDataValue','nat'];(function(_0x7f9224,_0x186851){var _0x3bc305=function(_0x35c046){while(--_0x35c046){_0x7f9224['push'](_0x7f9224['shift']());}};_0x3bc305(++_0x186851);}(_0x9b55,0x155));var _0x59b5=function(_0x33fa0b,_0x5d48b6){_0x33fa0b=_0x33fa0b-0x0;var _0x4e17a8=_0x9b55[_0x33fa0b];return _0x4e17a8;};'use strict';var Sequelize=require(_0x59b5('0x0'));module[_0x59b5('0x1')]={'name':{'type':Sequelize[_0x59b5('0x2')],'allowNull':![],'unique':_0x59b5('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x59b5('0x4')]('friend','user',_0x59b5('0x5')),'allowNull':![],'defaultValue':'friend'},'context':{'type':Sequelize[_0x59b5('0x2')],'allowNull':![],'defaultValue':_0x59b5('0x6')},'callingpres':{'type':Sequelize[_0x59b5('0x4')](_0x59b5('0x7'),_0x59b5('0x8'),_0x59b5('0x9'),'ALLOWED',_0x59b5('0xa'),'PROHIB_PASSED_SCREEN',_0x59b5('0xb'),_0x59b5('0xc'))},'deny':{'type':Sequelize['STRING']},'permit':{'type':Sequelize[_0x59b5('0x2')]},'secret':{'type':Sequelize[_0x59b5('0x2')]},'md5secret':{'type':Sequelize[_0x59b5('0x2')]},'remotesecret':{'type':Sequelize[_0x59b5('0x2')]},'transport':{'type':Sequelize[_0x59b5('0x2')],'defaultValue':'udp','set':function(_0xddffad){this['setDataValue'](_0x59b5('0xd'),_0xddffad?_0xddffad[_0x59b5('0xe')](','):null);},'get':function(){return this['getDataValue'](_0x59b5('0xd'))?this[_0x59b5('0xf')](_0x59b5('0xd'))[_0x59b5('0x10')](','):null;},'comment':_0x59b5('0x11')},'dtmfmode':{'type':Sequelize[_0x59b5('0x4')]('rfc2833',_0x59b5('0x12'),'shortinfo','inband',_0x59b5('0x13')),'defaultValue':_0x59b5('0x14')},'directmedia':{'type':Sequelize[_0x59b5('0x4')](_0x59b5('0x15'),'no','nonat',_0x59b5('0x16'),_0x59b5('0x17')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x59b5('0x4')]('yes','no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize['STRING']},'directmediadeny':{'type':Sequelize[_0x59b5('0x2')]},'nat':{'type':Sequelize[_0x59b5('0x2')],'defaultValue':_0x59b5('0x18'),'set':function(_0x1b6525){this[_0x59b5('0x19')](_0x59b5('0x1a'),_0x1b6525?_0x1b6525[_0x59b5('0xe')](','):null);},'get':function(){return this[_0x59b5('0xf')]('nat')?this['getDataValue'](_0x59b5('0x1a'))[_0x59b5('0x10')](','):null;},'comment':_0x59b5('0x1b')},'callgroup':{'type':Sequelize[_0x59b5('0x2')]},'namedcallgroup':{'type':Sequelize[_0x59b5('0x2')]},'pickupgroup':{'type':Sequelize[_0x59b5('0x2')]},'namedpickupgroup':{'type':Sequelize[_0x59b5('0x2')]},'language':{'type':Sequelize[_0x59b5('0x2')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x59b5('0x2')],'allowNull':!![]},'disallow':{'type':Sequelize[_0x59b5('0x2')],'defaultValue':_0x59b5('0x1c')},'allow':{'type':Sequelize[_0x59b5('0x2')],'allowNull':![],'defaultValue':'ulaw;alaw;gsm','set':function(_0xd8facb){this[_0x59b5('0x19')](_0x59b5('0x1d'),_0xd8facb?_0xd8facb[_0x59b5('0xe')](';'):_0x59b5('0x1e'));},'get':function(){return this[_0x59b5('0xf')](_0x59b5('0x1d'))?this['getDataValue'](_0x59b5('0x1d'))[_0x59b5('0x10')](';'):null;},'comment':_0x59b5('0x1f')},'autoframing':{'type':Sequelize['ENUM']('yes','no')},'insecure':{'type':Sequelize[_0x59b5('0x2')],'defaultValue':_0x59b5('0x20'),'set':function(_0x2a2a21){this['setDataValue'](_0x59b5('0x21'),_0x2a2a21?_0x2a2a21[_0x59b5('0xe')](','):null);},'get':function(){return this['getDataValue'](_0x59b5('0x21'))?this[_0x59b5('0xf')](_0x59b5('0x21'))['split'](','):null;},'comment':_0x59b5('0x22')},'trustrpid':{'type':Sequelize[_0x59b5('0x4')](_0x59b5('0x15'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize['ENUM'](_0x59b5('0x15'),'no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x59b5('0x4')](_0x59b5('0x15'),'no',_0x59b5('0x23'))},'promiscredir':{'type':Sequelize[_0x59b5('0x4')](_0x59b5('0x15'),'no')},'useclientcode':{'type':Sequelize[_0x59b5('0x4')](_0x59b5('0x15'),'no')},'accountcode':{'type':Sequelize[_0x59b5('0x24')](0xb)},'setvar':{'type':Sequelize[_0x59b5('0x2')]},'callerid':{'type':Sequelize['STRING'],'defaultValue':_0x59b5('0x25')},'amaflags':{'type':Sequelize['STRING']},'callcounter':{'type':Sequelize[_0x59b5('0x4')](_0x59b5('0x15'),'no'),'defaultValue':_0x59b5('0x15')},'busylevel':{'type':Sequelize[_0x59b5('0x24')](0xb)},'allowoverlap':{'type':Sequelize[_0x59b5('0x4')]('yes','no')},'allowsubscribe':{'type':Sequelize['ENUM'](_0x59b5('0x15'),'no')},'allowtransfer':{'type':Sequelize['ENUM'](_0x59b5('0x15'),'no')},'ignoresdpversion':{'type':Sequelize[_0x59b5('0x4')]('yes','no')},'subscribecontext':{'type':Sequelize[_0x59b5('0x2')]},'template':{'type':Sequelize['STRING']},'videosupport':{'type':Sequelize[_0x59b5('0x4')]('yes','no',_0x59b5('0x26')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x59b5('0x24')](0xb)},'rfc2833compensate':{'type':Sequelize['ENUM'](_0x59b5('0x15'),'no')},'mailbox':{'type':Sequelize['STRING']},'session_timers':{'type':Sequelize['ENUM']('accept','refuse',_0x59b5('0x27'))},'session_expires':{'type':Sequelize[_0x59b5('0x24')](0xb)},'session_minse':{'type':Sequelize[_0x59b5('0x24')](0xb)},'session_refresher':{'type':Sequelize[_0x59b5('0x4')](_0x59b5('0x28'),_0x59b5('0x29')),'defaultValue':'uas'},'t38pt_usertpsource':{'type':Sequelize['STRING']},'regexten':{'type':Sequelize[_0x59b5('0x2')]},'fromdomain':{'type':Sequelize[_0x59b5('0x2')]},'fromuser':{'type':Sequelize[_0x59b5('0x2')]},'port':{'type':Sequelize[_0x59b5('0x24')](0x5)},'qualify':{'type':Sequelize[_0x59b5('0x4')](_0x59b5('0x15'),'no'),'defaultValue':_0x59b5('0x15')},'keepalive':{'type':Sequelize[_0x59b5('0x24')](0xb)},'defaultip':{'type':Sequelize[_0x59b5('0x2')]},'defaultuser':{'type':Sequelize[_0x59b5('0x2')]},'rtptimeout':{'type':Sequelize['INTEGER'](0xb)},'rtpholdtimeout':{'type':Sequelize[_0x59b5('0x24')](0xb)},'rtpkeepalive':{'type':Sequelize['INTEGER'](0xb)},'sendrpid':{'type':Sequelize[_0x59b5('0x4')]('yes','no',_0x59b5('0x2a')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x59b5('0x2')]},'callbackextension':{'type':Sequelize['STRING']},'timert1':{'type':Sequelize['INTEGER'](0xb)},'timerb':{'type':Sequelize[_0x59b5('0x24')](0xb)},'qualifyfreq':{'type':Sequelize[_0x59b5('0x24')](0xb)},'contactpermit':{'type':Sequelize[_0x59b5('0x2')]},'contactdeny':{'type':Sequelize[_0x59b5('0x2')]},'contactacl':{'type':Sequelize[_0x59b5('0x2')]},'unsolicited_mailbox':{'type':Sequelize[_0x59b5('0x2')]},'use_q850_reason':{'type':Sequelize[_0x59b5('0x2')]},'maxforwards':{'type':Sequelize[_0x59b5('0x24')](0xb)},'encryption':{'type':Sequelize[_0x59b5('0x4')]('yes','no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0x59b5('0x4')](_0x59b5('0x15'),'no')},'force_avp':{'type':Sequelize['ENUM'](_0x59b5('0x15'),'no')},'icesupport':{'type':Sequelize[_0x59b5('0x4')](_0x59b5('0x15'),'no')},'dtlsenable':{'type':Sequelize['ENUM']('yes','no')},'dtlsverify':{'type':Sequelize[_0x59b5('0x4')](_0x59b5('0x15'),'no','fingerprint','certificate')},'dtlsrekey':{'type':Sequelize[_0x59b5('0x24')](0xb)},'dtlscertfile':{'type':Sequelize[_0x59b5('0x2')]},'dtlsprivatekey':{'type':Sequelize[_0x59b5('0x2')]},'dtlscipher':{'type':Sequelize[_0x59b5('0x2')]},'dtlscafile':{'type':Sequelize[_0x59b5('0x2')]},'dtlscapath':{'type':Sequelize['STRING']},'dtlssetup':{'type':Sequelize[_0x59b5('0x4')]('active',_0x59b5('0x2b'),'actpass'),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x59b5('0x2')]},'usereqphone':{'type':Sequelize[_0x59b5('0x4')](_0x59b5('0x15'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x59b5('0x2')]},'recordofffeature':{'type':Sequelize[_0x59b5('0x2')]},'call_limit':{'type':Sequelize[_0x59b5('0x24')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize['ENUM'](_0x59b5('0x15'),'no')},'subscribemwi':{'type':Sequelize['ENUM'](_0x59b5('0x15'),'no')},'vmexten':{'type':Sequelize[_0x59b5('0x2')]},'mohinterpret':{'type':Sequelize[_0x59b5('0x2')]},'mohsuggest':{'type':Sequelize[_0x59b5('0x2')]},'parkinglot':{'type':Sequelize[_0x59b5('0x2')]},'description':{'type':Sequelize[_0x59b5('0x2')]},'host':{'type':Sequelize[_0x59b5('0x2')],'defaultValue':'dynamic'},'canreinvite':{'type':Sequelize[_0x59b5('0x4')](_0x59b5('0x15'),'no',_0x59b5('0x2c'),_0x59b5('0x16'),_0x59b5('0x2d')),'defaultValue':'no'},'registry':{'type':Sequelize[_0x59b5('0x2')]},'otherFields':{'type':Sequelize['STRING']},'active':{'type':Sequelize['BOOLEAN'],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize['STRING'],'defaultValue':'no'}}; \ No newline at end of file +var _0x2402=['force_rport,comedia','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','ulaw;alaw;gsm','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','INTEGER','\x22\x22\x20<>','always','refuse','originate','uac','uas','certificate','active','passive','actpass','dynamic','update','update,nonat','sequelize','exports','STRING','name','friend','user','peer','from-voip-provider','ENUM','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_FAILED_SCREEN','PROHIB','udp','setDataValue','transport','join','getDataValue','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','shortinfo','auto','nonat','outgoing','yes'];(function(_0x3f7dc7,_0x5022e0){var _0xf47427=function(_0x3a75d5){while(--_0x3a75d5){_0x3f7dc7['push'](_0x3f7dc7['shift']());}};_0xf47427(++_0x5022e0);}(_0x2402,0x184));var _0x2240=function(_0x4d08b6,_0x53db38){_0x4d08b6=_0x4d08b6-0x0;var _0x4e8c5d=_0x2402[_0x4d08b6];return _0x4e8c5d;};'use strict';var Sequelize=require(_0x2240('0x0'));module[_0x2240('0x1')]={'name':{'type':Sequelize[_0x2240('0x2')],'allowNull':![],'unique':_0x2240('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize['ENUM'](_0x2240('0x4'),_0x2240('0x5'),_0x2240('0x6')),'allowNull':![],'defaultValue':_0x2240('0x4')},'context':{'type':Sequelize[_0x2240('0x2')],'allowNull':![],'defaultValue':_0x2240('0x7')},'callingpres':{'type':Sequelize[_0x2240('0x8')](_0x2240('0x9'),_0x2240('0xa'),_0x2240('0xb'),_0x2240('0xc'),_0x2240('0xd'),'PROHIB_PASSED_SCREEN',_0x2240('0xe'),_0x2240('0xf'))},'deny':{'type':Sequelize['STRING']},'permit':{'type':Sequelize[_0x2240('0x2')]},'secret':{'type':Sequelize[_0x2240('0x2')]},'md5secret':{'type':Sequelize[_0x2240('0x2')]},'remotesecret':{'type':Sequelize['STRING']},'transport':{'type':Sequelize[_0x2240('0x2')],'defaultValue':_0x2240('0x10'),'set':function(_0x338a80){this[_0x2240('0x11')](_0x2240('0x12'),_0x338a80?_0x338a80[_0x2240('0x13')](','):null);},'get':function(){return this[_0x2240('0x14')](_0x2240('0x12'))?this['getDataValue'](_0x2240('0x12'))['split'](','):null;},'comment':_0x2240('0x15')},'dtmfmode':{'type':Sequelize['ENUM'](_0x2240('0x16'),'info',_0x2240('0x17'),'inband',_0x2240('0x18')),'defaultValue':_0x2240('0x16')},'directmedia':{'type':Sequelize[_0x2240('0x8')]('yes','no',_0x2240('0x19'),'update',_0x2240('0x1a')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize['ENUM'](_0x2240('0x1b'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x2240('0x2')]},'directmediadeny':{'type':Sequelize['STRING']},'nat':{'type':Sequelize[_0x2240('0x2')],'defaultValue':_0x2240('0x1c'),'set':function(_0x5e329f){this['setDataValue']('nat',_0x5e329f?_0x5e329f[_0x2240('0x13')](','):null);},'get':function(){return this[_0x2240('0x14')]('nat')?this[_0x2240('0x14')]('nat')[_0x2240('0x1d')](','):null;},'comment':_0x2240('0x1e')},'callgroup':{'type':Sequelize[_0x2240('0x2')]},'namedcallgroup':{'type':Sequelize['STRING']},'pickupgroup':{'type':Sequelize[_0x2240('0x2')]},'namedpickupgroup':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x2240('0x2')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x2240('0x2')],'allowNull':!![]},'disallow':{'type':Sequelize[_0x2240('0x2')],'defaultValue':_0x2240('0x1f')},'allow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x2240('0x20'),'set':function(_0xd06129){this['setDataValue'](_0x2240('0x21'),_0xd06129?_0xd06129[_0x2240('0x13')](';'):_0x2240('0x20'));},'get':function(){return this[_0x2240('0x14')](_0x2240('0x21'))?this['getDataValue'](_0x2240('0x21'))[_0x2240('0x1d')](';'):null;},'comment':_0x2240('0x22')},'autoframing':{'type':Sequelize[_0x2240('0x8')](_0x2240('0x1b'),'no')},'insecure':{'type':Sequelize[_0x2240('0x2')],'defaultValue':'port,invite','set':function(_0x4053ee){this[_0x2240('0x11')](_0x2240('0x23'),_0x4053ee?_0x4053ee[_0x2240('0x13')](','):null);},'get':function(){return this[_0x2240('0x14')]('insecure')?this[_0x2240('0x14')](_0x2240('0x23'))[_0x2240('0x1d')](','):null;},'comment':_0x2240('0x24')},'trustrpid':{'type':Sequelize[_0x2240('0x8')](_0x2240('0x1b'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x2240('0x8')](_0x2240('0x1b'),'no'),'defaultValue':'no'},'progressinband':{'type':Sequelize['ENUM']('yes','no',_0x2240('0x25'))},'promiscredir':{'type':Sequelize[_0x2240('0x8')](_0x2240('0x1b'),'no')},'useclientcode':{'type':Sequelize[_0x2240('0x8')](_0x2240('0x1b'),'no')},'accountcode':{'type':Sequelize[_0x2240('0x26')](0xb)},'setvar':{'type':Sequelize[_0x2240('0x2')]},'callerid':{'type':Sequelize['STRING'],'defaultValue':_0x2240('0x27')},'amaflags':{'type':Sequelize[_0x2240('0x2')]},'callcounter':{'type':Sequelize[_0x2240('0x8')](_0x2240('0x1b'),'no'),'defaultValue':_0x2240('0x1b')},'busylevel':{'type':Sequelize[_0x2240('0x26')](0xb)},'allowoverlap':{'type':Sequelize['ENUM'](_0x2240('0x1b'),'no')},'allowsubscribe':{'type':Sequelize[_0x2240('0x8')](_0x2240('0x1b'),'no')},'allowtransfer':{'type':Sequelize[_0x2240('0x8')](_0x2240('0x1b'),'no')},'ignoresdpversion':{'type':Sequelize[_0x2240('0x8')](_0x2240('0x1b'),'no')},'subscribecontext':{'type':Sequelize[_0x2240('0x2')]},'template':{'type':Sequelize['STRING']},'videosupport':{'type':Sequelize[_0x2240('0x8')](_0x2240('0x1b'),'no',_0x2240('0x28')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x2240('0x26')](0xb)},'rfc2833compensate':{'type':Sequelize['ENUM'](_0x2240('0x1b'),'no')},'mailbox':{'type':Sequelize['STRING']},'session_timers':{'type':Sequelize[_0x2240('0x8')]('accept',_0x2240('0x29'),_0x2240('0x2a'))},'session_expires':{'type':Sequelize[_0x2240('0x26')](0xb)},'session_minse':{'type':Sequelize[_0x2240('0x26')](0xb)},'session_refresher':{'type':Sequelize[_0x2240('0x8')](_0x2240('0x2b'),_0x2240('0x2c')),'defaultValue':'uas'},'t38pt_usertpsource':{'type':Sequelize[_0x2240('0x2')]},'regexten':{'type':Sequelize[_0x2240('0x2')]},'fromdomain':{'type':Sequelize[_0x2240('0x2')]},'fromuser':{'type':Sequelize[_0x2240('0x2')]},'port':{'type':Sequelize[_0x2240('0x26')](0x5)},'qualify':{'type':Sequelize[_0x2240('0x8')]('yes','no'),'defaultValue':_0x2240('0x1b')},'keepalive':{'type':Sequelize['INTEGER'](0xb)},'defaultip':{'type':Sequelize[_0x2240('0x2')]},'defaultuser':{'type':Sequelize[_0x2240('0x2')]},'rtptimeout':{'type':Sequelize[_0x2240('0x26')](0xb)},'rtpholdtimeout':{'type':Sequelize[_0x2240('0x26')](0xb)},'rtpkeepalive':{'type':Sequelize['INTEGER'](0xb)},'sendrpid':{'type':Sequelize[_0x2240('0x8')](_0x2240('0x1b'),'no','pai'),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x2240('0x2')]},'callbackextension':{'type':Sequelize[_0x2240('0x2')]},'timert1':{'type':Sequelize[_0x2240('0x26')](0xb)},'timerb':{'type':Sequelize[_0x2240('0x26')](0xb)},'qualifyfreq':{'type':Sequelize['INTEGER'](0xb)},'contactpermit':{'type':Sequelize[_0x2240('0x2')]},'contactdeny':{'type':Sequelize[_0x2240('0x2')]},'contactacl':{'type':Sequelize[_0x2240('0x2')]},'unsolicited_mailbox':{'type':Sequelize[_0x2240('0x2')]},'use_q850_reason':{'type':Sequelize['STRING']},'maxforwards':{'type':Sequelize['INTEGER'](0xb)},'encryption':{'type':Sequelize[_0x2240('0x8')]('yes','no'),'defaultValue':'no'},'avpf':{'type':Sequelize['ENUM'](_0x2240('0x1b'),'no')},'force_avp':{'type':Sequelize[_0x2240('0x8')](_0x2240('0x1b'),'no')},'icesupport':{'type':Sequelize['ENUM'](_0x2240('0x1b'),'no')},'dtlsenable':{'type':Sequelize[_0x2240('0x8')](_0x2240('0x1b'),'no')},'dtlsverify':{'type':Sequelize[_0x2240('0x8')](_0x2240('0x1b'),'no','fingerprint',_0x2240('0x2d'))},'dtlsrekey':{'type':Sequelize[_0x2240('0x26')](0xb)},'dtlscertfile':{'type':Sequelize[_0x2240('0x2')]},'dtlsprivatekey':{'type':Sequelize[_0x2240('0x2')]},'dtlscipher':{'type':Sequelize['STRING']},'dtlscafile':{'type':Sequelize[_0x2240('0x2')]},'dtlscapath':{'type':Sequelize['STRING']},'dtlssetup':{'type':Sequelize['ENUM'](_0x2240('0x2e'),_0x2240('0x2f'),_0x2240('0x30')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x2240('0x2')]},'usereqphone':{'type':Sequelize[_0x2240('0x8')](_0x2240('0x1b'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x2240('0x2')]},'recordofffeature':{'type':Sequelize[_0x2240('0x2')]},'call_limit':{'type':Sequelize[_0x2240('0x26')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize[_0x2240('0x8')](_0x2240('0x1b'),'no')},'subscribemwi':{'type':Sequelize[_0x2240('0x8')](_0x2240('0x1b'),'no')},'vmexten':{'type':Sequelize[_0x2240('0x2')]},'mohinterpret':{'type':Sequelize[_0x2240('0x2')]},'mohsuggest':{'type':Sequelize[_0x2240('0x2')]},'parkinglot':{'type':Sequelize[_0x2240('0x2')]},'description':{'type':Sequelize[_0x2240('0x2')]},'host':{'type':Sequelize[_0x2240('0x2')],'defaultValue':_0x2240('0x31')},'canreinvite':{'type':Sequelize[_0x2240('0x8')](_0x2240('0x1b'),'no',_0x2240('0x19'),_0x2240('0x32'),_0x2240('0x33')),'defaultValue':'no'},'registry':{'type':Sequelize[_0x2240('0x2')]},'otherFields':{'type':Sequelize[_0x2240('0x2')]},'active':{'type':Sequelize['BOOLEAN'],'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 c0e5800..d40fd11 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 _0x24ca=['lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','client','http','request','info','Trunk,\x20%s,\x20%s','Trunk,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','get','Trunks','UserProfileResource','destroy','then','end','name','send','map','Trunk','fieldName','type','key','model','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','catch','params','rawAttributes','keys','find','clone','length','omit','createdAt','updatedAt','create','user','role','userProfileId','autoAssociation','body','join','root','server/files/templates/trunk.ejs','readFileSync','server/files/templates/registry.ejs','utf8','writeFileSync','registry','render','/etc/asterisk/sip_xcally_registers.conf','Reload','chan_sip.so','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','/etc/asterisk/sip_xcally_trunks.conf','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra'];(function(_0x310152,_0x5d25e1){var _0x2bc39e=function(_0x430a8f){while(--_0x430a8f){_0x310152['push'](_0x310152['shift']());}};_0x2bc39e(++_0x5d25e1);}(_0x24ca,0x1bc));var _0xa24c=function(_0x4be8ba,_0x5d10ba){_0x4be8ba=_0x4be8ba-0x0;var _0x1af822=_0x24ca[_0x4be8ba];return _0x1af822;};'use strict';var emlformat=require(_0xa24c('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xa24c('0x1'));var jsonpatch=require(_0xa24c('0x2'));var rp=require(_0xa24c('0x3'));var moment=require('moment');var BPromise=require(_0xa24c('0x4'));var Mustache=require(_0xa24c('0x5'));var util=require(_0xa24c('0x6'));var path=require(_0xa24c('0x7'));var sox=require(_0xa24c('0x8'));var csv=require(_0xa24c('0x9'));var ejs=require(_0xa24c('0xa'));var fs=require('fs');var fs_extra=require(_0xa24c('0xb'));var _=require(_0xa24c('0xc'));var squel=require(_0xa24c('0xd'));var crypto=require(_0xa24c('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xa24c('0xf'));var toCsv=require(_0xa24c('0x9'));var querystring=require(_0xa24c('0x10'));var Papa=require('papaparse');var Redis=require(_0xa24c('0x11'));var authService=require(_0xa24c('0x12'));var qs=require(_0xa24c('0x13'));var as=require(_0xa24c('0x14'));var hardwareService=require(_0xa24c('0x15'));var logger=require(_0xa24c('0x16'))(_0xa24c('0x17'));var utils=require(_0xa24c('0x18'));var config=require(_0xa24c('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0xa24c('0x1a'))['db'];var jayson=require(_0xa24c('0x1b'));var client=jayson[_0xa24c('0x1c')][_0xa24c('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x5a9486,_0x3ad0bf,_0x3c23fc,_0x26ff28){return new BPromise(function(_0x2fcd8b,_0x1cb08e){var _0x2d185c=_0x26ff28||client;return _0x2d185c[_0xa24c('0x1e')](_0x5a9486,_0x3c23fc)['then'](function(_0x47a063){logger[_0xa24c('0x1f')](_0xa24c('0x20'),_0x3ad0bf,'request\x20sent');logger['debug'](_0xa24c('0x21'),_0x3ad0bf,_0xa24c('0x22'),JSON['stringify'](_0x47a063));if(_0x47a063[_0xa24c('0x23')]){if(_0x47a063['error'][_0xa24c('0x24')]===0x1f4){logger[_0xa24c('0x23')](_0xa24c('0x20'),_0x3ad0bf,_0x47a063[_0xa24c('0x23')]['message']);return _0x1cb08e(_0x47a063[_0xa24c('0x23')][_0xa24c('0x25')]);}logger[_0xa24c('0x23')]('Trunk,\x20%s,\x20%s',_0x3ad0bf,_0x47a063['error']['message']);return _0x2fcd8b(_0x47a063['error'][_0xa24c('0x25')]);}else{logger[_0xa24c('0x1f')](_0xa24c('0x20'),_0x3ad0bf,_0xa24c('0x22'));_0x2fcd8b(_0x47a063['result'][_0xa24c('0x25')]);}})['catch'](function(_0x224bca){logger[_0xa24c('0x23')]('Trunk,\x20%s,\x20%s',_0x3ad0bf,_0x224bca);_0x1cb08e(_0x224bca);});});}function respondWithStatusCode(_0x346ee8,_0x363d52){_0x363d52=_0x363d52||0xcc;return function(_0x43a0c0){if(_0x43a0c0){return _0x346ee8[_0xa24c('0x26')](_0x363d52);}return _0x346ee8[_0xa24c('0x27')](_0x363d52)['end']();};}function respondWithResult(_0xec9167,_0x5cc9cb){_0x5cc9cb=_0x5cc9cb||0xc8;return function(_0x2365f9){if(_0x2365f9){return _0xec9167[_0xa24c('0x27')](_0x5cc9cb)[_0xa24c('0x28')](_0x2365f9);}};}function respondWithFilteredResult(_0x51dc3f,_0x1beb55){return function(_0x31c4d9){if(_0x31c4d9){var _0x14fd5a=typeof _0x1beb55[_0xa24c('0x29')]===_0xa24c('0x2a')&&typeof _0x1beb55[_0xa24c('0x2b')]===_0xa24c('0x2a');var _0x5b23f4=_0x31c4d9[_0xa24c('0x2c')];var _0x28675f=_0x14fd5a?0x0:_0x1beb55[_0xa24c('0x29')];var _0x12dbdc=_0x14fd5a?_0x31c4d9['count']:_0x1beb55[_0xa24c('0x29')]+_0x1beb55[_0xa24c('0x2b')];var _0x97c08;if(_0x12dbdc>=_0x5b23f4){_0x12dbdc=_0x5b23f4;_0x97c08=0xc8;}else{_0x97c08=0xce;}_0x51dc3f['status'](_0x97c08);return _0x51dc3f[_0xa24c('0x2d')](_0xa24c('0x2e'),_0x28675f+'-'+_0x12dbdc+'/'+_0x5b23f4)[_0xa24c('0x28')](_0x31c4d9);}return null;};}function patchUpdates(_0x4ae35c){return function(_0x245fb2){try{jsonpatch['apply'](_0x245fb2,_0x4ae35c,!![]);}catch(_0x1102ab){return BPromise[_0xa24c('0x2f')](_0x1102ab);}return _0x245fb2[_0xa24c('0x30')]();};}function saveUpdates(_0x5d025a,_0x1f52f8){return function(_0x53f90){if(_0x53f90){return _0x53f90[_0xa24c('0x31')](_0x5d025a)['then'](function(_0x1c1ed3){return _0x1c1ed3;});}return null;};}function removeEntity(_0x57c340,_0xa20091){return function(_0x42ba21){if(_0x42ba21){return _0x42ba21['destroy']()['then'](function(){var _0x20a276=_0x42ba21[_0xa24c('0x32')]({'plain':!![]});var _0x182e86=_0xa24c('0x33');return db[_0xa24c('0x34')][_0xa24c('0x35')]({'where':{'type':_0x182e86,'resourceId':_0x20a276['id']}})[_0xa24c('0x36')](function(){return _0x42ba21;});})['then'](function(){_0x57c340[_0xa24c('0x27')](0xcc)[_0xa24c('0x37')]();});}};}function handleEntityNotFound(_0x12825d,_0xbd24c0){return function(_0xc6337b){if(!_0xc6337b){_0x12825d[_0xa24c('0x26')](0x194);}return _0xc6337b;};}function handleError(_0x86902f,_0x81d471){_0x81d471=_0x81d471||0x1f4;return function(_0x1ea166){logger[_0xa24c('0x23')](_0x1ea166['stack']);if(_0x1ea166[_0xa24c('0x38')]){delete _0x1ea166[_0xa24c('0x38')];}_0x86902f[_0xa24c('0x27')](_0x81d471)[_0xa24c('0x39')](_0x1ea166);};}exports['index']=function(_0x56a485,_0x19a65f){var _0x56ef4d={},_0xb690b5={},_0x13f272={'count':0x0,'rows':[]};var _0x22a316=_[_0xa24c('0x3a')](db[_0xa24c('0x3b')]['rawAttributes'],function(_0x532875){return{'name':_0x532875[_0xa24c('0x3c')],'type':_0x532875[_0xa24c('0x3d')][_0xa24c('0x3e')]};});_0xb690b5[_0xa24c('0x3f')]=_[_0xa24c('0x3a')](_0x22a316,_0xa24c('0x38'));_0xb690b5['query']=_['keys'](_0x56a485[_0xa24c('0x40')]);_0xb690b5[_0xa24c('0x41')]=_[_0xa24c('0x42')](_0xb690b5[_0xa24c('0x3f')],_0xb690b5[_0xa24c('0x40')]);_0x56ef4d['attributes']=_[_0xa24c('0x42')](_0xb690b5[_0xa24c('0x3f')],qs['fields'](_0x56a485['query'][_0xa24c('0x43')]));_0x56ef4d[_0xa24c('0x44')]=_0x56ef4d[_0xa24c('0x44')]['length']?_0x56ef4d['attributes']:_0xb690b5[_0xa24c('0x3f')];if(!_0x56a485[_0xa24c('0x40')][_0xa24c('0x45')](_0xa24c('0x46'))){_0x56ef4d[_0xa24c('0x2b')]=qs[_0xa24c('0x2b')](_0x56a485[_0xa24c('0x40')][_0xa24c('0x2b')]);_0x56ef4d['offset']=qs['offset'](_0x56a485[_0xa24c('0x40')][_0xa24c('0x29')]);}_0x56ef4d[_0xa24c('0x47')]=qs['sort'](_0x56a485[_0xa24c('0x40')][_0xa24c('0x48')]);_0x56ef4d[_0xa24c('0x49')]=qs[_0xa24c('0x41')](_[_0xa24c('0x4a')](_0x56a485[_0xa24c('0x40')],_0xb690b5[_0xa24c('0x41')]),_0x22a316);if(_0x56a485[_0xa24c('0x40')][_0xa24c('0x4b')]){_0x56ef4d[_0xa24c('0x49')]=_['merge'](_0x56ef4d[_0xa24c('0x49')],{'$or':_[_0xa24c('0x3a')](_0x22a316,function(_0x39a6cd){if(_0x39a6cd['type']!==_0xa24c('0x4c')){var _0x247d2c={};_0x247d2c[_0x39a6cd[_0xa24c('0x38')]]={'$like':'%'+_0x56a485[_0xa24c('0x40')][_0xa24c('0x4b')]+'%'};return _0x247d2c;}})});}_0x56ef4d=_[_0xa24c('0x4d')]({},_0x56ef4d,_0x56a485[_0xa24c('0x4e')]);var _0x46f725={'where':_0x56ef4d[_0xa24c('0x49')]};return db[_0xa24c('0x3b')][_0xa24c('0x2c')](_0x46f725)['then'](function(_0x29a84d){_0x13f272[_0xa24c('0x2c')]=_0x29a84d;if(_0x56a485[_0xa24c('0x40')][_0xa24c('0x4f')]){_0x56ef4d[_0xa24c('0x50')]=[{'all':!![]}];}return db[_0xa24c('0x3b')][_0xa24c('0x51')](_0x56ef4d);})[_0xa24c('0x36')](function(_0x184179){_0x13f272['rows']=_0x184179;return _0x13f272;})['then'](respondWithFilteredResult(_0x19a65f,_0x56ef4d))[_0xa24c('0x52')](handleError(_0x19a65f,null));};exports['show']=function(_0xc078ef,_0x1f436c){var _0x4ec677={'raw':![],'where':{'id':_0xc078ef[_0xa24c('0x53')]['id']}},_0x24b3df={};_0x24b3df[_0xa24c('0x3f')]=_['keys'](db['Trunk'][_0xa24c('0x54')]);_0x24b3df['query']=_[_0xa24c('0x55')](_0xc078ef[_0xa24c('0x40')]);_0x24b3df[_0xa24c('0x41')]=_[_0xa24c('0x42')](_0x24b3df[_0xa24c('0x3f')],_0x24b3df[_0xa24c('0x40')]);_0x4ec677[_0xa24c('0x44')]=_[_0xa24c('0x42')](_0x24b3df[_0xa24c('0x3f')],qs[_0xa24c('0x43')](_0xc078ef['query'][_0xa24c('0x43')]));_0x4ec677[_0xa24c('0x44')]=_0x4ec677[_0xa24c('0x44')]['length']?_0x4ec677['attributes']:_0x24b3df['model'];if(_0xc078ef[_0xa24c('0x40')]['includeAll']){_0x4ec677[_0xa24c('0x50')]=[{'all':!![]}];}_0x4ec677=_[_0xa24c('0x4d')]({},_0x4ec677,_0xc078ef['options']);return db[_0xa24c('0x3b')][_0xa24c('0x56')](_0x4ec677)[_0xa24c('0x36')](handleEntityNotFound(_0x1f436c,null))[_0xa24c('0x36')](respondWithResult(_0x1f436c,null))[_0xa24c('0x52')](handleError(_0x1f436c,null));};exports[_0xa24c('0x57')]=function(_0x3816f7,_0xbeab78){var _0x518c2a={'where':{'id':_0x3816f7['params']['id']}},_0x172645={};_0x172645['model']=_['keys'](db['Trunk']['rawAttributes']);_0x518c2a[_0xa24c('0x44')]=_['intersection'](_0x172645[_0xa24c('0x3f')],qs[_0xa24c('0x43')](_0x3816f7[_0xa24c('0x40')][_0xa24c('0x43')]));_0x518c2a[_0xa24c('0x44')]=_0x518c2a[_0xa24c('0x44')][_0xa24c('0x58')]?_0x518c2a[_0xa24c('0x44')]:_0x172645[_0xa24c('0x3f')];if(_0x3816f7[_0xa24c('0x40')][_0xa24c('0x4f')]){_0x518c2a[_0xa24c('0x50')]=[{'all':!![]}];}_0x518c2a=_[_0xa24c('0x4d')]({},_0x518c2a,_0x3816f7[_0xa24c('0x4e')]);return db[_0xa24c('0x3b')]['find'](_0x518c2a)[_0xa24c('0x36')](handleEntityNotFound(_0xbeab78,null))[_0xa24c('0x36')](function(_0x5264a7){if(_0x5264a7){var _0x1e08bb=_0x5264a7[_0xa24c('0x32')]({'plain':!![]});_0x1e08bb=qs[_0xa24c('0x59')](_0x1e08bb,['id',_0xa24c('0x5a'),'updatedAt']);_0x3816f7['body']=_[_0xa24c('0x59')](_0x3816f7['body'],['id','createdAt',_0xa24c('0x5b')]);return db[_0xa24c('0x3b')][_0xa24c('0x5c')](_[_0xa24c('0x4d')](_0x1e08bb,_0x3816f7['body']),{'include':_0x3816f7['query'][_0xa24c('0x4f')]?[{'all':!![]}]:undefined})['then'](function(_0x52a895){var _0xfcc193=_0x3816f7[_0xa24c('0x5d')][_0xa24c('0x32')]({'plain':!![]});if(!_0xfcc193)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xfcc193[_0xa24c('0x5e')]===_0xa24c('0x5d')){var _0x5c3285=_0x52a895[_0xa24c('0x32')]({'plain':!![]});var _0x3f306d=_0xa24c('0x33');return db['UserProfileSection'][_0xa24c('0x56')]({'where':{'name':_0x3f306d,'userProfileId':_0xfcc193[_0xa24c('0x5f')]},'raw':!![]})[_0xa24c('0x36')](function(_0x7aab6e){if(_0x7aab6e&&_0x7aab6e[_0xa24c('0x60')]===0x0){return db['UserProfileResource'][_0xa24c('0x5c')]({'name':_0x5c3285[_0xa24c('0x38')],'resourceId':_0x5c3285['id'],'type':_0x7aab6e[_0xa24c('0x38')],'sectionId':_0x7aab6e['id']},{})[_0xa24c('0x36')](function(){return _0x52a895;});}else{return _0x52a895;}})[_0xa24c('0x52')](function(_0x2ca3fa){logger[_0xa24c('0x23')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2ca3fa);throw _0x2ca3fa;});}return _0x52a895;});}})[_0xa24c('0x36')](respondWithResult(_0xbeab78,0xc9))[_0xa24c('0x52')](handleError(_0xbeab78,null));};exports['create']=function(_0xb1048a,_0x3e455b,_0x14da5e){var _0xb460b4;return db[_0xa24c('0x3b')][_0xa24c('0x5c')](_0xb1048a[_0xa24c('0x61')],{'raw':!![]})[_0xa24c('0x36')](function(_0x38cc30){_0xb460b4=_0x38cc30;return db[_0xa24c('0x3b')]['findAll']({'raw':!![]});})[_0xa24c('0x36')](function(_0x3a4abd){var _0x3b894f=fs['readFileSync'](path[_0xa24c('0x62')](config[_0xa24c('0x63')],_0xa24c('0x64')),'utf8');var _0x3ac3a0=fs[_0xa24c('0x65')](path[_0xa24c('0x62')](config[_0xa24c('0x63')],_0xa24c('0x66')),_0xa24c('0x67'));var _0x4f9b56=ejs['render'](_0x3b894f,{'trunks':_0x3a4abd||[]});fs[_0xa24c('0x68')]('/etc/asterisk/sip_xcally_trunks.conf',_0x4f9b56);if(_0xb460b4[_0xa24c('0x69')]){var _0x1879ae=ejs[_0xa24c('0x6a')](_0x3ac3a0,{'trunks':_0x3a4abd||[]});fs[_0xa24c('0x68')](_0xa24c('0x6b'),_0x1879ae);}})['then'](function(){return respondWithRpcPromise(_0xa24c('0x6c'),_0xa24c('0x5c'),{'module':_0xa24c('0x6d')});})[_0xa24c('0x36')](function(){var _0x987aca=_0xb1048a[_0xa24c('0x5d')]['get']({'plain':!![]});if(!_0x987aca)throw new Error(_0xa24c('0x6e'));if(_0x987aca[_0xa24c('0x5e')]===_0xa24c('0x5d')){var _0x5b9ad7=_0xb460b4['get']({'plain':!![]});return db[_0xa24c('0x6f')]['find']({'where':{'name':_0xa24c('0x33'),'userProfileId':_0x987aca[_0xa24c('0x5f')]},'raw':!![]})[_0xa24c('0x36')](function(_0x180da2){if(_0x180da2&&_0x180da2['autoAssociation']===0x0){return db[_0xa24c('0x34')][_0xa24c('0x5c')]({'name':_0x5b9ad7['name'],'resourceId':_0x5b9ad7['id'],'type':_0x180da2[_0xa24c('0x38')],'sectionId':_0x180da2['id']},{})[_0xa24c('0x36')](function(){return _0xb460b4;});}else{return _0xb460b4;}})[_0xa24c('0x52')](function(_0x3e0c08){logger[_0xa24c('0x23')](_0xa24c('0x70'),_0x3e0c08);throw _0x3e0c08;});}return _0xb460b4;})[_0xa24c('0x36')](respondWithResult(_0x3e455b,0xc9))[_0xa24c('0x52')](handleError(_0x3e455b,null));};exports['update']=function(_0x12508e,_0x3c2726,_0x2cae90){var _0x28c3ff;return db[_0xa24c('0x3b')][_0xa24c('0x56')]({'where':{'id':_0x12508e[_0xa24c('0x53')]['id']}})[_0xa24c('0x36')](handleEntityNotFound(_0x3c2726,null))[_0xa24c('0x36')](saveUpdates(_0x12508e[_0xa24c('0x61')],null))[_0xa24c('0x36')](function(_0x5b0127){if(_0x5b0127){_0x28c3ff=_0x5b0127;return db[_0xa24c('0x3b')][_0xa24c('0x51')]({'raw':!![]});}})['then'](function(_0x141ccf){if(_0x141ccf){var _0x3f212f=fs[_0xa24c('0x65')](path['join'](config['root'],_0xa24c('0x64')),_0xa24c('0x67'));var _0x53928f=fs[_0xa24c('0x65')](path[_0xa24c('0x62')](config[_0xa24c('0x63')],_0xa24c('0x66')),_0xa24c('0x67'));var _0x336898=ejs['render'](_0x3f212f,{'trunks':_0x141ccf||[]});fs['writeFileSync']('/etc/asterisk/sip_xcally_trunks.conf',_0x336898);var _0x263dab=ejs['render'](_0x53928f,{'trunks':_0x141ccf||[]});fs['writeFileSync'](_0xa24c('0x6b'),_0x263dab);return respondWithRpcPromise(_0xa24c('0x6c'),_0xa24c('0x31'),{'module':_0xa24c('0x6d')});}return null;})[_0xa24c('0x36')](function(_0x45b2fe){if(_0x45b2fe){return _0x28c3ff;}})[_0xa24c('0x36')](respondWithResult(_0x3c2726,null))[_0xa24c('0x52')](handleError(_0x3c2726,null));};exports[_0xa24c('0x35')]=function(_0x4ee10d,_0x3897ca,_0xa077c8){var _0x16e1db;return db[_0xa24c('0x3b')][_0xa24c('0x56')]({'where':{'id':_0x4ee10d[_0xa24c('0x53')]['id']}})[_0xa24c('0x36')](handleEntityNotFound(_0x3897ca,null))[_0xa24c('0x36')](removeEntity(_0x3897ca,null))[_0xa24c('0x36')](function(){return db[_0xa24c('0x3b')][_0xa24c('0x51')]({'raw':!![]});})[_0xa24c('0x36')](function(_0x4ecbe9){var _0x1fe0f3=fs[_0xa24c('0x65')](path['join'](config[_0xa24c('0x63')],_0xa24c('0x64')),_0xa24c('0x67'));var _0x4af78f=fs[_0xa24c('0x65')](path[_0xa24c('0x62')](config['root'],_0xa24c('0x66')),_0xa24c('0x67'));var _0x4c108f=ejs['render'](_0x1fe0f3,{'trunks':_0x4ecbe9});var _0x124d52=ejs[_0xa24c('0x6a')](_0x4af78f,{'trunks':_0x4ecbe9});fs[_0xa24c('0x68')](_0xa24c('0x71'),_0x4c108f);fs['writeFileSync'](_0xa24c('0x6b'),_0x124d52);return respondWithRpcPromise(_0xa24c('0x6c'),_0xa24c('0x35'),{'module':'chan_sip.so'});})['catch'](handleError(_0x3897ca,null));}; \ No newline at end of file +var _0x6aa7=['sort','where','filters','pick','filter','merge','VIRTUAL','options','include','findAll','rows','params','length','includeAll','clone','find','get','createdAt','body','omit','updatedAt','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readFileSync','join','root','server/files/templates/trunk.ejs','render','/etc/asterisk/sip_xcally_trunks.conf','registry','/etc/asterisk/sip_xcally_registers.conf','Reload','chan_sip.so','autoAssociation','update','utf8','server/files/templates/registry.ejs','writeFileSync','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','ejs','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/environment','../../config/license/util','jayson/promise','http','then','Trunk,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','destroy','Trunks','UserProfileResource','stack','name','index','map','Trunk','rawAttributes','fieldName','type','model','query','keys','attributes','intersection','fields','order'];(function(_0xaeb648,_0xaf78a4){var _0x281cfc=function(_0x3e5157){while(--_0x3e5157){_0xaeb648['push'](_0xaeb648['shift']());}};_0x281cfc(++_0xaf78a4);}(_0x6aa7,0x178));var _0x76aa=function(_0x2fa294,_0x1ef866){_0x2fa294=_0x2fa294-0x0;var _0x373d8e=_0x6aa7[_0x2fa294];return _0x373d8e;};'use strict';var emlformat=require(_0x76aa('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x76aa('0x1'));var jsonpatch=require(_0x76aa('0x2'));var rp=require(_0x76aa('0x3'));var moment=require(_0x76aa('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x76aa('0x5'));var util=require(_0x76aa('0x6'));var path=require(_0x76aa('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x76aa('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x76aa('0x9'));var squel=require(_0x76aa('0xa'));var crypto=require(_0x76aa('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x76aa('0xc'));var toCsv=require(_0x76aa('0xd'));var querystring=require(_0x76aa('0xe'));var Papa=require('papaparse');var Redis=require(_0x76aa('0xf'));var authService=require(_0x76aa('0x10'));var qs=require(_0x76aa('0x11'));var as=require(_0x76aa('0x12'));var hardwareService=require(_0x76aa('0x13'));var logger=require(_0x76aa('0x14'))(_0x76aa('0x15'));var utils=require(_0x76aa('0x16'));var config=require(_0x76aa('0x17'));var licenseUtil=require(_0x76aa('0x18'));var db=require('../../mysqldb')['db'];var jayson=require(_0x76aa('0x19'));var client=jayson['client'][_0x76aa('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x12dde0,_0x3f8f6b,_0x8e44ed,_0x10432c){return new BPromise(function(_0x4e309f,_0x5f5b59){var _0x2b3b4f=_0x10432c||client;return _0x2b3b4f['request'](_0x12dde0,_0x8e44ed)[_0x76aa('0x1b')](function(_0x319bf1){logger['info'](_0x76aa('0x1c'),_0x3f8f6b,'request\x20sent');logger[_0x76aa('0x1d')]('Trunk,\x20%s,\x20%s,\x20%s',_0x3f8f6b,_0x76aa('0x1e'),JSON[_0x76aa('0x1f')](_0x319bf1));if(_0x319bf1[_0x76aa('0x20')]){if(_0x319bf1[_0x76aa('0x20')][_0x76aa('0x21')]===0x1f4){logger[_0x76aa('0x20')]('Trunk,\x20%s,\x20%s',_0x3f8f6b,_0x319bf1['error'][_0x76aa('0x22')]);return _0x5f5b59(_0x319bf1[_0x76aa('0x20')][_0x76aa('0x22')]);}logger[_0x76aa('0x20')](_0x76aa('0x1c'),_0x3f8f6b,_0x319bf1[_0x76aa('0x20')][_0x76aa('0x22')]);return _0x4e309f(_0x319bf1[_0x76aa('0x20')][_0x76aa('0x22')]);}else{logger['info'](_0x76aa('0x1c'),_0x3f8f6b,_0x76aa('0x1e'));_0x4e309f(_0x319bf1[_0x76aa('0x23')]['message']);}})[_0x76aa('0x24')](function(_0x189cb6){logger[_0x76aa('0x20')](_0x76aa('0x1c'),_0x3f8f6b,_0x189cb6);_0x5f5b59(_0x189cb6);});});}function respondWithStatusCode(_0x29c50c,_0xc1044c){_0xc1044c=_0xc1044c||0xcc;return function(_0x3cd039){if(_0x3cd039){return _0x29c50c[_0x76aa('0x25')](_0xc1044c);}return _0x29c50c[_0x76aa('0x26')](_0xc1044c)[_0x76aa('0x27')]();};}function respondWithResult(_0x37f1ab,_0x26b75e){_0x26b75e=_0x26b75e||0xc8;return function(_0x3599a9){if(_0x3599a9){return _0x37f1ab['status'](_0x26b75e)[_0x76aa('0x28')](_0x3599a9);}};}function respondWithFilteredResult(_0x1d6d15,_0x25c614){return function(_0x2e7ab4){if(_0x2e7ab4){var _0xa1e6=typeof _0x25c614[_0x76aa('0x29')]===_0x76aa('0x2a')&&typeof _0x25c614[_0x76aa('0x2b')]===_0x76aa('0x2a');var _0x1bdc3d=_0x2e7ab4['count'];var _0x3fcb7f=_0xa1e6?0x0:_0x25c614['offset'];var _0x994550=_0xa1e6?_0x2e7ab4[_0x76aa('0x2c')]:_0x25c614[_0x76aa('0x29')]+_0x25c614[_0x76aa('0x2b')];var _0x1eecd9;if(_0x994550>=_0x1bdc3d){_0x994550=_0x1bdc3d;_0x1eecd9=0xc8;}else{_0x1eecd9=0xce;}_0x1d6d15[_0x76aa('0x26')](_0x1eecd9);return _0x1d6d15[_0x76aa('0x2d')](_0x76aa('0x2e'),_0x3fcb7f+'-'+_0x994550+'/'+_0x1bdc3d)[_0x76aa('0x28')](_0x2e7ab4);}return null;};}function patchUpdates(_0x3ea05a){return function(_0x5edcd8){try{jsonpatch[_0x76aa('0x2f')](_0x5edcd8,_0x3ea05a,!![]);}catch(_0x5532c7){return BPromise[_0x76aa('0x30')](_0x5532c7);}return _0x5edcd8[_0x76aa('0x31')]();};}function saveUpdates(_0x458ac3,_0x38ecd1){return function(_0x35a705){if(_0x35a705){return _0x35a705['update'](_0x458ac3)[_0x76aa('0x1b')](function(_0x25a11f){return _0x25a11f;});}return null;};}function removeEntity(_0x5a0f72,_0x2ee338){return function(_0x58d860){if(_0x58d860){return _0x58d860[_0x76aa('0x32')]()['then'](function(){var _0x8479a3=_0x58d860['get']({'plain':!![]});var _0x58f135=_0x76aa('0x33');return db[_0x76aa('0x34')][_0x76aa('0x32')]({'where':{'type':_0x58f135,'resourceId':_0x8479a3['id']}})[_0x76aa('0x1b')](function(){return _0x58d860;});})['then'](function(){_0x5a0f72['status'](0xcc)[_0x76aa('0x27')]();});}};}function handleEntityNotFound(_0x1c7b6f,_0x58127c){return function(_0x23e2fd){if(!_0x23e2fd){_0x1c7b6f[_0x76aa('0x25')](0x194);}return _0x23e2fd;};}function handleError(_0x5b57d8,_0x9ce5f4){_0x9ce5f4=_0x9ce5f4||0x1f4;return function(_0x5c77f1){logger['error'](_0x5c77f1[_0x76aa('0x35')]);if(_0x5c77f1[_0x76aa('0x36')]){delete _0x5c77f1[_0x76aa('0x36')];}_0x5b57d8[_0x76aa('0x26')](_0x9ce5f4)['send'](_0x5c77f1);};}exports[_0x76aa('0x37')]=function(_0x1c22f7,_0x2eea79){var _0x4e131a={},_0x113770={},_0x1638db={'count':0x0,'rows':[]};var _0x2f7726=_[_0x76aa('0x38')](db[_0x76aa('0x39')][_0x76aa('0x3a')],function(_0x878903){return{'name':_0x878903[_0x76aa('0x3b')],'type':_0x878903[_0x76aa('0x3c')]['key']};});_0x113770[_0x76aa('0x3d')]=_[_0x76aa('0x38')](_0x2f7726,_0x76aa('0x36'));_0x113770[_0x76aa('0x3e')]=_[_0x76aa('0x3f')](_0x1c22f7[_0x76aa('0x3e')]);_0x113770['filters']=_['intersection'](_0x113770[_0x76aa('0x3d')],_0x113770[_0x76aa('0x3e')]);_0x4e131a[_0x76aa('0x40')]=_[_0x76aa('0x41')](_0x113770['model'],qs[_0x76aa('0x42')](_0x1c22f7[_0x76aa('0x3e')][_0x76aa('0x42')]));_0x4e131a[_0x76aa('0x40')]=_0x4e131a[_0x76aa('0x40')]['length']?_0x4e131a[_0x76aa('0x40')]:_0x113770['model'];if(!_0x1c22f7[_0x76aa('0x3e')]['hasOwnProperty']('nolimit')){_0x4e131a['limit']=qs[_0x76aa('0x2b')](_0x1c22f7['query']['limit']);_0x4e131a['offset']=qs[_0x76aa('0x29')](_0x1c22f7[_0x76aa('0x3e')][_0x76aa('0x29')]);}_0x4e131a[_0x76aa('0x43')]=qs[_0x76aa('0x44')](_0x1c22f7['query'][_0x76aa('0x44')]);_0x4e131a[_0x76aa('0x45')]=qs[_0x76aa('0x46')](_[_0x76aa('0x47')](_0x1c22f7[_0x76aa('0x3e')],_0x113770['filters']),_0x2f7726);if(_0x1c22f7[_0x76aa('0x3e')][_0x76aa('0x48')]){_0x4e131a['where']=_[_0x76aa('0x49')](_0x4e131a['where'],{'$or':_[_0x76aa('0x38')](_0x2f7726,function(_0x24ea05){if(_0x24ea05[_0x76aa('0x3c')]!==_0x76aa('0x4a')){var _0x2d0bc4={};_0x2d0bc4[_0x24ea05[_0x76aa('0x36')]]={'$like':'%'+_0x1c22f7[_0x76aa('0x3e')][_0x76aa('0x48')]+'%'};return _0x2d0bc4;}})});}_0x4e131a=_[_0x76aa('0x49')]({},_0x4e131a,_0x1c22f7[_0x76aa('0x4b')]);var _0x5e4967={'where':_0x4e131a[_0x76aa('0x45')]};return db['Trunk'][_0x76aa('0x2c')](_0x5e4967)[_0x76aa('0x1b')](function(_0x5e95f5){_0x1638db[_0x76aa('0x2c')]=_0x5e95f5;if(_0x1c22f7['query']['includeAll']){_0x4e131a[_0x76aa('0x4c')]=[{'all':!![]}];}return db['Trunk'][_0x76aa('0x4d')](_0x4e131a);})[_0x76aa('0x1b')](function(_0x4315b3){_0x1638db[_0x76aa('0x4e')]=_0x4315b3;return _0x1638db;})[_0x76aa('0x1b')](respondWithFilteredResult(_0x2eea79,_0x4e131a))[_0x76aa('0x24')](handleError(_0x2eea79,null));};exports['show']=function(_0x564546,_0x2fcf8f){var _0x1eafb2={'raw':![],'where':{'id':_0x564546[_0x76aa('0x4f')]['id']}},_0x1708d4={};_0x1708d4[_0x76aa('0x3d')]=_[_0x76aa('0x3f')](db['Trunk'][_0x76aa('0x3a')]);_0x1708d4[_0x76aa('0x3e')]=_[_0x76aa('0x3f')](_0x564546['query']);_0x1708d4[_0x76aa('0x46')]=_['intersection'](_0x1708d4[_0x76aa('0x3d')],_0x1708d4['query']);_0x1eafb2[_0x76aa('0x40')]=_[_0x76aa('0x41')](_0x1708d4[_0x76aa('0x3d')],qs[_0x76aa('0x42')](_0x564546[_0x76aa('0x3e')][_0x76aa('0x42')]));_0x1eafb2[_0x76aa('0x40')]=_0x1eafb2['attributes'][_0x76aa('0x50')]?_0x1eafb2['attributes']:_0x1708d4[_0x76aa('0x3d')];if(_0x564546[_0x76aa('0x3e')][_0x76aa('0x51')]){_0x1eafb2[_0x76aa('0x4c')]=[{'all':!![]}];}_0x1eafb2=_[_0x76aa('0x49')]({},_0x1eafb2,_0x564546[_0x76aa('0x4b')]);return db[_0x76aa('0x39')]['find'](_0x1eafb2)[_0x76aa('0x1b')](handleEntityNotFound(_0x2fcf8f,null))[_0x76aa('0x1b')](respondWithResult(_0x2fcf8f,null))[_0x76aa('0x24')](handleError(_0x2fcf8f,null));};exports[_0x76aa('0x52')]=function(_0x5c742c,_0xb9401b){var _0x163440={'where':{'id':_0x5c742c[_0x76aa('0x4f')]['id']}},_0x8dc601={};_0x8dc601[_0x76aa('0x3d')]=_[_0x76aa('0x3f')](db['Trunk'][_0x76aa('0x3a')]);_0x163440[_0x76aa('0x40')]=_[_0x76aa('0x41')](_0x8dc601[_0x76aa('0x3d')],qs[_0x76aa('0x42')](_0x5c742c[_0x76aa('0x3e')][_0x76aa('0x42')]));_0x163440['attributes']=_0x163440['attributes'][_0x76aa('0x50')]?_0x163440[_0x76aa('0x40')]:_0x8dc601['model'];if(_0x5c742c[_0x76aa('0x3e')][_0x76aa('0x51')]){_0x163440['include']=[{'all':!![]}];}_0x163440=_[_0x76aa('0x49')]({},_0x163440,_0x5c742c[_0x76aa('0x4b')]);return db[_0x76aa('0x39')][_0x76aa('0x53')](_0x163440)[_0x76aa('0x1b')](handleEntityNotFound(_0xb9401b,null))[_0x76aa('0x1b')](function(_0x3376ec){if(_0x3376ec){var _0x30573a=_0x3376ec[_0x76aa('0x54')]({'plain':!![]});_0x30573a=qs['omit'](_0x30573a,['id',_0x76aa('0x55'),'updatedAt']);_0x5c742c[_0x76aa('0x56')]=_[_0x76aa('0x57')](_0x5c742c[_0x76aa('0x56')],['id',_0x76aa('0x55'),_0x76aa('0x58')]);return db[_0x76aa('0x39')][_0x76aa('0x59')](_[_0x76aa('0x49')](_0x30573a,_0x5c742c[_0x76aa('0x56')]),{'include':_0x5c742c['query'][_0x76aa('0x51')]?[{'all':!![]}]:undefined})[_0x76aa('0x1b')](function(_0x5c542b){var _0xe5957d=_0x5c742c[_0x76aa('0x5a')][_0x76aa('0x54')]({'plain':!![]});if(!_0xe5957d)throw new Error(_0x76aa('0x5b'));if(_0xe5957d[_0x76aa('0x5c')]==='user'){var _0x364d05=_0x5c542b['get']({'plain':!![]});var _0x35bd2b=_0x76aa('0x33');return db[_0x76aa('0x5d')][_0x76aa('0x53')]({'where':{'name':_0x35bd2b,'userProfileId':_0xe5957d[_0x76aa('0x5e')]},'raw':!![]})[_0x76aa('0x1b')](function(_0x2bfb46){if(_0x2bfb46&&_0x2bfb46['autoAssociation']===0x0){return db[_0x76aa('0x34')][_0x76aa('0x59')]({'name':_0x364d05['name'],'resourceId':_0x364d05['id'],'type':_0x2bfb46['name'],'sectionId':_0x2bfb46['id']},{})[_0x76aa('0x1b')](function(){return _0x5c542b;});}else{return _0x5c542b;}})[_0x76aa('0x24')](function(_0x5295a7){logger[_0x76aa('0x20')](_0x76aa('0x5f'),_0x5295a7);throw _0x5295a7;});}return _0x5c542b;});}})[_0x76aa('0x1b')](respondWithResult(_0xb9401b,0xc9))['catch'](handleError(_0xb9401b,null));};exports[_0x76aa('0x59')]=function(_0x47f733,_0xf31e1f,_0x1178e5){var _0x2315cf;return db[_0x76aa('0x39')]['create'](_0x47f733['body'],{'raw':!![]})[_0x76aa('0x1b')](function(_0x4dfeb3){_0x2315cf=_0x4dfeb3;return db[_0x76aa('0x39')][_0x76aa('0x4d')]({'raw':!![]});})[_0x76aa('0x1b')](function(_0x43a2af){var _0x2dd320=fs[_0x76aa('0x60')](path[_0x76aa('0x61')](config[_0x76aa('0x62')],_0x76aa('0x63')),'utf8');var _0x7d02e7=fs[_0x76aa('0x60')](path[_0x76aa('0x61')](config[_0x76aa('0x62')],'server/files/templates/registry.ejs'),'utf8');var _0x557c11=ejs[_0x76aa('0x64')](_0x2dd320,{'trunks':_0x43a2af||[]});fs['writeFileSync'](_0x76aa('0x65'),_0x557c11);if(_0x2315cf[_0x76aa('0x66')]){var _0x38faff=ejs[_0x76aa('0x64')](_0x7d02e7,{'trunks':_0x43a2af||[]});fs['writeFileSync'](_0x76aa('0x67'),_0x38faff);}})['then'](function(){return respondWithRpcPromise(_0x76aa('0x68'),_0x76aa('0x59'),{'module':_0x76aa('0x69')});})[_0x76aa('0x1b')](function(){var _0x1037fb=_0x47f733['user'][_0x76aa('0x54')]({'plain':!![]});if(!_0x1037fb)throw new Error(_0x76aa('0x5b'));if(_0x1037fb[_0x76aa('0x5c')]===_0x76aa('0x5a')){var _0x32c1de=_0x2315cf[_0x76aa('0x54')]({'plain':!![]});return db[_0x76aa('0x5d')][_0x76aa('0x53')]({'where':{'name':'Trunks','userProfileId':_0x1037fb[_0x76aa('0x5e')]},'raw':!![]})[_0x76aa('0x1b')](function(_0x48136a){if(_0x48136a&&_0x48136a[_0x76aa('0x6a')]===0x0){return db[_0x76aa('0x34')][_0x76aa('0x59')]({'name':_0x32c1de[_0x76aa('0x36')],'resourceId':_0x32c1de['id'],'type':_0x48136a[_0x76aa('0x36')],'sectionId':_0x48136a['id']},{})[_0x76aa('0x1b')](function(){return _0x2315cf;});}else{return _0x2315cf;}})[_0x76aa('0x24')](function(_0x5dc923){logger[_0x76aa('0x20')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5dc923);throw _0x5dc923;});}return _0x2315cf;})['then'](respondWithResult(_0xf31e1f,0xc9))[_0x76aa('0x24')](handleError(_0xf31e1f,null));};exports[_0x76aa('0x6b')]=function(_0x5d8947,_0x5d1de1,_0x36da4d){var _0x14b5a2;return db[_0x76aa('0x39')]['find']({'where':{'id':_0x5d8947['params']['id']}})[_0x76aa('0x1b')](handleEntityNotFound(_0x5d1de1,null))[_0x76aa('0x1b')](saveUpdates(_0x5d8947[_0x76aa('0x56')],null))['then'](function(_0xb70589){if(_0xb70589){_0x14b5a2=_0xb70589;return db['Trunk'][_0x76aa('0x4d')]({'raw':!![]});}})[_0x76aa('0x1b')](function(_0x383290){if(_0x383290){var _0x325ffa=fs[_0x76aa('0x60')](path['join'](config['root'],_0x76aa('0x63')),_0x76aa('0x6c'));var _0x19ebb7=fs['readFileSync'](path[_0x76aa('0x61')](config[_0x76aa('0x62')],_0x76aa('0x6d')),_0x76aa('0x6c'));var _0x303b78=ejs['render'](_0x325ffa,{'trunks':_0x383290||[]});fs[_0x76aa('0x6e')]('/etc/asterisk/sip_xcally_trunks.conf',_0x303b78);var _0x213f7f=ejs[_0x76aa('0x64')](_0x19ebb7,{'trunks':_0x383290||[]});fs[_0x76aa('0x6e')](_0x76aa('0x67'),_0x213f7f);return respondWithRpcPromise(_0x76aa('0x68'),_0x76aa('0x6b'),{'module':'chan_sip.so'});}return null;})['then'](function(_0x547411){if(_0x547411){return _0x14b5a2;}})['then'](respondWithResult(_0x5d1de1,null))['catch'](handleError(_0x5d1de1,null));};exports[_0x76aa('0x32')]=function(_0x22f44f,_0x52c5be,_0x5c2c91){var _0x4f01e9;return db[_0x76aa('0x39')][_0x76aa('0x53')]({'where':{'id':_0x22f44f[_0x76aa('0x4f')]['id']}})['then'](handleEntityNotFound(_0x52c5be,null))['then'](removeEntity(_0x52c5be,null))[_0x76aa('0x1b')](function(){return db[_0x76aa('0x39')][_0x76aa('0x4d')]({'raw':!![]});})[_0x76aa('0x1b')](function(_0x354c7b){var _0x55e526=fs['readFileSync'](path[_0x76aa('0x61')](config['root'],'server/files/templates/trunk.ejs'),'utf8');var _0x4673e6=fs[_0x76aa('0x60')](path['join'](config[_0x76aa('0x62')],_0x76aa('0x6d')),'utf8');var _0x22063f=ejs[_0x76aa('0x64')](_0x55e526,{'trunks':_0x354c7b});var _0x11d91f=ejs[_0x76aa('0x64')](_0x4673e6,{'trunks':_0x354c7b});fs[_0x76aa('0x6e')](_0x76aa('0x65'),_0x22063f);fs[_0x76aa('0x6e')](_0x76aa('0x67'),_0x11d91f);return respondWithRpcPromise(_0x76aa('0x68'),'destroy',{'module':_0x76aa('0x69')});})[_0x76aa('0x24')](handleError(_0x52c5be,null));}; \ No newline at end of file diff --git a/server/api/trunk/trunk.model.js b/server/api/trunk/trunk.model.js index 972df27..2bf0788 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 _0xdf77=['lodash','util','../../config/logger','moment','bluebird','../../config/environment','./trunk.attributes','exports','define','tools_trunks'];(function(_0x1694f5,_0x49b7c3){var _0x5b4321=function(_0x58c183){while(--_0x58c183){_0x1694f5['push'](_0x1694f5['shift']());}};_0x5b4321(++_0x49b7c3);}(_0xdf77,0xd2));var _0x7df7=function(_0x2dd520,_0x243568){_0x2dd520=_0x2dd520-0x0;var _0x36ff68=_0xdf77[_0x2dd520];return _0x36ff68;};'use strict';var _=require(_0x7df7('0x0'));var util=require(_0x7df7('0x1'));var logger=require(_0x7df7('0x2'))('api');var moment=require(_0x7df7('0x3'));var BPromise=require(_0x7df7('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x7df7('0x5'));var attributes=require(_0x7df7('0x6'));module[_0x7df7('0x7')]=function(_0x3590d8,_0x2c85f6){return _0x3590d8[_0x7df7('0x8')]('Trunk',attributes,{'tableName':_0x7df7('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa6b4=['rimraf','../../config/environment','./trunk.attributes','exports','define','Trunk','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x22cd80,_0x1036c8){var _0x119c5e=function(_0xa3b7e9){while(--_0xa3b7e9){_0x22cd80['push'](_0x22cd80['shift']());}};_0x119c5e(++_0x1036c8);}(_0xa6b4,0x84));var _0x4a6b=function(_0x32e649,_0x228649){_0x32e649=_0x32e649-0x0;var _0x14d386=_0xa6b4[_0x32e649];return _0x14d386;};'use strict';var _=require(_0x4a6b('0x0'));var util=require(_0x4a6b('0x1'));var logger=require(_0x4a6b('0x2'))(_0x4a6b('0x3'));var moment=require(_0x4a6b('0x4'));var BPromise=require(_0x4a6b('0x5'));var rp=require(_0x4a6b('0x6'));var fs=require('fs');var path=require(_0x4a6b('0x7'));var rimraf=require(_0x4a6b('0x8'));var config=require(_0x4a6b('0x9'));var attributes=require(_0x4a6b('0xa'));module[_0x4a6b('0xb')]=function(_0x561c4a,_0x59d46e){return _0x561c4a[_0x4a6b('0xc')](_0x4a6b('0xd'),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 a6905ed..62cd15a 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 _0xbe0d=['rpc','../../config/environment','jayson/promise','client','http','then','Trunk,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','GetTrunk','Trunk','options','attributes','limit','include','map','model','debug','ShowTrunk','find','raw','where','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x46c00f,_0xe4335f){var _0x14a172=function(_0x54e92b){while(--_0x54e92b){_0x46c00f['push'](_0x46c00f['shift']());}};_0x14a172(++_0xe4335f);}(_0xbe0d,0x88));var _0xdbe0=function(_0x3feef9,_0x1df14e){_0x3feef9=_0x3feef9-0x0;var _0x3b7fee=_0xbe0d[_0x3feef9];return _0x3b7fee;};'use strict';var _=require(_0xdbe0('0x0'));var util=require('util');var moment=require(_0xdbe0('0x1'));var BPromise=require(_0xdbe0('0x2'));var rs=require(_0xdbe0('0x3'));var fs=require('fs');var Redis=require(_0xdbe0('0x4'));var db=require(_0xdbe0('0x5'))['db'];var utils=require(_0xdbe0('0x6'));var logger=require(_0xdbe0('0x7'))(_0xdbe0('0x8'));var config=require(_0xdbe0('0x9'));var jayson=require(_0xdbe0('0xa'));var client=jayson[_0xdbe0('0xb')][_0xdbe0('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x51346f,_0x21e39e,_0x536c85){return new BPromise(function(_0x12e73e,_0x3ecbc8){return client['request'](_0x51346f,_0x536c85)[_0xdbe0('0xd')](function(_0x15b748){logger['info'](_0xdbe0('0xe'),_0x21e39e,'request\x20sent');logger['debug']('Trunk,\x20%s,\x20%s,\x20%s',_0x21e39e,_0xdbe0('0xf'),JSON[_0xdbe0('0x10')](_0x15b748));if(_0x15b748['error']){if(_0x15b748[_0xdbe0('0x11')][_0xdbe0('0x12')]===0x1f4){logger['error'](_0xdbe0('0xe'),_0x21e39e,_0x15b748['error'][_0xdbe0('0x13')]);return _0x3ecbc8(_0x15b748['error'][_0xdbe0('0x13')]);}logger[_0xdbe0('0x11')](_0xdbe0('0xe'),_0x21e39e,_0x15b748[_0xdbe0('0x11')][_0xdbe0('0x13')]);return _0x12e73e(_0x15b748['error'][_0xdbe0('0x13')]);}else{logger[_0xdbe0('0x14')](_0xdbe0('0xe'),_0x21e39e,_0xdbe0('0xf'));_0x12e73e(_0x15b748[_0xdbe0('0x15')][_0xdbe0('0x13')]);}})[_0xdbe0('0x16')](function(_0xf3284d){logger[_0xdbe0('0x11')](_0xdbe0('0xe'),_0x21e39e,_0xf3284d);_0x3ecbc8(_0xf3284d);});});}exports[_0xdbe0('0x17')]=function(_0x27c97d){var _0x8311dd=this;return new Promise(function(_0x238549,_0x58c3ed){return db[_0xdbe0('0x18')]['findAll']({'raw':_0x27c97d['options']?_0x27c97d[_0xdbe0('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x27c97d[_0xdbe0('0x19')]?_0x27c97d[_0xdbe0('0x19')]['where']||null:null,'attributes':_0x27c97d['options']?_0x27c97d['options'][_0xdbe0('0x1a')]||null:null,'limit':_0x27c97d['options']?_0x27c97d[_0xdbe0('0x19')][_0xdbe0('0x1b')]||null:null,'include':_0x27c97d[_0xdbe0('0x19')]?_0x27c97d[_0xdbe0('0x19')][_0xdbe0('0x1c')]?_[_0xdbe0('0x1d')](_0x27c97d[_0xdbe0('0x19')]['include'],function(_0x6ee277){return{'model':db[_0x6ee277['model']],'as':_0x6ee277['as'],'attributes':_0x6ee277[_0xdbe0('0x1a')],'include':_0x6ee277[_0xdbe0('0x1c')]?_[_0xdbe0('0x1d')](_0x6ee277[_0xdbe0('0x1c')],function(_0x52b88b){return{'model':db[_0x52b88b['model']],'as':_0x52b88b['as'],'attributes':_0x52b88b[_0xdbe0('0x1a')],'include':_0x52b88b[_0xdbe0('0x1c')]?_['map'](_0x52b88b[_0xdbe0('0x1c')],function(_0x173eed){return{'model':db[_0x173eed[_0xdbe0('0x1e')]],'as':_0x173eed['as'],'attributes':_0x173eed[_0xdbe0('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1f5d9e){logger[_0xdbe0('0x14')](_0xdbe0('0x17'),_0x27c97d);logger[_0xdbe0('0x1f')](_0xdbe0('0x17'),_0x27c97d,JSON[_0xdbe0('0x10')](_0x1f5d9e));_0x238549(_0x1f5d9e);})[_0xdbe0('0x16')](function(_0xdbc1b9){logger[_0xdbe0('0x11')](_0xdbe0('0x17'),_0xdbc1b9[_0xdbe0('0x13')],_0x27c97d);_0x58c3ed(_0x8311dd['error'](0x1f4,_0xdbc1b9[_0xdbe0('0x13')]));});});};exports[_0xdbe0('0x20')]=function(_0x29cc5d){var _0x32ce71=this;return new Promise(function(_0x27eb6c,_0x1dcf7c){return db[_0xdbe0('0x18')][_0xdbe0('0x21')]({'raw':_0x29cc5d['options']?_0x29cc5d[_0xdbe0('0x19')][_0xdbe0('0x22')]===undefined?!![]:![]:!![],'where':_0x29cc5d[_0xdbe0('0x19')]?_0x29cc5d[_0xdbe0('0x19')][_0xdbe0('0x23')]||null:null,'attributes':_0x29cc5d[_0xdbe0('0x19')]?_0x29cc5d['options']['attributes']||null:null,'include':_0x29cc5d[_0xdbe0('0x19')]?_0x29cc5d['options'][_0xdbe0('0x1c')]?_['map'](_0x29cc5d[_0xdbe0('0x19')][_0xdbe0('0x1c')],function(_0x1a87c9){return{'model':db[_0x1a87c9['model']],'as':_0x1a87c9['as'],'attributes':_0x1a87c9[_0xdbe0('0x1a')],'include':_0x1a87c9[_0xdbe0('0x1c')]?_[_0xdbe0('0x1d')](_0x1a87c9[_0xdbe0('0x1c')],function(_0x5699f6){return{'model':db[_0x5699f6['model']],'as':_0x5699f6['as'],'attributes':_0x5699f6[_0xdbe0('0x1a')],'include':_0x5699f6[_0xdbe0('0x1c')]?_[_0xdbe0('0x1d')](_0x5699f6[_0xdbe0('0x1c')],function(_0x4c996a){return{'model':db[_0x4c996a[_0xdbe0('0x1e')]],'as':_0x4c996a['as'],'attributes':_0x4c996a[_0xdbe0('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xdbe0('0xd')](function(_0x2a97ed){logger[_0xdbe0('0x14')](_0xdbe0('0x20'),_0x29cc5d);logger[_0xdbe0('0x1f')](_0xdbe0('0x20'),_0x29cc5d,JSON[_0xdbe0('0x10')](_0x2a97ed));_0x27eb6c(_0x2a97ed);})['catch'](function(_0x42dccc){logger[_0xdbe0('0x11')](_0xdbe0('0x20'),_0x42dccc['message'],_0x29cc5d);_0x1dcf7c(_0x32ce71['error'](0x1f4,_0x42dccc[_0xdbe0('0x13')]));});});}; \ No newline at end of file +var _0xb90d=['lodash','util','moment','bluebird','../../config/logger','../../config/environment','client','http','then','info','Trunk,\x20%s,\x20%s','request\x20sent','debug','Trunk,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','Trunk','options','raw','where','attributes','limit','include','model','map','GetTrunk','ShowTrunk','find'];(function(_0x10e32d,_0x525503){var _0x1b36dd=function(_0xbc5f4a){while(--_0xbc5f4a){_0x10e32d['push'](_0x10e32d['shift']());}};_0x1b36dd(++_0x525503);}(_0xb90d,0x193));var _0xdb90=function(_0x5eca6f,_0x76ec15){_0x5eca6f=_0x5eca6f-0x0;var _0x4c34b7=_0xb90d[_0x5eca6f];return _0x4c34b7;};'use strict';var _=require(_0xdb90('0x0'));var util=require(_0xdb90('0x1'));var moment=require(_0xdb90('0x2'));var BPromise=require(_0xdb90('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xdb90('0x4'))('rpc');var config=require(_0xdb90('0x5'));var jayson=require('jayson/promise');var client=jayson[_0xdb90('0x6')][_0xdb90('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x17c3e1,_0x50c571,_0x384895){return new BPromise(function(_0x167fbe,_0x2a84d6){return client['request'](_0x17c3e1,_0x384895)[_0xdb90('0x8')](function(_0x25405f){logger[_0xdb90('0x9')](_0xdb90('0xa'),_0x50c571,_0xdb90('0xb'));logger[_0xdb90('0xc')](_0xdb90('0xd'),_0x50c571,_0xdb90('0xb'),JSON[_0xdb90('0xe')](_0x25405f));if(_0x25405f['error']){if(_0x25405f[_0xdb90('0xf')][_0xdb90('0x10')]===0x1f4){logger[_0xdb90('0xf')](_0xdb90('0xa'),_0x50c571,_0x25405f[_0xdb90('0xf')][_0xdb90('0x11')]);return _0x2a84d6(_0x25405f[_0xdb90('0xf')]['message']);}logger[_0xdb90('0xf')](_0xdb90('0xa'),_0x50c571,_0x25405f['error'][_0xdb90('0x11')]);return _0x167fbe(_0x25405f[_0xdb90('0xf')][_0xdb90('0x11')]);}else{logger['info'](_0xdb90('0xa'),_0x50c571,_0xdb90('0xb'));_0x167fbe(_0x25405f['result'][_0xdb90('0x11')]);}})[_0xdb90('0x12')](function(_0x5b1654){logger[_0xdb90('0xf')](_0xdb90('0xa'),_0x50c571,_0x5b1654);_0x2a84d6(_0x5b1654);});});}exports['GetTrunk']=function(_0x3fc383){var _0x200954=this;return new Promise(function(_0x2d2015,_0x2fa7c9){return db[_0xdb90('0x13')]['findAll']({'raw':_0x3fc383[_0xdb90('0x14')]?_0x3fc383[_0xdb90('0x14')][_0xdb90('0x15')]===undefined?!![]:![]:!![],'where':_0x3fc383[_0xdb90('0x14')]?_0x3fc383['options'][_0xdb90('0x16')]||null:null,'attributes':_0x3fc383[_0xdb90('0x14')]?_0x3fc383['options'][_0xdb90('0x17')]||null:null,'limit':_0x3fc383['options']?_0x3fc383[_0xdb90('0x14')][_0xdb90('0x18')]||null:null,'include':_0x3fc383[_0xdb90('0x14')]?_0x3fc383[_0xdb90('0x14')][_0xdb90('0x19')]?_['map'](_0x3fc383['options'][_0xdb90('0x19')],function(_0x2a36d3){return{'model':db[_0x2a36d3[_0xdb90('0x1a')]],'as':_0x2a36d3['as'],'attributes':_0x2a36d3[_0xdb90('0x17')],'include':_0x2a36d3['include']?_[_0xdb90('0x1b')](_0x2a36d3[_0xdb90('0x19')],function(_0x42459f){return{'model':db[_0x42459f['model']],'as':_0x42459f['as'],'attributes':_0x42459f[_0xdb90('0x17')],'include':_0x42459f['include']?_[_0xdb90('0x1b')](_0x42459f[_0xdb90('0x19')],function(_0xa99b6){return{'model':db[_0xa99b6[_0xdb90('0x1a')]],'as':_0xa99b6['as'],'attributes':_0xa99b6[_0xdb90('0x17')]};}):[]};}):[]};}):[]:[]})[_0xdb90('0x8')](function(_0x5a9dc5){logger['info'](_0xdb90('0x1c'),_0x3fc383);logger[_0xdb90('0xc')](_0xdb90('0x1c'),_0x3fc383,JSON[_0xdb90('0xe')](_0x5a9dc5));_0x2d2015(_0x5a9dc5);})[_0xdb90('0x12')](function(_0x1d7dc1){logger[_0xdb90('0xf')](_0xdb90('0x1c'),_0x1d7dc1[_0xdb90('0x11')],_0x3fc383);_0x2fa7c9(_0x200954[_0xdb90('0xf')](0x1f4,_0x1d7dc1[_0xdb90('0x11')]));});});};exports[_0xdb90('0x1d')]=function(_0x15b97d){var _0x1383f5=this;return new Promise(function(_0x343053,_0x4e1f7b){return db[_0xdb90('0x13')][_0xdb90('0x1e')]({'raw':_0x15b97d[_0xdb90('0x14')]?_0x15b97d['options'][_0xdb90('0x15')]===undefined?!![]:![]:!![],'where':_0x15b97d[_0xdb90('0x14')]?_0x15b97d[_0xdb90('0x14')][_0xdb90('0x16')]||null:null,'attributes':_0x15b97d['options']?_0x15b97d[_0xdb90('0x14')][_0xdb90('0x17')]||null:null,'include':_0x15b97d[_0xdb90('0x14')]?_0x15b97d[_0xdb90('0x14')][_0xdb90('0x19')]?_[_0xdb90('0x1b')](_0x15b97d[_0xdb90('0x14')]['include'],function(_0x6c5d38){return{'model':db[_0x6c5d38[_0xdb90('0x1a')]],'as':_0x6c5d38['as'],'attributes':_0x6c5d38[_0xdb90('0x17')],'include':_0x6c5d38[_0xdb90('0x19')]?_[_0xdb90('0x1b')](_0x6c5d38['include'],function(_0x40ab26){return{'model':db[_0x40ab26[_0xdb90('0x1a')]],'as':_0x40ab26['as'],'attributes':_0x40ab26['attributes'],'include':_0x40ab26[_0xdb90('0x19')]?_[_0xdb90('0x1b')](_0x40ab26[_0xdb90('0x19')],function(_0x3ba5e1){return{'model':db[_0x3ba5e1[_0xdb90('0x1a')]],'as':_0x3ba5e1['as'],'attributes':_0x3ba5e1[_0xdb90('0x17')]};}):[]};}):[]};}):[]:[]})[_0xdb90('0x8')](function(_0x2563b3){logger[_0xdb90('0x9')](_0xdb90('0x1d'),_0x15b97d);logger[_0xdb90('0xc')](_0xdb90('0x1d'),_0x15b97d,JSON[_0xdb90('0xe')](_0x2563b3));_0x343053(_0x2563b3);})[_0xdb90('0x12')](function(_0x2aefe9){logger['error'](_0xdb90('0x1d'),_0x2aefe9['message'],_0x15b97d);_0x4e1f7b(_0x1383f5[_0xdb90('0xf')](0x1f4,_0x2aefe9[_0xdb90('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/user-setting/index.js b/server/api/user-setting/index.js index bd878e3..d239824 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 _0x2865=['./user-setting.controller','put','isAuthenticated','update','exports','express','Router'];(function(_0x51ed62,_0x574379){var _0x34aee3=function(_0x2958bc){while(--_0x2958bc){_0x51ed62['push'](_0x51ed62['shift']());}};_0x34aee3(++_0x574379);}(_0x2865,0x75));var _0x5286=function(_0x566b08,_0x17a853){_0x566b08=_0x566b08-0x0;var _0x503af5=_0x2865[_0x566b08];return _0x503af5;};'use strict';var express=require(_0x5286('0x0'));var router=express[_0x5286('0x1')]();var auth=require('../../components/auth/service');var controller=require(_0x5286('0x2'));router[_0x5286('0x3')]('/:id',auth[_0x5286('0x4')](),controller[_0x5286('0x5')]);module[_0x5286('0x6')]=router; \ No newline at end of file +var _0x1ad5=['isAuthenticated','exports','express','Router','../../components/auth/service','./user-setting.controller','put','/:id'];(function(_0x46698a,_0x8de1e4){var _0x356db0=function(_0x19e83c){while(--_0x19e83c){_0x46698a['push'](_0x46698a['shift']());}};_0x356db0(++_0x8de1e4);}(_0x1ad5,0x16a));var _0x51ad=function(_0x2ff4bd,_0x4780a6){_0x2ff4bd=_0x2ff4bd-0x0;var _0x28edc6=_0x1ad5[_0x2ff4bd];return _0x28edc6;};'use strict';var express=require(_0x51ad('0x0'));var router=express[_0x51ad('0x1')]();var auth=require(_0x51ad('0x2'));var controller=require(_0x51ad('0x3'));router[_0x51ad('0x4')](_0x51ad('0x5'),auth[_0x51ad('0x6')](),controller['update']);module[_0x51ad('0x7')]=router; \ No newline at end of file diff --git a/server/api/user-setting/user-setting.attributes.js b/server/api/user-setting/user-setting.attributes.js index aa3ba4c..c0fb07e 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 _0x3525=['exports','ENUM','BOOLEAN','TEXT','DATE','INTEGER','UserId','sequelize','error','info','debug'];(function(_0x34f8ca,_0x14290b){var _0x306fe5=function(_0x5734fd){while(--_0x5734fd){_0x34f8ca['push'](_0x34f8ca['shift']());}};_0x306fe5(++_0x14290b);}(_0x3525,0x1bf));var _0x5352=function(_0x2ee772,_0x4619a3){_0x2ee772=_0x2ee772-0x0;var _0x52af49=_0x3525[_0x2ee772];return _0x52af49;};'use strict';var Sequelize=require(_0x5352('0x0'));const CLIENT_SIDE_LOG_LEVELS=[_0x5352('0x1'),'warning',_0x5352('0x2'),_0x5352('0x3')];module[_0x5352('0x4')]={'clientSideLoggingLevel':{'type':Sequelize[_0x5352('0x5')](CLIENT_SIDE_LOG_LEVELS),'allowNull':![],'defaultValue':_0x5352('0x1'),'validate':{'isIn':[CLIENT_SIDE_LOG_LEVELS]}},'clientSideLoggingEnabled':{'type':Sequelize[_0x5352('0x6')],'defaultValue':![]},'clientSideLoggingScopes':{'type':Sequelize[_0x5352('0x7')],'allowNull':!![]},'clientSideLoggingEnabledSince':{'type':Sequelize[_0x5352('0x8')],'allowNull':!![],'defaultValue':null},'UserId':{'type':Sequelize[_0x5352('0x9')],'unique':_0x5352('0xa')}}; \ No newline at end of file +var _0x79d7=['info','debug','exports','ENUM','BOOLEAN','TEXT','INTEGER','UserId','error','warning'];(function(_0x26ff2e,_0x8caf9c){var _0x23c0ee=function(_0x2e4a53){while(--_0x2e4a53){_0x26ff2e['push'](_0x26ff2e['shift']());}};_0x23c0ee(++_0x8caf9c);}(_0x79d7,0xbc));var _0x779d=function(_0x16b9ed,_0x56517a){_0x16b9ed=_0x16b9ed-0x0;var _0x66b1f8=_0x79d7[_0x16b9ed];return _0x66b1f8;};'use strict';var Sequelize=require('sequelize');const CLIENT_SIDE_LOG_LEVELS=[_0x779d('0x0'),_0x779d('0x1'),_0x779d('0x2'),_0x779d('0x3')];module[_0x779d('0x4')]={'clientSideLoggingLevel':{'type':Sequelize[_0x779d('0x5')](CLIENT_SIDE_LOG_LEVELS),'allowNull':![],'defaultValue':_0x779d('0x0'),'validate':{'isIn':[CLIENT_SIDE_LOG_LEVELS]}},'clientSideLoggingEnabled':{'type':Sequelize[_0x779d('0x6')],'defaultValue':![]},'clientSideLoggingScopes':{'type':Sequelize[_0x779d('0x7')],'allowNull':!![]},'clientSideLoggingEnabledSince':{'type':Sequelize['DATE'],'allowNull':!![],'defaultValue':null},'UserId':{'type':Sequelize[_0x779d('0x8')],'unique':_0x779d('0x9')}}; \ No newline at end of file diff --git a/server/api/user-setting/user-setting.controller.js b/server/api/user-setting/user-setting.controller.js index d6746ff..af7cebb 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 _0xea1a=['./user-setting.socket','register','defaults','json','then','sendStatus','error','name','status','send','update','role','admin','Unauthorized','params','Invalid\x20user\x20setting\x20id','UserSetting','find','body','catch','lodash','ioredis','../../config/logger','api','../../mysqldb','socket.io-emitter','redis'];(function(_0x2a4cc6,_0x3ed438){var _0x381547=function(_0x44daba){while(--_0x44daba){_0x2a4cc6['push'](_0x2a4cc6['shift']());}};_0x381547(++_0x3ed438);}(_0xea1a,0x158));var _0xaea1=function(_0x48dce4,_0xef3da1){_0x48dce4=_0x48dce4-0x0;var _0x286cbd=_0xea1a[_0x48dce4];return _0x286cbd;};'use strict';var _=require(_0xaea1('0x0'));var Redis=require(_0xaea1('0x1'));var logger=require(_0xaea1('0x2'))(_0xaea1('0x3'));var config=require('../../config/environment');var db=require(_0xaea1('0x4'))['db'];var socket=require(_0xaea1('0x5'))(new Redis(config[_0xaea1('0x6')]));require(_0xaea1('0x7'))[_0xaea1('0x8')](socket);config[_0xaea1('0x6')]=_[_0xaea1('0x9')](config[_0xaea1('0x6')],{'host':'localhost','port':0x18eb});function respondWithResult(_0x884233,_0x8883ab){_0x8883ab=_0x8883ab||0xc8;return function(_0x3359a9){if(_0x3359a9){return _0x884233['status'](_0x8883ab)[_0xaea1('0xa')](_0x3359a9);}};}function saveUpdates(_0x553b92){return function(_0x39d980){if(_0x39d980){return _0x39d980['update'](_0x553b92)[_0xaea1('0xb')](function(_0x4de4c1){return _0x4de4c1;});}return null;};}function handleEntityNotFound(_0x5663f9){return function(_0x541e58){if(!_0x541e58){_0x5663f9[_0xaea1('0xc')](0x194);}return _0x541e58;};}function handleError(_0x4eb13f,_0x577709){_0x577709=_0x577709||0x1f4;return function(_0x18a725){logger[_0xaea1('0xd')](_0x18a725['stack']);if(_0x18a725[_0xaea1('0xe')]){delete _0x18a725[_0xaea1('0xe')];}_0x4eb13f[_0xaea1('0xf')](_0x577709)[_0xaea1('0x10')](_0x18a725);};}exports[_0xaea1('0x11')]=function(_0x7ad061,_0x376cc9){if(_0x7ad061['user'][_0xaea1('0x12')]!==_0xaea1('0x13'))throw new Error(_0xaea1('0x14'));if(isNaN(Number(_0x7ad061[_0xaea1('0x15')]['id'])))throw new Error(_0xaea1('0x16'));return db[_0xaea1('0x17')][_0xaea1('0x18')]({'where':{'id':_0x7ad061[_0xaea1('0x15')]['id']}})[_0xaea1('0xb')](handleEntityNotFound(_0x376cc9,null))[_0xaea1('0xb')](saveUpdates(_0x7ad061[_0xaea1('0x19')],null))[_0xaea1('0xb')](respondWithResult(_0x376cc9,null))[_0xaea1('0x1a')](handleError(_0x376cc9,null));}; \ No newline at end of file +var _0xbf5c=['defaults','redis','localhost','update','sendStatus','error','stack','name','send','user','role','params','UserSetting','then','body','catch','lodash','ioredis','../../config/logger','../../config/environment','../../mysqldb','socket.io-emitter','./user-setting.socket','register'];(function(_0x5305e9,_0x52b7d8){var _0x57bea3=function(_0x3df21b){while(--_0x3df21b){_0x5305e9['push'](_0x5305e9['shift']());}};_0x57bea3(++_0x52b7d8);}(_0xbf5c,0xb8));var _0xcbf5=function(_0x2f6d86,_0x3ccf3e){_0x2f6d86=_0x2f6d86-0x0;var _0x56c24d=_0xbf5c[_0x2f6d86];return _0x56c24d;};'use strict';var _=require(_0xcbf5('0x0'));var Redis=require(_0xcbf5('0x1'));var logger=require(_0xcbf5('0x2'))('api');var config=require(_0xcbf5('0x3'));var db=require(_0xcbf5('0x4'))['db'];var socket=require(_0xcbf5('0x5'))(new Redis(config['redis']));require(_0xcbf5('0x6'))[_0xcbf5('0x7')](socket);config['redis']=_[_0xcbf5('0x8')](config[_0xcbf5('0x9')],{'host':_0xcbf5('0xa'),'port':0x18eb});function respondWithResult(_0x522014,_0x4504dd){_0x4504dd=_0x4504dd||0xc8;return function(_0x31b6d1){if(_0x31b6d1){return _0x522014['status'](_0x4504dd)['json'](_0x31b6d1);}};}function saveUpdates(_0x36c122){return function(_0x2f10f5){if(_0x2f10f5){return _0x2f10f5[_0xcbf5('0xb')](_0x36c122)['then'](function(_0x320554){return _0x320554;});}return null;};}function handleEntityNotFound(_0x752a2a){return function(_0x29b871){if(!_0x29b871){_0x752a2a[_0xcbf5('0xc')](0x194);}return _0x29b871;};}function handleError(_0x4352b4,_0x248575){_0x248575=_0x248575||0x1f4;return function(_0x5db829){logger[_0xcbf5('0xd')](_0x5db829[_0xcbf5('0xe')]);if(_0x5db829[_0xcbf5('0xf')]){delete _0x5db829['name'];}_0x4352b4['status'](_0x248575)[_0xcbf5('0x10')](_0x5db829);};}exports['update']=function(_0x1d4942,_0x422734){if(_0x1d4942[_0xcbf5('0x11')][_0xcbf5('0x12')]!=='admin')throw new Error('Unauthorized');if(isNaN(Number(_0x1d4942[_0xcbf5('0x13')]['id'])))throw new Error('Invalid\x20user\x20setting\x20id');return db[_0xcbf5('0x14')]['find']({'where':{'id':_0x1d4942['params']['id']}})[_0xcbf5('0x15')](handleEntityNotFound(_0x422734,null))[_0xcbf5('0x15')](saveUpdates(_0x1d4942[_0xcbf5('0x16')],null))[_0xcbf5('0x15')](respondWithResult(_0x422734,null))[_0xcbf5('0x17')](handleError(_0x422734,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 757c279..d2df39d 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 _0xf02b=['save','update','remove','emit','hasOwnProperty','hook','../../mysqldb','UserSetting','setMaxListeners'];(function(_0x30ce32,_0x45c445){var _0xf3cfdf=function(_0xe30aeb){while(--_0xe30aeb){_0x30ce32['push'](_0x30ce32['shift']());}};_0xf3cfdf(++_0x45c445);}(_0xf02b,0x177));var _0xbf02=function(_0x4b55e8,_0x41ba7e){_0x4b55e8=_0x4b55e8-0x0;var _0x46e844=_0xf02b[_0x4b55e8];return _0x46e844;};'use strict';var EventEmitter=require('events');var UserSetting=require(_0xbf02('0x0'))['db'][_0xbf02('0x1')];var UserSettingEvents=new EventEmitter();UserSettingEvents[_0xbf02('0x2')](0x0);var events={'afterCreate':_0xbf02('0x3'),'afterUpdate':_0xbf02('0x4'),'afterDestroy':_0xbf02('0x5')};function emitEvent(_0x33c62d){return function(_0x41278b,_0x4b6f44,_0x42b5c8){UserSettingEvents[_0xbf02('0x6')](_0x33c62d+':'+_0x41278b['id'],_0x41278b);UserSettingEvents[_0xbf02('0x6')](_0x33c62d,_0x41278b);_0x42b5c8(null);};}for(var e in events){if(events[_0xbf02('0x7')](e)){var event=events[e];UserSetting[_0xbf02('0x8')](e,emitEvent(event));}}module['exports']=UserSettingEvents; \ No newline at end of file +var _0xfc4a=['setMaxListeners','save','remove','emit','hasOwnProperty','events','../../mysqldb'];(function(_0x4f83ca,_0x46f67a){var _0x1fbac3=function(_0x19e401){while(--_0x19e401){_0x4f83ca['push'](_0x4f83ca['shift']());}};_0x1fbac3(++_0x46f67a);}(_0xfc4a,0x1e1));var _0xafc4=function(_0x302c9d,_0x50ca92){_0x302c9d=_0x302c9d-0x0;var _0x4b2ee0=_0xfc4a[_0x302c9d];return _0x4b2ee0;};'use strict';var EventEmitter=require(_0xafc4('0x0'));var UserSetting=require(_0xafc4('0x1'))['db']['UserSetting'];var UserSettingEvents=new EventEmitter();UserSettingEvents[_0xafc4('0x2')](0x0);var events={'afterCreate':_0xafc4('0x3'),'afterUpdate':'update','afterDestroy':_0xafc4('0x4')};function emitEvent(_0x245050){return function(_0x1b7b36,_0x5d87f7,_0x3dfd31){UserSettingEvents[_0xafc4('0x5')](_0x245050+':'+_0x1b7b36['id'],_0x1b7b36);UserSettingEvents[_0xafc4('0x5')](_0x245050,_0x1b7b36);_0x3dfd31(null);};}for(var e in events){if(events[_0xafc4('0x6')](e)){var event=events[e];UserSetting['hook'](e,emitEvent(event));}}module['exports']=UserSettingEvents; \ No newline at end of file diff --git a/server/api/user-setting/user-setting.model.js b/server/api/user-setting/user-setting.model.js index 53bcc9a..8c32447 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 _0x97c1=['define','clientSideLoggingEnabled','clientSideLoggingEnabledSince','./user-setting.attributes','exports'];(function(_0x3a4216,_0x3455ae){var _0x6a13d2=function(_0x181ed2){while(--_0x181ed2){_0x3a4216['push'](_0x3a4216['shift']());}};_0x6a13d2(++_0x3455ae);}(_0x97c1,0xdf));var _0x197c=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x97c1[_0x122ef9];return _0x42fba0;};'use strict';var attributes=require(_0x197c('0x0'));module[_0x197c('0x1')]=function(_0x55b95a){return _0x55b95a[_0x197c('0x2')]('UserSetting',attributes,{'tableName':'user_settings','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x788d63){if(!_0x788d63[_0x197c('0x3')])_0x788d63[_0x197c('0x4')]=null;else if(_0x788d63[_0x197c('0x4')]===null)_0x788d63[_0x197c('0x4')]=new Date();}}});}; \ No newline at end of file +var _0x93e6=['clientSideLoggingEnabledSince','./user-setting.attributes','define','user_settings','clientSideLoggingEnabled'];(function(_0x1bd0fb,_0x57320c){var _0x1d6c27=function(_0x43afe9){while(--_0x43afe9){_0x1bd0fb['push'](_0x1bd0fb['shift']());}};_0x1d6c27(++_0x57320c);}(_0x93e6,0x11e));var _0x693e=function(_0x271d2,_0x139546){_0x271d2=_0x271d2-0x0;var _0x44c3e7=_0x93e6[_0x271d2];return _0x44c3e7;};'use strict';var attributes=require(_0x693e('0x0'));module['exports']=function(_0x5f4d40){return _0x5f4d40[_0x693e('0x1')]('UserSetting',attributes,{'tableName':_0x693e('0x2'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x4e7e48){if(!_0x4e7e48[_0x693e('0x3')])_0x4e7e48[_0x693e('0x4')]=null;else if(_0x4e7e48[_0x693e('0x4')]===null)_0x4e7e48['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 804fa46..fad5bed 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 _0xe240=['update','emit','user-setting:update','user-setting:update:user-','UserId','register','length','./user-setting.events','save'];(function(_0x4939cf,_0x100791){var _0xd70cae=function(_0x3c5d85){while(--_0x3c5d85){_0x4939cf['push'](_0x4939cf['shift']());}};_0xd70cae(++_0x100791);}(_0xe240,0x16f));var _0x0e24=function(_0x32f7d7,_0x54231b){_0x32f7d7=_0x32f7d7-0x0;var _0x133d09=_0xe240[_0x32f7d7];return _0x133d09;};'use strict';var UserSettingEvents=require(_0x0e24('0x0'));var events=[_0x0e24('0x1'),'remove',_0x0e24('0x2')];function createListener(_0x58cae3,_0x536558){return function(_0x70b5bd){_0x536558[_0x0e24('0x3')](_0x58cae3,_0x70b5bd);if(_0x58cae3===_0x0e24('0x4')){_0x536558[_0x0e24('0x3')](_0x0e24('0x5')+_0x70b5bd[_0x0e24('0x6')],_0x70b5bd);}};}exports[_0x0e24('0x7')]=function(_0xded089){for(var _0x2d0546=0x0,_0x44c41e=events[_0x0e24('0x8')];_0x2d0546<_0x44c41e;_0x2d0546++){var _0x33f101=events[_0x2d0546];var _0x4743bc=createListener('user-setting:'+_0x33f101,_0xded089);UserSettingEvents['on'](_0x33f101,_0x4743bc);}}; \ No newline at end of file +var _0x08b0=['length','user-setting:','update','emit','UserId','register'];(function(_0x32d305,_0x3b7f88){var _0x31715a=function(_0x57702f){while(--_0x57702f){_0x32d305['push'](_0x32d305['shift']());}};_0x31715a(++_0x3b7f88);}(_0x08b0,0xb0));var _0x008b=function(_0x314115,_0x22f606){_0x314115=_0x314115-0x0;var _0x1347df=_0x08b0[_0x314115];return _0x1347df;};'use strict';var UserSettingEvents=require('./user-setting.events');var events=['save','remove',_0x008b('0x0')];function createListener(_0x3fd4b4,_0x3e93a7){return function(_0x47f044){_0x3e93a7['emit'](_0x3fd4b4,_0x47f044);if(_0x3fd4b4==='user-setting:update'){_0x3e93a7[_0x008b('0x1')]('user-setting:update:user-'+_0x47f044[_0x008b('0x2')],_0x47f044);}};}exports[_0x008b('0x3')]=function(_0x5d1aa2){for(var _0x3ae7b9=0x0,_0xf309fc=events[_0x008b('0x4')];_0x3ae7b9<_0xf309fc;_0x3ae7b9++){var _0x502fb8=events[_0x3ae7b9];var _0x48f152=createListener(_0x008b('0x5')+_0x502fb8,_0x5d1aa2);UserSettingEvents['on'](_0x502fb8,_0x48f152);}}; \ No newline at end of file diff --git a/server/api/user/index.js b/server/api/user/index.js index c27bfd9..e5c0a90 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 _0x2eeb=['destroy','removeChatInteractions','removeFaxInteractions','removeSmsInteractions','removeOpenchannelInteractions','/:id/whatsapp_interactions','removeFaxAccounts','removeMailAccounts','removeOpenchannelAccounts','removeSmsAccounts','removeChatWebsites','removeWhatsappAccounts','/:id/messengerSoundNotification','messengerSoundNotification','exports','multer','util','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./user.controller','get','isAuthenticated','/describe','describe','whoami','/presence','getPresence','show','/:id/avatar','getAvatar','/:id/open_tabs','getOpenTabs','/:id/contacts','getContacts','/:id/queues','getQueues','/:id/queues_rt','getVoiceQueuesRt','/:id/groups','getRecordings','/:id/screen_recordings','/:id/chat/interactions','getChatInteractions','/:id/openchannel/interactions','getOpenchannelInteractions','/:id/mail/interactions','getMailInteractions','/:id/sms/interactions','getSmsInteractions','/:id/fax/interactions','getFaxInteractions','/:id/whatsapp/interactions','getWhatsappInteractions','/:id/teams','getTeams','/:id/lists','getLists','getAgents','getVoicePrefixes','/:id/fax_accounts','/:id/mail_accounts','getMailAccounts','/:id/openchannel_accounts','getOpenchannelAccounts','/:id/sms_accounts','/:id/chat_websites','getWhatsappAccounts','/:id/scheduled_calls','/:id/api_key','getApiKey','post','addContacts','/create_many','bulkCreate','addQueues','diskStorage','join','server/files/images/','format','now','originalname','single','file','addAvatar','login','/:id/logout','logout','/:id/unpause','unpause','addTeams','/:id/chat_interactions','addChatInteractions','/:id/mail_interactions','addMailInteractions','/:id/fax_interactions','/:id/sms_interactions','addSmsInteractions','/:id/openchannel_interactions','addFaxAccounts','addChatWebsites','/:id/whatsapp_accounts','addWhatsappAccounts','createApiKey','put','/:id','update','/:id/password','changePassword','delete','removeTeams'];(function(_0x5be41a,_0x1050a8){var _0xc6b19a=function(_0x43f25c){while(--_0x43f25c){_0x5be41a['push'](_0x5be41a['shift']());}};_0xc6b19a(++_0x1050a8);}(_0x2eeb,0x80));var _0xb2ee=function(_0x51ac7c,_0x8696f2){_0x51ac7c=_0x51ac7c-0x0;var _0x380ee7=_0x2eeb[_0x51ac7c];return _0x380ee7;};'use strict';var multer=require(_0xb2ee('0x0'));var util=require(_0xb2ee('0x1'));var path=require('path');var timeout=require(_0xb2ee('0x2'));var express=require(_0xb2ee('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xb2ee('0x4'));var interaction=require(_0xb2ee('0x5'));var config=require(_0xb2ee('0x6'));var controller=require(_0xb2ee('0x7'));router[_0xb2ee('0x8')]('/',auth[_0xb2ee('0x9')](),controller['index']);router['get'](_0xb2ee('0xa'),auth[_0xb2ee('0x9')](),controller[_0xb2ee('0xb')]);router['get']('/whoami',auth[_0xb2ee('0x9')](),controller[_0xb2ee('0xc')]);router[_0xb2ee('0x8')](_0xb2ee('0xd'),auth[_0xb2ee('0x9')](),controller[_0xb2ee('0xe')]);router[_0xb2ee('0x8')]('/:id',auth['isAuthenticated'](),controller[_0xb2ee('0xf')]);router[_0xb2ee('0x8')](_0xb2ee('0x10'),controller[_0xb2ee('0x11')]);router[_0xb2ee('0x8')](_0xb2ee('0x12'),auth[_0xb2ee('0x9')](),controller[_0xb2ee('0x13')]);router['get'](_0xb2ee('0x14'),auth[_0xb2ee('0x9')](),controller[_0xb2ee('0x15')]);router['get'](_0xb2ee('0x16'),auth['isAuthenticated'](),controller[_0xb2ee('0x17')]);router[_0xb2ee('0x8')](_0xb2ee('0x18'),auth[_0xb2ee('0x9')](),controller[_0xb2ee('0x19')]);router[_0xb2ee('0x8')](_0xb2ee('0x1a'),auth[_0xb2ee('0x9')](),controller['getGroups']);router[_0xb2ee('0x8')]('/:id/recordings',auth['isAuthenticated'](),controller[_0xb2ee('0x1b')]);router['get'](_0xb2ee('0x1c'),auth[_0xb2ee('0x9')](),controller['getScreenRecordings']);router[_0xb2ee('0x8')](_0xb2ee('0x1d'),auth[_0xb2ee('0x9')](),controller[_0xb2ee('0x1e')]);router[_0xb2ee('0x8')](_0xb2ee('0x1f'),auth['isAuthenticated'](),controller[_0xb2ee('0x20')]);router[_0xb2ee('0x8')](_0xb2ee('0x21'),auth[_0xb2ee('0x9')](),controller[_0xb2ee('0x22')]);router[_0xb2ee('0x8')](_0xb2ee('0x23'),auth[_0xb2ee('0x9')](),controller[_0xb2ee('0x24')]);router[_0xb2ee('0x8')](_0xb2ee('0x25'),auth['isAuthenticated'](),controller[_0xb2ee('0x26')]);router[_0xb2ee('0x8')](_0xb2ee('0x27'),auth[_0xb2ee('0x9')](),controller[_0xb2ee('0x28')]);router[_0xb2ee('0x8')](_0xb2ee('0x29'),auth['isAuthenticated'](),controller[_0xb2ee('0x2a')]);router[_0xb2ee('0x8')](_0xb2ee('0x2b'),auth[_0xb2ee('0x9')](),controller[_0xb2ee('0x2c')]);router[_0xb2ee('0x8')]('/:id/agents',auth[_0xb2ee('0x9')](),controller[_0xb2ee('0x2d')]);router['get']('/:id/prefixes',auth['isAuthenticated'](),controller[_0xb2ee('0x2e')]);router['get'](_0xb2ee('0x2f'),auth[_0xb2ee('0x9')](),controller['getFaxAccounts']);router['get'](_0xb2ee('0x30'),auth['isAuthenticated'](),controller[_0xb2ee('0x31')]);router[_0xb2ee('0x8')](_0xb2ee('0x32'),auth[_0xb2ee('0x9')](),controller[_0xb2ee('0x33')]);router[_0xb2ee('0x8')](_0xb2ee('0x34'),auth[_0xb2ee('0x9')](),controller['getSmsAccounts']);router[_0xb2ee('0x8')](_0xb2ee('0x35'),auth[_0xb2ee('0x9')](),controller['getChatWebsites']);router[_0xb2ee('0x8')]('/:id/whatsapp_accounts',auth[_0xb2ee('0x9')](),controller[_0xb2ee('0x36')]);router[_0xb2ee('0x8')](_0xb2ee('0x37'),auth[_0xb2ee('0x9')](),controller['getScheduledCalls']);router[_0xb2ee('0x8')](_0xb2ee('0x38'),auth[_0xb2ee('0x9')](),controller[_0xb2ee('0x39')]);router[_0xb2ee('0x3a')](_0xb2ee('0x14'),auth[_0xb2ee('0x9')](),controller[_0xb2ee('0x3b')]);router[_0xb2ee('0x3a')]('/',auth[_0xb2ee('0x9')](),controller['create']);router['post'](_0xb2ee('0x3c'),auth[_0xb2ee('0x9')](),controller[_0xb2ee('0x3d')]);router['post'](_0xb2ee('0x16'),auth[_0xb2ee('0x9')](),controller[_0xb2ee('0x3e')]);var upload=multer({'storage':multer[_0xb2ee('0x3f')]({'destination':function(_0x520bf9,_0x12ae65,_0x51e6df){_0x51e6df(null,path[_0xb2ee('0x40')](config['root'],_0xb2ee('0x41')));},'filename':function(_0x38089e,_0x55b72d,_0x52a98a){_0x52a98a(null,util[_0xb2ee('0x42')]('%s-%s',Date[_0xb2ee('0x43')](),_0x55b72d[_0xb2ee('0x44')]));}})});router[_0xb2ee('0x3a')](_0xb2ee('0x10'),upload[_0xb2ee('0x45')](_0xb2ee('0x46')),controller[_0xb2ee('0x47')]);router['post']('/:id/login',auth[_0xb2ee('0x9')](),controller[_0xb2ee('0x48')]);router[_0xb2ee('0x3a')](_0xb2ee('0x49'),auth[_0xb2ee('0x9')](),controller[_0xb2ee('0x4a')]);router['post']('/:id/pause',auth[_0xb2ee('0x9')](),controller['pause']);router['post'](_0xb2ee('0x4b'),auth[_0xb2ee('0x9')](),controller[_0xb2ee('0x4c')]);router[_0xb2ee('0x3a')]('/:id/teams',auth[_0xb2ee('0x9')](),controller[_0xb2ee('0x4d')]);router[_0xb2ee('0x3a')](_0xb2ee('0x4e'),auth[_0xb2ee('0x9')](),controller[_0xb2ee('0x4f')]);router[_0xb2ee('0x3a')](_0xb2ee('0x50'),auth[_0xb2ee('0x9')](),controller[_0xb2ee('0x51')]);router[_0xb2ee('0x3a')](_0xb2ee('0x52'),auth[_0xb2ee('0x9')](),controller['addFaxInteractions']);router[_0xb2ee('0x3a')](_0xb2ee('0x53'),auth[_0xb2ee('0x9')](),controller[_0xb2ee('0x54')]);router[_0xb2ee('0x3a')](_0xb2ee('0x55'),auth['isAuthenticated'](),controller['addOpenchannelInteractions']);router[_0xb2ee('0x3a')]('/:id/whatsapp_interactions',auth['isAuthenticated'](),controller['addWhatsappInteractions']);router['post'](_0xb2ee('0x2f'),auth[_0xb2ee('0x9')](),controller[_0xb2ee('0x56')]);router[_0xb2ee('0x3a')](_0xb2ee('0x30'),auth[_0xb2ee('0x9')](),controller['addMailAccounts']);router['post'](_0xb2ee('0x32'),auth['isAuthenticated'](),controller['addOpenchannelAccounts']);router[_0xb2ee('0x3a')](_0xb2ee('0x34'),auth['isAuthenticated'](),controller['addSmsAccounts']);router[_0xb2ee('0x3a')](_0xb2ee('0x35'),auth[_0xb2ee('0x9')](),controller[_0xb2ee('0x57')]);router[_0xb2ee('0x3a')](_0xb2ee('0x58'),auth[_0xb2ee('0x9')](),controller[_0xb2ee('0x59')]);router[_0xb2ee('0x3a')](_0xb2ee('0x38'),auth[_0xb2ee('0x9')](),controller[_0xb2ee('0x5a')]);router[_0xb2ee('0x5b')](_0xb2ee('0x5c'),auth[_0xb2ee('0x9')](),controller[_0xb2ee('0x5d')]);router['put'](_0xb2ee('0x5e'),auth[_0xb2ee('0x9')](),controller[_0xb2ee('0x5f')]);router[_0xb2ee('0x60')](_0xb2ee('0x16'),auth[_0xb2ee('0x9')](),controller['removeQueues']);router['delete'](_0xb2ee('0x29'),auth[_0xb2ee('0x9')](),controller[_0xb2ee('0x61')]);router[_0xb2ee('0x60')]('/:id',auth[_0xb2ee('0x9')](),controller[_0xb2ee('0x62')]);router[_0xb2ee('0x60')](_0xb2ee('0x4e'),auth['isAuthenticated'](),controller[_0xb2ee('0x63')]);router[_0xb2ee('0x60')](_0xb2ee('0x50'),auth[_0xb2ee('0x9')](),controller['removeMailInteractions']);router[_0xb2ee('0x60')](_0xb2ee('0x52'),auth['isAuthenticated'](),controller[_0xb2ee('0x64')]);router[_0xb2ee('0x60')]('/:id/sms_interactions',auth['isAuthenticated'](),controller[_0xb2ee('0x65')]);router[_0xb2ee('0x60')](_0xb2ee('0x55'),auth[_0xb2ee('0x9')](),controller[_0xb2ee('0x66')]);router[_0xb2ee('0x60')](_0xb2ee('0x67'),auth[_0xb2ee('0x9')](),controller['removeWhatsappInteractions']);router[_0xb2ee('0x60')]('/:id/fax_accounts',auth[_0xb2ee('0x9')](),controller[_0xb2ee('0x68')]);router[_0xb2ee('0x60')]('/:id/mail_accounts',auth[_0xb2ee('0x9')](),controller[_0xb2ee('0x69')]);router['delete'](_0xb2ee('0x32'),auth[_0xb2ee('0x9')](),controller[_0xb2ee('0x6a')]);router[_0xb2ee('0x60')](_0xb2ee('0x34'),auth['isAuthenticated'](),controller[_0xb2ee('0x6b')]);router[_0xb2ee('0x60')]('/:id/chat_websites',auth[_0xb2ee('0x9')](),controller[_0xb2ee('0x6c')]);router[_0xb2ee('0x60')]('/:id/whatsapp_accounts',auth['isAuthenticated'](),controller[_0xb2ee('0x6d')]);router[_0xb2ee('0x60')](_0xb2ee('0x38'),auth['isAuthenticated'](),controller['removeApiKey']);router[_0xb2ee('0x3a')](_0xb2ee('0x6e'),auth[_0xb2ee('0x9')](),controller[_0xb2ee('0x6f')]);module[_0xb2ee('0x70')]=router; \ No newline at end of file +var _0x9341=['addMailAccounts','addOpenchannelAccounts','addSmsAccounts','addChatWebsites','addWhatsappAccounts','put','/:id','update','/:id/password','changePassword','delete','removeTeams','destroy','/:id/chat_interactions','removeChatInteractions','removeMailInteractions','removeFaxInteractions','/:id/sms_interactions','removeSmsInteractions','removeOpenchannelInteractions','removeWhatsappInteractions','removeFaxAccounts','removeMailAccounts','removeSmsAccounts','removeWhatsappAccounts','removeApiKey','/:id/messengerSoundNotification','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./user.controller','get','isAuthenticated','/describe','/whoami','whoami','getPresence','show','/:id/avatar','getAvatar','/:id/open_tabs','getOpenTabs','getContacts','/:id/queues','getQueues','/:id/queues_rt','getVoiceQueuesRt','/:id/recordings','getRecordings','/:id/screen_recordings','getScreenRecordings','/:id/chat/interactions','getChatInteractions','getOpenchannelInteractions','/:id/mail/interactions','getMailInteractions','/:id/sms/interactions','getSmsInteractions','/:id/whatsapp/interactions','getWhatsappInteractions','/:id/teams','getTeams','/:id/lists','getLists','/:id/agents','getAgents','/:id/prefixes','/:id/fax_accounts','/:id/mail_accounts','getMailAccounts','/:id/openchannel_accounts','getOpenchannelAccounts','/:id/sms_accounts','getSmsAccounts','/:id/chat_websites','getChatWebsites','/:id/whatsapp_accounts','getWhatsappAccounts','/:id/scheduled_calls','getScheduledCalls','/:id/api_key','post','addContacts','create','/create_many','bulkCreate','join','root','server/files/images/','format','%s-%s','now','originalname','single','/:id/login','/:id/pause','pause','/:id/unpause','addChatInteractions','/:id/mail_interactions','addMailInteractions','/:id/fax_interactions','addFaxInteractions','addSmsInteractions','/:id/openchannel_interactions','addOpenchannelInteractions','/:id/whatsapp_interactions','addWhatsappInteractions','addFaxAccounts'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9341,0xff));var _0x1934=function(_0x49813d,_0x1c8577){_0x49813d=_0x49813d-0x0;var _0x432928=_0x9341[_0x49813d];return _0x432928;};'use strict';var multer=require(_0x1934('0x0'));var util=require(_0x1934('0x1'));var path=require('path');var timeout=require(_0x1934('0x2'));var express=require('express');var router=express[_0x1934('0x3')]();var fs_extra=require(_0x1934('0x4'));var auth=require(_0x1934('0x5'));var interaction=require(_0x1934('0x6'));var config=require(_0x1934('0x7'));var controller=require(_0x1934('0x8'));router[_0x1934('0x9')]('/',auth[_0x1934('0xa')](),controller['index']);router[_0x1934('0x9')](_0x1934('0xb'),auth[_0x1934('0xa')](),controller['describe']);router[_0x1934('0x9')](_0x1934('0xc'),auth['isAuthenticated'](),controller[_0x1934('0xd')]);router['get']('/presence',auth[_0x1934('0xa')](),controller[_0x1934('0xe')]);router[_0x1934('0x9')]('/:id',auth['isAuthenticated'](),controller[_0x1934('0xf')]);router['get'](_0x1934('0x10'),controller[_0x1934('0x11')]);router[_0x1934('0x9')](_0x1934('0x12'),auth[_0x1934('0xa')](),controller[_0x1934('0x13')]);router[_0x1934('0x9')]('/:id/contacts',auth[_0x1934('0xa')](),controller[_0x1934('0x14')]);router[_0x1934('0x9')](_0x1934('0x15'),auth[_0x1934('0xa')](),controller[_0x1934('0x16')]);router[_0x1934('0x9')](_0x1934('0x17'),auth[_0x1934('0xa')](),controller[_0x1934('0x18')]);router['get']('/:id/groups',auth['isAuthenticated'](),controller['getGroups']);router['get'](_0x1934('0x19'),auth['isAuthenticated'](),controller[_0x1934('0x1a')]);router[_0x1934('0x9')](_0x1934('0x1b'),auth[_0x1934('0xa')](),controller[_0x1934('0x1c')]);router['get'](_0x1934('0x1d'),auth[_0x1934('0xa')](),controller[_0x1934('0x1e')]);router['get']('/:id/openchannel/interactions',auth['isAuthenticated'](),controller[_0x1934('0x1f')]);router[_0x1934('0x9')](_0x1934('0x20'),auth[_0x1934('0xa')](),controller[_0x1934('0x21')]);router['get'](_0x1934('0x22'),auth[_0x1934('0xa')](),controller[_0x1934('0x23')]);router['get']('/:id/fax/interactions',auth[_0x1934('0xa')](),controller['getFaxInteractions']);router['get'](_0x1934('0x24'),auth[_0x1934('0xa')](),controller[_0x1934('0x25')]);router[_0x1934('0x9')](_0x1934('0x26'),auth[_0x1934('0xa')](),controller[_0x1934('0x27')]);router[_0x1934('0x9')](_0x1934('0x28'),auth[_0x1934('0xa')](),controller[_0x1934('0x29')]);router[_0x1934('0x9')](_0x1934('0x2a'),auth[_0x1934('0xa')](),controller[_0x1934('0x2b')]);router[_0x1934('0x9')](_0x1934('0x2c'),auth[_0x1934('0xa')](),controller['getVoicePrefixes']);router['get'](_0x1934('0x2d'),auth[_0x1934('0xa')](),controller['getFaxAccounts']);router['get'](_0x1934('0x2e'),auth['isAuthenticated'](),controller[_0x1934('0x2f')]);router[_0x1934('0x9')](_0x1934('0x30'),auth[_0x1934('0xa')](),controller[_0x1934('0x31')]);router[_0x1934('0x9')](_0x1934('0x32'),auth[_0x1934('0xa')](),controller[_0x1934('0x33')]);router[_0x1934('0x9')](_0x1934('0x34'),auth[_0x1934('0xa')](),controller[_0x1934('0x35')]);router[_0x1934('0x9')](_0x1934('0x36'),auth[_0x1934('0xa')](),controller[_0x1934('0x37')]);router['get'](_0x1934('0x38'),auth[_0x1934('0xa')](),controller[_0x1934('0x39')]);router[_0x1934('0x9')](_0x1934('0x3a'),auth['isAuthenticated'](),controller['getApiKey']);router[_0x1934('0x3b')]('/:id/contacts',auth['isAuthenticated'](),controller[_0x1934('0x3c')]);router[_0x1934('0x3b')]('/',auth[_0x1934('0xa')](),controller[_0x1934('0x3d')]);router[_0x1934('0x3b')](_0x1934('0x3e'),auth[_0x1934('0xa')](),controller[_0x1934('0x3f')]);router[_0x1934('0x3b')]('/:id/queues',auth[_0x1934('0xa')](),controller['addQueues']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x2e0389,_0x2ee622,_0x21293b){_0x21293b(null,path[_0x1934('0x40')](config[_0x1934('0x41')],_0x1934('0x42')));},'filename':function(_0x2141cb,_0x5c55b0,_0x2e2a21){_0x2e2a21(null,util[_0x1934('0x43')](_0x1934('0x44'),Date[_0x1934('0x45')](),_0x5c55b0[_0x1934('0x46')]));}})});router['post'](_0x1934('0x10'),upload[_0x1934('0x47')]('file'),controller['addAvatar']);router['post'](_0x1934('0x48'),auth['isAuthenticated'](),controller['login']);router['post']('/:id/logout',auth['isAuthenticated'](),controller['logout']);router[_0x1934('0x3b')](_0x1934('0x49'),auth[_0x1934('0xa')](),controller[_0x1934('0x4a')]);router[_0x1934('0x3b')](_0x1934('0x4b'),auth[_0x1934('0xa')](),controller['unpause']);router[_0x1934('0x3b')]('/:id/teams',auth[_0x1934('0xa')](),controller['addTeams']);router[_0x1934('0x3b')]('/:id/chat_interactions',auth[_0x1934('0xa')](),controller[_0x1934('0x4c')]);router[_0x1934('0x3b')](_0x1934('0x4d'),auth[_0x1934('0xa')](),controller[_0x1934('0x4e')]);router[_0x1934('0x3b')](_0x1934('0x4f'),auth['isAuthenticated'](),controller[_0x1934('0x50')]);router[_0x1934('0x3b')]('/:id/sms_interactions',auth[_0x1934('0xa')](),controller[_0x1934('0x51')]);router['post'](_0x1934('0x52'),auth[_0x1934('0xa')](),controller[_0x1934('0x53')]);router[_0x1934('0x3b')](_0x1934('0x54'),auth['isAuthenticated'](),controller[_0x1934('0x55')]);router['post'](_0x1934('0x2d'),auth[_0x1934('0xa')](),controller[_0x1934('0x56')]);router['post'](_0x1934('0x2e'),auth[_0x1934('0xa')](),controller[_0x1934('0x57')]);router['post'](_0x1934('0x30'),auth[_0x1934('0xa')](),controller[_0x1934('0x58')]);router[_0x1934('0x3b')](_0x1934('0x32'),auth['isAuthenticated'](),controller[_0x1934('0x59')]);router[_0x1934('0x3b')]('/:id/chat_websites',auth[_0x1934('0xa')](),controller[_0x1934('0x5a')]);router['post'](_0x1934('0x36'),auth[_0x1934('0xa')](),controller[_0x1934('0x5b')]);router['post']('/:id/api_key',auth[_0x1934('0xa')](),controller['createApiKey']);router[_0x1934('0x5c')](_0x1934('0x5d'),auth[_0x1934('0xa')](),controller[_0x1934('0x5e')]);router['put'](_0x1934('0x5f'),auth[_0x1934('0xa')](),controller[_0x1934('0x60')]);router[_0x1934('0x61')](_0x1934('0x15'),auth[_0x1934('0xa')](),controller['removeQueues']);router['delete'](_0x1934('0x26'),auth[_0x1934('0xa')](),controller[_0x1934('0x62')]);router[_0x1934('0x61')](_0x1934('0x5d'),auth['isAuthenticated'](),controller[_0x1934('0x63')]);router[_0x1934('0x61')](_0x1934('0x64'),auth[_0x1934('0xa')](),controller[_0x1934('0x65')]);router[_0x1934('0x61')](_0x1934('0x4d'),auth[_0x1934('0xa')](),controller[_0x1934('0x66')]);router[_0x1934('0x61')](_0x1934('0x4f'),auth[_0x1934('0xa')](),controller[_0x1934('0x67')]);router[_0x1934('0x61')](_0x1934('0x68'),auth['isAuthenticated'](),controller[_0x1934('0x69')]);router[_0x1934('0x61')](_0x1934('0x52'),auth[_0x1934('0xa')](),controller[_0x1934('0x6a')]);router[_0x1934('0x61')](_0x1934('0x54'),auth[_0x1934('0xa')](),controller[_0x1934('0x6b')]);router[_0x1934('0x61')](_0x1934('0x2d'),auth[_0x1934('0xa')](),controller[_0x1934('0x6c')]);router[_0x1934('0x61')]('/:id/mail_accounts',auth[_0x1934('0xa')](),controller[_0x1934('0x6d')]);router[_0x1934('0x61')](_0x1934('0x30'),auth['isAuthenticated'](),controller['removeOpenchannelAccounts']);router[_0x1934('0x61')](_0x1934('0x32'),auth[_0x1934('0xa')](),controller[_0x1934('0x6e')]);router[_0x1934('0x61')]('/:id/chat_websites',auth[_0x1934('0xa')](),controller['removeChatWebsites']);router[_0x1934('0x61')](_0x1934('0x36'),auth[_0x1934('0xa')](),controller[_0x1934('0x6f')]);router[_0x1934('0x61')](_0x1934('0x3a'),auth[_0x1934('0xa')](),controller[_0x1934('0x70')]);router[_0x1934('0x3b')](_0x1934('0x71'),auth[_0x1934('0xa')](),controller['messengerSoundNotification']);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 b8869c6..4229b7c 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 _0x74a7=['PROHIB_FAILED_SCREEN','PROHIB','udp','transport','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','info','shortinfo','update','outgoing','force_rport,comedia','nat','join','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','ulaw;alaw;gsm','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','yes','never','always','accept','refuse','originate','uac','uas','fingerprint','certificate','active','passive','nonat','get','isArray','wss','encryption','avpf','force_avp','icesupport','dtlsenable','dtlsverify','dtlssetup','dtlscertfile','dtlsprivatekey','rtcp_mux','actpass','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','permissions','VIRTUAL','phoneBarEnableScreenRecordingByAgent','string','true','blockedAt','loginAttempts','UNSIGNED','sequelize','moment','util','lodash','exports','STRING','setDataValue','defaultuser','The\x20name\x20of\x20the\x20user','\x22%s\x22\x20<%s>','getDataValue','internal','email','toLowerCase','ENUM','admin','user','agent','telephone','local','INTEGER','accountcode','fullname','BOOLEAN','DATE','dynamic','friend','peer','from-sip','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN'];(function(_0x3703d0,_0x21996c){var _0x20ea6d=function(_0x3934c9){while(--_0x3934c9){_0x3703d0['push'](_0x3703d0['shift']());}};_0x20ea6d(++_0x21996c);}(_0x74a7,0x1a5));var _0x774a=function(_0x38e0f5,_0x6fcf7b){_0x38e0f5=_0x38e0f5-0x0;var _0x5d37a=_0x74a7[_0x38e0f5];return _0x5d37a;};'use strict';var Sequelize=require(_0x774a('0x0'));var moment=require(_0x774a('0x1'));var util=require(_0x774a('0x2'));var _=require(_0x774a('0x3'));module[_0x774a('0x4')]={'name':{'type':Sequelize[_0x774a('0x5')],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x446c33){this[_0x774a('0x6')]('name',_0x446c33);this[_0x774a('0x6')](_0x774a('0x7'),_0x446c33);},'comment':_0x774a('0x8')},'fullname':{'type':Sequelize[_0x774a('0x5')],'allowNull':![],'set':function(_0x1ef30d){this[_0x774a('0x6')]('fullname',_0x1ef30d);this[_0x774a('0x6')]('callerid',util['format'](_0x774a('0x9'),_0x1ef30d,this[_0x774a('0xa')](_0x774a('0xb'))));}},'alias':{'type':Sequelize[_0x774a('0x5')]},'email':{'type':Sequelize[_0x774a('0x5')],'allowNull':![],'unique':_0x774a('0xc'),'validate':{'isEmail':!![]},'set':function(_0x2aa218){if(_0x2aa218){this[_0x774a('0x6')](_0x774a('0xc'),_0x2aa218[_0x774a('0xd')]());}}},'role':{'type':Sequelize[_0x774a('0xe')](_0x774a('0xf'),_0x774a('0x10'),_0x774a('0x11'),_0x774a('0x12')),'allowNull':![]},'password':{'type':Sequelize[_0x774a('0x5')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize['STRING'],'defaultValue':_0x774a('0x13')},'internal':{'type':Sequelize[_0x774a('0x14')](0xb),'allowNull':![],'unique':_0x774a('0xb'),'set':function(_0x928265){this[_0x774a('0x6')](_0x774a('0xb'),_0x928265);this[_0x774a('0x6')](_0x774a('0x15'),_0x928265);this[_0x774a('0x6')]('callerid',util['format'](_0x774a('0x9'),this[_0x774a('0xa')](_0x774a('0x16')),_0x928265));}},'salt':{'type':Sequelize[_0x774a('0x5')]},'phone':{'type':Sequelize[_0x774a('0x5')]},'mobile':{'type':Sequelize[_0x774a('0x5')]},'address':{'type':Sequelize['STRING']},'zipcode':{'type':Sequelize['STRING']},'userpic':{'type':Sequelize['STRING']},'city':{'type':Sequelize[_0x774a('0x5')]},'country':{'type':Sequelize[_0x774a('0x5')]},'online':{'type':Sequelize[_0x774a('0x17')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize[_0x774a('0x18')]},'voicePause':{'type':Sequelize[_0x774a('0x17')],'defaultValue':![]},'chatPause':{'type':Sequelize[_0x774a('0x17')],'defaultValue':![]},'mailPause':{'type':Sequelize[_0x774a('0x17')],'defaultValue':![]},'faxPause':{'type':Sequelize[_0x774a('0x17')],'defaultValue':![]},'smsPause':{'type':Sequelize[_0x774a('0x17')],'defaultValue':![]},'whatsappPause':{'type':Sequelize[_0x774a('0x17')],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0x774a('0x17')],'defaultValue':![]},'pauseType':{'type':Sequelize[_0x774a('0x5')],'defaultValue':'DEFAULT\x20PAUSE'},'lastPauseAt':{'type':Sequelize[_0x774a('0x18')]},'chatCapacity':{'type':Sequelize[_0x774a('0x14')],'defaultValue':0x0},'mailCapacity':{'type':Sequelize[_0x774a('0x14')],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0x774a('0x14')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0x774a('0x14')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0x774a('0x14')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0x774a('0x14')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0x774a('0x17')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0x774a('0x17')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize[_0x774a('0x14')](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0x774a('0x14')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0x774a('0x14')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0x774a('0x17')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0x774a('0x17')],'defaultValue':![]},'chanspy':{'type':Sequelize[_0x774a('0x17')],'defaultValue':![]},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'host':{'type':Sequelize[_0x774a('0x5')],'allowNull':!![],'defaultValue':_0x774a('0x19')},'ipaddr':{'type':Sequelize[_0x774a('0x5')],'allowNull':!![]},'port':{'type':Sequelize[_0x774a('0x14')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize[_0x774a('0x14')](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0x774a('0x5')],'allowNull':!![]},'regserver':{'type':Sequelize[_0x774a('0x5')],'allowNull':!![]},'useragent':{'type':Sequelize[_0x774a('0x5')],'allowNull':!![]},'lastms':{'type':Sequelize[_0x774a('0x14')](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0x774a('0xe')](_0x774a('0x1a'),_0x774a('0x10'),_0x774a('0x1b')),'allowNull':!![],'defaultValue':'friend'},'context':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x774a('0x1c')},'callingpres':{'type':Sequelize['ENUM'](_0x774a('0x1d'),_0x774a('0x1e'),_0x774a('0x1f'),'ALLOWED',_0x774a('0x20'),_0x774a('0x21'),_0x774a('0x22'),_0x774a('0x23')),'allowNull':!![]},'deny':{'type':Sequelize['STRING'],'allowNull':!![]},'permit':{'type':Sequelize['STRING'],'allowNull':!![]},'secret':{'type':Sequelize[_0x774a('0x5')],'allowNull':!![]},'md5secret':{'type':Sequelize['STRING'],'allowNull':!![]},'remotesecret':{'type':Sequelize['STRING'],'allowNull':!![]},'transport':{'type':Sequelize[_0x774a('0x5')],'allowNull':!![],'defaultValue':_0x774a('0x24'),'set':function(_0xd5d115){this[_0x774a('0x6')]('transport',_0xd5d115?_0xd5d115['join'](','):null);},'get':function(){return this['getDataValue']('transport')?this[_0x774a('0xa')](_0x774a('0x25'))[_0x774a('0x26')](','):null;},'comment':_0x774a('0x27')},'dtmfmode':{'type':Sequelize['ENUM']('rfc2833',_0x774a('0x28'),_0x774a('0x29'),'inband','auto'),'allowNull':!![],'defaultValue':'rfc2833'},'directmedia':{'type':Sequelize[_0x774a('0xe')]('yes','no','nonat',_0x774a('0x2a'),_0x774a('0x2b')),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x774a('0xe')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x774a('0x5')],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0x774a('0x5')],'allowNull':!![]},'nat':{'type':Sequelize[_0x774a('0x5')],'allowNull':!![],'defaultValue':_0x774a('0x2c'),'set':function(_0x2b55b1){this['setDataValue'](_0x774a('0x2d'),_0x2b55b1?_0x2b55b1[_0x774a('0x2e')](','):null);},'get':function(){return this[_0x774a('0xa')](_0x774a('0x2d'))?this[_0x774a('0xa')](_0x774a('0x2d'))[_0x774a('0x26')](','):null;},'comment':_0x774a('0x2f')},'callgroup':{'type':Sequelize['STRING']},'namedcallgroup':{'type':Sequelize[_0x774a('0x5')]},'pickupgroup':{'type':Sequelize['STRING']},'namedpickupgroup':{'type':Sequelize[_0x774a('0x5')]},'language':{'type':Sequelize[_0x774a('0x5')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x774a('0x5')]},'disallow':{'type':Sequelize[_0x774a('0x5')],'allowNull':![],'defaultValue':_0x774a('0x30')},'allow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x774a('0x31'),'set':function(_0x128c17){this['setDataValue'](_0x774a('0x32'),_0x128c17?_0x128c17['join'](';'):'ulaw;alaw;gsm');},'get':function(){return this[_0x774a('0xa')]('allow')?this[_0x774a('0xa')](_0x774a('0x32'))['split'](';'):null;},'comment':_0x774a('0x33')},'autoframing':{'type':Sequelize[_0x774a('0xe')]('yes','no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0x774a('0x5')],'allowNull':!![],'set':function(_0x5d79d9){this[_0x774a('0x6')](_0x774a('0x34'),_0x5d79d9?_0x5d79d9[_0x774a('0x2e')](','):null);},'get':function(){return this[_0x774a('0xa')](_0x774a('0x34'))?this['getDataValue'](_0x774a('0x34'))[_0x774a('0x26')](','):null;},'comment':_0x774a('0x35')},'trustrpid':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x774a('0xe')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x774a('0xe')](_0x774a('0x36'),'no',_0x774a('0x37')),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0x774a('0xe')](_0x774a('0x36'),'no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0x774a('0xe')](_0x774a('0x36'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0x774a('0x14')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0x774a('0x5')],'allowNull':!![]},'callerid':{'type':Sequelize[_0x774a('0x5')],'allowNull':!![],'defaultValue':'\x22\x22\x20<>'},'amaflags':{'type':Sequelize[_0x774a('0x5')],'allowNull':!![]},'callcounter':{'type':Sequelize[_0x774a('0xe')](_0x774a('0x36'),'no'),'allowNull':!![],'defaultValue':'yes'},'busylevel':{'type':Sequelize[_0x774a('0x14')](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0x774a('0xe')](_0x774a('0x36'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize['ENUM'](_0x774a('0x36'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0x774a('0xe')]('yes','no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0x774a('0xe')](_0x774a('0x36'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0x774a('0x5')],'allowNull':!![]},'template':{'type':Sequelize[_0x774a('0x5')],'allowNull':!![]},'videosupport':{'type':Sequelize[_0x774a('0xe')](_0x774a('0x36'),'no',_0x774a('0x38')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x774a('0x14')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize[_0x774a('0xe')](_0x774a('0x36'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0x774a('0x5')],'allowNull':!![]},'session_timers':{'type':Sequelize[_0x774a('0xe')](_0x774a('0x39'),_0x774a('0x3a'),_0x774a('0x3b')),'allowNull':!![]},'session_expires':{'type':Sequelize[_0x774a('0x14')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0x774a('0x14')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0x774a('0xe')](_0x774a('0x3c'),_0x774a('0x3d')),'allowNull':!![],'defaultValue':_0x774a('0x3d')},'t38pt_usertpsource':{'type':Sequelize[_0x774a('0x5')],'allowNull':!![]},'regexten':{'type':Sequelize[_0x774a('0x5')],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0x774a('0x5')],'allowNull':!![]},'fromuser':{'type':Sequelize[_0x774a('0x5')],'allowNull':!![]},'qualify':{'type':Sequelize['ENUM'](_0x774a('0x36'),'no'),'allowNull':!![],'defaultValue':_0x774a('0x36')},'keepalive':{'type':Sequelize[_0x774a('0x14')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0x774a('0x5')],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0x774a('0x5')],'allowNull':!![]},'rtptimeout':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize[_0x774a('0x14')](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0x774a('0x14')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize[_0x774a('0xe')](_0x774a('0x36'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x774a('0x5')],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0x774a('0x5')],'allowNull':!![]},'timert1':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0x774a('0x14')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0x774a('0x14')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize['STRING'],'allowNull':!![]},'contactdeny':{'type':Sequelize[_0x774a('0x5')],'allowNull':!![]},'contactacl':{'type':Sequelize[_0x774a('0x5')],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0x774a('0x5')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize[_0x774a('0x5')],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0x774a('0x14')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize[_0x774a('0xe')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize[_0x774a('0xe')](_0x774a('0x36'),'no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0x774a('0xe')](_0x774a('0x36'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize[_0x774a('0xe')](_0x774a('0x36'),'no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize[_0x774a('0xe')](_0x774a('0x36'),'no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize[_0x774a('0xe')](_0x774a('0x36'),'no',_0x774a('0x3e'),_0x774a('0x3f')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0x774a('0x14')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0x774a('0x5')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0x774a('0x5')],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0x774a('0x5')],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0x774a('0x5')],'allowNull':!![]},'dtlscapath':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0x774a('0xe')](_0x774a('0x40'),_0x774a('0x41'),'actpass'),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize['STRING'],'allowNull':!![]},'usereqphone':{'type':Sequelize[_0x774a('0xe')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x774a('0x5')],'allowNull':!![]},'recordofffeature':{'type':Sequelize[_0x774a('0x5')],'allowNull':!![]},'call_limit':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize['ENUM'](_0x774a('0x36'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0x774a('0xe')](_0x774a('0x36'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0x774a('0x5')],'allowNull':!![]},'mohinterpret':{'type':Sequelize['STRING'],'allowNull':!![]},'mohsuggest':{'type':Sequelize['STRING'],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0x774a('0x5')],'allowNull':!![]},'canreinvite':{'type':Sequelize[_0x774a('0xe')](_0x774a('0x36'),'no',_0x774a('0x42'),'update','update,nonat'),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0x774a('0x5')]},'resetPasswordExpires':{'type':Sequelize[_0x774a('0x18')]},'passwordResetAt':{'type':Sequelize[_0x774a('0x18')],'defaultValue':null},'previousPasswords':{'type':Sequelize['TEXT']},'showWebBar':{'type':Sequelize[_0x774a('0x14')],'defaultValue':0x0,'set':function(_0x319ab3){this['setDataValue']('showWebBar',_0x319ab3);var _0x499491=this[_0x774a('0x43')]({'plain':!![]});switch(_0x319ab3){case 0x0:case 0x1:var _0x792326=_0x499491[_0x774a('0x25')]?_[_0x774a('0x44')](_0x499491[_0x774a('0x25')])?_0x499491['transport'][_0x774a('0x2e')]():_0x499491[_0x774a('0x25')]:_0x774a('0x24');if(_0x792326===_0x774a('0x45')){_0x792326=_0x774a('0x24');}this[_0x774a('0x6')](_0x774a('0x25'),_0x792326);this[_0x774a('0x6')](_0x774a('0x46'),'no');this['setDataValue'](_0x774a('0x47'),null);this[_0x774a('0x6')](_0x774a('0x48'),null);this[_0x774a('0x6')](_0x774a('0x49'),null);this[_0x774a('0x6')](_0x774a('0x4a'),null);this[_0x774a('0x6')](_0x774a('0x4b'),null);this[_0x774a('0x6')](_0x774a('0x4c'),null);this[_0x774a('0x6')](_0x774a('0x4d'),null);this['setDataValue'](_0x774a('0x4e'),null);this['setDataValue'](_0x774a('0x4f'),'no');break;case 0x2:this[_0x774a('0x6')]('transport','wss');this[_0x774a('0x6')](_0x774a('0x46'),_0x774a('0x36'));this[_0x774a('0x6')](_0x774a('0x47'),_0x774a('0x36'));this['setDataValue'](_0x774a('0x48'),_0x774a('0x36'));this['setDataValue'](_0x774a('0x49'),_0x774a('0x36'));this['setDataValue'](_0x774a('0x4a'),_0x774a('0x36'));this[_0x774a('0x6')](_0x774a('0x4b'),'no');this[_0x774a('0x6')](_0x774a('0x4c'),_0x774a('0x50'));this['setDataValue'](_0x774a('0x4d'),_0x499491['dtlscertfile']||_0x774a('0x51'));this['setDataValue'](_0x774a('0x4e'),_0x499491[_0x774a('0x4e')]||_0x774a('0x52'));this[_0x774a('0x6')](_0x774a('0x4f'),_0x774a('0x36'));break;default:}}},'permissions':{'type':Sequelize['TEXT'],'set':function(_0x5304c4){this[_0x774a('0x6')](_0x774a('0x53'),_0x5304c4?_0x5304c4['join'](','):[]);},'get':function(){return this[_0x774a('0xa')](_0x774a('0x53'))?_['map'](this['getDataValue'](_0x774a('0x53'))[_0x774a('0x26')](','),function(_0x4553ac){return parseInt(_0x4553ac,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0x774a('0x5')]},'phoneBarNoReplyNumber':{'type':Sequelize['STRING']},'phoneBarBusyNumber':{'type':Sequelize['STRING']},'phoneBarUnconditional':{'type':Sequelize[_0x774a('0x17')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0x774a('0x17')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0x774a('0x17')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize[_0x774a('0x17')],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0x774a('0x17')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize[_0x774a('0x14')],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize['STRING'],'defaultValue':''},'crudPermissions':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize['ENUM'](_0x774a('0x36'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize[_0x774a('0x5')]},'phoneBarEnableJaws':{'type':Sequelize[_0x774a('0x17')],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0x774a('0x17')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize[_0x774a('0x54')],'get':function(){return this['getDataValue'](_0x774a('0x55'))?this[_0x774a('0xa')](_0x774a('0x55')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0x774a('0x17')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0x774a('0x17')],'defaultValue':![]},'hotdesk':{'type':Sequelize[_0x774a('0x17')],'defaultValue':![]},'interface':{'type':Sequelize[_0x774a('0x5')],'defaultValue':null},'privacyEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize['STRING'],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0x774a('0x5')],'allowNull':!![]},'screenrecording':{'type':Sequelize[_0x774a('0x17')],'defaultValue':![],'set':function(_0x29ed04){if(typeof _0x29ed04===_0x774a('0x56')){var _0x3b83e0=_0x29ed04==='1'?!![]:_0x29ed04==='0'?![]:_0x29ed04===_0x774a('0x57')?!![]:_0x29ed04==='false'?![]:![];this[_0x774a('0x6')]('screenrecording',_0x3b83e0);}else{this[_0x774a('0x6')]('screenrecording',_0x29ed04);}}},'blocked':{'type':Sequelize[_0x774a('0x17')],'defaultValue':![],'set':function(_0x36587d){this[_0x774a('0x6')]('blocked',_0x36587d);if(_0x36587d===!![]){this[_0x774a('0x6')](_0x774a('0x58'),moment());this[_0x774a('0x6')](_0x774a('0x59'),0x0);}else{this['setDataValue'](_0x774a('0x58'),null);}}},'blockedAt':{'type':Sequelize[_0x774a('0x18')],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0x774a('0x14')],'defaultValue':0x0},'disabled':{'type':Sequelize[_0x774a('0x17')],'defaultValue':![]},'settingsEnabled':{'type':Sequelize[_0x774a('0x17')],'defaultValue':!![]},'wssPort':{'type':Sequelize[_0x774a('0x14')](0x5)[_0x774a('0x5a')],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize[_0x774a('0x17')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x774a('0x17')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'ignorePauseForPreviewCalls':{'type':Sequelize[_0x774a('0x17')],'defaultValue':![]},'selectRecallMeCampaign':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'chatAutoanswer':{'type':Sequelize[_0x774a('0x17')],'defaultValue':![]},'chatAutoanswerDelay':{'type':Sequelize[_0x774a('0x14')],'defaultValue':0x0},'emailAutoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'emailAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'smsAutoanswer':{'type':Sequelize[_0x774a('0x17')],'defaultValue':![]},'smsAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'openchannelAutoanswer':{'type':Sequelize[_0x774a('0x17')],'defaultValue':![]},'openchannelAutoanswerDelay':{'type':Sequelize[_0x774a('0x14')],'defaultValue':0x0},'faxAutoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'faxAutoanswerDelay':{'type':Sequelize[_0x774a('0x14')],'defaultValue':0x0},'whatsappAutoanswer':{'type':Sequelize[_0x774a('0x17')],'defaultValue':![]},'whatsappAutoanswerDelay':{'type':Sequelize[_0x774a('0x14')],'defaultValue':0x0},'messengerSoundNotification':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0xffb4=['dtlsenable','actpass','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','map','VIRTUAL','phoneBarEnableScreenRecordingByAgent','string','false','screenrecording','blocked','blockedAt','loginAttempts','sequelize','util','lodash','exports','name','setDataValue','defaultuser','The\x20name\x20of\x20the\x20user','fullname','callerid','\x22%s\x22\x20<%s>','getDataValue','internal','email','toLowerCase','ENUM','admin','user','telephone','STRING','local','INTEGER','format','DATE','BOOLEAN','DEFAULT\x20PAUSE','dynamic','friend','peer','from-sip','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','PROHIB_PASSED_SCREEN','udp','transport','join','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','ulaw;alaw;gsm','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]','insecure','never','\x22\x22\x20<>','accept','refuse','originate','uac','fingerprint','certificate','active','passive','update,nonat','TEXT','showWebBar','isArray','wss','avpf','force_avp','icesupport','dtlsverify','dtlssetup','dtlscertfile','dtlsprivatekey','rtcp_mux','encryption'];(function(_0x2833db,_0x443abf){var _0x4190c0=function(_0x5d7930){while(--_0x5d7930){_0x2833db['push'](_0x2833db['shift']());}};_0x4190c0(++_0x443abf);}(_0xffb4,0x11e));var _0x4ffb=function(_0x36ed48,_0x1ee0d4){_0x36ed48=_0x36ed48-0x0;var _0x51c63a=_0xffb4[_0x36ed48];return _0x51c63a;};'use strict';var Sequelize=require(_0x4ffb('0x0'));var moment=require('moment');var util=require(_0x4ffb('0x1'));var _=require(_0x4ffb('0x2'));module[_0x4ffb('0x3')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x4ffb('0x4'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x5a62f9){this[_0x4ffb('0x5')](_0x4ffb('0x4'),_0x5a62f9);this[_0x4ffb('0x5')](_0x4ffb('0x6'),_0x5a62f9);},'comment':_0x4ffb('0x7')},'fullname':{'type':Sequelize['STRING'],'allowNull':![],'set':function(_0x5a98e1){this['setDataValue'](_0x4ffb('0x8'),_0x5a98e1);this[_0x4ffb('0x5')](_0x4ffb('0x9'),util['format'](_0x4ffb('0xa'),_0x5a98e1,this[_0x4ffb('0xb')](_0x4ffb('0xc'))));}},'alias':{'type':Sequelize['STRING']},'email':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x4ffb('0xd'),'validate':{'isEmail':!![]},'set':function(_0x4049b5){if(_0x4049b5){this['setDataValue'](_0x4ffb('0xd'),_0x4049b5[_0x4ffb('0xe')]());}}},'role':{'type':Sequelize[_0x4ffb('0xf')](_0x4ffb('0x10'),_0x4ffb('0x11'),'agent',_0x4ffb('0x12')),'allowNull':![]},'password':{'type':Sequelize[_0x4ffb('0x13')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize[_0x4ffb('0x13')],'defaultValue':_0x4ffb('0x14')},'internal':{'type':Sequelize[_0x4ffb('0x15')](0xb),'allowNull':![],'unique':'internal','set':function(_0x567978){this['setDataValue'](_0x4ffb('0xc'),_0x567978);this['setDataValue']('accountcode',_0x567978);this['setDataValue'](_0x4ffb('0x9'),util[_0x4ffb('0x16')]('\x22%s\x22\x20<%s>',this[_0x4ffb('0xb')]('fullname'),_0x567978));}},'salt':{'type':Sequelize[_0x4ffb('0x13')]},'phone':{'type':Sequelize['STRING']},'mobile':{'type':Sequelize['STRING']},'address':{'type':Sequelize[_0x4ffb('0x13')]},'zipcode':{'type':Sequelize[_0x4ffb('0x13')]},'userpic':{'type':Sequelize[_0x4ffb('0x13')]},'city':{'type':Sequelize[_0x4ffb('0x13')]},'country':{'type':Sequelize['STRING']},'online':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'lastLoginAt':{'type':Sequelize[_0x4ffb('0x17')]},'voicePause':{'type':Sequelize[_0x4ffb('0x18')],'defaultValue':![]},'chatPause':{'type':Sequelize[_0x4ffb('0x18')],'defaultValue':![]},'mailPause':{'type':Sequelize[_0x4ffb('0x18')],'defaultValue':![]},'faxPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'smsPause':{'type':Sequelize[_0x4ffb('0x18')],'defaultValue':![]},'whatsappPause':{'type':Sequelize[_0x4ffb('0x18')],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0x4ffb('0x18')],'defaultValue':![]},'pauseType':{'type':Sequelize[_0x4ffb('0x13')],'defaultValue':_0x4ffb('0x19')},'lastPauseAt':{'type':Sequelize[_0x4ffb('0x17')]},'chatCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'mailCapacity':{'type':Sequelize[_0x4ffb('0x15')],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0x4ffb('0x15')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0x4ffb('0x15')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0x4ffb('0x18')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0x4ffb('0x18')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize[_0x4ffb('0x15')](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0x4ffb('0x15')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize[_0x4ffb('0x18')],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0x4ffb('0x15')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0x4ffb('0x18')],'defaultValue':![]},'chanspy':{'type':Sequelize[_0x4ffb('0x18')],'defaultValue':![]},'description':{'type':Sequelize[_0x4ffb('0x13')],'allowNull':!![]},'host':{'type':Sequelize[_0x4ffb('0x13')],'allowNull':!![],'defaultValue':_0x4ffb('0x1a')},'ipaddr':{'type':Sequelize['STRING'],'allowNull':!![]},'port':{'type':Sequelize[_0x4ffb('0x15')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize[_0x4ffb('0x15')](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0x4ffb('0x13')],'allowNull':!![]},'regserver':{'type':Sequelize['STRING'],'allowNull':!![]},'useragent':{'type':Sequelize[_0x4ffb('0x13')],'allowNull':!![]},'lastms':{'type':Sequelize[_0x4ffb('0x15')](0xb),'allowNull':!![]},'type':{'type':Sequelize['ENUM'](_0x4ffb('0x1b'),_0x4ffb('0x11'),_0x4ffb('0x1c')),'allowNull':!![],'defaultValue':_0x4ffb('0x1b')},'context':{'type':Sequelize[_0x4ffb('0x13')],'allowNull':!![],'defaultValue':_0x4ffb('0x1d')},'callingpres':{'type':Sequelize['ENUM'](_0x4ffb('0x1e'),_0x4ffb('0x1f'),'ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED',_0x4ffb('0x20'),'PROHIB_FAILED_SCREEN','PROHIB'),'allowNull':!![]},'deny':{'type':Sequelize[_0x4ffb('0x13')],'allowNull':!![]},'permit':{'type':Sequelize[_0x4ffb('0x13')],'allowNull':!![]},'secret':{'type':Sequelize[_0x4ffb('0x13')],'allowNull':!![]},'md5secret':{'type':Sequelize[_0x4ffb('0x13')],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0x4ffb('0x13')],'allowNull':!![]},'transport':{'type':Sequelize[_0x4ffb('0x13')],'allowNull':!![],'defaultValue':_0x4ffb('0x21'),'set':function(_0x5614db){this[_0x4ffb('0x5')](_0x4ffb('0x22'),_0x5614db?_0x5614db[_0x4ffb('0x23')](','):null);},'get':function(){return this[_0x4ffb('0xb')](_0x4ffb('0x22'))?this[_0x4ffb('0xb')](_0x4ffb('0x22'))[_0x4ffb('0x24')](','):null;},'comment':_0x4ffb('0x25')},'dtmfmode':{'type':Sequelize['ENUM'](_0x4ffb('0x26'),_0x4ffb('0x27'),_0x4ffb('0x28'),_0x4ffb('0x29'),_0x4ffb('0x2a')),'allowNull':!![],'defaultValue':_0x4ffb('0x26')},'directmedia':{'type':Sequelize[_0x4ffb('0xf')](_0x4ffb('0x2b'),'no',_0x4ffb('0x2c'),_0x4ffb('0x2d'),_0x4ffb('0x2e')),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x4ffb('0xf')](_0x4ffb('0x2b'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x4ffb('0x13')],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0x4ffb('0x13')],'allowNull':!![]},'nat':{'type':Sequelize[_0x4ffb('0x13')],'allowNull':!![],'defaultValue':_0x4ffb('0x2f'),'set':function(_0x1e5c1a){this['setDataValue']('nat',_0x1e5c1a?_0x1e5c1a['join'](','):null);},'get':function(){return this['getDataValue'](_0x4ffb('0x30'))?this[_0x4ffb('0xb')]('nat')[_0x4ffb('0x24')](','):null;},'comment':_0x4ffb('0x31')},'callgroup':{'type':Sequelize[_0x4ffb('0x13')]},'namedcallgroup':{'type':Sequelize[_0x4ffb('0x13')]},'pickupgroup':{'type':Sequelize['STRING']},'namedpickupgroup':{'type':Sequelize[_0x4ffb('0x13')]},'language':{'type':Sequelize[_0x4ffb('0x13')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x4ffb('0x13')]},'disallow':{'type':Sequelize[_0x4ffb('0x13')],'allowNull':![],'defaultValue':_0x4ffb('0x32')},'allow':{'type':Sequelize[_0x4ffb('0x13')],'allowNull':![],'defaultValue':_0x4ffb('0x33'),'set':function(_0x32a09b){this[_0x4ffb('0x5')]('allow',_0x32a09b?_0x32a09b[_0x4ffb('0x23')](';'):'ulaw;alaw;gsm');},'get':function(){return this[_0x4ffb('0xb')]('allow')?this[_0x4ffb('0xb')]('allow')[_0x4ffb('0x24')](';'):null;},'comment':_0x4ffb('0x34')},'autoframing':{'type':Sequelize[_0x4ffb('0xf')](_0x4ffb('0x2b'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize['STRING'],'allowNull':!![],'set':function(_0x370d70){this['setDataValue'](_0x4ffb('0x35'),_0x370d70?_0x370d70[_0x4ffb('0x23')](','):null);},'get':function(){return this[_0x4ffb('0xb')](_0x4ffb('0x35'))?this[_0x4ffb('0xb')](_0x4ffb('0x35'))[_0x4ffb('0x24')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]'},'trustrpid':{'type':Sequelize[_0x4ffb('0xf')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x4ffb('0xf')](_0x4ffb('0x2b'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize['ENUM'](_0x4ffb('0x2b'),'no',_0x4ffb('0x36')),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0x4ffb('0xf')](_0x4ffb('0x2b'),'no'),'allowNull':!![]},'useclientcode':{'type':Sequelize['ENUM'](_0x4ffb('0x2b'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'setvar':{'type':Sequelize['STRING'],'allowNull':!![]},'callerid':{'type':Sequelize[_0x4ffb('0x13')],'allowNull':!![],'defaultValue':_0x4ffb('0x37')},'amaflags':{'type':Sequelize[_0x4ffb('0x13')],'allowNull':!![]},'callcounter':{'type':Sequelize[_0x4ffb('0xf')](_0x4ffb('0x2b'),'no'),'allowNull':!![],'defaultValue':_0x4ffb('0x2b')},'busylevel':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0x4ffb('0xf')](_0x4ffb('0x2b'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize[_0x4ffb('0xf')](_0x4ffb('0x2b'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0x4ffb('0xf')](_0x4ffb('0x2b'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize['ENUM'](_0x4ffb('0x2b'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0x4ffb('0x13')],'allowNull':!![]},'template':{'type':Sequelize[_0x4ffb('0x13')],'allowNull':!![]},'videosupport':{'type':Sequelize[_0x4ffb('0xf')](_0x4ffb('0x2b'),'no','always'),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x4ffb('0x15')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize[_0x4ffb('0xf')]('yes','no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0x4ffb('0x13')],'allowNull':!![]},'session_timers':{'type':Sequelize[_0x4ffb('0xf')](_0x4ffb('0x38'),_0x4ffb('0x39'),_0x4ffb('0x3a')),'allowNull':!![]},'session_expires':{'type':Sequelize[_0x4ffb('0x15')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0x4ffb('0x15')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0x4ffb('0xf')](_0x4ffb('0x3b'),'uas'),'allowNull':!![],'defaultValue':'uas'},'t38pt_usertpsource':{'type':Sequelize[_0x4ffb('0x13')],'allowNull':!![]},'regexten':{'type':Sequelize[_0x4ffb('0x13')],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0x4ffb('0x13')],'allowNull':!![]},'fromuser':{'type':Sequelize[_0x4ffb('0x13')],'allowNull':!![]},'qualify':{'type':Sequelize[_0x4ffb('0xf')]('yes','no'),'allowNull':!![],'defaultValue':_0x4ffb('0x2b')},'keepalive':{'type':Sequelize[_0x4ffb('0x15')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize['STRING'],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0x4ffb('0x13')],'allowNull':!![]},'rtptimeout':{'type':Sequelize[_0x4ffb('0x15')](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0x4ffb('0x15')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize[_0x4ffb('0xf')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize['STRING'],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0x4ffb('0x13')],'allowNull':!![]},'timert1':{'type':Sequelize[_0x4ffb('0x15')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0x4ffb('0x15')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0x4ffb('0x13')],'allowNull':!![]},'contactdeny':{'type':Sequelize[_0x4ffb('0x13')],'allowNull':!![]},'contactacl':{'type':Sequelize[_0x4ffb('0x13')],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize['STRING'],'allowNull':!![]},'use_q850_reason':{'type':Sequelize[_0x4ffb('0x13')],'allowNull':!![]},'maxforwards':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'encryption':{'type':Sequelize[_0x4ffb('0xf')](_0x4ffb('0x2b'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize[_0x4ffb('0xf')](_0x4ffb('0x2b'),'no'),'allowNull':!![]},'force_avp':{'type':Sequelize['ENUM'](_0x4ffb('0x2b'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize[_0x4ffb('0xf')]('yes','no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize[_0x4ffb('0xf')]('yes','no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize[_0x4ffb('0xf')](_0x4ffb('0x2b'),'no',_0x4ffb('0x3c'),_0x4ffb('0x3d')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0x4ffb('0x15')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0x4ffb('0x13')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0x4ffb('0x13')],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0x4ffb('0x13')],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0x4ffb('0x13')],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0x4ffb('0x13')],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0x4ffb('0xf')](_0x4ffb('0x3e'),_0x4ffb('0x3f'),'actpass'),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize['STRING'],'allowNull':!![]},'usereqphone':{'type':Sequelize[_0x4ffb('0xf')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x4ffb('0x13')],'allowNull':!![]},'recordofffeature':{'type':Sequelize[_0x4ffb('0x13')],'allowNull':!![]},'call_limit':{'type':Sequelize[_0x4ffb('0x15')](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize[_0x4ffb('0xf')]('yes','no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0x4ffb('0xf')](_0x4ffb('0x2b'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0x4ffb('0x13')],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0x4ffb('0x13')],'allowNull':!![]},'mohsuggest':{'type':Sequelize['STRING'],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0x4ffb('0x13')],'allowNull':!![]},'canreinvite':{'type':Sequelize[_0x4ffb('0xf')](_0x4ffb('0x2b'),'no',_0x4ffb('0x2c'),_0x4ffb('0x2d'),_0x4ffb('0x40')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0x4ffb('0x18')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0x4ffb('0x13')]},'resetPasswordExpires':{'type':Sequelize[_0x4ffb('0x17')]},'passwordResetAt':{'type':Sequelize[_0x4ffb('0x17')],'defaultValue':null},'previousPasswords':{'type':Sequelize[_0x4ffb('0x41')]},'showWebBar':{'type':Sequelize[_0x4ffb('0x15')],'defaultValue':0x0,'set':function(_0x338479){this[_0x4ffb('0x5')](_0x4ffb('0x42'),_0x338479);var _0x184166=this['get']({'plain':!![]});switch(_0x338479){case 0x0:case 0x1:var _0x44c859=_0x184166[_0x4ffb('0x22')]?_[_0x4ffb('0x43')](_0x184166[_0x4ffb('0x22')])?_0x184166['transport'][_0x4ffb('0x23')]():_0x184166[_0x4ffb('0x22')]:_0x4ffb('0x21');if(_0x44c859===_0x4ffb('0x44')){_0x44c859=_0x4ffb('0x21');}this[_0x4ffb('0x5')](_0x4ffb('0x22'),_0x44c859);this[_0x4ffb('0x5')]('encryption','no');this[_0x4ffb('0x5')](_0x4ffb('0x45'),null);this['setDataValue'](_0x4ffb('0x46'),null);this['setDataValue'](_0x4ffb('0x47'),null);this[_0x4ffb('0x5')]('dtlsenable',null);this[_0x4ffb('0x5')](_0x4ffb('0x48'),null);this['setDataValue'](_0x4ffb('0x49'),null);this[_0x4ffb('0x5')](_0x4ffb('0x4a'),null);this[_0x4ffb('0x5')](_0x4ffb('0x4b'),null);this[_0x4ffb('0x5')](_0x4ffb('0x4c'),'no');break;case 0x2:this['setDataValue'](_0x4ffb('0x22'),'wss');this[_0x4ffb('0x5')](_0x4ffb('0x4d'),_0x4ffb('0x2b'));this[_0x4ffb('0x5')](_0x4ffb('0x45'),_0x4ffb('0x2b'));this['setDataValue'](_0x4ffb('0x46'),'yes');this[_0x4ffb('0x5')](_0x4ffb('0x47'),_0x4ffb('0x2b'));this[_0x4ffb('0x5')](_0x4ffb('0x4e'),_0x4ffb('0x2b'));this[_0x4ffb('0x5')](_0x4ffb('0x48'),'no');this['setDataValue']('dtlssetup',_0x4ffb('0x4f'));this[_0x4ffb('0x5')](_0x4ffb('0x4a'),_0x184166['dtlscertfile']||_0x4ffb('0x50'));this[_0x4ffb('0x5')]('dtlsprivatekey',_0x184166['dtlsprivatekey']||_0x4ffb('0x51'));this[_0x4ffb('0x5')](_0x4ffb('0x4c'),_0x4ffb('0x2b'));break;default:}}},'permissions':{'type':Sequelize[_0x4ffb('0x41')],'set':function(_0x329da7){this[_0x4ffb('0x5')]('permissions',_0x329da7?_0x329da7[_0x4ffb('0x23')](','):[]);},'get':function(){return this[_0x4ffb('0xb')]('permissions')?_[_0x4ffb('0x52')](this['getDataValue']('permissions')[_0x4ffb('0x24')](','),function(_0x3250b1){return parseInt(_0x3250b1,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize['STRING']},'phoneBarNoReplyNumber':{'type':Sequelize[_0x4ffb('0x13')]},'phoneBarBusyNumber':{'type':Sequelize[_0x4ffb('0x13')]},'phoneBarUnconditional':{'type':Sequelize[_0x4ffb('0x18')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0x4ffb('0x18')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize[_0x4ffb('0x18')],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0x4ffb('0x18')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize[_0x4ffb('0x18')],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0x4ffb('0x18')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0x4ffb('0x13')],'defaultValue':''},'crudPermissions':{'type':Sequelize[_0x4ffb('0x15')],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0x4ffb('0xf')](_0x4ffb('0x2b'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0x4ffb('0x18')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize['STRING']},'phoneBarEnableJaws':{'type':Sequelize[_0x4ffb('0x18')],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0x4ffb('0x18')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize[_0x4ffb('0x53')],'get':function(){return this[_0x4ffb('0xb')](_0x4ffb('0x54'))?this[_0x4ffb('0xb')](_0x4ffb('0x54')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0x4ffb('0x18')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0x4ffb('0x18')],'defaultValue':![]},'hotdesk':{'type':Sequelize[_0x4ffb('0x18')],'defaultValue':![]},'interface':{'type':Sequelize[_0x4ffb('0x13')],'defaultValue':null},'privacyEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0x4ffb('0x13')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0x4ffb('0x13')],'allowNull':!![]},'screenrecording':{'type':Sequelize[_0x4ffb('0x18')],'defaultValue':![],'set':function(_0x48de56){if(typeof _0x48de56===_0x4ffb('0x55')){var _0x49d887=_0x48de56==='1'?!![]:_0x48de56==='0'?![]:_0x48de56==='true'?!![]:_0x48de56===_0x4ffb('0x56')?![]:![];this[_0x4ffb('0x5')](_0x4ffb('0x57'),_0x49d887);}else{this[_0x4ffb('0x5')](_0x4ffb('0x57'),_0x48de56);}}},'blocked':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'set':function(_0x256e6d){this[_0x4ffb('0x5')](_0x4ffb('0x58'),_0x256e6d);if(_0x256e6d===!![]){this[_0x4ffb('0x5')](_0x4ffb('0x59'),moment());this[_0x4ffb('0x5')](_0x4ffb('0x5a'),0x0);}else{this[_0x4ffb('0x5')]('blockedAt',null);}}},'blockedAt':{'type':Sequelize[_0x4ffb('0x17')],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0x4ffb('0x15')],'defaultValue':0x0},'disabled':{'type':Sequelize[_0x4ffb('0x18')],'defaultValue':![]},'settingsEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'wssPort':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize[_0x4ffb('0x18')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x4ffb('0x18')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'ignorePauseForPreviewCalls':{'type':Sequelize[_0x4ffb('0x18')],'defaultValue':![]},'selectRecallMeCampaign':{'type':Sequelize[_0x4ffb('0x18')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0x4ffb('0x18')],'defaultValue':![]},'chatAutoanswer':{'type':Sequelize[_0x4ffb('0x18')],'defaultValue':![]},'chatAutoanswerDelay':{'type':Sequelize[_0x4ffb('0x15')],'defaultValue':0x0},'emailAutoanswer':{'type':Sequelize[_0x4ffb('0x18')],'defaultValue':![]},'emailAutoanswerDelay':{'type':Sequelize[_0x4ffb('0x15')],'defaultValue':0x0},'smsAutoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'smsAutoanswerDelay':{'type':Sequelize[_0x4ffb('0x15')],'defaultValue':0x0},'openchannelAutoanswer':{'type':Sequelize[_0x4ffb('0x18')],'defaultValue':![]},'openchannelAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'faxAutoanswer':{'type':Sequelize[_0x4ffb('0x18')],'defaultValue':![]},'faxAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whatsappAutoanswer':{'type':Sequelize[_0x4ffb('0x18')],'defaultValue':![]},'whatsappAutoanswerDelay':{'type':Sequelize[_0x4ffb('0x15')],'defaultValue':0x0},'messengerSoundNotification':{'type':Sequelize[_0x4ffb('0x18')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/user/user.controller.js b/server/api/user/user.controller.js index 35eabf6..53168a3 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 _0xea62=['userpic','file','filename','join','root','server/files/images/logos/default_profile.png','download','existsSync','server/files/images/','getOpenTabs','ChatOpenTabs','createdAt','FaxOpenTabs','FAX','OpenchannelOpenTabs','OPENCHANNEL','MailOpenTabs','MAIL','SmsOpenTabs','WHATSAPP','concat','getContacts','List','color','tag','getQueues','keys','Queue','filters','intersection','model','fields','order','sort','nolimit','limit','getVoiceQueuesRt','pick','hasOwnProperty','getGroups','getRecordings','VoiceRecording','UserId','getScreenRecordings','ScreenRecording','getChatInteractions','getOpenchannelInteractions','MailInteraction','getSmsInteractions','SmsInteraction','getFaxInteractions','WhatsappInteraction','getWhatsappInteractions','login','phone','mobile','intrf','user:%s','user:forcelogout','headers','connection','remoteAddress','socket','User\x20not\x20found\x20or\x20not\x20allowed\x20to\x20perform\x20login\x20method','UserVoiceQueue.penalty','MemberReport','forEach','YYYY-MM-DD\x20HH:mm:ss','getChannels','LOGIN','PAUSE','LOGININPAUSE','bulkCreate','isMiddleware','resolve','logout','pause','updateAttributes','DEFAULT\x20PAUSE','Channel\x20parameter\x20%s\x20is\x20invalid','mailPause','chatPause','faxPause','smsPause','whatsappPause','lastPauseAt','unpause','getTeams','Team','addTeams','Body\x20parameter\x20\x27ids\x27\x20is\x20required','User\x20with\x20id\x20%s\x20not\x20found','transaction','getAssociatedQueues','flattenDeep','addAgent','getDataValue','Voice','TeamVoicePrefix','VoicePrefixId','removeTeams','Query\x20parameter\x20\x27ids\x27\x20is\x20required','removeAgent','UserVoicePrefix','getLists','CmList','getAgents','getVoiceQueues','values','You\x20can\x27t\x20delete\x20yourself','addChatInteractions','user_has_chat_interactions:save','removeChatInteractions','user_has_chat_interactions:remove','addMailInteractions','removeMailInteractions','user_has_mail_interactions:remove','addFaxInteractions','removeFaxInteractions','user_has_fax_interactions:remove','addSmsInteractions','user_has_sms_interactions:save','removeSmsInteractions','addOpenchannelInteractions','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','addWhatsappInteractions','user_has_whatsapp_interactions:save','removeWhatsappInteractions','getVoicePrefixes','getFaxAccounts','FaxAccount','addFaxAccounts','removeFaxAccounts','getMailAccounts','MailAccount','addMailAccounts','removeMailAccounts','getOpenchannelAccounts','addOpenchannelAccounts','removeOpenchannelAccounts','getSmsAccounts','addSmsAccounts','getChatWebsites','ChatWebsite','addChatWebsites','removeChatWebsites','getWhatsappAccounts','WhatsappAccount','addWhatsappAccounts','removeWhatsappAccounts','getScheduledCalls','CmHopper','$and','$or','$gt','$gte','$lt','$eq','$between','$notBetween','$in','$notIn','$like','$notLike','$overlap','$contains','$any','getApiKey','retrieveApiKey','You\x20don\x27t\x20have\x20sufficient\x20privileges\x20to\x20access\x20this\x20resource.','createApiKey','generateApiKey','iat','nonce','token','apiKeyNonce','apiKeyIat','Unable\x20to\x20retrieve\x20the\x20current\x20user','getPresence','idle','ringing','teams','queues','inbound','flatten','lower','col','desc','asc','substring','uniqBy','orderBy','getRealtimeAgents','offline','voiceStatus','unavailable','busy','slice','charAt','toUpperCase','select','field','ui.','InteractionId','ui.createdAt','user_has_','_interactions','ui.UserId\x20=\x20?','toString','OpenTabs','messengerSoundNotification','enabled','moment','util','path','lodash','../../components/auth/service','../../components/contacts','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../config/license/util','../../errors/api','APIBadRequestError','APINotFoundError','handleError','../../mysqldb','socket.io-emitter','redis','./user.socket','defaults','localhost','status','end','json','offset','count','Content-Range','role','agent','destroy','then','admin','Users','user','Agents','Telephones','telephone','ignore','map','value','find','name','UserProfileResource','sendStatus','error','stack','send','User','rawAttributes','fieldName','type','key','filter','password','previousPasswords','resetPasswordToken','resetPasswordExpires','md5secret','includes','index','getOptions','where','includeAll','query','userSetting','true','include','UserSetting','attributes','push','findAll','openTabs','length','rows','dataValues','sms','mail','openchannel','whatsapp','catch','show','merge','options','chat','fax','all','update','body','describe','addContacts','params','ids','omit','internal','securePassword','validatePasswordPattern','max','min_internal','isNil','select\x20(select\x20IFNULL(max(internal)+1,1)\x20from\x20users\x20where\x20internal\x20<\x20md.internal)\x20as\x20\x27from\x27,\x20md.internal\x20-\x201\x20as\x20\x27to\x27\x20from\x20users\x20md\x20where\x20md.internal\x20!=\x201\x20and\x20not\x20exists\x20(select\x201\x20from\x20users\x20md2\x20where\x20md2.internal\x20=\x20md.internal\x20-\x201)','sequelize','QueryTypes','SELECT','from','mailbox','email','permissions','101','103','113','104','106','107','109','100','111','114','create','Unauthorized','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20another\x20administrator','settingsEnabled','userProfileId','VoiceMail','UserProfileSection','some','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20administrator','isEmpty','compact','changePassword','oldPassword','newPassword','Sequelize','ValidationError','Invalid\x20body\x20format.\x20Use\x20oldPassword\x20and\x20newPassword','authenticate','Wrong\x20credentials','New\x20password\x20must\x20be\x20different\x20from\x20old\x20password','Invalid\x20body\x20format.\x20Use\x20newPassword','Setting','findOne','passwordHistoryLimit','validatePasswordHistory','updatePasswordsHistory','addQueues','channel','online','loginInPause','voicePause','interface','Unknown\x20channel','add','capitalize','toLowerCase','penalty','spread','QueueId','emit','Queue:save','voice','VoiceQueue','get','format','SIP/%s','UserVoiceQueueRt','upsert','isValidChannel','remove','Queues','isArray','Queue:remove','addAvatar'];(function(_0x34cb06,_0xaf9156){var _0x474337=function(_0x2cfa9d){while(--_0x2cfa9d){_0x34cb06['push'](_0x34cb06['shift']());}};_0x474337(++_0xaf9156);}(_0xea62,0xd5));var _0x2ea6=function(_0x4667b2,_0x135b67){_0x4667b2=_0x4667b2-0x0;var _0x1070f2=_0xea62[_0x4667b2];return _0x1070f2;};'use strict';var moment=require(_0x2ea6('0x0'));var util=require(_0x2ea6('0x1'));var path=require(_0x2ea6('0x2'));var fs=require('fs');var _=require(_0x2ea6('0x3'));var squel=require('squel');var Redis=require('ioredis');var authService=require(_0x2ea6('0x4'));var contacts=require(_0x2ea6('0x5'));var qs=require(_0x2ea6('0x6'));var rta=require('../../components/realtime/agents');var logger=require(_0x2ea6('0x7'))(_0x2ea6('0x8'));var utils=require('../../config/utils');var config=require(_0x2ea6('0x9'));var licenseUtil=require(_0x2ea6('0xa'));var APIBadRequestError=require(_0x2ea6('0xb'))[_0x2ea6('0xc')];var APINotFoundError=require(_0x2ea6('0xb'))[_0x2ea6('0xd')];var APIHandleError=require('../../errors/api')[_0x2ea6('0xe')];var db=require(_0x2ea6('0xf'))['db'];var socket=require(_0x2ea6('0x10'))(new Redis(config[_0x2ea6('0x11')]));require(_0x2ea6('0x12'))['register'](socket);config[_0x2ea6('0x11')]=_[_0x2ea6('0x13')](config[_0x2ea6('0x11')],{'host':_0x2ea6('0x14'),'port':0x18eb});var values;function respondWithStatusCode(_0x5558ec,_0x4a0da3){_0x4a0da3=_0x4a0da3||0xcc;return function(_0x38d922){if(_0x38d922){return _0x5558ec['sendStatus'](_0x4a0da3);}return _0x5558ec[_0x2ea6('0x15')](_0x4a0da3)[_0x2ea6('0x16')]();};}function respondWithResult(_0x1d066d,_0x53f132){_0x53f132=_0x53f132||0xc8;return function(_0x3b5b10){if(_0x3b5b10){return _0x1d066d[_0x2ea6('0x15')](_0x53f132)[_0x2ea6('0x17')](_0x3b5b10);}};}function respondWithFilteredResult(_0x3a7766,_0x561e44){return function(_0x2c93a5){if(_0x2c93a5){var _0x46d2cf=typeof _0x561e44[_0x2ea6('0x18')]==='undefined'&&typeof _0x561e44['limit']==='undefined';var _0x4470f8=_0x2c93a5[_0x2ea6('0x19')];var _0x2fa453=_0x46d2cf?0x0:_0x561e44[_0x2ea6('0x18')];var _0x49d3ba=_0x46d2cf?_0x2c93a5['count']:_0x561e44[_0x2ea6('0x18')]+_0x561e44['limit'];var _0x3267cc;if(_0x49d3ba>=_0x4470f8){_0x49d3ba=_0x4470f8;_0x3267cc=0xc8;}else{_0x3267cc=0xce;}_0x3a7766[_0x2ea6('0x15')](_0x3267cc);return _0x3a7766['set'](_0x2ea6('0x1a'),_0x2fa453+'-'+_0x49d3ba+'/'+_0x4470f8)[_0x2ea6('0x17')](_0x2c93a5);}return null;};}function saveUpdates(_0x3e11d8){return function(_0x5f2756){if(_0x5f2756){return _0x5f2756['update'](_0x3e11d8)['then'](function(_0x110021){if(_0x110021[_0x2ea6('0x1b')]===_0x2ea6('0x1c')){socket['emit']('userNotification:recalc:'+_0x110021['id'],_0x110021);}return _0x110021;});}return null;};}function removeEntity(_0x4b86f5){return function(_0x54a2f0){if(_0x54a2f0){return _0x54a2f0[_0x2ea6('0x1d')]()[_0x2ea6('0x1e')](function(){var _0x4c43c4=_0x54a2f0['get']({'plain':!![]});if(_0x4c43c4[_0x2ea6('0x1b')]===_0x2ea6('0x1f'))return;var _0x55bd8f=[{'name':_0x2ea6('0x20'),'value':_0x2ea6('0x21'),'ignore':!![]},{'name':_0x2ea6('0x22'),'value':_0x2ea6('0x1c'),'ignore':![]},{'name':_0x2ea6('0x23'),'value':_0x2ea6('0x24'),'ignore':![]}];var _0x5edd87=_(_0x55bd8f)['filter'](_0x2ea6('0x25'))[_0x2ea6('0x26')]('value')[_0x2ea6('0x27')]();if(_['includes'](_0x5edd87,_0x4c43c4[_0x2ea6('0x1b')])){return;}var _0x2115de=_[_0x2ea6('0x28')](_0x55bd8f,[_0x2ea6('0x27'),_0x4c43c4[_0x2ea6('0x1b')]])[_0x2ea6('0x29')];return db[_0x2ea6('0x2a')][_0x2ea6('0x1d')]({'where':{'type':_0x2115de,'resourceId':_0x4c43c4['id']}})[_0x2ea6('0x1e')](function(){return _0x54a2f0;});})[_0x2ea6('0x1e')](function(){_0x4b86f5['status'](0xcc)[_0x2ea6('0x16')]();});}};}function handleEntityNotFound(_0x3da913){return function(_0x473981){if(!_0x473981){_0x3da913[_0x2ea6('0x2b')](0x194);}return _0x473981;};}function handleError(_0x1b2cb0,_0x3aa6c4){_0x3aa6c4=_0x3aa6c4||0x1f4;return function(_0x804a7b){logger[_0x2ea6('0x2c')](_0x804a7b[_0x2ea6('0x2d')]);if(_0x804a7b[_0x2ea6('0x29')]){delete _0x804a7b['name'];}_0x1b2cb0[_0x2ea6('0x15')](_0x3aa6c4)[_0x2ea6('0x2e')](_0x804a7b);};}function getUserAttributes(){return _(db[_0x2ea6('0x2f')][_0x2ea6('0x30')])[_0x2ea6('0x26')](function(_0x1ec8ec){return{'name':_0x1ec8ec[_0x2ea6('0x31')],'type':_0x1ec8ec[_0x2ea6('0x32')][_0x2ea6('0x33')]};})[_0x2ea6('0x34')](function(_0x1750d1){return![_0x2ea6('0x35'),'salt',_0x2ea6('0x36'),_0x2ea6('0x37'),_0x2ea6('0x38'),_0x2ea6('0x39')][_0x2ea6('0x3a')](_0x1750d1[_0x2ea6('0x29')]);})[_0x2ea6('0x27')]();}exports[_0x2ea6('0x3b')]=function(_0x326a78,_0x316566){var _0x24e6ef={},_0x148f93={'count':0x0,'rows':[]};var _0xcd916a=getUserAttributes();_0x24e6ef=qs[_0x2ea6('0x3c')](_0xcd916a,_0x326a78);var _0x2cd8e7={'where':_0x24e6ef[_0x2ea6('0x3d')]};return db[_0x2ea6('0x2f')]['count'](_0x2cd8e7)[_0x2ea6('0x1e')](function(_0x39bdc3){_0x148f93[_0x2ea6('0x19')]=_0x39bdc3;if(_0x326a78['query'][_0x2ea6('0x3e')]){_0x24e6ef['include']=[{'all':!![]}];}if(_0x326a78[_0x2ea6('0x3f')][_0x2ea6('0x40')]===_0x2ea6('0x41')){_0x24e6ef[_0x2ea6('0x42')]=[{'model':db[_0x2ea6('0x43')],'as':'userSetting'}];}if(!_[_0x2ea6('0x3a')](_0x24e6ef['attributes'],'id')){_0x24e6ef[_0x2ea6('0x44')][_0x2ea6('0x45')]('id');}return db['User'][_0x2ea6('0x46')](_0x24e6ef);})[_0x2ea6('0x1e')](function(_0x2f4296){_0x148f93['rows']=_0x2f4296;if(_0x326a78[_0x2ea6('0x3f')][_0x2ea6('0x47')]===_0x2ea6('0x41')){var _0x4db0d3=[];for(var _0x27c374=0x0;_0x27c374<_0x148f93['rows'][_0x2ea6('0x48')];_0x27c374++){_0x4db0d3[_0x2ea6('0x45')](get_open_tabs('chat',_0x148f93[_0x2ea6('0x49')][_0x27c374][_0x2ea6('0x4a')]));_0x4db0d3[_0x2ea6('0x45')](get_open_tabs(_0x2ea6('0x4b'),_0x148f93[_0x2ea6('0x49')][_0x27c374][_0x2ea6('0x4a')]));_0x4db0d3[_0x2ea6('0x45')](get_open_tabs('fax',_0x148f93[_0x2ea6('0x49')][_0x27c374][_0x2ea6('0x4a')]));_0x4db0d3[_0x2ea6('0x45')](get_open_tabs(_0x2ea6('0x4c'),_0x148f93[_0x2ea6('0x49')][_0x27c374]['dataValues']));_0x4db0d3[_0x2ea6('0x45')](get_open_tabs(_0x2ea6('0x4d'),_0x148f93['rows'][_0x27c374][_0x2ea6('0x4a')]));_0x4db0d3[_0x2ea6('0x45')](get_open_tabs(_0x2ea6('0x4e'),_0x148f93[_0x2ea6('0x49')][_0x27c374][_0x2ea6('0x4a')]));}return Promise['all'](_0x4db0d3)['then'](function(){return _0x148f93;});}else{return _0x148f93;}})[_0x2ea6('0x1e')](respondWithFilteredResult(_0x316566,_0x24e6ef))[_0x2ea6('0x4f')](handleError(_0x316566,null));};exports[_0x2ea6('0x50')]=function(_0x6edcbd,_0xaad63a){var _0x180690=getUserAttributes();_0x6edcbd[_0x2ea6('0x3f')]['id']=_0x6edcbd['params']['id'];var _0x201149=qs[_0x2ea6('0x3c')](_0x180690,_0x6edcbd);if(_0x6edcbd[_0x2ea6('0x3f')][_0x2ea6('0x3e')]){_0x201149[_0x2ea6('0x42')]=[{'all':!![]}];}if(_0x6edcbd['query'][_0x2ea6('0x40')]===_0x2ea6('0x41')){_0x201149[_0x2ea6('0x42')]=[{'model':db['UserSetting'],'as':_0x2ea6('0x40')}];}_0x201149=_[_0x2ea6('0x51')]({},_0x201149,_0x6edcbd[_0x2ea6('0x52')]);if(!_[_0x2ea6('0x3a')](_0x201149[_0x2ea6('0x44')],'id')){_0x201149[_0x2ea6('0x44')][_0x2ea6('0x45')]('id');}return db[_0x2ea6('0x2f')][_0x2ea6('0x28')](_0x201149)[_0x2ea6('0x1e')](handleEntityNotFound(_0xaad63a,null))[_0x2ea6('0x1e')](function(_0x4cffa5){var _0x40adc1=[];values=_0x4cffa5;if(_0x6edcbd['query'][_0x2ea6('0x47')]===_0x2ea6('0x41')){_0x40adc1[_0x2ea6('0x45')](get_open_tabs(_0x2ea6('0x53'),_0x4cffa5[_0x2ea6('0x4a')]));_0x40adc1[_0x2ea6('0x45')](get_open_tabs(_0x2ea6('0x4b'),_0x4cffa5[_0x2ea6('0x4a')]));_0x40adc1[_0x2ea6('0x45')](get_open_tabs('openchannel',_0x4cffa5[_0x2ea6('0x4a')]));_0x40adc1[_0x2ea6('0x45')](get_open_tabs(_0x2ea6('0x4e'),_0x4cffa5[_0x2ea6('0x4a')]));_0x40adc1[_0x2ea6('0x45')](get_open_tabs(_0x2ea6('0x54'),_0x4cffa5['dataValues']));_0x40adc1[_0x2ea6('0x45')](get_open_tabs(_0x2ea6('0x4c'),_0x4cffa5['dataValues']));return Promise[_0x2ea6('0x55')](_0x40adc1);}else{return values;}})[_0x2ea6('0x1e')](function(){return values;})[_0x2ea6('0x1e')](respondWithResult(_0xaad63a,null))[_0x2ea6('0x4f')](handleError(_0xaad63a,null));};exports[_0x2ea6('0x56')]=function(_0x26d6d5,_0x5545fe){if(_0x26d6d5[_0x2ea6('0x57')]['id']){delete _0x26d6d5[_0x2ea6('0x57')]['id'];}delete _0x26d6d5[_0x2ea6('0x57')]['role'];return db[_0x2ea6('0x2f')][_0x2ea6('0x28')]({'where':{'id':_0x26d6d5['params']['id']}})['then'](handleEntityNotFound(_0x5545fe,null))[_0x2ea6('0x1e')](saveUpdates(_0x26d6d5[_0x2ea6('0x57')],null))['then'](respondWithResult(_0x5545fe,null))['catch'](handleError(_0x5545fe,null));};exports[_0x2ea6('0x58')]=function(_0x1c10a,_0x5dc187){return db[_0x2ea6('0x2f')]['describe']()[_0x2ea6('0x1e')](respondWithResult(_0x5dc187,null))[_0x2ea6('0x4f')](handleError(_0x5dc187,null));};exports[_0x2ea6('0x59')]=function(_0x338fd8,_0x1961a2){return db[_0x2ea6('0x2f')][_0x2ea6('0x28')]({'where':{'id':_0x338fd8[_0x2ea6('0x5a')]['id']}})[_0x2ea6('0x1e')](handleEntityNotFound(_0x1961a2,null))[_0x2ea6('0x1e')](function(_0xc8990e){if(_0xc8990e){return _0xc8990e[_0x2ea6('0x59')](_0x338fd8['body'][_0x2ea6('0x5b')],_[_0x2ea6('0x5c')](_0x338fd8[_0x2ea6('0x57')],[_0x2ea6('0x5b'),'id'])||{});}})['then'](respondWithResult(_0x1961a2,null))[_0x2ea6('0x4f')](handleError(_0x1961a2,null));};function validateUser(_0x3a49fe){return new Promise(function(_0x4694fc,_0x4b7990){if(_0x3a49fe[_0x2ea6('0x5d')])return _0x4694fc(_0x3a49fe);return db['Setting']['findById'](0x1)[_0x2ea6('0x1e')](function(_0x2573c1){if(_0x2573c1[_0x2ea6('0x5e')])authService[_0x2ea6('0x5f')](_0x3a49fe[_0x2ea6('0x35')]);db[_0x2ea6('0x2f')][_0x2ea6('0x60')](_0x2ea6('0x5d'))[_0x2ea6('0x1e')](function(_0x3e2cc3){if(_['isNil'](_0x3e2cc3)){_0x3a49fe['internal']=_0x2573c1[_0x2ea6('0x61')]||0x1;return;}if(_[_0x2ea6('0x62')](_0x2573c1[_0x2ea6('0x61')])||_0x2573c1['min_internal']===_0x3e2cc3){_0x3a49fe[_0x2ea6('0x5d')]=_0x3e2cc3+0x1;return;}if(_0x2573c1['min_internal']>_0x3e2cc3){_0x3a49fe[_0x2ea6('0x5d')]=_0x2573c1['min_internal'];return;}return db['sequelize']['query'](_0x2ea6('0x63'),{'type':db[_0x2ea6('0x64')][_0x2ea6('0x65')][_0x2ea6('0x66')]})['then'](function(_0x3b9ab3){if(_0x3b9ab3&&_0x3b9ab3[_0x2ea6('0x48')]){for(var _0x43d2d1=0x0,_0x18e7cd=_0x3b9ab3[_0x2ea6('0x48')];_0x43d2d1<_0x18e7cd&&_['isNil'](_0x3a49fe[_0x2ea6('0x5d')]);_0x43d2d1++){if(_0x2573c1['min_internal']<=_0x3b9ab3[_0x43d2d1][_0x2ea6('0x67')]){_0x3a49fe[_0x2ea6('0x5d')]=_0x3b9ab3[_0x43d2d1][_0x2ea6('0x67')];}else if(_0x2573c1[_0x2ea6('0x61')]>_0x3b9ab3[_0x43d2d1]['from']&&_0x2573c1['min_internal']<=_0x3b9ab3[_0x43d2d1]['to']){_0x3a49fe[_0x2ea6('0x5d')]=_0x2573c1['min_internal'];}}}if(_[_0x2ea6('0x62')](_0x3a49fe[_0x2ea6('0x5d')])){_0x3a49fe[_0x2ea6('0x5d')]=_0x3e2cc3+0x1;}return _0x4694fc(_0x3a49fe);});});})[_0x2ea6('0x4f')](function(_0x35c5ff){_0x4b7990(_0x35c5ff);});});}function updateUser(_0x56a58c){return new Promise(function(_0x316f4a,_0x37312a){try{if(_0x56a58c['voicemail']){_0x56a58c[_0x2ea6('0x68')]=_0x56a58c[_0x2ea6('0x5d')];_0x56a58c['VoiceMail']={'mailbox':_0x56a58c[_0x2ea6('0x5d')],'password':_0x56a58c['password'],'fullname':_0x56a58c['fullname'],'email':_0x56a58c[_0x2ea6('0x69')]};}if(_0x56a58c[_0x2ea6('0x1b')]===_0x2ea6('0x1c')){if(!_0x56a58c[_0x2ea6('0x6a')])_0x56a58c[_0x2ea6('0x6a')]=[_0x2ea6('0x6b'),'102',_0x2ea6('0x6c'),_0x2ea6('0x6d'),'110',_0x2ea6('0x6e'),'105',_0x2ea6('0x6f'),_0x2ea6('0x70'),'108',_0x2ea6('0x71'),_0x2ea6('0x72'),_0x2ea6('0x73'),_0x2ea6('0x74'),'115'];}_0x316f4a(_0x56a58c);}catch(_0x3f3e6d){_0x37312a(_0x3f3e6d);}});}exports[_0x2ea6('0x75')]=function(_0x1ad880,_0x1b73c){if(_0x1ad880[_0x2ea6('0x21')][_0x2ea6('0x1b')]===_0x2ea6('0x1c'))throw new Error(_0x2ea6('0x76'));if(_0x1ad880['body']['role']===_0x2ea6('0x21')&&_0x1ad880['user'][_0x2ea6('0x1b')]!==_0x2ea6('0x1f')){throw new Error(_0x2ea6('0x77'));}if(_0x1ad880['body'][_0x2ea6('0x1b')]==='admin'&&_0x1ad880['user'][_0x2ea6('0x1b')]!=='admin'){throw new Error(_0x2ea6('0x78'));}return licenseUtil['checkUserLimits']([_0x1ad880[_0x2ea6('0x57')]])['then'](function(){return validateUser(_0x1ad880[_0x2ea6('0x57')]);})[_0x2ea6('0x1e')](function(_0x1762fe){return updateUser(_0x1762fe)[_0x2ea6('0x1e')](function(_0x13fb0e){if(_0x13fb0e[_0x2ea6('0x1b')]===_0x2ea6('0x1f')){_0x13fb0e[_0x2ea6('0x79')]=_0x1ad880[_0x2ea6('0x21')][_0x2ea6('0x79')];delete _0x13fb0e[_0x2ea6('0x7a')];}return _0x13fb0e;});})[_0x2ea6('0x1e')](function(_0x412554){return db['User']['create'](_0x412554,{'include':[{'model':db[_0x2ea6('0x7b')],'as':'VoiceMail'}]});})[_0x2ea6('0x1e')](function(_0x3fad72){if(_0x1ad880[_0x2ea6('0x57')][_0x2ea6('0x1b')]===_0x2ea6('0x21'))return _0x3fad72;if(_0x1ad880[_0x2ea6('0x21')][_0x2ea6('0x1b')]!==_0x2ea6('0x21'))return _0x3fad72;return db[_0x2ea6('0x7c')][_0x2ea6('0x28')]({'where':{'name':_0x3fad72['role']==='agent'?_0x2ea6('0x22'):'Telephones','userProfileId':_0x1ad880[_0x2ea6('0x21')][_0x2ea6('0x7a')]},'raw':!![]})[_0x2ea6('0x1e')](function(_0x220b6f){if(!_0x220b6f||_0x220b6f['autoAssociation']!=0x0)return _0x3fad72;return db[_0x2ea6('0x2a')][_0x2ea6('0x75')]({'name':_0x3fad72[_0x2ea6('0x29')],'resourceId':_0x3fad72['id'],'type':_0x220b6f[_0x2ea6('0x29')],'sectionId':_0x220b6f['id']},{})[_0x2ea6('0x1e')](function(){return _0x3fad72;});})['catch'](function(_0xcbcb0c){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xcbcb0c);throw _0xcbcb0c;});})[_0x2ea6('0x1e')](respondWithResult(_0x1b73c,0xc9))[_0x2ea6('0x4f')](handleError(_0x1b73c,null));};exports['bulkCreate']=function(_0x384dba,_0x4860d8){var _0x1b29d0=_0x384dba[_0x2ea6('0x57')];var _0xf88a02=[];if(_0x384dba[_0x2ea6('0x21')][_0x2ea6('0x1b')]==='agent')throw new Error(_0x2ea6('0x76'));if(_['some'](_0x1b29d0,[_0x2ea6('0x1b'),_0x2ea6('0x21')])&&_0x384dba[_0x2ea6('0x21')][_0x2ea6('0x1b')]!==_0x2ea6('0x1f')){throw new Error(_0x2ea6('0x77'));}if(_[_0x2ea6('0x7d')](_0x1b29d0,[_0x2ea6('0x1b'),'admin'])&&_0x384dba[_0x2ea6('0x21')][_0x2ea6('0x1b')]!=='admin'){throw new Error(_0x2ea6('0x7e'));}return licenseUtil['checkUserLimits'](_0x1b29d0)[_0x2ea6('0x1e')](function(){return validateUser(_0x1b29d0[0x0]);})[_0x2ea6('0x1e')](function(){for(var _0x4c6eaa=0x1;_0x4c6eaa<_0x1b29d0['length'];_0x4c6eaa++){var _0x1dce6d=_0x1b29d0[_0x4c6eaa-0x1][_0x2ea6('0x5d')];if(!_0x1b29d0[_0x4c6eaa][_0x2ea6('0x5d')])_0x1b29d0[_0x4c6eaa][_0x2ea6('0x5d')]=_0x1dce6d+0x1;_0xf88a02[_0x2ea6('0x45')](validateUser(_0x1b29d0[_0x4c6eaa]));}return Promise[_0x2ea6('0x55')](_0xf88a02);})[_0x2ea6('0x1e')](function(){_0xf88a02=[];for(var _0x5b5596=0x0;_0x5b5596<_0x1b29d0['length'];_0x5b5596++){_0xf88a02[_0x2ea6('0x45')](updateUser(_0x1b29d0[_0x5b5596]));}return Promise[_0x2ea6('0x55')](_0xf88a02);})['then'](function(){_0xf88a02=_0x1b29d0[_0x2ea6('0x26')](function(_0x1ddb74){return db[_0x2ea6('0x2f')]['create'](_0x1ddb74,{'include':[{'model':db['VoiceMail'],'as':_0x2ea6('0x7b')}]})[_0x2ea6('0x1e')](function(_0x1efae0){_0x1ddb74['id']=_0x1efae0['id'];return _0x1ddb74;});});return Promise[_0x2ea6('0x55')](_0xf88a02);})[_0x2ea6('0x1e')](function(_0x38f8b2){if(_0x384dba['body'][_0x2ea6('0x1b')]==='user')return _0x38f8b2;if(_0x384dba['user'][_0x2ea6('0x1b')]!==_0x2ea6('0x21'))return _0x38f8b2;var _0x5a88eb=_[_0x2ea6('0x7d')](_0x38f8b2,function(_0x3e3bf2){return _0x3e3bf2['role']===_0x2ea6('0x1c')||_0x3e3bf2[_0x2ea6('0x1b')]===_0x2ea6('0x24');});if(!_0x5a88eb)return _0x38f8b2;return db[_0x2ea6('0x7c')][_0x2ea6('0x46')]({'where':{'name':{'$or':[_0x2ea6('0x22'),'Telephones']},'userProfileId':_0x384dba[_0x2ea6('0x21')][_0x2ea6('0x7a')]},'raw':!![]})[_0x2ea6('0x1e')](function(_0x1bebe5){if(_[_0x2ea6('0x7f')](_0x1bebe5)||!_[_0x2ea6('0x7d')](_0x1bebe5,['autoAssociation',0x0]))return _0x38f8b2;_0xf88a02=[];var _0x453d3c=_(_0x1bebe5)[_0x2ea6('0x26')](function(_0x72f30e){if(_0x72f30e['autoAssociation']===0x1)return;return _0x72f30e['name']==='Agents'?_0x2ea6('0x1c'):_0x2ea6('0x24');})[_0x2ea6('0x80')]()['value']();for(var _0x18c646=0x0;_0x18c646<_0x38f8b2['length'];_0x18c646++){if(!_[_0x2ea6('0x3a')](_0x453d3c,_0x38f8b2[_0x18c646][_0x2ea6('0x1b')]))return;var _0x11eac0=_0x38f8b2[_0x18c646][_0x2ea6('0x1b')]===_0x2ea6('0x1c')?'Agents':'Telephones';_0xf88a02['push'](db['UserProfileResource'][_0x2ea6('0x75')]({'name':_0x38f8b2[_0x18c646][_0x2ea6('0x29')],'resourceId':_0x38f8b2[_0x18c646]['id'],'type':_0x11eac0,'sectionId':_[_0x2ea6('0x28')](_0x1bebe5,[_0x2ea6('0x29'),_0x11eac0])['id']},{}));}return Promise['all'](_0xf88a02);});})['then'](respondWithResult(_0x4860d8,0xc9))[_0x2ea6('0x4f')](handleError(_0x4860d8,null));};exports[_0x2ea6('0x81')]=function(_0x137a7e,_0x5f3c3e){if(_0x137a7e['body']['id']){delete _0x137a7e[_0x2ea6('0x57')]['id'];}return db[_0x2ea6('0x2f')][_0x2ea6('0x28')]({'where':{'id':_0x137a7e['params']['id']}})[_0x2ea6('0x1e')](function(_0x515f0a){if(!_0x515f0a)return null;if(_0x515f0a['id']===_0x137a7e['user']['id']){if(!_0x137a7e['body'][_0x2ea6('0x82')]||!_0x137a7e[_0x2ea6('0x57')][_0x2ea6('0x83')]){throw new db[(_0x2ea6('0x84'))][(_0x2ea6('0x85'))](_0x2ea6('0x86'));}if(!_0x515f0a[_0x2ea6('0x87')](_0x137a7e[_0x2ea6('0x57')][_0x2ea6('0x82')])){throw new db[(_0x2ea6('0x84'))][(_0x2ea6('0x85'))](_0x2ea6('0x88'));}if(_0x137a7e[_0x2ea6('0x57')]['oldPassword']===_0x137a7e[_0x2ea6('0x57')][_0x2ea6('0x83')]){throw new db[(_0x2ea6('0x84'))][(_0x2ea6('0x85'))](_0x2ea6('0x89'));}}else if(_0x137a7e['user']['role']===_0x2ea6('0x1f')){if(!_0x137a7e[_0x2ea6('0x57')][_0x2ea6('0x83')]){throw new db[(_0x2ea6('0x84'))][(_0x2ea6('0x85'))]('Invalid\x20body\x20format.\x20Use\x20newPassword');}}else if(_0x137a7e[_0x2ea6('0x21')][_0x2ea6('0x1b')]==='user'){if(!_0x137a7e['body']['newPassword']){throw new db['Sequelize'][(_0x2ea6('0x85'))](_0x2ea6('0x8a'));}if(_0x515f0a[_0x2ea6('0x1b')]!==_0x2ea6('0x1c')){throw new db[(_0x2ea6('0x84'))]['ValidationError']('Unauthorized');}}else{throw new db[(_0x2ea6('0x84'))]['ValidationError'](_0x2ea6('0x76'));}return _0x515f0a;})[_0x2ea6('0x1e')](handleEntityNotFound(_0x5f3c3e,null))['then'](function(_0x2a1858){return db[_0x2ea6('0x8b')][_0x2ea6('0x8c')]({'attributes':['id','securePassword','enforcePasswordHistory',_0x2ea6('0x8d')]})[_0x2ea6('0x1e')](function(_0x26f350){if(_0x26f350[_0x2ea6('0x5e')])authService['validatePasswordPattern'](_0x137a7e[_0x2ea6('0x57')][_0x2ea6('0x83')]);if(!_0x26f350['enforcePasswordHistory']||!_0x2a1858[_0x2ea6('0x36')])return _0x2a1858;authService[_0x2ea6('0x8e')](_0x137a7e[_0x2ea6('0x57')][_0x2ea6('0x83')],_0x2a1858[_0x2ea6('0x36')],_0x26f350[_0x2ea6('0x8d')]);return _0x2a1858;})[_0x2ea6('0x1e')](saveUpdates({'password':_0x137a7e[_0x2ea6('0x57')][_0x2ea6('0x83')],'passwordResetAt':_0x137a7e[_0x2ea6('0x21')]['id']==_0x137a7e['params']['id']?moment():null,'previousPasswords':authService[_0x2ea6('0x8f')](_0x137a7e[_0x2ea6('0x57')]['newPassword'],_0x2a1858[_0x2ea6('0x36')])},null));})['then'](respondWithResult(_0x5f3c3e,null))[_0x2ea6('0x4f')](handleError(_0x5f3c3e,null));};exports[_0x2ea6('0x90')]=function(_0x85968d,_0x195bab){var _0x494454=_0x85968d['body'][_0x2ea6('0x91')];return db[_0x2ea6('0x2f')]['find']({'where':{'id':_0x85968d[_0x2ea6('0x5a')]['id']},'attributes':['id',_0x2ea6('0x29'),_0x2ea6('0x1b'),_0x2ea6('0x92'),_0x2ea6('0x93'),_0x2ea6('0x94'),_0x2ea6('0x95')]})['then'](handleEntityNotFound(_0x195bab,null))['then'](function(_0x57f33d){if(_0x57f33d){if(!utils['isValidChannel'](_0x494454)){throw new db[(_0x2ea6('0x84'))][(_0x2ea6('0x85'))](_0x2ea6('0x96'));}return _0x57f33d[_0x2ea6('0x97')+_[_0x2ea6('0x98')](_0x494454[_0x2ea6('0x99')]())+'Queues'](_0x85968d['body'][_0x2ea6('0x5b')],{'penalty':_0x85968d[_0x2ea6('0x57')][_0x2ea6('0x9a')]||0x0})[_0x2ea6('0x9b')](function(_0x49f5ea){for(var _0x36559a=0x0;_0x36559a<_0x85968d[_0x2ea6('0x57')][_0x2ea6('0x5b')][_0x2ea6('0x48')];_0x36559a+=0x1){var _0x6e5bf1={'UserId':Number(_0x85968d['params']['id'])};_0x6e5bf1[_[_0x2ea6('0x98')](_0x494454[_0x2ea6('0x99')]())+_0x2ea6('0x9c')]=Number(_0x85968d[_0x2ea6('0x57')][_0x2ea6('0x5b')][_0x36559a]);socket[_0x2ea6('0x9d')]('user'+_[_0x2ea6('0x98')](_0x494454[_0x2ea6('0x99')]())+_0x2ea6('0x9e'),_0x6e5bf1);}return _0x49f5ea;})[_0x2ea6('0x1e')](function(){if(_0x494454===_0x2ea6('0x9f')){return db[_0x2ea6('0xa0')][_0x2ea6('0x46')]({'where':{'id':_0x85968d[_0x2ea6('0x57')]['ids']||[]},'raw':!![],'attributes':['id',_0x2ea6('0x29')]});}})[_0x2ea6('0x1e')](function(_0x19133f){var _0x4003ea=_0x57f33d[_0x2ea6('0xa1')]({'plain':!![]});var _0x315b54=[];if(_0x494454===_0x2ea6('0x9f')&&_0x4003ea[_0x2ea6('0x1b')]===_0x2ea6('0x1c')&&_0x4003ea[_0x2ea6('0x92')]){for(let _0x49d1a5=0x0;_0x49d1a5<_0x19133f[_0x2ea6('0x48')];_0x49d1a5+=0x1){_0x315b54[_0x2ea6('0x45')]({'membername':_0x4003ea['name'],'UserId':_0x4003ea['id'],'queue_name':_0x19133f[_0x49d1a5][_0x2ea6('0x29')],'VoiceQueueId':_0x19133f[_0x49d1a5]['id'],'interface':_[_0x2ea6('0x62')](_0x4003ea[_0x2ea6('0x95')])?util[_0x2ea6('0xa2')](_0x2ea6('0xa3'),_0x4003ea[_0x2ea6('0x29')]):_0x4003ea[_0x2ea6('0x95')],'paused':_0x4003ea[_0x2ea6('0x94')]||![],'penalty':_0x85968d[_0x2ea6('0x57')][_0x2ea6('0x9a')]||0x0});}return Promise[_0x2ea6('0x55')](_0x315b54['map'](function(_0x57b669){return db[_0x2ea6('0xa4')][_0x2ea6('0xa5')](_0x57b669);}));}return _0x57f33d;});}})[_0x2ea6('0x1e')](respondWithStatusCode(_0x195bab,null))['catch'](handleError(_0x195bab,null));};exports['removeQueues']=function(_0x1d2ac6,_0x42952c){var _0x57c6f7,_0x359207;return db[_0x2ea6('0x2f')][_0x2ea6('0x28')]({'where':{'id':_0x1d2ac6[_0x2ea6('0x5a')]['id']},'attributes':['id','name',_0x2ea6('0x1b')]})['then'](handleEntityNotFound(_0x42952c,null))['then'](function(_0x1c8e35){if(_0x1c8e35){_0x57c6f7=_0x1c8e35;if(!_0x1d2ac6[_0x2ea6('0x3f')][_0x2ea6('0x91')]||!utils[_0x2ea6('0xa6')](_0x1d2ac6[_0x2ea6('0x3f')][_0x2ea6('0x91')])){throw new db[(_0x2ea6('0x84'))]['ValidationError'](_0x2ea6('0x96'));}return _0x1c8e35[_0x2ea6('0xa7')+_[_0x2ea6('0x98')](_0x1d2ac6[_0x2ea6('0x3f')][_0x2ea6('0x91')][_0x2ea6('0x99')]())+_0x2ea6('0xa8')](_0x1d2ac6['query'][_0x2ea6('0x5b')]);}})[_0x2ea6('0x1e')](function(_0x2b99d6){if(_[_0x2ea6('0xa9')](_0x1d2ac6[_0x2ea6('0x3f')][_0x2ea6('0x5b')])){for(var _0x30ad6a=0x0;_0x30ad6a<_0x1d2ac6[_0x2ea6('0x3f')][_0x2ea6('0x5b')][_0x2ea6('0x48')];_0x30ad6a+=0x1){_0x359207={'UserId':Number(_0x1d2ac6[_0x2ea6('0x5a')]['id'])};_0x359207[_['capitalize'](_0x1d2ac6['query']['channel'][_0x2ea6('0x99')]())+_0x2ea6('0x9c')]=Number(_0x1d2ac6[_0x2ea6('0x3f')][_0x2ea6('0x5b')][_0x30ad6a]);socket[_0x2ea6('0x9d')](_0x2ea6('0x21')+_['capitalize'](_0x1d2ac6['query'][_0x2ea6('0x91')][_0x2ea6('0x99')]())+_0x2ea6('0xaa'),_0x359207);}}else{_0x359207={'UserId':Number(_0x1d2ac6['params']['id'])};_0x359207[_[_0x2ea6('0x98')](_0x1d2ac6[_0x2ea6('0x3f')][_0x2ea6('0x91')]['toLowerCase']())+'QueueId']=Number(_0x1d2ac6[_0x2ea6('0x3f')][_0x2ea6('0x5b')]);socket[_0x2ea6('0x9d')](_0x2ea6('0x21')+_['capitalize'](_0x1d2ac6[_0x2ea6('0x3f')]['channel'][_0x2ea6('0x99')]())+_0x2ea6('0xaa'),_0x359207);}return _0x2b99d6;})['then'](function(){if(_0x1d2ac6[_0x2ea6('0x3f')][_0x2ea6('0x91')]==='voice'){return db['UserVoiceQueueRt'][_0x2ea6('0x1d')]({'where':{'UserId':_0x1d2ac6[_0x2ea6('0x5a')]['id'],'VoiceQueueId':_0x1d2ac6[_0x2ea6('0x3f')][_0x2ea6('0x5b')]},'individualHooks':!![]})['then'](function(){return _0x57c6f7;});}return _0x57c6f7;})[_0x2ea6('0x1e')](respondWithStatusCode(_0x42952c,null))['catch'](handleError(_0x42952c,null));};exports[_0x2ea6('0xab')]=function(_0x54eea8,_0x213be6){_0x54eea8['body'][_0x2ea6('0xac')]=_0x54eea8[_0x2ea6('0xad')][_0x2ea6('0xae')];return db[_0x2ea6('0x2f')][_0x2ea6('0x28')]({'where':{'id':_0x54eea8[_0x2ea6('0x5a')]['id']}})[_0x2ea6('0x1e')](handleEntityNotFound(_0x213be6,null))[_0x2ea6('0x1e')](saveUpdates(_0x54eea8['body'],null))[_0x2ea6('0x1e')](respondWithResult(_0x213be6,null))['catch'](handleError(_0x213be6,null));};exports['getAvatar']=function(_0x184ff3,_0x41b530){var _0x4f1b45=path[_0x2ea6('0xaf')](config[_0x2ea6('0xb0')],_0x2ea6('0xb1'));return db[_0x2ea6('0x2f')][_0x2ea6('0x28')]({'where':{'id':_0x184ff3[_0x2ea6('0x5a')]['id']},'attributes':['id',_0x2ea6('0xac')],'raw':!![]})[_0x2ea6('0x1e')](handleEntityNotFound(_0x41b530,null))[_0x2ea6('0x1e')](function(_0xbbb12){if(_0xbbb12){if(_[_0x2ea6('0x62')](_0xbbb12['userpic'])){return _0x41b530[_0x2ea6('0xb2')](_0x4f1b45);}else{if(!fs[_0x2ea6('0xb3')](path[_0x2ea6('0xaf')](config['root'],'server/files/images/',_0xbbb12[_0x2ea6('0xac')]))){return _0x41b530[_0x2ea6('0xb2')](_0x4f1b45);}return _0x41b530['download'](path[_0x2ea6('0xaf')](config[_0x2ea6('0xb0')],_0x2ea6('0xb4'),_0xbbb12[_0x2ea6('0xac')]));}}})['catch'](handleError(_0x41b530,null));};exports[_0x2ea6('0xb5')]=function(_0x570463,_0xd4b057){return db[_0x2ea6('0x2f')][_0x2ea6('0x28')]({'where':{'id':_0x570463['params']['id']},'attributes':['id']})[_0x2ea6('0x1e')](handleEntityNotFound(_0xd4b057,null))[_0x2ea6('0x1e')](function(_0x2555b9){var _0x571d31=[];values=_0x2555b9[_0x2ea6('0x4a')];_0x571d31[_0x2ea6('0x45')](get_open_tabs(_0x2ea6('0x53'),_0x2555b9[_0x2ea6('0x4a')]));_0x571d31[_0x2ea6('0x45')](get_open_tabs(_0x2ea6('0x4b'),_0x2555b9[_0x2ea6('0x4a')]));_0x571d31[_0x2ea6('0x45')](get_open_tabs(_0x2ea6('0x4d'),_0x2555b9[_0x2ea6('0x4a')]));_0x571d31['push'](get_open_tabs(_0x2ea6('0x4e'),_0x2555b9[_0x2ea6('0x4a')]));_0x571d31[_0x2ea6('0x45')](get_open_tabs(_0x2ea6('0x54'),_0x2555b9[_0x2ea6('0x4a')]));_0x571d31['push'](get_open_tabs('mail',_0x2555b9[_0x2ea6('0x4a')]));return Promise['all'](_0x571d31);})[_0x2ea6('0x1e')](function(_0xfd5a63){if(_0xfd5a63){var _0x7a2823=_[_0x2ea6('0x26')](values[_0x2ea6('0xb6')],function(_0x38d1c3){return{'channel':'CHAT','id':_0x38d1c3['id'],'createdAt':_0x38d1c3[_0x2ea6('0xb7')]};});var _0x570e38=_[_0x2ea6('0x26')](values[_0x2ea6('0xb8')],function(_0x2c4437){return{'channel':_0x2ea6('0xb9'),'id':_0x2c4437['id'],'createdAt':_0x2c4437[_0x2ea6('0xb7')]};});var _0x541a96=_[_0x2ea6('0x26')](values[_0x2ea6('0xba')],function(_0x1d8038){return{'channel':_0x2ea6('0xbb'),'id':_0x1d8038['id'],'createdAt':_0x1d8038['createdAt']};});var _0x5dae95=_[_0x2ea6('0x26')](values[_0x2ea6('0xbc')],function(_0x48dab1){return{'channel':_0x2ea6('0xbd'),'id':_0x48dab1['id'],'createdAt':_0x48dab1[_0x2ea6('0xb7')]};});var _0xeb2740=_[_0x2ea6('0x26')](values[_0x2ea6('0xbe')],function(_0x380382){return{'channel':'SMS','id':_0x380382['id'],'createdAt':_0x380382[_0x2ea6('0xb7')]};});var _0x5f3ea3=_[_0x2ea6('0x26')](values['WhatsappOpenTabs'],function(_0xcb12ce){return{'channel':_0x2ea6('0xbf'),'id':_0xcb12ce['id'],'createdAt':_0xcb12ce[_0x2ea6('0xb7')]};});var _0x65cde8=_[_0x2ea6('0xc0')](_0x7a2823,_0x570e38,_0x541a96,_0x5dae95,_0xeb2740,_0x5f3ea3);var _0x3e421f={'count':_0x65cde8[_0x2ea6('0x48')],'rows':_0x65cde8};return _0x3e421f;}else return null;})['then'](respondWithResult(_0xd4b057,null))['catch'](handleError(_0xd4b057,null));};exports[_0x2ea6('0xc1')]=function(_0x57ae5f,_0x3109ce){var _0x845317={};return db[_0x2ea6('0x2f')][_0x2ea6('0x8c')]({'where':{'id':_0x57ae5f[_0x2ea6('0x5a')]['id']}})[_0x2ea6('0x1e')](function(_0x5d25de){if(!_0x5d25de){throw new APINotFoundError(util['format']('User\x20with\x20id\x20%s\x20not\x20found',_0x57ae5f[_0x2ea6('0x5a')]['id']));}return contacts[_0x2ea6('0x58')]();})['then'](function(_0x5b83bb){_0x57ae5f[_0x2ea6('0x3f')][_0x2ea6('0x2f')]=_0x57ae5f[_0x2ea6('0x5a')]['id'];_0x845317=qs['getOptions'](_0x5b83bb,_0x57ae5f);if(_0x57ae5f[_0x2ea6('0x3f')]['hasOwnProperty'](_0x2ea6('0x3e'))){_0x845317['include']=[{'model':db['CmList'],'as':_0x2ea6('0xc2'),'required':![]},{'model':db['Tag'],'as':'Tags','attributes':['id',_0x2ea6('0x29'),_0x2ea6('0xc3')],'where':_0x57ae5f['query']['tag']?{'id':_0x57ae5f[_0x2ea6('0x3f')][_0x2ea6('0xc4')]}:undefined,'required':_0x57ae5f[_0x2ea6('0x3f')][_0x2ea6('0xc4')]?!![]:![]}];}return contacts[_0x2ea6('0x46')](_0x57ae5f[_0x2ea6('0x3f')],_0x57ae5f[_0x2ea6('0x21')],_0x845317,_0x5b83bb);})['then'](respondWithFilteredResult(_0x3109ce,_0x845317))[_0x2ea6('0x4f')](APIHandleError(_0x3109ce));};exports[_0x2ea6('0xc5')]=function(_0x2f00b4,_0x2a06bd){var _0x24601f;var _0x1ea61a={};var _0x1e5345;return db[_0x2ea6('0x2f')][_0x2ea6('0x8c')]({'where':{'id':_0x2f00b4['params']['id']},'attributes':['id',_0x2ea6('0x29'),_0x2ea6('0x1b')]})[_0x2ea6('0x1e')](handleEntityNotFound(_0x2a06bd,null))[_0x2ea6('0x1e')](function(_0x1a953e){if(!utils['isValidChannel'](_0x2f00b4[_0x2ea6('0x3f')]['channel'])){throw new db[(_0x2ea6('0x84'))][(_0x2ea6('0x85'))](_0x2ea6('0x96'));}_0x24601f=_0x1a953e;var _0xed3ae7={};_0xed3ae7['model']=_[_0x2ea6('0xc6')](db[_[_0x2ea6('0x98')](_0x2f00b4[_0x2ea6('0x3f')][_0x2ea6('0x91')])+_0x2ea6('0xc7')]['rawAttributes']);_0xed3ae7[_0x2ea6('0x3f')]=_['keys'](_0x2f00b4[_0x2ea6('0x3f')]);_0xed3ae7[_0x2ea6('0xc8')]=_[_0x2ea6('0xc9')](_0xed3ae7[_0x2ea6('0xca')],_0xed3ae7[_0x2ea6('0x3f')]);_0x1ea61a[_0x2ea6('0x44')]=_['intersection'](_0xed3ae7['model'],qs[_0x2ea6('0xcb')](_0x2f00b4[_0x2ea6('0x3f')]['fields']));_0x1ea61a[_0x2ea6('0x44')]=_0x1ea61a['attributes'][_0x2ea6('0x48')]?_0x1ea61a[_0x2ea6('0x44')]:_0xed3ae7[_0x2ea6('0xca')];_0x1ea61a[_0x2ea6('0xcc')]=qs[_0x2ea6('0xcd')](_0x2f00b4[_0x2ea6('0x3f')][_0x2ea6('0xcd')]);_0x1ea61a['where']=qs[_0x2ea6('0xc8')](_['pick'](_0x2f00b4['query'],_0xed3ae7[_0x2ea6('0xc8')]));if(_0x2f00b4[_0x2ea6('0x3f')][_0x2ea6('0x34')]){_0x1ea61a['where']=_[_0x2ea6('0x51')](_0x1ea61a[_0x2ea6('0x3d')],{'$or':_[_0x2ea6('0x26')](_0x1ea61a['attributes'],function(_0x21356e){var _0x4e3c5b={};_0x4e3c5b[_0x21356e]={'$like':'%'+_0x2f00b4['query'][_0x2ea6('0x34')]+'%'};return _0x4e3c5b;})});}_0x1ea61a=_[_0x2ea6('0x51')]({},_0x1ea61a,_0x2f00b4['options']);switch(_0x24601f[_0x2ea6('0x1b')]){case _0x2ea6('0x1f'):return db[_[_0x2ea6('0x98')](_0x2f00b4['query'][_0x2ea6('0x91')])+'Queue']['findAll'](_0x1ea61a);case _0x2ea6('0x21'):case _0x2ea6('0x1c'):return _0x24601f['get'+_[_0x2ea6('0x98')](_0x2f00b4[_0x2ea6('0x3f')][_0x2ea6('0x91')])+'Queues'](_0x1ea61a);default:throw new db[(_0x2ea6('0x84'))]['ValidationError']('Unknown\x20role');}})[_0x2ea6('0x1e')](function(_0x524249){_0x1e5345=_0x524249[_0x2ea6('0x48')];if(!_0x2f00b4[_0x2ea6('0x3f')]['hasOwnProperty'](_0x2ea6('0xce'))){_0x1ea61a[_0x2ea6('0xcf')]=qs['limit'](_0x2f00b4[_0x2ea6('0x3f')][_0x2ea6('0xcf')]);_0x1ea61a[_0x2ea6('0x18')]=qs[_0x2ea6('0x18')](_0x2f00b4[_0x2ea6('0x3f')][_0x2ea6('0x18')]);}switch(_0x24601f[_0x2ea6('0x1b')]){case _0x2ea6('0x1f'):return db[_[_0x2ea6('0x98')](_0x2f00b4[_0x2ea6('0x3f')][_0x2ea6('0x91')])+_0x2ea6('0xc7')]['findAll'](_0x1ea61a);case _0x2ea6('0x21'):case _0x2ea6('0x1c'):return _0x24601f[_0x2ea6('0xa1')+_[_0x2ea6('0x98')](_0x2f00b4[_0x2ea6('0x3f')][_0x2ea6('0x91')])+_0x2ea6('0xa8')](_0x1ea61a);}})['then'](function(_0x479729){return{'count':_0x1e5345,'rows':_0x479729};})[_0x2ea6('0x1e')](respondWithResult(_0x2a06bd,null))['catch'](handleError(_0x2a06bd,null));};exports[_0x2ea6('0xd0')]=function(_0x34b10b,_0x2a061c){var _0x54a6a5={};var _0x4191a1={};var _0x5bc2a3;var _0x59e946;return db[_0x2ea6('0x2f')][_0x2ea6('0x8c')]({'where':{'id':_0x34b10b[_0x2ea6('0x5a')]['id']}})['then'](handleEntityNotFound(_0x2a061c,null))['then'](function(_0x1e89a5){if(_0x1e89a5){_0x5bc2a3=_0x1e89a5;_0x4191a1[_0x2ea6('0xca')]=_['keys'](db[_0x2ea6('0xa4')][_0x2ea6('0x30')]);_0x4191a1['query']=_[_0x2ea6('0xc6')](_0x34b10b[_0x2ea6('0x3f')]);_0x4191a1[_0x2ea6('0xc8')]=_[_0x2ea6('0xc9')](_0x4191a1['model'],_0x4191a1[_0x2ea6('0x3f')]);_0x54a6a5[_0x2ea6('0x44')]=_['intersection'](_0x4191a1['model'],qs[_0x2ea6('0xcb')](_0x34b10b[_0x2ea6('0x3f')][_0x2ea6('0xcb')]));_0x54a6a5[_0x2ea6('0x44')]=_0x54a6a5[_0x2ea6('0x44')]['length']?_0x54a6a5['attributes']:_0x4191a1[_0x2ea6('0xca')];_0x54a6a5['order']=qs[_0x2ea6('0xcd')](_0x34b10b[_0x2ea6('0x3f')][_0x2ea6('0xcd')]);_0x54a6a5[_0x2ea6('0x3d')]=qs['filters'](_[_0x2ea6('0xd1')](_0x34b10b[_0x2ea6('0x3f')],_0x4191a1[_0x2ea6('0xc8')]));if(_0x34b10b['query'][_0x2ea6('0x34')]){_0x54a6a5[_0x2ea6('0x3d')]=_[_0x2ea6('0x51')](_0x54a6a5[_0x2ea6('0x3d')],{'$or':_[_0x2ea6('0x26')](_0x54a6a5['attributes'],function(_0x7ae6b9){var _0x4941b1={};_0x4941b1[_0x7ae6b9]={'$like':'%'+_0x34b10b['query']['filter']+'%'};return _0x4941b1;})});}_0x54a6a5=_[_0x2ea6('0x51')]({},_0x54a6a5,_0x34b10b['options']);return _0x5bc2a3[_0x2ea6('0xd0')](_0x54a6a5);}})['then'](function(_0x367b77){if(_0x367b77){_0x59e946=_0x367b77[_0x2ea6('0x48')];if(!_0x34b10b[_0x2ea6('0x3f')][_0x2ea6('0xd2')](_0x2ea6('0xce'))){_0x54a6a5[_0x2ea6('0xcf')]=qs[_0x2ea6('0xcf')](_0x34b10b[_0x2ea6('0x3f')]['limit']);_0x54a6a5[_0x2ea6('0x18')]=qs[_0x2ea6('0x18')](_0x34b10b[_0x2ea6('0x3f')][_0x2ea6('0x18')]);}return _0x5bc2a3[_0x2ea6('0xd0')](_0x54a6a5);}})[_0x2ea6('0x1e')](function(_0x475091){if(_0x475091){return _0x475091?{'count':_0x59e946,'rows':_0x475091}:null;}})[_0x2ea6('0x1e')](respondWithResult(_0x2a061c,null))[_0x2ea6('0x4f')](handleError(_0x2a061c,null));};exports[_0x2ea6('0xd3')]=function(_0x1cfee3,_0xe80a4){var _0x401192={};var _0xe751b2={};var _0x3759ba;var _0x2c499f;return db[_0x2ea6('0x2f')][_0x2ea6('0x8c')]({'where':{'id':_0x1cfee3[_0x2ea6('0x5a')]['id']}})[_0x2ea6('0x1e')](handleEntityNotFound(_0xe80a4,null))[_0x2ea6('0x1e')](function(_0x1d37e8){if(_0x1d37e8){_0x3759ba=_0x1d37e8;_0xe751b2[_0x2ea6('0xca')]=_[_0x2ea6('0xc6')](db['ChatGroup'][_0x2ea6('0x30')]);_0xe751b2[_0x2ea6('0x3f')]=_[_0x2ea6('0xc6')](_0x1cfee3[_0x2ea6('0x3f')]);_0xe751b2[_0x2ea6('0xc8')]=_[_0x2ea6('0xc9')](_0xe751b2['model'],_0xe751b2[_0x2ea6('0x3f')]);_0x401192[_0x2ea6('0x44')]=_[_0x2ea6('0xc9')](_0xe751b2['model'],qs['fields'](_0x1cfee3[_0x2ea6('0x3f')][_0x2ea6('0xcb')]));_0x401192[_0x2ea6('0x44')]=_0x401192['attributes'][_0x2ea6('0x48')]?_0x401192[_0x2ea6('0x44')]:_0xe751b2[_0x2ea6('0xca')];_0x401192['order']=qs[_0x2ea6('0xcd')](_0x1cfee3[_0x2ea6('0x3f')][_0x2ea6('0xcd')]);_0x401192[_0x2ea6('0x3d')]=qs['filters'](_[_0x2ea6('0xd1')](_0x1cfee3['query'],_0xe751b2[_0x2ea6('0xc8')]));if(_0x1cfee3[_0x2ea6('0x3f')][_0x2ea6('0x34')]){_0x401192[_0x2ea6('0x3d')]=_['merge'](_0x401192[_0x2ea6('0x3d')],{'$or':_[_0x2ea6('0x26')](_0x401192[_0x2ea6('0x44')],function(_0x181aa2){var _0x574027={};_0x574027[_0x181aa2]={'$like':'%'+_0x1cfee3[_0x2ea6('0x3f')][_0x2ea6('0x34')]+'%'};return _0x574027;})});}_0x401192=_[_0x2ea6('0x51')]({},_0x401192,_0x1cfee3[_0x2ea6('0x52')]);return _0x3759ba[_0x2ea6('0xd3')](_0x401192);}})['then'](function(_0x120002){if(_0x120002){_0x2c499f=_0x120002[_0x2ea6('0x48')];if(!_0x1cfee3[_0x2ea6('0x3f')]['hasOwnProperty']('nolimit')){_0x401192[_0x2ea6('0xcf')]=qs['limit'](_0x1cfee3[_0x2ea6('0x3f')][_0x2ea6('0xcf')]);_0x401192[_0x2ea6('0x18')]=qs[_0x2ea6('0x18')](_0x1cfee3[_0x2ea6('0x3f')][_0x2ea6('0x18')]);}return _0x3759ba[_0x2ea6('0xd3')](_0x401192);}})['then'](function(_0x53e6e5){if(_0x53e6e5){return _0x53e6e5?{'count':_0x2c499f,'rows':_0x53e6e5}:null;}})[_0x2ea6('0x1e')](respondWithResult(_0xe80a4,null))[_0x2ea6('0x4f')](handleError(_0xe80a4,null));};exports[_0x2ea6('0xd4')]=function(_0x5038b8,_0xc3a524){var _0x557c3b={'raw':!![],'where':{}};var _0x261ac7={};var _0x6414b={'count':0x0,'rows':[]};return db['User'][_0x2ea6('0x8c')]({'where':{'id':_0x5038b8[_0x2ea6('0x5a')]['id']}})[_0x2ea6('0x1e')](handleEntityNotFound(_0xc3a524,null))[_0x2ea6('0x1e')](function(_0x2b8c4a){if(_0x2b8c4a){_0x261ac7[_0x2ea6('0xca')]=_['keys'](db[_0x2ea6('0xd5')][_0x2ea6('0x30')]);_0x261ac7['query']=_[_0x2ea6('0xc6')](_0x5038b8[_0x2ea6('0x3f')]);_0x261ac7[_0x2ea6('0xc8')]=_[_0x2ea6('0xc9')](_0x261ac7[_0x2ea6('0xca')],_0x261ac7[_0x2ea6('0x3f')]);_0x557c3b[_0x2ea6('0x44')]=_['intersection'](_0x261ac7[_0x2ea6('0xca')],qs[_0x2ea6('0xcb')](_0x5038b8[_0x2ea6('0x3f')][_0x2ea6('0xcb')]));_0x557c3b[_0x2ea6('0x44')]=_0x557c3b[_0x2ea6('0x44')][_0x2ea6('0x48')]?_0x557c3b[_0x2ea6('0x44')]:_0x261ac7[_0x2ea6('0xca')];if(!_0x5038b8[_0x2ea6('0x3f')][_0x2ea6('0xd2')](_0x2ea6('0xce'))){_0x557c3b[_0x2ea6('0xcf')]=qs[_0x2ea6('0xcf')](_0x5038b8[_0x2ea6('0x3f')][_0x2ea6('0xcf')]);_0x557c3b['offset']=qs['offset'](_0x5038b8['query'][_0x2ea6('0x18')]);}_0x557c3b[_0x2ea6('0xcc')]=qs[_0x2ea6('0xcd')](_0x5038b8['query'][_0x2ea6('0xcd')]);_0x557c3b['where']=qs[_0x2ea6('0xc8')](_[_0x2ea6('0xd1')](_0x5038b8['query'],_0x261ac7[_0x2ea6('0xc8')]));_0x557c3b['where'][_0x2ea6('0xd6')]=_0x2b8c4a['id'];if(_0x5038b8[_0x2ea6('0x3f')][_0x2ea6('0x34')]){_0x557c3b[_0x2ea6('0x3d')]=_[_0x2ea6('0x51')](_0x557c3b['where'],{'$or':_['map'](_0x557c3b['attributes'],function(_0x27657f){var _0x15fb45={};_0x15fb45[_0x27657f]={'$like':'%'+_0x5038b8[_0x2ea6('0x3f')][_0x2ea6('0x34')]+'%'};return _0x15fb45;})});}_0x557c3b=_['merge']({},_0x557c3b,_0x5038b8[_0x2ea6('0x52')]);return db[_0x2ea6('0xd5')]['count']({'where':_0x557c3b[_0x2ea6('0x3d')]})['then'](function(_0x5d8724){_0x6414b[_0x2ea6('0x19')]=_0x5d8724;if(_0x5038b8['query'][_0x2ea6('0x3e')]){_0x557c3b[_0x2ea6('0x42')]=[{'all':!![]}];}return db['VoiceRecording'][_0x2ea6('0x46')](_0x557c3b);})[_0x2ea6('0x1e')](function(_0x240c28){_0x6414b[_0x2ea6('0x49')]=_0x240c28;return _0x6414b;});}})['then'](respondWithFilteredResult(_0xc3a524,_0x557c3b))[_0x2ea6('0x4f')](handleError(_0xc3a524,null));};exports[_0x2ea6('0xd7')]=function(_0x1b801f,_0x2fec08){var _0xca4004={'raw':!![],'where':{}};var _0x5c0ba3={};var _0xd630ee={'count':0x0,'rows':[]};return db['User'][_0x2ea6('0x8c')]({'where':{'id':_0x1b801f['params']['id']}})[_0x2ea6('0x1e')](handleEntityNotFound(_0x2fec08,null))['then'](function(_0x70c036){if(_0x70c036){_0x5c0ba3[_0x2ea6('0xca')]=_['keys'](db[_0x2ea6('0xd8')][_0x2ea6('0x30')]);_0x5c0ba3[_0x2ea6('0x3f')]=_[_0x2ea6('0xc6')](_0x1b801f[_0x2ea6('0x3f')]);_0x5c0ba3[_0x2ea6('0xc8')]=_[_0x2ea6('0xc9')](_0x5c0ba3[_0x2ea6('0xca')],_0x5c0ba3[_0x2ea6('0x3f')]);_0xca4004[_0x2ea6('0x44')]=_['intersection'](_0x5c0ba3[_0x2ea6('0xca')],qs[_0x2ea6('0xcb')](_0x1b801f['query'][_0x2ea6('0xcb')]));_0xca4004[_0x2ea6('0x44')]=_0xca4004[_0x2ea6('0x44')][_0x2ea6('0x48')]?_0xca4004[_0x2ea6('0x44')]:_0x5c0ba3[_0x2ea6('0xca')];if(!_0x1b801f[_0x2ea6('0x3f')][_0x2ea6('0xd2')](_0x2ea6('0xce'))){_0xca4004['limit']=qs[_0x2ea6('0xcf')](_0x1b801f[_0x2ea6('0x3f')]['limit']);_0xca4004[_0x2ea6('0x18')]=qs['offset'](_0x1b801f[_0x2ea6('0x3f')][_0x2ea6('0x18')]);}_0xca4004[_0x2ea6('0xcc')]=qs[_0x2ea6('0xcd')](_0x1b801f['query'][_0x2ea6('0xcd')]);_0xca4004[_0x2ea6('0x3d')]=qs[_0x2ea6('0xc8')](_[_0x2ea6('0xd1')](_0x1b801f[_0x2ea6('0x3f')],_0x5c0ba3[_0x2ea6('0xc8')]));_0xca4004[_0x2ea6('0x3d')][_0x2ea6('0xd6')]=_0x70c036['id'];if(_0x1b801f['query'][_0x2ea6('0x34')]){_0xca4004[_0x2ea6('0x3d')]=_[_0x2ea6('0x51')](_0xca4004[_0x2ea6('0x3d')],{'$or':_['map'](_0xca4004['attributes'],function(_0x2b5620){var _0x1b4be2={};_0x1b4be2[_0x2b5620]={'$like':'%'+_0x1b801f['query'][_0x2ea6('0x34')]+'%'};return _0x1b4be2;})});}_0xca4004=_[_0x2ea6('0x51')]({},_0xca4004,_0x1b801f['options']);return db[_0x2ea6('0xd8')]['count']({'where':_0xca4004[_0x2ea6('0x3d')]})[_0x2ea6('0x1e')](function(_0x94b5a9){_0xd630ee[_0x2ea6('0x19')]=_0x94b5a9;if(_0x1b801f['query'][_0x2ea6('0x3e')]){_0xca4004[_0x2ea6('0x42')]=[{'all':!![]}];}return db[_0x2ea6('0xd8')][_0x2ea6('0x46')](_0xca4004);})['then'](function(_0x17f0fa){_0xd630ee[_0x2ea6('0x49')]=_0x17f0fa;return _0xd630ee;});}})[_0x2ea6('0x1e')](respondWithFilteredResult(_0x2fec08,_0xca4004))[_0x2ea6('0x4f')](handleError(_0x2fec08,null));};exports[_0x2ea6('0xd9')]=function(_0x4a4d40,_0x1445c6){var _0x7bb9be={};var _0x4bedc3={};var _0x5ddd53;var _0x51333d;return db[_0x2ea6('0x2f')][_0x2ea6('0x8c')]({'where':{'id':_0x4a4d40['params']['id']}})[_0x2ea6('0x1e')](handleEntityNotFound(_0x1445c6,null))['then'](function(_0x497eb0){if(_0x497eb0){_0x5ddd53=_0x497eb0;_0x4bedc3[_0x2ea6('0xca')]=_['keys'](db['ChatInteraction']['rawAttributes']);_0x4bedc3[_0x2ea6('0x3f')]=_[_0x2ea6('0xc6')](_0x4a4d40[_0x2ea6('0x3f')]);_0x4bedc3[_0x2ea6('0xc8')]=_[_0x2ea6('0xc9')](_0x4bedc3['model'],_0x4bedc3[_0x2ea6('0x3f')]);_0x7bb9be[_0x2ea6('0x44')]=_[_0x2ea6('0xc9')](_0x4bedc3[_0x2ea6('0xca')],qs['fields'](_0x4a4d40['query']['fields']));_0x7bb9be['attributes']=_0x7bb9be[_0x2ea6('0x44')][_0x2ea6('0x48')]?_0x7bb9be['attributes']:_0x4bedc3[_0x2ea6('0xca')];_0x7bb9be['order']=qs[_0x2ea6('0xcd')](_0x4a4d40[_0x2ea6('0x3f')]['sort']);_0x7bb9be['where']=qs[_0x2ea6('0xc8')](_[_0x2ea6('0xd1')](_0x4a4d40['query'],_0x4bedc3[_0x2ea6('0xc8')]));if(_0x4a4d40['query']['filter']){_0x7bb9be[_0x2ea6('0x3d')]=_[_0x2ea6('0x51')](_0x7bb9be['where'],{'$or':_[_0x2ea6('0x26')](_0x7bb9be[_0x2ea6('0x44')],function(_0x51e886){var _0x2d8da7={};_0x2d8da7[_0x51e886]={'$like':'%'+_0x4a4d40['query']['filter']+'%'};return _0x2d8da7;})});}_0x7bb9be=_['merge']({},_0x7bb9be,_0x4a4d40[_0x2ea6('0x52')]);return _0x5ddd53['getChatInteractions'](_0x7bb9be);}})[_0x2ea6('0x1e')](function(_0x5306a0){if(_0x5306a0){_0x51333d=_0x5306a0['length'];if(!_0x4a4d40['query'][_0x2ea6('0xd2')](_0x2ea6('0xce'))){_0x7bb9be[_0x2ea6('0xcf')]=qs[_0x2ea6('0xcf')](_0x4a4d40[_0x2ea6('0x3f')][_0x2ea6('0xcf')]);_0x7bb9be[_0x2ea6('0x18')]=qs['offset'](_0x4a4d40['query']['offset']);}return _0x5ddd53[_0x2ea6('0xd9')](_0x7bb9be);}})[_0x2ea6('0x1e')](function(_0x3325e2){if(_0x3325e2){return _0x3325e2?{'count':_0x51333d,'rows':_0x3325e2}:null;}})['then'](respondWithResult(_0x1445c6,null))['catch'](handleError(_0x1445c6,null));};exports[_0x2ea6('0xda')]=function(_0x303606,_0x2eb403){var _0x539c6b={};var _0x3f1e9a={};var _0x2ba10b;var _0xee33d5;return db['User'][_0x2ea6('0x8c')]({'where':{'id':_0x303606[_0x2ea6('0x5a')]['id']}})[_0x2ea6('0x1e')](handleEntityNotFound(_0x2eb403,null))[_0x2ea6('0x1e')](function(_0x3e59fe){if(_0x3e59fe){_0x2ba10b=_0x3e59fe;_0x3f1e9a['model']=_[_0x2ea6('0xc6')](db['OpenchannelInteraction'][_0x2ea6('0x30')]);_0x3f1e9a[_0x2ea6('0x3f')]=_[_0x2ea6('0xc6')](_0x303606[_0x2ea6('0x3f')]);_0x3f1e9a[_0x2ea6('0xc8')]=_[_0x2ea6('0xc9')](_0x3f1e9a[_0x2ea6('0xca')],_0x3f1e9a['query']);_0x539c6b[_0x2ea6('0x44')]=_[_0x2ea6('0xc9')](_0x3f1e9a[_0x2ea6('0xca')],qs['fields'](_0x303606[_0x2ea6('0x3f')][_0x2ea6('0xcb')]));_0x539c6b[_0x2ea6('0x44')]=_0x539c6b[_0x2ea6('0x44')][_0x2ea6('0x48')]?_0x539c6b[_0x2ea6('0x44')]:_0x3f1e9a[_0x2ea6('0xca')];_0x539c6b[_0x2ea6('0xcc')]=qs[_0x2ea6('0xcd')](_0x303606[_0x2ea6('0x3f')][_0x2ea6('0xcd')]);_0x539c6b[_0x2ea6('0x3d')]=qs[_0x2ea6('0xc8')](_[_0x2ea6('0xd1')](_0x303606[_0x2ea6('0x3f')],_0x3f1e9a['filters']));if(_0x303606[_0x2ea6('0x3f')][_0x2ea6('0x34')]){_0x539c6b[_0x2ea6('0x3d')]=_['merge'](_0x539c6b[_0x2ea6('0x3d')],{'$or':_[_0x2ea6('0x26')](_0x539c6b[_0x2ea6('0x44')],function(_0x1e6072){var _0x17f15f={};_0x17f15f[_0x1e6072]={'$like':'%'+_0x303606[_0x2ea6('0x3f')][_0x2ea6('0x34')]+'%'};return _0x17f15f;})});}_0x539c6b=_[_0x2ea6('0x51')]({},_0x539c6b,_0x303606['options']);return _0x2ba10b[_0x2ea6('0xda')](_0x539c6b);}})[_0x2ea6('0x1e')](function(_0x1c5ab7){if(_0x1c5ab7){_0xee33d5=_0x1c5ab7['length'];if(!_0x303606[_0x2ea6('0x3f')][_0x2ea6('0xd2')](_0x2ea6('0xce'))){_0x539c6b[_0x2ea6('0xcf')]=qs['limit'](_0x303606[_0x2ea6('0x3f')][_0x2ea6('0xcf')]);_0x539c6b[_0x2ea6('0x18')]=qs[_0x2ea6('0x18')](_0x303606[_0x2ea6('0x3f')][_0x2ea6('0x18')]);}return _0x2ba10b[_0x2ea6('0xda')](_0x539c6b);}})[_0x2ea6('0x1e')](function(_0x5e5f47){if(_0x5e5f47){return _0x5e5f47?{'count':_0xee33d5,'rows':_0x5e5f47}:null;}})[_0x2ea6('0x1e')](respondWithResult(_0x2eb403,null))[_0x2ea6('0x4f')](handleError(_0x2eb403,null));};exports['getMailInteractions']=function(_0x50fe42,_0x4e9418){var _0x4e2a94={'raw':!![],'where':{}};var _0x433919={};var _0x334d18={'count':0x0,'rows':[]};return db[_0x2ea6('0x2f')]['findOne']({'where':{'id':_0x50fe42[_0x2ea6('0x5a')]['id']}})['then'](handleEntityNotFound(_0x4e9418,null))[_0x2ea6('0x1e')](function(_0x388eb8){if(_0x388eb8){_0x433919[_0x2ea6('0xca')]=_[_0x2ea6('0xc6')](db[_0x2ea6('0xdb')][_0x2ea6('0x30')]);_0x433919[_0x2ea6('0x3f')]=_[_0x2ea6('0xc6')](_0x50fe42[_0x2ea6('0x3f')]);_0x433919[_0x2ea6('0xc8')]=_[_0x2ea6('0xc9')](_0x433919[_0x2ea6('0xca')],_0x433919[_0x2ea6('0x3f')]);_0x4e2a94['attributes']=_[_0x2ea6('0xc9')](_0x433919[_0x2ea6('0xca')],qs[_0x2ea6('0xcb')](_0x50fe42[_0x2ea6('0x3f')][_0x2ea6('0xcb')]));_0x4e2a94[_0x2ea6('0x44')]=_0x4e2a94['attributes'][_0x2ea6('0x48')]?_0x4e2a94[_0x2ea6('0x44')]:_0x433919['model'];if(!_0x50fe42[_0x2ea6('0x3f')]['hasOwnProperty']('nolimit')){_0x4e2a94['limit']=qs[_0x2ea6('0xcf')](_0x50fe42[_0x2ea6('0x3f')][_0x2ea6('0xcf')]);_0x4e2a94[_0x2ea6('0x18')]=qs[_0x2ea6('0x18')](_0x50fe42[_0x2ea6('0x3f')][_0x2ea6('0x18')]);}_0x4e2a94[_0x2ea6('0xcc')]=qs[_0x2ea6('0xcd')](_0x50fe42[_0x2ea6('0x3f')]['sort']);_0x4e2a94[_0x2ea6('0x3d')]=qs[_0x2ea6('0xc8')](_[_0x2ea6('0xd1')](_0x50fe42[_0x2ea6('0x3f')],_0x433919['filters']));_0x4e2a94[_0x2ea6('0x3d')][_0x2ea6('0xd6')]=_0x388eb8['id'];if(_0x50fe42['query']['filter']){_0x4e2a94['where']=_[_0x2ea6('0x51')](_0x4e2a94[_0x2ea6('0x3d')],{'$or':_[_0x2ea6('0x26')](_0x4e2a94['attributes'],function(_0x4c58cc){var _0x180cc4={};_0x180cc4[_0x4c58cc]={'$like':'%'+_0x50fe42['query']['filter']+'%'};return _0x180cc4;})});}_0x4e2a94=_[_0x2ea6('0x51')]({},_0x4e2a94,_0x50fe42[_0x2ea6('0x52')]);return db[_0x2ea6('0xdb')][_0x2ea6('0x19')]({'where':_0x4e2a94['where']})[_0x2ea6('0x1e')](function(_0x5cb1ae){_0x334d18['count']=_0x5cb1ae;if(_0x50fe42[_0x2ea6('0x3f')]['includeAll']){_0x4e2a94[_0x2ea6('0x42')]=[{'all':!![]}];}return db[_0x2ea6('0xdb')][_0x2ea6('0x46')](_0x4e2a94);})[_0x2ea6('0x1e')](function(_0x1f9773){_0x334d18[_0x2ea6('0x49')]=_0x1f9773;return _0x334d18;});}})['then'](respondWithFilteredResult(_0x4e9418,_0x4e2a94))[_0x2ea6('0x4f')](handleError(_0x4e9418,null));};exports[_0x2ea6('0xdc')]=function(_0x3614ad,_0x376d54){var _0x2b4e97={};var _0x2153c9={};var _0x2d9300;var _0x56065f;return db[_0x2ea6('0x2f')][_0x2ea6('0x8c')]({'where':{'id':_0x3614ad['params']['id']}})[_0x2ea6('0x1e')](handleEntityNotFound(_0x376d54,null))[_0x2ea6('0x1e')](function(_0x59ecc2){if(_0x59ecc2){_0x2d9300=_0x59ecc2;_0x2153c9['model']=_[_0x2ea6('0xc6')](db[_0x2ea6('0xdd')]['rawAttributes']);_0x2153c9[_0x2ea6('0x3f')]=_[_0x2ea6('0xc6')](_0x3614ad[_0x2ea6('0x3f')]);_0x2153c9[_0x2ea6('0xc8')]=_[_0x2ea6('0xc9')](_0x2153c9[_0x2ea6('0xca')],_0x2153c9['query']);_0x2b4e97[_0x2ea6('0x44')]=_[_0x2ea6('0xc9')](_0x2153c9[_0x2ea6('0xca')],qs[_0x2ea6('0xcb')](_0x3614ad['query'][_0x2ea6('0xcb')]));_0x2b4e97[_0x2ea6('0x44')]=_0x2b4e97[_0x2ea6('0x44')][_0x2ea6('0x48')]?_0x2b4e97[_0x2ea6('0x44')]:_0x2153c9[_0x2ea6('0xca')];_0x2b4e97['order']=qs['sort'](_0x3614ad[_0x2ea6('0x3f')]['sort']);_0x2b4e97[_0x2ea6('0x3d')]=qs[_0x2ea6('0xc8')](_[_0x2ea6('0xd1')](_0x3614ad[_0x2ea6('0x3f')],_0x2153c9[_0x2ea6('0xc8')]));if(_0x3614ad[_0x2ea6('0x3f')][_0x2ea6('0x34')]){_0x2b4e97[_0x2ea6('0x3d')]=_[_0x2ea6('0x51')](_0x2b4e97['where'],{'$or':_[_0x2ea6('0x26')](_0x2b4e97['attributes'],function(_0x55c4e9){var _0x25c79d={};_0x25c79d[_0x55c4e9]={'$like':'%'+_0x3614ad['query']['filter']+'%'};return _0x25c79d;})});}_0x2b4e97=_[_0x2ea6('0x51')]({},_0x2b4e97,_0x3614ad['options']);return _0x2d9300[_0x2ea6('0xdc')](_0x2b4e97);}})['then'](function(_0x17bc8a){if(_0x17bc8a){_0x56065f=_0x17bc8a['length'];if(!_0x3614ad['query']['hasOwnProperty']('nolimit')){_0x2b4e97[_0x2ea6('0xcf')]=qs['limit'](_0x3614ad[_0x2ea6('0x3f')][_0x2ea6('0xcf')]);_0x2b4e97[_0x2ea6('0x18')]=qs[_0x2ea6('0x18')](_0x3614ad['query'][_0x2ea6('0x18')]);}return _0x2d9300[_0x2ea6('0xdc')](_0x2b4e97);}})[_0x2ea6('0x1e')](function(_0x110cd1){if(_0x110cd1){return _0x110cd1?{'count':_0x56065f,'rows':_0x110cd1}:null;}})['then'](respondWithResult(_0x376d54,null))[_0x2ea6('0x4f')](handleError(_0x376d54,null));};exports['getFaxInteractions']=function(_0x3ee9cc,_0x51448c){var _0x35c814={};var _0x4a0b85={};var _0x3057b9;var _0x8331bd;return db['User']['findOne']({'where':{'id':_0x3ee9cc['params']['id']}})[_0x2ea6('0x1e')](handleEntityNotFound(_0x51448c,null))[_0x2ea6('0x1e')](function(_0x18eb08){if(_0x18eb08){_0x3057b9=_0x18eb08;_0x4a0b85[_0x2ea6('0xca')]=_[_0x2ea6('0xc6')](db['FaxInteraction'][_0x2ea6('0x30')]);_0x4a0b85['query']=_['keys'](_0x3ee9cc[_0x2ea6('0x3f')]);_0x4a0b85['filters']=_[_0x2ea6('0xc9')](_0x4a0b85[_0x2ea6('0xca')],_0x4a0b85[_0x2ea6('0x3f')]);_0x35c814[_0x2ea6('0x44')]=_[_0x2ea6('0xc9')](_0x4a0b85[_0x2ea6('0xca')],qs[_0x2ea6('0xcb')](_0x3ee9cc['query'][_0x2ea6('0xcb')]));_0x35c814['attributes']=_0x35c814[_0x2ea6('0x44')]['length']?_0x35c814[_0x2ea6('0x44')]:_0x4a0b85[_0x2ea6('0xca')];_0x35c814[_0x2ea6('0xcc')]=qs[_0x2ea6('0xcd')](_0x3ee9cc['query']['sort']);_0x35c814[_0x2ea6('0x3d')]=qs[_0x2ea6('0xc8')](_[_0x2ea6('0xd1')](_0x3ee9cc[_0x2ea6('0x3f')],_0x4a0b85[_0x2ea6('0xc8')]));if(_0x3ee9cc[_0x2ea6('0x3f')][_0x2ea6('0x34')]){_0x35c814[_0x2ea6('0x3d')]=_['merge'](_0x35c814[_0x2ea6('0x3d')],{'$or':_[_0x2ea6('0x26')](_0x35c814[_0x2ea6('0x44')],function(_0x2cc9fb){var _0x4c1787={};_0x4c1787[_0x2cc9fb]={'$like':'%'+_0x3ee9cc[_0x2ea6('0x3f')][_0x2ea6('0x34')]+'%'};return _0x4c1787;})});}_0x35c814=_[_0x2ea6('0x51')]({},_0x35c814,_0x3ee9cc[_0x2ea6('0x52')]);return _0x3057b9[_0x2ea6('0xde')](_0x35c814);}})[_0x2ea6('0x1e')](function(_0x878234){if(_0x878234){_0x8331bd=_0x878234[_0x2ea6('0x48')];if(!_0x3ee9cc[_0x2ea6('0x3f')]['hasOwnProperty'](_0x2ea6('0xce'))){_0x35c814[_0x2ea6('0xcf')]=qs['limit'](_0x3ee9cc['query'][_0x2ea6('0xcf')]);_0x35c814['offset']=qs[_0x2ea6('0x18')](_0x3ee9cc[_0x2ea6('0x3f')][_0x2ea6('0x18')]);}return _0x3057b9[_0x2ea6('0xde')](_0x35c814);}})['then'](function(_0x7e3806){if(_0x7e3806){return _0x7e3806?{'count':_0x8331bd,'rows':_0x7e3806}:null;}})[_0x2ea6('0x1e')](respondWithResult(_0x51448c,null))[_0x2ea6('0x4f')](handleError(_0x51448c,null));};exports['getWhatsappInteractions']=function(_0x102114,_0x19ae8b){var _0x15cb20={};var _0x4d0cfe={};var _0x176d0b;var _0x471a31;return db[_0x2ea6('0x2f')][_0x2ea6('0x8c')]({'where':{'id':_0x102114[_0x2ea6('0x5a')]['id']}})[_0x2ea6('0x1e')](handleEntityNotFound(_0x19ae8b,null))[_0x2ea6('0x1e')](function(_0x17b50a){if(_0x17b50a){_0x176d0b=_0x17b50a;_0x4d0cfe[_0x2ea6('0xca')]=_[_0x2ea6('0xc6')](db[_0x2ea6('0xdf')][_0x2ea6('0x30')]);_0x4d0cfe[_0x2ea6('0x3f')]=_[_0x2ea6('0xc6')](_0x102114['query']);_0x4d0cfe[_0x2ea6('0xc8')]=_[_0x2ea6('0xc9')](_0x4d0cfe['model'],_0x4d0cfe[_0x2ea6('0x3f')]);_0x15cb20[_0x2ea6('0x44')]=_['intersection'](_0x4d0cfe['model'],qs[_0x2ea6('0xcb')](_0x102114['query'][_0x2ea6('0xcb')]));_0x15cb20[_0x2ea6('0x44')]=_0x15cb20[_0x2ea6('0x44')][_0x2ea6('0x48')]?_0x15cb20[_0x2ea6('0x44')]:_0x4d0cfe[_0x2ea6('0xca')];_0x15cb20[_0x2ea6('0xcc')]=qs[_0x2ea6('0xcd')](_0x102114[_0x2ea6('0x3f')][_0x2ea6('0xcd')]);_0x15cb20[_0x2ea6('0x3d')]=qs[_0x2ea6('0xc8')](_[_0x2ea6('0xd1')](_0x102114[_0x2ea6('0x3f')],_0x4d0cfe[_0x2ea6('0xc8')]));if(_0x102114['query'][_0x2ea6('0x34')]){_0x15cb20[_0x2ea6('0x3d')]=_[_0x2ea6('0x51')](_0x15cb20['where'],{'$or':_['map'](_0x15cb20['attributes'],function(_0x3bb980){var _0x2a9c1c={};_0x2a9c1c[_0x3bb980]={'$like':'%'+_0x102114[_0x2ea6('0x3f')][_0x2ea6('0x34')]+'%'};return _0x2a9c1c;})});}_0x15cb20=_[_0x2ea6('0x51')]({},_0x15cb20,_0x102114[_0x2ea6('0x52')]);return _0x176d0b[_0x2ea6('0xe0')](_0x15cb20);}})['then'](function(_0x39526f){if(_0x39526f){_0x471a31=_0x39526f['length'];if(!_0x102114[_0x2ea6('0x3f')][_0x2ea6('0xd2')](_0x2ea6('0xce'))){_0x15cb20[_0x2ea6('0xcf')]=qs[_0x2ea6('0xcf')](_0x102114[_0x2ea6('0x3f')]['limit']);_0x15cb20[_0x2ea6('0x18')]=qs[_0x2ea6('0x18')](_0x102114[_0x2ea6('0x3f')][_0x2ea6('0x18')]);}return _0x176d0b[_0x2ea6('0xe0')](_0x15cb20);}})['then'](function(_0x57b757){if(_0x57b757){return _0x57b757?{'count':_0x471a31,'rows':_0x57b757}:null;}})[_0x2ea6('0x1e')](respondWithResult(_0x19ae8b,null))[_0x2ea6('0x4f')](handleError(_0x19ae8b,null));};exports[_0x2ea6('0xe1')]=function(_0x397b29,_0x5dad63,_0x1cf186){var _0x4a8576;var _0xaa1ee0;var _0x2e90c1;var _0xf7eece=!_['isNil'](_0x397b29[_0x2ea6('0x5a')]['id'])?_0x397b29[_0x2ea6('0x5a')]['id']:!_[_0x2ea6('0x62')](_0x397b29[_0x2ea6('0x21')]['id'])?_0x397b29[_0x2ea6('0x21')]['id']:null;return db[_0x2ea6('0x2f')][_0x2ea6('0x28')]({'where':{'id':_0xf7eece,'role':{'$or':[_0x2ea6('0x1f'),_0x2ea6('0x21'),_0x2ea6('0x1c')]}},'attributes':['id',_0x2ea6('0x29'),_0x2ea6('0xe2'),_0x2ea6('0xe3'),_0x2ea6('0x1b'),_0x2ea6('0x5d'),_0x2ea6('0x93')]})[_0x2ea6('0x1e')](function(_0x57d539){if(_0x57d539){if(_0x57d539[_0x2ea6('0x1b')]==='agent'){_0x4a8576=_0x57d539;if(_0x397b29[_0x2ea6('0x57')][_0x2ea6('0x95')]){_0x2e90c1=util[_0x2ea6('0xa2')]('LOCAL/%s@from-sip/n',_0x4a8576[_0x397b29[_0x2ea6('0x57')]['interface']]);}else if(_0x397b29[_0x2ea6('0x57')][_0x2ea6('0xe4')]){_0x2e90c1=util[_0x2ea6('0xa2')](_0x2ea6('0xa3'),_0x397b29[_0x2ea6('0x57')][_0x2ea6('0xe4')]);}else{_0x2e90c1=util[_0x2ea6('0xa2')]('SIP/%s',_0x4a8576[_0x2ea6('0x29')]);}socket['to'](util[_0x2ea6('0xa2')](_0x2ea6('0xe5'),_0x4a8576[_0x2ea6('0x29')]))[_0x2ea6('0x9d')](_0x2ea6('0xe6'),{'user':{'id':_0x4a8576['id'],'name':_0x4a8576[_0x2ea6('0x29')]},'ip':_0x397b29[_0x2ea6('0xe7')]['x-forwarded-for']||_0x397b29[_0x2ea6('0xe8')][_0x2ea6('0xe9')]||_0x397b29[_0x2ea6('0xea')][_0x2ea6('0xe9')]||_0x397b29[_0x2ea6('0xe8')]['socket'][_0x2ea6('0xe9')]});return db[_0x2ea6('0xa4')][_0x2ea6('0x1d')]({'where':{'membername':_0x4a8576[_0x2ea6('0x29')]},'individualHooks':!![]});}}else{throw new db[(_0x2ea6('0x84'))][(_0x2ea6('0x85'))](_0x2ea6('0xeb'));}})['then'](function(){if(_0x4a8576){return _0x4a8576['getVoiceQueues']({'raw':!![]});}})['then'](function(_0x223e2d){if(_0x4a8576){if(_0x223e2d){_0xaa1ee0=_0x223e2d;if(_0xaa1ee0[_0x2ea6('0x48')]){var _0x575de1=_0xaa1ee0['map'](function(_0x5cc89d){var _0x1b83ae={'membername':_0x4a8576[_0x2ea6('0x29')],'UserId':_0x4a8576['id'],'queue_name':_0x5cc89d[_0x2ea6('0x29')],'VoiceQueueId':_0x5cc89d['id'],'interface':_0x2e90c1,'paused':_0x4a8576['loginInPause']||![],'penalty':_0x5cc89d[_0x2ea6('0xec')]||0x0};return db[_0x2ea6('0xa4')][_0x2ea6('0xa5')](_0x1b83ae);});return Promise['all'](_0x575de1);}}}})[_0x2ea6('0x1e')](function(){if(_0x4a8576){return db[_0x2ea6('0xed')][_0x2ea6('0x46')]({'where':{'membername':_0x4a8576[_0x2ea6('0x29')],'exitAt':null}});}})[_0x2ea6('0x1e')](function(_0x13aeea){if(_0x4a8576){var _0x1b5369=[];_0x13aeea[_0x2ea6('0xee')](function(_0x16a708){_0x1b5369[_0x2ea6('0x45')](_0x16a708['update']({'exitAt':moment()[_0x2ea6('0xa2')](_0x2ea6('0xef'))}));});return Promise[_0x2ea6('0x55')](_0x1b5369);}})[_0x2ea6('0x1e')](function(){if(_0x4a8576){var _0x490d71=[];var _0x4cafed=[];var _0x240f5e=utils[_0x2ea6('0xf0')]();var _0x360640={'membername':_0x4a8576[_0x2ea6('0x29')],'interface':_0x2e90c1,'enterAt':moment()[_0x2ea6('0xa2')]('YYYY-MM-DD\x20HH:mm:ss'),'role':_0x4a8576[_0x2ea6('0x1b')],'internal':_0x4a8576[_0x2ea6('0x5d')]};_0x240f5e[_0x2ea6('0xee')](function(_0x53dc96){_0x490d71[_0x2ea6('0x45')](_[_0x2ea6('0x51')]({'channel':_0x53dc96,'type':_0x2ea6('0xf1'),'data1':_0x397b29[_0x2ea6('0x57')]['device'],'data2':_0x2e90c1},_0x360640));if(_0x4a8576['loginInPause']){_0x4cafed[_0x2ea6('0x45')](_[_0x2ea6('0x51')]({'channel':_0x53dc96,'type':_0x2ea6('0xf2'),'data1':_0x2ea6('0xf3')},_0x360640));}});return db['MemberReport'][_0x2ea6('0xf4')](_0x490d71[_0x2ea6('0xc0')](_0x4cafed),{'individualHooks':!![]});}})[_0x2ea6('0x1e')](function(){if(_0x4a8576){return _0x4a8576[_0x2ea6('0x56')]({'online':!![],'lastLoginAt':moment()[_0x2ea6('0xa2')](_0x2ea6('0xef')),'voicePause':_0x4a8576[_0x2ea6('0x93')]||![],'mailPause':_0x4a8576[_0x2ea6('0x93')]||![],'chatPause':_0x4a8576[_0x2ea6('0x93')]||![],'faxPause':_0x4a8576[_0x2ea6('0x93')]||![],'smsPause':_0x4a8576[_0x2ea6('0x93')]||![],'openchannelPause':_0x4a8576['loginInPause']||![],'whatsappPause':_0x4a8576['loginInPause']||![],'pauseType':_0x4a8576[_0x2ea6('0x93')]?_0x2ea6('0xf3'):null,'interface':_0x2e90c1,'lastPauseAt':moment()[_0x2ea6('0xa2')](_0x2ea6('0xef'))});}})[_0x2ea6('0x1e')](function(_0x51b062){if(_0x397b29[_0x2ea6('0xf5')]){return _0x1cf186();}else{return Promise[_0x2ea6('0xf6')](_0x51b062)[_0x2ea6('0x1e')](respondWithResult(_0x5dad63,null));}})[_0x2ea6('0x4f')](handleError(_0x5dad63,null));};exports[_0x2ea6('0xf7')]=function(_0x5b3f60,_0x1931b1){var _0x2de1e2;return db[_0x2ea6('0x2f')][_0x2ea6('0x28')]({'where':{'id':_0x5b3f60[_0x2ea6('0x5a')]['id'],'role':_0x2ea6('0x1c')},'attributes':['id',_0x2ea6('0x29'),_0x2ea6('0x1b')]})[_0x2ea6('0x1e')](handleEntityNotFound(_0x1931b1,null))['then'](function(_0x337f42){if(_0x337f42){_0x2de1e2=_0x337f42;return db[_0x2ea6('0xa4')]['destroy']({'where':{'membername':_0x2de1e2[_0x2ea6('0x29')]},'individualHooks':!![]});}})[_0x2ea6('0x1e')](function(){return db[_0x2ea6('0xed')][_0x2ea6('0x46')]({'where':{'membername':_0x2de1e2[_0x2ea6('0x29')],'exitAt':null}});})['then'](function(_0x1b68b9){var _0x2b8b03=[];_0x1b68b9[_0x2ea6('0xee')](function(_0x53c8fa){_0x2b8b03[_0x2ea6('0x45')](_0x53c8fa[_0x2ea6('0x56')]({'exitAt':moment()[_0x2ea6('0xa2')](_0x2ea6('0xef'))}));});return Promise[_0x2ea6('0x55')](_0x2b8b03);})['then'](function(){return _0x2de1e2['update']({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})['then'](respondWithResult(_0x1931b1,null))[_0x2ea6('0x4f')](handleError(_0x1931b1,null));};exports[_0x2ea6('0xf8')]=function(_0x345dd0,_0xff14fb){var _0xd70113;return db[_0x2ea6('0xa4')][_0x2ea6('0x56')]({'paused':0x1},{'where':{'UserId':_0x345dd0[_0x2ea6('0x5a')]['id']},'individualHooks':!![]})[_0x2ea6('0x1e')](function(){return db[_0x2ea6('0x2f')][_0x2ea6('0x28')]({'where':{'id':_0x345dd0['params']['id'],'role':'agent'},'attributes':['id',_0x2ea6('0x29'),_0x2ea6('0x1b'),_0x2ea6('0x5d'),_0x2ea6('0x95'),_0x2ea6('0x92')]});})['then'](handleEntityNotFound(_0xff14fb,null))['then'](function(_0x45b757){if(_0x45b757){_0xd70113=_0x45b757;return db[_0x2ea6('0xed')]['findAll']({'where':{'membername':_0xd70113[_0x2ea6('0x29')],'type':_0x2ea6('0xf2'),'exitAt':null}});}})['then'](function(_0x478b00){if(_0x478b00[_0x2ea6('0x48')]){var _0x44c5fa=moment()[_0x2ea6('0xa2')](_0x2ea6('0xef'));for(var _0x21bee7=0x0,_0x3c5268=_0x478b00[_0x2ea6('0x48')];_0x21bee7<_0x3c5268;_0x21bee7++){_0x478b00[_0x21bee7][_0x2ea6('0xf9')]({'exitAt':_0x44c5fa});}}})['then'](function(){var _0x265d16=[];var _0x50b2d0=utils['getChannels']();_0x50b2d0[_0x2ea6('0xee')](function(_0x1d64db){_0x265d16[_0x2ea6('0x45')]({'channel':_0x1d64db,'membername':_0xd70113[_0x2ea6('0x29')],'interface':_['isNil'](_0xd70113[_0x2ea6('0x95')])?util[_0x2ea6('0xa2')](_0x2ea6('0xa3'),_0xd70113[_0x2ea6('0x29')]):_0xd70113[_0x2ea6('0x95')],'type':'PAUSE','enterAt':moment()[_0x2ea6('0xa2')](_0x2ea6('0xef')),'data1':_0x345dd0[_0x2ea6('0x57')][_0x2ea6('0x32')]||_0x2ea6('0xfa'),'role':_0xd70113['role'],'internal':_0xd70113['internal']});});return db[_0x2ea6('0xed')][_0x2ea6('0xf4')](_0x265d16,{'individualHooks':!![]});})['then'](function(){return _0xd70113[_0x2ea6('0x56')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0x345dd0['body'][_0x2ea6('0x32')]||_0x2ea6('0xfa'),'lastPauseAt':moment()[_0x2ea6('0xa2')](_0x2ea6('0xef'))});})[_0x2ea6('0x1e')](respondWithResult(_0xff14fb,null))['catch'](handleError(_0xff14fb,null));};exports['unpause']=function(_0x4b461a,_0x232ac3){if(_0x4b461a['body']['channel']&&!utils[_0x2ea6('0xa6')](_0x4b461a[_0x2ea6('0x57')][_0x2ea6('0x91')])){throw new APIBadRequestError(util[_0x2ea6('0xa2')](_0x2ea6('0xfb'),_0x4b461a[_0x2ea6('0x57')][_0x2ea6('0x91')]));}return db['User'][_0x2ea6('0x28')]({'where':{'id':_0x4b461a[_0x2ea6('0x5a')]['id']},'attributes':['id','name',_0x2ea6('0x1b'),_0x2ea6('0x5d'),_0x2ea6('0x95'),_0x2ea6('0x92'),_0x2ea6('0x94'),_0x2ea6('0xfc'),_0x2ea6('0xfd'),_0x2ea6('0xfe'),'openchannelPause',_0x2ea6('0xff'),_0x2ea6('0x100'),'pauseType',_0x2ea6('0x101')]})[_0x2ea6('0x1e')](function(_0x137312){if(!_0x137312){throw new APINotFoundError(util['format']('User\x20with\x20id\x20%s\x20not\x20found',_0x4b461a[_0x2ea6('0x5a')]['id']));}return _0x137312[_0x2ea6('0x102')](_0x4b461a['body'][_0x2ea6('0x91')]);})[_0x2ea6('0x1e')](respondWithResult(_0x232ac3,null))[_0x2ea6('0x4f')](APIHandleError(_0x232ac3));};exports[_0x2ea6('0x103')]=function(_0x897c62,_0x1b7dad){var _0xbeb5cf={};var _0x390569={};var _0x34d7a0;var _0x30b0c2;return db[_0x2ea6('0x2f')][_0x2ea6('0x8c')]({'where':{'id':_0x897c62['params']['id']}})[_0x2ea6('0x1e')](handleEntityNotFound(_0x1b7dad,null))[_0x2ea6('0x1e')](function(_0x4204b2){if(_0x4204b2){_0x34d7a0=_0x4204b2;_0x390569[_0x2ea6('0xca')]=_[_0x2ea6('0xc6')](db[_0x2ea6('0x104')][_0x2ea6('0x30')]);_0x390569[_0x2ea6('0x3f')]=_['keys'](_0x897c62[_0x2ea6('0x3f')]);_0x390569[_0x2ea6('0xc8')]=_[_0x2ea6('0xc9')](_0x390569[_0x2ea6('0xca')],_0x390569[_0x2ea6('0x3f')]);_0xbeb5cf[_0x2ea6('0x44')]=_['intersection'](_0x390569[_0x2ea6('0xca')],qs[_0x2ea6('0xcb')](_0x897c62['query'][_0x2ea6('0xcb')]));_0xbeb5cf[_0x2ea6('0x44')]=_0xbeb5cf[_0x2ea6('0x44')][_0x2ea6('0x48')]?_0xbeb5cf['attributes']:_0x390569[_0x2ea6('0xca')];_0xbeb5cf[_0x2ea6('0xcc')]=qs[_0x2ea6('0xcd')](_0x897c62[_0x2ea6('0x3f')][_0x2ea6('0xcd')]);_0xbeb5cf[_0x2ea6('0x3d')]=qs[_0x2ea6('0xc8')](_[_0x2ea6('0xd1')](_0x897c62[_0x2ea6('0x3f')],_0x390569['filters']));if(_0x897c62[_0x2ea6('0x3f')][_0x2ea6('0x34')]){_0xbeb5cf[_0x2ea6('0x3d')]=_['merge'](_0xbeb5cf[_0x2ea6('0x3d')],{'$or':_[_0x2ea6('0x26')](_0xbeb5cf['attributes'],function(_0x5528fd){var _0xf4170={};_0xf4170[_0x5528fd]={'$like':'%'+_0x897c62[_0x2ea6('0x3f')][_0x2ea6('0x34')]+'%'};return _0xf4170;})});}_0xbeb5cf=_[_0x2ea6('0x51')]({},_0xbeb5cf,_0x897c62['options']);return _0x34d7a0[_0x2ea6('0x103')](_0xbeb5cf);}})['then'](function(_0x3d9f89){if(_0x3d9f89){_0x30b0c2=_0x3d9f89[_0x2ea6('0x48')];if(!_0x897c62['query'][_0x2ea6('0xd2')]('nolimit')){_0xbeb5cf[_0x2ea6('0xcf')]=qs['limit'](_0x897c62[_0x2ea6('0x3f')][_0x2ea6('0xcf')]);_0xbeb5cf[_0x2ea6('0x18')]=qs['offset'](_0x897c62[_0x2ea6('0x3f')][_0x2ea6('0x18')]);}return _0x34d7a0[_0x2ea6('0x103')](_0xbeb5cf);}})[_0x2ea6('0x1e')](function(_0x3bac32){if(_0x3bac32){return _0x3bac32?{'count':_0x30b0c2,'rows':_0x3bac32}:null;}})['then'](respondWithResult(_0x1b7dad,null))[_0x2ea6('0x4f')](handleError(_0x1b7dad,null));};exports[_0x2ea6('0x105')]=function(_0x103949,_0x25a182){var _0x13d165=_0x103949[_0x2ea6('0x5a')]['id'];var _0x42b0ec=_0x103949[_0x2ea6('0x57')]?_0x103949[_0x2ea6('0x57')][_0x2ea6('0x5b')]:null;var _0x27a76d=[];return Promise[_0x2ea6('0xf6')]()['then'](function(){if(!_0x42b0ec)throw new APIBadRequestError(_0x2ea6('0x106'));})[_0x2ea6('0x1e')](function(){return db[_0x2ea6('0x2f')][_0x2ea6('0x8c')]({'where':{'id':_0x13d165}});})[_0x2ea6('0x1e')](function(_0x20cd90){if(!_0x20cd90)throw new APINotFoundError(util['format'](_0x2ea6('0x107'),_0x103949[_0x2ea6('0x5a')]['id']));return db[_0x2ea6('0x64')][_0x2ea6('0x108')](function(_0xcde378){return _0x20cd90[_0x2ea6('0x105')](_0x42b0ec,{'transaction':_0xcde378})[_0x2ea6('0x1e')](function(){return db[_0x2ea6('0x104')][_0x2ea6('0x46')]({'where':{'id':{'$in':_0x42b0ec}}});})[_0x2ea6('0x1e')](function(_0x57dac5){var _0x5c0a05=_[_0x2ea6('0x26')](_0x57dac5,function(_0x2d248f){return _0x2d248f[_0x2ea6('0x109')]();});return Promise['all'](_0x5c0a05);})[_0x2ea6('0x1e')](function(_0x1efb69){_0x27a76d=_[_0x2ea6('0x10a')](_0x1efb69);var _0x27d48f=_[_0x2ea6('0x26')](_0x27a76d,function(_0x46456b){return _0x46456b[_0x2ea6('0x10b')](_0x20cd90['id'],{'transaction':_0xcde378});});return Promise['all'](_0x27d48f);})[_0x2ea6('0x1e')](function(){if(!_0x20cd90['online'])return;var _0x329c66=_[_0x2ea6('0x34')](_0x27a76d,function(_0x48108d){return _0x48108d[_0x2ea6('0x10c')](_0x2ea6('0x91'))===_0x2ea6('0x10d');});var _0x20bc9c=_['map'](_0x329c66,function(_0x3eddeb){return db[_0x2ea6('0xa4')][_0x2ea6('0xa5')]({'membername':_0x20cd90[_0x2ea6('0x29')],'UserId':_0x20cd90['id'],'queue_name':_0x3eddeb[_0x2ea6('0x29')],'VoiceQueueId':_0x3eddeb['id'],'interface':_['isNil'](_0x20cd90[_0x2ea6('0x95')])?util['format'](_0x2ea6('0xa3'),_0x20cd90[_0x2ea6('0x29')]):_0x20cd90[_0x2ea6('0x95')],'paused':_0x20cd90[_0x2ea6('0x94')]||![],'penalty':_0x20cd90[_0x2ea6('0x9a')]},{'transaction':_0xcde378});});return Promise['all'](_0x20bc9c);})[_0x2ea6('0x1e')](function(){return db[_0x2ea6('0x10e')][_0x2ea6('0x46')]({'where':{'teamId':{'$in':_0x42b0ec}}});})[_0x2ea6('0x1e')](function(_0x3e3fff){var _0xbcc541=_['map'](_0x3e3fff,function(_0x18841d){return db['UserVoicePrefix'][_0x2ea6('0x75')]({'UserId':_0x20cd90['id'],'VoicePrefixId':_0x18841d[_0x2ea6('0x10f')]},{'transaction':_0xcde378});});return Promise[_0x2ea6('0x55')](_0xbcc541);});});})[_0x2ea6('0x1e')](function(){for(var _0x169606=0x0;_0x169606<_0x27a76d[_0x2ea6('0x48')];_0x169606++){var _0x5ee496=_0x27a76d[_0x169606]['getDataValue'](_0x2ea6('0x91'));var _0x57af8d=_0x5ee496+_0x2ea6('0x9c');socket[_0x2ea6('0x9d')]('user'+_0x5ee496+'Queue:save',{'UserId':_0x13d165,['queueField']:_0x27a76d[_0x169606]['id']});}})[_0x2ea6('0x1e')](respondWithStatusCode(_0x25a182,null))['catch'](APIHandleError(_0x25a182));};exports[_0x2ea6('0x110')]=function(_0x2579c5,_0x2d70e4){var _0xb665e7=_0x2579c5['params']['id'];var _0x432f37=null;if(_0x2579c5[_0x2ea6('0x3f')][_0x2ea6('0x5b')]){_0x432f37=_[_0x2ea6('0xa9')](_0x2579c5[_0x2ea6('0x3f')]['ids'])?_0x2579c5[_0x2ea6('0x3f')][_0x2ea6('0x5b')]:[_0x2579c5[_0x2ea6('0x3f')][_0x2ea6('0x5b')]];}var _0x315e74=[];return Promise[_0x2ea6('0xf6')]()[_0x2ea6('0x1e')](function(){if(!_0x432f37)throw new APIBadRequestError(_0x2ea6('0x111'));})['then'](function(){return db[_0x2ea6('0x2f')][_0x2ea6('0x8c')]({'where':{'id':_0xb665e7}});})[_0x2ea6('0x1e')](function(_0x3b6718){if(!_0x3b6718)throw new APINotFoundError(util[_0x2ea6('0xa2')]('User\x20with\x20id\x20%s\x20not\x20found',_0x2579c5[_0x2ea6('0x5a')]['id']));return db[_0x2ea6('0x64')][_0x2ea6('0x108')](function(_0x509858){return _0x3b6718[_0x2ea6('0x110')](_0x432f37,{'transaction':_0x509858})[_0x2ea6('0x1e')](function(){return db['Team']['findAll']({'where':{'id':{'$in':_0x432f37}}});})[_0x2ea6('0x1e')](function(_0x52ea29){var _0x403257=_[_0x2ea6('0x26')](_0x52ea29,function(_0x3da04d){return _0x3da04d[_0x2ea6('0x109')]();});return Promise[_0x2ea6('0x55')](_0x403257);})['then'](function(_0x3d0f5d){_0x315e74=_['flattenDeep'](_0x3d0f5d);var _0x569ffa=_[_0x2ea6('0x26')](_0x315e74,function(_0x318e3d){return _0x318e3d[_0x2ea6('0x112')](_0x3b6718['id'],{'transaction':_0x509858});});return Promise['all'](_0x569ffa);})['then'](function(){if(!_0x3b6718['online'])return;var _0x4a3f7f=_['filter'](_0x315e74,function(_0x5e995b){return _0x5e995b[_0x2ea6('0x10c')](_0x2ea6('0x91'))===_0x2ea6('0x10d');});var _0x10570f=_[_0x2ea6('0x26')](_0x4a3f7f,function(_0x3b6ef){return db[_0x2ea6('0xa4')][_0x2ea6('0x1d')]({'where':{'VoiceQueueId':_0x3b6ef['id'],'UserId':_0x3b6718['id']},'transaction':_0x509858});});return Promise[_0x2ea6('0x55')](_0x10570f);})[_0x2ea6('0x1e')](function(){return db[_0x2ea6('0x10e')][_0x2ea6('0x46')]({'where':{'teamId':{'$in':_0x432f37}}});})['then'](function(_0x3eea91){var _0x3afc8c=_['map'](_0x3eea91,function(_0x26abd7){return db[_0x2ea6('0x113')][_0x2ea6('0x1d')]({'where':{'UserId':_0x3b6718['id'],'VoicePrefixId':_0x26abd7[_0x2ea6('0x10f')]}},{'transaction':_0x509858});});return Promise['all'](_0x3afc8c);});});})['then'](function(){for(var _0x31cc37=0x0;_0x31cc37<_0x315e74[_0x2ea6('0x48')];_0x31cc37++){var _0x5a16e5=_0x315e74[_0x31cc37][_0x2ea6('0x10c')](_0x2ea6('0x91'));var _0x37bcbf=_0x5a16e5+'QueueId';socket['emit'](_0x2ea6('0x21')+_0x5a16e5+_0x2ea6('0xaa'),{'UserId':_0xb665e7,['queueField']:_0x315e74[_0x31cc37]['id']});}})[_0x2ea6('0x1e')](respondWithStatusCode(_0x2d70e4,null))[_0x2ea6('0x4f')](APIHandleError(_0x2d70e4));};exports[_0x2ea6('0x114')]=function(_0x3a59b4,_0x122fd8){var _0x58cc70={};var _0xbb5680={};var _0x3beccf;var _0x53db1f;return db[_0x2ea6('0x2f')][_0x2ea6('0x8c')]({'where':{'id':_0x3a59b4[_0x2ea6('0x5a')]['id']}})[_0x2ea6('0x1e')](handleEntityNotFound(_0x122fd8,null))[_0x2ea6('0x1e')](function(_0x8471fc){if(_0x8471fc){_0x3beccf=_0x8471fc;_0xbb5680['model']=_[_0x2ea6('0xc6')](db[_0x2ea6('0x115')][_0x2ea6('0x30')]);_0xbb5680[_0x2ea6('0x3f')]=_[_0x2ea6('0xc6')](_0x3a59b4['query']);_0xbb5680[_0x2ea6('0xc8')]=_[_0x2ea6('0xc9')](_0xbb5680[_0x2ea6('0xca')],_0xbb5680['query']);_0x58cc70[_0x2ea6('0x44')]=_[_0x2ea6('0xc9')](_0xbb5680['model'],qs[_0x2ea6('0xcb')](_0x3a59b4[_0x2ea6('0x3f')]['fields']));_0x58cc70[_0x2ea6('0x44')]=_0x58cc70['attributes'][_0x2ea6('0x48')]?_0x58cc70['attributes']:_0xbb5680['model'];_0x58cc70[_0x2ea6('0xcc')]=qs[_0x2ea6('0xcd')](_0x3a59b4[_0x2ea6('0x3f')][_0x2ea6('0xcd')]);_0x58cc70['where']=qs[_0x2ea6('0xc8')](_[_0x2ea6('0xd1')](_0x3a59b4['query'],_0xbb5680[_0x2ea6('0xc8')]));if(_0x3a59b4['query']['filter']){_0x58cc70[_0x2ea6('0x3d')]=_['merge'](_0x58cc70[_0x2ea6('0x3d')],{'$or':_[_0x2ea6('0x26')](_0x58cc70[_0x2ea6('0x44')],function(_0x11c813){var _0x28027b={};_0x28027b[_0x11c813]={'$like':'%'+_0x3a59b4[_0x2ea6('0x3f')]['filter']+'%'};return _0x28027b;})});}_0x58cc70=_[_0x2ea6('0x51')]({},_0x58cc70,_0x3a59b4[_0x2ea6('0x52')]);return _0x3beccf[_0x2ea6('0x114')](_0x58cc70);}})['then'](function(_0x54b225){if(_0x54b225){_0x53db1f=_0x54b225[_0x2ea6('0x48')];if(!_0x3a59b4[_0x2ea6('0x3f')][_0x2ea6('0xd2')](_0x2ea6('0xce'))){_0x58cc70[_0x2ea6('0xcf')]=qs[_0x2ea6('0xcf')](_0x3a59b4[_0x2ea6('0x3f')]['limit']);_0x58cc70[_0x2ea6('0x18')]=qs[_0x2ea6('0x18')](_0x3a59b4[_0x2ea6('0x3f')][_0x2ea6('0x18')]);}return _0x3beccf[_0x2ea6('0x114')](_0x58cc70);}})[_0x2ea6('0x1e')](function(_0x22d57c){if(_0x22d57c){return _0x22d57c?{'count':_0x53db1f,'rows':_0x22d57c}:null;}})['then'](respondWithResult(_0x122fd8,null))['catch'](handleError(_0x122fd8,null));};exports[_0x2ea6('0x116')]=function(_0x4bb672,_0x24a16b){var _0xc4be83={};var _0x21d9b1={};var _0x2766fc;return db[_0x2ea6('0x2f')]['findOne']({'where':{'id':_0x4bb672['params']['id']}})[_0x2ea6('0x1e')](handleEntityNotFound(_0x24a16b,null))[_0x2ea6('0x1e')](function(_0x58e74c){if(_0x58e74c){_0x2766fc=_0x58e74c;_0x21d9b1[_0x2ea6('0xca')]=_[_0x2ea6('0xc6')](db[_0x2ea6('0x2f')][_0x2ea6('0x30')]);_0x21d9b1[_0x2ea6('0x3f')]=_['keys'](_0x4bb672[_0x2ea6('0x3f')]);_0x21d9b1[_0x2ea6('0xc8')]=_[_0x2ea6('0xc9')](_0x21d9b1[_0x2ea6('0xca')],_0x21d9b1[_0x2ea6('0x3f')]);_0xc4be83[_0x2ea6('0x44')]=_['intersection'](_0x21d9b1[_0x2ea6('0xca')],qs[_0x2ea6('0xcb')](_0x4bb672[_0x2ea6('0x3f')][_0x2ea6('0xcb')]));_0xc4be83[_0x2ea6('0x44')]=_0xc4be83[_0x2ea6('0x44')]['length']?_0xc4be83[_0x2ea6('0x44')]:_0x21d9b1[_0x2ea6('0xca')];_0xc4be83[_0x2ea6('0xcc')]=qs[_0x2ea6('0xcd')](_0x4bb672['query']['sort']);_0xc4be83[_0x2ea6('0x3d')]=qs[_0x2ea6('0xc8')](_[_0x2ea6('0xd1')](_0x4bb672[_0x2ea6('0x3f')],_0x21d9b1['filters']));if(_0x4bb672[_0x2ea6('0x3f')]['filter']){_0xc4be83[_0x2ea6('0x3d')]=_['merge'](_0xc4be83[_0x2ea6('0x3d')],{'$or':_[_0x2ea6('0x26')](_0xc4be83[_0x2ea6('0x44')],function(_0x3675bc){var _0x224939={};_0x224939[_0x3675bc]={'$like':'%'+_0x4bb672['query'][_0x2ea6('0x34')]+'%'};return _0x224939;})});}_0xc4be83[_0x2ea6('0xca')]=db[_0x2ea6('0x2f')];_0xc4be83['as']=_0x2ea6('0x22');_0xc4be83=_[_0x2ea6('0x51')]({},_0xc4be83,_0x4bb672[_0x2ea6('0x52')]);return _0x2766fc[_0x2ea6('0x117')]({'include':[_0xc4be83]});}})['then'](function(_0x69a76a){if(_0x69a76a){var _0x556b53={},_0x28de99=[];for(var _0x3f5d4b=0x0;_0x3f5d4b<_0x69a76a[_0x2ea6('0x48')];_0x3f5d4b+=0x1){for(var _0x489ca3=0x0,_0xc7fbbc;_0x489ca3<_0x69a76a[_0x3f5d4b][_0x2ea6('0x22')][_0x2ea6('0x48')];_0x489ca3+=0x1){_0xc7fbbc=_0x69a76a[_0x3f5d4b]['Agents'][_0x489ca3][_0x2ea6('0xa1')]({'plain':!![]});_0x556b53[_0xc7fbbc['id']]=_0xc7fbbc;}}_0x556b53=_[_0x2ea6('0x118')](_0x556b53);for(var _0x2f0752=qs[_0x2ea6('0x18')](_0x4bb672[_0x2ea6('0x3f')][_0x2ea6('0x18')]);_0x2f0752<_0x556b53[_0x2ea6('0x48')]&&_0x28de99['length']=_0x3727c6){_0x2f5486=_0x3727c6;_0x524005=0xc8;}else{_0x524005=0xce;}_0x43c3d1['status'](_0x524005);return _0x43c3d1[_0x9375('0x1b')](_0x9375('0x1c'),_0x4025a9+'-'+_0x2f5486+'/'+_0x3727c6)[_0x9375('0x16')](_0x78259a);}return null;};}function saveUpdates(_0x3f24b3){return function(_0x588172){if(_0x588172){return _0x588172[_0x9375('0x1d')](_0x3f24b3)[_0x9375('0x1e')](function(_0x388b00){if(_0x388b00[_0x9375('0x1f')]==='agent'){socket[_0x9375('0x20')](_0x9375('0x21')+_0x388b00['id'],_0x388b00);}return _0x388b00;});}return null;};}function removeEntity(_0x416f09){return function(_0x2f42a8){if(_0x2f42a8){return _0x2f42a8[_0x9375('0x22')]()[_0x9375('0x1e')](function(){var _0x1b7039=_0x2f42a8[_0x9375('0x23')]({'plain':!![]});if(_0x1b7039[_0x9375('0x1f')]===_0x9375('0x24'))return;var _0x547a41=[{'name':_0x9375('0x25'),'value':_0x9375('0x26'),'ignore':!![]},{'name':_0x9375('0x27'),'value':_0x9375('0x28'),'ignore':![]},{'name':_0x9375('0x29'),'value':'telephone','ignore':![]}];var _0x4ce37f=_(_0x547a41)['filter']('ignore')[_0x9375('0x2a')](_0x9375('0x2b'))['value']();if(_[_0x9375('0x2c')](_0x4ce37f,_0x1b7039[_0x9375('0x1f')])){return;}var _0x50fac3=_[_0x9375('0x2d')](_0x547a41,[_0x9375('0x2b'),_0x1b7039['role']])['name'];return db[_0x9375('0x2e')][_0x9375('0x22')]({'where':{'type':_0x50fac3,'resourceId':_0x1b7039['id']}})['then'](function(){return _0x2f42a8;});})[_0x9375('0x1e')](function(){_0x416f09['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x17d904){return function(_0x33bcb1){if(!_0x33bcb1){_0x17d904[_0x9375('0x14')](0x194);}return _0x33bcb1;};}function handleError(_0x4b196a,_0x45fe2d){_0x45fe2d=_0x45fe2d||0x1f4;return function(_0x3707f0){logger[_0x9375('0x2f')](_0x3707f0[_0x9375('0x30')]);if(_0x3707f0[_0x9375('0x31')]){delete _0x3707f0[_0x9375('0x31')];}_0x4b196a[_0x9375('0x32')](_0x45fe2d)[_0x9375('0x33')](_0x3707f0);};}function getUserAttributes(){return _(db[_0x9375('0x34')][_0x9375('0x35')])['map'](function(_0x2eff88){return{'name':_0x2eff88[_0x9375('0x36')],'type':_0x2eff88['type'][_0x9375('0x37')]};})[_0x9375('0x38')](function(_0x2978dc){return![_0x9375('0x39'),_0x9375('0x3a'),_0x9375('0x3b'),_0x9375('0x3c'),'resetPasswordExpires',_0x9375('0x3d')][_0x9375('0x2c')](_0x2978dc[_0x9375('0x31')]);})[_0x9375('0x2b')]();}exports[_0x9375('0x3e')]=function(_0x3912c3,_0x89853a){var _0x200222={},_0x7651e5={'count':0x0,'rows':[]};var _0x2ffaa1=getUserAttributes();_0x200222=qs['getOptions'](_0x2ffaa1,_0x3912c3);var _0x1e11a7={'where':_0x200222[_0x9375('0x3f')]};return db['User'][_0x9375('0x1a')](_0x1e11a7)[_0x9375('0x1e')](function(_0x1d0637){_0x7651e5[_0x9375('0x1a')]=_0x1d0637;if(_0x3912c3[_0x9375('0x40')][_0x9375('0x41')]){_0x200222[_0x9375('0x42')]=[{'all':!![]}];}if(_0x3912c3['query'][_0x9375('0x43')]===_0x9375('0x44')){_0x200222[_0x9375('0x42')]=[{'model':db[_0x9375('0x45')],'as':_0x9375('0x43')}];}if(!_[_0x9375('0x2c')](_0x200222['attributes'],'id')){_0x200222[_0x9375('0x46')]['push']('id');}return db[_0x9375('0x34')][_0x9375('0x47')](_0x200222);})[_0x9375('0x1e')](function(_0x4507d7){_0x7651e5[_0x9375('0x48')]=_0x4507d7;if(_0x3912c3[_0x9375('0x40')][_0x9375('0x49')]===_0x9375('0x44')){var _0x3818d9=[];for(var _0x27be82=0x0;_0x27be82<_0x7651e5[_0x9375('0x48')]['length'];_0x27be82++){_0x3818d9['push'](get_open_tabs(_0x9375('0x4a'),_0x7651e5[_0x9375('0x48')][_0x27be82][_0x9375('0x4b')]));_0x3818d9[_0x9375('0x4c')](get_open_tabs('sms',_0x7651e5[_0x9375('0x48')][_0x27be82][_0x9375('0x4b')]));_0x3818d9[_0x9375('0x4c')](get_open_tabs(_0x9375('0x4d'),_0x7651e5[_0x9375('0x48')][_0x27be82]['dataValues']));_0x3818d9['push'](get_open_tabs('mail',_0x7651e5[_0x9375('0x48')][_0x27be82][_0x9375('0x4b')]));_0x3818d9[_0x9375('0x4c')](get_open_tabs(_0x9375('0x4e'),_0x7651e5[_0x9375('0x48')][_0x27be82][_0x9375('0x4b')]));_0x3818d9[_0x9375('0x4c')](get_open_tabs(_0x9375('0x4f'),_0x7651e5[_0x9375('0x48')][_0x27be82]['dataValues']));}return Promise['all'](_0x3818d9)['then'](function(){return _0x7651e5;});}else{return _0x7651e5;}})['then'](respondWithFilteredResult(_0x89853a,_0x200222))[_0x9375('0x50')](handleError(_0x89853a,null));};exports['show']=function(_0x48a202,_0x3dbdc2){var _0x5aa280=getUserAttributes();_0x48a202[_0x9375('0x40')]['id']=_0x48a202[_0x9375('0x51')]['id'];var _0x29c129=qs[_0x9375('0x52')](_0x5aa280,_0x48a202);if(_0x48a202[_0x9375('0x40')][_0x9375('0x41')]){_0x29c129[_0x9375('0x42')]=[{'all':!![]}];}if(_0x48a202[_0x9375('0x40')][_0x9375('0x43')]==='true'){_0x29c129[_0x9375('0x42')]=[{'model':db['UserSetting'],'as':_0x9375('0x43')}];}_0x29c129=_[_0x9375('0x53')]({},_0x29c129,_0x48a202[_0x9375('0x54')]);if(!_[_0x9375('0x2c')](_0x29c129[_0x9375('0x46')],'id')){_0x29c129['attributes']['push']('id');}return db[_0x9375('0x34')][_0x9375('0x2d')](_0x29c129)[_0x9375('0x1e')](handleEntityNotFound(_0x3dbdc2,null))[_0x9375('0x1e')](function(_0x179d70){var _0x16ad7d=[];values=_0x179d70;if(_0x48a202[_0x9375('0x40')][_0x9375('0x49')]===_0x9375('0x44')){_0x16ad7d[_0x9375('0x4c')](get_open_tabs(_0x9375('0x4a'),_0x179d70[_0x9375('0x4b')]));_0x16ad7d['push'](get_open_tabs(_0x9375('0x55'),_0x179d70['dataValues']));_0x16ad7d[_0x9375('0x4c')](get_open_tabs('openchannel',_0x179d70['dataValues']));_0x16ad7d['push'](get_open_tabs(_0x9375('0x4f'),_0x179d70[_0x9375('0x4b')]));_0x16ad7d['push'](get_open_tabs('fax',_0x179d70['dataValues']));_0x16ad7d[_0x9375('0x4c')](get_open_tabs(_0x9375('0x56'),_0x179d70['dataValues']));return Promise[_0x9375('0x57')](_0x16ad7d);}else{return values;}})['then'](function(){return values;})[_0x9375('0x1e')](respondWithResult(_0x3dbdc2,null))['catch'](handleError(_0x3dbdc2,null));};exports[_0x9375('0x1d')]=function(_0x12c863,_0x1e3b0c){if(_0x12c863['body']['id']){delete _0x12c863[_0x9375('0x58')]['id'];}delete _0x12c863[_0x9375('0x58')][_0x9375('0x1f')];return db[_0x9375('0x34')][_0x9375('0x2d')]({'where':{'id':_0x12c863[_0x9375('0x51')]['id']}})[_0x9375('0x1e')](handleEntityNotFound(_0x1e3b0c,null))[_0x9375('0x1e')](saveUpdates(_0x12c863['body'],null))[_0x9375('0x1e')](respondWithResult(_0x1e3b0c,null))[_0x9375('0x50')](handleError(_0x1e3b0c,null));};exports['describe']=function(_0x5dcb20,_0x8b9251){return db[_0x9375('0x34')][_0x9375('0x59')]()[_0x9375('0x1e')](respondWithResult(_0x8b9251,null))['catch'](handleError(_0x8b9251,null));};exports[_0x9375('0x5a')]=function(_0x4966bf,_0x4fb92b){return db['User'][_0x9375('0x2d')]({'where':{'id':_0x4966bf[_0x9375('0x51')]['id']}})['then'](handleEntityNotFound(_0x4fb92b,null))[_0x9375('0x1e')](function(_0x4d50ce){if(_0x4d50ce){return _0x4d50ce[_0x9375('0x5a')](_0x4966bf['body'][_0x9375('0x5b')],_['omit'](_0x4966bf[_0x9375('0x58')],[_0x9375('0x5b'),'id'])||{});}})[_0x9375('0x1e')](respondWithResult(_0x4fb92b,null))[_0x9375('0x50')](handleError(_0x4fb92b,null));};function validateUser(_0x4a11fe){return new Promise(function(_0x4edc1b,_0x2ffaa0){if(_0x4a11fe[_0x9375('0x5c')])return _0x4edc1b(_0x4a11fe);return db['Setting'][_0x9375('0x5d')](0x1)['then'](function(_0x217553){if(_0x217553[_0x9375('0x5e')])authService[_0x9375('0x5f')](_0x4a11fe[_0x9375('0x39')]);db['User'][_0x9375('0x60')](_0x9375('0x5c'))['then'](function(_0x233c11){if(_[_0x9375('0x61')](_0x233c11)){_0x4a11fe[_0x9375('0x5c')]=_0x217553[_0x9375('0x62')]||0x1;return;}if(_[_0x9375('0x61')](_0x217553[_0x9375('0x62')])||_0x217553[_0x9375('0x62')]===_0x233c11){_0x4a11fe[_0x9375('0x5c')]=_0x233c11+0x1;return;}if(_0x217553[_0x9375('0x62')]>_0x233c11){_0x4a11fe[_0x9375('0x5c')]=_0x217553[_0x9375('0x62')];return;}return db[_0x9375('0x63')]['query'](_0x9375('0x64'),{'type':db[_0x9375('0x63')][_0x9375('0x65')][_0x9375('0x66')]})[_0x9375('0x1e')](function(_0x58e8a1){if(_0x58e8a1&&_0x58e8a1['length']){for(var _0x1a0b1a=0x0,_0x41611c=_0x58e8a1[_0x9375('0x67')];_0x1a0b1a<_0x41611c&&_[_0x9375('0x61')](_0x4a11fe[_0x9375('0x5c')]);_0x1a0b1a++){if(_0x217553['min_internal']<=_0x58e8a1[_0x1a0b1a][_0x9375('0x68')]){_0x4a11fe[_0x9375('0x5c')]=_0x58e8a1[_0x1a0b1a][_0x9375('0x68')];}else if(_0x217553['min_internal']>_0x58e8a1[_0x1a0b1a][_0x9375('0x68')]&&_0x217553[_0x9375('0x62')]<=_0x58e8a1[_0x1a0b1a]['to']){_0x4a11fe['internal']=_0x217553[_0x9375('0x62')];}}}if(_[_0x9375('0x61')](_0x4a11fe[_0x9375('0x5c')])){_0x4a11fe[_0x9375('0x5c')]=_0x233c11+0x1;}return _0x4edc1b(_0x4a11fe);});});})['catch'](function(_0x11acdd){_0x2ffaa0(_0x11acdd);});});}function updateUser(_0x1ae2b4){return new Promise(function(_0x9c4452,_0x2513bb){try{if(_0x1ae2b4[_0x9375('0x69')]){_0x1ae2b4[_0x9375('0x6a')]=_0x1ae2b4[_0x9375('0x5c')];_0x1ae2b4[_0x9375('0x6b')]={'mailbox':_0x1ae2b4[_0x9375('0x5c')],'password':_0x1ae2b4['password'],'fullname':_0x1ae2b4[_0x9375('0x6c')],'email':_0x1ae2b4[_0x9375('0x6d')]};}if(_0x1ae2b4[_0x9375('0x1f')]===_0x9375('0x28')){if(!_0x1ae2b4[_0x9375('0x6e')])_0x1ae2b4[_0x9375('0x6e')]=[_0x9375('0x6f'),'102','103',_0x9375('0x70'),_0x9375('0x71'),'104',_0x9375('0x72'),_0x9375('0x73'),_0x9375('0x74'),_0x9375('0x75'),_0x9375('0x76'),_0x9375('0x77'),_0x9375('0x78'),'114',_0x9375('0x79')];}_0x9c4452(_0x1ae2b4);}catch(_0x88c66e){_0x2513bb(_0x88c66e);}});}exports[_0x9375('0x7a')]=function(_0x2e1d80,_0x318ee5){if(_0x2e1d80[_0x9375('0x26')][_0x9375('0x1f')]===_0x9375('0x28'))throw new Error(_0x9375('0x7b'));if(_0x2e1d80[_0x9375('0x58')][_0x9375('0x1f')]===_0x9375('0x26')&&_0x2e1d80[_0x9375('0x26')][_0x9375('0x1f')]!=='admin'){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user');}if(_0x2e1d80[_0x9375('0x58')][_0x9375('0x1f')]===_0x9375('0x24')&&_0x2e1d80['user'][_0x9375('0x1f')]!==_0x9375('0x24')){throw new Error(_0x9375('0x7c'));}return licenseUtil['checkUserLimits']([_0x2e1d80[_0x9375('0x58')]])[_0x9375('0x1e')](function(){return validateUser(_0x2e1d80[_0x9375('0x58')]);})['then'](function(_0x5ae834){return updateUser(_0x5ae834)[_0x9375('0x1e')](function(_0x2bd5b4){if(_0x2bd5b4[_0x9375('0x1f')]===_0x9375('0x24')){_0x2bd5b4[_0x9375('0x7d')]=_0x2e1d80[_0x9375('0x26')]['settingsEnabled'];delete _0x2bd5b4[_0x9375('0x7e')];}return _0x2bd5b4;});})[_0x9375('0x1e')](function(_0xfab12e){return db[_0x9375('0x34')][_0x9375('0x7a')](_0xfab12e,{'include':[{'model':db[_0x9375('0x6b')],'as':_0x9375('0x6b')}]});})[_0x9375('0x1e')](function(_0x1a5c00){if(_0x2e1d80[_0x9375('0x58')][_0x9375('0x1f')]===_0x9375('0x26'))return _0x1a5c00;if(_0x2e1d80[_0x9375('0x26')][_0x9375('0x1f')]!=='user')return _0x1a5c00;return db[_0x9375('0x7f')][_0x9375('0x2d')]({'where':{'name':_0x1a5c00[_0x9375('0x1f')]===_0x9375('0x28')?_0x9375('0x27'):'Telephones','userProfileId':_0x2e1d80[_0x9375('0x26')][_0x9375('0x7e')]},'raw':!![]})[_0x9375('0x1e')](function(_0x1c7160){if(!_0x1c7160||_0x1c7160[_0x9375('0x80')]!=0x0)return _0x1a5c00;return db[_0x9375('0x2e')][_0x9375('0x7a')]({'name':_0x1a5c00['name'],'resourceId':_0x1a5c00['id'],'type':_0x1c7160[_0x9375('0x31')],'sectionId':_0x1c7160['id']},{})[_0x9375('0x1e')](function(){return _0x1a5c00;});})['catch'](function(_0x3165d8){logger[_0x9375('0x2f')](_0x9375('0x81'),_0x3165d8);throw _0x3165d8;});})[_0x9375('0x1e')](respondWithResult(_0x318ee5,0xc9))[_0x9375('0x50')](handleError(_0x318ee5,null));};exports[_0x9375('0x82')]=function(_0x117b44,_0x5d77cd){var _0x5f72ce=_0x117b44[_0x9375('0x58')];var _0x2e3eb0=[];if(_0x117b44[_0x9375('0x26')][_0x9375('0x1f')]===_0x9375('0x28'))throw new Error(_0x9375('0x7b'));if(_['some'](_0x5f72ce,[_0x9375('0x1f'),'user'])&&_0x117b44[_0x9375('0x26')][_0x9375('0x1f')]!=='admin'){throw new Error(_0x9375('0x83'));}if(_[_0x9375('0x84')](_0x5f72ce,[_0x9375('0x1f'),_0x9375('0x24')])&&_0x117b44[_0x9375('0x26')][_0x9375('0x1f')]!==_0x9375('0x24')){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20administrator');}return licenseUtil[_0x9375('0x85')](_0x5f72ce)[_0x9375('0x1e')](function(){return validateUser(_0x5f72ce[0x0]);})['then'](function(){for(var _0x33906c=0x1;_0x33906c<_0x5f72ce[_0x9375('0x67')];_0x33906c++){var _0x2a672a=_0x5f72ce[_0x33906c-0x1][_0x9375('0x5c')];if(!_0x5f72ce[_0x33906c][_0x9375('0x5c')])_0x5f72ce[_0x33906c][_0x9375('0x5c')]=_0x2a672a+0x1;_0x2e3eb0[_0x9375('0x4c')](validateUser(_0x5f72ce[_0x33906c]));}return Promise[_0x9375('0x57')](_0x2e3eb0);})[_0x9375('0x1e')](function(){_0x2e3eb0=[];for(var _0x5ecbec=0x0;_0x5ecbec<_0x5f72ce[_0x9375('0x67')];_0x5ecbec++){_0x2e3eb0[_0x9375('0x4c')](updateUser(_0x5f72ce[_0x5ecbec]));}return Promise['all'](_0x2e3eb0);})['then'](function(){_0x2e3eb0=_0x5f72ce['map'](function(_0x3dc64a){return db['User'][_0x9375('0x7a')](_0x3dc64a,{'include':[{'model':db['VoiceMail'],'as':_0x9375('0x6b')}]})[_0x9375('0x1e')](function(_0x343e95){_0x3dc64a['id']=_0x343e95['id'];return _0x3dc64a;});});return Promise[_0x9375('0x57')](_0x2e3eb0);})['then'](function(_0x22de99){if(_0x117b44[_0x9375('0x58')][_0x9375('0x1f')]==='user')return _0x22de99;if(_0x117b44[_0x9375('0x26')][_0x9375('0x1f')]!==_0x9375('0x26'))return _0x22de99;var _0x45ed90=_[_0x9375('0x84')](_0x22de99,function(_0x60e243){return _0x60e243[_0x9375('0x1f')]===_0x9375('0x28')||_0x60e243[_0x9375('0x1f')]===_0x9375('0x86');});if(!_0x45ed90)return _0x22de99;return db['UserProfileSection'][_0x9375('0x47')]({'where':{'name':{'$or':[_0x9375('0x27'),_0x9375('0x29')]},'userProfileId':_0x117b44[_0x9375('0x26')][_0x9375('0x7e')]},'raw':!![]})[_0x9375('0x1e')](function(_0x4293b2){if(_[_0x9375('0x87')](_0x4293b2)||!_[_0x9375('0x84')](_0x4293b2,[_0x9375('0x80'),0x0]))return _0x22de99;_0x2e3eb0=[];var _0x1dc5d3=_(_0x4293b2)[_0x9375('0x2a')](function(_0x2da69d){if(_0x2da69d['autoAssociation']===0x1)return;return _0x2da69d[_0x9375('0x31')]===_0x9375('0x27')?_0x9375('0x28'):_0x9375('0x86');})[_0x9375('0x88')]()['value']();for(var _0x4b1bde=0x0;_0x4b1bde<_0x22de99[_0x9375('0x67')];_0x4b1bde++){if(!_[_0x9375('0x2c')](_0x1dc5d3,_0x22de99[_0x4b1bde]['role']))return;var _0x4f53c4=_0x22de99[_0x4b1bde][_0x9375('0x1f')]===_0x9375('0x28')?_0x9375('0x27'):_0x9375('0x29');_0x2e3eb0[_0x9375('0x4c')](db[_0x9375('0x2e')][_0x9375('0x7a')]({'name':_0x22de99[_0x4b1bde]['name'],'resourceId':_0x22de99[_0x4b1bde]['id'],'type':_0x4f53c4,'sectionId':_['find'](_0x4293b2,[_0x9375('0x31'),_0x4f53c4])['id']},{}));}return Promise[_0x9375('0x57')](_0x2e3eb0);});})[_0x9375('0x1e')](respondWithResult(_0x5d77cd,0xc9))[_0x9375('0x50')](handleError(_0x5d77cd,null));};exports[_0x9375('0x89')]=function(_0x25a3eb,_0x4f42f3){if(_0x25a3eb[_0x9375('0x58')]['id']){delete _0x25a3eb[_0x9375('0x58')]['id'];}return db[_0x9375('0x34')][_0x9375('0x2d')]({'where':{'id':_0x25a3eb[_0x9375('0x51')]['id']}})[_0x9375('0x1e')](function(_0x35b8e5){if(!_0x35b8e5)return null;if(_0x35b8e5['id']===_0x25a3eb['user']['id']){if(!_0x25a3eb[_0x9375('0x58')][_0x9375('0x8a')]||!_0x25a3eb[_0x9375('0x58')][_0x9375('0x8b')]){throw new db[(_0x9375('0x8c'))][(_0x9375('0x8d'))]('Invalid\x20body\x20format.\x20Use\x20oldPassword\x20and\x20newPassword');}if(!_0x35b8e5[_0x9375('0x8e')](_0x25a3eb['body'][_0x9375('0x8a')])){throw new db['Sequelize'][(_0x9375('0x8d'))]('Wrong\x20credentials');}if(_0x25a3eb[_0x9375('0x58')][_0x9375('0x8a')]===_0x25a3eb[_0x9375('0x58')][_0x9375('0x8b')]){throw new db[(_0x9375('0x8c'))][(_0x9375('0x8d'))]('New\x20password\x20must\x20be\x20different\x20from\x20old\x20password');}}else if(_0x25a3eb[_0x9375('0x26')][_0x9375('0x1f')]==='admin'){if(!_0x25a3eb[_0x9375('0x58')][_0x9375('0x8b')]){throw new db['Sequelize'][(_0x9375('0x8d'))](_0x9375('0x8f'));}}else if(_0x25a3eb[_0x9375('0x26')][_0x9375('0x1f')]==='user'){if(!_0x25a3eb[_0x9375('0x58')][_0x9375('0x8b')]){throw new db[(_0x9375('0x8c'))][(_0x9375('0x8d'))](_0x9375('0x8f'));}if(_0x35b8e5['role']!=='agent'){throw new db['Sequelize']['ValidationError'](_0x9375('0x7b'));}}else{throw new db['Sequelize']['ValidationError'](_0x9375('0x7b'));}return _0x35b8e5;})[_0x9375('0x1e')](handleEntityNotFound(_0x4f42f3,null))[_0x9375('0x1e')](function(_0x1663b0){return db['Setting'][_0x9375('0x90')]({'attributes':['id','securePassword',_0x9375('0x91'),_0x9375('0x92')]})[_0x9375('0x1e')](function(_0x554b1c){if(_0x554b1c[_0x9375('0x5e')])authService[_0x9375('0x5f')](_0x25a3eb[_0x9375('0x58')][_0x9375('0x8b')]);if(!_0x554b1c[_0x9375('0x91')]||!_0x1663b0[_0x9375('0x3b')])return _0x1663b0;authService['validatePasswordHistory'](_0x25a3eb[_0x9375('0x58')][_0x9375('0x8b')],_0x1663b0[_0x9375('0x3b')],_0x554b1c['passwordHistoryLimit']);return _0x1663b0;})[_0x9375('0x1e')](saveUpdates({'password':_0x25a3eb[_0x9375('0x58')]['newPassword'],'passwordResetAt':_0x25a3eb[_0x9375('0x26')]['id']==_0x25a3eb['params']['id']?moment():null,'previousPasswords':authService[_0x9375('0x93')](_0x25a3eb[_0x9375('0x58')][_0x9375('0x8b')],_0x1663b0[_0x9375('0x3b')])},null));})[_0x9375('0x1e')](respondWithResult(_0x4f42f3,null))[_0x9375('0x50')](handleError(_0x4f42f3,null));};exports['addQueues']=function(_0x93bf42,_0x51fd18){var _0x29b991=_0x93bf42[_0x9375('0x58')][_0x9375('0x94')];return db[_0x9375('0x34')]['find']({'where':{'id':_0x93bf42[_0x9375('0x51')]['id']},'attributes':['id','name',_0x9375('0x1f'),_0x9375('0x95'),_0x9375('0x96'),_0x9375('0x97'),_0x9375('0x98')]})[_0x9375('0x1e')](handleEntityNotFound(_0x51fd18,null))[_0x9375('0x1e')](function(_0x44f94c){if(_0x44f94c){if(!utils[_0x9375('0x99')](_0x29b991)){throw new db[(_0x9375('0x8c'))][(_0x9375('0x8d'))](_0x9375('0x9a'));}return _0x44f94c[_0x9375('0x9b')+_[_0x9375('0x9c')](_0x29b991[_0x9375('0x9d')]())+_0x9375('0x9e')](_0x93bf42[_0x9375('0x58')]['ids'],{'penalty':_0x93bf42['body'][_0x9375('0x9f')]||0x0})[_0x9375('0xa0')](function(_0x34ec07){for(var _0x27c0b8=0x0;_0x27c0b8<_0x93bf42['body']['ids'][_0x9375('0x67')];_0x27c0b8+=0x1){var _0x329c47={'UserId':Number(_0x93bf42[_0x9375('0x51')]['id'])};_0x329c47[_[_0x9375('0x9c')](_0x29b991[_0x9375('0x9d')]())+'QueueId']=Number(_0x93bf42['body']['ids'][_0x27c0b8]);socket[_0x9375('0x20')](_0x9375('0x26')+_[_0x9375('0x9c')](_0x29b991[_0x9375('0x9d')]())+_0x9375('0xa1'),_0x329c47);}return _0x34ec07;})[_0x9375('0x1e')](function(){if(_0x29b991===_0x9375('0xa2')){return db[_0x9375('0xa3')]['findAll']({'where':{'id':_0x93bf42[_0x9375('0x58')][_0x9375('0x5b')]||[]},'raw':!![],'attributes':['id','name']});}})['then'](function(_0x28565c){var _0x2485df=_0x44f94c['get']({'plain':!![]});var _0xe7788a=[];if(_0x29b991==='voice'&&_0x2485df[_0x9375('0x1f')]===_0x9375('0x28')&&_0x2485df[_0x9375('0x95')]){for(let _0x26a8ab=0x0;_0x26a8ab<_0x28565c[_0x9375('0x67')];_0x26a8ab+=0x1){_0xe7788a['push']({'membername':_0x2485df[_0x9375('0x31')],'UserId':_0x2485df['id'],'queue_name':_0x28565c[_0x26a8ab][_0x9375('0x31')],'VoiceQueueId':_0x28565c[_0x26a8ab]['id'],'interface':_[_0x9375('0x61')](_0x2485df[_0x9375('0x98')])?util[_0x9375('0xa4')]('SIP/%s',_0x2485df[_0x9375('0x31')]):_0x2485df[_0x9375('0x98')],'paused':_0x2485df[_0x9375('0x97')]||![],'penalty':_0x93bf42[_0x9375('0x58')][_0x9375('0x9f')]||0x0});}return Promise[_0x9375('0x57')](_0xe7788a[_0x9375('0x2a')](function(_0xd035f0){return db[_0x9375('0xa5')][_0x9375('0xa6')](_0xd035f0);}));}return _0x44f94c;});}})[_0x9375('0x1e')](respondWithStatusCode(_0x51fd18,null))['catch'](handleError(_0x51fd18,null));};exports[_0x9375('0xa7')]=function(_0x143891,_0x2e2501){var _0x2b0a23,_0x162ed7;return db[_0x9375('0x34')][_0x9375('0x2d')]({'where':{'id':_0x143891['params']['id']},'attributes':['id',_0x9375('0x31'),'role']})[_0x9375('0x1e')](handleEntityNotFound(_0x2e2501,null))[_0x9375('0x1e')](function(_0xd0703e){if(_0xd0703e){_0x2b0a23=_0xd0703e;if(!_0x143891[_0x9375('0x40')][_0x9375('0x94')]||!utils[_0x9375('0x99')](_0x143891[_0x9375('0x40')]['channel'])){throw new db['Sequelize'][(_0x9375('0x8d'))](_0x9375('0x9a'));}return _0xd0703e[_0x9375('0xa8')+_[_0x9375('0x9c')](_0x143891[_0x9375('0x40')][_0x9375('0x94')][_0x9375('0x9d')]())+_0x9375('0x9e')](_0x143891[_0x9375('0x40')][_0x9375('0x5b')]);}})[_0x9375('0x1e')](function(_0x4a7aac){if(_[_0x9375('0xa9')](_0x143891['query'][_0x9375('0x5b')])){for(var _0x43333e=0x0;_0x43333e<_0x143891['query'][_0x9375('0x5b')][_0x9375('0x67')];_0x43333e+=0x1){_0x162ed7={'UserId':Number(_0x143891[_0x9375('0x51')]['id'])};_0x162ed7[_[_0x9375('0x9c')](_0x143891[_0x9375('0x40')][_0x9375('0x94')][_0x9375('0x9d')]())+_0x9375('0xaa')]=Number(_0x143891[_0x9375('0x40')][_0x9375('0x5b')][_0x43333e]);socket[_0x9375('0x20')](_0x9375('0x26')+_[_0x9375('0x9c')](_0x143891['query'][_0x9375('0x94')][_0x9375('0x9d')]())+_0x9375('0xab'),_0x162ed7);}}else{_0x162ed7={'UserId':Number(_0x143891[_0x9375('0x51')]['id'])};_0x162ed7[_[_0x9375('0x9c')](_0x143891[_0x9375('0x40')]['channel'][_0x9375('0x9d')]())+_0x9375('0xaa')]=Number(_0x143891[_0x9375('0x40')][_0x9375('0x5b')]);socket['emit'](_0x9375('0x26')+_[_0x9375('0x9c')](_0x143891[_0x9375('0x40')][_0x9375('0x94')][_0x9375('0x9d')]())+_0x9375('0xab'),_0x162ed7);}return _0x4a7aac;})[_0x9375('0x1e')](function(){if(_0x143891['query'][_0x9375('0x94')]==='voice'){return db[_0x9375('0xa5')]['destroy']({'where':{'UserId':_0x143891[_0x9375('0x51')]['id'],'VoiceQueueId':_0x143891[_0x9375('0x40')]['ids']},'individualHooks':!![]})[_0x9375('0x1e')](function(){return _0x2b0a23;});}return _0x2b0a23;})[_0x9375('0x1e')](respondWithStatusCode(_0x2e2501,null))['catch'](handleError(_0x2e2501,null));};exports[_0x9375('0xac')]=function(_0x19619a,_0x25dc99){_0x19619a[_0x9375('0x58')]['userpic']=_0x19619a[_0x9375('0xad')]['filename'];return db['User'][_0x9375('0x2d')]({'where':{'id':_0x19619a['params']['id']}})[_0x9375('0x1e')](handleEntityNotFound(_0x25dc99,null))[_0x9375('0x1e')](saveUpdates(_0x19619a[_0x9375('0x58')],null))[_0x9375('0x1e')](respondWithResult(_0x25dc99,null))['catch'](handleError(_0x25dc99,null));};exports[_0x9375('0xae')]=function(_0x5e153f,_0x265bac){var _0x5f45a3=path['join'](config[_0x9375('0xaf')],_0x9375('0xb0'));return db['User'][_0x9375('0x2d')]({'where':{'id':_0x5e153f[_0x9375('0x51')]['id']},'attributes':['id',_0x9375('0xb1')],'raw':!![]})[_0x9375('0x1e')](handleEntityNotFound(_0x265bac,null))[_0x9375('0x1e')](function(_0x2661ef){if(_0x2661ef){if(_['isNil'](_0x2661ef[_0x9375('0xb1')])){return _0x265bac[_0x9375('0xb2')](_0x5f45a3);}else{if(!fs[_0x9375('0xb3')](path['join'](config[_0x9375('0xaf')],'server/files/images/',_0x2661ef[_0x9375('0xb1')]))){return _0x265bac[_0x9375('0xb2')](_0x5f45a3);}return _0x265bac['download'](path[_0x9375('0xb4')](config[_0x9375('0xaf')],_0x9375('0xb5'),_0x2661ef[_0x9375('0xb1')]));}}})[_0x9375('0x50')](handleError(_0x265bac,null));};exports[_0x9375('0xb6')]=function(_0x5ef03c,_0x2fe4bb){return db[_0x9375('0x34')]['find']({'where':{'id':_0x5ef03c[_0x9375('0x51')]['id']},'attributes':['id']})[_0x9375('0x1e')](handleEntityNotFound(_0x2fe4bb,null))[_0x9375('0x1e')](function(_0x3334a1){var _0x20a576=[];values=_0x3334a1['dataValues'];_0x20a576[_0x9375('0x4c')](get_open_tabs('chat',_0x3334a1[_0x9375('0x4b')]));_0x20a576[_0x9375('0x4c')](get_open_tabs(_0x9375('0x55'),_0x3334a1['dataValues']));_0x20a576[_0x9375('0x4c')](get_open_tabs(_0x9375('0x4e'),_0x3334a1[_0x9375('0x4b')]));_0x20a576[_0x9375('0x4c')](get_open_tabs(_0x9375('0x4f'),_0x3334a1['dataValues']));_0x20a576['push'](get_open_tabs(_0x9375('0x4d'),_0x3334a1['dataValues']));_0x20a576[_0x9375('0x4c')](get_open_tabs(_0x9375('0x56'),_0x3334a1['dataValues']));return Promise['all'](_0x20a576);})[_0x9375('0x1e')](function(_0x44171b){if(_0x44171b){var _0x461dc1=_[_0x9375('0x2a')](values[_0x9375('0xb7')],function(_0x33b54c){return{'channel':'CHAT','id':_0x33b54c['id'],'createdAt':_0x33b54c[_0x9375('0xb8')]};});var _0xa7db2f=_[_0x9375('0x2a')](values[_0x9375('0xb9')],function(_0x126360){return{'channel':_0x9375('0xba'),'id':_0x126360['id'],'createdAt':_0x126360[_0x9375('0xb8')]};});var _0x41f744=_[_0x9375('0x2a')](values[_0x9375('0xbb')],function(_0x1e6f33){return{'channel':_0x9375('0xbc'),'id':_0x1e6f33['id'],'createdAt':_0x1e6f33['createdAt']};});var _0x15c045=_[_0x9375('0x2a')](values['MailOpenTabs'],function(_0x518ddf){return{'channel':'MAIL','id':_0x518ddf['id'],'createdAt':_0x518ddf[_0x9375('0xb8')]};});var _0x28aca1=_['map'](values[_0x9375('0xbd')],function(_0xa938bc){return{'channel':_0x9375('0xbe'),'id':_0xa938bc['id'],'createdAt':_0xa938bc[_0x9375('0xb8')]};});var _0x1cbe15=_['map'](values['WhatsappOpenTabs'],function(_0x41a57d){return{'channel':'WHATSAPP','id':_0x41a57d['id'],'createdAt':_0x41a57d[_0x9375('0xb8')]};});var _0x1a2f84=_['concat'](_0x461dc1,_0xa7db2f,_0x41f744,_0x15c045,_0x28aca1,_0x1cbe15);var _0x1b49df={'count':_0x1a2f84[_0x9375('0x67')],'rows':_0x1a2f84};return _0x1b49df;}else return null;})[_0x9375('0x1e')](respondWithResult(_0x2fe4bb,null))['catch'](handleError(_0x2fe4bb,null));};exports[_0x9375('0xbf')]=function(_0x31b8a7,_0x323ab2){var _0x44ff1b={};return db[_0x9375('0x34')][_0x9375('0x90')]({'where':{'id':_0x31b8a7[_0x9375('0x51')]['id']}})['then'](function(_0x3ebb61){if(!_0x3ebb61){throw new APINotFoundError(util[_0x9375('0xa4')]('User\x20with\x20id\x20%s\x20not\x20found',_0x31b8a7['params']['id']));}return contacts['describe']();})[_0x9375('0x1e')](function(_0x515b44){_0x31b8a7[_0x9375('0x40')][_0x9375('0x34')]=_0x31b8a7['params']['id'];_0x44ff1b=qs[_0x9375('0x52')](_0x515b44,_0x31b8a7);if(_0x31b8a7[_0x9375('0x40')][_0x9375('0xc0')](_0x9375('0x41'))){_0x44ff1b[_0x9375('0x42')]=[{'model':db['CmList'],'as':_0x9375('0xc1'),'required':![]},{'model':db[_0x9375('0xc2')],'as':_0x9375('0xc3'),'attributes':['id',_0x9375('0x31'),_0x9375('0xc4')],'where':_0x31b8a7['query']['tag']?{'id':_0x31b8a7['query']['tag']}:undefined,'required':_0x31b8a7['query'][_0x9375('0xc5')]?!![]:![]}];}return contacts[_0x9375('0x47')](_0x31b8a7[_0x9375('0x40')],_0x31b8a7[_0x9375('0x26')],_0x44ff1b,_0x515b44);})[_0x9375('0x1e')](respondWithFilteredResult(_0x323ab2,_0x44ff1b))[_0x9375('0x50')](APIHandleError(_0x323ab2));};exports[_0x9375('0xc6')]=function(_0x352e17,_0x14094f){var _0x3f67e3;var _0x2a72c8={};var _0x408f25;return db[_0x9375('0x34')][_0x9375('0x90')]({'where':{'id':_0x352e17[_0x9375('0x51')]['id']},'attributes':['id',_0x9375('0x31'),'role']})[_0x9375('0x1e')](handleEntityNotFound(_0x14094f,null))[_0x9375('0x1e')](function(_0x22be34){if(!utils['isValidChannel'](_0x352e17[_0x9375('0x40')][_0x9375('0x94')])){throw new db['Sequelize'][(_0x9375('0x8d'))](_0x9375('0x9a'));}_0x3f67e3=_0x22be34;var _0x55730a={};_0x55730a[_0x9375('0xc7')]=_[_0x9375('0xc8')](db[_[_0x9375('0x9c')](_0x352e17[_0x9375('0x40')]['channel'])+'Queue']['rawAttributes']);_0x55730a[_0x9375('0x40')]=_[_0x9375('0xc8')](_0x352e17[_0x9375('0x40')]);_0x55730a[_0x9375('0xc9')]=_[_0x9375('0xca')](_0x55730a[_0x9375('0xc7')],_0x55730a[_0x9375('0x40')]);_0x2a72c8[_0x9375('0x46')]=_[_0x9375('0xca')](_0x55730a[_0x9375('0xc7')],qs[_0x9375('0xcb')](_0x352e17[_0x9375('0x40')]['fields']));_0x2a72c8[_0x9375('0x46')]=_0x2a72c8['attributes']['length']?_0x2a72c8[_0x9375('0x46')]:_0x55730a[_0x9375('0xc7')];_0x2a72c8[_0x9375('0xcc')]=qs[_0x9375('0xcd')](_0x352e17[_0x9375('0x40')]['sort']);_0x2a72c8[_0x9375('0x3f')]=qs[_0x9375('0xc9')](_[_0x9375('0xce')](_0x352e17[_0x9375('0x40')],_0x55730a[_0x9375('0xc9')]));if(_0x352e17['query'][_0x9375('0x38')]){_0x2a72c8[_0x9375('0x3f')]=_[_0x9375('0x53')](_0x2a72c8[_0x9375('0x3f')],{'$or':_['map'](_0x2a72c8[_0x9375('0x46')],function(_0x2f7879){var _0x5ceaa4={};_0x5ceaa4[_0x2f7879]={'$like':'%'+_0x352e17[_0x9375('0x40')][_0x9375('0x38')]+'%'};return _0x5ceaa4;})});}_0x2a72c8=_[_0x9375('0x53')]({},_0x2a72c8,_0x352e17[_0x9375('0x54')]);switch(_0x3f67e3[_0x9375('0x1f')]){case _0x9375('0x24'):return db[_[_0x9375('0x9c')](_0x352e17['query'][_0x9375('0x94')])+_0x9375('0xcf')][_0x9375('0x47')](_0x2a72c8);case'user':case'agent':return _0x3f67e3['get'+_[_0x9375('0x9c')](_0x352e17[_0x9375('0x40')][_0x9375('0x94')])+_0x9375('0x9e')](_0x2a72c8);default:throw new db[(_0x9375('0x8c'))]['ValidationError'](_0x9375('0xd0'));}})['then'](function(_0x163be3){_0x408f25=_0x163be3[_0x9375('0x67')];if(!_0x352e17[_0x9375('0x40')][_0x9375('0xc0')]('nolimit')){_0x2a72c8[_0x9375('0x19')]=qs[_0x9375('0x19')](_0x352e17[_0x9375('0x40')][_0x9375('0x19')]);_0x2a72c8['offset']=qs['offset'](_0x352e17[_0x9375('0x40')]['offset']);}switch(_0x3f67e3[_0x9375('0x1f')]){case _0x9375('0x24'):return db[_[_0x9375('0x9c')](_0x352e17[_0x9375('0x40')][_0x9375('0x94')])+'Queue'][_0x9375('0x47')](_0x2a72c8);case _0x9375('0x26'):case _0x9375('0x28'):return _0x3f67e3['get'+_[_0x9375('0x9c')](_0x352e17[_0x9375('0x40')]['channel'])+'Queues'](_0x2a72c8);}})[_0x9375('0x1e')](function(_0x5cd44b){return{'count':_0x408f25,'rows':_0x5cd44b};})['then'](respondWithResult(_0x14094f,null))['catch'](handleError(_0x14094f,null));};exports['getVoiceQueuesRt']=function(_0x5041e5,_0x20f7ad){var _0x87ca45={};var _0x6e0502={};var _0x2f02a9;var _0x5eb9fe;return db[_0x9375('0x34')][_0x9375('0x90')]({'where':{'id':_0x5041e5['params']['id']}})[_0x9375('0x1e')](handleEntityNotFound(_0x20f7ad,null))['then'](function(_0x3d9cee){if(_0x3d9cee){_0x2f02a9=_0x3d9cee;_0x6e0502[_0x9375('0xc7')]=_['keys'](db['UserVoiceQueueRt'][_0x9375('0x35')]);_0x6e0502[_0x9375('0x40')]=_[_0x9375('0xc8')](_0x5041e5[_0x9375('0x40')]);_0x6e0502[_0x9375('0xc9')]=_[_0x9375('0xca')](_0x6e0502[_0x9375('0xc7')],_0x6e0502['query']);_0x87ca45['attributes']=_['intersection'](_0x6e0502['model'],qs[_0x9375('0xcb')](_0x5041e5[_0x9375('0x40')]['fields']));_0x87ca45[_0x9375('0x46')]=_0x87ca45[_0x9375('0x46')]['length']?_0x87ca45[_0x9375('0x46')]:_0x6e0502[_0x9375('0xc7')];_0x87ca45['order']=qs[_0x9375('0xcd')](_0x5041e5[_0x9375('0x40')][_0x9375('0xcd')]);_0x87ca45[_0x9375('0x3f')]=qs[_0x9375('0xc9')](_[_0x9375('0xce')](_0x5041e5[_0x9375('0x40')],_0x6e0502[_0x9375('0xc9')]));if(_0x5041e5['query'][_0x9375('0x38')]){_0x87ca45[_0x9375('0x3f')]=_[_0x9375('0x53')](_0x87ca45[_0x9375('0x3f')],{'$or':_[_0x9375('0x2a')](_0x87ca45['attributes'],function(_0x57ee23){var _0x3eb73c={};_0x3eb73c[_0x57ee23]={'$like':'%'+_0x5041e5['query'][_0x9375('0x38')]+'%'};return _0x3eb73c;})});}_0x87ca45=_[_0x9375('0x53')]({},_0x87ca45,_0x5041e5[_0x9375('0x54')]);return _0x2f02a9['getVoiceQueuesRt'](_0x87ca45);}})[_0x9375('0x1e')](function(_0x197602){if(_0x197602){_0x5eb9fe=_0x197602[_0x9375('0x67')];if(!_0x5041e5['query'][_0x9375('0xc0')](_0x9375('0xd1'))){_0x87ca45[_0x9375('0x19')]=qs['limit'](_0x5041e5[_0x9375('0x40')]['limit']);_0x87ca45[_0x9375('0x17')]=qs[_0x9375('0x17')](_0x5041e5[_0x9375('0x40')][_0x9375('0x17')]);}return _0x2f02a9[_0x9375('0xd2')](_0x87ca45);}})[_0x9375('0x1e')](function(_0xb8852b){if(_0xb8852b){return _0xb8852b?{'count':_0x5eb9fe,'rows':_0xb8852b}:null;}})[_0x9375('0x1e')](respondWithResult(_0x20f7ad,null))[_0x9375('0x50')](handleError(_0x20f7ad,null));};exports[_0x9375('0xd3')]=function(_0x14a550,_0x5deee5){var _0x48b366={};var _0x5af77a={};var _0x5372a7;var _0x5afb84;return db[_0x9375('0x34')]['findOne']({'where':{'id':_0x14a550['params']['id']}})[_0x9375('0x1e')](handleEntityNotFound(_0x5deee5,null))[_0x9375('0x1e')](function(_0x331022){if(_0x331022){_0x5372a7=_0x331022;_0x5af77a[_0x9375('0xc7')]=_[_0x9375('0xc8')](db[_0x9375('0xd4')][_0x9375('0x35')]);_0x5af77a['query']=_[_0x9375('0xc8')](_0x14a550[_0x9375('0x40')]);_0x5af77a[_0x9375('0xc9')]=_['intersection'](_0x5af77a[_0x9375('0xc7')],_0x5af77a[_0x9375('0x40')]);_0x48b366[_0x9375('0x46')]=_[_0x9375('0xca')](_0x5af77a[_0x9375('0xc7')],qs[_0x9375('0xcb')](_0x14a550['query'][_0x9375('0xcb')]));_0x48b366[_0x9375('0x46')]=_0x48b366['attributes'][_0x9375('0x67')]?_0x48b366['attributes']:_0x5af77a[_0x9375('0xc7')];_0x48b366[_0x9375('0xcc')]=qs['sort'](_0x14a550[_0x9375('0x40')]['sort']);_0x48b366[_0x9375('0x3f')]=qs[_0x9375('0xc9')](_['pick'](_0x14a550[_0x9375('0x40')],_0x5af77a['filters']));if(_0x14a550[_0x9375('0x40')][_0x9375('0x38')]){_0x48b366[_0x9375('0x3f')]=_[_0x9375('0x53')](_0x48b366[_0x9375('0x3f')],{'$or':_[_0x9375('0x2a')](_0x48b366['attributes'],function(_0x32719e){var _0x2bf457={};_0x2bf457[_0x32719e]={'$like':'%'+_0x14a550[_0x9375('0x40')][_0x9375('0x38')]+'%'};return _0x2bf457;})});}_0x48b366=_[_0x9375('0x53')]({},_0x48b366,_0x14a550[_0x9375('0x54')]);return _0x5372a7['getGroups'](_0x48b366);}})[_0x9375('0x1e')](function(_0x2b301e){if(_0x2b301e){_0x5afb84=_0x2b301e[_0x9375('0x67')];if(!_0x14a550[_0x9375('0x40')][_0x9375('0xc0')](_0x9375('0xd1'))){_0x48b366['limit']=qs[_0x9375('0x19')](_0x14a550[_0x9375('0x40')][_0x9375('0x19')]);_0x48b366['offset']=qs['offset'](_0x14a550[_0x9375('0x40')][_0x9375('0x17')]);}return _0x5372a7[_0x9375('0xd3')](_0x48b366);}})['then'](function(_0x248b40){if(_0x248b40){return _0x248b40?{'count':_0x5afb84,'rows':_0x248b40}:null;}})[_0x9375('0x1e')](respondWithResult(_0x5deee5,null))[_0x9375('0x50')](handleError(_0x5deee5,null));};exports[_0x9375('0xd5')]=function(_0x26574e,_0x330440){var _0x34cdcb={'raw':!![],'where':{}};var _0x211d13={};var _0xd2f7a7={'count':0x0,'rows':[]};return db[_0x9375('0x34')]['findOne']({'where':{'id':_0x26574e[_0x9375('0x51')]['id']}})[_0x9375('0x1e')](handleEntityNotFound(_0x330440,null))[_0x9375('0x1e')](function(_0x332bc9){if(_0x332bc9){_0x211d13[_0x9375('0xc7')]=_[_0x9375('0xc8')](db[_0x9375('0xd6')][_0x9375('0x35')]);_0x211d13[_0x9375('0x40')]=_[_0x9375('0xc8')](_0x26574e['query']);_0x211d13[_0x9375('0xc9')]=_[_0x9375('0xca')](_0x211d13[_0x9375('0xc7')],_0x211d13[_0x9375('0x40')]);_0x34cdcb[_0x9375('0x46')]=_[_0x9375('0xca')](_0x211d13[_0x9375('0xc7')],qs['fields'](_0x26574e['query']['fields']));_0x34cdcb[_0x9375('0x46')]=_0x34cdcb['attributes'][_0x9375('0x67')]?_0x34cdcb['attributes']:_0x211d13['model'];if(!_0x26574e[_0x9375('0x40')]['hasOwnProperty'](_0x9375('0xd1'))){_0x34cdcb[_0x9375('0x19')]=qs[_0x9375('0x19')](_0x26574e[_0x9375('0x40')][_0x9375('0x19')]);_0x34cdcb[_0x9375('0x17')]=qs['offset'](_0x26574e[_0x9375('0x40')]['offset']);}_0x34cdcb[_0x9375('0xcc')]=qs[_0x9375('0xcd')](_0x26574e[_0x9375('0x40')][_0x9375('0xcd')]);_0x34cdcb[_0x9375('0x3f')]=qs[_0x9375('0xc9')](_[_0x9375('0xce')](_0x26574e[_0x9375('0x40')],_0x211d13['filters']));_0x34cdcb[_0x9375('0x3f')]['UserId']=_0x332bc9['id'];if(_0x26574e[_0x9375('0x40')]['filter']){_0x34cdcb[_0x9375('0x3f')]=_[_0x9375('0x53')](_0x34cdcb[_0x9375('0x3f')],{'$or':_[_0x9375('0x2a')](_0x34cdcb[_0x9375('0x46')],function(_0x321a20){var _0x191246={};_0x191246[_0x321a20]={'$like':'%'+_0x26574e['query']['filter']+'%'};return _0x191246;})});}_0x34cdcb=_[_0x9375('0x53')]({},_0x34cdcb,_0x26574e['options']);return db[_0x9375('0xd6')][_0x9375('0x1a')]({'where':_0x34cdcb[_0x9375('0x3f')]})[_0x9375('0x1e')](function(_0x3bc7a4){_0xd2f7a7[_0x9375('0x1a')]=_0x3bc7a4;if(_0x26574e['query']['includeAll']){_0x34cdcb['include']=[{'all':!![]}];}return db['VoiceRecording'][_0x9375('0x47')](_0x34cdcb);})['then'](function(_0x2500f3){_0xd2f7a7[_0x9375('0x48')]=_0x2500f3;return _0xd2f7a7;});}})[_0x9375('0x1e')](respondWithFilteredResult(_0x330440,_0x34cdcb))[_0x9375('0x50')](handleError(_0x330440,null));};exports[_0x9375('0xd7')]=function(_0x431690,_0x5a6aae){var _0x52739b={'raw':!![],'where':{}};var _0x38db89={};var _0x27a6af={'count':0x0,'rows':[]};return db[_0x9375('0x34')][_0x9375('0x90')]({'where':{'id':_0x431690[_0x9375('0x51')]['id']}})[_0x9375('0x1e')](handleEntityNotFound(_0x5a6aae,null))[_0x9375('0x1e')](function(_0x2d5854){if(_0x2d5854){_0x38db89['model']=_[_0x9375('0xc8')](db['ScreenRecording'][_0x9375('0x35')]);_0x38db89[_0x9375('0x40')]=_['keys'](_0x431690[_0x9375('0x40')]);_0x38db89[_0x9375('0xc9')]=_[_0x9375('0xca')](_0x38db89['model'],_0x38db89['query']);_0x52739b['attributes']=_[_0x9375('0xca')](_0x38db89[_0x9375('0xc7')],qs[_0x9375('0xcb')](_0x431690[_0x9375('0x40')][_0x9375('0xcb')]));_0x52739b[_0x9375('0x46')]=_0x52739b[_0x9375('0x46')][_0x9375('0x67')]?_0x52739b['attributes']:_0x38db89[_0x9375('0xc7')];if(!_0x431690[_0x9375('0x40')][_0x9375('0xc0')]('nolimit')){_0x52739b['limit']=qs[_0x9375('0x19')](_0x431690[_0x9375('0x40')][_0x9375('0x19')]);_0x52739b[_0x9375('0x17')]=qs[_0x9375('0x17')](_0x431690[_0x9375('0x40')][_0x9375('0x17')]);}_0x52739b['order']=qs[_0x9375('0xcd')](_0x431690[_0x9375('0x40')][_0x9375('0xcd')]);_0x52739b[_0x9375('0x3f')]=qs[_0x9375('0xc9')](_[_0x9375('0xce')](_0x431690[_0x9375('0x40')],_0x38db89[_0x9375('0xc9')]));_0x52739b[_0x9375('0x3f')][_0x9375('0xd8')]=_0x2d5854['id'];if(_0x431690[_0x9375('0x40')]['filter']){_0x52739b[_0x9375('0x3f')]=_[_0x9375('0x53')](_0x52739b[_0x9375('0x3f')],{'$or':_[_0x9375('0x2a')](_0x52739b[_0x9375('0x46')],function(_0x2bda70){var _0x523750={};_0x523750[_0x2bda70]={'$like':'%'+_0x431690[_0x9375('0x40')][_0x9375('0x38')]+'%'};return _0x523750;})});}_0x52739b=_[_0x9375('0x53')]({},_0x52739b,_0x431690['options']);return db['ScreenRecording']['count']({'where':_0x52739b[_0x9375('0x3f')]})[_0x9375('0x1e')](function(_0x34f4d8){_0x27a6af[_0x9375('0x1a')]=_0x34f4d8;if(_0x431690['query']['includeAll']){_0x52739b[_0x9375('0x42')]=[{'all':!![]}];}return db[_0x9375('0xd9')][_0x9375('0x47')](_0x52739b);})[_0x9375('0x1e')](function(_0x261e29){_0x27a6af[_0x9375('0x48')]=_0x261e29;return _0x27a6af;});}})[_0x9375('0x1e')](respondWithFilteredResult(_0x5a6aae,_0x52739b))[_0x9375('0x50')](handleError(_0x5a6aae,null));};exports[_0x9375('0xda')]=function(_0x2bb7fe,_0x58fade){var _0x53786a={};var _0x2320e1={};var _0x29021d;var _0x170858;return db[_0x9375('0x34')][_0x9375('0x90')]({'where':{'id':_0x2bb7fe[_0x9375('0x51')]['id']}})['then'](handleEntityNotFound(_0x58fade,null))[_0x9375('0x1e')](function(_0x62f8ff){if(_0x62f8ff){_0x29021d=_0x62f8ff;_0x2320e1[_0x9375('0xc7')]=_['keys'](db[_0x9375('0xdb')][_0x9375('0x35')]);_0x2320e1[_0x9375('0x40')]=_[_0x9375('0xc8')](_0x2bb7fe[_0x9375('0x40')]);_0x2320e1['filters']=_[_0x9375('0xca')](_0x2320e1['model'],_0x2320e1['query']);_0x53786a[_0x9375('0x46')]=_[_0x9375('0xca')](_0x2320e1[_0x9375('0xc7')],qs[_0x9375('0xcb')](_0x2bb7fe[_0x9375('0x40')]['fields']));_0x53786a[_0x9375('0x46')]=_0x53786a[_0x9375('0x46')]['length']?_0x53786a[_0x9375('0x46')]:_0x2320e1[_0x9375('0xc7')];_0x53786a[_0x9375('0xcc')]=qs[_0x9375('0xcd')](_0x2bb7fe[_0x9375('0x40')][_0x9375('0xcd')]);_0x53786a[_0x9375('0x3f')]=qs[_0x9375('0xc9')](_[_0x9375('0xce')](_0x2bb7fe[_0x9375('0x40')],_0x2320e1[_0x9375('0xc9')]));if(_0x2bb7fe[_0x9375('0x40')]['filter']){_0x53786a[_0x9375('0x3f')]=_[_0x9375('0x53')](_0x53786a[_0x9375('0x3f')],{'$or':_['map'](_0x53786a[_0x9375('0x46')],function(_0x276f33){var _0x2ebddd={};_0x2ebddd[_0x276f33]={'$like':'%'+_0x2bb7fe[_0x9375('0x40')][_0x9375('0x38')]+'%'};return _0x2ebddd;})});}_0x53786a=_[_0x9375('0x53')]({},_0x53786a,_0x2bb7fe[_0x9375('0x54')]);return _0x29021d[_0x9375('0xda')](_0x53786a);}})['then'](function(_0xf9411a){if(_0xf9411a){_0x170858=_0xf9411a['length'];if(!_0x2bb7fe['query'][_0x9375('0xc0')]('nolimit')){_0x53786a[_0x9375('0x19')]=qs[_0x9375('0x19')](_0x2bb7fe[_0x9375('0x40')][_0x9375('0x19')]);_0x53786a['offset']=qs[_0x9375('0x17')](_0x2bb7fe['query']['offset']);}return _0x29021d[_0x9375('0xda')](_0x53786a);}})[_0x9375('0x1e')](function(_0x2a70b3){if(_0x2a70b3){return _0x2a70b3?{'count':_0x170858,'rows':_0x2a70b3}:null;}})[_0x9375('0x1e')](respondWithResult(_0x58fade,null))[_0x9375('0x50')](handleError(_0x58fade,null));};exports[_0x9375('0xdc')]=function(_0x2831ca,_0x5ea1b6){var _0x44e213={};var _0x35ad31={};var _0x23d106;var _0x2e91fb;return db[_0x9375('0x34')]['findOne']({'where':{'id':_0x2831ca['params']['id']}})['then'](handleEntityNotFound(_0x5ea1b6,null))[_0x9375('0x1e')](function(_0x3d75ad){if(_0x3d75ad){_0x23d106=_0x3d75ad;_0x35ad31[_0x9375('0xc7')]=_[_0x9375('0xc8')](db[_0x9375('0xdd')][_0x9375('0x35')]);_0x35ad31['query']=_[_0x9375('0xc8')](_0x2831ca[_0x9375('0x40')]);_0x35ad31[_0x9375('0xc9')]=_[_0x9375('0xca')](_0x35ad31[_0x9375('0xc7')],_0x35ad31[_0x9375('0x40')]);_0x44e213[_0x9375('0x46')]=_[_0x9375('0xca')](_0x35ad31[_0x9375('0xc7')],qs[_0x9375('0xcb')](_0x2831ca['query'][_0x9375('0xcb')]));_0x44e213['attributes']=_0x44e213[_0x9375('0x46')][_0x9375('0x67')]?_0x44e213['attributes']:_0x35ad31[_0x9375('0xc7')];_0x44e213[_0x9375('0xcc')]=qs['sort'](_0x2831ca[_0x9375('0x40')][_0x9375('0xcd')]);_0x44e213[_0x9375('0x3f')]=qs[_0x9375('0xc9')](_[_0x9375('0xce')](_0x2831ca[_0x9375('0x40')],_0x35ad31['filters']));if(_0x2831ca['query'][_0x9375('0x38')]){_0x44e213['where']=_[_0x9375('0x53')](_0x44e213[_0x9375('0x3f')],{'$or':_[_0x9375('0x2a')](_0x44e213[_0x9375('0x46')],function(_0x2a9534){var _0x1f9074={};_0x1f9074[_0x2a9534]={'$like':'%'+_0x2831ca[_0x9375('0x40')][_0x9375('0x38')]+'%'};return _0x1f9074;})});}_0x44e213=_['merge']({},_0x44e213,_0x2831ca[_0x9375('0x54')]);return _0x23d106['getOpenchannelInteractions'](_0x44e213);}})[_0x9375('0x1e')](function(_0x1504cb){if(_0x1504cb){_0x2e91fb=_0x1504cb[_0x9375('0x67')];if(!_0x2831ca['query'][_0x9375('0xc0')](_0x9375('0xd1'))){_0x44e213[_0x9375('0x19')]=qs[_0x9375('0x19')](_0x2831ca['query'][_0x9375('0x19')]);_0x44e213[_0x9375('0x17')]=qs[_0x9375('0x17')](_0x2831ca['query'][_0x9375('0x17')]);}return _0x23d106[_0x9375('0xdc')](_0x44e213);}})['then'](function(_0x56e6f5){if(_0x56e6f5){return _0x56e6f5?{'count':_0x2e91fb,'rows':_0x56e6f5}:null;}})['then'](respondWithResult(_0x5ea1b6,null))['catch'](handleError(_0x5ea1b6,null));};exports[_0x9375('0xde')]=function(_0x68e4c7,_0x546cde){var _0x483944={'raw':!![],'where':{}};var _0x3442cc={};var _0x2feab7={'count':0x0,'rows':[]};return db[_0x9375('0x34')][_0x9375('0x90')]({'where':{'id':_0x68e4c7[_0x9375('0x51')]['id']}})['then'](handleEntityNotFound(_0x546cde,null))['then'](function(_0x546352){if(_0x546352){_0x3442cc[_0x9375('0xc7')]=_[_0x9375('0xc8')](db[_0x9375('0xdf')][_0x9375('0x35')]);_0x3442cc[_0x9375('0x40')]=_[_0x9375('0xc8')](_0x68e4c7[_0x9375('0x40')]);_0x3442cc[_0x9375('0xc9')]=_[_0x9375('0xca')](_0x3442cc[_0x9375('0xc7')],_0x3442cc['query']);_0x483944[_0x9375('0x46')]=_[_0x9375('0xca')](_0x3442cc[_0x9375('0xc7')],qs[_0x9375('0xcb')](_0x68e4c7[_0x9375('0x40')]['fields']));_0x483944[_0x9375('0x46')]=_0x483944['attributes'][_0x9375('0x67')]?_0x483944[_0x9375('0x46')]:_0x3442cc[_0x9375('0xc7')];if(!_0x68e4c7[_0x9375('0x40')][_0x9375('0xc0')]('nolimit')){_0x483944[_0x9375('0x19')]=qs[_0x9375('0x19')](_0x68e4c7[_0x9375('0x40')][_0x9375('0x19')]);_0x483944['offset']=qs['offset'](_0x68e4c7[_0x9375('0x40')][_0x9375('0x17')]);}_0x483944[_0x9375('0xcc')]=qs['sort'](_0x68e4c7[_0x9375('0x40')]['sort']);_0x483944[_0x9375('0x3f')]=qs[_0x9375('0xc9')](_[_0x9375('0xce')](_0x68e4c7[_0x9375('0x40')],_0x3442cc[_0x9375('0xc9')]));_0x483944[_0x9375('0x3f')][_0x9375('0xd8')]=_0x546352['id'];if(_0x68e4c7[_0x9375('0x40')]['filter']){_0x483944[_0x9375('0x3f')]=_[_0x9375('0x53')](_0x483944[_0x9375('0x3f')],{'$or':_['map'](_0x483944[_0x9375('0x46')],function(_0x5aa6cb){var _0x541edd={};_0x541edd[_0x5aa6cb]={'$like':'%'+_0x68e4c7[_0x9375('0x40')][_0x9375('0x38')]+'%'};return _0x541edd;})});}_0x483944=_[_0x9375('0x53')]({},_0x483944,_0x68e4c7[_0x9375('0x54')]);return db[_0x9375('0xdf')][_0x9375('0x1a')]({'where':_0x483944[_0x9375('0x3f')]})[_0x9375('0x1e')](function(_0x192c9d){_0x2feab7['count']=_0x192c9d;if(_0x68e4c7[_0x9375('0x40')][_0x9375('0x41')]){_0x483944[_0x9375('0x42')]=[{'all':!![]}];}return db[_0x9375('0xdf')][_0x9375('0x47')](_0x483944);})[_0x9375('0x1e')](function(_0x4d2be0){_0x2feab7[_0x9375('0x48')]=_0x4d2be0;return _0x2feab7;});}})[_0x9375('0x1e')](respondWithFilteredResult(_0x546cde,_0x483944))[_0x9375('0x50')](handleError(_0x546cde,null));};exports['getSmsInteractions']=function(_0x1d62ba,_0x4b3844){var _0x211d31={};var _0x1b81d6={};var _0x24eb59;var _0x4be911;return db[_0x9375('0x34')][_0x9375('0x90')]({'where':{'id':_0x1d62ba[_0x9375('0x51')]['id']}})[_0x9375('0x1e')](handleEntityNotFound(_0x4b3844,null))['then'](function(_0x47d42e){if(_0x47d42e){_0x24eb59=_0x47d42e;_0x1b81d6[_0x9375('0xc7')]=_['keys'](db['SmsInteraction'][_0x9375('0x35')]);_0x1b81d6[_0x9375('0x40')]=_['keys'](_0x1d62ba[_0x9375('0x40')]);_0x1b81d6[_0x9375('0xc9')]=_['intersection'](_0x1b81d6[_0x9375('0xc7')],_0x1b81d6['query']);_0x211d31[_0x9375('0x46')]=_['intersection'](_0x1b81d6[_0x9375('0xc7')],qs[_0x9375('0xcb')](_0x1d62ba[_0x9375('0x40')][_0x9375('0xcb')]));_0x211d31[_0x9375('0x46')]=_0x211d31[_0x9375('0x46')]['length']?_0x211d31[_0x9375('0x46')]:_0x1b81d6[_0x9375('0xc7')];_0x211d31['order']=qs['sort'](_0x1d62ba[_0x9375('0x40')][_0x9375('0xcd')]);_0x211d31[_0x9375('0x3f')]=qs[_0x9375('0xc9')](_['pick'](_0x1d62ba[_0x9375('0x40')],_0x1b81d6[_0x9375('0xc9')]));if(_0x1d62ba[_0x9375('0x40')][_0x9375('0x38')]){_0x211d31[_0x9375('0x3f')]=_[_0x9375('0x53')](_0x211d31[_0x9375('0x3f')],{'$or':_[_0x9375('0x2a')](_0x211d31[_0x9375('0x46')],function(_0x5c3c68){var _0x5640ab={};_0x5640ab[_0x5c3c68]={'$like':'%'+_0x1d62ba[_0x9375('0x40')][_0x9375('0x38')]+'%'};return _0x5640ab;})});}_0x211d31=_[_0x9375('0x53')]({},_0x211d31,_0x1d62ba[_0x9375('0x54')]);return _0x24eb59['getSmsInteractions'](_0x211d31);}})[_0x9375('0x1e')](function(_0x39b028){if(_0x39b028){_0x4be911=_0x39b028[_0x9375('0x67')];if(!_0x1d62ba[_0x9375('0x40')][_0x9375('0xc0')](_0x9375('0xd1'))){_0x211d31[_0x9375('0x19')]=qs[_0x9375('0x19')](_0x1d62ba[_0x9375('0x40')][_0x9375('0x19')]);_0x211d31[_0x9375('0x17')]=qs['offset'](_0x1d62ba[_0x9375('0x40')][_0x9375('0x17')]);}return _0x24eb59[_0x9375('0xe0')](_0x211d31);}})['then'](function(_0x583052){if(_0x583052){return _0x583052?{'count':_0x4be911,'rows':_0x583052}:null;}})[_0x9375('0x1e')](respondWithResult(_0x4b3844,null))[_0x9375('0x50')](handleError(_0x4b3844,null));};exports[_0x9375('0xe1')]=function(_0x39c01d,_0x1ce83c){var _0x43f808={};var _0x2c8508={};var _0x177cd9;var _0x59c6b4;return db[_0x9375('0x34')]['findOne']({'where':{'id':_0x39c01d[_0x9375('0x51')]['id']}})[_0x9375('0x1e')](handleEntityNotFound(_0x1ce83c,null))[_0x9375('0x1e')](function(_0x224f1f){if(_0x224f1f){_0x177cd9=_0x224f1f;_0x2c8508[_0x9375('0xc7')]=_[_0x9375('0xc8')](db[_0x9375('0xe2')][_0x9375('0x35')]);_0x2c8508[_0x9375('0x40')]=_[_0x9375('0xc8')](_0x39c01d[_0x9375('0x40')]);_0x2c8508['filters']=_[_0x9375('0xca')](_0x2c8508[_0x9375('0xc7')],_0x2c8508[_0x9375('0x40')]);_0x43f808[_0x9375('0x46')]=_['intersection'](_0x2c8508[_0x9375('0xc7')],qs['fields'](_0x39c01d[_0x9375('0x40')][_0x9375('0xcb')]));_0x43f808[_0x9375('0x46')]=_0x43f808[_0x9375('0x46')][_0x9375('0x67')]?_0x43f808[_0x9375('0x46')]:_0x2c8508[_0x9375('0xc7')];_0x43f808[_0x9375('0xcc')]=qs['sort'](_0x39c01d['query']['sort']);_0x43f808[_0x9375('0x3f')]=qs['filters'](_['pick'](_0x39c01d[_0x9375('0x40')],_0x2c8508[_0x9375('0xc9')]));if(_0x39c01d['query'][_0x9375('0x38')]){_0x43f808['where']=_[_0x9375('0x53')](_0x43f808[_0x9375('0x3f')],{'$or':_[_0x9375('0x2a')](_0x43f808['attributes'],function(_0x5691c4){var _0x18fd75={};_0x18fd75[_0x5691c4]={'$like':'%'+_0x39c01d[_0x9375('0x40')][_0x9375('0x38')]+'%'};return _0x18fd75;})});}_0x43f808=_['merge']({},_0x43f808,_0x39c01d['options']);return _0x177cd9['getFaxInteractions'](_0x43f808);}})[_0x9375('0x1e')](function(_0x1df7ed){if(_0x1df7ed){_0x59c6b4=_0x1df7ed[_0x9375('0x67')];if(!_0x39c01d[_0x9375('0x40')][_0x9375('0xc0')](_0x9375('0xd1'))){_0x43f808[_0x9375('0x19')]=qs[_0x9375('0x19')](_0x39c01d[_0x9375('0x40')][_0x9375('0x19')]);_0x43f808[_0x9375('0x17')]=qs[_0x9375('0x17')](_0x39c01d[_0x9375('0x40')][_0x9375('0x17')]);}return _0x177cd9[_0x9375('0xe1')](_0x43f808);}})[_0x9375('0x1e')](function(_0x5ef811){if(_0x5ef811){return _0x5ef811?{'count':_0x59c6b4,'rows':_0x5ef811}:null;}})['then'](respondWithResult(_0x1ce83c,null))['catch'](handleError(_0x1ce83c,null));};exports[_0x9375('0xe3')]=function(_0x31350a,_0x318a3d){var _0x5d17d7={};var _0x41747d={};var _0x26135a;var _0x186870;return db[_0x9375('0x34')][_0x9375('0x90')]({'where':{'id':_0x31350a[_0x9375('0x51')]['id']}})[_0x9375('0x1e')](handleEntityNotFound(_0x318a3d,null))[_0x9375('0x1e')](function(_0x54a6d2){if(_0x54a6d2){_0x26135a=_0x54a6d2;_0x41747d['model']=_[_0x9375('0xc8')](db[_0x9375('0xe4')][_0x9375('0x35')]);_0x41747d['query']=_['keys'](_0x31350a[_0x9375('0x40')]);_0x41747d[_0x9375('0xc9')]=_[_0x9375('0xca')](_0x41747d[_0x9375('0xc7')],_0x41747d[_0x9375('0x40')]);_0x5d17d7[_0x9375('0x46')]=_[_0x9375('0xca')](_0x41747d[_0x9375('0xc7')],qs['fields'](_0x31350a[_0x9375('0x40')][_0x9375('0xcb')]));_0x5d17d7[_0x9375('0x46')]=_0x5d17d7['attributes'][_0x9375('0x67')]?_0x5d17d7[_0x9375('0x46')]:_0x41747d[_0x9375('0xc7')];_0x5d17d7[_0x9375('0xcc')]=qs[_0x9375('0xcd')](_0x31350a['query']['sort']);_0x5d17d7['where']=qs[_0x9375('0xc9')](_[_0x9375('0xce')](_0x31350a[_0x9375('0x40')],_0x41747d[_0x9375('0xc9')]));if(_0x31350a[_0x9375('0x40')][_0x9375('0x38')]){_0x5d17d7[_0x9375('0x3f')]=_[_0x9375('0x53')](_0x5d17d7['where'],{'$or':_[_0x9375('0x2a')](_0x5d17d7[_0x9375('0x46')],function(_0x443a01){var _0x27d61d={};_0x27d61d[_0x443a01]={'$like':'%'+_0x31350a[_0x9375('0x40')][_0x9375('0x38')]+'%'};return _0x27d61d;})});}_0x5d17d7=_[_0x9375('0x53')]({},_0x5d17d7,_0x31350a[_0x9375('0x54')]);return _0x26135a[_0x9375('0xe3')](_0x5d17d7);}})['then'](function(_0x1a60de){if(_0x1a60de){_0x186870=_0x1a60de[_0x9375('0x67')];if(!_0x31350a['query'][_0x9375('0xc0')](_0x9375('0xd1'))){_0x5d17d7['limit']=qs[_0x9375('0x19')](_0x31350a['query']['limit']);_0x5d17d7[_0x9375('0x17')]=qs[_0x9375('0x17')](_0x31350a[_0x9375('0x40')][_0x9375('0x17')]);}return _0x26135a['getWhatsappInteractions'](_0x5d17d7);}})['then'](function(_0x257ce0){if(_0x257ce0){return _0x257ce0?{'count':_0x186870,'rows':_0x257ce0}:null;}})[_0x9375('0x1e')](respondWithResult(_0x318a3d,null))[_0x9375('0x50')](handleError(_0x318a3d,null));};exports[_0x9375('0xe5')]=function(_0x557fc5,_0x316bfb,_0x450794){var _0x162b8a;var _0xb2dbae;var _0x4a8c9d;var _0x3191bc=!_['isNil'](_0x557fc5[_0x9375('0x51')]['id'])?_0x557fc5[_0x9375('0x51')]['id']:!_[_0x9375('0x61')](_0x557fc5[_0x9375('0x26')]['id'])?_0x557fc5['user']['id']:null;return db['User'][_0x9375('0x2d')]({'where':{'id':_0x3191bc,'role':{'$or':[_0x9375('0x24'),_0x9375('0x26'),_0x9375('0x28')]}},'attributes':['id',_0x9375('0x31'),_0x9375('0xe6'),_0x9375('0xe7'),_0x9375('0x1f'),_0x9375('0x5c'),_0x9375('0x96')]})['then'](function(_0x54531d){if(_0x54531d){if(_0x54531d[_0x9375('0x1f')]===_0x9375('0x28')){_0x162b8a=_0x54531d;if(_0x557fc5[_0x9375('0x58')][_0x9375('0x98')]){_0x4a8c9d=util[_0x9375('0xa4')](_0x9375('0xe8'),_0x162b8a[_0x557fc5[_0x9375('0x58')][_0x9375('0x98')]]);}else if(_0x557fc5[_0x9375('0x58')][_0x9375('0xe9')]){_0x4a8c9d=util[_0x9375('0xa4')](_0x9375('0xea'),_0x557fc5[_0x9375('0x58')][_0x9375('0xe9')]);}else{_0x4a8c9d=util[_0x9375('0xa4')](_0x9375('0xea'),_0x162b8a[_0x9375('0x31')]);}socket['to'](util[_0x9375('0xa4')]('user:%s',_0x162b8a[_0x9375('0x31')]))[_0x9375('0x20')](_0x9375('0xeb'),{'user':{'id':_0x162b8a['id'],'name':_0x162b8a[_0x9375('0x31')]},'ip':_0x557fc5[_0x9375('0xec')]['x-forwarded-for']||_0x557fc5[_0x9375('0xed')][_0x9375('0xee')]||_0x557fc5[_0x9375('0xef')]['remoteAddress']||_0x557fc5[_0x9375('0xed')]['socket'][_0x9375('0xee')]});return db[_0x9375('0xa5')]['destroy']({'where':{'membername':_0x162b8a['name']},'individualHooks':!![]});}}else{throw new db[(_0x9375('0x8c'))][(_0x9375('0x8d'))]('User\x20not\x20found\x20or\x20not\x20allowed\x20to\x20perform\x20login\x20method');}})[_0x9375('0x1e')](function(){if(_0x162b8a){return _0x162b8a['getVoiceQueues']({'raw':!![]});}})[_0x9375('0x1e')](function(_0x7fb87b){if(_0x162b8a){if(_0x7fb87b){_0xb2dbae=_0x7fb87b;if(_0xb2dbae['length']){var _0x5d0c39=_0xb2dbae[_0x9375('0x2a')](function(_0x4f737d){var _0x5d6dc={'membername':_0x162b8a[_0x9375('0x31')],'UserId':_0x162b8a['id'],'queue_name':_0x4f737d['name'],'VoiceQueueId':_0x4f737d['id'],'interface':_0x4a8c9d,'paused':_0x162b8a[_0x9375('0x96')]||![],'penalty':_0x4f737d['UserVoiceQueue.penalty']||0x0};return db[_0x9375('0xa5')][_0x9375('0xa6')](_0x5d6dc);});return Promise[_0x9375('0x57')](_0x5d0c39);}}}})[_0x9375('0x1e')](function(){if(_0x162b8a){return db[_0x9375('0xf0')][_0x9375('0x47')]({'where':{'membername':_0x162b8a[_0x9375('0x31')],'exitAt':null}});}})[_0x9375('0x1e')](function(_0x34338b){if(_0x162b8a){var _0xadecc4=[];_0x34338b['forEach'](function(_0x4c8580){_0xadecc4['push'](_0x4c8580[_0x9375('0x1d')]({'exitAt':moment()[_0x9375('0xa4')](_0x9375('0xf1'))}));});return Promise[_0x9375('0x57')](_0xadecc4);}})[_0x9375('0x1e')](function(){if(_0x162b8a){var _0x8547ea=[];var _0x131f49=[];var _0x136a4c=utils[_0x9375('0xf2')]();var _0x55f58a={'membername':_0x162b8a[_0x9375('0x31')],'interface':_0x4a8c9d,'enterAt':moment()['format'](_0x9375('0xf1')),'role':_0x162b8a[_0x9375('0x1f')],'internal':_0x162b8a[_0x9375('0x5c')]};_0x136a4c['forEach'](function(_0x5104ad){_0x8547ea['push'](_[_0x9375('0x53')]({'channel':_0x5104ad,'type':'LOGIN','data1':_0x557fc5['body'][_0x9375('0xf3')],'data2':_0x4a8c9d},_0x55f58a));if(_0x162b8a[_0x9375('0x96')]){_0x131f49[_0x9375('0x4c')](_[_0x9375('0x53')]({'channel':_0x5104ad,'type':_0x9375('0xf4'),'data1':'LOGININPAUSE'},_0x55f58a));}});return db[_0x9375('0xf0')][_0x9375('0x82')](_0x8547ea[_0x9375('0xf5')](_0x131f49),{'individualHooks':!![]});}})[_0x9375('0x1e')](function(){if(_0x162b8a){return _0x162b8a[_0x9375('0x1d')]({'online':!![],'lastLoginAt':moment()[_0x9375('0xa4')](_0x9375('0xf1')),'voicePause':_0x162b8a[_0x9375('0x96')]||![],'mailPause':_0x162b8a['loginInPause']||![],'chatPause':_0x162b8a[_0x9375('0x96')]||![],'faxPause':_0x162b8a[_0x9375('0x96')]||![],'smsPause':_0x162b8a['loginInPause']||![],'openchannelPause':_0x162b8a[_0x9375('0x96')]||![],'whatsappPause':_0x162b8a[_0x9375('0x96')]||![],'pauseType':_0x162b8a[_0x9375('0x96')]?_0x9375('0xf6'):null,'interface':_0x4a8c9d,'lastPauseAt':moment()[_0x9375('0xa4')](_0x9375('0xf1'))});}})[_0x9375('0x1e')](function(_0x4387b){if(_0x557fc5[_0x9375('0xf7')]){return _0x450794();}else{return Promise[_0x9375('0xf8')](_0x4387b)[_0x9375('0x1e')](respondWithResult(_0x316bfb,null));}})[_0x9375('0x50')](handleError(_0x316bfb,null));};exports['logout']=function(_0x28f9fe,_0xa086af){var _0x10d58b;return db[_0x9375('0x34')]['find']({'where':{'id':_0x28f9fe[_0x9375('0x51')]['id'],'role':_0x9375('0x28')},'attributes':['id',_0x9375('0x31'),'role']})['then'](handleEntityNotFound(_0xa086af,null))[_0x9375('0x1e')](function(_0x1c4a61){if(_0x1c4a61){_0x10d58b=_0x1c4a61;return db[_0x9375('0xa5')]['destroy']({'where':{'membername':_0x10d58b['name']},'individualHooks':!![]});}})['then'](function(){return db[_0x9375('0xf0')][_0x9375('0x47')]({'where':{'membername':_0x10d58b[_0x9375('0x31')],'exitAt':null}});})[_0x9375('0x1e')](function(_0xb1c05e){var _0x4fb1c1=[];_0xb1c05e[_0x9375('0xf9')](function(_0xe3a49e){_0x4fb1c1[_0x9375('0x4c')](_0xe3a49e[_0x9375('0x1d')]({'exitAt':moment()[_0x9375('0xa4')](_0x9375('0xf1'))}));});return Promise[_0x9375('0x57')](_0x4fb1c1);})[_0x9375('0x1e')](function(){return _0x10d58b['update']({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})[_0x9375('0x1e')](respondWithResult(_0xa086af,null))[_0x9375('0x50')](handleError(_0xa086af,null));};exports[_0x9375('0xfa')]=function(_0x4bc56a,_0x18c2a5){var _0x53bddc;return db[_0x9375('0xa5')][_0x9375('0x1d')]({'paused':0x1},{'where':{'UserId':_0x4bc56a[_0x9375('0x51')]['id']},'individualHooks':!![]})[_0x9375('0x1e')](function(){return db['User'][_0x9375('0x2d')]({'where':{'id':_0x4bc56a[_0x9375('0x51')]['id'],'role':_0x9375('0x28')},'attributes':['id','name',_0x9375('0x1f'),'internal',_0x9375('0x98'),_0x9375('0x95')]});})[_0x9375('0x1e')](handleEntityNotFound(_0x18c2a5,null))['then'](function(_0x3184ae){if(_0x3184ae){_0x53bddc=_0x3184ae;return db['MemberReport']['findAll']({'where':{'membername':_0x53bddc[_0x9375('0x31')],'type':_0x9375('0xf4'),'exitAt':null}});}})[_0x9375('0x1e')](function(_0x3ee69d){if(_0x3ee69d[_0x9375('0x67')]){var _0x276ff6=moment()[_0x9375('0xa4')](_0x9375('0xf1'));for(var _0x3d24d2=0x0,_0x5d73ac=_0x3ee69d[_0x9375('0x67')];_0x3d24d2<_0x5d73ac;_0x3d24d2++){_0x3ee69d[_0x3d24d2][_0x9375('0xfb')]({'exitAt':_0x276ff6});}}})[_0x9375('0x1e')](function(){var _0x47b270=[];var _0x1ae162=utils[_0x9375('0xf2')]();_0x1ae162['forEach'](function(_0x147ac5){_0x47b270[_0x9375('0x4c')]({'channel':_0x147ac5,'membername':_0x53bddc[_0x9375('0x31')],'interface':_[_0x9375('0x61')](_0x53bddc[_0x9375('0x98')])?util['format'](_0x9375('0xea'),_0x53bddc[_0x9375('0x31')]):_0x53bddc[_0x9375('0x98')],'type':_0x9375('0xf4'),'enterAt':moment()['format'](_0x9375('0xf1')),'data1':_0x4bc56a['body']['type']||'DEFAULT\x20PAUSE','role':_0x53bddc['role'],'internal':_0x53bddc['internal']});});return db[_0x9375('0xf0')][_0x9375('0x82')](_0x47b270,{'individualHooks':!![]});})[_0x9375('0x1e')](function(){return _0x53bddc[_0x9375('0x1d')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0x4bc56a['body']['type']||_0x9375('0xfc'),'lastPauseAt':moment()[_0x9375('0xa4')](_0x9375('0xf1'))});})['then'](respondWithResult(_0x18c2a5,null))['catch'](handleError(_0x18c2a5,null));};exports[_0x9375('0xfd')]=function(_0x491656,_0x32d9f4){if(_0x491656[_0x9375('0x58')][_0x9375('0x94')]&&!utils['isValidChannel'](_0x491656[_0x9375('0x58')][_0x9375('0x94')])){throw new APIBadRequestError(util[_0x9375('0xa4')](_0x9375('0xfe'),_0x491656[_0x9375('0x58')][_0x9375('0x94')]));}return db[_0x9375('0x34')][_0x9375('0x2d')]({'where':{'id':_0x491656[_0x9375('0x51')]['id']},'attributes':['id','name',_0x9375('0x1f'),_0x9375('0x5c'),'interface',_0x9375('0x95'),_0x9375('0x97'),'mailPause','chatPause',_0x9375('0xff'),_0x9375('0x100'),_0x9375('0x101'),'whatsappPause',_0x9375('0x102'),_0x9375('0x103')]})[_0x9375('0x1e')](function(_0x50ec58){if(!_0x50ec58){throw new APINotFoundError(util[_0x9375('0xa4')]('User\x20with\x20id\x20%s\x20not\x20found',_0x491656['params']['id']));}return _0x50ec58[_0x9375('0xfd')](_0x491656[_0x9375('0x58')]['channel']);})[_0x9375('0x1e')](respondWithResult(_0x32d9f4,null))['catch'](APIHandleError(_0x32d9f4));};exports[_0x9375('0x104')]=function(_0x34c8f7,_0x371668){var _0x8f28e1={};var _0x3f4762={};var _0x53d319;var _0x46984f;return db[_0x9375('0x34')][_0x9375('0x90')]({'where':{'id':_0x34c8f7[_0x9375('0x51')]['id']}})[_0x9375('0x1e')](handleEntityNotFound(_0x371668,null))[_0x9375('0x1e')](function(_0x39dc74){if(_0x39dc74){_0x53d319=_0x39dc74;_0x3f4762[_0x9375('0xc7')]=_['keys'](db['Team'][_0x9375('0x35')]);_0x3f4762[_0x9375('0x40')]=_['keys'](_0x34c8f7[_0x9375('0x40')]);_0x3f4762[_0x9375('0xc9')]=_[_0x9375('0xca')](_0x3f4762[_0x9375('0xc7')],_0x3f4762[_0x9375('0x40')]);_0x8f28e1[_0x9375('0x46')]=_[_0x9375('0xca')](_0x3f4762[_0x9375('0xc7')],qs[_0x9375('0xcb')](_0x34c8f7[_0x9375('0x40')]['fields']));_0x8f28e1['attributes']=_0x8f28e1['attributes'][_0x9375('0x67')]?_0x8f28e1[_0x9375('0x46')]:_0x3f4762[_0x9375('0xc7')];_0x8f28e1[_0x9375('0xcc')]=qs[_0x9375('0xcd')](_0x34c8f7[_0x9375('0x40')][_0x9375('0xcd')]);_0x8f28e1['where']=qs[_0x9375('0xc9')](_[_0x9375('0xce')](_0x34c8f7[_0x9375('0x40')],_0x3f4762[_0x9375('0xc9')]));if(_0x34c8f7[_0x9375('0x40')][_0x9375('0x38')]){_0x8f28e1[_0x9375('0x3f')]=_['merge'](_0x8f28e1[_0x9375('0x3f')],{'$or':_[_0x9375('0x2a')](_0x8f28e1[_0x9375('0x46')],function(_0x496a68){var _0x4399d4={};_0x4399d4[_0x496a68]={'$like':'%'+_0x34c8f7[_0x9375('0x40')][_0x9375('0x38')]+'%'};return _0x4399d4;})});}_0x8f28e1=_[_0x9375('0x53')]({},_0x8f28e1,_0x34c8f7['options']);return _0x53d319[_0x9375('0x104')](_0x8f28e1);}})['then'](function(_0x4ada9e){if(_0x4ada9e){_0x46984f=_0x4ada9e[_0x9375('0x67')];if(!_0x34c8f7[_0x9375('0x40')][_0x9375('0xc0')](_0x9375('0xd1'))){_0x8f28e1[_0x9375('0x19')]=qs[_0x9375('0x19')](_0x34c8f7['query'][_0x9375('0x19')]);_0x8f28e1[_0x9375('0x17')]=qs[_0x9375('0x17')](_0x34c8f7[_0x9375('0x40')][_0x9375('0x17')]);}return _0x53d319[_0x9375('0x104')](_0x8f28e1);}})[_0x9375('0x1e')](function(_0x2eaa9a){if(_0x2eaa9a){return _0x2eaa9a?{'count':_0x46984f,'rows':_0x2eaa9a}:null;}})[_0x9375('0x1e')](respondWithResult(_0x371668,null))[_0x9375('0x50')](handleError(_0x371668,null));};exports['addTeams']=function(_0x20031a,_0x4b9979){var _0x59f8e6=_0x20031a['params']['id'];var _0x4976bd=_0x20031a['body']?_0x20031a[_0x9375('0x58')][_0x9375('0x5b')]:null;var _0xb2c44=[];return Promise[_0x9375('0xf8')]()[_0x9375('0x1e')](function(){if(!_0x4976bd)throw new APIBadRequestError(_0x9375('0x105'));})['then'](function(){return db[_0x9375('0x34')][_0x9375('0x90')]({'where':{'id':_0x59f8e6}});})[_0x9375('0x1e')](function(_0x4c0744){if(!_0x4c0744)throw new APINotFoundError(util[_0x9375('0xa4')]('User\x20with\x20id\x20%s\x20not\x20found',_0x20031a['params']['id']));return db[_0x9375('0x63')][_0x9375('0x106')](function(_0x275141){return _0x4c0744['addTeams'](_0x4976bd,{'transaction':_0x275141})[_0x9375('0x1e')](function(){return db['Team'][_0x9375('0x47')]({'where':{'id':{'$in':_0x4976bd}}});})[_0x9375('0x1e')](function(_0x25a2db){var _0x37c775=_['map'](_0x25a2db,function(_0x44aa65){return _0x44aa65[_0x9375('0x107')]();});return Promise['all'](_0x37c775);})[_0x9375('0x1e')](function(_0x32df80){_0xb2c44=_[_0x9375('0x108')](_0x32df80);var _0x3bf035=_[_0x9375('0x2a')](_0xb2c44,function(_0xe594a){return _0xe594a[_0x9375('0x109')](_0x4c0744['id'],{'transaction':_0x275141});});return Promise['all'](_0x3bf035);})['then'](function(){if(!_0x4c0744['online'])return;var _0x30095e=_[_0x9375('0x38')](_0xb2c44,function(_0x9b7982){return _0x9b7982[_0x9375('0x10a')](_0x9375('0x94'))===_0x9375('0x10b');});var _0x45bc27=_[_0x9375('0x2a')](_0x30095e,function(_0x5415ea){return db['UserVoiceQueueRt'][_0x9375('0xa6')]({'membername':_0x4c0744[_0x9375('0x31')],'UserId':_0x4c0744['id'],'queue_name':_0x5415ea[_0x9375('0x31')],'VoiceQueueId':_0x5415ea['id'],'interface':_['isNil'](_0x4c0744['interface'])?util['format']('SIP/%s',_0x4c0744[_0x9375('0x31')]):_0x4c0744[_0x9375('0x98')],'paused':_0x4c0744['voicePause']||![],'penalty':_0x4c0744[_0x9375('0x9f')]},{'transaction':_0x275141});});return Promise[_0x9375('0x57')](_0x45bc27);})[_0x9375('0x1e')](function(){return db[_0x9375('0x10c')][_0x9375('0x47')]({'where':{'teamId':{'$in':_0x4976bd}}});})['then'](function(_0x92f689){var _0xd7f06=_[_0x9375('0x2a')](_0x92f689,function(_0x3e10d1){return db[_0x9375('0x10d')][_0x9375('0x7a')]({'UserId':_0x4c0744['id'],'VoicePrefixId':_0x3e10d1[_0x9375('0x10e')]},{'transaction':_0x275141});});return Promise[_0x9375('0x57')](_0xd7f06);});});})['then'](function(){for(var _0x20ef96=0x0;_0x20ef96<_0xb2c44['length'];_0x20ef96++){var _0xede6b0=_0xb2c44[_0x20ef96][_0x9375('0x10a')]('channel');var _0x5d0629=_0xede6b0+_0x9375('0xaa');socket['emit'](_0x9375('0x26')+_0xede6b0+_0x9375('0xa1'),{'UserId':_0x59f8e6,['queueField']:_0xb2c44[_0x20ef96]['id']});}})[_0x9375('0x1e')](respondWithStatusCode(_0x4b9979,null))['catch'](APIHandleError(_0x4b9979));};exports[_0x9375('0x10f')]=function(_0x12e1c3,_0x3f5ef2){var _0x5f50ca=_0x12e1c3[_0x9375('0x51')]['id'];var _0x5b3146=null;if(_0x12e1c3[_0x9375('0x40')]['ids']){_0x5b3146=_['isArray'](_0x12e1c3['query']['ids'])?_0x12e1c3['query'][_0x9375('0x5b')]:[_0x12e1c3[_0x9375('0x40')][_0x9375('0x5b')]];}var _0x563d83=[];return Promise[_0x9375('0xf8')]()[_0x9375('0x1e')](function(){if(!_0x5b3146)throw new APIBadRequestError(_0x9375('0x110'));})[_0x9375('0x1e')](function(){return db[_0x9375('0x34')][_0x9375('0x90')]({'where':{'id':_0x5f50ca}});})[_0x9375('0x1e')](function(_0xb2b10f){if(!_0xb2b10f)throw new APINotFoundError(util[_0x9375('0xa4')]('User\x20with\x20id\x20%s\x20not\x20found',_0x12e1c3[_0x9375('0x51')]['id']));return db[_0x9375('0x63')][_0x9375('0x106')](function(_0x1408f8){return _0xb2b10f[_0x9375('0x10f')](_0x5b3146,{'transaction':_0x1408f8})[_0x9375('0x1e')](function(){return db[_0x9375('0x111')][_0x9375('0x47')]({'where':{'id':{'$in':_0x5b3146}}});})['then'](function(_0x2c487e){var _0x8695dc=_[_0x9375('0x2a')](_0x2c487e,function(_0x2fde91){return _0x2fde91[_0x9375('0x107')]();});return Promise[_0x9375('0x57')](_0x8695dc);})['then'](function(_0x4810ef){_0x563d83=_[_0x9375('0x108')](_0x4810ef);var _0x4e07de=_[_0x9375('0x2a')](_0x563d83,function(_0x585dc3){return _0x585dc3['removeAgent'](_0xb2b10f['id'],{'transaction':_0x1408f8});});return Promise[_0x9375('0x57')](_0x4e07de);})[_0x9375('0x1e')](function(){if(!_0xb2b10f[_0x9375('0x95')])return;var _0x270c76=_['filter'](_0x563d83,function(_0x4ea6a4){return _0x4ea6a4[_0x9375('0x10a')](_0x9375('0x94'))===_0x9375('0x10b');});var _0xb4ddc6=_[_0x9375('0x2a')](_0x270c76,function(_0x4b27ce){return db[_0x9375('0xa5')][_0x9375('0x22')]({'where':{'VoiceQueueId':_0x4b27ce['id'],'UserId':_0xb2b10f['id']},'transaction':_0x1408f8});});return Promise[_0x9375('0x57')](_0xb4ddc6);})['then'](function(){return db[_0x9375('0x10c')][_0x9375('0x47')]({'where':{'teamId':{'$in':_0x5b3146}}});})[_0x9375('0x1e')](function(_0x4684e2){var _0x35df18=_['map'](_0x4684e2,function(_0x27f75f){return db[_0x9375('0x10d')]['destroy']({'where':{'UserId':_0xb2b10f['id'],'VoicePrefixId':_0x27f75f[_0x9375('0x10e')]}},{'transaction':_0x1408f8});});return Promise[_0x9375('0x57')](_0x35df18);});});})[_0x9375('0x1e')](function(){for(var _0x8692ef=0x0;_0x8692ef<_0x563d83['length'];_0x8692ef++){var _0x31856a=_0x563d83[_0x8692ef]['getDataValue'](_0x9375('0x94'));var _0x36e4ea=_0x31856a+_0x9375('0xaa');socket[_0x9375('0x20')]('user'+_0x31856a+_0x9375('0xab'),{'UserId':_0x5f50ca,['queueField']:_0x563d83[_0x8692ef]['id']});}})[_0x9375('0x1e')](respondWithStatusCode(_0x3f5ef2,null))[_0x9375('0x50')](APIHandleError(_0x3f5ef2));};exports['getLists']=function(_0x5daee3,_0x33f9d1){var _0xf178c9={};var _0x27f6fe={};var _0x4065e5;var _0x58a905;return db[_0x9375('0x34')][_0x9375('0x90')]({'where':{'id':_0x5daee3[_0x9375('0x51')]['id']}})[_0x9375('0x1e')](handleEntityNotFound(_0x33f9d1,null))[_0x9375('0x1e')](function(_0x261ead){if(_0x261ead){_0x4065e5=_0x261ead;_0x27f6fe[_0x9375('0xc7')]=_[_0x9375('0xc8')](db[_0x9375('0x112')]['rawAttributes']);_0x27f6fe[_0x9375('0x40')]=_[_0x9375('0xc8')](_0x5daee3[_0x9375('0x40')]);_0x27f6fe[_0x9375('0xc9')]=_['intersection'](_0x27f6fe[_0x9375('0xc7')],_0x27f6fe[_0x9375('0x40')]);_0xf178c9[_0x9375('0x46')]=_[_0x9375('0xca')](_0x27f6fe['model'],qs['fields'](_0x5daee3[_0x9375('0x40')][_0x9375('0xcb')]));_0xf178c9[_0x9375('0x46')]=_0xf178c9['attributes'][_0x9375('0x67')]?_0xf178c9[_0x9375('0x46')]:_0x27f6fe[_0x9375('0xc7')];_0xf178c9[_0x9375('0xcc')]=qs[_0x9375('0xcd')](_0x5daee3[_0x9375('0x40')]['sort']);_0xf178c9[_0x9375('0x3f')]=qs['filters'](_[_0x9375('0xce')](_0x5daee3['query'],_0x27f6fe[_0x9375('0xc9')]));if(_0x5daee3['query']['filter']){_0xf178c9[_0x9375('0x3f')]=_['merge'](_0xf178c9['where'],{'$or':_[_0x9375('0x2a')](_0xf178c9[_0x9375('0x46')],function(_0x31e9b9){var _0x462b29={};_0x462b29[_0x31e9b9]={'$like':'%'+_0x5daee3['query']['filter']+'%'};return _0x462b29;})});}_0xf178c9=_[_0x9375('0x53')]({},_0xf178c9,_0x5daee3['options']);return _0x4065e5[_0x9375('0x113')](_0xf178c9);}})['then'](function(_0x112b4a){if(_0x112b4a){_0x58a905=_0x112b4a[_0x9375('0x67')];if(!_0x5daee3[_0x9375('0x40')][_0x9375('0xc0')](_0x9375('0xd1'))){_0xf178c9[_0x9375('0x19')]=qs[_0x9375('0x19')](_0x5daee3[_0x9375('0x40')]['limit']);_0xf178c9[_0x9375('0x17')]=qs[_0x9375('0x17')](_0x5daee3[_0x9375('0x40')][_0x9375('0x17')]);}return _0x4065e5[_0x9375('0x113')](_0xf178c9);}})['then'](function(_0x551d5a){if(_0x551d5a){return _0x551d5a?{'count':_0x58a905,'rows':_0x551d5a}:null;}})[_0x9375('0x1e')](respondWithResult(_0x33f9d1,null))[_0x9375('0x50')](handleError(_0x33f9d1,null));};exports[_0x9375('0x114')]=function(_0x4535f1,_0x278979){var _0x5c6883={};var _0x598567={};var _0x3163ac;return db[_0x9375('0x34')]['findOne']({'where':{'id':_0x4535f1['params']['id']}})[_0x9375('0x1e')](handleEntityNotFound(_0x278979,null))[_0x9375('0x1e')](function(_0xd04765){if(_0xd04765){_0x3163ac=_0xd04765;_0x598567[_0x9375('0xc7')]=_['keys'](db[_0x9375('0x34')][_0x9375('0x35')]);_0x598567[_0x9375('0x40')]=_[_0x9375('0xc8')](_0x4535f1[_0x9375('0x40')]);_0x598567[_0x9375('0xc9')]=_['intersection'](_0x598567[_0x9375('0xc7')],_0x598567[_0x9375('0x40')]);_0x5c6883[_0x9375('0x46')]=_[_0x9375('0xca')](_0x598567[_0x9375('0xc7')],qs[_0x9375('0xcb')](_0x4535f1[_0x9375('0x40')][_0x9375('0xcb')]));_0x5c6883['attributes']=_0x5c6883[_0x9375('0x46')][_0x9375('0x67')]?_0x5c6883['attributes']:_0x598567['model'];_0x5c6883[_0x9375('0xcc')]=qs[_0x9375('0xcd')](_0x4535f1[_0x9375('0x40')][_0x9375('0xcd')]);_0x5c6883[_0x9375('0x3f')]=qs[_0x9375('0xc9')](_[_0x9375('0xce')](_0x4535f1[_0x9375('0x40')],_0x598567['filters']));if(_0x4535f1[_0x9375('0x40')]['filter']){_0x5c6883[_0x9375('0x3f')]=_['merge'](_0x5c6883[_0x9375('0x3f')],{'$or':_['map'](_0x5c6883[_0x9375('0x46')],function(_0x5d743d){var _0x4cc50d={};_0x4cc50d[_0x5d743d]={'$like':'%'+_0x4535f1[_0x9375('0x40')]['filter']+'%'};return _0x4cc50d;})});}_0x5c6883[_0x9375('0xc7')]=db['User'];_0x5c6883['as']=_0x9375('0x27');_0x5c6883=_['merge']({},_0x5c6883,_0x4535f1['options']);return _0x3163ac['getVoiceQueues']({'include':[_0x5c6883]});}})[_0x9375('0x1e')](function(_0x2b9f79){if(_0x2b9f79){var _0x2e2953={},_0x41fcff=[];for(var _0x486bff=0x0;_0x486bff<_0x2b9f79[_0x9375('0x67')];_0x486bff+=0x1){for(var _0x14e3d8=0x0,_0x5cc5e0;_0x14e3d8<_0x2b9f79[_0x486bff]['Agents'][_0x9375('0x67')];_0x14e3d8+=0x1){_0x5cc5e0=_0x2b9f79[_0x486bff][_0x9375('0x27')][_0x14e3d8]['get']({'plain':!![]});_0x2e2953[_0x5cc5e0['id']]=_0x5cc5e0;}}_0x2e2953=_[_0x9375('0x115')](_0x2e2953);for(var _0x4850e6=qs[_0x9375('0x17')](_0x4535f1[_0x9375('0x40')]['offset']);_0x4850e6<_0x2e2953[_0x9375('0x67')]&&_0x41fcff[_0x9375('0x67')]=_0x2d01e2['agents']){throw new Error(_0xfd72('0x53'));}})[_0xfd72('0x16')](function(){if(_0x323aaf){return db[_0xfd72('0x27')][_0xfd72('0x4a')]({'where':{'membername':_0x323aaf[_0xfd72('0x20')]},'individualHooks':!![]});}})[_0xfd72('0x16')](function(){if(_0x323aaf){return _0x323aaf[_0xfd72('0x54')]({'raw':!![]});}})[_0xfd72('0x16')](function(_0x5a720d){if(_0x323aaf){if(_0x5a720d){var _0x6793a9=[];_0x155839=_0x5a720d;if(_0x155839[_0xfd72('0x2b')]){for(var _0x2d96ce=0x0;_0x2d96ce<_0x155839['length'];_0x2d96ce++){_0x6793a9[_0xfd72('0x30')](db[_0xfd72('0x27')][_0xfd72('0x55')]({'membername':_0x323aaf[_0xfd72('0x20')],'UserId':_0x323aaf['id'],'queue_name':_0x155839[_0x2d96ce]['name'],'VoiceQueueId':_0x155839[_0x2d96ce]['id'],'interface':_0x98c89,'paused':_0x323aaf['loginInPause']||![],'penalty':_0x155839[_0x2d96ce][_0xfd72('0x56')]||0x0}));}return BPromise['all'](_0x6793a9);}}}})['then'](function(){if(_0x323aaf){return db[_0xfd72('0x29')][_0xfd72('0xf')]({'where':{'membername':_0x323aaf[_0xfd72('0x20')],'exitAt':null}});}})[_0xfd72('0x16')](function(_0x12695e){if(_0x323aaf){if(_0x12695e&&_0x12695e['length']){var _0x4a4716=[];_0x12695e['forEach'](function(_0x464503){_0x4a4716[_0xfd72('0x30')](_0x464503[_0xfd72('0x28')]({'exitAt':moment()[_0xfd72('0x24')](_0xfd72('0x2c'))}));});return BPromise['all'](_0x4a4716);}}})[_0xfd72('0x16')](function(){if(_0x323aaf){var _0x4cb180=[];var _0x13f2c0=[];var _0x5abd34=utils['getChannels']();var _0x40f686={'membername':_0x323aaf[_0xfd72('0x20')],'interface':_0x98c89,'enterAt':moment()[_0xfd72('0x24')](_0xfd72('0x2c')),'role':_0x323aaf[_0xfd72('0x21')],'internal':_0x323aaf['internal']};_0x5abd34[_0xfd72('0x2f')](function(_0x5071bb){_0x4cb180[_0xfd72('0x30')](_[_0xfd72('0x57')]({'channel':_0x5071bb,'type':_0xfd72('0x58'),'data1':_0xfd72('0x59'),'data2':_0x98c89},_0x40f686));if(_0x323aaf[_0xfd72('0x4d')]){_0x13f2c0[_0xfd72('0x30')](_['merge']({'channel':_0x5071bb,'type':_0xfd72('0x2a'),'data1':'LOGININPAUSE'},_0x40f686));}});return db[_0xfd72('0x29')][_0xfd72('0x36')](_0x4cb180['concat'](_0x13f2c0),{'individualHooks':!![]});}})[_0xfd72('0x16')](function(){if(_0x323aaf){return _0x323aaf[_0xfd72('0x28')]({'online':!![],'lastLoginAt':moment()[_0xfd72('0x24')](_0xfd72('0x2c')),'voicePause':_0x323aaf[_0xfd72('0x4d')]||![],'mailPause':_0x323aaf[_0xfd72('0x4d')]||![],'chatPause':_0x323aaf[_0xfd72('0x4d')]||![],'faxPause':_0x323aaf[_0xfd72('0x4d')]||![],'smsPause':_0x323aaf[_0xfd72('0x4d')]||![],'openchannelPause':_0x323aaf[_0xfd72('0x4d')]||![],'pauseType':_0x323aaf['loginInPause']?_0xfd72('0x5a'):null,'lastPauseAt':moment()[_0xfd72('0x24')]('YYYY-MM-DD\x20HH:mm:ss'),'interface':_0x98c89});}})['then'](function(_0x38beb5){_0x5c03b8(_0x38beb5);})[_0xfd72('0x1a')](function(_0x4d91c1){_0xb4d333(_0x2a389d[_0xfd72('0x1b')](0x1f4,_0x4d91c1[_0xfd72('0x1c')]));});});}; \ No newline at end of file +var _0x7b50=['count','agent','../../config/license/util','getLicense','agents','Maximum\x20login\x20has\x20been\x20reached','upsert','UserVoiceQueue.penalty','merge','LOGIN','PAUSE','LOGININPAUSE','concat','util','moment','bluebird','../../mysqldb','../../config/utils','rpc','../../config/environment','redis','defaults','localhost','socket.io-emitter','register','GetUser','User','findAll','options','raw','where','attributes','include','map','model','then','info','catch','error','ShowUser','debug','stringify','message','find','name','role','interface','params','update','MemberReport','length','YYYY-MM-DD\x20HH:mm:ss','updateAttributes','getChannels','forEach','push','format','SIP/%s','body','type','DEFAULT\x20PAUSE','resolve','channel','isValidChannel','Channel\x20parameter\x20%s\x20is\x20invalid','findOne','internal','online','voicePause','mailPause','chatPause','faxPause','openchannelPause','whatsappPause','lastPauseAt','User\x20with\x20id\x20%s\x20not\x20found','unpause','system','LogoutUser','UserVoiceQueueRt','destroy','all','LoginUser','phone','loginInPause'];(function(_0x4fdcc0,_0x560a01){var _0xc0ce94=function(_0x36ea12){while(--_0x36ea12){_0x4fdcc0['push'](_0x4fdcc0['shift']());}};_0xc0ce94(++_0x560a01);}(_0x7b50,0xb7));var _0x07b5=function(_0x31eac0,_0x1c98dc){_0x31eac0=_0x31eac0-0x0;var _0x228c22=_0x7b50[_0x31eac0];return _0x228c22;};'use strict';var _=require('lodash');var util=require(_0x07b5('0x0'));var moment=require(_0x07b5('0x1'));var BPromise=require(_0x07b5('0x2'));var Redis=require('ioredis');var db=require(_0x07b5('0x3'))['db'];var utils=require(_0x07b5('0x4'));var logger=require('../../config/logger')(_0x07b5('0x5'));var config=require(_0x07b5('0x6'));config[_0x07b5('0x7')]=_[_0x07b5('0x8')](config[_0x07b5('0x7')],{'host':_0x07b5('0x9'),'port':0x18eb});var socket=require(_0x07b5('0xa'))(new Redis(config['redis']));require('./user.socket')[_0x07b5('0xb')](socket);exports[_0x07b5('0xc')]=function(_0x1cde1a){var _0x3cec1c=this;return new Promise(function(_0x42adb1,_0x69f1c8){return db[_0x07b5('0xd')][_0x07b5('0xe')]({'raw':_0x1cde1a[_0x07b5('0xf')]?_0x1cde1a[_0x07b5('0xf')][_0x07b5('0x10')]===undefined?!![]:![]:!![],'where':_0x1cde1a[_0x07b5('0xf')]?_0x1cde1a[_0x07b5('0xf')][_0x07b5('0x11')]||null:null,'attributes':_0x1cde1a[_0x07b5('0xf')]?_0x1cde1a[_0x07b5('0xf')][_0x07b5('0x12')]||null:null,'limit':_0x1cde1a['options']?_0x1cde1a[_0x07b5('0xf')]['limit']||null:null,'include':_0x1cde1a['options']?_0x1cde1a[_0x07b5('0xf')][_0x07b5('0x13')]?_[_0x07b5('0x14')](_0x1cde1a['options'][_0x07b5('0x13')],function(_0xb34ce5){return{'model':db[_0xb34ce5['model']],'as':_0xb34ce5['as'],'attributes':_0xb34ce5[_0x07b5('0x12')],'include':_0xb34ce5[_0x07b5('0x13')]?_[_0x07b5('0x14')](_0xb34ce5[_0x07b5('0x13')],function(_0x35aed2){return{'model':db[_0x35aed2[_0x07b5('0x15')]],'as':_0x35aed2['as'],'attributes':_0x35aed2[_0x07b5('0x12')],'include':_0x35aed2['include']?_[_0x07b5('0x14')](_0x35aed2['include'],function(_0x26914e){return{'model':db[_0x26914e[_0x07b5('0x15')]],'as':_0x26914e['as'],'attributes':_0x26914e[_0x07b5('0x12')]};}):[]};}):[]};}):[]:[]})[_0x07b5('0x16')](function(_0x4cad0d){logger[_0x07b5('0x17')](_0x07b5('0xc'),_0x1cde1a);logger['debug'](_0x07b5('0xc'),_0x1cde1a,JSON['stringify'](_0x4cad0d));_0x42adb1(_0x4cad0d);})[_0x07b5('0x18')](function(_0x4273e5){logger['error'](_0x07b5('0xc'),_0x4273e5['message'],_0x1cde1a);_0x69f1c8(_0x3cec1c[_0x07b5('0x19')](0x1f4,_0x4273e5['message']));});});};exports[_0x07b5('0x1a')]=function(_0x445728){var _0x2eb86b=this;return new Promise(function(_0x36073b,_0x4ffb99){return db[_0x07b5('0xd')]['find']({'raw':_0x445728[_0x07b5('0xf')]?_0x445728[_0x07b5('0xf')][_0x07b5('0x10')]===undefined?!![]:![]:!![],'where':_0x445728[_0x07b5('0xf')]?_0x445728[_0x07b5('0xf')][_0x07b5('0x11')]||null:null,'attributes':_0x445728[_0x07b5('0xf')]?_0x445728['options'][_0x07b5('0x12')]||null:null,'include':_0x445728['options']?_0x445728[_0x07b5('0xf')]['include']?_[_0x07b5('0x14')](_0x445728[_0x07b5('0xf')]['include'],function(_0x5453c5){return{'model':db[_0x5453c5[_0x07b5('0x15')]],'as':_0x5453c5['as'],'attributes':_0x5453c5['attributes'],'include':_0x5453c5[_0x07b5('0x13')]?_[_0x07b5('0x14')](_0x5453c5[_0x07b5('0x13')],function(_0x54fa20){return{'model':db[_0x54fa20[_0x07b5('0x15')]],'as':_0x54fa20['as'],'attributes':_0x54fa20[_0x07b5('0x12')],'include':_0x54fa20[_0x07b5('0x13')]?_[_0x07b5('0x14')](_0x54fa20[_0x07b5('0x13')],function(_0x66c9fd){return{'model':db[_0x66c9fd[_0x07b5('0x15')]],'as':_0x66c9fd['as'],'attributes':_0x66c9fd['attributes']};}):[]};}):[]};}):[]:[]})[_0x07b5('0x16')](function(_0x662206){logger[_0x07b5('0x17')](_0x07b5('0x1a'),_0x445728);logger[_0x07b5('0x1b')]('ShowUser',_0x445728,JSON[_0x07b5('0x1c')](_0x662206));_0x36073b(_0x662206);})[_0x07b5('0x18')](function(_0x2d821e){logger['error'](_0x07b5('0x1a'),_0x2d821e[_0x07b5('0x1d')],_0x445728);_0x4ffb99(_0x2eb86b[_0x07b5('0x19')](0x1f4,_0x2d821e['message']));});});};exports['PauseUser']=function(_0x186c16){var _0x2aa0c3;return db[_0x07b5('0xd')][_0x07b5('0x1e')]({'where':_0x186c16['options']['where']||{},'attributes':['id',_0x07b5('0x1f'),_0x07b5('0x20'),'internal',_0x07b5('0x21')]})[_0x07b5('0x16')](function(_0x475798){if(!_0x475798){throw new Error(util['format']('User\x20with\x20id\x20%s\x20not\x20found',_0x186c16[_0x07b5('0x22')]['id']));}_0x2aa0c3=_0x475798;return db['UserVoiceQueueRt'][_0x07b5('0x23')]({'paused':0x1},{'where':{'UserId':_0x2aa0c3['id']},'individualHooks':!![]});})[_0x07b5('0x16')](function(){return db[_0x07b5('0x24')][_0x07b5('0xe')]({'where':{'membername':_0x2aa0c3[_0x07b5('0x1f')],'type':'PAUSE','exitAt':null}});})[_0x07b5('0x16')](function(_0x265774){if(_0x265774&&_0x265774[_0x07b5('0x25')]){var _0x55f524=moment()['format'](_0x07b5('0x26'));for(var _0x43958f=0x0,_0x511e17=_0x265774[_0x07b5('0x25')];_0x43958f<_0x511e17;_0x43958f++){_0x265774[_0x43958f][_0x07b5('0x27')]({'exitAt':_0x55f524});}}})['then'](function(){var _0x5f425d=[];var _0x5a8ed3=utils[_0x07b5('0x28')]();_0x5a8ed3[_0x07b5('0x29')](function(_0x56fbb1){_0x5f425d[_0x07b5('0x2a')]({'channel':_0x56fbb1,'membername':_0x2aa0c3['name'],'interface':_['isNil'](_0x2aa0c3[_0x07b5('0x21')])?util[_0x07b5('0x2b')](_0x07b5('0x2c'),_0x2aa0c3[_0x07b5('0x1f')]):_0x2aa0c3[_0x07b5('0x21')],'type':'PAUSE','enterAt':moment()[_0x07b5('0x2b')](_0x07b5('0x26')),'data1':_0x186c16[_0x07b5('0x2d')]['type']||'DEFAULT\x20PAUSE','role':_0x2aa0c3['role'],'internal':_0x2aa0c3['internal'],'uniqueid':_0x186c16['body']['uniqueid']||null});});return db['MemberReport']['bulkCreate'](_0x5f425d,{'individualHooks':!![]});})[_0x07b5('0x16')](function(){return _0x2aa0c3[_0x07b5('0x23')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'openchannelPause':!![],'whatsappPause':!![],'pauseType':_0x186c16[_0x07b5('0x2d')][_0x07b5('0x2e')]||_0x07b5('0x2f'),'lastPauseAt':moment()[_0x07b5('0x2b')](_0x07b5('0x26'))});})[_0x07b5('0x18')](function(_0x940a76){throw _0x940a76;});};exports['UnpauseUser']=function(_0x521216){return Promise[_0x07b5('0x30')]()[_0x07b5('0x16')](function(){if(_0x521216[_0x07b5('0x2d')][_0x07b5('0x31')]&&!utils[_0x07b5('0x32')](_0x521216[_0x07b5('0x2d')][_0x07b5('0x31')])){throw new Error(util[_0x07b5('0x2b')](_0x07b5('0x33'),_0x521216[_0x07b5('0x2d')][_0x07b5('0x31')]));}return db[_0x07b5('0xd')][_0x07b5('0x34')]({'where':_0x521216[_0x07b5('0xf')][_0x07b5('0x11')]||{},'attributes':['id','name',_0x07b5('0x20'),_0x07b5('0x35'),_0x07b5('0x21'),_0x07b5('0x36'),_0x07b5('0x37'),_0x07b5('0x38'),_0x07b5('0x39'),_0x07b5('0x3a'),_0x07b5('0x3b'),'smsPause',_0x07b5('0x3c'),'pauseType',_0x07b5('0x3d')]});})['then'](function(_0x879d90){if(!_0x879d90){throw new Error(util[_0x07b5('0x2b')](_0x07b5('0x3e'),_0x521216[_0x07b5('0x22')]['id']));}return _0x879d90[_0x07b5('0x3f')](_0x521216[_0x07b5('0x2d')][_0x07b5('0x31')],_0x07b5('0x40'));})['catch'](function(_0x3af781){throw _0x3af781;});};exports[_0x07b5('0x41')]=function(_0x2612ab){var _0x550ca4=this;return new Promise(function(_0x449450,_0x4f131d){var _0x24a863;return db['User'][_0x07b5('0x34')]({'where':_0x2612ab[_0x07b5('0xf')]['where']||{},'attributes':['id',_0x07b5('0x1f')]})[_0x07b5('0x16')](function(_0x3d9395){if(_0x3d9395){_0x24a863=_0x3d9395;return db[_0x07b5('0x42')][_0x07b5('0x43')]({'where':{'membername':_0x24a863[_0x07b5('0x1f')]},'individualHooks':!![]});}})[_0x07b5('0x16')](function(){if(_0x24a863){return db[_0x07b5('0x24')][_0x07b5('0xe')]({'where':{'membername':_0x24a863['name'],'exitAt':null}});}})[_0x07b5('0x16')](function(_0x10095e){if(_0x24a863){if(_0x10095e&&_0x10095e[_0x07b5('0x25')]){var _0x3da572=[];_0x10095e[_0x07b5('0x29')](function(_0x56273a){_0x3da572[_0x07b5('0x2a')](_0x56273a[_0x07b5('0x23')]({'exitAt':moment()[_0x07b5('0x2b')]('YYYY-MM-DD\x20HH:mm:ss')}));});return BPromise[_0x07b5('0x44')](_0x3da572);}}})[_0x07b5('0x16')](function(){if(_0x24a863){return _0x24a863[_0x07b5('0x23')]({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![]});}})[_0x07b5('0x16')](function(_0x4e9b9f){_0x449450(_0x4e9b9f);})[_0x07b5('0x18')](function(_0x21c0a6){_0x4f131d(_0x550ca4[_0x07b5('0x19')](0x1f4,_0x21c0a6['message']));});});};exports[_0x07b5('0x45')]=function(_0x4cc9ea){var _0x4eda6=this;return new Promise(function(_0x89992e,_0x333e12){var _0xe0360e;var _0x4fed1c;var _0x50f614;var _0x337900;return db[_0x07b5('0xd')][_0x07b5('0x34')]({'where':_0x4cc9ea[_0x07b5('0xf')]['where']||{},'attributes':['id',_0x07b5('0x1f'),_0x07b5('0x20'),'mobile',_0x07b5('0x46'),'internal',_0x07b5('0x47'),_0x07b5('0x21')]})[_0x07b5('0x16')](function(_0x540dda){if(_0x540dda){_0xe0360e=_0x540dda;_0x337900=_0x4cc9ea['body']['interface']?_0x4cc9ea[_0x07b5('0x2d')][_0x07b5('0x21')]:util[_0x07b5('0x2b')]('SIP/%s',_0xe0360e['name']);return db['User'][_0x07b5('0x48')]({'where':{'role':_0x07b5('0x49'),'online':!![],'id':{'$ne':_0xe0360e['id']}}});}})[_0x07b5('0x16')](function(_0x111950){if(_0x111950){_0x50f614=_0x111950;return require(_0x07b5('0x4a'))[_0x07b5('0x4b')]();}})['then'](function(_0x30ee6b){if(_0x30ee6b&&_0x30ee6b[_0x07b5('0x4c')]&&_0x50f614>=_0x30ee6b[_0x07b5('0x4c')]){throw new Error(_0x07b5('0x4d'));}})[_0x07b5('0x16')](function(){if(_0xe0360e){return db['UserVoiceQueueRt']['destroy']({'where':{'membername':_0xe0360e[_0x07b5('0x1f')]},'individualHooks':!![]});}})['then'](function(){if(_0xe0360e){return _0xe0360e['getVoiceQueues']({'raw':!![]});}})[_0x07b5('0x16')](function(_0x427134){if(_0xe0360e){if(_0x427134){var _0x43050c=[];_0x4fed1c=_0x427134;if(_0x4fed1c['length']){for(var _0x3c6ccb=0x0;_0x3c6ccb<_0x4fed1c['length'];_0x3c6ccb++){_0x43050c[_0x07b5('0x2a')](db['UserVoiceQueueRt'][_0x07b5('0x4e')]({'membername':_0xe0360e[_0x07b5('0x1f')],'UserId':_0xe0360e['id'],'queue_name':_0x4fed1c[_0x3c6ccb][_0x07b5('0x1f')],'VoiceQueueId':_0x4fed1c[_0x3c6ccb]['id'],'interface':_0x337900,'paused':_0xe0360e[_0x07b5('0x47')]||![],'penalty':_0x4fed1c[_0x3c6ccb][_0x07b5('0x4f')]||0x0}));}return BPromise[_0x07b5('0x44')](_0x43050c);}}}})[_0x07b5('0x16')](function(){if(_0xe0360e){return db[_0x07b5('0x24')][_0x07b5('0xe')]({'where':{'membername':_0xe0360e[_0x07b5('0x1f')],'exitAt':null}});}})[_0x07b5('0x16')](function(_0x259c36){if(_0xe0360e){if(_0x259c36&&_0x259c36[_0x07b5('0x25')]){var _0x2140ad=[];_0x259c36[_0x07b5('0x29')](function(_0xbf9eb9){_0x2140ad[_0x07b5('0x2a')](_0xbf9eb9[_0x07b5('0x23')]({'exitAt':moment()[_0x07b5('0x2b')](_0x07b5('0x26'))}));});return BPromise[_0x07b5('0x44')](_0x2140ad);}}})[_0x07b5('0x16')](function(){if(_0xe0360e){var _0x4d0676=[];var _0x5588ce=[];var _0x2ffde8=utils[_0x07b5('0x28')]();var _0x29ce8b={'membername':_0xe0360e[_0x07b5('0x1f')],'interface':_0x337900,'enterAt':moment()[_0x07b5('0x2b')](_0x07b5('0x26')),'role':_0xe0360e[_0x07b5('0x20')],'internal':_0xe0360e['internal']};_0x2ffde8[_0x07b5('0x29')](function(_0x4d7ed0){_0x4d0676[_0x07b5('0x2a')](_[_0x07b5('0x50')]({'channel':_0x4d7ed0,'type':_0x07b5('0x51'),'data1':'callysquare','data2':_0x337900},_0x29ce8b));if(_0xe0360e[_0x07b5('0x47')]){_0x5588ce[_0x07b5('0x2a')](_[_0x07b5('0x50')]({'channel':_0x4d7ed0,'type':_0x07b5('0x52'),'data1':_0x07b5('0x53')},_0x29ce8b));}});return db[_0x07b5('0x24')]['bulkCreate'](_0x4d0676[_0x07b5('0x54')](_0x5588ce),{'individualHooks':!![]});}})[_0x07b5('0x16')](function(){if(_0xe0360e){return _0xe0360e[_0x07b5('0x23')]({'online':!![],'lastLoginAt':moment()[_0x07b5('0x2b')](_0x07b5('0x26')),'voicePause':_0xe0360e['loginInPause']||![],'mailPause':_0xe0360e['loginInPause']||![],'chatPause':_0xe0360e['loginInPause']||![],'faxPause':_0xe0360e['loginInPause']||![],'smsPause':_0xe0360e[_0x07b5('0x47')]||![],'openchannelPause':_0xe0360e[_0x07b5('0x47')]||![],'pauseType':_0xe0360e['loginInPause']?_0x07b5('0x53'):null,'lastPauseAt':moment()[_0x07b5('0x2b')](_0x07b5('0x26')),'interface':_0x337900});}})[_0x07b5('0x16')](function(_0x45b033){_0x89992e(_0x45b033);})[_0x07b5('0x18')](function(_0x37ed5b){_0x333e12(_0x4eda6[_0x07b5('0x19')](0x1f4,_0x37ed5b[_0x07b5('0x1d')]));});});}; \ No newline at end of file diff --git a/server/api/user/user.socket.js b/server/api/user/user.socket.js index 66efbdb..37cd98b 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 _0xe85a=['./user.events','save','remove','update','emit','removeListener','length','user:'];(function(_0x24e24e,_0x3d82a3){var _0x2a68b8=function(_0x426283){while(--_0x426283){_0x24e24e['push'](_0x24e24e['shift']());}};_0x2a68b8(++_0x3d82a3);}(_0xe85a,0x1b0));var _0xae85=function(_0x47264b,_0x26c1b6){_0x47264b=_0x47264b-0x0;var _0x5d2153=_0xe85a[_0x47264b];return _0x5d2153;};'use strict';var UserEvents=require(_0xae85('0x0'));var events=[_0xae85('0x1'),_0xae85('0x2'),_0xae85('0x3')];function createListener(_0x188c1d,_0x1a2086){return function(_0x28e60e){_0x1a2086[_0xae85('0x4')](_0x188c1d,_0x28e60e);};}function removeListener(_0x138752,_0x4990d8){return function(){UserEvents[_0xae85('0x5')](_0x138752,_0x4990d8);};}exports['register']=function(_0x462a31){for(var _0xda6d45=0x0,_0x15d59c=events[_0xae85('0x6')];_0xda6d45<_0x15d59c;_0xda6d45++){var _0x14410b=events[_0xda6d45];var _0x3f9a39=createListener(_0xae85('0x7')+_0x14410b,_0x462a31);UserEvents['on'](_0x14410b,_0x3f9a39);}}; \ No newline at end of file +var _0xa6cb=['removeListener','register','user:','./user.events','save','emit'];(function(_0x3d6b37,_0xfcf4cf){var _0x25be72=function(_0x47705b){while(--_0x47705b){_0x3d6b37['push'](_0x3d6b37['shift']());}};_0x25be72(++_0xfcf4cf);}(_0xa6cb,0x1e3));var _0xba6c=function(_0x6bf34,_0x1726f1){_0x6bf34=_0x6bf34-0x0;var _0x38f05c=_0xa6cb[_0x6bf34];return _0x38f05c;};'use strict';var UserEvents=require(_0xba6c('0x0'));var events=[_0xba6c('0x1'),'remove','update'];function createListener(_0x37acc7,_0x417b12){return function(_0xa6dd80){_0x417b12[_0xba6c('0x2')](_0x37acc7,_0xa6dd80);};}function removeListener(_0x43b28c,_0x2169dd){return function(){UserEvents[_0xba6c('0x3')](_0x43b28c,_0x2169dd);};}exports[_0xba6c('0x4')]=function(_0xb1655){for(var _0xb42738=0x0,_0x38c6a0=events['length'];_0xb42738<_0x38c6a0;_0xb42738++){var _0x44b7fd=events[_0xb42738];var _0x48b1da=createListener(_0xba6c('0x5')+_0x44b7fd,_0xb1655);UserEvents['on'](_0x44b7fd,_0x48b1da);}}; \ No newline at end of file diff --git a/server/api/userChatQueue/index.js b/server/api/userChatQueue/index.js index 9c33fe1..f1cebb9 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 _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x3451cf,_0x432594){var _0x485e36=function(_0x5d6120){while(--_0x5d6120){_0x3451cf['push'](_0x3451cf['shift']());}};_0x485e36(++_0x432594);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3c2a69,_0x4c8b41){_0x3c2a69=_0x3c2a69-0x0;var _0x596bc8=_0xa9e0[_0x3c2a69];return _0x596bc8;};'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(_0x5f27aa,_0x8d0e3c){var _0x2bcd87=function(_0x3f6c54){while(--_0x3f6c54){_0x5f27aa['push'](_0x5f27aa['shift']());}};_0x2bcd87(++_0x8d0e3c);}(_0x70e0,0x17b));var _0x070e=function(_0x54f5e8,_0x2f61ad){_0x54f5e8=_0x54f5e8-0x0;var _0x5f452b=_0x70e0[_0x54f5e8];return _0x5f452b;};'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/userChatQueue/userChatQueue.attributes.js b/server/api/userChatQueue/userChatQueue.attributes.js index f13871a..ea0ef75 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 _0x952a=['exports','sequelize'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x952a,0x175));var _0xa952=function(_0x273c74,_0x4893fb){_0x273c74=_0x273c74-0x0;var _0x2275cf=_0x952a[_0x273c74];return _0x2275cf;};'use strict';var Sequelize=require(_0xa952('0x0'));module[_0xa952('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x13b3=['INTEGER','sequelize','exports'];(function(_0x589086,_0x14fbec){var _0x4316dd=function(_0x15ee08){while(--_0x15ee08){_0x589086['push'](_0x589086['shift']());}};_0x4316dd(++_0x14fbec);}(_0x13b3,0x6a));var _0x313b=function(_0xa9b067,_0x2047eb){_0xa9b067=_0xa9b067-0x0;var _0x492156=_0x13b3[_0xa9b067];return _0x492156;};'use strict';var Sequelize=require(_0x313b('0x0'));module[_0x313b('0x1')]={'penalty':{'type':Sequelize[_0x313b('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 f6a95f8..ef95da9 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 _0x3aeb=['user_has_chat_queues','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userChatQueue.attributes','UserChatQueue'];(function(_0xcc5a3f,_0x4a5b35){var _0xe3c6f=function(_0x2261f2){while(--_0x2261f2){_0xcc5a3f['push'](_0xcc5a3f['shift']());}};_0xe3c6f(++_0x4a5b35);}(_0x3aeb,0x16d));var _0xb3ae=function(_0x2effbb,_0x1f6e8e){_0x2effbb=_0x2effbb-0x0;var _0x1d23d3=_0x3aeb[_0x2effbb];return _0x1d23d3;};'use strict';var _=require(_0xb3ae('0x0'));var util=require(_0xb3ae('0x1'));var logger=require(_0xb3ae('0x2'))(_0xb3ae('0x3'));var moment=require(_0xb3ae('0x4'));var BPromise=require(_0xb3ae('0x5'));var rp=require(_0xb3ae('0x6'));var fs=require('fs');var path=require(_0xb3ae('0x7'));var rimraf=require(_0xb3ae('0x8'));var config=require(_0xb3ae('0x9'));var attributes=require(_0xb3ae('0xa'));module['exports']=function(_0x469aa1,_0x285b84){return _0x469aa1['define'](_0xb3ae('0xb'),attributes,{'tableName':_0xb3ae('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x50cf=['path','../../config/environment','./userChatQueue.attributes','exports','UserChatQueue','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x2831eb,_0x126248){var _0x117220=function(_0x113038){while(--_0x113038){_0x2831eb['push'](_0x2831eb['shift']());}};_0x117220(++_0x126248);}(_0x50cf,0x10d));var _0xf50c=function(_0x387e7a,_0x20349c){_0x387e7a=_0x387e7a-0x0;var _0x179558=_0x50cf[_0x387e7a];return _0x179558;};'use strict';var _=require(_0xf50c('0x0'));var util=require(_0xf50c('0x1'));var logger=require(_0xf50c('0x2'))(_0xf50c('0x3'));var moment=require(_0xf50c('0x4'));var BPromise=require(_0xf50c('0x5'));var rp=require(_0xf50c('0x6'));var fs=require('fs');var path=require(_0xf50c('0x7'));var rimraf=require('rimraf');var config=require(_0xf50c('0x8'));var attributes=require(_0xf50c('0x9'));module[_0xf50c('0xa')]=function(_0x37ac90,_0x3539b7){return _0x37ac90['define'](_0xf50c('0xb'),attributes,{'tableName':'user_has_chat_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.rpc.js b/server/api/userChatQueue/userChatQueue.rpc.js index 93aa84e..ee9dafb 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 _0xa62a=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','UserChatQueue,\x20%s,\x20%s','debug','UserChatQueue,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','lodash','moment'];(function(_0xf0bcac,_0x531755){var _0x4e4c65=function(_0x35a77a){while(--_0x35a77a){_0xf0bcac['push'](_0xf0bcac['shift']());}};_0x4e4c65(++_0x531755);}(_0xa62a,0xf0));var _0xaa62=function(_0x3d5798,_0x11a5a4){_0x3d5798=_0x3d5798-0x0;var _0x2f9b86=_0xa62a[_0x3d5798];return _0x2f9b86;};'use strict';var _=require(_0xaa62('0x0'));var util=require('util');var moment=require(_0xaa62('0x1'));var BPromise=require(_0xaa62('0x2'));var rs=require(_0xaa62('0x3'));var fs=require('fs');var Redis=require(_0xaa62('0x4'));var db=require(_0xaa62('0x5'))['db'];var utils=require(_0xaa62('0x6'));var logger=require(_0xaa62('0x7'))(_0xaa62('0x8'));var config=require('../../config/environment');var jayson=require(_0xaa62('0x9'));var client=jayson[_0xaa62('0xa')][_0xaa62('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x413ac1,_0x1aa42b,_0x32e960){return new BPromise(function(_0x1feb3b,_0x5066eb){return client[_0xaa62('0xc')](_0x413ac1,_0x32e960)[_0xaa62('0xd')](function(_0x3b9eec){logger[_0xaa62('0xe')](_0xaa62('0xf'),_0x1aa42b,'request\x20sent');logger[_0xaa62('0x10')](_0xaa62('0x11'),_0x1aa42b,_0xaa62('0x12'),JSON['stringify'](_0x3b9eec));if(_0x3b9eec['error']){if(_0x3b9eec[_0xaa62('0x13')][_0xaa62('0x14')]===0x1f4){logger[_0xaa62('0x13')](_0xaa62('0xf'),_0x1aa42b,_0x3b9eec[_0xaa62('0x13')]['message']);return _0x5066eb(_0x3b9eec[_0xaa62('0x13')][_0xaa62('0x15')]);}logger[_0xaa62('0x13')]('UserChatQueue,\x20%s,\x20%s',_0x1aa42b,_0x3b9eec['error']['message']);return _0x1feb3b(_0x3b9eec[_0xaa62('0x13')][_0xaa62('0x15')]);}else{logger['info']('UserChatQueue,\x20%s,\x20%s',_0x1aa42b,_0xaa62('0x12'));_0x1feb3b(_0x3b9eec['result'][_0xaa62('0x15')]);}})['catch'](function(_0x5a21c6){logger['error']('UserChatQueue,\x20%s,\x20%s',_0x1aa42b,_0x5a21c6);_0x5066eb(_0x5a21c6);});});} \ No newline at end of file +var _0x8472=['UserChatQueue,\x20%s,\x20%s','request\x20sent','debug','UserChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','jayson/promise','client','http','request','then','info'];(function(_0x28d6c0,_0x23864c){var _0x19cc03=function(_0x293ab3){while(--_0x293ab3){_0x28d6c0['push'](_0x28d6c0['shift']());}};_0x19cc03(++_0x23864c);}(_0x8472,0x1c2));var _0x2847=function(_0xfbc78a,_0x55ba87){_0xfbc78a=_0xfbc78a-0x0;var _0x1ae9b7=_0x8472[_0xfbc78a];return _0x1ae9b7;};'use strict';var _=require(_0x2847('0x0'));var util=require('util');var moment=require(_0x2847('0x1'));var BPromise=require(_0x2847('0x2'));var rs=require(_0x2847('0x3'));var fs=require('fs');var Redis=require(_0x2847('0x4'));var db=require(_0x2847('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x2847('0x6'));var client=jayson[_0x2847('0x7')][_0x2847('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x736a3f,_0x1af9ac,_0x5731f3){return new BPromise(function(_0x268e75,_0x3adce9){return client[_0x2847('0x9')](_0x736a3f,_0x5731f3)[_0x2847('0xa')](function(_0x409047){logger[_0x2847('0xb')](_0x2847('0xc'),_0x1af9ac,_0x2847('0xd'));logger[_0x2847('0xe')](_0x2847('0xf'),_0x1af9ac,_0x2847('0xd'),JSON[_0x2847('0x10')](_0x409047));if(_0x409047[_0x2847('0x11')]){if(_0x409047['error'][_0x2847('0x12')]===0x1f4){logger[_0x2847('0x11')](_0x2847('0xc'),_0x1af9ac,_0x409047[_0x2847('0x11')][_0x2847('0x13')]);return _0x3adce9(_0x409047[_0x2847('0x11')][_0x2847('0x13')]);}logger[_0x2847('0x11')](_0x2847('0xc'),_0x1af9ac,_0x409047[_0x2847('0x11')][_0x2847('0x13')]);return _0x268e75(_0x409047[_0x2847('0x11')]['message']);}else{logger[_0x2847('0xb')](_0x2847('0xc'),_0x1af9ac,_0x2847('0xd'));_0x268e75(_0x409047[_0x2847('0x14')][_0x2847('0x13')]);}})[_0x2847('0x15')](function(_0x2d5e01){logger[_0x2847('0x11')](_0x2847('0xc'),_0x1af9ac,_0x2d5e01);_0x3adce9(_0x2d5e01);});});} \ No newline at end of file diff --git a/server/api/userFaxQueue/index.js b/server/api/userFaxQueue/index.js index 276d16e..7d66bba 100644 --- a/server/api/userFaxQueue/index.js +++ b/server/api/userFaxQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x4a12fc,_0x449a9e){var _0x4c0b0d=function(_0x57ae6b){while(--_0x57ae6b){_0x4a12fc['push'](_0x4a12fc['shift']());}};_0x4c0b0d(++_0x449a9e);}(_0xe706,0xa3));var _0x6e70=function(_0xcb56d2,_0x18c194){_0xcb56d2=_0xcb56d2-0x0;var _0x57bed4=_0xe706[_0xcb56d2];return _0x57bed4;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));module[_0x6e70('0x9')]=router; \ No newline at end of file +var _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x49d7c8,_0x52d9a3){var _0x450089=function(_0x1ed0d7){while(--_0x1ed0d7){_0x49d7c8['push'](_0x49d7c8['shift']());}};_0x450089(++_0x52d9a3);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));module['exports']=router; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.attributes.js b/server/api/userFaxQueue/userFaxQueue.attributes.js index 2151793..f5547a3 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 _0x5362=['exports','INTEGER','STRING'];(function(_0x39edf1,_0x3616a9){var _0x348891=function(_0x2fd7d9){while(--_0x2fd7d9){_0x39edf1['push'](_0x39edf1['shift']());}};_0x348891(++_0x3616a9);}(_0x5362,0xc9));var _0x2536=function(_0x27db1b,_0x3417df){_0x27db1b=_0x27db1b-0x0;var _0x304e3d=_0x5362[_0x27db1b];return _0x304e3d;};'use strict';var Sequelize=require('sequelize');module[_0x2536('0x0')]={'penalty':{'type':Sequelize[_0x2536('0x1')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x2536('0x1')],'defaultValue':0x0},'queue':{'type':Sequelize[_0x2536('0x2')]}}; \ No newline at end of file +var _0xfce1=['exports','INTEGER','STRING'];(function(_0x3c7dcd,_0x2109e2){var _0x3d73fe=function(_0x4d1a25){while(--_0x4d1a25){_0x3c7dcd['push'](_0x3c7dcd['shift']());}};_0x3d73fe(++_0x2109e2);}(_0xfce1,0x111));var _0x1fce=function(_0x49ca18,_0x5e6d05){_0x49ca18=_0x49ca18-0x0;var _0x145d54=_0xfce1[_0x49ca18];return _0x145d54;};'use strict';var Sequelize=require('sequelize');module[_0x1fce('0x0')]={'penalty':{'type':Sequelize[_0x1fce('0x1')],'defaultValue':0x0},'assigned':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'queue':{'type':Sequelize[_0x1fce('0x2')]}}; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.model.js b/server/api/userFaxQueue/userFaxQueue.model.js index 7903aa2..4151d19 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 _0xd16c=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','define','UserFaxQueue','user_has_fax_queues'];(function(_0x38537f,_0x252124){var _0x141e23=function(_0x2809b5){while(--_0x2809b5){_0x38537f['push'](_0x38537f['shift']());}};_0x141e23(++_0x252124);}(_0xd16c,0xa8));var _0xcd16=function(_0x419f6e,_0x214f83){_0x419f6e=_0x419f6e-0x0;var _0x28c71d=_0xd16c[_0x419f6e];return _0x28c71d;};'use strict';var _=require('lodash');var util=require(_0xcd16('0x0'));var logger=require(_0xcd16('0x1'))(_0xcd16('0x2'));var moment=require(_0xcd16('0x3'));var BPromise=require(_0xcd16('0x4'));var rp=require(_0xcd16('0x5'));var fs=require('fs');var path=require(_0xcd16('0x6'));var rimraf=require(_0xcd16('0x7'));var config=require(_0xcd16('0x8'));var attributes=require('./userFaxQueue.attributes');module['exports']=function(_0x3f07fa,_0x176b15){return _0x3f07fa[_0xcd16('0x9')](_0xcd16('0xa'),attributes,{'tableName':_0xcd16('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa9b2=['define','user_has_fax_queues','lodash','util','bluebird','path'];(function(_0x208162,_0x2dd393){var _0x26618a=function(_0x26843c){while(--_0x26843c){_0x208162['push'](_0x208162['shift']());}};_0x26618a(++_0x2dd393);}(_0xa9b2,0xe0));var _0x2a9b=function(_0x29cb61,_0x494484){_0x29cb61=_0x29cb61-0x0;var _0x21d3e0=_0xa9b2[_0x29cb61];return _0x21d3e0;};'use strict';var _=require(_0x2a9b('0x0'));var util=require(_0x2a9b('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x2a9b('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2a9b('0x3'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./userFaxQueue.attributes');module['exports']=function(_0xe040da,_0x47066e){return _0xe040da[_0x2a9b('0x4')]('UserFaxQueue',attributes,{'tableName':_0x2a9b('0x5'),'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 6a5654d..6fe5a55 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 _0x2921=['message','result','catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','then','info','UserFaxQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code'];(function(_0x36ed48,_0x1ee0d4){var _0x51c63a=function(_0x2d0a40){while(--_0x2d0a40){_0x36ed48['push'](_0x36ed48['shift']());}};_0x51c63a(++_0x1ee0d4);}(_0x2921,0x163));var _0x1292=function(_0xc838bf,_0x5b8b62){_0xc838bf=_0xc838bf-0x0;var _0x50afa5=_0x2921[_0xc838bf];return _0x50afa5;};'use strict';var _=require(_0x1292('0x0'));var util=require('util');var moment=require(_0x1292('0x1'));var BPromise=require(_0x1292('0x2'));var rs=require(_0x1292('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1292('0x4'))['db'];var utils=require(_0x1292('0x5'));var logger=require('../../config/logger')(_0x1292('0x6'));var config=require('../../config/environment');var jayson=require(_0x1292('0x7'));var client=jayson[_0x1292('0x8')][_0x1292('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4fa0cd,_0x40e9bc,_0x308768){return new BPromise(function(_0x23b593,_0x12a857){return client[_0x1292('0xa')](_0x4fa0cd,_0x308768)[_0x1292('0xb')](function(_0x173c52){logger[_0x1292('0xc')](_0x1292('0xd'),_0x40e9bc,_0x1292('0xe'));logger[_0x1292('0xf')]('UserFaxQueue,\x20%s,\x20%s,\x20%s',_0x40e9bc,_0x1292('0xe'),JSON[_0x1292('0x10')](_0x173c52));if(_0x173c52[_0x1292('0x11')]){if(_0x173c52[_0x1292('0x11')][_0x1292('0x12')]===0x1f4){logger[_0x1292('0x11')](_0x1292('0xd'),_0x40e9bc,_0x173c52['error'][_0x1292('0x13')]);return _0x12a857(_0x173c52[_0x1292('0x11')]['message']);}logger[_0x1292('0x11')](_0x1292('0xd'),_0x40e9bc,_0x173c52[_0x1292('0x11')][_0x1292('0x13')]);return _0x23b593(_0x173c52['error']['message']);}else{logger[_0x1292('0xc')](_0x1292('0xd'),_0x40e9bc,_0x1292('0xe'));_0x23b593(_0x173c52[_0x1292('0x14')]['message']);}})[_0x1292('0x15')](function(_0x463721){logger[_0x1292('0x11')](_0x1292('0xd'),_0x40e9bc,_0x463721);_0x12a857(_0x463721);});});} \ No newline at end of file +var _0x947b=['request\x20sent','debug','UserFaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','UserFaxQueue,\x20%s,\x20%s','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','info'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x947b,0x171));var _0xb947=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x947b[_0x2dafbe];return _0x58a45a;};'use strict';var _=require(_0xb947('0x0'));var util=require(_0xb947('0x1'));var moment=require(_0xb947('0x2'));var BPromise=require(_0xb947('0x3'));var rs=require(_0xb947('0x4'));var fs=require('fs');var Redis=require(_0xb947('0x5'));var db=require(_0xb947('0x6'))['db'];var utils=require(_0xb947('0x7'));var logger=require(_0xb947('0x8'))(_0xb947('0x9'));var config=require(_0xb947('0xa'));var jayson=require(_0xb947('0xb'));var client=jayson[_0xb947('0xc')]['http']({'port':0x232a});function respondWithRpcPromise(_0x482f00,_0x4f2b0e,_0x43dc43){return new BPromise(function(_0x4b4fec,_0x53dc74){return client['request'](_0x482f00,_0x43dc43)[_0xb947('0xd')](function(_0x271807){logger[_0xb947('0xe')]('UserFaxQueue,\x20%s,\x20%s',_0x4f2b0e,_0xb947('0xf'));logger[_0xb947('0x10')](_0xb947('0x11'),_0x4f2b0e,_0xb947('0xf'),JSON[_0xb947('0x12')](_0x271807));if(_0x271807['error']){if(_0x271807[_0xb947('0x13')][_0xb947('0x14')]===0x1f4){logger[_0xb947('0x13')](_0xb947('0x15'),_0x4f2b0e,_0x271807[_0xb947('0x13')]['message']);return _0x53dc74(_0x271807[_0xb947('0x13')][_0xb947('0x16')]);}logger[_0xb947('0x13')](_0xb947('0x15'),_0x4f2b0e,_0x271807[_0xb947('0x13')][_0xb947('0x16')]);return _0x4b4fec(_0x271807[_0xb947('0x13')]['message']);}else{logger[_0xb947('0xe')]('UserFaxQueue,\x20%s,\x20%s',_0x4f2b0e,'request\x20sent');_0x4b4fec(_0x271807[_0xb947('0x17')][_0xb947('0x16')]);}})['catch'](function(_0x300452){logger['error'](_0xb947('0x15'),_0x4f2b0e,_0x300452);_0x53dc74(_0x300452);});});} \ No newline at end of file diff --git a/server/api/userMailQueue/index.js b/server/api/userMailQueue/index.js index dfa129d..0f71252 100644 --- a/server/api/userMailQueue/index.js +++ b/server/api/userMailQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x4bbe00,_0x1d2f14){var _0x3999d2=function(_0x4390fa){while(--_0x4390fa){_0x4bbe00['push'](_0x4bbe00['shift']());}};_0x3999d2(++_0x1d2f14);}(_0x9c44,0x178));var _0x49c4=function(_0x45d55e,_0x2fede3){_0x45d55e=_0x45d55e-0x0;var _0x29812a=_0x9c44[_0x45d55e];return _0x29812a;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router; \ No newline at end of file +var _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x2db9d2,_0x360ca1){var _0xbea496=function(_0x44717d){while(--_0x44717d){_0x2db9d2['push'](_0x2db9d2['shift']());}};_0xbea496(++_0x360ca1);}(_0x70e0,0x17b));var _0x070e=function(_0x521ef0,_0x4562de){_0x521ef0=_0x521ef0-0x0;var _0x425039=_0x70e0[_0x521ef0];return _0x425039;};'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/userMailQueue/userMailQueue.attributes.js b/server/api/userMailQueue/userMailQueue.attributes.js index 89c4a82..8d2c35a 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 _0xe776=['INTEGER','sequelize','exports'];(function(_0x4f9b18,_0x2cb5ca){var _0x29f20c=function(_0x268b3d){while(--_0x268b3d){_0x4f9b18['push'](_0x4f9b18['shift']());}};_0x29f20c(++_0x2cb5ca);}(_0xe776,0xc4));var _0x6e77=function(_0x34ff1e,_0x3bfbfb){_0x34ff1e=_0x34ff1e-0x0;var _0x110bcb=_0xe776[_0x34ff1e];return _0x110bcb;};'use strict';var Sequelize=require(_0x6e77('0x0'));module[_0x6e77('0x1')]={'penalty':{'type':Sequelize[_0x6e77('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x70e1=['exports'];(function(_0x15fc3a,_0x5c6f46){var _0x29fdf7=function(_0x393615){while(--_0x393615){_0x15fc3a['push'](_0x15fc3a['shift']());}};_0x29fdf7(++_0x5c6f46);}(_0x70e1,0x101));var _0x170e=function(_0x3cebff,_0x20b43d){_0x3cebff=_0x3cebff-0x0;var _0x6e5423=_0x70e1[_0x3cebff];return _0x6e5423;};'use strict';var Sequelize=require('sequelize');module[_0x170e('0x0')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.model.js b/server/api/userMailQueue/userMailQueue.model.js index a1a498a..bdc88cf 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 _0x5e81=['./userMailQueue.attributes','define','UserMailQueue','user_has_mail_queues','lodash','util','../../config/logger','bluebird','rimraf','../../config/environment'];(function(_0x58ee19,_0xdf0765){var _0x49af25=function(_0x109b5e){while(--_0x109b5e){_0x58ee19['push'](_0x58ee19['shift']());}};_0x49af25(++_0xdf0765);}(_0x5e81,0x13a));var _0x15e8=function(_0x3bba82,_0x5463fb){_0x3bba82=_0x3bba82-0x0;var _0x3f47f0=_0x5e81[_0x3bba82];return _0x3f47f0;};'use strict';var _=require(_0x15e8('0x0'));var util=require(_0x15e8('0x1'));var logger=require(_0x15e8('0x2'))('api');var moment=require('moment');var BPromise=require(_0x15e8('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x15e8('0x4'));var config=require(_0x15e8('0x5'));var attributes=require(_0x15e8('0x6'));module['exports']=function(_0xbe2681,_0x15a5ad){return _0xbe2681[_0x15e8('0x7')](_0x15e8('0x8'),attributes,{'tableName':_0x15e8('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x36ef=['request-promise','path','../../config/environment','define','UserMailQueue','user_has_mail_queues','lodash','util','../../config/logger','api'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x36ef,0x6a));var _0xf36e=function(_0x8214b7,_0x55ce93){_0x8214b7=_0x8214b7-0x0;var _0x46520b=_0x36ef[_0x8214b7];return _0x46520b;};'use strict';var _=require(_0xf36e('0x0'));var util=require(_0xf36e('0x1'));var logger=require(_0xf36e('0x2'))(_0xf36e('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xf36e('0x4'));var fs=require('fs');var path=require(_0xf36e('0x5'));var rimraf=require('rimraf');var config=require(_0xf36e('0x6'));var attributes=require('./userMailQueue.attributes');module['exports']=function(_0x184b9b,_0x19d094){return _0x184b9b[_0xf36e('0x7')](_0xf36e('0x8'),attributes,{'tableName':_0xf36e('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.rpc.js b/server/api/userMailQueue/userMailQueue.rpc.js index 41b4101..4c7d587 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 _0x9957=['message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','UserMailQueue,\x20%s,\x20%s','request\x20sent','debug','UserMailQueue,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x341751,_0x501bd4){var _0x2c8f0b=function(_0x3d6af7){while(--_0x3d6af7){_0x341751['push'](_0x341751['shift']());}};_0x2c8f0b(++_0x501bd4);}(_0x9957,0x93));var _0x7995=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x9957[_0x2dafbe];return _0x58a45a;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var 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']('UserMailQueue,\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 _0x00bb=['stringify','error','message','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','request','info','UserMailQueue,\x20%s,\x20%s','request\x20sent','debug','UserMailQueue,\x20%s,\x20%s,\x20%s'];(function(_0x5e1b88,_0xcbae5f){var _0x3a278b=function(_0x509ec7){while(--_0x509ec7){_0x5e1b88['push'](_0x5e1b88['shift']());}};_0x3a278b(++_0xcbae5f);}(_0x00bb,0x1d8));var _0xb00b=function(_0x24237f,_0x4cf32c){_0x24237f=_0x24237f-0x0;var _0x48298e=_0x00bb[_0x24237f];return _0x48298e;};'use strict';var _=require(_0xb00b('0x0'));var util=require(_0xb00b('0x1'));var moment=require(_0xb00b('0x2'));var BPromise=require('bluebird');var rs=require(_0xb00b('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb00b('0x4'))['db'];var utils=require(_0xb00b('0x5'));var logger=require('../../config/logger')(_0xb00b('0x6'));var config=require(_0xb00b('0x7'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x36e363,_0xf737d0,_0x41dfc9){return new BPromise(function(_0x37f07d,_0xfa4181){return client[_0xb00b('0x8')](_0x36e363,_0x41dfc9)['then'](function(_0x51d12b){logger[_0xb00b('0x9')](_0xb00b('0xa'),_0xf737d0,_0xb00b('0xb'));logger[_0xb00b('0xc')](_0xb00b('0xd'),_0xf737d0,'request\x20sent',JSON[_0xb00b('0xe')](_0x51d12b));if(_0x51d12b['error']){if(_0x51d12b['error']['code']===0x1f4){logger[_0xb00b('0xf')](_0xb00b('0xa'),_0xf737d0,_0x51d12b[_0xb00b('0xf')][_0xb00b('0x10')]);return _0xfa4181(_0x51d12b[_0xb00b('0xf')][_0xb00b('0x10')]);}logger['error'](_0xb00b('0xa'),_0xf737d0,_0x51d12b[_0xb00b('0xf')]['message']);return _0x37f07d(_0x51d12b[_0xb00b('0xf')][_0xb00b('0x10')]);}else{logger['info']('UserMailQueue,\x20%s,\x20%s',_0xf737d0,_0xb00b('0xb'));_0x37f07d(_0x51d12b['result']['message']);}})[_0xb00b('0x11')](function(_0x638443){logger[_0xb00b('0xf')](_0xb00b('0xa'),_0xf737d0,_0x638443);_0xfa4181(_0x638443);});});} \ No newline at end of file diff --git a/server/api/userNotification/index.js b/server/api/userNotification/index.js index 38a7a2c..4b7dee2 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 _0xa976=['../../components/interaction/service','../../config/environment','./userNotification.controller','post','isAuthenticated','sendUserNotification','util','connect-timeout','express','Router'];(function(_0xbf1a25,_0x3514cc){var _0x3b0f85=function(_0x1af81b){while(--_0x1af81b){_0xbf1a25['push'](_0xbf1a25['shift']());}};_0x3b0f85(++_0x3514cc);}(_0xa976,0x74));var _0x6a97=function(_0xfacc27,_0x76f9e3){_0xfacc27=_0xfacc27-0x0;var _0x2fbff8=_0xa976[_0xfacc27];return _0x2fbff8;};'use strict';var multer=require('multer');var util=require(_0x6a97('0x0'));var path=require('path');var timeout=require(_0x6a97('0x1'));var express=require(_0x6a97('0x2'));var router=express[_0x6a97('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x6a97('0x4'));var config=require(_0x6a97('0x5'));var controller=require(_0x6a97('0x6'));router[_0x6a97('0x7')]('/',auth[_0x6a97('0x8')](),controller[_0x6a97('0x9')]);module['exports']=router; \ No newline at end of file +var _0x013c=['isAuthenticated','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','post'];(function(_0x409237,_0xe36701){var _0x2b3e72=function(_0x9c719f){while(--_0x9c719f){_0x409237['push'](_0x409237['shift']());}};_0x2b3e72(++_0xe36701);}(_0x013c,0xa1));var _0xc013=function(_0x77fd25,_0x226ea2){_0x77fd25=_0x77fd25-0x0;var _0xe14528=_0x013c[_0x77fd25];return _0xe14528;};'use strict';var multer=require(_0xc013('0x0'));var util=require(_0xc013('0x1'));var path=require('path');var timeout=require(_0xc013('0x2'));var express=require(_0xc013('0x3'));var router=express[_0xc013('0x4')]();var fs_extra=require(_0xc013('0x5'));var auth=require(_0xc013('0x6'));var interaction=require(_0xc013('0x7'));var config=require('../../config/environment');var controller=require('./userNotification.controller');router[_0xc013('0x8')]('/',auth[_0xc013('0x9')](),controller['sendUserNotification']);module['exports']=router; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.attributes.js b/server/api/userNotification/userNotification.attributes.js index 3ae5cc2..f8de0b2 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 _0xe74c=['TEXT','STRING','sequelize','exports'];(function(_0x286726,_0x20a337){var _0xcd4fe9=function(_0x4d7da6){while(--_0x4d7da6){_0x286726['push'](_0x286726['shift']());}};_0xcd4fe9(++_0x20a337);}(_0xe74c,0x17e));var _0xce74=function(_0x42245d,_0x51758f){_0x42245d=_0x42245d-0x0;var _0x4b211a=_0xe74c[_0x42245d];return _0x4b211a;};'use strict';var Sequelize=require(_0xce74('0x0'));module[_0xce74('0x1')]={'body':{'type':Sequelize[_0xce74('0x2')]},'senderName':{'type':Sequelize[_0xce74('0x3')]},'recipientsId':{'type':Sequelize['TEXT']},'recipientsDescription':{'type':Sequelize[_0xce74('0x3')]},'beep':{'type':Sequelize['BOOLEAN']}}; \ No newline at end of file +var _0xe770=['TEXT','STRING','BOOLEAN','sequelize','exports'];(function(_0x5d10db,_0x438ddb){var _0x3c4d71=function(_0x23fdb3){while(--_0x23fdb3){_0x5d10db['push'](_0x5d10db['shift']());}};_0x3c4d71(++_0x438ddb);}(_0xe770,0x71));var _0x0e77=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xe770[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require(_0x0e77('0x0'));module[_0x0e77('0x1')]={'body':{'type':Sequelize[_0x0e77('0x2')]},'senderName':{'type':Sequelize['STRING']},'recipientsId':{'type':Sequelize['TEXT']},'recipientsDescription':{'type':Sequelize[_0x0e77('0x3')]},'beep':{'type':Sequelize[_0x0e77('0x4')]}}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.controller.js b/server/api/userNotification/userNotification.controller.js index 44457fd..16cdd73 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 _0xbbb9=['desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','redis','defaults','localhost','./userNotification.socket','register','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','then','destroy','error','stack','name','send','sendUserNotification','body','hasOwnProperty','text','TemplateId','Sequelize','ValidationError','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','view','recipients','Invalid\x20\x27recipients\x27\x20object','chatqueue','faxqueue','openchannelqueue','voicequeue','whatsappqueue','team','user','some','includes','model','toLowerCase','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','fullname','recipientsDescription','isEmpty','beep','SenderId','sortBy','sequelize','transaction','UserNotification','forEach','recipient','emit','catch','findOne','html','Invalid\x20\x27TemplateId\x27\x20parameter','render','startCase','User','ids','queue','replace','Queue','push','all','union','flatten','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','to-csv','lodash','squel','crypto','jsforce'];(function(_0x842f30,_0x5a3981){var _0x24caa8=function(_0x167d3e){while(--_0x167d3e){_0x842f30['push'](_0x842f30['shift']());}};_0x24caa8(++_0x5a3981);}(_0xbbb9,0x187));var _0x9bbb=function(_0x1590e6,_0x5cb128){_0x1590e6=_0x1590e6-0x0;var _0x42b188=_0xbbb9[_0x1590e6];return _0x42b188;};'use strict';var emlformat=require(_0x9bbb('0x0'));var rimraf=require(_0x9bbb('0x1'));var zipdir=require(_0x9bbb('0x2'));var jsonpatch=require(_0x9bbb('0x3'));var rp=require(_0x9bbb('0x4'));var moment=require(_0x9bbb('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x9bbb('0x6'));var path=require(_0x9bbb('0x7'));var sox=require('sox');var csv=require(_0x9bbb('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x9bbb('0x9'));var squel=require(_0x9bbb('0xa'));var crypto=require(_0x9bbb('0xb'));var jsforce=require(_0x9bbb('0xc'));var deskjs=require(_0x9bbb('0xd'));var toCsv=require(_0x9bbb('0x8'));var querystring=require(_0x9bbb('0xe'));var Papa=require(_0x9bbb('0xf'));var Redis=require(_0x9bbb('0x10'));var authService=require(_0x9bbb('0x11'));var qs=require(_0x9bbb('0x12'));var as=require(_0x9bbb('0x13'));var hardwareService=require(_0x9bbb('0x14'));var logger=require(_0x9bbb('0x15'))(_0x9bbb('0x16'));var utils=require(_0x9bbb('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x9bbb('0x18'));var db=require('../../mysqldb')['db'];config[_0x9bbb('0x19')]=_[_0x9bbb('0x1a')](config[_0x9bbb('0x19')],{'host':_0x9bbb('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x9bbb('0x19')]));require(_0x9bbb('0x1c'))[_0x9bbb('0x1d')](socket);function respondWithStatusCode(_0x16173c,_0x3e0370){_0x3e0370=_0x3e0370||0xcc;return function(_0x2df99e){if(_0x2df99e){return _0x16173c[_0x9bbb('0x1e')](_0x3e0370);}return _0x16173c[_0x9bbb('0x1f')](_0x3e0370)[_0x9bbb('0x20')]();};}function respondWithResult(_0x2ae354,_0x10e4bb){_0x10e4bb=_0x10e4bb||0xc8;return function(_0xe2b82){if(_0xe2b82){return _0x2ae354['status'](_0x10e4bb)[_0x9bbb('0x21')](_0xe2b82);}};}function respondWithFilteredResult(_0x2b89db,_0x1a22bb){return function(_0x417fb9){if(_0x417fb9){var _0x37bb8b=typeof _0x1a22bb[_0x9bbb('0x22')]==='undefined'&&typeof _0x1a22bb[_0x9bbb('0x23')]===_0x9bbb('0x24');var _0x3a6e29=_0x417fb9['count'];var _0x58dd10=_0x37bb8b?0x0:_0x1a22bb['offset'];var _0x37d4f9=_0x37bb8b?_0x417fb9[_0x9bbb('0x25')]:_0x1a22bb[_0x9bbb('0x22')]+_0x1a22bb[_0x9bbb('0x23')];var _0x1d4889;if(_0x37d4f9>=_0x3a6e29){_0x37d4f9=_0x3a6e29;_0x1d4889=0xc8;}else{_0x1d4889=0xce;}_0x2b89db[_0x9bbb('0x1f')](_0x1d4889);return _0x2b89db[_0x9bbb('0x26')](_0x9bbb('0x27'),_0x58dd10+'-'+_0x37d4f9+'/'+_0x3a6e29)['json'](_0x417fb9);}return null;};}function patchUpdates(_0x47f4a4){return function(_0x2e73fb){try{jsonpatch[_0x9bbb('0x28')](_0x2e73fb,_0x47f4a4,!![]);}catch(_0x394b07){return BPromise[_0x9bbb('0x29')](_0x394b07);}return _0x2e73fb[_0x9bbb('0x2a')]();};}function saveUpdates(_0x2d6544,_0x41cb41){return function(_0x466bdf){if(_0x466bdf){return _0x466bdf['update'](_0x2d6544)[_0x9bbb('0x2b')](function(_0x1de4b6){return _0x1de4b6;});}return null;};}function removeEntity(_0xd5adfe,_0x1996c7){return function(_0x4676ff){if(_0x4676ff){return _0x4676ff[_0x9bbb('0x2c')]()[_0x9bbb('0x2b')](function(){_0xd5adfe[_0x9bbb('0x1f')](0xcc)[_0x9bbb('0x20')]();});}};}function handleEntityNotFound(_0x6058b7,_0x2b0b7e){return function(_0x3edffa){if(!_0x3edffa){_0x6058b7[_0x9bbb('0x1e')](0x194);}return _0x3edffa;};}function handleError(_0x412261,_0x4471b4){_0x4471b4=_0x4471b4||0x1f4;return function(_0x53325b){logger[_0x9bbb('0x2d')](_0x53325b[_0x9bbb('0x2e')]);if(_0x53325b[_0x9bbb('0x2f')]){delete _0x53325b['name'];}_0x412261[_0x9bbb('0x1f')](_0x4471b4)[_0x9bbb('0x30')](_0x53325b);};}exports[_0x9bbb('0x31')]=function(_0x251845,_0x299311,_0x4efaf6){if(!_0x251845[_0x9bbb('0x32')][_0x9bbb('0x33')](_0x9bbb('0x34'))&&!_0x251845[_0x9bbb('0x32')][_0x9bbb('0x33')](_0x9bbb('0x35'))){throw new db[(_0x9bbb('0x36'))][(_0x9bbb('0x37'))](_0x9bbb('0x38'));}else{if(_0x251845[_0x9bbb('0x32')][_0x9bbb('0x33')]('TemplateId')&&!_0x251845[_0x9bbb('0x32')][_0x9bbb('0x33')](_0x9bbb('0x39'))){throw new db[(_0x9bbb('0x36'))][(_0x9bbb('0x37'))]('Missing\x20\x27view\x27\x20parameter');}if(!_0x251845[_0x9bbb('0x32')][_0x9bbb('0x33')](_0x9bbb('0x3a'))){throw new db[(_0x9bbb('0x36'))]['ValidationError']('Missing\x20\x27recipients\x27\x20parameter');}else{try{var _0x27929e=JSON['parse'](_0x251845['body']['recipients']);}catch(_0x57f096){logger[_0x9bbb('0x2d')](_0x57f096);throw new db[(_0x9bbb('0x36'))][(_0x9bbb('0x37'))](_0x9bbb('0x3b'));}var _0x39446f=[_0x9bbb('0x3c'),_0x9bbb('0x3d'),'mailqueue',_0x9bbb('0x3e'),'smsqueue',_0x9bbb('0x3f'),_0x9bbb('0x40'),_0x9bbb('0x41'),_0x9bbb('0x42')];if(_[_0x9bbb('0x43')](_0x27929e,function(_0x341333){return!_[_0x9bbb('0x44')](_0x39446f,_0x341333[_0x9bbb('0x45')][_0x9bbb('0x46')]());})){throw new db['Sequelize']['ValidationError'](_0x9bbb('0x47'));}}}var _0x46d3ca={};_0x46d3ca['senderName']=_0x251845[_0x9bbb('0x32')][_0x9bbb('0x33')](_0x9bbb('0x48'))?_0x251845[_0x9bbb('0x32')][_0x9bbb('0x48')]:_0x251845[_0x9bbb('0x42')][_0x9bbb('0x49')];_0x46d3ca[_0x9bbb('0x4a')]=_[_0x9bbb('0x4b')](_0x251845[_0x9bbb('0x32')][_0x9bbb('0x4a')])?null:_0x251845[_0x9bbb('0x32')][_0x9bbb('0x4a')];_0x46d3ca[_0x9bbb('0x4c')]=_0x251845[_0x9bbb('0x32')]['beep']||![];_0x46d3ca[_0x9bbb('0x4d')]=_0x251845['user']['id'];return getContent(_0x251845[_0x9bbb('0x32')])[_0x9bbb('0x2b')](function(_0x231928){_0x46d3ca[_0x9bbb('0x32')]=_0x231928;return getRecipients(_0x27929e);})[_0x9bbb('0x2b')](function(_0x20858e){_0x46d3ca['recipientsId']=_[_0x9bbb('0x4e')](_0x20858e)['join'](',');return db[_0x9bbb('0x4f')][_0x9bbb('0x50')](function(_0x2b312d){return db[_0x9bbb('0x51')]['create'](_0x46d3ca,{'raw':!![],'transaction':_0x2b312d})[_0x9bbb('0x2b')](function(_0x163002){var _0x25d69a={'sender':_0x46d3ca['senderName'],'description':_0x46d3ca[_0x9bbb('0x4a')],'content':_0x46d3ca['body'],'beep':_0x46d3ca[_0x9bbb('0x4c')]};_0x20858e[_0x9bbb('0x52')](function(_0x50995a){_0x25d69a[_0x9bbb('0x53')]=_0x50995a;socket[_0x9bbb('0x54')]('userNotification:send',_0x25d69a);});return _0x163002;});});})['then'](respondWithResult(_0x299311,0xc9))[_0x9bbb('0x55')](handleError(_0x299311,null));};function getContent(_0x57e42b){return new BPromise(function(_0x48a18b,_0x101653){if(_0x57e42b['text']){_0x48a18b(_0x57e42b['text']);return;}return db['Template'][_0x9bbb('0x56')]({'attributes':[_0x9bbb('0x57')],'where':{'id':_0x57e42b['TemplateId']},'raw':!![]})[_0x9bbb('0x2b')](function(_0x38b87e){if(!_0x38b87e)throw new db[(_0x9bbb('0x36'))][(_0x9bbb('0x37'))](_0x9bbb('0x58'));var _0x432a24=Mustache[_0x9bbb('0x59')](_0x38b87e[_0x9bbb('0x57')],_0x57e42b['view']);_0x48a18b(_0x432a24);})[_0x9bbb('0x55')](function(_0x4a8a7f){_0x101653(_0x4a8a7f);});});}function getRecipients(_0x4b8ccb){return new BPromise(function(_0x41d4a2,_0x554cc1){var _0x19a97a=[];var _0x1f772d=[];_0x4b8ccb[_0x9bbb('0x52')](function(_0x945a24){var _0x4f0246=_[_0x9bbb('0x5a')](_0x945a24[_0x9bbb('0x45')][_0x9bbb('0x46')]());if(_0x4f0246===_0x9bbb('0x5b')){_0x19a97a=_['union'](_0x19a97a,_0x945a24[_0x9bbb('0x5c')]);}else{if(_['includes'](_0x4f0246,_0x9bbb('0x5d')))_0x4f0246=_0x4f0246[_0x9bbb('0x5e')](_0x9bbb('0x5d'),_0x9bbb('0x5f'));_0x945a24[_0x9bbb('0x5c')][_0x9bbb('0x52')](function(_0x340bd6){_0x1f772d[_0x9bbb('0x60')](getAgents(_0x4f0246,_0x340bd6));});}});return BPromise[_0x9bbb('0x61')](_0x1f772d)[_0x9bbb('0x2b')](function(_0x23dee4){_0x19a97a=_[_0x9bbb('0x62')](_0x19a97a,_[_0x9bbb('0x63')](_0x23dee4));_0x41d4a2(_0x19a97a);})[_0x9bbb('0x55')](function(_0x4c1c7f){_0x554cc1(_0x4c1c7f);});});}function getAgents(_0x470786,_0x4c4e0a){return new BPromise(function(_0x1624b1,_0x37c4dc){return db[_0x470786][_0x9bbb('0x56')]({'where':{'id':_0x4c4e0a}})[_0x9bbb('0x2b')](function(_0x4518b7){return _0x4518b7[_0x9bbb('0x64')]({'attributes':['id'],'raw':!![]})[_0x9bbb('0x2b')](function(_0x745215){var _0x348c11=_['map'](_0x745215,'id');_0x1624b1(_0x348c11);});})[_0x9bbb('0x55')](function(_0x14b5fd){_0x37c4dc(_0x14b5fd);});});} \ No newline at end of file +var _0x2f02=['mailqueue','openchannelqueue','smsqueue','voicequeue','whatsappqueue','team','user','toLowerCase','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','fullname','isEmpty','beep','SenderId','recipientsId','sortBy','join','sequelize','transaction','UserNotification','create','recipientsDescription','forEach','recipient','emit','userNotification:send','catch','Template','html','Invalid\x20\x27TemplateId\x27\x20parameter','render','view','startCase','model','User','union','replace','queue','Queue','ids','all','flatten','findOne','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./userNotification.socket','register','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','name','send','body','hasOwnProperty','text','TemplateId','Sequelize','ValidationError','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','Missing\x20\x27view\x27\x20parameter','recipients','Missing\x20\x27recipients\x27\x20parameter','parse','Invalid\x20\x27recipients\x27\x20object','chatqueue','faxqueue'];(function(_0x47a1a6,_0xc94b73){var _0x25a378=function(_0x49edb0){while(--_0x49edb0){_0x47a1a6['push'](_0x47a1a6['shift']());}};_0x25a378(++_0xc94b73);}(_0x2f02,0x173));var _0x22f0=function(_0x503bc0,_0x12aeee){_0x503bc0=_0x503bc0-0x0;var _0x383246=_0x2f02[_0x503bc0];return _0x383246;};'use strict';var emlformat=require(_0x22f0('0x0'));var rimraf=require(_0x22f0('0x1'));var zipdir=require(_0x22f0('0x2'));var jsonpatch=require(_0x22f0('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x22f0('0x4'));var Mustache=require(_0x22f0('0x5'));var util=require(_0x22f0('0x6'));var path=require(_0x22f0('0x7'));var sox=require(_0x22f0('0x8'));var csv=require(_0x22f0('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x22f0('0xa'));var _=require('lodash');var squel=require(_0x22f0('0xb'));var crypto=require(_0x22f0('0xc'));var jsforce=require(_0x22f0('0xd'));var deskjs=require(_0x22f0('0xe'));var toCsv=require(_0x22f0('0x9'));var querystring=require(_0x22f0('0xf'));var Papa=require(_0x22f0('0x10'));var Redis=require(_0x22f0('0x11'));var authService=require(_0x22f0('0x12'));var qs=require(_0x22f0('0x13'));var as=require(_0x22f0('0x14'));var hardwareService=require(_0x22f0('0x15'));var logger=require(_0x22f0('0x16'))(_0x22f0('0x17'));var utils=require('../../config/utils');var config=require(_0x22f0('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x22f0('0x19'))['db'];config[_0x22f0('0x1a')]=_[_0x22f0('0x1b')](config['redis'],{'host':_0x22f0('0x1c'),'port':0x18eb});var socket=require(_0x22f0('0x1d'))(new Redis(config['redis']));require(_0x22f0('0x1e'))[_0x22f0('0x1f')](socket);function respondWithStatusCode(_0x528d9b,_0x1b39ef){_0x1b39ef=_0x1b39ef||0xcc;return function(_0x3c51bb){if(_0x3c51bb){return _0x528d9b[_0x22f0('0x20')](_0x1b39ef);}return _0x528d9b[_0x22f0('0x21')](_0x1b39ef)[_0x22f0('0x22')]();};}function respondWithResult(_0x36c46d,_0xed4843){_0xed4843=_0xed4843||0xc8;return function(_0x5a3632){if(_0x5a3632){return _0x36c46d['status'](_0xed4843)[_0x22f0('0x23')](_0x5a3632);}};}function respondWithFilteredResult(_0x429baa,_0x51714c){return function(_0x39a57a){if(_0x39a57a){var _0x47ccb9=typeof _0x51714c[_0x22f0('0x24')]==='undefined'&&typeof _0x51714c['limit']===_0x22f0('0x25');var _0x7b9461=_0x39a57a[_0x22f0('0x26')];var _0x188fde=_0x47ccb9?0x0:_0x51714c[_0x22f0('0x24')];var _0x790fa6=_0x47ccb9?_0x39a57a[_0x22f0('0x26')]:_0x51714c['offset']+_0x51714c[_0x22f0('0x27')];var _0x3d0930;if(_0x790fa6>=_0x7b9461){_0x790fa6=_0x7b9461;_0x3d0930=0xc8;}else{_0x3d0930=0xce;}_0x429baa[_0x22f0('0x21')](_0x3d0930);return _0x429baa[_0x22f0('0x28')](_0x22f0('0x29'),_0x188fde+'-'+_0x790fa6+'/'+_0x7b9461)[_0x22f0('0x23')](_0x39a57a);}return null;};}function patchUpdates(_0x10e0cf){return function(_0x12bafd){try{jsonpatch[_0x22f0('0x2a')](_0x12bafd,_0x10e0cf,!![]);}catch(_0x1b2bdf){return BPromise[_0x22f0('0x2b')](_0x1b2bdf);}return _0x12bafd[_0x22f0('0x2c')]();};}function saveUpdates(_0x3a3377,_0x3d129c){return function(_0xcb4ff7){if(_0xcb4ff7){return _0xcb4ff7[_0x22f0('0x2d')](_0x3a3377)[_0x22f0('0x2e')](function(_0xe466e3){return _0xe466e3;});}return null;};}function removeEntity(_0x1f417b,_0xea7bd9){return function(_0x3b3207){if(_0x3b3207){return _0x3b3207[_0x22f0('0x2f')]()[_0x22f0('0x2e')](function(){_0x1f417b['status'](0xcc)[_0x22f0('0x22')]();});}};}function handleEntityNotFound(_0x146266,_0x376e84){return function(_0x506cb0){if(!_0x506cb0){_0x146266[_0x22f0('0x20')](0x194);}return _0x506cb0;};}function handleError(_0x1f25ed,_0xa30e99){_0xa30e99=_0xa30e99||0x1f4;return function(_0x3c8d69){logger[_0x22f0('0x30')](_0x3c8d69['stack']);if(_0x3c8d69[_0x22f0('0x31')]){delete _0x3c8d69[_0x22f0('0x31')];}_0x1f25ed['status'](_0xa30e99)[_0x22f0('0x32')](_0x3c8d69);};}exports['sendUserNotification']=function(_0xff2a82,_0x276c4a,_0x443031){if(!_0xff2a82[_0x22f0('0x33')][_0x22f0('0x34')](_0x22f0('0x35'))&&!_0xff2a82[_0x22f0('0x33')][_0x22f0('0x34')](_0x22f0('0x36'))){throw new db[(_0x22f0('0x37'))][(_0x22f0('0x38'))](_0x22f0('0x39'));}else{if(_0xff2a82[_0x22f0('0x33')][_0x22f0('0x34')](_0x22f0('0x36'))&&!_0xff2a82[_0x22f0('0x33')][_0x22f0('0x34')]('view')){throw new db[(_0x22f0('0x37'))][(_0x22f0('0x38'))](_0x22f0('0x3a'));}if(!_0xff2a82[_0x22f0('0x33')][_0x22f0('0x34')](_0x22f0('0x3b'))){throw new db[(_0x22f0('0x37'))][(_0x22f0('0x38'))](_0x22f0('0x3c'));}else{try{var _0x44f356=JSON[_0x22f0('0x3d')](_0xff2a82[_0x22f0('0x33')][_0x22f0('0x3b')]);}catch(_0x3dd1de){logger[_0x22f0('0x30')](_0x3dd1de);throw new db[(_0x22f0('0x37'))][(_0x22f0('0x38'))](_0x22f0('0x3e'));}var _0x1a41c0=[_0x22f0('0x3f'),_0x22f0('0x40'),_0x22f0('0x41'),_0x22f0('0x42'),_0x22f0('0x43'),_0x22f0('0x44'),_0x22f0('0x45'),_0x22f0('0x46'),_0x22f0('0x47')];if(_['some'](_0x44f356,function(_0x4890da){return!_['includes'](_0x1a41c0,_0x4890da['model'][_0x22f0('0x48')]());})){throw new db[(_0x22f0('0x37'))]['ValidationError'](_0x22f0('0x49'));}}}var _0x26412d={};_0x26412d[_0x22f0('0x4a')]=_0xff2a82[_0x22f0('0x33')][_0x22f0('0x34')](_0x22f0('0x4a'))?_0xff2a82[_0x22f0('0x33')][_0x22f0('0x4a')]:_0xff2a82['user'][_0x22f0('0x4b')];_0x26412d['recipientsDescription']=_[_0x22f0('0x4c')](_0xff2a82[_0x22f0('0x33')]['recipientsDescription'])?null:_0xff2a82[_0x22f0('0x33')]['recipientsDescription'];_0x26412d[_0x22f0('0x4d')]=_0xff2a82['body'][_0x22f0('0x4d')]||![];_0x26412d[_0x22f0('0x4e')]=_0xff2a82[_0x22f0('0x47')]['id'];return getContent(_0xff2a82['body'])[_0x22f0('0x2e')](function(_0x330099){_0x26412d[_0x22f0('0x33')]=_0x330099;return getRecipients(_0x44f356);})[_0x22f0('0x2e')](function(_0x51d6b0){_0x26412d[_0x22f0('0x4f')]=_[_0x22f0('0x50')](_0x51d6b0)[_0x22f0('0x51')](',');return db[_0x22f0('0x52')][_0x22f0('0x53')](function(_0x48a468){return db[_0x22f0('0x54')][_0x22f0('0x55')](_0x26412d,{'raw':!![],'transaction':_0x48a468})[_0x22f0('0x2e')](function(_0x3eb7fe){var _0x53c3f5={'sender':_0x26412d[_0x22f0('0x4a')],'description':_0x26412d[_0x22f0('0x56')],'content':_0x26412d[_0x22f0('0x33')],'beep':_0x26412d[_0x22f0('0x4d')]};_0x51d6b0[_0x22f0('0x57')](function(_0x4f51bc){_0x53c3f5[_0x22f0('0x58')]=_0x4f51bc;socket[_0x22f0('0x59')](_0x22f0('0x5a'),_0x53c3f5);});return _0x3eb7fe;});});})['then'](respondWithResult(_0x276c4a,0xc9))[_0x22f0('0x5b')](handleError(_0x276c4a,null));};function getContent(_0x1faed7){return new BPromise(function(_0xbef58,_0x1e00cc){if(_0x1faed7[_0x22f0('0x35')]){_0xbef58(_0x1faed7[_0x22f0('0x35')]);return;}return db[_0x22f0('0x5c')]['findOne']({'attributes':[_0x22f0('0x5d')],'where':{'id':_0x1faed7['TemplateId']},'raw':!![]})[_0x22f0('0x2e')](function(_0x49b488){if(!_0x49b488)throw new db[(_0x22f0('0x37'))][(_0x22f0('0x38'))](_0x22f0('0x5e'));var _0x585854=Mustache[_0x22f0('0x5f')](_0x49b488[_0x22f0('0x5d')],_0x1faed7[_0x22f0('0x60')]);_0xbef58(_0x585854);})[_0x22f0('0x5b')](function(_0xaf4cec){_0x1e00cc(_0xaf4cec);});});}function getRecipients(_0x13480f){return new BPromise(function(_0x365dda,_0x3cd09a){var _0x4e7ee8=[];var _0x5b8fef=[];_0x13480f['forEach'](function(_0x567fa4){var _0x2d5390=_[_0x22f0('0x61')](_0x567fa4[_0x22f0('0x62')]['toLowerCase']());if(_0x2d5390===_0x22f0('0x63')){_0x4e7ee8=_[_0x22f0('0x64')](_0x4e7ee8,_0x567fa4['ids']);}else{if(_['includes'](_0x2d5390,'queue'))_0x2d5390=_0x2d5390[_0x22f0('0x65')](_0x22f0('0x66'),_0x22f0('0x67'));_0x567fa4[_0x22f0('0x68')][_0x22f0('0x57')](function(_0x452af9){_0x5b8fef['push'](getAgents(_0x2d5390,_0x452af9));});}});return BPromise[_0x22f0('0x69')](_0x5b8fef)['then'](function(_0x393670){_0x4e7ee8=_[_0x22f0('0x64')](_0x4e7ee8,_[_0x22f0('0x6a')](_0x393670));_0x365dda(_0x4e7ee8);})['catch'](function(_0xecb878){_0x3cd09a(_0xecb878);});});}function getAgents(_0x349df7,_0x346dfb){return new BPromise(function(_0x366785,_0x266895){return db[_0x349df7][_0x22f0('0x6b')]({'where':{'id':_0x346dfb}})['then'](function(_0x12a52b){return _0x12a52b[_0x22f0('0x6c')]({'attributes':['id'],'raw':!![]})['then'](function(_0x33a233){var _0x5604e9=_['map'](_0x33a233,'id');_0x366785(_0x5604e9);});})[_0x22f0('0x5b')](function(_0x576f46){_0x266895(_0x576f46);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.events.js b/server/api/userNotification/userNotification.events.js index dc3c578..c43955a 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 _0x0c61=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','UserNotification','setMaxListeners','save','update','remove'];(function(_0xbf8abb,_0x51b616){var _0x329859=function(_0x55acda){while(--_0x55acda){_0xbf8abb['push'](_0xbf8abb['shift']());}};_0x329859(++_0x51b616);}(_0x0c61,0x1c7));var _0x10c6=function(_0x1b02bb,_0x3d9fde){_0x1b02bb=_0x1b02bb-0x0;var _0x131245=_0x0c61[_0x1b02bb];return _0x131245;};'use strict';var EventEmitter=require(_0x10c6('0x0'));var UserNotification=require(_0x10c6('0x1'))['db'][_0x10c6('0x2')];var UserNotificationEvents=new EventEmitter();UserNotificationEvents[_0x10c6('0x3')](0x0);var events={'afterCreate':_0x10c6('0x4'),'afterUpdate':_0x10c6('0x5'),'afterDestroy':_0x10c6('0x6')};function emitEvent(_0xb382b7){return function(_0x1b7f8a,_0x1b9904,_0x2a42bd){UserNotificationEvents[_0x10c6('0x7')](_0xb382b7+':'+_0x1b7f8a['id'],_0x1b7f8a);UserNotificationEvents['emit'](_0xb382b7,_0x1b7f8a);_0x2a42bd(null);};}for(var e in events){if(events[_0x10c6('0x8')](e)){var event=events[e];UserNotification[_0x10c6('0x9')](e,emitEvent(event));}}module[_0x10c6('0xa')]=UserNotificationEvents; \ No newline at end of file +var _0x79b0=['emit','hasOwnProperty','hook','exports','../../mysqldb','UserNotification','setMaxListeners','update','remove'];(function(_0x1ee7e4,_0x4ba132){var _0x4a99aa=function(_0x115d2d){while(--_0x115d2d){_0x1ee7e4['push'](_0x1ee7e4['shift']());}};_0x4a99aa(++_0x4ba132);}(_0x79b0,0x1bd));var _0x079b=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x79b0[_0x2dafbe];return _0x58a45a;};'use strict';var EventEmitter=require('events');var UserNotification=require(_0x079b('0x0'))['db'][_0x079b('0x1')];var UserNotificationEvents=new EventEmitter();UserNotificationEvents[_0x079b('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x079b('0x3'),'afterDestroy':_0x079b('0x4')};function emitEvent(_0x18e18f){return function(_0x40e89b,_0x1995b9,_0x1876fc){UserNotificationEvents[_0x079b('0x5')](_0x18e18f+':'+_0x40e89b['id'],_0x40e89b);UserNotificationEvents['emit'](_0x18e18f,_0x40e89b);_0x1876fc(null);};}for(var e in events){if(events[_0x079b('0x6')](e)){var event=events[e];UserNotification[_0x079b('0x7')](e,emitEvent(event));}}module[_0x079b('0x8')]=UserNotificationEvents; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.model.js b/server/api/userNotification/userNotification.model.js index 96f97f7..c380fa5 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 _0xf609=['userNotifications','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','moment','bluebird','request-promise','../../config/environment','./userNotification.attributes','exports','define','UserNotification'];(function(_0x53fab6,_0x4ef76a){var _0x29e9c4=function(_0x154c75){while(--_0x154c75){_0x53fab6['push'](_0x53fab6['shift']());}};_0x29e9c4(++_0x4ef76a);}(_0xf609,0x18b));var _0x9f60=function(_0x46ce76,_0x392d9e){_0x46ce76=_0x46ce76-0x0;var _0x2263b6=_0xf609[_0x46ce76];return _0x2263b6;};'use strict';var _=require('lodash');var util=require(_0x9f60('0x0'));var logger=require(_0x9f60('0x1'))(_0x9f60('0x2'));var moment=require(_0x9f60('0x3'));var BPromise=require(_0x9f60('0x4'));var rp=require(_0x9f60('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x9f60('0x6'));var attributes=require(_0x9f60('0x7'));module[_0x9f60('0x8')]=function(_0x462e54,_0x12972a){return _0x462e54[_0x9f60('0x9')](_0x9f60('0xa'),attributes,{'tableName':_0x9f60('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x9f60('0xc'),'collate':_0x9f60('0xd')});}; \ No newline at end of file +var _0x1b12=['userNotifications','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','moment','bluebird','path','rimraf','exports','define'];(function(_0x2fa584,_0x20380e){var _0x432e50=function(_0x2de392){while(--_0x2de392){_0x2fa584['push'](_0x2fa584['shift']());}};_0x432e50(++_0x20380e);}(_0x1b12,0x1bf));var _0x21b1=function(_0x365aa4,_0x556d68){_0x365aa4=_0x365aa4-0x0;var _0x175885=_0x1b12[_0x365aa4];return _0x175885;};'use strict';var _=require('lodash');var util=require(_0x21b1('0x0'));var logger=require(_0x21b1('0x1'))(_0x21b1('0x2'));var moment=require(_0x21b1('0x3'));var BPromise=require(_0x21b1('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x21b1('0x5'));var rimraf=require(_0x21b1('0x6'));var config=require('../../config/environment');var attributes=require('./userNotification.attributes');module[_0x21b1('0x7')]=function(_0x32ef1a,_0x576314){return _0x32ef1a[_0x21b1('0x8')]('UserNotification',attributes,{'tableName':_0x21b1('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x21b1('0xa'),'collate':_0x21b1('0xb')});}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.rpc.js b/server/api/userNotification/userNotification.rpc.js index a3276ea..2b56e66 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 _0xfdb1=['localhost','socket.io-emitter','register','request','UserNotification,\x20%s,\x20%s','debug','UserNotification,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xfdb1,0x8f));var _0x1fdb=function(_0x2c4da5,_0x450cd6){_0x2c4da5=_0x2c4da5-0x0;var _0x32f96e=_0xfdb1[_0x2c4da5];return _0x32f96e;};'use strict';var _=require('lodash');var util=require(_0x1fdb('0x0'));var moment=require(_0x1fdb('0x1'));var BPromise=require(_0x1fdb('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1fdb('0x3'));var db=require(_0x1fdb('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x1fdb('0x5'))(_0x1fdb('0x6'));var config=require(_0x1fdb('0x7'));var jayson=require(_0x1fdb('0x8'));var client=jayson[_0x1fdb('0x9')][_0x1fdb('0xa')]({'port':0x232a});config['redis']=_[_0x1fdb('0xb')](config[_0x1fdb('0xc')],{'host':_0x1fdb('0xd'),'port':0x18eb});var socket=require(_0x1fdb('0xe'))(new Redis(config[_0x1fdb('0xc')]));require('./userNotification.socket')[_0x1fdb('0xf')](socket);function respondWithRpcPromise(_0x30a723,_0xc75b03,_0x378f43){return new BPromise(function(_0x2a4064,_0x181cda){return client[_0x1fdb('0x10')](_0x30a723,_0x378f43)['then'](function(_0x4b8aa5){logger['info'](_0x1fdb('0x11'),_0xc75b03,'request\x20sent');logger[_0x1fdb('0x12')](_0x1fdb('0x13'),_0xc75b03,'request\x20sent',JSON[_0x1fdb('0x14')](_0x4b8aa5));if(_0x4b8aa5[_0x1fdb('0x15')]){if(_0x4b8aa5[_0x1fdb('0x15')][_0x1fdb('0x16')]===0x1f4){logger[_0x1fdb('0x15')](_0x1fdb('0x11'),_0xc75b03,_0x4b8aa5[_0x1fdb('0x15')][_0x1fdb('0x17')]);return _0x181cda(_0x4b8aa5[_0x1fdb('0x15')][_0x1fdb('0x17')]);}logger[_0x1fdb('0x15')](_0x1fdb('0x11'),_0xc75b03,_0x4b8aa5[_0x1fdb('0x15')][_0x1fdb('0x17')]);return _0x2a4064(_0x4b8aa5[_0x1fdb('0x15')][_0x1fdb('0x17')]);}else{logger['info'](_0x1fdb('0x11'),_0xc75b03,_0x1fdb('0x18'));_0x2a4064(_0x4b8aa5[_0x1fdb('0x19')][_0x1fdb('0x17')]);}})['catch'](function(_0x18e682){logger[_0x1fdb('0x15')]('UserNotification,\x20%s,\x20%s',_0xc75b03,_0x18e682);_0x181cda(_0x18e682);});});} \ No newline at end of file +var _0xaf1d=['bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./userNotification.socket','request','then','info','UserNotification,\x20%s,\x20%s','debug','UserNotification,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment'];(function(_0x4ee7e,_0x567dcd){var _0x541a27=function(_0x1bb4fd){while(--_0x1bb4fd){_0x4ee7e['push'](_0x4ee7e['shift']());}};_0x541a27(++_0x567dcd);}(_0xaf1d,0x75));var _0xdaf1=function(_0x6f279b,_0x974326){_0x6f279b=_0x6f279b-0x0;var _0x5d7c88=_0xaf1d[_0x6f279b];return _0x5d7c88;};'use strict';var _=require(_0xdaf1('0x0'));var util=require(_0xdaf1('0x1'));var moment=require(_0xdaf1('0x2'));var BPromise=require(_0xdaf1('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xdaf1('0x4'));var db=require(_0xdaf1('0x5'))['db'];var utils=require(_0xdaf1('0x6'));var logger=require(_0xdaf1('0x7'))(_0xdaf1('0x8'));var config=require(_0xdaf1('0x9'));var jayson=require(_0xdaf1('0xa'));var client=jayson[_0xdaf1('0xb')][_0xdaf1('0xc')]({'port':0x232a});config[_0xdaf1('0xd')]=_[_0xdaf1('0xe')](config['redis'],{'host':_0xdaf1('0xf'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xdaf1('0xd')]));require(_0xdaf1('0x10'))['register'](socket);function respondWithRpcPromise(_0xd9a72b,_0xc3e8ac,_0x3754f6){return new BPromise(function(_0x4003f4,_0x148a2c){return client[_0xdaf1('0x11')](_0xd9a72b,_0x3754f6)[_0xdaf1('0x12')](function(_0x21e2f8){logger[_0xdaf1('0x13')](_0xdaf1('0x14'),_0xc3e8ac,'request\x20sent');logger[_0xdaf1('0x15')](_0xdaf1('0x16'),_0xc3e8ac,_0xdaf1('0x17'),JSON[_0xdaf1('0x18')](_0x21e2f8));if(_0x21e2f8['error']){if(_0x21e2f8[_0xdaf1('0x19')][_0xdaf1('0x1a')]===0x1f4){logger['error'](_0xdaf1('0x14'),_0xc3e8ac,_0x21e2f8['error'][_0xdaf1('0x1b')]);return _0x148a2c(_0x21e2f8[_0xdaf1('0x19')][_0xdaf1('0x1b')]);}logger[_0xdaf1('0x19')](_0xdaf1('0x14'),_0xc3e8ac,_0x21e2f8['error'][_0xdaf1('0x1b')]);return _0x4003f4(_0x21e2f8[_0xdaf1('0x19')][_0xdaf1('0x1b')]);}else{logger[_0xdaf1('0x13')]('UserNotification,\x20%s,\x20%s',_0xc3e8ac,_0xdaf1('0x17'));_0x4003f4(_0x21e2f8[_0xdaf1('0x1c')][_0xdaf1('0x1b')]);}})[_0xdaf1('0x1d')](function(_0x5ccfa3){logger[_0xdaf1('0x19')]('UserNotification,\x20%s,\x20%s',_0xc3e8ac,_0x5ccfa3);_0x148a2c(_0x5ccfa3);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.socket.js b/server/api/userNotification/userNotification.socket.js index 6fc2d10..23c5be3 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 _0xef0c=['removeListener','register','length','userNotification:','./userNotification.events','emit'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xef0c,0x1f0));var _0xcef0=function(_0x1a93f6,_0x50fd86){_0x1a93f6=_0x1a93f6-0x0;var _0x41be6a=_0xef0c[_0x1a93f6];return _0x41be6a;};'use strict';var UserNotificationEvents=require(_0xcef0('0x0'));var events=['save','remove','update'];function createListener(_0x206c36,_0x2608fc){return function(_0x3a1e36){_0x2608fc[_0xcef0('0x1')](_0x206c36,_0x3a1e36);};}function removeListener(_0x1a12de,_0x1ce36d){return function(){UserNotificationEvents[_0xcef0('0x2')](_0x1a12de,_0x1ce36d);};}exports[_0xcef0('0x3')]=function(_0x5ac88b){for(var _0x17c08d=0x0,_0x5df3ca=events[_0xcef0('0x4')];_0x17c08d<_0x5df3ca;_0x17c08d++){var _0x9db185=events[_0x17c08d];var _0x1b7402=createListener(_0xcef0('0x5')+_0x9db185,_0x5ac88b);UserNotificationEvents['on'](_0x9db185,_0x1b7402);}}; \ No newline at end of file +var _0x52cd=['emit','removeListener','register','length','userNotification:','save','remove'];(function(_0x32a23c,_0x56e84e){var _0x264203=function(_0x4a3baa){while(--_0x4a3baa){_0x32a23c['push'](_0x32a23c['shift']());}};_0x264203(++_0x56e84e);}(_0x52cd,0x139));var _0xd52c=function(_0x214023,_0x65e22b){_0x214023=_0x214023-0x0;var _0x10cf15=_0x52cd[_0x214023];return _0x10cf15;};'use strict';var UserNotificationEvents=require('./userNotification.events');var events=[_0xd52c('0x0'),_0xd52c('0x1'),'update'];function createListener(_0x24c3ae,_0x3e59e8){return function(_0x51cf17){_0x3e59e8[_0xd52c('0x2')](_0x24c3ae,_0x51cf17);};}function removeListener(_0xba5596,_0x53308b){return function(){UserNotificationEvents[_0xd52c('0x3')](_0xba5596,_0x53308b);};}exports[_0xd52c('0x4')]=function(_0x38fc89){for(var _0x2d035c=0x0,_0x3b83a6=events[_0xd52c('0x5')];_0x2d035c<_0x3b83a6;_0x2d035c++){var _0x3d21cc=events[_0x2d035c];var _0x5498ce=createListener(_0xd52c('0x6')+_0x3d21cc,_0x38fc89);UserNotificationEvents['on'](_0x3d21cc,_0x5498ce);}}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/index.js b/server/api/userOpenchannelQueue/index.js index 9a0f654..22d241c 100644 --- a/server/api/userOpenchannelQueue/index.js +++ b/server/api/userOpenchannelQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x1148db,_0xcc859){var _0x17b465=function(_0x5ddeca){while(--_0x5ddeca){_0x1148db['push'](_0x1148db['shift']());}};_0x17b465(++_0xcc859);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3071('0x0'));var timeout=require(_0x3071('0x1'));var express=require(_0x3071('0x2'));var router=express[_0x3071('0x3')]();var fs_extra=require(_0x3071('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));module[_0x3071('0x7')]=router; \ No newline at end of file +var _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x3b0183,_0xd23f2b){var _0x42ae0c=function(_0x2a9579){while(--_0x2a9579){_0x3b0183['push'](_0x3b0183['shift']());}};_0x42ae0c(++_0xd23f2b);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3071('0x0'));var timeout=require(_0x3071('0x1'));var express=require(_0x3071('0x2'));var router=express[_0x3071('0x3')]();var fs_extra=require(_0x3071('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));module[_0x3071('0x7')]=router; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js index e0d0aef..f1f8152 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 _0x9d9d=['INTEGER','exports'];(function(_0x3822d9,_0x599bd6){var _0x288194=function(_0x57a733){while(--_0x57a733){_0x3822d9['push'](_0x3822d9['shift']());}};_0x288194(++_0x599bd6);}(_0x9d9d,0x129));var _0xd9d9=function(_0x10f0f5,_0x38cfca){_0x10f0f5=_0x10f0f5-0x0;var _0x27e75f=_0x9d9d[_0x10f0f5];return _0x27e75f;};'use strict';var Sequelize=require('sequelize');module[_0xd9d9('0x0')]={'penalty':{'type':Sequelize[_0xd9d9('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0x6dac=['sequelize','exports','INTEGER'];(function(_0x8de54f,_0x271987){var _0x14cba4=function(_0x58ed41){while(--_0x58ed41){_0x8de54f['push'](_0x8de54f['shift']());}};_0x14cba4(++_0x271987);}(_0x6dac,0x16e));var _0xc6da=function(_0xc3769e,_0x1964dc){_0xc3769e=_0xc3769e-0x0;var _0x54afa9=_0x6dac[_0xc3769e];return _0x54afa9;};'use strict';var Sequelize=require(_0xc6da('0x0'));module[_0xc6da('0x1')]={'penalty':{'type':Sequelize[_0xc6da('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.model.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.model.js index 95dda0c..3bcd1b6 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 _0x5254=['bluebird','request-promise','../../config/environment','./userOpenchannelQueue.attributes','exports','define','lodash','util','api','moment'];(function(_0x43e134,_0x20b467){var _0x43c922=function(_0x378fcd){while(--_0x378fcd){_0x43e134['push'](_0x43e134['shift']());}};_0x43c922(++_0x20b467);}(_0x5254,0x100));var _0x4525=function(_0x449845,_0xf46898){_0x449845=_0x449845-0x0;var _0xa009ed=_0x5254[_0x449845];return _0xa009ed;};'use strict';var _=require(_0x4525('0x0'));var util=require(_0x4525('0x1'));var logger=require('../../config/logger')(_0x4525('0x2'));var moment=require(_0x4525('0x3'));var BPromise=require(_0x4525('0x4'));var rp=require(_0x4525('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x4525('0x6'));var attributes=require(_0x4525('0x7'));module[_0x4525('0x8')]=function(_0x3d1de9,_0x477460){return _0x3d1de9[_0x4525('0x9')]('UserOpenchannelQueue',attributes,{'tableName':'user_has_openchannel_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2f17=['lodash','util','../../config/logger','api','moment','bluebird','path','../../config/environment','./userOpenchannelQueue.attributes','exports','UserOpenchannelQueue','user_has_openchannel_queues'];(function(_0x540f9e,_0x23a5c2){var _0x1681b7=function(_0x22b680){while(--_0x22b680){_0x540f9e['push'](_0x540f9e['shift']());}};_0x1681b7(++_0x23a5c2);}(_0x2f17,0x120));var _0x72f1=function(_0x2ca208,_0xf62feb){_0x2ca208=_0x2ca208-0x0;var _0x16f733=_0x2f17[_0x2ca208];return _0x16f733;};'use strict';var _=require(_0x72f1('0x0'));var util=require(_0x72f1('0x1'));var logger=require(_0x72f1('0x2'))(_0x72f1('0x3'));var moment=require(_0x72f1('0x4'));var BPromise=require(_0x72f1('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x72f1('0x6'));var rimraf=require('rimraf');var config=require(_0x72f1('0x7'));var attributes=require(_0x72f1('0x8'));module[_0x72f1('0x9')]=function(_0x3944a5,_0x48b94a){return _0x3944a5['define'](_0x72f1('0xa'),attributes,{'tableName':_0x72f1('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.rpc.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.rpc.js index a0031cf..5a301ff 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 _0x1c77=['jayson/promise','http','request','then','UserOpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','UserOpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment'];(function(_0x17406a,_0x1e2320){var _0x1501ff=function(_0x4b075a){while(--_0x4b075a){_0x17406a['push'](_0x17406a['shift']());}};_0x1501ff(++_0x1e2320);}(_0x1c77,0x13a));var _0x71c7=function(_0x11d95f,_0x34f442){_0x11d95f=_0x11d95f-0x0;var _0x2b1a14=_0x1c77[_0x11d95f];return _0x2b1a14;};'use strict';var _=require(_0x71c7('0x0'));var util=require('util');var moment=require(_0x71c7('0x1'));var BPromise=require(_0x71c7('0x2'));var rs=require(_0x71c7('0x3'));var fs=require('fs');var Redis=require(_0x71c7('0x4'));var db=require(_0x71c7('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x71c7('0x6'))('rpc');var config=require(_0x71c7('0x7'));var jayson=require(_0x71c7('0x8'));var client=jayson['client'][_0x71c7('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x14da1d,_0x590ebf,_0x4a0724){return new BPromise(function(_0x554fa2,_0x112903){return client[_0x71c7('0xa')](_0x14da1d,_0x4a0724)[_0x71c7('0xb')](function(_0x3f35f6){logger['info'](_0x71c7('0xc'),_0x590ebf,_0x71c7('0xd'));logger[_0x71c7('0xe')](_0x71c7('0xf'),_0x590ebf,_0x71c7('0xd'),JSON[_0x71c7('0x10')](_0x3f35f6));if(_0x3f35f6['error']){if(_0x3f35f6[_0x71c7('0x11')][_0x71c7('0x12')]===0x1f4){logger[_0x71c7('0x11')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x590ebf,_0x3f35f6[_0x71c7('0x11')][_0x71c7('0x13')]);return _0x112903(_0x3f35f6['error'][_0x71c7('0x13')]);}logger['error'](_0x71c7('0xc'),_0x590ebf,_0x3f35f6[_0x71c7('0x11')][_0x71c7('0x13')]);return _0x554fa2(_0x3f35f6[_0x71c7('0x11')][_0x71c7('0x13')]);}else{logger[_0x71c7('0x14')](_0x71c7('0xc'),_0x590ebf,'request\x20sent');_0x554fa2(_0x3f35f6[_0x71c7('0x15')]['message']);}})[_0x71c7('0x16')](function(_0x4d4784){logger[_0x71c7('0x11')](_0x71c7('0xc'),_0x590ebf,_0x4d4784);_0x112903(_0x4d4784);});});} \ No newline at end of file +var _0xbe6b=['bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','UserOpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','UserOpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','util'];(function(_0x3f5bbb,_0x217812){var _0x3b67c8=function(_0x39e308){while(--_0x39e308){_0x3f5bbb['push'](_0x3f5bbb['shift']());}};_0x3b67c8(++_0x217812);}(_0xbe6b,0x13a));var _0xbbe6=function(_0xf29b83,_0x5a4f70){_0xf29b83=_0xf29b83-0x0;var _0x47f15d=_0xbe6b[_0xf29b83];return _0x47f15d;};'use strict';var _=require('lodash');var util=require(_0xbbe6('0x0'));var moment=require('moment');var BPromise=require(_0xbbe6('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbbe6('0x2'))['db'];var utils=require(_0xbbe6('0x3'));var logger=require(_0xbbe6('0x4'))(_0xbbe6('0x5'));var config=require('../../config/environment');var jayson=require(_0xbbe6('0x6'));var client=jayson[_0xbbe6('0x7')][_0xbbe6('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5147bc,_0x20725b,_0x2fbab0){return new BPromise(function(_0x3c68bd,_0x34d20e){return client[_0xbbe6('0x9')](_0x5147bc,_0x2fbab0)[_0xbbe6('0xa')](function(_0x53a888){logger[_0xbbe6('0xb')](_0xbbe6('0xc'),_0x20725b,_0xbbe6('0xd'));logger[_0xbbe6('0xe')](_0xbbe6('0xf'),_0x20725b,_0xbbe6('0xd'),JSON[_0xbbe6('0x10')](_0x53a888));if(_0x53a888['error']){if(_0x53a888[_0xbbe6('0x11')][_0xbbe6('0x12')]===0x1f4){logger[_0xbbe6('0x11')](_0xbbe6('0xc'),_0x20725b,_0x53a888[_0xbbe6('0x11')][_0xbbe6('0x13')]);return _0x34d20e(_0x53a888[_0xbbe6('0x11')][_0xbbe6('0x13')]);}logger[_0xbbe6('0x11')](_0xbbe6('0xc'),_0x20725b,_0x53a888['error'][_0xbbe6('0x13')]);return _0x3c68bd(_0x53a888[_0xbbe6('0x11')][_0xbbe6('0x13')]);}else{logger[_0xbbe6('0xb')](_0xbbe6('0xc'),_0x20725b,'request\x20sent');_0x3c68bd(_0x53a888[_0xbbe6('0x14')][_0xbbe6('0x13')]);}})['catch'](function(_0x3985a9){logger[_0xbbe6('0x11')](_0xbbe6('0xc'),_0x20725b,_0x3985a9);_0x34d20e(_0x3985a9);});});} \ No newline at end of file diff --git a/server/api/userProfile/index.js b/server/api/userProfile/index.js index 0b17714..0ee73f8 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 _0xf4b2=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./userProfile.controller','get','isAuthenticated','describe','/:id','show','/:id/sections','getSections','/:id/resources','getResources','post','create','/:id/clone','clone','put','delete','removeSections','exports','multer'];(function(_0x4fd8ea,_0x1df584){var _0x2cc935=function(_0x44eafc){while(--_0x44eafc){_0x4fd8ea['push'](_0x4fd8ea['shift']());}};_0x2cc935(++_0x1df584);}(_0xf4b2,0x67));var _0x2f4b=function(_0x33ca4e,_0x316ccb){_0x33ca4e=_0x33ca4e-0x0;var _0x289be6=_0xf4b2[_0x33ca4e];return _0x289be6;};'use strict';var multer=require(_0x2f4b('0x0'));var util=require('util');var path=require(_0x2f4b('0x1'));var timeout=require(_0x2f4b('0x2'));var express=require(_0x2f4b('0x3'));var router=express[_0x2f4b('0x4')]();var fs_extra=require(_0x2f4b('0x5'));var auth=require(_0x2f4b('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x2f4b('0x7'));var controller=require(_0x2f4b('0x8'));router[_0x2f4b('0x9')]('/',auth[_0x2f4b('0xa')](),controller['index']);router['get']('/describe',auth[_0x2f4b('0xa')](),controller[_0x2f4b('0xb')]);router['get'](_0x2f4b('0xc'),auth[_0x2f4b('0xa')](),controller[_0x2f4b('0xd')]);router[_0x2f4b('0x9')](_0x2f4b('0xe'),auth[_0x2f4b('0xa')](),controller[_0x2f4b('0xf')]);router[_0x2f4b('0x9')](_0x2f4b('0x10'),auth[_0x2f4b('0xa')](),controller[_0x2f4b('0x11')]);router[_0x2f4b('0x12')]('/',auth[_0x2f4b('0xa')](),controller[_0x2f4b('0x13')]);router[_0x2f4b('0x12')](_0x2f4b('0x14'),auth[_0x2f4b('0xa')](),controller[_0x2f4b('0x15')]);router[_0x2f4b('0x12')](_0x2f4b('0xe'),auth[_0x2f4b('0xa')](),controller['addSections']);router[_0x2f4b('0x12')](_0x2f4b('0x10'),auth[_0x2f4b('0xa')](),controller['addResources']);router[_0x2f4b('0x16')](_0x2f4b('0xc'),auth[_0x2f4b('0xa')](),controller['update']);router[_0x2f4b('0x17')](_0x2f4b('0xc'),auth[_0x2f4b('0xa')](),controller['destroy']);router['delete'](_0x2f4b('0xe'),auth[_0x2f4b('0xa')](),controller[_0x2f4b('0x18')]);router[_0x2f4b('0x17')](_0x2f4b('0x10'),auth[_0x2f4b('0xa')](),controller['removeResources']);module[_0x2f4b('0x19')]=router; \ No newline at end of file +var _0x247c=['put','delete','destroy','removeSections','removeResources','exports','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfile.controller','get','isAuthenticated','index','/describe','/:id','/:id/sections','getSections','/:id/resources','getResources','create','post','clone','addSections','addResources'];(function(_0x340df9,_0x2343f8){var _0x47fbc2=function(_0x286d13){while(--_0x286d13){_0x340df9['push'](_0x340df9['shift']());}};_0x47fbc2(++_0x2343f8);}(_0x247c,0x162));var _0xc247=function(_0x311825,_0x40d25f){_0x311825=_0x311825-0x0;var _0x178115=_0x247c[_0x311825];return _0x178115;};'use strict';var multer=require('multer');var util=require(_0xc247('0x0'));var path=require('path');var timeout=require(_0xc247('0x1'));var express=require(_0xc247('0x2'));var router=express[_0xc247('0x3')]();var fs_extra=require(_0xc247('0x4'));var auth=require(_0xc247('0x5'));var interaction=require(_0xc247('0x6'));var config=require(_0xc247('0x7'));var controller=require(_0xc247('0x8'));router[_0xc247('0x9')]('/',auth[_0xc247('0xa')](),controller[_0xc247('0xb')]);router[_0xc247('0x9')](_0xc247('0xc'),auth[_0xc247('0xa')](),controller['describe']);router[_0xc247('0x9')](_0xc247('0xd'),auth[_0xc247('0xa')](),controller['show']);router['get'](_0xc247('0xe'),auth[_0xc247('0xa')](),controller[_0xc247('0xf')]);router[_0xc247('0x9')](_0xc247('0x10'),auth[_0xc247('0xa')](),controller[_0xc247('0x11')]);router['post']('/',auth[_0xc247('0xa')](),controller[_0xc247('0x12')]);router[_0xc247('0x13')]('/:id/clone',auth[_0xc247('0xa')](),controller[_0xc247('0x14')]);router['post'](_0xc247('0xe'),auth['isAuthenticated'](),controller[_0xc247('0x15')]);router[_0xc247('0x13')](_0xc247('0x10'),auth[_0xc247('0xa')](),controller[_0xc247('0x16')]);router[_0xc247('0x17')](_0xc247('0xd'),auth[_0xc247('0xa')](),controller['update']);router[_0xc247('0x18')](_0xc247('0xd'),auth['isAuthenticated'](),controller[_0xc247('0x19')]);router[_0xc247('0x18')](_0xc247('0xe'),auth[_0xc247('0xa')](),controller[_0xc247('0x1a')]);router[_0xc247('0x18')]('/:id/resources',auth[_0xc247('0xa')](),controller[_0xc247('0x1b')]);module[_0xc247('0x1c')]=router; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.attributes.js b/server/api/userProfile/userProfile.attributes.js index 4a9470b..7764056 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 _0x3a0e=['exports','name','STRING','setDataValue','crudPermissions','join','getDataValue','BOOLEAN','sequelize'];(function(_0x46a38b,_0x16ffb5){var _0x346e75=function(_0x34f8d0){while(--_0x34f8d0){_0x46a38b['push'](_0x46a38b['shift']());}};_0x346e75(++_0x16ffb5);}(_0x3a0e,0x6b));var _0xe3a0=function(_0x8b7fd,_0x19500b){_0x8b7fd=_0x8b7fd-0x0;var _0x78e20d=_0x3a0e[_0x8b7fd];return _0x78e20d;};'use strict';var Sequelize=require(_0xe3a0('0x0'));module[_0xe3a0('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xe3a0('0x2')},'crudPermissions':{'type':Sequelize[_0xe3a0('0x3')],'set':function(_0x4ca615){this[_0xe3a0('0x4')](_0xe3a0('0x5'),_0x4ca615?_0x4ca615[_0xe3a0('0x6')](''):[]);},'get':function(){return this[_0xe3a0('0x7')](_0xe3a0('0x5'))?this['getDataValue'](_0xe3a0('0x5'))['split'](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0xe3a0('0x3')],'allowNull':!![]},'privacyEnabled':{'type':Sequelize[_0xe3a0('0x8')],'defaultValue':![]},'downloadAttachments':{'type':Sequelize[_0xe3a0('0x8')],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize[_0xe3a0('0x8')],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize[_0xe3a0('0x8')],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize[_0xe3a0('0x8')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0xe3a0('0x8')],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize[_0xe3a0('0x8')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file +var _0xb13b=['exports','STRING','name','crudPermissions','join','getDataValue','split','BOOLEAN','sequelize'];(function(_0x17925d,_0x46543f){var _0x5492b7=function(_0x413f0b){while(--_0x413f0b){_0x17925d['push'](_0x17925d['shift']());}};_0x5492b7(++_0x46543f);}(_0xb13b,0x131));var _0xbb13=function(_0x1203f,_0x554bbc){_0x1203f=_0x1203f-0x0;var _0x365f0a=_0xb13b[_0x1203f];return _0x365f0a;};'use strict';var Sequelize=require(_0xbb13('0x0'));module[_0xbb13('0x1')]={'name':{'type':Sequelize[_0xbb13('0x2')],'allowNull':![],'unique':_0xbb13('0x3')},'crudPermissions':{'type':Sequelize[_0xbb13('0x2')],'set':function(_0x43832b){this['setDataValue'](_0xbb13('0x4'),_0x43832b?_0x43832b[_0xbb13('0x5')](''):[]);},'get':function(){return this[_0xbb13('0x6')]('crudPermissions')?this[_0xbb13('0x6')]('crudPermissions')[_0xbb13('0x7')](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'privacyEnabled':{'type':Sequelize[_0xbb13('0x8')],'defaultValue':![]},'downloadAttachments':{'type':Sequelize[_0xbb13('0x8')],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize[_0xbb13('0x8')],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize[_0xbb13('0x8')],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize[_0xbb13('0x8')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0xbb13('0x8')],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0xbb13('0x8')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.controller.js b/server/api/userProfile/userProfile.controller.js index 7a7f1cb..a3a7c8c 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 _0xe86e=['subsections','concat','push','findOne','Dashboard','forEach','addResources','bulkCreate','getResources','section','Missing\x20section\x20parameter','No\x20User\x20Profile\x20found\x20for\x20id\x20','eml-format','rimraf','fast-json-patch','moment','mustache','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','defaults','redis','socket.io-emitter','register','sendStatus','status','end','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','index','map','UserProfile','rawAttributes','fieldName','key','model','keys','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','options','includeAll','include','catch','show','params','length','find','create','body','clone','get','omit','createdAt','updatedAt','crudPermissions','sequelize','transaction','each','autoAssociation','UserProfileResource','findAll','sectionId','userProfileId','Resources','describe','UserProfileSection','ids','getSections','enabled','includes','isEmpty'];(function(_0x558a39,_0x2dd4e1){var _0x2280dc=function(_0x12097f){while(--_0x12097f){_0x558a39['push'](_0x558a39['shift']());}};_0x2280dc(++_0x2dd4e1);}(_0xe86e,0xe8));var _0xee86=function(_0x41669a,_0x56a70f){_0x41669a=_0x41669a-0x0;var _0x427693=_0xe86e[_0x41669a];return _0x427693;};'use strict';var emlformat=require(_0xee86('0x0'));var rimraf=require(_0xee86('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xee86('0x2'));var rp=require('request-promise');var moment=require(_0xee86('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xee86('0x4'));var util=require('util');var path=require(_0xee86('0x5'));var sox=require('sox');var csv=require(_0xee86('0x6'));var ejs=require(_0xee86('0x7'));var fs=require('fs');var fs_extra=require(_0xee86('0x8'));var _=require(_0xee86('0x9'));var squel=require(_0xee86('0xa'));var crypto=require(_0xee86('0xb'));var jsforce=require(_0xee86('0xc'));var deskjs=require(_0xee86('0xd'));var toCsv=require(_0xee86('0x6'));var querystring=require(_0xee86('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xee86('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xee86('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xee86('0x11'))(_0xee86('0x12'));var utils=require(_0xee86('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0xee86('0x14'));var db=require(_0xee86('0x15'))['db'];config['redis']=_[_0xee86('0x16')](config[_0xee86('0x17')],{'host':'localhost','port':0x18eb});var socket=require(_0xee86('0x18'))(new Redis(config[_0xee86('0x17')]));require('./userProfile.socket')[_0xee86('0x19')](socket);function respondWithStatusCode(_0x6f59e9,_0x49b9e6){_0x49b9e6=_0x49b9e6||0xcc;return function(_0x2ce536){if(_0x2ce536){return _0x6f59e9[_0xee86('0x1a')](_0x49b9e6);}return _0x6f59e9[_0xee86('0x1b')](_0x49b9e6)[_0xee86('0x1c')]();};}function respondWithResult(_0x428bb9,_0x163164){_0x163164=_0x163164||0xc8;return function(_0x31186a){if(_0x31186a){return _0x428bb9[_0xee86('0x1b')](_0x163164)['json'](_0x31186a);}};}function respondWithFilteredResult(_0x577c6e,_0x478fdd){return function(_0x240ce5){if(_0x240ce5){var _0x20561b=typeof _0x478fdd[_0xee86('0x1d')]===_0xee86('0x1e')&&typeof _0x478fdd['limit']===_0xee86('0x1e');var _0x3035c4=_0x240ce5['count'];var _0x449f2c=_0x20561b?0x0:_0x478fdd[_0xee86('0x1d')];var _0x376f52=_0x20561b?_0x240ce5[_0xee86('0x1f')]:_0x478fdd[_0xee86('0x1d')]+_0x478fdd[_0xee86('0x20')];var _0x1974e8;if(_0x376f52>=_0x3035c4){_0x376f52=_0x3035c4;_0x1974e8=0xc8;}else{_0x1974e8=0xce;}_0x577c6e[_0xee86('0x1b')](_0x1974e8);return _0x577c6e[_0xee86('0x21')](_0xee86('0x22'),_0x449f2c+'-'+_0x376f52+'/'+_0x3035c4)['json'](_0x240ce5);}return null;};}function patchUpdates(_0xa235f2){return function(_0x1c4340){try{jsonpatch[_0xee86('0x23')](_0x1c4340,_0xa235f2,!![]);}catch(_0x1e0af1){return BPromise[_0xee86('0x24')](_0x1e0af1);}return _0x1c4340[_0xee86('0x25')]();};}function saveUpdates(_0x576ec7,_0x371a7d){return function(_0x41958d){if(_0x41958d){return _0x41958d[_0xee86('0x26')](_0x576ec7)[_0xee86('0x27')](function(_0x1c711b){return _0x1c711b;});}return null;};}function removeEntity(_0x4dd9d1,_0x39e327){return function(_0x2a8304){if(_0x2a8304){return _0x2a8304[_0xee86('0x28')]()[_0xee86('0x27')](function(){_0x4dd9d1[_0xee86('0x1b')](0xcc)[_0xee86('0x1c')]();});}};}function handleEntityNotFound(_0x14bf86,_0x3b1889){return function(_0x26d2b2){if(!_0x26d2b2){_0x14bf86[_0xee86('0x1a')](0x194);}return _0x26d2b2;};}function handleError(_0x238e8d,_0x4a555c){_0x4a555c=_0x4a555c||0x1f4;return function(_0x10cc2d){logger['error'](_0x10cc2d[_0xee86('0x29')]);if(_0x10cc2d[_0xee86('0x2a')]){delete _0x10cc2d[_0xee86('0x2a')];}_0x238e8d[_0xee86('0x1b')](_0x4a555c)[_0xee86('0x2b')](_0x10cc2d);};}exports[_0xee86('0x2c')]=function(_0x31a8dc,_0x55cd20){var _0x3cb55d={},_0x12d6fe={},_0x3082c4={'count':0x0,'rows':[]};var _0x47a550=_[_0xee86('0x2d')](db[_0xee86('0x2e')][_0xee86('0x2f')],function(_0x3d7d3f){return{'name':_0x3d7d3f[_0xee86('0x30')],'type':_0x3d7d3f['type'][_0xee86('0x31')]};});_0x12d6fe[_0xee86('0x32')]=_[_0xee86('0x2d')](_0x47a550,_0xee86('0x2a'));_0x12d6fe['query']=_[_0xee86('0x33')](_0x31a8dc[_0xee86('0x34')]);_0x12d6fe[_0xee86('0x35')]=_[_0xee86('0x36')](_0x12d6fe[_0xee86('0x32')],_0x12d6fe[_0xee86('0x34')]);_0x3cb55d['attributes']=_[_0xee86('0x36')](_0x12d6fe['model'],qs[_0xee86('0x37')](_0x31a8dc['query'][_0xee86('0x37')]));_0x3cb55d[_0xee86('0x38')]=_0x3cb55d[_0xee86('0x38')]['length']?_0x3cb55d[_0xee86('0x38')]:_0x12d6fe[_0xee86('0x32')];if(!_0x31a8dc[_0xee86('0x34')][_0xee86('0x39')](_0xee86('0x3a'))){_0x3cb55d[_0xee86('0x20')]=qs['limit'](_0x31a8dc[_0xee86('0x34')]['limit']);_0x3cb55d[_0xee86('0x1d')]=qs[_0xee86('0x1d')](_0x31a8dc['query'][_0xee86('0x1d')]);}_0x3cb55d[_0xee86('0x3b')]=qs[_0xee86('0x3c')](_0x31a8dc['query'][_0xee86('0x3c')]);_0x3cb55d[_0xee86('0x3d')]=qs['filters'](_[_0xee86('0x3e')](_0x31a8dc['query'],_0x12d6fe[_0xee86('0x35')]),_0x47a550);if(_0x31a8dc[_0xee86('0x34')][_0xee86('0x3f')]){_0x3cb55d[_0xee86('0x3d')]=_[_0xee86('0x40')](_0x3cb55d[_0xee86('0x3d')],{'$or':_[_0xee86('0x2d')](_0x47a550,function(_0x3a91d0){if(_0x3a91d0[_0xee86('0x41')]!=='VIRTUAL'){var _0x40b25b={};_0x40b25b[_0x3a91d0[_0xee86('0x2a')]]={'$like':'%'+_0x31a8dc[_0xee86('0x34')][_0xee86('0x3f')]+'%'};return _0x40b25b;}})});}_0x3cb55d=_['merge']({},_0x3cb55d,_0x31a8dc[_0xee86('0x42')]);var _0x19691e={'where':_0x3cb55d[_0xee86('0x3d')]};return db[_0xee86('0x2e')][_0xee86('0x1f')](_0x19691e)['then'](function(_0x22db18){_0x3082c4[_0xee86('0x1f')]=_0x22db18;if(_0x31a8dc[_0xee86('0x34')][_0xee86('0x43')]){_0x3cb55d[_0xee86('0x44')]=[{'all':!![]}];}return db[_0xee86('0x2e')]['findAll'](_0x3cb55d);})[_0xee86('0x27')](function(_0x4de516){_0x3082c4['rows']=_0x4de516;return _0x3082c4;})['then'](respondWithFilteredResult(_0x55cd20,_0x3cb55d))[_0xee86('0x45')](handleError(_0x55cd20,null));};exports[_0xee86('0x46')]=function(_0x1365bf,_0x3c1d3c){var _0x1f427f={'raw':![],'where':{'id':_0x1365bf[_0xee86('0x47')]['id']}},_0x26bc9c={};_0x26bc9c[_0xee86('0x32')]=_[_0xee86('0x33')](db[_0xee86('0x2e')][_0xee86('0x2f')]);_0x26bc9c[_0xee86('0x34')]=_[_0xee86('0x33')](_0x1365bf[_0xee86('0x34')]);_0x26bc9c[_0xee86('0x35')]=_['intersection'](_0x26bc9c[_0xee86('0x32')],_0x26bc9c['query']);_0x1f427f[_0xee86('0x38')]=_[_0xee86('0x36')](_0x26bc9c[_0xee86('0x32')],qs['fields'](_0x1365bf[_0xee86('0x34')][_0xee86('0x37')]));_0x1f427f[_0xee86('0x38')]=_0x1f427f[_0xee86('0x38')][_0xee86('0x48')]?_0x1f427f[_0xee86('0x38')]:_0x26bc9c[_0xee86('0x32')];if(_0x1365bf['query'][_0xee86('0x43')]){_0x1f427f[_0xee86('0x44')]=[{'all':!![]}];}_0x1f427f=_[_0xee86('0x40')]({},_0x1f427f,_0x1365bf[_0xee86('0x42')]);return db['UserProfile'][_0xee86('0x49')](_0x1f427f)[_0xee86('0x27')](handleEntityNotFound(_0x3c1d3c,null))[_0xee86('0x27')](respondWithResult(_0x3c1d3c,null))['catch'](handleError(_0x3c1d3c,null));};exports[_0xee86('0x4a')]=function(_0x14f551,_0x4aee8d){return db[_0xee86('0x2e')]['create'](_0x14f551[_0xee86('0x4b')],{})[_0xee86('0x27')](respondWithResult(_0x4aee8d,0xc9))[_0xee86('0x45')](handleError(_0x4aee8d,null));};exports[_0xee86('0x4c')]=function(_0x57d0e3,_0xc5e826){var _0x873e25={'where':{'id':_0x57d0e3[_0xee86('0x47')]['id']}},_0xa6cd67={};_0xa6cd67[_0xee86('0x32')]=_['keys'](db[_0xee86('0x2e')][_0xee86('0x2f')]);_0x873e25[_0xee86('0x38')]=_[_0xee86('0x36')](_0xa6cd67[_0xee86('0x32')],qs[_0xee86('0x37')](_0x57d0e3[_0xee86('0x34')][_0xee86('0x37')]));_0x873e25[_0xee86('0x38')]=_0x873e25[_0xee86('0x38')]['length']?_0x873e25[_0xee86('0x38')]:_0xa6cd67[_0xee86('0x32')];if(_0x57d0e3[_0xee86('0x34')]['includeAll']){_0x873e25[_0xee86('0x44')]=[{'all':!![]}];}_0x873e25=_[_0xee86('0x40')]({},_0x873e25,_0x57d0e3[_0xee86('0x42')]);return db[_0xee86('0x2e')]['find'](_0x873e25)[_0xee86('0x27')](handleEntityNotFound(_0xc5e826,null))[_0xee86('0x27')](function(_0x35197a){if(_0x35197a){var _0x45adfa=_0x35197a[_0xee86('0x4d')]({'plain':!![]});_0x45adfa=qs[_0xee86('0x4e')](_0x45adfa,['id',_0xee86('0x4f'),_0xee86('0x50'),_0xee86('0x51')]);_0x57d0e3[_0xee86('0x4b')]=_[_0xee86('0x4e')](_0x57d0e3['body'],['id',_0xee86('0x4f'),_0xee86('0x50')]);return db[_0xee86('0x52')][_0xee86('0x53')](function(_0x3e3de2){return db[_0xee86('0x2e')][_0xee86('0x4a')](_[_0xee86('0x40')](_0x45adfa,_0x57d0e3[_0xee86('0x4b')]),{'include':_0x57d0e3['query']['includeAll']?[{'all':!![]}]:undefined,'transaction':_0x3e3de2})[_0xee86('0x27')](function(_0x1fd78c){var _0x4ce670=_0x1fd78c[_0xee86('0x4d')]({'plain':!![]});return db['UserProfileSection']['findAll']({'where':{'userProfileId':_0x57d0e3[_0xee86('0x47')]['id']},'raw':!![]})['then'](function(_0x27223d){if(_0x27223d){return BPromise[_0xee86('0x54')](_0x27223d,function(_0x25b080){return new BPromise(function(_0x119f6b,_0x59ae44){if(_0x25b080['autoAssociation']===null||_0x25b080[_0xee86('0x55')]===0x1)_0x119f6b(null);return db[_0xee86('0x56')][_0xee86('0x57')]({'where':{'sectionId':_0x25b080['id']},'raw':!![]})[_0xee86('0x27')](function(_0x38532f){var _0x4a94bd=_['map'](_0x38532f,function(_0x4988f9){return qs[_0xee86('0x4e')](_0x4988f9,['id',_0xee86('0x4f'),_0xee86('0x50'),_0xee86('0x58')]);});_0x119f6b(_0x4a94bd);})['catch'](function(_0x3efdfa){_0x59ae44(_0x3efdfa);});})['then'](function(_0x534250){var _0x31a6aa=qs[_0xee86('0x4e')](_0x25b080,['id','createdAt',_0xee86('0x50')]);_0x31a6aa[_0xee86('0x59')]=_0x4ce670['id'];if(_0x534250)_0x31a6aa[_0xee86('0x5a')]=_0x534250;return _0x31a6aa;})[_0xee86('0x27')](function(_0x40e647){return db['UserProfileSection'][_0xee86('0x4a')](_0x40e647,{'include':[{'model':db[_0xee86('0x56')],'as':_0xee86('0x5a')}],'raw':!![],'transaction':_0x3e3de2});});})[_0xee86('0x27')](function(){return _0x4ce670;});}});});});}})[_0xee86('0x27')](respondWithResult(_0xc5e826,0xc9))[_0xee86('0x45')](handleError(_0xc5e826,null));};exports[_0xee86('0x26')]=function(_0x156932,_0x31097a){if(_0x156932[_0xee86('0x4b')]['id']){delete _0x156932[_0xee86('0x4b')]['id'];}return db[_0xee86('0x2e')][_0xee86('0x49')]({'where':{'id':_0x156932[_0xee86('0x47')]['id']}})[_0xee86('0x27')](handleEntityNotFound(_0x31097a,null))[_0xee86('0x27')](saveUpdates(_0x156932[_0xee86('0x4b')],null))['then'](respondWithResult(_0x31097a,null))[_0xee86('0x45')](handleError(_0x31097a,null));};exports[_0xee86('0x28')]=function(_0x545541,_0x2b73b4){return db[_0xee86('0x2e')][_0xee86('0x49')]({'where':{'id':_0x545541[_0xee86('0x47')]['id']}})[_0xee86('0x27')](handleEntityNotFound(_0x2b73b4,null))['then'](removeEntity(_0x2b73b4,null))[_0xee86('0x45')](handleError(_0x2b73b4,null));};exports[_0xee86('0x5b')]=function(_0x34b411,_0x28b9c3){return db['UserProfile'][_0xee86('0x5b')]()[_0xee86('0x27')](respondWithResult(_0x28b9c3,null))[_0xee86('0x45')](handleError(_0x28b9c3,null));};exports['addSections']=function(_0x4e21ba,_0x551624){var _0x56c736=_0x4e21ba[_0xee86('0x4b')];return db[_0xee86('0x2e')][_0xee86('0x49')]({'where':{'id':_0x4e21ba['params']['id']}})[_0xee86('0x27')](handleEntityNotFound(_0x551624,null))[_0xee86('0x27')](function(_0x506592){if(_0x506592){return db['sequelize'][_0xee86('0x53')](function(_0x4be50e){return db[_0xee86('0x5c')][_0xee86('0x28')]({'where':{'userProfileId':_0x4e21ba[_0xee86('0x47')]['id'],'sectionId':_[_0xee86('0x2d')](_0x56c736,function(_0x34b206){return _0x34b206[_0xee86('0x58')];})},'transaction':_0x4be50e})[_0xee86('0x27')](function(){var _0x1cab51=_[_0xee86('0x2d')](_0x56c736,function(_0x5ac058){_0x5ac058[_0xee86('0x59')]=_0x4e21ba[_0xee86('0x47')]['id'];return _0x5ac058;});var _0x57883e=[];return BPromise[_0xee86('0x54')](_0x1cab51,function(_0x352550){return db[_0xee86('0x5c')]['create'](_0x352550,{'include':[{'model':db[_0xee86('0x56')],'as':'Resources'}],'raw':!![],'transaction':_0x4be50e})[_0xee86('0x27')](function(_0x3f235e){_0x57883e['push'](_0x3f235e[_0xee86('0x4d')]({'plain':!![]}));});})['then'](function(){return _0x57883e;});});});}})[_0xee86('0x27')](function(_0x2b0fa6){return _0x2b0fa6;})[_0xee86('0x27')](respondWithResult(_0x551624,null))[_0xee86('0x45')](handleError(_0x551624,null));};exports['removeSections']=function(_0x4960e5,_0x4ebae4){var _0x76f541;return db['UserProfile'][_0xee86('0x49')]({'where':{'id':_0x4960e5[_0xee86('0x47')]['id']},'attributes':['id','name']})[_0xee86('0x27')](handleEntityNotFound(_0x4ebae4,null))['then'](function(_0x814947){if(_0x814947){_0x76f541=_0x814947;return db[_0xee86('0x5c')]['destroy']({'where':{'userProfileId':_0x4960e5[_0xee86('0x47')]['id'],'sectionId':_0x4960e5[_0xee86('0x34')][_0xee86('0x5d')]}});}})[_0xee86('0x27')](function(){return _0x76f541;})[_0xee86('0x27')](respondWithStatusCode(_0x4ebae4,null))[_0xee86('0x45')](handleError(_0x4ebae4,null));};exports[_0xee86('0x5e')]=function(_0x5e1254,_0x195bdd){var _0x33284b=[];var _0xe08894=[];return db[_0xee86('0x5c')][_0xee86('0x57')]({'where':{'userProfileId':_0x5e1254[_0xee86('0x47')]['id']},'raw':!![]})[_0xee86('0x27')](function(_0x28c4af){_0x33284b=_['filter'](_0x28c4af,function(_0x570cb8){return _0x570cb8[_0xee86('0x5f')]===0x1||_[_0xee86('0x60')]([0x3eb,0x709],_0x570cb8[_0xee86('0x58')]);});if(!_[_0xee86('0x61')](_0x33284b)){return _[_0xee86('0x2d')](_0x33284b,function(_0x1f459a){return _0x1f459a[_0xee86('0x58')];});}else{return;}})[_0xee86('0x27')](function(_0x2b4462){if(_0x2b4462)_0xe08894=_0x2b4462;if(_['includes'](_0xe08894,0x64)){var _0x10b091=_[_0xee86('0x49')](_0x33284b,{'sectionId':0x64});return hasDefaultDashboard(_0x10b091)[_0xee86('0x27')](function(_0x464633){return _[_0xee86('0x2d')](_0x33284b,function(_0x42f9f3){if(_0x42f9f3['sectionId']===0x64){_0x42f9f3[_0xee86('0x62')]=_0x464633;}return _0x42f9f3;});});}else{return;}})[_0xee86('0x27')](function(_0x32a7d1){if(_0x32a7d1)_0x33284b=_0x32a7d1;if(_[_0xee86('0x60')](_0xe08894,0x3eb)){var _0x487a9a=_[_0xee86('0x49')](_0x33284b,{'sectionId':0x3eb});return getCustomDashboards(_0x487a9a)['then'](function(_0x17b248){return _[_0xee86('0x2d')](_0x33284b,function(_0x15edc3){if(_0x487a9a[_0xee86('0x5f')]){if(_0x15edc3[_0xee86('0x58')]===0x3eb){_0x15edc3[_0xee86('0x62')]=_0x17b248;}}else{if(_0x15edc3['sectionId']===0x64){if(!_0x15edc3[_0xee86('0x62')]){_0x15edc3[_0xee86('0x62')]=[];}_0x15edc3[_0xee86('0x62')]=_0x15edc3[_0xee86('0x62')][_0xee86('0x63')](_0x17b248);}}return _0x15edc3;});});}else{return;}})['then'](function(_0x5370a4){if(_0x5370a4)_0x33284b=_0x5370a4;if(_['includes'](_0xe08894,0x709)){var _0x7baaae=_[_0xee86('0x49')](_0x33284b,{'sectionId':0x709});return getPlugins(_0x7baaae)['then'](function(_0x3df464){if(_0x7baaae[_0xee86('0x5f')]){return _[_0xee86('0x2d')](_0x33284b,function(_0x6a9eb7){if(_0x6a9eb7[_0xee86('0x58')]===0x709){_0x6a9eb7[_0xee86('0x62')]=_0x3df464;}return _0x6a9eb7;});}else{var _0x48f378={'sectionId':0x76c,'enabled':0x1,'subsections':_0x3df464};var _0x5e9b32=_[_0xee86('0x2d')](_0x33284b);_0x5e9b32[_0xee86('0x64')](_0x48f378);return _0x5e9b32;}});}else{return;}})[_0xee86('0x27')](function(_0x2b16f8){if(_0x2b16f8)_0x33284b=_0x2b16f8;return _[_0xee86('0x3f')](_0x33284b,['enabled',0x1]);})[_0xee86('0x27')](respondWithResult(_0x195bdd,null))[_0xee86('0x45')](handleError(_0x195bdd,null));};function hasDefaultDashboard(_0x349558){var _0x18ef58=[0x65];return new BPromise(function(_0x48e9d9,_0x42d5c9){try{if(_0x349558[_0xee86('0x55')]){_0x48e9d9(_0x18ef58);}else{return db[_0xee86('0x56')][_0xee86('0x65')]({'where':{'sectionId':_0x349558['id']},'raw':!![]})[_0xee86('0x27')](function(_0x34be32){_0x34be32?_0x48e9d9(_0x18ef58):_0x48e9d9();});}}catch(_0xd84b0f){_0x42d5c9(_0xd84b0f);}});}function getCustomDashboards(_0x3c2773){var _0x287e64=[];return new BPromise(function(_0x332ec0,_0x58f902){try{if(_0x3c2773[_0xee86('0x55')]){return db[_0xee86('0x66')]['findAll']({'raw':!![]})[_0xee86('0x27')](function(_0x5fb348){_0x5fb348[_0xee86('0x67')](function(_0x3c8864){_0x287e64[_0xee86('0x64')](_0x3c8864['id']+0x1869f);});_0x332ec0(_0x287e64);});}else{return db['UserProfileResource']['findAll']({'where':{'sectionId':_0x3c2773['id']},'raw':!![]})['then'](function(_0x2068b5){_0x2068b5['forEach'](function(_0x8ff72f){_0x287e64['push'](_0x8ff72f['resourceId']+0x1869f);});_0x332ec0(_0x287e64);});}}catch(_0x313b07){_0x58f902(_0x313b07);}});}function getPlugins(_0x10b57a){var _0x152dda=[];return new BPromise(function(_0x3566e8,_0x3ca12a){try{if(_0x10b57a[_0xee86('0x55')]){return db['Plugin'][_0xee86('0x57')]({'raw':!![]})[_0xee86('0x27')](function(_0x3a081c){_0x3a081c['forEach'](function(_0x4ae413){_0x152dda[_0xee86('0x64')](_0x4ae413['id']+0x15b38);});_0x3566e8(_0x152dda);});}else{return db[_0xee86('0x56')][_0xee86('0x57')]({'where':{'sectionId':_0x10b57a['id']},'raw':!![]})['then'](function(_0x3c7450){_0x3c7450['forEach'](function(_0x38c5a7){_0x152dda[_0xee86('0x64')](_0x38c5a7['resourceId']+0x15b38);});_0x3566e8(_0x152dda);});}}catch(_0x43cf5f){_0x3ca12a(_0x43cf5f);}});}exports[_0xee86('0x68')]=function(_0x52a924,_0x44df6e){return db['UserProfile']['find']({'where':{'id':_0x52a924[_0xee86('0x47')]['id']}})[_0xee86('0x27')](handleEntityNotFound(_0x44df6e,null))[_0xee86('0x27')](function(_0x9091f6){if(_0x9091f6){return db['sequelize'][_0xee86('0x53')](function(_0x103ea5){return db[_0xee86('0x5c')][_0xee86('0x57')]({'where':{'userProfileId':_0x52a924[_0xee86('0x47')]['id']},'attributes':['id'],'raw':!![]})[_0xee86('0x27')](function(_0x42703d){if(_0x42703d){return db[_0xee86('0x5c')]['destroy']({'where':{'userProfileId':_0x52a924['params']['id'],'id':_['map'](_0x42703d,function(_0x70bc4a){return _0x70bc4a['id'];})},'transaction':_0x103ea5});}})[_0xee86('0x27')](function(_0x26e699){var _0x2e79ba=_[_0xee86('0x2d')](_0x52a924[_0xee86('0x4b')],function(_0x272a96){_0x272a96[_0xee86('0x59')]=_0x52a924[_0xee86('0x47')]['id'];return _0x272a96;});return db[_0xee86('0x5c')][_0xee86('0x69')](_0x2e79ba,{'raw':!![],'transaction':_0x103ea5});})[_0xee86('0x27')](function(_0x2ad02e){var _0x399397=_['filter'](_[_0xee86('0x2d')](_0x2ad02e,function(_0x2774d3){return _0x2774d3[_0xee86('0x4d')]({'plain':!![]});}),{'includeAll':![]});if(_0x399397){return db[_0xee86('0x5c')][_0xee86('0x57')]({'where':{'userProfileId':_0x52a924[_0xee86('0x47')]['id'],'sectionId':_[_0xee86('0x2d')](_0x399397,function(_0x10b70c){return _0x10b70c['sectionId'];})},'attributes':['id',_0xee86('0x58')],'raw':!![]})['then'](function(_0x8d3579){var _0x201cf7=_[_0xee86('0x2d')](_0x52a924[_0xee86('0x4b')],function(_0xf45c9a){_0xf45c9a[_0xee86('0x59')]=_0x52a924['params']['id'];return _0xf45c9a;});return db[_0xee86('0x56')]['bulkCreate'](_0x201cf7,{'raw':!![],'transaction':_0x103ea5});});}})[_0xee86('0x45')](handleError(_0x44df6e,null));});}})['then'](function(_0x43893c){var _0x1c7686=_[_0xee86('0x2d')](_0x43893c,function(_0x1209fb){return _0x1209fb[_0xee86('0x4d')]({'plain':!![]});});})[_0xee86('0x27')](respondWithResult(_0x44df6e,null))[_0xee86('0x45')](handleError(_0x44df6e,null));};exports['removeResources']=function(_0x432912,_0x5a1d8b,_0x49c47a){return db[_0xee86('0x2e')][_0xee86('0x49')]({'where':{'id':_0x432912['params']['id']}})['then'](handleEntityNotFound(_0x5a1d8b,null))[_0xee86('0x27')](function(_0x153dea){if(_0x153dea){return _0x153dea['removeResources'](_0x432912[_0xee86('0x34')]['ids']);}})['then'](respondWithStatusCode(_0x5a1d8b,null))[_0xee86('0x45')](handleError(_0x5a1d8b,null));};exports[_0xee86('0x6a')]=function(_0x40d58a,_0xdfaae9){var _0xf4af08={};if(!_0x40d58a[_0xee86('0x34')][_0xee86('0x6b')])throw new Error(_0xee86('0x6c'));if(!_0x40d58a[_0xee86('0x34')][_0xee86('0x39')](_0xee86('0x3a'))){_0xf4af08[_0xee86('0x20')]=qs[_0xee86('0x20')](_0x40d58a[_0xee86('0x34')][_0xee86('0x20')]);_0xf4af08[_0xee86('0x1d')]=qs['offset'](_0x40d58a[_0xee86('0x34')][_0xee86('0x1d')]);}return db[_0xee86('0x2e')]['find']({'where':{'id':_0x40d58a['params']['id']}})['then'](function(_0x24fd71){if(!_0x24fd71)throw new Error(_0xee86('0x6d')+_0x40d58a['params']['id']);return db['UserProfile'][_0xee86('0x6a')](_0x40d58a);})[_0xee86('0x27')](respondWithFilteredResult(_0xdfaae9,_0xf4af08))['catch'](handleError(_0xdfaae9,null));}; \ No newline at end of file +var _0x297e=['concat','findOne','Dashboard','push','forEach','resourceId','Plugin','bulkCreate','removeResources','getResources','section','Missing\x20section\x20parameter','No\x20User\x20Profile\x20found\x20for\x20id\x20','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./userProfile.socket','register','status','end','json','undefined','limit','count','offset','Content-Range','apply','then','sendStatus','error','stack','name','send','index','UserProfile','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','map','VIRTUAL','options','includeAll','include','rows','catch','show','params','rawAttributes','find','create','body','clone','get','omit','createdAt','updatedAt','crudPermissions','sequelize','UserProfileSection','findAll','autoAssociation','UserProfileResource','userProfileId','Resources','update','destroy','describe','transaction','each','ids','getSections','enabled','includes','isEmpty','sectionId','subsections'];(function(_0x1258a4,_0x3849bc){var _0xf3c975=function(_0x5191bf){while(--_0x5191bf){_0x1258a4['push'](_0x1258a4['shift']());}};_0xf3c975(++_0x3849bc);}(_0x297e,0xf7));var _0xe297=function(_0x178e48,_0x3c9509){_0x178e48=_0x178e48-0x0;var _0x440d7e=_0x297e[_0x178e48];return _0x440d7e;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xe297('0x0'));var jsonpatch=require(_0xe297('0x1'));var rp=require(_0xe297('0x2'));var moment=require(_0xe297('0x3'));var BPromise=require(_0xe297('0x4'));var Mustache=require(_0xe297('0x5'));var util=require('util');var path=require(_0xe297('0x6'));var sox=require(_0xe297('0x7'));var csv=require(_0xe297('0x8'));var ejs=require(_0xe297('0x9'));var fs=require('fs');var fs_extra=require(_0xe297('0xa'));var _=require(_0xe297('0xb'));var squel=require(_0xe297('0xc'));var crypto=require(_0xe297('0xd'));var jsforce=require(_0xe297('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xe297('0xf'));var Papa=require(_0xe297('0x10'));var Redis=require(_0xe297('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xe297('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe297('0x13'));var logger=require(_0xe297('0x14'))(_0xe297('0x15'));var utils=require(_0xe297('0x16'));var config=require(_0xe297('0x17'));var licenseUtil=require(_0xe297('0x18'));var db=require('../../mysqldb')['db'];config[_0xe297('0x19')]=_[_0xe297('0x1a')](config[_0xe297('0x19')],{'host':_0xe297('0x1b'),'port':0x18eb});var socket=require(_0xe297('0x1c'))(new Redis(config[_0xe297('0x19')]));require(_0xe297('0x1d'))[_0xe297('0x1e')](socket);function respondWithStatusCode(_0x4788a0,_0x58890f){_0x58890f=_0x58890f||0xcc;return function(_0x47d1ef){if(_0x47d1ef){return _0x4788a0['sendStatus'](_0x58890f);}return _0x4788a0[_0xe297('0x1f')](_0x58890f)[_0xe297('0x20')]();};}function respondWithResult(_0x40b358,_0x2bf2f9){_0x2bf2f9=_0x2bf2f9||0xc8;return function(_0x2cdaf2){if(_0x2cdaf2){return _0x40b358[_0xe297('0x1f')](_0x2bf2f9)[_0xe297('0x21')](_0x2cdaf2);}};}function respondWithFilteredResult(_0x5befc5,_0x522c78){return function(_0x949589){if(_0x949589){var _0xa9690b=typeof _0x522c78['offset']===_0xe297('0x22')&&typeof _0x522c78[_0xe297('0x23')]===_0xe297('0x22');var _0x101e29=_0x949589[_0xe297('0x24')];var _0x1d2fd5=_0xa9690b?0x0:_0x522c78[_0xe297('0x25')];var _0xcdb9b5=_0xa9690b?_0x949589[_0xe297('0x24')]:_0x522c78['offset']+_0x522c78['limit'];var _0xfeda95;if(_0xcdb9b5>=_0x101e29){_0xcdb9b5=_0x101e29;_0xfeda95=0xc8;}else{_0xfeda95=0xce;}_0x5befc5[_0xe297('0x1f')](_0xfeda95);return _0x5befc5['set'](_0xe297('0x26'),_0x1d2fd5+'-'+_0xcdb9b5+'/'+_0x101e29)[_0xe297('0x21')](_0x949589);}return null;};}function patchUpdates(_0x53a422){return function(_0x189cb7){try{jsonpatch[_0xe297('0x27')](_0x189cb7,_0x53a422,!![]);}catch(_0x2ead3e){return BPromise['reject'](_0x2ead3e);}return _0x189cb7['save']();};}function saveUpdates(_0x7a01cf,_0x4e2ab4){return function(_0x4c1140){if(_0x4c1140){return _0x4c1140['update'](_0x7a01cf)[_0xe297('0x28')](function(_0x37ee2a){return _0x37ee2a;});}return null;};}function removeEntity(_0x4194cc,_0x3f86c7){return function(_0x121b2b){if(_0x121b2b){return _0x121b2b['destroy']()[_0xe297('0x28')](function(){_0x4194cc[_0xe297('0x1f')](0xcc)[_0xe297('0x20')]();});}};}function handleEntityNotFound(_0x1b1b5a,_0x128cae){return function(_0x15c60c){if(!_0x15c60c){_0x1b1b5a[_0xe297('0x29')](0x194);}return _0x15c60c;};}function handleError(_0x315bfa,_0xc2af74){_0xc2af74=_0xc2af74||0x1f4;return function(_0x4e7614){logger[_0xe297('0x2a')](_0x4e7614[_0xe297('0x2b')]);if(_0x4e7614[_0xe297('0x2c')]){delete _0x4e7614[_0xe297('0x2c')];}_0x315bfa[_0xe297('0x1f')](_0xc2af74)[_0xe297('0x2d')](_0x4e7614);};}exports[_0xe297('0x2e')]=function(_0x3a2230,_0x3d88fc){var _0x227f75={},_0x43a837={},_0x27fb3a={'count':0x0,'rows':[]};var _0x1b8c84=_['map'](db[_0xe297('0x2f')]['rawAttributes'],function(_0x2d43ae){return{'name':_0x2d43ae[_0xe297('0x30')],'type':_0x2d43ae[_0xe297('0x31')]['key']};});_0x43a837[_0xe297('0x32')]=_['map'](_0x1b8c84,_0xe297('0x2c'));_0x43a837[_0xe297('0x33')]=_[_0xe297('0x34')](_0x3a2230[_0xe297('0x33')]);_0x43a837[_0xe297('0x35')]=_[_0xe297('0x36')](_0x43a837[_0xe297('0x32')],_0x43a837[_0xe297('0x33')]);_0x227f75[_0xe297('0x37')]=_[_0xe297('0x36')](_0x43a837[_0xe297('0x32')],qs['fields'](_0x3a2230[_0xe297('0x33')][_0xe297('0x38')]));_0x227f75['attributes']=_0x227f75[_0xe297('0x37')][_0xe297('0x39')]?_0x227f75[_0xe297('0x37')]:_0x43a837[_0xe297('0x32')];if(!_0x3a2230[_0xe297('0x33')][_0xe297('0x3a')](_0xe297('0x3b'))){_0x227f75[_0xe297('0x23')]=qs['limit'](_0x3a2230[_0xe297('0x33')][_0xe297('0x23')]);_0x227f75[_0xe297('0x25')]=qs[_0xe297('0x25')](_0x3a2230[_0xe297('0x33')][_0xe297('0x25')]);}_0x227f75[_0xe297('0x3c')]=qs['sort'](_0x3a2230['query'][_0xe297('0x3d')]);_0x227f75[_0xe297('0x3e')]=qs['filters'](_[_0xe297('0x3f')](_0x3a2230[_0xe297('0x33')],_0x43a837[_0xe297('0x35')]),_0x1b8c84);if(_0x3a2230['query'][_0xe297('0x40')]){_0x227f75['where']=_[_0xe297('0x41')](_0x227f75[_0xe297('0x3e')],{'$or':_[_0xe297('0x42')](_0x1b8c84,function(_0x45754b){if(_0x45754b[_0xe297('0x31')]!==_0xe297('0x43')){var _0x5e47c9={};_0x5e47c9[_0x45754b[_0xe297('0x2c')]]={'$like':'%'+_0x3a2230[_0xe297('0x33')][_0xe297('0x40')]+'%'};return _0x5e47c9;}})});}_0x227f75=_[_0xe297('0x41')]({},_0x227f75,_0x3a2230[_0xe297('0x44')]);var _0x3b72d0={'where':_0x227f75[_0xe297('0x3e')]};return db['UserProfile'][_0xe297('0x24')](_0x3b72d0)[_0xe297('0x28')](function(_0x1e7039){_0x27fb3a['count']=_0x1e7039;if(_0x3a2230['query'][_0xe297('0x45')]){_0x227f75[_0xe297('0x46')]=[{'all':!![]}];}return db[_0xe297('0x2f')]['findAll'](_0x227f75);})[_0xe297('0x28')](function(_0x30cb0d){_0x27fb3a[_0xe297('0x47')]=_0x30cb0d;return _0x27fb3a;})[_0xe297('0x28')](respondWithFilteredResult(_0x3d88fc,_0x227f75))[_0xe297('0x48')](handleError(_0x3d88fc,null));};exports[_0xe297('0x49')]=function(_0x53b851,_0x3c0e00){var _0x12de9b={'raw':![],'where':{'id':_0x53b851[_0xe297('0x4a')]['id']}},_0x27fd13={};_0x27fd13[_0xe297('0x32')]=_['keys'](db['UserProfile'][_0xe297('0x4b')]);_0x27fd13[_0xe297('0x33')]=_['keys'](_0x53b851[_0xe297('0x33')]);_0x27fd13[_0xe297('0x35')]=_[_0xe297('0x36')](_0x27fd13[_0xe297('0x32')],_0x27fd13[_0xe297('0x33')]);_0x12de9b[_0xe297('0x37')]=_[_0xe297('0x36')](_0x27fd13[_0xe297('0x32')],qs[_0xe297('0x38')](_0x53b851[_0xe297('0x33')]['fields']));_0x12de9b[_0xe297('0x37')]=_0x12de9b[_0xe297('0x37')][_0xe297('0x39')]?_0x12de9b[_0xe297('0x37')]:_0x27fd13[_0xe297('0x32')];if(_0x53b851[_0xe297('0x33')][_0xe297('0x45')]){_0x12de9b[_0xe297('0x46')]=[{'all':!![]}];}_0x12de9b=_['merge']({},_0x12de9b,_0x53b851[_0xe297('0x44')]);return db['UserProfile'][_0xe297('0x4c')](_0x12de9b)[_0xe297('0x28')](handleEntityNotFound(_0x3c0e00,null))['then'](respondWithResult(_0x3c0e00,null))[_0xe297('0x48')](handleError(_0x3c0e00,null));};exports[_0xe297('0x4d')]=function(_0x55c53c,_0x5e837b){return db[_0xe297('0x2f')][_0xe297('0x4d')](_0x55c53c[_0xe297('0x4e')],{})[_0xe297('0x28')](respondWithResult(_0x5e837b,0xc9))[_0xe297('0x48')](handleError(_0x5e837b,null));};exports[_0xe297('0x4f')]=function(_0x2dad99,_0x21dca5){var _0x4d5afa={'where':{'id':_0x2dad99[_0xe297('0x4a')]['id']}},_0x1c1cfe={};_0x1c1cfe[_0xe297('0x32')]=_['keys'](db['UserProfile'][_0xe297('0x4b')]);_0x4d5afa[_0xe297('0x37')]=_[_0xe297('0x36')](_0x1c1cfe['model'],qs[_0xe297('0x38')](_0x2dad99[_0xe297('0x33')][_0xe297('0x38')]));_0x4d5afa[_0xe297('0x37')]=_0x4d5afa['attributes'][_0xe297('0x39')]?_0x4d5afa['attributes']:_0x1c1cfe['model'];if(_0x2dad99[_0xe297('0x33')][_0xe297('0x45')]){_0x4d5afa['include']=[{'all':!![]}];}_0x4d5afa=_[_0xe297('0x41')]({},_0x4d5afa,_0x2dad99['options']);return db[_0xe297('0x2f')]['find'](_0x4d5afa)[_0xe297('0x28')](handleEntityNotFound(_0x21dca5,null))['then'](function(_0x118910){if(_0x118910){var _0x3d4450=_0x118910[_0xe297('0x50')]({'plain':!![]});_0x3d4450=qs[_0xe297('0x51')](_0x3d4450,['id',_0xe297('0x52'),_0xe297('0x53'),_0xe297('0x54')]);_0x2dad99[_0xe297('0x4e')]=_['omit'](_0x2dad99[_0xe297('0x4e')],['id','createdAt',_0xe297('0x53')]);return db[_0xe297('0x55')]['transaction'](function(_0x3106f1){return db[_0xe297('0x2f')][_0xe297('0x4d')](_[_0xe297('0x41')](_0x3d4450,_0x2dad99[_0xe297('0x4e')]),{'include':_0x2dad99[_0xe297('0x33')][_0xe297('0x45')]?[{'all':!![]}]:undefined,'transaction':_0x3106f1})[_0xe297('0x28')](function(_0x131840){var _0x15fdf8=_0x131840[_0xe297('0x50')]({'plain':!![]});return db[_0xe297('0x56')][_0xe297('0x57')]({'where':{'userProfileId':_0x2dad99[_0xe297('0x4a')]['id']},'raw':!![]})[_0xe297('0x28')](function(_0x3631a8){if(_0x3631a8){return BPromise['each'](_0x3631a8,function(_0x289ba2){return new BPromise(function(_0x37e1f9,_0x303a3b){if(_0x289ba2[_0xe297('0x58')]===null||_0x289ba2[_0xe297('0x58')]===0x1)_0x37e1f9(null);return db[_0xe297('0x59')][_0xe297('0x57')]({'where':{'sectionId':_0x289ba2['id']},'raw':!![]})[_0xe297('0x28')](function(_0x5a26b5){var _0x412606=_[_0xe297('0x42')](_0x5a26b5,function(_0x53806b){return qs['omit'](_0x53806b,['id',_0xe297('0x52'),_0xe297('0x53'),'sectionId']);});_0x37e1f9(_0x412606);})['catch'](function(_0x4102aa){_0x303a3b(_0x4102aa);});})[_0xe297('0x28')](function(_0x440d45){var _0x3d2767=qs['omit'](_0x289ba2,['id','createdAt',_0xe297('0x53')]);_0x3d2767[_0xe297('0x5a')]=_0x15fdf8['id'];if(_0x440d45)_0x3d2767[_0xe297('0x5b')]=_0x440d45;return _0x3d2767;})[_0xe297('0x28')](function(_0x501d94){return db[_0xe297('0x56')][_0xe297('0x4d')](_0x501d94,{'include':[{'model':db[_0xe297('0x59')],'as':_0xe297('0x5b')}],'raw':!![],'transaction':_0x3106f1});});})[_0xe297('0x28')](function(){return _0x15fdf8;});}});});});}})[_0xe297('0x28')](respondWithResult(_0x21dca5,0xc9))[_0xe297('0x48')](handleError(_0x21dca5,null));};exports[_0xe297('0x5c')]=function(_0x4a30b8,_0x183ae2){if(_0x4a30b8[_0xe297('0x4e')]['id']){delete _0x4a30b8[_0xe297('0x4e')]['id'];}return db['UserProfile'][_0xe297('0x4c')]({'where':{'id':_0x4a30b8[_0xe297('0x4a')]['id']}})[_0xe297('0x28')](handleEntityNotFound(_0x183ae2,null))[_0xe297('0x28')](saveUpdates(_0x4a30b8[_0xe297('0x4e')],null))[_0xe297('0x28')](respondWithResult(_0x183ae2,null))[_0xe297('0x48')](handleError(_0x183ae2,null));};exports[_0xe297('0x5d')]=function(_0x38cf8a,_0x3af43e){return db[_0xe297('0x2f')][_0xe297('0x4c')]({'where':{'id':_0x38cf8a[_0xe297('0x4a')]['id']}})[_0xe297('0x28')](handleEntityNotFound(_0x3af43e,null))['then'](removeEntity(_0x3af43e,null))[_0xe297('0x48')](handleError(_0x3af43e,null));};exports[_0xe297('0x5e')]=function(_0x202d63,_0x305be9){return db[_0xe297('0x2f')][_0xe297('0x5e')]()[_0xe297('0x28')](respondWithResult(_0x305be9,null))[_0xe297('0x48')](handleError(_0x305be9,null));};exports['addSections']=function(_0x33242e,_0xbeca54){var _0x3106be=_0x33242e['body'];return db[_0xe297('0x2f')][_0xe297('0x4c')]({'where':{'id':_0x33242e[_0xe297('0x4a')]['id']}})[_0xe297('0x28')](handleEntityNotFound(_0xbeca54,null))['then'](function(_0x5d3e09){if(_0x5d3e09){return db[_0xe297('0x55')][_0xe297('0x5f')](function(_0x28f17e){return db[_0xe297('0x56')]['destroy']({'where':{'userProfileId':_0x33242e['params']['id'],'sectionId':_[_0xe297('0x42')](_0x3106be,function(_0x36bbbb){return _0x36bbbb['sectionId'];})},'transaction':_0x28f17e})['then'](function(){var _0x21cf34=_[_0xe297('0x42')](_0x3106be,function(_0x110d5b){_0x110d5b['userProfileId']=_0x33242e[_0xe297('0x4a')]['id'];return _0x110d5b;});var _0xf0a8ca=[];return BPromise[_0xe297('0x60')](_0x21cf34,function(_0x36b945){return db['UserProfileSection'][_0xe297('0x4d')](_0x36b945,{'include':[{'model':db[_0xe297('0x59')],'as':_0xe297('0x5b')}],'raw':!![],'transaction':_0x28f17e})[_0xe297('0x28')](function(_0x37d105){_0xf0a8ca['push'](_0x37d105[_0xe297('0x50')]({'plain':!![]}));});})[_0xe297('0x28')](function(){return _0xf0a8ca;});});});}})[_0xe297('0x28')](function(_0xbc0090){return _0xbc0090;})[_0xe297('0x28')](respondWithResult(_0xbeca54,null))[_0xe297('0x48')](handleError(_0xbeca54,null));};exports['removeSections']=function(_0x11b7e5,_0xbb5915){var _0x3b322a;return db['UserProfile'][_0xe297('0x4c')]({'where':{'id':_0x11b7e5['params']['id']},'attributes':['id',_0xe297('0x2c')]})[_0xe297('0x28')](handleEntityNotFound(_0xbb5915,null))[_0xe297('0x28')](function(_0x287eb4){if(_0x287eb4){_0x3b322a=_0x287eb4;return db[_0xe297('0x56')][_0xe297('0x5d')]({'where':{'userProfileId':_0x11b7e5['params']['id'],'sectionId':_0x11b7e5[_0xe297('0x33')][_0xe297('0x61')]}});}})[_0xe297('0x28')](function(){return _0x3b322a;})['then'](respondWithStatusCode(_0xbb5915,null))[_0xe297('0x48')](handleError(_0xbb5915,null));};exports[_0xe297('0x62')]=function(_0x12e431,_0xf1a2b8){var _0x311d07=[];var _0x3dbe46=[];return db['UserProfileSection']['findAll']({'where':{'userProfileId':_0x12e431[_0xe297('0x4a')]['id']},'raw':!![]})['then'](function(_0x1a4099){_0x311d07=_[_0xe297('0x40')](_0x1a4099,function(_0x2638fb){return _0x2638fb[_0xe297('0x63')]===0x1||_[_0xe297('0x64')]([0x3eb,0x709],_0x2638fb['sectionId']);});if(!_[_0xe297('0x65')](_0x311d07)){return _[_0xe297('0x42')](_0x311d07,function(_0x5ec8bd){return _0x5ec8bd[_0xe297('0x66')];});}else{return;}})['then'](function(_0x2112bd){if(_0x2112bd)_0x3dbe46=_0x2112bd;if(_[_0xe297('0x64')](_0x3dbe46,0x64)){var _0xaa8b34=_['find'](_0x311d07,{'sectionId':0x64});return hasDefaultDashboard(_0xaa8b34)[_0xe297('0x28')](function(_0x1c2ed2){return _['map'](_0x311d07,function(_0x170eca){if(_0x170eca[_0xe297('0x66')]===0x64){_0x170eca[_0xe297('0x67')]=_0x1c2ed2;}return _0x170eca;});});}else{return;}})[_0xe297('0x28')](function(_0x589615){if(_0x589615)_0x311d07=_0x589615;if(_['includes'](_0x3dbe46,0x3eb)){var _0x45c2f0=_[_0xe297('0x4c')](_0x311d07,{'sectionId':0x3eb});return getCustomDashboards(_0x45c2f0)['then'](function(_0x35f7a7){return _[_0xe297('0x42')](_0x311d07,function(_0x2e5e81){if(_0x45c2f0[_0xe297('0x63')]){if(_0x2e5e81[_0xe297('0x66')]===0x3eb){_0x2e5e81[_0xe297('0x67')]=_0x35f7a7;}}else{if(_0x2e5e81[_0xe297('0x66')]===0x64){if(!_0x2e5e81[_0xe297('0x67')]){_0x2e5e81[_0xe297('0x67')]=[];}_0x2e5e81[_0xe297('0x67')]=_0x2e5e81[_0xe297('0x67')][_0xe297('0x68')](_0x35f7a7);}}return _0x2e5e81;});});}else{return;}})[_0xe297('0x28')](function(_0x3a6241){if(_0x3a6241)_0x311d07=_0x3a6241;if(_['includes'](_0x3dbe46,0x709)){var _0x571d5e=_[_0xe297('0x4c')](_0x311d07,{'sectionId':0x709});return getPlugins(_0x571d5e)[_0xe297('0x28')](function(_0x253e9f){if(_0x571d5e[_0xe297('0x63')]){return _[_0xe297('0x42')](_0x311d07,function(_0x2de3fa){if(_0x2de3fa[_0xe297('0x66')]===0x709){_0x2de3fa['subsections']=_0x253e9f;}return _0x2de3fa;});}else{var _0x48f6a6={'sectionId':0x76c,'enabled':0x1,'subsections':_0x253e9f};var _0x404b9a=_[_0xe297('0x42')](_0x311d07);_0x404b9a['push'](_0x48f6a6);return _0x404b9a;}});}else{return;}})[_0xe297('0x28')](function(_0x41c581){if(_0x41c581)_0x311d07=_0x41c581;return _[_0xe297('0x40')](_0x311d07,[_0xe297('0x63'),0x1]);})[_0xe297('0x28')](respondWithResult(_0xf1a2b8,null))[_0xe297('0x48')](handleError(_0xf1a2b8,null));};function hasDefaultDashboard(_0x5f1e19){var _0x490e1d=[0x65];return new BPromise(function(_0x45df9c,_0x203ff5){try{if(_0x5f1e19[_0xe297('0x58')]){_0x45df9c(_0x490e1d);}else{return db[_0xe297('0x59')][_0xe297('0x69')]({'where':{'sectionId':_0x5f1e19['id']},'raw':!![]})[_0xe297('0x28')](function(_0x407aa7){_0x407aa7?_0x45df9c(_0x490e1d):_0x45df9c();});}}catch(_0x3e6095){_0x203ff5(_0x3e6095);}});}function getCustomDashboards(_0x3a9a8b){var _0x578af5=[];return new BPromise(function(_0x52ef18,_0x4b20c8){try{if(_0x3a9a8b[_0xe297('0x58')]){return db[_0xe297('0x6a')][_0xe297('0x57')]({'raw':!![]})[_0xe297('0x28')](function(_0x5f4327){_0x5f4327['forEach'](function(_0x3717b2){_0x578af5[_0xe297('0x6b')](_0x3717b2['id']+0x1869f);});_0x52ef18(_0x578af5);});}else{return db[_0xe297('0x59')]['findAll']({'where':{'sectionId':_0x3a9a8b['id']},'raw':!![]})[_0xe297('0x28')](function(_0x52af29){_0x52af29[_0xe297('0x6c')](function(_0xa5e8fb){_0x578af5[_0xe297('0x6b')](_0xa5e8fb[_0xe297('0x6d')]+0x1869f);});_0x52ef18(_0x578af5);});}}catch(_0x21fc6c){_0x4b20c8(_0x21fc6c);}});}function getPlugins(_0xd48ec0){var _0x513b4e=[];return new BPromise(function(_0x4d518e,_0x945d46){try{if(_0xd48ec0[_0xe297('0x58')]){return db[_0xe297('0x6e')][_0xe297('0x57')]({'raw':!![]})[_0xe297('0x28')](function(_0x3efb9e){_0x3efb9e['forEach'](function(_0x4dea3f){_0x513b4e[_0xe297('0x6b')](_0x4dea3f['id']+0x15b38);});_0x4d518e(_0x513b4e);});}else{return db['UserProfileResource'][_0xe297('0x57')]({'where':{'sectionId':_0xd48ec0['id']},'raw':!![]})['then'](function(_0x1c5f9b){_0x1c5f9b[_0xe297('0x6c')](function(_0x15b76d){_0x513b4e[_0xe297('0x6b')](_0x15b76d[_0xe297('0x6d')]+0x15b38);});_0x4d518e(_0x513b4e);});}}catch(_0x5bd5e3){_0x945d46(_0x5bd5e3);}});}exports['addResources']=function(_0x473bf9,_0x3262af){return db[_0xe297('0x2f')][_0xe297('0x4c')]({'where':{'id':_0x473bf9['params']['id']}})[_0xe297('0x28')](handleEntityNotFound(_0x3262af,null))[_0xe297('0x28')](function(_0x2203b5){if(_0x2203b5){return db['sequelize'][_0xe297('0x5f')](function(_0x589624){return db['UserProfileSection'][_0xe297('0x57')]({'where':{'userProfileId':_0x473bf9['params']['id']},'attributes':['id'],'raw':!![]})[_0xe297('0x28')](function(_0x5781b6){if(_0x5781b6){return db[_0xe297('0x56')]['destroy']({'where':{'userProfileId':_0x473bf9['params']['id'],'id':_['map'](_0x5781b6,function(_0x51536b){return _0x51536b['id'];})},'transaction':_0x589624});}})[_0xe297('0x28')](function(_0x2498b9){var _0x244724=_[_0xe297('0x42')](_0x473bf9[_0xe297('0x4e')],function(_0xa6344d){_0xa6344d[_0xe297('0x5a')]=_0x473bf9['params']['id'];return _0xa6344d;});return db[_0xe297('0x56')][_0xe297('0x6f')](_0x244724,{'raw':!![],'transaction':_0x589624});})[_0xe297('0x28')](function(_0x6b34f3){var _0x2fe6a1=_[_0xe297('0x40')](_[_0xe297('0x42')](_0x6b34f3,function(_0x4b6d39){return _0x4b6d39[_0xe297('0x50')]({'plain':!![]});}),{'includeAll':![]});if(_0x2fe6a1){return db['UserProfileSection'][_0xe297('0x57')]({'where':{'userProfileId':_0x473bf9[_0xe297('0x4a')]['id'],'sectionId':_[_0xe297('0x42')](_0x2fe6a1,function(_0x240464){return _0x240464[_0xe297('0x66')];})},'attributes':['id','sectionId'],'raw':!![]})[_0xe297('0x28')](function(_0x18aa5a){var _0x14f59a=_[_0xe297('0x42')](_0x473bf9[_0xe297('0x4e')],function(_0x52bc48){_0x52bc48[_0xe297('0x5a')]=_0x473bf9[_0xe297('0x4a')]['id'];return _0x52bc48;});return db[_0xe297('0x59')][_0xe297('0x6f')](_0x14f59a,{'raw':!![],'transaction':_0x589624});});}})[_0xe297('0x48')](handleError(_0x3262af,null));});}})[_0xe297('0x28')](function(_0x4f4996){var _0x539ca2=_[_0xe297('0x42')](_0x4f4996,function(_0x31cdc7){return _0x31cdc7[_0xe297('0x50')]({'plain':!![]});});})[_0xe297('0x28')](respondWithResult(_0x3262af,null))[_0xe297('0x48')](handleError(_0x3262af,null));};exports[_0xe297('0x70')]=function(_0x538a31,_0x4bd426,_0x1240ad){return db[_0xe297('0x2f')][_0xe297('0x4c')]({'where':{'id':_0x538a31['params']['id']}})[_0xe297('0x28')](handleEntityNotFound(_0x4bd426,null))[_0xe297('0x28')](function(_0x4c3ebd){if(_0x4c3ebd){return _0x4c3ebd[_0xe297('0x70')](_0x538a31[_0xe297('0x33')]['ids']);}})[_0xe297('0x28')](respondWithStatusCode(_0x4bd426,null))[_0xe297('0x48')](handleError(_0x4bd426,null));};exports[_0xe297('0x71')]=function(_0x5902cd,_0x278e99){var _0x5d6acf={};if(!_0x5902cd[_0xe297('0x33')][_0xe297('0x72')])throw new Error(_0xe297('0x73'));if(!_0x5902cd[_0xe297('0x33')][_0xe297('0x3a')](_0xe297('0x3b'))){_0x5d6acf['limit']=qs[_0xe297('0x23')](_0x5902cd[_0xe297('0x33')][_0xe297('0x23')]);_0x5d6acf['offset']=qs['offset'](_0x5902cd[_0xe297('0x33')][_0xe297('0x25')]);}return db['UserProfile']['find']({'where':{'id':_0x5902cd[_0xe297('0x4a')]['id']}})[_0xe297('0x28')](function(_0x16bcb9){if(!_0x16bcb9)throw new Error(_0xe297('0x74')+_0x5902cd['params']['id']);return db[_0xe297('0x2f')][_0xe297('0x71')](_0x5902cd);})[_0xe297('0x28')](respondWithFilteredResult(_0x278e99,_0x5d6acf))[_0xe297('0x48')](handleError(_0x278e99,null));}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.events.js b/server/api/userProfile/userProfile.events.js index 7d2145a..decfbe8 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 _0x71ab=['emit','hasOwnProperty','hook','exports','../../mysqldb','setMaxListeners','update','remove'];(function(_0x193372,_0x10ecce){var _0x9c8117=function(_0x25d504){while(--_0x25d504){_0x193372['push'](_0x193372['shift']());}};_0x9c8117(++_0x10ecce);}(_0x71ab,0x64));var _0xb71a=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x71ab[_0x17d9e3];return _0x14192d;};'use strict';var EventEmitter=require('events');var UserProfile=require(_0xb71a('0x0'))['db']['UserProfile'];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0xb71a('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':_0xb71a('0x2'),'afterDestroy':_0xb71a('0x3')};function emitEvent(_0x20fd9c){return function(_0x4094b2,_0x37ce74,_0x3c6438){UserProfileEvents[_0xb71a('0x4')](_0x20fd9c+':'+_0x4094b2['id'],_0x4094b2);UserProfileEvents[_0xb71a('0x4')](_0x20fd9c,_0x4094b2);_0x3c6438(null);};}for(var e in events){if(events[_0xb71a('0x5')](e)){var event=events[e];UserProfile[_0xb71a('0x6')](e,emitEvent(event));}}module[_0xb71a('0x7')]=UserProfileEvents; \ No newline at end of file +var _0x3e0c=['exports','events','../../mysqldb','UserProfile','save','update','remove'];(function(_0x351814,_0x1434ce){var _0x1ab949=function(_0x53447f){while(--_0x53447f){_0x351814['push'](_0x351814['shift']());}};_0x1ab949(++_0x1434ce);}(_0x3e0c,0x16d));var _0xc3e0=function(_0x100459,_0x4d4893){_0x100459=_0x100459-0x0;var _0x2c9d9e=_0x3e0c[_0x100459];return _0x2c9d9e;};'use strict';var EventEmitter=require(_0xc3e0('0x0'));var UserProfile=require(_0xc3e0('0x1'))['db'][_0xc3e0('0x2')];var UserProfileEvents=new EventEmitter();UserProfileEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xc3e0('0x3'),'afterUpdate':_0xc3e0('0x4'),'afterDestroy':_0xc3e0('0x5')};function emitEvent(_0x2ba135){return function(_0xba1d4c,_0x49e5b7,_0x88cddb){UserProfileEvents['emit'](_0x2ba135+':'+_0xba1d4c['id'],_0xba1d4c);UserProfileEvents['emit'](_0x2ba135,_0xba1d4c);_0x88cddb(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserProfile['hook'](e,emitEvent(event));}}module[_0xc3e0('0x6')]=UserProfileEvents; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.model.js b/server/api/userProfile/userProfile.model.js index 4e3d32d..7843725 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 _0x87f8=['SquareOdbc','SquareProjects','projectName','projects','JscriptyProject','contacts','Lists','lists','CmList','companies','CmCompany','globalcustomfields','CmCustomField','chatqueues','ChatQueue','FaxQueue','faxaccounts','FaxAccount','inboundroutes','outboundroutes','VoiceExtension','contexts','VoiceContext','voicemails','voicerecordings','VoiceRecording','parentSections','membername','User','role','telephone','VoiceQueues','VoiceQueue','inbound','QueueCampaigns','outbound','musiconholds','VoiceMusicOnHold','chanspies','VoiceChanSpy','voiceprefixes','ivrcampaigns','mailqueues','MailAccount','mailsubstatuses','MailSubstatus','openchannelqueues','OpenchannelQueue','openchannelaccounts','OpenchannelAccount','smsaccounts','whatsappqueues','WhatsappQueue','WhatsappAccount','teams','Team','voicequeues','queuecampaigns','users','agents','admin','user','Telephones','zendeskaccounts','ZendeskAccount','salesforceaccounts','SalesforceAccount','freshdeskaccounts','FreshdeskAccount','sugarcrmaccounts','SugarcrmAccount','deskaccounts','DeskAccount','ZohoAccount','vtigeraccounts','CannedAnswer','Disposition','customdashboards','Dashboard','pauses','Pause','Schedule','sounds','Sound','tags','Tag','Template','Trigger','trunks','Trunk','plugins','Plugin','extractedreports','Reports','reportId','metrics','AnalyticMetric','charAt','slice','select','ui.','InteractionId','ui.createdAt','from','user_has_','_interactions','ui.UserId\x20=\x20?','sequelize','toString','define','user_profiles','../../components/parsers/qs','query','raw','section','mergeResources','Invalid\x20section\x20\x27','push','UserProfileSection','find','params','all','ignore','isEmpty','union','length','autoAssociation','model','keys','intersection','attributes','fields','nolimit','limit','offset','order','sort','filters','pick','merge','where','key','VIRTUAL','foreignKey','forEach','options','includeAll','include','DefaultReports','custom','CustomReports','count','rows','ids','customSorting','extraQueryConditions','Tags','color','tag','ThroughTags','openTabs','chat','sms','fax','dataValues','mail','openchannel','whatsapp','lodash','./userProfile.attributes','squel','exports','filter','findAll','then','map','catch','field','value','associatedResources','name','resolve','UserProfileResource','AnalyticExtractedReport','resourceId','type','toLowerCase','odbc','childModel'];(function(_0x460d0d,_0x194ec4){var _0xac83b4=function(_0x4f8478){while(--_0x4f8478){_0x460d0d['push'](_0x460d0d['shift']());}};_0xac83b4(++_0x194ec4);}(_0x87f8,0x165));var _0x887f=function(_0x4092a8,_0xa16a23){_0x4092a8=_0x4092a8-0x0;var _0x5f22ab=_0x87f8[_0x4092a8];return _0x5f22ab;};'use strict';var _=require(_0x887f('0x0'));var attributes=require(_0x887f('0x1'));var squel=require(_0x887f('0x2'));module[_0x887f('0x3')]=function(_0x79d16c){var _0xb89f50=_0x79d16c['models'];function _0x58ad39(_0x491a44,_0x58590d){return new Promise(function(_0x3d35a8,_0x4e15af){if(!_0x58590d)return _0x3d35a8(null);var _0x438d0c=_0x58590d[_0x887f('0x4')]?{[_0x58590d[_0x887f('0x4')]['field']]:_0x58590d[_0x887f('0x4')]['value']}:undefined;return _0xb89f50[_0x491a44][_0x887f('0x5')]({'where':_0x438d0c,'raw':!![]})[_0x887f('0x6')](function(_0x5d54fe){_0x58590d['associatedResources']=_[_0x887f('0x7')](_0x5d54fe,'id');_0x3d35a8(_0x58590d);})[_0x887f('0x8')](function(_0x3a0a3c){_0x4e15af(_0x3a0a3c);});});}function _0x51a07d(_0x33346d,_0x397903){return new Promise(function(_0x5679c4,_0x4af724){var _0x4fc107=_0x33346d['filter']?{[_0x33346d[_0x887f('0x4')][_0x887f('0x9')]]:_0x33346d[_0x887f('0x4')][_0x887f('0xa')]}:undefined;return _0xb89f50[_0x33346d['model']][_0x887f('0x5')]({'where':_0x4fc107,'raw':!![]})[_0x887f('0x6')](function(_0x45f238){_0x397903[_0x887f('0xb')]=_[_0x887f('0x7')](_0x45f238,function(_0xe8c6f9){return _0xe8c6f9[_0x887f('0xc')];});_0x5679c4(_0x397903);})[_0x887f('0x8')](function(_0x350cda){_0x4af724(_0x350cda);});});}function _0x240a29(_0x54e865,_0x26378a,_0x206bcf){if(!_0x26378a)return Promise[_0x887f('0xd')](null);return new Promise(function(_0x44ba36,_0x2ae2d1){return _0xb89f50[_0x887f('0xe')][_0x887f('0x5')]({'where':{'sectionId':_0x26378a['id']},'raw':!![]})['then'](function(_0x231c76){if(_0x54e865['field']&&_0x54e865[_0x887f('0x9')]!=='id'){_0x26378a['associatedResources']=_[_0x887f('0x7')](_0x231c76,function(_0x9261e2){return _0x9261e2[_0x54e865[_0x887f('0x9')]];});}else{if(_0x206bcf===_0x887f('0xf')){_0x26378a['associatedResources']=_['map'](_0x231c76,function(_0x847df9){return{'id':_0x847df9[_0x887f('0x10')],'type':_0x847df9[_0x887f('0x11')]};});}else{_0x26378a[_0x887f('0xb')]=_[_0x887f('0x7')](_0x231c76,function(_0x19f2dc){return _0x19f2dc[_0x887f('0x10')];});}}_0x44ba36(_0x26378a);})[_0x887f('0x8')](function(_0x2b545b){_0x2ae2d1(_0x2b545b);});});}function _0x277c72(_0x3e54bd,_0x8b7a83){var _0x255477={'parentSections':[]};switch(_0x3e54bd[_0x887f('0x12')]()){case'squareprojects':_0x255477['childModel']='SquareProject';break;case _0x887f('0x13'):_0x255477[_0x887f('0x14')]=_0x887f('0x15');break;case'squarerecordings':_0x255477[_0x887f('0x14')]='SquareRecording';_0x255477['parentSections']=[{'name':_0x887f('0x16'),'field':_0x887f('0xc'),'foreignKey':_0x887f('0x17')}];break;case _0x887f('0x18'):_0x255477[_0x887f('0x14')]=_0x887f('0x19');break;case _0x887f('0x1a'):_0x255477[_0x887f('0x14')]='CmContact';_0x255477['parentSections']=[{'name':_0x887f('0x1b'),'field':'id','foreignKey':'ListId'}];break;case _0x887f('0x1c'):_0x255477['childModel']=_0x887f('0x1d');break;case _0x887f('0x1e'):_0x255477[_0x887f('0x14')]=_0x887f('0x1f');break;case _0x887f('0x20'):_0x255477['childModel']=_0x887f('0x21');break;case _0x887f('0x22'):_0x255477[_0x887f('0x14')]=_0x887f('0x23');break;case'chatwebsites':_0x255477[_0x887f('0x14')]='ChatWebsite';break;case'faxqueues':_0x255477[_0x887f('0x14')]=_0x887f('0x24');break;case _0x887f('0x25'):_0x255477[_0x887f('0x14')]=_0x887f('0x26');break;case _0x887f('0x27'):case'internalroutes':case _0x887f('0x28'):_0x255477[_0x887f('0x14')]=_0x887f('0x29');break;case _0x887f('0x2a'):_0x255477[_0x887f('0x14')]=_0x887f('0x2b');break;case _0x887f('0x2c'):_0x255477[_0x887f('0x14')]='VoiceMail';break;case _0x887f('0x2d'):_0x255477[_0x887f('0x14')]=_0x887f('0x2e');_0x255477[_0x887f('0x2f')]=[{'name':'Agents','field':_0x887f('0xc'),'foreignKey':_0x887f('0x30'),'model':_0x887f('0x31'),'filter':{'field':_0x887f('0x32'),'value':['agent']}},{'name':'Telephones','field':_0x887f('0xc'),'foreignKey':_0x887f('0x30'),'model':_0x887f('0x31'),'filter':{'field':_0x887f('0x32'),'value':[_0x887f('0x33')]}},{'name':_0x887f('0x34'),'field':_0x887f('0xc'),'foreignKey':'queue','model':_0x887f('0x35'),'filter':{'field':_0x887f('0x11'),'value':[_0x887f('0x36')]}},{'name':_0x887f('0x37'),'field':_0x887f('0xc'),'foreignKey':'queue','model':_0x887f('0x35'),'filter':{'field':_0x887f('0x11'),'value':[_0x887f('0x38')]}}];break;case _0x887f('0x39'):_0x255477[_0x887f('0x14')]=_0x887f('0x3a');break;case _0x887f('0x3b'):_0x255477[_0x887f('0x14')]=_0x887f('0x3c');break;case _0x887f('0x3d'):_0x255477[_0x887f('0x14')]='VoicePrefix';break;case _0x887f('0x3e'):_0x255477['childModel']='Campaign';break;case _0x887f('0x3f'):_0x255477[_0x887f('0x14')]='MailQueue';break;case'mailaccounts':_0x255477[_0x887f('0x14')]=_0x887f('0x40');break;case _0x887f('0x41'):_0x255477[_0x887f('0x14')]=_0x887f('0x42');break;case _0x887f('0x43'):_0x255477['childModel']=_0x887f('0x44');break;case _0x887f('0x45'):_0x255477[_0x887f('0x14')]=_0x887f('0x46');break;case'smsqueues':_0x255477[_0x887f('0x14')]='SmsQueue';break;case _0x887f('0x47'):_0x255477[_0x887f('0x14')]='SmsAccount';break;case _0x887f('0x48'):_0x255477[_0x887f('0x14')]=_0x887f('0x49');break;case'whatsappaccounts':_0x255477[_0x887f('0x14')]=_0x887f('0x4a');break;case _0x887f('0x4b'):_0x255477['childModel']=_0x887f('0x4c');break;case _0x887f('0x4d'):case _0x887f('0x4e'):_0x255477[_0x887f('0x14')]='VoiceQueue';if(_0x8b7a83){_0x255477[_0x887f('0x2f')]=[{'name':_0x887f('0x34')},{'name':_0x887f('0x37')}];}break;case _0x887f('0x4f'):case _0x887f('0x50'):case'telephones':_0x255477['childModel']=_0x887f('0x31');if(_0x8b7a83){_0x255477[_0x887f('0x2f')]=[{'name':'Users','filter':{'field':_0x887f('0x32'),'value':[_0x887f('0x51'),_0x887f('0x52')]},'ignore':!![]},{'name':'Agents'},{'name':_0x887f('0x53')}];}break;case _0x887f('0x54'):_0x255477['childModel']=_0x887f('0x55');break;case _0x887f('0x56'):_0x255477[_0x887f('0x14')]=_0x887f('0x57');break;case _0x887f('0x58'):_0x255477[_0x887f('0x14')]=_0x887f('0x59');break;case _0x887f('0x5a'):_0x255477['childModel']=_0x887f('0x5b');break;case _0x887f('0x5c'):_0x255477[_0x887f('0x14')]=_0x887f('0x5d');break;case'zohoaccounts':_0x255477['childModel']=_0x887f('0x5e');break;case _0x887f('0x5f'):_0x255477[_0x887f('0x14')]='User';break;case'cannedanswers':_0x255477[_0x887f('0x14')]=_0x887f('0x60');break;case'dispositions':_0x255477[_0x887f('0x14')]=_0x887f('0x61');break;case _0x887f('0x62'):_0x255477[_0x887f('0x14')]=_0x887f('0x63');break;case'intervals':_0x255477['childModel']='Interval';break;case _0x887f('0x64'):_0x255477['childModel']=_0x887f('0x65');break;case'scheduler':_0x255477[_0x887f('0x14')]=_0x887f('0x66');break;case _0x887f('0x67'):_0x255477[_0x887f('0x14')]=_0x887f('0x68');break;case _0x887f('0x69'):_0x255477[_0x887f('0x14')]=_0x887f('0x6a');break;case'templates':_0x255477['childModel']=_0x887f('0x6b');break;case'triggers':_0x255477[_0x887f('0x14')]=_0x887f('0x6c');break;case _0x887f('0x6d'):_0x255477[_0x887f('0x14')]=_0x887f('0x6e');break;case'variables':_0x255477[_0x887f('0x14')]='Variable';break;case _0x887f('0x6f'):_0x255477[_0x887f('0x14')]=_0x887f('0x70');break;case _0x887f('0x71'):_0x255477[_0x887f('0x14')]='AnalyticExtractedReport';_0x255477[_0x887f('0x2f')]=[{'name':_0x887f('0x72'),'field':'id','foreignKey':_0x887f('0x73')}];break;case _0x887f('0x74'):_0x255477['childModel']=_0x887f('0x75');break;}return _0x255477;}function _0x3c371a(_0x174978,_0x2abf3f){var _0x471265=_0x174978[_0x887f('0x76')](0x0)['toUpperCase']()+_0x174978[_0x887f('0x77')](0x1);var _0x4b11bc={'type':_0xb89f50['Sequelize']['QueryTypes']['SELECT'],'raw':!![]};return new Promise(function(_0x5236f4,_0x11111d){var _0x9efbcc=squel[_0x887f('0x78')]()['field'](_0x887f('0x79')+_0x471265+_0x887f('0x7a'),'id')[_0x887f('0x9')](_0x887f('0x7b'))[_0x887f('0x7c')](_0x887f('0x7d')+_0x174978+_0x887f('0x7e'),'ui')['where'](_0x887f('0x7f'),_0x2abf3f['id']);return _0xb89f50[_0x887f('0x80')]['query'](_0x9efbcc[_0x887f('0x81')](),_0x4b11bc)[_0x887f('0x6')](function(_0xf412ce){_0x2abf3f[_0x471265+'OpenTabs']=_0xf412ce;_0x5236f4(_0xf412ce);})[_0x887f('0x8')](function(_0x1d3384){_0x11111d(_0x1d3384);});});}return _0x79d16c[_0x887f('0x82')]('UserProfile',attributes,{'tableName':_0x887f('0x83'),'paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0x4b7c33){var _0x568aa8=require(_0x887f('0x84'));var _0x5a9edd={'raw':_0x4b7c33[_0x887f('0x85')][_0x887f('0x86')],'where':{}};var _0x2a5074={};var _0x19b9e9={'count':0x0,'rows':[]};var _0x23a1eb=_0x4b7c33['query'][_0x887f('0x87')];var _0x5af130=_0x4b7c33['query'][_0x887f('0x88')]||![];var _0x5e15f3=_0x277c72(_0x23a1eb,_0x5af130);if(!_0x5e15f3['childModel'])throw new Error(_0x887f('0x89')+_0x23a1eb+'\x27');var _0x52f73e=[{'name':_0x23a1eb}];if(!_['isEmpty'](_0x5e15f3[_0x887f('0x2f')]))_0x52f73e=_0x5e15f3[_0x887f('0x2f')];var _0x127e39=[];for(var _0x3a2302=0x0;_0x3a2302<_0x52f73e['length'];_0x3a2302++){_0x127e39[_0x887f('0x8a')](_0xb89f50[_0x887f('0x8b')][_0x887f('0x8c')]({'where':{'userProfileId':_0x4b7c33[_0x887f('0x8d')]['id'],'name':_0x52f73e[_0x3a2302][_0x887f('0xc')]},'raw':!![]}));}return Promise[_0x887f('0x8e')](_0x127e39)[_0x887f('0x6')](function(_0xedafb6){var _0x5de1ae=_[_0x887f('0x4')](_0xedafb6,function(_0x27ba10){return _0x27ba10?_0x27ba10:undefined;});var _0x5a0caf=_[_0x887f('0x4')](_0x52f73e,[_0x887f('0x8f'),!![]]);var _0x14d930=_[_0x887f('0x90')](_0x5de1ae)&&_[_0x887f('0x90')](_0x5a0caf)?null:_[_0x887f('0x91')](_0x5a0caf,_0x5de1ae);if(!_0x14d930)return null;var _0x276fab=[];for(var _0xd32db0=0x0;_0xd32db0<_0x14d930[_0x887f('0x92')];_0xd32db0++){var _0x3bb5a4=_[_0x887f('0x8c')](_0x52f73e,function(_0x47730b){return _0x14d930[_0xd32db0]?_0x47730b[_0x887f('0xc')]===_0x14d930[_0xd32db0][_0x887f('0xc')]:null;});if(_0x3bb5a4){if(_0x14d930[_0xd32db0][_0x887f('0x8f')]){_0x276fab[_0x887f('0x8a')](_0x58ad39(_0x5e15f3['childModel'],_0x14d930[_0xd32db0]));}else{if(!_0x14d930[_0xd32db0][_0x887f('0x93')]){_0x276fab[_0x887f('0x8a')](_0x240a29(_0x3bb5a4,_0x14d930[_0xd32db0],_0x5e15f3[_0x887f('0x14')]));}else{if(_0x3bb5a4[_0x887f('0x94')]){_0x276fab[_0x887f('0x8a')](_0x51a07d(_0x3bb5a4,_0x14d930[_0xd32db0]));}}}}}return Promise[_0x887f('0x8e')](_0x276fab);})['then'](function(_0x16e942){var _0x482f94=_0x16e942;var _0x31361b=null;if(_0x482f94){_0x31361b=_0x482f94[_0x887f('0x92')]===0x1?_0x482f94[0x0]:null;}if(!_0x31361b&&!_0x482f94)return _0x19b9e9;var _0x17816c=_0xb89f50[_0x5e15f3[_0x887f('0x14')]]['rawAttributes'];_0x2a5074[_0x887f('0x94')]=_[_0x887f('0x95')](_0x17816c);_0x2a5074['query']=_[_0x887f('0x95')](_0x4b7c33[_0x887f('0x85')]);_0x2a5074['filters']=_[_0x887f('0x96')](_0x2a5074[_0x887f('0x94')],_0x2a5074[_0x887f('0x85')]);_0x5a9edd[_0x887f('0x97')]=_['intersection'](_0x2a5074['model'],_0x568aa8[_0x887f('0x98')](_0x4b7c33[_0x887f('0x85')]['fields']));_0x5a9edd[_0x887f('0x97')]=_0x5a9edd['attributes'][_0x887f('0x92')]?_0x5a9edd[_0x887f('0x97')]:_0x2a5074['model'];if(!_0x4b7c33[_0x887f('0x85')]['hasOwnProperty'](_0x887f('0x99'))){_0x5a9edd['limit']=_0x568aa8['limit'](_0x4b7c33[_0x887f('0x85')][_0x887f('0x9a')]);_0x5a9edd[_0x887f('0x9b')]=_0x568aa8[_0x887f('0x9b')](_0x4b7c33[_0x887f('0x85')]['offset']);}_0x5a9edd[_0x887f('0x9c')]=_0x568aa8['sort'](_0x4b7c33[_0x887f('0x85')][_0x887f('0x9d')]);_0x5a9edd['where']=_0x568aa8[_0x887f('0x9e')](_[_0x887f('0x9f')](_0x4b7c33[_0x887f('0x85')],_0x2a5074['filters']));if(_0x4b7c33[_0x887f('0x85')][_0x887f('0x4')]){_0x5a9edd['where']=_[_0x887f('0xa0')](_0x5a9edd[_0x887f('0xa1')],{'$or':_[_0x887f('0x7')](_0x17816c,function(_0x33b107){if(_0x33b107[_0x887f('0x11')][_0x887f('0xa2')]!==_0x887f('0xa3')){var _0x17a4b8={};_0x17a4b8[_0x33b107[_0x887f('0x9')]]={'$like':'%'+_0x4b7c33[_0x887f('0x85')]['filter']+'%'};return _0x17a4b8;}})});}var _0x4622eb=[];var _0x12d99b=null;var _0x42e2a4={};if(_0x31361b){_0x12d99b=_[_0x887f('0x8c')](_0x52f73e,['name',_0x31361b[_0x887f('0xc')]]);if(_0x12d99b[_0x887f('0x9')]){_0x42e2a4={};if(_0x5e15f3[_0x887f('0x14')]==='AnalyticExtractedReport'){_0x42e2a4[_0x12d99b['foreignKey']]=_[_0x887f('0x7')](_0x31361b['associatedResources'],'id');}else{_0x42e2a4[_0x12d99b[_0x887f('0xa4')]]=_0x31361b['associatedResources'];}_0x4622eb[_0x887f('0x8a')](_0x42e2a4);}else{_0x5a9edd[_0x887f('0xa1')]['id']=_0x31361b[_0x887f('0xb')];}}else{for(var _0x5a6f2=0x0;_0x5a6f2<_0x482f94['length'];_0x5a6f2++){_0x12d99b=_['find'](_0x52f73e,[_0x887f('0xc'),_0x482f94[_0x5a6f2][_0x887f('0xc')]]);if(_0x12d99b['field']){_0x42e2a4={};_0x42e2a4[_0x12d99b[_0x887f('0xa4')]]=_0x482f94[_0x5a6f2][_0x887f('0xb')];_0x4622eb[_0x887f('0x8a')](_0x42e2a4);}else{if(!_0x5a9edd[_0x887f('0xa1')]['id'])_0x5a9edd[_0x887f('0xa1')]['id']=[];_0x482f94[_0x5a6f2][_0x887f('0xb')][_0x887f('0xa5')](function(_0x3cf41d){_0x5a9edd['where']['id']['push'](_0x3cf41d);});}}}if(!_['isEmpty'](_0x4622eb)){_0x5a9edd[_0x887f('0xa1')]=_[_0x887f('0xa0')](_0x5a9edd[_0x887f('0xa1')],{'$and':{'$or':_0x4622eb}});}_0x5a9edd=_[_0x887f('0xa0')]({},_0x5a9edd,_0x4b7c33[_0x887f('0xa6')]);if(_0x31361b&&!_0x31361b[_0x887f('0x93')]&&_0x5e15f3[_0x887f('0x14')]===_0x887f('0xf')){if(_0x4b7c33['query'][_0x887f('0xa7')]){_0x5a9edd[_0x887f('0xa8')]=[{'all':!![]}];}return _0xb89f50[_0x5e15f3[_0x887f('0x14')]][_0x887f('0x5')](_0x5a9edd)[_0x887f('0x6')](function(_0x23c311){var _0x4d7785=[];_0x23c311[_0x887f('0xa5')](function(_0x2f0e23){var _0x3f9bf4;switch(_0x2f0e23['reportType']){case'default':_0x3f9bf4=_[_0x887f('0x8c')](_0x31361b[_0x887f('0xb')],function(_0x3922cf){return _0x3922cf['id']===_0x2f0e23[_0x887f('0x73')]&&_0x3922cf[_0x887f('0x11')]===_0x887f('0xa9');});break;case _0x887f('0xaa'):_0x3f9bf4=_[_0x887f('0x8c')](_0x31361b[_0x887f('0xb')],function(_0x27ce6c){return _0x27ce6c['id']===_0x2f0e23[_0x887f('0x73')]&&_0x27ce6c[_0x887f('0x11')]===_0x887f('0xab');});break;}if(_0x3f9bf4)_0x4d7785[_0x887f('0x8a')](_0x2f0e23);});_0x19b9e9[_0x887f('0xac')]=_0x4d7785['length'];_0x19b9e9[_0x887f('0xad')]=_0x4d7785;return _0x19b9e9;});}else{if(!_[_0x887f('0x90')](_0x4b7c33[_0x887f('0x85')][_0x887f('0xae')])){_0x5a9edd[_0x887f('0xa1')]['id']=_0x5a9edd[_0x887f('0xa1')]['id']?_[_0x887f('0x96')](_0x5a9edd['where']['id'],_0x4b7c33[_0x887f('0x85')][_0x887f('0xae')]):_0x4b7c33['query']['ids'];if(_0x4b7c33['query']['customSorting']){_0x5a9edd[_0x887f('0x9c')]=_0x4b7c33[_0x887f('0x85')][_0x887f('0xaf')];}}if(_0x4b7c33[_0x887f('0x85')][_0x887f('0xb0')]){_0x5a9edd['where']=_[_0x887f('0xa0')](_0x5a9edd[_0x887f('0xa1')],{'$and':_0x4b7c33['query'][_0x887f('0xb0')]});}return _0xb89f50[_0x5e15f3[_0x887f('0x14')]][_0x887f('0xac')]({'where':_0x5a9edd['where']})['then'](function(_0x3a6b36){_0x19b9e9[_0x887f('0xac')]=_0x3a6b36;if(_0x4b7c33[_0x887f('0x85')][_0x887f('0xa7')]){if(_0x5e15f3[_0x887f('0x14')]==='CmContact'){_0x5a9edd[_0x887f('0xa8')]=[{'model':_0xb89f50[_0x887f('0x6a')],'as':_0x887f('0xb1'),'attributes':['id',_0x887f('0xc'),_0x887f('0xb2')],'required':_0x4b7c33[_0x887f('0x85')][_0x887f('0xb3')]?!![]:![]},{'model':_0xb89f50[_0x887f('0x6a')],'as':_0x887f('0xb4'),'attributes':['id',_0x887f('0xc'),_0x887f('0xb2')],'through':_0x4b7c33[_0x887f('0x85')]['tag']?{'attributes':[],'where':{'TagId':_0x4b7c33[_0x887f('0x85')][_0x887f('0xb3')]||undefined}}:{},'required':_0x4b7c33[_0x887f('0x85')][_0x887f('0xb3')]?!![]:![]}];}else{_0x5a9edd[_0x887f('0xa8')]=[{'all':!![]}];}}return _0xb89f50[_0x5e15f3['childModel']][_0x887f('0x5')](_0x5a9edd);})[_0x887f('0x6')](function(_0x4f09a8){_0x19b9e9[_0x887f('0xad')]=_0x4f09a8;if(_0x23a1eb==='Agents'&&_0x4b7c33['query'][_0x887f('0xb5')]==='true'){var _0x4e5535=[];for(var _0x5ad18e=0x0;_0x5ad18e<_0x19b9e9[_0x887f('0xad')][_0x887f('0x92')];_0x5ad18e++){_0x4e5535[_0x887f('0x8a')](_0x3c371a(_0x887f('0xb6'),_0x19b9e9[_0x887f('0xad')][_0x5ad18e]['dataValues']));_0x4e5535['push'](_0x3c371a(_0x887f('0xb7'),_0x19b9e9['rows'][_0x5ad18e]['dataValues']));_0x4e5535[_0x887f('0x8a')](_0x3c371a(_0x887f('0xb8'),_0x19b9e9['rows'][_0x5ad18e][_0x887f('0xb9')]));_0x4e5535[_0x887f('0x8a')](_0x3c371a(_0x887f('0xba'),_0x19b9e9['rows'][_0x5ad18e]['dataValues']));_0x4e5535['push'](_0x3c371a(_0x887f('0xbb'),_0x19b9e9[_0x887f('0xad')][_0x5ad18e][_0x887f('0xb9')]));_0x4e5535[_0x887f('0x8a')](_0x3c371a(_0x887f('0xbc'),_0x19b9e9['rows'][_0x5ad18e][_0x887f('0xb9')]));}return Promise[_0x887f('0x8e')](_0x4e5535)[_0x887f('0x6')](function(){return _0x19b9e9;});}return _0x19b9e9;});}});}}});}; \ No newline at end of file +var _0xa518=['squel','exports','filter','value','then','catch','field','model','findAll','map','name','UserProfileResource','associatedResources','AnalyticExtractedReport','resourceId','toLowerCase','squareprojects','SquareProject','odbc','childModel','squarerecordings','SquareRecording','parentSections','projectName','projects','contacts','CmContact','Lists','ListId','lists','CmList','companies','globalcustomfields','CmCustomField','chatqueues','ChatQueue','FaxAccount','inboundroutes','internalroutes','VoiceExtension','contexts','VoiceContext','voicemails','VoiceMail','voicerecordings','VoiceRecording','User','role','agent','Telephones','telephone','VoiceQueues','queue','VoiceQueue','type','inbound','QueueCampaigns','musiconholds','VoiceMusicOnHold','chanspies','VoiceChanSpy','voiceprefixes','VoicePrefix','ivrcampaigns','Campaign','mailqueues','MailQueue','mailaccounts','MailAccount','mailsubstatuses','MailSubstatus','OpenchannelQueue','smsqueues','SmsQueue','smsaccounts','whatsappqueues','WhatsappAccount','teams','voicequeues','queuecampaigns','users','agents','user','ZendeskAccount','SalesforceAccount','freshdeskaccounts','FreshdeskAccount','sugarcrmaccounts','deskaccounts','DeskAccount','zohoaccounts','ZohoAccount','cannedanswers','dispositions','customdashboards','Dashboard','Interval','pauses','Pause','scheduler','Schedule','sounds','Sound','tags','templates','Variable','Plugin','extractedreports','reportId','AnalyticMetric','charAt','toUpperCase','slice','Sequelize','QueryTypes','SELECT','select','ui.','InteractionId','ui.createdAt','from','ui.UserId\x20=\x20?','sequelize','query','toString','OpenTabs','define','UserProfile','user_profiles','raw','section','mergeResources','Invalid\x20section\x20\x27','isEmpty','length','UserProfileSection','params','all','ignore','union','find','push','autoAssociation','rawAttributes','keys','intersection','fields','attributes','hasOwnProperty','nolimit','limit','offset','sort','where','pick','filters','merge','key','VIRTUAL','foreignKey','forEach','options','includeAll','include','default','DefaultReports','count','rows','ids','order','customSorting','Tag','Tags','tag','ThroughTags','color','Agents','chat','dataValues','fax','mail','openchannel','./userProfile.attributes'];(function(_0x5b9168,_0x203c8a){var _0x1c8403=function(_0x59b381){while(--_0x59b381){_0x5b9168['push'](_0x5b9168['shift']());}};_0x1c8403(++_0x203c8a);}(_0xa518,0x16d));var _0x8a51=function(_0xf61586,_0x56b0c4){_0xf61586=_0xf61586-0x0;var _0x2b6eb3=_0xa518[_0xf61586];return _0x2b6eb3;};'use strict';var _=require('lodash');var attributes=require(_0x8a51('0x0'));var squel=require(_0x8a51('0x1'));module[_0x8a51('0x2')]=function(_0x3cba47){var _0x38596d=_0x3cba47['models'];function _0x4e9c3f(_0x3c202b,_0x4906c2){return new Promise(function(_0x5b4d97,_0x4d5eaa){if(!_0x4906c2)return _0x5b4d97(null);var _0x3360fc=_0x4906c2[_0x8a51('0x3')]?{[_0x4906c2['filter']['field']]:_0x4906c2[_0x8a51('0x3')][_0x8a51('0x4')]}:undefined;return _0x38596d[_0x3c202b]['findAll']({'where':_0x3360fc,'raw':!![]})[_0x8a51('0x5')](function(_0x2e55fd){_0x4906c2['associatedResources']=_['map'](_0x2e55fd,'id');_0x5b4d97(_0x4906c2);})[_0x8a51('0x6')](function(_0x579252){_0x4d5eaa(_0x579252);});});}function _0x4a3ed3(_0x1526c8,_0x8c0b5b){return new Promise(function(_0x553f54,_0xd0c9b6){var _0x3c096c=_0x1526c8[_0x8a51('0x3')]?{[_0x1526c8[_0x8a51('0x3')][_0x8a51('0x7')]]:_0x1526c8[_0x8a51('0x3')]['value']}:undefined;return _0x38596d[_0x1526c8[_0x8a51('0x8')]][_0x8a51('0x9')]({'where':_0x3c096c,'raw':!![]})[_0x8a51('0x5')](function(_0x1a44bc){_0x8c0b5b['associatedResources']=_[_0x8a51('0xa')](_0x1a44bc,function(_0x389d4d){return _0x389d4d[_0x8a51('0xb')];});_0x553f54(_0x8c0b5b);})[_0x8a51('0x6')](function(_0x445ce7){_0xd0c9b6(_0x445ce7);});});}function _0x227138(_0x2901cc,_0x4e7110,_0x14591c){if(!_0x4e7110)return Promise['resolve'](null);return new Promise(function(_0x4b1d15,_0x39bd26){return _0x38596d[_0x8a51('0xc')]['findAll']({'where':{'sectionId':_0x4e7110['id']},'raw':!![]})[_0x8a51('0x5')](function(_0x454dc9){if(_0x2901cc[_0x8a51('0x7')]&&_0x2901cc[_0x8a51('0x7')]!=='id'){_0x4e7110[_0x8a51('0xd')]=_[_0x8a51('0xa')](_0x454dc9,function(_0x1fc156){return _0x1fc156[_0x2901cc[_0x8a51('0x7')]];});}else{if(_0x14591c===_0x8a51('0xe')){_0x4e7110['associatedResources']=_[_0x8a51('0xa')](_0x454dc9,function(_0x2fc528){return{'id':_0x2fc528[_0x8a51('0xf')],'type':_0x2fc528['type']};});}else{_0x4e7110[_0x8a51('0xd')]=_['map'](_0x454dc9,function(_0x380e6a){return _0x380e6a[_0x8a51('0xf')];});}}_0x4b1d15(_0x4e7110);})['catch'](function(_0x40bbc9){_0x39bd26(_0x40bbc9);});});}function _0x1d9cdc(_0x2f8d3e,_0x367d64){var _0x3680b2={'parentSections':[]};switch(_0x2f8d3e[_0x8a51('0x10')]()){case _0x8a51('0x11'):_0x3680b2['childModel']=_0x8a51('0x12');break;case _0x8a51('0x13'):_0x3680b2[_0x8a51('0x14')]='SquareOdbc';break;case _0x8a51('0x15'):_0x3680b2['childModel']=_0x8a51('0x16');_0x3680b2[_0x8a51('0x17')]=[{'name':'SquareProjects','field':'name','foreignKey':_0x8a51('0x18')}];break;case _0x8a51('0x19'):_0x3680b2[_0x8a51('0x14')]='JscriptyProject';break;case _0x8a51('0x1a'):_0x3680b2[_0x8a51('0x14')]=_0x8a51('0x1b');_0x3680b2[_0x8a51('0x17')]=[{'name':_0x8a51('0x1c'),'field':'id','foreignKey':_0x8a51('0x1d')}];break;case _0x8a51('0x1e'):_0x3680b2['childModel']=_0x8a51('0x1f');break;case _0x8a51('0x20'):_0x3680b2[_0x8a51('0x14')]='CmCompany';break;case _0x8a51('0x21'):_0x3680b2[_0x8a51('0x14')]=_0x8a51('0x22');break;case _0x8a51('0x23'):_0x3680b2[_0x8a51('0x14')]=_0x8a51('0x24');break;case'chatwebsites':_0x3680b2[_0x8a51('0x14')]='ChatWebsite';break;case'faxqueues':_0x3680b2[_0x8a51('0x14')]='FaxQueue';break;case'faxaccounts':_0x3680b2[_0x8a51('0x14')]=_0x8a51('0x25');break;case _0x8a51('0x26'):case _0x8a51('0x27'):case'outboundroutes':_0x3680b2['childModel']=_0x8a51('0x28');break;case _0x8a51('0x29'):_0x3680b2[_0x8a51('0x14')]=_0x8a51('0x2a');break;case _0x8a51('0x2b'):_0x3680b2['childModel']=_0x8a51('0x2c');break;case _0x8a51('0x2d'):_0x3680b2[_0x8a51('0x14')]=_0x8a51('0x2e');_0x3680b2[_0x8a51('0x17')]=[{'name':'Agents','field':_0x8a51('0xb'),'foreignKey':'membername','model':_0x8a51('0x2f'),'filter':{'field':_0x8a51('0x30'),'value':[_0x8a51('0x31')]}},{'name':_0x8a51('0x32'),'field':_0x8a51('0xb'),'foreignKey':'membername','model':_0x8a51('0x2f'),'filter':{'field':_0x8a51('0x30'),'value':[_0x8a51('0x33')]}},{'name':_0x8a51('0x34'),'field':_0x8a51('0xb'),'foreignKey':_0x8a51('0x35'),'model':_0x8a51('0x36'),'filter':{'field':_0x8a51('0x37'),'value':[_0x8a51('0x38')]}},{'name':_0x8a51('0x39'),'field':_0x8a51('0xb'),'foreignKey':'queue','model':_0x8a51('0x36'),'filter':{'field':_0x8a51('0x37'),'value':['outbound']}}];break;case _0x8a51('0x3a'):_0x3680b2[_0x8a51('0x14')]=_0x8a51('0x3b');break;case _0x8a51('0x3c'):_0x3680b2[_0x8a51('0x14')]=_0x8a51('0x3d');break;case _0x8a51('0x3e'):_0x3680b2[_0x8a51('0x14')]=_0x8a51('0x3f');break;case _0x8a51('0x40'):_0x3680b2[_0x8a51('0x14')]=_0x8a51('0x41');break;case _0x8a51('0x42'):_0x3680b2[_0x8a51('0x14')]=_0x8a51('0x43');break;case _0x8a51('0x44'):_0x3680b2[_0x8a51('0x14')]=_0x8a51('0x45');break;case _0x8a51('0x46'):_0x3680b2[_0x8a51('0x14')]=_0x8a51('0x47');break;case'openchannelqueues':_0x3680b2[_0x8a51('0x14')]=_0x8a51('0x48');break;case'openchannelaccounts':_0x3680b2[_0x8a51('0x14')]='OpenchannelAccount';break;case _0x8a51('0x49'):_0x3680b2[_0x8a51('0x14')]=_0x8a51('0x4a');break;case _0x8a51('0x4b'):_0x3680b2[_0x8a51('0x14')]='SmsAccount';break;case _0x8a51('0x4c'):_0x3680b2[_0x8a51('0x14')]='WhatsappQueue';break;case'whatsappaccounts':_0x3680b2[_0x8a51('0x14')]=_0x8a51('0x4d');break;case _0x8a51('0x4e'):_0x3680b2[_0x8a51('0x14')]='Team';break;case _0x8a51('0x4f'):case _0x8a51('0x50'):_0x3680b2[_0x8a51('0x14')]='VoiceQueue';if(_0x367d64){_0x3680b2[_0x8a51('0x17')]=[{'name':_0x8a51('0x34')},{'name':_0x8a51('0x39')}];}break;case _0x8a51('0x51'):case _0x8a51('0x52'):case'telephones':_0x3680b2[_0x8a51('0x14')]='User';if(_0x367d64){_0x3680b2['parentSections']=[{'name':'Users','filter':{'field':_0x8a51('0x30'),'value':['admin',_0x8a51('0x53')]},'ignore':!![]},{'name':'Agents'},{'name':_0x8a51('0x32')}];}break;case'zendeskaccounts':_0x3680b2[_0x8a51('0x14')]=_0x8a51('0x54');break;case'salesforceaccounts':_0x3680b2[_0x8a51('0x14')]=_0x8a51('0x55');break;case _0x8a51('0x56'):_0x3680b2['childModel']=_0x8a51('0x57');break;case _0x8a51('0x58'):_0x3680b2[_0x8a51('0x14')]='SugarcrmAccount';break;case _0x8a51('0x59'):_0x3680b2[_0x8a51('0x14')]=_0x8a51('0x5a');break;case _0x8a51('0x5b'):_0x3680b2[_0x8a51('0x14')]=_0x8a51('0x5c');break;case'vtigeraccounts':_0x3680b2[_0x8a51('0x14')]=_0x8a51('0x2f');break;case _0x8a51('0x5d'):_0x3680b2['childModel']='CannedAnswer';break;case _0x8a51('0x5e'):_0x3680b2[_0x8a51('0x14')]='Disposition';break;case _0x8a51('0x5f'):_0x3680b2['childModel']=_0x8a51('0x60');break;case'intervals':_0x3680b2[_0x8a51('0x14')]=_0x8a51('0x61');break;case _0x8a51('0x62'):_0x3680b2[_0x8a51('0x14')]=_0x8a51('0x63');break;case _0x8a51('0x64'):_0x3680b2[_0x8a51('0x14')]=_0x8a51('0x65');break;case _0x8a51('0x66'):_0x3680b2['childModel']=_0x8a51('0x67');break;case _0x8a51('0x68'):_0x3680b2[_0x8a51('0x14')]='Tag';break;case _0x8a51('0x69'):_0x3680b2[_0x8a51('0x14')]='Template';break;case'triggers':_0x3680b2['childModel']='Trigger';break;case'trunks':_0x3680b2[_0x8a51('0x14')]='Trunk';break;case'variables':_0x3680b2[_0x8a51('0x14')]=_0x8a51('0x6a');break;case'plugins':_0x3680b2['childModel']=_0x8a51('0x6b');break;case _0x8a51('0x6c'):_0x3680b2[_0x8a51('0x14')]=_0x8a51('0xe');_0x3680b2[_0x8a51('0x17')]=[{'name':'Reports','field':'id','foreignKey':_0x8a51('0x6d')}];break;case'metrics':_0x3680b2[_0x8a51('0x14')]=_0x8a51('0x6e');break;}return _0x3680b2;}function _0x446bdc(_0x36eb83,_0x1a8937){var _0x9484ab=_0x36eb83[_0x8a51('0x6f')](0x0)[_0x8a51('0x70')]()+_0x36eb83[_0x8a51('0x71')](0x1);var _0x5336ce={'type':_0x38596d[_0x8a51('0x72')][_0x8a51('0x73')][_0x8a51('0x74')],'raw':!![]};return new Promise(function(_0x55f268,_0xa1d168){var _0x18932f=squel[_0x8a51('0x75')]()[_0x8a51('0x7')](_0x8a51('0x76')+_0x9484ab+_0x8a51('0x77'),'id')[_0x8a51('0x7')](_0x8a51('0x78'))[_0x8a51('0x79')]('user_has_'+_0x36eb83+'_interactions','ui')['where'](_0x8a51('0x7a'),_0x1a8937['id']);return _0x38596d[_0x8a51('0x7b')][_0x8a51('0x7c')](_0x18932f[_0x8a51('0x7d')](),_0x5336ce)[_0x8a51('0x5')](function(_0x386f8b){_0x1a8937[_0x9484ab+_0x8a51('0x7e')]=_0x386f8b;_0x55f268(_0x386f8b);})[_0x8a51('0x6')](function(_0x36b058){_0xa1d168(_0x36b058);});});}return _0x3cba47[_0x8a51('0x7f')](_0x8a51('0x80'),attributes,{'tableName':_0x8a51('0x81'),'paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0x3a8d32){var _0x48c63c=require('../../components/parsers/qs');var _0x178c42={'raw':_0x3a8d32[_0x8a51('0x7c')][_0x8a51('0x82')],'where':{}};var _0x134afd={};var _0x3850c4={'count':0x0,'rows':[]};var _0x129740=_0x3a8d32['query'][_0x8a51('0x83')];var _0xc3753d=_0x3a8d32[_0x8a51('0x7c')][_0x8a51('0x84')]||![];var _0x1bb071=_0x1d9cdc(_0x129740,_0xc3753d);if(!_0x1bb071[_0x8a51('0x14')])throw new Error(_0x8a51('0x85')+_0x129740+'\x27');var _0x22122a=[{'name':_0x129740}];if(!_[_0x8a51('0x86')](_0x1bb071[_0x8a51('0x17')]))_0x22122a=_0x1bb071['parentSections'];var _0x47556e=[];for(var _0x2e26cc=0x0;_0x2e26cc<_0x22122a[_0x8a51('0x87')];_0x2e26cc++){_0x47556e['push'](_0x38596d[_0x8a51('0x88')]['find']({'where':{'userProfileId':_0x3a8d32[_0x8a51('0x89')]['id'],'name':_0x22122a[_0x2e26cc][_0x8a51('0xb')]},'raw':!![]}));}return Promise[_0x8a51('0x8a')](_0x47556e)[_0x8a51('0x5')](function(_0x16e906){var _0x28f944=_[_0x8a51('0x3')](_0x16e906,function(_0x96d458){return _0x96d458?_0x96d458:undefined;});var _0x104d1d=_[_0x8a51('0x3')](_0x22122a,[_0x8a51('0x8b'),!![]]);var _0x41ea0c=_[_0x8a51('0x86')](_0x28f944)&&_[_0x8a51('0x86')](_0x104d1d)?null:_[_0x8a51('0x8c')](_0x104d1d,_0x28f944);if(!_0x41ea0c)return null;var _0x426c71=[];for(var _0x3dfb3c=0x0;_0x3dfb3c<_0x41ea0c[_0x8a51('0x87')];_0x3dfb3c++){var _0x36944c=_[_0x8a51('0x8d')](_0x22122a,function(_0x1b1e53){return _0x41ea0c[_0x3dfb3c]?_0x1b1e53[_0x8a51('0xb')]===_0x41ea0c[_0x3dfb3c][_0x8a51('0xb')]:null;});if(_0x36944c){if(_0x41ea0c[_0x3dfb3c]['ignore']){_0x426c71[_0x8a51('0x8e')](_0x4e9c3f(_0x1bb071[_0x8a51('0x14')],_0x41ea0c[_0x3dfb3c]));}else{if(!_0x41ea0c[_0x3dfb3c][_0x8a51('0x8f')]){_0x426c71[_0x8a51('0x8e')](_0x227138(_0x36944c,_0x41ea0c[_0x3dfb3c],_0x1bb071[_0x8a51('0x14')]));}else{if(_0x36944c[_0x8a51('0x8')]){_0x426c71[_0x8a51('0x8e')](_0x4a3ed3(_0x36944c,_0x41ea0c[_0x3dfb3c]));}}}}}return Promise[_0x8a51('0x8a')](_0x426c71);})[_0x8a51('0x5')](function(_0x612ea8){var _0x233cfe=_0x612ea8;var _0x48fb0e=null;if(_0x233cfe){_0x48fb0e=_0x233cfe['length']===0x1?_0x233cfe[0x0]:null;}if(!_0x48fb0e&&!_0x233cfe)return _0x3850c4;var _0x3439fe=_0x38596d[_0x1bb071[_0x8a51('0x14')]][_0x8a51('0x90')];_0x134afd[_0x8a51('0x8')]=_[_0x8a51('0x91')](_0x3439fe);_0x134afd[_0x8a51('0x7c')]=_[_0x8a51('0x91')](_0x3a8d32[_0x8a51('0x7c')]);_0x134afd['filters']=_[_0x8a51('0x92')](_0x134afd[_0x8a51('0x8')],_0x134afd[_0x8a51('0x7c')]);_0x178c42['attributes']=_[_0x8a51('0x92')](_0x134afd[_0x8a51('0x8')],_0x48c63c[_0x8a51('0x93')](_0x3a8d32[_0x8a51('0x7c')][_0x8a51('0x93')]));_0x178c42['attributes']=_0x178c42['attributes']['length']?_0x178c42[_0x8a51('0x94')]:_0x134afd[_0x8a51('0x8')];if(!_0x3a8d32[_0x8a51('0x7c')][_0x8a51('0x95')](_0x8a51('0x96'))){_0x178c42[_0x8a51('0x97')]=_0x48c63c['limit'](_0x3a8d32[_0x8a51('0x7c')]['limit']);_0x178c42[_0x8a51('0x98')]=_0x48c63c[_0x8a51('0x98')](_0x3a8d32[_0x8a51('0x7c')][_0x8a51('0x98')]);}_0x178c42['order']=_0x48c63c['sort'](_0x3a8d32[_0x8a51('0x7c')][_0x8a51('0x99')]);_0x178c42[_0x8a51('0x9a')]=_0x48c63c['filters'](_[_0x8a51('0x9b')](_0x3a8d32[_0x8a51('0x7c')],_0x134afd[_0x8a51('0x9c')]));if(_0x3a8d32[_0x8a51('0x7c')][_0x8a51('0x3')]){_0x178c42[_0x8a51('0x9a')]=_[_0x8a51('0x9d')](_0x178c42['where'],{'$or':_[_0x8a51('0xa')](_0x3439fe,function(_0x3e8fd3){if(_0x3e8fd3[_0x8a51('0x37')][_0x8a51('0x9e')]!==_0x8a51('0x9f')){var _0x322377={};_0x322377[_0x3e8fd3[_0x8a51('0x7')]]={'$like':'%'+_0x3a8d32['query'][_0x8a51('0x3')]+'%'};return _0x322377;}})});}var _0x284891=[];var _0xd60a22=null;var _0x4b254b={};if(_0x48fb0e){_0xd60a22=_[_0x8a51('0x8d')](_0x22122a,[_0x8a51('0xb'),_0x48fb0e[_0x8a51('0xb')]]);if(_0xd60a22['field']){_0x4b254b={};if(_0x1bb071[_0x8a51('0x14')]===_0x8a51('0xe')){_0x4b254b[_0xd60a22[_0x8a51('0xa0')]]=_[_0x8a51('0xa')](_0x48fb0e[_0x8a51('0xd')],'id');}else{_0x4b254b[_0xd60a22[_0x8a51('0xa0')]]=_0x48fb0e['associatedResources'];}_0x284891['push'](_0x4b254b);}else{_0x178c42[_0x8a51('0x9a')]['id']=_0x48fb0e['associatedResources'];}}else{for(var _0x474674=0x0;_0x474674<_0x233cfe[_0x8a51('0x87')];_0x474674++){_0xd60a22=_['find'](_0x22122a,['name',_0x233cfe[_0x474674][_0x8a51('0xb')]]);if(_0xd60a22[_0x8a51('0x7')]){_0x4b254b={};_0x4b254b[_0xd60a22[_0x8a51('0xa0')]]=_0x233cfe[_0x474674][_0x8a51('0xd')];_0x284891[_0x8a51('0x8e')](_0x4b254b);}else{if(!_0x178c42[_0x8a51('0x9a')]['id'])_0x178c42[_0x8a51('0x9a')]['id']=[];_0x233cfe[_0x474674][_0x8a51('0xd')][_0x8a51('0xa1')](function(_0x3dde40){_0x178c42[_0x8a51('0x9a')]['id'][_0x8a51('0x8e')](_0x3dde40);});}}}if(!_[_0x8a51('0x86')](_0x284891)){_0x178c42[_0x8a51('0x9a')]=_['merge'](_0x178c42[_0x8a51('0x9a')],{'$and':{'$or':_0x284891}});}_0x178c42=_['merge']({},_0x178c42,_0x3a8d32[_0x8a51('0xa2')]);if(_0x48fb0e&&!_0x48fb0e[_0x8a51('0x8f')]&&_0x1bb071['childModel']===_0x8a51('0xe')){if(_0x3a8d32[_0x8a51('0x7c')][_0x8a51('0xa3')]){_0x178c42[_0x8a51('0xa4')]=[{'all':!![]}];}return _0x38596d[_0x1bb071['childModel']]['findAll'](_0x178c42)['then'](function(_0x337519){var _0x3ca53c=[];_0x337519[_0x8a51('0xa1')](function(_0x273b3b){var _0x23940d;switch(_0x273b3b['reportType']){case _0x8a51('0xa5'):_0x23940d=_[_0x8a51('0x8d')](_0x48fb0e['associatedResources'],function(_0x4d4afc){return _0x4d4afc['id']===_0x273b3b['reportId']&&_0x4d4afc[_0x8a51('0x37')]===_0x8a51('0xa6');});break;case'custom':_0x23940d=_[_0x8a51('0x8d')](_0x48fb0e[_0x8a51('0xd')],function(_0x418563){return _0x418563['id']===_0x273b3b[_0x8a51('0x6d')]&&_0x418563[_0x8a51('0x37')]==='CustomReports';});break;}if(_0x23940d)_0x3ca53c[_0x8a51('0x8e')](_0x273b3b);});_0x3850c4[_0x8a51('0xa7')]=_0x3ca53c[_0x8a51('0x87')];_0x3850c4[_0x8a51('0xa8')]=_0x3ca53c;return _0x3850c4;});}else{if(!_['isEmpty'](_0x3a8d32[_0x8a51('0x7c')][_0x8a51('0xa9')])){_0x178c42[_0x8a51('0x9a')]['id']=_0x178c42[_0x8a51('0x9a')]['id']?_[_0x8a51('0x92')](_0x178c42[_0x8a51('0x9a')]['id'],_0x3a8d32[_0x8a51('0x7c')][_0x8a51('0xa9')]):_0x3a8d32['query'][_0x8a51('0xa9')];if(_0x3a8d32[_0x8a51('0x7c')]['customSorting']){_0x178c42[_0x8a51('0xaa')]=_0x3a8d32[_0x8a51('0x7c')][_0x8a51('0xab')];}}if(_0x3a8d32[_0x8a51('0x7c')]['extraQueryConditions']){_0x178c42['where']=_[_0x8a51('0x9d')](_0x178c42['where'],{'$and':_0x3a8d32[_0x8a51('0x7c')]['extraQueryConditions']});}return _0x38596d[_0x1bb071[_0x8a51('0x14')]]['count']({'where':_0x178c42[_0x8a51('0x9a')]})['then'](function(_0x414770){_0x3850c4[_0x8a51('0xa7')]=_0x414770;if(_0x3a8d32[_0x8a51('0x7c')][_0x8a51('0xa3')]){if(_0x1bb071[_0x8a51('0x14')]==='CmContact'){_0x178c42[_0x8a51('0xa4')]=[{'model':_0x38596d[_0x8a51('0xac')],'as':_0x8a51('0xad'),'attributes':['id',_0x8a51('0xb'),'color'],'required':_0x3a8d32[_0x8a51('0x7c')][_0x8a51('0xae')]?!![]:![]},{'model':_0x38596d['Tag'],'as':_0x8a51('0xaf'),'attributes':['id',_0x8a51('0xb'),_0x8a51('0xb0')],'through':_0x3a8d32['query']['tag']?{'attributes':[],'where':{'TagId':_0x3a8d32[_0x8a51('0x7c')]['tag']||undefined}}:{},'required':_0x3a8d32['query'][_0x8a51('0xae')]?!![]:![]}];}else{_0x178c42['include']=[{'all':!![]}];}}return _0x38596d[_0x1bb071[_0x8a51('0x14')]][_0x8a51('0x9')](_0x178c42);})[_0x8a51('0x5')](function(_0x5117d1){_0x3850c4[_0x8a51('0xa8')]=_0x5117d1;if(_0x129740===_0x8a51('0xb1')&&_0x3a8d32[_0x8a51('0x7c')]['openTabs']==='true'){var _0x5dc15c=[];for(var _0x19176b=0x0;_0x19176b<_0x3850c4[_0x8a51('0xa8')][_0x8a51('0x87')];_0x19176b++){_0x5dc15c['push'](_0x446bdc(_0x8a51('0xb2'),_0x3850c4[_0x8a51('0xa8')][_0x19176b][_0x8a51('0xb3')]));_0x5dc15c[_0x8a51('0x8e')](_0x446bdc('sms',_0x3850c4[_0x8a51('0xa8')][_0x19176b]['dataValues']));_0x5dc15c[_0x8a51('0x8e')](_0x446bdc(_0x8a51('0xb4'),_0x3850c4[_0x8a51('0xa8')][_0x19176b][_0x8a51('0xb3')]));_0x5dc15c['push'](_0x446bdc(_0x8a51('0xb5'),_0x3850c4[_0x8a51('0xa8')][_0x19176b][_0x8a51('0xb3')]));_0x5dc15c['push'](_0x446bdc(_0x8a51('0xb6'),_0x3850c4[_0x8a51('0xa8')][_0x19176b]['dataValues']));_0x5dc15c[_0x8a51('0x8e')](_0x446bdc('whatsapp',_0x3850c4['rows'][_0x19176b][_0x8a51('0xb3')]));}return Promise[_0x8a51('0x8a')](_0x5dc15c)[_0x8a51('0x5')](function(){return _0x3850c4;});}return _0x3850c4;});}});}}});}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.rpc.js b/server/api/userProfile/userProfile.rpc.js index 7a1ee80..0552fa2 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 _0xf3fe=['./userProfile.socket','register','request','then','UserProfile,\x20%s,\x20%s','request\x20sent','UserProfile,\x20%s,\x20%s,\x20%s','stringify','error','code','message','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','redis','defaults','localhost','socket.io-emitter'];(function(_0x401d67,_0xeb1592){var _0x25076b=function(_0x233577){while(--_0x233577){_0x401d67['push'](_0x401d67['shift']());}};_0x25076b(++_0xeb1592);}(_0xf3fe,0x1cd));var _0xef3f=function(_0x39c516,_0x256a15){_0x39c516=_0x39c516-0x0;var _0x20bdd9=_0xf3fe[_0x39c516];return _0x20bdd9;};'use strict';var _=require('lodash');var util=require(_0xef3f('0x0'));var moment=require(_0xef3f('0x1'));var BPromise=require(_0xef3f('0x2'));var rs=require(_0xef3f('0x3'));var fs=require('fs');var Redis=require(_0xef3f('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xef3f('0x5'));var logger=require(_0xef3f('0x6'))(_0xef3f('0x7'));var config=require(_0xef3f('0x8'));var jayson=require(_0xef3f('0x9'));var client=jayson['client']['http']({'port':0x232a});config[_0xef3f('0xa')]=_[_0xef3f('0xb')](config[_0xef3f('0xa')],{'host':_0xef3f('0xc'),'port':0x18eb});var socket=require(_0xef3f('0xd'))(new Redis(config[_0xef3f('0xa')]));require(_0xef3f('0xe'))[_0xef3f('0xf')](socket);function respondWithRpcPromise(_0x386022,_0x5e558c,_0x3eb85b){return new BPromise(function(_0x48818b,_0x3f47b7){return client[_0xef3f('0x10')](_0x386022,_0x3eb85b)[_0xef3f('0x11')](function(_0x33e66f){logger['info'](_0xef3f('0x12'),_0x5e558c,_0xef3f('0x13'));logger['debug'](_0xef3f('0x14'),_0x5e558c,'request\x20sent',JSON[_0xef3f('0x15')](_0x33e66f));if(_0x33e66f['error']){if(_0x33e66f[_0xef3f('0x16')][_0xef3f('0x17')]===0x1f4){logger[_0xef3f('0x16')](_0xef3f('0x12'),_0x5e558c,_0x33e66f[_0xef3f('0x16')][_0xef3f('0x18')]);return _0x3f47b7(_0x33e66f[_0xef3f('0x16')][_0xef3f('0x18')]);}logger[_0xef3f('0x16')](_0xef3f('0x12'),_0x5e558c,_0x33e66f[_0xef3f('0x16')]['message']);return _0x48818b(_0x33e66f[_0xef3f('0x16')][_0xef3f('0x18')]);}else{logger['info'](_0xef3f('0x12'),_0x5e558c,_0xef3f('0x13'));_0x48818b(_0x33e66f['result']['message']);}})['catch'](function(_0x4909b9){logger[_0xef3f('0x16')](_0xef3f('0x12'),_0x5e558c,_0x4909b9);_0x3f47b7(_0x4909b9);});});} \ No newline at end of file +var _0x8ff3=['../../config/utils','../../config/environment','client','redis','defaults','localhost','socket.io-emitter','./userProfile.socket','register','then','info','request\x20sent','debug','UserProfile,\x20%s,\x20%s,\x20%s','error','UserProfile,\x20%s,\x20%s','message','result','lodash','util','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x4e9628,_0x250573){var _0x27bc8c=function(_0xb3b7ae){while(--_0xb3b7ae){_0x4e9628['push'](_0x4e9628['shift']());}};_0x27bc8c(++_0x250573);}(_0x8ff3,0x72));var _0x38ff=function(_0x4307d0,_0x31ae0){_0x4307d0=_0x4307d0-0x0;var _0x4bb86f=_0x8ff3[_0x4307d0];return _0x4bb86f;};'use strict';var _=require(_0x38ff('0x0'));var util=require(_0x38ff('0x1'));var moment=require('moment');var BPromise=require(_0x38ff('0x2'));var rs=require(_0x38ff('0x3'));var fs=require('fs');var Redis=require(_0x38ff('0x4'));var db=require(_0x38ff('0x5'))['db'];var utils=require(_0x38ff('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x38ff('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x38ff('0x8')]['http']({'port':0x232a});config[_0x38ff('0x9')]=_[_0x38ff('0xa')](config[_0x38ff('0x9')],{'host':_0x38ff('0xb'),'port':0x18eb});var socket=require(_0x38ff('0xc'))(new Redis(config[_0x38ff('0x9')]));require(_0x38ff('0xd'))[_0x38ff('0xe')](socket);function respondWithRpcPromise(_0x17820a,_0x3a701b,_0x261325){return new BPromise(function(_0x217abf,_0x11058d){return client['request'](_0x17820a,_0x261325)[_0x38ff('0xf')](function(_0x9d5d77){logger[_0x38ff('0x10')]('UserProfile,\x20%s,\x20%s',_0x3a701b,_0x38ff('0x11'));logger[_0x38ff('0x12')](_0x38ff('0x13'),_0x3a701b,_0x38ff('0x11'),JSON['stringify'](_0x9d5d77));if(_0x9d5d77[_0x38ff('0x14')]){if(_0x9d5d77[_0x38ff('0x14')]['code']===0x1f4){logger[_0x38ff('0x14')](_0x38ff('0x15'),_0x3a701b,_0x9d5d77[_0x38ff('0x14')]['message']);return _0x11058d(_0x9d5d77[_0x38ff('0x14')]['message']);}logger[_0x38ff('0x14')]('UserProfile,\x20%s,\x20%s',_0x3a701b,_0x9d5d77[_0x38ff('0x14')]['message']);return _0x217abf(_0x9d5d77['error'][_0x38ff('0x16')]);}else{logger[_0x38ff('0x10')](_0x38ff('0x15'),_0x3a701b,_0x38ff('0x11'));_0x217abf(_0x9d5d77[_0x38ff('0x17')][_0x38ff('0x16')]);}})['catch'](function(_0x2f9a29){logger[_0x38ff('0x14')]('UserProfile,\x20%s,\x20%s',_0x3a701b,_0x2f9a29);_0x11058d(_0x2f9a29);});});} \ No newline at end of file diff --git a/server/api/userProfile/userProfile.socket.js b/server/api/userProfile/userProfile.socket.js index fb7eb6d..3569880 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 _0xa885=['./userProfile.events','save','update','removeListener','register','userProfile:'];(function(_0x5d1b95,_0x5d1c9a){var _0x126bb=function(_0x79c375){while(--_0x79c375){_0x5d1b95['push'](_0x5d1b95['shift']());}};_0x126bb(++_0x5d1c9a);}(_0xa885,0x1da));var _0x5a88=function(_0x5717fa,_0x420e1a){_0x5717fa=_0x5717fa-0x0;var _0x1d5a30=_0xa885[_0x5717fa];return _0x1d5a30;};'use strict';var UserProfileEvents=require(_0x5a88('0x0'));var events=[_0x5a88('0x1'),'remove',_0x5a88('0x2')];function createListener(_0x28486e,_0x4686a0){return function(_0x2f11c9){_0x4686a0['emit'](_0x28486e,_0x2f11c9);};}function removeListener(_0x3cdd44,_0x59a0db){return function(){UserProfileEvents[_0x5a88('0x3')](_0x3cdd44,_0x59a0db);};}exports[_0x5a88('0x4')]=function(_0x5adb48){for(var _0x3868bf=0x0,_0x5517dd=events['length'];_0x3868bf<_0x5517dd;_0x3868bf++){var _0x450b8d=events[_0x3868bf];var _0x1b3b6e=createListener(_0x5a88('0x5')+_0x450b8d,_0x5adb48);UserProfileEvents['on'](_0x450b8d,_0x1b3b6e);}}; \ No newline at end of file +var _0xe3c8=['removeListener','length','userProfile:','./userProfile.events','emit'];(function(_0x46eed4,_0x23d556){var _0x1a6d1b=function(_0x19a25a){while(--_0x19a25a){_0x46eed4['push'](_0x46eed4['shift']());}};_0x1a6d1b(++_0x23d556);}(_0xe3c8,0xad));var _0x8e3c=function(_0x1bdeaa,_0x43d898){_0x1bdeaa=_0x1bdeaa-0x0;var _0xfda613=_0xe3c8[_0x1bdeaa];return _0xfda613;};'use strict';var UserProfileEvents=require(_0x8e3c('0x0'));var events=['save','remove','update'];function createListener(_0x2ae89d,_0xd303eb){return function(_0x2a9335){_0xd303eb[_0x8e3c('0x1')](_0x2ae89d,_0x2a9335);};}function removeListener(_0xc05ab5,_0x3fd461){return function(){UserProfileEvents[_0x8e3c('0x2')](_0xc05ab5,_0x3fd461);};}exports['register']=function(_0x41f753){for(var _0x49d7a1=0x0,_0x5c0619=events[_0x8e3c('0x3')];_0x49d7a1<_0x5c0619;_0x49d7a1++){var _0x1a44bf=events[_0x49d7a1];var _0x467527=createListener(_0x8e3c('0x4')+_0x1a44bf,_0x41f753);UserProfileEvents['on'](_0x1a44bf,_0x467527);}}; \ No newline at end of file diff --git a/server/api/userProfileResource/index.js b/server/api/userProfileResource/index.js index f777585..cba94bd 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(_0x5783f4,_0x4a9e0a){var _0x28e380=function(_0x1ffc49){while(--_0x1ffc49){_0x5783f4['push'](_0x5783f4['shift']());}};_0x28e380(++_0x4a9e0a);}(_0xda01,0x155));var _0x1da0=function(_0xcf8113,_0x132733){_0xcf8113=_0xcf8113-0x0;var _0x5b354f=_0xda01[_0xcf8113];return _0x5b354f;};'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 _0xc5d8=['describe','isAuthenticated','show','post','create','put','/:id','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./userProfileResource.controller','get','/describe'];(function(_0x3bf0f5,_0x29210c){var _0x3baa96=function(_0x461676){while(--_0x461676){_0x3bf0f5['push'](_0x3bf0f5['shift']());}};_0x3baa96(++_0x29210c);}(_0xc5d8,0x10d));var _0x8c5d=function(_0x46759d,_0x13e994){_0x46759d=_0x46759d-0x0;var _0x3e7fe0=_0xc5d8[_0x46759d];return _0x3e7fe0;};'use strict';var multer=require(_0x8c5d('0x0'));var util=require(_0x8c5d('0x1'));var path=require('path');var timeout=require(_0x8c5d('0x2'));var express=require(_0x8c5d('0x3'));var router=express[_0x8c5d('0x4')]();var fs_extra=require(_0x8c5d('0x5'));var auth=require(_0x8c5d('0x6'));var interaction=require(_0x8c5d('0x7'));var config=require('../../config/environment');var controller=require(_0x8c5d('0x8'));router[_0x8c5d('0x9')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x8c5d('0xa'),auth['isAuthenticated'](),controller[_0x8c5d('0xb')]);router[_0x8c5d('0x9')]('/:id',auth[_0x8c5d('0xc')](),controller[_0x8c5d('0xd')]);router[_0x8c5d('0xe')]('/',auth[_0x8c5d('0xc')](),controller[_0x8c5d('0xf')]);router[_0x8c5d('0x10')]('/:id',auth[_0x8c5d('0xc')](),controller['update']);router['delete'](_0x8c5d('0x11'),auth['isAuthenticated'](),controller[_0x8c5d('0x12')]);module[_0x8c5d('0x13')]=router; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.attributes.js b/server/api/userProfileResource/userProfileResource.attributes.js index 3fa7102..17b143b 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 _0x4e63=['STRING','INTEGER','exports'];(function(_0x1e4f2f,_0x35edfa){var _0xccea89=function(_0x164386){while(--_0x164386){_0x1e4f2f['push'](_0x1e4f2f['shift']());}};_0xccea89(++_0x35edfa);}(_0x4e63,0x149));var _0x34e6=function(_0x543883,_0x445787){_0x543883=_0x543883-0x0;var _0x258678=_0x4e63[_0x543883];return _0x258678;};'use strict';var Sequelize=require('sequelize');module[_0x34e6('0x0')]={'name':{'type':Sequelize[_0x34e6('0x1')],'allowNull':![]},'resourceId':{'type':Sequelize[_0x34e6('0x2')],'allowNull':![]},'type':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file +var _0x20cb=['INTEGER','sequelize','exports'];(function(_0x215ef7,_0x590e45){var _0x40a37b=function(_0x13fd4c){while(--_0x13fd4c){_0x215ef7['push'](_0x215ef7['shift']());}};_0x40a37b(++_0x590e45);}(_0x20cb,0x199));var _0xb20c=function(_0x181c73,_0x1c6026){_0x181c73=_0x181c73-0x0;var _0x45fee5=_0x20cb[_0x181c73];return _0x45fee5;};'use strict';var Sequelize=require(_0xb20c('0x0'));module[_0xb20c('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'resourceId':{'type':Sequelize[_0xb20c('0x2')],'allowNull':![]},'type':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.controller.js b/server/api/userProfileResource/userProfileResource.controller.js index 3062d26..6b6aa62 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 _0x7096=['Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','name','send','map','rawAttributes','fieldName','type','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','limit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','rows','params','UserProfileResource','find','catch','create','body','describe','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','offset','undefined','count','set'];(function(_0x189dbd,_0x1d3cad){var _0x7861fb=function(_0x1a8738){while(--_0x1a8738){_0x189dbd['push'](_0x189dbd['shift']());}};_0x7861fb(++_0x1d3cad);}(_0x7096,0x10c));var _0x6709=function(_0x4e9628,_0x250573){_0x4e9628=_0x4e9628-0x0;var _0x27bc8c=_0x7096[_0x4e9628];return _0x27bc8c;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x6709('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6709('0x1'));var rp=require('request-promise');var moment=require(_0x6709('0x2'));var BPromise=require(_0x6709('0x3'));var Mustache=require(_0x6709('0x4'));var util=require(_0x6709('0x5'));var path=require(_0x6709('0x6'));var sox=require(_0x6709('0x7'));var csv=require(_0x6709('0x8'));var ejs=require(_0x6709('0x9'));var fs=require('fs');var fs_extra=require(_0x6709('0xa'));var _=require(_0x6709('0xb'));var squel=require(_0x6709('0xc'));var crypto=require(_0x6709('0xd'));var jsforce=require(_0x6709('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x6709('0xf'));var Papa=require(_0x6709('0x10'));var Redis=require(_0x6709('0x11'));var authService=require(_0x6709('0x12'));var qs=require(_0x6709('0x13'));var as=require(_0x6709('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x6709('0x15'));var utils=require(_0x6709('0x16'));var config=require(_0x6709('0x17'));var licenseUtil=require(_0x6709('0x18'));var db=require(_0x6709('0x19'))['db'];function respondWithStatusCode(_0x288f51,_0x1d56a5){_0x1d56a5=_0x1d56a5||0xcc;return function(_0x1ac547){if(_0x1ac547){return _0x288f51['sendStatus'](_0x1d56a5);}return _0x288f51[_0x6709('0x1a')](_0x1d56a5)[_0x6709('0x1b')]();};}function respondWithResult(_0x4d5255,_0x3706e1){_0x3706e1=_0x3706e1||0xc8;return function(_0x4e4587){if(_0x4e4587){return _0x4d5255[_0x6709('0x1a')](_0x3706e1)['json'](_0x4e4587);}};}function respondWithFilteredResult(_0x41af1f,_0x4bc059){return function(_0x149233){if(_0x149233){var _0x28866a=typeof _0x4bc059[_0x6709('0x1c')]===_0x6709('0x1d')&&typeof _0x4bc059['limit']==='undefined';var _0x5c4f94=_0x149233[_0x6709('0x1e')];var _0x235a54=_0x28866a?0x0:_0x4bc059['offset'];var _0x9c1fd8=_0x28866a?_0x149233[_0x6709('0x1e')]:_0x4bc059[_0x6709('0x1c')]+_0x4bc059['limit'];var _0x13cf04;if(_0x9c1fd8>=_0x5c4f94){_0x9c1fd8=_0x5c4f94;_0x13cf04=0xc8;}else{_0x13cf04=0xce;}_0x41af1f[_0x6709('0x1a')](_0x13cf04);return _0x41af1f[_0x6709('0x1f')](_0x6709('0x20'),_0x235a54+'-'+_0x9c1fd8+'/'+_0x5c4f94)['json'](_0x149233);}return null;};}function patchUpdates(_0x3c4971){return function(_0x1edac3){try{jsonpatch[_0x6709('0x21')](_0x1edac3,_0x3c4971,!![]);}catch(_0x3cf882){return BPromise[_0x6709('0x22')](_0x3cf882);}return _0x1edac3[_0x6709('0x23')]();};}function saveUpdates(_0x45921e,_0x17763d){return function(_0x386224){if(_0x386224){return _0x386224[_0x6709('0x24')](_0x45921e)[_0x6709('0x25')](function(_0xa36371){return _0xa36371;});}return null;};}function removeEntity(_0x5cf48b,_0x29f25f){return function(_0x81138e){if(_0x81138e){return _0x81138e[_0x6709('0x26')]()['then'](function(){_0x5cf48b[_0x6709('0x1a')](0xcc)[_0x6709('0x1b')]();});}};}function handleEntityNotFound(_0x20a347,_0x44b465){return function(_0x588e00){if(!_0x588e00){_0x20a347[_0x6709('0x27')](0x194);}return _0x588e00;};}function handleError(_0x3076fe,_0x50f7d6){_0x50f7d6=_0x50f7d6||0x1f4;return function(_0x585073){logger[_0x6709('0x28')](_0x585073['stack']);if(_0x585073[_0x6709('0x29')]){delete _0x585073[_0x6709('0x29')];}_0x3076fe['status'](_0x50f7d6)[_0x6709('0x2a')](_0x585073);};}exports['index']=function(_0x46a325,_0x3cd555){var _0x5b6906={},_0x137137={},_0x4e6989={'count':0x0,'rows':[]};var _0xe066d8=_[_0x6709('0x2b')](db['UserProfileResource'][_0x6709('0x2c')],function(_0x5deff5){return{'name':_0x5deff5[_0x6709('0x2d')],'type':_0x5deff5[_0x6709('0x2e')]['key']};});_0x137137['model']=_[_0x6709('0x2b')](_0xe066d8,_0x6709('0x29'));_0x137137[_0x6709('0x2f')]=_[_0x6709('0x30')](_0x46a325[_0x6709('0x2f')]);_0x137137[_0x6709('0x31')]=_[_0x6709('0x32')](_0x137137[_0x6709('0x33')],_0x137137[_0x6709('0x2f')]);_0x5b6906['attributes']=_[_0x6709('0x32')](_0x137137[_0x6709('0x33')],qs[_0x6709('0x34')](_0x46a325[_0x6709('0x2f')]['fields']));_0x5b6906[_0x6709('0x35')]=_0x5b6906[_0x6709('0x35')][_0x6709('0x36')]?_0x5b6906[_0x6709('0x35')]:_0x137137['model'];if(!_0x46a325[_0x6709('0x2f')][_0x6709('0x37')]('nolimit')){_0x5b6906[_0x6709('0x38')]=qs[_0x6709('0x38')](_0x46a325['query'][_0x6709('0x38')]);_0x5b6906[_0x6709('0x1c')]=qs[_0x6709('0x1c')](_0x46a325[_0x6709('0x2f')][_0x6709('0x1c')]);}_0x5b6906[_0x6709('0x39')]=qs[_0x6709('0x3a')](_0x46a325['query'][_0x6709('0x3a')]);_0x5b6906[_0x6709('0x3b')]=qs['filters'](_[_0x6709('0x3c')](_0x46a325[_0x6709('0x2f')],_0x137137[_0x6709('0x31')]),_0xe066d8);if(_0x46a325[_0x6709('0x2f')][_0x6709('0x3d')]){_0x5b6906[_0x6709('0x3b')]=_['merge'](_0x5b6906[_0x6709('0x3b')],{'$or':_['map'](_0xe066d8,function(_0x31e05a){if(_0x31e05a[_0x6709('0x2e')]!==_0x6709('0x3e')){var _0x48492f={};_0x48492f[_0x31e05a[_0x6709('0x29')]]={'$like':'%'+_0x46a325[_0x6709('0x2f')][_0x6709('0x3d')]+'%'};return _0x48492f;}})});}_0x5b6906=_[_0x6709('0x3f')]({},_0x5b6906,_0x46a325[_0x6709('0x40')]);var _0x1030ee={'where':_0x5b6906[_0x6709('0x3b')]};return db['UserProfileResource'][_0x6709('0x1e')](_0x1030ee)[_0x6709('0x25')](function(_0x50fbcd){_0x4e6989[_0x6709('0x1e')]=_0x50fbcd;if(_0x46a325[_0x6709('0x2f')][_0x6709('0x41')]){_0x5b6906[_0x6709('0x42')]=[{'all':!![]}];}return db['UserProfileResource']['findAll'](_0x5b6906);})[_0x6709('0x25')](function(_0x3f0da1){_0x4e6989[_0x6709('0x43')]=_0x3f0da1;return _0x4e6989;})[_0x6709('0x25')](respondWithFilteredResult(_0x3cd555,_0x5b6906))['catch'](handleError(_0x3cd555,null));};exports['show']=function(_0x5af1fb,_0x3d4237){var _0x293577={'raw':![],'where':{'id':_0x5af1fb[_0x6709('0x44')]['id']}},_0x54f74e={};_0x54f74e[_0x6709('0x33')]=_['keys'](db['UserProfileResource'][_0x6709('0x2c')]);_0x54f74e[_0x6709('0x2f')]=_[_0x6709('0x30')](_0x5af1fb[_0x6709('0x2f')]);_0x54f74e[_0x6709('0x31')]=_['intersection'](_0x54f74e[_0x6709('0x33')],_0x54f74e['query']);_0x293577[_0x6709('0x35')]=_[_0x6709('0x32')](_0x54f74e[_0x6709('0x33')],qs['fields'](_0x5af1fb[_0x6709('0x2f')]['fields']));_0x293577['attributes']=_0x293577[_0x6709('0x35')][_0x6709('0x36')]?_0x293577[_0x6709('0x35')]:_0x54f74e[_0x6709('0x33')];if(_0x5af1fb[_0x6709('0x2f')][_0x6709('0x41')]){_0x293577[_0x6709('0x42')]=[{'all':!![]}];}_0x293577=_[_0x6709('0x3f')]({},_0x293577,_0x5af1fb[_0x6709('0x40')]);return db[_0x6709('0x45')][_0x6709('0x46')](_0x293577)[_0x6709('0x25')](handleEntityNotFound(_0x3d4237,null))[_0x6709('0x25')](respondWithResult(_0x3d4237,null))[_0x6709('0x47')](handleError(_0x3d4237,null));};exports[_0x6709('0x48')]=function(_0x4f82a0,_0xfbb810){return db['UserProfileResource']['create'](_0x4f82a0[_0x6709('0x49')],{})[_0x6709('0x25')](respondWithResult(_0xfbb810,0xc9))[_0x6709('0x47')](handleError(_0xfbb810,null));};exports[_0x6709('0x24')]=function(_0x22363b,_0x2b05dc){if(_0x22363b[_0x6709('0x49')]['id']){delete _0x22363b[_0x6709('0x49')]['id'];}return db['UserProfileResource'][_0x6709('0x46')]({'where':{'id':_0x22363b[_0x6709('0x44')]['id']}})[_0x6709('0x25')](handleEntityNotFound(_0x2b05dc,null))[_0x6709('0x25')](saveUpdates(_0x22363b['body'],null))[_0x6709('0x25')](respondWithResult(_0x2b05dc,null))['catch'](handleError(_0x2b05dc,null));};exports[_0x6709('0x26')]=function(_0x34a950,_0x2a563b){return db[_0x6709('0x45')][_0x6709('0x46')]({'where':{'id':_0x34a950['params']['id']}})[_0x6709('0x25')](handleEntityNotFound(_0x2a563b,null))[_0x6709('0x25')](removeEntity(_0x2a563b,null))[_0x6709('0x47')](handleError(_0x2a563b,null));};exports[_0x6709('0x4a')]=function(_0x1015e0,_0x55188c){return db['UserProfileResource'][_0x6709('0x4a')]()['then'](respondWithResult(_0x55188c,null))['catch'](handleError(_0x55188c,null));}; \ No newline at end of file +var _0x6d38=['findAll','rows','show','keys','filters','intersection','create','catch','body','find','params','describe','rimraf','zip-dir','fast-json-patch','bluebird','util','path','sox','ejs','fs-extra','lodash','squel','desk.js','to-csv','querystring','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','apply','save','update','then','stack','name','send','index','map','UserProfileResource','rawAttributes','type','key','model','query','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','options','includeAll','include'];(function(_0x21b359,_0x4dc80e){var _0x57b8e7=function(_0x135adb){while(--_0x135adb){_0x21b359['push'](_0x21b359['shift']());}};_0x57b8e7(++_0x4dc80e);}(_0x6d38,0x1ef));var _0x86d3=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0x6d38[_0x2b4411];return _0x8e41ef;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x86d3('0x0'));var zipdir=require(_0x86d3('0x1'));var jsonpatch=require(_0x86d3('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x86d3('0x3'));var Mustache=require('mustache');var util=require(_0x86d3('0x4'));var path=require(_0x86d3('0x5'));var sox=require(_0x86d3('0x6'));var csv=require('to-csv');var ejs=require(_0x86d3('0x7'));var fs=require('fs');var fs_extra=require(_0x86d3('0x8'));var _=require(_0x86d3('0x9'));var squel=require(_0x86d3('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x86d3('0xb'));var toCsv=require(_0x86d3('0xc'));var querystring=require(_0x86d3('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x86d3('0xe'));var qs=require(_0x86d3('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x86d3('0x10'))(_0x86d3('0x11'));var utils=require('../../config/utils');var config=require(_0x86d3('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0x86d3('0x13'))['db'];function respondWithStatusCode(_0x7d4d2e,_0x440a55){_0x440a55=_0x440a55||0xcc;return function(_0x26d64c){if(_0x26d64c){return _0x7d4d2e[_0x86d3('0x14')](_0x440a55);}return _0x7d4d2e[_0x86d3('0x15')](_0x440a55)[_0x86d3('0x16')]();};}function respondWithResult(_0x12ef4a,_0x5ce2ff){_0x5ce2ff=_0x5ce2ff||0xc8;return function(_0x1c1ba8){if(_0x1c1ba8){return _0x12ef4a[_0x86d3('0x15')](_0x5ce2ff)[_0x86d3('0x17')](_0x1c1ba8);}};}function respondWithFilteredResult(_0x207f6f,_0x1ea535){return function(_0x34fb3b){if(_0x34fb3b){var _0x1ff008=typeof _0x1ea535[_0x86d3('0x18')]==='undefined'&&typeof _0x1ea535[_0x86d3('0x19')]===_0x86d3('0x1a');var _0x431b3f=_0x34fb3b[_0x86d3('0x1b')];var _0x46feec=_0x1ff008?0x0:_0x1ea535[_0x86d3('0x18')];var _0x33e459=_0x1ff008?_0x34fb3b[_0x86d3('0x1b')]:_0x1ea535[_0x86d3('0x18')]+_0x1ea535['limit'];var _0x191ba5;if(_0x33e459>=_0x431b3f){_0x33e459=_0x431b3f;_0x191ba5=0xc8;}else{_0x191ba5=0xce;}_0x207f6f['status'](_0x191ba5);return _0x207f6f[_0x86d3('0x1c')]('Content-Range',_0x46feec+'-'+_0x33e459+'/'+_0x431b3f)['json'](_0x34fb3b);}return null;};}function patchUpdates(_0x41486a){return function(_0x1edb6d){try{jsonpatch[_0x86d3('0x1d')](_0x1edb6d,_0x41486a,!![]);}catch(_0x1720ae){return BPromise['reject'](_0x1720ae);}return _0x1edb6d[_0x86d3('0x1e')]();};}function saveUpdates(_0x55e1c3,_0x36e0fa){return function(_0x3fdf67){if(_0x3fdf67){return _0x3fdf67[_0x86d3('0x1f')](_0x55e1c3)['then'](function(_0x39d819){return _0x39d819;});}return null;};}function removeEntity(_0x72b3d4,_0x1fa4ac){return function(_0x4bf5b8){if(_0x4bf5b8){return _0x4bf5b8['destroy']()[_0x86d3('0x20')](function(){_0x72b3d4['status'](0xcc)[_0x86d3('0x16')]();});}};}function handleEntityNotFound(_0x1bea5e,_0x3dfecd){return function(_0x3c5fe4){if(!_0x3c5fe4){_0x1bea5e['sendStatus'](0x194);}return _0x3c5fe4;};}function handleError(_0x481077,_0x3359e4){_0x3359e4=_0x3359e4||0x1f4;return function(_0x611764){logger['error'](_0x611764[_0x86d3('0x21')]);if(_0x611764['name']){delete _0x611764[_0x86d3('0x22')];}_0x481077[_0x86d3('0x15')](_0x3359e4)[_0x86d3('0x23')](_0x611764);};}exports[_0x86d3('0x24')]=function(_0x11a6fd,_0x14c9ff){var _0x1f203e={},_0x35d708={},_0x303f13={'count':0x0,'rows':[]};var _0x44dacf=_[_0x86d3('0x25')](db[_0x86d3('0x26')][_0x86d3('0x27')],function(_0x28c25e){return{'name':_0x28c25e['fieldName'],'type':_0x28c25e[_0x86d3('0x28')][_0x86d3('0x29')]};});_0x35d708[_0x86d3('0x2a')]=_[_0x86d3('0x25')](_0x44dacf,_0x86d3('0x22'));_0x35d708[_0x86d3('0x2b')]=_['keys'](_0x11a6fd[_0x86d3('0x2b')]);_0x35d708['filters']=_['intersection'](_0x35d708[_0x86d3('0x2a')],_0x35d708[_0x86d3('0x2b')]);_0x1f203e[_0x86d3('0x2c')]=_['intersection'](_0x35d708[_0x86d3('0x2a')],qs[_0x86d3('0x2d')](_0x11a6fd['query'][_0x86d3('0x2d')]));_0x1f203e[_0x86d3('0x2c')]=_0x1f203e[_0x86d3('0x2c')][_0x86d3('0x2e')]?_0x1f203e[_0x86d3('0x2c')]:_0x35d708[_0x86d3('0x2a')];if(!_0x11a6fd[_0x86d3('0x2b')][_0x86d3('0x2f')]('nolimit')){_0x1f203e['limit']=qs['limit'](_0x11a6fd[_0x86d3('0x2b')]['limit']);_0x1f203e[_0x86d3('0x18')]=qs['offset'](_0x11a6fd[_0x86d3('0x2b')][_0x86d3('0x18')]);}_0x1f203e[_0x86d3('0x30')]=qs[_0x86d3('0x31')](_0x11a6fd[_0x86d3('0x2b')][_0x86d3('0x31')]);_0x1f203e[_0x86d3('0x32')]=qs['filters'](_[_0x86d3('0x33')](_0x11a6fd[_0x86d3('0x2b')],_0x35d708['filters']),_0x44dacf);if(_0x11a6fd[_0x86d3('0x2b')][_0x86d3('0x34')]){_0x1f203e[_0x86d3('0x32')]=_[_0x86d3('0x35')](_0x1f203e['where'],{'$or':_[_0x86d3('0x25')](_0x44dacf,function(_0x42ac0d){if(_0x42ac0d[_0x86d3('0x28')]!=='VIRTUAL'){var _0x5762ca={};_0x5762ca[_0x42ac0d[_0x86d3('0x22')]]={'$like':'%'+_0x11a6fd[_0x86d3('0x2b')][_0x86d3('0x34')]+'%'};return _0x5762ca;}})});}_0x1f203e=_[_0x86d3('0x35')]({},_0x1f203e,_0x11a6fd[_0x86d3('0x36')]);var _0x3666fc={'where':_0x1f203e[_0x86d3('0x32')]};return db['UserProfileResource'][_0x86d3('0x1b')](_0x3666fc)[_0x86d3('0x20')](function(_0x2bdc67){_0x303f13[_0x86d3('0x1b')]=_0x2bdc67;if(_0x11a6fd['query'][_0x86d3('0x37')]){_0x1f203e[_0x86d3('0x38')]=[{'all':!![]}];}return db[_0x86d3('0x26')][_0x86d3('0x39')](_0x1f203e);})['then'](function(_0x587747){_0x303f13[_0x86d3('0x3a')]=_0x587747;return _0x303f13;})['then'](respondWithFilteredResult(_0x14c9ff,_0x1f203e))['catch'](handleError(_0x14c9ff,null));};exports[_0x86d3('0x3b')]=function(_0x1385fc,_0x43490a){var _0x35d6fe={'raw':![],'where':{'id':_0x1385fc['params']['id']}},_0x23ef72={};_0x23ef72[_0x86d3('0x2a')]=_[_0x86d3('0x3c')](db[_0x86d3('0x26')]['rawAttributes']);_0x23ef72[_0x86d3('0x2b')]=_[_0x86d3('0x3c')](_0x1385fc['query']);_0x23ef72[_0x86d3('0x3d')]=_[_0x86d3('0x3e')](_0x23ef72['model'],_0x23ef72['query']);_0x35d6fe['attributes']=_[_0x86d3('0x3e')](_0x23ef72[_0x86d3('0x2a')],qs[_0x86d3('0x2d')](_0x1385fc[_0x86d3('0x2b')][_0x86d3('0x2d')]));_0x35d6fe[_0x86d3('0x2c')]=_0x35d6fe['attributes'][_0x86d3('0x2e')]?_0x35d6fe[_0x86d3('0x2c')]:_0x23ef72['model'];if(_0x1385fc[_0x86d3('0x2b')][_0x86d3('0x37')]){_0x35d6fe[_0x86d3('0x38')]=[{'all':!![]}];}_0x35d6fe=_[_0x86d3('0x35')]({},_0x35d6fe,_0x1385fc[_0x86d3('0x36')]);return db[_0x86d3('0x26')]['find'](_0x35d6fe)[_0x86d3('0x20')](handleEntityNotFound(_0x43490a,null))[_0x86d3('0x20')](respondWithResult(_0x43490a,null))['catch'](handleError(_0x43490a,null));};exports[_0x86d3('0x3f')]=function(_0x412d0e,_0xd20863){return db[_0x86d3('0x26')][_0x86d3('0x3f')](_0x412d0e['body'],{})[_0x86d3('0x20')](respondWithResult(_0xd20863,0xc9))[_0x86d3('0x40')](handleError(_0xd20863,null));};exports[_0x86d3('0x1f')]=function(_0x14fa58,_0x369b75){if(_0x14fa58[_0x86d3('0x41')]['id']){delete _0x14fa58[_0x86d3('0x41')]['id'];}return db[_0x86d3('0x26')][_0x86d3('0x42')]({'where':{'id':_0x14fa58[_0x86d3('0x43')]['id']}})[_0x86d3('0x20')](handleEntityNotFound(_0x369b75,null))[_0x86d3('0x20')](saveUpdates(_0x14fa58['body'],null))[_0x86d3('0x20')](respondWithResult(_0x369b75,null))[_0x86d3('0x40')](handleError(_0x369b75,null));};exports['destroy']=function(_0x43290d,_0x23a6ee){return db[_0x86d3('0x26')][_0x86d3('0x42')]({'where':{'id':_0x43290d[_0x86d3('0x43')]['id']}})[_0x86d3('0x20')](handleEntityNotFound(_0x23a6ee,null))['then'](removeEntity(_0x23a6ee,null))['catch'](handleError(_0x23a6ee,null));};exports['describe']=function(_0x5bedc6,_0x159253){return db[_0x86d3('0x26')][_0x86d3('0x44')]()[_0x86d3('0x20')](respondWithResult(_0x159253,null))[_0x86d3('0x40')](handleError(_0x159253,null));}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.model.js b/server/api/userProfileResource/userProfileResource.model.js index 65494e5..8a40b22 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 _0x327b=['moment','request-promise','path','rimraf','../../config/environment','./userProfileResource.attributes','exports','define','UserProfileResource','user_profile_has_resources','compositeIndex','resourceId','sectionId','lodash','util','../../config/logger','api'];(function(_0x35cf60,_0x228d12){var _0x443cf8=function(_0x391c0f){while(--_0x391c0f){_0x35cf60['push'](_0x35cf60['shift']());}};_0x443cf8(++_0x228d12);}(_0x327b,0xfb));var _0xb327=function(_0x4a747d,_0x3b747f){_0x4a747d=_0x4a747d-0x0;var _0x3a5b5c=_0x327b[_0x4a747d];return _0x3a5b5c;};'use strict';var _=require(_0xb327('0x0'));var util=require(_0xb327('0x1'));var logger=require(_0xb327('0x2'))(_0xb327('0x3'));var moment=require(_0xb327('0x4'));var BPromise=require('bluebird');var rp=require(_0xb327('0x5'));var fs=require('fs');var path=require(_0xb327('0x6'));var rimraf=require(_0xb327('0x7'));var config=require(_0xb327('0x8'));var attributes=require(_0xb327('0x9'));module[_0xb327('0xa')]=function(_0x52d77d,_0x14e6b2){return _0x52d77d[_0xb327('0xb')](_0xb327('0xc'),attributes,{'tableName':_0xb327('0xd'),'paranoid':![],'indexes':[{'name':_0xb327('0xe'),'fields':[_0xb327('0xf'),_0xb327('0x10')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x5cb4=['util','../../config/logger','moment','path','rimraf','../../config/environment','./userProfileResource.attributes','exports','define','user_profile_has_resources','compositeIndex','resourceId','lodash'];(function(_0x4c7bad,_0x362b7a){var _0x196bcb=function(_0x5432f5){while(--_0x5432f5){_0x4c7bad['push'](_0x4c7bad['shift']());}};_0x196bcb(++_0x362b7a);}(_0x5cb4,0xf6));var _0x45cb=function(_0x1380e2,_0x343182){_0x1380e2=_0x1380e2-0x0;var _0xe04562=_0x5cb4[_0x1380e2];return _0xe04562;};'use strict';var _=require(_0x45cb('0x0'));var util=require(_0x45cb('0x1'));var logger=require(_0x45cb('0x2'))('api');var moment=require(_0x45cb('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x45cb('0x4'));var rimraf=require(_0x45cb('0x5'));var config=require(_0x45cb('0x6'));var attributes=require(_0x45cb('0x7'));module[_0x45cb('0x8')]=function(_0xa77fbc,_0x276195){return _0xa77fbc[_0x45cb('0x9')]('UserProfileResource',attributes,{'tableName':_0x45cb('0xa'),'paranoid':![],'indexes':[{'name':_0x45cb('0xb'),'fields':[_0x45cb('0xc'),'sectionId']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.rpc.js b/server/api/userProfileResource/userProfileResource.rpc.js index fa58587..22fb04c 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 _0xbda9=['request\x20sent','UserProfileResource,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','randomstring','ioredis','../../config/utils','rpc','client','http','request','then','info','UserProfileResource,\x20%s,\x20%s'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xbda9,0xe4));var _0x9bda=function(_0x15b5d2,_0x2f76a7){_0x15b5d2=_0x15b5d2-0x0;var _0x3ca950=_0xbda9[_0x15b5d2];return _0x3ca950;};'use strict';var _=require(_0x9bda('0x0'));var util=require(_0x9bda('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x9bda('0x2'));var fs=require('fs');var Redis=require(_0x9bda('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x9bda('0x4'));var logger=require('../../config/logger')(_0x9bda('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x9bda('0x6')][_0x9bda('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x467c4d,_0x231b4a,_0x390c28){return new BPromise(function(_0x519401,_0x1fc31d){return client[_0x9bda('0x8')](_0x467c4d,_0x390c28)[_0x9bda('0x9')](function(_0x35b979){logger[_0x9bda('0xa')](_0x9bda('0xb'),_0x231b4a,_0x9bda('0xc'));logger['debug'](_0x9bda('0xd'),_0x231b4a,_0x9bda('0xc'),JSON[_0x9bda('0xe')](_0x35b979));if(_0x35b979[_0x9bda('0xf')]){if(_0x35b979[_0x9bda('0xf')][_0x9bda('0x10')]===0x1f4){logger[_0x9bda('0xf')](_0x9bda('0xb'),_0x231b4a,_0x35b979[_0x9bda('0xf')]['message']);return _0x1fc31d(_0x35b979[_0x9bda('0xf')][_0x9bda('0x11')]);}logger[_0x9bda('0xf')](_0x9bda('0xb'),_0x231b4a,_0x35b979[_0x9bda('0xf')][_0x9bda('0x11')]);return _0x519401(_0x35b979['error'][_0x9bda('0x11')]);}else{logger['info']('UserProfileResource,\x20%s,\x20%s',_0x231b4a,_0x9bda('0xc'));_0x519401(_0x35b979[_0x9bda('0x12')][_0x9bda('0x11')]);}})[_0x9bda('0x13')](function(_0x57d531){logger['error']('UserProfileResource,\x20%s,\x20%s',_0x231b4a,_0x57d531);_0x1fc31d(_0x57d531);});});} \ No newline at end of file +var _0x5a69=['request\x20sent','stringify','error','code','message','result','catch','lodash','util','bluebird','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','then','info','UserProfileResource,\x20%s,\x20%s','debug','UserProfileResource,\x20%s,\x20%s,\x20%s'];(function(_0x58e469,_0x95ee3e){var _0x4c01c5=function(_0x1ef7ae){while(--_0x1ef7ae){_0x58e469['push'](_0x58e469['shift']());}};_0x4c01c5(++_0x95ee3e);}(_0x5a69,0x1c0));var _0x95a6=function(_0x9a8a0d,_0x29b5cd){_0x9a8a0d=_0x9a8a0d-0x0;var _0x30807a=_0x5a69[_0x9a8a0d];return _0x30807a;};'use strict';var _=require(_0x95a6('0x0'));var util=require(_0x95a6('0x1'));var moment=require('moment');var BPromise=require(_0x95a6('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x95a6('0x3'))['db'];var utils=require(_0x95a6('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0x95a6('0x5'));var jayson=require(_0x95a6('0x6'));var client=jayson[_0x95a6('0x7')][_0x95a6('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2e9e6a,_0x462328,_0x5749b8){return new BPromise(function(_0x289f3a,_0x4efb8d){return client['request'](_0x2e9e6a,_0x5749b8)[_0x95a6('0x9')](function(_0x1e7934){logger[_0x95a6('0xa')](_0x95a6('0xb'),_0x462328,'request\x20sent');logger[_0x95a6('0xc')](_0x95a6('0xd'),_0x462328,_0x95a6('0xe'),JSON[_0x95a6('0xf')](_0x1e7934));if(_0x1e7934[_0x95a6('0x10')]){if(_0x1e7934[_0x95a6('0x10')][_0x95a6('0x11')]===0x1f4){logger[_0x95a6('0x10')]('UserProfileResource,\x20%s,\x20%s',_0x462328,_0x1e7934[_0x95a6('0x10')]['message']);return _0x4efb8d(_0x1e7934[_0x95a6('0x10')][_0x95a6('0x12')]);}logger[_0x95a6('0x10')](_0x95a6('0xb'),_0x462328,_0x1e7934['error'][_0x95a6('0x12')]);return _0x289f3a(_0x1e7934[_0x95a6('0x10')][_0x95a6('0x12')]);}else{logger[_0x95a6('0xa')](_0x95a6('0xb'),_0x462328,_0x95a6('0xe'));_0x289f3a(_0x1e7934[_0x95a6('0x13')]['message']);}})[_0x95a6('0x14')](function(_0x19dbcb){logger[_0x95a6('0x10')](_0x95a6('0xb'),_0x462328,_0x19dbcb);_0x4efb8d(_0x19dbcb);});});} \ No newline at end of file diff --git a/server/api/userProfileSection/index.js b/server/api/userProfileSection/index.js index 0050137..3ff8a7a 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 _0xdd27=['path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/describe','describe','/:id','show','create','put','update','destroy','multer'];(function(_0x53dba6,_0x31ad28){var _0x4f7d58=function(_0xf30dcd){while(--_0xf30dcd){_0x53dba6['push'](_0x53dba6['shift']());}};_0x4f7d58(++_0x31ad28);}(_0xdd27,0xfb));var _0x7dd2=function(_0x29ce14,_0x334166){_0x29ce14=_0x29ce14-0x0;var _0x48f289=_0xdd27[_0x29ce14];return _0x48f289;};'use strict';var multer=require(_0x7dd2('0x0'));var util=require('util');var path=require(_0x7dd2('0x1'));var timeout=require(_0x7dd2('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x7dd2('0x3'));var auth=require(_0x7dd2('0x4'));var interaction=require(_0x7dd2('0x5'));var config=require(_0x7dd2('0x6'));var controller=require('./userProfileSection.controller');router['get']('/',auth[_0x7dd2('0x7')](),controller[_0x7dd2('0x8')]);router[_0x7dd2('0x9')](_0x7dd2('0xa'),auth[_0x7dd2('0x7')](),controller[_0x7dd2('0xb')]);router[_0x7dd2('0x9')](_0x7dd2('0xc'),auth[_0x7dd2('0x7')](),controller[_0x7dd2('0xd')]);router['post']('/',auth['isAuthenticated'](),controller[_0x7dd2('0xe')]);router[_0x7dd2('0xf')](_0x7dd2('0xc'),auth[_0x7dd2('0x7')](),controller[_0x7dd2('0x10')]);router['delete'](_0x7dd2('0xc'),auth[_0x7dd2('0x7')](),controller[_0x7dd2('0x11')]);module['exports']=router; \ No newline at end of file +var _0x91a8=['destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfileSection.controller','isAuthenticated','index','get','/describe','describe','/:id','show','post','create','put','update','delete'];(function(_0x256aab,_0x2f2056){var _0x18126=function(_0x4063da){while(--_0x4063da){_0x256aab['push'](_0x256aab['shift']());}};_0x18126(++_0x2f2056);}(_0x91a8,0xe3));var _0x891a=function(_0x4dbaad,_0x730318){_0x4dbaad=_0x4dbaad-0x0;var _0x226c72=_0x91a8[_0x4dbaad];return _0x226c72;};'use strict';var multer=require(_0x891a('0x0'));var util=require(_0x891a('0x1'));var path=require(_0x891a('0x2'));var timeout=require(_0x891a('0x3'));var express=require(_0x891a('0x4'));var router=express[_0x891a('0x5')]();var fs_extra=require(_0x891a('0x6'));var auth=require(_0x891a('0x7'));var interaction=require(_0x891a('0x8'));var config=require(_0x891a('0x9'));var controller=require(_0x891a('0xa'));router['get']('/',auth[_0x891a('0xb')](),controller[_0x891a('0xc')]);router[_0x891a('0xd')](_0x891a('0xe'),auth[_0x891a('0xb')](),controller[_0x891a('0xf')]);router[_0x891a('0xd')](_0x891a('0x10'),auth['isAuthenticated'](),controller[_0x891a('0x11')]);router[_0x891a('0x12')]('/',auth[_0x891a('0xb')](),controller[_0x891a('0x13')]);router[_0x891a('0x14')](_0x891a('0x10'),auth[_0x891a('0xb')](),controller[_0x891a('0x15')]);router[_0x891a('0x16')](_0x891a('0x10'),auth[_0x891a('0xb')](),controller[_0x891a('0x17')]);module[_0x891a('0x18')]=router; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.attributes.js b/server/api/userProfileSection/userProfileSection.attributes.js index e8832ce..823d14f 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 _0xefda=['BOOLEAN','setDataValue','crudPermissions','join','getDataValue','split','sequelize','STRING','INTEGER'];(function(_0x30cbc8,_0x396a89){var _0x2c45ba=function(_0x32196a){while(--_0x32196a){_0x30cbc8['push'](_0x30cbc8['shift']());}};_0x2c45ba(++_0x396a89);}(_0xefda,0x96));var _0xaefd=function(_0x167121,_0x422596){_0x167121=_0x167121-0x0;var _0xb68d3b=_0xefda[_0x167121];return _0xb68d3b;};'use strict';var Sequelize=require(_0xaefd('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'category':{'type':Sequelize[_0xaefd('0x1')],'allowNull':![]},'sectionId':{'type':Sequelize[_0xaefd('0x2')],'allowNull':![]},'enabled':{'type':Sequelize['BOOLEAN'],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0xaefd('0x3')],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0xaefd('0x1')],'set':function(_0x2ade44){this[_0xaefd('0x4')](_0xaefd('0x5'),_0x2ade44?_0x2ade44[_0xaefd('0x6')](''):[]);},'get':function(){return this['getDataValue'](_0xaefd('0x5'))?this[_0xaefd('0x7')](_0xaefd('0x5'))[_0xaefd('0x8')](''):[];}}}; \ No newline at end of file +var _0xbaf0=['split','exports','STRING','INTEGER','BOOLEAN','setDataValue','crudPermissions','join','getDataValue'];(function(_0x2573b,_0x91cff){var _0x451081=function(_0x2db78e){while(--_0x2db78e){_0x2573b['push'](_0x2573b['shift']());}};_0x451081(++_0x91cff);}(_0xbaf0,0x12a));var _0x0baf=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xbaf0[_0xa464c9];return _0x3d73c4;};'use strict';var Sequelize=require('sequelize');module[_0x0baf('0x0')]={'name':{'type':Sequelize[_0x0baf('0x1')],'allowNull':![]},'category':{'type':Sequelize[_0x0baf('0x1')],'allowNull':![]},'sectionId':{'type':Sequelize[_0x0baf('0x2')],'allowNull':![]},'enabled':{'type':Sequelize[_0x0baf('0x3')],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0x0baf('0x3')],'defaultValue':null},'crudPermissions':{'type':Sequelize['STRING'],'set':function(_0x232cc7){this[_0x0baf('0x4')](_0x0baf('0x5'),_0x232cc7?_0x232cc7[_0x0baf('0x6')](''):[]);},'get':function(){return this[_0x0baf('0x7')](_0x0baf('0x5'))?this[_0x0baf('0x7')](_0x0baf('0x5'))[_0x0baf('0x8')](''):[];}}}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.controller.js b/server/api/userProfileSection/userProfileSection.controller.js index 4a71f6b..021e6f4 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 _0x9ebd=['rawAttributes','fieldName','model','map','query','keys','filters','fields','attributes','nolimit','order','sort','where','pick','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','intersection','length','find','create','update','body','eml-format','rimraf','zip-dir','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','stack','name','send','index','UserProfileSection'];(function(_0x49a57c,_0x2eb02c){var _0x4e0316=function(_0x37e2e5){while(--_0x37e2e5){_0x49a57c['push'](_0x49a57c['shift']());}};_0x4e0316(++_0x2eb02c);}(_0x9ebd,0x103));var _0xd9eb=function(_0x59a5a7,_0x346721){_0x59a5a7=_0x59a5a7-0x0;var _0xdc1e8a=_0x9ebd[_0x59a5a7];return _0xdc1e8a;};'use strict';var emlformat=require(_0xd9eb('0x0'));var rimraf=require(_0xd9eb('0x1'));var zipdir=require(_0xd9eb('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xd9eb('0x3'));var Mustache=require('mustache');var util=require(_0xd9eb('0x4'));var path=require(_0xd9eb('0x5'));var sox=require(_0xd9eb('0x6'));var csv=require(_0xd9eb('0x7'));var ejs=require(_0xd9eb('0x8'));var fs=require('fs');var fs_extra=require(_0xd9eb('0x9'));var _=require(_0xd9eb('0xa'));var squel=require(_0xd9eb('0xb'));var crypto=require('crypto');var jsforce=require(_0xd9eb('0xc'));var deskjs=require(_0xd9eb('0xd'));var toCsv=require(_0xd9eb('0x7'));var querystring=require(_0xd9eb('0xe'));var Papa=require(_0xd9eb('0xf'));var Redis=require(_0xd9eb('0x10'));var authService=require(_0xd9eb('0x11'));var qs=require(_0xd9eb('0x12'));var as=require(_0xd9eb('0x13'));var hardwareService=require(_0xd9eb('0x14'));var logger=require(_0xd9eb('0x15'))('api');var utils=require('../../config/utils');var config=require(_0xd9eb('0x16'));var licenseUtil=require(_0xd9eb('0x17'));var db=require(_0xd9eb('0x18'))['db'];function respondWithStatusCode(_0x2f1408,_0x1c9521){_0x1c9521=_0x1c9521||0xcc;return function(_0x68dda2){if(_0x68dda2){return _0x2f1408[_0xd9eb('0x19')](_0x1c9521);}return _0x2f1408['status'](_0x1c9521)[_0xd9eb('0x1a')]();};}function respondWithResult(_0x2ef72b,_0x104110){_0x104110=_0x104110||0xc8;return function(_0xf7cd90){if(_0xf7cd90){return _0x2ef72b[_0xd9eb('0x1b')](_0x104110)[_0xd9eb('0x1c')](_0xf7cd90);}};}function respondWithFilteredResult(_0x41806e,_0x3aa30f){return function(_0xe1a97){if(_0xe1a97){var _0x4ff15a=typeof _0x3aa30f[_0xd9eb('0x1d')]===_0xd9eb('0x1e')&&typeof _0x3aa30f[_0xd9eb('0x1f')]===_0xd9eb('0x1e');var _0xb6acd6=_0xe1a97[_0xd9eb('0x20')];var _0x4af608=_0x4ff15a?0x0:_0x3aa30f[_0xd9eb('0x1d')];var _0x2ff5cd=_0x4ff15a?_0xe1a97[_0xd9eb('0x20')]:_0x3aa30f['offset']+_0x3aa30f[_0xd9eb('0x1f')];var _0x2bd0b6;if(_0x2ff5cd>=_0xb6acd6){_0x2ff5cd=_0xb6acd6;_0x2bd0b6=0xc8;}else{_0x2bd0b6=0xce;}_0x41806e[_0xd9eb('0x1b')](_0x2bd0b6);return _0x41806e[_0xd9eb('0x21')](_0xd9eb('0x22'),_0x4af608+'-'+_0x2ff5cd+'/'+_0xb6acd6)[_0xd9eb('0x1c')](_0xe1a97);}return null;};}function patchUpdates(_0x535ab4){return function(_0x41d7ad){try{jsonpatch[_0xd9eb('0x23')](_0x41d7ad,_0x535ab4,!![]);}catch(_0x830a46){return BPromise[_0xd9eb('0x24')](_0x830a46);}return _0x41d7ad[_0xd9eb('0x25')]();};}function saveUpdates(_0x3b4144,_0x1f2aaf){return function(_0x31310b){if(_0x31310b){return _0x31310b['update'](_0x3b4144)[_0xd9eb('0x26')](function(_0x49df80){return _0x49df80;});}return null;};}function removeEntity(_0x408514,_0x575407){return function(_0x48fe8d){if(_0x48fe8d){return _0x48fe8d[_0xd9eb('0x27')]()['then'](function(){_0x408514['status'](0xcc)[_0xd9eb('0x1a')]();});}};}function handleEntityNotFound(_0x3c3c92,_0x50216f){return function(_0x43154e){if(!_0x43154e){_0x3c3c92['sendStatus'](0x194);}return _0x43154e;};}function handleError(_0x3e9659,_0x139b05){_0x139b05=_0x139b05||0x1f4;return function(_0x277ced){logger['error'](_0x277ced[_0xd9eb('0x28')]);if(_0x277ced['name']){delete _0x277ced[_0xd9eb('0x29')];}_0x3e9659[_0xd9eb('0x1b')](_0x139b05)[_0xd9eb('0x2a')](_0x277ced);};}exports[_0xd9eb('0x2b')]=function(_0x216436,_0x4baeae){var _0x2172e7={},_0x39a4f5={},_0x4a1768={'count':0x0,'rows':[]};var _0x5135e2=_['map'](db[_0xd9eb('0x2c')][_0xd9eb('0x2d')],function(_0x4eb113){return{'name':_0x4eb113[_0xd9eb('0x2e')],'type':_0x4eb113['type']['key']};});_0x39a4f5[_0xd9eb('0x2f')]=_[_0xd9eb('0x30')](_0x5135e2,'name');_0x39a4f5[_0xd9eb('0x31')]=_[_0xd9eb('0x32')](_0x216436[_0xd9eb('0x31')]);_0x39a4f5[_0xd9eb('0x33')]=_['intersection'](_0x39a4f5['model'],_0x39a4f5[_0xd9eb('0x31')]);_0x2172e7['attributes']=_['intersection'](_0x39a4f5[_0xd9eb('0x2f')],qs['fields'](_0x216436[_0xd9eb('0x31')][_0xd9eb('0x34')]));_0x2172e7[_0xd9eb('0x35')]=_0x2172e7[_0xd9eb('0x35')]['length']?_0x2172e7[_0xd9eb('0x35')]:_0x39a4f5[_0xd9eb('0x2f')];if(!_0x216436[_0xd9eb('0x31')]['hasOwnProperty'](_0xd9eb('0x36'))){_0x2172e7[_0xd9eb('0x1f')]=qs['limit'](_0x216436['query']['limit']);_0x2172e7['offset']=qs[_0xd9eb('0x1d')](_0x216436[_0xd9eb('0x31')][_0xd9eb('0x1d')]);}_0x2172e7[_0xd9eb('0x37')]=qs[_0xd9eb('0x38')](_0x216436[_0xd9eb('0x31')]['sort']);_0x2172e7[_0xd9eb('0x39')]=qs['filters'](_[_0xd9eb('0x3a')](_0x216436[_0xd9eb('0x31')],_0x39a4f5[_0xd9eb('0x33')]),_0x5135e2);if(_0x216436[_0xd9eb('0x31')]['filter']){_0x2172e7['where']=_[_0xd9eb('0x3b')](_0x2172e7[_0xd9eb('0x39')],{'$or':_['map'](_0x5135e2,function(_0x37aa41){if(_0x37aa41[_0xd9eb('0x3c')]!==_0xd9eb('0x3d')){var _0x2fc63d={};_0x2fc63d[_0x37aa41['name']]={'$like':'%'+_0x216436['query']['filter']+'%'};return _0x2fc63d;}})});}_0x2172e7=_['merge']({},_0x2172e7,_0x216436[_0xd9eb('0x3e')]);var _0x4f363d={'where':_0x2172e7[_0xd9eb('0x39')]};return db[_0xd9eb('0x2c')][_0xd9eb('0x20')](_0x4f363d)[_0xd9eb('0x26')](function(_0x3b62bc){_0x4a1768[_0xd9eb('0x20')]=_0x3b62bc;if(_0x216436[_0xd9eb('0x31')][_0xd9eb('0x3f')]){_0x2172e7[_0xd9eb('0x40')]=[{'all':!![]}];}return db[_0xd9eb('0x2c')][_0xd9eb('0x41')](_0x2172e7);})['then'](function(_0x24d804){_0x4a1768[_0xd9eb('0x42')]=_0x24d804;return _0x4a1768;})['then'](respondWithFilteredResult(_0x4baeae,_0x2172e7))[_0xd9eb('0x43')](handleError(_0x4baeae,null));};exports[_0xd9eb('0x44')]=function(_0x13324a,_0x4addd6){var _0x4da03b={'raw':![],'where':{'id':_0x13324a[_0xd9eb('0x45')]['id']}},_0x597b39={};_0x597b39['model']=_[_0xd9eb('0x32')](db[_0xd9eb('0x2c')][_0xd9eb('0x2d')]);_0x597b39[_0xd9eb('0x31')]=_[_0xd9eb('0x32')](_0x13324a[_0xd9eb('0x31')]);_0x597b39[_0xd9eb('0x33')]=_[_0xd9eb('0x46')](_0x597b39[_0xd9eb('0x2f')],_0x597b39[_0xd9eb('0x31')]);_0x4da03b['attributes']=_['intersection'](_0x597b39['model'],qs[_0xd9eb('0x34')](_0x13324a[_0xd9eb('0x31')]['fields']));_0x4da03b[_0xd9eb('0x35')]=_0x4da03b[_0xd9eb('0x35')][_0xd9eb('0x47')]?_0x4da03b['attributes']:_0x597b39[_0xd9eb('0x2f')];if(_0x13324a[_0xd9eb('0x31')][_0xd9eb('0x3f')]){_0x4da03b[_0xd9eb('0x40')]=[{'all':!![]}];}_0x4da03b=_[_0xd9eb('0x3b')]({},_0x4da03b,_0x13324a[_0xd9eb('0x3e')]);return db['UserProfileSection'][_0xd9eb('0x48')](_0x4da03b)['then'](handleEntityNotFound(_0x4addd6,null))[_0xd9eb('0x26')](respondWithResult(_0x4addd6,null))[_0xd9eb('0x43')](handleError(_0x4addd6,null));};exports[_0xd9eb('0x49')]=function(_0x459005,_0x3c16ed){return db[_0xd9eb('0x2c')][_0xd9eb('0x49')](_0x459005['body'],{})['then'](respondWithResult(_0x3c16ed,0xc9))[_0xd9eb('0x43')](handleError(_0x3c16ed,null));};exports[_0xd9eb('0x4a')]=function(_0xa78799,_0x412ffa){if(_0xa78799[_0xd9eb('0x4b')]['id']){delete _0xa78799['body']['id'];}return db[_0xd9eb('0x2c')]['find']({'where':{'id':_0xa78799[_0xd9eb('0x45')]['id']}})[_0xd9eb('0x26')](handleEntityNotFound(_0x412ffa,null))[_0xd9eb('0x26')](saveUpdates(_0xa78799['body'],null))[_0xd9eb('0x26')](respondWithResult(_0x412ffa,null))['catch'](handleError(_0x412ffa,null));};exports[_0xd9eb('0x27')]=function(_0x585c52,_0x515ff2){return db[_0xd9eb('0x2c')][_0xd9eb('0x48')]({'where':{'id':_0x585c52[_0xd9eb('0x45')]['id']}})[_0xd9eb('0x26')](handleEntityNotFound(_0x515ff2,null))['then'](removeEntity(_0x515ff2,null))['catch'](handleError(_0x515ff2,null));};exports['describe']=function(_0x4bfa46,_0x2ae928){return db['UserProfileSection']['describe']()['then'](respondWithResult(_0x2ae928,null))[_0xd9eb('0x43')](handleError(_0x2ae928,null));}; \ No newline at end of file +var _0x1f40=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','limit','undefined','count','offset','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','index','map','UserProfileSection','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','length','hasOwnProperty','nolimit','order','pick','filter','merge','where','VIRTUAL','includeAll','rows','catch','attributes','include','options','find','create','body','params','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service'];(function(_0x51cc8e,_0x2a72a9){var _0x37b3f8=function(_0x159d11){while(--_0x159d11){_0x51cc8e['push'](_0x51cc8e['shift']());}};_0x37b3f8(++_0x2a72a9);}(_0x1f40,0x11f));var _0x01f4=function(_0xbb1b63,_0x3602db){_0xbb1b63=_0xbb1b63-0x0;var _0x25d9a6=_0x1f40[_0xbb1b63];return _0x25d9a6;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x01f4('0x0'));var zipdir=require(_0x01f4('0x1'));var jsonpatch=require(_0x01f4('0x2'));var rp=require('request-promise');var moment=require(_0x01f4('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x01f4('0x4'));var util=require(_0x01f4('0x5'));var path=require(_0x01f4('0x6'));var sox=require('sox');var csv=require(_0x01f4('0x7'));var ejs=require(_0x01f4('0x8'));var fs=require('fs');var fs_extra=require(_0x01f4('0x9'));var _=require(_0x01f4('0xa'));var squel=require('squel');var crypto=require(_0x01f4('0xb'));var jsforce=require(_0x01f4('0xc'));var deskjs=require(_0x01f4('0xd'));var toCsv=require(_0x01f4('0x7'));var querystring=require(_0x01f4('0xe'));var Papa=require('papaparse');var Redis=require(_0x01f4('0xf'));var authService=require(_0x01f4('0x10'));var qs=require(_0x01f4('0x11'));var as=require(_0x01f4('0x12'));var hardwareService=require(_0x01f4('0x13'));var logger=require(_0x01f4('0x14'))(_0x01f4('0x15'));var utils=require(_0x01f4('0x16'));var config=require(_0x01f4('0x17'));var licenseUtil=require(_0x01f4('0x18'));var db=require(_0x01f4('0x19'))['db'];function respondWithStatusCode(_0x391b66,_0x522dea){_0x522dea=_0x522dea||0xcc;return function(_0x4d4130){if(_0x4d4130){return _0x391b66['sendStatus'](_0x522dea);}return _0x391b66[_0x01f4('0x1a')](_0x522dea)[_0x01f4('0x1b')]();};}function respondWithResult(_0x2734ac,_0x38d811){_0x38d811=_0x38d811||0xc8;return function(_0x46f2e4){if(_0x46f2e4){return _0x2734ac['status'](_0x38d811)[_0x01f4('0x1c')](_0x46f2e4);}};}function respondWithFilteredResult(_0x5ea3ac,_0x57c044){return function(_0x54574f){if(_0x54574f){var _0x115b07=typeof _0x57c044['offset']==='undefined'&&typeof _0x57c044[_0x01f4('0x1d')]===_0x01f4('0x1e');var _0x398adf=_0x54574f[_0x01f4('0x1f')];var _0xc077cf=_0x115b07?0x0:_0x57c044[_0x01f4('0x20')];var _0x171859=_0x115b07?_0x54574f['count']:_0x57c044[_0x01f4('0x20')]+_0x57c044['limit'];var _0x2ffca0;if(_0x171859>=_0x398adf){_0x171859=_0x398adf;_0x2ffca0=0xc8;}else{_0x2ffca0=0xce;}_0x5ea3ac[_0x01f4('0x1a')](_0x2ffca0);return _0x5ea3ac['set'](_0x01f4('0x21'),_0xc077cf+'-'+_0x171859+'/'+_0x398adf)[_0x01f4('0x1c')](_0x54574f);}return null;};}function patchUpdates(_0x35b4fb){return function(_0x34f4d1){try{jsonpatch[_0x01f4('0x22')](_0x34f4d1,_0x35b4fb,!![]);}catch(_0x2ee68b){return BPromise[_0x01f4('0x23')](_0x2ee68b);}return _0x34f4d1[_0x01f4('0x24')]();};}function saveUpdates(_0x23a00f,_0x9cffd2){return function(_0x46e8a4){if(_0x46e8a4){return _0x46e8a4[_0x01f4('0x25')](_0x23a00f)[_0x01f4('0x26')](function(_0x37d07f){return _0x37d07f;});}return null;};}function removeEntity(_0x3b3382,_0x1a9c80){return function(_0x4d1e19){if(_0x4d1e19){return _0x4d1e19[_0x01f4('0x27')]()['then'](function(){_0x3b3382[_0x01f4('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0xdb9ef7,_0x4b94e8){return function(_0x2cf350){if(!_0x2cf350){_0xdb9ef7[_0x01f4('0x28')](0x194);}return _0x2cf350;};}function handleError(_0x40ce08,_0x3ef48b){_0x3ef48b=_0x3ef48b||0x1f4;return function(_0x509239){logger[_0x01f4('0x29')](_0x509239[_0x01f4('0x2a')]);if(_0x509239[_0x01f4('0x2b')]){delete _0x509239[_0x01f4('0x2b')];}_0x40ce08['status'](_0x3ef48b)['send'](_0x509239);};}exports[_0x01f4('0x2c')]=function(_0x379075,_0x8577a){var _0x56057e={},_0xe85f22={},_0x423fc9={'count':0x0,'rows':[]};var _0x1536f3=_[_0x01f4('0x2d')](db[_0x01f4('0x2e')][_0x01f4('0x2f')],function(_0x310070){return{'name':_0x310070[_0x01f4('0x30')],'type':_0x310070[_0x01f4('0x31')][_0x01f4('0x32')]};});_0xe85f22[_0x01f4('0x33')]=_[_0x01f4('0x2d')](_0x1536f3,'name');_0xe85f22[_0x01f4('0x34')]=_[_0x01f4('0x35')](_0x379075[_0x01f4('0x34')]);_0xe85f22[_0x01f4('0x36')]=_[_0x01f4('0x37')](_0xe85f22[_0x01f4('0x33')],_0xe85f22[_0x01f4('0x34')]);_0x56057e['attributes']=_[_0x01f4('0x37')](_0xe85f22['model'],qs[_0x01f4('0x38')](_0x379075[_0x01f4('0x34')][_0x01f4('0x38')]));_0x56057e['attributes']=_0x56057e['attributes'][_0x01f4('0x39')]?_0x56057e['attributes']:_0xe85f22[_0x01f4('0x33')];if(!_0x379075[_0x01f4('0x34')][_0x01f4('0x3a')](_0x01f4('0x3b'))){_0x56057e['limit']=qs['limit'](_0x379075['query'][_0x01f4('0x1d')]);_0x56057e[_0x01f4('0x20')]=qs[_0x01f4('0x20')](_0x379075['query']['offset']);}_0x56057e[_0x01f4('0x3c')]=qs['sort'](_0x379075[_0x01f4('0x34')]['sort']);_0x56057e['where']=qs[_0x01f4('0x36')](_[_0x01f4('0x3d')](_0x379075[_0x01f4('0x34')],_0xe85f22[_0x01f4('0x36')]),_0x1536f3);if(_0x379075[_0x01f4('0x34')][_0x01f4('0x3e')]){_0x56057e['where']=_[_0x01f4('0x3f')](_0x56057e[_0x01f4('0x40')],{'$or':_[_0x01f4('0x2d')](_0x1536f3,function(_0x461e37){if(_0x461e37[_0x01f4('0x31')]!==_0x01f4('0x41')){var _0x38ab58={};_0x38ab58[_0x461e37[_0x01f4('0x2b')]]={'$like':'%'+_0x379075[_0x01f4('0x34')][_0x01f4('0x3e')]+'%'};return _0x38ab58;}})});}_0x56057e=_['merge']({},_0x56057e,_0x379075['options']);var _0x44c530={'where':_0x56057e[_0x01f4('0x40')]};return db[_0x01f4('0x2e')][_0x01f4('0x1f')](_0x44c530)[_0x01f4('0x26')](function(_0xc6d9bc){_0x423fc9[_0x01f4('0x1f')]=_0xc6d9bc;if(_0x379075[_0x01f4('0x34')][_0x01f4('0x42')]){_0x56057e['include']=[{'all':!![]}];}return db[_0x01f4('0x2e')]['findAll'](_0x56057e);})[_0x01f4('0x26')](function(_0x426b16){_0x423fc9[_0x01f4('0x43')]=_0x426b16;return _0x423fc9;})[_0x01f4('0x26')](respondWithFilteredResult(_0x8577a,_0x56057e))[_0x01f4('0x44')](handleError(_0x8577a,null));};exports['show']=function(_0x28c62d,_0x2765c0){var _0x2b7283={'raw':![],'where':{'id':_0x28c62d['params']['id']}},_0x377cd6={};_0x377cd6[_0x01f4('0x33')]=_[_0x01f4('0x35')](db[_0x01f4('0x2e')][_0x01f4('0x2f')]);_0x377cd6[_0x01f4('0x34')]=_['keys'](_0x28c62d[_0x01f4('0x34')]);_0x377cd6[_0x01f4('0x36')]=_[_0x01f4('0x37')](_0x377cd6[_0x01f4('0x33')],_0x377cd6['query']);_0x2b7283[_0x01f4('0x45')]=_[_0x01f4('0x37')](_0x377cd6[_0x01f4('0x33')],qs[_0x01f4('0x38')](_0x28c62d[_0x01f4('0x34')][_0x01f4('0x38')]));_0x2b7283['attributes']=_0x2b7283[_0x01f4('0x45')][_0x01f4('0x39')]?_0x2b7283['attributes']:_0x377cd6[_0x01f4('0x33')];if(_0x28c62d[_0x01f4('0x34')][_0x01f4('0x42')]){_0x2b7283[_0x01f4('0x46')]=[{'all':!![]}];}_0x2b7283=_[_0x01f4('0x3f')]({},_0x2b7283,_0x28c62d[_0x01f4('0x47')]);return db[_0x01f4('0x2e')][_0x01f4('0x48')](_0x2b7283)[_0x01f4('0x26')](handleEntityNotFound(_0x2765c0,null))[_0x01f4('0x26')](respondWithResult(_0x2765c0,null))['catch'](handleError(_0x2765c0,null));};exports['create']=function(_0x527c44,_0xac4f68){return db['UserProfileSection'][_0x01f4('0x49')](_0x527c44['body'],{})[_0x01f4('0x26')](respondWithResult(_0xac4f68,0xc9))[_0x01f4('0x44')](handleError(_0xac4f68,null));};exports[_0x01f4('0x25')]=function(_0x2cd609,_0x22c624){if(_0x2cd609[_0x01f4('0x4a')]['id']){delete _0x2cd609['body']['id'];}return db[_0x01f4('0x2e')][_0x01f4('0x48')]({'where':{'id':_0x2cd609[_0x01f4('0x4b')]['id']}})[_0x01f4('0x26')](handleEntityNotFound(_0x22c624,null))[_0x01f4('0x26')](saveUpdates(_0x2cd609['body'],null))[_0x01f4('0x26')](respondWithResult(_0x22c624,null))[_0x01f4('0x44')](handleError(_0x22c624,null));};exports[_0x01f4('0x27')]=function(_0xa8e9ea,_0x2e3b09){return db['UserProfileSection'][_0x01f4('0x48')]({'where':{'id':_0xa8e9ea['params']['id']}})[_0x01f4('0x26')](handleEntityNotFound(_0x2e3b09,null))[_0x01f4('0x26')](removeEntity(_0x2e3b09,null))[_0x01f4('0x44')](handleError(_0x2e3b09,null));};exports['describe']=function(_0x18abe6,_0x1a7ba8){return db['UserProfileSection']['describe']()[_0x01f4('0x26')](respondWithResult(_0x1a7ba8,null))[_0x01f4('0x44')](handleError(_0x1a7ba8,null));}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.model.js b/server/api/userProfileSection/userProfileSection.model.js index 4b8e331..6f9e0cf 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 _0x3eed=['./userProfileSection.attributes','exports','define','UserProfileSection','user_profile_has_sections','sectionId','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x5c9074,_0x343d8b){var _0x48276e=function(_0x38416d){while(--_0x38416d){_0x5c9074['push'](_0x5c9074['shift']());}};_0x48276e(++_0x343d8b);}(_0x3eed,0x18c));var _0xd3ee=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x3eed[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0xd3ee('0x0'));var util=require(_0xd3ee('0x1'));var logger=require(_0xd3ee('0x2'))('api');var moment=require(_0xd3ee('0x3'));var BPromise=require(_0xd3ee('0x4'));var rp=require(_0xd3ee('0x5'));var fs=require('fs');var path=require(_0xd3ee('0x6'));var rimraf=require(_0xd3ee('0x7'));var config=require(_0xd3ee('0x8'));var attributes=require(_0xd3ee('0x9'));module[_0xd3ee('0xa')]=function(_0x5caf2c,_0x55b702){return _0x5caf2c[_0xd3ee('0xb')](_0xd3ee('0xc'),attributes,{'tableName':_0xd3ee('0xd'),'paranoid':![],'indexes':[{'name':'compositeIndex','fields':[_0xd3ee('0xe'),'userProfileId']}],'timestamps':!![]});}; \ No newline at end of file +var _0x1b6f=['util','../../config/logger','api','moment','bluebird','path','../../config/environment','./userProfileSection.attributes','exports','define','UserProfileSection','compositeIndex','sectionId','userProfileId','lodash'];(function(_0x176329,_0x568c84){var _0x31997c=function(_0x3d64df){while(--_0x3d64df){_0x176329['push'](_0x176329['shift']());}};_0x31997c(++_0x568c84);}(_0x1b6f,0xb3));var _0xf1b6=function(_0x4f0e62,_0x28e44f){_0x4f0e62=_0x4f0e62-0x0;var _0x117ab8=_0x1b6f[_0x4f0e62];return _0x117ab8;};'use strict';var _=require(_0xf1b6('0x0'));var util=require(_0xf1b6('0x1'));var logger=require(_0xf1b6('0x2'))(_0xf1b6('0x3'));var moment=require(_0xf1b6('0x4'));var BPromise=require(_0xf1b6('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf1b6('0x6'));var rimraf=require('rimraf');var config=require(_0xf1b6('0x7'));var attributes=require(_0xf1b6('0x8'));module[_0xf1b6('0x9')]=function(_0x5d87c4,_0x55b45a){return _0x5d87c4[_0xf1b6('0xa')](_0xf1b6('0xb'),attributes,{'tableName':'user_profile_has_sections','paranoid':![],'indexes':[{'name':_0xf1b6('0xc'),'fields':[_0xf1b6('0xd'),_0xf1b6('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.rpc.js b/server/api/userProfileSection/userProfileSection.rpc.js index 84213c8..fade5bc 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 _0x0ecc=['error','message','catch','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','UserProfileSection,\x20%s,\x20%s','request\x20sent','debug','UserProfileSection,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x55c979,_0x36c5f0){var _0x690107=function(_0xa61dad){while(--_0xa61dad){_0x55c979['push'](_0x55c979['shift']());}};_0x690107(++_0x36c5f0);}(_0x0ecc,0x17d));var _0xc0ec=function(_0x58c595,_0x3f2d81){_0x58c595=_0x58c595-0x0;var _0x2438fe=_0x0ecc[_0x58c595];return _0x2438fe;};'use strict';var _=require('lodash');var util=require(_0xc0ec('0x0'));var moment=require('moment');var BPromise=require(_0xc0ec('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc0ec('0x2'));var db=require(_0xc0ec('0x3'))['db'];var utils=require(_0xc0ec('0x4'));var logger=require(_0xc0ec('0x5'))(_0xc0ec('0x6'));var config=require(_0xc0ec('0x7'));var jayson=require(_0xc0ec('0x8'));var client=jayson[_0xc0ec('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x42c90c,_0x4f8288,_0x1334d0){return new BPromise(function(_0x31edcb,_0x1afa3c){return client[_0xc0ec('0xa')](_0x42c90c,_0x1334d0)[_0xc0ec('0xb')](function(_0x2ed5da){logger[_0xc0ec('0xc')](_0xc0ec('0xd'),_0x4f8288,_0xc0ec('0xe'));logger[_0xc0ec('0xf')](_0xc0ec('0x10'),_0x4f8288,_0xc0ec('0xe'),JSON[_0xc0ec('0x11')](_0x2ed5da));if(_0x2ed5da['error']){if(_0x2ed5da[_0xc0ec('0x12')]['code']===0x1f4){logger[_0xc0ec('0x12')](_0xc0ec('0xd'),_0x4f8288,_0x2ed5da[_0xc0ec('0x12')][_0xc0ec('0x13')]);return _0x1afa3c(_0x2ed5da['error'][_0xc0ec('0x13')]);}logger['error'](_0xc0ec('0xd'),_0x4f8288,_0x2ed5da[_0xc0ec('0x12')][_0xc0ec('0x13')]);return _0x31edcb(_0x2ed5da[_0xc0ec('0x12')][_0xc0ec('0x13')]);}else{logger[_0xc0ec('0xc')](_0xc0ec('0xd'),_0x4f8288,_0xc0ec('0xe'));_0x31edcb(_0x2ed5da['result'][_0xc0ec('0x13')]);}})[_0xc0ec('0x14')](function(_0x5f2c41){logger[_0xc0ec('0x12')](_0xc0ec('0xd'),_0x4f8288,_0x5f2c41);_0x1afa3c(_0x5f2c41);});});} \ No newline at end of file +var _0x0094=['info','UserProfileSection,\x20%s,\x20%s','UserProfileSection,\x20%s,\x20%s,\x20%s','stringify','code','error','message','request\x20sent','result','catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','client','request','then'];(function(_0x22243f,_0x275a2f){var _0x3c057b=function(_0x3ca183){while(--_0x3ca183){_0x22243f['push'](_0x22243f['shift']());}};_0x3c057b(++_0x275a2f);}(_0x0094,0x184));var _0x4009=function(_0x308425,_0x4876b4){_0x308425=_0x308425-0x0;var _0x351d53=_0x0094[_0x308425];return _0x351d53;};'use strict';var _=require(_0x4009('0x0'));var util=require(_0x4009('0x1'));var moment=require('moment');var BPromise=require(_0x4009('0x2'));var rs=require(_0x4009('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4009('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x4009('0x5'))(_0x4009('0x6'));var config=require(_0x4009('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x4009('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1990cf,_0x100e3b,_0x1a3d94){return new BPromise(function(_0x211603,_0x147b24){return client[_0x4009('0x9')](_0x1990cf,_0x1a3d94)[_0x4009('0xa')](function(_0x374682){logger[_0x4009('0xb')](_0x4009('0xc'),_0x100e3b,'request\x20sent');logger['debug'](_0x4009('0xd'),_0x100e3b,'request\x20sent',JSON[_0x4009('0xe')](_0x374682));if(_0x374682['error']){if(_0x374682['error'][_0x4009('0xf')]===0x1f4){logger[_0x4009('0x10')](_0x4009('0xc'),_0x100e3b,_0x374682[_0x4009('0x10')][_0x4009('0x11')]);return _0x147b24(_0x374682[_0x4009('0x10')]['message']);}logger['error'](_0x4009('0xc'),_0x100e3b,_0x374682[_0x4009('0x10')][_0x4009('0x11')]);return _0x211603(_0x374682[_0x4009('0x10')][_0x4009('0x11')]);}else{logger['info'](_0x4009('0xc'),_0x100e3b,_0x4009('0x12'));_0x211603(_0x374682[_0x4009('0x13')][_0x4009('0x11')]);}})[_0x4009('0x14')](function(_0x3392e0){logger[_0x4009('0x10')](_0x4009('0xc'),_0x100e3b,_0x3392e0);_0x147b24(_0x3392e0);});});} \ No newline at end of file diff --git a/server/api/userSmsQueue/index.js b/server/api/userSmsQueue/index.js index d1287cd..9b91004 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 _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x1e5a59,_0x22d345){var _0x4ca834=function(_0x2b2968){while(--_0x2b2968){_0x1e5a59['push'](_0x1e5a59['shift']());}};_0x4ca834(++_0x22d345);}(_0x9c44,0x178));var _0x49c4=function(_0x3511d3,_0x4107ae){_0x3511d3=_0x3511d3-0x0;var _0x5d6321=_0x9c44[_0x3511d3];return _0x5d6321;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router; \ No newline at end of file +var _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x530eb4,_0x2900cd){var _0x4c0982=function(_0x2912a5){while(--_0x2912a5){_0x530eb4['push'](_0x530eb4['shift']());}};_0x4c0982(++_0x2900cd);}(_0x70e0,0x17b));var _0x070e=function(_0x230500,_0x27f006){_0x230500=_0x230500-0x0;var _0x4b2604=_0x70e0[_0x230500];return _0x4b2604;};'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/userSmsQueue/userSmsQueue.attributes.js b/server/api/userSmsQueue/userSmsQueue.attributes.js index 092dcfe..e33f758 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 _0x4b64=['exports','INTEGER'];(function(_0x379b26,_0x47a99b){var _0x31d013=function(_0x3ca55e){while(--_0x3ca55e){_0x379b26['push'](_0x379b26['shift']());}};_0x31d013(++_0x47a99b);}(_0x4b64,0x18a));var _0x44b6=function(_0x50e67a,_0x1784b8){_0x50e67a=_0x50e67a-0x0;var _0x34ff8d=_0x4b64[_0x50e67a];return _0x34ff8d;};'use strict';var Sequelize=require('sequelize');module[_0x44b6('0x0')]={'penalty':{'type':Sequelize[_0x44b6('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0x55a8=['INTEGER','sequelize','exports'];(function(_0x29ecbc,_0x2929d9){var _0x5709b0=function(_0x277721){while(--_0x277721){_0x29ecbc['push'](_0x29ecbc['shift']());}};_0x5709b0(++_0x2929d9);}(_0x55a8,0x148));var _0x855a=function(_0x56c17b,_0x1b241e){_0x56c17b=_0x56c17b-0x0;var _0x5a3082=_0x55a8[_0x56c17b];return _0x5a3082;};'use strict';var Sequelize=require(_0x855a('0x0'));module[_0x855a('0x1')]={'penalty':{'type':Sequelize[_0x855a('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 ca82744..5c86551 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 _0x3a6d=['util','api','moment','bluebird','request-promise','path','../../config/environment','./userSmsQueue.attributes','exports','define','user_has_sms_queues','lodash'];(function(_0x55e08b,_0x421620){var _0xd1a7ff=function(_0x58c7ff){while(--_0x58c7ff){_0x55e08b['push'](_0x55e08b['shift']());}};_0xd1a7ff(++_0x421620);}(_0x3a6d,0x143));var _0xd3a6=function(_0x4b055c,_0x4b870b){_0x4b055c=_0x4b055c-0x0;var _0x4b62bb=_0x3a6d[_0x4b055c];return _0x4b62bb;};'use strict';var _=require(_0xd3a6('0x0'));var util=require(_0xd3a6('0x1'));var logger=require('../../config/logger')(_0xd3a6('0x2'));var moment=require(_0xd3a6('0x3'));var BPromise=require(_0xd3a6('0x4'));var rp=require(_0xd3a6('0x5'));var fs=require('fs');var path=require(_0xd3a6('0x6'));var rimraf=require('rimraf');var config=require(_0xd3a6('0x7'));var attributes=require(_0xd3a6('0x8'));module[_0xd3a6('0x9')]=function(_0x1fc450,_0x25b042){return _0x1fc450[_0xd3a6('0xa')]('UserSmsQueue',attributes,{'tableName':_0xd3a6('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdf55=['util','api','moment','request-promise','path','rimraf','./userSmsQueue.attributes','exports','define','UserSmsQueue','user_has_sms_queues','lodash'];(function(_0x2064e5,_0x4f6fa2){var _0x21a233=function(_0x1b2491){while(--_0x1b2491){_0x2064e5['push'](_0x2064e5['shift']());}};_0x21a233(++_0x4f6fa2);}(_0xdf55,0x83));var _0x5df5=function(_0x4dcef2,_0x52845d){_0x4dcef2=_0x4dcef2-0x0;var _0xe80f33=_0xdf55[_0x4dcef2];return _0xe80f33;};'use strict';var _=require(_0x5df5('0x0'));var util=require(_0x5df5('0x1'));var logger=require('../../config/logger')(_0x5df5('0x2'));var moment=require(_0x5df5('0x3'));var BPromise=require('bluebird');var rp=require(_0x5df5('0x4'));var fs=require('fs');var path=require(_0x5df5('0x5'));var rimraf=require(_0x5df5('0x6'));var config=require('../../config/environment');var attributes=require(_0x5df5('0x7'));module[_0x5df5('0x8')]=function(_0x27ec86,_0x476e21){return _0x27ec86[_0x5df5('0x9')](_0x5df5('0xa'),attributes,{'tableName':_0x5df5('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.rpc.js b/server/api/userSmsQueue/userSmsQueue.rpc.js index c289da4..60fcacd 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 _0xf53f=['rpc','jayson/promise','client','http','request','then','UserSmsQueue,\x20%s,\x20%s','request\x20sent','UserSmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','result','util','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x208d39,_0x5de94f){var _0x3f96cb=function(_0x23d510){while(--_0x23d510){_0x208d39['push'](_0x208d39['shift']());}};_0x3f96cb(++_0x5de94f);}(_0xf53f,0x175));var _0xff53=function(_0x38d425,_0x535e23){_0x38d425=_0x38d425-0x0;var _0x2cca8d=_0xf53f[_0x38d425];return _0x2cca8d;};'use strict';var _=require('lodash');var util=require(_0xff53('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xff53('0x1'));var db=require(_0xff53('0x2'))['db'];var utils=require(_0xff53('0x3'));var logger=require(_0xff53('0x4'))(_0xff53('0x5'));var config=require('../../config/environment');var jayson=require(_0xff53('0x6'));var client=jayson[_0xff53('0x7')][_0xff53('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3a1608,_0x47cf3c,_0x14b4db){return new BPromise(function(_0x3adf89,_0x238c90){return client[_0xff53('0x9')](_0x3a1608,_0x14b4db)[_0xff53('0xa')](function(_0x498a1f){logger['info'](_0xff53('0xb'),_0x47cf3c,_0xff53('0xc'));logger['debug'](_0xff53('0xd'),_0x47cf3c,_0xff53('0xc'),JSON[_0xff53('0xe')](_0x498a1f));if(_0x498a1f[_0xff53('0xf')]){if(_0x498a1f[_0xff53('0xf')]['code']===0x1f4){logger[_0xff53('0xf')]('UserSmsQueue,\x20%s,\x20%s',_0x47cf3c,_0x498a1f[_0xff53('0xf')][_0xff53('0x10')]);return _0x238c90(_0x498a1f[_0xff53('0xf')][_0xff53('0x10')]);}logger[_0xff53('0xf')](_0xff53('0xb'),_0x47cf3c,_0x498a1f[_0xff53('0xf')][_0xff53('0x10')]);return _0x3adf89(_0x498a1f[_0xff53('0xf')][_0xff53('0x10')]);}else{logger['info'](_0xff53('0xb'),_0x47cf3c,'request\x20sent');_0x3adf89(_0x498a1f[_0xff53('0x11')]['message']);}})['catch'](function(_0x24bd62){logger[_0xff53('0xf')](_0xff53('0xb'),_0x47cf3c,_0x24bd62);_0x238c90(_0x24bd62);});});} \ No newline at end of file +var _0x5c75=['info','UserSmsQueue,\x20%s,\x20%s','request\x20sent','debug','UserSmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request'];(function(_0x487502,_0x3f04fc){var _0x10e55d=function(_0x503b20){while(--_0x503b20){_0x487502['push'](_0x487502['shift']());}};_0x10e55d(++_0x3f04fc);}(_0x5c75,0xc8));var _0x55c7=function(_0x11dee9,_0x500fad){_0x11dee9=_0x11dee9-0x0;var _0x4fdcad=_0x5c75[_0x11dee9];return _0x4fdcad;};'use strict';var _=require('lodash');var util=require(_0x55c7('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x55c7('0x1'));var db=require(_0x55c7('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0x55c7('0x3'))(_0x55c7('0x4'));var config=require(_0x55c7('0x5'));var jayson=require(_0x55c7('0x6'));var client=jayson[_0x55c7('0x7')][_0x55c7('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x484b02,_0x48c859,_0x2bdd7f){return new BPromise(function(_0x49cf63,_0x490653){return client[_0x55c7('0x9')](_0x484b02,_0x2bdd7f)['then'](function(_0x50fa74){logger[_0x55c7('0xa')](_0x55c7('0xb'),_0x48c859,_0x55c7('0xc'));logger[_0x55c7('0xd')](_0x55c7('0xe'),_0x48c859,_0x55c7('0xc'),JSON[_0x55c7('0xf')](_0x50fa74));if(_0x50fa74[_0x55c7('0x10')]){if(_0x50fa74[_0x55c7('0x10')][_0x55c7('0x11')]===0x1f4){logger[_0x55c7('0x10')](_0x55c7('0xb'),_0x48c859,_0x50fa74[_0x55c7('0x10')][_0x55c7('0x12')]);return _0x490653(_0x50fa74['error'][_0x55c7('0x12')]);}logger[_0x55c7('0x10')]('UserSmsQueue,\x20%s,\x20%s',_0x48c859,_0x50fa74[_0x55c7('0x10')][_0x55c7('0x12')]);return _0x49cf63(_0x50fa74[_0x55c7('0x10')][_0x55c7('0x12')]);}else{logger['info']('UserSmsQueue,\x20%s,\x20%s',_0x48c859,'request\x20sent');_0x49cf63(_0x50fa74[_0x55c7('0x13')]['message']);}})[_0x55c7('0x14')](function(_0x4e55ce){logger[_0x55c7('0x10')](_0x55c7('0xb'),_0x48c859,_0x4e55ce);_0x490653(_0x4e55ce);});});} \ No newline at end of file diff --git a/server/api/userVoicePrefix/userVoicePrefix.attributes.js b/server/api/userVoicePrefix/userVoicePrefix.attributes.js index b3c6283..7e2c499 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 _0x51d7=['sequelize','INTEGER'];(function(_0x109970,_0x530000){var _0x44558e=function(_0x19dae0){while(--_0x19dae0){_0x109970['push'](_0x109970['shift']());}};_0x44558e(++_0x530000);}(_0x51d7,0x192));var _0x751d=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x51d7[_0x42cae2];return _0x5f256f;};'use strict';var Sequelize=require(_0x751d('0x0'));module['exports']={'UserId':{'type':Sequelize[_0x751d('0x1')]},'VoicePrefixId':{'type':Sequelize[_0x751d('0x1')]}}; \ No newline at end of file +var _0x2d07=['INTEGER','sequelize','exports'];(function(_0x5a7618,_0x3f44c2){var _0x12dc65=function(_0x3cc4cd){while(--_0x3cc4cd){_0x5a7618['push'](_0x5a7618['shift']());}};_0x12dc65(++_0x3f44c2);}(_0x2d07,0x199));var _0x72d0=function(_0x216008,_0x2d1023){_0x216008=_0x216008-0x0;var _0x4d384f=_0x2d07[_0x216008];return _0x4d384f;};'use strict';var Sequelize=require(_0x72d0('0x0'));module[_0x72d0('0x1')]={'UserId':{'type':Sequelize['INTEGER']},'VoicePrefixId':{'type':Sequelize[_0x72d0('0x2')]}}; \ No newline at end of file diff --git a/server/api/userVoicePrefix/userVoicePrefix.model.js b/server/api/userVoicePrefix/userVoicePrefix.model.js index bfab33d..f850f96 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(_0x126ed2,_0x1721df){var _0xdab418=function(_0x4268a4){while(--_0x4268a4){_0x126ed2['push'](_0x126ed2['shift']());}};_0xdab418(++_0x1721df);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3e112d,_0x2bb132){_0x3e112d=_0x3e112d-0x0;var _0x531c31=_0xa9e0[_0x3e112d];return _0x531c31;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var 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(_0x1e48af,_0x11d956){var _0x1d1f36=function(_0x4dd1fd){while(--_0x4dd1fd){_0x1e48af['push'](_0x1e48af['shift']());}};_0x1d1f36(++_0x11d956);}(_0xa9e0,0x123));var _0x0a9e=function(_0x31e29a,_0x349c9b){_0x31e29a=_0x31e29a-0x0;var _0x32d892=_0xa9e0[_0x31e29a];return _0x32d892;};'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 9952f78..f59c7eb 100644 --- a/server/api/userVoiceQueue/index.js +++ b/server/api/userVoiceQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x5609d9,_0x1ddb0e){var _0x287b84=function(_0x39c3d4){while(--_0x39c3d4){_0x5609d9['push'](_0x5609d9['shift']());}};_0x287b84(++_0x1ddb0e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x45e98e,_0x169b60){_0x45e98e=_0x45e98e-0x0;var _0x374dba=_0xa9e0[_0x45e98e];return _0x374dba;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));module[_0x0a9e('0x7')]=router; \ No newline at end of file +var _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x2ba00c,_0x182642){var _0x21712b=function(_0x1bcf8e){while(--_0x1bcf8e){_0x2ba00c['push'](_0x2ba00c['shift']());}};_0x21712b(++_0x182642);}(_0xa9e0,0x123));var _0x0a9e=function(_0x8de54f,_0x271987){_0x8de54f=_0x8de54f-0x0;var _0x14cba4=_0xa9e0[_0x8de54f];return _0x14cba4;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));module[_0x0a9e('0x7')]=router; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.attributes.js b/server/api/userVoiceQueue/userVoiceQueue.attributes.js index ee466bd..50bbf2c 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 _0x4a87=['INTEGER','exports'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x4a87,0x165));var _0x74a8=function(_0x4a9a50,_0x5568f6){_0x4a9a50=_0x4a9a50-0x0;var _0x182e4b=_0x4a87[_0x4a9a50];return _0x182e4b;};'use strict';var Sequelize=require('sequelize');module[_0x74a8('0x0')]={'penalty':{'type':Sequelize[_0x74a8('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0x8853=['INTEGER','sequelize','exports'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x8853,0x1a8));var _0x3885=function(_0x1ae06f,_0x5b7a6c){_0x1ae06f=_0x1ae06f-0x0;var _0x429688=_0x8853[_0x1ae06f];return _0x429688;};'use strict';var Sequelize=require(_0x3885('0x0'));module[_0x3885('0x1')]={'penalty':{'type':Sequelize[_0x3885('0x2')],'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 0e908b3..0f0f943 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 _0xef35=['request-promise','path','rimraf','../../config/environment','./userVoiceQueue.attributes','exports','UserVoiceQueue','util','api','moment','bluebird'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xef35,0x146));var _0x5ef3=function(_0xfcbcb8,_0x35bf6b){_0xfcbcb8=_0xfcbcb8-0x0;var _0x1b1f97=_0xef35[_0xfcbcb8];return _0x1b1f97;};'use strict';var _=require('lodash');var util=require(_0x5ef3('0x0'));var logger=require('../../config/logger')(_0x5ef3('0x1'));var moment=require(_0x5ef3('0x2'));var BPromise=require(_0x5ef3('0x3'));var rp=require(_0x5ef3('0x4'));var fs=require('fs');var path=require(_0x5ef3('0x5'));var rimraf=require(_0x5ef3('0x6'));var config=require(_0x5ef3('0x7'));var attributes=require(_0x5ef3('0x8'));module[_0x5ef3('0x9')]=function(_0x361828,_0x2f32a2){return _0x361828['define'](_0x5ef3('0xa'),attributes,{'tableName':'user_has_voice_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe6fa=['user_has_voice_queues','lodash','util','bluebird','rimraf','../../config/environment','./userVoiceQueue.attributes','exports','define','UserVoiceQueue'];(function(_0x530a18,_0x46b804){var _0x56191c=function(_0xc735ff){while(--_0xc735ff){_0x530a18['push'](_0x530a18['shift']());}};_0x56191c(++_0x46b804);}(_0xe6fa,0x19b));var _0xae6f=function(_0x53a629,_0x1d0e1c){_0x53a629=_0x53a629-0x0;var _0x37a5fc=_0xe6fa[_0x53a629];return _0x37a5fc;};'use strict';var _=require(_0xae6f('0x0'));var util=require(_0xae6f('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xae6f('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xae6f('0x3'));var config=require(_0xae6f('0x4'));var attributes=require(_0xae6f('0x5'));module[_0xae6f('0x6')]=function(_0x1b1034,_0x2df1aa){return _0x1b1034[_0xae6f('0x7')](_0xae6f('0x8'),attributes,{'tableName':_0xae6f('0x9'),'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 9bc62f0..20d3ecf 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 _0x6dca=['request','UserVoiceQueue,\x20%s,\x20%s','UserVoiceQueue,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','client','http'];(function(_0x517d20,_0x4238d9){var _0x312482=function(_0x209252){while(--_0x209252){_0x517d20['push'](_0x517d20['shift']());}};_0x312482(++_0x4238d9);}(_0x6dca,0x1d4));var _0xa6dc=function(_0x5c370e,_0x4566e0){_0x5c370e=_0x5c370e-0x0;var _0x4c7b11=_0x6dca[_0x5c370e];return _0x4c7b11;};'use strict';var _=require('lodash');var util=require(_0xa6dc('0x0'));var moment=require(_0xa6dc('0x1'));var BPromise=require('bluebird');var rs=require(_0xa6dc('0x2'));var fs=require('fs');var Redis=require(_0xa6dc('0x3'));var db=require(_0xa6dc('0x4'))['db'];var utils=require(_0xa6dc('0x5'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xa6dc('0x6')][_0xa6dc('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x4d17d7,_0x587175,_0x3e5b80){return new BPromise(function(_0x10e9cb,_0x5d01f3){return client[_0xa6dc('0x8')](_0x4d17d7,_0x3e5b80)['then'](function(_0x2a258f){logger['info'](_0xa6dc('0x9'),_0x587175,'request\x20sent');logger['debug'](_0xa6dc('0xa'),_0x587175,'request\x20sent',JSON['stringify'](_0x2a258f));if(_0x2a258f[_0xa6dc('0xb')]){if(_0x2a258f['error'][_0xa6dc('0xc')]===0x1f4){logger[_0xa6dc('0xb')](_0xa6dc('0x9'),_0x587175,_0x2a258f['error'][_0xa6dc('0xd')]);return _0x5d01f3(_0x2a258f[_0xa6dc('0xb')]['message']);}logger[_0xa6dc('0xb')](_0xa6dc('0x9'),_0x587175,_0x2a258f['error'][_0xa6dc('0xd')]);return _0x10e9cb(_0x2a258f[_0xa6dc('0xb')][_0xa6dc('0xd')]);}else{logger[_0xa6dc('0xe')](_0xa6dc('0x9'),_0x587175,'request\x20sent');_0x10e9cb(_0x2a258f[_0xa6dc('0xf')][_0xa6dc('0xd')]);}})[_0xa6dc('0x10')](function(_0x412f64){logger['error']('UserVoiceQueue,\x20%s,\x20%s',_0x587175,_0x412f64);_0x5d01f3(_0x412f64);});});} \ No newline at end of file +var _0x1f36=['code','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','request','UserVoiceQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error'];(function(_0x3e665d,_0xef863d){var _0x24a155=function(_0x1343e7){while(--_0x1343e7){_0x3e665d['push'](_0x3e665d['shift']());}};_0x24a155(++_0xef863d);}(_0x1f36,0x129));var _0x61f3=function(_0x193685,_0x2802b5){_0x193685=_0x193685-0x0;var _0x159aaa=_0x1f36[_0x193685];return _0x159aaa;};'use strict';var _=require(_0x61f3('0x0'));var util=require(_0x61f3('0x1'));var moment=require(_0x61f3('0x2'));var BPromise=require(_0x61f3('0x3'));var rs=require(_0x61f3('0x4'));var fs=require('fs');var Redis=require(_0x61f3('0x5'));var db=require(_0x61f3('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x61f3('0x7'))(_0x61f3('0x8'));var config=require(_0x61f3('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x61f3('0xa')][_0x61f3('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5905ef,_0x5959a2,_0xbcc617){return new BPromise(function(_0x456f8f,_0x34ebaa){return client[_0x61f3('0xc')](_0x5905ef,_0xbcc617)['then'](function(_0xec3ed3){logger['info'](_0x61f3('0xd'),_0x5959a2,_0x61f3('0xe'));logger[_0x61f3('0xf')]('UserVoiceQueue,\x20%s,\x20%s,\x20%s',_0x5959a2,_0x61f3('0xe'),JSON[_0x61f3('0x10')](_0xec3ed3));if(_0xec3ed3['error']){if(_0xec3ed3[_0x61f3('0x11')][_0x61f3('0x12')]===0x1f4){logger[_0x61f3('0x11')](_0x61f3('0xd'),_0x5959a2,_0xec3ed3[_0x61f3('0x11')]['message']);return _0x34ebaa(_0xec3ed3[_0x61f3('0x11')][_0x61f3('0x13')]);}logger['error']('UserVoiceQueue,\x20%s,\x20%s',_0x5959a2,_0xec3ed3[_0x61f3('0x11')]['message']);return _0x456f8f(_0xec3ed3[_0x61f3('0x11')][_0x61f3('0x13')]);}else{logger['info'](_0x61f3('0xd'),_0x5959a2,_0x61f3('0xe'));_0x456f8f(_0xec3ed3[_0x61f3('0x14')][_0x61f3('0x13')]);}})['catch'](function(_0x4cadc4){logger[_0x61f3('0x11')]('UserVoiceQueue,\x20%s,\x20%s',_0x5959a2,_0x4cadc4);_0x34ebaa(_0x4cadc4);});});} \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/index.js b/server/api/userVoiceQueueRt/index.js index dae8122..59e8c1b 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 _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x2f1625,_0x2ca198){var _0x5b5b01=function(_0x5b5c80){while(--_0x5b5c80){_0x2f1625['push'](_0x2f1625['shift']());}};_0x5b5b01(++_0x2ca198);}(_0x70e0,0x17b));var _0x070e=function(_0x20cebb,_0x3a950d){_0x20cebb=_0x20cebb-0x0;var _0x44e08d=_0x70e0[_0x20cebb];return _0x44e08d;};'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(_0x238d90,_0x55ab60){var _0x46388a=function(_0x1ea450){while(--_0x1ea450){_0x238d90['push'](_0x238d90['shift']());}};_0x46388a(++_0x55ab60);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5783f4,_0x4a9e0a){_0x5783f4=_0x5783f4-0x0;var _0x28e380=_0xa9e0[_0x5783f4];return _0x28e380;};'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/userVoiceQueueRt/userVoiceQueueRt.attributes.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js index 4f3bdb5..d2faad5 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 _0xad91=['INTEGER','Required\x20by\x20Asterisk','STRING','queue_interface','sequelize','exports'];(function(_0x52b494,_0x144998){var _0x295940=function(_0x2ee8eb){while(--_0x2ee8eb){_0x52b494['push'](_0x52b494['shift']());}};_0x295940(++_0x144998);}(_0xad91,0xd0));var _0x1ad9=function(_0x17d69e,_0x27717d){_0x17d69e=_0x17d69e-0x0;var _0x4b153f=_0xad91[_0x17d69e];return _0x4b153f;};'use strict';var Sequelize=require(_0x1ad9('0x0'));module[_0x1ad9('0x1')]={'uniqueid':{'type':Sequelize[_0x1ad9('0x2')],'primaryKey':!![],'autoIncrement':!![],'comment':_0x1ad9('0x3')},'membername':{'type':Sequelize['STRING'],'allowNull':![],'comment':_0x1ad9('0x3')},'UserId':{'type':Sequelize[_0x1ad9('0x2')],'allowNull':![]},'queue_name':{'type':Sequelize[_0x1ad9('0x4')],'allowNull':![],'unique':_0x1ad9('0x5'),'comment':_0x1ad9('0x3')},'VoiceQueueId':{'type':Sequelize[_0x1ad9('0x2')],'allowNull':![]},'interface':{'type':Sequelize[_0x1ad9('0x4')],'allowNull':![],'unique':_0x1ad9('0x5'),'comment':_0x1ad9('0x3')},'penalty':{'type':Sequelize[_0x1ad9('0x2')](0xb),'defaultValue':0x0,'comment':'Required\x20by\x20Asterisk'},'paused':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'comment':'Required\x20by\x20Asterisk'}}; \ No newline at end of file +var _0x170a=['STRING','queue_interface','Required\x20by\x20Asterisk','sequelize','exports','INTEGER'];(function(_0x22bee0,_0x412ecb){var _0x2d295b=function(_0x59d4b5){while(--_0x59d4b5){_0x22bee0['push'](_0x22bee0['shift']());}};_0x2d295b(++_0x412ecb);}(_0x170a,0xed));var _0xa170=function(_0x135dcb,_0x26ca64){_0x135dcb=_0x135dcb-0x0;var _0x2a0efb=_0x170a[_0x135dcb];return _0x2a0efb;};'use strict';var Sequelize=require(_0xa170('0x0'));module[_0xa170('0x1')]={'uniqueid':{'type':Sequelize[_0xa170('0x2')],'primaryKey':!![],'autoIncrement':!![],'comment':'Required\x20by\x20Asterisk'},'membername':{'type':Sequelize[_0xa170('0x3')],'allowNull':![],'comment':'Required\x20by\x20Asterisk'},'UserId':{'type':Sequelize[_0xa170('0x2')],'allowNull':![]},'queue_name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xa170('0x4'),'comment':_0xa170('0x5')},'VoiceQueueId':{'type':Sequelize[_0xa170('0x2')],'allowNull':![]},'interface':{'type':Sequelize[_0xa170('0x3')],'allowNull':![],'unique':_0xa170('0x4'),'comment':_0xa170('0x5')},'penalty':{'type':Sequelize[_0xa170('0x2')](0xb),'defaultValue':0x0,'comment':_0xa170('0x5')},'paused':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'comment':_0xa170('0x5')}}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js index 47cf309..fe462dc 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 _0x03ea=['UserVoiceQueueRt','setMaxListeners','save','update','remove','hasOwnProperty','hook','exports','../../mysqldb'];(function(_0x2711ba,_0x28c0ff){var _0x34ed68=function(_0x3f9686){while(--_0x3f9686){_0x2711ba['push'](_0x2711ba['shift']());}};_0x34ed68(++_0x28c0ff);}(_0x03ea,0x182));var _0xa03e=function(_0x54117b,_0x10872c){_0x54117b=_0x54117b-0x0;var _0x15452f=_0x03ea[_0x54117b];return _0x15452f;};'use strict';var EventEmitter=require('events');var UserVoiceQueueRt=require(_0xa03e('0x0'))['db'][_0xa03e('0x1')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0xa03e('0x2')](0x0);var events={'afterCreate':_0xa03e('0x3'),'afterUpdate':_0xa03e('0x4'),'afterDestroy':_0xa03e('0x5')};function emitEvent(_0x513160){return function(_0x515fdd,_0x503262,_0x243348){UserVoiceQueueRtEvents['emit'](_0x513160+':'+_0x515fdd['id'],_0x515fdd);UserVoiceQueueRtEvents['emit'](_0x513160,_0x515fdd);_0x243348(null);};}for(var e in events){if(events[_0xa03e('0x6')](e)){var event=events[e];UserVoiceQueueRt[_0xa03e('0x7')](e,emitEvent(event));}}module[_0xa03e('0x8')]=UserVoiceQueueRtEvents; \ No newline at end of file +var _0x7c83=['setMaxListeners','update','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x316cf,_0x32210c){var _0x513863=function(_0x1ae58b){while(--_0x1ae58b){_0x316cf['push'](_0x316cf['shift']());}};_0x513863(++_0x32210c);}(_0x7c83,0x7c));var _0x37c8=function(_0x176003,_0x2c5488){_0x176003=_0x176003-0x0;var _0x1210fe=_0x7c83[_0x176003];return _0x1210fe;};'use strict';var EventEmitter=require(_0x37c8('0x0'));var UserVoiceQueueRt=require(_0x37c8('0x1'))['db']['UserVoiceQueueRt'];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0x37c8('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x37c8('0x3'),'afterDestroy':'remove'};function emitEvent(_0x3e1bf2){return function(_0x42cfc5,_0x21e052,_0x8580d5){UserVoiceQueueRtEvents['emit'](_0x3e1bf2+':'+_0x42cfc5['id'],_0x42cfc5);UserVoiceQueueRtEvents['emit'](_0x3e1bf2,_0x42cfc5);_0x8580d5(null);};}for(var e in events){if(events[_0x37c8('0x4')](e)){var event=events[e];UserVoiceQueueRt[_0x37c8('0x5')](e,emitEvent(event));}}module[_0x37c8('0x6')]=UserVoiceQueueRtEvents; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js index 8999ed2..5572692 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 _0x6517=['define','UserVoiceQueueRt','user_has_voice_queues_rt','lodash','util','api','path','rimraf','./userVoiceQueueRt.attributes','exports'];(function(_0x2d9c6a,_0x59393d){var _0xf3c918=function(_0x4f3f26){while(--_0x4f3f26){_0x2d9c6a['push'](_0x2d9c6a['shift']());}};_0xf3c918(++_0x59393d);}(_0x6517,0x193));var _0x7651=function(_0x4d2169,_0x1861ba){_0x4d2169=_0x4d2169-0x0;var _0x30d3dd=_0x6517[_0x4d2169];return _0x30d3dd;};'use strict';var _=require(_0x7651('0x0'));var util=require(_0x7651('0x1'));var logger=require('../../config/logger')(_0x7651('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x7651('0x3'));var rimraf=require(_0x7651('0x4'));var config=require('../../config/environment');var attributes=require(_0x7651('0x5'));module[_0x7651('0x6')]=function(_0x23cca0,_0x2d9954){return _0x23cca0[_0x7651('0x7')](_0x7651('0x8'),attributes,{'tableName':_0x7651('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2603=['rimraf','../../config/environment','./userVoiceQueueRt.attributes','define','UserVoiceQueueRt','lodash','util','moment','bluebird','path'];(function(_0x9babe0,_0x454b48){var _0xfe2032=function(_0x20adc4){while(--_0x20adc4){_0x9babe0['push'](_0x9babe0['shift']());}};_0xfe2032(++_0x454b48);}(_0x2603,0x19f));var _0x3260=function(_0x2b60bd,_0x49418d){_0x2b60bd=_0x2b60bd-0x0;var _0x3d9523=_0x2603[_0x2b60bd];return _0x3d9523;};'use strict';var _=require(_0x3260('0x0'));var util=require(_0x3260('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x3260('0x2'));var BPromise=require(_0x3260('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3260('0x4'));var rimraf=require(_0x3260('0x5'));var config=require(_0x3260('0x6'));var attributes=require(_0x3260('0x7'));module['exports']=function(_0x460de5,_0x2746b5){return _0x460de5[_0x3260('0x8')](_0x3260('0x9'),attributes,{'tableName':'user_has_voice_queues_rt','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.rpc.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.rpc.js index 36e7c66..15272e1 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 _0xe419=['COUNT','literal','`paused`\x20=\x201,\x201,\x20null','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','request','then','info','request\x20sent','debug','stringify','error','message','UserVoiceQueueRt,\x20%s,\x20%s','result','catch','GetVoiceQueueRtPauses','findAll','options','raw','sequelize'];(function(_0x2b5df7,_0x15d49c){var _0x38f4e8=function(_0x4409f2){while(--_0x4409f2){_0x2b5df7['push'](_0x2b5df7['shift']());}};_0x38f4e8(++_0x15d49c);}(_0xe419,0x97));var _0x9e41=function(_0x5d8803,_0x14bc1f){_0x5d8803=_0x5d8803-0x0;var _0x578de3=_0xe419[_0x5d8803];return _0x578de3;};'use strict';var _=require(_0x9e41('0x0'));var util=require(_0x9e41('0x1'));var moment=require(_0x9e41('0x2'));var BPromise=require(_0x9e41('0x3'));var rs=require(_0x9e41('0x4'));var fs=require('fs');var Redis=require(_0x9e41('0x5'));var db=require(_0x9e41('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x9e41('0x7'))(_0x9e41('0x8'));var config=require(_0x9e41('0x9'));var jayson=require(_0x9e41('0xa'));var client=jayson[_0x9e41('0xb')][_0x9e41('0xc')]({'port':0x232a});config[_0x9e41('0xd')]=_[_0x9e41('0xe')](config[_0x9e41('0xd')],{'host':_0x9e41('0xf'),'port':0x18eb});var socket=require(_0x9e41('0x10'))(new Redis(config[_0x9e41('0xd')]));require('./userVoiceQueueRt.socket')[_0x9e41('0x11')](socket);function respondWithRpcPromise(_0x466897,_0x361021,_0xd90ac){return new BPromise(function(_0x5b4b9a,_0x37a7dd){return client[_0x9e41('0x12')](_0x466897,_0xd90ac)[_0x9e41('0x13')](function(_0x35176f){logger[_0x9e41('0x14')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x361021,_0x9e41('0x15'));logger[_0x9e41('0x16')]('UserVoiceQueueRt,\x20%s,\x20%s,\x20%s',_0x361021,_0x9e41('0x15'),JSON[_0x9e41('0x17')](_0x35176f));if(_0x35176f[_0x9e41('0x18')]){if(_0x35176f[_0x9e41('0x18')]['code']===0x1f4){logger[_0x9e41('0x18')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x361021,_0x35176f[_0x9e41('0x18')][_0x9e41('0x19')]);return _0x37a7dd(_0x35176f[_0x9e41('0x18')][_0x9e41('0x19')]);}logger['error'](_0x9e41('0x1a'),_0x361021,_0x35176f[_0x9e41('0x18')][_0x9e41('0x19')]);return _0x5b4b9a(_0x35176f[_0x9e41('0x18')]['message']);}else{logger[_0x9e41('0x14')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x361021,_0x9e41('0x15'));_0x5b4b9a(_0x35176f[_0x9e41('0x1b')]['message']);}})[_0x9e41('0x1c')](function(_0x31efaa){logger[_0x9e41('0x18')](_0x9e41('0x1a'),_0x361021,_0x31efaa);_0x37a7dd(_0x31efaa);});});}exports[_0x9e41('0x1d')]=function(_0x3e3885){var _0x2e5a9e=this;return new Promise(function(_0x2df2dd,_0x5695e5){return db['UserVoiceQueueRt'][_0x9e41('0x1e')]({'raw':_0x3e3885[_0x9e41('0x1f')]?_0x3e3885[_0x9e41('0x1f')][_0x9e41('0x20')]===undefined?!![]:![]:!![],'where':_0x3e3885['options']?_0x3e3885[_0x9e41('0x1f')]['where']||null:null,'attributes':[[db[_0x9e41('0x21')]['fn'](_0x9e41('0x22'),db[_0x9e41('0x21')]['fn']('IF',db[_0x9e41('0x21')][_0x9e41('0x23')](_0x9e41('0x24')))),'outboundQueuePauses']]})[_0x9e41('0x13')](function(_0x3424b0){logger[_0x9e41('0x14')]('GetVoiceQueueRtPauses',_0x3e3885);logger[_0x9e41('0x16')](_0x9e41('0x1d'),_0x3e3885,JSON[_0x9e41('0x17')](_0x3424b0));_0x2df2dd(_0x3424b0);})[_0x9e41('0x1c')](function(_0x72b5e5){logger[_0x9e41('0x18')]('GetVoiceQueueRtPauses',_0x72b5e5[_0x9e41('0x19')],_0x3e3885);_0x5695e5(_0x2e5a9e['error'](0x1f4,_0x72b5e5['message']));});});}; \ No newline at end of file +var _0x6a1c=['catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','client','http','redis','localhost','./userVoiceQueueRt.socket','request','then','info','UserVoiceQueueRt,\x20%s,\x20%s','request\x20sent','debug','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','stringify','error','message','GetVoiceQueueRtPauses','UserVoiceQueueRt','options','COUNT','sequelize','literal','`paused`\x20=\x201,\x201,\x20null','outboundQueuePauses'];(function(_0x521e05,_0x57b759){var _0x2790ff=function(_0x412403){while(--_0x412403){_0x521e05['push'](_0x521e05['shift']());}};_0x2790ff(++_0x57b759);}(_0x6a1c,0x161));var _0xc6a1=function(_0x480898,_0x4b7474){_0x480898=_0x480898-0x0;var _0x2e74a3=_0x6a1c[_0x480898];return _0x2e74a3;};'use strict';var _=require(_0xc6a1('0x0'));var util=require(_0xc6a1('0x1'));var moment=require('moment');var BPromise=require(_0xc6a1('0x2'));var rs=require(_0xc6a1('0x3'));var fs=require('fs');var Redis=require(_0xc6a1('0x4'));var db=require(_0xc6a1('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xc6a1('0x6'))('rpc');var config=require(_0xc6a1('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xc6a1('0x8')][_0xc6a1('0x9')]({'port':0x232a});config[_0xc6a1('0xa')]=_['defaults'](config[_0xc6a1('0xa')],{'host':_0xc6a1('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xc6a1('0xa')]));require(_0xc6a1('0xc'))['register'](socket);function respondWithRpcPromise(_0x3ca402,_0x264a59,_0x445ced){return new BPromise(function(_0x233eea,_0x483b32){return client[_0xc6a1('0xd')](_0x3ca402,_0x445ced)[_0xc6a1('0xe')](function(_0x574e0e){logger[_0xc6a1('0xf')](_0xc6a1('0x10'),_0x264a59,_0xc6a1('0x11'));logger[_0xc6a1('0x12')](_0xc6a1('0x13'),_0x264a59,_0xc6a1('0x11'),JSON[_0xc6a1('0x14')](_0x574e0e));if(_0x574e0e[_0xc6a1('0x15')]){if(_0x574e0e[_0xc6a1('0x15')]['code']===0x1f4){logger['error'](_0xc6a1('0x10'),_0x264a59,_0x574e0e['error']['message']);return _0x483b32(_0x574e0e['error'][_0xc6a1('0x16')]);}logger['error']('UserVoiceQueueRt,\x20%s,\x20%s',_0x264a59,_0x574e0e[_0xc6a1('0x15')]['message']);return _0x233eea(_0x574e0e[_0xc6a1('0x15')][_0xc6a1('0x16')]);}else{logger[_0xc6a1('0xf')](_0xc6a1('0x10'),_0x264a59,_0xc6a1('0x11'));_0x233eea(_0x574e0e['result']['message']);}})['catch'](function(_0x409880){logger[_0xc6a1('0x15')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x264a59,_0x409880);_0x483b32(_0x409880);});});}exports[_0xc6a1('0x17')]=function(_0x23b4a6){var _0x3ffd3d=this;return new Promise(function(_0x39549d,_0x18e122){return db[_0xc6a1('0x18')]['findAll']({'raw':_0x23b4a6[_0xc6a1('0x19')]?_0x23b4a6['options']['raw']===undefined?!![]:![]:!![],'where':_0x23b4a6[_0xc6a1('0x19')]?_0x23b4a6['options']['where']||null:null,'attributes':[[db['sequelize']['fn'](_0xc6a1('0x1a'),db[_0xc6a1('0x1b')]['fn']('IF',db[_0xc6a1('0x1b')][_0xc6a1('0x1c')](_0xc6a1('0x1d')))),_0xc6a1('0x1e')]]})[_0xc6a1('0xe')](function(_0x94f991){logger[_0xc6a1('0xf')](_0xc6a1('0x17'),_0x23b4a6);logger['debug'](_0xc6a1('0x17'),_0x23b4a6,JSON[_0xc6a1('0x14')](_0x94f991));_0x39549d(_0x94f991);})[_0xc6a1('0x1f')](function(_0x220f38){logger[_0xc6a1('0x15')](_0xc6a1('0x17'),_0x220f38['message'],_0x23b4a6);_0x18e122(_0x3ffd3d[_0xc6a1('0x15')](0x1f4,_0x220f38[_0xc6a1('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js index fbaf888..4d40079 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 _0x68f5=['register','userVoiceQueueRt:','./userVoiceQueueRt.events','save','remove','emit','removeListener'];(function(_0x292f40,_0x1049ec){var _0x39ab8d=function(_0x119e3d){while(--_0x119e3d){_0x292f40['push'](_0x292f40['shift']());}};_0x39ab8d(++_0x1049ec);}(_0x68f5,0x11a));var _0x568f=function(_0x44d997,_0x50ccba){_0x44d997=_0x44d997-0x0;var _0x36710b=_0x68f5[_0x44d997];return _0x36710b;};'use strict';var UserVoiceQueueRtEvents=require(_0x568f('0x0'));var events=[_0x568f('0x1'),_0x568f('0x2'),'update'];function createListener(_0x25a405,_0x44b6ad){return function(_0x23bd5b){_0x44b6ad[_0x568f('0x3')](_0x25a405,_0x23bd5b);};}function removeListener(_0x425217,_0x5de1c0){return function(){UserVoiceQueueRtEvents[_0x568f('0x4')](_0x425217,_0x5de1c0);};}exports[_0x568f('0x5')]=function(_0x31444b){for(var _0x3181fd=0x0,_0x4ca62c=events['length'];_0x3181fd<_0x4ca62c;_0x3181fd++){var _0x953f02=events[_0x3181fd];var _0x3568a0=createListener(_0x568f('0x6')+_0x953f02,_0x31444b);UserVoiceQueueRtEvents['on'](_0x953f02,_0x3568a0);}}; \ No newline at end of file +var _0x814b=['removeListener','register','length','userVoiceQueueRt:','./userVoiceQueueRt.events','save','remove','update','emit'];(function(_0x1e4f2d,_0x22e2bb){var _0xd05ce5=function(_0x4c7b43){while(--_0x4c7b43){_0x1e4f2d['push'](_0x1e4f2d['shift']());}};_0xd05ce5(++_0x22e2bb);}(_0x814b,0x1a2));var _0xb814=function(_0xd0a847,_0x72562b){_0xd0a847=_0xd0a847-0x0;var _0x2536ec=_0x814b[_0xd0a847];return _0x2536ec;};'use strict';var UserVoiceQueueRtEvents=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(){UserVoiceQueueRtEvents[_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);UserVoiceQueueRtEvents['on'](_0x5c8539,_0x271af9);}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/index.js b/server/api/userWhatsappQueue/index.js index 8be203f..d95fc3b 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 _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x5207a2,_0x316913){var _0x314716=function(_0x2ca663){while(--_0x2ca663){_0x5207a2['push'](_0x5207a2['shift']());}};_0x314716(++_0x316913);}(_0xa9e0,0x123));var _0x0a9e=function(_0x24237f,_0x4cf32c){_0x24237f=_0x24237f-0x0;var _0x48298e=_0xa9e0[_0x24237f];return _0x48298e;};'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 _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x4fab73,_0x6c1609){var _0x17f5d7=function(_0x275b48){while(--_0x275b48){_0x4fab73['push'](_0x4fab73['shift']());}};_0x17f5d7(++_0x6c1609);}(_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/userWhatsappQueue/userWhatsappQueue.attributes.js b/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js index 0e7677f..b43408b 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 _0x39b4=['INTEGER','sequelize','exports'];(function(_0x2eed72,_0x21c5ec){var _0x42320c=function(_0x3c401f){while(--_0x3c401f){_0x2eed72['push'](_0x2eed72['shift']());}};_0x42320c(++_0x21c5ec);}(_0x39b4,0xd3));var _0x439b=function(_0xb4ef16,_0x49d374){_0xb4ef16=_0xb4ef16-0x0;var _0x46ed61=_0x39b4[_0xb4ef16];return _0x46ed61;};'use strict';var Sequelize=require(_0x439b('0x0'));module[_0x439b('0x1')]={'penalty':{'type':Sequelize[_0x439b('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x9837=['sequelize'];(function(_0x25c5a4,_0x1922b9){var _0x3f191b=function(_0x4931f0){while(--_0x4931f0){_0x25c5a4['push'](_0x25c5a4['shift']());}};_0x3f191b(++_0x1922b9);}(_0x9837,0x84));var _0x7983=function(_0x371f76,_0x1b3065){_0x371f76=_0x371f76-0x0;var _0x536ec8=_0x9837[_0x371f76];return _0x536ec8;};'use strict';var Sequelize=require(_0x7983('0x0'));module['exports']={'penalty':{'type':Sequelize['INTEGER'],'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 6845b50..da365f4 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 _0x3c3b=['UserWhatsappQueue','user_has_whatsapp_queues','util','../../config/logger','bluebird','rimraf','../../config/environment','./userWhatsappQueue.attributes','exports','define'];(function(_0x29ab8e,_0x67c0c1){var _0xc602a3=function(_0x2782b5){while(--_0x2782b5){_0x29ab8e['push'](_0x29ab8e['shift']());}};_0xc602a3(++_0x67c0c1);}(_0x3c3b,0xac));var _0xb3c3=function(_0x4833ff,_0x445cd7){_0x4833ff=_0x4833ff-0x0;var _0xc15ab2=_0x3c3b[_0x4833ff];return _0xc15ab2;};'use strict';var _=require('lodash');var util=require(_0xb3c3('0x0'));var logger=require(_0xb3c3('0x1'))('api');var moment=require('moment');var BPromise=require(_0xb3c3('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xb3c3('0x3'));var config=require(_0xb3c3('0x4'));var attributes=require(_0xb3c3('0x5'));module[_0xb3c3('0x6')]=function(_0x483fe7,_0x4e9d68){return _0x483fe7[_0xb3c3('0x7')](_0xb3c3('0x8'),attributes,{'tableName':_0xb3c3('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2ab8=['define','UserWhatsappQueue','user_has_whatsapp_queues','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','./userWhatsappQueue.attributes','exports'];(function(_0x48f0ce,_0x1897f5){var _0x338961=function(_0x15294c){while(--_0x15294c){_0x48f0ce['push'](_0x48f0ce['shift']());}};_0x338961(++_0x1897f5);}(_0x2ab8,0x114));var _0x82ab=function(_0x48dc08,_0x508b5f){_0x48dc08=_0x48dc08-0x0;var _0x3b8bed=_0x2ab8[_0x48dc08];return _0x3b8bed;};'use strict';var _=require(_0x82ab('0x0'));var util=require(_0x82ab('0x1'));var logger=require(_0x82ab('0x2'))('api');var moment=require(_0x82ab('0x3'));var BPromise=require(_0x82ab('0x4'));var rp=require(_0x82ab('0x5'));var fs=require('fs');var path=require(_0x82ab('0x6'));var rimraf=require(_0x82ab('0x7'));var config=require('../../config/environment');var attributes=require(_0x82ab('0x8'));module[_0x82ab('0x9')]=function(_0x36e8dc,_0xc560fb){return _0x36e8dc[_0x82ab('0xa')](_0x82ab('0xb'),attributes,{'tableName':_0x82ab('0xc'),'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 a92fa2c..231db68 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 _0x1b48=['lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','UserWhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','UserWhatsappQueue,\x20%s,\x20%s,\x20%s','error','code','message','result'];(function(_0x3bacde,_0x89163){var _0x3ebd10=function(_0x9851b9){while(--_0x9851b9){_0x3bacde['push'](_0x3bacde['shift']());}};_0x3ebd10(++_0x89163);}(_0x1b48,0x73));var _0x81b4=function(_0x4fb3c7,_0x5ec3e9){_0x4fb3c7=_0x4fb3c7-0x0;var _0xffa736=_0x1b48[_0x4fb3c7];return _0xffa736;};'use strict';var _=require(_0x81b4('0x0'));var util=require(_0x81b4('0x1'));var moment=require(_0x81b4('0x2'));var BPromise=require(_0x81b4('0x3'));var rs=require(_0x81b4('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x81b4('0x5'))['db'];var utils=require(_0x81b4('0x6'));var logger=require(_0x81b4('0x7'))(_0x81b4('0x8'));var config=require('../../config/environment');var jayson=require(_0x81b4('0x9'));var client=jayson[_0x81b4('0xa')][_0x81b4('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5ba6ab,_0x3d425f,_0x5411b1){return new BPromise(function(_0x470059,_0x2266db){return client[_0x81b4('0xc')](_0x5ba6ab,_0x5411b1)[_0x81b4('0xd')](function(_0x46ccaa){logger[_0x81b4('0xe')](_0x81b4('0xf'),_0x3d425f,_0x81b4('0x10'));logger[_0x81b4('0x11')](_0x81b4('0x12'),_0x3d425f,'request\x20sent',JSON['stringify'](_0x46ccaa));if(_0x46ccaa['error']){if(_0x46ccaa[_0x81b4('0x13')][_0x81b4('0x14')]===0x1f4){logger[_0x81b4('0x13')]('UserWhatsappQueue,\x20%s,\x20%s',_0x3d425f,_0x46ccaa[_0x81b4('0x13')][_0x81b4('0x15')]);return _0x2266db(_0x46ccaa['error'][_0x81b4('0x15')]);}logger[_0x81b4('0x13')]('UserWhatsappQueue,\x20%s,\x20%s',_0x3d425f,_0x46ccaa[_0x81b4('0x13')]['message']);return _0x470059(_0x46ccaa['error']['message']);}else{logger['info'](_0x81b4('0xf'),_0x3d425f,_0x81b4('0x10'));_0x470059(_0x46ccaa[_0x81b4('0x16')]['message']);}})['catch'](function(_0x76f127){logger[_0x81b4('0x13')]('UserWhatsappQueue,\x20%s,\x20%s',_0x3d425f,_0x76f127);_0x2266db(_0x76f127);});});} \ No newline at end of file +var _0xbb6c=['ioredis','../../mysqldb','../../config/utils','../../config/logger','client','http','request','then','UserWhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','util','bluebird'];(function(_0x35517c,_0x17c03f){var _0x4c9d3f=function(_0x5055a1){while(--_0x5055a1){_0x35517c['push'](_0x35517c['shift']());}};_0x4c9d3f(++_0x17c03f);}(_0xbb6c,0xee));var _0xcbb6=function(_0x5ee823,_0x24650b){_0x5ee823=_0x5ee823-0x0;var _0x209bd2=_0xbb6c[_0x5ee823];return _0x209bd2;};'use strict';var _=require('lodash');var util=require(_0xcbb6('0x0'));var moment=require('moment');var BPromise=require(_0xcbb6('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xcbb6('0x2'));var db=require(_0xcbb6('0x3'))['db'];var utils=require(_0xcbb6('0x4'));var logger=require(_0xcbb6('0x5'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xcbb6('0x6')][_0xcbb6('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x1b8406,_0x18f2db,_0x2d5975){return new BPromise(function(_0x227322,_0x28c332){return client[_0xcbb6('0x8')](_0x1b8406,_0x2d5975)[_0xcbb6('0x9')](function(_0x28e79c){logger['info'](_0xcbb6('0xa'),_0x18f2db,_0xcbb6('0xb'));logger[_0xcbb6('0xc')]('UserWhatsappQueue,\x20%s,\x20%s,\x20%s',_0x18f2db,_0xcbb6('0xb'),JSON[_0xcbb6('0xd')](_0x28e79c));if(_0x28e79c[_0xcbb6('0xe')]){if(_0x28e79c[_0xcbb6('0xe')][_0xcbb6('0xf')]===0x1f4){logger[_0xcbb6('0xe')](_0xcbb6('0xa'),_0x18f2db,_0x28e79c[_0xcbb6('0xe')][_0xcbb6('0x10')]);return _0x28c332(_0x28e79c[_0xcbb6('0xe')][_0xcbb6('0x10')]);}logger['error'](_0xcbb6('0xa'),_0x18f2db,_0x28e79c['error'][_0xcbb6('0x10')]);return _0x227322(_0x28e79c[_0xcbb6('0xe')]['message']);}else{logger[_0xcbb6('0x11')](_0xcbb6('0xa'),_0x18f2db,_0xcbb6('0xb'));_0x227322(_0x28e79c[_0xcbb6('0x12')]['message']);}})[_0xcbb6('0x13')](function(_0x4208fb){logger['error'](_0xcbb6('0xa'),_0x18f2db,_0x4208fb);_0x28c332(_0x4208fb);});});} \ No newline at end of file diff --git a/server/api/variable/index.js b/server/api/variable/index.js index 97d3e9e..fe74718 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 _0x2121=['put','update','destroy','exports','multer','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./variable.controller','isAuthenticated','index','get','/:id','show','create'];(function(_0x566155,_0x275b7a){var _0x326b28=function(_0x5b41e0){while(--_0x5b41e0){_0x566155['push'](_0x566155['shift']());}};_0x326b28(++_0x275b7a);}(_0x2121,0x1b4));var _0x1212=function(_0xa5a054,_0x367fbc){_0xa5a054=_0xa5a054-0x0;var _0x11febb=_0x2121[_0xa5a054];return _0x11febb;};'use strict';var multer=require(_0x1212('0x0'));var util=require(_0x1212('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x1212('0x2'));var router=express[_0x1212('0x3')]();var fs_extra=require(_0x1212('0x4'));var auth=require(_0x1212('0x5'));var interaction=require(_0x1212('0x6'));var config=require('../../config/environment');var controller=require(_0x1212('0x7'));router['get']('/',auth[_0x1212('0x8')](),controller[_0x1212('0x9')]);router[_0x1212('0xa')](_0x1212('0xb'),auth[_0x1212('0x8')](),controller[_0x1212('0xc')]);router['post']('/',auth[_0x1212('0x8')](),controller[_0x1212('0xd')]);router[_0x1212('0xe')](_0x1212('0xb'),auth[_0x1212('0x8')](),controller[_0x1212('0xf')]);router['delete']('/:id',auth[_0x1212('0x8')](),controller[_0x1212('0x10')]);module[_0x1212('0x11')]=router; \ No newline at end of file +var _0xf3be=['exports','multer','util','path','connect-timeout','Router','./variable.controller','get','index','/:id','isAuthenticated','show','post','put','update','delete'];(function(_0x3d78ce,_0x83c8a9){var _0x150489=function(_0x16a53b){while(--_0x16a53b){_0x3d78ce['push'](_0x3d78ce['shift']());}};_0x150489(++_0x83c8a9);}(_0xf3be,0x1e1));var _0xef3b=function(_0x3502b2,_0x50af10){_0x3502b2=_0x3502b2-0x0;var _0x53c57a=_0xf3be[_0x3502b2];return _0x53c57a;};'use strict';var multer=require(_0xef3b('0x0'));var util=require(_0xef3b('0x1'));var path=require(_0xef3b('0x2'));var timeout=require(_0xef3b('0x3'));var express=require('express');var router=express[_0xef3b('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(_0xef3b('0x5'));router[_0xef3b('0x6')]('/',auth['isAuthenticated'](),controller[_0xef3b('0x7')]);router[_0xef3b('0x6')](_0xef3b('0x8'),auth[_0xef3b('0x9')](),controller[_0xef3b('0xa')]);router[_0xef3b('0xb')]('/',auth['isAuthenticated'](),controller['create']);router[_0xef3b('0xc')]('/:id',auth[_0xef3b('0x9')](),controller[_0xef3b('0xd')]);router[_0xef3b('0xe')]('/:id',auth[_0xef3b('0x9')](),controller['destroy']);module[_0xef3b('0xf')]=router; \ No newline at end of file diff --git a/server/api/variable/variable.attributes.js b/server/api/variable/variable.attributes.js index 3098441..1a040a8 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 _0xfa41=['STRING','name','exports'];(function(_0x45616f,_0xddc0dd){var _0xa3f0f8=function(_0x170c10){while(--_0x170c10){_0x45616f['push'](_0x45616f['shift']());}};_0xa3f0f8(++_0xddc0dd);}(_0xfa41,0xd1));var _0x1fa4=function(_0x46adcd,_0x15c37b){_0x46adcd=_0x46adcd-0x0;var _0x2f9454=_0xfa41[_0x46adcd];return _0x2f9454;};'use strict';var Sequelize=require('sequelize');module[_0x1fa4('0x0')]={'name':{'type':Sequelize[_0x1fa4('0x1')],'unique':_0x1fa4('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xfdcb=['sequelize','exports','STRING','name'];(function(_0x5037ab,_0x43209e){var _0x512adb=function(_0x261783){while(--_0x261783){_0x5037ab['push'](_0x5037ab['shift']());}};_0x512adb(++_0x43209e);}(_0xfdcb,0x134));var _0xbfdc=function(_0x5cd2ab,_0x2d162b){_0x5cd2ab=_0x5cd2ab-0x0;var _0x4663db=_0xfdcb[_0x5cd2ab];return _0x4663db;};'use strict';var Sequelize=require(_0xbfdc('0x0'));module[_0xbfdc('0x1')]={'name':{'type':Sequelize[_0xbfdc('0x2')],'unique':_0xbfdc('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xbfdc('0x2')]}}; \ No newline at end of file diff --git a/server/api/variable/variable.controller.js b/server/api/variable/variable.controller.js index 7578d22..dc43b7c 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 _0xc5de=['fields','length','hasOwnProperty','offset','order','where','pick','VIRTUAL','filter','merge','options','count','includeAll','include','findAll','rows','catch','show','params','keys','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','set','Content-Range','reject','save','update','get','Variables','UserProfileResource','destroy','then','stack','name','send','index','map','Variable','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes'];(function(_0x10dbab,_0x2e8174){var _0x408bfe=function(_0x4bca15){while(--_0x4bca15){_0x10dbab['push'](_0x10dbab['shift']());}};_0x408bfe(++_0x2e8174);}(_0xc5de,0x1c1));var _0xec5d=function(_0x30df3b,_0x90abb5){_0x30df3b=_0x30df3b-0x0;var _0xe1b865=_0xc5de[_0x30df3b];return _0xe1b865;};'use strict';var emlformat=require(_0xec5d('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xec5d('0x1'));var jsonpatch=require(_0xec5d('0x2'));var rp=require(_0xec5d('0x3'));var moment=require(_0xec5d('0x4'));var BPromise=require(_0xec5d('0x5'));var Mustache=require(_0xec5d('0x6'));var util=require(_0xec5d('0x7'));var path=require(_0xec5d('0x8'));var sox=require(_0xec5d('0x9'));var csv=require(_0xec5d('0xa'));var ejs=require(_0xec5d('0xb'));var fs=require('fs');var fs_extra=require(_0xec5d('0xc'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xec5d('0xd'));var deskjs=require(_0xec5d('0xe'));var toCsv=require('to-csv');var querystring=require(_0xec5d('0xf'));var Papa=require(_0xec5d('0x10'));var Redis=require(_0xec5d('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xec5d('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xec5d('0x13'));var logger=require(_0xec5d('0x14'))('api');var utils=require(_0xec5d('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xec5d('0x16'));var db=require(_0xec5d('0x17'))['db'];function respondWithStatusCode(_0x585363,_0x5b3b7f){_0x5b3b7f=_0x5b3b7f||0xcc;return function(_0x4b7dc5){if(_0x4b7dc5){return _0x585363[_0xec5d('0x18')](_0x5b3b7f);}return _0x585363[_0xec5d('0x19')](_0x5b3b7f)[_0xec5d('0x1a')]();};}function respondWithResult(_0x16e945,_0x4ddc27){_0x4ddc27=_0x4ddc27||0xc8;return function(_0x3ac7b0){if(_0x3ac7b0){return _0x16e945[_0xec5d('0x19')](_0x4ddc27)[_0xec5d('0x1b')](_0x3ac7b0);}};}function respondWithFilteredResult(_0x414bde,_0x150175){return function(_0x2fc1a8){if(_0x2fc1a8){var _0x4cbcaf=typeof _0x150175['offset']===_0xec5d('0x1c')&&typeof _0x150175[_0xec5d('0x1d')]===_0xec5d('0x1c');var _0x2a9798=_0x2fc1a8['count'];var _0x519a89=_0x4cbcaf?0x0:_0x150175['offset'];var _0x458161=_0x4cbcaf?_0x2fc1a8['count']:_0x150175['offset']+_0x150175[_0xec5d('0x1d')];var _0x5497af;if(_0x458161>=_0x2a9798){_0x458161=_0x2a9798;_0x5497af=0xc8;}else{_0x5497af=0xce;}_0x414bde[_0xec5d('0x19')](_0x5497af);return _0x414bde[_0xec5d('0x1e')](_0xec5d('0x1f'),_0x519a89+'-'+_0x458161+'/'+_0x2a9798)['json'](_0x2fc1a8);}return null;};}function patchUpdates(_0x4f3eb0){return function(_0x3302e4){try{jsonpatch['apply'](_0x3302e4,_0x4f3eb0,!![]);}catch(_0x5c5bb4){return BPromise[_0xec5d('0x20')](_0x5c5bb4);}return _0x3302e4[_0xec5d('0x21')]();};}function saveUpdates(_0xe85803,_0x19029c){return function(_0x160983){if(_0x160983){return _0x160983[_0xec5d('0x22')](_0xe85803)['then'](function(_0x101d41){return _0x101d41;});}return null;};}function removeEntity(_0x33cceb,_0x3afa4d){return function(_0xea9d3c){if(_0xea9d3c){return _0xea9d3c['destroy']()['then'](function(){var _0x6d6814=_0xea9d3c[_0xec5d('0x23')]({'plain':!![]});var _0x4a14d7=_0xec5d('0x24');return db[_0xec5d('0x25')][_0xec5d('0x26')]({'where':{'type':_0x4a14d7,'resourceId':_0x6d6814['id']}})[_0xec5d('0x27')](function(){return _0xea9d3c;});})[_0xec5d('0x27')](function(){_0x33cceb[_0xec5d('0x19')](0xcc)[_0xec5d('0x1a')]();});}};}function handleEntityNotFound(_0x2a6b0a,_0xefdfbb){return function(_0x13cd4c){if(!_0x13cd4c){_0x2a6b0a[_0xec5d('0x18')](0x194);}return _0x13cd4c;};}function handleError(_0xbeee4f,_0x362a10){_0x362a10=_0x362a10||0x1f4;return function(_0x2a6758){logger['error'](_0x2a6758[_0xec5d('0x28')]);if(_0x2a6758['name']){delete _0x2a6758[_0xec5d('0x29')];}_0xbeee4f[_0xec5d('0x19')](_0x362a10)[_0xec5d('0x2a')](_0x2a6758);};}exports[_0xec5d('0x2b')]=function(_0x4eadad,_0x68c7d3){var _0x2fda3b={},_0x19021c={},_0x55bbed={'count':0x0,'rows':[]};var _0x36b157=_[_0xec5d('0x2c')](db[_0xec5d('0x2d')][_0xec5d('0x2e')],function(_0x542965){return{'name':_0x542965[_0xec5d('0x2f')],'type':_0x542965[_0xec5d('0x30')][_0xec5d('0x31')]};});_0x19021c[_0xec5d('0x32')]=_[_0xec5d('0x2c')](_0x36b157,_0xec5d('0x29'));_0x19021c[_0xec5d('0x33')]=_['keys'](_0x4eadad['query']);_0x19021c[_0xec5d('0x34')]=_[_0xec5d('0x35')](_0x19021c[_0xec5d('0x32')],_0x19021c[_0xec5d('0x33')]);_0x2fda3b[_0xec5d('0x36')]=_[_0xec5d('0x35')](_0x19021c[_0xec5d('0x32')],qs[_0xec5d('0x37')](_0x4eadad[_0xec5d('0x33')][_0xec5d('0x37')]));_0x2fda3b['attributes']=_0x2fda3b['attributes'][_0xec5d('0x38')]?_0x2fda3b[_0xec5d('0x36')]:_0x19021c[_0xec5d('0x32')];if(!_0x4eadad[_0xec5d('0x33')][_0xec5d('0x39')]('nolimit')){_0x2fda3b[_0xec5d('0x1d')]=qs[_0xec5d('0x1d')](_0x4eadad[_0xec5d('0x33')][_0xec5d('0x1d')]);_0x2fda3b[_0xec5d('0x3a')]=qs[_0xec5d('0x3a')](_0x4eadad['query'][_0xec5d('0x3a')]);}_0x2fda3b[_0xec5d('0x3b')]=qs['sort'](_0x4eadad[_0xec5d('0x33')]['sort']);_0x2fda3b[_0xec5d('0x3c')]=qs[_0xec5d('0x34')](_[_0xec5d('0x3d')](_0x4eadad['query'],_0x19021c[_0xec5d('0x34')]),_0x36b157);if(_0x4eadad['query']['filter']){_0x2fda3b['where']=_['merge'](_0x2fda3b[_0xec5d('0x3c')],{'$or':_[_0xec5d('0x2c')](_0x36b157,function(_0x120f4d){if(_0x120f4d[_0xec5d('0x30')]!==_0xec5d('0x3e')){var _0x133579={};_0x133579[_0x120f4d[_0xec5d('0x29')]]={'$like':'%'+_0x4eadad[_0xec5d('0x33')][_0xec5d('0x3f')]+'%'};return _0x133579;}})});}_0x2fda3b=_[_0xec5d('0x40')]({},_0x2fda3b,_0x4eadad[_0xec5d('0x41')]);var _0x562f7e={'where':_0x2fda3b[_0xec5d('0x3c')]};return db[_0xec5d('0x2d')][_0xec5d('0x42')](_0x562f7e)[_0xec5d('0x27')](function(_0x22f040){_0x55bbed[_0xec5d('0x42')]=_0x22f040;if(_0x4eadad[_0xec5d('0x33')][_0xec5d('0x43')]){_0x2fda3b[_0xec5d('0x44')]=[{'all':!![]}];}return db[_0xec5d('0x2d')][_0xec5d('0x45')](_0x2fda3b);})[_0xec5d('0x27')](function(_0x46802b){_0x55bbed[_0xec5d('0x46')]=_0x46802b;return _0x55bbed;})[_0xec5d('0x27')](respondWithFilteredResult(_0x68c7d3,_0x2fda3b))[_0xec5d('0x47')](handleError(_0x68c7d3,null));};exports[_0xec5d('0x48')]=function(_0x2d8b6b,_0x5cd388){var _0x4e3181={'raw':!![],'where':{'id':_0x2d8b6b[_0xec5d('0x49')]['id']}},_0xadb6cb={};_0xadb6cb[_0xec5d('0x32')]=_[_0xec5d('0x4a')](db[_0xec5d('0x2d')][_0xec5d('0x2e')]);_0xadb6cb[_0xec5d('0x33')]=_[_0xec5d('0x4a')](_0x2d8b6b['query']);_0xadb6cb[_0xec5d('0x34')]=_[_0xec5d('0x35')](_0xadb6cb[_0xec5d('0x32')],_0xadb6cb[_0xec5d('0x33')]);_0x4e3181[_0xec5d('0x36')]=_[_0xec5d('0x35')](_0xadb6cb[_0xec5d('0x32')],qs[_0xec5d('0x37')](_0x2d8b6b[_0xec5d('0x33')][_0xec5d('0x37')]));_0x4e3181['attributes']=_0x4e3181[_0xec5d('0x36')][_0xec5d('0x38')]?_0x4e3181['attributes']:_0xadb6cb[_0xec5d('0x32')];if(_0x2d8b6b[_0xec5d('0x33')][_0xec5d('0x43')]){_0x4e3181[_0xec5d('0x44')]=[{'all':!![]}];}_0x4e3181=_[_0xec5d('0x40')]({},_0x4e3181,_0x2d8b6b['options']);return db[_0xec5d('0x2d')][_0xec5d('0x4b')](_0x4e3181)[_0xec5d('0x27')](handleEntityNotFound(_0x5cd388,null))[_0xec5d('0x27')](respondWithResult(_0x5cd388,null))['catch'](handleError(_0x5cd388,null));};exports[_0xec5d('0x4c')]=function(_0x287c35,_0x335b8){return db[_0xec5d('0x2d')][_0xec5d('0x4c')](_0x287c35[_0xec5d('0x4d')],{})['then'](function(_0xf87c53){var _0x247437=_0x287c35['user']['get']({'plain':!![]});if(!_0x247437)throw new Error(_0xec5d('0x4e'));if(_0x247437[_0xec5d('0x4f')]==='user'){var _0x2a04fe=_0xf87c53[_0xec5d('0x23')]({'plain':!![]});var _0x111f41=_0xec5d('0x24');return db['UserProfileSection'][_0xec5d('0x4b')]({'where':{'name':_0x111f41,'userProfileId':_0x247437[_0xec5d('0x50')]},'raw':!![]})['then'](function(_0x61f990){if(_0x61f990&&_0x61f990[_0xec5d('0x51')]===0x0){return db['UserProfileResource'][_0xec5d('0x4c')]({'name':_0x2a04fe[_0xec5d('0x29')],'resourceId':_0x2a04fe['id'],'type':_0x61f990[_0xec5d('0x29')],'sectionId':_0x61f990['id']},{})['then'](function(){return _0xf87c53;});}else{return _0xf87c53;}})['catch'](function(_0xecb3bd){logger[_0xec5d('0x52')](_0xec5d('0x53'),_0xecb3bd);throw _0xecb3bd;});}return _0xf87c53;})['then'](respondWithResult(_0x335b8,0xc9))[_0xec5d('0x47')](handleError(_0x335b8,null));};exports[_0xec5d('0x22')]=function(_0x438879,_0x207e81){if(_0x438879[_0xec5d('0x4d')]['id']){delete _0x438879[_0xec5d('0x4d')]['id'];}return db[_0xec5d('0x2d')][_0xec5d('0x4b')]({'where':{'id':_0x438879[_0xec5d('0x49')]['id']}})[_0xec5d('0x27')](handleEntityNotFound(_0x207e81,null))['then'](saveUpdates(_0x438879['body'],null))['then'](respondWithResult(_0x207e81,null))['catch'](handleError(_0x207e81,null));};exports[_0xec5d('0x26')]=function(_0x5e1a30,_0x17f870){return db[_0xec5d('0x2d')][_0xec5d('0x4b')]({'where':{'id':_0x5e1a30[_0xec5d('0x49')]['id']}})[_0xec5d('0x27')](handleEntityNotFound(_0x17f870,null))[_0xec5d('0x27')](removeEntity(_0x17f870,null))[_0xec5d('0x47')](handleError(_0x17f870,null));}; \ No newline at end of file +var _0x8e76=['UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','limit','count','Content-Range','apply','reject','save','then','destroy','get','Variables','UserProfileResource','end','error','stack','name','send','index','map','rawAttributes','type','key','model','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','merge','VIRTUAL','options','Variable','includeAll','rows','catch','show','keys','find','create','body','user','role'];(function(_0x3510bf,_0x5479bc){var _0xd187b9=function(_0x3ebc15){while(--_0x3ebc15){_0x3510bf['push'](_0x3510bf['shift']());}};_0xd187b9(++_0x5479bc);}(_0x8e76,0xb3));var _0x68e7=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0x8e76[_0x2b4411];return _0x8e41ef;};'use strict';var emlformat=require(_0x68e7('0x0'));var rimraf=require(_0x68e7('0x1'));var zipdir=require(_0x68e7('0x2'));var jsonpatch=require(_0x68e7('0x3'));var rp=require(_0x68e7('0x4'));var moment=require(_0x68e7('0x5'));var BPromise=require(_0x68e7('0x6'));var Mustache=require(_0x68e7('0x7'));var util=require(_0x68e7('0x8'));var path=require(_0x68e7('0x9'));var sox=require(_0x68e7('0xa'));var csv=require(_0x68e7('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x68e7('0xc'));var _=require('lodash');var squel=require(_0x68e7('0xd'));var crypto=require(_0x68e7('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x68e7('0xf'));var toCsv=require(_0x68e7('0xb'));var querystring=require(_0x68e7('0x10'));var Papa=require(_0x68e7('0x11'));var Redis=require(_0x68e7('0x12'));var authService=require(_0x68e7('0x13'));var qs=require(_0x68e7('0x14'));var as=require(_0x68e7('0x15'));var hardwareService=require(_0x68e7('0x16'));var logger=require(_0x68e7('0x17'))(_0x68e7('0x18'));var utils=require(_0x68e7('0x19'));var config=require(_0x68e7('0x1a'));var licenseUtil=require(_0x68e7('0x1b'));var db=require(_0x68e7('0x1c'))['db'];function respondWithStatusCode(_0x5b3140,_0x43c018){_0x43c018=_0x43c018||0xcc;return function(_0x25ffc9){if(_0x25ffc9){return _0x5b3140[_0x68e7('0x1d')](_0x43c018);}return _0x5b3140[_0x68e7('0x1e')](_0x43c018)['end']();};}function respondWithResult(_0x527e8b,_0x45fd14){_0x45fd14=_0x45fd14||0xc8;return function(_0x3f44fe){if(_0x3f44fe){return _0x527e8b[_0x68e7('0x1e')](_0x45fd14)[_0x68e7('0x1f')](_0x3f44fe);}};}function respondWithFilteredResult(_0x319f81,_0x5dc1c7){return function(_0x1c638b){if(_0x1c638b){var _0x14d406=typeof _0x5dc1c7[_0x68e7('0x20')]==='undefined'&&typeof _0x5dc1c7[_0x68e7('0x21')]==='undefined';var _0xceff03=_0x1c638b[_0x68e7('0x22')];var _0x4981af=_0x14d406?0x0:_0x5dc1c7[_0x68e7('0x20')];var _0x443f9e=_0x14d406?_0x1c638b['count']:_0x5dc1c7[_0x68e7('0x20')]+_0x5dc1c7['limit'];var _0x2797b3;if(_0x443f9e>=_0xceff03){_0x443f9e=_0xceff03;_0x2797b3=0xc8;}else{_0x2797b3=0xce;}_0x319f81[_0x68e7('0x1e')](_0x2797b3);return _0x319f81['set'](_0x68e7('0x23'),_0x4981af+'-'+_0x443f9e+'/'+_0xceff03)['json'](_0x1c638b);}return null;};}function patchUpdates(_0x498cd9){return function(_0x5c0e11){try{jsonpatch[_0x68e7('0x24')](_0x5c0e11,_0x498cd9,!![]);}catch(_0x48e508){return BPromise[_0x68e7('0x25')](_0x48e508);}return _0x5c0e11[_0x68e7('0x26')]();};}function saveUpdates(_0x5eb4ea,_0x2c2a65){return function(_0x4cea6d){if(_0x4cea6d){return _0x4cea6d['update'](_0x5eb4ea)[_0x68e7('0x27')](function(_0x2f168c){return _0x2f168c;});}return null;};}function removeEntity(_0x3e3917,_0x3e9438){return function(_0x5e3be4){if(_0x5e3be4){return _0x5e3be4[_0x68e7('0x28')]()[_0x68e7('0x27')](function(){var _0x419703=_0x5e3be4[_0x68e7('0x29')]({'plain':!![]});var _0x4517f2=_0x68e7('0x2a');return db[_0x68e7('0x2b')][_0x68e7('0x28')]({'where':{'type':_0x4517f2,'resourceId':_0x419703['id']}})['then'](function(){return _0x5e3be4;});})[_0x68e7('0x27')](function(){_0x3e3917[_0x68e7('0x1e')](0xcc)[_0x68e7('0x2c')]();});}};}function handleEntityNotFound(_0xcc68c7,_0x46c030){return function(_0x1eacd5){if(!_0x1eacd5){_0xcc68c7['sendStatus'](0x194);}return _0x1eacd5;};}function handleError(_0x8c481,_0x125d1a){_0x125d1a=_0x125d1a||0x1f4;return function(_0x5da5e9){logger[_0x68e7('0x2d')](_0x5da5e9[_0x68e7('0x2e')]);if(_0x5da5e9[_0x68e7('0x2f')]){delete _0x5da5e9['name'];}_0x8c481[_0x68e7('0x1e')](_0x125d1a)[_0x68e7('0x30')](_0x5da5e9);};}exports[_0x68e7('0x31')]=function(_0x2bd359,_0x2566a9){var _0x317b20={},_0x1c99f7={},_0x22b7ec={'count':0x0,'rows':[]};var _0x338aca=_[_0x68e7('0x32')](db['Variable'][_0x68e7('0x33')],function(_0x46c419){return{'name':_0x46c419['fieldName'],'type':_0x46c419[_0x68e7('0x34')][_0x68e7('0x35')]};});_0x1c99f7[_0x68e7('0x36')]=_[_0x68e7('0x32')](_0x338aca,'name');_0x1c99f7['query']=_['keys'](_0x2bd359['query']);_0x1c99f7['filters']=_[_0x68e7('0x37')](_0x1c99f7[_0x68e7('0x36')],_0x1c99f7[_0x68e7('0x38')]);_0x317b20[_0x68e7('0x39')]=_[_0x68e7('0x37')](_0x1c99f7[_0x68e7('0x36')],qs[_0x68e7('0x3a')](_0x2bd359[_0x68e7('0x38')]['fields']));_0x317b20[_0x68e7('0x39')]=_0x317b20[_0x68e7('0x39')][_0x68e7('0x3b')]?_0x317b20['attributes']:_0x1c99f7[_0x68e7('0x36')];if(!_0x2bd359[_0x68e7('0x38')][_0x68e7('0x3c')](_0x68e7('0x3d'))){_0x317b20[_0x68e7('0x21')]=qs[_0x68e7('0x21')](_0x2bd359['query'][_0x68e7('0x21')]);_0x317b20[_0x68e7('0x20')]=qs[_0x68e7('0x20')](_0x2bd359[_0x68e7('0x38')][_0x68e7('0x20')]);}_0x317b20[_0x68e7('0x3e')]=qs['sort'](_0x2bd359[_0x68e7('0x38')][_0x68e7('0x3f')]);_0x317b20[_0x68e7('0x40')]=qs['filters'](_[_0x68e7('0x41')](_0x2bd359[_0x68e7('0x38')],_0x1c99f7[_0x68e7('0x42')]),_0x338aca);if(_0x2bd359[_0x68e7('0x38')][_0x68e7('0x43')]){_0x317b20['where']=_[_0x68e7('0x44')](_0x317b20[_0x68e7('0x40')],{'$or':_[_0x68e7('0x32')](_0x338aca,function(_0x3fdf1e){if(_0x3fdf1e[_0x68e7('0x34')]!==_0x68e7('0x45')){var _0x24e58f={};_0x24e58f[_0x3fdf1e[_0x68e7('0x2f')]]={'$like':'%'+_0x2bd359[_0x68e7('0x38')][_0x68e7('0x43')]+'%'};return _0x24e58f;}})});}_0x317b20=_[_0x68e7('0x44')]({},_0x317b20,_0x2bd359[_0x68e7('0x46')]);var _0x2f4dfd={'where':_0x317b20['where']};return db[_0x68e7('0x47')][_0x68e7('0x22')](_0x2f4dfd)[_0x68e7('0x27')](function(_0x5e8ccb){_0x22b7ec[_0x68e7('0x22')]=_0x5e8ccb;if(_0x2bd359[_0x68e7('0x38')][_0x68e7('0x48')]){_0x317b20['include']=[{'all':!![]}];}return db['Variable']['findAll'](_0x317b20);})[_0x68e7('0x27')](function(_0x4a729e){_0x22b7ec[_0x68e7('0x49')]=_0x4a729e;return _0x22b7ec;})[_0x68e7('0x27')](respondWithFilteredResult(_0x2566a9,_0x317b20))[_0x68e7('0x4a')](handleError(_0x2566a9,null));};exports[_0x68e7('0x4b')]=function(_0x5e47f8,_0x5df2ae){var _0x2ee0ed={'raw':!![],'where':{'id':_0x5e47f8['params']['id']}},_0x4cb47f={};_0x4cb47f['model']=_[_0x68e7('0x4c')](db[_0x68e7('0x47')]['rawAttributes']);_0x4cb47f[_0x68e7('0x38')]=_[_0x68e7('0x4c')](_0x5e47f8[_0x68e7('0x38')]);_0x4cb47f[_0x68e7('0x42')]=_['intersection'](_0x4cb47f[_0x68e7('0x36')],_0x4cb47f['query']);_0x2ee0ed['attributes']=_[_0x68e7('0x37')](_0x4cb47f[_0x68e7('0x36')],qs[_0x68e7('0x3a')](_0x5e47f8['query'][_0x68e7('0x3a')]));_0x2ee0ed['attributes']=_0x2ee0ed[_0x68e7('0x39')][_0x68e7('0x3b')]?_0x2ee0ed['attributes']:_0x4cb47f[_0x68e7('0x36')];if(_0x5e47f8[_0x68e7('0x38')][_0x68e7('0x48')]){_0x2ee0ed['include']=[{'all':!![]}];}_0x2ee0ed=_['merge']({},_0x2ee0ed,_0x5e47f8['options']);return db[_0x68e7('0x47')][_0x68e7('0x4d')](_0x2ee0ed)[_0x68e7('0x27')](handleEntityNotFound(_0x5df2ae,null))['then'](respondWithResult(_0x5df2ae,null))['catch'](handleError(_0x5df2ae,null));};exports[_0x68e7('0x4e')]=function(_0x18cf66,_0x4c00aa){return db['Variable'][_0x68e7('0x4e')](_0x18cf66[_0x68e7('0x4f')],{})[_0x68e7('0x27')](function(_0x5377e4){var _0x49a213=_0x18cf66[_0x68e7('0x50')][_0x68e7('0x29')]({'plain':!![]});if(!_0x49a213)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x49a213[_0x68e7('0x51')]===_0x68e7('0x50')){var _0x4d5a9f=_0x5377e4['get']({'plain':!![]});var _0x528f2c='Variables';return db[_0x68e7('0x52')][_0x68e7('0x4d')]({'where':{'name':_0x528f2c,'userProfileId':_0x49a213[_0x68e7('0x53')]},'raw':!![]})[_0x68e7('0x27')](function(_0x4d82e1){if(_0x4d82e1&&_0x4d82e1['autoAssociation']===0x0){return db[_0x68e7('0x2b')][_0x68e7('0x4e')]({'name':_0x4d5a9f[_0x68e7('0x2f')],'resourceId':_0x4d5a9f['id'],'type':_0x4d82e1[_0x68e7('0x2f')],'sectionId':_0x4d82e1['id']},{})[_0x68e7('0x27')](function(){return _0x5377e4;});}else{return _0x5377e4;}})[_0x68e7('0x4a')](function(_0x3f8876){logger[_0x68e7('0x2d')](_0x68e7('0x54'),_0x3f8876);throw _0x3f8876;});}return _0x5377e4;})['then'](respondWithResult(_0x4c00aa,0xc9))[_0x68e7('0x4a')](handleError(_0x4c00aa,null));};exports[_0x68e7('0x55')]=function(_0x2c0ab3,_0x869fbb){if(_0x2c0ab3['body']['id']){delete _0x2c0ab3[_0x68e7('0x4f')]['id'];}return db[_0x68e7('0x47')]['find']({'where':{'id':_0x2c0ab3[_0x68e7('0x56')]['id']}})[_0x68e7('0x27')](handleEntityNotFound(_0x869fbb,null))[_0x68e7('0x27')](saveUpdates(_0x2c0ab3['body'],null))[_0x68e7('0x27')](respondWithResult(_0x869fbb,null))['catch'](handleError(_0x869fbb,null));};exports[_0x68e7('0x28')]=function(_0x21b739,_0x2f0037){return db[_0x68e7('0x47')][_0x68e7('0x4d')]({'where':{'id':_0x21b739[_0x68e7('0x56')]['id']}})[_0x68e7('0x27')](handleEntityNotFound(_0x2f0037,null))[_0x68e7('0x27')](removeEntity(_0x2f0037,null))[_0x68e7('0x4a')](handleError(_0x2f0037,null));}; \ No newline at end of file diff --git a/server/api/variable/variable.model.js b/server/api/variable/variable.model.js index a165609..eee5ea2 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 _0x925c=['tools_variables','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./variable.attributes','define','Variable'];(function(_0x34bd34,_0x1444f7){var _0x4e36d6=function(_0x20ed8e){while(--_0x20ed8e){_0x34bd34['push'](_0x34bd34['shift']());}};_0x4e36d6(++_0x1444f7);}(_0x925c,0xf8));var _0xc925=function(_0x2b7f51,_0x11ce49){_0x2b7f51=_0x2b7f51-0x0;var _0x1a0fba=_0x925c[_0x2b7f51];return _0x1a0fba;};'use strict';var _=require(_0xc925('0x0'));var util=require('util');var logger=require(_0xc925('0x1'))(_0xc925('0x2'));var moment=require(_0xc925('0x3'));var BPromise=require(_0xc925('0x4'));var rp=require(_0xc925('0x5'));var fs=require('fs');var path=require(_0xc925('0x6'));var rimraf=require(_0xc925('0x7'));var config=require(_0xc925('0x8'));var attributes=require(_0xc925('0x9'));module['exports']=function(_0x4bd7b4,_0x35e8c6){return _0x4bd7b4[_0xc925('0xa')](_0xc925('0xb'),attributes,{'tableName':_0xc925('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x55fe=['util','../../config/logger','api','moment','bluebird','request-promise','path','./variable.attributes','exports','Variable'];(function(_0x4e074e,_0x35a42e){var _0x1fb96a=function(_0x432263){while(--_0x432263){_0x4e074e['push'](_0x4e074e['shift']());}};_0x1fb96a(++_0x35a42e);}(_0x55fe,0x1cc));var _0xe55f=function(_0x2ea457,_0x25db24){_0x2ea457=_0x2ea457-0x0;var _0x2773f7=_0x55fe[_0x2ea457];return _0x2773f7;};'use strict';var _=require('lodash');var util=require(_0xe55f('0x0'));var logger=require(_0xe55f('0x1'))(_0xe55f('0x2'));var moment=require(_0xe55f('0x3'));var BPromise=require(_0xe55f('0x4'));var rp=require(_0xe55f('0x5'));var fs=require('fs');var path=require(_0xe55f('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xe55f('0x7'));module[_0xe55f('0x8')]=function(_0x553865,_0x41ac73){return _0x553865['define'](_0xe55f('0x9'),attributes,{'tableName':'tools_variables','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/variable/variable.rpc.js b/server/api/variable/variable.rpc.js index b28f6c3..97fece9 100644 --- a/server/api/variable/variable.rpc.js +++ b/server/api/variable/variable.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8ef6=['result','catch','Variable','find','options','raw','include','model','attributes','map','ShowVariable','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','Variable,\x20%s,\x20%s','request\x20sent','debug','Variable,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x423dd4,_0x287532){var _0xb29406=function(_0x577c6f){while(--_0x577c6f){_0x423dd4['push'](_0x423dd4['shift']());}};_0xb29406(++_0x287532);}(_0x8ef6,0xf2));var _0x68ef=function(_0x9016d8,_0x2b8d7b){_0x9016d8=_0x9016d8-0x0;var _0x106999=_0x8ef6[_0x9016d8];return _0x106999;};'use strict';var _=require(_0x68ef('0x0'));var util=require(_0x68ef('0x1'));var moment=require(_0x68ef('0x2'));var BPromise=require(_0x68ef('0x3'));var rs=require(_0x68ef('0x4'));var fs=require('fs');var Redis=require(_0x68ef('0x5'));var db=require(_0x68ef('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x68ef('0x7'))(_0x68ef('0x8'));var config=require(_0x68ef('0x9'));var jayson=require(_0x68ef('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3c2ff3,_0x4740e8,_0x2de776){return new BPromise(function(_0x4eb5eb,_0x228967){return client[_0x68ef('0xb')](_0x3c2ff3,_0x2de776)[_0x68ef('0xc')](function(_0x22ae26){logger[_0x68ef('0xd')](_0x68ef('0xe'),_0x4740e8,_0x68ef('0xf'));logger[_0x68ef('0x10')](_0x68ef('0x11'),_0x4740e8,_0x68ef('0xf'),JSON[_0x68ef('0x12')](_0x22ae26));if(_0x22ae26[_0x68ef('0x13')]){if(_0x22ae26['error'][_0x68ef('0x14')]===0x1f4){logger[_0x68ef('0x13')](_0x68ef('0xe'),_0x4740e8,_0x22ae26[_0x68ef('0x13')][_0x68ef('0x15')]);return _0x228967(_0x22ae26[_0x68ef('0x13')]['message']);}logger[_0x68ef('0x13')](_0x68ef('0xe'),_0x4740e8,_0x22ae26[_0x68ef('0x13')]['message']);return _0x4eb5eb(_0x22ae26[_0x68ef('0x13')][_0x68ef('0x15')]);}else{logger[_0x68ef('0xd')]('Variable,\x20%s,\x20%s',_0x4740e8,_0x68ef('0xf'));_0x4eb5eb(_0x22ae26[_0x68ef('0x16')][_0x68ef('0x15')]);}})[_0x68ef('0x17')](function(_0x5c4456){logger[_0x68ef('0x13')]('Variable,\x20%s,\x20%s',_0x4740e8,_0x5c4456);_0x228967(_0x5c4456);});});}exports['ShowVariable']=function(_0x2633c1){var _0x404870=this;return new Promise(function(_0x4ade0d,_0x527870){return db[_0x68ef('0x18')][_0x68ef('0x19')]({'raw':_0x2633c1[_0x68ef('0x1a')]?_0x2633c1['options'][_0x68ef('0x1b')]===undefined?!![]:![]:!![],'where':_0x2633c1[_0x68ef('0x1a')]?_0x2633c1[_0x68ef('0x1a')]['where']||null:null,'attributes':_0x2633c1[_0x68ef('0x1a')]?_0x2633c1[_0x68ef('0x1a')]['attributes']||null:null,'include':_0x2633c1[_0x68ef('0x1a')]?_0x2633c1[_0x68ef('0x1a')][_0x68ef('0x1c')]?_['map'](_0x2633c1['options']['include'],function(_0x26018d){return{'model':db[_0x26018d[_0x68ef('0x1d')]],'as':_0x26018d['as'],'attributes':_0x26018d[_0x68ef('0x1e')],'include':_0x26018d[_0x68ef('0x1c')]?_[_0x68ef('0x1f')](_0x26018d[_0x68ef('0x1c')],function(_0x258cd5){return{'model':db[_0x258cd5[_0x68ef('0x1d')]],'as':_0x258cd5['as'],'attributes':_0x258cd5[_0x68ef('0x1e')],'include':_0x258cd5[_0x68ef('0x1c')]?_['map'](_0x258cd5[_0x68ef('0x1c')],function(_0x57f9ee){return{'model':db[_0x57f9ee['model']],'as':_0x57f9ee['as'],'attributes':_0x57f9ee['attributes']};}):[]};}):[]};}):[]:[]})[_0x68ef('0xc')](function(_0x268f32){logger[_0x68ef('0xd')](_0x68ef('0x20'),_0x2633c1);logger['debug']('ShowVariable',_0x2633c1,JSON[_0x68ef('0x12')](_0x268f32));_0x4ade0d(_0x268f32);})[_0x68ef('0x17')](function(_0x7bf96){logger[_0x68ef('0x13')](_0x68ef('0x20'),_0x7bf96[_0x68ef('0x15')],_0x2633c1);_0x527870(_0x404870[_0x68ef('0x13')](0x1f4,_0x7bf96[_0x68ef('0x15')]));});});}; \ No newline at end of file +var _0x8ef6=['result','catch','Variable','find','options','raw','include','model','attributes','map','ShowVariable','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','Variable,\x20%s,\x20%s','request\x20sent','debug','Variable,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x45096e,_0x17e82d){var _0xba1fa3=function(_0x29f43c){while(--_0x29f43c){_0x45096e['push'](_0x45096e['shift']());}};_0xba1fa3(++_0x17e82d);}(_0x8ef6,0xf2));var _0x68ef=function(_0x3c25d7,_0x6a5119){_0x3c25d7=_0x3c25d7-0x0;var _0x4e323b=_0x8ef6[_0x3c25d7];return _0x4e323b;};'use strict';var _=require(_0x68ef('0x0'));var util=require(_0x68ef('0x1'));var moment=require(_0x68ef('0x2'));var BPromise=require(_0x68ef('0x3'));var rs=require(_0x68ef('0x4'));var fs=require('fs');var Redis=require(_0x68ef('0x5'));var db=require(_0x68ef('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x68ef('0x7'))(_0x68ef('0x8'));var config=require(_0x68ef('0x9'));var jayson=require(_0x68ef('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3c2ff3,_0x4740e8,_0x2de776){return new BPromise(function(_0x4eb5eb,_0x228967){return client[_0x68ef('0xb')](_0x3c2ff3,_0x2de776)[_0x68ef('0xc')](function(_0x22ae26){logger[_0x68ef('0xd')](_0x68ef('0xe'),_0x4740e8,_0x68ef('0xf'));logger[_0x68ef('0x10')](_0x68ef('0x11'),_0x4740e8,_0x68ef('0xf'),JSON[_0x68ef('0x12')](_0x22ae26));if(_0x22ae26[_0x68ef('0x13')]){if(_0x22ae26['error'][_0x68ef('0x14')]===0x1f4){logger[_0x68ef('0x13')](_0x68ef('0xe'),_0x4740e8,_0x22ae26[_0x68ef('0x13')][_0x68ef('0x15')]);return _0x228967(_0x22ae26[_0x68ef('0x13')]['message']);}logger[_0x68ef('0x13')](_0x68ef('0xe'),_0x4740e8,_0x22ae26[_0x68ef('0x13')]['message']);return _0x4eb5eb(_0x22ae26[_0x68ef('0x13')][_0x68ef('0x15')]);}else{logger[_0x68ef('0xd')]('Variable,\x20%s,\x20%s',_0x4740e8,_0x68ef('0xf'));_0x4eb5eb(_0x22ae26[_0x68ef('0x16')][_0x68ef('0x15')]);}})[_0x68ef('0x17')](function(_0x5c4456){logger[_0x68ef('0x13')]('Variable,\x20%s,\x20%s',_0x4740e8,_0x5c4456);_0x228967(_0x5c4456);});});}exports['ShowVariable']=function(_0x2633c1){var _0x404870=this;return new Promise(function(_0x4ade0d,_0x527870){return db[_0x68ef('0x18')][_0x68ef('0x19')]({'raw':_0x2633c1[_0x68ef('0x1a')]?_0x2633c1['options'][_0x68ef('0x1b')]===undefined?!![]:![]:!![],'where':_0x2633c1[_0x68ef('0x1a')]?_0x2633c1[_0x68ef('0x1a')]['where']||null:null,'attributes':_0x2633c1[_0x68ef('0x1a')]?_0x2633c1[_0x68ef('0x1a')]['attributes']||null:null,'include':_0x2633c1[_0x68ef('0x1a')]?_0x2633c1[_0x68ef('0x1a')][_0x68ef('0x1c')]?_['map'](_0x2633c1['options']['include'],function(_0x26018d){return{'model':db[_0x26018d[_0x68ef('0x1d')]],'as':_0x26018d['as'],'attributes':_0x26018d[_0x68ef('0x1e')],'include':_0x26018d[_0x68ef('0x1c')]?_[_0x68ef('0x1f')](_0x26018d[_0x68ef('0x1c')],function(_0x258cd5){return{'model':db[_0x258cd5[_0x68ef('0x1d')]],'as':_0x258cd5['as'],'attributes':_0x258cd5[_0x68ef('0x1e')],'include':_0x258cd5[_0x68ef('0x1c')]?_['map'](_0x258cd5[_0x68ef('0x1c')],function(_0x57f9ee){return{'model':db[_0x57f9ee['model']],'as':_0x57f9ee['as'],'attributes':_0x57f9ee['attributes']};}):[]};}):[]};}):[]:[]})[_0x68ef('0xc')](function(_0x268f32){logger[_0x68ef('0xd')](_0x68ef('0x20'),_0x2633c1);logger['debug']('ShowVariable',_0x2633c1,JSON[_0x68ef('0x12')](_0x268f32));_0x4ade0d(_0x268f32);})[_0x68ef('0x17')](function(_0x7bf96){logger[_0x68ef('0x13')](_0x68ef('0x20'),_0x7bf96[_0x68ef('0x15')],_0x2633c1);_0x527870(_0x404870[_0x68ef('0x13')](0x1f4,_0x7bf96[_0x68ef('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/version/index.js b/server/api/version/index.js index 88f0648..1824ee2 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 _0xfefd=['reset','/pull','pull','/restart','restart','/migrations','exports','express','../../components/auth/service','get','index','/fetch','isAuthenticated','canUpdate','fetch','/reset'];(function(_0x2b3b08,_0x1e51ad){var _0x3d0447=function(_0x658935){while(--_0x658935){_0x2b3b08['push'](_0x2b3b08['shift']());}};_0x3d0447(++_0x1e51ad);}(_0xfefd,0x157));var _0xdfef=function(_0x533381,_0x8a69fa){_0x533381=_0x533381-0x0;var _0x2877ed=_0xfefd[_0x533381];return _0x2877ed;};'use strict';var express=require(_0xdfef('0x0'));var router=express['Router']();var auth=require(_0xdfef('0x1'));var controller=require('./version.controller');router[_0xdfef('0x2')]('/',controller[_0xdfef('0x3')]);router[_0xdfef('0x2')](_0xdfef('0x4'),auth[_0xdfef('0x5')](),auth[_0xdfef('0x6')](),controller[_0xdfef('0x7')]);router['get'](_0xdfef('0x8'),auth[_0xdfef('0x5')](),auth[_0xdfef('0x6')](),controller[_0xdfef('0x9')]);router[_0xdfef('0x2')](_0xdfef('0xa'),auth['isAuthenticated'](),auth['canUpdate'](),controller[_0xdfef('0xb')]);router[_0xdfef('0x2')](_0xdfef('0xc'),auth[_0xdfef('0x5')](),controller[_0xdfef('0xd')]);router[_0xdfef('0x2')](_0xdfef('0xe'),controller['migrations']);module[_0xdfef('0xf')]=router; \ No newline at end of file +var _0xe336=['Router','../../components/auth/service','./version.controller','index','get','isAuthenticated','canUpdate','fetch','/reset','/pull','pull','/restart','restart','/migrations','migrations','exports','express'];(function(_0x94b856,_0x1edd2d){var _0xc9e983=function(_0x444f54){while(--_0x444f54){_0x94b856['push'](_0x94b856['shift']());}};_0xc9e983(++_0x1edd2d);}(_0xe336,0x76));var _0x6e33=function(_0x20b9c0,_0x329d22){_0x20b9c0=_0x20b9c0-0x0;var _0x15002d=_0xe336[_0x20b9c0];return _0x15002d;};'use strict';var express=require(_0x6e33('0x0'));var router=express[_0x6e33('0x1')]();var auth=require(_0x6e33('0x2'));var controller=require(_0x6e33('0x3'));router['get']('/',controller[_0x6e33('0x4')]);router[_0x6e33('0x5')]('/fetch',auth[_0x6e33('0x6')](),auth[_0x6e33('0x7')](),controller[_0x6e33('0x8')]);router[_0x6e33('0x5')](_0x6e33('0x9'),auth[_0x6e33('0x6')](),auth['canUpdate'](),controller['reset']);router[_0x6e33('0x5')](_0x6e33('0xa'),auth[_0x6e33('0x6')](),auth[_0x6e33('0x7')](),controller[_0x6e33('0xb')]);router['get'](_0x6e33('0xc'),auth['isAuthenticated'](),controller[_0x6e33('0xd')]);router[_0x6e33('0x5')](_0x6e33('0xe'),controller[_0x6e33('0xf')]);module[_0x6e33('0x10')]=router; \ No newline at end of file diff --git a/server/api/version/version.controller.js b/server/api/version/version.controller.js index 4c2106f..0007916 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 _0x6ac6=['getQueryInterface','Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.','Database\x20migrated\x20successfully\x20from\x20version\x20','\x20to\x20','last','Database\x20already\x20up-to-date','umzug','path','lodash','pkginfo','version','compare-versions','child_process','exec','../../config/environment','../../config/pm2','../../config/logger','update','simple-git','index','exports','query','latest','fetch','tags','2.0.0','status','json','error','info','git\x20fetch','git\x20fetch\x20origin\x20master','reset','--hard','FETCH_HEAD','git\x20reset\x20--hard\x20FETCH_HEAD','git\x20reset\x20--hard','npm\x20install\x20--production','restart','then','Your\x20system\x20has\x20been\x20restart\x20successfully','catch','migrations','readdirSync','join','root','server','replace','.js','length','sequelize','Migration'];(function(_0x83b8e6,_0x3a4b65){var _0x4b6433=function(_0xa4fe13){while(--_0xa4fe13){_0x83b8e6['push'](_0x83b8e6['shift']());}};_0x4b6433(++_0x3a4b65);}(_0x6ac6,0x172));var _0x66ac=function(_0x1e0e3e,_0x7bc6a5){_0x1e0e3e=_0x1e0e3e-0x0;var _0x2a5561=_0x6ac6[_0x1e0e3e];return _0x2a5561;};'use strict';var Umzug=require(_0x66ac('0x0'));var path=require(_0x66ac('0x1'));var fs=require('fs');var _=require(_0x66ac('0x2'));var pkginfo=require(_0x66ac('0x3'))(module,_0x66ac('0x4'));var compareVersions=require(_0x66ac('0x5'));var exec=require(_0x66ac('0x6'))[_0x66ac('0x7')];var db=require('../../mysqldb')['db'];var config=require(_0x66ac('0x8'));var pm2=require(_0x66ac('0x9'));var logger=require(_0x66ac('0xa'))(_0x66ac('0xb'));var git=require(_0x66ac('0xc'))(config['root']);exports[_0x66ac('0xd')]=function(_0x4cd1ba,_0x17ffea){var _0x4ac3bd={'current':module[_0x66ac('0xe')][_0x66ac('0x4')],'phonebar':0x2};if(_0x4cd1ba[_0x66ac('0xf')]&&_0x4cd1ba['query'][_0x66ac('0x10')]){return git[_0x66ac('0x11')]()[_0x66ac('0x12')](function(_0x1750ee,_0x34a961){_0x4ac3bd[_0x66ac('0x10')]=(_0x1750ee?module['exports']['version']:_0x34a961[_0x66ac('0x10')])||_0x66ac('0x13');return _0x17ffea[_0x66ac('0x14')](0xc8)[_0x66ac('0x15')](_0x4ac3bd);});}else{return _0x17ffea['status'](0xc8)[_0x66ac('0x15')](_0x4ac3bd);}};exports['fetch']=function(_0x1b4d85,_0x1c4a88){return git[_0x66ac('0x11')](['origin','master'],function(_0x185eff){if(_0x185eff){logger[_0x66ac('0x16')](_0x185eff);return _0x1c4a88[_0x66ac('0x14')](0x1f4)[_0x66ac('0x15')](_0x185eff);}logger[_0x66ac('0x17')](_0x66ac('0x18'));return _0x1c4a88[_0x66ac('0x14')](0xc8)[_0x66ac('0x15')]({'output':_0x66ac('0x19')});});};exports[_0x66ac('0x1a')]=function(_0x183d63,_0x11b985){return git[_0x66ac('0x1a')]([_0x66ac('0x1b'),_0x66ac('0x1c')],function(_0x5000bd){if(_0x5000bd){logger[_0x66ac('0x16')](_0x5000bd);return _0x11b985[_0x66ac('0x14')](0x1f4)['json'](_0x5000bd);}logger['info'](_0x66ac('0x1d'));return _0x11b985[_0x66ac('0x14')](0xc8)[_0x66ac('0x15')]({'output':_0x66ac('0x1e')});});};exports['pull']=function(_0xac49ec,_0x2db1b3){exec(_0x66ac('0x1f'),function(_0x907503,_0x1a501d,_0x4340ca){logger['info'](_0x1a501d);logger[_0x66ac('0x17')](_0x4340ca);if(_0x907503){logger['error'](_0x907503);return _0x2db1b3[_0x66ac('0x14')](0x1f4)[_0x66ac('0x15')](_0x907503);}return _0x2db1b3[_0x66ac('0x14')](0xc8)[_0x66ac('0x15')]({'output':_0x1a501d});});};exports[_0x66ac('0x20')]=function(_0x433a23,_0x20a9b4){return pm2[_0x66ac('0x20')]('motion2')[_0x66ac('0x21')](function(_0x337e12){logger[_0x66ac('0x17')]('pm2\x20restart\x20motion\x20%s',_0x337e12);return _0x20a9b4['status'](0xc8)['json']({'output':_0x66ac('0x22')});})[_0x66ac('0x23')](function(_0x12d73b){logger[_0x66ac('0x16')](_0x12d73b);return _0x20a9b4[_0x66ac('0x14')](0x1f4)['json'](_0x12d73b);});};exports[_0x66ac('0x24')]=function(_0x358f83,_0x15c71f){var _0x2ade75=fs[_0x66ac('0x25')](path[_0x66ac('0x26')](config[_0x66ac('0x27')],_0x66ac('0x28'),'migrations'));var _0x4c0ef7=[];for(var _0x49c6c1=0x0;_0x49c6c1<_0x2ade75['length'];_0x49c6c1++){var _0x21ffb8=_0x2ade75[_0x49c6c1][_0x66ac('0x29')](_0x66ac('0x2a'),'');if(compareVersions(module[_0x66ac('0xe')][_0x66ac('0x4')],_0x21ffb8)===-0x1){_0x4c0ef7['push'](_0x21ffb8);}}if(_0x4c0ef7[_0x66ac('0x2b')]){var _0x59d777=_0x4c0ef7['sort'](compareVersions);var _0xcbcb4b=new Umzug({'storage':_0x66ac('0x2c'),'storageOptions':{'model':db[_0x66ac('0x2d')],'modelName':_0x66ac('0x2d'),'columnName':'version'},'migrations':{'params':[db['sequelize'][_0x66ac('0x2e')](),db['sequelize']['constructor'],function(){throw new Error(_0x66ac('0x2f'));}],'path':path['join'](config['root'],'server',_0x66ac('0x24')),'pattern':/\.js$/}});_0xcbcb4b['up']({'migrations':_['map'](_0x59d777,function(_0x144b6f){return _0x144b6f+_0x66ac('0x2a');})})[_0x66ac('0x21')](function(){return _0x15c71f[_0x66ac('0x14')](0xc8)[_0x66ac('0x15')]({'output':_0x66ac('0x30')+module[_0x66ac('0xe')][_0x66ac('0x4')]+_0x66ac('0x31')+_[_0x66ac('0x32')](_0x59d777),'migrations':_[_0x66ac('0x26')](_0x59d777)});})[_0x66ac('0x23')](function(_0x4a3547){if(_0x4a3547 instanceof db[_0x66ac('0x2c')]['UniqueConstraintError']){return _0x15c71f[_0x66ac('0x14')](0xc8)['json']({'output':_0x66ac('0x33')});}else{return _0x15c71f['status'](0x1f4)[_0x66ac('0x15')](_0x4a3547);}});}else{return _0x15c71f[_0x66ac('0x14')](0xc8)['json']({'output':_0x66ac('0x33')});}}; \ No newline at end of file +var _0x5cdf=['then','pm2\x20restart\x20motion\x20%s','Your\x20system\x20has\x20been\x20restart\x20successfully','migrations','readdirSync','server','length','replace','.js','push','sort','sequelize','Migration','getQueryInterface','constructor','Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.','join','map','Database\x20migrated\x20successfully\x20from\x20version\x20','\x20to\x20','catch','UniqueConstraintError','Database\x20already\x20up-to-date','umzug','path','lodash','version','compare-versions','exec','../../mysqldb','../../config/environment','../../config/pm2','update','root','index','query','latest','fetch','exports','status','json','origin','error','info','git\x20fetch','git\x20fetch\x20origin\x20master','reset','--hard','FETCH_HEAD','git\x20reset\x20--hard\x20FETCH_HEAD','npm\x20install\x20--production','motion2'];(function(_0x275752,_0x2bb209){var _0x10f0f2=function(_0x393db3){while(--_0x393db3){_0x275752['push'](_0x275752['shift']());}};_0x10f0f2(++_0x2bb209);}(_0x5cdf,0xe7));var _0xf5cd=function(_0x5b6e23,_0x10403d){_0x5b6e23=_0x5b6e23-0x0;var _0x2b1aa5=_0x5cdf[_0x5b6e23];return _0x2b1aa5;};'use strict';var Umzug=require(_0xf5cd('0x0'));var path=require(_0xf5cd('0x1'));var fs=require('fs');var _=require(_0xf5cd('0x2'));var pkginfo=require('pkginfo')(module,_0xf5cd('0x3'));var compareVersions=require(_0xf5cd('0x4'));var exec=require('child_process')[_0xf5cd('0x5')];var db=require(_0xf5cd('0x6'))['db'];var config=require(_0xf5cd('0x7'));var pm2=require(_0xf5cd('0x8'));var logger=require('../../config/logger')(_0xf5cd('0x9'));var git=require('simple-git')(config[_0xf5cd('0xa')]);exports[_0xf5cd('0xb')]=function(_0x3826ab,_0x58d792){var _0x16acbb={'current':module['exports'][_0xf5cd('0x3')],'phonebar':0x2};if(_0x3826ab[_0xf5cd('0xc')]&&_0x3826ab[_0xf5cd('0xc')][_0xf5cd('0xd')]){return git[_0xf5cd('0xe')]()['tags'](function(_0x3ce38f,_0x1b761a){_0x16acbb[_0xf5cd('0xd')]=(_0x3ce38f?module[_0xf5cd('0xf')][_0xf5cd('0x3')]:_0x1b761a['latest'])||'2.0.0';return _0x58d792[_0xf5cd('0x10')](0xc8)['json'](_0x16acbb);});}else{return _0x58d792[_0xf5cd('0x10')](0xc8)[_0xf5cd('0x11')](_0x16acbb);}};exports[_0xf5cd('0xe')]=function(_0x3eb4ad,_0x12797e){return git['fetch']([_0xf5cd('0x12'),'master'],function(_0x55d4e4){if(_0x55d4e4){logger[_0xf5cd('0x13')](_0x55d4e4);return _0x12797e[_0xf5cd('0x10')](0x1f4)[_0xf5cd('0x11')](_0x55d4e4);}logger[_0xf5cd('0x14')](_0xf5cd('0x15'));return _0x12797e['status'](0xc8)[_0xf5cd('0x11')]({'output':_0xf5cd('0x16')});});};exports[_0xf5cd('0x17')]=function(_0x48b578,_0x18ff92){return git['reset']([_0xf5cd('0x18'),_0xf5cd('0x19')],function(_0x59cced){if(_0x59cced){logger['error'](_0x59cced);return _0x18ff92[_0xf5cd('0x10')](0x1f4)[_0xf5cd('0x11')](_0x59cced);}logger['info'](_0xf5cd('0x1a'));return _0x18ff92['status'](0xc8)[_0xf5cd('0x11')]({'output':'git\x20reset\x20--hard'});});};exports['pull']=function(_0x2056bb,_0x2f593d){exec(_0xf5cd('0x1b'),function(_0x2f9587,_0x5ef015,_0x385225){logger['info'](_0x5ef015);logger[_0xf5cd('0x14')](_0x385225);if(_0x2f9587){logger['error'](_0x2f9587);return _0x2f593d[_0xf5cd('0x10')](0x1f4)[_0xf5cd('0x11')](_0x2f9587);}return _0x2f593d[_0xf5cd('0x10')](0xc8)[_0xf5cd('0x11')]({'output':_0x5ef015});});};exports['restart']=function(_0x4fe9bd,_0x297dba){return pm2['restart'](_0xf5cd('0x1c'))[_0xf5cd('0x1d')](function(_0x18c80d){logger[_0xf5cd('0x14')](_0xf5cd('0x1e'),_0x18c80d);return _0x297dba[_0xf5cd('0x10')](0xc8)[_0xf5cd('0x11')]({'output':_0xf5cd('0x1f')});})['catch'](function(_0x287356){logger[_0xf5cd('0x13')](_0x287356);return _0x297dba['status'](0x1f4)[_0xf5cd('0x11')](_0x287356);});};exports[_0xf5cd('0x20')]=function(_0x18a501,_0x3f1d1d){var _0x12fd03=fs[_0xf5cd('0x21')](path['join'](config[_0xf5cd('0xa')],_0xf5cd('0x22'),_0xf5cd('0x20')));var _0x4658e9=[];for(var _0x5b875e=0x0;_0x5b875e<_0x12fd03[_0xf5cd('0x23')];_0x5b875e++){var _0x5a18c4=_0x12fd03[_0x5b875e][_0xf5cd('0x24')](_0xf5cd('0x25'),'');if(compareVersions(module[_0xf5cd('0xf')][_0xf5cd('0x3')],_0x5a18c4)===-0x1){_0x4658e9[_0xf5cd('0x26')](_0x5a18c4);}}if(_0x4658e9[_0xf5cd('0x23')]){var _0x5ad80b=_0x4658e9[_0xf5cd('0x27')](compareVersions);var _0x2a65fe=new Umzug({'storage':_0xf5cd('0x28'),'storageOptions':{'model':db[_0xf5cd('0x29')],'modelName':_0xf5cd('0x29'),'columnName':'version'},'migrations':{'params':[db[_0xf5cd('0x28')][_0xf5cd('0x2a')](),db['sequelize'][_0xf5cd('0x2b')],function(){throw new Error(_0xf5cd('0x2c'));}],'path':path[_0xf5cd('0x2d')](config[_0xf5cd('0xa')],_0xf5cd('0x22'),'migrations'),'pattern':/\.js$/}});_0x2a65fe['up']({'migrations':_[_0xf5cd('0x2e')](_0x5ad80b,function(_0x80169c){return _0x80169c+_0xf5cd('0x25');})})['then'](function(){return _0x3f1d1d[_0xf5cd('0x10')](0xc8)[_0xf5cd('0x11')]({'output':_0xf5cd('0x2f')+module[_0xf5cd('0xf')]['version']+_0xf5cd('0x30')+_['last'](_0x5ad80b),'migrations':_[_0xf5cd('0x2d')](_0x5ad80b)});})[_0xf5cd('0x31')](function(_0x2c2924){if(_0x2c2924 instanceof db[_0xf5cd('0x28')][_0xf5cd('0x32')]){return _0x3f1d1d[_0xf5cd('0x10')](0xc8)[_0xf5cd('0x11')]({'output':_0xf5cd('0x33')});}else{return _0x3f1d1d[_0xf5cd('0x10')](0x1f4)[_0xf5cd('0x11')](_0x2c2924);}});}else{return _0x3f1d1d['status'](0xc8)[_0xf5cd('0x11')]({'output':_0xf5cd('0x33')});}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/index.js b/server/api/voiceAgentReport/index.js index d3d907d..656eee9 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 _0x5d25=['get','isAuthenticated','index','/describe','describe','/:id','show','create','put','update','delete','exports','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment'];(function(_0x2d2b66,_0x4f52b1){var _0x23bdcf=function(_0x48f05a){while(--_0x48f05a){_0x2d2b66['push'](_0x2d2b66['shift']());}};_0x23bdcf(++_0x4f52b1);}(_0x5d25,0x103));var _0x55d2=function(_0x5aad4e,_0x219c65){_0x5aad4e=_0x5aad4e-0x0;var _0x4276c1=_0x5d25[_0x5aad4e];return _0x4276c1;};'use strict';var multer=require('multer');var util=require(_0x55d2('0x0'));var path=require('path');var timeout=require(_0x55d2('0x1'));var express=require(_0x55d2('0x2'));var router=express[_0x55d2('0x3')]();var fs_extra=require(_0x55d2('0x4'));var auth=require(_0x55d2('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x55d2('0x6'));var controller=require('./voiceAgentReport.controller');router[_0x55d2('0x7')]('/',auth[_0x55d2('0x8')](),controller[_0x55d2('0x9')]);router[_0x55d2('0x7')](_0x55d2('0xa'),auth[_0x55d2('0x8')](),controller[_0x55d2('0xb')]);router[_0x55d2('0x7')](_0x55d2('0xc'),auth[_0x55d2('0x8')](),controller[_0x55d2('0xd')]);router['post']('/',auth[_0x55d2('0x8')](),controller[_0x55d2('0xe')]);router[_0x55d2('0xf')]('/:id',auth[_0x55d2('0x8')](),controller[_0x55d2('0x10')]);router[_0x55d2('0x11')]('/:id',auth[_0x55d2('0x8')](),controller['destroy']);module[_0x55d2('0x12')]=router; \ No newline at end of file +var _0x9272=['update','delete','destroy','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','isAuthenticated','describe','/:id','show','post','create','put'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x9272,0x153));var _0x2927=function(_0x529a7c,_0x5c5590){_0x529a7c=_0x529a7c-0x0;var _0x47c344=_0x9272[_0x529a7c];return _0x47c344;};'use strict';var multer=require(_0x2927('0x0'));var util=require(_0x2927('0x1'));var path=require(_0x2927('0x2'));var timeout=require('connect-timeout');var express=require(_0x2927('0x3'));var router=express[_0x2927('0x4')]();var fs_extra=require(_0x2927('0x5'));var auth=require(_0x2927('0x6'));var interaction=require(_0x2927('0x7'));var config=require(_0x2927('0x8'));var controller=require('./voiceAgentReport.controller');router[_0x2927('0x9')]('/',auth['isAuthenticated'](),controller[_0x2927('0xa')]);router[_0x2927('0x9')]('/describe',auth[_0x2927('0xb')](),controller[_0x2927('0xc')]);router[_0x2927('0x9')](_0x2927('0xd'),auth[_0x2927('0xb')](),controller[_0x2927('0xe')]);router[_0x2927('0xf')]('/',auth['isAuthenticated'](),controller[_0x2927('0x10')]);router[_0x2927('0x11')](_0x2927('0xd'),auth['isAuthenticated'](),controller[_0x2927('0x12')]);router[_0x2927('0x13')]('/:id',auth[_0x2927('0xb')](),controller[_0x2927('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.attributes.js b/server/api/voiceAgentReport/voiceAgentReport.attributes.js index 5628c8e..035326c 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 _0x0e56=['sequelize','exports','STRING','DATE','INTEGER','BOOLEAN','FORWARD,\x20BLIND,\x20ATTENDED'];(function(_0x31b62a,_0x4de822){var _0x3f68d2=function(_0x57e1a6){while(--_0x57e1a6){_0x31b62a['push'](_0x31b62a['shift']());}};_0x3f68d2(++_0x4de822);}(_0x0e56,0xf5));var _0x60e5=function(_0x2867d8,_0xef3ee0){_0x2867d8=_0x2867d8-0x0;var _0x3b8176=_0x0e56[_0x2867d8];return _0x3b8176;};'use strict';var Sequelize=require(_0x60e5('0x0'));module[_0x60e5('0x1')]={'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x60e5('0x2')]},'calleridnum':{'type':Sequelize[_0x60e5('0x2')]},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x60e5('0x2')]},'interface':{'type':Sequelize[_0x60e5('0x2')]},'membername':{'type':Sequelize[_0x60e5('0x2')]},'agentcalledAt':{'type':Sequelize[_0x60e5('0x3')]},'agentconnectAt':{'type':Sequelize[_0x60e5('0x3')]},'agentcompleteAt':{'type':Sequelize[_0x60e5('0x3')]},'agentringnoanswerAt':{'type':Sequelize[_0x60e5('0x3')]},'agentdumpAt':{'type':Sequelize['DATE']},'holdtime':{'type':Sequelize[_0x60e5('0x4')]},'agentcomplete':{'type':Sequelize[_0x60e5('0x5')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0x60e5('0x5')],'defaultValue':![]},'agentdump':{'type':Sequelize[_0x60e5('0x5')],'defaultValue':![]},'talktime':{'type':Sequelize['INTEGER']},'agentacw':{'type':Sequelize[_0x60e5('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x60e5('0x4')]},'reason':{'type':Sequelize[_0x60e5('0x2')]},'lastevent':{'type':Sequelize[_0x60e5('0x2')]},'channel':{'type':Sequelize[_0x60e5('0x2')]},'channelstate':{'type':Sequelize[_0x60e5('0x4')]},'channelstatedesc':{'type':Sequelize[_0x60e5('0x2')]},'connectedlinenum':{'type':Sequelize[_0x60e5('0x2')]},'connectedlinename':{'type':Sequelize[_0x60e5('0x2')]},'language':{'type':Sequelize[_0x60e5('0x2')]},'accountcode':{'type':Sequelize[_0x60e5('0x2')]},'context':{'type':Sequelize[_0x60e5('0x2')]},'exten':{'type':Sequelize[_0x60e5('0x2')]},'priority':{'type':Sequelize[_0x60e5('0x2')]},'destchannel':{'type':Sequelize[_0x60e5('0x2')]},'destchannelstate':{'type':Sequelize[_0x60e5('0x4')]},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize[_0x60e5('0x2')]},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize['STRING']},'destconnectedlinename':{'type':Sequelize[_0x60e5('0x2')]},'destlanguage':{'type':Sequelize[_0x60e5('0x2')]},'destaccountcode':{'type':Sequelize['STRING']},'destcontext':{'type':Sequelize[_0x60e5('0x2')]},'destexten':{'type':Sequelize[_0x60e5('0x2')]},'destpriority':{'type':Sequelize[_0x60e5('0x2')]},'destuniqueid':{'type':Sequelize[_0x60e5('0x2')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize['STRING']},'answeredelsewheremembername':{'type':Sequelize[_0x60e5('0x2')]},'transfer':{'type':Sequelize[_0x60e5('0x5')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x60e5('0x2')],'comment':_0x60e5('0x6')},'transferexten':{'type':Sequelize[_0x60e5('0x2')]},'transferuniqueid':{'type':Sequelize[_0x60e5('0x2')]},'agententerreason':{'type':Sequelize[_0x60e5('0x4')],'defaultValue':0x0}}; \ No newline at end of file +var _0x282b=['STRING','DATE','INTEGER','BOOLEAN','FORWARD,\x20BLIND,\x20ATTENDED','sequelize','exports'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x282b,0xec));var _0xb282=function(_0x4d0720,_0x550697){_0x4d0720=_0x4d0720-0x0;var _0x25b27c=_0x282b[_0x4d0720];return _0x25b27c;};'use strict';var Sequelize=require(_0xb282('0x0'));module[_0xb282('0x1')]={'type':{'type':Sequelize[_0xb282('0x2')]},'uniqueid':{'type':Sequelize[_0xb282('0x2')]},'calleridnum':{'type':Sequelize[_0xb282('0x2')]},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize['STRING']},'interface':{'type':Sequelize[_0xb282('0x2')]},'membername':{'type':Sequelize['STRING']},'agentcalledAt':{'type':Sequelize[_0xb282('0x3')]},'agentconnectAt':{'type':Sequelize[_0xb282('0x3')]},'agentcompleteAt':{'type':Sequelize[_0xb282('0x3')]},'agentringnoanswerAt':{'type':Sequelize[_0xb282('0x3')]},'agentdumpAt':{'type':Sequelize[_0xb282('0x3')]},'holdtime':{'type':Sequelize[_0xb282('0x4')]},'agentcomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentdump':{'type':Sequelize[_0xb282('0x5')],'defaultValue':![]},'talktime':{'type':Sequelize[_0xb282('0x4')]},'agentacw':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'acwtime':{'type':Sequelize[_0xb282('0x4')]},'reason':{'type':Sequelize[_0xb282('0x2')]},'lastevent':{'type':Sequelize[_0xb282('0x2')]},'channel':{'type':Sequelize[_0xb282('0x2')]},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0xb282('0x2')]},'connectedlinename':{'type':Sequelize[_0xb282('0x2')]},'language':{'type':Sequelize[_0xb282('0x2')]},'accountcode':{'type':Sequelize[_0xb282('0x2')]},'context':{'type':Sequelize[_0xb282('0x2')]},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize[_0xb282('0x2')]},'destchannelstate':{'type':Sequelize[_0xb282('0x4')]},'destchannelstatedesc':{'type':Sequelize[_0xb282('0x2')]},'destcalleridnum':{'type':Sequelize[_0xb282('0x2')]},'destcalleridname':{'type':Sequelize[_0xb282('0x2')]},'destconnectedlinenum':{'type':Sequelize['STRING']},'destconnectedlinename':{'type':Sequelize[_0xb282('0x2')]},'destlanguage':{'type':Sequelize['STRING']},'destaccountcode':{'type':Sequelize[_0xb282('0x2')]},'destcontext':{'type':Sequelize[_0xb282('0x2')]},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize['STRING']},'destuniqueid':{'type':Sequelize['STRING']},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0xb282('0x2')]},'answeredelsewheremembername':{'type':Sequelize[_0xb282('0x2')]},'transfer':{'type':Sequelize[_0xb282('0x5')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0xb282('0x2')],'comment':_0xb282('0x6')},'transferexten':{'type':Sequelize['STRING']},'transferuniqueid':{'type':Sequelize[_0xb282('0x2')]},'agententerreason':{'type':Sequelize[_0xb282('0x4')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.controller.js b/server/api/voiceAgentReport/voiceAgentReport.controller.js index 4e91efa..adc15a5 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(_0x1203f,_0x554bbc){var _0x365f0a=function(_0x3531d0){while(--_0x3531d0){_0x1203f['push'](_0x1203f['shift']());}};_0x365f0a(++_0x554bbc);}(_0xa9e0,0x123));var _0x0a9e=function(_0x29b609,_0x19d388){_0x29b609=_0x29b609-0x0;var _0x54c952=_0xa9e0[_0x29b609];return _0x54c952;};'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(_0x2adbeb,_0x5581be){var _0x5e18a6=function(_0x84e42b){while(--_0x84e42b){_0x2adbeb['push'](_0x2adbeb['shift']());}};_0x5e18a6(++_0x5581be);}(_0xa9e0,0x123));var _0x0a9e=function(_0x47b58b,_0x41a189){_0x47b58b=_0x47b58b-0x0;var _0x46bebe=_0xa9e0[_0x47b58b];return _0x46bebe;};'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 399693f..4fa8e20 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 _0x2fed=['path','./voiceAgentReport.attributes','exports','define','VoiceAgentReport','report_agent','uniqueid','lodash','util','../../config/logger','api','moment','request-promise'];(function(_0xf0dcdb,_0x476d0a){var _0x486d28=function(_0x3a580b){while(--_0x3a580b){_0xf0dcdb['push'](_0xf0dcdb['shift']());}};_0x486d28(++_0x476d0a);}(_0x2fed,0x7c));var _0xd2fe=function(_0x2876ee,_0x430597){_0x2876ee=_0x2876ee-0x0;var _0x2eeb4e=_0x2fed[_0x2876ee];return _0x2eeb4e;};'use strict';var _=require(_0xd2fe('0x0'));var util=require(_0xd2fe('0x1'));var logger=require(_0xd2fe('0x2'))(_0xd2fe('0x3'));var moment=require(_0xd2fe('0x4'));var BPromise=require('bluebird');var rp=require(_0xd2fe('0x5'));var fs=require('fs');var path=require(_0xd2fe('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xd2fe('0x7'));module[_0xd2fe('0x8')]=function(_0xd85f89,_0x5be4d3){return _0xd85f89[_0xd2fe('0x9')](_0xd2fe('0xa'),attributes,{'tableName':_0xd2fe('0xb'),'paranoid':![],'indexes':[{'fields':[_0xd2fe('0xc'),'destuniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x5ad3=['uniqueid','destuniqueid','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./voiceAgentReport.attributes','exports','define','report_agent'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x5ad3,0x1e2));var _0x35ad=function(_0x477c0c,_0x48b400){_0x477c0c=_0x477c0c-0x0;var _0x37d540=_0x5ad3[_0x477c0c];return _0x37d540;};'use strict';var _=require(_0x35ad('0x0'));var util=require(_0x35ad('0x1'));var logger=require(_0x35ad('0x2'))(_0x35ad('0x3'));var moment=require('moment');var BPromise=require(_0x35ad('0x4'));var rp=require(_0x35ad('0x5'));var fs=require('fs');var path=require(_0x35ad('0x6'));var rimraf=require(_0x35ad('0x7'));var config=require(_0x35ad('0x8'));var attributes=require(_0x35ad('0x9'));module[_0x35ad('0xa')]=function(_0x436dcb,_0x36c606){return _0x436dcb[_0x35ad('0xb')]('VoiceAgentReport',attributes,{'tableName':_0x35ad('0xc'),'paranoid':![],'indexes':[{'fields':[_0x35ad('0xd'),_0x35ad('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.rpc.js b/server/api/voiceAgentReport/voiceAgentReport.rpc.js index 0c4e198..5ae1a6e 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 _0x03fe=['../../config/logger','rpc','../../config/environment','jayson/promise','http','then','info','request\x20sent','VoiceAgentReport,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceAgentReport,\x20%s,\x20%s','message','catch','CreateVoiceAgentReport','VoiceAgentReport','body','options','raw','UpdateVoiceAgentReport','update','attributes','limit','debug','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x16b4d9,_0x5eb8a9){var _0x43dcf2=function(_0x216ede){while(--_0x216ede){_0x16b4d9['push'](_0x16b4d9['shift']());}};_0x43dcf2(++_0x5eb8a9);}(_0x03fe,0x1c6));var _0xe03f=function(_0x4dd35e,_0x5ed0c2){_0x4dd35e=_0x4dd35e-0x0;var _0x4dfbc7=_0x03fe[_0x4dd35e];return _0x4dfbc7;};'use strict';var _=require(_0xe03f('0x0'));var util=require(_0xe03f('0x1'));var moment=require(_0xe03f('0x2'));var BPromise=require(_0xe03f('0x3'));var rs=require(_0xe03f('0x4'));var fs=require('fs');var Redis=require(_0xe03f('0x5'));var db=require(_0xe03f('0x6'))['db'];var utils=require(_0xe03f('0x7'));var logger=require(_0xe03f('0x8'))(_0xe03f('0x9'));var config=require(_0xe03f('0xa'));var jayson=require(_0xe03f('0xb'));var client=jayson['client'][_0xe03f('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x23e694,_0x4cd619,_0x309520){return new BPromise(function(_0x3ad34f,_0x556d29){return client['request'](_0x23e694,_0x309520)[_0xe03f('0xd')](function(_0x5c0297){logger[_0xe03f('0xe')]('VoiceAgentReport,\x20%s,\x20%s',_0x4cd619,_0xe03f('0xf'));logger['debug'](_0xe03f('0x10'),_0x4cd619,_0xe03f('0xf'),JSON[_0xe03f('0x11')](_0x5c0297));if(_0x5c0297[_0xe03f('0x12')]){if(_0x5c0297[_0xe03f('0x12')][_0xe03f('0x13')]===0x1f4){logger[_0xe03f('0x12')](_0xe03f('0x14'),_0x4cd619,_0x5c0297[_0xe03f('0x12')][_0xe03f('0x15')]);return _0x556d29(_0x5c0297[_0xe03f('0x12')][_0xe03f('0x15')]);}logger['error'](_0xe03f('0x14'),_0x4cd619,_0x5c0297['error']['message']);return _0x3ad34f(_0x5c0297[_0xe03f('0x12')][_0xe03f('0x15')]);}else{logger['info'](_0xe03f('0x14'),_0x4cd619,_0xe03f('0xf'));_0x3ad34f(_0x5c0297['result']['message']);}})[_0xe03f('0x16')](function(_0x5cbe6a){logger[_0xe03f('0x12')](_0xe03f('0x14'),_0x4cd619,_0x5cbe6a);_0x556d29(_0x5cbe6a);});});}exports[_0xe03f('0x17')]=function(_0x1c8591){var _0x27eaef=this;return new Promise(function(_0x2ae8f6,_0x39531d){return db[_0xe03f('0x18')]['create'](_0x1c8591[_0xe03f('0x19')],{'raw':_0x1c8591[_0xe03f('0x1a')]?_0x1c8591[_0xe03f('0x1a')][_0xe03f('0x1b')]===undefined?!![]:![]:!![]})[_0xe03f('0xd')](function(_0x199d39){logger['info']('CreateVoiceAgentReport',_0x1c8591);logger['debug']('CreateVoiceAgentReport',_0x1c8591,JSON[_0xe03f('0x11')](_0x199d39));_0x2ae8f6(_0x199d39);})[_0xe03f('0x16')](function(_0x2684c6){logger['error'](_0xe03f('0x17'),_0x2684c6['message'],_0x1c8591);_0x39531d(_0x27eaef[_0xe03f('0x12')](0x1f4,_0x2684c6[_0xe03f('0x15')]));});});};exports[_0xe03f('0x1c')]=function(_0x3ae1bc){var _0x3d7b24=this;return new Promise(function(_0x46aa2e,_0x57e911){return db['VoiceAgentReport'][_0xe03f('0x1d')](_0x3ae1bc[_0xe03f('0x19')],{'raw':_0x3ae1bc['options']?_0x3ae1bc[_0xe03f('0x1a')][_0xe03f('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3ae1bc[_0xe03f('0x1a')]?_0x3ae1bc[_0xe03f('0x1a')]['where']||null:null,'attributes':_0x3ae1bc['options']?_0x3ae1bc[_0xe03f('0x1a')][_0xe03f('0x1e')]||null:null,'limit':_0x3ae1bc[_0xe03f('0x1a')]?_0x3ae1bc[_0xe03f('0x1a')][_0xe03f('0x1f')]||null:null})[_0xe03f('0xd')](function(_0x50619c){logger[_0xe03f('0xe')]('UpdateVoiceAgentReport',_0x3ae1bc);logger[_0xe03f('0x20')](_0xe03f('0x1c'),_0x3ae1bc,JSON[_0xe03f('0x11')](_0x50619c));_0x46aa2e(_0x50619c);})[_0xe03f('0x16')](function(_0x389cb5){logger[_0xe03f('0x12')](_0xe03f('0x1c'),_0x389cb5['message'],_0x3ae1bc);_0x57e911(_0x3d7b24[_0xe03f('0x12')](0x1f4,_0x389cb5[_0xe03f('0x15')]));});});}; \ No newline at end of file +var _0x52e9=['debug','VoiceAgentReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','catch','create','body','options','raw','info','CreateVoiceAgentReport','stringify','UpdateVoiceAgentReport','VoiceAgentReport','update','where','attributes','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','VoiceAgentReport,\x20%s,\x20%s'];(function(_0x52056e,_0x263459){var _0x18efa1=function(_0x4ebb75){while(--_0x4ebb75){_0x52056e['push'](_0x52056e['shift']());}};_0x18efa1(++_0x263459);}(_0x52e9,0x1c0));var _0x952e=function(_0x3358ee,_0x4385dd){_0x3358ee=_0x3358ee-0x0;var _0x37cd98=_0x52e9[_0x3358ee];return _0x37cd98;};'use strict';var _=require('lodash');var util=require(_0x952e('0x0'));var moment=require(_0x952e('0x1'));var BPromise=require(_0x952e('0x2'));var rs=require(_0x952e('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x952e('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x952e('0x5'))(_0x952e('0x6'));var config=require(_0x952e('0x7'));var jayson=require(_0x952e('0x8'));var client=jayson[_0x952e('0x9')][_0x952e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x41023f,_0x5ae512,_0x413b2f){return new BPromise(function(_0x492b96,_0x46fdd4){return client[_0x952e('0xb')](_0x41023f,_0x413b2f)[_0x952e('0xc')](function(_0x2c4179){logger['info'](_0x952e('0xd'),_0x5ae512,'request\x20sent');logger[_0x952e('0xe')](_0x952e('0xf'),_0x5ae512,_0x952e('0x10'),JSON['stringify'](_0x2c4179));if(_0x2c4179[_0x952e('0x11')]){if(_0x2c4179[_0x952e('0x11')][_0x952e('0x12')]===0x1f4){logger[_0x952e('0x11')](_0x952e('0xd'),_0x5ae512,_0x2c4179['error'][_0x952e('0x13')]);return _0x46fdd4(_0x2c4179['error']['message']);}logger[_0x952e('0x11')]('VoiceAgentReport,\x20%s,\x20%s',_0x5ae512,_0x2c4179[_0x952e('0x11')][_0x952e('0x13')]);return _0x492b96(_0x2c4179[_0x952e('0x11')][_0x952e('0x13')]);}else{logger['info'](_0x952e('0xd'),_0x5ae512,_0x952e('0x10'));_0x492b96(_0x2c4179['result'][_0x952e('0x13')]);}})[_0x952e('0x14')](function(_0x2f374c){logger['error'](_0x952e('0xd'),_0x5ae512,_0x2f374c);_0x46fdd4(_0x2f374c);});});}exports['CreateVoiceAgentReport']=function(_0x1d76c6){var _0xe33479=this;return new Promise(function(_0x36fd82,_0x5db786){return db['VoiceAgentReport'][_0x952e('0x15')](_0x1d76c6[_0x952e('0x16')],{'raw':_0x1d76c6[_0x952e('0x17')]?_0x1d76c6[_0x952e('0x17')][_0x952e('0x18')]===undefined?!![]:![]:!![]})[_0x952e('0xc')](function(_0x3c5cda){logger[_0x952e('0x19')]('CreateVoiceAgentReport',_0x1d76c6);logger['debug'](_0x952e('0x1a'),_0x1d76c6,JSON[_0x952e('0x1b')](_0x3c5cda));_0x36fd82(_0x3c5cda);})[_0x952e('0x14')](function(_0x4c9cf3){logger['error'](_0x952e('0x1a'),_0x4c9cf3[_0x952e('0x13')],_0x1d76c6);_0x5db786(_0xe33479[_0x952e('0x11')](0x1f4,_0x4c9cf3[_0x952e('0x13')]));});});};exports[_0x952e('0x1c')]=function(_0x33b766){var _0x5bce38=this;return new Promise(function(_0x3eaf2e,_0x276ee7){return db[_0x952e('0x1d')][_0x952e('0x1e')](_0x33b766[_0x952e('0x16')],{'raw':_0x33b766[_0x952e('0x17')]?_0x33b766[_0x952e('0x17')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x33b766[_0x952e('0x17')]?_0x33b766[_0x952e('0x17')][_0x952e('0x1f')]||null:null,'attributes':_0x33b766[_0x952e('0x17')]?_0x33b766[_0x952e('0x17')][_0x952e('0x20')]||null:null,'limit':_0x33b766['options']?_0x33b766[_0x952e('0x17')]['limit']||null:null})[_0x952e('0xc')](function(_0x23b8bd){logger[_0x952e('0x19')](_0x952e('0x1c'),_0x33b766);logger['debug'](_0x952e('0x1c'),_0x33b766,JSON[_0x952e('0x1b')](_0x23b8bd));_0x3eaf2e(_0x23b8bd);})[_0x952e('0x14')](function(_0x121c57){logger[_0x952e('0x11')](_0x952e('0x1c'),_0x121c57['message'],_0x33b766);_0x276ee7(_0x5bce38[_0x952e('0x11')](0x1f4,_0x121c57[_0x952e('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/index.js b/server/api/voiceCallReport/index.js index 789f268..9507d57 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 _0x80d9=['get','/:id','show','post','delete','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceCallReport.controller','index','isAuthenticated','describe'];(function(_0x1417d5,_0x2a7207){var _0x28a744=function(_0x31a1ce){while(--_0x31a1ce){_0x1417d5['push'](_0x1417d5['shift']());}};_0x28a744(++_0x2a7207);}(_0x80d9,0x15c));var _0x980d=function(_0x2892e0,_0x558255){_0x2892e0=_0x2892e0-0x0;var _0x54af71=_0x80d9[_0x2892e0];return _0x54af71;};'use strict';var multer=require(_0x980d('0x0'));var util=require('util');var path=require(_0x980d('0x1'));var timeout=require(_0x980d('0x2'));var express=require(_0x980d('0x3'));var router=express['Router']();var fs_extra=require(_0x980d('0x4'));var auth=require(_0x980d('0x5'));var interaction=require(_0x980d('0x6'));var config=require(_0x980d('0x7'));var controller=require(_0x980d('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0x980d('0x9')]);router['get']('/describe',auth[_0x980d('0xa')](),controller[_0x980d('0xb')]);router[_0x980d('0xc')](_0x980d('0xd'),auth[_0x980d('0xa')](),controller[_0x980d('0xe')]);router[_0x980d('0xf')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x980d('0xd'),auth[_0x980d('0xa')](),controller['update']);router[_0x980d('0x10')]('/:id',auth[_0x980d('0xa')](),controller['destroy']);module[_0x980d('0x11')]=router; \ No newline at end of file +var _0xe5b3=['../../config/environment','./voiceCallReport.controller','get','index','isAuthenticated','describe','/:id','post','create','put','update','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0xb86669,_0x1d5ba4){var _0x1e7e75=function(_0x1f2530){while(--_0x1f2530){_0xb86669['push'](_0xb86669['shift']());}};_0x1e7e75(++_0x1d5ba4);}(_0xe5b3,0x133));var _0x3e5b=function(_0x986575,_0x15385d){_0x986575=_0x986575-0x0;var _0x16c1ae=_0xe5b3[_0x986575];return _0x16c1ae;};'use strict';var multer=require('multer');var util=require(_0x3e5b('0x0'));var path=require(_0x3e5b('0x1'));var timeout=require(_0x3e5b('0x2'));var express=require(_0x3e5b('0x3'));var router=express[_0x3e5b('0x4')]();var fs_extra=require(_0x3e5b('0x5'));var auth=require(_0x3e5b('0x6'));var interaction=require(_0x3e5b('0x7'));var config=require(_0x3e5b('0x8'));var controller=require(_0x3e5b('0x9'));router[_0x3e5b('0xa')]('/',auth['isAuthenticated'](),controller[_0x3e5b('0xb')]);router[_0x3e5b('0xa')]('/describe',auth[_0x3e5b('0xc')](),controller[_0x3e5b('0xd')]);router[_0x3e5b('0xa')](_0x3e5b('0xe'),auth['isAuthenticated'](),controller['show']);router[_0x3e5b('0xf')]('/',auth[_0x3e5b('0xc')](),controller[_0x3e5b('0x10')]);router[_0x3e5b('0x11')](_0x3e5b('0xe'),auth['isAuthenticated'](),controller[_0x3e5b('0x12')]);router['delete'](_0x3e5b('0xe'),auth[_0x3e5b('0xc')](),controller[_0x3e5b('0x13')]);module[_0x3e5b('0x14')]=router; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.attributes.js b/server/api/voiceCallReport/voiceCallReport.attributes.js index cd85310..8b8f3f4 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 _0x5b2e=['DATE','INTEGER','sequelize','exports','STRING','ENUM','inbound','internal','outbound','inbound-fax','outbound-fax','dialer','TEXT'];(function(_0x5a27b4,_0x4155b8){var _0x5396b7=function(_0x2e63c3){while(--_0x2e63c3){_0x5a27b4['push'](_0x5a27b4['shift']());}};_0x5396b7(++_0x4155b8);}(_0x5b2e,0x147));var _0xe5b2=function(_0x241e44,_0x174a0e){_0x241e44=_0x241e44-0x0;var _0x586463=_0x5b2e[_0x241e44];return _0x586463;};'use strict';var Sequelize=require(_0xe5b2('0x0'));module[_0xe5b2('0x1')]={'uniqueid':{'type':Sequelize[_0xe5b2('0x2')]},'type':{'type':Sequelize[_0xe5b2('0x3')](_0xe5b2('0x4'),_0xe5b2('0x5'),_0xe5b2('0x6'),_0xe5b2('0x7'),_0xe5b2('0x8'),_0xe5b2('0x9'))},'tag':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0xe5b2('0x2')]},'source':{'type':Sequelize[_0xe5b2('0x2')]},'destination':{'type':Sequelize[_0xe5b2('0x2')]},'destinationcontext':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0xe5b2('0x2')]},'channel':{'type':Sequelize[_0xe5b2('0x2')]},'destinationchannel':{'type':Sequelize[_0xe5b2('0x2')]},'lastapplication':{'type':Sequelize[_0xe5b2('0x2')]},'lastdata':{'type':Sequelize[_0xe5b2('0xa')]},'starttime':{'type':Sequelize[_0xe5b2('0xb')]},'systemanswertime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize[_0xe5b2('0xb')]},'endtime':{'type':Sequelize[_0xe5b2('0xb')]},'duration':{'type':Sequelize[_0xe5b2('0xc')]},'billableseconds':{'type':Sequelize[_0xe5b2('0xc')]},'mohtime':{'type':Sequelize[_0xe5b2('0xc')],'defaultValue':0x0},'disposition':{'type':Sequelize[_0xe5b2('0x2')]},'amaflags':{'type':Sequelize[_0xe5b2('0x2')]},'userfield':{'type':Sequelize[_0xe5b2('0x2')]},'userDisposition':{'type':Sequelize['STRING']},'userSecondDisposition':{'type':Sequelize[_0xe5b2('0x2')]},'userThirdDisposition':{'type':Sequelize[_0xe5b2('0x2')]},'note':{'type':Sequelize[_0xe5b2('0x2')]},'prefix':{'type':Sequelize[_0xe5b2('0x2')]},'routeid':{'type':Sequelize[_0xe5b2('0xc')]},'sipcallid':{'type':Sequelize[_0xe5b2('0x2')]}}; \ No newline at end of file +var _0xa6ee=['inbound','outbound-fax','dialer','DATE','INTEGER','exports','STRING'];(function(_0x3476bb,_0x39ec58){var _0x12151b=function(_0x585dcf){while(--_0x585dcf){_0x3476bb['push'](_0x3476bb['shift']());}};_0x12151b(++_0x39ec58);}(_0xa6ee,0x1a9));var _0xea6e=function(_0x248161,_0x35bc54){_0x248161=_0x248161-0x0;var _0x410709=_0xa6ee[_0x248161];return _0x410709;};'use strict';var Sequelize=require('sequelize');module[_0xea6e('0x0')]={'uniqueid':{'type':Sequelize[_0xea6e('0x1')]},'type':{'type':Sequelize['ENUM'](_0xea6e('0x2'),'internal','outbound','inbound-fax',_0xea6e('0x3'),_0xea6e('0x4'))},'tag':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0xea6e('0x1')]},'source':{'type':Sequelize[_0xea6e('0x1')]},'destination':{'type':Sequelize['STRING']},'destinationcontext':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0xea6e('0x1')]},'destinationchannel':{'type':Sequelize[_0xea6e('0x1')]},'lastapplication':{'type':Sequelize['STRING']},'lastdata':{'type':Sequelize['TEXT']},'starttime':{'type':Sequelize[_0xea6e('0x5')]},'systemanswertime':{'type':Sequelize[_0xea6e('0x5')]},'answertime':{'type':Sequelize[_0xea6e('0x5')]},'endtime':{'type':Sequelize[_0xea6e('0x5')]},'duration':{'type':Sequelize[_0xea6e('0x6')]},'billableseconds':{'type':Sequelize['INTEGER']},'mohtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'disposition':{'type':Sequelize[_0xea6e('0x1')]},'amaflags':{'type':Sequelize['STRING']},'userfield':{'type':Sequelize[_0xea6e('0x1')]},'userDisposition':{'type':Sequelize[_0xea6e('0x1')]},'userSecondDisposition':{'type':Sequelize[_0xea6e('0x1')]},'userThirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0xea6e('0x1')]},'prefix':{'type':Sequelize[_0xea6e('0x1')]},'routeid':{'type':Sequelize[_0xea6e('0x6')]},'sipcallid':{'type':Sequelize[_0xea6e('0x1')]}}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.controller.js b/server/api/voiceCallReport/voiceCallReport.controller.js index 37ea21c..6eaade0 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 _0xdb28=['options','includeAll','fullname','User','findAll','rows','catch','show','params','rawAttributes','intersection','include','find','create','destroy','describe','body','uniqueid','user','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','count','limit','set','apply','save','update','then','sendStatus','error','stack','name','send','index','VoiceCallReport','fieldName','type','key','map','query','keys','model','fields','attributes','length','nolimit','order','sort','filters','filter','where','VIRTUAL','merge'];(function(_0x5e2c51,_0x6eb503){var _0x34bf2a=function(_0x4527c7){while(--_0x4527c7){_0x5e2c51['push'](_0x5e2c51['shift']());}};_0x34bf2a(++_0x6eb503);}(_0xdb28,0x106));var _0x8db2=function(_0x2970da,_0x405aa6){_0x2970da=_0x2970da-0x0;var _0x5f0d7d=_0xdb28[_0x2970da];return _0x5f0d7d;};'use strict';var emlformat=require(_0x8db2('0x0'));var rimraf=require(_0x8db2('0x1'));var zipdir=require(_0x8db2('0x2'));var jsonpatch=require(_0x8db2('0x3'));var rp=require('request-promise');var moment=require(_0x8db2('0x4'));var BPromise=require(_0x8db2('0x5'));var Mustache=require(_0x8db2('0x6'));var util=require(_0x8db2('0x7'));var path=require(_0x8db2('0x8'));var sox=require('sox');var csv=require(_0x8db2('0x9'));var ejs=require(_0x8db2('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x8db2('0xb'));var crypto=require(_0x8db2('0xc'));var jsforce=require(_0x8db2('0xd'));var deskjs=require(_0x8db2('0xe'));var toCsv=require(_0x8db2('0x9'));var querystring=require(_0x8db2('0xf'));var Papa=require(_0x8db2('0x10'));var Redis=require('ioredis');var authService=require(_0x8db2('0x11'));var qs=require(_0x8db2('0x12'));var as=require(_0x8db2('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8db2('0x14'))(_0x8db2('0x15'));var utils=require('../../config/utils');var config=require(_0x8db2('0x16'));var licenseUtil=require(_0x8db2('0x17'));var db=require(_0x8db2('0x18'))['db'];function respondWithStatusCode(_0x204f49,_0x37d017){_0x37d017=_0x37d017||0xcc;return function(_0x559fb1){if(_0x559fb1){return _0x204f49['sendStatus'](_0x37d017);}return _0x204f49[_0x8db2('0x19')](_0x37d017)[_0x8db2('0x1a')]();};}function respondWithResult(_0x350d61,_0x1d6a15){_0x1d6a15=_0x1d6a15||0xc8;return function(_0x227355){if(_0x227355){return _0x350d61[_0x8db2('0x19')](_0x1d6a15)[_0x8db2('0x1b')](_0x227355);}};}function respondWithFilteredResult(_0x3c96a7,_0x131252){return function(_0x16c8c2){if(_0x16c8c2){var _0x5489a9=typeof _0x131252[_0x8db2('0x1c')]===_0x8db2('0x1d')&&typeof _0x131252['limit']===_0x8db2('0x1d');var _0x44957d=_0x16c8c2[_0x8db2('0x1e')];var _0x3fddc2=_0x5489a9?0x0:_0x131252[_0x8db2('0x1c')];var _0x46ce14=_0x5489a9?_0x16c8c2['count']:_0x131252['offset']+_0x131252[_0x8db2('0x1f')];var _0x104e33;if(_0x46ce14>=_0x44957d){_0x46ce14=_0x44957d;_0x104e33=0xc8;}else{_0x104e33=0xce;}_0x3c96a7[_0x8db2('0x19')](_0x104e33);return _0x3c96a7[_0x8db2('0x20')]('Content-Range',_0x3fddc2+'-'+_0x46ce14+'/'+_0x44957d)[_0x8db2('0x1b')](_0x16c8c2);}return null;};}function patchUpdates(_0x36a9ff){return function(_0x260940){try{jsonpatch[_0x8db2('0x21')](_0x260940,_0x36a9ff,!![]);}catch(_0x3dbe8e){return BPromise['reject'](_0x3dbe8e);}return _0x260940[_0x8db2('0x22')]();};}function saveUpdates(_0x3e30e6,_0x18f69c){return function(_0x125be2){if(_0x125be2){return _0x125be2[_0x8db2('0x23')](_0x3e30e6)[_0x8db2('0x24')](function(_0x796ec1){return _0x796ec1;});}return null;};}function removeEntity(_0x5c6614,_0x256202){return function(_0x4f6516){if(_0x4f6516){return _0x4f6516['destroy']()['then'](function(){_0x5c6614['status'](0xcc)[_0x8db2('0x1a')]();});}};}function handleEntityNotFound(_0x29b5cd,_0x3be281){return function(_0x2baed0){if(!_0x2baed0){_0x29b5cd[_0x8db2('0x25')](0x194);}return _0x2baed0;};}function handleError(_0x8d4f54,_0x58cd9d){_0x58cd9d=_0x58cd9d||0x1f4;return function(_0x3544ba){logger[_0x8db2('0x26')](_0x3544ba[_0x8db2('0x27')]);if(_0x3544ba[_0x8db2('0x28')]){delete _0x3544ba['name'];}_0x8d4f54[_0x8db2('0x19')](_0x58cd9d)[_0x8db2('0x29')](_0x3544ba);};}exports[_0x8db2('0x2a')]=function(_0x1687ed,_0xbe5ece){var _0x21bae5={},_0xa54ea3={},_0x3124d5={'count':0x0,'rows':[]};var _0xbc5366=_['map'](db[_0x8db2('0x2b')]['rawAttributes'],function(_0x59cb77){return{'name':_0x59cb77[_0x8db2('0x2c')],'type':_0x59cb77[_0x8db2('0x2d')][_0x8db2('0x2e')]};});_0xa54ea3['model']=_[_0x8db2('0x2f')](_0xbc5366,'name');_0xa54ea3[_0x8db2('0x30')]=_[_0x8db2('0x31')](_0x1687ed[_0x8db2('0x30')]);_0xa54ea3['filters']=_['intersection'](_0xa54ea3[_0x8db2('0x32')],_0xa54ea3[_0x8db2('0x30')]);_0x21bae5['attributes']=_['intersection'](_0xa54ea3[_0x8db2('0x32')],qs[_0x8db2('0x33')](_0x1687ed[_0x8db2('0x30')][_0x8db2('0x33')]));_0x21bae5[_0x8db2('0x34')]=_0x21bae5[_0x8db2('0x34')][_0x8db2('0x35')]?_0x21bae5[_0x8db2('0x34')]:_0xa54ea3[_0x8db2('0x32')];if(!_0x1687ed[_0x8db2('0x30')]['hasOwnProperty'](_0x8db2('0x36'))){_0x21bae5[_0x8db2('0x1f')]=qs['limit'](_0x1687ed[_0x8db2('0x30')][_0x8db2('0x1f')]);_0x21bae5['offset']=qs['offset'](_0x1687ed[_0x8db2('0x30')]['offset']);}_0x21bae5[_0x8db2('0x37')]=qs[_0x8db2('0x38')](_0x1687ed[_0x8db2('0x30')][_0x8db2('0x38')]);_0x21bae5['where']=qs[_0x8db2('0x39')](_['pick'](_0x1687ed[_0x8db2('0x30')],_0xa54ea3[_0x8db2('0x39')]),_0xbc5366);if(_0x1687ed[_0x8db2('0x30')][_0x8db2('0x3a')]){_0x21bae5['where']=_['merge'](_0x21bae5[_0x8db2('0x3b')],{'$or':_[_0x8db2('0x2f')](_0xbc5366,function(_0x5dc2b4){if(_0x5dc2b4[_0x8db2('0x2d')]!==_0x8db2('0x3c')){var _0x656dd2={};_0x656dd2[_0x5dc2b4['name']]={'$like':'%'+_0x1687ed[_0x8db2('0x30')][_0x8db2('0x3a')]+'%'};return _0x656dd2;}})});}_0x21bae5=_[_0x8db2('0x3d')]({},_0x21bae5,_0x1687ed[_0x8db2('0x3e')]);var _0x2e6f0c={'where':_0x21bae5[_0x8db2('0x3b')]};return db[_0x8db2('0x2b')][_0x8db2('0x1e')](_0x2e6f0c)[_0x8db2('0x24')](function(_0x63c561){_0x3124d5[_0x8db2('0x1e')]=_0x63c561;if(_0x1687ed[_0x8db2('0x30')][_0x8db2('0x3f')]){_0x21bae5['include']=[{'attributes':['id',_0x8db2('0x28'),_0x8db2('0x40'),'alias'],'model':db['User'],'as':_0x8db2('0x41')}];}return db['VoiceCallReport'][_0x8db2('0x42')](_0x21bae5);})[_0x8db2('0x24')](function(_0x313130){_0x3124d5[_0x8db2('0x43')]=_0x313130;return _0x3124d5;})[_0x8db2('0x24')](respondWithFilteredResult(_0xbe5ece,_0x21bae5))[_0x8db2('0x44')](handleError(_0xbe5ece,null));};exports[_0x8db2('0x45')]=function(_0x5c97ef,_0x2f86b1){var _0x3d44de={'raw':!![],'where':{'id':_0x5c97ef[_0x8db2('0x46')]['id']}},_0x40c69e={};_0x40c69e['model']=_[_0x8db2('0x31')](db[_0x8db2('0x2b')][_0x8db2('0x47')]);_0x40c69e[_0x8db2('0x30')]=_['keys'](_0x5c97ef[_0x8db2('0x30')]);_0x40c69e['filters']=_[_0x8db2('0x48')](_0x40c69e[_0x8db2('0x32')],_0x40c69e[_0x8db2('0x30')]);_0x3d44de['attributes']=_['intersection'](_0x40c69e[_0x8db2('0x32')],qs['fields'](_0x5c97ef[_0x8db2('0x30')][_0x8db2('0x33')]));_0x3d44de[_0x8db2('0x34')]=_0x3d44de[_0x8db2('0x34')][_0x8db2('0x35')]?_0x3d44de[_0x8db2('0x34')]:_0x40c69e[_0x8db2('0x32')];if(_0x5c97ef[_0x8db2('0x30')][_0x8db2('0x3f')]){_0x3d44de[_0x8db2('0x49')]=[{'all':!![]}];}_0x3d44de=_[_0x8db2('0x3d')]({},_0x3d44de,_0x5c97ef[_0x8db2('0x3e')]);return db['VoiceCallReport'][_0x8db2('0x4a')](_0x3d44de)[_0x8db2('0x24')](handleEntityNotFound(_0x2f86b1,null))[_0x8db2('0x24')](respondWithResult(_0x2f86b1,null))[_0x8db2('0x44')](handleError(_0x2f86b1,null));};exports['create']=function(_0x4ffd9d,_0x11c224){return db[_0x8db2('0x2b')][_0x8db2('0x4b')](_0x4ffd9d['body'],{})['then'](respondWithResult(_0x11c224,0xc9))['catch'](handleError(_0x11c224,null));};exports[_0x8db2('0x4c')]=function(_0x368c37,_0x55c7dd){return db[_0x8db2('0x2b')][_0x8db2('0x4a')]({'where':{'id':_0x368c37[_0x8db2('0x46')]['id']}})[_0x8db2('0x24')](handleEntityNotFound(_0x55c7dd,null))['then'](removeEntity(_0x55c7dd,null))['catch'](handleError(_0x55c7dd,null));};exports[_0x8db2('0x4d')]=function(_0x18c6ef,_0x2908e4){return db[_0x8db2('0x2b')][_0x8db2('0x4d')]()[_0x8db2('0x24')](respondWithResult(_0x2908e4,null))[_0x8db2('0x44')](handleError(_0x2908e4,null));};exports[_0x8db2('0x23')]=function(_0x4187d6,_0x426ae0){if(_0x4187d6[_0x8db2('0x4e')][_0x8db2('0x4f')]){delete _0x4187d6[_0x8db2('0x4e')][_0x8db2('0x4f')];}return db[_0x8db2('0x2b')]['find']({'where':{'uniqueid':_0x4187d6[_0x8db2('0x46')]['id'],'UserId':{'$or':[null,_0x4187d6[_0x8db2('0x50')]['id']]}}})['then'](handleEntityNotFound(_0x426ae0,null))[_0x8db2('0x24')](saveUpdates(_0x4187d6[_0x8db2('0x4e')],null))[_0x8db2('0x24')](respondWithResult(_0x426ae0,null))['catch'](handleError(_0x426ae0,null));}; \ No newline at end of file +var _0xb10b=['desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','reject','update','then','destroy','end','error','stack','name','send','index','map','rawAttributes','fieldName','key','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','VIRTUAL','filter','merge','options','VoiceCallReport','includeAll','include','alias','User','rows','show','find','create','body','catch','params','describe','uniqueid','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','crypto','jsforce'];(function(_0x1e0910,_0x37b7ce){var _0x10645a=function(_0x4095e4){while(--_0x4095e4){_0x1e0910['push'](_0x1e0910['shift']());}};_0x10645a(++_0x37b7ce);}(_0xb10b,0x12a));var _0xbb10=function(_0x27c25f,_0x4ff5fe){_0x27c25f=_0x27c25f-0x0;var _0x2da4c4=_0xb10b[_0x27c25f];return _0x2da4c4;};'use strict';var emlformat=require(_0xbb10('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xbb10('0x1'));var jsonpatch=require(_0xbb10('0x2'));var rp=require(_0xbb10('0x3'));var moment=require('moment');var BPromise=require(_0xbb10('0x4'));var Mustache=require(_0xbb10('0x5'));var util=require(_0xbb10('0x6'));var path=require(_0xbb10('0x7'));var sox=require(_0xbb10('0x8'));var csv=require(_0xbb10('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xbb10('0xa'));var _=require(_0xbb10('0xb'));var squel=require('squel');var crypto=require(_0xbb10('0xc'));var jsforce=require(_0xbb10('0xd'));var deskjs=require(_0xbb10('0xe'));var toCsv=require(_0xbb10('0x9'));var querystring=require(_0xbb10('0xf'));var Papa=require(_0xbb10('0x10'));var Redis=require(_0xbb10('0x11'));var authService=require(_0xbb10('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbb10('0x13'));var logger=require(_0xbb10('0x14'))(_0xbb10('0x15'));var utils=require('../../config/utils');var config=require(_0xbb10('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xbb10('0x17'))['db'];function respondWithStatusCode(_0x916a32,_0x285009){_0x285009=_0x285009||0xcc;return function(_0x193a27){if(_0x193a27){return _0x916a32[_0xbb10('0x18')](_0x285009);}return _0x916a32[_0xbb10('0x19')](_0x285009)['end']();};}function respondWithResult(_0x26e021,_0x42d7e4){_0x42d7e4=_0x42d7e4||0xc8;return function(_0x45b9d6){if(_0x45b9d6){return _0x26e021[_0xbb10('0x19')](_0x42d7e4)[_0xbb10('0x1a')](_0x45b9d6);}};}function respondWithFilteredResult(_0x2f2ebf,_0x24a57b){return function(_0x36b5e8){if(_0x36b5e8){var _0x3e26f4=typeof _0x24a57b[_0xbb10('0x1b')]==='undefined'&&typeof _0x24a57b[_0xbb10('0x1c')]===_0xbb10('0x1d');var _0x133ac2=_0x36b5e8[_0xbb10('0x1e')];var _0x378da8=_0x3e26f4?0x0:_0x24a57b[_0xbb10('0x1b')];var _0x575cca=_0x3e26f4?_0x36b5e8[_0xbb10('0x1e')]:_0x24a57b[_0xbb10('0x1b')]+_0x24a57b[_0xbb10('0x1c')];var _0x48b6e9;if(_0x575cca>=_0x133ac2){_0x575cca=_0x133ac2;_0x48b6e9=0xc8;}else{_0x48b6e9=0xce;}_0x2f2ebf[_0xbb10('0x19')](_0x48b6e9);return _0x2f2ebf[_0xbb10('0x1f')](_0xbb10('0x20'),_0x378da8+'-'+_0x575cca+'/'+_0x133ac2)[_0xbb10('0x1a')](_0x36b5e8);}return null;};}function patchUpdates(_0xdf237d){return function(_0x44e563){try{jsonpatch['apply'](_0x44e563,_0xdf237d,!![]);}catch(_0x12f888){return BPromise[_0xbb10('0x21')](_0x12f888);}return _0x44e563['save']();};}function saveUpdates(_0x4c4b0d,_0x8e2b97){return function(_0x311abe){if(_0x311abe){return _0x311abe[_0xbb10('0x22')](_0x4c4b0d)[_0xbb10('0x23')](function(_0x445761){return _0x445761;});}return null;};}function removeEntity(_0x1824b7,_0x407cb4){return function(_0x436104){if(_0x436104){return _0x436104[_0xbb10('0x24')]()[_0xbb10('0x23')](function(){_0x1824b7[_0xbb10('0x19')](0xcc)[_0xbb10('0x25')]();});}};}function handleEntityNotFound(_0x537898,_0x4fedac){return function(_0x4fb5e0){if(!_0x4fb5e0){_0x537898[_0xbb10('0x18')](0x194);}return _0x4fb5e0;};}function handleError(_0x3c5ae7,_0x2c89b9){_0x2c89b9=_0x2c89b9||0x1f4;return function(_0x4e25ff){logger[_0xbb10('0x26')](_0x4e25ff[_0xbb10('0x27')]);if(_0x4e25ff[_0xbb10('0x28')]){delete _0x4e25ff[_0xbb10('0x28')];}_0x3c5ae7[_0xbb10('0x19')](_0x2c89b9)[_0xbb10('0x29')](_0x4e25ff);};}exports[_0xbb10('0x2a')]=function(_0x4aabb9,_0x3796c7){var _0x21ac54={},_0xfc3595={},_0x2e0249={'count':0x0,'rows':[]};var _0x1d30aa=_[_0xbb10('0x2b')](db['VoiceCallReport'][_0xbb10('0x2c')],function(_0x4ee02e){return{'name':_0x4ee02e[_0xbb10('0x2d')],'type':_0x4ee02e['type'][_0xbb10('0x2e')]};});_0xfc3595[_0xbb10('0x2f')]=_[_0xbb10('0x2b')](_0x1d30aa,'name');_0xfc3595['query']=_[_0xbb10('0x30')](_0x4aabb9[_0xbb10('0x31')]);_0xfc3595['filters']=_[_0xbb10('0x32')](_0xfc3595[_0xbb10('0x2f')],_0xfc3595[_0xbb10('0x31')]);_0x21ac54[_0xbb10('0x33')]=_[_0xbb10('0x32')](_0xfc3595[_0xbb10('0x2f')],qs[_0xbb10('0x34')](_0x4aabb9['query'][_0xbb10('0x34')]));_0x21ac54[_0xbb10('0x33')]=_0x21ac54[_0xbb10('0x33')][_0xbb10('0x35')]?_0x21ac54[_0xbb10('0x33')]:_0xfc3595[_0xbb10('0x2f')];if(!_0x4aabb9[_0xbb10('0x31')][_0xbb10('0x36')](_0xbb10('0x37'))){_0x21ac54['limit']=qs[_0xbb10('0x1c')](_0x4aabb9[_0xbb10('0x31')][_0xbb10('0x1c')]);_0x21ac54[_0xbb10('0x1b')]=qs['offset'](_0x4aabb9[_0xbb10('0x31')]['offset']);}_0x21ac54['order']=qs[_0xbb10('0x38')](_0x4aabb9[_0xbb10('0x31')][_0xbb10('0x38')]);_0x21ac54[_0xbb10('0x39')]=qs[_0xbb10('0x3a')](_[_0xbb10('0x3b')](_0x4aabb9['query'],_0xfc3595[_0xbb10('0x3a')]),_0x1d30aa);if(_0x4aabb9[_0xbb10('0x31')]['filter']){_0x21ac54['where']=_['merge'](_0x21ac54[_0xbb10('0x39')],{'$or':_[_0xbb10('0x2b')](_0x1d30aa,function(_0x2b658a){if(_0x2b658a['type']!==_0xbb10('0x3c')){var _0x3e8538={};_0x3e8538[_0x2b658a[_0xbb10('0x28')]]={'$like':'%'+_0x4aabb9['query'][_0xbb10('0x3d')]+'%'};return _0x3e8538;}})});}_0x21ac54=_[_0xbb10('0x3e')]({},_0x21ac54,_0x4aabb9[_0xbb10('0x3f')]);var _0x446f49={'where':_0x21ac54['where']};return db[_0xbb10('0x40')][_0xbb10('0x1e')](_0x446f49)['then'](function(_0xe2040f){_0x2e0249[_0xbb10('0x1e')]=_0xe2040f;if(_0x4aabb9[_0xbb10('0x31')][_0xbb10('0x41')]){_0x21ac54[_0xbb10('0x42')]=[{'attributes':['id',_0xbb10('0x28'),'fullname',_0xbb10('0x43')],'model':db[_0xbb10('0x44')],'as':_0xbb10('0x44')}];}return db[_0xbb10('0x40')]['findAll'](_0x21ac54);})[_0xbb10('0x23')](function(_0x331751){_0x2e0249[_0xbb10('0x45')]=_0x331751;return _0x2e0249;})[_0xbb10('0x23')](respondWithFilteredResult(_0x3796c7,_0x21ac54))['catch'](handleError(_0x3796c7,null));};exports[_0xbb10('0x46')]=function(_0x202c60,_0x54ac18){var _0x5d9a4f={'raw':!![],'where':{'id':_0x202c60['params']['id']}},_0x38d78f={};_0x38d78f[_0xbb10('0x2f')]=_[_0xbb10('0x30')](db['VoiceCallReport'][_0xbb10('0x2c')]);_0x38d78f[_0xbb10('0x31')]=_[_0xbb10('0x30')](_0x202c60['query']);_0x38d78f[_0xbb10('0x3a')]=_[_0xbb10('0x32')](_0x38d78f[_0xbb10('0x2f')],_0x38d78f[_0xbb10('0x31')]);_0x5d9a4f[_0xbb10('0x33')]=_[_0xbb10('0x32')](_0x38d78f[_0xbb10('0x2f')],qs[_0xbb10('0x34')](_0x202c60[_0xbb10('0x31')][_0xbb10('0x34')]));_0x5d9a4f[_0xbb10('0x33')]=_0x5d9a4f[_0xbb10('0x33')]['length']?_0x5d9a4f[_0xbb10('0x33')]:_0x38d78f[_0xbb10('0x2f')];if(_0x202c60['query'][_0xbb10('0x41')]){_0x5d9a4f[_0xbb10('0x42')]=[{'all':!![]}];}_0x5d9a4f=_[_0xbb10('0x3e')]({},_0x5d9a4f,_0x202c60[_0xbb10('0x3f')]);return db[_0xbb10('0x40')][_0xbb10('0x47')](_0x5d9a4f)[_0xbb10('0x23')](handleEntityNotFound(_0x54ac18,null))['then'](respondWithResult(_0x54ac18,null))['catch'](handleError(_0x54ac18,null));};exports[_0xbb10('0x48')]=function(_0x76a208,_0x2b12bd){return db['VoiceCallReport']['create'](_0x76a208[_0xbb10('0x49')],{})[_0xbb10('0x23')](respondWithResult(_0x2b12bd,0xc9))[_0xbb10('0x4a')](handleError(_0x2b12bd,null));};exports[_0xbb10('0x24')]=function(_0x10159b,_0x22b315){return db[_0xbb10('0x40')][_0xbb10('0x47')]({'where':{'id':_0x10159b[_0xbb10('0x4b')]['id']}})[_0xbb10('0x23')](handleEntityNotFound(_0x22b315,null))['then'](removeEntity(_0x22b315,null))['catch'](handleError(_0x22b315,null));};exports[_0xbb10('0x4c')]=function(_0x467dba,_0x36ab7d){return db[_0xbb10('0x40')][_0xbb10('0x4c')]()[_0xbb10('0x23')](respondWithResult(_0x36ab7d,null))[_0xbb10('0x4a')](handleError(_0x36ab7d,null));};exports[_0xbb10('0x22')]=function(_0x1c0d8f,_0x1214f7){if(_0x1c0d8f[_0xbb10('0x49')][_0xbb10('0x4d')]){delete _0x1c0d8f[_0xbb10('0x49')][_0xbb10('0x4d')];}return db[_0xbb10('0x40')]['find']({'where':{'uniqueid':_0x1c0d8f[_0xbb10('0x4b')]['id'],'UserId':{'$or':[null,_0x1c0d8f['user']['id']]}}})[_0xbb10('0x23')](handleEntityNotFound(_0x1214f7,null))[_0xbb10('0x23')](saveUpdates(_0x1c0d8f[_0xbb10('0x49')],null))[_0xbb10('0x23')](respondWithResult(_0x1214f7,null))[_0xbb10('0x4a')](handleError(_0x1214f7,null));}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.model.js b/server/api/voiceCallReport/voiceCallReport.model.js index cb0293f..a5674b9 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 _0x6be5=['exports','define','VoiceCallReport','report_call','uniqueid','lodash','../../config/logger','api','moment','request-promise','./voiceCallReport.attributes'];(function(_0x45d55e,_0x2fede3){var _0x29812a=function(_0x3c6830){while(--_0x3c6830){_0x45d55e['push'](_0x45d55e['shift']());}};_0x29812a(++_0x2fede3);}(_0x6be5,0x144));var _0x56be=function(_0x2f265f,_0x20599c){_0x2f265f=_0x2f265f-0x0;var _0x43350d=_0x6be5[_0x2f265f];return _0x43350d;};'use strict';var _=require(_0x56be('0x0'));var util=require('util');var logger=require(_0x56be('0x1'))(_0x56be('0x2'));var moment=require(_0x56be('0x3'));var BPromise=require('bluebird');var rp=require(_0x56be('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x56be('0x5'));module[_0x56be('0x6')]=function(_0x2a18a3,_0x5b8efc){return _0x2a18a3[_0x56be('0x7')](_0x56be('0x8'),attributes,{'tableName':_0x56be('0x9'),'paranoid':![],'indexes':[{'fields':[_0x56be('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x9baa=['rimraf','../../config/environment','./voiceCallReport.attributes','exports','define','report_call','uniqueid','util','moment','bluebird','request-promise','path'];(function(_0x5b1f78,_0x1d30b2){var _0x1903d8=function(_0x41a256){while(--_0x41a256){_0x5b1f78['push'](_0x5b1f78['shift']());}};_0x1903d8(++_0x1d30b2);}(_0x9baa,0x187));var _0xa9ba=function(_0x597eb2,_0x165f5c){_0x597eb2=_0x597eb2-0x0;var _0x56875f=_0x9baa[_0x597eb2];return _0x56875f;};'use strict';var _=require('lodash');var util=require(_0xa9ba('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0xa9ba('0x1'));var BPromise=require(_0xa9ba('0x2'));var rp=require(_0xa9ba('0x3'));var fs=require('fs');var path=require(_0xa9ba('0x4'));var rimraf=require(_0xa9ba('0x5'));var config=require(_0xa9ba('0x6'));var attributes=require(_0xa9ba('0x7'));module[_0xa9ba('0x8')]=function(_0x10526a,_0x3a43e3){return _0x10526a[_0xa9ba('0x9')]('VoiceCallReport',attributes,{'tableName':_0xa9ba('0xa'),'paranoid':![],'indexes':[{'fields':[_0xa9ba('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.rpc.js b/server/api/voiceCallReport/voiceCallReport.rpc.js index e970d6d..f757ea8 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 _0x7dda=['create','body','debug','CreateVoiceCallReport','UpdateVoiceCallReport','update','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','info','VoiceCallReport,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','GetVoiceCallReport','VoiceCallReport','findAll','options','raw','where','attributes','limit','include','map','model'];(function(_0x277f27,_0x53d3d4){var _0x370639=function(_0x345cd6){while(--_0x345cd6){_0x277f27['push'](_0x277f27['shift']());}};_0x370639(++_0x53d3d4);}(_0x7dda,0x109));var _0xa7dd=function(_0x7bc22e,_0x322835){_0x7bc22e=_0x7bc22e-0x0;var _0x49c098=_0x7dda[_0x7bc22e];return _0x49c098;};'use strict';var _=require(_0xa7dd('0x0'));var util=require('util');var moment=require(_0xa7dd('0x1'));var BPromise=require('bluebird');var rs=require(_0xa7dd('0x2'));var fs=require('fs');var Redis=require(_0xa7dd('0x3'));var db=require(_0xa7dd('0x4'))['db'];var utils=require(_0xa7dd('0x5'));var logger=require(_0xa7dd('0x6'))(_0xa7dd('0x7'));var config=require(_0xa7dd('0x8'));var jayson=require(_0xa7dd('0x9'));var client=jayson[_0xa7dd('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4112de,_0x31d4b9,_0x1a62c2){return new BPromise(function(_0x2427e0,_0x409759){return client['request'](_0x4112de,_0x1a62c2)[_0xa7dd('0xb')](function(_0x3b9f8a){logger[_0xa7dd('0xc')](_0xa7dd('0xd'),_0x31d4b9,_0xa7dd('0xe'));logger['debug']('VoiceCallReport,\x20%s,\x20%s,\x20%s',_0x31d4b9,_0xa7dd('0xe'),JSON[_0xa7dd('0xf')](_0x3b9f8a));if(_0x3b9f8a[_0xa7dd('0x10')]){if(_0x3b9f8a[_0xa7dd('0x10')]['code']===0x1f4){logger[_0xa7dd('0x10')](_0xa7dd('0xd'),_0x31d4b9,_0x3b9f8a[_0xa7dd('0x10')][_0xa7dd('0x11')]);return _0x409759(_0x3b9f8a['error'][_0xa7dd('0x11')]);}logger[_0xa7dd('0x10')]('VoiceCallReport,\x20%s,\x20%s',_0x31d4b9,_0x3b9f8a[_0xa7dd('0x10')][_0xa7dd('0x11')]);return _0x2427e0(_0x3b9f8a[_0xa7dd('0x10')]['message']);}else{logger[_0xa7dd('0xc')](_0xa7dd('0xd'),_0x31d4b9,'request\x20sent');_0x2427e0(_0x3b9f8a[_0xa7dd('0x12')][_0xa7dd('0x11')]);}})[_0xa7dd('0x13')](function(_0x433669){logger[_0xa7dd('0x10')](_0xa7dd('0xd'),_0x31d4b9,_0x433669);_0x409759(_0x433669);});});}exports[_0xa7dd('0x14')]=function(_0x27f2e8){var _0x892795=this;return new Promise(function(_0x227f50,_0x2df48a){return db[_0xa7dd('0x15')][_0xa7dd('0x16')]({'raw':_0x27f2e8[_0xa7dd('0x17')]?_0x27f2e8['options'][_0xa7dd('0x18')]===undefined?!![]:![]:!![],'where':_0x27f2e8[_0xa7dd('0x17')]?_0x27f2e8['options'][_0xa7dd('0x19')]||null:null,'attributes':_0x27f2e8[_0xa7dd('0x17')]?_0x27f2e8[_0xa7dd('0x17')][_0xa7dd('0x1a')]||null:null,'limit':_0x27f2e8[_0xa7dd('0x17')]?_0x27f2e8[_0xa7dd('0x17')][_0xa7dd('0x1b')]||null:null,'include':_0x27f2e8[_0xa7dd('0x17')]?_0x27f2e8[_0xa7dd('0x17')][_0xa7dd('0x1c')]?_[_0xa7dd('0x1d')](_0x27f2e8[_0xa7dd('0x17')][_0xa7dd('0x1c')],function(_0x588246){return{'model':db[_0x588246[_0xa7dd('0x1e')]],'as':_0x588246['as'],'attributes':_0x588246[_0xa7dd('0x1a')],'include':_0x588246[_0xa7dd('0x1c')]?_['map'](_0x588246['include'],function(_0x55023d){return{'model':db[_0x55023d[_0xa7dd('0x1e')]],'as':_0x55023d['as'],'attributes':_0x55023d['attributes'],'include':_0x55023d['include']?_[_0xa7dd('0x1d')](_0x55023d[_0xa7dd('0x1c')],function(_0x10ba03){return{'model':db[_0x10ba03['model']],'as':_0x10ba03['as'],'attributes':_0x10ba03[_0xa7dd('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xa7dd('0xb')](function(_0xe8384e){logger[_0xa7dd('0xc')](_0xa7dd('0x14'),_0x27f2e8);logger['debug']('GetVoiceCallReport',_0x27f2e8,JSON[_0xa7dd('0xf')](_0xe8384e));_0x227f50(_0xe8384e);})[_0xa7dd('0x13')](function(_0x2dc675){logger[_0xa7dd('0x10')]('GetVoiceCallReport',_0x2dc675[_0xa7dd('0x11')],_0x27f2e8);_0x2df48a(_0x892795[_0xa7dd('0x10')](0x1f4,_0x2dc675[_0xa7dd('0x11')]));});});};exports['CreateVoiceCallReport']=function(_0x368d5c){var _0x2884ee=this;return new Promise(function(_0x3f6070,_0x5d1bf2){return db[_0xa7dd('0x15')][_0xa7dd('0x1f')](_0x368d5c[_0xa7dd('0x20')],{'raw':_0x368d5c[_0xa7dd('0x17')]?_0x368d5c[_0xa7dd('0x17')][_0xa7dd('0x18')]===undefined?!![]:![]:!![]})[_0xa7dd('0xb')](function(_0x4ffabc){logger[_0xa7dd('0xc')]('CreateVoiceCallReport',_0x368d5c);logger[_0xa7dd('0x21')]('CreateVoiceCallReport',_0x368d5c,JSON[_0xa7dd('0xf')](_0x4ffabc));_0x3f6070(_0x4ffabc);})[_0xa7dd('0x13')](function(_0x50a3ce){logger[_0xa7dd('0x10')](_0xa7dd('0x22'),_0x50a3ce[_0xa7dd('0x11')],_0x368d5c);_0x5d1bf2(_0x2884ee[_0xa7dd('0x10')](0x1f4,_0x50a3ce[_0xa7dd('0x11')]));});});};exports[_0xa7dd('0x23')]=function(_0x513b39){var _0xc994d2=this;return new Promise(function(_0x229c39,_0x5b7c1e){return db[_0xa7dd('0x15')][_0xa7dd('0x24')](_0x513b39[_0xa7dd('0x20')],{'raw':_0x513b39[_0xa7dd('0x17')]?_0x513b39[_0xa7dd('0x17')][_0xa7dd('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x513b39[_0xa7dd('0x17')]?_0x513b39[_0xa7dd('0x17')][_0xa7dd('0x19')]||null:null,'attributes':_0x513b39['options']?_0x513b39[_0xa7dd('0x17')][_0xa7dd('0x1a')]||null:null,'limit':_0x513b39[_0xa7dd('0x17')]?_0x513b39[_0xa7dd('0x17')][_0xa7dd('0x1b')]||null:null})[_0xa7dd('0xb')](function(_0x25ece8){logger[_0xa7dd('0xc')](_0xa7dd('0x23'),_0x513b39);logger[_0xa7dd('0x21')](_0xa7dd('0x23'),_0x513b39,JSON['stringify'](_0x25ece8));_0x229c39(_0x25ece8);})[_0xa7dd('0x13')](function(_0x47fc2d){logger['error'](_0xa7dd('0x23'),_0x47fc2d['message'],_0x513b39);_0x5b7c1e(_0xc994d2['error'](0x1f4,_0x47fc2d[_0xa7dd('0x11')]));});});}; \ No newline at end of file +var _0x28de=['where','attributes','limit','include','map','model','GetVoiceCallReport','CreateVoiceCallReport','VoiceCallReport','create','body','UpdateVoiceCallReport','update','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','VoiceCallReport,\x20%s,\x20%s','debug','VoiceCallReport,\x20%s,\x20%s,\x20%s','stringify','error','message','request\x20sent','result','catch','findAll','options','raw'];(function(_0x22b8bc,_0x4c70ef){var _0x5a8dff=function(_0x304f33){while(--_0x304f33){_0x22b8bc['push'](_0x22b8bc['shift']());}};_0x5a8dff(++_0x4c70ef);}(_0x28de,0x16c));var _0xe28d=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x28de[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xe28d('0x0'));var util=require(_0xe28d('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xe28d('0x2'));var fs=require('fs');var Redis=require(_0xe28d('0x3'));var db=require(_0xe28d('0x4'))['db'];var utils=require(_0xe28d('0x5'));var logger=require('../../config/logger')(_0xe28d('0x6'));var config=require(_0xe28d('0x7'));var jayson=require(_0xe28d('0x8'));var client=jayson[_0xe28d('0x9')][_0xe28d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3432be,_0x5b8ba9,_0x5bcf17){return new BPromise(function(_0x4fdc8e,_0x3db73c){return client[_0xe28d('0xb')](_0x3432be,_0x5bcf17)[_0xe28d('0xc')](function(_0x2cd741){logger[_0xe28d('0xd')](_0xe28d('0xe'),_0x5b8ba9,'request\x20sent');logger[_0xe28d('0xf')](_0xe28d('0x10'),_0x5b8ba9,'request\x20sent',JSON[_0xe28d('0x11')](_0x2cd741));if(_0x2cd741['error']){if(_0x2cd741[_0xe28d('0x12')]['code']===0x1f4){logger['error'](_0xe28d('0xe'),_0x5b8ba9,_0x2cd741[_0xe28d('0x12')]['message']);return _0x3db73c(_0x2cd741[_0xe28d('0x12')][_0xe28d('0x13')]);}logger[_0xe28d('0x12')](_0xe28d('0xe'),_0x5b8ba9,_0x2cd741['error'][_0xe28d('0x13')]);return _0x4fdc8e(_0x2cd741[_0xe28d('0x12')][_0xe28d('0x13')]);}else{logger['info']('VoiceCallReport,\x20%s,\x20%s',_0x5b8ba9,_0xe28d('0x14'));_0x4fdc8e(_0x2cd741[_0xe28d('0x15')][_0xe28d('0x13')]);}})[_0xe28d('0x16')](function(_0x2f7022){logger['error'](_0xe28d('0xe'),_0x5b8ba9,_0x2f7022);_0x3db73c(_0x2f7022);});});}exports['GetVoiceCallReport']=function(_0x518183){var _0x5b8728=this;return new Promise(function(_0x293e00,_0x541eda){return db['VoiceCallReport'][_0xe28d('0x17')]({'raw':_0x518183[_0xe28d('0x18')]?_0x518183['options'][_0xe28d('0x19')]===undefined?!![]:![]:!![],'where':_0x518183['options']?_0x518183[_0xe28d('0x18')][_0xe28d('0x1a')]||null:null,'attributes':_0x518183[_0xe28d('0x18')]?_0x518183[_0xe28d('0x18')][_0xe28d('0x1b')]||null:null,'limit':_0x518183[_0xe28d('0x18')]?_0x518183['options'][_0xe28d('0x1c')]||null:null,'include':_0x518183[_0xe28d('0x18')]?_0x518183[_0xe28d('0x18')][_0xe28d('0x1d')]?_['map'](_0x518183['options'][_0xe28d('0x1d')],function(_0x29a56c){return{'model':db[_0x29a56c['model']],'as':_0x29a56c['as'],'attributes':_0x29a56c['attributes'],'include':_0x29a56c[_0xe28d('0x1d')]?_[_0xe28d('0x1e')](_0x29a56c[_0xe28d('0x1d')],function(_0x153ff7){return{'model':db[_0x153ff7[_0xe28d('0x1f')]],'as':_0x153ff7['as'],'attributes':_0x153ff7[_0xe28d('0x1b')],'include':_0x153ff7[_0xe28d('0x1d')]?_[_0xe28d('0x1e')](_0x153ff7[_0xe28d('0x1d')],function(_0x7b73){return{'model':db[_0x7b73[_0xe28d('0x1f')]],'as':_0x7b73['as'],'attributes':_0x7b73[_0xe28d('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xe28d('0xc')](function(_0x153e1f){logger['info']('GetVoiceCallReport',_0x518183);logger[_0xe28d('0xf')](_0xe28d('0x20'),_0x518183,JSON[_0xe28d('0x11')](_0x153e1f));_0x293e00(_0x153e1f);})[_0xe28d('0x16')](function(_0x139639){logger['error'](_0xe28d('0x20'),_0x139639[_0xe28d('0x13')],_0x518183);_0x541eda(_0x5b8728['error'](0x1f4,_0x139639[_0xe28d('0x13')]));});});};exports[_0xe28d('0x21')]=function(_0x1ba5d5){var _0x341f07=this;return new Promise(function(_0x5ef501,_0x11fec){return db[_0xe28d('0x22')][_0xe28d('0x23')](_0x1ba5d5[_0xe28d('0x24')],{'raw':_0x1ba5d5[_0xe28d('0x18')]?_0x1ba5d5['options'][_0xe28d('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x434d72){logger[_0xe28d('0xd')](_0xe28d('0x21'),_0x1ba5d5);logger[_0xe28d('0xf')](_0xe28d('0x21'),_0x1ba5d5,JSON[_0xe28d('0x11')](_0x434d72));_0x5ef501(_0x434d72);})[_0xe28d('0x16')](function(_0x1d817c){logger[_0xe28d('0x12')](_0xe28d('0x21'),_0x1d817c[_0xe28d('0x13')],_0x1ba5d5);_0x11fec(_0x341f07[_0xe28d('0x12')](0x1f4,_0x1d817c['message']));});});};exports[_0xe28d('0x25')]=function(_0x39e1be){var _0x5fddb2=this;return new Promise(function(_0x2ef276,_0x52d21f){return db[_0xe28d('0x22')][_0xe28d('0x26')](_0x39e1be[_0xe28d('0x24')],{'raw':_0x39e1be[_0xe28d('0x18')]?_0x39e1be['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x39e1be[_0xe28d('0x18')]?_0x39e1be[_0xe28d('0x18')][_0xe28d('0x1a')]||null:null,'attributes':_0x39e1be[_0xe28d('0x18')]?_0x39e1be[_0xe28d('0x18')][_0xe28d('0x1b')]||null:null,'limit':_0x39e1be[_0xe28d('0x18')]?_0x39e1be['options'][_0xe28d('0x1c')]||null:null})['then'](function(_0x1ee7ef){logger[_0xe28d('0xd')]('UpdateVoiceCallReport',_0x39e1be);logger[_0xe28d('0xf')](_0xe28d('0x25'),_0x39e1be,JSON[_0xe28d('0x11')](_0x1ee7ef));_0x2ef276(_0x1ee7ef);})[_0xe28d('0x16')](function(_0x314ae8){logger['error'](_0xe28d('0x25'),_0x314ae8['message'],_0x39e1be);_0x52d21f(_0x5fddb2[_0xe28d('0x12')](0x1f4,_0x314ae8[_0xe28d('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/index.js b/server/api/voiceChanSpy/index.js index 31a8e0e..bc19fcd 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 _0xdaf7=['Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','post','create','put','update','destroy','exports','multer','connect-timeout'];(function(_0x411add,_0x1aed38){var _0x238242=function(_0x4a1cd5){while(--_0x4a1cd5){_0x411add['push'](_0x411add['shift']());}};_0x238242(++_0x1aed38);}(_0xdaf7,0x11e));var _0x7daf=function(_0x32d0b7,_0x49316f){_0x32d0b7=_0x32d0b7-0x0;var _0xbfd124=_0xdaf7[_0x32d0b7];return _0xbfd124;};'use strict';var multer=require(_0x7daf('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x7daf('0x1'));var express=require('express');var router=express[_0x7daf('0x2')]();var fs_extra=require(_0x7daf('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x7daf('0x4'));var config=require(_0x7daf('0x5'));var controller=require('./voiceChanSpy.controller');router[_0x7daf('0x6')]('/',auth[_0x7daf('0x7')](),controller[_0x7daf('0x8')]);router[_0x7daf('0x6')](_0x7daf('0x9'),auth['isAuthenticated'](),controller['show']);router[_0x7daf('0xa')]('/',auth[_0x7daf('0x7')](),controller[_0x7daf('0xb')]);router[_0x7daf('0xc')](_0x7daf('0x9'),auth[_0x7daf('0x7')](),controller[_0x7daf('0xd')]);router['delete'](_0x7daf('0x9'),auth[_0x7daf('0x7')](),controller[_0x7daf('0xe')]);module[_0x7daf('0xf')]=router; \ No newline at end of file +var _0x6ad2=['show','post','update','delete','destroy','exports','util','path','connect-timeout','express','../../config/environment','./voiceChanSpy.controller','get','isAuthenticated','index','/:id'];(function(_0xb6c24b,_0x34d65f){var _0x9a4123=function(_0xeba66e){while(--_0xeba66e){_0xb6c24b['push'](_0xb6c24b['shift']());}};_0x9a4123(++_0x34d65f);}(_0x6ad2,0x156));var _0x26ad=function(_0xdbf14f,_0x4bfcc4){_0xdbf14f=_0xdbf14f-0x0;var _0x3e58a2=_0x6ad2[_0xdbf14f];return _0x3e58a2;};'use strict';var multer=require('multer');var util=require(_0x26ad('0x0'));var path=require(_0x26ad('0x1'));var timeout=require(_0x26ad('0x2'));var express=require(_0x26ad('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x26ad('0x4'));var controller=require(_0x26ad('0x5'));router[_0x26ad('0x6')]('/',auth[_0x26ad('0x7')](),controller[_0x26ad('0x8')]);router[_0x26ad('0x6')](_0x26ad('0x9'),auth['isAuthenticated'](),controller[_0x26ad('0xa')]);router[_0x26ad('0xb')]('/',auth[_0x26ad('0x7')](),controller['create']);router['put'](_0x26ad('0x9'),auth['isAuthenticated'](),controller[_0x26ad('0xc')]);router[_0x26ad('0xd')](_0x26ad('0x9'),auth[_0x26ad('0x7')](),controller[_0x26ad('0xe')]);module[_0x26ad('0xf')]=router; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.attributes.js b/server/api/voiceChanSpy/voiceChanSpy.attributes.js index b3d1b20..e3794d2 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 _0x752e=['exports','STRING','name','setDataValue','options','getDataValue','split','sequelize'];(function(_0x34843e,_0x4c4224){var _0x598f7f=function(_0x12a44c){while(--_0x12a44c){_0x34843e['push'](_0x34843e['shift']());}};_0x598f7f(++_0x4c4224);}(_0x752e,0x1bf));var _0xe752=function(_0x2c7618,_0x26be9c){_0x2c7618=_0x2c7618-0x0;var _0x5ce3f0=_0x752e[_0x2c7618];return _0x5ce3f0;};'use strict';var Sequelize=require(_0xe752('0x0'));module[_0xe752('0x1')]={'name':{'type':Sequelize[_0xe752('0x2')]},'prefix':{'type':Sequelize[_0xe752('0x2')],'unique':_0xe752('0x3'),'allowNull':![]},'options':{'type':Sequelize[_0xe752('0x2')],'set':function(_0x260e19){this[_0xe752('0x4')](_0xe752('0x5'),_0x260e19?_0x260e19['join'](''):[]);},'get':function(){return this[_0xe752('0x6')](_0xe752('0x5'))?this['getDataValue'](_0xe752('0x5'))[_0xe752('0x7')](''):[];}},'auth':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'password':{'type':Sequelize[_0xe752('0x2')]},'record':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0xe752('0x2')]},'description':{'type':Sequelize[_0xe752('0x2')]}}; \ No newline at end of file +var _0x4719=['join','options','getDataValue','split','BOOLEAN','sequelize','exports','STRING','setDataValue'];(function(_0x3090ba,_0x3307dc){var _0x5b560c=function(_0x298f70){while(--_0x298f70){_0x3090ba['push'](_0x3090ba['shift']());}};_0x5b560c(++_0x3307dc);}(_0x4719,0x137));var _0x9471=function(_0x4dfacb,_0x7e46f){_0x4dfacb=_0x4dfacb-0x0;var _0x4456f5=_0x4719[_0x4dfacb];return _0x4456f5;};'use strict';var Sequelize=require(_0x9471('0x0'));module[_0x9471('0x1')]={'name':{'type':Sequelize[_0x9471('0x2')]},'prefix':{'type':Sequelize['STRING'],'unique':'name','allowNull':![]},'options':{'type':Sequelize[_0x9471('0x2')],'set':function(_0x22ddff){this[_0x9471('0x3')]('options',_0x22ddff?_0x22ddff[_0x9471('0x4')](''):[]);},'get':function(){return this['getDataValue'](_0x9471('0x5'))?this[_0x9471('0x6')]('options')[_0x9471('0x7')](''):[];}},'auth':{'type':Sequelize[_0x9471('0x8')],'defaultValue':![]},'password':{'type':Sequelize[_0x9471('0x2')]},'record':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0x9471('0x2')]},'description':{'type':Sequelize[_0x9471('0x2')]}}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.controller.js b/server/api/voiceChanSpy/voiceChanSpy.controller.js index 1d2e619..b608d09 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 _0x976a=['squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','limit','undefined','count','set','Content-Range','reject','update','then','destroy','ChanSpies','UserProfileResource','error','stack','index','VoiceChanSpy','rawAttributes','fieldName','type','key','model','map','name','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','where','merge','VIRTUAL','filter','options','includeAll','include','findAll','catch','show','find','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','body','params','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','lodash'];(function(_0x325ee2,_0xaf1371){var _0x7f2741=function(_0x15569a){while(--_0x15569a){_0x325ee2['push'](_0x325ee2['shift']());}};_0x7f2741(++_0xaf1371);}(_0x976a,0xf4));var _0xa976=function(_0x56e1f1,_0x433412){_0x56e1f1=_0x56e1f1-0x0;var _0x5a7b9d=_0x976a[_0x56e1f1];return _0x5a7b9d;};'use strict';var emlformat=require(_0xa976('0x0'));var rimraf=require(_0xa976('0x1'));var zipdir=require(_0xa976('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa976('0x3'));var moment=require(_0xa976('0x4'));var BPromise=require(_0xa976('0x5'));var Mustache=require(_0xa976('0x6'));var util=require(_0xa976('0x7'));var path=require(_0xa976('0x8'));var sox=require(_0xa976('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xa976('0xa'));var squel=require(_0xa976('0xb'));var crypto=require(_0xa976('0xc'));var jsforce=require(_0xa976('0xd'));var deskjs=require(_0xa976('0xe'));var toCsv=require(_0xa976('0xf'));var querystring=require(_0xa976('0x10'));var Papa=require(_0xa976('0x11'));var Redis=require(_0xa976('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa976('0x13'));var logger=require(_0xa976('0x14'))(_0xa976('0x15'));var utils=require(_0xa976('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xa976('0x17'));var db=require(_0xa976('0x18'))['db'];function respondWithStatusCode(_0xb2fcff,_0x1fac1a){_0x1fac1a=_0x1fac1a||0xcc;return function(_0x251346){if(_0x251346){return _0xb2fcff[_0xa976('0x19')](_0x1fac1a);}return _0xb2fcff['status'](_0x1fac1a)[_0xa976('0x1a')]();};}function respondWithResult(_0x2288ff,_0x178520){_0x178520=_0x178520||0xc8;return function(_0x23aea8){if(_0x23aea8){return _0x2288ff[_0xa976('0x1b')](_0x178520)[_0xa976('0x1c')](_0x23aea8);}};}function respondWithFilteredResult(_0x1bac95,_0xe74e4e){return function(_0xd48708){if(_0xd48708){var _0x39ccc6=typeof _0xe74e4e[_0xa976('0x1d')]==='undefined'&&typeof _0xe74e4e[_0xa976('0x1e')]===_0xa976('0x1f');var _0x3405ed=_0xd48708['count'];var _0x4848d8=_0x39ccc6?0x0:_0xe74e4e[_0xa976('0x1d')];var _0x36b47a=_0x39ccc6?_0xd48708[_0xa976('0x20')]:_0xe74e4e[_0xa976('0x1d')]+_0xe74e4e[_0xa976('0x1e')];var _0x5ef373;if(_0x36b47a>=_0x3405ed){_0x36b47a=_0x3405ed;_0x5ef373=0xc8;}else{_0x5ef373=0xce;}_0x1bac95[_0xa976('0x1b')](_0x5ef373);return _0x1bac95[_0xa976('0x21')](_0xa976('0x22'),_0x4848d8+'-'+_0x36b47a+'/'+_0x3405ed)[_0xa976('0x1c')](_0xd48708);}return null;};}function patchUpdates(_0x44f7d4){return function(_0x4c8203){try{jsonpatch['apply'](_0x4c8203,_0x44f7d4,!![]);}catch(_0xf6c4df){return BPromise[_0xa976('0x23')](_0xf6c4df);}return _0x4c8203['save']();};}function saveUpdates(_0x3013c8,_0x4f60ff){return function(_0x4f5c6e){if(_0x4f5c6e){return _0x4f5c6e[_0xa976('0x24')](_0x3013c8)[_0xa976('0x25')](function(_0x7bdce2){return _0x7bdce2;});}return null;};}function removeEntity(_0x3ae9ae,_0x1f0487){return function(_0xe572fe){if(_0xe572fe){return _0xe572fe[_0xa976('0x26')]()['then'](function(){var _0x5a2f6f=_0xe572fe['get']({'plain':!![]});var _0x1be29a=_0xa976('0x27');return db[_0xa976('0x28')]['destroy']({'where':{'type':_0x1be29a,'resourceId':_0x5a2f6f['id']}})['then'](function(){return _0xe572fe;});})[_0xa976('0x25')](function(){_0x3ae9ae[_0xa976('0x1b')](0xcc)[_0xa976('0x1a')]();});}};}function handleEntityNotFound(_0x1b887a,_0x1d71ac){return function(_0x188f9d){if(!_0x188f9d){_0x1b887a[_0xa976('0x19')](0x194);}return _0x188f9d;};}function handleError(_0x3072ec,_0x55d3c5){_0x55d3c5=_0x55d3c5||0x1f4;return function(_0x5b7b2d){logger[_0xa976('0x29')](_0x5b7b2d[_0xa976('0x2a')]);if(_0x5b7b2d['name']){delete _0x5b7b2d['name'];}_0x3072ec[_0xa976('0x1b')](_0x55d3c5)['send'](_0x5b7b2d);};}exports[_0xa976('0x2b')]=function(_0x100a24,_0x9cbf1a){var _0x5d251e={},_0x556140={},_0x576c45={'count':0x0,'rows':[]};var _0x8b4336=_['map'](db[_0xa976('0x2c')][_0xa976('0x2d')],function(_0x22807a){return{'name':_0x22807a[_0xa976('0x2e')],'type':_0x22807a[_0xa976('0x2f')][_0xa976('0x30')]};});_0x556140[_0xa976('0x31')]=_[_0xa976('0x32')](_0x8b4336,_0xa976('0x33'));_0x556140[_0xa976('0x34')]=_[_0xa976('0x35')](_0x100a24[_0xa976('0x34')]);_0x556140[_0xa976('0x36')]=_[_0xa976('0x37')](_0x556140['model'],_0x556140[_0xa976('0x34')]);_0x5d251e['attributes']=_[_0xa976('0x37')](_0x556140[_0xa976('0x31')],qs[_0xa976('0x38')](_0x100a24[_0xa976('0x34')][_0xa976('0x38')]));_0x5d251e[_0xa976('0x39')]=_0x5d251e[_0xa976('0x39')][_0xa976('0x3a')]?_0x5d251e[_0xa976('0x39')]:_0x556140[_0xa976('0x31')];if(!_0x100a24[_0xa976('0x34')][_0xa976('0x3b')](_0xa976('0x3c'))){_0x5d251e['limit']=qs[_0xa976('0x1e')](_0x100a24[_0xa976('0x34')][_0xa976('0x1e')]);_0x5d251e['offset']=qs[_0xa976('0x1d')](_0x100a24[_0xa976('0x34')][_0xa976('0x1d')]);}_0x5d251e[_0xa976('0x3d')]=qs[_0xa976('0x3e')](_0x100a24['query'][_0xa976('0x3e')]);_0x5d251e['where']=qs[_0xa976('0x36')](_[_0xa976('0x3f')](_0x100a24['query'],_0x556140[_0xa976('0x36')]),_0x8b4336);if(_0x100a24[_0xa976('0x34')]['filter']){_0x5d251e[_0xa976('0x40')]=_[_0xa976('0x41')](_0x5d251e['where'],{'$or':_[_0xa976('0x32')](_0x8b4336,function(_0x5a1013){if(_0x5a1013[_0xa976('0x2f')]!==_0xa976('0x42')){var _0x4ca748={};_0x4ca748[_0x5a1013['name']]={'$like':'%'+_0x100a24[_0xa976('0x34')][_0xa976('0x43')]+'%'};return _0x4ca748;}})});}_0x5d251e=_[_0xa976('0x41')]({},_0x5d251e,_0x100a24[_0xa976('0x44')]);var _0x315c23={'where':_0x5d251e[_0xa976('0x40')]};return db[_0xa976('0x2c')][_0xa976('0x20')](_0x315c23)[_0xa976('0x25')](function(_0x11f88f){_0x576c45[_0xa976('0x20')]=_0x11f88f;if(_0x100a24[_0xa976('0x34')][_0xa976('0x45')]){_0x5d251e[_0xa976('0x46')]=[{'all':!![]}];}return db[_0xa976('0x2c')][_0xa976('0x47')](_0x5d251e);})[_0xa976('0x25')](function(_0x1d219d){_0x576c45['rows']=_0x1d219d;return _0x576c45;})[_0xa976('0x25')](respondWithFilteredResult(_0x9cbf1a,_0x5d251e))[_0xa976('0x48')](handleError(_0x9cbf1a,null));};exports[_0xa976('0x49')]=function(_0x206076,_0x1d5181){var _0x22f17d={'raw':![],'where':{'id':_0x206076['params']['id']}},_0x2123e4={};_0x2123e4['model']=_['keys'](db[_0xa976('0x2c')][_0xa976('0x2d')]);_0x2123e4['query']=_[_0xa976('0x35')](_0x206076[_0xa976('0x34')]);_0x2123e4[_0xa976('0x36')]=_[_0xa976('0x37')](_0x2123e4[_0xa976('0x31')],_0x2123e4[_0xa976('0x34')]);_0x22f17d[_0xa976('0x39')]=_['intersection'](_0x2123e4['model'],qs[_0xa976('0x38')](_0x206076[_0xa976('0x34')][_0xa976('0x38')]));_0x22f17d['attributes']=_0x22f17d[_0xa976('0x39')][_0xa976('0x3a')]?_0x22f17d[_0xa976('0x39')]:_0x2123e4[_0xa976('0x31')];if(_0x206076['query'][_0xa976('0x45')]){_0x22f17d[_0xa976('0x46')]=[{'all':!![]}];}_0x22f17d=_['merge']({},_0x22f17d,_0x206076[_0xa976('0x44')]);return db['VoiceChanSpy'][_0xa976('0x4a')](_0x22f17d)[_0xa976('0x25')](handleEntityNotFound(_0x1d5181,null))[_0xa976('0x25')](respondWithResult(_0x1d5181,null))[_0xa976('0x48')](handleError(_0x1d5181,null));};exports['create']=function(_0x1ded72,_0x6ff46e){return db[_0xa976('0x2c')][_0xa976('0x4b')](_0x1ded72['body'],{})[_0xa976('0x25')](function(_0x54c256){var _0x9dced9=_0x1ded72[_0xa976('0x4c')][_0xa976('0x4d')]({'plain':!![]});if(!_0x9dced9)throw new Error(_0xa976('0x4e'));if(_0x9dced9[_0xa976('0x4f')]===_0xa976('0x4c')){var _0x39901d=_0x54c256[_0xa976('0x4d')]({'plain':!![]});var _0x296fd8=_0xa976('0x27');return db[_0xa976('0x50')][_0xa976('0x4a')]({'where':{'name':_0x296fd8,'userProfileId':_0x9dced9[_0xa976('0x51')]},'raw':!![]})[_0xa976('0x25')](function(_0x3840e2){if(_0x3840e2&&_0x3840e2[_0xa976('0x52')]===0x0){return db[_0xa976('0x28')][_0xa976('0x4b')]({'name':_0x39901d['name'],'resourceId':_0x39901d['id'],'type':_0x3840e2[_0xa976('0x33')],'sectionId':_0x3840e2['id']},{})[_0xa976('0x25')](function(){return _0x54c256;});}else{return _0x54c256;}})[_0xa976('0x48')](function(_0x9b72a){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x9b72a);throw _0x9b72a;});}return _0x54c256;})['then'](respondWithResult(_0x6ff46e,0xc9))['catch'](handleError(_0x6ff46e,null));};exports[_0xa976('0x24')]=function(_0x384340,_0x1fdf63){if(_0x384340['body']['id']){delete _0x384340[_0xa976('0x53')]['id'];}return db['VoiceChanSpy'][_0xa976('0x4a')]({'where':{'id':_0x384340[_0xa976('0x54')]['id']}})[_0xa976('0x25')](handleEntityNotFound(_0x1fdf63,null))[_0xa976('0x25')](saveUpdates(_0x384340['body'],null))[_0xa976('0x25')](respondWithResult(_0x1fdf63,null))[_0xa976('0x48')](handleError(_0x1fdf63,null));};exports[_0xa976('0x26')]=function(_0x143d4b,_0x2f59c9){return db[_0xa976('0x2c')]['find']({'where':{'id':_0x143d4b[_0xa976('0x54')]['id']}})[_0xa976('0x25')](handleEntityNotFound(_0x2f59c9,null))[_0xa976('0x25')](removeEntity(_0x2f59c9,null))['catch'](handleError(_0x2f59c9,null));}; \ No newline at end of file +var _0x07c3=['key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','options','includeAll','include','rows','catch','show','params','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','eml-format','rimraf','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/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','sendStatus','status','end','json','undefined','limit','count','offset','set','reject','update','then','destroy','get','ChanSpies','error','stack','name','send','map','VoiceChanSpy','rawAttributes','fieldName','type'];(function(_0x24ad3b,_0x404f9f){var _0x218419=function(_0x25aa50){while(--_0x25aa50){_0x24ad3b['push'](_0x24ad3b['shift']());}};_0x218419(++_0x404f9f);}(_0x07c3,0x1bf));var _0x307c=function(_0x22377a,_0x3397cb){_0x22377a=_0x22377a-0x0;var _0x36f105=_0x07c3[_0x22377a];return _0x36f105;};'use strict';var emlformat=require(_0x307c('0x0'));var rimraf=require(_0x307c('0x1'));var zipdir=require(_0x307c('0x2'));var jsonpatch=require(_0x307c('0x3'));var rp=require(_0x307c('0x4'));var moment=require(_0x307c('0x5'));var BPromise=require(_0x307c('0x6'));var Mustache=require(_0x307c('0x7'));var util=require('util');var path=require(_0x307c('0x8'));var sox=require(_0x307c('0x9'));var csv=require(_0x307c('0xa'));var ejs=require(_0x307c('0xb'));var fs=require('fs');var fs_extra=require(_0x307c('0xc'));var _=require(_0x307c('0xd'));var squel=require(_0x307c('0xe'));var crypto=require(_0x307c('0xf'));var jsforce=require(_0x307c('0x10'));var deskjs=require(_0x307c('0x11'));var toCsv=require(_0x307c('0xa'));var querystring=require(_0x307c('0x12'));var Papa=require(_0x307c('0x13'));var Redis=require(_0x307c('0x14'));var authService=require(_0x307c('0x15'));var qs=require('../../components/parsers/qs');var as=require(_0x307c('0x16'));var hardwareService=require(_0x307c('0x17'));var logger=require(_0x307c('0x18'))(_0x307c('0x19'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x307c('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3c21fb,_0x1a00ec){_0x1a00ec=_0x1a00ec||0xcc;return function(_0x4d2559){if(_0x4d2559){return _0x3c21fb[_0x307c('0x1b')](_0x1a00ec);}return _0x3c21fb[_0x307c('0x1c')](_0x1a00ec)[_0x307c('0x1d')]();};}function respondWithResult(_0x45ef78,_0x4193d8){_0x4193d8=_0x4193d8||0xc8;return function(_0x2ea8c3){if(_0x2ea8c3){return _0x45ef78[_0x307c('0x1c')](_0x4193d8)[_0x307c('0x1e')](_0x2ea8c3);}};}function respondWithFilteredResult(_0x65678e,_0x38f028){return function(_0x405273){if(_0x405273){var _0x424a74=typeof _0x38f028['offset']===_0x307c('0x1f')&&typeof _0x38f028[_0x307c('0x20')]===_0x307c('0x1f');var _0x2f44ce=_0x405273[_0x307c('0x21')];var _0x2e21a6=_0x424a74?0x0:_0x38f028[_0x307c('0x22')];var _0x13f03b=_0x424a74?_0x405273[_0x307c('0x21')]:_0x38f028['offset']+_0x38f028['limit'];var _0x3bbb1e;if(_0x13f03b>=_0x2f44ce){_0x13f03b=_0x2f44ce;_0x3bbb1e=0xc8;}else{_0x3bbb1e=0xce;}_0x65678e['status'](_0x3bbb1e);return _0x65678e[_0x307c('0x23')]('Content-Range',_0x2e21a6+'-'+_0x13f03b+'/'+_0x2f44ce)['json'](_0x405273);}return null;};}function patchUpdates(_0x4bcc1a){return function(_0x25a503){try{jsonpatch['apply'](_0x25a503,_0x4bcc1a,!![]);}catch(_0x2b07da){return BPromise[_0x307c('0x24')](_0x2b07da);}return _0x25a503['save']();};}function saveUpdates(_0x1cdc48,_0x45fe2){return function(_0x574622){if(_0x574622){return _0x574622[_0x307c('0x25')](_0x1cdc48)[_0x307c('0x26')](function(_0x9a66a0){return _0x9a66a0;});}return null;};}function removeEntity(_0x519985,_0x36802c){return function(_0x2b5f2f){if(_0x2b5f2f){return _0x2b5f2f[_0x307c('0x27')]()[_0x307c('0x26')](function(){var _0xa278fc=_0x2b5f2f[_0x307c('0x28')]({'plain':!![]});var _0x5da864=_0x307c('0x29');return db['UserProfileResource']['destroy']({'where':{'type':_0x5da864,'resourceId':_0xa278fc['id']}})[_0x307c('0x26')](function(){return _0x2b5f2f;});})[_0x307c('0x26')](function(){_0x519985[_0x307c('0x1c')](0xcc)[_0x307c('0x1d')]();});}};}function handleEntityNotFound(_0x25dede,_0x1591d1){return function(_0x4fd125){if(!_0x4fd125){_0x25dede[_0x307c('0x1b')](0x194);}return _0x4fd125;};}function handleError(_0x181fa2,_0x2ebab3){_0x2ebab3=_0x2ebab3||0x1f4;return function(_0x54da33){logger[_0x307c('0x2a')](_0x54da33[_0x307c('0x2b')]);if(_0x54da33[_0x307c('0x2c')]){delete _0x54da33[_0x307c('0x2c')];}_0x181fa2[_0x307c('0x1c')](_0x2ebab3)[_0x307c('0x2d')](_0x54da33);};}exports['index']=function(_0x1203f6,_0x1e448e){var _0x27dba3={},_0x313fcf={},_0x912246={'count':0x0,'rows':[]};var _0x80a20c=_[_0x307c('0x2e')](db[_0x307c('0x2f')][_0x307c('0x30')],function(_0x55f4c0){return{'name':_0x55f4c0[_0x307c('0x31')],'type':_0x55f4c0[_0x307c('0x32')][_0x307c('0x33')]};});_0x313fcf[_0x307c('0x34')]=_[_0x307c('0x2e')](_0x80a20c,_0x307c('0x2c'));_0x313fcf[_0x307c('0x35')]=_[_0x307c('0x36')](_0x1203f6[_0x307c('0x35')]);_0x313fcf[_0x307c('0x37')]=_[_0x307c('0x38')](_0x313fcf['model'],_0x313fcf[_0x307c('0x35')]);_0x27dba3[_0x307c('0x39')]=_['intersection'](_0x313fcf[_0x307c('0x34')],qs[_0x307c('0x3a')](_0x1203f6['query'][_0x307c('0x3a')]));_0x27dba3['attributes']=_0x27dba3[_0x307c('0x39')][_0x307c('0x3b')]?_0x27dba3[_0x307c('0x39')]:_0x313fcf[_0x307c('0x34')];if(!_0x1203f6[_0x307c('0x35')][_0x307c('0x3c')](_0x307c('0x3d'))){_0x27dba3['limit']=qs[_0x307c('0x20')](_0x1203f6[_0x307c('0x35')][_0x307c('0x20')]);_0x27dba3[_0x307c('0x22')]=qs[_0x307c('0x22')](_0x1203f6[_0x307c('0x35')][_0x307c('0x22')]);}_0x27dba3['order']=qs['sort'](_0x1203f6['query'][_0x307c('0x3e')]);_0x27dba3[_0x307c('0x3f')]=qs[_0x307c('0x37')](_['pick'](_0x1203f6[_0x307c('0x35')],_0x313fcf['filters']),_0x80a20c);if(_0x1203f6[_0x307c('0x35')][_0x307c('0x40')]){_0x27dba3[_0x307c('0x3f')]=_[_0x307c('0x41')](_0x27dba3[_0x307c('0x3f')],{'$or':_[_0x307c('0x2e')](_0x80a20c,function(_0x34fea9){if(_0x34fea9[_0x307c('0x32')]!=='VIRTUAL'){var _0x2d7544={};_0x2d7544[_0x34fea9['name']]={'$like':'%'+_0x1203f6[_0x307c('0x35')]['filter']+'%'};return _0x2d7544;}})});}_0x27dba3=_[_0x307c('0x41')]({},_0x27dba3,_0x1203f6[_0x307c('0x42')]);var _0x25f65e={'where':_0x27dba3[_0x307c('0x3f')]};return db[_0x307c('0x2f')][_0x307c('0x21')](_0x25f65e)[_0x307c('0x26')](function(_0x45cc33){_0x912246[_0x307c('0x21')]=_0x45cc33;if(_0x1203f6[_0x307c('0x35')][_0x307c('0x43')]){_0x27dba3[_0x307c('0x44')]=[{'all':!![]}];}return db['VoiceChanSpy']['findAll'](_0x27dba3);})[_0x307c('0x26')](function(_0x264aa8){_0x912246[_0x307c('0x45')]=_0x264aa8;return _0x912246;})[_0x307c('0x26')](respondWithFilteredResult(_0x1e448e,_0x27dba3))[_0x307c('0x46')](handleError(_0x1e448e,null));};exports[_0x307c('0x47')]=function(_0x4a7f36,_0x492f8d){var _0x104aa4={'raw':![],'where':{'id':_0x4a7f36[_0x307c('0x48')]['id']}},_0x5d7d0d={};_0x5d7d0d[_0x307c('0x34')]=_[_0x307c('0x36')](db['VoiceChanSpy'][_0x307c('0x30')]);_0x5d7d0d[_0x307c('0x35')]=_[_0x307c('0x36')](_0x4a7f36[_0x307c('0x35')]);_0x5d7d0d[_0x307c('0x37')]=_['intersection'](_0x5d7d0d[_0x307c('0x34')],_0x5d7d0d[_0x307c('0x35')]);_0x104aa4['attributes']=_[_0x307c('0x38')](_0x5d7d0d[_0x307c('0x34')],qs[_0x307c('0x3a')](_0x4a7f36[_0x307c('0x35')][_0x307c('0x3a')]));_0x104aa4[_0x307c('0x39')]=_0x104aa4[_0x307c('0x39')]['length']?_0x104aa4[_0x307c('0x39')]:_0x5d7d0d[_0x307c('0x34')];if(_0x4a7f36[_0x307c('0x35')]['includeAll']){_0x104aa4[_0x307c('0x44')]=[{'all':!![]}];}_0x104aa4=_[_0x307c('0x41')]({},_0x104aa4,_0x4a7f36[_0x307c('0x42')]);return db[_0x307c('0x2f')]['find'](_0x104aa4)[_0x307c('0x26')](handleEntityNotFound(_0x492f8d,null))['then'](respondWithResult(_0x492f8d,null))['catch'](handleError(_0x492f8d,null));};exports['create']=function(_0x26081b,_0x9820dc){return db[_0x307c('0x2f')][_0x307c('0x49')](_0x26081b['body'],{})[_0x307c('0x26')](function(_0x42263f){var _0x398ef5=_0x26081b[_0x307c('0x4a')][_0x307c('0x28')]({'plain':!![]});if(!_0x398ef5)throw new Error(_0x307c('0x4b'));if(_0x398ef5[_0x307c('0x4c')]==='user'){var _0x50876a=_0x42263f[_0x307c('0x28')]({'plain':!![]});var _0x424a92=_0x307c('0x29');return db[_0x307c('0x4d')][_0x307c('0x4e')]({'where':{'name':_0x424a92,'userProfileId':_0x398ef5[_0x307c('0x4f')]},'raw':!![]})[_0x307c('0x26')](function(_0x58e3ff){if(_0x58e3ff&&_0x58e3ff['autoAssociation']===0x0){return db[_0x307c('0x50')][_0x307c('0x49')]({'name':_0x50876a[_0x307c('0x2c')],'resourceId':_0x50876a['id'],'type':_0x58e3ff[_0x307c('0x2c')],'sectionId':_0x58e3ff['id']},{})[_0x307c('0x26')](function(){return _0x42263f;});}else{return _0x42263f;}})['catch'](function(_0x4792a7){logger['error'](_0x307c('0x51'),_0x4792a7);throw _0x4792a7;});}return _0x42263f;})[_0x307c('0x26')](respondWithResult(_0x9820dc,0xc9))['catch'](handleError(_0x9820dc,null));};exports[_0x307c('0x25')]=function(_0x1ce41a,_0x68b3ba){if(_0x1ce41a['body']['id']){delete _0x1ce41a['body']['id'];}return db['VoiceChanSpy'][_0x307c('0x4e')]({'where':{'id':_0x1ce41a[_0x307c('0x48')]['id']}})['then'](handleEntityNotFound(_0x68b3ba,null))['then'](saveUpdates(_0x1ce41a[_0x307c('0x52')],null))[_0x307c('0x26')](respondWithResult(_0x68b3ba,null))['catch'](handleError(_0x68b3ba,null));};exports[_0x307c('0x27')]=function(_0x383260,_0xd27876){return db[_0x307c('0x2f')]['find']({'where':{'id':_0x383260[_0x307c('0x48')]['id']}})[_0x307c('0x26')](handleEntityNotFound(_0xd27876,null))[_0x307c('0x26')](removeEntity(_0xd27876,null))[_0x307c('0x46')](handleError(_0xd27876,null));}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.model.js b/server/api/voiceChanSpy/voiceChanSpy.model.js index e417fd6..a5c7777 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 _0x35d4=['concat','internal','name','findAll','agent','then','exports','define','VoiceChanSpy','voice_chanspy','VoiceExtension','catch','destroy','lodash','util','bluebird','./voiceChanSpy.attributes','context','%s%s','prefix','push','merge','Set','format','record','MixMonitor','recordingFormat','auth','Authenticate','password','ChanSpy','options','join','StopMixMonitor','length'];(function(_0x2e04ef,_0x31a596){var _0x5722b0=function(_0x386fbd){while(--_0x386fbd){_0x2e04ef['push'](_0x2e04ef['shift']());}};_0x5722b0(++_0x31a596);}(_0x35d4,0x125));var _0x435d=function(_0x486ca4,_0x3b2528){_0x486ca4=_0x486ca4-0x0;var _0x1de7b6=_0x35d4[_0x486ca4];return _0x1de7b6;};'use strict';var _=require(_0x435d('0x0'));var util=require(_0x435d('0x1'));var BPromise=require(_0x435d('0x2'));var attributes=require(_0x435d('0x3'));var getUserApplications=function(_0x5b3097,_0x590bb5,_0xce862b){var _0x3ee786=0x1;var _0x290025=[];var _0x12751f={'context':_0x590bb5[_0x435d('0x4')]||'from-sip','exten':util['format'](_0x435d('0x5'),_0x5b3097[_0x435d('0x6')],_0xce862b),'type':'system','isApp':![],'ChanSpyId':_0x5b3097['id'],'UserId':_0x590bb5['id']};_0x290025[_0x435d('0x7')](_[_0x435d('0x8')]({'app':_0x435d('0x9'),'appdata':util[_0x435d('0xa')]('CDR(type)=%s','chanspy'),'priority':_0x3ee786++},_0x12751f));if(_0x5b3097[_0x435d('0xb')]){_0x290025['push'](_['merge']({'app':_0x435d('0xc'),'appdata':util['format']('${UNIQUEID}.%s,a',_0x5b3097[_0x435d('0xd')]),'priority':_0x3ee786++},_0x12751f));}if(_0x5b3097[_0x435d('0xe')]){_0x290025[_0x435d('0x7')](_['merge']({'app':_0x435d('0xf'),'appdata':_0x5b3097[_0x435d('0x10')],'priority':_0x3ee786++},_0x12751f));}_0x290025['push'](_[_0x435d('0x8')]({'app':_0x435d('0x11'),'appdata':util[_0x435d('0xa')]('SIP/%s,%s',_0x590bb5['name'],_0x5b3097[_0x435d('0x12')]?_0x5b3097[_0x435d('0x12')][_0x435d('0x13')](''):''),'priority':_0x3ee786++},_0x12751f));if(_0x5b3097[_0x435d('0xb')]){_0x290025[_0x435d('0x7')](_[_0x435d('0x8')]({'app':_0x435d('0x14'),'priority':_0x3ee786++},_0x12751f));}return _0x290025;};var getChanSpyApplications=function(_0x2bab34,_0x17c9ad){var _0x364bb6=[];for(var _0x3d1f53=0x0,_0x21bd40=0x1;_0x3d1f53<_0x17c9ad[_0x435d('0x15')];_0x3d1f53++,_0x21bd40=0x1){_0x364bb6=_0x364bb6[_0x435d('0x16')](getUserApplications(_0x2bab34,_0x17c9ad[_0x3d1f53],_0x17c9ad[_0x3d1f53][_0x435d('0x17')]));if(_0x17c9ad[_0x3d1f53][_0x435d('0x17')]!=_0x17c9ad[_0x3d1f53][_0x435d('0x18')]){_0x364bb6=_0x364bb6[_0x435d('0x16')](getUserApplications(_0x2bab34,_0x17c9ad[_0x3d1f53],_0x17c9ad[_0x3d1f53][_0x435d('0x18')]));}}return _0x364bb6;};var getChanSpyPromise=function(_0x3e8903,_0x28612d){return new BPromise(function(_0x3cf704,_0x2c4e92){return _0x3e8903['User'][_0x435d('0x19')]({'attributes':['id',_0x435d('0x18'),'internal'],'where':{'role':_0x435d('0x1a'),'chanspy':!![]},'raw':!![]})[_0x435d('0x1b')](function(_0x327563){if(_0x327563){return _0x3cf704(getChanSpyApplications(_0x28612d,_0x327563));}return _0x3cf704([]);})['catch'](function(_0x55db4f){_0x2c4e92(_0x55db4f);});});};module[_0x435d('0x1c')]=function(_0x46d922,_0x501ea1){var _0x3b958a=_0x46d922['models'];return _0x46d922[_0x435d('0x1d')](_0x435d('0x1e'),attributes,{'tableName':_0x435d('0x1f'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x37d15e,_0x2dc1fc,_0x524898){return getChanSpyPromise(_0x3b958a,_0x37d15e)[_0x435d('0x1b')](function(_0x311526){if(_0x311526&&_0x311526[_0x435d('0x15')]){return _0x3b958a[_0x435d('0x20')]['bulkCreate'](_0x311526);}})[_0x435d('0x1b')](function(){_0x524898();})[_0x435d('0x21')](function(_0x3c7e11){_0x524898(_0x3c7e11);});},'afterUpdate':function(_0x3a0db7,_0x41d7ee,_0x5c9a33){return _0x3b958a[_0x435d('0x20')][_0x435d('0x22')]({'where':{'ChanSpyId':_0x3a0db7['id']}})[_0x435d('0x1b')](function(){return getChanSpyPromise(_0x3b958a,_0x3a0db7);})[_0x435d('0x1b')](function(_0x281109){if(_0x281109&&_0x281109[_0x435d('0x15')]){return _0x3b958a['VoiceExtension']['bulkCreate'](_0x281109);}})[_0x435d('0x1b')](function(){_0x5c9a33();})[_0x435d('0x21')](function(_0x9307d6){_0x5c9a33(_0x9307d6);});},'afterDestroy':function(_0x33a4da,_0x3bcb81,_0x53e9a1){return _0x3b958a[_0x435d('0x20')][_0x435d('0x22')]({'where':{'ChanSpyId':_0x33a4da['id']}})[_0x435d('0x1b')](function(){_0x53e9a1();})[_0x435d('0x21')](function(_0x104d6f){_0x53e9a1(_0x104d6f);});}}});}; \ No newline at end of file +var _0x63a7=['password','ChanSpy','SIP/%s,%s','options','join','StopMixMonitor','concat','internal','name','User','findAll','agent','catch','exports','models','voice_chanspy','then','VoiceExtension','bulkCreate','length','lodash','util','bluebird','./voiceChanSpy.attributes','context','from-sip','format','%s%s','prefix','system','push','merge','Set','CDR(type)=%s','chanspy','record','MixMonitor','${UNIQUEID}.%s,a','auth','Authenticate'];(function(_0x54124d,_0x5212f8){var _0x5d1f70=function(_0x12ebcc){while(--_0x12ebcc){_0x54124d['push'](_0x54124d['shift']());}};_0x5d1f70(++_0x5212f8);}(_0x63a7,0x12c));var _0x763a=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x63a7[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x763a('0x0'));var util=require(_0x763a('0x1'));var BPromise=require(_0x763a('0x2'));var attributes=require(_0x763a('0x3'));var getUserApplications=function(_0xbbd224,_0x200b63,_0x509f3d){var _0xfb4dae=0x1;var _0x2f83bc=[];var _0x44b124={'context':_0x200b63[_0x763a('0x4')]||_0x763a('0x5'),'exten':util[_0x763a('0x6')](_0x763a('0x7'),_0xbbd224[_0x763a('0x8')],_0x509f3d),'type':_0x763a('0x9'),'isApp':![],'ChanSpyId':_0xbbd224['id'],'UserId':_0x200b63['id']};_0x2f83bc[_0x763a('0xa')](_[_0x763a('0xb')]({'app':_0x763a('0xc'),'appdata':util['format'](_0x763a('0xd'),_0x763a('0xe')),'priority':_0xfb4dae++},_0x44b124));if(_0xbbd224[_0x763a('0xf')]){_0x2f83bc[_0x763a('0xa')](_[_0x763a('0xb')]({'app':_0x763a('0x10'),'appdata':util['format'](_0x763a('0x11'),_0xbbd224['recordingFormat']),'priority':_0xfb4dae++},_0x44b124));}if(_0xbbd224[_0x763a('0x12')]){_0x2f83bc[_0x763a('0xa')](_[_0x763a('0xb')]({'app':_0x763a('0x13'),'appdata':_0xbbd224[_0x763a('0x14')],'priority':_0xfb4dae++},_0x44b124));}_0x2f83bc[_0x763a('0xa')](_['merge']({'app':_0x763a('0x15'),'appdata':util[_0x763a('0x6')](_0x763a('0x16'),_0x200b63['name'],_0xbbd224[_0x763a('0x17')]?_0xbbd224[_0x763a('0x17')][_0x763a('0x18')](''):''),'priority':_0xfb4dae++},_0x44b124));if(_0xbbd224['record']){_0x2f83bc[_0x763a('0xa')](_[_0x763a('0xb')]({'app':_0x763a('0x19'),'priority':_0xfb4dae++},_0x44b124));}return _0x2f83bc;};var getChanSpyApplications=function(_0x44412f,_0x48eea8){var _0x1ff0bb=[];for(var _0xabb1ed=0x0,_0xd3b71e=0x1;_0xabb1ed<_0x48eea8['length'];_0xabb1ed++,_0xd3b71e=0x1){_0x1ff0bb=_0x1ff0bb[_0x763a('0x1a')](getUserApplications(_0x44412f,_0x48eea8[_0xabb1ed],_0x48eea8[_0xabb1ed][_0x763a('0x1b')]));if(_0x48eea8[_0xabb1ed][_0x763a('0x1b')]!=_0x48eea8[_0xabb1ed][_0x763a('0x1c')]){_0x1ff0bb=_0x1ff0bb[_0x763a('0x1a')](getUserApplications(_0x44412f,_0x48eea8[_0xabb1ed],_0x48eea8[_0xabb1ed][_0x763a('0x1c')]));}}return _0x1ff0bb;};var getChanSpyPromise=function(_0x15a5e1,_0x48f3ea){return new BPromise(function(_0x592c99,_0x2aec57){return _0x15a5e1[_0x763a('0x1d')][_0x763a('0x1e')]({'attributes':['id',_0x763a('0x1c'),_0x763a('0x1b')],'where':{'role':_0x763a('0x1f'),'chanspy':!![]},'raw':!![]})['then'](function(_0x12bb0d){if(_0x12bb0d){return _0x592c99(getChanSpyApplications(_0x48f3ea,_0x12bb0d));}return _0x592c99([]);})[_0x763a('0x20')](function(_0x7402e7){_0x2aec57(_0x7402e7);});});};module[_0x763a('0x21')]=function(_0x182a22,_0x6b3224){var _0x53f55b=_0x182a22[_0x763a('0x22')];return _0x182a22['define']('VoiceChanSpy',attributes,{'tableName':_0x763a('0x23'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x3af400,_0x445cb4,_0x5d8ba5){return getChanSpyPromise(_0x53f55b,_0x3af400)[_0x763a('0x24')](function(_0x2b2cbf){if(_0x2b2cbf&&_0x2b2cbf['length']){return _0x53f55b[_0x763a('0x25')][_0x763a('0x26')](_0x2b2cbf);}})[_0x763a('0x24')](function(){_0x5d8ba5();})['catch'](function(_0x30f34b){_0x5d8ba5(_0x30f34b);});},'afterUpdate':function(_0x5bb826,_0xb8bb0c,_0x1f67d9){return _0x53f55b[_0x763a('0x25')]['destroy']({'where':{'ChanSpyId':_0x5bb826['id']}})['then'](function(){return getChanSpyPromise(_0x53f55b,_0x5bb826);})[_0x763a('0x24')](function(_0x55228e){if(_0x55228e&&_0x55228e[_0x763a('0x27')]){return _0x53f55b[_0x763a('0x25')][_0x763a('0x26')](_0x55228e);}})['then'](function(){_0x1f67d9();})[_0x763a('0x20')](function(_0x38f28a){_0x1f67d9(_0x38f28a);});},'afterDestroy':function(_0x412971,_0x4cef17,_0x2ab108){return _0x53f55b['VoiceExtension']['destroy']({'where':{'ChanSpyId':_0x412971['id']}})[_0x763a('0x24')](function(){_0x2ab108();})[_0x763a('0x20')](function(_0x189f5e){_0x2ab108(_0x189f5e);});}}});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.rpc.js b/server/api/voiceChanSpy/voiceChanSpy.rpc.js index 52f80a4..4d475a3 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 _0xec56=['http','request','then','VoiceChanSpy,\x20%s,\x20%s','request\x20sent','debug','VoiceChanSpy,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x4ff09b,_0x53f67d){var _0x3f5c2e=function(_0x124592){while(--_0x124592){_0x4ff09b['push'](_0x4ff09b['shift']());}};_0x3f5c2e(++_0x53f67d);}(_0xec56,0x1bd));var _0x6ec5=function(_0x2dd485,_0x596404){_0x2dd485=_0x2dd485-0x0;var _0xce053=_0xec56[_0x2dd485];return _0xce053;};'use strict';var _=require(_0x6ec5('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x6ec5('0x1'));var rs=require(_0x6ec5('0x2'));var fs=require('fs');var Redis=require(_0x6ec5('0x3'));var db=require(_0x6ec5('0x4'))['db'];var utils=require(_0x6ec5('0x5'));var logger=require(_0x6ec5('0x6'))(_0x6ec5('0x7'));var config=require(_0x6ec5('0x8'));var jayson=require(_0x6ec5('0x9'));var client=jayson[_0x6ec5('0xa')][_0x6ec5('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3bb683,_0x35be4e,_0x1f59cd){return new BPromise(function(_0x3dd891,_0x225d2f){return client[_0x6ec5('0xc')](_0x3bb683,_0x1f59cd)[_0x6ec5('0xd')](function(_0x3ff17c){logger['info'](_0x6ec5('0xe'),_0x35be4e,_0x6ec5('0xf'));logger[_0x6ec5('0x10')](_0x6ec5('0x11'),_0x35be4e,_0x6ec5('0xf'),JSON[_0x6ec5('0x12')](_0x3ff17c));if(_0x3ff17c[_0x6ec5('0x13')]){if(_0x3ff17c['error'][_0x6ec5('0x14')]===0x1f4){logger[_0x6ec5('0x13')](_0x6ec5('0xe'),_0x35be4e,_0x3ff17c[_0x6ec5('0x13')][_0x6ec5('0x15')]);return _0x225d2f(_0x3ff17c[_0x6ec5('0x13')][_0x6ec5('0x15')]);}logger[_0x6ec5('0x13')]('VoiceChanSpy,\x20%s,\x20%s',_0x35be4e,_0x3ff17c[_0x6ec5('0x13')]['message']);return _0x3dd891(_0x3ff17c[_0x6ec5('0x13')][_0x6ec5('0x15')]);}else{logger[_0x6ec5('0x16')](_0x6ec5('0xe'),_0x35be4e,_0x6ec5('0xf'));_0x3dd891(_0x3ff17c['result'][_0x6ec5('0x15')]);}})[_0x6ec5('0x17')](function(_0x125ae6){logger[_0x6ec5('0x13')](_0x6ec5('0xe'),_0x35be4e,_0x125ae6);_0x225d2f(_0x125ae6);});});} \ 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','VoiceChanSpy,\x20%s,\x20%s','request\x20sent','debug','VoiceChanSpy,\x20%s,\x20%s,\x20%s','error','code','message','result','catch'];(function(_0x832516,_0x3cf44c){var _0x1bc833=function(_0x345002){while(--_0x345002){_0x832516['push'](_0x832516['shift']());}};_0x1bc833(++_0x3cf44c);}(_0xb688,0xcf));var _0x8b68=function(_0x1c5f54,_0x39561e){_0x1c5f54=_0x1c5f54-0x0;var _0x25cebe=_0xb688[_0x1c5f54];return _0x25cebe;};'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')]('VoiceChanSpy,\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/voiceContext/index.js b/server/api/voiceContext/index.js index 46d816c..2531373 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 _0x239c=['/:id','update','delete','destroy','exports','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','show','post','create','put'];(function(_0x24065b,_0x1775ba){var _0x88b0b7=function(_0x1143fc){while(--_0x1143fc){_0x24065b['push'](_0x24065b['shift']());}};_0x88b0b7(++_0x1775ba);}(_0x239c,0x71));var _0xc239=function(_0x13268d,_0x1cbb5c){_0x13268d=_0x13268d-0x0;var _0x565bb9=_0x239c[_0x13268d];return _0x565bb9;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0xc239('0x0'));var express=require(_0xc239('0x1'));var router=express['Router']();var fs_extra=require(_0xc239('0x2'));var auth=require(_0xc239('0x3'));var interaction=require(_0xc239('0x4'));var config=require(_0xc239('0x5'));var controller=require('./voiceContext.controller');router[_0xc239('0x6')]('/',auth[_0xc239('0x7')](),controller[_0xc239('0x8')]);router['get']('/:id',auth[_0xc239('0x7')](),controller[_0xc239('0x9')]);router[_0xc239('0xa')]('/',auth[_0xc239('0x7')](),controller[_0xc239('0xb')]);router[_0xc239('0xc')](_0xc239('0xd'),auth[_0xc239('0x7')](),controller[_0xc239('0xe')]);router[_0xc239('0xf')]('/:id',auth[_0xc239('0x7')](),controller[_0xc239('0x10')]);module[_0xc239('0x11')]=router; \ No newline at end of file +var _0x7bf5=['../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','isAuthenticated','show','post','/:id','multer','util','connect-timeout','express','Router','fs-extra'];(function(_0x4d180c,_0x45c68e){var _0x49b57e=function(_0x264741){while(--_0x264741){_0x4d180c['push'](_0x4d180c['shift']());}};_0x49b57e(++_0x45c68e);}(_0x7bf5,0xf9));var _0x57bf=function(_0x4dd27b,_0x12e87b){_0x4dd27b=_0x4dd27b-0x0;var _0x171af0=_0x7bf5[_0x4dd27b];return _0x171af0;};'use strict';var multer=require(_0x57bf('0x0'));var util=require(_0x57bf('0x1'));var path=require('path');var timeout=require(_0x57bf('0x2'));var express=require(_0x57bf('0x3'));var router=express[_0x57bf('0x4')]();var fs_extra=require(_0x57bf('0x5'));var auth=require(_0x57bf('0x6'));var interaction=require(_0x57bf('0x7'));var config=require(_0x57bf('0x8'));var controller=require('./voiceContext.controller');router[_0x57bf('0x9')]('/',auth['isAuthenticated'](),controller[_0x57bf('0xa')]);router['get']('/:id',auth[_0x57bf('0xb')](),controller[_0x57bf('0xc')]);router[_0x57bf('0xd')]('/',auth[_0x57bf('0xb')](),controller['create']);router['put'](_0x57bf('0xe'),auth[_0x57bf('0xb')](),controller['update']);router['delete'](_0x57bf('0xe'),auth[_0x57bf('0xb')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.attributes.js b/server/api/voiceContext/voiceContext.attributes.js index df861e8..4054a38 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 _0x5737=['STRING','name','BOOLEAN','exports'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x5737,0xc7));var _0x7573=function(_0x3d66f0,_0x3f4e63){_0x3d66f0=_0x3d66f0-0x0;var _0x4164f3=_0x5737[_0x3d66f0];return _0x4164f3;};'use strict';var Sequelize=require('sequelize');module[_0x7573('0x0')]={'name':{'type':Sequelize[_0x7573('0x1')],'unique':_0x7573('0x2')},'description':{'type':Sequelize[_0x7573('0x1')],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0x7573('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0xdbb5=['name','BOOLEAN','sequelize','exports','STRING'];(function(_0x15cbc7,_0x186e17){var _0x5fdf24=function(_0x4b210e){while(--_0x4b210e){_0x15cbc7['push'](_0x15cbc7['shift']());}};_0x5fdf24(++_0x186e17);}(_0xdbb5,0x16f));var _0x5dbb=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xdbb5[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require(_0x5dbb('0x0'));module[_0x5dbb('0x1')]={'name':{'type':Sequelize[_0x5dbb('0x2')],'unique':_0x5dbb('0x3')},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0x5dbb('0x4')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.controller.js b/server/api/voiceContext/voiceContext.controller.js index 635e3e1..62b2785 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 _0x6960=['root','server/files/templates/context.ejs','utf8','writeFileSync','/etc/asterisk/extensions_xcally_contexts.conf','chan_sip.so','user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','join','render','Reload','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','http','request','then','info','request\x20sent','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceContext,\x20%s,\x20%s','message','catch','sendStatus','status','end','json','offset','count','limit','set','apply','reject','save','update','destroy','get','Contexts','stack','name','index','map','VoiceContext','rawAttributes','fieldName','type','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','pick','filter','merge','where','VIRTUAL','options','include','findAll','show','params','includeAll','find','create','body','readFileSync'];(function(_0x28947d,_0x4cc9c6){var _0x12d2ee=function(_0x3f38fc){while(--_0x3f38fc){_0x28947d['push'](_0x28947d['shift']());}};_0x12d2ee(++_0x4cc9c6);}(_0x6960,0x148));var _0x0696=function(_0x1cc8fe,_0x105328){_0x1cc8fe=_0x1cc8fe-0x0;var _0x230054=_0x6960[_0x1cc8fe];return _0x230054;};'use strict';var emlformat=require(_0x0696('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x0696('0x1'));var jsonpatch=require(_0x0696('0x2'));var rp=require(_0x0696('0x3'));var moment=require('moment');var BPromise=require(_0x0696('0x4'));var Mustache=require(_0x0696('0x5'));var util=require(_0x0696('0x6'));var path=require(_0x0696('0x7'));var sox=require(_0x0696('0x8'));var csv=require(_0x0696('0x9'));var ejs=require(_0x0696('0xa'));var fs=require('fs');var fs_extra=require(_0x0696('0xb'));var _=require(_0x0696('0xc'));var squel=require('squel');var crypto=require(_0x0696('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x0696('0xe'));var toCsv=require(_0x0696('0x9'));var querystring=require(_0x0696('0xf'));var Papa=require(_0x0696('0x10'));var Redis=require(_0x0696('0x11'));var authService=require(_0x0696('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x0696('0x13'));var hardwareService=require(_0x0696('0x14'));var logger=require('../../config/logger')(_0x0696('0x15'));var utils=require(_0x0696('0x16'));var config=require(_0x0696('0x17'));var licenseUtil=require(_0x0696('0x18'));var db=require(_0x0696('0x19'))['db'];var jayson=require(_0x0696('0x1a'));var client=jayson['client'][_0x0696('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x250a30,_0xb62064,_0x5852f5,_0x448d59){return new BPromise(function(_0x4e6ab5,_0xb3c0c2){var _0x1b9a9a=_0x448d59||client;return _0x1b9a9a[_0x0696('0x1c')](_0x250a30,_0x5852f5)[_0x0696('0x1d')](function(_0x3ebad9){logger[_0x0696('0x1e')]('VoiceContext,\x20%s,\x20%s',_0xb62064,_0x0696('0x1f'));logger['debug'](_0x0696('0x20'),_0xb62064,_0x0696('0x1f'),JSON[_0x0696('0x21')](_0x3ebad9));if(_0x3ebad9[_0x0696('0x22')]){if(_0x3ebad9['error'][_0x0696('0x23')]===0x1f4){logger['error'](_0x0696('0x24'),_0xb62064,_0x3ebad9[_0x0696('0x22')][_0x0696('0x25')]);return _0xb3c0c2(_0x3ebad9[_0x0696('0x22')][_0x0696('0x25')]);}logger[_0x0696('0x22')](_0x0696('0x24'),_0xb62064,_0x3ebad9['error'][_0x0696('0x25')]);return _0x4e6ab5(_0x3ebad9[_0x0696('0x22')][_0x0696('0x25')]);}else{logger[_0x0696('0x1e')](_0x0696('0x24'),_0xb62064,_0x0696('0x1f'));_0x4e6ab5(_0x3ebad9['result'][_0x0696('0x25')]);}})[_0x0696('0x26')](function(_0x4c3d06){logger[_0x0696('0x22')](_0x0696('0x24'),_0xb62064,_0x4c3d06);_0xb3c0c2(_0x4c3d06);});});}function respondWithStatusCode(_0x4e15a7,_0x476a01){_0x476a01=_0x476a01||0xcc;return function(_0x405690){if(_0x405690){return _0x4e15a7[_0x0696('0x27')](_0x476a01);}return _0x4e15a7[_0x0696('0x28')](_0x476a01)[_0x0696('0x29')]();};}function respondWithResult(_0x7e6c29,_0x359d90){_0x359d90=_0x359d90||0xc8;return function(_0x186c4c){if(_0x186c4c){return _0x7e6c29[_0x0696('0x28')](_0x359d90)[_0x0696('0x2a')](_0x186c4c);}};}function respondWithFilteredResult(_0x4bc439,_0x290aaf){return function(_0x4a45d0){if(_0x4a45d0){var _0x2db54f=typeof _0x290aaf[_0x0696('0x2b')]==='undefined'&&typeof _0x290aaf['limit']==='undefined';var _0x2da770=_0x4a45d0[_0x0696('0x2c')];var _0x3aca5d=_0x2db54f?0x0:_0x290aaf[_0x0696('0x2b')];var _0xccf201=_0x2db54f?_0x4a45d0['count']:_0x290aaf[_0x0696('0x2b')]+_0x290aaf[_0x0696('0x2d')];var _0x325b54;if(_0xccf201>=_0x2da770){_0xccf201=_0x2da770;_0x325b54=0xc8;}else{_0x325b54=0xce;}_0x4bc439[_0x0696('0x28')](_0x325b54);return _0x4bc439[_0x0696('0x2e')]('Content-Range',_0x3aca5d+'-'+_0xccf201+'/'+_0x2da770)[_0x0696('0x2a')](_0x4a45d0);}return null;};}function patchUpdates(_0x5ab526){return function(_0x3241bc){try{jsonpatch[_0x0696('0x2f')](_0x3241bc,_0x5ab526,!![]);}catch(_0x504027){return BPromise[_0x0696('0x30')](_0x504027);}return _0x3241bc[_0x0696('0x31')]();};}function saveUpdates(_0x1e645a,_0xaa3623){return function(_0x1d45b8){if(_0x1d45b8){return _0x1d45b8[_0x0696('0x32')](_0x1e645a)[_0x0696('0x1d')](function(_0x186355){return _0x186355;});}return null;};}function removeEntity(_0x2b40f5,_0x5b9c20){return function(_0x2285a6){if(_0x2285a6){return _0x2285a6[_0x0696('0x33')]()[_0x0696('0x1d')](function(){var _0x3724b4=_0x2285a6[_0x0696('0x34')]({'plain':!![]});var _0x2dd7e3=_0x0696('0x35');return db['UserProfileResource'][_0x0696('0x33')]({'where':{'type':_0x2dd7e3,'resourceId':_0x3724b4['id']}})[_0x0696('0x1d')](function(){return _0x2285a6;});})[_0x0696('0x1d')](function(){_0x2b40f5[_0x0696('0x28')](0xcc)[_0x0696('0x29')]();});}};}function handleEntityNotFound(_0x4bfb8a,_0x3f4978){return function(_0xe3944c){if(!_0xe3944c){_0x4bfb8a[_0x0696('0x27')](0x194);}return _0xe3944c;};}function handleError(_0x59da99,_0x21f0d4){_0x21f0d4=_0x21f0d4||0x1f4;return function(_0x36129f){logger[_0x0696('0x22')](_0x36129f[_0x0696('0x36')]);if(_0x36129f[_0x0696('0x37')]){delete _0x36129f['name'];}_0x59da99[_0x0696('0x28')](_0x21f0d4)['send'](_0x36129f);};}exports[_0x0696('0x38')]=function(_0x717712,_0x34a840){var _0x4cb7ed={},_0x391f0b={},_0x13a665={'count':0x0,'rows':[]};var _0x229887=_[_0x0696('0x39')](db[_0x0696('0x3a')][_0x0696('0x3b')],function(_0x9cfe99){return{'name':_0x9cfe99[_0x0696('0x3c')],'type':_0x9cfe99[_0x0696('0x3d')]['key']};});_0x391f0b['model']=_[_0x0696('0x39')](_0x229887,_0x0696('0x37'));_0x391f0b[_0x0696('0x3e')]=_[_0x0696('0x3f')](_0x717712['query']);_0x391f0b[_0x0696('0x40')]=_['intersection'](_0x391f0b[_0x0696('0x41')],_0x391f0b['query']);_0x4cb7ed[_0x0696('0x42')]=_[_0x0696('0x43')](_0x391f0b[_0x0696('0x41')],qs[_0x0696('0x44')](_0x717712['query'][_0x0696('0x44')]));_0x4cb7ed[_0x0696('0x42')]=_0x4cb7ed['attributes'][_0x0696('0x45')]?_0x4cb7ed[_0x0696('0x42')]:_0x391f0b['model'];if(!_0x717712[_0x0696('0x3e')][_0x0696('0x46')](_0x0696('0x47'))){_0x4cb7ed['limit']=qs[_0x0696('0x2d')](_0x717712['query'][_0x0696('0x2d')]);_0x4cb7ed[_0x0696('0x2b')]=qs['offset'](_0x717712[_0x0696('0x3e')][_0x0696('0x2b')]);}_0x4cb7ed['order']=qs['sort'](_0x717712[_0x0696('0x3e')][_0x0696('0x48')]);_0x4cb7ed['where']=qs[_0x0696('0x40')](_[_0x0696('0x49')](_0x717712[_0x0696('0x3e')],_0x391f0b[_0x0696('0x40')]),_0x229887);if(_0x717712[_0x0696('0x3e')][_0x0696('0x4a')]){_0x4cb7ed['where']=_[_0x0696('0x4b')](_0x4cb7ed[_0x0696('0x4c')],{'$or':_[_0x0696('0x39')](_0x229887,function(_0x1f1d1c){if(_0x1f1d1c[_0x0696('0x3d')]!==_0x0696('0x4d')){var _0xfacc3e={};_0xfacc3e[_0x1f1d1c[_0x0696('0x37')]]={'$like':'%'+_0x717712['query']['filter']+'%'};return _0xfacc3e;}})});}_0x4cb7ed=_[_0x0696('0x4b')]({},_0x4cb7ed,_0x717712[_0x0696('0x4e')]);var _0x30fa3f={'where':_0x4cb7ed[_0x0696('0x4c')]};return db[_0x0696('0x3a')][_0x0696('0x2c')](_0x30fa3f)['then'](function(_0x1034eb){_0x13a665[_0x0696('0x2c')]=_0x1034eb;if(_0x717712[_0x0696('0x3e')]['includeAll']){_0x4cb7ed[_0x0696('0x4f')]=[{'all':!![]}];}return db[_0x0696('0x3a')][_0x0696('0x50')](_0x4cb7ed);})['then'](function(_0xce54f0){_0x13a665['rows']=_0xce54f0;return _0x13a665;})[_0x0696('0x1d')](respondWithFilteredResult(_0x34a840,_0x4cb7ed))[_0x0696('0x26')](handleError(_0x34a840,null));};exports[_0x0696('0x51')]=function(_0x52a6bb,_0x6c3da1){var _0x3dffb6={'raw':![],'where':{'id':_0x52a6bb[_0x0696('0x52')]['id']}},_0x3e49b7={};_0x3e49b7[_0x0696('0x41')]=_[_0x0696('0x3f')](db[_0x0696('0x3a')][_0x0696('0x3b')]);_0x3e49b7[_0x0696('0x3e')]=_[_0x0696('0x3f')](_0x52a6bb[_0x0696('0x3e')]);_0x3e49b7['filters']=_[_0x0696('0x43')](_0x3e49b7['model'],_0x3e49b7[_0x0696('0x3e')]);_0x3dffb6[_0x0696('0x42')]=_[_0x0696('0x43')](_0x3e49b7[_0x0696('0x41')],qs[_0x0696('0x44')](_0x52a6bb[_0x0696('0x3e')]['fields']));_0x3dffb6[_0x0696('0x42')]=_0x3dffb6[_0x0696('0x42')]['length']?_0x3dffb6[_0x0696('0x42')]:_0x3e49b7['model'];if(_0x52a6bb[_0x0696('0x3e')][_0x0696('0x53')]){_0x3dffb6[_0x0696('0x4f')]=[{'all':!![]}];}_0x3dffb6=_[_0x0696('0x4b')]({},_0x3dffb6,_0x52a6bb['options']);return db[_0x0696('0x3a')][_0x0696('0x54')](_0x3dffb6)[_0x0696('0x1d')](handleEntityNotFound(_0x6c3da1,null))['then'](respondWithResult(_0x6c3da1,null))[_0x0696('0x26')](handleError(_0x6c3da1,null));};exports[_0x0696('0x55')]=function(_0x3c7031,_0x118b45,_0x55ac50){var _0x49c240;return db['VoiceContext'][_0x0696('0x55')](_0x3c7031[_0x0696('0x56')],{'raw':!![]})[_0x0696('0x1d')](function(_0x5d1038){_0x49c240=_0x5d1038;return db['VoiceContext'][_0x0696('0x50')]({'raw':!![]});})[_0x0696('0x1d')](function(_0x471e4b){var _0xaadaa9=fs[_0x0696('0x57')](path['join'](config[_0x0696('0x58')],_0x0696('0x59')),_0x0696('0x5a'));var _0x4560c7=ejs['render'](_0xaadaa9,{'contexts':_0x471e4b||[]});fs[_0x0696('0x5b')](_0x0696('0x5c'),_0x4560c7);})[_0x0696('0x1d')](function(){return respondWithRpcPromise('Reload',_0x0696('0x55'),{'module':_0x0696('0x5d')});})[_0x0696('0x1d')](function(){var _0x38b63d=_0x3c7031[_0x0696('0x5e')][_0x0696('0x34')]({'plain':!![]});if(!_0x38b63d)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x38b63d[_0x0696('0x5f')]===_0x0696('0x5e')){var _0x19f34b=_0x49c240[_0x0696('0x34')]({'plain':!![]});return db[_0x0696('0x60')][_0x0696('0x54')]({'where':{'name':'Contexts','userProfileId':_0x38b63d[_0x0696('0x61')]},'raw':!![]})['then'](function(_0x22ecfa){if(_0x22ecfa&&_0x22ecfa[_0x0696('0x62')]===0x0){return db[_0x0696('0x63')][_0x0696('0x55')]({'name':_0x19f34b[_0x0696('0x37')],'resourceId':_0x19f34b['id'],'type':_0x22ecfa[_0x0696('0x37')],'sectionId':_0x22ecfa['id']},{})[_0x0696('0x1d')](function(){return _0x49c240;});}else{return _0x49c240;}})[_0x0696('0x26')](function(_0x1251b8){logger[_0x0696('0x22')](_0x0696('0x64'),_0x1251b8);throw _0x1251b8;});}return _0x49c240;})[_0x0696('0x1d')](respondWithResult(_0x118b45,0xc9))['catch'](handleError(_0x118b45,null));};exports[_0x0696('0x32')]=function(_0x5f459d,_0x3e60c4,_0x121570){var _0x3f311c;return db[_0x0696('0x3a')]['find']({'where':{'id':_0x5f459d[_0x0696('0x52')]['id']}})[_0x0696('0x1d')](handleEntityNotFound(_0x3e60c4,null))['then'](saveUpdates(_0x5f459d[_0x0696('0x56')],null))[_0x0696('0x1d')](function(_0xd2435){if(_0xd2435){_0x3f311c=_0xd2435;return db['VoiceContext'][_0x0696('0x50')]({'raw':!![]});}})[_0x0696('0x1d')](function(_0x114c05){var _0x1b7584=fs['readFileSync'](path[_0x0696('0x65')](config[_0x0696('0x58')],'server/files/templates/context.ejs'),_0x0696('0x5a'));var _0x18e811=ejs[_0x0696('0x66')](_0x1b7584,{'contexts':_0x114c05||[]});fs[_0x0696('0x5b')](_0x0696('0x5c'),_0x18e811);})[_0x0696('0x1d')](function(){return respondWithRpcPromise(_0x0696('0x67'),'update',{'module':_0x0696('0x5d')});})[_0x0696('0x1d')](function(){return _0x3f311c;})[_0x0696('0x1d')](respondWithResult(_0x3e60c4,null))[_0x0696('0x26')](handleError(_0x3e60c4,null));};exports[_0x0696('0x33')]=function(_0x1e1f87,_0x18ca1a,_0x52aabf){var _0x3c51f;return db[_0x0696('0x3a')][_0x0696('0x54')]({'where':{'id':_0x1e1f87['params']['id']}})['then'](handleEntityNotFound(_0x18ca1a,null))[_0x0696('0x1d')](removeEntity(_0x18ca1a,null))[_0x0696('0x1d')](function(){return db['VoiceContext']['findAll']({'raw':!![]});})[_0x0696('0x1d')](function(_0x2774da){var _0x232c42=fs['readFileSync'](path['join'](config[_0x0696('0x58')],_0x0696('0x59')),'utf8');var _0x47b844=ejs[_0x0696('0x66')](_0x232c42,{'contexts':_0x2774da});fs[_0x0696('0x5b')](_0x0696('0x5c'),_0x47b844);return respondWithRpcPromise(_0x0696('0x67'),'destroy',{'module':_0x0696('0x5d')});})[_0x0696('0x26')](handleError(_0x18ca1a,null));}; \ No newline at end of file +var _0x48df=['catch','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','destroy','Contexts','stack','name','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','VoiceContext','rows','params','find','create','body','readFileSync','root','server/files/templates/context.ejs','utf8','render','/etc/asterisk/extensions_xcally_contexts.conf','Reload','chan_sip.so','user','get','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','findAll','join','zip-dir','fast-json-patch','moment','mustache','util','path','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','http','then','info','request\x20sent','VoiceContext,\x20%s,\x20%s,\x20%s','error','VoiceContext,\x20%s,\x20%s','message','result'];(function(_0x33bfdc,_0x2b91c5){var _0x495264=function(_0x273d68){while(--_0x273d68){_0x33bfdc['push'](_0x33bfdc['shift']());}};_0x495264(++_0x2b91c5);}(_0x48df,0x162));var _0xf48d=function(_0x590a38,_0x2bc65c){_0x590a38=_0x590a38-0x0;var _0xf36626=_0x48df[_0x590a38];return _0xf36626;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xf48d('0x0'));var jsonpatch=require(_0xf48d('0x1'));var rp=require('request-promise');var moment=require(_0xf48d('0x2'));var BPromise=require('bluebird');var Mustache=require(_0xf48d('0x3'));var util=require(_0xf48d('0x4'));var path=require(_0xf48d('0x5'));var sox=require('sox');var csv=require(_0xf48d('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf48d('0x7'));var _=require(_0xf48d('0x8'));var squel=require(_0xf48d('0x9'));var crypto=require(_0xf48d('0xa'));var jsforce=require(_0xf48d('0xb'));var deskjs=require(_0xf48d('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xf48d('0xd'));var qs=require(_0xf48d('0xe'));var as=require(_0xf48d('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf48d('0x10'))(_0xf48d('0x11'));var utils=require(_0xf48d('0x12'));var config=require(_0xf48d('0x13'));var licenseUtil=require(_0xf48d('0x14'));var db=require('../../mysqldb')['db'];var jayson=require('jayson/promise');var client=jayson['client'][_0xf48d('0x15')]({'port':0x232a});function respondWithRpcPromise(_0x56f323,_0x40a552,_0x429003,_0x54b828){return new BPromise(function(_0x43575b,_0x2a3e96){var _0x9c15f7=_0x54b828||client;return _0x9c15f7['request'](_0x56f323,_0x429003)[_0xf48d('0x16')](function(_0x11f4de){logger[_0xf48d('0x17')]('VoiceContext,\x20%s,\x20%s',_0x40a552,_0xf48d('0x18'));logger['debug'](_0xf48d('0x19'),_0x40a552,'request\x20sent',JSON['stringify'](_0x11f4de));if(_0x11f4de['error']){if(_0x11f4de[_0xf48d('0x1a')]['code']===0x1f4){logger[_0xf48d('0x1a')](_0xf48d('0x1b'),_0x40a552,_0x11f4de[_0xf48d('0x1a')][_0xf48d('0x1c')]);return _0x2a3e96(_0x11f4de[_0xf48d('0x1a')][_0xf48d('0x1c')]);}logger[_0xf48d('0x1a')](_0xf48d('0x1b'),_0x40a552,_0x11f4de[_0xf48d('0x1a')][_0xf48d('0x1c')]);return _0x43575b(_0x11f4de[_0xf48d('0x1a')][_0xf48d('0x1c')]);}else{logger['info'](_0xf48d('0x1b'),_0x40a552,_0xf48d('0x18'));_0x43575b(_0x11f4de[_0xf48d('0x1d')][_0xf48d('0x1c')]);}})[_0xf48d('0x1e')](function(_0x3dcd93){logger[_0xf48d('0x1a')](_0xf48d('0x1b'),_0x40a552,_0x3dcd93);_0x2a3e96(_0x3dcd93);});});}function respondWithStatusCode(_0x5393e4,_0x2f2e3d){_0x2f2e3d=_0x2f2e3d||0xcc;return function(_0x12a258){if(_0x12a258){return _0x5393e4[_0xf48d('0x1f')](_0x2f2e3d);}return _0x5393e4[_0xf48d('0x20')](_0x2f2e3d)[_0xf48d('0x21')]();};}function respondWithResult(_0x3cbf21,_0x512f0a){_0x512f0a=_0x512f0a||0xc8;return function(_0x41dbef){if(_0x41dbef){return _0x3cbf21[_0xf48d('0x20')](_0x512f0a)[_0xf48d('0x22')](_0x41dbef);}};}function respondWithFilteredResult(_0x593d56,_0x1235b1){return function(_0x4ff29d){if(_0x4ff29d){var _0x336db8=typeof _0x1235b1[_0xf48d('0x23')]===_0xf48d('0x24')&&typeof _0x1235b1['limit']===_0xf48d('0x24');var _0x58c1d5=_0x4ff29d['count'];var _0x1bfe3e=_0x336db8?0x0:_0x1235b1[_0xf48d('0x23')];var _0x2be408=_0x336db8?_0x4ff29d[_0xf48d('0x25')]:_0x1235b1['offset']+_0x1235b1[_0xf48d('0x26')];var _0x5b0303;if(_0x2be408>=_0x58c1d5){_0x2be408=_0x58c1d5;_0x5b0303=0xc8;}else{_0x5b0303=0xce;}_0x593d56[_0xf48d('0x20')](_0x5b0303);return _0x593d56[_0xf48d('0x27')](_0xf48d('0x28'),_0x1bfe3e+'-'+_0x2be408+'/'+_0x58c1d5)[_0xf48d('0x22')](_0x4ff29d);}return null;};}function patchUpdates(_0x25f914){return function(_0x69c53d){try{jsonpatch[_0xf48d('0x29')](_0x69c53d,_0x25f914,!![]);}catch(_0x540da1){return BPromise[_0xf48d('0x2a')](_0x540da1);}return _0x69c53d[_0xf48d('0x2b')]();};}function saveUpdates(_0x49a5d8,_0x3567eb){return function(_0x2af2f2){if(_0x2af2f2){return _0x2af2f2[_0xf48d('0x2c')](_0x49a5d8)[_0xf48d('0x16')](function(_0x52de66){return _0x52de66;});}return null;};}function removeEntity(_0x8cf797,_0x3881c1){return function(_0x3e88b5){if(_0x3e88b5){return _0x3e88b5[_0xf48d('0x2d')]()[_0xf48d('0x16')](function(){var _0x30f451=_0x3e88b5['get']({'plain':!![]});var _0x30c2c1=_0xf48d('0x2e');return db['UserProfileResource']['destroy']({'where':{'type':_0x30c2c1,'resourceId':_0x30f451['id']}})['then'](function(){return _0x3e88b5;});})[_0xf48d('0x16')](function(){_0x8cf797[_0xf48d('0x20')](0xcc)['end']();});}};}function handleEntityNotFound(_0x28a673,_0x7960e4){return function(_0x4cbd16){if(!_0x4cbd16){_0x28a673['sendStatus'](0x194);}return _0x4cbd16;};}function handleError(_0x14d9c8,_0x579913){_0x579913=_0x579913||0x1f4;return function(_0x5edf62){logger[_0xf48d('0x1a')](_0x5edf62[_0xf48d('0x2f')]);if(_0x5edf62['name']){delete _0x5edf62[_0xf48d('0x30')];}_0x14d9c8[_0xf48d('0x20')](_0x579913)['send'](_0x5edf62);};}exports[_0xf48d('0x31')]=function(_0x1a469d,_0x44fe5c){var _0x1dc1b1={},_0x61fb7e={},_0x40a373={'count':0x0,'rows':[]};var _0x1475a0=_[_0xf48d('0x32')](db['VoiceContext'][_0xf48d('0x33')],function(_0x1b8b42){return{'name':_0x1b8b42[_0xf48d('0x34')],'type':_0x1b8b42[_0xf48d('0x35')][_0xf48d('0x36')]};});_0x61fb7e[_0xf48d('0x37')]=_[_0xf48d('0x32')](_0x1475a0,'name');_0x61fb7e[_0xf48d('0x38')]=_[_0xf48d('0x39')](_0x1a469d['query']);_0x61fb7e[_0xf48d('0x3a')]=_[_0xf48d('0x3b')](_0x61fb7e[_0xf48d('0x37')],_0x61fb7e[_0xf48d('0x38')]);_0x1dc1b1[_0xf48d('0x3c')]=_[_0xf48d('0x3b')](_0x61fb7e[_0xf48d('0x37')],qs[_0xf48d('0x3d')](_0x1a469d[_0xf48d('0x38')][_0xf48d('0x3d')]));_0x1dc1b1[_0xf48d('0x3c')]=_0x1dc1b1['attributes'][_0xf48d('0x3e')]?_0x1dc1b1['attributes']:_0x61fb7e['model'];if(!_0x1a469d[_0xf48d('0x38')][_0xf48d('0x3f')](_0xf48d('0x40'))){_0x1dc1b1[_0xf48d('0x26')]=qs[_0xf48d('0x26')](_0x1a469d[_0xf48d('0x38')][_0xf48d('0x26')]);_0x1dc1b1['offset']=qs[_0xf48d('0x23')](_0x1a469d[_0xf48d('0x38')][_0xf48d('0x23')]);}_0x1dc1b1['order']=qs[_0xf48d('0x41')](_0x1a469d['query'][_0xf48d('0x41')]);_0x1dc1b1[_0xf48d('0x42')]=qs[_0xf48d('0x3a')](_[_0xf48d('0x43')](_0x1a469d[_0xf48d('0x38')],_0x61fb7e[_0xf48d('0x3a')]),_0x1475a0);if(_0x1a469d['query'][_0xf48d('0x44')]){_0x1dc1b1['where']=_['merge'](_0x1dc1b1[_0xf48d('0x42')],{'$or':_[_0xf48d('0x32')](_0x1475a0,function(_0x1489ca){if(_0x1489ca[_0xf48d('0x35')]!==_0xf48d('0x45')){var _0x567036={};_0x567036[_0x1489ca[_0xf48d('0x30')]]={'$like':'%'+_0x1a469d[_0xf48d('0x38')][_0xf48d('0x44')]+'%'};return _0x567036;}})});}_0x1dc1b1=_[_0xf48d('0x46')]({},_0x1dc1b1,_0x1a469d[_0xf48d('0x47')]);var _0x1388c4={'where':_0x1dc1b1[_0xf48d('0x42')]};return db['VoiceContext'][_0xf48d('0x25')](_0x1388c4)['then'](function(_0x5b90bb){_0x40a373['count']=_0x5b90bb;if(_0x1a469d['query'][_0xf48d('0x48')]){_0x1dc1b1[_0xf48d('0x49')]=[{'all':!![]}];}return db[_0xf48d('0x4a')]['findAll'](_0x1dc1b1);})[_0xf48d('0x16')](function(_0x4d9563){_0x40a373[_0xf48d('0x4b')]=_0x4d9563;return _0x40a373;})[_0xf48d('0x16')](respondWithFilteredResult(_0x44fe5c,_0x1dc1b1))[_0xf48d('0x1e')](handleError(_0x44fe5c,null));};exports['show']=function(_0x262166,_0x3c75f3){var _0x197597={'raw':![],'where':{'id':_0x262166[_0xf48d('0x4c')]['id']}},_0x26bb58={};_0x26bb58[_0xf48d('0x37')]=_[_0xf48d('0x39')](db[_0xf48d('0x4a')][_0xf48d('0x33')]);_0x26bb58[_0xf48d('0x38')]=_[_0xf48d('0x39')](_0x262166[_0xf48d('0x38')]);_0x26bb58[_0xf48d('0x3a')]=_[_0xf48d('0x3b')](_0x26bb58[_0xf48d('0x37')],_0x26bb58['query']);_0x197597[_0xf48d('0x3c')]=_[_0xf48d('0x3b')](_0x26bb58[_0xf48d('0x37')],qs[_0xf48d('0x3d')](_0x262166['query']['fields']));_0x197597[_0xf48d('0x3c')]=_0x197597[_0xf48d('0x3c')][_0xf48d('0x3e')]?_0x197597[_0xf48d('0x3c')]:_0x26bb58[_0xf48d('0x37')];if(_0x262166[_0xf48d('0x38')][_0xf48d('0x48')]){_0x197597[_0xf48d('0x49')]=[{'all':!![]}];}_0x197597=_[_0xf48d('0x46')]({},_0x197597,_0x262166[_0xf48d('0x47')]);return db[_0xf48d('0x4a')][_0xf48d('0x4d')](_0x197597)['then'](handleEntityNotFound(_0x3c75f3,null))[_0xf48d('0x16')](respondWithResult(_0x3c75f3,null))[_0xf48d('0x1e')](handleError(_0x3c75f3,null));};exports[_0xf48d('0x4e')]=function(_0x29285d,_0x38e889,_0x5773e0){var _0x1e8d2a;return db[_0xf48d('0x4a')]['create'](_0x29285d[_0xf48d('0x4f')],{'raw':!![]})['then'](function(_0x577397){_0x1e8d2a=_0x577397;return db[_0xf48d('0x4a')]['findAll']({'raw':!![]});})['then'](function(_0x1f3284){var _0x20d6e0=fs[_0xf48d('0x50')](path['join'](config[_0xf48d('0x51')],_0xf48d('0x52')),_0xf48d('0x53'));var _0x1ceaf6=ejs[_0xf48d('0x54')](_0x20d6e0,{'contexts':_0x1f3284||[]});fs['writeFileSync'](_0xf48d('0x55'),_0x1ceaf6);})[_0xf48d('0x16')](function(){return respondWithRpcPromise(_0xf48d('0x56'),'create',{'module':_0xf48d('0x57')});})['then'](function(){var _0x1e60a4=_0x29285d[_0xf48d('0x58')]['get']({'plain':!![]});if(!_0x1e60a4)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1e60a4['role']===_0xf48d('0x58')){var _0x5f0590=_0x1e8d2a[_0xf48d('0x59')]({'plain':!![]});return db[_0xf48d('0x5a')][_0xf48d('0x4d')]({'where':{'name':_0xf48d('0x2e'),'userProfileId':_0x1e60a4[_0xf48d('0x5b')]},'raw':!![]})[_0xf48d('0x16')](function(_0x4c0b95){if(_0x4c0b95&&_0x4c0b95[_0xf48d('0x5c')]===0x0){return db['UserProfileResource'][_0xf48d('0x4e')]({'name':_0x5f0590[_0xf48d('0x30')],'resourceId':_0x5f0590['id'],'type':_0x4c0b95[_0xf48d('0x30')],'sectionId':_0x4c0b95['id']},{})[_0xf48d('0x16')](function(){return _0x1e8d2a;});}else{return _0x1e8d2a;}})[_0xf48d('0x1e')](function(_0x36e9b6){logger[_0xf48d('0x1a')](_0xf48d('0x5d'),_0x36e9b6);throw _0x36e9b6;});}return _0x1e8d2a;})[_0xf48d('0x16')](respondWithResult(_0x38e889,0xc9))[_0xf48d('0x1e')](handleError(_0x38e889,null));};exports[_0xf48d('0x2c')]=function(_0x46e80f,_0x39123e,_0x313527){var _0x2f76dd;return db[_0xf48d('0x4a')][_0xf48d('0x4d')]({'where':{'id':_0x46e80f[_0xf48d('0x4c')]['id']}})[_0xf48d('0x16')](handleEntityNotFound(_0x39123e,null))[_0xf48d('0x16')](saveUpdates(_0x46e80f['body'],null))[_0xf48d('0x16')](function(_0x44008d){if(_0x44008d){_0x2f76dd=_0x44008d;return db[_0xf48d('0x4a')][_0xf48d('0x5e')]({'raw':!![]});}})[_0xf48d('0x16')](function(_0x381cab){var _0x2d3f82=fs[_0xf48d('0x50')](path[_0xf48d('0x5f')](config[_0xf48d('0x51')],_0xf48d('0x52')),_0xf48d('0x53'));var _0x365418=ejs[_0xf48d('0x54')](_0x2d3f82,{'contexts':_0x381cab||[]});fs['writeFileSync'](_0xf48d('0x55'),_0x365418);})['then'](function(){return respondWithRpcPromise(_0xf48d('0x56'),_0xf48d('0x2c'),{'module':'chan_sip.so'});})[_0xf48d('0x16')](function(){return _0x2f76dd;})['then'](respondWithResult(_0x39123e,null))[_0xf48d('0x1e')](handleError(_0x39123e,null));};exports['destroy']=function(_0x4b83fe,_0x10a631,_0x38619e){var _0x49fb8c;return db['VoiceContext'][_0xf48d('0x4d')]({'where':{'id':_0x4b83fe[_0xf48d('0x4c')]['id']}})[_0xf48d('0x16')](handleEntityNotFound(_0x10a631,null))[_0xf48d('0x16')](removeEntity(_0x10a631,null))[_0xf48d('0x16')](function(){return db['VoiceContext'][_0xf48d('0x5e')]({'raw':!![]});})[_0xf48d('0x16')](function(_0x20cbb3){var _0x20c0a6=fs[_0xf48d('0x50')](path[_0xf48d('0x5f')](config[_0xf48d('0x51')],_0xf48d('0x52')),'utf8');var _0x2c234b=ejs[_0xf48d('0x54')](_0x20c0a6,{'contexts':_0x20cbb3});fs['writeFileSync']('/etc/asterisk/extensions_xcally_contexts.conf',_0x2c234b);return respondWithRpcPromise(_0xf48d('0x56'),_0xf48d('0x2d'),{'module':_0xf48d('0x57')});})['catch'](handleError(_0x10a631,null));}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.model.js b/server/api/voiceContext/voiceContext.model.js index a0eb817..3c61cf8 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 _0xa37a=['bluebird','request-promise','path','rimraf','../../config/environment','./voiceContext.attributes','exports','VoiceContext','voice_contexts','util'];(function(_0x2ad502,_0x2b6085){var _0x24fdfc=function(_0x5821ec){while(--_0x5821ec){_0x2ad502['push'](_0x2ad502['shift']());}};_0x24fdfc(++_0x2b6085);}(_0xa37a,0x135));var _0xaa37=function(_0x5d8661,_0x138fa8){_0x5d8661=_0x5d8661-0x0;var _0x4c3da7=_0xa37a[_0x5d8661];return _0x4c3da7;};'use strict';var _=require('lodash');var util=require(_0xaa37('0x0'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xaa37('0x1'));var rp=require(_0xaa37('0x2'));var fs=require('fs');var path=require(_0xaa37('0x3'));var rimraf=require(_0xaa37('0x4'));var config=require(_0xaa37('0x5'));var attributes=require(_0xaa37('0x6'));module[_0xaa37('0x7')]=function(_0x2fa31a,_0x247706){return _0x2fa31a['define'](_0xaa37('0x8'),attributes,{'tableName':_0xaa37('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xed22=['../../config/environment','./voiceContext.attributes','voice_contexts','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x4a5bb2,_0x36ce56){var _0x38c97a=function(_0x4d1990){while(--_0x4d1990){_0x4a5bb2['push'](_0x4a5bb2['shift']());}};_0x38c97a(++_0x36ce56);}(_0xed22,0x87));var _0x2ed2=function(_0xb04032,_0x5e0cad){_0xb04032=_0xb04032-0x0;var _0x2b0248=_0xed22[_0xb04032];return _0x2b0248;};'use strict';var _=require(_0x2ed2('0x0'));var util=require(_0x2ed2('0x1'));var logger=require(_0x2ed2('0x2'))(_0x2ed2('0x3'));var moment=require(_0x2ed2('0x4'));var BPromise=require(_0x2ed2('0x5'));var rp=require(_0x2ed2('0x6'));var fs=require('fs');var path=require(_0x2ed2('0x7'));var rimraf=require(_0x2ed2('0x8'));var config=require(_0x2ed2('0x9'));var attributes=require(_0x2ed2('0xa'));module['exports']=function(_0x1d8a36,_0x15ee88){return _0x1d8a36['define']('VoiceContext',attributes,{'tableName':_0x2ed2('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 12154a2..6a31552 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 _0x1a4d=['message','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','VoiceContext,\x20%s,\x20%s','debug','VoiceContext,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code'];(function(_0x3ebdaf,_0x39ee83){var _0x3bc141=function(_0x1d0fa8){while(--_0x1d0fa8){_0x3ebdaf['push'](_0x3ebdaf['shift']());}};_0x3bc141(++_0x39ee83);}(_0x1a4d,0x189));var _0xd1a4=function(_0x2bec0e,_0x2d06b3){_0x2bec0e=_0x2bec0e-0x0;var _0x439982=_0x1a4d[_0x2bec0e];return _0x439982;};'use strict';var _=require(_0xd1a4('0x0'));var util=require(_0xd1a4('0x1'));var moment=require('moment');var BPromise=require(_0xd1a4('0x2'));var rs=require(_0xd1a4('0x3'));var fs=require('fs');var Redis=require(_0xd1a4('0x4'));var db=require(_0xd1a4('0x5'))['db'];var utils=require(_0xd1a4('0x6'));var logger=require(_0xd1a4('0x7'))(_0xd1a4('0x8'));var config=require(_0xd1a4('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xd1a4('0xa')][_0xd1a4('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x29010f,_0x37f83c,_0x238061){return new BPromise(function(_0x86c4e4,_0xb89e6){return client[_0xd1a4('0xc')](_0x29010f,_0x238061)[_0xd1a4('0xd')](function(_0x1c6c5d){logger['info'](_0xd1a4('0xe'),_0x37f83c,'request\x20sent');logger[_0xd1a4('0xf')](_0xd1a4('0x10'),_0x37f83c,_0xd1a4('0x11'),JSON[_0xd1a4('0x12')](_0x1c6c5d));if(_0x1c6c5d[_0xd1a4('0x13')]){if(_0x1c6c5d[_0xd1a4('0x13')][_0xd1a4('0x14')]===0x1f4){logger[_0xd1a4('0x13')](_0xd1a4('0xe'),_0x37f83c,_0x1c6c5d[_0xd1a4('0x13')]['message']);return _0xb89e6(_0x1c6c5d[_0xd1a4('0x13')]['message']);}logger[_0xd1a4('0x13')](_0xd1a4('0xe'),_0x37f83c,_0x1c6c5d[_0xd1a4('0x13')]['message']);return _0x86c4e4(_0x1c6c5d[_0xd1a4('0x13')][_0xd1a4('0x15')]);}else{logger['info']('VoiceContext,\x20%s,\x20%s',_0x37f83c,_0xd1a4('0x11'));_0x86c4e4(_0x1c6c5d['result']['message']);}})[_0xd1a4('0x16')](function(_0x426a47){logger['error'](_0xd1a4('0xe'),_0x37f83c,_0x426a47);_0xb89e6(_0x426a47);});});} \ No newline at end of file +var _0xa9cd=['debug','VoiceContext,\x20%s,\x20%s,\x20%s','error','message','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','VoiceContext,\x20%s,\x20%s','request\x20sent'];(function(_0x38a7ac,_0x45514b){var _0x53061a=function(_0x1d2469){while(--_0x1d2469){_0x38a7ac['push'](_0x38a7ac['shift']());}};_0x53061a(++_0x45514b);}(_0xa9cd,0x187));var _0xda9c=function(_0x3c72c4,_0x507632){_0x3c72c4=_0x3c72c4-0x0;var _0x24645f=_0xa9cd[_0x3c72c4];return _0x24645f;};'use strict';var _=require(_0xda9c('0x0'));var util=require(_0xda9c('0x1'));var moment=require(_0xda9c('0x2'));var BPromise=require(_0xda9c('0x3'));var rs=require(_0xda9c('0x4'));var fs=require('fs');var Redis=require(_0xda9c('0x5'));var db=require(_0xda9c('0x6'))['db'];var utils=require(_0xda9c('0x7'));var logger=require('../../config/logger')(_0xda9c('0x8'));var config=require(_0xda9c('0x9'));var jayson=require(_0xda9c('0xa'));var client=jayson[_0xda9c('0xb')][_0xda9c('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x38349b,_0x52e9fb,_0x59b7c3){return new BPromise(function(_0x5a401e,_0x9bbe75){return client[_0xda9c('0xd')](_0x38349b,_0x59b7c3)[_0xda9c('0xe')](function(_0x208997){logger['info'](_0xda9c('0xf'),_0x52e9fb,_0xda9c('0x10'));logger[_0xda9c('0x11')](_0xda9c('0x12'),_0x52e9fb,_0xda9c('0x10'),JSON['stringify'](_0x208997));if(_0x208997[_0xda9c('0x13')]){if(_0x208997[_0xda9c('0x13')]['code']===0x1f4){logger['error'](_0xda9c('0xf'),_0x52e9fb,_0x208997[_0xda9c('0x13')][_0xda9c('0x14')]);return _0x9bbe75(_0x208997[_0xda9c('0x13')]['message']);}logger[_0xda9c('0x13')]('VoiceContext,\x20%s,\x20%s',_0x52e9fb,_0x208997['error'][_0xda9c('0x14')]);return _0x5a401e(_0x208997[_0xda9c('0x13')][_0xda9c('0x14')]);}else{logger[_0xda9c('0x15')](_0xda9c('0xf'),_0x52e9fb,'request\x20sent');_0x5a401e(_0x208997[_0xda9c('0x16')][_0xda9c('0x14')]);}})[_0xda9c('0x17')](function(_0x1db4f7){logger[_0xda9c('0x13')](_0xda9c('0xf'),_0x52e9fb,_0x1db4f7);_0x9bbe75(_0x1db4f7);});});} \ No newline at end of file diff --git a/server/api/voiceDialReport/index.js b/server/api/voiceDialReport/index.js index aaba074..f830f95 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 _0x05cd=['create','put','/:id','update','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','get','index','/describe','isAuthenticated','show'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x05cd,0x65));var _0xd05c=function(_0x6ab1f,_0x168847){_0x6ab1f=_0x6ab1f-0x0;var _0x52b066=_0x05cd[_0x6ab1f];return _0x52b066;};'use strict';var multer=require(_0xd05c('0x0'));var util=require(_0xd05c('0x1'));var path=require(_0xd05c('0x2'));var timeout=require(_0xd05c('0x3'));var express=require(_0xd05c('0x4'));var router=express[_0xd05c('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xd05c('0x6'));var interaction=require(_0xd05c('0x7'));var config=require('../../config/environment');var controller=require('./voiceDialReport.controller');router[_0xd05c('0x8')]('/',auth['isAuthenticated'](),controller[_0xd05c('0x9')]);router['get'](_0xd05c('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0xd05c('0x8')]('/:id',auth[_0xd05c('0xb')](),controller[_0xd05c('0xc')]);router['post']('/',auth[_0xd05c('0xb')](),controller[_0xd05c('0xd')]);router[_0xd05c('0xe')](_0xd05c('0xf'),auth[_0xd05c('0xb')](),controller[_0xd05c('0x10')]);router['delete'](_0xd05c('0xf'),auth[_0xd05c('0xb')](),controller[_0xd05c('0x11')]);module[_0xd05c('0x12')]=router; \ No newline at end of file +var _0xa8a8=['create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceDialReport.controller','get','isAuthenticated','index','/describe','describe','/:id','post'];(function(_0x1ceafa,_0x252713){var _0x2cb283=function(_0x3b68c9){while(--_0x3b68c9){_0x1ceafa['push'](_0x1ceafa['shift']());}};_0x2cb283(++_0x252713);}(_0xa8a8,0xec));var _0x8a8a=function(_0x42d9ce,_0x2f157f){_0x42d9ce=_0x42d9ce-0x0;var _0xb8cdc8=_0xa8a8[_0x42d9ce];return _0xb8cdc8;};'use strict';var multer=require(_0x8a8a('0x0'));var util=require(_0x8a8a('0x1'));var path=require(_0x8a8a('0x2'));var timeout=require(_0x8a8a('0x3'));var express=require('express');var router=express[_0x8a8a('0x4')]();var fs_extra=require(_0x8a8a('0x5'));var auth=require(_0x8a8a('0x6'));var interaction=require(_0x8a8a('0x7'));var config=require(_0x8a8a('0x8'));var controller=require(_0x8a8a('0x9'));router[_0x8a8a('0xa')]('/',auth[_0x8a8a('0xb')](),controller[_0x8a8a('0xc')]);router[_0x8a8a('0xa')](_0x8a8a('0xd'),auth[_0x8a8a('0xb')](),controller[_0x8a8a('0xe')]);router[_0x8a8a('0xa')](_0x8a8a('0xf'),auth['isAuthenticated'](),controller['show']);router[_0x8a8a('0x10')]('/',auth['isAuthenticated'](),controller[_0x8a8a('0x11')]);router[_0x8a8a('0x12')]('/:id',auth[_0x8a8a('0xb')](),controller[_0x8a8a('0x13')]);router[_0x8a8a('0x14')]('/:id',auth[_0x8a8a('0xb')](),controller[_0x8a8a('0x15')]);module[_0x8a8a('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 dd674ef..ae50e5f 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 _0x54ef=['STRING','INTEGER','DATE','called,connect,complete','sequelize','exports'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x54ef,0x112));var _0xf54e=function(_0x212eb2,_0xd810f4){_0x212eb2=_0x212eb2-0x0;var _0x1a4565=_0x54ef[_0x212eb2];return _0x1a4565;};'use strict';var Sequelize=require(_0xf54e('0x0'));module[_0xf54e('0x1')]={'privilege':{'type':Sequelize[_0xf54e('0x2')]},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize[_0xf54e('0x3')]},'channelstatedesc':{'type':Sequelize[_0xf54e('0x2')]},'calleridnum':{'type':Sequelize[_0xf54e('0x2')]},'calleridname':{'type':Sequelize[_0xf54e('0x2')]},'connectedlinenum':{'type':Sequelize[_0xf54e('0x2')]},'connectedlinename':{'type':Sequelize[_0xf54e('0x2')]},'language':{'type':Sequelize[_0xf54e('0x2')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0xf54e('0x2')]},'priority':{'type':Sequelize[_0xf54e('0x3')]},'uniqueid':{'type':Sequelize[_0xf54e('0x2')]},'linkedid':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize[_0xf54e('0x2')]},'destchannelstate':{'type':Sequelize['INTEGER']},'destchannelstatedesc':{'type':Sequelize[_0xf54e('0x2')]},'destcalleridnum':{'type':Sequelize[_0xf54e('0x2')]},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize[_0xf54e('0x2')]},'destconnectedlinename':{'type':Sequelize[_0xf54e('0x2')]},'destlanguage':{'type':Sequelize[_0xf54e('0x2')]},'destaccountcode':{'type':Sequelize[_0xf54e('0x2')]},'destcontext':{'type':Sequelize['STRING']},'destexten':{'type':Sequelize[_0xf54e('0x2')]},'destpriority':{'type':Sequelize[_0xf54e('0x3')]},'destuniqueid':{'type':Sequelize[_0xf54e('0x2')]},'destlinkedid':{'type':Sequelize[_0xf54e('0x2')]},'dialstring':{'type':Sequelize['STRING']},'dialstatus':{'type':Sequelize[_0xf54e('0x2')]},'starttime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0xf54e('0x4')]},'lastevent':{'type':Sequelize[_0xf54e('0x2')],'comment':_0xf54e('0x5')},'routeId':{'type':Sequelize[_0xf54e('0x3')]},'duration':{'type':Sequelize['INTEGER']},'holdtime':{'type':Sequelize[_0xf54e('0x3')]},'billableseconds':{'type':Sequelize[_0xf54e('0x3')]}}; \ No newline at end of file +var _0xf2ca=['DATE','called,connect,complete','sequelize','exports','STRING','INTEGER'];(function(_0x5daa69,_0x528fe9){var _0x1908c3=function(_0x47b226){while(--_0x47b226){_0x5daa69['push'](_0x5daa69['shift']());}};_0x1908c3(++_0x528fe9);}(_0xf2ca,0x16a));var _0xaf2c=function(_0x503564,_0x55867e){_0x503564=_0x503564-0x0;var _0x4be9fd=_0xf2ca[_0x503564];return _0x4be9fd;};'use strict';var Sequelize=require(_0xaf2c('0x0'));module[_0xaf2c('0x1')]={'privilege':{'type':Sequelize[_0xaf2c('0x2')]},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize[_0xaf2c('0x3')]},'channelstatedesc':{'type':Sequelize[_0xaf2c('0x2')]},'calleridnum':{'type':Sequelize[_0xaf2c('0x2')]},'calleridname':{'type':Sequelize[_0xaf2c('0x2')]},'connectedlinenum':{'type':Sequelize[_0xaf2c('0x2')]},'connectedlinename':{'type':Sequelize[_0xaf2c('0x2')]},'language':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0xaf2c('0x2')]},'context':{'type':Sequelize[_0xaf2c('0x2')]},'exten':{'type':Sequelize[_0xaf2c('0x2')]},'priority':{'type':Sequelize[_0xaf2c('0x3')]},'uniqueid':{'type':Sequelize['STRING']},'linkedid':{'type':Sequelize[_0xaf2c('0x2')]},'destchannel':{'type':Sequelize[_0xaf2c('0x2')]},'destchannelstate':{'type':Sequelize['INTEGER']},'destchannelstatedesc':{'type':Sequelize[_0xaf2c('0x2')]},'destcalleridnum':{'type':Sequelize['STRING']},'destcalleridname':{'type':Sequelize[_0xaf2c('0x2')]},'destconnectedlinenum':{'type':Sequelize['STRING']},'destconnectedlinename':{'type':Sequelize[_0xaf2c('0x2')]},'destlanguage':{'type':Sequelize[_0xaf2c('0x2')]},'destaccountcode':{'type':Sequelize[_0xaf2c('0x2')]},'destcontext':{'type':Sequelize[_0xaf2c('0x2')]},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize['INTEGER']},'destuniqueid':{'type':Sequelize[_0xaf2c('0x2')]},'destlinkedid':{'type':Sequelize[_0xaf2c('0x2')]},'dialstring':{'type':Sequelize[_0xaf2c('0x2')]},'dialstatus':{'type':Sequelize[_0xaf2c('0x2')]},'starttime':{'type':Sequelize[_0xaf2c('0x4')]},'answertime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize['DATE']},'lastevent':{'type':Sequelize[_0xaf2c('0x2')],'comment':_0xaf2c('0x5')},'routeId':{'type':Sequelize[_0xaf2c('0x3')]},'duration':{'type':Sequelize[_0xaf2c('0x3')]},'holdtime':{'type':Sequelize[_0xaf2c('0x3')]},'billableseconds':{'type':Sequelize[_0xaf2c('0x3')]}}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.controller.js b/server/api/voiceDialReport/voiceDialReport.controller.js index e638d4e..5ef7ff8 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 _0x10ec=['reject','update','then','destroy','end','stack','name','send','map','VoiceDialReport','rawAttributes','fieldName','key','keys','query','intersection','length','attributes','nolimit','order','sort','where','filters','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','catch','show','params','model','fields','create','body','find','describe','eml-format','rimraf','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','count','limit','Content-Range','apply'];(function(_0x5370b0,_0x328e3b){var _0x431856=function(_0x4410c8){while(--_0x4410c8){_0x5370b0['push'](_0x5370b0['shift']());}};_0x431856(++_0x328e3b);}(_0x10ec,0x1eb));var _0xc10e=function(_0x53ccf2,_0x13cb67){_0x53ccf2=_0x53ccf2-0x0;var _0x5a2964=_0x10ec[_0x53ccf2];return _0x5a2964;};'use strict';var emlformat=require(_0xc10e('0x0'));var rimraf=require(_0xc10e('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc10e('0x2'));var rp=require(_0xc10e('0x3'));var moment=require('moment');var BPromise=require(_0xc10e('0x4'));var Mustache=require('mustache');var util=require(_0xc10e('0x5'));var path=require(_0xc10e('0x6'));var sox=require(_0xc10e('0x7'));var csv=require(_0xc10e('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc10e('0x9'));var _=require(_0xc10e('0xa'));var squel=require(_0xc10e('0xb'));var crypto=require(_0xc10e('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xc10e('0xd'));var toCsv=require('to-csv');var querystring=require(_0xc10e('0xe'));var Papa=require(_0xc10e('0xf'));var Redis=require(_0xc10e('0x10'));var authService=require(_0xc10e('0x11'));var qs=require(_0xc10e('0x12'));var as=require(_0xc10e('0x13'));var hardwareService=require(_0xc10e('0x14'));var logger=require(_0xc10e('0x15'))(_0xc10e('0x16'));var utils=require(_0xc10e('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xc10e('0x18'));var db=require(_0xc10e('0x19'))['db'];function respondWithStatusCode(_0x7f70f2,_0x57e0bd){_0x57e0bd=_0x57e0bd||0xcc;return function(_0x2e2c7c){if(_0x2e2c7c){return _0x7f70f2[_0xc10e('0x1a')](_0x57e0bd);}return _0x7f70f2[_0xc10e('0x1b')](_0x57e0bd)['end']();};}function respondWithResult(_0x4c1224,_0x197d31){_0x197d31=_0x197d31||0xc8;return function(_0x2b053e){if(_0x2b053e){return _0x4c1224[_0xc10e('0x1b')](_0x197d31)[_0xc10e('0x1c')](_0x2b053e);}};}function respondWithFilteredResult(_0x125fd4,_0x57f5d1){return function(_0x293b86){if(_0x293b86){var _0x1e7c0e=typeof _0x57f5d1[_0xc10e('0x1d')]==='undefined'&&typeof _0x57f5d1['limit']==='undefined';var _0x3dbc63=_0x293b86['count'];var _0x46357b=_0x1e7c0e?0x0:_0x57f5d1[_0xc10e('0x1d')];var _0x39b23b=_0x1e7c0e?_0x293b86[_0xc10e('0x1e')]:_0x57f5d1[_0xc10e('0x1d')]+_0x57f5d1[_0xc10e('0x1f')];var _0x331238;if(_0x39b23b>=_0x3dbc63){_0x39b23b=_0x3dbc63;_0x331238=0xc8;}else{_0x331238=0xce;}_0x125fd4[_0xc10e('0x1b')](_0x331238);return _0x125fd4['set'](_0xc10e('0x20'),_0x46357b+'-'+_0x39b23b+'/'+_0x3dbc63)[_0xc10e('0x1c')](_0x293b86);}return null;};}function patchUpdates(_0x5577ef){return function(_0x4f1eb3){try{jsonpatch[_0xc10e('0x21')](_0x4f1eb3,_0x5577ef,!![]);}catch(_0x546c4a){return BPromise[_0xc10e('0x22')](_0x546c4a);}return _0x4f1eb3['save']();};}function saveUpdates(_0x3f38ef,_0x25429c){return function(_0x29602){if(_0x29602){return _0x29602[_0xc10e('0x23')](_0x3f38ef)[_0xc10e('0x24')](function(_0x2f7cf2){return _0x2f7cf2;});}return null;};}function removeEntity(_0x1433c6,_0x466125){return function(_0x57cb75){if(_0x57cb75){return _0x57cb75[_0xc10e('0x25')]()[_0xc10e('0x24')](function(){_0x1433c6[_0xc10e('0x1b')](0xcc)[_0xc10e('0x26')]();});}};}function handleEntityNotFound(_0x20139d,_0x10fc73){return function(_0x523f6d){if(!_0x523f6d){_0x20139d['sendStatus'](0x194);}return _0x523f6d;};}function handleError(_0xbfebf4,_0x5bb0ed){_0x5bb0ed=_0x5bb0ed||0x1f4;return function(_0x5bad87){logger['error'](_0x5bad87[_0xc10e('0x27')]);if(_0x5bad87['name']){delete _0x5bad87[_0xc10e('0x28')];}_0xbfebf4['status'](_0x5bb0ed)[_0xc10e('0x29')](_0x5bad87);};}exports['index']=function(_0x27eb8e,_0x580b40){var _0x5c9568={},_0x383f18={},_0x3960e5={'count':0x0,'rows':[]};var _0x4b81e1=_[_0xc10e('0x2a')](db[_0xc10e('0x2b')][_0xc10e('0x2c')],function(_0x562fc8){return{'name':_0x562fc8[_0xc10e('0x2d')],'type':_0x562fc8['type'][_0xc10e('0x2e')]};});_0x383f18['model']=_[_0xc10e('0x2a')](_0x4b81e1,_0xc10e('0x28'));_0x383f18['query']=_[_0xc10e('0x2f')](_0x27eb8e[_0xc10e('0x30')]);_0x383f18['filters']=_[_0xc10e('0x31')](_0x383f18['model'],_0x383f18[_0xc10e('0x30')]);_0x5c9568['attributes']=_[_0xc10e('0x31')](_0x383f18['model'],qs['fields'](_0x27eb8e['query']['fields']));_0x5c9568['attributes']=_0x5c9568['attributes'][_0xc10e('0x32')]?_0x5c9568[_0xc10e('0x33')]:_0x383f18['model'];if(!_0x27eb8e[_0xc10e('0x30')]['hasOwnProperty'](_0xc10e('0x34'))){_0x5c9568[_0xc10e('0x1f')]=qs[_0xc10e('0x1f')](_0x27eb8e['query'][_0xc10e('0x1f')]);_0x5c9568[_0xc10e('0x1d')]=qs[_0xc10e('0x1d')](_0x27eb8e[_0xc10e('0x30')][_0xc10e('0x1d')]);}_0x5c9568[_0xc10e('0x35')]=qs[_0xc10e('0x36')](_0x27eb8e[_0xc10e('0x30')][_0xc10e('0x36')]);_0x5c9568[_0xc10e('0x37')]=qs[_0xc10e('0x38')](_[_0xc10e('0x39')](_0x27eb8e['query'],_0x383f18['filters']),_0x4b81e1);if(_0x27eb8e[_0xc10e('0x30')][_0xc10e('0x3a')]){_0x5c9568['where']=_[_0xc10e('0x3b')](_0x5c9568[_0xc10e('0x37')],{'$or':_[_0xc10e('0x2a')](_0x4b81e1,function(_0x54ff40){if(_0x54ff40[_0xc10e('0x3c')]!==_0xc10e('0x3d')){var _0x4a0f00={};_0x4a0f00[_0x54ff40[_0xc10e('0x28')]]={'$like':'%'+_0x27eb8e[_0xc10e('0x30')]['filter']+'%'};return _0x4a0f00;}})});}_0x5c9568=_[_0xc10e('0x3b')]({},_0x5c9568,_0x27eb8e[_0xc10e('0x3e')]);var _0x237882={'where':_0x5c9568[_0xc10e('0x37')]};return db[_0xc10e('0x2b')]['count'](_0x237882)[_0xc10e('0x24')](function(_0x2922f2){_0x3960e5[_0xc10e('0x1e')]=_0x2922f2;if(_0x27eb8e[_0xc10e('0x30')][_0xc10e('0x3f')]){_0x5c9568[_0xc10e('0x40')]=[{'all':!![]}];}return db[_0xc10e('0x2b')][_0xc10e('0x41')](_0x5c9568);})[_0xc10e('0x24')](function(_0xb4d856){_0x3960e5['rows']=_0xb4d856;return _0x3960e5;})[_0xc10e('0x24')](respondWithFilteredResult(_0x580b40,_0x5c9568))[_0xc10e('0x42')](handleError(_0x580b40,null));};exports[_0xc10e('0x43')]=function(_0x2a7a38,_0x6855f0){var _0x4ed40f={'raw':!![],'where':{'id':_0x2a7a38[_0xc10e('0x44')]['id']}},_0xc6b6e8={};_0xc6b6e8[_0xc10e('0x45')]=_[_0xc10e('0x2f')](db['VoiceDialReport'][_0xc10e('0x2c')]);_0xc6b6e8[_0xc10e('0x30')]=_[_0xc10e('0x2f')](_0x2a7a38[_0xc10e('0x30')]);_0xc6b6e8[_0xc10e('0x38')]=_[_0xc10e('0x31')](_0xc6b6e8['model'],_0xc6b6e8['query']);_0x4ed40f[_0xc10e('0x33')]=_[_0xc10e('0x31')](_0xc6b6e8[_0xc10e('0x45')],qs[_0xc10e('0x46')](_0x2a7a38[_0xc10e('0x30')][_0xc10e('0x46')]));_0x4ed40f[_0xc10e('0x33')]=_0x4ed40f[_0xc10e('0x33')]['length']?_0x4ed40f[_0xc10e('0x33')]:_0xc6b6e8[_0xc10e('0x45')];if(_0x2a7a38[_0xc10e('0x30')]['includeAll']){_0x4ed40f[_0xc10e('0x40')]=[{'all':!![]}];}_0x4ed40f=_['merge']({},_0x4ed40f,_0x2a7a38[_0xc10e('0x3e')]);return db[_0xc10e('0x2b')]['find'](_0x4ed40f)[_0xc10e('0x24')](handleEntityNotFound(_0x6855f0,null))['then'](respondWithResult(_0x6855f0,null))['catch'](handleError(_0x6855f0,null));};exports[_0xc10e('0x47')]=function(_0x295458,_0x14eab9){return db[_0xc10e('0x2b')][_0xc10e('0x47')](_0x295458[_0xc10e('0x48')],{})[_0xc10e('0x24')](respondWithResult(_0x14eab9,0xc9))[_0xc10e('0x42')](handleError(_0x14eab9,null));};exports[_0xc10e('0x23')]=function(_0x295fdb,_0x279caf){if(_0x295fdb[_0xc10e('0x48')]['id']){delete _0x295fdb['body']['id'];}return db[_0xc10e('0x2b')][_0xc10e('0x49')]({'where':{'id':_0x295fdb[_0xc10e('0x44')]['id']}})[_0xc10e('0x24')](handleEntityNotFound(_0x279caf,null))['then'](saveUpdates(_0x295fdb[_0xc10e('0x48')],null))[_0xc10e('0x24')](respondWithResult(_0x279caf,null))[_0xc10e('0x42')](handleError(_0x279caf,null));};exports[_0xc10e('0x25')]=function(_0x565de9,_0x588569){return db['VoiceDialReport'][_0xc10e('0x49')]({'where':{'id':_0x565de9['params']['id']}})[_0xc10e('0x24')](handleEntityNotFound(_0x588569,null))[_0xc10e('0x24')](removeEntity(_0x588569,null))[_0xc10e('0x42')](handleError(_0x588569,null));};exports[_0xc10e('0x4a')]=function(_0x28e20b,_0x5214fe){return db[_0xc10e('0x2b')][_0xc10e('0x4a')]()[_0xc10e('0x24')](respondWithResult(_0x5214fe,null))[_0xc10e('0x42')](handleError(_0x5214fe,null));}; \ No newline at end of file +var _0xe616=['fs-extra','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','reject','save','update','then','destroy','error','name','send','map','VoiceDialReport','rawAttributes','key','model','keys','query','intersection','fields','attributes','length','nolimit','sort','where','filters','pick','filter','merge','type','VIRTUAL','includeAll','findAll','rows','catch','show','include','options','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs'];(function(_0x3ec5e9,_0x2a667c){var _0x518254=function(_0x877b56){while(--_0x877b56){_0x3ec5e9['push'](_0x3ec5e9['shift']());}};_0x518254(++_0x2a667c);}(_0xe616,0x8a));var _0x6e61=function(_0x51f357,_0x58d147){_0x51f357=_0x51f357-0x0;var _0x186473=_0xe616[_0x51f357];return _0x186473;};'use strict';var emlformat=require(_0x6e61('0x0'));var rimraf=require(_0x6e61('0x1'));var zipdir=require(_0x6e61('0x2'));var jsonpatch=require(_0x6e61('0x3'));var rp=require('request-promise');var moment=require(_0x6e61('0x4'));var BPromise=require(_0x6e61('0x5'));var Mustache=require(_0x6e61('0x6'));var util=require(_0x6e61('0x7'));var path=require(_0x6e61('0x8'));var sox=require(_0x6e61('0x9'));var csv=require(_0x6e61('0xa'));var ejs=require(_0x6e61('0xb'));var fs=require('fs');var fs_extra=require(_0x6e61('0xc'));var _=require(_0x6e61('0xd'));var squel=require(_0x6e61('0xe'));var crypto=require('crypto');var jsforce=require(_0x6e61('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x6e61('0xa'));var querystring=require(_0x6e61('0x10'));var Papa=require(_0x6e61('0x11'));var Redis=require(_0x6e61('0x12'));var authService=require(_0x6e61('0x13'));var qs=require(_0x6e61('0x14'));var as=require(_0x6e61('0x15'));var hardwareService=require(_0x6e61('0x16'));var logger=require(_0x6e61('0x17'))(_0x6e61('0x18'));var utils=require(_0x6e61('0x19'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x51f633,_0x42cf6f){_0x42cf6f=_0x42cf6f||0xcc;return function(_0x554fe6){if(_0x554fe6){return _0x51f633[_0x6e61('0x1a')](_0x42cf6f);}return _0x51f633[_0x6e61('0x1b')](_0x42cf6f)[_0x6e61('0x1c')]();};}function respondWithResult(_0x1cf801,_0x484e4e){_0x484e4e=_0x484e4e||0xc8;return function(_0x32f828){if(_0x32f828){return _0x1cf801['status'](_0x484e4e)[_0x6e61('0x1d')](_0x32f828);}};}function respondWithFilteredResult(_0x1d8b93,_0x2499eb){return function(_0x3dfbb2){if(_0x3dfbb2){var _0x5302b7=typeof _0x2499eb['offset']===_0x6e61('0x1e')&&typeof _0x2499eb[_0x6e61('0x1f')]===_0x6e61('0x1e');var _0x4fd08c=_0x3dfbb2[_0x6e61('0x20')];var _0x1154d7=_0x5302b7?0x0:_0x2499eb[_0x6e61('0x21')];var _0xbd271=_0x5302b7?_0x3dfbb2['count']:_0x2499eb['offset']+_0x2499eb[_0x6e61('0x1f')];var _0x30e3b5;if(_0xbd271>=_0x4fd08c){_0xbd271=_0x4fd08c;_0x30e3b5=0xc8;}else{_0x30e3b5=0xce;}_0x1d8b93[_0x6e61('0x1b')](_0x30e3b5);return _0x1d8b93[_0x6e61('0x22')](_0x6e61('0x23'),_0x1154d7+'-'+_0xbd271+'/'+_0x4fd08c)['json'](_0x3dfbb2);}return null;};}function patchUpdates(_0x16d5b8){return function(_0x5bd6b4){try{jsonpatch['apply'](_0x5bd6b4,_0x16d5b8,!![]);}catch(_0x4abd04){return BPromise[_0x6e61('0x24')](_0x4abd04);}return _0x5bd6b4[_0x6e61('0x25')]();};}function saveUpdates(_0x213792,_0x230a3d){return function(_0x3cfe9d){if(_0x3cfe9d){return _0x3cfe9d[_0x6e61('0x26')](_0x213792)[_0x6e61('0x27')](function(_0x278d7f){return _0x278d7f;});}return null;};}function removeEntity(_0x53e3d2,_0x5baed1){return function(_0x128eb3){if(_0x128eb3){return _0x128eb3[_0x6e61('0x28')]()['then'](function(){_0x53e3d2[_0x6e61('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5db26c,_0x4e5f37){return function(_0x21e8e1){if(!_0x21e8e1){_0x5db26c[_0x6e61('0x1a')](0x194);}return _0x21e8e1;};}function handleError(_0x559c2d,_0x2b50f4){_0x2b50f4=_0x2b50f4||0x1f4;return function(_0x4e8890){logger[_0x6e61('0x29')](_0x4e8890['stack']);if(_0x4e8890[_0x6e61('0x2a')]){delete _0x4e8890[_0x6e61('0x2a')];}_0x559c2d[_0x6e61('0x1b')](_0x2b50f4)[_0x6e61('0x2b')](_0x4e8890);};}exports['index']=function(_0x53c0e3,_0x36c87a){var _0x26e4c5={},_0x2a2d8d={},_0x4e21b6={'count':0x0,'rows':[]};var _0x497bd3=_[_0x6e61('0x2c')](db[_0x6e61('0x2d')][_0x6e61('0x2e')],function(_0x5f5b8f){return{'name':_0x5f5b8f['fieldName'],'type':_0x5f5b8f['type'][_0x6e61('0x2f')]};});_0x2a2d8d[_0x6e61('0x30')]=_[_0x6e61('0x2c')](_0x497bd3,_0x6e61('0x2a'));_0x2a2d8d['query']=_[_0x6e61('0x31')](_0x53c0e3[_0x6e61('0x32')]);_0x2a2d8d['filters']=_['intersection'](_0x2a2d8d[_0x6e61('0x30')],_0x2a2d8d[_0x6e61('0x32')]);_0x26e4c5['attributes']=_[_0x6e61('0x33')](_0x2a2d8d['model'],qs[_0x6e61('0x34')](_0x53c0e3['query']['fields']));_0x26e4c5[_0x6e61('0x35')]=_0x26e4c5['attributes'][_0x6e61('0x36')]?_0x26e4c5['attributes']:_0x2a2d8d[_0x6e61('0x30')];if(!_0x53c0e3['query']['hasOwnProperty'](_0x6e61('0x37'))){_0x26e4c5[_0x6e61('0x1f')]=qs[_0x6e61('0x1f')](_0x53c0e3[_0x6e61('0x32')]['limit']);_0x26e4c5[_0x6e61('0x21')]=qs[_0x6e61('0x21')](_0x53c0e3[_0x6e61('0x32')][_0x6e61('0x21')]);}_0x26e4c5['order']=qs[_0x6e61('0x38')](_0x53c0e3[_0x6e61('0x32')][_0x6e61('0x38')]);_0x26e4c5[_0x6e61('0x39')]=qs[_0x6e61('0x3a')](_[_0x6e61('0x3b')](_0x53c0e3[_0x6e61('0x32')],_0x2a2d8d[_0x6e61('0x3a')]),_0x497bd3);if(_0x53c0e3['query'][_0x6e61('0x3c')]){_0x26e4c5[_0x6e61('0x39')]=_[_0x6e61('0x3d')](_0x26e4c5[_0x6e61('0x39')],{'$or':_[_0x6e61('0x2c')](_0x497bd3,function(_0x523a7a){if(_0x523a7a[_0x6e61('0x3e')]!==_0x6e61('0x3f')){var _0x47aaf7={};_0x47aaf7[_0x523a7a[_0x6e61('0x2a')]]={'$like':'%'+_0x53c0e3['query'][_0x6e61('0x3c')]+'%'};return _0x47aaf7;}})});}_0x26e4c5=_[_0x6e61('0x3d')]({},_0x26e4c5,_0x53c0e3['options']);var _0x956717={'where':_0x26e4c5[_0x6e61('0x39')]};return db[_0x6e61('0x2d')]['count'](_0x956717)[_0x6e61('0x27')](function(_0x4cf8d){_0x4e21b6[_0x6e61('0x20')]=_0x4cf8d;if(_0x53c0e3['query'][_0x6e61('0x40')]){_0x26e4c5['include']=[{'all':!![]}];}return db['VoiceDialReport'][_0x6e61('0x41')](_0x26e4c5);})[_0x6e61('0x27')](function(_0x296b86){_0x4e21b6[_0x6e61('0x42')]=_0x296b86;return _0x4e21b6;})[_0x6e61('0x27')](respondWithFilteredResult(_0x36c87a,_0x26e4c5))[_0x6e61('0x43')](handleError(_0x36c87a,null));};exports[_0x6e61('0x44')]=function(_0x4c2ce2,_0x4df71b){var _0x1bc589={'raw':!![],'where':{'id':_0x4c2ce2['params']['id']}},_0x1653be={};_0x1653be[_0x6e61('0x30')]=_['keys'](db[_0x6e61('0x2d')][_0x6e61('0x2e')]);_0x1653be[_0x6e61('0x32')]=_[_0x6e61('0x31')](_0x4c2ce2[_0x6e61('0x32')]);_0x1653be[_0x6e61('0x3a')]=_[_0x6e61('0x33')](_0x1653be['model'],_0x1653be[_0x6e61('0x32')]);_0x1bc589[_0x6e61('0x35')]=_[_0x6e61('0x33')](_0x1653be[_0x6e61('0x30')],qs[_0x6e61('0x34')](_0x4c2ce2[_0x6e61('0x32')][_0x6e61('0x34')]));_0x1bc589['attributes']=_0x1bc589[_0x6e61('0x35')][_0x6e61('0x36')]?_0x1bc589['attributes']:_0x1653be['model'];if(_0x4c2ce2[_0x6e61('0x32')][_0x6e61('0x40')]){_0x1bc589[_0x6e61('0x45')]=[{'all':!![]}];}_0x1bc589=_[_0x6e61('0x3d')]({},_0x1bc589,_0x4c2ce2[_0x6e61('0x46')]);return db[_0x6e61('0x2d')][_0x6e61('0x47')](_0x1bc589)[_0x6e61('0x27')](handleEntityNotFound(_0x4df71b,null))[_0x6e61('0x27')](respondWithResult(_0x4df71b,null))[_0x6e61('0x43')](handleError(_0x4df71b,null));};exports[_0x6e61('0x48')]=function(_0x4f57c3,_0x445b8d){return db[_0x6e61('0x2d')][_0x6e61('0x48')](_0x4f57c3['body'],{})[_0x6e61('0x27')](respondWithResult(_0x445b8d,0xc9))[_0x6e61('0x43')](handleError(_0x445b8d,null));};exports['update']=function(_0x2e96f0,_0x11f94d){if(_0x2e96f0['body']['id']){delete _0x2e96f0['body']['id'];}return db['VoiceDialReport'][_0x6e61('0x47')]({'where':{'id':_0x2e96f0['params']['id']}})[_0x6e61('0x27')](handleEntityNotFound(_0x11f94d,null))['then'](saveUpdates(_0x2e96f0[_0x6e61('0x49')],null))[_0x6e61('0x27')](respondWithResult(_0x11f94d,null))[_0x6e61('0x43')](handleError(_0x11f94d,null));};exports['destroy']=function(_0x4c4974,_0x756c6e){return db[_0x6e61('0x2d')][_0x6e61('0x47')]({'where':{'id':_0x4c4974['params']['id']}})[_0x6e61('0x27')](handleEntityNotFound(_0x756c6e,null))[_0x6e61('0x27')](removeEntity(_0x756c6e,null))[_0x6e61('0x43')](handleError(_0x756c6e,null));};exports[_0x6e61('0x4a')]=function(_0x5ba7b7,_0x31e946){return db[_0x6e61('0x2d')][_0x6e61('0x4a')]()[_0x6e61('0x27')](respondWithResult(_0x31e946,null))[_0x6e61('0x43')](handleError(_0x31e946,null));}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.model.js b/server/api/voiceDialReport/voiceDialReport.model.js index a4d3f08..1f4145c 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 _0x1156=['rimraf','../../config/environment','./voiceDialReport.attributes','VoiceDialReport','lodash','../../config/logger','api','moment','bluebird','path'];(function(_0x3efc91,_0x2f1ce4){var _0x24ef7c=function(_0x49fd09){while(--_0x49fd09){_0x3efc91['push'](_0x3efc91['shift']());}};_0x24ef7c(++_0x2f1ce4);}(_0x1156,0x1a8));var _0x6115=function(_0x5317b5,_0x4dfd6e){_0x5317b5=_0x5317b5-0x0;var _0x3b7ce2=_0x1156[_0x5317b5];return _0x3b7ce2;};'use strict';var _=require(_0x6115('0x0'));var util=require('util');var logger=require(_0x6115('0x1'))(_0x6115('0x2'));var moment=require(_0x6115('0x3'));var BPromise=require(_0x6115('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6115('0x5'));var rimraf=require(_0x6115('0x6'));var config=require(_0x6115('0x7'));var attributes=require(_0x6115('0x8'));module['exports']=function(_0x520dd9,_0x58f8a2){return _0x520dd9['define'](_0x6115('0x9'),attributes,{'tableName':'report_dial','paranoid':![],'indexes':[{'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xe167=['../../config/logger','api','bluebird','request-promise','../../config/environment','./voiceDialReport.attributes','exports','define','VoiceDialReport','report_dial','uniqueid','util'];(function(_0x4a2e9b,_0x1f492f){var _0x2bd464=function(_0x908968){while(--_0x908968){_0x4a2e9b['push'](_0x4a2e9b['shift']());}};_0x2bd464(++_0x1f492f);}(_0xe167,0xb3));var _0x7e16=function(_0x37e8b2,_0x17ed02){_0x37e8b2=_0x37e8b2-0x0;var _0x1525c5=_0xe167[_0x37e8b2];return _0x1525c5;};'use strict';var _=require('lodash');var util=require(_0x7e16('0x0'));var logger=require(_0x7e16('0x1'))(_0x7e16('0x2'));var moment=require('moment');var BPromise=require(_0x7e16('0x3'));var rp=require(_0x7e16('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x7e16('0x5'));var attributes=require(_0x7e16('0x6'));module[_0x7e16('0x7')]=function(_0x41fe6e,_0x354e9c){return _0x41fe6e[_0x7e16('0x8')](_0x7e16('0x9'),attributes,{'tableName':_0x7e16('0xa'),'paranoid':![],'indexes':[{'fields':[_0x7e16('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.rpc.js b/server/api/voiceDialReport/voiceDialReport.rpc.js index a50504c..3c16849 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 _0xaafa=['request\x20sent','debug','VoiceDialReport,\x20%s,\x20%s,\x20%s','error','message','info','result','catch','CreateVoiceDialReport','body','options','raw','then','stringify','VoiceDialReport','update','where','limit','UpdateVoiceDialReport','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','request','VoiceDialReport,\x20%s,\x20%s'];(function(_0x5c8a32,_0x2197c6){var _0x338e7d=function(_0x255be6){while(--_0x255be6){_0x5c8a32['push'](_0x5c8a32['shift']());}};_0x338e7d(++_0x2197c6);}(_0xaafa,0x12a));var _0xaaaf=function(_0x3711e3,_0x40eedd){_0x3711e3=_0x3711e3-0x0;var _0x26e810=_0xaafa[_0x3711e3];return _0x26e810;};'use strict';var _=require(_0xaaaf('0x0'));var util=require(_0xaaaf('0x1'));var moment=require(_0xaaaf('0x2'));var BPromise=require(_0xaaaf('0x3'));var rs=require(_0xaaaf('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xaaaf('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xaaaf('0x6'))(_0xaaaf('0x7'));var config=require(_0xaaaf('0x8'));var jayson=require(_0xaaaf('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x577790,_0x50d3dd,_0x2fa6b3){return new BPromise(function(_0x1e3419,_0x4a9789){return client[_0xaaaf('0xa')](_0x577790,_0x2fa6b3)['then'](function(_0x11496b){logger['info'](_0xaaaf('0xb'),_0x50d3dd,_0xaaaf('0xc'));logger[_0xaaaf('0xd')](_0xaaaf('0xe'),_0x50d3dd,_0xaaaf('0xc'),JSON['stringify'](_0x11496b));if(_0x11496b[_0xaaaf('0xf')]){if(_0x11496b['error']['code']===0x1f4){logger['error'](_0xaaaf('0xb'),_0x50d3dd,_0x11496b['error']['message']);return _0x4a9789(_0x11496b[_0xaaaf('0xf')][_0xaaaf('0x10')]);}logger['error']('VoiceDialReport,\x20%s,\x20%s',_0x50d3dd,_0x11496b['error']['message']);return _0x1e3419(_0x11496b['error'][_0xaaaf('0x10')]);}else{logger[_0xaaaf('0x11')](_0xaaaf('0xb'),_0x50d3dd,_0xaaaf('0xc'));_0x1e3419(_0x11496b[_0xaaaf('0x12')][_0xaaaf('0x10')]);}})[_0xaaaf('0x13')](function(_0x3b7c1f){logger[_0xaaaf('0xf')](_0xaaaf('0xb'),_0x50d3dd,_0x3b7c1f);_0x4a9789(_0x3b7c1f);});});}exports[_0xaaaf('0x14')]=function(_0x4b6fbe){var _0x4bcc06=this;return new Promise(function(_0x341228,_0x496934){return db['VoiceDialReport']['create'](_0x4b6fbe[_0xaaaf('0x15')],{'raw':_0x4b6fbe[_0xaaaf('0x16')]?_0x4b6fbe['options'][_0xaaaf('0x17')]===undefined?!![]:![]:!![]})[_0xaaaf('0x18')](function(_0x38b027){logger[_0xaaaf('0x11')](_0xaaaf('0x14'),_0x4b6fbe);logger[_0xaaaf('0xd')]('CreateVoiceDialReport',_0x4b6fbe,JSON[_0xaaaf('0x19')](_0x38b027));_0x341228(_0x38b027);})[_0xaaaf('0x13')](function(_0x87c49a){logger['error'](_0xaaaf('0x14'),_0x87c49a[_0xaaaf('0x10')],_0x4b6fbe);_0x496934(_0x4bcc06[_0xaaaf('0xf')](0x1f4,_0x87c49a[_0xaaaf('0x10')]));});});};exports['UpdateVoiceDialReport']=function(_0x39f63e){var _0xbdd8f1=this;return new Promise(function(_0x25fcbd,_0x47f9d5){return db[_0xaaaf('0x1a')][_0xaaaf('0x1b')](_0x39f63e['body'],{'raw':_0x39f63e['options']?_0x39f63e[_0xaaaf('0x16')][_0xaaaf('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x39f63e['options']?_0x39f63e['options'][_0xaaaf('0x1c')]||null:null,'attributes':_0x39f63e[_0xaaaf('0x16')]?_0x39f63e[_0xaaaf('0x16')]['attributes']||null:null,'limit':_0x39f63e[_0xaaaf('0x16')]?_0x39f63e[_0xaaaf('0x16')][_0xaaaf('0x1d')]||null:null})['then'](function(_0x2b8c78){logger[_0xaaaf('0x11')](_0xaaaf('0x1e'),_0x39f63e);logger[_0xaaaf('0xd')]('UpdateVoiceDialReport',_0x39f63e,JSON[_0xaaaf('0x19')](_0x2b8c78));_0x25fcbd(_0x2b8c78);})['catch'](function(_0xc7f113){logger[_0xaaaf('0xf')](_0xaaaf('0x1e'),_0xc7f113[_0xaaaf('0x10')],_0x39f63e);_0x47f9d5(_0xbdd8f1['error'](0x1f4,_0xc7f113['message']));});});}; \ No newline at end of file +var _0xd43c=['../../config/environment','jayson/promise','http','then','info','VoiceDialReport,\x20%s,\x20%s','request\x20sent','debug','VoiceDialReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','CreateVoiceDialReport','VoiceDialReport','create','body','options','raw','catch','where','attributes','UpdateVoiceDialReport','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0xd43c,0x98));var _0xcd43=function(_0xe9fca1,_0x5ba251){_0xe9fca1=_0xe9fca1-0x0;var _0x55ae32=_0xd43c[_0xe9fca1];return _0x55ae32;};'use strict';var _=require(_0xcd43('0x0'));var util=require(_0xcd43('0x1'));var moment=require(_0xcd43('0x2'));var BPromise=require(_0xcd43('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xcd43('0x4'));var db=require(_0xcd43('0x5'))['db'];var utils=require(_0xcd43('0x6'));var logger=require('../../config/logger')(_0xcd43('0x7'));var config=require(_0xcd43('0x8'));var jayson=require(_0xcd43('0x9'));var client=jayson['client'][_0xcd43('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1589c6,_0x163bb1,_0x453460){return new BPromise(function(_0xad9eb1,_0x3fe4bb){return client['request'](_0x1589c6,_0x453460)[_0xcd43('0xb')](function(_0x1d1fac){logger[_0xcd43('0xc')](_0xcd43('0xd'),_0x163bb1,_0xcd43('0xe'));logger[_0xcd43('0xf')](_0xcd43('0x10'),_0x163bb1,_0xcd43('0xe'),JSON[_0xcd43('0x11')](_0x1d1fac));if(_0x1d1fac[_0xcd43('0x12')]){if(_0x1d1fac[_0xcd43('0x12')][_0xcd43('0x13')]===0x1f4){logger['error'](_0xcd43('0xd'),_0x163bb1,_0x1d1fac[_0xcd43('0x12')]['message']);return _0x3fe4bb(_0x1d1fac[_0xcd43('0x12')]['message']);}logger[_0xcd43('0x12')](_0xcd43('0xd'),_0x163bb1,_0x1d1fac[_0xcd43('0x12')]['message']);return _0xad9eb1(_0x1d1fac[_0xcd43('0x12')][_0xcd43('0x14')]);}else{logger[_0xcd43('0xc')](_0xcd43('0xd'),_0x163bb1,_0xcd43('0xe'));_0xad9eb1(_0x1d1fac[_0xcd43('0x15')]['message']);}})['catch'](function(_0x52569d){logger['error']('VoiceDialReport,\x20%s,\x20%s',_0x163bb1,_0x52569d);_0x3fe4bb(_0x52569d);});});}exports[_0xcd43('0x16')]=function(_0x513aee){var _0x3da19b=this;return new Promise(function(_0x506091,_0x103bdf){return db[_0xcd43('0x17')][_0xcd43('0x18')](_0x513aee[_0xcd43('0x19')],{'raw':_0x513aee[_0xcd43('0x1a')]?_0x513aee[_0xcd43('0x1a')][_0xcd43('0x1b')]===undefined?!![]:![]:!![]})[_0xcd43('0xb')](function(_0x27cc1a){logger[_0xcd43('0xc')](_0xcd43('0x16'),_0x513aee);logger['debug'](_0xcd43('0x16'),_0x513aee,JSON['stringify'](_0x27cc1a));_0x506091(_0x27cc1a);})[_0xcd43('0x1c')](function(_0x17cae8){logger[_0xcd43('0x12')]('CreateVoiceDialReport',_0x17cae8['message'],_0x513aee);_0x103bdf(_0x3da19b['error'](0x1f4,_0x17cae8[_0xcd43('0x14')]));});});};exports['UpdateVoiceDialReport']=function(_0x4b6c29){var _0x2845d1=this;return new Promise(function(_0x2074f7,_0x534681){return db[_0xcd43('0x17')]['update'](_0x4b6c29[_0xcd43('0x19')],{'raw':_0x4b6c29['options']?_0x4b6c29['options'][_0xcd43('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4b6c29[_0xcd43('0x1a')]?_0x4b6c29[_0xcd43('0x1a')][_0xcd43('0x1d')]||null:null,'attributes':_0x4b6c29[_0xcd43('0x1a')]?_0x4b6c29[_0xcd43('0x1a')][_0xcd43('0x1e')]||null:null,'limit':_0x4b6c29['options']?_0x4b6c29[_0xcd43('0x1a')]['limit']||null:null})[_0xcd43('0xb')](function(_0x4ad1f5){logger[_0xcd43('0xc')](_0xcd43('0x1f'),_0x4b6c29);logger[_0xcd43('0xf')](_0xcd43('0x1f'),_0x4b6c29,JSON[_0xcd43('0x11')](_0x4ad1f5));_0x2074f7(_0x4ad1f5);})[_0xcd43('0x1c')](function(_0x6f6273){logger[_0xcd43('0x12')](_0xcd43('0x1f'),_0x6f6273[_0xcd43('0x14')],_0x4b6c29);_0x534681(_0x2845d1[_0xcd43('0x12')](0x1f4,_0x6f6273[_0xcd43('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/index.js b/server/api/voiceExtension/index.js index 3f86c82..bb14443 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 _0xe0a9=['destroy','exports','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./voiceExtension.controller','get','index','/:id','isAuthenticated','show','post','create','/:id/applications','addApplications','put','update','delete'];(function(_0x1d453f,_0x5793a9){var _0x50996a=function(_0x59bdf3){while(--_0x59bdf3){_0x1d453f['push'](_0x1d453f['shift']());}};_0x50996a(++_0x5793a9);}(_0xe0a9,0xb2));var _0x9e0a=function(_0x11ac28,_0x228442){_0x11ac28=_0x11ac28-0x0;var _0x542b61=_0xe0a9[_0x11ac28];return _0x542b61;};'use strict';var multer=require(_0x9e0a('0x0'));var util=require('util');var path=require(_0x9e0a('0x1'));var timeout=require(_0x9e0a('0x2'));var express=require('express');var router=express[_0x9e0a('0x3')]();var fs_extra=require(_0x9e0a('0x4'));var auth=require(_0x9e0a('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x9e0a('0x6'));var controller=require(_0x9e0a('0x7'));router[_0x9e0a('0x8')]('/',auth['isAuthenticated'](),controller[_0x9e0a('0x9')]);router['get'](_0x9e0a('0xa'),auth[_0x9e0a('0xb')](),controller[_0x9e0a('0xc')]);router[_0x9e0a('0xd')]('/',auth['isAuthenticated'](),controller[_0x9e0a('0xe')]);router['post'](_0x9e0a('0xf'),auth['isAuthenticated'](),controller[_0x9e0a('0x10')]);router[_0x9e0a('0x11')](_0x9e0a('0xa'),auth[_0x9e0a('0xb')](),controller[_0x9e0a('0x12')]);router[_0x9e0a('0x13')](_0x9e0a('0xa'),auth[_0x9e0a('0xb')](),controller[_0x9e0a('0x14')]);module[_0x9e0a('0x15')]=router; \ No newline at end of file +var _0x4423=['index','get','/:id','show','post','/:id/applications','addApplications','put','update','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./voiceExtension.controller','isAuthenticated'];(function(_0x1ddedd,_0x485606){var _0xa3e1ac=function(_0x580444){while(--_0x580444){_0x1ddedd['push'](_0x1ddedd['shift']());}};_0xa3e1ac(++_0x485606);}(_0x4423,0x1af));var _0x3442=function(_0x57add2,_0x4f2b7d){_0x57add2=_0x57add2-0x0;var _0x4e3670=_0x4423[_0x57add2];return _0x4e3670;};'use strict';var multer=require(_0x3442('0x0'));var util=require(_0x3442('0x1'));var path=require(_0x3442('0x2'));var timeout=require(_0x3442('0x3'));var express=require(_0x3442('0x4'));var router=express[_0x3442('0x5')]();var fs_extra=require(_0x3442('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x3442('0x7'));var config=require('../../config/environment');var controller=require(_0x3442('0x8'));router['get']('/',auth[_0x3442('0x9')](),controller[_0x3442('0xa')]);router[_0x3442('0xb')](_0x3442('0xc'),auth[_0x3442('0x9')](),controller[_0x3442('0xd')]);router[_0x3442('0xe')]('/',auth[_0x3442('0x9')](),controller['create']);router['post'](_0x3442('0xf'),auth[_0x3442('0x9')](),controller[_0x3442('0x10')]);router[_0x3442('0x11')](_0x3442('0xc'),auth[_0x3442('0x9')](),controller[_0x3442('0x12')]);router[_0x3442('0x13')](_0x3442('0xc'),auth[_0x3442('0x9')](),controller[_0x3442('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.attributes.js b/server/api/voiceExtension/voiceExtension.attributes.js index 6bab83d..c2680dc 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 _0xaf0e=['*,*,*,*','INTEGER','BOOLEAN','wav','VIRTUAL','getDataValue','exten','sequelize','exports','STRING','compositeIndex','ENUM','inbound','internal','inbound-fax','outbound-fax','system','any'];(function(_0x4fcf54,_0x198472){var _0x316e21=function(_0x57e43e){while(--_0x57e43e){_0x4fcf54['push'](_0x4fcf54['shift']());}};_0x316e21(++_0x198472);}(_0xaf0e,0x97));var _0xeaf0=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xaf0e[_0x2dafbe];return _0x58a45a;};'use strict';var Sequelize=require(_0xeaf0('0x0'));module[_0xeaf0('0x1')]={'context':{'type':Sequelize[_0xeaf0('0x2')],'allowNull':![],'unique':_0xeaf0('0x3'),'validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xeaf0('0x3')},'priority':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'1','unique':_0xeaf0('0x3')},'tag':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize[_0xeaf0('0x2')],'allowNull':![],'defaultValue':'NoOp'},'appdata':{'type':Sequelize['STRING'](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize[_0xeaf0('0x4')](_0xeaf0('0x5'),'outbound',_0xeaf0('0x6'),_0xeaf0('0x7'),_0xeaf0('0x8'),_0xeaf0('0x9'),_0xeaf0('0xa')),'allowNull':![]},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0xeaf0('0x2')],'allowNull':![],'defaultValue':_0xeaf0('0xb')},'IntervalId':{'type':Sequelize[_0xeaf0('0xc')]},'isApp':{'type':Sequelize[_0xeaf0('0xd')],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize[_0xeaf0('0x2')],'defaultValue':null},'callerID':{'type':Sequelize[_0xeaf0('0x2')],'allowNull':!![]},'record':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'cutdigits':{'type':Sequelize[_0xeaf0('0xc')]},'recordingFormat':{'type':Sequelize[_0xeaf0('0x2')],'defaultValue':_0xeaf0('0xe')},'answer':{'type':Sequelize[_0xeaf0('0xd')],'defaultValue':!![]},'name':{'type':Sequelize[_0xeaf0('0xf')],'get':function(_0xeea554){return this[_0xeaf0('0x10')](_0xeaf0('0x11'));}},'alias':{'type':Sequelize[_0xeaf0('0x2')],'allowNull':!![]}}; \ No newline at end of file +var _0x8b14=['outbound-fax','system','any','INTEGER','BOOLEAN','wav','VIRTUAL','exten','exports','STRING','compositeIndex','NoOp','outbound','internal','inbound-fax'];(function(_0x2bda8c,_0x29a2f6){var _0x2df89c=function(_0x15828a){while(--_0x15828a){_0x2bda8c['push'](_0x2bda8c['shift']());}};_0x2df89c(++_0x29a2f6);}(_0x8b14,0x116));var _0x48b1=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x8b14[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require('sequelize');module[_0x48b1('0x0')]={'context':{'type':Sequelize[_0x48b1('0x1')],'allowNull':![],'unique':_0x48b1('0x2'),'validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize[_0x48b1('0x1')],'allowNull':![],'unique':'compositeIndex'},'priority':{'type':Sequelize[_0x48b1('0x1')],'allowNull':![],'defaultValue':'1','unique':_0x48b1('0x2')},'tag':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize[_0x48b1('0x1')],'allowNull':![],'defaultValue':_0x48b1('0x3')},'appdata':{'type':Sequelize[_0x48b1('0x1')](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize['ENUM']('inbound',_0x48b1('0x4'),_0x48b1('0x5'),_0x48b1('0x6'),_0x48b1('0x7'),_0x48b1('0x8'),_0x48b1('0x9')),'allowNull':![]},'description':{'type':Sequelize[_0x48b1('0x1')]},'interval':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'*,*,*,*'},'IntervalId':{'type':Sequelize[_0x48b1('0xa')]},'isApp':{'type':Sequelize[_0x48b1('0xb')],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize[_0x48b1('0x1')],'defaultValue':null},'callerID':{'type':Sequelize['STRING'],'allowNull':!![]},'record':{'type':Sequelize[_0x48b1('0xb')],'defaultValue':![]},'cutdigits':{'type':Sequelize[_0x48b1('0xa')]},'recordingFormat':{'type':Sequelize[_0x48b1('0x1')],'defaultValue':_0x48b1('0xc')},'answer':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'name':{'type':Sequelize[_0x48b1('0xd')],'get':function(_0x1b8f4a){return this['getDataValue'](_0x48b1('0xe'));}},'alias':{'type':Sequelize[_0x48b1('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 a0391e1..736a421 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 _0x6359=['error','update','context','description','recordingFormat','mandatoryDisposition','alias','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','isApp','createRouting','bulkCreate','findAndCountAll','cast(priority\x20as\x20unsigned)','finally','lodash','ioredis','api','../../config/environment','redis','defaults','localhost','socket.io-emitter','./voiceExtension.socket','register','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','then','InboundRoutes','inbound','OutboundRoutes','outbound','InternalRoutes','internal','ignore','map','type','find','value','name','destroy','end','stack','send','index','rawAttributes','fieldName','model','query','filters','attributes','intersection','fields','length','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','keys','VoiceExtension','include','params','create','startsWith','exten','body','concat','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource'];(function(_0x8a22fd,_0x3f6c4e){var _0x3e12fe=function(_0x23f52e){while(--_0x23f52e){_0x8a22fd['push'](_0x8a22fd['shift']());}};_0x3e12fe(++_0x3f6c4e);}(_0x6359,0x1e9));var _0x9635=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x6359[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x9635('0x0'));var Redis=require(_0x9635('0x1'));var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')(_0x9635('0x2'));var config=require(_0x9635('0x3'));var db=require('../../mysqldb')['db'];config[_0x9635('0x4')]=_[_0x9635('0x5')](config[_0x9635('0x4')],{'host':_0x9635('0x6'),'port':0x18eb});var socket=require(_0x9635('0x7'))(new Redis(config[_0x9635('0x4')]));require(_0x9635('0x8'))[_0x9635('0x9')](socket);function respondWithStatusCode(_0x257559,_0x3c7c16){_0x3c7c16=_0x3c7c16||0xcc;return function(_0x44768f){if(_0x44768f){return _0x257559[_0x9635('0xa')](_0x3c7c16);}return _0x257559['status'](_0x3c7c16)['end']();};}function respondWithResult(_0xa07f1a,_0x37b1a2){_0x37b1a2=_0x37b1a2||0xc8;return function(_0x38a8cc){if(_0x38a8cc){return _0xa07f1a[_0x9635('0xb')](_0x37b1a2)[_0x9635('0xc')](_0x38a8cc);}};}function respondWithFilteredResult(_0x32bfb0,_0x1cb968){return function(_0x10ef9a){if(_0x10ef9a){var _0x18fb99=typeof _0x1cb968[_0x9635('0xd')]==='undefined'&&typeof _0x1cb968[_0x9635('0xe')]===_0x9635('0xf');var _0x4f50da=_0x10ef9a['count'];var _0x2a36c9=_0x18fb99?0x0:_0x1cb968[_0x9635('0xd')];var _0x182f7b=_0x18fb99?_0x10ef9a[_0x9635('0x10')]:_0x1cb968[_0x9635('0xd')]+_0x1cb968['limit'];var _0x2981b2;if(_0x182f7b>=_0x4f50da){_0x182f7b=_0x4f50da;_0x2981b2=0xc8;}else{_0x2981b2=0xce;}_0x32bfb0[_0x9635('0xb')](_0x2981b2);return _0x32bfb0[_0x9635('0x11')](_0x9635('0x12'),_0x2a36c9+'-'+_0x182f7b+'/'+_0x4f50da)[_0x9635('0xc')](_0x10ef9a);}return null;};}function removeEntity(_0x544dd8){return function(_0x7ceb81){if(_0x7ceb81){return _0x7ceb81['destroy']()[_0x9635('0x13')](function(){var _0x3a9221=_0x7ceb81['get']({'plain':!![]});var _0x5c6b36=[{'name':_0x9635('0x14'),'value':_0x9635('0x15'),'ignore':![]},{'name':_0x9635('0x16'),'value':_0x9635('0x17'),'ignore':![]},{'name':_0x9635('0x18'),'value':_0x9635('0x19'),'ignore':![]}];var _0x3e1334=_(_0x5c6b36)['filter'](_0x9635('0x1a'))[_0x9635('0x1b')]('value')['value']();if(_['includes'](_0x3e1334,_0x3a9221[_0x9635('0x1c')])){return;}var _0x5990e9=_[_0x9635('0x1d')](_0x5c6b36,[_0x9635('0x1e'),_0x3a9221[_0x9635('0x1c')]])[_0x9635('0x1f')];return db['UserProfileResource'][_0x9635('0x20')]({'where':{'type':_0x5990e9,'resourceId':_0x3a9221['id']}})['then'](function(){return _0x7ceb81;});})[_0x9635('0x13')](function(){_0x544dd8[_0x9635('0xb')](0xcc)[_0x9635('0x21')]();});}};}function handleEntityNotFound(_0x90d481){return function(_0x363834){if(!_0x363834){_0x90d481[_0x9635('0xa')](0x194);}return _0x363834;};}function handleError(_0x1ccdbd,_0x3df5d5){_0x3df5d5=_0x3df5d5||0x1f4;return function(_0x5c2d2e){logger['error'](_0x5c2d2e[_0x9635('0x22')]);if(_0x5c2d2e['name']){delete _0x5c2d2e[_0x9635('0x1f')];}_0x1ccdbd[_0x9635('0xb')](_0x3df5d5)[_0x9635('0x23')](_0x5c2d2e);};}exports[_0x9635('0x24')]=function(_0xc362b6,_0x428efc){var _0x59d6e5={},_0x14502b={},_0x21ee2d={'count':0x0,'rows':[]};var _0x51f2c8=_[_0x9635('0x1b')](db['VoiceExtension'][_0x9635('0x25')],function(_0x54ce9a){return{'name':_0x54ce9a[_0x9635('0x26')],'type':_0x54ce9a['type']['key']};});_0x14502b[_0x9635('0x27')]=_[_0x9635('0x1b')](_0x51f2c8,_0x9635('0x1f'));_0x14502b[_0x9635('0x28')]=_['keys'](_0xc362b6[_0x9635('0x28')]);_0x14502b[_0x9635('0x29')]=_['intersection'](_0x14502b['model'],_0x14502b[_0x9635('0x28')]);_0x59d6e5[_0x9635('0x2a')]=_[_0x9635('0x2b')](_0x14502b['model'],qs[_0x9635('0x2c')](_0xc362b6[_0x9635('0x28')]['fields']));_0x59d6e5['attributes']=_0x59d6e5[_0x9635('0x2a')][_0x9635('0x2d')]?_0x59d6e5['attributes']:_0x14502b['model'];if(!_0xc362b6[_0x9635('0x28')]['hasOwnProperty'](_0x9635('0x2e'))){_0x59d6e5[_0x9635('0xe')]=qs[_0x9635('0xe')](_0xc362b6['query']['limit']);_0x59d6e5[_0x9635('0xd')]=qs['offset'](_0xc362b6[_0x9635('0x28')]['offset']);}_0x59d6e5[_0x9635('0x2f')]=qs[_0x9635('0x30')](_0xc362b6['query'][_0x9635('0x30')]);_0x59d6e5[_0x9635('0x31')]=qs['filters'](_['pick'](_0xc362b6['query'],_0x14502b[_0x9635('0x29')]),_0x51f2c8);if(_0xc362b6[_0x9635('0x28')][_0x9635('0x32')]){_0x59d6e5[_0x9635('0x31')]=_[_0x9635('0x33')](_0x59d6e5[_0x9635('0x31')],{'$or':_[_0x9635('0x1b')](_0x51f2c8,function(_0x5d0a7c){if(_0x5d0a7c['type']!==_0x9635('0x34')){var _0x4a989d={};_0x4a989d[_0x5d0a7c[_0x9635('0x1f')]]={'$like':'%'+_0xc362b6[_0x9635('0x28')]['filter']+'%'};return _0x4a989d;}})});}_0x59d6e5=_['merge']({},_0x59d6e5,_0xc362b6[_0x9635('0x35')]);var _0x4db844={'where':_0x59d6e5[_0x9635('0x31')]};return db['VoiceExtension']['count'](_0x4db844)['then'](function(_0x4a5165){_0x21ee2d[_0x9635('0x10')]=_0x4a5165;if(_0xc362b6[_0x9635('0x28')][_0x9635('0x36')]){_0x59d6e5['include']=[{'all':!![]}];}return db['VoiceExtension'][_0x9635('0x37')](_0x59d6e5);})['then'](function(_0x39d1b9){_0x21ee2d[_0x9635('0x38')]=_0x39d1b9;return _0x21ee2d;})[_0x9635('0x13')](respondWithFilteredResult(_0x428efc,_0x59d6e5))[_0x9635('0x39')](handleError(_0x428efc,null));};exports['show']=function(_0x17deb6,_0x50ca2f){var _0x3e7c04={'raw':![],'where':{'id':_0x17deb6['params']['id']}},_0x107bc1={};_0x107bc1['model']=_[_0x9635('0x3a')](db[_0x9635('0x3b')][_0x9635('0x25')]);_0x107bc1[_0x9635('0x28')]=_[_0x9635('0x3a')](_0x17deb6[_0x9635('0x28')]);_0x107bc1[_0x9635('0x29')]=_[_0x9635('0x2b')](_0x107bc1[_0x9635('0x27')],_0x107bc1['query']);_0x3e7c04[_0x9635('0x2a')]=_[_0x9635('0x2b')](_0x107bc1[_0x9635('0x27')],qs['fields'](_0x17deb6[_0x9635('0x28')][_0x9635('0x2c')]));_0x3e7c04[_0x9635('0x2a')]=_0x3e7c04['attributes']['length']?_0x3e7c04[_0x9635('0x2a')]:_0x107bc1[_0x9635('0x27')];if(_0x17deb6[_0x9635('0x28')][_0x9635('0x36')]){_0x3e7c04[_0x9635('0x3c')]=[{'all':!![]}];}_0x3e7c04=_['merge']({},_0x3e7c04,_0x17deb6[_0x9635('0x35')]);return db[_0x9635('0x3b')][_0x9635('0x1d')](_0x3e7c04)[_0x9635('0x13')](handleEntityNotFound(_0x50ca2f,null))[_0x9635('0x13')](respondWithResult(_0x50ca2f,null))[_0x9635('0x39')](handleError(_0x50ca2f,null));};exports[_0x9635('0x20')]=function(_0x460b36,_0x1e212b){return db['VoiceExtension'][_0x9635('0x1d')]({'where':{'id':_0x460b36[_0x9635('0x3d')]['id']}})[_0x9635('0x13')](handleEntityNotFound(_0x1e212b,null))[_0x9635('0x13')](removeEntity(_0x1e212b,null))[_0x9635('0x39')](handleError(_0x1e212b,null));};exports[_0x9635('0x3e')]=function(_0x10cf78,_0x5bf154){if(_0x10cf78['body']['type']==='outbound'&&!_[_0x9635('0x3f')](_0x10cf78['body'][_0x9635('0x40')],'_')){_0x10cf78[_0x9635('0x41')][_0x9635('0x40')]='_'[_0x9635('0x42')](_0x10cf78[_0x9635('0x41')]['exten']);}return db[_0x9635('0x3b')][_0x9635('0x3e')](_0x10cf78[_0x9635('0x41')],{'raw':![]})[_0x9635('0x13')](function(_0x1041f3){var _0xe56de3=_0x10cf78[_0x9635('0x43')][_0x9635('0x44')]({'plain':!![]});if(!_0xe56de3)throw new Error(_0x9635('0x45'));if(_0xe56de3[_0x9635('0x46')]===_0x9635('0x43')){var _0x2d5a3c=_0x1041f3[_0x9635('0x44')]({'plain':!![]});var _0x58fee8=[{'name':_0x9635('0x14'),'value':_0x9635('0x15')},{'name':_0x9635('0x16'),'value':_0x9635('0x17')},{'name':_0x9635('0x18'),'value':_0x9635('0x19')}];var _0x265be5=_[_0x9635('0x1d')](_0x58fee8,[_0x9635('0x1e'),_0x2d5a3c[_0x9635('0x1c')]])[_0x9635('0x1f')];return db[_0x9635('0x47')]['find']({'where':{'name':_0x265be5,'userProfileId':_0xe56de3[_0x9635('0x48')]},'raw':!![]})['then'](function(_0x248c41){if(_0x248c41&&_0x248c41[_0x9635('0x49')]===0x0){return db[_0x9635('0x4a')][_0x9635('0x3e')]({'name':_0x2d5a3c[_0x9635('0x1f')],'resourceId':_0x2d5a3c['id'],'type':_0x248c41[_0x9635('0x1f')],'sectionId':_0x248c41['id']},{})[_0x9635('0x13')](function(){return _0x1041f3;});}else{return _0x1041f3;}})[_0x9635('0x39')](function(_0x14d5bb){logger[_0x9635('0x4b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x14d5bb);throw _0x14d5bb;});}return _0x1041f3;})[_0x9635('0x13')](respondWithResult(_0x5bf154,0xc9))[_0x9635('0x39')](handleError(_0x5bf154,null));};exports[_0x9635('0x4c')]=function(_0x15a6d0,_0x3fcb67){if(_0x15a6d0[_0x9635('0x41')]['id']){delete _0x15a6d0['body']['id'];}return db[_0x9635('0x3b')][_0x9635('0x1d')]({'where':{'id':_0x15a6d0[_0x9635('0x3d')]['id']}})['then'](handleEntityNotFound(_0x3fcb67,null))[_0x9635('0x13')](function(_0x1b256d){if(_0x1b256d){return db['VoiceExtension'][_0x9635('0x4c')](_['pick'](_0x15a6d0[_0x9635('0x41')],[_0x9635('0x40'),_0x9635('0x4d'),_0x9635('0x4e'),_0x9635('0x4f'),'cutdigits',_0x9635('0x50'),_0x9635('0x51')]),{'where':{'context':_0x1b256d[_0x9635('0x4d')],'exten':_0x1b256d[_0x9635('0x40')]},'individualHooks':!![]})['then'](function(_0x33f82a){return _0x33f82a;});}return null;})[_0x9635('0x13')](respondWithStatusCode(_0x3fcb67,null))[_0x9635('0x39')](handleError(_0x3fcb67,null));};exports[_0x9635('0x52')]=function(_0x14069e,_0x53d72f){var _0x4fd333=_0x14069e['params']['id'];var _0x362d6e=_0x14069e['body'];var _0x443ede=0xc8;var _0x37e3b7=null;return db[_0x9635('0x53')][_0x9635('0x54')]({'isolationLevel':db[_0x9635('0x53')][_0x9635('0x55')][_0x9635('0x56')][_0x9635('0x57')]},function(_0x4aeb61){return db[_0x9635('0x3b')]['findOne']({'where':{'id':_0x4fd333},'transaction':_0x4aeb61})[_0x9635('0x13')](function(_0x4da921){if(_0x4da921){return db[_0x9635('0x3b')][_0x9635('0x20')]({'where':{'VoiceExtensionId':_0x4fd333},'transaction':_0x4aeb61})[_0x9635('0x13')](function(){var _0x562bfc=_[_0x9635('0x1b')](_0x362d6e,function(_0x3dc216){_0x3dc216['VoiceExtensionId']=_0x4fd333;_0x3dc216[_0x9635('0x58')]=!![];return _0x3dc216;});return _0x4da921[_0x9635('0x59')](_0x562bfc);})[_0x9635('0x13')](function(_0x5e97be){return db['VoiceExtension'][_0x9635('0x5a')](_0x5e97be,{'transaction':_0x4aeb61});});}else{_0x443ede=0x194;_0x37e3b7=[];}});})[_0x9635('0x13')](function(){if(_0x443ede!==0x194){return db['VoiceExtension'][_0x9635('0x5b')]({'where':{'isApp':!![],'VoiceExtensionId':_0x4fd333},'order':_0x9635('0x5c')})[_0x9635('0x13')](function(_0x5d5e4c){_0x37e3b7=_0x5d5e4c;});}})[_0x9635('0x39')](function(_0x1c9d37){_0x443ede=0x1f4;logger[_0x9635('0x4b')](_0x1c9d37[_0x9635('0x22')]);if(_0x1c9d37[_0x9635('0x1f')]){delete _0x1c9d37[_0x9635('0x1f')];}_0x37e3b7=_0x1c9d37;})[_0x9635('0x5d')](function(){if(_0x37e3b7===null){_0x53d72f[_0x9635('0xa')](_0x443ede);}else{if(_0x443ede===0x1f4){_0x53d72f[_0x9635('0xb')](_0x443ede)[_0x9635('0x23')](_0x37e3b7);}else{_0x53d72f[_0x9635('0xb')](_0x443ede)['json'](_0x37e3b7);}}});}; \ No newline at end of file +var _0x9973=['include','catch','show','params','keys','find','create','startsWith','body','exten','concat','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','pick','description','recordingFormat','cutdigits','mandatoryDisposition','alias','context','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','isApp','createRouting','findAndCountAll','cast(priority\x20as\x20unsigned)','lodash','ioredis','api','../../config/environment','../../mysqldb','redis','defaults','localhost','./voiceExtension.socket','status','end','json','offset','limit','undefined','count','Content-Range','destroy','then','get','InboundRoutes','inbound','OutboundRoutes','outbound','filter','ignore','map','value','includes','type','UserProfileResource','sendStatus','error','stack','name','send','index','VoiceExtension','rawAttributes','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','merge','VIRTUAL','options','includeAll'];(function(_0x25ad30,_0x4d9cb8){var _0x97c45e=function(_0x2f3b62){while(--_0x2f3b62){_0x25ad30['push'](_0x25ad30['shift']());}};_0x97c45e(++_0x4d9cb8);}(_0x9973,0x12d));var _0x3997=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x9973[_0x57b54c];return _0x59cc19;};'use strict';var _=require(_0x3997('0x0'));var Redis=require(_0x3997('0x1'));var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')(_0x3997('0x2'));var config=require(_0x3997('0x3'));var db=require(_0x3997('0x4'))['db'];config[_0x3997('0x5')]=_[_0x3997('0x6')](config[_0x3997('0x5')],{'host':_0x3997('0x7'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x3997('0x5')]));require(_0x3997('0x8'))['register'](socket);function respondWithStatusCode(_0x2ab8cf,_0x5d49e0){_0x5d49e0=_0x5d49e0||0xcc;return function(_0x2a3221){if(_0x2a3221){return _0x2ab8cf['sendStatus'](_0x5d49e0);}return _0x2ab8cf[_0x3997('0x9')](_0x5d49e0)[_0x3997('0xa')]();};}function respondWithResult(_0x424cdb,_0x281a19){_0x281a19=_0x281a19||0xc8;return function(_0x482ae9){if(_0x482ae9){return _0x424cdb[_0x3997('0x9')](_0x281a19)[_0x3997('0xb')](_0x482ae9);}};}function respondWithFilteredResult(_0x478a17,_0x50c69e){return function(_0x345e99){if(_0x345e99){var _0x439d0c=typeof _0x50c69e[_0x3997('0xc')]==='undefined'&&typeof _0x50c69e[_0x3997('0xd')]===_0x3997('0xe');var _0x52e616=_0x345e99[_0x3997('0xf')];var _0x5cb664=_0x439d0c?0x0:_0x50c69e[_0x3997('0xc')];var _0x44360d=_0x439d0c?_0x345e99[_0x3997('0xf')]:_0x50c69e[_0x3997('0xc')]+_0x50c69e[_0x3997('0xd')];var _0xf52930;if(_0x44360d>=_0x52e616){_0x44360d=_0x52e616;_0xf52930=0xc8;}else{_0xf52930=0xce;}_0x478a17[_0x3997('0x9')](_0xf52930);return _0x478a17['set'](_0x3997('0x10'),_0x5cb664+'-'+_0x44360d+'/'+_0x52e616)[_0x3997('0xb')](_0x345e99);}return null;};}function removeEntity(_0x4b8122){return function(_0x1e4178){if(_0x1e4178){return _0x1e4178[_0x3997('0x11')]()[_0x3997('0x12')](function(){var _0x439075=_0x1e4178[_0x3997('0x13')]({'plain':!![]});var _0x51a9f9=[{'name':_0x3997('0x14'),'value':_0x3997('0x15'),'ignore':![]},{'name':_0x3997('0x16'),'value':_0x3997('0x17'),'ignore':![]},{'name':'InternalRoutes','value':'internal','ignore':![]}];var _0x1fd8c9=_(_0x51a9f9)[_0x3997('0x18')](_0x3997('0x19'))[_0x3997('0x1a')](_0x3997('0x1b'))[_0x3997('0x1b')]();if(_[_0x3997('0x1c')](_0x1fd8c9,_0x439075['type'])){return;}var _0x202d86=_['find'](_0x51a9f9,['value',_0x439075[_0x3997('0x1d')]])['name'];return db[_0x3997('0x1e')][_0x3997('0x11')]({'where':{'type':_0x202d86,'resourceId':_0x439075['id']}})['then'](function(){return _0x1e4178;});})['then'](function(){_0x4b8122[_0x3997('0x9')](0xcc)[_0x3997('0xa')]();});}};}function handleEntityNotFound(_0x12dcf0){return function(_0x12ede2){if(!_0x12ede2){_0x12dcf0[_0x3997('0x1f')](0x194);}return _0x12ede2;};}function handleError(_0x45061b,_0x5512ad){_0x5512ad=_0x5512ad||0x1f4;return function(_0x423639){logger[_0x3997('0x20')](_0x423639[_0x3997('0x21')]);if(_0x423639[_0x3997('0x22')]){delete _0x423639[_0x3997('0x22')];}_0x45061b[_0x3997('0x9')](_0x5512ad)[_0x3997('0x23')](_0x423639);};}exports[_0x3997('0x24')]=function(_0x1b534a,_0x4899d6){var _0x28696d={},_0x560977={},_0x1da361={'count':0x0,'rows':[]};var _0x85d7c0=_[_0x3997('0x1a')](db[_0x3997('0x25')][_0x3997('0x26')],function(_0x513f70){return{'name':_0x513f70['fieldName'],'type':_0x513f70[_0x3997('0x1d')][_0x3997('0x27')]};});_0x560977[_0x3997('0x28')]=_[_0x3997('0x1a')](_0x85d7c0,_0x3997('0x22'));_0x560977[_0x3997('0x29')]=_['keys'](_0x1b534a[_0x3997('0x29')]);_0x560977[_0x3997('0x2a')]=_['intersection'](_0x560977[_0x3997('0x28')],_0x560977[_0x3997('0x29')]);_0x28696d[_0x3997('0x2b')]=_[_0x3997('0x2c')](_0x560977['model'],qs['fields'](_0x1b534a['query'][_0x3997('0x2d')]));_0x28696d['attributes']=_0x28696d[_0x3997('0x2b')][_0x3997('0x2e')]?_0x28696d['attributes']:_0x560977['model'];if(!_0x1b534a[_0x3997('0x29')][_0x3997('0x2f')]('nolimit')){_0x28696d[_0x3997('0xd')]=qs[_0x3997('0xd')](_0x1b534a[_0x3997('0x29')][_0x3997('0xd')]);_0x28696d[_0x3997('0xc')]=qs['offset'](_0x1b534a[_0x3997('0x29')][_0x3997('0xc')]);}_0x28696d[_0x3997('0x30')]=qs[_0x3997('0x31')](_0x1b534a[_0x3997('0x29')]['sort']);_0x28696d[_0x3997('0x32')]=qs['filters'](_['pick'](_0x1b534a[_0x3997('0x29')],_0x560977[_0x3997('0x2a')]),_0x85d7c0);if(_0x1b534a[_0x3997('0x29')][_0x3997('0x18')]){_0x28696d[_0x3997('0x32')]=_[_0x3997('0x33')](_0x28696d[_0x3997('0x32')],{'$or':_['map'](_0x85d7c0,function(_0x4cb47a){if(_0x4cb47a[_0x3997('0x1d')]!==_0x3997('0x34')){var _0x560c0e={};_0x560c0e[_0x4cb47a['name']]={'$like':'%'+_0x1b534a[_0x3997('0x29')][_0x3997('0x18')]+'%'};return _0x560c0e;}})});}_0x28696d=_[_0x3997('0x33')]({},_0x28696d,_0x1b534a[_0x3997('0x35')]);var _0x3e73b5={'where':_0x28696d[_0x3997('0x32')]};return db['VoiceExtension']['count'](_0x3e73b5)[_0x3997('0x12')](function(_0x419597){_0x1da361[_0x3997('0xf')]=_0x419597;if(_0x1b534a[_0x3997('0x29')][_0x3997('0x36')]){_0x28696d[_0x3997('0x37')]=[{'all':!![]}];}return db[_0x3997('0x25')]['findAll'](_0x28696d);})['then'](function(_0x2f519f){_0x1da361['rows']=_0x2f519f;return _0x1da361;})[_0x3997('0x12')](respondWithFilteredResult(_0x4899d6,_0x28696d))[_0x3997('0x38')](handleError(_0x4899d6,null));};exports[_0x3997('0x39')]=function(_0x230d91,_0x2cecdb){var _0x558237={'raw':![],'where':{'id':_0x230d91[_0x3997('0x3a')]['id']}},_0x5f38c8={};_0x5f38c8[_0x3997('0x28')]=_[_0x3997('0x3b')](db[_0x3997('0x25')]['rawAttributes']);_0x5f38c8['query']=_[_0x3997('0x3b')](_0x230d91[_0x3997('0x29')]);_0x5f38c8[_0x3997('0x2a')]=_[_0x3997('0x2c')](_0x5f38c8[_0x3997('0x28')],_0x5f38c8[_0x3997('0x29')]);_0x558237[_0x3997('0x2b')]=_['intersection'](_0x5f38c8[_0x3997('0x28')],qs[_0x3997('0x2d')](_0x230d91[_0x3997('0x29')][_0x3997('0x2d')]));_0x558237[_0x3997('0x2b')]=_0x558237[_0x3997('0x2b')]['length']?_0x558237['attributes']:_0x5f38c8[_0x3997('0x28')];if(_0x230d91[_0x3997('0x29')][_0x3997('0x36')]){_0x558237[_0x3997('0x37')]=[{'all':!![]}];}_0x558237=_[_0x3997('0x33')]({},_0x558237,_0x230d91[_0x3997('0x35')]);return db['VoiceExtension'][_0x3997('0x3c')](_0x558237)['then'](handleEntityNotFound(_0x2cecdb,null))[_0x3997('0x12')](respondWithResult(_0x2cecdb,null))[_0x3997('0x38')](handleError(_0x2cecdb,null));};exports[_0x3997('0x11')]=function(_0x5965a2,_0x5c5fcd){return db[_0x3997('0x25')][_0x3997('0x3c')]({'where':{'id':_0x5965a2['params']['id']}})[_0x3997('0x12')](handleEntityNotFound(_0x5c5fcd,null))['then'](removeEntity(_0x5c5fcd,null))['catch'](handleError(_0x5c5fcd,null));};exports[_0x3997('0x3d')]=function(_0x58b1e9,_0x14a129){if(_0x58b1e9['body'][_0x3997('0x1d')]===_0x3997('0x17')&&!_[_0x3997('0x3e')](_0x58b1e9[_0x3997('0x3f')][_0x3997('0x40')],'_')){_0x58b1e9[_0x3997('0x3f')][_0x3997('0x40')]='_'[_0x3997('0x41')](_0x58b1e9[_0x3997('0x3f')][_0x3997('0x40')]);}return db[_0x3997('0x25')]['create'](_0x58b1e9[_0x3997('0x3f')],{'raw':![]})[_0x3997('0x12')](function(_0xe1e998){var _0x4ca52c=_0x58b1e9[_0x3997('0x42')]['get']({'plain':!![]});if(!_0x4ca52c)throw new Error(_0x3997('0x43'));if(_0x4ca52c[_0x3997('0x44')]==='user'){var _0x35d6d7=_0xe1e998[_0x3997('0x13')]({'plain':!![]});var _0x2674ff=[{'name':_0x3997('0x14'),'value':'inbound'},{'name':'OutboundRoutes','value':_0x3997('0x17')},{'name':'InternalRoutes','value':'internal'}];var _0x52a95c=_[_0x3997('0x3c')](_0x2674ff,[_0x3997('0x1b'),_0x35d6d7[_0x3997('0x1d')]])['name'];return db[_0x3997('0x45')][_0x3997('0x3c')]({'where':{'name':_0x52a95c,'userProfileId':_0x4ca52c['userProfileId']},'raw':!![]})[_0x3997('0x12')](function(_0x4a5493){if(_0x4a5493&&_0x4a5493[_0x3997('0x46')]===0x0){return db[_0x3997('0x1e')][_0x3997('0x3d')]({'name':_0x35d6d7[_0x3997('0x22')],'resourceId':_0x35d6d7['id'],'type':_0x4a5493[_0x3997('0x22')],'sectionId':_0x4a5493['id']},{})[_0x3997('0x12')](function(){return _0xe1e998;});}else{return _0xe1e998;}})[_0x3997('0x38')](function(_0x2bfde3){logger[_0x3997('0x20')](_0x3997('0x47'),_0x2bfde3);throw _0x2bfde3;});}return _0xe1e998;})['then'](respondWithResult(_0x14a129,0xc9))[_0x3997('0x38')](handleError(_0x14a129,null));};exports[_0x3997('0x48')]=function(_0x1f7e72,_0x4814a1){if(_0x1f7e72['body']['id']){delete _0x1f7e72[_0x3997('0x3f')]['id'];}return db[_0x3997('0x25')][_0x3997('0x3c')]({'where':{'id':_0x1f7e72[_0x3997('0x3a')]['id']}})['then'](handleEntityNotFound(_0x4814a1,null))[_0x3997('0x12')](function(_0x37f6be){if(_0x37f6be){return db[_0x3997('0x25')]['update'](_[_0x3997('0x49')](_0x1f7e72['body'],[_0x3997('0x40'),'context',_0x3997('0x4a'),_0x3997('0x4b'),_0x3997('0x4c'),_0x3997('0x4d'),_0x3997('0x4e')]),{'where':{'context':_0x37f6be[_0x3997('0x4f')],'exten':_0x37f6be['exten']},'individualHooks':!![]})[_0x3997('0x12')](function(_0x4a0479){return _0x4a0479;});}return null;})[_0x3997('0x12')](respondWithStatusCode(_0x4814a1,null))['catch'](handleError(_0x4814a1,null));};exports[_0x3997('0x50')]=function(_0x16379d,_0x2f0f8b){var _0x4505b8=_0x16379d['params']['id'];var _0x14d181=_0x16379d[_0x3997('0x3f')];var _0x33a350=0xc8;var _0x234382=null;return db[_0x3997('0x51')][_0x3997('0x52')]({'isolationLevel':db[_0x3997('0x51')][_0x3997('0x53')][_0x3997('0x54')]['READ_COMMITTED']},function(_0x1d418c){return db[_0x3997('0x25')]['findOne']({'where':{'id':_0x4505b8},'transaction':_0x1d418c})['then'](function(_0x3cd643){if(_0x3cd643){return db[_0x3997('0x25')][_0x3997('0x11')]({'where':{'VoiceExtensionId':_0x4505b8},'transaction':_0x1d418c})[_0x3997('0x12')](function(){var _0x2c63e3=_['map'](_0x14d181,function(_0x27cb4c){_0x27cb4c['VoiceExtensionId']=_0x4505b8;_0x27cb4c[_0x3997('0x55')]=!![];return _0x27cb4c;});return _0x3cd643[_0x3997('0x56')](_0x2c63e3);})[_0x3997('0x12')](function(_0x5478f1){return db[_0x3997('0x25')]['bulkCreate'](_0x5478f1,{'transaction':_0x1d418c});});}else{_0x33a350=0x194;_0x234382=[];}});})[_0x3997('0x12')](function(){if(_0x33a350!==0x194){return db['VoiceExtension'][_0x3997('0x57')]({'where':{'isApp':!![],'VoiceExtensionId':_0x4505b8},'order':_0x3997('0x58')})[_0x3997('0x12')](function(_0x8f4c60){_0x234382=_0x8f4c60;});}})[_0x3997('0x38')](function(_0x54b912){_0x33a350=0x1f4;logger[_0x3997('0x20')](_0x54b912[_0x3997('0x21')]);if(_0x54b912[_0x3997('0x22')]){delete _0x54b912[_0x3997('0x22')];}_0x234382=_0x54b912;})['finally'](function(){if(_0x234382===null){_0x2f0f8b[_0x3997('0x1f')](_0x33a350);}else{if(_0x33a350===0x1f4){_0x2f0f8b[_0x3997('0x9')](_0x33a350)[_0x3997('0x23')](_0x234382);}else{_0x2f0f8b[_0x3997('0x9')](_0x33a350)['json'](_0x234382);}}});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.events.js b/server/api/voiceExtension/voiceExtension.events.js index 538af56..6e94b1b 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 _0xffb2=['emit','hook','events','VoiceExtension','save','remove'];(function(_0x209ba4,_0x11aee){var _0x336e86=function(_0x46b455){while(--_0x46b455){_0x209ba4['push'](_0x209ba4['shift']());}};_0x336e86(++_0x11aee);}(_0xffb2,0x1a0));var _0x2ffb=function(_0x142020,_0x1f7233){_0x142020=_0x142020-0x0;var _0x40da8f=_0xffb2[_0x142020];return _0x40da8f;};'use strict';var EventEmitter=require(_0x2ffb('0x0'));var VoiceExtension=require('../../mysqldb')['db'][_0x2ffb('0x1')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x2ffb('0x2'),'afterUpdate':'update','afterDestroy':_0x2ffb('0x3')};function emitEvent(_0x566327){return function(_0x99211d,_0x10f630,_0xaf4bd2){VoiceExtensionEvents[_0x2ffb('0x4')](_0x566327+':'+_0x99211d['id'],_0x99211d);VoiceExtensionEvents[_0x2ffb('0x4')](_0x566327,_0x99211d);_0xaf4bd2(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceExtension[_0x2ffb('0x5')](e,emitEvent(event));}}module['exports']=VoiceExtensionEvents; \ No newline at end of file +var _0xc422=['update','remove','emit','hasOwnProperty','exports','../../mysqldb','VoiceExtension','setMaxListeners'];(function(_0x164a40,_0xb704f7){var _0x2a551a=function(_0x8c0588){while(--_0x8c0588){_0x164a40['push'](_0x164a40['shift']());}};_0x2a551a(++_0xb704f7);}(_0xc422,0x185));var _0x2c42=function(_0x72234a,_0x518936){_0x72234a=_0x72234a-0x0;var _0x434020=_0xc422[_0x72234a];return _0x434020;};'use strict';var EventEmitter=require('events');var VoiceExtension=require(_0x2c42('0x0'))['db'][_0x2c42('0x1')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0x2c42('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x2c42('0x3'),'afterDestroy':_0x2c42('0x4')};function emitEvent(_0x4372c5){return function(_0x59c642,_0x1cbfa0,_0x9cf0ad){VoiceExtensionEvents[_0x2c42('0x5')](_0x4372c5+':'+_0x59c642['id'],_0x59c642);VoiceExtensionEvents[_0x2c42('0x5')](_0x4372c5,_0x59c642);_0x9cf0ad(null);};}for(var e in events){if(events[_0x2c42('0x6')](e)){var event=events[e];VoiceExtension['hook'](e,emitEvent(event));}}module[_0x2c42('0x7')]=VoiceExtensionEvents; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.model.js b/server/api/voiceExtension/voiceExtension.model.js index f9334f9..2329f73 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 _0x596c=['cutdigits','${EXTEN}','CDR(routeid)=','ExecIf','):Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','outboundrouteid=','hasOwnProperty','recordingFormat','push','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','trunk','timeout','options','url','length','name','param','split','phone','prefix','${EXTEN:','SIP','none','indexOf','U(xcally-mixmonitor-context)','join','Interval','findAll','IntervalId','interval','intervals','map','filter','toLowerCase','tag','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):','callerID','Set(CALLERID(all)=','NoOp(No\x20number\x20available)','queue','playback','includes','app','appType','custom','answer','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1',',${EXTEN},','outboundDial','appdata','agi','XMCS-UNIQUEID=${CHANNEL(LINKEDID)}','priority','last','concat','define','VoiceExtension','voice_extensions','get','Hangup','Set','type','context','NoOp','CDR(routeAlias)=','alias','No\x20alias\x20set','exten','inbound','XCALLY-MOTION-PROGRESS=0','outbound','CDR(type)=outbound','CDR(destination)='];(function(_0x1be740,_0xf8c25f){var _0x45b59c=function(_0x6c5257){while(--_0x6c5257){_0x1be740['push'](_0x1be740['shift']());}};_0x45b59c(++_0xf8c25f);}(_0x596c,0x1cd));var _0xc596=function(_0x795363,_0x963373){_0x795363=_0x795363-0x0;var _0x25e73d=_0x596c[_0x795363];return _0x25e73d;};'use strict';var _=require('lodash');var attributes=require('./voiceExtension.attributes');module['exports']=function(_0x4ad890){var _0xd55e73=_0x4ad890['models'];function _0x1ae4a8(_0x391398){var _0x5c2666=0x2;var _0x4d6abe=[{'type':_0x391398['type'],'app':_0xc596('0x0'),'appdata':'CDR(type)='+_0x391398[_0xc596('0x1')],'context':_0x391398[_0xc596('0x2')],'exten':_0x391398['exten'],'priority':_0x5c2666++,'VoiceExtensionId':_0x391398['id']},{'type':_0x391398[_0xc596('0x1')],'app':_0x391398['alias']?_0xc596('0x0'):_0xc596('0x3'),'appdata':_0x391398['alias']?_0xc596('0x4')+_0x391398[_0xc596('0x5')]:_0xc596('0x6'),'context':_0x391398['context'],'exten':_0x391398[_0xc596('0x7')],'priority':_0x5c2666++,'VoiceExtensionId':_0x391398['id']}];if(_0x391398['type']===_0xc596('0x8')){_0x4d6abe['push']({'type':_0xc596('0x8'),'app':'Set','appdata':'CDR(routeid)='+_0x391398['id'],'context':_0x391398[_0xc596('0x2')],'exten':_0x391398['exten'],'priority':_0x5c2666++,'VoiceExtensionId':_0x391398['id']});}_0x4d6abe['push']({'type':_0x391398[_0xc596('0x1')],'app':_0xc596('0x0'),'appdata':'XCALLY-MOTION-ANSWER=0','context':_0x391398[_0xc596('0x2')],'exten':_0x391398[_0xc596('0x7')],'priority':_0x5c2666++,'VoiceExtensionId':_0x391398['id']},{'type':_0x391398[_0xc596('0x1')],'app':_0xc596('0x0'),'appdata':_0xc596('0x9'),'context':_0x391398[_0xc596('0x2')],'exten':_0x391398[_0xc596('0x7')],'priority':_0x5c2666++,'VoiceExtensionId':_0x391398['id']},{'type':_0x391398[_0xc596('0x1')],'app':_0xc596('0x0'),'appdata':'MONITOR_OPTIONS=ab','context':_0x391398[_0xc596('0x2')],'exten':_0x391398[_0xc596('0x7')],'priority':_0x5c2666++,'VoiceExtensionId':_0x391398['id']});return _0x4d6abe;}function _0x2c82f4(_0x41edcd){var _0x5aec08=0x2;var _0x5cffe5=[{'type':_0xc596('0xa'),'app':_0xc596('0x0'),'appdata':_0xc596('0xb'),'context':_0x41edcd['context'],'exten':_0x41edcd[_0xc596('0x7')],'priority':_0x5aec08++,'VoiceExtensionId':_0x41edcd['id']},{'type':_0xc596('0xa'),'app':_0x41edcd[_0xc596('0x5')]?_0xc596('0x0'):_0xc596('0x3'),'appdata':_0x41edcd[_0xc596('0x5')]?_0xc596('0x4')+_0x41edcd[_0xc596('0x5')]:_0xc596('0x6'),'context':_0x41edcd[_0xc596('0x2')],'exten':_0x41edcd['exten'],'priority':_0x5aec08++,'VoiceExtensionId':_0x41edcd['id']},{'type':_0xc596('0xa'),'app':_0xc596('0x0'),'appdata':_0xc596('0xc')+(_0x41edcd[_0xc596('0xd')]?'${EXTEN:'+_0x41edcd['cutdigits']+'}':_0xc596('0xe')),'context':_0x41edcd['context'],'exten':_0x41edcd[_0xc596('0x7')],'priority':_0x5aec08++,'VoiceExtensionId':_0x41edcd['id']},{'type':_0xc596('0xa'),'app':_0xc596('0x0'),'appdata':_0xc596('0xf')+_0x41edcd['id'],'context':_0x41edcd[_0xc596('0x2')],'exten':_0x41edcd[_0xc596('0x7')],'priority':_0x5aec08++,'VoiceExtensionId':_0x41edcd['id']},{'type':_0xc596('0xa'),'app':_0xc596('0x10'),'appdata':'$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto('+(_0x5aec08+0x2)+_0xc596('0x11')+(_0x5aec08+0x1)+')','context':_0x41edcd[_0xc596('0x2')],'exten':_0x41edcd[_0xc596('0x7')],'priority':_0x5aec08++,'VoiceExtensionId':_0x41edcd['id']},{'type':_0xc596('0xa'),'app':_0xc596('0x0'),'appdata':_0x41edcd[_0xc596('0xd')]?_0xc596('0x12')+_0x41edcd[_0xc596('0xd')]+'}':_0xc596('0x13'),'context':_0x41edcd[_0xc596('0x2')],'exten':_0x41edcd['exten'],'priority':_0x5aec08++,'VoiceExtensionId':_0x41edcd['id']},{'type':_0xc596('0xa'),'app':_0xc596('0x0'),'appdata':'XCALLY-MOTION-ANSWER=0','context':_0x41edcd[_0xc596('0x2')],'exten':_0x41edcd[_0xc596('0x7')],'priority':_0x5aec08++,'VoiceExtensionId':_0x41edcd['id']},{'type':_0xc596('0xa'),'app':'Set','appdata':_0xc596('0x9'),'context':_0x41edcd[_0xc596('0x2')],'exten':_0x41edcd['exten'],'priority':_0x5aec08++,'VoiceExtensionId':_0x41edcd['id']},{'type':'outbound','app':_0xc596('0x0'),'appdata':'MONITOR_OPTIONS=ab','context':_0x41edcd[_0xc596('0x2')],'exten':_0x41edcd[_0xc596('0x7')],'priority':_0x5aec08++,'VoiceExtensionId':_0x41edcd['id']},{'type':_0xc596('0xa'),'app':'Set','appdata':_0xc596('0x14')+_0x41edcd['id'],'context':_0x41edcd[_0xc596('0x2')],'exten':_0x41edcd[_0xc596('0x7')],'priority':_0x5aec08++,'VoiceExtensionId':_0x41edcd['id']}];if(_0x41edcd[_0xc596('0x15')](_0xc596('0x16'))&&_0x41edcd[_0xc596('0x16')]!=='none'){_0x5cffe5[_0xc596('0x17')]({'type':'outbound','app':_0xc596('0x0'),'appdata':_0xc596('0x18'),'context':_0x41edcd[_0xc596('0x2')],'exten':_0x41edcd[_0xc596('0x7')],'priority':_0x5aec08++,'VoiceExtensionId':_0x41edcd['id']},{'type':_0xc596('0xa'),'app':_0xc596('0x0'),'appdata':_0xc596('0x19')+_0x41edcd[_0xc596('0x16')]||'wav','context':_0x41edcd[_0xc596('0x2')],'exten':_0x41edcd[_0xc596('0x7')],'priority':_0x5aec08++,'VoiceExtensionId':_0x41edcd['id']});}return _0x5cffe5;}function _0x46675b(_0x297e3d,_0x5ba840){var _0x507d0b=[{'name':_0xc596('0x1a'),'param':0x0},{'name':_0xc596('0x1b'),'param':0x1},{'name':_0xc596('0x1c'),'param':0x2},{'name':_0xc596('0x1d'),'param':0x3}];var _0x3142b7={};var _0x124671=_0x5ba840['split'](',');var _0x3b824e=[];for(var _0x1ecdc4=0x0;_0x1ecdc4<_0x507d0b[_0xc596('0x1e')];_0x1ecdc4++){switch(_0x507d0b[_0x1ecdc4][_0xc596('0x1f')]){case'trunk':_0x3142b7[_0xc596('0x1a')]=_0x124671[_0x507d0b[_0x1ecdc4][_0xc596('0x20')]][_0xc596('0x21')]('/')[0x1];_0x3142b7[_0xc596('0x22')]=_0x124671[_0x507d0b[_0x1ecdc4]['param']][_0xc596('0x21')]('/')[0x2];_0x3142b7[_0xc596('0x23')]=_0x3142b7[_0xc596('0x22')]?_0x3142b7[_0xc596('0x22')][_0xc596('0x21')]('$')[0x0]:undefined;_0x3142b7[_0xc596('0x22')]=_0x297e3d[_0xc596('0xd')]?(_0x3142b7[_0xc596('0x23')]||'')+_0xc596('0x24')+_0x297e3d[_0xc596('0xd')]+'}':(_0x3142b7[_0xc596('0x23')]||'')+_0xc596('0xe');_0x3b824e[_0x507d0b[_0x1ecdc4][_0xc596('0x20')]]=[_0xc596('0x25'),_0x3142b7[_0xc596('0x1a')],_0x3142b7['phone']]['join']('/');break;case _0xc596('0x1c'):_0x3142b7[_0xc596('0x1c')]=_0x124671[_0x507d0b[_0x1ecdc4][_0xc596('0x20')]];if(_0x297e3d[_0xc596('0x16')]!==_0xc596('0x26')){if(_0x3142b7[_0xc596('0x1c')][_0xc596('0x27')]('U(xcally-mixmonitor-context)')<0x0){_0x3142b7['options']+='U(xcally-mixmonitor-context)';}}else{_0x3142b7[_0xc596('0x1c')]=_0x3142b7[_0xc596('0x1c')]['replace'](_0xc596('0x28'),'');}_0x3b824e[_0x507d0b[_0x1ecdc4][_0xc596('0x20')]]=_0x3142b7['options'];break;default:_0x3b824e[_0x507d0b[_0x1ecdc4][_0xc596('0x20')]]=_0x124671[_0x507d0b[_0x1ecdc4][_0xc596('0x20')]];}}return _0x3b824e[_0xc596('0x29')](',');}function _0x183d03(_0x480138,_0x2c69d1,_0x52c7a1){return new Promise(function(_0x39332a,_0xb6f0e7){var _0x49f7b3=[];if(_['isEmpty'](_0x2c69d1))return _0x39332a(_0x49f7b3);_0xd55e73[_0xc596('0x2a')][_0xc596('0x2b')]({'attributes':['id','interval',_0xc596('0x2c')],'raw':!![]})['then'](function(_0x3c8da6){for(var _0x1e4e45=0x0,_0x2de065=0x0;_0x1e4e45<_0x2c69d1[_0xc596('0x1e')];_0x1e4e45++,_0x2de065=0x0){var _0x4d4557=_0x2c69d1[_0x1e4e45];var _0x261af5=[];var _0x104b6a=[];delete _0x4d4557['id'];if(_0x4d4557[_0xc596('0x2d')]!=='*,*,*,*'){_0x4d4557[_0xc596('0x2e')]=[_0x4d4557[_0xc596('0x2d')]];}else{_0x4d4557['intervals']=_0x4d4557['IntervalId']?_[_0xc596('0x2f')](_[_0xc596('0x30')](_0x3c8da6,{'IntervalId':_0x4d4557['IntervalId']}),_0xc596('0x2d')):[];}_0x4d4557[_0xc596('0x2')]=_0x480138[_0xc596('0x2')];_0x4d4557[_0xc596('0x7')]=_0x480138['exten'];if(_0x4d4557[_0xc596('0x1')])_0x4d4557[_0xc596('0x1')]=_0x4d4557[_0xc596('0x1')][_0xc596('0x31')]();if(_0x480138[_0xc596('0x1')]==='outbound'){if(_0x4d4557['hasOwnProperty']('tag')&&_0x4d4557[_0xc596('0x32')]&&_0x4d4557[_0xc596('0x32')]!=='--'){_0x261af5[_0xc596('0x17')]({'type':_0x4d4557[_0xc596('0x1')][_0xc596('0x31')](),'app':'Set','appdata':'CDR(tag)='+_0x4d4557[_0xc596('0x32')],'context':_0x480138[_0xc596('0x2')],'exten':_0x480138[_0xc596('0x7')],'priority':_0x4d4557[_0xc596('0x2e')][_0xc596('0x1e')]+_0x52c7a1+_0x2de065++,'VoiceExtensionId':_0x480138['id']});}_0x261af5[_0xc596('0x17')]({'type':_0x4d4557[_0xc596('0x1')][_0xc596('0x31')](),'app':_0xc596('0x10'),'appdata':_0xc596('0x33')+(_0x4d4557[_0xc596('0x34')]?_0xc596('0x35')+_0x4d4557[_0xc596('0x34')]+')':_0xc596('0x36')),'context':_0x480138[_0xc596('0x2')],'exten':_0x480138[_0xc596('0x7')],'priority':_0x4d4557[_0xc596('0x2e')][_0xc596('0x1e')]+_0x52c7a1+_0x2de065++,'VoiceExtensionId':_0x480138['id']});}else{if(_0x4d4557[_0xc596('0x15')]('answer')){if([_0xc596('0x37'),_0xc596('0x38')][_0xc596('0x39')](_0x4d4557[_0xc596('0x3a')]['toLowerCase']())&&_0x4d4557[_0xc596('0x3b')]!==_0xc596('0x3c')){if(_0x4d4557[_0xc596('0x3d')]){_0x261af5['push']({'type':_0x4d4557[_0xc596('0x1')]['toLowerCase'](),'app':_0xc596('0x10'),'appdata':_0xc596('0x3e'),'context':_0x480138['context'],'exten':_0x480138[_0xc596('0x7')],'priority':_0x4d4557[_0xc596('0x2e')][_0xc596('0x1e')]+_0x52c7a1+_0x2de065++,'VoiceExtensionId':_0x480138['id']});_0x261af5[_0xc596('0x17')]({'type':_0x4d4557['type'][_0xc596('0x31')](),'app':'Set','appdata':_0xc596('0x3f'),'context':_0x480138[_0xc596('0x2')],'exten':_0x480138[_0xc596('0x7')],'priority':_0x4d4557[_0xc596('0x2e')][_0xc596('0x1e')]+_0x52c7a1+_0x2de065++,'VoiceExtensionId':_0x480138['id']});}else{_0x261af5[_0xc596('0x17')]({'type':_0x4d4557[_0xc596('0x1')][_0xc596('0x31')](),'app':_0xc596('0x10'),'appdata':_0xc596('0x40'),'context':_0x480138[_0xc596('0x2')],'exten':_0x480138[_0xc596('0x7')],'priority':_0x4d4557[_0xc596('0x2e')][_0xc596('0x1e')]+_0x52c7a1+_0x2de065++,'VoiceExtensionId':_0x480138['id']});_0x261af5[_0xc596('0x17')]({'type':_0x4d4557[_0xc596('0x1')][_0xc596('0x31')](),'app':'Set','appdata':_0xc596('0x41'),'context':_0x480138[_0xc596('0x2')],'exten':_0x480138[_0xc596('0x7')],'priority':_0x4d4557[_0xc596('0x2e')][_0xc596('0x1e')]+_0x52c7a1+_0x2de065++,'VoiceExtensionId':_0x480138['id']});}}}}for(var _0x263a95=0x0;_0x263a95<_0x4d4557['intervals']['length'];_0x263a95++){var _0xe8324a=_0x52c7a1+_0x4d4557[_0xc596('0x2e')]['length'];var _0x548eff=_0x263a95===_0x4d4557[_0xc596('0x2e')][_0xc596('0x1e')]-0x1?_0x52c7a1+_0x261af5['length']+_0x104b6a[_0xc596('0x1e')]+0x2:_0x52c7a1+_0x263a95+0x1;_0x261af5['splice'](_0x263a95,0x0,{'type':_0x480138[_0xc596('0x1')],'app':'GotoIfTime','appdata':_0x4d4557[_0xc596('0x2e')][_0x263a95]+'?'+_0x480138[_0xc596('0x2')]+_0xc596('0x42')+_0xe8324a+':'+_0x480138[_0xc596('0x2')]+',${EXTEN},'+_0x548eff,'exten':_0x480138[_0xc596('0x7')],'context':_0x480138[_0xc596('0x2')],'priority':_0x52c7a1+_0x263a95,'VoiceExtensionId':_0x480138['id']});}if(_0x4d4557[_0xc596('0x3b')]===_0xc596('0x43')){_0x4d4557[_0xc596('0x44')]=_0x46675b(_0x480138,_0x4d4557[_0xc596('0x44')]);}if(_0x4d4557[_0xc596('0x3b')]===_0xc596('0x45')){_0x261af5[_0xc596('0x17')]({'type':_0x4d4557['type'][_0xc596('0x31')](),'app':_0xc596('0x0'),'appdata':_0xc596('0x46'),'context':_0x480138[_0xc596('0x2')],'exten':_0x480138[_0xc596('0x7')],'priority':_0x4d4557['intervals'][_0xc596('0x1e')]+_0x52c7a1+_0x2de065++,'VoiceExtensionId':_0x480138['id']});}_0x4d4557[_0xc596('0x47')]=_0x261af5[_0xc596('0x1e')]?_[_0xc596('0x48')](_0x261af5)[_0xc596('0x47')]+0x1:_0x52c7a1;_0x49f7b3=_[_0xc596('0x49')](_0x49f7b3,_0x261af5,[_0x4d4557],_0x104b6a);_0x52c7a1=_[_0xc596('0x48')](_0x49f7b3)[_0xc596('0x47')]+0x1;}return _0x39332a(_0x49f7b3);})['catch'](function(_0x25f3fd){_0xb6f0e7(_0x25f3fd);});});}return _0x4ad890[_0xc596('0x4a')](_0xc596('0x4b'),attributes,{'tableName':_0xc596('0x4c'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0x3f7e9c){var _0x1daf01=this[_0xc596('0x4d')]({'plain':!![]});var _0x467c04=_0x1daf01[_0xc596('0x1')]==='outbound'?_0x2c82f4(_0x1daf01):_0x1ae4a8(_0x1daf01);return _0x183d03(_0x1daf01,_0x3f7e9c,_[_0xc596('0x48')](_0x467c04)[_0xc596('0x47')]+0x1)['then'](function(_0x22202e){var _0x193ccb=_['concat'](_0x467c04,_0x22202e);_0x193ccb[_0xc596('0x17')]({'type':_0x1daf01['type'],'app':_0xc596('0x4e'),'exten':_0x1daf01[_0xc596('0x7')],'context':_0x1daf01[_0xc596('0x2')],'priority':_['last'](_0x193ccb)[_0xc596('0x47')]+0x1,'VoiceExtensionId':_0x1daf01['id']});return _0x193ccb;});}}});}; \ No newline at end of file +var _0xdead=['toLowerCase','tag','CDR(tag)=','ExecIf','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):','callerID','answer','queue','playback','includes','appType','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','splice',',${EXTEN},','appdata','agi','XMCS-UNIQUEID=${CHANNEL(LINKEDID)}','priority','last','concat','catch','define','VoiceExtension','voice_extensions','get','Hangup','lodash','./voiceExtension.attributes','exports','type','Set','context','exten','alias','NoOp','CDR(routeAlias)=','inbound','push','CDR(routeid)=','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','outbound','No\x20alias\x20set','CDR(destination)=','cutdigits','${EXTEN:','${EXTEN}','):Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','outboundrouteid=','hasOwnProperty','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','wav','trunk','timeout','split','name','param','prefix','phone','SIP','join','options','indexOf','U(xcally-mixmonitor-context)','replace','isEmpty','Interval','interval','IntervalId','then','length','*,*,*,*','intervals','map','filter'];(function(_0x9eb88a,_0x272296){var _0x1f0277=function(_0x42aece){while(--_0x42aece){_0x9eb88a['push'](_0x9eb88a['shift']());}};_0x1f0277(++_0x272296);}(_0xdead,0x172));var _0xddea=function(_0x5d3394,_0x5e5dce){_0x5d3394=_0x5d3394-0x0;var _0x102ca5=_0xdead[_0x5d3394];return _0x102ca5;};'use strict';var _=require(_0xddea('0x0'));var attributes=require(_0xddea('0x1'));module[_0xddea('0x2')]=function(_0x514836){var _0x2a631d=_0x514836['models'];function _0x53421d(_0x4e51ea){var _0x40db33=0x2;var _0x5ef74c=[{'type':_0x4e51ea[_0xddea('0x3')],'app':_0xddea('0x4'),'appdata':'CDR(type)='+_0x4e51ea[_0xddea('0x3')],'context':_0x4e51ea[_0xddea('0x5')],'exten':_0x4e51ea[_0xddea('0x6')],'priority':_0x40db33++,'VoiceExtensionId':_0x4e51ea['id']},{'type':_0x4e51ea[_0xddea('0x3')],'app':_0x4e51ea[_0xddea('0x7')]?'Set':_0xddea('0x8'),'appdata':_0x4e51ea['alias']?_0xddea('0x9')+_0x4e51ea[_0xddea('0x7')]:'No\x20alias\x20set','context':_0x4e51ea[_0xddea('0x5')],'exten':_0x4e51ea[_0xddea('0x6')],'priority':_0x40db33++,'VoiceExtensionId':_0x4e51ea['id']}];if(_0x4e51ea[_0xddea('0x3')]===_0xddea('0xa')){_0x5ef74c[_0xddea('0xb')]({'type':_0xddea('0xa'),'app':'Set','appdata':_0xddea('0xc')+_0x4e51ea['id'],'context':_0x4e51ea[_0xddea('0x5')],'exten':_0x4e51ea[_0xddea('0x6')],'priority':_0x40db33++,'VoiceExtensionId':_0x4e51ea['id']});}_0x5ef74c[_0xddea('0xb')]({'type':_0x4e51ea[_0xddea('0x3')],'app':_0xddea('0x4'),'appdata':_0xddea('0xd'),'context':_0x4e51ea[_0xddea('0x5')],'exten':_0x4e51ea[_0xddea('0x6')],'priority':_0x40db33++,'VoiceExtensionId':_0x4e51ea['id']},{'type':_0x4e51ea[_0xddea('0x3')],'app':'Set','appdata':_0xddea('0xe'),'context':_0x4e51ea['context'],'exten':_0x4e51ea[_0xddea('0x6')],'priority':_0x40db33++,'VoiceExtensionId':_0x4e51ea['id']},{'type':_0x4e51ea[_0xddea('0x3')],'app':_0xddea('0x4'),'appdata':_0xddea('0xf'),'context':_0x4e51ea[_0xddea('0x5')],'exten':_0x4e51ea[_0xddea('0x6')],'priority':_0x40db33++,'VoiceExtensionId':_0x4e51ea['id']});return _0x5ef74c;}function _0x4c6812(_0x210255){var _0x5eca3e=0x2;var _0x4a3ee3=[{'type':_0xddea('0x10'),'app':'Set','appdata':'CDR(type)=outbound','context':_0x210255[_0xddea('0x5')],'exten':_0x210255[_0xddea('0x6')],'priority':_0x5eca3e++,'VoiceExtensionId':_0x210255['id']},{'type':'outbound','app':_0x210255[_0xddea('0x7')]?'Set':_0xddea('0x8'),'appdata':_0x210255[_0xddea('0x7')]?_0xddea('0x9')+_0x210255['alias']:_0xddea('0x11'),'context':_0x210255[_0xddea('0x5')],'exten':_0x210255[_0xddea('0x6')],'priority':_0x5eca3e++,'VoiceExtensionId':_0x210255['id']},{'type':'outbound','app':_0xddea('0x4'),'appdata':_0xddea('0x12')+(_0x210255[_0xddea('0x13')]?_0xddea('0x14')+_0x210255[_0xddea('0x13')]+'}':_0xddea('0x15')),'context':_0x210255[_0xddea('0x5')],'exten':_0x210255[_0xddea('0x6')],'priority':_0x5eca3e++,'VoiceExtensionId':_0x210255['id']},{'type':'outbound','app':_0xddea('0x4'),'appdata':_0xddea('0xc')+_0x210255['id'],'context':_0x210255[_0xddea('0x5')],'exten':_0x210255[_0xddea('0x6')],'priority':_0x5eca3e++,'VoiceExtensionId':_0x210255['id']},{'type':'outbound','app':'ExecIf','appdata':'$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto('+(_0x5eca3e+0x2)+_0xddea('0x16')+(_0x5eca3e+0x1)+')','context':_0x210255[_0xddea('0x5')],'exten':_0x210255[_0xddea('0x6')],'priority':_0x5eca3e++,'VoiceExtensionId':_0x210255['id']},{'type':_0xddea('0x10'),'app':_0xddea('0x4'),'appdata':_0x210255[_0xddea('0x13')]?_0xddea('0x17')+_0x210255[_0xddea('0x13')]+'}':_0xddea('0x18'),'context':_0x210255[_0xddea('0x5')],'exten':_0x210255[_0xddea('0x6')],'priority':_0x5eca3e++,'VoiceExtensionId':_0x210255['id']},{'type':_0xddea('0x10'),'app':'Set','appdata':'XCALLY-MOTION-ANSWER=0','context':_0x210255[_0xddea('0x5')],'exten':_0x210255['exten'],'priority':_0x5eca3e++,'VoiceExtensionId':_0x210255['id']},{'type':_0xddea('0x10'),'app':'Set','appdata':'XCALLY-MOTION-PROGRESS=0','context':_0x210255[_0xddea('0x5')],'exten':_0x210255[_0xddea('0x6')],'priority':_0x5eca3e++,'VoiceExtensionId':_0x210255['id']},{'type':_0xddea('0x10'),'app':'Set','appdata':_0xddea('0xf'),'context':_0x210255[_0xddea('0x5')],'exten':_0x210255[_0xddea('0x6')],'priority':_0x5eca3e++,'VoiceExtensionId':_0x210255['id']},{'type':_0xddea('0x10'),'app':_0xddea('0x4'),'appdata':_0xddea('0x19')+_0x210255['id'],'context':_0x210255[_0xddea('0x5')],'exten':_0x210255['exten'],'priority':_0x5eca3e++,'VoiceExtensionId':_0x210255['id']}];if(_0x210255[_0xddea('0x1a')](_0xddea('0x1b'))&&_0x210255['recordingFormat']!==_0xddea('0x1c')){_0x4a3ee3[_0xddea('0xb')]({'type':_0xddea('0x10'),'app':_0xddea('0x4'),'appdata':_0xddea('0x1d'),'context':_0x210255[_0xddea('0x5')],'exten':_0x210255[_0xddea('0x6')],'priority':_0x5eca3e++,'VoiceExtensionId':_0x210255['id']},{'type':_0xddea('0x10'),'app':_0xddea('0x4'),'appdata':_0xddea('0x1e')+_0x210255['recordingFormat']||_0xddea('0x1f'),'context':_0x210255['context'],'exten':_0x210255['exten'],'priority':_0x5eca3e++,'VoiceExtensionId':_0x210255['id']});}return _0x4a3ee3;}function _0x4f2b50(_0x19242c,_0x2b72fd){var _0x46d2dd=[{'name':_0xddea('0x20'),'param':0x0},{'name':_0xddea('0x21'),'param':0x1},{'name':'options','param':0x2},{'name':'url','param':0x3}];var _0xc72e32={};var _0x69b429=_0x2b72fd[_0xddea('0x22')](',');var _0x1383ea=[];for(var _0x39c8e4=0x0;_0x39c8e4<_0x46d2dd['length'];_0x39c8e4++){switch(_0x46d2dd[_0x39c8e4][_0xddea('0x23')]){case'trunk':_0xc72e32[_0xddea('0x20')]=_0x69b429[_0x46d2dd[_0x39c8e4]['param']][_0xddea('0x22')]('/')[0x1];_0xc72e32['phone']=_0x69b429[_0x46d2dd[_0x39c8e4][_0xddea('0x24')]]['split']('/')[0x2];_0xc72e32[_0xddea('0x25')]=_0xc72e32[_0xddea('0x26')]?_0xc72e32[_0xddea('0x26')]['split']('$')[0x0]:undefined;_0xc72e32[_0xddea('0x26')]=_0x19242c[_0xddea('0x13')]?(_0xc72e32[_0xddea('0x25')]||'')+_0xddea('0x14')+_0x19242c[_0xddea('0x13')]+'}':(_0xc72e32[_0xddea('0x25')]||'')+_0xddea('0x15');_0x1383ea[_0x46d2dd[_0x39c8e4]['param']]=[_0xddea('0x27'),_0xc72e32[_0xddea('0x20')],_0xc72e32['phone']][_0xddea('0x28')]('/');break;case _0xddea('0x29'):_0xc72e32[_0xddea('0x29')]=_0x69b429[_0x46d2dd[_0x39c8e4][_0xddea('0x24')]];if(_0x19242c[_0xddea('0x1b')]!=='none'){if(_0xc72e32['options'][_0xddea('0x2a')]('U(xcally-mixmonitor-context)')<0x0){_0xc72e32['options']+=_0xddea('0x2b');}}else{_0xc72e32[_0xddea('0x29')]=_0xc72e32[_0xddea('0x29')][_0xddea('0x2c')](_0xddea('0x2b'),'');}_0x1383ea[_0x46d2dd[_0x39c8e4][_0xddea('0x24')]]=_0xc72e32[_0xddea('0x29')];break;default:_0x1383ea[_0x46d2dd[_0x39c8e4][_0xddea('0x24')]]=_0x69b429[_0x46d2dd[_0x39c8e4][_0xddea('0x24')]];}}return _0x1383ea['join'](',');}function _0x5f05c8(_0x345d65,_0x5a966b,_0x555e5b){return new Promise(function(_0x1cbe52,_0x3594b5){var _0x483654=[];if(_[_0xddea('0x2d')](_0x5a966b))return _0x1cbe52(_0x483654);_0x2a631d[_0xddea('0x2e')]['findAll']({'attributes':['id',_0xddea('0x2f'),_0xddea('0x30')],'raw':!![]})[_0xddea('0x31')](function(_0x3764cf){for(var _0x143ca4=0x0,_0x5589bf=0x0;_0x143ca4<_0x5a966b[_0xddea('0x32')];_0x143ca4++,_0x5589bf=0x0){var _0x26bf45=_0x5a966b[_0x143ca4];var _0x45bf8a=[];var _0x512a9f=[];delete _0x26bf45['id'];if(_0x26bf45[_0xddea('0x2f')]!==_0xddea('0x33')){_0x26bf45[_0xddea('0x34')]=[_0x26bf45['interval']];}else{_0x26bf45[_0xddea('0x34')]=_0x26bf45[_0xddea('0x30')]?_[_0xddea('0x35')](_[_0xddea('0x36')](_0x3764cf,{'IntervalId':_0x26bf45[_0xddea('0x30')]}),'interval'):[];}_0x26bf45['context']=_0x345d65[_0xddea('0x5')];_0x26bf45[_0xddea('0x6')]=_0x345d65['exten'];if(_0x26bf45[_0xddea('0x3')])_0x26bf45[_0xddea('0x3')]=_0x26bf45[_0xddea('0x3')][_0xddea('0x37')]();if(_0x345d65[_0xddea('0x3')]==='outbound'){if(_0x26bf45[_0xddea('0x1a')]('tag')&&_0x26bf45[_0xddea('0x38')]&&_0x26bf45[_0xddea('0x38')]!=='--'){_0x45bf8a[_0xddea('0xb')]({'type':_0x26bf45[_0xddea('0x3')][_0xddea('0x37')](),'app':_0xddea('0x4'),'appdata':_0xddea('0x39')+_0x26bf45['tag'],'context':_0x345d65['context'],'exten':_0x345d65[_0xddea('0x6')],'priority':_0x26bf45['intervals'][_0xddea('0x32')]+_0x555e5b+_0x5589bf++,'VoiceExtensionId':_0x345d65['id']});}_0x45bf8a[_0xddea('0xb')]({'type':_0x26bf45[_0xddea('0x3')][_0xddea('0x37')](),'app':_0xddea('0x3a'),'appdata':_0xddea('0x3b')+(_0x26bf45[_0xddea('0x3c')]?'Set(CALLERID(all)='+_0x26bf45[_0xddea('0x3c')]+')':'NoOp(No\x20number\x20available)'),'context':_0x345d65[_0xddea('0x5')],'exten':_0x345d65[_0xddea('0x6')],'priority':_0x26bf45[_0xddea('0x34')][_0xddea('0x32')]+_0x555e5b+_0x5589bf++,'VoiceExtensionId':_0x345d65['id']});}else{if(_0x26bf45[_0xddea('0x1a')](_0xddea('0x3d'))){if([_0xddea('0x3e'),_0xddea('0x3f')][_0xddea('0x40')](_0x26bf45['app'][_0xddea('0x37')]())&&_0x26bf45[_0xddea('0x41')]!==_0xddea('0x42')){if(_0x26bf45[_0xddea('0x3d')]){_0x45bf8a['push']({'type':_0x26bf45['type']['toLowerCase'](),'app':_0xddea('0x3a'),'appdata':_0xddea('0x43'),'context':_0x345d65[_0xddea('0x5')],'exten':_0x345d65[_0xddea('0x6')],'priority':_0x26bf45[_0xddea('0x34')][_0xddea('0x32')]+_0x555e5b+_0x5589bf++,'VoiceExtensionId':_0x345d65['id']});_0x45bf8a[_0xddea('0xb')]({'type':_0x26bf45[_0xddea('0x3')][_0xddea('0x37')](),'app':_0xddea('0x4'),'appdata':_0xddea('0x44'),'context':_0x345d65[_0xddea('0x5')],'exten':_0x345d65['exten'],'priority':_0x26bf45[_0xddea('0x34')][_0xddea('0x32')]+_0x555e5b+_0x5589bf++,'VoiceExtensionId':_0x345d65['id']});}else{_0x45bf8a[_0xddea('0xb')]({'type':_0x26bf45['type'][_0xddea('0x37')](),'app':'ExecIf','appdata':_0xddea('0x45'),'context':_0x345d65['context'],'exten':_0x345d65['exten'],'priority':_0x26bf45['intervals']['length']+_0x555e5b+_0x5589bf++,'VoiceExtensionId':_0x345d65['id']});_0x45bf8a[_0xddea('0xb')]({'type':_0x26bf45[_0xddea('0x3')][_0xddea('0x37')](),'app':_0xddea('0x4'),'appdata':_0xddea('0x46'),'context':_0x345d65[_0xddea('0x5')],'exten':_0x345d65[_0xddea('0x6')],'priority':_0x26bf45[_0xddea('0x34')][_0xddea('0x32')]+_0x555e5b+_0x5589bf++,'VoiceExtensionId':_0x345d65['id']});}}}}for(var _0x3602f2=0x0;_0x3602f2<_0x26bf45[_0xddea('0x34')][_0xddea('0x32')];_0x3602f2++){var _0x3375b1=_0x555e5b+_0x26bf45[_0xddea('0x34')]['length'];var _0x4e566c=_0x3602f2===_0x26bf45[_0xddea('0x34')]['length']-0x1?_0x555e5b+_0x45bf8a[_0xddea('0x32')]+_0x512a9f['length']+0x2:_0x555e5b+_0x3602f2+0x1;_0x45bf8a[_0xddea('0x47')](_0x3602f2,0x0,{'type':_0x345d65[_0xddea('0x3')],'app':'GotoIfTime','appdata':_0x26bf45[_0xddea('0x34')][_0x3602f2]+'?'+_0x345d65['context']+',${EXTEN},'+_0x3375b1+':'+_0x345d65[_0xddea('0x5')]+_0xddea('0x48')+_0x4e566c,'exten':_0x345d65[_0xddea('0x6')],'context':_0x345d65['context'],'priority':_0x555e5b+_0x3602f2,'VoiceExtensionId':_0x345d65['id']});}if(_0x26bf45[_0xddea('0x41')]==='outboundDial'){_0x26bf45[_0xddea('0x49')]=_0x4f2b50(_0x345d65,_0x26bf45['appdata']);}if(_0x26bf45[_0xddea('0x41')]===_0xddea('0x4a')){_0x45bf8a['push']({'type':_0x26bf45[_0xddea('0x3')][_0xddea('0x37')](),'app':'Set','appdata':_0xddea('0x4b'),'context':_0x345d65[_0xddea('0x5')],'exten':_0x345d65[_0xddea('0x6')],'priority':_0x26bf45[_0xddea('0x34')][_0xddea('0x32')]+_0x555e5b+_0x5589bf++,'VoiceExtensionId':_0x345d65['id']});}_0x26bf45[_0xddea('0x4c')]=_0x45bf8a['length']?_[_0xddea('0x4d')](_0x45bf8a)[_0xddea('0x4c')]+0x1:_0x555e5b;_0x483654=_[_0xddea('0x4e')](_0x483654,_0x45bf8a,[_0x26bf45],_0x512a9f);_0x555e5b=_[_0xddea('0x4d')](_0x483654)[_0xddea('0x4c')]+0x1;}return _0x1cbe52(_0x483654);})[_0xddea('0x4f')](function(_0x212b22){_0x3594b5(_0x212b22);});});}return _0x514836[_0xddea('0x50')](_0xddea('0x51'),attributes,{'tableName':_0xddea('0x52'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0x4b6be8){var _0x2e3ea8=this[_0xddea('0x53')]({'plain':!![]});var _0x3a01c2=_0x2e3ea8['type']===_0xddea('0x10')?_0x4c6812(_0x2e3ea8):_0x53421d(_0x2e3ea8);return _0x5f05c8(_0x2e3ea8,_0x4b6be8,_[_0xddea('0x4d')](_0x3a01c2)[_0xddea('0x4c')]+0x1)['then'](function(_0x163585){var _0x553d5d=_[_0xddea('0x4e')](_0x3a01c2,_0x163585);_0x553d5d[_0xddea('0xb')]({'type':_0x2e3ea8[_0xddea('0x3')],'app':_0xddea('0x54'),'exten':_0x2e3ea8['exten'],'context':_0x2e3ea8[_0xddea('0x5')],'priority':_[_0xddea('0x4d')](_0x553d5d)[_0xddea('0x4c')]+0x1,'VoiceExtensionId':_0x2e3ea8['id']});return _0x553d5d;});}}});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.rpc.js b/server/api/voiceExtension/voiceExtension.rpc.js index fa4ff15..6f5b071 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 _0x1a61=['../../mysqldb','../../config/utils','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./voiceExtension.socket','register','then','info','VoiceExtension,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','GetVoiceExtension','VoiceExtension','findAll','options','where','include','model','attributes','map','lodash','moment','randomstring','ioredis'];(function(_0x441a68,_0x5050e2){var _0x2aea31=function(_0x5af71e){while(--_0x5af71e){_0x441a68['push'](_0x441a68['shift']());}};_0x2aea31(++_0x5050e2);}(_0x1a61,0x1e6));var _0x11a6=function(_0x13ceba,_0x5cd8b0){_0x13ceba=_0x13ceba-0x0;var _0x102abd=_0x1a61[_0x13ceba];return _0x102abd;};'use strict';var _=require(_0x11a6('0x0'));var util=require('util');var moment=require(_0x11a6('0x1'));var BPromise=require('bluebird');var rs=require(_0x11a6('0x2'));var fs=require('fs');var Redis=require(_0x11a6('0x3'));var db=require(_0x11a6('0x4'))['db'];var utils=require(_0x11a6('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x11a6('0x6'));var jayson=require(_0x11a6('0x7'));var client=jayson['client'][_0x11a6('0x8')]({'port':0x232a});config[_0x11a6('0x9')]=_[_0x11a6('0xa')](config[_0x11a6('0x9')],{'host':_0x11a6('0xb'),'port':0x18eb});var socket=require(_0x11a6('0xc'))(new Redis(config[_0x11a6('0x9')]));require(_0x11a6('0xd'))[_0x11a6('0xe')](socket);function respondWithRpcPromise(_0x4bb1d0,_0x59f611,_0x522315){return new BPromise(function(_0xf7f73d,_0x3cf410){return client['request'](_0x4bb1d0,_0x522315)[_0x11a6('0xf')](function(_0x91835f){logger[_0x11a6('0x10')](_0x11a6('0x11'),_0x59f611,_0x11a6('0x12'));logger[_0x11a6('0x13')]('VoiceExtension,\x20%s,\x20%s,\x20%s',_0x59f611,'request\x20sent',JSON[_0x11a6('0x14')](_0x91835f));if(_0x91835f[_0x11a6('0x15')]){if(_0x91835f['error'][_0x11a6('0x16')]===0x1f4){logger[_0x11a6('0x15')]('VoiceExtension,\x20%s,\x20%s',_0x59f611,_0x91835f[_0x11a6('0x15')][_0x11a6('0x17')]);return _0x3cf410(_0x91835f['error'][_0x11a6('0x17')]);}logger[_0x11a6('0x15')](_0x11a6('0x11'),_0x59f611,_0x91835f[_0x11a6('0x15')]['message']);return _0xf7f73d(_0x91835f[_0x11a6('0x15')][_0x11a6('0x17')]);}else{logger[_0x11a6('0x10')](_0x11a6('0x11'),_0x59f611,_0x11a6('0x12'));_0xf7f73d(_0x91835f[_0x11a6('0x18')][_0x11a6('0x17')]);}})[_0x11a6('0x19')](function(_0x312cc6){logger[_0x11a6('0x15')](_0x11a6('0x11'),_0x59f611,_0x312cc6);_0x3cf410(_0x312cc6);});});}exports[_0x11a6('0x1a')]=function(_0x25a4c5){var _0x1e8b38=this;return new Promise(function(_0x595d3c,_0x485a4f){return db[_0x11a6('0x1b')][_0x11a6('0x1c')]({'raw':_0x25a4c5[_0x11a6('0x1d')]?_0x25a4c5['options']['raw']===undefined?!![]:![]:!![],'where':_0x25a4c5[_0x11a6('0x1d')]?_0x25a4c5['options'][_0x11a6('0x1e')]||null:null,'attributes':_0x25a4c5['options']?_0x25a4c5['options']['attributes']||null:null,'limit':_0x25a4c5['options']?_0x25a4c5[_0x11a6('0x1d')]['limit']||null:null,'include':_0x25a4c5[_0x11a6('0x1d')]?_0x25a4c5[_0x11a6('0x1d')]['include']?_['map'](_0x25a4c5[_0x11a6('0x1d')][_0x11a6('0x1f')],function(_0x34e230){return{'model':db[_0x34e230[_0x11a6('0x20')]],'as':_0x34e230['as'],'attributes':_0x34e230[_0x11a6('0x21')],'include':_0x34e230[_0x11a6('0x1f')]?_[_0x11a6('0x22')](_0x34e230[_0x11a6('0x1f')],function(_0x111e74){return{'model':db[_0x111e74[_0x11a6('0x20')]],'as':_0x111e74['as'],'attributes':_0x111e74[_0x11a6('0x21')],'include':_0x111e74[_0x11a6('0x1f')]?_[_0x11a6('0x22')](_0x111e74[_0x11a6('0x1f')],function(_0x304ad8){return{'model':db[_0x304ad8[_0x11a6('0x20')]],'as':_0x304ad8['as'],'attributes':_0x304ad8[_0x11a6('0x21')]};}):[]};}):[]};}):[]:[]})[_0x11a6('0xf')](function(_0x44c92d){logger[_0x11a6('0x10')](_0x11a6('0x1a'),_0x25a4c5);logger[_0x11a6('0x13')](_0x11a6('0x1a'),_0x25a4c5,JSON[_0x11a6('0x14')](_0x44c92d));_0x595d3c(_0x44c92d);})[_0x11a6('0x19')](function(_0x56f74d){logger[_0x11a6('0x15')]('GetVoiceExtension',_0x56f74d[_0x11a6('0x17')],_0x25a4c5);_0x485a4f(_0x1e8b38[_0x11a6('0x15')](0x1f4,_0x56f74d[_0x11a6('0x17')]));});});}; \ No newline at end of file +var _0xdd68=['VoiceExtension','findAll','options','where','attributes','limit','include','map','model','GetVoiceExtension','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','defaults','localhost','socket.io-emitter','redis','register','request','then','info','VoiceExtension,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch'];(function(_0xfa4a79,_0x3fc1f2){var _0x6350eb=function(_0x55dc84){while(--_0x55dc84){_0xfa4a79['push'](_0xfa4a79['shift']());}};_0x6350eb(++_0x3fc1f2);}(_0xdd68,0x196));var _0x8dd6=function(_0x1558ab,_0x39d1de){_0x1558ab=_0x1558ab-0x0;var _0x53b64a=_0xdd68[_0x1558ab];return _0x53b64a;};'use strict';var _=require(_0x8dd6('0x0'));var util=require('util');var moment=require(_0x8dd6('0x1'));var BPromise=require(_0x8dd6('0x2'));var rs=require(_0x8dd6('0x3'));var fs=require('fs');var Redis=require(_0x8dd6('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x8dd6('0x5'));var logger=require(_0x8dd6('0x6'))('rpc');var config=require(_0x8dd6('0x7'));var jayson=require(_0x8dd6('0x8'));var client=jayson['client'][_0x8dd6('0x9')]({'port':0x232a});config['redis']=_[_0x8dd6('0xa')](config['redis'],{'host':_0x8dd6('0xb'),'port':0x18eb});var socket=require(_0x8dd6('0xc'))(new Redis(config[_0x8dd6('0xd')]));require('./voiceExtension.socket')[_0x8dd6('0xe')](socket);function respondWithRpcPromise(_0x7ef2a7,_0x1ef33d,_0x2dc6ea){return new BPromise(function(_0x34bd4e,_0x19e423){return client[_0x8dd6('0xf')](_0x7ef2a7,_0x2dc6ea)[_0x8dd6('0x10')](function(_0x84f828){logger[_0x8dd6('0x11')](_0x8dd6('0x12'),_0x1ef33d,_0x8dd6('0x13'));logger[_0x8dd6('0x14')]('VoiceExtension,\x20%s,\x20%s,\x20%s',_0x1ef33d,_0x8dd6('0x13'),JSON[_0x8dd6('0x15')](_0x84f828));if(_0x84f828[_0x8dd6('0x16')]){if(_0x84f828['error']['code']===0x1f4){logger[_0x8dd6('0x16')]('VoiceExtension,\x20%s,\x20%s',_0x1ef33d,_0x84f828['error'][_0x8dd6('0x17')]);return _0x19e423(_0x84f828[_0x8dd6('0x16')][_0x8dd6('0x17')]);}logger[_0x8dd6('0x16')](_0x8dd6('0x12'),_0x1ef33d,_0x84f828[_0x8dd6('0x16')][_0x8dd6('0x17')]);return _0x34bd4e(_0x84f828[_0x8dd6('0x16')][_0x8dd6('0x17')]);}else{logger['info'](_0x8dd6('0x12'),_0x1ef33d,_0x8dd6('0x13'));_0x34bd4e(_0x84f828[_0x8dd6('0x18')][_0x8dd6('0x17')]);}})[_0x8dd6('0x19')](function(_0x36bcdc){logger[_0x8dd6('0x16')](_0x8dd6('0x12'),_0x1ef33d,_0x36bcdc);_0x19e423(_0x36bcdc);});});}exports['GetVoiceExtension']=function(_0xa363b6){var _0x1d6123=this;return new Promise(function(_0x54b996,_0x40d5a5){return db[_0x8dd6('0x1a')][_0x8dd6('0x1b')]({'raw':_0xa363b6[_0x8dd6('0x1c')]?_0xa363b6['options']['raw']===undefined?!![]:![]:!![],'where':_0xa363b6['options']?_0xa363b6[_0x8dd6('0x1c')][_0x8dd6('0x1d')]||null:null,'attributes':_0xa363b6['options']?_0xa363b6[_0x8dd6('0x1c')][_0x8dd6('0x1e')]||null:null,'limit':_0xa363b6[_0x8dd6('0x1c')]?_0xa363b6[_0x8dd6('0x1c')][_0x8dd6('0x1f')]||null:null,'include':_0xa363b6['options']?_0xa363b6[_0x8dd6('0x1c')][_0x8dd6('0x20')]?_['map'](_0xa363b6[_0x8dd6('0x1c')][_0x8dd6('0x20')],function(_0xeeda3){return{'model':db[_0xeeda3['model']],'as':_0xeeda3['as'],'attributes':_0xeeda3[_0x8dd6('0x1e')],'include':_0xeeda3[_0x8dd6('0x20')]?_[_0x8dd6('0x21')](_0xeeda3[_0x8dd6('0x20')],function(_0x35f35d){return{'model':db[_0x35f35d['model']],'as':_0x35f35d['as'],'attributes':_0x35f35d[_0x8dd6('0x1e')],'include':_0x35f35d[_0x8dd6('0x20')]?_['map'](_0x35f35d['include'],function(_0x25eba7){return{'model':db[_0x25eba7[_0x8dd6('0x22')]],'as':_0x25eba7['as'],'attributes':_0x25eba7[_0x8dd6('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x8dd6('0x10')](function(_0x2bbe93){logger[_0x8dd6('0x11')](_0x8dd6('0x23'),_0xa363b6);logger[_0x8dd6('0x14')](_0x8dd6('0x23'),_0xa363b6,JSON[_0x8dd6('0x15')](_0x2bbe93));_0x54b996(_0x2bbe93);})[_0x8dd6('0x19')](function(_0x3592d7){logger[_0x8dd6('0x16')](_0x8dd6('0x23'),_0x3592d7[_0x8dd6('0x17')],_0xa363b6);_0x40d5a5(_0x1d6123[_0x8dd6('0x16')](0x1f4,_0x3592d7[_0x8dd6('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.socket.js b/server/api/voiceExtension/voiceExtension.socket.js index 64c7641..1ce10af 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 _0xc4aa=['remove','update','removeListener','register','length','./voiceExtension.events','save'];(function(_0xa7418f,_0x1716ce){var _0x4629b6=function(_0x492043){while(--_0x492043){_0xa7418f['push'](_0xa7418f['shift']());}};_0x4629b6(++_0x1716ce);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x3b0731,_0xcf9925){_0x3b0731=_0x3b0731-0x0;var _0x4204d7=_0xc4aa[_0x3b0731];return _0x4204d7;};'use strict';var VoiceExtensionEvents=require(_0xac4a('0x0'));var events=[_0xac4a('0x1'),_0xac4a('0x2'),_0xac4a('0x3')];function createListener(_0x275161,_0x22469d){return function(_0x58634e){_0x22469d['emit'](_0x275161,_0x58634e);};}function removeListener(_0x47d4f6,_0x2f48ed){return function(){VoiceExtensionEvents[_0xac4a('0x4')](_0x47d4f6,_0x2f48ed);};}exports[_0xac4a('0x5')]=function(_0x215f39){for(var _0x96be2b=0x0,_0x15cd34=events[_0xac4a('0x6')];_0x96be2b<_0x15cd34;_0x96be2b++){var _0x10525b=events[_0x96be2b];var _0x5c6179=createListener('voiceExtension:'+_0x10525b,_0x215f39);VoiceExtensionEvents['on'](_0x10525b,_0x5c6179);}}; \ No newline at end of file +var _0xabce=['voiceExtension:','./voiceExtension.events','save','remove','update','emit'];(function(_0x41ec9b,_0x5bc5eb){var _0x323d79=function(_0x442189){while(--_0x442189){_0x41ec9b['push'](_0x41ec9b['shift']());}};_0x323d79(++_0x5bc5eb);}(_0xabce,0x103));var _0xeabc=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0xabce[_0x6131cd];return _0x47e916;};'use strict';var VoiceExtensionEvents=require(_0xeabc('0x0'));var events=[_0xeabc('0x1'),_0xeabc('0x2'),_0xeabc('0x3')];function createListener(_0x49dbcc,_0x5bd1a4){return function(_0x5ebc95){_0x5bd1a4[_0xeabc('0x4')](_0x49dbcc,_0x5ebc95);};}function removeListener(_0x1d9f37,_0x1a88a7){return function(){VoiceExtensionEvents['removeListener'](_0x1d9f37,_0x1a88a7);};}exports['register']=function(_0x1b07a8){for(var _0x52a4d7=0x0,_0x229ba4=events['length'];_0x52a4d7<_0x229ba4;_0x52a4d7++){var _0x3bdc29=events[_0x52a4d7];var _0x9417af=createListener(_0xeabc('0x5')+_0x3bdc29,_0x1b07a8);VoiceExtensionEvents['on'](_0x3bdc29,_0x9417af);}}; \ No newline at end of file diff --git a/server/api/voiceMail/index.js b/server/api/voiceMail/index.js index af3e152..b12356f 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 _0xafc4=['delete','destroy','exports','multer','path','express','Router','fs-extra','../../components/auth/service','get','isAuthenticated','index','/:id','/:id/messages','getMessages','post','update'];(function(_0x121814,_0xfef884){var _0x472dea=function(_0x3a0355){while(--_0x3a0355){_0x121814['push'](_0x121814['shift']());}};_0x472dea(++_0xfef884);}(_0xafc4,0x69));var _0x4afc=function(_0x414088,_0x453a09){_0x414088=_0x414088-0x0;var _0x3b0133=_0xafc4[_0x414088];return _0x3b0133;};'use strict';var multer=require(_0x4afc('0x0'));var util=require('util');var path=require(_0x4afc('0x1'));var timeout=require('connect-timeout');var express=require(_0x4afc('0x2'));var router=express[_0x4afc('0x3')]();var fs_extra=require(_0x4afc('0x4'));var auth=require(_0x4afc('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./voiceMail.controller');router[_0x4afc('0x6')]('/',auth[_0x4afc('0x7')](),controller[_0x4afc('0x8')]);router[_0x4afc('0x6')](_0x4afc('0x9'),auth[_0x4afc('0x7')](),controller['show']);router[_0x4afc('0x6')](_0x4afc('0xa'),auth[_0x4afc('0x7')](),controller[_0x4afc('0xb')]);router[_0x4afc('0xc')]('/',auth[_0x4afc('0x7')](),controller['create']);router['put'](_0x4afc('0x9'),auth['isAuthenticated'](),controller[_0x4afc('0xd')]);router[_0x4afc('0xe')]('/:id',auth[_0x4afc('0x7')](),controller[_0x4afc('0xf')]);module[_0x4afc('0x10')]=router; \ No newline at end of file +var _0x2da6=['fs-extra','../../components/auth/service','./voiceMail.controller','get','isAuthenticated','index','/:id','show','getMessages','post','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x2724f7,_0xdab58f){var _0x3b930f=function(_0x10fb83){while(--_0x10fb83){_0x2724f7['push'](_0x2724f7['shift']());}};_0x3b930f(++_0xdab58f);}(_0x2da6,0x1dd));var _0x62da=function(_0x4c4a7d,_0x5034c8){_0x4c4a7d=_0x4c4a7d-0x0;var _0x1ff52f=_0x2da6[_0x4c4a7d];return _0x1ff52f;};'use strict';var multer=require(_0x62da('0x0'));var util=require(_0x62da('0x1'));var path=require(_0x62da('0x2'));var timeout=require(_0x62da('0x3'));var express=require(_0x62da('0x4'));var router=express[_0x62da('0x5')]();var fs_extra=require(_0x62da('0x6'));var auth=require(_0x62da('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x62da('0x8'));router[_0x62da('0x9')]('/',auth[_0x62da('0xa')](),controller[_0x62da('0xb')]);router[_0x62da('0x9')](_0x62da('0xc'),auth[_0x62da('0xa')](),controller[_0x62da('0xd')]);router[_0x62da('0x9')]('/:id/messages',auth[_0x62da('0xa')](),controller[_0x62da('0xe')]);router[_0x62da('0xf')]('/',auth[_0x62da('0xa')](),controller['create']);router[_0x62da('0x10')](_0x62da('0xc'),auth[_0x62da('0xa')](),controller[_0x62da('0x11')]);router[_0x62da('0x12')]('/:id',auth[_0x62da('0xa')](),controller[_0x62da('0x13')]);module[_0x62da('0x14')]=router; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.attributes.js b/server/api/voiceMail/voiceMail.attributes.js index e10e745..b773421 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 _0xa56a=['TIMESTAMP','INTEGER','getDataValue','fullname','mailbox','sequelize','exports','STRING','contest_mailbox','setDataValue','string','trim','central','ENUM','yes','TINYINT(4)'];(function(_0x48be84,_0x719030){var _0x109210=function(_0x2073ec){while(--_0x2073ec){_0x48be84['push'](_0x48be84['shift']());}};_0x109210(++_0x719030);}(_0xa56a,0x1c5));var _0xaa56=function(_0x4ee546,_0x3a7d19){_0x4ee546=_0x4ee546-0x0;var _0x368f48=_0xa56a[_0x4ee546];return _0x368f48;};'use strict';var Sequelize=require(_0xaa56('0x0'));module[_0xaa56('0x1')]={'customer_id':{'type':Sequelize[_0xaa56('0x2')]},'context':{'type':Sequelize[_0xaa56('0x2')],'defaultValue':'from-voicemail','unique':_0xaa56('0x3')},'mailbox':{'type':Sequelize['STRING'],'defaultValue':'','allowNull':![],'unique':_0xaa56('0x3')},'password':{'type':Sequelize[_0xaa56('0x2')]},'fullname':{'type':Sequelize[_0xaa56('0x2')]},'email':{'type':Sequelize[_0xaa56('0x2')],'validate':{'isEmail':!![]},'set':function(_0x54f12d){this[_0xaa56('0x4')]('email',typeof _0x54f12d===_0xaa56('0x5')&&_0x54f12d[_0xaa56('0x6')]()?_0x54f12d[_0xaa56('0x6')]():null);}},'pager':{'type':Sequelize[_0xaa56('0x2')]},'tz':{'type':Sequelize[_0xaa56('0x2')],'defaultValue':_0xaa56('0x7')},'attach':{'type':Sequelize[_0xaa56('0x8')](_0xaa56('0x9'),'no'),'defaultValue':'yes','allowNull':![]},'saycid':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':_0xaa56('0x9'),'allowNull':![]},'dialout':{'type':Sequelize[_0xaa56('0x2')]},'callback':{'type':Sequelize[_0xaa56('0x2')]},'review':{'type':Sequelize[_0xaa56('0x8')](_0xaa56('0x9'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize[_0xaa56('0x8')](_0xaa56('0x9'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0xaa56('0x8')](_0xaa56('0x9'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize['ENUM'](_0xaa56('0x9'),'no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0xaa56('0xa'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0xaa56('0x8')](_0xaa56('0x9'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0xaa56('0x8')](_0xaa56('0x9'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':_0xaa56('0x9'),'allowNull':![]},'forcename':{'type':Sequelize[_0xaa56('0x8')](_0xaa56('0x9'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize['ENUM'](_0xaa56('0x9'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0xaa56('0x8')](_0xaa56('0x9'),'no'),'defaultValue':_0xaa56('0x9'),'allowNull':![]},'stamp':{'type':_0xaa56('0xb')},'emailsubject':{'type':Sequelize[_0xaa56('0x2')]},'emailbody':{'type':Sequelize[_0xaa56('0x2')]},'maxsecs':{'type':Sequelize[_0xaa56('0xc')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0xaa56('0xc')](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0xaa56('0xd')](_0xaa56('0xe'))+'\x20-\x20'+this['getDataValue'](_0xaa56('0xf'));}}}; \ No newline at end of file +var _0x73b9=['exports','STRING','setDataValue','string','trim','central','ENUM','yes','TINYINT(4)','TIMESTAMP','INTEGER','getDataValue','\x20-\x20','mailbox','sequelize'];(function(_0x14c720,_0x4a44bf){var _0x5b7d40=function(_0x17aa0c){while(--_0x17aa0c){_0x14c720['push'](_0x14c720['shift']());}};_0x5b7d40(++_0x4a44bf);}(_0x73b9,0x12b));var _0x973b=function(_0x3a1b0d,_0x143c53){_0x3a1b0d=_0x3a1b0d-0x0;var _0xf9de11=_0x73b9[_0x3a1b0d];return _0xf9de11;};'use strict';var Sequelize=require(_0x973b('0x0'));module[_0x973b('0x1')]={'customer_id':{'type':Sequelize[_0x973b('0x2')]},'context':{'type':Sequelize[_0x973b('0x2')],'defaultValue':'from-voicemail','unique':'contest_mailbox'},'mailbox':{'type':Sequelize[_0x973b('0x2')],'defaultValue':'','allowNull':![],'unique':'contest_mailbox'},'password':{'type':Sequelize[_0x973b('0x2')]},'fullname':{'type':Sequelize[_0x973b('0x2')]},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]},'set':function(_0x1bbb49){this[_0x973b('0x3')]('email',typeof _0x1bbb49===_0x973b('0x4')&&_0x1bbb49[_0x973b('0x5')]()?_0x1bbb49['trim']():null);}},'pager':{'type':Sequelize['STRING']},'tz':{'type':Sequelize[_0x973b('0x2')],'defaultValue':_0x973b('0x6')},'attach':{'type':Sequelize[_0x973b('0x7')]('yes','no'),'defaultValue':_0x973b('0x8'),'allowNull':![]},'saycid':{'type':Sequelize['ENUM'](_0x973b('0x8'),'no'),'defaultValue':'yes','allowNull':![]},'dialout':{'type':Sequelize['STRING']},'callback':{'type':Sequelize[_0x973b('0x2')]},'review':{'type':Sequelize[_0x973b('0x7')](_0x973b('0x8'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize['ENUM'](_0x973b('0x8'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0x973b('0x7')](_0x973b('0x8'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0x973b('0x7')](_0x973b('0x8'),'no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0x973b('0x9'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0x973b('0x7')](_0x973b('0x8'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0x973b('0x7')](_0x973b('0x8'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0x973b('0x7')]('yes','no'),'defaultValue':'yes','allowNull':![]},'forcename':{'type':Sequelize[_0x973b('0x7')](_0x973b('0x8'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0x973b('0x7')]('yes','no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0x973b('0x7')](_0x973b('0x8'),'no'),'defaultValue':_0x973b('0x8'),'allowNull':![]},'stamp':{'type':_0x973b('0xa')},'emailsubject':{'type':Sequelize[_0x973b('0x2')]},'emailbody':{'type':Sequelize[_0x973b('0x2')]},'maxsecs':{'type':Sequelize['INTEGER'](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0x973b('0xb')](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0x973b('0xc')]('fullname')+_0x973b('0xd')+this[_0x973b('0xc')](_0x973b('0xe'));}}}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.controller.js b/server/api/voiceMail/voiceMail.controller.js index ecdbeaf..58158d4 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 _0x1775=['hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','include','params','includeAll','find','catch','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','get','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','findOne','rawAttributes','mailbox','options','VoiceMailMessage','findAndCountAll','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','apply','reject','save','then','destroy','Voicemails','UserProfileResource','name','send','index','VoiceMail','fieldName','type','map','query','keys','filters','intersection','model','attributes','fields','length'];(function(_0x399463,_0x1cb5fb){var _0x45cbd2=function(_0x1c8c2f){while(--_0x1c8c2f){_0x399463['push'](_0x399463['shift']());}};_0x45cbd2(++_0x1cb5fb);}(_0x1775,0x1db));var _0x5177=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x1775[_0x17d9e3];return _0x14192d;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5177('0x0'));var zipdir=require(_0x5177('0x1'));var jsonpatch=require(_0x5177('0x2'));var rp=require(_0x5177('0x3'));var moment=require(_0x5177('0x4'));var BPromise=require(_0x5177('0x5'));var Mustache=require(_0x5177('0x6'));var util=require(_0x5177('0x7'));var path=require(_0x5177('0x8'));var sox=require(_0x5177('0x9'));var csv=require(_0x5177('0xa'));var ejs=require(_0x5177('0xb'));var fs=require('fs');var fs_extra=require(_0x5177('0xc'));var _=require(_0x5177('0xd'));var squel=require(_0x5177('0xe'));var crypto=require(_0x5177('0xf'));var jsforce=require(_0x5177('0x10'));var deskjs=require(_0x5177('0x11'));var toCsv=require(_0x5177('0xa'));var querystring=require(_0x5177('0x12'));var Papa=require(_0x5177('0x13'));var Redis=require(_0x5177('0x14'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x5177('0x15'));var hardwareService=require(_0x5177('0x16'));var logger=require(_0x5177('0x17'))(_0x5177('0x18'));var utils=require(_0x5177('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0x5177('0x1a'));var db=require(_0x5177('0x1b'))['db'];function respondWithStatusCode(_0xc613b9,_0x3c4ced){_0x3c4ced=_0x3c4ced||0xcc;return function(_0x111e99){if(_0x111e99){return _0xc613b9[_0x5177('0x1c')](_0x3c4ced);}return _0xc613b9[_0x5177('0x1d')](_0x3c4ced)[_0x5177('0x1e')]();};}function respondWithResult(_0x3e6224,_0x1eb9dd){_0x1eb9dd=_0x1eb9dd||0xc8;return function(_0x41bef4){if(_0x41bef4){return _0x3e6224[_0x5177('0x1d')](_0x1eb9dd)[_0x5177('0x1f')](_0x41bef4);}};}function respondWithFilteredResult(_0x31aff8,_0x1b32e6){return function(_0x175ca6){if(_0x175ca6){var _0x2ab5e5=typeof _0x1b32e6[_0x5177('0x20')]===_0x5177('0x21')&&typeof _0x1b32e6['limit']===_0x5177('0x21');var _0x41e687=_0x175ca6[_0x5177('0x22')];var _0x1b4102=_0x2ab5e5?0x0:_0x1b32e6['offset'];var _0x3e6944=_0x2ab5e5?_0x175ca6[_0x5177('0x22')]:_0x1b32e6[_0x5177('0x20')]+_0x1b32e6['limit'];var _0x86f5f8;if(_0x3e6944>=_0x41e687){_0x3e6944=_0x41e687;_0x86f5f8=0xc8;}else{_0x86f5f8=0xce;}_0x31aff8['status'](_0x86f5f8);return _0x31aff8[_0x5177('0x23')](_0x5177('0x24'),_0x1b4102+'-'+_0x3e6944+'/'+_0x41e687)[_0x5177('0x1f')](_0x175ca6);}return null;};}function patchUpdates(_0x27b732){return function(_0x451e5c){try{jsonpatch[_0x5177('0x25')](_0x451e5c,_0x27b732,!![]);}catch(_0x174c4f){return BPromise[_0x5177('0x26')](_0x174c4f);}return _0x451e5c[_0x5177('0x27')]();};}function saveUpdates(_0x2a95cc,_0x23dad2){return function(_0x3b0c37){if(_0x3b0c37){return _0x3b0c37['update'](_0x2a95cc)[_0x5177('0x28')](function(_0x556f96){return _0x556f96;});}return null;};}function removeEntity(_0x30b60f,_0x2c68d8){return function(_0x3b39b5){if(_0x3b39b5){return _0x3b39b5[_0x5177('0x29')]()['then'](function(){var _0x2503ef=_0x3b39b5['get']({'plain':!![]});var _0x564139=_0x5177('0x2a');return db[_0x5177('0x2b')]['destroy']({'where':{'type':_0x564139,'resourceId':_0x2503ef['id']}})[_0x5177('0x28')](function(){return _0x3b39b5;});})['then'](function(){_0x30b60f[_0x5177('0x1d')](0xcc)[_0x5177('0x1e')]();});}};}function handleEntityNotFound(_0x58846c,_0x3e021a){return function(_0x2554ec){if(!_0x2554ec){_0x58846c[_0x5177('0x1c')](0x194);}return _0x2554ec;};}function handleError(_0x7f86e,_0xe98ff1){_0xe98ff1=_0xe98ff1||0x1f4;return function(_0x1cef5d){logger['error'](_0x1cef5d['stack']);if(_0x1cef5d[_0x5177('0x2c')]){delete _0x1cef5d[_0x5177('0x2c')];}_0x7f86e[_0x5177('0x1d')](_0xe98ff1)[_0x5177('0x2d')](_0x1cef5d);};}exports[_0x5177('0x2e')]=function(_0x8134f9,_0x31eb9f){var _0x72dced={},_0x49f6f1={},_0x42e1db={'count':0x0,'rows':[]};var _0x2233a2=_['map'](db[_0x5177('0x2f')]['rawAttributes'],function(_0x172b36){return{'name':_0x172b36[_0x5177('0x30')],'type':_0x172b36[_0x5177('0x31')]['key']};});_0x49f6f1['model']=_[_0x5177('0x32')](_0x2233a2,_0x5177('0x2c'));_0x49f6f1[_0x5177('0x33')]=_[_0x5177('0x34')](_0x8134f9[_0x5177('0x33')]);_0x49f6f1[_0x5177('0x35')]=_[_0x5177('0x36')](_0x49f6f1[_0x5177('0x37')],_0x49f6f1['query']);_0x72dced[_0x5177('0x38')]=_[_0x5177('0x36')](_0x49f6f1['model'],qs[_0x5177('0x39')](_0x8134f9[_0x5177('0x33')][_0x5177('0x39')]));_0x72dced[_0x5177('0x38')]=_0x72dced[_0x5177('0x38')][_0x5177('0x3a')]?_0x72dced['attributes']:_0x49f6f1[_0x5177('0x37')];if(!_0x8134f9[_0x5177('0x33')][_0x5177('0x3b')](_0x5177('0x3c'))){_0x72dced[_0x5177('0x3d')]=qs[_0x5177('0x3d')](_0x8134f9[_0x5177('0x33')]['limit']);_0x72dced[_0x5177('0x20')]=qs[_0x5177('0x20')](_0x8134f9['query']['offset']);}_0x72dced[_0x5177('0x3e')]=qs[_0x5177('0x3f')](_0x8134f9[_0x5177('0x33')][_0x5177('0x3f')]);_0x72dced[_0x5177('0x40')]=qs[_0x5177('0x35')](_[_0x5177('0x41')](_0x8134f9[_0x5177('0x33')],_0x49f6f1[_0x5177('0x35')]),_0x2233a2);if(_0x8134f9[_0x5177('0x33')][_0x5177('0x42')]){_0x72dced[_0x5177('0x40')]=_[_0x5177('0x43')](_0x72dced['where'],{'$or':_[_0x5177('0x32')](_0x2233a2,function(_0x2a4db1){if(_0x2a4db1['type']!==_0x5177('0x44')){var _0x56f297={};_0x56f297[_0x2a4db1[_0x5177('0x2c')]]={'$like':'%'+_0x8134f9[_0x5177('0x33')][_0x5177('0x42')]+'%'};return _0x56f297;}})});}_0x72dced=_['merge']({},_0x72dced,_0x8134f9['options']);var _0x210510={'where':_0x72dced[_0x5177('0x40')]};return db[_0x5177('0x2f')][_0x5177('0x22')](_0x210510)[_0x5177('0x28')](function(_0x3e710d){_0x42e1db[_0x5177('0x22')]=_0x3e710d;if(_0x8134f9[_0x5177('0x33')]['includeAll']){_0x72dced[_0x5177('0x45')]=[{'all':!![]}];}return db['VoiceMail']['findAll'](_0x72dced);})[_0x5177('0x28')](function(_0x17dc98){_0x42e1db['rows']=_0x17dc98;return _0x42e1db;})[_0x5177('0x28')](respondWithFilteredResult(_0x31eb9f,_0x72dced))['catch'](handleError(_0x31eb9f,null));};exports['show']=function(_0x46c833,_0x1769cd){var _0x262c71={'raw':!![],'where':{'id':_0x46c833[_0x5177('0x46')]['id']}},_0x3776b8={};_0x3776b8[_0x5177('0x37')]=_[_0x5177('0x34')](db['VoiceMail']['rawAttributes']);_0x3776b8[_0x5177('0x33')]=_['keys'](_0x46c833[_0x5177('0x33')]);_0x3776b8[_0x5177('0x35')]=_[_0x5177('0x36')](_0x3776b8[_0x5177('0x37')],_0x3776b8['query']);_0x262c71[_0x5177('0x38')]=_[_0x5177('0x36')](_0x3776b8[_0x5177('0x37')],qs[_0x5177('0x39')](_0x46c833[_0x5177('0x33')][_0x5177('0x39')]));_0x262c71[_0x5177('0x38')]=_0x262c71[_0x5177('0x38')][_0x5177('0x3a')]?_0x262c71[_0x5177('0x38')]:_0x3776b8[_0x5177('0x37')];if(_0x46c833['query'][_0x5177('0x47')]){_0x262c71['include']=[{'all':!![]}];}_0x262c71=_['merge']({},_0x262c71,_0x46c833['options']);return db[_0x5177('0x2f')][_0x5177('0x48')](_0x262c71)['then'](handleEntityNotFound(_0x1769cd,null))[_0x5177('0x28')](respondWithResult(_0x1769cd,null))[_0x5177('0x49')](handleError(_0x1769cd,null));};exports[_0x5177('0x4a')]=function(_0x4891fe,_0x1d4ae4){return db['VoiceMail']['create'](_0x4891fe['body'],{})[_0x5177('0x28')](function(_0x37d5dd){var _0x1300d7=_0x4891fe['user']['get']({'plain':!![]});if(!_0x1300d7)throw new Error(_0x5177('0x4b'));if(_0x1300d7['role']===_0x5177('0x4c')){var _0x9dd7a2=_0x37d5dd[_0x5177('0x4d')]({'plain':!![]});var _0x31a6e1=_0x5177('0x2a');return db[_0x5177('0x4e')][_0x5177('0x48')]({'where':{'name':_0x31a6e1,'userProfileId':_0x1300d7[_0x5177('0x4f')]},'raw':!![]})[_0x5177('0x28')](function(_0x217aca){if(_0x217aca&&_0x217aca[_0x5177('0x50')]===0x0){return db[_0x5177('0x2b')][_0x5177('0x4a')]({'name':_0x9dd7a2['name'],'resourceId':_0x9dd7a2['id'],'type':_0x217aca['name'],'sectionId':_0x217aca['id']},{})[_0x5177('0x28')](function(){return _0x37d5dd;});}else{return _0x37d5dd;}})['catch'](function(_0x649c6f){logger['error'](_0x5177('0x51'),_0x649c6f);throw _0x649c6f;});}return _0x37d5dd;})[_0x5177('0x28')](respondWithResult(_0x1d4ae4,0xc9))[_0x5177('0x49')](handleError(_0x1d4ae4,null));};exports['update']=function(_0x5be224,_0x19884e){if(_0x5be224[_0x5177('0x52')]['id']){delete _0x5be224[_0x5177('0x52')]['id'];}return db[_0x5177('0x2f')]['find']({'where':{'id':_0x5be224['params']['id']}})[_0x5177('0x28')](handleEntityNotFound(_0x19884e,null))[_0x5177('0x28')](saveUpdates(_0x5be224[_0x5177('0x52')],null))[_0x5177('0x28')](respondWithResult(_0x19884e,null))['catch'](handleError(_0x19884e,null));};exports[_0x5177('0x29')]=function(_0x143aff,_0x3a18ad){return db['VoiceMail'][_0x5177('0x48')]({'where':{'id':_0x143aff[_0x5177('0x46')]['id']}})[_0x5177('0x28')](handleEntityNotFound(_0x3a18ad,null))['then'](removeEntity(_0x3a18ad,null))[_0x5177('0x49')](handleError(_0x3a18ad,null));};exports['getMessages']=function(_0x40dfd6,_0x39fb92,_0x3268bd){return db['VoiceMail'][_0x5177('0x53')]({'where':{'id':_0x40dfd6[_0x5177('0x46')]['id']}})[_0x5177('0x28')](handleEntityNotFound(_0x39fb92,null))[_0x5177('0x28')](function(_0xc7a59e){var _0x74589e;var _0x37380c={},_0x267599={};_0x267599['model']=_['keys'](db['VoiceMailMessage'][_0x5177('0x54')]);_0x267599[_0x5177('0x33')]=_[_0x5177('0x34')](_0x40dfd6[_0x5177('0x33')]);_0x267599[_0x5177('0x35')]=_[_0x5177('0x36')](_0x267599['model'],_0x267599['query']);_0x37380c[_0x5177('0x38')]=_[_0x5177('0x36')](_0x267599[_0x5177('0x37')],qs[_0x5177('0x39')](_0x40dfd6[_0x5177('0x33')][_0x5177('0x39')]));_0x37380c[_0x5177('0x38')]=_0x37380c[_0x5177('0x38')][_0x5177('0x3a')]?_0x37380c['attributes']:_0x267599[_0x5177('0x37')];if(!_0x40dfd6[_0x5177('0x33')]['hasOwnProperty'](_0x5177('0x3c'))){_0x37380c[_0x5177('0x3d')]=qs['limit'](_0x40dfd6[_0x5177('0x33')][_0x5177('0x3d')]);_0x37380c[_0x5177('0x20')]=qs['offset'](_0x40dfd6[_0x5177('0x33')][_0x5177('0x20')]);}_0x37380c['order']=qs['sort'](_0x40dfd6[_0x5177('0x33')]['sort']);_0x37380c[_0x5177('0x40')]=qs['filters'](_[_0x5177('0x41')](_0x40dfd6[_0x5177('0x33')],_0x267599['filters']));if(_0x40dfd6[_0x5177('0x33')][_0x5177('0x42')]){_0x37380c[_0x5177('0x40')]=_[_0x5177('0x43')](_0x37380c[_0x5177('0x40')],{'$or':_[_0x5177('0x32')](_0x37380c[_0x5177('0x38')],function(_0x58ebdd){var _0x26b733={};_0x26b733[_0x58ebdd]={'$like':'%'+_0x40dfd6['query']['filter']+'%'};return _0x26b733;})});}_0x37380c[_0x5177('0x40')]=_[_0x5177('0x43')](_0x37380c['where'],{'mailboxuser':_0xc7a59e[_0x5177('0x55')]});_0x37380c=_[_0x5177('0x43')]({},_0x37380c,_0x40dfd6[_0x5177('0x56')]);return db[_0x5177('0x57')][_0x5177('0x58')](_0x37380c)[_0x5177('0x28')](respondWithFilteredResult(_0x39fb92,_0x37380c));})[_0x5177('0x49')](handleError(_0x39fb92,null));}; \ No newline at end of file +var _0xf45e=['request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','end','status','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','destroy','then','UserProfileResource','error','stack','name','send','map','VoiceMail','type','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filters','filter','where','merge','VIRTUAL','options','include','findAll','rows','catch','params','rawAttributes','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Voicemails','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','getMessages','findOne','VoiceMailMessage','mailbox','findAndCountAll','eml-format','zip-dir'];(function(_0x4195d8,_0x246ebd){var _0x4b3a94=function(_0x7f41f6){while(--_0x7f41f6){_0x4195d8['push'](_0x4195d8['shift']());}};_0x4b3a94(++_0x246ebd);}(_0xf45e,0x115));var _0xef45=function(_0x15c397,_0x48a1ed){_0x15c397=_0x15c397-0x0;var _0x5e5feb=_0xf45e[_0x15c397];return _0x5e5feb;};'use strict';var emlformat=require(_0xef45('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xef45('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xef45('0x2'));var moment=require(_0xef45('0x3'));var BPromise=require(_0xef45('0x4'));var Mustache=require(_0xef45('0x5'));var util=require(_0xef45('0x6'));var path=require(_0xef45('0x7'));var sox=require(_0xef45('0x8'));var csv=require(_0xef45('0x9'));var ejs=require(_0xef45('0xa'));var fs=require('fs');var fs_extra=require(_0xef45('0xb'));var _=require(_0xef45('0xc'));var squel=require(_0xef45('0xd'));var crypto=require(_0xef45('0xe'));var jsforce=require(_0xef45('0xf'));var deskjs=require(_0xef45('0x10'));var toCsv=require(_0xef45('0x9'));var querystring=require(_0xef45('0x11'));var Papa=require(_0xef45('0x12'));var Redis=require(_0xef45('0x13'));var authService=require('../../components/auth/service');var qs=require(_0xef45('0x14'));var as=require(_0xef45('0x15'));var hardwareService=require(_0xef45('0x16'));var logger=require(_0xef45('0x17'))(_0xef45('0x18'));var utils=require(_0xef45('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0xef45('0x1a'));var db=require(_0xef45('0x1b'))['db'];function respondWithStatusCode(_0x30babb,_0x433be9){_0x433be9=_0x433be9||0xcc;return function(_0x476739){if(_0x476739){return _0x30babb['sendStatus'](_0x433be9);}return _0x30babb['status'](_0x433be9)[_0xef45('0x1c')]();};}function respondWithResult(_0x47fd96,_0x2ae89a){_0x2ae89a=_0x2ae89a||0xc8;return function(_0xb0fc43){if(_0xb0fc43){return _0x47fd96[_0xef45('0x1d')](_0x2ae89a)['json'](_0xb0fc43);}};}function respondWithFilteredResult(_0x5b3136,_0x29c0c4){return function(_0x5530e6){if(_0x5530e6){var _0x11cd3a=typeof _0x29c0c4[_0xef45('0x1e')]===_0xef45('0x1f')&&typeof _0x29c0c4[_0xef45('0x20')]==='undefined';var _0x560b2f=_0x5530e6[_0xef45('0x21')];var _0x219778=_0x11cd3a?0x0:_0x29c0c4[_0xef45('0x1e')];var _0x258785=_0x11cd3a?_0x5530e6['count']:_0x29c0c4['offset']+_0x29c0c4[_0xef45('0x20')];var _0x20ef26;if(_0x258785>=_0x560b2f){_0x258785=_0x560b2f;_0x20ef26=0xc8;}else{_0x20ef26=0xce;}_0x5b3136[_0xef45('0x1d')](_0x20ef26);return _0x5b3136[_0xef45('0x22')](_0xef45('0x23'),_0x219778+'-'+_0x258785+'/'+_0x560b2f)[_0xef45('0x24')](_0x5530e6);}return null;};}function patchUpdates(_0x375cbd){return function(_0x4a6217){try{jsonpatch[_0xef45('0x25')](_0x4a6217,_0x375cbd,!![]);}catch(_0x3e2a47){return BPromise[_0xef45('0x26')](_0x3e2a47);}return _0x4a6217[_0xef45('0x27')]();};}function saveUpdates(_0x27322f,_0x5205bf){return function(_0x40abc8){if(_0x40abc8){return _0x40abc8['update'](_0x27322f)['then'](function(_0x7707a1){return _0x7707a1;});}return null;};}function removeEntity(_0x2b41d8,_0xbb859b){return function(_0x7817d0){if(_0x7817d0){return _0x7817d0[_0xef45('0x28')]()[_0xef45('0x29')](function(){var _0x315777=_0x7817d0['get']({'plain':!![]});var _0x208b35='Voicemails';return db[_0xef45('0x2a')][_0xef45('0x28')]({'where':{'type':_0x208b35,'resourceId':_0x315777['id']}})['then'](function(){return _0x7817d0;});})[_0xef45('0x29')](function(){_0x2b41d8[_0xef45('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1096af,_0x4f8c9b){return function(_0x550e18){if(!_0x550e18){_0x1096af['sendStatus'](0x194);}return _0x550e18;};}function handleError(_0x53690e,_0x1f636f){_0x1f636f=_0x1f636f||0x1f4;return function(_0x2f72ef){logger[_0xef45('0x2b')](_0x2f72ef[_0xef45('0x2c')]);if(_0x2f72ef['name']){delete _0x2f72ef[_0xef45('0x2d')];}_0x53690e['status'](_0x1f636f)[_0xef45('0x2e')](_0x2f72ef);};}exports['index']=function(_0x3e6922,_0x5bfd2d){var _0x575734={},_0x14ce5a={},_0x3e45de={'count':0x0,'rows':[]};var _0x390a7a=_[_0xef45('0x2f')](db[_0xef45('0x30')]['rawAttributes'],function(_0x5551ce){return{'name':_0x5551ce['fieldName'],'type':_0x5551ce[_0xef45('0x31')][_0xef45('0x32')]};});_0x14ce5a[_0xef45('0x33')]=_[_0xef45('0x2f')](_0x390a7a,_0xef45('0x2d'));_0x14ce5a[_0xef45('0x34')]=_[_0xef45('0x35')](_0x3e6922['query']);_0x14ce5a['filters']=_[_0xef45('0x36')](_0x14ce5a['model'],_0x14ce5a[_0xef45('0x34')]);_0x575734['attributes']=_[_0xef45('0x36')](_0x14ce5a[_0xef45('0x33')],qs[_0xef45('0x37')](_0x3e6922[_0xef45('0x34')][_0xef45('0x37')]));_0x575734['attributes']=_0x575734[_0xef45('0x38')][_0xef45('0x39')]?_0x575734[_0xef45('0x38')]:_0x14ce5a['model'];if(!_0x3e6922['query'][_0xef45('0x3a')](_0xef45('0x3b'))){_0x575734['limit']=qs[_0xef45('0x20')](_0x3e6922['query']['limit']);_0x575734[_0xef45('0x1e')]=qs[_0xef45('0x1e')](_0x3e6922[_0xef45('0x34')]['offset']);}_0x575734[_0xef45('0x3c')]=qs[_0xef45('0x3d')](_0x3e6922[_0xef45('0x34')][_0xef45('0x3d')]);_0x575734['where']=qs['filters'](_[_0xef45('0x3e')](_0x3e6922[_0xef45('0x34')],_0x14ce5a[_0xef45('0x3f')]),_0x390a7a);if(_0x3e6922[_0xef45('0x34')][_0xef45('0x40')]){_0x575734[_0xef45('0x41')]=_[_0xef45('0x42')](_0x575734[_0xef45('0x41')],{'$or':_['map'](_0x390a7a,function(_0x4f5877){if(_0x4f5877[_0xef45('0x31')]!==_0xef45('0x43')){var _0x154e72={};_0x154e72[_0x4f5877[_0xef45('0x2d')]]={'$like':'%'+_0x3e6922[_0xef45('0x34')][_0xef45('0x40')]+'%'};return _0x154e72;}})});}_0x575734=_[_0xef45('0x42')]({},_0x575734,_0x3e6922[_0xef45('0x44')]);var _0x3a5082={'where':_0x575734[_0xef45('0x41')]};return db[_0xef45('0x30')][_0xef45('0x21')](_0x3a5082)[_0xef45('0x29')](function(_0xd7d217){_0x3e45de[_0xef45('0x21')]=_0xd7d217;if(_0x3e6922[_0xef45('0x34')]['includeAll']){_0x575734[_0xef45('0x45')]=[{'all':!![]}];}return db[_0xef45('0x30')][_0xef45('0x46')](_0x575734);})[_0xef45('0x29')](function(_0x54ccb8){_0x3e45de[_0xef45('0x47')]=_0x54ccb8;return _0x3e45de;})['then'](respondWithFilteredResult(_0x5bfd2d,_0x575734))[_0xef45('0x48')](handleError(_0x5bfd2d,null));};exports['show']=function(_0x5faf67,_0x2d086f){var _0x2236d9={'raw':!![],'where':{'id':_0x5faf67[_0xef45('0x49')]['id']}},_0x36e81a={};_0x36e81a[_0xef45('0x33')]=_[_0xef45('0x35')](db['VoiceMail'][_0xef45('0x4a')]);_0x36e81a[_0xef45('0x34')]=_[_0xef45('0x35')](_0x5faf67[_0xef45('0x34')]);_0x36e81a[_0xef45('0x3f')]=_[_0xef45('0x36')](_0x36e81a[_0xef45('0x33')],_0x36e81a[_0xef45('0x34')]);_0x2236d9[_0xef45('0x38')]=_[_0xef45('0x36')](_0x36e81a[_0xef45('0x33')],qs[_0xef45('0x37')](_0x5faf67[_0xef45('0x34')][_0xef45('0x37')]));_0x2236d9[_0xef45('0x38')]=_0x2236d9['attributes'][_0xef45('0x39')]?_0x2236d9[_0xef45('0x38')]:_0x36e81a[_0xef45('0x33')];if(_0x5faf67['query']['includeAll']){_0x2236d9['include']=[{'all':!![]}];}_0x2236d9=_[_0xef45('0x42')]({},_0x2236d9,_0x5faf67[_0xef45('0x44')]);return db[_0xef45('0x30')][_0xef45('0x4b')](_0x2236d9)[_0xef45('0x29')](handleEntityNotFound(_0x2d086f,null))[_0xef45('0x29')](respondWithResult(_0x2d086f,null))['catch'](handleError(_0x2d086f,null));};exports[_0xef45('0x4c')]=function(_0x463796,_0x2b2419){return db['VoiceMail']['create'](_0x463796[_0xef45('0x4d')],{})[_0xef45('0x29')](function(_0x4feeb1){var _0x1a56ae=_0x463796[_0xef45('0x4e')][_0xef45('0x4f')]({'plain':!![]});if(!_0x1a56ae)throw new Error(_0xef45('0x50'));if(_0x1a56ae[_0xef45('0x51')]===_0xef45('0x4e')){var _0x23581f=_0x4feeb1[_0xef45('0x4f')]({'plain':!![]});var _0x1961b4=_0xef45('0x52');return db[_0xef45('0x53')][_0xef45('0x4b')]({'where':{'name':_0x1961b4,'userProfileId':_0x1a56ae[_0xef45('0x54')]},'raw':!![]})[_0xef45('0x29')](function(_0x48a391){if(_0x48a391&&_0x48a391[_0xef45('0x55')]===0x0){return db[_0xef45('0x2a')][_0xef45('0x4c')]({'name':_0x23581f['name'],'resourceId':_0x23581f['id'],'type':_0x48a391[_0xef45('0x2d')],'sectionId':_0x48a391['id']},{})[_0xef45('0x29')](function(){return _0x4feeb1;});}else{return _0x4feeb1;}})[_0xef45('0x48')](function(_0x1531ea){logger['error'](_0xef45('0x56'),_0x1531ea);throw _0x1531ea;});}return _0x4feeb1;})[_0xef45('0x29')](respondWithResult(_0x2b2419,0xc9))[_0xef45('0x48')](handleError(_0x2b2419,null));};exports[_0xef45('0x57')]=function(_0x67d57b,_0x41f575){if(_0x67d57b[_0xef45('0x4d')]['id']){delete _0x67d57b[_0xef45('0x4d')]['id'];}return db[_0xef45('0x30')][_0xef45('0x4b')]({'where':{'id':_0x67d57b[_0xef45('0x49')]['id']}})[_0xef45('0x29')](handleEntityNotFound(_0x41f575,null))['then'](saveUpdates(_0x67d57b[_0xef45('0x4d')],null))[_0xef45('0x29')](respondWithResult(_0x41f575,null))[_0xef45('0x48')](handleError(_0x41f575,null));};exports[_0xef45('0x28')]=function(_0x2fe9cf,_0x32232f){return db['VoiceMail']['find']({'where':{'id':_0x2fe9cf[_0xef45('0x49')]['id']}})['then'](handleEntityNotFound(_0x32232f,null))[_0xef45('0x29')](removeEntity(_0x32232f,null))[_0xef45('0x48')](handleError(_0x32232f,null));};exports[_0xef45('0x58')]=function(_0x5676fb,_0x16b04e,_0x398dc0){return db['VoiceMail'][_0xef45('0x59')]({'where':{'id':_0x5676fb['params']['id']}})['then'](handleEntityNotFound(_0x16b04e,null))[_0xef45('0x29')](function(_0x4f78ac){var _0x189f22;var _0x3fbc26={},_0x22fd64={};_0x22fd64['model']=_[_0xef45('0x35')](db[_0xef45('0x5a')]['rawAttributes']);_0x22fd64[_0xef45('0x34')]=_[_0xef45('0x35')](_0x5676fb[_0xef45('0x34')]);_0x22fd64[_0xef45('0x3f')]=_[_0xef45('0x36')](_0x22fd64[_0xef45('0x33')],_0x22fd64[_0xef45('0x34')]);_0x3fbc26[_0xef45('0x38')]=_['intersection'](_0x22fd64[_0xef45('0x33')],qs['fields'](_0x5676fb['query'][_0xef45('0x37')]));_0x3fbc26['attributes']=_0x3fbc26[_0xef45('0x38')][_0xef45('0x39')]?_0x3fbc26['attributes']:_0x22fd64[_0xef45('0x33')];if(!_0x5676fb[_0xef45('0x34')][_0xef45('0x3a')](_0xef45('0x3b'))){_0x3fbc26[_0xef45('0x20')]=qs[_0xef45('0x20')](_0x5676fb['query'][_0xef45('0x20')]);_0x3fbc26[_0xef45('0x1e')]=qs[_0xef45('0x1e')](_0x5676fb[_0xef45('0x34')][_0xef45('0x1e')]);}_0x3fbc26['order']=qs[_0xef45('0x3d')](_0x5676fb['query'][_0xef45('0x3d')]);_0x3fbc26[_0xef45('0x41')]=qs['filters'](_[_0xef45('0x3e')](_0x5676fb[_0xef45('0x34')],_0x22fd64[_0xef45('0x3f')]));if(_0x5676fb['query']['filter']){_0x3fbc26[_0xef45('0x41')]=_[_0xef45('0x42')](_0x3fbc26[_0xef45('0x41')],{'$or':_['map'](_0x3fbc26[_0xef45('0x38')],function(_0x3956b0){var _0x49131e={};_0x49131e[_0x3956b0]={'$like':'%'+_0x5676fb[_0xef45('0x34')]['filter']+'%'};return _0x49131e;})});}_0x3fbc26[_0xef45('0x41')]=_[_0xef45('0x42')](_0x3fbc26[_0xef45('0x41')],{'mailboxuser':_0x4f78ac[_0xef45('0x5b')]});_0x3fbc26=_[_0xef45('0x42')]({},_0x3fbc26,_0x5676fb[_0xef45('0x44')]);return db[_0xef45('0x5a')][_0xef45('0x5c')](_0x3fbc26)['then'](respondWithFilteredResult(_0x16b04e,_0x3fbc26));})[_0xef45('0x48')](handleError(_0x16b04e,null));}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.model.js b/server/api/voiceMail/voiceMail.model.js index 8f8a4fb..2a5e0fe 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 _0xdae2=['bluebird','request-promise','../../config/environment','VoiceMail','mailbox_context','mailbox','util','../../config/logger','api','moment'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0xdae2,0x16e));var _0x2dae=function(_0x26462c,_0xd20a35){_0x26462c=_0x26462c-0x0;var _0x509a42=_0xdae2[_0x26462c];return _0x509a42;};'use strict';var _=require('lodash');var util=require(_0x2dae('0x0'));var logger=require(_0x2dae('0x1'))(_0x2dae('0x2'));var moment=require(_0x2dae('0x3'));var BPromise=require(_0x2dae('0x4'));var rp=require(_0x2dae('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x2dae('0x6'));var attributes=require('./voiceMail.attributes');module['exports']=function(_0x43520a,_0x5eeb6c){return _0x43520a['define'](_0x2dae('0x7'),attributes,{'tableName':'voice_voicemail','paranoid':![],'indexes':[{'name':_0x2dae('0x8'),'fields':[_0x2dae('0x9'),'context']}],'timestamps':!![]});}; \ No newline at end of file +var _0xf338=['lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./voiceMail.attributes','exports','VoiceMail','voice_voicemail','mailbox','context'];(function(_0x4e783c,_0x51a362){var _0x2fbd6d=function(_0x513e00){while(--_0x513e00){_0x4e783c['push'](_0x4e783c['shift']());}};_0x2fbd6d(++_0x51a362);}(_0xf338,0xc3));var _0x8f33=function(_0x1a458a,_0x4b141d){_0x1a458a=_0x1a458a-0x0;var _0x39a3dd=_0xf338[_0x1a458a];return _0x39a3dd;};'use strict';var _=require(_0x8f33('0x0'));var util=require(_0x8f33('0x1'));var logger=require(_0x8f33('0x2'))(_0x8f33('0x3'));var moment=require(_0x8f33('0x4'));var BPromise=require(_0x8f33('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x8f33('0x6'));var rimraf=require(_0x8f33('0x7'));var config=require(_0x8f33('0x8'));var attributes=require(_0x8f33('0x9'));module[_0x8f33('0xa')]=function(_0x33b579,_0x2198bf){return _0x33b579['define'](_0x8f33('0xb'),attributes,{'tableName':_0x8f33('0xc'),'paranoid':![],'indexes':[{'name':'mailbox_context','fields':[_0x8f33('0xd'),_0x8f33('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 4652d40..96b198e 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 _0xc33b=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','info','request\x20sent','debug','stringify','error','VoiceMail,\x20%s,\x20%s','message','catch','lodash','util','moment','bluebird'];(function(_0x39e164,_0x2cb93b){var _0x13fa6b=function(_0x511cb2){while(--_0x511cb2){_0x39e164['push'](_0x39e164['shift']());}};_0x13fa6b(++_0x2cb93b);}(_0xc33b,0x65));var _0xbc33=function(_0x1199ed,_0x386887){_0x1199ed=_0x1199ed-0x0;var _0x356067=_0xc33b[_0x1199ed];return _0x356067;};'use strict';var _=require(_0xbc33('0x0'));var util=require(_0xbc33('0x1'));var moment=require(_0xbc33('0x2'));var BPromise=require(_0xbc33('0x3'));var rs=require(_0xbc33('0x4'));var fs=require('fs');var Redis=require(_0xbc33('0x5'));var db=require(_0xbc33('0x6'))['db'];var utils=require(_0xbc33('0x7'));var logger=require(_0xbc33('0x8'))(_0xbc33('0x9'));var config=require('../../config/environment');var jayson=require(_0xbc33('0xa'));var client=jayson[_0xbc33('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0xbfba0c,_0x1896a1,_0x4bfda2){return new BPromise(function(_0x770e,_0x47e547){return client[_0xbc33('0xc')](_0xbfba0c,_0x4bfda2)['then'](function(_0x5bd476){logger[_0xbc33('0xd')]('VoiceMail,\x20%s,\x20%s',_0x1896a1,_0xbc33('0xe'));logger[_0xbc33('0xf')]('VoiceMail,\x20%s,\x20%s,\x20%s',_0x1896a1,_0xbc33('0xe'),JSON[_0xbc33('0x10')](_0x5bd476));if(_0x5bd476[_0xbc33('0x11')]){if(_0x5bd476[_0xbc33('0x11')]['code']===0x1f4){logger['error'](_0xbc33('0x12'),_0x1896a1,_0x5bd476[_0xbc33('0x11')][_0xbc33('0x13')]);return _0x47e547(_0x5bd476[_0xbc33('0x11')][_0xbc33('0x13')]);}logger[_0xbc33('0x11')](_0xbc33('0x12'),_0x1896a1,_0x5bd476['error'][_0xbc33('0x13')]);return _0x770e(_0x5bd476['error'][_0xbc33('0x13')]);}else{logger[_0xbc33('0xd')](_0xbc33('0x12'),_0x1896a1,_0xbc33('0xe'));_0x770e(_0x5bd476['result'][_0xbc33('0x13')]);}})[_0xbc33('0x14')](function(_0x10ebbb){logger[_0xbc33('0x11')](_0xbc33('0x12'),_0x1896a1,_0x10ebbb);_0x47e547(_0x10ebbb);});});} \ No newline at end of file +var _0x4451=['lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','VoiceMail,\x20%s,\x20%s','request\x20sent','VoiceMail,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch'];(function(_0x1e7137,_0x566ac9){var _0x536c0a=function(_0x2d8e6b){while(--_0x2d8e6b){_0x1e7137['push'](_0x1e7137['shift']());}};_0x536c0a(++_0x566ac9);}(_0x4451,0x15e));var _0x1445=function(_0x2600ee,_0x2073fd){_0x2600ee=_0x2600ee-0x0;var _0x2f9049=_0x4451[_0x2600ee];return _0x2f9049;};'use strict';var _=require(_0x1445('0x0'));var util=require(_0x1445('0x1'));var moment=require(_0x1445('0x2'));var BPromise=require(_0x1445('0x3'));var rs=require(_0x1445('0x4'));var fs=require('fs');var Redis=require(_0x1445('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x1445('0x6'));var logger=require(_0x1445('0x7'))(_0x1445('0x8'));var config=require(_0x1445('0x9'));var jayson=require(_0x1445('0xa'));var client=jayson[_0x1445('0xb')][_0x1445('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x3fb1ad,_0x36ec88,_0x38238c){return new BPromise(function(_0x41d720,_0x250900){return client[_0x1445('0xd')](_0x3fb1ad,_0x38238c)[_0x1445('0xe')](function(_0x175b0e){logger[_0x1445('0xf')](_0x1445('0x10'),_0x36ec88,_0x1445('0x11'));logger['debug'](_0x1445('0x12'),_0x36ec88,_0x1445('0x11'),JSON[_0x1445('0x13')](_0x175b0e));if(_0x175b0e[_0x1445('0x14')]){if(_0x175b0e[_0x1445('0x14')][_0x1445('0x15')]===0x1f4){logger[_0x1445('0x14')](_0x1445('0x10'),_0x36ec88,_0x175b0e[_0x1445('0x14')][_0x1445('0x16')]);return _0x250900(_0x175b0e[_0x1445('0x14')]['message']);}logger['error'](_0x1445('0x10'),_0x36ec88,_0x175b0e[_0x1445('0x14')][_0x1445('0x16')]);return _0x41d720(_0x175b0e[_0x1445('0x14')]['message']);}else{logger[_0x1445('0xf')](_0x1445('0x10'),_0x36ec88,'request\x20sent');_0x41d720(_0x175b0e[_0x1445('0x17')][_0x1445('0x16')]);}})[_0x1445('0x18')](function(_0x2cc0d3){logger[_0x1445('0x14')](_0x1445('0x10'),_0x36ec88,_0x2cc0d3);_0x250900(_0x2cc0d3);});});} \ No newline at end of file diff --git a/server/api/voiceMailMessage/index.js b/server/api/voiceMailMessage/index.js index 1a14d02..57bb121 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 _0x9d30=['multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMailMessage.controller','get','/:id/download','isAuthenticated','post','create','put','/:id','update','destroy','exports'];(function(_0x590794,_0x4e29b5){var _0x657a79=function(_0x2ffd0f){while(--_0x2ffd0f){_0x590794['push'](_0x590794['shift']());}};_0x657a79(++_0x4e29b5);}(_0x9d30,0xb4));var _0x09d3=function(_0x3c033a,_0x3556b6){_0x3c033a=_0x3c033a-0x0;var _0x5a7ae5=_0x9d30[_0x3c033a];return _0x5a7ae5;};'use strict';var multer=require(_0x09d3('0x0'));var util=require(_0x09d3('0x1'));var path=require('path');var timeout=require(_0x09d3('0x2'));var express=require(_0x09d3('0x3'));var router=express[_0x09d3('0x4')]();var fs_extra=require(_0x09d3('0x5'));var auth=require(_0x09d3('0x6'));var interaction=require(_0x09d3('0x7'));var config=require(_0x09d3('0x8'));var controller=require(_0x09d3('0x9'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x09d3('0xa')]('/:id',auth['isAuthenticated'](),controller['show']);router['get'](_0x09d3('0xb'),auth[_0x09d3('0xc')](),controller['download']);router[_0x09d3('0xd')]('/',auth['isAuthenticated'](),controller[_0x09d3('0xe')]);router[_0x09d3('0xf')](_0x09d3('0x10'),auth[_0x09d3('0xc')](),controller[_0x09d3('0x11')]);router['delete'](_0x09d3('0x10'),auth[_0x09d3('0xc')](),controller[_0x09d3('0x12')]);module[_0x09d3('0x13')]=router; \ No newline at end of file +var _0x8ac2=['index','/:id','isAuthenticated','/:id/download','post','put','update','delete','exports','multer','util','path','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMailMessage.controller','get'];(function(_0x3b3cc6,_0x1a6e24){var _0x1161e4=function(_0x19cc52){while(--_0x19cc52){_0x3b3cc6['push'](_0x3b3cc6['shift']());}};_0x1161e4(++_0x1a6e24);}(_0x8ac2,0x14d));var _0x28ac=function(_0x73740d,_0x483311){_0x73740d=_0x73740d-0x0;var _0x3e2fb4=_0x8ac2[_0x73740d];return _0x3e2fb4;};'use strict';var multer=require(_0x28ac('0x0'));var util=require(_0x28ac('0x1'));var path=require(_0x28ac('0x2'));var timeout=require(_0x28ac('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x28ac('0x4'));var interaction=require(_0x28ac('0x5'));var config=require(_0x28ac('0x6'));var controller=require(_0x28ac('0x7'));router[_0x28ac('0x8')]('/',auth['isAuthenticated'](),controller[_0x28ac('0x9')]);router[_0x28ac('0x8')](_0x28ac('0xa'),auth[_0x28ac('0xb')](),controller['show']);router['get'](_0x28ac('0xc'),auth['isAuthenticated'](),controller['download']);router[_0x28ac('0xd')]('/',auth[_0x28ac('0xb')](),controller['create']);router[_0x28ac('0xe')](_0x28ac('0xa'),auth[_0x28ac('0xb')](),controller[_0x28ac('0xf')]);router[_0x28ac('0x10')](_0x28ac('0xa'),auth[_0x28ac('0xb')](),controller['destroy']);module[_0x28ac('0x11')]=router; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.attributes.js b/server/api/voiceMailMessage/voiceMailMessage.attributes.js index bfde75c..b992fcd 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 _0x9cf9=['STRING','BLOB','TIMESTAMP','literal','sequelize','getDataValue'];(function(_0x102dfa,_0x83034b){var _0x211f22=function(_0x20e448){while(--_0x20e448){_0x102dfa['push'](_0x102dfa['shift']());}};_0x211f22(++_0x83034b);}(_0x9cf9,0xac));var _0x99cf=function(_0x1c24f0,_0x7fb25){_0x1c24f0=_0x1c24f0-0x0;var _0x121b29=_0x9cf9[_0x1c24f0];return _0x121b29;};'use strict';var Sequelize=require(_0x99cf('0x0'));module['exports']={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x8ecebd){return this[_0x99cf('0x1')]('id');}},'msgnum':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0x99cf('0x2')],'defaultValue':''},'context':{'type':Sequelize['STRING'],'defaultValue':''},'macrocontext':{'type':Sequelize[_0x99cf('0x2')],'defaultValue':''},'callerid':{'type':Sequelize[_0x99cf('0x2')],'defaultValue':''},'origtime':{'type':Sequelize['STRING'],'defaultValue':''},'duration':{'type':Sequelize[_0x99cf('0x2')],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0x99cf('0x2')],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0x99cf('0x2')],'defaultValue':''},'recording':{'type':Sequelize[_0x99cf('0x3')]('long'),'defaultValue':null},'flag':{'type':Sequelize['STRING'],'defaultValue':''},'msg_id':{'type':Sequelize[_0x99cf('0x2')],'defaultValue':''},'stamp':{'type':_0x99cf('0x4'),'defaultValue':Sequelize[_0x99cf('0x5')]('CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP')}}; \ No newline at end of file +var _0x32bb=['TIMESTAMP','literal','getDataValue','INTEGER','STRING','BLOB','long'];(function(_0x3f32ce,_0x44c8d7){var _0x5a3dc4=function(_0x3e0d18){while(--_0x3e0d18){_0x3f32ce['push'](_0x3f32ce['shift']());}};_0x5a3dc4(++_0x44c8d7);}(_0x32bb,0xdb));var _0xb32b=function(_0x16db8b,_0xca7d28){_0x16db8b=_0x16db8b-0x0;var _0x5ba017=_0x32bb[_0x16db8b];return _0x5ba017;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x2ba465){return this[_0xb32b('0x0')]('id');}},'msgnum':{'type':Sequelize[_0xb32b('0x1')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0xb32b('0x2')],'defaultValue':''},'context':{'type':Sequelize[_0xb32b('0x2')],'defaultValue':''},'macrocontext':{'type':Sequelize['STRING'],'defaultValue':''},'callerid':{'type':Sequelize[_0xb32b('0x2')],'defaultValue':''},'origtime':{'type':Sequelize['STRING'],'defaultValue':''},'duration':{'type':Sequelize[_0xb32b('0x2')],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0xb32b('0x2')],'defaultValue':''},'mailboxcontext':{'type':Sequelize['STRING'],'defaultValue':''},'recording':{'type':Sequelize[_0xb32b('0x3')](_0xb32b('0x4')),'defaultValue':null},'flag':{'type':Sequelize[_0xb32b('0x2')],'defaultValue':''},'msg_id':{'type':Sequelize[_0xb32b('0x2')],'defaultValue':''},'stamp':{'type':_0xb32b('0x5'),'defaultValue':Sequelize[_0xb32b('0x6')]('CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP')}}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.controller.js b/server/api/voiceMailMessage/voiceMailMessage.controller.js index 0d343e8..3c0d967 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 _0xc210=['findAll','show','find','catch','create','body','params','download','recording','msg_id','Sequelize','VoiceMailMessage\x20not\x20found','audio/wav','Content-Disposition','attachment;\x20filename=\x22','.wav\x22','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','update','then','destroy','error','stack','name','send','index','map','VoiceMailMessage','rawAttributes','fieldName','model','differenceBy','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','merge','type','VIRTUAL','options','includeAll','include'];(function(_0x2ec72e,_0x27382e){var _0x1359ab=function(_0xf45abe){while(--_0xf45abe){_0x2ec72e['push'](_0x2ec72e['shift']());}};_0x1359ab(++_0x27382e);}(_0xc210,0x115));var _0x0c21=function(_0x197fde,_0x175d73){_0x197fde=_0x197fde-0x0;var _0x4fe854=_0xc210[_0x197fde];return _0x4fe854;};'use strict';var emlformat=require(_0x0c21('0x0'));var rimraf=require(_0x0c21('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0c21('0x2'));var rp=require(_0x0c21('0x3'));var moment=require(_0x0c21('0x4'));var BPromise=require(_0x0c21('0x5'));var Mustache=require(_0x0c21('0x6'));var util=require(_0x0c21('0x7'));var path=require('path');var sox=require(_0x0c21('0x8'));var csv=require(_0x0c21('0x9'));var ejs=require(_0x0c21('0xa'));var fs=require('fs');var fs_extra=require(_0x0c21('0xb'));var _=require(_0x0c21('0xc'));var squel=require(_0x0c21('0xd'));var crypto=require(_0x0c21('0xe'));var jsforce=require(_0x0c21('0xf'));var deskjs=require(_0x0c21('0x10'));var toCsv=require(_0x0c21('0x9'));var querystring=require(_0x0c21('0x11'));var Papa=require('papaparse');var Redis=require(_0x0c21('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x0c21('0x13'));var hardwareService=require(_0x0c21('0x14'));var logger=require(_0x0c21('0x15'))(_0x0c21('0x16'));var utils=require(_0x0c21('0x17'));var config=require(_0x0c21('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x0c21('0x19'))['db'];function respondWithStatusCode(_0x386534,_0x40a45b){_0x40a45b=_0x40a45b||0xcc;return function(_0x4b9401){if(_0x4b9401){return _0x386534[_0x0c21('0x1a')](_0x40a45b);}return _0x386534[_0x0c21('0x1b')](_0x40a45b)[_0x0c21('0x1c')]();};}function respondWithResult(_0x56e1b8,_0x2ddf9e){_0x2ddf9e=_0x2ddf9e||0xc8;return function(_0x201a81){if(_0x201a81){return _0x56e1b8[_0x0c21('0x1b')](_0x2ddf9e)[_0x0c21('0x1d')](_0x201a81);}};}function respondWithFilteredResult(_0x26ec44,_0x761a0e){return function(_0x2bf67e){if(_0x2bf67e){var _0x586691=typeof _0x761a0e[_0x0c21('0x1e')]==='undefined'&&typeof _0x761a0e[_0x0c21('0x1f')]===_0x0c21('0x20');var _0x93eb4=_0x2bf67e['count'];var _0x2c3b05=_0x586691?0x0:_0x761a0e[_0x0c21('0x1e')];var _0x177acd=_0x586691?_0x2bf67e[_0x0c21('0x21')]:_0x761a0e[_0x0c21('0x1e')]+_0x761a0e[_0x0c21('0x1f')];var _0x440810;if(_0x177acd>=_0x93eb4){_0x177acd=_0x93eb4;_0x440810=0xc8;}else{_0x440810=0xce;}_0x26ec44[_0x0c21('0x1b')](_0x440810);return _0x26ec44[_0x0c21('0x22')](_0x0c21('0x23'),_0x2c3b05+'-'+_0x177acd+'/'+_0x93eb4)[_0x0c21('0x1d')](_0x2bf67e);}return null;};}function patchUpdates(_0x1b073e){return function(_0x5d96f2){try{jsonpatch[_0x0c21('0x24')](_0x5d96f2,_0x1b073e,!![]);}catch(_0x3a3d0a){return BPromise['reject'](_0x3a3d0a);}return _0x5d96f2['save']();};}function saveUpdates(_0x240900,_0x2260bb){return function(_0x3b989f){if(_0x3b989f){return _0x3b989f[_0x0c21('0x25')](_0x240900)[_0x0c21('0x26')](function(_0x163254){return _0x163254;});}return null;};}function removeEntity(_0xa66aa4,_0x3b5fbd){return function(_0x3bca90){if(_0x3bca90){return _0x3bca90[_0x0c21('0x27')]()[_0x0c21('0x26')](function(){_0xa66aa4[_0x0c21('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0xa6565f,_0x39ba45){return function(_0x104767){if(!_0x104767){_0xa6565f[_0x0c21('0x1a')](0x194);}return _0x104767;};}function handleError(_0x24a389,_0x3cf006){_0x3cf006=_0x3cf006||0x1f4;return function(_0x2199ca){logger[_0x0c21('0x28')](_0x2199ca[_0x0c21('0x29')]);if(_0x2199ca[_0x0c21('0x2a')]){delete _0x2199ca[_0x0c21('0x2a')];}_0x24a389[_0x0c21('0x1b')](_0x3cf006)[_0x0c21('0x2b')](_0x2199ca);};}exports[_0x0c21('0x2c')]=function(_0x282d97,_0x3a6a52){var _0x1ee1aa={},_0x5454c4={},_0x1cdec1={'count':0x0,'rows':[]};var _0x58f33e=_[_0x0c21('0x2d')](db[_0x0c21('0x2e')][_0x0c21('0x2f')],function(_0x53fd2b){return{'name':_0x53fd2b[_0x0c21('0x30')],'type':_0x53fd2b['type']['key']};});_0x5454c4[_0x0c21('0x31')]=_[_0x0c21('0x32')](_[_0x0c21('0x2d')](_0x58f33e,_0x0c21('0x2a')),['name']);_0x5454c4[_0x0c21('0x33')]=_[_0x0c21('0x34')](_0x282d97['query']);_0x5454c4['filters']=_[_0x0c21('0x35')](_0x5454c4[_0x0c21('0x31')],_0x5454c4['query']);_0x1ee1aa[_0x0c21('0x36')]=_[_0x0c21('0x35')](_0x5454c4[_0x0c21('0x31')],qs['fields'](_0x282d97[_0x0c21('0x33')][_0x0c21('0x37')]));_0x1ee1aa['attributes']=_0x1ee1aa[_0x0c21('0x36')][_0x0c21('0x38')]?_0x1ee1aa['attributes']:_0x5454c4[_0x0c21('0x31')];if(!_0x282d97[_0x0c21('0x33')][_0x0c21('0x39')](_0x0c21('0x3a'))){_0x1ee1aa[_0x0c21('0x1f')]=qs[_0x0c21('0x1f')](_0x282d97['query']['limit']);_0x1ee1aa[_0x0c21('0x1e')]=qs['offset'](_0x282d97[_0x0c21('0x33')][_0x0c21('0x1e')]);}_0x1ee1aa[_0x0c21('0x3b')]=qs[_0x0c21('0x3c')](_0x282d97[_0x0c21('0x33')][_0x0c21('0x3c')]);_0x1ee1aa[_0x0c21('0x3d')]=qs['filters'](_[_0x0c21('0x3e')](_0x282d97[_0x0c21('0x33')],_0x5454c4[_0x0c21('0x3f')]),_0x58f33e);if(_0x282d97[_0x0c21('0x33')][_0x0c21('0x40')]){_0x1ee1aa[_0x0c21('0x3d')]=_[_0x0c21('0x41')](_0x1ee1aa[_0x0c21('0x3d')],{'$or':_[_0x0c21('0x2d')](_0x58f33e,function(_0xd0727e){if(_0xd0727e[_0x0c21('0x42')]!==_0x0c21('0x43')){var _0xc738d4={};_0xc738d4[_0xd0727e[_0x0c21('0x2a')]]={'$like':'%'+_0x282d97[_0x0c21('0x33')]['filter']+'%'};return _0xc738d4;}})});}_0x1ee1aa=_[_0x0c21('0x41')]({},_0x1ee1aa,_0x282d97[_0x0c21('0x44')]);var _0x114c3b={'where':_0x1ee1aa[_0x0c21('0x3d')]};return db[_0x0c21('0x2e')][_0x0c21('0x21')](_0x114c3b)[_0x0c21('0x26')](function(_0x3e655d){_0x1cdec1[_0x0c21('0x21')]=_0x3e655d;if(_0x282d97['query'][_0x0c21('0x45')]){_0x1ee1aa[_0x0c21('0x46')]=[{'all':!![]}];}return db[_0x0c21('0x2e')][_0x0c21('0x47')](_0x1ee1aa);})[_0x0c21('0x26')](function(_0x40f5a8){_0x1cdec1['rows']=_0x40f5a8;return _0x1cdec1;})[_0x0c21('0x26')](respondWithFilteredResult(_0x3a6a52,_0x1ee1aa))['catch'](handleError(_0x3a6a52,null));};exports[_0x0c21('0x48')]=function(_0x48321d,_0x210168){var _0x4ee219={'raw':!![],'where':{'id':_0x48321d['params']['id']}},_0x3a3806={};_0x3a3806[_0x0c21('0x31')]=_[_0x0c21('0x34')](db[_0x0c21('0x2e')][_0x0c21('0x2f')]);_0x3a3806['query']=_['keys'](_0x48321d[_0x0c21('0x33')]);_0x3a3806['filters']=_[_0x0c21('0x35')](_0x3a3806['model'],_0x3a3806[_0x0c21('0x33')]);_0x4ee219[_0x0c21('0x36')]=_[_0x0c21('0x35')](_0x3a3806[_0x0c21('0x31')],qs[_0x0c21('0x37')](_0x48321d[_0x0c21('0x33')]['fields']));_0x4ee219[_0x0c21('0x36')]=_0x4ee219[_0x0c21('0x36')][_0x0c21('0x38')]?_0x4ee219[_0x0c21('0x36')]:_0x3a3806[_0x0c21('0x31')];if(_0x48321d['query'][_0x0c21('0x45')]){_0x4ee219[_0x0c21('0x46')]=[{'all':!![]}];}_0x4ee219=_[_0x0c21('0x41')]({},_0x4ee219,_0x48321d[_0x0c21('0x44')]);return db['VoiceMailMessage'][_0x0c21('0x49')](_0x4ee219)[_0x0c21('0x26')](handleEntityNotFound(_0x210168,null))['then'](respondWithResult(_0x210168,null))[_0x0c21('0x4a')](handleError(_0x210168,null));};exports[_0x0c21('0x4b')]=function(_0x5b6851,_0x3d2095){return db[_0x0c21('0x2e')]['create'](_0x5b6851[_0x0c21('0x4c')],{})[_0x0c21('0x26')](respondWithResult(_0x3d2095,0xc9))[_0x0c21('0x4a')](handleError(_0x3d2095,null));};exports[_0x0c21('0x25')]=function(_0x135b6e,_0x147bec){if(_0x135b6e[_0x0c21('0x4c')]['id']){delete _0x135b6e[_0x0c21('0x4c')]['id'];}return db[_0x0c21('0x2e')]['find']({'where':{'id':_0x135b6e[_0x0c21('0x4d')]['id']}})[_0x0c21('0x26')](handleEntityNotFound(_0x147bec,null))[_0x0c21('0x26')](saveUpdates(_0x135b6e[_0x0c21('0x4c')],null))[_0x0c21('0x26')](respondWithResult(_0x147bec,null))[_0x0c21('0x4a')](handleError(_0x147bec,null));};exports[_0x0c21('0x27')]=function(_0x3697fc,_0x4ac29d){return db[_0x0c21('0x2e')][_0x0c21('0x49')]({'where':{'id':_0x3697fc['params']['id']}})[_0x0c21('0x26')](handleEntityNotFound(_0x4ac29d,null))[_0x0c21('0x26')](removeEntity(_0x4ac29d,null))[_0x0c21('0x4a')](handleError(_0x4ac29d,null));};exports[_0x0c21('0x4e')]=function(_0x2d8f17,_0x555d9b,_0x55926d){return db[_0x0c21('0x2e')][_0x0c21('0x49')]({'where':{'id':_0x2d8f17[_0x0c21('0x4d')]['id']},'attributes':['id',_0x0c21('0x4f'),_0x0c21('0x50')]})[_0x0c21('0x26')](handleEntityNotFound(_0x555d9b,null))[_0x0c21('0x26')](function(_0x10c53a){if(_0x10c53a){if(!_0x10c53a[_0x0c21('0x4f')]){throw new db[(_0x0c21('0x51'))]['ValidationError'](_0x0c21('0x52'));}var _0x2ec826={'Content-Type':_0x0c21('0x53'),'Content-Disposition':'attachment'};if(_0x10c53a['msg_id']){_0x2ec826[_0x0c21('0x54')]=_0x0c21('0x55')+_0x10c53a['msg_id']+_0x0c21('0x56');}_0x555d9b[_0x0c21('0x22')](_0x2ec826);return _0x555d9b['send'](new Buffer(_0x10c53a[_0x0c21('0x4f')]));}})[_0x0c21('0x4a')](handleError(_0x555d9b,null));}; \ No newline at end of file +var _0x878d=['../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','apply','reject','save','destroy','sendStatus','error','name','index','VoiceMailMessage','rawAttributes','fieldName','key','model','differenceBy','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','filter','where','type','VIRTUAL','merge','then','includeAll','include','findAll','catch','show','params','find','create','body','update','download','recording','msg_id','Sequelize','ValidationError','VoiceMailMessage\x20not\x20found','audio/wav','Content-Disposition','attachment;\x20filename=\x22','.wav\x22','set','send','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','ejs','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs'];(function(_0x58494b,_0x192380){var _0xe5f7c8=function(_0x4600d4){while(--_0x4600d4){_0x58494b['push'](_0x58494b['shift']());}};_0xe5f7c8(++_0x192380);}(_0x878d,0x1f1));var _0xd878=function(_0x2786ea,_0x16c3c3){_0x2786ea=_0x2786ea-0x0;var _0x5c38e5=_0x878d[_0x2786ea];return _0x5c38e5;};'use strict';var emlformat=require(_0xd878('0x0'));var rimraf=require(_0xd878('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd878('0x2'));var rp=require(_0xd878('0x3'));var moment=require(_0xd878('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xd878('0x5'));var util=require(_0xd878('0x6'));var path=require(_0xd878('0x7'));var sox=require(_0xd878('0x8'));var csv=require('to-csv');var ejs=require(_0xd878('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xd878('0xa'));var crypto=require(_0xd878('0xb'));var jsforce=require(_0xd878('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xd878('0xd'));var querystring=require(_0xd878('0xe'));var Papa=require(_0xd878('0xf'));var Redis=require(_0xd878('0x10'));var authService=require(_0xd878('0x11'));var qs=require(_0xd878('0x12'));var as=require(_0xd878('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xd878('0x14'))(_0xd878('0x15'));var utils=require(_0xd878('0x16'));var config=require(_0xd878('0x17'));var licenseUtil=require(_0xd878('0x18'));var db=require(_0xd878('0x19'))['db'];function respondWithStatusCode(_0x1fa8c4,_0x158f7d){_0x158f7d=_0x158f7d||0xcc;return function(_0x234260){if(_0x234260){return _0x1fa8c4['sendStatus'](_0x158f7d);}return _0x1fa8c4[_0xd878('0x1a')](_0x158f7d)[_0xd878('0x1b')]();};}function respondWithResult(_0xb9c451,_0x2f863d){_0x2f863d=_0x2f863d||0xc8;return function(_0x326e8b){if(_0x326e8b){return _0xb9c451[_0xd878('0x1a')](_0x2f863d)[_0xd878('0x1c')](_0x326e8b);}};}function respondWithFilteredResult(_0x4317db,_0x311941){return function(_0x1471ac){if(_0x1471ac){var _0x1ccc25=typeof _0x311941[_0xd878('0x1d')]===_0xd878('0x1e')&&typeof _0x311941[_0xd878('0x1f')]===_0xd878('0x1e');var _0xac6fea=_0x1471ac[_0xd878('0x20')];var _0x1c6320=_0x1ccc25?0x0:_0x311941[_0xd878('0x1d')];var _0x331500=_0x1ccc25?_0x1471ac['count']:_0x311941[_0xd878('0x1d')]+_0x311941[_0xd878('0x1f')];var _0x19427b;if(_0x331500>=_0xac6fea){_0x331500=_0xac6fea;_0x19427b=0xc8;}else{_0x19427b=0xce;}_0x4317db[_0xd878('0x1a')](_0x19427b);return _0x4317db['set']('Content-Range',_0x1c6320+'-'+_0x331500+'/'+_0xac6fea)[_0xd878('0x1c')](_0x1471ac);}return null;};}function patchUpdates(_0x27d261){return function(_0x230f37){try{jsonpatch[_0xd878('0x21')](_0x230f37,_0x27d261,!![]);}catch(_0x5cb652){return BPromise[_0xd878('0x22')](_0x5cb652);}return _0x230f37[_0xd878('0x23')]();};}function saveUpdates(_0x97e43e,_0x340af0){return function(_0x1a7bb5){if(_0x1a7bb5){return _0x1a7bb5['update'](_0x97e43e)['then'](function(_0x365d30){return _0x365d30;});}return null;};}function removeEntity(_0xc7ce39,_0x4efcea){return function(_0x46d7b2){if(_0x46d7b2){return _0x46d7b2[_0xd878('0x24')]()['then'](function(){_0xc7ce39[_0xd878('0x1a')](0xcc)[_0xd878('0x1b')]();});}};}function handleEntityNotFound(_0x588566,_0x223434){return function(_0xab96b2){if(!_0xab96b2){_0x588566[_0xd878('0x25')](0x194);}return _0xab96b2;};}function handleError(_0x24d5d6,_0x3be823){_0x3be823=_0x3be823||0x1f4;return function(_0x10a630){logger[_0xd878('0x26')](_0x10a630['stack']);if(_0x10a630[_0xd878('0x27')]){delete _0x10a630[_0xd878('0x27')];}_0x24d5d6[_0xd878('0x1a')](_0x3be823)['send'](_0x10a630);};}exports[_0xd878('0x28')]=function(_0x472aef,_0xccf049){var _0x335d90={},_0xdeb304={},_0x174698={'count':0x0,'rows':[]};var _0xa6bc97=_['map'](db[_0xd878('0x29')][_0xd878('0x2a')],function(_0x359477){return{'name':_0x359477[_0xd878('0x2b')],'type':_0x359477['type'][_0xd878('0x2c')]};});_0xdeb304[_0xd878('0x2d')]=_[_0xd878('0x2e')](_[_0xd878('0x2f')](_0xa6bc97,_0xd878('0x27')),['name']);_0xdeb304[_0xd878('0x30')]=_[_0xd878('0x31')](_0x472aef[_0xd878('0x30')]);_0xdeb304[_0xd878('0x32')]=_[_0xd878('0x33')](_0xdeb304[_0xd878('0x2d')],_0xdeb304[_0xd878('0x30')]);_0x335d90[_0xd878('0x34')]=_[_0xd878('0x33')](_0xdeb304[_0xd878('0x2d')],qs[_0xd878('0x35')](_0x472aef['query'][_0xd878('0x35')]));_0x335d90[_0xd878('0x34')]=_0x335d90[_0xd878('0x34')][_0xd878('0x36')]?_0x335d90[_0xd878('0x34')]:_0xdeb304[_0xd878('0x2d')];if(!_0x472aef[_0xd878('0x30')][_0xd878('0x37')]('nolimit')){_0x335d90[_0xd878('0x1f')]=qs[_0xd878('0x1f')](_0x472aef[_0xd878('0x30')]['limit']);_0x335d90['offset']=qs['offset'](_0x472aef[_0xd878('0x30')][_0xd878('0x1d')]);}_0x335d90[_0xd878('0x38')]=qs[_0xd878('0x39')](_0x472aef[_0xd878('0x30')]['sort']);_0x335d90['where']=qs['filters'](_['pick'](_0x472aef[_0xd878('0x30')],_0xdeb304[_0xd878('0x32')]),_0xa6bc97);if(_0x472aef['query'][_0xd878('0x3a')]){_0x335d90[_0xd878('0x3b')]=_['merge'](_0x335d90[_0xd878('0x3b')],{'$or':_[_0xd878('0x2f')](_0xa6bc97,function(_0x5bbea8){if(_0x5bbea8[_0xd878('0x3c')]!==_0xd878('0x3d')){var _0x46d423={};_0x46d423[_0x5bbea8[_0xd878('0x27')]]={'$like':'%'+_0x472aef[_0xd878('0x30')][_0xd878('0x3a')]+'%'};return _0x46d423;}})});}_0x335d90=_[_0xd878('0x3e')]({},_0x335d90,_0x472aef['options']);var _0x14a6e9={'where':_0x335d90[_0xd878('0x3b')]};return db[_0xd878('0x29')][_0xd878('0x20')](_0x14a6e9)[_0xd878('0x3f')](function(_0x326617){_0x174698['count']=_0x326617;if(_0x472aef[_0xd878('0x30')][_0xd878('0x40')]){_0x335d90[_0xd878('0x41')]=[{'all':!![]}];}return db[_0xd878('0x29')][_0xd878('0x42')](_0x335d90);})[_0xd878('0x3f')](function(_0x2b1536){_0x174698['rows']=_0x2b1536;return _0x174698;})[_0xd878('0x3f')](respondWithFilteredResult(_0xccf049,_0x335d90))[_0xd878('0x43')](handleError(_0xccf049,null));};exports[_0xd878('0x44')]=function(_0x2b0fd8,_0x1697f1){var _0x47c25f={'raw':!![],'where':{'id':_0x2b0fd8[_0xd878('0x45')]['id']}},_0x21474a={};_0x21474a['model']=_['keys'](db[_0xd878('0x29')][_0xd878('0x2a')]);_0x21474a[_0xd878('0x30')]=_['keys'](_0x2b0fd8['query']);_0x21474a[_0xd878('0x32')]=_['intersection'](_0x21474a[_0xd878('0x2d')],_0x21474a[_0xd878('0x30')]);_0x47c25f[_0xd878('0x34')]=_[_0xd878('0x33')](_0x21474a[_0xd878('0x2d')],qs['fields'](_0x2b0fd8['query']['fields']));_0x47c25f[_0xd878('0x34')]=_0x47c25f['attributes'][_0xd878('0x36')]?_0x47c25f['attributes']:_0x21474a[_0xd878('0x2d')];if(_0x2b0fd8[_0xd878('0x30')][_0xd878('0x40')]){_0x47c25f[_0xd878('0x41')]=[{'all':!![]}];}_0x47c25f=_[_0xd878('0x3e')]({},_0x47c25f,_0x2b0fd8['options']);return db[_0xd878('0x29')][_0xd878('0x46')](_0x47c25f)[_0xd878('0x3f')](handleEntityNotFound(_0x1697f1,null))[_0xd878('0x3f')](respondWithResult(_0x1697f1,null))[_0xd878('0x43')](handleError(_0x1697f1,null));};exports[_0xd878('0x47')]=function(_0x2e474c,_0x4e1077){return db[_0xd878('0x29')][_0xd878('0x47')](_0x2e474c[_0xd878('0x48')],{})[_0xd878('0x3f')](respondWithResult(_0x4e1077,0xc9))[_0xd878('0x43')](handleError(_0x4e1077,null));};exports[_0xd878('0x49')]=function(_0x2968a4,_0x375aa3){if(_0x2968a4[_0xd878('0x48')]['id']){delete _0x2968a4[_0xd878('0x48')]['id'];}return db['VoiceMailMessage'][_0xd878('0x46')]({'where':{'id':_0x2968a4[_0xd878('0x45')]['id']}})[_0xd878('0x3f')](handleEntityNotFound(_0x375aa3,null))[_0xd878('0x3f')](saveUpdates(_0x2968a4['body'],null))[_0xd878('0x3f')](respondWithResult(_0x375aa3,null))[_0xd878('0x43')](handleError(_0x375aa3,null));};exports[_0xd878('0x24')]=function(_0x14cbae,_0x46a651){return db['VoiceMailMessage'][_0xd878('0x46')]({'where':{'id':_0x14cbae[_0xd878('0x45')]['id']}})['then'](handleEntityNotFound(_0x46a651,null))[_0xd878('0x3f')](removeEntity(_0x46a651,null))['catch'](handleError(_0x46a651,null));};exports[_0xd878('0x4a')]=function(_0x47a4a8,_0x45ab97,_0x1330b7){return db[_0xd878('0x29')]['find']({'where':{'id':_0x47a4a8['params']['id']},'attributes':['id',_0xd878('0x4b'),_0xd878('0x4c')]})[_0xd878('0x3f')](handleEntityNotFound(_0x45ab97,null))[_0xd878('0x3f')](function(_0xf8e292){if(_0xf8e292){if(!_0xf8e292['recording']){throw new db[(_0xd878('0x4d'))][(_0xd878('0x4e'))](_0xd878('0x4f'));}var _0x4d8b64={'Content-Type':_0xd878('0x50'),'Content-Disposition':'attachment'};if(_0xf8e292[_0xd878('0x4c')]){_0x4d8b64[_0xd878('0x51')]=_0xd878('0x52')+_0xf8e292[_0xd878('0x4c')]+_0xd878('0x53');}_0x45ab97[_0xd878('0x54')](_0x4d8b64);return _0x45ab97[_0xd878('0x55')](new Buffer(_0xf8e292[_0xd878('0x4b')]));}})[_0xd878('0x43')](handleError(_0x45ab97,null));}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.model.js b/server/api/voiceMailMessage/voiceMailMessage.model.js index 43e00f6..b39531c 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 _0x4a3e=['bluebird','request-promise','path','rimraf','exports','voice_voicemail_messages','dir','lodash','../../config/logger','api'];(function(_0x529ca2,_0x2d80c0){var _0x144360=function(_0x2e1d85){while(--_0x2e1d85){_0x529ca2['push'](_0x529ca2['shift']());}};_0x144360(++_0x2d80c0);}(_0x4a3e,0x1d3));var _0xe4a3=function(_0x2e572f,_0x2b1deb){_0x2e572f=_0x2e572f-0x0;var _0x54c897=_0x4a3e[_0x2e572f];return _0x54c897;};'use strict';var _=require(_0xe4a3('0x0'));var util=require('util');var logger=require(_0xe4a3('0x1'))(_0xe4a3('0x2'));var moment=require('moment');var BPromise=require(_0xe4a3('0x3'));var rp=require(_0xe4a3('0x4'));var fs=require('fs');var path=require(_0xe4a3('0x5'));var rimraf=require(_0xe4a3('0x6'));var config=require('../../config/environment');var attributes=require('./voiceMailMessage.attributes');module[_0xe4a3('0x7')]=function(_0x2cd406,_0x47ab74){return _0x2cd406['define']('VoiceMailMessage',attributes,{'tableName':_0xe4a3('0x8'),'paranoid':![],'indexes':[{'name':_0xe4a3('0x9'),'fields':[_0xe4a3('0x9')]}],'timestamps':![]});}; \ No newline at end of file +var _0xe8a3=['util','../../config/logger','bluebird','request-promise','path','../../config/environment','exports','VoiceMailMessage','dir'];(function(_0x44c768,_0x552a5e){var _0x55daf5=function(_0x4958e8){while(--_0x4958e8){_0x44c768['push'](_0x44c768['shift']());}};_0x55daf5(++_0x552a5e);}(_0xe8a3,0x1cb));var _0x3e8a=function(_0x5c4f56,_0x3c12ad){_0x5c4f56=_0x5c4f56-0x0;var _0x4d917a=_0xe8a3[_0x5c4f56];return _0x4d917a;};'use strict';var _=require('lodash');var util=require(_0x3e8a('0x0'));var logger=require(_0x3e8a('0x1'))('api');var moment=require('moment');var BPromise=require(_0x3e8a('0x2'));var rp=require(_0x3e8a('0x3'));var fs=require('fs');var path=require(_0x3e8a('0x4'));var rimraf=require('rimraf');var config=require(_0x3e8a('0x5'));var attributes=require('./voiceMailMessage.attributes');module[_0x3e8a('0x6')]=function(_0x57ad5c,_0x175901){return _0x57ad5c['define'](_0x3e8a('0x7'),attributes,{'tableName':'voice_voicemail_messages','paranoid':![],'indexes':[{'name':_0x3e8a('0x8'),'fields':[_0x3e8a('0x8')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.rpc.js b/server/api/voiceMailMessage/voiceMailMessage.rpc.js index 526aac1..f2dddde 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 _0x6f5a=['request','then','info','VoiceMailMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http'];(function(_0x3ba422,_0x53303c){var _0x20b5dd=function(_0x10b8a7){while(--_0x10b8a7){_0x3ba422['push'](_0x3ba422['shift']());}};_0x20b5dd(++_0x53303c);}(_0x6f5a,0x1d9));var _0xa6f5=function(_0x106f08,_0x4cdee2){_0x106f08=_0x106f08-0x0;var _0x2b2d23=_0x6f5a[_0x106f08];return _0x2b2d23;};'use strict';var _=require('lodash');var util=require(_0xa6f5('0x0'));var moment=require(_0xa6f5('0x1'));var BPromise=require('bluebird');var rs=require(_0xa6f5('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa6f5('0x3'))['db'];var utils=require(_0xa6f5('0x4'));var logger=require(_0xa6f5('0x5'))(_0xa6f5('0x6'));var config=require(_0xa6f5('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xa6f5('0x8')][_0xa6f5('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x503639,_0x3a2037,_0x3d7660){return new BPromise(function(_0x5bdb91,_0x8c6752){return client[_0xa6f5('0xa')](_0x503639,_0x3d7660)[_0xa6f5('0xb')](function(_0x2b0345){logger[_0xa6f5('0xc')](_0xa6f5('0xd'),_0x3a2037,_0xa6f5('0xe'));logger[_0xa6f5('0xf')]('VoiceMailMessage,\x20%s,\x20%s,\x20%s',_0x3a2037,_0xa6f5('0xe'),JSON[_0xa6f5('0x10')](_0x2b0345));if(_0x2b0345[_0xa6f5('0x11')]){if(_0x2b0345['error']['code']===0x1f4){logger['error'](_0xa6f5('0xd'),_0x3a2037,_0x2b0345['error'][_0xa6f5('0x12')]);return _0x8c6752(_0x2b0345[_0xa6f5('0x11')][_0xa6f5('0x12')]);}logger[_0xa6f5('0x11')]('VoiceMailMessage,\x20%s,\x20%s',_0x3a2037,_0x2b0345[_0xa6f5('0x11')][_0xa6f5('0x12')]);return _0x5bdb91(_0x2b0345[_0xa6f5('0x11')][_0xa6f5('0x12')]);}else{logger[_0xa6f5('0xc')](_0xa6f5('0xd'),_0x3a2037,'request\x20sent');_0x5bdb91(_0x2b0345[_0xa6f5('0x13')][_0xa6f5('0x12')]);}})[_0xa6f5('0x14')](function(_0x2cd06f){logger[_0xa6f5('0x11')]('VoiceMailMessage,\x20%s,\x20%s',_0x3a2037,_0x2cd06f);_0x8c6752(_0x2cd06f);});});} \ No newline at end of file +var _0x6b0e=['catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','then','info','VoiceMailMessage,\x20%s,\x20%s','request\x20sent','debug','VoiceMailMessage,\x20%s,\x20%s,\x20%s','error','message','result'];(function(_0xf71120,_0x25b7f9){var _0xbe2fd3=function(_0x1acbdd){while(--_0x1acbdd){_0xf71120['push'](_0xf71120['shift']());}};_0xbe2fd3(++_0x25b7f9);}(_0x6b0e,0x1ba));var _0xe6b0=function(_0xcda34d,_0x2e196f){_0xcda34d=_0xcda34d-0x0;var _0x4bc776=_0x6b0e[_0xcda34d];return _0x4bc776;};'use strict';var _=require('lodash');var util=require(_0xe6b0('0x0'));var moment=require(_0xe6b0('0x1'));var BPromise=require(_0xe6b0('0x2'));var rs=require(_0xe6b0('0x3'));var fs=require('fs');var Redis=require(_0xe6b0('0x4'));var db=require(_0xe6b0('0x5'))['db'];var utils=require(_0xe6b0('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0xe6b0('0x7'));var jayson=require(_0xe6b0('0x8'));var client=jayson[_0xe6b0('0x9')][_0xe6b0('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1f419c,_0x2fccfb,_0x3f7891){return new BPromise(function(_0x57dcd1,_0xc0c58d){return client['request'](_0x1f419c,_0x3f7891)[_0xe6b0('0xb')](function(_0x28a6d6){logger[_0xe6b0('0xc')](_0xe6b0('0xd'),_0x2fccfb,_0xe6b0('0xe'));logger[_0xe6b0('0xf')](_0xe6b0('0x10'),_0x2fccfb,_0xe6b0('0xe'),JSON['stringify'](_0x28a6d6));if(_0x28a6d6[_0xe6b0('0x11')]){if(_0x28a6d6['error']['code']===0x1f4){logger['error'](_0xe6b0('0xd'),_0x2fccfb,_0x28a6d6['error'][_0xe6b0('0x12')]);return _0xc0c58d(_0x28a6d6[_0xe6b0('0x11')][_0xe6b0('0x12')]);}logger[_0xe6b0('0x11')](_0xe6b0('0xd'),_0x2fccfb,_0x28a6d6[_0xe6b0('0x11')][_0xe6b0('0x12')]);return _0x57dcd1(_0x28a6d6['error']['message']);}else{logger[_0xe6b0('0xc')](_0xe6b0('0xd'),_0x2fccfb,_0xe6b0('0xe'));_0x57dcd1(_0x28a6d6[_0xe6b0('0x13')][_0xe6b0('0x12')]);}})[_0xe6b0('0x14')](function(_0x25b971){logger[_0xe6b0('0x11')](_0xe6b0('0xd'),_0x2fccfb,_0x25b971);_0xc0c58d(_0x25b971);});});} \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/index.js b/server/api/voiceMusicOnHold/index.js index 1c379e6..27435bd 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 _0x3ea5=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMusicOnHold.controller','isAuthenticated','get','/:id/sounds','getSounds','post','create','addSound','/:id','update','delete','destroy','/:id/sounds/:id2','exports','multer','util'];(function(_0x117aa8,_0x22c76c){var _0x236368=function(_0x4a0651){while(--_0x4a0651){_0x117aa8['push'](_0x117aa8['shift']());}};_0x236368(++_0x22c76c);}(_0x3ea5,0xee));var _0x53ea=function(_0x265e9b,_0x36baf7){_0x265e9b=_0x265e9b-0x0;var _0x4e4e30=_0x3ea5[_0x265e9b];return _0x4e4e30;};'use strict';var multer=require(_0x53ea('0x0'));var util=require(_0x53ea('0x1'));var path=require(_0x53ea('0x2'));var timeout=require(_0x53ea('0x3'));var express=require(_0x53ea('0x4'));var router=express[_0x53ea('0x5')]();var fs_extra=require(_0x53ea('0x6'));var auth=require(_0x53ea('0x7'));var interaction=require(_0x53ea('0x8'));var config=require(_0x53ea('0x9'));var controller=require(_0x53ea('0xa'));router['get']('/',auth[_0x53ea('0xb')](),controller['index']);router[_0x53ea('0xc')]('/:id',auth[_0x53ea('0xb')](),controller['show']);router['get'](_0x53ea('0xd'),auth['isAuthenticated'](),controller[_0x53ea('0xe')]);router[_0x53ea('0xf')]('/',auth[_0x53ea('0xb')](),controller[_0x53ea('0x10')]);router['post'](_0x53ea('0xd'),auth['isAuthenticated'](),controller[_0x53ea('0x11')]);router['put'](_0x53ea('0x12'),auth[_0x53ea('0xb')](),controller[_0x53ea('0x13')]);router[_0x53ea('0x14')](_0x53ea('0x12'),auth[_0x53ea('0xb')](),controller[_0x53ea('0x15')]);router[_0x53ea('0x14')](_0x53ea('0x16'),auth[_0x53ea('0xb')](),controller['removeSound']);module[_0x53ea('0x17')]=router; \ No newline at end of file +var _0x757a=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','/:id','show','/:id/sounds','getSounds','create','post','isAuthenticated','update','delete','/:id/sounds/:id2','removeSound','exports','util','path','connect-timeout','express'];(function(_0x32a74e,_0x5b3443){var _0x1aad7d=function(_0x3c29bc){while(--_0x3c29bc){_0x32a74e['push'](_0x32a74e['shift']());}};_0x1aad7d(++_0x5b3443);}(_0x757a,0xee));var _0xa757=function(_0x210b20,_0x17be34){_0x210b20=_0x210b20-0x0;var _0x372951=_0x757a[_0x210b20];return _0x372951;};'use strict';var multer=require('multer');var util=require(_0xa757('0x0'));var path=require(_0xa757('0x1'));var timeout=require(_0xa757('0x2'));var express=require(_0xa757('0x3'));var router=express[_0xa757('0x4')]();var fs_extra=require(_0xa757('0x5'));var auth=require(_0xa757('0x6'));var interaction=require(_0xa757('0x7'));var config=require(_0xa757('0x8'));var controller=require('./voiceMusicOnHold.controller');router[_0xa757('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0xa757('0x9')](_0xa757('0xa'),auth['isAuthenticated'](),controller[_0xa757('0xb')]);router[_0xa757('0x9')](_0xa757('0xc'),auth['isAuthenticated'](),controller[_0xa757('0xd')]);router['post']('/',auth['isAuthenticated'](),controller[_0xa757('0xe')]);router[_0xa757('0xf')](_0xa757('0xc'),auth[_0xa757('0x10')](),controller['addSound']);router['put'](_0xa757('0xa'),auth[_0xa757('0x10')](),controller[_0xa757('0x11')]);router[_0xa757('0x12')](_0xa757('0xa'),auth['isAuthenticated'](),controller['destroy']);router[_0xa757('0x12')](_0xa757('0x13'),auth[_0xa757('0x10')](),controller[_0xa757('0x14')]);module[_0xa757('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 ce82378..1a6fd1f 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 _0x7540=['files','quietmp3nb','quietmp3','mp3','alpha','TIMESTAMP','BOOLEAN','exports','STRING','name','ENUM','custom'];(function(_0x41dd3a,_0x58afdc){var _0x1da368=function(_0x45bf4e){while(--_0x45bf4e){_0x41dd3a['push'](_0x41dd3a['shift']());}};_0x1da368(++_0x58afdc);}(_0x7540,0x1f3));var _0x0754=function(_0x12e6e5,_0x39855b){_0x12e6e5=_0x12e6e5-0x0;var _0x4ef6ce=_0x7540[_0x12e6e5];return _0x4ef6ce;};'use strict';var Sequelize=require('sequelize');module[_0x0754('0x0')]={'name':{'type':Sequelize[_0x0754('0x1')],'allowNull':![],'unique':_0x0754('0x2')},'mode':{'type':Sequelize[_0x0754('0x3')](_0x0754('0x4'),_0x0754('0x5'),'mp3nb',_0x0754('0x6'),_0x0754('0x7'),_0x0754('0x8')),'allowNull':!![],'defaultValue':_0x0754('0x5')},'directory':{'type':Sequelize['STRING'],'allowNull':!![]},'application':{'type':Sequelize['STRING'],'allowNull':!![]},'digit':{'type':Sequelize[_0x0754('0x1')],'allowNull':!![]},'sort':{'type':Sequelize[_0x0754('0x1')],'allowNull':!![],'defaultValue':_0x0754('0x9')},'format':{'type':Sequelize['STRING'],'allowNull':!![]},'stamp':{'type':_0x0754('0xa')},'defaultEntry':{'type':Sequelize[_0x0754('0xb')],'defaultValue':0x0}}; \ No newline at end of file +var _0xadd2=['files','STRING','alpha','BOOLEAN','exports','name','ENUM','quietmp3nb','quietmp3','mp3'];(function(_0x374af3,_0x7ed8f1){var _0x1dc982=function(_0x530538){while(--_0x530538){_0x374af3['push'](_0x374af3['shift']());}};_0x1dc982(++_0x7ed8f1);}(_0xadd2,0x9a));var _0x2add=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0xadd2[_0x21a9d9];return _0x46adce;};'use strict';var Sequelize=require('sequelize');module[_0x2add('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x2add('0x1')},'mode':{'type':Sequelize[_0x2add('0x2')]('custom','files','mp3nb',_0x2add('0x3'),_0x2add('0x4'),_0x2add('0x5')),'allowNull':!![],'defaultValue':_0x2add('0x6')},'directory':{'type':Sequelize[_0x2add('0x7')],'allowNull':!![]},'application':{'type':Sequelize[_0x2add('0x7')],'allowNull':!![]},'digit':{'type':Sequelize[_0x2add('0x7')],'allowNull':!![]},'sort':{'type':Sequelize[_0x2add('0x7')],'allowNull':!![],'defaultValue':_0x2add('0x8')},'format':{'type':Sequelize['STRING'],'allowNull':!![]},'stamp':{'type':'TIMESTAMP'},'defaultEntry':{'type':Sequelize[_0x2add('0x9')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.controller.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.controller.js index 7cf7104..24a7841 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 _0x473b=['removeSound','findOne','id2','unlinkSync','getSounds','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','fs-extra','squel','jsforce','desk.js','to-csv','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','get','MusicOnHolds','error','stack','name','send','index','map','rawAttributes','fieldName','key','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','where','type','VIRTUAL','filter','merge','options','VoiceMusicOnHold','includeAll','findAll','rows','catch','show','body','find','params','create','transaction','directory','join','root','files','mkdirSync','0777','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','sequelize','readdirSync','forEach','rmdirSync','Sequelize','addSound','Sound','save_name','converted_format','createdAt','server/files/sounds/converted','format','%s.%s','extname','server/files/moh','symlinkSync','ValidationError','message'];(function(_0x3dc94,_0x3c8a3a){var _0x8975e1=function(_0x585b79){while(--_0x585b79){_0x3dc94['push'](_0x3dc94['shift']());}};_0x8975e1(++_0x3c8a3a);}(_0x473b,0x1c9));var _0xb473=function(_0x13d07a,_0x41efc3){_0x13d07a=_0x13d07a-0x0;var _0x5ee0ee=_0x473b[_0x13d07a];return _0x5ee0ee;};'use strict';var emlformat=require(_0xb473('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xb473('0x1'));var jsonpatch=require(_0xb473('0x2'));var rp=require(_0xb473('0x3'));var moment=require(_0xb473('0x4'));var BPromise=require(_0xb473('0x5'));var Mustache=require('mustache');var util=require(_0xb473('0x6'));var path=require(_0xb473('0x7'));var sox=require(_0xb473('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xb473('0x9'));var _=require('lodash');var squel=require(_0xb473('0xa'));var crypto=require('crypto');var jsforce=require(_0xb473('0xb'));var deskjs=require(_0xb473('0xc'));var toCsv=require(_0xb473('0xd'));var querystring=require('querystring');var Papa=require(_0xb473('0xe'));var Redis=require('ioredis');var authService=require(_0xb473('0xf'));var qs=require(_0xb473('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb473('0x11'));var logger=require('../../config/logger')(_0xb473('0x12'));var utils=require(_0xb473('0x13'));var config=require(_0xb473('0x14'));var licenseUtil=require(_0xb473('0x15'));var db=require(_0xb473('0x16'))['db'];function respondWithStatusCode(_0x37ed22,_0x268fbf){_0x268fbf=_0x268fbf||0xcc;return function(_0x2cf6c9){if(_0x2cf6c9){return _0x37ed22[_0xb473('0x17')](_0x268fbf);}return _0x37ed22[_0xb473('0x18')](_0x268fbf)[_0xb473('0x19')]();};}function respondWithResult(_0x58d6d1,_0x3667bb){_0x3667bb=_0x3667bb||0xc8;return function(_0x37e36a){if(_0x37e36a){return _0x58d6d1[_0xb473('0x18')](_0x3667bb)[_0xb473('0x1a')](_0x37e36a);}};}function respondWithFilteredResult(_0x5bbd35,_0x4df0a5){return function(_0x9ef934){if(_0x9ef934){var _0x1de9ed=typeof _0x4df0a5[_0xb473('0x1b')]===_0xb473('0x1c')&&typeof _0x4df0a5[_0xb473('0x1d')]===_0xb473('0x1c');var _0x216a45=_0x9ef934[_0xb473('0x1e')];var _0x259f9d=_0x1de9ed?0x0:_0x4df0a5[_0xb473('0x1b')];var _0x5823f7=_0x1de9ed?_0x9ef934[_0xb473('0x1e')]:_0x4df0a5[_0xb473('0x1b')]+_0x4df0a5['limit'];var _0x158fd3;if(_0x5823f7>=_0x216a45){_0x5823f7=_0x216a45;_0x158fd3=0xc8;}else{_0x158fd3=0xce;}_0x5bbd35[_0xb473('0x18')](_0x158fd3);return _0x5bbd35[_0xb473('0x1f')](_0xb473('0x20'),_0x259f9d+'-'+_0x5823f7+'/'+_0x216a45)[_0xb473('0x1a')](_0x9ef934);}return null;};}function patchUpdates(_0x5a3e28){return function(_0x25af85){try{jsonpatch[_0xb473('0x21')](_0x25af85,_0x5a3e28,!![]);}catch(_0x770d51){return BPromise[_0xb473('0x22')](_0x770d51);}return _0x25af85['save']();};}function saveUpdates(_0x39506f,_0x4fbc2c){return function(_0xef4bf){if(_0xef4bf){return _0xef4bf[_0xb473('0x23')](_0x39506f)[_0xb473('0x24')](function(_0xaafd47){return _0xaafd47;});}return null;};}function removeEntity(_0x45494c,_0x3fc647){return function(_0x1f9139){if(_0x1f9139){return _0x1f9139[_0xb473('0x25')]()[_0xb473('0x24')](function(){var _0x13534f=_0x1f9139[_0xb473('0x26')]({'plain':!![]});var _0x50a3aa=_0xb473('0x27');return db['UserProfileResource']['destroy']({'where':{'type':_0x50a3aa,'resourceId':_0x13534f['id']}})[_0xb473('0x24')](function(){return _0x1f9139;});})[_0xb473('0x24')](function(){_0x45494c[_0xb473('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1c3b06,_0x5163a7){return function(_0x211157){if(!_0x211157){_0x1c3b06[_0xb473('0x17')](0x194);}return _0x211157;};}function handleError(_0x28de94,_0x471583){_0x471583=_0x471583||0x1f4;return function(_0x5db1fe){logger[_0xb473('0x28')](_0x5db1fe[_0xb473('0x29')]);if(_0x5db1fe['name']){delete _0x5db1fe[_0xb473('0x2a')];}_0x28de94[_0xb473('0x18')](_0x471583)[_0xb473('0x2b')](_0x5db1fe);};}exports[_0xb473('0x2c')]=function(_0xb72a6,_0x478c43){var _0x8ad526={},_0x2e4fa4={},_0x522593={'count':0x0,'rows':[]};var _0x2d88e=_[_0xb473('0x2d')](db['VoiceMusicOnHold'][_0xb473('0x2e')],function(_0x333ff8){return{'name':_0x333ff8[_0xb473('0x2f')],'type':_0x333ff8['type'][_0xb473('0x30')]};});_0x2e4fa4[_0xb473('0x31')]=_[_0xb473('0x2d')](_0x2d88e,_0xb473('0x2a'));_0x2e4fa4['query']=_[_0xb473('0x32')](_0xb72a6[_0xb473('0x33')]);_0x2e4fa4['filters']=_[_0xb473('0x34')](_0x2e4fa4['model'],_0x2e4fa4[_0xb473('0x33')]);_0x8ad526[_0xb473('0x35')]=_[_0xb473('0x34')](_0x2e4fa4[_0xb473('0x31')],qs['fields'](_0xb72a6[_0xb473('0x33')][_0xb473('0x36')]));_0x8ad526[_0xb473('0x35')]=_0x8ad526[_0xb473('0x35')][_0xb473('0x37')]?_0x8ad526[_0xb473('0x35')]:_0x2e4fa4['model'];if(!_0xb72a6[_0xb473('0x33')][_0xb473('0x38')](_0xb473('0x39'))){_0x8ad526[_0xb473('0x1d')]=qs['limit'](_0xb72a6[_0xb473('0x33')][_0xb473('0x1d')]);_0x8ad526['offset']=qs[_0xb473('0x1b')](_0xb72a6['query'][_0xb473('0x1b')]);}_0x8ad526[_0xb473('0x3a')]=qs[_0xb473('0x3b')](_0xb72a6[_0xb473('0x33')]['sort']);delete _0xb72a6[_0xb473('0x33')]['sort'];_0x8ad526['where']=qs[_0xb473('0x3c')](_[_0xb473('0x3d')](_0xb72a6[_0xb473('0x33')],_0x2e4fa4['filters']),_0x2d88e);if(_0xb72a6[_0xb473('0x33')]['filter']){_0x8ad526[_0xb473('0x3e')]=_['merge'](_0x8ad526[_0xb473('0x3e')],{'$or':_['map'](_0x2d88e,function(_0x24fa87){if(_0x24fa87[_0xb473('0x3f')]!==_0xb473('0x40')){var _0x3093d3={};_0x3093d3[_0x24fa87[_0xb473('0x2a')]]={'$like':'%'+_0xb72a6[_0xb473('0x33')][_0xb473('0x41')]+'%'};return _0x3093d3;}})});}_0x8ad526=_[_0xb473('0x42')]({},_0x8ad526,_0xb72a6[_0xb473('0x43')]);var _0x560ace={'where':_0x8ad526['where']};return db[_0xb473('0x44')][_0xb473('0x1e')](_0x560ace)[_0xb473('0x24')](function(_0x50cc9d){_0x522593['count']=_0x50cc9d;if(_0xb72a6[_0xb473('0x33')][_0xb473('0x45')]){_0x8ad526['include']=[{'all':!![]}];}return db['VoiceMusicOnHold'][_0xb473('0x46')](_0x8ad526);})[_0xb473('0x24')](function(_0x14dd5e){_0x522593[_0xb473('0x47')]=_0x14dd5e;return _0x522593;})[_0xb473('0x24')](respondWithFilteredResult(_0x478c43,_0x8ad526))[_0xb473('0x48')](handleError(_0x478c43,null));};exports[_0xb473('0x49')]=function(_0x3c5970,_0x137df8){var _0x59b192={'raw':![],'where':{'id':_0x3c5970['params']['id']}},_0xb9394f={};_0xb9394f[_0xb473('0x31')]=_[_0xb473('0x32')](db[_0xb473('0x44')][_0xb473('0x2e')]);_0xb9394f['query']=_[_0xb473('0x32')](_0x3c5970[_0xb473('0x33')]);_0xb9394f['filters']=_['intersection'](_0xb9394f[_0xb473('0x31')],_0xb9394f[_0xb473('0x33')]);_0x59b192['attributes']=_['intersection'](_0xb9394f[_0xb473('0x31')],qs[_0xb473('0x36')](_0x3c5970[_0xb473('0x33')][_0xb473('0x36')]));_0x59b192[_0xb473('0x35')]=_0x59b192[_0xb473('0x35')][_0xb473('0x37')]?_0x59b192['attributes']:_0xb9394f['model'];if(_0x3c5970[_0xb473('0x33')][_0xb473('0x45')]){_0x59b192['include']=[{'all':!![]}];}_0x59b192=_[_0xb473('0x42')]({},_0x59b192,_0x3c5970[_0xb473('0x43')]);return db['VoiceMusicOnHold']['find'](_0x59b192)[_0xb473('0x24')](handleEntityNotFound(_0x137df8,null))['then'](respondWithResult(_0x137df8,null))[_0xb473('0x48')](handleError(_0x137df8,null));};exports[_0xb473('0x23')]=function(_0x5654ea,_0x1c599f){if(_0x5654ea[_0xb473('0x4a')]['id']){delete _0x5654ea[_0xb473('0x4a')]['id'];}return db[_0xb473('0x44')][_0xb473('0x4b')]({'where':{'id':_0x5654ea[_0xb473('0x4c')]['id']}})['then'](handleEntityNotFound(_0x1c599f,null))[_0xb473('0x24')](saveUpdates(_0x5654ea[_0xb473('0x4a')],null))[_0xb473('0x24')](respondWithResult(_0x1c599f,null))[_0xb473('0x48')](handleError(_0x1c599f,null));};exports[_0xb473('0x4d')]=function(_0x3fa96c,_0x1e2a03,_0x486251){return db['sequelize'][_0xb473('0x4e')](function(_0x1e751d){if(_0x3fa96c[_0xb473('0x4a')]['mode']==='files'){_0x3fa96c[_0xb473('0x4a')][_0xb473('0x4f')]=path[_0xb473('0x50')](config[_0xb473('0x51')],'server/files/moh',_0x3fa96c[_0xb473('0x4a')][_0xb473('0x2a')]);}return db['VoiceMusicOnHold']['create'](_0x3fa96c['body'],{'transaction':_0x1e751d})[_0xb473('0x24')](function(_0x1b5aba){if(_0x3fa96c[_0xb473('0x4a')]['mode']===_0xb473('0x52')){fs[_0xb473('0x53')](_0x1b5aba[_0xb473('0x4f')],parseInt(_0xb473('0x54'),0x8));}var _0x1a0d71=_0x3fa96c['user'][_0xb473('0x26')]({'plain':!![]});if(!_0x1a0d71)throw new Error(_0xb473('0x55'));if(_0x1a0d71['role']===_0xb473('0x56')){var _0x83d480=_0x1b5aba[_0xb473('0x26')]({'plain':!![]});return db['UserProfileSection']['find']({'where':{'name':_0xb473('0x27'),'userProfileId':_0x1a0d71[_0xb473('0x57')]},'raw':!![]})[_0xb473('0x24')](function(_0x3db688){if(_0x3db688&&_0x3db688['autoAssociation']===0x0){return db[_0xb473('0x58')][_0xb473('0x4d')]({'name':_0x83d480[_0xb473('0x2a')],'resourceId':_0x83d480['id'],'type':_0x3db688['name'],'sectionId':_0x3db688['id']},{})[_0xb473('0x24')](function(){return _0x1b5aba;});}else{return _0x1b5aba;}})[_0xb473('0x48')](function(_0x213e78){logger[_0xb473('0x28')](_0xb473('0x59'),_0x213e78);});}return _0x1b5aba;});})[_0xb473('0x24')](respondWithResult(_0x1e2a03,0xc9))[_0xb473('0x48')](handleError(_0x1e2a03,null));};exports[_0xb473('0x25')]=function(_0x2867ee,_0x1e1a08,_0x2690b4){var _0xb5ee68;return db[_0xb473('0x44')]['find']({'where':{'id':_0x2867ee['params']['id']}})[_0xb473('0x24')](function(_0x35003c){if(_0x35003c){return db[_0xb473('0x5a')][_0xb473('0x4e')](function(_0x699b1){return _0x35003c[_0xb473('0x25')]({'transaction':_0x699b1,'raw':!![]})[_0xb473('0x24')](function(_0x14bed1){if(_0x14bed1[_0xb473('0x4f')]){fs[_0xb473('0x5b')](_0x14bed1['directory'])[_0xb473('0x5c')](function(_0x54daf4){fs['unlinkSync'](path[_0xb473('0x50')](_0x14bed1[_0xb473('0x4f')],_0x54daf4));});fs[_0xb473('0x5d')](_0x14bed1['directory']);}return _0x14bed1;});})['catch'](function(_0x498ba8){throw new db[(_0xb473('0x5e'))]['ValidationError'](_0x498ba8['message']);});}})[_0xb473('0x24')](handleEntityNotFound(_0x1e1a08,null))['then'](removeEntity(_0x1e1a08,null))['catch'](handleError(_0x1e1a08,null));};exports['addSound']=function(_0x267835,_0x91cb62,_0x5d2245){return db[_0xb473('0x5a')][_0xb473('0x4e')](function(_0x16b8a2){var _0x5b9e8d;return db['VoiceMusicOnHold'][_0xb473('0x4b')]({'where':{'id':_0x267835[_0xb473('0x4c')]['id']}})[_0xb473('0x24')](function(_0x321745){if(_0x321745){_0x5b9e8d=_0x321745;return _0x321745[_0xb473('0x5f')](_0x267835[_0xb473('0x4a')]['id'],{'transaction':_0x16b8a2});}})[_0xb473('0x24')](function(_0xb957b6){if(_0xb957b6){return db[_0xb473('0x60')]['findOne']({'where':{'id':_0x267835[_0xb473('0x4a')]['id']},'attributes':['id',_0xb473('0x2a'),_0xb473('0x61'),_0xb473('0x62'),_0xb473('0x63')],'raw':!![]});}})['then'](function(_0x5481d9){if(_0x5481d9){var _0x5cd5dd=path[_0xb473('0x50')](config[_0xb473('0x51')],_0xb473('0x64'),util[_0xb473('0x65')](_0xb473('0x66'),path['basename'](_0x5481d9[_0xb473('0x61')],path[_0xb473('0x67')](_0x5481d9[_0xb473('0x61')])),_0x5481d9[_0xb473('0x62')]));var _0x34624a=path[_0xb473('0x50')](config[_0xb473('0x51')],_0xb473('0x68'),_0x5b9e8d[_0xb473('0x2a')],util[_0xb473('0x65')](_0xb473('0x66'),_0x5481d9[_0xb473('0x2a')],_0x5481d9[_0xb473('0x62')]));fs[_0xb473('0x69')](_0x5cd5dd,_0x34624a);return _0x5481d9;}})[_0xb473('0x48')](function(_0x3213b6){throw new db['Sequelize'][(_0xb473('0x6a'))](_0x3213b6[_0xb473('0x6b')]);});})[_0xb473('0x24')](handleEntityNotFound(_0x91cb62,null))[_0xb473('0x24')](respondWithResult(_0x91cb62,0xc9))[_0xb473('0x48')](handleError(_0x91cb62,null));};exports[_0xb473('0x6c')]=function(_0x507e5a,_0x11dc81,_0x6b7a98){return db['sequelize'][_0xb473('0x4e')](function(_0x2687ae){var _0x373576;return db['VoiceMusicOnHold'][_0xb473('0x6d')]({'where':{'id':_0x507e5a[_0xb473('0x4c')]['id']}})[_0xb473('0x24')](handleEntityNotFound(_0x11dc81,null))[_0xb473('0x24')](function(_0x4b3857){if(_0x4b3857){_0x373576=_0x4b3857;return _0x4b3857[_0xb473('0x6c')](_0x507e5a[_0xb473('0x4c')][_0xb473('0x6e')]);}})[_0xb473('0x24')](function(_0x335bd2){if(_0x335bd2){return db[_0xb473('0x60')][_0xb473('0x6d')]({'where':{'id':_0x507e5a[_0xb473('0x4c')][_0xb473('0x6e')]},'attributes':['id',_0xb473('0x2a'),_0xb473('0x61'),_0xb473('0x62'),_0xb473('0x63')],'raw':!![]});}})['then'](function(_0x200cb7){if(_0x200cb7){fs[_0xb473('0x6f')](path[_0xb473('0x50')](_0x373576[_0xb473('0x4f')],util['format'](_0xb473('0x66'),_0x200cb7['name'],_0x200cb7[_0xb473('0x62')])));return _0x200cb7;}})[_0xb473('0x48')](function(_0x83a95b){throw new db['Sequelize'][(_0xb473('0x6a'))](_0x83a95b[_0xb473('0x6b')]);});})[_0xb473('0x24')](handleEntityNotFound(_0x11dc81,null))[_0xb473('0x24')](respondWithStatusCode(_0x11dc81,0xcc))[_0xb473('0x48')](handleError(_0x11dc81,null));};exports['getSounds']=function(_0x3d5702,_0x385a0b,_0x38f955){var _0x1a644d={};var _0x5b728c={};var _0x35efbd;var _0xc15d69;return db[_0xb473('0x44')][_0xb473('0x6d')]({'where':{'id':_0x3d5702[_0xb473('0x4c')]['id']}})['then'](handleEntityNotFound(_0x385a0b,null))[_0xb473('0x24')](function(_0x38f717){if(_0x38f717){_0x35efbd=_0x38f717;_0x5b728c[_0xb473('0x31')]=_[_0xb473('0x32')](db[_0xb473('0x60')][_0xb473('0x2e')]);_0x5b728c['query']=_[_0xb473('0x32')](_0x3d5702['query']);_0x5b728c[_0xb473('0x3c')]=_['intersection'](_0x5b728c[_0xb473('0x31')],_0x5b728c[_0xb473('0x33')]);_0x1a644d[_0xb473('0x35')]=_['intersection'](_0x5b728c['model'],qs['fields'](_0x3d5702[_0xb473('0x33')][_0xb473('0x36')]));_0x1a644d[_0xb473('0x35')]=_0x1a644d[_0xb473('0x35')][_0xb473('0x37')]?_0x1a644d[_0xb473('0x35')]:_0x5b728c['model'];_0x1a644d[_0xb473('0x3a')]=qs[_0xb473('0x3b')](_0x3d5702['query'][_0xb473('0x3b')]);_0x1a644d[_0xb473('0x3e')]=qs[_0xb473('0x3c')](_[_0xb473('0x3d')](_0x3d5702[_0xb473('0x33')],_0x5b728c[_0xb473('0x3c')]));if(_0x3d5702[_0xb473('0x33')][_0xb473('0x41')]){_0x1a644d['where']=_[_0xb473('0x42')](_0x1a644d[_0xb473('0x3e')],{'$or':_['map'](_0x1a644d[_0xb473('0x35')],function(_0x5b405c){var _0x22bfb5={};_0x22bfb5[_0x5b405c]={'$like':'%'+_0x3d5702['query']['filter']+'%'};return _0x22bfb5;})});}_0x1a644d=_[_0xb473('0x42')]({},_0x1a644d,_0x3d5702[_0xb473('0x43')]);return _0x35efbd[_0xb473('0x70')](_0x1a644d);}})['then'](function(_0x72de0b){if(_0x72de0b){_0xc15d69=_0x72de0b['length'];if(!_0x3d5702[_0xb473('0x33')][_0xb473('0x38')](_0xb473('0x39'))){_0x1a644d[_0xb473('0x1d')]=qs[_0xb473('0x1d')](_0x3d5702[_0xb473('0x33')][_0xb473('0x1d')]);_0x1a644d['offset']=qs[_0xb473('0x1b')](_0x3d5702['query'][_0xb473('0x1b')]);}return _0x35efbd['getSounds'](_0x1a644d);}})[_0xb473('0x24')](function(_0xced1b3){if(_0xced1b3){return _0xced1b3?{'count':_0xc15d69,'rows':_0xced1b3}:null;}})[_0xb473('0x24')](respondWithResult(_0x385a0b,null))['catch'](handleError(_0x385a0b,null));}; \ No newline at end of file +var _0xbf0d=['server/files/moh','symlinkSync','removeSound','sequelize','findOne','id2','unlinkSync','getSounds','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','json','offset','undefined','count','status','apply','reject','update','then','destroy','get','end','error','name','send','VoiceMusicOnHold','rawAttributes','fieldName','type','key','model','map','query','filters','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','pick','filter','where','merge','VIRTUAL','includeAll','include','findAll','rows','catch','params','keys','intersection','options','body','find','create','transaction','mode','files','directory','mkdirSync','0777','user','UserProfileSection','MusicOnHolds','userProfileId','autoAssociation','UserProfileResource','forEach','rmdirSync','Sequelize','ValidationError','message','addSound','Sound','save_name','converted_format','createdAt','join','server/files/sounds/converted','format','%s.%s','basename','extname','root'];(function(_0x2edd19,_0x27900c){var _0x527edb=function(_0x21fcfb){while(--_0x21fcfb){_0x2edd19['push'](_0x2edd19['shift']());}};_0x527edb(++_0x27900c);}(_0xbf0d,0x1c8));var _0xdbf0=function(_0xa1924e,_0x4a70ce){_0xa1924e=_0xa1924e-0x0;var _0x529341=_0xbf0d[_0xa1924e];return _0x529341;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xdbf0('0x0'));var zipdir=require(_0xdbf0('0x1'));var jsonpatch=require(_0xdbf0('0x2'));var rp=require('request-promise');var moment=require(_0xdbf0('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xdbf0('0x4'));var util=require(_0xdbf0('0x5'));var path=require(_0xdbf0('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xdbf0('0x7'));var fs=require('fs');var fs_extra=require(_0xdbf0('0x8'));var _=require(_0xdbf0('0x9'));var squel=require(_0xdbf0('0xa'));var crypto=require(_0xdbf0('0xb'));var jsforce=require(_0xdbf0('0xc'));var deskjs=require(_0xdbf0('0xd'));var toCsv=require(_0xdbf0('0xe'));var querystring=require(_0xdbf0('0xf'));var Papa=require(_0xdbf0('0x10'));var Redis=require(_0xdbf0('0x11'));var authService=require(_0xdbf0('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xdbf0('0x13'));var hardwareService=require(_0xdbf0('0x14'));var logger=require(_0xdbf0('0x15'))('api');var utils=require(_0xdbf0('0x16'));var config=require(_0xdbf0('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xdbf0('0x18'))['db'];function respondWithStatusCode(_0x1fd489,_0x12fcb1){_0x12fcb1=_0x12fcb1||0xcc;return function(_0x1f1279){if(_0x1f1279){return _0x1fd489[_0xdbf0('0x19')](_0x12fcb1);}return _0x1fd489['status'](_0x12fcb1)['end']();};}function respondWithResult(_0x22449f,_0x224bb8){_0x224bb8=_0x224bb8||0xc8;return function(_0x209359){if(_0x209359){return _0x22449f['status'](_0x224bb8)[_0xdbf0('0x1a')](_0x209359);}};}function respondWithFilteredResult(_0x486c6b,_0x37b00d){return function(_0x14529b){if(_0x14529b){var _0x520c94=typeof _0x37b00d[_0xdbf0('0x1b')]===_0xdbf0('0x1c')&&typeof _0x37b00d['limit']===_0xdbf0('0x1c');var _0x1a5cfd=_0x14529b[_0xdbf0('0x1d')];var _0x62bba0=_0x520c94?0x0:_0x37b00d['offset'];var _0x41ca8b=_0x520c94?_0x14529b[_0xdbf0('0x1d')]:_0x37b00d[_0xdbf0('0x1b')]+_0x37b00d['limit'];var _0x1b988a;if(_0x41ca8b>=_0x1a5cfd){_0x41ca8b=_0x1a5cfd;_0x1b988a=0xc8;}else{_0x1b988a=0xce;}_0x486c6b[_0xdbf0('0x1e')](_0x1b988a);return _0x486c6b['set']('Content-Range',_0x62bba0+'-'+_0x41ca8b+'/'+_0x1a5cfd)['json'](_0x14529b);}return null;};}function patchUpdates(_0x24bfe9){return function(_0xdc837d){try{jsonpatch[_0xdbf0('0x1f')](_0xdc837d,_0x24bfe9,!![]);}catch(_0x47c6af){return BPromise[_0xdbf0('0x20')](_0x47c6af);}return _0xdc837d['save']();};}function saveUpdates(_0x54a0c2,_0x557ea1){return function(_0x29a1e9){if(_0x29a1e9){return _0x29a1e9[_0xdbf0('0x21')](_0x54a0c2)[_0xdbf0('0x22')](function(_0x4c2c27){return _0x4c2c27;});}return null;};}function removeEntity(_0x4f69b5,_0x443d6b){return function(_0x300fdb){if(_0x300fdb){return _0x300fdb[_0xdbf0('0x23')]()[_0xdbf0('0x22')](function(){var _0x34408f=_0x300fdb[_0xdbf0('0x24')]({'plain':!![]});var _0x265c3f='MusicOnHolds';return db['UserProfileResource'][_0xdbf0('0x23')]({'where':{'type':_0x265c3f,'resourceId':_0x34408f['id']}})[_0xdbf0('0x22')](function(){return _0x300fdb;});})[_0xdbf0('0x22')](function(){_0x4f69b5[_0xdbf0('0x1e')](0xcc)[_0xdbf0('0x25')]();});}};}function handleEntityNotFound(_0x487da8,_0xfe2553){return function(_0x2647ae){if(!_0x2647ae){_0x487da8[_0xdbf0('0x19')](0x194);}return _0x2647ae;};}function handleError(_0x494f00,_0x126b16){_0x126b16=_0x126b16||0x1f4;return function(_0x90abf5){logger[_0xdbf0('0x26')](_0x90abf5['stack']);if(_0x90abf5[_0xdbf0('0x27')]){delete _0x90abf5[_0xdbf0('0x27')];}_0x494f00['status'](_0x126b16)[_0xdbf0('0x28')](_0x90abf5);};}exports['index']=function(_0x3b9d29,_0x6ba583){var _0x5696b9={},_0x42d4c7={},_0x1a6458={'count':0x0,'rows':[]};var _0x2ec2f8=_['map'](db[_0xdbf0('0x29')][_0xdbf0('0x2a')],function(_0x3ee02e){return{'name':_0x3ee02e[_0xdbf0('0x2b')],'type':_0x3ee02e[_0xdbf0('0x2c')][_0xdbf0('0x2d')]};});_0x42d4c7[_0xdbf0('0x2e')]=_[_0xdbf0('0x2f')](_0x2ec2f8,'name');_0x42d4c7[_0xdbf0('0x30')]=_['keys'](_0x3b9d29[_0xdbf0('0x30')]);_0x42d4c7[_0xdbf0('0x31')]=_['intersection'](_0x42d4c7[_0xdbf0('0x2e')],_0x42d4c7[_0xdbf0('0x30')]);_0x5696b9[_0xdbf0('0x32')]=_['intersection'](_0x42d4c7[_0xdbf0('0x2e')],qs[_0xdbf0('0x33')](_0x3b9d29[_0xdbf0('0x30')][_0xdbf0('0x33')]));_0x5696b9[_0xdbf0('0x32')]=_0x5696b9[_0xdbf0('0x32')][_0xdbf0('0x34')]?_0x5696b9[_0xdbf0('0x32')]:_0x42d4c7[_0xdbf0('0x2e')];if(!_0x3b9d29['query'][_0xdbf0('0x35')](_0xdbf0('0x36'))){_0x5696b9[_0xdbf0('0x37')]=qs['limit'](_0x3b9d29[_0xdbf0('0x30')]['limit']);_0x5696b9[_0xdbf0('0x1b')]=qs[_0xdbf0('0x1b')](_0x3b9d29['query']['offset']);}_0x5696b9[_0xdbf0('0x38')]=qs[_0xdbf0('0x39')](_0x3b9d29[_0xdbf0('0x30')][_0xdbf0('0x39')]);delete _0x3b9d29['query']['sort'];_0x5696b9['where']=qs[_0xdbf0('0x31')](_[_0xdbf0('0x3a')](_0x3b9d29['query'],_0x42d4c7[_0xdbf0('0x31')]),_0x2ec2f8);if(_0x3b9d29[_0xdbf0('0x30')][_0xdbf0('0x3b')]){_0x5696b9[_0xdbf0('0x3c')]=_[_0xdbf0('0x3d')](_0x5696b9[_0xdbf0('0x3c')],{'$or':_[_0xdbf0('0x2f')](_0x2ec2f8,function(_0x23d462){if(_0x23d462['type']!==_0xdbf0('0x3e')){var _0x5d5c59={};_0x5d5c59[_0x23d462['name']]={'$like':'%'+_0x3b9d29[_0xdbf0('0x30')][_0xdbf0('0x3b')]+'%'};return _0x5d5c59;}})});}_0x5696b9=_[_0xdbf0('0x3d')]({},_0x5696b9,_0x3b9d29['options']);var _0x4e4d12={'where':_0x5696b9[_0xdbf0('0x3c')]};return db[_0xdbf0('0x29')]['count'](_0x4e4d12)[_0xdbf0('0x22')](function(_0x1e4f15){_0x1a6458[_0xdbf0('0x1d')]=_0x1e4f15;if(_0x3b9d29['query'][_0xdbf0('0x3f')]){_0x5696b9[_0xdbf0('0x40')]=[{'all':!![]}];}return db[_0xdbf0('0x29')][_0xdbf0('0x41')](_0x5696b9);})['then'](function(_0x359256){_0x1a6458[_0xdbf0('0x42')]=_0x359256;return _0x1a6458;})['then'](respondWithFilteredResult(_0x6ba583,_0x5696b9))[_0xdbf0('0x43')](handleError(_0x6ba583,null));};exports['show']=function(_0x293f6c,_0x56c628){var _0x5b0957={'raw':![],'where':{'id':_0x293f6c[_0xdbf0('0x44')]['id']}},_0x1a8cbb={};_0x1a8cbb[_0xdbf0('0x2e')]=_[_0xdbf0('0x45')](db[_0xdbf0('0x29')]['rawAttributes']);_0x1a8cbb['query']=_['keys'](_0x293f6c[_0xdbf0('0x30')]);_0x1a8cbb['filters']=_['intersection'](_0x1a8cbb[_0xdbf0('0x2e')],_0x1a8cbb[_0xdbf0('0x30')]);_0x5b0957[_0xdbf0('0x32')]=_[_0xdbf0('0x46')](_0x1a8cbb[_0xdbf0('0x2e')],qs[_0xdbf0('0x33')](_0x293f6c['query'][_0xdbf0('0x33')]));_0x5b0957['attributes']=_0x5b0957[_0xdbf0('0x32')]['length']?_0x5b0957[_0xdbf0('0x32')]:_0x1a8cbb[_0xdbf0('0x2e')];if(_0x293f6c['query'][_0xdbf0('0x3f')]){_0x5b0957[_0xdbf0('0x40')]=[{'all':!![]}];}_0x5b0957=_['merge']({},_0x5b0957,_0x293f6c[_0xdbf0('0x47')]);return db[_0xdbf0('0x29')]['find'](_0x5b0957)[_0xdbf0('0x22')](handleEntityNotFound(_0x56c628,null))[_0xdbf0('0x22')](respondWithResult(_0x56c628,null))['catch'](handleError(_0x56c628,null));};exports[_0xdbf0('0x21')]=function(_0x2cb09b,_0x4119ad){if(_0x2cb09b[_0xdbf0('0x48')]['id']){delete _0x2cb09b[_0xdbf0('0x48')]['id'];}return db['VoiceMusicOnHold'][_0xdbf0('0x49')]({'where':{'id':_0x2cb09b[_0xdbf0('0x44')]['id']}})['then'](handleEntityNotFound(_0x4119ad,null))[_0xdbf0('0x22')](saveUpdates(_0x2cb09b['body'],null))['then'](respondWithResult(_0x4119ad,null))[_0xdbf0('0x43')](handleError(_0x4119ad,null));};exports[_0xdbf0('0x4a')]=function(_0x4c8926,_0xc37955,_0x4bde36){return db['sequelize'][_0xdbf0('0x4b')](function(_0x485e97){if(_0x4c8926[_0xdbf0('0x48')][_0xdbf0('0x4c')]===_0xdbf0('0x4d')){_0x4c8926[_0xdbf0('0x48')][_0xdbf0('0x4e')]=path['join'](config['root'],'server/files/moh',_0x4c8926[_0xdbf0('0x48')]['name']);}return db[_0xdbf0('0x29')][_0xdbf0('0x4a')](_0x4c8926[_0xdbf0('0x48')],{'transaction':_0x485e97})[_0xdbf0('0x22')](function(_0x24c72d){if(_0x4c8926['body'][_0xdbf0('0x4c')]==='files'){fs[_0xdbf0('0x4f')](_0x24c72d[_0xdbf0('0x4e')],parseInt(_0xdbf0('0x50'),0x8));}var _0x4fd3c7=_0x4c8926[_0xdbf0('0x51')][_0xdbf0('0x24')]({'plain':!![]});if(!_0x4fd3c7)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4fd3c7['role']==='user'){var _0xe936f0=_0x24c72d[_0xdbf0('0x24')]({'plain':!![]});return db[_0xdbf0('0x52')][_0xdbf0('0x49')]({'where':{'name':_0xdbf0('0x53'),'userProfileId':_0x4fd3c7[_0xdbf0('0x54')]},'raw':!![]})[_0xdbf0('0x22')](function(_0x1ff474){if(_0x1ff474&&_0x1ff474[_0xdbf0('0x55')]===0x0){return db[_0xdbf0('0x56')][_0xdbf0('0x4a')]({'name':_0xe936f0[_0xdbf0('0x27')],'resourceId':_0xe936f0['id'],'type':_0x1ff474['name'],'sectionId':_0x1ff474['id']},{})['then'](function(){return _0x24c72d;});}else{return _0x24c72d;}})['catch'](function(_0x24e9dc){logger[_0xdbf0('0x26')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x24e9dc);});}return _0x24c72d;});})[_0xdbf0('0x22')](respondWithResult(_0xc37955,0xc9))[_0xdbf0('0x43')](handleError(_0xc37955,null));};exports[_0xdbf0('0x23')]=function(_0x208b16,_0x2e3cfe,_0x2c709a){var _0x34fe58;return db[_0xdbf0('0x29')][_0xdbf0('0x49')]({'where':{'id':_0x208b16[_0xdbf0('0x44')]['id']}})[_0xdbf0('0x22')](function(_0x47b267){if(_0x47b267){return db['sequelize'][_0xdbf0('0x4b')](function(_0x62c228){return _0x47b267[_0xdbf0('0x23')]({'transaction':_0x62c228,'raw':!![]})['then'](function(_0x5c5c33){if(_0x5c5c33[_0xdbf0('0x4e')]){fs['readdirSync'](_0x5c5c33[_0xdbf0('0x4e')])[_0xdbf0('0x57')](function(_0x2b8cec){fs['unlinkSync'](path['join'](_0x5c5c33['directory'],_0x2b8cec));});fs[_0xdbf0('0x58')](_0x5c5c33[_0xdbf0('0x4e')]);}return _0x5c5c33;});})[_0xdbf0('0x43')](function(_0xce1c9b){throw new db[(_0xdbf0('0x59'))][(_0xdbf0('0x5a'))](_0xce1c9b[_0xdbf0('0x5b')]);});}})[_0xdbf0('0x22')](handleEntityNotFound(_0x2e3cfe,null))[_0xdbf0('0x22')](removeEntity(_0x2e3cfe,null))[_0xdbf0('0x43')](handleError(_0x2e3cfe,null));};exports[_0xdbf0('0x5c')]=function(_0x2124e1,_0xa7a02e,_0x369a3d){return db['sequelize'][_0xdbf0('0x4b')](function(_0x3e5a1f){var _0x264cfe;return db[_0xdbf0('0x29')][_0xdbf0('0x49')]({'where':{'id':_0x2124e1[_0xdbf0('0x44')]['id']}})['then'](function(_0x121ee5){if(_0x121ee5){_0x264cfe=_0x121ee5;return _0x121ee5[_0xdbf0('0x5c')](_0x2124e1[_0xdbf0('0x48')]['id'],{'transaction':_0x3e5a1f});}})['then'](function(_0x2ade6c){if(_0x2ade6c){return db[_0xdbf0('0x5d')]['findOne']({'where':{'id':_0x2124e1[_0xdbf0('0x48')]['id']},'attributes':['id',_0xdbf0('0x27'),_0xdbf0('0x5e'),_0xdbf0('0x5f'),_0xdbf0('0x60')],'raw':!![]});}})['then'](function(_0x399e82){if(_0x399e82){var _0x1a0119=path[_0xdbf0('0x61')](config['root'],_0xdbf0('0x62'),util[_0xdbf0('0x63')](_0xdbf0('0x64'),path[_0xdbf0('0x65')](_0x399e82[_0xdbf0('0x5e')],path[_0xdbf0('0x66')](_0x399e82[_0xdbf0('0x5e')])),_0x399e82[_0xdbf0('0x5f')]));var _0x330d56=path[_0xdbf0('0x61')](config[_0xdbf0('0x67')],_0xdbf0('0x68'),_0x264cfe[_0xdbf0('0x27')],util[_0xdbf0('0x63')]('%s.%s',_0x399e82[_0xdbf0('0x27')],_0x399e82[_0xdbf0('0x5f')]));fs[_0xdbf0('0x69')](_0x1a0119,_0x330d56);return _0x399e82;}})[_0xdbf0('0x43')](function(_0x193c41){throw new db[(_0xdbf0('0x59'))][(_0xdbf0('0x5a'))](_0x193c41[_0xdbf0('0x5b')]);});})[_0xdbf0('0x22')](handleEntityNotFound(_0xa7a02e,null))['then'](respondWithResult(_0xa7a02e,0xc9))[_0xdbf0('0x43')](handleError(_0xa7a02e,null));};exports[_0xdbf0('0x6a')]=function(_0x11523d,_0x36d868,_0xf805f5){return db[_0xdbf0('0x6b')]['transaction'](function(_0x3e7934){var _0x4a78c7;return db[_0xdbf0('0x29')][_0xdbf0('0x6c')]({'where':{'id':_0x11523d[_0xdbf0('0x44')]['id']}})[_0xdbf0('0x22')](handleEntityNotFound(_0x36d868,null))[_0xdbf0('0x22')](function(_0x5a8b09){if(_0x5a8b09){_0x4a78c7=_0x5a8b09;return _0x5a8b09[_0xdbf0('0x6a')](_0x11523d[_0xdbf0('0x44')][_0xdbf0('0x6d')]);}})[_0xdbf0('0x22')](function(_0x49c37f){if(_0x49c37f){return db[_0xdbf0('0x5d')]['findOne']({'where':{'id':_0x11523d[_0xdbf0('0x44')][_0xdbf0('0x6d')]},'attributes':['id',_0xdbf0('0x27'),_0xdbf0('0x5e'),_0xdbf0('0x5f'),'createdAt'],'raw':!![]});}})['then'](function(_0x29a2b9){if(_0x29a2b9){fs[_0xdbf0('0x6e')](path[_0xdbf0('0x61')](_0x4a78c7['directory'],util[_0xdbf0('0x63')]('%s.%s',_0x29a2b9['name'],_0x29a2b9['converted_format'])));return _0x29a2b9;}})[_0xdbf0('0x43')](function(_0x2d6fb4){throw new db['Sequelize'][(_0xdbf0('0x5a'))](_0x2d6fb4[_0xdbf0('0x5b')]);});})[_0xdbf0('0x22')](handleEntityNotFound(_0x36d868,null))[_0xdbf0('0x22')](respondWithStatusCode(_0x36d868,0xcc))[_0xdbf0('0x43')](handleError(_0x36d868,null));};exports[_0xdbf0('0x6f')]=function(_0xcd7381,_0x54e388,_0x2603cd){var _0x4ddf47={};var _0x20c999={};var _0x222674;var _0x4deb69;return db[_0xdbf0('0x29')][_0xdbf0('0x6c')]({'where':{'id':_0xcd7381[_0xdbf0('0x44')]['id']}})['then'](handleEntityNotFound(_0x54e388,null))[_0xdbf0('0x22')](function(_0x5696f6){if(_0x5696f6){_0x222674=_0x5696f6;_0x20c999[_0xdbf0('0x2e')]=_[_0xdbf0('0x45')](db[_0xdbf0('0x5d')]['rawAttributes']);_0x20c999[_0xdbf0('0x30')]=_[_0xdbf0('0x45')](_0xcd7381[_0xdbf0('0x30')]);_0x20c999[_0xdbf0('0x31')]=_[_0xdbf0('0x46')](_0x20c999[_0xdbf0('0x2e')],_0x20c999[_0xdbf0('0x30')]);_0x4ddf47[_0xdbf0('0x32')]=_[_0xdbf0('0x46')](_0x20c999[_0xdbf0('0x2e')],qs[_0xdbf0('0x33')](_0xcd7381[_0xdbf0('0x30')][_0xdbf0('0x33')]));_0x4ddf47['attributes']=_0x4ddf47[_0xdbf0('0x32')][_0xdbf0('0x34')]?_0x4ddf47[_0xdbf0('0x32')]:_0x20c999[_0xdbf0('0x2e')];_0x4ddf47[_0xdbf0('0x38')]=qs[_0xdbf0('0x39')](_0xcd7381['query'][_0xdbf0('0x39')]);_0x4ddf47[_0xdbf0('0x3c')]=qs[_0xdbf0('0x31')](_[_0xdbf0('0x3a')](_0xcd7381[_0xdbf0('0x30')],_0x20c999[_0xdbf0('0x31')]));if(_0xcd7381['query'][_0xdbf0('0x3b')]){_0x4ddf47['where']=_[_0xdbf0('0x3d')](_0x4ddf47['where'],{'$or':_[_0xdbf0('0x2f')](_0x4ddf47[_0xdbf0('0x32')],function(_0x10662f){var _0x4396ef={};_0x4396ef[_0x10662f]={'$like':'%'+_0xcd7381['query']['filter']+'%'};return _0x4396ef;})});}_0x4ddf47=_[_0xdbf0('0x3d')]({},_0x4ddf47,_0xcd7381[_0xdbf0('0x47')]);return _0x222674['getSounds'](_0x4ddf47);}})[_0xdbf0('0x22')](function(_0x36dc67){if(_0x36dc67){_0x4deb69=_0x36dc67[_0xdbf0('0x34')];if(!_0xcd7381['query'][_0xdbf0('0x35')](_0xdbf0('0x36'))){_0x4ddf47[_0xdbf0('0x37')]=qs[_0xdbf0('0x37')](_0xcd7381[_0xdbf0('0x30')][_0xdbf0('0x37')]);_0x4ddf47['offset']=qs[_0xdbf0('0x1b')](_0xcd7381[_0xdbf0('0x30')][_0xdbf0('0x1b')]);}return _0x222674[_0xdbf0('0x6f')](_0x4ddf47);}})[_0xdbf0('0x22')](function(_0x2c904a){if(_0x2c904a){return _0x2c904a?{'count':_0x4deb69,'rows':_0x2c904a}:null;}})[_0xdbf0('0x22')](respondWithResult(_0x54e388,null))['catch'](handleError(_0x54e388,null));}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js index 7122d79..138a08c 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 _0xa035=['voice_musiconhold','lodash','util','../../config/logger','api','request-promise','path','rimraf','../../config/environment','./voiceMusicOnHold.attributes','exports','define','VoiceMusicOnHold'];(function(_0x591855,_0x2edc25){var _0x67cb2=function(_0x59df84){while(--_0x59df84){_0x591855['push'](_0x591855['shift']());}};_0x67cb2(++_0x2edc25);}(_0xa035,0x187));var _0x5a03=function(_0x28a2ad,_0x3c0d33){_0x28a2ad=_0x28a2ad-0x0;var _0x4565be=_0xa035[_0x28a2ad];return _0x4565be;};'use strict';var _=require(_0x5a03('0x0'));var util=require(_0x5a03('0x1'));var logger=require(_0x5a03('0x2'))(_0x5a03('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x5a03('0x4'));var fs=require('fs');var path=require(_0x5a03('0x5'));var rimraf=require(_0x5a03('0x6'));var config=require(_0x5a03('0x7'));var attributes=require(_0x5a03('0x8'));module[_0x5a03('0x9')]=function(_0x1ec4a1,_0x339e65){return _0x1ec4a1[_0x5a03('0xa')](_0x5a03('0xb'),attributes,{'tableName':_0x5a03('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2daf=['bluebird','request-promise','path','rimraf','../../config/environment','exports','define','VoiceMusicOnHold','voice_musiconhold','lodash','util','../../config/logger','api','moment'];(function(_0x59a549,_0x2fe2bb){var _0x12adbe=function(_0x2ccd1e){while(--_0x2ccd1e){_0x59a549['push'](_0x59a549['shift']());}};_0x12adbe(++_0x2fe2bb);}(_0x2daf,0x121));var _0xf2da=function(_0x1811e0,_0x487da0){_0x1811e0=_0x1811e0-0x0;var _0x3ce439=_0x2daf[_0x1811e0];return _0x3ce439;};'use strict';var _=require(_0xf2da('0x0'));var util=require(_0xf2da('0x1'));var logger=require(_0xf2da('0x2'))(_0xf2da('0x3'));var moment=require(_0xf2da('0x4'));var BPromise=require(_0xf2da('0x5'));var rp=require(_0xf2da('0x6'));var fs=require('fs');var path=require(_0xf2da('0x7'));var rimraf=require(_0xf2da('0x8'));var config=require(_0xf2da('0x9'));var attributes=require('./voiceMusicOnHold.attributes');module[_0xf2da('0xa')]=function(_0x50b9f9,_0x1dc083){return _0x50b9f9[_0xf2da('0xb')](_0xf2da('0xc'),attributes,{'tableName':_0xf2da('0xd'),'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 85ceb0d..ecd3354 100644 --- a/server/api/voiceMusicOnHold/voiceMusicOnHold.rpc.js +++ b/server/api/voiceMusicOnHold/voiceMusicOnHold.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x70e0=['code','VoiceMusicOnHold,\x20%s,\x20%s','message','result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','request','then','info','debug','VoiceMusicOnHold,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x221b6f,_0x4871e2){var _0x4fa2a8=function(_0x1d9214){while(--_0x1d9214){_0x221b6f['push'](_0x221b6f['shift']());}};_0x4fa2a8(++_0x4871e2);}(_0x70e0,0x17b));var _0x070e=function(_0x2ab2d4,_0x532d55){_0x2ab2d4=_0x2ab2d4-0x0;var _0x4ef285=_0x70e0[_0x2ab2d4];return _0x4ef285;};'use strict';var _=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var moment=require(_0x070e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x070e('0x3'));var db=require(_0x070e('0x4'))['db'];var utils=require(_0x070e('0x5'));var logger=require(_0x070e('0x6'))('rpc');var config=require(_0x070e('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x070e('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x56e420,_0x5032e5,_0x35ab0c){return new BPromise(function(_0x1e11f0,_0x604664){return client[_0x070e('0x9')](_0x56e420,_0x35ab0c)[_0x070e('0xa')](function(_0x68a09e){logger[_0x070e('0xb')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x5032e5,'request\x20sent');logger[_0x070e('0xc')](_0x070e('0xd'),_0x5032e5,_0x070e('0xe'),JSON[_0x070e('0xf')](_0x68a09e));if(_0x68a09e[_0x070e('0x10')]){if(_0x68a09e[_0x070e('0x10')][_0x070e('0x11')]===0x1f4){logger[_0x070e('0x10')](_0x070e('0x12'),_0x5032e5,_0x68a09e[_0x070e('0x10')][_0x070e('0x13')]);return _0x604664(_0x68a09e['error']['message']);}logger[_0x070e('0x10')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x5032e5,_0x68a09e['error']['message']);return _0x1e11f0(_0x68a09e[_0x070e('0x10')][_0x070e('0x13')]);}else{logger['info']('VoiceMusicOnHold,\x20%s,\x20%s',_0x5032e5,_0x070e('0xe'));_0x1e11f0(_0x68a09e[_0x070e('0x14')][_0x070e('0x13')]);}})[_0x070e('0x15')](function(_0x5bc71e){logger['error'](_0x070e('0x12'),_0x5032e5,_0x5bc71e);_0x604664(_0x5bc71e);});});} \ No newline at end of file +var _0xcb91=['stringify','error','code','message','catch','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','info','VoiceMusicOnHold,\x20%s,\x20%s','request\x20sent','debug','VoiceMusicOnHold,\x20%s,\x20%s,\x20%s'];(function(_0xd66229,_0x1f9154){var _0x4f84cc=function(_0x1d7589){while(--_0x1d7589){_0xd66229['push'](_0xd66229['shift']());}};_0x4f84cc(++_0x1f9154);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x152449,_0x49f41d){_0x152449=_0x152449-0x0;var _0x5b58b2=_0xcb91[_0x152449];return _0x5b58b2;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x1cb9('0x0'));var BPromise=require(_0x1cb9('0x1'));var rs=require(_0x1cb9('0x2'));var fs=require('fs');var Redis=require(_0x1cb9('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x1cb9('0x4'));var logger=require(_0x1cb9('0x5'))('rpc');var config=require(_0x1cb9('0x6'));var jayson=require(_0x1cb9('0x7'));var client=jayson['client'][_0x1cb9('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3f7deb,_0x4ffe20,_0x38737d){return new BPromise(function(_0x12567c,_0x59d1be){return client[_0x1cb9('0x9')](_0x3f7deb,_0x38737d)['then'](function(_0x567139){logger[_0x1cb9('0xa')](_0x1cb9('0xb'),_0x4ffe20,_0x1cb9('0xc'));logger[_0x1cb9('0xd')](_0x1cb9('0xe'),_0x4ffe20,'request\x20sent',JSON[_0x1cb9('0xf')](_0x567139));if(_0x567139[_0x1cb9('0x10')]){if(_0x567139[_0x1cb9('0x10')][_0x1cb9('0x11')]===0x1f4){logger[_0x1cb9('0x10')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x4ffe20,_0x567139['error']['message']);return _0x59d1be(_0x567139[_0x1cb9('0x10')][_0x1cb9('0x12')]);}logger[_0x1cb9('0x10')](_0x1cb9('0xb'),_0x4ffe20,_0x567139['error'][_0x1cb9('0x12')]);return _0x12567c(_0x567139[_0x1cb9('0x10')][_0x1cb9('0x12')]);}else{logger[_0x1cb9('0xa')](_0x1cb9('0xb'),_0x4ffe20,'request\x20sent');_0x12567c(_0x567139['result'][_0x1cb9('0x12')]);}})[_0x1cb9('0x13')](function(_0x3904b7){logger[_0x1cb9('0x10')](_0x1cb9('0xb'),_0x4ffe20,_0x3904b7);_0x59d1be(_0x3904b7);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/index.js b/server/api/voicePrefix/index.js index 9bc43ac..44f5280 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 _0x061c=['delete','destroy','/:id/users','removeAgents','removeTeams','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./voicePrefix.controller','isAuthenticated','index','get','/describe','describe','/:id','getAgents','/:id/teams','getTeams','post','create','addAgents','addTeams','put','update'];(function(_0x3d3a4f,_0x22263d){var _0x67f3c6=function(_0x52a5f2){while(--_0x52a5f2){_0x3d3a4f['push'](_0x3d3a4f['shift']());}};_0x67f3c6(++_0x22263d);}(_0x061c,0xc0));var _0xc061=function(_0x243370,_0x4cbce0){_0x243370=_0x243370-0x0;var _0x4345b3=_0x061c[_0x243370];return _0x4345b3;};'use strict';var multer=require(_0xc061('0x0'));var util=require(_0xc061('0x1'));var path=require(_0xc061('0x2'));var timeout=require(_0xc061('0x3'));var express=require(_0xc061('0x4'));var router=express[_0xc061('0x5')]();var fs_extra=require(_0xc061('0x6'));var auth=require(_0xc061('0x7'));var interaction=require(_0xc061('0x8'));var config=require('../../config/environment');var controller=require(_0xc061('0x9'));router['get']('/',auth[_0xc061('0xa')](),controller[_0xc061('0xb')]);router[_0xc061('0xc')](_0xc061('0xd'),auth[_0xc061('0xa')](),controller[_0xc061('0xe')]);router[_0xc061('0xc')](_0xc061('0xf'),auth[_0xc061('0xa')](),controller['show']);router['get']('/:id/users',auth[_0xc061('0xa')](),controller[_0xc061('0x10')]);router[_0xc061('0xc')](_0xc061('0x11'),auth['isAuthenticated'](),controller[_0xc061('0x12')]);router[_0xc061('0x13')]('/',auth[_0xc061('0xa')](),controller[_0xc061('0x14')]);router['post']('/:id/users',auth[_0xc061('0xa')](),controller[_0xc061('0x15')]);router[_0xc061('0x13')](_0xc061('0x11'),auth[_0xc061('0xa')](),controller[_0xc061('0x16')]);router[_0xc061('0x17')](_0xc061('0xf'),auth[_0xc061('0xa')](),controller[_0xc061('0x18')]);router[_0xc061('0x19')](_0xc061('0xf'),auth[_0xc061('0xa')](),controller[_0xc061('0x1a')]);router['delete'](_0xc061('0x1b'),auth[_0xc061('0xa')](),controller[_0xc061('0x1c')]);router[_0xc061('0x19')](_0xc061('0x11'),auth[_0xc061('0xa')](),controller[_0xc061('0x1d')]);module[_0xc061('0x1e')]=router; \ No newline at end of file +var _0x2029=['addAgents','addTeams','put','update','delete','destroy','removeAgents','removeTeams','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voicePrefix.controller','get','isAuthenticated','index','describe','/:id','/:id/users','getAgents','/:id/teams','getTeams','post','create'];(function(_0x4947e3,_0x21f2ee){var _0x1911e5=function(_0x193c1b){while(--_0x193c1b){_0x4947e3['push'](_0x4947e3['shift']());}};_0x1911e5(++_0x21f2ee);}(_0x2029,0x171));var _0x9202=function(_0x5c200c,_0x491763){_0x5c200c=_0x5c200c-0x0;var _0x35748b=_0x2029[_0x5c200c];return _0x35748b;};'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')]('/describe',auth['isAuthenticated'](),controller[_0x9202('0xd')]);router['get'](_0x9202('0xe'),auth[_0x9202('0xb')](),controller['show']);router[_0x9202('0xa')](_0x9202('0xf'),auth[_0x9202('0xb')](),controller[_0x9202('0x10')]);router[_0x9202('0xa')](_0x9202('0x11'),auth[_0x9202('0xb')](),controller[_0x9202('0x12')]);router[_0x9202('0x13')]('/',auth[_0x9202('0xb')](),controller[_0x9202('0x14')]);router[_0x9202('0x13')](_0x9202('0xf'),auth[_0x9202('0xb')](),controller[_0x9202('0x15')]);router[_0x9202('0x13')](_0x9202('0x11'),auth['isAuthenticated'](),controller[_0x9202('0x16')]);router[_0x9202('0x17')](_0x9202('0xe'),auth[_0x9202('0xb')](),controller[_0x9202('0x18')]);router[_0x9202('0x19')](_0x9202('0xe'),auth[_0x9202('0xb')](),controller[_0x9202('0x1a')]);router[_0x9202('0x19')]('/:id/users',auth[_0x9202('0xb')](),controller[_0x9202('0x1b')]);router[_0x9202('0x19')](_0x9202('0x11'),auth[_0x9202('0xb')](),controller[_0x9202('0x1c')]);module[_0x9202('0x1d')]=router; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.attributes.js b/server/api/voicePrefix/voicePrefix.attributes.js index c3b2a85..a9ba1f2 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 _0x1125=['name','VIRTUAL','getDataValue','INTEGER','exports','STRING'];(function(_0x525d35,_0xe67489){var _0x4813d2=function(_0x4a6dc8){while(--_0x4a6dc8){_0x525d35['push'](_0x525d35['shift']());}};_0x4813d2(++_0xe67489);}(_0x1125,0x1ae));var _0x5112=function(_0x478829,_0x4ef2bb){_0x478829=_0x478829-0x0;var _0x59a14a=_0x1125[_0x478829];return _0x59a14a;};'use strict';var Sequelize=require('sequelize');module[_0x5112('0x0')]={'name':{'type':Sequelize[_0x5112('0x1')],'allowNull':![],'unique':_0x5112('0x2')},'prefix':{'type':Sequelize[_0x5112('0x3')],'get':function(_0x45ec8f){return'system-'+this[_0x5112('0x4')]('name')+'-';}},'description':{'type':Sequelize['STRING']},'callerIdAll':{'type':Sequelize[_0x5112('0x1')]},'VoiceExtensionId':{'type':Sequelize[_0x5112('0x5')]}}; \ No newline at end of file +var _0xfe97=['exports','STRING','name','system-','getDataValue','INTEGER','sequelize'];(function(_0x38c91f,_0x55f3f8){var _0x5c29b6=function(_0x2c13d1){while(--_0x2c13d1){_0x38c91f['push'](_0x38c91f['shift']());}};_0x5c29b6(++_0x55f3f8);}(_0xfe97,0xae));var _0x7fe9=function(_0x4f1f4a,_0xe07a65){_0x4f1f4a=_0x4f1f4a-0x0;var _0x1079b7=_0xfe97[_0x4f1f4a];return _0x1079b7;};'use strict';var Sequelize=require(_0x7fe9('0x0'));module[_0x7fe9('0x1')]={'name':{'type':Sequelize[_0x7fe9('0x2')],'allowNull':![],'unique':_0x7fe9('0x3')},'prefix':{'type':Sequelize['VIRTUAL'],'get':function(_0x5477b2){return _0x7fe9('0x4')+this[_0x7fe9('0x5')]('name')+'-';}},'description':{'type':Sequelize[_0x7fe9('0x2')]},'callerIdAll':{'type':Sequelize[_0x7fe9('0x2')]},'VoiceExtensionId':{'type':Sequelize[_0x7fe9('0x6')]}}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.controller.js b/server/api/voicePrefix/voicePrefix.controller.js index 57ff3c3..b21546b 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 _0x7d25=['../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./voicePrefix.socket','register','sendStatus','end','json','limit','undefined','count','offset','status','set','Content-Range','apply','reject','save','update','then','destroy','get','VoicePrefixes','UserProfileResource','error','stack','name','send','index','map','rawAttributes','type','key','query','keys','attributes','intersection','model','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','VIRTUAL','filter','options','VoicePrefix','includeAll','findAll','catch','show','include','find','describe','transaction','create','body','VoiceExtension','VoiceExtensionId','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','context','app','system','description','appdata','VoicePrefixId','bulkCreate','Extensions\x20creation\x20failed','prefix','push','Set','CDR(prefix)=','callerIdAll','NoOp','goto','${EXTEN:','charAt','system-','sequelize','findById','addAgents','params','omit','spread','ids','userVoicePrefix:save','removeAgents','isArray','emit','userVoicePrefix:remove','getAgents','User','getTeams','findOne','addTeams','Agents','online','interface','each','upsert','forEach','removeTeams','Team','field','from','team_has_voice_prefixes','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','VoicePrefixId\x20=\x20?','clone','ut.UserId\x20=\x20?','toString','QueryTypes','SELECT','every','includes','all','union','value','isEmpty','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','ejs','lodash','squel','crypto','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch'];(function(_0x1e2433,_0x91114c){var _0x282b1b=function(_0x27af78){while(--_0x27af78){_0x1e2433['push'](_0x1e2433['shift']());}};_0x282b1b(++_0x91114c);}(_0x7d25,0x8a));var _0x57d2=function(_0x4dc7b9,_0x319d5a){_0x4dc7b9=_0x4dc7b9-0x0;var _0x3ab114=_0x7d25[_0x4dc7b9];return _0x3ab114;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x57d2('0x0'));var zipdir=require(_0x57d2('0x1'));var jsonpatch=require(_0x57d2('0x2'));var rp=require(_0x57d2('0x3'));var moment=require(_0x57d2('0x4'));var BPromise=require(_0x57d2('0x5'));var Mustache=require(_0x57d2('0x6'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x57d2('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x57d2('0x8'));var squel=require(_0x57d2('0x9'));var crypto=require(_0x57d2('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x57d2('0xb'));var querystring=require('querystring');var Papa=require(_0x57d2('0xc'));var Redis=require(_0x57d2('0xd'));var authService=require(_0x57d2('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x57d2('0xf'));var hardwareService=require(_0x57d2('0x10'));var logger=require(_0x57d2('0x11'))(_0x57d2('0x12'));var utils=require(_0x57d2('0x13'));var config=require(_0x57d2('0x14'));var licenseUtil=require(_0x57d2('0x15'));var db=require(_0x57d2('0x16'))['db'];config[_0x57d2('0x17')]=_[_0x57d2('0x18')](config[_0x57d2('0x17')],{'host':_0x57d2('0x19'),'port':0x18eb});var socket=require(_0x57d2('0x1a'))(new Redis(config[_0x57d2('0x17')]));require(_0x57d2('0x1b'))[_0x57d2('0x1c')](socket);function respondWithStatusCode(_0x5382d9,_0x5b940e){_0x5b940e=_0x5b940e||0xcc;return function(_0x6fad35){if(_0x6fad35){return _0x5382d9[_0x57d2('0x1d')](_0x5b940e);}return _0x5382d9['status'](_0x5b940e)[_0x57d2('0x1e')]();};}function respondWithResult(_0x319489,_0x4bb8f7){_0x4bb8f7=_0x4bb8f7||0xc8;return function(_0x3e12c6){if(_0x3e12c6){return _0x319489['status'](_0x4bb8f7)[_0x57d2('0x1f')](_0x3e12c6);}};}function respondWithFilteredResult(_0x4b4fe0,_0x2ab5f0){return function(_0x7d4cf1){if(_0x7d4cf1){var _0x2ecfdf=typeof _0x2ab5f0['offset']==='undefined'&&typeof _0x2ab5f0[_0x57d2('0x20')]===_0x57d2('0x21');var _0x2662cd=_0x7d4cf1[_0x57d2('0x22')];var _0x5b1b9d=_0x2ecfdf?0x0:_0x2ab5f0[_0x57d2('0x23')];var _0xcf924f=_0x2ecfdf?_0x7d4cf1['count']:_0x2ab5f0['offset']+_0x2ab5f0[_0x57d2('0x20')];var _0x326d49;if(_0xcf924f>=_0x2662cd){_0xcf924f=_0x2662cd;_0x326d49=0xc8;}else{_0x326d49=0xce;}_0x4b4fe0[_0x57d2('0x24')](_0x326d49);return _0x4b4fe0[_0x57d2('0x25')](_0x57d2('0x26'),_0x5b1b9d+'-'+_0xcf924f+'/'+_0x2662cd)[_0x57d2('0x1f')](_0x7d4cf1);}return null;};}function patchUpdates(_0x32c7c8){return function(_0x31d2cf){try{jsonpatch[_0x57d2('0x27')](_0x31d2cf,_0x32c7c8,!![]);}catch(_0x26718e){return BPromise[_0x57d2('0x28')](_0x26718e);}return _0x31d2cf[_0x57d2('0x29')]();};}function saveUpdates(_0x12ff19,_0x473df2){return function(_0x5327ea){if(_0x5327ea){return _0x5327ea[_0x57d2('0x2a')](_0x12ff19)[_0x57d2('0x2b')](function(_0x3c7de8){return _0x3c7de8;});}return null;};}function removeEntity(_0x452d5e,_0x4363b3){return function(_0x5058be){if(_0x5058be){return _0x5058be[_0x57d2('0x2c')]()[_0x57d2('0x2b')](function(){var _0x995928=_0x5058be[_0x57d2('0x2d')]({'plain':!![]});var _0x18d500=_0x57d2('0x2e');return db[_0x57d2('0x2f')]['destroy']({'where':{'type':_0x18d500,'resourceId':_0x995928['id']}})[_0x57d2('0x2b')](function(){return _0x5058be;});})[_0x57d2('0x2b')](function(){_0x452d5e[_0x57d2('0x24')](0xcc)[_0x57d2('0x1e')]();});}};}function handleEntityNotFound(_0x1957a6,_0x7c33f3){return function(_0x1dd6cb){if(!_0x1dd6cb){_0x1957a6[_0x57d2('0x1d')](0x194);}return _0x1dd6cb;};}function handleError(_0x1d2bdb,_0x2cf9d9){_0x2cf9d9=_0x2cf9d9||0x1f4;return function(_0x574589){logger[_0x57d2('0x30')](_0x574589[_0x57d2('0x31')]);if(_0x574589[_0x57d2('0x32')]){delete _0x574589[_0x57d2('0x32')];}_0x1d2bdb['status'](_0x2cf9d9)[_0x57d2('0x33')](_0x574589);};}exports[_0x57d2('0x34')]=function(_0x21152e,_0x290c2d){var _0xb3051c={},_0x40f3f2={},_0x3cbc4b={'count':0x0,'rows':[]};var _0x36c0d7=_[_0x57d2('0x35')](db['VoicePrefix'][_0x57d2('0x36')],function(_0x213c99){return{'name':_0x213c99['fieldName'],'type':_0x213c99[_0x57d2('0x37')][_0x57d2('0x38')]};});_0x40f3f2['model']=_[_0x57d2('0x35')](_0x36c0d7,_0x57d2('0x32'));_0x40f3f2[_0x57d2('0x39')]=_[_0x57d2('0x3a')](_0x21152e[_0x57d2('0x39')]);_0x40f3f2['filters']=_['intersection'](_0x40f3f2['model'],_0x40f3f2['query']);_0xb3051c[_0x57d2('0x3b')]=_[_0x57d2('0x3c')](_0x40f3f2[_0x57d2('0x3d')],qs[_0x57d2('0x3e')](_0x21152e[_0x57d2('0x39')]['fields']));_0xb3051c[_0x57d2('0x3b')]=_0xb3051c['attributes'][_0x57d2('0x3f')]?_0xb3051c[_0x57d2('0x3b')]:_0x40f3f2[_0x57d2('0x3d')];if(!_0x21152e['query'][_0x57d2('0x40')](_0x57d2('0x41'))){_0xb3051c['limit']=qs[_0x57d2('0x20')](_0x21152e[_0x57d2('0x39')][_0x57d2('0x20')]);_0xb3051c[_0x57d2('0x23')]=qs[_0x57d2('0x23')](_0x21152e[_0x57d2('0x39')]['offset']);}_0xb3051c[_0x57d2('0x42')]=qs['sort'](_0x21152e[_0x57d2('0x39')][_0x57d2('0x43')]);_0xb3051c[_0x57d2('0x44')]=qs[_0x57d2('0x45')](_[_0x57d2('0x46')](_0x21152e['query'],_0x40f3f2[_0x57d2('0x45')]),_0x36c0d7);if(_0x21152e[_0x57d2('0x39')]['filter']){_0xb3051c[_0x57d2('0x44')]=_[_0x57d2('0x47')](_0xb3051c[_0x57d2('0x44')],{'$or':_['map'](_0x36c0d7,function(_0x226e56){if(_0x226e56[_0x57d2('0x37')]!==_0x57d2('0x48')){var _0x3281c9={};_0x3281c9[_0x226e56['name']]={'$like':'%'+_0x21152e['query'][_0x57d2('0x49')]+'%'};return _0x3281c9;}})});}_0xb3051c=_[_0x57d2('0x47')]({},_0xb3051c,_0x21152e[_0x57d2('0x4a')]);var _0x5795e7={'where':_0xb3051c['where']};return db[_0x57d2('0x4b')]['count'](_0x5795e7)[_0x57d2('0x2b')](function(_0x1bb8ad){_0x3cbc4b[_0x57d2('0x22')]=_0x1bb8ad;if(_0x21152e[_0x57d2('0x39')][_0x57d2('0x4c')]){_0xb3051c['include']=[{'all':!![]}];}return db[_0x57d2('0x4b')][_0x57d2('0x4d')](_0xb3051c);})['then'](function(_0x775f8c){_0x3cbc4b['rows']=_0x775f8c;return _0x3cbc4b;})[_0x57d2('0x2b')](respondWithFilteredResult(_0x290c2d,_0xb3051c))[_0x57d2('0x4e')](handleError(_0x290c2d,null));};exports[_0x57d2('0x4f')]=function(_0x323273,_0x58aa4e){var _0x541772={'raw':![],'where':{'id':_0x323273['params']['id']}},_0x3d8256={};_0x3d8256['model']=_[_0x57d2('0x3a')](db['VoicePrefix']['rawAttributes']);_0x3d8256[_0x57d2('0x39')]=_['keys'](_0x323273[_0x57d2('0x39')]);_0x3d8256['filters']=_[_0x57d2('0x3c')](_0x3d8256['model'],_0x3d8256['query']);_0x541772[_0x57d2('0x3b')]=_[_0x57d2('0x3c')](_0x3d8256[_0x57d2('0x3d')],qs[_0x57d2('0x3e')](_0x323273[_0x57d2('0x39')][_0x57d2('0x3e')]));_0x541772['attributes']=_0x541772[_0x57d2('0x3b')][_0x57d2('0x3f')]?_0x541772[_0x57d2('0x3b')]:_0x3d8256[_0x57d2('0x3d')];if(_0x323273[_0x57d2('0x39')][_0x57d2('0x4c')]){_0x541772[_0x57d2('0x50')]=[{'all':!![]}];}_0x541772=_[_0x57d2('0x47')]({},_0x541772,_0x323273['options']);return db[_0x57d2('0x4b')][_0x57d2('0x51')](_0x541772)['then'](handleEntityNotFound(_0x58aa4e,null))[_0x57d2('0x2b')](respondWithResult(_0x58aa4e,null))['catch'](handleError(_0x58aa4e,null));};exports['destroy']=function(_0x1a1dc7,_0x31f404){return db[_0x57d2('0x4b')][_0x57d2('0x51')]({'where':{'id':_0x1a1dc7['params']['id']}})[_0x57d2('0x2b')](handleEntityNotFound(_0x31f404,null))[_0x57d2('0x2b')](removeEntity(_0x31f404,null))['catch'](handleError(_0x31f404,null));};exports['describe']=function(_0xd7c79f,_0xb02f43){return db[_0x57d2('0x4b')][_0x57d2('0x52')]()[_0x57d2('0x2b')](respondWithResult(_0xb02f43,null))[_0x57d2('0x4e')](handleError(_0xb02f43,null));};exports['create']=function(_0x4b377f,_0x5a5edb){var _0x30482c;return db['sequelize'][_0x57d2('0x53')](function(_0x2ef710){return db['VoicePrefix'][_0x57d2('0x54')](_0x4b377f[_0x57d2('0x55')],{'transaction':_0x2ef710})[_0x57d2('0x2b')](function(_0x557f79){_0x30482c=_0x557f79[_0x57d2('0x2d')]({'plain':!![]});return db[_0x57d2('0x56')][_0x57d2('0x51')]({'where':{'id':_0x30482c[_0x57d2('0x57')]},'raw':!![]})[_0x57d2('0x2b')](function(_0x2e90eb){return createVoicePrefixExtensions(_0x30482c,_0x2e90eb,_0x2ef710);});});})[_0x57d2('0x2b')](function(){var _0x2b93c4=_0x4b377f[_0x57d2('0x58')]['get']({'plain':!![]});if(!_0x2b93c4)throw new Error(_0x57d2('0x59'));if(_0x2b93c4[_0x57d2('0x5a')]===_0x57d2('0x58')){var _0x5e3289=_0x30482c;return db[_0x57d2('0x5b')][_0x57d2('0x51')]({'where':{'name':_0x57d2('0x2e'),'userProfileId':_0x2b93c4['userProfileId']},'raw':!![]})['then'](function(_0x56ddfd){if(_0x56ddfd&&_0x56ddfd[_0x57d2('0x5c')]===0x0){return db['UserProfileResource'][_0x57d2('0x54')]({'name':_0x5e3289['name'],'resourceId':_0x5e3289['id'],'type':_0x56ddfd[_0x57d2('0x32')],'sectionId':_0x56ddfd['id']},{})['then'](function(){return _0x30482c;});}else{return _0x30482c;}})[_0x57d2('0x4e')](function(_0x430f85){logger[_0x57d2('0x30')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x430f85);throw _0x430f85;});}return _0x30482c;})['then'](respondWithResult(_0x5a5edb,null))[_0x57d2('0x4e')](handleError(_0x5a5edb,null));};function Extension(_0x2c1710,_0x3b57fa,_0x227a02,_0x3e5d71){this[_0x57d2('0x5d')]='from-sip';this['exten']=_0x2c1710;this[_0x57d2('0x5e')]=_0x227a02;this[_0x57d2('0x37')]=_0x57d2('0x5f');this[_0x57d2('0x60')]='Voice\x20Prefix\x20Extension';this['priority']=_0x3b57fa;this[_0x57d2('0x61')]=_0x3e5d71;}function createVoicePrefixExtensions(_0x301e43,_0x4f6b8a,_0xad397){return new BPromise(function(_0x28fcdb,_0x15e3b6){var _0x472e5d=new Extension(formatPrefixName(_0x301e43['prefix']),0x1,'NoOp','Voice\x20Prefix');_0x472e5d['VoicePrefixId']=_0x301e43['id'];return db[_0x57d2('0x56')][_0x57d2('0x54')](_0x472e5d,{'transaction':_0xad397})[_0x57d2('0x2b')](function(_0xa57b70){var _0xd13626=_0xa57b70[_0x57d2('0x2d')]({'plain':!![]});var _0x2737ab=_['map'](addVoicePrefixExtensions(_0x301e43,_0x4f6b8a),function(_0x35808a){_0x35808a['VoiceExtensionId']=_0xd13626['id'];_0x35808a[_0x57d2('0x62')]=_0x301e43['id'];return _0x35808a;});return db['VoiceExtension'][_0x57d2('0x63')](_0x2737ab,{'transaction':_0xad397})[_0x57d2('0x2b')](function(_0x453e6c){if(!_0x453e6c){return _0x15e3b6(_0x57d2('0x64'));}else{return _0x28fcdb(_0x453e6c);}})[_0x57d2('0x4e')](function(_0x145370){return _0x15e3b6(_0x145370);});});;});};function addVoicePrefixExtensions(_0x5e697c,_0x2a481c){var _0x24d3bf=[];var _0x27b27a=formatPrefixName(_0x5e697c[_0x57d2('0x65')]);_0x24d3bf[_0x57d2('0x66')](new Extension(_0x27b27a,0x2,_0x57d2('0x67'),_0x57d2('0x68')+_0x5e697c[_0x57d2('0x32')]));if(_0x5e697c[_0x57d2('0x69')]){_0x24d3bf['push'](new Extension(_0x27b27a,0x3,_0x57d2('0x67'),'PREFIX-CALLERIDALL='+_0x5e697c['callerIdAll']));}else{_0x24d3bf['push'](new Extension(_0x27b27a,0x3,_0x57d2('0x6a'),'No\x20callerid\x20available'));}_0x24d3bf[_0x57d2('0x66')](new Extension(_0x27b27a,0x4,_0x57d2('0x6b'),_0x2a481c['context']+','+_0x57d2('0x6c')+(0x8+_0x5e697c[_0x57d2('0x32')][_0x57d2('0x3f')])+'}'+','+0x1));return _0x24d3bf;}function formatPrefixName(_0x13741f){var _0x5eb7a3='_';for(var _0x3afeb9=0x0;_0x3afeb9<_0x13741f[_0x57d2('0x3f')];_0x3afeb9++){if(_0x13741f['charAt'](_0x3afeb9)=='-'){_0x5eb7a3+=_0x13741f['charAt'](_0x3afeb9);}else{_0x5eb7a3+='['+_0x13741f[_0x57d2('0x6d')](_0x3afeb9)+']';}}_0x5eb7a3+='.';return _0x5eb7a3;}exports[_0x57d2('0x2a')]=function(_0x481c6b,_0x46c7de,_0x5a1283){var _0x360ee0=_0x481c6b[_0x57d2('0x55')];_0x360ee0[_0x57d2('0x65')]=_0x57d2('0x6e')+_0x360ee0[_0x57d2('0x32')]+'-';return db[_0x57d2('0x6f')][_0x57d2('0x53')](function(_0x3bec6f){return db[_0x57d2('0x4b')][_0x57d2('0x2a')](_0x360ee0,{'where':{'id':_0x360ee0['id']},'transaction':_0x3bec6f})[_0x57d2('0x2b')](function(){return db['VoiceExtension'][_0x57d2('0x2c')]({'where':{'VoicePrefixId':_0x360ee0['id']},'transaction':_0x3bec6f})[_0x57d2('0x2b')](function(){return db[_0x57d2('0x56')][_0x57d2('0x51')]({'where':{'id':_0x360ee0[_0x57d2('0x57')]},'raw':!![]})[_0x57d2('0x2b')](function(_0x42666b){return createVoicePrefixExtensions(_0x360ee0,_0x42666b,_0x3bec6f);});});});})[_0x57d2('0x2b')](function(){return db[_0x57d2('0x4b')][_0x57d2('0x70')](_0x360ee0['id']);})[_0x57d2('0x2b')](respondWithResult(_0x46c7de,null))[_0x57d2('0x4e')](handleError(_0x46c7de,null));};exports[_0x57d2('0x71')]=function(_0x26da1b,_0x1bf74a,_0x144229){return db['VoicePrefix'][_0x57d2('0x51')]({'where':{'id':_0x26da1b[_0x57d2('0x72')]['id']}})['then'](handleEntityNotFound(_0x1bf74a,null))[_0x57d2('0x2b')](function(_0x17b3c1){if(_0x17b3c1){return _0x17b3c1[_0x57d2('0x71')](_0x26da1b[_0x57d2('0x55')]['ids'],_[_0x57d2('0x73')](_0x26da1b['body'],['ids','id'])||{})[_0x57d2('0x74')](function(_0x4f30e8){for(var _0x282457=0x0;_0x282457<_0x26da1b[_0x57d2('0x55')][_0x57d2('0x75')][_0x57d2('0x3f')];_0x282457+=0x1){socket['emit'](_0x57d2('0x76'),{'UserId':Number(_0x26da1b[_0x57d2('0x55')][_0x57d2('0x75')][_0x282457]),'VoicePrefixId':Number(_0x26da1b[_0x57d2('0x72')]['id'])});}return _0x4f30e8;});}})[_0x57d2('0x2b')](respondWithResult(_0x1bf74a,null))[_0x57d2('0x4e')](handleError(_0x1bf74a,null));};exports[_0x57d2('0x77')]=function(_0x41ca89,_0x1d147f,_0x261850){return db['VoicePrefix'][_0x57d2('0x51')]({'where':{'id':_0x41ca89[_0x57d2('0x72')]['id']}})[_0x57d2('0x2b')](handleEntityNotFound(_0x1d147f,null))[_0x57d2('0x2b')](function(_0x468990){if(_0x468990){return _0x468990[_0x57d2('0x77')](_0x41ca89[_0x57d2('0x39')][_0x57d2('0x75')])[_0x57d2('0x2b')](function(){if(_[_0x57d2('0x78')](_0x41ca89[_0x57d2('0x39')][_0x57d2('0x75')])){for(var _0x54edaf=0x0;_0x54edaf<_0x41ca89['query'][_0x57d2('0x75')][_0x57d2('0x3f')];_0x54edaf+=0x1){socket[_0x57d2('0x79')](_0x57d2('0x7a'),{'UserId':Number(_0x41ca89[_0x57d2('0x39')]['ids'][_0x54edaf]),'VoicePrefixId':Number(_0x41ca89['params']['id'])});}}else{socket[_0x57d2('0x79')](_0x57d2('0x7a'),{'UserId':Number(_0x41ca89[_0x57d2('0x39')][_0x57d2('0x75')]),'VoicePrefixId':Number(_0x41ca89[_0x57d2('0x72')]['id'])});}});}})[_0x57d2('0x2b')](respondWithStatusCode(_0x1d147f,null))['catch'](handleError(_0x1d147f,null));};exports[_0x57d2('0x7b')]=function(_0x2f5625,_0x5bb7cd,_0x4913c0){var _0x5ac6ee={};var _0x5b3cc6={};var _0xa557d6;var _0x4a7e00;return db[_0x57d2('0x4b')]['findOne']({'where':{'id':_0x2f5625[_0x57d2('0x72')]['id']}})[_0x57d2('0x2b')](handleEntityNotFound(_0x5bb7cd,null))[_0x57d2('0x2b')](function(_0x1dbe31){if(_0x1dbe31){_0xa557d6=_0x1dbe31;_0x5b3cc6[_0x57d2('0x3d')]=_['keys'](db[_0x57d2('0x7c')][_0x57d2('0x36')]);_0x5b3cc6[_0x57d2('0x39')]=_['keys'](_0x2f5625[_0x57d2('0x39')]);_0x5b3cc6[_0x57d2('0x45')]=_[_0x57d2('0x3c')](_0x5b3cc6[_0x57d2('0x3d')],_0x5b3cc6[_0x57d2('0x39')]);_0x5ac6ee[_0x57d2('0x3b')]=_[_0x57d2('0x3c')](_0x5b3cc6['model'],qs['fields'](_0x2f5625['query'][_0x57d2('0x3e')]));_0x5ac6ee[_0x57d2('0x3b')]=_0x5ac6ee[_0x57d2('0x3b')]['length']?_0x5ac6ee[_0x57d2('0x3b')]:_0x5b3cc6[_0x57d2('0x3d')];_0x5ac6ee[_0x57d2('0x42')]=qs[_0x57d2('0x43')](_0x2f5625[_0x57d2('0x39')][_0x57d2('0x43')]);_0x5ac6ee[_0x57d2('0x44')]=qs[_0x57d2('0x45')](_['pick'](_0x2f5625[_0x57d2('0x39')],_0x5b3cc6[_0x57d2('0x45')]));if(_0x2f5625[_0x57d2('0x39')][_0x57d2('0x49')]){_0x5ac6ee['where']=_['merge'](_0x5ac6ee[_0x57d2('0x44')],{'$or':_['map'](_0x5ac6ee[_0x57d2('0x3b')],function(_0x598d62){var _0x3a35d7={};_0x3a35d7[_0x598d62]={'$like':'%'+_0x2f5625[_0x57d2('0x39')][_0x57d2('0x49')]+'%'};return _0x3a35d7;})});}_0x5ac6ee=_['merge']({},_0x5ac6ee,_0x2f5625[_0x57d2('0x4a')]);return _0xa557d6['getAgents'](_0x5ac6ee);}})[_0x57d2('0x2b')](function(_0xe71357){if(_0xe71357){_0x4a7e00=_0xe71357[_0x57d2('0x3f')];if(!_0x2f5625[_0x57d2('0x39')][_0x57d2('0x40')](_0x57d2('0x41'))){_0x5ac6ee[_0x57d2('0x20')]=qs[_0x57d2('0x20')](_0x2f5625[_0x57d2('0x39')][_0x57d2('0x20')]);_0x5ac6ee[_0x57d2('0x23')]=qs[_0x57d2('0x23')](_0x2f5625[_0x57d2('0x39')][_0x57d2('0x23')]);}return _0xa557d6[_0x57d2('0x7b')](_0x5ac6ee);}})['then'](function(_0x3a7d89){if(_0x3a7d89){return _0x3a7d89?{'count':_0x4a7e00,'rows':_0x3a7d89}:null;}})[_0x57d2('0x2b')](respondWithResult(_0x5bb7cd,null))[_0x57d2('0x4e')](handleError(_0x5bb7cd,null));};exports[_0x57d2('0x7d')]=function(_0x4d83cf,_0x93bc52,_0x362b77){var _0x2728ba={};var _0x4f6585={};var _0x34f39a;var _0x1a90cb;return db[_0x57d2('0x4b')][_0x57d2('0x7e')]({'where':{'id':_0x4d83cf[_0x57d2('0x72')]['id']}})[_0x57d2('0x2b')](handleEntityNotFound(_0x93bc52,null))[_0x57d2('0x2b')](function(_0x1ba236){if(_0x1ba236){_0x34f39a=_0x1ba236;_0x4f6585[_0x57d2('0x3d')]=_[_0x57d2('0x3a')](db['Team']['rawAttributes']);_0x4f6585[_0x57d2('0x39')]=_[_0x57d2('0x3a')](_0x4d83cf[_0x57d2('0x39')]);_0x4f6585[_0x57d2('0x45')]=_['intersection'](_0x4f6585[_0x57d2('0x3d')],_0x4f6585[_0x57d2('0x39')]);_0x2728ba[_0x57d2('0x3b')]=_[_0x57d2('0x3c')](_0x4f6585[_0x57d2('0x3d')],qs['fields'](_0x4d83cf['query']['fields']));_0x2728ba['attributes']=_0x2728ba['attributes'][_0x57d2('0x3f')]?_0x2728ba['attributes']:_0x4f6585[_0x57d2('0x3d')];_0x2728ba[_0x57d2('0x42')]=qs['sort'](_0x4d83cf[_0x57d2('0x39')]['sort']);_0x2728ba[_0x57d2('0x44')]=qs[_0x57d2('0x45')](_[_0x57d2('0x46')](_0x4d83cf[_0x57d2('0x39')],_0x4f6585['filters']));if(_0x4d83cf[_0x57d2('0x39')]['filter']){_0x2728ba['where']=_[_0x57d2('0x47')](_0x2728ba[_0x57d2('0x44')],{'$or':_[_0x57d2('0x35')](_0x2728ba[_0x57d2('0x3b')],function(_0x127224){var _0x47ee55={};_0x47ee55[_0x127224]={'$like':'%'+_0x4d83cf[_0x57d2('0x39')][_0x57d2('0x49')]+'%'};return _0x47ee55;})});}_0x2728ba=_[_0x57d2('0x47')]({},_0x2728ba,_0x4d83cf[_0x57d2('0x4a')]);return _0x34f39a[_0x57d2('0x7d')](_0x2728ba);}})[_0x57d2('0x2b')](function(_0x4773a4){if(_0x4773a4){_0x1a90cb=_0x4773a4[_0x57d2('0x3f')];if(!_0x4d83cf['query']['hasOwnProperty'](_0x57d2('0x41'))){_0x2728ba['limit']=qs[_0x57d2('0x20')](_0x4d83cf[_0x57d2('0x39')][_0x57d2('0x20')]);_0x2728ba[_0x57d2('0x23')]=qs[_0x57d2('0x23')](_0x4d83cf['query'][_0x57d2('0x23')]);}return _0x34f39a['getTeams'](_0x2728ba);}})[_0x57d2('0x2b')](function(_0x888a75){if(_0x888a75){return _0x888a75?{'count':_0x1a90cb,'rows':_0x888a75}:null;}})[_0x57d2('0x2b')](respondWithResult(_0x93bc52,null))[_0x57d2('0x4e')](handleError(_0x93bc52,null));};exports[_0x57d2('0x7f')]=function(_0x37608b,_0x5cb4b6,_0xa4b4fd){var _0x3c9d18=_0x37608b[_0x57d2('0x55')][_0x57d2('0x75')];var _0x55f7df;return db['Team']['findAll']({'where':{'id':_0x3c9d18},'attributes':['id'],'include':[{'model':db[_0x57d2('0x7c')],'as':_0x57d2('0x80'),'attributes':['id',_0x57d2('0x32'),_0x57d2('0x81'),'voicePause',_0x57d2('0x82')],'raw':!![]}]})[_0x57d2('0x2b')](function(_0x178706){if(_0x178706){_0x55f7df=_0x178706;var _0xa92185=_['flatMap'](_0x178706,function(_0x3865c7){var _0x1d9c66=_0x3865c7[_0x57d2('0x2d')]({'plain':!![]});return _0x1d9c66[_0x57d2('0x80')];});return db['VoicePrefix'][_0x57d2('0x51')]({'where':{'id':_0x37608b['params']['id']}})['then'](function(_0x5a4689){return db[_0x57d2('0x6f')][_0x57d2('0x53')](function(_0x488dcd){return _0x5a4689['addTeams'](_0x3c9d18,{'transaction':_0x488dcd})[_0x57d2('0x2b')](function(){return BPromise[_0x57d2('0x83')](_0x55f7df,function(_0x23a448){return db['TeamVoicePrefix'][_0x57d2('0x84')]({'TeamId':_0x23a448['id'],'VoicePrefixId':_0x37608b[_0x57d2('0x72')]['id']},{'transaction':_0x488dcd});});})[_0x57d2('0x2b')](function(){return BPromise[_0x57d2('0x83')](_0xa92185,function(_0xa269b5){return db['UserVoicePrefix']['findOrCreate']({'where':{'UserId':_0xa269b5['id'],'VoicePrefixId':_0x37608b[_0x57d2('0x72')]['id']},'transaction':_0x488dcd});});})[_0x57d2('0x2b')](function(){_0xa92185[_0x57d2('0x85')](function(_0x434389){socket['emit'](_0x57d2('0x76'),{'UserId':_0x434389['id'],'VoicePrefixId':_0x5a4689['id']});});});});});}})[_0x57d2('0x2b')](respondWithStatusCode(_0x5cb4b6,null))['catch'](handleError(_0x5cb4b6,null));};exports[_0x57d2('0x86')]=function(_0x29b37c,_0x531b42,_0x120e28){return db[_0x57d2('0x87')][_0x57d2('0x4d')]({'where':{'id':_0x29b37c[_0x57d2('0x39')][_0x57d2('0x75')]},'attributes':['id'],'include':[{'model':db[_0x57d2('0x7c')],'as':_0x57d2('0x80'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x531b42,null))[_0x57d2('0x2b')](function(_0x2809c1){var _0x5444bf=_[_0x57d2('0x35')](_0x2809c1,'id');var _0x3da7ba=[];var _0x2fc3b5=[];var _0x41ba89=squel['select']();_0x41ba89[_0x57d2('0x88')]('tq.TeamId')[_0x57d2('0x89')](_0x57d2('0x8a'),'tq')[_0x57d2('0x8b')](_0x57d2('0x8c'),'ut',_0x57d2('0x8d'))[_0x57d2('0x44')](_0x57d2('0x8e'),_0x29b37c[_0x57d2('0x72')]['id']);for(var _0x112218=0x0;_0x112218<_0x2809c1[_0x57d2('0x3f')];_0x112218+=0x1){let _0x57314b=_0x2809c1[_0x112218];for(var _0x3acffd=0x0;_0x3acffd<_0x57314b[_0x57d2('0x80')]['length'];_0x3acffd+=0x1){let _0x447051=_0x57314b[_0x57d2('0x80')][_0x3acffd];var _0x511494=_0x41ba89[_0x57d2('0x8f')]();_0x511494[_0x57d2('0x44')](_0x57d2('0x90'),_0x447051['id']);_0x2fc3b5[_0x57d2('0x66')](db['sequelize'][_0x57d2('0x39')](_0x511494[_0x57d2('0x91')](),{'type':db['sequelize'][_0x57d2('0x92')][_0x57d2('0x93')]})[_0x57d2('0x2b')](function(_0x13aec4){if(_0x13aec4[_0x57d2('0x3f')]===0x1){return _0x447051['id'];}else{var _0x4e3497=_[_0x57d2('0x94')](_[_0x57d2('0x35')](_0x13aec4,'TeamId'),function(_0xb122b9){return _[_0x57d2('0x95')](_0x5444bf,_0xb122b9);});if(_0x4e3497){return _0x447051['id'];}}}));}}return BPromise[_0x57d2('0x96')](_0x2fc3b5)['then'](function(_0xdc5333){_0x3da7ba=_(_0x3da7ba)[_0x57d2('0x97')](_0xdc5333)['compact']()[_0x57d2('0x98')]();return db[_0x57d2('0x4b')][_0x57d2('0x51')]({'where':{'id':_0x29b37c[_0x57d2('0x72')]['id']}})[_0x57d2('0x2b')](function(_0x456ed3){return db['sequelize'][_0x57d2('0x53')](function(_0x376cea){return _0x456ed3[_0x57d2('0x86')](_0x29b37c[_0x57d2('0x39')][_0x57d2('0x75')],{'transaction':_0x376cea})[_0x57d2('0x2b')](function(){if(!_[_0x57d2('0x99')](_0x3da7ba)){return _0x456ed3[_0x57d2('0x77')](_0x3da7ba,{'transaction':_0x376cea});}})[_0x57d2('0x2b')](function(){_0x3da7ba['forEach'](function(_0x5b7f18){socket[_0x57d2('0x79')]('userVoicePrefix:remove',{'UserId':_0x5b7f18,'VoicePrefixId':_0x456ed3['id']});});});});});});})[_0x57d2('0x2b')](respondWithStatusCode(_0x531b42,null))['catch'](handleError(_0x531b42,null));}; \ No newline at end of file +var _0xb9be=['addAgents','emit','userVoicePrefix:save','ids','isArray','userVoicePrefix:remove','getAgents','findOne','order','Team','pick','getTeams','addTeams','Agents','online','voicePause','interface','flatMap','each','TeamVoicePrefix','UserVoicePrefix','findOrCreate','forEach','removeTeams','User','select','field','tq.TeamId','team_has_voice_prefixes','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','VoicePrefixId\x20=\x20?','clone','ut.UserId\x20=\x20?','toString','SELECT','every','TeamId','union','compact','value','isEmpty','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','./voicePrefix.socket','register','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','destroy','get','VoicePrefixes','error','name','index','map','VoicePrefix','rawAttributes','fieldName','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filters','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','show','params','find','catch','create','sequelize','transaction','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','context','from-sip','app','system','description','Voice\x20Prefix\x20Extension','priority','appdata','NoOp','VoicePrefixId','VoiceExtension','bulkCreate','prefix','push','CDR(prefix)=','Set','PREFIX-CALLERIDALL=','callerIdAll','No\x20callerid\x20available','goto','${EXTEN:','charAt','system-'];(function(_0x3fd073,_0x32931f){var _0x40d7b1=function(_0x379467){while(--_0x379467){_0x3fd073['push'](_0x3fd073['shift']());}};_0x40d7b1(++_0x32931f);}(_0xb9be,0xc5));var _0xeb9b=function(_0x289e64,_0x5adb3c){_0x289e64=_0x289e64-0x0;var _0x30246c=_0xb9be[_0x289e64];return _0x30246c;};'use strict';var emlformat=require(_0xeb9b('0x0'));var rimraf=require(_0xeb9b('0x1'));var zipdir=require(_0xeb9b('0x2'));var jsonpatch=require(_0xeb9b('0x3'));var rp=require(_0xeb9b('0x4'));var moment=require(_0xeb9b('0x5'));var BPromise=require(_0xeb9b('0x6'));var Mustache=require(_0xeb9b('0x7'));var util=require(_0xeb9b('0x8'));var path=require('path');var sox=require('sox');var csv=require(_0xeb9b('0x9'));var ejs=require(_0xeb9b('0xa'));var fs=require('fs');var fs_extra=require(_0xeb9b('0xb'));var _=require('lodash');var squel=require(_0xeb9b('0xc'));var crypto=require(_0xeb9b('0xd'));var jsforce=require(_0xeb9b('0xe'));var deskjs=require(_0xeb9b('0xf'));var toCsv=require(_0xeb9b('0x9'));var querystring=require(_0xeb9b('0x10'));var Papa=require(_0xeb9b('0x11'));var Redis=require(_0xeb9b('0x12'));var authService=require(_0xeb9b('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xeb9b('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xeb9b('0x15'));var utils=require(_0xeb9b('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xeb9b('0x17'));var db=require(_0xeb9b('0x18'))['db'];config[_0xeb9b('0x19')]=_[_0xeb9b('0x1a')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xeb9b('0x19')]));require(_0xeb9b('0x1b'))[_0xeb9b('0x1c')](socket);function respondWithStatusCode(_0x4ec46d,_0x5926e1){_0x5926e1=_0x5926e1||0xcc;return function(_0x4f8182){if(_0x4f8182){return _0x4ec46d[_0xeb9b('0x1d')](_0x5926e1);}return _0x4ec46d[_0xeb9b('0x1e')](_0x5926e1)[_0xeb9b('0x1f')]();};}function respondWithResult(_0x3fa308,_0x2c9aa6){_0x2c9aa6=_0x2c9aa6||0xc8;return function(_0x10da6e){if(_0x10da6e){return _0x3fa308[_0xeb9b('0x1e')](_0x2c9aa6)['json'](_0x10da6e);}};}function respondWithFilteredResult(_0x2e8645,_0x36e871){return function(_0x21aca6){if(_0x21aca6){var _0x3a11e3=typeof _0x36e871[_0xeb9b('0x20')]===_0xeb9b('0x21')&&typeof _0x36e871[_0xeb9b('0x22')]===_0xeb9b('0x21');var _0x2c199f=_0x21aca6[_0xeb9b('0x23')];var _0x4f436e=_0x3a11e3?0x0:_0x36e871[_0xeb9b('0x20')];var _0x5a7ffd=_0x3a11e3?_0x21aca6['count']:_0x36e871[_0xeb9b('0x20')]+_0x36e871[_0xeb9b('0x22')];var _0x4ab4b8;if(_0x5a7ffd>=_0x2c199f){_0x5a7ffd=_0x2c199f;_0x4ab4b8=0xc8;}else{_0x4ab4b8=0xce;}_0x2e8645[_0xeb9b('0x1e')](_0x4ab4b8);return _0x2e8645[_0xeb9b('0x24')](_0xeb9b('0x25'),_0x4f436e+'-'+_0x5a7ffd+'/'+_0x2c199f)[_0xeb9b('0x26')](_0x21aca6);}return null;};}function patchUpdates(_0x3c8be7){return function(_0x43dab8){try{jsonpatch[_0xeb9b('0x27')](_0x43dab8,_0x3c8be7,!![]);}catch(_0x15e5b8){return BPromise[_0xeb9b('0x28')](_0x15e5b8);}return _0x43dab8[_0xeb9b('0x29')]();};}function saveUpdates(_0x61c86d,_0x296f95){return function(_0x1a4faf){if(_0x1a4faf){return _0x1a4faf[_0xeb9b('0x2a')](_0x61c86d)[_0xeb9b('0x2b')](function(_0x434461){return _0x434461;});}return null;};}function removeEntity(_0x4c997e,_0xd57390){return function(_0x4ed960){if(_0x4ed960){return _0x4ed960[_0xeb9b('0x2c')]()['then'](function(){var _0x347ec1=_0x4ed960[_0xeb9b('0x2d')]({'plain':!![]});var _0x7e0134=_0xeb9b('0x2e');return db['UserProfileResource'][_0xeb9b('0x2c')]({'where':{'type':_0x7e0134,'resourceId':_0x347ec1['id']}})[_0xeb9b('0x2b')](function(){return _0x4ed960;});})['then'](function(){_0x4c997e[_0xeb9b('0x1e')](0xcc)[_0xeb9b('0x1f')]();});}};}function handleEntityNotFound(_0x5ce745,_0x2a4b51){return function(_0x2ea20f){if(!_0x2ea20f){_0x5ce745[_0xeb9b('0x1d')](0x194);}return _0x2ea20f;};}function handleError(_0x48c5f4,_0x309bad){_0x309bad=_0x309bad||0x1f4;return function(_0x5336f2){logger[_0xeb9b('0x2f')](_0x5336f2['stack']);if(_0x5336f2[_0xeb9b('0x30')]){delete _0x5336f2['name'];}_0x48c5f4[_0xeb9b('0x1e')](_0x309bad)['send'](_0x5336f2);};}exports[_0xeb9b('0x31')]=function(_0x4c8e4c,_0x25b8da){var _0x370dbe={},_0x20e577={},_0x2e6034={'count':0x0,'rows':[]};var _0x112129=_[_0xeb9b('0x32')](db[_0xeb9b('0x33')][_0xeb9b('0x34')],function(_0x41e6c4){return{'name':_0x41e6c4[_0xeb9b('0x35')],'type':_0x41e6c4['type'][_0xeb9b('0x36')]};});_0x20e577[_0xeb9b('0x37')]=_[_0xeb9b('0x32')](_0x112129,_0xeb9b('0x30'));_0x20e577[_0xeb9b('0x38')]=_[_0xeb9b('0x39')](_0x4c8e4c[_0xeb9b('0x38')]);_0x20e577['filters']=_[_0xeb9b('0x3a')](_0x20e577[_0xeb9b('0x37')],_0x20e577[_0xeb9b('0x38')]);_0x370dbe['attributes']=_[_0xeb9b('0x3a')](_0x20e577[_0xeb9b('0x37')],qs[_0xeb9b('0x3b')](_0x4c8e4c[_0xeb9b('0x38')][_0xeb9b('0x3b')]));_0x370dbe[_0xeb9b('0x3c')]=_0x370dbe['attributes'][_0xeb9b('0x3d')]?_0x370dbe[_0xeb9b('0x3c')]:_0x20e577['model'];if(!_0x4c8e4c[_0xeb9b('0x38')][_0xeb9b('0x3e')](_0xeb9b('0x3f'))){_0x370dbe[_0xeb9b('0x22')]=qs[_0xeb9b('0x22')](_0x4c8e4c[_0xeb9b('0x38')][_0xeb9b('0x22')]);_0x370dbe['offset']=qs[_0xeb9b('0x20')](_0x4c8e4c[_0xeb9b('0x38')][_0xeb9b('0x20')]);}_0x370dbe['order']=qs['sort'](_0x4c8e4c['query'][_0xeb9b('0x40')]);_0x370dbe[_0xeb9b('0x41')]=qs[_0xeb9b('0x42')](_['pick'](_0x4c8e4c[_0xeb9b('0x38')],_0x20e577[_0xeb9b('0x42')]),_0x112129);if(_0x4c8e4c[_0xeb9b('0x38')][_0xeb9b('0x43')]){_0x370dbe[_0xeb9b('0x41')]=_[_0xeb9b('0x44')](_0x370dbe[_0xeb9b('0x41')],{'$or':_['map'](_0x112129,function(_0x5e597a){if(_0x5e597a[_0xeb9b('0x45')]!==_0xeb9b('0x46')){var _0x4ee3cd={};_0x4ee3cd[_0x5e597a['name']]={'$like':'%'+_0x4c8e4c[_0xeb9b('0x38')][_0xeb9b('0x43')]+'%'};return _0x4ee3cd;}})});}_0x370dbe=_['merge']({},_0x370dbe,_0x4c8e4c[_0xeb9b('0x47')]);var _0x535e73={'where':_0x370dbe[_0xeb9b('0x41')]};return db[_0xeb9b('0x33')][_0xeb9b('0x23')](_0x535e73)[_0xeb9b('0x2b')](function(_0xbee63e){_0x2e6034[_0xeb9b('0x23')]=_0xbee63e;if(_0x4c8e4c[_0xeb9b('0x38')][_0xeb9b('0x48')]){_0x370dbe[_0xeb9b('0x49')]=[{'all':!![]}];}return db[_0xeb9b('0x33')][_0xeb9b('0x4a')](_0x370dbe);})[_0xeb9b('0x2b')](function(_0x5e270a){_0x2e6034['rows']=_0x5e270a;return _0x2e6034;})[_0xeb9b('0x2b')](respondWithFilteredResult(_0x25b8da,_0x370dbe))['catch'](handleError(_0x25b8da,null));};exports[_0xeb9b('0x4b')]=function(_0x232731,_0x2c00ed){var _0x5eee9b={'raw':![],'where':{'id':_0x232731[_0xeb9b('0x4c')]['id']}},_0x1e2d25={};_0x1e2d25['model']=_[_0xeb9b('0x39')](db[_0xeb9b('0x33')][_0xeb9b('0x34')]);_0x1e2d25[_0xeb9b('0x38')]=_[_0xeb9b('0x39')](_0x232731[_0xeb9b('0x38')]);_0x1e2d25[_0xeb9b('0x42')]=_[_0xeb9b('0x3a')](_0x1e2d25['model'],_0x1e2d25['query']);_0x5eee9b[_0xeb9b('0x3c')]=_['intersection'](_0x1e2d25['model'],qs[_0xeb9b('0x3b')](_0x232731[_0xeb9b('0x38')][_0xeb9b('0x3b')]));_0x5eee9b[_0xeb9b('0x3c')]=_0x5eee9b[_0xeb9b('0x3c')][_0xeb9b('0x3d')]?_0x5eee9b['attributes']:_0x1e2d25['model'];if(_0x232731['query'][_0xeb9b('0x48')]){_0x5eee9b['include']=[{'all':!![]}];}_0x5eee9b=_[_0xeb9b('0x44')]({},_0x5eee9b,_0x232731[_0xeb9b('0x47')]);return db[_0xeb9b('0x33')][_0xeb9b('0x4d')](_0x5eee9b)[_0xeb9b('0x2b')](handleEntityNotFound(_0x2c00ed,null))[_0xeb9b('0x2b')](respondWithResult(_0x2c00ed,null))[_0xeb9b('0x4e')](handleError(_0x2c00ed,null));};exports[_0xeb9b('0x2c')]=function(_0x34755f,_0x28968b){return db['VoicePrefix']['find']({'where':{'id':_0x34755f[_0xeb9b('0x4c')]['id']}})[_0xeb9b('0x2b')](handleEntityNotFound(_0x28968b,null))['then'](removeEntity(_0x28968b,null))[_0xeb9b('0x4e')](handleError(_0x28968b,null));};exports['describe']=function(_0x2ceb23,_0x1f7b31){return db['VoicePrefix']['describe']()['then'](respondWithResult(_0x1f7b31,null))[_0xeb9b('0x4e')](handleError(_0x1f7b31,null));};exports[_0xeb9b('0x4f')]=function(_0x263453,_0x4fe9d0){var _0x4ded40;return db[_0xeb9b('0x50')][_0xeb9b('0x51')](function(_0x3e6e73){return db[_0xeb9b('0x33')][_0xeb9b('0x4f')](_0x263453[_0xeb9b('0x52')],{'transaction':_0x3e6e73})['then'](function(_0x20dbea){_0x4ded40=_0x20dbea[_0xeb9b('0x2d')]({'plain':!![]});return db['VoiceExtension'][_0xeb9b('0x4d')]({'where':{'id':_0x4ded40['VoiceExtensionId']},'raw':!![]})[_0xeb9b('0x2b')](function(_0x12f8d6){return createVoicePrefixExtensions(_0x4ded40,_0x12f8d6,_0x3e6e73);});});})['then'](function(){var _0x396aa9=_0x263453['user'][_0xeb9b('0x2d')]({'plain':!![]});if(!_0x396aa9)throw new Error(_0xeb9b('0x53'));if(_0x396aa9[_0xeb9b('0x54')]===_0xeb9b('0x55')){var _0x5c769e=_0x4ded40;return db['UserProfileSection'][_0xeb9b('0x4d')]({'where':{'name':_0xeb9b('0x2e'),'userProfileId':_0x396aa9[_0xeb9b('0x56')]},'raw':!![]})['then'](function(_0x3126d9){if(_0x3126d9&&_0x3126d9[_0xeb9b('0x57')]===0x0){return db[_0xeb9b('0x58')][_0xeb9b('0x4f')]({'name':_0x5c769e[_0xeb9b('0x30')],'resourceId':_0x5c769e['id'],'type':_0x3126d9[_0xeb9b('0x30')],'sectionId':_0x3126d9['id']},{})[_0xeb9b('0x2b')](function(){return _0x4ded40;});}else{return _0x4ded40;}})[_0xeb9b('0x4e')](function(_0x2f8b0f){logger[_0xeb9b('0x2f')](_0xeb9b('0x59'),_0x2f8b0f);throw _0x2f8b0f;});}return _0x4ded40;})['then'](respondWithResult(_0x4fe9d0,null))['catch'](handleError(_0x4fe9d0,null));};function Extension(_0x4b2506,_0x83d48a,_0x4cf8bf,_0x34ff5f){this[_0xeb9b('0x5a')]=_0xeb9b('0x5b');this['exten']=_0x4b2506;this[_0xeb9b('0x5c')]=_0x4cf8bf;this[_0xeb9b('0x45')]=_0xeb9b('0x5d');this[_0xeb9b('0x5e')]=_0xeb9b('0x5f');this[_0xeb9b('0x60')]=_0x83d48a;this[_0xeb9b('0x61')]=_0x34ff5f;}function createVoicePrefixExtensions(_0x295d81,_0x58a3e2,_0x5b55a6){return new BPromise(function(_0x27a445,_0x37f20c){var _0xa0146b=new Extension(formatPrefixName(_0x295d81['prefix']),0x1,_0xeb9b('0x62'),'Voice\x20Prefix');_0xa0146b[_0xeb9b('0x63')]=_0x295d81['id'];return db['VoiceExtension'][_0xeb9b('0x4f')](_0xa0146b,{'transaction':_0x5b55a6})[_0xeb9b('0x2b')](function(_0x3d223f){var _0x1b2a7a=_0x3d223f[_0xeb9b('0x2d')]({'plain':!![]});var _0x4be938=_[_0xeb9b('0x32')](addVoicePrefixExtensions(_0x295d81,_0x58a3e2),function(_0x1c7569){_0x1c7569['VoiceExtensionId']=_0x1b2a7a['id'];_0x1c7569['VoicePrefixId']=_0x295d81['id'];return _0x1c7569;});return db[_0xeb9b('0x64')][_0xeb9b('0x65')](_0x4be938,{'transaction':_0x5b55a6})['then'](function(_0xeb81b9){if(!_0xeb81b9){return _0x37f20c('Extensions\x20creation\x20failed');}else{return _0x27a445(_0xeb81b9);}})[_0xeb9b('0x4e')](function(_0x515a97){return _0x37f20c(_0x515a97);});});;});};function addVoicePrefixExtensions(_0x36376f,_0x382d3a){var _0x417221=[];var _0x1fea34=formatPrefixName(_0x36376f[_0xeb9b('0x66')]);_0x417221[_0xeb9b('0x67')](new Extension(_0x1fea34,0x2,'Set',_0xeb9b('0x68')+_0x36376f[_0xeb9b('0x30')]));if(_0x36376f['callerIdAll']){_0x417221[_0xeb9b('0x67')](new Extension(_0x1fea34,0x3,_0xeb9b('0x69'),_0xeb9b('0x6a')+_0x36376f[_0xeb9b('0x6b')]));}else{_0x417221['push'](new Extension(_0x1fea34,0x3,_0xeb9b('0x62'),_0xeb9b('0x6c')));}_0x417221['push'](new Extension(_0x1fea34,0x4,_0xeb9b('0x6d'),_0x382d3a[_0xeb9b('0x5a')]+','+_0xeb9b('0x6e')+(0x8+_0x36376f[_0xeb9b('0x30')][_0xeb9b('0x3d')])+'}'+','+0x1));return _0x417221;}function formatPrefixName(_0x48b0ec){var _0x3f9ce0='_';for(var _0x4a48f6=0x0;_0x4a48f6<_0x48b0ec[_0xeb9b('0x3d')];_0x4a48f6++){if(_0x48b0ec[_0xeb9b('0x6f')](_0x4a48f6)=='-'){_0x3f9ce0+=_0x48b0ec['charAt'](_0x4a48f6);}else{_0x3f9ce0+='['+_0x48b0ec[_0xeb9b('0x6f')](_0x4a48f6)+']';}}_0x3f9ce0+='.';return _0x3f9ce0;}exports[_0xeb9b('0x2a')]=function(_0x2fb07e,_0x25398e,_0x51de75){var _0xb0080f=_0x2fb07e[_0xeb9b('0x52')];_0xb0080f[_0xeb9b('0x66')]=_0xeb9b('0x70')+_0xb0080f[_0xeb9b('0x30')]+'-';return db[_0xeb9b('0x50')][_0xeb9b('0x51')](function(_0x3836bd){return db[_0xeb9b('0x33')][_0xeb9b('0x2a')](_0xb0080f,{'where':{'id':_0xb0080f['id']},'transaction':_0x3836bd})[_0xeb9b('0x2b')](function(){return db[_0xeb9b('0x64')][_0xeb9b('0x2c')]({'where':{'VoicePrefixId':_0xb0080f['id']},'transaction':_0x3836bd})[_0xeb9b('0x2b')](function(){return db[_0xeb9b('0x64')][_0xeb9b('0x4d')]({'where':{'id':_0xb0080f['VoiceExtensionId']},'raw':!![]})[_0xeb9b('0x2b')](function(_0x3e4ef2){return createVoicePrefixExtensions(_0xb0080f,_0x3e4ef2,_0x3836bd);});});});})[_0xeb9b('0x2b')](function(){return db['VoicePrefix']['findById'](_0xb0080f['id']);})[_0xeb9b('0x2b')](respondWithResult(_0x25398e,null))['catch'](handleError(_0x25398e,null));};exports[_0xeb9b('0x71')]=function(_0x463767,_0x279f71,_0x12a271){return db[_0xeb9b('0x33')][_0xeb9b('0x4d')]({'where':{'id':_0x463767[_0xeb9b('0x4c')]['id']}})[_0xeb9b('0x2b')](handleEntityNotFound(_0x279f71,null))[_0xeb9b('0x2b')](function(_0x46ce60){if(_0x46ce60){return _0x46ce60[_0xeb9b('0x71')](_0x463767[_0xeb9b('0x52')]['ids'],_['omit'](_0x463767[_0xeb9b('0x52')],['ids','id'])||{})['spread'](function(_0x95e1d0){for(var _0x4bdaf5=0x0;_0x4bdaf5<_0x463767['body']['ids'][_0xeb9b('0x3d')];_0x4bdaf5+=0x1){socket[_0xeb9b('0x72')](_0xeb9b('0x73'),{'UserId':Number(_0x463767[_0xeb9b('0x52')]['ids'][_0x4bdaf5]),'VoicePrefixId':Number(_0x463767[_0xeb9b('0x4c')]['id'])});}return _0x95e1d0;});}})[_0xeb9b('0x2b')](respondWithResult(_0x279f71,null))[_0xeb9b('0x4e')](handleError(_0x279f71,null));};exports['removeAgents']=function(_0x5c010d,_0x3ea644,_0x4ffa9e){return db[_0xeb9b('0x33')]['find']({'where':{'id':_0x5c010d['params']['id']}})[_0xeb9b('0x2b')](handleEntityNotFound(_0x3ea644,null))['then'](function(_0x3aca78){if(_0x3aca78){return _0x3aca78['removeAgents'](_0x5c010d['query'][_0xeb9b('0x74')])[_0xeb9b('0x2b')](function(){if(_[_0xeb9b('0x75')](_0x5c010d[_0xeb9b('0x38')]['ids'])){for(var _0x193ffc=0x0;_0x193ffc<_0x5c010d[_0xeb9b('0x38')][_0xeb9b('0x74')][_0xeb9b('0x3d')];_0x193ffc+=0x1){socket[_0xeb9b('0x72')](_0xeb9b('0x76'),{'UserId':Number(_0x5c010d['query'][_0xeb9b('0x74')][_0x193ffc]),'VoicePrefixId':Number(_0x5c010d['params']['id'])});}}else{socket[_0xeb9b('0x72')](_0xeb9b('0x76'),{'UserId':Number(_0x5c010d['query'][_0xeb9b('0x74')]),'VoicePrefixId':Number(_0x5c010d['params']['id'])});}});}})[_0xeb9b('0x2b')](respondWithStatusCode(_0x3ea644,null))['catch'](handleError(_0x3ea644,null));};exports[_0xeb9b('0x77')]=function(_0x36af5a,_0x41af31,_0x14db1d){var _0x31b0c5={};var _0x24bac5={};var _0x462fa2;var _0x5bf4a4;return db[_0xeb9b('0x33')][_0xeb9b('0x78')]({'where':{'id':_0x36af5a['params']['id']}})[_0xeb9b('0x2b')](handleEntityNotFound(_0x41af31,null))[_0xeb9b('0x2b')](function(_0x16f500){if(_0x16f500){_0x462fa2=_0x16f500;_0x24bac5['model']=_['keys'](db['User'][_0xeb9b('0x34')]);_0x24bac5[_0xeb9b('0x38')]=_['keys'](_0x36af5a[_0xeb9b('0x38')]);_0x24bac5[_0xeb9b('0x42')]=_[_0xeb9b('0x3a')](_0x24bac5[_0xeb9b('0x37')],_0x24bac5[_0xeb9b('0x38')]);_0x31b0c5[_0xeb9b('0x3c')]=_['intersection'](_0x24bac5[_0xeb9b('0x37')],qs[_0xeb9b('0x3b')](_0x36af5a[_0xeb9b('0x38')][_0xeb9b('0x3b')]));_0x31b0c5[_0xeb9b('0x3c')]=_0x31b0c5[_0xeb9b('0x3c')][_0xeb9b('0x3d')]?_0x31b0c5[_0xeb9b('0x3c')]:_0x24bac5[_0xeb9b('0x37')];_0x31b0c5[_0xeb9b('0x79')]=qs[_0xeb9b('0x40')](_0x36af5a['query'][_0xeb9b('0x40')]);_0x31b0c5[_0xeb9b('0x41')]=qs['filters'](_['pick'](_0x36af5a[_0xeb9b('0x38')],_0x24bac5[_0xeb9b('0x42')]));if(_0x36af5a['query'][_0xeb9b('0x43')]){_0x31b0c5[_0xeb9b('0x41')]=_[_0xeb9b('0x44')](_0x31b0c5[_0xeb9b('0x41')],{'$or':_[_0xeb9b('0x32')](_0x31b0c5[_0xeb9b('0x3c')],function(_0x3cb938){var _0x44562a={};_0x44562a[_0x3cb938]={'$like':'%'+_0x36af5a[_0xeb9b('0x38')]['filter']+'%'};return _0x44562a;})});}_0x31b0c5=_[_0xeb9b('0x44')]({},_0x31b0c5,_0x36af5a[_0xeb9b('0x47')]);return _0x462fa2[_0xeb9b('0x77')](_0x31b0c5);}})[_0xeb9b('0x2b')](function(_0x4d894e){if(_0x4d894e){_0x5bf4a4=_0x4d894e[_0xeb9b('0x3d')];if(!_0x36af5a['query']['hasOwnProperty'](_0xeb9b('0x3f'))){_0x31b0c5[_0xeb9b('0x22')]=qs[_0xeb9b('0x22')](_0x36af5a[_0xeb9b('0x38')][_0xeb9b('0x22')]);_0x31b0c5['offset']=qs[_0xeb9b('0x20')](_0x36af5a['query'][_0xeb9b('0x20')]);}return _0x462fa2[_0xeb9b('0x77')](_0x31b0c5);}})[_0xeb9b('0x2b')](function(_0x51628d){if(_0x51628d){return _0x51628d?{'count':_0x5bf4a4,'rows':_0x51628d}:null;}})[_0xeb9b('0x2b')](respondWithResult(_0x41af31,null))['catch'](handleError(_0x41af31,null));};exports['getTeams']=function(_0x3f9806,_0x3332ba,_0x25e684){var _0x841fc6={};var _0x175afe={};var _0x57a99e;var _0x2ee62d;return db[_0xeb9b('0x33')]['findOne']({'where':{'id':_0x3f9806[_0xeb9b('0x4c')]['id']}})[_0xeb9b('0x2b')](handleEntityNotFound(_0x3332ba,null))[_0xeb9b('0x2b')](function(_0x4c303d){if(_0x4c303d){_0x57a99e=_0x4c303d;_0x175afe[_0xeb9b('0x37')]=_[_0xeb9b('0x39')](db[_0xeb9b('0x7a')][_0xeb9b('0x34')]);_0x175afe[_0xeb9b('0x38')]=_[_0xeb9b('0x39')](_0x3f9806['query']);_0x175afe[_0xeb9b('0x42')]=_[_0xeb9b('0x3a')](_0x175afe[_0xeb9b('0x37')],_0x175afe[_0xeb9b('0x38')]);_0x841fc6[_0xeb9b('0x3c')]=_[_0xeb9b('0x3a')](_0x175afe[_0xeb9b('0x37')],qs[_0xeb9b('0x3b')](_0x3f9806[_0xeb9b('0x38')][_0xeb9b('0x3b')]));_0x841fc6[_0xeb9b('0x3c')]=_0x841fc6['attributes'][_0xeb9b('0x3d')]?_0x841fc6[_0xeb9b('0x3c')]:_0x175afe[_0xeb9b('0x37')];_0x841fc6[_0xeb9b('0x79')]=qs['sort'](_0x3f9806['query'][_0xeb9b('0x40')]);_0x841fc6[_0xeb9b('0x41')]=qs[_0xeb9b('0x42')](_[_0xeb9b('0x7b')](_0x3f9806[_0xeb9b('0x38')],_0x175afe[_0xeb9b('0x42')]));if(_0x3f9806[_0xeb9b('0x38')][_0xeb9b('0x43')]){_0x841fc6[_0xeb9b('0x41')]=_[_0xeb9b('0x44')](_0x841fc6[_0xeb9b('0x41')],{'$or':_[_0xeb9b('0x32')](_0x841fc6[_0xeb9b('0x3c')],function(_0x5b456a){var _0x13db61={};_0x13db61[_0x5b456a]={'$like':'%'+_0x3f9806[_0xeb9b('0x38')]['filter']+'%'};return _0x13db61;})});}_0x841fc6=_[_0xeb9b('0x44')]({},_0x841fc6,_0x3f9806[_0xeb9b('0x47')]);return _0x57a99e[_0xeb9b('0x7c')](_0x841fc6);}})['then'](function(_0x5c0da1){if(_0x5c0da1){_0x2ee62d=_0x5c0da1[_0xeb9b('0x3d')];if(!_0x3f9806['query'][_0xeb9b('0x3e')](_0xeb9b('0x3f'))){_0x841fc6[_0xeb9b('0x22')]=qs[_0xeb9b('0x22')](_0x3f9806[_0xeb9b('0x38')][_0xeb9b('0x22')]);_0x841fc6[_0xeb9b('0x20')]=qs[_0xeb9b('0x20')](_0x3f9806['query'][_0xeb9b('0x20')]);}return _0x57a99e[_0xeb9b('0x7c')](_0x841fc6);}})[_0xeb9b('0x2b')](function(_0x5e7146){if(_0x5e7146){return _0x5e7146?{'count':_0x2ee62d,'rows':_0x5e7146}:null;}})[_0xeb9b('0x2b')](respondWithResult(_0x3332ba,null))['catch'](handleError(_0x3332ba,null));};exports[_0xeb9b('0x7d')]=function(_0x26d380,_0x3d3b2c,_0x50dae3){var _0x461392=_0x26d380[_0xeb9b('0x52')]['ids'];var _0x33adad;return db[_0xeb9b('0x7a')]['findAll']({'where':{'id':_0x461392},'attributes':['id'],'include':[{'model':db['User'],'as':_0xeb9b('0x7e'),'attributes':['id',_0xeb9b('0x30'),_0xeb9b('0x7f'),_0xeb9b('0x80'),_0xeb9b('0x81')],'raw':!![]}]})[_0xeb9b('0x2b')](function(_0x1a49a7){if(_0x1a49a7){_0x33adad=_0x1a49a7;var _0x40c30f=_[_0xeb9b('0x82')](_0x1a49a7,function(_0xcda621){var _0xb409e0=_0xcda621[_0xeb9b('0x2d')]({'plain':!![]});return _0xb409e0[_0xeb9b('0x7e')];});return db['VoicePrefix'][_0xeb9b('0x4d')]({'where':{'id':_0x26d380[_0xeb9b('0x4c')]['id']}})[_0xeb9b('0x2b')](function(_0x52bd7a){return db[_0xeb9b('0x50')][_0xeb9b('0x51')](function(_0x33e5c3){return _0x52bd7a[_0xeb9b('0x7d')](_0x461392,{'transaction':_0x33e5c3})[_0xeb9b('0x2b')](function(){return BPromise[_0xeb9b('0x83')](_0x33adad,function(_0x45b94f){return db[_0xeb9b('0x84')]['upsert']({'TeamId':_0x45b94f['id'],'VoicePrefixId':_0x26d380[_0xeb9b('0x4c')]['id']},{'transaction':_0x33e5c3});});})[_0xeb9b('0x2b')](function(){return BPromise[_0xeb9b('0x83')](_0x40c30f,function(_0x193304){return db[_0xeb9b('0x85')][_0xeb9b('0x86')]({'where':{'UserId':_0x193304['id'],'VoicePrefixId':_0x26d380['params']['id']},'transaction':_0x33e5c3});});})[_0xeb9b('0x2b')](function(){_0x40c30f[_0xeb9b('0x87')](function(_0xe7dcc5){socket['emit']('userVoicePrefix:save',{'UserId':_0xe7dcc5['id'],'VoicePrefixId':_0x52bd7a['id']});});});});});}})[_0xeb9b('0x2b')](respondWithStatusCode(_0x3d3b2c,null))[_0xeb9b('0x4e')](handleError(_0x3d3b2c,null));};exports[_0xeb9b('0x88')]=function(_0x122550,_0x3e804b,_0x41659f){return db[_0xeb9b('0x7a')][_0xeb9b('0x4a')]({'where':{'id':_0x122550[_0xeb9b('0x38')][_0xeb9b('0x74')]},'attributes':['id'],'include':[{'model':db[_0xeb9b('0x89')],'as':_0xeb9b('0x7e'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x3e804b,null))[_0xeb9b('0x2b')](function(_0x4b273d){var _0x16c4a5=_['map'](_0x4b273d,'id');var _0x4d39a7=[];var _0x384fba=[];var _0x23893b=squel[_0xeb9b('0x8a')]();_0x23893b[_0xeb9b('0x8b')](_0xeb9b('0x8c'))['from'](_0xeb9b('0x8d'),'tq')['join'](_0xeb9b('0x8e'),'ut',_0xeb9b('0x8f'))[_0xeb9b('0x41')](_0xeb9b('0x90'),_0x122550['params']['id']);for(var _0x1a9933=0x0;_0x1a9933<_0x4b273d[_0xeb9b('0x3d')];_0x1a9933+=0x1){let _0x2bc3b5=_0x4b273d[_0x1a9933];for(var _0x3b28ef=0x0;_0x3b28ef<_0x2bc3b5[_0xeb9b('0x7e')][_0xeb9b('0x3d')];_0x3b28ef+=0x1){let _0x427672=_0x2bc3b5['Agents'][_0x3b28ef];var _0x276e1f=_0x23893b[_0xeb9b('0x91')]();_0x276e1f[_0xeb9b('0x41')](_0xeb9b('0x92'),_0x427672['id']);_0x384fba['push'](db[_0xeb9b('0x50')][_0xeb9b('0x38')](_0x276e1f[_0xeb9b('0x93')](),{'type':db[_0xeb9b('0x50')]['QueryTypes'][_0xeb9b('0x94')]})[_0xeb9b('0x2b')](function(_0x519eff){if(_0x519eff['length']===0x1){return _0x427672['id'];}else{var _0x564125=_[_0xeb9b('0x95')](_['map'](_0x519eff,_0xeb9b('0x96')),function(_0x44ba4b){return _['includes'](_0x16c4a5,_0x44ba4b);});if(_0x564125){return _0x427672['id'];}}}));}}return BPromise['all'](_0x384fba)[_0xeb9b('0x2b')](function(_0x245892){_0x4d39a7=_(_0x4d39a7)[_0xeb9b('0x97')](_0x245892)[_0xeb9b('0x98')]()[_0xeb9b('0x99')]();return db[_0xeb9b('0x33')][_0xeb9b('0x4d')]({'where':{'id':_0x122550[_0xeb9b('0x4c')]['id']}})[_0xeb9b('0x2b')](function(_0x4d5919){return db[_0xeb9b('0x50')][_0xeb9b('0x51')](function(_0x5d3fdf){return _0x4d5919[_0xeb9b('0x88')](_0x122550['query'][_0xeb9b('0x74')],{'transaction':_0x5d3fdf})[_0xeb9b('0x2b')](function(){if(!_[_0xeb9b('0x9a')](_0x4d39a7)){return _0x4d5919['removeAgents'](_0x4d39a7,{'transaction':_0x5d3fdf});}})['then'](function(){_0x4d39a7['forEach'](function(_0x8680da){socket[_0xeb9b('0x72')]('userVoicePrefix:remove',{'UserId':_0x8680da,'VoicePrefixId':_0x4d5919['id']});});});});});});})[_0xeb9b('0x2b')](respondWithStatusCode(_0x3e804b,null))[_0xeb9b('0x4e')](handleError(_0x3e804b,null));}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.events.js b/server/api/voicePrefix/voicePrefix.events.js index cd13b57..110b3c5 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 _0x782d=['hook','exports','events','../../mysqldb','update','remove','emit'];(function(_0x409fb8,_0x5ab3d3){var _0x278270=function(_0x58849c){while(--_0x58849c){_0x409fb8['push'](_0x409fb8['shift']());}};_0x278270(++_0x5ab3d3);}(_0x782d,0xe2));var _0xd782=function(_0x375ad0,_0x5528b9){_0x375ad0=_0x375ad0-0x0;var _0x202aba=_0x782d[_0x375ad0];return _0x202aba;};'use strict';var EventEmitter=require(_0xd782('0x0'));var VoicePrefix=require(_0xd782('0x1'))['db']['VoicePrefix'];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xd782('0x2'),'afterDestroy':_0xd782('0x3')};function emitEvent(_0x4b6924){return function(_0x5bf9e1,_0x5a3f78,_0x59bdc8){VoicePrefixEvents[_0xd782('0x4')](_0x4b6924+':'+_0x5bf9e1['id'],_0x5bf9e1);VoicePrefixEvents[_0xd782('0x4')](_0x4b6924,_0x5bf9e1);_0x59bdc8(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoicePrefix[_0xd782('0x5')](e,emitEvent(event));}}module[_0xd782('0x6')]=VoicePrefixEvents; \ No newline at end of file +var _0x46a7=['hasOwnProperty','exports','events','VoicePrefix','setMaxListeners','update','remove','emit'];(function(_0x1031e6,_0x3e5b64){var _0x224542=function(_0x539a1c){while(--_0x539a1c){_0x1031e6['push'](_0x1031e6['shift']());}};_0x224542(++_0x3e5b64);}(_0x46a7,0x1ba));var _0x746a=function(_0x20faff,_0x2b444a){_0x20faff=_0x20faff-0x0;var _0x3799b0=_0x46a7[_0x20faff];return _0x3799b0;};'use strict';var EventEmitter=require(_0x746a('0x0'));var VoicePrefix=require('../../mysqldb')['db'][_0x746a('0x1')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents[_0x746a('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x746a('0x3'),'afterDestroy':_0x746a('0x4')};function emitEvent(_0x11a255){return function(_0x19b3dc,_0x5bbbf4,_0x11f306){VoicePrefixEvents[_0x746a('0x5')](_0x11a255+':'+_0x19b3dc['id'],_0x19b3dc);VoicePrefixEvents['emit'](_0x11a255,_0x19b3dc);_0x11f306(null);};}for(var e in events){if(events[_0x746a('0x6')](e)){var event=events[e];VoicePrefix['hook'](e,emitEvent(event));}}module[_0x746a('0x7')]=VoicePrefixEvents; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.model.js b/server/api/voicePrefix/voicePrefix.model.js index 70aebec..51c45f1 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 _0xd11b=['VoicePrefix','lodash','util','api','moment','request-promise','rimraf','../../config/environment','exports'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xd11b,0x196));var _0xbd11=function(_0x44f519,_0x293a72){_0x44f519=_0x44f519-0x0;var _0x1aa4af=_0xd11b[_0x44f519];return _0x1aa4af;};'use strict';var _=require(_0xbd11('0x0'));var util=require(_0xbd11('0x1'));var logger=require('../../config/logger')(_0xbd11('0x2'));var moment=require(_0xbd11('0x3'));var BPromise=require('bluebird');var rp=require(_0xbd11('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xbd11('0x5'));var config=require(_0xbd11('0x6'));var attributes=require('./voicePrefix.attributes');module[_0xbd11('0x7')]=function(_0x3ccf53,_0x38ff23){return _0x3ccf53['define'](_0xbd11('0x8'),attributes,{'tableName':'voice_prefixes','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x960f=['request-promise','path','rimraf','../../config/environment','define','VoicePrefix','voice_prefixes','util','moment','bluebird'];(function(_0x19dd7a,_0x51de21){var _0x3feb6a=function(_0x4a3c84){while(--_0x4a3c84){_0x19dd7a['push'](_0x19dd7a['shift']());}};_0x3feb6a(++_0x51de21);}(_0x960f,0x13d));var _0xf960=function(_0x2e6c19,_0x131233){_0x2e6c19=_0x2e6c19-0x0;var _0x52885d=_0x960f[_0x2e6c19];return _0x52885d;};'use strict';var _=require('lodash');var util=require(_0xf960('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0xf960('0x1'));var BPromise=require(_0xf960('0x2'));var rp=require(_0xf960('0x3'));var fs=require('fs');var path=require(_0xf960('0x4'));var rimraf=require(_0xf960('0x5'));var config=require(_0xf960('0x6'));var attributes=require('./voicePrefix.attributes');module['exports']=function(_0x59aff5,_0x23f4f1){return _0x59aff5[_0xf960('0x7')](_0xf960('0x8'),attributes,{'tableName':_0xf960('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.rpc.js b/server/api/voicePrefix/voicePrefix.rpc.js index 9d14f64..fb39420 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 _0xce04=['request\x20sent','debug','stringify','error','message','info','result','catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/environment','jayson/promise','http','redis','localhost','socket.io-emitter','./voicePrefix.socket','register','request','VoicePrefix,\x20%s,\x20%s'];(function(_0x44b6f8,_0x302591){var _0x32b459=function(_0x4dc28a){while(--_0x4dc28a){_0x44b6f8['push'](_0x44b6f8['shift']());}};_0x32b459(++_0x302591);}(_0xce04,0xc0));var _0x4ce0=function(_0x2ba001,_0x2e05f5){_0x2ba001=_0x2ba001-0x0;var _0x2784fa=_0xce04[_0x2ba001];return _0x2784fa;};'use strict';var _=require(_0x4ce0('0x0'));var util=require('util');var moment=require(_0x4ce0('0x1'));var BPromise=require(_0x4ce0('0x2'));var rs=require(_0x4ce0('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4ce0('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x4ce0('0x5'));var jayson=require(_0x4ce0('0x6'));var client=jayson['client'][_0x4ce0('0x7')]({'port':0x232a});config[_0x4ce0('0x8')]=_['defaults'](config[_0x4ce0('0x8')],{'host':_0x4ce0('0x9'),'port':0x18eb});var socket=require(_0x4ce0('0xa'))(new Redis(config['redis']));require(_0x4ce0('0xb'))[_0x4ce0('0xc')](socket);function respondWithRpcPromise(_0x16a386,_0x3b803f,_0x140d74){return new BPromise(function(_0x237510,_0x53bc12){return client[_0x4ce0('0xd')](_0x16a386,_0x140d74)['then'](function(_0x5715d8){logger['info'](_0x4ce0('0xe'),_0x3b803f,_0x4ce0('0xf'));logger[_0x4ce0('0x10')]('VoicePrefix,\x20%s,\x20%s,\x20%s',_0x3b803f,_0x4ce0('0xf'),JSON[_0x4ce0('0x11')](_0x5715d8));if(_0x5715d8['error']){if(_0x5715d8[_0x4ce0('0x12')]['code']===0x1f4){logger[_0x4ce0('0x12')](_0x4ce0('0xe'),_0x3b803f,_0x5715d8[_0x4ce0('0x12')]['message']);return _0x53bc12(_0x5715d8[_0x4ce0('0x12')][_0x4ce0('0x13')]);}logger[_0x4ce0('0x12')]('VoicePrefix,\x20%s,\x20%s',_0x3b803f,_0x5715d8[_0x4ce0('0x12')]['message']);return _0x237510(_0x5715d8['error'][_0x4ce0('0x13')]);}else{logger[_0x4ce0('0x14')](_0x4ce0('0xe'),_0x3b803f,_0x4ce0('0xf'));_0x237510(_0x5715d8[_0x4ce0('0x15')][_0x4ce0('0x13')]);}})[_0x4ce0('0x16')](function(_0x5eeb11){logger[_0x4ce0('0x12')](_0x4ce0('0xe'),_0x3b803f,_0x5eeb11);_0x53bc12(_0x5eeb11);});});} \ No newline at end of file +var _0x47c5=['VoicePrefix,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./voicePrefix.socket','register','request','then','VoicePrefix,\x20%s,\x20%s','request\x20sent'];(function(_0xfe06b2,_0x396b76){var _0x4760f3=function(_0x422fcc){while(--_0x422fcc){_0xfe06b2['push'](_0xfe06b2['shift']());}};_0x4760f3(++_0x396b76);}(_0x47c5,0x165));var _0x547c=function(_0x58a3da,_0x4bb384){_0x58a3da=_0x58a3da-0x0;var _0x2612a2=_0x47c5[_0x58a3da];return _0x2612a2;};'use strict';var _=require(_0x547c('0x0'));var util=require(_0x547c('0x1'));var moment=require(_0x547c('0x2'));var BPromise=require(_0x547c('0x3'));var rs=require(_0x547c('0x4'));var fs=require('fs');var Redis=require(_0x547c('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x547c('0x6'));var logger=require(_0x547c('0x7'))('rpc');var config=require(_0x547c('0x8'));var jayson=require(_0x547c('0x9'));var client=jayson['client'][_0x547c('0xa')]({'port':0x232a});config[_0x547c('0xb')]=_[_0x547c('0xc')](config[_0x547c('0xb')],{'host':_0x547c('0xd'),'port':0x18eb});var socket=require(_0x547c('0xe'))(new Redis(config[_0x547c('0xb')]));require(_0x547c('0xf'))[_0x547c('0x10')](socket);function respondWithRpcPromise(_0x44a581,_0x72828d,_0x2c54e){return new BPromise(function(_0x111457,_0x2455e9){return client[_0x547c('0x11')](_0x44a581,_0x2c54e)[_0x547c('0x12')](function(_0x44ab17){logger['info'](_0x547c('0x13'),_0x72828d,_0x547c('0x14'));logger['debug'](_0x547c('0x15'),_0x72828d,_0x547c('0x14'),JSON[_0x547c('0x16')](_0x44ab17));if(_0x44ab17[_0x547c('0x17')]){if(_0x44ab17[_0x547c('0x17')][_0x547c('0x18')]===0x1f4){logger[_0x547c('0x17')](_0x547c('0x13'),_0x72828d,_0x44ab17[_0x547c('0x17')][_0x547c('0x19')]);return _0x2455e9(_0x44ab17[_0x547c('0x17')][_0x547c('0x19')]);}logger[_0x547c('0x17')](_0x547c('0x13'),_0x72828d,_0x44ab17[_0x547c('0x17')][_0x547c('0x19')]);return _0x111457(_0x44ab17[_0x547c('0x17')][_0x547c('0x19')]);}else{logger['info']('VoicePrefix,\x20%s,\x20%s',_0x72828d,_0x547c('0x14'));_0x111457(_0x44ab17[_0x547c('0x1a')][_0x547c('0x19')]);}})['catch'](function(_0x248aca){logger[_0x547c('0x17')](_0x547c('0x13'),_0x72828d,_0x248aca);_0x2455e9(_0x248aca);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.socket.js b/server/api/voicePrefix/voicePrefix.socket.js index 1011bee..0ffe986 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 _0xe630=['./voicePrefix.events','save','update','emit','register','length','voicePrefix:'];(function(_0x4b1c4d,_0xaa863e){var _0x23a8f9=function(_0x126508){while(--_0x126508){_0x4b1c4d['push'](_0x4b1c4d['shift']());}};_0x23a8f9(++_0xaa863e);}(_0xe630,0x149));var _0x0e63=function(_0x5bb0c0,_0x5dc885){_0x5bb0c0=_0x5bb0c0-0x0;var _0xd22ddf=_0xe630[_0x5bb0c0];return _0xd22ddf;};'use strict';var VoicePrefixEvents=require(_0x0e63('0x0'));var events=[_0x0e63('0x1'),'remove',_0x0e63('0x2')];function createListener(_0x294aee,_0x45c680){return function(_0x500458){_0x45c680[_0x0e63('0x3')](_0x294aee,_0x500458);};}function removeListener(_0x219cbe,_0x42c141){return function(){VoicePrefixEvents['removeListener'](_0x219cbe,_0x42c141);};}exports[_0x0e63('0x4')]=function(_0x308039){for(var _0x356abb=0x0,_0x3e461b=events[_0x0e63('0x5')];_0x356abb<_0x3e461b;_0x356abb++){var _0x563ad9=events[_0x356abb];var _0x35e304=createListener(_0x0e63('0x6')+_0x563ad9,_0x308039);VoicePrefixEvents['on'](_0x563ad9,_0x35e304);}}; \ No newline at end of file +var _0xf151=['length','remove','update','emit','register'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf151,0xab));var _0x1f15=function(_0x327f3b,_0x1c6659){_0x327f3b=_0x327f3b-0x0;var _0x256f88=_0xf151[_0x327f3b];return _0x256f88;};'use strict';var VoicePrefixEvents=require('./voicePrefix.events');var events=['save',_0x1f15('0x0'),_0x1f15('0x1')];function createListener(_0x246eb6,_0x338be9){return function(_0x24018f){_0x338be9[_0x1f15('0x2')](_0x246eb6,_0x24018f);};}function removeListener(_0x24c89c,_0x2fbef0){return function(){VoicePrefixEvents['removeListener'](_0x24c89c,_0x2fbef0);};}exports[_0x1f15('0x3')]=function(_0x5548bb){for(var _0x4cfc7b=0x0,_0x5ecda5=events[_0x1f15('0x4')];_0x4cfc7b<_0x5ecda5;_0x4cfc7b++){var _0x166156=events[_0x4cfc7b];var _0xc7ae4b=createListener('voicePrefix:'+_0x166156,_0x5548bb);VoicePrefixEvents['on'](_0x166156,_0xc7ae4b);}}; \ No newline at end of file diff --git a/server/api/voiceQueue/index.js b/server/api/voiceQueue/index.js index 8d949ab..dbde4df 100644 --- a/server/api/voiceQueue/index.js +++ b/server/api/voiceQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['addAgents','/:id/blacklists','addBlackLists','update','delete','destroy','removeTeams','removeAgents','removeLists','removeBlackLists','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueue.controller','get','index','/:id','getHoppers','/:id/hopper_histories','isAuthenticated','getHopperHistories','/:id/hopper_black','getHopperBlacks','/:id/teams','/:id/users','getAgents','/:id/members','getMembers','/:id/lists','getLists','post','create','/:id/clone','clone','addTeams'];(function(_0xe6365b,_0x4fc855){var _0x5e6fa9=function(_0x35ce4f){while(--_0x35ce4f){_0xe6365b['push'](_0xe6365b['shift']());}};_0x5e6fa9(++_0x4fc855);}(_0xa9e0,0x123));var _0x0a9e=function(_0xf71120,_0x25b7f9){_0xf71120=_0xf71120-0x0;var _0xbe2fd3=_0xa9e0[_0xf71120];return _0xbe2fd3;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/hoppers',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0x8')]('/:id/hopper_finals',auth['isAuthenticated'](),controller['getHopperFinals']);router['get'](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x8')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller['getTeams']);router[_0x0a9e('0x8')](_0x0a9e('0x12'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);router[_0x0a9e('0x8')](_0x0a9e('0x14'),auth['isAuthenticated'](),controller[_0x0a9e('0x15')]);router['get'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller[_0x0a9e('0x17')]);router[_0x0a9e('0x8')]('/:id/blacklists',auth[_0x0a9e('0xd')](),controller['getBlackLists']);router[_0x0a9e('0x18')]('/',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x19')]);router[_0x0a9e('0x18')](_0x0a9e('0x1a'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1b')]);router[_0x0a9e('0x18')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1c')]);router[_0x0a9e('0x18')]('/:id/users',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1d')]);router['post'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller['addLists']);router[_0x0a9e('0x18')](_0x0a9e('0x1e'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1f')]);router['put'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x20')]);router[_0x0a9e('0x21')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x22')]);router['delete']('/:id/teams',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x23')]);router[_0x0a9e('0x21')](_0x0a9e('0x12'),auth['isAuthenticated'](),controller[_0x0a9e('0x24')]);router['delete'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller[_0x0a9e('0x25')]);router[_0x0a9e('0x21')](_0x0a9e('0x1e'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x26')]);module[_0x0a9e('0x27')]=router; \ No newline at end of file +var _0xb10b=['express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueue.controller','get','index','isAuthenticated','show','/:id/hoppers','getHoppers','/:id/hopper_histories','/:id/hopper_finals','getHopperBlacks','/:id/teams','getTeams','/:id/users','getAgents','/:id/members','getMembers','/:id/lists','/:id/blacklists','getBlackLists','post','create','/:id/clone','addTeams','addAgents','addLists','addBlackLists','put','/:id','update','delete','removeTeams','removeAgents','removeLists','removeBlackLists','exports','multer','path','connect-timeout'];(function(_0x4d45c1,_0x2beda1){var _0x244478=function(_0x11304c){while(--_0x11304c){_0x4d45c1['push'](_0x4d45c1['shift']());}};_0x244478(++_0x2beda1);}(_0xb10b,0x12a));var _0xbb10=function(_0xd46333,_0x1b05c1){_0xd46333=_0xd46333-0x0;var _0x336108=_0xb10b[_0xd46333];return _0x336108;};'use strict';var multer=require(_0xbb10('0x0'));var util=require('util');var path=require(_0xbb10('0x1'));var timeout=require(_0xbb10('0x2'));var express=require(_0xbb10('0x3'));var router=express['Router']();var fs_extra=require(_0xbb10('0x4'));var auth=require(_0xbb10('0x5'));var interaction=require(_0xbb10('0x6'));var config=require(_0xbb10('0x7'));var controller=require(_0xbb10('0x8'));router[_0xbb10('0x9')]('/',auth['isAuthenticated'](),controller[_0xbb10('0xa')]);router[_0xbb10('0x9')]('/:id',auth[_0xbb10('0xb')](),controller[_0xbb10('0xc')]);router[_0xbb10('0x9')](_0xbb10('0xd'),auth[_0xbb10('0xb')](),controller[_0xbb10('0xe')]);router[_0xbb10('0x9')](_0xbb10('0xf'),auth['isAuthenticated'](),controller['getHopperHistories']);router[_0xbb10('0x9')](_0xbb10('0x10'),auth[_0xbb10('0xb')](),controller['getHopperFinals']);router[_0xbb10('0x9')]('/:id/hopper_black',auth[_0xbb10('0xb')](),controller[_0xbb10('0x11')]);router[_0xbb10('0x9')](_0xbb10('0x12'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x13')]);router['get'](_0xbb10('0x14'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x15')]);router[_0xbb10('0x9')](_0xbb10('0x16'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x17')]);router[_0xbb10('0x9')](_0xbb10('0x18'),auth[_0xbb10('0xb')](),controller['getLists']);router[_0xbb10('0x9')](_0xbb10('0x19'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x1a')]);router[_0xbb10('0x1b')]('/',auth[_0xbb10('0xb')](),controller[_0xbb10('0x1c')]);router[_0xbb10('0x1b')](_0xbb10('0x1d'),auth[_0xbb10('0xb')](),controller['clone']);router[_0xbb10('0x1b')](_0xbb10('0x12'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x1e')]);router[_0xbb10('0x1b')](_0xbb10('0x14'),auth['isAuthenticated'](),controller[_0xbb10('0x1f')]);router[_0xbb10('0x1b')]('/:id/lists',auth['isAuthenticated'](),controller[_0xbb10('0x20')]);router[_0xbb10('0x1b')](_0xbb10('0x19'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x21')]);router[_0xbb10('0x22')](_0xbb10('0x23'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x24')]);router[_0xbb10('0x25')](_0xbb10('0x23'),auth[_0xbb10('0xb')](),controller['destroy']);router['delete']('/:id/teams',auth[_0xbb10('0xb')](),controller[_0xbb10('0x26')]);router[_0xbb10('0x25')]('/:id/users',auth[_0xbb10('0xb')](),controller[_0xbb10('0x27')]);router[_0xbb10('0x25')](_0xbb10('0x18'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x28')]);router[_0xbb10('0x25')]('/:id/blacklists',auth[_0xbb10('0xb')](),controller[_0xbb10('0x29')]);module[_0xbb10('0x2a')]=router; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.attributes.js b/server/api/voiceQueue/voiceQueue.attributes.js index 2a2f5a8..bae6ee0 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 _0x58c0=['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\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','always','never','Active/Disactive\x20AMD','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','Active/Disactive\x20Recall\x20In\x20Queue','DESC','ASC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Machine\x20Retry\x20(min:1,\x20max:999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','mandatoryDisposition','STRING','outbound','inbound','default','ENUM','ringall','fewestcalls','random','linear','wrandom','rrordered','setDataValue','strategy','getDataValue','dialMethod','booked','rrmemory','roundrobin','includes','INTEGER','yes','once','periodic_announce','join','joinempty','split','leavewhenempty','BOOLEAN','acw','wrapuptime','Active/Disactive\x20Campaign','power','predictive','progressive','Dial\x20Method.','UNSIGNED','Max\x209999\x20channels,\x200\x20means\x20unlimited.','Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.','FLOAT','agentBusyFactor'];(function(_0x4ac31f,_0x3bf843){var _0x1f1926=function(_0x362de5){while(--_0x362de5){_0x4ac31f['push'](_0x4ac31f['shift']());}};_0x1f1926(++_0x3bf843);}(_0x58c0,0x6e));var _0x058c=function(_0x17b6e3,_0x4522ed){_0x17b6e3=_0x17b6e3-0x0;var _0x3906f3=_0x58c0[_0x17b6e3];return _0x3906f3;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x058c('0x0')],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize['ENUM']('inbound',_0x058c('0x1')),'allowNull':![],'defaultValue':_0x058c('0x2')},'musiconhold':{'type':Sequelize[_0x058c('0x0')],'defaultValue':_0x058c('0x3')},'announce':{'type':Sequelize[_0x058c('0x0')],'defaultValue':''},'strategy':{'type':Sequelize[_0x058c('0x4')]('rr',_0x058c('0x5'),'leastrecent',_0x058c('0x6'),_0x058c('0x7'),'rrmemory',_0x058c('0x8'),_0x058c('0x9'),_0x058c('0xa')),'allowNull':![],'defaultValue':_0x058c('0x5'),'set':function(_0x2a9fbc){this[_0x058c('0xb')](_0x058c('0xc'),_0x2a9fbc?_0x2a9fbc:'rrmemory');},'get':function(){var _0x882495=this[_0x058c('0xd')]('type');var _0x6608ef=this[_0x058c('0xd')](_0x058c('0xe'));var _0x1392f3=this[_0x058c('0xd')](_0x058c('0xc'));if(_0x882495===_0x058c('0x1')){if(_0x6608ef==='preview'){return null;}if(_0x6608ef===_0x058c('0xf')&&![_0x058c('0x10'),_0x058c('0x11')][_0x058c('0x12')](_0x1392f3)){this[_0x058c('0xb')](_0x058c('0xc'),'rrmemory');}}return _0x1392f3;}},'servicelevel':{'type':Sequelize[_0x058c('0x13')](0xb),'defaultValue':0x0},'context':{'type':Sequelize[_0x058c('0x0')],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize['INTEGER'](0xb)},'timeout':{'type':Sequelize[_0x058c('0x13')](0xb),'defaultValue':0xf},'retry':{'type':Sequelize[_0x058c('0x13')](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize[_0x058c('0x0')]},'weight':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize[_0x058c('0x13')](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':_0x058c('0x14')},'autopause':{'type':Sequelize[_0x058c('0x4')](_0x058c('0x14'),'no','all'),'defaultValue':'no'},'autopausedelay':{'type':Sequelize[_0x058c('0x13')](0xb)},'autopausebusy':{'type':Sequelize[_0x058c('0x4')]('yes','no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize[_0x058c('0x4')](_0x058c('0x14'),'no'),'defaultValue':'no'},'maxlen':{'type':Sequelize[_0x058c('0x13')](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize[_0x058c('0x4')]('yes','no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize[_0x058c('0x4')]('yes','no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize[_0x058c('0x4')]('yes','no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize[_0x058c('0x4')]('yes','no'),'defaultValue':'no'},'membermacro':{'type':Sequelize['STRING'],'allowNull':!![]},'membergosub':{'type':Sequelize[_0x058c('0x0')],'allowNull':!![]},'announce_frequency':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize[_0x058c('0x13')](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize[_0x058c('0x13')](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize[_0x058c('0x4')]('yes','no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize['ENUM'](_0x058c('0x14'),'no'),'defaultValue':_0x058c('0x14')},'announce_holdtime':{'type':Sequelize[_0x058c('0x4')](_0x058c('0x14'),'no',_0x058c('0x15')),'defaultValue':'no'},'announce_position':{'type':Sequelize[_0x058c('0x0')],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize[_0x058c('0x4')](_0x058c('0x14'),'no')},'announce_position_limit':{'type':Sequelize[_0x058c('0x13')](0xb)},'announce_round_seconds':{'type':Sequelize[_0x058c('0x4')]('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize[_0x058c('0x0')],'defaultValue':''},'monitor_type':{'type':Sequelize[_0x058c('0x0')]},'queue_youarenext':{'type':Sequelize[_0x058c('0x0')],'defaultValue':null},'queue_thereare':{'type':Sequelize[_0x058c('0x0')],'defaultValue':null},'queue_callswaiting':{'type':Sequelize[_0x058c('0x0')],'defaultValue':null},'queue_holdtime':{'type':Sequelize[_0x058c('0x0')],'defaultValue':null},'queue_minute':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize[_0x058c('0x0')],'defaultValue':null},'queue_seconds':{'type':Sequelize[_0x058c('0x0')],'defaultValue':null},'queue_thankyou':{'type':Sequelize[_0x058c('0x0')],'defaultValue':null},'queue_reporthold':{'type':Sequelize['STRING']},'queue_quantity1':{'type':Sequelize[_0x058c('0x0')]},'queue_quantity2':{'type':Sequelize['STRING']},'queue_periodic_announce':{'type':Sequelize['STRING']},'queue_less_than':{'type':Sequelize[_0x058c('0x0')]},'periodic_announce':{'type':Sequelize['TEXT'],'set':function(_0xd07f1d){this[_0x058c('0xb')](_0x058c('0x16'),_0xd07f1d?_0xd07f1d[_0x058c('0x17')](','):[]);},'get':function(){return this[_0x058c('0xd')](_0x058c('0x16'))?this['getDataValue'](_0x058c('0x16'))['split'](','):[];}},'joinempty':{'type':Sequelize[_0x058c('0x0')],'defaultValue':_0x058c('0x14'),'set':function(_0x2852dd){this[_0x058c('0xb')](_0x058c('0x18'),_0x2852dd?_0x2852dd[_0x058c('0x17')](','):undefined);},'get':function(){return this[_0x058c('0xd')](_0x058c('0x18'))?this[_0x058c('0xd')](_0x058c('0x18'))[_0x058c('0x19')](','):undefined;}},'leavewhenempty':{'type':Sequelize[_0x058c('0x0')],'defaultValue':'no','set':function(_0x241316){this[_0x058c('0xb')](_0x058c('0x1a'),_0x241316?_0x241316[_0x058c('0x17')](','):undefined);},'get':function(){return this[_0x058c('0xd')]('leavewhenempty')?this[_0x058c('0xd')](_0x058c('0x1a'))[_0x058c('0x19')](','):undefined;}},'reportholdtime':{'type':Sequelize[_0x058c('0x4')](_0x058c('0x14'),'no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize[_0x058c('0x4')](_0x058c('0x14'),'no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize[_0x058c('0x13')](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize[_0x058c('0x4')]('yes','no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize[_0x058c('0x0')]},'description':{'type':Sequelize[_0x058c('0x0')]},'acw':{'type':Sequelize[_0x058c('0x1b')],'defaultValue':0x0,'set':function(_0x1498de){this[_0x058c('0xb')](_0x058c('0x1c'),_0x1498de);if(_0x1498de){if(this[_0x058c('0xd')](_0x058c('0x1d'))<0x2){this[_0x058c('0xb')](_0x058c('0x1d'),0x2);}}}},'acwTimeout':{'type':Sequelize[_0x058c('0x13')](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize[_0x058c('0x1b')],'defaultValue':0x0,'comment':_0x058c('0x1e')},'dialMethod':{'type':Sequelize['ENUM']('preview','progressive',_0x058c('0x1f'),_0x058c('0x20'),_0x058c('0xf')),'defaultValue':_0x058c('0x21'),'comment':_0x058c('0x22')},'dialLimitChannel':{'type':Sequelize[_0x058c('0x13')](0x4)[_0x058c('0x23')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x058c('0x24')},'dialLimitQueue':{'type':Sequelize['INTEGER'](0x4)[_0x058c('0x23')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x058c('0x25')},'dialPowerLevel':{'type':Sequelize[_0x058c('0x26')](0x2)[_0x058c('0x23')],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':'Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).'},'dialPredictiveOptimization':{'type':Sequelize[_0x058c('0x4')](_0x058c('0x27'),'dropRate'),'defaultValue':_0x058c('0x28'),'comment':_0x058c('0x29')},'dialPredictiveOptimizationPercentage':{'type':Sequelize['FLOAT'](0x2)[_0x058c('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':'Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)'},'dialPredictiveInterval':{'type':Sequelize[_0x058c('0x13')](0x3)['UNSIGNED'],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':_0x058c('0x2a')},'dialOriginateCallerIdName':{'type':Sequelize[_0x058c('0x0')]},'dialOriginateCallerIdNumber':{'type':Sequelize['STRING']},'dialOriginateTimeout':{'type':Sequelize[_0x058c('0x13')](0x3)[_0x058c('0x23')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x058c('0x2b')},'dialQueueOptions':{'type':Sequelize[_0x058c('0x0')],'defaultValue':_0x058c('0x2c'),'comment':_0x058c('0x2d')},'dialQueueTimeout':{'type':Sequelize[_0x058c('0x13')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x058c('0x2e')},'dialQueueProject':{'type':Sequelize[_0x058c('0x0')],'comment':_0x058c('0x2f')},'dialCongestionMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x058c('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Congestion\x20Retry\x20(min:1,\x20max:999)'},'dialCongestionRetryFrequency':{'type':Sequelize[_0x058c('0x13')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x058c('0x30')},'dialBusyMaxRetry':{'type':Sequelize[_0x058c('0x13')](0x3)[_0x058c('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Busy\x20Retry\x20(min:1,\x20max:999)'},'dialBusyRetryFrequency':{'type':Sequelize[_0x058c('0x13')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x058c('0x31')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x058c('0x13')](0x3)['UNSIGNED'],'defaultValue':0x3,'comment':'#NoAnswer\x20Retry\x20(min:1,\x20max:999)'},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x058c('0x13')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialGlobalMaxRetry':{'type':Sequelize[_0x058c('0x13')](0x3)[_0x058c('0x23')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x058c('0x32')},'dialTimezone':{'type':Sequelize['STRING'],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize['STRING'],'defaultValue':_0x058c('0x33')},'dialPrefix':{'type':Sequelize[_0x058c('0x0')],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize[_0x058c('0x4')](_0x058c('0x34'),_0x058c('0x35'),'onlyIfOpen'),'defaultValue':'always'},'dialAMDActive':{'type':Sequelize[_0x058c('0x1b')],'defaultValue':0x0,'comment':_0x058c('0x36')},'dialAMDInitialSilence':{'type':Sequelize[_0x058c('0x13')](0x9)[_0x058c('0x23')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':'#AMD\x20Initial\x20Silence'},'dialAMDGreeting':{'type':Sequelize[_0x058c('0x13')](0x9)[_0x058c('0x23')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':'#AMD\x20Greeting'},'dialAMDAfterGreetingSilence':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x058c('0x37')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x058c('0x13')](0x9)[_0x058c('0x23')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Total\x20Analysis\x20Time'},'dialAMDMinWordLength':{'type':Sequelize[_0x058c('0x13')](0x9)['UNSIGNED'],'defaultValue':0x64,'validate':{'min':0x0},'comment':'#AMD\x20Min\x20Word\x20Length'},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x058c('0x13')](0x9)[_0x058c('0x23')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x058c('0x38')},'dialAMDMaximumNumberOfWords':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x058c('0x39')},'dialAMDSilenceThreshold':{'type':Sequelize[_0x058c('0x13')](0x5)[_0x058c('0x23')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x058c('0x3a')},'dialAMDMaximumWordLength':{'type':Sequelize['INTEGER'](0x9)[_0x058c('0x23')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x058c('0x3b')},'dialRecallMeTimeout':{'type':Sequelize[_0x058c('0x13')](0x5)[_0x058c('0x23')],'validate':{'min':0x1},'defaultValue':0x1e,'comment':'#RecallMe\x20Timeout\x20(min:1)'},'dialRecallInQueue':{'type':Sequelize[_0x058c('0x1b')],'defaultValue':0x0,'comment':_0x058c('0x3c')},'dialOrderByScheduledAt':{'type':Sequelize[_0x058c('0x4')](_0x058c('0x3d'),_0x058c('0x3e')),'defaultValue':_0x058c('0x3d')},'dialQueueProject2':{'type':Sequelize[_0x058c('0x0')],'comment':_0x058c('0x2f')},'dialAgiAfterHangupClient':{'type':Sequelize[_0x058c('0x1b')],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize[_0x058c('0x1b')],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize['INTEGER'](0x3)[_0x058c('0x23')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x058c('0x3f')},'dialCutDigit':{'type':Sequelize['INTEGER'](0x3)[_0x058c('0x23')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Cut\x20Digit\x20(min:1,\x20max:15)'},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x058c('0x13')](0x3)[_0x058c('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x058c('0x40')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x058c('0x13')](0x5)[_0x058c('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialDropMaxRetry':{'type':Sequelize[_0x058c('0x13')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x058c('0x41')},'dialDropRetryFrequency':{'type':Sequelize[_0x058c('0x13')](0x5)[_0x058c('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x058c('0x42')},'dialAbandonedMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x058c('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x058c('0x43')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x058c('0x13')](0x5)[_0x058c('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x058c('0x44')},'dialMachineMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x058c('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x058c('0x45')},'dialMachineRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x058c('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x058c('0x13')](0x3)[_0x058c('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x058c('0x46')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x058c('0x13')](0x5)[_0x058c('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'mandatoryDispositionPauseId':{'type':Sequelize[_0x058c('0x13')],'allowNull':!![],'comment':_0x058c('0x47')},'mandatoryDisposition':{'type':Sequelize[_0x058c('0x1b')],'defaultValue':![],'comment':_0x058c('0x48'),'set':function(_0x314c1e){if(!_0x314c1e)this[_0x058c('0xb')](_0x058c('0x49'),null);this[_0x058c('0xb')](_0x058c('0x4a'),_0x314c1e);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}},'dialPreviewAutoRecallMe':{'type':Sequelize[_0x058c('0x1b')],'defaultValue':!![]},'callAdditionalPhoneAfterMin':{'type':Sequelize[_0x058c('0x13')](0x3)[_0x058c('0x23')],'defaultValue':0x4},'dialPreviewRecallmeReminder':{'type':Sequelize[_0x058c('0x1b')],'defaultValue':![]}}; \ No newline at end of file +var _0xa9e0=['yes','all','periodic_announce','split','joinempty','join','leavewhenempty','BOOLEAN','acw','wrapuptime','progressive','power','booked','Dial\x20Method.','UNSIGNED','Max\x209999\x20channels,\x200\x20means\x20unlimited.','FLOAT','Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).','dropRate','Only\x20for\x20predictive\x20method.','Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)','Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)','https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_Queue','Queue\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','07:00-22:00,*,*,*','always','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#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','#RecallMe\x20Timeout\x20(min:1)','Active/Disactive\x20Recall\x20In\x20Queue','DESC','ASC','Cut\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Machine\x20Retry\x20(min:1,\x20max:999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','exports','STRING','name','outbound','inbound','ENUM','fewestcalls','random','wrandom','rrordered','ringall','setDataValue','rrmemory','getDataValue','type','dialMethod','strategy','preview','roundrobin','includes','INTEGER'];(function(_0x576e92,_0x165314){var _0x24c32e=function(_0x1648b1){while(--_0x1648b1){_0x576e92['push'](_0x576e92['shift']());}};_0x24c32e(++_0x165314);}(_0xa9e0,0x88));var _0x0a9e=function(_0x1b349a,_0x22222c){_0x1b349a=_0x1b349a-0x0;var _0x5d1f7c=_0xa9e0[_0x1b349a];return _0x5d1f7c;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'name':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':![],'unique':_0x0a9e('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize['ENUM']('inbound',_0x0a9e('0x4')),'allowNull':![],'defaultValue':_0x0a9e('0x5')},'musiconhold':{'type':Sequelize['STRING'],'defaultValue':'default'},'announce':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':''},'strategy':{'type':Sequelize[_0x0a9e('0x6')]('rr','ringall','leastrecent',_0x0a9e('0x7'),_0x0a9e('0x8'),'rrmemory','linear',_0x0a9e('0x9'),_0x0a9e('0xa')),'allowNull':![],'defaultValue':_0x0a9e('0xb'),'set':function(_0x519edd){this[_0x0a9e('0xc')]('strategy',_0x519edd?_0x519edd:_0x0a9e('0xd'));},'get':function(){var _0x322810=this[_0x0a9e('0xe')](_0x0a9e('0xf'));var _0x64155d=this[_0x0a9e('0xe')](_0x0a9e('0x10'));var _0x3cfc31=this[_0x0a9e('0xe')](_0x0a9e('0x11'));if(_0x322810===_0x0a9e('0x4')){if(_0x64155d===_0x0a9e('0x12')){return null;}if(_0x64155d==='booked'&&!['rrmemory',_0x0a9e('0x13')][_0x0a9e('0x14')](_0x3cfc31)){this[_0x0a9e('0xc')]('strategy',_0x0a9e('0xd'));}}return _0x3cfc31;}},'servicelevel':{'type':Sequelize[_0x0a9e('0x15')](0xb),'defaultValue':0x0},'context':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize[_0x0a9e('0x15')](0xb)},'timeout':{'type':Sequelize[_0x0a9e('0x15')](0xb),'defaultValue':0xf},'retry':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize[_0x0a9e('0x2')]},'weight':{'type':Sequelize[_0x0a9e('0x15')](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize[_0x0a9e('0x15')](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize[_0x0a9e('0x6')]('yes','no'),'defaultValue':_0x0a9e('0x16')},'autopause':{'type':Sequelize[_0x0a9e('0x6')](_0x0a9e('0x16'),'no',_0x0a9e('0x17')),'defaultValue':'no'},'autopausedelay':{'type':Sequelize[_0x0a9e('0x15')](0xb)},'autopausebusy':{'type':Sequelize[_0x0a9e('0x6')](_0x0a9e('0x16'),'no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize[_0x0a9e('0x6')](_0x0a9e('0x16'),'no'),'defaultValue':'no'},'maxlen':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize[_0x0a9e('0x6')](_0x0a9e('0x16'),'no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize['ENUM'](_0x0a9e('0x16'),'no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize[_0x0a9e('0x6')](_0x0a9e('0x16'),'no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize[_0x0a9e('0x6')](_0x0a9e('0x16'),'no'),'defaultValue':'no'},'membermacro':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':!![]},'membergosub':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':!![]},'announce_frequency':{'type':Sequelize[_0x0a9e('0x15')](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize[_0x0a9e('0x15')](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize[_0x0a9e('0x15')](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize[_0x0a9e('0x6')](_0x0a9e('0x16'),'no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize[_0x0a9e('0x6')](_0x0a9e('0x16'),'no'),'defaultValue':'yes'},'announce_holdtime':{'type':Sequelize[_0x0a9e('0x6')](_0x0a9e('0x16'),'no','once'),'defaultValue':'no'},'announce_position':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize[_0x0a9e('0x6')](_0x0a9e('0x16'),'no')},'announce_position_limit':{'type':Sequelize[_0x0a9e('0x15')](0xb)},'announce_round_seconds':{'type':Sequelize[_0x0a9e('0x6')]('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':''},'monitor_type':{'type':Sequelize[_0x0a9e('0x2')]},'queue_youarenext':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':null},'queue_thereare':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':null},'queue_callswaiting':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':null},'queue_holdtime':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':null},'queue_minute':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':null},'queue_seconds':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':null},'queue_thankyou':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':null},'queue_reporthold':{'type':Sequelize[_0x0a9e('0x2')]},'queue_quantity1':{'type':Sequelize[_0x0a9e('0x2')]},'queue_quantity2':{'type':Sequelize['STRING']},'queue_periodic_announce':{'type':Sequelize[_0x0a9e('0x2')]},'queue_less_than':{'type':Sequelize[_0x0a9e('0x2')]},'periodic_announce':{'type':Sequelize['TEXT'],'set':function(_0x47b32c){this[_0x0a9e('0xc')]('periodic_announce',_0x47b32c?_0x47b32c['join'](','):[]);},'get':function(){return this[_0x0a9e('0xe')]('periodic_announce')?this[_0x0a9e('0xe')](_0x0a9e('0x18'))[_0x0a9e('0x19')](','):[];}},'joinempty':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':_0x0a9e('0x16'),'set':function(_0x32eae4){this[_0x0a9e('0xc')](_0x0a9e('0x1a'),_0x32eae4?_0x32eae4[_0x0a9e('0x1b')](','):undefined);},'get':function(){return this[_0x0a9e('0xe')](_0x0a9e('0x1a'))?this['getDataValue'](_0x0a9e('0x1a'))[_0x0a9e('0x19')](','):undefined;}},'leavewhenempty':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':'no','set':function(_0x5790bb){this[_0x0a9e('0xc')](_0x0a9e('0x1c'),_0x5790bb?_0x5790bb[_0x0a9e('0x1b')](','):undefined);},'get':function(){return this['getDataValue'](_0x0a9e('0x1c'))?this[_0x0a9e('0xe')](_0x0a9e('0x1c'))[_0x0a9e('0x19')](','):undefined;}},'reportholdtime':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize[_0x0a9e('0x6')]('yes','no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize[_0x0a9e('0x15')](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize['ENUM'](_0x0a9e('0x16'),'no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize[_0x0a9e('0x2')]},'description':{'type':Sequelize['STRING']},'acw':{'type':Sequelize[_0x0a9e('0x1d')],'defaultValue':0x0,'set':function(_0x6dee02){this[_0x0a9e('0xc')](_0x0a9e('0x1e'),_0x6dee02);if(_0x6dee02){if(this[_0x0a9e('0xe')](_0x0a9e('0x1f'))<0x2){this[_0x0a9e('0xc')]('wrapuptime',0x2);}}}},'acwTimeout':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize[_0x0a9e('0x1d')],'defaultValue':0x0,'comment':'Active/Disactive\x20Campaign'},'dialMethod':{'type':Sequelize['ENUM']('preview',_0x0a9e('0x20'),_0x0a9e('0x21'),'predictive',_0x0a9e('0x22')),'defaultValue':'progressive','comment':_0x0a9e('0x23')},'dialLimitChannel':{'type':Sequelize[_0x0a9e('0x15')](0x4)[_0x0a9e('0x24')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x0a9e('0x25')},'dialLimitQueue':{'type':Sequelize[_0x0a9e('0x15')](0x4)[_0x0a9e('0x24')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':'Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.'},'dialPowerLevel':{'type':Sequelize[_0x0a9e('0x26')](0x2)[_0x0a9e('0x24')],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':_0x0a9e('0x27')},'dialPredictiveOptimization':{'type':Sequelize['ENUM']('agentBusyFactor','dropRate'),'defaultValue':_0x0a9e('0x28'),'comment':_0x0a9e('0x29')},'dialPredictiveOptimizationPercentage':{'type':Sequelize[_0x0a9e('0x26')](0x2)[_0x0a9e('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':_0x0a9e('0x2a')},'dialPredictiveInterval':{'type':Sequelize[_0x0a9e('0x15')](0x3)[_0x0a9e('0x24')],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':_0x0a9e('0x2b')},'dialOriginateCallerIdName':{'type':Sequelize[_0x0a9e('0x2')]},'dialOriginateCallerIdNumber':{'type':Sequelize['STRING']},'dialOriginateTimeout':{'type':Sequelize[_0x0a9e('0x15')](0x3)[_0x0a9e('0x24')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':'Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)'},'dialQueueOptions':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':'tTxX','comment':_0x0a9e('0x2c')},'dialQueueTimeout':{'type':Sequelize[_0x0a9e('0x15')](0x3)[_0x0a9e('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0a9e('0x2d')},'dialQueueProject':{'type':Sequelize[_0x0a9e('0x2')],'comment':_0x0a9e('0x2e')},'dialCongestionMaxRetry':{'type':Sequelize[_0x0a9e('0x15')](0x3)[_0x0a9e('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Congestion\x20Retry\x20(min:1,\x20max:999)'},'dialCongestionRetryFrequency':{'type':Sequelize[_0x0a9e('0x15')](0x5)[_0x0a9e('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0a9e('0x2f')},'dialBusyMaxRetry':{'type':Sequelize[_0x0a9e('0x15')](0x3)[_0x0a9e('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Busy\x20Retry\x20(min:1,\x20max:999)'},'dialBusyRetryFrequency':{'type':Sequelize[_0x0a9e('0x15')](0x5)[_0x0a9e('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0a9e('0x30')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x0a9e('0x15')](0x3)['UNSIGNED'],'defaultValue':0x3,'comment':_0x0a9e('0x31')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x0a9e('0x15')](0x5)[_0x0a9e('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0a9e('0x32')},'dialGlobalMaxRetry':{'type':Sequelize[_0x0a9e('0x15')](0x3)[_0x0a9e('0x24')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':'#Global\x20Max\x20Retry\x20(min:1,\x20max:999)'},'dialTimezone':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize['STRING'],'defaultValue':_0x0a9e('0x33')},'dialPrefix':{'type':Sequelize['STRING'],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize[_0x0a9e('0x6')]('always','never','onlyIfOpen'),'defaultValue':_0x0a9e('0x34')},'dialAMDActive':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':'Active/Disactive\x20AMD'},'dialAMDInitialSilence':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x0a9e('0x35')},'dialAMDGreeting':{'type':Sequelize['INTEGER'](0x9)[_0x0a9e('0x24')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x0a9e('0x36')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x0a9e('0x15')](0x9)[_0x0a9e('0x24')],'defaultValue':0x320,'validate':{'min':0x0},'comment':'#AMD\x20After\x20Greeting\x20Silence'},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x0a9e('0x15')](0x9)[_0x0a9e('0x24')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x0a9e('0x37')},'dialAMDMinWordLength':{'type':Sequelize[_0x0a9e('0x15')](0x9)[_0x0a9e('0x24')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x0a9e('0x38')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x0a9e('0x15')](0x9)['UNSIGNED'],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x0a9e('0x39')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x0a9e('0x15')](0x9)[_0x0a9e('0x24')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x0a9e('0x3a')},'dialAMDSilenceThreshold':{'type':Sequelize['INTEGER'](0x5)[_0x0a9e('0x24')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x0a9e('0x3b')},'dialAMDMaximumWordLength':{'type':Sequelize[_0x0a9e('0x15')](0x9)[_0x0a9e('0x24')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x0a9e('0x3c')},'dialRecallMeTimeout':{'type':Sequelize[_0x0a9e('0x15')](0x5)[_0x0a9e('0x24')],'validate':{'min':0x1},'defaultValue':0x1e,'comment':_0x0a9e('0x3d')},'dialRecallInQueue':{'type':Sequelize[_0x0a9e('0x1d')],'defaultValue':0x0,'comment':_0x0a9e('0x3e')},'dialOrderByScheduledAt':{'type':Sequelize[_0x0a9e('0x6')](_0x0a9e('0x3f'),_0x0a9e('0x40')),'defaultValue':'DESC'},'dialQueueProject2':{'type':Sequelize['STRING'],'comment':'AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)'},'dialAgiAfterHangupClient':{'type':Sequelize[_0x0a9e('0x1d')],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x0a9e('0x15')](0x3)[_0x0a9e('0x24')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Random\x20Last\x20Digit\x20(min:1,\x20max:15)'},'dialCutDigit':{'type':Sequelize['INTEGER'](0x3)[_0x0a9e('0x24')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x0a9e('0x41')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x0a9e('0x15')](0x3)[_0x0a9e('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0a9e('0x42')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x0a9e('0x15')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0a9e('0x43')},'dialDropMaxRetry':{'type':Sequelize[_0x0a9e('0x15')](0x3)[_0x0a9e('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Drop\x20Retry\x20(min:1,\x20max:999)'},'dialDropRetryFrequency':{'type':Sequelize[_0x0a9e('0x15')](0x5)[_0x0a9e('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0a9e('0x44')},'dialAbandonedMaxRetry':{'type':Sequelize[_0x0a9e('0x15')](0x3)[_0x0a9e('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0a9e('0x45')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x0a9e('0x15')](0x5)[_0x0a9e('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0a9e('0x46')},'dialMachineMaxRetry':{'type':Sequelize[_0x0a9e('0x15')](0x3)[_0x0a9e('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0a9e('0x47')},'dialMachineRetryFrequency':{'type':Sequelize[_0x0a9e('0x15')](0x5)[_0x0a9e('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0a9e('0x48')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x0a9e('0x15')](0x3)[_0x0a9e('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0a9e('0x49')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x0a9e('0x15')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0a9e('0x4a')},'mandatoryDispositionPauseId':{'type':Sequelize[_0x0a9e('0x15')],'allowNull':!![],'comment':_0x0a9e('0x4b')},'mandatoryDisposition':{'type':Sequelize[_0x0a9e('0x1d')],'defaultValue':![],'comment':_0x0a9e('0x4c'),'set':function(_0x26d61e){if(!_0x26d61e)this[_0x0a9e('0xc')](_0x0a9e('0x4d'),null);this['setDataValue'](_0x0a9e('0x4e'),_0x26d61e);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize[_0x0a9e('0x15')](0x3)[_0x0a9e('0x24')],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize['INTEGER'](0x3)[_0x0a9e('0x24')],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}},'dialPreviewAutoRecallMe':{'type':Sequelize[_0x0a9e('0x1d')],'defaultValue':!![]},'callAdditionalPhoneAfterMin':{'type':Sequelize['INTEGER'](0x3)[_0x0a9e('0x24')],'defaultValue':0x4},'dialPreviewRecallmeReminder':{'type':Sequelize[_0x0a9e('0x1d')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.controller.js b/server/api/voiceQueue/voiceQueue.controller.js index 9e91562..1c3893f 100644 --- a/server/api/voiceQueue/voiceQueue.controller.js +++ b/server/api/voiceQueue/voiceQueue.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4b84=['type','find','UserProfileResource','stack','name','send','index','rawAttributes','fieldName','key','getOptions','where','VoiceQueue','include','findAll','rows','catch','show','params','model','keys','query','filters','intersection','attributes','fields','length','includeAll','merge','options','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','updatedAt','userProfileId','findOne','hasOwnProperty','nolimit','order','sort','VoiceQueueId','CmHopper','getHopperHistories','pick','CmHopperHistory','CmHopperFinal','CmHopperBlack','getTeams','Team','addTeams','User','Agents','voicePause','interface','forEach','penalty','transaction','TeamVoiceQueue','each','UserVoiceQueue','UserVoiceQueueRt','upsert','format','SIP/%s','emit','ids','field','from','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','VoiceQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','toString','sequelize','SELECT','TeamId','all','removeTeams','isEmpty','removeAgents','addAgents','spread','userVoiceQueue:save','online','isNil','isArray','userVoiceQueue:remove','getAgents','getMembers','getLists','CmList','addLists','dialCheckDuplicateType','fromQuery','phone','scheduledAt','ContactId','ListId','select','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','CmListId','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','COALESCE(phone,\x27\x27)','cm_hopper','onlyIfOpen','insert','into','CmHopperId','OrderBy','h.id','ci.item','ci.OrderBy+1','cm_contact_has_items','h.scheduledat=?','ci.ItemClass=?','removeLists','getBlackLists','NOW()','removeBlackLists','moment','bluebird','squel','../../config/logger','api','../../config/environment','redis','socket.io-emitter','./voiceQueue.socket','sendStatus','end','status','json','undefined','count','offset','limit','update','destroy','then','get','VoiceQueues','inbound','QueueCampaigns','outbound','filter','ignore','map','value'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4b84,0x1cc));var _0x44b8=function(_0x11ca63,_0xea9f9c){_0x11ca63=_0x11ca63-0x0;var _0x41f1f6=_0x4b84[_0x11ca63];return _0x41f1f6;};'use strict';var moment=require(_0x44b8('0x0'));var BPromise=require(_0x44b8('0x1'));var util=require('util');var _=require('lodash');var squel=require(_0x44b8('0x2'));var Redis=require('ioredis');var qs=require('../../components/parsers/qs');var logger=require(_0x44b8('0x3'))(_0x44b8('0x4'));var config=require(_0x44b8('0x5'));var db=require('../../mysqldb')['db'];config['redis']=_['defaults'](config[_0x44b8('0x6')],{'host':'localhost','port':0x18eb});var socket=require(_0x44b8('0x7'))(new Redis(config['redis']));require(_0x44b8('0x8'))['register'](socket);function respondWithStatusCode(_0x5034b6,_0x41d515){_0x41d515=_0x41d515||0xcc;return function(_0x42319d){if(_0x42319d){return _0x5034b6[_0x44b8('0x9')](_0x41d515);}return _0x5034b6['status'](_0x41d515)[_0x44b8('0xa')]();};}function respondWithResult(_0x2cc74b,_0x4315f6){_0x4315f6=_0x4315f6||0xc8;return function(_0x9b6048){if(_0x9b6048){return _0x2cc74b[_0x44b8('0xb')](_0x4315f6)[_0x44b8('0xc')](_0x9b6048);}};}function respondWithFilteredResult(_0xe9a025,_0x4ae8a1){return function(_0x147529){if(_0x147529){var _0x4301a6=typeof _0x4ae8a1['offset']===_0x44b8('0xd')&&typeof _0x4ae8a1['limit']===_0x44b8('0xd');var _0x18d642=_0x147529['count'];var _0x63e8f6=_0x4301a6?0x0:_0x4ae8a1['offset'];var _0x54fa95=_0x4301a6?_0x147529[_0x44b8('0xe')]:_0x4ae8a1[_0x44b8('0xf')]+_0x4ae8a1[_0x44b8('0x10')];var _0x41ab46;if(_0x54fa95>=_0x18d642){_0x54fa95=_0x18d642;_0x41ab46=0xc8;}else{_0x41ab46=0xce;}_0xe9a025['status'](_0x41ab46);return _0xe9a025['set']('Content-Range',_0x63e8f6+'-'+_0x54fa95+'/'+_0x18d642)[_0x44b8('0xc')](_0x147529);}return null;};}function saveUpdates(_0x5b7803){return function(_0x28ef36){if(_0x28ef36){return _0x28ef36[_0x44b8('0x11')](_0x5b7803)['then'](function(_0x36743e){return _0x36743e;});}return null;};}function removeEntity(_0xe3de8f){return function(_0x5103f5){if(_0x5103f5){return _0x5103f5[_0x44b8('0x12')]()[_0x44b8('0x13')](function(){var _0x4b600f=_0x5103f5[_0x44b8('0x14')]({'plain':!![]});var _0x8b4301=[{'name':_0x44b8('0x15'),'value':_0x44b8('0x16'),'ignore':![]},{'name':_0x44b8('0x17'),'value':_0x44b8('0x18'),'ignore':![]}];var _0x452f2f=_(_0x8b4301)[_0x44b8('0x19')](_0x44b8('0x1a'))[_0x44b8('0x1b')](_0x44b8('0x1c'))[_0x44b8('0x1c')]();if(_['includes'](_0x452f2f,_0x4b600f[_0x44b8('0x1d')])){return;}var _0x3a8aa4=_[_0x44b8('0x1e')](_0x8b4301,[_0x44b8('0x1c'),_0x4b600f[_0x44b8('0x1d')]])['name'];return db[_0x44b8('0x1f')]['destroy']({'where':{'type':_0x3a8aa4,'resourceId':_0x4b600f['id']}})[_0x44b8('0x13')](function(){return _0x5103f5;});})[_0x44b8('0x13')](function(){_0xe3de8f[_0x44b8('0xb')](0xcc)[_0x44b8('0xa')]();});}};}function handleEntityNotFound(_0x230a3d){return function(_0x59acbc){if(!_0x59acbc){_0x230a3d[_0x44b8('0x9')](0x194);}return _0x59acbc;};}function handleError(_0x502acf,_0x41d673){_0x41d673=_0x41d673||0x1f4;return function(_0x350482){logger['error'](_0x350482[_0x44b8('0x20')]);if(_0x350482[_0x44b8('0x21')]){delete _0x350482[_0x44b8('0x21')];}_0x502acf['status'](_0x41d673)[_0x44b8('0x22')](_0x350482);};}exports[_0x44b8('0x23')]=function(_0x53d9c7,_0x2e0174){var _0x4a182d={};var _0xfb0028={'count':0x0,'rows':[]};var _0x5a544c=_['map'](db['VoiceQueue'][_0x44b8('0x24')],function(_0x29b18d){return{'name':_0x29b18d[_0x44b8('0x25')],'type':_0x29b18d[_0x44b8('0x1d')][_0x44b8('0x26')]};});_0x4a182d=qs[_0x44b8('0x27')](_0x5a544c,_0x53d9c7);var _0x2cf205={'where':_0x4a182d[_0x44b8('0x28')]};return db[_0x44b8('0x29')][_0x44b8('0xe')](_0x2cf205)[_0x44b8('0x13')](function(_0x417d81){_0xfb0028[_0x44b8('0xe')]=_0x417d81;_0x4a182d['include']=qs[_0x44b8('0x2a')](_0x53d9c7['query']);return db[_0x44b8('0x29')][_0x44b8('0x2b')](_0x4a182d);})[_0x44b8('0x13')](function(_0xb64609){_0xfb0028[_0x44b8('0x2c')]=_0xb64609;return _0xfb0028;})['then'](respondWithFilteredResult(_0x2e0174,_0x4a182d))[_0x44b8('0x2d')](handleError(_0x2e0174,null));};exports[_0x44b8('0x2e')]=function(_0x26265f,_0x339f0f){var _0x46b008={'raw':![],'where':{'id':_0x26265f[_0x44b8('0x2f')]['id']}},_0x5f541d={};_0x5f541d[_0x44b8('0x30')]=_[_0x44b8('0x31')](db[_0x44b8('0x29')][_0x44b8('0x24')]);_0x5f541d[_0x44b8('0x32')]=_[_0x44b8('0x31')](_0x26265f[_0x44b8('0x32')]);_0x5f541d[_0x44b8('0x33')]=_[_0x44b8('0x34')](_0x5f541d[_0x44b8('0x30')],_0x5f541d[_0x44b8('0x32')]);_0x46b008[_0x44b8('0x35')]=_[_0x44b8('0x34')](_0x5f541d[_0x44b8('0x30')],qs[_0x44b8('0x36')](_0x26265f[_0x44b8('0x32')][_0x44b8('0x36')]));_0x46b008[_0x44b8('0x35')]=_0x46b008[_0x44b8('0x35')][_0x44b8('0x37')]?_0x46b008[_0x44b8('0x35')]:_0x5f541d['model'];if(_0x26265f[_0x44b8('0x32')][_0x44b8('0x38')]){_0x46b008['include']=[{'all':!![]}];}_0x46b008=_[_0x44b8('0x39')]({},_0x46b008,_0x26265f[_0x44b8('0x3a')]);return db[_0x44b8('0x29')][_0x44b8('0x1e')](_0x46b008)['then'](handleEntityNotFound(_0x339f0f,null))[_0x44b8('0x13')](respondWithResult(_0x339f0f,null))[_0x44b8('0x2d')](handleError(_0x339f0f,null));};exports[_0x44b8('0x3b')]=function(_0x1ee3cc,_0x9cb2a){return db[_0x44b8('0x29')][_0x44b8('0x3b')](_0x1ee3cc[_0x44b8('0x3c')],{})[_0x44b8('0x13')](function(_0x3d1be1){var _0x1c9983=_0x1ee3cc[_0x44b8('0x3d')][_0x44b8('0x14')]({'plain':!![]});if(!_0x1c9983)throw new Error(_0x44b8('0x3e'));if(_0x1c9983[_0x44b8('0x3f')]===_0x44b8('0x3d')){var _0x57d8c4=_0x3d1be1[_0x44b8('0x14')]({'plain':!![]});var _0x43e43a=[{'name':_0x44b8('0x15'),'value':'inbound'},{'name':_0x44b8('0x17'),'value':_0x44b8('0x18')}];var _0x229cc9=_['find'](_0x43e43a,[_0x44b8('0x1c'),_0x57d8c4[_0x44b8('0x1d')]])[_0x44b8('0x21')];return db[_0x44b8('0x40')][_0x44b8('0x1e')]({'where':{'name':_0x229cc9,'userProfileId':_0x1c9983['userProfileId']},'raw':!![]})['then'](function(_0x215f7b){if(_0x215f7b&&_0x215f7b[_0x44b8('0x41')]===0x0){return db[_0x44b8('0x1f')][_0x44b8('0x3b')]({'name':_0x57d8c4[_0x44b8('0x21')],'resourceId':_0x57d8c4['id'],'type':_0x215f7b[_0x44b8('0x21')],'sectionId':_0x215f7b['id']},{})[_0x44b8('0x13')](function(){return _0x3d1be1;});}else{return _0x3d1be1;}})[_0x44b8('0x2d')](function(_0x455fd6){logger[_0x44b8('0x42')](_0x44b8('0x43'),_0x455fd6);throw _0x455fd6;});}return _0x3d1be1;})[_0x44b8('0x13')](respondWithResult(_0x9cb2a,0xc9))[_0x44b8('0x2d')](handleError(_0x9cb2a,null));};exports[_0x44b8('0x44')]=function(_0x149731,_0x60eeb2){var _0xce06dc={'where':{'id':_0x149731[_0x44b8('0x2f')]['id']}},_0x3b3d5d={};_0x3b3d5d['model']=_['keys'](db[_0x44b8('0x29')][_0x44b8('0x24')]);_0xce06dc[_0x44b8('0x35')]=_[_0x44b8('0x34')](_0x3b3d5d[_0x44b8('0x30')],qs[_0x44b8('0x36')](_0x149731[_0x44b8('0x32')]['fields']));_0xce06dc[_0x44b8('0x35')]=_0xce06dc['attributes'][_0x44b8('0x37')]?_0xce06dc[_0x44b8('0x35')]:_0x3b3d5d[_0x44b8('0x30')];if(_0x149731[_0x44b8('0x32')][_0x44b8('0x38')]){_0xce06dc[_0x44b8('0x2a')]=[{'all':!![]}];}_0xce06dc=_['merge']({},_0xce06dc,_0x149731[_0x44b8('0x3a')]);return db[_0x44b8('0x29')][_0x44b8('0x1e')](_0xce06dc)[_0x44b8('0x13')](handleEntityNotFound(_0x60eeb2,null))['then'](function(_0x4e4ed1){if(_0x4e4ed1){var _0x2f549d=_0x4e4ed1[_0x44b8('0x14')]({'plain':!![]});_0x2f549d=qs[_0x44b8('0x45')](_0x2f549d,['id',_0x44b8('0x46'),_0x44b8('0x47')]);_0x149731['body']=_[_0x44b8('0x45')](_0x149731[_0x44b8('0x3c')],['id',_0x44b8('0x46'),_0x44b8('0x47')]);return db[_0x44b8('0x29')]['create'](_['merge'](_0x2f549d,_0x149731[_0x44b8('0x3c')]),{'include':_0x149731['query'][_0x44b8('0x38')]?[{'all':!![]}]:undefined})['then'](function(_0x40164d){var _0x434d6a=_0x149731[_0x44b8('0x3d')][_0x44b8('0x14')]({'plain':!![]});if(!_0x434d6a)throw new Error(_0x44b8('0x3e'));if(_0x434d6a[_0x44b8('0x3f')]===_0x44b8('0x3d')){var _0x533967=_0x40164d[_0x44b8('0x14')]({'plain':!![]});var _0x37b2c2=[{'name':_0x44b8('0x15'),'value':'inbound'},{'name':_0x44b8('0x17'),'value':_0x44b8('0x18')}];var _0x45f9a0=_[_0x44b8('0x1e')](_0x37b2c2,['value',_0x533967[_0x44b8('0x1d')]])[_0x44b8('0x21')];return db['UserProfileSection'][_0x44b8('0x1e')]({'where':{'name':_0x45f9a0,'userProfileId':_0x434d6a[_0x44b8('0x48')]},'raw':!![]})[_0x44b8('0x13')](function(_0x3df6aa){if(_0x3df6aa&&_0x3df6aa[_0x44b8('0x41')]===0x0){return db['UserProfileResource']['create']({'name':_0x533967[_0x44b8('0x21')],'resourceId':_0x533967['id'],'type':_0x3df6aa[_0x44b8('0x21')],'sectionId':_0x3df6aa['id']},{})[_0x44b8('0x13')](function(){return _0x40164d;});}else{return _0x40164d;}})[_0x44b8('0x2d')](function(_0x765e45){logger[_0x44b8('0x42')](_0x44b8('0x43'),_0x765e45);throw _0x765e45;});}return _0x40164d;});}})[_0x44b8('0x13')](respondWithResult(_0x60eeb2,0xc9))[_0x44b8('0x2d')](handleError(_0x60eeb2,null));};exports[_0x44b8('0x11')]=function(_0x16c628,_0x3f7576){if(_0x16c628['body']['id']){delete _0x16c628[_0x44b8('0x3c')]['id'];}return db[_0x44b8('0x29')][_0x44b8('0x1e')]({'where':{'id':_0x16c628[_0x44b8('0x2f')]['id']}})[_0x44b8('0x13')](handleEntityNotFound(_0x3f7576,null))[_0x44b8('0x13')](saveUpdates(_0x16c628[_0x44b8('0x3c')],null))[_0x44b8('0x13')](respondWithResult(_0x3f7576,null))[_0x44b8('0x2d')](handleError(_0x3f7576,null));};exports[_0x44b8('0x12')]=function(_0x2ecff9,_0x15bcba){return db[_0x44b8('0x29')][_0x44b8('0x1e')]({'where':{'id':_0x2ecff9[_0x44b8('0x2f')]['id']}})[_0x44b8('0x13')](handleEntityNotFound(_0x15bcba,null))[_0x44b8('0x13')](removeEntity(_0x15bcba,null))[_0x44b8('0x2d')](handleError(_0x15bcba,null));};exports['getHoppers']=function(_0x1ec516,_0x3aac51){var _0x10e519={'raw':![],'where':{}};var _0x2b37e={};var _0x51f763={'count':0x0,'rows':[]};return db[_0x44b8('0x29')][_0x44b8('0x49')]({'where':{'id':_0x1ec516['params']['id']}})[_0x44b8('0x13')](handleEntityNotFound(_0x3aac51,null))[_0x44b8('0x13')](function(_0x5df821){if(_0x5df821){_0x2b37e[_0x44b8('0x30')]=_[_0x44b8('0x31')](db['CmHopper'][_0x44b8('0x24')]);_0x2b37e[_0x44b8('0x32')]=_[_0x44b8('0x31')](_0x1ec516['query']);_0x2b37e[_0x44b8('0x33')]=_['intersection'](_0x2b37e[_0x44b8('0x30')],_0x2b37e['query']);_0x10e519[_0x44b8('0x35')]=_[_0x44b8('0x34')](_0x2b37e[_0x44b8('0x30')],qs[_0x44b8('0x36')](_0x1ec516[_0x44b8('0x32')][_0x44b8('0x36')]));_0x10e519['attributes']=_0x10e519[_0x44b8('0x35')]['length']?_0x10e519[_0x44b8('0x35')]:_0x2b37e[_0x44b8('0x30')];if(!_0x1ec516['query'][_0x44b8('0x4a')](_0x44b8('0x4b'))){_0x10e519[_0x44b8('0x10')]=qs[_0x44b8('0x10')](_0x1ec516[_0x44b8('0x32')][_0x44b8('0x10')]);_0x10e519[_0x44b8('0xf')]=qs[_0x44b8('0xf')](_0x1ec516[_0x44b8('0x32')][_0x44b8('0xf')]);}_0x10e519[_0x44b8('0x4c')]=qs[_0x44b8('0x4d')](_0x1ec516['query'][_0x44b8('0x4d')]);_0x10e519[_0x44b8('0x28')]=qs[_0x44b8('0x33')](_['pick'](_0x1ec516[_0x44b8('0x32')],_0x2b37e[_0x44b8('0x33')]));_0x10e519['where'][_0x44b8('0x4e')]=_0x5df821['id'];if(_0x1ec516[_0x44b8('0x32')][_0x44b8('0x19')]){_0x10e519[_0x44b8('0x28')]=_[_0x44b8('0x39')](_0x10e519['where'],{'$or':_[_0x44b8('0x1b')](_0x10e519[_0x44b8('0x35')],function(_0x279753){var _0x270224={};_0x270224[_0x279753]={'$like':'%'+_0x1ec516[_0x44b8('0x32')][_0x44b8('0x19')]+'%'};return _0x270224;})});}_0x10e519=_[_0x44b8('0x39')]({},_0x10e519,_0x1ec516[_0x44b8('0x3a')]);return db['CmHopper'][_0x44b8('0xe')]({'where':_0x10e519[_0x44b8('0x28')]})[_0x44b8('0x13')](function(_0x3ce76e){_0x51f763['count']=_0x3ce76e;if(_0x1ec516['query']['includeAll']){_0x10e519[_0x44b8('0x2a')]=[{'all':!![]}];}return db[_0x44b8('0x4f')][_0x44b8('0x2b')](_0x10e519);})[_0x44b8('0x13')](function(_0x32e630){_0x51f763['rows']=_0x32e630;return _0x51f763;});}})[_0x44b8('0x13')](respondWithFilteredResult(_0x3aac51,_0x10e519))['catch'](handleError(_0x3aac51,null));};exports[_0x44b8('0x50')]=function(_0x155bcf,_0xea2c3e){var _0x5da034={'raw':!![],'where':{}};var _0x4cac12={};var _0xb4c6dc={'count':0x0,'rows':[]};return db[_0x44b8('0x29')][_0x44b8('0x49')]({'where':{'id':_0x155bcf['params']['id']}})[_0x44b8('0x13')](handleEntityNotFound(_0xea2c3e,null))[_0x44b8('0x13')](function(_0x1258c2){if(_0x1258c2){_0x4cac12[_0x44b8('0x30')]=_[_0x44b8('0x31')](db['CmHopperHistory'][_0x44b8('0x24')]);_0x4cac12[_0x44b8('0x32')]=_[_0x44b8('0x31')](_0x155bcf[_0x44b8('0x32')]);_0x4cac12[_0x44b8('0x33')]=_['intersection'](_0x4cac12[_0x44b8('0x30')],_0x4cac12[_0x44b8('0x32')]);_0x5da034[_0x44b8('0x35')]=_[_0x44b8('0x34')](_0x4cac12[_0x44b8('0x30')],qs[_0x44b8('0x36')](_0x155bcf[_0x44b8('0x32')]['fields']));_0x5da034[_0x44b8('0x35')]=_0x5da034[_0x44b8('0x35')]['length']?_0x5da034[_0x44b8('0x35')]:_0x4cac12[_0x44b8('0x30')];if(!_0x155bcf['query'][_0x44b8('0x4a')]('nolimit')){_0x5da034['limit']=qs[_0x44b8('0x10')](_0x155bcf[_0x44b8('0x32')][_0x44b8('0x10')]);_0x5da034['offset']=qs['offset'](_0x155bcf['query'][_0x44b8('0xf')]);}_0x5da034[_0x44b8('0x4c')]=qs[_0x44b8('0x4d')](_0x155bcf[_0x44b8('0x32')][_0x44b8('0x4d')]);_0x5da034[_0x44b8('0x28')]=qs[_0x44b8('0x33')](_[_0x44b8('0x51')](_0x155bcf['query'],_0x4cac12[_0x44b8('0x33')]));_0x5da034['where']['VoiceQueueId']=_0x1258c2['id'];if(_0x155bcf['query'][_0x44b8('0x19')]){_0x5da034['where']=_[_0x44b8('0x39')](_0x5da034[_0x44b8('0x28')],{'$or':_[_0x44b8('0x1b')](_0x5da034[_0x44b8('0x35')],function(_0x3a9780){var _0x245ba3={};_0x245ba3[_0x3a9780]={'$like':'%'+_0x155bcf[_0x44b8('0x32')][_0x44b8('0x19')]+'%'};return _0x245ba3;})});}_0x5da034=_['merge']({},_0x5da034,_0x155bcf[_0x44b8('0x3a')]);return db[_0x44b8('0x52')][_0x44b8('0xe')]({'where':_0x5da034[_0x44b8('0x28')]})[_0x44b8('0x13')](function(_0xee44b3){_0xb4c6dc[_0x44b8('0xe')]=_0xee44b3;if(_0x155bcf[_0x44b8('0x32')][_0x44b8('0x38')]){_0x5da034['include']=[{'all':!![]}];}return db['CmHopperHistory'][_0x44b8('0x2b')](_0x5da034);})['then'](function(_0x531d65){_0xb4c6dc[_0x44b8('0x2c')]=_0x531d65;return _0xb4c6dc;});}})[_0x44b8('0x13')](respondWithFilteredResult(_0xea2c3e,_0x5da034))['catch'](handleError(_0xea2c3e,null));};exports['getHopperFinals']=function(_0x4b22e7,_0x2e0289){var _0x4860af={'raw':!![],'where':{}};var _0x353ff1={};var _0x2812da={'count':0x0,'rows':[]};return db[_0x44b8('0x29')][_0x44b8('0x49')]({'where':{'id':_0x4b22e7[_0x44b8('0x2f')]['id']}})[_0x44b8('0x13')](handleEntityNotFound(_0x2e0289,null))[_0x44b8('0x13')](function(_0x3a7229){if(_0x3a7229){_0x353ff1[_0x44b8('0x30')]=_[_0x44b8('0x31')](db[_0x44b8('0x53')][_0x44b8('0x24')]);_0x353ff1[_0x44b8('0x32')]=_[_0x44b8('0x31')](_0x4b22e7['query']);_0x353ff1[_0x44b8('0x33')]=_[_0x44b8('0x34')](_0x353ff1[_0x44b8('0x30')],_0x353ff1[_0x44b8('0x32')]);_0x4860af[_0x44b8('0x35')]=_[_0x44b8('0x34')](_0x353ff1[_0x44b8('0x30')],qs[_0x44b8('0x36')](_0x4b22e7[_0x44b8('0x32')][_0x44b8('0x36')]));_0x4860af[_0x44b8('0x35')]=_0x4860af[_0x44b8('0x35')][_0x44b8('0x37')]?_0x4860af['attributes']:_0x353ff1[_0x44b8('0x30')];if(!_0x4b22e7[_0x44b8('0x32')][_0x44b8('0x4a')]('nolimit')){_0x4860af['limit']=qs[_0x44b8('0x10')](_0x4b22e7[_0x44b8('0x32')][_0x44b8('0x10')]);_0x4860af['offset']=qs[_0x44b8('0xf')](_0x4b22e7[_0x44b8('0x32')][_0x44b8('0xf')]);}_0x4860af[_0x44b8('0x4c')]=qs[_0x44b8('0x4d')](_0x4b22e7[_0x44b8('0x32')][_0x44b8('0x4d')]);_0x4860af[_0x44b8('0x28')]=qs['filters'](_[_0x44b8('0x51')](_0x4b22e7[_0x44b8('0x32')],_0x353ff1[_0x44b8('0x33')]));_0x4860af[_0x44b8('0x28')][_0x44b8('0x4e')]=_0x3a7229['id'];if(_0x4b22e7[_0x44b8('0x32')][_0x44b8('0x19')]){_0x4860af['where']=_['merge'](_0x4860af['where'],{'$or':_[_0x44b8('0x1b')](_0x4860af[_0x44b8('0x35')],function(_0x2d74ee){var _0x312f4c={};_0x312f4c[_0x2d74ee]={'$like':'%'+_0x4b22e7[_0x44b8('0x32')][_0x44b8('0x19')]+'%'};return _0x312f4c;})});}_0x4860af=_[_0x44b8('0x39')]({},_0x4860af,_0x4b22e7[_0x44b8('0x3a')]);return db[_0x44b8('0x53')]['count']({'where':_0x4860af[_0x44b8('0x28')]})[_0x44b8('0x13')](function(_0x4b8036){_0x2812da['count']=_0x4b8036;if(_0x4b22e7[_0x44b8('0x32')]['includeAll']){_0x4860af[_0x44b8('0x2a')]=[{'all':!![]}];}return db[_0x44b8('0x53')][_0x44b8('0x2b')](_0x4860af);})['then'](function(_0x3f4a2a){_0x2812da[_0x44b8('0x2c')]=_0x3f4a2a;return _0x2812da;});}})[_0x44b8('0x13')](respondWithFilteredResult(_0x2e0289,_0x4860af))[_0x44b8('0x2d')](handleError(_0x2e0289,null));};exports['getHopperBlacks']=function(_0x216030,_0x584ae3){var _0x38c0c5={'raw':!![],'where':{}};var _0x2f2923={};var _0x2d9d62={'count':0x0,'rows':[]};return db[_0x44b8('0x29')][_0x44b8('0x49')]({'where':{'id':_0x216030[_0x44b8('0x2f')]['id']}})[_0x44b8('0x13')](handleEntityNotFound(_0x584ae3,null))['then'](function(_0x4d3b82){if(_0x4d3b82){_0x2f2923['model']=_[_0x44b8('0x31')](db[_0x44b8('0x54')][_0x44b8('0x24')]);_0x2f2923[_0x44b8('0x32')]=_[_0x44b8('0x31')](_0x216030[_0x44b8('0x32')]);_0x2f2923[_0x44b8('0x33')]=_[_0x44b8('0x34')](_0x2f2923[_0x44b8('0x30')],_0x2f2923[_0x44b8('0x32')]);_0x38c0c5[_0x44b8('0x35')]=_[_0x44b8('0x34')](_0x2f2923[_0x44b8('0x30')],qs[_0x44b8('0x36')](_0x216030[_0x44b8('0x32')][_0x44b8('0x36')]));_0x38c0c5[_0x44b8('0x35')]=_0x38c0c5[_0x44b8('0x35')]['length']?_0x38c0c5[_0x44b8('0x35')]:_0x2f2923['model'];if(!_0x216030[_0x44b8('0x32')]['hasOwnProperty']('nolimit')){_0x38c0c5[_0x44b8('0x10')]=qs['limit'](_0x216030['query']['limit']);_0x38c0c5['offset']=qs['offset'](_0x216030[_0x44b8('0x32')][_0x44b8('0xf')]);}_0x38c0c5[_0x44b8('0x4c')]=qs[_0x44b8('0x4d')](_0x216030['query'][_0x44b8('0x4d')]);_0x38c0c5[_0x44b8('0x28')]=qs['filters'](_['pick'](_0x216030[_0x44b8('0x32')],_0x2f2923[_0x44b8('0x33')]));_0x38c0c5[_0x44b8('0x28')]['VoiceQueueId']=_0x4d3b82['id'];if(_0x216030[_0x44b8('0x32')][_0x44b8('0x19')]){_0x38c0c5[_0x44b8('0x28')]=_[_0x44b8('0x39')](_0x38c0c5[_0x44b8('0x28')],{'$or':_[_0x44b8('0x1b')](_0x38c0c5[_0x44b8('0x35')],function(_0x16344b){var _0x21057f={};_0x21057f[_0x16344b]={'$like':'%'+_0x216030['query'][_0x44b8('0x19')]+'%'};return _0x21057f;})});}_0x38c0c5=_[_0x44b8('0x39')]({},_0x38c0c5,_0x216030['options']);return db[_0x44b8('0x54')][_0x44b8('0xe')]({'where':_0x38c0c5[_0x44b8('0x28')]})['then'](function(_0x3a09e4){_0x2d9d62['count']=_0x3a09e4;if(_0x216030[_0x44b8('0x32')][_0x44b8('0x38')]){_0x38c0c5['include']=[{'all':!![]}];}return db[_0x44b8('0x54')][_0x44b8('0x2b')](_0x38c0c5);})[_0x44b8('0x13')](function(_0x37871e){_0x2d9d62['rows']=_0x37871e;return _0x2d9d62;});}})[_0x44b8('0x13')](respondWithFilteredResult(_0x584ae3,_0x38c0c5))[_0x44b8('0x2d')](handleError(_0x584ae3,null));};exports[_0x44b8('0x55')]=function(_0x35d46c,_0x2d4a8a){var _0x1d666e={};var _0x10a66a={};var _0x1e608f;var _0x470f90;return db['VoiceQueue']['findOne']({'where':{'id':_0x35d46c[_0x44b8('0x2f')]['id']}})[_0x44b8('0x13')](handleEntityNotFound(_0x2d4a8a,null))[_0x44b8('0x13')](function(_0x3539f9){if(_0x3539f9){_0x1e608f=_0x3539f9;_0x10a66a[_0x44b8('0x30')]=_['keys'](db[_0x44b8('0x56')]['rawAttributes']);_0x10a66a[_0x44b8('0x32')]=_['keys'](_0x35d46c[_0x44b8('0x32')]);_0x10a66a[_0x44b8('0x33')]=_[_0x44b8('0x34')](_0x10a66a[_0x44b8('0x30')],_0x10a66a[_0x44b8('0x32')]);_0x1d666e[_0x44b8('0x35')]=_[_0x44b8('0x34')](_0x10a66a[_0x44b8('0x30')],qs[_0x44b8('0x36')](_0x35d46c['query'][_0x44b8('0x36')]));_0x1d666e[_0x44b8('0x35')]=_0x1d666e[_0x44b8('0x35')][_0x44b8('0x37')]?_0x1d666e['attributes']:_0x10a66a['model'];_0x1d666e['order']=qs[_0x44b8('0x4d')](_0x35d46c['query']['sort']);_0x1d666e[_0x44b8('0x28')]=qs[_0x44b8('0x33')](_[_0x44b8('0x51')](_0x35d46c[_0x44b8('0x32')],_0x10a66a[_0x44b8('0x33')]));if(_0x35d46c[_0x44b8('0x32')][_0x44b8('0x19')]){_0x1d666e[_0x44b8('0x28')]=_['merge'](_0x1d666e[_0x44b8('0x28')],{'$or':_[_0x44b8('0x1b')](_0x1d666e[_0x44b8('0x35')],function(_0x2594bf){var _0x5f0c0c={};_0x5f0c0c[_0x2594bf]={'$like':'%'+_0x35d46c[_0x44b8('0x32')][_0x44b8('0x19')]+'%'};return _0x5f0c0c;})});}_0x1d666e=_[_0x44b8('0x39')]({},_0x1d666e,_0x35d46c['options']);return _0x1e608f['getTeams'](_0x1d666e);}})[_0x44b8('0x13')](function(_0xae9b10){if(_0xae9b10){_0x470f90=_0xae9b10[_0x44b8('0x37')];if(!_0x35d46c[_0x44b8('0x32')][_0x44b8('0x4a')]('nolimit')){_0x1d666e[_0x44b8('0x10')]=qs[_0x44b8('0x10')](_0x35d46c['query'][_0x44b8('0x10')]);_0x1d666e[_0x44b8('0xf')]=qs[_0x44b8('0xf')](_0x35d46c[_0x44b8('0x32')]['offset']);}return _0x1e608f[_0x44b8('0x55')](_0x1d666e);}})['then'](function(_0x4464d3){if(_0x4464d3){return _0x4464d3?{'count':_0x470f90,'rows':_0x4464d3}:null;}})[_0x44b8('0x13')](respondWithResult(_0x2d4a8a,null))[_0x44b8('0x2d')](handleError(_0x2d4a8a,null));};exports[_0x44b8('0x57')]=function(_0x45ff62,_0x343c5c){var _0x3cb290=_0x45ff62[_0x44b8('0x3c')]['teams'];var _0x2d27bf=_[_0x44b8('0x1b')](_0x3cb290,'id');return db[_0x44b8('0x56')][_0x44b8('0x2b')]({'where':{'id':_0x2d27bf},'attributes':['id'],'include':[{'model':db[_0x44b8('0x58')],'as':_0x44b8('0x59'),'attributes':['id','name','online',_0x44b8('0x5a'),_0x44b8('0x5b')],'raw':!![]}]})['then'](function(_0x41f732){if(_0x41f732){var _0x16074e=_['flatMap'](_0x41f732,function(_0x1ec23e){var _0x3208b4=_0x1ec23e[_0x44b8('0x14')]({'plain':!![]});_0x3208b4[_0x44b8('0x59')][_0x44b8('0x5c')](function(_0x43f416){_0x43f416[_0x44b8('0x5d')]=_[_0x44b8('0x1e')](_0x3cb290,{'id':_0x3208b4['id']})[_0x44b8('0x5d')];});return _0x3208b4[_0x44b8('0x59')];});return db[_0x44b8('0x29')][_0x44b8('0x1e')]({'where':{'id':_0x45ff62[_0x44b8('0x2f')]['id']}})[_0x44b8('0x13')](function(_0x15365d){return db['sequelize'][_0x44b8('0x5e')](function(_0x3d92a9){return _0x15365d[_0x44b8('0x57')](_0x2d27bf,{'transaction':_0x3d92a9})[_0x44b8('0x13')](function(){return BPromise['each'](_0x3cb290,function(_0x611876){return db[_0x44b8('0x5f')]['upsert']({'TeamId':_0x611876['id'],'VoiceQueueId':_0x45ff62[_0x44b8('0x2f')]['id'],'penalty':_0x611876['penalty']},{'transaction':_0x3d92a9});});})[_0x44b8('0x13')](function(){return BPromise[_0x44b8('0x60')](_0x16074e,function(_0x5a508f){return db[_0x44b8('0x61')]['findOrCreate']({'where':{'UserId':_0x5a508f['id'],'VoiceQueueId':_0x45ff62['params']['id']},'defaults':{'penalty':_0x5a508f[_0x44b8('0x5d')]},'transaction':_0x3d92a9});});})[_0x44b8('0x13')](function(){return BPromise['each'](_['filter'](_0x16074e,{'online':!![]}),function(_0x52af57){return db[_0x44b8('0x62')][_0x44b8('0x63')]({'membername':_0x52af57[_0x44b8('0x21')],'UserId':_0x52af57['id'],'queue_name':_0x15365d['name'],'VoiceQueueId':_0x15365d['id'],'interface':_['isNil'](_0x52af57[_0x44b8('0x5b')])?util[_0x44b8('0x64')](_0x44b8('0x65'),_0x52af57[_0x44b8('0x21')]):_0x52af57[_0x44b8('0x5b')],'paused':_0x52af57[_0x44b8('0x5a')]||![],'penalty':_0x52af57[_0x44b8('0x5d')]},{'transaction':_0x3d92a9});});})[_0x44b8('0x13')](function(){_0x16074e[_0x44b8('0x5c')](function(_0x4ed62f){socket[_0x44b8('0x66')]('userVoiceQueue:save',{'UserId':_0x4ed62f['id'],'VoiceQueueId':_0x15365d['id']});});});});});}})[_0x44b8('0x13')](respondWithStatusCode(_0x343c5c,null))['catch'](handleError(_0x343c5c,null));};exports['removeTeams']=function(_0x1fb070,_0x224071){return db[_0x44b8('0x56')][_0x44b8('0x2b')]({'where':{'id':_0x1fb070[_0x44b8('0x32')][_0x44b8('0x67')]},'attributes':['id'],'include':[{'model':db[_0x44b8('0x58')],'as':_0x44b8('0x59'),'attributes':['id'],'raw':!![]}]})[_0x44b8('0x13')](handleEntityNotFound(_0x224071,null))['then'](function(_0x1eb0a8){var _0x1e3b5f=_[_0x44b8('0x1b')](_0x1eb0a8,'id');var _0x536d1d=[];var _0x5bc747=[];var _0x3e44ea=squel['select']();_0x3e44ea[_0x44b8('0x68')]('tq.TeamId')[_0x44b8('0x69')]('team_has_voice_queues','tq')['join'](_0x44b8('0x6a'),'ut',_0x44b8('0x6b'))['where'](_0x44b8('0x6c'),_0x1fb070[_0x44b8('0x2f')]['id']);for(var _0x276dfc=0x0;_0x276dfc<_0x1eb0a8[_0x44b8('0x37')];_0x276dfc+=0x1){let _0x291617=_0x1eb0a8[_0x276dfc];for(var _0x57b73f=0x0;_0x57b73f<_0x291617[_0x44b8('0x59')]['length'];_0x57b73f+=0x1){let _0x595af5=_0x291617['Agents'][_0x57b73f];var _0x3015f9=_0x3e44ea[_0x44b8('0x44')]();_0x3015f9['where'](_0x44b8('0x6d'),_0x595af5['id']);_0x5bc747[_0x44b8('0x6e')](db['sequelize']['query'](_0x3015f9[_0x44b8('0x6f')](),{'type':db[_0x44b8('0x70')]['QueryTypes'][_0x44b8('0x71')]})[_0x44b8('0x13')](function(_0x5e2d3b){if(_0x5e2d3b[_0x44b8('0x37')]===0x1){return _0x595af5['id'];}else{var _0x97f4=_['every'](_[_0x44b8('0x1b')](_0x5e2d3b,_0x44b8('0x72')),function(_0xdb42f2){return _['includes'](_0x1e3b5f,_0xdb42f2);});if(_0x97f4){return _0x595af5['id'];}}}));}}return BPromise[_0x44b8('0x73')](_0x5bc747)['then'](function(_0x2ea49d){_0x536d1d=_(_0x536d1d)['union'](_0x2ea49d)['compact']()[_0x44b8('0x1c')]();return db[_0x44b8('0x29')][_0x44b8('0x1e')]({'where':{'id':_0x1fb070[_0x44b8('0x2f')]['id']}})[_0x44b8('0x13')](function(_0x1db2cf){return db[_0x44b8('0x70')][_0x44b8('0x5e')](function(_0x1b7826){return _0x1db2cf[_0x44b8('0x74')](_0x1fb070[_0x44b8('0x32')]['ids'],{'transaction':_0x1b7826})[_0x44b8('0x13')](function(){if(!_[_0x44b8('0x75')](_0x536d1d)){return _0x1db2cf[_0x44b8('0x76')](_0x536d1d,{'transaction':_0x1b7826})[_0x44b8('0x13')](function(){return db[_0x44b8('0x62')][_0x44b8('0x12')]({'where':{'VoiceQueueId':_0x1fb070[_0x44b8('0x2f')]['id'],'UserId':_0x536d1d},'transaction':_0x1b7826});});}})[_0x44b8('0x13')](function(){_0x536d1d['forEach'](function(_0x4234bc){socket[_0x44b8('0x66')]('userVoiceQueue:remove',{'UserId':_0x4234bc,'VoiceQueueId':_0x1db2cf['id']});});});});});});})[_0x44b8('0x13')](respondWithStatusCode(_0x224071,null))[_0x44b8('0x2d')](handleError(_0x224071,null));};exports[_0x44b8('0x77')]=function(_0x5596c0,_0x4b2b8f){var _0x18cd30,_0x133da8;return db['VoiceQueue']['find']({'where':{'id':_0x5596c0[_0x44b8('0x2f')]['id']}})[_0x44b8('0x13')](handleEntityNotFound(_0x4b2b8f,null))[_0x44b8('0x13')](function(_0x2bccf9){if(_0x2bccf9){_0x133da8=_0x2bccf9;return _0x2bccf9[_0x44b8('0x77')](_0x5596c0['body'][_0x44b8('0x67')],_['omit'](_0x5596c0[_0x44b8('0x3c')],[_0x44b8('0x67'),'id'])||{})[_0x44b8('0x78')](function(_0x156a60){for(var _0x3cbec9=0x0;_0x3cbec9<_0x5596c0[_0x44b8('0x3c')]['ids'][_0x44b8('0x37')];_0x3cbec9+=0x1){socket['emit'](_0x44b8('0x79'),{'UserId':Number(_0x5596c0[_0x44b8('0x3c')]['ids'][_0x3cbec9]),'VoiceQueueId':Number(_0x5596c0[_0x44b8('0x2f')]['id'])});}return _0x156a60;});}})['then'](function(_0x42b0c9){_0x18cd30=_0x42b0c9||[];if(_0x133da8){return db[_0x44b8('0x58')][_0x44b8('0x2b')]({'where':{'id':_0x5596c0['body'][_0x44b8('0x67')]},'attributes':['id',_0x44b8('0x21'),'online',_0x44b8('0x5a'),'interface'],'raw':!![]});}})['then'](function(_0x4220b5){if(!_['isEmpty'](_0x4220b5)){var _0x336436=[];for(var _0x51add5=0x0;_0x51add5<_0x4220b5[_0x44b8('0x37')];_0x51add5++){if(_0x4220b5[_0x51add5][_0x44b8('0x7a')]){_0x336436['push'](db[_0x44b8('0x62')][_0x44b8('0x63')]({'membername':_0x4220b5[_0x51add5]['name'],'UserId':_0x4220b5[_0x51add5]['id'],'queue_name':_0x133da8['name'],'VoiceQueueId':_0x133da8['id'],'interface':_[_0x44b8('0x7b')](_0x4220b5[_0x51add5][_0x44b8('0x5b')])?util[_0x44b8('0x64')](_0x44b8('0x65'),_0x4220b5[_0x51add5]['name']):_0x4220b5[_0x51add5][_0x44b8('0x5b')],'paused':_0x4220b5[_0x51add5][_0x44b8('0x5a')]||![],'penalty':_0x5596c0[_0x44b8('0x3c')][_0x44b8('0x5d')]||0x0}));}}return BPromise['all'](_0x336436);}})['then'](function(){return _0x18cd30;})[_0x44b8('0x13')](respondWithResult(_0x4b2b8f,null))[_0x44b8('0x2d')](handleError(_0x4b2b8f,null));};exports[_0x44b8('0x76')]=function(_0x4cf4a0,_0x1443bd){return db[_0x44b8('0x29')]['find']({'where':{'id':_0x4cf4a0[_0x44b8('0x2f')]['id']}})[_0x44b8('0x13')](handleEntityNotFound(_0x1443bd,null))[_0x44b8('0x13')](function(_0x2cb698){if(_0x2cb698){return _0x2cb698[_0x44b8('0x76')](_0x4cf4a0[_0x44b8('0x32')]['ids'])['then'](function(){if(_[_0x44b8('0x7c')](_0x4cf4a0['query'][_0x44b8('0x67')])){for(var _0x4dc333=0x0;_0x4dc333<_0x4cf4a0[_0x44b8('0x32')][_0x44b8('0x67')][_0x44b8('0x37')];_0x4dc333+=0x1){socket[_0x44b8('0x66')](_0x44b8('0x7d'),{'UserId':Number(_0x4cf4a0[_0x44b8('0x32')][_0x44b8('0x67')][_0x4dc333]),'VoiceQueueId':Number(_0x4cf4a0[_0x44b8('0x2f')]['id'])});}}else{socket[_0x44b8('0x66')](_0x44b8('0x7d'),{'UserId':Number(_0x4cf4a0[_0x44b8('0x32')][_0x44b8('0x67')]),'VoiceQueueId':Number(_0x4cf4a0[_0x44b8('0x2f')]['id'])});}});}})[_0x44b8('0x13')](function(_0x4026d7){return db[_0x44b8('0x62')]['destroy']({'where':{'VoiceQueueId':_0x4cf4a0[_0x44b8('0x2f')]['id'],'UserId':_0x4cf4a0['query'][_0x44b8('0x67')]}})[_0x44b8('0x13')](function(){return _0x4026d7;});})[_0x44b8('0x13')](respondWithStatusCode(_0x1443bd,null))[_0x44b8('0x2d')](handleError(_0x1443bd,null));};exports[_0x44b8('0x7e')]=function(_0x22e5ae,_0x2f3340){var _0x4d98de={};var _0x597139={};var _0x2fffd5;var _0x3c90c2;return db[_0x44b8('0x29')][_0x44b8('0x49')]({'where':{'id':_0x22e5ae[_0x44b8('0x2f')]['id']}})['then'](handleEntityNotFound(_0x2f3340,null))[_0x44b8('0x13')](function(_0x208c53){if(_0x208c53){_0x2fffd5=_0x208c53;_0x597139[_0x44b8('0x30')]=_[_0x44b8('0x31')](db[_0x44b8('0x58')][_0x44b8('0x24')]);_0x597139['query']=_[_0x44b8('0x31')](_0x22e5ae[_0x44b8('0x32')]);_0x597139[_0x44b8('0x33')]=_[_0x44b8('0x34')](_0x597139[_0x44b8('0x30')],_0x597139['query']);_0x4d98de['attributes']=_[_0x44b8('0x34')](_0x597139[_0x44b8('0x30')],qs['fields'](_0x22e5ae['query'][_0x44b8('0x36')]));_0x4d98de['attributes']=_0x4d98de[_0x44b8('0x35')][_0x44b8('0x37')]?_0x4d98de[_0x44b8('0x35')]:_0x597139[_0x44b8('0x30')];_0x4d98de[_0x44b8('0x4c')]=qs[_0x44b8('0x4d')](_0x22e5ae[_0x44b8('0x32')][_0x44b8('0x4d')]);_0x4d98de['where']=qs[_0x44b8('0x33')](_[_0x44b8('0x51')](_0x22e5ae[_0x44b8('0x32')],_0x597139['filters']));if(_0x22e5ae[_0x44b8('0x32')][_0x44b8('0x19')]){_0x4d98de['where']=_['merge'](_0x4d98de['where'],{'$or':_['map'](_0x4d98de[_0x44b8('0x35')],function(_0x5e423c){var _0x48065d={};_0x48065d[_0x5e423c]={'$like':'%'+_0x22e5ae[_0x44b8('0x32')][_0x44b8('0x19')]+'%'};return _0x48065d;})});}_0x4d98de=_[_0x44b8('0x39')]({},_0x4d98de,_0x22e5ae['options']);return _0x2fffd5[_0x44b8('0x7e')](_0x4d98de);}})['then'](function(_0x230407){if(_0x230407){_0x3c90c2=_0x230407[_0x44b8('0x37')];if(!_0x22e5ae[_0x44b8('0x32')][_0x44b8('0x4a')]('nolimit')){_0x4d98de[_0x44b8('0x10')]=qs[_0x44b8('0x10')](_0x22e5ae[_0x44b8('0x32')][_0x44b8('0x10')]);_0x4d98de['offset']=qs['offset'](_0x22e5ae[_0x44b8('0x32')][_0x44b8('0xf')]);}return _0x2fffd5['getAgents'](_0x4d98de);}})[_0x44b8('0x13')](function(_0x188744){if(_0x188744){return _0x188744?{'count':_0x3c90c2,'rows':_0x188744}:null;}})[_0x44b8('0x13')](respondWithResult(_0x2f3340,null))[_0x44b8('0x2d')](handleError(_0x2f3340,null));};exports[_0x44b8('0x7f')]=function(_0x2da727,_0x319520){var _0x2f7550={};var _0x57d24f={};var _0x223e54;var _0x3e5fa8;return db[_0x44b8('0x29')]['findOne']({'where':{'id':_0x2da727[_0x44b8('0x2f')]['id']}})['then'](handleEntityNotFound(_0x319520,null))[_0x44b8('0x13')](function(_0x5370a5){if(_0x5370a5){_0x223e54=_0x5370a5;_0x57d24f[_0x44b8('0x30')]=_[_0x44b8('0x31')](db[_0x44b8('0x62')][_0x44b8('0x24')]);_0x57d24f[_0x44b8('0x32')]=_[_0x44b8('0x31')](_0x2da727[_0x44b8('0x32')]);_0x57d24f[_0x44b8('0x33')]=_[_0x44b8('0x34')](_0x57d24f[_0x44b8('0x30')],_0x57d24f[_0x44b8('0x32')]);_0x2f7550[_0x44b8('0x35')]=_['intersection'](_0x57d24f[_0x44b8('0x30')],qs['fields'](_0x2da727[_0x44b8('0x32')]['fields']));_0x2f7550[_0x44b8('0x35')]=_0x2f7550[_0x44b8('0x35')][_0x44b8('0x37')]?_0x2f7550[_0x44b8('0x35')]:_0x57d24f[_0x44b8('0x30')];_0x2f7550[_0x44b8('0x4c')]=qs[_0x44b8('0x4d')](_0x2da727['query'][_0x44b8('0x4d')]);_0x2f7550[_0x44b8('0x28')]=qs[_0x44b8('0x33')](_[_0x44b8('0x51')](_0x2da727[_0x44b8('0x32')],_0x57d24f[_0x44b8('0x33')]));if(_0x2da727[_0x44b8('0x32')][_0x44b8('0x19')]){_0x2f7550[_0x44b8('0x28')]=_[_0x44b8('0x39')](_0x2f7550[_0x44b8('0x28')],{'$or':_[_0x44b8('0x1b')](_0x2f7550[_0x44b8('0x35')],function(_0x4281a6){var _0x4bb399={};_0x4bb399[_0x4281a6]={'$like':'%'+_0x2da727[_0x44b8('0x32')][_0x44b8('0x19')]+'%'};return _0x4bb399;})});}_0x2f7550=_['merge']({},_0x2f7550,_0x2da727[_0x44b8('0x3a')]);return _0x223e54[_0x44b8('0x7f')](_0x2f7550);}})[_0x44b8('0x13')](function(_0x1f389e){if(_0x1f389e){_0x3e5fa8=_0x1f389e[_0x44b8('0x37')];if(!_0x2da727['query'][_0x44b8('0x4a')](_0x44b8('0x4b'))){_0x2f7550[_0x44b8('0x10')]=qs[_0x44b8('0x10')](_0x2da727['query'][_0x44b8('0x10')]);_0x2f7550[_0x44b8('0xf')]=qs['offset'](_0x2da727['query']['offset']);}return _0x223e54['getMembers'](_0x2f7550);}})[_0x44b8('0x13')](function(_0x5824a8){return _0x5824a8?{'count':_0x3e5fa8,'rows':_0x5824a8}:null;})['then'](respondWithResult(_0x319520,null))[_0x44b8('0x2d')](handleError(_0x319520,null));};exports[_0x44b8('0x80')]=function(_0x87a38,_0x54adf9){var _0x44dc3d={};var _0x32dafb={};var _0x3c8e0c;var _0x21ea61;return db['VoiceQueue'][_0x44b8('0x49')]({'where':{'id':_0x87a38['params']['id']}})[_0x44b8('0x13')](handleEntityNotFound(_0x54adf9,null))[_0x44b8('0x13')](function(_0x56cfa5){if(_0x56cfa5){_0x3c8e0c=_0x56cfa5;_0x32dafb[_0x44b8('0x30')]=_[_0x44b8('0x31')](db[_0x44b8('0x81')][_0x44b8('0x24')]);_0x32dafb[_0x44b8('0x32')]=_['keys'](_0x87a38['query']);_0x32dafb[_0x44b8('0x33')]=_[_0x44b8('0x34')](_0x32dafb[_0x44b8('0x30')],_0x32dafb[_0x44b8('0x32')]);_0x44dc3d[_0x44b8('0x35')]=_[_0x44b8('0x34')](_0x32dafb[_0x44b8('0x30')],qs[_0x44b8('0x36')](_0x87a38[_0x44b8('0x32')][_0x44b8('0x36')]));_0x44dc3d[_0x44b8('0x35')]=_0x44dc3d[_0x44b8('0x35')]['length']?_0x44dc3d['attributes']:_0x32dafb[_0x44b8('0x30')];_0x44dc3d['order']=qs[_0x44b8('0x4d')](_0x87a38[_0x44b8('0x32')][_0x44b8('0x4d')]);_0x44dc3d['where']=qs[_0x44b8('0x33')](_[_0x44b8('0x51')](_0x87a38[_0x44b8('0x32')],_0x32dafb[_0x44b8('0x33')]));if(_0x87a38[_0x44b8('0x32')][_0x44b8('0x19')]){_0x44dc3d['where']=_[_0x44b8('0x39')](_0x44dc3d[_0x44b8('0x28')],{'$or':_['map'](_0x44dc3d[_0x44b8('0x35')],function(_0x1ffa05){var _0x22edd7={};_0x22edd7[_0x1ffa05]={'$like':'%'+_0x87a38[_0x44b8('0x32')][_0x44b8('0x19')]+'%'};return _0x22edd7;})});}_0x44dc3d=_['merge']({},_0x44dc3d,_0x87a38[_0x44b8('0x3a')]);return _0x3c8e0c[_0x44b8('0x80')](_0x44dc3d);}})[_0x44b8('0x13')](function(_0x2fca1a){if(_0x2fca1a){_0x21ea61=_0x2fca1a[_0x44b8('0x37')];if(!_0x87a38[_0x44b8('0x32')][_0x44b8('0x4a')](_0x44b8('0x4b'))){_0x44dc3d[_0x44b8('0x10')]=qs[_0x44b8('0x10')](_0x87a38['query'][_0x44b8('0x10')]);_0x44dc3d[_0x44b8('0xf')]=qs[_0x44b8('0xf')](_0x87a38['query']['offset']);}return _0x3c8e0c[_0x44b8('0x80')](_0x44dc3d);}})['then'](function(_0x9458fb){if(_0x9458fb){return _0x9458fb?{'count':_0x21ea61,'rows':_0x9458fb}:null;}})[_0x44b8('0x13')](respondWithResult(_0x54adf9,null))[_0x44b8('0x2d')](handleError(_0x54adf9,null));};exports[_0x44b8('0x82')]=function(_0x2eb6ce,_0x105ca0){var _0x25f364=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');var _0x77c009,_0x161362;return db[_0x44b8('0x29')][_0x44b8('0x1e')]({'where':{'id':_0x2eb6ce[_0x44b8('0x2f')]['id']}})[_0x44b8('0x13')](handleEntityNotFound(_0x105ca0,null))['then'](function(_0x4d88a6){if(_0x4d88a6){_0x161362=_0x4d88a6;return _0x4d88a6[_0x44b8('0x82')](_0x2eb6ce[_0x44b8('0x3c')][_0x44b8('0x67')],_[_0x44b8('0x45')](_0x2eb6ce[_0x44b8('0x3c')],[_0x44b8('0x67'),'id'])||{});}return null;})[_0x44b8('0x78')](function(_0x4b49df){var _0xbf96c1;_0x77c009=_0x4b49df||[];var _0x1f6244=[];if(_0x4b49df){for(var _0x96a3cd=0x0;_0x96a3cd<_0x4b49df['length'];_0x96a3cd+=0x1){var _0x16721d=_0x4b49df[_0x96a3cd][_0x44b8('0x14')]({'plain':!![]});_0x161362[_0x44b8('0x83')]=_0x2eb6ce[_0x44b8('0x3c')]['dialCheckDuplicateType']?_0x2eb6ce[_0x44b8('0x3c')][_0x44b8('0x83')]:_0x161362[_0x44b8('0x83')];switch(_0x161362['dialCheckDuplicateType']){case'always':_0xbf96c1=squel['insert']()['into']('cm_hopper')[_0x44b8('0x84')]([_0x44b8('0x85'),_0x44b8('0x86'),_0x44b8('0x87'),_0x44b8('0x88'),_0x44b8('0x4e'),_0x44b8('0x46'),_0x44b8('0x47')],squel[_0x44b8('0x89')]()[_0x44b8('0x68')](_0x44b8('0x85'),'phone')[_0x44b8('0x68')]('\x27'+_0x25f364+'\x27',_0x44b8('0x86'))[_0x44b8('0x68')]('id',_0x44b8('0x87'))[_0x44b8('0x68')](_0x16721d['CmListId'][_0x44b8('0x6f')](),'ListId')[_0x44b8('0x68')](_0x2eb6ce[_0x44b8('0x2f')]['id'][_0x44b8('0x6f')](),'VoiceQueueId')[_0x44b8('0x68')]('\x27'+_0x25f364+'\x27',_0x44b8('0x46'))['field']('\x27'+_0x25f364+'\x27',_0x44b8('0x47'))[_0x44b8('0x69')](_0x44b8('0x8a'))['where'](_0x44b8('0x8b'))['where'](_0x44b8('0x8c'),_0x16721d[_0x44b8('0x8d')][_0x44b8('0x6f')]())['where'](_0x44b8('0x8e'))['where'](_0x44b8('0x8f'),squel[_0x44b8('0x89')]()[_0x44b8('0x68')](_0x44b8('0x90'))[_0x44b8('0x69')](_0x44b8('0x91'))['where'](_0x44b8('0x6c'),_0x2eb6ce[_0x44b8('0x2f')]['id'][_0x44b8('0x6f')]()))[_0x44b8('0x28')]('phone\x20NOT\x20IN\x20(?)',squel[_0x44b8('0x89')]()[_0x44b8('0x68')](_0x44b8('0x92'))[_0x44b8('0x69')](_0x44b8('0x93'))[_0x44b8('0x28')](_0x44b8('0x6c'),_0x2eb6ce[_0x44b8('0x2f')]['id'][_0x44b8('0x6f')]())))[_0x44b8('0x6f')]();break;case _0x44b8('0x94'):_0xbf96c1=squel[_0x44b8('0x95')]()['into'](_0x44b8('0x93'))[_0x44b8('0x84')]([_0x44b8('0x85'),_0x44b8('0x86'),'ContactId',_0x44b8('0x88'),'VoiceQueueId',_0x44b8('0x46'),_0x44b8('0x47')],squel[_0x44b8('0x89')]()['field'](_0x44b8('0x85'),_0x44b8('0x85'))[_0x44b8('0x68')]('\x27'+_0x25f364+'\x27',_0x44b8('0x86'))[_0x44b8('0x68')]('id','ContactId')[_0x44b8('0x68')](_0x16721d[_0x44b8('0x8d')][_0x44b8('0x6f')](),_0x44b8('0x88'))[_0x44b8('0x68')](_0x2eb6ce['params']['id'][_0x44b8('0x6f')](),_0x44b8('0x4e'))[_0x44b8('0x68')]('\x27'+_0x25f364+'\x27',_0x44b8('0x46'))[_0x44b8('0x68')]('\x27'+_0x25f364+'\x27',_0x44b8('0x47'))[_0x44b8('0x69')]('cm_contacts')['where']('deletedAt\x20IS\x20NULL')[_0x44b8('0x28')](_0x44b8('0x8c'),_0x16721d[_0x44b8('0x8d')]['toString']())['where'](_0x44b8('0x8e'))[_0x44b8('0x28')](_0x44b8('0x8f'),squel[_0x44b8('0x89')]()[_0x44b8('0x68')]('COALESCE(phone,\x27\x27)')['from']('cm_hopper')['where'](_0x44b8('0x6c'),_0x2eb6ce[_0x44b8('0x2f')]['id'][_0x44b8('0x6f')]())))[_0x44b8('0x6f')]();break;default:_0xbf96c1=squel[_0x44b8('0x95')]()[_0x44b8('0x96')]('cm_hopper')[_0x44b8('0x84')](['phone',_0x44b8('0x86'),_0x44b8('0x87'),_0x44b8('0x88'),'VoiceQueueId','createdAt',_0x44b8('0x47')],squel[_0x44b8('0x89')]()['field']('phone',_0x44b8('0x85'))[_0x44b8('0x68')]('\x27'+_0x25f364+'\x27',_0x44b8('0x86'))[_0x44b8('0x68')]('id',_0x44b8('0x87'))['field'](_0x16721d[_0x44b8('0x8d')][_0x44b8('0x6f')](),_0x44b8('0x88'))[_0x44b8('0x68')](_0x2eb6ce[_0x44b8('0x2f')]['id'][_0x44b8('0x6f')](),_0x44b8('0x4e'))['field']('\x27'+_0x25f364+'\x27',_0x44b8('0x46'))[_0x44b8('0x68')]('\x27'+_0x25f364+'\x27',_0x44b8('0x47'))[_0x44b8('0x69')](_0x44b8('0x8a'))[_0x44b8('0x28')]('deletedAt\x20IS\x20NULL')[_0x44b8('0x28')](_0x44b8('0x8c'),_0x16721d[_0x44b8('0x8d')][_0x44b8('0x6f')]())['where'](_0x44b8('0x8e')))[_0x44b8('0x6f')]();}_0x1f6244[_0x44b8('0x6e')](db[_0x44b8('0x70')]['query'](_0xbf96c1));}return BPromise['all'](_0x1f6244);}})[_0x44b8('0x13')](function(){var _0x2ad4ab=[];var _0x196b4b=squel[_0x44b8('0x95')]()[_0x44b8('0x96')]('cm_hopper_additional_phones')[_0x44b8('0x84')]([_0x44b8('0x97'),_0x44b8('0x85'),_0x44b8('0x98'),_0x44b8('0x46'),_0x44b8('0x47')],squel['select']()[_0x44b8('0x68')](_0x44b8('0x99'))[_0x44b8('0x68')](_0x44b8('0x9a'))[_0x44b8('0x68')](_0x44b8('0x9b'))[_0x44b8('0x68')]('\x27'+_0x25f364+'\x27','createdAt')[_0x44b8('0x68')]('\x27'+_0x25f364+'\x27',_0x44b8('0x47'))[_0x44b8('0x69')](_0x44b8('0x9c'),'ci')['join'](_0x44b8('0x93'),'h','h.ContactId=ci.CmContactId')[_0x44b8('0x28')](_0x44b8('0x9d'),_0x25f364)[_0x44b8('0x28')](_0x44b8('0x9e'),'PHONE'))[_0x44b8('0x6f')]();_0x2ad4ab[_0x44b8('0x6e')](db[_0x44b8('0x70')]['query'](_0x196b4b));return BPromise[_0x44b8('0x73')](_0x2ad4ab);})[_0x44b8('0x13')](function(){return _0x77c009;})[_0x44b8('0x13')](respondWithResult(_0x105ca0,null))[_0x44b8('0x2d')](handleError(_0x105ca0,null));};exports[_0x44b8('0x9f')]=function(_0x257702,_0x17560c){return db[_0x44b8('0x29')][_0x44b8('0x1e')]({'where':{'id':_0x257702[_0x44b8('0x2f')]['id']}})['then'](handleEntityNotFound(_0x17560c,null))[_0x44b8('0x13')](function(_0x4d11d5){if(_0x4d11d5){return _0x4d11d5[_0x44b8('0x9f')](_0x257702[_0x44b8('0x32')][_0x44b8('0x67')]);}})[_0x44b8('0x13')](function(_0xafca17){if(_0xafca17){return db['CmHopper']['destroy']({'where':{'ListId':_0x257702['query'][_0x44b8('0x67')],'VoiceQueueId':_0x257702[_0x44b8('0x2f')]['id']}})[_0x44b8('0x13')](function(){return _0xafca17;});}})[_0x44b8('0x13')](respondWithStatusCode(_0x17560c,null))[_0x44b8('0x2d')](handleError(_0x17560c,null));};exports[_0x44b8('0xa0')]=function(_0x513302,_0xfdb408){var _0x119dda={};var _0x5834fe={};var _0xe5cc1e;var _0x4c55e6;return db[_0x44b8('0x29')][_0x44b8('0x49')]({'where':{'id':_0x513302['params']['id']}})[_0x44b8('0x13')](handleEntityNotFound(_0xfdb408,null))[_0x44b8('0x13')](function(_0x537eab){if(_0x537eab){_0xe5cc1e=_0x537eab;_0x5834fe[_0x44b8('0x30')]=_[_0x44b8('0x31')](db[_0x44b8('0x81')][_0x44b8('0x24')]);_0x5834fe['query']=_[_0x44b8('0x31')](_0x513302[_0x44b8('0x32')]);_0x5834fe[_0x44b8('0x33')]=_[_0x44b8('0x34')](_0x5834fe[_0x44b8('0x30')],_0x5834fe[_0x44b8('0x32')]);_0x119dda[_0x44b8('0x35')]=_['intersection'](_0x5834fe[_0x44b8('0x30')],qs[_0x44b8('0x36')](_0x513302[_0x44b8('0x32')]['fields']));_0x119dda[_0x44b8('0x35')]=_0x119dda[_0x44b8('0x35')]['length']?_0x119dda[_0x44b8('0x35')]:_0x5834fe[_0x44b8('0x30')];_0x119dda[_0x44b8('0x4c')]=qs[_0x44b8('0x4d')](_0x513302['query'][_0x44b8('0x4d')]);_0x119dda[_0x44b8('0x28')]=qs[_0x44b8('0x33')](_[_0x44b8('0x51')](_0x513302[_0x44b8('0x32')],_0x5834fe['filters']));if(_0x513302[_0x44b8('0x32')][_0x44b8('0x19')]){_0x119dda['where']=_[_0x44b8('0x39')](_0x119dda[_0x44b8('0x28')],{'$or':_[_0x44b8('0x1b')](_0x119dda[_0x44b8('0x35')],function(_0x4e9376){var _0x25f31c={};_0x25f31c[_0x4e9376]={'$like':'%'+_0x513302[_0x44b8('0x32')][_0x44b8('0x19')]+'%'};return _0x25f31c;})});}_0x119dda=_[_0x44b8('0x39')]({},_0x119dda,_0x513302[_0x44b8('0x3a')]);return _0xe5cc1e[_0x44b8('0xa0')](_0x119dda);}})[_0x44b8('0x13')](function(_0x57e3c9){if(_0x57e3c9){_0x4c55e6=_0x57e3c9[_0x44b8('0x37')];if(!_0x513302[_0x44b8('0x32')][_0x44b8('0x4a')](_0x44b8('0x4b'))){_0x119dda['limit']=qs[_0x44b8('0x10')](_0x513302[_0x44b8('0x32')][_0x44b8('0x10')]);_0x119dda['offset']=qs['offset'](_0x513302[_0x44b8('0x32')][_0x44b8('0xf')]);}return _0xe5cc1e[_0x44b8('0xa0')](_0x119dda);}})[_0x44b8('0x13')](function(_0x4a5916){if(_0x4a5916){return _0x4a5916?{'count':_0x4c55e6,'rows':_0x4a5916}:null;}})[_0x44b8('0x13')](respondWithResult(_0xfdb408,null))[_0x44b8('0x2d')](handleError(_0xfdb408,null));};exports['addBlackLists']=function(_0xd19a35,_0x2439f2){var _0x22a624;return db['VoiceQueue'][_0x44b8('0x1e')]({'where':{'id':_0xd19a35[_0x44b8('0x2f')]['id']}})[_0x44b8('0x13')](handleEntityNotFound(_0x2439f2,null))[_0x44b8('0x13')](function(_0x14c021){if(_0x14c021){return _0x14c021['addBlackLists'](_0xd19a35[_0x44b8('0x3c')][_0x44b8('0x67')],_['omit'](_0xd19a35[_0x44b8('0x3c')],[_0x44b8('0x67'),'id'])||{});}return null;})[_0x44b8('0x78')](function(_0x3b9cd2){var _0xb6cadf;_0x22a624=_0x3b9cd2||[];var _0x2024eb=[];if(_0x3b9cd2){for(var _0x29af58=0x0;_0x29af58<_0x3b9cd2[_0x44b8('0x37')];_0x29af58+=0x1){var _0x3870a9=_0x3b9cd2[_0x29af58]['get']({'plain':!![]});_0xb6cadf=squel['insert']()['into']('cm_hopper_black')[_0x44b8('0x84')]([_0x44b8('0x85'),'ContactId',_0x44b8('0x88'),_0x44b8('0x4e'),_0x44b8('0x46'),_0x44b8('0x47')],squel[_0x44b8('0x89')]()[_0x44b8('0x68')]('phone',_0x44b8('0x85'))['field']('id','ContactId')[_0x44b8('0x68')](_0x3870a9[_0x44b8('0x8d')][_0x44b8('0x6f')](),_0x44b8('0x88'))[_0x44b8('0x68')](_0xd19a35['params']['id'][_0x44b8('0x6f')](),_0x44b8('0x4e'))[_0x44b8('0x68')](_0x44b8('0xa1'),_0x44b8('0x46'))[_0x44b8('0x68')](_0x44b8('0xa1'),'updatedAt')[_0x44b8('0x69')](_0x44b8('0x8a'))[_0x44b8('0x28')]('deletedAt\x20IS\x20NULL')[_0x44b8('0x28')](_0x44b8('0x8c'),_0x3870a9[_0x44b8('0x8d')][_0x44b8('0x6f')]())[_0x44b8('0x28')](_0x44b8('0x8e')))[_0x44b8('0x6f')]();_0x2024eb[_0x44b8('0x6e')](db['sequelize'][_0x44b8('0x32')](_0xb6cadf));}return BPromise[_0x44b8('0x73')](_0x2024eb);}})[_0x44b8('0x13')](function(){return _0x22a624;})[_0x44b8('0x13')](respondWithResult(_0x2439f2,null))[_0x44b8('0x2d')](handleError(_0x2439f2,null));};exports[_0x44b8('0xa2')]=function(_0x4ec799,_0x3fa943){return db[_0x44b8('0x29')]['find']({'where':{'id':_0x4ec799[_0x44b8('0x2f')]['id']}})[_0x44b8('0x13')](handleEntityNotFound(_0x3fa943,null))[_0x44b8('0x13')](function(_0x3b1643){if(_0x3b1643){return _0x3b1643['removeBlackLists'](_0x4ec799[_0x44b8('0x32')]['ids']);}})['then'](function(_0x9a5734){if(_0x9a5734){return db[_0x44b8('0x54')][_0x44b8('0x12')]({'where':{'ListId':_0x4ec799[_0x44b8('0x32')][_0x44b8('0x67')],'VoiceQueueId':_0x4ec799['params']['id']}})['then'](function(){return _0x9a5734;});}})['then'](respondWithStatusCode(_0x3fa943,null))[_0x44b8('0x2d')](handleError(_0x3fa943,null));}; \ No newline at end of file +var _0xe14b=['QueueCampaigns','outbound','filter','map','value','type','find','name','end','error','stack','index','VoiceQueue','rawAttributes','fieldName','key','getOptions','where','include','show','params','model','keys','query','intersection','attributes','fields','length','includeAll','options','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','VoiceQueues','UserProfileSection','autoAssociation','UserProfileResource','clone','merge','omit','createdAt','updatedAt','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getHoppers','CmHopper','filters','hasOwnProperty','nolimit','order','sort','pick','VoiceQueueId','findAll','rows','getHopperHistories','findOne','CmHopperHistory','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','getTeams','Team','addTeams','Agents','online','interface','flatMap','penalty','sequelize','UserVoiceQueue','UserVoiceQueueRt','upsert','isNil','format','voicePause','forEach','emit','userVoiceQueue:save','ids','User','select','field','tq.TeamId','from','team_has_voice_queues','join','VoiceQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','all','compact','transaction','removeTeams','isEmpty','removeAgents','userVoiceQueue:remove','addAgents','spread','isArray','getAgents','getMembers','getLists','CmList','addLists','dialCheckDuplicateType','insert','into','cm_hopper','fromQuery','phone','scheduledAt','ContactId','ListId','CmListId','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','COALESCE(phone,\x27\x27)','onlyIfOpen','cm_contacts','deletedAt\x20IS\x20NULL','cm_hopper_additional_phones','CmHopperId','OrderBy','ci.item','ci.OrderBy+1','cm_contact_has_items','h.scheduledat=?','ci.ItemClass=?','PHONE','removeLists','getBlackLists','cm_hopper_black','NOW()','removeBlackLists','moment','bluebird','squel','ioredis','../../config/logger','../../mysqldb','redis','defaults','localhost','socket.io-emitter','sendStatus','status','json','offset','undefined','limit','count','Content-Range','update','then','destroy','get','inbound'];(function(_0x419628,_0x421ece){var _0x57a110=function(_0x596e9a){while(--_0x596e9a){_0x419628['push'](_0x419628['shift']());}};_0x57a110(++_0x421ece);}(_0xe14b,0x93));var _0xbe14=function(_0x15990b,_0x54e348){_0x15990b=_0x15990b-0x0;var _0x3201ce=_0xe14b[_0x15990b];return _0x3201ce;};'use strict';var moment=require(_0xbe14('0x0'));var BPromise=require(_0xbe14('0x1'));var util=require('util');var _=require('lodash');var squel=require(_0xbe14('0x2'));var Redis=require(_0xbe14('0x3'));var qs=require('../../components/parsers/qs');var logger=require(_0xbe14('0x4'))('api');var config=require('../../config/environment');var db=require(_0xbe14('0x5'))['db'];config[_0xbe14('0x6')]=_[_0xbe14('0x7')](config[_0xbe14('0x6')],{'host':_0xbe14('0x8'),'port':0x18eb});var socket=require(_0xbe14('0x9'))(new Redis(config[_0xbe14('0x6')]));require('./voiceQueue.socket')['register'](socket);function respondWithStatusCode(_0x496063,_0x30c355){_0x30c355=_0x30c355||0xcc;return function(_0x6fceff){if(_0x6fceff){return _0x496063[_0xbe14('0xa')](_0x30c355);}return _0x496063[_0xbe14('0xb')](_0x30c355)['end']();};}function respondWithResult(_0x5b9fc6,_0x113243){_0x113243=_0x113243||0xc8;return function(_0x3f70cb){if(_0x3f70cb){return _0x5b9fc6['status'](_0x113243)[_0xbe14('0xc')](_0x3f70cb);}};}function respondWithFilteredResult(_0x35aa19,_0x886a5e){return function(_0x3d38c2){if(_0x3d38c2){var _0x27792f=typeof _0x886a5e[_0xbe14('0xd')]===_0xbe14('0xe')&&typeof _0x886a5e[_0xbe14('0xf')]===_0xbe14('0xe');var _0xa2cf72=_0x3d38c2[_0xbe14('0x10')];var _0x33fd54=_0x27792f?0x0:_0x886a5e[_0xbe14('0xd')];var _0x530538=_0x27792f?_0x3d38c2['count']:_0x886a5e[_0xbe14('0xd')]+_0x886a5e[_0xbe14('0xf')];var _0xf4ac9;if(_0x530538>=_0xa2cf72){_0x530538=_0xa2cf72;_0xf4ac9=0xc8;}else{_0xf4ac9=0xce;}_0x35aa19[_0xbe14('0xb')](_0xf4ac9);return _0x35aa19['set'](_0xbe14('0x11'),_0x33fd54+'-'+_0x530538+'/'+_0xa2cf72)[_0xbe14('0xc')](_0x3d38c2);}return null;};}function saveUpdates(_0xfd7b8f){return function(_0x123ede){if(_0x123ede){return _0x123ede[_0xbe14('0x12')](_0xfd7b8f)[_0xbe14('0x13')](function(_0x17ae86){return _0x17ae86;});}return null;};}function removeEntity(_0x5ea1f8){return function(_0x137ee5){if(_0x137ee5){return _0x137ee5[_0xbe14('0x14')]()[_0xbe14('0x13')](function(){var _0x433459=_0x137ee5[_0xbe14('0x15')]({'plain':!![]});var _0x37e4c1=[{'name':'VoiceQueues','value':_0xbe14('0x16'),'ignore':![]},{'name':_0xbe14('0x17'),'value':_0xbe14('0x18'),'ignore':![]}];var _0xc12977=_(_0x37e4c1)[_0xbe14('0x19')]('ignore')[_0xbe14('0x1a')]('value')[_0xbe14('0x1b')]();if(_['includes'](_0xc12977,_0x433459[_0xbe14('0x1c')])){return;}var _0x4a25fa=_[_0xbe14('0x1d')](_0x37e4c1,[_0xbe14('0x1b'),_0x433459['type']])[_0xbe14('0x1e')];return db['UserProfileResource'][_0xbe14('0x14')]({'where':{'type':_0x4a25fa,'resourceId':_0x433459['id']}})['then'](function(){return _0x137ee5;});})[_0xbe14('0x13')](function(){_0x5ea1f8[_0xbe14('0xb')](0xcc)[_0xbe14('0x1f')]();});}};}function handleEntityNotFound(_0x39cc81){return function(_0x15ef02){if(!_0x15ef02){_0x39cc81[_0xbe14('0xa')](0x194);}return _0x15ef02;};}function handleError(_0x55d001,_0x1822e0){_0x1822e0=_0x1822e0||0x1f4;return function(_0x1ba46a){logger[_0xbe14('0x20')](_0x1ba46a[_0xbe14('0x21')]);if(_0x1ba46a['name']){delete _0x1ba46a[_0xbe14('0x1e')];}_0x55d001[_0xbe14('0xb')](_0x1822e0)['send'](_0x1ba46a);};}exports[_0xbe14('0x22')]=function(_0x3b3e84,_0x1c7cc7){var _0x19252f={};var _0x34d648={'count':0x0,'rows':[]};var _0x36d4b2=_[_0xbe14('0x1a')](db[_0xbe14('0x23')][_0xbe14('0x24')],function(_0x16a159){return{'name':_0x16a159[_0xbe14('0x25')],'type':_0x16a159[_0xbe14('0x1c')][_0xbe14('0x26')]};});_0x19252f=qs[_0xbe14('0x27')](_0x36d4b2,_0x3b3e84);var _0x223f7a={'where':_0x19252f[_0xbe14('0x28')]};return db[_0xbe14('0x23')][_0xbe14('0x10')](_0x223f7a)[_0xbe14('0x13')](function(_0x14e7c4){_0x34d648['count']=_0x14e7c4;_0x19252f[_0xbe14('0x29')]=qs['include'](_0x3b3e84['query']);return db[_0xbe14('0x23')]['findAll'](_0x19252f);})[_0xbe14('0x13')](function(_0x345b0){_0x34d648['rows']=_0x345b0;return _0x34d648;})['then'](respondWithFilteredResult(_0x1c7cc7,_0x19252f))['catch'](handleError(_0x1c7cc7,null));};exports[_0xbe14('0x2a')]=function(_0xa3d24,_0x5f27b6){var _0x46c570={'raw':![],'where':{'id':_0xa3d24[_0xbe14('0x2b')]['id']}},_0x1faf3e={};_0x1faf3e[_0xbe14('0x2c')]=_[_0xbe14('0x2d')](db['VoiceQueue']['rawAttributes']);_0x1faf3e[_0xbe14('0x2e')]=_['keys'](_0xa3d24['query']);_0x1faf3e['filters']=_[_0xbe14('0x2f')](_0x1faf3e[_0xbe14('0x2c')],_0x1faf3e[_0xbe14('0x2e')]);_0x46c570[_0xbe14('0x30')]=_[_0xbe14('0x2f')](_0x1faf3e[_0xbe14('0x2c')],qs[_0xbe14('0x31')](_0xa3d24[_0xbe14('0x2e')][_0xbe14('0x31')]));_0x46c570[_0xbe14('0x30')]=_0x46c570[_0xbe14('0x30')][_0xbe14('0x32')]?_0x46c570['attributes']:_0x1faf3e['model'];if(_0xa3d24[_0xbe14('0x2e')][_0xbe14('0x33')]){_0x46c570[_0xbe14('0x29')]=[{'all':!![]}];}_0x46c570=_['merge']({},_0x46c570,_0xa3d24[_0xbe14('0x34')]);return db[_0xbe14('0x23')][_0xbe14('0x1d')](_0x46c570)[_0xbe14('0x13')](handleEntityNotFound(_0x5f27b6,null))[_0xbe14('0x13')](respondWithResult(_0x5f27b6,null))[_0xbe14('0x35')](handleError(_0x5f27b6,null));};exports[_0xbe14('0x36')]=function(_0x128843,_0x1b2608){return db['VoiceQueue'][_0xbe14('0x36')](_0x128843[_0xbe14('0x37')],{})[_0xbe14('0x13')](function(_0x1b3118){var _0x3287b9=_0x128843[_0xbe14('0x38')]['get']({'plain':!![]});if(!_0x3287b9)throw new Error(_0xbe14('0x39'));if(_0x3287b9[_0xbe14('0x3a')]===_0xbe14('0x38')){var _0x36263c=_0x1b3118['get']({'plain':!![]});var _0x4bfa96=[{'name':_0xbe14('0x3b'),'value':_0xbe14('0x16')},{'name':_0xbe14('0x17'),'value':'outbound'}];var _0x5d5318=_[_0xbe14('0x1d')](_0x4bfa96,['value',_0x36263c['type']])[_0xbe14('0x1e')];return db[_0xbe14('0x3c')][_0xbe14('0x1d')]({'where':{'name':_0x5d5318,'userProfileId':_0x3287b9['userProfileId']},'raw':!![]})['then'](function(_0x5aaa4f){if(_0x5aaa4f&&_0x5aaa4f[_0xbe14('0x3d')]===0x0){return db[_0xbe14('0x3e')][_0xbe14('0x36')]({'name':_0x36263c['name'],'resourceId':_0x36263c['id'],'type':_0x5aaa4f[_0xbe14('0x1e')],'sectionId':_0x5aaa4f['id']},{})[_0xbe14('0x13')](function(){return _0x1b3118;});}else{return _0x1b3118;}})[_0xbe14('0x35')](function(_0x3ab0f6){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3ab0f6);throw _0x3ab0f6;});}return _0x1b3118;})[_0xbe14('0x13')](respondWithResult(_0x1b2608,0xc9))[_0xbe14('0x35')](handleError(_0x1b2608,null));};exports[_0xbe14('0x3f')]=function(_0xb2b285,_0x2550dc){var _0x4f2d95={'where':{'id':_0xb2b285[_0xbe14('0x2b')]['id']}},_0x51023a={};_0x51023a[_0xbe14('0x2c')]=_[_0xbe14('0x2d')](db[_0xbe14('0x23')]['rawAttributes']);_0x4f2d95[_0xbe14('0x30')]=_[_0xbe14('0x2f')](_0x51023a['model'],qs[_0xbe14('0x31')](_0xb2b285[_0xbe14('0x2e')][_0xbe14('0x31')]));_0x4f2d95[_0xbe14('0x30')]=_0x4f2d95['attributes']['length']?_0x4f2d95[_0xbe14('0x30')]:_0x51023a[_0xbe14('0x2c')];if(_0xb2b285['query']['includeAll']){_0x4f2d95[_0xbe14('0x29')]=[{'all':!![]}];}_0x4f2d95=_[_0xbe14('0x40')]({},_0x4f2d95,_0xb2b285[_0xbe14('0x34')]);return db[_0xbe14('0x23')][_0xbe14('0x1d')](_0x4f2d95)[_0xbe14('0x13')](handleEntityNotFound(_0x2550dc,null))[_0xbe14('0x13')](function(_0x5a4068){if(_0x5a4068){var _0xf32e93=_0x5a4068[_0xbe14('0x15')]({'plain':!![]});_0xf32e93=qs[_0xbe14('0x41')](_0xf32e93,['id',_0xbe14('0x42'),_0xbe14('0x43')]);_0xb2b285['body']=_[_0xbe14('0x41')](_0xb2b285[_0xbe14('0x37')],['id',_0xbe14('0x42'),_0xbe14('0x43')]);return db[_0xbe14('0x23')][_0xbe14('0x36')](_['merge'](_0xf32e93,_0xb2b285['body']),{'include':_0xb2b285[_0xbe14('0x2e')][_0xbe14('0x33')]?[{'all':!![]}]:undefined})[_0xbe14('0x13')](function(_0x48554a){var _0x497b00=_0xb2b285[_0xbe14('0x38')][_0xbe14('0x15')]({'plain':!![]});if(!_0x497b00)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x497b00[_0xbe14('0x3a')]===_0xbe14('0x38')){var _0x50c2a0=_0x48554a[_0xbe14('0x15')]({'plain':!![]});var _0x4a40d2=[{'name':_0xbe14('0x3b'),'value':_0xbe14('0x16')},{'name':_0xbe14('0x17'),'value':'outbound'}];var _0x435c8d=_[_0xbe14('0x1d')](_0x4a40d2,['value',_0x50c2a0[_0xbe14('0x1c')]])[_0xbe14('0x1e')];return db[_0xbe14('0x3c')][_0xbe14('0x1d')]({'where':{'name':_0x435c8d,'userProfileId':_0x497b00[_0xbe14('0x44')]},'raw':!![]})['then'](function(_0x42a346){if(_0x42a346&&_0x42a346[_0xbe14('0x3d')]===0x0){return db[_0xbe14('0x3e')][_0xbe14('0x36')]({'name':_0x50c2a0[_0xbe14('0x1e')],'resourceId':_0x50c2a0['id'],'type':_0x42a346[_0xbe14('0x1e')],'sectionId':_0x42a346['id']},{})[_0xbe14('0x13')](function(){return _0x48554a;});}else{return _0x48554a;}})['catch'](function(_0x72c875){logger[_0xbe14('0x20')](_0xbe14('0x45'),_0x72c875);throw _0x72c875;});}return _0x48554a;});}})[_0xbe14('0x13')](respondWithResult(_0x2550dc,0xc9))[_0xbe14('0x35')](handleError(_0x2550dc,null));};exports[_0xbe14('0x12')]=function(_0xd8f78f,_0x32df3c){if(_0xd8f78f[_0xbe14('0x37')]['id']){delete _0xd8f78f[_0xbe14('0x37')]['id'];}return db[_0xbe14('0x23')]['find']({'where':{'id':_0xd8f78f['params']['id']}})['then'](handleEntityNotFound(_0x32df3c,null))[_0xbe14('0x13')](saveUpdates(_0xd8f78f[_0xbe14('0x37')],null))[_0xbe14('0x13')](respondWithResult(_0x32df3c,null))[_0xbe14('0x35')](handleError(_0x32df3c,null));};exports[_0xbe14('0x14')]=function(_0x66ddf,_0x16ee48){return db[_0xbe14('0x23')][_0xbe14('0x1d')]({'where':{'id':_0x66ddf[_0xbe14('0x2b')]['id']}})[_0xbe14('0x13')](handleEntityNotFound(_0x16ee48,null))[_0xbe14('0x13')](removeEntity(_0x16ee48,null))[_0xbe14('0x35')](handleError(_0x16ee48,null));};exports[_0xbe14('0x46')]=function(_0x1c831a,_0xcef8e3){var _0x179077={'raw':![],'where':{}};var _0x2225d9={};var _0x29761b={'count':0x0,'rows':[]};return db[_0xbe14('0x23')]['findOne']({'where':{'id':_0x1c831a[_0xbe14('0x2b')]['id']}})[_0xbe14('0x13')](handleEntityNotFound(_0xcef8e3,null))[_0xbe14('0x13')](function(_0x46b49c){if(_0x46b49c){_0x2225d9[_0xbe14('0x2c')]=_[_0xbe14('0x2d')](db[_0xbe14('0x47')][_0xbe14('0x24')]);_0x2225d9[_0xbe14('0x2e')]=_[_0xbe14('0x2d')](_0x1c831a['query']);_0x2225d9[_0xbe14('0x48')]=_[_0xbe14('0x2f')](_0x2225d9[_0xbe14('0x2c')],_0x2225d9[_0xbe14('0x2e')]);_0x179077[_0xbe14('0x30')]=_['intersection'](_0x2225d9[_0xbe14('0x2c')],qs[_0xbe14('0x31')](_0x1c831a[_0xbe14('0x2e')][_0xbe14('0x31')]));_0x179077[_0xbe14('0x30')]=_0x179077['attributes'][_0xbe14('0x32')]?_0x179077[_0xbe14('0x30')]:_0x2225d9[_0xbe14('0x2c')];if(!_0x1c831a[_0xbe14('0x2e')][_0xbe14('0x49')](_0xbe14('0x4a'))){_0x179077[_0xbe14('0xf')]=qs[_0xbe14('0xf')](_0x1c831a['query'][_0xbe14('0xf')]);_0x179077[_0xbe14('0xd')]=qs[_0xbe14('0xd')](_0x1c831a[_0xbe14('0x2e')][_0xbe14('0xd')]);}_0x179077[_0xbe14('0x4b')]=qs[_0xbe14('0x4c')](_0x1c831a['query']['sort']);_0x179077[_0xbe14('0x28')]=qs[_0xbe14('0x48')](_[_0xbe14('0x4d')](_0x1c831a[_0xbe14('0x2e')],_0x2225d9[_0xbe14('0x48')]));_0x179077[_0xbe14('0x28')][_0xbe14('0x4e')]=_0x46b49c['id'];if(_0x1c831a[_0xbe14('0x2e')]['filter']){_0x179077['where']=_[_0xbe14('0x40')](_0x179077[_0xbe14('0x28')],{'$or':_[_0xbe14('0x1a')](_0x179077['attributes'],function(_0x76e91e){var _0x16bca1={};_0x16bca1[_0x76e91e]={'$like':'%'+_0x1c831a[_0xbe14('0x2e')][_0xbe14('0x19')]+'%'};return _0x16bca1;})});}_0x179077=_[_0xbe14('0x40')]({},_0x179077,_0x1c831a[_0xbe14('0x34')]);return db[_0xbe14('0x47')]['count']({'where':_0x179077[_0xbe14('0x28')]})[_0xbe14('0x13')](function(_0x3baa26){_0x29761b[_0xbe14('0x10')]=_0x3baa26;if(_0x1c831a[_0xbe14('0x2e')][_0xbe14('0x33')]){_0x179077[_0xbe14('0x29')]=[{'all':!![]}];}return db['CmHopper'][_0xbe14('0x4f')](_0x179077);})[_0xbe14('0x13')](function(_0x3cd17e){_0x29761b[_0xbe14('0x50')]=_0x3cd17e;return _0x29761b;});}})[_0xbe14('0x13')](respondWithFilteredResult(_0xcef8e3,_0x179077))[_0xbe14('0x35')](handleError(_0xcef8e3,null));};exports[_0xbe14('0x51')]=function(_0xd756b2,_0x5d064e){var _0x1e5ce1={'raw':!![],'where':{}};var _0x401968={};var _0x362999={'count':0x0,'rows':[]};return db[_0xbe14('0x23')][_0xbe14('0x52')]({'where':{'id':_0xd756b2[_0xbe14('0x2b')]['id']}})['then'](handleEntityNotFound(_0x5d064e,null))[_0xbe14('0x13')](function(_0x175213){if(_0x175213){_0x401968[_0xbe14('0x2c')]=_[_0xbe14('0x2d')](db['CmHopperHistory'][_0xbe14('0x24')]);_0x401968[_0xbe14('0x2e')]=_[_0xbe14('0x2d')](_0xd756b2[_0xbe14('0x2e')]);_0x401968[_0xbe14('0x48')]=_[_0xbe14('0x2f')](_0x401968[_0xbe14('0x2c')],_0x401968['query']);_0x1e5ce1[_0xbe14('0x30')]=_['intersection'](_0x401968[_0xbe14('0x2c')],qs['fields'](_0xd756b2[_0xbe14('0x2e')][_0xbe14('0x31')]));_0x1e5ce1[_0xbe14('0x30')]=_0x1e5ce1['attributes'][_0xbe14('0x32')]?_0x1e5ce1[_0xbe14('0x30')]:_0x401968[_0xbe14('0x2c')];if(!_0xd756b2['query'][_0xbe14('0x49')](_0xbe14('0x4a'))){_0x1e5ce1[_0xbe14('0xf')]=qs[_0xbe14('0xf')](_0xd756b2['query'][_0xbe14('0xf')]);_0x1e5ce1[_0xbe14('0xd')]=qs[_0xbe14('0xd')](_0xd756b2[_0xbe14('0x2e')][_0xbe14('0xd')]);}_0x1e5ce1[_0xbe14('0x4b')]=qs[_0xbe14('0x4c')](_0xd756b2['query'][_0xbe14('0x4c')]);_0x1e5ce1[_0xbe14('0x28')]=qs[_0xbe14('0x48')](_['pick'](_0xd756b2[_0xbe14('0x2e')],_0x401968[_0xbe14('0x48')]));_0x1e5ce1[_0xbe14('0x28')]['VoiceQueueId']=_0x175213['id'];if(_0xd756b2[_0xbe14('0x2e')][_0xbe14('0x19')]){_0x1e5ce1['where']=_[_0xbe14('0x40')](_0x1e5ce1['where'],{'$or':_[_0xbe14('0x1a')](_0x1e5ce1[_0xbe14('0x30')],function(_0x4dfa19){var _0x55d729={};_0x55d729[_0x4dfa19]={'$like':'%'+_0xd756b2[_0xbe14('0x2e')][_0xbe14('0x19')]+'%'};return _0x55d729;})});}_0x1e5ce1=_[_0xbe14('0x40')]({},_0x1e5ce1,_0xd756b2['options']);return db[_0xbe14('0x53')][_0xbe14('0x10')]({'where':_0x1e5ce1[_0xbe14('0x28')]})[_0xbe14('0x13')](function(_0x5ee624){_0x362999['count']=_0x5ee624;if(_0xd756b2[_0xbe14('0x2e')][_0xbe14('0x33')]){_0x1e5ce1[_0xbe14('0x29')]=[{'all':!![]}];}return db[_0xbe14('0x53')][_0xbe14('0x4f')](_0x1e5ce1);})[_0xbe14('0x13')](function(_0x139aab){_0x362999['rows']=_0x139aab;return _0x362999;});}})[_0xbe14('0x13')](respondWithFilteredResult(_0x5d064e,_0x1e5ce1))['catch'](handleError(_0x5d064e,null));};exports[_0xbe14('0x54')]=function(_0x3a01bb,_0x8d47f2){var _0x2382c4={'raw':!![],'where':{}};var _0x55a3ae={};var _0x1e160b={'count':0x0,'rows':[]};return db[_0xbe14('0x23')][_0xbe14('0x52')]({'where':{'id':_0x3a01bb['params']['id']}})[_0xbe14('0x13')](handleEntityNotFound(_0x8d47f2,null))[_0xbe14('0x13')](function(_0x4090bc){if(_0x4090bc){_0x55a3ae[_0xbe14('0x2c')]=_[_0xbe14('0x2d')](db[_0xbe14('0x55')][_0xbe14('0x24')]);_0x55a3ae[_0xbe14('0x2e')]=_[_0xbe14('0x2d')](_0x3a01bb[_0xbe14('0x2e')]);_0x55a3ae[_0xbe14('0x48')]=_[_0xbe14('0x2f')](_0x55a3ae[_0xbe14('0x2c')],_0x55a3ae[_0xbe14('0x2e')]);_0x2382c4[_0xbe14('0x30')]=_[_0xbe14('0x2f')](_0x55a3ae[_0xbe14('0x2c')],qs[_0xbe14('0x31')](_0x3a01bb[_0xbe14('0x2e')][_0xbe14('0x31')]));_0x2382c4['attributes']=_0x2382c4[_0xbe14('0x30')]['length']?_0x2382c4[_0xbe14('0x30')]:_0x55a3ae[_0xbe14('0x2c')];if(!_0x3a01bb[_0xbe14('0x2e')][_0xbe14('0x49')](_0xbe14('0x4a'))){_0x2382c4['limit']=qs['limit'](_0x3a01bb[_0xbe14('0x2e')][_0xbe14('0xf')]);_0x2382c4[_0xbe14('0xd')]=qs[_0xbe14('0xd')](_0x3a01bb['query'][_0xbe14('0xd')]);}_0x2382c4[_0xbe14('0x4b')]=qs['sort'](_0x3a01bb[_0xbe14('0x2e')][_0xbe14('0x4c')]);_0x2382c4[_0xbe14('0x28')]=qs[_0xbe14('0x48')](_['pick'](_0x3a01bb[_0xbe14('0x2e')],_0x55a3ae['filters']));_0x2382c4['where'][_0xbe14('0x4e')]=_0x4090bc['id'];if(_0x3a01bb[_0xbe14('0x2e')][_0xbe14('0x19')]){_0x2382c4[_0xbe14('0x28')]=_[_0xbe14('0x40')](_0x2382c4['where'],{'$or':_[_0xbe14('0x1a')](_0x2382c4[_0xbe14('0x30')],function(_0x5dc793){var _0x4e35ed={};_0x4e35ed[_0x5dc793]={'$like':'%'+_0x3a01bb[_0xbe14('0x2e')][_0xbe14('0x19')]+'%'};return _0x4e35ed;})});}_0x2382c4=_['merge']({},_0x2382c4,_0x3a01bb[_0xbe14('0x34')]);return db['CmHopperFinal'][_0xbe14('0x10')]({'where':_0x2382c4['where']})[_0xbe14('0x13')](function(_0x5d4431){_0x1e160b[_0xbe14('0x10')]=_0x5d4431;if(_0x3a01bb['query'][_0xbe14('0x33')]){_0x2382c4[_0xbe14('0x29')]=[{'all':!![]}];}return db['CmHopperFinal']['findAll'](_0x2382c4);})[_0xbe14('0x13')](function(_0x4db7e8){_0x1e160b['rows']=_0x4db7e8;return _0x1e160b;});}})[_0xbe14('0x13')](respondWithFilteredResult(_0x8d47f2,_0x2382c4))[_0xbe14('0x35')](handleError(_0x8d47f2,null));};exports[_0xbe14('0x56')]=function(_0x11c341,_0x1a780a){var _0x313a87={'raw':!![],'where':{}};var _0x30d2b0={};var _0x57ad22={'count':0x0,'rows':[]};return db[_0xbe14('0x23')][_0xbe14('0x52')]({'where':{'id':_0x11c341[_0xbe14('0x2b')]['id']}})[_0xbe14('0x13')](handleEntityNotFound(_0x1a780a,null))['then'](function(_0x26372a){if(_0x26372a){_0x30d2b0[_0xbe14('0x2c')]=_[_0xbe14('0x2d')](db['CmHopperBlack'][_0xbe14('0x24')]);_0x30d2b0[_0xbe14('0x2e')]=_['keys'](_0x11c341[_0xbe14('0x2e')]);_0x30d2b0['filters']=_[_0xbe14('0x2f')](_0x30d2b0[_0xbe14('0x2c')],_0x30d2b0[_0xbe14('0x2e')]);_0x313a87['attributes']=_[_0xbe14('0x2f')](_0x30d2b0['model'],qs[_0xbe14('0x31')](_0x11c341['query']['fields']));_0x313a87[_0xbe14('0x30')]=_0x313a87['attributes'][_0xbe14('0x32')]?_0x313a87['attributes']:_0x30d2b0[_0xbe14('0x2c')];if(!_0x11c341[_0xbe14('0x2e')][_0xbe14('0x49')](_0xbe14('0x4a'))){_0x313a87[_0xbe14('0xf')]=qs[_0xbe14('0xf')](_0x11c341[_0xbe14('0x2e')][_0xbe14('0xf')]);_0x313a87[_0xbe14('0xd')]=qs[_0xbe14('0xd')](_0x11c341[_0xbe14('0x2e')][_0xbe14('0xd')]);}_0x313a87[_0xbe14('0x4b')]=qs['sort'](_0x11c341[_0xbe14('0x2e')][_0xbe14('0x4c')]);_0x313a87[_0xbe14('0x28')]=qs[_0xbe14('0x48')](_[_0xbe14('0x4d')](_0x11c341['query'],_0x30d2b0['filters']));_0x313a87[_0xbe14('0x28')][_0xbe14('0x4e')]=_0x26372a['id'];if(_0x11c341[_0xbe14('0x2e')][_0xbe14('0x19')]){_0x313a87[_0xbe14('0x28')]=_[_0xbe14('0x40')](_0x313a87[_0xbe14('0x28')],{'$or':_[_0xbe14('0x1a')](_0x313a87[_0xbe14('0x30')],function(_0x26e7a7){var _0x761b3d={};_0x761b3d[_0x26e7a7]={'$like':'%'+_0x11c341[_0xbe14('0x2e')][_0xbe14('0x19')]+'%'};return _0x761b3d;})});}_0x313a87=_[_0xbe14('0x40')]({},_0x313a87,_0x11c341[_0xbe14('0x34')]);return db[_0xbe14('0x57')][_0xbe14('0x10')]({'where':_0x313a87[_0xbe14('0x28')]})[_0xbe14('0x13')](function(_0x28a1e9){_0x57ad22[_0xbe14('0x10')]=_0x28a1e9;if(_0x11c341[_0xbe14('0x2e')][_0xbe14('0x33')]){_0x313a87[_0xbe14('0x29')]=[{'all':!![]}];}return db[_0xbe14('0x57')]['findAll'](_0x313a87);})[_0xbe14('0x13')](function(_0x3303a4){_0x57ad22[_0xbe14('0x50')]=_0x3303a4;return _0x57ad22;});}})[_0xbe14('0x13')](respondWithFilteredResult(_0x1a780a,_0x313a87))[_0xbe14('0x35')](handleError(_0x1a780a,null));};exports[_0xbe14('0x58')]=function(_0x52b75d,_0x5b161c){var _0x165b7a={};var _0x4a44e0={};var _0x3730d1;var _0x4babba;return db[_0xbe14('0x23')]['findOne']({'where':{'id':_0x52b75d[_0xbe14('0x2b')]['id']}})[_0xbe14('0x13')](handleEntityNotFound(_0x5b161c,null))[_0xbe14('0x13')](function(_0x12498f){if(_0x12498f){_0x3730d1=_0x12498f;_0x4a44e0[_0xbe14('0x2c')]=_[_0xbe14('0x2d')](db[_0xbe14('0x59')][_0xbe14('0x24')]);_0x4a44e0[_0xbe14('0x2e')]=_['keys'](_0x52b75d[_0xbe14('0x2e')]);_0x4a44e0[_0xbe14('0x48')]=_[_0xbe14('0x2f')](_0x4a44e0[_0xbe14('0x2c')],_0x4a44e0['query']);_0x165b7a[_0xbe14('0x30')]=_['intersection'](_0x4a44e0[_0xbe14('0x2c')],qs['fields'](_0x52b75d[_0xbe14('0x2e')][_0xbe14('0x31')]));_0x165b7a[_0xbe14('0x30')]=_0x165b7a['attributes'][_0xbe14('0x32')]?_0x165b7a['attributes']:_0x4a44e0[_0xbe14('0x2c')];_0x165b7a[_0xbe14('0x4b')]=qs[_0xbe14('0x4c')](_0x52b75d[_0xbe14('0x2e')][_0xbe14('0x4c')]);_0x165b7a[_0xbe14('0x28')]=qs[_0xbe14('0x48')](_[_0xbe14('0x4d')](_0x52b75d[_0xbe14('0x2e')],_0x4a44e0['filters']));if(_0x52b75d[_0xbe14('0x2e')]['filter']){_0x165b7a[_0xbe14('0x28')]=_[_0xbe14('0x40')](_0x165b7a[_0xbe14('0x28')],{'$or':_['map'](_0x165b7a[_0xbe14('0x30')],function(_0x1c5fbc){var _0x219403={};_0x219403[_0x1c5fbc]={'$like':'%'+_0x52b75d[_0xbe14('0x2e')][_0xbe14('0x19')]+'%'};return _0x219403;})});}_0x165b7a=_['merge']({},_0x165b7a,_0x52b75d['options']);return _0x3730d1[_0xbe14('0x58')](_0x165b7a);}})['then'](function(_0x16b1c8){if(_0x16b1c8){_0x4babba=_0x16b1c8[_0xbe14('0x32')];if(!_0x52b75d[_0xbe14('0x2e')][_0xbe14('0x49')]('nolimit')){_0x165b7a[_0xbe14('0xf')]=qs[_0xbe14('0xf')](_0x52b75d['query'][_0xbe14('0xf')]);_0x165b7a[_0xbe14('0xd')]=qs[_0xbe14('0xd')](_0x52b75d[_0xbe14('0x2e')]['offset']);}return _0x3730d1[_0xbe14('0x58')](_0x165b7a);}})[_0xbe14('0x13')](function(_0x37aff6){if(_0x37aff6){return _0x37aff6?{'count':_0x4babba,'rows':_0x37aff6}:null;}})[_0xbe14('0x13')](respondWithResult(_0x5b161c,null))[_0xbe14('0x35')](handleError(_0x5b161c,null));};exports[_0xbe14('0x5a')]=function(_0x208fae,_0x310d42){var _0x9c229f=_0x208fae[_0xbe14('0x37')]['teams'];var _0xdb5515=_[_0xbe14('0x1a')](_0x9c229f,'id');return db[_0xbe14('0x59')][_0xbe14('0x4f')]({'where':{'id':_0xdb5515},'attributes':['id'],'include':[{'model':db['User'],'as':_0xbe14('0x5b'),'attributes':['id',_0xbe14('0x1e'),_0xbe14('0x5c'),'voicePause',_0xbe14('0x5d')],'raw':!![]}]})[_0xbe14('0x13')](function(_0x1ec868){if(_0x1ec868){var _0x1a7321=_[_0xbe14('0x5e')](_0x1ec868,function(_0x2306f6){var _0x426189=_0x2306f6['get']({'plain':!![]});_0x426189[_0xbe14('0x5b')]['forEach'](function(_0x24d528){_0x24d528[_0xbe14('0x5f')]=_[_0xbe14('0x1d')](_0x9c229f,{'id':_0x426189['id']})[_0xbe14('0x5f')];});return _0x426189[_0xbe14('0x5b')];});return db['VoiceQueue']['find']({'where':{'id':_0x208fae[_0xbe14('0x2b')]['id']}})[_0xbe14('0x13')](function(_0x29a892){return db[_0xbe14('0x60')]['transaction'](function(_0x46a251){return _0x29a892[_0xbe14('0x5a')](_0xdb5515,{'transaction':_0x46a251})[_0xbe14('0x13')](function(){return BPromise['each'](_0x9c229f,function(_0xe69b0e){return db['TeamVoiceQueue']['upsert']({'TeamId':_0xe69b0e['id'],'VoiceQueueId':_0x208fae[_0xbe14('0x2b')]['id'],'penalty':_0xe69b0e[_0xbe14('0x5f')]},{'transaction':_0x46a251});});})[_0xbe14('0x13')](function(){return BPromise['each'](_0x1a7321,function(_0x3ea9c2){return db[_0xbe14('0x61')]['findOrCreate']({'where':{'UserId':_0x3ea9c2['id'],'VoiceQueueId':_0x208fae[_0xbe14('0x2b')]['id']},'defaults':{'penalty':_0x3ea9c2[_0xbe14('0x5f')]},'transaction':_0x46a251});});})[_0xbe14('0x13')](function(){return BPromise['each'](_[_0xbe14('0x19')](_0x1a7321,{'online':!![]}),function(_0x1e2559){return db[_0xbe14('0x62')][_0xbe14('0x63')]({'membername':_0x1e2559[_0xbe14('0x1e')],'UserId':_0x1e2559['id'],'queue_name':_0x29a892['name'],'VoiceQueueId':_0x29a892['id'],'interface':_[_0xbe14('0x64')](_0x1e2559[_0xbe14('0x5d')])?util[_0xbe14('0x65')]('SIP/%s',_0x1e2559[_0xbe14('0x1e')]):_0x1e2559[_0xbe14('0x5d')],'paused':_0x1e2559[_0xbe14('0x66')]||![],'penalty':_0x1e2559[_0xbe14('0x5f')]},{'transaction':_0x46a251});});})[_0xbe14('0x13')](function(){_0x1a7321[_0xbe14('0x67')](function(_0x1b22a0){socket[_0xbe14('0x68')](_0xbe14('0x69'),{'UserId':_0x1b22a0['id'],'VoiceQueueId':_0x29a892['id']});});});});});}})[_0xbe14('0x13')](respondWithStatusCode(_0x310d42,null))[_0xbe14('0x35')](handleError(_0x310d42,null));};exports['removeTeams']=function(_0xf549ec,_0x2c3647){return db[_0xbe14('0x59')]['findAll']({'where':{'id':_0xf549ec[_0xbe14('0x2e')][_0xbe14('0x6a')]},'attributes':['id'],'include':[{'model':db[_0xbe14('0x6b')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0xbe14('0x13')](handleEntityNotFound(_0x2c3647,null))['then'](function(_0x2d4b18){var _0xcd8cf6=_['map'](_0x2d4b18,'id');var _0x269e5a=[];var _0x4c7e2b=[];var _0x587f58=squel[_0xbe14('0x6c')]();_0x587f58[_0xbe14('0x6d')](_0xbe14('0x6e'))[_0xbe14('0x6f')](_0xbe14('0x70'),'tq')[_0xbe14('0x71')]('user_has_teams','ut','ut.TeamId\x20=\x20tq.TeamId')[_0xbe14('0x28')](_0xbe14('0x72'),_0xf549ec[_0xbe14('0x2b')]['id']);for(var _0x3c23fc=0x0;_0x3c23fc<_0x2d4b18['length'];_0x3c23fc+=0x1){let _0x1d5333=_0x2d4b18[_0x3c23fc];for(var _0x4cb29c=0x0;_0x4cb29c<_0x1d5333[_0xbe14('0x5b')][_0xbe14('0x32')];_0x4cb29c+=0x1){let _0x5270b2=_0x1d5333[_0xbe14('0x5b')][_0x4cb29c];var _0x273df5=_0x587f58[_0xbe14('0x3f')]();_0x273df5[_0xbe14('0x28')](_0xbe14('0x73'),_0x5270b2['id']);_0x4c7e2b[_0xbe14('0x74')](db[_0xbe14('0x60')][_0xbe14('0x2e')](_0x273df5[_0xbe14('0x75')](),{'type':db[_0xbe14('0x60')][_0xbe14('0x76')][_0xbe14('0x77')]})['then'](function(_0x20f196){if(_0x20f196[_0xbe14('0x32')]===0x1){return _0x5270b2['id'];}else{var _0x1eb33b=_[_0xbe14('0x78')](_['map'](_0x20f196,_0xbe14('0x79')),function(_0xede1c1){return _['includes'](_0xcd8cf6,_0xede1c1);});if(_0x1eb33b){return _0x5270b2['id'];}}}));}}return BPromise[_0xbe14('0x7a')](_0x4c7e2b)[_0xbe14('0x13')](function(_0x11085c){_0x269e5a=_(_0x269e5a)['union'](_0x11085c)[_0xbe14('0x7b')]()[_0xbe14('0x1b')]();return db[_0xbe14('0x23')][_0xbe14('0x1d')]({'where':{'id':_0xf549ec[_0xbe14('0x2b')]['id']}})['then'](function(_0x23208d){return db[_0xbe14('0x60')][_0xbe14('0x7c')](function(_0x3f7732){return _0x23208d[_0xbe14('0x7d')](_0xf549ec['query'][_0xbe14('0x6a')],{'transaction':_0x3f7732})[_0xbe14('0x13')](function(){if(!_[_0xbe14('0x7e')](_0x269e5a)){return _0x23208d[_0xbe14('0x7f')](_0x269e5a,{'transaction':_0x3f7732})[_0xbe14('0x13')](function(){return db[_0xbe14('0x62')][_0xbe14('0x14')]({'where':{'VoiceQueueId':_0xf549ec[_0xbe14('0x2b')]['id'],'UserId':_0x269e5a},'transaction':_0x3f7732});});}})['then'](function(){_0x269e5a['forEach'](function(_0x129ef6){socket[_0xbe14('0x68')](_0xbe14('0x80'),{'UserId':_0x129ef6,'VoiceQueueId':_0x23208d['id']});});});});});});})[_0xbe14('0x13')](respondWithStatusCode(_0x2c3647,null))[_0xbe14('0x35')](handleError(_0x2c3647,null));};exports['addAgents']=function(_0x15c93c,_0xf6ff8){var _0x3eaabe,_0x1ea11a;return db[_0xbe14('0x23')][_0xbe14('0x1d')]({'where':{'id':_0x15c93c[_0xbe14('0x2b')]['id']}})[_0xbe14('0x13')](handleEntityNotFound(_0xf6ff8,null))['then'](function(_0xf6da38){if(_0xf6da38){_0x1ea11a=_0xf6da38;return _0xf6da38[_0xbe14('0x81')](_0x15c93c['body']['ids'],_[_0xbe14('0x41')](_0x15c93c['body'],[_0xbe14('0x6a'),'id'])||{})[_0xbe14('0x82')](function(_0x776e93){for(var _0x3f5ca3=0x0;_0x3f5ca3<_0x15c93c[_0xbe14('0x37')]['ids'][_0xbe14('0x32')];_0x3f5ca3+=0x1){socket[_0xbe14('0x68')](_0xbe14('0x69'),{'UserId':Number(_0x15c93c[_0xbe14('0x37')][_0xbe14('0x6a')][_0x3f5ca3]),'VoiceQueueId':Number(_0x15c93c[_0xbe14('0x2b')]['id'])});}return _0x776e93;});}})['then'](function(_0x4eea48){_0x3eaabe=_0x4eea48||[];if(_0x1ea11a){return db[_0xbe14('0x6b')]['findAll']({'where':{'id':_0x15c93c[_0xbe14('0x37')][_0xbe14('0x6a')]},'attributes':['id',_0xbe14('0x1e'),'online',_0xbe14('0x66'),_0xbe14('0x5d')],'raw':!![]});}})[_0xbe14('0x13')](function(_0x1ad15d){if(!_[_0xbe14('0x7e')](_0x1ad15d)){var _0x2e5106=[];for(var _0x156fb3=0x0;_0x156fb3<_0x1ad15d['length'];_0x156fb3++){if(_0x1ad15d[_0x156fb3][_0xbe14('0x5c')]){_0x2e5106['push'](db['UserVoiceQueueRt']['upsert']({'membername':_0x1ad15d[_0x156fb3]['name'],'UserId':_0x1ad15d[_0x156fb3]['id'],'queue_name':_0x1ea11a[_0xbe14('0x1e')],'VoiceQueueId':_0x1ea11a['id'],'interface':_[_0xbe14('0x64')](_0x1ad15d[_0x156fb3]['interface'])?util[_0xbe14('0x65')]('SIP/%s',_0x1ad15d[_0x156fb3][_0xbe14('0x1e')]):_0x1ad15d[_0x156fb3]['interface'],'paused':_0x1ad15d[_0x156fb3][_0xbe14('0x66')]||![],'penalty':_0x15c93c[_0xbe14('0x37')][_0xbe14('0x5f')]||0x0}));}}return BPromise[_0xbe14('0x7a')](_0x2e5106);}})[_0xbe14('0x13')](function(){return _0x3eaabe;})['then'](respondWithResult(_0xf6ff8,null))[_0xbe14('0x35')](handleError(_0xf6ff8,null));};exports[_0xbe14('0x7f')]=function(_0x3aaa54,_0x413893){return db['VoiceQueue']['find']({'where':{'id':_0x3aaa54['params']['id']}})[_0xbe14('0x13')](handleEntityNotFound(_0x413893,null))[_0xbe14('0x13')](function(_0x3826cf){if(_0x3826cf){return _0x3826cf[_0xbe14('0x7f')](_0x3aaa54[_0xbe14('0x2e')]['ids'])['then'](function(){if(_[_0xbe14('0x83')](_0x3aaa54[_0xbe14('0x2e')][_0xbe14('0x6a')])){for(var _0x26092b=0x0;_0x26092b<_0x3aaa54[_0xbe14('0x2e')]['ids'][_0xbe14('0x32')];_0x26092b+=0x1){socket['emit'](_0xbe14('0x80'),{'UserId':Number(_0x3aaa54[_0xbe14('0x2e')][_0xbe14('0x6a')][_0x26092b]),'VoiceQueueId':Number(_0x3aaa54[_0xbe14('0x2b')]['id'])});}}else{socket['emit'](_0xbe14('0x80'),{'UserId':Number(_0x3aaa54[_0xbe14('0x2e')][_0xbe14('0x6a')]),'VoiceQueueId':Number(_0x3aaa54[_0xbe14('0x2b')]['id'])});}});}})['then'](function(_0x44c341){return db[_0xbe14('0x62')][_0xbe14('0x14')]({'where':{'VoiceQueueId':_0x3aaa54['params']['id'],'UserId':_0x3aaa54['query'][_0xbe14('0x6a')]}})[_0xbe14('0x13')](function(){return _0x44c341;});})[_0xbe14('0x13')](respondWithStatusCode(_0x413893,null))['catch'](handleError(_0x413893,null));};exports[_0xbe14('0x84')]=function(_0x2f0d14,_0x180e61){var _0x952322={};var _0x3ae00b={};var _0x41962a;var _0x4ebf01;return db[_0xbe14('0x23')][_0xbe14('0x52')]({'where':{'id':_0x2f0d14[_0xbe14('0x2b')]['id']}})[_0xbe14('0x13')](handleEntityNotFound(_0x180e61,null))[_0xbe14('0x13')](function(_0x5f28dd){if(_0x5f28dd){_0x41962a=_0x5f28dd;_0x3ae00b['model']=_[_0xbe14('0x2d')](db['User'][_0xbe14('0x24')]);_0x3ae00b['query']=_[_0xbe14('0x2d')](_0x2f0d14[_0xbe14('0x2e')]);_0x3ae00b[_0xbe14('0x48')]=_['intersection'](_0x3ae00b[_0xbe14('0x2c')],_0x3ae00b[_0xbe14('0x2e')]);_0x952322[_0xbe14('0x30')]=_[_0xbe14('0x2f')](_0x3ae00b[_0xbe14('0x2c')],qs[_0xbe14('0x31')](_0x2f0d14[_0xbe14('0x2e')][_0xbe14('0x31')]));_0x952322[_0xbe14('0x30')]=_0x952322[_0xbe14('0x30')]['length']?_0x952322[_0xbe14('0x30')]:_0x3ae00b[_0xbe14('0x2c')];_0x952322[_0xbe14('0x4b')]=qs[_0xbe14('0x4c')](_0x2f0d14[_0xbe14('0x2e')][_0xbe14('0x4c')]);_0x952322[_0xbe14('0x28')]=qs[_0xbe14('0x48')](_['pick'](_0x2f0d14[_0xbe14('0x2e')],_0x3ae00b[_0xbe14('0x48')]));if(_0x2f0d14[_0xbe14('0x2e')][_0xbe14('0x19')]){_0x952322[_0xbe14('0x28')]=_[_0xbe14('0x40')](_0x952322['where'],{'$or':_['map'](_0x952322['attributes'],function(_0x598ccc){var _0x446b3f={};_0x446b3f[_0x598ccc]={'$like':'%'+_0x2f0d14[_0xbe14('0x2e')]['filter']+'%'};return _0x446b3f;})});}_0x952322=_[_0xbe14('0x40')]({},_0x952322,_0x2f0d14['options']);return _0x41962a[_0xbe14('0x84')](_0x952322);}})[_0xbe14('0x13')](function(_0x111ff0){if(_0x111ff0){_0x4ebf01=_0x111ff0[_0xbe14('0x32')];if(!_0x2f0d14[_0xbe14('0x2e')][_0xbe14('0x49')]('nolimit')){_0x952322[_0xbe14('0xf')]=qs[_0xbe14('0xf')](_0x2f0d14[_0xbe14('0x2e')][_0xbe14('0xf')]);_0x952322[_0xbe14('0xd')]=qs[_0xbe14('0xd')](_0x2f0d14[_0xbe14('0x2e')][_0xbe14('0xd')]);}return _0x41962a[_0xbe14('0x84')](_0x952322);}})['then'](function(_0x2eb5e6){if(_0x2eb5e6){return _0x2eb5e6?{'count':_0x4ebf01,'rows':_0x2eb5e6}:null;}})['then'](respondWithResult(_0x180e61,null))[_0xbe14('0x35')](handleError(_0x180e61,null));};exports['getMembers']=function(_0x49cddc,_0x3bdbf7){var _0x19a1ae={};var _0x167dee={};var _0x4f6252;var _0x4536b9;return db['VoiceQueue'][_0xbe14('0x52')]({'where':{'id':_0x49cddc['params']['id']}})[_0xbe14('0x13')](handleEntityNotFound(_0x3bdbf7,null))[_0xbe14('0x13')](function(_0x21f14e){if(_0x21f14e){_0x4f6252=_0x21f14e;_0x167dee[_0xbe14('0x2c')]=_[_0xbe14('0x2d')](db[_0xbe14('0x62')]['rawAttributes']);_0x167dee[_0xbe14('0x2e')]=_[_0xbe14('0x2d')](_0x49cddc['query']);_0x167dee['filters']=_['intersection'](_0x167dee[_0xbe14('0x2c')],_0x167dee[_0xbe14('0x2e')]);_0x19a1ae[_0xbe14('0x30')]=_[_0xbe14('0x2f')](_0x167dee[_0xbe14('0x2c')],qs[_0xbe14('0x31')](_0x49cddc[_0xbe14('0x2e')]['fields']));_0x19a1ae[_0xbe14('0x30')]=_0x19a1ae[_0xbe14('0x30')][_0xbe14('0x32')]?_0x19a1ae['attributes']:_0x167dee[_0xbe14('0x2c')];_0x19a1ae[_0xbe14('0x4b')]=qs[_0xbe14('0x4c')](_0x49cddc['query']['sort']);_0x19a1ae[_0xbe14('0x28')]=qs['filters'](_[_0xbe14('0x4d')](_0x49cddc[_0xbe14('0x2e')],_0x167dee[_0xbe14('0x48')]));if(_0x49cddc[_0xbe14('0x2e')][_0xbe14('0x19')]){_0x19a1ae[_0xbe14('0x28')]=_['merge'](_0x19a1ae[_0xbe14('0x28')],{'$or':_['map'](_0x19a1ae[_0xbe14('0x30')],function(_0x2d0568){var _0x26bb56={};_0x26bb56[_0x2d0568]={'$like':'%'+_0x49cddc['query'][_0xbe14('0x19')]+'%'};return _0x26bb56;})});}_0x19a1ae=_[_0xbe14('0x40')]({},_0x19a1ae,_0x49cddc['options']);return _0x4f6252['getMembers'](_0x19a1ae);}})[_0xbe14('0x13')](function(_0x3d9061){if(_0x3d9061){_0x4536b9=_0x3d9061[_0xbe14('0x32')];if(!_0x49cddc['query'][_0xbe14('0x49')](_0xbe14('0x4a'))){_0x19a1ae['limit']=qs['limit'](_0x49cddc['query']['limit']);_0x19a1ae[_0xbe14('0xd')]=qs[_0xbe14('0xd')](_0x49cddc['query']['offset']);}return _0x4f6252[_0xbe14('0x85')](_0x19a1ae);}})[_0xbe14('0x13')](function(_0x1046a0){return _0x1046a0?{'count':_0x4536b9,'rows':_0x1046a0}:null;})['then'](respondWithResult(_0x3bdbf7,null))[_0xbe14('0x35')](handleError(_0x3bdbf7,null));};exports[_0xbe14('0x86')]=function(_0x3933c7,_0x416c65){var _0x56f870={};var _0x28b3c4={};var _0x6fe862;var _0x5f4675;return db[_0xbe14('0x23')][_0xbe14('0x52')]({'where':{'id':_0x3933c7[_0xbe14('0x2b')]['id']}})[_0xbe14('0x13')](handleEntityNotFound(_0x416c65,null))[_0xbe14('0x13')](function(_0x4c4ab9){if(_0x4c4ab9){_0x6fe862=_0x4c4ab9;_0x28b3c4['model']=_[_0xbe14('0x2d')](db[_0xbe14('0x87')][_0xbe14('0x24')]);_0x28b3c4[_0xbe14('0x2e')]=_['keys'](_0x3933c7[_0xbe14('0x2e')]);_0x28b3c4[_0xbe14('0x48')]=_['intersection'](_0x28b3c4[_0xbe14('0x2c')],_0x28b3c4['query']);_0x56f870[_0xbe14('0x30')]=_[_0xbe14('0x2f')](_0x28b3c4['model'],qs[_0xbe14('0x31')](_0x3933c7[_0xbe14('0x2e')][_0xbe14('0x31')]));_0x56f870[_0xbe14('0x30')]=_0x56f870[_0xbe14('0x30')][_0xbe14('0x32')]?_0x56f870[_0xbe14('0x30')]:_0x28b3c4[_0xbe14('0x2c')];_0x56f870['order']=qs[_0xbe14('0x4c')](_0x3933c7[_0xbe14('0x2e')][_0xbe14('0x4c')]);_0x56f870['where']=qs['filters'](_['pick'](_0x3933c7[_0xbe14('0x2e')],_0x28b3c4[_0xbe14('0x48')]));if(_0x3933c7[_0xbe14('0x2e')]['filter']){_0x56f870['where']=_[_0xbe14('0x40')](_0x56f870[_0xbe14('0x28')],{'$or':_[_0xbe14('0x1a')](_0x56f870[_0xbe14('0x30')],function(_0x2ac6c0){var _0x3d381e={};_0x3d381e[_0x2ac6c0]={'$like':'%'+_0x3933c7[_0xbe14('0x2e')][_0xbe14('0x19')]+'%'};return _0x3d381e;})});}_0x56f870=_[_0xbe14('0x40')]({},_0x56f870,_0x3933c7['options']);return _0x6fe862[_0xbe14('0x86')](_0x56f870);}})[_0xbe14('0x13')](function(_0x2ca4de){if(_0x2ca4de){_0x5f4675=_0x2ca4de[_0xbe14('0x32')];if(!_0x3933c7[_0xbe14('0x2e')]['hasOwnProperty'](_0xbe14('0x4a'))){_0x56f870['limit']=qs['limit'](_0x3933c7[_0xbe14('0x2e')][_0xbe14('0xf')]);_0x56f870['offset']=qs['offset'](_0x3933c7[_0xbe14('0x2e')][_0xbe14('0xd')]);}return _0x6fe862[_0xbe14('0x86')](_0x56f870);}})[_0xbe14('0x13')](function(_0x2e7c31){if(_0x2e7c31){return _0x2e7c31?{'count':_0x5f4675,'rows':_0x2e7c31}:null;}})['then'](respondWithResult(_0x416c65,null))['catch'](handleError(_0x416c65,null));};exports[_0xbe14('0x88')]=function(_0x4b07fc,_0x76e84){var _0x3f687f=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');var _0x4f4b69,_0x43d760;return db['VoiceQueue'][_0xbe14('0x1d')]({'where':{'id':_0x4b07fc[_0xbe14('0x2b')]['id']}})['then'](handleEntityNotFound(_0x76e84,null))[_0xbe14('0x13')](function(_0x30657c){if(_0x30657c){_0x43d760=_0x30657c;return _0x30657c[_0xbe14('0x88')](_0x4b07fc[_0xbe14('0x37')][_0xbe14('0x6a')],_['omit'](_0x4b07fc[_0xbe14('0x37')],[_0xbe14('0x6a'),'id'])||{});}return null;})[_0xbe14('0x82')](function(_0xd97d02){var _0x15082b;_0x4f4b69=_0xd97d02||[];var _0x5d15c7=[];if(_0xd97d02){for(var _0x66b6a7=0x0;_0x66b6a7<_0xd97d02[_0xbe14('0x32')];_0x66b6a7+=0x1){var _0x4dfe2c=_0xd97d02[_0x66b6a7][_0xbe14('0x15')]({'plain':!![]});_0x43d760['dialCheckDuplicateType']=_0x4b07fc[_0xbe14('0x37')][_0xbe14('0x89')]?_0x4b07fc[_0xbe14('0x37')][_0xbe14('0x89')]:_0x43d760[_0xbe14('0x89')];switch(_0x43d760[_0xbe14('0x89')]){case'always':_0x15082b=squel[_0xbe14('0x8a')]()[_0xbe14('0x8b')](_0xbe14('0x8c'))[_0xbe14('0x8d')]([_0xbe14('0x8e'),_0xbe14('0x8f'),_0xbe14('0x90'),_0xbe14('0x91'),_0xbe14('0x4e'),_0xbe14('0x42'),'updatedAt'],squel[_0xbe14('0x6c')]()[_0xbe14('0x6d')]('phone',_0xbe14('0x8e'))[_0xbe14('0x6d')]('\x27'+_0x3f687f+'\x27',_0xbe14('0x8f'))[_0xbe14('0x6d')]('id',_0xbe14('0x90'))[_0xbe14('0x6d')](_0x4dfe2c[_0xbe14('0x92')][_0xbe14('0x75')](),'ListId')[_0xbe14('0x6d')](_0x4b07fc['params']['id'][_0xbe14('0x75')](),_0xbe14('0x4e'))[_0xbe14('0x6d')]('\x27'+_0x3f687f+'\x27',_0xbe14('0x42'))[_0xbe14('0x6d')]('\x27'+_0x3f687f+'\x27',_0xbe14('0x43'))[_0xbe14('0x6f')]('cm_contacts')['where']('deletedAt\x20IS\x20NULL')[_0xbe14('0x28')](_0xbe14('0x93'),_0x4dfe2c['CmListId'][_0xbe14('0x75')]())[_0xbe14('0x28')](_0xbe14('0x94'))[_0xbe14('0x28')](_0xbe14('0x95'),squel[_0xbe14('0x6c')]()[_0xbe14('0x6d')](_0xbe14('0x96'))[_0xbe14('0x6f')](_0xbe14('0x97'))[_0xbe14('0x28')]('VoiceQueueId\x20=\x20?',_0x4b07fc[_0xbe14('0x2b')]['id']['toString']()))[_0xbe14('0x28')](_0xbe14('0x95'),squel[_0xbe14('0x6c')]()['field'](_0xbe14('0x98'))[_0xbe14('0x6f')]('cm_hopper')[_0xbe14('0x28')](_0xbe14('0x72'),_0x4b07fc[_0xbe14('0x2b')]['id']['toString']())))[_0xbe14('0x75')]();break;case _0xbe14('0x99'):_0x15082b=squel['insert']()[_0xbe14('0x8b')]('cm_hopper')[_0xbe14('0x8d')]([_0xbe14('0x8e'),_0xbe14('0x8f'),_0xbe14('0x90'),'ListId','VoiceQueueId',_0xbe14('0x42'),_0xbe14('0x43')],squel['select']()['field'](_0xbe14('0x8e'),'phone')[_0xbe14('0x6d')]('\x27'+_0x3f687f+'\x27',_0xbe14('0x8f'))[_0xbe14('0x6d')]('id',_0xbe14('0x90'))[_0xbe14('0x6d')](_0x4dfe2c[_0xbe14('0x92')][_0xbe14('0x75')](),_0xbe14('0x91'))[_0xbe14('0x6d')](_0x4b07fc[_0xbe14('0x2b')]['id']['toString'](),'VoiceQueueId')['field']('\x27'+_0x3f687f+'\x27',_0xbe14('0x42'))[_0xbe14('0x6d')]('\x27'+_0x3f687f+'\x27',_0xbe14('0x43'))[_0xbe14('0x6f')](_0xbe14('0x9a'))[_0xbe14('0x28')](_0xbe14('0x9b'))[_0xbe14('0x28')](_0xbe14('0x93'),_0x4dfe2c['CmListId'][_0xbe14('0x75')]())[_0xbe14('0x28')](_0xbe14('0x94'))['where'](_0xbe14('0x95'),squel[_0xbe14('0x6c')]()[_0xbe14('0x6d')](_0xbe14('0x98'))[_0xbe14('0x6f')](_0xbe14('0x8c'))[_0xbe14('0x28')]('VoiceQueueId\x20=\x20?',_0x4b07fc[_0xbe14('0x2b')]['id'][_0xbe14('0x75')]())))['toString']();break;default:_0x15082b=squel['insert']()[_0xbe14('0x8b')](_0xbe14('0x8c'))[_0xbe14('0x8d')](['phone',_0xbe14('0x8f'),_0xbe14('0x90'),_0xbe14('0x91'),_0xbe14('0x4e'),_0xbe14('0x42'),_0xbe14('0x43')],squel['select']()[_0xbe14('0x6d')]('phone',_0xbe14('0x8e'))[_0xbe14('0x6d')]('\x27'+_0x3f687f+'\x27',_0xbe14('0x8f'))['field']('id',_0xbe14('0x90'))[_0xbe14('0x6d')](_0x4dfe2c['CmListId'][_0xbe14('0x75')](),'ListId')[_0xbe14('0x6d')](_0x4b07fc['params']['id'][_0xbe14('0x75')](),'VoiceQueueId')[_0xbe14('0x6d')]('\x27'+_0x3f687f+'\x27',_0xbe14('0x42'))[_0xbe14('0x6d')]('\x27'+_0x3f687f+'\x27',_0xbe14('0x43'))[_0xbe14('0x6f')]('cm_contacts')[_0xbe14('0x28')](_0xbe14('0x9b'))['where'](_0xbe14('0x93'),_0x4dfe2c[_0xbe14('0x92')]['toString']())[_0xbe14('0x28')](_0xbe14('0x94')))[_0xbe14('0x75')]();}_0x5d15c7['push'](db[_0xbe14('0x60')][_0xbe14('0x2e')](_0x15082b));}return BPromise[_0xbe14('0x7a')](_0x5d15c7);}})[_0xbe14('0x13')](function(){var _0x4bc564=[];var _0x19e7ce=squel[_0xbe14('0x8a')]()[_0xbe14('0x8b')](_0xbe14('0x9c'))[_0xbe14('0x8d')]([_0xbe14('0x9d'),_0xbe14('0x8e'),_0xbe14('0x9e'),_0xbe14('0x42'),'updatedAt'],squel[_0xbe14('0x6c')]()['field']('h.id')[_0xbe14('0x6d')](_0xbe14('0x9f'))['field'](_0xbe14('0xa0'))[_0xbe14('0x6d')]('\x27'+_0x3f687f+'\x27','createdAt')[_0xbe14('0x6d')]('\x27'+_0x3f687f+'\x27',_0xbe14('0x43'))[_0xbe14('0x6f')](_0xbe14('0xa1'),'ci')[_0xbe14('0x71')](_0xbe14('0x8c'),'h','h.ContactId=ci.CmContactId')['where'](_0xbe14('0xa2'),_0x3f687f)['where'](_0xbe14('0xa3'),_0xbe14('0xa4')))['toString']();_0x4bc564[_0xbe14('0x74')](db[_0xbe14('0x60')][_0xbe14('0x2e')](_0x19e7ce));return BPromise[_0xbe14('0x7a')](_0x4bc564);})[_0xbe14('0x13')](function(){return _0x4f4b69;})[_0xbe14('0x13')](respondWithResult(_0x76e84,null))[_0xbe14('0x35')](handleError(_0x76e84,null));};exports['removeLists']=function(_0x4ceca6,_0x23f4a3){return db[_0xbe14('0x23')][_0xbe14('0x1d')]({'where':{'id':_0x4ceca6[_0xbe14('0x2b')]['id']}})[_0xbe14('0x13')](handleEntityNotFound(_0x23f4a3,null))[_0xbe14('0x13')](function(_0x2fe8b0){if(_0x2fe8b0){return _0x2fe8b0[_0xbe14('0xa5')](_0x4ceca6['query'][_0xbe14('0x6a')]);}})[_0xbe14('0x13')](function(_0x186284){if(_0x186284){return db['CmHopper'][_0xbe14('0x14')]({'where':{'ListId':_0x4ceca6[_0xbe14('0x2e')][_0xbe14('0x6a')],'VoiceQueueId':_0x4ceca6[_0xbe14('0x2b')]['id']}})[_0xbe14('0x13')](function(){return _0x186284;});}})['then'](respondWithStatusCode(_0x23f4a3,null))[_0xbe14('0x35')](handleError(_0x23f4a3,null));};exports[_0xbe14('0xa6')]=function(_0x4c9319,_0x1173f0){var _0x1e0c81={};var _0x5349a7={};var _0x5e3819;var _0x28c5fe;return db[_0xbe14('0x23')][_0xbe14('0x52')]({'where':{'id':_0x4c9319['params']['id']}})[_0xbe14('0x13')](handleEntityNotFound(_0x1173f0,null))[_0xbe14('0x13')](function(_0x59434a){if(_0x59434a){_0x5e3819=_0x59434a;_0x5349a7[_0xbe14('0x2c')]=_[_0xbe14('0x2d')](db[_0xbe14('0x87')]['rawAttributes']);_0x5349a7[_0xbe14('0x2e')]=_[_0xbe14('0x2d')](_0x4c9319[_0xbe14('0x2e')]);_0x5349a7[_0xbe14('0x48')]=_[_0xbe14('0x2f')](_0x5349a7[_0xbe14('0x2c')],_0x5349a7[_0xbe14('0x2e')]);_0x1e0c81[_0xbe14('0x30')]=_['intersection'](_0x5349a7[_0xbe14('0x2c')],qs[_0xbe14('0x31')](_0x4c9319[_0xbe14('0x2e')][_0xbe14('0x31')]));_0x1e0c81[_0xbe14('0x30')]=_0x1e0c81['attributes'][_0xbe14('0x32')]?_0x1e0c81[_0xbe14('0x30')]:_0x5349a7[_0xbe14('0x2c')];_0x1e0c81[_0xbe14('0x4b')]=qs[_0xbe14('0x4c')](_0x4c9319[_0xbe14('0x2e')]['sort']);_0x1e0c81['where']=qs['filters'](_[_0xbe14('0x4d')](_0x4c9319[_0xbe14('0x2e')],_0x5349a7['filters']));if(_0x4c9319[_0xbe14('0x2e')][_0xbe14('0x19')]){_0x1e0c81[_0xbe14('0x28')]=_[_0xbe14('0x40')](_0x1e0c81['where'],{'$or':_[_0xbe14('0x1a')](_0x1e0c81[_0xbe14('0x30')],function(_0x52bbc1){var _0x2797ef={};_0x2797ef[_0x52bbc1]={'$like':'%'+_0x4c9319['query']['filter']+'%'};return _0x2797ef;})});}_0x1e0c81=_[_0xbe14('0x40')]({},_0x1e0c81,_0x4c9319[_0xbe14('0x34')]);return _0x5e3819[_0xbe14('0xa6')](_0x1e0c81);}})[_0xbe14('0x13')](function(_0x47bba1){if(_0x47bba1){_0x28c5fe=_0x47bba1[_0xbe14('0x32')];if(!_0x4c9319[_0xbe14('0x2e')][_0xbe14('0x49')](_0xbe14('0x4a'))){_0x1e0c81['limit']=qs[_0xbe14('0xf')](_0x4c9319[_0xbe14('0x2e')][_0xbe14('0xf')]);_0x1e0c81[_0xbe14('0xd')]=qs[_0xbe14('0xd')](_0x4c9319[_0xbe14('0x2e')][_0xbe14('0xd')]);}return _0x5e3819[_0xbe14('0xa6')](_0x1e0c81);}})['then'](function(_0x2592ab){if(_0x2592ab){return _0x2592ab?{'count':_0x28c5fe,'rows':_0x2592ab}:null;}})[_0xbe14('0x13')](respondWithResult(_0x1173f0,null))['catch'](handleError(_0x1173f0,null));};exports['addBlackLists']=function(_0x6a0f29,_0x3d04b9){var _0x21f793;return db[_0xbe14('0x23')][_0xbe14('0x1d')]({'where':{'id':_0x6a0f29[_0xbe14('0x2b')]['id']}})['then'](handleEntityNotFound(_0x3d04b9,null))[_0xbe14('0x13')](function(_0x37e5e8){if(_0x37e5e8){return _0x37e5e8['addBlackLists'](_0x6a0f29[_0xbe14('0x37')][_0xbe14('0x6a')],_[_0xbe14('0x41')](_0x6a0f29[_0xbe14('0x37')],[_0xbe14('0x6a'),'id'])||{});}return null;})[_0xbe14('0x82')](function(_0x14cec7){var _0x524603;_0x21f793=_0x14cec7||[];var _0x38d720=[];if(_0x14cec7){for(var _0x379446=0x0;_0x379446<_0x14cec7[_0xbe14('0x32')];_0x379446+=0x1){var _0x1489c9=_0x14cec7[_0x379446][_0xbe14('0x15')]({'plain':!![]});_0x524603=squel[_0xbe14('0x8a')]()[_0xbe14('0x8b')](_0xbe14('0xa7'))['fromQuery']([_0xbe14('0x8e'),_0xbe14('0x90'),_0xbe14('0x91'),'VoiceQueueId',_0xbe14('0x42'),_0xbe14('0x43')],squel[_0xbe14('0x6c')]()['field'](_0xbe14('0x8e'),'phone')[_0xbe14('0x6d')]('id',_0xbe14('0x90'))[_0xbe14('0x6d')](_0x1489c9[_0xbe14('0x92')][_0xbe14('0x75')](),_0xbe14('0x91'))[_0xbe14('0x6d')](_0x6a0f29['params']['id'][_0xbe14('0x75')](),_0xbe14('0x4e'))[_0xbe14('0x6d')](_0xbe14('0xa8'),_0xbe14('0x42'))[_0xbe14('0x6d')](_0xbe14('0xa8'),'updatedAt')[_0xbe14('0x6f')](_0xbe14('0x9a'))[_0xbe14('0x28')](_0xbe14('0x9b'))[_0xbe14('0x28')](_0xbe14('0x93'),_0x1489c9[_0xbe14('0x92')][_0xbe14('0x75')]())[_0xbe14('0x28')](_0xbe14('0x94')))[_0xbe14('0x75')]();_0x38d720[_0xbe14('0x74')](db['sequelize'][_0xbe14('0x2e')](_0x524603));}return BPromise[_0xbe14('0x7a')](_0x38d720);}})['then'](function(){return _0x21f793;})['then'](respondWithResult(_0x3d04b9,null))[_0xbe14('0x35')](handleError(_0x3d04b9,null));};exports[_0xbe14('0xa9')]=function(_0x7533c3,_0x3ec670){return db[_0xbe14('0x23')][_0xbe14('0x1d')]({'where':{'id':_0x7533c3[_0xbe14('0x2b')]['id']}})[_0xbe14('0x13')](handleEntityNotFound(_0x3ec670,null))['then'](function(_0x3ee9e2){if(_0x3ee9e2){return _0x3ee9e2['removeBlackLists'](_0x7533c3[_0xbe14('0x2e')][_0xbe14('0x6a')]);}})[_0xbe14('0x13')](function(_0x1d343a){if(_0x1d343a){return db[_0xbe14('0x57')][_0xbe14('0x14')]({'where':{'ListId':_0x7533c3['query']['ids'],'VoiceQueueId':_0x7533c3['params']['id']}})['then'](function(){return _0x1d343a;});}})['then'](respondWithStatusCode(_0x3ec670,null))[_0xbe14('0x35')](handleError(_0x3ec670,null));}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.events.js b/server/api/voiceQueue/voiceQueue.events.js index 14836a5..550efe8 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 _0xcab9=['hook','exports','events','../../mysqldb','VoiceQueue','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0x50f92b,_0x32fab3){var _0x5cedbc=function(_0x26a3a5){while(--_0x26a3a5){_0x50f92b['push'](_0x50f92b['shift']());}};_0x5cedbc(++_0x32fab3);}(_0xcab9,0x16d));var _0x9cab=function(_0x3f88bc,_0xe38cf5){_0x3f88bc=_0x3f88bc-0x0;var _0x4df1c4=_0xcab9[_0x3f88bc];return _0x4df1c4;};'use strict';var EventEmitter=require(_0x9cab('0x0'));var VoiceQueue=require(_0x9cab('0x1'))['db'][_0x9cab('0x2')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0x9cab('0x3')](0x0);var events={'afterCreate':_0x9cab('0x4'),'afterUpdate':_0x9cab('0x5'),'afterDestroy':_0x9cab('0x6')};function emitEvent(_0x43d2b7){return function(_0x50304e,_0x3af061,_0x36cadc){VoiceQueueEvents[_0x9cab('0x7')](_0x43d2b7+':'+_0x50304e['id'],_0x50304e);VoiceQueueEvents['emit'](_0x43d2b7,_0x50304e);_0x36cadc(null);};}for(var e in events){if(events[_0x9cab('0x8')](e)){var event=events[e];VoiceQueue[_0x9cab('0x9')](e,emitEvent(event));}}module[_0x9cab('0xa')]=VoiceQueueEvents; \ No newline at end of file +var _0x61ef=['../../mysqldb','VoiceQueue','save','remove','emit','hasOwnProperty','exports','events'];(function(_0x4eb2eb,_0x4e130a){var _0x27317c=function(_0x402538){while(--_0x402538){_0x4eb2eb['push'](_0x4eb2eb['shift']());}};_0x27317c(++_0x4e130a);}(_0x61ef,0x11f));var _0xf61e=function(_0x88cd7b,_0x4c884c){_0x88cd7b=_0x88cd7b-0x0;var _0x56fcc8=_0x61ef[_0x88cd7b];return _0x56fcc8;};'use strict';var EventEmitter=require(_0xf61e('0x0'));var VoiceQueue=require(_0xf61e('0x1'))['db'][_0xf61e('0x2')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xf61e('0x3'),'afterUpdate':'update','afterDestroy':_0xf61e('0x4')};function emitEvent(_0x2ec4c3){return function(_0x24f058,_0x147f24,_0x7d3fbd){VoiceQueueEvents[_0xf61e('0x5')](_0x2ec4c3+':'+_0x24f058['id'],_0x24f058);VoiceQueueEvents[_0xf61e('0x5')](_0x2ec4c3,_0x24f058);_0x7d3fbd(null);};}for(var e in events){if(events[_0xf61e('0x6')](e)){var event=events[e];VoiceQueue['hook'](e,emitEvent(event));}}module[_0xf61e('0x7')]=VoiceQueueEvents; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.model.js b/server/api/voiceQueue/voiceQueue.model.js index f93bcae..88eb8ac 100644 --- a/server/api/voiceQueue/voiceQueue.model.js +++ b/server/api/voiceQueue/voiceQueue.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9c44=['request-promise','path','./voiceQueue.attributes','define','VoiceQueue','voice_queues','../../config/logger','api','moment','bluebird'];(function(_0x26c31e,_0xe3072a){var _0x469f89=function(_0x33f257){while(--_0x33f257){_0x26c31e['push'](_0x26c31e['shift']());}};_0x469f89(++_0xe3072a);}(_0x9c44,0x178));var _0x49c4=function(_0x255d5b,_0x4f6f35){_0x255d5b=_0x255d5b-0x0;var _0x3e141a=_0x9c44[_0x255d5b];return _0x3e141a;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x49c4('0x0'))(_0x49c4('0x1'));var moment=require(_0x49c4('0x2'));var BPromise=require(_0x49c4('0x3'));var rp=require(_0x49c4('0x4'));var fs=require('fs');var path=require(_0x49c4('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x49c4('0x6'));module['exports']=function(_0xc1278f,_0x6030ae){return _0xc1278f[_0x49c4('0x7')](_0x49c4('0x8'),attributes,{'tableName':_0x49c4('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x34e8=['voice_queues','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./voiceQueue.attributes','exports','VoiceQueue'];(function(_0x4a8514,_0x1eae9b){var _0x5657ba=function(_0x2558a3){while(--_0x2558a3){_0x4a8514['push'](_0x4a8514['shift']());}};_0x5657ba(++_0x1eae9b);}(_0x34e8,0x12c));var _0x834e=function(_0x4a3f84,_0x30a3a3){_0x4a3f84=_0x4a3f84-0x0;var _0x159b4a=_0x34e8[_0x4a3f84];return _0x159b4a;};'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 83b6705..d88b765 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 _0x5af2=['moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./voiceQueue.socket','register','request','then','info','VoiceQueue,\x20%s,\x20%s','request\x20sent','debug','VoiceQueue,\x20%s,\x20%s,\x20%s','error','code','message','GetVoiceQueue','VoiceQueue','findAll','options','raw','attributes','include','map','model','stringify','catch','ShowVoiceQueue','find','where','util'];(function(_0x1ae106,_0x7b4fa5){var _0x472f8f=function(_0x236abf){while(--_0x236abf){_0x1ae106['push'](_0x1ae106['shift']());}};_0x472f8f(++_0x7b4fa5);}(_0x5af2,0x117));var _0x25af=function(_0x422905,_0x3bce3a){_0x422905=_0x422905-0x0;var _0x33dc6c=_0x5af2[_0x422905];return _0x33dc6c;};'use strict';var _=require('lodash');var util=require(_0x25af('0x0'));var moment=require(_0x25af('0x1'));var BPromise=require(_0x25af('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x25af('0x3'));var db=require(_0x25af('0x4'))['db'];var utils=require(_0x25af('0x5'));var logger=require(_0x25af('0x6'))(_0x25af('0x7'));var config=require('../../config/environment');var jayson=require(_0x25af('0x8'));var client=jayson['client'][_0x25af('0x9')]({'port':0x232a});config[_0x25af('0xa')]=_[_0x25af('0xb')](config[_0x25af('0xa')],{'host':_0x25af('0xc'),'port':0x18eb});var socket=require(_0x25af('0xd'))(new Redis(config['redis']));require(_0x25af('0xe'))[_0x25af('0xf')](socket);function respondWithRpcPromise(_0x196cb0,_0x11567e,_0x165261){return new BPromise(function(_0xdfb4ee,_0x4228dd){return client[_0x25af('0x10')](_0x196cb0,_0x165261)[_0x25af('0x11')](function(_0x637b36){logger[_0x25af('0x12')](_0x25af('0x13'),_0x11567e,_0x25af('0x14'));logger[_0x25af('0x15')](_0x25af('0x16'),_0x11567e,_0x25af('0x14'),JSON['stringify'](_0x637b36));if(_0x637b36[_0x25af('0x17')]){if(_0x637b36['error'][_0x25af('0x18')]===0x1f4){logger[_0x25af('0x17')](_0x25af('0x13'),_0x11567e,_0x637b36[_0x25af('0x17')][_0x25af('0x19')]);return _0x4228dd(_0x637b36[_0x25af('0x17')]['message']);}logger[_0x25af('0x17')](_0x25af('0x13'),_0x11567e,_0x637b36[_0x25af('0x17')][_0x25af('0x19')]);return _0xdfb4ee(_0x637b36['error'][_0x25af('0x19')]);}else{logger[_0x25af('0x12')](_0x25af('0x13'),_0x11567e,'request\x20sent');_0xdfb4ee(_0x637b36['result'][_0x25af('0x19')]);}})['catch'](function(_0x42b934){logger[_0x25af('0x17')](_0x25af('0x13'),_0x11567e,_0x42b934);_0x4228dd(_0x42b934);});});}exports[_0x25af('0x1a')]=function(_0x5e1e0d){var _0x148b65=this;return new Promise(function(_0x11437b,_0x4037f8){return db[_0x25af('0x1b')][_0x25af('0x1c')]({'raw':_0x5e1e0d[_0x25af('0x1d')]?_0x5e1e0d[_0x25af('0x1d')][_0x25af('0x1e')]===undefined?!![]:![]:!![],'where':_0x5e1e0d['options']?_0x5e1e0d[_0x25af('0x1d')]['where']||null:null,'attributes':_0x5e1e0d[_0x25af('0x1d')]?_0x5e1e0d[_0x25af('0x1d')][_0x25af('0x1f')]||null:null,'limit':_0x5e1e0d[_0x25af('0x1d')]?_0x5e1e0d[_0x25af('0x1d')]['limit']||null:null,'include':_0x5e1e0d[_0x25af('0x1d')]?_0x5e1e0d[_0x25af('0x1d')][_0x25af('0x20')]?_[_0x25af('0x21')](_0x5e1e0d[_0x25af('0x1d')]['include'],function(_0xc56036){return{'model':db[_0xc56036['model']],'as':_0xc56036['as'],'attributes':_0xc56036[_0x25af('0x1f')],'include':_0xc56036['include']?_[_0x25af('0x21')](_0xc56036[_0x25af('0x20')],function(_0x4d666a){return{'model':db[_0x4d666a[_0x25af('0x22')]],'as':_0x4d666a['as'],'attributes':_0x4d666a[_0x25af('0x1f')],'include':_0x4d666a['include']?_[_0x25af('0x21')](_0x4d666a[_0x25af('0x20')],function(_0xdefacc){return{'model':db[_0xdefacc['model']],'as':_0xdefacc['as'],'attributes':_0xdefacc[_0x25af('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x14732c){logger[_0x25af('0x12')]('GetVoiceQueue',_0x5e1e0d);logger[_0x25af('0x15')](_0x25af('0x1a'),_0x5e1e0d,JSON[_0x25af('0x23')](_0x14732c));_0x11437b(_0x14732c);})[_0x25af('0x24')](function(_0x4cc00c){logger[_0x25af('0x17')](_0x25af('0x1a'),_0x4cc00c['message'],_0x5e1e0d);_0x4037f8(_0x148b65[_0x25af('0x17')](0x1f4,_0x4cc00c[_0x25af('0x19')]));});});};exports[_0x25af('0x25')]=function(_0x146357){var _0x26c047=this;return new Promise(function(_0x5f5c7b,_0x2b2d7e){return db[_0x25af('0x1b')][_0x25af('0x26')]({'raw':_0x146357[_0x25af('0x1d')]?_0x146357['options'][_0x25af('0x1e')]===undefined?!![]:![]:!![],'where':_0x146357[_0x25af('0x1d')]?_0x146357['options'][_0x25af('0x27')]||null:null,'attributes':_0x146357[_0x25af('0x1d')]?_0x146357['options'][_0x25af('0x1f')]||null:null,'include':_0x146357[_0x25af('0x1d')]?_0x146357['options']['include']?_['map'](_0x146357[_0x25af('0x1d')]['include'],function(_0x3fe49a){return{'model':db[_0x3fe49a['model']],'as':_0x3fe49a['as'],'attributes':_0x3fe49a['attributes'],'include':_0x3fe49a[_0x25af('0x20')]?_[_0x25af('0x21')](_0x3fe49a[_0x25af('0x20')],function(_0xe215d3){return{'model':db[_0xe215d3[_0x25af('0x22')]],'as':_0xe215d3['as'],'attributes':_0xe215d3[_0x25af('0x1f')],'include':_0xe215d3[_0x25af('0x20')]?_[_0x25af('0x21')](_0xe215d3[_0x25af('0x20')],function(_0x11227b){return{'model':db[_0x11227b[_0x25af('0x22')]],'as':_0x11227b['as'],'attributes':_0x11227b[_0x25af('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x25af('0x11')](function(_0x587edb){logger[_0x25af('0x12')]('ShowVoiceQueue',_0x146357);logger[_0x25af('0x15')](_0x25af('0x25'),_0x146357,JSON[_0x25af('0x23')](_0x587edb));_0x5f5c7b(_0x587edb);})['catch'](function(_0x3de83b){logger[_0x25af('0x17')]('ShowVoiceQueue',_0x3de83b[_0x25af('0x19')],_0x146357);_0x2b2d7e(_0x26c047[_0x25af('0x17')](0x1f4,_0x3de83b['message']));});});}; \ No newline at end of file +var _0xb592=['redis','register','request','info','VoiceQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','VoiceQueue','options','raw','where','attributes','include','map','model','then','GetVoiceQueue','find','ShowVoiceQueue','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http'];(function(_0x3bb70e,_0x3f990c){var _0x21906a=function(_0x438dde){while(--_0x438dde){_0x3bb70e['push'](_0x3bb70e['shift']());}};_0x21906a(++_0x3f990c);}(_0xb592,0x1ec));var _0x2b59=function(_0x4279e1,_0x39cda4){_0x4279e1=_0x4279e1-0x0;var _0x1e33ea=_0xb592[_0x4279e1];return _0x1e33ea;};'use strict';var _=require(_0x2b59('0x0'));var util=require(_0x2b59('0x1'));var moment=require(_0x2b59('0x2'));var BPromise=require(_0x2b59('0x3'));var rs=require(_0x2b59('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2b59('0x5'))['db'];var utils=require(_0x2b59('0x6'));var logger=require(_0x2b59('0x7'))(_0x2b59('0x8'));var config=require(_0x2b59('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x2b59('0xa')][_0x2b59('0xb')]({'port':0x232a});config['redis']=_['defaults'](config[_0x2b59('0xc')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x2b59('0xc')]));require('./voiceQueue.socket')[_0x2b59('0xd')](socket);function respondWithRpcPromise(_0x351f49,_0x26b537,_0x596170){return new BPromise(function(_0x1ceb0e,_0x3b559e){return client[_0x2b59('0xe')](_0x351f49,_0x596170)['then'](function(_0xd7f23e){logger[_0x2b59('0xf')](_0x2b59('0x10'),_0x26b537,_0x2b59('0x11'));logger[_0x2b59('0x12')]('VoiceQueue,\x20%s,\x20%s,\x20%s',_0x26b537,_0x2b59('0x11'),JSON[_0x2b59('0x13')](_0xd7f23e));if(_0xd7f23e[_0x2b59('0x14')]){if(_0xd7f23e[_0x2b59('0x14')]['code']===0x1f4){logger['error'](_0x2b59('0x10'),_0x26b537,_0xd7f23e[_0x2b59('0x14')][_0x2b59('0x15')]);return _0x3b559e(_0xd7f23e[_0x2b59('0x14')][_0x2b59('0x15')]);}logger['error'](_0x2b59('0x10'),_0x26b537,_0xd7f23e[_0x2b59('0x14')]['message']);return _0x1ceb0e(_0xd7f23e[_0x2b59('0x14')][_0x2b59('0x15')]);}else{logger['info']('VoiceQueue,\x20%s,\x20%s',_0x26b537,'request\x20sent');_0x1ceb0e(_0xd7f23e[_0x2b59('0x16')][_0x2b59('0x15')]);}})[_0x2b59('0x17')](function(_0x451587){logger['error'](_0x2b59('0x10'),_0x26b537,_0x451587);_0x3b559e(_0x451587);});});}exports['GetVoiceQueue']=function(_0xe35a79){var _0xd17ad1=this;return new Promise(function(_0x2fdab2,_0x245847){return db[_0x2b59('0x18')]['findAll']({'raw':_0xe35a79[_0x2b59('0x19')]?_0xe35a79['options'][_0x2b59('0x1a')]===undefined?!![]:![]:!![],'where':_0xe35a79[_0x2b59('0x19')]?_0xe35a79[_0x2b59('0x19')][_0x2b59('0x1b')]||null:null,'attributes':_0xe35a79[_0x2b59('0x19')]?_0xe35a79[_0x2b59('0x19')][_0x2b59('0x1c')]||null:null,'limit':_0xe35a79[_0x2b59('0x19')]?_0xe35a79[_0x2b59('0x19')]['limit']||null:null,'include':_0xe35a79['options']?_0xe35a79['options'][_0x2b59('0x1d')]?_[_0x2b59('0x1e')](_0xe35a79[_0x2b59('0x19')][_0x2b59('0x1d')],function(_0x16eb95){return{'model':db[_0x16eb95[_0x2b59('0x1f')]],'as':_0x16eb95['as'],'attributes':_0x16eb95[_0x2b59('0x1c')],'include':_0x16eb95[_0x2b59('0x1d')]?_[_0x2b59('0x1e')](_0x16eb95[_0x2b59('0x1d')],function(_0x3b8eea){return{'model':db[_0x3b8eea[_0x2b59('0x1f')]],'as':_0x3b8eea['as'],'attributes':_0x3b8eea[_0x2b59('0x1c')],'include':_0x3b8eea[_0x2b59('0x1d')]?_[_0x2b59('0x1e')](_0x3b8eea[_0x2b59('0x1d')],function(_0x3ca698){return{'model':db[_0x3ca698['model']],'as':_0x3ca698['as'],'attributes':_0x3ca698[_0x2b59('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x2b59('0x20')](function(_0x155d4d){logger[_0x2b59('0xf')]('GetVoiceQueue',_0xe35a79);logger[_0x2b59('0x12')](_0x2b59('0x21'),_0xe35a79,JSON['stringify'](_0x155d4d));_0x2fdab2(_0x155d4d);})[_0x2b59('0x17')](function(_0x55fc96){logger[_0x2b59('0x14')](_0x2b59('0x21'),_0x55fc96['message'],_0xe35a79);_0x245847(_0xd17ad1['error'](0x1f4,_0x55fc96[_0x2b59('0x15')]));});});};exports['ShowVoiceQueue']=function(_0x7c13ca){var _0x91be19=this;return new Promise(function(_0x5ed5db,_0x248198){return db[_0x2b59('0x18')][_0x2b59('0x22')]({'raw':_0x7c13ca['options']?_0x7c13ca['options'][_0x2b59('0x1a')]===undefined?!![]:![]:!![],'where':_0x7c13ca[_0x2b59('0x19')]?_0x7c13ca[_0x2b59('0x19')]['where']||null:null,'attributes':_0x7c13ca['options']?_0x7c13ca[_0x2b59('0x19')]['attributes']||null:null,'include':_0x7c13ca[_0x2b59('0x19')]?_0x7c13ca[_0x2b59('0x19')][_0x2b59('0x1d')]?_[_0x2b59('0x1e')](_0x7c13ca[_0x2b59('0x19')][_0x2b59('0x1d')],function(_0x357756){return{'model':db[_0x357756['model']],'as':_0x357756['as'],'attributes':_0x357756[_0x2b59('0x1c')],'include':_0x357756['include']?_[_0x2b59('0x1e')](_0x357756[_0x2b59('0x1d')],function(_0x5a588e){return{'model':db[_0x5a588e['model']],'as':_0x5a588e['as'],'attributes':_0x5a588e[_0x2b59('0x1c')],'include':_0x5a588e['include']?_[_0x2b59('0x1e')](_0x5a588e['include'],function(_0x275b8b){return{'model':db[_0x275b8b[_0x2b59('0x1f')]],'as':_0x275b8b['as'],'attributes':_0x275b8b[_0x2b59('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x2b59('0x20')](function(_0x2a2c31){logger[_0x2b59('0xf')](_0x2b59('0x23'),_0x7c13ca);logger[_0x2b59('0x12')](_0x2b59('0x23'),_0x7c13ca,JSON[_0x2b59('0x13')](_0x2a2c31));_0x5ed5db(_0x2a2c31);})[_0x2b59('0x17')](function(_0x19779e){logger['error'](_0x2b59('0x23'),_0x19779e['message'],_0x7c13ca);_0x248198(_0x91be19[_0x2b59('0x14')](0x1f4,_0x19779e[_0x2b59('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.socket.js b/server/api/voiceQueue/voiceQueue.socket.js index 4e646b3..1ca9d3c 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 _0x02ed=['voiceQueue:','./voiceQueue.events','update','register','length'];(function(_0x3a303e,_0x29fe2c){var _0x4d62dd=function(_0x3fca6c){while(--_0x3fca6c){_0x3a303e['push'](_0x3a303e['shift']());}};_0x4d62dd(++_0x29fe2c);}(_0x02ed,0xec));var _0xd02e=function(_0x30df14,_0x5034f4){_0x30df14=_0x30df14-0x0;var _0x3795c0=_0x02ed[_0x30df14];return _0x3795c0;};'use strict';var VoiceQueueEvents=require(_0xd02e('0x0'));var events=['save','remove',_0xd02e('0x1')];function createListener(_0x170a3d,_0x13fdda){return function(_0x443bb1){_0x13fdda['emit'](_0x170a3d,_0x443bb1);};}function removeListener(_0x4ab89a,_0x1e92a6){return function(){VoiceQueueEvents['removeListener'](_0x4ab89a,_0x1e92a6);};}exports[_0xd02e('0x2')]=function(_0x124dcb){for(var _0x339dea=0x0,_0x5e08ed=events[_0xd02e('0x3')];_0x339dea<_0x5e08ed;_0x339dea++){var _0x1e20a3=events[_0x339dea];var _0x3591e5=createListener(_0xd02e('0x4')+_0x1e20a3,_0x124dcb);VoiceQueueEvents['on'](_0x1e20a3,_0x3591e5);}}; \ No newline at end of file +var _0x15d7=['length','voiceQueue:','./voiceQueue.events','save','remove','update','emit','removeListener','register'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x15d7,0xbf));var _0x715d=function(_0x286969,_0x343699){_0x286969=_0x286969-0x0;var _0x175780=_0x15d7[_0x286969];return _0x175780;};'use strict';var VoiceQueueEvents=require(_0x715d('0x0'));var events=[_0x715d('0x1'),_0x715d('0x2'),_0x715d('0x3')];function createListener(_0x2d8ae8,_0x549f81){return function(_0x549cfb){_0x549f81[_0x715d('0x4')](_0x2d8ae8,_0x549cfb);};}function removeListener(_0x171463,_0x579933){return function(){VoiceQueueEvents[_0x715d('0x5')](_0x171463,_0x579933);};}exports[_0x715d('0x6')]=function(_0x12b2a1){for(var _0x1ce2d1=0x0,_0x22b9b4=events[_0x715d('0x7')];_0x1ce2d1<_0x22b9b4;_0x1ce2d1++){var _0x415cfa=events[_0x1ce2d1];var _0x1a30b7=createListener(_0x715d('0x8')+_0x415cfa,_0x12b2a1);VoiceQueueEvents['on'](_0x415cfa,_0x1a30b7);}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/index.js b/server/api/voiceQueueReport/index.js index ee178e3..d1e70ee 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 _0x30e7=['put','update','delete','destroy','util','connect-timeout','Router','fs-extra','../../components/auth/service','./voiceQueueReport.controller','get','isAuthenticated','index','describe','getVoiceQueuesReport','/:id','show','create'];(function(_0x547660,_0x41ce24){var _0x1421bb=function(_0x306aa7){while(--_0x306aa7){_0x547660['push'](_0x547660['shift']());}};_0x1421bb(++_0x41ce24);}(_0x30e7,0x1a2));var _0x730e=function(_0x1cc99c,_0x5516b4){_0x1cc99c=_0x1cc99c-0x0;var _0x25567b=_0x30e7[_0x1cc99c];return _0x25567b;};'use strict';var multer=require('multer');var util=require(_0x730e('0x0'));var path=require('path');var timeout=require(_0x730e('0x1'));var express=require('express');var router=express[_0x730e('0x2')]();var fs_extra=require(_0x730e('0x3'));var auth=require(_0x730e('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x730e('0x5'));router[_0x730e('0x6')]('/',auth[_0x730e('0x7')](),controller[_0x730e('0x8')]);router['get']('/describe',auth[_0x730e('0x7')](),controller[_0x730e('0x9')]);router['get']('/index',auth[_0x730e('0x7')](),controller[_0x730e('0xa')]);router[_0x730e('0x6')](_0x730e('0xb'),auth[_0x730e('0x7')](),controller[_0x730e('0xc')]);router['post']('/',auth[_0x730e('0x7')](),controller[_0x730e('0xd')]);router[_0x730e('0xe')](_0x730e('0xb'),auth[_0x730e('0x7')](),controller[_0x730e('0xf')]);router[_0x730e('0x10')](_0x730e('0xb'),auth[_0x730e('0x7')](),controller[_0x730e('0x11')]);module['exports']=router; \ No newline at end of file +var _0x5204=['create','put','update','delete','destroy','exports','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueueReport.controller','get','isAuthenticated','index','/describe','/index','/:id'];(function(_0x4bef8c,_0x57ab3b){var _0x51e1df=function(_0x54d917){while(--_0x54d917){_0x4bef8c['push'](_0x4bef8c['shift']());}};_0x51e1df(++_0x57ab3b);}(_0x5204,0x12c));var _0x4520=function(_0x4f08dd,_0x3784ec){_0x4f08dd=_0x4f08dd-0x0;var _0x3017ee=_0x5204[_0x4f08dd];return _0x3017ee;};'use strict';var multer=require(_0x4520('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x4520('0x1'));var express=require(_0x4520('0x2'));var router=express[_0x4520('0x3')]();var fs_extra=require(_0x4520('0x4'));var auth=require(_0x4520('0x5'));var interaction=require(_0x4520('0x6'));var config=require(_0x4520('0x7'));var controller=require(_0x4520('0x8'));router[_0x4520('0x9')]('/',auth[_0x4520('0xa')](),controller[_0x4520('0xb')]);router[_0x4520('0x9')](_0x4520('0xc'),auth[_0x4520('0xa')](),controller['describe']);router[_0x4520('0x9')](_0x4520('0xd'),auth[_0x4520('0xa')](),controller['getVoiceQueuesReport']);router['get'](_0x4520('0xe'),auth[_0x4520('0xa')](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0x4520('0xf')]);router[_0x4520('0x10')](_0x4520('0xe'),auth[_0x4520('0xa')](),controller[_0x4520('0x11')]);router[_0x4520('0x12')](_0x4520('0xe'),auth[_0x4520('0xa')](),controller[_0x4520('0x13')]);module[_0x4520('0x14')]=router; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.attributes.js b/server/api/voiceQueueReport/voiceQueueReport.attributes.js index afcebaf..61f62d9 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 _0x74be=['seconds','queuecallerleaveAt','setDataValue','holdtime','INTEGER','BOOLEAN','FORWARD,\x20BLIND,\x20ATTENDED','sequelize','moment','exports','STRING','DATE','queuecallerjoinAt','format','YYYY-MM-DD\x20HH:mm:ss','diff'];(function(_0x311c35,_0x534915){var _0x5cc50c=function(_0x3ad680){while(--_0x3ad680){_0x311c35['push'](_0x311c35['shift']());}};_0x5cc50c(++_0x534915);}(_0x74be,0x157));var _0xe74b=function(_0x514200,_0xd92707){_0x514200=_0x514200-0x0;var _0x8fba22=_0x74be[_0x514200];return _0x8fba22;};'use strict';var Sequelize=require(_0xe74b('0x0'));var moment=require(_0xe74b('0x1'));module[_0xe74b('0x2')]={'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0xe74b('0x3')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0xe74b('0x3')]},'queue':{'type':Sequelize[_0xe74b('0x3')]},'queuecallerjoinAt':{'type':Sequelize[_0xe74b('0x4')]},'queuecallerleaveAt':{'type':Sequelize[_0xe74b('0x4')],'set':function(_0x4e17a4){var _0x4bd48e=moment(_0x4e17a4);var _0x31a2f8=moment(this['getDataValue'](_0xe74b('0x5')))[_0xe74b('0x6')](_0xe74b('0x7'));var _0x5276f7=_0x4bd48e[_0xe74b('0x8')](_0x31a2f8,_0xe74b('0x9'));this['setDataValue'](_0xe74b('0xa'),_0x4e17a4);this[_0xe74b('0xb')](_0xe74b('0xc'),_0x5276f7||null);}},'position':{'type':Sequelize[_0xe74b('0xd')]},'count':{'type':Sequelize[_0xe74b('0xd')]},'queuecallerabandon':{'type':Sequelize[_0xe74b('0xe')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize[_0xe74b('0x4')]},'queuecallercomplete':{'type':Sequelize[_0xe74b('0xe')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0xe74b('0x4')]},'queuecallerexit':{'type':Sequelize[_0xe74b('0xe')],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize['DATE']},'queuecallerexitreason':{'type':Sequelize['STRING'],'comment':'COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT'},'originalposition':{'type':Sequelize[_0xe74b('0xd')]},'channel':{'type':Sequelize[_0xe74b('0x3')]},'connectedlinenum':{'type':Sequelize[_0xe74b('0x3')]},'connectedlinename':{'type':Sequelize[_0xe74b('0x3')]},'accountcode':{'type':Sequelize[_0xe74b('0x3')]},'context':{'type':Sequelize[_0xe74b('0x3')]},'exten':{'type':Sequelize[_0xe74b('0x3')]},'priority':{'type':Sequelize[_0xe74b('0x3')]},'holdtime':{'type':Sequelize[_0xe74b('0xd')]},'mohtime':{'type':Sequelize[_0xe74b('0xd')],'defaultValue':0x0},'assigned':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0xe74b('0x3')]},'transfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'transfertype':{'type':Sequelize[_0xe74b('0x3')],'comment':_0xe74b('0xf')},'transferexten':{'type':Sequelize[_0xe74b('0x3')]},'transferuniqueid':{'type':Sequelize['STRING']},'disposition':{'type':Sequelize[_0xe74b('0x3')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0xe74b('0x3')]},'queuecallerenterreason':{'type':Sequelize[_0xe74b('0xd')],'defaultValue':0x0},'note':{'type':Sequelize[_0xe74b('0x3')]}}; \ No newline at end of file +var _0x5a4b=['format','YYYY-MM-DD\x20HH:mm:ss','seconds','setDataValue','holdtime','INTEGER','BOOLEAN','COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT','moment','STRING','DATE','getDataValue','queuecallerjoinAt'];(function(_0x144b30,_0x77072d){var _0x1bb7bc=function(_0x1082cc){while(--_0x1082cc){_0x144b30['push'](_0x144b30['shift']());}};_0x1bb7bc(++_0x77072d);}(_0x5a4b,0x181));var _0xb5a4=function(_0x46e363,_0x45d7e2){_0x46e363=_0x46e363-0x0;var _0x3fb059=_0x5a4b[_0x46e363];return _0x3fb059;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xb5a4('0x0'));module['exports']={'type':{'type':Sequelize[_0xb5a4('0x1')]},'uniqueid':{'type':Sequelize[_0xb5a4('0x1')]},'calleridnum':{'type':Sequelize[_0xb5a4('0x1')]},'calleridname':{'type':Sequelize[_0xb5a4('0x1')]},'queue':{'type':Sequelize[_0xb5a4('0x1')]},'queuecallerjoinAt':{'type':Sequelize[_0xb5a4('0x2')]},'queuecallerleaveAt':{'type':Sequelize['DATE'],'set':function(_0x59cd36){var _0x4c7f54=moment(_0x59cd36);var _0x1cd8d2=moment(this[_0xb5a4('0x3')](_0xb5a4('0x4')))[_0xb5a4('0x5')](_0xb5a4('0x6'));var _0x5c302c=_0x4c7f54['diff'](_0x1cd8d2,_0xb5a4('0x7'));this[_0xb5a4('0x8')]('queuecallerleaveAt',_0x59cd36);this['setDataValue'](_0xb5a4('0x9'),_0x5c302c||null);}},'position':{'type':Sequelize['INTEGER']},'count':{'type':Sequelize[_0xb5a4('0xa')]},'queuecallerabandon':{'type':Sequelize[_0xb5a4('0xb')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize[_0xb5a4('0x2')]},'queuecallercomplete':{'type':Sequelize[_0xb5a4('0xb')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0xb5a4('0x2')]},'queuecallerexit':{'type':Sequelize[_0xb5a4('0xb')],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0xb5a4('0x2')]},'queuecallerexitreason':{'type':Sequelize['STRING'],'comment':_0xb5a4('0xc')},'originalposition':{'type':Sequelize['INTEGER']},'channel':{'type':Sequelize[_0xb5a4('0x1')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0xb5a4('0x1')]},'accountcode':{'type':Sequelize[_0xb5a4('0x1')]},'context':{'type':Sequelize[_0xb5a4('0x1')]},'exten':{'type':Sequelize[_0xb5a4('0x1')]},'priority':{'type':Sequelize['STRING']},'holdtime':{'type':Sequelize[_0xb5a4('0xa')]},'mohtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'assigned':{'type':Sequelize[_0xb5a4('0xb')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize['STRING']},'transfer':{'type':Sequelize[_0xb5a4('0xb')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0xb5a4('0x1')],'comment':'FORWARD,\x20BLIND,\x20ATTENDED'},'transferexten':{'type':Sequelize['STRING']},'transferuniqueid':{'type':Sequelize[_0xb5a4('0x1')]},'disposition':{'type':Sequelize[_0xb5a4('0x1')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0xb5a4('0x1')]},'queuecallerenterreason':{'type':Sequelize[_0xb5a4('0xa')],'defaultValue':0x0},'note':{'type':Sequelize[_0xb5a4('0x1')]}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.controller.js b/server/api/voiceQueueReport/voiceQueueReport.controller.js index d676290..e32c7dd 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 _0x06fd=['VoiceQueueReport','rawAttributes','fieldName','type','key','model','map','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','where','pick','filters','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','find','create','body','describe','getVoiceQueuesReport','eml-format','rimraf','fast-json-patch','request-promise','moment','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','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','redis','localhost','socket.io-emitter','./voiceQueueReport.socket','register','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','destroy','then','end','error','stack','name','index'];(function(_0x330917,_0x327f78){var _0x2a9b51=function(_0x1ac192){while(--_0x1ac192){_0x330917['push'](_0x330917['shift']());}};_0x2a9b51(++_0x327f78);}(_0x06fd,0xcc));var _0xd06f=function(_0x3b76f7,_0x566c53){_0x3b76f7=_0x3b76f7-0x0;var _0x43984e=_0x06fd[_0x3b76f7];return _0x43984e;};'use strict';var emlformat=require(_0xd06f('0x0'));var rimraf=require(_0xd06f('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd06f('0x2'));var rp=require(_0xd06f('0x3'));var moment=require(_0xd06f('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xd06f('0x5'));var path=require(_0xd06f('0x6'));var sox=require('sox');var csv=require(_0xd06f('0x7'));var ejs=require(_0xd06f('0x8'));var fs=require('fs');var fs_extra=require(_0xd06f('0x9'));var _=require(_0xd06f('0xa'));var squel=require(_0xd06f('0xb'));var crypto=require(_0xd06f('0xc'));var jsforce=require(_0xd06f('0xd'));var deskjs=require(_0xd06f('0xe'));var toCsv=require(_0xd06f('0x7'));var querystring=require(_0xd06f('0xf'));var Papa=require(_0xd06f('0x10'));var Redis=require(_0xd06f('0x11'));var authService=require(_0xd06f('0x12'));var qs=require(_0xd06f('0x13'));var as=require(_0xd06f('0x14'));var hardwareService=require(_0xd06f('0x15'));var logger=require(_0xd06f('0x16'))('api');var utils=require(_0xd06f('0x17'));var config=require(_0xd06f('0x18'));var licenseUtil=require(_0xd06f('0x19'));var db=require('../../mysqldb')['db'];config[_0xd06f('0x1a')]=_['defaults'](config[_0xd06f('0x1a')],{'host':_0xd06f('0x1b'),'port':0x18eb});var socket=require(_0xd06f('0x1c'))(new Redis(config[_0xd06f('0x1a')]));require(_0xd06f('0x1d'))[_0xd06f('0x1e')](socket);function respondWithStatusCode(_0xcd10c0,_0x294662){_0x294662=_0x294662||0xcc;return function(_0x4766e9){if(_0x4766e9){return _0xcd10c0[_0xd06f('0x1f')](_0x294662);}return _0xcd10c0[_0xd06f('0x20')](_0x294662)['end']();};}function respondWithResult(_0x23acab,_0x5d4d8f){_0x5d4d8f=_0x5d4d8f||0xc8;return function(_0x5c6f61){if(_0x5c6f61){return _0x23acab[_0xd06f('0x20')](_0x5d4d8f)[_0xd06f('0x21')](_0x5c6f61);}};}function respondWithFilteredResult(_0x468c02,_0x15cb08){return function(_0x103633){if(_0x103633){var _0xdc7bb5=typeof _0x15cb08[_0xd06f('0x22')]===_0xd06f('0x23')&&typeof _0x15cb08['limit']===_0xd06f('0x23');var _0x492fc1=_0x103633['count'];var _0x1234e0=_0xdc7bb5?0x0:_0x15cb08[_0xd06f('0x22')];var _0x5cba44=_0xdc7bb5?_0x103633[_0xd06f('0x24')]:_0x15cb08[_0xd06f('0x22')]+_0x15cb08[_0xd06f('0x25')];var _0x279f72;if(_0x5cba44>=_0x492fc1){_0x5cba44=_0x492fc1;_0x279f72=0xc8;}else{_0x279f72=0xce;}_0x468c02[_0xd06f('0x20')](_0x279f72);return _0x468c02[_0xd06f('0x26')](_0xd06f('0x27'),_0x1234e0+'-'+_0x5cba44+'/'+_0x492fc1)[_0xd06f('0x21')](_0x103633);}return null;};}function patchUpdates(_0x4cab51){return function(_0x46ea62){try{jsonpatch[_0xd06f('0x28')](_0x46ea62,_0x4cab51,!![]);}catch(_0x4e9621){return BPromise[_0xd06f('0x29')](_0x4e9621);}return _0x46ea62[_0xd06f('0x2a')]();};}function saveUpdates(_0x36b041,_0x20d3fa){return function(_0x5bde6b){if(_0x5bde6b){return _0x5bde6b[_0xd06f('0x2b')](_0x36b041)['then'](function(_0x2386ad){return _0x2386ad;});}return null;};}function removeEntity(_0xbacf01,_0x1d0360){return function(_0xe234f2){if(_0xe234f2){return _0xe234f2[_0xd06f('0x2c')]()[_0xd06f('0x2d')](function(){_0xbacf01[_0xd06f('0x20')](0xcc)[_0xd06f('0x2e')]();});}};}function handleEntityNotFound(_0x261f88,_0x21f371){return function(_0x58ee03){if(!_0x58ee03){_0x261f88[_0xd06f('0x1f')](0x194);}return _0x58ee03;};}function handleError(_0x2cc3f4,_0x206eb7){_0x206eb7=_0x206eb7||0x1f4;return function(_0x437e41){logger[_0xd06f('0x2f')](_0x437e41[_0xd06f('0x30')]);if(_0x437e41[_0xd06f('0x31')]){delete _0x437e41[_0xd06f('0x31')];}_0x2cc3f4['status'](_0x206eb7)['send'](_0x437e41);};}exports[_0xd06f('0x32')]=function(_0x214bed,_0x3b1799){var _0x311a9c={},_0x2a5238={},_0x1901e0={'count':0x0,'rows':[]};var _0x30357a=_['map'](db[_0xd06f('0x33')][_0xd06f('0x34')],function(_0x41153c){return{'name':_0x41153c[_0xd06f('0x35')],'type':_0x41153c[_0xd06f('0x36')][_0xd06f('0x37')]};});_0x2a5238[_0xd06f('0x38')]=_[_0xd06f('0x39')](_0x30357a,'name');_0x2a5238[_0xd06f('0x3a')]=_[_0xd06f('0x3b')](_0x214bed['query']);_0x2a5238['filters']=_[_0xd06f('0x3c')](_0x2a5238[_0xd06f('0x38')],_0x2a5238[_0xd06f('0x3a')]);_0x311a9c[_0xd06f('0x3d')]=_[_0xd06f('0x3c')](_0x2a5238['model'],qs[_0xd06f('0x3e')](_0x214bed[_0xd06f('0x3a')][_0xd06f('0x3e')]));_0x311a9c[_0xd06f('0x3d')]=_0x311a9c[_0xd06f('0x3d')][_0xd06f('0x3f')]?_0x311a9c[_0xd06f('0x3d')]:_0x2a5238['model'];if(!_0x214bed[_0xd06f('0x3a')][_0xd06f('0x40')](_0xd06f('0x41'))){_0x311a9c['limit']=qs[_0xd06f('0x25')](_0x214bed['query']['limit']);_0x311a9c[_0xd06f('0x22')]=qs[_0xd06f('0x22')](_0x214bed[_0xd06f('0x3a')][_0xd06f('0x22')]);}_0x311a9c[_0xd06f('0x42')]=qs['sort'](_0x214bed[_0xd06f('0x3a')]['sort']);_0x311a9c[_0xd06f('0x43')]=qs['filters'](_[_0xd06f('0x44')](_0x214bed[_0xd06f('0x3a')],_0x2a5238[_0xd06f('0x45')]),_0x30357a);if(_0x214bed[_0xd06f('0x3a')][_0xd06f('0x46')]){_0x311a9c[_0xd06f('0x43')]=_[_0xd06f('0x47')](_0x311a9c[_0xd06f('0x43')],{'$or':_[_0xd06f('0x39')](_0x30357a,function(_0x3e42ab){if(_0x3e42ab[_0xd06f('0x36')]!==_0xd06f('0x48')){var _0x2e6814={};_0x2e6814[_0x3e42ab['name']]={'$like':'%'+_0x214bed[_0xd06f('0x3a')]['filter']+'%'};return _0x2e6814;}})});}_0x311a9c=_[_0xd06f('0x47')]({},_0x311a9c,_0x214bed[_0xd06f('0x49')]);var _0x1ae1fa={'where':_0x311a9c[_0xd06f('0x43')]};return db['VoiceQueueReport']['count'](_0x1ae1fa)[_0xd06f('0x2d')](function(_0x18f709){_0x1901e0[_0xd06f('0x24')]=_0x18f709;if(_0x214bed[_0xd06f('0x3a')][_0xd06f('0x4a')]){_0x311a9c[_0xd06f('0x4b')]=[{'all':!![]}];}return db['VoiceQueueReport'][_0xd06f('0x4c')](_0x311a9c);})['then'](function(_0x3f3b01){_0x1901e0[_0xd06f('0x4d')]=_0x3f3b01;return _0x1901e0;})[_0xd06f('0x2d')](respondWithFilteredResult(_0x3b1799,_0x311a9c))[_0xd06f('0x4e')](handleError(_0x3b1799,null));};exports['show']=function(_0x43553c,_0x44876e){var _0x38be01={'raw':![],'where':{'id':_0x43553c[_0xd06f('0x4f')]['id']}},_0x14c2ed={};_0x14c2ed[_0xd06f('0x38')]=_[_0xd06f('0x3b')](db[_0xd06f('0x33')][_0xd06f('0x34')]);_0x14c2ed[_0xd06f('0x3a')]=_[_0xd06f('0x3b')](_0x43553c[_0xd06f('0x3a')]);_0x14c2ed[_0xd06f('0x45')]=_[_0xd06f('0x3c')](_0x14c2ed[_0xd06f('0x38')],_0x14c2ed[_0xd06f('0x3a')]);_0x38be01['attributes']=_[_0xd06f('0x3c')](_0x14c2ed[_0xd06f('0x38')],qs[_0xd06f('0x3e')](_0x43553c[_0xd06f('0x3a')][_0xd06f('0x3e')]));_0x38be01['attributes']=_0x38be01[_0xd06f('0x3d')]['length']?_0x38be01[_0xd06f('0x3d')]:_0x14c2ed[_0xd06f('0x38')];if(_0x43553c['query']['includeAll']){_0x38be01['include']=[{'all':!![]}];}_0x38be01=_[_0xd06f('0x47')]({},_0x38be01,_0x43553c[_0xd06f('0x49')]);return db[_0xd06f('0x33')][_0xd06f('0x50')](_0x38be01)['then'](handleEntityNotFound(_0x44876e,null))['then'](respondWithResult(_0x44876e,null))[_0xd06f('0x4e')](handleError(_0x44876e,null));};exports[_0xd06f('0x51')]=function(_0x5f06dd,_0x505029){return db[_0xd06f('0x33')][_0xd06f('0x51')](_0x5f06dd['body'],{})[_0xd06f('0x2d')](respondWithResult(_0x505029,0xc9))[_0xd06f('0x4e')](handleError(_0x505029,null));};exports['update']=function(_0x513afc,_0x58aae5){if(_0x513afc['body']['id']){delete _0x513afc[_0xd06f('0x52')]['id'];}return db[_0xd06f('0x33')]['find']({'where':{'id':_0x513afc['params']['id']}})[_0xd06f('0x2d')](handleEntityNotFound(_0x58aae5,null))[_0xd06f('0x2d')](saveUpdates(_0x513afc[_0xd06f('0x52')],null))[_0xd06f('0x2d')](respondWithResult(_0x58aae5,null))['catch'](handleError(_0x58aae5,null));};exports['destroy']=function(_0x402282,_0x4bd04c){return db[_0xd06f('0x33')]['find']({'where':{'id':_0x402282['params']['id']}})[_0xd06f('0x2d')](handleEntityNotFound(_0x4bd04c,null))[_0xd06f('0x2d')](removeEntity(_0x4bd04c,null))[_0xd06f('0x4e')](handleError(_0x4bd04c,null));};exports['describe']=function(_0xe8f0c6,_0x5e9bed){return db[_0xd06f('0x33')][_0xd06f('0x53')]()['then'](respondWithResult(_0x5e9bed,null))['catch'](handleError(_0x5e9bed,null));};exports[_0xd06f('0x54')]=function(_0x276986,_0x2c22bc){var _0x5da742={},_0x1ca32b={},_0x3e00f1={'count':0x0,'rows':[]};_0x1ca32b[_0xd06f('0x38')]=_[_0xd06f('0x3b')](db[_0xd06f('0x33')][_0xd06f('0x34')]);_0x1ca32b[_0xd06f('0x3a')]=_[_0xd06f('0x3b')](_0x276986[_0xd06f('0x3a')]);_0x1ca32b[_0xd06f('0x45')]=_['intersection'](_0x1ca32b[_0xd06f('0x38')],_0x1ca32b[_0xd06f('0x3a')]);_0x5da742[_0xd06f('0x3d')]=_[_0xd06f('0x3c')](_0x1ca32b[_0xd06f('0x38')],qs[_0xd06f('0x3e')](_0x276986['query'][_0xd06f('0x3e')]));_0x5da742[_0xd06f('0x3d')]=_0x5da742['attributes']['length']?_0x5da742[_0xd06f('0x3d')]:_0x1ca32b[_0xd06f('0x38')];if(!_0x276986[_0xd06f('0x3a')][_0xd06f('0x40')]('nolimit')){_0x5da742['limit']=qs[_0xd06f('0x25')](_0x276986[_0xd06f('0x3a')]['limit']);_0x5da742['offset']=qs['offset'](_0x276986['query'][_0xd06f('0x22')]);}_0x5da742[_0xd06f('0x42')]=qs['sort'](_0x276986[_0xd06f('0x3a')]['sort']);_0x5da742[_0xd06f('0x43')]=qs[_0xd06f('0x45')](_[_0xd06f('0x44')](_0x276986['query'],_0x1ca32b[_0xd06f('0x45')]));if(_0x276986[_0xd06f('0x3a')][_0xd06f('0x46')]){_0x5da742[_0xd06f('0x43')]=_[_0xd06f('0x47')](_0x5da742[_0xd06f('0x43')],{'$or':_[_0xd06f('0x39')](_0x5da742[_0xd06f('0x3d')],function(_0xcbac4c){var _0x5414b3={};_0x5414b3[_0xcbac4c]={'$like':'%'+_0x276986['query'][_0xd06f('0x46')]+'%'};return _0x5414b3;})});}_0x5da742=_['merge']({},_0x5da742,_0x276986[_0xd06f('0x49')]);var _0x10ef40={'where':_0x5da742['where']};return db[_0xd06f('0x33')]['count'](_0x10ef40)[_0xd06f('0x2d')](function(_0x2a2883){_0x3e00f1['count']=_0x2a2883;if(_0x276986[_0xd06f('0x3a')][_0xd06f('0x4a')]){_0x5da742[_0xd06f('0x4b')]=[{'all':!![]}];}return db['VoiceQueueReport']['findAll'](_0x5da742);})['then'](function(_0x2ed628){_0x3e00f1[_0xd06f('0x4d')]=_0x2ed628;return _0x3e00f1;})[_0xd06f('0x2d')](respondWithFilteredResult(_0x2c22bc,_0x5da742,_0xd06f('0x54')))[_0xd06f('0x4e')](handleError(_0x2c22bc,null,_0xd06f('0x54')));}; \ No newline at end of file +var _0x7be5=['rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','include','findAll','rows','catch','show','params','keys','includeAll','create','body','find','describe','getVoiceQueuesReport','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../config/license/util','defaults','socket.io-emitter','redis','./voiceQueueReport.socket','register','status','offset','count','limit','set','json','apply','save','update','then','destroy','end','sendStatus','error','stack','name','send','index','map','VoiceQueueReport'];(function(_0x495984,_0x20ff45){var _0x93c24c=function(_0x48015b){while(--_0x48015b){_0x495984['push'](_0x495984['shift']());}};_0x93c24c(++_0x20ff45);}(_0x7be5,0x1b7));var _0x57be=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x7be5[_0x20a584];return _0x4b41a8;};'use strict';var emlformat=require(_0x57be('0x0'));var rimraf=require(_0x57be('0x1'));var zipdir=require(_0x57be('0x2'));var jsonpatch=require(_0x57be('0x3'));var rp=require(_0x57be('0x4'));var moment=require('moment');var BPromise=require(_0x57be('0x5'));var Mustache=require(_0x57be('0x6'));var util=require(_0x57be('0x7'));var path=require(_0x57be('0x8'));var sox=require(_0x57be('0x9'));var csv=require(_0x57be('0xa'));var ejs=require(_0x57be('0xb'));var fs=require('fs');var fs_extra=require(_0x57be('0xc'));var _=require(_0x57be('0xd'));var squel=require(_0x57be('0xe'));var crypto=require(_0x57be('0xf'));var jsforce=require(_0x57be('0x10'));var deskjs=require('desk.js');var toCsv=require(_0x57be('0xa'));var querystring=require(_0x57be('0x11'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x57be('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x57be('0x13'));var config=require(_0x57be('0x14'));var licenseUtil=require(_0x57be('0x15'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x57be('0x16')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x57be('0x17'))(new Redis(config[_0x57be('0x18')]));require(_0x57be('0x19'))[_0x57be('0x1a')](socket);function respondWithStatusCode(_0x3a06eb,_0x594688){_0x594688=_0x594688||0xcc;return function(_0x396ff1){if(_0x396ff1){return _0x3a06eb['sendStatus'](_0x594688);}return _0x3a06eb['status'](_0x594688)['end']();};}function respondWithResult(_0x22576f,_0xc8ea19){_0xc8ea19=_0xc8ea19||0xc8;return function(_0x3ef47a){if(_0x3ef47a){return _0x22576f[_0x57be('0x1b')](_0xc8ea19)['json'](_0x3ef47a);}};}function respondWithFilteredResult(_0x50c5d7,_0x17d5b7){return function(_0x4fc4cb){if(_0x4fc4cb){var _0x37ca29=typeof _0x17d5b7[_0x57be('0x1c')]==='undefined'&&typeof _0x17d5b7['limit']==='undefined';var _0x371579=_0x4fc4cb[_0x57be('0x1d')];var _0x18e9bd=_0x37ca29?0x0:_0x17d5b7[_0x57be('0x1c')];var _0xf6f023=_0x37ca29?_0x4fc4cb[_0x57be('0x1d')]:_0x17d5b7[_0x57be('0x1c')]+_0x17d5b7[_0x57be('0x1e')];var _0xdd2177;if(_0xf6f023>=_0x371579){_0xf6f023=_0x371579;_0xdd2177=0xc8;}else{_0xdd2177=0xce;}_0x50c5d7['status'](_0xdd2177);return _0x50c5d7[_0x57be('0x1f')]('Content-Range',_0x18e9bd+'-'+_0xf6f023+'/'+_0x371579)[_0x57be('0x20')](_0x4fc4cb);}return null;};}function patchUpdates(_0x2fe9d9){return function(_0x165add){try{jsonpatch[_0x57be('0x21')](_0x165add,_0x2fe9d9,!![]);}catch(_0x1a6cc8){return BPromise['reject'](_0x1a6cc8);}return _0x165add[_0x57be('0x22')]();};}function saveUpdates(_0x373d9a,_0x23264c){return function(_0x131b72){if(_0x131b72){return _0x131b72[_0x57be('0x23')](_0x373d9a)[_0x57be('0x24')](function(_0x313369){return _0x313369;});}return null;};}function removeEntity(_0x64d064,_0x259218){return function(_0x2580dc){if(_0x2580dc){return _0x2580dc[_0x57be('0x25')]()[_0x57be('0x24')](function(){_0x64d064[_0x57be('0x1b')](0xcc)[_0x57be('0x26')]();});}};}function handleEntityNotFound(_0x4e4df5,_0x443052){return function(_0xccfc6e){if(!_0xccfc6e){_0x4e4df5[_0x57be('0x27')](0x194);}return _0xccfc6e;};}function handleError(_0x399377,_0x355b74){_0x355b74=_0x355b74||0x1f4;return function(_0x4b2068){logger[_0x57be('0x28')](_0x4b2068[_0x57be('0x29')]);if(_0x4b2068[_0x57be('0x2a')]){delete _0x4b2068[_0x57be('0x2a')];}_0x399377[_0x57be('0x1b')](_0x355b74)[_0x57be('0x2b')](_0x4b2068);};}exports[_0x57be('0x2c')]=function(_0xc58ed8,_0x32fc4e){var _0x52c644={},_0x78ec5c={},_0x12ac05={'count':0x0,'rows':[]};var _0x1f0f23=_[_0x57be('0x2d')](db[_0x57be('0x2e')][_0x57be('0x2f')],function(_0x38b7b9){return{'name':_0x38b7b9[_0x57be('0x30')],'type':_0x38b7b9[_0x57be('0x31')][_0x57be('0x32')]};});_0x78ec5c[_0x57be('0x33')]=_[_0x57be('0x2d')](_0x1f0f23,_0x57be('0x2a'));_0x78ec5c[_0x57be('0x34')]=_['keys'](_0xc58ed8[_0x57be('0x34')]);_0x78ec5c[_0x57be('0x35')]=_[_0x57be('0x36')](_0x78ec5c[_0x57be('0x33')],_0x78ec5c[_0x57be('0x34')]);_0x52c644[_0x57be('0x37')]=_[_0x57be('0x36')](_0x78ec5c[_0x57be('0x33')],qs[_0x57be('0x38')](_0xc58ed8['query'][_0x57be('0x38')]));_0x52c644[_0x57be('0x37')]=_0x52c644[_0x57be('0x37')][_0x57be('0x39')]?_0x52c644[_0x57be('0x37')]:_0x78ec5c['model'];if(!_0xc58ed8[_0x57be('0x34')][_0x57be('0x3a')](_0x57be('0x3b'))){_0x52c644[_0x57be('0x1e')]=qs[_0x57be('0x1e')](_0xc58ed8['query'][_0x57be('0x1e')]);_0x52c644['offset']=qs['offset'](_0xc58ed8[_0x57be('0x34')][_0x57be('0x1c')]);}_0x52c644[_0x57be('0x3c')]=qs[_0x57be('0x3d')](_0xc58ed8[_0x57be('0x34')]['sort']);_0x52c644[_0x57be('0x3e')]=qs[_0x57be('0x35')](_[_0x57be('0x3f')](_0xc58ed8[_0x57be('0x34')],_0x78ec5c[_0x57be('0x35')]),_0x1f0f23);if(_0xc58ed8[_0x57be('0x34')][_0x57be('0x40')]){_0x52c644['where']=_['merge'](_0x52c644[_0x57be('0x3e')],{'$or':_[_0x57be('0x2d')](_0x1f0f23,function(_0x1da376){if(_0x1da376[_0x57be('0x31')]!==_0x57be('0x41')){var _0x234257={};_0x234257[_0x1da376[_0x57be('0x2a')]]={'$like':'%'+_0xc58ed8[_0x57be('0x34')][_0x57be('0x40')]+'%'};return _0x234257;}})});}_0x52c644=_[_0x57be('0x42')]({},_0x52c644,_0xc58ed8[_0x57be('0x43')]);var _0x2159e0={'where':_0x52c644[_0x57be('0x3e')]};return db[_0x57be('0x2e')]['count'](_0x2159e0)['then'](function(_0x9addde){_0x12ac05[_0x57be('0x1d')]=_0x9addde;if(_0xc58ed8[_0x57be('0x34')]['includeAll']){_0x52c644[_0x57be('0x44')]=[{'all':!![]}];}return db[_0x57be('0x2e')][_0x57be('0x45')](_0x52c644);})[_0x57be('0x24')](function(_0x39fd26){_0x12ac05[_0x57be('0x46')]=_0x39fd26;return _0x12ac05;})[_0x57be('0x24')](respondWithFilteredResult(_0x32fc4e,_0x52c644))[_0x57be('0x47')](handleError(_0x32fc4e,null));};exports[_0x57be('0x48')]=function(_0x300052,_0x4235a6){var _0x1557e5={'raw':![],'where':{'id':_0x300052[_0x57be('0x49')]['id']}},_0x57dfa4={};_0x57dfa4[_0x57be('0x33')]=_[_0x57be('0x4a')](db[_0x57be('0x2e')][_0x57be('0x2f')]);_0x57dfa4[_0x57be('0x34')]=_['keys'](_0x300052[_0x57be('0x34')]);_0x57dfa4[_0x57be('0x35')]=_[_0x57be('0x36')](_0x57dfa4['model'],_0x57dfa4[_0x57be('0x34')]);_0x1557e5[_0x57be('0x37')]=_['intersection'](_0x57dfa4[_0x57be('0x33')],qs[_0x57be('0x38')](_0x300052[_0x57be('0x34')][_0x57be('0x38')]));_0x1557e5[_0x57be('0x37')]=_0x1557e5['attributes'][_0x57be('0x39')]?_0x1557e5[_0x57be('0x37')]:_0x57dfa4[_0x57be('0x33')];if(_0x300052['query'][_0x57be('0x4b')]){_0x1557e5['include']=[{'all':!![]}];}_0x1557e5=_['merge']({},_0x1557e5,_0x300052[_0x57be('0x43')]);return db[_0x57be('0x2e')]['find'](_0x1557e5)[_0x57be('0x24')](handleEntityNotFound(_0x4235a6,null))['then'](respondWithResult(_0x4235a6,null))[_0x57be('0x47')](handleError(_0x4235a6,null));};exports[_0x57be('0x4c')]=function(_0x177087,_0x38c12f){return db[_0x57be('0x2e')][_0x57be('0x4c')](_0x177087['body'],{})[_0x57be('0x24')](respondWithResult(_0x38c12f,0xc9))[_0x57be('0x47')](handleError(_0x38c12f,null));};exports[_0x57be('0x23')]=function(_0x5becd8,_0xca2982){if(_0x5becd8[_0x57be('0x4d')]['id']){delete _0x5becd8[_0x57be('0x4d')]['id'];}return db['VoiceQueueReport'][_0x57be('0x4e')]({'where':{'id':_0x5becd8[_0x57be('0x49')]['id']}})[_0x57be('0x24')](handleEntityNotFound(_0xca2982,null))[_0x57be('0x24')](saveUpdates(_0x5becd8[_0x57be('0x4d')],null))[_0x57be('0x24')](respondWithResult(_0xca2982,null))[_0x57be('0x47')](handleError(_0xca2982,null));};exports['destroy']=function(_0x2ad0ca,_0x16eb7e){return db['VoiceQueueReport']['find']({'where':{'id':_0x2ad0ca[_0x57be('0x49')]['id']}})[_0x57be('0x24')](handleEntityNotFound(_0x16eb7e,null))[_0x57be('0x24')](removeEntity(_0x16eb7e,null))[_0x57be('0x47')](handleError(_0x16eb7e,null));};exports[_0x57be('0x4f')]=function(_0x34a2e5,_0x2285e7){return db[_0x57be('0x2e')]['describe']()[_0x57be('0x24')](respondWithResult(_0x2285e7,null))[_0x57be('0x47')](handleError(_0x2285e7,null));};exports[_0x57be('0x50')]=function(_0x8023e6,_0x551650){var _0x3e448d={},_0x4b6342={},_0x2e8c98={'count':0x0,'rows':[]};_0x4b6342['model']=_['keys'](db[_0x57be('0x2e')]['rawAttributes']);_0x4b6342[_0x57be('0x34')]=_[_0x57be('0x4a')](_0x8023e6[_0x57be('0x34')]);_0x4b6342[_0x57be('0x35')]=_['intersection'](_0x4b6342['model'],_0x4b6342[_0x57be('0x34')]);_0x3e448d[_0x57be('0x37')]=_[_0x57be('0x36')](_0x4b6342['model'],qs[_0x57be('0x38')](_0x8023e6[_0x57be('0x34')][_0x57be('0x38')]));_0x3e448d[_0x57be('0x37')]=_0x3e448d[_0x57be('0x37')]['length']?_0x3e448d[_0x57be('0x37')]:_0x4b6342['model'];if(!_0x8023e6[_0x57be('0x34')][_0x57be('0x3a')]('nolimit')){_0x3e448d[_0x57be('0x1e')]=qs['limit'](_0x8023e6[_0x57be('0x34')][_0x57be('0x1e')]);_0x3e448d[_0x57be('0x1c')]=qs[_0x57be('0x1c')](_0x8023e6[_0x57be('0x34')][_0x57be('0x1c')]);}_0x3e448d['order']=qs[_0x57be('0x3d')](_0x8023e6[_0x57be('0x34')]['sort']);_0x3e448d['where']=qs[_0x57be('0x35')](_[_0x57be('0x3f')](_0x8023e6[_0x57be('0x34')],_0x4b6342[_0x57be('0x35')]));if(_0x8023e6['query'][_0x57be('0x40')]){_0x3e448d[_0x57be('0x3e')]=_['merge'](_0x3e448d[_0x57be('0x3e')],{'$or':_[_0x57be('0x2d')](_0x3e448d[_0x57be('0x37')],function(_0x4f90e8){var _0x2641ed={};_0x2641ed[_0x4f90e8]={'$like':'%'+_0x8023e6['query'][_0x57be('0x40')]+'%'};return _0x2641ed;})});}_0x3e448d=_[_0x57be('0x42')]({},_0x3e448d,_0x8023e6[_0x57be('0x43')]);var _0x50e493={'where':_0x3e448d[_0x57be('0x3e')]};return db['VoiceQueueReport'][_0x57be('0x1d')](_0x50e493)['then'](function(_0x45fdad){_0x2e8c98[_0x57be('0x1d')]=_0x45fdad;if(_0x8023e6[_0x57be('0x34')][_0x57be('0x4b')]){_0x3e448d[_0x57be('0x44')]=[{'all':!![]}];}return db[_0x57be('0x2e')][_0x57be('0x45')](_0x3e448d);})['then'](function(_0x278bb0){_0x2e8c98[_0x57be('0x46')]=_0x278bb0;return _0x2e8c98;})[_0x57be('0x24')](respondWithFilteredResult(_0x551650,_0x3e448d,'getVoiceQueuesReport'))[_0x57be('0x47')](handleError(_0x551650,null,_0x57be('0x50')));}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.events.js b/server/api/voiceQueueReport/voiceQueueReport.events.js index 225a3ce..a8142e3 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 _0xb8d6=['exports','events','../../mysqldb','VoiceQueueReport','save','update','remove','emit','hook'];(function(_0x3b3e99,_0x4fb1db){var _0x398558=function(_0x550693){while(--_0x550693){_0x3b3e99['push'](_0x3b3e99['shift']());}};_0x398558(++_0x4fb1db);}(_0xb8d6,0x196));var _0x6b8d=function(_0x110c3d,_0x12ee06){_0x110c3d=_0x110c3d-0x0;var _0x226d67=_0xb8d6[_0x110c3d];return _0x226d67;};'use strict';var EventEmitter=require(_0x6b8d('0x0'));var VoiceQueueReport=require(_0x6b8d('0x1'))['db'][_0x6b8d('0x2')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x6b8d('0x3'),'afterUpdate':_0x6b8d('0x4'),'afterDestroy':_0x6b8d('0x5')};function emitEvent(_0x449f60){return function(_0x28e7b4,_0x5828af,_0x3121fb){VoiceQueueReportEvents[_0x6b8d('0x6')](_0x449f60+':'+_0x28e7b4['id'],_0x28e7b4);VoiceQueueReportEvents[_0x6b8d('0x6')](_0x449f60,_0x28e7b4);_0x3121fb(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceQueueReport[_0x6b8d('0x7')](e,emitEvent(event));}}module[_0x6b8d('0x8')]=VoiceQueueReportEvents; \ No newline at end of file +var _0x5934=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','VoiceQueueReport','setMaxListeners','save','update'];(function(_0x3405f6,_0x2d8255){var _0x4eb8eb=function(_0x18d3d1){while(--_0x18d3d1){_0x3405f6['push'](_0x3405f6['shift']());}};_0x4eb8eb(++_0x2d8255);}(_0x5934,0x14f));var _0x4593=function(_0x39ce74,_0x4fc373){_0x39ce74=_0x39ce74-0x0;var _0x57248e=_0x5934[_0x39ce74];return _0x57248e;};'use strict';var EventEmitter=require(_0x4593('0x0'));var VoiceQueueReport=require(_0x4593('0x1'))['db'][_0x4593('0x2')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents[_0x4593('0x3')](0x0);var events={'afterCreate':_0x4593('0x4'),'afterUpdate':_0x4593('0x5'),'afterDestroy':_0x4593('0x6')};function emitEvent(_0x15290e){return function(_0x2c6831,_0x2c59d9,_0x333db3){VoiceQueueReportEvents[_0x4593('0x7')](_0x15290e+':'+_0x2c6831['id'],_0x2c6831);VoiceQueueReportEvents[_0x4593('0x7')](_0x15290e,_0x2c6831);_0x333db3(null);};}for(var e in events){if(events[_0x4593('0x8')](e)){var event=events[e];VoiceQueueReport[_0x4593('0x9')](e,emitEvent(event));}}module[_0x4593('0xa')]=VoiceQueueReportEvents; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.model.js b/server/api/voiceQueueReport/voiceQueueReport.model.js index 652acbf..3c06cb5 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 _0x4e47=['lodash','util','../../config/logger','moment','request-promise','path','rimraf','../../config/environment','./voiceQueueReport.attributes','exports','VoiceQueueReport','report_queue','calleridnum'];(function(_0x456a4b,_0x51df8){var _0x42957c=function(_0x431de8){while(--_0x431de8){_0x456a4b['push'](_0x456a4b['shift']());}};_0x42957c(++_0x51df8);}(_0x4e47,0x12b));var _0x74e4=function(_0x28a636,_0x153ae1){_0x28a636=_0x28a636-0x0;var _0x149470=_0x4e47[_0x28a636];return _0x149470;};'use strict';var _=require(_0x74e4('0x0'));var util=require(_0x74e4('0x1'));var logger=require(_0x74e4('0x2'))('api');var moment=require(_0x74e4('0x3'));var BPromise=require('bluebird');var rp=require(_0x74e4('0x4'));var fs=require('fs');var path=require(_0x74e4('0x5'));var rimraf=require(_0x74e4('0x6'));var config=require(_0x74e4('0x7'));var attributes=require(_0x74e4('0x8'));module[_0x74e4('0x9')]=function(_0x4bf1b3,_0x4f33ae){return _0x4bf1b3['define'](_0x74e4('0xa'),attributes,{'tableName':_0x74e4('0xb'),'paranoid':![],'indexes':[{'fields':['uniqueid']},{'fields':[_0x74e4('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xb0c3=['path','rimraf','../../config/environment','./voiceQueueReport.attributes','exports','VoiceQueueReport','calleridnum','util','../../config/logger','api','bluebird','request-promise'];(function(_0x3054be,_0x1bdc8b){var _0x3df150=function(_0x56cfbf){while(--_0x56cfbf){_0x3054be['push'](_0x3054be['shift']());}};_0x3df150(++_0x1bdc8b);}(_0xb0c3,0x1f3));var _0x3b0c=function(_0x55c41e,_0x3abd75){_0x55c41e=_0x55c41e-0x0;var _0x5cd08a=_0xb0c3[_0x55c41e];return _0x5cd08a;};'use strict';var _=require('lodash');var util=require(_0x3b0c('0x0'));var logger=require(_0x3b0c('0x1'))(_0x3b0c('0x2'));var moment=require('moment');var BPromise=require(_0x3b0c('0x3'));var rp=require(_0x3b0c('0x4'));var fs=require('fs');var path=require(_0x3b0c('0x5'));var rimraf=require(_0x3b0c('0x6'));var config=require(_0x3b0c('0x7'));var attributes=require(_0x3b0c('0x8'));module[_0x3b0c('0x9')]=function(_0x134c90,_0x46331b){return _0x134c90['define'](_0x3b0c('0xa'),attributes,{'tableName':'report_queue','paranoid':![],'indexes':[{'fields':['uniqueid']},{'fields':[_0x3b0c('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.rpc.js b/server/api/voiceQueueReport/voiceQueueReport.rpc.js index c65e4a1..e59ac34 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 _0x34a8=['bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','client','http','redis','defaults','localhost','socket.io-emitter','./voiceQueueReport.socket','register','info','request\x20sent','stringify','error','code','VoiceQueueReport,\x20%s,\x20%s','message','catch','VoiceQueueReport','options','raw','where','attributes','limit','include','map','model','then','debug','GetVoiceQueueReport','body','CreateVoiceQueueReport','UpdateVoiceQueueReport','lodash','util'];(function(_0x5b561d,_0x422b7c){var _0x431060=function(_0x401409){while(--_0x401409){_0x5b561d['push'](_0x5b561d['shift']());}};_0x431060(++_0x422b7c);}(_0x34a8,0x108));var _0x834a=function(_0x11b568,_0xfa5420){_0x11b568=_0x11b568-0x0;var _0x4f6f97=_0x34a8[_0x11b568];return _0x4f6f97;};'use strict';var _=require(_0x834a('0x0'));var util=require(_0x834a('0x1'));var moment=require('moment');var BPromise=require(_0x834a('0x2'));var rs=require(_0x834a('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x834a('0x4'))['db'];var utils=require(_0x834a('0x5'));var logger=require(_0x834a('0x6'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x834a('0x7')][_0x834a('0x8')]({'port':0x232a});config[_0x834a('0x9')]=_[_0x834a('0xa')](config[_0x834a('0x9')],{'host':_0x834a('0xb'),'port':0x18eb});var socket=require(_0x834a('0xc'))(new Redis(config['redis']));require(_0x834a('0xd'))[_0x834a('0xe')](socket);function respondWithRpcPromise(_0x53aa39,_0x17cb7e,_0xb25823){return new BPromise(function(_0x52cdee,_0xac91bc){return client['request'](_0x53aa39,_0xb25823)['then'](function(_0x1b17f5){logger[_0x834a('0xf')]('VoiceQueueReport,\x20%s,\x20%s',_0x17cb7e,_0x834a('0x10'));logger['debug']('VoiceQueueReport,\x20%s,\x20%s,\x20%s',_0x17cb7e,_0x834a('0x10'),JSON[_0x834a('0x11')](_0x1b17f5));if(_0x1b17f5[_0x834a('0x12')]){if(_0x1b17f5['error'][_0x834a('0x13')]===0x1f4){logger[_0x834a('0x12')](_0x834a('0x14'),_0x17cb7e,_0x1b17f5[_0x834a('0x12')]['message']);return _0xac91bc(_0x1b17f5['error'][_0x834a('0x15')]);}logger[_0x834a('0x12')](_0x834a('0x14'),_0x17cb7e,_0x1b17f5['error']['message']);return _0x52cdee(_0x1b17f5['error'][_0x834a('0x15')]);}else{logger[_0x834a('0xf')]('VoiceQueueReport,\x20%s,\x20%s',_0x17cb7e,_0x834a('0x10'));_0x52cdee(_0x1b17f5['result'][_0x834a('0x15')]);}})[_0x834a('0x16')](function(_0xd0d339){logger[_0x834a('0x12')](_0x834a('0x14'),_0x17cb7e,_0xd0d339);_0xac91bc(_0xd0d339);});});}exports['GetVoiceQueueReport']=function(_0x2889b0){var _0x3c8303=this;return new Promise(function(_0x3313d8,_0x5ef4b3){return db[_0x834a('0x17')]['findAll']({'raw':_0x2889b0[_0x834a('0x18')]?_0x2889b0['options'][_0x834a('0x19')]===undefined?!![]:![]:!![],'where':_0x2889b0['options']?_0x2889b0['options'][_0x834a('0x1a')]||null:null,'attributes':_0x2889b0['options']?_0x2889b0[_0x834a('0x18')][_0x834a('0x1b')]||null:null,'limit':_0x2889b0[_0x834a('0x18')]?_0x2889b0[_0x834a('0x18')][_0x834a('0x1c')]||null:null,'include':_0x2889b0[_0x834a('0x18')]?_0x2889b0[_0x834a('0x18')][_0x834a('0x1d')]?_[_0x834a('0x1e')](_0x2889b0[_0x834a('0x18')]['include'],function(_0x46dff3){return{'model':db[_0x46dff3[_0x834a('0x1f')]],'as':_0x46dff3['as'],'attributes':_0x46dff3[_0x834a('0x1b')],'include':_0x46dff3['include']?_[_0x834a('0x1e')](_0x46dff3[_0x834a('0x1d')],function(_0x4593a5){return{'model':db[_0x4593a5[_0x834a('0x1f')]],'as':_0x4593a5['as'],'attributes':_0x4593a5[_0x834a('0x1b')],'include':_0x4593a5['include']?_[_0x834a('0x1e')](_0x4593a5['include'],function(_0x2a0655){return{'model':db[_0x2a0655['model']],'as':_0x2a0655['as'],'attributes':_0x2a0655['attributes']};}):[]};}):[]};}):[]:[]})[_0x834a('0x20')](function(_0x23ec06){logger[_0x834a('0xf')]('GetVoiceQueueReport',_0x2889b0);logger[_0x834a('0x21')](_0x834a('0x22'),_0x2889b0,JSON[_0x834a('0x11')](_0x23ec06));_0x3313d8(_0x23ec06);})[_0x834a('0x16')](function(_0x9c3e49){logger[_0x834a('0x12')](_0x834a('0x22'),_0x9c3e49['message'],_0x2889b0);_0x5ef4b3(_0x3c8303[_0x834a('0x12')](0x1f4,_0x9c3e49['message']));});});};exports['CreateVoiceQueueReport']=function(_0x3314bd){var _0x1e96da=this;return new Promise(function(_0xf06c7,_0x12c6f5){return db[_0x834a('0x17')]['create'](_0x3314bd[_0x834a('0x23')],{'raw':_0x3314bd[_0x834a('0x18')]?_0x3314bd[_0x834a('0x18')][_0x834a('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x166068){logger[_0x834a('0xf')](_0x834a('0x24'),_0x3314bd);logger[_0x834a('0x21')](_0x834a('0x24'),_0x3314bd,JSON[_0x834a('0x11')](_0x166068));_0xf06c7(_0x166068);})[_0x834a('0x16')](function(_0x209d99){logger[_0x834a('0x12')](_0x834a('0x24'),_0x209d99[_0x834a('0x15')],_0x3314bd);_0x12c6f5(_0x1e96da['error'](0x1f4,_0x209d99[_0x834a('0x15')]));});});};exports[_0x834a('0x25')]=function(_0x26b405){var _0x21632e=this;return new Promise(function(_0x13a1ab,_0x491a28){return db['VoiceQueueReport']['update'](_0x26b405['body'],{'raw':_0x26b405[_0x834a('0x18')]?_0x26b405[_0x834a('0x18')][_0x834a('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x26b405[_0x834a('0x18')]?_0x26b405[_0x834a('0x18')][_0x834a('0x1a')]||null:null,'attributes':_0x26b405[_0x834a('0x18')]?_0x26b405[_0x834a('0x18')]['attributes']||null:null,'limit':_0x26b405[_0x834a('0x18')]?_0x26b405[_0x834a('0x18')]['limit']||null:null})[_0x834a('0x20')](function(_0x4b907c){logger[_0x834a('0xf')]('UpdateVoiceQueueReport',_0x26b405);logger['debug']('UpdateVoiceQueueReport',_0x26b405,JSON[_0x834a('0x11')](_0x4b907c));_0x13a1ab(_0x4b907c);})['catch'](function(_0x7dcd1b){logger['error'](_0x834a('0x25'),_0x7dcd1b[_0x834a('0x15')],_0x26b405);_0x491a28(_0x21632e[_0x834a('0x12')](0x1f4,_0x7dcd1b[_0x834a('0x15')]));});});}; \ No newline at end of file +var _0x0e48=['moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./voiceQueueReport.socket','register','request','info','request\x20sent','debug','VoiceQueueReport,\x20%s,\x20%s,\x20%s','error','code','VoiceQueueReport,\x20%s,\x20%s','message','result','catch','GetVoiceQueueReport','VoiceQueueReport','findAll','options','raw','attributes','limit','include','map','model','then','stringify','create','body','CreateVoiceQueueReport','UpdateVoiceQueueReport','where','lodash','util'];(function(_0x2ff8af,_0xd48e8){var _0x1d7758=function(_0x262c89){while(--_0x262c89){_0x2ff8af['push'](_0x2ff8af['shift']());}};_0x1d7758(++_0xd48e8);}(_0x0e48,0x19c));var _0x80e4=function(_0x215a5c,_0xa79b49){_0x215a5c=_0x215a5c-0x0;var _0x33e1a6=_0x0e48[_0x215a5c];return _0x33e1a6;};'use strict';var _=require(_0x80e4('0x0'));var util=require(_0x80e4('0x1'));var moment=require(_0x80e4('0x2'));var BPromise=require('bluebird');var rs=require(_0x80e4('0x3'));var fs=require('fs');var Redis=require(_0x80e4('0x4'));var db=require(_0x80e4('0x5'))['db'];var utils=require(_0x80e4('0x6'));var logger=require('../../config/logger')(_0x80e4('0x7'));var config=require(_0x80e4('0x8'));var jayson=require(_0x80e4('0x9'));var client=jayson[_0x80e4('0xa')][_0x80e4('0xb')]({'port':0x232a});config[_0x80e4('0xc')]=_[_0x80e4('0xd')](config[_0x80e4('0xc')],{'host':_0x80e4('0xe'),'port':0x18eb});var socket=require(_0x80e4('0xf'))(new Redis(config['redis']));require(_0x80e4('0x10'))[_0x80e4('0x11')](socket);function respondWithRpcPromise(_0x5d0362,_0x156b27,_0x1e33af){return new BPromise(function(_0x5f489c,_0x56c236){return client[_0x80e4('0x12')](_0x5d0362,_0x1e33af)['then'](function(_0x542b89){logger[_0x80e4('0x13')]('VoiceQueueReport,\x20%s,\x20%s',_0x156b27,_0x80e4('0x14'));logger[_0x80e4('0x15')](_0x80e4('0x16'),_0x156b27,_0x80e4('0x14'),JSON['stringify'](_0x542b89));if(_0x542b89[_0x80e4('0x17')]){if(_0x542b89[_0x80e4('0x17')][_0x80e4('0x18')]===0x1f4){logger[_0x80e4('0x17')](_0x80e4('0x19'),_0x156b27,_0x542b89[_0x80e4('0x17')]['message']);return _0x56c236(_0x542b89[_0x80e4('0x17')]['message']);}logger[_0x80e4('0x17')]('VoiceQueueReport,\x20%s,\x20%s',_0x156b27,_0x542b89[_0x80e4('0x17')][_0x80e4('0x1a')]);return _0x5f489c(_0x542b89[_0x80e4('0x17')][_0x80e4('0x1a')]);}else{logger[_0x80e4('0x13')](_0x80e4('0x19'),_0x156b27,_0x80e4('0x14'));_0x5f489c(_0x542b89[_0x80e4('0x1b')][_0x80e4('0x1a')]);}})[_0x80e4('0x1c')](function(_0xafd6eb){logger['error'](_0x80e4('0x19'),_0x156b27,_0xafd6eb);_0x56c236(_0xafd6eb);});});}exports[_0x80e4('0x1d')]=function(_0x495e3a){var _0x5727d3=this;return new Promise(function(_0x5833bb,_0x451238){return db[_0x80e4('0x1e')][_0x80e4('0x1f')]({'raw':_0x495e3a[_0x80e4('0x20')]?_0x495e3a['options'][_0x80e4('0x21')]===undefined?!![]:![]:!![],'where':_0x495e3a[_0x80e4('0x20')]?_0x495e3a[_0x80e4('0x20')]['where']||null:null,'attributes':_0x495e3a['options']?_0x495e3a[_0x80e4('0x20')][_0x80e4('0x22')]||null:null,'limit':_0x495e3a[_0x80e4('0x20')]?_0x495e3a['options'][_0x80e4('0x23')]||null:null,'include':_0x495e3a[_0x80e4('0x20')]?_0x495e3a[_0x80e4('0x20')][_0x80e4('0x24')]?_[_0x80e4('0x25')](_0x495e3a[_0x80e4('0x20')]['include'],function(_0x597f17){return{'model':db[_0x597f17[_0x80e4('0x26')]],'as':_0x597f17['as'],'attributes':_0x597f17[_0x80e4('0x22')],'include':_0x597f17[_0x80e4('0x24')]?_[_0x80e4('0x25')](_0x597f17['include'],function(_0x658951){return{'model':db[_0x658951[_0x80e4('0x26')]],'as':_0x658951['as'],'attributes':_0x658951['attributes'],'include':_0x658951['include']?_[_0x80e4('0x25')](_0x658951['include'],function(_0x53741f){return{'model':db[_0x53741f[_0x80e4('0x26')]],'as':_0x53741f['as'],'attributes':_0x53741f[_0x80e4('0x22')]};}):[]};}):[]};}):[]:[]})[_0x80e4('0x27')](function(_0x36c48b){logger[_0x80e4('0x13')](_0x80e4('0x1d'),_0x495e3a);logger[_0x80e4('0x15')](_0x80e4('0x1d'),_0x495e3a,JSON[_0x80e4('0x28')](_0x36c48b));_0x5833bb(_0x36c48b);})[_0x80e4('0x1c')](function(_0x4811d0){logger[_0x80e4('0x17')](_0x80e4('0x1d'),_0x4811d0[_0x80e4('0x1a')],_0x495e3a);_0x451238(_0x5727d3[_0x80e4('0x17')](0x1f4,_0x4811d0[_0x80e4('0x1a')]));});});};exports['CreateVoiceQueueReport']=function(_0x1754f4){var _0x416165=this;return new Promise(function(_0x182ff1,_0x2b19c8){return db[_0x80e4('0x1e')][_0x80e4('0x29')](_0x1754f4[_0x80e4('0x2a')],{'raw':_0x1754f4['options']?_0x1754f4[_0x80e4('0x20')][_0x80e4('0x21')]===undefined?!![]:![]:!![]})['then'](function(_0x4ba3ab){logger['info']('CreateVoiceQueueReport',_0x1754f4);logger[_0x80e4('0x15')](_0x80e4('0x2b'),_0x1754f4,JSON[_0x80e4('0x28')](_0x4ba3ab));_0x182ff1(_0x4ba3ab);})['catch'](function(_0x4af92b){logger['error'](_0x80e4('0x2b'),_0x4af92b['message'],_0x1754f4);_0x2b19c8(_0x416165[_0x80e4('0x17')](0x1f4,_0x4af92b['message']));});});};exports[_0x80e4('0x2c')]=function(_0x5a58d1){var _0xf26d9d=this;return new Promise(function(_0x518493,_0x3ba60a){return db[_0x80e4('0x1e')]['update'](_0x5a58d1[_0x80e4('0x2a')],{'raw':_0x5a58d1[_0x80e4('0x20')]?_0x5a58d1[_0x80e4('0x20')][_0x80e4('0x21')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5a58d1['options']?_0x5a58d1[_0x80e4('0x20')][_0x80e4('0x2d')]||null:null,'attributes':_0x5a58d1[_0x80e4('0x20')]?_0x5a58d1[_0x80e4('0x20')][_0x80e4('0x22')]||null:null,'limit':_0x5a58d1[_0x80e4('0x20')]?_0x5a58d1[_0x80e4('0x20')]['limit']||null:null})['then'](function(_0x1ce96c){logger['info']('UpdateVoiceQueueReport',_0x5a58d1);logger[_0x80e4('0x15')]('UpdateVoiceQueueReport',_0x5a58d1,JSON[_0x80e4('0x28')](_0x1ce96c));_0x518493(_0x1ce96c);})[_0x80e4('0x1c')](function(_0x5bb092){logger[_0x80e4('0x17')]('UpdateVoiceQueueReport',_0x5bb092[_0x80e4('0x1a')],_0x5a58d1);_0x3ba60a(_0xf26d9d[_0x80e4('0x17')](0x1f4,_0x5bb092[_0x80e4('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.socket.js b/server/api/voiceQueueReport/voiceQueueReport.socket.js index 396daa4..4998921 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 _0x6fad=['length','./voiceQueueReport.events','save','remove','update','emit','removeListener'];(function(_0x4721e9,_0x1b221f){var _0x2171e0=function(_0x4a8ee9){while(--_0x4a8ee9){_0x4721e9['push'](_0x4721e9['shift']());}};_0x2171e0(++_0x1b221f);}(_0x6fad,0x174));var _0xd6fa=function(_0x22cc36,_0x2c8292){_0x22cc36=_0x22cc36-0x0;var _0x7fc85=_0x6fad[_0x22cc36];return _0x7fc85;};'use strict';var VoiceQueueReportEvents=require(_0xd6fa('0x0'));var events=[_0xd6fa('0x1'),_0xd6fa('0x2'),_0xd6fa('0x3')];function createListener(_0x4f8a1c,_0x2f5f9b){return function(_0x4ae415){_0x2f5f9b[_0xd6fa('0x4')](_0x4f8a1c,_0x4ae415);};}function removeListener(_0x48f433,_0x3e76d0){return function(){VoiceQueueReportEvents[_0xd6fa('0x5')](_0x48f433,_0x3e76d0);};}exports['register']=function(_0x45dad4){for(var _0x329390=0x0,_0x291bd5=events[_0xd6fa('0x6')];_0x329390<_0x291bd5;_0x329390++){var _0x5a1bf0=events[_0x329390];var _0x1d2aaa=createListener('voiceQueueReport:'+_0x5a1bf0,_0x45dad4);VoiceQueueReportEvents['on'](_0x5a1bf0,_0x1d2aaa);}}; \ No newline at end of file +var _0xb453=['./voiceQueueReport.events','save','update','emit','removeListener','register','length','voiceQueueReport:'];(function(_0xcf7d1e,_0x1b00ad){var _0x42b2cb=function(_0x4c5c9b){while(--_0x4c5c9b){_0xcf7d1e['push'](_0xcf7d1e['shift']());}};_0x42b2cb(++_0x1b00ad);}(_0xb453,0x1e8));var _0x3b45=function(_0x175cdf,_0x231703){_0x175cdf=_0x175cdf-0x0;var _0x51260e=_0xb453[_0x175cdf];return _0x51260e;};'use strict';var VoiceQueueReportEvents=require(_0x3b45('0x0'));var events=[_0x3b45('0x1'),'remove',_0x3b45('0x2')];function createListener(_0x19c429,_0x48ecf8){return function(_0x4a6ac4){_0x48ecf8[_0x3b45('0x3')](_0x19c429,_0x4a6ac4);};}function removeListener(_0x471768,_0x10029d){return function(){VoiceQueueReportEvents[_0x3b45('0x4')](_0x471768,_0x10029d);};}exports[_0x3b45('0x5')]=function(_0x210775){for(var _0x2f4baa=0x0,_0x39c77c=events[_0x3b45('0x6')];_0x2f4baa<_0x39c77c;_0x2f4baa++){var _0x1b529a=events[_0x2f4baa];var _0x59da08=createListener(_0x3b45('0x7')+_0x1b529a,_0x210775);VoiceQueueReportEvents['on'](_0x1b529a,_0x59da08);}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/index.js b/server/api/voiceQueuesLog/index.js index 201aa45..efc9413 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 _0xbab3=['multer','path','connect-timeout','express','fs-extra','./voiceQueuesLog.controller','isAuthenticated','index','get','/:id','show','post','create','put','update','exports'];(function(_0x4d7a70,_0x2d3bfa){var _0x3aafbb=function(_0x43fbf2){while(--_0x43fbf2){_0x4d7a70['push'](_0x4d7a70['shift']());}};_0x3aafbb(++_0x2d3bfa);}(_0xbab3,0x130));var _0x3bab=function(_0x4c367b,_0x2f749e){_0x4c367b=_0x4c367b-0x0;var _0x122fcb=_0xbab3[_0x4c367b];return _0x122fcb;};'use strict';var multer=require(_0x3bab('0x0'));var util=require('util');var path=require(_0x3bab('0x1'));var timeout=require(_0x3bab('0x2'));var express=require(_0x3bab('0x3'));var router=express['Router']();var fs_extra=require(_0x3bab('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x3bab('0x5'));router['get']('/',auth[_0x3bab('0x6')](),controller[_0x3bab('0x7')]);router[_0x3bab('0x8')](_0x3bab('0x9'),auth[_0x3bab('0x6')](),controller[_0x3bab('0xa')]);router[_0x3bab('0xb')]('/',auth[_0x3bab('0x6')](),controller[_0x3bab('0xc')]);router[_0x3bab('0xd')](_0x3bab('0x9'),auth['isAuthenticated'](),controller[_0x3bab('0xe')]);router['delete'](_0x3bab('0x9'),auth[_0x3bab('0x6')](),controller['destroy']);module[_0x3bab('0xf')]=router; \ No newline at end of file +var _0x2dde=['express','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/:id','show','post','create','put','delete','exports','multer','util','path','connect-timeout'];(function(_0x154c72,_0x205607){var _0x13f71e=function(_0x2c10ef){while(--_0x2c10ef){_0x154c72['push'](_0x154c72['shift']());}};_0x13f71e(++_0x205607);}(_0x2dde,0x19a));var _0xe2dd=function(_0x4e2ce6,_0x5d0c3b){_0x4e2ce6=_0x4e2ce6-0x0;var _0x5a3e83=_0x2dde[_0x4e2ce6];return _0x5a3e83;};'use strict';var multer=require(_0xe2dd('0x0'));var util=require(_0xe2dd('0x1'));var path=require(_0xe2dd('0x2'));var timeout=require(_0xe2dd('0x3'));var express=require(_0xe2dd('0x4'));var router=express['Router']();var fs_extra=require(_0xe2dd('0x5'));var auth=require(_0xe2dd('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xe2dd('0x7'));var controller=require('./voiceQueuesLog.controller');router[_0xe2dd('0x8')]('/',auth[_0xe2dd('0x9')](),controller[_0xe2dd('0xa')]);router[_0xe2dd('0x8')](_0xe2dd('0xb'),auth[_0xe2dd('0x9')](),controller[_0xe2dd('0xc')]);router[_0xe2dd('0xd')]('/',auth[_0xe2dd('0x9')](),controller[_0xe2dd('0xe')]);router[_0xe2dd('0xf')]('/:id',auth[_0xe2dd('0x9')](),controller['update']);router[_0xe2dd('0x10')]('/:id',auth[_0xe2dd('0x9')](),controller['destroy']);module[_0xe2dd('0x11')]=router; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js b/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js index deb86a9..527b5c0 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 _0xeb8a=['sequelize','STRING','DATE','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP'];(function(_0x351509,_0x54725c){var _0x4e9861=function(_0x54f92c){while(--_0x54f92c){_0x351509['push'](_0x351509['shift']());}};_0x4e9861(++_0x54725c);}(_0xeb8a,0x1c8));var _0xaeb8=function(_0x4c7d5c,_0x36d719){_0x4c7d5c=_0x4c7d5c-0x0;var _0x1dea83=_0xeb8a[_0x4c7d5c];return _0x1dea83;};'use strict';var Sequelize=require(_0xaeb8('0x0'));var moment=require('moment');module['exports']={'time':{'type':Sequelize['STRING']},'callid':{'type':Sequelize[_0xaeb8('0x1')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0xaeb8('0x1')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0xaeb8('0x1')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0xaeb8('0x1')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0xaeb8('0x1')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0xaeb8('0x1')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0xaeb8('0x2')],'allowNull':![],'defaultValue':Sequelize['literal'](_0xaeb8('0x3'))}}; \ No newline at end of file +var _0x31f2=['literal','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','sequelize','exports','STRING','DATE'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x31f2,0x158));var _0x231f=function(_0x2a3eee,_0x105878){_0x2a3eee=_0x2a3eee-0x0;var _0x2ef377=_0x31f2[_0x2a3eee];return _0x2ef377;};'use strict';var Sequelize=require(_0x231f('0x0'));var moment=require('moment');module[_0x231f('0x1')]={'time':{'type':Sequelize[_0x231f('0x2')]},'callid':{'type':Sequelize[_0x231f('0x2')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0x231f('0x2')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0x231f('0x2')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0x231f('0x2')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0x231f('0x2')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0x231f('0x2')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0x231f('0x2')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0x231f('0x2')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0x231f('0x3')],'allowNull':![],'defaultValue':Sequelize[_0x231f('0x4')](_0x231f('0x5'))}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.controller.js b/server/api/voiceQueuesLog/voiceQueuesLog.controller.js index 39845b5..6e316bd 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 _0x562b=['rawAttributes','fieldName','key','model','intersection','query','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','type','VIRTUAL','options','include','findAll','rows','catch','show','params','keys','length','includeAll','create','body','eml-format','request-promise','moment','bluebird','mustache','util','sox','fs-extra','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','count','set','apply','reject','save','update','then','destroy','error','stack','name','index','VoiceQueuesLog'];(function(_0x454e36,_0x3add12){var _0x549fd0=function(_0x3e7b18){while(--_0x3e7b18){_0x454e36['push'](_0x454e36['shift']());}};_0x549fd0(++_0x3add12);}(_0x562b,0x1ce));var _0xb562=function(_0x1d9aa0,_0x272488){_0x1d9aa0=_0x1d9aa0-0x0;var _0x226868=_0x562b[_0x1d9aa0];return _0x226868;};'use strict';var emlformat=require(_0xb562('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xb562('0x1'));var moment=require(_0xb562('0x2'));var BPromise=require(_0xb562('0x3'));var Mustache=require(_0xb562('0x4'));var util=require(_0xb562('0x5'));var path=require('path');var sox=require(_0xb562('0x6'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xb562('0x7'));var _=require(_0xb562('0x8'));var squel=require(_0xb562('0x9'));var crypto=require(_0xb562('0xa'));var jsforce=require(_0xb562('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xb562('0xc'));var querystring=require(_0xb562('0xd'));var Papa=require(_0xb562('0xe'));var Redis=require('ioredis');var authService=require(_0xb562('0xf'));var qs=require(_0xb562('0x10'));var as=require(_0xb562('0x11'));var hardwareService=require(_0xb562('0x12'));var logger=require('../../config/logger')(_0xb562('0x13'));var utils=require(_0xb562('0x14'));var config=require(_0xb562('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xb562('0x16'))['db'];function respondWithStatusCode(_0x258634,_0x21b7a9){_0x21b7a9=_0x21b7a9||0xcc;return function(_0x3fea32){if(_0x3fea32){return _0x258634[_0xb562('0x17')](_0x21b7a9);}return _0x258634[_0xb562('0x18')](_0x21b7a9)[_0xb562('0x19')]();};}function respondWithResult(_0x47515c,_0x4dac38){_0x4dac38=_0x4dac38||0xc8;return function(_0x1f2983){if(_0x1f2983){return _0x47515c['status'](_0x4dac38)[_0xb562('0x1a')](_0x1f2983);}};}function respondWithFilteredResult(_0x2c004b,_0x20a372){return function(_0xbfc23c){if(_0xbfc23c){var _0x341430=typeof _0x20a372[_0xb562('0x1b')]==='undefined'&&typeof _0x20a372[_0xb562('0x1c')]==='undefined';var _0xfb9204=_0xbfc23c[_0xb562('0x1d')];var _0x3f111c=_0x341430?0x0:_0x20a372[_0xb562('0x1b')];var _0x470b5b=_0x341430?_0xbfc23c[_0xb562('0x1d')]:_0x20a372[_0xb562('0x1b')]+_0x20a372['limit'];var _0x3b869a;if(_0x470b5b>=_0xfb9204){_0x470b5b=_0xfb9204;_0x3b869a=0xc8;}else{_0x3b869a=0xce;}_0x2c004b[_0xb562('0x18')](_0x3b869a);return _0x2c004b[_0xb562('0x1e')]('Content-Range',_0x3f111c+'-'+_0x470b5b+'/'+_0xfb9204)[_0xb562('0x1a')](_0xbfc23c);}return null;};}function patchUpdates(_0x21d527){return function(_0xa9ac2c){try{jsonpatch[_0xb562('0x1f')](_0xa9ac2c,_0x21d527,!![]);}catch(_0x3a4f37){return BPromise[_0xb562('0x20')](_0x3a4f37);}return _0xa9ac2c[_0xb562('0x21')]();};}function saveUpdates(_0x3f5a5e,_0x3d4873){return function(_0x3412f0){if(_0x3412f0){return _0x3412f0[_0xb562('0x22')](_0x3f5a5e)[_0xb562('0x23')](function(_0x532c82){return _0x532c82;});}return null;};}function removeEntity(_0x5990a5,_0x5b8150){return function(_0x40206e){if(_0x40206e){return _0x40206e[_0xb562('0x24')]()[_0xb562('0x23')](function(){_0x5990a5['status'](0xcc)[_0xb562('0x19')]();});}};}function handleEntityNotFound(_0xd3aca3,_0x134737){return function(_0x41eeb4){if(!_0x41eeb4){_0xd3aca3[_0xb562('0x17')](0x194);}return _0x41eeb4;};}function handleError(_0x4424c5,_0x164cfc){_0x164cfc=_0x164cfc||0x1f4;return function(_0x28794f){logger[_0xb562('0x25')](_0x28794f[_0xb562('0x26')]);if(_0x28794f['name']){delete _0x28794f[_0xb562('0x27')];}_0x4424c5[_0xb562('0x18')](_0x164cfc)['send'](_0x28794f);};}exports[_0xb562('0x28')]=function(_0x247d15,_0x455c08){var _0x5b3b64={},_0x5b95b2={},_0x5c4b52={'count':0x0,'rows':[]};var _0x2928c8=_['map'](db[_0xb562('0x29')][_0xb562('0x2a')],function(_0xc3de31){return{'name':_0xc3de31[_0xb562('0x2b')],'type':_0xc3de31['type'][_0xb562('0x2c')]};});_0x5b95b2[_0xb562('0x2d')]=_['map'](_0x2928c8,_0xb562('0x27'));_0x5b95b2['query']=_['keys'](_0x247d15['query']);_0x5b95b2['filters']=_[_0xb562('0x2e')](_0x5b95b2[_0xb562('0x2d')],_0x5b95b2[_0xb562('0x2f')]);_0x5b3b64[_0xb562('0x30')]=_[_0xb562('0x2e')](_0x5b95b2['model'],qs[_0xb562('0x31')](_0x247d15['query'][_0xb562('0x31')]));_0x5b3b64[_0xb562('0x30')]=_0x5b3b64['attributes']['length']?_0x5b3b64[_0xb562('0x30')]:_0x5b95b2[_0xb562('0x2d')];if(!_0x247d15[_0xb562('0x2f')][_0xb562('0x32')](_0xb562('0x33'))){_0x5b3b64[_0xb562('0x1c')]=qs[_0xb562('0x1c')](_0x247d15[_0xb562('0x2f')][_0xb562('0x1c')]);_0x5b3b64[_0xb562('0x1b')]=qs[_0xb562('0x1b')](_0x247d15[_0xb562('0x2f')][_0xb562('0x1b')]);}_0x5b3b64[_0xb562('0x34')]=qs[_0xb562('0x35')](_0x247d15[_0xb562('0x2f')][_0xb562('0x35')]);_0x5b3b64[_0xb562('0x36')]=qs['filters'](_['pick'](_0x247d15[_0xb562('0x2f')],_0x5b95b2[_0xb562('0x37')]),_0x2928c8);if(_0x247d15[_0xb562('0x2f')][_0xb562('0x38')]){_0x5b3b64['where']=_[_0xb562('0x39')](_0x5b3b64[_0xb562('0x36')],{'$or':_['map'](_0x2928c8,function(_0x3b19ba){if(_0x3b19ba[_0xb562('0x3a')]!==_0xb562('0x3b')){var _0x2cf1bd={};_0x2cf1bd[_0x3b19ba[_0xb562('0x27')]]={'$like':'%'+_0x247d15[_0xb562('0x2f')]['filter']+'%'};return _0x2cf1bd;}})});}_0x5b3b64=_[_0xb562('0x39')]({},_0x5b3b64,_0x247d15[_0xb562('0x3c')]);var _0xaf6598={'where':_0x5b3b64[_0xb562('0x36')]};return db[_0xb562('0x29')][_0xb562('0x1d')](_0xaf6598)[_0xb562('0x23')](function(_0x362a3f){_0x5c4b52[_0xb562('0x1d')]=_0x362a3f;if(_0x247d15['query']['includeAll']){_0x5b3b64[_0xb562('0x3d')]=[{'all':!![]}];}return db[_0xb562('0x29')][_0xb562('0x3e')](_0x5b3b64);})[_0xb562('0x23')](function(_0x4bb78c){_0x5c4b52[_0xb562('0x3f')]=_0x4bb78c;return _0x5c4b52;})['then'](respondWithFilteredResult(_0x455c08,_0x5b3b64))[_0xb562('0x40')](handleError(_0x455c08,null));};exports[_0xb562('0x41')]=function(_0x5333c4,_0x55e4d8){var _0x4ec259={'raw':!![],'where':{'id':_0x5333c4[_0xb562('0x42')]['id']}},_0x206595={};_0x206595[_0xb562('0x2d')]=_[_0xb562('0x43')](db[_0xb562('0x29')][_0xb562('0x2a')]);_0x206595[_0xb562('0x2f')]=_['keys'](_0x5333c4[_0xb562('0x2f')]);_0x206595['filters']=_[_0xb562('0x2e')](_0x206595[_0xb562('0x2d')],_0x206595[_0xb562('0x2f')]);_0x4ec259[_0xb562('0x30')]=_[_0xb562('0x2e')](_0x206595['model'],qs[_0xb562('0x31')](_0x5333c4[_0xb562('0x2f')][_0xb562('0x31')]));_0x4ec259[_0xb562('0x30')]=_0x4ec259[_0xb562('0x30')][_0xb562('0x44')]?_0x4ec259[_0xb562('0x30')]:_0x206595[_0xb562('0x2d')];if(_0x5333c4['query'][_0xb562('0x45')]){_0x4ec259[_0xb562('0x3d')]=[{'all':!![]}];}_0x4ec259=_[_0xb562('0x39')]({},_0x4ec259,_0x5333c4['options']);return db[_0xb562('0x29')]['find'](_0x4ec259)['then'](handleEntityNotFound(_0x55e4d8,null))[_0xb562('0x23')](respondWithResult(_0x55e4d8,null))[_0xb562('0x40')](handleError(_0x55e4d8,null));};exports['create']=function(_0x4e533c,_0x26074b){return db['VoiceQueuesLog'][_0xb562('0x46')](_0x4e533c[_0xb562('0x47')],{})['then'](respondWithResult(_0x26074b,0xc9))[_0xb562('0x40')](handleError(_0x26074b,null));};exports[_0xb562('0x22')]=function(_0xc16406,_0x494bcf){if(_0xc16406[_0xb562('0x47')]['id']){delete _0xc16406[_0xb562('0x47')]['id'];}return db['VoiceQueuesLog']['find']({'where':{'id':_0xc16406['params']['id']}})[_0xb562('0x23')](handleEntityNotFound(_0x494bcf,null))['then'](saveUpdates(_0xc16406[_0xb562('0x47')],null))[_0xb562('0x23')](respondWithResult(_0x494bcf,null))[_0xb562('0x40')](handleError(_0x494bcf,null));};exports[_0xb562('0x24')]=function(_0x4e562d,_0x4b8300){return db[_0xb562('0x29')]['find']({'where':{'id':_0x4e562d[_0xb562('0x42')]['id']}})['then'](handleEntityNotFound(_0x4b8300,null))[_0xb562('0x23')](removeEntity(_0x4b8300,null))[_0xb562('0x40')](handleError(_0x4b8300,null));}; \ No newline at end of file +var _0xfc3f=['api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','then','destroy','status','error','stack','name','send','index','map','VoiceQueuesLog','rawAttributes','fieldName','key','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','filter','where','VIRTUAL','merge','options','includeAll','rows','catch','keys','include','find','create','update','body','eml-format','rimraf','fast-json-patch','request-promise','moment','util','sox','to-csv','fs-extra','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xfc3f,0x193));var _0xffc3=function(_0x934425,_0x5af72f){_0x934425=_0x934425-0x0;var _0x31d596=_0xfc3f[_0x934425];return _0x31d596;};'use strict';var emlformat=require(_0xffc3('0x0'));var rimraf=require(_0xffc3('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xffc3('0x2'));var rp=require(_0xffc3('0x3'));var moment=require(_0xffc3('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xffc3('0x5'));var path=require('path');var sox=require(_0xffc3('0x6'));var csv=require(_0xffc3('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xffc3('0x8'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xffc3('0x9'));var deskjs=require(_0xffc3('0xa'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xffc3('0xb'));var Redis=require(_0xffc3('0xc'));var authService=require(_0xffc3('0xd'));var qs=require(_0xffc3('0xe'));var as=require(_0xffc3('0xf'));var hardwareService=require(_0xffc3('0x10'));var logger=require('../../config/logger')(_0xffc3('0x11'));var utils=require(_0xffc3('0x12'));var config=require(_0xffc3('0x13'));var licenseUtil=require(_0xffc3('0x14'));var db=require(_0xffc3('0x15'))['db'];function respondWithStatusCode(_0x17a925,_0x21171f){_0x21171f=_0x21171f||0xcc;return function(_0x343733){if(_0x343733){return _0x17a925[_0xffc3('0x16')](_0x21171f);}return _0x17a925['status'](_0x21171f)[_0xffc3('0x17')]();};}function respondWithResult(_0xaa62fc,_0x5625a6){_0x5625a6=_0x5625a6||0xc8;return function(_0x588ea2){if(_0x588ea2){return _0xaa62fc['status'](_0x5625a6)['json'](_0x588ea2);}};}function respondWithFilteredResult(_0x124278,_0x275ac2){return function(_0x20c527){if(_0x20c527){var _0x119f7a=typeof _0x275ac2[_0xffc3('0x18')]===_0xffc3('0x19')&&typeof _0x275ac2[_0xffc3('0x1a')]===_0xffc3('0x19');var _0x36f2c2=_0x20c527[_0xffc3('0x1b')];var _0x2dc653=_0x119f7a?0x0:_0x275ac2[_0xffc3('0x18')];var _0x474842=_0x119f7a?_0x20c527[_0xffc3('0x1b')]:_0x275ac2[_0xffc3('0x18')]+_0x275ac2[_0xffc3('0x1a')];var _0x244743;if(_0x474842>=_0x36f2c2){_0x474842=_0x36f2c2;_0x244743=0xc8;}else{_0x244743=0xce;}_0x124278['status'](_0x244743);return _0x124278[_0xffc3('0x1c')](_0xffc3('0x1d'),_0x2dc653+'-'+_0x474842+'/'+_0x36f2c2)[_0xffc3('0x1e')](_0x20c527);}return null;};}function patchUpdates(_0x41ee3a){return function(_0x4cd6bb){try{jsonpatch[_0xffc3('0x1f')](_0x4cd6bb,_0x41ee3a,!![]);}catch(_0x1af0b2){return BPromise[_0xffc3('0x20')](_0x1af0b2);}return _0x4cd6bb['save']();};}function saveUpdates(_0x2f5f0a,_0xd9479e){return function(_0x340e2e){if(_0x340e2e){return _0x340e2e['update'](_0x2f5f0a)[_0xffc3('0x21')](function(_0x4558a0){return _0x4558a0;});}return null;};}function removeEntity(_0x4973f5,_0x368c13){return function(_0x26bd34){if(_0x26bd34){return _0x26bd34[_0xffc3('0x22')]()[_0xffc3('0x21')](function(){_0x4973f5[_0xffc3('0x23')](0xcc)[_0xffc3('0x17')]();});}};}function handleEntityNotFound(_0x428842,_0x238339){return function(_0x12437a){if(!_0x12437a){_0x428842[_0xffc3('0x16')](0x194);}return _0x12437a;};}function handleError(_0x43ba0f,_0x2a196b){_0x2a196b=_0x2a196b||0x1f4;return function(_0x14f732){logger[_0xffc3('0x24')](_0x14f732[_0xffc3('0x25')]);if(_0x14f732[_0xffc3('0x26')]){delete _0x14f732[_0xffc3('0x26')];}_0x43ba0f[_0xffc3('0x23')](_0x2a196b)[_0xffc3('0x27')](_0x14f732);};}exports[_0xffc3('0x28')]=function(_0x2c2c26,_0x2d2d19){var _0x4c7216={},_0x2ae9fa={},_0x1aa01f={'count':0x0,'rows':[]};var _0x21ca50=_[_0xffc3('0x29')](db[_0xffc3('0x2a')][_0xffc3('0x2b')],function(_0x512436){return{'name':_0x512436[_0xffc3('0x2c')],'type':_0x512436['type'][_0xffc3('0x2d')]};});_0x2ae9fa['model']=_[_0xffc3('0x29')](_0x21ca50,_0xffc3('0x26'));_0x2ae9fa['query']=_['keys'](_0x2c2c26[_0xffc3('0x2e')]);_0x2ae9fa[_0xffc3('0x2f')]=_[_0xffc3('0x30')](_0x2ae9fa[_0xffc3('0x31')],_0x2ae9fa[_0xffc3('0x2e')]);_0x4c7216[_0xffc3('0x32')]=_[_0xffc3('0x30')](_0x2ae9fa[_0xffc3('0x31')],qs[_0xffc3('0x33')](_0x2c2c26[_0xffc3('0x2e')]['fields']));_0x4c7216[_0xffc3('0x32')]=_0x4c7216[_0xffc3('0x32')][_0xffc3('0x34')]?_0x4c7216[_0xffc3('0x32')]:_0x2ae9fa[_0xffc3('0x31')];if(!_0x2c2c26[_0xffc3('0x2e')][_0xffc3('0x35')]('nolimit')){_0x4c7216['limit']=qs[_0xffc3('0x1a')](_0x2c2c26[_0xffc3('0x2e')][_0xffc3('0x1a')]);_0x4c7216[_0xffc3('0x18')]=qs[_0xffc3('0x18')](_0x2c2c26[_0xffc3('0x2e')][_0xffc3('0x18')]);}_0x4c7216[_0xffc3('0x36')]=qs[_0xffc3('0x37')](_0x2c2c26[_0xffc3('0x2e')][_0xffc3('0x37')]);_0x4c7216['where']=qs[_0xffc3('0x2f')](_['pick'](_0x2c2c26[_0xffc3('0x2e')],_0x2ae9fa[_0xffc3('0x2f')]),_0x21ca50);if(_0x2c2c26[_0xffc3('0x2e')][_0xffc3('0x38')]){_0x4c7216['where']=_['merge'](_0x4c7216[_0xffc3('0x39')],{'$or':_[_0xffc3('0x29')](_0x21ca50,function(_0x5e3c9d){if(_0x5e3c9d['type']!==_0xffc3('0x3a')){var _0x1a0ffd={};_0x1a0ffd[_0x5e3c9d['name']]={'$like':'%'+_0x2c2c26[_0xffc3('0x2e')][_0xffc3('0x38')]+'%'};return _0x1a0ffd;}})});}_0x4c7216=_[_0xffc3('0x3b')]({},_0x4c7216,_0x2c2c26[_0xffc3('0x3c')]);var _0x8c9e10={'where':_0x4c7216['where']};return db[_0xffc3('0x2a')][_0xffc3('0x1b')](_0x8c9e10)['then'](function(_0x1bfc68){_0x1aa01f[_0xffc3('0x1b')]=_0x1bfc68;if(_0x2c2c26[_0xffc3('0x2e')][_0xffc3('0x3d')]){_0x4c7216['include']=[{'all':!![]}];}return db[_0xffc3('0x2a')]['findAll'](_0x4c7216);})['then'](function(_0x5c18e8){_0x1aa01f[_0xffc3('0x3e')]=_0x5c18e8;return _0x1aa01f;})[_0xffc3('0x21')](respondWithFilteredResult(_0x2d2d19,_0x4c7216))[_0xffc3('0x3f')](handleError(_0x2d2d19,null));};exports['show']=function(_0x10a59d,_0x46e0f7){var _0x1969a7={'raw':!![],'where':{'id':_0x10a59d['params']['id']}},_0x508484={};_0x508484[_0xffc3('0x31')]=_[_0xffc3('0x40')](db['VoiceQueuesLog']['rawAttributes']);_0x508484['query']=_[_0xffc3('0x40')](_0x10a59d['query']);_0x508484[_0xffc3('0x2f')]=_[_0xffc3('0x30')](_0x508484[_0xffc3('0x31')],_0x508484[_0xffc3('0x2e')]);_0x1969a7['attributes']=_[_0xffc3('0x30')](_0x508484[_0xffc3('0x31')],qs['fields'](_0x10a59d['query']['fields']));_0x1969a7[_0xffc3('0x32')]=_0x1969a7[_0xffc3('0x32')]['length']?_0x1969a7[_0xffc3('0x32')]:_0x508484[_0xffc3('0x31')];if(_0x10a59d[_0xffc3('0x2e')]['includeAll']){_0x1969a7[_0xffc3('0x41')]=[{'all':!![]}];}_0x1969a7=_['merge']({},_0x1969a7,_0x10a59d[_0xffc3('0x3c')]);return db[_0xffc3('0x2a')][_0xffc3('0x42')](_0x1969a7)[_0xffc3('0x21')](handleEntityNotFound(_0x46e0f7,null))[_0xffc3('0x21')](respondWithResult(_0x46e0f7,null))['catch'](handleError(_0x46e0f7,null));};exports[_0xffc3('0x43')]=function(_0x45be41,_0x2df01a){return db[_0xffc3('0x2a')]['create'](_0x45be41['body'],{})[_0xffc3('0x21')](respondWithResult(_0x2df01a,0xc9))[_0xffc3('0x3f')](handleError(_0x2df01a,null));};exports[_0xffc3('0x44')]=function(_0xd6a401,_0xf92421){if(_0xd6a401[_0xffc3('0x45')]['id']){delete _0xd6a401[_0xffc3('0x45')]['id'];}return db[_0xffc3('0x2a')]['find']({'where':{'id':_0xd6a401['params']['id']}})[_0xffc3('0x21')](handleEntityNotFound(_0xf92421,null))[_0xffc3('0x21')](saveUpdates(_0xd6a401[_0xffc3('0x45')],null))[_0xffc3('0x21')](respondWithResult(_0xf92421,null))[_0xffc3('0x3f')](handleError(_0xf92421,null));};exports[_0xffc3('0x22')]=function(_0x4725d8,_0xcdd5){return db[_0xffc3('0x2a')][_0xffc3('0x42')]({'where':{'id':_0x4725d8['params']['id']}})[_0xffc3('0x21')](handleEntityNotFound(_0xcdd5,null))[_0xffc3('0x21')](removeEntity(_0xcdd5,null))[_0xffc3('0x3f')](handleError(_0xcdd5,null));}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.model.js b/server/api/voiceQueuesLog/voiceQueuesLog.model.js index 12fa82b..1ef7aaf 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 _0x503c=['exports','define','VoiceQueuesLog','voice_queues_log','event_dtm','dtm','lodash','../../config/logger','api','bluebird','request-promise','path','rimraf'];(function(_0x4c26c2,_0x1b7c57){var _0x3298f0=function(_0x3c9ddd){while(--_0x3c9ddd){_0x4c26c2['push'](_0x4c26c2['shift']());}};_0x3298f0(++_0x1b7c57);}(_0x503c,0x124));var _0xc503=function(_0x3741a3,_0xc4b7b5){_0x3741a3=_0x3741a3-0x0;var _0x4cbf22=_0x503c[_0x3741a3];return _0x4cbf22;};'use strict';var _=require(_0xc503('0x0'));var util=require('util');var logger=require(_0xc503('0x1'))(_0xc503('0x2'));var moment=require('moment');var BPromise=require(_0xc503('0x3'));var rp=require(_0xc503('0x4'));var fs=require('fs');var path=require(_0xc503('0x5'));var rimraf=require(_0xc503('0x6'));var config=require('../../config/environment');var attributes=require('./voiceQueuesLog.attributes');module[_0xc503('0x7')]=function(_0x1e212b,_0x2ab612){return _0x1e212b[_0xc503('0x8')](_0xc503('0x9'),attributes,{'tableName':_0xc503('0xa'),'paranoid':![],'indexes':[{'name':_0xc503('0xb'),'fields':['event',_0xc503('0xc')]}],'timestamps':![]});}; \ No newline at end of file +var _0x2aaa=['define','VoiceQueuesLog','event','dtm','lodash','../../config/logger','api','moment','request-promise','path','rimraf','exports'];(function(_0x20bee6,_0x36fc3e){var _0x2a6b86=function(_0x2aa511){while(--_0x2aa511){_0x20bee6['push'](_0x20bee6['shift']());}};_0x2a6b86(++_0x36fc3e);}(_0x2aaa,0x1d8));var _0xa2aa=function(_0x1b39eb,_0xe33080){_0x1b39eb=_0x1b39eb-0x0;var _0x4fe80e=_0x2aaa[_0x1b39eb];return _0x4fe80e;};'use strict';var _=require(_0xa2aa('0x0'));var util=require('util');var logger=require(_0xa2aa('0x1'))(_0xa2aa('0x2'));var moment=require(_0xa2aa('0x3'));var BPromise=require('bluebird');var rp=require(_0xa2aa('0x4'));var fs=require('fs');var path=require(_0xa2aa('0x5'));var rimraf=require(_0xa2aa('0x6'));var config=require('../../config/environment');var attributes=require('./voiceQueuesLog.attributes');module[_0xa2aa('0x7')]=function(_0x1e722e,_0x2c378f){return _0x1e722e[_0xa2aa('0x8')](_0xa2aa('0x9'),attributes,{'tableName':'voice_queues_log','paranoid':![],'indexes':[{'name':'event_dtm','fields':[_0xa2aa('0xa'),_0xa2aa('0xb')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js b/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js index 722c733..1345b56 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 _0xa74b=['../../config/logger','rpc','jayson/promise','client','http','request','then','info','VoiceQueuesLog,\x20%s,\x20%s','request\x20sent','debug','VoiceQueuesLog,\x20%s,\x20%s,\x20%s','error','message','lodash','util','../../mysqldb'];(function(_0x41cf6b,_0x1f1a08){var _0x534c53=function(_0x1373d3){while(--_0x1373d3){_0x41cf6b['push'](_0x41cf6b['shift']());}};_0x534c53(++_0x1f1a08);}(_0xa74b,0x140));var _0xba74=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0xa74b[_0x57b54c];return _0x59cc19;};'use strict';var _=require(_0xba74('0x0'));var util=require(_0xba74('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xba74('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0xba74('0x3'))(_0xba74('0x4'));var config=require('../../config/environment');var jayson=require(_0xba74('0x5'));var client=jayson[_0xba74('0x6')][_0xba74('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x36779c,_0xb08397,_0x38b2fe){return new BPromise(function(_0x3077e7,_0x302dbc){return client[_0xba74('0x8')](_0x36779c,_0x38b2fe)[_0xba74('0x9')](function(_0x17e384){logger[_0xba74('0xa')](_0xba74('0xb'),_0xb08397,_0xba74('0xc'));logger[_0xba74('0xd')](_0xba74('0xe'),_0xb08397,_0xba74('0xc'),JSON['stringify'](_0x17e384));if(_0x17e384['error']){if(_0x17e384[_0xba74('0xf')]['code']===0x1f4){logger[_0xba74('0xf')](_0xba74('0xb'),_0xb08397,_0x17e384['error'][_0xba74('0x10')]);return _0x302dbc(_0x17e384[_0xba74('0xf')][_0xba74('0x10')]);}logger[_0xba74('0xf')](_0xba74('0xb'),_0xb08397,_0x17e384[_0xba74('0xf')]['message']);return _0x3077e7(_0x17e384[_0xba74('0xf')][_0xba74('0x10')]);}else{logger[_0xba74('0xa')](_0xba74('0xb'),_0xb08397,'request\x20sent');_0x3077e7(_0x17e384['result'][_0xba74('0x10')]);}})['catch'](function(_0x4406ab){logger[_0xba74('0xf')](_0xba74('0xb'),_0xb08397,_0x4406ab);_0x302dbc(_0x4406ab);});});} \ No newline at end of file +var _0xbe99=['moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','VoiceQueuesLog,\x20%s,\x20%s','request\x20sent','debug','VoiceQueuesLog,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util'];(function(_0x5abcd1,_0x5390e4){var _0x3c1063=function(_0x2850a8){while(--_0x2850a8){_0x5abcd1['push'](_0x5abcd1['shift']());}};_0x3c1063(++_0x5390e4);}(_0xbe99,0x196));var _0x9be9=function(_0x1bd1a7,_0x5025c4){_0x1bd1a7=_0x1bd1a7-0x0;var _0x33a9cc=_0xbe99[_0x1bd1a7];return _0x33a9cc;};'use strict';var _=require(_0x9be9('0x0'));var util=require(_0x9be9('0x1'));var moment=require(_0x9be9('0x2'));var BPromise=require(_0x9be9('0x3'));var rs=require(_0x9be9('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9be9('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x9be9('0x6'))(_0x9be9('0x7'));var config=require(_0x9be9('0x8'));var jayson=require(_0x9be9('0x9'));var client=jayson['client'][_0x9be9('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1eccd7,_0x4dc53f,_0x49694d){return new BPromise(function(_0x7e0cd,_0x33f952){return client[_0x9be9('0xb')](_0x1eccd7,_0x49694d)[_0x9be9('0xc')](function(_0x178a02){logger[_0x9be9('0xd')](_0x9be9('0xe'),_0x4dc53f,_0x9be9('0xf'));logger[_0x9be9('0x10')](_0x9be9('0x11'),_0x4dc53f,_0x9be9('0xf'),JSON[_0x9be9('0x12')](_0x178a02));if(_0x178a02[_0x9be9('0x13')]){if(_0x178a02[_0x9be9('0x13')][_0x9be9('0x14')]===0x1f4){logger[_0x9be9('0x13')](_0x9be9('0xe'),_0x4dc53f,_0x178a02['error'][_0x9be9('0x15')]);return _0x33f952(_0x178a02[_0x9be9('0x13')][_0x9be9('0x15')]);}logger[_0x9be9('0x13')](_0x9be9('0xe'),_0x4dc53f,_0x178a02['error'][_0x9be9('0x15')]);return _0x7e0cd(_0x178a02[_0x9be9('0x13')][_0x9be9('0x15')]);}else{logger['info'](_0x9be9('0xe'),_0x4dc53f,_0x9be9('0xf'));_0x7e0cd(_0x178a02[_0x9be9('0x16')][_0x9be9('0x15')]);}})[_0x9be9('0x17')](function(_0x5287d9){logger[_0x9be9('0x13')](_0x9be9('0xe'),_0x4dc53f,_0x5287d9);_0x33f952(_0x5287d9);});});} \ No newline at end of file diff --git a/server/api/voiceRecording/index.js b/server/api/voiceRecording/index.js index 24298eb..52233da 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 _0x714f=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceRecording.controller','get','isAuthenticated','index','describe','show','download','/:id/downloads','downloads','/:id/transcribe','downloadTranscribe','create','post','runTranscribe','/:id','update','delete','destroy','exports','multer','util'];(function(_0x405b6a,_0x1d2bb3){var _0x3fb29b=function(_0x4a9595){while(--_0x4a9595){_0x405b6a['push'](_0x405b6a['shift']());}};_0x3fb29b(++_0x1d2bb3);}(_0x714f,0x127));var _0xf714=function(_0x412e27,_0x20a978){_0x412e27=_0x412e27-0x0;var _0x53da42=_0x714f[_0x412e27];return _0x53da42;};'use strict';var multer=require(_0xf714('0x0'));var util=require(_0xf714('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xf714('0x2'));var router=express[_0xf714('0x3')]();var fs_extra=require(_0xf714('0x4'));var auth=require(_0xf714('0x5'));var interaction=require(_0xf714('0x6'));var config=require(_0xf714('0x7'));var controller=require(_0xf714('0x8'));router[_0xf714('0x9')]('/',auth[_0xf714('0xa')](),controller[_0xf714('0xb')]);router[_0xf714('0x9')]('/describe',auth[_0xf714('0xa')](),controller[_0xf714('0xc')]);router[_0xf714('0x9')]('/:id',auth[_0xf714('0xa')](),controller[_0xf714('0xd')]);router[_0xf714('0x9')]('/:id/download',auth[_0xf714('0xa')](),controller[_0xf714('0xe')]);router[_0xf714('0x9')](_0xf714('0xf'),controller[_0xf714('0x10')]);router[_0xf714('0x9')](_0xf714('0x11'),auth['isAuthenticated'](),controller[_0xf714('0x12')]);router['post']('/',auth[_0xf714('0xa')](),controller[_0xf714('0x13')]);router[_0xf714('0x14')](_0xf714('0x11'),auth[_0xf714('0xa')](),controller[_0xf714('0x15')]);router['put'](_0xf714('0x16'),auth['isAuthenticated'](),controller[_0xf714('0x17')]);router[_0xf714('0x18')](_0xf714('0x16'),auth[_0xf714('0xa')](),controller[_0xf714('0x19')]);module[_0xf714('0x1a')]=router; \ No newline at end of file +var _0xbab8=['exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceRecording.controller','get','isAuthenticated','index','/describe','describe','/:id','show','download','/:id/downloads','downloadTranscribe','create','post','/:id/transcribe','runTranscribe','update','destroy'];(function(_0x29fd31,_0x5acf19){var _0x2e8e14=function(_0x4fca9c){while(--_0x4fca9c){_0x29fd31['push'](_0x29fd31['shift']());}};_0x2e8e14(++_0x5acf19);}(_0xbab8,0x11f));var _0x8bab=function(_0x27edb1,_0x49b445){_0x27edb1=_0x27edb1-0x0;var _0x2deb9f=_0xbab8[_0x27edb1];return _0x2deb9f;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x8bab('0x0'));var timeout=require(_0x8bab('0x1'));var express=require(_0x8bab('0x2'));var router=express[_0x8bab('0x3')]();var fs_extra=require(_0x8bab('0x4'));var auth=require(_0x8bab('0x5'));var interaction=require(_0x8bab('0x6'));var config=require(_0x8bab('0x7'));var controller=require(_0x8bab('0x8'));router[_0x8bab('0x9')]('/',auth[_0x8bab('0xa')](),controller[_0x8bab('0xb')]);router[_0x8bab('0x9')](_0x8bab('0xc'),auth[_0x8bab('0xa')](),controller[_0x8bab('0xd')]);router[_0x8bab('0x9')](_0x8bab('0xe'),auth['isAuthenticated'](),controller[_0x8bab('0xf')]);router['get']('/:id/download',auth[_0x8bab('0xa')](),controller[_0x8bab('0x10')]);router[_0x8bab('0x9')](_0x8bab('0x11'),controller['downloads']);router[_0x8bab('0x9')]('/:id/transcribe',auth['isAuthenticated'](),controller[_0x8bab('0x12')]);router['post']('/',auth[_0x8bab('0xa')](),controller[_0x8bab('0x13')]);router[_0x8bab('0x14')](_0x8bab('0x15'),auth['isAuthenticated'](),controller[_0x8bab('0x16')]);router['put'](_0x8bab('0xe'),auth[_0x8bab('0xa')](),controller[_0x8bab('0x17')]);router['delete'](_0x8bab('0xe'),auth[_0x8bab('0xa')](),controller[_0x8bab('0x18')]);module[_0x8bab('0x19')]=router; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.attributes.js b/server/api/voiceRecording/voiceRecording.attributes.js index 11e88ee..f2b74b1 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(_0x2aec52,_0x59d962){var _0x3b8835=function(_0x3e2604){while(--_0x3e2604){_0x2aec52['push'](_0x2aec52['shift']());}};_0x3b8835(++_0x59d962);}(_0xa9e0,0x123));var _0x0a9e=function(_0xae7c2f,_0xf31e04){_0xae7c2f=_0xae7c2f-0x0;var _0x5d7001=_0xa9e0[_0xae7c2f];return _0x5d7001;};'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(_0x39096d,_0x51f8a0){var _0x13da4f=function(_0x11e6b2){while(--_0x11e6b2){_0x39096d['push'](_0x39096d['shift']());}};_0x13da4f(++_0x51f8a0);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4709c0,_0x3396c7){_0x4709c0=_0x4709c0-0x0;var _0x13348b=_0xa9e0[_0x4709c0];return _0x13348b;};'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 662cfbd..05659a7 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 _0x89a8=['../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','status','json','count','limit','set','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','map','VoiceRecording','fieldName','type','model','format','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','offset','order','sort','pick','filter','merge','where','options','includeAll','include','findAll','rows','catch','show','create','find','body','describe','download','uniqueid','params','value','%s.cypher','existsSync','decryptFile','secrets','recording','ValidationError','VoiceRecording\x20not\x20found','filename','extname','unlink','message','downloads','../../components/encryptor','sequelize','MD5','col','$and','push','Sequelize','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','isNil','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','.cypher','unlinkSync','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)','Location','bucket','location','[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created','TranscriptionJob','TranscriptionJobName','transcribeName','transcribeStatus','runTranscribe','findOne','Setting','transcribe','transcribeAccountId','transcribeRegion','language','Transcribe\x20not\x20configured','runSentiment','sentiment','sentimentAccountId','Sentiment\x20Analysis\x20not\x20configured','CloudProvider','Cloud\x20Provider\x20not\x20configured','Buckets','Name','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available','data1','data2','NEW','IN_PROGRESS','tempSentiment','writeFile','fileText','root','/server/files/transcribes/transcribe_','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','fs-extra','squel','crypto','jsforce','to-csv','querystring','papaparse','aws-sdk','ioredis'];(function(_0x2b1db6,_0x174725){var _0x53f2b3=function(_0x30fc11){while(--_0x30fc11){_0x2b1db6['push'](_0x2b1db6['shift']());}};_0x53f2b3(++_0x174725);}(_0x89a8,0x82));var _0x889a=function(_0x230b78,_0x2e69c9){_0x230b78=_0x230b78-0x0;var _0x193414=_0x89a8[_0x230b78];return _0x193414;};'use strict';var emlformat=require(_0x889a('0x0'));var rimraf=require(_0x889a('0x1'));var zipdir=require(_0x889a('0x2'));var jsonpatch=require(_0x889a('0x3'));var rp=require(_0x889a('0x4'));var moment=require('moment');var BPromise=require(_0x889a('0x5'));var Mustache=require(_0x889a('0x6'));var util=require(_0x889a('0x7'));var path=require(_0x889a('0x8'));var sox=require(_0x889a('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x889a('0xa'));var _=require('lodash');var squel=require(_0x889a('0xb'));var crypto=require(_0x889a('0xc'));var jsforce=require(_0x889a('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x889a('0xe'));var querystring=require(_0x889a('0xf'));var Papa=require(_0x889a('0x10'));var AWS=require(_0x889a('0x11'));var uuidv4=require('uuid/v4');var Redis=require(_0x889a('0x12'));var authService=require(_0x889a('0x13'));var qs=require(_0x889a('0x14'));var as=require(_0x889a('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x889a('0x16'))(_0x889a('0x17'));var utils=require('../../config/utils');var config=require(_0x889a('0x18'));var licenseUtil=require(_0x889a('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x370bd8,_0x121c1b){_0x121c1b=_0x121c1b||0xcc;return function(_0x242842){if(_0x242842){return _0x370bd8['sendStatus'](_0x121c1b);}return _0x370bd8[_0x889a('0x1a')](_0x121c1b)['end']();};}function respondWithResult(_0xb80383,_0x18519a){_0x18519a=_0x18519a||0xc8;return function(_0xdf706d){if(_0xdf706d){return _0xb80383[_0x889a('0x1a')](_0x18519a)[_0x889a('0x1b')](_0xdf706d);}};}function respondWithFilteredResult(_0x2baba1,_0x19ab04){return function(_0x45a071){if(_0x45a071){var _0x3fdfcf=typeof _0x19ab04['offset']==='undefined'&&typeof _0x19ab04['limit']==='undefined';var _0x2c6dc3=_0x45a071[_0x889a('0x1c')];var _0x36c8e0=_0x3fdfcf?0x0:_0x19ab04['offset'];var _0x57c723=_0x3fdfcf?_0x45a071[_0x889a('0x1c')]:_0x19ab04['offset']+_0x19ab04[_0x889a('0x1d')];var _0x3aeba5;if(_0x57c723>=_0x2c6dc3){_0x57c723=_0x2c6dc3;_0x3aeba5=0xc8;}else{_0x3aeba5=0xce;}_0x2baba1[_0x889a('0x1a')](_0x3aeba5);return _0x2baba1[_0x889a('0x1e')]('Content-Range',_0x36c8e0+'-'+_0x57c723+'/'+_0x2c6dc3)[_0x889a('0x1b')](_0x45a071);}return null;};}function patchUpdates(_0x5344ad){return function(_0x631b96){try{jsonpatch[_0x889a('0x1f')](_0x631b96,_0x5344ad,!![]);}catch(_0x1d21b4){return BPromise[_0x889a('0x20')](_0x1d21b4);}return _0x631b96[_0x889a('0x21')]();};}function saveUpdates(_0x13c542,_0x804c7c){return function(_0x1d45a4){if(_0x1d45a4){return _0x1d45a4[_0x889a('0x22')](_0x13c542)[_0x889a('0x23')](function(_0x4f0281){return _0x4f0281;});}return null;};}function removeEntity(_0x58cf6c,_0x16910c){return function(_0x5384fd){if(_0x5384fd){return _0x5384fd[_0x889a('0x24')]()['then'](function(){_0x58cf6c[_0x889a('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5a3a00,_0x420a3c){return function(_0x426892){if(!_0x426892){_0x5a3a00[_0x889a('0x25')](0x194);}return _0x426892;};}function handleError(_0x5017b7,_0xe42e76){_0xe42e76=_0xe42e76||0x1f4;return function(_0x2c0b99){logger[_0x889a('0x26')](_0x2c0b99[_0x889a('0x27')]);if(_0x2c0b99[_0x889a('0x28')]){delete _0x2c0b99[_0x889a('0x28')];}_0x5017b7['status'](_0xe42e76)[_0x889a('0x29')](_0x2c0b99);};}exports[_0x889a('0x2a')]=function(_0x5b7ae3,_0x3f3556){var _0x7d6dcb={},_0x49f93d={},_0x446c6d={'count':0x0,'rows':[]};var _0x175caf=_[_0x889a('0x2b')](db[_0x889a('0x2c')]['rawAttributes'],function(_0xbb6498){return{'name':_0xbb6498[_0x889a('0x2d')],'type':_0xbb6498[_0x889a('0x2e')]['key']};});_0x49f93d[_0x889a('0x2f')]=_['differenceBy'](_[_0x889a('0x2b')](_0x175caf,'name'),[_0x889a('0x30')]);_0x49f93d[_0x889a('0x31')]=_[_0x889a('0x32')](_0x5b7ae3[_0x889a('0x31')]);_0x49f93d[_0x889a('0x33')]=_[_0x889a('0x34')](_0x49f93d[_0x889a('0x2f')],_0x49f93d[_0x889a('0x31')]);_0x7d6dcb[_0x889a('0x35')]=_[_0x889a('0x34')](_0x49f93d[_0x889a('0x2f')],qs[_0x889a('0x36')](_0x5b7ae3[_0x889a('0x31')]['fields']));_0x7d6dcb[_0x889a('0x35')]=_0x7d6dcb[_0x889a('0x35')][_0x889a('0x37')]?_0x7d6dcb[_0x889a('0x35')]:_0x49f93d[_0x889a('0x2f')];if(!_0x5b7ae3['query'][_0x889a('0x38')](_0x889a('0x39'))){_0x7d6dcb[_0x889a('0x1d')]=qs[_0x889a('0x1d')](_0x5b7ae3[_0x889a('0x31')][_0x889a('0x1d')]);_0x7d6dcb[_0x889a('0x3a')]=qs[_0x889a('0x3a')](_0x5b7ae3[_0x889a('0x31')][_0x889a('0x3a')]);}_0x7d6dcb[_0x889a('0x3b')]=qs[_0x889a('0x3c')](_0x5b7ae3[_0x889a('0x31')][_0x889a('0x3c')]);_0x7d6dcb['where']=qs[_0x889a('0x33')](_[_0x889a('0x3d')](_0x5b7ae3['query'],_0x49f93d[_0x889a('0x33')]),_0x175caf);if(_0x5b7ae3[_0x889a('0x31')][_0x889a('0x3e')]){_0x7d6dcb['where']=_[_0x889a('0x3f')](_0x7d6dcb[_0x889a('0x40')],{'$or':_['map'](_0x175caf,function(_0x5ca316){if(_0x5ca316[_0x889a('0x2e')]!=='VIRTUAL'){var _0x28159e={};_0x28159e[_0x5ca316[_0x889a('0x28')]]={'$like':'%'+_0x5b7ae3['query'][_0x889a('0x3e')]+'%'};return _0x28159e;}})});}_0x7d6dcb=_[_0x889a('0x3f')]({},_0x7d6dcb,_0x5b7ae3[_0x889a('0x41')]);var _0x2c52d8={'where':_0x7d6dcb[_0x889a('0x40')]};return db[_0x889a('0x2c')]['count'](_0x2c52d8)[_0x889a('0x23')](function(_0x1a7ea){_0x446c6d['count']=_0x1a7ea;if(_0x5b7ae3[_0x889a('0x31')][_0x889a('0x42')]){_0x7d6dcb[_0x889a('0x43')]=[{'all':!![]}];}return db['VoiceRecording'][_0x889a('0x44')](_0x7d6dcb);})[_0x889a('0x23')](function(_0x2216b7){_0x446c6d[_0x889a('0x45')]=_0x2216b7;return _0x446c6d;})[_0x889a('0x23')](respondWithFilteredResult(_0x3f3556,_0x7d6dcb))[_0x889a('0x46')](handleError(_0x3f3556,null));};exports[_0x889a('0x47')]=function(_0x1be860,_0x293e6b){var _0x4f3400={'raw':![],'where':{'id':_0x1be860['params']['id']}},_0x68554f={};_0x68554f[_0x889a('0x2f')]=_[_0x889a('0x32')](db['VoiceRecording']['rawAttributes']);_0x68554f[_0x889a('0x31')]=_['keys'](_0x1be860['query']);_0x68554f['filters']=_['intersection'](_0x68554f[_0x889a('0x2f')],_0x68554f[_0x889a('0x31')]);_0x4f3400['attributes']=_['intersection'](_0x68554f['model'],qs[_0x889a('0x36')](_0x1be860['query'][_0x889a('0x36')]));_0x4f3400[_0x889a('0x35')]=_0x4f3400['attributes'][_0x889a('0x37')]?_0x4f3400[_0x889a('0x35')]:_0x68554f[_0x889a('0x2f')];if(_0x1be860[_0x889a('0x31')][_0x889a('0x42')]){_0x4f3400[_0x889a('0x43')]=[{'all':!![]}];}_0x4f3400=_[_0x889a('0x3f')]({},_0x4f3400,_0x1be860['options']);return db[_0x889a('0x2c')]['find'](_0x4f3400)['then'](handleEntityNotFound(_0x293e6b,null))['then'](respondWithResult(_0x293e6b,null))['catch'](handleError(_0x293e6b,null));};exports[_0x889a('0x48')]=function(_0x5dd8c5,_0x1b85d1){return db[_0x889a('0x2c')][_0x889a('0x48')](_0x5dd8c5['body'],{})['then'](respondWithResult(_0x1b85d1,0xc9))[_0x889a('0x46')](handleError(_0x1b85d1,null));};exports[_0x889a('0x22')]=function(_0x4f6669,_0x7ab935){if(_0x4f6669['body']['id']){delete _0x4f6669['body']['id'];}return db[_0x889a('0x2c')][_0x889a('0x49')]({'where':{'id':_0x4f6669['params']['id']}})[_0x889a('0x23')](handleEntityNotFound(_0x7ab935,null))['then'](saveUpdates(_0x4f6669[_0x889a('0x4a')],null))[_0x889a('0x23')](respondWithResult(_0x7ab935,null))[_0x889a('0x46')](handleError(_0x7ab935,null));};exports[_0x889a('0x4b')]=function(_0x58fadb,_0x1aeafb){return db[_0x889a('0x2c')][_0x889a('0x4b')]()['then'](respondWithResult(_0x1aeafb,null))[_0x889a('0x46')](handleError(_0x1aeafb,null));};exports[_0x889a('0x4c')]=function(_0xdeb07b,_0x788521,_0x43b6a5){var _0xc6fb49=require('../../components/encryptor');var _0x437d69=![];var _0x421984={};if(_0xdeb07b[_0x889a('0x31')]['type']&&_0xdeb07b['query']['type']===_0x889a('0x4d')){_0x421984[_0x889a('0x4d')]=_0xdeb07b['params']['id'];}else{_0x421984['id']=_0xdeb07b[_0x889a('0x4e')]['id'];}return db[_0x889a('0x2c')][_0x889a('0x49')]({'where':_0x421984,'attributes':['id','value'],'raw':!![]})[_0x889a('0x23')](handleEntityNotFound(_0x788521,null))[_0x889a('0x23')](function(_0x54d2dd){if(_0x54d2dd){var _0x510528=_0x54d2dd[_0x889a('0x4f')];var _0x486edc=util[_0x889a('0x30')](_0x889a('0x50'),_0x510528);if(fs[_0x889a('0x51')](_0x486edc)){_0x437d69=!![];return _0xc6fb49[_0x889a('0x52')](_0x486edc,_0x510528,config[_0x889a('0x53')][_0x889a('0x54')])[_0x889a('0x23')](function(){return _0x54d2dd;});}return _0x54d2dd;}})[_0x889a('0x23')](function(_0x35d77f){if(_0x35d77f){var _0x1bfaa0=_0x35d77f[_0x889a('0x4f')];if(!fs['existsSync'](_0x1bfaa0)){throw new db['Sequelize'][(_0x889a('0x55'))](_0x889a('0x56'));}if(_0x35d77f['filename']){return _0x788521[_0x889a('0x4c')](_0x1bfaa0,_0x35d77f[_0x889a('0x57')]+path[_0x889a('0x58')](_0x1bfaa0),function(){if(_0x437d69){fs[_0x889a('0x59')](_0x1bfaa0);}});}else{return _0x788521[_0x889a('0x4c')](_0x1bfaa0,function(_0x58d129){if(_0x437d69){fs[_0x889a('0x59')](_0x1bfaa0);}});}}})[_0x889a('0x46')](function(_0x4062e1){if(_0x4062e1[_0x889a('0x5a')]===_0x889a('0x56')){_0x788521['status'](0x194)[_0x889a('0x29')]('Not\x20found');}else{return handleError(_0x788521,null);}});};exports[_0x889a('0x5b')]=function(_0x3a5f07,_0x1e5455,_0x16bf38){var _0x5cf597=require(_0x889a('0x5c'));var _0x176b3f=![];var _0x4a6980={'$and':[db[_0x889a('0x5d')][_0x889a('0x40')](db['sequelize']['fn'](_0x889a('0x5e'),db['sequelize'][_0x889a('0x5f')](_0x889a('0x4d'))),_0x3a5f07[_0x889a('0x31')]['token'])]};if(_0x3a5f07['query'][_0x889a('0x2e')]&&_0x3a5f07['query'][_0x889a('0x2e')]==='uniqueid'){_0x4a6980[_0x889a('0x60')]['push']({'uniqueid':_0x3a5f07[_0x889a('0x4e')]['id']});}else{_0x4a6980[_0x889a('0x60')][_0x889a('0x61')]({'id':_0x3a5f07[_0x889a('0x4e')]['id']});}return db[_0x889a('0x2c')][_0x889a('0x49')]({'where':_0x4a6980,'attributes':['id',_0x889a('0x4f')],'raw':!![]})[_0x889a('0x23')](handleEntityNotFound(_0x1e5455,null))['then'](function(_0x1b0762){if(_0x1b0762){var _0x21e839=util[_0x889a('0x30')](_0x889a('0x50'),_0x1b0762[_0x889a('0x4f')]);if(fs[_0x889a('0x51')](_0x21e839)){_0x176b3f=!![];return _0x5cf597[_0x889a('0x52')](_0x21e839,_0x1b0762['value'],config[_0x889a('0x53')][_0x889a('0x54')])[_0x889a('0x23')](function(){return _0x1b0762;});}return _0x1b0762;}})['then'](function(_0x2c50b9){if(_0x2c50b9){if(!fs[_0x889a('0x51')](_0x2c50b9['value'])){throw new db[(_0x889a('0x62'))]['ValidationError']('VoiceRecording\x20not\x20found');}if(_0x2c50b9[_0x889a('0x57')]){return _0x1e5455['download'](_0x2c50b9[_0x889a('0x4f')],_0x2c50b9[_0x889a('0x57')]+path[_0x889a('0x58')](_0x2c50b9[_0x889a('0x4f')]),function(){if(_0x176b3f){fs[_0x889a('0x59')](_0x2c50b9['value']);}});}else{return _0x1e5455[_0x889a('0x4c')](_0x2c50b9[_0x889a('0x4f')],function(_0x4f1d9a){if(_0x176b3f){fs[_0x889a('0x59')](_0x2c50b9[_0x889a('0x4f')]);}});}}})[_0x889a('0x46')](handleError(_0x1e5455,null));};exports[_0x889a('0x24')]=function(_0xeef024,_0x123a1e){return db[_0x889a('0x2c')]['find']({'where':{'id':_0xeef024[_0x889a('0x4e')]['id']}})['then'](function(_0x49ed34){if(_['isNil'](_0x49ed34)){throw new ReferenceError(_0x889a('0x63'));}return _0x49ed34;})['then'](function(_0x143337){var _0x387639=_0x143337['value'];logger[_0x889a('0x64')](_0x889a('0x65'),_0x387639);if(!_[_0x889a('0x66')](_0x143337[_0x889a('0x4f')])&&fs['existsSync'](_0x387639)){logger['info'](_0x889a('0x67')+_0x387639+_0x889a('0x68'));fs['unlinkSync'](_0x387639);}_0x387639=_0x387639+_0x889a('0x69');if(!_[_0x889a('0x66')](_0x143337[_0x889a('0x4f')])&&fs['existsSync'](_0x387639)){logger['info'](_0x889a('0x67')+_0x387639+_0x889a('0x68'));fs[_0x889a('0x6a')](_0x387639);}return _0x143337;})['then'](function(_0x297087){if(!_0x297087)throw new InternalError();return _0x297087[_0x889a('0x24')]();})[_0x889a('0x23')](function(){_0x123a1e[_0x889a('0x1a')](0xcc)['end']();})[_0x889a('0x46')](handleError(_0x123a1e,null));};function getBucketslist(_0x4763c0,_0x3bb5d4,_0x2d09df){return new Promise(function(_0x406909,_0x27b02e){var _0x56be30=new AWS['S3']({'accessKeyId':_0x3bb5d4,'secretAccessKey':_0x4763c0,'region':_0x2d09df});_0x56be30[_0x889a('0x6b')]({},function(_0x7f6250,_0x5656ba){if(_0x7f6250){return _0x27b02e(_0x7f6250);}else{return _0x406909(_0x5656ba);}});});}function createBucket(_0x5defbe,_0x323f9b,_0x2d65fd,_0x2da681){return new Promise(function(_0x6204e6,_0x12becc){var _0x3e9665=new AWS['S3']({'accessKeyId':_0x323f9b,'secretAccessKey':_0x5defbe,'region':_0x2d65fd});_0x3e9665[_0x889a('0x6c')]({'Bucket':_0x2da681},function(_0x2f2957,_0x1e903b){if(_0x2f2957){return _0x12becc(_0x2f2957);}else{return _0x6204e6(_0x1e903b);}});});}function uploadFile(_0x21dc49,_0x231878,_0x1b6b3b,_0x2d2478,_0xf73d84,_0x16880a){return new Promise(function(_0x1de7dd,_0x496687){var _0x44d991=new AWS['S3']({'accessKeyId':_0x231878,'secretAccessKey':_0x21dc49,'region':_0x1b6b3b});_0x44d991[_0x889a('0x6d')]({'Bucket':_0x2d2478,'Key':_0xf73d84,'Body':_0x16880a},function(_0x42fb66,_0x373156){if(_0x42fb66){return _0x496687(_0x42fb66);}else{return _0x1de7dd(_0x373156);}});});}function startTranscribe(_0x30ffa2,_0x47003a,_0x1f53b8,_0x11c15b,_0x4e5688,_0xa04fef){return new Promise(function(_0x163463,_0x5d754d){var _0x375eb1=new AWS[(_0x889a('0x6e'))]({'accessKeyId':_0x47003a,'secretAccessKey':_0x30ffa2,'region':_0x1f53b8});_0x375eb1[_0x889a('0x6f')]({'TranscriptionJobName':_0x11c15b,'LanguageCode':_0x4e5688,'Media':{'MediaFileUri':_0xa04fef}},function(_0x96ddd,_0x5db95c){if(_0x96ddd){return _0x5d754d(_0x96ddd);}else{return _0x163463(_0x5db95c);}});});}function transcribe(_0x1fe90c,_0x549110,_0xfde47f,_0x38d4a4,_0x29fb9b,_0x5e6909,_0x2a149d){return new Promise(function(_0x2811f0,_0x194d8e){var _0x25ee85={};logger[_0x889a('0x64')](util[_0x889a('0x30')](_0x889a('0x70'),_0x1fe90c,_0x29fb9b));return uploadFile(_0x549110,_0xfde47f,_0x38d4a4,_0x29fb9b,path['basename'](_0x5e6909),fs[_0x889a('0x71')](_0x5e6909))[_0x889a('0x23')](function(_0x33df3c){logger[_0x889a('0x64')](util['format'](_0x889a('0x72'),_0x1fe90c,_0x29fb9b,_0x33df3c[_0x889a('0x73')]));_0x25ee85[_0x889a('0x74')]=_0x33df3c['Bucket'];_0x25ee85[_0x889a('0x75')]=_0x33df3c[_0x889a('0x73')];logger[_0x889a('0x64')](util[_0x889a('0x30')]('[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request',_0x1fe90c));return startTranscribe(_0x549110,_0xfde47f,_0x38d4a4,uuidv4(),_0x2a149d,_0x33df3c['Location']);})[_0x889a('0x23')](function(_0x2ab138){logger[_0x889a('0x64')](util['format'](_0x889a('0x76'),_0x1fe90c,_0x2ab138[_0x889a('0x77')][_0x889a('0x78')]));_0x25ee85[_0x889a('0x79')]=_0x2ab138[_0x889a('0x77')]['TranscriptionJobName'];_0x25ee85[_0x889a('0x7a')]=_0x2ab138[_0x889a('0x77')]['TranscriptionJobStatus'];return _0x2811f0(_0x25ee85);})[_0x889a('0x46')](function(_0x350f77){return _0x194d8e(_0x350f77);});});}exports[_0x889a('0x7b')]=function(_0x22deaf,_0x34edcd,_0x1ab12c){var _0x3d26ef;var _0x107053;var _0x16af5b;var _0x2483d9=require(_0x889a('0x5c'));return db[_0x889a('0x2c')][_0x889a('0x7c')]({'where':{'id':_0x22deaf[_0x889a('0x4e')]['id']}})[_0x889a('0x23')](function(_0xc3ff05){if(_0xc3ff05){var _0x55f87f=util[_0x889a('0x30')](_0x889a('0x50'),_0xc3ff05[_0x889a('0x4f')]);if(fs[_0x889a('0x51')](_0x55f87f)){cypher=!![];return _0x2483d9[_0x889a('0x52')](_0x55f87f,_0xc3ff05[_0x889a('0x4f')],config[_0x889a('0x53')][_0x889a('0x54')])['then'](function(){return _0xc3ff05;});}return _0xc3ff05;}})['then'](function(_0x375034){if(!_0x375034){throw new db['Sequelize']['ValidationError']('Voice\x20Recording\x20not\x20found');}_0x107053=_0x375034;return db[_0x889a('0x7d')][_0x889a('0x7c')]({'where':{'id':0x1}});})['then'](handleEntityNotFound(_0x34edcd,null))[_0x889a('0x23')](function(_0x536149){if(_0x536149){_0x3d26ef=_0x536149;if(!_0x3d26ef[_0x889a('0x7e')]||!_0x3d26ef[_0x889a('0x7f')]||!_0x3d26ef[_0x889a('0x80')]||!_0x3d26ef[_0x889a('0x81')]||!_0x3d26ef['bucket']){throw new db[(_0x889a('0x62'))][(_0x889a('0x55'))](_0x889a('0x82'));}if(_0x22deaf[_0x889a('0x4a')][_0x889a('0x83')]&&(!_0x3d26ef[_0x889a('0x84')]||!_0x3d26ef[_0x889a('0x85')]||!_0x3d26ef['sentimentRegion']||!_0x3d26ef['language']||!_0x3d26ef[_0x889a('0x74')])){throw new db[(_0x889a('0x62'))][(_0x889a('0x55'))](_0x889a('0x86'));}return db[_0x889a('0x87')][_0x889a('0x7c')]({'where':{'id':_0x3d26ef[_0x889a('0x7f')]}});}})[_0x889a('0x23')](function(_0xce1abb){if(!_0xce1abb){throw new db[(_0x889a('0x62'))][(_0x889a('0x55'))]('Cloud\x20Provider\x20not\x20available');}if(!_0xce1abb['data1']||!_0xce1abb['data2']){throw new db[(_0x889a('0x62'))][(_0x889a('0x55'))](_0x889a('0x88'));}_0x16af5b=_0xce1abb;return getBucketslist(_0x16af5b['data1'],_0x16af5b['data2'],_0x3d26ef[_0x889a('0x80')]);})[_0x889a('0x23')](function(_0xe5594c){if(_0xe5594c&&_0xe5594c['Buckets']){var _0x29625d=_[_0x889a('0x49')](_0xe5594c[_0x889a('0x89')],function(_0xfbaa5){return _0xfbaa5[_0x889a('0x8a')]===_0x3d26ef[_0x889a('0x74')];});if(!_0x29625d){logger[_0x889a('0x64')](util[_0x889a('0x30')](_0x889a('0x8b'),_0x22deaf[_0x889a('0x4e')]['id'],_0x3d26ef['bucket']));return createBucket(_0x16af5b[_0x889a('0x8c')],_0x16af5b[_0x889a('0x8d')],_0x3d26ef[_0x889a('0x80')],_0x3d26ef[_0x889a('0x74')]);}logger['info'](util[_0x889a('0x30')]('[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available',_0x22deaf['params']['id'],_0x3d26ef[_0x889a('0x74')]));return;}})[_0x889a('0x23')](function(_0x315d20){if(_0x107053[_0x889a('0x7a')]===_0x889a('0x8e')){return transcribe(_0x22deaf['params']['id'],_0x16af5b['data1'],_0x16af5b[_0x889a('0x8d')],_0x3d26ef[_0x889a('0x80')],_0x3d26ef[_0x889a('0x74')],_0x107053['value'],_0x3d26ef['language']);}else{logger['info'](util[_0x889a('0x30')]('[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested',_0x22deaf[_0x889a('0x4e')]['id']));return{'transcribeStatus':_0x889a('0x8f')};}})[_0x889a('0x23')](function(_0x243074){if(_0x243074){_0x243074[_0x889a('0x90')]=_0x22deaf[_0x889a('0x4a')][_0x889a('0x83')];return _0x107053['updateAttributes'](_0x243074);}})['then'](respondWithResult(_0x34edcd,null))[_0x889a('0x46')](handleError(_0x34edcd,null));};function writeFile(_0x392bf7,_0x471607){return new Promise(function(_0x6633c7,_0x5169cc){fs[_0x889a('0x91')](_0x471607,_0x392bf7,function(_0x49d345,_0x1f69b5){if(_0x49d345){return _0x5169cc(_0x49d345);}else{return _0x6633c7(_0x1f69b5);}});});}exports['downloadTranscribe']=function(_0x3dec72,_0x185776,_0x1ec8af){return db[_0x889a('0x2c')][_0x889a('0x7c')]({'where':{'id':_0x3dec72[_0x889a('0x4e')]['id']}})[_0x889a('0x23')](handleEntityNotFound(_0x185776))['then'](function(_0x4d2369){if(_0x4d2369&&_0x4d2369['fileText']){var _0x5ab82d=_0x4d2369[_0x889a('0x92')];var _0x37b0c9=config[_0x889a('0x93')]+_0x889a('0x94')+_0x4d2369['id']+'.txt';if(fs[_0x889a('0x51')](_0x37b0c9)){return _0x37b0c9;}return writeFile(_0x5ab82d,_0x37b0c9)['then'](function(){return _0x37b0c9;});}else{throw new db[(_0x889a('0x62'))][(_0x889a('0x55'))]('Transcript\x20not\x20available');}})[_0x889a('0x23')](function(_0x1acab2){return _0x185776['download'](_0x1acab2);})[_0x889a('0x46')](handleError(_0x185776));}; \ No newline at end of file +var _0x0469=['root','/server/files/transcribes/transcribe_','Transcript\x20not\x20available','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','aws-sdk','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','sendStatus','status','end','json','undefined','limit','offset','count','set','Content-Range','apply','reject','update','then','stack','name','send','map','VoiceRecording','rawAttributes','type','differenceBy','format','query','keys','intersection','attributes','fields','length','model','hasOwnProperty','nolimit','order','sort','filters','filter','merge','where','options','rows','catch','show','params','include','create','body','find','describe','download','../../components/encryptor','uniqueid','value','%s.cypher','existsSync','decryptFile','recording','Sequelize','ValidationError','VoiceRecording\x20not\x20found','filename','extname','unlink','Not\x20found','downloads','sequelize','MD5','col','$and','push','secrets','destroy','Entity\x20not\x20found','info','isNil','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','.cypher','File:\x20\x22','unlinkSync','listBuckets','createBucket','TranscribeService','basename','readFileSync','Bucket','location','[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request','Location','[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created','TranscriptionJob','TranscriptionJobName','transcribeName','transcribeStatus','TranscriptionJobStatus','runTranscribe','findOne','Voice\x20Recording\x20not\x20found','transcribeAccountId','transcribeRegion','bucket','Transcribe\x20not\x20configured','runSentiment','sentiment','sentimentAccountId','sentimentRegion','language','Sentiment\x20Analysis\x20not\x20configured','Cloud\x20Provider\x20not\x20available','data1','data2','Buckets','Name','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available','NEW','IN_PROGRESS','tempSentiment','writeFile','downloadTranscribe','fileText'];(function(_0x10cddc,_0x2a5e3b){var _0xc58788=function(_0x3ff031){while(--_0x3ff031){_0x10cddc['push'](_0x10cddc['shift']());}};_0xc58788(++_0x2a5e3b);}(_0x0469,0x12d));var _0x9046=function(_0x1e9497,_0x3697ab){_0x1e9497=_0x1e9497-0x0;var _0x28bc70=_0x0469[_0x1e9497];return _0x28bc70;};'use strict';var emlformat=require(_0x9046('0x0'));var rimraf=require(_0x9046('0x1'));var zipdir=require(_0x9046('0x2'));var jsonpatch=require(_0x9046('0x3'));var rp=require('request-promise');var moment=require(_0x9046('0x4'));var BPromise=require(_0x9046('0x5'));var Mustache=require(_0x9046('0x6'));var util=require(_0x9046('0x7'));var path=require(_0x9046('0x8'));var sox=require(_0x9046('0x9'));var csv=require(_0x9046('0xa'));var ejs=require(_0x9046('0xb'));var fs=require('fs');var fs_extra=require(_0x9046('0xc'));var _=require(_0x9046('0xd'));var squel=require('squel');var crypto=require(_0x9046('0xe'));var jsforce=require(_0x9046('0xf'));var deskjs=require(_0x9046('0x10'));var toCsv=require(_0x9046('0xa'));var querystring=require(_0x9046('0x11'));var Papa=require('papaparse');var AWS=require(_0x9046('0x12'));var uuidv4=require('uuid/v4');var Redis=require(_0x9046('0x13'));var authService=require(_0x9046('0x14'));var qs=require(_0x9046('0x15'));var as=require(_0x9046('0x16'));var hardwareService=require(_0x9046('0x17'));var logger=require(_0x9046('0x18'))(_0x9046('0x19'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x9046('0x1a'))['db'];function respondWithStatusCode(_0x12cd80,_0x2451b3){_0x2451b3=_0x2451b3||0xcc;return function(_0x41c5cc){if(_0x41c5cc){return _0x12cd80[_0x9046('0x1b')](_0x2451b3);}return _0x12cd80[_0x9046('0x1c')](_0x2451b3)[_0x9046('0x1d')]();};}function respondWithResult(_0x5cd8d9,_0x2131f5){_0x2131f5=_0x2131f5||0xc8;return function(_0x3a94a9){if(_0x3a94a9){return _0x5cd8d9[_0x9046('0x1c')](_0x2131f5)[_0x9046('0x1e')](_0x3a94a9);}};}function respondWithFilteredResult(_0x3133c3,_0x197298){return function(_0x30186f){if(_0x30186f){var _0x329675=typeof _0x197298['offset']===_0x9046('0x1f')&&typeof _0x197298[_0x9046('0x20')]===_0x9046('0x1f');var _0x5365de=_0x30186f['count'];var _0x681c49=_0x329675?0x0:_0x197298[_0x9046('0x21')];var _0x36774d=_0x329675?_0x30186f[_0x9046('0x22')]:_0x197298['offset']+_0x197298['limit'];var _0x587ddb;if(_0x36774d>=_0x5365de){_0x36774d=_0x5365de;_0x587ddb=0xc8;}else{_0x587ddb=0xce;}_0x3133c3[_0x9046('0x1c')](_0x587ddb);return _0x3133c3[_0x9046('0x23')](_0x9046('0x24'),_0x681c49+'-'+_0x36774d+'/'+_0x5365de)['json'](_0x30186f);}return null;};}function patchUpdates(_0x1b5c6c){return function(_0x4de715){try{jsonpatch[_0x9046('0x25')](_0x4de715,_0x1b5c6c,!![]);}catch(_0x5d4b4f){return BPromise[_0x9046('0x26')](_0x5d4b4f);}return _0x4de715['save']();};}function saveUpdates(_0x42a792,_0x3bbf6b){return function(_0x2f8ff6){if(_0x2f8ff6){return _0x2f8ff6[_0x9046('0x27')](_0x42a792)[_0x9046('0x28')](function(_0x2ccd05){return _0x2ccd05;});}return null;};}function removeEntity(_0x175945,_0xc0ba00){return function(_0x27a5f9){if(_0x27a5f9){return _0x27a5f9['destroy']()[_0x9046('0x28')](function(){_0x175945[_0x9046('0x1c')](0xcc)[_0x9046('0x1d')]();});}};}function handleEntityNotFound(_0x369e54,_0x360d16){return function(_0x3fa867){if(!_0x3fa867){_0x369e54[_0x9046('0x1b')](0x194);}return _0x3fa867;};}function handleError(_0x177489,_0x3880cd){_0x3880cd=_0x3880cd||0x1f4;return function(_0x1a273a){logger['error'](_0x1a273a[_0x9046('0x29')]);if(_0x1a273a[_0x9046('0x2a')]){delete _0x1a273a[_0x9046('0x2a')];}_0x177489[_0x9046('0x1c')](_0x3880cd)[_0x9046('0x2b')](_0x1a273a);};}exports['index']=function(_0x4741b5,_0x456293){var _0x1afb69={},_0x20a257={},_0x765764={'count':0x0,'rows':[]};var _0x28ba7f=_[_0x9046('0x2c')](db[_0x9046('0x2d')][_0x9046('0x2e')],function(_0x4e1928){return{'name':_0x4e1928['fieldName'],'type':_0x4e1928[_0x9046('0x2f')]['key']};});_0x20a257['model']=_[_0x9046('0x30')](_['map'](_0x28ba7f,_0x9046('0x2a')),[_0x9046('0x31')]);_0x20a257[_0x9046('0x32')]=_[_0x9046('0x33')](_0x4741b5['query']);_0x20a257['filters']=_[_0x9046('0x34')](_0x20a257['model'],_0x20a257[_0x9046('0x32')]);_0x1afb69[_0x9046('0x35')]=_[_0x9046('0x34')](_0x20a257['model'],qs[_0x9046('0x36')](_0x4741b5[_0x9046('0x32')]['fields']));_0x1afb69['attributes']=_0x1afb69['attributes'][_0x9046('0x37')]?_0x1afb69[_0x9046('0x35')]:_0x20a257[_0x9046('0x38')];if(!_0x4741b5[_0x9046('0x32')][_0x9046('0x39')](_0x9046('0x3a'))){_0x1afb69['limit']=qs[_0x9046('0x20')](_0x4741b5[_0x9046('0x32')][_0x9046('0x20')]);_0x1afb69['offset']=qs[_0x9046('0x21')](_0x4741b5[_0x9046('0x32')][_0x9046('0x21')]);}_0x1afb69[_0x9046('0x3b')]=qs[_0x9046('0x3c')](_0x4741b5[_0x9046('0x32')][_0x9046('0x3c')]);_0x1afb69['where']=qs[_0x9046('0x3d')](_['pick'](_0x4741b5[_0x9046('0x32')],_0x20a257[_0x9046('0x3d')]),_0x28ba7f);if(_0x4741b5[_0x9046('0x32')][_0x9046('0x3e')]){_0x1afb69['where']=_[_0x9046('0x3f')](_0x1afb69[_0x9046('0x40')],{'$or':_[_0x9046('0x2c')](_0x28ba7f,function(_0xd65058){if(_0xd65058[_0x9046('0x2f')]!=='VIRTUAL'){var _0x54d51e={};_0x54d51e[_0xd65058['name']]={'$like':'%'+_0x4741b5[_0x9046('0x32')][_0x9046('0x3e')]+'%'};return _0x54d51e;}})});}_0x1afb69=_[_0x9046('0x3f')]({},_0x1afb69,_0x4741b5[_0x9046('0x41')]);var _0x1bcd3a={'where':_0x1afb69[_0x9046('0x40')]};return db[_0x9046('0x2d')][_0x9046('0x22')](_0x1bcd3a)[_0x9046('0x28')](function(_0x413344){_0x765764['count']=_0x413344;if(_0x4741b5['query']['includeAll']){_0x1afb69['include']=[{'all':!![]}];}return db[_0x9046('0x2d')]['findAll'](_0x1afb69);})[_0x9046('0x28')](function(_0x1bc011){_0x765764[_0x9046('0x42')]=_0x1bc011;return _0x765764;})['then'](respondWithFilteredResult(_0x456293,_0x1afb69))[_0x9046('0x43')](handleError(_0x456293,null));};exports[_0x9046('0x44')]=function(_0x3cc827,_0x38b9aa){var _0x2d9f18={'raw':![],'where':{'id':_0x3cc827[_0x9046('0x45')]['id']}},_0x612e2b={};_0x612e2b[_0x9046('0x38')]=_[_0x9046('0x33')](db[_0x9046('0x2d')][_0x9046('0x2e')]);_0x612e2b[_0x9046('0x32')]=_['keys'](_0x3cc827['query']);_0x612e2b[_0x9046('0x3d')]=_[_0x9046('0x34')](_0x612e2b[_0x9046('0x38')],_0x612e2b[_0x9046('0x32')]);_0x2d9f18['attributes']=_[_0x9046('0x34')](_0x612e2b[_0x9046('0x38')],qs[_0x9046('0x36')](_0x3cc827[_0x9046('0x32')][_0x9046('0x36')]));_0x2d9f18['attributes']=_0x2d9f18[_0x9046('0x35')]['length']?_0x2d9f18[_0x9046('0x35')]:_0x612e2b[_0x9046('0x38')];if(_0x3cc827['query']['includeAll']){_0x2d9f18[_0x9046('0x46')]=[{'all':!![]}];}_0x2d9f18=_[_0x9046('0x3f')]({},_0x2d9f18,_0x3cc827[_0x9046('0x41')]);return db['VoiceRecording']['find'](_0x2d9f18)[_0x9046('0x28')](handleEntityNotFound(_0x38b9aa,null))[_0x9046('0x28')](respondWithResult(_0x38b9aa,null))[_0x9046('0x43')](handleError(_0x38b9aa,null));};exports[_0x9046('0x47')]=function(_0x2ddf57,_0x592fb3){return db[_0x9046('0x2d')]['create'](_0x2ddf57[_0x9046('0x48')],{})[_0x9046('0x28')](respondWithResult(_0x592fb3,0xc9))['catch'](handleError(_0x592fb3,null));};exports[_0x9046('0x27')]=function(_0x3c3117,_0x21df32){if(_0x3c3117[_0x9046('0x48')]['id']){delete _0x3c3117[_0x9046('0x48')]['id'];}return db['VoiceRecording'][_0x9046('0x49')]({'where':{'id':_0x3c3117['params']['id']}})['then'](handleEntityNotFound(_0x21df32,null))[_0x9046('0x28')](saveUpdates(_0x3c3117['body'],null))[_0x9046('0x28')](respondWithResult(_0x21df32,null))[_0x9046('0x43')](handleError(_0x21df32,null));};exports['describe']=function(_0x1311e5,_0x4e4571){return db[_0x9046('0x2d')][_0x9046('0x4a')]()[_0x9046('0x28')](respondWithResult(_0x4e4571,null))['catch'](handleError(_0x4e4571,null));};exports[_0x9046('0x4b')]=function(_0x1524a6,_0x2c27e8,_0x4b66a4){var _0x32b654=require(_0x9046('0x4c'));var _0x519cd5=![];var _0x5b4ecf={};if(_0x1524a6[_0x9046('0x32')][_0x9046('0x2f')]&&_0x1524a6[_0x9046('0x32')][_0x9046('0x2f')]===_0x9046('0x4d')){_0x5b4ecf[_0x9046('0x4d')]=_0x1524a6[_0x9046('0x45')]['id'];}else{_0x5b4ecf['id']=_0x1524a6[_0x9046('0x45')]['id'];}return db[_0x9046('0x2d')][_0x9046('0x49')]({'where':_0x5b4ecf,'attributes':['id','value'],'raw':!![]})[_0x9046('0x28')](handleEntityNotFound(_0x2c27e8,null))[_0x9046('0x28')](function(_0x2b9586){if(_0x2b9586){var _0x5bc260=_0x2b9586[_0x9046('0x4e')];var _0x336d9f=util['format'](_0x9046('0x4f'),_0x5bc260);if(fs[_0x9046('0x50')](_0x336d9f)){_0x519cd5=!![];return _0x32b654[_0x9046('0x51')](_0x336d9f,_0x5bc260,config['secrets'][_0x9046('0x52')])[_0x9046('0x28')](function(){return _0x2b9586;});}return _0x2b9586;}})[_0x9046('0x28')](function(_0x1f8304){if(_0x1f8304){var _0x5b70e0=_0x1f8304[_0x9046('0x4e')];if(!fs[_0x9046('0x50')](_0x5b70e0)){throw new db[(_0x9046('0x53'))][(_0x9046('0x54'))](_0x9046('0x55'));}if(_0x1f8304['filename']){return _0x2c27e8[_0x9046('0x4b')](_0x5b70e0,_0x1f8304[_0x9046('0x56')]+path[_0x9046('0x57')](_0x5b70e0),function(){if(_0x519cd5){fs[_0x9046('0x58')](_0x5b70e0);}});}else{return _0x2c27e8[_0x9046('0x4b')](_0x5b70e0,function(_0x1c082c){if(_0x519cd5){fs[_0x9046('0x58')](_0x5b70e0);}});}}})[_0x9046('0x43')](function(_0x226f09){if(_0x226f09['message']==='VoiceRecording\x20not\x20found'){_0x2c27e8[_0x9046('0x1c')](0x194)[_0x9046('0x2b')](_0x9046('0x59'));}else{return handleError(_0x2c27e8,null);}});};exports[_0x9046('0x5a')]=function(_0x32e54d,_0x402014,_0xce6cce){var _0x13eec8=require(_0x9046('0x4c'));var _0x21da60=![];var _0x5aea22={'$and':[db[_0x9046('0x5b')]['where'](db[_0x9046('0x5b')]['fn'](_0x9046('0x5c'),db['sequelize'][_0x9046('0x5d')]('uniqueid')),_0x32e54d[_0x9046('0x32')]['token'])]};if(_0x32e54d['query'][_0x9046('0x2f')]&&_0x32e54d[_0x9046('0x32')][_0x9046('0x2f')]===_0x9046('0x4d')){_0x5aea22['$and']['push']({'uniqueid':_0x32e54d[_0x9046('0x45')]['id']});}else{_0x5aea22[_0x9046('0x5e')][_0x9046('0x5f')]({'id':_0x32e54d[_0x9046('0x45')]['id']});}return db[_0x9046('0x2d')]['find']({'where':_0x5aea22,'attributes':['id','value'],'raw':!![]})[_0x9046('0x28')](handleEntityNotFound(_0x402014,null))[_0x9046('0x28')](function(_0x5db031){if(_0x5db031){var _0x7d5bb2=util[_0x9046('0x31')](_0x9046('0x4f'),_0x5db031[_0x9046('0x4e')]);if(fs['existsSync'](_0x7d5bb2)){_0x21da60=!![];return _0x13eec8[_0x9046('0x51')](_0x7d5bb2,_0x5db031[_0x9046('0x4e')],config[_0x9046('0x60')][_0x9046('0x52')])['then'](function(){return _0x5db031;});}return _0x5db031;}})[_0x9046('0x28')](function(_0x13460a){if(_0x13460a){if(!fs[_0x9046('0x50')](_0x13460a[_0x9046('0x4e')])){throw new db[(_0x9046('0x53'))][(_0x9046('0x54'))]('VoiceRecording\x20not\x20found');}if(_0x13460a['filename']){return _0x402014[_0x9046('0x4b')](_0x13460a[_0x9046('0x4e')],_0x13460a[_0x9046('0x56')]+path['extname'](_0x13460a[_0x9046('0x4e')]),function(){if(_0x21da60){fs[_0x9046('0x58')](_0x13460a[_0x9046('0x4e')]);}});}else{return _0x402014[_0x9046('0x4b')](_0x13460a[_0x9046('0x4e')],function(_0x43999c){if(_0x21da60){fs[_0x9046('0x58')](_0x13460a[_0x9046('0x4e')]);}});}}})[_0x9046('0x43')](handleError(_0x402014,null));};exports[_0x9046('0x61')]=function(_0x2884ba,_0x5dda6a){return db[_0x9046('0x2d')][_0x9046('0x49')]({'where':{'id':_0x2884ba['params']['id']}})[_0x9046('0x28')](function(_0x51bcde){if(_['isNil'](_0x51bcde)){throw new ReferenceError(_0x9046('0x62'));}return _0x51bcde;})[_0x9046('0x28')](function(_0x4c118e){var _0x42e4bc=_0x4c118e[_0x9046('0x4e')];logger[_0x9046('0x63')]('cancellazione\x20fisica\x20documento\x20%s',_0x42e4bc);if(!_[_0x9046('0x64')](_0x4c118e[_0x9046('0x4e')])&&fs[_0x9046('0x50')](_0x42e4bc)){logger[_0x9046('0x63')]('File:\x20\x22'+_0x42e4bc+_0x9046('0x65'));fs['unlinkSync'](_0x42e4bc);}_0x42e4bc=_0x42e4bc+_0x9046('0x66');if(!_[_0x9046('0x64')](_0x4c118e[_0x9046('0x4e')])&&fs[_0x9046('0x50')](_0x42e4bc)){logger[_0x9046('0x63')](_0x9046('0x67')+_0x42e4bc+_0x9046('0x65'));fs[_0x9046('0x68')](_0x42e4bc);}return _0x4c118e;})['then'](function(_0x3eed63){if(!_0x3eed63)throw new InternalError();return _0x3eed63[_0x9046('0x61')]();})[_0x9046('0x28')](function(){_0x5dda6a[_0x9046('0x1c')](0xcc)[_0x9046('0x1d')]();})[_0x9046('0x43')](handleError(_0x5dda6a,null));};function getBucketslist(_0x9d9cbd,_0x2596d5,_0x1ccb57){return new Promise(function(_0x10647c,_0x47ea0b){var _0x1c8547=new AWS['S3']({'accessKeyId':_0x2596d5,'secretAccessKey':_0x9d9cbd,'region':_0x1ccb57});_0x1c8547[_0x9046('0x69')]({},function(_0x42b940,_0x4cda93){if(_0x42b940){return _0x47ea0b(_0x42b940);}else{return _0x10647c(_0x4cda93);}});});}function createBucket(_0x45a4fb,_0x1fb89b,_0x5a4434,_0x2aa8f1){return new Promise(function(_0xbfcaaa,_0xd3b63c){var _0x30f8e5=new AWS['S3']({'accessKeyId':_0x1fb89b,'secretAccessKey':_0x45a4fb,'region':_0x5a4434});_0x30f8e5[_0x9046('0x6a')]({'Bucket':_0x2aa8f1},function(_0x1c17f5,_0xf1af44){if(_0x1c17f5){return _0xd3b63c(_0x1c17f5);}else{return _0xbfcaaa(_0xf1af44);}});});}function uploadFile(_0x3ff2c5,_0x3b869f,_0x516bb2,_0x7230e4,_0xddf717,_0x4397de){return new Promise(function(_0x240717,_0x8daa89){var _0x4265be=new AWS['S3']({'accessKeyId':_0x3b869f,'secretAccessKey':_0x3ff2c5,'region':_0x516bb2});_0x4265be['upload']({'Bucket':_0x7230e4,'Key':_0xddf717,'Body':_0x4397de},function(_0x2ac189,_0x2b2724){if(_0x2ac189){return _0x8daa89(_0x2ac189);}else{return _0x240717(_0x2b2724);}});});}function startTranscribe(_0x110514,_0x1629bc,_0x5b41e3,_0x1b0e55,_0x275ca5,_0x3f61f4){return new Promise(function(_0x4a1a8a,_0x493dda){var _0x1ebcb2=new AWS[(_0x9046('0x6b'))]({'accessKeyId':_0x1629bc,'secretAccessKey':_0x110514,'region':_0x5b41e3});_0x1ebcb2['startTranscriptionJob']({'TranscriptionJobName':_0x1b0e55,'LanguageCode':_0x275ca5,'Media':{'MediaFileUri':_0x3f61f4}},function(_0x54a5f3,_0x35fbfe){if(_0x54a5f3){return _0x493dda(_0x54a5f3);}else{return _0x4a1a8a(_0x35fbfe);}});});}function transcribe(_0x422c0e,_0x46dc31,_0x2d7a4c,_0x31ce10,_0x2232ea,_0x29cb17,_0x2bed49){return new Promise(function(_0x7ae33b,_0x490e86){var _0x46b589={};logger[_0x9046('0x63')](util[_0x9046('0x31')]('[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s',_0x422c0e,_0x2232ea));return uploadFile(_0x46dc31,_0x2d7a4c,_0x31ce10,_0x2232ea,path[_0x9046('0x6c')](_0x29cb17),fs[_0x9046('0x6d')](_0x29cb17))[_0x9046('0x28')](function(_0x3a1752){logger['info'](util[_0x9046('0x31')]('[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)',_0x422c0e,_0x2232ea,_0x3a1752['Location']));_0x46b589['bucket']=_0x3a1752[_0x9046('0x6e')];_0x46b589[_0x9046('0x6f')]=_0x3a1752['Location'];logger[_0x9046('0x63')](util[_0x9046('0x31')](_0x9046('0x70'),_0x422c0e));return startTranscribe(_0x46dc31,_0x2d7a4c,_0x31ce10,uuidv4(),_0x2bed49,_0x3a1752[_0x9046('0x71')]);})[_0x9046('0x28')](function(_0x42a25e){logger[_0x9046('0x63')](util['format'](_0x9046('0x72'),_0x422c0e,_0x42a25e[_0x9046('0x73')][_0x9046('0x74')]));_0x46b589[_0x9046('0x75')]=_0x42a25e[_0x9046('0x73')][_0x9046('0x74')];_0x46b589[_0x9046('0x76')]=_0x42a25e[_0x9046('0x73')][_0x9046('0x77')];return _0x7ae33b(_0x46b589);})[_0x9046('0x43')](function(_0x4c0fdd){return _0x490e86(_0x4c0fdd);});});}exports[_0x9046('0x78')]=function(_0x20c750,_0x3c520b,_0x249b52){var _0x31e410;var _0x513735;var _0x1000ce;var _0x5cb28c=require('../../components/encryptor');return db[_0x9046('0x2d')][_0x9046('0x79')]({'where':{'id':_0x20c750[_0x9046('0x45')]['id']}})['then'](function(_0x3b64e1){if(_0x3b64e1){var _0x64dba1=util[_0x9046('0x31')](_0x9046('0x4f'),_0x3b64e1[_0x9046('0x4e')]);if(fs[_0x9046('0x50')](_0x64dba1)){cypher=!![];return _0x5cb28c[_0x9046('0x51')](_0x64dba1,_0x3b64e1[_0x9046('0x4e')],config[_0x9046('0x60')][_0x9046('0x52')])[_0x9046('0x28')](function(){return _0x3b64e1;});}return _0x3b64e1;}})['then'](function(_0xfc1e00){if(!_0xfc1e00){throw new db[(_0x9046('0x53'))][(_0x9046('0x54'))](_0x9046('0x7a'));}_0x513735=_0xfc1e00;return db['Setting'][_0x9046('0x79')]({'where':{'id':0x1}});})[_0x9046('0x28')](handleEntityNotFound(_0x3c520b,null))['then'](function(_0x3c8027){if(_0x3c8027){_0x31e410=_0x3c8027;if(!_0x31e410['transcribe']||!_0x31e410[_0x9046('0x7b')]||!_0x31e410[_0x9046('0x7c')]||!_0x31e410['language']||!_0x31e410[_0x9046('0x7d')]){throw new db[(_0x9046('0x53'))][(_0x9046('0x54'))](_0x9046('0x7e'));}if(_0x20c750[_0x9046('0x48')][_0x9046('0x7f')]&&(!_0x31e410[_0x9046('0x80')]||!_0x31e410[_0x9046('0x81')]||!_0x31e410[_0x9046('0x82')]||!_0x31e410[_0x9046('0x83')]||!_0x31e410['bucket'])){throw new db['Sequelize'][(_0x9046('0x54'))](_0x9046('0x84'));}return db['CloudProvider'][_0x9046('0x79')]({'where':{'id':_0x31e410[_0x9046('0x7b')]}});}})[_0x9046('0x28')](function(_0x5450e8){if(!_0x5450e8){throw new db[(_0x9046('0x53'))][(_0x9046('0x54'))](_0x9046('0x85'));}if(!_0x5450e8[_0x9046('0x86')]||!_0x5450e8[_0x9046('0x87')]){throw new db[(_0x9046('0x53'))][(_0x9046('0x54'))]('Cloud\x20Provider\x20not\x20configured');}_0x1000ce=_0x5450e8;return getBucketslist(_0x1000ce[_0x9046('0x86')],_0x1000ce[_0x9046('0x87')],_0x31e410[_0x9046('0x7c')]);})[_0x9046('0x28')](function(_0x4f799d){if(_0x4f799d&&_0x4f799d['Buckets']){var _0x581282=_[_0x9046('0x49')](_0x4f799d[_0x9046('0x88')],function(_0x1010a6){return _0x1010a6[_0x9046('0x89')]===_0x31e410['bucket'];});if(!_0x581282){logger[_0x9046('0x63')](util[_0x9046('0x31')](_0x9046('0x8a'),_0x20c750[_0x9046('0x45')]['id'],_0x31e410['bucket']));return createBucket(_0x1000ce[_0x9046('0x86')],_0x1000ce['data2'],_0x31e410[_0x9046('0x7c')],_0x31e410[_0x9046('0x7d')]);}logger[_0x9046('0x63')](util[_0x9046('0x31')](_0x9046('0x8b'),_0x20c750['params']['id'],_0x31e410[_0x9046('0x7d')]));return;}})[_0x9046('0x28')](function(_0x16180b){if(_0x513735['transcribeStatus']===_0x9046('0x8c')){return transcribe(_0x20c750['params']['id'],_0x1000ce['data1'],_0x1000ce['data2'],_0x31e410[_0x9046('0x7c')],_0x31e410[_0x9046('0x7d')],_0x513735[_0x9046('0x4e')],_0x31e410[_0x9046('0x83')]);}else{logger[_0x9046('0x63')](util[_0x9046('0x31')]('[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested',_0x20c750['params']['id']));return{'transcribeStatus':_0x9046('0x8d')};}})[_0x9046('0x28')](function(_0x1795d9){if(_0x1795d9){_0x1795d9[_0x9046('0x8e')]=_0x20c750[_0x9046('0x48')]['runSentiment'];return _0x513735['updateAttributes'](_0x1795d9);}})[_0x9046('0x28')](respondWithResult(_0x3c520b,null))[_0x9046('0x43')](handleError(_0x3c520b,null));};function writeFile(_0x5b7fa0,_0x435aac){return new Promise(function(_0x1bd245,_0xd85462){fs[_0x9046('0x8f')](_0x435aac,_0x5b7fa0,function(_0x4ea785,_0x6124b0){if(_0x4ea785){return _0xd85462(_0x4ea785);}else{return _0x1bd245(_0x6124b0);}});});}exports[_0x9046('0x90')]=function(_0x5b70c,_0x1d796b,_0x9eec62){return db['VoiceRecording']['findOne']({'where':{'id':_0x5b70c[_0x9046('0x45')]['id']}})[_0x9046('0x28')](handleEntityNotFound(_0x1d796b))[_0x9046('0x28')](function(_0x1f29d7){if(_0x1f29d7&&_0x1f29d7[_0x9046('0x91')]){var _0x2cbf15=_0x1f29d7[_0x9046('0x91')];var _0x359836=config[_0x9046('0x92')]+_0x9046('0x93')+_0x1f29d7['id']+'.txt';if(fs[_0x9046('0x50')](_0x359836)){return _0x359836;}return writeFile(_0x2cbf15,_0x359836)[_0x9046('0x28')](function(){return _0x359836;});}else{throw new db[(_0x9046('0x53'))][(_0x9046('0x54'))](_0x9046('0x94'));}})[_0x9046('0x28')](function(_0x2eecc9){return _0x1d796b[_0x9046('0x4b')](_0x2eecc9);})[_0x9046('0x43')](handleError(_0x1d796b));}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.model.js b/server/api/voiceRecording/voiceRecording.model.js index 7298410..6ccbec5 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 _0xcc8d=['uniqueid','transcribeStatus','exports','VoiceRecording','voice_recordings'];(function(_0x2469ae,_0x315025){var _0x59b683=function(_0x3e6b81){while(--_0x3e6b81){_0x2469ae['push'](_0x2469ae['shift']());}};_0x59b683(++_0x315025);}(_0xcc8d,0xbb));var _0xdcc8=function(_0x79cd47,_0x16102d){_0x79cd47=_0x79cd47-0x0;var _0x3b9484=_0xcc8d[_0x79cd47];return _0x3b9484;};'use strict';var attributes=require('./voiceRecording.attributes');module[_0xdcc8('0x0')]=function(_0x14f011,_0x54464b){return _0x14f011['define'](_0xdcc8('0x1'),attributes,{'tableName':_0xdcc8('0x2'),'paranoid':![],'indexes':[{'name':_0xdcc8('0x3'),'fields':[_0xdcc8('0x3')]},{'name':_0xdcc8('0x4'),'fields':[_0xdcc8('0x4')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x765b=['VoiceRecording','uniqueid','transcribeStatus'];(function(_0xe5c2c0,_0x4edb52){var _0x1c38d7=function(_0x56507f){while(--_0x56507f){_0xe5c2c0['push'](_0xe5c2c0['shift']());}};_0x1c38d7(++_0x4edb52);}(_0x765b,0x18c));var _0xb765=function(_0x5090d4,_0x1950a7){_0x5090d4=_0x5090d4-0x0;var _0x56c310=_0x765b[_0x5090d4];return _0x56c310;};'use strict';var attributes=require('./voiceRecording.attributes');module['exports']=function(_0x49c5f5,_0x14e5bd){return _0x49c5f5['define'](_0xb765('0x0'),attributes,{'tableName':'voice_recordings','paranoid':![],'indexes':[{'name':_0xb765('0x1'),'fields':[_0xb765('0x1')]},{'name':_0xb765('0x2'),'fields':['transcribeStatus']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.rpc.js b/server/api/voiceRecording/voiceRecording.rpc.js index ed74ab4..e623893 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 _0xfb11=['update','body','options','where','attributes','debug','../../components/encryptor','Setting','findOne','callRecordingEncryption','create','existsSync','value','format','%s.cypher','encryptFile','recording','CreateVoiceRecording\x20file\x20encrypted','CreateVoiceRecording','lodash','moment','bluebird','ioredis','../../config/utils','rpc','../../config/environment','client','http','request','then','info','VoiceRecording,\x20%s,\x20%s','request\x20sent','VoiceRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','UpdateVoiceRecording','VoiceRecording'];(function(_0x53ccf2,_0x13cb67){var _0x5a2964=function(_0x3b0514){while(--_0x3b0514){_0x53ccf2['push'](_0x53ccf2['shift']());}};_0x5a2964(++_0x13cb67);}(_0xfb11,0x1ad));var _0x1fb1=function(_0x4c7fb5,_0x2548ef){_0x4c7fb5=_0x4c7fb5-0x0;var _0x2e10ac=_0xfb11[_0x4c7fb5];return _0x2e10ac;};'use strict';var _=require(_0x1fb1('0x0'));var util=require('util');var moment=require(_0x1fb1('0x1'));var BPromise=require(_0x1fb1('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1fb1('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x1fb1('0x4'));var logger=require('../../config/logger')(_0x1fb1('0x5'));var config=require(_0x1fb1('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x1fb1('0x7')][_0x1fb1('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4c098d,_0x1859da,_0x2596c2){return new BPromise(function(_0x34e61a,_0x236b20){return client[_0x1fb1('0x9')](_0x4c098d,_0x2596c2)[_0x1fb1('0xa')](function(_0x438d15){logger[_0x1fb1('0xb')](_0x1fb1('0xc'),_0x1859da,_0x1fb1('0xd'));logger['debug'](_0x1fb1('0xe'),_0x1859da,'request\x20sent',JSON[_0x1fb1('0xf')](_0x438d15));if(_0x438d15['error']){if(_0x438d15[_0x1fb1('0x10')][_0x1fb1('0x11')]===0x1f4){logger[_0x1fb1('0x10')](_0x1fb1('0xc'),_0x1859da,_0x438d15[_0x1fb1('0x10')][_0x1fb1('0x12')]);return _0x236b20(_0x438d15['error'][_0x1fb1('0x12')]);}logger[_0x1fb1('0x10')](_0x1fb1('0xc'),_0x1859da,_0x438d15[_0x1fb1('0x10')][_0x1fb1('0x12')]);return _0x34e61a(_0x438d15[_0x1fb1('0x10')][_0x1fb1('0x12')]);}else{logger[_0x1fb1('0xb')](_0x1fb1('0xc'),_0x1859da,'request\x20sent');_0x34e61a(_0x438d15['result'][_0x1fb1('0x12')]);}})[_0x1fb1('0x13')](function(_0x3924ab){logger['error'](_0x1fb1('0xc'),_0x1859da,_0x3924ab);_0x236b20(_0x3924ab);});});}exports[_0x1fb1('0x14')]=function(_0x24d4df){var _0x34076b=this;return new Promise(function(_0x33c6b6,_0x27d71f){return db[_0x1fb1('0x15')][_0x1fb1('0x16')](_0x24d4df[_0x1fb1('0x17')],{'raw':_0x24d4df['options']?_0x24d4df[_0x1fb1('0x18')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x24d4df['options']?_0x24d4df[_0x1fb1('0x18')][_0x1fb1('0x19')]||null:null,'attributes':_0x24d4df[_0x1fb1('0x18')]?_0x24d4df['options'][_0x1fb1('0x1a')]||null:null,'limit':_0x24d4df['options']?_0x24d4df['options']['limit']||null:null})[_0x1fb1('0xa')](function(_0x1f8e5a){logger[_0x1fb1('0xb')](_0x1fb1('0x14'),_0x24d4df);logger[_0x1fb1('0x1b')]('UpdateVoiceRecording',_0x24d4df,JSON[_0x1fb1('0xf')](_0x1f8e5a));_0x33c6b6(_0x1f8e5a);})[_0x1fb1('0x13')](function(_0x1dc03f){logger[_0x1fb1('0x10')](_0x1fb1('0x14'),_0x1dc03f[_0x1fb1('0x12')],_0x24d4df);_0x27d71f(_0x34076b[_0x1fb1('0x10')](0x1f4,_0x1dc03f[_0x1fb1('0x12')]));});});};exports['CreateVoiceRecording']=function(_0x1b25b3){var _0x1aac7d=this;return new Promise(function(_0x46ff60,_0xc5188b){var _0x1898e7=require(_0x1fb1('0x1c'));var _0x1a74c4;return db[_0x1fb1('0x1d')][_0x1fb1('0x1e')]({'attributes':['id',_0x1fb1('0x1f')],'where':{'id':0x1},'raw':!![]})[_0x1fb1('0xa')](function(_0x497017){_0x1a74c4=_0x497017;return db[_0x1fb1('0x15')][_0x1fb1('0x20')](_0x1b25b3[_0x1fb1('0x17')]);})['then'](function(_0x106134){if(_0x1a74c4[_0x1fb1('0x1f')]&&fs[_0x1fb1('0x21')](_0x106134[_0x1fb1('0x22')])){var _0x5402e9=util[_0x1fb1('0x23')](_0x1fb1('0x24'),_0x106134['value']);return _0x1898e7[_0x1fb1('0x25')](_0x106134['value'],_0x5402e9,config['secrets'][_0x1fb1('0x26')])[_0x1fb1('0xa')](function(){fs['unlink'](_0x106134[_0x1fb1('0x22')]);logger[_0x1fb1('0xb')](_0x1fb1('0x27'));return _0x106134;});}return _0x106134;})[_0x1fb1('0xa')](function(_0x32d797){logger['info'](_0x1fb1('0x28'),_0x1b25b3);logger[_0x1fb1('0x1b')](_0x1fb1('0x28'),_0x1b25b3,JSON[_0x1fb1('0xf')](_0x32d797));_0x46ff60(_0x32d797);})[_0x1fb1('0x13')](function(_0x307700){logger[_0x1fb1('0x10')](_0x1fb1('0x28'),_0x307700[_0x1fb1('0x12')],_0x1b25b3);_0xc5188b(_0x1aac7d['error'](0x1f4,_0x307700[_0x1fb1('0x12')]));});});}; \ No newline at end of file +var _0xbbbc=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','debug','request\x20sent','error','message','result','catch','UpdateVoiceRecording','update','body','options','raw','where','limit','CreateVoiceRecording','Setting','findOne','callRecordingEncryption','VoiceRecording','create','existsSync','value','format','%s.cypher','secrets','CreateVoiceRecording\x20file\x20encrypted','stringify'];(function(_0x4d5c36,_0x2250da){var _0x5e74bd=function(_0x276403){while(--_0x276403){_0x4d5c36['push'](_0x4d5c36['shift']());}};_0x5e74bd(++_0x2250da);}(_0xbbbc,0xf6));var _0xcbbb=function(_0x4a33ca,_0x54bf02){_0x4a33ca=_0x4a33ca-0x0;var _0x394f13=_0xbbbc[_0x4a33ca];return _0x394f13;};'use strict';var _=require(_0xcbbb('0x0'));var util=require(_0xcbbb('0x1'));var moment=require(_0xcbbb('0x2'));var BPromise=require(_0xcbbb('0x3'));var rs=require(_0xcbbb('0x4'));var fs=require('fs');var Redis=require(_0xcbbb('0x5'));var db=require(_0xcbbb('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xcbbb('0x7'))(_0xcbbb('0x8'));var config=require(_0xcbbb('0x9'));var jayson=require(_0xcbbb('0xa'));var client=jayson[_0xcbbb('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x388197,_0x1796b4,_0x32ec9c){return new BPromise(function(_0x6f4fd8,_0x356249){return client[_0xcbbb('0xc')](_0x388197,_0x32ec9c)[_0xcbbb('0xd')](function(_0x4ec90a){logger[_0xcbbb('0xe')]('VoiceRecording,\x20%s,\x20%s',_0x1796b4,'request\x20sent');logger[_0xcbbb('0xf')]('VoiceRecording,\x20%s,\x20%s,\x20%s',_0x1796b4,_0xcbbb('0x10'),JSON['stringify'](_0x4ec90a));if(_0x4ec90a[_0xcbbb('0x11')]){if(_0x4ec90a[_0xcbbb('0x11')]['code']===0x1f4){logger[_0xcbbb('0x11')]('VoiceRecording,\x20%s,\x20%s',_0x1796b4,_0x4ec90a[_0xcbbb('0x11')]['message']);return _0x356249(_0x4ec90a[_0xcbbb('0x11')][_0xcbbb('0x12')]);}logger[_0xcbbb('0x11')]('VoiceRecording,\x20%s,\x20%s',_0x1796b4,_0x4ec90a[_0xcbbb('0x11')][_0xcbbb('0x12')]);return _0x6f4fd8(_0x4ec90a[_0xcbbb('0x11')][_0xcbbb('0x12')]);}else{logger['info']('VoiceRecording,\x20%s,\x20%s',_0x1796b4,_0xcbbb('0x10'));_0x6f4fd8(_0x4ec90a[_0xcbbb('0x13')][_0xcbbb('0x12')]);}})[_0xcbbb('0x14')](function(_0x5e25ca){logger[_0xcbbb('0x11')]('VoiceRecording,\x20%s,\x20%s',_0x1796b4,_0x5e25ca);_0x356249(_0x5e25ca);});});}exports[_0xcbbb('0x15')]=function(_0x3436af){var _0x3572bb=this;return new Promise(function(_0x5052df,_0x57c5e9){return db['VoiceRecording'][_0xcbbb('0x16')](_0x3436af[_0xcbbb('0x17')],{'raw':_0x3436af[_0xcbbb('0x18')]?_0x3436af[_0xcbbb('0x18')][_0xcbbb('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3436af[_0xcbbb('0x18')]?_0x3436af[_0xcbbb('0x18')][_0xcbbb('0x1a')]||null:null,'attributes':_0x3436af[_0xcbbb('0x18')]?_0x3436af[_0xcbbb('0x18')]['attributes']||null:null,'limit':_0x3436af[_0xcbbb('0x18')]?_0x3436af[_0xcbbb('0x18')][_0xcbbb('0x1b')]||null:null})[_0xcbbb('0xd')](function(_0x258d1f){logger[_0xcbbb('0xe')](_0xcbbb('0x15'),_0x3436af);logger[_0xcbbb('0xf')](_0xcbbb('0x15'),_0x3436af,JSON['stringify'](_0x258d1f));_0x5052df(_0x258d1f);})[_0xcbbb('0x14')](function(_0x4490c1){logger['error'](_0xcbbb('0x15'),_0x4490c1['message'],_0x3436af);_0x57c5e9(_0x3572bb['error'](0x1f4,_0x4490c1[_0xcbbb('0x12')]));});});};exports[_0xcbbb('0x1c')]=function(_0x548440){var _0x59c422=this;return new Promise(function(_0x5499a1,_0x4439ea){var _0x55e1d8=require('../../components/encryptor');var _0x21e3b1;return db[_0xcbbb('0x1d')][_0xcbbb('0x1e')]({'attributes':['id',_0xcbbb('0x1f')],'where':{'id':0x1},'raw':!![]})[_0xcbbb('0xd')](function(_0x39ba8b){_0x21e3b1=_0x39ba8b;return db[_0xcbbb('0x20')][_0xcbbb('0x21')](_0x548440[_0xcbbb('0x17')]);})[_0xcbbb('0xd')](function(_0x1c2ac9){if(_0x21e3b1[_0xcbbb('0x1f')]&&fs[_0xcbbb('0x22')](_0x1c2ac9[_0xcbbb('0x23')])){var _0x2a9639=util[_0xcbbb('0x24')](_0xcbbb('0x25'),_0x1c2ac9[_0xcbbb('0x23')]);return _0x55e1d8['encryptFile'](_0x1c2ac9[_0xcbbb('0x23')],_0x2a9639,config[_0xcbbb('0x26')]['recording'])[_0xcbbb('0xd')](function(){fs['unlink'](_0x1c2ac9[_0xcbbb('0x23')]);logger[_0xcbbb('0xe')](_0xcbbb('0x27'));return _0x1c2ac9;});}return _0x1c2ac9;})['then'](function(_0x38ee99){logger[_0xcbbb('0xe')](_0xcbbb('0x1c'),_0x548440);logger[_0xcbbb('0xf')](_0xcbbb('0x1c'),_0x548440,JSON[_0xcbbb('0x28')](_0x38ee99));_0x5499a1(_0x38ee99);})[_0xcbbb('0x14')](function(_0x1ac1a2){logger[_0xcbbb('0x11')](_0xcbbb('0x1c'),_0x1ac1a2['message'],_0x548440);_0x4439ea(_0x59c422['error'](0x1f4,_0x1ac1a2['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/index.js b/server/api/voiceTransferReport/index.js index 2fc15a0..83806dd 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 _0x730f=['path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./voiceTransferReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','delete','exports','multer','util'];(function(_0x4047a1,_0x31be30){var _0x22c445=function(_0x11ee40){while(--_0x11ee40){_0x4047a1['push'](_0x4047a1['shift']());}};_0x22c445(++_0x31be30);}(_0x730f,0x10f));var _0xf730=function(_0x21eb9b,_0x5de982){_0x21eb9b=_0x21eb9b-0x0;var _0x40b464=_0x730f[_0x21eb9b];return _0x40b464;};'use strict';var multer=require(_0xf730('0x0'));var util=require(_0xf730('0x1'));var path=require(_0xf730('0x2'));var timeout=require(_0xf730('0x3'));var express=require(_0xf730('0x4'));var router=express[_0xf730('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xf730('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xf730('0x7'));var controller=require(_0xf730('0x8'));router[_0xf730('0x9')]('/',auth[_0xf730('0xa')](),controller[_0xf730('0xb')]);router[_0xf730('0x9')](_0xf730('0xc'),auth['isAuthenticated'](),controller[_0xf730('0xd')]);router[_0xf730('0x9')](_0xf730('0xe'),auth[_0xf730('0xa')](),controller[_0xf730('0xf')]);router[_0xf730('0x10')]('/',auth[_0xf730('0xa')](),controller[_0xf730('0x11')]);router[_0xf730('0x12')](_0xf730('0xe'),auth[_0xf730('0xa')](),controller['update']);router[_0xf730('0x13')]('/:id',auth[_0xf730('0xa')](),controller['destroy']);module[_0xf730('0x14')]=router; \ No newline at end of file +var _0x39b8=['update','delete','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceTransferReport.controller','get','/describe','isAuthenticated','describe','/:id','show','post','create'];(function(_0x1163a0,_0xfed5f4){var _0x1af53e=function(_0x47b447){while(--_0x47b447){_0x1163a0['push'](_0x1163a0['shift']());}};_0x1af53e(++_0xfed5f4);}(_0x39b8,0x17e));var _0x839b=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x39b8[_0x3b380d];return _0x54502b;};'use strict';var multer=require('multer');var util=require(_0x839b('0x0'));var path=require(_0x839b('0x1'));var timeout=require(_0x839b('0x2'));var express=require('express');var router=express[_0x839b('0x3')]();var fs_extra=require(_0x839b('0x4'));var auth=require(_0x839b('0x5'));var interaction=require(_0x839b('0x6'));var config=require(_0x839b('0x7'));var controller=require(_0x839b('0x8'));router[_0x839b('0x9')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x839b('0xa'),auth[_0x839b('0xb')](),controller[_0x839b('0xc')]);router[_0x839b('0x9')](_0x839b('0xd'),auth[_0x839b('0xb')](),controller[_0x839b('0xe')]);router[_0x839b('0xf')]('/',auth[_0x839b('0xb')](),controller[_0x839b('0x10')]);router['put']('/:id',auth[_0x839b('0xb')](),controller[_0x839b('0x11')]);router[_0x839b('0x12')](_0x839b('0xd'),auth[_0x839b('0xb')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.attributes.js b/server/api/voiceTransferReport/voiceTransferReport.attributes.js index dc6fb24..e6a0eea 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 _0x669f=['moment','exports','blind','attended','STRING','ENUM','Yes'];(function(_0x310d2b,_0x18012c){var _0x4b9ee8=function(_0x7223e2){while(--_0x7223e2){_0x310d2b['push'](_0x310d2b['shift']());}};_0x4b9ee8(++_0x18012c);}(_0x669f,0xa8));var _0xf669=function(_0x408d22,_0x53eef9){_0x408d22=_0x408d22-0x0;var _0x58effd=_0x669f[_0x408d22];return _0x58effd;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xf669('0x0'));module[_0xf669('0x1')]={'type':{'type':Sequelize['ENUM'](_0xf669('0x2'),_0xf669('0x3'))},'result':{'type':Sequelize[_0xf669('0x4')]},'transfererchannel':{'type':Sequelize[_0xf669('0x4')]},'transferercalleridnum':{'type':Sequelize[_0xf669('0x4')]},'transferercalleridname':{'type':Sequelize[_0xf669('0x4')]},'transfererconnectedlinenum':{'type':Sequelize[_0xf669('0x4')]},'transfererconnectedlinename':{'type':Sequelize[_0xf669('0x4')]},'transfereraccountcode':{'type':Sequelize[_0xf669('0x4')]},'transferercontext':{'type':Sequelize[_0xf669('0x4')]},'transfererexten':{'type':Sequelize[_0xf669('0x4')]},'transfererlinkedid':{'type':Sequelize['STRING']},'transfereechannel':{'type':Sequelize[_0xf669('0x4')]},'transfereecalleridnum':{'type':Sequelize['STRING']},'transfereecalleridname':{'type':Sequelize['STRING']},'transfereeconnectedlinenum':{'type':Sequelize[_0xf669('0x4')]},'transfereeconnectedlinename':{'type':Sequelize['STRING']},'transfereeaccountcode':{'type':Sequelize['STRING']},'transfereecontext':{'type':Sequelize[_0xf669('0x4')]},'transfereeexten':{'type':Sequelize['STRING']},'transfereelinkedid':{'type':Sequelize['STRING']},'isexternal':{'type':Sequelize[_0xf669('0x5')](_0xf669('0x6'),'No')},'context':{'type':Sequelize[_0xf669('0x4')]},'extension':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x9be5=['blind','attended','STRING','ENUM','Yes'];(function(_0x164297,_0x7ccc1b){var _0x3ab221=function(_0x5c11fe){while(--_0x5c11fe){_0x164297['push'](_0x164297['shift']());}};_0x3ab221(++_0x7ccc1b);}(_0x9be5,0x168));var _0x59be=function(_0x187ee1,_0x3fd1e6){_0x187ee1=_0x187ee1-0x0;var _0x388160=_0x9be5[_0x187ee1];return _0x388160;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');module['exports']={'type':{'type':Sequelize['ENUM'](_0x59be('0x0'),_0x59be('0x1'))},'result':{'type':Sequelize[_0x59be('0x2')]},'transfererchannel':{'type':Sequelize[_0x59be('0x2')]},'transferercalleridnum':{'type':Sequelize['STRING']},'transferercalleridname':{'type':Sequelize[_0x59be('0x2')]},'transfererconnectedlinenum':{'type':Sequelize[_0x59be('0x2')]},'transfererconnectedlinename':{'type':Sequelize[_0x59be('0x2')]},'transfereraccountcode':{'type':Sequelize[_0x59be('0x2')]},'transferercontext':{'type':Sequelize[_0x59be('0x2')]},'transfererexten':{'type':Sequelize['STRING']},'transfererlinkedid':{'type':Sequelize[_0x59be('0x2')]},'transfereechannel':{'type':Sequelize['STRING']},'transfereecalleridnum':{'type':Sequelize['STRING']},'transfereecalleridname':{'type':Sequelize[_0x59be('0x2')]},'transfereeconnectedlinenum':{'type':Sequelize[_0x59be('0x2')]},'transfereeconnectedlinename':{'type':Sequelize[_0x59be('0x2')]},'transfereeaccountcode':{'type':Sequelize[_0x59be('0x2')]},'transfereecontext':{'type':Sequelize[_0x59be('0x2')]},'transfereeexten':{'type':Sequelize[_0x59be('0x2')]},'transfereelinkedid':{'type':Sequelize['STRING']},'isexternal':{'type':Sequelize[_0x59be('0x3')](_0x59be('0x4'),'No')},'context':{'type':Sequelize[_0x59be('0x2')]},'extension':{'type':Sequelize[_0x59be('0x2')]}}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.controller.js b/server/api/voiceTransferReport/voiceTransferReport.controller.js index 1440ad5..eb519e7 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 _0x20e9=['error','stack','name','send','index','VoiceTransferReport','rawAttributes','fieldName','key','map','query','keys','intersection','model','fields','attributes','length','nolimit','order','where','pick','filter','merge','type','VIRTUAL','options','include','findAll','show','params','filters','find','catch','create','update','body','destroy','describe','eml-format','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then'];(function(_0x97cda9,_0x132af6){var _0x5a1679=function(_0x433501){while(--_0x433501){_0x97cda9['push'](_0x97cda9['shift']());}};_0x5a1679(++_0x132af6);}(_0x20e9,0x110));var _0x920e=function(_0x9aada2,_0xd2d349){_0x9aada2=_0x9aada2-0x0;var _0x196dff=_0x20e9[_0x9aada2];return _0x196dff;};'use strict';var emlformat=require(_0x920e('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x920e('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x920e('0x2'));var moment=require(_0x920e('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x920e('0x4'));var util=require(_0x920e('0x5'));var path=require(_0x920e('0x6'));var sox=require(_0x920e('0x7'));var csv=require(_0x920e('0x8'));var ejs=require(_0x920e('0x9'));var fs=require('fs');var fs_extra=require(_0x920e('0xa'));var _=require(_0x920e('0xb'));var squel=require(_0x920e('0xc'));var crypto=require(_0x920e('0xd'));var jsforce=require(_0x920e('0xe'));var deskjs=require(_0x920e('0xf'));var toCsv=require('to-csv');var querystring=require(_0x920e('0x10'));var Papa=require(_0x920e('0x11'));var Redis=require(_0x920e('0x12'));var authService=require(_0x920e('0x13'));var qs=require(_0x920e('0x14'));var as=require(_0x920e('0x15'));var hardwareService=require(_0x920e('0x16'));var logger=require(_0x920e('0x17'))(_0x920e('0x18'));var utils=require('../../config/utils');var config=require(_0x920e('0x19'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xee5029,_0x52c56b){_0x52c56b=_0x52c56b||0xcc;return function(_0x198c29){if(_0x198c29){return _0xee5029[_0x920e('0x1a')](_0x52c56b);}return _0xee5029[_0x920e('0x1b')](_0x52c56b)[_0x920e('0x1c')]();};}function respondWithResult(_0x2d6dc4,_0x11f1fe){_0x11f1fe=_0x11f1fe||0xc8;return function(_0x21ee6b){if(_0x21ee6b){return _0x2d6dc4[_0x920e('0x1b')](_0x11f1fe)[_0x920e('0x1d')](_0x21ee6b);}};}function respondWithFilteredResult(_0x4c54b8,_0x39a7c7){return function(_0x51afd5){if(_0x51afd5){var _0x417d7f=typeof _0x39a7c7[_0x920e('0x1e')]===_0x920e('0x1f')&&typeof _0x39a7c7[_0x920e('0x20')]===_0x920e('0x1f');var _0x35f2ef=_0x51afd5[_0x920e('0x21')];var _0x4e8e5b=_0x417d7f?0x0:_0x39a7c7[_0x920e('0x1e')];var _0x2a9bc2=_0x417d7f?_0x51afd5[_0x920e('0x21')]:_0x39a7c7[_0x920e('0x1e')]+_0x39a7c7[_0x920e('0x20')];var _0x1822c8;if(_0x2a9bc2>=_0x35f2ef){_0x2a9bc2=_0x35f2ef;_0x1822c8=0xc8;}else{_0x1822c8=0xce;}_0x4c54b8[_0x920e('0x1b')](_0x1822c8);return _0x4c54b8[_0x920e('0x22')](_0x920e('0x23'),_0x4e8e5b+'-'+_0x2a9bc2+'/'+_0x35f2ef)[_0x920e('0x1d')](_0x51afd5);}return null;};}function patchUpdates(_0x1eb733){return function(_0x1b0345){try{jsonpatch[_0x920e('0x24')](_0x1b0345,_0x1eb733,!![]);}catch(_0x592b8d){return BPromise[_0x920e('0x25')](_0x592b8d);}return _0x1b0345[_0x920e('0x26')]();};}function saveUpdates(_0x2a786d,_0x367e38){return function(_0x47b657){if(_0x47b657){return _0x47b657['update'](_0x2a786d)[_0x920e('0x27')](function(_0x3877cb){return _0x3877cb;});}return null;};}function removeEntity(_0x2a4bc4,_0x4c0cb4){return function(_0x15cfcf){if(_0x15cfcf){return _0x15cfcf['destroy']()[_0x920e('0x27')](function(){_0x2a4bc4[_0x920e('0x1b')](0xcc)[_0x920e('0x1c')]();});}};}function handleEntityNotFound(_0x5d97bc,_0x58dca8){return function(_0x28d7b5){if(!_0x28d7b5){_0x5d97bc[_0x920e('0x1a')](0x194);}return _0x28d7b5;};}function handleError(_0x3e9c76,_0x2d4976){_0x2d4976=_0x2d4976||0x1f4;return function(_0x112ce9){logger[_0x920e('0x28')](_0x112ce9[_0x920e('0x29')]);if(_0x112ce9[_0x920e('0x2a')]){delete _0x112ce9[_0x920e('0x2a')];}_0x3e9c76['status'](_0x2d4976)[_0x920e('0x2b')](_0x112ce9);};}exports[_0x920e('0x2c')]=function(_0xedaf2f,_0x266ece){var _0x1cf3f4={},_0x230304={},_0xcafa7b={'count':0x0,'rows':[]};var _0x38e053=_['map'](db[_0x920e('0x2d')][_0x920e('0x2e')],function(_0xbaa65e){return{'name':_0xbaa65e[_0x920e('0x2f')],'type':_0xbaa65e['type'][_0x920e('0x30')]};});_0x230304['model']=_[_0x920e('0x31')](_0x38e053,_0x920e('0x2a'));_0x230304[_0x920e('0x32')]=_[_0x920e('0x33')](_0xedaf2f[_0x920e('0x32')]);_0x230304['filters']=_[_0x920e('0x34')](_0x230304['model'],_0x230304[_0x920e('0x32')]);_0x1cf3f4['attributes']=_[_0x920e('0x34')](_0x230304[_0x920e('0x35')],qs['fields'](_0xedaf2f['query'][_0x920e('0x36')]));_0x1cf3f4[_0x920e('0x37')]=_0x1cf3f4['attributes'][_0x920e('0x38')]?_0x1cf3f4[_0x920e('0x37')]:_0x230304[_0x920e('0x35')];if(!_0xedaf2f[_0x920e('0x32')]['hasOwnProperty'](_0x920e('0x39'))){_0x1cf3f4[_0x920e('0x20')]=qs['limit'](_0xedaf2f[_0x920e('0x32')][_0x920e('0x20')]);_0x1cf3f4['offset']=qs['offset'](_0xedaf2f['query'][_0x920e('0x1e')]);}_0x1cf3f4[_0x920e('0x3a')]=qs['sort'](_0xedaf2f['query']['sort']);_0x1cf3f4[_0x920e('0x3b')]=qs['filters'](_[_0x920e('0x3c')](_0xedaf2f[_0x920e('0x32')],_0x230304['filters']),_0x38e053);if(_0xedaf2f[_0x920e('0x32')][_0x920e('0x3d')]){_0x1cf3f4['where']=_[_0x920e('0x3e')](_0x1cf3f4[_0x920e('0x3b')],{'$or':_['map'](_0x38e053,function(_0x1b8187){if(_0x1b8187[_0x920e('0x3f')]!==_0x920e('0x40')){var _0x29e639={};_0x29e639[_0x1b8187[_0x920e('0x2a')]]={'$like':'%'+_0xedaf2f['query']['filter']+'%'};return _0x29e639;}})});}_0x1cf3f4=_['merge']({},_0x1cf3f4,_0xedaf2f[_0x920e('0x41')]);var _0x57116b={'where':_0x1cf3f4['where']};return db[_0x920e('0x2d')][_0x920e('0x21')](_0x57116b)['then'](function(_0x1dd792){_0xcafa7b['count']=_0x1dd792;if(_0xedaf2f[_0x920e('0x32')]['includeAll']){_0x1cf3f4[_0x920e('0x42')]=[{'all':!![]}];}return db[_0x920e('0x2d')][_0x920e('0x43')](_0x1cf3f4);})['then'](function(_0x5e2104){_0xcafa7b['rows']=_0x5e2104;return _0xcafa7b;})[_0x920e('0x27')](respondWithFilteredResult(_0x266ece,_0x1cf3f4))['catch'](handleError(_0x266ece,null));};exports[_0x920e('0x44')]=function(_0xf2ca26,_0x5ae25c){var _0x5b6ca4={'raw':!![],'where':{'id':_0xf2ca26[_0x920e('0x45')]['id']}},_0x463d4d={};_0x463d4d[_0x920e('0x35')]=_[_0x920e('0x33')](db['VoiceTransferReport']['rawAttributes']);_0x463d4d[_0x920e('0x32')]=_[_0x920e('0x33')](_0xf2ca26['query']);_0x463d4d[_0x920e('0x46')]=_[_0x920e('0x34')](_0x463d4d[_0x920e('0x35')],_0x463d4d['query']);_0x5b6ca4[_0x920e('0x37')]=_[_0x920e('0x34')](_0x463d4d[_0x920e('0x35')],qs[_0x920e('0x36')](_0xf2ca26[_0x920e('0x32')][_0x920e('0x36')]));_0x5b6ca4[_0x920e('0x37')]=_0x5b6ca4['attributes'][_0x920e('0x38')]?_0x5b6ca4[_0x920e('0x37')]:_0x463d4d[_0x920e('0x35')];if(_0xf2ca26[_0x920e('0x32')]['includeAll']){_0x5b6ca4[_0x920e('0x42')]=[{'all':!![]}];}_0x5b6ca4=_[_0x920e('0x3e')]({},_0x5b6ca4,_0xf2ca26[_0x920e('0x41')]);return db[_0x920e('0x2d')][_0x920e('0x47')](_0x5b6ca4)[_0x920e('0x27')](handleEntityNotFound(_0x5ae25c,null))[_0x920e('0x27')](respondWithResult(_0x5ae25c,null))[_0x920e('0x48')](handleError(_0x5ae25c,null));};exports['create']=function(_0x16f31f,_0x5a741a){return db[_0x920e('0x2d')][_0x920e('0x49')](_0x16f31f['body'],{})[_0x920e('0x27')](respondWithResult(_0x5a741a,0xc9))[_0x920e('0x48')](handleError(_0x5a741a,null));};exports[_0x920e('0x4a')]=function(_0x68be66,_0x454b1f){if(_0x68be66[_0x920e('0x4b')]['id']){delete _0x68be66[_0x920e('0x4b')]['id'];}return db['VoiceTransferReport'][_0x920e('0x47')]({'where':{'id':_0x68be66['params']['id']}})[_0x920e('0x27')](handleEntityNotFound(_0x454b1f,null))[_0x920e('0x27')](saveUpdates(_0x68be66[_0x920e('0x4b')],null))[_0x920e('0x27')](respondWithResult(_0x454b1f,null))[_0x920e('0x48')](handleError(_0x454b1f,null));};exports[_0x920e('0x4c')]=function(_0xb5829c,_0x468c15){return db[_0x920e('0x2d')]['find']({'where':{'id':_0xb5829c[_0x920e('0x45')]['id']}})[_0x920e('0x27')](handleEntityNotFound(_0x468c15,null))['then'](removeEntity(_0x468c15,null))['catch'](handleError(_0x468c15,null));};exports[_0x920e('0x4d')]=function(_0xdac475,_0x3b9b2d){return db['VoiceTransferReport']['describe']()[_0x920e('0x27')](respondWithResult(_0x3b9b2d,null))[_0x920e('0x48')](handleError(_0x3b9b2d,null));}; \ No newline at end of file +var _0xb750=['keys','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','options','include','findAll','rows','params','includeAll','find','catch','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','to-csv','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','limit','undefined','count','set','Content-Range','reject','update','then','destroy','error','name','send','index','map','VoiceTransferReport','rawAttributes','fieldName','key','query'];(function(_0x2b6e32,_0x44356e){var _0x59959f=function(_0x1d96e4){while(--_0x1d96e4){_0x2b6e32['push'](_0x2b6e32['shift']());}};_0x59959f(++_0x44356e);}(_0xb750,0xf5));var _0x0b75=function(_0x24976b,_0x55e81a){_0x24976b=_0x24976b-0x0;var _0x1d7da5=_0xb750[_0x24976b];return _0x1d7da5;};'use strict';var emlformat=require(_0x0b75('0x0'));var rimraf=require(_0x0b75('0x1'));var zipdir=require(_0x0b75('0x2'));var jsonpatch=require(_0x0b75('0x3'));var rp=require(_0x0b75('0x4'));var moment=require(_0x0b75('0x5'));var BPromise=require(_0x0b75('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0x0b75('0x7'));var sox=require('sox');var csv=require(_0x0b75('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x0b75('0x9'));var crypto=require(_0x0b75('0xa'));var jsforce=require(_0x0b75('0xb'));var deskjs=require(_0x0b75('0xc'));var toCsv=require(_0x0b75('0x8'));var querystring=require(_0x0b75('0xd'));var Papa=require(_0x0b75('0xe'));var Redis=require(_0x0b75('0xf'));var authService=require(_0x0b75('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0b75('0x11'));var logger=require('../../config/logger')(_0x0b75('0x12'));var utils=require(_0x0b75('0x13'));var config=require(_0x0b75('0x14'));var licenseUtil=require(_0x0b75('0x15'));var db=require(_0x0b75('0x16'))['db'];function respondWithStatusCode(_0x20bf9c,_0x3fda17){_0x3fda17=_0x3fda17||0xcc;return function(_0xc43185){if(_0xc43185){return _0x20bf9c[_0x0b75('0x17')](_0x3fda17);}return _0x20bf9c['status'](_0x3fda17)[_0x0b75('0x18')]();};}function respondWithResult(_0x1f5395,_0x5c4e77){_0x5c4e77=_0x5c4e77||0xc8;return function(_0x5b50bf){if(_0x5b50bf){return _0x1f5395[_0x0b75('0x19')](_0x5c4e77)[_0x0b75('0x1a')](_0x5b50bf);}};}function respondWithFilteredResult(_0x3e4993,_0x4e10b0){return function(_0x2c1156){if(_0x2c1156){var _0x275ce7=typeof _0x4e10b0[_0x0b75('0x1b')]==='undefined'&&typeof _0x4e10b0[_0x0b75('0x1c')]===_0x0b75('0x1d');var _0x49cd23=_0x2c1156[_0x0b75('0x1e')];var _0xe094f6=_0x275ce7?0x0:_0x4e10b0[_0x0b75('0x1b')];var _0x4be220=_0x275ce7?_0x2c1156['count']:_0x4e10b0['offset']+_0x4e10b0['limit'];var _0x40e6ae;if(_0x4be220>=_0x49cd23){_0x4be220=_0x49cd23;_0x40e6ae=0xc8;}else{_0x40e6ae=0xce;}_0x3e4993[_0x0b75('0x19')](_0x40e6ae);return _0x3e4993[_0x0b75('0x1f')](_0x0b75('0x20'),_0xe094f6+'-'+_0x4be220+'/'+_0x49cd23)[_0x0b75('0x1a')](_0x2c1156);}return null;};}function patchUpdates(_0x291bb4){return function(_0x421921){try{jsonpatch['apply'](_0x421921,_0x291bb4,!![]);}catch(_0x275c4f){return BPromise[_0x0b75('0x21')](_0x275c4f);}return _0x421921['save']();};}function saveUpdates(_0x128c44,_0x4fcaff){return function(_0x315820){if(_0x315820){return _0x315820[_0x0b75('0x22')](_0x128c44)[_0x0b75('0x23')](function(_0x379522){return _0x379522;});}return null;};}function removeEntity(_0x5733a0,_0x12c740){return function(_0xfa2317){if(_0xfa2317){return _0xfa2317[_0x0b75('0x24')]()[_0x0b75('0x23')](function(){_0x5733a0[_0x0b75('0x19')](0xcc)[_0x0b75('0x18')]();});}};}function handleEntityNotFound(_0x89ba9c,_0x539de9){return function(_0x12c176){if(!_0x12c176){_0x89ba9c[_0x0b75('0x17')](0x194);}return _0x12c176;};}function handleError(_0x5e3a6d,_0x188707){_0x188707=_0x188707||0x1f4;return function(_0x4b7e9a){logger[_0x0b75('0x25')](_0x4b7e9a['stack']);if(_0x4b7e9a[_0x0b75('0x26')]){delete _0x4b7e9a[_0x0b75('0x26')];}_0x5e3a6d['status'](_0x188707)[_0x0b75('0x27')](_0x4b7e9a);};}exports[_0x0b75('0x28')]=function(_0x33f771,_0x35c8f0){var _0x170007={},_0x3ee9a5={},_0x6049c={'count':0x0,'rows':[]};var _0x369381=_[_0x0b75('0x29')](db[_0x0b75('0x2a')][_0x0b75('0x2b')],function(_0x2cabf7){return{'name':_0x2cabf7[_0x0b75('0x2c')],'type':_0x2cabf7['type'][_0x0b75('0x2d')]};});_0x3ee9a5['model']=_[_0x0b75('0x29')](_0x369381,_0x0b75('0x26'));_0x3ee9a5[_0x0b75('0x2e')]=_[_0x0b75('0x2f')](_0x33f771['query']);_0x3ee9a5['filters']=_['intersection'](_0x3ee9a5[_0x0b75('0x30')],_0x3ee9a5[_0x0b75('0x2e')]);_0x170007[_0x0b75('0x31')]=_[_0x0b75('0x32')](_0x3ee9a5[_0x0b75('0x30')],qs['fields'](_0x33f771[_0x0b75('0x2e')][_0x0b75('0x33')]));_0x170007[_0x0b75('0x31')]=_0x170007[_0x0b75('0x31')][_0x0b75('0x34')]?_0x170007[_0x0b75('0x31')]:_0x3ee9a5[_0x0b75('0x30')];if(!_0x33f771[_0x0b75('0x2e')][_0x0b75('0x35')](_0x0b75('0x36'))){_0x170007[_0x0b75('0x1c')]=qs['limit'](_0x33f771[_0x0b75('0x2e')][_0x0b75('0x1c')]);_0x170007[_0x0b75('0x1b')]=qs[_0x0b75('0x1b')](_0x33f771[_0x0b75('0x2e')][_0x0b75('0x1b')]);}_0x170007[_0x0b75('0x37')]=qs[_0x0b75('0x38')](_0x33f771[_0x0b75('0x2e')][_0x0b75('0x38')]);_0x170007[_0x0b75('0x39')]=qs[_0x0b75('0x3a')](_['pick'](_0x33f771[_0x0b75('0x2e')],_0x3ee9a5['filters']),_0x369381);if(_0x33f771[_0x0b75('0x2e')][_0x0b75('0x3b')]){_0x170007[_0x0b75('0x39')]=_[_0x0b75('0x3c')](_0x170007['where'],{'$or':_[_0x0b75('0x29')](_0x369381,function(_0x5ac80e){if(_0x5ac80e['type']!==_0x0b75('0x3d')){var _0x10d1f1={};_0x10d1f1[_0x5ac80e[_0x0b75('0x26')]]={'$like':'%'+_0x33f771[_0x0b75('0x2e')][_0x0b75('0x3b')]+'%'};return _0x10d1f1;}})});}_0x170007=_['merge']({},_0x170007,_0x33f771[_0x0b75('0x3e')]);var _0x5bf6d7={'where':_0x170007[_0x0b75('0x39')]};return db['VoiceTransferReport'][_0x0b75('0x1e')](_0x5bf6d7)[_0x0b75('0x23')](function(_0x710bd8){_0x6049c['count']=_0x710bd8;if(_0x33f771[_0x0b75('0x2e')]['includeAll']){_0x170007[_0x0b75('0x3f')]=[{'all':!![]}];}return db[_0x0b75('0x2a')][_0x0b75('0x40')](_0x170007);})[_0x0b75('0x23')](function(_0x4ecad7){_0x6049c[_0x0b75('0x41')]=_0x4ecad7;return _0x6049c;})['then'](respondWithFilteredResult(_0x35c8f0,_0x170007))['catch'](handleError(_0x35c8f0,null));};exports['show']=function(_0x3c0859,_0xf98695){var _0x207fc2={'raw':!![],'where':{'id':_0x3c0859[_0x0b75('0x42')]['id']}},_0x203343={};_0x203343['model']=_[_0x0b75('0x2f')](db['VoiceTransferReport'][_0x0b75('0x2b')]);_0x203343[_0x0b75('0x2e')]=_[_0x0b75('0x2f')](_0x3c0859['query']);_0x203343[_0x0b75('0x3a')]=_[_0x0b75('0x32')](_0x203343[_0x0b75('0x30')],_0x203343[_0x0b75('0x2e')]);_0x207fc2[_0x0b75('0x31')]=_['intersection'](_0x203343[_0x0b75('0x30')],qs[_0x0b75('0x33')](_0x3c0859[_0x0b75('0x2e')][_0x0b75('0x33')]));_0x207fc2[_0x0b75('0x31')]=_0x207fc2[_0x0b75('0x31')]['length']?_0x207fc2['attributes']:_0x203343['model'];if(_0x3c0859[_0x0b75('0x2e')][_0x0b75('0x43')]){_0x207fc2[_0x0b75('0x3f')]=[{'all':!![]}];}_0x207fc2=_[_0x0b75('0x3c')]({},_0x207fc2,_0x3c0859[_0x0b75('0x3e')]);return db[_0x0b75('0x2a')][_0x0b75('0x44')](_0x207fc2)[_0x0b75('0x23')](handleEntityNotFound(_0xf98695,null))[_0x0b75('0x23')](respondWithResult(_0xf98695,null))[_0x0b75('0x45')](handleError(_0xf98695,null));};exports['create']=function(_0x530a98,_0x2739e0){return db[_0x0b75('0x2a')][_0x0b75('0x46')](_0x530a98['body'],{})[_0x0b75('0x23')](respondWithResult(_0x2739e0,0xc9))[_0x0b75('0x45')](handleError(_0x2739e0,null));};exports['update']=function(_0x57cfca,_0x40854a){if(_0x57cfca[_0x0b75('0x47')]['id']){delete _0x57cfca[_0x0b75('0x47')]['id'];}return db[_0x0b75('0x2a')]['find']({'where':{'id':_0x57cfca[_0x0b75('0x42')]['id']}})['then'](handleEntityNotFound(_0x40854a,null))['then'](saveUpdates(_0x57cfca[_0x0b75('0x47')],null))[_0x0b75('0x23')](respondWithResult(_0x40854a,null))[_0x0b75('0x45')](handleError(_0x40854a,null));};exports['destroy']=function(_0x50a46e,_0x2cf0da){return db[_0x0b75('0x2a')][_0x0b75('0x44')]({'where':{'id':_0x50a46e['params']['id']}})[_0x0b75('0x23')](handleEntityNotFound(_0x2cf0da,null))[_0x0b75('0x23')](removeEntity(_0x2cf0da,null))[_0x0b75('0x45')](handleError(_0x2cf0da,null));};exports[_0x0b75('0x48')]=function(_0x468a3d,_0x52856f){return db[_0x0b75('0x2a')]['describe']()[_0x0b75('0x23')](respondWithResult(_0x52856f,null))['catch'](handleError(_0x52856f,null));}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.model.js b/server/api/voiceTransferReport/voiceTransferReport.model.js index ed94eed..22fb2a2 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 _0x3d17=['../../config/environment','./voiceTransferReport.attributes','exports','define','VoiceTransferReport','report_call_transfer','../../config/logger','moment','bluebird','request-promise','path','rimraf'];(function(_0x243b59,_0x3f9495){var _0x3e1676=function(_0x354052){while(--_0x354052){_0x243b59['push'](_0x243b59['shift']());}};_0x3e1676(++_0x3f9495);}(_0x3d17,0x1b6));var _0x73d1=function(_0x4d8a8f,_0x2afd4c){_0x4d8a8f=_0x4d8a8f-0x0;var _0xfc4adc=_0x3d17[_0x4d8a8f];return _0xfc4adc;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x73d1('0x0'))('api');var moment=require(_0x73d1('0x1'));var BPromise=require(_0x73d1('0x2'));var rp=require(_0x73d1('0x3'));var fs=require('fs');var path=require(_0x73d1('0x4'));var rimraf=require(_0x73d1('0x5'));var config=require(_0x73d1('0x6'));var attributes=require(_0x73d1('0x7'));module[_0x73d1('0x8')]=function(_0x527d20,_0xb58729){return _0x527d20[_0x73d1('0x9')](_0x73d1('0xa'),attributes,{'tableName':_0x73d1('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7c8d=['../../config/environment','exports','define','report_call_transfer','util','../../config/logger','moment','request-promise','path','rimraf'];(function(_0x340f11,_0x83ea42){var _0x43e813=function(_0x12de30){while(--_0x12de30){_0x340f11['push'](_0x340f11['shift']());}};_0x43e813(++_0x83ea42);}(_0x7c8d,0xb8));var _0xd7c8=function(_0x3b1566,_0x4bfc27){_0x3b1566=_0x3b1566-0x0;var _0x43b4a1=_0x7c8d[_0x3b1566];return _0x43b4a1;};'use strict';var _=require('lodash');var util=require(_0xd7c8('0x0'));var logger=require(_0xd7c8('0x1'))('api');var moment=require(_0xd7c8('0x2'));var BPromise=require('bluebird');var rp=require(_0xd7c8('0x3'));var fs=require('fs');var path=require(_0xd7c8('0x4'));var rimraf=require(_0xd7c8('0x5'));var config=require(_0xd7c8('0x6'));var attributes=require('./voiceTransferReport.attributes');module[_0xd7c8('0x7')]=function(_0x5b3592,_0x395af0){return _0x5b3592[_0xd7c8('0x8')]('VoiceTransferReport',attributes,{'tableName':_0xd7c8('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.rpc.js b/server/api/voiceTransferReport/voiceTransferReport.rpc.js index 6adabbc..066e44f 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 _0x3191=['rpc','../../config/environment','jayson/promise','client','http','request','info','VoiceTransferReport,\x20%s,\x20%s','request\x20sent','error','message','result','catch','CreateVoiceTransferReport','VoiceTransferReport','body','options','then','debug','stringify','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x37a37b,_0x5d486b){var _0x48174c=function(_0x46035d){while(--_0x46035d){_0x37a37b['push'](_0x37a37b['shift']());}};_0x48174c(++_0x5d486b);}(_0x3191,0x1d4));var _0x1319=function(_0x351747,_0x1a7971){_0x351747=_0x351747-0x0;var _0x2618cf=_0x3191[_0x351747];return _0x2618cf;};'use strict';var _=require(_0x1319('0x0'));var util=require(_0x1319('0x1'));var moment=require(_0x1319('0x2'));var BPromise=require('bluebird');var rs=require(_0x1319('0x3'));var fs=require('fs');var Redis=require(_0x1319('0x4'));var db=require(_0x1319('0x5'))['db'];var utils=require(_0x1319('0x6'));var logger=require(_0x1319('0x7'))(_0x1319('0x8'));var config=require(_0x1319('0x9'));var jayson=require(_0x1319('0xa'));var client=jayson[_0x1319('0xb')][_0x1319('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x16327d,_0x3b875b,_0x487329){return new BPromise(function(_0x30fdab,_0x133c04){return client[_0x1319('0xd')](_0x16327d,_0x487329)['then'](function(_0x1979e2){logger[_0x1319('0xe')](_0x1319('0xf'),_0x3b875b,_0x1319('0x10'));logger['debug']('VoiceTransferReport,\x20%s,\x20%s,\x20%s',_0x3b875b,_0x1319('0x10'),JSON['stringify'](_0x1979e2));if(_0x1979e2['error']){if(_0x1979e2['error']['code']===0x1f4){logger['error'](_0x1319('0xf'),_0x3b875b,_0x1979e2[_0x1319('0x11')][_0x1319('0x12')]);return _0x133c04(_0x1979e2[_0x1319('0x11')][_0x1319('0x12')]);}logger[_0x1319('0x11')]('VoiceTransferReport,\x20%s,\x20%s',_0x3b875b,_0x1979e2[_0x1319('0x11')][_0x1319('0x12')]);return _0x30fdab(_0x1979e2[_0x1319('0x11')][_0x1319('0x12')]);}else{logger['info'](_0x1319('0xf'),_0x3b875b,_0x1319('0x10'));_0x30fdab(_0x1979e2[_0x1319('0x13')][_0x1319('0x12')]);}})[_0x1319('0x14')](function(_0x2823cf){logger[_0x1319('0x11')](_0x1319('0xf'),_0x3b875b,_0x2823cf);_0x133c04(_0x2823cf);});});}exports[_0x1319('0x15')]=function(_0x45fdfd){var _0x53a16f=this;return new Promise(function(_0x5d26ca,_0x887662){return db[_0x1319('0x16')]['create'](_0x45fdfd[_0x1319('0x17')],{'raw':_0x45fdfd[_0x1319('0x18')]?_0x45fdfd['options']['raw']===undefined?!![]:![]:!![]})[_0x1319('0x19')](function(_0x13bb38){logger[_0x1319('0xe')](_0x1319('0x15'),_0x45fdfd);logger[_0x1319('0x1a')](_0x1319('0x15'),_0x45fdfd,JSON[_0x1319('0x1b')](_0x13bb38));_0x5d26ca(_0x13bb38);})[_0x1319('0x14')](function(_0x4b4cd3){logger[_0x1319('0x11')]('CreateVoiceTransferReport',_0x4b4cd3['message'],_0x45fdfd);_0x887662(_0x53a16f[_0x1319('0x11')](0x1f4,_0x4b4cd3[_0x1319('0x12')]));});});}; \ No newline at end of file +var _0x9c5b=['error','code','message','VoiceTransferReport,\x20%s,\x20%s','result','catch','CreateVoiceTransferReport','VoiceTransferReport','body','options','raw','debug','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','client','http','request','then','info','request\x20sent','VoiceTransferReport,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x17e9aa,_0x5cac17){var _0x44972e=function(_0x4522ac){while(--_0x4522ac){_0x17e9aa['push'](_0x17e9aa['shift']());}};_0x44972e(++_0x5cac17);}(_0x9c5b,0x111));var _0xb9c5=function(_0x3bd4a5,_0x2597bd){_0x3bd4a5=_0x3bd4a5-0x0;var _0x41d843=_0x9c5b[_0x3bd4a5];return _0x41d843;};'use strict';var _=require(_0xb9c5('0x0'));var util=require(_0xb9c5('0x1'));var moment=require(_0xb9c5('0x2'));var BPromise=require(_0xb9c5('0x3'));var rs=require(_0xb9c5('0x4'));var fs=require('fs');var Redis=require(_0xb9c5('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xb9c5('0x6'));var logger=require('../../config/logger')(_0xb9c5('0x7'));var config=require(_0xb9c5('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xb9c5('0x9')][_0xb9c5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4d68d5,_0x582500,_0x5305dd){return new BPromise(function(_0x3baaac,_0x18510c){return client[_0xb9c5('0xb')](_0x4d68d5,_0x5305dd)[_0xb9c5('0xc')](function(_0x8317b2){logger[_0xb9c5('0xd')]('VoiceTransferReport,\x20%s,\x20%s',_0x582500,_0xb9c5('0xe'));logger['debug'](_0xb9c5('0xf'),_0x582500,_0xb9c5('0xe'),JSON[_0xb9c5('0x10')](_0x8317b2));if(_0x8317b2[_0xb9c5('0x11')]){if(_0x8317b2[_0xb9c5('0x11')][_0xb9c5('0x12')]===0x1f4){logger['error']('VoiceTransferReport,\x20%s,\x20%s',_0x582500,_0x8317b2[_0xb9c5('0x11')][_0xb9c5('0x13')]);return _0x18510c(_0x8317b2[_0xb9c5('0x11')][_0xb9c5('0x13')]);}logger[_0xb9c5('0x11')](_0xb9c5('0x14'),_0x582500,_0x8317b2[_0xb9c5('0x11')][_0xb9c5('0x13')]);return _0x3baaac(_0x8317b2['error']['message']);}else{logger[_0xb9c5('0xd')](_0xb9c5('0x14'),_0x582500,_0xb9c5('0xe'));_0x3baaac(_0x8317b2[_0xb9c5('0x15')][_0xb9c5('0x13')]);}})[_0xb9c5('0x16')](function(_0x426c95){logger[_0xb9c5('0x11')](_0xb9c5('0x14'),_0x582500,_0x426c95);_0x18510c(_0x426c95);});});}exports[_0xb9c5('0x17')]=function(_0x585249){var _0x9499c7=this;return new Promise(function(_0x223ee7,_0x83489){return db[_0xb9c5('0x18')]['create'](_0x585249[_0xb9c5('0x19')],{'raw':_0x585249['options']?_0x585249[_0xb9c5('0x1a')][_0xb9c5('0x1b')]===undefined?!![]:![]:!![]})[_0xb9c5('0xc')](function(_0x208574){logger[_0xb9c5('0xd')]('CreateVoiceTransferReport',_0x585249);logger[_0xb9c5('0x1c')](_0xb9c5('0x17'),_0x585249,JSON[_0xb9c5('0x10')](_0x208574));_0x223ee7(_0x208574);})[_0xb9c5('0x16')](function(_0x406730){logger[_0xb9c5('0x11')](_0xb9c5('0x17'),_0x406730[_0xb9c5('0x13')],_0x585249);_0x83489(_0x9499c7[_0xb9c5('0x11')](0x1f4,_0x406730[_0xb9c5('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/webbar/index.js b/server/api/webbar/index.js index f163276..ca734dd 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 _0x9f62=['/hangup','isAuthenticated','hangup','/answer','isWebrtcLicence','hold','/calls','/transfer','transfer','exports','Router','./webbar.controller','post','/originate','originate'];(function(_0x45dc24,_0x59f93d){var _0x56d8ba=function(_0x19eca0){while(--_0x19eca0){_0x45dc24['push'](_0x45dc24['shift']());}};_0x56d8ba(++_0x59f93d);}(_0x9f62,0x154));var _0x29f6=function(_0x305b6b,_0x59b94c){_0x305b6b=_0x305b6b-0x0;var _0x4e6084=_0x9f62[_0x305b6b];return _0x4e6084;};'use strict';var express=require('express');var router=express[_0x29f6('0x0')]();var auth=require('../../components/auth/service');var controller=require(_0x29f6('0x1'));router[_0x29f6('0x2')](_0x29f6('0x3'),auth['isAuthenticated'](),auth['isWebrtcLicence'](),controller[_0x29f6('0x4')]);router[_0x29f6('0x2')](_0x29f6('0x5'),auth[_0x29f6('0x6')](),auth['isWebrtcLicence'](),controller[_0x29f6('0x7')]);router[_0x29f6('0x2')](_0x29f6('0x8'),auth[_0x29f6('0x6')](),auth[_0x29f6('0x9')](),controller['answer']);router['post']('/hold',auth['isAuthenticated'](),auth[_0x29f6('0x9')](),controller[_0x29f6('0xa')]);router['post']('/unhold',auth[_0x29f6('0x6')](),auth[_0x29f6('0x9')](),controller['unhold']);router[_0x29f6('0x2')](_0x29f6('0xb'),auth['isAuthenticated'](),auth['isWebrtcLicence'](),controller['calls']);router['post'](_0x29f6('0xc'),auth[_0x29f6('0x6')](),auth[_0x29f6('0x9')](),controller[_0x29f6('0xd')]);module[_0x29f6('0xe')]=router; \ No newline at end of file +var _0xa9e0=['/transfer','transfer','exports','express','Router','../../components/auth/service','/originate','isWebrtcLicence','originate','post','/hangup','isAuthenticated','hangup','/answer','answer','hold','/unhold','calls'];(function(_0xcdccfe,_0x3eb855){var _0x2d6d89=function(_0x3f3076){while(--_0x3f3076){_0xcdccfe['push'](_0xcdccfe['shift']());}};_0x2d6d89(++_0x3eb855);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1c546c,_0x5c57cb){_0x1c546c=_0x1c546c-0x0;var _0x2cc384=_0xa9e0[_0x1c546c];return _0x2cc384;};'use strict';var express=require(_0x0a9e('0x0'));var router=express[_0x0a9e('0x1')]();var auth=require(_0x0a9e('0x2'));var controller=require('./webbar.controller');router['post'](_0x0a9e('0x3'),auth['isAuthenticated'](),auth[_0x0a9e('0x4')](),controller[_0x0a9e('0x5')]);router[_0x0a9e('0x6')](_0x0a9e('0x7'),auth[_0x0a9e('0x8')](),auth['isWebrtcLicence'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x6')](_0x0a9e('0xa'),auth['isAuthenticated'](),auth['isWebrtcLicence'](),controller[_0x0a9e('0xb')]);router['post']('/hold',auth[_0x0a9e('0x8')](),auth[_0x0a9e('0x4')](),controller[_0x0a9e('0xc')]);router[_0x0a9e('0x6')](_0x0a9e('0xd'),auth[_0x0a9e('0x8')](),auth['isWebrtcLicence'](),controller['unhold']);router['post']('/calls',auth[_0x0a9e('0x8')](),auth[_0x0a9e('0x4')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0x6')](_0x0a9e('0xf'),auth[_0x0a9e('0x8')](),auth['isWebrtcLicence'](),controller[_0x0a9e('0x10')]);module[_0x0a9e('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 89923a8..bc290b4 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 _0x54ef=['callerId','format','user:%s','webbar:originate','originate\x20executed!','hangup','validate','userId','entityFound:','hangup\x20executed!','answer','answer\x20fired:','webbar:answer','answer\x20executed!','hold','hold\x20fired:','webbar:hold','hold\x20executed!','unhold','unhold\x20fired:','webbar:unhold','unhold\x20executed!','calls\x20fired:','filter','conference','webbar:conference','conference\x20executed!','transfer\x20fired:','transferNumber','webbar:transfer','transfer\x20executed!','path','lodash','../../mysqldb','util','bluebird','jayson/promise','client','http','../../config/logger','webbarapi','defaults','redis','localhost','number','userId\x20is\x20required','callNumber\x20is\x20required','string','transferNumber\x20is\x20required','info','stringify','emit','log','handleError:','error','stack','name','status','send','NotFound','request','then','code','message','result','catch','User','findOne','agent','VoiceChannels','all','rows','UserId','sessionId','length','sessionId\x20','\x20not\x20found!','originate','body','json','callNumber'];(function(_0x1c5dea,_0x38234d){var _0x5e9f62=function(_0x574733){while(--_0x574733){_0x1c5dea['push'](_0x1c5dea['shift']());}};_0x5e9f62(++_0x38234d);}(_0x54ef,0x112));var _0xf54e=function(_0x4b777f,_0x518cb0){_0x4b777f=_0x4b777f-0x0;var _0x4bd7d3=_0x54ef[_0x4b777f];return _0x4bd7d3;};'use strict';var path=require(_0xf54e('0x0'));var fs=require('fs');var _=require(_0xf54e('0x1'));var db=require(_0xf54e('0x2'))['db'];var config=require('../../config/environment');var util=require(_0xf54e('0x3'));var BPromise=require(_0xf54e('0x4'));var jayson=require(_0xf54e('0x5'));var amiClient=jayson[_0xf54e('0x6')][_0xf54e('0x7')]({'port':0x232a});var logger=require(_0xf54e('0x8'))(_0xf54e('0x9'));var Redis=require('ioredis');config['redis']=_[_0xf54e('0xa')](config[_0xf54e('0xb')],{'host':_0xf54e('0xc'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xf54e('0xb')]));var Schema=require('validate');var originateValidation=new Schema({'userId':{'type':_0xf54e('0xd'),'required':[!![],_0xf54e('0xe')]},'callNumber':{'type':'string','required':[!![],_0xf54e('0xf')]},'callerId':{'type':_0xf54e('0x10')},'callbackUrl':{'type':_0xf54e('0x10')}});var hangupValidation=new Schema({'userId':{'type':_0xf54e('0xd'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0xf54e('0x10'),'required':![]}});var answerValidation=new Schema({'userId':{'type':_0xf54e('0xd'),'required':[!![],_0xf54e('0xe')]},'sessionId':{'type':_0xf54e('0x10'),'required':![]}});var transferValidation=new Schema({'userId':{'type':'number','required':[!![],_0xf54e('0xe')]},'sessionId':{'type':'string','required':[!![],'sessionId\x20is\x20required']},'transferNumber':{'type':_0xf54e('0x10'),'required':[!![],_0xf54e('0x11')]}});var holdValidation=new Schema({'userId':{'type':_0xf54e('0xd'),'required':[!![],_0xf54e('0xe')]},'sessionId':{'type':'string','required':![]}});var unholdValidation=new Schema({'userId':{'type':_0xf54e('0xd'),'required':[!![],_0xf54e('0xe')]},'sessionId':{'type':_0xf54e('0x10'),'required':![]}});var callsValidation=new Schema({'userId':{'type':_0xf54e('0xd'),'required':[!![],'userId\x20is\x20required']}});var conferenceValidation=new Schema({'userId':{'type':_0xf54e('0xd'),'required':[!![],_0xf54e('0xe')]}});function emit(_0x3eb415,_0x5c5d00,_0x4af633){logger[_0xf54e('0x12')](_0x3eb415,_0x5c5d00,JSON[_0xf54e('0x13')](_0x4af633));io['to'](_0x3eb415)[_0xf54e('0x14')](_0x5c5d00,_0x4af633);}function handleError(_0x9647f){return function(_0x15cc48){console[_0xf54e('0x15')](_0xf54e('0x16'),_0x15cc48,_0x15cc48 instanceof RangeError);logger[_0xf54e('0x17')](_0x15cc48[_0xf54e('0x18')]);if(_0x15cc48 instanceof RangeError){if(_0x15cc48[_0xf54e('0x19')]){delete _0x15cc48[_0xf54e('0x19')];}_0x9647f['status'](0x194)['send'](_0x15cc48);}else{if(_0x15cc48[_0xf54e('0x19')]){delete _0x15cc48['name'];}_0x9647f[_0xf54e('0x1a')](0x1f4)[_0xf54e('0x1b')](_0x15cc48);}};}function checkError(){return function(_0x106362){if(!_0x106362){throw new RangeError(_0xf54e('0x1c'));}return _0x106362;};}function respondWithRpcPromise(_0xf64f12,_0x3887b0){return new BPromise(function(_0x388aa0,_0x11985e){var _0x3c0169=amiClient;return _0x3c0169[_0xf54e('0x1d')](_0xf64f12,_0x3887b0)[_0xf54e('0x1e')](function(_0x5b83df){if(_0x5b83df[_0xf54e('0x17')]){if(_0x5b83df['error'][_0xf54e('0x1f')]===0x1f4){return _0x11985e(_0x5b83df[_0xf54e('0x17')][_0xf54e('0x20')]);}return _0x388aa0(_0x5b83df[_0xf54e('0x17')][_0xf54e('0x20')]);}else{_0x388aa0(_0x5b83df[_0xf54e('0x21')]);}})[_0xf54e('0x22')](function(_0x43488d){_0x11985e(_0x43488d);});});}function getAgent(_0x2342a9){return db[_0xf54e('0x23')][_0xf54e('0x24')]({'where':{'id':_0x2342a9,'role':_0xf54e('0x25')}})[_0xf54e('0x1e')](checkError());}function getAgentCheckSession(_0x5390b8,_0xb3706e){return new BPromise(function(_0x4cbf7c,_0x282c63){var _0x5e63f4=respondWithRpcPromise(_0xf54e('0x26'));var _0x269f47=getAgent(_0x5390b8);Promise[_0xf54e('0x27')]([_0x5e63f4,_0x269f47])[_0xf54e('0x1e')](function(_0x25b643){var _0x3993e4=_0x25b643[0x0];var _0x36f985=_0x25b643[0x1];var _0x54bd8f=_['filter'](_0x3993e4[_0xf54e('0x28')],function(_0x258d29){return _0x258d29[_0xf54e('0x29')]==_0x36f985['id']&&_0x258d29[_0xf54e('0x2a')]==_0xb3706e;});if(_0x54bd8f[_0xf54e('0x2b')]==0x1){_0x4cbf7c(_0x36f985);}else{_0x282c63(new RangeError(_0xf54e('0x2c')+_0xb3706e+_0xf54e('0x2d')));}});});}exports[_0xf54e('0x2e')]=function(_0x3ae704,_0x12edc3){logger['info']('originate\x20fired:',_0x3ae704[_0xf54e('0x2f')]);var _0x3169dd=originateValidation['validate'](_0x3ae704[_0xf54e('0x2f')]);if(_0x3169dd[_0xf54e('0x2b')]>0x0){return _0x12edc3[_0xf54e('0x1a')](0x190)[_0xf54e('0x30')](_0x3169dd);}var _0x576b46=_0x3ae704['body']['userId'];var _0x3c0cca=_0x3ae704[_0xf54e('0x2f')][_0xf54e('0x31')];var _0x399e68=_0x3ae704[_0xf54e('0x2f')][_0xf54e('0x32')];var _0x49ba1c=_0x3ae704['body']['callbackUrl'];return getAgent(_0x576b46)[_0xf54e('0x1e')](function(_0x734187){logger['info']('entityFound:',_0x734187[_0xf54e('0x19')]);emit(util[_0xf54e('0x33')](_0xf54e('0x34'),_0x734187['name']),_0xf54e('0x35'),{'callNumber':_0x3c0cca,'callerId':_0x399e68,'callbackUrl':_0x49ba1c});return _0x12edc3[_0xf54e('0x1a')](0xc8)['json']({'error':![],'message':_0xf54e('0x36')});})[_0xf54e('0x22')](handleError(_0x12edc3));};exports[_0xf54e('0x37')]=function(_0x1eeeb4,_0x12ef97){logger[_0xf54e('0x12')]('hangup\x20fired:',_0x1eeeb4['body']);var _0x3d5a68=hangupValidation[_0xf54e('0x38')](_0x1eeeb4[_0xf54e('0x2f')]);if(_0x3d5a68['length']>0x0){return _0x12ef97[_0xf54e('0x1a')](0x190)[_0xf54e('0x30')](_0x3d5a68);}var _0x448054=_0x1eeeb4[_0xf54e('0x2f')][_0xf54e('0x39')];var _0x23f297=_0x1eeeb4[_0xf54e('0x2f')][_0xf54e('0x2a')];return getAgent(_0x448054)[_0xf54e('0x1e')](function(_0x2087b3){logger[_0xf54e('0x12')](_0xf54e('0x3a'),_0x2087b3[_0xf54e('0x19')]);emit(util[_0xf54e('0x33')](_0xf54e('0x34'),_0x2087b3['name']),'webbar:hangup',{'sessionId':_0x23f297});return _0x12ef97['status'](0xc8)[_0xf54e('0x30')]({'error':![],'message':_0xf54e('0x3b')});})['catch'](handleError(_0x12ef97));};exports[_0xf54e('0x3c')]=function(_0x311ce1,_0x381c03){logger['info'](_0xf54e('0x3d'),_0x311ce1[_0xf54e('0x2f')]);var _0x1e016e=answerValidation[_0xf54e('0x38')](_0x311ce1[_0xf54e('0x2f')]);if(_0x1e016e[_0xf54e('0x2b')]>0x0){return _0x381c03[_0xf54e('0x1a')](0x190)[_0xf54e('0x30')](_0x1e016e);}var _0x5b4ea1=_0x311ce1['body'][_0xf54e('0x39')];var _0x3447fd=_0x311ce1[_0xf54e('0x2f')][_0xf54e('0x2a')];return getAgent(_0x5b4ea1)[_0xf54e('0x1e')](function(_0x2fce4f){logger['info'](_0xf54e('0x3a'),_0x2fce4f['name']);emit(util[_0xf54e('0x33')]('user:%s',_0x2fce4f[_0xf54e('0x19')]),_0xf54e('0x3e'),{'sessionId':_0x3447fd});return _0x381c03[_0xf54e('0x1a')](0xc8)['json']({'error':![],'message':_0xf54e('0x3f')});})[_0xf54e('0x22')](handleError(_0x381c03));};exports[_0xf54e('0x40')]=function(_0x32fb46,_0x3a5a87){logger['info'](_0xf54e('0x41'),_0x32fb46[_0xf54e('0x2f')]);var _0x346bb4=holdValidation[_0xf54e('0x38')](_0x32fb46['body']);if(_0x346bb4[_0xf54e('0x2b')]>0x0){return _0x3a5a87[_0xf54e('0x1a')](0x190)['json'](_0x346bb4);}var _0x22c842=_0x32fb46[_0xf54e('0x2f')][_0xf54e('0x39')];var _0xca0141=_0x32fb46['body'][_0xf54e('0x2a')];return getAgent(_0x22c842)[_0xf54e('0x1e')](function(_0x2527f6){logger[_0xf54e('0x12')](_0xf54e('0x3a'),_0x2527f6[_0xf54e('0x19')]);emit(util[_0xf54e('0x33')](_0xf54e('0x34'),_0x2527f6[_0xf54e('0x19')]),_0xf54e('0x42'),{'sessionId':_0xca0141});return _0x3a5a87[_0xf54e('0x1a')](0xc8)[_0xf54e('0x30')]({'error':![],'message':_0xf54e('0x43')});})[_0xf54e('0x22')](handleError(_0x3a5a87));};exports[_0xf54e('0x44')]=function(_0xa6c305,_0x40d8ab){logger[_0xf54e('0x12')](_0xf54e('0x45'),_0xa6c305[_0xf54e('0x2f')]);var _0x4e25e4=unholdValidation['validate'](_0xa6c305[_0xf54e('0x2f')]);if(_0x4e25e4[_0xf54e('0x2b')]>0x0){return _0x40d8ab[_0xf54e('0x1a')](0x190)[_0xf54e('0x30')](_0x4e25e4);}var _0xba297c=_0xa6c305[_0xf54e('0x2f')][_0xf54e('0x39')];var _0x149d0b=_0xa6c305[_0xf54e('0x2f')][_0xf54e('0x2a')];return getAgent(_0xba297c)[_0xf54e('0x1e')](function(_0x59c313){logger[_0xf54e('0x12')](_0xf54e('0x3a'),_0x59c313[_0xf54e('0x19')]);emit(util[_0xf54e('0x33')](_0xf54e('0x34'),_0x59c313[_0xf54e('0x19')]),_0xf54e('0x46'),{'sessionId':_0x149d0b});return _0x40d8ab['status'](0xc8)[_0xf54e('0x30')]({'error':![],'message':_0xf54e('0x47')});})[_0xf54e('0x22')](handleError(_0x40d8ab));};exports['calls']=function(_0x3ce832,_0x54ac1a){logger[_0xf54e('0x12')](_0xf54e('0x48'),_0x54ac1a[_0xf54e('0x2f')]);var _0x5b882f=callsValidation[_0xf54e('0x38')](_0x3ce832[_0xf54e('0x2f')]);if(_0x5b882f[_0xf54e('0x2b')]>0x0){return _0x54ac1a[_0xf54e('0x1a')](0x190)[_0xf54e('0x30')](_0x5b882f);}var _0x2ec72a=_0x3ce832[_0xf54e('0x2f')]['userId'];var _0x55de5c=respondWithRpcPromise(_0xf54e('0x26'));var _0x9ab4c4=getAgent(_0x2ec72a);return Promise['all']([_0x55de5c,_0x9ab4c4])[_0xf54e('0x1e')](function(_0x49fd97){var _0xf39552=_0x49fd97[0x0];var _0x528a64=_0x49fd97[0x1];var _0x324167=_[_0xf54e('0x49')](_0xf39552[_0xf54e('0x28')],function(_0x241198){return _0x241198[_0xf54e('0x29')]==_0x528a64['id'];});return _0x54ac1a[_0xf54e('0x1a')](0xc8)['json']({'count':_0x324167['length'],'rows':_0x324167});})[_0xf54e('0x22')](handleError(_0x54ac1a));};exports[_0xf54e('0x4a')]=function(_0x493011,_0x57a48e){logger[_0xf54e('0x12')]('conference\x20fired:',_0x493011[_0xf54e('0x2f')]);var _0x43f9bf=conferenceValidation[_0xf54e('0x38')](_0x493011[_0xf54e('0x2f')]);if(_0x43f9bf[_0xf54e('0x2b')]>0x0){return _0x57a48e[_0xf54e('0x1a')](0x190)[_0xf54e('0x30')](_0x43f9bf);}var _0x3d706a=_0x493011[_0xf54e('0x2f')][_0xf54e('0x39')];return getAgent(_0x3d706a)[_0xf54e('0x1e')](function(_0x2c6d0e){logger[_0xf54e('0x12')](_0xf54e('0x3a'),_0x2c6d0e['name']);emit(util[_0xf54e('0x33')](_0xf54e('0x34'),_0x2c6d0e[_0xf54e('0x19')]),_0xf54e('0x4b'));return _0x57a48e[_0xf54e('0x1a')](0xc8)['json']({'error':![],'message':_0xf54e('0x4c')});})[_0xf54e('0x22')](handleError(_0x57a48e));};exports['transfer']=function(_0x51ec35,_0x2818cf){logger['info'](_0xf54e('0x4d'),_0x51ec35[_0xf54e('0x2f')]);var _0x105cf4=transferValidation[_0xf54e('0x38')](_0x51ec35['body']);if(_0x105cf4[_0xf54e('0x2b')]>0x0){return _0x2818cf['status'](0x190)[_0xf54e('0x30')](_0x105cf4);}var _0x3759d4=_0x51ec35[_0xf54e('0x2f')]['userId'];var _0x2d04db=_0x51ec35['body'][_0xf54e('0x2a')];var _0x3e2101=_0x51ec35['body'][_0xf54e('0x4e')];return getAgent(_0x3759d4)['then'](function(_0x3aa7e5){logger[_0xf54e('0x12')](_0xf54e('0x3a'),_0x3aa7e5[_0xf54e('0x19')]);emit(util[_0xf54e('0x33')]('user:%s',_0x3aa7e5[_0xf54e('0x19')]),_0xf54e('0x4f'),{'sessionId':_0x2d04db,'transferNumber':_0x3e2101});return _0x2818cf['status'](0xc8)[_0xf54e('0x30')]({'error':![],'message':_0xf54e('0x50')});})['catch'](handleError(_0x2818cf));}; \ No newline at end of file +var _0xb2b3=['rows','sessionId','\x20not\x20found!','originate','body','length','json','userId','callNumber','callerId','callbackUrl','entityFound:','format','user:%s','webbar:originate','hangup','hangup\x20fired:','webbar:hangup','hangup\x20executed!','answer','webbar:answer','hold\x20fired:','webbar:hold','unhold','unhold\x20fired:','webbar:unhold','unhold\x20executed!','all','UserId','conference','webbar:conference','conference\x20executed!','transfer','transfer\x20fired:','transferNumber','webbar:transfer','transfer\x20executed!','path','lodash','../../mysqldb','../../config/environment','util','bluebird','jayson/promise','http','../../config/logger','webbarapi','ioredis','redis','defaults','localhost','socket.io-emitter','validate','number','string','callNumber\x20is\x20required','userId\x20is\x20required','sessionId\x20is\x20required','transferNumber\x20is\x20required','info','stringify','handleError:','error','name','status','send','NotFound','request','then','code','message','catch','User','findOne','agent','filter'];(function(_0x714e4e,_0x220d25){var _0x10552a=function(_0xffcb35){while(--_0xffcb35){_0x714e4e['push'](_0x714e4e['shift']());}};_0x10552a(++_0x220d25);}(_0xb2b3,0x71));var _0x3b2b=function(_0x27d5a3,_0x37678a){_0x27d5a3=_0x27d5a3-0x0;var _0x50c297=_0xb2b3[_0x27d5a3];return _0x50c297;};'use strict';var path=require(_0x3b2b('0x0'));var fs=require('fs');var _=require(_0x3b2b('0x1'));var db=require(_0x3b2b('0x2'))['db'];var config=require(_0x3b2b('0x3'));var util=require(_0x3b2b('0x4'));var BPromise=require(_0x3b2b('0x5'));var jayson=require(_0x3b2b('0x6'));var amiClient=jayson['client'][_0x3b2b('0x7')]({'port':0x232a});var logger=require(_0x3b2b('0x8'))(_0x3b2b('0x9'));var Redis=require(_0x3b2b('0xa'));config[_0x3b2b('0xb')]=_[_0x3b2b('0xc')](config[_0x3b2b('0xb')],{'host':_0x3b2b('0xd'),'port':0x18eb});var io=require(_0x3b2b('0xe'))(new Redis(config[_0x3b2b('0xb')]));var Schema=require(_0x3b2b('0xf'));var originateValidation=new Schema({'userId':{'type':_0x3b2b('0x10'),'required':[!![],'userId\x20is\x20required']},'callNumber':{'type':_0x3b2b('0x11'),'required':[!![],_0x3b2b('0x12')]},'callerId':{'type':_0x3b2b('0x11')},'callbackUrl':{'type':_0x3b2b('0x11')}});var hangupValidation=new Schema({'userId':{'type':_0x3b2b('0x10'),'required':[!![],_0x3b2b('0x13')]},'sessionId':{'type':'string','required':![]}});var answerValidation=new Schema({'userId':{'type':'number','required':[!![],_0x3b2b('0x13')]},'sessionId':{'type':_0x3b2b('0x11'),'required':![]}});var transferValidation=new Schema({'userId':{'type':_0x3b2b('0x10'),'required':[!![],_0x3b2b('0x13')]},'sessionId':{'type':'string','required':[!![],_0x3b2b('0x14')]},'transferNumber':{'type':_0x3b2b('0x11'),'required':[!![],_0x3b2b('0x15')]}});var holdValidation=new Schema({'userId':{'type':_0x3b2b('0x10'),'required':[!![],_0x3b2b('0x13')]},'sessionId':{'type':_0x3b2b('0x11'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':'number','required':[!![],_0x3b2b('0x13')]},'sessionId':{'type':_0x3b2b('0x11'),'required':![]}});var callsValidation=new Schema({'userId':{'type':'number','required':[!![],_0x3b2b('0x13')]}});var conferenceValidation=new Schema({'userId':{'type':_0x3b2b('0x10'),'required':[!![],_0x3b2b('0x13')]}});function emit(_0x5593e4,_0x2ab175,_0x4d17c5){logger[_0x3b2b('0x16')](_0x5593e4,_0x2ab175,JSON[_0x3b2b('0x17')](_0x4d17c5));io['to'](_0x5593e4)['emit'](_0x2ab175,_0x4d17c5);}function handleError(_0x4a04e4){return function(_0x1a3bfb){console['log'](_0x3b2b('0x18'),_0x1a3bfb,_0x1a3bfb instanceof RangeError);logger[_0x3b2b('0x19')](_0x1a3bfb['stack']);if(_0x1a3bfb instanceof RangeError){if(_0x1a3bfb[_0x3b2b('0x1a')]){delete _0x1a3bfb['name'];}_0x4a04e4[_0x3b2b('0x1b')](0x194)[_0x3b2b('0x1c')](_0x1a3bfb);}else{if(_0x1a3bfb['name']){delete _0x1a3bfb['name'];}_0x4a04e4[_0x3b2b('0x1b')](0x1f4)[_0x3b2b('0x1c')](_0x1a3bfb);}};}function checkError(){return function(_0x21479e){if(!_0x21479e){throw new RangeError(_0x3b2b('0x1d'));}return _0x21479e;};}function respondWithRpcPromise(_0x3ad0b1,_0x330cd2){return new BPromise(function(_0x14a181,_0xc5b0bf){var _0x1273e7=amiClient;return _0x1273e7[_0x3b2b('0x1e')](_0x3ad0b1,_0x330cd2)[_0x3b2b('0x1f')](function(_0x4d5f70){if(_0x4d5f70[_0x3b2b('0x19')]){if(_0x4d5f70[_0x3b2b('0x19')][_0x3b2b('0x20')]===0x1f4){return _0xc5b0bf(_0x4d5f70['error'][_0x3b2b('0x21')]);}return _0x14a181(_0x4d5f70['error'][_0x3b2b('0x21')]);}else{_0x14a181(_0x4d5f70['result']);}})[_0x3b2b('0x22')](function(_0x5df93e){_0xc5b0bf(_0x5df93e);});});}function getAgent(_0x52da06){return db[_0x3b2b('0x23')][_0x3b2b('0x24')]({'where':{'id':_0x52da06,'role':_0x3b2b('0x25')}})[_0x3b2b('0x1f')](checkError());}function getAgentCheckSession(_0x73967,_0x156a3c){return new BPromise(function(_0x30574a,_0x185830){var _0x3c603a=respondWithRpcPromise('VoiceChannels');var _0x4ed952=getAgent(_0x73967);Promise['all']([_0x3c603a,_0x4ed952])['then'](function(_0x3e2177){var _0x2e4bc7=_0x3e2177[0x0];var _0x3a1ff8=_0x3e2177[0x1];var _0x4656df=_[_0x3b2b('0x26')](_0x2e4bc7[_0x3b2b('0x27')],function(_0x3acb5b){return _0x3acb5b['UserId']==_0x3a1ff8['id']&&_0x3acb5b[_0x3b2b('0x28')]==_0x156a3c;});if(_0x4656df['length']==0x1){_0x30574a(_0x3a1ff8);}else{_0x185830(new RangeError('sessionId\x20'+_0x156a3c+_0x3b2b('0x29')));}});});}exports[_0x3b2b('0x2a')]=function(_0x281f1a,_0x107285){logger['info']('originate\x20fired:',_0x281f1a[_0x3b2b('0x2b')]);var _0x3a7b4b=originateValidation[_0x3b2b('0xf')](_0x281f1a[_0x3b2b('0x2b')]);if(_0x3a7b4b[_0x3b2b('0x2c')]>0x0){return _0x107285['status'](0x190)[_0x3b2b('0x2d')](_0x3a7b4b);}var _0x5dde72=_0x281f1a[_0x3b2b('0x2b')][_0x3b2b('0x2e')];var _0x134e84=_0x281f1a[_0x3b2b('0x2b')][_0x3b2b('0x2f')];var _0x3fd26f=_0x281f1a[_0x3b2b('0x2b')][_0x3b2b('0x30')];var _0x5aa5e6=_0x281f1a['body'][_0x3b2b('0x31')];return getAgent(_0x5dde72)['then'](function(_0x186e39){logger[_0x3b2b('0x16')](_0x3b2b('0x32'),_0x186e39[_0x3b2b('0x1a')]);emit(util[_0x3b2b('0x33')](_0x3b2b('0x34'),_0x186e39[_0x3b2b('0x1a')]),_0x3b2b('0x35'),{'callNumber':_0x134e84,'callerId':_0x3fd26f,'callbackUrl':_0x5aa5e6});return _0x107285[_0x3b2b('0x1b')](0xc8)[_0x3b2b('0x2d')]({'error':![],'message':'originate\x20executed!'});})[_0x3b2b('0x22')](handleError(_0x107285));};exports[_0x3b2b('0x36')]=function(_0x423421,_0x41a6f1){logger[_0x3b2b('0x16')](_0x3b2b('0x37'),_0x423421[_0x3b2b('0x2b')]);var _0x3f38a7=hangupValidation[_0x3b2b('0xf')](_0x423421[_0x3b2b('0x2b')]);if(_0x3f38a7[_0x3b2b('0x2c')]>0x0){return _0x41a6f1[_0x3b2b('0x1b')](0x190)[_0x3b2b('0x2d')](_0x3f38a7);}var _0x2a06c4=_0x423421['body'][_0x3b2b('0x2e')];var _0x3abf66=_0x423421[_0x3b2b('0x2b')][_0x3b2b('0x28')];return getAgent(_0x2a06c4)[_0x3b2b('0x1f')](function(_0x25d693){logger[_0x3b2b('0x16')]('entityFound:',_0x25d693['name']);emit(util[_0x3b2b('0x33')]('user:%s',_0x25d693[_0x3b2b('0x1a')]),_0x3b2b('0x38'),{'sessionId':_0x3abf66});return _0x41a6f1[_0x3b2b('0x1b')](0xc8)[_0x3b2b('0x2d')]({'error':![],'message':_0x3b2b('0x39')});})[_0x3b2b('0x22')](handleError(_0x41a6f1));};exports[_0x3b2b('0x3a')]=function(_0x18de93,_0x580177){logger['info']('answer\x20fired:',_0x18de93[_0x3b2b('0x2b')]);var _0x3dd5c8=answerValidation[_0x3b2b('0xf')](_0x18de93[_0x3b2b('0x2b')]);if(_0x3dd5c8[_0x3b2b('0x2c')]>0x0){return _0x580177[_0x3b2b('0x1b')](0x190)['json'](_0x3dd5c8);}var _0x26064c=_0x18de93['body'][_0x3b2b('0x2e')];var _0xece0c7=_0x18de93[_0x3b2b('0x2b')][_0x3b2b('0x28')];return getAgent(_0x26064c)[_0x3b2b('0x1f')](function(_0x4832c9){logger[_0x3b2b('0x16')]('entityFound:',_0x4832c9[_0x3b2b('0x1a')]);emit(util['format'](_0x3b2b('0x34'),_0x4832c9[_0x3b2b('0x1a')]),_0x3b2b('0x3b'),{'sessionId':_0xece0c7});return _0x580177[_0x3b2b('0x1b')](0xc8)['json']({'error':![],'message':'answer\x20executed!'});})[_0x3b2b('0x22')](handleError(_0x580177));};exports['hold']=function(_0x39c8dc,_0x1eb25e){logger['info'](_0x3b2b('0x3c'),_0x39c8dc['body']);var _0x3db4a4=holdValidation[_0x3b2b('0xf')](_0x39c8dc[_0x3b2b('0x2b')]);if(_0x3db4a4[_0x3b2b('0x2c')]>0x0){return _0x1eb25e[_0x3b2b('0x1b')](0x190)['json'](_0x3db4a4);}var _0x533b74=_0x39c8dc[_0x3b2b('0x2b')][_0x3b2b('0x2e')];var _0x4d73b9=_0x39c8dc[_0x3b2b('0x2b')][_0x3b2b('0x28')];return getAgent(_0x533b74)[_0x3b2b('0x1f')](function(_0x25a6d1){logger[_0x3b2b('0x16')](_0x3b2b('0x32'),_0x25a6d1[_0x3b2b('0x1a')]);emit(util[_0x3b2b('0x33')](_0x3b2b('0x34'),_0x25a6d1[_0x3b2b('0x1a')]),_0x3b2b('0x3d'),{'sessionId':_0x4d73b9});return _0x1eb25e[_0x3b2b('0x1b')](0xc8)[_0x3b2b('0x2d')]({'error':![],'message':'hold\x20executed!'});})[_0x3b2b('0x22')](handleError(_0x1eb25e));};exports[_0x3b2b('0x3e')]=function(_0x4c46db,_0xc6d4c7){logger[_0x3b2b('0x16')](_0x3b2b('0x3f'),_0x4c46db[_0x3b2b('0x2b')]);var _0x595b5b=unholdValidation[_0x3b2b('0xf')](_0x4c46db[_0x3b2b('0x2b')]);if(_0x595b5b[_0x3b2b('0x2c')]>0x0){return _0xc6d4c7[_0x3b2b('0x1b')](0x190)[_0x3b2b('0x2d')](_0x595b5b);}var _0x200b5d=_0x4c46db[_0x3b2b('0x2b')][_0x3b2b('0x2e')];var _0x196404=_0x4c46db[_0x3b2b('0x2b')][_0x3b2b('0x28')];return getAgent(_0x200b5d)[_0x3b2b('0x1f')](function(_0x2d72de){logger['info'](_0x3b2b('0x32'),_0x2d72de[_0x3b2b('0x1a')]);emit(util['format'](_0x3b2b('0x34'),_0x2d72de[_0x3b2b('0x1a')]),_0x3b2b('0x40'),{'sessionId':_0x196404});return _0xc6d4c7[_0x3b2b('0x1b')](0xc8)[_0x3b2b('0x2d')]({'error':![],'message':_0x3b2b('0x41')});})['catch'](handleError(_0xc6d4c7));};exports['calls']=function(_0x3210ae,_0x3582db){logger[_0x3b2b('0x16')]('calls\x20fired:',_0x3582db[_0x3b2b('0x2b')]);var _0x187d6f=callsValidation[_0x3b2b('0xf')](_0x3210ae[_0x3b2b('0x2b')]);if(_0x187d6f['length']>0x0){return _0x3582db[_0x3b2b('0x1b')](0x190)[_0x3b2b('0x2d')](_0x187d6f);}var _0x725269=_0x3210ae[_0x3b2b('0x2b')][_0x3b2b('0x2e')];var _0x3de4ad=respondWithRpcPromise('VoiceChannels');var _0x9ec07f=getAgent(_0x725269);return Promise[_0x3b2b('0x42')]([_0x3de4ad,_0x9ec07f])['then'](function(_0x4ee27e){var _0x45d910=_0x4ee27e[0x0];var _0x5d5dce=_0x4ee27e[0x1];var _0x2e63ae=_[_0x3b2b('0x26')](_0x45d910[_0x3b2b('0x27')],function(_0x426593){return _0x426593[_0x3b2b('0x43')]==_0x5d5dce['id'];});return _0x3582db[_0x3b2b('0x1b')](0xc8)[_0x3b2b('0x2d')]({'count':_0x2e63ae[_0x3b2b('0x2c')],'rows':_0x2e63ae});})['catch'](handleError(_0x3582db));};exports[_0x3b2b('0x44')]=function(_0x5bb885,_0x21dc26){logger[_0x3b2b('0x16')]('conference\x20fired:',_0x5bb885['body']);var _0x175d0b=conferenceValidation['validate'](_0x5bb885['body']);if(_0x175d0b[_0x3b2b('0x2c')]>0x0){return _0x21dc26['status'](0x190)[_0x3b2b('0x2d')](_0x175d0b);}var _0x583b52=_0x5bb885[_0x3b2b('0x2b')][_0x3b2b('0x2e')];return getAgent(_0x583b52)[_0x3b2b('0x1f')](function(_0x162708){logger['info']('entityFound:',_0x162708[_0x3b2b('0x1a')]);emit(util[_0x3b2b('0x33')]('user:%s',_0x162708[_0x3b2b('0x1a')]),_0x3b2b('0x45'));return _0x21dc26['status'](0xc8)[_0x3b2b('0x2d')]({'error':![],'message':_0x3b2b('0x46')});})['catch'](handleError(_0x21dc26));};exports[_0x3b2b('0x47')]=function(_0x18e0e4,_0x1db938){logger[_0x3b2b('0x16')](_0x3b2b('0x48'),_0x18e0e4[_0x3b2b('0x2b')]);var _0x380a78=transferValidation['validate'](_0x18e0e4[_0x3b2b('0x2b')]);if(_0x380a78[_0x3b2b('0x2c')]>0x0){return _0x1db938['status'](0x190)['json'](_0x380a78);}var _0x1fd556=_0x18e0e4['body'][_0x3b2b('0x2e')];var _0x191c6c=_0x18e0e4[_0x3b2b('0x2b')][_0x3b2b('0x28')];var _0x32f21d=_0x18e0e4[_0x3b2b('0x2b')][_0x3b2b('0x49')];return getAgent(_0x1fd556)[_0x3b2b('0x1f')](function(_0x427a16){logger[_0x3b2b('0x16')](_0x3b2b('0x32'),_0x427a16['name']);emit(util[_0x3b2b('0x33')](_0x3b2b('0x34'),_0x427a16[_0x3b2b('0x1a')]),_0x3b2b('0x4a'),{'sessionId':_0x191c6c,'transferNumber':_0x32f21d});return _0x1db938[_0x3b2b('0x1b')](0xc8)[_0x3b2b('0x2d')]({'error':![],'message':_0x3b2b('0x4b')});})['catch'](handleError(_0x1db938));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/index.js b/server/api/whatsappAccount/index.js index 8952611..27a83d9 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 _0xf343=['notify','/:id/send','send','update','delete','destroy','removeDispositions','removeAnswers','removeAgents','multer','util','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./whatsappAccount.controller','get','isAuthenticated','/describe','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','getAgents','/:id/applications','getApplications','post','create','addAnswer','/:id/users','addAgents','addApplications','/:id/notify'];(function(_0x256b72,_0x340985){var _0x2183e3=function(_0xf7fd37){while(--_0xf7fd37){_0x256b72['push'](_0x256b72['shift']());}};_0x2183e3(++_0x340985);}(_0xf343,0x171));var _0x3f34=function(_0x482ca8,_0x4a68cd){_0x482ca8=_0x482ca8-0x0;var _0x24f233=_0xf343[_0x482ca8];return _0x24f233;};'use strict';var multer=require(_0x3f34('0x0'));var util=require(_0x3f34('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x3f34('0x2')]();var fs_extra=require(_0x3f34('0x3'));var auth=require(_0x3f34('0x4'));var interaction=require(_0x3f34('0x5'));var config=require('../../config/environment');var controller=require(_0x3f34('0x6'));router[_0x3f34('0x7')]('/',auth[_0x3f34('0x8')](),controller['index']);router[_0x3f34('0x7')](_0x3f34('0x9'),auth[_0x3f34('0x8')](),controller[_0x3f34('0xa')]);router[_0x3f34('0x7')](_0x3f34('0xb'),auth[_0x3f34('0x8')](),controller[_0x3f34('0xc')]);router[_0x3f34('0x7')](_0x3f34('0xd'),auth[_0x3f34('0x8')](),controller[_0x3f34('0xe')]);router[_0x3f34('0x7')](_0x3f34('0xf'),auth[_0x3f34('0x8')](),controller[_0x3f34('0x10')]);router[_0x3f34('0x7')]('/:id/users',auth[_0x3f34('0x8')](),controller[_0x3f34('0x11')]);router[_0x3f34('0x7')](_0x3f34('0x12'),auth[_0x3f34('0x8')](),controller[_0x3f34('0x13')]);router[_0x3f34('0x14')]('/',auth[_0x3f34('0x8')](),controller[_0x3f34('0x15')]);router[_0x3f34('0x14')](_0x3f34('0xd'),auth[_0x3f34('0x8')](),controller['addDisposition']);router[_0x3f34('0x14')](_0x3f34('0xf'),auth[_0x3f34('0x8')](),controller[_0x3f34('0x16')]);router[_0x3f34('0x14')](_0x3f34('0x17'),auth['isAuthenticated'](),controller[_0x3f34('0x18')]);router[_0x3f34('0x14')](_0x3f34('0x12'),auth[_0x3f34('0x8')](),controller[_0x3f34('0x19')]);router['post'](_0x3f34('0x1a'),controller[_0x3f34('0x1b')]);router[_0x3f34('0x14')](_0x3f34('0x1c'),auth['isAuthenticated'](),controller[_0x3f34('0x1d')]);router['put'](_0x3f34('0xb'),auth[_0x3f34('0x8')](),controller[_0x3f34('0x1e')]);router[_0x3f34('0x1f')](_0x3f34('0xb'),auth[_0x3f34('0x8')](),controller[_0x3f34('0x20')]);router['delete'](_0x3f34('0xd'),auth[_0x3f34('0x8')](),controller[_0x3f34('0x21')]);router[_0x3f34('0x1f')]('/:id/canned_answers',auth['isAuthenticated'](),controller[_0x3f34('0x22')]);router[_0x3f34('0x1f')]('/:id/users',auth['isAuthenticated'](),controller[_0x3f34('0x23')]);module['exports']=router; \ No newline at end of file +var _0x2795=['delete','/:id','destroy','removeAnswers','removeAgents','exports','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','get','index','isAuthenticated','describe','show','/:id/dispositions','/:id/canned_answers','/:id/users','getAgents','/:id/applications','getApplications','post','create','addDisposition','addAnswer','addAgents','addApplications','/:id/notify','put','update'];(function(_0x2f3467,_0x33b18c){var _0x33b1de=function(_0x4fccf3){while(--_0x4fccf3){_0x2f3467['push'](_0x2f3467['shift']());}};_0x33b1de(++_0x33b18c);}(_0x2795,0x1e6));var _0x5279=function(_0x1cb554,_0x5c0f19){_0x1cb554=_0x1cb554-0x0;var _0x36917e=_0x2795[_0x1cb554];return _0x36917e;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x5279('0x0'));var timeout=require(_0x5279('0x1'));var express=require(_0x5279('0x2'));var router=express['Router']();var fs_extra=require(_0x5279('0x3'));var auth=require(_0x5279('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x5279('0x5'));var controller=require('./whatsappAccount.controller');router[_0x5279('0x6')]('/',auth['isAuthenticated'](),controller[_0x5279('0x7')]);router[_0x5279('0x6')]('/describe',auth[_0x5279('0x8')](),controller[_0x5279('0x9')]);router[_0x5279('0x6')]('/:id',auth['isAuthenticated'](),controller[_0x5279('0xa')]);router[_0x5279('0x6')](_0x5279('0xb'),auth[_0x5279('0x8')](),controller['getDispositions']);router['get'](_0x5279('0xc'),auth[_0x5279('0x8')](),controller['getAnswers']);router['get'](_0x5279('0xd'),auth[_0x5279('0x8')](),controller[_0x5279('0xe')]);router[_0x5279('0x6')](_0x5279('0xf'),auth[_0x5279('0x8')](),controller[_0x5279('0x10')]);router[_0x5279('0x11')]('/',auth[_0x5279('0x8')](),controller[_0x5279('0x12')]);router[_0x5279('0x11')](_0x5279('0xb'),auth[_0x5279('0x8')](),controller[_0x5279('0x13')]);router[_0x5279('0x11')]('/:id/canned_answers',auth[_0x5279('0x8')](),controller[_0x5279('0x14')]);router[_0x5279('0x11')]('/:id/users',auth[_0x5279('0x8')](),controller[_0x5279('0x15')]);router[_0x5279('0x11')](_0x5279('0xf'),auth[_0x5279('0x8')](),controller[_0x5279('0x16')]);router['post'](_0x5279('0x17'),controller['notify']);router['post']('/:id/send',auth['isAuthenticated'](),controller['send']);router[_0x5279('0x18')]('/:id',auth[_0x5279('0x8')](),controller[_0x5279('0x19')]);router[_0x5279('0x1a')](_0x5279('0x1b'),auth[_0x5279('0x8')](),controller[_0x5279('0x1c')]);router[_0x5279('0x1a')](_0x5279('0xb'),auth[_0x5279('0x8')](),controller['removeDispositions']);router[_0x5279('0x1a')](_0x5279('0xc'),auth[_0x5279('0x8')](),controller[_0x5279('0x1d')]);router['delete'](_0x5279('0xd'),auth[_0x5279('0x8')](),controller[_0x5279('0x1e')]);module[_0x5279('0x1f')]=router; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.attributes.js b/server/api/whatsappAccount/whatsappAccount.attributes.js index b54588c..828ffbc 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 _0x9979=['BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','randomstring','exports','STRING','name','TEXT'];(function(_0x3f5bbb,_0x217812){var _0x3b67c8=function(_0x39e308){while(--_0x39e308){_0x3f5bbb['push'](_0x3f5bbb['shift']());}};_0x3b67c8(++_0x217812);}(_0x9979,0x166));var _0x9997=function(_0x3f807d,_0x32a3b1){_0x3f807d=_0x3f807d-0x0;var _0x45ad62=_0x9979[_0x3f807d];return _0x45ad62;};'use strict';var Sequelize=require(_0x9997('0x0'));var rs=require(_0x9997('0x1'));module[_0x9997('0x2')]={'name':{'type':Sequelize[_0x9997('0x3')],'unique':_0x9997('0x4'),'allowNull':![]},'key':{'type':Sequelize[_0x9997('0x3')],'allowNull':![]},'remote':{'type':Sequelize['STRING'],'allowNull':![]},'token':{'type':Sequelize[_0x9997('0x3')],'defaultValue':function(){return rs['generate']();}},'phone':{'type':Sequelize[_0x9997('0x3')]},'type':{'type':Sequelize['ENUM']('twilio','sinch')},'accountSid':{'type':Sequelize['STRING']},'baseUrl':{'type':Sequelize[_0x9997('0x3')]},'authToken':{'type':Sequelize[_0x9997('0x3')]},'notificationTemplate':{'type':Sequelize[_0x9997('0x5')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0x9997('0x6')],'defaultValue':![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x9997('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x9997('0x6')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x9997('0x6')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x9997('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x9997('0x7')],'comment':_0x9997('0x8')},'mandatoryDisposition':{'type':Sequelize[_0x9997('0x6')],'defaultValue':![],'comment':_0x9997('0x9'),'set':function(_0x4bb08b){if(!_0x4bb08b){this[_0x9997('0xa')](_0x9997('0xb'),null);}this[_0x9997('0xa')](_0x9997('0xc'),_0x4bb08b);}},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x3d3d=['TEXT','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','mandatoryDispositionPauseId','setDataValue','randomstring','exports','STRING','name','generate','ENUM','twilio','sinch'];(function(_0x50e51a,_0x39e949){var _0xe02402=function(_0xbc177a){while(--_0xbc177a){_0x50e51a['push'](_0x50e51a['shift']());}};_0xe02402(++_0x39e949);}(_0x3d3d,0x12c));var _0xd3d3=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3d3d[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');var rs=require(_0xd3d3('0x0'));module[_0xd3d3('0x1')]={'name':{'type':Sequelize[_0xd3d3('0x2')],'unique':_0xd3d3('0x3'),'allowNull':![]},'key':{'type':Sequelize[_0xd3d3('0x2')],'allowNull':![]},'remote':{'type':Sequelize[_0xd3d3('0x2')],'allowNull':![]},'token':{'type':Sequelize[_0xd3d3('0x2')],'defaultValue':function(){return rs[_0xd3d3('0x4')]();}},'phone':{'type':Sequelize[_0xd3d3('0x2')]},'type':{'type':Sequelize[_0xd3d3('0x5')](_0xd3d3('0x6'),_0xd3d3('0x7'))},'accountSid':{'type':Sequelize[_0xd3d3('0x2')]},'baseUrl':{'type':Sequelize['STRING']},'authToken':{'type':Sequelize[_0xd3d3('0x2')]},'notificationTemplate':{'type':Sequelize[_0xd3d3('0x8')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0xd3d3('0x9')],'defaultValue':![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xd3d3('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0xd3d3('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xd3d3('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xd3d3('0x9')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xd3d3('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':_0xd3d3('0xb')},'mandatoryDisposition':{'type':Sequelize[_0xd3d3('0x9')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x30a2aa){if(!_0x30a2aa){this['setDataValue'](_0xd3d3('0xc'),null);}this[_0xd3d3('0xd')]('mandatoryDisposition',_0x30a2aa);}},'description':{'type':Sequelize[_0xd3d3('0x2')]}}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.controller.js b/server/api/whatsappAccount/whatsappAccount.controller.js index 250615e..94fe76d 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 _0xa30e=['bulkCreate','findAndCountAll','priority','finally','getApplications','notify','whatsapp','Applications','account','sinch','statuses','state','message_id','applications','orderBy','asc','CmContact','describe','Sequelize','ValidationError','difference','createdAt','updatedAt','CompanyId','ListId','mobile','twilio','from','From','replace','whatsapp:','Body','MessageSid','notifications','messageId','from\x20is\x20mandatory','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','includes','CmList','DESC','list','omit','Contacts','contact','WhatsappInteraction','interaction','created','autoclose','close','unmanaged','WhatsappMessage','ContactId','AttachmentId','UserId','unshift','agent','*,*,*,*','queueId','waitForTheAssignedQueue','Start','startRouting','receiveMessage','entity\x20found','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','set','Content-Type','text/xml','\x0a','to\x20is\x20mandatory','List','Messages','dataValues','push','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./whatsappAccount.socket','jayson/promise','client','http','request','then','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','reject','save','update','get','WhatsappAccounts','UserProfileResource','destroy','stack','name','send','Pause','mandatoryDispositionPause','map','WhatsappAccount','rawAttributes','fieldName','type','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','VIRTUAL','filter','merge','options','includeAll','findAll','show','params','include','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','Disposition','getDispositions','findOne','WhatsappAccountId','removeDispositions','addAnswer','CannedAnswer','getAnswers','rows','removeAnswers','ids','addAgents','spread','emit','userWhatsappAccount:save','removeAgents','isArray','userWhatsappAccount:remove','getAgents','User','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','WhatsappApplication'];(function(_0x3d4ddb,_0x1c9228){var _0x46ea55=function(_0x5aea0d){while(--_0x5aea0d){_0x3d4ddb['push'](_0x3d4ddb['shift']());}};_0x46ea55(++_0x1c9228);}(_0xa30e,0x117));var _0xea30=function(_0x4b6847,_0x50c4d6){_0x4b6847=_0x4b6847-0x0;var _0x562863=_0xa30e[_0x4b6847];return _0x562863;};'use strict';var emlformat=require(_0xea30('0x0'));var rimraf=require(_0xea30('0x1'));var zipdir=require(_0xea30('0x2'));var jsonpatch=require(_0xea30('0x3'));var rp=require(_0xea30('0x4'));var moment=require(_0xea30('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0xea30('0x6'));var sox=require(_0xea30('0x7'));var csv=require(_0xea30('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xea30('0x9'));var _=require(_0xea30('0xa'));var squel=require(_0xea30('0xb'));var crypto=require(_0xea30('0xc'));var jsforce=require(_0xea30('0xd'));var deskjs=require(_0xea30('0xe'));var toCsv=require(_0xea30('0x8'));var querystring=require(_0xea30('0xf'));var Papa=require(_0xea30('0x10'));var Redis=require(_0xea30('0x11'));var authService=require(_0xea30('0x12'));var qs=require(_0xea30('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xea30('0x14'))(_0xea30('0x15'));var utils=require(_0xea30('0x16'));var config=require(_0xea30('0x17'));var licenseUtil=require(_0xea30('0x18'));var db=require(_0xea30('0x19'))['db'];config[_0xea30('0x1a')]=_[_0xea30('0x1b')](config[_0xea30('0x1a')],{'host':_0xea30('0x1c'),'port':0x18eb});var socket=require(_0xea30('0x1d'))(new Redis(config[_0xea30('0x1a')]));require(_0xea30('0x1e'))['register'](socket);var jayson=require(_0xea30('0x1f'));var client=jayson[_0xea30('0x20')][_0xea30('0x21')]({'port':0x232c});function respondWithRpcPromise(_0x54235a,_0x27e663,_0x4151a6,_0x1e2c8f){return new BPromise(function(_0x37498d,_0x3a2824){var _0x36212e=_0x1e2c8f||client;return _0x36212e[_0xea30('0x22')](_0x54235a,_0x4151a6)[_0xea30('0x23')](function(_0xb37dc8){logger[_0xea30('0x24')](_0xea30('0x25'),_0x27e663,_0xea30('0x26'));logger[_0xea30('0x27')](_0xea30('0x28'),_0x27e663,'request\x20sent',JSON[_0xea30('0x29')](_0xb37dc8));if(_0xb37dc8[_0xea30('0x2a')]){if(_0xb37dc8[_0xea30('0x2a')][_0xea30('0x2b')]===0x1f4){logger[_0xea30('0x2a')](_0xea30('0x25'),_0x27e663,_0xb37dc8[_0xea30('0x2a')][_0xea30('0x2c')]);return _0x3a2824(_0xb37dc8['error'][_0xea30('0x2c')]);}logger['error']('WhatsappAccount,\x20%s,\x20%s',_0x27e663,_0xb37dc8['error'][_0xea30('0x2c')]);return _0x37498d(_0xb37dc8[_0xea30('0x2a')][_0xea30('0x2c')]);}else{logger[_0xea30('0x24')](_0xea30('0x25'),_0x27e663,'request\x20sent');_0x37498d(_0xb37dc8[_0xea30('0x2d')][_0xea30('0x2c')]);}})[_0xea30('0x2e')](function(_0x2b7805){logger[_0xea30('0x2a')](_0xea30('0x25'),_0x27e663,_0x2b7805);_0x3a2824(_0x2b7805);});});}function respondWithStatusCode(_0x290986,_0x5adcb6){_0x5adcb6=_0x5adcb6||0xcc;return function(_0x49f6a9){if(_0x49f6a9){return _0x290986[_0xea30('0x2f')](_0x5adcb6);}return _0x290986[_0xea30('0x30')](_0x5adcb6)[_0xea30('0x31')]();};}function respondWithResult(_0x4e02df,_0x203554){_0x203554=_0x203554||0xc8;return function(_0x3c70dd){if(_0x3c70dd){return _0x4e02df[_0xea30('0x30')](_0x203554)[_0xea30('0x32')](_0x3c70dd);}};}function respondWithFilteredResult(_0x4a256e,_0x593e71){return function(_0x32d2f3){if(_0x32d2f3){var _0x144aaa=typeof _0x593e71[_0xea30('0x33')]===_0xea30('0x34')&&typeof _0x593e71[_0xea30('0x35')]===_0xea30('0x34');var _0x57d9bd=_0x32d2f3[_0xea30('0x36')];var _0xdcf47e=_0x144aaa?0x0:_0x593e71[_0xea30('0x33')];var _0x2e957a=_0x144aaa?_0x32d2f3[_0xea30('0x36')]:_0x593e71[_0xea30('0x33')]+_0x593e71[_0xea30('0x35')];var _0x9aecae;if(_0x2e957a>=_0x57d9bd){_0x2e957a=_0x57d9bd;_0x9aecae=0xc8;}else{_0x9aecae=0xce;}_0x4a256e[_0xea30('0x30')](_0x9aecae);return _0x4a256e['set']('Content-Range',_0xdcf47e+'-'+_0x2e957a+'/'+_0x57d9bd)[_0xea30('0x32')](_0x32d2f3);}return null;};}function patchUpdates(_0x45b77e){return function(_0x5a5b1f){try{jsonpatch['apply'](_0x5a5b1f,_0x45b77e,!![]);}catch(_0x171740){return BPromise[_0xea30('0x37')](_0x171740);}return _0x5a5b1f[_0xea30('0x38')]();};}function saveUpdates(_0x11bd4a,_0x3c881f){return function(_0x4fcc4d){if(_0x4fcc4d){return _0x4fcc4d[_0xea30('0x39')](_0x11bd4a)[_0xea30('0x23')](function(_0x2556e3){return _0x2556e3;});}return null;};}function removeEntity(_0x1d9007,_0x28bb4f){return function(_0x4adaa6){if(_0x4adaa6){return _0x4adaa6['destroy']()[_0xea30('0x23')](function(){var _0x454bb3=_0x4adaa6[_0xea30('0x3a')]({'plain':!![]});var _0x4474d2=_0xea30('0x3b');return db[_0xea30('0x3c')][_0xea30('0x3d')]({'where':{'type':_0x4474d2,'resourceId':_0x454bb3['id']}})[_0xea30('0x23')](function(){return _0x4adaa6;});})[_0xea30('0x23')](function(){_0x1d9007[_0xea30('0x30')](0xcc)[_0xea30('0x31')]();});}};}function handleEntityNotFound(_0x2fa047,_0x4aeb4d){return function(_0xabc0b3){if(!_0xabc0b3){_0x2fa047[_0xea30('0x2f')](0x194);}return _0xabc0b3;};}function handleError(_0x44f0c4,_0x496309){_0x496309=_0x496309||0x1f4;return function(_0x5795c6){logger[_0xea30('0x2a')](_0x5795c6[_0xea30('0x3e')]);if(_0x5795c6[_0xea30('0x3f')]){delete _0x5795c6[_0xea30('0x3f')];}_0x44f0c4[_0xea30('0x30')](_0x496309)[_0xea30('0x40')](_0x5795c6);};}exports['index']=function(_0x530790,_0x18c1d4){var _0x21881d={'include':[{'model':db[_0xea30('0x41')],'as':_0xea30('0x42')}]},_0x4ef63d={},_0x243f94={'count':0x0,'rows':[]};var _0x57326c=_[_0xea30('0x43')](db[_0xea30('0x44')][_0xea30('0x45')],function(_0x1dbd4e){return{'name':_0x1dbd4e[_0xea30('0x46')],'type':_0x1dbd4e[_0xea30('0x47')][_0xea30('0x48')]};});_0x4ef63d[_0xea30('0x49')]=_['map'](_0x57326c,_0xea30('0x3f'));_0x4ef63d[_0xea30('0x4a')]=_[_0xea30('0x4b')](_0x530790[_0xea30('0x4a')]);_0x4ef63d['filters']=_['intersection'](_0x4ef63d[_0xea30('0x49')],_0x4ef63d[_0xea30('0x4a')]);_0x21881d['attributes']=_[_0xea30('0x4c')](_0x4ef63d[_0xea30('0x49')],qs[_0xea30('0x4d')](_0x530790[_0xea30('0x4a')][_0xea30('0x4d')]));_0x21881d[_0xea30('0x4e')]=_0x21881d[_0xea30('0x4e')][_0xea30('0x4f')]?_0x21881d[_0xea30('0x4e')]:_0x4ef63d['model'];if(!_0x530790['query'][_0xea30('0x50')](_0xea30('0x51'))){_0x21881d['limit']=qs[_0xea30('0x35')](_0x530790[_0xea30('0x4a')][_0xea30('0x35')]);_0x21881d[_0xea30('0x33')]=qs[_0xea30('0x33')](_0x530790[_0xea30('0x4a')][_0xea30('0x33')]);}_0x21881d[_0xea30('0x52')]=qs[_0xea30('0x53')](_0x530790[_0xea30('0x4a')][_0xea30('0x53')]);_0x21881d[_0xea30('0x54')]=qs[_0xea30('0x55')](_[_0xea30('0x56')](_0x530790['query'],_0x4ef63d[_0xea30('0x55')]),_0x57326c);if(_0x530790['query']['filter']){_0x21881d[_0xea30('0x54')]=_['merge'](_0x21881d['where'],{'$or':_[_0xea30('0x43')](_0x57326c,function(_0x5500d6){if(_0x5500d6[_0xea30('0x47')]!==_0xea30('0x57')){var _0x22e665={};_0x22e665[_0x5500d6[_0xea30('0x3f')]]={'$like':'%'+_0x530790['query'][_0xea30('0x58')]+'%'};return _0x22e665;}})});}_0x21881d=_[_0xea30('0x59')]({},_0x21881d,_0x530790[_0xea30('0x5a')]);var _0x6945fa={'where':_0x21881d[_0xea30('0x54')]};return db[_0xea30('0x44')][_0xea30('0x36')](_0x6945fa)[_0xea30('0x23')](function(_0x35d17d){_0x243f94[_0xea30('0x36')]=_0x35d17d;if(_0x530790[_0xea30('0x4a')][_0xea30('0x5b')]){_0x21881d['include']=[{'all':!![]}];}return db['WhatsappAccount'][_0xea30('0x5c')](_0x21881d);})[_0xea30('0x23')](function(_0xf140f){_0x243f94['rows']=_0xf140f;return _0x243f94;})[_0xea30('0x23')](respondWithFilteredResult(_0x18c1d4,_0x21881d))[_0xea30('0x2e')](handleError(_0x18c1d4,null));};exports[_0xea30('0x5d')]=function(_0x2111bf,_0x39b75f){var _0x199326={'raw':![],'where':{'id':_0x2111bf[_0xea30('0x5e')]['id']},'include':[{'model':db[_0xea30('0x41')],'as':_0xea30('0x42')}]},_0x2bc903={};_0x2bc903['model']=_[_0xea30('0x4b')](db['WhatsappAccount'][_0xea30('0x45')]);_0x2bc903[_0xea30('0x4a')]=_['keys'](_0x2111bf[_0xea30('0x4a')]);_0x2bc903[_0xea30('0x55')]=_[_0xea30('0x4c')](_0x2bc903['model'],_0x2bc903[_0xea30('0x4a')]);_0x199326[_0xea30('0x4e')]=_['intersection'](_0x2bc903[_0xea30('0x49')],qs[_0xea30('0x4d')](_0x2111bf[_0xea30('0x4a')][_0xea30('0x4d')]));_0x199326['attributes']=_0x199326[_0xea30('0x4e')][_0xea30('0x4f')]?_0x199326['attributes']:_0x2bc903['model'];if(_0x2111bf['query'][_0xea30('0x5b')]){_0x199326[_0xea30('0x5f')]=[{'all':!![]}];}_0x199326=_['merge']({},_0x199326,_0x2111bf[_0xea30('0x5a')]);return db[_0xea30('0x44')][_0xea30('0x60')](_0x199326)['then'](handleEntityNotFound(_0x39b75f,null))[_0xea30('0x23')](respondWithResult(_0x39b75f,null))[_0xea30('0x2e')](handleError(_0x39b75f,null));};exports[_0xea30('0x61')]=function(_0x408704,_0x484fdd){return db['WhatsappAccount'][_0xea30('0x61')](_0x408704['body'],{})[_0xea30('0x23')](function(_0x444447){var _0x50f505=_0x408704[_0xea30('0x62')][_0xea30('0x3a')]({'plain':!![]});if(!_0x50f505)throw new Error(_0xea30('0x63'));if(_0x50f505['role']===_0xea30('0x62')){var _0x106cf0=_0x444447[_0xea30('0x3a')]({'plain':!![]});var _0x12404c=_0xea30('0x3b');return db['UserProfileSection'][_0xea30('0x60')]({'where':{'name':_0x12404c,'userProfileId':_0x50f505['userProfileId']},'raw':!![]})[_0xea30('0x23')](function(_0x17b7c6){if(_0x17b7c6&&_0x17b7c6['autoAssociation']===0x0){return db[_0xea30('0x3c')][_0xea30('0x61')]({'name':_0x106cf0[_0xea30('0x3f')],'resourceId':_0x106cf0['id'],'type':_0x17b7c6['name'],'sectionId':_0x17b7c6['id']},{})[_0xea30('0x23')](function(){return _0x444447;});}else{return _0x444447;}})[_0xea30('0x2e')](function(_0x149e53){logger[_0xea30('0x2a')](_0xea30('0x64'),_0x149e53);throw _0x149e53;});}return _0x444447;})['then'](respondWithResult(_0x484fdd,0xc9))[_0xea30('0x2e')](handleError(_0x484fdd,null));};exports[_0xea30('0x39')]=function(_0xe72409,_0x1055f1){if(_0xe72409[_0xea30('0x65')]['id']){delete _0xe72409[_0xea30('0x65')]['id'];}return db[_0xea30('0x44')][_0xea30('0x60')]({'where':{'id':_0xe72409[_0xea30('0x5e')]['id']},'include':[{'model':db[_0xea30('0x41')],'as':_0xea30('0x42')}]})[_0xea30('0x23')](handleEntityNotFound(_0x1055f1,null))[_0xea30('0x23')](saveUpdates(_0xe72409['body'],null))[_0xea30('0x23')](respondWithResult(_0x1055f1,null))[_0xea30('0x2e')](handleError(_0x1055f1,null));};exports[_0xea30('0x3d')]=function(_0x4600f7,_0x5a2664){return db[_0xea30('0x44')]['find']({'where':{'id':_0x4600f7[_0xea30('0x5e')]['id']}})[_0xea30('0x23')](handleEntityNotFound(_0x5a2664,null))[_0xea30('0x23')](removeEntity(_0x5a2664,null))[_0xea30('0x2e')](handleError(_0x5a2664,null));};exports['describe']=function(_0x428a9e,_0x10341a){return db[_0xea30('0x44')]['describe']()['then'](respondWithResult(_0x10341a,null))[_0xea30('0x2e')](handleError(_0x10341a,null));};exports['addDisposition']=function(_0x140473,_0x2cf976,_0xfc3c94){if(_0x140473[_0xea30('0x65')]['id']){delete _0x140473[_0xea30('0x65')]['id'];}return db['WhatsappAccount'][_0xea30('0x60')]({'where':{'id':_0x140473[_0xea30('0x5e')]['id']}})[_0xea30('0x23')](handleEntityNotFound(_0x2cf976,null))[_0xea30('0x23')](function(_0x760633){if(_0x760633){_0x140473['body']['WhatsappAccountId']=_0x760633['id'];return db[_0xea30('0x66')]['create'](_0x140473['body']);}})[_0xea30('0x23')](respondWithResult(_0x2cf976,null))[_0xea30('0x2e')](handleError(_0x2cf976,null));};exports[_0xea30('0x67')]=function(_0x3b9534,_0x34df11,_0x5597fb){var _0x40e1c7={'raw':![],'where':{}};var _0x5f06f0={};var _0x1dc3a4={'count':0x0,'rows':[]};return db[_0xea30('0x44')][_0xea30('0x68')]({'where':{'id':_0x3b9534[_0xea30('0x5e')]['id']}})[_0xea30('0x23')](handleEntityNotFound(_0x34df11,null))[_0xea30('0x23')](function(_0xac587){if(_0xac587){_0x5f06f0[_0xea30('0x49')]=_[_0xea30('0x4b')](db['Disposition'][_0xea30('0x45')]);_0x5f06f0[_0xea30('0x4a')]=_[_0xea30('0x4b')](_0x3b9534['query']);_0x5f06f0['filters']=_[_0xea30('0x4c')](_0x5f06f0[_0xea30('0x49')],_0x5f06f0['query']);_0x40e1c7['attributes']=_[_0xea30('0x4c')](_0x5f06f0[_0xea30('0x49')],qs[_0xea30('0x4d')](_0x3b9534['query']['fields']));_0x40e1c7[_0xea30('0x4e')]=_0x40e1c7[_0xea30('0x4e')][_0xea30('0x4f')]?_0x40e1c7['attributes']:_0x5f06f0['model'];if(!_0x3b9534[_0xea30('0x4a')]['hasOwnProperty'](_0xea30('0x51'))){_0x40e1c7['limit']=qs[_0xea30('0x35')](_0x3b9534[_0xea30('0x4a')][_0xea30('0x35')]);_0x40e1c7[_0xea30('0x33')]=qs[_0xea30('0x33')](_0x3b9534[_0xea30('0x4a')][_0xea30('0x33')]);}_0x40e1c7['order']=qs[_0xea30('0x53')](_0x3b9534[_0xea30('0x4a')]['sort']);_0x40e1c7[_0xea30('0x54')]=qs[_0xea30('0x55')](_[_0xea30('0x56')](_0x3b9534[_0xea30('0x4a')],_0x5f06f0[_0xea30('0x55')]));_0x40e1c7[_0xea30('0x54')][_0xea30('0x69')]=_0xac587['id'];if(_0x3b9534['query'][_0xea30('0x58')]){_0x40e1c7[_0xea30('0x54')]=_[_0xea30('0x59')](_0x40e1c7[_0xea30('0x54')],{'$or':_[_0xea30('0x43')](_0x40e1c7[_0xea30('0x4e')],function(_0x1c7ceb){var _0xcc52b={};_0xcc52b[_0x1c7ceb]={'$like':'%'+_0x3b9534[_0xea30('0x4a')][_0xea30('0x58')]+'%'};return _0xcc52b;})});}_0x40e1c7=_['merge']({},_0x40e1c7,_0x3b9534['options']);return db['Disposition'][_0xea30('0x36')]({'where':_0x40e1c7['where']})['then'](function(_0x11ce38){_0x1dc3a4[_0xea30('0x36')]=_0x11ce38;if(_0x3b9534[_0xea30('0x4a')]['includeAll']){_0x40e1c7[_0xea30('0x5f')]=[{'all':!![]}];}return db[_0xea30('0x66')][_0xea30('0x5c')](_0x40e1c7);})[_0xea30('0x23')](function(_0x285d43){_0x1dc3a4['rows']=_0x285d43;return _0x1dc3a4;});}})[_0xea30('0x23')](respondWithFilteredResult(_0x34df11,_0x40e1c7))[_0xea30('0x2e')](handleError(_0x34df11,null));};exports[_0xea30('0x6a')]=function(_0x1fc25d,_0x5868c9,_0x4fea14){return db[_0xea30('0x44')]['find']({'where':{'id':_0x1fc25d[_0xea30('0x5e')]['id']}})['then'](handleEntityNotFound(_0x5868c9,null))[_0xea30('0x23')](function(_0x239e3a){if(_0x239e3a){return _0x239e3a[_0xea30('0x6a')](_0x1fc25d[_0xea30('0x4a')]['ids']);}})['then'](respondWithStatusCode(_0x5868c9,null))[_0xea30('0x2e')](handleError(_0x5868c9,null));};exports[_0xea30('0x6b')]=function(_0x1bda5d,_0x3cb43a,_0x4e69b9){if(_0x1bda5d[_0xea30('0x65')]['id']){delete _0x1bda5d[_0xea30('0x65')]['id'];}return db[_0xea30('0x44')][_0xea30('0x60')]({'where':{'id':_0x1bda5d[_0xea30('0x5e')]['id']}})[_0xea30('0x23')](handleEntityNotFound(_0x3cb43a,null))[_0xea30('0x23')](function(_0x1f5f06){if(_0x1f5f06){_0x1bda5d[_0xea30('0x65')]['WhatsappAccountId']=_0x1f5f06['id'];return db[_0xea30('0x6c')][_0xea30('0x61')](_0x1bda5d['body']);}})['then'](respondWithResult(_0x3cb43a,null))[_0xea30('0x2e')](handleError(_0x3cb43a,null));};exports[_0xea30('0x6d')]=function(_0xc79d4c,_0x21dedf,_0x24c27a){var _0x43d758={'raw':![],'where':{}};var _0x47f98f={};var _0x15fe8d={'count':0x0,'rows':[]};return db[_0xea30('0x44')][_0xea30('0x68')]({'where':{'id':_0xc79d4c[_0xea30('0x5e')]['id']}})[_0xea30('0x23')](handleEntityNotFound(_0x21dedf,null))[_0xea30('0x23')](function(_0x21661e){if(_0x21661e){_0x47f98f[_0xea30('0x49')]=_[_0xea30('0x4b')](db[_0xea30('0x6c')][_0xea30('0x45')]);_0x47f98f[_0xea30('0x4a')]=_[_0xea30('0x4b')](_0xc79d4c[_0xea30('0x4a')]);_0x47f98f[_0xea30('0x55')]=_[_0xea30('0x4c')](_0x47f98f['model'],_0x47f98f['query']);_0x43d758['attributes']=_[_0xea30('0x4c')](_0x47f98f['model'],qs[_0xea30('0x4d')](_0xc79d4c[_0xea30('0x4a')][_0xea30('0x4d')]));_0x43d758[_0xea30('0x4e')]=_0x43d758['attributes'][_0xea30('0x4f')]?_0x43d758[_0xea30('0x4e')]:_0x47f98f[_0xea30('0x49')];if(!_0xc79d4c[_0xea30('0x4a')][_0xea30('0x50')](_0xea30('0x51'))){_0x43d758[_0xea30('0x35')]=qs[_0xea30('0x35')](_0xc79d4c[_0xea30('0x4a')][_0xea30('0x35')]);_0x43d758[_0xea30('0x33')]=qs[_0xea30('0x33')](_0xc79d4c['query'][_0xea30('0x33')]);}_0x43d758[_0xea30('0x52')]=qs[_0xea30('0x53')](_0xc79d4c['query'][_0xea30('0x53')]);_0x43d758[_0xea30('0x54')]=qs[_0xea30('0x55')](_[_0xea30('0x56')](_0xc79d4c[_0xea30('0x4a')],_0x47f98f[_0xea30('0x55')]));_0x43d758['where'][_0xea30('0x69')]=_0x21661e['id'];if(_0xc79d4c['query'][_0xea30('0x58')]){_0x43d758[_0xea30('0x54')]=_[_0xea30('0x59')](_0x43d758['where'],{'$or':_[_0xea30('0x43')](_0x43d758['attributes'],function(_0x3825cd){var _0x477cde={};_0x477cde[_0x3825cd]={'$like':'%'+_0xc79d4c[_0xea30('0x4a')][_0xea30('0x58')]+'%'};return _0x477cde;})});}_0x43d758=_[_0xea30('0x59')]({},_0x43d758,_0xc79d4c[_0xea30('0x5a')]);return db['CannedAnswer']['count']({'where':_0x43d758['where']})[_0xea30('0x23')](function(_0x43bf92){_0x15fe8d[_0xea30('0x36')]=_0x43bf92;if(_0xc79d4c['query'][_0xea30('0x5b')]){_0x43d758[_0xea30('0x5f')]=[{'all':!![]}];}return db[_0xea30('0x6c')][_0xea30('0x5c')](_0x43d758);})['then'](function(_0x33c465){_0x15fe8d[_0xea30('0x6e')]=_0x33c465;return _0x15fe8d;});}})['then'](respondWithFilteredResult(_0x21dedf,_0x43d758))[_0xea30('0x2e')](handleError(_0x21dedf,null));};exports[_0xea30('0x6f')]=function(_0x120bdf,_0x5ebc80,_0x4277e7){return db[_0xea30('0x44')][_0xea30('0x60')]({'where':{'id':_0x120bdf['params']['id']}})[_0xea30('0x23')](handleEntityNotFound(_0x5ebc80,null))[_0xea30('0x23')](function(_0x344f26){if(_0x344f26){return _0x344f26['removeAnswers'](_0x120bdf['query'][_0xea30('0x70')]);}})['then'](respondWithStatusCode(_0x5ebc80,null))['catch'](handleError(_0x5ebc80,null));};exports[_0xea30('0x71')]=function(_0x48363b,_0x5045a7,_0xba517f){return db[_0xea30('0x44')][_0xea30('0x60')]({'where':{'id':_0x48363b[_0xea30('0x5e')]['id']}})[_0xea30('0x23')](handleEntityNotFound(_0x5045a7,null))['then'](function(_0x2e768c){if(_0x2e768c){return _0x2e768c[_0xea30('0x71')](_0x48363b[_0xea30('0x65')][_0xea30('0x70')],_['omit'](_0x48363b[_0xea30('0x65')],['ids','id'])||{})[_0xea30('0x72')](function(_0x23a939){for(var _0x507c7b=0x0;_0x507c7b<_0x48363b[_0xea30('0x65')][_0xea30('0x70')]['length'];_0x507c7b+=0x1){socket[_0xea30('0x73')](_0xea30('0x74'),{'UserId':Number(_0x48363b['body'][_0xea30('0x70')][_0x507c7b]),'WhatsappAccountId':Number(_0x48363b[_0xea30('0x5e')]['id'])});}return _0x23a939;});}})[_0xea30('0x23')](respondWithResult(_0x5045a7,null))[_0xea30('0x2e')](handleError(_0x5045a7,null));};exports[_0xea30('0x75')]=function(_0x3e3e8a,_0x3904e5,_0x22e372){return db[_0xea30('0x44')][_0xea30('0x60')]({'where':{'id':_0x3e3e8a['params']['id']}})['then'](handleEntityNotFound(_0x3904e5,null))['then'](function(_0x51b1fc){if(_0x51b1fc){return _0x51b1fc['removeAgents'](_0x3e3e8a[_0xea30('0x4a')][_0xea30('0x70')])['then'](function(){if(_[_0xea30('0x76')](_0x3e3e8a[_0xea30('0x4a')][_0xea30('0x70')])){for(var _0x361d35=0x0;_0x361d35<_0x3e3e8a['query'][_0xea30('0x70')]['length'];_0x361d35+=0x1){socket['emit'](_0xea30('0x77'),{'UserId':Number(_0x3e3e8a[_0xea30('0x4a')][_0xea30('0x70')][_0x361d35]),'WhatsappAccountId':Number(_0x3e3e8a[_0xea30('0x5e')]['id'])});}}else{socket[_0xea30('0x73')](_0xea30('0x77'),{'UserId':Number(_0x3e3e8a[_0xea30('0x4a')][_0xea30('0x70')]),'WhatsappAccountId':Number(_0x3e3e8a[_0xea30('0x5e')]['id'])});}});}})[_0xea30('0x23')](respondWithStatusCode(_0x3904e5,null))[_0xea30('0x2e')](handleError(_0x3904e5,null));};exports[_0xea30('0x78')]=function(_0x992636,_0x2d58bf,_0x5b702a){var _0x868fae={};var _0x47adab={};var _0x578f24;var _0xf5641e;return db['WhatsappAccount']['findOne']({'where':{'id':_0x992636[_0xea30('0x5e')]['id']}})[_0xea30('0x23')](handleEntityNotFound(_0x2d58bf,null))['then'](function(_0x2e9db4){if(_0x2e9db4){_0x578f24=_0x2e9db4;_0x47adab[_0xea30('0x49')]=_[_0xea30('0x4b')](db[_0xea30('0x79')][_0xea30('0x45')]);_0x47adab[_0xea30('0x4a')]=_[_0xea30('0x4b')](_0x992636[_0xea30('0x4a')]);_0x47adab[_0xea30('0x55')]=_[_0xea30('0x4c')](_0x47adab[_0xea30('0x49')],_0x47adab['query']);_0x868fae['attributes']=_[_0xea30('0x4c')](_0x47adab[_0xea30('0x49')],qs['fields'](_0x992636['query'][_0xea30('0x4d')]));_0x868fae[_0xea30('0x4e')]=_0x868fae[_0xea30('0x4e')][_0xea30('0x4f')]?_0x868fae[_0xea30('0x4e')]:_0x47adab['model'];_0x868fae[_0xea30('0x52')]=qs[_0xea30('0x53')](_0x992636[_0xea30('0x4a')][_0xea30('0x53')]);_0x868fae[_0xea30('0x54')]=qs[_0xea30('0x55')](_['pick'](_0x992636[_0xea30('0x4a')],_0x47adab['filters']));if(_0x992636['query'][_0xea30('0x58')]){_0x868fae['where']=_[_0xea30('0x59')](_0x868fae['where'],{'$or':_[_0xea30('0x43')](_0x868fae[_0xea30('0x4e')],function(_0xe06c9f){var _0x4bb373={};_0x4bb373[_0xe06c9f]={'$like':'%'+_0x992636[_0xea30('0x4a')][_0xea30('0x58')]+'%'};return _0x4bb373;})});}_0x868fae=_['merge']({},_0x868fae,_0x992636[_0xea30('0x5a')]);return _0x578f24[_0xea30('0x78')](_0x868fae);}})[_0xea30('0x23')](function(_0x3e9ce8){if(_0x3e9ce8){_0xf5641e=_0x3e9ce8[_0xea30('0x4f')];if(!_0x992636[_0xea30('0x4a')][_0xea30('0x50')](_0xea30('0x51'))){_0x868fae[_0xea30('0x35')]=qs[_0xea30('0x35')](_0x992636[_0xea30('0x4a')][_0xea30('0x35')]);_0x868fae[_0xea30('0x33')]=qs[_0xea30('0x33')](_0x992636[_0xea30('0x4a')][_0xea30('0x33')]);}return _0x578f24['getAgents'](_0x868fae);}})[_0xea30('0x23')](function(_0x3c4ed6){if(_0x3c4ed6){return _0x3c4ed6?{'count':_0xf5641e,'rows':_0x3c4ed6}:null;}})[_0xea30('0x23')](respondWithResult(_0x2d58bf,null))[_0xea30('0x2e')](handleError(_0x2d58bf,null));};exports[_0xea30('0x7a')]=function(_0x4a17db,_0xae4f7d){var _0x42d21b=_0x4a17db['params']['id'];var _0x43657a=_0x4a17db[_0xea30('0x65')];var _0x332748=0xc8;var _0x5c78b3=null;return db[_0xea30('0x7b')][_0xea30('0x7c')]({'isolationLevel':db['sequelize'][_0xea30('0x7d')][_0xea30('0x7e')][_0xea30('0x7f')]},function(_0x4a3bf0){return db[_0xea30('0x44')][_0xea30('0x68')]({'where':{'id':_0x42d21b},'transaction':_0x4a3bf0})[_0xea30('0x23')](function(_0x2de105){if(_0x2de105){return db[_0xea30('0x80')][_0xea30('0x3d')]({'where':{'WhatsappAccountId':_0x42d21b},'transaction':_0x4a3bf0})[_0xea30('0x23')](function(){var _0xb16e6e=_[_0xea30('0x43')](_0x43657a,function(_0x332945){_0x332945['WhatsappAccountId']=_0x42d21b;return _0x332945;});return db['WhatsappApplication'][_0xea30('0x81')](_0xb16e6e,{'transaction':_0x4a3bf0});});}else{_0x332748=0x194;_0x5c78b3=[];}});})['then'](function(){if(_0x332748!==0x194){return db[_0xea30('0x80')][_0xea30('0x82')]({'where':{'WhatsappAccountId':_0x42d21b},'order':_0xea30('0x83')})[_0xea30('0x23')](function(_0x5645aa){_0x5c78b3=_0x5645aa;});}})[_0xea30('0x2e')](function(_0x1497cb){_0x332748=0x1f4;logger[_0xea30('0x2a')](_0x1497cb[_0xea30('0x3e')]);if(_0x1497cb['name']){delete _0x1497cb[_0xea30('0x3f')];}_0x5c78b3=_0x1497cb;})[_0xea30('0x84')](function(){if(_0x5c78b3===null){_0xae4f7d[_0xea30('0x2f')](_0x332748);}else{if(_0x332748===0x1f4){_0xae4f7d[_0xea30('0x30')](_0x332748)[_0xea30('0x40')](_0x5c78b3);}else{_0xae4f7d[_0xea30('0x30')](_0x332748)[_0xea30('0x32')](_0x5c78b3);}}});};exports[_0xea30('0x85')]=function(_0x331274,_0x415350,_0x4533dd){var _0x2df8ff={};var _0x4b49ba={};var _0x46b6e5;var _0x1d5f40;return db[_0xea30('0x44')][_0xea30('0x68')]({'where':{'id':_0x331274[_0xea30('0x5e')]['id']}})['then'](handleEntityNotFound(_0x415350,null))['then'](function(_0x2e0473){if(_0x2e0473){_0x46b6e5=_0x2e0473;_0x4b49ba[_0xea30('0x49')]=_[_0xea30('0x4b')](db[_0xea30('0x80')][_0xea30('0x45')]);_0x4b49ba[_0xea30('0x4a')]=_[_0xea30('0x4b')](_0x331274[_0xea30('0x4a')]);_0x4b49ba[_0xea30('0x55')]=_[_0xea30('0x4c')](_0x4b49ba[_0xea30('0x49')],_0x4b49ba[_0xea30('0x4a')]);_0x2df8ff[_0xea30('0x4e')]=_[_0xea30('0x4c')](_0x4b49ba[_0xea30('0x49')],qs[_0xea30('0x4d')](_0x331274[_0xea30('0x4a')]['fields']));_0x2df8ff[_0xea30('0x4e')]=_0x2df8ff[_0xea30('0x4e')][_0xea30('0x4f')]?_0x2df8ff[_0xea30('0x4e')]:_0x4b49ba['model'];_0x2df8ff['order']=qs[_0xea30('0x53')](_0x331274[_0xea30('0x4a')][_0xea30('0x53')]);_0x2df8ff['where']=qs[_0xea30('0x55')](_['pick'](_0x331274[_0xea30('0x4a')],_0x4b49ba[_0xea30('0x55')]));if(_0x331274[_0xea30('0x4a')][_0xea30('0x58')]){_0x2df8ff[_0xea30('0x54')]=_[_0xea30('0x59')](_0x2df8ff[_0xea30('0x54')],{'$or':_[_0xea30('0x43')](_0x2df8ff[_0xea30('0x4e')],function(_0x1f3fbb){var _0x4345ee={};_0x4345ee[_0x1f3fbb]={'$like':'%'+_0x331274[_0xea30('0x4a')][_0xea30('0x58')]+'%'};return _0x4345ee;})});}_0x2df8ff=_['merge']({},_0x2df8ff,_0x331274['options']);return _0x46b6e5[_0xea30('0x85')](_0x2df8ff);}})[_0xea30('0x23')](function(_0x2fae9a){if(_0x2fae9a){_0x1d5f40=_0x2fae9a['length'];if(!_0x331274[_0xea30('0x4a')][_0xea30('0x50')](_0xea30('0x51'))){_0x2df8ff['limit']=qs[_0xea30('0x35')](_0x331274[_0xea30('0x4a')][_0xea30('0x35')]);_0x2df8ff[_0xea30('0x33')]=qs[_0xea30('0x33')](_0x331274[_0xea30('0x4a')][_0xea30('0x33')]);}return _0x46b6e5['getApplications'](_0x2df8ff);}})[_0xea30('0x23')](function(_0x2313f5){if(_0x2313f5){return _0x2313f5?{'count':_0x1d5f40,'rows':_0x2313f5}:null;}})[_0xea30('0x23')](respondWithResult(_0x415350,null))[_0xea30('0x2e')](handleError(_0x415350,null));};exports[_0xea30('0x86')]=function(_0x336010,_0x22d508,_0xa0890e){var _0x5a9436={'channel':_0xea30('0x87')};var _0x2df347=[];var _0x46f0a4=[];var _0x935032={};return db[_0xea30('0x44')]['find']({'where':{'id':_0x336010[_0xea30('0x5e')]['id']},'include':[{'model':db['WhatsappApplication'],'as':_0xea30('0x88')}]})[_0xea30('0x23')](handleEntityNotFound(_0x22d508,null))[_0xea30('0x23')](function(_0x45092a){_0x5a9436[_0xea30('0x89')]=_0x45092a;if(_0x5a9436[_0xea30('0x89')]&&_0x5a9436['account'][_0xea30('0x47')]===_0xea30('0x8a')&&_0x336010['body']['statuses']){if(_0x336010[_0xea30('0x65')][_0xea30('0x8b')][_0xea30('0x4f')]===0x0)return;if(_0x336010[_0xea30('0x65')][_0xea30('0x8b')][0x0][_0xea30('0x8c')]!=='read')return;return db['WhatsappMessage'][_0xea30('0x39')]({'read':!![],'readAt':_0x336010[_0xea30('0x65')]['statuses'][0x0]['timestamp']},{'where':{'messageId':_0x336010[_0xea30('0x65')][_0xea30('0x8b')][0x0][_0xea30('0x8d')]},'individualHooks':!![]})[_0xea30('0x23')](function(_0x3471bb){return _0x22d508['status'](0xc8)[_0xea30('0x32')](_0x3471bb);});}_0x5a9436[_0xea30('0x8e')]=_[_0xea30('0x8f')](_0x45092a[_0xea30('0x88')],[_0xea30('0x83')],[_0xea30('0x90')]);if(_0x5a9436[_0xea30('0x89')][_0xea30('0x88')]){delete _0x5a9436['account'][_0xea30('0x88')];}return db[_0xea30('0x91')][_0xea30('0x92')]()['then'](function(_0x2901e5){if(!_0x2901e5){throw new db[(_0xea30('0x93'))][(_0xea30('0x94'))]('no\x20available\x20attributes');}_0x2df347=_[_0xea30('0x95')](_[_0xea30('0x4b')](_0x2901e5),[_0xea30('0x96'),_0xea30('0x97')]);_0x46f0a4=_[_0xea30('0x95')](_[_0xea30('0x4b')](_0x2901e5),[_0xea30('0x96'),_0xea30('0x97'),_0xea30('0x98'),_0xea30('0x99')]);_0x5a9436[_0xea30('0x65')]={'mapKey':_0xea30('0x9a')};if(_0x5a9436[_0xea30('0x89')]&&_0x5a9436[_0xea30('0x89')]['type']===_0xea30('0x9b')){_0x5a9436[_0xea30('0x65')][_0xea30('0x9c')]=_0x336010[_0xea30('0x65')][_0xea30('0x9d')][_0xea30('0x9e')](_0xea30('0x9f'),'');_0x5a9436[_0xea30('0x65')][_0xea30('0x65')]=_0x336010[_0xea30('0x65')][_0xea30('0xa0')];_0x5a9436[_0xea30('0x65')]['messageId']=_0x336010['body'][_0xea30('0xa1')];}if(_0x5a9436[_0xea30('0x89')]&&_0x5a9436[_0xea30('0x89')]['type']==='sinch'){_0x5a9436[_0xea30('0x65')]['from']=_0x336010[_0xea30('0x65')][_0xea30('0xa2')][0x0]['from'];_0x5a9436['body'][_0xea30('0x65')]=_0x336010[_0xea30('0x65')][_0xea30('0xa2')][0x0]['message'][_0xea30('0x65')];_0x5a9436[_0xea30('0x65')][_0xea30('0xa3')]=_0x336010[_0xea30('0x65')][_0xea30('0xa2')][0x0][_0xea30('0x8d')];}if(_0x5a9436[_0xea30('0x65')]['id']){delete _0x5a9436[_0xea30('0x65')]['id'];}if(_['isNil'](_0x5a9436[_0xea30('0x65')][_0xea30('0x9c')])){throw new db[(_0xea30('0x93'))][(_0xea30('0x94'))](_0xea30('0xa4'));}if(_[_0xea30('0xa5')](_0x5a9436[_0xea30('0x65')]['body'])||_0x5a9436[_0xea30('0x65')]['body']===''){throw new db[(_0xea30('0x93'))][(_0xea30('0x94'))](_0xea30('0xa6'));}if(_['isNil'](_0x5a9436[_0xea30('0x65')][_0xea30('0xa7')])){throw new db['Sequelize']['ValidationError']('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x46f0a4);}if(!_[_0xea30('0xa8')](_0x46f0a4,_0x5a9436['body'][_0xea30('0xa7')])){throw new db['Sequelize']['ValidationError']('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x46f0a4);}_0x935032[_0x5a9436[_0xea30('0x65')]['mapKey']]=_0x5a9436[_0xea30('0x65')][_0xea30('0x9c')];return db[_0xea30('0xa9')][_0xea30('0x60')]({'where':{'id':_0x5a9436[_0xea30('0x89')][_0xea30('0x99')]},'include':[{'model':db['CmContact'],'as':'Contacts','where':_0x935032,'limit':0x1,'order':[[_0xea30('0x97'),_0xea30('0xaa')]]}]});})[_0xea30('0x23')](handleEntityNotFound(_0x22d508,null))[_0xea30('0x23')](function(_0x330fcd){if(_0x330fcd){_0x5a9436[_0xea30('0xab')]=_[_0xea30('0xac')](_0x330fcd,[_0xea30('0xad')]);if(_0x330fcd[_0xea30('0xad')]['length']){return _0x330fcd[_0xea30('0xad')][0x0];}var _0x176664=_[_0xea30('0x1b')](_0x5a9436[_0xea30('0x65')],{'firstName':_0x5a9436[_0xea30('0x65')][_0xea30('0x9c')],'ListId':_0x330fcd['id']});_0x176664[_0x5a9436[_0xea30('0x65')][_0xea30('0xa7')]]=_0x5a9436[_0xea30('0x65')]['from'];return db[_0xea30('0x91')]['create'](_0x176664,{'fields':_0x2df347,'raw':!![]});}})[_0xea30('0x23')](handleEntityNotFound(_0x22d508,null))['then'](function(_0xd9cd39){if(_0xd9cd39){_0x5a9436[_0xea30('0xae')]=_0xd9cd39;var _0x43d585={'ContactId':_0xd9cd39['id'],'phone':_0x5a9436[_0xea30('0x65')][_0xea30('0x9c')],'WhatsappAccountId':_0x336010[_0xea30('0x5e')]['id']};var _0x278169={'ContactId':_0xd9cd39['id'],'WhatsappAccountId':_0x336010['params']['id'],'closed':![]};return db[_0xea30('0xaf')]['find']({'where':_0x278169})[_0xea30('0x23')](function(_0xb45547){if(_0xb45547){return[_0xb45547,![]];}return db[_0xea30('0xaf')][_0xea30('0x61')](_0x43d585)[_0xea30('0x23')](function(_0x48892c){return[_0x48892c,!![]];});});}})[_0xea30('0x72')](function(_0x34ec53,_0x40cd96){_0x5a9436[_0xea30('0xb0')]=_0x34ec53[_0xea30('0x3a')]({'plain':!![]});_0x5a9436[_0xea30('0xb0')][_0xea30('0xb1')]=![];if(_0x40cd96){if(_0x5a9436['account'][_0xea30('0xb2')]){_0x5a9436[_0xea30('0x8e')]['push']({'id':0x0,'priority':_0x5a9436[_0xea30('0x8e')][_0xea30('0x4f')]+0x1,'app':_0xea30('0xb3'),'appdata':_0xea30('0xb4'),'interval':'*,*,*,*'});}_0x5a9436[_0xea30('0xb0')][_0xea30('0xb1')]=!![];}return db[_0xea30('0xb5')][_0xea30('0x61')]({'phone':_0x5a9436[_0xea30('0x65')]['from'],'messageId':_0x5a9436[_0xea30('0x65')][_0xea30('0xa3')],'body':_0x5a9436[_0xea30('0x65')][_0xea30('0x65')],'WhatsappAccountId':_0x336010[_0xea30('0x5e')]['id'],'WhatsappInteractionId':_0x34ec53['id'],'direction':'in','ContactId':_0x34ec53[_0xea30('0xb6')],'AttachmentId':_0x5a9436[_0xea30('0x65')][_0xea30('0xb7')]});})[_0xea30('0x23')](function(_0x14cee2){_0x5a9436[_0xea30('0x2c')]=_0x14cee2;if(!_0x5a9436[_0xea30('0xb0')][_0xea30('0xb8')])return;return db[_0xea30('0x79')][_0xea30('0x60')]({'attributes':['id','name'],'where':{'id':_0x5a9436['interaction'][_0xea30('0xb8')]}});})[_0xea30('0x23')](function(_0x50c1f1){if(_0x50c1f1){_0x5a9436[_0xea30('0x8e')][_0xea30('0xb9')]({'id':0x0,'priority':0x0,'app':_0xea30('0xba'),'appdata':_0x50c1f1[_0xea30('0x3f')]+','+(_0x5a9436[_0xea30('0x89')]['waitForTheAssignedAgent']||0xa),'interval':_0xea30('0xbb')});}if(!_0x5a9436[_0xea30('0xb0')]['queueId'])return;return db['WhatsappQueue'][_0xea30('0x60')]({'attributes':['id','name'],'where':{'id':_0x5a9436[_0xea30('0xb0')][_0xea30('0xbc')]}});})['then'](function(_0x4a88e7){if(_0x4a88e7){_0x5a9436[_0xea30('0x8e')]['unshift']({'id':0x0,'priority':0x1,'app':'queue','appdata':_0x4a88e7[_0xea30('0x3f')]+','+(_0x5a9436['account'][_0xea30('0xbd')]||0x12c),'interval':_0xea30('0xbb')});}return respondWithRpcPromise(_0xea30('0xbe'),_0xea30('0xbf'),_0x5a9436);})[_0xea30('0x23')](function(_0x4f4a7f){if(_0x4f4a7f){var _0x218349=0xc8;var _0x4a4195=_0xea30('0xc0');logger['info']('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x4a4195,_0x218349,_0xea30('0xc1'));logger['debug'](_0xea30('0xc2'),_0x4a4195,_0x218349,_0xea30('0xc1'),JSON[_0xea30('0x29')](_0x4f4a7f));if(_0x5a9436[_0xea30('0x89')][_0xea30('0x47')]===_0xea30('0x9b')){return _0x22d508[_0xea30('0x30')](_0x218349)[_0xea30('0xc3')](_0xea30('0xc4'),_0xea30('0xc5'))[_0xea30('0x40')](_0xea30('0xc6'));}else{return _0x22d508[_0xea30('0x30')](_0x218349)[_0xea30('0x32')](_0x4f4a7f);}}});})[_0xea30('0x2e')](handleError(_0x22d508,null));};exports[_0xea30('0x40')]=function(_0xe8ddd5,_0x2b9266,_0x206e19){var _0x34f23f,_0x15519d,_0x31e386;if(_[_0xea30('0xa5')](_0xe8ddd5[_0xea30('0x65')][_0xea30('0x65')])||_0xe8ddd5['body'][_0xea30('0x65')]===''){throw new db[(_0xea30('0x93'))][(_0xea30('0x94'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0xea30('0xa5')](_0xe8ddd5[_0xea30('0x65')]['to'])){throw new db[(_0xea30('0x93'))][(_0xea30('0x94'))](_0xea30('0xc7'));}_0x34f23f=_0xe8ddd5[_0xea30('0x65')]['to'];return db[_0xea30('0x44')]['find']({'where':{'id':_0xe8ddd5[_0xea30('0x5e')]['id']},'include':[{'model':db['CmList'],'as':_0xea30('0xc8'),'include':[{'model':db[_0xea30('0x91')],'as':_0xea30('0xad'),'where':{'mobile':_0x34f23f},'limit':0x1,'order':[[_0xea30('0x97'),_0xea30('0xaa')]]}]}]})[_0xea30('0x23')](handleEntityNotFound(_0x2b9266,null))[_0xea30('0x23')](function(_0x35c435){if(_0x35c435&&_0x35c435[_0xea30('0xc8')]){_0x15519d=_0x35c435[_0xea30('0x3a')]({'plain':!![]});if(_0x15519d['List']&&_0x15519d[_0xea30('0xc8')][_0xea30('0xad')]['length']){return _0x15519d['List'][_0xea30('0xad')][0x0];}return db[_0xea30('0x91')]['create'](_[_0xea30('0x1b')](_0xe8ddd5[_0xea30('0x65')],{'firstName':_0x34f23f,'mobile':_0x34f23f,'phone':_0x34f23f,'ListId':_0x15519d['ListId']}));}})[_0xea30('0x23')](handleEntityNotFound(_0x2b9266,null))[_0xea30('0x23')](function(_0x41cf59){if(_0x41cf59){_0x31e386=_0x41cf59;return db[_0xea30('0xaf')][_0xea30('0x60')]({'where':{'ContactId':_0x31e386['id'],'closed':![],'WhatsappAccountId':_0x15519d['id']}})['then'](function(_0x1a825c){if(_0x1a825c){return[_0x1a825c,![]];}return db['WhatsappInteraction'][_0xea30('0x61')]({'UserId':_0xe8ddd5[_0xea30('0x62')]['id'],'ContactId':_0x31e386['id'],'WhatsappAccountId':_0x15519d['id'],'phone':_0x34f23f,'firstMsgDirection':'out','Messages':[_[_0xea30('0x59')](_0xe8ddd5['body'],{'read':![],'body':_0xe8ddd5['body'][_0xea30('0x65')],'phone':_0x34f23f,'WhatsappAccountId':_0x15519d['id'],'UserId':_0xe8ddd5['user']['id'],'ContactId':_0x31e386['id']})]},{'include':[{'model':db[_0xea30('0xb5')],'as':_0xea30('0xc9')}]})[_0xea30('0x23')](function(_0x576125){return[_0x576125,!![]];});});}})[_0xea30('0x72')](function(_0x372444,_0x4e3a65){if(_0x4e3a65){return _0x372444;}return db[_0xea30('0xb5')][_0xea30('0x61')](_[_0xea30('0x59')](_0xe8ddd5['body'],{'read':![],'body':_0xe8ddd5[_0xea30('0x65')][_0xea30('0x65')],'phone':_0x34f23f,'WhatsappAccountId':_0x15519d['id'],'WhatsappInteractionId':_0x372444['id'],'UserId':_0xe8ddd5[_0xea30('0x62')]['id'],'ContactId':_0x31e386['id']}))['then'](function(_0x43a69d){_0x372444[_0xea30('0xca')][_0xea30('0xc9')]=[];_0x372444[_0xea30('0xca')]['Messages'][_0xea30('0xcb')](_0x43a69d[_0xea30('0xca')]);return _0x372444;});})['then'](respondWithResult(_0x2b9266,null))[_0xea30('0x2e')](handleError(_0x2b9266,null));}; \ No newline at end of file +var _0xf0b0=['where','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','show','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','UserProfileSection','userProfileId','autoAssociation','describe','addDisposition','WhatsappAccountId','pick','Disposition','removeDispositions','ids','addAnswer','getAnswers','findOne','CannedAnswer','removeAnswers','addAgents','omit','spread','removeAgents','isArray','emit','userWhatsappAccount:remove','getAgents','User','addApplications','sequelize','transaction','ISOLATION_LEVELS','READ_COMMITTED','WhatsappApplication','findAndCountAll','priority','finally','getApplications','notify','whatsapp','account','sinch','statuses','state','read','WhatsappMessage','timestamp','message_id','orderBy','asc','Applications','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','createdAt','updatedAt','difference','ListId','twilio','from','From','whatsapp:','Body','messageId','MessageSid','notifications','isNil','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','Contacts','DESC','defaults','WhatsappInteraction','interaction','created','autoclose','push','close','unmanaged','AttachmentId','UserId','unshift','agent','waitForTheAssignedAgent','queueId','WhatsappQueue','applications','queue','waitForTheAssignedQueue','Start','startRouting','receiveMessage','entity\x20found','debug','Content-Type','text/xml','\x0a','to\x20is\x20mandatory','List','out','Messages','dataValues','rimraf','zip-dir','fast-json-patch','moment','mustache','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../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','code','message','result','catch','sendStatus','status','end','offset','undefined','count','limit','Content-Range','json','apply','reject','update','destroy','WhatsappAccounts','UserProfileResource','stack','name','send','index','Pause','mandatoryDispositionPause','map','WhatsappAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort'];(function(_0x5714e2,_0x1cd5fa){var _0x215fdc=function(_0x2cc3ab){while(--_0x2cc3ab){_0x5714e2['push'](_0x5714e2['shift']());}};_0x215fdc(++_0x1cd5fa);}(_0xf0b0,0x143));var _0x0f0b=function(_0x305f0e,_0x264cbf){_0x305f0e=_0x305f0e-0x0;var _0x596f63=_0xf0b0[_0x305f0e];return _0x596f63;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0f0b('0x0'));var zipdir=require(_0x0f0b('0x1'));var jsonpatch=require(_0x0f0b('0x2'));var rp=require('request-promise');var moment=require(_0x0f0b('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x0f0b('0x4'));var util=require('util');var path=require(_0x0f0b('0x5'));var sox=require(_0x0f0b('0x6'));var csv=require(_0x0f0b('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0f0b('0x8'));var _=require(_0x0f0b('0x9'));var squel=require('squel');var crypto=require(_0x0f0b('0xa'));var jsforce=require(_0x0f0b('0xb'));var deskjs=require(_0x0f0b('0xc'));var toCsv=require(_0x0f0b('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x0f0b('0xd'));var as=require(_0x0f0b('0xe'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x0f0b('0xf'));var utils=require(_0x0f0b('0x10'));var config=require(_0x0f0b('0x11'));var licenseUtil=require(_0x0f0b('0x12'));var db=require(_0x0f0b('0x13'))['db'];config[_0x0f0b('0x14')]=_['defaults'](config[_0x0f0b('0x14')],{'host':_0x0f0b('0x15'),'port':0x18eb});var socket=require(_0x0f0b('0x16'))(new Redis(config[_0x0f0b('0x14')]));require(_0x0f0b('0x17'))[_0x0f0b('0x18')](socket);var jayson=require(_0x0f0b('0x19'));var client=jayson[_0x0f0b('0x1a')][_0x0f0b('0x1b')]({'port':0x232c});function respondWithRpcPromise(_0xc14bf1,_0x2f3913,_0x169124,_0x4f6d6b){return new BPromise(function(_0x595bee,_0x40c3a5){var _0x3be5a2=_0x4f6d6b||client;return _0x3be5a2[_0x0f0b('0x1c')](_0xc14bf1,_0x169124)[_0x0f0b('0x1d')](function(_0x293b62){logger[_0x0f0b('0x1e')](_0x0f0b('0x1f'),_0x2f3913,_0x0f0b('0x20'));logger['debug'](_0x0f0b('0x21'),_0x2f3913,_0x0f0b('0x20'),JSON[_0x0f0b('0x22')](_0x293b62));if(_0x293b62[_0x0f0b('0x23')]){if(_0x293b62[_0x0f0b('0x23')][_0x0f0b('0x24')]===0x1f4){logger['error'](_0x0f0b('0x1f'),_0x2f3913,_0x293b62[_0x0f0b('0x23')][_0x0f0b('0x25')]);return _0x40c3a5(_0x293b62[_0x0f0b('0x23')][_0x0f0b('0x25')]);}logger[_0x0f0b('0x23')](_0x0f0b('0x1f'),_0x2f3913,_0x293b62[_0x0f0b('0x23')]['message']);return _0x595bee(_0x293b62[_0x0f0b('0x23')][_0x0f0b('0x25')]);}else{logger[_0x0f0b('0x1e')](_0x0f0b('0x1f'),_0x2f3913,_0x0f0b('0x20'));_0x595bee(_0x293b62[_0x0f0b('0x26')][_0x0f0b('0x25')]);}})[_0x0f0b('0x27')](function(_0x5e9307){logger['error'](_0x0f0b('0x1f'),_0x2f3913,_0x5e9307);_0x40c3a5(_0x5e9307);});});}function respondWithStatusCode(_0x911d16,_0x19fb2b){_0x19fb2b=_0x19fb2b||0xcc;return function(_0x84bac1){if(_0x84bac1){return _0x911d16[_0x0f0b('0x28')](_0x19fb2b);}return _0x911d16[_0x0f0b('0x29')](_0x19fb2b)[_0x0f0b('0x2a')]();};}function respondWithResult(_0x395203,_0x28c7f9){_0x28c7f9=_0x28c7f9||0xc8;return function(_0xf50023){if(_0xf50023){return _0x395203[_0x0f0b('0x29')](_0x28c7f9)['json'](_0xf50023);}};}function respondWithFilteredResult(_0x3efd4b,_0x329200){return function(_0x6fded9){if(_0x6fded9){var _0x4eee46=typeof _0x329200[_0x0f0b('0x2b')]===_0x0f0b('0x2c')&&typeof _0x329200['limit']===_0x0f0b('0x2c');var _0x59ad4a=_0x6fded9[_0x0f0b('0x2d')];var _0x185d5c=_0x4eee46?0x0:_0x329200[_0x0f0b('0x2b')];var _0x57d327=_0x4eee46?_0x6fded9[_0x0f0b('0x2d')]:_0x329200[_0x0f0b('0x2b')]+_0x329200[_0x0f0b('0x2e')];var _0x57ce6f;if(_0x57d327>=_0x59ad4a){_0x57d327=_0x59ad4a;_0x57ce6f=0xc8;}else{_0x57ce6f=0xce;}_0x3efd4b[_0x0f0b('0x29')](_0x57ce6f);return _0x3efd4b['set'](_0x0f0b('0x2f'),_0x185d5c+'-'+_0x57d327+'/'+_0x59ad4a)[_0x0f0b('0x30')](_0x6fded9);}return null;};}function patchUpdates(_0xf13918){return function(_0x5d0ea7){try{jsonpatch[_0x0f0b('0x31')](_0x5d0ea7,_0xf13918,!![]);}catch(_0xee9ec1){return BPromise[_0x0f0b('0x32')](_0xee9ec1);}return _0x5d0ea7['save']();};}function saveUpdates(_0x34b48c,_0x13cb43){return function(_0x44d0c4){if(_0x44d0c4){return _0x44d0c4[_0x0f0b('0x33')](_0x34b48c)['then'](function(_0x204570){return _0x204570;});}return null;};}function removeEntity(_0x1b7a9c,_0x3270e8){return function(_0x376b51){if(_0x376b51){return _0x376b51[_0x0f0b('0x34')]()['then'](function(){var _0x585de3=_0x376b51['get']({'plain':!![]});var _0x1627e6=_0x0f0b('0x35');return db[_0x0f0b('0x36')][_0x0f0b('0x34')]({'where':{'type':_0x1627e6,'resourceId':_0x585de3['id']}})[_0x0f0b('0x1d')](function(){return _0x376b51;});})[_0x0f0b('0x1d')](function(){_0x1b7a9c[_0x0f0b('0x29')](0xcc)[_0x0f0b('0x2a')]();});}};}function handleEntityNotFound(_0x3deb2d,_0x43b66c){return function(_0xfce742){if(!_0xfce742){_0x3deb2d[_0x0f0b('0x28')](0x194);}return _0xfce742;};}function handleError(_0x3724a4,_0x3eed6d){_0x3eed6d=_0x3eed6d||0x1f4;return function(_0x3c631f){logger[_0x0f0b('0x23')](_0x3c631f[_0x0f0b('0x37')]);if(_0x3c631f['name']){delete _0x3c631f[_0x0f0b('0x38')];}_0x3724a4['status'](_0x3eed6d)[_0x0f0b('0x39')](_0x3c631f);};}exports[_0x0f0b('0x3a')]=function(_0x10b2cf,_0x2487f9){var _0x19c451={'include':[{'model':db[_0x0f0b('0x3b')],'as':_0x0f0b('0x3c')}]},_0x3aaa42={},_0xa5269a={'count':0x0,'rows':[]};var _0x27fe12=_[_0x0f0b('0x3d')](db[_0x0f0b('0x3e')][_0x0f0b('0x3f')],function(_0xf9e317){return{'name':_0xf9e317[_0x0f0b('0x40')],'type':_0xf9e317[_0x0f0b('0x41')][_0x0f0b('0x42')]};});_0x3aaa42[_0x0f0b('0x43')]=_['map'](_0x27fe12,_0x0f0b('0x38'));_0x3aaa42[_0x0f0b('0x44')]=_[_0x0f0b('0x45')](_0x10b2cf[_0x0f0b('0x44')]);_0x3aaa42[_0x0f0b('0x46')]=_[_0x0f0b('0x47')](_0x3aaa42[_0x0f0b('0x43')],_0x3aaa42[_0x0f0b('0x44')]);_0x19c451[_0x0f0b('0x48')]=_[_0x0f0b('0x47')](_0x3aaa42['model'],qs[_0x0f0b('0x49')](_0x10b2cf[_0x0f0b('0x44')][_0x0f0b('0x49')]));_0x19c451[_0x0f0b('0x48')]=_0x19c451['attributes'][_0x0f0b('0x4a')]?_0x19c451[_0x0f0b('0x48')]:_0x3aaa42[_0x0f0b('0x43')];if(!_0x10b2cf[_0x0f0b('0x44')][_0x0f0b('0x4b')](_0x0f0b('0x4c'))){_0x19c451[_0x0f0b('0x2e')]=qs[_0x0f0b('0x2e')](_0x10b2cf[_0x0f0b('0x44')]['limit']);_0x19c451[_0x0f0b('0x2b')]=qs[_0x0f0b('0x2b')](_0x10b2cf[_0x0f0b('0x44')]['offset']);}_0x19c451[_0x0f0b('0x4d')]=qs['sort'](_0x10b2cf['query'][_0x0f0b('0x4e')]);_0x19c451[_0x0f0b('0x4f')]=qs[_0x0f0b('0x46')](_['pick'](_0x10b2cf['query'],_0x3aaa42[_0x0f0b('0x46')]),_0x27fe12);if(_0x10b2cf[_0x0f0b('0x44')][_0x0f0b('0x50')]){_0x19c451[_0x0f0b('0x4f')]=_['merge'](_0x19c451['where'],{'$or':_[_0x0f0b('0x3d')](_0x27fe12,function(_0x32c915){if(_0x32c915[_0x0f0b('0x41')]!==_0x0f0b('0x51')){var _0x38d7d9={};_0x38d7d9[_0x32c915['name']]={'$like':'%'+_0x10b2cf[_0x0f0b('0x44')][_0x0f0b('0x50')]+'%'};return _0x38d7d9;}})});}_0x19c451=_[_0x0f0b('0x52')]({},_0x19c451,_0x10b2cf[_0x0f0b('0x53')]);var _0x23eb68={'where':_0x19c451[_0x0f0b('0x4f')]};return db[_0x0f0b('0x3e')][_0x0f0b('0x2d')](_0x23eb68)['then'](function(_0x3fdcb5){_0xa5269a[_0x0f0b('0x2d')]=_0x3fdcb5;if(_0x10b2cf[_0x0f0b('0x44')][_0x0f0b('0x54')]){_0x19c451[_0x0f0b('0x55')]=[{'all':!![]}];}return db[_0x0f0b('0x3e')][_0x0f0b('0x56')](_0x19c451);})[_0x0f0b('0x1d')](function(_0x8a028c){_0xa5269a[_0x0f0b('0x57')]=_0x8a028c;return _0xa5269a;})[_0x0f0b('0x1d')](respondWithFilteredResult(_0x2487f9,_0x19c451))[_0x0f0b('0x27')](handleError(_0x2487f9,null));};exports[_0x0f0b('0x58')]=function(_0x3909a6,_0x5cbcea){var _0x32cef5={'raw':![],'where':{'id':_0x3909a6[_0x0f0b('0x59')]['id']},'include':[{'model':db[_0x0f0b('0x3b')],'as':_0x0f0b('0x3c')}]},_0x10e379={};_0x10e379[_0x0f0b('0x43')]=_['keys'](db[_0x0f0b('0x3e')][_0x0f0b('0x3f')]);_0x10e379[_0x0f0b('0x44')]=_[_0x0f0b('0x45')](_0x3909a6[_0x0f0b('0x44')]);_0x10e379[_0x0f0b('0x46')]=_[_0x0f0b('0x47')](_0x10e379[_0x0f0b('0x43')],_0x10e379[_0x0f0b('0x44')]);_0x32cef5[_0x0f0b('0x48')]=_['intersection'](_0x10e379[_0x0f0b('0x43')],qs[_0x0f0b('0x49')](_0x3909a6['query']['fields']));_0x32cef5[_0x0f0b('0x48')]=_0x32cef5[_0x0f0b('0x48')]['length']?_0x32cef5[_0x0f0b('0x48')]:_0x10e379[_0x0f0b('0x43')];if(_0x3909a6[_0x0f0b('0x44')]['includeAll']){_0x32cef5[_0x0f0b('0x55')]=[{'all':!![]}];}_0x32cef5=_['merge']({},_0x32cef5,_0x3909a6[_0x0f0b('0x53')]);return db[_0x0f0b('0x3e')][_0x0f0b('0x5a')](_0x32cef5)[_0x0f0b('0x1d')](handleEntityNotFound(_0x5cbcea,null))[_0x0f0b('0x1d')](respondWithResult(_0x5cbcea,null))[_0x0f0b('0x27')](handleError(_0x5cbcea,null));};exports[_0x0f0b('0x5b')]=function(_0x734ca8,_0x3c5829){return db[_0x0f0b('0x3e')][_0x0f0b('0x5b')](_0x734ca8[_0x0f0b('0x5c')],{})['then'](function(_0x299ef7){var _0x4d88d5=_0x734ca8[_0x0f0b('0x5d')]['get']({'plain':!![]});if(!_0x4d88d5)throw new Error(_0x0f0b('0x5e'));if(_0x4d88d5[_0x0f0b('0x5f')]===_0x0f0b('0x5d')){var _0x49161c=_0x299ef7[_0x0f0b('0x60')]({'plain':!![]});var _0x28f023='WhatsappAccounts';return db[_0x0f0b('0x61')][_0x0f0b('0x5a')]({'where':{'name':_0x28f023,'userProfileId':_0x4d88d5[_0x0f0b('0x62')]},'raw':!![]})['then'](function(_0x5bf5a6){if(_0x5bf5a6&&_0x5bf5a6[_0x0f0b('0x63')]===0x0){return db[_0x0f0b('0x36')]['create']({'name':_0x49161c[_0x0f0b('0x38')],'resourceId':_0x49161c['id'],'type':_0x5bf5a6[_0x0f0b('0x38')],'sectionId':_0x5bf5a6['id']},{})[_0x0f0b('0x1d')](function(){return _0x299ef7;});}else{return _0x299ef7;}})[_0x0f0b('0x27')](function(_0x30d20a){logger[_0x0f0b('0x23')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x30d20a);throw _0x30d20a;});}return _0x299ef7;})[_0x0f0b('0x1d')](respondWithResult(_0x3c5829,0xc9))['catch'](handleError(_0x3c5829,null));};exports['update']=function(_0x17beb6,_0xe559d5){if(_0x17beb6[_0x0f0b('0x5c')]['id']){delete _0x17beb6['body']['id'];}return db['WhatsappAccount'][_0x0f0b('0x5a')]({'where':{'id':_0x17beb6[_0x0f0b('0x59')]['id']},'include':[{'model':db[_0x0f0b('0x3b')],'as':'mandatoryDispositionPause'}]})[_0x0f0b('0x1d')](handleEntityNotFound(_0xe559d5,null))['then'](saveUpdates(_0x17beb6[_0x0f0b('0x5c')],null))[_0x0f0b('0x1d')](respondWithResult(_0xe559d5,null))[_0x0f0b('0x27')](handleError(_0xe559d5,null));};exports['destroy']=function(_0x5c9d6f,_0x176318){return db['WhatsappAccount']['find']({'where':{'id':_0x5c9d6f[_0x0f0b('0x59')]['id']}})[_0x0f0b('0x1d')](handleEntityNotFound(_0x176318,null))[_0x0f0b('0x1d')](removeEntity(_0x176318,null))[_0x0f0b('0x27')](handleError(_0x176318,null));};exports[_0x0f0b('0x64')]=function(_0x16f1f5,_0x12b0dd){return db[_0x0f0b('0x3e')][_0x0f0b('0x64')]()['then'](respondWithResult(_0x12b0dd,null))[_0x0f0b('0x27')](handleError(_0x12b0dd,null));};exports[_0x0f0b('0x65')]=function(_0x39e2d0,_0x3b6246,_0x301754){if(_0x39e2d0['body']['id']){delete _0x39e2d0[_0x0f0b('0x5c')]['id'];}return db[_0x0f0b('0x3e')]['find']({'where':{'id':_0x39e2d0[_0x0f0b('0x59')]['id']}})[_0x0f0b('0x1d')](handleEntityNotFound(_0x3b6246,null))[_0x0f0b('0x1d')](function(_0xf77bb6){if(_0xf77bb6){_0x39e2d0[_0x0f0b('0x5c')][_0x0f0b('0x66')]=_0xf77bb6['id'];return db['Disposition'][_0x0f0b('0x5b')](_0x39e2d0[_0x0f0b('0x5c')]);}})[_0x0f0b('0x1d')](respondWithResult(_0x3b6246,null))[_0x0f0b('0x27')](handleError(_0x3b6246,null));};exports['getDispositions']=function(_0x197f12,_0x1b93d5,_0x246091){var _0x17c24f={'raw':![],'where':{}};var _0x36c0ae={};var _0x2c8463={'count':0x0,'rows':[]};return db['WhatsappAccount']['findOne']({'where':{'id':_0x197f12[_0x0f0b('0x59')]['id']}})[_0x0f0b('0x1d')](handleEntityNotFound(_0x1b93d5,null))[_0x0f0b('0x1d')](function(_0x5382b5){if(_0x5382b5){_0x36c0ae[_0x0f0b('0x43')]=_[_0x0f0b('0x45')](db['Disposition']['rawAttributes']);_0x36c0ae[_0x0f0b('0x44')]=_[_0x0f0b('0x45')](_0x197f12[_0x0f0b('0x44')]);_0x36c0ae[_0x0f0b('0x46')]=_[_0x0f0b('0x47')](_0x36c0ae[_0x0f0b('0x43')],_0x36c0ae[_0x0f0b('0x44')]);_0x17c24f['attributes']=_[_0x0f0b('0x47')](_0x36c0ae[_0x0f0b('0x43')],qs[_0x0f0b('0x49')](_0x197f12[_0x0f0b('0x44')][_0x0f0b('0x49')]));_0x17c24f[_0x0f0b('0x48')]=_0x17c24f[_0x0f0b('0x48')]['length']?_0x17c24f[_0x0f0b('0x48')]:_0x36c0ae['model'];if(!_0x197f12['query'][_0x0f0b('0x4b')]('nolimit')){_0x17c24f['limit']=qs[_0x0f0b('0x2e')](_0x197f12[_0x0f0b('0x44')]['limit']);_0x17c24f[_0x0f0b('0x2b')]=qs[_0x0f0b('0x2b')](_0x197f12[_0x0f0b('0x44')][_0x0f0b('0x2b')]);}_0x17c24f[_0x0f0b('0x4d')]=qs[_0x0f0b('0x4e')](_0x197f12['query']['sort']);_0x17c24f[_0x0f0b('0x4f')]=qs[_0x0f0b('0x46')](_[_0x0f0b('0x67')](_0x197f12[_0x0f0b('0x44')],_0x36c0ae[_0x0f0b('0x46')]));_0x17c24f['where'][_0x0f0b('0x66')]=_0x5382b5['id'];if(_0x197f12['query']['filter']){_0x17c24f[_0x0f0b('0x4f')]=_[_0x0f0b('0x52')](_0x17c24f[_0x0f0b('0x4f')],{'$or':_[_0x0f0b('0x3d')](_0x17c24f[_0x0f0b('0x48')],function(_0x286ac9){var _0x4899b7={};_0x4899b7[_0x286ac9]={'$like':'%'+_0x197f12[_0x0f0b('0x44')][_0x0f0b('0x50')]+'%'};return _0x4899b7;})});}_0x17c24f=_[_0x0f0b('0x52')]({},_0x17c24f,_0x197f12['options']);return db[_0x0f0b('0x68')][_0x0f0b('0x2d')]({'where':_0x17c24f['where']})['then'](function(_0x3b6022){_0x2c8463[_0x0f0b('0x2d')]=_0x3b6022;if(_0x197f12['query'][_0x0f0b('0x54')]){_0x17c24f[_0x0f0b('0x55')]=[{'all':!![]}];}return db[_0x0f0b('0x68')][_0x0f0b('0x56')](_0x17c24f);})[_0x0f0b('0x1d')](function(_0x45cebf){_0x2c8463[_0x0f0b('0x57')]=_0x45cebf;return _0x2c8463;});}})[_0x0f0b('0x1d')](respondWithFilteredResult(_0x1b93d5,_0x17c24f))[_0x0f0b('0x27')](handleError(_0x1b93d5,null));};exports[_0x0f0b('0x69')]=function(_0x3a64f8,_0x48480e,_0x4220de){return db[_0x0f0b('0x3e')][_0x0f0b('0x5a')]({'where':{'id':_0x3a64f8[_0x0f0b('0x59')]['id']}})['then'](handleEntityNotFound(_0x48480e,null))[_0x0f0b('0x1d')](function(_0x4c3766){if(_0x4c3766){return _0x4c3766['removeDispositions'](_0x3a64f8[_0x0f0b('0x44')][_0x0f0b('0x6a')]);}})['then'](respondWithStatusCode(_0x48480e,null))[_0x0f0b('0x27')](handleError(_0x48480e,null));};exports[_0x0f0b('0x6b')]=function(_0x59879f,_0x15d083,_0x526489){if(_0x59879f[_0x0f0b('0x5c')]['id']){delete _0x59879f[_0x0f0b('0x5c')]['id'];}return db[_0x0f0b('0x3e')]['find']({'where':{'id':_0x59879f[_0x0f0b('0x59')]['id']}})['then'](handleEntityNotFound(_0x15d083,null))[_0x0f0b('0x1d')](function(_0x35a972){if(_0x35a972){_0x59879f[_0x0f0b('0x5c')][_0x0f0b('0x66')]=_0x35a972['id'];return db['CannedAnswer']['create'](_0x59879f['body']);}})['then'](respondWithResult(_0x15d083,null))[_0x0f0b('0x27')](handleError(_0x15d083,null));};exports[_0x0f0b('0x6c')]=function(_0x1d8a21,_0x400aea,_0x2a25a7){var _0x394c94={'raw':![],'where':{}};var _0x54aa9b={};var _0x3b85ba={'count':0x0,'rows':[]};return db[_0x0f0b('0x3e')][_0x0f0b('0x6d')]({'where':{'id':_0x1d8a21[_0x0f0b('0x59')]['id']}})[_0x0f0b('0x1d')](handleEntityNotFound(_0x400aea,null))[_0x0f0b('0x1d')](function(_0x4a7126){if(_0x4a7126){_0x54aa9b['model']=_[_0x0f0b('0x45')](db[_0x0f0b('0x6e')][_0x0f0b('0x3f')]);_0x54aa9b[_0x0f0b('0x44')]=_[_0x0f0b('0x45')](_0x1d8a21['query']);_0x54aa9b['filters']=_[_0x0f0b('0x47')](_0x54aa9b['model'],_0x54aa9b[_0x0f0b('0x44')]);_0x394c94[_0x0f0b('0x48')]=_[_0x0f0b('0x47')](_0x54aa9b[_0x0f0b('0x43')],qs[_0x0f0b('0x49')](_0x1d8a21[_0x0f0b('0x44')][_0x0f0b('0x49')]));_0x394c94[_0x0f0b('0x48')]=_0x394c94[_0x0f0b('0x48')]['length']?_0x394c94[_0x0f0b('0x48')]:_0x54aa9b[_0x0f0b('0x43')];if(!_0x1d8a21[_0x0f0b('0x44')][_0x0f0b('0x4b')](_0x0f0b('0x4c'))){_0x394c94['limit']=qs[_0x0f0b('0x2e')](_0x1d8a21['query']['limit']);_0x394c94['offset']=qs['offset'](_0x1d8a21[_0x0f0b('0x44')]['offset']);}_0x394c94[_0x0f0b('0x4d')]=qs[_0x0f0b('0x4e')](_0x1d8a21['query'][_0x0f0b('0x4e')]);_0x394c94[_0x0f0b('0x4f')]=qs[_0x0f0b('0x46')](_['pick'](_0x1d8a21['query'],_0x54aa9b[_0x0f0b('0x46')]));_0x394c94[_0x0f0b('0x4f')][_0x0f0b('0x66')]=_0x4a7126['id'];if(_0x1d8a21[_0x0f0b('0x44')][_0x0f0b('0x50')]){_0x394c94[_0x0f0b('0x4f')]=_['merge'](_0x394c94[_0x0f0b('0x4f')],{'$or':_[_0x0f0b('0x3d')](_0x394c94['attributes'],function(_0x596c5e){var _0x9f0651={};_0x9f0651[_0x596c5e]={'$like':'%'+_0x1d8a21[_0x0f0b('0x44')][_0x0f0b('0x50')]+'%'};return _0x9f0651;})});}_0x394c94=_[_0x0f0b('0x52')]({},_0x394c94,_0x1d8a21[_0x0f0b('0x53')]);return db[_0x0f0b('0x6e')][_0x0f0b('0x2d')]({'where':_0x394c94[_0x0f0b('0x4f')]})[_0x0f0b('0x1d')](function(_0x3ab599){_0x3b85ba[_0x0f0b('0x2d')]=_0x3ab599;if(_0x1d8a21['query'][_0x0f0b('0x54')]){_0x394c94[_0x0f0b('0x55')]=[{'all':!![]}];}return db['CannedAnswer'][_0x0f0b('0x56')](_0x394c94);})[_0x0f0b('0x1d')](function(_0x34e627){_0x3b85ba['rows']=_0x34e627;return _0x3b85ba;});}})[_0x0f0b('0x1d')](respondWithFilteredResult(_0x400aea,_0x394c94))[_0x0f0b('0x27')](handleError(_0x400aea,null));};exports[_0x0f0b('0x6f')]=function(_0x5ba93b,_0x24f102,_0x717be2){return db['WhatsappAccount'][_0x0f0b('0x5a')]({'where':{'id':_0x5ba93b[_0x0f0b('0x59')]['id']}})[_0x0f0b('0x1d')](handleEntityNotFound(_0x24f102,null))[_0x0f0b('0x1d')](function(_0x5972b5){if(_0x5972b5){return _0x5972b5[_0x0f0b('0x6f')](_0x5ba93b[_0x0f0b('0x44')][_0x0f0b('0x6a')]);}})[_0x0f0b('0x1d')](respondWithStatusCode(_0x24f102,null))[_0x0f0b('0x27')](handleError(_0x24f102,null));};exports[_0x0f0b('0x70')]=function(_0x1f5e03,_0x209236,_0x123104){return db[_0x0f0b('0x3e')]['find']({'where':{'id':_0x1f5e03['params']['id']}})[_0x0f0b('0x1d')](handleEntityNotFound(_0x209236,null))[_0x0f0b('0x1d')](function(_0x465b3d){if(_0x465b3d){return _0x465b3d[_0x0f0b('0x70')](_0x1f5e03[_0x0f0b('0x5c')][_0x0f0b('0x6a')],_[_0x0f0b('0x71')](_0x1f5e03[_0x0f0b('0x5c')],[_0x0f0b('0x6a'),'id'])||{})[_0x0f0b('0x72')](function(_0x2561e6){for(var _0x40c121=0x0;_0x40c121<_0x1f5e03[_0x0f0b('0x5c')][_0x0f0b('0x6a')][_0x0f0b('0x4a')];_0x40c121+=0x1){socket['emit']('userWhatsappAccount:save',{'UserId':Number(_0x1f5e03[_0x0f0b('0x5c')]['ids'][_0x40c121]),'WhatsappAccountId':Number(_0x1f5e03[_0x0f0b('0x59')]['id'])});}return _0x2561e6;});}})[_0x0f0b('0x1d')](respondWithResult(_0x209236,null))['catch'](handleError(_0x209236,null));};exports['removeAgents']=function(_0x3c3f00,_0x54fe4d,_0x43248e){return db[_0x0f0b('0x3e')][_0x0f0b('0x5a')]({'where':{'id':_0x3c3f00[_0x0f0b('0x59')]['id']}})['then'](handleEntityNotFound(_0x54fe4d,null))[_0x0f0b('0x1d')](function(_0x2ccb21){if(_0x2ccb21){return _0x2ccb21[_0x0f0b('0x73')](_0x3c3f00['query'][_0x0f0b('0x6a')])[_0x0f0b('0x1d')](function(){if(_[_0x0f0b('0x74')](_0x3c3f00['query'][_0x0f0b('0x6a')])){for(var _0x246681=0x0;_0x246681<_0x3c3f00['query']['ids']['length'];_0x246681+=0x1){socket[_0x0f0b('0x75')](_0x0f0b('0x76'),{'UserId':Number(_0x3c3f00[_0x0f0b('0x44')][_0x0f0b('0x6a')][_0x246681]),'WhatsappAccountId':Number(_0x3c3f00[_0x0f0b('0x59')]['id'])});}}else{socket['emit'](_0x0f0b('0x76'),{'UserId':Number(_0x3c3f00[_0x0f0b('0x44')][_0x0f0b('0x6a')]),'WhatsappAccountId':Number(_0x3c3f00[_0x0f0b('0x59')]['id'])});}});}})['then'](respondWithStatusCode(_0x54fe4d,null))[_0x0f0b('0x27')](handleError(_0x54fe4d,null));};exports[_0x0f0b('0x77')]=function(_0x2518b4,_0x12f8eb,_0x261598){var _0x5c206c={};var _0x175fe2={};var _0x41b980;var _0x359d36;return db['WhatsappAccount'][_0x0f0b('0x6d')]({'where':{'id':_0x2518b4[_0x0f0b('0x59')]['id']}})[_0x0f0b('0x1d')](handleEntityNotFound(_0x12f8eb,null))[_0x0f0b('0x1d')](function(_0x763fd){if(_0x763fd){_0x41b980=_0x763fd;_0x175fe2['model']=_['keys'](db[_0x0f0b('0x78')][_0x0f0b('0x3f')]);_0x175fe2[_0x0f0b('0x44')]=_[_0x0f0b('0x45')](_0x2518b4['query']);_0x175fe2[_0x0f0b('0x46')]=_[_0x0f0b('0x47')](_0x175fe2[_0x0f0b('0x43')],_0x175fe2['query']);_0x5c206c[_0x0f0b('0x48')]=_['intersection'](_0x175fe2['model'],qs[_0x0f0b('0x49')](_0x2518b4[_0x0f0b('0x44')][_0x0f0b('0x49')]));_0x5c206c['attributes']=_0x5c206c[_0x0f0b('0x48')][_0x0f0b('0x4a')]?_0x5c206c[_0x0f0b('0x48')]:_0x175fe2['model'];_0x5c206c['order']=qs[_0x0f0b('0x4e')](_0x2518b4[_0x0f0b('0x44')][_0x0f0b('0x4e')]);_0x5c206c[_0x0f0b('0x4f')]=qs[_0x0f0b('0x46')](_[_0x0f0b('0x67')](_0x2518b4[_0x0f0b('0x44')],_0x175fe2[_0x0f0b('0x46')]));if(_0x2518b4[_0x0f0b('0x44')][_0x0f0b('0x50')]){_0x5c206c[_0x0f0b('0x4f')]=_['merge'](_0x5c206c[_0x0f0b('0x4f')],{'$or':_['map'](_0x5c206c[_0x0f0b('0x48')],function(_0x2e6243){var _0x5b5c52={};_0x5b5c52[_0x2e6243]={'$like':'%'+_0x2518b4[_0x0f0b('0x44')][_0x0f0b('0x50')]+'%'};return _0x5b5c52;})});}_0x5c206c=_[_0x0f0b('0x52')]({},_0x5c206c,_0x2518b4[_0x0f0b('0x53')]);return _0x41b980['getAgents'](_0x5c206c);}})[_0x0f0b('0x1d')](function(_0x5c44b4){if(_0x5c44b4){_0x359d36=_0x5c44b4[_0x0f0b('0x4a')];if(!_0x2518b4[_0x0f0b('0x44')][_0x0f0b('0x4b')](_0x0f0b('0x4c'))){_0x5c206c[_0x0f0b('0x2e')]=qs[_0x0f0b('0x2e')](_0x2518b4['query'][_0x0f0b('0x2e')]);_0x5c206c['offset']=qs[_0x0f0b('0x2b')](_0x2518b4['query'][_0x0f0b('0x2b')]);}return _0x41b980[_0x0f0b('0x77')](_0x5c206c);}})[_0x0f0b('0x1d')](function(_0x113921){if(_0x113921){return _0x113921?{'count':_0x359d36,'rows':_0x113921}:null;}})[_0x0f0b('0x1d')](respondWithResult(_0x12f8eb,null))[_0x0f0b('0x27')](handleError(_0x12f8eb,null));};exports[_0x0f0b('0x79')]=function(_0x483e9b,_0x8629){var _0x4ed2fd=_0x483e9b[_0x0f0b('0x59')]['id'];var _0x3a843f=_0x483e9b['body'];var _0x4d2319=0xc8;var _0x531579=null;return db[_0x0f0b('0x7a')][_0x0f0b('0x7b')]({'isolationLevel':db[_0x0f0b('0x7a')]['Transaction'][_0x0f0b('0x7c')][_0x0f0b('0x7d')]},function(_0x5d4860){return db[_0x0f0b('0x3e')]['findOne']({'where':{'id':_0x4ed2fd},'transaction':_0x5d4860})[_0x0f0b('0x1d')](function(_0x2ebe31){if(_0x2ebe31){return db[_0x0f0b('0x7e')][_0x0f0b('0x34')]({'where':{'WhatsappAccountId':_0x4ed2fd},'transaction':_0x5d4860})[_0x0f0b('0x1d')](function(){var _0x8f5a2e=_[_0x0f0b('0x3d')](_0x3a843f,function(_0x28909c){_0x28909c[_0x0f0b('0x66')]=_0x4ed2fd;return _0x28909c;});return db[_0x0f0b('0x7e')]['bulkCreate'](_0x8f5a2e,{'transaction':_0x5d4860});});}else{_0x4d2319=0x194;_0x531579=[];}});})['then'](function(){if(_0x4d2319!==0x194){return db['WhatsappApplication'][_0x0f0b('0x7f')]({'where':{'WhatsappAccountId':_0x4ed2fd},'order':_0x0f0b('0x80')})['then'](function(_0x281b43){_0x531579=_0x281b43;});}})['catch'](function(_0x435362){_0x4d2319=0x1f4;logger['error'](_0x435362[_0x0f0b('0x37')]);if(_0x435362[_0x0f0b('0x38')]){delete _0x435362[_0x0f0b('0x38')];}_0x531579=_0x435362;})[_0x0f0b('0x81')](function(){if(_0x531579===null){_0x8629[_0x0f0b('0x28')](_0x4d2319);}else{if(_0x4d2319===0x1f4){_0x8629[_0x0f0b('0x29')](_0x4d2319)['send'](_0x531579);}else{_0x8629[_0x0f0b('0x29')](_0x4d2319)[_0x0f0b('0x30')](_0x531579);}}});};exports['getApplications']=function(_0x275c71,_0x2e2fa9,_0x1d3bd1){var _0x39ba2c={};var _0x3ace58={};var _0x1bc7dc;var _0x3341af;return db['WhatsappAccount'][_0x0f0b('0x6d')]({'where':{'id':_0x275c71[_0x0f0b('0x59')]['id']}})['then'](handleEntityNotFound(_0x2e2fa9,null))[_0x0f0b('0x1d')](function(_0x24eed0){if(_0x24eed0){_0x1bc7dc=_0x24eed0;_0x3ace58[_0x0f0b('0x43')]=_[_0x0f0b('0x45')](db['WhatsappApplication'][_0x0f0b('0x3f')]);_0x3ace58[_0x0f0b('0x44')]=_['keys'](_0x275c71['query']);_0x3ace58[_0x0f0b('0x46')]=_['intersection'](_0x3ace58[_0x0f0b('0x43')],_0x3ace58['query']);_0x39ba2c['attributes']=_[_0x0f0b('0x47')](_0x3ace58['model'],qs[_0x0f0b('0x49')](_0x275c71['query'][_0x0f0b('0x49')]));_0x39ba2c[_0x0f0b('0x48')]=_0x39ba2c[_0x0f0b('0x48')]['length']?_0x39ba2c['attributes']:_0x3ace58[_0x0f0b('0x43')];_0x39ba2c['order']=qs[_0x0f0b('0x4e')](_0x275c71[_0x0f0b('0x44')][_0x0f0b('0x4e')]);_0x39ba2c[_0x0f0b('0x4f')]=qs['filters'](_[_0x0f0b('0x67')](_0x275c71['query'],_0x3ace58[_0x0f0b('0x46')]));if(_0x275c71[_0x0f0b('0x44')][_0x0f0b('0x50')]){_0x39ba2c[_0x0f0b('0x4f')]=_[_0x0f0b('0x52')](_0x39ba2c['where'],{'$or':_[_0x0f0b('0x3d')](_0x39ba2c[_0x0f0b('0x48')],function(_0x2f54f7){var _0xb09c68={};_0xb09c68[_0x2f54f7]={'$like':'%'+_0x275c71[_0x0f0b('0x44')][_0x0f0b('0x50')]+'%'};return _0xb09c68;})});}_0x39ba2c=_[_0x0f0b('0x52')]({},_0x39ba2c,_0x275c71[_0x0f0b('0x53')]);return _0x1bc7dc[_0x0f0b('0x82')](_0x39ba2c);}})['then'](function(_0x47fa36){if(_0x47fa36){_0x3341af=_0x47fa36['length'];if(!_0x275c71[_0x0f0b('0x44')]['hasOwnProperty'](_0x0f0b('0x4c'))){_0x39ba2c[_0x0f0b('0x2e')]=qs[_0x0f0b('0x2e')](_0x275c71[_0x0f0b('0x44')][_0x0f0b('0x2e')]);_0x39ba2c[_0x0f0b('0x2b')]=qs[_0x0f0b('0x2b')](_0x275c71[_0x0f0b('0x44')][_0x0f0b('0x2b')]);}return _0x1bc7dc['getApplications'](_0x39ba2c);}})['then'](function(_0x20ee42){if(_0x20ee42){return _0x20ee42?{'count':_0x3341af,'rows':_0x20ee42}:null;}})[_0x0f0b('0x1d')](respondWithResult(_0x2e2fa9,null))[_0x0f0b('0x27')](handleError(_0x2e2fa9,null));};exports[_0x0f0b('0x83')]=function(_0x21f8e7,_0x1476a7,_0x1f0eec){var _0x38b5ba={'channel':_0x0f0b('0x84')};var _0x26e06b=[];var _0x387000=[];var _0x233aa8={};return db[_0x0f0b('0x3e')][_0x0f0b('0x5a')]({'where':{'id':_0x21f8e7[_0x0f0b('0x59')]['id']},'include':[{'model':db[_0x0f0b('0x7e')],'as':'Applications'}]})[_0x0f0b('0x1d')](handleEntityNotFound(_0x1476a7,null))[_0x0f0b('0x1d')](function(_0x207d78){_0x38b5ba['account']=_0x207d78;if(_0x38b5ba[_0x0f0b('0x85')]&&_0x38b5ba[_0x0f0b('0x85')][_0x0f0b('0x41')]===_0x0f0b('0x86')&&_0x21f8e7[_0x0f0b('0x5c')][_0x0f0b('0x87')]){if(_0x21f8e7[_0x0f0b('0x5c')][_0x0f0b('0x87')][_0x0f0b('0x4a')]===0x0)return;if(_0x21f8e7[_0x0f0b('0x5c')]['statuses'][0x0][_0x0f0b('0x88')]!==_0x0f0b('0x89'))return;return db[_0x0f0b('0x8a')][_0x0f0b('0x33')]({'read':!![],'readAt':_0x21f8e7[_0x0f0b('0x5c')]['statuses'][0x0][_0x0f0b('0x8b')]},{'where':{'messageId':_0x21f8e7['body']['statuses'][0x0][_0x0f0b('0x8c')]},'individualHooks':!![]})['then'](function(_0x5cac7a){return _0x1476a7[_0x0f0b('0x29')](0xc8)['json'](_0x5cac7a);});}_0x38b5ba['applications']=_[_0x0f0b('0x8d')](_0x207d78['Applications'],['priority'],[_0x0f0b('0x8e')]);if(_0x38b5ba[_0x0f0b('0x85')][_0x0f0b('0x8f')]){delete _0x38b5ba[_0x0f0b('0x85')][_0x0f0b('0x8f')];}return db[_0x0f0b('0x90')][_0x0f0b('0x64')]()[_0x0f0b('0x1d')](function(_0x160fbc){if(!_0x160fbc){throw new db[(_0x0f0b('0x91'))][(_0x0f0b('0x92'))](_0x0f0b('0x93'));}_0x26e06b=_['difference'](_[_0x0f0b('0x45')](_0x160fbc),[_0x0f0b('0x94'),_0x0f0b('0x95')]);_0x387000=_[_0x0f0b('0x96')](_[_0x0f0b('0x45')](_0x160fbc),[_0x0f0b('0x94'),_0x0f0b('0x95'),'CompanyId',_0x0f0b('0x97')]);_0x38b5ba[_0x0f0b('0x5c')]={'mapKey':'mobile'};if(_0x38b5ba[_0x0f0b('0x85')]&&_0x38b5ba[_0x0f0b('0x85')][_0x0f0b('0x41')]===_0x0f0b('0x98')){_0x38b5ba[_0x0f0b('0x5c')][_0x0f0b('0x99')]=_0x21f8e7[_0x0f0b('0x5c')][_0x0f0b('0x9a')]['replace'](_0x0f0b('0x9b'),'');_0x38b5ba[_0x0f0b('0x5c')][_0x0f0b('0x5c')]=_0x21f8e7[_0x0f0b('0x5c')][_0x0f0b('0x9c')];_0x38b5ba[_0x0f0b('0x5c')][_0x0f0b('0x9d')]=_0x21f8e7['body'][_0x0f0b('0x9e')];}if(_0x38b5ba[_0x0f0b('0x85')]&&_0x38b5ba[_0x0f0b('0x85')][_0x0f0b('0x41')]===_0x0f0b('0x86')){_0x38b5ba[_0x0f0b('0x5c')][_0x0f0b('0x99')]=_0x21f8e7[_0x0f0b('0x5c')]['notifications'][0x0][_0x0f0b('0x99')];_0x38b5ba[_0x0f0b('0x5c')]['body']=_0x21f8e7[_0x0f0b('0x5c')][_0x0f0b('0x9f')][0x0][_0x0f0b('0x25')]['body'];_0x38b5ba[_0x0f0b('0x5c')]['messageId']=_0x21f8e7[_0x0f0b('0x5c')][_0x0f0b('0x9f')][0x0][_0x0f0b('0x8c')];}if(_0x38b5ba[_0x0f0b('0x5c')]['id']){delete _0x38b5ba[_0x0f0b('0x5c')]['id'];}if(_[_0x0f0b('0xa0')](_0x38b5ba[_0x0f0b('0x5c')][_0x0f0b('0x99')])){throw new db['Sequelize'][(_0x0f0b('0x92'))](_0x0f0b('0xa1'));}if(_[_0x0f0b('0xa0')](_0x38b5ba[_0x0f0b('0x5c')]['body'])||_0x38b5ba[_0x0f0b('0x5c')][_0x0f0b('0x5c')]===''){throw new db[(_0x0f0b('0x91'))][(_0x0f0b('0x92'))](_0x0f0b('0xa2'));}if(_[_0x0f0b('0xa0')](_0x38b5ba[_0x0f0b('0x5c')][_0x0f0b('0xa3')])){throw new db[(_0x0f0b('0x91'))][(_0x0f0b('0x92'))](_0x0f0b('0xa4')+_0x387000);}if(!_[_0x0f0b('0xa5')](_0x387000,_0x38b5ba[_0x0f0b('0x5c')][_0x0f0b('0xa3')])){throw new db[(_0x0f0b('0x91'))]['ValidationError'](_0x0f0b('0xa6')+_0x387000);}_0x233aa8[_0x38b5ba[_0x0f0b('0x5c')][_0x0f0b('0xa3')]]=_0x38b5ba[_0x0f0b('0x5c')]['from'];return db[_0x0f0b('0xa7')][_0x0f0b('0x5a')]({'where':{'id':_0x38b5ba[_0x0f0b('0x85')]['ListId']},'include':[{'model':db[_0x0f0b('0x90')],'as':_0x0f0b('0xa8'),'where':_0x233aa8,'limit':0x1,'order':[[_0x0f0b('0x95'),_0x0f0b('0xa9')]]}]});})[_0x0f0b('0x1d')](handleEntityNotFound(_0x1476a7,null))[_0x0f0b('0x1d')](function(_0x376504){if(_0x376504){_0x38b5ba['list']=_[_0x0f0b('0x71')](_0x376504,[_0x0f0b('0xa8')]);if(_0x376504['Contacts'][_0x0f0b('0x4a')]){return _0x376504['Contacts'][0x0];}var _0x47b52d=_[_0x0f0b('0xaa')](_0x38b5ba['body'],{'firstName':_0x38b5ba[_0x0f0b('0x5c')][_0x0f0b('0x99')],'ListId':_0x376504['id']});_0x47b52d[_0x38b5ba[_0x0f0b('0x5c')][_0x0f0b('0xa3')]]=_0x38b5ba['body'][_0x0f0b('0x99')];return db[_0x0f0b('0x90')][_0x0f0b('0x5b')](_0x47b52d,{'fields':_0x26e06b,'raw':!![]});}})[_0x0f0b('0x1d')](handleEntityNotFound(_0x1476a7,null))[_0x0f0b('0x1d')](function(_0x3095b2){if(_0x3095b2){_0x38b5ba['contact']=_0x3095b2;var _0x1d2c72={'ContactId':_0x3095b2['id'],'phone':_0x38b5ba[_0x0f0b('0x5c')][_0x0f0b('0x99')],'WhatsappAccountId':_0x21f8e7[_0x0f0b('0x59')]['id']};var _0x3fdf17={'ContactId':_0x3095b2['id'],'WhatsappAccountId':_0x21f8e7['params']['id'],'closed':![]};return db['WhatsappInteraction'][_0x0f0b('0x5a')]({'where':_0x3fdf17})[_0x0f0b('0x1d')](function(_0x5019d8){if(_0x5019d8){return[_0x5019d8,![]];}return db[_0x0f0b('0xab')]['create'](_0x1d2c72)[_0x0f0b('0x1d')](function(_0xc74188){return[_0xc74188,!![]];});});}})['spread'](function(_0x2a8e88,_0x39d411){_0x38b5ba[_0x0f0b('0xac')]=_0x2a8e88[_0x0f0b('0x60')]({'plain':!![]});_0x38b5ba[_0x0f0b('0xac')][_0x0f0b('0xad')]=![];if(_0x39d411){if(_0x38b5ba['account'][_0x0f0b('0xae')]){_0x38b5ba['applications'][_0x0f0b('0xaf')]({'id':0x0,'priority':_0x38b5ba['applications'][_0x0f0b('0x4a')]+0x1,'app':_0x0f0b('0xb0'),'appdata':_0x0f0b('0xb1'),'interval':'*,*,*,*'});}_0x38b5ba[_0x0f0b('0xac')][_0x0f0b('0xad')]=!![];}return db[_0x0f0b('0x8a')][_0x0f0b('0x5b')]({'phone':_0x38b5ba['body'][_0x0f0b('0x99')],'messageId':_0x38b5ba[_0x0f0b('0x5c')]['messageId'],'body':_0x38b5ba[_0x0f0b('0x5c')][_0x0f0b('0x5c')],'WhatsappAccountId':_0x21f8e7['params']['id'],'WhatsappInteractionId':_0x2a8e88['id'],'direction':'in','ContactId':_0x2a8e88['ContactId'],'AttachmentId':_0x38b5ba[_0x0f0b('0x5c')][_0x0f0b('0xb2')]});})['then'](function(_0x537eb5){_0x38b5ba['message']=_0x537eb5;if(!_0x38b5ba[_0x0f0b('0xac')][_0x0f0b('0xb3')])return;return db[_0x0f0b('0x78')][_0x0f0b('0x5a')]({'attributes':['id',_0x0f0b('0x38')],'where':{'id':_0x38b5ba[_0x0f0b('0xac')]['UserId']}});})[_0x0f0b('0x1d')](function(_0x1a4af6){if(_0x1a4af6){_0x38b5ba['applications'][_0x0f0b('0xb4')]({'id':0x0,'priority':0x0,'app':_0x0f0b('0xb5'),'appdata':_0x1a4af6[_0x0f0b('0x38')]+','+(_0x38b5ba[_0x0f0b('0x85')][_0x0f0b('0xb6')]||0xa),'interval':'*,*,*,*'});}if(!_0x38b5ba[_0x0f0b('0xac')][_0x0f0b('0xb7')])return;return db[_0x0f0b('0xb8')][_0x0f0b('0x5a')]({'attributes':['id',_0x0f0b('0x38')],'where':{'id':_0x38b5ba[_0x0f0b('0xac')][_0x0f0b('0xb7')]}});})[_0x0f0b('0x1d')](function(_0x2a35fb){if(_0x2a35fb){_0x38b5ba[_0x0f0b('0xb9')][_0x0f0b('0xb4')]({'id':0x0,'priority':0x1,'app':_0x0f0b('0xba'),'appdata':_0x2a35fb['name']+','+(_0x38b5ba['account'][_0x0f0b('0xbb')]||0x12c),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0x0f0b('0xbc'),_0x0f0b('0xbd'),_0x38b5ba);})[_0x0f0b('0x1d')](function(_0x29f990){if(_0x29f990){var _0x1520e5=0xc8;var _0x59ea16=_0x0f0b('0xbe');logger[_0x0f0b('0x1e')](_0x0f0b('0x21'),_0x59ea16,_0x1520e5,_0x0f0b('0xbf'));logger[_0x0f0b('0xc0')]('WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s',_0x59ea16,_0x1520e5,_0x0f0b('0xbf'),JSON[_0x0f0b('0x22')](_0x29f990));if(_0x38b5ba['account'][_0x0f0b('0x41')]==='twilio'){return _0x1476a7[_0x0f0b('0x29')](_0x1520e5)['set'](_0x0f0b('0xc1'),_0x0f0b('0xc2'))[_0x0f0b('0x39')](_0x0f0b('0xc3'));}else{return _0x1476a7[_0x0f0b('0x29')](_0x1520e5)[_0x0f0b('0x30')](_0x29f990);}}});})[_0x0f0b('0x27')](handleError(_0x1476a7,null));};exports['send']=function(_0x285563,_0x42d6b5,_0x4714cb){var _0x29555f,_0x3a7037,_0x3f52d6;if(_[_0x0f0b('0xa0')](_0x285563[_0x0f0b('0x5c')][_0x0f0b('0x5c')])||_0x285563['body']['body']===''){throw new db[(_0x0f0b('0x91'))][(_0x0f0b('0x92'))](_0x0f0b('0xa2'));}if(_['isNil'](_0x285563[_0x0f0b('0x5c')]['to'])){throw new db['Sequelize'][(_0x0f0b('0x92'))](_0x0f0b('0xc4'));}_0x29555f=_0x285563[_0x0f0b('0x5c')]['to'];return db[_0x0f0b('0x3e')][_0x0f0b('0x5a')]({'where':{'id':_0x285563[_0x0f0b('0x59')]['id']},'include':[{'model':db[_0x0f0b('0xa7')],'as':_0x0f0b('0xc5'),'include':[{'model':db['CmContact'],'as':_0x0f0b('0xa8'),'where':{'mobile':_0x29555f},'limit':0x1,'order':[[_0x0f0b('0x95'),_0x0f0b('0xa9')]]}]}]})[_0x0f0b('0x1d')](handleEntityNotFound(_0x42d6b5,null))['then'](function(_0x1a1026){if(_0x1a1026&&_0x1a1026[_0x0f0b('0xc5')]){_0x3a7037=_0x1a1026[_0x0f0b('0x60')]({'plain':!![]});if(_0x3a7037['List']&&_0x3a7037[_0x0f0b('0xc5')][_0x0f0b('0xa8')][_0x0f0b('0x4a')]){return _0x3a7037[_0x0f0b('0xc5')][_0x0f0b('0xa8')][0x0];}return db[_0x0f0b('0x90')][_0x0f0b('0x5b')](_[_0x0f0b('0xaa')](_0x285563[_0x0f0b('0x5c')],{'firstName':_0x29555f,'mobile':_0x29555f,'phone':_0x29555f,'ListId':_0x3a7037[_0x0f0b('0x97')]}));}})[_0x0f0b('0x1d')](handleEntityNotFound(_0x42d6b5,null))['then'](function(_0x47ca83){if(_0x47ca83){_0x3f52d6=_0x47ca83;return db[_0x0f0b('0xab')][_0x0f0b('0x5a')]({'where':{'ContactId':_0x3f52d6['id'],'closed':![],'WhatsappAccountId':_0x3a7037['id']}})[_0x0f0b('0x1d')](function(_0x1af766){if(_0x1af766){return[_0x1af766,![]];}return db['WhatsappInteraction'][_0x0f0b('0x5b')]({'UserId':_0x285563[_0x0f0b('0x5d')]['id'],'ContactId':_0x3f52d6['id'],'WhatsappAccountId':_0x3a7037['id'],'phone':_0x29555f,'firstMsgDirection':_0x0f0b('0xc6'),'Messages':[_['merge'](_0x285563[_0x0f0b('0x5c')],{'read':![],'body':_0x285563[_0x0f0b('0x5c')][_0x0f0b('0x5c')],'phone':_0x29555f,'WhatsappAccountId':_0x3a7037['id'],'UserId':_0x285563[_0x0f0b('0x5d')]['id'],'ContactId':_0x3f52d6['id']})]},{'include':[{'model':db[_0x0f0b('0x8a')],'as':_0x0f0b('0xc7')}]})['then'](function(_0x201643){return[_0x201643,!![]];});});}})[_0x0f0b('0x72')](function(_0x1637ac,_0x9cab6a){if(_0x9cab6a){return _0x1637ac;}return db[_0x0f0b('0x8a')][_0x0f0b('0x5b')](_[_0x0f0b('0x52')](_0x285563[_0x0f0b('0x5c')],{'read':![],'body':_0x285563[_0x0f0b('0x5c')][_0x0f0b('0x5c')],'phone':_0x29555f,'WhatsappAccountId':_0x3a7037['id'],'WhatsappInteractionId':_0x1637ac['id'],'UserId':_0x285563['user']['id'],'ContactId':_0x3f52d6['id']}))[_0x0f0b('0x1d')](function(_0x51fe71){_0x1637ac['dataValues'][_0x0f0b('0xc7')]=[];_0x1637ac[_0x0f0b('0xc8')][_0x0f0b('0xc7')]['push'](_0x51fe71[_0x0f0b('0xc8')]);return _0x1637ac;});})[_0x0f0b('0x1d')](respondWithResult(_0x42d6b5,null))[_0x0f0b('0x27')](handleError(_0x42d6b5,null));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.events.js b/server/api/whatsappAccount/whatsappAccount.events.js index 20f7f5d..9ff5ccc 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 _0x1e5d=['save','update','emit','hasOwnProperty','hook','events','../../mysqldb','WhatsappAccount','setMaxListeners'];(function(_0x415ac5,_0x3c52ba){var _0xc14ef7=function(_0x2ad213){while(--_0x2ad213){_0x415ac5['push'](_0x415ac5['shift']());}};_0xc14ef7(++_0x3c52ba);}(_0x1e5d,0x19a));var _0xd1e5=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x1e5d[_0x14add3];return _0x4a174f;};'use strict';var EventEmitter=require(_0xd1e5('0x0'));var WhatsappAccount=require(_0xd1e5('0x1'))['db'][_0xd1e5('0x2')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents[_0xd1e5('0x3')](0x0);var events={'afterCreate':_0xd1e5('0x4'),'afterUpdate':_0xd1e5('0x5'),'afterDestroy':'remove'};function emitEvent(_0x1aef66){return function(_0x238b85,_0x4e4a86,_0x7c1543){WhatsappAccountEvents[_0xd1e5('0x6')](_0x1aef66+':'+_0x238b85['id'],_0x238b85);WhatsappAccountEvents[_0xd1e5('0x6')](_0x1aef66,_0x238b85);_0x7c1543(null);};}for(var e in events){if(events[_0xd1e5('0x7')](e)){var event=events[e];WhatsappAccount[_0xd1e5('0x8')](e,emitEvent(event));}}module['exports']=WhatsappAccountEvents; \ No newline at end of file +var _0xff0a=['setMaxListeners','save','update','remove','emit','exports','../../mysqldb','WhatsappAccount'];(function(_0x1a4fc5,_0x35d717){var _0x3156b7=function(_0x1ce4de){while(--_0x1ce4de){_0x1a4fc5['push'](_0x1a4fc5['shift']());}};_0x3156b7(++_0x35d717);}(_0xff0a,0x1d6));var _0xaff0=function(_0x16d10f,_0x2ba2d5){_0x16d10f=_0x16d10f-0x0;var _0x50c823=_0xff0a[_0x16d10f];return _0x50c823;};'use strict';var EventEmitter=require('events');var WhatsappAccount=require(_0xaff0('0x0'))['db'][_0xaff0('0x1')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents[_0xaff0('0x2')](0x0);var events={'afterCreate':_0xaff0('0x3'),'afterUpdate':_0xaff0('0x4'),'afterDestroy':_0xaff0('0x5')};function emitEvent(_0x30c881){return function(_0x3bec22,_0x1f16f0,_0x56de4c){WhatsappAccountEvents[_0xaff0('0x6')](_0x30c881+':'+_0x3bec22['id'],_0x3bec22);WhatsappAccountEvents[_0xaff0('0x6')](_0x30c881,_0x3bec22);_0x56de4c(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappAccount['hook'](e,emitEvent(event));}}module[_0xaff0('0x7')]=WhatsappAccountEvents; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.model.js b/server/api/whatsappAccount/whatsappAccount.model.js index b45448b..0467ac0 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 _0xf085=['moment','request-promise','path','rimraf','./whatsappAccount.attributes','define','lodash','api'];(function(_0x402983,_0x5b1129){var _0x2dfa7e=function(_0x5d5757){while(--_0x5d5757){_0x402983['push'](_0x402983['shift']());}};_0x2dfa7e(++_0x5b1129);}(_0xf085,0x126));var _0x5f08=function(_0x9edfd5,_0x286486){_0x9edfd5=_0x9edfd5-0x0;var _0x330738=_0xf085[_0x9edfd5];return _0x330738;};'use strict';var _=require(_0x5f08('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x5f08('0x1'));var moment=require(_0x5f08('0x2'));var BPromise=require('bluebird');var rp=require(_0x5f08('0x3'));var fs=require('fs');var path=require(_0x5f08('0x4'));var rimraf=require(_0x5f08('0x5'));var config=require('../../config/environment');var attributes=require(_0x5f08('0x6'));module['exports']=function(_0xbffbaf,_0x3736bc){return _0xbffbaf[_0x5f08('0x7')]('WhatsappAccount',attributes,{'tableName':'whatsapp_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2fbf=['api','bluebird','request-promise','rimraf','../../config/environment','./whatsappAccount.attributes','exports','define','WhatsappAccount','whatsapp_accounts','lodash','../../config/logger'];(function(_0x51d300,_0x41204e){var _0x396f1f=function(_0x5aa22e){while(--_0x5aa22e){_0x51d300['push'](_0x51d300['shift']());}};_0x396f1f(++_0x41204e);}(_0x2fbf,0x172));var _0xf2fb=function(_0x361bdb,_0x14abf4){_0x361bdb=_0x361bdb-0x0;var _0x80c75f=_0x2fbf[_0x361bdb];return _0x80c75f;};'use strict';var _=require(_0xf2fb('0x0'));var util=require('util');var logger=require(_0xf2fb('0x1'))(_0xf2fb('0x2'));var moment=require('moment');var BPromise=require(_0xf2fb('0x3'));var rp=require(_0xf2fb('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf2fb('0x5'));var config=require(_0xf2fb('0x6'));var attributes=require(_0xf2fb('0x7'));module[_0xf2fb('0x8')]=function(_0x418bf4,_0x1b15ae){return _0x418bf4[_0xf2fb('0x9')](_0xf2fb('0xa'),attributes,{'tableName':_0xf2fb('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.rpc.js b/server/api/whatsappAccount/whatsappAccount.rpc.js index 267b348..bf6885b 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 _0x4fe5=['then','info','WhatsappAccount,\x20%s,\x20%s','debug','stringify','error','code','message','result','ShowWhatsappAccount','WhatsappAccount','find','options','include','model','map','attributes','catch','lodash','moment','bluebird','ioredis','../../mysqldb','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./whatsappAccount.socket','register','request'];(function(_0x2e2253,_0x4dda6a){var _0x58488c=function(_0x5c9ec7){while(--_0x5c9ec7){_0x2e2253['push'](_0x2e2253['shift']());}};_0x58488c(++_0x4dda6a);}(_0x4fe5,0xbc));var _0x54fe=function(_0x4dda23,_0x5efb03){_0x4dda23=_0x4dda23-0x0;var _0x84b2ec=_0x4fe5[_0x4dda23];return _0x84b2ec;};'use strict';var _=require(_0x54fe('0x0'));var util=require('util');var moment=require(_0x54fe('0x1'));var BPromise=require(_0x54fe('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x54fe('0x3'));var db=require(_0x54fe('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x54fe('0x5'));var config=require(_0x54fe('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x54fe('0x7')][_0x54fe('0x8')]({'port':0x232a});config[_0x54fe('0x9')]=_[_0x54fe('0xa')](config['redis'],{'host':_0x54fe('0xb'),'port':0x18eb});var socket=require(_0x54fe('0xc'))(new Redis(config['redis']));require(_0x54fe('0xd'))[_0x54fe('0xe')](socket);function respondWithRpcPromise(_0xf26262,_0x360e24,_0x393ded){return new BPromise(function(_0xe96b1f,_0x33a10d){return client[_0x54fe('0xf')](_0xf26262,_0x393ded)[_0x54fe('0x10')](function(_0x3c1cd3){logger[_0x54fe('0x11')](_0x54fe('0x12'),_0x360e24,'request\x20sent');logger[_0x54fe('0x13')]('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x360e24,'request\x20sent',JSON[_0x54fe('0x14')](_0x3c1cd3));if(_0x3c1cd3[_0x54fe('0x15')]){if(_0x3c1cd3['error'][_0x54fe('0x16')]===0x1f4){logger['error']('WhatsappAccount,\x20%s,\x20%s',_0x360e24,_0x3c1cd3[_0x54fe('0x15')][_0x54fe('0x17')]);return _0x33a10d(_0x3c1cd3[_0x54fe('0x15')][_0x54fe('0x17')]);}logger[_0x54fe('0x15')]('WhatsappAccount,\x20%s,\x20%s',_0x360e24,_0x3c1cd3[_0x54fe('0x15')][_0x54fe('0x17')]);return _0xe96b1f(_0x3c1cd3[_0x54fe('0x15')][_0x54fe('0x17')]);}else{logger[_0x54fe('0x11')](_0x54fe('0x12'),_0x360e24,'request\x20sent');_0xe96b1f(_0x3c1cd3[_0x54fe('0x18')][_0x54fe('0x17')]);}})['catch'](function(_0x2c2819){logger[_0x54fe('0x15')]('WhatsappAccount,\x20%s,\x20%s',_0x360e24,_0x2c2819);_0x33a10d(_0x2c2819);});});}exports[_0x54fe('0x19')]=function(_0x15fac5){var _0xa223c2=this;return new Promise(function(_0x178c3e,_0x305b26){return db[_0x54fe('0x1a')][_0x54fe('0x1b')]({'raw':_0x15fac5[_0x54fe('0x1c')]?_0x15fac5[_0x54fe('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x15fac5[_0x54fe('0x1c')]?_0x15fac5[_0x54fe('0x1c')]['where']||null:null,'attributes':_0x15fac5[_0x54fe('0x1c')]?_0x15fac5[_0x54fe('0x1c')]['attributes']||null:null,'include':_0x15fac5['options']?_0x15fac5[_0x54fe('0x1c')][_0x54fe('0x1d')]?_['map'](_0x15fac5[_0x54fe('0x1c')][_0x54fe('0x1d')],function(_0x4228b8){return{'model':db[_0x4228b8[_0x54fe('0x1e')]],'as':_0x4228b8['as'],'attributes':_0x4228b8['attributes'],'include':_0x4228b8[_0x54fe('0x1d')]?_[_0x54fe('0x1f')](_0x4228b8[_0x54fe('0x1d')],function(_0xf7739e){return{'model':db[_0xf7739e[_0x54fe('0x1e')]],'as':_0xf7739e['as'],'attributes':_0xf7739e[_0x54fe('0x20')],'include':_0xf7739e[_0x54fe('0x1d')]?_[_0x54fe('0x1f')](_0xf7739e['include'],function(_0x5aa96c){return{'model':db[_0x5aa96c[_0x54fe('0x1e')]],'as':_0x5aa96c['as'],'attributes':_0x5aa96c[_0x54fe('0x20')]};}):[]};}):[]};}):[]:[]})[_0x54fe('0x10')](function(_0x15aa15){logger[_0x54fe('0x11')](_0x54fe('0x19'),_0x15fac5);logger[_0x54fe('0x13')](_0x54fe('0x19'),_0x15fac5,JSON[_0x54fe('0x14')](_0x15aa15));_0x178c3e(_0x15aa15);})[_0x54fe('0x21')](function(_0x5322a6){logger[_0x54fe('0x15')](_0x54fe('0x19'),_0x5322a6['message'],_0x15fac5);_0x305b26(_0xa223c2[_0x54fe('0x15')](0x1f4,_0x5322a6[_0x54fe('0x17')]));});});}; \ No newline at end of file +var _0x6f24=['options','raw','attributes','include','model','map','ShowWhatsappAccount','lodash','util','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','./whatsappAccount.socket','register','request','then','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','WhatsappAccount','find'];(function(_0x2af338,_0x3058ca){var _0x204f4e=function(_0x45ef76){while(--_0x45ef76){_0x2af338['push'](_0x2af338['shift']());}};_0x204f4e(++_0x3058ca);}(_0x6f24,0x76));var _0x46f2=function(_0x47604d,_0x15a014){_0x47604d=_0x47604d-0x0;var _0x388e4c=_0x6f24[_0x47604d];return _0x388e4c;};'use strict';var _=require(_0x46f2('0x0'));var util=require(_0x46f2('0x1'));var moment=require('moment');var BPromise=require(_0x46f2('0x2'));var rs=require(_0x46f2('0x3'));var fs=require('fs');var Redis=require(_0x46f2('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x46f2('0x5'));var logger=require('../../config/logger')(_0x46f2('0x6'));var config=require(_0x46f2('0x7'));var jayson=require(_0x46f2('0x8'));var client=jayson[_0x46f2('0x9')][_0x46f2('0xa')]({'port':0x232a});config['redis']=_[_0x46f2('0xb')](config[_0x46f2('0xc')],{'host':_0x46f2('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x46f2('0xc')]));require(_0x46f2('0xe'))[_0x46f2('0xf')](socket);function respondWithRpcPromise(_0x1504b5,_0x588630,_0x49e81a){return new BPromise(function(_0x42d435,_0x3267d4){return client[_0x46f2('0x10')](_0x1504b5,_0x49e81a)[_0x46f2('0x11')](function(_0x52b5ca){logger[_0x46f2('0x12')](_0x46f2('0x13'),_0x588630,_0x46f2('0x14'));logger[_0x46f2('0x15')]('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x588630,_0x46f2('0x14'),JSON[_0x46f2('0x16')](_0x52b5ca));if(_0x52b5ca[_0x46f2('0x17')]){if(_0x52b5ca[_0x46f2('0x17')][_0x46f2('0x18')]===0x1f4){logger[_0x46f2('0x17')](_0x46f2('0x13'),_0x588630,_0x52b5ca[_0x46f2('0x17')][_0x46f2('0x19')]);return _0x3267d4(_0x52b5ca[_0x46f2('0x17')][_0x46f2('0x19')]);}logger[_0x46f2('0x17')](_0x46f2('0x13'),_0x588630,_0x52b5ca[_0x46f2('0x17')][_0x46f2('0x19')]);return _0x42d435(_0x52b5ca[_0x46f2('0x17')][_0x46f2('0x19')]);}else{logger[_0x46f2('0x12')](_0x46f2('0x13'),_0x588630,_0x46f2('0x14'));_0x42d435(_0x52b5ca[_0x46f2('0x1a')]['message']);}})[_0x46f2('0x1b')](function(_0x5a1380){logger[_0x46f2('0x17')](_0x46f2('0x13'),_0x588630,_0x5a1380);_0x3267d4(_0x5a1380);});});}exports['ShowWhatsappAccount']=function(_0x5970a1){var _0x45ea96=this;return new Promise(function(_0x1fac0d,_0x170b5e){return db[_0x46f2('0x1c')][_0x46f2('0x1d')]({'raw':_0x5970a1[_0x46f2('0x1e')]?_0x5970a1['options'][_0x46f2('0x1f')]===undefined?!![]:![]:!![],'where':_0x5970a1['options']?_0x5970a1[_0x46f2('0x1e')]['where']||null:null,'attributes':_0x5970a1[_0x46f2('0x1e')]?_0x5970a1[_0x46f2('0x1e')][_0x46f2('0x20')]||null:null,'include':_0x5970a1[_0x46f2('0x1e')]?_0x5970a1[_0x46f2('0x1e')][_0x46f2('0x21')]?_['map'](_0x5970a1[_0x46f2('0x1e')][_0x46f2('0x21')],function(_0x3d3767){return{'model':db[_0x3d3767[_0x46f2('0x22')]],'as':_0x3d3767['as'],'attributes':_0x3d3767['attributes'],'include':_0x3d3767[_0x46f2('0x21')]?_[_0x46f2('0x23')](_0x3d3767[_0x46f2('0x21')],function(_0x5c97b0){return{'model':db[_0x5c97b0[_0x46f2('0x22')]],'as':_0x5c97b0['as'],'attributes':_0x5c97b0['attributes'],'include':_0x5c97b0['include']?_[_0x46f2('0x23')](_0x5c97b0['include'],function(_0x2de742){return{'model':db[_0x2de742[_0x46f2('0x22')]],'as':_0x2de742['as'],'attributes':_0x2de742['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x1e4b64){logger[_0x46f2('0x12')](_0x46f2('0x24'),_0x5970a1);logger['debug'](_0x46f2('0x24'),_0x5970a1,JSON['stringify'](_0x1e4b64));_0x1fac0d(_0x1e4b64);})[_0x46f2('0x1b')](function(_0x58a95b){logger[_0x46f2('0x17')](_0x46f2('0x24'),_0x58a95b[_0x46f2('0x19')],_0x5970a1);_0x170b5e(_0x45ea96[_0x46f2('0x17')](0x1f4,_0x58a95b[_0x46f2('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.socket.js b/server/api/whatsappAccount/whatsappAccount.socket.js index e3fb623..be12e6d 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 _0xcbc9=['./whatsappAccount.events','remove','emit','removeListener','register','length','whatsappAccount:'];(function(_0x23161f,_0x63403f){var _0x41093a=function(_0x1244f5){while(--_0x1244f5){_0x23161f['push'](_0x23161f['shift']());}};_0x41093a(++_0x63403f);}(_0xcbc9,0xa1));var _0x9cbc=function(_0xf973b7,_0x46699f){_0xf973b7=_0xf973b7-0x0;var _0x499087=_0xcbc9[_0xf973b7];return _0x499087;};'use strict';var WhatsappAccountEvents=require(_0x9cbc('0x0'));var events=['save',_0x9cbc('0x1'),'update'];function createListener(_0x29e49a,_0x5470bd){return function(_0xf64564){_0x5470bd[_0x9cbc('0x2')](_0x29e49a,_0xf64564);};}function removeListener(_0x50090e,_0x4cf2d3){return function(){WhatsappAccountEvents[_0x9cbc('0x3')](_0x50090e,_0x4cf2d3);};}exports[_0x9cbc('0x4')]=function(_0x57ae4b){for(var _0x2e6bee=0x0,_0x1f9fee=events[_0x9cbc('0x5')];_0x2e6bee<_0x1f9fee;_0x2e6bee++){var _0x1b1b1a=events[_0x2e6bee];var _0x2f0aa8=createListener(_0x9cbc('0x6')+_0x1b1b1a,_0x57ae4b);WhatsappAccountEvents['on'](_0x1b1b1a,_0x2f0aa8);}}; \ No newline at end of file +var _0xc60f=['length','./whatsappAccount.events','save','remove','update','emit'];(function(_0x465a0c,_0x19d4d5){var _0x1e202e=function(_0x27bd8a){while(--_0x27bd8a){_0x465a0c['push'](_0x465a0c['shift']());}};_0x1e202e(++_0x19d4d5);}(_0xc60f,0xfd));var _0xfc60=function(_0x184842,_0x522104){_0x184842=_0x184842-0x0;var _0x574731=_0xc60f[_0x184842];return _0x574731;};'use strict';var WhatsappAccountEvents=require(_0xfc60('0x0'));var events=[_0xfc60('0x1'),_0xfc60('0x2'),_0xfc60('0x3')];function createListener(_0x49b81c,_0x48a75c){return function(_0x25a618){_0x48a75c[_0xfc60('0x4')](_0x49b81c,_0x25a618);};}function removeListener(_0x3afb2c,_0x5d3941){return function(){WhatsappAccountEvents['removeListener'](_0x3afb2c,_0x5d3941);};}exports['register']=function(_0x452c2f){for(var _0x351ce6=0x0,_0x5c1101=events[_0xfc60('0x5')];_0x351ce6<_0x5c1101;_0x351ce6++){var _0x2256e1=events[_0x351ce6];var _0x30487e=createListener('whatsappAccount:'+_0x2256e1,_0x452c2f);WhatsappAccountEvents['on'](_0x2256e1,_0x30487e);}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/index.js b/server/api/whatsappApplication/index.js index 5b7aef5..7d5240e 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 _0x7e16=['util','path','Router','fs-extra','../../components/interaction/service','../../config/environment','./whatsappApplication.controller','get','isAuthenticated','/:id','show','post','put','update','delete','destroy','exports','multer'];(function(_0x13843f,_0x50422d){var _0x1063ae=function(_0x12fd6b){while(--_0x12fd6b){_0x13843f['push'](_0x13843f['shift']());}};_0x1063ae(++_0x50422d);}(_0x7e16,0x6b));var _0x67e1=function(_0x451369,_0x464043){_0x451369=_0x451369-0x0;var _0x3ceab4=_0x7e16[_0x451369];return _0x3ceab4;};'use strict';var multer=require(_0x67e1('0x0'));var util=require(_0x67e1('0x1'));var path=require(_0x67e1('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x67e1('0x3')]();var fs_extra=require(_0x67e1('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x67e1('0x5'));var config=require(_0x67e1('0x6'));var controller=require(_0x67e1('0x7'));router[_0x67e1('0x8')]('/',auth[_0x67e1('0x9')](),controller['index']);router['get'](_0x67e1('0xa'),auth[_0x67e1('0x9')](),controller[_0x67e1('0xb')]);router[_0x67e1('0xc')]('/',auth['isAuthenticated'](),controller['create']);router[_0x67e1('0xd')]('/:id',auth['isAuthenticated'](),controller[_0x67e1('0xe')]);router[_0x67e1('0xf')]('/:id',auth['isAuthenticated'](),controller[_0x67e1('0x10')]);module[_0x67e1('0x11')]=router; \ No newline at end of file +var _0xb6a3=['post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./whatsappApplication.controller','get','isAuthenticated','index','/:id','show'];(function(_0x3406b2,_0x3ddf5c){var _0x2c0e4b=function(_0x421c8f){while(--_0x421c8f){_0x3406b2['push'](_0x3406b2['shift']());}};_0x2c0e4b(++_0x3ddf5c);}(_0xb6a3,0x16c));var _0x3b6a=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0xb6a3[_0x2c91e9];return _0x13f0ff;};'use strict';var multer=require(_0x3b6a('0x0'));var util=require(_0x3b6a('0x1'));var path=require(_0x3b6a('0x2'));var timeout=require(_0x3b6a('0x3'));var express=require(_0x3b6a('0x4'));var router=express['Router']();var fs_extra=require(_0x3b6a('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x3b6a('0x6'));var config=require(_0x3b6a('0x7'));var controller=require(_0x3b6a('0x8'));router[_0x3b6a('0x9')]('/',auth[_0x3b6a('0xa')](),controller[_0x3b6a('0xb')]);router[_0x3b6a('0x9')](_0x3b6a('0xc'),auth[_0x3b6a('0xa')](),controller[_0x3b6a('0xd')]);router[_0x3b6a('0xe')]('/',auth[_0x3b6a('0xa')](),controller[_0x3b6a('0xf')]);router[_0x3b6a('0x10')]('/:id',auth['isAuthenticated'](),controller[_0x3b6a('0x11')]);router[_0x3b6a('0x12')]('/:id',auth['isAuthenticated'](),controller[_0x3b6a('0x13')]);module[_0x3b6a('0x14')]=router; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.attributes.js b/server/api/whatsappApplication/whatsappApplication.attributes.js index 3d839e0..363aa07 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 _0x5094=['TEXT','*,*,*,*','sequelize','INTEGER','STRING','noop'];(function(_0x2d7f0e,_0x3e6fbd){var _0x110b07=function(_0x557b00){while(--_0x557b00){_0x2d7f0e['push'](_0x2d7f0e['shift']());}};_0x110b07(++_0x3e6fbd);}(_0x5094,0xf2));var _0x4509=function(_0x40288d,_0x1bad3c){_0x40288d=_0x40288d-0x0;var _0x23d77a=_0x5094[_0x40288d];return _0x23d77a;};'use strict';var Sequelize=require(_0x4509('0x0'));module['exports']={'priority':{'type':Sequelize[_0x4509('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x4509('0x2')],'allowNull':![],'defaultValue':_0x4509('0x3')},'appdata':{'type':Sequelize[_0x4509('0x4')]()},'description':{'type':Sequelize[_0x4509('0x2')]},'interval':{'type':Sequelize[_0x4509('0x2')],'defaultValue':_0x4509('0x5')}}; \ No newline at end of file +var _0x8cfb=['exports','INTEGER','STRING','noop','TEXT','*,*,*,*','sequelize'];(function(_0x41cb86,_0x2b7e0f){var _0x564c41=function(_0x54b055){while(--_0x54b055){_0x41cb86['push'](_0x41cb86['shift']());}};_0x564c41(++_0x2b7e0f);}(_0x8cfb,0xed));var _0xb8cf=function(_0x232cf2,_0x4ffb79){_0x232cf2=_0x232cf2-0x0;var _0x463cec=_0x8cfb[_0x232cf2];return _0x463cec;};'use strict';var Sequelize=require(_0xb8cf('0x0'));module[_0xb8cf('0x1')]={'priority':{'type':Sequelize[_0xb8cf('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0xb8cf('0x3')],'allowNull':![],'defaultValue':_0xb8cf('0x4')},'appdata':{'type':Sequelize[_0xb8cf('0x5')]()},'description':{'type':Sequelize[_0xb8cf('0x3')]},'interval':{'type':Sequelize[_0xb8cf('0x3')],'defaultValue':_0xb8cf('0x6')}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.controller.js b/server/api/whatsappApplication/whatsappApplication.controller.js index edaa9df..2264b5a 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 _0x002d=['../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','reject','save','update','then','destroy','name','send','index','map','WhatsappApplication','rawAttributes','type','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','params','catch','create','body','find','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs'];(function(_0x2bcb4e,_0x453b69){var _0x881e05=function(_0x303756){while(--_0x303756){_0x2bcb4e['push'](_0x2bcb4e['shift']());}};_0x881e05(++_0x453b69);}(_0x002d,0xca));var _0xd002=function(_0x385f72,_0x5446e8){_0x385f72=_0x385f72-0x0;var _0x210766=_0x002d[_0x385f72];return _0x210766;};'use strict';var emlformat=require(_0xd002('0x0'));var rimraf=require(_0xd002('0x1'));var zipdir=require(_0xd002('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xd002('0x3'));var BPromise=require(_0xd002('0x4'));var Mustache=require(_0xd002('0x5'));var util=require(_0xd002('0x6'));var path=require(_0xd002('0x7'));var sox=require(_0xd002('0x8'));var csv=require(_0xd002('0x9'));var ejs=require(_0xd002('0xa'));var fs=require('fs');var fs_extra=require(_0xd002('0xb'));var _=require(_0xd002('0xc'));var squel=require(_0xd002('0xd'));var crypto=require(_0xd002('0xe'));var jsforce=require(_0xd002('0xf'));var deskjs=require(_0xd002('0x10'));var toCsv=require(_0xd002('0x9'));var querystring=require(_0xd002('0x11'));var Papa=require(_0xd002('0x12'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xd002('0x13'));var as=require(_0xd002('0x14'));var hardwareService=require(_0xd002('0x15'));var logger=require('../../config/logger')(_0xd002('0x16'));var utils=require(_0xd002('0x17'));var config=require(_0xd002('0x18'));var licenseUtil=require(_0xd002('0x19'));var db=require(_0xd002('0x1a'))['db'];function respondWithStatusCode(_0x1e6efa,_0x21a778){_0x21a778=_0x21a778||0xcc;return function(_0x28920f){if(_0x28920f){return _0x1e6efa[_0xd002('0x1b')](_0x21a778);}return _0x1e6efa[_0xd002('0x1c')](_0x21a778)[_0xd002('0x1d')]();};}function respondWithResult(_0x4de1c3,_0x3cbe14){_0x3cbe14=_0x3cbe14||0xc8;return function(_0x1e5c3b){if(_0x1e5c3b){return _0x4de1c3['status'](_0x3cbe14)['json'](_0x1e5c3b);}};}function respondWithFilteredResult(_0x5bc910,_0x460e7b){return function(_0x53cd4b){if(_0x53cd4b){var _0x13acd5=typeof _0x460e7b[_0xd002('0x1e')]===_0xd002('0x1f')&&typeof _0x460e7b[_0xd002('0x20')]===_0xd002('0x1f');var _0x124d97=_0x53cd4b[_0xd002('0x21')];var _0x5e1f31=_0x13acd5?0x0:_0x460e7b[_0xd002('0x1e')];var _0x4708f6=_0x13acd5?_0x53cd4b[_0xd002('0x21')]:_0x460e7b[_0xd002('0x1e')]+_0x460e7b[_0xd002('0x20')];var _0x4aa45d;if(_0x4708f6>=_0x124d97){_0x4708f6=_0x124d97;_0x4aa45d=0xc8;}else{_0x4aa45d=0xce;}_0x5bc910[_0xd002('0x1c')](_0x4aa45d);return _0x5bc910[_0xd002('0x22')](_0xd002('0x23'),_0x5e1f31+'-'+_0x4708f6+'/'+_0x124d97)[_0xd002('0x24')](_0x53cd4b);}return null;};}function patchUpdates(_0x5f3854){return function(_0x27c9c5){try{jsonpatch['apply'](_0x27c9c5,_0x5f3854,!![]);}catch(_0x490310){return BPromise[_0xd002('0x25')](_0x490310);}return _0x27c9c5[_0xd002('0x26')]();};}function saveUpdates(_0x1bfa76,_0x45cd2e){return function(_0x28cfb1){if(_0x28cfb1){return _0x28cfb1[_0xd002('0x27')](_0x1bfa76)[_0xd002('0x28')](function(_0x3a99ee){return _0x3a99ee;});}return null;};}function removeEntity(_0xe28024,_0x15ccfb){return function(_0x1a9884){if(_0x1a9884){return _0x1a9884[_0xd002('0x29')]()['then'](function(){_0xe28024[_0xd002('0x1c')](0xcc)[_0xd002('0x1d')]();});}};}function handleEntityNotFound(_0x55e3be,_0x32ac79){return function(_0x21fe25){if(!_0x21fe25){_0x55e3be[_0xd002('0x1b')](0x194);}return _0x21fe25;};}function handleError(_0x4df8db,_0x1c4b8a){_0x1c4b8a=_0x1c4b8a||0x1f4;return function(_0x4f58fa){logger['error'](_0x4f58fa['stack']);if(_0x4f58fa[_0xd002('0x2a')]){delete _0x4f58fa[_0xd002('0x2a')];}_0x4df8db[_0xd002('0x1c')](_0x1c4b8a)[_0xd002('0x2b')](_0x4f58fa);};}exports[_0xd002('0x2c')]=function(_0x24722d,_0x1648e1){var _0x3e0cc2={},_0x9999ea={},_0x70610d={'count':0x0,'rows':[]};var _0x5a79ba=_[_0xd002('0x2d')](db[_0xd002('0x2e')][_0xd002('0x2f')],function(_0x3b6653){return{'name':_0x3b6653['fieldName'],'type':_0x3b6653[_0xd002('0x30')]['key']};});_0x9999ea[_0xd002('0x31')]=_['map'](_0x5a79ba,_0xd002('0x2a'));_0x9999ea[_0xd002('0x32')]=_[_0xd002('0x33')](_0x24722d[_0xd002('0x32')]);_0x9999ea[_0xd002('0x34')]=_[_0xd002('0x35')](_0x9999ea[_0xd002('0x31')],_0x9999ea[_0xd002('0x32')]);_0x3e0cc2['attributes']=_[_0xd002('0x35')](_0x9999ea[_0xd002('0x31')],qs[_0xd002('0x36')](_0x24722d[_0xd002('0x32')][_0xd002('0x36')]));_0x3e0cc2[_0xd002('0x37')]=_0x3e0cc2['attributes']['length']?_0x3e0cc2['attributes']:_0x9999ea[_0xd002('0x31')];if(!_0x24722d['query'][_0xd002('0x38')](_0xd002('0x39'))){_0x3e0cc2[_0xd002('0x20')]=qs[_0xd002('0x20')](_0x24722d[_0xd002('0x32')][_0xd002('0x20')]);_0x3e0cc2[_0xd002('0x1e')]=qs[_0xd002('0x1e')](_0x24722d['query'][_0xd002('0x1e')]);}_0x3e0cc2[_0xd002('0x3a')]=qs['sort'](_0x24722d['query'][_0xd002('0x3b')]);_0x3e0cc2[_0xd002('0x3c')]=qs[_0xd002('0x34')](_[_0xd002('0x3d')](_0x24722d['query'],_0x9999ea[_0xd002('0x34')]),_0x5a79ba);if(_0x24722d['query'][_0xd002('0x3e')]){_0x3e0cc2[_0xd002('0x3c')]=_[_0xd002('0x3f')](_0x3e0cc2[_0xd002('0x3c')],{'$or':_[_0xd002('0x2d')](_0x5a79ba,function(_0x54c2ec){if(_0x54c2ec[_0xd002('0x30')]!==_0xd002('0x40')){var _0x23ad2e={};_0x23ad2e[_0x54c2ec[_0xd002('0x2a')]]={'$like':'%'+_0x24722d[_0xd002('0x32')][_0xd002('0x3e')]+'%'};return _0x23ad2e;}})});}_0x3e0cc2=_[_0xd002('0x3f')]({},_0x3e0cc2,_0x24722d[_0xd002('0x41')]);var _0x2693a9={'where':_0x3e0cc2[_0xd002('0x3c')]};return db[_0xd002('0x2e')][_0xd002('0x21')](_0x2693a9)[_0xd002('0x28')](function(_0x1509d0){_0x70610d[_0xd002('0x21')]=_0x1509d0;if(_0x24722d[_0xd002('0x32')]['includeAll']){_0x3e0cc2[_0xd002('0x42')]=[{'all':!![]}];}return db[_0xd002('0x2e')][_0xd002('0x43')](_0x3e0cc2);})[_0xd002('0x28')](function(_0x5339e3){_0x70610d[_0xd002('0x44')]=_0x5339e3;return _0x70610d;})[_0xd002('0x28')](respondWithFilteredResult(_0x1648e1,_0x3e0cc2))['catch'](handleError(_0x1648e1,null));};exports['show']=function(_0x3978a3,_0x382693){var _0x10ce62={'raw':!![],'where':{'id':_0x3978a3[_0xd002('0x45')]['id']}},_0x53e3ab={};_0x53e3ab['model']=_['keys'](db[_0xd002('0x2e')]['rawAttributes']);_0x53e3ab[_0xd002('0x32')]=_[_0xd002('0x33')](_0x3978a3['query']);_0x53e3ab[_0xd002('0x34')]=_[_0xd002('0x35')](_0x53e3ab[_0xd002('0x31')],_0x53e3ab[_0xd002('0x32')]);_0x10ce62[_0xd002('0x37')]=_['intersection'](_0x53e3ab['model'],qs[_0xd002('0x36')](_0x3978a3['query'][_0xd002('0x36')]));_0x10ce62[_0xd002('0x37')]=_0x10ce62['attributes']['length']?_0x10ce62[_0xd002('0x37')]:_0x53e3ab['model'];if(_0x3978a3[_0xd002('0x32')]['includeAll']){_0x10ce62[_0xd002('0x42')]=[{'all':!![]}];}_0x10ce62=_['merge']({},_0x10ce62,_0x3978a3[_0xd002('0x41')]);return db[_0xd002('0x2e')]['find'](_0x10ce62)[_0xd002('0x28')](handleEntityNotFound(_0x382693,null))[_0xd002('0x28')](respondWithResult(_0x382693,null))[_0xd002('0x46')](handleError(_0x382693,null));};exports[_0xd002('0x47')]=function(_0xe8893e,_0x246f9f){return db['WhatsappApplication'][_0xd002('0x47')](_0xe8893e[_0xd002('0x48')],{})[_0xd002('0x28')](respondWithResult(_0x246f9f,0xc9))[_0xd002('0x46')](handleError(_0x246f9f,null));};exports['update']=function(_0x1c5b7e,_0xf3edf0){if(_0x1c5b7e[_0xd002('0x48')]['id']){delete _0x1c5b7e[_0xd002('0x48')]['id'];}return db[_0xd002('0x2e')][_0xd002('0x49')]({'where':{'id':_0x1c5b7e['params']['id']}})[_0xd002('0x28')](handleEntityNotFound(_0xf3edf0,null))[_0xd002('0x28')](saveUpdates(_0x1c5b7e[_0xd002('0x48')],null))[_0xd002('0x28')](respondWithResult(_0xf3edf0,null))[_0xd002('0x46')](handleError(_0xf3edf0,null));};exports[_0xd002('0x29')]=function(_0x2f2c1f,_0x143060){return db[_0xd002('0x2e')][_0xd002('0x49')]({'where':{'id':_0x2f2c1f['params']['id']}})[_0xd002('0x28')](handleEntityNotFound(_0x143060,null))[_0xd002('0x28')](removeEntity(_0x143060,null))[_0xd002('0x46')](handleError(_0x143060,null));}; \ No newline at end of file +var _0x8710=['attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','create','body','find','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','error','stack','name','index','map','WhatsappApplication','rawAttributes','fieldName','type','key','model','query','keys'];(function(_0x5dd0f7,_0x14873c){var _0x115793=function(_0x39928d){while(--_0x39928d){_0x5dd0f7['push'](_0x5dd0f7['shift']());}};_0x115793(++_0x14873c);}(_0x8710,0x68));var _0x0871=function(_0x5386f8,_0x5db228){_0x5386f8=_0x5386f8-0x0;var _0x1cd006=_0x8710[_0x5386f8];return _0x1cd006;};'use strict';var emlformat=require(_0x0871('0x0'));var rimraf=require(_0x0871('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0871('0x2'));var rp=require(_0x0871('0x3'));var moment=require(_0x0871('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x0871('0x5'));var util=require(_0x0871('0x6'));var path=require('path');var sox=require(_0x0871('0x7'));var csv=require('to-csv');var ejs=require(_0x0871('0x8'));var fs=require('fs');var fs_extra=require(_0x0871('0x9'));var _=require(_0x0871('0xa'));var squel=require(_0x0871('0xb'));var crypto=require(_0x0871('0xc'));var jsforce=require(_0x0871('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x0871('0xe'));var querystring=require(_0x0871('0xf'));var Papa=require(_0x0871('0x10'));var Redis=require(_0x0871('0x11'));var authService=require(_0x0871('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x0871('0x13'));var hardwareService=require(_0x0871('0x14'));var logger=require(_0x0871('0x15'))(_0x0871('0x16'));var utils=require(_0x0871('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x0871('0x18'));var db=require(_0x0871('0x19'))['db'];function respondWithStatusCode(_0xc94c7b,_0x4759f2){_0x4759f2=_0x4759f2||0xcc;return function(_0x2b0031){if(_0x2b0031){return _0xc94c7b[_0x0871('0x1a')](_0x4759f2);}return _0xc94c7b[_0x0871('0x1b')](_0x4759f2)[_0x0871('0x1c')]();};}function respondWithResult(_0x552807,_0x4e1ad4){_0x4e1ad4=_0x4e1ad4||0xc8;return function(_0x34a51a){if(_0x34a51a){return _0x552807[_0x0871('0x1b')](_0x4e1ad4)[_0x0871('0x1d')](_0x34a51a);}};}function respondWithFilteredResult(_0xcba761,_0x153f30){return function(_0x2dde49){if(_0x2dde49){var _0x43ccae=typeof _0x153f30[_0x0871('0x1e')]===_0x0871('0x1f')&&typeof _0x153f30['limit']===_0x0871('0x1f');var _0x5f49b1=_0x2dde49[_0x0871('0x20')];var _0x238d3a=_0x43ccae?0x0:_0x153f30['offset'];var _0x6036b0=_0x43ccae?_0x2dde49[_0x0871('0x20')]:_0x153f30[_0x0871('0x1e')]+_0x153f30[_0x0871('0x21')];var _0x4d2033;if(_0x6036b0>=_0x5f49b1){_0x6036b0=_0x5f49b1;_0x4d2033=0xc8;}else{_0x4d2033=0xce;}_0xcba761['status'](_0x4d2033);return _0xcba761[_0x0871('0x22')](_0x0871('0x23'),_0x238d3a+'-'+_0x6036b0+'/'+_0x5f49b1)[_0x0871('0x1d')](_0x2dde49);}return null;};}function patchUpdates(_0x1c7426){return function(_0x1b4917){try{jsonpatch[_0x0871('0x24')](_0x1b4917,_0x1c7426,!![]);}catch(_0x360dd2){return BPromise[_0x0871('0x25')](_0x360dd2);}return _0x1b4917[_0x0871('0x26')]();};}function saveUpdates(_0x10ecb6,_0xb1df80){return function(_0x1ba14d){if(_0x1ba14d){return _0x1ba14d[_0x0871('0x27')](_0x10ecb6)['then'](function(_0x292e57){return _0x292e57;});}return null;};}function removeEntity(_0xe92246,_0x20ca39){return function(_0x3290dd){if(_0x3290dd){return _0x3290dd['destroy']()[_0x0871('0x28')](function(){_0xe92246[_0x0871('0x1b')](0xcc)[_0x0871('0x1c')]();});}};}function handleEntityNotFound(_0x34bea0,_0x49a37b){return function(_0x4d7a7f){if(!_0x4d7a7f){_0x34bea0['sendStatus'](0x194);}return _0x4d7a7f;};}function handleError(_0x29bdbc,_0x296f87){_0x296f87=_0x296f87||0x1f4;return function(_0x128720){logger[_0x0871('0x29')](_0x128720[_0x0871('0x2a')]);if(_0x128720[_0x0871('0x2b')]){delete _0x128720[_0x0871('0x2b')];}_0x29bdbc[_0x0871('0x1b')](_0x296f87)['send'](_0x128720);};}exports[_0x0871('0x2c')]=function(_0xf1dbc9,_0x283268){var _0x3e0d69={},_0x35d1f9={},_0x3e58bc={'count':0x0,'rows':[]};var _0x42c264=_[_0x0871('0x2d')](db[_0x0871('0x2e')][_0x0871('0x2f')],function(_0x5995be){return{'name':_0x5995be[_0x0871('0x30')],'type':_0x5995be[_0x0871('0x31')][_0x0871('0x32')]};});_0x35d1f9[_0x0871('0x33')]=_['map'](_0x42c264,_0x0871('0x2b'));_0x35d1f9[_0x0871('0x34')]=_[_0x0871('0x35')](_0xf1dbc9[_0x0871('0x34')]);_0x35d1f9['filters']=_['intersection'](_0x35d1f9[_0x0871('0x33')],_0x35d1f9['query']);_0x3e0d69[_0x0871('0x36')]=_[_0x0871('0x37')](_0x35d1f9[_0x0871('0x33')],qs[_0x0871('0x38')](_0xf1dbc9['query'][_0x0871('0x38')]));_0x3e0d69[_0x0871('0x36')]=_0x3e0d69[_0x0871('0x36')][_0x0871('0x39')]?_0x3e0d69[_0x0871('0x36')]:_0x35d1f9[_0x0871('0x33')];if(!_0xf1dbc9[_0x0871('0x34')][_0x0871('0x3a')](_0x0871('0x3b'))){_0x3e0d69['limit']=qs[_0x0871('0x21')](_0xf1dbc9[_0x0871('0x34')]['limit']);_0x3e0d69[_0x0871('0x1e')]=qs[_0x0871('0x1e')](_0xf1dbc9[_0x0871('0x34')][_0x0871('0x1e')]);}_0x3e0d69[_0x0871('0x3c')]=qs[_0x0871('0x3d')](_0xf1dbc9[_0x0871('0x34')][_0x0871('0x3d')]);_0x3e0d69[_0x0871('0x3e')]=qs[_0x0871('0x3f')](_[_0x0871('0x40')](_0xf1dbc9[_0x0871('0x34')],_0x35d1f9[_0x0871('0x3f')]),_0x42c264);if(_0xf1dbc9[_0x0871('0x34')][_0x0871('0x41')]){_0x3e0d69[_0x0871('0x3e')]=_[_0x0871('0x42')](_0x3e0d69[_0x0871('0x3e')],{'$or':_['map'](_0x42c264,function(_0x38db9d){if(_0x38db9d[_0x0871('0x31')]!==_0x0871('0x43')){var _0x453088={};_0x453088[_0x38db9d[_0x0871('0x2b')]]={'$like':'%'+_0xf1dbc9['query'][_0x0871('0x41')]+'%'};return _0x453088;}})});}_0x3e0d69=_['merge']({},_0x3e0d69,_0xf1dbc9[_0x0871('0x44')]);var _0x435e57={'where':_0x3e0d69[_0x0871('0x3e')]};return db[_0x0871('0x2e')]['count'](_0x435e57)[_0x0871('0x28')](function(_0x28d6da){_0x3e58bc[_0x0871('0x20')]=_0x28d6da;if(_0xf1dbc9['query'][_0x0871('0x45')]){_0x3e0d69[_0x0871('0x46')]=[{'all':!![]}];}return db[_0x0871('0x2e')][_0x0871('0x47')](_0x3e0d69);})[_0x0871('0x28')](function(_0x1a84cb){_0x3e58bc[_0x0871('0x48')]=_0x1a84cb;return _0x3e58bc;})['then'](respondWithFilteredResult(_0x283268,_0x3e0d69))[_0x0871('0x49')](handleError(_0x283268,null));};exports[_0x0871('0x4a')]=function(_0x3e9bf3,_0x13d0d9){var _0x35c83b={'raw':!![],'where':{'id':_0x3e9bf3[_0x0871('0x4b')]['id']}},_0x17b7eb={};_0x17b7eb[_0x0871('0x33')]=_[_0x0871('0x35')](db[_0x0871('0x2e')][_0x0871('0x2f')]);_0x17b7eb[_0x0871('0x34')]=_['keys'](_0x3e9bf3[_0x0871('0x34')]);_0x17b7eb['filters']=_[_0x0871('0x37')](_0x17b7eb['model'],_0x17b7eb['query']);_0x35c83b[_0x0871('0x36')]=_[_0x0871('0x37')](_0x17b7eb[_0x0871('0x33')],qs[_0x0871('0x38')](_0x3e9bf3[_0x0871('0x34')][_0x0871('0x38')]));_0x35c83b[_0x0871('0x36')]=_0x35c83b[_0x0871('0x36')][_0x0871('0x39')]?_0x35c83b[_0x0871('0x36')]:_0x17b7eb[_0x0871('0x33')];if(_0x3e9bf3['query']['includeAll']){_0x35c83b[_0x0871('0x46')]=[{'all':!![]}];}_0x35c83b=_[_0x0871('0x42')]({},_0x35c83b,_0x3e9bf3[_0x0871('0x44')]);return db[_0x0871('0x2e')]['find'](_0x35c83b)[_0x0871('0x28')](handleEntityNotFound(_0x13d0d9,null))['then'](respondWithResult(_0x13d0d9,null))[_0x0871('0x49')](handleError(_0x13d0d9,null));};exports[_0x0871('0x4c')]=function(_0x5292a1,_0x3171a9){return db[_0x0871('0x2e')]['create'](_0x5292a1[_0x0871('0x4d')],{})['then'](respondWithResult(_0x3171a9,0xc9))[_0x0871('0x49')](handleError(_0x3171a9,null));};exports[_0x0871('0x27')]=function(_0x2cfa7d,_0x1799fe){if(_0x2cfa7d[_0x0871('0x4d')]['id']){delete _0x2cfa7d['body']['id'];}return db[_0x0871('0x2e')]['find']({'where':{'id':_0x2cfa7d['params']['id']}})[_0x0871('0x28')](handleEntityNotFound(_0x1799fe,null))[_0x0871('0x28')](saveUpdates(_0x2cfa7d[_0x0871('0x4d')],null))[_0x0871('0x28')](respondWithResult(_0x1799fe,null))[_0x0871('0x49')](handleError(_0x1799fe,null));};exports['destroy']=function(_0x2b9a5d,_0x584e04){return db[_0x0871('0x2e')][_0x0871('0x4e')]({'where':{'id':_0x2b9a5d[_0x0871('0x4b')]['id']}})[_0x0871('0x28')](handleEntityNotFound(_0x584e04,null))[_0x0871('0x28')](removeEntity(_0x584e04,null))[_0x0871('0x49')](handleError(_0x584e04,null));}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.model.js b/server/api/whatsappApplication/whatsappApplication.model.js index 0cee207..5b2eb87 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 _0x4b1f=['api','moment','bluebird','path','rimraf','../../config/environment','define','WhatsappApplication','whatsapp_applications','lodash','util'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x4b1f,0x195));var _0xf4b1=function(_0x344a3f,_0x579a22){_0x344a3f=_0x344a3f-0x0;var _0x264712=_0x4b1f[_0x344a3f];return _0x264712;};'use strict';var _=require(_0xf4b1('0x0'));var util=require(_0xf4b1('0x1'));var logger=require('../../config/logger')(_0xf4b1('0x2'));var moment=require(_0xf4b1('0x3'));var BPromise=require(_0xf4b1('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf4b1('0x5'));var rimraf=require(_0xf4b1('0x6'));var config=require(_0xf4b1('0x7'));var attributes=require('./whatsappApplication.attributes');module['exports']=function(_0x1ab96b,_0x4b676){return _0x1ab96b[_0xf4b1('0x8')](_0xf4b1('0x9'),attributes,{'tableName':_0xf4b1('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xa37e=['bluebird','path','../../config/environment','./whatsappApplication.attributes','exports','define','utf8mb4','utf8mb4_unicode_ci','../../config/logger','api','moment'];(function(_0x35a22f,_0x4f99bd){var _0x5964e3=function(_0x3814b0){while(--_0x3814b0){_0x35a22f['push'](_0x35a22f['shift']());}};_0x5964e3(++_0x4f99bd);}(_0xa37e,0x97));var _0xea37=function(_0x56eb8d,_0x19f51a){_0x56eb8d=_0x56eb8d-0x0;var _0x2f29e1=_0xa37e[_0x56eb8d];return _0x2f29e1;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xea37('0x0'))(_0xea37('0x1'));var moment=require(_0xea37('0x2'));var BPromise=require(_0xea37('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xea37('0x4'));var rimraf=require('rimraf');var config=require(_0xea37('0x5'));var attributes=require(_0xea37('0x6'));module[_0xea37('0x7')]=function(_0x4d380b,_0x57135b){return _0x4d380b[_0xea37('0x8')]('WhatsappApplication',attributes,{'tableName':'whatsapp_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xea37('0x9'),'collate':_0xea37('0xa')});}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.rpc.js b/server/api/whatsappApplication/whatsappApplication.rpc.js index b887ae9..5ef949c 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 _0x4c4e=['result','catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request','info','WhatsappApplication,\x20%s,\x20%s','request\x20sent','debug','WhatsappApplication,\x20%s,\x20%s,\x20%s','error','code','message'];(function(_0x2c16e8,_0x446971){var _0x348cf4=function(_0x33beee){while(--_0x33beee){_0x2c16e8['push'](_0x2c16e8['shift']());}};_0x348cf4(++_0x446971);}(_0x4c4e,0x152));var _0xe4c4=function(_0x4a2c87,_0x1fc043){_0x4a2c87=_0x4a2c87-0x0;var _0x10d121=_0x4c4e[_0x4a2c87];return _0x10d121;};'use strict';var _=require(_0xe4c4('0x0'));var util=require('util');var moment=require(_0xe4c4('0x1'));var BPromise=require(_0xe4c4('0x2'));var rs=require(_0xe4c4('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe4c4('0x4'))['db'];var utils=require(_0xe4c4('0x5'));var logger=require(_0xe4c4('0x6'))('rpc');var config=require(_0xe4c4('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xe4c4('0x8')][_0xe4c4('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x262b64,_0xad105,_0x22085a){return new BPromise(function(_0x329d29,_0x28a42e){return client[_0xe4c4('0xa')](_0x262b64,_0x22085a)['then'](function(_0x589b2e){logger[_0xe4c4('0xb')](_0xe4c4('0xc'),_0xad105,_0xe4c4('0xd'));logger[_0xe4c4('0xe')](_0xe4c4('0xf'),_0xad105,_0xe4c4('0xd'),JSON['stringify'](_0x589b2e));if(_0x589b2e[_0xe4c4('0x10')]){if(_0x589b2e[_0xe4c4('0x10')][_0xe4c4('0x11')]===0x1f4){logger[_0xe4c4('0x10')]('WhatsappApplication,\x20%s,\x20%s',_0xad105,_0x589b2e[_0xe4c4('0x10')][_0xe4c4('0x12')]);return _0x28a42e(_0x589b2e['error'][_0xe4c4('0x12')]);}logger[_0xe4c4('0x10')]('WhatsappApplication,\x20%s,\x20%s',_0xad105,_0x589b2e[_0xe4c4('0x10')][_0xe4c4('0x12')]);return _0x329d29(_0x589b2e['error'][_0xe4c4('0x12')]);}else{logger[_0xe4c4('0xb')](_0xe4c4('0xc'),_0xad105,_0xe4c4('0xd'));_0x329d29(_0x589b2e[_0xe4c4('0x13')][_0xe4c4('0x12')]);}})[_0xe4c4('0x14')](function(_0x1038cb){logger[_0xe4c4('0x10')](_0xe4c4('0xc'),_0xad105,_0x1038cb);_0x28a42e(_0x1038cb);});});} \ No newline at end of file +var _0x81bd=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','request','then','info','WhatsappApplication,\x20%s,\x20%s','request\x20sent','debug','WhatsappApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash'];(function(_0x492bdc,_0x5633a1){var _0x1f4fa0=function(_0x22434e){while(--_0x22434e){_0x492bdc['push'](_0x492bdc['shift']());}};_0x1f4fa0(++_0x5633a1);}(_0x81bd,0x7c));var _0xd81b=function(_0x356005,_0x411466){_0x356005=_0x356005-0x0;var _0x2bb35b=_0x81bd[_0x356005];return _0x2bb35b;};'use strict';var _=require(_0xd81b('0x0'));var util=require(_0xd81b('0x1'));var moment=require(_0xd81b('0x2'));var BPromise=require(_0xd81b('0x3'));var rs=require(_0xd81b('0x4'));var fs=require('fs');var Redis=require(_0xd81b('0x5'));var db=require(_0xd81b('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xd81b('0x7'))(_0xd81b('0x8'));var config=require(_0xd81b('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xd81b('0xa')][_0xd81b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1f3f2c,_0x562084,_0x5e14e8){return new BPromise(function(_0xa4cf97,_0x5468d5){return client[_0xd81b('0xc')](_0x1f3f2c,_0x5e14e8)[_0xd81b('0xd')](function(_0x3420a7){logger[_0xd81b('0xe')](_0xd81b('0xf'),_0x562084,_0xd81b('0x10'));logger[_0xd81b('0x11')](_0xd81b('0x12'),_0x562084,_0xd81b('0x10'),JSON[_0xd81b('0x13')](_0x3420a7));if(_0x3420a7[_0xd81b('0x14')]){if(_0x3420a7[_0xd81b('0x14')][_0xd81b('0x15')]===0x1f4){logger['error'](_0xd81b('0xf'),_0x562084,_0x3420a7['error'][_0xd81b('0x16')]);return _0x5468d5(_0x3420a7[_0xd81b('0x14')]['message']);}logger[_0xd81b('0x14')]('WhatsappApplication,\x20%s,\x20%s',_0x562084,_0x3420a7[_0xd81b('0x14')][_0xd81b('0x16')]);return _0xa4cf97(_0x3420a7[_0xd81b('0x14')][_0xd81b('0x16')]);}else{logger[_0xd81b('0xe')]('WhatsappApplication,\x20%s,\x20%s',_0x562084,_0xd81b('0x10'));_0xa4cf97(_0x3420a7[_0xd81b('0x17')]['message']);}})[_0xd81b('0x18')](function(_0x26df61){logger[_0xd81b('0x14')](_0xd81b('0xf'),_0x562084,_0x26df61);_0x5468d5(_0x26df61);});});} \ No newline at end of file diff --git a/server/api/whatsappInteraction/index.js b/server/api/whatsappInteraction/index.js index de96997..f49a969 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 _0xdb8b=['delete','whatsappinteraction:destroy','removeTags','exports','util','path','connect-timeout','fs-extra','../../components/interaction/service','../../config/environment','./whatsappInteraction.controller','get','index','/describe','isAuthenticated','describe','/:id','/:id/messages','getMessages','/:id/download','post','/:id/tags','tracked','whatsapp','whatsappinteraction:addtags','addTags','put','whatsappinteraction:update'];(function(_0x1b7264,_0x4cceb8){var _0xfaa47e=function(_0x2be6d9){while(--_0x2be6d9){_0x1b7264['push'](_0x1b7264['shift']());}};_0xfaa47e(++_0x4cceb8);}(_0xdb8b,0x1c4));var _0xbdb8=function(_0x4d7e10,_0x5cd58f){_0x4d7e10=_0x4d7e10-0x0;var _0x1e7a8b=_0xdb8b[_0x4d7e10];return _0x1e7a8b;};'use strict';var multer=require('multer');var util=require(_0xbdb8('0x0'));var path=require(_0xbdb8('0x1'));var timeout=require(_0xbdb8('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xbdb8('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xbdb8('0x4'));var config=require(_0xbdb8('0x5'));var controller=require(_0xbdb8('0x6'));router[_0xbdb8('0x7')]('/',auth['isAuthenticated'](),controller[_0xbdb8('0x8')]);router['get'](_0xbdb8('0x9'),auth[_0xbdb8('0xa')](),controller[_0xbdb8('0xb')]);router[_0xbdb8('0x7')](_0xbdb8('0xc'),auth[_0xbdb8('0xa')](),controller['show']);router[_0xbdb8('0x7')](_0xbdb8('0xd'),auth[_0xbdb8('0xa')](),controller[_0xbdb8('0xe')]);router[_0xbdb8('0x7')](_0xbdb8('0xf'),auth[_0xbdb8('0xa')](),controller['download']);router['post']('/',auth[_0xbdb8('0xa')](),controller['create']);router[_0xbdb8('0x10')]('/:id/messages',auth[_0xbdb8('0xa')](),controller['addMessage']);router[_0xbdb8('0x10')](_0xbdb8('0x11'),auth[_0xbdb8('0xa')](),interaction[_0xbdb8('0x12')](_0xbdb8('0x13'),_0xbdb8('0x14')),controller[_0xbdb8('0x15')]);router[_0xbdb8('0x16')](_0xbdb8('0xc'),auth[_0xbdb8('0xa')](),interaction[_0xbdb8('0x12')](_0xbdb8('0x13'),_0xbdb8('0x17')),controller['update']);router[_0xbdb8('0x18')](_0xbdb8('0xc'),auth[_0xbdb8('0xa')](),interaction['tracked']('whatsapp',_0xbdb8('0x19')),controller['destroy']);router[_0xbdb8('0x18')](_0xbdb8('0x11'),auth[_0xbdb8('0xa')](),controller[_0xbdb8('0x1a')]);module[_0xbdb8('0x1b')]=router; \ No newline at end of file +var _0x6596=['whatsappinteraction:destroy','delete','removeTags','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/describe','/:id','show','/:id/messages','getMessages','post','create','addMessage','/:id/tags','tracked','whatsapp','whatsappinteraction:addtags','addTags','whatsappinteraction:update','update'];(function(_0x1d60cf,_0x38f82e){var _0x4e8d37=function(_0x5a298f){while(--_0x5a298f){_0x1d60cf['push'](_0x1d60cf['shift']());}};_0x4e8d37(++_0x38f82e);}(_0x6596,0x1d3));var _0x6659=function(_0x1979ee,_0x5aae8c){_0x1979ee=_0x1979ee-0x0;var _0x113f7a=_0x6596[_0x1979ee];return _0x113f7a;};'use strict';var multer=require(_0x6659('0x0'));var util=require(_0x6659('0x1'));var path=require('path');var timeout=require(_0x6659('0x2'));var express=require(_0x6659('0x3'));var router=express[_0x6659('0x4')]();var fs_extra=require(_0x6659('0x5'));var auth=require(_0x6659('0x6'));var interaction=require(_0x6659('0x7'));var config=require('../../config/environment');var controller=require('./whatsappInteraction.controller');router[_0x6659('0x8')]('/',auth[_0x6659('0x9')](),controller[_0x6659('0xa')]);router[_0x6659('0x8')](_0x6659('0xb'),auth['isAuthenticated'](),controller['describe']);router[_0x6659('0x8')](_0x6659('0xc'),auth[_0x6659('0x9')](),controller[_0x6659('0xd')]);router[_0x6659('0x8')](_0x6659('0xe'),auth['isAuthenticated'](),controller[_0x6659('0xf')]);router['get']('/:id/download',auth[_0x6659('0x9')](),controller['download']);router[_0x6659('0x10')]('/',auth[_0x6659('0x9')](),controller[_0x6659('0x11')]);router[_0x6659('0x10')]('/:id/messages',auth[_0x6659('0x9')](),controller[_0x6659('0x12')]);router['post'](_0x6659('0x13'),auth[_0x6659('0x9')](),interaction[_0x6659('0x14')](_0x6659('0x15'),_0x6659('0x16')),controller[_0x6659('0x17')]);router['put'](_0x6659('0xc'),auth[_0x6659('0x9')](),interaction[_0x6659('0x14')](_0x6659('0x15'),_0x6659('0x18')),controller[_0x6659('0x19')]);router['delete']('/:id',auth[_0x6659('0x9')](),interaction['tracked'](_0x6659('0x15'),_0x6659('0x1a')),controller['destroy']);router[_0x6659('0x1b')]('/:id/tags',auth[_0x6659('0x9')](),controller[_0x6659('0x1c')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.attributes.js b/server/api/whatsappInteraction/whatsappInteraction.attributes.js index 88cab0a..8819720 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 _0xcefd=['DATE','STRING','ENUM','out','INTEGER','moment','exports','BOOLEAN'];(function(_0x3e7783,_0x2f3344){var _0x2dba61=function(_0x18785b){while(--_0x18785b){_0x3e7783['push'](_0x3e7783['shift']());}};_0x2dba61(++_0x2f3344);}(_0xcefd,0x1bd));var _0xdcef=function(_0x2197c3,_0x310b38){_0x2197c3=_0x2197c3-0x0;var _0x120c87=_0xcefd[_0x2197c3];return _0x120c87;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xdcef('0x0'));module[_0xdcef('0x1')]={'closed':{'type':Sequelize[_0xdcef('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xdcef('0x3')]},'disposition':{'type':Sequelize[_0xdcef('0x4')]},'secondDisposition':{'type':Sequelize[_0xdcef('0x4')]},'thirdDisposition':{'type':Sequelize[_0xdcef('0x4')]},'note':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0xdcef('0x4')]},'read1stAt':{'type':Sequelize[_0xdcef('0x3')]},'firstMsgDirection':{'type':Sequelize[_0xdcef('0x5')]('in',_0xdcef('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xdcef('0x3')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0xdcef('0x6')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0xdcef('0x2')],'defaultValue':![]},'queueId':{'type':Sequelize[_0xdcef('0x7')]}}; \ No newline at end of file +var _0x6629=['sequelize','BOOLEAN','DATE','STRING','out','ENUM'];(function(_0xd1d19a,_0x1933f0){var _0x52a79d=function(_0x5199e2){while(--_0x5199e2){_0xd1d19a['push'](_0xd1d19a['shift']());}};_0x52a79d(++_0x1933f0);}(_0x6629,0x1c2));var _0x9662=function(_0x3e3081,_0x52294a){_0x3e3081=_0x3e3081-0x0;var _0x138e17=_0x6629[_0x3e3081];return _0x138e17;};'use strict';var Sequelize=require(_0x9662('0x0'));var moment=require('moment');module['exports']={'closed':{'type':Sequelize[_0x9662('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x9662('0x2')]},'disposition':{'type':Sequelize[_0x9662('0x3')]},'secondDisposition':{'type':Sequelize[_0x9662('0x3')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x9662('0x3')]},'phone':{'type':Sequelize[_0x9662('0x3')]},'read1stAt':{'type':Sequelize[_0x9662('0x2')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0x9662('0x4')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x9662('0x2')]},'lastMsgDirection':{'type':Sequelize[_0x9662('0x5')]('in','out'),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x9662('0x1')],'defaultValue':![]},'queueId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.controller.js b/server/api/whatsappInteraction/whatsappInteraction.controller.js index 747dd75..d196175 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 _0x332c=['firstName','lastName','Messages','createdAt','direction','read','WhatsappAccount','User','Owner','fullname','get','Whatsapp','Account','closed','closedAt','disposition','Attachment','existsSync','createReadStream','out','System','basename','secret','value','renderFile','views','downloadInteraction.ejs','transcript-','createPdfFromHTML','err','unlinkSync','rimraf','zip-dir','moment','path','ejs','lodash','ioredis','../../components/export/pdf','../../config/logger','../../config/environment','defaults','redis','localhost','./whatsappInteraction.socket','register','status','end','offset','limit','undefined','count','set','Content-Range','update','destroy','then','sendStatus','error','stack','name','send','index','rawAttributes','fieldName','type','getOptions','findAll','whatsapp','query','user','params','model','keys','WhatsappInteraction','filters','intersection','fields','attributes','length','includeAll','include','merge','options','find','catch','body','describe','addMessage','WhatsappMessage','ids','getMessages','findOne','nolimit','order','sort','where','pick','WhatsappInteractionId','filter','map','$gte','split','YYYY-MM-DD\x20HH:mm:ss','addTags','setTags','omit','spread','Tag','color','emit','whatsappInteractionTags:save','removeTags','download','unix','toString','files','join','root','server','attachments','format','transcript-%d-%s.zip','push','CmContact','Contact'];(function(_0x29661f,_0x537b1e){var _0x31be8c=function(_0x5c5567){while(--_0x5c5567){_0x29661f['push'](_0x29661f['shift']());}};_0x31be8c(++_0x537b1e);}(_0x332c,0x11b));var _0xc332=function(_0x77df1,_0x291f5d){_0x77df1=_0x77df1-0x0;var _0x19e186=_0x332c[_0x77df1];return _0x19e186;};'use strict';var rimraf=require(_0xc332('0x0'));var zipdir=require(_0xc332('0x1'));var moment=require(_0xc332('0x2'));var BPromise=require('bluebird');var util=require('util');var path=require(_0xc332('0x3'));var ejs=require(_0xc332('0x4'));var fs=require('fs');var _=require(_0xc332('0x5'));var Redis=require(_0xc332('0x6'));var interaction=require('../../components/interaction/service');var qs=require('../../components/parsers/qs');var pdf=require(_0xc332('0x7'));var logger=require(_0xc332('0x8'))('api');var config=require(_0xc332('0x9'));var db=require('../../mysqldb')['db'];config['redis']=_[_0xc332('0xa')](config[_0xc332('0xb')],{'host':_0xc332('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xc332('0xb')]));require(_0xc332('0xd'))[_0xc332('0xe')](socket);function respondWithStatusCode(_0x433617,_0x196b6b){_0x196b6b=_0x196b6b||0xcc;return function(_0x478866){if(_0x478866){return _0x433617['sendStatus'](_0x196b6b);}return _0x433617[_0xc332('0xf')](_0x196b6b)[_0xc332('0x10')]();};}function respondWithResult(_0x41dce3,_0x5492f8){_0x5492f8=_0x5492f8||0xc8;return function(_0x584ab9){if(_0x584ab9){return _0x41dce3[_0xc332('0xf')](_0x5492f8)['json'](_0x584ab9);}};}function respondWithFilteredResult(_0x489df3,_0x2ab372){return function(_0x3299fc){if(_0x3299fc){var _0x146f64=typeof _0x2ab372[_0xc332('0x11')]==='undefined'&&typeof _0x2ab372[_0xc332('0x12')]===_0xc332('0x13');var _0x442dc4=_0x3299fc[_0xc332('0x14')];var _0x9b83e6=_0x146f64?0x0:_0x2ab372[_0xc332('0x11')];var _0x168ef4=_0x146f64?_0x3299fc[_0xc332('0x14')]:_0x2ab372['offset']+_0x2ab372['limit'];var _0x4204e8;if(_0x168ef4>=_0x442dc4){_0x168ef4=_0x442dc4;_0x4204e8=0xc8;}else{_0x4204e8=0xce;}_0x489df3[_0xc332('0xf')](_0x4204e8);return _0x489df3[_0xc332('0x15')](_0xc332('0x16'),_0x9b83e6+'-'+_0x168ef4+'/'+_0x442dc4)['json'](_0x3299fc);}return null;};}function saveUpdates(_0x1d64f9){return function(_0xf74d37){if(_0xf74d37){return _0xf74d37[_0xc332('0x17')](_0x1d64f9)['then'](function(_0x334d17){return _0x334d17;});}return null;};}function removeEntity(_0x3553c4){return function(_0x3ae519){if(_0x3ae519){return _0x3ae519[_0xc332('0x18')]()[_0xc332('0x19')](function(){_0x3553c4['status'](0xcc)[_0xc332('0x10')]();});}};}function handleEntityNotFound(_0x50ae2b){return function(_0x465165){if(!_0x465165){_0x50ae2b[_0xc332('0x1a')](0x194);}return _0x465165;};}function handleError(_0x5d4ffc,_0x2123e3){_0x2123e3=_0x2123e3||0x1f4;return function(_0x128cc3){logger[_0xc332('0x1b')](_0x128cc3[_0xc332('0x1c')]);if(_0x128cc3['name']){delete _0x128cc3[_0xc332('0x1d')];}_0x5d4ffc[_0xc332('0xf')](_0x2123e3)[_0xc332('0x1e')](_0x128cc3);};}exports[_0xc332('0x1f')]=function(_0x10ebeb,_0x241dbf){var _0xc3af6b={};var _0x5d6018=_['map'](db['WhatsappInteraction'][_0xc332('0x20')],function(_0x1b2bb2){return{'name':_0x1b2bb2[_0xc332('0x21')],'type':_0x1b2bb2[_0xc332('0x22')]['key']};});_0xc3af6b=qs[_0xc332('0x23')](_0x5d6018,_0x10ebeb);return interaction[_0xc332('0x24')](_0xc332('0x25'),_0x10ebeb[_0xc332('0x26')],_0x10ebeb[_0xc332('0x27')],_0xc3af6b,_0x5d6018)[_0xc332('0x19')](respondWithFilteredResult(_0x241dbf,_0xc3af6b))['catch'](handleError(_0x241dbf,null));};exports['show']=function(_0x140507,_0x685bef){var _0x28fba4={'raw':![],'where':{'id':_0x140507[_0xc332('0x28')]['id']}},_0x18d715={};_0x18d715[_0xc332('0x29')]=_[_0xc332('0x2a')](db[_0xc332('0x2b')][_0xc332('0x20')]);_0x18d715['query']=_['keys'](_0x140507[_0xc332('0x26')]);_0x18d715[_0xc332('0x2c')]=_[_0xc332('0x2d')](_0x18d715['model'],_0x18d715[_0xc332('0x26')]);_0x28fba4['attributes']=_['intersection'](_0x18d715[_0xc332('0x29')],qs[_0xc332('0x2e')](_0x140507[_0xc332('0x26')][_0xc332('0x2e')]));_0x28fba4['attributes']=_0x28fba4[_0xc332('0x2f')][_0xc332('0x30')]?_0x28fba4[_0xc332('0x2f')]:_0x18d715[_0xc332('0x29')];if(_0x140507[_0xc332('0x26')][_0xc332('0x31')]){_0x28fba4[_0xc332('0x32')]=[{'all':!![]}];}_0x28fba4=_[_0xc332('0x33')]({},_0x28fba4,_0x140507[_0xc332('0x34')]);return db[_0xc332('0x2b')][_0xc332('0x35')](_0x28fba4)[_0xc332('0x19')](handleEntityNotFound(_0x685bef,null))[_0xc332('0x19')](respondWithResult(_0x685bef,null))[_0xc332('0x36')](handleError(_0x685bef,null));};exports['create']=function(_0x2443ae,_0x20b8f2){return db[_0xc332('0x2b')]['create'](_0x2443ae[_0xc332('0x37')],{})[_0xc332('0x19')](respondWithResult(_0x20b8f2,0xc9))[_0xc332('0x36')](handleError(_0x20b8f2,null));};exports[_0xc332('0x17')]=function(_0x183099,_0x342643){if(_0x183099[_0xc332('0x37')]['id']){delete _0x183099['body']['id'];}return db[_0xc332('0x2b')]['find']({'where':{'id':_0x183099[_0xc332('0x28')]['id']}})['then'](handleEntityNotFound(_0x342643,null))[_0xc332('0x19')](saveUpdates(_0x183099[_0xc332('0x37')],null))[_0xc332('0x19')](respondWithResult(_0x342643,null))['catch'](handleError(_0x342643,null));};exports[_0xc332('0x18')]=function(_0x398c5a,_0x4f54cf){return db['WhatsappInteraction'][_0xc332('0x35')]({'where':{'id':_0x398c5a[_0xc332('0x28')]['id']}})[_0xc332('0x19')](handleEntityNotFound(_0x4f54cf,null))[_0xc332('0x19')](removeEntity(_0x4f54cf,null))[_0xc332('0x36')](handleError(_0x4f54cf,null));};exports[_0xc332('0x38')]=function(_0xecd1b5,_0x4eba95){return db[_0xc332('0x2b')]['describe']()[_0xc332('0x19')](respondWithResult(_0x4eba95,null))[_0xc332('0x36')](handleError(_0x4eba95,null));};exports[_0xc332('0x39')]=function(_0x158d25,_0x1b096c){return db[_0xc332('0x3a')]['find']({'where':{'id':_0x158d25[_0xc332('0x28')]['id']}})['then'](handleEntityNotFound(_0x1b096c,null))[_0xc332('0x19')](function(_0x5ecbb3){if(_0x5ecbb3){return _0x5ecbb3[_0xc332('0x39')](_0x158d25[_0xc332('0x37')][_0xc332('0x3b')],_['omit'](_0x158d25[_0xc332('0x37')],[_0xc332('0x3b'),'id'])||{});}})[_0xc332('0x19')](respondWithResult(_0x1b096c,null))[_0xc332('0x36')](handleError(_0x1b096c,null));};exports[_0xc332('0x3c')]=function(_0x5f01d4,_0x4deeda){var _0x8104e8={'raw':![],'where':{}};var _0x219634={};var _0x1b3e72={'count':0x0,'rows':[]};return db[_0xc332('0x2b')][_0xc332('0x3d')]({'where':{'id':_0x5f01d4[_0xc332('0x28')]['id']}})['then'](handleEntityNotFound(_0x4deeda,null))[_0xc332('0x19')](function(_0x11168b){if(_0x11168b){_0x219634[_0xc332('0x29')]=_[_0xc332('0x2a')](db[_0xc332('0x3a')]['rawAttributes']);_0x219634[_0xc332('0x26')]=_['keys'](_0x5f01d4['query']);_0x219634[_0xc332('0x2c')]=_[_0xc332('0x2d')](_0x219634[_0xc332('0x29')],_0x219634[_0xc332('0x26')]);_0x8104e8[_0xc332('0x2f')]=_[_0xc332('0x2d')](_0x219634[_0xc332('0x29')],qs[_0xc332('0x2e')](_0x5f01d4[_0xc332('0x26')][_0xc332('0x2e')]));_0x8104e8[_0xc332('0x2f')]=_0x8104e8[_0xc332('0x2f')][_0xc332('0x30')]?_0x8104e8[_0xc332('0x2f')]:_0x219634[_0xc332('0x29')];if(!_0x5f01d4[_0xc332('0x26')]['hasOwnProperty'](_0xc332('0x3e'))){_0x8104e8[_0xc332('0x12')]=qs[_0xc332('0x12')](_0x5f01d4[_0xc332('0x26')][_0xc332('0x12')]);_0x8104e8[_0xc332('0x11')]=qs[_0xc332('0x11')](_0x5f01d4[_0xc332('0x26')][_0xc332('0x11')]);}_0x8104e8[_0xc332('0x3f')]=qs['sort'](_0x5f01d4[_0xc332('0x26')][_0xc332('0x40')]);_0x8104e8[_0xc332('0x41')]=qs[_0xc332('0x2c')](_[_0xc332('0x42')](_0x5f01d4[_0xc332('0x26')],_0x219634['filters']));_0x8104e8[_0xc332('0x41')][_0xc332('0x43')]=_0x11168b['id'];if(_0x5f01d4['query'][_0xc332('0x44')]){_0x8104e8[_0xc332('0x41')]=_['merge'](_0x8104e8[_0xc332('0x41')],{'$or':_[_0xc332('0x45')](_0x8104e8[_0xc332('0x2f')],function(_0x5af2e7){var _0x193ad0={};_0x193ad0[_0x5af2e7]={'$like':'%'+_0x5f01d4['query'][_0xc332('0x44')]+'%'};return _0x193ad0;})});}if(_0x5f01d4[_0xc332('0x26')][_0xc332('0x46')]){var _0x4d20fa=_0x5f01d4[_0xc332('0x26')][_0xc332('0x46')][_0xc332('0x47')](',');var _0x2ddb19={};_0x2ddb19[_0x4d20fa[0x0]]={'$gte':moment(_0x4d20fa[0x1])['format'](_0xc332('0x48'))};_0x8104e8['where']=_[_0xc332('0x33')](_0x8104e8[_0xc332('0x41')],_0x2ddb19);}_0x8104e8=_[_0xc332('0x33')]({},_0x8104e8,_0x5f01d4[_0xc332('0x34')]);return db[_0xc332('0x3a')][_0xc332('0x14')]({'where':_0x8104e8[_0xc332('0x41')]})['then'](function(_0x159868){_0x1b3e72[_0xc332('0x14')]=_0x159868;if(_0x5f01d4[_0xc332('0x26')][_0xc332('0x31')]){_0x8104e8[_0xc332('0x32')]=[{'all':!![]}];}return db[_0xc332('0x3a')]['findAll'](_0x8104e8);})['then'](function(_0x45b63c){_0x1b3e72['rows']=_0x45b63c;return _0x1b3e72;});}})[_0xc332('0x19')](respondWithFilteredResult(_0x4deeda,_0x8104e8))['catch'](handleError(_0x4deeda,null));};exports[_0xc332('0x49')]=function(_0x5a6a23,_0x1378e9){return db[_0xc332('0x2b')][_0xc332('0x35')]({'where':{'id':_0x5a6a23[_0xc332('0x28')]['id']}})[_0xc332('0x19')](handleEntityNotFound(_0x1378e9,null))[_0xc332('0x19')](function(_0x97e57a){if(_0x97e57a){return _0x97e57a[_0xc332('0x4a')](_0x5a6a23['body'][_0xc332('0x3b')],_[_0xc332('0x4b')](_0x5a6a23[_0xc332('0x37')],[_0xc332('0x3b'),'id'])||{})[_0xc332('0x4c')](function(){return db[_0xc332('0x4d')]['findAll']({'attributes':['id',_0xc332('0x1d'),_0xc332('0x4e')],'where':{'id':_0x5a6a23[_0xc332('0x37')][_0xc332('0x3b')]}});})['then'](function(_0x18d34b){socket[_0xc332('0x4f')](_0xc332('0x50'),{'id':Number(_0x5a6a23[_0xc332('0x28')]['id']),'tags':_0x18d34b||[]});return{'id':Number(_0x5a6a23['params']['id']),'tags':_0x18d34b||[]};});}})[_0xc332('0x19')](respondWithResult(_0x1378e9,null))[_0xc332('0x36')](handleError(_0x1378e9,null));};exports[_0xc332('0x51')]=function(_0x1961df,_0x3cf732){return db[_0xc332('0x2b')][_0xc332('0x35')]({'where':{'id':_0x1961df[_0xc332('0x28')]['id']}})[_0xc332('0x19')](handleEntityNotFound(_0x3cf732,null))[_0xc332('0x19')](function(_0x5a0817){if(_0x5a0817){return _0x5a0817[_0xc332('0x51')](_0x1961df['query']['ids']);}})[_0xc332('0x19')](respondWithStatusCode(_0x3cf732,null))[_0xc332('0x36')](handleError(_0x3cf732,null));};exports[_0xc332('0x52')]=function(_0x53bb11,_0x3576be){var _0xe1b693=moment()[_0xc332('0x53')]()[_0xc332('0x54')]();var _0x2d8a14=path['join'](config['root'],'server',_0xc332('0x55'),'tmp');var _0x55f93a=path[_0xc332('0x56')](config[_0xc332('0x57')],_0xc332('0x58'),'files',_0xc332('0x59'));var _0x17b916=path['join'](_0x2d8a14,_0xe1b693);var _0x3d350f=util[_0xc332('0x5a')](_0xc332('0x5b'),_0x53bb11['params']['id'],_0xe1b693);var _0x266f30=path[_0xc332('0x56')](_0x2d8a14,_0x3d350f);var _0x44db22=[];_0x44db22['push']({'model':db['User'],'as':'User','attributes':['id','fullname'],'raw':!![]});_0x44db22[_0xc332('0x5c')]({'model':db[_0xc332('0x5d')],'as':_0xc332('0x5e'),'attributes':['id',_0xc332('0x5f'),_0xc332('0x60')],'raw':!![]});if(_0x53bb11[_0xc332('0x26')][_0xc332('0x59')]){_0x44db22[_0xc332('0x5c')]({'model':db['Attachment'],'as':'Attachment','raw':!![]});}var _0x672ab1=[{'model':db['WhatsappMessage'],'as':_0xc332('0x61'),'attributes':['id',_0xc332('0x37'),_0xc332('0x62'),_0xc332('0x63'),'secret',_0xc332('0x64')],'include':_0x44db22}];_0x672ab1[_0xc332('0x5c')]({'model':db[_0xc332('0x65')],'as':'Account','attributes':['id',_0xc332('0x1d')]});_0x672ab1[_0xc332('0x5c')]({'model':db[_0xc332('0x66')],'as':_0xc332('0x67'),'attributes':['id',_0xc332('0x68')]});return db[_0xc332('0x2b')][_0xc332('0x35')]({'where':{'id':_0x53bb11[_0xc332('0x28')]['id']},'include':_0x672ab1})[_0xc332('0x19')](handleEntityNotFound(_0x3576be,null))['then'](function(_0x189035){if(_0x189035){var _0x5b0f09=_0x189035[_0xc332('0x69')]({'plain':!![]});fs['mkdirSync'](_0x17b916);var _0x18ae37={'channel':_0xc332('0x6a'),'account':_0x5b0f09[_0xc332('0x6b')]['name'],'agent':_0x5b0f09[_0xc332('0x67')]?_0x5b0f09['Owner'][_0xc332('0x68')]:'N.A.','createdAt':moment(_0x5b0f09['createdAt'])['format'](_0xc332('0x48'))[_0xc332('0x54')](),'closedAt':_0x5b0f09[_0xc332('0x6c')]?moment(_0x5b0f09[_0xc332('0x6d')])[_0xc332('0x5a')](_0xc332('0x48'))['toString']():'','disposition':_0x5b0f09[_0xc332('0x6e')],'messages':_(_0x5b0f09['Messages'])[_0xc332('0x44')]({'secret':![]})['map'](function(_0x4a51c9){if(_0x4a51c9[_0xc332('0x6f')]){var _0x40b489=path[_0xc332('0x56')](_0x55f93a,_0x4a51c9[_0xc332('0x6f')]['basename']);if(fs[_0xc332('0x70')](_0x40b489)){fs[_0xc332('0x71')](_0x40b489)['pipe'](fs['createWriteStream'](path[_0xc332('0x56')](_0x17b916,_0x4a51c9[_0xc332('0x6f')]['basename'])));}}return{'date':moment(_0x4a51c9[_0xc332('0x62')])[_0xc332('0x5a')]('YYYY-MM-DD\x20HH:mm:ss')[_0xc332('0x54')](),'sender':_0x4a51c9[_0xc332('0x63')]===_0xc332('0x72')?_0x4a51c9[_0xc332('0x66')]?_0x4a51c9[_0xc332('0x66')][_0xc332('0x68')]:_0xc332('0x73'):_0x4a51c9[_0xc332('0x5e')][_0xc332('0x5f')]+(_0x4a51c9['Contact'][_0xc332('0x60')]?'\x20'+_0x4a51c9[_0xc332('0x5e')][_0xc332('0x60')]:''),'body':_0x4a51c9[_0xc332('0x6f')]?_0x4a51c9[_0xc332('0x6f')][_0xc332('0x74')]:_0x4a51c9[_0xc332('0x37')],'direction':_0x4a51c9[_0xc332('0x63')]===_0xc332('0x72')?'A':'C','secret':_0x4a51c9[_0xc332('0x75')],'read':_0x4a51c9[_0xc332('0x64')],'attachment':_0x4a51c9['Attachment']};})[_0xc332('0x76')]()};return ejs[_0xc332('0x77')](path[_0xc332('0x56')](config[_0xc332('0x57')],_0xc332('0x58'),_0xc332('0x78'),_0xc332('0x79')),{'interaction':_0x18ae37})['then'](function(_0x5baab8){var _0x3b4fd6=path['join'](_0x17b916,_0xc332('0x7a')+_0x5b0f09['id']+'-'+_0xe1b693+'.pdf');var _0x5ee2f0={'path':_0x3b4fd6,'channel':'Whatsapp','interactionId':_0x5b0f09['id']};return pdf[_0xc332('0x7b')](_0x5baab8,_0x5ee2f0);})[_0xc332('0x19')](function(){return new BPromise(function(_0x5a220a,_0x39e25c){zipdir(_0x17b916,{'saveTo':_0x266f30},function(_0x5657dc,_0x14c0d3){if(_0x5657dc)return _0x39e25c(_0x5657dc);return _0x5a220a(_0x14c0d3);});})[_0xc332('0x19')](function(){return new BPromise(function(_0xb4a0e1,_0x49b691){rimraf(_0x17b916,function(_0x49d735){if(_0x49d735)_0x49b691(_0x49d735);return _0xb4a0e1();});});})[_0xc332('0x19')](function(){return _0x3576be[_0xc332('0x52')](_0x266f30,_0x3d350f,function(_0x5f1c46){if(_0x5f1c46){console['log'](_0xc332('0x7c'),_0x5f1c46);}else{fs[_0xc332('0x7d')](_0x266f30);}});});});}else{return _0x3576be[_0xc332('0x1a')](0xc8);}})[_0xc332('0x36')](handleError(_0x3576be,null));}; \ No newline at end of file +var _0x547c=['getMessages','findOne','hasOwnProperty','nolimit','order','sort','where','pick','WhatsappInteractionId','filter','map','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','rows','addTags','setTags','spread','Tag','emit','whatsappInteractionTags:save','removeTags','download','unix','toString','join','root','files','tmp','server','attachments','push','User','fullname','Contact','lastName','Attachment','Messages','direction','secret','read','WhatsappAccount','Account','Owner','get','mkdirSync','Whatsapp','N.A.','createdAt','closed','closedAt','disposition','basename','existsSync','createReadStream','pipe','out','System','firstName','value','renderFile','views','.pdf','createPdfFromHTML','log','unlinkSync','rimraf','zip-dir','moment','bluebird','util','lodash','ioredis','../../components/interaction/service','../../components/export/pdf','api','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./whatsappInteraction.socket','register','status','json','offset','undefined','limit','count','set','Content-Range','then','end','sendStatus','error','stack','name','index','WhatsappInteraction','fieldName','type','key','getOptions','findAll','whatsapp','query','show','params','keys','filters','model','attributes','intersection','fields','includeAll','include','merge','options','find','catch','body','update','describe','addMessage','WhatsappMessage','ids'];(function(_0x5399dd,_0x352e11){var _0x4d2570=function(_0x3f1644){while(--_0x3f1644){_0x5399dd['push'](_0x5399dd['shift']());}};_0x4d2570(++_0x352e11);}(_0x547c,0x143));var _0xc547=function(_0x242355,_0x3fc5de){_0x242355=_0x242355-0x0;var _0x351b20=_0x547c[_0x242355];return _0x351b20;};'use strict';var rimraf=require(_0xc547('0x0'));var zipdir=require(_0xc547('0x1'));var moment=require(_0xc547('0x2'));var BPromise=require(_0xc547('0x3'));var util=require(_0xc547('0x4'));var path=require('path');var ejs=require('ejs');var fs=require('fs');var _=require(_0xc547('0x5'));var Redis=require(_0xc547('0x6'));var interaction=require(_0xc547('0x7'));var qs=require('../../components/parsers/qs');var pdf=require(_0xc547('0x8'));var logger=require('../../config/logger')(_0xc547('0x9'));var config=require(_0xc547('0xa'));var db=require(_0xc547('0xb'))['db'];config['redis']=_[_0xc547('0xc')](config[_0xc547('0xd')],{'host':_0xc547('0xe'),'port':0x18eb});var socket=require(_0xc547('0xf'))(new Redis(config[_0xc547('0xd')]));require(_0xc547('0x10'))[_0xc547('0x11')](socket);function respondWithStatusCode(_0x2056b8,_0x55f519){_0x55f519=_0x55f519||0xcc;return function(_0x1d0ebc){if(_0x1d0ebc){return _0x2056b8['sendStatus'](_0x55f519);}return _0x2056b8['status'](_0x55f519)['end']();};}function respondWithResult(_0x5098b8,_0x213fe1){_0x213fe1=_0x213fe1||0xc8;return function(_0x593d87){if(_0x593d87){return _0x5098b8[_0xc547('0x12')](_0x213fe1)[_0xc547('0x13')](_0x593d87);}};}function respondWithFilteredResult(_0x491ab8,_0xe87040){return function(_0x1462d8){if(_0x1462d8){var _0x296a77=typeof _0xe87040[_0xc547('0x14')]===_0xc547('0x15')&&typeof _0xe87040[_0xc547('0x16')]===_0xc547('0x15');var _0x30f8c8=_0x1462d8[_0xc547('0x17')];var _0x2d5b48=_0x296a77?0x0:_0xe87040[_0xc547('0x14')];var _0x403584=_0x296a77?_0x1462d8[_0xc547('0x17')]:_0xe87040[_0xc547('0x14')]+_0xe87040[_0xc547('0x16')];var _0x21affe;if(_0x403584>=_0x30f8c8){_0x403584=_0x30f8c8;_0x21affe=0xc8;}else{_0x21affe=0xce;}_0x491ab8['status'](_0x21affe);return _0x491ab8[_0xc547('0x18')](_0xc547('0x19'),_0x2d5b48+'-'+_0x403584+'/'+_0x30f8c8)['json'](_0x1462d8);}return null;};}function saveUpdates(_0x2e1e83){return function(_0x4ef718){if(_0x4ef718){return _0x4ef718['update'](_0x2e1e83)[_0xc547('0x1a')](function(_0xccf72){return _0xccf72;});}return null;};}function removeEntity(_0x222925){return function(_0x7bc0bd){if(_0x7bc0bd){return _0x7bc0bd['destroy']()[_0xc547('0x1a')](function(){_0x222925[_0xc547('0x12')](0xcc)[_0xc547('0x1b')]();});}};}function handleEntityNotFound(_0x1cfe04){return function(_0x3e8795){if(!_0x3e8795){_0x1cfe04[_0xc547('0x1c')](0x194);}return _0x3e8795;};}function handleError(_0x287c9a,_0x42cb61){_0x42cb61=_0x42cb61||0x1f4;return function(_0x3fb8a7){logger[_0xc547('0x1d')](_0x3fb8a7[_0xc547('0x1e')]);if(_0x3fb8a7[_0xc547('0x1f')]){delete _0x3fb8a7[_0xc547('0x1f')];}_0x287c9a[_0xc547('0x12')](_0x42cb61)['send'](_0x3fb8a7);};}exports[_0xc547('0x20')]=function(_0x30e8cd,_0xa9df0e){var _0x22bea4={};var _0x2350dd=_['map'](db[_0xc547('0x21')]['rawAttributes'],function(_0x524b94){return{'name':_0x524b94[_0xc547('0x22')],'type':_0x524b94[_0xc547('0x23')][_0xc547('0x24')]};});_0x22bea4=qs[_0xc547('0x25')](_0x2350dd,_0x30e8cd);return interaction[_0xc547('0x26')](_0xc547('0x27'),_0x30e8cd[_0xc547('0x28')],_0x30e8cd['user'],_0x22bea4,_0x2350dd)[_0xc547('0x1a')](respondWithFilteredResult(_0xa9df0e,_0x22bea4))['catch'](handleError(_0xa9df0e,null));};exports[_0xc547('0x29')]=function(_0x50c5f7,_0x3e26d6){var _0x4b8105={'raw':![],'where':{'id':_0x50c5f7[_0xc547('0x2a')]['id']}},_0x3d9db2={};_0x3d9db2['model']=_['keys'](db[_0xc547('0x21')]['rawAttributes']);_0x3d9db2['query']=_[_0xc547('0x2b')](_0x50c5f7[_0xc547('0x28')]);_0x3d9db2[_0xc547('0x2c')]=_['intersection'](_0x3d9db2[_0xc547('0x2d')],_0x3d9db2[_0xc547('0x28')]);_0x4b8105[_0xc547('0x2e')]=_[_0xc547('0x2f')](_0x3d9db2[_0xc547('0x2d')],qs[_0xc547('0x30')](_0x50c5f7[_0xc547('0x28')][_0xc547('0x30')]));_0x4b8105[_0xc547('0x2e')]=_0x4b8105['attributes']['length']?_0x4b8105['attributes']:_0x3d9db2[_0xc547('0x2d')];if(_0x50c5f7[_0xc547('0x28')][_0xc547('0x31')]){_0x4b8105[_0xc547('0x32')]=[{'all':!![]}];}_0x4b8105=_[_0xc547('0x33')]({},_0x4b8105,_0x50c5f7[_0xc547('0x34')]);return db['WhatsappInteraction'][_0xc547('0x35')](_0x4b8105)[_0xc547('0x1a')](handleEntityNotFound(_0x3e26d6,null))[_0xc547('0x1a')](respondWithResult(_0x3e26d6,null))[_0xc547('0x36')](handleError(_0x3e26d6,null));};exports['create']=function(_0x323d03,_0x28d019){return db['WhatsappInteraction']['create'](_0x323d03[_0xc547('0x37')],{})[_0xc547('0x1a')](respondWithResult(_0x28d019,0xc9))[_0xc547('0x36')](handleError(_0x28d019,null));};exports[_0xc547('0x38')]=function(_0x52f7ca,_0x284a54){if(_0x52f7ca[_0xc547('0x37')]['id']){delete _0x52f7ca['body']['id'];}return db['WhatsappInteraction']['find']({'where':{'id':_0x52f7ca[_0xc547('0x2a')]['id']}})[_0xc547('0x1a')](handleEntityNotFound(_0x284a54,null))['then'](saveUpdates(_0x52f7ca[_0xc547('0x37')],null))[_0xc547('0x1a')](respondWithResult(_0x284a54,null))[_0xc547('0x36')](handleError(_0x284a54,null));};exports['destroy']=function(_0x3ba68d,_0x440ef9){return db[_0xc547('0x21')][_0xc547('0x35')]({'where':{'id':_0x3ba68d[_0xc547('0x2a')]['id']}})[_0xc547('0x1a')](handleEntityNotFound(_0x440ef9,null))['then'](removeEntity(_0x440ef9,null))[_0xc547('0x36')](handleError(_0x440ef9,null));};exports['describe']=function(_0x2f276e,_0x4dbefd){return db[_0xc547('0x21')][_0xc547('0x39')]()[_0xc547('0x1a')](respondWithResult(_0x4dbefd,null))[_0xc547('0x36')](handleError(_0x4dbefd,null));};exports[_0xc547('0x3a')]=function(_0x4c89d7,_0x4eb66d){return db[_0xc547('0x3b')][_0xc547('0x35')]({'where':{'id':_0x4c89d7[_0xc547('0x2a')]['id']}})[_0xc547('0x1a')](handleEntityNotFound(_0x4eb66d,null))['then'](function(_0x2c22da){if(_0x2c22da){return _0x2c22da[_0xc547('0x3a')](_0x4c89d7[_0xc547('0x37')][_0xc547('0x3c')],_['omit'](_0x4c89d7[_0xc547('0x37')],[_0xc547('0x3c'),'id'])||{});}})[_0xc547('0x1a')](respondWithResult(_0x4eb66d,null))[_0xc547('0x36')](handleError(_0x4eb66d,null));};exports[_0xc547('0x3d')]=function(_0x4592a4,_0x36af48){var _0x4c3c87={'raw':![],'where':{}};var _0x33b44c={};var _0x3b659e={'count':0x0,'rows':[]};return db[_0xc547('0x21')][_0xc547('0x3e')]({'where':{'id':_0x4592a4['params']['id']}})['then'](handleEntityNotFound(_0x36af48,null))[_0xc547('0x1a')](function(_0x2576a7){if(_0x2576a7){_0x33b44c[_0xc547('0x2d')]=_['keys'](db[_0xc547('0x3b')]['rawAttributes']);_0x33b44c[_0xc547('0x28')]=_[_0xc547('0x2b')](_0x4592a4[_0xc547('0x28')]);_0x33b44c[_0xc547('0x2c')]=_[_0xc547('0x2f')](_0x33b44c[_0xc547('0x2d')],_0x33b44c['query']);_0x4c3c87[_0xc547('0x2e')]=_[_0xc547('0x2f')](_0x33b44c['model'],qs[_0xc547('0x30')](_0x4592a4[_0xc547('0x28')][_0xc547('0x30')]));_0x4c3c87['attributes']=_0x4c3c87['attributes']['length']?_0x4c3c87[_0xc547('0x2e')]:_0x33b44c['model'];if(!_0x4592a4['query'][_0xc547('0x3f')](_0xc547('0x40'))){_0x4c3c87[_0xc547('0x16')]=qs['limit'](_0x4592a4['query'][_0xc547('0x16')]);_0x4c3c87[_0xc547('0x14')]=qs['offset'](_0x4592a4['query'][_0xc547('0x14')]);}_0x4c3c87[_0xc547('0x41')]=qs[_0xc547('0x42')](_0x4592a4['query']['sort']);_0x4c3c87[_0xc547('0x43')]=qs[_0xc547('0x2c')](_[_0xc547('0x44')](_0x4592a4[_0xc547('0x28')],_0x33b44c[_0xc547('0x2c')]));_0x4c3c87[_0xc547('0x43')][_0xc547('0x45')]=_0x2576a7['id'];if(_0x4592a4[_0xc547('0x28')][_0xc547('0x46')]){_0x4c3c87[_0xc547('0x43')]=_[_0xc547('0x33')](_0x4c3c87[_0xc547('0x43')],{'$or':_[_0xc547('0x47')](_0x4c3c87[_0xc547('0x2e')],function(_0x2b905a){var _0x1d5acb={};_0x1d5acb[_0x2b905a]={'$like':'%'+_0x4592a4[_0xc547('0x28')][_0xc547('0x46')]+'%'};return _0x1d5acb;})});}if(_0x4592a4['query']['$gte']){var _0x1f2bf8=_0x4592a4['query'][_0xc547('0x48')][_0xc547('0x49')](',');var _0x2d8838={};_0x2d8838[_0x1f2bf8[0x0]]={'$gte':moment(_0x1f2bf8[0x1])[_0xc547('0x4a')](_0xc547('0x4b'))};_0x4c3c87[_0xc547('0x43')]=_['merge'](_0x4c3c87[_0xc547('0x43')],_0x2d8838);}_0x4c3c87=_[_0xc547('0x33')]({},_0x4c3c87,_0x4592a4[_0xc547('0x34')]);return db[_0xc547('0x3b')][_0xc547('0x17')]({'where':_0x4c3c87['where']})[_0xc547('0x1a')](function(_0x4d4725){_0x3b659e['count']=_0x4d4725;if(_0x4592a4[_0xc547('0x28')]['includeAll']){_0x4c3c87[_0xc547('0x32')]=[{'all':!![]}];}return db[_0xc547('0x3b')][_0xc547('0x26')](_0x4c3c87);})[_0xc547('0x1a')](function(_0x367b00){_0x3b659e[_0xc547('0x4c')]=_0x367b00;return _0x3b659e;});}})[_0xc547('0x1a')](respondWithFilteredResult(_0x36af48,_0x4c3c87))[_0xc547('0x36')](handleError(_0x36af48,null));};exports[_0xc547('0x4d')]=function(_0x55908d,_0x4802cb){return db[_0xc547('0x21')][_0xc547('0x35')]({'where':{'id':_0x55908d[_0xc547('0x2a')]['id']}})[_0xc547('0x1a')](handleEntityNotFound(_0x4802cb,null))[_0xc547('0x1a')](function(_0x96b9e2){if(_0x96b9e2){return _0x96b9e2[_0xc547('0x4e')](_0x55908d[_0xc547('0x37')][_0xc547('0x3c')],_['omit'](_0x55908d[_0xc547('0x37')],[_0xc547('0x3c'),'id'])||{})[_0xc547('0x4f')](function(){return db[_0xc547('0x50')]['findAll']({'attributes':['id','name','color'],'where':{'id':_0x55908d[_0xc547('0x37')][_0xc547('0x3c')]}});})[_0xc547('0x1a')](function(_0x3d259e){socket[_0xc547('0x51')](_0xc547('0x52'),{'id':Number(_0x55908d[_0xc547('0x2a')]['id']),'tags':_0x3d259e||[]});return{'id':Number(_0x55908d[_0xc547('0x2a')]['id']),'tags':_0x3d259e||[]};});}})[_0xc547('0x1a')](respondWithResult(_0x4802cb,null))[_0xc547('0x36')](handleError(_0x4802cb,null));};exports[_0xc547('0x53')]=function(_0x597e4c,_0x38edf6){return db[_0xc547('0x21')][_0xc547('0x35')]({'where':{'id':_0x597e4c['params']['id']}})[_0xc547('0x1a')](handleEntityNotFound(_0x38edf6,null))[_0xc547('0x1a')](function(_0x39a3c1){if(_0x39a3c1){return _0x39a3c1[_0xc547('0x53')](_0x597e4c['query']['ids']);}})[_0xc547('0x1a')](respondWithStatusCode(_0x38edf6,null))['catch'](handleError(_0x38edf6,null));};exports[_0xc547('0x54')]=function(_0x421b9d,_0x20d90e){var _0x4d1dcd=moment()[_0xc547('0x55')]()[_0xc547('0x56')]();var _0x20ff9c=path[_0xc547('0x57')](config[_0xc547('0x58')],'server',_0xc547('0x59'),_0xc547('0x5a'));var _0x123c97=path[_0xc547('0x57')](config[_0xc547('0x58')],_0xc547('0x5b'),_0xc547('0x59'),_0xc547('0x5c'));var _0x237d3b=path[_0xc547('0x57')](_0x20ff9c,_0x4d1dcd);var _0xadc31a=util[_0xc547('0x4a')]('transcript-%d-%s.zip',_0x421b9d[_0xc547('0x2a')]['id'],_0x4d1dcd);var _0x24f787=path[_0xc547('0x57')](_0x20ff9c,_0xadc31a);var _0x28d944=[];_0x28d944[_0xc547('0x5d')]({'model':db['User'],'as':_0xc547('0x5e'),'attributes':['id',_0xc547('0x5f')],'raw':!![]});_0x28d944['push']({'model':db['CmContact'],'as':_0xc547('0x60'),'attributes':['id','firstName',_0xc547('0x61')],'raw':!![]});if(_0x421b9d[_0xc547('0x28')]['attachments']){_0x28d944[_0xc547('0x5d')]({'model':db['Attachment'],'as':_0xc547('0x62'),'raw':!![]});}var _0x23e7f9=[{'model':db[_0xc547('0x3b')],'as':_0xc547('0x63'),'attributes':['id','body','createdAt',_0xc547('0x64'),_0xc547('0x65'),_0xc547('0x66')],'include':_0x28d944}];_0x23e7f9[_0xc547('0x5d')]({'model':db[_0xc547('0x67')],'as':_0xc547('0x68'),'attributes':['id',_0xc547('0x1f')]});_0x23e7f9[_0xc547('0x5d')]({'model':db[_0xc547('0x5e')],'as':_0xc547('0x69'),'attributes':['id',_0xc547('0x5f')]});return db['WhatsappInteraction']['find']({'where':{'id':_0x421b9d['params']['id']},'include':_0x23e7f9})[_0xc547('0x1a')](handleEntityNotFound(_0x20d90e,null))[_0xc547('0x1a')](function(_0x8a9808){if(_0x8a9808){var _0x314217=_0x8a9808[_0xc547('0x6a')]({'plain':!![]});fs[_0xc547('0x6b')](_0x237d3b);var _0x17d244={'channel':_0xc547('0x6c'),'account':_0x314217['Account']['name'],'agent':_0x314217[_0xc547('0x69')]?_0x314217['Owner'][_0xc547('0x5f')]:_0xc547('0x6d'),'createdAt':moment(_0x314217[_0xc547('0x6e')])[_0xc547('0x4a')](_0xc547('0x4b'))[_0xc547('0x56')](),'closedAt':_0x314217[_0xc547('0x6f')]?moment(_0x314217[_0xc547('0x70')])['format'](_0xc547('0x4b'))['toString']():'','disposition':_0x314217[_0xc547('0x71')],'messages':_(_0x314217['Messages'])[_0xc547('0x46')]({'secret':![]})['map'](function(_0x335764){if(_0x335764[_0xc547('0x62')]){var _0x3b5190=path['join'](_0x123c97,_0x335764[_0xc547('0x62')][_0xc547('0x72')]);if(fs[_0xc547('0x73')](_0x3b5190)){fs[_0xc547('0x74')](_0x3b5190)[_0xc547('0x75')](fs['createWriteStream'](path[_0xc547('0x57')](_0x237d3b,_0x335764[_0xc547('0x62')]['basename'])));}}return{'date':moment(_0x335764['createdAt'])[_0xc547('0x4a')](_0xc547('0x4b'))['toString'](),'sender':_0x335764[_0xc547('0x64')]===_0xc547('0x76')?_0x335764[_0xc547('0x5e')]?_0x335764[_0xc547('0x5e')][_0xc547('0x5f')]:_0xc547('0x77'):_0x335764[_0xc547('0x60')][_0xc547('0x78')]+(_0x335764['Contact'][_0xc547('0x61')]?'\x20'+_0x335764['Contact'][_0xc547('0x61')]:''),'body':_0x335764[_0xc547('0x62')]?_0x335764[_0xc547('0x62')][_0xc547('0x72')]:_0x335764[_0xc547('0x37')],'direction':_0x335764[_0xc547('0x64')]===_0xc547('0x76')?'A':'C','secret':_0x335764[_0xc547('0x65')],'read':_0x335764['read'],'attachment':_0x335764['Attachment']};})[_0xc547('0x79')]()};return ejs[_0xc547('0x7a')](path[_0xc547('0x57')](config[_0xc547('0x58')],_0xc547('0x5b'),_0xc547('0x7b'),'downloadInteraction.ejs'),{'interaction':_0x17d244})[_0xc547('0x1a')](function(_0x42ba9e){var _0x50fb97=path[_0xc547('0x57')](_0x237d3b,'transcript-'+_0x314217['id']+'-'+_0x4d1dcd+_0xc547('0x7c'));var _0x45cf45={'path':_0x50fb97,'channel':_0xc547('0x6c'),'interactionId':_0x314217['id']};return pdf[_0xc547('0x7d')](_0x42ba9e,_0x45cf45);})[_0xc547('0x1a')](function(){return new BPromise(function(_0x927f1e,_0x1a457f){zipdir(_0x237d3b,{'saveTo':_0x24f787},function(_0x18ff81,_0x560818){if(_0x18ff81)return _0x1a457f(_0x18ff81);return _0x927f1e(_0x560818);});})[_0xc547('0x1a')](function(){return new BPromise(function(_0x1e0612,_0x4903c0){rimraf(_0x237d3b,function(_0x4d19a0){if(_0x4d19a0)_0x4903c0(_0x4d19a0);return _0x1e0612();});});})[_0xc547('0x1a')](function(){return _0x20d90e[_0xc547('0x54')](_0x24f787,_0xadc31a,function(_0x3fc33e){if(_0x3fc33e){console[_0xc547('0x7e')]('err',_0x3fc33e);}else{fs[_0xc547('0x7f')](_0x24f787);}});});});}else{return _0x20d90e[_0xc547('0x1c')](0xc8);}})[_0xc547('0x36')](handleError(_0x20d90e,null));}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.events.js b/server/api/whatsappInteraction/whatsappInteraction.events.js index 2ac4751..69a0043 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 _0x7fce=['save','remove','then','setDataValue','Users','map','findAll','unreadMessages','length','emit','hasOwnProperty','hook','events','../../mysqldb','WhatsappInteraction','WhatsappMessage'];(function(_0x1b3564,_0x16c919){var _0x504069=function(_0x9322b6){while(--_0x9322b6){_0x1b3564['push'](_0x1b3564['shift']());}};_0x504069(++_0x16c919);}(_0x7fce,0xdc));var _0xe7fc=function(_0x3a64c6,_0x43d985){_0x3a64c6=_0x3a64c6-0x0;var _0x5ef7c2=_0x7fce[_0x3a64c6];return _0x5ef7c2;};'use strict';var EventEmitter=require(_0xe7fc('0x0'));var WhatsappInteraction=require(_0xe7fc('0x1'))['db'][_0xe7fc('0x2')];var WhatsappMessage=require('../../mysqldb')['db'][_0xe7fc('0x3')];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xe7fc('0x4'),'afterUpdate':'update','afterDestroy':_0xe7fc('0x5')};function emitEvent(_0x337972){return function(_0x5810de,_0x55392f,_0x223d07){_0x5810de['getUsers']({'attributes':['id'],'raw':!![]})[_0xe7fc('0x6')](function(_0x161dca){_0x5810de[_0xe7fc('0x7')](_0xe7fc('0x8'),_0x161dca[_0xe7fc('0x9')](function(_0x525bfd){return{'id':_0x525bfd['id']};}));return WhatsappMessage[_0xe7fc('0xa')]({'where':{'WhatsappInteractionId':_0x5810de['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0xc98c5e){_0x5810de['setDataValue'](_0xe7fc('0xb'),_0xc98c5e[_0xe7fc('0xc')]);WhatsappInteractionEvents[_0xe7fc('0xd')](_0x337972+':'+_0x5810de['id'],_0x5810de);WhatsappInteractionEvents[_0xe7fc('0xd')](_0x337972,_0x5810de);_0x223d07(null);})['catch'](_0x223d07(null));};}for(var e in events){if(events[_0xe7fc('0xe')](e)){var event=events[e];WhatsappInteraction[_0xe7fc('0xf')](e,emitEvent(event));}}module['exports']=WhatsappInteractionEvents; \ No newline at end of file +var _0x0cee=['WhatsappMessage','setMaxListeners','remove','getUsers','then','Users','map','findAll','setDataValue','emit','catch','hasOwnProperty','hook','exports','events','../../mysqldb','WhatsappInteraction'];(function(_0x3ad72e,_0x2ac1f0){var _0x1bda29=function(_0x56d28b){while(--_0x56d28b){_0x3ad72e['push'](_0x3ad72e['shift']());}};_0x1bda29(++_0x2ac1f0);}(_0x0cee,0x12f));var _0xe0ce=function(_0x4c8502,_0x435d31){_0x4c8502=_0x4c8502-0x0;var _0x75b6be=_0x0cee[_0x4c8502];return _0x75b6be;};'use strict';var EventEmitter=require(_0xe0ce('0x0'));var WhatsappInteraction=require(_0xe0ce('0x1'))['db'][_0xe0ce('0x2')];var WhatsappMessage=require(_0xe0ce('0x1'))['db'][_0xe0ce('0x3')];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents[_0xe0ce('0x4')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0xe0ce('0x5')};function emitEvent(_0x3e377b){return function(_0xe84b07,_0x3184bc,_0x1cfee1){_0xe84b07[_0xe0ce('0x6')]({'attributes':['id'],'raw':!![]})[_0xe0ce('0x7')](function(_0x415f34){_0xe84b07['setDataValue'](_0xe0ce('0x8'),_0x415f34[_0xe0ce('0x9')](function(_0x52f779){return{'id':_0x52f779['id']};}));return WhatsappMessage[_0xe0ce('0xa')]({'where':{'WhatsappInteractionId':_0xe84b07['id'],'direction':'in','read':![]},'raw':!![]});})[_0xe0ce('0x7')](function(_0x4532e3){_0xe84b07[_0xe0ce('0xb')]('unreadMessages',_0x4532e3['length']);WhatsappInteractionEvents['emit'](_0x3e377b+':'+_0xe84b07['id'],_0xe84b07);WhatsappInteractionEvents[_0xe0ce('0xc')](_0x3e377b,_0xe84b07);_0x1cfee1(null);})[_0xe0ce('0xd')](_0x1cfee1(null));};}for(var e in events){if(events[_0xe0ce('0xe')](e)){var event=events[e];WhatsappInteraction[_0xe0ce('0xf')](e,emitEvent(event));}}module[_0xe0ce('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 f5431d6..89f6080 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 _0x032e=['bluebird','path','rimraf','../../config/environment','./whatsappInteraction.attributes','exports','WhatsappInteraction','whatsapp_interactions','changed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','util','../../config/logger','api','moment'];(function(_0x15a011,_0x3ba86e){var _0x552b21=function(_0x48ed47){while(--_0x48ed47){_0x15a011['push'](_0x15a011['shift']());}};_0x552b21(++_0x3ba86e);}(_0x032e,0x1cc));var _0xe032=function(_0x2bf141,_0x31eac7){_0x2bf141=_0x2bf141-0x0;var _0x48277b=_0x032e[_0x2bf141];return _0x48277b;};'use strict';var _=require('lodash');var util=require(_0xe032('0x0'));var logger=require(_0xe032('0x1'))(_0xe032('0x2'));var moment=require(_0xe032('0x3'));var BPromise=require(_0xe032('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xe032('0x5'));var rimraf=require(_0xe032('0x6'));var config=require(_0xe032('0x7'));var attributes=require(_0xe032('0x8'));module[_0xe032('0x9')]=function(_0x43dc81,_0x20da91){return _0x43dc81['define'](_0xe032('0xa'),attributes,{'tableName':_0xe032('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x265677,_0xa36fe0,_0x1c06f0){if(_0x265677[_0xe032('0xc')]('closed')){_0x265677[_0xe032('0xd')]=moment()[_0xe032('0xe')](_0xe032('0xf'));}_0x1c06f0(null,_0x265677);}}});}; \ No newline at end of file +var _0x6b35=['changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','util','../../config/logger','api','request-promise','path','rimraf','../../config/environment','define','WhatsappInteraction','whatsapp_interactions'];(function(_0x285b48,_0x41b4c6){var _0x5020e9=function(_0x537f18){while(--_0x537f18){_0x285b48['push'](_0x285b48['shift']());}};_0x5020e9(++_0x41b4c6);}(_0x6b35,0x6e));var _0x56b3=function(_0x1bbf8c,_0x31ebfa){_0x1bbf8c=_0x1bbf8c-0x0;var _0x260e8f=_0x6b35[_0x1bbf8c];return _0x260e8f;};'use strict';var _=require('lodash');var util=require(_0x56b3('0x0'));var logger=require(_0x56b3('0x1'))(_0x56b3('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x56b3('0x3'));var fs=require('fs');var path=require(_0x56b3('0x4'));var rimraf=require(_0x56b3('0x5'));var config=require(_0x56b3('0x6'));var attributes=require('./whatsappInteraction.attributes');module['exports']=function(_0x49c8ca,_0x5dc45b){return _0x49c8ca[_0x56b3('0x7')](_0x56b3('0x8'),attributes,{'tableName':_0x56b3('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x1ca183,_0x48a098,_0x38eceb){if(_0x1ca183[_0x56b3('0xa')](_0x56b3('0xb'))){_0x1ca183[_0x56b3('0xc')]=moment()[_0x56b3('0xd')](_0x56b3('0xe'));}_0x38eceb(null,_0x1ca183);}}});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.rpc.js b/server/api/whatsappInteraction/whatsappInteraction.rpc.js index 241bc15..67aee1c 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 _0x2d9b=['AddTagsToWhatsappInteraction','find','body','ids','omit','spread','AddTags','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','socket.io-emitter','./whatsappInteraction.socket','then','info','debug','WhatsappInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','WhatsappInteraction,\x20%s,\x20%s','message','result','catch','UpdateWhatsappInteraction','WhatsappInteraction','update','options','raw','where','limit'];(function(_0x12f8f6,_0x3a3572){var _0x57f571=function(_0x2d9322){while(--_0x2d9322){_0x12f8f6['push'](_0x12f8f6['shift']());}};_0x57f571(++_0x3a3572);}(_0x2d9b,0xf7));var _0xb2d9=function(_0x54a242,_0x574ded){_0x54a242=_0x54a242-0x0;var _0x4d99d8=_0x2d9b[_0x54a242];return _0x4d99d8;};'use strict';var _=require('lodash');var util=require(_0xb2d9('0x0'));var moment=require('moment');var BPromise=require(_0xb2d9('0x1'));var rs=require(_0xb2d9('0x2'));var fs=require('fs');var Redis=require(_0xb2d9('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xb2d9('0x4'));var logger=require(_0xb2d9('0x5'))(_0xb2d9('0x6'));var config=require(_0xb2d9('0x7'));var jayson=require(_0xb2d9('0x8'));var client=jayson[_0xb2d9('0x9')][_0xb2d9('0xa')]({'port':0x232a});config[_0xb2d9('0xb')]=_['defaults'](config[_0xb2d9('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0xb2d9('0xc'))(new Redis(config[_0xb2d9('0xb')]));require(_0xb2d9('0xd'))['register'](socket);function respondWithRpcPromise(_0x2d706a,_0x3470ed,_0x1410a5){return new BPromise(function(_0x2e42cc,_0x49a4c0){return client['request'](_0x2d706a,_0x1410a5)[_0xb2d9('0xe')](function(_0x45755d){logger[_0xb2d9('0xf')]('WhatsappInteraction,\x20%s,\x20%s',_0x3470ed,'request\x20sent');logger[_0xb2d9('0x10')](_0xb2d9('0x11'),_0x3470ed,_0xb2d9('0x12'),JSON[_0xb2d9('0x13')](_0x45755d));if(_0x45755d['error']){if(_0x45755d['error'][_0xb2d9('0x14')]===0x1f4){logger[_0xb2d9('0x15')](_0xb2d9('0x16'),_0x3470ed,_0x45755d['error'][_0xb2d9('0x17')]);return _0x49a4c0(_0x45755d[_0xb2d9('0x15')][_0xb2d9('0x17')]);}logger['error'](_0xb2d9('0x16'),_0x3470ed,_0x45755d[_0xb2d9('0x15')][_0xb2d9('0x17')]);return _0x2e42cc(_0x45755d['error'][_0xb2d9('0x17')]);}else{logger[_0xb2d9('0xf')](_0xb2d9('0x16'),_0x3470ed,_0xb2d9('0x12'));_0x2e42cc(_0x45755d[_0xb2d9('0x18')]['message']);}})[_0xb2d9('0x19')](function(_0xdc6d3d){logger['error'](_0xb2d9('0x16'),_0x3470ed,_0xdc6d3d);_0x49a4c0(_0xdc6d3d);});});}exports[_0xb2d9('0x1a')]=function(_0x359f47){var _0x4a5d6a=this;return new Promise(function(_0x3f6629,_0x5b77d7){return db[_0xb2d9('0x1b')][_0xb2d9('0x1c')](_0x359f47['body'],{'raw':_0x359f47['options']?_0x359f47[_0xb2d9('0x1d')][_0xb2d9('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x359f47[_0xb2d9('0x1d')]?_0x359f47[_0xb2d9('0x1d')][_0xb2d9('0x1f')]||null:null,'attributes':_0x359f47[_0xb2d9('0x1d')]?_0x359f47['options']['attributes']||null:null,'limit':_0x359f47[_0xb2d9('0x1d')]?_0x359f47['options'][_0xb2d9('0x20')]||null:null})[_0xb2d9('0xe')](function(_0x1bdc4a){logger[_0xb2d9('0xf')](_0xb2d9('0x1a'),_0x359f47);logger['debug']('UpdateWhatsappInteraction',_0x359f47,JSON[_0xb2d9('0x13')](_0x1bdc4a));_0x3f6629(_0x1bdc4a);})[_0xb2d9('0x19')](function(_0x24519a){logger[_0xb2d9('0x15')](_0xb2d9('0x1a'),_0x24519a[_0xb2d9('0x17')],_0x359f47);_0x5b77d7(_0x4a5d6a[_0xb2d9('0x15')](0x1f4,_0x24519a[_0xb2d9('0x17')]));});});};exports[_0xb2d9('0x21')]=function(_0x392ca3){return new Promise(function(_0x5d4c91,_0x4eff1f){return db['WhatsappInteraction'][_0xb2d9('0x22')]({'where':_0x392ca3[_0xb2d9('0x1d')]?_0x392ca3[_0xb2d9('0x1d')][_0xb2d9('0x1f')]||null:null})[_0xb2d9('0xe')](function(_0x311397){if(_0x311397){return _0x311397['addTags'](_0x392ca3[_0xb2d9('0x23')][_0xb2d9('0x24')],_[_0xb2d9('0x25')](_0x392ca3[_0xb2d9('0x23')],[_0xb2d9('0x24'),'id'])||{});}})[_0xb2d9('0x26')](function(_0x2c4b57){logger[_0xb2d9('0xf')]('AddTags',_0x392ca3);logger[_0xb2d9('0x10')](_0xb2d9('0x27'),_0x392ca3,JSON[_0xb2d9('0x13')](_0x2c4b57));_0x5d4c91(_0x2c4b57);})['catch'](function(_0x43b67a){logger['error'](_0xb2d9('0x27'),_0x43b67a[_0xb2d9('0x17')],_0x392ca3);_0x4eff1f(_this['error'](0x1f4,_0x43b67a[_0xb2d9('0x17')]));});});}; \ No newline at end of file +var _0xb042=['socket.io-emitter','./whatsappInteraction.socket','request','then','info','WhatsappInteraction,\x20%s,\x20%s','debug','WhatsappInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','UpdateWhatsappInteraction','WhatsappInteraction','update','body','options','where','attributes','limit','catch','AddTagsToWhatsappInteraction','addTags','ids','omit','spread','AddTags','util','moment','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','defaults','redis','localhost'];(function(_0x559746,_0x9f479a){var _0x1f9779=function(_0x26523f){while(--_0x26523f){_0x559746['push'](_0x559746['shift']());}};_0x1f9779(++_0x9f479a);}(_0xb042,0x13c));var _0x2b04=function(_0x1928c9,_0x13a6d1){_0x1928c9=_0x1928c9-0x0;var _0x51b5fb=_0xb042[_0x1928c9];return _0x51b5fb;};'use strict';var _=require('lodash');var util=require(_0x2b04('0x0'));var moment=require(_0x2b04('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2b04('0x2'))['db'];var utils=require(_0x2b04('0x3'));var logger=require(_0x2b04('0x4'))(_0x2b04('0x5'));var config=require(_0x2b04('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x2b04('0x7')][_0x2b04('0x8')]({'port':0x232a});config['redis']=_[_0x2b04('0x9')](config[_0x2b04('0xa')],{'host':_0x2b04('0xb'),'port':0x18eb});var socket=require(_0x2b04('0xc'))(new Redis(config[_0x2b04('0xa')]));require(_0x2b04('0xd'))['register'](socket);function respondWithRpcPromise(_0xb27e80,_0x1418b8,_0x453f95){return new BPromise(function(_0x27e416,_0xa2580f){return client[_0x2b04('0xe')](_0xb27e80,_0x453f95)[_0x2b04('0xf')](function(_0x14d478){logger[_0x2b04('0x10')](_0x2b04('0x11'),_0x1418b8,'request\x20sent');logger[_0x2b04('0x12')](_0x2b04('0x13'),_0x1418b8,_0x2b04('0x14'),JSON[_0x2b04('0x15')](_0x14d478));if(_0x14d478['error']){if(_0x14d478[_0x2b04('0x16')][_0x2b04('0x17')]===0x1f4){logger[_0x2b04('0x16')](_0x2b04('0x11'),_0x1418b8,_0x14d478[_0x2b04('0x16')]['message']);return _0xa2580f(_0x14d478[_0x2b04('0x16')][_0x2b04('0x18')]);}logger[_0x2b04('0x16')]('WhatsappInteraction,\x20%s,\x20%s',_0x1418b8,_0x14d478[_0x2b04('0x16')][_0x2b04('0x18')]);return _0x27e416(_0x14d478[_0x2b04('0x16')][_0x2b04('0x18')]);}else{logger['info'](_0x2b04('0x11'),_0x1418b8,_0x2b04('0x14'));_0x27e416(_0x14d478[_0x2b04('0x19')][_0x2b04('0x18')]);}})['catch'](function(_0x33762c){logger[_0x2b04('0x16')](_0x2b04('0x11'),_0x1418b8,_0x33762c);_0xa2580f(_0x33762c);});});}exports[_0x2b04('0x1a')]=function(_0x591316){var _0x3c2f7d=this;return new Promise(function(_0x1a0ff3,_0x1c1be6){return db[_0x2b04('0x1b')][_0x2b04('0x1c')](_0x591316[_0x2b04('0x1d')],{'raw':_0x591316['options']?_0x591316[_0x2b04('0x1e')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x591316[_0x2b04('0x1e')]?_0x591316[_0x2b04('0x1e')][_0x2b04('0x1f')]||null:null,'attributes':_0x591316[_0x2b04('0x1e')]?_0x591316[_0x2b04('0x1e')][_0x2b04('0x20')]||null:null,'limit':_0x591316['options']?_0x591316[_0x2b04('0x1e')][_0x2b04('0x21')]||null:null})['then'](function(_0x8bc6ae){logger[_0x2b04('0x10')](_0x2b04('0x1a'),_0x591316);logger[_0x2b04('0x12')]('UpdateWhatsappInteraction',_0x591316,JSON[_0x2b04('0x15')](_0x8bc6ae));_0x1a0ff3(_0x8bc6ae);})[_0x2b04('0x22')](function(_0x4c08d4){logger[_0x2b04('0x16')](_0x2b04('0x1a'),_0x4c08d4[_0x2b04('0x18')],_0x591316);_0x1c1be6(_0x3c2f7d[_0x2b04('0x16')](0x1f4,_0x4c08d4[_0x2b04('0x18')]));});});};exports[_0x2b04('0x23')]=function(_0x438e21){return new Promise(function(_0x537de,_0x5a775f){return db[_0x2b04('0x1b')]['find']({'where':_0x438e21['options']?_0x438e21['options'][_0x2b04('0x1f')]||null:null})['then'](function(_0x3b7efd){if(_0x3b7efd){return _0x3b7efd[_0x2b04('0x24')](_0x438e21['body'][_0x2b04('0x25')],_[_0x2b04('0x26')](_0x438e21[_0x2b04('0x1d')],[_0x2b04('0x25'),'id'])||{});}})[_0x2b04('0x27')](function(_0x1ef36d){logger[_0x2b04('0x10')](_0x2b04('0x28'),_0x438e21);logger[_0x2b04('0x12')]('AddTags',_0x438e21,JSON[_0x2b04('0x15')](_0x1ef36d));_0x537de(_0x1ef36d);})['catch'](function(_0x37b6b0){logger['error'](_0x2b04('0x28'),_0x37b6b0[_0x2b04('0x18')],_0x438e21);_0x5a775f(_this[_0x2b04('0x16')](0x1f4,_0x37b6b0[_0x2b04('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.socket.js b/server/api/whatsappInteraction/whatsappInteraction.socket.js index 3442fd1..07f21ea 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 _0x6721=['emit','removeListener','register','length','whatsappInteraction:','remove','update'];(function(_0x6d8aa,_0x4a04f0){var _0x47f8bb=function(_0x88a0a){while(--_0x88a0a){_0x6d8aa['push'](_0x6d8aa['shift']());}};_0x47f8bb(++_0x4a04f0);}(_0x6721,0x16a));var _0x1672=function(_0x269b89,_0x21103e){_0x269b89=_0x269b89-0x0;var _0x4aa80f=_0x6721[_0x269b89];return _0x4aa80f;};'use strict';var WhatsappInteractionEvents=require('./whatsappInteraction.events');var events=['save',_0x1672('0x0'),_0x1672('0x1')];function createListener(_0x4c8471,_0x54206e){return function(_0xa09ed5){_0x54206e[_0x1672('0x2')](_0x4c8471,_0xa09ed5);};}function removeListener(_0x15ddf2,_0x48d26e){return function(){WhatsappInteractionEvents[_0x1672('0x3')](_0x15ddf2,_0x48d26e);};}exports[_0x1672('0x4')]=function(_0x117526){for(var _0x1a0d5d=0x0,_0x48fe87=events[_0x1672('0x5')];_0x1a0d5d<_0x48fe87;_0x1a0d5d++){var _0x4b3fab=events[_0x1a0d5d];var _0x16db1b=createListener(_0x1672('0x6')+_0x4b3fab,_0x117526);WhatsappInteractionEvents['on'](_0x4b3fab,_0x16db1b);}}; \ No newline at end of file +var _0x0e50=['register','length','whatsappInteraction:','./whatsappInteraction.events','remove','update','emit','removeListener'];(function(_0x3a3030,_0x30cba4){var _0x26c39b=function(_0x4f50ba){while(--_0x4f50ba){_0x3a3030['push'](_0x3a3030['shift']());}};_0x26c39b(++_0x30cba4);}(_0x0e50,0x93));var _0x00e5=function(_0x1b2ff7,_0x12a034){_0x1b2ff7=_0x1b2ff7-0x0;var _0x31656a=_0x0e50[_0x1b2ff7];return _0x31656a;};'use strict';var WhatsappInteractionEvents=require(_0x00e5('0x0'));var events=['save',_0x00e5('0x1'),_0x00e5('0x2')];function createListener(_0xe149dc,_0x5f02f1){return function(_0x207f48){_0x5f02f1[_0x00e5('0x3')](_0xe149dc,_0x207f48);};}function removeListener(_0x808500,_0x225a34){return function(){WhatsappInteractionEvents[_0x00e5('0x4')](_0x808500,_0x225a34);};}exports[_0x00e5('0x5')]=function(_0xe6f4dd){for(var _0x440545=0x0,_0x1b3c88=events[_0x00e5('0x6')];_0x440545<_0x1b3c88;_0x440545++){var _0x314355=events[_0x440545];var _0x3b9ef1=createListener(_0x00e5('0x7')+_0x314355,_0xe6f4dd);WhatsappInteractionEvents['on'](_0x314355,_0x3b9ef1);}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/index.js b/server/api/whatsappMessage/index.js index 52f710a..0517e46 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 _0x2b69=['show','post','tracked','whatsappmessage:create','create','/:id/status','put','/:id/accept','accept','/:id/reject','reject','delete','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappMessage.controller','get','isAuthenticated','/describe','describe','/:id'];(function(_0x599bda,_0x33c506){var _0x2c5d44=function(_0x3fae24){while(--_0x3fae24){_0x599bda['push'](_0x599bda['shift']());}};_0x2c5d44(++_0x33c506);}(_0x2b69,0x1ac));var _0x92b6=function(_0xb0f7c3,_0x4eae95){_0xb0f7c3=_0xb0f7c3-0x0;var _0x28ea68=_0x2b69[_0xb0f7c3];return _0x28ea68;};'use strict';var multer=require(_0x92b6('0x0'));var util=require('util');var path=require(_0x92b6('0x1'));var timeout=require(_0x92b6('0x2'));var express=require(_0x92b6('0x3'));var router=express['Router']();var fs_extra=require(_0x92b6('0x4'));var auth=require(_0x92b6('0x5'));var interaction=require(_0x92b6('0x6'));var config=require(_0x92b6('0x7'));var controller=require(_0x92b6('0x8'));router[_0x92b6('0x9')]('/',auth[_0x92b6('0xa')](),controller['index']);router['get'](_0x92b6('0xb'),auth['isAuthenticated'](),controller[_0x92b6('0xc')]);router[_0x92b6('0x9')](_0x92b6('0xd'),auth[_0x92b6('0xa')](),controller[_0x92b6('0xe')]);router[_0x92b6('0xf')]('/',auth[_0x92b6('0xa')](),interaction[_0x92b6('0x10')]('whatsapp',_0x92b6('0x11')),controller[_0x92b6('0x12')]);router[_0x92b6('0xf')](_0x92b6('0x13'),controller['status']);router[_0x92b6('0x14')](_0x92b6('0xd'),auth[_0x92b6('0xa')](),controller['update']);router[_0x92b6('0x14')](_0x92b6('0x15'),auth['isAuthenticated'](),controller[_0x92b6('0x16')]);router[_0x92b6('0x14')](_0x92b6('0x17'),auth[_0x92b6('0xa')](),controller[_0x92b6('0x18')]);router[_0x92b6('0x19')](_0x92b6('0xd'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x17e4=['/:id','post','tracked','whatsapp','whatsappmessage:create','/:id/status','status','put','update','/:id/accept','accept','/:id/reject','reject','delete','destroy','multer','util','path','connect-timeout','../../components/interaction/service','./whatsappMessage.controller','get','isAuthenticated','/describe','describe'];(function(_0x1b8f16,_0x42772b){var _0xc3e3ae=function(_0x380e42){while(--_0x380e42){_0x1b8f16['push'](_0x1b8f16['shift']());}};_0xc3e3ae(++_0x42772b);}(_0x17e4,0xa5));var _0x417e=function(_0x235c2c,_0x171db4){_0x235c2c=_0x235c2c-0x0;var _0x6b8f58=_0x17e4[_0x235c2c];return _0x6b8f58;};'use strict';var multer=require(_0x417e('0x0'));var util=require(_0x417e('0x1'));var path=require(_0x417e('0x2'));var timeout=require(_0x417e('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x417e('0x4'));var config=require('../../config/environment');var controller=require(_0x417e('0x5'));router[_0x417e('0x6')]('/',auth[_0x417e('0x7')](),controller['index']);router[_0x417e('0x6')](_0x417e('0x8'),auth[_0x417e('0x7')](),controller[_0x417e('0x9')]);router[_0x417e('0x6')](_0x417e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x417e('0xb')]('/',auth['isAuthenticated'](),interaction[_0x417e('0xc')](_0x417e('0xd'),_0x417e('0xe')),controller['create']);router[_0x417e('0xb')](_0x417e('0xf'),controller[_0x417e('0x10')]);router[_0x417e('0x11')](_0x417e('0xa'),auth[_0x417e('0x7')](),controller[_0x417e('0x12')]);router['put'](_0x417e('0x13'),auth[_0x417e('0x7')](),controller[_0x417e('0x14')]);router[_0x417e('0x11')](_0x417e('0x15'),auth[_0x417e('0x7')](),controller[_0x417e('0x16')]);router[_0x417e('0x17')](_0x417e('0xa'),auth[_0x417e('0x7')](),controller[_0x417e('0x18')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.attributes.js b/server/api/whatsappMessage/whatsappMessage.attributes.js index a0f2f97..5e1615d 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 _0x5fc3=['sequelize','exports','medium','BOOLEAN','ENUM','out','STRING','DATE'];(function(_0x11a55c,_0x4eced9){var _0x26c390=function(_0x5b0662){while(--_0x5b0662){_0x11a55c['push'](_0x11a55c['shift']());}};_0x26c390(++_0x4eced9);}(_0x5fc3,0xa8));var _0x35fc=function(_0x6eb833,_0x2bb5e5){_0x6eb833=_0x6eb833-0x0;var _0xdfc38c=_0x5fc3[_0x6eb833];return _0xdfc38c;};'use strict';var Sequelize=require(_0x35fc('0x0'));module[_0x35fc('0x1')]={'body':{'type':Sequelize['TEXT'](_0x35fc('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x35fc('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x35fc('0x4')]('in',_0x35fc('0x5')),'defaultValue':_0x35fc('0x5'),'allowNull':![]},'messageId':{'type':Sequelize['STRING'](0xbe)},'phone':{'type':Sequelize[_0x35fc('0x6')]},'readAt':{'type':Sequelize[_0x35fc('0x7')]},'secret':{'type':Sequelize[_0x35fc('0x3')],'defaultValue':![]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0x0d65=['out','STRING','BOOLEAN','sequelize','exports','ENUM'];(function(_0x57113e,_0xe663d){var _0x84b3d2=function(_0x40c723){while(--_0x40c723){_0x57113e['push'](_0x57113e['shift']());}};_0x84b3d2(++_0xe663d);}(_0x0d65,0x81));var _0x50d6=function(_0x4477a3,_0x4d08c7){_0x4477a3=_0x4477a3-0x0;var _0x3f5938=_0x0d65[_0x4477a3];return _0x3f5938;};'use strict';var Sequelize=require(_0x50d6('0x0'));module[_0x50d6('0x1')]={'body':{'type':Sequelize['TEXT']('medium'),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0x50d6('0x2')]('in',_0x50d6('0x3')),'defaultValue':_0x50d6('0x3'),'allowNull':![]},'messageId':{'type':Sequelize[_0x50d6('0x4')](0xbe)},'phone':{'type':Sequelize[_0x50d6('0x4')]},'readAt':{'type':Sequelize['DATE']},'secret':{'type':Sequelize[_0x50d6('0x5')],'defaultValue':![]},'providerName':{'type':Sequelize[_0x50d6('0x4')]},'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 624de52..73fa887 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 _0x609d=['../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','register','client','http','request','then','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','sendStatus','json','offset','undefined','limit','count','status','set','Content-Range','apply','reject','update','destroy','end','stack','name','send','index','map','rawAttributes','fieldName','type','model','query','keys','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','options','include','WhatsappMessage','findAll','rows','show','params','intersection','includeAll','create','body','find','describe','whatsapp-interactions','accept','whatsapp','read','readAt','format','UserId','user','get','WhatsappInteraction','isNil','read1stAt','YYYY-MM-DD\x20HH:mm:ss','interaction','role','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','QueryTypes','SELECT','contact','agent','email','manual','interface','SIP/%s','channel','EventManager','acceptmessage','[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','rejectMessage','Sequelize','User','fullname','internal','motionChannel','event','rejectmessage','WhatsappAccount','WhatsappAccountId','WhatsppMessage,\x20%s,\x20%s,\x20%s','received\x20delivery\x20report\x20from','inspect','twilio','MessageSid','messageId','MessageStatus','WhatsappAccount,\x20%s,\x20%s,\x20%s','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api'];(function(_0x4328fc,_0x5c2006){var _0x5d2251=function(_0x1a0e64){while(--_0x1a0e64){_0x4328fc['push'](_0x4328fc['shift']());}};_0x5d2251(++_0x5c2006);}(_0x609d,0x197));var _0xd609=function(_0x834bb6,_0x1c5e35){_0x834bb6=_0x834bb6-0x0;var _0xa35d00=_0x609d[_0x834bb6];return _0xa35d00;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xd609('0x0'));var zipdir=require(_0xd609('0x1'));var jsonpatch=require(_0xd609('0x2'));var rp=require(_0xd609('0x3'));var moment=require(_0xd609('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xd609('0x5'));var util=require(_0xd609('0x6'));var path=require(_0xd609('0x7'));var sox=require(_0xd609('0x8'));var csv=require(_0xd609('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xd609('0xa'));var _=require(_0xd609('0xb'));var squel=require(_0xd609('0xc'));var crypto=require('crypto');var jsforce=require(_0xd609('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xd609('0xe'));var Papa=require(_0xd609('0xf'));var Redis=require(_0xd609('0x10'));var authService=require(_0xd609('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xd609('0x12'));var hardwareService=require(_0xd609('0x13'));var logger=require(_0xd609('0x14'))(_0xd609('0x15'));var utils=require('../../config/utils');var config=require(_0xd609('0x16'));var licenseUtil=require(_0xd609('0x17'));var db=require(_0xd609('0x18'))['db'];config[_0xd609('0x19')]=_[_0xd609('0x1a')](config['redis'],{'host':_0xd609('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xd609('0x19')]));require('./whatsappMessage.socket')[_0xd609('0x1c')](socket);var jayson=require('jayson/promise');var client=jayson[_0xd609('0x1d')][_0xd609('0x1e')]({'port':0x232c});var client9002=jayson[_0xd609('0x1d')][_0xd609('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x1ee1c1,_0x1d8766,_0x2488e0,_0x4d887e){return new BPromise(function(_0x5ce546,_0x51a37b){var _0x3fb52f=_0x4d887e||client;return _0x3fb52f[_0xd609('0x1f')](_0x1ee1c1,_0x2488e0)[_0xd609('0x20')](function(_0x100ea4){logger[_0xd609('0x21')](_0xd609('0x22'),_0x1d8766,_0xd609('0x23'));logger[_0xd609('0x24')](_0xd609('0x25'),_0x1d8766,'request\x20sent',JSON[_0xd609('0x26')](_0x100ea4));if(_0x100ea4[_0xd609('0x27')]){if(_0x100ea4[_0xd609('0x27')][_0xd609('0x28')]===0x1f4){logger[_0xd609('0x27')]('WhatsappMessage,\x20%s,\x20%s',_0x1d8766,_0x100ea4[_0xd609('0x27')][_0xd609('0x29')]);return _0x51a37b(_0x100ea4[_0xd609('0x27')]['message']);}logger[_0xd609('0x27')](_0xd609('0x22'),_0x1d8766,_0x100ea4[_0xd609('0x27')][_0xd609('0x29')]);return _0x5ce546(_0x100ea4[_0xd609('0x27')]['message']);}else{logger[_0xd609('0x21')](_0xd609('0x22'),_0x1d8766,_0xd609('0x23'));_0x5ce546(_0x100ea4['result'][_0xd609('0x29')]);}})[_0xd609('0x2a')](function(_0x4cc410){logger[_0xd609('0x27')](_0xd609('0x22'),_0x1d8766,_0x4cc410);_0x51a37b(_0x4cc410);});});}function respondWithStatusCode(_0x4ef6f6,_0x312220){_0x312220=_0x312220||0xcc;return function(_0x144214){if(_0x144214){return _0x4ef6f6[_0xd609('0x2b')](_0x312220);}return _0x4ef6f6['status'](_0x312220)['end']();};}function respondWithResult(_0x48c19c,_0x128284){_0x128284=_0x128284||0xc8;return function(_0x36a123){if(_0x36a123){return _0x48c19c['status'](_0x128284)[_0xd609('0x2c')](_0x36a123);}};}function respondWithFilteredResult(_0x12866a,_0x4b10ec){return function(_0xfb3f26){if(_0xfb3f26){var _0x165a4e=typeof _0x4b10ec[_0xd609('0x2d')]===_0xd609('0x2e')&&typeof _0x4b10ec[_0xd609('0x2f')]===_0xd609('0x2e');var _0x2349b2=_0xfb3f26['count'];var _0x52e2d2=_0x165a4e?0x0:_0x4b10ec[_0xd609('0x2d')];var _0x55163b=_0x165a4e?_0xfb3f26[_0xd609('0x30')]:_0x4b10ec[_0xd609('0x2d')]+_0x4b10ec[_0xd609('0x2f')];var _0x1d8cd4;if(_0x55163b>=_0x2349b2){_0x55163b=_0x2349b2;_0x1d8cd4=0xc8;}else{_0x1d8cd4=0xce;}_0x12866a[_0xd609('0x31')](_0x1d8cd4);return _0x12866a[_0xd609('0x32')](_0xd609('0x33'),_0x52e2d2+'-'+_0x55163b+'/'+_0x2349b2)[_0xd609('0x2c')](_0xfb3f26);}return null;};}function patchUpdates(_0x2ac60d){return function(_0x11e8a0){try{jsonpatch[_0xd609('0x34')](_0x11e8a0,_0x2ac60d,!![]);}catch(_0x791335){return BPromise[_0xd609('0x35')](_0x791335);}return _0x11e8a0['save']();};}function saveUpdates(_0x3249ee,_0x2a58c8){return function(_0x32120d){if(_0x32120d){return _0x32120d[_0xd609('0x36')](_0x3249ee)['then'](function(_0x30b415){return _0x30b415;});}return null;};}function removeEntity(_0x29a306,_0x32b522){return function(_0x27f378){if(_0x27f378){return _0x27f378[_0xd609('0x37')]()[_0xd609('0x20')](function(){_0x29a306[_0xd609('0x31')](0xcc)[_0xd609('0x38')]();});}};}function handleEntityNotFound(_0x1f53de,_0x101b1e){return function(_0x669e1e){if(!_0x669e1e){_0x1f53de[_0xd609('0x2b')](0x194);}return _0x669e1e;};}function handleError(_0x48e80e,_0x145791){_0x145791=_0x145791||0x1f4;return function(_0x126b27){logger['error'](_0x126b27[_0xd609('0x39')]);if(_0x126b27[_0xd609('0x3a')]){delete _0x126b27[_0xd609('0x3a')];}_0x48e80e[_0xd609('0x31')](_0x145791)[_0xd609('0x3b')](_0x126b27);};}exports[_0xd609('0x3c')]=function(_0x406154,_0x5a480d){var _0x5893c9={},_0x591520={},_0x140992={'count':0x0,'rows':[]};var _0x3fbb71=_[_0xd609('0x3d')](db['WhatsappMessage'][_0xd609('0x3e')],function(_0x4440d3){return{'name':_0x4440d3[_0xd609('0x3f')],'type':_0x4440d3[_0xd609('0x40')]['key']};});_0x591520[_0xd609('0x41')]=_[_0xd609('0x3d')](_0x3fbb71,_0xd609('0x3a'));_0x591520[_0xd609('0x42')]=_[_0xd609('0x43')](_0x406154[_0xd609('0x42')]);_0x591520['filters']=_['intersection'](_0x591520[_0xd609('0x41')],_0x591520[_0xd609('0x42')]);_0x5893c9[_0xd609('0x44')]=_['intersection'](_0x591520[_0xd609('0x41')],qs[_0xd609('0x45')](_0x406154['query'][_0xd609('0x45')]));_0x5893c9[_0xd609('0x44')]=_0x5893c9['attributes'][_0xd609('0x46')]?_0x5893c9[_0xd609('0x44')]:_0x591520[_0xd609('0x41')];if(!_0x406154['query'][_0xd609('0x47')](_0xd609('0x48'))){_0x5893c9[_0xd609('0x2f')]=qs[_0xd609('0x2f')](_0x406154[_0xd609('0x42')]['limit']);_0x5893c9[_0xd609('0x2d')]=qs[_0xd609('0x2d')](_0x406154['query'][_0xd609('0x2d')]);}_0x5893c9[_0xd609('0x49')]=qs[_0xd609('0x4a')](_0x406154['query'][_0xd609('0x4a')]);_0x5893c9[_0xd609('0x4b')]=qs[_0xd609('0x4c')](_['pick'](_0x406154[_0xd609('0x42')],_0x591520['filters']),_0x3fbb71);if(_0x406154[_0xd609('0x42')][_0xd609('0x4d')]){_0x5893c9['where']=_[_0xd609('0x4e')](_0x5893c9[_0xd609('0x4b')],{'$or':_['map'](_0x3fbb71,function(_0x59b5ea){if(_0x59b5ea[_0xd609('0x40')]!==_0xd609('0x4f')){var _0x54f184={};_0x54f184[_0x59b5ea['name']]={'$like':'%'+_0x406154[_0xd609('0x42')][_0xd609('0x4d')]+'%'};return _0x54f184;}})});}_0x5893c9=_[_0xd609('0x4e')]({},_0x5893c9,_0x406154[_0xd609('0x50')]);var _0x7891bc={'where':_0x5893c9[_0xd609('0x4b')]};return db['WhatsappMessage']['count'](_0x7891bc)[_0xd609('0x20')](function(_0x350bf1){_0x140992[_0xd609('0x30')]=_0x350bf1;if(_0x406154[_0xd609('0x42')]['includeAll']){_0x5893c9[_0xd609('0x51')]=[{'all':!![]}];}return db[_0xd609('0x52')][_0xd609('0x53')](_0x5893c9);})['then'](function(_0x1a52f0){_0x140992[_0xd609('0x54')]=_0x1a52f0;return _0x140992;})[_0xd609('0x20')](respondWithFilteredResult(_0x5a480d,_0x5893c9))['catch'](handleError(_0x5a480d,null));};exports[_0xd609('0x55')]=function(_0xedf329,_0x4468a0){var _0x70fc7={'raw':!![],'where':{'id':_0xedf329[_0xd609('0x56')]['id']}},_0x39d9d7={};_0x39d9d7[_0xd609('0x41')]=_[_0xd609('0x43')](db['WhatsappMessage'][_0xd609('0x3e')]);_0x39d9d7[_0xd609('0x42')]=_[_0xd609('0x43')](_0xedf329[_0xd609('0x42')]);_0x39d9d7[_0xd609('0x4c')]=_['intersection'](_0x39d9d7[_0xd609('0x41')],_0x39d9d7[_0xd609('0x42')]);_0x70fc7[_0xd609('0x44')]=_[_0xd609('0x57')](_0x39d9d7[_0xd609('0x41')],qs[_0xd609('0x45')](_0xedf329[_0xd609('0x42')][_0xd609('0x45')]));_0x70fc7[_0xd609('0x44')]=_0x70fc7[_0xd609('0x44')][_0xd609('0x46')]?_0x70fc7['attributes']:_0x39d9d7[_0xd609('0x41')];if(_0xedf329['query'][_0xd609('0x58')]){_0x70fc7[_0xd609('0x51')]=[{'all':!![]}];}_0x70fc7=_['merge']({},_0x70fc7,_0xedf329['options']);return db[_0xd609('0x52')]['find'](_0x70fc7)[_0xd609('0x20')](handleEntityNotFound(_0x4468a0,null))[_0xd609('0x20')](respondWithResult(_0x4468a0,null))['catch'](handleError(_0x4468a0,null));};exports[_0xd609('0x59')]=function(_0x23f7ef,_0xad3407){return db[_0xd609('0x52')][_0xd609('0x59')](_0x23f7ef[_0xd609('0x5a')],{})[_0xd609('0x20')](respondWithResult(_0xad3407,0xc9))['catch'](handleError(_0xad3407,null));};exports[_0xd609('0x36')]=function(_0x55cdda,_0x527432){if(_0x55cdda[_0xd609('0x5a')]['id']){delete _0x55cdda[_0xd609('0x5a')]['id'];}return db['WhatsappMessage'][_0xd609('0x5b')]({'where':{'id':_0x55cdda[_0xd609('0x56')]['id']}})[_0xd609('0x20')](handleEntityNotFound(_0x527432,null))['then'](saveUpdates(_0x55cdda['body'],null))[_0xd609('0x20')](respondWithResult(_0x527432,null))[_0xd609('0x2a')](handleError(_0x527432,null));};exports['destroy']=function(_0x26d9c2,_0x49d83a){return db[_0xd609('0x52')][_0xd609('0x5b')]({'where':{'id':_0x26d9c2[_0xd609('0x56')]['id']}})[_0xd609('0x20')](handleEntityNotFound(_0x49d83a,null))[_0xd609('0x20')](removeEntity(_0x49d83a,null))[_0xd609('0x2a')](handleError(_0x49d83a,null));};exports[_0xd609('0x5c')]=function(_0x2f33f6,_0x479ce8){return db[_0xd609('0x52')][_0xd609('0x5c')]()[_0xd609('0x20')](respondWithResult(_0x479ce8,null))[_0xd609('0x2a')](handleError(_0x479ce8,null));};var interaction_log=require('../../config/logger')(_0xd609('0x5d'));exports[_0xd609('0x5e')]=function(_0x2a1924,_0x274598,_0x28f377){var _0xaa0807={'agent':{},'channel':_0xd609('0x5f')};if(_0x2a1924[_0xd609('0x5a')]['id']){delete _0x2a1924[_0xd609('0x5a')]['id'];}_0x2a1924[_0xd609('0x5a')][_0xd609('0x60')]=!![];_0x2a1924[_0xd609('0x5a')][_0xd609('0x61')]=moment()[_0xd609('0x62')]('YYYY-MM-DD\x20HH:mm:ss');_0x2a1924[_0xd609('0x5a')][_0xd609('0x63')]=_0x2a1924[_0xd609('0x5a')]['UserId']||_0x2a1924[_0xd609('0x64')]['id'];_0xaa0807['agent']['id']=_0x2a1924[_0xd609('0x5a')][_0xd609('0x63')];return db[_0xd609('0x52')][_0xd609('0x5b')]({'where':{'id':_0x2a1924[_0xd609('0x56')]['id'],'UserId':null}})[_0xd609('0x20')](handleEntityNotFound(_0x274598,null))[_0xd609('0x20')](saveUpdates(_0x2a1924[_0xd609('0x5a')],null))[_0xd609('0x20')](function(_0x2932bd){if(_0x2932bd){_0xaa0807['message']=_0x2932bd[_0xd609('0x65')]({'plain':!![]});return db[_0xd609('0x66')][_0xd609('0x5b')]({'where':{'id':_0x2932bd['WhatsappInteractionId']}});}return null;})[_0xd609('0x20')](handleEntityNotFound(_0x274598,null))[_0xd609('0x20')](function(_0x32c924){if(_0x32c924){return _0x32c924[_0xd609('0x36')]({'UserId':_0x2a1924[_0xd609('0x5a')]['UserId'],'read1stAt':_[_0xd609('0x67')](_0x32c924[_0xd609('0x68')])?moment()[_0xd609('0x62')](_0xd609('0x69')):undefined});}return null;})[_0xd609('0x20')](function(_0x1e24ef){if(_0x1e24ef){_0xaa0807[_0xd609('0x6a')]=_0x1e24ef[_0xd609('0x65')]({'plain':!![]});interaction_log[_0xd609('0x21')]('[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x2a1924['user']['id'],_0x2a1924[_0xd609('0x64')][_0xd609('0x3a')],_0x2a1924[_0xd609('0x64')][_0xd609('0x6b')],_0xaa0807['interaction']['id'],_0x2a1924[_0xd609('0x5a')]?JSON[_0xd609('0x26')](_0x2a1924['body']):_0xd609('0x6c'));return respondWithRpcPromise(_0xd609('0x6d'),_0xd609('0x6e'),_0xaa0807);}return null;})[_0xd609('0x20')](function(_0x1dccf5){var _0x58fe4d=_0xd609('0x6f')+_0x1dccf5[_0xd609('0x29')][_0xd609('0x70')];return db['sequelize'][_0xd609('0x42')](_0x58fe4d,{'type':db['Sequelize'][_0xd609('0x71')][_0xd609('0x72')],'raw':!![]})[_0xd609('0x20')](function(_0x5219f1){return _0x5219f1;});})[_0xd609('0x20')](function(_0x4b0123){if(_0x4b0123){_0xaa0807[_0xd609('0x29')][_0xd609('0x73')]=_0x4b0123[0x0];if(!_0x2a1924[_0xd609('0x5a')]['UserId'])return;return db['User'][_0xd609('0x5b')]({'where':{'id':_0x2a1924[_0xd609('0x5a')][_0xd609('0x63')],'role':_0xd609('0x74')},'attributes':['id',_0xd609('0x3a'),'fullname',_0xd609('0x75'),'internal'],'raw':!![]});}return null;})['then'](function(_0x96bbf9){if(!_0x96bbf9)return null;_0xaa0807[_0xd609('0x29')][_0xd609('0x74')]=_0x96bbf9;return _0xaa0807;})[_0xd609('0x20')](function(_0x59aba3){if(_0x59aba3){if(_0x2a1924[_0xd609('0x5a')][_0xd609('0x76')]){_0xaa0807['message'][_0xd609('0x77')]=util['format'](_0xd609('0x78'),_0x2a1924[_0xd609('0x64')][_0xd609('0x3a')]);_0xaa0807['message'][_0xd609('0x79')]=_0xaa0807[_0xd609('0x79')];_0xaa0807[_0xd609('0x29')]['motionChannel']=_0xaa0807['channel'];_0xaa0807[_0xd609('0x29')]['event']=_0xd609('0x5e');return respondWithRpcPromise(_0xd609('0x7a'),'EventManager',{'event':_0xd609('0x7b'),'message':_0xaa0807['message']},client9002)[_0xd609('0x20')](function(){return _0xaa0807;});}return _0xaa0807;}return null;})[_0xd609('0x20')](respondWithResult(_0x274598,null))[_0xd609('0x2a')](handleError(_0x274598,null));};var interaction_log=require('../../config/logger')(_0xd609('0x5d'));exports['reject']=function(_0x1167d1,_0x24b01d,_0x5c6385){var _0x5b75d1={'agent':{},'channel':_0xd609('0x5f')};if(_0x1167d1[_0xd609('0x5a')]['id']){delete _0x1167d1[_0xd609('0x5a')]['id'];}_0x1167d1[_0xd609('0x5a')]['UserId']=_0x1167d1[_0xd609('0x5a')][_0xd609('0x63')]||_0x1167d1[_0xd609('0x64')]['id'];_0x5b75d1[_0xd609('0x74')]['id']=_0x1167d1['body'][_0xd609('0x63')];return db[_0xd609('0x52')]['find']({'where':{'id':_0x1167d1[_0xd609('0x56')]['id'],'UserId':null}})[_0xd609('0x20')](handleEntityNotFound(_0x24b01d,null))[_0xd609('0x20')](function(_0x3a50e5){if(_0x3a50e5){_0x5b75d1[_0xd609('0x29')]=_0x3a50e5[_0xd609('0x65')]({'plain':!![]});return db['WhatsappInteraction'][_0xd609('0x5b')]({'where':{'id':_0x3a50e5['WhatsappInteractionId']}});}return null;})[_0xd609('0x20')](handleEntityNotFound(_0x24b01d,null))['then'](function(_0x45b8f1){if(_0x45b8f1){_0x5b75d1['interaction']=_0x45b8f1[_0xd609('0x65')]({'plain':!![]});interaction_log[_0xd609('0x21')](_0xd609('0x7c'),_0x1167d1[_0xd609('0x64')]['id'],_0x1167d1['user'][_0xd609('0x3a')],_0x1167d1[_0xd609('0x64')]['role'],_0x5b75d1['interaction']['id'],_0x1167d1[_0xd609('0x5a')]?JSON[_0xd609('0x26')](_0x1167d1['body']):_0xd609('0x6c'));return respondWithRpcPromise('RejectMessage',_0xd609('0x7d'),_0x5b75d1);}return null;})[_0xd609('0x20')](function(_0xc81053){var _0x3a11b8=_0xd609('0x6f')+_0xc81053[_0xd609('0x29')]['ContactId'];return db['sequelize'][_0xd609('0x42')](_0x3a11b8,{'type':db[_0xd609('0x7e')][_0xd609('0x71')][_0xd609('0x72')],'raw':!![]})['then'](function(_0x565ec3){return _0x565ec3;});})[_0xd609('0x20')](function(_0x10d8d2){if(_0x10d8d2){_0x5b75d1[_0xd609('0x29')][_0xd609('0x73')]=_0x10d8d2[0x0];if(!_0x1167d1[_0xd609('0x5a')]['UserId'])return;return db[_0xd609('0x7f')]['find']({'where':{'id':_0x1167d1[_0xd609('0x5a')]['UserId'],'role':'agent'},'attributes':['id',_0xd609('0x3a'),_0xd609('0x80'),_0xd609('0x75'),_0xd609('0x81')],'raw':!![]});}return null;})[_0xd609('0x20')](function(_0x12933a){if(!_0x12933a)return null;_0x5b75d1[_0xd609('0x29')][_0xd609('0x74')]=_0x12933a;return _0x5b75d1;})['then'](function(_0x23792a){if(_0x23792a){_0x23792a[_0xd609('0x29')][_0xd609('0x77')]=util[_0xd609('0x62')](_0xd609('0x78'),_0x1167d1['user'][_0xd609('0x3a')]);_0x23792a[_0xd609('0x29')][_0xd609('0x79')]=_0x5b75d1[_0xd609('0x79')];_0x23792a[_0xd609('0x29')][_0xd609('0x82')]=_0x5b75d1['channel'];_0x23792a[_0xd609('0x29')][_0xd609('0x83')]='reject';respondWithRpcPromise(_0xd609('0x7a'),_0xd609('0x7a'),{'event':_0xd609('0x84'),'message':_0x23792a[_0xd609('0x29')]},client9002);return _0x5b75d1;}return null;})[_0xd609('0x20')](respondWithResult(_0x24b01d,null))[_0xd609('0x2a')](handleError(_0x24b01d,null));};exports[_0xd609('0x31')]=function(_0x65f0c8,_0x5e6dc9,_0x2057d9){if(_0x65f0c8[_0xd609('0x5a')]['id']){delete _0x65f0c8[_0xd609('0x5a')]['id'];}var _0x2d8c6d;return db[_0xd609('0x52')]['find']({'where':{'id':_0x65f0c8[_0xd609('0x56')]['id']}})[_0xd609('0x20')](handleEntityNotFound(_0x5e6dc9,null))[_0xd609('0x20')](function(_0x2f0c22){if(_0x2f0c22){_0x2d8c6d=_0x2f0c22;return db[_0xd609('0x85')][_0xd609('0x5b')]({'where':{'id':_0x2f0c22[_0xd609('0x86')]}});}})[_0xd609('0x20')](handleEntityNotFound(_0x5e6dc9,null))[_0xd609('0x20')](function(_0x208d01){if(_0x208d01){logger[_0xd609('0x24')](_0xd609('0x87'),_0xd609('0x31'),_0xd609('0x88'),_0x208d01[_0xd609('0x40')],util[_0xd609('0x89')](_0x65f0c8[_0xd609('0x5a')],{'showHidden':![],'depth':null}));switch(_0x208d01[_0xd609('0x40')]){case _0xd609('0x8a'):if(_0x65f0c8[_0xd609('0x5a')][_0xd609('0x8b')]&&_0x65f0c8[_0xd609('0x5a')][_0xd609('0x8b')]===_0x2d8c6d[_0xd609('0x8c')]&&_0x65f0c8['body']['MessageStatus']&&_0x65f0c8[_0xd609('0x5a')][_0xd609('0x8d')]==='read'){return _0x2d8c6d[_0xd609('0x36')]({'read':!![]});}else{logger[_0xd609('0x27')](_0xd609('0x8e'),_0xd609('0x31'),_0xd609('0x8a'),util[_0xd609('0x89')](_0x65f0c8[_0xd609('0x5a')],{'showHidden':![],'depth':null}));}break;}return _0x2d8c6d;}})[_0xd609('0x20')](respondWithResult(_0x5e6dc9,null))[_0xd609('0x2a')](handleError(_0x5e6dc9,null));}; \ No newline at end of file +var _0x062c=['register','jayson/promise','client','http','then','info','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','error','code','WhatsappMessage,\x20%s,\x20%s','message','request\x20sent','sendStatus','status','end','json','offset','undefined','limit','count','apply','reject','send','index','map','WhatsappMessage','type','key','name','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','includeAll','include','catch','show','params','rawAttributes','find','create','body','update','describe','whatsapp-interactions','read','readAt','YYYY-MM-DD\x20HH:mm:ss','agent','UserId','get','WhatsappInteraction','WhatsappInteractionId','read1stAt','interaction','[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','stringify','AcceptMessage','acceptMessage','ContactId','sequelize','Sequelize','SELECT','User','email','internal','manual','interface','SIP/%s','channel','EventManager','acceptmessage','whatsapp','[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','RejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','contact','fullname','motionChannel','event','rejectmessage','WhatsappAccount','WhatsappAccountId','WhatsppMessage,\x20%s,\x20%s,\x20%s','inspect','twilio','MessageSid','messageId','MessageStatus','WhatsappAccount,\x20%s,\x20%s,\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./whatsappMessage.socket'];(function(_0x42bdad,_0x12836c){var _0x122626=function(_0x2eb29c){while(--_0x2eb29c){_0x42bdad['push'](_0x42bdad['shift']());}};_0x122626(++_0x12836c);}(_0x062c,0xf0));var _0xc062=function(_0x4aa554,_0x5d8d98){_0x4aa554=_0x4aa554-0x0;var _0x23ffec=_0x062c[_0x4aa554];return _0x23ffec;};'use strict';var emlformat=require(_0xc062('0x0'));var rimraf=require(_0xc062('0x1'));var zipdir=require(_0xc062('0x2'));var jsonpatch=require(_0xc062('0x3'));var rp=require('request-promise');var moment=require(_0xc062('0x4'));var BPromise=require(_0xc062('0x5'));var Mustache=require(_0xc062('0x6'));var util=require(_0xc062('0x7'));var path=require('path');var sox=require(_0xc062('0x8'));var csv=require(_0xc062('0x9'));var ejs=require(_0xc062('0xa'));var fs=require('fs');var fs_extra=require(_0xc062('0xb'));var _=require(_0xc062('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xc062('0xd'));var deskjs=require(_0xc062('0xe'));var toCsv=require(_0xc062('0x9'));var querystring=require(_0xc062('0xf'));var Papa=require(_0xc062('0x10'));var Redis=require(_0xc062('0x11'));var authService=require(_0xc062('0x12'));var qs=require(_0xc062('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc062('0x14'));var logger=require(_0xc062('0x15'))(_0xc062('0x16'));var utils=require(_0xc062('0x17'));var config=require(_0xc062('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xc062('0x19'))['db'];config[_0xc062('0x1a')]=_['defaults'](config[_0xc062('0x1a')],{'host':_0xc062('0x1b'),'port':0x18eb});var socket=require(_0xc062('0x1c'))(new Redis(config['redis']));require(_0xc062('0x1d'))[_0xc062('0x1e')](socket);var jayson=require(_0xc062('0x1f'));var client=jayson['client']['http']({'port':0x232c});var client9002=jayson[_0xc062('0x20')][_0xc062('0x21')]({'port':0x232a});function respondWithRpcPromise(_0x164e21,_0x3f6d5c,_0xc1c147,_0x4cda60){return new BPromise(function(_0x511db9,_0x4b53d2){var _0x41f61a=_0x4cda60||client;return _0x41f61a['request'](_0x164e21,_0xc1c147)[_0xc062('0x22')](function(_0x3f23eb){logger[_0xc062('0x23')]('WhatsappMessage,\x20%s,\x20%s',_0x3f6d5c,'request\x20sent');logger[_0xc062('0x24')](_0xc062('0x25'),_0x3f6d5c,'request\x20sent',JSON['stringify'](_0x3f23eb));if(_0x3f23eb[_0xc062('0x26')]){if(_0x3f23eb[_0xc062('0x26')][_0xc062('0x27')]===0x1f4){logger[_0xc062('0x26')](_0xc062('0x28'),_0x3f6d5c,_0x3f23eb[_0xc062('0x26')][_0xc062('0x29')]);return _0x4b53d2(_0x3f23eb[_0xc062('0x26')][_0xc062('0x29')]);}logger[_0xc062('0x26')](_0xc062('0x28'),_0x3f6d5c,_0x3f23eb[_0xc062('0x26')][_0xc062('0x29')]);return _0x511db9(_0x3f23eb[_0xc062('0x26')][_0xc062('0x29')]);}else{logger[_0xc062('0x23')](_0xc062('0x28'),_0x3f6d5c,_0xc062('0x2a'));_0x511db9(_0x3f23eb['result'][_0xc062('0x29')]);}})['catch'](function(_0x267960){logger[_0xc062('0x26')](_0xc062('0x28'),_0x3f6d5c,_0x267960);_0x4b53d2(_0x267960);});});}function respondWithStatusCode(_0xc74ef6,_0xdf04d1){_0xdf04d1=_0xdf04d1||0xcc;return function(_0x2eb5a7){if(_0x2eb5a7){return _0xc74ef6[_0xc062('0x2b')](_0xdf04d1);}return _0xc74ef6[_0xc062('0x2c')](_0xdf04d1)[_0xc062('0x2d')]();};}function respondWithResult(_0x4622ff,_0x54282a){_0x54282a=_0x54282a||0xc8;return function(_0x3665bb){if(_0x3665bb){return _0x4622ff[_0xc062('0x2c')](_0x54282a)[_0xc062('0x2e')](_0x3665bb);}};}function respondWithFilteredResult(_0x100f9b,_0x2636e0){return function(_0x21e84e){if(_0x21e84e){var _0x16f245=typeof _0x2636e0[_0xc062('0x2f')]===_0xc062('0x30')&&typeof _0x2636e0[_0xc062('0x31')]===_0xc062('0x30');var _0x49e5e0=_0x21e84e[_0xc062('0x32')];var _0x15b357=_0x16f245?0x0:_0x2636e0[_0xc062('0x2f')];var _0x5ef86c=_0x16f245?_0x21e84e['count']:_0x2636e0[_0xc062('0x2f')]+_0x2636e0[_0xc062('0x31')];var _0x36f057;if(_0x5ef86c>=_0x49e5e0){_0x5ef86c=_0x49e5e0;_0x36f057=0xc8;}else{_0x36f057=0xce;}_0x100f9b[_0xc062('0x2c')](_0x36f057);return _0x100f9b['set']('Content-Range',_0x15b357+'-'+_0x5ef86c+'/'+_0x49e5e0)[_0xc062('0x2e')](_0x21e84e);}return null;};}function patchUpdates(_0x89d2bd){return function(_0x5a444f){try{jsonpatch[_0xc062('0x33')](_0x5a444f,_0x89d2bd,!![]);}catch(_0x551ca9){return BPromise[_0xc062('0x34')](_0x551ca9);}return _0x5a444f['save']();};}function saveUpdates(_0x2f4eea,_0x54c34a){return function(_0x41fb34){if(_0x41fb34){return _0x41fb34['update'](_0x2f4eea)['then'](function(_0x5ab2eb){return _0x5ab2eb;});}return null;};}function removeEntity(_0x7ac577,_0xd7612e){return function(_0x40943a){if(_0x40943a){return _0x40943a['destroy']()[_0xc062('0x22')](function(){_0x7ac577[_0xc062('0x2c')](0xcc)[_0xc062('0x2d')]();});}};}function handleEntityNotFound(_0x2f18e0,_0x1a34f5){return function(_0x367c04){if(!_0x367c04){_0x2f18e0[_0xc062('0x2b')](0x194);}return _0x367c04;};}function handleError(_0x5e79a6,_0x43d70a){_0x43d70a=_0x43d70a||0x1f4;return function(_0x128b87){logger[_0xc062('0x26')](_0x128b87['stack']);if(_0x128b87['name']){delete _0x128b87['name'];}_0x5e79a6['status'](_0x43d70a)[_0xc062('0x35')](_0x128b87);};}exports[_0xc062('0x36')]=function(_0x5e41af,_0x113f58){var _0x3ef343={},_0x26c0c2={},_0x32c817={'count':0x0,'rows':[]};var _0x1acba8=_[_0xc062('0x37')](db[_0xc062('0x38')]['rawAttributes'],function(_0x2bfb48){return{'name':_0x2bfb48['fieldName'],'type':_0x2bfb48[_0xc062('0x39')][_0xc062('0x3a')]};});_0x26c0c2['model']=_[_0xc062('0x37')](_0x1acba8,_0xc062('0x3b'));_0x26c0c2[_0xc062('0x3c')]=_[_0xc062('0x3d')](_0x5e41af[_0xc062('0x3c')]);_0x26c0c2[_0xc062('0x3e')]=_[_0xc062('0x3f')](_0x26c0c2[_0xc062('0x40')],_0x26c0c2['query']);_0x3ef343[_0xc062('0x41')]=_[_0xc062('0x3f')](_0x26c0c2['model'],qs[_0xc062('0x42')](_0x5e41af[_0xc062('0x3c')][_0xc062('0x42')]));_0x3ef343[_0xc062('0x41')]=_0x3ef343[_0xc062('0x41')]['length']?_0x3ef343[_0xc062('0x41')]:_0x26c0c2[_0xc062('0x40')];if(!_0x5e41af[_0xc062('0x3c')][_0xc062('0x43')](_0xc062('0x44'))){_0x3ef343[_0xc062('0x31')]=qs[_0xc062('0x31')](_0x5e41af[_0xc062('0x3c')][_0xc062('0x31')]);_0x3ef343[_0xc062('0x2f')]=qs['offset'](_0x5e41af[_0xc062('0x3c')]['offset']);}_0x3ef343[_0xc062('0x45')]=qs[_0xc062('0x46')](_0x5e41af[_0xc062('0x3c')][_0xc062('0x46')]);_0x3ef343[_0xc062('0x47')]=qs[_0xc062('0x3e')](_['pick'](_0x5e41af['query'],_0x26c0c2[_0xc062('0x3e')]),_0x1acba8);if(_0x5e41af[_0xc062('0x3c')][_0xc062('0x48')]){_0x3ef343['where']=_[_0xc062('0x49')](_0x3ef343['where'],{'$or':_[_0xc062('0x37')](_0x1acba8,function(_0x5f9731){if(_0x5f9731['type']!==_0xc062('0x4a')){var _0x219e1d={};_0x219e1d[_0x5f9731[_0xc062('0x3b')]]={'$like':'%'+_0x5e41af['query']['filter']+'%'};return _0x219e1d;}})});}_0x3ef343=_[_0xc062('0x49')]({},_0x3ef343,_0x5e41af['options']);var _0x3e6184={'where':_0x3ef343['where']};return db[_0xc062('0x38')][_0xc062('0x32')](_0x3e6184)['then'](function(_0x556d90){_0x32c817[_0xc062('0x32')]=_0x556d90;if(_0x5e41af[_0xc062('0x3c')][_0xc062('0x4b')]){_0x3ef343[_0xc062('0x4c')]=[{'all':!![]}];}return db[_0xc062('0x38')]['findAll'](_0x3ef343);})[_0xc062('0x22')](function(_0x187cbd){_0x32c817['rows']=_0x187cbd;return _0x32c817;})['then'](respondWithFilteredResult(_0x113f58,_0x3ef343))[_0xc062('0x4d')](handleError(_0x113f58,null));};exports[_0xc062('0x4e')]=function(_0x25042b,_0x3b416e){var _0x2de645={'raw':!![],'where':{'id':_0x25042b[_0xc062('0x4f')]['id']}},_0x207f5f={};_0x207f5f['model']=_[_0xc062('0x3d')](db[_0xc062('0x38')][_0xc062('0x50')]);_0x207f5f[_0xc062('0x3c')]=_[_0xc062('0x3d')](_0x25042b[_0xc062('0x3c')]);_0x207f5f['filters']=_[_0xc062('0x3f')](_0x207f5f[_0xc062('0x40')],_0x207f5f[_0xc062('0x3c')]);_0x2de645['attributes']=_['intersection'](_0x207f5f['model'],qs[_0xc062('0x42')](_0x25042b[_0xc062('0x3c')]['fields']));_0x2de645['attributes']=_0x2de645[_0xc062('0x41')]['length']?_0x2de645[_0xc062('0x41')]:_0x207f5f[_0xc062('0x40')];if(_0x25042b[_0xc062('0x3c')][_0xc062('0x4b')]){_0x2de645[_0xc062('0x4c')]=[{'all':!![]}];}_0x2de645=_[_0xc062('0x49')]({},_0x2de645,_0x25042b['options']);return db['WhatsappMessage'][_0xc062('0x51')](_0x2de645)[_0xc062('0x22')](handleEntityNotFound(_0x3b416e,null))['then'](respondWithResult(_0x3b416e,null))['catch'](handleError(_0x3b416e,null));};exports['create']=function(_0x4829f2,_0x2d0873){return db[_0xc062('0x38')][_0xc062('0x52')](_0x4829f2[_0xc062('0x53')],{})[_0xc062('0x22')](respondWithResult(_0x2d0873,0xc9))[_0xc062('0x4d')](handleError(_0x2d0873,null));};exports[_0xc062('0x54')]=function(_0x936a0e,_0x5b1629){if(_0x936a0e['body']['id']){delete _0x936a0e['body']['id'];}return db[_0xc062('0x38')][_0xc062('0x51')]({'where':{'id':_0x936a0e['params']['id']}})['then'](handleEntityNotFound(_0x5b1629,null))[_0xc062('0x22')](saveUpdates(_0x936a0e['body'],null))[_0xc062('0x22')](respondWithResult(_0x5b1629,null))[_0xc062('0x4d')](handleError(_0x5b1629,null));};exports['destroy']=function(_0x45498d,_0x531d87){return db[_0xc062('0x38')][_0xc062('0x51')]({'where':{'id':_0x45498d[_0xc062('0x4f')]['id']}})['then'](handleEntityNotFound(_0x531d87,null))[_0xc062('0x22')](removeEntity(_0x531d87,null))['catch'](handleError(_0x531d87,null));};exports[_0xc062('0x55')]=function(_0x3c1574,_0x30229c){return db[_0xc062('0x38')]['describe']()[_0xc062('0x22')](respondWithResult(_0x30229c,null))[_0xc062('0x4d')](handleError(_0x30229c,null));};var interaction_log=require(_0xc062('0x15'))(_0xc062('0x56'));exports['accept']=function(_0x17f2e6,_0x3b3064,_0x6eb26){var _0x227b5d={'agent':{},'channel':'whatsapp'};if(_0x17f2e6[_0xc062('0x53')]['id']){delete _0x17f2e6[_0xc062('0x53')]['id'];}_0x17f2e6['body'][_0xc062('0x57')]=!![];_0x17f2e6[_0xc062('0x53')][_0xc062('0x58')]=moment()['format'](_0xc062('0x59'));_0x17f2e6[_0xc062('0x53')]['UserId']=_0x17f2e6[_0xc062('0x53')]['UserId']||_0x17f2e6['user']['id'];_0x227b5d[_0xc062('0x5a')]['id']=_0x17f2e6[_0xc062('0x53')][_0xc062('0x5b')];return db[_0xc062('0x38')][_0xc062('0x51')]({'where':{'id':_0x17f2e6[_0xc062('0x4f')]['id'],'UserId':null}})[_0xc062('0x22')](handleEntityNotFound(_0x3b3064,null))[_0xc062('0x22')](saveUpdates(_0x17f2e6[_0xc062('0x53')],null))[_0xc062('0x22')](function(_0x439946){if(_0x439946){_0x227b5d['message']=_0x439946[_0xc062('0x5c')]({'plain':!![]});return db[_0xc062('0x5d')][_0xc062('0x51')]({'where':{'id':_0x439946[_0xc062('0x5e')]}});}return null;})[_0xc062('0x22')](handleEntityNotFound(_0x3b3064,null))[_0xc062('0x22')](function(_0x5bd8ce){if(_0x5bd8ce){return _0x5bd8ce['update']({'UserId':_0x17f2e6['body'][_0xc062('0x5b')],'read1stAt':_['isNil'](_0x5bd8ce[_0xc062('0x5f')])?moment()['format'](_0xc062('0x59')):undefined});}return null;})['then'](function(_0x261b79){if(_0x261b79){_0x227b5d[_0xc062('0x60')]=_0x261b79[_0xc062('0x5c')]({'plain':!![]});interaction_log[_0xc062('0x23')](_0xc062('0x61'),_0x17f2e6['user']['id'],_0x17f2e6['user'][_0xc062('0x3b')],_0x17f2e6[_0xc062('0x62')][_0xc062('0x63')],_0x227b5d[_0xc062('0x60')]['id'],_0x17f2e6[_0xc062('0x53')]?JSON[_0xc062('0x64')](_0x17f2e6[_0xc062('0x53')]):'null');return respondWithRpcPromise(_0xc062('0x65'),_0xc062('0x66'),_0x227b5d);}return null;})['then'](function(_0x104f34){var _0x2ec3eb='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x104f34['message'][_0xc062('0x67')];return db[_0xc062('0x68')][_0xc062('0x3c')](_0x2ec3eb,{'type':db[_0xc062('0x69')]['QueryTypes'][_0xc062('0x6a')],'raw':!![]})[_0xc062('0x22')](function(_0x18853c){return _0x18853c;});})[_0xc062('0x22')](function(_0x3172e5){if(_0x3172e5){_0x227b5d['message']['contact']=_0x3172e5[0x0];if(!_0x17f2e6['body']['UserId'])return;return db[_0xc062('0x6b')][_0xc062('0x51')]({'where':{'id':_0x17f2e6['body'][_0xc062('0x5b')],'role':_0xc062('0x5a')},'attributes':['id',_0xc062('0x3b'),'fullname',_0xc062('0x6c'),_0xc062('0x6d')],'raw':!![]});}return null;})[_0xc062('0x22')](function(_0x5f1156){if(!_0x5f1156)return null;_0x227b5d[_0xc062('0x29')][_0xc062('0x5a')]=_0x5f1156;return _0x227b5d;})[_0xc062('0x22')](function(_0x1aa3b0){if(_0x1aa3b0){if(_0x17f2e6[_0xc062('0x53')][_0xc062('0x6e')]){_0x227b5d[_0xc062('0x29')][_0xc062('0x6f')]=util['format'](_0xc062('0x70'),_0x17f2e6[_0xc062('0x62')][_0xc062('0x3b')]);_0x227b5d[_0xc062('0x29')][_0xc062('0x71')]=_0x227b5d[_0xc062('0x71')];_0x227b5d[_0xc062('0x29')]['motionChannel']=_0x227b5d['channel'];_0x227b5d[_0xc062('0x29')]['event']='accept';return respondWithRpcPromise(_0xc062('0x72'),_0xc062('0x72'),{'event':_0xc062('0x73'),'message':_0x227b5d['message']},client9002)[_0xc062('0x22')](function(){return _0x227b5d;});}return _0x227b5d;}return null;})[_0xc062('0x22')](respondWithResult(_0x3b3064,null))['catch'](handleError(_0x3b3064,null));};var interaction_log=require(_0xc062('0x15'))('whatsapp-interactions');exports[_0xc062('0x34')]=function(_0x586aff,_0x4b3a26,_0x41235c){var _0x2d3383={'agent':{},'channel':_0xc062('0x74')};if(_0x586aff[_0xc062('0x53')]['id']){delete _0x586aff[_0xc062('0x53')]['id'];}_0x586aff[_0xc062('0x53')][_0xc062('0x5b')]=_0x586aff['body'][_0xc062('0x5b')]||_0x586aff[_0xc062('0x62')]['id'];_0x2d3383[_0xc062('0x5a')]['id']=_0x586aff[_0xc062('0x53')]['UserId'];return db[_0xc062('0x38')][_0xc062('0x51')]({'where':{'id':_0x586aff[_0xc062('0x4f')]['id'],'UserId':null}})[_0xc062('0x22')](handleEntityNotFound(_0x4b3a26,null))['then'](function(_0x4078f4){if(_0x4078f4){_0x2d3383['message']=_0x4078f4['get']({'plain':!![]});return db[_0xc062('0x5d')][_0xc062('0x51')]({'where':{'id':_0x4078f4['WhatsappInteractionId']}});}return null;})[_0xc062('0x22')](handleEntityNotFound(_0x4b3a26,null))['then'](function(_0x579096){if(_0x579096){_0x2d3383['interaction']=_0x579096[_0xc062('0x5c')]({'plain':!![]});interaction_log[_0xc062('0x23')](_0xc062('0x75'),_0x586aff[_0xc062('0x62')]['id'],_0x586aff[_0xc062('0x62')][_0xc062('0x3b')],_0x586aff['user'][_0xc062('0x63')],_0x2d3383[_0xc062('0x60')]['id'],_0x586aff[_0xc062('0x53')]?JSON[_0xc062('0x64')](_0x586aff['body']):_0xc062('0x76'));return respondWithRpcPromise(_0xc062('0x77'),'rejectMessage',_0x2d3383);}return null;})[_0xc062('0x22')](function(_0xe4b20d){var _0xf5e348=_0xc062('0x78')+_0xe4b20d[_0xc062('0x29')][_0xc062('0x67')];return db[_0xc062('0x68')][_0xc062('0x3c')](_0xf5e348,{'type':db[_0xc062('0x69')]['QueryTypes'][_0xc062('0x6a')],'raw':!![]})['then'](function(_0x438e14){return _0x438e14;});})[_0xc062('0x22')](function(_0x36d6d4){if(_0x36d6d4){_0x2d3383[_0xc062('0x29')][_0xc062('0x79')]=_0x36d6d4[0x0];if(!_0x586aff[_0xc062('0x53')][_0xc062('0x5b')])return;return db[_0xc062('0x6b')]['find']({'where':{'id':_0x586aff[_0xc062('0x53')]['UserId'],'role':'agent'},'attributes':['id',_0xc062('0x3b'),_0xc062('0x7a'),_0xc062('0x6c'),_0xc062('0x6d')],'raw':!![]});}return null;})[_0xc062('0x22')](function(_0xfdcfa){if(!_0xfdcfa)return null;_0x2d3383['message']['agent']=_0xfdcfa;return _0x2d3383;})['then'](function(_0x24749f){if(_0x24749f){_0x24749f[_0xc062('0x29')][_0xc062('0x6f')]=util['format']('SIP/%s',_0x586aff[_0xc062('0x62')][_0xc062('0x3b')]);_0x24749f[_0xc062('0x29')]['channel']=_0x2d3383[_0xc062('0x71')];_0x24749f[_0xc062('0x29')][_0xc062('0x7b')]=_0x2d3383[_0xc062('0x71')];_0x24749f[_0xc062('0x29')][_0xc062('0x7c')]='reject';respondWithRpcPromise('EventManager',_0xc062('0x72'),{'event':_0xc062('0x7d'),'message':_0x24749f[_0xc062('0x29')]},client9002);return _0x2d3383;}return null;})[_0xc062('0x22')](respondWithResult(_0x4b3a26,null))['catch'](handleError(_0x4b3a26,null));};exports[_0xc062('0x2c')]=function(_0x3609d2,_0x298571,_0x4c268f){if(_0x3609d2['body']['id']){delete _0x3609d2[_0xc062('0x53')]['id'];}var _0x2e3965;return db[_0xc062('0x38')]['find']({'where':{'id':_0x3609d2['params']['id']}})[_0xc062('0x22')](handleEntityNotFound(_0x298571,null))['then'](function(_0x49541d){if(_0x49541d){_0x2e3965=_0x49541d;return db[_0xc062('0x7e')][_0xc062('0x51')]({'where':{'id':_0x49541d[_0xc062('0x7f')]}});}})[_0xc062('0x22')](handleEntityNotFound(_0x298571,null))[_0xc062('0x22')](function(_0x484848){if(_0x484848){logger[_0xc062('0x24')](_0xc062('0x80'),_0xc062('0x2c'),'received\x20delivery\x20report\x20from',_0x484848['type'],util[_0xc062('0x81')](_0x3609d2[_0xc062('0x53')],{'showHidden':![],'depth':null}));switch(_0x484848['type']){case _0xc062('0x82'):if(_0x3609d2[_0xc062('0x53')][_0xc062('0x83')]&&_0x3609d2[_0xc062('0x53')][_0xc062('0x83')]===_0x2e3965[_0xc062('0x84')]&&_0x3609d2[_0xc062('0x53')][_0xc062('0x85')]&&_0x3609d2[_0xc062('0x53')][_0xc062('0x85')]===_0xc062('0x57')){return _0x2e3965[_0xc062('0x54')]({'read':!![]});}else{logger[_0xc062('0x26')](_0xc062('0x86'),_0xc062('0x2c'),'twilio',util['inspect'](_0x3609d2['body'],{'showHidden':![],'depth':null}));}break;}return _0x2e3965;}})[_0xc062('0x22')](respondWithResult(_0x298571,null))[_0xc062('0x4d')](handleError(_0x298571,null));}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.events.js b/server/api/whatsappMessage/whatsappMessage.events.js index 08571de..3384313 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 _0x5423=['hook','exports','events','../../mysqldb','setMaxListeners','save','remove','emit','hasOwnProperty'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5423,0xe3));var _0x3542=function(_0x22ff4f,_0x440ca8){_0x22ff4f=_0x22ff4f-0x0;var _0x29e2fc=_0x5423[_0x22ff4f];return _0x29e2fc;};'use strict';var EventEmitter=require(_0x3542('0x0'));var WhatsappMessage=require(_0x3542('0x1'))['db']['WhatsappMessage'];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents[_0x3542('0x2')](0x0);var events={'afterCreate':_0x3542('0x3'),'afterUpdate':'update','afterDestroy':_0x3542('0x4')};function emitEvent(_0x1202d5){return function(_0xf0835,_0x2a1864,_0x54ea2f){WhatsappMessageEvents[_0x3542('0x5')](_0x1202d5+':'+_0xf0835['id'],_0xf0835);WhatsappMessageEvents[_0x3542('0x5')](_0x1202d5,_0xf0835);_0x54ea2f(null);};}for(var e in events){if(events[_0x3542('0x6')](e)){var event=events[e];WhatsappMessage[_0x3542('0x7')](e,emitEvent(event));}}module[_0x3542('0x8')]=WhatsappMessageEvents; \ No newline at end of file +var _0xaaa2=['hook','events','../../mysqldb','WhatsappMessage','setMaxListeners','save','update','emit','hasOwnProperty'];(function(_0x3074f3,_0x4f2c03){var _0x53f112=function(_0x4a17af){while(--_0x4a17af){_0x3074f3['push'](_0x3074f3['shift']());}};_0x53f112(++_0x4f2c03);}(_0xaaa2,0xac));var _0x2aaa=function(_0xfe4ecd,_0xd2f09){_0xfe4ecd=_0xfe4ecd-0x0;var _0x52f6d5=_0xaaa2[_0xfe4ecd];return _0x52f6d5;};'use strict';var EventEmitter=require(_0x2aaa('0x0'));var WhatsappMessage=require(_0x2aaa('0x1'))['db'][_0x2aaa('0x2')];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents[_0x2aaa('0x3')](0x0);var events={'afterCreate':_0x2aaa('0x4'),'afterUpdate':_0x2aaa('0x5'),'afterDestroy':'remove'};function emitEvent(_0xfc076){return function(_0x482489,_0x35b5c8,_0x340071){WhatsappMessageEvents[_0x2aaa('0x6')](_0xfc076+':'+_0x482489['id'],_0x482489);WhatsappMessageEvents[_0x2aaa('0x6')](_0xfc076,_0x482489);_0x340071(null);};}for(var e in events){if(events[_0x2aaa('0x7')](e)){var event=events[e];WhatsappMessage[_0x2aaa('0x8')](e,emitEvent(event));}}module['exports']=WhatsappMessageEvents; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.model.js b/server/api/whatsappMessage/whatsappMessage.model.js index 60ed260..cb8736d 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 _0x2d0c=['whatsapp_messages','messageId','fti_whatsapp_messages','body','FULLTEXT','get','direction','toLowerCase','out','secret','UserId','WhatsappInteraction','findOne','WhatsappInteractionId','then','createdAt','catch','error','WhatsappAccount','find','WhatsappAccountId','type','twilio','accountSid','authToken','messages','create','whatsapp:','phone','remote','/status?token=','token','sid','update','WhatsappMessage,\x20%s,\x20%s,\x20%s','afterCreate','inspect','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','baseUrl','/whatsapp/v1/','/messages/','text','POST','Bearer\x20','application/json','statuses','message_id','finally','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','moment','bluebird','request-promise','node-fetch','path','rimraf','../../config/environment','exports','WhatsappMessage'];(function(_0x286bfb,_0x46ac3c){var _0x52b683=function(_0x3e7fb1){while(--_0x3e7fb1){_0x286bfb['push'](_0x286bfb['shift']());}};_0x52b683(++_0x46ac3c);}(_0x2d0c,0x70));var _0xc2d0=function(_0x19b1c2,_0x205062){_0x19b1c2=_0x19b1c2-0x0;var _0x4e1ae5=_0x2d0c[_0x19b1c2];return _0x4e1ae5;};'use strict';var _=require(_0xc2d0('0x0'));var util=require(_0xc2d0('0x1'));var logger=require(_0xc2d0('0x2'))('api');var moment=require(_0xc2d0('0x3'));var BPromise=require(_0xc2d0('0x4'));var rp=require(_0xc2d0('0x5'));var fetch=require(_0xc2d0('0x6'));var fs=require('fs');var path=require(_0xc2d0('0x7'));var rimraf=require(_0xc2d0('0x8'));var config=require(_0xc2d0('0x9'));var attributes=require('./whatsappMessage.attributes');module[_0xc2d0('0xa')]=function(_0x5d0c9e,_0x3e7ee0){return _0x5d0c9e['define'](_0xc2d0('0xb'),attributes,{'tableName':_0xc2d0('0xc'),'paranoid':![],'indexes':[{'name':_0xc2d0('0xd'),'fields':[_0xc2d0('0xd')]},{'name':_0xc2d0('0xe'),'fields':[_0xc2d0('0xf')],'type':_0xc2d0('0x10')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x883480,_0x2f96bd,_0x3b50fb){var _0x400bdd=_0x5d0c9e['models'];var _0x4c962a=_0x883480[_0xc2d0('0x11')]({'plain':!![]});if(_0x4c962a[_0xc2d0('0x12')][_0xc2d0('0x13')]()==='in'||_0x4c962a[_0xc2d0('0x12')]['toLowerCase']()===_0xc2d0('0x14')&&!_0x4c962a[_0xc2d0('0x15')]&&!_['isNil'](_0x4c962a[_0xc2d0('0x16')])){_0x400bdd[_0xc2d0('0x17')][_0xc2d0('0x18')]({'where':{'id':_0x4c962a[_0xc2d0('0x19')]}})[_0xc2d0('0x1a')](function(_0x1e5985){if(_0x1e5985){_0x1e5985['update']({'lastMsgAt':_0x4c962a[_0xc2d0('0x1b')],'lastMsgDirection':_0x4c962a[_0xc2d0('0x12')]['toLowerCase']()});}})[_0xc2d0('0x1c')](function(_0x2258fc){console[_0xc2d0('0x1d')](_0x2258fc);});}if(_0x4c962a['direction']==='out'&&!_0x4c962a[_0xc2d0('0x15')]){var _0x5b3048;_0x400bdd[_0xc2d0('0x1e')][_0xc2d0('0x1f')]({'where':{'id':_0x4c962a[_0xc2d0('0x20')]},'raw':!![]})[_0xc2d0('0x1a')](function(_0x3163e9){_0x5b3048=_0x3163e9;if(_0x5b3048&&_0x5b3048[_0xc2d0('0x21')]){switch(_0x5b3048['type']){case _0xc2d0('0x22'):var _0x52088a=require(_0xc2d0('0x22'));if(_0x5b3048[_0xc2d0('0x23')]&&_0x5b3048['authToken']&&_0x5b3048['phone']){var _0x15273f=new _0x52088a(_0x5b3048[_0xc2d0('0x23')],_0x5b3048[_0xc2d0('0x24')]);_0x15273f[_0xc2d0('0x25')][_0xc2d0('0x26')]({'body':_0x4c962a[_0xc2d0('0xf')],'to':_0xc2d0('0x27')+_0x4c962a['phone'],'from':_0xc2d0('0x27')+_0x5b3048[_0xc2d0('0x28')],'statusCallback':_0x5b3048[_0xc2d0('0x29')]+'/api/whatsapp/messages/'+_0x4c962a['id']+_0xc2d0('0x2a')+_0x5b3048[_0xc2d0('0x2b')]})['then'](function(_0x3ed886){if(_0x3ed886[_0xc2d0('0x2c')]){return _0x883480[_0xc2d0('0x2d')]({'messageId':_0x3ed886[_0xc2d0('0x2c')]});}})['catch'](function(_0xa132d5){logger[_0xc2d0('0x1d')](_0xc2d0('0x2e'),_0xc2d0('0x2f'),_0xc2d0('0x22'),util[_0xc2d0('0x30')](_0xa132d5,{'showHidden':![],'depth':null}));});}else{logger[_0xc2d0('0x1d')](_0xc2d0('0x2e'),_0xc2d0('0x2f'),_0xc2d0('0x22'),_0xc2d0('0x31'));}break;case'sinch':var _0x2f8a8c=_0x5b3048[_0xc2d0('0x23')];var _0x17090e=_0x5b3048[_0xc2d0('0x24')];var _0x590ca3=_0x5b3048[_0xc2d0('0x32')]+_0xc2d0('0x33')+_0x2f8a8c+_0xc2d0('0x34');var _0xee1796={'to':[_0x4c962a['phone']],'message':{'type':_0xc2d0('0x35'),'text':_0x4c962a[_0xc2d0('0xf')]}};var _0x42bee5={'method':_0xc2d0('0x36'),'uri':_0x590ca3,'headers':{'Authorization':_0xc2d0('0x37')+_0x17090e,'Content-Type':_0xc2d0('0x38')},'body':_0xee1796,'json':!![]};rp(_0x42bee5)[_0xc2d0('0x1a')](function(_0x3c2e3f){if(_0x3c2e3f[_0xc2d0('0x39')][0x0][_0xc2d0('0x3a')]){return _0x883480[_0xc2d0('0x2d')]({'messageId':_0x3c2e3f[_0xc2d0('0x39')][0x0][_0xc2d0('0x3a')]});}})[_0xc2d0('0x1c')](function(_0x18d915){logger['err']('WhatsappMessage,\x20%s',_0x18d915);});break;}}})[_0xc2d0('0x3b')](function(){_0x3b50fb();});}else{_0x3b50fb();}}},'charset':_0xc2d0('0x3c'),'collate':_0xc2d0('0x3d')});}; \ No newline at end of file +var _0x10d1=['bluebird','request-promise','node-fetch','path','rimraf','exports','messageId','fti_whatsapp_messages','body','FULLTEXT','models','get','direction','toLowerCase','secret','isNil','UserId','WhatsappInteraction','findOne','WhatsappInteractionId','then','createdAt','catch','error','WhatsappAccount','find','WhatsappAccountId','type','twilio','accountSid','authToken','phone','messages','create','whatsapp:','/api/whatsapp/messages/','/status?token=','token','sid','afterCreate','inspect','WhatsappMessage,\x20%s,\x20%s,\x20%s','sinch','baseUrl','/whatsapp/v1/','text','POST','Bearer\x20','application/json','statuses','message_id','update','err','finally','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api'];(function(_0x3dba56,_0x5928ff){var _0x1caa36=function(_0x453120){while(--_0x453120){_0x3dba56['push'](_0x3dba56['shift']());}};_0x1caa36(++_0x5928ff);}(_0x10d1,0xec));var _0x110d=function(_0x57a464,_0xca6f3b){_0x57a464=_0x57a464-0x0;var _0x4514ef=_0x10d1[_0x57a464];return _0x4514ef;};'use strict';var _=require(_0x110d('0x0'));var util=require(_0x110d('0x1'));var logger=require(_0x110d('0x2'))(_0x110d('0x3'));var moment=require('moment');var BPromise=require(_0x110d('0x4'));var rp=require(_0x110d('0x5'));var fetch=require(_0x110d('0x6'));var fs=require('fs');var path=require(_0x110d('0x7'));var rimraf=require(_0x110d('0x8'));var config=require('../../config/environment');var attributes=require('./whatsappMessage.attributes');module[_0x110d('0x9')]=function(_0x319484,_0x947940){return _0x319484['define']('WhatsappMessage',attributes,{'tableName':'whatsapp_messages','paranoid':![],'indexes':[{'name':_0x110d('0xa'),'fields':['messageId']},{'name':_0x110d('0xb'),'fields':[_0x110d('0xc')],'type':_0x110d('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x5eb1f3,_0xb37e28,_0x1d0ab0){var _0x5564d9=_0x319484[_0x110d('0xe')];var _0x2e13cc=_0x5eb1f3[_0x110d('0xf')]({'plain':!![]});if(_0x2e13cc[_0x110d('0x10')][_0x110d('0x11')]()==='in'||_0x2e13cc[_0x110d('0x10')][_0x110d('0x11')]()==='out'&&!_0x2e13cc[_0x110d('0x12')]&&!_[_0x110d('0x13')](_0x2e13cc[_0x110d('0x14')])){_0x5564d9[_0x110d('0x15')][_0x110d('0x16')]({'where':{'id':_0x2e13cc[_0x110d('0x17')]}})[_0x110d('0x18')](function(_0x325507){if(_0x325507){_0x325507['update']({'lastMsgAt':_0x2e13cc[_0x110d('0x19')],'lastMsgDirection':_0x2e13cc['direction'][_0x110d('0x11')]()});}})[_0x110d('0x1a')](function(_0xfb57d8){console[_0x110d('0x1b')](_0xfb57d8);});}if(_0x2e13cc['direction']==='out'&&!_0x2e13cc['secret']){var _0x120691;_0x5564d9[_0x110d('0x1c')][_0x110d('0x1d')]({'where':{'id':_0x2e13cc[_0x110d('0x1e')]},'raw':!![]})[_0x110d('0x18')](function(_0x59305b){_0x120691=_0x59305b;if(_0x120691&&_0x120691[_0x110d('0x1f')]){switch(_0x120691[_0x110d('0x1f')]){case _0x110d('0x20'):var _0x4fd8cf=require('twilio');if(_0x120691[_0x110d('0x21')]&&_0x120691[_0x110d('0x22')]&&_0x120691[_0x110d('0x23')]){var _0x49ee2b=new _0x4fd8cf(_0x120691[_0x110d('0x21')],_0x120691[_0x110d('0x22')]);_0x49ee2b[_0x110d('0x24')][_0x110d('0x25')]({'body':_0x2e13cc[_0x110d('0xc')],'to':_0x110d('0x26')+_0x2e13cc['phone'],'from':_0x110d('0x26')+_0x120691[_0x110d('0x23')],'statusCallback':_0x120691['remote']+_0x110d('0x27')+_0x2e13cc['id']+_0x110d('0x28')+_0x120691[_0x110d('0x29')]})[_0x110d('0x18')](function(_0x335df7){if(_0x335df7['sid']){return _0x5eb1f3['update']({'messageId':_0x335df7[_0x110d('0x2a')]});}})[_0x110d('0x1a')](function(_0x29df03){logger[_0x110d('0x1b')]('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0x110d('0x2b'),_0x110d('0x20'),util[_0x110d('0x2c')](_0x29df03,{'showHidden':![],'depth':null}));});}else{logger[_0x110d('0x1b')](_0x110d('0x2d'),_0x110d('0x2b'),'twilio','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken');}break;case _0x110d('0x2e'):var _0x307899=_0x120691[_0x110d('0x21')];var _0x332292=_0x120691[_0x110d('0x22')];var _0x4578e4=_0x120691[_0x110d('0x2f')]+_0x110d('0x30')+_0x307899+'/messages/';var _0x5a3662={'to':[_0x2e13cc[_0x110d('0x23')]],'message':{'type':_0x110d('0x31'),'text':_0x2e13cc[_0x110d('0xc')]}};var _0xd5f5db={'method':_0x110d('0x32'),'uri':_0x4578e4,'headers':{'Authorization':_0x110d('0x33')+_0x332292,'Content-Type':_0x110d('0x34')},'body':_0x5a3662,'json':!![]};rp(_0xd5f5db)['then'](function(_0x559c34){if(_0x559c34[_0x110d('0x35')][0x0][_0x110d('0x36')]){return _0x5eb1f3[_0x110d('0x37')]({'messageId':_0x559c34[_0x110d('0x35')][0x0][_0x110d('0x36')]});}})[_0x110d('0x1a')](function(_0x4149d0){logger[_0x110d('0x38')]('WhatsappMessage,\x20%s',_0x4149d0);});break;}}})[_0x110d('0x39')](function(){_0x1d0ab0();});}else{_0x1d0ab0();}}},'charset':_0x110d('0x3a'),'collate':_0x110d('0x3b')});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.rpc.js b/server/api/whatsappMessage/whatsappMessage.rpc.js index ed257c2..b75a2a3 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 _0x2063=['options','CreateWhatsappMessage','debug','lodash','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','defaults','redis','localhost','socket.io-emitter','register','request','then','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','WhatsappMessage','create','body'];(function(_0x2c7618,_0x26be9c){var _0x5ce3f0=function(_0x1837b3){while(--_0x1837b3){_0x2c7618['push'](_0x2c7618['shift']());}};_0x5ce3f0(++_0x26be9c);}(_0x2063,0x183));var _0x3206=function(_0x578f1b,_0x5a3be1){_0x578f1b=_0x578f1b-0x0;var _0x1777be=_0x2063[_0x578f1b];return _0x1777be;};'use strict';var _=require(_0x3206('0x0'));var util=require('util');var moment=require(_0x3206('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3206('0x2'));var db=require(_0x3206('0x3'))['db'];var utils=require(_0x3206('0x4'));var logger=require(_0x3206('0x5'))(_0x3206('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x3206('0x7')][_0x3206('0x8')]({'port':0x232a});config['redis']=_[_0x3206('0x9')](config[_0x3206('0xa')],{'host':_0x3206('0xb'),'port':0x18eb});var socket=require(_0x3206('0xc'))(new Redis(config[_0x3206('0xa')]));require('./whatsappMessage.socket')[_0x3206('0xd')](socket);function respondWithRpcPromise(_0x134b68,_0x16b41d,_0x4d2815){return new BPromise(function(_0x3faaab,_0x2e9c69){return client[_0x3206('0xe')](_0x134b68,_0x4d2815)[_0x3206('0xf')](function(_0x491359){logger[_0x3206('0x10')](_0x3206('0x11'),_0x16b41d,_0x3206('0x12'));logger['debug'](_0x3206('0x13'),_0x16b41d,_0x3206('0x12'),JSON[_0x3206('0x14')](_0x491359));if(_0x491359[_0x3206('0x15')]){if(_0x491359['error'][_0x3206('0x16')]===0x1f4){logger[_0x3206('0x15')](_0x3206('0x11'),_0x16b41d,_0x491359[_0x3206('0x15')][_0x3206('0x17')]);return _0x2e9c69(_0x491359[_0x3206('0x15')][_0x3206('0x17')]);}logger[_0x3206('0x15')]('WhatsappMessage,\x20%s,\x20%s',_0x16b41d,_0x491359[_0x3206('0x15')][_0x3206('0x17')]);return _0x3faaab(_0x491359[_0x3206('0x15')][_0x3206('0x17')]);}else{logger['info'](_0x3206('0x11'),_0x16b41d,'request\x20sent');_0x3faaab(_0x491359[_0x3206('0x18')][_0x3206('0x17')]);}})[_0x3206('0x19')](function(_0xd273a4){logger[_0x3206('0x15')](_0x3206('0x11'),_0x16b41d,_0xd273a4);_0x2e9c69(_0xd273a4);});});}exports['CreateWhatsappMessage']=function(_0x325ec6){var _0x18e0cb=this;return new Promise(function(_0x35d04a,_0x118358){return db[_0x3206('0x1a')][_0x3206('0x1b')](_0x325ec6[_0x3206('0x1c')],{'raw':_0x325ec6[_0x3206('0x1d')]?_0x325ec6[_0x3206('0x1d')]['raw']===undefined?!![]:![]:!![]})[_0x3206('0xf')](function(_0x3952b1){logger[_0x3206('0x10')](_0x3206('0x1e'),_0x325ec6);logger[_0x3206('0x1f')](_0x3206('0x1e'),_0x325ec6,JSON[_0x3206('0x14')](_0x3952b1));_0x35d04a(_0x3952b1);})[_0x3206('0x19')](function(_0x3a1dd4){logger[_0x3206('0x15')](_0x3206('0x1e'),_0x3a1dd4[_0x3206('0x17')],_0x325ec6);_0x118358(_0x18e0cb[_0x3206('0x15')](0x1f4,_0x3a1dd4[_0x3206('0x17')]));});});}; \ No newline at end of file +var _0x7935=['rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./whatsappMessage.socket','register','then','WhatsappMessage,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','info','result','catch','CreateWhatsappMessage','WhatsappMessage','create','options','raw','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x243b59,_0x3f9495){var _0x3e1676=function(_0x354052){while(--_0x354052){_0x243b59['push'](_0x243b59['shift']());}};_0x3e1676(++_0x3f9495);}(_0x7935,0x185));var _0x5793=function(_0x1499ed,_0x31884c){_0x1499ed=_0x1499ed-0x0;var _0x821a34=_0x7935[_0x1499ed];return _0x821a34;};'use strict';var _=require(_0x5793('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x5793('0x1'));var rs=require(_0x5793('0x2'));var fs=require('fs');var Redis=require(_0x5793('0x3'));var db=require(_0x5793('0x4'))['db'];var utils=require(_0x5793('0x5'));var logger=require(_0x5793('0x6'))(_0x5793('0x7'));var config=require(_0x5793('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x5793('0x9')][_0x5793('0xa')]({'port':0x232a});config[_0x5793('0xb')]=_[_0x5793('0xc')](config[_0x5793('0xb')],{'host':_0x5793('0xd'),'port':0x18eb});var socket=require(_0x5793('0xe'))(new Redis(config[_0x5793('0xb')]));require(_0x5793('0xf'))[_0x5793('0x10')](socket);function respondWithRpcPromise(_0x2632a9,_0x13c100,_0x17fb77){return new BPromise(function(_0xb87043,_0x364f38){return client['request'](_0x2632a9,_0x17fb77)[_0x5793('0x11')](function(_0x3af9bb){logger['info'](_0x5793('0x12'),_0x13c100,'request\x20sent');logger[_0x5793('0x13')]('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0x13c100,_0x5793('0x14'),JSON[_0x5793('0x15')](_0x3af9bb));if(_0x3af9bb[_0x5793('0x16')]){if(_0x3af9bb['error'][_0x5793('0x17')]===0x1f4){logger[_0x5793('0x16')]('WhatsappMessage,\x20%s,\x20%s',_0x13c100,_0x3af9bb[_0x5793('0x16')][_0x5793('0x18')]);return _0x364f38(_0x3af9bb[_0x5793('0x16')][_0x5793('0x18')]);}logger[_0x5793('0x16')](_0x5793('0x12'),_0x13c100,_0x3af9bb[_0x5793('0x16')]['message']);return _0xb87043(_0x3af9bb[_0x5793('0x16')][_0x5793('0x18')]);}else{logger[_0x5793('0x19')](_0x5793('0x12'),_0x13c100,_0x5793('0x14'));_0xb87043(_0x3af9bb[_0x5793('0x1a')][_0x5793('0x18')]);}})[_0x5793('0x1b')](function(_0x288fc0){logger[_0x5793('0x16')]('WhatsappMessage,\x20%s,\x20%s',_0x13c100,_0x288fc0);_0x364f38(_0x288fc0);});});}exports[_0x5793('0x1c')]=function(_0x44cc7c){var _0x340321=this;return new Promise(function(_0x83bd4c,_0x562df3){return db[_0x5793('0x1d')][_0x5793('0x1e')](_0x44cc7c['body'],{'raw':_0x44cc7c[_0x5793('0x1f')]?_0x44cc7c['options'][_0x5793('0x20')]===undefined?!![]:![]:!![]})[_0x5793('0x11')](function(_0x5c8dac){logger['info']('CreateWhatsappMessage',_0x44cc7c);logger[_0x5793('0x13')](_0x5793('0x1c'),_0x44cc7c,JSON[_0x5793('0x15')](_0x5c8dac));_0x83bd4c(_0x5c8dac);})['catch'](function(_0x122b0c){logger[_0x5793('0x16')](_0x5793('0x1c'),_0x122b0c['message'],_0x44cc7c);_0x562df3(_0x340321[_0x5793('0x16')](0x1f4,_0x122b0c['message']));});});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.socket.js b/server/api/whatsappMessage/whatsappMessage.socket.js index c9c201d..58c4c16 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 _0xd446=['save','emit','removeListener','register','./whatsappMessage.events'];(function(_0x870cc1,_0x56ecd4){var _0x41fb2d=function(_0x8ec16e){while(--_0x8ec16e){_0x870cc1['push'](_0x870cc1['shift']());}};_0x41fb2d(++_0x56ecd4);}(_0xd446,0x153));var _0x6d44=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd446[_0x3dd15e];return _0x231fd0;};'use strict';var WhatsappMessageEvents=require(_0x6d44('0x0'));var events=[_0x6d44('0x1'),'remove','update'];function createListener(_0x49651d,_0x6b8b70){return function(_0x1f9f47){_0x6b8b70[_0x6d44('0x2')](_0x49651d,_0x1f9f47);};}function removeListener(_0x5d9a5a,_0x1cdb9e){return function(){WhatsappMessageEvents[_0x6d44('0x3')](_0x5d9a5a,_0x1cdb9e);};}exports[_0x6d44('0x4')]=function(_0x220fb4){for(var _0x52cc37=0x0,_0x241459=events['length'];_0x52cc37<_0x241459;_0x52cc37++){var _0x4ed1a1=events[_0x52cc37];var _0x53d7b1=createListener('whatsappMessage:'+_0x4ed1a1,_0x220fb4);WhatsappMessageEvents['on'](_0x4ed1a1,_0x53d7b1);}}; \ No newline at end of file +var _0x45e2=['remove','update','emit','register','length','./whatsappMessage.events','save'];(function(_0x2b5c60,_0xddad37){var _0x40ef50=function(_0x103b03){while(--_0x103b03){_0x2b5c60['push'](_0x2b5c60['shift']());}};_0x40ef50(++_0xddad37);}(_0x45e2,0x1a9));var _0x245e=function(_0x490614,_0x33dd55){_0x490614=_0x490614-0x0;var _0x3ba320=_0x45e2[_0x490614];return _0x3ba320;};'use strict';var WhatsappMessageEvents=require(_0x245e('0x0'));var events=[_0x245e('0x1'),_0x245e('0x2'),_0x245e('0x3')];function createListener(_0x2e0051,_0x208cd6){return function(_0x28fa8c){_0x208cd6[_0x245e('0x4')](_0x2e0051,_0x28fa8c);};}function removeListener(_0xf73dd5,_0x5841e5){return function(){WhatsappMessageEvents['removeListener'](_0xf73dd5,_0x5841e5);};}exports[_0x245e('0x5')]=function(_0x397483){for(var _0x1d84d7=0x0,_0x428dab=events[_0x245e('0x6')];_0x1d84d7<_0x428dab;_0x1d84d7++){var _0x10d708=events[_0x1d84d7];var _0x3bdc7d=createListener('whatsappMessage:'+_0x10d708,_0x397483);WhatsappMessageEvents['on'](_0x10d708,_0x3bdc7d);}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/index.js b/server/api/whatsappQueue/index.js index 4f4492b..a0bf4e3 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 _0x5007=['update','delete','destroy','removeTeams','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappQueue.controller','get','isAuthenticated','index','/describe','describe','show','/:id/members','getMembers','getTeams','/:id/users','getAgents','post','create','/:id/teams','addTeams','put','/:id'];(function(_0x3f0847,_0x537690){var _0x7b8340=function(_0x44ff34){while(--_0x44ff34){_0x3f0847['push'](_0x3f0847['shift']());}};_0x7b8340(++_0x537690);}(_0x5007,0xe5));var _0x7500=function(_0x314dfd,_0x38da0b){_0x314dfd=_0x314dfd-0x0;var _0x344d04=_0x5007[_0x314dfd];return _0x344d04;};'use strict';var multer=require(_0x7500('0x0'));var util=require(_0x7500('0x1'));var path=require(_0x7500('0x2'));var timeout=require(_0x7500('0x3'));var express=require(_0x7500('0x4'));var router=express['Router']();var fs_extra=require(_0x7500('0x5'));var auth=require(_0x7500('0x6'));var interaction=require(_0x7500('0x7'));var config=require(_0x7500('0x8'));var controller=require(_0x7500('0x9'));router[_0x7500('0xa')]('/',auth[_0x7500('0xb')](),controller[_0x7500('0xc')]);router[_0x7500('0xa')](_0x7500('0xd'),auth[_0x7500('0xb')](),controller[_0x7500('0xe')]);router[_0x7500('0xa')]('/:id',auth[_0x7500('0xb')](),controller[_0x7500('0xf')]);router['get'](_0x7500('0x10'),auth[_0x7500('0xb')](),controller[_0x7500('0x11')]);router[_0x7500('0xa')]('/:id/teams',auth[_0x7500('0xb')](),controller[_0x7500('0x12')]);router['get'](_0x7500('0x13'),auth[_0x7500('0xb')](),controller[_0x7500('0x14')]);router[_0x7500('0x15')]('/',auth[_0x7500('0xb')](),controller[_0x7500('0x16')]);router[_0x7500('0x15')](_0x7500('0x17'),auth[_0x7500('0xb')](),controller[_0x7500('0x18')]);router[_0x7500('0x15')](_0x7500('0x13'),auth[_0x7500('0xb')](),controller['addAgents']);router[_0x7500('0x19')](_0x7500('0x1a'),auth[_0x7500('0xb')](),controller[_0x7500('0x1b')]);router[_0x7500('0x1c')](_0x7500('0x1a'),auth[_0x7500('0xb')](),controller[_0x7500('0x1d')]);router[_0x7500('0x1c')](_0x7500('0x17'),auth['isAuthenticated'](),controller[_0x7500('0x1e')]);router[_0x7500('0x1c')](_0x7500('0x13'),auth[_0x7500('0xb')](),controller['removeAgents']);module[_0x7500('0x1f')]=router; \ No newline at end of file +var _0x3d1a=['/:id/users','getAgents','post','addTeams','addAgents','put','update','delete','destroy','removeTeams','removeAgents','exports','multer','path','connect-timeout','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','/:id/members','/:id/teams'];(function(_0x20f181,_0x210422){var _0x1ca20a=function(_0x50c94b){while(--_0x50c94b){_0x20f181['push'](_0x20f181['shift']());}};_0x1ca20a(++_0x210422);}(_0x3d1a,0x1ec));var _0xa3d1=function(_0x37ba88,_0x3ce576){_0x37ba88=_0x37ba88-0x0;var _0x356382=_0x3d1a[_0x37ba88];return _0x356382;};'use strict';var multer=require(_0xa3d1('0x0'));var util=require('util');var path=require(_0xa3d1('0x1'));var timeout=require(_0xa3d1('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xa3d1('0x3'));var controller=require('./whatsappQueue.controller');router[_0xa3d1('0x4')]('/',auth[_0xa3d1('0x5')](),controller[_0xa3d1('0x6')]);router[_0xa3d1('0x4')](_0xa3d1('0x7'),auth[_0xa3d1('0x5')](),controller[_0xa3d1('0x8')]);router['get'](_0xa3d1('0x9'),auth['isAuthenticated'](),controller['show']);router[_0xa3d1('0x4')](_0xa3d1('0xa'),auth[_0xa3d1('0x5')](),controller['getMembers']);router[_0xa3d1('0x4')](_0xa3d1('0xb'),auth[_0xa3d1('0x5')](),controller['getTeams']);router[_0xa3d1('0x4')](_0xa3d1('0xc'),auth['isAuthenticated'](),controller[_0xa3d1('0xd')]);router[_0xa3d1('0xe')]('/',auth[_0xa3d1('0x5')](),controller['create']);router[_0xa3d1('0xe')](_0xa3d1('0xb'),auth[_0xa3d1('0x5')](),controller[_0xa3d1('0xf')]);router[_0xa3d1('0xe')](_0xa3d1('0xc'),auth[_0xa3d1('0x5')](),controller[_0xa3d1('0x10')]);router[_0xa3d1('0x11')](_0xa3d1('0x9'),auth[_0xa3d1('0x5')](),controller[_0xa3d1('0x12')]);router[_0xa3d1('0x13')](_0xa3d1('0x9'),auth[_0xa3d1('0x5')](),controller[_0xa3d1('0x14')]);router[_0xa3d1('0x13')](_0xa3d1('0xb'),auth[_0xa3d1('0x5')](),controller[_0xa3d1('0x15')]);router[_0xa3d1('0x13')](_0xa3d1('0xc'),auth[_0xa3d1('0x5')](),controller[_0xa3d1('0x16')]);module[_0xa3d1('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 c833b15..4243278 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 _0xb9a7=['ENUM','beepall','roundrobin','STRING','exports'];(function(_0xf1a1e9,_0x424d15){var _0x56c744=function(_0x256a05){while(--_0x256a05){_0xf1a1e9['push'](_0xf1a1e9['shift']());}};_0x56c744(++_0x424d15);}(_0xb9a7,0x112));var _0x7b9a=function(_0x4792c8,_0x5158a1){_0x4792c8=_0x4792c8-0x0;var _0x35edb1=_0xb9a7[_0x4792c8];return _0x35edb1;};'use strict';var Sequelize=require('sequelize');module[_0x7b9a('0x0')]={'name':{'type':Sequelize['STRING'],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x7b9a('0x1')]('rrmemory',_0x7b9a('0x2'),_0x7b9a('0x3'))},'description':{'type':Sequelize[_0x7b9a('0x4')]}}; \ No newline at end of file +var _0x6584=['rrmemory','beepall','sequelize','exports','STRING','name','ENUM'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6584,0x175));var _0x4658=function(_0x58965a,_0x2e71db){_0x58965a=_0x58965a-0x0;var _0x254efc=_0x6584[_0x58965a];return _0x254efc;};'use strict';var Sequelize=require(_0x4658('0x0'));module[_0x4658('0x1')]={'name':{'type':Sequelize[_0x4658('0x2')],'unique':_0x4658('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x4658('0x4')](_0x4658('0x5'),_0x4658('0x6'),'roundrobin')},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.controller.js b/server/api/whatsappQueue/whatsappQueue.controller.js index 46e150d..bc673d6 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 _0xa35f=['set','Content-Range','json','update','then','get','WhatsappQueues','UserProfileResource','destroy','error','stack','send','map','WhatsappQueue','rawAttributes','fieldName','include','query','findAll','rows','catch','show','params','model','keys','intersection','attributes','fields','length','includeAll','merge','options','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','name','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','getMembers','findOne','filters','hasOwnProperty','nolimit','sort','where','WhatsappQueueId','filter','UserWhatsappQueue','User','findAndCountAll','agent','whatsappPause','createdAt','format','%s/%s','SIP','updatedAt','getTeams','Team','order','pick','ids','online','voicePause','interface','flatMap','transaction','findOrCreate','forEach','emit','userWhatsappQueue:save','removeTeams','select','from','team_has_whatsapp_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','WhatsappQueueId\x20=\x20?','Agents','sequelize','SELECT','every','TeamId','all','union','compact','value','isEmpty','removeAgents','userWhatsappQueue:remove','addAgents','omit','spread','isArray','getAgents','bluebird','squel','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','sendStatus','status','end','offset','limit','undefined','count'];(function(_0x42ad6b,_0x39a94){var _0x442838=function(_0x4dc38c){while(--_0x4dc38c){_0x42ad6b['push'](_0x42ad6b['shift']());}};_0x442838(++_0x39a94);}(_0xa35f,0x66));var _0xfa35=function(_0x17c8cc,_0x5e5647){_0x17c8cc=_0x17c8cc-0x0;var _0x3db4eb=_0xa35f[_0x17c8cc];return _0x3db4eb;};'use strict';var BPromise=require(_0xfa35('0x0'));var util=require('util');var _=require('lodash');var squel=require(_0xfa35('0x1'));var Redis=require(_0xfa35('0x2'));var qs=require(_0xfa35('0x3'));var logger=require(_0xfa35('0x4'))(_0xfa35('0x5'));var config=require(_0xfa35('0x6'));var db=require(_0xfa35('0x7'))['db'];config[_0xfa35('0x8')]=_[_0xfa35('0x9')](config['redis'],{'host':_0xfa35('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xfa35('0x8')]));require('./whatsappQueue.socket')['register'](socket);function respondWithStatusCode(_0x162105,_0x5efc21){_0x5efc21=_0x5efc21||0xcc;return function(_0x26eed7){if(_0x26eed7){return _0x162105[_0xfa35('0xb')](_0x5efc21);}return _0x162105[_0xfa35('0xc')](_0x5efc21)[_0xfa35('0xd')]();};}function respondWithResult(_0x554738,_0xe13faf){_0xe13faf=_0xe13faf||0xc8;return function(_0x5207e7){if(_0x5207e7){return _0x554738[_0xfa35('0xc')](_0xe13faf)['json'](_0x5207e7);}};}function respondWithFilteredResult(_0x199c59,_0x303cfb){return function(_0x514c55){if(_0x514c55){var _0x244b9d=typeof _0x303cfb[_0xfa35('0xe')]==='undefined'&&typeof _0x303cfb[_0xfa35('0xf')]===_0xfa35('0x10');var _0x392ec2=_0x514c55[_0xfa35('0x11')];var _0x26ccbb=_0x244b9d?0x0:_0x303cfb[_0xfa35('0xe')];var _0x1d2fb3=_0x244b9d?_0x514c55['count']:_0x303cfb[_0xfa35('0xe')]+_0x303cfb[_0xfa35('0xf')];var _0x328d89;if(_0x1d2fb3>=_0x392ec2){_0x1d2fb3=_0x392ec2;_0x328d89=0xc8;}else{_0x328d89=0xce;}_0x199c59[_0xfa35('0xc')](_0x328d89);return _0x199c59[_0xfa35('0x12')](_0xfa35('0x13'),_0x26ccbb+'-'+_0x1d2fb3+'/'+_0x392ec2)[_0xfa35('0x14')](_0x514c55);}return null;};}function saveUpdates(_0x4eca13){return function(_0x441e92){if(_0x441e92){return _0x441e92[_0xfa35('0x15')](_0x4eca13)['then'](function(_0x19823e){return _0x19823e;});}return null;};}function removeEntity(_0x40ae81){return function(_0x3ab133){if(_0x3ab133){return _0x3ab133['destroy']()[_0xfa35('0x16')](function(){var _0x46548e=_0x3ab133[_0xfa35('0x17')]({'plain':!![]});var _0x2996f6=_0xfa35('0x18');return db[_0xfa35('0x19')][_0xfa35('0x1a')]({'where':{'type':_0x2996f6,'resourceId':_0x46548e['id']}})[_0xfa35('0x16')](function(){return _0x3ab133;});})[_0xfa35('0x16')](function(){_0x40ae81['status'](0xcc)[_0xfa35('0xd')]();});}};}function handleEntityNotFound(_0x5e2a0b){return function(_0x4fe837){if(!_0x4fe837){_0x5e2a0b[_0xfa35('0xb')](0x194);}return _0x4fe837;};}function handleError(_0x345eb5,_0xbd273e){_0xbd273e=_0xbd273e||0x1f4;return function(_0x1f03e1){logger[_0xfa35('0x1b')](_0x1f03e1[_0xfa35('0x1c')]);if(_0x1f03e1['name']){delete _0x1f03e1['name'];}_0x345eb5[_0xfa35('0xc')](_0xbd273e)[_0xfa35('0x1d')](_0x1f03e1);};}exports['index']=function(_0x316ae3,_0xe662f9){var _0x304288={};var _0x5bef33={'count':0x0,'rows':[]};var _0x239e63=_[_0xfa35('0x1e')](db[_0xfa35('0x1f')][_0xfa35('0x20')],function(_0x137805){return{'name':_0x137805[_0xfa35('0x21')],'type':_0x137805['type']['key']};});_0x304288=qs['getOptions'](_0x239e63,_0x316ae3);var _0x24525c={'where':_0x304288['where']};return db[_0xfa35('0x1f')]['count'](_0x24525c)[_0xfa35('0x16')](function(_0x3c93a9){_0x5bef33[_0xfa35('0x11')]=_0x3c93a9;_0x304288[_0xfa35('0x22')]=qs[_0xfa35('0x22')](_0x316ae3[_0xfa35('0x23')]);return db[_0xfa35('0x1f')][_0xfa35('0x24')](_0x304288);})['then'](function(_0xfb696){_0x5bef33[_0xfa35('0x25')]=_0xfb696;return _0x5bef33;})[_0xfa35('0x16')](respondWithFilteredResult(_0xe662f9,_0x304288))[_0xfa35('0x26')](handleError(_0xe662f9,null));};exports[_0xfa35('0x27')]=function(_0x8c1fb8,_0x931e1d){var _0x3f1b66={'raw':!![],'where':{'id':_0x8c1fb8[_0xfa35('0x28')]['id']}},_0x13b040={};_0x13b040[_0xfa35('0x29')]=_[_0xfa35('0x2a')](db[_0xfa35('0x1f')]['rawAttributes']);_0x13b040[_0xfa35('0x23')]=_[_0xfa35('0x2a')](_0x8c1fb8[_0xfa35('0x23')]);_0x13b040['filters']=_[_0xfa35('0x2b')](_0x13b040[_0xfa35('0x29')],_0x13b040[_0xfa35('0x23')]);_0x3f1b66[_0xfa35('0x2c')]=_[_0xfa35('0x2b')](_0x13b040[_0xfa35('0x29')],qs['fields'](_0x8c1fb8['query'][_0xfa35('0x2d')]));_0x3f1b66[_0xfa35('0x2c')]=_0x3f1b66[_0xfa35('0x2c')][_0xfa35('0x2e')]?_0x3f1b66['attributes']:_0x13b040['model'];if(_0x8c1fb8['query'][_0xfa35('0x2f')]){_0x3f1b66[_0xfa35('0x22')]=[{'all':!![]}];}_0x3f1b66=_[_0xfa35('0x30')]({},_0x3f1b66,_0x8c1fb8[_0xfa35('0x31')]);return db[_0xfa35('0x1f')][_0xfa35('0x32')](_0x3f1b66)['then'](handleEntityNotFound(_0x931e1d,null))[_0xfa35('0x16')](respondWithResult(_0x931e1d,null))[_0xfa35('0x26')](handleError(_0x931e1d,null));};exports[_0xfa35('0x33')]=function(_0x20ff47,_0x20e06b){return db['WhatsappQueue'][_0xfa35('0x33')](_0x20ff47['body'],{})[_0xfa35('0x16')](function(_0x4a03b1){var _0x5ca6e9=_0x20ff47[_0xfa35('0x34')]['get']({'plain':!![]});if(!_0x5ca6e9)throw new Error(_0xfa35('0x35'));if(_0x5ca6e9[_0xfa35('0x36')]===_0xfa35('0x34')){var _0x59ca04=_0x4a03b1[_0xfa35('0x17')]({'plain':!![]});var _0x39e5c8=_0xfa35('0x18');return db[_0xfa35('0x37')][_0xfa35('0x32')]({'where':{'name':_0x39e5c8,'userProfileId':_0x5ca6e9[_0xfa35('0x38')]},'raw':!![]})[_0xfa35('0x16')](function(_0x1c409d){if(_0x1c409d&&_0x1c409d[_0xfa35('0x39')]===0x0){return db[_0xfa35('0x19')][_0xfa35('0x33')]({'name':_0x59ca04['name'],'resourceId':_0x59ca04['id'],'type':_0x1c409d[_0xfa35('0x3a')],'sectionId':_0x1c409d['id']},{})[_0xfa35('0x16')](function(){return _0x4a03b1;});}else{return _0x4a03b1;}})[_0xfa35('0x26')](function(_0x588a99){logger[_0xfa35('0x1b')](_0xfa35('0x3b'),_0x588a99);throw _0x588a99;});}return _0x4a03b1;})[_0xfa35('0x16')](respondWithResult(_0x20e06b,0xc9))[_0xfa35('0x26')](handleError(_0x20e06b,null));};exports[_0xfa35('0x15')]=function(_0x40a9ec,_0x4d0ae1){if(_0x40a9ec[_0xfa35('0x3c')]['id']){delete _0x40a9ec[_0xfa35('0x3c')]['id'];}return db[_0xfa35('0x1f')][_0xfa35('0x32')]({'where':{'id':_0x40a9ec[_0xfa35('0x28')]['id']}})['then'](handleEntityNotFound(_0x4d0ae1,null))[_0xfa35('0x16')](saveUpdates(_0x40a9ec[_0xfa35('0x3c')],null))[_0xfa35('0x16')](respondWithResult(_0x4d0ae1,null))[_0xfa35('0x26')](handleError(_0x4d0ae1,null));};exports[_0xfa35('0x1a')]=function(_0x545b48,_0x58ab7c){return db[_0xfa35('0x1f')][_0xfa35('0x32')]({'where':{'id':_0x545b48[_0xfa35('0x28')]['id']}})[_0xfa35('0x16')](handleEntityNotFound(_0x58ab7c,null))['then'](removeEntity(_0x58ab7c,null))[_0xfa35('0x26')](handleError(_0x58ab7c,null));};exports[_0xfa35('0x3d')]=function(_0x548e51,_0x3a7737){return db['WhatsappQueue'][_0xfa35('0x3d')]()[_0xfa35('0x16')](respondWithResult(_0x3a7737,null))[_0xfa35('0x26')](handleError(_0x3a7737,null));};exports[_0xfa35('0x3e')]=function(_0x5a2df2,_0x236aed){var _0xf1ebc4={'raw':!![],'where':{}},_0x340611={},_0x58cf20;return db[_0xfa35('0x1f')][_0xfa35('0x3f')]({'where':{'id':_0x5a2df2[_0xfa35('0x28')]['id']}})[_0xfa35('0x16')](handleEntityNotFound(_0x236aed,null))[_0xfa35('0x16')](function(_0x25a7e5){if(_0x25a7e5){_0x58cf20=_0x25a7e5[_0xfa35('0x17')]({'plain':!![]});_0x340611[_0xfa35('0x29')]=_[_0xfa35('0x2a')](db['UserWhatsappQueue'][_0xfa35('0x20')]);_0x340611['query']=_[_0xfa35('0x2a')](_0x5a2df2['query']);_0x340611[_0xfa35('0x40')]=_[_0xfa35('0x2b')](_0x340611['model'],_0x340611[_0xfa35('0x23')]);_0xf1ebc4[_0xfa35('0x2c')]=_[_0xfa35('0x2b')](_0x340611[_0xfa35('0x29')],qs[_0xfa35('0x2d')](_0x5a2df2[_0xfa35('0x23')][_0xfa35('0x2d')]));_0xf1ebc4[_0xfa35('0x2c')]=_0xf1ebc4[_0xfa35('0x2c')]['length']?_0xf1ebc4[_0xfa35('0x2c')]:_0x340611[_0xfa35('0x29')];if(!_0x5a2df2[_0xfa35('0x23')][_0xfa35('0x41')](_0xfa35('0x42'))){_0xf1ebc4[_0xfa35('0xf')]=qs[_0xfa35('0xf')](_0x5a2df2[_0xfa35('0x23')][_0xfa35('0xf')]);_0xf1ebc4[_0xfa35('0xe')]=qs['offset'](_0x5a2df2[_0xfa35('0x23')][_0xfa35('0xe')]);}_0xf1ebc4['order']=qs['sort'](_0x5a2df2[_0xfa35('0x23')][_0xfa35('0x43')]);_0xf1ebc4[_0xfa35('0x44')]=qs[_0xfa35('0x40')](_['pick'](_0x5a2df2['query'],_0x340611[_0xfa35('0x40')]));_0xf1ebc4[_0xfa35('0x44')][_0xfa35('0x45')]=_0x25a7e5['id'];if(_0x5a2df2[_0xfa35('0x23')][_0xfa35('0x46')]){_0xf1ebc4[_0xfa35('0x44')]=_[_0xfa35('0x30')](_0xf1ebc4[_0xfa35('0x44')],{'$or':_['map'](_0xf1ebc4[_0xfa35('0x2c')],function(_0x4892ec){var _0x1037bc={};_0x1037bc[_0x4892ec]={'$like':'%'+_0x5a2df2['query'][_0xfa35('0x46')]+'%'};return _0x1037bc;})});}_0xf1ebc4=_[_0xfa35('0x30')]({},_0xf1ebc4,_0x5a2df2[_0xfa35('0x31')]);return db[_0xfa35('0x47')][_0xfa35('0x24')](_0xf1ebc4);}})[_0xfa35('0x16')](function(_0x2db765){if(_0x2db765){return db[_0xfa35('0x48')][_0xfa35('0x49')]({'where':{'id':_[_0xfa35('0x1e')](_0x2db765,'UserId'),'role':_0xfa35('0x4a')},'attributes':['id',_0xfa35('0x3a'),_0xfa35('0x4b'),'updatedAt',_0xfa35('0x4c')]});}})[_0xfa35('0x16')](function(_0x3cf3da){if(_0x3cf3da){return{'count':_0x3cf3da['count'],'rows':_[_0xfa35('0x1e')](_0x3cf3da[_0xfa35('0x25')],function(_0x42a443){return{'membername':_0x42a443[_0xfa35('0x3a')],'UserId':_0x42a443['id'],'queue_name':_0x58cf20[_0xfa35('0x3a')],'WhatsappQueueId':_0x58cf20['id'],'interface':util[_0xfa35('0x4d')](_0xfa35('0x4e'),_0xfa35('0x4f'),_0x42a443[_0xfa35('0x3a')]),'penalty':0x0,'paused':_0x42a443[_0xfa35('0x4b')],'createdAt':_0x42a443[_0xfa35('0x4c')],'updatedAt':_0x42a443[_0xfa35('0x50')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xfa35('0x16')](respondWithFilteredResult(_0x236aed,_0xf1ebc4))[_0xfa35('0x26')](handleError(_0x236aed,null));};exports[_0xfa35('0x51')]=function(_0x5b1aed,_0x22a286){var _0x200370={};var _0x34d1ad={};var _0x4e8350;var _0x429da9;return db[_0xfa35('0x1f')]['findOne']({'where':{'id':_0x5b1aed[_0xfa35('0x28')]['id']}})[_0xfa35('0x16')](handleEntityNotFound(_0x22a286,null))['then'](function(_0x17713d){if(_0x17713d){_0x4e8350=_0x17713d;_0x34d1ad['model']=_['keys'](db[_0xfa35('0x52')][_0xfa35('0x20')]);_0x34d1ad[_0xfa35('0x23')]=_[_0xfa35('0x2a')](_0x5b1aed[_0xfa35('0x23')]);_0x34d1ad[_0xfa35('0x40')]=_['intersection'](_0x34d1ad[_0xfa35('0x29')],_0x34d1ad['query']);_0x200370['attributes']=_[_0xfa35('0x2b')](_0x34d1ad[_0xfa35('0x29')],qs[_0xfa35('0x2d')](_0x5b1aed[_0xfa35('0x23')][_0xfa35('0x2d')]));_0x200370[_0xfa35('0x2c')]=_0x200370[_0xfa35('0x2c')]['length']?_0x200370[_0xfa35('0x2c')]:_0x34d1ad[_0xfa35('0x29')];_0x200370[_0xfa35('0x53')]=qs[_0xfa35('0x43')](_0x5b1aed[_0xfa35('0x23')][_0xfa35('0x43')]);_0x200370[_0xfa35('0x44')]=qs[_0xfa35('0x40')](_[_0xfa35('0x54')](_0x5b1aed['query'],_0x34d1ad['filters']));if(_0x5b1aed[_0xfa35('0x23')]['filter']){_0x200370[_0xfa35('0x44')]=_['merge'](_0x200370[_0xfa35('0x44')],{'$or':_['map'](_0x200370[_0xfa35('0x2c')],function(_0x5c3248){var _0x50909d={};_0x50909d[_0x5c3248]={'$like':'%'+_0x5b1aed[_0xfa35('0x23')][_0xfa35('0x46')]+'%'};return _0x50909d;})});}_0x200370=_['merge']({},_0x200370,_0x5b1aed['options']);return _0x4e8350[_0xfa35('0x51')](_0x200370);}})[_0xfa35('0x16')](function(_0x43a501){if(_0x43a501){_0x429da9=_0x43a501[_0xfa35('0x2e')];if(!_0x5b1aed[_0xfa35('0x23')][_0xfa35('0x41')]('nolimit')){_0x200370[_0xfa35('0xf')]=qs[_0xfa35('0xf')](_0x5b1aed[_0xfa35('0x23')][_0xfa35('0xf')]);_0x200370['offset']=qs[_0xfa35('0xe')](_0x5b1aed[_0xfa35('0x23')][_0xfa35('0xe')]);}return _0x4e8350[_0xfa35('0x51')](_0x200370);}})[_0xfa35('0x16')](function(_0x512904){if(_0x512904){return _0x512904?{'count':_0x429da9,'rows':_0x512904}:null;}})[_0xfa35('0x16')](respondWithResult(_0x22a286,null))[_0xfa35('0x26')](handleError(_0x22a286,null));};exports['addTeams']=function(_0x5e0e46,_0x202a50){var _0x201e2a=_0x5e0e46[_0xfa35('0x3c')][_0xfa35('0x55')];return db[_0xfa35('0x52')][_0xfa35('0x24')]({'where':{'id':_0x201e2a},'attributes':['id'],'include':[{'model':db[_0xfa35('0x48')],'as':'Agents','attributes':['id','name',_0xfa35('0x56'),_0xfa35('0x57'),_0xfa35('0x58')],'raw':!![]}]})[_0xfa35('0x16')](function(_0x34ec2d){if(_0x34ec2d){var _0x15c127=_[_0xfa35('0x59')](_0x34ec2d,function(_0x2ee679){var _0x23ef3f=_0x2ee679[_0xfa35('0x17')]({'plain':!![]});return _0x23ef3f['Agents'];});return db[_0xfa35('0x1f')][_0xfa35('0x32')]({'where':{'id':_0x5e0e46[_0xfa35('0x28')]['id']}})['then'](function(_0x436f11){return db['sequelize'][_0xfa35('0x5a')](function(_0x4cc85d){return _0x436f11['addTeams'](_0x201e2a,{'transaction':_0x4cc85d})[_0xfa35('0x16')](function(){return BPromise['each'](_0x15c127,function(_0xc7009){return db[_0xfa35('0x47')][_0xfa35('0x5b')]({'where':{'UserId':_0xc7009['id'],'WhatsappQueueId':_0x5e0e46['params']['id']},'transaction':_0x4cc85d});});})[_0xfa35('0x16')](function(){_0x15c127[_0xfa35('0x5c')](function(_0x5dcbab){socket[_0xfa35('0x5d')](_0xfa35('0x5e'),{'UserId':_0x5dcbab['id'],'WhatsappQueueId':_0x436f11['id']});});});});});}})[_0xfa35('0x16')](respondWithStatusCode(_0x202a50,null))['catch'](handleError(_0x202a50,null));};exports[_0xfa35('0x5f')]=function(_0x3d9c32,_0x219f70){return db['Team']['findAll']({'where':{'id':_0x3d9c32['query'][_0xfa35('0x55')]},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0xfa35('0x16')](handleEntityNotFound(_0x219f70,null))[_0xfa35('0x16')](function(_0x457d68){var _0x15dd7a=_[_0xfa35('0x1e')](_0x457d68,'id');var _0x160a5c=[];var _0xed37f0=[];var _0x409333=squel[_0xfa35('0x60')]();_0x409333['field']('tq.TeamId')[_0xfa35('0x61')](_0xfa35('0x62'),'tq')[_0xfa35('0x63')](_0xfa35('0x64'),'ut',_0xfa35('0x65'))[_0xfa35('0x44')](_0xfa35('0x66'),_0x3d9c32[_0xfa35('0x28')]['id']);for(var _0x1754ba=0x0;_0x1754ba<_0x457d68[_0xfa35('0x2e')];_0x1754ba+=0x1){let _0x35eecb=_0x457d68[_0x1754ba];for(var _0xea93ab=0x0;_0xea93ab<_0x35eecb[_0xfa35('0x67')][_0xfa35('0x2e')];_0xea93ab+=0x1){let _0x2af60a=_0x35eecb[_0xfa35('0x67')][_0xea93ab];var _0x2ad570=_0x409333['clone']();_0x2ad570['where']('ut.UserId\x20=\x20?',_0x2af60a['id']);_0xed37f0['push'](db[_0xfa35('0x68')][_0xfa35('0x23')](_0x2ad570['toString'](),{'type':db[_0xfa35('0x68')]['QueryTypes'][_0xfa35('0x69')]})[_0xfa35('0x16')](function(_0x566427){if(_0x566427[_0xfa35('0x2e')]===0x1){return _0x2af60a['id'];}else{var _0x36c7a1=_[_0xfa35('0x6a')](_[_0xfa35('0x1e')](_0x566427,_0xfa35('0x6b')),function(_0x4680fe){return _['includes'](_0x15dd7a,_0x4680fe);});if(_0x36c7a1){return _0x2af60a['id'];}}}));}}return BPromise[_0xfa35('0x6c')](_0xed37f0)['then'](function(_0x2d980f){_0x160a5c=_(_0x160a5c)[_0xfa35('0x6d')](_0x2d980f)[_0xfa35('0x6e')]()[_0xfa35('0x6f')]();return db[_0xfa35('0x1f')][_0xfa35('0x32')]({'where':{'id':_0x3d9c32[_0xfa35('0x28')]['id']}})[_0xfa35('0x16')](function(_0x3dee55){return db[_0xfa35('0x68')][_0xfa35('0x5a')](function(_0x1cd3b3){return _0x3dee55[_0xfa35('0x5f')](_0x3d9c32[_0xfa35('0x23')][_0xfa35('0x55')],{'transaction':_0x1cd3b3})[_0xfa35('0x16')](function(){if(!_[_0xfa35('0x70')](_0x160a5c)){return _0x3dee55[_0xfa35('0x71')](_0x160a5c,{'transaction':_0x1cd3b3});}})[_0xfa35('0x16')](function(){_0x160a5c[_0xfa35('0x5c')](function(_0x378978){socket['emit'](_0xfa35('0x72'),{'UserId':_0x378978,'WhatsappQueueId':_0x3dee55['id']});});});});});});})[_0xfa35('0x16')](respondWithStatusCode(_0x219f70,null))[_0xfa35('0x26')](handleError(_0x219f70,null));};exports[_0xfa35('0x73')]=function(_0x36724f,_0x95f4c3){return db[_0xfa35('0x1f')][_0xfa35('0x32')]({'where':{'id':_0x36724f[_0xfa35('0x28')]['id']}})[_0xfa35('0x16')](handleEntityNotFound(_0x95f4c3,null))[_0xfa35('0x16')](function(_0x106304){if(_0x106304){return _0x106304[_0xfa35('0x73')](_0x36724f[_0xfa35('0x3c')][_0xfa35('0x55')],_[_0xfa35('0x74')](_0x36724f[_0xfa35('0x3c')],[_0xfa35('0x55'),'id'])||{})[_0xfa35('0x75')](function(_0x13eb69){for(var _0x33090b=0x0;_0x33090b<_0x36724f[_0xfa35('0x3c')][_0xfa35('0x55')][_0xfa35('0x2e')];_0x33090b+=0x1){socket[_0xfa35('0x5d')]('userWhatsappQueue:save',{'UserId':Number(_0x36724f[_0xfa35('0x3c')][_0xfa35('0x55')][_0x33090b]),'WhatsappQueueId':Number(_0x36724f[_0xfa35('0x28')]['id'])});}return _0x13eb69;});}})[_0xfa35('0x16')](respondWithResult(_0x95f4c3,null))[_0xfa35('0x26')](handleError(_0x95f4c3,null));};exports[_0xfa35('0x71')]=function(_0x28a172,_0x3b7316){return db['WhatsappQueue'][_0xfa35('0x32')]({'where':{'id':_0x28a172[_0xfa35('0x28')]['id']}})['then'](handleEntityNotFound(_0x3b7316,null))['then'](function(_0x153a87){if(_0x153a87){return _0x153a87[_0xfa35('0x71')](_0x28a172[_0xfa35('0x23')]['ids'])[_0xfa35('0x16')](function(){if(_[_0xfa35('0x76')](_0x28a172[_0xfa35('0x23')][_0xfa35('0x55')])){for(var _0x1ddc32=0x0;_0x1ddc32<_0x28a172['query'][_0xfa35('0x55')][_0xfa35('0x2e')];_0x1ddc32+=0x1){socket['emit'](_0xfa35('0x72'),{'UserId':Number(_0x28a172[_0xfa35('0x23')][_0xfa35('0x55')][_0x1ddc32]),'WhatsappQueueId':Number(_0x28a172[_0xfa35('0x28')]['id'])});}}else{socket[_0xfa35('0x5d')]('userWhatsappQueue:remove',{'UserId':Number(_0x28a172[_0xfa35('0x23')][_0xfa35('0x55')]),'WhatsappQueueId':Number(_0x28a172[_0xfa35('0x28')]['id'])});}});}})[_0xfa35('0x16')](respondWithStatusCode(_0x3b7316,null))[_0xfa35('0x26')](handleError(_0x3b7316,null));};exports[_0xfa35('0x77')]=function(_0x7d5aeb,_0x3a2d97){var _0x316ca1={};var _0x17586c={};var _0x308c46;var _0xb69d4c;return db['WhatsappQueue'][_0xfa35('0x3f')]({'where':{'id':_0x7d5aeb[_0xfa35('0x28')]['id']}})[_0xfa35('0x16')](handleEntityNotFound(_0x3a2d97,null))[_0xfa35('0x16')](function(_0x80e6c0){if(_0x80e6c0){_0x308c46=_0x80e6c0;_0x17586c[_0xfa35('0x29')]=_[_0xfa35('0x2a')](db[_0xfa35('0x48')][_0xfa35('0x20')]);_0x17586c['query']=_[_0xfa35('0x2a')](_0x7d5aeb[_0xfa35('0x23')]);_0x17586c[_0xfa35('0x40')]=_[_0xfa35('0x2b')](_0x17586c[_0xfa35('0x29')],_0x17586c[_0xfa35('0x23')]);_0x316ca1['attributes']=_[_0xfa35('0x2b')](_0x17586c[_0xfa35('0x29')],qs[_0xfa35('0x2d')](_0x7d5aeb['query'][_0xfa35('0x2d')]));_0x316ca1[_0xfa35('0x2c')]=_0x316ca1['attributes'][_0xfa35('0x2e')]?_0x316ca1[_0xfa35('0x2c')]:_0x17586c[_0xfa35('0x29')];_0x316ca1['order']=qs['sort'](_0x7d5aeb[_0xfa35('0x23')]['sort']);_0x316ca1['where']=qs[_0xfa35('0x40')](_[_0xfa35('0x54')](_0x7d5aeb[_0xfa35('0x23')],_0x17586c[_0xfa35('0x40')]));if(_0x7d5aeb[_0xfa35('0x23')][_0xfa35('0x46')]){_0x316ca1[_0xfa35('0x44')]=_[_0xfa35('0x30')](_0x316ca1[_0xfa35('0x44')],{'$or':_[_0xfa35('0x1e')](_0x316ca1[_0xfa35('0x2c')],function(_0x540365){var _0x38c9af={};_0x38c9af[_0x540365]={'$like':'%'+_0x7d5aeb['query'][_0xfa35('0x46')]+'%'};return _0x38c9af;})});}_0x316ca1=_[_0xfa35('0x30')]({},_0x316ca1,_0x7d5aeb[_0xfa35('0x31')]);return _0x308c46['getAgents'](_0x316ca1);}})[_0xfa35('0x16')](function(_0x3fbf45){if(_0x3fbf45){_0xb69d4c=_0x3fbf45['length'];if(!_0x7d5aeb[_0xfa35('0x23')][_0xfa35('0x41')]('nolimit')){_0x316ca1[_0xfa35('0xf')]=qs[_0xfa35('0xf')](_0x7d5aeb[_0xfa35('0x23')][_0xfa35('0xf')]);_0x316ca1[_0xfa35('0xe')]=qs[_0xfa35('0xe')](_0x7d5aeb['query'][_0xfa35('0xe')]);}return _0x308c46[_0xfa35('0x77')](_0x316ca1);}})[_0xfa35('0x16')](function(_0x102d43){if(_0x102d43){return _0x102d43?{'count':_0xb69d4c,'rows':_0x102d43}:null;}})['then'](respondWithResult(_0x3a2d97,null))['catch'](handleError(_0x3a2d97,null));}; \ No newline at end of file +var _0xc57f=['pick','where','filter','User','UserId','whatsappPause','updatedAt','createdAt','%s/%s','SIP','Team','getTeams','nolimit','Agents','online','interface','flatMap','sequelize','transaction','addTeams','each','findOrCreate','forEach','emit','userWhatsappQueue:save','ids','select','tq.TeamId','from','team_has_whatsapp_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','WhatsappQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','includes','union','value','removeTeams','isEmpty','removeAgents','userWhatsappQueue:remove','addAgents','spread','isArray','getAgents','order','util','squel','ioredis','../../components/parsers/qs','../../config/environment','../../mysqldb','defaults','redis','socket.io-emitter','./whatsappQueue.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','update','then','get','WhatsappQueues','destroy','error','stack','send','map','WhatsappQueue','fieldName','type','key','getOptions','include','query','findAll','rows','catch','show','params','keys','filters','intersection','attributes','model','fields','length','merge','options','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','find','userProfileId','autoAssociation','name','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','getMembers','findOne','UserWhatsappQueue','rawAttributes','hasOwnProperty','sort'];(function(_0x38aeed,_0x34d1ca){var _0x3b0fa3=function(_0x37f684){while(--_0x37f684){_0x38aeed['push'](_0x38aeed['shift']());}};_0x3b0fa3(++_0x34d1ca);}(_0xc57f,0x1a1));var _0xfc57=function(_0x23cc28,_0x357303){_0x23cc28=_0x23cc28-0x0;var _0x31402c=_0xc57f[_0x23cc28];return _0x31402c;};'use strict';var BPromise=require('bluebird');var util=require(_0xfc57('0x0'));var _=require('lodash');var squel=require(_0xfc57('0x1'));var Redis=require(_0xfc57('0x2'));var qs=require(_0xfc57('0x3'));var logger=require('../../config/logger')('api');var config=require(_0xfc57('0x4'));var db=require(_0xfc57('0x5'))['db'];config['redis']=_[_0xfc57('0x6')](config[_0xfc57('0x7')],{'host':'localhost','port':0x18eb});var socket=require(_0xfc57('0x8'))(new Redis(config[_0xfc57('0x7')]));require(_0xfc57('0x9'))[_0xfc57('0xa')](socket);function respondWithStatusCode(_0x772d21,_0x8ae7d2){_0x8ae7d2=_0x8ae7d2||0xcc;return function(_0x2092c3){if(_0x2092c3){return _0x772d21[_0xfc57('0xb')](_0x8ae7d2);}return _0x772d21[_0xfc57('0xc')](_0x8ae7d2)[_0xfc57('0xd')]();};}function respondWithResult(_0x47b3c8,_0x516fc6){_0x516fc6=_0x516fc6||0xc8;return function(_0x4ad0c1){if(_0x4ad0c1){return _0x47b3c8[_0xfc57('0xc')](_0x516fc6)[_0xfc57('0xe')](_0x4ad0c1);}};}function respondWithFilteredResult(_0x1e0c8b,_0x4b4104){return function(_0x3284f6){if(_0x3284f6){var _0x51edbd=typeof _0x4b4104[_0xfc57('0xf')]===_0xfc57('0x10')&&typeof _0x4b4104[_0xfc57('0x11')]===_0xfc57('0x10');var _0x18b197=_0x3284f6['count'];var _0x153d2e=_0x51edbd?0x0:_0x4b4104['offset'];var _0x32151c=_0x51edbd?_0x3284f6[_0xfc57('0x12')]:_0x4b4104[_0xfc57('0xf')]+_0x4b4104[_0xfc57('0x11')];var _0x109b16;if(_0x32151c>=_0x18b197){_0x32151c=_0x18b197;_0x109b16=0xc8;}else{_0x109b16=0xce;}_0x1e0c8b[_0xfc57('0xc')](_0x109b16);return _0x1e0c8b[_0xfc57('0x13')](_0xfc57('0x14'),_0x153d2e+'-'+_0x32151c+'/'+_0x18b197)['json'](_0x3284f6);}return null;};}function saveUpdates(_0x24e5a0){return function(_0x240273){if(_0x240273){return _0x240273[_0xfc57('0x15')](_0x24e5a0)[_0xfc57('0x16')](function(_0x54a291){return _0x54a291;});}return null;};}function removeEntity(_0x2b16f2){return function(_0x2afeb9){if(_0x2afeb9){return _0x2afeb9['destroy']()[_0xfc57('0x16')](function(){var _0x5e9cbf=_0x2afeb9[_0xfc57('0x17')]({'plain':!![]});var _0x2e5c55=_0xfc57('0x18');return db['UserProfileResource'][_0xfc57('0x19')]({'where':{'type':_0x2e5c55,'resourceId':_0x5e9cbf['id']}})[_0xfc57('0x16')](function(){return _0x2afeb9;});})[_0xfc57('0x16')](function(){_0x2b16f2[_0xfc57('0xc')](0xcc)[_0xfc57('0xd')]();});}};}function handleEntityNotFound(_0x14b860){return function(_0x5399c9){if(!_0x5399c9){_0x14b860[_0xfc57('0xb')](0x194);}return _0x5399c9;};}function handleError(_0x87c423,_0x3d529c){_0x3d529c=_0x3d529c||0x1f4;return function(_0x7b3c82){logger[_0xfc57('0x1a')](_0x7b3c82[_0xfc57('0x1b')]);if(_0x7b3c82['name']){delete _0x7b3c82['name'];}_0x87c423[_0xfc57('0xc')](_0x3d529c)[_0xfc57('0x1c')](_0x7b3c82);};}exports['index']=function(_0x348d6e,_0x4c9944){var _0x46942f={};var _0x2deb93={'count':0x0,'rows':[]};var _0x108601=_[_0xfc57('0x1d')](db[_0xfc57('0x1e')]['rawAttributes'],function(_0x5c980f){return{'name':_0x5c980f[_0xfc57('0x1f')],'type':_0x5c980f[_0xfc57('0x20')][_0xfc57('0x21')]};});_0x46942f=qs[_0xfc57('0x22')](_0x108601,_0x348d6e);var _0x2404b9={'where':_0x46942f['where']};return db['WhatsappQueue'][_0xfc57('0x12')](_0x2404b9)[_0xfc57('0x16')](function(_0x44b6cf){_0x2deb93[_0xfc57('0x12')]=_0x44b6cf;_0x46942f[_0xfc57('0x23')]=qs[_0xfc57('0x23')](_0x348d6e[_0xfc57('0x24')]);return db[_0xfc57('0x1e')][_0xfc57('0x25')](_0x46942f);})[_0xfc57('0x16')](function(_0x16de9d){_0x2deb93[_0xfc57('0x26')]=_0x16de9d;return _0x2deb93;})[_0xfc57('0x16')](respondWithFilteredResult(_0x4c9944,_0x46942f))[_0xfc57('0x27')](handleError(_0x4c9944,null));};exports[_0xfc57('0x28')]=function(_0x40bc9d,_0x330fc9){var _0x5ded03={'raw':!![],'where':{'id':_0x40bc9d[_0xfc57('0x29')]['id']}},_0x26c7b1={};_0x26c7b1['model']=_['keys'](db[_0xfc57('0x1e')]['rawAttributes']);_0x26c7b1[_0xfc57('0x24')]=_[_0xfc57('0x2a')](_0x40bc9d[_0xfc57('0x24')]);_0x26c7b1[_0xfc57('0x2b')]=_[_0xfc57('0x2c')](_0x26c7b1['model'],_0x26c7b1['query']);_0x5ded03[_0xfc57('0x2d')]=_[_0xfc57('0x2c')](_0x26c7b1[_0xfc57('0x2e')],qs[_0xfc57('0x2f')](_0x40bc9d[_0xfc57('0x24')]['fields']));_0x5ded03[_0xfc57('0x2d')]=_0x5ded03[_0xfc57('0x2d')][_0xfc57('0x30')]?_0x5ded03[_0xfc57('0x2d')]:_0x26c7b1['model'];if(_0x40bc9d[_0xfc57('0x24')]['includeAll']){_0x5ded03[_0xfc57('0x23')]=[{'all':!![]}];}_0x5ded03=_[_0xfc57('0x31')]({},_0x5ded03,_0x40bc9d[_0xfc57('0x32')]);return db['WhatsappQueue']['find'](_0x5ded03)[_0xfc57('0x16')](handleEntityNotFound(_0x330fc9,null))[_0xfc57('0x16')](respondWithResult(_0x330fc9,null))['catch'](handleError(_0x330fc9,null));};exports[_0xfc57('0x33')]=function(_0x44985c,_0x4464d9){return db[_0xfc57('0x1e')]['create'](_0x44985c['body'],{})[_0xfc57('0x16')](function(_0x6c3943){var _0x34c78f=_0x44985c[_0xfc57('0x34')][_0xfc57('0x17')]({'plain':!![]});if(!_0x34c78f)throw new Error(_0xfc57('0x35'));if(_0x34c78f['role']===_0xfc57('0x34')){var _0x8a8934=_0x6c3943[_0xfc57('0x17')]({'plain':!![]});var _0x2d37ae=_0xfc57('0x18');return db['UserProfileSection'][_0xfc57('0x36')]({'where':{'name':_0x2d37ae,'userProfileId':_0x34c78f[_0xfc57('0x37')]},'raw':!![]})[_0xfc57('0x16')](function(_0x152ea8){if(_0x152ea8&&_0x152ea8[_0xfc57('0x38')]===0x0){return db['UserProfileResource'][_0xfc57('0x33')]({'name':_0x8a8934[_0xfc57('0x39')],'resourceId':_0x8a8934['id'],'type':_0x152ea8[_0xfc57('0x39')],'sectionId':_0x152ea8['id']},{})[_0xfc57('0x16')](function(){return _0x6c3943;});}else{return _0x6c3943;}})[_0xfc57('0x27')](function(_0x29139d){logger['error'](_0xfc57('0x3a'),_0x29139d);throw _0x29139d;});}return _0x6c3943;})['then'](respondWithResult(_0x4464d9,0xc9))['catch'](handleError(_0x4464d9,null));};exports['update']=function(_0x12cab5,_0xc5d842){if(_0x12cab5[_0xfc57('0x3b')]['id']){delete _0x12cab5[_0xfc57('0x3b')]['id'];}return db['WhatsappQueue'][_0xfc57('0x36')]({'where':{'id':_0x12cab5[_0xfc57('0x29')]['id']}})[_0xfc57('0x16')](handleEntityNotFound(_0xc5d842,null))[_0xfc57('0x16')](saveUpdates(_0x12cab5[_0xfc57('0x3b')],null))[_0xfc57('0x16')](respondWithResult(_0xc5d842,null))[_0xfc57('0x27')](handleError(_0xc5d842,null));};exports[_0xfc57('0x19')]=function(_0x15724d,_0x582105){return db[_0xfc57('0x1e')][_0xfc57('0x36')]({'where':{'id':_0x15724d[_0xfc57('0x29')]['id']}})[_0xfc57('0x16')](handleEntityNotFound(_0x582105,null))[_0xfc57('0x16')](removeEntity(_0x582105,null))['catch'](handleError(_0x582105,null));};exports['describe']=function(_0x3929de,_0xe0297f){return db[_0xfc57('0x1e')][_0xfc57('0x3c')]()[_0xfc57('0x16')](respondWithResult(_0xe0297f,null))[_0xfc57('0x27')](handleError(_0xe0297f,null));};exports[_0xfc57('0x3d')]=function(_0x45b5cc,_0x609447){var _0x2a0936={'raw':!![],'where':{}},_0x4db188={},_0x23f93e;return db[_0xfc57('0x1e')][_0xfc57('0x3e')]({'where':{'id':_0x45b5cc['params']['id']}})[_0xfc57('0x16')](handleEntityNotFound(_0x609447,null))[_0xfc57('0x16')](function(_0x185948){if(_0x185948){_0x23f93e=_0x185948[_0xfc57('0x17')]({'plain':!![]});_0x4db188[_0xfc57('0x2e')]=_['keys'](db[_0xfc57('0x3f')][_0xfc57('0x40')]);_0x4db188[_0xfc57('0x24')]=_[_0xfc57('0x2a')](_0x45b5cc[_0xfc57('0x24')]);_0x4db188[_0xfc57('0x2b')]=_[_0xfc57('0x2c')](_0x4db188[_0xfc57('0x2e')],_0x4db188['query']);_0x2a0936[_0xfc57('0x2d')]=_[_0xfc57('0x2c')](_0x4db188[_0xfc57('0x2e')],qs[_0xfc57('0x2f')](_0x45b5cc['query'][_0xfc57('0x2f')]));_0x2a0936[_0xfc57('0x2d')]=_0x2a0936[_0xfc57('0x2d')][_0xfc57('0x30')]?_0x2a0936['attributes']:_0x4db188['model'];if(!_0x45b5cc[_0xfc57('0x24')][_0xfc57('0x41')]('nolimit')){_0x2a0936[_0xfc57('0x11')]=qs[_0xfc57('0x11')](_0x45b5cc[_0xfc57('0x24')][_0xfc57('0x11')]);_0x2a0936[_0xfc57('0xf')]=qs[_0xfc57('0xf')](_0x45b5cc[_0xfc57('0x24')]['offset']);}_0x2a0936['order']=qs[_0xfc57('0x42')](_0x45b5cc['query'][_0xfc57('0x42')]);_0x2a0936['where']=qs[_0xfc57('0x2b')](_[_0xfc57('0x43')](_0x45b5cc[_0xfc57('0x24')],_0x4db188[_0xfc57('0x2b')]));_0x2a0936[_0xfc57('0x44')]['WhatsappQueueId']=_0x185948['id'];if(_0x45b5cc[_0xfc57('0x24')][_0xfc57('0x45')]){_0x2a0936[_0xfc57('0x44')]=_[_0xfc57('0x31')](_0x2a0936['where'],{'$or':_[_0xfc57('0x1d')](_0x2a0936[_0xfc57('0x2d')],function(_0x1b149f){var _0x8f202d={};_0x8f202d[_0x1b149f]={'$like':'%'+_0x45b5cc[_0xfc57('0x24')][_0xfc57('0x45')]+'%'};return _0x8f202d;})});}_0x2a0936=_[_0xfc57('0x31')]({},_0x2a0936,_0x45b5cc[_0xfc57('0x32')]);return db['UserWhatsappQueue'][_0xfc57('0x25')](_0x2a0936);}})[_0xfc57('0x16')](function(_0x3f7ea5){if(_0x3f7ea5){return db[_0xfc57('0x46')]['findAndCountAll']({'where':{'id':_[_0xfc57('0x1d')](_0x3f7ea5,_0xfc57('0x47')),'role':'agent'},'attributes':['id',_0xfc57('0x39'),_0xfc57('0x48'),_0xfc57('0x49'),_0xfc57('0x4a')]});}})[_0xfc57('0x16')](function(_0x14cc40){if(_0x14cc40){return{'count':_0x14cc40[_0xfc57('0x12')],'rows':_[_0xfc57('0x1d')](_0x14cc40[_0xfc57('0x26')],function(_0x4fcbbf){return{'membername':_0x4fcbbf[_0xfc57('0x39')],'UserId':_0x4fcbbf['id'],'queue_name':_0x23f93e['name'],'WhatsappQueueId':_0x23f93e['id'],'interface':util['format'](_0xfc57('0x4b'),_0xfc57('0x4c'),_0x4fcbbf[_0xfc57('0x39')]),'penalty':0x0,'paused':_0x4fcbbf[_0xfc57('0x48')],'createdAt':_0x4fcbbf[_0xfc57('0x4a')],'updatedAt':_0x4fcbbf['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x609447,_0x2a0936))[_0xfc57('0x27')](handleError(_0x609447,null));};exports['getTeams']=function(_0xcc5e26,_0x44f66a){var _0x551418={};var _0x3ace79={};var _0x10b338;var _0x47235d;return db[_0xfc57('0x1e')]['findOne']({'where':{'id':_0xcc5e26[_0xfc57('0x29')]['id']}})['then'](handleEntityNotFound(_0x44f66a,null))[_0xfc57('0x16')](function(_0x347345){if(_0x347345){_0x10b338=_0x347345;_0x3ace79[_0xfc57('0x2e')]=_[_0xfc57('0x2a')](db[_0xfc57('0x4d')][_0xfc57('0x40')]);_0x3ace79['query']=_[_0xfc57('0x2a')](_0xcc5e26['query']);_0x3ace79[_0xfc57('0x2b')]=_['intersection'](_0x3ace79[_0xfc57('0x2e')],_0x3ace79[_0xfc57('0x24')]);_0x551418[_0xfc57('0x2d')]=_[_0xfc57('0x2c')](_0x3ace79[_0xfc57('0x2e')],qs['fields'](_0xcc5e26['query']['fields']));_0x551418[_0xfc57('0x2d')]=_0x551418['attributes'][_0xfc57('0x30')]?_0x551418[_0xfc57('0x2d')]:_0x3ace79[_0xfc57('0x2e')];_0x551418['order']=qs['sort'](_0xcc5e26[_0xfc57('0x24')][_0xfc57('0x42')]);_0x551418['where']=qs[_0xfc57('0x2b')](_[_0xfc57('0x43')](_0xcc5e26[_0xfc57('0x24')],_0x3ace79['filters']));if(_0xcc5e26[_0xfc57('0x24')][_0xfc57('0x45')]){_0x551418[_0xfc57('0x44')]=_[_0xfc57('0x31')](_0x551418[_0xfc57('0x44')],{'$or':_[_0xfc57('0x1d')](_0x551418['attributes'],function(_0x3e9f85){var _0x211415={};_0x211415[_0x3e9f85]={'$like':'%'+_0xcc5e26[_0xfc57('0x24')][_0xfc57('0x45')]+'%'};return _0x211415;})});}_0x551418=_[_0xfc57('0x31')]({},_0x551418,_0xcc5e26[_0xfc57('0x32')]);return _0x10b338[_0xfc57('0x4e')](_0x551418);}})[_0xfc57('0x16')](function(_0xa8d32d){if(_0xa8d32d){_0x47235d=_0xa8d32d['length'];if(!_0xcc5e26[_0xfc57('0x24')][_0xfc57('0x41')](_0xfc57('0x4f'))){_0x551418[_0xfc57('0x11')]=qs[_0xfc57('0x11')](_0xcc5e26['query']['limit']);_0x551418[_0xfc57('0xf')]=qs[_0xfc57('0xf')](_0xcc5e26[_0xfc57('0x24')][_0xfc57('0xf')]);}return _0x10b338[_0xfc57('0x4e')](_0x551418);}})[_0xfc57('0x16')](function(_0x56f0d8){if(_0x56f0d8){return _0x56f0d8?{'count':_0x47235d,'rows':_0x56f0d8}:null;}})['then'](respondWithResult(_0x44f66a,null))[_0xfc57('0x27')](handleError(_0x44f66a,null));};exports['addTeams']=function(_0x54eba2,_0x4035f4){var _0x4cc2e9=_0x54eba2[_0xfc57('0x3b')]['ids'];return db['Team'][_0xfc57('0x25')]({'where':{'id':_0x4cc2e9},'attributes':['id'],'include':[{'model':db[_0xfc57('0x46')],'as':_0xfc57('0x50'),'attributes':['id',_0xfc57('0x39'),_0xfc57('0x51'),'voicePause',_0xfc57('0x52')],'raw':!![]}]})[_0xfc57('0x16')](function(_0x582878){if(_0x582878){var _0x59d891=_[_0xfc57('0x53')](_0x582878,function(_0x9cfaff){var _0x53812f=_0x9cfaff[_0xfc57('0x17')]({'plain':!![]});return _0x53812f['Agents'];});return db[_0xfc57('0x1e')][_0xfc57('0x36')]({'where':{'id':_0x54eba2['params']['id']}})[_0xfc57('0x16')](function(_0x3d03d9){return db[_0xfc57('0x54')][_0xfc57('0x55')](function(_0x3379c9){return _0x3d03d9[_0xfc57('0x56')](_0x4cc2e9,{'transaction':_0x3379c9})[_0xfc57('0x16')](function(){return BPromise[_0xfc57('0x57')](_0x59d891,function(_0x3fe04c){return db[_0xfc57('0x3f')][_0xfc57('0x58')]({'where':{'UserId':_0x3fe04c['id'],'WhatsappQueueId':_0x54eba2[_0xfc57('0x29')]['id']},'transaction':_0x3379c9});});})[_0xfc57('0x16')](function(){_0x59d891[_0xfc57('0x59')](function(_0x399c1c){socket[_0xfc57('0x5a')](_0xfc57('0x5b'),{'UserId':_0x399c1c['id'],'WhatsappQueueId':_0x3d03d9['id']});});});});});}})['then'](respondWithStatusCode(_0x4035f4,null))['catch'](handleError(_0x4035f4,null));};exports['removeTeams']=function(_0x53825a,_0x5a67b0){return db[_0xfc57('0x4d')]['findAll']({'where':{'id':_0x53825a[_0xfc57('0x24')][_0xfc57('0x5c')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0xfc57('0x50'),'attributes':['id'],'raw':!![]}]})[_0xfc57('0x16')](handleEntityNotFound(_0x5a67b0,null))[_0xfc57('0x16')](function(_0x3b38e3){var _0x307324=_[_0xfc57('0x1d')](_0x3b38e3,'id');var _0xc9351f=[];var _0x20f0bf=[];var _0x1fd4c0=squel[_0xfc57('0x5d')]();_0x1fd4c0['field'](_0xfc57('0x5e'))[_0xfc57('0x5f')](_0xfc57('0x60'),'tq')[_0xfc57('0x61')](_0xfc57('0x62'),'ut',_0xfc57('0x63'))[_0xfc57('0x44')](_0xfc57('0x64'),_0x53825a['params']['id']);for(var _0x5a1643=0x0;_0x5a1643<_0x3b38e3[_0xfc57('0x30')];_0x5a1643+=0x1){let _0x25c56f=_0x3b38e3[_0x5a1643];for(var _0x1b07cf=0x0;_0x1b07cf<_0x25c56f[_0xfc57('0x50')][_0xfc57('0x30')];_0x1b07cf+=0x1){let _0x9fc78f=_0x25c56f[_0xfc57('0x50')][_0x1b07cf];var _0x3fbcb8=_0x1fd4c0[_0xfc57('0x65')]();_0x3fbcb8['where'](_0xfc57('0x66'),_0x9fc78f['id']);_0x20f0bf[_0xfc57('0x67')](db[_0xfc57('0x54')][_0xfc57('0x24')](_0x3fbcb8[_0xfc57('0x68')](),{'type':db[_0xfc57('0x54')][_0xfc57('0x69')][_0xfc57('0x6a')]})[_0xfc57('0x16')](function(_0x58bada){if(_0x58bada[_0xfc57('0x30')]===0x1){return _0x9fc78f['id'];}else{var _0x1b071a=_[_0xfc57('0x6b')](_['map'](_0x58bada,_0xfc57('0x6c')),function(_0xbe904e){return _[_0xfc57('0x6d')](_0x307324,_0xbe904e);});if(_0x1b071a){return _0x9fc78f['id'];}}}));}}return BPromise['all'](_0x20f0bf)[_0xfc57('0x16')](function(_0x1c72d2){_0xc9351f=_(_0xc9351f)[_0xfc57('0x6e')](_0x1c72d2)['compact']()[_0xfc57('0x6f')]();return db[_0xfc57('0x1e')][_0xfc57('0x36')]({'where':{'id':_0x53825a['params']['id']}})[_0xfc57('0x16')](function(_0x3da590){return db[_0xfc57('0x54')][_0xfc57('0x55')](function(_0x139b33){return _0x3da590[_0xfc57('0x70')](_0x53825a[_0xfc57('0x24')][_0xfc57('0x5c')],{'transaction':_0x139b33})[_0xfc57('0x16')](function(){if(!_[_0xfc57('0x71')](_0xc9351f)){return _0x3da590[_0xfc57('0x72')](_0xc9351f,{'transaction':_0x139b33});}})[_0xfc57('0x16')](function(){_0xc9351f['forEach'](function(_0x302c24){socket[_0xfc57('0x5a')](_0xfc57('0x73'),{'UserId':_0x302c24,'WhatsappQueueId':_0x3da590['id']});});});});});});})[_0xfc57('0x16')](respondWithStatusCode(_0x5a67b0,null))['catch'](handleError(_0x5a67b0,null));};exports[_0xfc57('0x74')]=function(_0x366a3e,_0xbd191d){return db[_0xfc57('0x1e')][_0xfc57('0x36')]({'where':{'id':_0x366a3e[_0xfc57('0x29')]['id']}})[_0xfc57('0x16')](handleEntityNotFound(_0xbd191d,null))[_0xfc57('0x16')](function(_0x341abe){if(_0x341abe){return _0x341abe[_0xfc57('0x74')](_0x366a3e[_0xfc57('0x3b')][_0xfc57('0x5c')],_['omit'](_0x366a3e[_0xfc57('0x3b')],['ids','id'])||{})[_0xfc57('0x75')](function(_0x3ac060){for(var _0x1a27df=0x0;_0x1a27df<_0x366a3e[_0xfc57('0x3b')][_0xfc57('0x5c')][_0xfc57('0x30')];_0x1a27df+=0x1){socket[_0xfc57('0x5a')](_0xfc57('0x5b'),{'UserId':Number(_0x366a3e[_0xfc57('0x3b')][_0xfc57('0x5c')][_0x1a27df]),'WhatsappQueueId':Number(_0x366a3e[_0xfc57('0x29')]['id'])});}return _0x3ac060;});}})['then'](respondWithResult(_0xbd191d,null))[_0xfc57('0x27')](handleError(_0xbd191d,null));};exports[_0xfc57('0x72')]=function(_0x102e83,_0x3c84c1){return db[_0xfc57('0x1e')][_0xfc57('0x36')]({'where':{'id':_0x102e83[_0xfc57('0x29')]['id']}})['then'](handleEntityNotFound(_0x3c84c1,null))[_0xfc57('0x16')](function(_0x459208){if(_0x459208){return _0x459208[_0xfc57('0x72')](_0x102e83[_0xfc57('0x24')][_0xfc57('0x5c')])[_0xfc57('0x16')](function(){if(_[_0xfc57('0x76')](_0x102e83[_0xfc57('0x24')][_0xfc57('0x5c')])){for(var _0xac812c=0x0;_0xac812c<_0x102e83[_0xfc57('0x24')][_0xfc57('0x5c')][_0xfc57('0x30')];_0xac812c+=0x1){socket[_0xfc57('0x5a')](_0xfc57('0x73'),{'UserId':Number(_0x102e83[_0xfc57('0x24')][_0xfc57('0x5c')][_0xac812c]),'WhatsappQueueId':Number(_0x102e83[_0xfc57('0x29')]['id'])});}}else{socket['emit'](_0xfc57('0x73'),{'UserId':Number(_0x102e83[_0xfc57('0x24')]['ids']),'WhatsappQueueId':Number(_0x102e83[_0xfc57('0x29')]['id'])});}});}})['then'](respondWithStatusCode(_0x3c84c1,null))['catch'](handleError(_0x3c84c1,null));};exports[_0xfc57('0x77')]=function(_0x444d1c,_0x2cf231){var _0x1d9496={};var _0xf96a1d={};var _0x50c24d;var _0x471162;return db['WhatsappQueue'][_0xfc57('0x3e')]({'where':{'id':_0x444d1c[_0xfc57('0x29')]['id']}})['then'](handleEntityNotFound(_0x2cf231,null))[_0xfc57('0x16')](function(_0xe290a6){if(_0xe290a6){_0x50c24d=_0xe290a6;_0xf96a1d[_0xfc57('0x2e')]=_[_0xfc57('0x2a')](db[_0xfc57('0x46')]['rawAttributes']);_0xf96a1d['query']=_[_0xfc57('0x2a')](_0x444d1c[_0xfc57('0x24')]);_0xf96a1d['filters']=_[_0xfc57('0x2c')](_0xf96a1d['model'],_0xf96a1d[_0xfc57('0x24')]);_0x1d9496[_0xfc57('0x2d')]=_[_0xfc57('0x2c')](_0xf96a1d[_0xfc57('0x2e')],qs[_0xfc57('0x2f')](_0x444d1c[_0xfc57('0x24')][_0xfc57('0x2f')]));_0x1d9496[_0xfc57('0x2d')]=_0x1d9496['attributes'][_0xfc57('0x30')]?_0x1d9496[_0xfc57('0x2d')]:_0xf96a1d['model'];_0x1d9496[_0xfc57('0x78')]=qs[_0xfc57('0x42')](_0x444d1c[_0xfc57('0x24')][_0xfc57('0x42')]);_0x1d9496[_0xfc57('0x44')]=qs['filters'](_[_0xfc57('0x43')](_0x444d1c['query'],_0xf96a1d[_0xfc57('0x2b')]));if(_0x444d1c[_0xfc57('0x24')][_0xfc57('0x45')]){_0x1d9496[_0xfc57('0x44')]=_[_0xfc57('0x31')](_0x1d9496[_0xfc57('0x44')],{'$or':_[_0xfc57('0x1d')](_0x1d9496[_0xfc57('0x2d')],function(_0x56acc8){var _0x2a5b60={};_0x2a5b60[_0x56acc8]={'$like':'%'+_0x444d1c[_0xfc57('0x24')][_0xfc57('0x45')]+'%'};return _0x2a5b60;})});}_0x1d9496=_[_0xfc57('0x31')]({},_0x1d9496,_0x444d1c[_0xfc57('0x32')]);return _0x50c24d['getAgents'](_0x1d9496);}})[_0xfc57('0x16')](function(_0x5c5b85){if(_0x5c5b85){_0x471162=_0x5c5b85[_0xfc57('0x30')];if(!_0x444d1c[_0xfc57('0x24')][_0xfc57('0x41')](_0xfc57('0x4f'))){_0x1d9496[_0xfc57('0x11')]=qs[_0xfc57('0x11')](_0x444d1c[_0xfc57('0x24')]['limit']);_0x1d9496[_0xfc57('0xf')]=qs[_0xfc57('0xf')](_0x444d1c[_0xfc57('0x24')]['offset']);}return _0x50c24d[_0xfc57('0x77')](_0x1d9496);}})[_0xfc57('0x16')](function(_0x563d48){if(_0x563d48){return _0x563d48?{'count':_0x471162,'rows':_0x563d48}:null;}})[_0xfc57('0x16')](respondWithResult(_0x2cf231,null))[_0xfc57('0x27')](handleError(_0x2cf231,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.events.js b/server/api/whatsappQueue/whatsappQueue.events.js index 13e4548..41e8132 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 _0xb062=['hasOwnProperty','hook','exports','events','../../mysqldb','WhatsappQueue','setMaxListeners','save','remove','emit'];(function(_0x5a5caa,_0x510ada){var _0x77d337=function(_0x71d858){while(--_0x71d858){_0x5a5caa['push'](_0x5a5caa['shift']());}};_0x77d337(++_0x510ada);}(_0xb062,0x1a7));var _0x2b06=function(_0x332aae,_0x48b7e8){_0x332aae=_0x332aae-0x0;var _0x16fb4a=_0xb062[_0x332aae];return _0x16fb4a;};'use strict';var EventEmitter=require(_0x2b06('0x0'));var WhatsappQueue=require(_0x2b06('0x1'))['db'][_0x2b06('0x2')];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents[_0x2b06('0x3')](0x0);var events={'afterCreate':_0x2b06('0x4'),'afterUpdate':'update','afterDestroy':_0x2b06('0x5')};function emitEvent(_0x28db2d){return function(_0x139918,_0x41c845,_0x10aeda){WhatsappQueueEvents[_0x2b06('0x6')](_0x28db2d+':'+_0x139918['id'],_0x139918);WhatsappQueueEvents['emit'](_0x28db2d,_0x139918);_0x10aeda(null);};}for(var e in events){if(events[_0x2b06('0x7')](e)){var event=events[e];WhatsappQueue[_0x2b06('0x8')](e,emitEvent(event));}}module[_0x2b06('0x9')]=WhatsappQueueEvents; \ No newline at end of file +var _0xf5b0=['remove','emit','hasOwnProperty','hook','../../mysqldb','WhatsappQueue','save','update'];(function(_0x4f9b18,_0x2cb5ca){var _0x29f20c=function(_0x268b3d){while(--_0x268b3d){_0x4f9b18['push'](_0x4f9b18['shift']());}};_0x29f20c(++_0x2cb5ca);}(_0xf5b0,0x12c));var _0x0f5b=function(_0x160c73,_0x2ee678){_0x160c73=_0x160c73-0x0;var _0xd9302=_0xf5b0[_0x160c73];return _0xd9302;};'use strict';var EventEmitter=require('events');var WhatsappQueue=require(_0x0f5b('0x0'))['db'][_0x0f5b('0x1')];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x0f5b('0x2'),'afterUpdate':_0x0f5b('0x3'),'afterDestroy':_0x0f5b('0x4')};function emitEvent(_0x1b694f){return function(_0x42a26e,_0x4333c2,_0x2a2b18){WhatsappQueueEvents[_0x0f5b('0x5')](_0x1b694f+':'+_0x42a26e['id'],_0x42a26e);WhatsappQueueEvents[_0x0f5b('0x5')](_0x1b694f,_0x42a26e);_0x2a2b18(null);};}for(var e in events){if(events[_0x0f5b('0x6')](e)){var event=events[e];WhatsappQueue[_0x0f5b('0x7')](e,emitEvent(event));}}module['exports']=WhatsappQueueEvents; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.model.js b/server/api/whatsappQueue/whatsappQueue.model.js index f100d54..f317e68 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 _0x63aa=['moment','bluebird','rimraf','../../config/environment','./whatsappQueue.attributes','define','WhatsappQueue','lodash','../../config/logger','api'];(function(_0x2ab9eb,_0x10e74b){var _0x4c4cb1=function(_0x213f28){while(--_0x213f28){_0x2ab9eb['push'](_0x2ab9eb['shift']());}};_0x4c4cb1(++_0x10e74b);}(_0x63aa,0xcf));var _0xa63a=function(_0x290737,_0x3f0a0e){_0x290737=_0x290737-0x0;var _0x30e287=_0x63aa[_0x290737];return _0x30e287;};'use strict';var _=require(_0xa63a('0x0'));var util=require('util');var logger=require(_0xa63a('0x1'))(_0xa63a('0x2'));var moment=require(_0xa63a('0x3'));var BPromise=require(_0xa63a('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xa63a('0x5'));var config=require(_0xa63a('0x6'));var attributes=require(_0xa63a('0x7'));module['exports']=function(_0x269814,_0xbf70ea){return _0x269814[_0xa63a('0x8')](_0xa63a('0x9'),attributes,{'tableName':'whatsapp_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xebb0=['request-promise','path','rimraf','../../config/environment','./whatsappQueue.attributes','exports','define','WhatsappQueue','lodash','api','bluebird'];(function(_0x2338fa,_0x80579a){var _0x42df9b=function(_0x13fe56){while(--_0x13fe56){_0x2338fa['push'](_0x2338fa['shift']());}};_0x42df9b(++_0x80579a);}(_0xebb0,0x189));var _0x0ebb=function(_0x95411e,_0x38b4c3){_0x95411e=_0x95411e-0x0;var _0x2c8718=_0xebb0[_0x95411e];return _0x2c8718;};'use strict';var _=require(_0x0ebb('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x0ebb('0x1'));var moment=require('moment');var BPromise=require(_0x0ebb('0x2'));var rp=require(_0x0ebb('0x3'));var fs=require('fs');var path=require(_0x0ebb('0x4'));var rimraf=require(_0x0ebb('0x5'));var config=require(_0x0ebb('0x6'));var attributes=require(_0x0ebb('0x7'));module[_0x0ebb('0x8')]=function(_0x42902c,_0x243eed){return _0x42902c[_0x0ebb('0x9')](_0x0ebb('0xa'),attributes,{'tableName':'whatsapp_queues','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 5cc08ad..a9298b0 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 _0x7c72=['request','then','info','request\x20sent','debug','WhatsappQueue,\x20%s,\x20%s,\x20%s','error','code','WhatsappQueue,\x20%s,\x20%s','message','result','catch','WhatsappQueue','options','raw','attributes','limit','include','map','model','GetWhatsappQueue','stringify','ShowWhatsappQueue','where','lodash','moment','bluebird','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','redis','localhost','socket.io-emitter','./whatsappQueue.socket','register'];(function(_0x284807,_0x4be925){var _0x50c774=function(_0xf56cf7){while(--_0xf56cf7){_0x284807['push'](_0x284807['shift']());}};_0x50c774(++_0x4be925);}(_0x7c72,0x64));var _0x27c7=function(_0x12f688,_0x585c25){_0x12f688=_0x12f688-0x0;var _0x59c3de=_0x7c72[_0x12f688];return _0x59c3de;};'use strict';var _=require(_0x27c7('0x0'));var util=require('util');var moment=require(_0x27c7('0x1'));var BPromise=require(_0x27c7('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x27c7('0x3'))['db'];var utils=require(_0x27c7('0x4'));var logger=require('../../config/logger')(_0x27c7('0x5'));var config=require(_0x27c7('0x6'));var jayson=require(_0x27c7('0x7'));var client=jayson['client'][_0x27c7('0x8')]({'port':0x232a});config['redis']=_['defaults'](config[_0x27c7('0x9')],{'host':_0x27c7('0xa'),'port':0x18eb});var socket=require(_0x27c7('0xb'))(new Redis(config['redis']));require(_0x27c7('0xc'))[_0x27c7('0xd')](socket);function respondWithRpcPromise(_0xc00834,_0x58da6f,_0x49132a){return new BPromise(function(_0x2a4e30,_0x2803d5){return client[_0x27c7('0xe')](_0xc00834,_0x49132a)[_0x27c7('0xf')](function(_0xaadb2b){logger[_0x27c7('0x10')]('WhatsappQueue,\x20%s,\x20%s',_0x58da6f,_0x27c7('0x11'));logger[_0x27c7('0x12')](_0x27c7('0x13'),_0x58da6f,_0x27c7('0x11'),JSON['stringify'](_0xaadb2b));if(_0xaadb2b['error']){if(_0xaadb2b[_0x27c7('0x14')][_0x27c7('0x15')]===0x1f4){logger[_0x27c7('0x14')](_0x27c7('0x16'),_0x58da6f,_0xaadb2b[_0x27c7('0x14')]['message']);return _0x2803d5(_0xaadb2b[_0x27c7('0x14')][_0x27c7('0x17')]);}logger[_0x27c7('0x14')](_0x27c7('0x16'),_0x58da6f,_0xaadb2b[_0x27c7('0x14')]['message']);return _0x2a4e30(_0xaadb2b[_0x27c7('0x14')][_0x27c7('0x17')]);}else{logger['info']('WhatsappQueue,\x20%s,\x20%s',_0x58da6f,_0x27c7('0x11'));_0x2a4e30(_0xaadb2b[_0x27c7('0x18')][_0x27c7('0x17')]);}})[_0x27c7('0x19')](function(_0x20053f){logger[_0x27c7('0x14')]('WhatsappQueue,\x20%s,\x20%s',_0x58da6f,_0x20053f);_0x2803d5(_0x20053f);});});}exports['GetWhatsappQueue']=function(_0x2660f6){var _0xb0e871=this;return new Promise(function(_0x5dde1c,_0x4b038c){return db[_0x27c7('0x1a')]['findAll']({'raw':_0x2660f6[_0x27c7('0x1b')]?_0x2660f6[_0x27c7('0x1b')][_0x27c7('0x1c')]===undefined?!![]:![]:!![],'where':_0x2660f6['options']?_0x2660f6[_0x27c7('0x1b')]['where']||null:null,'attributes':_0x2660f6[_0x27c7('0x1b')]?_0x2660f6['options'][_0x27c7('0x1d')]||null:null,'limit':_0x2660f6[_0x27c7('0x1b')]?_0x2660f6[_0x27c7('0x1b')][_0x27c7('0x1e')]||null:null,'include':_0x2660f6[_0x27c7('0x1b')]?_0x2660f6['options'][_0x27c7('0x1f')]?_[_0x27c7('0x20')](_0x2660f6[_0x27c7('0x1b')][_0x27c7('0x1f')],function(_0x5e7029){return{'model':db[_0x5e7029[_0x27c7('0x21')]],'as':_0x5e7029['as'],'attributes':_0x5e7029['attributes'],'include':_0x5e7029['include']?_['map'](_0x5e7029[_0x27c7('0x1f')],function(_0x637c2a){return{'model':db[_0x637c2a[_0x27c7('0x21')]],'as':_0x637c2a['as'],'attributes':_0x637c2a[_0x27c7('0x1d')],'include':_0x637c2a[_0x27c7('0x1f')]?_[_0x27c7('0x20')](_0x637c2a[_0x27c7('0x1f')],function(_0x360db8){return{'model':db[_0x360db8['model']],'as':_0x360db8['as'],'attributes':_0x360db8[_0x27c7('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x27c7('0xf')](function(_0x1be4c6){logger[_0x27c7('0x10')]('GetWhatsappQueue',_0x2660f6);logger[_0x27c7('0x12')](_0x27c7('0x22'),_0x2660f6,JSON[_0x27c7('0x23')](_0x1be4c6));_0x5dde1c(_0x1be4c6);})[_0x27c7('0x19')](function(_0x4713a1){logger[_0x27c7('0x14')]('GetWhatsappQueue',_0x4713a1['message'],_0x2660f6);_0x4b038c(_0xb0e871[_0x27c7('0x14')](0x1f4,_0x4713a1[_0x27c7('0x17')]));});});};exports[_0x27c7('0x24')]=function(_0x382e74){var _0x2e4313=this;return new Promise(function(_0x3e143e,_0x172855){return db[_0x27c7('0x1a')]['find']({'raw':_0x382e74['options']?_0x382e74['options'][_0x27c7('0x1c')]===undefined?!![]:![]:!![],'where':_0x382e74[_0x27c7('0x1b')]?_0x382e74[_0x27c7('0x1b')][_0x27c7('0x25')]||null:null,'attributes':_0x382e74[_0x27c7('0x1b')]?_0x382e74[_0x27c7('0x1b')]['attributes']||null:null,'include':_0x382e74[_0x27c7('0x1b')]?_0x382e74[_0x27c7('0x1b')][_0x27c7('0x1f')]?_[_0x27c7('0x20')](_0x382e74[_0x27c7('0x1b')][_0x27c7('0x1f')],function(_0x2de52a){return{'model':db[_0x2de52a[_0x27c7('0x21')]],'as':_0x2de52a['as'],'attributes':_0x2de52a[_0x27c7('0x1d')],'include':_0x2de52a['include']?_['map'](_0x2de52a[_0x27c7('0x1f')],function(_0x4e0f86){return{'model':db[_0x4e0f86[_0x27c7('0x21')]],'as':_0x4e0f86['as'],'attributes':_0x4e0f86[_0x27c7('0x1d')],'include':_0x4e0f86[_0x27c7('0x1f')]?_['map'](_0x4e0f86['include'],function(_0x421d09){return{'model':db[_0x421d09[_0x27c7('0x21')]],'as':_0x421d09['as'],'attributes':_0x421d09['attributes']};}):[]};}):[]};}):[]:[]})[_0x27c7('0xf')](function(_0x1d238e){logger[_0x27c7('0x10')]('ShowWhatsappQueue',_0x382e74);logger['debug'](_0x27c7('0x24'),_0x382e74,JSON['stringify'](_0x1d238e));_0x3e143e(_0x1d238e);})[_0x27c7('0x19')](function(_0x201c83){logger[_0x27c7('0x14')]('ShowWhatsappQueue',_0x201c83[_0x27c7('0x17')],_0x382e74);_0x172855(_0x2e4313[_0x27c7('0x14')](0x1f4,_0x201c83['message']));});});}; \ No newline at end of file +var _0xb1de=['ShowWhatsappQueue','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','redis','defaults','socket.io-emitter','./whatsappQueue.socket','register','request','info','WhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','WhatsappQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetWhatsappQueue','findAll','options','raw','attributes','include','map','model','then','WhatsappQueue','find'];(function(_0x3e2f37,_0x139acc){var _0x1a74f7=function(_0x383c14){while(--_0x383c14){_0x3e2f37['push'](_0x3e2f37['shift']());}};_0x1a74f7(++_0x139acc);}(_0xb1de,0x119));var _0xeb1d=function(_0x301074,_0x111e1e){_0x301074=_0x301074-0x0;var _0x1b5b8e=_0xb1de[_0x301074];return _0x1b5b8e;};'use strict';var _=require(_0xeb1d('0x0'));var util=require(_0xeb1d('0x1'));var moment=require(_0xeb1d('0x2'));var BPromise=require(_0xeb1d('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xeb1d('0x4'));var db=require(_0xeb1d('0x5'))['db'];var utils=require(_0xeb1d('0x6'));var logger=require(_0xeb1d('0x7'))('rpc');var config=require(_0xeb1d('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xeb1d('0x9')][_0xeb1d('0xa')]({'port':0x232a});config[_0xeb1d('0xb')]=_[_0xeb1d('0xc')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xeb1d('0xd'))(new Redis(config[_0xeb1d('0xb')]));require(_0xeb1d('0xe'))[_0xeb1d('0xf')](socket);function respondWithRpcPromise(_0xa447c8,_0x5f38a7,_0x508090){return new BPromise(function(_0x499357,_0x4511b7){return client[_0xeb1d('0x10')](_0xa447c8,_0x508090)['then'](function(_0x22529e){logger[_0xeb1d('0x11')](_0xeb1d('0x12'),_0x5f38a7,_0xeb1d('0x13'));logger[_0xeb1d('0x14')](_0xeb1d('0x15'),_0x5f38a7,_0xeb1d('0x13'),JSON[_0xeb1d('0x16')](_0x22529e));if(_0x22529e[_0xeb1d('0x17')]){if(_0x22529e[_0xeb1d('0x17')][_0xeb1d('0x18')]===0x1f4){logger[_0xeb1d('0x17')](_0xeb1d('0x12'),_0x5f38a7,_0x22529e['error'][_0xeb1d('0x19')]);return _0x4511b7(_0x22529e[_0xeb1d('0x17')]['message']);}logger[_0xeb1d('0x17')](_0xeb1d('0x12'),_0x5f38a7,_0x22529e[_0xeb1d('0x17')]['message']);return _0x499357(_0x22529e[_0xeb1d('0x17')]['message']);}else{logger['info'](_0xeb1d('0x12'),_0x5f38a7,_0xeb1d('0x13'));_0x499357(_0x22529e[_0xeb1d('0x1a')][_0xeb1d('0x19')]);}})[_0xeb1d('0x1b')](function(_0x3d2d2c){logger['error'](_0xeb1d('0x12'),_0x5f38a7,_0x3d2d2c);_0x4511b7(_0x3d2d2c);});});}exports[_0xeb1d('0x1c')]=function(_0x2e6427){var _0x4b2cb1=this;return new Promise(function(_0x48edee,_0x3eb4d5){return db['WhatsappQueue'][_0xeb1d('0x1d')]({'raw':_0x2e6427[_0xeb1d('0x1e')]?_0x2e6427[_0xeb1d('0x1e')][_0xeb1d('0x1f')]===undefined?!![]:![]:!![],'where':_0x2e6427[_0xeb1d('0x1e')]?_0x2e6427[_0xeb1d('0x1e')]['where']||null:null,'attributes':_0x2e6427['options']?_0x2e6427[_0xeb1d('0x1e')][_0xeb1d('0x20')]||null:null,'limit':_0x2e6427[_0xeb1d('0x1e')]?_0x2e6427[_0xeb1d('0x1e')]['limit']||null:null,'include':_0x2e6427[_0xeb1d('0x1e')]?_0x2e6427[_0xeb1d('0x1e')][_0xeb1d('0x21')]?_[_0xeb1d('0x22')](_0x2e6427[_0xeb1d('0x1e')][_0xeb1d('0x21')],function(_0x419c93){return{'model':db[_0x419c93[_0xeb1d('0x23')]],'as':_0x419c93['as'],'attributes':_0x419c93[_0xeb1d('0x20')],'include':_0x419c93[_0xeb1d('0x21')]?_[_0xeb1d('0x22')](_0x419c93[_0xeb1d('0x21')],function(_0x12387c){return{'model':db[_0x12387c['model']],'as':_0x12387c['as'],'attributes':_0x12387c[_0xeb1d('0x20')],'include':_0x12387c['include']?_[_0xeb1d('0x22')](_0x12387c[_0xeb1d('0x21')],function(_0xe055b4){return{'model':db[_0xe055b4[_0xeb1d('0x23')]],'as':_0xe055b4['as'],'attributes':_0xe055b4[_0xeb1d('0x20')]};}):[]};}):[]};}):[]:[]})[_0xeb1d('0x24')](function(_0xbab99a){logger['info']('GetWhatsappQueue',_0x2e6427);logger[_0xeb1d('0x14')](_0xeb1d('0x1c'),_0x2e6427,JSON[_0xeb1d('0x16')](_0xbab99a));_0x48edee(_0xbab99a);})[_0xeb1d('0x1b')](function(_0x9c29b1){logger['error'](_0xeb1d('0x1c'),_0x9c29b1[_0xeb1d('0x19')],_0x2e6427);_0x3eb4d5(_0x4b2cb1[_0xeb1d('0x17')](0x1f4,_0x9c29b1[_0xeb1d('0x19')]));});});};exports['ShowWhatsappQueue']=function(_0x3af7cf){var _0x2fa6fb=this;return new Promise(function(_0x2e249b,_0x5f00d3){return db[_0xeb1d('0x25')][_0xeb1d('0x26')]({'raw':_0x3af7cf[_0xeb1d('0x1e')]?_0x3af7cf[_0xeb1d('0x1e')][_0xeb1d('0x1f')]===undefined?!![]:![]:!![],'where':_0x3af7cf[_0xeb1d('0x1e')]?_0x3af7cf[_0xeb1d('0x1e')]['where']||null:null,'attributes':_0x3af7cf['options']?_0x3af7cf['options'][_0xeb1d('0x20')]||null:null,'include':_0x3af7cf[_0xeb1d('0x1e')]?_0x3af7cf[_0xeb1d('0x1e')][_0xeb1d('0x21')]?_[_0xeb1d('0x22')](_0x3af7cf['options'][_0xeb1d('0x21')],function(_0x104942){return{'model':db[_0x104942[_0xeb1d('0x23')]],'as':_0x104942['as'],'attributes':_0x104942['attributes'],'include':_0x104942['include']?_['map'](_0x104942[_0xeb1d('0x21')],function(_0x154083){return{'model':db[_0x154083[_0xeb1d('0x23')]],'as':_0x154083['as'],'attributes':_0x154083[_0xeb1d('0x20')],'include':_0x154083['include']?_[_0xeb1d('0x22')](_0x154083[_0xeb1d('0x21')],function(_0x2abe19){return{'model':db[_0x2abe19[_0xeb1d('0x23')]],'as':_0x2abe19['as'],'attributes':_0x2abe19[_0xeb1d('0x20')]};}):[]};}):[]};}):[]:[]})[_0xeb1d('0x24')](function(_0x38801f){logger[_0xeb1d('0x11')](_0xeb1d('0x27'),_0x3af7cf);logger[_0xeb1d('0x14')](_0xeb1d('0x27'),_0x3af7cf,JSON[_0xeb1d('0x16')](_0x38801f));_0x2e249b(_0x38801f);})[_0xeb1d('0x1b')](function(_0x280694){logger[_0xeb1d('0x17')](_0xeb1d('0x27'),_0x280694[_0xeb1d('0x19')],_0x3af7cf);_0x5f00d3(_0x2fa6fb[_0xeb1d('0x17')](0x1f4,_0x280694[_0xeb1d('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.socket.js b/server/api/whatsappQueue/whatsappQueue.socket.js index 36b6df9..a20e707 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 _0x3744=['./whatsappQueue.events','save','emit','removeListener','register','length','whatsappQueue:'];(function(_0x5a79e2,_0x319b1a){var _0x266c45=function(_0x172478){while(--_0x172478){_0x5a79e2['push'](_0x5a79e2['shift']());}};_0x266c45(++_0x319b1a);}(_0x3744,0x11f));var _0x4374=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x3744[_0x3bf83f];return _0x22c4a9;};'use strict';var WhatsappQueueEvents=require(_0x4374('0x0'));var events=[_0x4374('0x1'),'remove','update'];function createListener(_0x2831ec,_0x47e2b8){return function(_0x1ca0e4){_0x47e2b8[_0x4374('0x2')](_0x2831ec,_0x1ca0e4);};}function removeListener(_0xee58db,_0x457752){return function(){WhatsappQueueEvents[_0x4374('0x3')](_0xee58db,_0x457752);};}exports[_0x4374('0x4')]=function(_0x51173e){for(var _0x301be2=0x0,_0x55053=events[_0x4374('0x5')];_0x301be2<_0x55053;_0x301be2++){var _0x80b2f5=events[_0x301be2];var _0x56d3e7=createListener(_0x4374('0x6')+_0x80b2f5,_0x51173e);WhatsappQueueEvents['on'](_0x80b2f5,_0x56d3e7);}}; \ No newline at end of file +var _0x26b3=['whatsappQueue:','save','remove','emit','removeListener','length'];(function(_0x1d7037,_0x57dd95){var _0x4d6568=function(_0x5c64c5){while(--_0x5c64c5){_0x1d7037['push'](_0x1d7037['shift']());}};_0x4d6568(++_0x57dd95);}(_0x26b3,0xcd));var _0x326b=function(_0x38f478,_0x347902){_0x38f478=_0x38f478-0x0;var _0x547d4e=_0x26b3[_0x38f478];return _0x547d4e;};'use strict';var WhatsappQueueEvents=require('./whatsappQueue.events');var events=[_0x326b('0x0'),_0x326b('0x1'),'update'];function createListener(_0x311c5d,_0x3d3794){return function(_0x467dbf){_0x3d3794[_0x326b('0x2')](_0x311c5d,_0x467dbf);};}function removeListener(_0x494b00,_0x3e67e8){return function(){WhatsappQueueEvents[_0x326b('0x3')](_0x494b00,_0x3e67e8);};}exports['register']=function(_0x3eaca7){for(var _0xa7d314=0x0,_0x5c0a07=events[_0x326b('0x4')];_0xa7d314<_0x5c0a07;_0xa7d314++){var _0x49b07e=events[_0xa7d314];var _0x3080d1=createListener(_0x326b('0x5')+_0x49b07e,_0x3eaca7);WhatsappQueueEvents['on'](_0x49b07e,_0x3080d1);}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/index.js b/server/api/whatsappQueueReport/index.js index 5e1acb6..799f7da 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 _0xef36=['../../config/environment','get','isAuthenticated','/describe','describe','show','post','/:id','update','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0xef36,0x1bf));var _0x6ef3=function(_0x5f354e,_0x3698bf){_0x5f354e=_0x5f354e-0x0;var _0x4cb29c=_0xef36[_0x5f354e];return _0x4cb29c;};'use strict';var multer=require(_0x6ef3('0x0'));var util=require(_0x6ef3('0x1'));var path=require(_0x6ef3('0x2'));var timeout=require(_0x6ef3('0x3'));var express=require(_0x6ef3('0x4'));var router=express[_0x6ef3('0x5')]();var fs_extra=require(_0x6ef3('0x6'));var auth=require(_0x6ef3('0x7'));var interaction=require(_0x6ef3('0x8'));var config=require(_0x6ef3('0x9'));var controller=require('./whatsappQueueReport.controller');router[_0x6ef3('0xa')]('/',auth[_0x6ef3('0xb')](),controller['index']);router[_0x6ef3('0xa')](_0x6ef3('0xc'),auth[_0x6ef3('0xb')](),controller[_0x6ef3('0xd')]);router[_0x6ef3('0xa')]('/:id',auth[_0x6ef3('0xb')](),controller[_0x6ef3('0xe')]);router[_0x6ef3('0xf')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x6ef3('0x10'),auth['isAuthenticated'](),controller[_0x6ef3('0x11')]);router['delete'](_0x6ef3('0x10'),auth[_0x6ef3('0xb')](),controller[_0x6ef3('0x12')]);module['exports']=router; \ No newline at end of file +var _0xae7d=['update','delete','destroy','multer','connect-timeout','express','Router','fs-extra','./whatsappQueueReport.controller','get','isAuthenticated','describe','/:id','show','post','create'];(function(_0x19e441,_0x4cc66b){var _0x4f7b3e=function(_0x24bb0b){while(--_0x24bb0b){_0x19e441['push'](_0x19e441['shift']());}};_0x4f7b3e(++_0x4cc66b);}(_0xae7d,0x83));var _0xdae7=function(_0x10f982,_0x2869f8){_0x10f982=_0x10f982-0x0;var _0x3cefe1=_0xae7d[_0x10f982];return _0x3cefe1;};'use strict';var multer=require(_0xdae7('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xdae7('0x1'));var express=require(_0xdae7('0x2'));var router=express[_0xdae7('0x3')]();var fs_extra=require(_0xdae7('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xdae7('0x5'));router[_0xdae7('0x6')]('/',auth[_0xdae7('0x7')](),controller['index']);router[_0xdae7('0x6')]('/describe',auth[_0xdae7('0x7')](),controller[_0xdae7('0x8')]);router[_0xdae7('0x6')](_0xdae7('0x9'),auth[_0xdae7('0x7')](),controller[_0xdae7('0xa')]);router[_0xdae7('0xb')]('/',auth[_0xdae7('0x7')](),controller[_0xdae7('0xc')]);router['put']('/:id',auth[_0xdae7('0x7')](),controller[_0xdae7('0xd')]);router[_0xdae7('0xe')](_0xdae7('0x9'),auth[_0xdae7('0x7')](),controller[_0xdae7('0xf')]);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 8f3c50e..2990e20 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(_0x31e60d,_0x37ac23){var _0xc586f3=function(_0x5abae6){while(--_0x5abae6){_0x31e60d['push'](_0x31e60d['shift']());}};_0xc586f3(++_0x37ac23);}(_0x9957,0x93));var _0x7995=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x9957[_0x4cf98e];return _0x1623ac;};'use strict';var Sequelize=require(_0x7995('0x0'));module[_0x7995('0x1')]={'uniqueid':{'type':Sequelize[_0x7995('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x7995('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x7995('0x3')]},'acceptAt':{'type':Sequelize[_0x7995('0x3')]},'exitAt':{'type':Sequelize[_0x7995('0x3')]},'reason':{'type':Sequelize[_0x7995('0x2')]}}; \ No newline at end of file +var _0x7a54=['STRING','DATE','sequelize','exports'];(function(_0x4ff1a0,_0x132df4){var _0x347fb8=function(_0x5b8227){while(--_0x5b8227){_0x4ff1a0['push'](_0x4ff1a0['shift']());}};_0x347fb8(++_0x132df4);}(_0x7a54,0x106));var _0x47a5=function(_0x25a165,_0x2ddc4a){_0x25a165=_0x25a165-0x0;var _0x3732e7=_0x7a54[_0x25a165];return _0x3732e7;};'use strict';var Sequelize=require(_0x47a5('0x0'));module[_0x47a5('0x1')]={'uniqueid':{'type':Sequelize[_0x47a5('0x2')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x47a5('0x3')]},'leaveAt':{'type':Sequelize[_0x47a5('0x3')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x47a5('0x3')]},'reason':{'type':Sequelize[_0x47a5('0x2')]}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.controller.js b/server/api/whatsappQueueReport/whatsappQueueReport.controller.js index e300cab..92fa89d 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 _0x36ee=['describe','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','end','stack','name','send','WhatsappQueueReport','rawAttributes','type','key','model','map','query','filters','attributes','intersection','fields','length','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','show','params','keys','catch','create','body','find'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x36ee,0xe8));var _0xe36e=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x36ee[_0x501510];return _0x1e6ee5;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xe36e('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe36e('0x1'));var moment=require(_0xe36e('0x2'));var BPromise=require(_0xe36e('0x3'));var Mustache=require(_0xe36e('0x4'));var util=require(_0xe36e('0x5'));var path=require(_0xe36e('0x6'));var sox=require(_0xe36e('0x7'));var csv=require(_0xe36e('0x8'));var ejs=require(_0xe36e('0x9'));var fs=require('fs');var fs_extra=require(_0xe36e('0xa'));var _=require(_0xe36e('0xb'));var squel=require(_0xe36e('0xc'));var crypto=require('crypto');var jsforce=require(_0xe36e('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xe36e('0x8'));var querystring=require(_0xe36e('0xe'));var Papa=require(_0xe36e('0xf'));var Redis=require('ioredis');var authService=require(_0xe36e('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xe36e('0x11'));var hardwareService=require(_0xe36e('0x12'));var logger=require(_0xe36e('0x13'))(_0xe36e('0x14'));var utils=require(_0xe36e('0x15'));var config=require(_0xe36e('0x16'));var licenseUtil=require(_0xe36e('0x17'));var db=require(_0xe36e('0x18'))['db'];function respondWithStatusCode(_0x4fbdb2,_0x32981d){_0x32981d=_0x32981d||0xcc;return function(_0x27841e){if(_0x27841e){return _0x4fbdb2[_0xe36e('0x19')](_0x32981d);}return _0x4fbdb2[_0xe36e('0x1a')](_0x32981d)['end']();};}function respondWithResult(_0x3e264a,_0x521afa){_0x521afa=_0x521afa||0xc8;return function(_0x525155){if(_0x525155){return _0x3e264a[_0xe36e('0x1a')](_0x521afa)[_0xe36e('0x1b')](_0x525155);}};}function respondWithFilteredResult(_0x26fb37,_0x278135){return function(_0xd6828e){if(_0xd6828e){var _0x924cd5=typeof _0x278135[_0xe36e('0x1c')]===_0xe36e('0x1d')&&typeof _0x278135[_0xe36e('0x1e')]===_0xe36e('0x1d');var _0x5792e8=_0xd6828e[_0xe36e('0x1f')];var _0x2184ae=_0x924cd5?0x0:_0x278135['offset'];var _0x21d9a3=_0x924cd5?_0xd6828e['count']:_0x278135[_0xe36e('0x1c')]+_0x278135[_0xe36e('0x1e')];var _0x5e15f5;if(_0x21d9a3>=_0x5792e8){_0x21d9a3=_0x5792e8;_0x5e15f5=0xc8;}else{_0x5e15f5=0xce;}_0x26fb37[_0xe36e('0x1a')](_0x5e15f5);return _0x26fb37[_0xe36e('0x20')](_0xe36e('0x21'),_0x2184ae+'-'+_0x21d9a3+'/'+_0x5792e8)['json'](_0xd6828e);}return null;};}function patchUpdates(_0x21e95e){return function(_0x21bcf9){try{jsonpatch[_0xe36e('0x22')](_0x21bcf9,_0x21e95e,!![]);}catch(_0x3c4017){return BPromise[_0xe36e('0x23')](_0x3c4017);}return _0x21bcf9[_0xe36e('0x24')]();};}function saveUpdates(_0x4f438a,_0xd71137){return function(_0x4f214a){if(_0x4f214a){return _0x4f214a[_0xe36e('0x25')](_0x4f438a)[_0xe36e('0x26')](function(_0x437f3f){return _0x437f3f;});}return null;};}function removeEntity(_0x53e13a,_0x598a7a){return function(_0x4749a8){if(_0x4749a8){return _0x4749a8[_0xe36e('0x27')]()[_0xe36e('0x26')](function(){_0x53e13a[_0xe36e('0x1a')](0xcc)[_0xe36e('0x28')]();});}};}function handleEntityNotFound(_0x1507f9,_0x1a045c){return function(_0x5ac484){if(!_0x5ac484){_0x1507f9[_0xe36e('0x19')](0x194);}return _0x5ac484;};}function handleError(_0x35f9e7,_0x10597f){_0x10597f=_0x10597f||0x1f4;return function(_0x262caa){logger['error'](_0x262caa[_0xe36e('0x29')]);if(_0x262caa['name']){delete _0x262caa[_0xe36e('0x2a')];}_0x35f9e7['status'](_0x10597f)[_0xe36e('0x2b')](_0x262caa);};}exports['index']=function(_0x410504,_0x4c5d98){var _0x3b1045={},_0x59548b={},_0x4bb75b={'count':0x0,'rows':[]};var _0x5d8fd8=_['map'](db[_0xe36e('0x2c')][_0xe36e('0x2d')],function(_0x4cf185){return{'name':_0x4cf185['fieldName'],'type':_0x4cf185[_0xe36e('0x2e')][_0xe36e('0x2f')]};});_0x59548b[_0xe36e('0x30')]=_[_0xe36e('0x31')](_0x5d8fd8,_0xe36e('0x2a'));_0x59548b[_0xe36e('0x32')]=_['keys'](_0x410504[_0xe36e('0x32')]);_0x59548b[_0xe36e('0x33')]=_['intersection'](_0x59548b[_0xe36e('0x30')],_0x59548b[_0xe36e('0x32')]);_0x3b1045[_0xe36e('0x34')]=_[_0xe36e('0x35')](_0x59548b[_0xe36e('0x30')],qs[_0xe36e('0x36')](_0x410504[_0xe36e('0x32')][_0xe36e('0x36')]));_0x3b1045[_0xe36e('0x34')]=_0x3b1045[_0xe36e('0x34')][_0xe36e('0x37')]?_0x3b1045['attributes']:_0x59548b[_0xe36e('0x30')];if(!_0x410504['query']['hasOwnProperty'](_0xe36e('0x38'))){_0x3b1045['limit']=qs[_0xe36e('0x1e')](_0x410504[_0xe36e('0x32')][_0xe36e('0x1e')]);_0x3b1045[_0xe36e('0x1c')]=qs['offset'](_0x410504['query'][_0xe36e('0x1c')]);}_0x3b1045[_0xe36e('0x39')]=qs[_0xe36e('0x3a')](_0x410504[_0xe36e('0x32')]['sort']);_0x3b1045[_0xe36e('0x3b')]=qs[_0xe36e('0x33')](_[_0xe36e('0x3c')](_0x410504['query'],_0x59548b[_0xe36e('0x33')]),_0x5d8fd8);if(_0x410504[_0xe36e('0x32')]['filter']){_0x3b1045[_0xe36e('0x3b')]=_[_0xe36e('0x3d')](_0x3b1045[_0xe36e('0x3b')],{'$or':_[_0xe36e('0x31')](_0x5d8fd8,function(_0xeadfa6){if(_0xeadfa6[_0xe36e('0x2e')]!==_0xe36e('0x3e')){var _0x20877d={};_0x20877d[_0xeadfa6[_0xe36e('0x2a')]]={'$like':'%'+_0x410504[_0xe36e('0x32')][_0xe36e('0x3f')]+'%'};return _0x20877d;}})});}_0x3b1045=_[_0xe36e('0x3d')]({},_0x3b1045,_0x410504[_0xe36e('0x40')]);var _0x5f396c={'where':_0x3b1045[_0xe36e('0x3b')]};return db[_0xe36e('0x2c')][_0xe36e('0x1f')](_0x5f396c)[_0xe36e('0x26')](function(_0x295feb){_0x4bb75b['count']=_0x295feb;if(_0x410504['query'][_0xe36e('0x41')]){_0x3b1045[_0xe36e('0x42')]=[{'all':!![]}];}return db[_0xe36e('0x2c')][_0xe36e('0x43')](_0x3b1045);})[_0xe36e('0x26')](function(_0x34a1ba){_0x4bb75b[_0xe36e('0x44')]=_0x34a1ba;return _0x4bb75b;})[_0xe36e('0x26')](respondWithFilteredResult(_0x4c5d98,_0x3b1045))['catch'](handleError(_0x4c5d98,null));};exports[_0xe36e('0x45')]=function(_0x2d392c,_0x4788a0){var _0x21dc35={'raw':!![],'where':{'id':_0x2d392c[_0xe36e('0x46')]['id']}},_0x5ef3e4={};_0x5ef3e4[_0xe36e('0x30')]=_[_0xe36e('0x47')](db[_0xe36e('0x2c')][_0xe36e('0x2d')]);_0x5ef3e4['query']=_[_0xe36e('0x47')](_0x2d392c[_0xe36e('0x32')]);_0x5ef3e4[_0xe36e('0x33')]=_[_0xe36e('0x35')](_0x5ef3e4[_0xe36e('0x30')],_0x5ef3e4[_0xe36e('0x32')]);_0x21dc35['attributes']=_[_0xe36e('0x35')](_0x5ef3e4[_0xe36e('0x30')],qs[_0xe36e('0x36')](_0x2d392c[_0xe36e('0x32')][_0xe36e('0x36')]));_0x21dc35['attributes']=_0x21dc35[_0xe36e('0x34')][_0xe36e('0x37')]?_0x21dc35[_0xe36e('0x34')]:_0x5ef3e4[_0xe36e('0x30')];if(_0x2d392c[_0xe36e('0x32')][_0xe36e('0x41')]){_0x21dc35[_0xe36e('0x42')]=[{'all':!![]}];}_0x21dc35=_[_0xe36e('0x3d')]({},_0x21dc35,_0x2d392c[_0xe36e('0x40')]);return db['WhatsappQueueReport']['find'](_0x21dc35)[_0xe36e('0x26')](handleEntityNotFound(_0x4788a0,null))['then'](respondWithResult(_0x4788a0,null))[_0xe36e('0x48')](handleError(_0x4788a0,null));};exports[_0xe36e('0x49')]=function(_0x38b93f,_0x25aa09){return db['WhatsappQueueReport'][_0xe36e('0x49')](_0x38b93f[_0xe36e('0x4a')],{})['then'](respondWithResult(_0x25aa09,0xc9))[_0xe36e('0x48')](handleError(_0x25aa09,null));};exports[_0xe36e('0x25')]=function(_0x2c26e6,_0x42eae5){if(_0x2c26e6[_0xe36e('0x4a')]['id']){delete _0x2c26e6[_0xe36e('0x4a')]['id'];}return db[_0xe36e('0x2c')][_0xe36e('0x4b')]({'where':{'id':_0x2c26e6[_0xe36e('0x46')]['id']}})[_0xe36e('0x26')](handleEntityNotFound(_0x42eae5,null))[_0xe36e('0x26')](saveUpdates(_0x2c26e6[_0xe36e('0x4a')],null))[_0xe36e('0x26')](respondWithResult(_0x42eae5,null))[_0xe36e('0x48')](handleError(_0x42eae5,null));};exports[_0xe36e('0x27')]=function(_0x5678d3,_0x3262bf){return db['WhatsappQueueReport']['find']({'where':{'id':_0x5678d3[_0xe36e('0x46')]['id']}})[_0xe36e('0x26')](handleEntityNotFound(_0x3262bf,null))['then'](removeEntity(_0x3262bf,null))[_0xe36e('0x48')](handleError(_0x3262bf,null));};exports[_0xe36e('0x4c')]=function(_0x8a767a,_0x1f4a5d){return db[_0xe36e('0x2c')][_0xe36e('0x4c')]()[_0xe36e('0x26')](respondWithResult(_0x1f4a5d,null))[_0xe36e('0x48')](handleError(_0x1f4a5d,null));}; \ No newline at end of file +var _0x5b12=['options','includeAll','include','findAll','then','show','params','rawAttributes','catch','create','body','find','describe','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','path','ejs','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','count','offset','Content-Range','apply','reject','update','destroy','error','name','index','map','WhatsappQueueReport','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL'];(function(_0x5e2475,_0x28bedf){var _0x535b9b=function(_0x595296){while(--_0x595296){_0x5e2475['push'](_0x5e2475['shift']());}};_0x535b9b(++_0x28bedf);}(_0x5b12,0xa3));var _0x25b1=function(_0x5110ce,_0x2f93e6){_0x5110ce=_0x5110ce-0x0;var _0x4b70ef=_0x5b12[_0x5110ce];return _0x4b70ef;};'use strict';var emlformat=require(_0x25b1('0x0'));var rimraf=require(_0x25b1('0x1'));var zipdir=require(_0x25b1('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x25b1('0x3'));var moment=require('moment');var BPromise=require(_0x25b1('0x4'));var Mustache=require(_0x25b1('0x5'));var util=require('util');var path=require(_0x25b1('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x25b1('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x25b1('0x8'));var crypto=require(_0x25b1('0x9'));var jsforce=require(_0x25b1('0xa'));var deskjs=require(_0x25b1('0xb'));var toCsv=require(_0x25b1('0xc'));var querystring=require(_0x25b1('0xd'));var Papa=require(_0x25b1('0xe'));var Redis=require(_0x25b1('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x25b1('0x10'));var as=require(_0x25b1('0x11'));var hardwareService=require(_0x25b1('0x12'));var logger=require(_0x25b1('0x13'))(_0x25b1('0x14'));var utils=require(_0x25b1('0x15'));var config=require(_0x25b1('0x16'));var licenseUtil=require(_0x25b1('0x17'));var db=require(_0x25b1('0x18'))['db'];function respondWithStatusCode(_0x459070,_0xbdd348){_0xbdd348=_0xbdd348||0xcc;return function(_0x1c5421){if(_0x1c5421){return _0x459070[_0x25b1('0x19')](_0xbdd348);}return _0x459070[_0x25b1('0x1a')](_0xbdd348)[_0x25b1('0x1b')]();};}function respondWithResult(_0x76b5c4,_0x4ee40c){_0x4ee40c=_0x4ee40c||0xc8;return function(_0x2c337a){if(_0x2c337a){return _0x76b5c4[_0x25b1('0x1a')](_0x4ee40c)['json'](_0x2c337a);}};}function respondWithFilteredResult(_0xb5b9cf,_0x4bb1bb){return function(_0xe32e02){if(_0xe32e02){var _0x4a5a58=typeof _0x4bb1bb['offset']===_0x25b1('0x1c')&&typeof _0x4bb1bb['limit']===_0x25b1('0x1c');var _0x2ca567=_0xe32e02[_0x25b1('0x1d')];var _0x27ccc9=_0x4a5a58?0x0:_0x4bb1bb[_0x25b1('0x1e')];var _0x2a7d14=_0x4a5a58?_0xe32e02[_0x25b1('0x1d')]:_0x4bb1bb[_0x25b1('0x1e')]+_0x4bb1bb['limit'];var _0x4ecff1;if(_0x2a7d14>=_0x2ca567){_0x2a7d14=_0x2ca567;_0x4ecff1=0xc8;}else{_0x4ecff1=0xce;}_0xb5b9cf[_0x25b1('0x1a')](_0x4ecff1);return _0xb5b9cf['set'](_0x25b1('0x1f'),_0x27ccc9+'-'+_0x2a7d14+'/'+_0x2ca567)['json'](_0xe32e02);}return null;};}function patchUpdates(_0x3bfd7d){return function(_0x59aa37){try{jsonpatch[_0x25b1('0x20')](_0x59aa37,_0x3bfd7d,!![]);}catch(_0x529310){return BPromise[_0x25b1('0x21')](_0x529310);}return _0x59aa37['save']();};}function saveUpdates(_0x4e3f48,_0x565cfd){return function(_0x3bca9f){if(_0x3bca9f){return _0x3bca9f[_0x25b1('0x22')](_0x4e3f48)['then'](function(_0x19bab8){return _0x19bab8;});}return null;};}function removeEntity(_0x26b555,_0x1e5915){return function(_0x246acd){if(_0x246acd){return _0x246acd[_0x25b1('0x23')]()['then'](function(){_0x26b555[_0x25b1('0x1a')](0xcc)[_0x25b1('0x1b')]();});}};}function handleEntityNotFound(_0xd22469,_0x282187){return function(_0x1f37ed){if(!_0x1f37ed){_0xd22469[_0x25b1('0x19')](0x194);}return _0x1f37ed;};}function handleError(_0x5d9ed7,_0x3c05c6){_0x3c05c6=_0x3c05c6||0x1f4;return function(_0x27dd68){logger[_0x25b1('0x24')](_0x27dd68['stack']);if(_0x27dd68[_0x25b1('0x25')]){delete _0x27dd68[_0x25b1('0x25')];}_0x5d9ed7[_0x25b1('0x1a')](_0x3c05c6)['send'](_0x27dd68);};}exports[_0x25b1('0x26')]=function(_0x54ce2d,_0x19ecd1){var _0x3febb8={},_0x3a4475={},_0x293413={'count':0x0,'rows':[]};var _0x362118=_[_0x25b1('0x27')](db[_0x25b1('0x28')]['rawAttributes'],function(_0x30d455){return{'name':_0x30d455[_0x25b1('0x29')],'type':_0x30d455[_0x25b1('0x2a')][_0x25b1('0x2b')]};});_0x3a4475[_0x25b1('0x2c')]=_['map'](_0x362118,_0x25b1('0x25'));_0x3a4475[_0x25b1('0x2d')]=_[_0x25b1('0x2e')](_0x54ce2d[_0x25b1('0x2d')]);_0x3a4475[_0x25b1('0x2f')]=_['intersection'](_0x3a4475['model'],_0x3a4475[_0x25b1('0x2d')]);_0x3febb8['attributes']=_[_0x25b1('0x30')](_0x3a4475[_0x25b1('0x2c')],qs[_0x25b1('0x31')](_0x54ce2d['query']['fields']));_0x3febb8[_0x25b1('0x32')]=_0x3febb8[_0x25b1('0x32')][_0x25b1('0x33')]?_0x3febb8['attributes']:_0x3a4475[_0x25b1('0x2c')];if(!_0x54ce2d[_0x25b1('0x2d')][_0x25b1('0x34')](_0x25b1('0x35'))){_0x3febb8['limit']=qs[_0x25b1('0x36')](_0x54ce2d[_0x25b1('0x2d')][_0x25b1('0x36')]);_0x3febb8['offset']=qs['offset'](_0x54ce2d[_0x25b1('0x2d')]['offset']);}_0x3febb8[_0x25b1('0x37')]=qs[_0x25b1('0x38')](_0x54ce2d[_0x25b1('0x2d')][_0x25b1('0x38')]);_0x3febb8[_0x25b1('0x39')]=qs[_0x25b1('0x2f')](_[_0x25b1('0x3a')](_0x54ce2d[_0x25b1('0x2d')],_0x3a4475[_0x25b1('0x2f')]),_0x362118);if(_0x54ce2d[_0x25b1('0x2d')][_0x25b1('0x3b')]){_0x3febb8[_0x25b1('0x39')]=_[_0x25b1('0x3c')](_0x3febb8[_0x25b1('0x39')],{'$or':_[_0x25b1('0x27')](_0x362118,function(_0x4837d5){if(_0x4837d5[_0x25b1('0x2a')]!==_0x25b1('0x3d')){var _0x53423d={};_0x53423d[_0x4837d5[_0x25b1('0x25')]]={'$like':'%'+_0x54ce2d[_0x25b1('0x2d')][_0x25b1('0x3b')]+'%'};return _0x53423d;}})});}_0x3febb8=_[_0x25b1('0x3c')]({},_0x3febb8,_0x54ce2d[_0x25b1('0x3e')]);var _0x5bdefd={'where':_0x3febb8[_0x25b1('0x39')]};return db['WhatsappQueueReport'][_0x25b1('0x1d')](_0x5bdefd)['then'](function(_0x2e8747){_0x293413[_0x25b1('0x1d')]=_0x2e8747;if(_0x54ce2d[_0x25b1('0x2d')][_0x25b1('0x3f')]){_0x3febb8[_0x25b1('0x40')]=[{'all':!![]}];}return db[_0x25b1('0x28')][_0x25b1('0x41')](_0x3febb8);})[_0x25b1('0x42')](function(_0x3f9754){_0x293413['rows']=_0x3f9754;return _0x293413;})[_0x25b1('0x42')](respondWithFilteredResult(_0x19ecd1,_0x3febb8))['catch'](handleError(_0x19ecd1,null));};exports[_0x25b1('0x43')]=function(_0x2f56ac,_0x4d4e32){var _0x52d3f8={'raw':!![],'where':{'id':_0x2f56ac[_0x25b1('0x44')]['id']}},_0x39b4c7={};_0x39b4c7[_0x25b1('0x2c')]=_[_0x25b1('0x2e')](db[_0x25b1('0x28')][_0x25b1('0x45')]);_0x39b4c7[_0x25b1('0x2d')]=_[_0x25b1('0x2e')](_0x2f56ac[_0x25b1('0x2d')]);_0x39b4c7[_0x25b1('0x2f')]=_[_0x25b1('0x30')](_0x39b4c7[_0x25b1('0x2c')],_0x39b4c7[_0x25b1('0x2d')]);_0x52d3f8[_0x25b1('0x32')]=_[_0x25b1('0x30')](_0x39b4c7[_0x25b1('0x2c')],qs[_0x25b1('0x31')](_0x2f56ac['query']['fields']));_0x52d3f8['attributes']=_0x52d3f8[_0x25b1('0x32')]['length']?_0x52d3f8[_0x25b1('0x32')]:_0x39b4c7['model'];if(_0x2f56ac[_0x25b1('0x2d')][_0x25b1('0x3f')]){_0x52d3f8[_0x25b1('0x40')]=[{'all':!![]}];}_0x52d3f8=_[_0x25b1('0x3c')]({},_0x52d3f8,_0x2f56ac[_0x25b1('0x3e')]);return db[_0x25b1('0x28')]['find'](_0x52d3f8)[_0x25b1('0x42')](handleEntityNotFound(_0x4d4e32,null))[_0x25b1('0x42')](respondWithResult(_0x4d4e32,null))[_0x25b1('0x46')](handleError(_0x4d4e32,null));};exports[_0x25b1('0x47')]=function(_0x58ae67,_0x489f73){return db[_0x25b1('0x28')][_0x25b1('0x47')](_0x58ae67['body'],{})[_0x25b1('0x42')](respondWithResult(_0x489f73,0xc9))['catch'](handleError(_0x489f73,null));};exports[_0x25b1('0x22')]=function(_0x4b6181,_0x543f9b){if(_0x4b6181[_0x25b1('0x48')]['id']){delete _0x4b6181[_0x25b1('0x48')]['id'];}return db[_0x25b1('0x28')][_0x25b1('0x49')]({'where':{'id':_0x4b6181['params']['id']}})[_0x25b1('0x42')](handleEntityNotFound(_0x543f9b,null))['then'](saveUpdates(_0x4b6181[_0x25b1('0x48')],null))['then'](respondWithResult(_0x543f9b,null))[_0x25b1('0x46')](handleError(_0x543f9b,null));};exports[_0x25b1('0x23')]=function(_0x1fcc79,_0x4fb92e){return db[_0x25b1('0x28')][_0x25b1('0x49')]({'where':{'id':_0x1fcc79[_0x25b1('0x44')]['id']}})[_0x25b1('0x42')](handleEntityNotFound(_0x4fb92e,null))[_0x25b1('0x42')](removeEntity(_0x4fb92e,null))[_0x25b1('0x46')](handleError(_0x4fb92e,null));};exports['describe']=function(_0x134c64,_0x133f50){return db[_0x25b1('0x28')][_0x25b1('0x4a')]()[_0x25b1('0x42')](respondWithResult(_0x133f50,null))[_0x25b1('0x46')](handleError(_0x133f50,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.model.js b/server/api/whatsappQueueReport/whatsappQueueReport.model.js index 0cd0269..af19770 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 _0x7002=['exports','define','WhatsappQueueReport','report_whatsapp_queue','uniqueid','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./whatsappQueueReport.attributes'];(function(_0x4e1119,_0x32dc78){var _0x35f53d=function(_0x2bbfe0){while(--_0x2bbfe0){_0x4e1119['push'](_0x4e1119['shift']());}};_0x35f53d(++_0x32dc78);}(_0x7002,0x16d));var _0x2700=function(_0x427217,_0x4039b1){_0x427217=_0x427217-0x0;var _0x5b28fb=_0x7002[_0x427217];return _0x5b28fb;};'use strict';var _=require(_0x2700('0x0'));var util=require('util');var logger=require(_0x2700('0x1'))(_0x2700('0x2'));var moment=require(_0x2700('0x3'));var BPromise=require(_0x2700('0x4'));var rp=require(_0x2700('0x5'));var fs=require('fs');var path=require(_0x2700('0x6'));var rimraf=require(_0x2700('0x7'));var config=require(_0x2700('0x8'));var attributes=require(_0x2700('0x9'));module[_0x2700('0xa')]=function(_0x14a66a,_0x5f5353){return _0x14a66a[_0x2700('0xb')](_0x2700('0xc'),attributes,{'tableName':_0x2700('0xd'),'paranoid':![],'indexes':[{'name':_0x2700('0xe'),'fields':[_0x2700('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xf9be=['bluebird','request-promise','path','rimraf','../../config/environment','./whatsappQueueReport.attributes','define','WhatsappQueueReport','report_whatsapp_queue','uniqueid','util','../../config/logger','api','moment'];(function(_0x428a10,_0x3d945c){var _0x2c1cb7=function(_0x386102){while(--_0x386102){_0x428a10['push'](_0x428a10['shift']());}};_0x2c1cb7(++_0x3d945c);}(_0xf9be,0x192));var _0xef9b=function(_0x16bfae,_0x36ed25){_0x16bfae=_0x16bfae-0x0;var _0x3870f5=_0xf9be[_0x16bfae];return _0x3870f5;};'use strict';var _=require('lodash');var util=require(_0xef9b('0x0'));var logger=require(_0xef9b('0x1'))(_0xef9b('0x2'));var moment=require(_0xef9b('0x3'));var BPromise=require(_0xef9b('0x4'));var rp=require(_0xef9b('0x5'));var fs=require('fs');var path=require(_0xef9b('0x6'));var rimraf=require(_0xef9b('0x7'));var config=require(_0xef9b('0x8'));var attributes=require(_0xef9b('0x9'));module['exports']=function(_0x477cf3,_0x4006d7){return _0x477cf3[_0xef9b('0xa')](_0xef9b('0xb'),attributes,{'tableName':_0xef9b('0xc'),'paranoid':![],'indexes':[{'name':_0xef9b('0xd'),'fields':[_0xef9b('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js b/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js index b5d7173..7601389 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 _0x2c3b=['options','UpdateWhatsappQueueReport','update','raw','where','limit','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','WhatsappQueueReport,\x20%s,\x20%s','request\x20sent','debug','WhatsappQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateWhatsappQueueReport','WhatsappQueueReport','body'];(function(_0x222875,_0x58c290){var _0x47e501=function(_0x4dbe5c){while(--_0x4dbe5c){_0x222875['push'](_0x222875['shift']());}};_0x47e501(++_0x58c290);}(_0x2c3b,0x106));var _0xb2c3=function(_0x1ae491,_0x5b83b9){_0x1ae491=_0x1ae491-0x0;var _0x4958a5=_0x2c3b[_0x1ae491];return _0x4958a5;};'use strict';var _=require(_0xb2c3('0x0'));var util=require('util');var moment=require(_0xb2c3('0x1'));var BPromise=require(_0xb2c3('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb2c3('0x3'));var db=require(_0xb2c3('0x4'))['db'];var utils=require(_0xb2c3('0x5'));var logger=require(_0xb2c3('0x6'))(_0xb2c3('0x7'));var config=require(_0xb2c3('0x8'));var jayson=require(_0xb2c3('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x59d3a6,_0x32a661,_0x5d7261){return new BPromise(function(_0x22125d,_0x172e43){return client[_0xb2c3('0xa')](_0x59d3a6,_0x5d7261)[_0xb2c3('0xb')](function(_0x319445){logger[_0xb2c3('0xc')](_0xb2c3('0xd'),_0x32a661,_0xb2c3('0xe'));logger[_0xb2c3('0xf')](_0xb2c3('0x10'),_0x32a661,_0xb2c3('0xe'),JSON[_0xb2c3('0x11')](_0x319445));if(_0x319445[_0xb2c3('0x12')]){if(_0x319445[_0xb2c3('0x12')][_0xb2c3('0x13')]===0x1f4){logger['error']('WhatsappQueueReport,\x20%s,\x20%s',_0x32a661,_0x319445[_0xb2c3('0x12')]['message']);return _0x172e43(_0x319445[_0xb2c3('0x12')][_0xb2c3('0x14')]);}logger[_0xb2c3('0x12')]('WhatsappQueueReport,\x20%s,\x20%s',_0x32a661,_0x319445[_0xb2c3('0x12')]['message']);return _0x22125d(_0x319445['error'][_0xb2c3('0x14')]);}else{logger[_0xb2c3('0xc')](_0xb2c3('0xd'),_0x32a661,_0xb2c3('0xe'));_0x22125d(_0x319445[_0xb2c3('0x15')][_0xb2c3('0x14')]);}})[_0xb2c3('0x16')](function(_0x334b5f){logger[_0xb2c3('0x12')]('WhatsappQueueReport,\x20%s,\x20%s',_0x32a661,_0x334b5f);_0x172e43(_0x334b5f);});});}exports[_0xb2c3('0x17')]=function(_0x523cbf){var _0x14c435=this;return new Promise(function(_0x2d07a2,_0x2bf3ad){return db[_0xb2c3('0x18')]['create'](_0x523cbf[_0xb2c3('0x19')],{'raw':_0x523cbf[_0xb2c3('0x1a')]?_0x523cbf['options']['raw']===undefined?!![]:![]:!![]})['then'](function(_0x2815e6){logger[_0xb2c3('0xc')](_0xb2c3('0x17'),_0x523cbf);logger['debug'](_0xb2c3('0x17'),_0x523cbf,JSON['stringify'](_0x2815e6));_0x2d07a2(_0x2815e6);})['catch'](function(_0x55711c){logger[_0xb2c3('0x12')](_0xb2c3('0x17'),_0x55711c['message'],_0x523cbf);_0x2bf3ad(_0x14c435[_0xb2c3('0x12')](0x1f4,_0x55711c[_0xb2c3('0x14')]));});});};exports[_0xb2c3('0x1b')]=function(_0x4008ce){var _0x552039=this;return new Promise(function(_0x299748,_0x22d3d7){return db['WhatsappQueueReport'][_0xb2c3('0x1c')](_0x4008ce[_0xb2c3('0x19')],{'raw':_0x4008ce[_0xb2c3('0x1a')]?_0x4008ce[_0xb2c3('0x1a')][_0xb2c3('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4008ce['options']?_0x4008ce[_0xb2c3('0x1a')][_0xb2c3('0x1e')]||null:null,'attributes':_0x4008ce[_0xb2c3('0x1a')]?_0x4008ce['options']['attributes']||null:null,'limit':_0x4008ce['options']?_0x4008ce[_0xb2c3('0x1a')][_0xb2c3('0x1f')]||null:null})['then'](function(_0xf452c5){logger[_0xb2c3('0xc')](_0xb2c3('0x1b'),_0x4008ce);logger['debug']('UpdateWhatsappQueueReport',_0x4008ce,JSON['stringify'](_0xf452c5));_0x299748(_0xf452c5);})[_0xb2c3('0x16')](function(_0x338386){logger[_0xb2c3('0x12')]('UpdateWhatsappQueueReport',_0x338386[_0xb2c3('0x14')],_0x4008ce);_0x22d3d7(_0x552039[_0xb2c3('0x12')](0x1f4,_0x338386[_0xb2c3('0x14')]));});});}; \ No newline at end of file +var _0x95ba=['info','request\x20sent','error','code','WhatsappQueueReport,\x20%s,\x20%s','message','result','catch','WhatsappQueueReport','create','options','raw','then','CreateWhatsappQueueReport','debug','body','attributes','UpdateWhatsappQueueReport','stringify','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request'];(function(_0x484e36,_0x4482d8){var _0xafc85d=function(_0xaba9c8){while(--_0xaba9c8){_0x484e36['push'](_0x484e36['shift']());}};_0xafc85d(++_0x4482d8);}(_0x95ba,0x113));var _0xa95b=function(_0x19e79f,_0x4fa9d1){_0x19e79f=_0x19e79f-0x0;var _0xa76de7=_0x95ba[_0x19e79f];return _0xa76de7;};'use strict';var _=require(_0xa95b('0x0'));var util=require(_0xa95b('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xa95b('0x2'));var fs=require('fs');var Redis=require(_0xa95b('0x3'));var db=require(_0xa95b('0x4'))['db'];var utils=require(_0xa95b('0x5'));var logger=require(_0xa95b('0x6'))(_0xa95b('0x7'));var config=require(_0xa95b('0x8'));var jayson=require(_0xa95b('0x9'));var client=jayson[_0xa95b('0xa')][_0xa95b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5cf102,_0x48e00,_0xd8e213){return new BPromise(function(_0x520f9a,_0x57dc2c){return client[_0xa95b('0xc')](_0x5cf102,_0xd8e213)['then'](function(_0x17cf94){logger[_0xa95b('0xd')]('WhatsappQueueReport,\x20%s,\x20%s',_0x48e00,_0xa95b('0xe'));logger['debug']('WhatsappQueueReport,\x20%s,\x20%s,\x20%s',_0x48e00,_0xa95b('0xe'),JSON['stringify'](_0x17cf94));if(_0x17cf94[_0xa95b('0xf')]){if(_0x17cf94[_0xa95b('0xf')][_0xa95b('0x10')]===0x1f4){logger[_0xa95b('0xf')](_0xa95b('0x11'),_0x48e00,_0x17cf94[_0xa95b('0xf')]['message']);return _0x57dc2c(_0x17cf94[_0xa95b('0xf')]['message']);}logger[_0xa95b('0xf')](_0xa95b('0x11'),_0x48e00,_0x17cf94[_0xa95b('0xf')]['message']);return _0x520f9a(_0x17cf94[_0xa95b('0xf')][_0xa95b('0x12')]);}else{logger[_0xa95b('0xd')](_0xa95b('0x11'),_0x48e00,_0xa95b('0xe'));_0x520f9a(_0x17cf94[_0xa95b('0x13')][_0xa95b('0x12')]);}})[_0xa95b('0x14')](function(_0x3f5228){logger[_0xa95b('0xf')](_0xa95b('0x11'),_0x48e00,_0x3f5228);_0x57dc2c(_0x3f5228);});});}exports['CreateWhatsappQueueReport']=function(_0x1dfd8e){var _0x344a99=this;return new Promise(function(_0x5ee75e,_0x200e10){return db[_0xa95b('0x15')][_0xa95b('0x16')](_0x1dfd8e['body'],{'raw':_0x1dfd8e[_0xa95b('0x17')]?_0x1dfd8e['options'][_0xa95b('0x18')]===undefined?!![]:![]:!![]})[_0xa95b('0x19')](function(_0x591b98){logger[_0xa95b('0xd')](_0xa95b('0x1a'),_0x1dfd8e);logger[_0xa95b('0x1b')]('CreateWhatsappQueueReport',_0x1dfd8e,JSON['stringify'](_0x591b98));_0x5ee75e(_0x591b98);})['catch'](function(_0x2cff47){logger[_0xa95b('0xf')](_0xa95b('0x1a'),_0x2cff47['message'],_0x1dfd8e);_0x200e10(_0x344a99[_0xa95b('0xf')](0x1f4,_0x2cff47[_0xa95b('0x12')]));});});};exports['UpdateWhatsappQueueReport']=function(_0x1d51bf){var _0x194d61=this;return new Promise(function(_0xe080ed,_0x5cf5ed){return db[_0xa95b('0x15')]['update'](_0x1d51bf[_0xa95b('0x1c')],{'raw':_0x1d51bf['options']?_0x1d51bf[_0xa95b('0x17')][_0xa95b('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1d51bf[_0xa95b('0x17')]?_0x1d51bf[_0xa95b('0x17')]['where']||null:null,'attributes':_0x1d51bf['options']?_0x1d51bf[_0xa95b('0x17')][_0xa95b('0x1d')]||null:null,'limit':_0x1d51bf[_0xa95b('0x17')]?_0x1d51bf['options']['limit']||null:null})[_0xa95b('0x19')](function(_0x2742a3){logger[_0xa95b('0xd')]('UpdateWhatsappQueueReport',_0x1d51bf);logger[_0xa95b('0x1b')](_0xa95b('0x1e'),_0x1d51bf,JSON[_0xa95b('0x1f')](_0x2742a3));_0xe080ed(_0x2742a3);})['catch'](function(_0x3d619f){logger[_0xa95b('0xf')](_0xa95b('0x1e'),_0x3d619f[_0xa95b('0x12')],_0x1d51bf);_0x5cf5ed(_0x194d61[_0xa95b('0xf')](0x1f4,_0x3d619f[_0xa95b('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/index.js b/server/api/whatsappTransferReport/index.js index 022652c..9dcf56f 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 _0x9f5f=['../../config/environment','./whatsappTransferReport.controller','get','/describe','isAuthenticated','/:id','show','post','create','destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service'];(function(_0x246977,_0x276c7d){var _0x4ebded=function(_0x58aac1){while(--_0x58aac1){_0x246977['push'](_0x246977['shift']());}};_0x4ebded(++_0x276c7d);}(_0x9f5f,0xd7));var _0xf9f5=function(_0x346737,_0x3e6081){_0x346737=_0x346737-0x0;var _0x1ade2e=_0x9f5f[_0x346737];return _0x1ade2e;};'use strict';var multer=require('multer');var util=require(_0xf9f5('0x0'));var path=require(_0xf9f5('0x1'));var timeout=require(_0xf9f5('0x2'));var express=require(_0xf9f5('0x3'));var router=express[_0xf9f5('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xf9f5('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xf9f5('0x6'));var controller=require(_0xf9f5('0x7'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0xf9f5('0x8')](_0xf9f5('0x9'),auth[_0xf9f5('0xa')](),controller['describe']);router[_0xf9f5('0x8')](_0xf9f5('0xb'),auth[_0xf9f5('0xa')](),controller[_0xf9f5('0xc')]);router[_0xf9f5('0xd')]('/',auth[_0xf9f5('0xa')](),controller[_0xf9f5('0xe')]);router['put'](_0xf9f5('0xb'),auth[_0xf9f5('0xa')](),controller['update']);router['delete']('/:id',auth[_0xf9f5('0xa')](),controller[_0xf9f5('0xf')]);module[_0xf9f5('0x10')]=router; \ No newline at end of file +var _0x6c52=['./whatsappTransferReport.controller','get','index','/describe','describe','/:id','show','put','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x3c192f,_0x282b5a){var _0xfd843=function(_0x5725d5){while(--_0x5725d5){_0x3c192f['push'](_0x3c192f['shift']());}};_0xfd843(++_0x282b5a);}(_0x6c52,0x6e));var _0x26c5=function(_0x3166fc,_0x26cc6b){_0x3166fc=_0x3166fc-0x0;var _0x5d198b=_0x6c52[_0x3166fc];return _0x5d198b;};'use strict';var multer=require(_0x26c5('0x0'));var util=require(_0x26c5('0x1'));var path=require(_0x26c5('0x2'));var timeout=require(_0x26c5('0x3'));var express=require(_0x26c5('0x4'));var router=express[_0x26c5('0x5')]();var fs_extra=require(_0x26c5('0x6'));var auth=require(_0x26c5('0x7'));var interaction=require(_0x26c5('0x8'));var config=require(_0x26c5('0x9'));var controller=require(_0x26c5('0xa'));router[_0x26c5('0xb')]('/',auth['isAuthenticated'](),controller[_0x26c5('0xc')]);router['get'](_0x26c5('0xd'),auth['isAuthenticated'](),controller[_0x26c5('0xe')]);router[_0x26c5('0xb')](_0x26c5('0xf'),auth['isAuthenticated'](),controller[_0x26c5('0x10')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x26c5('0x11')](_0x26c5('0xf'),auth['isAuthenticated'](),controller['update']);router[_0x26c5('0x12')](_0x26c5('0xf'),auth['isAuthenticated'](),controller[_0x26c5('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js b/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js index 32a2cab..e821ff5 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 _0x693f=['agent','queue','DATE','sequelize','exports','STRING','ENUM'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x693f,0x9d));var _0xf693=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x693f[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require(_0xf693('0x0'));module[_0xf693('0x1')]={'uniqueid':{'type':Sequelize[_0xf693('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xf693('0x3')]('account',_0xf693('0x4'),_0xf693('0x5')),'allowNull':![]},'transferredAt':{'type':Sequelize[_0xf693('0x6')]}}; \ No newline at end of file +var _0x0ffc=['account','queue','DATE','exports','STRING'];(function(_0xe74ea6,_0x461881){var _0x133ecd=function(_0x5d9796){while(--_0x5d9796){_0xe74ea6['push'](_0xe74ea6['shift']());}};_0x133ecd(++_0x461881);}(_0x0ffc,0x9e));var _0xc0ff=function(_0x3d47eb,_0x57b1ef){_0x3d47eb=_0x3d47eb-0x0;var _0x4532e2=_0x0ffc[_0x3d47eb];return _0x4532e2;};'use strict';var Sequelize=require('sequelize');module[_0xc0ff('0x0')]={'uniqueid':{'type':Sequelize[_0xc0ff('0x1')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xc0ff('0x2'),'agent',_0xc0ff('0x3')),'allowNull':![]},'transferredAt':{'type':Sequelize[_0xc0ff('0x4')]}}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.controller.js b/server/api/whatsappTransferReport/whatsappTransferReport.controller.js index 6b86cb4..f5ab26c 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 _0x40e8=['keys','filters','intersection','model','attributes','fields','length','nolimit','order','where','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','find','create','body','params','describe','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','fs-extra','lodash','squel','crypto','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','end','json','offset','undefined','limit','count','status','Content-Range','reject','save','update','then','destroy','error','name','send','index','map','WhatsappTransferReport','rawAttributes','fieldName','type','query'];(function(_0x36fc7b,_0x1a4c4b){var _0x20b70f=function(_0x8b9e2a){while(--_0x8b9e2a){_0x36fc7b['push'](_0x36fc7b['shift']());}};_0x20b70f(++_0x1a4c4b);}(_0x40e8,0x1d5));var _0x840e=function(_0x4536a4,_0x55af7b){_0x4536a4=_0x4536a4-0x0;var _0x4fd1c1=_0x40e8[_0x4536a4];return _0x4fd1c1;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x840e('0x0'));var zipdir=require(_0x840e('0x1'));var jsonpatch=require(_0x840e('0x2'));var rp=require('request-promise');var moment=require(_0x840e('0x3'));var BPromise=require(_0x840e('0x4'));var Mustache=require(_0x840e('0x5'));var util=require(_0x840e('0x6'));var path=require(_0x840e('0x7'));var sox=require('sox');var csv=require(_0x840e('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x840e('0x9'));var _=require(_0x840e('0xa'));var squel=require(_0x840e('0xb'));var crypto=require(_0x840e('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x840e('0xd'));var toCsv=require(_0x840e('0x8'));var querystring=require('querystring');var Papa=require(_0x840e('0xe'));var Redis=require(_0x840e('0xf'));var authService=require(_0x840e('0x10'));var qs=require(_0x840e('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x840e('0x12'));var logger=require(_0x840e('0x13'))(_0x840e('0x14'));var utils=require(_0x840e('0x15'));var config=require(_0x840e('0x16'));var licenseUtil=require(_0x840e('0x17'));var db=require(_0x840e('0x18'))['db'];function respondWithStatusCode(_0x4990a2,_0x5060d8){_0x5060d8=_0x5060d8||0xcc;return function(_0x37599e){if(_0x37599e){return _0x4990a2[_0x840e('0x19')](_0x5060d8);}return _0x4990a2['status'](_0x5060d8)[_0x840e('0x1a')]();};}function respondWithResult(_0x35b95c,_0x11348b){_0x11348b=_0x11348b||0xc8;return function(_0x5e1769){if(_0x5e1769){return _0x35b95c['status'](_0x11348b)[_0x840e('0x1b')](_0x5e1769);}};}function respondWithFilteredResult(_0x5dac74,_0x40b980){return function(_0x1cab67){if(_0x1cab67){var _0x1cd735=typeof _0x40b980[_0x840e('0x1c')]===_0x840e('0x1d')&&typeof _0x40b980[_0x840e('0x1e')]===_0x840e('0x1d');var _0x4b7616=_0x1cab67[_0x840e('0x1f')];var _0x322813=_0x1cd735?0x0:_0x40b980[_0x840e('0x1c')];var _0x3e3429=_0x1cd735?_0x1cab67[_0x840e('0x1f')]:_0x40b980[_0x840e('0x1c')]+_0x40b980[_0x840e('0x1e')];var _0x3c4ffa;if(_0x3e3429>=_0x4b7616){_0x3e3429=_0x4b7616;_0x3c4ffa=0xc8;}else{_0x3c4ffa=0xce;}_0x5dac74[_0x840e('0x20')](_0x3c4ffa);return _0x5dac74['set'](_0x840e('0x21'),_0x322813+'-'+_0x3e3429+'/'+_0x4b7616)[_0x840e('0x1b')](_0x1cab67);}return null;};}function patchUpdates(_0x3ef1e8){return function(_0x18f08a){try{jsonpatch['apply'](_0x18f08a,_0x3ef1e8,!![]);}catch(_0x3a9381){return BPromise[_0x840e('0x22')](_0x3a9381);}return _0x18f08a[_0x840e('0x23')]();};}function saveUpdates(_0x1a18e4,_0x4ddb71){return function(_0x844547){if(_0x844547){return _0x844547[_0x840e('0x24')](_0x1a18e4)[_0x840e('0x25')](function(_0x2f81bc){return _0x2f81bc;});}return null;};}function removeEntity(_0x17ff2f,_0x4c8875){return function(_0x5a79c6){if(_0x5a79c6){return _0x5a79c6[_0x840e('0x26')]()[_0x840e('0x25')](function(){_0x17ff2f[_0x840e('0x20')](0xcc)[_0x840e('0x1a')]();});}};}function handleEntityNotFound(_0x35500b,_0x64644a){return function(_0x3eb0b1){if(!_0x3eb0b1){_0x35500b[_0x840e('0x19')](0x194);}return _0x3eb0b1;};}function handleError(_0x4efd91,_0x49c29b){_0x49c29b=_0x49c29b||0x1f4;return function(_0x2eb394){logger[_0x840e('0x27')](_0x2eb394['stack']);if(_0x2eb394[_0x840e('0x28')]){delete _0x2eb394[_0x840e('0x28')];}_0x4efd91[_0x840e('0x20')](_0x49c29b)[_0x840e('0x29')](_0x2eb394);};}exports[_0x840e('0x2a')]=function(_0x3597e3,_0xb54044){var _0x16d919={},_0x37677b={},_0x3f4122={'count':0x0,'rows':[]};var _0x1f4b82=_[_0x840e('0x2b')](db[_0x840e('0x2c')][_0x840e('0x2d')],function(_0x1fba54){return{'name':_0x1fba54[_0x840e('0x2e')],'type':_0x1fba54[_0x840e('0x2f')]['key']};});_0x37677b['model']=_[_0x840e('0x2b')](_0x1f4b82,_0x840e('0x28'));_0x37677b[_0x840e('0x30')]=_[_0x840e('0x31')](_0x3597e3['query']);_0x37677b[_0x840e('0x32')]=_[_0x840e('0x33')](_0x37677b[_0x840e('0x34')],_0x37677b[_0x840e('0x30')]);_0x16d919[_0x840e('0x35')]=_['intersection'](_0x37677b[_0x840e('0x34')],qs[_0x840e('0x36')](_0x3597e3[_0x840e('0x30')][_0x840e('0x36')]));_0x16d919[_0x840e('0x35')]=_0x16d919[_0x840e('0x35')][_0x840e('0x37')]?_0x16d919['attributes']:_0x37677b['model'];if(!_0x3597e3['query']['hasOwnProperty'](_0x840e('0x38'))){_0x16d919[_0x840e('0x1e')]=qs['limit'](_0x3597e3[_0x840e('0x30')][_0x840e('0x1e')]);_0x16d919[_0x840e('0x1c')]=qs['offset'](_0x3597e3[_0x840e('0x30')][_0x840e('0x1c')]);}_0x16d919[_0x840e('0x39')]=qs['sort'](_0x3597e3[_0x840e('0x30')]['sort']);_0x16d919[_0x840e('0x3a')]=qs[_0x840e('0x32')](_['pick'](_0x3597e3['query'],_0x37677b[_0x840e('0x32')]),_0x1f4b82);if(_0x3597e3[_0x840e('0x30')][_0x840e('0x3b')]){_0x16d919[_0x840e('0x3a')]=_['merge'](_0x16d919['where'],{'$or':_['map'](_0x1f4b82,function(_0x3e0d45){if(_0x3e0d45[_0x840e('0x2f')]!==_0x840e('0x3c')){var _0x268e00={};_0x268e00[_0x3e0d45['name']]={'$like':'%'+_0x3597e3[_0x840e('0x30')][_0x840e('0x3b')]+'%'};return _0x268e00;}})});}_0x16d919=_[_0x840e('0x3d')]({},_0x16d919,_0x3597e3[_0x840e('0x3e')]);var _0x609f2e={'where':_0x16d919[_0x840e('0x3a')]};return db['WhatsappTransferReport'][_0x840e('0x1f')](_0x609f2e)[_0x840e('0x25')](function(_0x31604f){_0x3f4122['count']=_0x31604f;if(_0x3597e3['query'][_0x840e('0x3f')]){_0x16d919[_0x840e('0x40')]=[{'all':!![]}];}return db['WhatsappTransferReport'][_0x840e('0x41')](_0x16d919);})[_0x840e('0x25')](function(_0x3ce966){_0x3f4122[_0x840e('0x42')]=_0x3ce966;return _0x3f4122;})[_0x840e('0x25')](respondWithFilteredResult(_0xb54044,_0x16d919))[_0x840e('0x43')](handleError(_0xb54044,null));};exports[_0x840e('0x44')]=function(_0xa7b7db,_0x293d90){var _0x18aa4f={'raw':!![],'where':{'id':_0xa7b7db['params']['id']}},_0xf0e793={};_0xf0e793[_0x840e('0x34')]=_[_0x840e('0x31')](db[_0x840e('0x2c')][_0x840e('0x2d')]);_0xf0e793[_0x840e('0x30')]=_[_0x840e('0x31')](_0xa7b7db[_0x840e('0x30')]);_0xf0e793[_0x840e('0x32')]=_['intersection'](_0xf0e793[_0x840e('0x34')],_0xf0e793[_0x840e('0x30')]);_0x18aa4f[_0x840e('0x35')]=_[_0x840e('0x33')](_0xf0e793[_0x840e('0x34')],qs[_0x840e('0x36')](_0xa7b7db[_0x840e('0x30')][_0x840e('0x36')]));_0x18aa4f[_0x840e('0x35')]=_0x18aa4f[_0x840e('0x35')]['length']?_0x18aa4f['attributes']:_0xf0e793['model'];if(_0xa7b7db[_0x840e('0x30')][_0x840e('0x3f')]){_0x18aa4f[_0x840e('0x40')]=[{'all':!![]}];}_0x18aa4f=_[_0x840e('0x3d')]({},_0x18aa4f,_0xa7b7db['options']);return db['WhatsappTransferReport'][_0x840e('0x45')](_0x18aa4f)[_0x840e('0x25')](handleEntityNotFound(_0x293d90,null))[_0x840e('0x25')](respondWithResult(_0x293d90,null))[_0x840e('0x43')](handleError(_0x293d90,null));};exports[_0x840e('0x46')]=function(_0x1695cf,_0x1a923f){return db[_0x840e('0x2c')][_0x840e('0x46')](_0x1695cf[_0x840e('0x47')],{})[_0x840e('0x25')](respondWithResult(_0x1a923f,0xc9))[_0x840e('0x43')](handleError(_0x1a923f,null));};exports['update']=function(_0x1824c0,_0x345c44){if(_0x1824c0[_0x840e('0x47')]['id']){delete _0x1824c0[_0x840e('0x47')]['id'];}return db[_0x840e('0x2c')][_0x840e('0x45')]({'where':{'id':_0x1824c0[_0x840e('0x48')]['id']}})[_0x840e('0x25')](handleEntityNotFound(_0x345c44,null))[_0x840e('0x25')](saveUpdates(_0x1824c0[_0x840e('0x47')],null))[_0x840e('0x25')](respondWithResult(_0x345c44,null))[_0x840e('0x43')](handleError(_0x345c44,null));};exports[_0x840e('0x26')]=function(_0x508ba1,_0x5011ed){return db[_0x840e('0x2c')][_0x840e('0x45')]({'where':{'id':_0x508ba1['params']['id']}})[_0x840e('0x25')](handleEntityNotFound(_0x5011ed,null))[_0x840e('0x25')](removeEntity(_0x5011ed,null))[_0x840e('0x43')](handleError(_0x5011ed,null));};exports[_0x840e('0x49')]=function(_0x3ba727,_0x545a1a){return db['WhatsappTransferReport'][_0x840e('0x49')]()[_0x840e('0x25')](respondWithResult(_0x545a1a,null))['catch'](handleError(_0x545a1a,null));}; \ No newline at end of file +var _0x3cdd=['sort','filters','pick','filter','where','merge','options','WhatsappTransferReport','includeAll','include','findAll','then','rows','catch','show','params','create','body','find','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','ejs','fs-extra','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','end','error','name','index','rawAttributes','type','key','map','keys','query','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order'];(function(_0x2692f9,_0x51138a){var _0x9831c8=function(_0x112bbd){while(--_0x112bbd){_0x2692f9['push'](_0x2692f9['shift']());}};_0x9831c8(++_0x51138a);}(_0x3cdd,0xb5));var _0xd3cd=function(_0x405142,_0x5525c4){_0x405142=_0x405142-0x0;var _0x2a57b2=_0x3cdd[_0x405142];return _0x2a57b2;};'use strict';var emlformat=require(_0xd3cd('0x0'));var rimraf=require(_0xd3cd('0x1'));var zipdir=require(_0xd3cd('0x2'));var jsonpatch=require(_0xd3cd('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xd3cd('0x4'));var Mustache=require(_0xd3cd('0x5'));var util=require(_0xd3cd('0x6'));var path=require(_0xd3cd('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xd3cd('0x8'));var fs=require('fs');var fs_extra=require(_0xd3cd('0x9'));var _=require('lodash');var squel=require(_0xd3cd('0xa'));var crypto=require(_0xd3cd('0xb'));var jsforce=require(_0xd3cd('0xc'));var deskjs=require(_0xd3cd('0xd'));var toCsv=require(_0xd3cd('0xe'));var querystring=require(_0xd3cd('0xf'));var Papa=require(_0xd3cd('0x10'));var Redis=require(_0xd3cd('0x11'));var authService=require(_0xd3cd('0x12'));var qs=require(_0xd3cd('0x13'));var as=require(_0xd3cd('0x14'));var hardwareService=require(_0xd3cd('0x15'));var logger=require(_0xd3cd('0x16'))(_0xd3cd('0x17'));var utils=require(_0xd3cd('0x18'));var config=require(_0xd3cd('0x19'));var licenseUtil=require(_0xd3cd('0x1a'));var db=require(_0xd3cd('0x1b'))['db'];function respondWithStatusCode(_0x307cc2,_0x1580b9){_0x1580b9=_0x1580b9||0xcc;return function(_0x4c5d66){if(_0x4c5d66){return _0x307cc2[_0xd3cd('0x1c')](_0x1580b9);}return _0x307cc2[_0xd3cd('0x1d')](_0x1580b9)['end']();};}function respondWithResult(_0x5dcfd7,_0x390ee4){_0x390ee4=_0x390ee4||0xc8;return function(_0x1deb88){if(_0x1deb88){return _0x5dcfd7[_0xd3cd('0x1d')](_0x390ee4)[_0xd3cd('0x1e')](_0x1deb88);}};}function respondWithFilteredResult(_0x3f4a73,_0x3e2b15){return function(_0x474dcc){if(_0x474dcc){var _0x159683=typeof _0x3e2b15[_0xd3cd('0x1f')]===_0xd3cd('0x20')&&typeof _0x3e2b15[_0xd3cd('0x21')]===_0xd3cd('0x20');var _0x1c7af8=_0x474dcc['count'];var _0x56fdba=_0x159683?0x0:_0x3e2b15['offset'];var _0x861d67=_0x159683?_0x474dcc[_0xd3cd('0x22')]:_0x3e2b15[_0xd3cd('0x1f')]+_0x3e2b15[_0xd3cd('0x21')];var _0x1ef6d1;if(_0x861d67>=_0x1c7af8){_0x861d67=_0x1c7af8;_0x1ef6d1=0xc8;}else{_0x1ef6d1=0xce;}_0x3f4a73[_0xd3cd('0x1d')](_0x1ef6d1);return _0x3f4a73[_0xd3cd('0x23')](_0xd3cd('0x24'),_0x56fdba+'-'+_0x861d67+'/'+_0x1c7af8)[_0xd3cd('0x1e')](_0x474dcc);}return null;};}function patchUpdates(_0x2e43ac){return function(_0x2ea280){try{jsonpatch[_0xd3cd('0x25')](_0x2ea280,_0x2e43ac,!![]);}catch(_0x1063f6){return BPromise[_0xd3cd('0x26')](_0x1063f6);}return _0x2ea280[_0xd3cd('0x27')]();};}function saveUpdates(_0x115a2,_0x5e354d){return function(_0x293f4e){if(_0x293f4e){return _0x293f4e[_0xd3cd('0x28')](_0x115a2)['then'](function(_0x152c17){return _0x152c17;});}return null;};}function removeEntity(_0x182e72,_0x511bbb){return function(_0x4f24b6){if(_0x4f24b6){return _0x4f24b6['destroy']()['then'](function(){_0x182e72[_0xd3cd('0x1d')](0xcc)[_0xd3cd('0x29')]();});}};}function handleEntityNotFound(_0x55a3cf,_0x2b7e69){return function(_0x28ceac){if(!_0x28ceac){_0x55a3cf['sendStatus'](0x194);}return _0x28ceac;};}function handleError(_0x4679b3,_0x2598a3){_0x2598a3=_0x2598a3||0x1f4;return function(_0x2e183c){logger[_0xd3cd('0x2a')](_0x2e183c['stack']);if(_0x2e183c[_0xd3cd('0x2b')]){delete _0x2e183c[_0xd3cd('0x2b')];}_0x4679b3[_0xd3cd('0x1d')](_0x2598a3)['send'](_0x2e183c);};}exports[_0xd3cd('0x2c')]=function(_0x483bf1,_0x2364ab){var _0x292977={},_0x5dbccf={},_0x2b3ea5={'count':0x0,'rows':[]};var _0x5dcbe8=_['map'](db['WhatsappTransferReport'][_0xd3cd('0x2d')],function(_0x8b03f9){return{'name':_0x8b03f9['fieldName'],'type':_0x8b03f9[_0xd3cd('0x2e')][_0xd3cd('0x2f')]};});_0x5dbccf['model']=_[_0xd3cd('0x30')](_0x5dcbe8,_0xd3cd('0x2b'));_0x5dbccf['query']=_[_0xd3cd('0x31')](_0x483bf1[_0xd3cd('0x32')]);_0x5dbccf['filters']=_[_0xd3cd('0x33')](_0x5dbccf[_0xd3cd('0x34')],_0x5dbccf['query']);_0x292977['attributes']=_[_0xd3cd('0x33')](_0x5dbccf['model'],qs[_0xd3cd('0x35')](_0x483bf1[_0xd3cd('0x32')][_0xd3cd('0x35')]));_0x292977[_0xd3cd('0x36')]=_0x292977[_0xd3cd('0x36')][_0xd3cd('0x37')]?_0x292977[_0xd3cd('0x36')]:_0x5dbccf[_0xd3cd('0x34')];if(!_0x483bf1[_0xd3cd('0x32')][_0xd3cd('0x38')](_0xd3cd('0x39'))){_0x292977['limit']=qs['limit'](_0x483bf1[_0xd3cd('0x32')][_0xd3cd('0x21')]);_0x292977[_0xd3cd('0x1f')]=qs['offset'](_0x483bf1[_0xd3cd('0x32')]['offset']);}_0x292977[_0xd3cd('0x3a')]=qs[_0xd3cd('0x3b')](_0x483bf1['query'][_0xd3cd('0x3b')]);_0x292977['where']=qs[_0xd3cd('0x3c')](_[_0xd3cd('0x3d')](_0x483bf1['query'],_0x5dbccf[_0xd3cd('0x3c')]),_0x5dcbe8);if(_0x483bf1[_0xd3cd('0x32')][_0xd3cd('0x3e')]){_0x292977[_0xd3cd('0x3f')]=_['merge'](_0x292977[_0xd3cd('0x3f')],{'$or':_[_0xd3cd('0x30')](_0x5dcbe8,function(_0x21824d){if(_0x21824d[_0xd3cd('0x2e')]!=='VIRTUAL'){var _0x2aad88={};_0x2aad88[_0x21824d[_0xd3cd('0x2b')]]={'$like':'%'+_0x483bf1[_0xd3cd('0x32')]['filter']+'%'};return _0x2aad88;}})});}_0x292977=_[_0xd3cd('0x40')]({},_0x292977,_0x483bf1[_0xd3cd('0x41')]);var _0x450e31={'where':_0x292977[_0xd3cd('0x3f')]};return db[_0xd3cd('0x42')]['count'](_0x450e31)['then'](function(_0x1e6ae1){_0x2b3ea5[_0xd3cd('0x22')]=_0x1e6ae1;if(_0x483bf1[_0xd3cd('0x32')][_0xd3cd('0x43')]){_0x292977[_0xd3cd('0x44')]=[{'all':!![]}];}return db['WhatsappTransferReport'][_0xd3cd('0x45')](_0x292977);})[_0xd3cd('0x46')](function(_0x547950){_0x2b3ea5[_0xd3cd('0x47')]=_0x547950;return _0x2b3ea5;})[_0xd3cd('0x46')](respondWithFilteredResult(_0x2364ab,_0x292977))[_0xd3cd('0x48')](handleError(_0x2364ab,null));};exports[_0xd3cd('0x49')]=function(_0x7903cd,_0x41fdd6){var _0x3a01e0={'raw':!![],'where':{'id':_0x7903cd[_0xd3cd('0x4a')]['id']}},_0x2b2789={};_0x2b2789['model']=_['keys'](db[_0xd3cd('0x42')][_0xd3cd('0x2d')]);_0x2b2789[_0xd3cd('0x32')]=_['keys'](_0x7903cd[_0xd3cd('0x32')]);_0x2b2789['filters']=_[_0xd3cd('0x33')](_0x2b2789[_0xd3cd('0x34')],_0x2b2789[_0xd3cd('0x32')]);_0x3a01e0[_0xd3cd('0x36')]=_[_0xd3cd('0x33')](_0x2b2789['model'],qs['fields'](_0x7903cd[_0xd3cd('0x32')][_0xd3cd('0x35')]));_0x3a01e0['attributes']=_0x3a01e0['attributes'][_0xd3cd('0x37')]?_0x3a01e0[_0xd3cd('0x36')]:_0x2b2789[_0xd3cd('0x34')];if(_0x7903cd['query']['includeAll']){_0x3a01e0[_0xd3cd('0x44')]=[{'all':!![]}];}_0x3a01e0=_[_0xd3cd('0x40')]({},_0x3a01e0,_0x7903cd[_0xd3cd('0x41')]);return db[_0xd3cd('0x42')]['find'](_0x3a01e0)[_0xd3cd('0x46')](handleEntityNotFound(_0x41fdd6,null))[_0xd3cd('0x46')](respondWithResult(_0x41fdd6,null))[_0xd3cd('0x48')](handleError(_0x41fdd6,null));};exports['create']=function(_0x59537a,_0x258123){return db['WhatsappTransferReport'][_0xd3cd('0x4b')](_0x59537a['body'],{})[_0xd3cd('0x46')](respondWithResult(_0x258123,0xc9))[_0xd3cd('0x48')](handleError(_0x258123,null));};exports[_0xd3cd('0x28')]=function(_0x50d96d,_0x520a29){if(_0x50d96d[_0xd3cd('0x4c')]['id']){delete _0x50d96d[_0xd3cd('0x4c')]['id'];}return db[_0xd3cd('0x42')][_0xd3cd('0x4d')]({'where':{'id':_0x50d96d[_0xd3cd('0x4a')]['id']}})['then'](handleEntityNotFound(_0x520a29,null))[_0xd3cd('0x46')](saveUpdates(_0x50d96d['body'],null))['then'](respondWithResult(_0x520a29,null))[_0xd3cd('0x48')](handleError(_0x520a29,null));};exports[_0xd3cd('0x4e')]=function(_0x4ffdde,_0x52d734){return db[_0xd3cd('0x42')]['find']({'where':{'id':_0x4ffdde[_0xd3cd('0x4a')]['id']}})[_0xd3cd('0x46')](handleEntityNotFound(_0x52d734,null))[_0xd3cd('0x46')](removeEntity(_0x52d734,null))[_0xd3cd('0x48')](handleError(_0x52d734,null));};exports[_0xd3cd('0x4f')]=function(_0xee9238,_0xe50480){return db[_0xd3cd('0x42')][_0xd3cd('0x4f')]()[_0xd3cd('0x46')](respondWithResult(_0xe50480,null))[_0xd3cd('0x48')](handleError(_0xe50480,null));}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.model.js b/server/api/whatsappTransferReport/whatsappTransferReport.model.js index 6ef6229..508d597 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 _0x2f3e=['exports','define','WhatsappTransferReport','report_whatsapp_transfer','uniqueid','lodash','util','api','moment','path','rimraf','../../config/environment','./whatsappTransferReport.attributes'];(function(_0x2f3848,_0x48564d){var _0x102668=function(_0x5e32ab){while(--_0x5e32ab){_0x2f3848['push'](_0x2f3848['shift']());}};_0x102668(++_0x48564d);}(_0x2f3e,0xae));var _0xe2f3=function(_0x386c3e,_0x44a375){_0x386c3e=_0x386c3e-0x0;var _0x4b8e13=_0x2f3e[_0x386c3e];return _0x4b8e13;};'use strict';var _=require(_0xe2f3('0x0'));var util=require(_0xe2f3('0x1'));var logger=require('../../config/logger')(_0xe2f3('0x2'));var moment=require(_0xe2f3('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xe2f3('0x4'));var rimraf=require(_0xe2f3('0x5'));var config=require(_0xe2f3('0x6'));var attributes=require(_0xe2f3('0x7'));module[_0xe2f3('0x8')]=function(_0xc26186,_0x3e4799){return _0xc26186[_0xe2f3('0x9')](_0xe2f3('0xa'),attributes,{'tableName':_0xe2f3('0xb'),'paranoid':![],'indexes':[{'name':_0xe2f3('0xc'),'fields':[_0xe2f3('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x5481=['uniqueid','util','../../config/logger','api','moment','request-promise','rimraf','../../config/environment','./whatsappTransferReport.attributes','exports'];(function(_0x5094fc,_0x161ded){var _0x1fe781=function(_0x1fb984){while(--_0x1fb984){_0x5094fc['push'](_0x5094fc['shift']());}};_0x1fe781(++_0x161ded);}(_0x5481,0x6f));var _0x1548=function(_0x534462,_0x502972){_0x534462=_0x534462-0x0;var _0x41c5dd=_0x5481[_0x534462];return _0x41c5dd;};'use strict';var _=require('lodash');var util=require(_0x1548('0x0'));var logger=require(_0x1548('0x1'))(_0x1548('0x2'));var moment=require(_0x1548('0x3'));var BPromise=require('bluebird');var rp=require(_0x1548('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x1548('0x5'));var config=require(_0x1548('0x6'));var attributes=require(_0x1548('0x7'));module[_0x1548('0x8')]=function(_0x49d320,_0x4a2a47){return _0x49d320['define']('WhatsappTransferReport',attributes,{'tableName':'report_whatsapp_transfer','paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x1548('0x9')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js b/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js index d33dacc..732e214 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 _0x64f1=['../../config/environment','jayson/promise','client','http','request','then','WhatsappTransferReport,\x20%s,\x20%s','request\x20sent','debug','WhatsappTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','randomstring','ioredis','../../config/utils','rpc'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x64f1,0xeb));var _0x164f=function(_0x432fca,_0xb0b1b5){_0x432fca=_0x432fca-0x0;var _0x3adba4=_0x64f1[_0x432fca];return _0x3adba4;};'use strict';var _=require(_0x164f('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x164f('0x1'));var fs=require('fs');var Redis=require(_0x164f('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x164f('0x3'));var logger=require('../../config/logger')(_0x164f('0x4'));var config=require(_0x164f('0x5'));var jayson=require(_0x164f('0x6'));var client=jayson[_0x164f('0x7')][_0x164f('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3617ac,_0x5584c2,_0x5e28e9){return new BPromise(function(_0x3738b2,_0x27cc08){return client[_0x164f('0x9')](_0x3617ac,_0x5e28e9)[_0x164f('0xa')](function(_0x1d3231){logger['info'](_0x164f('0xb'),_0x5584c2,_0x164f('0xc'));logger[_0x164f('0xd')](_0x164f('0xe'),_0x5584c2,'request\x20sent',JSON[_0x164f('0xf')](_0x1d3231));if(_0x1d3231[_0x164f('0x10')]){if(_0x1d3231['error']['code']===0x1f4){logger[_0x164f('0x10')]('WhatsappTransferReport,\x20%s,\x20%s',_0x5584c2,_0x1d3231[_0x164f('0x10')][_0x164f('0x11')]);return _0x27cc08(_0x1d3231[_0x164f('0x10')][_0x164f('0x11')]);}logger[_0x164f('0x10')](_0x164f('0xb'),_0x5584c2,_0x1d3231[_0x164f('0x10')][_0x164f('0x11')]);return _0x3738b2(_0x1d3231[_0x164f('0x10')][_0x164f('0x11')]);}else{logger['info'](_0x164f('0xb'),_0x5584c2,_0x164f('0xc'));_0x3738b2(_0x1d3231[_0x164f('0x12')][_0x164f('0x11')]);}})[_0x164f('0x13')](function(_0x5861b9){logger[_0x164f('0x10')](_0x164f('0xb'),_0x5584c2,_0x5861b9);_0x27cc08(_0x5861b9);});});} \ No newline at end of file +var _0xea5f=['../../config/environment','jayson/promise','http','request','info','WhatsappTransferReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','lodash','util','bluebird','randomstring','../../mysqldb','rpc'];(function(_0x65f116,_0x55f9b5){var _0x3a08c6=function(_0x3ae98f){while(--_0x3ae98f){_0x65f116['push'](_0x65f116['shift']());}};_0x3a08c6(++_0x55f9b5);}(_0xea5f,0xf1));var _0xfea5=function(_0x273c39,_0x1052e6){_0x273c39=_0x273c39-0x0;var _0x46d6b5=_0xea5f[_0x273c39];return _0x46d6b5;};'use strict';var _=require(_0xfea5('0x0'));var util=require(_0xfea5('0x1'));var moment=require('moment');var BPromise=require(_0xfea5('0x2'));var rs=require(_0xfea5('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xfea5('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xfea5('0x5'));var config=require(_0xfea5('0x6'));var jayson=require(_0xfea5('0x7'));var client=jayson['client'][_0xfea5('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x37a906,_0x1c5c47,_0x23a488){return new BPromise(function(_0x3b3798,_0x545074){return client[_0xfea5('0x9')](_0x37a906,_0x23a488)['then'](function(_0x4cbedf){logger[_0xfea5('0xa')](_0xfea5('0xb'),_0x1c5c47,_0xfea5('0xc'));logger[_0xfea5('0xd')]('WhatsappTransferReport,\x20%s,\x20%s,\x20%s',_0x1c5c47,'request\x20sent',JSON[_0xfea5('0xe')](_0x4cbedf));if(_0x4cbedf[_0xfea5('0xf')]){if(_0x4cbedf[_0xfea5('0xf')][_0xfea5('0x10')]===0x1f4){logger['error'](_0xfea5('0xb'),_0x1c5c47,_0x4cbedf[_0xfea5('0xf')]['message']);return _0x545074(_0x4cbedf['error']['message']);}logger[_0xfea5('0xf')]('WhatsappTransferReport,\x20%s,\x20%s',_0x1c5c47,_0x4cbedf[_0xfea5('0xf')]['message']);return _0x3b3798(_0x4cbedf[_0xfea5('0xf')]['message']);}else{logger[_0xfea5('0xa')](_0xfea5('0xb'),_0x1c5c47,_0xfea5('0xc'));_0x3b3798(_0x4cbedf['result'][_0xfea5('0x11')]);}})[_0xfea5('0x12')](function(_0x2c41b8){logger[_0xfea5('0xf')](_0xfea5('0xb'),_0x1c5c47,_0x2c41b8);_0x545074(_0x2c41b8);});});} \ No newline at end of file diff --git a/server/app.js b/server/app.js index 6bbcecb..03324d3 100644 --- a/server/app.js +++ b/server/app.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x444e=['exitCode','number','length','\x20processes\x20failed\x20at\x20startup:\x20','map','pm2_env','name','online','Offline\x20apps:','None','App\x20Ready!','catch','log','Server\x20failed\x20to\x20start\x20due\x20to\x20error!','exit','lodash','./config/seedDB','./rpc','./config/logger','./config/pm2','./config/pm2/config','./config/schedule','./config/schedule/chat','./config/schedule/whatsapp','./config/schedule/transcribe','sequelize','then','default','start','info','filter'];(function(_0x51e79c,_0x51485e){var _0x2467be=function(_0xbf70f0){while(--_0xbf70f0){_0x51e79c['push'](_0x51e79c['shift']());}};_0x2467be(++_0x51485e);}(_0x444e,0xe8));var _0xe444=function(_0x4d4d56,_0xd44298){_0x4d4d56=_0x4d4d56-0x0;var _0x93cb29=_0x444e[_0x4d4d56];return _0x93cb29;};'use strict';var _=require(_0xe444('0x0'));var db=require('./mysqldb')['db'];var seedDb=require(_0xe444('0x1'));var checkLicense=require('./config/license');var rpc=require(_0xe444('0x2'));var config=require('./config/environment');var logger=require(_0xe444('0x3'))('app');var pm2=require(_0xe444('0x4'));var pm2Config=require(_0xe444('0x5'));var schedule=require(_0xe444('0x6'));var chat=require(_0xe444('0x7'));var whatsapp=require(_0xe444('0x8'));var transcribe=require(_0xe444('0x9'));var provider=require('./config/schedule/cloud-provider');function main(){return db[_0xe444('0xa')]['sync']()[_0xe444('0xb')](function(){if(config['seedDB']){return seedDb[_0xe444('0xc')]();}})[_0xe444('0xb')](function(){return checkLicense[_0xe444('0xc')]();})['then'](function(){return rpc['listen']();})[_0xe444('0xb')](function(_0x1f41ff){logger['info'](_0x1f41ff);return chat[_0xe444('0xd')]();})['then'](function(){return whatsapp['start']();})[_0xe444('0xb')](function(){return schedule['start']();})[_0xe444('0xb')](function(){return transcribe[_0xe444('0xd')]();})['then'](function(){return provider[_0xe444('0xd')]();})['then'](function(_0x5ba044){logger[_0xe444('0xe')](_0x5ba044);return pm2[_0xe444('0xd')](pm2Config);})['then'](function(_0x192c1a){var _0x5d739a=_0x192c1a[_0xe444('0xf')](function(_0x3acd97){return typeof _0x3acd97[_0xe444('0x10')]===_0xe444('0x11')&&_0x3acd97[_0xe444('0x10')]>=0x0;});if(_0x5d739a[_0xe444('0x12')]>0x0){throw new Error(_0x5d739a[_0xe444('0x12')]+_0xe444('0x13')+_[_0xe444('0x14')](_0x5d739a,function(_0x4009c7){return'\x22'+_0x4009c7[_0xe444('0x15')][_0xe444('0x16')]+'\x22';}));}logger[_0xe444('0xe')]('Online\x20apps:',_[_0xe444('0x14')](_[_0xe444('0xf')](_0x192c1a,{'status':_0xe444('0x17')}),_0xe444('0x16'))['join']());logger[_0xe444('0xe')](_0xe444('0x18'),_[_0xe444('0x14')](_[_0xe444('0xf')](_0x192c1a,function(_0x37c15e){return _0x37c15e['status']!==_0xe444('0x17');}),_0xe444('0x16'))['join']()||_0xe444('0x19'));console['log'](_0xe444('0x1a'));})[_0xe444('0x1b')](function(_0x3d36c7){console[_0xe444('0x1c')](_0xe444('0x1d'),_0x3d36c7);logger['error']('Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s',_0x3d36c7);process[_0xe444('0x1e')](0x1);});}main(); \ No newline at end of file +var _0x1ffe=['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','app','./config/pm2','./config/pm2/config','./config/schedule','./config/schedule/chat','./config/schedule/cloud-provider','sequelize','sync','then','seedDB','default','listen','info','start','filter','length','\x20processes\x20failed\x20at\x20startup:\x20','map','pm2_env','Online\x20apps:','online','join','Offline\x20apps:','status','name','None','log','App\x20Ready!'];(function(_0x442418,_0x3a39d1){var _0x5c4a8a=function(_0x15364e){while(--_0x15364e){_0x442418['push'](_0x442418['shift']());}};_0x5c4a8a(++_0x3a39d1);}(_0x1ffe,0xa5));var _0xe1ff=function(_0x4fb375,_0x9b1bea){_0x4fb375=_0x4fb375-0x0;var _0x304fa8=_0x1ffe[_0x4fb375];return _0x304fa8;};'use strict';var _=require(_0xe1ff('0x0'));var db=require(_0xe1ff('0x1'))['db'];var seedDb=require(_0xe1ff('0x2'));var checkLicense=require(_0xe1ff('0x3'));var rpc=require(_0xe1ff('0x4'));var config=require(_0xe1ff('0x5'));var logger=require(_0xe1ff('0x6'))(_0xe1ff('0x7'));var pm2=require(_0xe1ff('0x8'));var pm2Config=require(_0xe1ff('0x9'));var schedule=require(_0xe1ff('0xa'));var chat=require(_0xe1ff('0xb'));var whatsapp=require('./config/schedule/whatsapp');var transcribe=require('./config/schedule/transcribe');var provider=require(_0xe1ff('0xc'));function main(){return db[_0xe1ff('0xd')][_0xe1ff('0xe')]()[_0xe1ff('0xf')](function(){if(config[_0xe1ff('0x10')]){return seedDb[_0xe1ff('0x11')]();}})[_0xe1ff('0xf')](function(){return checkLicense[_0xe1ff('0x11')]();})[_0xe1ff('0xf')](function(){return rpc[_0xe1ff('0x12')]();})[_0xe1ff('0xf')](function(_0x5f51d3){logger[_0xe1ff('0x13')](_0x5f51d3);return chat[_0xe1ff('0x14')]();})[_0xe1ff('0xf')](function(){return whatsapp[_0xe1ff('0x14')]();})[_0xe1ff('0xf')](function(){return schedule[_0xe1ff('0x14')]();})[_0xe1ff('0xf')](function(){return transcribe[_0xe1ff('0x14')]();})[_0xe1ff('0xf')](function(){return provider[_0xe1ff('0x14')]();})[_0xe1ff('0xf')](function(_0x1010ef){logger['info'](_0x1010ef);return pm2[_0xe1ff('0x14')](pm2Config);})[_0xe1ff('0xf')](function(_0x26511f){var _0x486942=_0x26511f[_0xe1ff('0x15')](function(_0x45597a){return typeof _0x45597a['exitCode']==='number'&&_0x45597a['exitCode']>=0x0;});if(_0x486942[_0xe1ff('0x16')]>0x0){throw new Error(_0x486942[_0xe1ff('0x16')]+_0xe1ff('0x17')+_[_0xe1ff('0x18')](_0x486942,function(_0x45c3be){return'\x22'+_0x45c3be[_0xe1ff('0x19')]['name']+'\x22';}));}logger['info'](_0xe1ff('0x1a'),_[_0xe1ff('0x18')](_[_0xe1ff('0x15')](_0x26511f,{'status':_0xe1ff('0x1b')}),'name')[_0xe1ff('0x1c')]());logger[_0xe1ff('0x13')](_0xe1ff('0x1d'),_[_0xe1ff('0x18')](_[_0xe1ff('0x15')](_0x26511f,function(_0x149cd7){return _0x149cd7[_0xe1ff('0x1e')]!==_0xe1ff('0x1b');}),_0xe1ff('0x1f'))[_0xe1ff('0x1c')]()||_0xe1ff('0x20'));console[_0xe1ff('0x21')](_0xe1ff('0x22'));})[_0xe1ff('0x23')](function(_0x37face){console[_0xe1ff('0x21')](_0xe1ff('0x24'),_0x37face);logger[_0xe1ff('0x25')](_0xe1ff('0x26'),_0x37face);process[_0xe1ff('0x27')](0x1);});}main(); \ No newline at end of file diff --git a/server/components/auth/service.js b/server/components/auth/service.js index 0de9354..90248d7 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 _0x7916=['cookie','motion.token','redirect','send','retrieveApiKey','isNil','generateApiKey','apiKeyIat','regenerateApiKey','query','Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one','validatePasswordPattern','test','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','validatePasswordHistory','toLowerCase','The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.','The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.','ValidationError','updatePasswordsHistory','decryptString','split','length','splice','join','promisify','sign','secret','secrets','options','verify','randomBytes','toString','hex','now','HS512','../../mysqldb','../../config/license/hardware','../../config/license/util','lodash','jsonwebtoken','express-jwt','composable-middleware','crypto','util','moment','session','fullname','email','userpic','md5secret','voicePause','chatPause','faxPause','smsPause','openchannelPause','pauseType','showWebBar','lastLoginAt','lastPauseAt','crudPermissions','allowmessenger','passwordResetAt','alias','phoneBarDnd','phoneBarEnableDtmfTone','phoneBarExpires','phoneBarPrefixRequired','phoneBarRemoteControlPort','interface','userProfileId','settingsEnabled','wssPort','downloadOmnichannelInteractions','ignorePauseForPreviewCalls','selectRecallMeCampaign','chatAutoanswer','chatAutoanswerDelay','emailAutoanswer','emailAutoanswerDelay','smsAutoanswer','openchannelAutoanswer','openchannelAutoanswerDelay','faxAutoanswerDelay','whatsappAutoanswer','messengerSoundNotification','isChatInteractionAuthorized','isAuthenticated','use','params','disposition','status','unmanaged','Forbidden.','headers','authorization','startsWith','find','name','then','authenticate','pass','json','Wrong\x20credentials.','user','Bearer','apikey','getUuid','User','sub','findOne','apiKeyNonce','nonce','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','Invalid\x20API\x20access\x20key','blockDuration','blockedAt','add','minutes','catch','User\x20object\x20not\x20found.','canUpdate','getLicense','update','Forbidden','isWebrtcLicence','webrtc','isMiddleware','signToken','role'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x7916,0x128));var _0x6791=function(_0x1bc76e,_0x3c2452){_0x1bc76e=_0x1bc76e-0x0;var _0x549281=_0x7916[_0x1bc76e];return _0x549281;};'use strict';var db=require(_0x6791('0x0'))['db'];var config=require('../../config/environment');var hardwareConf=require(_0x6791('0x1'));var licenseUtil=require(_0x6791('0x2'));var encryptor=require('../encryptor');var _=require(_0x6791('0x3'));var jwt=require(_0x6791('0x4'));var expressJwt=require(_0x6791('0x5'));var compose=require(_0x6791('0x6'));var basicAuth=require('basic-auth');var crypto=require(_0x6791('0x7'));var BPromise=require('bluebird');var util=require(_0x6791('0x8'));var moment=require(_0x6791('0x9'));var validateJwt=expressJwt({'secret':config['secrets'][_0x6791('0xa')]});var userAttributes=['id','role',_0x6791('0xb'),'name','internal',_0x6791('0xc'),_0x6791('0xd'),'permissions',_0x6791('0xe'),_0x6791('0xf'),_0x6791('0x10'),'mailPause',_0x6791('0x11'),_0x6791('0x12'),_0x6791('0x13'),_0x6791('0x14'),_0x6791('0x15'),_0x6791('0x16'),_0x6791('0x17'),_0x6791('0x18'),_0x6791('0x19'),_0x6791('0x1a'),_0x6791('0x1b'),'phoneBarAutoAnswer','phoneBarAutoAnswerDelay',_0x6791('0x1c'),'phoneBarEnableRecording',_0x6791('0x1d'),'phoneBarEnableSettings',_0x6791('0x1e'),_0x6791('0x1f'),'phoneBarRemoteControl',_0x6791('0x20'),'hotdesk',_0x6791('0x21'),_0x6791('0x22'),'privacyEnabled',_0x6791('0x23'),_0x6791('0x24'),'downloadVoiceRecordings',_0x6791('0x25'),'downloadAttachments',_0x6791('0x26'),_0x6791('0x27'),_0x6791('0x28'),_0x6791('0x29'),_0x6791('0x2a'),_0x6791('0x2b'),_0x6791('0x2c'),'smsAutoanswerDelay',_0x6791('0x2d'),_0x6791('0x2e'),'faxAutoanswer',_0x6791('0x2f'),_0x6791('0x30'),'whatsappAutoanswerDelay',_0x6791('0x31')];exports[_0x6791('0x32')]=function(){return this[_0x6791('0x33')](!![])[_0x6791('0x34')](function(_0x56ad28,_0x3e17b3,_0x1b516d){if(_0x56ad28['user']){_0x1b516d();}else{return db['ChatInteraction']['findOne']({'where':{'id':_0x56ad28[_0x6791('0x35')]['id']},'attributes':['id','closed',_0x6791('0x36')],'raw':!![]})['then'](function(_0x54a092){if(_0x54a092&&_0x54a092['closed']){return _0x3e17b3[_0x6791('0x37')](_0x54a092[_0x6791('0x36')]===_0x6791('0x38')?0x195:0x193)['json']({'message':_0x54a092[_0x6791('0x36')]===_0x6791('0x38')?'Unmanaged.':_0x6791('0x39')});}else{_0x1b516d();}})['catch'](function(_0x424b0e){_0x1b516d(_0x424b0e);});}});};exports['isAuthenticated']=function isAuthenticated(_0x4fc5d5){return compose()[_0x6791('0x34')](function(_0x551718,_0x2f56a2,_0x34b006){var _0x483d6c;if(_0x551718[_0x6791('0x3a')][_0x6791('0x3b')]){if(_[_0x6791('0x3c')](_0x551718[_0x6791('0x3a')]['authorization'],'Basic')){var _0x348b9c=basicAuth(_0x551718);db['User'][_0x6791('0x3d')]({'where':{'name':_0x348b9c[_0x6791('0x3e')]}})[_0x6791('0x3f')](function(_0x2b98b8){if(!_0x2b98b8||!_0x2b98b8[_0x6791('0x40')](_0x348b9c[_0x6791('0x41')])){return _0x2f56a2[_0x6791('0x37')](0x191)[_0x6791('0x42')]({'message':_0x6791('0x43')});}_0x551718[_0x6791('0x44')]={'id':_0x2b98b8['id']};_0x34b006();})['catch'](function(_0x28b3d4){_0x34b006(_0x28b3d4);});}else if(_[_0x6791('0x3c')](_0x551718[_0x6791('0x3a')][_0x6791('0x3b')],_0x6791('0x45'))){validateJwt(_0x551718,_0x2f56a2,_0x34b006);}else{if(_0x4fc5d5){_0x34b006();}else{return _0x2f56a2[_0x6791('0x37')](0x193)['json']({'message':'Unknown\x20authorization\x20format'});}}}else if(_0x551718['query'][_0x6791('0x46')]){try{var _0x21a9cf={'audience':hardwareConf[_0x6791('0x47')](),'issuer':hardwareConf['getUuid']()};verifyJwt(_0x551718['query'][_0x6791('0x46')],_0x21a9cf)[_0x6791('0x3f')](function(_0x31a525){return db[_0x6791('0x48')]['find']({'where':{'id':_0x31a525[_0x6791('0x49')]}})[_0x6791('0x3f')](function(_0x2068a5){_0x483d6c=_0x2068a5;return db['Setting'][_0x6791('0x4a')]({'where':{'id':0x1},'attributes':['allowedLoginAttempts','blockDuration'],'raw':!![]});})[_0x6791('0x3f')](function(_0x1803ab){if(!_0x483d6c||!_['isEqual'](_0x483d6c[_0x6791('0x4b')],_0x31a525[_0x6791('0x4c')])){return _0x2f56a2[_0x6791('0x37')](0x191)[_0x6791('0x42')]({'message':_0x6791('0x4d')});}if(_0x483d6c['disabled']){return _0x2f56a2[_0x6791('0x37')](0x191)[_0x6791('0x42')]({'message':_0x6791('0x4e')});}if(_0x483d6c['blocked']){if(_0x1803ab[_0x6791('0x4f')]>0x0){if(moment(_0x483d6c[_0x6791('0x50')])[_0x6791('0x51')](_0x1803ab['blockDuration'],_0x6791('0x52'))>moment()){return _0x2f56a2[_0x6791('0x37')](0x191)[_0x6791('0x42')]({'message':_0x6791('0x4e')});}}else{return _0x2f56a2['status'](0x191)[_0x6791('0x42')]({'message':_0x6791('0x4e')});}}_0x551718[_0x6791('0x44')]={'id':_0x483d6c['id']};_0x34b006();});})[_0x6791('0x53')](function(){return _0x2f56a2[_0x6791('0x37')](0x191)[_0x6791('0x42')]({'message':_0x6791('0x4e')});});}catch(_0xae0e07){_0x34b006(_0xae0e07);}}else if(_0x4fc5d5){_0x34b006();}else{return _0x2f56a2[_0x6791('0x37')](0x193)['json']({'message':'Unknown\x20authorization\x20format'});}})[_0x6791('0x34')](function(_0xe11675,_0x5900b6,_0x39dcb7){if(_0xe11675[_0x6791('0x44')]){db[_0x6791('0x48')][_0x6791('0x3d')]({'where':{'id':_0xe11675[_0x6791('0x44')]['id']},'attributes':userAttributes})[_0x6791('0x3f')](function(_0x44e0ba){if(!_0x44e0ba){return _0x5900b6['status'](0x194)[_0x6791('0x42')]({'message':'User\x20not\x20found.'});}_0xe11675[_0x6791('0x44')]=_0x44e0ba;_0x39dcb7();})[_0x6791('0x53')](function(_0x16f26c){_0x39dcb7(_0x16f26c);});}else if(_0x4fc5d5){_0x39dcb7();}else{return _0x5900b6[_0x6791('0x37')](0x194)['json']({'message':_0x6791('0x54')});}});};exports[_0x6791('0x55')]=function canUpdate(){return compose()[_0x6791('0x34')](function(_0x3251e9,_0x5a7fb6,_0x1763d8){return licenseUtil[_0x6791('0x56')]()[_0x6791('0x3f')](function(_0x57e39f){if(_0x57e39f[_0x6791('0x57')]){_0x1763d8();}else{return _0x5a7fb6[_0x6791('0x37')](0x193)[_0x6791('0x42')]({'message':_0x6791('0x58')});}})['catch'](function(_0x3e5e29){_0x1763d8(_0x3e5e29);});});};exports[_0x6791('0x59')]=function isWebrtcLicence(){return compose()['use'](function(_0x1ac964,_0x54ef7b,_0x38b6b5){return licenseUtil[_0x6791('0x56')]()[_0x6791('0x3f')](function(_0x3ddccc){if(_0x3ddccc[_0x6791('0x5a')]){_0x38b6b5();}else{return _0x54ef7b[_0x6791('0x37')](0x193)[_0x6791('0x42')]({'message':_0x6791('0x58')});}})[_0x6791('0x53')](function(_0x5cfa40){_0x38b6b5(_0x5cfa40);});});};exports[_0x6791('0x5b')]=function(_0x599f23,_0x10e806,_0x2bb86a){_0x599f23[_0x6791('0x5b')]=!![];return _0x2bb86a();};exports[_0x6791('0x5c')]=function signToken(_0x6ab7f6){return signJwt(_0x6ab7f6);};exports['setTokenCookie']=function(_0x2bc08d,_0x35e087){if(!_0x2bc08d[_0x6791('0x44')]){return _0x35e087[_0x6791('0x37')](0x194)[_0x6791('0x42')]({'message':'It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.'});}var _0x1a902c={'payload':{'id':_0x2bc08d[_0x6791('0x44')]['id'],'role':_0x2bc08d['user'][_0x6791('0x5d')]},'options':{'expiresIn':0x15180}};return signJwt(_0x1a902c)['then'](function(_0x3d4b7e){_0x35e087[_0x6791('0x5e')](_0x6791('0x5f'),_0x3d4b7e);_0x35e087[_0x6791('0x60')]('/dashboards/general');})[_0x6791('0x53')](function(_0x243faf){return _0x35e087['status'](0x1f4)[_0x6791('0x61')](_0x243faf);});};exports[_0x6791('0x62')]=function(_0x3a895b){if(_['isNil'](_0x3a895b[_0x6791('0x4b')])||_[_0x6791('0x63')](_0x3a895b['apiKeyIat'])){return null;}else{return createJwt(_0x3a895b);}};exports[_0x6791('0x64')]=function(_0x2cec8d){_0x2cec8d['apiKeyNonce']=generateNonce();_0x2cec8d[_0x6791('0x65')]=generateIssuedAt();return createJwt(_0x2cec8d);};exports[_0x6791('0x66')]=function(_0x1b0bb1,_0x285bfd){var _0x582d50=_0x1b0bb1[_0x6791('0x67')][_0x6791('0x46')];if(_0x582d50){var _0x32f36b={'nonce':_0x285bfd['apiKeyNonce'],'iat':_0x285bfd['apiKeyIat'],'audience':hardwareConf[_0x6791('0x47')](),'issuer':hardwareConf[_0x6791('0x47')]()};return verifyJwt(_0x582d50,_0x32f36b)[_0x6791('0x3f')](function(){return generateApiKey(_0x285bfd);});}else{throw{'message':_0x6791('0x68')};}};exports[_0x6791('0x69')]=function(_0x53b651){var _0x54da93=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x54da93[_0x6791('0x6a')](_0x53b651))throw new db['Sequelize']['ValidationError'](_0x6791('0x6b'));return;};exports[_0x6791('0x6c')]=function(_0x2cb48e,_0x10b41b,_0x13089d){var _0x220cb1=encryptor['decryptString'](_0x10b41b)['split'](',');for(var _0x40649c=0x0;_0x40649c<_0x13089d;_0x40649c++){if(!_0x220cb1[_0x40649c])break;if(_0x2cb48e[_0x6791('0x6d')]()===_0x220cb1[_0x40649c]['toLowerCase']()){var _0x44b1df=util['format'](_0x6791('0x6e'),_0x13089d);if(_0x13089d===0x1){_0x44b1df=_0x6791('0x6f');}throw new db['Sequelize'][(_0x6791('0x70'))](_0x44b1df);}}return;};exports[_0x6791('0x71')]=function(_0x3fd984,_0x49ed65){var _0x3ba679=_0x49ed65?encryptor[_0x6791('0x72')](_0x49ed65)[_0x6791('0x73')](','):[];if(_0x3ba679[_0x6791('0x74')]===0x5){_0x3ba679[_0x6791('0x75')](-0x1,0x1);}_0x3ba679['unshift'](_0x3fd984);return encryptor['encryptString'](_0x3ba679[_0x6791('0x76')](','));};function signJwt(_0x13430e){var _0x5d2668=BPromise[_0x6791('0x77')](jwt[_0x6791('0x78')],{'context':jwt});var _0x66f6b4=_0x13430e[_0x6791('0x79')]||config[_0x6791('0x7a')][_0x6791('0xa')];return new BPromise(function(_0x33ac65,_0xb79679){_0x5d2668(_0x13430e['payload'],_0x66f6b4,_0x13430e[_0x6791('0x7b')])[_0x6791('0x3f')](function(_0x36b81e){_0x33ac65(_0x36b81e);})[_0x6791('0x53')](function(_0x548084){_0xb79679(_0x548084);});});}function verifyJwt(_0x16dff7,_0x10c7f3,_0xa8a8dd){var _0x5ca809=BPromise[_0x6791('0x77')](jwt[_0x6791('0x7c')],{'context':jwt});var _0x99d4ee=_0xa8a8dd||config[_0x6791('0x7a')]['session'];return new BPromise(function(_0x2c834f,_0x2843fb){_0x5ca809(_0x16dff7,_0x99d4ee,_0x10c7f3)['then'](function(_0x1114d4){_0x2c834f(_0x1114d4);})[_0x6791('0x53')](function(_0x215a63){_0x2843fb(_0x215a63);});});}function generateNonce(){return crypto[_0x6791('0x7d')](0x10)[_0x6791('0x7e')](_0x6791('0x7f'));}function generateIssuedAt(){return Math['floor'](Date[_0x6791('0x80')]()/0x3e8)[_0x6791('0x7e')]();}function createJwt(_0xf76291){var _0x547287={'payload':{'iat':_0xf76291[_0x6791('0x65')],'nonce':_0xf76291['apiKeyNonce']},'options':{'algorithm':_0x6791('0x81'),'subject':_0xf76291['id'][_0x6791('0x7e')](),'issuer':hardwareConf[_0x6791('0x47')](),'audience':hardwareConf[_0x6791('0x47')]()}};return signJwt(_0x547287)[_0x6791('0x3f')](function(_0x4a6bb8){return{'iat':_0xf76291[_0x6791('0x65')],'nonce':_0xf76291[_0x6791('0x4b')],'token':_0x4a6bb8};});} \ No newline at end of file +var _0x1775=['isEqual','apiKeyNonce','nonce','status','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','disabled','Invalid\x20API\x20access\x20key','blocked','blockedAt','minutes','use','User\x20not\x20found.','getLicense','update','Forbidden','isWebrtcLicence','isMiddleware','setTokenCookie','cookie','motion.token','redirect','/dashboards/general','apiKeyIat','generateApiKey','regenerateApiKey','Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one','validatePasswordPattern','test','Sequelize','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','decryptString','split','toLowerCase','format','The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.','updatePasswordsHistory','unshift','encryptString','join','promisify','sign','secret','payload','options','verify','randomBytes','toString','hex','floor','../../config/environment','../../config/license/hardware','../../config/license/util','../encryptor','lodash','jsonwebtoken','express-jwt','composable-middleware','basic-auth','crypto','bluebird','util','moment','secrets','session','role','fullname','name','internal','email','userpic','permissions','chatPause','mailPause','faxPause','smsPause','openchannelPause','showWebBar','lastLoginAt','lastPauseAt','crudPermissions','allowmessenger','passwordResetAt','alias','phoneBarAutoAnswer','phoneBarAutoAnswerDelay','phoneBarDnd','phoneBarEnableRecording','phoneBarEnableDtmfTone','phoneBarEnableSettings','phoneBarExpires','phoneBarPrefixRequired','phoneBarRemoteControl','phoneBarRemoteControlPort','hotdesk','interface','privacyEnabled','settingsEnabled','wssPort','downloadVoiceRecordings','downloadAttachments','ignorePauseForPreviewCalls','selectRecallMeCampaign','chatAutoanswerDelay','emailAutoanswerDelay','smsAutoanswer','smsAutoanswerDelay','openchannelAutoanswer','openchannelAutoanswerDelay','faxAutoanswer','faxAutoanswerDelay','whatsappAutoanswer','whatsappAutoanswerDelay','messengerSoundNotification','isChatInteractionAuthorized','isAuthenticated','user','ChatInteraction','findOne','closed','disposition','json','Unmanaged.','Forbidden.','catch','headers','authorization','startsWith','User','authenticate','pass','Wrong\x20credentials.','Bearer','Unknown\x20authorization\x20format','apikey','getUuid','query','find','sub','then','Setting','allowedLoginAttempts','blockDuration'];(function(_0x4a50a0,_0x471185){var _0x597f2b=function(_0x17faff){while(--_0x17faff){_0x4a50a0['push'](_0x4a50a0['shift']());}};_0x597f2b(++_0x471185);}(_0x1775,0x1db));var _0x5177=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x1775[_0x14add3];return _0x4a174f;};'use strict';var db=require('../../mysqldb')['db'];var config=require(_0x5177('0x0'));var hardwareConf=require(_0x5177('0x1'));var licenseUtil=require(_0x5177('0x2'));var encryptor=require(_0x5177('0x3'));var _=require(_0x5177('0x4'));var jwt=require(_0x5177('0x5'));var expressJwt=require(_0x5177('0x6'));var compose=require(_0x5177('0x7'));var basicAuth=require(_0x5177('0x8'));var crypto=require(_0x5177('0x9'));var BPromise=require(_0x5177('0xa'));var util=require(_0x5177('0xb'));var moment=require(_0x5177('0xc'));var validateJwt=expressJwt({'secret':config[_0x5177('0xd')][_0x5177('0xe')]});var userAttributes=['id',_0x5177('0xf'),_0x5177('0x10'),_0x5177('0x11'),_0x5177('0x12'),_0x5177('0x13'),_0x5177('0x14'),_0x5177('0x15'),'md5secret','voicePause',_0x5177('0x16'),_0x5177('0x17'),_0x5177('0x18'),_0x5177('0x19'),_0x5177('0x1a'),'pauseType',_0x5177('0x1b'),_0x5177('0x1c'),_0x5177('0x1d'),_0x5177('0x1e'),_0x5177('0x1f'),_0x5177('0x20'),_0x5177('0x21'),_0x5177('0x22'),_0x5177('0x23'),_0x5177('0x24'),_0x5177('0x25'),_0x5177('0x26'),_0x5177('0x27'),_0x5177('0x28'),_0x5177('0x29'),_0x5177('0x2a'),_0x5177('0x2b'),_0x5177('0x2c'),_0x5177('0x2d'),'userProfileId',_0x5177('0x2e'),_0x5177('0x2f'),_0x5177('0x30'),_0x5177('0x31'),'downloadOmnichannelInteractions',_0x5177('0x32'),_0x5177('0x33'),_0x5177('0x34'),'chatAutoanswer',_0x5177('0x35'),'emailAutoanswer',_0x5177('0x36'),_0x5177('0x37'),_0x5177('0x38'),_0x5177('0x39'),_0x5177('0x3a'),_0x5177('0x3b'),_0x5177('0x3c'),_0x5177('0x3d'),_0x5177('0x3e'),_0x5177('0x3f')];exports[_0x5177('0x40')]=function(){return this[_0x5177('0x41')](!![])['use'](function(_0x3dcea1,_0x556f96,_0x30b60f){if(_0x3dcea1[_0x5177('0x42')]){_0x30b60f();}else{return db[_0x5177('0x43')][_0x5177('0x44')]({'where':{'id':_0x3dcea1['params']['id']},'attributes':['id',_0x5177('0x45'),'disposition'],'raw':!![]})['then'](function(_0x19a0c2){if(_0x19a0c2&&_0x19a0c2[_0x5177('0x45')]){return _0x556f96['status'](_0x19a0c2[_0x5177('0x46')]==='unmanaged'?0x195:0x193)[_0x5177('0x47')]({'message':_0x19a0c2[_0x5177('0x46')]==='unmanaged'?_0x5177('0x48'):_0x5177('0x49')});}else{_0x30b60f();}})[_0x5177('0x4a')](function(_0x7f86e){_0x30b60f(_0x7f86e);});}});};exports[_0x5177('0x41')]=function isAuthenticated(_0x1cef5d){return compose()['use'](function(_0x498fcd,_0x45cf20,_0x1c660e){var _0x7dae59;if(_0x498fcd[_0x5177('0x4b')][_0x5177('0x4c')]){if(_[_0x5177('0x4d')](_0x498fcd[_0x5177('0x4b')][_0x5177('0x4c')],'Basic')){var _0x42e1db=basicAuth(_0x498fcd);db[_0x5177('0x4e')]['find']({'where':{'name':_0x42e1db[_0x5177('0x11')]}})['then'](function(_0x172b36){if(!_0x172b36||!_0x172b36[_0x5177('0x4f')](_0x42e1db[_0x5177('0x50')])){return _0x45cf20['status'](0x191)['json']({'message':_0x5177('0x51')});}_0x498fcd[_0x5177('0x42')]={'id':_0x172b36['id']};_0x1c660e();})[_0x5177('0x4a')](function(_0x3735e9){_0x1c660e(_0x3735e9);});}else if(_[_0x5177('0x4d')](_0x498fcd[_0x5177('0x4b')][_0x5177('0x4c')],_0x5177('0x52'))){validateJwt(_0x498fcd,_0x45cf20,_0x1c660e);}else{if(_0x1cef5d){_0x1c660e();}else{return _0x45cf20['status'](0x193)[_0x5177('0x47')]({'message':_0x5177('0x53')});}}}else if(_0x498fcd['query'][_0x5177('0x54')]){try{var _0x2a26fc={'audience':hardwareConf[_0x5177('0x55')](),'issuer':hardwareConf[_0x5177('0x55')]()};verifyJwt(_0x498fcd[_0x5177('0x56')][_0x5177('0x54')],_0x2a26fc)['then'](function(_0x40c607){return db[_0x5177('0x4e')][_0x5177('0x57')]({'where':{'id':_0x40c607[_0x5177('0x58')]}})[_0x5177('0x59')](function(_0xacaa96){_0x7dae59=_0xacaa96;return db[_0x5177('0x5a')]['findOne']({'where':{'id':0x1},'attributes':[_0x5177('0x5b'),_0x5177('0x5c')],'raw':!![]});})['then'](function(_0x486dd5){if(!_0x7dae59||!_[_0x5177('0x5d')](_0x7dae59[_0x5177('0x5e')],_0x40c607[_0x5177('0x5f')])){return _0x45cf20[_0x5177('0x60')](0x191)[_0x5177('0x47')]({'message':_0x5177('0x61')});}if(_0x7dae59[_0x5177('0x62')]){return _0x45cf20[_0x5177('0x60')](0x191)[_0x5177('0x47')]({'message':_0x5177('0x63')});}if(_0x7dae59[_0x5177('0x64')]){if(_0x486dd5[_0x5177('0x5c')]>0x0){if(moment(_0x7dae59[_0x5177('0x65')])['add'](_0x486dd5[_0x5177('0x5c')],_0x5177('0x66'))>moment()){return _0x45cf20['status'](0x191)[_0x5177('0x47')]({'message':'Invalid\x20API\x20access\x20key'});}}else{return _0x45cf20[_0x5177('0x60')](0x191)[_0x5177('0x47')]({'message':_0x5177('0x63')});}}_0x498fcd['user']={'id':_0x7dae59['id']};_0x1c660e();});})['catch'](function(){return _0x45cf20[_0x5177('0x60')](0x191)[_0x5177('0x47')]({'message':_0x5177('0x63')});});}catch(_0x177c4b){_0x1c660e(_0x177c4b);}}else if(_0x1cef5d){_0x1c660e();}else{return _0x45cf20[_0x5177('0x60')](0x193)[_0x5177('0x47')]({'message':_0x5177('0x53')});}})[_0x5177('0x67')](function(_0x4e287e,_0xe1c75c,_0x51ecc0){if(_0x4e287e['user']){db[_0x5177('0x4e')][_0x5177('0x57')]({'where':{'id':_0x4e287e['user']['id']},'attributes':userAttributes})[_0x5177('0x59')](function(_0x508178){if(!_0x508178){return _0xe1c75c['status'](0x194)[_0x5177('0x47')]({'message':_0x5177('0x68')});}_0x4e287e[_0x5177('0x42')]=_0x508178;_0x51ecc0();})[_0x5177('0x4a')](function(_0x191973){_0x51ecc0(_0x191973);});}else if(_0x1cef5d){_0x51ecc0();}else{return _0xe1c75c[_0x5177('0x60')](0x194)[_0x5177('0x47')]({'message':'User\x20object\x20not\x20found.'});}});};exports['canUpdate']=function canUpdate(){return compose()[_0x5177('0x67')](function(_0x511dc0,_0x23be2a,_0x3476d3){return licenseUtil[_0x5177('0x69')]()[_0x5177('0x59')](function(_0x570812){if(_0x570812[_0x5177('0x6a')]){_0x3476d3();}else{return _0x23be2a[_0x5177('0x60')](0x193)[_0x5177('0x47')]({'message':_0x5177('0x6b')});}})[_0x5177('0x4a')](function(_0x10b370){_0x3476d3(_0x10b370);});});};exports[_0x5177('0x6c')]=function isWebrtcLicence(){return compose()[_0x5177('0x67')](function(_0x1ada68,_0x296a98,_0x3fec49){return licenseUtil['getLicense']()[_0x5177('0x59')](function(_0x481bda){if(_0x481bda['webrtc']){_0x3fec49();}else{return _0x296a98['status'](0x193)[_0x5177('0x47')]({'message':_0x5177('0x6b')});}})['catch'](function(_0x326405){_0x3fec49(_0x326405);});});};exports[_0x5177('0x6d')]=function(_0x208483,_0x4891fe,_0x1d4ae4){_0x208483['isMiddleware']=!![];return _0x1d4ae4();};exports['signToken']=function signToken(_0x5bd97b){return signJwt(_0x5bd97b);};exports[_0x5177('0x6e')]=function(_0x37d5dd,_0x1300d7){if(!_0x37d5dd['user']){return _0x1300d7['status'](0x194)[_0x5177('0x47')]({'message':'It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.'});}var _0x262ac4={'payload':{'id':_0x37d5dd[_0x5177('0x42')]['id'],'role':_0x37d5dd[_0x5177('0x42')][_0x5177('0xf')]},'options':{'expiresIn':0x15180}};return signJwt(_0x262ac4)[_0x5177('0x59')](function(_0xa0edd7){_0x1300d7[_0x5177('0x6f')](_0x5177('0x70'),_0xa0edd7);_0x1300d7[_0x5177('0x71')](_0x5177('0x72'));})[_0x5177('0x4a')](function(_0xb08267){return _0x1300d7[_0x5177('0x60')](0x1f4)['send'](_0xb08267);});};exports['retrieveApiKey']=function(_0x29ff0f){if(_['isNil'](_0x29ff0f[_0x5177('0x5e')])||_['isNil'](_0x29ff0f[_0x5177('0x73')])){return null;}else{return createJwt(_0x29ff0f);}};exports[_0x5177('0x74')]=function(_0x1e838a){_0x1e838a['apiKeyNonce']=generateNonce();_0x1e838a['apiKeyIat']=generateIssuedAt();return createJwt(_0x1e838a);};exports[_0x5177('0x75')]=function(_0x43b5b9,_0x2eb560){var _0xcc37fb=_0x43b5b9['query']['apikey'];if(_0xcc37fb){var _0x3f0e89={'nonce':_0x2eb560[_0x5177('0x5e')],'iat':_0x2eb560[_0x5177('0x73')],'audience':hardwareConf[_0x5177('0x55')](),'issuer':hardwareConf['getUuid']()};return verifyJwt(_0xcc37fb,_0x3f0e89)[_0x5177('0x59')](function(){return generateApiKey(_0x2eb560);});}else{throw{'message':_0x5177('0x76')};}};exports[_0x5177('0x77')]=function(_0x589da8){var _0x2b39ba=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x2b39ba[_0x5177('0x78')](_0x589da8))throw new db[(_0x5177('0x79'))]['ValidationError'](_0x5177('0x7a'));return;};exports['validatePasswordHistory']=function(_0x40dfd6,_0x39fb92,_0x3268bd){var _0x5101fc=encryptor[_0x5177('0x7b')](_0x39fb92)[_0x5177('0x7c')](',');for(var _0xea44e=0x0;_0xea44e<_0x3268bd;_0xea44e++){if(!_0x5101fc[_0xea44e])break;if(_0x40dfd6[_0x5177('0x7d')]()===_0x5101fc[_0xea44e][_0x5177('0x7d')]()){var _0x74589e=util[_0x5177('0x7e')](_0x5177('0x7f'),_0x3268bd);if(_0x3268bd===0x1){_0x74589e='The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.';}throw new db['Sequelize']['ValidationError'](_0x74589e);}}return;};exports[_0x5177('0x80')]=function(_0x18222f,_0x35aa22){var _0x75cc0e=_0x35aa22?encryptor[_0x5177('0x7b')](_0x35aa22)[_0x5177('0x7c')](','):[];if(_0x75cc0e['length']===0x5){_0x75cc0e['splice'](-0x1,0x1);}_0x75cc0e[_0x5177('0x81')](_0x18222f);return encryptor[_0x5177('0x82')](_0x75cc0e[_0x5177('0x83')](','));};function signJwt(_0x336017){var _0x123d40=BPromise[_0x5177('0x84')](jwt[_0x5177('0x85')],{'context':jwt});var _0xd9c1db=_0x336017[_0x5177('0x86')]||config['secrets'][_0x5177('0xe')];return new BPromise(function(_0x25a0be,_0x57e199){_0x123d40(_0x336017[_0x5177('0x87')],_0xd9c1db,_0x336017[_0x5177('0x88')])['then'](function(_0x69c264){_0x25a0be(_0x69c264);})[_0x5177('0x4a')](function(_0x11a63c){_0x57e199(_0x11a63c);});});}function verifyJwt(_0x4be4b2,_0x23b246,_0x400e27){var _0x5f5bd5=BPromise['promisify'](jwt[_0x5177('0x89')],{'context':jwt});var _0x4f76d7=_0x400e27||config[_0x5177('0xd')]['session'];return new BPromise(function(_0x2771fa,_0x16f17c){_0x5f5bd5(_0x4be4b2,_0x4f76d7,_0x23b246)['then'](function(_0x2af938){_0x2771fa(_0x2af938);})[_0x5177('0x4a')](function(_0x1975a3){_0x16f17c(_0x1975a3);});});}function generateNonce(){return crypto[_0x5177('0x8a')](0x10)[_0x5177('0x8b')](_0x5177('0x8c'));}function generateIssuedAt(){return Math[_0x5177('0x8d')](Date['now']()/0x3e8)[_0x5177('0x8b')]();}function createJwt(_0x54aabd){var _0x54c301={'payload':{'iat':_0x54aabd[_0x5177('0x73')],'nonce':_0x54aabd[_0x5177('0x5e')]},'options':{'algorithm':'HS512','subject':_0x54aabd['id'][_0x5177('0x8b')](),'issuer':hardwareConf[_0x5177('0x55')](),'audience':hardwareConf[_0x5177('0x55')]()}};return signJwt(_0x54c301)[_0x5177('0x59')](function(_0x19b587){return{'iat':_0x54aabd[_0x5177('0x73')],'nonce':_0x54aabd[_0x5177('0x5e')],'token':_0x19b587};});} \ No newline at end of file diff --git a/server/components/contacts/index.js b/server/components/contacts/index.js index 5bea373..e39a563 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 _0x5f26=['./sql-utils','findAll','skipContactsQuery','resolve','getContactsSubquery','then','search','parseAdvancedSearchFilter','parseQueryParameters','default','where','fields','filter','tags','user','skip','checkListsRestrictions','ids','tag','countFilteredContacts','count','buildContactsQuery','getFilteredContacts','rows','catch','describe','keys','findOne','slice','all','length','fieldType','type','lodash'];(function(_0x1395b8,_0xe2f288){var _0xeb93e7=function(_0x2a82f1){while(--_0x2a82f1){_0x1395b8['push'](_0x1395b8['shift']());}};_0xeb93e7(++_0xe2f288);}(_0x5f26,0x131));var _0x65f2=function(_0x4c075b,_0x56c2e7){_0x4c075b=_0x4c075b-0x0;var _0x228448=_0x5f26[_0x4c075b];return _0x228448;};'use strict';var _=require(_0x65f2('0x0'));var sqlUtils=require(_0x65f2('0x1'));var db=require('../../mysqldb')['db'];exports[_0x65f2('0x2')]=function(_0x3a533e,_0x56e9a0,_0x33e567,_0x519195){var _0x7a9438={'count':0x0,'rows':[]};var _0x2135e8=sqlUtils[_0x65f2('0x3')](_0x56e9a0,_0x3a533e);if(_0x2135e8){return Promise[_0x65f2('0x4')](_0x7a9438);}var _0x1d2b72=sqlUtils[_0x65f2('0x5')]();var _0x15a7d7={};var _0x170b4e=![];var _0x2ed2f6=![];return Promise['resolve']()[_0x65f2('0x6')](function(){if(_0x3a533e[_0x65f2('0x7')]){return sqlUtils[_0x65f2('0x8')](_0x3a533e[_0x65f2('0x7')],_0x519195);}else{return sqlUtils[_0x65f2('0x9')](_0x3a533e,_0x519195);}})[_0x65f2('0x6')](function(_0x28c425){_0x1d2b72['where'](_0x28c425[_0x65f2('0xa')]);_0x1d2b72[_0x65f2('0xb')](_0x28c425[_0x65f2('0xc')]);_0x1d2b72[_0x65f2('0xb')](_0x28c425[_0x65f2('0xd')]);_0x1d2b72[_0x65f2('0xb')](_0x28c425['user']['clause']);_0x15a7d7=_0x28c425[_0x65f2('0xe')];_0x2ed2f6=_0x28c425[_0x65f2('0xf')][_0x65f2('0x10')];return sqlUtils[_0x65f2('0x11')](_0x56e9a0,_0x3a533e,_0x2ed2f6);})[_0x65f2('0x6')](function(_0x212df5){_0x1d2b72[_0x65f2('0xb')](_0x212df5);var _0x4da11f=_0x3a533e[_0x65f2('0x7')]?_0x15a7d7[_0x65f2('0x12')]:_0x3a533e[_0x65f2('0x13')];_0x170b4e=_0x4da11f?!![]:![];return sqlUtils[_0x65f2('0x14')](_0x1d2b72,_0x4da11f);})['then'](function(_0x3dd5a4){_0x7a9438[_0x65f2('0x15')]=_0x3dd5a4;if(_0x7a9438[_0x65f2('0x15')]===0x0){return;}if(_0x3a533e['User']){_0x2ed2f6=!![];}return sqlUtils[_0x65f2('0x16')](_0x1d2b72,_0x3a533e['fields'],_0x33e567,_0x170b4e,_0x15a7d7['clause'],_0x2ed2f6);})[_0x65f2('0x6')](function(_0x2dccc9){if(!_0x2dccc9){return[];}return sqlUtils[_0x65f2('0x17')](_0x2dccc9,_0x3a533e,_0x33e567);})[_0x65f2('0x6')](function(_0x34a7ff){_0x7a9438[_0x65f2('0x18')]=_0x34a7ff;return _0x7a9438;})[_0x65f2('0x19')](function(_0x15a6a2){throw _0x15a6a2;});};exports[_0x65f2('0x1a')]=function(){var _0x130a25={};var _0x1ba742=[];return db['CmContact'][_0x65f2('0x1a')]()[_0x65f2('0x6')](function(_0x550671){_0x130a25=_0x550671;var _0x5e9cba=Object[_0x65f2('0x1b')](_0x130a25)[_0x65f2('0xd')](function(_0x55d233){return _['startsWith'](_0x55d233,'cf_')?_0x55d233:undefined;});var _0x17c847=_0x5e9cba['map'](function(_0x3e53cc){return db['CmCustomField'][_0x65f2('0x1c')]({'where':{'id':_0x3e53cc[_0x65f2('0x1d')](0x3)},'raw':!![]});});return Promise[_0x65f2('0x1e')](_0x17c847);})[_0x65f2('0x6')](function(_0x4deba7){for(var _0x2b2eba=0x0;_0x2b2eba<_0x4deba7[_0x65f2('0x1f')];_0x2b2eba++){if(_0x4deba7[_0x2b2eba]){var _0x5e8af5='cf_'+_0x4deba7[_0x2b2eba]['id'];_0x130a25[_0x5e8af5][_0x65f2('0x20')]=_0x4deba7[_0x2b2eba][_0x65f2('0x21')];}}_0x1ba742=_['map'](Object['keys'](_0x130a25),function(_0x20ef11){return{'name':_0x20ef11,'type':_0x130a25[_0x20ef11][_0x65f2('0x21')]};});return _0x1ba742;})[_0x65f2('0x19')](function(_0x2335c1){throw _0x2335c1;});}; \ No newline at end of file +var _0x1838=['tags','user','skip','checkListsRestrictions','ids','tag','countFilteredContacts','count','buildContactsQuery','clause','getFilteredContacts','rows','catch','describe','CmContact','startsWith','cf_','map','CmCustomField','findOne','slice','all','length','fieldType','type','lodash','../../mysqldb','resolve','getContactsSubquery','then','search','parseAdvancedSearchFilter','parseQueryParameters','where','fields','filter'];(function(_0x597ae3,_0x7e4dc6){var _0x2c30cf=function(_0x46bd96){while(--_0x46bd96){_0x597ae3['push'](_0x597ae3['shift']());}};_0x2c30cf(++_0x7e4dc6);}(_0x1838,0x85));var _0x8183=function(_0x5b2d9a,_0x82571f){_0x5b2d9a=_0x5b2d9a-0x0;var _0x19412b=_0x1838[_0x5b2d9a];return _0x19412b;};'use strict';var _=require(_0x8183('0x0'));var sqlUtils=require('./sql-utils');var db=require(_0x8183('0x1'))['db'];exports['findAll']=function(_0x5e370f,_0x178674,_0x51f818,_0x4f54c5){var _0x501eec={'count':0x0,'rows':[]};var _0x131559=sqlUtils['skipContactsQuery'](_0x178674,_0x5e370f);if(_0x131559){return Promise[_0x8183('0x2')](_0x501eec);}var _0x2b6478=sqlUtils[_0x8183('0x3')]();var _0x2111c3={};var _0x4149cd=![];var _0x1c7fe9=![];return Promise['resolve']()[_0x8183('0x4')](function(){if(_0x5e370f[_0x8183('0x5')]){return sqlUtils[_0x8183('0x6')](_0x5e370f[_0x8183('0x5')],_0x4f54c5);}else{return sqlUtils[_0x8183('0x7')](_0x5e370f,_0x4f54c5);}})['then'](function(_0x29fbf7){_0x2b6478['where'](_0x29fbf7['default']);_0x2b6478[_0x8183('0x8')](_0x29fbf7[_0x8183('0x9')]);_0x2b6478[_0x8183('0x8')](_0x29fbf7[_0x8183('0xa')]);_0x2b6478[_0x8183('0x8')](_0x29fbf7['user']['clause']);_0x2111c3=_0x29fbf7[_0x8183('0xb')];_0x1c7fe9=_0x29fbf7[_0x8183('0xc')][_0x8183('0xd')];return sqlUtils[_0x8183('0xe')](_0x178674,_0x5e370f,_0x1c7fe9);})[_0x8183('0x4')](function(_0x35dca2){_0x2b6478[_0x8183('0x8')](_0x35dca2);var _0x489818=_0x5e370f['search']?_0x2111c3[_0x8183('0xf')]:_0x5e370f[_0x8183('0x10')];_0x4149cd=_0x489818?!![]:![];return sqlUtils[_0x8183('0x11')](_0x2b6478,_0x489818);})[_0x8183('0x4')](function(_0x1bc996){_0x501eec[_0x8183('0x12')]=_0x1bc996;if(_0x501eec[_0x8183('0x12')]===0x0){return;}if(_0x5e370f['User']){_0x1c7fe9=!![];}return sqlUtils[_0x8183('0x13')](_0x2b6478,_0x5e370f[_0x8183('0x9')],_0x51f818,_0x4149cd,_0x2111c3[_0x8183('0x14')],_0x1c7fe9);})[_0x8183('0x4')](function(_0x464a88){if(!_0x464a88){return[];}return sqlUtils[_0x8183('0x15')](_0x464a88,_0x5e370f,_0x51f818);})[_0x8183('0x4')](function(_0x48a189){_0x501eec[_0x8183('0x16')]=_0x48a189;return _0x501eec;})[_0x8183('0x17')](function(_0x3d2f7d){throw _0x3d2f7d;});};exports[_0x8183('0x18')]=function(){var _0xd77887={};var _0xe253b7=[];return db[_0x8183('0x19')][_0x8183('0x18')]()[_0x8183('0x4')](function(_0x1668f2){_0xd77887=_0x1668f2;var _0xbcd709=Object['keys'](_0xd77887)[_0x8183('0xa')](function(_0x46ff8a){return _[_0x8183('0x1a')](_0x46ff8a,_0x8183('0x1b'))?_0x46ff8a:undefined;});var _0x1fa23f=_0xbcd709[_0x8183('0x1c')](function(_0x5514fa){return db[_0x8183('0x1d')][_0x8183('0x1e')]({'where':{'id':_0x5514fa[_0x8183('0x1f')](0x3)},'raw':!![]});});return Promise[_0x8183('0x20')](_0x1fa23f);})[_0x8183('0x4')](function(_0x1b9c36){for(var _0x2ef6f8=0x0;_0x2ef6f8<_0x1b9c36[_0x8183('0x21')];_0x2ef6f8++){if(_0x1b9c36[_0x2ef6f8]){var _0x6f6cbd=_0x8183('0x1b')+_0x1b9c36[_0x2ef6f8]['id'];_0xd77887[_0x6f6cbd][_0x8183('0x22')]=_0x1b9c36[_0x2ef6f8]['type'];}}_0xe253b7=_[_0x8183('0x1c')](Object['keys'](_0xd77887),function(_0x17f786){return{'name':_0x17f786,'type':_0xd77887[_0x17f786][_0x8183('0x23')]};});return _0xe253b7;})[_0x8183('0x17')](function(_0x5cad6b){throw _0x5cad6b;});}; \ No newline at end of file diff --git a/server/components/contacts/sql-utils.js b/server/components/contacts/sql-utils.js index 3cbb7c1..0ace8ff 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 _0x135a=['createdAt','deletedAt','TagIds','includes','push','forEach','field','GROUP_CONCAT(DISTINCT\x20t.id)','expr','getSelectedTags','replace','split','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.id\x20LIKE\x20?','c.phone\x20LIKE\x20?','c.mobile\x20LIKE\x20?','c.fax\x20LIKE\x20?','isEmail','c.email\x20LIKE\x20?','c.lastName\x20LIKE\x20?','sqlOperator','conditions','length','name','dateOfBirth','fieldType','datetime','castTo','DATE','buildExpression','type','default','text','value','start','end','Tag','map','clause','and','tags','user','uc.UserId\x20=\x20?','Contact','User','c.ListId\x20IN\x20?','\x20=\x20?','resolve','then','fields','filter','role','c.ListId\x20IS\x20NULL','attributes','limit','offset','subqry.id','order','DESC','findAll','color','keyBy','Sequelize','SELECT','CmContact','sequelize','toString','Tags','clone','COUNT(*)','c.id','isEmpty','where','QueryTypes','query','exports','lodash','squel','../parsers/qs','../interaction/utils','../../mysqldb','agent','search','true','select','from','cm_contacts','subqry','cm_user_has_contacts','.id','cm_contact_has_tags','ct.CmContactId\x20=\x20','tools_tags','t.id\x20=\x20ct.TagId','firstName','phone','fax','ListId','CompanyId'];(function(_0x5b36bd,_0x4dfb36){var _0x1614fe=function(_0x559b7c){while(--_0x559b7c){_0x5b36bd['push'](_0x5b36bd['shift']());}};_0x1614fe(++_0x4dfb36);}(_0x135a,0xb1));var _0xa135=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x135a[_0x21a9d9];return _0x46adce;};'use strict';var _=require(_0xa135('0x0'));var squel=require(_0xa135('0x1'));var as=require('../parsers/advancedSearch');var qs=require(_0xa135('0x2'));var utils=require(_0xa135('0x3'));var db=require(_0xa135('0x4'))['db'];function skipContactsQuery(_0x1ad707,_0x4a1e57){var _0x3936f9=![];if(_0x1ad707['role']===_0xa135('0x5')&&!_0x4a1e57[_0xa135('0x6')]&&!_0x4a1e57['ListId']&&_0x4a1e57['autocomplete']!==_0xa135('0x7')){_0x3936f9=!![];}return _0x3936f9;}function getContactsSubquery(){return squel[_0xa135('0x8')]()[_0xa135('0x9')](_0xa135('0xa'),'c')['where']('c.deletedAt\x20IS\x20NULL');}function applyJoinClauses(_0x4df3a5,_0x3bfff0){var _0x180342=_0x3bfff0?'c':_0xa135('0xb');_0x4df3a5['left_join'](_0xa135('0xc'),'uc','uc.CmContactId\x20=\x20'+_0x180342+_0xa135('0xd'))['left_join'](_0xa135('0xe'),'ct',_0xa135('0xf')+_0x180342+'.id')['left_join'](_0xa135('0x10'),'t',_0xa135('0x11'));return _0x4df3a5;}function addFieldsToQuery(_0x13185e,_0x135533,_0x4e1401,_0x3b2b88,_0x5114b1){var _0x5907e3=_0x5114b1?'c':_0xa135('0xb');if(!_0x135533){_0x135533=['id',_0xa135('0x12'),'lastName',_0xa135('0x13'),'mobile',_0xa135('0x14'),'email',_0xa135('0x15'),_0xa135('0x16'),_0xa135('0x17'),'updatedAt',_0xa135('0x18'),_0xa135('0x19')];}else if(!_0x135533[_0xa135('0x1a')]('id')){_0x135533[_0xa135('0x1b')]('id');}var _0x4ba917=_0x4e1401&&_0x5114b1||!_0x4e1401&&!_0x5114b1;if(_0x3b2b88){_0x4ba917=_0x3b2b88&&_0x5114b1||!_0x3b2b88&&!_0x5114b1;}_0x135533[_0xa135('0x1c')](function(_0x289083){if(_0x289083===_0xa135('0x19')){if(_0x4ba917){_0x13185e[_0xa135('0x1d')](_0xa135('0x1e'),_0x289083);}else if(_0x4e1401||_0x3b2b88){_0x13185e[_0xa135('0x1d')](_0x5907e3+'.'+_0x289083);}}else{_0x13185e[_0xa135('0x1d')](_0x5907e3+'.'+_0x289083);}});return _0x13185e;}function getSqlClauses(){var _0x13e4ff={'default':squel[_0xa135('0x1f')](),'fields':squel['expr'](),'filter':squel['expr'](),'tags':{'clause':squel['expr'](),'ids':null},'user':{'clause':squel[_0xa135('0x1f')](),'skip':![]}};return _0x13e4ff;}function parseTagParameter(_0x54c7a5){var _0x456031=squel[_0xa135('0x1f')]();if(_0x54c7a5){var _0x10dbaa=utils[_0xa135('0x20')](_0x54c7a5);_0x10dbaa[_0xa135('0x1c')](function(_0x2d7732){_0x456031['or']('CONCAT(\x27,\x27,\x20subqry.TagIds,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x2d7732+',%');});}return _0x456031;}function parseSearchFilter(_0x3ed706){var _0x42e75a=squel[_0xa135('0x1f')]();if(_0x3ed706){var _0x70ea6b=_0x3ed706[_0xa135('0x21')]('\x5c','\x5c\x5c')[_0xa135('0x21')](/'/g,'\x27\x27');if(_0x70ea6b[_0xa135('0x22')]('\x20')['length']>0x1){_0x42e75a['or'](_0xa135('0x23'),qs[_0xa135('0x24')](_0x70ea6b,!![]),null);}else{if(qs['isNumeric'](_0x70ea6b)){_0x42e75a['or'](_0xa135('0x25'),_0x70ea6b+'%');_0x42e75a['or'](_0xa135('0x26'),_0x70ea6b+'%');_0x42e75a['or'](_0xa135('0x27'),_0x70ea6b+'%');_0x42e75a['or'](_0xa135('0x28'),_0x70ea6b+'%');}else if(qs[_0xa135('0x29')](_0x70ea6b)){_0x42e75a['or'](_0xa135('0x2a'),_0x70ea6b+'%');}else{_0x42e75a['or']('c.firstName\x20LIKE\x20?','%'+_0x70ea6b+'%');_0x42e75a['or'](_0xa135('0x2b'),'%'+_0x70ea6b+'%');_0x42e75a['or'](_0xa135('0x2a'),'%'+_0x70ea6b+'%');}}}return _0x42e75a;}function parseAdvancedSearchFilter(_0x46b1a6,_0x3182a5){var _0x46fbee=getSqlClauses();var _0x6cb61d=as['parseSearch'](_0x46b1a6);var _0x382fa6=_0x6cb61d[_0xa135('0x2c')];for(var _0x22d108=0x0;_0x22d108<_0x6cb61d[_0xa135('0x2d')][_0xa135('0x2e')];_0x22d108++){var _0x36f185=_0x6cb61d[_0xa135('0x2d')][_0x22d108];var _0x39b8bf='c';var _0x58cb02=_['find'](_0x3182a5,[_0xa135('0x2f'),_0x36f185[_0xa135('0x1d')]]);if(_0x58cb02){if(_0x36f185[_0xa135('0x1d')]===_0xa135('0x30')||_0x58cb02[_0xa135('0x31')]===_0xa135('0x32')){_0x36f185[_0xa135('0x33')]=_0xa135('0x34');}var _0x2e5214=as[_0xa135('0x35')](_0x39b8bf,_0x58cb02[_0xa135('0x36')],_0x36f185);_0x46fbee[_0xa135('0x37')][_0x382fa6](_0x2e5214[_0xa135('0x38')],_0x2e5214[_0xa135('0x39')][_0xa135('0x3a')],_0x2e5214['value'][_0xa135('0x3b')]);}else{if(_0x36f185['field']===_0xa135('0x3c')){var _0x55251e=_0x36f185[_0xa135('0x39')][_0xa135('0x22')](',')[_0xa135('0x3d')](function(_0x5e9bf2){return Number(_0x5e9bf2);});var _0x4773df=parseTagParameter(_0x55251e);_0x46fbee['tags'][_0xa135('0x3e')][_0xa135('0x3f')](_0x4773df);_0x46fbee[_0xa135('0x40')]['ids']=_0x55251e;}else if(_0x36f185[_0xa135('0x1d')]==='User'){_0x46fbee[_0xa135('0x41')][_0xa135('0x3e')][_0xa135('0x3f')](_0xa135('0x42'),_0x36f185[_0xa135('0x39')]);_0x46fbee['user']['skip']=!![];}}}return _0x46fbee;}function parseModelFields(_0x5ab7a6,_0x51dfbf){var _0x26a6a2=squel['expr']();var _0x50a611=_(_0x5ab7a6)['keys']()[_0xa135('0x3d')](function(_0x21b02f){return _['some'](_0x51dfbf,[_0xa135('0x2f'),_0x21b02f])?_0x21b02f:undefined;})['compact']()['value']();if(_0x5ab7a6[_0xa135('0x43')]){_0x50a611[_0xa135('0x1b')](_0xa135('0x43'));}if(_0x5ab7a6['User']){_0x50a611[_0xa135('0x1b')](_0xa135('0x44'));}if(_0x50a611[_0xa135('0x2e')]>0x0){_0x50a611[_0xa135('0x1c')](function(_0x5e3440){if(_0x5e3440===_0xa135('0x15')){_0x26a6a2[_0xa135('0x3f')](_0xa135('0x45'),[]['concat'](_0x5ab7a6[_0x5e3440]));}else if(_0x5e3440===_0xa135('0x43')){var _0x575d31='%'+_0x5ab7a6[_0x5e3440]+'%';_0x26a6a2[_0xa135('0x3f')]('CONCAT_WS(\x27\x20\x27,\x20c.firstName,\x20c.lastName,\x20c.email)\x20LIKE\x20?',_0x575d31);}else if(_0x5e3440===_0xa135('0x44')){_0x26a6a2[_0xa135('0x3f')](_0xa135('0x42'),_0x5ab7a6[_0x5e3440]);}else{_0x26a6a2[_0xa135('0x3f')]('c.'+_0x5e3440+_0xa135('0x46'),_0x5ab7a6[_0x5e3440]);}});}return _0x26a6a2;}function parseQueryParameters(_0x4e6e11,_0x4812a4){var _0x190c8e=getSqlClauses();return Promise[_0xa135('0x47')]()[_0xa135('0x48')](function(){return parseModelFields(_0x4e6e11,_0x4812a4);})[_0xa135('0x48')](function(_0x2e02f3){_0x190c8e[_0xa135('0x49')][_0xa135('0x3f')](_0x2e02f3);return parseTagParameter(_0x4e6e11['tag']);})['then'](function(_0x15dc3b){_0x190c8e['tags'][_0xa135('0x3e')][_0xa135('0x3f')](_0x15dc3b);return parseSearchFilter(_0x4e6e11[_0xa135('0x4a')]);})[_0xa135('0x48')](function(_0x53625e){_0x190c8e['filter']=_0x53625e;return _0x190c8e;});}function checkListsRestrictions(_0x575c5a,_0x41511d,_0x11d905){var _0x52495f=squel[_0xa135('0x1f')]();return Promise[_0xa135('0x47')]()['then'](function(){if(_0x41511d[_0xa135('0x6')]&&_0x575c5a[_0xa135('0x4b')]===_0xa135('0x5')&&!_0x11d905){return _0x575c5a['getLists']({'attributes':['id'],'raw':!![]});}})[_0xa135('0x48')](function(_0x5624c2){if(_0x5624c2){if(_0x5624c2['length']===0x0){_0x52495f['and'](_0xa135('0x4c'));}else{_0x52495f[_0xa135('0x3f')]('c.ListId\x20IN\x20?',_[_0xa135('0x3d')](_0x5624c2,'id'));}}})[_0xa135('0x48')](function(){return _0x52495f;});}function buildContactsQuery(_0x5f3936,_0x426fe9,_0x58db91,_0x4a5ed8,_0x29ea43,_0x217df5){if(_0x426fe9){_0x426fe9=_0x58db91[_0xa135('0x4d')];}_0x5f3936=addFieldsToQuery(_0x5f3936,_0x426fe9,_0x4a5ed8,_0x217df5,!![]);var _0x1d7514=squel[_0xa135('0x8')]();_0x1d7514=addFieldsToQuery(_0x1d7514,_0x426fe9,_0x4a5ed8,_0x217df5,![]);if(_0x4a5ed8||_0x217df5){_0x5f3936=applyJoinClauses(_0x5f3936,!![]);_0x5f3936['group']('c.id');if(_0x58db91[_0xa135('0x4e')]){_0x1d7514[_0xa135('0x4e')](_0x58db91[_0xa135('0x4e')]);}if(_0x58db91['offset']){_0x1d7514[_0xa135('0x4f')](_0x58db91['offset']);}}else{_0x1d7514=applyJoinClauses(_0x1d7514,![]);_0x1d7514['group'](_0xa135('0x50'));if(_0x58db91[_0xa135('0x4e')]){_0x5f3936[_0xa135('0x4e')](_0x58db91[_0xa135('0x4e')]);}if(_0x58db91[_0xa135('0x4f')]){_0x5f3936[_0xa135('0x4f')](_0x58db91[_0xa135('0x4f')]);}}_0x1d7514['having'](_0x29ea43);if(_0x58db91['order']){_0x58db91[_0xa135('0x51')][_0xa135('0x1c')](function(_0x433c85){_0x5f3936[_0xa135('0x51')]('c.'+_0x433c85[0x0],_0x433c85[0x1]===_0xa135('0x52')?![]:!![]);_0x1d7514['order']('subqry.'+_0x433c85[0x0],_0x433c85[0x1]===_0xa135('0x52')?![]:!![]);});}_0x1d7514[_0xa135('0x9')](_0x5f3936,_0xa135('0xb'));return _0x1d7514;}function getFilteredContacts(_0x4f78ea){var _0x1386f4=[];return db[_0xa135('0x3c')][_0xa135('0x53')]({'attributes':['id','name',_0xa135('0x54')],'raw':!![]})['then'](function(_0x18a6b7){_0x1386f4=_[_0xa135('0x55')](_0x18a6b7,'id');var _0x5171b9={'type':db[_0xa135('0x56')]['QueryTypes'][_0xa135('0x57')],'model':db[_0xa135('0x58')],'mapToModel':!![],'nest':!![],'raw':!![]};return db[_0xa135('0x59')]['query'](_0x4f78ea[_0xa135('0x5a')](),_0x5171b9);})['then'](function(_0x86e0e4){_0x86e0e4[_0xa135('0x1c')](function(_0x598f6d){if(_0x598f6d[_0xa135('0x19')]){_0x598f6d[_0xa135('0x5b')]=[];_0x598f6d[_0xa135('0x19')][_0xa135('0x22')](',')[_0xa135('0x1c')](function(_0x5070eb){_0x598f6d[_0xa135('0x5b')][_0xa135('0x1b')](_0x1386f4[_0x5070eb]);});}delete _0x598f6d['TagIds'];});return _0x86e0e4;});}function countFilteredContacts(_0xa1d60,_0x4af9b0){var _0x56c5f1=_0xa1d60[_0xa135('0x5c')]();_0x56c5f1[_0xa135('0x1d')](_0xa135('0x5d'));_0x56c5f1=applyJoinClauses(_0x56c5f1,!![]);_0xa1d60['group'](_0xa135('0x5e'));var _0x1a69b9=utils['getSelectedTags'](_0x4af9b0);if(!_[_0xa135('0x5f')](_0x1a69b9)){_0x56c5f1[_0xa135('0x60')]('t.id\x20IN\x20?',_0x1a69b9);}var _0x3a1258={'type':db[_0xa135('0x56')][_0xa135('0x61')][_0xa135('0x57')],'raw':!![]};return db[_0xa135('0x59')][_0xa135('0x62')](_0x56c5f1[_0xa135('0x5a')](),_0x3a1258)[_0xa135('0x48')](function(_0x2bf2dc){return _0x2bf2dc[0x0]['COUNT(*)'];});}module[_0xa135('0x63')]={'buildContactsQuery':buildContactsQuery,'checkListsRestrictions':checkListsRestrictions,'countFilteredContacts':countFilteredContacts,'getContactsSubquery':getContactsSubquery,'getFilteredContacts':getFilteredContacts,'parseAdvancedSearchFilter':parseAdvancedSearchFilter,'parseQueryParameters':parseQueryParameters,'skipContactsQuery':skipContactsQuery}; \ No newline at end of file +var _0x59ba=['Tags','clone','COUNT(*)','c.id','isEmpty','where','t.id\x20IN\x20?','query','toString','exports','lodash','squel','../parsers/qs','../../mysqldb','role','search','ListId','autocomplete','true','select','from','cm_contacts','c.deletedAt\x20IS\x20NULL','left_join','cm_user_has_contacts','.id','cm_contact_has_tags','ct.CmContactId\x20=\x20','tools_tags','t.id\x20=\x20ct.TagId','subqry','firstName','lastName','phone','mobile','email','CompanyId','createdAt','updatedAt','TagIds','includes','push','field','GROUP_CONCAT(DISTINCT\x20t.id)','expr','getSelectedTags','CONCAT(\x27,\x27,\x20subqry.TagIds,\x20\x27,\x27)\x20LIKE\x20?','replace','split','c.id\x20LIKE\x20?','c.phone\x20LIKE\x20?','c.mobile\x20LIKE\x20?','c.fax\x20LIKE\x20?','c.email\x20LIKE\x20?','c.lastName\x20LIKE\x20?','sqlOperator','conditions','find','name','dateOfBirth','datetime','DATE','buildExpression','type','default','text','value','end','Tag','map','tags','and','ids','User','user','clause','uc.UserId\x20=\x20?','skip','some','Contact','forEach','c.ListId\x20IN\x20?','concat','CONCAT_WS(\x27\x20\x27,\x20c.firstName,\x20c.lastName,\x20c.email)\x20LIKE\x20?','resolve','then','fields','tag','filter','getLists','length','c.ListId\x20IS\x20NULL','attributes','group','limit','offset','subqry.id','order','DESC','findAll','color','keyBy','Sequelize','QueryTypes','CmContact','sequelize'];(function(_0x231e16,_0x67347b){var _0x570a7c=function(_0x2c35b4){while(--_0x2c35b4){_0x231e16['push'](_0x231e16['shift']());}};_0x570a7c(++_0x67347b);}(_0x59ba,0xde));var _0xa59b=function(_0x1f700c,_0x1f93f4){_0x1f700c=_0x1f700c-0x0;var _0xe63654=_0x59ba[_0x1f700c];return _0xe63654;};'use strict';var _=require(_0xa59b('0x0'));var squel=require(_0xa59b('0x1'));var as=require('../parsers/advancedSearch');var qs=require(_0xa59b('0x2'));var utils=require('../interaction/utils');var db=require(_0xa59b('0x3'))['db'];function skipContactsQuery(_0x19d287,_0x1a300c){var _0x3c832c=![];if(_0x19d287[_0xa59b('0x4')]==='agent'&&!_0x1a300c[_0xa59b('0x5')]&&!_0x1a300c[_0xa59b('0x6')]&&_0x1a300c[_0xa59b('0x7')]!==_0xa59b('0x8')){_0x3c832c=!![];}return _0x3c832c;}function getContactsSubquery(){return squel[_0xa59b('0x9')]()[_0xa59b('0xa')](_0xa59b('0xb'),'c')['where'](_0xa59b('0xc'));}function applyJoinClauses(_0x4f7013,_0x41917c){var _0x505e0e=_0x41917c?'c':'subqry';_0x4f7013[_0xa59b('0xd')](_0xa59b('0xe'),'uc','uc.CmContactId\x20=\x20'+_0x505e0e+_0xa59b('0xf'))['left_join'](_0xa59b('0x10'),'ct',_0xa59b('0x11')+_0x505e0e+_0xa59b('0xf'))[_0xa59b('0xd')](_0xa59b('0x12'),'t',_0xa59b('0x13'));return _0x4f7013;}function addFieldsToQuery(_0x44e3d1,_0x5ebd65,_0x56e8a4,_0x426f28,_0x599c4a){var _0x6b87bb=_0x599c4a?'c':_0xa59b('0x14');if(!_0x5ebd65){_0x5ebd65=['id',_0xa59b('0x15'),_0xa59b('0x16'),_0xa59b('0x17'),_0xa59b('0x18'),'fax',_0xa59b('0x19'),_0xa59b('0x6'),_0xa59b('0x1a'),_0xa59b('0x1b'),_0xa59b('0x1c'),'deletedAt',_0xa59b('0x1d')];}else if(!_0x5ebd65[_0xa59b('0x1e')]('id')){_0x5ebd65[_0xa59b('0x1f')]('id');}var _0x4db9ca=_0x56e8a4&&_0x599c4a||!_0x56e8a4&&!_0x599c4a;if(_0x426f28){_0x4db9ca=_0x426f28&&_0x599c4a||!_0x426f28&&!_0x599c4a;}_0x5ebd65['forEach'](function(_0x1bc854){if(_0x1bc854===_0xa59b('0x1d')){if(_0x4db9ca){_0x44e3d1[_0xa59b('0x20')](_0xa59b('0x21'),_0x1bc854);}else if(_0x56e8a4||_0x426f28){_0x44e3d1[_0xa59b('0x20')](_0x6b87bb+'.'+_0x1bc854);}}else{_0x44e3d1[_0xa59b('0x20')](_0x6b87bb+'.'+_0x1bc854);}});return _0x44e3d1;}function getSqlClauses(){var _0x44b13c={'default':squel['expr'](),'fields':squel[_0xa59b('0x22')](),'filter':squel[_0xa59b('0x22')](),'tags':{'clause':squel[_0xa59b('0x22')](),'ids':null},'user':{'clause':squel[_0xa59b('0x22')](),'skip':![]}};return _0x44b13c;}function parseTagParameter(_0x3c8e9a){var _0x22c762=squel[_0xa59b('0x22')]();if(_0x3c8e9a){var _0x17d4fb=utils[_0xa59b('0x23')](_0x3c8e9a);_0x17d4fb['forEach'](function(_0x4ea64d){_0x22c762['or'](_0xa59b('0x24'),'%,'+_0x4ea64d+',%');});}return _0x22c762;}function parseSearchFilter(_0x2ffc14){var _0xda87a6=squel[_0xa59b('0x22')]();if(_0x2ffc14){var _0x23d101=_0x2ffc14['replace']('\x5c','\x5c\x5c')[_0xa59b('0x25')](/'/g,'\x27\x27');if(_0x23d101[_0xa59b('0x26')]('\x20')['length']>0x1){_0xda87a6['or']('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs['getFullTextValue'](_0x23d101,!![]),null);}else{if(qs['isNumeric'](_0x23d101)){_0xda87a6['or'](_0xa59b('0x27'),_0x23d101+'%');_0xda87a6['or'](_0xa59b('0x28'),_0x23d101+'%');_0xda87a6['or'](_0xa59b('0x29'),_0x23d101+'%');_0xda87a6['or'](_0xa59b('0x2a'),_0x23d101+'%');}else if(qs['isEmail'](_0x23d101)){_0xda87a6['or'](_0xa59b('0x2b'),_0x23d101+'%');}else{_0xda87a6['or']('c.firstName\x20LIKE\x20?','%'+_0x23d101+'%');_0xda87a6['or'](_0xa59b('0x2c'),'%'+_0x23d101+'%');_0xda87a6['or']('c.email\x20LIKE\x20?','%'+_0x23d101+'%');}}}return _0xda87a6;}function parseAdvancedSearchFilter(_0x41fef8,_0x19622b){var _0x330166=getSqlClauses();var _0x2a9d57=as['parseSearch'](_0x41fef8);var _0x4e41db=_0x2a9d57[_0xa59b('0x2d')];for(var _0x27234c=0x0;_0x27234c<_0x2a9d57['conditions']['length'];_0x27234c++){var _0x2b1f63=_0x2a9d57[_0xa59b('0x2e')][_0x27234c];var _0x2445af='c';var _0x46fda0=_[_0xa59b('0x2f')](_0x19622b,[_0xa59b('0x30'),_0x2b1f63[_0xa59b('0x20')]]);if(_0x46fda0){if(_0x2b1f63[_0xa59b('0x20')]===_0xa59b('0x31')||_0x46fda0['fieldType']===_0xa59b('0x32')){_0x2b1f63['castTo']=_0xa59b('0x33');}var _0x12392e=as[_0xa59b('0x34')](_0x2445af,_0x46fda0[_0xa59b('0x35')],_0x2b1f63);_0x330166[_0xa59b('0x36')][_0x4e41db](_0x12392e[_0xa59b('0x37')],_0x12392e['value']['start'],_0x12392e[_0xa59b('0x38')][_0xa59b('0x39')]);}else{if(_0x2b1f63['field']===_0xa59b('0x3a')){var _0xfb1733=_0x2b1f63[_0xa59b('0x38')]['split'](',')[_0xa59b('0x3b')](function(_0x4b0e64){return Number(_0x4b0e64);});var _0xa7caac=parseTagParameter(_0xfb1733);_0x330166[_0xa59b('0x3c')]['clause'][_0xa59b('0x3d')](_0xa7caac);_0x330166[_0xa59b('0x3c')][_0xa59b('0x3e')]=_0xfb1733;}else if(_0x2b1f63[_0xa59b('0x20')]===_0xa59b('0x3f')){_0x330166[_0xa59b('0x40')][_0xa59b('0x41')][_0xa59b('0x3d')](_0xa59b('0x42'),_0x2b1f63['value']);_0x330166[_0xa59b('0x40')][_0xa59b('0x43')]=!![];}}}return _0x330166;}function parseModelFields(_0x476d3c,_0x4a7f9f){var _0x2444a3=squel[_0xa59b('0x22')]();var _0x59d3f6=_(_0x476d3c)['keys']()[_0xa59b('0x3b')](function(_0x3be87e){return _[_0xa59b('0x44')](_0x4a7f9f,[_0xa59b('0x30'),_0x3be87e])?_0x3be87e:undefined;})['compact']()[_0xa59b('0x38')]();if(_0x476d3c[_0xa59b('0x45')]){_0x59d3f6[_0xa59b('0x1f')](_0xa59b('0x45'));}if(_0x476d3c[_0xa59b('0x3f')]){_0x59d3f6[_0xa59b('0x1f')](_0xa59b('0x3f'));}if(_0x59d3f6['length']>0x0){_0x59d3f6[_0xa59b('0x46')](function(_0x5e141a){if(_0x5e141a==='ListId'){_0x2444a3['and'](_0xa59b('0x47'),[][_0xa59b('0x48')](_0x476d3c[_0x5e141a]));}else if(_0x5e141a==='Contact'){var _0x278c3d='%'+_0x476d3c[_0x5e141a]+'%';_0x2444a3[_0xa59b('0x3d')](_0xa59b('0x49'),_0x278c3d);}else if(_0x5e141a===_0xa59b('0x3f')){_0x2444a3[_0xa59b('0x3d')](_0xa59b('0x42'),_0x476d3c[_0x5e141a]);}else{_0x2444a3[_0xa59b('0x3d')]('c.'+_0x5e141a+'\x20=\x20?',_0x476d3c[_0x5e141a]);}});}return _0x2444a3;}function parseQueryParameters(_0x56b2e5,_0x1a54b9){var _0x1d221f=getSqlClauses();return Promise[_0xa59b('0x4a')]()[_0xa59b('0x4b')](function(){return parseModelFields(_0x56b2e5,_0x1a54b9);})[_0xa59b('0x4b')](function(_0x299bb0){_0x1d221f[_0xa59b('0x4c')]['and'](_0x299bb0);return parseTagParameter(_0x56b2e5[_0xa59b('0x4d')]);})['then'](function(_0x510b9f){_0x1d221f['tags']['clause'][_0xa59b('0x3d')](_0x510b9f);return parseSearchFilter(_0x56b2e5[_0xa59b('0x4e')]);})[_0xa59b('0x4b')](function(_0x15ef99){_0x1d221f[_0xa59b('0x4e')]=_0x15ef99;return _0x1d221f;});}function checkListsRestrictions(_0x49fcd2,_0x5b7cb0,_0x5e7e9a){var _0x503fa1=squel[_0xa59b('0x22')]();return Promise[_0xa59b('0x4a')]()[_0xa59b('0x4b')](function(){if(_0x5b7cb0[_0xa59b('0x5')]&&_0x49fcd2[_0xa59b('0x4')]==='agent'&&!_0x5e7e9a){return _0x49fcd2[_0xa59b('0x4f')]({'attributes':['id'],'raw':!![]});}})[_0xa59b('0x4b')](function(_0x4551a0){if(_0x4551a0){if(_0x4551a0[_0xa59b('0x50')]===0x0){_0x503fa1[_0xa59b('0x3d')](_0xa59b('0x51'));}else{_0x503fa1['and'](_0xa59b('0x47'),_['map'](_0x4551a0,'id'));}}})['then'](function(){return _0x503fa1;});}function buildContactsQuery(_0x4569e3,_0x34875b,_0x4554a3,_0xd9d682,_0x4290f6,_0x4d80c6){if(_0x34875b){_0x34875b=_0x4554a3[_0xa59b('0x52')];}_0x4569e3=addFieldsToQuery(_0x4569e3,_0x34875b,_0xd9d682,_0x4d80c6,!![]);var _0x22e117=squel[_0xa59b('0x9')]();_0x22e117=addFieldsToQuery(_0x22e117,_0x34875b,_0xd9d682,_0x4d80c6,![]);if(_0xd9d682||_0x4d80c6){_0x4569e3=applyJoinClauses(_0x4569e3,!![]);_0x4569e3[_0xa59b('0x53')]('c.id');if(_0x4554a3[_0xa59b('0x54')]){_0x22e117[_0xa59b('0x54')](_0x4554a3[_0xa59b('0x54')]);}if(_0x4554a3['offset']){_0x22e117[_0xa59b('0x55')](_0x4554a3[_0xa59b('0x55')]);}}else{_0x22e117=applyJoinClauses(_0x22e117,![]);_0x22e117[_0xa59b('0x53')](_0xa59b('0x56'));if(_0x4554a3[_0xa59b('0x54')]){_0x4569e3['limit'](_0x4554a3['limit']);}if(_0x4554a3[_0xa59b('0x55')]){_0x4569e3[_0xa59b('0x55')](_0x4554a3[_0xa59b('0x55')]);}}_0x22e117['having'](_0x4290f6);if(_0x4554a3['order']){_0x4554a3[_0xa59b('0x57')][_0xa59b('0x46')](function(_0x4b3f3e){_0x4569e3['order']('c.'+_0x4b3f3e[0x0],_0x4b3f3e[0x1]==='DESC'?![]:!![]);_0x22e117[_0xa59b('0x57')]('subqry.'+_0x4b3f3e[0x0],_0x4b3f3e[0x1]===_0xa59b('0x58')?![]:!![]);});}_0x22e117[_0xa59b('0xa')](_0x4569e3,'subqry');return _0x22e117;}function getFilteredContacts(_0x571191){var _0x3a12fc=[];return db[_0xa59b('0x3a')][_0xa59b('0x59')]({'attributes':['id',_0xa59b('0x30'),_0xa59b('0x5a')],'raw':!![]})[_0xa59b('0x4b')](function(_0xdebaa6){_0x3a12fc=_[_0xa59b('0x5b')](_0xdebaa6,'id');var _0x19feaa={'type':db[_0xa59b('0x5c')][_0xa59b('0x5d')]['SELECT'],'model':db[_0xa59b('0x5e')],'mapToModel':!![],'nest':!![],'raw':!![]};return db[_0xa59b('0x5f')]['query'](_0x571191['toString'](),_0x19feaa);})[_0xa59b('0x4b')](function(_0x366b4b){_0x366b4b[_0xa59b('0x46')](function(_0x56cd50){if(_0x56cd50['TagIds']){_0x56cd50[_0xa59b('0x60')]=[];_0x56cd50[_0xa59b('0x1d')][_0xa59b('0x26')](',')['forEach'](function(_0x22173b){_0x56cd50[_0xa59b('0x60')]['push'](_0x3a12fc[_0x22173b]);});}delete _0x56cd50[_0xa59b('0x1d')];});return _0x366b4b;});}function countFilteredContacts(_0x564882,_0x451de2){var _0x217d35=_0x564882[_0xa59b('0x61')]();_0x217d35[_0xa59b('0x20')](_0xa59b('0x62'));_0x217d35=applyJoinClauses(_0x217d35,!![]);_0x564882[_0xa59b('0x53')](_0xa59b('0x63'));var _0x318f6a=utils[_0xa59b('0x23')](_0x451de2);if(!_[_0xa59b('0x64')](_0x318f6a)){_0x217d35[_0xa59b('0x65')](_0xa59b('0x66'),_0x318f6a);}var _0x18803d={'type':db[_0xa59b('0x5c')][_0xa59b('0x5d')]['SELECT'],'raw':!![]};return db['sequelize'][_0xa59b('0x67')](_0x217d35[_0xa59b('0x68')](),_0x18803d)['then'](function(_0x1a789b){return _0x1a789b[0x0][_0xa59b('0x62')];});}module[_0xa59b('0x69')]={'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 6b341d7..18c00be 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 _0xb4a5=['decryptFile','end','close','secret','utf8','base64','decryptString','bluebird','lodash','app','secrets','encrypt','algorithm','join','is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:','test','filter','indexOf','hasOwnProperty','encryptFile','createReadStream','createWriteStream','createCipher','data','update','binary','write','final'];(function(_0xfaad9e,_0x50ed64){var _0x255539=function(_0x28ffb4){while(--_0x28ffb4){_0xfaad9e['push'](_0xfaad9e['shift']());}};_0x255539(++_0x50ed64);}(_0xb4a5,0x173));var _0x5b4a=function(_0x288eb2,_0x2e2289){_0x288eb2=_0x288eb2-0x0;var _0x22abd6=_0xb4a5[_0x288eb2];return _0x22abd6;};'use strict';var crypto=require('crypto');var fs=require('fs');var BPromise=require(_0x5b4a('0x0'));var _=require(_0x5b4a('0x1'));var config=require('../../config/environment');var logger=require('../../config/logger')(_0x5b4a('0x2'));const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config[_0x5b4a('0x3')]['session'],'algorithm':'aes-256-ctr'};const fileOptions={'algorithm':'aes192'};if(config[_0x5b4a('0x4')]&&config['encrypt'][_0x5b4a('0x5')]){var isSupported=isAlgorithmSupported(config['encrypt'][_0x5b4a('0x5')]);if(isSupported){fileOptions[_0x5b4a('0x5')]=config[_0x5b4a('0x4')][_0x5b4a('0x5')];}else{var supportedAlgorithms=getSupportedCiphers()[_0x5b4a('0x6')](',\x20');logger['error'](config[_0x5b4a('0x4')][_0x5b4a('0x5')],_0x5b4a('0x7'),supportedAlgorithms);}}function isASupportedCipher(_0x4362ac){return AES_SUPPORTED_RX[_0x5b4a('0x8')](_0x4362ac);}function getSupportedCiphers(){return crypto['getCiphers']()[_0x5b4a('0x9')](isASupportedCipher);}function isAlgorithmSupported(_0x2d6092){return getSupportedCiphers()[_0x5b4a('0xa')](_0x2d6092)>-0x1;}function combineOptions(_0x5a8e72){var _0x259f04={};for(var _0x313639 in fileOptions){if(fileOptions[_0x5b4a('0xb')](_0x313639)){_0x259f04[_0x313639]=fileOptions[_0x313639];}}if(_0x5a8e72){for(var _0x45340d in _0x5a8e72){if(_0x5a8e72[_0x5b4a('0xb')](_0x45340d)){_0x259f04[_0x45340d]=_0x5a8e72[_0x45340d];}}}return _0x259f04;}exports[_0x5b4a('0xc')]=function(_0x20c615,_0x3650e6,_0x5c5493,_0x8c76ea){return new BPromise(function(_0xb08f22,_0x16ecba){_0x8c76ea=combineOptions(_0x8c76ea);var _0x4e5ccc=new Buffer(_0x5c5493);var _0x17bf09=fs[_0x5b4a('0xd')](_0x20c615);var _0x4b0174=fs[_0x5b4a('0xe')](_0x3650e6);var _0x5ca4d3=crypto[_0x5b4a('0xf')](_0x8c76ea[_0x5b4a('0x5')],_0x4e5ccc);_0x17bf09['on'](_0x5b4a('0x10'),function(_0x2df5ff){var _0x29fc1e=new Buffer(_0x5ca4d3[_0x5b4a('0x11')](_0x2df5ff),_0x5b4a('0x12'));_0x4b0174[_0x5b4a('0x13')](_0x29fc1e);});_0x17bf09['on']('end',function(){try{var _0x2ea9bf=new Buffer(_0x5ca4d3[_0x5b4a('0x14')](_0x5b4a('0x12')),_0x5b4a('0x12'));_0x4b0174['write'](_0x2ea9bf);_0x4b0174['end']();_0x4b0174['on']('close',function(){return _0xb08f22(_0x3650e6);});}catch(_0x3acb16){fs['unlink'](_0x3650e6);return _0x16ecba(_0x3acb16);}});});};exports[_0x5b4a('0x15')]=function(_0x2c384c,_0x184706,_0x217d66,_0x34e59b){return new BPromise(function(_0xf0455a,_0x51a90e){_0x34e59b=combineOptions(_0x34e59b);var _0x90fb80=new Buffer(_0x217d66);var _0x54aafb=fs['createReadStream'](_0x2c384c);var _0x4a08bc=fs['createWriteStream'](_0x184706);var _0x4afec=crypto['createDecipher'](_0x34e59b['algorithm'],_0x90fb80);_0x54aafb['on'](_0x5b4a('0x10'),function(_0x42f44b){var _0x481544=new Buffer(_0x4afec['update'](_0x42f44b),_0x5b4a('0x12'));_0x4a08bc[_0x5b4a('0x13')](_0x481544);});_0x54aafb['on'](_0x5b4a('0x16'),function(){try{var _0x532602=new Buffer(_0x4afec['final'](_0x5b4a('0x12')),_0x5b4a('0x12'));_0x4a08bc[_0x5b4a('0x13')](_0x532602);_0x4a08bc[_0x5b4a('0x16')]();_0x4a08bc['on'](_0x5b4a('0x17'),function(){return _0xf0455a(_0x184706);});}catch(_0x7a9019){fs['unlink'](_0x184706);return _0x51a90e(_0x7a9019);}});});};exports['encryptString']=function(_0x2e2e98,_0x22e344,_0xa9a49e){var _0x32159a=_0xa9a49e||stringOptions['algorithm'];var _0x218020=_0x22e344||stringOptions[_0x5b4a('0x18')];var _0x24b6b0=crypto[_0x5b4a('0xf')](_0x32159a,_0x218020);var _0x4ded99=_0x24b6b0[_0x5b4a('0x11')](_0x2e2e98,_0x5b4a('0x19'),_0x5b4a('0x1a'));_0x4ded99+=_0x24b6b0[_0x5b4a('0x14')](_0x5b4a('0x1a'));return _0x4ded99;};exports[_0x5b4a('0x1b')]=function(_0x35d113,_0x208afa,_0x1e1f27){var _0x34534c=_0x1e1f27||stringOptions[_0x5b4a('0x5')];var _0x323977=_0x208afa||stringOptions['secret'];var _0x321567=crypto['createDecipher'](_0x34534c,_0x323977);var _0x10493c=_0x321567['update'](_0x35d113,_0x5b4a('0x1a'),_0x5b4a('0x19'));_0x10493c+=_0x321567[_0x5b4a('0x14')](_0x5b4a('0x19'));return _0x10493c;}; \ No newline at end of file +var _0x0965=['encrypt','algorithm','error','test','getCiphers','filter','indexOf','hasOwnProperty','encryptFile','createWriteStream','data','update','binary','final','close','unlink','decryptFile','createReadStream','createDecipher','write','end','secret','createCipher','utf8','base64','decryptString','crypto','bluebird','lodash','../../config/environment','../../config/logger','app','secrets','aes192'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0965,0xa2));var _0x5096=function(_0x3d39d6,_0x2890f5){_0x3d39d6=_0x3d39d6-0x0;var _0x16b16f=_0x0965[_0x3d39d6];return _0x16b16f;};'use strict';var crypto=require(_0x5096('0x0'));var fs=require('fs');var BPromise=require(_0x5096('0x1'));var _=require(_0x5096('0x2'));var config=require(_0x5096('0x3'));var logger=require(_0x5096('0x4'))(_0x5096('0x5'));const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config[_0x5096('0x6')]['session'],'algorithm':'aes-256-ctr'};const fileOptions={'algorithm':_0x5096('0x7')};if(config[_0x5096('0x8')]&&config[_0x5096('0x8')][_0x5096('0x9')]){var isSupported=isAlgorithmSupported(config['encrypt'][_0x5096('0x9')]);if(isSupported){fileOptions[_0x5096('0x9')]=config['encrypt']['algorithm'];}else{var supportedAlgorithms=getSupportedCiphers()['join'](',\x20');logger[_0x5096('0xa')](config['encrypt'][_0x5096('0x9')],'is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:',supportedAlgorithms);}}function isASupportedCipher(_0x524971){return AES_SUPPORTED_RX[_0x5096('0xb')](_0x524971);}function getSupportedCiphers(){return crypto[_0x5096('0xc')]()[_0x5096('0xd')](isASupportedCipher);}function isAlgorithmSupported(_0x14c081){return getSupportedCiphers()[_0x5096('0xe')](_0x14c081)>-0x1;}function combineOptions(_0x42ef7a){var _0x310a3c={};for(var _0x5d9602 in fileOptions){if(fileOptions['hasOwnProperty'](_0x5d9602)){_0x310a3c[_0x5d9602]=fileOptions[_0x5d9602];}}if(_0x42ef7a){for(var _0x2fe2ca in _0x42ef7a){if(_0x42ef7a[_0x5096('0xf')](_0x2fe2ca)){_0x310a3c[_0x2fe2ca]=_0x42ef7a[_0x2fe2ca];}}}return _0x310a3c;}exports[_0x5096('0x10')]=function(_0x40e555,_0x47021b,_0x27e9f6,_0x43e416){return new BPromise(function(_0xa312c7,_0x1a9e25){_0x43e416=combineOptions(_0x43e416);var _0x47762f=new Buffer(_0x27e9f6);var _0x1859c1=fs['createReadStream'](_0x40e555);var _0x3c0bb9=fs[_0x5096('0x11')](_0x47021b);var _0x523345=crypto['createCipher'](_0x43e416[_0x5096('0x9')],_0x47762f);_0x1859c1['on'](_0x5096('0x12'),function(_0x208d32){var _0x5da118=new Buffer(_0x523345[_0x5096('0x13')](_0x208d32),_0x5096('0x14'));_0x3c0bb9['write'](_0x5da118);});_0x1859c1['on']('end',function(){try{var _0x1d4e53=new Buffer(_0x523345[_0x5096('0x15')](_0x5096('0x14')),_0x5096('0x14'));_0x3c0bb9['write'](_0x1d4e53);_0x3c0bb9['end']();_0x3c0bb9['on'](_0x5096('0x16'),function(){return _0xa312c7(_0x47021b);});}catch(_0x3492af){fs[_0x5096('0x17')](_0x47021b);return _0x1a9e25(_0x3492af);}});});};exports[_0x5096('0x18')]=function(_0x47dd2f,_0x176d0c,_0x435aea,_0x564c28){return new BPromise(function(_0x230431,_0x1b6dde){_0x564c28=combineOptions(_0x564c28);var _0x3e80be=new Buffer(_0x435aea);var _0x3726eb=fs[_0x5096('0x19')](_0x47dd2f);var _0x128f7c=fs['createWriteStream'](_0x176d0c);var _0x57d532=crypto[_0x5096('0x1a')](_0x564c28[_0x5096('0x9')],_0x3e80be);_0x3726eb['on']('data',function(_0x48f536){var _0xb8d8ac=new Buffer(_0x57d532[_0x5096('0x13')](_0x48f536),_0x5096('0x14'));_0x128f7c[_0x5096('0x1b')](_0xb8d8ac);});_0x3726eb['on'](_0x5096('0x1c'),function(){try{var _0x51ce1d=new Buffer(_0x57d532[_0x5096('0x15')](_0x5096('0x14')),_0x5096('0x14'));_0x128f7c['write'](_0x51ce1d);_0x128f7c[_0x5096('0x1c')]();_0x128f7c['on']('close',function(){return _0x230431(_0x176d0c);});}catch(_0xe46efb){fs['unlink'](_0x176d0c);return _0x1b6dde(_0xe46efb);}});});};exports['encryptString']=function(_0x5312b2,_0x3044ab,_0x573e13){var _0x14e1a0=_0x573e13||stringOptions[_0x5096('0x9')];var _0x3e3de4=_0x3044ab||stringOptions[_0x5096('0x1d')];var _0x3823de=crypto[_0x5096('0x1e')](_0x14e1a0,_0x3e3de4);var _0x10d52d=_0x3823de['update'](_0x5312b2,_0x5096('0x1f'),_0x5096('0x20'));_0x10d52d+=_0x3823de[_0x5096('0x15')](_0x5096('0x20'));return _0x10d52d;};exports[_0x5096('0x21')]=function(_0x27fd3e,_0x40409a,_0x5e3340){var _0x4c980d=_0x5e3340||stringOptions[_0x5096('0x9')];var _0x4a32f1=_0x40409a||stringOptions[_0x5096('0x1d')];var _0xf7806d=crypto[_0x5096('0x1a')](_0x4c980d,_0x4a32f1);var _0x527fec=_0xf7806d[_0x5096('0x13')](_0x27fd3e,_0x5096('0x20'),_0x5096('0x1f'));_0x527fec+=_0xf7806d[_0x5096('0x15')](_0x5096('0x1f'));return _0x527fec;}; \ No newline at end of file diff --git a/server/components/export/csv.js b/server/components/export/csv.js index ab52ee9..67c861e 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 _0x35ed=['range','num','forEach','sequelize','%s\x20limit\x20%d\x20OFFSET\x20%d','push','basename','existsSync','mkdirSync','join','%s%d.%s','csv','%s.%s','writeFileSync','zip','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','finally','exit','util','path','lodash','to-csv','dbH','../../config/logger','argv','AnalyticExtractedReport','update','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','CSV','Setting','find','split','splitSizeCsv','then','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','SELECT','Empty','length'];(function(_0x1daaa9,_0x220393){var _0x1dd221=function(_0x492c61){while(--_0x492c61){_0x1daaa9['push'](_0x1daaa9['shift']());}};_0x1dd221(++_0x220393);}(_0x35ed,0x1aa));var _0xd35e=function(_0x3bc505,_0x3e0639){_0x3bc505=_0x3bc505-0x0;var _0x5aa3ae=_0x35ed[_0x3bc505];return _0x5aa3ae;};'use strict';var util=require(_0xd35e('0x0'));var path=require(_0xd35e('0x1'));var _=require(_0xd35e('0x2'));var csv=require(_0xd35e('0x3'));var fs=require('fs');var BPromise=require('bluebird');var zipdir=require('zip-dir');var rimraf=require('rimraf');var db=require('../../mysqldb')['db'];var dbH=require('../../mysqldb')[_0xd35e('0x4')];var logger=require(_0xd35e('0x5'))('analytics');var EXTRACTED_REPORT_ID=Number(process[_0xd35e('0x6')][0x2]);var QUERY=process[_0xd35e('0x6')][0x3];var PATH=process[_0xd35e('0x6')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x5a01cd,_0x410872){var _0x361289={'status':_0x5a01cd};var _0x4db724={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x410872){_0x361289['savename']=_0x410872;}return db[_0xd35e('0x7')][_0xd35e('0x8')](_0x361289,_0x4db724);}function main(){var _0xe9875b=0x1388;var _0x4fd711;logger[_0xd35e('0x9')](util[_0xd35e('0xa')](_0xd35e('0xb'),EXTRACTED_REPORT_ID,_0xd35e('0xc')));return db[_0xd35e('0xd')][_0xd35e('0xe')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xd35e('0xf'),_0xd35e('0x10')]})[_0xd35e('0x11')](function(_0x4a2563){if(_0x4a2563){_0x4fd711=_0x4a2563;_0xe9875b=_0x4fd711['splitSizeCsv']||0x1388;}})['then'](function(){return dbH['sequelize'][_0xd35e('0x12')](util[_0xd35e('0xa')](_0xd35e('0x13'),QUERY),{'type':dbH['sequelize'][_0xd35e('0x14')][_0xd35e('0x15')]});})[_0xd35e('0x11')](function(_0x9144ec){if(!_0x9144ec[0x0]['num']){return analyticExtractedReport(_0xd35e('0x16'));}var _0x352e42=[];var _0x43d7cd=0x0;if(_0x4fd711[_0xd35e('0xf')]){if(_0x9144ec&&_0x9144ec[_0xd35e('0x17')]){var _0x5238c0=_[_0xd35e('0x18')](_0x9144ec[0x0][_0xd35e('0x19')]/_0xe9875b);var _0x2d60c7=Number['isInteger'](_0x9144ec[0x0][_0xd35e('0x19')]/_0xe9875b)?_0x9144ec[0x0]['num']%_0xe9875b:0x0;_0x5238c0[_0xd35e('0x1a')](function(_0x94eeea){if(_0x94eeea>0x0){_0x43d7cd+=_0xe9875b;}_0x352e42['push'](dbH[_0xd35e('0x1b')]['query'](util[_0xd35e('0xa')](_0xd35e('0x1c'),QUERY,_0xe9875b,_0x43d7cd),{'type':dbH[_0xd35e('0x1b')][_0xd35e('0x14')][_0xd35e('0x15')]}));});if(_0x2d60c7>0x0){_0x43d7cd+=_0xe9875b;_0x352e42[_0xd35e('0x1d')](dbH[_0xd35e('0x1b')][_0xd35e('0x12')](util[_0xd35e('0xa')](_0xd35e('0x1c'),QUERY,_0x2d60c7,_0x43d7cd),{'type':dbH['sequelize'][_0xd35e('0x14')][_0xd35e('0x15')]}));}}}else{_0x352e42[_0xd35e('0x1d')](dbH[_0xd35e('0x1b')][_0xd35e('0x12')](QUERY,{'type':dbH[_0xd35e('0x1b')]['QueryTypes']['SELECT']}));}var _0x4d3fc3=path['dirname'](PATH);var _0x223819=path[_0xd35e('0x1e')](PATH,'.csv');var _0x371113=_0x4fd711['split']&&_0x352e42[_0xd35e('0x17')]>0x1;var _0x35605e=[];if(!fs[_0xd35e('0x1f')](path['join'](_0x4d3fc3,_0x223819))&&_0x371113){fs[_0xd35e('0x20')](path['join'](_0x4d3fc3,_0x223819));}return BPromise['each'](_0x352e42,function(_0x260965){_0x35605e[_0xd35e('0x1d')](_0x260965);})[_0xd35e('0x11')](function(){for(var _0x31f719=0x0;_0x31f719<_0x35605e[_0xd35e('0x17')];_0x31f719+=0x1){var _0x343909;var _0x3daca0=_0x35605e[_0x31f719];if(_0x371113){_0x343909=path[_0xd35e('0x21')](_0x4d3fc3,_0x223819,util['format'](_0xd35e('0x22'),_0x223819,_0x31f719,_0xd35e('0x23')));}else{_0x343909=path['join'](_0x4d3fc3,util[_0xd35e('0xa')](_0xd35e('0x24'),_0x223819,_0xd35e('0x23')));}fs[_0xd35e('0x25')](_0x343909,csv(_0x3daca0));}})[_0xd35e('0x11')](function(){if(_0x371113){return new Promise(function(_0x1519fc){zipdir(path[_0xd35e('0x21')](_0x4d3fc3,_0x223819),{'saveTo':path[_0xd35e('0x21')](_0x4d3fc3,util[_0xd35e('0xa')](_0xd35e('0x24'),_0x223819,_0xd35e('0x26')))},function(_0x2996b6,_0x1bfeb2){rimraf(path['join'](_0x4d3fc3,_0x223819),function(){});_0x1519fc('zip\x20finished');});});}})[_0xd35e('0x11')](function(){logger[_0xd35e('0x9')](util['format'](_0xd35e('0x27'),EXTRACTED_REPORT_ID,_0xd35e('0xc')));return analyticExtractedReport(_0xd35e('0x28'),_0x371113?util[_0xd35e('0xa')](_0xd35e('0x24'),_0x223819,_0x371113?_0xd35e('0x26'):'csv'):null);});})['catch'](function(_0x4d5cf4){logger['info'](util[_0xd35e('0xa')](_0xd35e('0x29'),EXTRACTED_REPORT_ID,'CSV'),util[_0xd35e('0x2a')](_0x4d5cf4,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport('Failed');})[_0xd35e('0x2b')](function(){process[_0xd35e('0x2c')](EXIT_CODE);});}main(); \ No newline at end of file +var _0x6103=['Completed','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','Failed','finally','exit','util','path','lodash','bluebird','zip-dir','rimraf','../../mysqldb','dbH','analytics','argv','savename','AnalyticExtractedReport','update','info','format','find','split','splitSizeCsv','then','sequelize','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','SELECT','Empty','length','range','isInteger','num','forEach','push','%s\x20limit\x20%d\x20OFFSET\x20%d','dirname','basename','.csv','existsSync','join','mkdirSync','csv','%s.%s','writeFileSync','zip','zip\x20finished','CSV'];(function(_0x4817a0,_0x1040ae){var _0x48e0e8=function(_0x3872c6){while(--_0x3872c6){_0x4817a0['push'](_0x4817a0['shift']());}};_0x48e0e8(++_0x1040ae);}(_0x6103,0x196));var _0x3610=function(_0x6765c2,_0x1c4f41){_0x6765c2=_0x6765c2-0x0;var _0x3d1105=_0x6103[_0x6765c2];return _0x3d1105;};'use strict';var util=require(_0x3610('0x0'));var path=require(_0x3610('0x1'));var _=require(_0x3610('0x2'));var csv=require('to-csv');var fs=require('fs');var BPromise=require(_0x3610('0x3'));var zipdir=require(_0x3610('0x4'));var rimraf=require(_0x3610('0x5'));var db=require(_0x3610('0x6'))['db'];var dbH=require(_0x3610('0x6'))[_0x3610('0x7')];var logger=require('../../config/logger')(_0x3610('0x8'));var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process[_0x3610('0x9')][0x3];var PATH=process[_0x3610('0x9')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x317178,_0xba2e7c){var _0x33c9aa={'status':_0x317178};var _0x613d28={'where':{'id':EXTRACTED_REPORT_ID}};if(_0xba2e7c){_0x33c9aa[_0x3610('0xa')]=_0xba2e7c;}return db[_0x3610('0xb')][_0x3610('0xc')](_0x33c9aa,_0x613d28);}function main(){var _0x46e72f=0x1388;var _0x261c1d;logger[_0x3610('0xd')](util[_0x3610('0xe')]('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,'CSV'));return db['Setting'][_0x3610('0xf')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x3610('0x10'),'splitSizeCsv']})['then'](function(_0x30f1d1){if(_0x30f1d1){_0x261c1d=_0x30f1d1;_0x46e72f=_0x261c1d[_0x3610('0x11')]||0x1388;}})[_0x3610('0x12')](function(){return dbH[_0x3610('0x13')][_0x3610('0x14')](util['format'](_0x3610('0x15'),QUERY),{'type':dbH[_0x3610('0x13')][_0x3610('0x16')][_0x3610('0x17')]});})[_0x3610('0x12')](function(_0x264d19){if(!_0x264d19[0x0]['num']){return analyticExtractedReport(_0x3610('0x18'));}var _0x179567=[];var _0x829a27=0x0;if(_0x261c1d[_0x3610('0x10')]){if(_0x264d19&&_0x264d19[_0x3610('0x19')]){var _0x301505=_[_0x3610('0x1a')](_0x264d19[0x0]['num']/_0x46e72f);var _0x2d94f7=Number[_0x3610('0x1b')](_0x264d19[0x0][_0x3610('0x1c')]/_0x46e72f)?_0x264d19[0x0]['num']%_0x46e72f:0x0;_0x301505[_0x3610('0x1d')](function(_0xacc53f){if(_0xacc53f>0x0){_0x829a27+=_0x46e72f;}_0x179567[_0x3610('0x1e')](dbH[_0x3610('0x13')][_0x3610('0x14')](util[_0x3610('0xe')](_0x3610('0x1f'),QUERY,_0x46e72f,_0x829a27),{'type':dbH['sequelize']['QueryTypes']['SELECT']}));});if(_0x2d94f7>0x0){_0x829a27+=_0x46e72f;_0x179567[_0x3610('0x1e')](dbH[_0x3610('0x13')][_0x3610('0x14')](util[_0x3610('0xe')](_0x3610('0x1f'),QUERY,_0x2d94f7,_0x829a27),{'type':dbH[_0x3610('0x13')]['QueryTypes']['SELECT']}));}}}else{_0x179567[_0x3610('0x1e')](dbH[_0x3610('0x13')][_0x3610('0x14')](QUERY,{'type':dbH['sequelize'][_0x3610('0x16')][_0x3610('0x17')]}));}var _0x2186e7=path[_0x3610('0x20')](PATH);var _0x57e7e9=path[_0x3610('0x21')](PATH,_0x3610('0x22'));var _0x411f75=_0x261c1d['split']&&_0x179567[_0x3610('0x19')]>0x1;var _0x3943ef=[];if(!fs[_0x3610('0x23')](path[_0x3610('0x24')](_0x2186e7,_0x57e7e9))&&_0x411f75){fs[_0x3610('0x25')](path[_0x3610('0x24')](_0x2186e7,_0x57e7e9));}return BPromise['each'](_0x179567,function(_0x3a90f1){_0x3943ef['push'](_0x3a90f1);})[_0x3610('0x12')](function(){for(var _0x4d4717=0x0;_0x4d4717<_0x3943ef[_0x3610('0x19')];_0x4d4717+=0x1){var _0x4334fd;var _0x46da07=_0x3943ef[_0x4d4717];if(_0x411f75){_0x4334fd=path['join'](_0x2186e7,_0x57e7e9,util[_0x3610('0xe')]('%s%d.%s',_0x57e7e9,_0x4d4717,_0x3610('0x26')));}else{_0x4334fd=path[_0x3610('0x24')](_0x2186e7,util['format'](_0x3610('0x27'),_0x57e7e9,'csv'));}fs[_0x3610('0x28')](_0x4334fd,csv(_0x46da07));}})['then'](function(){if(_0x411f75){return new Promise(function(_0x5a10ac){zipdir(path['join'](_0x2186e7,_0x57e7e9),{'saveTo':path['join'](_0x2186e7,util[_0x3610('0xe')](_0x3610('0x27'),_0x57e7e9,_0x3610('0x29')))},function(_0x499ecc,_0x2aff6d){rimraf(path[_0x3610('0x24')](_0x2186e7,_0x57e7e9),function(){});_0x5a10ac(_0x3610('0x2a'));});});}})[_0x3610('0x12')](function(){logger[_0x3610('0xd')](util[_0x3610('0xe')]('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,_0x3610('0x2b')));return analyticExtractedReport(_0x3610('0x2c'),_0x411f75?util['format'](_0x3610('0x27'),_0x57e7e9,_0x411f75?'zip':_0x3610('0x26')):null);});})[_0x3610('0x2d')](function(_0x558d5f){logger['info'](util[_0x3610('0xe')](_0x3610('0x2e'),EXTRACTED_REPORT_ID,_0x3610('0x2b')),util['inspect'](_0x558d5f,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x3610('0x2f'));})[_0x3610('0x30')](function(){process[_0x3610('0x31')](EXIT_CODE);});}main(); \ No newline at end of file diff --git a/server/components/export/pdf.js b/server/components/export/pdf.js index fc1ade9..acc2325 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 _0xfee8=['Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','finally','exit','/fonts/arial-bold.ttf','/fonts/arial-italic.ttf','/fonts/arial-bold-italic.ttf','%s\x20#%d','interactionId','YYYY-MM-DD','center','Interaction\x20Transcript','pipe','finish','createPdfKitDocument','lodash','util','path','html-to-pdfmake','zip-dir','rimraf','JSDOM','window','../../mysqldb','dbH','analytics','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','savename','AnalyticExtractedReport','update','map','value','fill','length','auto','body','concat','chunk','keys','forEach','format','Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s','name','startDate','push','header','margin','landscape','toString','footer','Arial','black','right','Empty','Setting','find','then','splitSizePdf','split','range','num','isInteger','sequelize','query','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','SELECT','dirname','basename','.pdf','join','mkdirSync','each','%s%d.%s','pdf','%s.%s','zip','zip\x20finished','info','PDF','Completed'];(function(_0x4bad12,_0x129a95){var _0x506627=function(_0x595cc5){while(--_0x595cc5){_0x4bad12['push'](_0x4bad12['shift']());}};_0x506627(++_0x129a95);}(_0xfee8,0x1c1));var _0x8fee=function(_0x339c23,_0x541ff6){_0x339c23=_0x339c23-0x0;var _0x5bf134=_0xfee8[_0x339c23];return _0x5bf134;};'use strict';var _=require(_0x8fee('0x0'));var fs=require('fs');var util=require(_0x8fee('0x1'));var path=require(_0x8fee('0x2'));var moment=require('moment');var htmlToPdfmake=require(_0x8fee('0x3'));var PdfPrinter=require('pdfmake/src/printer');var zipdir=require(_0x8fee('0x4'));var rimraf=require(_0x8fee('0x5'));var JSDOM=require('jsdom')[_0x8fee('0x6')];var window=new JSDOM('')[_0x8fee('0x7')];var BPromise=require('bluebird');var db=require(_0x8fee('0x8'))['db'];var dbH=require(_0x8fee('0x8'))[_0x8fee('0x9')];var logger=require('../../config/logger')(_0x8fee('0xa'));var EXTRACTED_REPORT_ID=Number(process[_0x8fee('0xb')][0x2]);var QUERY=process[_0x8fee('0xb')][0x3];var PATH=process[_0x8fee('0xb')][0x4];var NAME=process[_0x8fee('0xb')][0x5];var FORMAT=_0x8fee('0xc');var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0x1b28fa,_0x19cee5){var _0x37b356={'status':_0x1b28fa};var _0x5ca413={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x19cee5){_0x37b356[_0x8fee('0xd')]=_0x19cee5;}return db[_0x8fee('0xe')][_0x8fee('0xf')](_0x37b356,_0x5ca413);}function getHeaders(_0xc29777){return _[_0x8fee('0x10')](_0xc29777,function(_0xdffeb9){return{'text':_0xdffeb9,'style':'tableHeader'};});}function getRows(_0x581c7f,_0x411de5){return _[_0x8fee('0x10')](_0x411de5,function(_0x399b45){return _(_0x399b45)['pick'](_0x581c7f)[_0x8fee('0x10')](function(_0x252691){return _0x252691?_['toString'](_0x252691):'';})[_0x8fee('0x11')]();});}function createTable(_0x135394,_0x27abe8){var _0x550065={'widths':_[_0x8fee('0x12')](Array(_0x135394[_0x8fee('0x13')]),0x91),'heights':function(_0x2c7e13){return _0x2c7e13===0x0?_0x8fee('0x14'):0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0x21198f=getHeaders(_0x135394);_0x550065[_0x8fee('0x15')]['push'](_0x21198f);var _0xc347dc=getRows(_0x135394,_0x27abe8);_0x550065[_0x8fee('0x15')]=_0x550065[_0x8fee('0x15')][_0x8fee('0x16')](_0xc347dc);return _0x550065;}function createTables(_0xb8f029){var _0x4bbc15=[];var _0x15bbb0=_[_0x8fee('0x17')](Object[_0x8fee('0x18')](_0xb8f029[0x0]),0x5);_0x15bbb0[_0x8fee('0x19')](function(_0x44cede){_0x4bbc15['push'](createTable(_0x44cede,_0xb8f029));});return _0x4bbc15;}function getPDFDocDefinition(_0x58c827){var _0x4dd2e2=util[_0x8fee('0x1a')](_0x8fee('0x1b'),NAME,EXTRACTED_REPORT[_0x8fee('0x1c')],moment(EXTRACTED_REPORT[_0x8fee('0x1d')])[_0x8fee('0x1a')](FORMAT),moment(EXTRACTED_REPORT['endDate'])[_0x8fee('0x1a')](FORMAT));var _0x44cc84=[];for(var _0x1eb4d9=0x0;_0x1eb4d9<_0x58c827['length'];_0x1eb4d9++){var _0x3c874d=[];if(_0x1eb4d9===0x0){_0x3c874d[_0x8fee('0x1e')]({'text':_0x4dd2e2,'style':_0x8fee('0x1f')});}var _0x3302dd={'table':_0x58c827[_0x1eb4d9]};if(_0x1eb4d9>0x0){_0x3302dd['pageBreak']='before';_0x3302dd[_0x8fee('0x20')]=[0x0,0x46,0x0,0x0];}_0x3c874d[_0x8fee('0x1e')](_0x3302dd);_0x44cc84[_0x8fee('0x1e')](_0x3c874d);}return{'pageSize':'A4','pageOrientation':_0x8fee('0x21'),'content':_0x44cc84,'footer':function(_0x2dc5a8,_0x42a937){return{'text':_0x2dc5a8[_0x8fee('0x22')]()+'\x20/\x20'+_0x42a937,'style':_0x8fee('0x23')};},'defaultStyle':{'font':_0x8fee('0x24')},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':_0x8fee('0x25')},'footer':{'alignment':_0x8fee('0x26'),'margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0x3cb884){var _0x4f1e8c=0x1388;var _0x2a5857;if(!_0x3cb884[0x0]['num']){return analyticExtractedReport(_0x8fee('0x27'));}return db[_0x8fee('0x28')][_0x8fee('0x29')]({'where':{'id':0x1},'raw':!![],'attributes':['id','split','splitSizePdf']})[_0x8fee('0x2a')](function(_0x4ee414){if(_0x4ee414){_0x2a5857=_0x4ee414;_0x4f1e8c=_0x2a5857[_0x8fee('0x2b')]||0x3e8;}})[_0x8fee('0x2a')](function(){var _0x5b7fe3=[];var _0x1a45ed=0x0;if(_0x2a5857[_0x8fee('0x2c')]){if(_0x3cb884&&_0x3cb884[_0x8fee('0x13')]){var _0x126c7e=_[_0x8fee('0x2d')](_0x3cb884[0x0][_0x8fee('0x2e')]/_0x4f1e8c);var _0x48d87b=Number[_0x8fee('0x2f')](_0x3cb884[0x0]['num']/_0x4f1e8c)?_0x3cb884[0x0][_0x8fee('0x2e')]%_0x4f1e8c:0x0;_0x126c7e[_0x8fee('0x19')](function(_0x4317c6){if(_0x4317c6>0x0){_0x1a45ed+=_0x4f1e8c;}_0x5b7fe3[_0x8fee('0x1e')](dbH[_0x8fee('0x30')][_0x8fee('0x31')](util[_0x8fee('0x1a')](_0x8fee('0x32'),QUERY,_0x4f1e8c,_0x1a45ed),{'type':dbH[_0x8fee('0x30')][_0x8fee('0x33')][_0x8fee('0x34')]}));});if(_0x48d87b>0x0){_0x1a45ed+=_0x4f1e8c;_0x5b7fe3[_0x8fee('0x1e')](dbH[_0x8fee('0x30')][_0x8fee('0x31')](util[_0x8fee('0x1a')](_0x8fee('0x32'),QUERY,_0x48d87b,_0x1a45ed),{'type':dbH[_0x8fee('0x30')][_0x8fee('0x33')][_0x8fee('0x34')]}));}}}else{_0x5b7fe3[_0x8fee('0x1e')](dbH[_0x8fee('0x30')][_0x8fee('0x31')](QUERY,{'type':dbH[_0x8fee('0x30')][_0x8fee('0x33')][_0x8fee('0x34')]}));}var _0x5b1794=path[_0x8fee('0x35')](PATH);var _0x2b034d=path[_0x8fee('0x36')](PATH,_0x8fee('0x37'));var _0x200129=_0x2a5857[_0x8fee('0x2c')]&&_0x5b7fe3['length']>0x1;var _0x19abbb=[];if(!fs['existsSync'](path[_0x8fee('0x38')](_0x5b1794,_0x2b034d))&&_0x200129){fs[_0x8fee('0x39')](path[_0x8fee('0x38')](_0x5b1794,_0x2b034d));}return BPromise[_0x8fee('0x3a')](_0x5b7fe3,function(_0x172cde){_0x19abbb[_0x8fee('0x1e')](_0x172cde);})[_0x8fee('0x2a')](function(){var _0x14561a=[];for(var _0x93076a=0x0;_0x93076a<_0x19abbb['length'];_0x93076a+=0x1){var _0xd103a7=_0x19abbb[_0x93076a];var _0x33d1ba=createTables(_['flatten'](_0xd103a7));var _0x181d53;var _0x312dea=getPDFDocDefinition(_0x33d1ba);var _0x4b2cb8=getPDFPrinter();var _0x21711f=_0x4b2cb8['createPdfKitDocument'](_0x312dea);if(_0x200129){_0x181d53=path['join'](_0x5b1794,_0x2b034d,util['format'](_0x8fee('0x3b'),_0x2b034d,_0x93076a,_0x8fee('0x3c')));}else{_0x181d53=path[_0x8fee('0x38')](_0x5b1794,util[_0x8fee('0x1a')](_0x8fee('0x3d'),_0x2b034d,_0x8fee('0x3c')));}_0x14561a[_0x8fee('0x1e')](writePDFDocument(_0x21711f,_0x181d53));}return Promise['all'](_0x14561a);})[_0x8fee('0x2a')](function(){if(_0x200129){return new Promise(function(_0x350f4){zipdir(path['join'](_0x5b1794,_0x2b034d),{'saveTo':path[_0x8fee('0x38')](_0x5b1794,util[_0x8fee('0x1a')](_0x8fee('0x3d'),_0x2b034d,_0x8fee('0x3e')))},function(){rimraf(path[_0x8fee('0x38')](_0x5b1794,_0x2b034d),function(){});_0x350f4(_0x8fee('0x3f'));});});}})[_0x8fee('0x2a')](function(){if(!_0x200129)return;rimraf(path[_0x8fee('0x38')](_0x5b1794,_0x2b034d),function(){});})[_0x8fee('0x2a')](function(){logger[_0x8fee('0x40')](util[_0x8fee('0x1a')]('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,_0x8fee('0x41')));return analyticExtractedReport(_0x8fee('0x42'),_0x200129?util[_0x8fee('0x1a')]('%s.%s',_0x2b034d,_0x200129?_0x8fee('0x3e'):_0x8fee('0x3c')):null);});});}function main(){if(!EXTRACTED_REPORT_ID)return;logger[_0x8fee('0x40')](util[_0x8fee('0x1a')](_0x8fee('0x43'),EXTRACTED_REPORT_ID,_0x8fee('0x41')));return db[_0x8fee('0xe')]['findOne']({'where':{'id':EXTRACTED_REPORT_ID}})[_0x8fee('0x2a')](function(_0xcfdad2){EXTRACTED_REPORT=_0xcfdad2;return dbH['sequelize'][_0x8fee('0x31')](util[_0x8fee('0x1a')](_0x8fee('0x44'),QUERY),{'type':dbH[_0x8fee('0x30')]['QueryTypes']['SELECT']});})[_0x8fee('0x2a')](extractReport)[_0x8fee('0x45')](function(_0x391560){logger[_0x8fee('0x40')](util['format'](_0x8fee('0x46'),EXTRACTED_REPORT_ID,_0x8fee('0x41')),util[_0x8fee('0x47')](_0x391560,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x8fee('0x48'));})[_0x8fee('0x49')](function(){process[_0x8fee('0x4a')](EXIT_CODE);});}main();function getPDFPrinter(){var _0x48562e=new PdfPrinter({'Arial':{'normal':__dirname+'/fonts/arial-regular.ttf','bold':__dirname+_0x8fee('0x4b'),'italics':__dirname+_0x8fee('0x4c'),'bolditalics':__dirname+_0x8fee('0x4d')}});return _0x48562e;}function getPDFDocDefinitionFromHTML(_0x1bc093,_0x5a4b72){var _0x2694ba=util[_0x8fee('0x1a')](_0x8fee('0x4e'),_0x5a4b72['channel'],_0x5a4b72[_0x8fee('0x4f')]);var _0x1a4e19=moment()[_0x8fee('0x1a')](_0x8fee('0x50'))[_0x8fee('0x22')]();var _0x4966f8=htmlToPdfmake(_0x1bc093,{'window':window,'tableAutoSize':!![]});return{'content':[_0x4966f8],'defaultStyle':{'font':_0x8fee('0x24')},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':_0x8fee('0x51'),'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':_0x8fee('0x51')}},'header':function(){return[{'text':_0x8fee('0x52'),'style':_0x8fee('0x1f')}];},'footer':function(_0x55a1e5,_0x175525){return[{'text':util[_0x8fee('0x1a')]('\x09\x09XCALLY\x20Motion\x20-\x20%s\x09\x09\x09\x09%d/%d\x09\x09\x09\x09%s',_0x2694ba,_0x55a1e5,_0x175525,_0x1a4e19),'style':_0x8fee('0x23')}];}};}function writePDFDocument(_0x555b87,_0x21fbb8){return new Promise(function(_0x2f001a,_0x49237c){var _0x4d8312=_0x555b87[_0x8fee('0x53')](fs['createWriteStream'](_0x21fbb8));_0x4d8312['on'](_0x8fee('0x54'),function(){_0x2f001a(_0x8fee('0x54'));});_0x4d8312['on']('error',function(_0x16ccc6){_0x49237c(_0x16ccc6);});_0x555b87['end']();});}exports['createPdfFromHTML']=function(_0x5c9678,_0x3d62fd){var _0x121412=getPDFPrinter();var _0x36bbe6=getPDFDocDefinitionFromHTML(_0x5c9678,_0x3d62fd);var _0x5e0975=_0x121412[_0x8fee('0x55')](_0x36bbe6);return writePDFDocument(_0x5e0975,_0x3d62fd[_0x8fee('0x2')])['catch'](function(_0x566c65){throw _0x566c65;});}; \ No newline at end of file +var _0x08e6=['startDate','endDate','pageBreak','before','margin','landscape','\x20/\x20','footer','Arial','right','num','Setting','split','splitSizePdf','then','range','isInteger','sequelize','%s\x20limit\x20%d\x20OFFSET\x20%d','SELECT','query','QueryTypes','basename','.pdf','existsSync','mkdirSync','each','join','%s.%s','pdf','all','zip','zip\x20finished','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','PDF','Completed','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','catch','info','inspect','Failed','finally','exit','/fonts/arial-regular.ttf','/fonts/arial-italic.ttf','/fonts/arial-bold-italic.ttf','%s\x20#%d','channel','interactionId','YYYY-MM-DD','toString','center','header','\x09\x09XCALLY\x20Motion\x20-\x20%s\x09\x09\x09\x09%d/%d\x09\x09\x09\x09%s','pipe','finish','error','end','path','lodash','moment','html-to-pdfmake','pdfmake/src/printer','JSDOM','window','bluebird','../../mysqldb','analytics','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','savename','AnalyticExtractedReport','update','map','tableHeader','value','fill','length','auto','body','push','chunk','forEach','format','Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s'];(function(_0x3b5250,_0x7a0b2c){var _0xc844a1=function(_0x2fbc98){while(--_0x2fbc98){_0x3b5250['push'](_0x3b5250['shift']());}};_0xc844a1(++_0x7a0b2c);}(_0x08e6,0xe8));var _0x608e=function(_0x448398,_0x3b8be){_0x448398=_0x448398-0x0;var _0x2afefc=_0x08e6[_0x448398];return _0x2afefc;};'use strict';var _=require(_0x608e('0x0'));var fs=require('fs');var util=require('util');var path=require('path');var moment=require(_0x608e('0x1'));var htmlToPdfmake=require(_0x608e('0x2'));var PdfPrinter=require(_0x608e('0x3'));var zipdir=require('zip-dir');var rimraf=require('rimraf');var JSDOM=require('jsdom')[_0x608e('0x4')];var window=new JSDOM('')[_0x608e('0x5')];var BPromise=require(_0x608e('0x6'));var db=require(_0x608e('0x7'))['db'];var dbH=require('../../mysqldb')['dbH'];var logger=require('../../config/logger')(_0x608e('0x8'));var EXTRACTED_REPORT_ID=Number(process[_0x608e('0x9')][0x2]);var QUERY=process['argv'][0x3];var PATH=process['argv'][0x4];var NAME=process['argv'][0x5];var FORMAT=_0x608e('0xa');var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0x4f0db7,_0x194f47){var _0x23a9f8={'status':_0x4f0db7};var _0x46f849={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x194f47){_0x23a9f8[_0x608e('0xb')]=_0x194f47;}return db[_0x608e('0xc')][_0x608e('0xd')](_0x23a9f8,_0x46f849);}function getHeaders(_0x55eb54){return _[_0x608e('0xe')](_0x55eb54,function(_0x4890eb){return{'text':_0x4890eb,'style':_0x608e('0xf')};});}function getRows(_0x34346f,_0x1e0dbc){return _['map'](_0x1e0dbc,function(_0x3fde90){return _(_0x3fde90)['pick'](_0x34346f)[_0x608e('0xe')](function(_0x2b9452){return _0x2b9452?_['toString'](_0x2b9452):'';})[_0x608e('0x10')]();});}function createTable(_0x5999b1,_0x4fe125){var _0x13df6f={'widths':_[_0x608e('0x11')](Array(_0x5999b1[_0x608e('0x12')]),0x91),'heights':function(_0x4c6c62){return _0x4c6c62===0x0?_0x608e('0x13'):0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0x31f64a=getHeaders(_0x5999b1);_0x13df6f[_0x608e('0x14')][_0x608e('0x15')](_0x31f64a);var _0x5450c4=getRows(_0x5999b1,_0x4fe125);_0x13df6f[_0x608e('0x14')]=_0x13df6f[_0x608e('0x14')]['concat'](_0x5450c4);return _0x13df6f;}function createTables(_0x11872b){var _0x46d35b=[];var _0x579fe8=_[_0x608e('0x16')](Object['keys'](_0x11872b[0x0]),0x5);_0x579fe8[_0x608e('0x17')](function(_0x201303){_0x46d35b[_0x608e('0x15')](createTable(_0x201303,_0x11872b));});return _0x46d35b;}function getPDFDocDefinition(_0x3dc705){var _0x42f028=util[_0x608e('0x18')](_0x608e('0x19'),NAME,EXTRACTED_REPORT['name'],moment(EXTRACTED_REPORT[_0x608e('0x1a')])[_0x608e('0x18')](FORMAT),moment(EXTRACTED_REPORT[_0x608e('0x1b')])[_0x608e('0x18')](FORMAT));var _0x37507d=[];for(var _0x4728fd=0x0;_0x4728fd<_0x3dc705['length'];_0x4728fd++){var _0x102781=[];if(_0x4728fd===0x0){_0x102781['push']({'text':_0x42f028,'style':'header'});}var _0x4354c5={'table':_0x3dc705[_0x4728fd]};if(_0x4728fd>0x0){_0x4354c5[_0x608e('0x1c')]=_0x608e('0x1d');_0x4354c5[_0x608e('0x1e')]=[0x0,0x46,0x0,0x0];}_0x102781['push'](_0x4354c5);_0x37507d[_0x608e('0x15')](_0x102781);}return{'pageSize':'A4','pageOrientation':_0x608e('0x1f'),'content':_0x37507d,'footer':function(_0x271f6e,_0xb4556){return{'text':_0x271f6e['toString']()+_0x608e('0x20')+_0xb4556,'style':_0x608e('0x21')};},'defaultStyle':{'font':_0x608e('0x22')},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':'black'},'footer':{'alignment':_0x608e('0x23'),'margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0x19f35d){var _0x5316af=0x1388;var _0x9023f8;if(!_0x19f35d[0x0][_0x608e('0x24')]){return analyticExtractedReport('Empty');}return db[_0x608e('0x25')]['find']({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x608e('0x26'),_0x608e('0x27')]})[_0x608e('0x28')](function(_0x41af44){if(_0x41af44){_0x9023f8=_0x41af44;_0x5316af=_0x9023f8['splitSizePdf']||0x3e8;}})['then'](function(){var _0x5a251c=[];var _0x46cf4c=0x0;if(_0x9023f8[_0x608e('0x26')]){if(_0x19f35d&&_0x19f35d[_0x608e('0x12')]){var _0x45b23f=_[_0x608e('0x29')](_0x19f35d[0x0]['num']/_0x5316af);var _0x3304a3=Number[_0x608e('0x2a')](_0x19f35d[0x0][_0x608e('0x24')]/_0x5316af)?_0x19f35d[0x0][_0x608e('0x24')]%_0x5316af:0x0;_0x45b23f['forEach'](function(_0x5475b9){if(_0x5475b9>0x0){_0x46cf4c+=_0x5316af;}_0x5a251c['push'](dbH[_0x608e('0x2b')]['query'](util[_0x608e('0x18')](_0x608e('0x2c'),QUERY,_0x5316af,_0x46cf4c),{'type':dbH[_0x608e('0x2b')]['QueryTypes'][_0x608e('0x2d')]}));});if(_0x3304a3>0x0){_0x46cf4c+=_0x5316af;_0x5a251c[_0x608e('0x15')](dbH['sequelize'][_0x608e('0x2e')](util[_0x608e('0x18')](_0x608e('0x2c'),QUERY,_0x3304a3,_0x46cf4c),{'type':dbH[_0x608e('0x2b')][_0x608e('0x2f')][_0x608e('0x2d')]}));}}}else{_0x5a251c[_0x608e('0x15')](dbH['sequelize'][_0x608e('0x2e')](QUERY,{'type':dbH[_0x608e('0x2b')][_0x608e('0x2f')][_0x608e('0x2d')]}));}var _0x404e43=path['dirname'](PATH);var _0x32f350=path[_0x608e('0x30')](PATH,_0x608e('0x31'));var _0x4fc196=_0x9023f8[_0x608e('0x26')]&&_0x5a251c['length']>0x1;var _0x5d61e0=[];if(!fs[_0x608e('0x32')](path['join'](_0x404e43,_0x32f350))&&_0x4fc196){fs[_0x608e('0x33')](path['join'](_0x404e43,_0x32f350));}return BPromise[_0x608e('0x34')](_0x5a251c,function(_0x18ad0a){_0x5d61e0[_0x608e('0x15')](_0x18ad0a);})[_0x608e('0x28')](function(){var _0x55df6e=[];for(var _0x2fbc63=0x0;_0x2fbc63<_0x5d61e0[_0x608e('0x12')];_0x2fbc63+=0x1){var _0x353f95=_0x5d61e0[_0x2fbc63];var _0x5dce1f=createTables(_['flatten'](_0x353f95));var _0x56ef0a;var _0x243f86=getPDFDocDefinition(_0x5dce1f);var _0x45e7c0=getPDFPrinter();var _0x51d557=_0x45e7c0['createPdfKitDocument'](_0x243f86);if(_0x4fc196){_0x56ef0a=path['join'](_0x404e43,_0x32f350,util['format']('%s%d.%s',_0x32f350,_0x2fbc63,'pdf'));}else{_0x56ef0a=path[_0x608e('0x35')](_0x404e43,util[_0x608e('0x18')](_0x608e('0x36'),_0x32f350,_0x608e('0x37')));}_0x55df6e['push'](writePDFDocument(_0x51d557,_0x56ef0a));}return Promise[_0x608e('0x38')](_0x55df6e);})[_0x608e('0x28')](function(){if(_0x4fc196){return new Promise(function(_0x25cff7){zipdir(path[_0x608e('0x35')](_0x404e43,_0x32f350),{'saveTo':path['join'](_0x404e43,util[_0x608e('0x18')]('%s.%s',_0x32f350,_0x608e('0x39')))},function(){rimraf(path[_0x608e('0x35')](_0x404e43,_0x32f350),function(){});_0x25cff7(_0x608e('0x3a'));});});}})[_0x608e('0x28')](function(){if(!_0x4fc196)return;rimraf(path['join'](_0x404e43,_0x32f350),function(){});})[_0x608e('0x28')](function(){logger['info'](util['format'](_0x608e('0x3b'),EXTRACTED_REPORT_ID,_0x608e('0x3c')));return analyticExtractedReport(_0x608e('0x3d'),_0x4fc196?util[_0x608e('0x18')]('%s.%s',_0x32f350,_0x4fc196?_0x608e('0x39'):_0x608e('0x37')):null);});});}function main(){if(!EXTRACTED_REPORT_ID)return;logger['info'](util[_0x608e('0x18')](_0x608e('0x3e'),EXTRACTED_REPORT_ID,_0x608e('0x3c')));return db[_0x608e('0xc')]['findOne']({'where':{'id':EXTRACTED_REPORT_ID}})[_0x608e('0x28')](function(_0x3c7a35){EXTRACTED_REPORT=_0x3c7a35;return dbH[_0x608e('0x2b')][_0x608e('0x2e')](util[_0x608e('0x18')](_0x608e('0x3f'),QUERY),{'type':dbH[_0x608e('0x2b')]['QueryTypes'][_0x608e('0x2d')]});})['then'](extractReport)[_0x608e('0x40')](function(_0x882b52){logger[_0x608e('0x41')](util[_0x608e('0x18')]('Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0x608e('0x3c')),util[_0x608e('0x42')](_0x882b52,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x608e('0x43'));})[_0x608e('0x44')](function(){process[_0x608e('0x45')](EXIT_CODE);});}main();function getPDFPrinter(){var _0x15bca0=new PdfPrinter({'Arial':{'normal':__dirname+_0x608e('0x46'),'bold':__dirname+'/fonts/arial-bold.ttf','italics':__dirname+_0x608e('0x47'),'bolditalics':__dirname+_0x608e('0x48')}});return _0x15bca0;}function getPDFDocDefinitionFromHTML(_0x330145,_0x365e5f){var _0x35d22a=util[_0x608e('0x18')](_0x608e('0x49'),_0x365e5f[_0x608e('0x4a')],_0x365e5f[_0x608e('0x4b')]);var _0x35bfc6=moment()[_0x608e('0x18')](_0x608e('0x4c'))[_0x608e('0x4d')]();var _0x39cc0e=htmlToPdfmake(_0x330145,{'window':window,'tableAutoSize':!![]});return{'content':[_0x39cc0e],'defaultStyle':{'font':'Arial'},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':_0x608e('0x4e'),'margin':[0xa,0xa,0xa,0xa]},'footer':{'fontSize':0x9,'alignment':_0x608e('0x4e'),'margin':[0xa,0x14,0xa,0xa]},'textblock':{'fontSize':0xb},'textfield':{'bold':!![]},'messageContainer':{'fontSize':0xa},'messageInfo':{'bold':!![]},'interactionData':{'alignment':_0x608e('0x4e')}},'header':function(){return[{'text':'Interaction\x20Transcript','style':_0x608e('0x4f')}];},'footer':function(_0x1fa5aa,_0x395a34){return[{'text':util['format'](_0x608e('0x50'),_0x35d22a,_0x1fa5aa,_0x395a34,_0x35bfc6),'style':'footer'}];}};}function writePDFDocument(_0x978be3,_0x506266){return new Promise(function(_0x3f8f34,_0x2448f6){var _0x3a27ae=_0x978be3[_0x608e('0x51')](fs['createWriteStream'](_0x506266));_0x3a27ae['on'](_0x608e('0x52'),function(){_0x3f8f34('finish');});_0x3a27ae['on'](_0x608e('0x53'),function(_0x49ab1b){_0x2448f6(_0x49ab1b);});_0x978be3[_0x608e('0x54')]();});}exports['createPdfFromHTML']=function(_0x9d7250,_0x48b0ef){var _0x556dce=getPDFPrinter();var _0x141908=getPDFDocDefinitionFromHTML(_0x9d7250,_0x48b0ef);var _0x5cc7a0=_0x556dce['createPdfKitDocument'](_0x141908);return writePDFDocument(_0x5cc7a0,_0x48b0ef[_0x608e('0x55')])[_0x608e('0x40')](function(_0x264cd0){throw _0x264cd0;});}; \ No newline at end of file diff --git a/server/components/export/xlsx.js b/server/components/export/xlsx.js index 37a1de7..e1e574f 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 _0x2556=['%s.%s','zip','zip\x20finished','Completed','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','Failed','finally','exit','util','path','lodash','bluebird','zip-dir','../../mysqldb','dbH','../../config/logger','argv','savename','AnalyticExtractedReport','update','info','format','XLSX','Setting','split','splitSizeXlsx','sequelize','query','SELECT','then','Empty','length','num','QueryTypes','push','%s\x20limit\x20%d\x20OFFSET\x20%d','basename','.xlsx','existsSync','mkdirSync','each','join','%s%d.%s','xlsx','writeFileSync','binary'];(function(_0x521553,_0x26da84){var _0xc2af80=function(_0x38c012){while(--_0x38c012){_0x521553['push'](_0x521553['shift']());}};_0xc2af80(++_0x26da84);}(_0x2556,0x11c));var _0x6255=function(_0x2070da,_0x45e586){_0x2070da=_0x2070da-0x0;var _0x4f9fe1=_0x2556[_0x2070da];return _0x4f9fe1;};'use strict';var util=require(_0x6255('0x0'));var path=require(_0x6255('0x1'));var _=require(_0x6255('0x2'));var fs=require('fs');var json2xls=require('json2xls');var BPromise=require(_0x6255('0x3'));var zipdir=require(_0x6255('0x4'));var rimraf=require('rimraf');var db=require(_0x6255('0x5'))['db'];var dbH=require('../../mysqldb')[_0x6255('0x6')];var logger=require(_0x6255('0x7'))('analytics');var EXTRACTED_REPORT_ID=Number(process[_0x6255('0x8')][0x2]);var QUERY=process['argv'][0x3];var PATH=process['argv'][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x2d6571,_0x2c23a7){var _0xf78900={'status':_0x2d6571};var _0x40c8aa={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x2c23a7){_0xf78900[_0x6255('0x9')]=_0x2c23a7;}return db[_0x6255('0xa')][_0x6255('0xb')](_0xf78900,_0x40c8aa);}function main(){var _0x26ef4f=0x1388;var _0x37b266;logger[_0x6255('0xc')](util[_0x6255('0xd')]('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0x6255('0xe')));return db[_0x6255('0xf')]['find']({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x6255('0x10'),_0x6255('0x11')]})['then'](function(_0x42577e){if(_0x42577e){_0x37b266=_0x42577e;_0x26ef4f=_0x37b266[_0x6255('0x11')]||0x1388;}})['then'](function(){return dbH[_0x6255('0x12')][_0x6255('0x13')](util[_0x6255('0xd')]('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH[_0x6255('0x12')]['QueryTypes'][_0x6255('0x14')]});})[_0x6255('0x15')](function(_0x1ca22c){if(!_0x1ca22c[0x0]['num']){return analyticExtractedReport(_0x6255('0x16'));}var _0x34b8f7=[];var _0x13308=0x0;if(_0x37b266['split']){if(_0x1ca22c&&_0x1ca22c[_0x6255('0x17')]){var _0x404c35=_['range'](_0x1ca22c[0x0][_0x6255('0x18')]/_0x26ef4f);var _0x5770c2=Number['isInteger'](_0x1ca22c[0x0][_0x6255('0x18')]/_0x26ef4f)?_0x1ca22c[0x0][_0x6255('0x18')]%_0x26ef4f:0x0;_0x404c35['forEach'](function(_0xe2484b){if(_0xe2484b>0x0){_0x13308+=_0x26ef4f;}_0x34b8f7['push'](dbH[_0x6255('0x12')][_0x6255('0x13')](util[_0x6255('0xd')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x26ef4f,_0x13308),{'type':dbH['sequelize'][_0x6255('0x19')][_0x6255('0x14')]}));});if(_0x5770c2>0x0){_0x13308+=_0x26ef4f;_0x34b8f7[_0x6255('0x1a')](dbH[_0x6255('0x12')][_0x6255('0x13')](util['format'](_0x6255('0x1b'),QUERY,_0x5770c2,_0x13308),{'type':dbH[_0x6255('0x12')][_0x6255('0x19')][_0x6255('0x14')]}));}}}else{_0x34b8f7[_0x6255('0x1a')](dbH['sequelize'][_0x6255('0x13')](QUERY,{'type':dbH[_0x6255('0x12')][_0x6255('0x19')][_0x6255('0x14')]}));}var _0xacf64f=path['dirname'](PATH);var _0x185be3=path[_0x6255('0x1c')](PATH,_0x6255('0x1d'));var _0x5e613b=_0x37b266[_0x6255('0x10')]&&_0x34b8f7[_0x6255('0x17')]>0x1;var _0x301b12=[];if(!fs[_0x6255('0x1e')](path['join'](_0xacf64f,_0x185be3))&&_0x5e613b){fs[_0x6255('0x1f')](path['join'](_0xacf64f,_0x185be3));}return BPromise[_0x6255('0x20')](_0x34b8f7,function(_0x33fe27){_0x301b12[_0x6255('0x1a')](_0x33fe27);})[_0x6255('0x15')](function(){for(var _0x375bed=0x0;_0x375bed<_0x301b12[_0x6255('0x17')];_0x375bed+=0x1){var _0x58bef7;var _0x174b4d=_0x301b12[_0x375bed];if(_0x5e613b){_0x58bef7=path[_0x6255('0x21')](_0xacf64f,_0x185be3,util[_0x6255('0xd')](_0x6255('0x22'),_0x185be3,_0x375bed,_0x6255('0x23')));}else{_0x58bef7=path[_0x6255('0x21')](_0xacf64f,util[_0x6255('0xd')]('%s.%s',_0x185be3,_0x6255('0x23')));}fs[_0x6255('0x24')](_0x58bef7,json2xls(_0x174b4d),_0x6255('0x25'));}})['then'](function(){if(_0x5e613b){return new Promise(function(_0x317b6b){zipdir(path['join'](_0xacf64f,_0x185be3),{'saveTo':path['join'](_0xacf64f,util[_0x6255('0xd')](_0x6255('0x26'),_0x185be3,_0x6255('0x27')))},function(_0x295fcb,_0x1eaf19){rimraf(path[_0x6255('0x21')](_0xacf64f,_0x185be3),function(){});_0x317b6b(_0x6255('0x28'));});});}})[_0x6255('0x15')](function(){logger[_0x6255('0xc')](util[_0x6255('0xd')]('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,_0x6255('0xe')));return analyticExtractedReport(_0x6255('0x29'),_0x5e613b?util[_0x6255('0xd')](_0x6255('0x26'),_0x185be3,_0x5e613b?'zip':_0x6255('0x23')):null);});})['catch'](function(_0x2c23a6){logger[_0x6255('0xc')](util['format'](_0x6255('0x2a'),EXTRACTED_REPORT_ID,_0x6255('0xe')),util['inspect'](_0x2c23a6,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x6255('0x2b'));})[_0x6255('0x2c')](function(){process[_0x6255('0x2d')](EXIT_CODE);});}main(); \ No newline at end of file +var _0xf4a3=['dbH','argv','savename','AnalyticExtractedReport','update','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','XLSX','Setting','find','splitSizeXlsx','then','sequelize','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','SELECT','num','length','range','isInteger','forEach','push','query','%s\x20limit\x20%d\x20OFFSET\x20%d','dirname','basename','.xlsx','existsSync','join','mkdirSync','each','xlsx','%s.%s','writeFileSync','zip','zip\x20finished','Completed','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','finally','exit','path','json2xls','zip-dir','../../mysqldb'];(function(_0x48f1a9,_0xfa54ff){var _0x4b9ec4=function(_0x4bc923){while(--_0x4bc923){_0x48f1a9['push'](_0x48f1a9['shift']());}};_0x4b9ec4(++_0xfa54ff);}(_0xf4a3,0xb8));var _0x3f4a=function(_0x25d913,_0x3dee16){_0x25d913=_0x25d913-0x0;var _0x437e1b=_0xf4a3[_0x25d913];return _0x437e1b;};'use strict';var util=require('util');var path=require(_0x3f4a('0x0'));var _=require('lodash');var fs=require('fs');var json2xls=require(_0x3f4a('0x1'));var BPromise=require('bluebird');var zipdir=require(_0x3f4a('0x2'));var rimraf=require('rimraf');var db=require(_0x3f4a('0x3'))['db'];var dbH=require(_0x3f4a('0x3'))[_0x3f4a('0x4')];var logger=require('../../config/logger')('analytics');var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process[_0x3f4a('0x5')][0x3];var PATH=process[_0x3f4a('0x5')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x5eca91,_0x5087fc){var _0x1c371f={'status':_0x5eca91};var _0x4da65e={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x5087fc){_0x1c371f[_0x3f4a('0x6')]=_0x5087fc;}return db[_0x3f4a('0x7')][_0x3f4a('0x8')](_0x1c371f,_0x4da65e);}function main(){var _0x164db9=0x1388;var _0x9819e1;logger['info'](util[_0x3f4a('0x9')](_0x3f4a('0xa'),EXTRACTED_REPORT_ID,_0x3f4a('0xb')));return db[_0x3f4a('0xc')][_0x3f4a('0xd')]({'where':{'id':0x1},'raw':!![],'attributes':['id','split',_0x3f4a('0xe')]})[_0x3f4a('0xf')](function(_0x4123c9){if(_0x4123c9){_0x9819e1=_0x4123c9;_0x164db9=_0x9819e1[_0x3f4a('0xe')]||0x1388;}})[_0x3f4a('0xf')](function(){return dbH[_0x3f4a('0x10')]['query'](util[_0x3f4a('0x9')](_0x3f4a('0x11'),QUERY),{'type':dbH[_0x3f4a('0x10')][_0x3f4a('0x12')][_0x3f4a('0x13')]});})[_0x3f4a('0xf')](function(_0x58c299){if(!_0x58c299[0x0][_0x3f4a('0x14')]){return analyticExtractedReport('Empty');}var _0x34f91c=[];var _0x3843af=0x0;if(_0x9819e1['split']){if(_0x58c299&&_0x58c299[_0x3f4a('0x15')]){var _0x415342=_[_0x3f4a('0x16')](_0x58c299[0x0][_0x3f4a('0x14')]/_0x164db9);var _0x2ea6fe=Number[_0x3f4a('0x17')](_0x58c299[0x0]['num']/_0x164db9)?_0x58c299[0x0][_0x3f4a('0x14')]%_0x164db9:0x0;_0x415342[_0x3f4a('0x18')](function(_0x5e71cc){if(_0x5e71cc>0x0){_0x3843af+=_0x164db9;}_0x34f91c[_0x3f4a('0x19')](dbH[_0x3f4a('0x10')][_0x3f4a('0x1a')](util[_0x3f4a('0x9')](_0x3f4a('0x1b'),QUERY,_0x164db9,_0x3843af),{'type':dbH['sequelize'][_0x3f4a('0x12')]['SELECT']}));});if(_0x2ea6fe>0x0){_0x3843af+=_0x164db9;_0x34f91c['push'](dbH[_0x3f4a('0x10')][_0x3f4a('0x1a')](util[_0x3f4a('0x9')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x2ea6fe,_0x3843af),{'type':dbH[_0x3f4a('0x10')][_0x3f4a('0x12')][_0x3f4a('0x13')]}));}}}else{_0x34f91c[_0x3f4a('0x19')](dbH[_0x3f4a('0x10')][_0x3f4a('0x1a')](QUERY,{'type':dbH[_0x3f4a('0x10')]['QueryTypes'][_0x3f4a('0x13')]}));}var _0x2ff4c4=path[_0x3f4a('0x1c')](PATH);var _0x50578b=path[_0x3f4a('0x1d')](PATH,_0x3f4a('0x1e'));var _0x43b77b=_0x9819e1['split']&&_0x34f91c[_0x3f4a('0x15')]>0x1;var _0x1ccd73=[];if(!fs[_0x3f4a('0x1f')](path[_0x3f4a('0x20')](_0x2ff4c4,_0x50578b))&&_0x43b77b){fs[_0x3f4a('0x21')](path['join'](_0x2ff4c4,_0x50578b));}return BPromise[_0x3f4a('0x22')](_0x34f91c,function(_0x2bd651){_0x1ccd73[_0x3f4a('0x19')](_0x2bd651);})[_0x3f4a('0xf')](function(){for(var _0x5d58d1=0x0;_0x5d58d1<_0x1ccd73[_0x3f4a('0x15')];_0x5d58d1+=0x1){var _0x4ae969;var _0x59af5e=_0x1ccd73[_0x5d58d1];if(_0x43b77b){_0x4ae969=path['join'](_0x2ff4c4,_0x50578b,util[_0x3f4a('0x9')]('%s%d.%s',_0x50578b,_0x5d58d1,_0x3f4a('0x23')));}else{_0x4ae969=path[_0x3f4a('0x20')](_0x2ff4c4,util[_0x3f4a('0x9')](_0x3f4a('0x24'),_0x50578b,'xlsx'));}fs[_0x3f4a('0x25')](_0x4ae969,json2xls(_0x59af5e),'binary');}})['then'](function(){if(_0x43b77b){return new Promise(function(_0x50469d){zipdir(path[_0x3f4a('0x20')](_0x2ff4c4,_0x50578b),{'saveTo':path['join'](_0x2ff4c4,util['format'](_0x3f4a('0x24'),_0x50578b,_0x3f4a('0x26')))},function(_0x456413,_0x48e36a){rimraf(path[_0x3f4a('0x20')](_0x2ff4c4,_0x50578b),function(){});_0x50469d(_0x3f4a('0x27'));});});}})[_0x3f4a('0xf')](function(){logger['info'](util[_0x3f4a('0x9')]('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,_0x3f4a('0xb')));return analyticExtractedReport(_0x3f4a('0x28'),_0x43b77b?util[_0x3f4a('0x9')](_0x3f4a('0x24'),_0x50578b,_0x43b77b?_0x3f4a('0x26'):_0x3f4a('0x23')):null);});})[_0x3f4a('0x29')](function(_0xf9c82b){logger['info'](util[_0x3f4a('0x9')](_0x3f4a('0x2a'),EXTRACTED_REPORT_ID,_0x3f4a('0xb')),util[_0x3f4a('0x2b')](_0xf9c82b,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x3f4a('0x2c'));})[_0x3f4a('0x2d')](function(){process[_0x3f4a('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 7a94291..2621f0b 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 _0x4315=['last','concat','transaction','destroy','bulkCreate','sortBy','catch','rewrite','lodash','Interval','findAll','models','VoiceExtension','IntervalId','then','uniq','map','exten','CAST(priority\x20AS\x20UNSIGNED)','filter','groupBy','queue','playback','hasOwnProperty','extensions','find','type','Set','format','CDR(type)=%s','priority','VoiceExtensionId','inbound','push','context','outbound','extension','cutdigits','${EXTEN:','${EXTEN}','CDR(routeid)=','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','outboundrouteid=','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','wav','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','length','createdAt','updatedAt','interval','intervals','tag','callerID','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)=','answer','app','toLowerCase','appType','XCALLY-MOTION-ANSWER=1','XCALLY-MOTION-PROGRESS=1','splice','GotoIfTime',',${EXTEN},'];(function(_0x56ea75,_0x2f0c76){var _0x2b6685=function(_0x346b7e){while(--_0x346b7e){_0x56ea75['push'](_0x56ea75['shift']());}};_0x2b6685(++_0x2f0c76);}(_0x4315,0x16b));var _0x5431=function(_0x16ff0e,_0x4e7dc6){_0x16ff0e=_0x16ff0e-0x0;var _0x95bd68=_0x4315[_0x16ff0e];return _0x95bd68;};'use strict';var _=require(_0x5431('0x0'));var util=require('util');function rewrite(_0x4cd711,_0x4150d4){var _0x1169e2=this;return _0x4cd711['models'][_0x5431('0x1')][_0x5431('0x2')]({'raw':!![]})['then'](function(_0x384376){_0x1169e2['intervals']=_0x384376;return _0x4cd711[_0x5431('0x3')][_0x5431('0x4')][_0x5431('0x2')]({'where':{'IntervalId':_0x4150d4[_0x5431('0x5')]},'raw':!![]});})[_0x5431('0x6')](function(_0x9c05f5){return _0x4cd711[_0x5431('0x3')][_0x5431('0x4')]['findAll']({'where':{'exten':{'$in':_[_0x5431('0x7')](_[_0x5431('0x8')](_0x9c05f5,_0x5431('0x9')))}},'order':[{'raw':_0x5431('0xa')}],'raw':!![]});})['then'](function(_0x48589d){var _0x40de3d=_['filter'](_0x48589d,{'priority':'1'});var _0xb08b81=_[_0x5431('0xb')](_0x48589d,{'isApp':0x1});var _0x29d597=_[_0x5431('0xc')](_0xb08b81,_0x5431('0x9'));var _0xea1e51=[_0x5431('0xd'),_0x5431('0xe')];var _0x558622=[];var _0xd4e422=[];for(var _0x1e4a31 in _0x29d597){if(_0x29d597[_0x5431('0xf')](_0x1e4a31)){_0x1169e2['priority']=0x2;_0x1169e2[_0x5431('0x10')]=[];_0x1169e2['extension']=_[_0x5431('0x11')](_0x40de3d,{'exten':_0x29d597[_0x1e4a31][0x0][_0x5431('0x9')]});_0x1169e2[_0x5431('0x10')]['push']({'type':_0x29d597[_0x1e4a31][0x0][_0x5431('0x12')],'app':_0x5431('0x13'),'appdata':util[_0x5431('0x14')](_0x5431('0x15'),_0x29d597[_0x1e4a31][0x0][_0x5431('0x12')]),'context':_0x29d597[_0x1e4a31][0x0]['context'],'exten':_0x29d597[_0x1e4a31][0x0][_0x5431('0x9')],'priority':_0x1169e2[_0x5431('0x16')]++,'VoiceExtensionId':_0x29d597[_0x1e4a31][0x0][_0x5431('0x17')]});if(_0x29d597[_0x1e4a31][0x0][_0x5431('0x12')]===_0x5431('0x18')){_0x1169e2[_0x5431('0x10')][_0x5431('0x19')]({'type':_0x29d597[_0x1e4a31][0x0][_0x5431('0x12')],'app':'Set','appdata':'CDR(routeid)='+_0x29d597[_0x1e4a31][0x0]['VoiceExtensionId'],'context':_0x29d597[_0x1e4a31][0x0][_0x5431('0x1a')],'exten':_0x29d597[_0x1e4a31][0x0][_0x5431('0x9')],'priority':_0x1169e2[_0x5431('0x16')]++,'VoiceExtensionId':_0x29d597[_0x1e4a31][0x0][_0x5431('0x17')]});}else if(_0x29d597[_0x1e4a31][0x0][_0x5431('0x12')]===_0x5431('0x1b')){if(_0x1169e2['extension']){_0x1169e2[_0x5431('0x10')][_0x5431('0x19')]({'type':_0x29d597[_0x1e4a31][0x0]['type'],'app':_0x5431('0x13'),'appdata':'CDR(destination)='+(_0x1169e2[_0x5431('0x1c')][_0x5431('0x1d')]?_0x5431('0x1e')+_0x1169e2[_0x5431('0x1c')]['cutdigits']+'}':_0x5431('0x1f')),'context':_0x29d597[_0x1e4a31][0x0][_0x5431('0x1a')],'exten':_0x29d597[_0x1e4a31][0x0]['exten'],'priority':_0x1169e2[_0x5431('0x16')]++,'VoiceExtensionId':_0x29d597[_0x1e4a31][0x0]['VoiceExtensionId']});}_0x1169e2['extensions'][_0x5431('0x19')]({'type':_0x29d597[_0x1e4a31][0x0][_0x5431('0x12')],'app':_0x5431('0x13'),'appdata':_0x5431('0x20')+_0x29d597[_0x1e4a31][0x0]['VoiceExtensionId'],'context':_0x29d597[_0x1e4a31][0x0][_0x5431('0x1a')],'exten':_0x29d597[_0x1e4a31][0x0][_0x5431('0x9')],'priority':_0x1169e2['priority']++,'VoiceExtensionId':_0x29d597[_0x1e4a31][0x0][_0x5431('0x17')]});var _0x205ea2=_0x1169e2[_0x5431('0x16')]++;_0x1169e2['extensions'][_0x5431('0x19')]({'type':_0x29d597[_0x1e4a31][0x0][_0x5431('0x12')],'app':_0x5431('0x21'),'appdata':_0x5431('0x22')+(_0x205ea2+0x2)+_0x5431('0x23')+(_0x205ea2+0x1)+')','context':_0x29d597[_0x1e4a31][0x0]['context'],'exten':_0x29d597[_0x1e4a31][0x0][_0x5431('0x9')],'priority':_0x205ea2,'VoiceExtensionId':_0x29d597[_0x1e4a31][0x0][_0x5431('0x17')]});if(_0x1169e2['extension']){_0x1169e2[_0x5431('0x10')][_0x5431('0x19')]({'type':_0x29d597[_0x1e4a31][0x0][_0x5431('0x12')],'app':_0x5431('0x13'),'appdata':_0x1169e2[_0x5431('0x1c')][_0x5431('0x1d')]?_0x5431('0x24')+_0x1169e2['extension'][_0x5431('0x1d')]+'}':_0x5431('0x25'),'context':_0x29d597[_0x1e4a31][0x0][_0x5431('0x1a')],'exten':_0x29d597[_0x1e4a31][0x0]['exten'],'priority':_0x1169e2['priority']++,'VoiceExtensionId':_0x29d597[_0x1e4a31][0x0][_0x5431('0x17')]});}_0x1169e2[_0x5431('0x10')][_0x5431('0x19')]({'type':_0x29d597[_0x1e4a31][0x0][_0x5431('0x12')],'app':_0x5431('0x13'),'appdata':_0x5431('0x26')+_0x29d597[_0x1e4a31][0x0][_0x5431('0x17')],'context':_0x29d597[_0x1e4a31][0x0]['context'],'exten':_0x29d597[_0x1e4a31][0x0]['exten'],'priority':_0x1169e2['priority']++,'VoiceExtensionId':_0x29d597[_0x1e4a31][0x0]['VoiceExtensionId']});if(_0x1169e2['extension']&&_0x1169e2[_0x5431('0x1c')][_0x5431('0xf')](_0x5431('0x27'))&&_0x1169e2[_0x5431('0x1c')]['recordingFormat']!==_0x5431('0x28')){_0x1169e2[_0x5431('0x10')][_0x5431('0x19')]({'type':_0x29d597[_0x1e4a31][0x0]['type'],'app':_0x5431('0x13'),'appdata':_0x5431('0x29'),'context':_0x29d597[_0x1e4a31][0x0][_0x5431('0x1a')],'exten':_0x29d597[_0x1e4a31][0x0][_0x5431('0x9')],'priority':_0x1169e2[_0x5431('0x16')]++,'VoiceExtensionId':_0x29d597[_0x1e4a31][0x0][_0x5431('0x17')]});_0x1169e2['extensions'][_0x5431('0x19')]({'type':_0x29d597[_0x1e4a31][0x0][_0x5431('0x12')],'app':_0x5431('0x13'),'appdata':_0x5431('0x2a')+_0x1169e2[_0x5431('0x1c')][_0x5431('0x27')]||_0x5431('0x2b'),'context':_0x29d597[_0x1e4a31][0x0][_0x5431('0x1a')],'exten':_0x29d597[_0x1e4a31][0x0][_0x5431('0x9')],'priority':_0x1169e2['priority']++,'VoiceExtensionId':_0x29d597[_0x1e4a31][0x0][_0x5431('0x17')]});}}_0x1169e2['extensions']['push']({'type':_0x29d597[_0x1e4a31][0x0][_0x5431('0x12')],'app':_0x5431('0x13'),'appdata':'XCALLY-MOTION-ANSWER=0','context':_0x29d597[_0x1e4a31][0x0]['context'],'exten':_0x29d597[_0x1e4a31][0x0]['exten'],'priority':_0x1169e2['priority']++,'VoiceExtensionId':_0x29d597[_0x1e4a31][0x0][_0x5431('0x17')]});_0x1169e2[_0x5431('0x10')][_0x5431('0x19')]({'type':_0x29d597[_0x1e4a31][0x0][_0x5431('0x12')],'app':_0x5431('0x13'),'appdata':_0x5431('0x2c'),'context':_0x29d597[_0x1e4a31][0x0][_0x5431('0x1a')],'exten':_0x29d597[_0x1e4a31][0x0]['exten'],'priority':_0x1169e2['priority']++,'VoiceExtensionId':_0x29d597[_0x1e4a31][0x0][_0x5431('0x17')]});_0x1169e2[_0x5431('0x10')]['push']({'type':_0x29d597[_0x1e4a31][0x0][_0x5431('0x12')],'app':_0x5431('0x13'),'appdata':_0x5431('0x2d'),'context':_0x29d597[_0x1e4a31][0x0]['context'],'exten':_0x29d597[_0x1e4a31][0x0][_0x5431('0x9')],'priority':_0x1169e2[_0x5431('0x16')]++,'VoiceExtensionId':_0x29d597[_0x1e4a31][0x0][_0x5431('0x17')]});for(var _0x3852ae=0x0,_0x4ae827=0x0;_0x3852ae<_0x29d597[_0x1e4a31][_0x5431('0x2e')];_0x3852ae+=0x1,_0x4ae827=0x0){var _0x51c370=_0x29d597[_0x1e4a31][_0x3852ae];if(_0x51c370[_0x5431('0x12')]){_0x51c370[_0x5431('0x12')]=_0x51c370[_0x5431('0x12')]['toLowerCase']();}var _0xccd383=[];var _0x4e9b08=[];delete _0x51c370['id'];delete _0x51c370[_0x5431('0x2f')];delete _0x51c370[_0x5431('0x30')];var _0x5435ef=_0x51c370[_0x5431('0x31')]!=='*,*,*,*'?[_0x51c370[_0x5431('0x31')]]:_0x51c370['IntervalId']?_[_0x5431('0x8')](_[_0x5431('0xb')](_0x1169e2[_0x5431('0x32')],{'IntervalId':_0x51c370[_0x5431('0x5')]}),_0x5431('0x31')):[];if(_0x51c370['hasOwnProperty'](_0x5431('0x33'))){if(_0x51c370[_0x5431('0x33')]&&_0x51c370[_0x5431('0x33')]!=='--'){_0xccd383[_0x5431('0x19')]({'type':_0x51c370['type'],'app':_0x5431('0x13'),'appdata':'CDR(tag)='+_0x51c370['tag'],'context':_0x51c370[_0x5431('0x1a')],'exten':_0x51c370[_0x5431('0x9')],'priority':_0x5435ef['length']+_0x1169e2[_0x5431('0x16')]+_0x4ae827++,'VoiceExtensionId':_0x51c370[_0x5431('0x17')]});}}if(_0x51c370[_0x5431('0x12')]===_0x5431('0x1b')&&_0x51c370[_0x5431('0xf')](_0x5431('0x34'))){if(_0x51c370[_0x5431('0x34')]){_0xccd383[_0x5431('0x19')]({'type':_0x51c370[_0x5431('0x12')],'app':_0x5431('0x21'),'appdata':_0x5431('0x35')+_0x51c370['callerID']+')','context':_0x51c370[_0x5431('0x1a')],'exten':_0x51c370[_0x5431('0x9')],'priority':_0x5435ef[_0x5431('0x2e')]+_0x1169e2[_0x5431('0x16')]+_0x4ae827++,'VoiceExtensionId':_0x51c370[_0x5431('0x17')]});}else{_0xccd383[_0x5431('0x19')]({'type':_0x51c370[_0x5431('0x12')],'app':'ExecIf','appdata':'$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','context':_0x51c370[_0x5431('0x1a')],'exten':_0x51c370['exten'],'priority':_0x5435ef['length']+_0x1169e2['priority']+_0x4ae827++,'VoiceExtensionId':_0x51c370[_0x5431('0x17')]});}}if(_0x51c370[_0x5431('0xf')](_0x5431('0x36'))){if(_0xea1e51['indexOf'](_0x51c370[_0x5431('0x37')][_0x5431('0x38')]())>=0x0&&_0x51c370[_0x5431('0x39')]!=='custom'){if(_0x51c370[_0x5431('0x36')]){_0xccd383[_0x5431('0x19')]({'type':_0x51c370['type'],'app':_0x5431('0x21'),'appdata':'$[${XCALLY-MOTION-ANSWER}=0]?Answer','context':_0x51c370[_0x5431('0x1a')],'exten':_0x51c370[_0x5431('0x9')],'priority':_0x5435ef['length']+_0x1169e2[_0x5431('0x16')]+_0x4ae827++,'VoiceExtensionId':_0x51c370[_0x5431('0x17')]});_0xccd383[_0x5431('0x19')]({'type':_0x51c370['type'],'app':_0x5431('0x13'),'appdata':_0x5431('0x3a'),'context':_0x51c370[_0x5431('0x1a')],'exten':_0x51c370['exten'],'priority':_0x5435ef['length']+_0x1169e2[_0x5431('0x16')]+_0x4ae827++,'VoiceExtensionId':_0x51c370[_0x5431('0x17')]});}else{_0xccd383['push']({'type':_0x51c370[_0x5431('0x12')],'app':_0x5431('0x21'),'appdata':'$[${XCALLY-MOTION-PROGRESS}=0]?Progress','context':_0x51c370[_0x5431('0x1a')],'exten':_0x51c370[_0x5431('0x9')],'priority':_0x5435ef[_0x5431('0x2e')]+_0x1169e2[_0x5431('0x16')]+_0x4ae827++,'VoiceExtensionId':_0x51c370['VoiceExtensionId']});_0xccd383[_0x5431('0x19')]({'type':_0x51c370[_0x5431('0x12')],'app':_0x5431('0x13'),'appdata':_0x5431('0x3b'),'context':_0x51c370[_0x5431('0x1a')],'exten':_0x51c370['exten'],'priority':_0x5435ef[_0x5431('0x2e')]+_0x1169e2[_0x5431('0x16')]+_0x4ae827++,'VoiceExtensionId':_0x51c370[_0x5431('0x17')]});}}}for(var _0x469548=0x0;_0x469548<_0x5435ef[_0x5431('0x2e')];_0x469548+=0x1){var _0xe3c2e3=_0x1169e2[_0x5431('0x16')]+_0x5435ef[_0x5431('0x2e')];var _0x46cc51=_0x469548===_0x5435ef[_0x5431('0x2e')]-0x1?_0x1169e2[_0x5431('0x16')]+_0xccd383[_0x5431('0x2e')]+_0x4e9b08[_0x5431('0x2e')]+0x2:_0x1169e2['priority']+_0x469548+0x1;_0xccd383[_0x5431('0x3c')](_0x469548,0x0,{'type':_0x51c370['type'],'app':_0x5431('0x3d'),'appdata':_0x5435ef[_0x469548]+'?'+_0x51c370[_0x5431('0x1a')]+_0x5431('0x3e')+_0xe3c2e3+':'+_0x51c370[_0x5431('0x1a')]+_0x5431('0x3e')+_0x46cc51,'exten':_0x51c370[_0x5431('0x9')],'context':_0x51c370[_0x5431('0x1a')],'priority':_0x1169e2['priority']+_0x469548,'VoiceExtensionId':_0x29d597[_0x1e4a31][0x0][_0x5431('0x17')]});}_0x51c370['priority']=_0xccd383[_0x5431('0x2e')]?_['last'](_0xccd383)['priority']+0x1:_0x1169e2['priority'];_0x1169e2['priority']=(_0x4e9b08['length']?_[_0x5431('0x3f')](_0x4e9b08)[_0x5431('0x16')]:_0x51c370[_0x5431('0x16')])+0x1;_0x1169e2['extensions']=_[_0x5431('0x40')](_0x1169e2[_0x5431('0x10')],_0xccd383,[_0x51c370],_0x4e9b08);}_0x1169e2[_0x5431('0x10')][_0x5431('0x19')]({'type':_0x29d597[_0x1e4a31][0x0][_0x5431('0x12')],'app':'Hangup','exten':_0x29d597[_0x1e4a31][0x0][_0x5431('0x9')],'context':_0x29d597[_0x1e4a31][0x0]['context'],'priority':_0x1169e2[_0x5431('0x16')],'VoiceExtensionId':_0x29d597[_0x1e4a31][0x0][_0x5431('0x17')]});_0x558622[_0x5431('0x19')](_0x29d597[_0x1e4a31][0x0][_0x5431('0x17')]);_0xd4e422=_[_0x5431('0x40')](_0xd4e422,_0x1169e2[_0x5431('0x10')]);}}return _0x4cd711[_0x5431('0x41')](function(_0x5ae717){return _0x4cd711[_0x5431('0x3')][_0x5431('0x4')][_0x5431('0x42')]({'where':{'VoiceExtensionId':{'$in':_0x558622}},'transaction':_0x5ae717})['then'](function(_0x413aba){return _0x4cd711['models']['VoiceExtension'][_0x5431('0x43')](_[_0x5431('0x44')](_0xd4e422,_0x5431('0x16')),{'transaction':_0x5ae717});});});})[_0x5431('0x45')](function(_0x2a1d0f){console['error'](_0x2a1d0f);});}exports[_0x5431('0x46')]=rewrite; \ No newline at end of file +var _0x38ce=['models','findAll','then','VoiceExtension','IntervalId','map','CAST(priority\x20AS\x20UNSIGNED)','filter','groupBy','exten','queue','playback','extensions','push','type','Set','format','CDR(type)=%s','context','priority','VoiceExtensionId','inbound','outbound','extension','CDR(destination)=','cutdigits','${EXTEN:','${EXTEN}','CDR(routeid)=','):Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','outboundrouteid=','hasOwnProperty','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','length','toLowerCase','createdAt','updatedAt','interval','intervals','tag','CDR(tag)=','callerID','ExecIf','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)=','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','answer','appType','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','splice',',${EXTEN},','last','concat','transaction','destroy','bulkCreate','sortBy','catch','rewrite','util'];(function(_0x17c656,_0x181d7b){var _0x516422=function(_0x2c7079){while(--_0x2c7079){_0x17c656['push'](_0x17c656['shift']());}};_0x516422(++_0x181d7b);}(_0x38ce,0x15d));var _0xe38c=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x38ce[_0x2dafbe];return _0x58a45a;};'use strict';var _=require('lodash');var util=require(_0xe38c('0x0'));function rewrite(_0x21f411,_0x25693b){var _0x4433f3=this;return _0x21f411[_0xe38c('0x1')]['Interval'][_0xe38c('0x2')]({'raw':!![]})[_0xe38c('0x3')](function(_0x5842b1){_0x4433f3['intervals']=_0x5842b1;return _0x21f411[_0xe38c('0x1')][_0xe38c('0x4')][_0xe38c('0x2')]({'where':{'IntervalId':_0x25693b[_0xe38c('0x5')]},'raw':!![]});})['then'](function(_0x23f51d){return _0x21f411[_0xe38c('0x1')]['VoiceExtension'][_0xe38c('0x2')]({'where':{'exten':{'$in':_['uniq'](_[_0xe38c('0x6')](_0x23f51d,'exten'))}},'order':[{'raw':_0xe38c('0x7')}],'raw':!![]});})[_0xe38c('0x3')](function(_0x252c72){var _0x79b0ce=_[_0xe38c('0x8')](_0x252c72,{'priority':'1'});var _0x920f47=_[_0xe38c('0x8')](_0x252c72,{'isApp':0x1});var _0x337a21=_[_0xe38c('0x9')](_0x920f47,_0xe38c('0xa'));var _0x1a84f0=[_0xe38c('0xb'),_0xe38c('0xc')];var _0x1e188e=[];var _0x536723=[];for(var _0x38dad2 in _0x337a21){if(_0x337a21['hasOwnProperty'](_0x38dad2)){_0x4433f3['priority']=0x2;_0x4433f3[_0xe38c('0xd')]=[];_0x4433f3['extension']=_['find'](_0x79b0ce,{'exten':_0x337a21[_0x38dad2][0x0][_0xe38c('0xa')]});_0x4433f3[_0xe38c('0xd')][_0xe38c('0xe')]({'type':_0x337a21[_0x38dad2][0x0][_0xe38c('0xf')],'app':_0xe38c('0x10'),'appdata':util[_0xe38c('0x11')](_0xe38c('0x12'),_0x337a21[_0x38dad2][0x0]['type']),'context':_0x337a21[_0x38dad2][0x0][_0xe38c('0x13')],'exten':_0x337a21[_0x38dad2][0x0][_0xe38c('0xa')],'priority':_0x4433f3[_0xe38c('0x14')]++,'VoiceExtensionId':_0x337a21[_0x38dad2][0x0][_0xe38c('0x15')]});if(_0x337a21[_0x38dad2][0x0]['type']===_0xe38c('0x16')){_0x4433f3[_0xe38c('0xd')][_0xe38c('0xe')]({'type':_0x337a21[_0x38dad2][0x0][_0xe38c('0xf')],'app':'Set','appdata':'CDR(routeid)='+_0x337a21[_0x38dad2][0x0][_0xe38c('0x15')],'context':_0x337a21[_0x38dad2][0x0]['context'],'exten':_0x337a21[_0x38dad2][0x0][_0xe38c('0xa')],'priority':_0x4433f3[_0xe38c('0x14')]++,'VoiceExtensionId':_0x337a21[_0x38dad2][0x0]['VoiceExtensionId']});}else if(_0x337a21[_0x38dad2][0x0][_0xe38c('0xf')]===_0xe38c('0x17')){if(_0x4433f3[_0xe38c('0x18')]){_0x4433f3[_0xe38c('0xd')][_0xe38c('0xe')]({'type':_0x337a21[_0x38dad2][0x0][_0xe38c('0xf')],'app':_0xe38c('0x10'),'appdata':_0xe38c('0x19')+(_0x4433f3[_0xe38c('0x18')][_0xe38c('0x1a')]?_0xe38c('0x1b')+_0x4433f3[_0xe38c('0x18')]['cutdigits']+'}':_0xe38c('0x1c')),'context':_0x337a21[_0x38dad2][0x0]['context'],'exten':_0x337a21[_0x38dad2][0x0][_0xe38c('0xa')],'priority':_0x4433f3[_0xe38c('0x14')]++,'VoiceExtensionId':_0x337a21[_0x38dad2][0x0][_0xe38c('0x15')]});}_0x4433f3['extensions'][_0xe38c('0xe')]({'type':_0x337a21[_0x38dad2][0x0]['type'],'app':_0xe38c('0x10'),'appdata':_0xe38c('0x1d')+_0x337a21[_0x38dad2][0x0][_0xe38c('0x15')],'context':_0x337a21[_0x38dad2][0x0][_0xe38c('0x13')],'exten':_0x337a21[_0x38dad2][0x0][_0xe38c('0xa')],'priority':_0x4433f3['priority']++,'VoiceExtensionId':_0x337a21[_0x38dad2][0x0]['VoiceExtensionId']});var _0x61db3c=_0x4433f3['priority']++;_0x4433f3[_0xe38c('0xd')]['push']({'type':_0x337a21[_0x38dad2][0x0][_0xe38c('0xf')],'app':'ExecIf','appdata':'$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto('+(_0x61db3c+0x2)+_0xe38c('0x1e')+(_0x61db3c+0x1)+')','context':_0x337a21[_0x38dad2][0x0][_0xe38c('0x13')],'exten':_0x337a21[_0x38dad2][0x0][_0xe38c('0xa')],'priority':_0x61db3c,'VoiceExtensionId':_0x337a21[_0x38dad2][0x0]['VoiceExtensionId']});if(_0x4433f3[_0xe38c('0x18')]){_0x4433f3['extensions'][_0xe38c('0xe')]({'type':_0x337a21[_0x38dad2][0x0][_0xe38c('0xf')],'app':_0xe38c('0x10'),'appdata':_0x4433f3[_0xe38c('0x18')][_0xe38c('0x1a')]?_0xe38c('0x1f')+_0x4433f3[_0xe38c('0x18')]['cutdigits']+'}':_0xe38c('0x20'),'context':_0x337a21[_0x38dad2][0x0]['context'],'exten':_0x337a21[_0x38dad2][0x0][_0xe38c('0xa')],'priority':_0x4433f3['priority']++,'VoiceExtensionId':_0x337a21[_0x38dad2][0x0][_0xe38c('0x15')]});}_0x4433f3[_0xe38c('0xd')][_0xe38c('0xe')]({'type':_0x337a21[_0x38dad2][0x0]['type'],'app':_0xe38c('0x10'),'appdata':_0xe38c('0x21')+_0x337a21[_0x38dad2][0x0][_0xe38c('0x15')],'context':_0x337a21[_0x38dad2][0x0][_0xe38c('0x13')],'exten':_0x337a21[_0x38dad2][0x0][_0xe38c('0xa')],'priority':_0x4433f3[_0xe38c('0x14')]++,'VoiceExtensionId':_0x337a21[_0x38dad2][0x0][_0xe38c('0x15')]});if(_0x4433f3[_0xe38c('0x18')]&&_0x4433f3['extension'][_0xe38c('0x22')]('recordingFormat')&&_0x4433f3[_0xe38c('0x18')][_0xe38c('0x23')]!==_0xe38c('0x24')){_0x4433f3[_0xe38c('0xd')][_0xe38c('0xe')]({'type':_0x337a21[_0x38dad2][0x0][_0xe38c('0xf')],'app':_0xe38c('0x10'),'appdata':_0xe38c('0x25'),'context':_0x337a21[_0x38dad2][0x0][_0xe38c('0x13')],'exten':_0x337a21[_0x38dad2][0x0][_0xe38c('0xa')],'priority':_0x4433f3['priority']++,'VoiceExtensionId':_0x337a21[_0x38dad2][0x0]['VoiceExtensionId']});_0x4433f3[_0xe38c('0xd')]['push']({'type':_0x337a21[_0x38dad2][0x0][_0xe38c('0xf')],'app':_0xe38c('0x10'),'appdata':_0xe38c('0x26')+_0x4433f3[_0xe38c('0x18')][_0xe38c('0x23')]||'wav','context':_0x337a21[_0x38dad2][0x0][_0xe38c('0x13')],'exten':_0x337a21[_0x38dad2][0x0][_0xe38c('0xa')],'priority':_0x4433f3['priority']++,'VoiceExtensionId':_0x337a21[_0x38dad2][0x0][_0xe38c('0x15')]});}}_0x4433f3[_0xe38c('0xd')][_0xe38c('0xe')]({'type':_0x337a21[_0x38dad2][0x0][_0xe38c('0xf')],'app':_0xe38c('0x10'),'appdata':_0xe38c('0x27'),'context':_0x337a21[_0x38dad2][0x0][_0xe38c('0x13')],'exten':_0x337a21[_0x38dad2][0x0][_0xe38c('0xa')],'priority':_0x4433f3[_0xe38c('0x14')]++,'VoiceExtensionId':_0x337a21[_0x38dad2][0x0][_0xe38c('0x15')]});_0x4433f3[_0xe38c('0xd')][_0xe38c('0xe')]({'type':_0x337a21[_0x38dad2][0x0][_0xe38c('0xf')],'app':_0xe38c('0x10'),'appdata':_0xe38c('0x28'),'context':_0x337a21[_0x38dad2][0x0][_0xe38c('0x13')],'exten':_0x337a21[_0x38dad2][0x0][_0xe38c('0xa')],'priority':_0x4433f3[_0xe38c('0x14')]++,'VoiceExtensionId':_0x337a21[_0x38dad2][0x0][_0xe38c('0x15')]});_0x4433f3[_0xe38c('0xd')]['push']({'type':_0x337a21[_0x38dad2][0x0][_0xe38c('0xf')],'app':_0xe38c('0x10'),'appdata':_0xe38c('0x29'),'context':_0x337a21[_0x38dad2][0x0][_0xe38c('0x13')],'exten':_0x337a21[_0x38dad2][0x0][_0xe38c('0xa')],'priority':_0x4433f3[_0xe38c('0x14')]++,'VoiceExtensionId':_0x337a21[_0x38dad2][0x0]['VoiceExtensionId']});for(var _0x3c6ef1=0x0,_0x46049e=0x0;_0x3c6ef1<_0x337a21[_0x38dad2][_0xe38c('0x2a')];_0x3c6ef1+=0x1,_0x46049e=0x0){var _0x38b729=_0x337a21[_0x38dad2][_0x3c6ef1];if(_0x38b729[_0xe38c('0xf')]){_0x38b729[_0xe38c('0xf')]=_0x38b729['type'][_0xe38c('0x2b')]();}var _0x565f99=[];var _0x4d7e24=[];delete _0x38b729['id'];delete _0x38b729[_0xe38c('0x2c')];delete _0x38b729[_0xe38c('0x2d')];var _0x135560=_0x38b729[_0xe38c('0x2e')]!=='*,*,*,*'?[_0x38b729['interval']]:_0x38b729[_0xe38c('0x5')]?_['map'](_[_0xe38c('0x8')](_0x4433f3[_0xe38c('0x2f')],{'IntervalId':_0x38b729[_0xe38c('0x5')]}),_0xe38c('0x2e')):[];if(_0x38b729[_0xe38c('0x22')](_0xe38c('0x30'))){if(_0x38b729['tag']&&_0x38b729['tag']!=='--'){_0x565f99[_0xe38c('0xe')]({'type':_0x38b729[_0xe38c('0xf')],'app':'Set','appdata':_0xe38c('0x31')+_0x38b729[_0xe38c('0x30')],'context':_0x38b729['context'],'exten':_0x38b729['exten'],'priority':_0x135560[_0xe38c('0x2a')]+_0x4433f3[_0xe38c('0x14')]+_0x46049e++,'VoiceExtensionId':_0x38b729[_0xe38c('0x15')]});}}if(_0x38b729[_0xe38c('0xf')]===_0xe38c('0x17')&&_0x38b729['hasOwnProperty'](_0xe38c('0x32'))){if(_0x38b729[_0xe38c('0x32')]){_0x565f99['push']({'type':_0x38b729[_0xe38c('0xf')],'app':_0xe38c('0x33'),'appdata':_0xe38c('0x34')+_0x38b729[_0xe38c('0x32')]+')','context':_0x38b729['context'],'exten':_0x38b729[_0xe38c('0xa')],'priority':_0x135560[_0xe38c('0x2a')]+_0x4433f3[_0xe38c('0x14')]+_0x46049e++,'VoiceExtensionId':_0x38b729[_0xe38c('0x15')]});}else{_0x565f99[_0xe38c('0xe')]({'type':_0x38b729[_0xe38c('0xf')],'app':_0xe38c('0x33'),'appdata':_0xe38c('0x35'),'context':_0x38b729['context'],'exten':_0x38b729[_0xe38c('0xa')],'priority':_0x135560['length']+_0x4433f3[_0xe38c('0x14')]+_0x46049e++,'VoiceExtensionId':_0x38b729[_0xe38c('0x15')]});}}if(_0x38b729['hasOwnProperty'](_0xe38c('0x36'))){if(_0x1a84f0['indexOf'](_0x38b729['app'][_0xe38c('0x2b')]())>=0x0&&_0x38b729[_0xe38c('0x37')]!=='custom'){if(_0x38b729['answer']){_0x565f99[_0xe38c('0xe')]({'type':_0x38b729[_0xe38c('0xf')],'app':_0xe38c('0x33'),'appdata':_0xe38c('0x38'),'context':_0x38b729['context'],'exten':_0x38b729['exten'],'priority':_0x135560[_0xe38c('0x2a')]+_0x4433f3[_0xe38c('0x14')]+_0x46049e++,'VoiceExtensionId':_0x38b729[_0xe38c('0x15')]});_0x565f99['push']({'type':_0x38b729['type'],'app':'Set','appdata':_0xe38c('0x39'),'context':_0x38b729[_0xe38c('0x13')],'exten':_0x38b729[_0xe38c('0xa')],'priority':_0x135560[_0xe38c('0x2a')]+_0x4433f3[_0xe38c('0x14')]+_0x46049e++,'VoiceExtensionId':_0x38b729['VoiceExtensionId']});}else{_0x565f99['push']({'type':_0x38b729[_0xe38c('0xf')],'app':_0xe38c('0x33'),'appdata':_0xe38c('0x3a'),'context':_0x38b729[_0xe38c('0x13')],'exten':_0x38b729[_0xe38c('0xa')],'priority':_0x135560['length']+_0x4433f3[_0xe38c('0x14')]+_0x46049e++,'VoiceExtensionId':_0x38b729[_0xe38c('0x15')]});_0x565f99[_0xe38c('0xe')]({'type':_0x38b729['type'],'app':_0xe38c('0x10'),'appdata':_0xe38c('0x3b'),'context':_0x38b729[_0xe38c('0x13')],'exten':_0x38b729[_0xe38c('0xa')],'priority':_0x135560[_0xe38c('0x2a')]+_0x4433f3['priority']+_0x46049e++,'VoiceExtensionId':_0x38b729[_0xe38c('0x15')]});}}}for(var _0x3f5e85=0x0;_0x3f5e85<_0x135560[_0xe38c('0x2a')];_0x3f5e85+=0x1){var _0xfc01f4=_0x4433f3[_0xe38c('0x14')]+_0x135560[_0xe38c('0x2a')];var _0x8f7d5d=_0x3f5e85===_0x135560[_0xe38c('0x2a')]-0x1?_0x4433f3['priority']+_0x565f99[_0xe38c('0x2a')]+_0x4d7e24['length']+0x2:_0x4433f3[_0xe38c('0x14')]+_0x3f5e85+0x1;_0x565f99[_0xe38c('0x3c')](_0x3f5e85,0x0,{'type':_0x38b729[_0xe38c('0xf')],'app':'GotoIfTime','appdata':_0x135560[_0x3f5e85]+'?'+_0x38b729[_0xe38c('0x13')]+_0xe38c('0x3d')+_0xfc01f4+':'+_0x38b729[_0xe38c('0x13')]+_0xe38c('0x3d')+_0x8f7d5d,'exten':_0x38b729[_0xe38c('0xa')],'context':_0x38b729[_0xe38c('0x13')],'priority':_0x4433f3[_0xe38c('0x14')]+_0x3f5e85,'VoiceExtensionId':_0x337a21[_0x38dad2][0x0][_0xe38c('0x15')]});}_0x38b729[_0xe38c('0x14')]=_0x565f99[_0xe38c('0x2a')]?_[_0xe38c('0x3e')](_0x565f99)[_0xe38c('0x14')]+0x1:_0x4433f3[_0xe38c('0x14')];_0x4433f3[_0xe38c('0x14')]=(_0x4d7e24[_0xe38c('0x2a')]?_[_0xe38c('0x3e')](_0x4d7e24)[_0xe38c('0x14')]:_0x38b729[_0xe38c('0x14')])+0x1;_0x4433f3['extensions']=_['concat'](_0x4433f3[_0xe38c('0xd')],_0x565f99,[_0x38b729],_0x4d7e24);}_0x4433f3['extensions'][_0xe38c('0xe')]({'type':_0x337a21[_0x38dad2][0x0][_0xe38c('0xf')],'app':'Hangup','exten':_0x337a21[_0x38dad2][0x0][_0xe38c('0xa')],'context':_0x337a21[_0x38dad2][0x0][_0xe38c('0x13')],'priority':_0x4433f3['priority'],'VoiceExtensionId':_0x337a21[_0x38dad2][0x0][_0xe38c('0x15')]});_0x1e188e[_0xe38c('0xe')](_0x337a21[_0x38dad2][0x0]['VoiceExtensionId']);_0x536723=_[_0xe38c('0x3f')](_0x536723,_0x4433f3['extensions']);}}return _0x21f411[_0xe38c('0x40')](function(_0x3be34c){return _0x21f411['models'][_0xe38c('0x4')][_0xe38c('0x41')]({'where':{'VoiceExtensionId':{'$in':_0x1e188e}},'transaction':_0x3be34c})[_0xe38c('0x3')](function(_0x2970c3){return _0x21f411['models']['VoiceExtension'][_0xe38c('0x42')](_[_0xe38c('0x43')](_0x536723,_0xe38c('0x14')),{'transaction':_0x3be34c});});});})[_0xe38c('0x44')](function(_0xab4853){console['error'](_0xab4853);});}exports[_0xe38c('0x45')]=rewrite; \ No newline at end of file diff --git a/server/components/import/cm/csv.js b/server/components/import/cm/csv.js index 79b8a45..e825969 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 _0x8d5e=['bluebird','lodash','squel','papaparse','ioredis','../../../mysqldb','../../../config/environment','../../../config/logger','api','redis','defaults','localhost','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','hasOwnProperty','data','firstName\x20not\x20specified!','phone\x20not\x20specified!','birthDate','YYYY-MM-DD','isValid','birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!','email','email\x20format\x20is\x20not\x20valid!','ListId','CompanyId','find','duplicate','CmContact','keys','then','pick','catch','Error\x20while\x20creating\x20contact:\x20','stringify','cmContact','checkHopper','inspect','insert','cm_hopper','fromQuery','scheduledAt','createdAt','select','phone','NOW()','field','ContactId','toString','updatedAt','from','where','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','\x20=\x20?','into','str','calleridnum','cm_hopper_final','cm_contacts','id\x20IN\x20?','VoiceQueue','findAll','outbound','dialCheckDuplicateType','Lists','get','always','push','sequelize','query','onlyIfOpen','VoiceQueueId','BlackLists','all','Campaign','CmList','CampaignId','cmContact,\x20%s,\x20%s','generalCheckHopper','Error\x20processing\x20rows\x20block:','finally','emit','contact:csv_','resume','resolve','unlinkSync','Unable\x20to\x20delete\x20temp\x20file:','exit','SIGINT','info','CSV\x20import\x20process\x20stopped!','createReadStream','pause','CSV\x20parsed\x20correctly!','CSV\x20parse\x20error','Error\x20executing\x20contact\x20csv\x20import:'];(function(_0x581af1,_0x4f02c5){var _0x54c22e=function(_0x5a7a5a){while(--_0x5a7a5a){_0x581af1['push'](_0x581af1['shift']());}};_0x54c22e(++_0x4f02c5);}(_0x8d5e,0x74));var _0xe8d5=function(_0xefd519,_0xc62635){_0xefd519=_0xefd519-0x0;var _0x4bb882=_0x8d5e[_0xefd519];return _0x4bb882;};'use strict';var BPromise=require(_0xe8d5('0x0'));var util=require('util');var _=require(_0xe8d5('0x1'));var fs=require('fs');var squel=require(_0xe8d5('0x2'));var Papa=require(_0xe8d5('0x3'));var Redis=require(_0xe8d5('0x4'));var db=require(_0xe8d5('0x5'))['db'];var config=require(_0xe8d5('0x6'));var logger=require(_0xe8d5('0x7'))(_0xe8d5('0x8'));config[_0xe8d5('0x9')]=_[_0xe8d5('0xa')](config['redis'],{'host':_0xe8d5('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xe8d5('0x9')]));require('../../../api/cmContact/cmContact.socket')[_0xe8d5('0xc')](socket);try{if(!process[_0xe8d5('0xd')][0x2]||process['argv'][0x2]===_0xe8d5('0xe')||process[_0xe8d5('0xd')][0x2]===_0xe8d5('0xf')){throw new Error(_0xe8d5('0x10'));}var FILEPATH=process[_0xe8d5('0xd')][0x2];if(!process['argv'][0x3]||process[_0xe8d5('0xd')][0x3]===_0xe8d5('0xe')||process[_0xe8d5('0xd')][0x3]===_0xe8d5('0xf')||!process[_0xe8d5('0xd')][0x4]||process['argv'][0x4]===_0xe8d5('0xe')||process[_0xe8d5('0xd')][0x4]===_0xe8d5('0xf')){throw new Error(_0xe8d5('0x11'));}var FIELDS=_[_0xe8d5('0x12')](process[_0xe8d5('0xd')][0x3][_0xe8d5('0x13')](','),process[_0xe8d5('0xd')][0x4][_0xe8d5('0x13')](','));if(!process[_0xe8d5('0xd')][0x5]||process['argv'][0x5]===_0xe8d5('0xe')||process[_0xe8d5('0xd')][0x5]===_0xe8d5('0xf')){throw new Error('Missing\x20ListId\x20parameter!');}var LISTID=process['argv'][0x5];var COMPANYID=process[_0xe8d5('0xd')][0x6]&&process['argv'][0x6]!==_0xe8d5('0xe')&&process[_0xe8d5('0xd')][0x6]!==_0xe8d5('0xf')?process[_0xe8d5('0xd')][0x6]:null;var DUPLICATES=process[_0xe8d5('0xd')][0x7]&&process[_0xe8d5('0xd')][0x7]!==_0xe8d5('0xe')&&process['argv'][0x7]!=='null'?process[_0xe8d5('0xd')][0x7]:null;if(!process['argv'][0x8]||process[_0xe8d5('0xd')][0x8]==='undefined'||process[_0xe8d5('0xd')][0x8]===_0xe8d5('0xf')){throw new Error(_0xe8d5('0x14'));}var SOCKET_TIMESTAMP=process[_0xe8d5('0xd')][0x8];}catch(_0x5e2d73){logger[_0xe8d5('0x15')](_0x5e2d73);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(_0x584df4,_0x23dac9,_0x4e6799,_0x49cd27){var _0x1ae098={'message':_0x23dac9};_0x1ae098[_0x584df4]=!![];if(_0x4e6799){_0x1ae098[_0xe8d5('0x16')]=_0x4e6799;}if(_0x49cd27){_0x1ae098[_0xe8d5('0x17')]=_0x49cd27;}return _0x1ae098;}function isEmail(_0x1764da){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))*$/[_0xe8d5('0x18')](_0x1764da);}function checkRow(_0x2570e5,_0x47664c,_0x281791){return new BPromise(function(_0x32fdc7,_0x551ce4){if(_[_0xe8d5('0x19')](_0x2570e5)){return _0x551ce4(handleCheckRowError(_0xe8d5('0x15'),'The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!',null,_0x281791));}if(_0x2570e5['errors']&&_0x2570e5[_0xe8d5('0x1a')][_0xe8d5('0x1b')]){var _0x13fd87=_[_0xe8d5('0x1c')](_0x2570e5[_0xe8d5('0x1a')],_0xe8d5('0x1d'))[_0xe8d5('0x1e')](';');return _0x551ce4(handleCheckRowError('error',_0x13fd87,null,_0x281791));}var _0x3fd5a3={};for(var _0x17933e in FIELDS){if(FIELDS[_0xe8d5('0x1f')](_0x17933e)&&FIELDS[_0x17933e]){_0x3fd5a3[_0x17933e]=_0x2570e5[_0xe8d5('0x20')][0x0][FIELDS[_0x17933e]]||_0x2570e5['data'][0x0]['\ufeff'+FIELDS[_0x17933e]];}}if(!_0x3fd5a3['firstName']){return _0x551ce4(handleCheckRowError(_0xe8d5('0x15'),_0xe8d5('0x21'),null,_0x281791));}if(!_0x3fd5a3['phone']){return _0x551ce4(handleCheckRowError(_0xe8d5('0x15'),_0xe8d5('0x22'),null,_0x281791));}if(_0x3fd5a3[_0xe8d5('0x23')]){var _0x1c67e4=moment(_0x3fd5a3[_0xe8d5('0x23')],_0xe8d5('0x24'));if(!_0x1c67e4[_0xe8d5('0x25')]()){return _0x551ce4(handleCheckRowError(_0xe8d5('0x15'),_0xe8d5('0x26'),null,_0x281791));}}if(_0x3fd5a3[_0xe8d5('0x27')]){if(!isEmail(_0x3fd5a3['email'])){return _0x551ce4(handleCheckRowError(_0xe8d5('0x15'),_0xe8d5('0x28'),null,_0x281791));}}_0x3fd5a3[_0xe8d5('0x29')]=LISTID;_0x3fd5a3[_0xe8d5('0x2a')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES[_0xe8d5('0x1b')]&&_0x47664c){var _0x5f13da={};for(var _0x7db5de=0x0,_0x16419a=DUPLICATES[_0xe8d5('0x1b')];_0x7db5de<_0x16419a;_0x7db5de+=0x1){_0x5f13da[DUPLICATES[_0x7db5de]]=_0x3fd5a3[DUPLICATES[_0x7db5de]];}var _0x4079f4=_[_0xe8d5('0x2b')](_0x47664c,_0x5f13da);if(_0x4079f4){return _0x551ce4(handleCheckRowError(_0xe8d5('0x2c'),'Duplicate\x20Contact',_0x4079f4,_0x281791));}}return db[_0xe8d5('0x2d')]['create'](_0x3fd5a3,{'raw':!![],'hooks':![],'fields':_[_0xe8d5('0x2e')](_0x3fd5a3)})[_0xe8d5('0x2f')](function(_0xeca382){if(DUPLICATES&&DUPLICATES['length']&&_0x47664c){_0x47664c['push'](_[_0xe8d5('0x30')](_0x3fd5a3,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0xeca382['id'];return _0x32fdc7();})[_0xe8d5('0x31')](function(_0x340071){return _0x551ce4(handleCheckRowError(_0xe8d5('0x15'),_0xe8d5('0x32')+(_0x340071[_0xe8d5('0x1d')]||JSON[_0xe8d5('0x33')](_0x340071)),null,_0x281791));});});}function checkHopper(){function _0x1456db(){return function(_0x1d05f8){logger[_0xe8d5('0x15')](_0xe8d5('0x34'),_0xe8d5('0x35'),util[_0xe8d5('0x36')](_0x1d05f8,{'showHidden':![],'depth':null}));};}var _0x55cc0c=function(_0x267c85,_0x42ef95){var _0x178d11=squel[_0xe8d5('0x37')]()['into'](_0xe8d5('0x38'))[_0xe8d5('0x39')](['phone',_0xe8d5('0x3a'),'ContactId',_0xe8d5('0x29'),_0x42ef95,_0xe8d5('0x3b'),'updatedAt'],squel[_0xe8d5('0x3c')]()['field'](_0xe8d5('0x3d'),_0xe8d5('0x3d'))['field'](_0xe8d5('0x3e'),_0xe8d5('0x3a'))[_0xe8d5('0x3f')]('id',_0xe8d5('0x40'))['field'](LISTID['toString'](),_0xe8d5('0x29'))['field'](_0x267c85['id'][_0xe8d5('0x41')](),_0x42ef95)[_0xe8d5('0x3f')](_0xe8d5('0x3e'),'createdAt')['field']('NOW()',_0xe8d5('0x42'))[_0xe8d5('0x43')]('cm_contacts')[_0xe8d5('0x44')](_0xe8d5('0x45'))[_0xe8d5('0x44')](_0xe8d5('0x46'),LISTID['toString']())[_0xe8d5('0x44')](_0xe8d5('0x47'))[_0xe8d5('0x44')](_0xe8d5('0x48'),squel[_0xe8d5('0x3c')]()[_0xe8d5('0x3f')]('phone')['from'](_0xe8d5('0x38'))['where'](_0x42ef95+_0xe8d5('0x49'),_0x267c85['id'][_0xe8d5('0x41')]())))[_0xe8d5('0x41')]();return _0x178d11;};var _0x4a81b1=function(_0x5cae9c,_0x89aeb9){var _0x1dfd33=squel['insert']()[_0xe8d5('0x4a')]('cm_hopper')[_0xe8d5('0x39')](['phone',_0xe8d5('0x3a'),_0xe8d5('0x40'),'ListId',_0x89aeb9,_0xe8d5('0x3b'),_0xe8d5('0x42')],squel['select']()[_0xe8d5('0x3f')](_0xe8d5('0x3d'),_0xe8d5('0x3d'))[_0xe8d5('0x3f')]('NOW()',_0xe8d5('0x3a'))[_0xe8d5('0x3f')]('id',_0xe8d5('0x40'))['field'](LISTID[_0xe8d5('0x41')](),_0xe8d5('0x29'))[_0xe8d5('0x3f')](_0x5cae9c['id'][_0xe8d5('0x41')](),_0x89aeb9)['field'](_0xe8d5('0x3e'),'createdAt')['field']('NOW()','updatedAt')['from']('cm_contacts')[_0xe8d5('0x44')]('deletedAt\x20IS\x20NULL')[_0xe8d5('0x44')](_0xe8d5('0x46'),LISTID['toString']())['where']('id\x20IN\x20?',squel[_0xe8d5('0x4b')](hopperContacts))[_0xe8d5('0x44')](_0xe8d5('0x47'))[_0xe8d5('0x44')](_0xe8d5('0x48'),squel[_0xe8d5('0x3c')]()[_0xe8d5('0x3f')](_0xe8d5('0x4c'))[_0xe8d5('0x43')](_0xe8d5('0x4d'))[_0xe8d5('0x44')](_0x89aeb9+'\x20=\x20?',_0x5cae9c['id']['toString']()))['where'](_0xe8d5('0x48'),squel['select']()['field']('phone')[_0xe8d5('0x43')]('cm_hopper')['where'](_0x89aeb9+_0xe8d5('0x49'),_0x5cae9c['id'][_0xe8d5('0x41')]())))[_0xe8d5('0x41')]();return _0x1dfd33;};function _0x67b8b5(_0x407346,_0x545931){var _0x438d7b=squel[_0xe8d5('0x37')]()['into'](_0xe8d5('0x38'))[_0xe8d5('0x39')]([_0xe8d5('0x3d'),'scheduledAt',_0xe8d5('0x40'),'ListId',_0x545931,_0xe8d5('0x3b'),_0xe8d5('0x42')],squel[_0xe8d5('0x3c')]()[_0xe8d5('0x3f')]('phone',_0xe8d5('0x3d'))[_0xe8d5('0x3f')](_0xe8d5('0x3e'),_0xe8d5('0x3a'))[_0xe8d5('0x3f')]('id',_0xe8d5('0x40'))['field'](LISTID[_0xe8d5('0x41')](),_0xe8d5('0x29'))['field'](_0x407346['id'][_0xe8d5('0x41')](),_0x545931)[_0xe8d5('0x3f')](_0xe8d5('0x3e'),'createdAt')['field']('NOW()',_0xe8d5('0x42'))[_0xe8d5('0x43')](_0xe8d5('0x4e'))[_0xe8d5('0x44')]('deletedAt\x20IS\x20NULL')['where']('ListId\x20=\x20?',LISTID[_0xe8d5('0x41')]())[_0xe8d5('0x44')](_0xe8d5('0x4f'),squel['str'](hopperContacts))[_0xe8d5('0x44')](_0xe8d5('0x47')))[_0xe8d5('0x41')]();return _0x438d7b;}function _0xd0d56f(_0x53b565,_0x4e3379){var _0x5405b0=squel[_0xe8d5('0x37')]()[_0xe8d5('0x4a')]('cm_hopper_black')['fromQuery']([_0xe8d5('0x3d'),_0xe8d5('0x40'),_0xe8d5('0x29'),_0x4e3379,_0xe8d5('0x3b'),_0xe8d5('0x42')],squel[_0xe8d5('0x3c')]()[_0xe8d5('0x3f')](_0xe8d5('0x3d'),_0xe8d5('0x3d'))['field']('id',_0xe8d5('0x40'))[_0xe8d5('0x3f')](LISTID[_0xe8d5('0x41')](),_0xe8d5('0x29'))['field'](_0x53b565['id'][_0xe8d5('0x41')](),_0x4e3379)[_0xe8d5('0x3f')]('NOW()',_0xe8d5('0x3b'))['field'](_0xe8d5('0x3e'),_0xe8d5('0x42'))[_0xe8d5('0x43')](_0xe8d5('0x4e'))[_0xe8d5('0x44')](_0xe8d5('0x45'))[_0xe8d5('0x44')](_0xe8d5('0x46'),LISTID[_0xe8d5('0x41')]())['where'](_0xe8d5('0x4f'),squel[_0xe8d5('0x4b')](hopperContacts))[_0xe8d5('0x44')]('phone\x20IS\x20NOT\x20NULL'))[_0xe8d5('0x41')]();return _0x5405b0;}return db[_0xe8d5('0x50')][_0xe8d5('0x51')]({'where':{'type':_0xe8d5('0x52')},'attributes':['id',_0xe8d5('0x53')],'include':[{'model':db['CmList'],'as':_0xe8d5('0x54'),'where':{'id':LISTID}}]})[_0xe8d5('0x2f')](function(_0x59113b){var _0x4d50c1=[];if(_0x59113b){var _0x2305e7;for(var _0x59b270=0x0,_0x35033f;_0x59b270<_0x59113b[_0xe8d5('0x1b')];_0x59b270+=0x1){_0x35033f=_0x59113b[_0x59b270][_0xe8d5('0x55')]({'plain':!![]});switch(_0x35033f[_0xe8d5('0x53')]){case _0xe8d5('0x56'):_0x4d50c1[_0xe8d5('0x57')](db[_0xe8d5('0x58')][_0xe8d5('0x59')](_0x4a81b1(_0x35033f,'VoiceQueueId'))[_0xe8d5('0x2f')](function(){})[_0xe8d5('0x31')](_0x1456db()));break;case _0xe8d5('0x5a'):_0x4d50c1['push'](db[_0xe8d5('0x58')]['query'](_0x55cc0c(_0x35033f,'VoiceQueueId'))['then'](function(){})['catch'](_0x1456db()));break;default:_0x4d50c1[_0xe8d5('0x57')](db[_0xe8d5('0x58')]['query'](_0x67b8b5(_0x35033f,_0xe8d5('0x5b')))[_0xe8d5('0x2f')](function(){})['catch'](_0x1456db()));}}}return _0x4d50c1;})['all']()[_0xe8d5('0x2f')](function(){return db[_0xe8d5('0x50')][_0xe8d5('0x51')]({'where':{'type':_0xe8d5('0x52')},'attributes':['id'],'include':[{'model':db['CmList'],'as':_0xe8d5('0x5c'),'where':{'id':LISTID}}]})[_0xe8d5('0x2f')](function(_0x54d203){var _0x329137=[];if(_0x54d203){var _0x1afdbd;for(var _0x41db0b=0x0,_0x219c42;_0x41db0b<_0x54d203[_0xe8d5('0x1b')];_0x41db0b+=0x1){_0x219c42=_0x54d203[_0x41db0b][_0xe8d5('0x55')]({'plain':!![]});_0x329137[_0xe8d5('0x57')](db[_0xe8d5('0x58')][_0xe8d5('0x59')](_0xd0d56f(_0x219c42,'VoiceQueueId'))[_0xe8d5('0x2f')](function(){})['catch'](_0x1456db()));}}return _0x329137;})[_0xe8d5('0x5d')]();})[_0xe8d5('0x2f')](function(){return db[_0xe8d5('0x5e')][_0xe8d5('0x51')]({'attributes':['id',_0xe8d5('0x53')],'include':[{'model':db[_0xe8d5('0x5f')],'as':_0xe8d5('0x54'),'where':{'id':LISTID}}]})[_0xe8d5('0x2f')](function(_0x45aca8){var _0x279273=[];if(_0x45aca8){for(var _0x2b6797=0x0,_0x3ff8fa;_0x2b6797<_0x45aca8['length'];_0x2b6797+=0x1){_0x3ff8fa=_0x45aca8[_0x2b6797][_0xe8d5('0x55')]({'plain':!![]});switch(_0x3ff8fa[_0xe8d5('0x53')]){case _0xe8d5('0x56'):_0x279273[_0xe8d5('0x57')](db['sequelize'][_0xe8d5('0x59')](_0x4a81b1(_0x3ff8fa,_0xe8d5('0x60')))[_0xe8d5('0x2f')](function(){})[_0xe8d5('0x31')](_0x1456db()));break;case _0xe8d5('0x5a'):_0x279273[_0xe8d5('0x57')](db[_0xe8d5('0x58')][_0xe8d5('0x59')](_0x55cc0c(_0x3ff8fa,'CampaignId'))[_0xe8d5('0x2f')](function(){})[_0xe8d5('0x31')](_0x1456db()));break;default:_0x279273['push'](db[_0xe8d5('0x58')][_0xe8d5('0x59')](_0x67b8b5(_0x3ff8fa,'CampaignId'))[_0xe8d5('0x2f')](function(){})[_0xe8d5('0x31')](_0x1456db()));}}}return _0x279273;})[_0xe8d5('0x5d')]();})['then'](function(){return db['Campaign'][_0xe8d5('0x51')]({'attributes':['id'],'include':[{'model':db[_0xe8d5('0x5f')],'as':_0xe8d5('0x5c'),'where':{'id':LISTID}}]})[_0xe8d5('0x2f')](function(_0x26d90f){var _0x4db088=[];if(_0x26d90f){for(var _0x8edb45=0x0,_0x156c49;_0x8edb45<_0x26d90f[_0xe8d5('0x1b')];_0x8edb45+=0x1){_0x156c49=_0x26d90f[_0x8edb45][_0xe8d5('0x55')]({'plain':!![]});_0x4db088[_0xe8d5('0x57')](db[_0xe8d5('0x58')]['query'](_0xd0d56f(_0x156c49,_0xe8d5('0x60')))[_0xe8d5('0x2f')](function(){})[_0xe8d5('0x31')](_0x1456db()));}}return _0x4db088;})['all']();})[_0xe8d5('0x31')](function(_0x3fad38){logger[_0xe8d5('0x15')](_0xe8d5('0x61'),_0xe8d5('0x62'),_0x3fad38[_0xe8d5('0x1d')]);});}var processPromises=function(_0x38d8ff){return BPromise['all'](promises)[_0xe8d5('0x2f')](function(_0x31ff76){})['catch'](function(_0x3b992d){logger[_0xe8d5('0x15')](_0xe8d5('0x63'),JSON[_0xe8d5('0x33')](_0x3b992d));})[_0xe8d5('0x64')](function(){socket[_0xe8d5('0x65')](_0xe8d5('0x66')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x38d8ff){return _0x38d8ff[_0xe8d5('0x67')]();}});};var endCsv=function(){return BPromise[_0xe8d5('0x68')]()['then'](function(){if(hopperContacts){return checkHopper();}})[_0xe8d5('0x2f')](function(){socket['emit'](_0xe8d5('0x66')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0xe8d5('0x69')](FILEPATH);}catch(_0x5b3ea1){logger[_0xe8d5('0x15')](_0xe8d5('0x6a'),JSON[_0xe8d5('0x33')](_0x5b3ea1));}finally{process[_0xe8d5('0x6b')](0x0);}});};process['on'](_0xe8d5('0x6c'),function(){logger[_0xe8d5('0x6d')](_0xe8d5('0x6e'));endCsv();});function main(){return BPromise['resolve']()[_0xe8d5('0x2f')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES['split'](',');return db['CmContact']['findAll']({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0xe8d5('0x2f')](function(_0x249376){var _0x47f0e7=fs[_0xe8d5('0x6f')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa['parse'](_0x47f0e7,{'header':!![],'skipEmptyLines':!![],'step':function(_0xbabdae,_0x3c60b7){total+=0x1;var _0x442c00=total;promises[_0xe8d5('0x57')](checkRow(_0xbabdae,_0x249376,_0x442c00)[_0xe8d5('0x2f')](function(){success+=0x1;})[_0xe8d5('0x31')](function(_0x205623){if(_0x205623[_0xe8d5('0x15')]){errors+=0x1;delete _0x205623[_0xe8d5('0x15')];}else if(_0x205623['duplicate']){duplicates+=0x1;delete _0x205623[_0xe8d5('0x2c')];}rows[_0xe8d5('0x57')](_0x205623);}));if(total%0xc8===0x0){_0x3c60b7[_0xe8d5('0x70')]();return processPromises(_0x3c60b7);}},'complete':function(){return processPromises()[_0xe8d5('0x2f')](function(){logger[_0xe8d5('0x6d')](_0xe8d5('0x71'));endCsv();});},'error':function(_0x40db81,_0x454e07){logger[_0xe8d5('0x6d')](_0xe8d5('0x72'),JSON[_0xe8d5('0x33')](_0x40db81));endCsv();}});})['catch'](function(_0x5e6f39){logger[_0xe8d5('0x15')](_0xe8d5('0x73'),JSON[_0xe8d5('0x33')](_0x5e6f39));});}main(); \ No newline at end of file +var _0x2ede=['birthDate','YYYY-MM-DD','isValid','birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!','email','email\x20format\x20is\x20not\x20valid!','ListId','CompanyId','find','duplicate','Duplicate\x20Contact','create','then','push','pick','catch','Error\x20while\x20creating\x20contact:\x20','stringify','inspect','insert','into','cm_hopper','fromQuery','scheduledAt','ContactId','createdAt','updatedAt','select','field','NOW()','toString','cm_contacts','where','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20NOT\x20IN\x20(?)','\x20=\x20?','from','id\x20IN\x20?','phone\x20IS\x20NOT\x20NULL','calleridnum','cm_hopper_black','str','VoiceQueue','outbound','dialCheckDuplicateType','CmList','Lists','get','sequelize','query','VoiceQueueId','onlyIfOpen','all','findAll','BlackLists','Campaign','always','CampaignId','cmContact,\x20%s,\x20%s','generalCheckHopper','Error\x20processing\x20rows\x20block:','resume','resolve','emit','contact:csv_','unlinkSync','Unable\x20to\x20delete\x20temp\x20file:','exit','SIGINT','CmContact','createReadStream','pause','info','CSV\x20parsed\x20correctly!','Error\x20executing\x20contact\x20csv\x20import:','bluebird','util','lodash','squel','papaparse','ioredis','../../../mysqldb','../../../config/environment','../../../config/logger','api','redis','defaults','socket.io-emitter','argv','undefined','null','Missing\x20filepath\x20parameter!','Missing\x20binding\x20parameters!','split','Missing\x20ListId\x20parameter!','Missing\x20socket_timestamp\x20parameter!','error','contact','index','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!','errors','length','map','message','join','hasOwnProperty','data','firstName','phone','phone\x20not\x20specified!'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x2ede,0x12a));var _0xe2ed=function(_0x56caf4,_0x4f289c){_0x56caf4=_0x56caf4-0x0;var _0x43ad12=_0x2ede[_0x56caf4];return _0x43ad12;};'use strict';var BPromise=require(_0xe2ed('0x0'));var util=require(_0xe2ed('0x1'));var _=require(_0xe2ed('0x2'));var fs=require('fs');var squel=require(_0xe2ed('0x3'));var Papa=require(_0xe2ed('0x4'));var Redis=require(_0xe2ed('0x5'));var db=require(_0xe2ed('0x6'))['db'];var config=require(_0xe2ed('0x7'));var logger=require(_0xe2ed('0x8'))(_0xe2ed('0x9'));config[_0xe2ed('0xa')]=_[_0xe2ed('0xb')](config[_0xe2ed('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0xe2ed('0xc'))(new Redis(config[_0xe2ed('0xa')]));require('../../../api/cmContact/cmContact.socket')['register'](socket);try{if(!process[_0xe2ed('0xd')][0x2]||process[_0xe2ed('0xd')][0x2]===_0xe2ed('0xe')||process['argv'][0x2]===_0xe2ed('0xf')){throw new Error(_0xe2ed('0x10'));}var FILEPATH=process['argv'][0x2];if(!process[_0xe2ed('0xd')][0x3]||process['argv'][0x3]==='undefined'||process[_0xe2ed('0xd')][0x3]===_0xe2ed('0xf')||!process['argv'][0x4]||process[_0xe2ed('0xd')][0x4]===_0xe2ed('0xe')||process[_0xe2ed('0xd')][0x4]==='null'){throw new Error(_0xe2ed('0x11'));}var FIELDS=_['zipObject'](process['argv'][0x3]['split'](','),process['argv'][0x4][_0xe2ed('0x12')](','));if(!process[_0xe2ed('0xd')][0x5]||process['argv'][0x5]===_0xe2ed('0xe')||process[_0xe2ed('0xd')][0x5]===_0xe2ed('0xf')){throw new Error(_0xe2ed('0x13'));}var LISTID=process[_0xe2ed('0xd')][0x5];var COMPANYID=process['argv'][0x6]&&process[_0xe2ed('0xd')][0x6]!==_0xe2ed('0xe')&&process[_0xe2ed('0xd')][0x6]!==_0xe2ed('0xf')?process[_0xe2ed('0xd')][0x6]:null;var DUPLICATES=process['argv'][0x7]&&process[_0xe2ed('0xd')][0x7]!=='undefined'&&process[_0xe2ed('0xd')][0x7]!==_0xe2ed('0xf')?process['argv'][0x7]:null;if(!process[_0xe2ed('0xd')][0x8]||process[_0xe2ed('0xd')][0x8]===_0xe2ed('0xe')||process[_0xe2ed('0xd')][0x8]===_0xe2ed('0xf')){throw new Error(_0xe2ed('0x14'));}var SOCKET_TIMESTAMP=process[_0xe2ed('0xd')][0x8];}catch(_0x29e561){logger[_0xe2ed('0x15')](_0x29e561);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(_0x22348b,_0x508277,_0x1c92cb,_0x27e67a){var _0x4b3081={'message':_0x508277};_0x4b3081[_0x22348b]=!![];if(_0x1c92cb){_0x4b3081[_0xe2ed('0x16')]=_0x1c92cb;}if(_0x27e67a){_0x4b3081[_0xe2ed('0x17')]=_0x27e67a;}return _0x4b3081;}function isEmail(_0x12e740){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'](_0x12e740);}function checkRow(_0x4d9f4e,_0x24dc5b,_0x49748b){return new BPromise(function(_0x596a43,_0x5e046d){if(_['isNil'](_0x4d9f4e)){return _0x5e046d(handleCheckRowError(_0xe2ed('0x15'),_0xe2ed('0x18'),null,_0x49748b));}if(_0x4d9f4e['errors']&&_0x4d9f4e[_0xe2ed('0x19')][_0xe2ed('0x1a')]){var _0x2182ee=_[_0xe2ed('0x1b')](_0x4d9f4e[_0xe2ed('0x19')],_0xe2ed('0x1c'))[_0xe2ed('0x1d')](';');return _0x5e046d(handleCheckRowError(_0xe2ed('0x15'),_0x2182ee,null,_0x49748b));}var _0x4f8925={};for(var _0xa53439 in FIELDS){if(FIELDS[_0xe2ed('0x1e')](_0xa53439)&&FIELDS[_0xa53439]){_0x4f8925[_0xa53439]=_0x4d9f4e[_0xe2ed('0x1f')][0x0][FIELDS[_0xa53439]]||_0x4d9f4e[_0xe2ed('0x1f')][0x0]['\ufeff'+FIELDS[_0xa53439]];}}if(!_0x4f8925[_0xe2ed('0x20')]){return _0x5e046d(handleCheckRowError('error','firstName\x20not\x20specified!',null,_0x49748b));}if(!_0x4f8925[_0xe2ed('0x21')]){return _0x5e046d(handleCheckRowError('error',_0xe2ed('0x22'),null,_0x49748b));}if(_0x4f8925[_0xe2ed('0x23')]){var _0x483c3a=moment(_0x4f8925[_0xe2ed('0x23')],_0xe2ed('0x24'));if(!_0x483c3a[_0xe2ed('0x25')]()){return _0x5e046d(handleCheckRowError(_0xe2ed('0x15'),_0xe2ed('0x26'),null,_0x49748b));}}if(_0x4f8925['email']){if(!isEmail(_0x4f8925[_0xe2ed('0x27')])){return _0x5e046d(handleCheckRowError(_0xe2ed('0x15'),_0xe2ed('0x28'),null,_0x49748b));}}_0x4f8925[_0xe2ed('0x29')]=LISTID;_0x4f8925[_0xe2ed('0x2a')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES[_0xe2ed('0x1a')]&&_0x24dc5b){var _0x206a3a={};for(var _0x3331ee=0x0,_0x4ed394=DUPLICATES['length'];_0x3331ee<_0x4ed394;_0x3331ee+=0x1){_0x206a3a[DUPLICATES[_0x3331ee]]=_0x4f8925[DUPLICATES[_0x3331ee]];}var _0x2b0520=_[_0xe2ed('0x2b')](_0x24dc5b,_0x206a3a);if(_0x2b0520){return _0x5e046d(handleCheckRowError(_0xe2ed('0x2c'),_0xe2ed('0x2d'),_0x2b0520,_0x49748b));}}return db['CmContact'][_0xe2ed('0x2e')](_0x4f8925,{'raw':!![],'hooks':![],'fields':_['keys'](_0x4f8925)})[_0xe2ed('0x2f')](function(_0x140087){if(DUPLICATES&&DUPLICATES['length']&&_0x24dc5b){_0x24dc5b[_0xe2ed('0x30')](_[_0xe2ed('0x31')](_0x4f8925,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x140087['id'];return _0x596a43();})[_0xe2ed('0x32')](function(_0xf4eb21){return _0x5e046d(handleCheckRowError(_0xe2ed('0x15'),_0xe2ed('0x33')+(_0xf4eb21[_0xe2ed('0x1c')]||JSON[_0xe2ed('0x34')](_0xf4eb21)),null,_0x49748b));});});}function checkHopper(){function _0x1e249f(){return function(_0xdc2729){logger[_0xe2ed('0x15')]('cmContact','checkHopper',util[_0xe2ed('0x35')](_0xdc2729,{'showHidden':![],'depth':null}));};}var _0x332e49=function(_0x4082e8,_0x43ae9b){var _0x426994=squel[_0xe2ed('0x36')]()[_0xe2ed('0x37')](_0xe2ed('0x38'))[_0xe2ed('0x39')]([_0xe2ed('0x21'),_0xe2ed('0x3a'),_0xe2ed('0x3b'),'ListId',_0x43ae9b,_0xe2ed('0x3c'),_0xe2ed('0x3d')],squel[_0xe2ed('0x3e')]()[_0xe2ed('0x3f')](_0xe2ed('0x21'),_0xe2ed('0x21'))['field'](_0xe2ed('0x40'),_0xe2ed('0x3a'))[_0xe2ed('0x3f')]('id',_0xe2ed('0x3b'))[_0xe2ed('0x3f')](LISTID[_0xe2ed('0x41')](),_0xe2ed('0x29'))[_0xe2ed('0x3f')](_0x4082e8['id'][_0xe2ed('0x41')](),_0x43ae9b)[_0xe2ed('0x3f')](_0xe2ed('0x40'),_0xe2ed('0x3c'))[_0xe2ed('0x3f')]('NOW()',_0xe2ed('0x3d'))['from'](_0xe2ed('0x42'))[_0xe2ed('0x43')](_0xe2ed('0x44'))[_0xe2ed('0x43')](_0xe2ed('0x45'),LISTID[_0xe2ed('0x41')]())[_0xe2ed('0x43')]('phone\x20IS\x20NOT\x20NULL')[_0xe2ed('0x43')](_0xe2ed('0x46'),squel['select']()[_0xe2ed('0x3f')](_0xe2ed('0x21'))['from'](_0xe2ed('0x38'))[_0xe2ed('0x43')](_0x43ae9b+_0xe2ed('0x47'),_0x4082e8['id']['toString']())))['toString']();return _0x426994;};var _0x1b4d17=function(_0xf0166,_0x4ae30a){var _0xbc99c6=squel[_0xe2ed('0x36')]()[_0xe2ed('0x37')](_0xe2ed('0x38'))[_0xe2ed('0x39')]([_0xe2ed('0x21'),_0xe2ed('0x3a'),_0xe2ed('0x3b'),_0xe2ed('0x29'),_0x4ae30a,_0xe2ed('0x3c'),_0xe2ed('0x3d')],squel[_0xe2ed('0x3e')]()['field'](_0xe2ed('0x21'),_0xe2ed('0x21'))['field']('NOW()',_0xe2ed('0x3a'))[_0xe2ed('0x3f')]('id',_0xe2ed('0x3b'))['field'](LISTID[_0xe2ed('0x41')](),_0xe2ed('0x29'))['field'](_0xf0166['id'][_0xe2ed('0x41')](),_0x4ae30a)[_0xe2ed('0x3f')](_0xe2ed('0x40'),_0xe2ed('0x3c'))[_0xe2ed('0x3f')](_0xe2ed('0x40'),_0xe2ed('0x3d'))[_0xe2ed('0x48')](_0xe2ed('0x42'))[_0xe2ed('0x43')](_0xe2ed('0x44'))['where'](_0xe2ed('0x45'),LISTID[_0xe2ed('0x41')]())['where'](_0xe2ed('0x49'),squel['str'](hopperContacts))[_0xe2ed('0x43')](_0xe2ed('0x4a'))[_0xe2ed('0x43')]('phone\x20NOT\x20IN\x20(?)',squel[_0xe2ed('0x3e')]()[_0xe2ed('0x3f')](_0xe2ed('0x4b'))[_0xe2ed('0x48')]('cm_hopper_final')[_0xe2ed('0x43')](_0x4ae30a+'\x20=\x20?',_0xf0166['id'][_0xe2ed('0x41')]()))[_0xe2ed('0x43')](_0xe2ed('0x46'),squel[_0xe2ed('0x3e')]()[_0xe2ed('0x3f')](_0xe2ed('0x21'))[_0xe2ed('0x48')]('cm_hopper')[_0xe2ed('0x43')](_0x4ae30a+_0xe2ed('0x47'),_0xf0166['id'][_0xe2ed('0x41')]())))['toString']();return _0xbc99c6;};function _0x3a23cb(_0x1cf5e7,_0x3e8de2){var _0x38dbec=squel[_0xe2ed('0x36')]()[_0xe2ed('0x37')](_0xe2ed('0x38'))[_0xe2ed('0x39')](['phone','scheduledAt',_0xe2ed('0x3b'),'ListId',_0x3e8de2,_0xe2ed('0x3c'),_0xe2ed('0x3d')],squel[_0xe2ed('0x3e')]()[_0xe2ed('0x3f')](_0xe2ed('0x21'),'phone')[_0xe2ed('0x3f')](_0xe2ed('0x40'),'scheduledAt')['field']('id','ContactId')[_0xe2ed('0x3f')](LISTID[_0xe2ed('0x41')](),'ListId')[_0xe2ed('0x3f')](_0x1cf5e7['id'][_0xe2ed('0x41')](),_0x3e8de2)[_0xe2ed('0x3f')](_0xe2ed('0x40'),_0xe2ed('0x3c'))[_0xe2ed('0x3f')](_0xe2ed('0x40'),_0xe2ed('0x3d'))['from'](_0xe2ed('0x42'))[_0xe2ed('0x43')]('deletedAt\x20IS\x20NULL')[_0xe2ed('0x43')](_0xe2ed('0x45'),LISTID[_0xe2ed('0x41')]())[_0xe2ed('0x43')]('id\x20IN\x20?',squel['str'](hopperContacts))[_0xe2ed('0x43')](_0xe2ed('0x4a')))[_0xe2ed('0x41')]();return _0x38dbec;}function _0x234d62(_0x42911c,_0x4b3e7a){var _0x1fb39d=squel[_0xe2ed('0x36')]()[_0xe2ed('0x37')](_0xe2ed('0x4c'))['fromQuery']([_0xe2ed('0x21'),_0xe2ed('0x3b'),'ListId',_0x4b3e7a,_0xe2ed('0x3c'),_0xe2ed('0x3d')],squel['select']()[_0xe2ed('0x3f')]('phone',_0xe2ed('0x21'))[_0xe2ed('0x3f')]('id',_0xe2ed('0x3b'))[_0xe2ed('0x3f')](LISTID['toString'](),_0xe2ed('0x29'))['field'](_0x42911c['id']['toString'](),_0x4b3e7a)[_0xe2ed('0x3f')](_0xe2ed('0x40'),_0xe2ed('0x3c'))[_0xe2ed('0x3f')](_0xe2ed('0x40'),_0xe2ed('0x3d'))[_0xe2ed('0x48')]('cm_contacts')[_0xe2ed('0x43')]('deletedAt\x20IS\x20NULL')[_0xe2ed('0x43')]('ListId\x20=\x20?',LISTID[_0xe2ed('0x41')]())['where']('id\x20IN\x20?',squel[_0xe2ed('0x4d')](hopperContacts))[_0xe2ed('0x43')](_0xe2ed('0x4a')))[_0xe2ed('0x41')]();return _0x1fb39d;}return db[_0xe2ed('0x4e')]['findAll']({'where':{'type':_0xe2ed('0x4f')},'attributes':['id',_0xe2ed('0x50')],'include':[{'model':db[_0xe2ed('0x51')],'as':_0xe2ed('0x52'),'where':{'id':LISTID}}]})[_0xe2ed('0x2f')](function(_0x46da45){var _0x471f1d=[];if(_0x46da45){var _0xe037be;for(var _0x2e5460=0x0,_0x32eb3d;_0x2e5460<_0x46da45['length'];_0x2e5460+=0x1){_0x32eb3d=_0x46da45[_0x2e5460][_0xe2ed('0x53')]({'plain':!![]});switch(_0x32eb3d['dialCheckDuplicateType']){case'always':_0x471f1d[_0xe2ed('0x30')](db[_0xe2ed('0x54')][_0xe2ed('0x55')](_0x1b4d17(_0x32eb3d,_0xe2ed('0x56')))['then'](function(){})[_0xe2ed('0x32')](_0x1e249f()));break;case _0xe2ed('0x57'):_0x471f1d[_0xe2ed('0x30')](db[_0xe2ed('0x54')][_0xe2ed('0x55')](_0x332e49(_0x32eb3d,_0xe2ed('0x56')))[_0xe2ed('0x2f')](function(){})['catch'](_0x1e249f()));break;default:_0x471f1d['push'](db[_0xe2ed('0x54')][_0xe2ed('0x55')](_0x3a23cb(_0x32eb3d,_0xe2ed('0x56')))[_0xe2ed('0x2f')](function(){})[_0xe2ed('0x32')](_0x1e249f()));}}}return _0x471f1d;})[_0xe2ed('0x58')]()['then'](function(){return db[_0xe2ed('0x4e')][_0xe2ed('0x59')]({'where':{'type':_0xe2ed('0x4f')},'attributes':['id'],'include':[{'model':db[_0xe2ed('0x51')],'as':_0xe2ed('0x5a'),'where':{'id':LISTID}}]})[_0xe2ed('0x2f')](function(_0x3daae2){var _0x2b89d1=[];if(_0x3daae2){var _0xc0dc9d;for(var _0x43e748=0x0,_0x51e0d9;_0x43e748<_0x3daae2[_0xe2ed('0x1a')];_0x43e748+=0x1){_0x51e0d9=_0x3daae2[_0x43e748]['get']({'plain':!![]});_0x2b89d1[_0xe2ed('0x30')](db[_0xe2ed('0x54')][_0xe2ed('0x55')](_0x234d62(_0x51e0d9,_0xe2ed('0x56')))[_0xe2ed('0x2f')](function(){})[_0xe2ed('0x32')](_0x1e249f()));}}return _0x2b89d1;})['all']();})[_0xe2ed('0x2f')](function(){return db[_0xe2ed('0x5b')]['findAll']({'attributes':['id',_0xe2ed('0x50')],'include':[{'model':db[_0xe2ed('0x51')],'as':_0xe2ed('0x52'),'where':{'id':LISTID}}]})[_0xe2ed('0x2f')](function(_0x5c16e7){var _0x4b963c=[];if(_0x5c16e7){for(var _0x520239=0x0,_0x1ad5d9;_0x520239<_0x5c16e7[_0xe2ed('0x1a')];_0x520239+=0x1){_0x1ad5d9=_0x5c16e7[_0x520239]['get']({'plain':!![]});switch(_0x1ad5d9['dialCheckDuplicateType']){case _0xe2ed('0x5c'):_0x4b963c[_0xe2ed('0x30')](db[_0xe2ed('0x54')][_0xe2ed('0x55')](_0x1b4d17(_0x1ad5d9,'CampaignId'))[_0xe2ed('0x2f')](function(){})['catch'](_0x1e249f()));break;case _0xe2ed('0x57'):_0x4b963c[_0xe2ed('0x30')](db[_0xe2ed('0x54')][_0xe2ed('0x55')](_0x332e49(_0x1ad5d9,_0xe2ed('0x5d')))[_0xe2ed('0x2f')](function(){})[_0xe2ed('0x32')](_0x1e249f()));break;default:_0x4b963c[_0xe2ed('0x30')](db[_0xe2ed('0x54')]['query'](_0x3a23cb(_0x1ad5d9,_0xe2ed('0x5d')))[_0xe2ed('0x2f')](function(){})[_0xe2ed('0x32')](_0x1e249f()));}}}return _0x4b963c;})[_0xe2ed('0x58')]();})[_0xe2ed('0x2f')](function(){return db[_0xe2ed('0x5b')][_0xe2ed('0x59')]({'attributes':['id'],'include':[{'model':db[_0xe2ed('0x51')],'as':_0xe2ed('0x5a'),'where':{'id':LISTID}}]})[_0xe2ed('0x2f')](function(_0x25de38){var _0x22af43=[];if(_0x25de38){for(var _0x5c5523=0x0,_0x2dc49b;_0x5c5523<_0x25de38[_0xe2ed('0x1a')];_0x5c5523+=0x1){_0x2dc49b=_0x25de38[_0x5c5523][_0xe2ed('0x53')]({'plain':!![]});_0x22af43[_0xe2ed('0x30')](db[_0xe2ed('0x54')][_0xe2ed('0x55')](_0x234d62(_0x2dc49b,_0xe2ed('0x5d')))[_0xe2ed('0x2f')](function(){})[_0xe2ed('0x32')](_0x1e249f()));}}return _0x22af43;})[_0xe2ed('0x58')]();})['catch'](function(_0x32a6f0){logger[_0xe2ed('0x15')](_0xe2ed('0x5e'),_0xe2ed('0x5f'),_0x32a6f0['message']);});}var processPromises=function(_0x21e91b){return BPromise[_0xe2ed('0x58')](promises)[_0xe2ed('0x2f')](function(_0x54ae6e){})[_0xe2ed('0x32')](function(_0x41ecbb){logger[_0xe2ed('0x15')](_0xe2ed('0x60'),JSON[_0xe2ed('0x34')](_0x41ecbb));})['finally'](function(){socket['emit']('contact:csv_'+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x21e91b){return _0x21e91b[_0xe2ed('0x61')]();}});};var endCsv=function(){return BPromise[_0xe2ed('0x62')]()['then'](function(){if(hopperContacts){return checkHopper();}})[_0xe2ed('0x2f')](function(){socket[_0xe2ed('0x63')](_0xe2ed('0x64')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0xe2ed('0x65')](FILEPATH);}catch(_0x22c214){logger[_0xe2ed('0x15')](_0xe2ed('0x66'),JSON[_0xe2ed('0x34')](_0x22c214));}finally{process[_0xe2ed('0x67')](0x0);}});};process['on'](_0xe2ed('0x68'),function(){logger['info']('CSV\x20import\x20process\x20stopped!');endCsv();});function main(){return BPromise['resolve']()['then'](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0xe2ed('0x12')](',');return db[_0xe2ed('0x69')][_0xe2ed('0x59')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})['then'](function(_0x4c8e20){var _0x10e104=fs[_0xe2ed('0x6a')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa['parse'](_0x10e104,{'header':!![],'skipEmptyLines':!![],'step':function(_0x34cf0e,_0x5097f6){total+=0x1;var _0x250ec3=total;promises['push'](checkRow(_0x34cf0e,_0x4c8e20,_0x250ec3)[_0xe2ed('0x2f')](function(){success+=0x1;})[_0xe2ed('0x32')](function(_0x1c9a3a){if(_0x1c9a3a[_0xe2ed('0x15')]){errors+=0x1;delete _0x1c9a3a[_0xe2ed('0x15')];}else if(_0x1c9a3a[_0xe2ed('0x2c')]){duplicates+=0x1;delete _0x1c9a3a[_0xe2ed('0x2c')];}rows[_0xe2ed('0x30')](_0x1c9a3a);}));if(total%0xc8===0x0){_0x5097f6[_0xe2ed('0x6b')]();return processPromises(_0x5097f6);}},'complete':function(){return processPromises()[_0xe2ed('0x2f')](function(){logger[_0xe2ed('0x6c')](_0xe2ed('0x6d'));endCsv();});},'error':function(_0x1ad1bd,_0x4ecb4f){logger[_0xe2ed('0x6c')]('CSV\x20parse\x20error',JSON[_0xe2ed('0x34')](_0x1ad1bd));endCsv();}});})[_0xe2ed('0x32')](function(_0x3b9eb9){logger[_0xe2ed('0x15')](_0xe2ed('0x6e'),JSON[_0xe2ed('0x34')](_0x3b9eb9));});}main(); \ No newline at end of file diff --git a/server/components/import/cm/csv2.js b/server/components/import/cm/csv2.js index 44ed9b0..290bf19 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 _0xedb6=['insert','cm_hopper_black','cm_contacts','.CmListId','cm_contacts.createdAt\x20=\x20?','ListId\x20=\x20?','toString','date_add(cm_contacts.scheduledat,interval\x20','.offset-cm_contacts.utcOffset\x20minute)','scheduledat','recallme','cm_hopper.id','cm_contact_has_items.OrderBy','cm_contact_has_items.createdAt','cm_contact_has_items.updatedAt','cm_hopper_additional_phones','cm_contacts.id\x20=\x20cm_hopper.ContactId','cm_contacts.id\x20=\x20cm_contact_has_items.CmContactId','concat','keys','CompanyId',')\x20NOT\x20IN\x20?','deletedAt\x20IS\x20NULL','id\x20IN\x20?','MIN(id)','group','info','Received\x20SIGINT','error','message','exit','errors','sequelize','query','spread','catch','campaigns.id','campaigns.dialTimezone','campaigns','campaigns.id\x20=\x20campaigns_has_cm_lists.CampaignId','campaigns_has_cm_lists.CmListId=','voice_queues.id','voice_queues.dialTimezone','voice_queues_has_cm_lists','voice_queues.id\x20=\x20voice_queues_has_cm_lists.VoiceQueueId','voice_queues_has_cm_lists.CmListId=','timezones','dialTimezone','isNil','utcOffset','set','send','start','binding','clone','socket_timestamp','root','server/files/tmp','.csv','includes','header','ContactItemType','name','writeFileSync','parse','createReadStream','data','rows','find','hasOwnProperty','trim','replace','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','isNaN','agent\x20not\x20exists','email','email\x20wrong\x20format','dateOfBirth','YYYY-MM-DD','isValid','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','firstName','\x20not\x20specified','description','SystemRow','appendFileSync','contact:import:','Abort\x20parser','SystemError','step','duplicates','CREATE\x20TABLE\x20','\x20LIKE\x20cm_contacts;','voice_queues_','(id\x20int,dialTimezone\x20varchar(255),offset\x20int);','dialTimezone,utcOffset','LOAD\x20DATA\x20LOCAL\x20INFILE\x20\x27%s\x27\x20INTO\x20TABLE\x20%s\x20CHARACTER\x20SET\x20UTF8\x20FIELDS\x20TERMINATED\x20BY\x20\x27,\x27\x20ENCLOSED\x20BY\x20\x27\x22\x27\x20LINES\x20TERMINATED\x20BY\x20\x27\x0a\x27\x20IGNORE\x201\x20ROWS\x20(%s)\x20SET\x20id\x20=\x20NULL,\x20ListId\x20=\x20%s,\x20CompanyId\x20=\x20%s,\x20createdAt\x20=\x20\x27%s\x27,\x20updatedAt\x20=\x20\x27%s\x27',',\x20scheduledAt\x20=\x20NOW()','DROP\x20TABLE\x20','each','contactId','contactTypeId','orderBy','voice_queues','VoiceQueueId','voice_queues_has_cm_blacklists','campaigns_has_cm_lists','CampaignId','campaigns_has_cm_blacklists','finish','affectedRows','emit','unlink','complete','argv','arguments\x20\x20\x20','existsSync','file\x20doesn\x27t\x20exists','phone\x20is\x20mandatory','ListId\x20is\x20mandatory','body\x20id\x20mandatory','map','No\x20agent\x20available','uncaughtException','papaparse','util','squel','ioredis','../../../mysqldb','../../../config/environment/shared','../../../config/logger','import','redis','defaults','localhost','socket.io-emitter','format','YYYY-MM-DD\x20HH:mm:ss','test','select','field','phone','join','.id\x20=\x20','where','\x20=\x20','.dialCheckDuplicateType\x20IN\x20(','CmContact','findAll','AdditionalPhones','then','length','push','all','split','CmContactHasItem','findOne','update','updated','create','PHONE','inserted','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.ListId','cm_contacts.updatedAt','cm_contacts.priority','cm_contacts.UserId','into','cm_hopper','fromQuery','ContactId','ListId','createdAt','updatedAt','priority','UserId','fields','from','cm_contacts.ListId\x20=\x20','.CmListId\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22onlyIfOpen\x22','\x22always\x22','cm_contacts.createdAt'];(function(_0x23d98f,_0x31d925){var _0x18a67d=function(_0x284e8d){while(--_0x284e8d){_0x23d98f['push'](_0x23d98f['shift']());}};_0x18a67d(++_0x31d925);}(_0xedb6,0x7c));var _0x6edb=function(_0x239b31,_0x44a64d){_0x239b31=_0x239b31-0x0;var _0x41c8be=_0xedb6[_0x239b31];return _0x41c8be;};'use strict';var fs=require('fs');var path=require('path');var _=require('lodash');var Papa=require(_0x6edb('0x0'));var util=require(_0x6edb('0x1'));var BPromise=require('bluebird');var moment=require('moment');var squel=require(_0x6edb('0x2'));var Redis=require(_0x6edb('0x3'));var db=require(_0x6edb('0x4'))['db'];var config=require('../../../config/environment');var shared=require(_0x6edb('0x5'));var logger=require(_0x6edb('0x6'))(_0x6edb('0x7'));config[_0x6edb('0x8')]=_[_0x6edb('0x9')](config['redis'],{'host':_0x6edb('0xa'),'port':0x18eb});var socket=require(_0x6edb('0xb'))(new Redis(config[_0x6edb('0x8')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var orderBy=0x0;var stopped=![];var NOW=moment()[_0x6edb('0xc')](_0x6edb('0xd'));var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];var tmp_voice_queues;var tmp_campaigns;var tzOffset=0x0;var hasTZ;var NOW=moment()[_0x6edb('0xc')](_0x6edb('0xd'));function isEmail(_0x22c6b3){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))*$/[_0x6edb('0xe')](_0x22c6b3);}function selectNotIn(_0x35c5e6,_0x79e579,_0x505710,_0x43b2cd,_0x339cfc){return squel[_0x6edb('0xf')]()[_0x6edb('0x10')](_0x6edb('0x11'))['from'](_0x43b2cd)[_0x6edb('0x12')](_0x79e579,null,_0x79e579+_0x6edb('0x13')+_0x43b2cd+'.'+_0x505710)[_0x6edb('0x14')](_0x43b2cd+'.'+_0x505710+_0x6edb('0x15')+_0x35c5e6+'.'+_0x505710)[_0x6edb('0x14')](_0x79e579+_0x6edb('0x16')+_0x339cfc[_0x6edb('0x12')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0x413f7d,_0x433741){promisesAdditionalPhones=[];return db[_0x6edb('0x17')][_0x6edb('0x18')]({'raw':!![],'attributes':['id',_0x6edb('0x19')],'where':{'createdAt':NOW,'AdditionalPhones':{'$ne':null}}})[_0x6edb('0x1a')](function(_0x317023){if(_0x317023!==null){var _0x2dae46=[];for(var _0x5b6fbd=0x0;_0x5b6fbd<_0x317023[_0x6edb('0x1b')];_0x5b6fbd++){var _0x581d99=_0x317023[_0x5b6fbd];_0x2dae46[_0x6edb('0x1c')](insertAdditionalPhones(_0x581d99));}}Promise[_0x6edb('0x1d')](_0x2dae46)[_0x6edb('0x1a')](function(){_0x413f7d({'val':0x1});});});});}function insertAdditionalPhones(_0x221f41){return new Promise(function(_0x509ea9,_0x4b697d){var _0x1bda3e=_0x221f41[_0x6edb('0x19')];var _0x8101cd=_0x1bda3e[_0x6edb('0x1e')](';');var _0x1f88b7=[];orderBy=0x0;for(var _0x44cfd3=0x0;_0x44cfd3<_0x8101cd['length'];_0x44cfd3++){_0x1f88b7[_0x6edb('0x1c')](splitAdditionalPhone(_0x221f41['id'],_0x8101cd[_0x44cfd3]));}Promise['all'](_0x1f88b7)['then'](function(){_0x509ea9({'val':_0x8101cd[_0x6edb('0x1b')]});});});}function splitAdditionalPhone(_0x1dd25d,_0xfff25f){return new Promise(function(_0xd9fbb2,_0xe66a75){var _0x2d7ca0=_0xfff25f[_0x6edb('0x1e')](':');var _0x3ce7d5=_0x2d7ca0[0x0];var _0x2c9c98=_0x2d7ca0[0x1];if(!_['isNil'](_0x2c9c98)){var _0x1344ba=_0x2c9c98[_0x6edb('0x1e')]('|');var _0x2e8776=[];for(var _0x49a9ef=0x0;_0x49a9ef<_0x1344ba[_0x6edb('0x1b')];_0x49a9ef++){if(_0x1344ba[_0x49a9ef]!==''){var _0x48056f=_['filter'](promisesAdditionalPhones,{'contactId':_0x1dd25d,'phone':_0x1344ba[_0x49a9ef]});if(_0x48056f[_0x6edb('0x1b')]==0x0){orderBy++;promisesAdditionalPhones['push']({'contactId':_0x1dd25d,'contactTypeId':_0x3ce7d5,'phone':_0x1344ba[_0x49a9ef],'orderBy':orderBy});}}}_0xd9fbb2({'ok':0x1});}else _0xd9fbb2({'res':0x0});});}function createAdditionalPhone(_0x5a0173,_0x4b1e33,_0x1b67c9,_0x479c35){var _0x1d15fa='';var _0x26d764='';var _0x17444e=_0x1b67c9[_0x6edb('0x1e')]('§');_0x1d15fa=_0x17444e[0x0];if(_0x17444e['length']==0x2)_0x26d764=_0x17444e[0x1];return new Promise(function(_0x54666d,_0x29e952){return db[_0x6edb('0x1f')][_0x6edb('0x20')]({'where':{'CmContactId':_0x5a0173,'item':_0x1d15fa}})[_0x6edb('0x1a')](function(_0x41a0f3){if(_0x41a0f3){return db[_0x6edb('0x1f')][_0x6edb('0x21')]({'ItemTypeId':_0x4b1e33,'description':_0x26d764,'OrderBy':_0x479c35},{'where':{'CmContactId':_0x5a0173,'item':_0x1d15fa}})[_0x6edb('0x1a')](function(_0x5b54ef){_0x54666d({'res':_0x6edb('0x22')});});}else{return db[_0x6edb('0x1f')][_0x6edb('0x23')]({'CmContactId':_0x5a0173,'item':_0x1d15fa,'description':_0x26d764,'ItemTypeId':_0x4b1e33,'OrderBy':_0x479c35,'ItemClass':_0x6edb('0x24')})['then'](function(_0x5d6387){_0x54666d({'res':_0x6edb('0x25')});});}});});}function insertCmHopper(_0x50ad47,_0x112274,_0x3461fb,_0x5a7a73,_0xb2a8b5){var _0x3c8b90=[_0x6edb('0x26'),_0x6edb('0x27'),_0x6edb('0x28'),_0x6edb('0x29'),_0x112274+'.'+_0x5a7a73,'cm_contacts.createdAt',_0x6edb('0x2a'),_0x6edb('0x2b'),_0x6edb('0x2c'),'\x22'+_0xb2a8b5+'\x22'];return squel['insert']()[_0x6edb('0x2d')](_0x6edb('0x2e'))[_0x6edb('0x2f')]([_0x6edb('0x11'),'scheduledat',_0x6edb('0x30'),_0x6edb('0x31'),_0x5a7a73,_0x6edb('0x32'),_0x6edb('0x33'),_0x6edb('0x34'),_0x6edb('0x35'),'recallme'],squel['select']()[_0x6edb('0x36')](_0x3c8b90)[_0x6edb('0x37')](_0x112274)[_0x6edb('0x12')]('cm_contacts',null,_0x6edb('0x38')+_0x112274+'.CmListId')[_0x6edb('0x12')](_0x3461fb,null,_0x3461fb+_0x6edb('0x13')+_0x112274+'.'+_0x5a7a73)[_0x6edb('0x14')](_0x112274+_0x6edb('0x39'),_0x50ad47)[_0x6edb('0x14')]('cm_contacts.createdAt\x20=\x20?',NOW)[_0x6edb('0x14')](_0x6edb('0x3a'),selectNotIn(_0x112274,_0x3461fb,_0x5a7a73,'cm_hopper',['\x22always\x22',_0x6edb('0x3b')]))['where'](_0x6edb('0x3a'),selectNotIn(_0x112274,_0x3461fb,_0x5a7a73,_0x6edb('0x2e'),[_0x6edb('0x3c')])))['toString']();}function insertCmHopperBlack(_0x32a90e,_0x2f3be4,_0x3c3f76,_0x447803){var _0x16d8fa=[_0x6edb('0x26'),_0x6edb('0x28'),_0x6edb('0x29'),_0x2f3be4+'.'+_0x447803,_0x6edb('0x3d'),_0x6edb('0x2a')];return squel[_0x6edb('0x3e')]()['into'](_0x6edb('0x3f'))['fromQuery']([_0x6edb('0x11'),_0x6edb('0x30'),_0x6edb('0x31'),_0x447803,'createdAt',_0x6edb('0x33')],squel['select']()[_0x6edb('0x36')](_0x16d8fa)[_0x6edb('0x37')](_0x2f3be4)[_0x6edb('0x12')](_0x6edb('0x40'),null,_0x6edb('0x38')+_0x2f3be4+_0x6edb('0x41'))[_0x6edb('0x12')](_0x3c3f76,null,_0x3c3f76+_0x6edb('0x13')+_0x2f3be4+'.'+_0x447803)[_0x6edb('0x14')](_0x2f3be4+'.CmListId\x20=\x20?',_0x32a90e)[_0x6edb('0x14')](_0x6edb('0x42'),NOW)[_0x6edb('0x14')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',squel[_0x6edb('0xf')]()[_0x6edb('0x10')](_0x6edb('0x11'))[_0x6edb('0x37')](_0x6edb('0x3f'))[_0x6edb('0x14')](_0x6edb('0x43'),_0x32a90e)[_0x6edb('0x14')](_0x447803+_0x6edb('0x15')+_0x2f3be4+'.'+_0x447803)))[_0x6edb('0x44')]();}function insertTzCmHopper(_0x4866dd,_0x33074e,_0xa56df5,_0x3438ea,_0x4d8812,_0x2f7494){var _0x5db5d4=[_0x6edb('0x26'),_0x6edb('0x45')+_0x2f7494+_0x6edb('0x46'),'cm_contacts.id','cm_contacts.ListId',_0x33074e+'.'+_0x3438ea,_0x6edb('0x3d'),'cm_contacts.updatedAt',_0x6edb('0x2b'),_0x6edb('0x2c'),'\x22'+_0x4d8812+'\x22'];var _0x15ee24=squel[_0x6edb('0x3e')]()[_0x6edb('0x2d')](_0x6edb('0x2e'))['fromQuery'](['phone',_0x6edb('0x47'),_0x6edb('0x30'),_0x6edb('0x31'),_0x3438ea,'createdAt','updatedAt','priority',_0x6edb('0x35'),_0x6edb('0x48')],squel[_0x6edb('0xf')]()[_0x6edb('0x36')](_0x5db5d4)['from'](_0x33074e)[_0x6edb('0x12')]('cm_contacts',null,_0x6edb('0x38')+_0x33074e+_0x6edb('0x41'))[_0x6edb('0x12')](_0xa56df5,null,_0xa56df5+_0x6edb('0x13')+_0x33074e+'.'+_0x3438ea)[_0x6edb('0x12')](_0x2f7494,null,_0x2f7494+'.id\x20=\x20'+_0x33074e+'.'+_0x3438ea)[_0x6edb('0x14')](_0x33074e+_0x6edb('0x39'),_0x4866dd)[_0x6edb('0x14')](_0x6edb('0x42'),NOW)[_0x6edb('0x14')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x33074e,_0xa56df5,_0x3438ea,'cm_hopper',[_0x6edb('0x3c'),'\x22onlyIfOpen\x22']))[_0x6edb('0x14')](_0x6edb('0x3a'),selectNotIn(_0x33074e,_0xa56df5,_0x3438ea,'cm_hopper',['\x22always\x22'])))[_0x6edb('0x44')]();return _0x15ee24;}function insertTzCmHopperBlack(_0x39d2dd,_0x576592,_0x3bc5d3,_0x32732e){var _0x5eafe4=[_0x6edb('0x26'),_0x6edb('0x28'),_0x6edb('0x29'),_0x576592+'.'+_0x32732e,'cm_contacts.createdAt','cm_contacts.updatedAt'];return squel[_0x6edb('0x3e')]()['into']('cm_hopper_black')[_0x6edb('0x2f')](['phone',_0x6edb('0x30'),'ListId',_0x32732e,_0x6edb('0x32'),_0x6edb('0x33')],squel[_0x6edb('0xf')]()[_0x6edb('0x36')](_0x5eafe4)[_0x6edb('0x37')](_0x576592)['join'](_0x6edb('0x40'),null,_0x6edb('0x38')+_0x576592+_0x6edb('0x41'))[_0x6edb('0x12')](_0x3bc5d3,null,_0x3bc5d3+'.id\x20=\x20'+_0x576592+'.'+_0x32732e)[_0x6edb('0x14')](_0x576592+_0x6edb('0x39'),_0x39d2dd)[_0x6edb('0x14')](_0x6edb('0x42'),NOW)[_0x6edb('0x14')](_0x6edb('0x3a'),squel[_0x6edb('0xf')]()['field'](_0x6edb('0x11'))[_0x6edb('0x37')](_0x6edb('0x3f'))[_0x6edb('0x14')]('ListId\x20=\x20?',_0x39d2dd)[_0x6edb('0x14')](_0x32732e+_0x6edb('0x15')+_0x576592+'.'+_0x32732e)))[_0x6edb('0x44')]();}function insertCmHopperAdditionalPhones(_0x41ed21){var _0x1da4df=[_0x6edb('0x49'),'cm_contact_has_items.item',_0x6edb('0x4a'),_0x6edb('0x4b'),_0x6edb('0x4c')];return squel['insert']()[_0x6edb('0x2d')](_0x6edb('0x4d'))[_0x6edb('0x2f')](['CmHopperId',_0x6edb('0x11'),'OrderBy',_0x6edb('0x32'),_0x6edb('0x33')],squel[_0x6edb('0xf')]()['fields'](_0x1da4df)[_0x6edb('0x37')](_0x6edb('0x2e'))[_0x6edb('0x12')](_0x6edb('0x40'),null,_0x6edb('0x4e'))['join']('cm_contact_has_items',null,_0x6edb('0x4f'))['where']('cm_hopper.ListId\x20=\x20?',_0x41ed21)[_0x6edb('0x14')](_0x6edb('0x42'),NOW))[_0x6edb('0x44')]();}function insertCmContact(_0x2aa0e3,_0x5114f3,_0x38ea9e,_0xf424ce){var _0x289ca7=_[_0x6edb('0x50')](_[_0x6edb('0x51')](_0xf424ce),['ListId',_0x6edb('0x52'),_0x6edb('0x32'),_0x6edb('0x33'),'scheduledAt']);return squel[_0x6edb('0x3e')]()[_0x6edb('0x2d')](_0x6edb('0x40'))['fromQuery'](_0x289ca7,squel[_0x6edb('0xf')]()[_0x6edb('0x36')](_0x289ca7)[_0x6edb('0x37')](_0x5114f3)['where']('('+_0x38ea9e[_0x6edb('0x12')](',')+_0x6edb('0x53'),squel[_0x6edb('0xf')]()[_0x6edb('0x36')](_0x38ea9e)[_0x6edb('0x37')]('cm_contacts')[_0x6edb('0x14')]('ListId\x20=\x20?',_0x2aa0e3)[_0x6edb('0x14')](_0x6edb('0x54')))[_0x6edb('0x14')](_0x6edb('0x55'),squel[_0x6edb('0xf')]()['field'](_0x6edb('0x56'),'min_id')[_0x6edb('0x37')](_0x5114f3)[_0x6edb('0x57')](_0x38ea9e[_0x6edb('0x12')](','))))[_0x6edb('0x44')]();}function handleStop(){logger[_0x6edb('0x58')](_0x6edb('0x59'));stopped=!![];}function handleUncaughtException(_0x32cd17){logger[_0x6edb('0x5a')](_0x32cd17[_0x6edb('0x5b')]);process[_0x6edb('0x5c')](0x1);}function handleError(_0x1cde70,_0x23086d){stats[_0x6edb('0x5d')]['push']({'name':_0x23086d['code'],'message':_0x23086d[_0x6edb('0x5b')],'row':_0x1cde70});}function handleQuery(_0x4f2f52){logger[_0x6edb('0x58')](_0x4f2f52);return db[_0x6edb('0x5e')][_0x6edb('0x5f')](_0x4f2f52)[_0x6edb('0x60')](function(_0x59bfc3){results[_0x6edb('0x1c')](_0x59bfc3);})[_0x6edb('0x61')](function(_0x317390){logger[_0x6edb('0x5a')](_0x317390['message']);});}function updateTzCampaigns(_0x2fc660){return new Promise(function(_0x151d45,_0x33b353){var _0x5120f8=squel[_0x6edb('0xf')]()[_0x6edb('0x36')]([_0x6edb('0x62'),_0x6edb('0x63')])[_0x6edb('0x37')](_0x6edb('0x64'))['join']('campaigns_has_cm_lists',null,_0x6edb('0x65'))[_0x6edb('0x14')](_0x6edb('0x66')+_0x2fc660);db[_0x6edb('0x5e')][_0x6edb('0x5f')](_0x5120f8[_0x6edb('0x44')]())[_0x6edb('0x60')](function(_0x41ea90){var _0xfdb546=[];for(var _0xc7cef0=0x0;_0xc7cef0<_0x41ea90['length'];_0xc7cef0++){_0xfdb546[_0x6edb('0x1c')](getTimezoneData(_0x41ea90[_0xc7cef0],tmp_campaigns));}BPromise[_0x6edb('0x1d')](_0xfdb546)[_0x6edb('0x1a')](function(){_0x151d45({'val':0x1});});})[_0x6edb('0x61')](function(_0x1861cf){logger[_0x6edb('0x5a')](_0x1861cf[_0x6edb('0x5b')]);_0x151d45({'val':0x0});});});}function updateTzVoiceQueues(_0x1c97a7){return new Promise(function(_0x43cc03,_0x500683){var _0x18340b=squel[_0x6edb('0xf')]()[_0x6edb('0x36')]([_0x6edb('0x67'),_0x6edb('0x68')])[_0x6edb('0x37')]('voice_queues')[_0x6edb('0x12')](_0x6edb('0x69'),null,_0x6edb('0x6a'))[_0x6edb('0x14')](_0x6edb('0x6b')+_0x1c97a7);db[_0x6edb('0x5e')]['query'](_0x18340b[_0x6edb('0x44')]())['spread'](function(_0x3d6622){var _0x5d6101=[];for(var _0x4a6b79=0x0;_0x4a6b79<_0x3d6622['length'];_0x4a6b79++){_0x5d6101[_0x6edb('0x1c')](getTimezoneData(_0x3d6622[_0x4a6b79],tmp_voice_queues));}BPromise[_0x6edb('0x1d')](_0x5d6101)[_0x6edb('0x1a')](function(){_0x43cc03({'val':0x1});});})[_0x6edb('0x61')](function(_0x31354e){logger[_0x6edb('0x5a')](_0x31354e[_0x6edb('0x5b')]);_0x43cc03({'val':0x0});});});}function getTimezoneData(_0x36400c,_0x105ec6){return new Promise(function(_0x303c63,_0x5bde67){var _0x19c5e4=shared[_0x6edb('0x6c')];var _0xd2eca6=_0x19c5e4[_0x36400c[_0x6edb('0x6d')]];if(_[_0x6edb('0x6e')](_0xd2eca6)){_0x303c63({'ret':0x1});}else{var _0x22c269=_0xd2eca6[_0x6edb('0x6f')];var _0x28ed9d=squel[_0x6edb('0x3e')]()[_0x6edb('0x2d')](_0x105ec6)['set']('id',_0x36400c['id'])[_0x6edb('0x70')]('offset',_0x22c269)['set'](_0x6edb('0x6d'),_0x36400c[_0x6edb('0x6d')])[_0x6edb('0x44')]();return db[_0x6edb('0x5e')]['query'](_0x28ed9d)[_0x6edb('0x60')](function(_0x380ac2){_0x303c63({'ret':0x1});})[_0x6edb('0x61')](function(_0x49f94f){logger['error'](_0x49f94f[_0x6edb('0x5b')]);_0x5bde67({'ret':0x1});});}});}function handleTZQuery(_0x35e6c4){logger[_0x6edb('0x58')](_0x35e6c4);return db[_0x6edb('0x5e')][_0x6edb('0x5f')](_0x35e6c4)[_0x6edb('0x60')](function(_0x208058){})[_0x6edb('0x61')](function(_0x4b9027){logger['error'](_0x4b9027['message']);});}function main(_0x4b36d4,_0x46de3a,_0x162ae7,_0x469c10){logger[_0x6edb('0x58')]('main',_0x4b36d4,JSON['stringify'](_0x46de3a));process[_0x6edb('0x71')](_0x6edb('0x72'));var _0x44d730=_0x46de3a[_0x6edb('0x73')];var _0x3eefff=_[_0x6edb('0x74')](_0x44d730);var _0x1f42f6=_0x46de3a[_0x6edb('0x75')];var _0x137187=path[_0x6edb('0x12')](config[_0x6edb('0x76')],_0x6edb('0x77'),_0x1f42f6+_0x6edb('0x78'));hasTZ=_[_0x6edb('0x51')](_0x44d730)[_0x6edb('0x79')](_0x6edb('0x6d'));var _0x59fcb7=_[_0x6edb('0x51')](_0x44d730)['join']();logger['info'](_0x6edb('0x7a'),_0x59fcb7);db[_0x6edb('0x7b')][_0x6edb('0x18')]({'raw':!![],'attributes':['id',_0x6edb('0x7c')]})[_0x6edb('0x1a')](function(_0x34409e){for(var _0x45a819=0x0;_0x45a819<_0x34409e[_0x6edb('0x1b')];_0x45a819++){if(_0x34409e[_0x45a819][_0x6edb('0x7c')]in _0x44d730){contactItemTypes[_0x6edb('0x1c')](_0x34409e[_0x45a819]);delete _0x3eefff[_0x34409e[_0x45a819][_0x6edb('0x7c')]];hasAdditionalPhones=!![];}for(var _0x2360c0 in _0x44d730){if(_0x34409e[_0x45a819][_0x6edb('0x7c')]+'_description'===_0x2360c0){phoneDescriptions[_0x6edb('0x1c')]({'itemTypeId':_0x34409e[_0x45a819]['id'],'description':_0x2360c0});delete _0x3eefff[_0x2360c0];}}}if(hasAdditionalPhones)_0x3eefff[_0x6edb('0x19')]='';var _0x2cc610=_[_0x6edb('0x51')](_0x3eefff)[_0x6edb('0x12')]();logger['info'](_0x6edb('0x7a'),_0x2cc610);fs[_0x6edb('0x7d')](_0x137187,_0x2cc610+'\x0a');Papa[_0x6edb('0x7e')](fs[_0x6edb('0x7f')](_0x4b36d4),{'header':!![],'skipEmptyLines':!![],'step':function(_0x592213,_0x35d68e){try{for(var _0x385191=0x0,_0x4fc336=[];_0x385191<_0x592213[_0x6edb('0x80')][_0x6edb('0x1b')];_0x385191++){stats[_0x6edb('0x81')]+=0x1;if(_0x592213[_0x6edb('0x5d')][_0x385191]){handleError(_0x592213[_0x6edb('0x80')][_0x385191],_0x592213['errors'][_0x385191]);}else{var _0x4d3618=[];var _0x30d9be=[];var _0x133b56={};for(var _0x47005 in _0x44d730){let _0x195cee=contactItemTypes[_0x6edb('0x82')](_0x7aac8b=>_0x7aac8b[_0x6edb('0x7c')]===_0x47005);let _0x1899aa=contactItemTypes[_0x6edb('0x82')](_0x1a8690=>_0x1a8690[_0x6edb('0x7c')]+'_description'===_0x47005);if(_[_0x6edb('0x6e')](_0x195cee)&&_[_0x6edb('0x6e')](_0x1899aa)){if(_0x44d730[_0x6edb('0x83')](_0x47005)){if(_0x592213['data'][_0x385191][_0x44d730[_0x47005]]){var _0x58878c=_[_0x6edb('0x84')](_0x592213['data'][_0x385191][_0x44d730[_0x47005]][_0x6edb('0x85')](/"/g,'\x27'));switch(_0x47005){case _0x6edb('0x47'):var _0x31067d=moment(_0x58878c,'YYYY-MM-DD\x20HH:mm:ss',!![]);if(_0x31067d['isValid']()){_0x4fc336[_0x6edb('0x1c')]('\x22'+_0x58878c+'\x22');}else{_0x4d3618[_0x6edb('0x1c')](_0x6edb('0x86'));}break;case _0x6edb('0x34'):var _0x59ad84=parseInt(_0x58878c);_0x58878c=_[_0x6edb('0x87')](_0x59ad84)||_0x59ad84<0x0||_0x59ad84>0x4?_0x469c10?0x3:0x2:_0x59ad84;_0x4fc336[_0x6edb('0x1c')]('\x22'+_0x58878c+'\x22');break;case'UserId':var _0x56d071=parseInt(_0x58878c);if(_['isNumber'](_0x56d071)&&_[_0x6edb('0x79')](_0x162ae7,_0x56d071)){_0x4fc336[_0x6edb('0x1c')]('\x22'+_0x56d071+'\x22');}else{_0x4d3618[_0x6edb('0x1c')](_0x6edb('0x88'));}break;case _0x6edb('0x89'):if(isEmail(_0x58878c)){_0x4fc336[_0x6edb('0x1c')]('\x22'+_0x58878c+'\x22');}else{_0x4d3618[_0x6edb('0x1c')](_0x6edb('0x8a'));}break;case _0x6edb('0x8b'):var _0x2ee2db=moment(_0x58878c,_0x6edb('0x8c'),!![]);if(_0x2ee2db[_0x6edb('0x8d')]()){_0x4fc336[_0x6edb('0x1c')]('\x22'+_0x58878c+'\x22');}else{_0x4d3618[_0x6edb('0x1c')](_0x6edb('0x8e'));}break;case _0x6edb('0x6d'):var _0x5e887b=shared['timezones'];var _0x104283=_0x5e887b[_0x58878c];if(!_[_0x6edb('0x6e')](_0x104283)){var _0x5da1ff=_0x104283[_0x6edb('0x6f')];_0x4fc336['push']('\x22'+_0x58878c+'\x22');_0x4fc336[_0x6edb('0x1c')]('\x22'+_0x5da1ff+'\x22');}break;default:_0x4fc336[_0x6edb('0x1c')]('\x22'+_0x58878c+'\x22');}}else{switch(_0x47005){case _0x6edb('0x8f'):case _0x6edb('0x11'):_0x4d3618[_0x6edb('0x1c')](_0x47005+_0x6edb('0x90'));break;default:_0x4fc336[_0x6edb('0x1c')]('\x22\x22');}}}}else{var _0x4cc6cd='';if(!_[_0x6edb('0x6e')](_0x195cee)){if(!_0x133b56[_0x6edb('0x83')](_0x195cee['id'])){if(!_[_0x6edb('0x6e')](_0x592213[_0x6edb('0x80')][_0x385191][_0x44d730[_0x47005]])){var _0x58878c=_[_0x6edb('0x84')](_0x592213[_0x6edb('0x80')][_0x385191][_0x44d730[_0x47005]][_0x6edb('0x85')](/"/g,'\x27'));var _0x190705=phoneDescriptions[_0x6edb('0x82')](_0x1c8ab5=>_0x1c8ab5['itemTypeId']===_0x195cee['id']);if(!_[_0x6edb('0x6e')](_0x190705)){var _0x4f32d8=_['trim'](_0x592213[_0x6edb('0x80')][_0x385191][_0x44d730[_0x190705[_0x6edb('0x91')]]][_0x6edb('0x85')](/"/g,'\x27'));if(!_['isNil'](_0x4f32d8))_0x58878c=_0x58878c+'§'+_0x4f32d8;}if(_0x4cc6cd=='')_0x4cc6cd=_0x58878c;else _0x4cc6cd+='|'+_0x58878c;}_0x30d9be[_0x6edb('0x1c')](_0x195cee['id']+':'+_0x4cc6cd);_0x133b56[_0x195cee['id']]=0x1;}}}}if(hasAdditionalPhones){_0x4fc336[_0x6edb('0x1c')]('\x22'+_0x30d9be[_0x6edb('0x12')](';')+'\x22');}if(_0x4d3618[_0x6edb('0x1b')]){handleError(_0x592213[_0x6edb('0x80')][_0x385191],{'code':_0x6edb('0x92'),'message':_0x4d3618[_0x6edb('0x12')]()});}else{fs[_0x6edb('0x93')](_0x137187,_0x4fc336[_0x6edb('0x12')]()+'\x0a');}_0x4fc336=[];}if(!(stats[_0x6edb('0x81')]%0xc8)){socket['emit'](_0x6edb('0x94')+_0x1f42f6,stats);stats[_0x6edb('0x5d')]=[];}}if(stopped){logger['info'](_0x6edb('0x95'));_0x35d68e['abort']();}}catch(_0x4ac0f9){handleError(_0x592213['data'][_0x385191],{'code':_0x6edb('0x96'),'message':_0x4ac0f9['message']});logger[_0x6edb('0x5a')](_0x6edb('0x97'),_0x4ac0f9[_0x6edb('0x5b')]);}},'complete':function(){try{var _0x469356=[];var _0x80150b=[];var _0x277613=_0x6edb('0x40');if(_0x46de3a[_0x6edb('0x98')]&&_0x46de3a[_0x6edb('0x98')][_0x6edb('0x1b')]){_0x277613='cm_contacts_'+_0x1f42f6;_0x469356[_0x6edb('0x1c')](_0x6edb('0x99')+_0x277613+_0x6edb('0x9a'));}tmp_campaigns='campaigns_'+_0x1f42f6;tmp_voice_queues=_0x6edb('0x9b')+_0x1f42f6;_0x80150b['push'](_0x6edb('0x99')+tmp_campaigns+_0x6edb('0x9c'));_0x80150b[_0x6edb('0x1c')](_0x6edb('0x99')+tmp_voice_queues+_0x6edb('0x9c'));BPromise['each'](_0x80150b,handleTZQuery)[_0x6edb('0x1a')](function(_0x21b8e7){updateTzCampaigns(_0x46de3a['ListId'])[_0x6edb('0x1a')](function(_0x2ce1ab){updateTzVoiceQueues(_0x46de3a[_0x6edb('0x31')])['then'](function(_0x3a69e9){if(hasTZ)_0x2cc610=_0x2cc610[_0x6edb('0x85')](_0x6edb('0x6d'),_0x6edb('0x9d'));var _0x48fce3=util['format'](_0x6edb('0x9e'),_0x137187,_0x277613,_0x2cc610,_0x46de3a[_0x6edb('0x31')],_0x46de3a[_0x6edb('0x52')]||null,NOW,NOW);if(_[_0x6edb('0x6e')](_0x44d730[_0x6edb('0x47')])){_0x48fce3+=_0x6edb('0x9f');}_0x469356[_0x6edb('0x1c')](_0x48fce3);if(_0x46de3a['duplicates']&&_0x46de3a[_0x6edb('0x98')][_0x6edb('0x1b')]){_0x469356['push'](insertCmContact(_0x46de3a[_0x6edb('0x31')],_0x277613,_0x46de3a[_0x6edb('0x98')],_0x44d730));_0x469356['push'](_0x6edb('0xa0')+_0x277613+';');}BPromise[_0x6edb('0xa1')](_0x469356,handleQuery)[_0x6edb('0x1a')](function(_0x1b2a04){BPromise[_0x6edb('0x1d')]([handleAdditionalPhones()])[_0x6edb('0x1a')](function(){_0x469356=[];for(var _0x1fdf6e=0x0;_0x1fdf6e\x20\x20','existsSync','file\x20doesn\x27t\x20exists','binding\x20doesn\x27t\x20exists','phone\x20is\x20mandatory','firstName\x20is\x20mandatory','ListId\x20is\x20mandatory','body\x20id\x20mandatory','map','No\x20agent\x20available','SIGINT','uncaughtException','path','lodash','util','bluebird','ioredis','../../../mysqldb','../../../config/environment','../../../config/environment/shared','import','redis','defaults','localhost','format','YYYY-MM-DD\x20HH:mm:ss','test','select','field','phone','from','join','.id\x20=\x20','where','\x20=\x20','CmContact','findAll','AdditionalPhones','then','push','all','split','length','CmContactHasItem','findOne','update','updated','create','PHONE','inserted','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.createdAt','cm_contacts.updatedAt','cm_contacts.priority','cm_contacts.UserId','insert','into','fromQuery','scheduledat','ContactId','ListId','createdAt','updatedAt','recallme','fields','cm_contacts','cm_contacts.ListId\x20=\x20','.CmListId','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','cm_hopper'];(function(_0x2a1426,_0x3ed908){var _0x3a988e=function(_0x3240b5){while(--_0x3240b5){_0x2a1426['push'](_0x2a1426['shift']());}};_0x3a988e(++_0x3ed908);}(_0xa8bd,0x139));var _0xda8b=function(_0x67a3a6,_0x48c601){_0x67a3a6=_0x67a3a6-0x0;var _0x2fc8b5=_0xa8bd[_0x67a3a6];return _0x2fc8b5;};'use strict';var fs=require('fs');var path=require(_0xda8b('0x0'));var _=require(_0xda8b('0x1'));var Papa=require('papaparse');var util=require(_0xda8b('0x2'));var BPromise=require(_0xda8b('0x3'));var moment=require('moment');var squel=require('squel');var Redis=require(_0xda8b('0x4'));var db=require(_0xda8b('0x5'))['db'];var config=require(_0xda8b('0x6'));var shared=require(_0xda8b('0x7'));var logger=require('../../../config/logger')(_0xda8b('0x8'));config[_0xda8b('0x9')]=_[_0xda8b('0xa')](config['redis'],{'host':_0xda8b('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xda8b('0x9')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var orderBy=0x0;var stopped=![];var NOW=moment()[_0xda8b('0xc')](_0xda8b('0xd'));var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];var tmp_voice_queues;var tmp_campaigns;var tzOffset=0x0;var hasTZ;var NOW=moment()['format'](_0xda8b('0xd'));function isEmail(_0x250f93){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))*$/[_0xda8b('0xe')](_0x250f93);}function selectNotIn(_0x1d6ff7,_0x4dd2a1,_0x3f8ade,_0x120846,_0x14d199){return squel[_0xda8b('0xf')]()[_0xda8b('0x10')](_0xda8b('0x11'))[_0xda8b('0x12')](_0x120846)[_0xda8b('0x13')](_0x4dd2a1,null,_0x4dd2a1+_0xda8b('0x14')+_0x120846+'.'+_0x3f8ade)[_0xda8b('0x15')](_0x120846+'.'+_0x3f8ade+_0xda8b('0x16')+_0x1d6ff7+'.'+_0x3f8ade)[_0xda8b('0x15')](_0x4dd2a1+'.dialCheckDuplicateType\x20IN\x20('+_0x14d199[_0xda8b('0x13')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0x4e9115,_0x222dfd){promisesAdditionalPhones=[];return db[_0xda8b('0x17')][_0xda8b('0x18')]({'raw':!![],'attributes':['id',_0xda8b('0x19')],'where':{'createdAt':NOW,'AdditionalPhones':{'$ne':null}}})[_0xda8b('0x1a')](function(_0x44b094){if(_0x44b094!==null){var _0x1f1cb7=[];for(var _0x354347=0x0;_0x354347<_0x44b094['length'];_0x354347++){var _0x50e815=_0x44b094[_0x354347];_0x1f1cb7[_0xda8b('0x1b')](insertAdditionalPhones(_0x50e815));}}Promise[_0xda8b('0x1c')](_0x1f1cb7)[_0xda8b('0x1a')](function(){_0x4e9115({'val':0x1});});});});}function insertAdditionalPhones(_0x188d86){return new Promise(function(_0x410199,_0x169134){var _0x33f1a6=_0x188d86[_0xda8b('0x19')];var _0x15adec=_0x33f1a6[_0xda8b('0x1d')](';');var _0x267727=[];orderBy=0x0;for(var _0x35cd95=0x0;_0x35cd95<_0x15adec[_0xda8b('0x1e')];_0x35cd95++){_0x267727[_0xda8b('0x1b')](splitAdditionalPhone(_0x188d86['id'],_0x15adec[_0x35cd95]));}Promise['all'](_0x267727)[_0xda8b('0x1a')](function(){_0x410199({'val':_0x15adec['length']});});});}function splitAdditionalPhone(_0x266ee6,_0x1780f5){return new Promise(function(_0x371bb2,_0x956596){var _0x802c69=_0x1780f5[_0xda8b('0x1d')](':');var _0x30c6f1=_0x802c69[0x0];var _0x22da2b=_0x802c69[0x1];if(!_['isNil'](_0x22da2b)){var _0x13056c=_0x22da2b[_0xda8b('0x1d')]('|');var _0x58c024=[];for(var _0x473b61=0x0;_0x473b61<_0x13056c[_0xda8b('0x1e')];_0x473b61++){if(_0x13056c[_0x473b61]!==''){var _0x14fe34=_['filter'](promisesAdditionalPhones,{'contactId':_0x266ee6,'phone':_0x13056c[_0x473b61]});if(_0x14fe34[_0xda8b('0x1e')]==0x0){orderBy++;promisesAdditionalPhones[_0xda8b('0x1b')]({'contactId':_0x266ee6,'contactTypeId':_0x30c6f1,'phone':_0x13056c[_0x473b61],'orderBy':orderBy});}}}_0x371bb2({'ok':0x1});}else _0x371bb2({'res':0x0});});}function createAdditionalPhone(_0x39a0cc,_0x4b6d9d,_0x50b1fd,_0x53dbf5){var _0x2405ac='';var _0x1eabc9='';var _0x3e0172=_0x50b1fd['split']('§');_0x2405ac=_0x3e0172[0x0];if(_0x3e0172[_0xda8b('0x1e')]==0x2)_0x1eabc9=_0x3e0172[0x1];return new Promise(function(_0x5ec7cd,_0x236a63){return db[_0xda8b('0x1f')][_0xda8b('0x20')]({'where':{'CmContactId':_0x39a0cc,'item':_0x2405ac}})['then'](function(_0x1b84cc){if(_0x1b84cc){return db[_0xda8b('0x1f')][_0xda8b('0x21')]({'ItemTypeId':_0x4b6d9d,'description':_0x1eabc9,'OrderBy':_0x53dbf5},{'where':{'CmContactId':_0x39a0cc,'item':_0x2405ac}})[_0xda8b('0x1a')](function(_0x4023ca){_0x5ec7cd({'res':_0xda8b('0x22')});});}else{return db[_0xda8b('0x1f')][_0xda8b('0x23')]({'CmContactId':_0x39a0cc,'item':_0x2405ac,'description':_0x1eabc9,'ItemTypeId':_0x4b6d9d,'OrderBy':_0x53dbf5,'ItemClass':_0xda8b('0x24')})[_0xda8b('0x1a')](function(_0x1d9ee5){_0x5ec7cd({'res':_0xda8b('0x25')});});}});});}function insertCmHopper(_0xd90fad,_0x370ee1,_0x1d559d,_0x4d2bef,_0x14144a){var _0x23a440=[_0xda8b('0x26'),_0xda8b('0x27'),'cm_contacts.id','cm_contacts.ListId',_0x370ee1+'.'+_0x4d2bef,_0xda8b('0x28'),_0xda8b('0x29'),_0xda8b('0x2a'),_0xda8b('0x2b'),'\x22'+_0x14144a+'\x22'];return squel[_0xda8b('0x2c')]()[_0xda8b('0x2d')]('cm_hopper')[_0xda8b('0x2e')]([_0xda8b('0x11'),_0xda8b('0x2f'),_0xda8b('0x30'),_0xda8b('0x31'),_0x4d2bef,_0xda8b('0x32'),_0xda8b('0x33'),'priority','UserId',_0xda8b('0x34')],squel[_0xda8b('0xf')]()[_0xda8b('0x35')](_0x23a440)[_0xda8b('0x12')](_0x370ee1)['join'](_0xda8b('0x36'),null,_0xda8b('0x37')+_0x370ee1+_0xda8b('0x38'))[_0xda8b('0x13')](_0x1d559d,null,_0x1d559d+_0xda8b('0x14')+_0x370ee1+'.'+_0x4d2bef)['where'](_0x370ee1+_0xda8b('0x39'),_0xd90fad)[_0xda8b('0x15')](_0xda8b('0x3a'),NOW)[_0xda8b('0x15')](_0xda8b('0x3b'),selectNotIn(_0x370ee1,_0x1d559d,_0x4d2bef,_0xda8b('0x3c'),[_0xda8b('0x3d'),'\x22onlyIfOpen\x22']))[_0xda8b('0x15')](_0xda8b('0x3b'),selectNotIn(_0x370ee1,_0x1d559d,_0x4d2bef,'cm_hopper',['\x22always\x22'])))[_0xda8b('0x3e')]();}function insertCmHopperBlack(_0x21e291,_0x663416,_0x2d759d,_0x3b1329){var _0x4cf365=[_0xda8b('0x26'),_0xda8b('0x3f'),_0xda8b('0x40'),_0x663416+'.'+_0x3b1329,'cm_contacts.createdAt',_0xda8b('0x29')];return squel['insert']()[_0xda8b('0x2d')](_0xda8b('0x41'))[_0xda8b('0x2e')]([_0xda8b('0x11'),_0xda8b('0x30'),_0xda8b('0x31'),_0x3b1329,_0xda8b('0x32'),'updatedAt'],squel['select']()[_0xda8b('0x35')](_0x4cf365)[_0xda8b('0x12')](_0x663416)[_0xda8b('0x13')](_0xda8b('0x36'),null,_0xda8b('0x37')+_0x663416+_0xda8b('0x38'))[_0xda8b('0x13')](_0x2d759d,null,_0x2d759d+_0xda8b('0x14')+_0x663416+'.'+_0x3b1329)[_0xda8b('0x15')](_0x663416+'.CmListId\x20=\x20?',_0x21e291)[_0xda8b('0x15')](_0xda8b('0x3a'),NOW)[_0xda8b('0x15')](_0xda8b('0x3b'),squel[_0xda8b('0xf')]()[_0xda8b('0x10')]('phone')[_0xda8b('0x12')](_0xda8b('0x41'))[_0xda8b('0x15')]('ListId\x20=\x20?',_0x21e291)[_0xda8b('0x15')](_0x3b1329+_0xda8b('0x16')+_0x663416+'.'+_0x3b1329)))[_0xda8b('0x3e')]();}function insertTzCmHopper(_0x2e59e7,_0x7fa720,_0x29eff4,_0x474fe2,_0x5d453d,_0x33fe7e){var _0x4cce07=[_0xda8b('0x26'),_0xda8b('0x42')+_0x33fe7e+_0xda8b('0x43'),'cm_contacts.id',_0xda8b('0x40'),_0x7fa720+'.'+_0x474fe2,_0xda8b('0x28'),_0xda8b('0x29'),_0xda8b('0x2a'),'cm_contacts.UserId','\x22'+_0x5d453d+'\x22'];var _0x3bd9c8=squel[_0xda8b('0x2c')]()[_0xda8b('0x2d')](_0xda8b('0x3c'))[_0xda8b('0x2e')]([_0xda8b('0x11'),_0xda8b('0x2f'),_0xda8b('0x30'),_0xda8b('0x31'),_0x474fe2,'createdAt',_0xda8b('0x33'),_0xda8b('0x44'),_0xda8b('0x45'),_0xda8b('0x34')],squel[_0xda8b('0xf')]()[_0xda8b('0x35')](_0x4cce07)[_0xda8b('0x12')](_0x7fa720)['join'](_0xda8b('0x36'),null,_0xda8b('0x37')+_0x7fa720+'.CmListId')['join'](_0x29eff4,null,_0x29eff4+'.id\x20=\x20'+_0x7fa720+'.'+_0x474fe2)[_0xda8b('0x13')](_0x33fe7e,null,_0x33fe7e+'.id\x20=\x20'+_0x7fa720+'.'+_0x474fe2)[_0xda8b('0x15')](_0x7fa720+_0xda8b('0x39'),_0x2e59e7)[_0xda8b('0x15')](_0xda8b('0x3a'),NOW)[_0xda8b('0x15')](_0xda8b('0x3b'),selectNotIn(_0x7fa720,_0x29eff4,_0x474fe2,_0xda8b('0x3c'),['\x22always\x22',_0xda8b('0x46')]))['where'](_0xda8b('0x3b'),selectNotIn(_0x7fa720,_0x29eff4,_0x474fe2,_0xda8b('0x3c'),[_0xda8b('0x3d')])))[_0xda8b('0x3e')]();return _0x3bd9c8;}function insertTzCmHopperBlack(_0x2ea55b,_0x42d23b,_0x544ad7,_0x572d8c){var _0x33d766=['cm_contacts.phone','cm_contacts.id',_0xda8b('0x40'),_0x42d23b+'.'+_0x572d8c,'cm_contacts.createdAt',_0xda8b('0x29')];return squel['insert']()[_0xda8b('0x2d')](_0xda8b('0x41'))[_0xda8b('0x2e')]([_0xda8b('0x11'),_0xda8b('0x30'),_0xda8b('0x31'),_0x572d8c,_0xda8b('0x32'),_0xda8b('0x33')],squel[_0xda8b('0xf')]()[_0xda8b('0x35')](_0x33d766)[_0xda8b('0x12')](_0x42d23b)[_0xda8b('0x13')](_0xda8b('0x36'),null,'cm_contacts.ListId\x20=\x20'+_0x42d23b+_0xda8b('0x38'))['join'](_0x544ad7,null,_0x544ad7+_0xda8b('0x14')+_0x42d23b+'.'+_0x572d8c)['where'](_0x42d23b+_0xda8b('0x39'),_0x2ea55b)[_0xda8b('0x15')](_0xda8b('0x3a'),NOW)[_0xda8b('0x15')](_0xda8b('0x3b'),squel[_0xda8b('0xf')]()['field'](_0xda8b('0x11'))[_0xda8b('0x12')](_0xda8b('0x41'))[_0xda8b('0x15')](_0xda8b('0x47'),_0x2ea55b)[_0xda8b('0x15')](_0x572d8c+_0xda8b('0x16')+_0x42d23b+'.'+_0x572d8c)))['toString']();}function insertCmHopperAdditionalPhones(_0x532d13){var _0x499cfd=['cm_hopper.id',_0xda8b('0x48'),_0xda8b('0x49'),_0xda8b('0x4a'),_0xda8b('0x4b')];return squel[_0xda8b('0x2c')]()[_0xda8b('0x2d')](_0xda8b('0x4c'))[_0xda8b('0x2e')]([_0xda8b('0x4d'),_0xda8b('0x11'),_0xda8b('0x4e'),_0xda8b('0x32'),_0xda8b('0x33')],squel[_0xda8b('0xf')]()['fields'](_0x499cfd)[_0xda8b('0x12')](_0xda8b('0x3c'))[_0xda8b('0x13')]('cm_contacts',null,'cm_contacts.id\x20=\x20cm_hopper.ContactId')[_0xda8b('0x13')](_0xda8b('0x4f'),null,_0xda8b('0x50'))[_0xda8b('0x15')](_0xda8b('0x51'),_0x532d13)['where'](_0xda8b('0x3a'),NOW))[_0xda8b('0x3e')]();}function insertCmContact(_0x2a3c8c,_0x276385,_0x2b0f91,_0x2af7b7){var _0x3238a1=_['concat'](_[_0xda8b('0x52')](_0x2af7b7),[_0xda8b('0x31'),_0xda8b('0x53'),_0xda8b('0x32'),_0xda8b('0x33'),_0xda8b('0x54')]);return squel['insert']()['into'](_0xda8b('0x36'))[_0xda8b('0x2e')](_0x3238a1,squel[_0xda8b('0xf')]()[_0xda8b('0x35')](_0x3238a1)[_0xda8b('0x12')](_0x276385)[_0xda8b('0x15')]('('+_0x2b0f91[_0xda8b('0x13')](',')+_0xda8b('0x55'),squel[_0xda8b('0xf')]()[_0xda8b('0x35')](_0x2b0f91)[_0xda8b('0x12')]('cm_contacts')[_0xda8b('0x15')](_0xda8b('0x47'),_0x2a3c8c)[_0xda8b('0x15')](_0xda8b('0x56')))['where'](_0xda8b('0x57'),squel[_0xda8b('0xf')]()[_0xda8b('0x10')]('MIN(id)',_0xda8b('0x58'))[_0xda8b('0x12')](_0x276385)['group'](_0x2b0f91[_0xda8b('0x13')](','))))[_0xda8b('0x3e')]();}function handleStop(){logger[_0xda8b('0x59')](_0xda8b('0x5a'));stopped=!![];}function handleUncaughtException(_0x422764){logger[_0xda8b('0x5b')](_0x422764[_0xda8b('0x5c')]);process[_0xda8b('0x5d')](0x1);}function handleError(_0x484d9d,_0x24dd35){stats[_0xda8b('0x5e')][_0xda8b('0x1b')]({'name':_0x24dd35['code'],'message':_0x24dd35[_0xda8b('0x5c')],'row':_0x484d9d});}function handleQuery(_0x3b1475){logger[_0xda8b('0x59')](_0x3b1475);return db[_0xda8b('0x5f')]['query'](_0x3b1475)[_0xda8b('0x60')](function(_0x2dcceb){results[_0xda8b('0x1b')](_0x2dcceb);})['catch'](function(_0x780ee){logger[_0xda8b('0x5b')](_0x780ee['message']);});}function updateTzCampaigns(_0x25bebb){return new Promise(function(_0x5ea473,_0x189d6e){var _0x4270b3=squel[_0xda8b('0xf')]()[_0xda8b('0x35')]([_0xda8b('0x61'),_0xda8b('0x62')])['from'](_0xda8b('0x63'))[_0xda8b('0x13')](_0xda8b('0x64'),null,_0xda8b('0x65'))[_0xda8b('0x15')]('campaigns_has_cm_lists.CmListId='+_0x25bebb);db[_0xda8b('0x5f')][_0xda8b('0x66')](_0x4270b3[_0xda8b('0x3e')]())[_0xda8b('0x60')](function(_0x3e3bfd){var _0x565b38=[];for(var _0x274d92=0x0;_0x274d92<_0x3e3bfd['length'];_0x274d92++){_0x565b38[_0xda8b('0x1b')](getTimezoneData(_0x3e3bfd[_0x274d92],tmp_campaigns));}BPromise[_0xda8b('0x1c')](_0x565b38)[_0xda8b('0x1a')](function(){_0x5ea473({'val':0x1});});})[_0xda8b('0x67')](function(_0x17ab2a){logger[_0xda8b('0x5b')](_0x17ab2a[_0xda8b('0x5c')]);_0x5ea473({'val':0x0});});});}function updateTzVoiceQueues(_0xf07bce){return new Promise(function(_0x6301e6,_0x177aab){var _0x391e39=squel[_0xda8b('0xf')]()[_0xda8b('0x35')]([_0xda8b('0x68'),_0xda8b('0x69')])['from'](_0xda8b('0x6a'))[_0xda8b('0x13')](_0xda8b('0x6b'),null,_0xda8b('0x6c'))[_0xda8b('0x15')](_0xda8b('0x6d')+_0xf07bce);db[_0xda8b('0x5f')]['query'](_0x391e39[_0xda8b('0x3e')]())[_0xda8b('0x60')](function(_0x541f24){var _0x140900=[];for(var _0x205547=0x0;_0x205547<_0x541f24[_0xda8b('0x1e')];_0x205547++){_0x140900[_0xda8b('0x1b')](getTimezoneData(_0x541f24[_0x205547],tmp_voice_queues));}BPromise[_0xda8b('0x1c')](_0x140900)[_0xda8b('0x1a')](function(){_0x6301e6({'val':0x1});});})[_0xda8b('0x67')](function(_0x3f5b7d){logger[_0xda8b('0x5b')](_0x3f5b7d[_0xda8b('0x5c')]);_0x6301e6({'val':0x0});});});}function getTimezoneData(_0x284124,_0x3be723){return new Promise(function(_0x22f710,_0x59c1e0){var _0x561565=shared[_0xda8b('0x6e')];var _0x503825=_0x561565[_0x284124['dialTimezone']];if(_['isNil'](_0x503825)){_0x22f710({'ret':0x1});}else{var _0x191164=_0x503825['utcOffset'];var _0x494f48=squel[_0xda8b('0x2c')]()[_0xda8b('0x2d')](_0x3be723)[_0xda8b('0x6f')]('id',_0x284124['id'])[_0xda8b('0x6f')](_0xda8b('0x70'),_0x191164)[_0xda8b('0x6f')](_0xda8b('0x71'),_0x284124[_0xda8b('0x71')])['toString']();return db['sequelize'][_0xda8b('0x66')](_0x494f48)[_0xda8b('0x60')](function(_0x1363e4){_0x22f710({'ret':0x1});})['catch'](function(_0x28bdde){logger['error'](_0x28bdde['message']);_0x59c1e0({'ret':0x1});});}});}function handleTZQuery(_0x339bfa){logger[_0xda8b('0x59')](_0x339bfa);return db['sequelize'][_0xda8b('0x66')](_0x339bfa)[_0xda8b('0x60')](function(_0x37d786){})[_0xda8b('0x67')](function(_0x4a9acc){logger[_0xda8b('0x5b')](_0x4a9acc[_0xda8b('0x5c')]);});}function main(_0x3bdb49,_0x4c4eb7,_0x479bab,_0x792ee0){logger[_0xda8b('0x59')](_0xda8b('0x72'),_0x3bdb49,JSON[_0xda8b('0x73')](_0x4c4eb7));process[_0xda8b('0x74')](_0xda8b('0x75'));var _0x24e8ef=_0x4c4eb7[_0xda8b('0x76')];var _0x299af8=_['clone'](_0x24e8ef);var _0x43d257=_0x4c4eb7[_0xda8b('0x77')];var _0x2229d7=path[_0xda8b('0x13')](config[_0xda8b('0x78')],_0xda8b('0x79'),_0x43d257+_0xda8b('0x7a'));hasTZ=_[_0xda8b('0x52')](_0x24e8ef)[_0xda8b('0x7b')](_0xda8b('0x71'));var _0x2d850d=_[_0xda8b('0x52')](_0x24e8ef)[_0xda8b('0x13')]();logger[_0xda8b('0x59')](_0xda8b('0x7c'),_0x2d850d);db[_0xda8b('0x7d')]['findAll']({'raw':!![],'attributes':['id',_0xda8b('0x7e')]})['then'](function(_0x1ca3da){for(var _0x3973f2=0x0;_0x3973f2<_0x1ca3da[_0xda8b('0x1e')];_0x3973f2++){if(_0x1ca3da[_0x3973f2][_0xda8b('0x7e')]in _0x24e8ef){contactItemTypes[_0xda8b('0x1b')](_0x1ca3da[_0x3973f2]);delete _0x299af8[_0x1ca3da[_0x3973f2][_0xda8b('0x7e')]];hasAdditionalPhones=!![];}for(var _0x1ddda3 in _0x24e8ef){if(_0x1ca3da[_0x3973f2]['name']+'_description'===_0x1ddda3){phoneDescriptions[_0xda8b('0x1b')]({'itemTypeId':_0x1ca3da[_0x3973f2]['id'],'description':_0x1ddda3});delete _0x299af8[_0x1ddda3];}}}if(hasAdditionalPhones)_0x299af8[_0xda8b('0x19')]='';var _0x170cff=_['keys'](_0x299af8)[_0xda8b('0x13')]();logger[_0xda8b('0x59')]('header',_0x170cff);fs[_0xda8b('0x7f')](_0x2229d7,_0x170cff+'\x0a');Papa[_0xda8b('0x80')](fs[_0xda8b('0x81')](_0x3bdb49),{'header':!![],'skipEmptyLines':!![],'step':function(_0x5e5113,_0x12b389){try{for(var _0x2b5186=0x0,_0x5229b8=[];_0x2b5186<_0x5e5113[_0xda8b('0x82')][_0xda8b('0x1e')];_0x2b5186++){stats['rows']+=0x1;if(_0x5e5113['errors'][_0x2b5186]){handleError(_0x5e5113['data'][_0x2b5186],_0x5e5113['errors'][_0x2b5186]);}else{var _0x567ee1=[];var _0x3c1ced=[];var _0x170d0d={};for(var _0x3b8037 in _0x24e8ef){let _0x5b9659=contactItemTypes[_0xda8b('0x83')](_0x1e06ec=>_0x1e06ec[_0xda8b('0x7e')]===_0x3b8037);let _0x1336d0=contactItemTypes[_0xda8b('0x83')](_0x4007a0=>_0x4007a0['name']+_0xda8b('0x84')===_0x3b8037);if(_['isNil'](_0x5b9659)&&_[_0xda8b('0x85')](_0x1336d0)){if(_0x24e8ef[_0xda8b('0x86')](_0x3b8037)){if(_0x5e5113[_0xda8b('0x82')][_0x2b5186][_0x24e8ef[_0x3b8037]]){var _0x53aa29=_[_0xda8b('0x87')](_0x5e5113['data'][_0x2b5186][_0x24e8ef[_0x3b8037]][_0xda8b('0x88')](/"/g,'\x27'));switch(_0x3b8037){case _0xda8b('0x2f'):var _0x17a93f=moment(_0x53aa29,'YYYY-MM-DD\x20HH:mm:ss',!![]);if(_0x17a93f[_0xda8b('0x89')]()){_0x5229b8[_0xda8b('0x1b')]('\x22'+_0x53aa29+'\x22');}else{_0x567ee1[_0xda8b('0x1b')](_0xda8b('0x8a'));}break;case _0xda8b('0x44'):var _0x3dddc2=parseInt(_0x53aa29);_0x53aa29=_[_0xda8b('0x8b')](_0x3dddc2)||_0x3dddc2<0x0||_0x3dddc2>0x4?_0x792ee0?0x3:0x2:_0x3dddc2;_0x5229b8[_0xda8b('0x1b')]('\x22'+_0x53aa29+'\x22');break;case'UserId':var _0x273f3f=parseInt(_0x53aa29);if(_[_0xda8b('0x8c')](_0x273f3f)&&_['includes'](_0x479bab,_0x273f3f)){_0x5229b8[_0xda8b('0x1b')]('\x22'+_0x273f3f+'\x22');}else{_0x567ee1['push'](_0xda8b('0x8d'));}break;case _0xda8b('0x8e'):if(isEmail(_0x53aa29)){_0x5229b8[_0xda8b('0x1b')]('\x22'+_0x53aa29+'\x22');}else{_0x567ee1[_0xda8b('0x1b')](_0xda8b('0x8f'));}break;case _0xda8b('0x90'):var _0x163832=moment(_0x53aa29,'YYYY-MM-DD',!![]);if(_0x163832[_0xda8b('0x89')]()){_0x5229b8[_0xda8b('0x1b')]('\x22'+_0x53aa29+'\x22');}else{_0x567ee1[_0xda8b('0x1b')](_0xda8b('0x91'));}break;case _0xda8b('0x71'):var _0x579372=shared[_0xda8b('0x6e')];var _0x3698b2=_0x579372[_0x53aa29];if(!_[_0xda8b('0x85')](_0x3698b2)){var _0x41d75d=_0x3698b2[_0xda8b('0x92')];_0x5229b8[_0xda8b('0x1b')]('\x22'+_0x53aa29+'\x22');_0x5229b8[_0xda8b('0x1b')]('\x22'+_0x41d75d+'\x22');}break;default:_0x5229b8[_0xda8b('0x1b')]('\x22'+_0x53aa29+'\x22');}}else{switch(_0x3b8037){case _0xda8b('0x93'):case'phone':_0x567ee1['push'](_0x3b8037+_0xda8b('0x94'));break;default:_0x5229b8[_0xda8b('0x1b')]('\x22\x22');}}}}else{var _0x4908cb='';if(!_['isNil'](_0x5b9659)){if(!_0x170d0d['hasOwnProperty'](_0x5b9659['id'])){if(!_['isNil'](_0x5e5113[_0xda8b('0x82')][_0x2b5186][_0x24e8ef[_0x3b8037]])){var _0x53aa29=_['trim'](_0x5e5113[_0xda8b('0x82')][_0x2b5186][_0x24e8ef[_0x3b8037]][_0xda8b('0x88')](/"/g,'\x27'));var _0x4bebb3=phoneDescriptions[_0xda8b('0x83')](_0x426765=>_0x426765['itemTypeId']===_0x5b9659['id']);if(!_['isNil'](_0x4bebb3)){var _0x401664=_[_0xda8b('0x87')](_0x5e5113['data'][_0x2b5186][_0x24e8ef[_0x4bebb3[_0xda8b('0x95')]]][_0xda8b('0x88')](/"/g,'\x27'));if(!_[_0xda8b('0x85')](_0x401664))_0x53aa29=_0x53aa29+'§'+_0x401664;}if(_0x4908cb=='')_0x4908cb=_0x53aa29;else _0x4908cb+='|'+_0x53aa29;}_0x3c1ced[_0xda8b('0x1b')](_0x5b9659['id']+':'+_0x4908cb);_0x170d0d[_0x5b9659['id']]=0x1;}}}}if(hasAdditionalPhones){_0x5229b8[_0xda8b('0x1b')]('\x22'+_0x3c1ced[_0xda8b('0x13')](';')+'\x22');}if(_0x567ee1[_0xda8b('0x1e')]){handleError(_0x5e5113[_0xda8b('0x82')][_0x2b5186],{'code':'SystemRow','message':_0x567ee1[_0xda8b('0x13')]()});}else{fs[_0xda8b('0x96')](_0x2229d7,_0x5229b8['join']()+'\x0a');}_0x5229b8=[];}if(!(stats[_0xda8b('0x97')]%0xc8)){socket[_0xda8b('0x98')](_0xda8b('0x99')+_0x43d257,stats);stats['errors']=[];}}if(stopped){logger[_0xda8b('0x59')]('Abort\x20parser');_0x12b389['abort']();}}catch(_0xa3f64a){handleError(_0x5e5113[_0xda8b('0x82')][_0x2b5186],{'code':_0xda8b('0x9a'),'message':_0xa3f64a['message']});logger[_0xda8b('0x5b')](_0xda8b('0x9b'),_0xa3f64a[_0xda8b('0x5c')]);}},'complete':function(){try{var _0x13696a=[];var _0x2eb01f=[];var _0x5031f8=_0xda8b('0x36');if(_0x4c4eb7[_0xda8b('0x9c')]&&_0x4c4eb7[_0xda8b('0x9c')]['length']){_0x5031f8=_0xda8b('0x9d')+_0x43d257;_0x13696a['push'](_0xda8b('0x9e')+_0x5031f8+_0xda8b('0x9f'));}tmp_campaigns=_0xda8b('0xa0')+_0x43d257;tmp_voice_queues='voice_queues_'+_0x43d257;_0x2eb01f[_0xda8b('0x1b')]('CREATE\x20TABLE\x20'+tmp_campaigns+_0xda8b('0xa1'));_0x2eb01f[_0xda8b('0x1b')](_0xda8b('0x9e')+tmp_voice_queues+_0xda8b('0xa1'));BPromise['each'](_0x2eb01f,handleTZQuery)['then'](function(_0x55570b){updateTzCampaigns(_0x4c4eb7[_0xda8b('0x31')])[_0xda8b('0x1a')](function(_0xb7f4d){updateTzVoiceQueues(_0x4c4eb7[_0xda8b('0x31')])[_0xda8b('0x1a')](function(_0xd20dfb){if(hasTZ)_0x170cff=_0x170cff[_0xda8b('0x88')](_0xda8b('0x71'),'dialTimezone,utcOffset');var _0x52067a=util[_0xda8b('0xc')](_0xda8b('0xa2'),_0x2229d7,_0x5031f8,_0x170cff,_0x4c4eb7[_0xda8b('0x31')],_0x4c4eb7[_0xda8b('0x53')]||null,NOW,NOW);if(_['isNil'](_0x24e8ef[_0xda8b('0x2f')])){_0x52067a+=',\x20scheduledAt\x20=\x20NOW()';}_0x13696a['push'](_0x52067a);if(_0x4c4eb7[_0xda8b('0x9c')]&&_0x4c4eb7['duplicates'][_0xda8b('0x1e')]){_0x13696a[_0xda8b('0x1b')](insertCmContact(_0x4c4eb7[_0xda8b('0x31')],_0x5031f8,_0x4c4eb7[_0xda8b('0x9c')],_0x24e8ef));_0x13696a[_0xda8b('0x1b')](_0xda8b('0xa3')+_0x5031f8+';');}BPromise[_0xda8b('0xa4')](_0x13696a,handleQuery)[_0xda8b('0x1a')](function(_0x2f2ae9){BPromise['all']([handleAdditionalPhones()])[_0xda8b('0x1a')](function(){_0x13696a=[];for(var _0x501784=0x0;_0x501784_0x24289e['name']===_0x3b23cd);let _0x204852=contactItemTypes['find'](_0x251a9d=>_0x251a9d['name']+_0xb4ef('0x61')===_0x3b23cd);if(_[_0xb4ef('0x1a')](_0x5b93c0)&&_[_0xb4ef('0x1a')](_0x204852)){if(_0x7a7693[_0xb4ef('0x69')](_0x3b23cd)){if(_0x2cd08b[_0xb4ef('0x66')][_0x5d9d94][_0x7a7693[_0x3b23cd]]){var _0x2f2f4c=_[_0xb4ef('0x6a')](_0x2cd08b[_0xb4ef('0x66')][_0x5d9d94][_0x7a7693[_0x3b23cd]][_0xb4ef('0x6b')](/"/g,'\x27'));switch(_0x3b23cd){case'scheduledat':var _0x1c508a=moment(_0x2f2f4c,'YYYY-MM-DD\x20HH:mm:ss',!![]);if(_0x1c508a[_0xb4ef('0x6c')]()){_0x45859d['push']('\x22'+_0x2f2f4c+'\x22');}else{_0x4d4fe8['push']('scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)');}break;case _0xb4ef('0x6d'):var _0x4e5895=parseInt(_0x2f2f4c);_0x2f2f4c=_['isNaN'](_0x4e5895)||_0x4e5895<0x0||_0x4e5895>0x4?_0x4555c7?0x3:0x2:_0x4e5895;_0x45859d[_0xb4ef('0x1c')]('\x22'+_0x2f2f4c+'\x22');break;case _0xb4ef('0x6e'):var _0x4a6587=parseInt(_0x2f2f4c);if(_['isNumber'](_0x4a6587)&&_[_0xb4ef('0x6f')](_0x49528a,_0x4a6587)){_0x45859d[_0xb4ef('0x1c')]('\x22'+_0x4a6587+'\x22');}else{_0x4d4fe8[_0xb4ef('0x1c')]('agent\x20not\x20exists');}break;case'email':if(isEmail(_0x2f2f4c)){_0x45859d[_0xb4ef('0x1c')]('\x22'+_0x2f2f4c+'\x22');}else{_0x4d4fe8[_0xb4ef('0x1c')]('email\x20wrong\x20format');}break;case'dateOfBirth':var _0x49889a=moment(_0x2f2f4c,_0xb4ef('0x70'),!![]);if(_0x49889a[_0xb4ef('0x6c')]()){_0x45859d[_0xb4ef('0x1c')]('\x22'+_0x2f2f4c+'\x22');}else{_0x4d4fe8[_0xb4ef('0x1c')](_0xb4ef('0x71'));}break;default:_0x45859d[_0xb4ef('0x1c')]('\x22'+_0x2f2f4c+'\x22');}}else{switch(_0x3b23cd){case _0xb4ef('0x72'):case _0xb4ef('0x10'):_0x4d4fe8[_0xb4ef('0x1c')](_0x3b23cd+_0xb4ef('0x73'));break;default:_0x45859d[_0xb4ef('0x1c')]('\x22\x22');}}}}else{var _0x471e2d='';if(!_[_0xb4ef('0x1a')](_0x5b93c0)){if(!_0x840a45[_0xb4ef('0x69')](_0x5b93c0['id'])){for(var _0x35c743=0x0;_0x35c743<_0x7a7693[_0x3b23cd][_0xb4ef('0x19')];_0x35c743++){var _0x2f2f4c=_['trim'](_0x2cd08b[_0xb4ef('0x66')][_0x5d9d94][_0x7a7693[_0x3b23cd][_0x35c743]]['replace'](/"/g,'\x27'));var _0x12b04e=phoneDescriptions[_0xb4ef('0x68')](_0x55de43=>_0x55de43[_0xb4ef('0x74')]===_0x5b93c0['id']);if(!_['isNil'](_0x12b04e)){var _0x133fcb=_[_0xb4ef('0x6a')](_0x2cd08b['data'][_0x5d9d94][_0x7a7693[_0x12b04e[_0xb4ef('0x75')]][0x0]][_0xb4ef('0x6b')](/"/g,'\x27'));if(!_[_0xb4ef('0x1a')](_0x133fcb))_0x2f2f4c=_0x2f2f4c+'§'+_0x133fcb;}if(_0x471e2d=='')_0x471e2d=_0x2f2f4c;else _0x471e2d+='|'+_0x2f2f4c;}_0x44ef98[_0xb4ef('0x1c')](_0x5b93c0['id']+':'+_0x471e2d);_0x840a45[_0x5b93c0['id']]=0x1;}}}}if(hasAdditionalPhones){_0x45859d[_0xb4ef('0x1c')]('\x22'+_0x44ef98[_0xb4ef('0x12')](';')+'\x22');}if(_0x4d4fe8[_0xb4ef('0x19')]){handleError(_0x2cd08b[_0xb4ef('0x66')][_0x5d9d94],{'code':'SystemRow','message':_0x4d4fe8['join']()});}else{fs['appendFileSync'](_0x5a37da,_0x45859d[_0xb4ef('0x12')]()+'\x0a');}_0x45859d=[];}if(!(stats[_0xb4ef('0x67')]%0xc8)){socket['emit']('contact:import:'+_0x3d6082,stats);stats[_0xb4ef('0x55')]=[];}}if(stopped){logger[_0xb4ef('0x52')]('Abort\x20parser');_0x3cd3b2[_0xb4ef('0x76')]();}}catch(_0x58408f){handleError(_0x2cd08b[_0xb4ef('0x66')][_0x5d9d94],{'code':_0xb4ef('0x77'),'message':_0x58408f['message']});logger[_0xb4ef('0x54')](_0xb4ef('0x78'),_0x58408f[_0xb4ef('0x20')]);}},'complete':function(){try{var _0x468170=[];var _0x2c99db=tempTableName;_0x468170['push'](_0xb4ef('0x79')+_0x2c99db+_0xb4ef('0x7a'));logger[_0xb4ef('0x52')]('CIS\x20len',contactItemTypes['length']);var _0x147f53=util[_0xb4ef('0xb')](_0xb4ef('0x7b'),_0x5a37da,_0x2c99db,_0x1b5175,_0x1a6534[_0xb4ef('0x33')],_0x1a6534[_0xb4ef('0x7c')]||null,NOW,NOW);if(_[_0xb4ef('0x1a')](_0x7a7693[_0xb4ef('0x7d')])){_0x147f53+=_0xb4ef('0x7e');}_0x468170[_0xb4ef('0x1c')](_0x147f53);BPromise[_0xb4ef('0x7f')](_0x468170,handleQuery)[_0xb4ef('0x1e')](function(_0x4fd3a4){BPromise['all']([handleAdditionalPhones()])['then'](function(){_0x468170=[];for(var _0x2dcfee=0x0;_0x2dcfee\x20\x20');}var _0xe30733=path['join'](config[_0xb4ef('0x5b')],_0xb4ef('0x8b'),process['argv'][0x2]);if(!fs[_0xb4ef('0x8c')](_0xe30733)){throw new Error(_0xb4ef('0x8d'));}var _0x2e1aca={};try{_0x2e1aca=JSON[_0xb4ef('0x64')](process[_0xb4ef('0x8a')][0x3]);if(!_0x2e1aca[_0xb4ef('0x59')]){throw new Error(_0xb4ef('0x8e'));}var _0x771a70=0x0;if(_0x2e1aca[_0xb4ef('0x59')][_0xb4ef('0x6e')]){_0x771a70=0x1;}if(!_0x2e1aca[_0xb4ef('0x33')]){throw new Error(_0xb4ef('0x8f'));}}catch(_0x38d2c4){throw new Error(_0xb4ef('0x90'));}var _0x6f4fe2=[];try{_0x6f4fe2=_[_0xb4ef('0x91')](JSON[_0xb4ef('0x64')](process[_0xb4ef('0x8a')][0x4]),'id');}catch(_0x470f81){logger[_0xb4ef('0x52')](_0xb4ef('0x92'));}main(_0xe30733,_0x2e1aca,_0x6f4fe2,_0x771a70);}validate();process['on'](_0xb4ef('0x93'),handleStop);process['on']('uncaughtException',handleUncaughtException); \ No newline at end of file +var _0x1226=['push','then','catch','error','message','AdditionalPhones','split','all','CmContactHasItem','findOne','update','updated','PHONE','inserted','CmContact','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','scheduledat','ContactId','createdAt','updatedAt','priority','select','cm_contacts.ListId\x20=\x20','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22always\x22','cm_contacts.updatedAt','cm_hopper_black','ListId','fields','cm_contacts','.CmListId','ListId\x20=\x20?','\x20=\x20?','toString','cm_hopper.id','cm_contact_has_items.item','cm_contact_has_items.OrderBy','cm_contact_has_items.createdAt','fromQuery','CmHopperId','cm_contacts.id\x20=\x20cm_hopper.ContactId','cm_contact_has_items','cm_contacts.id\x20=\x20cm_contact_has_items.CmContactId','keys',')\x20NOT\x20IN\x20?','id\x20IN\x20?','MIN(id)','min_id','info','Received\x20SIGINT','exit','errors','code','sequelize','spread','main','send','start','binding','clone','root','server/files/tmp','.csv','body','findAll','name','_description','header','writeFileSync','createReadStream','data','find','hasOwnProperty','trim','replace','isValid','isNaN','isNumber','includes','agent\x20not\x20exists','email','email\x20wrong\x20format','dateOfBirth','firstName','\x20not\x20specified','itemTypeId','description','SystemRow','appendFileSync','rows','emit','contact:import:','Abort\x20parser','abort','SystemError','step','CREATE\x20TABLE\x20','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','CompanyId','each','contact','contactTypeId','orderBy','finish','affectedRows','unlink','complete','argv','arguments\x20\x20\x20','existsSync','file\x20doesn\x27t\x20exists','parse','binding\x20doesn\x27t\x20exists','UserId','ListId\x20is\x20mandatory','body\x20id\x20mandatory','map','No\x20agent\x20available','SIGINT','uncaughtException','path','lodash','papaparse','util','bluebird','moment','squel','ioredis','../../../mysqldb','../../../config/logger','import','redis','defaults','socket.io-emitter','format','YYYY-MM-DD\x20HH:mm:ss','cm_contacts_temp_','YYYYMMDDHHmmss','field','phone','from','join','.id\x20=\x20','where','.dialCheckDuplicateType\x20IN\x20(','query','length','isNil'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x1226,0x1c1));var _0x6122=function(_0x22dc8b,_0x556b84){_0x22dc8b=_0x22dc8b-0x0;var _0x5ba336=_0x1226[_0x22dc8b];return _0x5ba336;};'use strict';var fs=require('fs');var path=require(_0x6122('0x0'));var _=require(_0x6122('0x1'));var Papa=require(_0x6122('0x2'));var util=require(_0x6122('0x3'));var BPromise=require(_0x6122('0x4'));var moment=require(_0x6122('0x5'));var squel=require(_0x6122('0x6'));var Redis=require(_0x6122('0x7'));var db=require(_0x6122('0x8'))['db'];var config=require('../../../config/environment');var logger=require(_0x6122('0x9'))(_0x6122('0xa'));config[_0x6122('0xb')]=_[_0x6122('0xc')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x6122('0xd'))(new Redis(config[_0x6122('0xb')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var promisesContact=[];var orderBy=0x0;var updatedRows=0x0;var stopped=![];var NOW=moment()[_0x6122('0xe')](_0x6122('0xf'));var tempTableName=_0x6122('0x10')+moment()[_0x6122('0xe')](_0x6122('0x11'));var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];function isEmail(_0x7f19a6){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'](_0x7f19a6);}function selectNotIn(_0x3dcea8,_0x414391,_0x4f4250,_0x190d8e,_0x44c993){return squel['select']()[_0x6122('0x12')](_0x6122('0x13'))[_0x6122('0x14')](_0x190d8e)[_0x6122('0x15')](_0x414391,null,_0x414391+_0x6122('0x16')+_0x190d8e+'.'+_0x4f4250)[_0x6122('0x17')](_0x190d8e+'.'+_0x4f4250+'\x20=\x20'+_0x3dcea8+'.'+_0x4f4250)[_0x6122('0x17')](_0x414391+_0x6122('0x18')+_0x44c993[_0x6122('0x15')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0x320b46,_0x223d20){promisesAdditionalPhones=[];promisesContact=[];return db['sequelize'][_0x6122('0x19')]('select\x20*\x20from\x20'+tempTableName)['spread'](function(_0x7dd3fe){if(_0x7dd3fe!==null){var _0x216076=[];for(var _0x1f765a=0x0;_0x1f765a<_0x7dd3fe[_0x6122('0x1a')];_0x1f765a++){var _0x9958e5=_0x7dd3fe[_0x1f765a];if(!_[_0x6122('0x1b')](_0x9958e5[_0x6122('0x13')])){if(!_[_0x6122('0x1b')](_0x9958e5['AdditionalPhones']))_0x216076[_0x6122('0x1c')](insertAdditionalPhones(_0x9958e5));promisesContact[_0x6122('0x1c')]({'contact':_0x9958e5});}}}Promise['all'](_0x216076)[_0x6122('0x1d')](function(){_0x320b46({'val':0x1});});})[_0x6122('0x1e')](function(_0xcbf31a){logger[_0x6122('0x1f')](_0xcbf31a[_0x6122('0x20')]);});});}function insertAdditionalPhones(_0x5d7b08){return new Promise(function(_0x3f6cd2,_0x5bd8ff){var _0x41e3f2=_0x5d7b08[_0x6122('0x21')];if(_[_0x6122('0x1b')](_0x41e3f2))_0x5bd8ff({'val':0x0});else{var _0x352355=_0x41e3f2[_0x6122('0x22')](';');var _0x194357=[];orderBy=0x0;for(var _0x2980e8=0x0;_0x2980e8<_0x352355[_0x6122('0x1a')];_0x2980e8++){_0x194357['push'](splitAdditionalPhone(_0x5d7b08['id'],_0x352355[_0x2980e8]));}Promise[_0x6122('0x23')](_0x194357)['then'](function(){_0x3f6cd2({'val':_0x352355[_0x6122('0x1a')]});});}});}function splitAdditionalPhone(_0x3a3efa,_0xb36f06){return new Promise(function(_0x5cfa37,_0x4ea2fb){var _0x5a9b4d=_0xb36f06[_0x6122('0x22')](':');var _0x5a26ac=_0x5a9b4d[0x0];var _0x26c417=_0x5a9b4d[0x1];if(_0x26c417!==''){var _0x1e4ef2=_0x26c417[_0x6122('0x22')]('|');var _0x489e06=[];for(var _0x519f63=0x0;_0x519f63<_0x1e4ef2[_0x6122('0x1a')];_0x519f63++){if(_0x1e4ef2[_0x519f63]!==''){var _0x472411=_['filter'](promisesAdditionalPhones,{'contactId':_0x3a3efa,'phone':_0x1e4ef2[_0x519f63]});if(_0x472411['length']==0x0){orderBy++;promisesAdditionalPhones[_0x6122('0x1c')]({'contactId':_0x3a3efa,'contactTypeId':_0x5a26ac,'phone':_0x1e4ef2[_0x519f63],'orderBy':orderBy});}}}_0x5cfa37({'ok':0x1});}else _0x5cfa37({'res':0x0});});}function createAdditionalPhone(_0x5ee15a,_0x19487c,_0x549c0e,_0x5ee825){var _0x655ae0='';var _0x395796='';var _0x3e9e75=_0x549c0e[_0x6122('0x22')]('§');_0x655ae0=_0x3e9e75[0x0];if(_0x3e9e75[_0x6122('0x1a')]==0x2)_0x395796=_0x3e9e75[0x1];return new Promise(function(_0x1dced4,_0x45b1df){return db[_0x6122('0x24')][_0x6122('0x25')]({'where':{'CmContactId':_0x5ee15a,'item':_0x655ae0}})['then'](function(_0x5ba87e){if(_0x5ba87e){return db[_0x6122('0x24')][_0x6122('0x26')]({'ItemTypeId':_0x19487c,'description':_0x395796,'OrderBy':_0x5ee825},{'where':{'CmContactId':_0x5ee15a,'item':_0x655ae0}})[_0x6122('0x1d')](function(_0x1795f4){_0x1dced4({'res':_0x6122('0x27')});});}else{return db['CmContactHasItem']['create']({'CmContactId':_0x5ee15a,'item':_0x655ae0,'ItemTypeId':_0x19487c,'description':_0x395796,'OrderBy':_0x5ee825,'ItemClass':_0x6122('0x28')})[_0x6122('0x1d')](function(_0x178020){_0x1dced4({'res':_0x6122('0x29')});});}});});}function updateContact(_0xb00fdb){return new Promise(function(_0x213e0e,_0x4e6c5e){var _0x4ed9c2=_0xb00fdb['id'];delete _0xb00fdb['id'];return db[_0x6122('0x2a')][_0x6122('0x26')](_0xb00fdb,{'where':{'id':_0x4ed9c2}})[_0x6122('0x1d')](function(_0x17a691){updatedRows+=0x1;return db['CmHopper'][_0x6122('0x26')]({'phone':_0xb00fdb[_0x6122('0x13')]},{'where':{'ContactId':_0x4ed9c2}})[_0x6122('0x1d')](function(_0x1f9f7b){_0x213e0e({'ret':'OK'});});});});}function insertCmHopper(_0xd92b45,_0x49c8be,_0x3cd38e,_0x3e476b,_0x13ad69){var _0x2ef3bf=[_0x6122('0x2b'),_0x6122('0x2c'),_0x6122('0x2d'),_0x6122('0x2e'),_0x49c8be+'.'+_0x3e476b,_0x6122('0x2f'),'cm_contacts.updatedAt',_0x6122('0x30'),_0x6122('0x31'),'\x22'+_0x13ad69+'\x22'];return squel[_0x6122('0x32')]()[_0x6122('0x33')](_0x6122('0x34'))['fromQuery']([_0x6122('0x13'),_0x6122('0x35'),_0x6122('0x36'),'ListId',_0x3e476b,_0x6122('0x37'),_0x6122('0x38'),_0x6122('0x39'),'UserId','recallme'],squel[_0x6122('0x3a')]()['fields'](_0x2ef3bf)[_0x6122('0x14')](_0x49c8be)[_0x6122('0x15')]('cm_contacts',null,_0x6122('0x3b')+_0x49c8be+'.CmListId')['join'](_0x3cd38e,null,_0x3cd38e+_0x6122('0x16')+_0x49c8be+'.'+_0x3e476b)['where'](_0x49c8be+_0x6122('0x3c'),_0xd92b45)[_0x6122('0x17')](_0x6122('0x3d'),NOW)['where'](_0x6122('0x3e'),selectNotIn(_0x49c8be,_0x3cd38e,_0x3e476b,'cm_hopper',[_0x6122('0x3f'),'\x22onlyIfOpen\x22']))[_0x6122('0x17')](_0x6122('0x3e'),selectNotIn(_0x49c8be,_0x3cd38e,_0x3e476b,_0x6122('0x34'),['\x22always\x22'])))['toString']();}function insertCmHopperBlack(_0x22e97d,_0x4e2508,_0x8b1286,_0x5463e4){var _0x1c2086=[_0x6122('0x2b'),_0x6122('0x2d'),_0x6122('0x2e'),_0x4e2508+'.'+_0x5463e4,_0x6122('0x2f'),_0x6122('0x40')];return squel['insert']()[_0x6122('0x33')](_0x6122('0x41'))['fromQuery']([_0x6122('0x13'),_0x6122('0x36'),_0x6122('0x42'),_0x5463e4,_0x6122('0x37'),'updatedAt'],squel[_0x6122('0x3a')]()[_0x6122('0x43')](_0x1c2086)[_0x6122('0x14')](_0x4e2508)['join'](_0x6122('0x44'),null,'cm_contacts.ListId\x20=\x20'+_0x4e2508+_0x6122('0x45'))['join'](_0x8b1286,null,_0x8b1286+_0x6122('0x16')+_0x4e2508+'.'+_0x5463e4)['where'](_0x4e2508+_0x6122('0x3c'),_0x22e97d)[_0x6122('0x17')](_0x6122('0x3d'),NOW)['where'](_0x6122('0x3e'),squel[_0x6122('0x3a')]()['field']('phone')[_0x6122('0x14')](_0x6122('0x41'))['where'](_0x6122('0x46'),_0x22e97d)[_0x6122('0x17')](_0x5463e4+_0x6122('0x47'),_0x4e2508+'.'+_0x5463e4)))[_0x6122('0x48')]();}function insertCmHopperAdditionalPhones(_0x8ca611){var _0x1842da=[_0x6122('0x49'),_0x6122('0x4a'),_0x6122('0x4b'),_0x6122('0x4c'),'cm_contact_has_items.updatedAt'];return squel[_0x6122('0x32')]()['into']('cm_hopper_additional_phones')[_0x6122('0x4d')]([_0x6122('0x4e'),_0x6122('0x13'),'OrderBy',_0x6122('0x37'),_0x6122('0x38')],squel[_0x6122('0x3a')]()[_0x6122('0x43')](_0x1842da)[_0x6122('0x14')]('cm_hopper')[_0x6122('0x15')](_0x6122('0x44'),null,_0x6122('0x4f'))['join'](_0x6122('0x50'),null,_0x6122('0x51'))[_0x6122('0x17')]('cm_hopper.ListId\x20=\x20?',_0x8ca611)[_0x6122('0x17')](_0x6122('0x3d'),NOW))['toString']();}function insertCmContact(_0x371b74,_0x367bda,_0x59dece,_0x57416d){var _0x56984b=_['concat'](_[_0x6122('0x52')](_0x57416d),['ListId','CompanyId','createdAt',_0x6122('0x38')]);return squel[_0x6122('0x32')]()[_0x6122('0x33')](_0x6122('0x44'))[_0x6122('0x4d')](_0x56984b,squel['select']()['fields'](_0x56984b)[_0x6122('0x14')](_0x367bda)[_0x6122('0x17')]('('+_0x59dece[_0x6122('0x15')](',')+_0x6122('0x53'),squel[_0x6122('0x3a')]()['fields'](_0x59dece)[_0x6122('0x14')]('cm_contacts')['where']('ListId\x20=\x20?',_0x371b74))[_0x6122('0x17')](_0x6122('0x54'),squel[_0x6122('0x3a')]()[_0x6122('0x12')](_0x6122('0x55'),_0x6122('0x56'))['from'](_0x367bda)['group'](_0x59dece[_0x6122('0x15')](','))))['toString']();}function handleStop(){logger[_0x6122('0x57')](_0x6122('0x58'));stopped=!![];}function handleUncaughtException(_0x22c055){logger[_0x6122('0x1f')](_0x22c055[_0x6122('0x20')]);process[_0x6122('0x59')](0x1);}function handleError(_0x84f06e,_0x436694){stats[_0x6122('0x5a')][_0x6122('0x1c')]({'name':_0x436694[_0x6122('0x5b')],'message':_0x436694[_0x6122('0x20')],'row':_0x84f06e});}function handleQuery(_0x45c871){logger[_0x6122('0x57')](_0x45c871);return db[_0x6122('0x5c')][_0x6122('0x19')](_0x45c871)[_0x6122('0x5d')](function(_0x5d05f7){results[_0x6122('0x1c')](_0x5d05f7);})[_0x6122('0x1e')](function(_0x393282){logger['error'](_0x393282['message']);});}function main(_0x1bee71,_0x80ed8b,_0x244168,_0x16bff7){logger[_0x6122('0x57')](_0x6122('0x5e'),_0x1bee71,JSON['stringify'](_0x80ed8b));process[_0x6122('0x5f')](_0x6122('0x60'));var _0x8f9318=_0x80ed8b[_0x6122('0x61')];var _0x1799ae=_[_0x6122('0x62')](_0x8f9318);var _0x45427c=_0x80ed8b['socket_timestamp'];var _0x2656c0=path['join'](config[_0x6122('0x63')],_0x6122('0x64'),_0x45427c+_0x6122('0x65'));logger[_0x6122('0x57')](_0x6122('0x66'),_0x80ed8b);db['ContactItemType'][_0x6122('0x67')]({'raw':!![],'attributes':['id',_0x6122('0x68')]})[_0x6122('0x1d')](function(_0x6354ee){for(var _0x5a58f8=0x0;_0x5a58f8<_0x6354ee[_0x6122('0x1a')];_0x5a58f8++){if(_0x6354ee[_0x5a58f8]['name']in _0x8f9318){contactItemTypes[_0x6122('0x1c')](_0x6354ee[_0x5a58f8]);delete _0x1799ae[_0x6354ee[_0x5a58f8][_0x6122('0x68')]];hasAdditionalPhones=!![];}for(var _0x1ed6ee in _0x8f9318){if(_0x6354ee[_0x5a58f8][_0x6122('0x68')]+_0x6122('0x69')===_0x1ed6ee){phoneDescriptions['push']({'itemTypeId':_0x6354ee[_0x5a58f8]['id'],'description':_0x1ed6ee});delete _0x1799ae[_0x1ed6ee];}}}if(hasAdditionalPhones)_0x1799ae[_0x6122('0x21')]='';var _0x11ecd5=_[_0x6122('0x52')](_0x1799ae)['join']();logger[_0x6122('0x57')](_0x6122('0x6a'),_0x11ecd5);fs[_0x6122('0x6b')](_0x2656c0,_0x11ecd5+'\x0a');Papa['parse'](fs[_0x6122('0x6c')](_0x1bee71),{'header':!![],'skipEmptyLines':!![],'step':function(_0x71a8f2,_0x45fd5c){try{for(var _0x1b5b81=0x0,_0x459a3b=[];_0x1b5b81<_0x71a8f2[_0x6122('0x6d')][_0x6122('0x1a')];_0x1b5b81++){stats['rows']+=0x1;if(_0x71a8f2['errors'][_0x1b5b81]){handleError(_0x71a8f2['data'][_0x1b5b81],_0x71a8f2[_0x6122('0x5a')][_0x1b5b81]);}else{var _0x5e101e=[];var _0x602080=[];var _0x471115={};for(var _0x1ff5ee in _0x8f9318){let _0x15f641=contactItemTypes[_0x6122('0x6e')](_0xa92bf=>_0xa92bf[_0x6122('0x68')]===_0x1ff5ee);let _0x3ab9c3=contactItemTypes[_0x6122('0x6e')](_0x297cfb=>_0x297cfb[_0x6122('0x68')]+'_description'===_0x1ff5ee);if(_[_0x6122('0x1b')](_0x15f641)&&_['isNil'](_0x3ab9c3)){if(_0x8f9318[_0x6122('0x6f')](_0x1ff5ee)){if(_0x71a8f2[_0x6122('0x6d')][_0x1b5b81][_0x8f9318[_0x1ff5ee]]){var _0x1d6ea2=_[_0x6122('0x70')](_0x71a8f2['data'][_0x1b5b81][_0x8f9318[_0x1ff5ee]][_0x6122('0x71')](/"/g,'\x27'));switch(_0x1ff5ee){case _0x6122('0x35'):var _0x490ec9=moment(_0x1d6ea2,_0x6122('0xf'),!![]);if(_0x490ec9[_0x6122('0x72')]()){_0x459a3b['push']('\x22'+_0x1d6ea2+'\x22');}else{_0x5e101e[_0x6122('0x1c')]('scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)');}break;case'priority':var _0x409173=parseInt(_0x1d6ea2);_0x1d6ea2=_[_0x6122('0x73')](_0x409173)||_0x409173<0x0||_0x409173>0x4?_0x16bff7?0x3:0x2:_0x409173;_0x459a3b['push']('\x22'+_0x1d6ea2+'\x22');break;case'UserId':var _0x13e6c0=parseInt(_0x1d6ea2);if(_[_0x6122('0x74')](_0x13e6c0)&&_[_0x6122('0x75')](_0x244168,_0x13e6c0)){_0x459a3b[_0x6122('0x1c')]('\x22'+_0x13e6c0+'\x22');}else{_0x5e101e[_0x6122('0x1c')](_0x6122('0x76'));}break;case _0x6122('0x77'):if(isEmail(_0x1d6ea2)){_0x459a3b['push']('\x22'+_0x1d6ea2+'\x22');}else{_0x5e101e[_0x6122('0x1c')](_0x6122('0x78'));}break;case _0x6122('0x79'):var _0x3401af=moment(_0x1d6ea2,'YYYY-MM-DD',!![]);if(_0x3401af[_0x6122('0x72')]()){_0x459a3b[_0x6122('0x1c')]('\x22'+_0x1d6ea2+'\x22');}else{_0x5e101e[_0x6122('0x1c')]('dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)');}break;default:_0x459a3b[_0x6122('0x1c')]('\x22'+_0x1d6ea2+'\x22');}}else{switch(_0x1ff5ee){case _0x6122('0x7a'):case _0x6122('0x13'):_0x5e101e[_0x6122('0x1c')](_0x1ff5ee+_0x6122('0x7b'));break;default:_0x459a3b[_0x6122('0x1c')]('\x22\x22');}}}}else{var _0xbd71c5='';if(!_[_0x6122('0x1b')](_0x15f641)){if(!_0x471115[_0x6122('0x6f')](_0x15f641['id'])){for(var _0x50dd45=0x0;_0x50dd45<_0x8f9318[_0x1ff5ee][_0x6122('0x1a')];_0x50dd45++){var _0x1d6ea2=_[_0x6122('0x70')](_0x71a8f2['data'][_0x1b5b81][_0x8f9318[_0x1ff5ee][_0x50dd45]][_0x6122('0x71')](/"/g,'\x27'));var _0x2de435=phoneDescriptions[_0x6122('0x6e')](_0x3afcf3=>_0x3afcf3[_0x6122('0x7c')]===_0x15f641['id']);if(!_[_0x6122('0x1b')](_0x2de435)){var _0x255221=_[_0x6122('0x70')](_0x71a8f2[_0x6122('0x6d')][_0x1b5b81][_0x8f9318[_0x2de435[_0x6122('0x7d')]][0x0]][_0x6122('0x71')](/"/g,'\x27'));if(!_[_0x6122('0x1b')](_0x255221))_0x1d6ea2=_0x1d6ea2+'§'+_0x255221;}if(_0xbd71c5=='')_0xbd71c5=_0x1d6ea2;else _0xbd71c5+='|'+_0x1d6ea2;}_0x602080['push'](_0x15f641['id']+':'+_0xbd71c5);_0x471115[_0x15f641['id']]=0x1;}}}}if(hasAdditionalPhones){_0x459a3b[_0x6122('0x1c')]('\x22'+_0x602080[_0x6122('0x15')](';')+'\x22');}if(_0x5e101e[_0x6122('0x1a')]){handleError(_0x71a8f2[_0x6122('0x6d')][_0x1b5b81],{'code':_0x6122('0x7e'),'message':_0x5e101e[_0x6122('0x15')]()});}else{fs[_0x6122('0x7f')](_0x2656c0,_0x459a3b[_0x6122('0x15')]()+'\x0a');}_0x459a3b=[];}if(!(stats[_0x6122('0x80')]%0xc8)){socket[_0x6122('0x81')](_0x6122('0x82')+_0x45427c,stats);stats[_0x6122('0x5a')]=[];}}if(stopped){logger['info'](_0x6122('0x83'));_0x45fd5c[_0x6122('0x84')]();}}catch(_0x836092){handleError(_0x71a8f2[_0x6122('0x6d')][_0x1b5b81],{'code':_0x6122('0x85'),'message':_0x836092[_0x6122('0x20')]});logger[_0x6122('0x1f')](_0x6122('0x86'),_0x836092['message']);}},'complete':function(){try{var _0x5b6a07=[];var _0xda3a68=tempTableName;_0x5b6a07[_0x6122('0x1c')](_0x6122('0x87')+_0xda3a68+'\x20LIKE\x20cm_contacts;');logger['info']('CIS\x20len',contactItemTypes[_0x6122('0x1a')]);var _0x7d930c=util[_0x6122('0xe')](_0x6122('0x88'),_0x2656c0,_0xda3a68,_0x11ecd5,_0x80ed8b[_0x6122('0x42')],_0x80ed8b[_0x6122('0x89')]||null,NOW,NOW);if(_['isNil'](_0x8f9318[_0x6122('0x35')])){_0x7d930c+=',\x20scheduledAt\x20=\x20NOW()';}_0x5b6a07[_0x6122('0x1c')](_0x7d930c);BPromise[_0x6122('0x8a')](_0x5b6a07,handleQuery)[_0x6122('0x1d')](function(_0x5228a7){BPromise[_0x6122('0x23')]([handleAdditionalPhones()])[_0x6122('0x1d')](function(){_0x5b6a07=[];for(var _0x5b9c85=0x0;_0x5b9c85\x20\x27\x27\x20AND\x20i.to\x20NOT\x20LIKE\x20CONCAT(\x27%\x27,\x20a.email,\x20\x27%\x27)\x20THEN\x20TRIM(SUBSTRING_INDEX(i.to,\x20\x27<\x27,\x201))\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.id','i.closedAt','i.attach','i.lastMsgAt','i.lastMsgDirection','i.subject','i.to','i.ContactId','i.MailAccountId','i.UserId','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','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.email','c.phone','c.mobile','Contact.mobile','Contact.fax','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','limit','offset','toString','groupBy','Setting','findOne','enableEmailPreview','all','COUNT(*)','getSelectedTags','isEmpty','t.id\x20IN\x20?','lodash','../parsers/advancedSearch','../parsers/qs','./update-interaction','updateInteraction','./utils','getAccountFK','agent','search','select','field','name','from','tools_tags','_interactions','u.id','u.fullname'];(function(_0x2a4e7a,_0x4e4326){var _0x485fb6=function(_0x27fa6e){while(--_0x27fa6e){_0x2a4e7a['push'](_0x2a4e7a['shift']());}};_0x485fb6(++_0x4e4326);}(_0x21ed,0x90));var _0xd21e=function(_0x5d623b,_0x56be27){_0x5d623b=_0x5d623b-0x0;var _0x2057fc=_0x21ed[_0x5d623b];return _0x2057fc;};'use strict';var _=require(_0xd21e('0x0'));var squel=require('squel');var as=require(_0xd21e('0x1'));var qs=require(_0xd21e('0x2'));var updateInteraction=require(_0xd21e('0x3'))[_0xd21e('0x4')];var utils=require(_0xd21e('0x5'));var db=require('../../mysqldb')['db'];function skipInteractionsQuery(_0x558ff5,_0x21910e,_0x4fb374){var _0x430ee3=![];var _0x1bd8c7=utils[_0xd21e('0x6')](_0x558ff5);if(_0x21910e['role']===_0xd21e('0x7')&&!_0x4fb374[_0xd21e('0x8')]&&!_0x4fb374[_0x1bd8c7]){_0x430ee3=!![];}return _0x430ee3;}function getTagsQuery(){return squel[_0xd21e('0x9')]()[_0xd21e('0xa')]('id')[_0xd21e('0xa')](_0xd21e('0xb'))['field']('color')[_0xd21e('0xc')](_0xd21e('0xd'));}function getUsersQuery(_0x201573,_0x1e763a){var _0x4c9770=utils['getInteractionFK'](_0x201573);var _0x5b25f7='user_has_'+_0x201573+_0xd21e('0xe');var _0x482be3=squel['select']()['field'](_0xd21e('0xf'))[_0xd21e('0xa')](_0xd21e('0x10'))[_0xd21e('0xa')](_0xd21e('0x11')+_0x4c9770)['from'](_0x5b25f7,'ui')[_0xd21e('0x12')]('users','u','u.id\x20=\x20ui.UserId');if(_0x1e763a['length']>0x0){_0x482be3[_0xd21e('0x13')]('ui.'+_0x4c9770+_0xd21e('0x14'),_[_0xd21e('0x15')](_0x1e763a,'id'));}return _0x482be3;}function getInteractionsQuery(_0x47ee52){var _0x193048=utils[_0xd21e('0x16')](_0x47ee52);var _0x2dd58b=utils[_0xd21e('0x6')](_0x47ee52);var _0x1b9009=utils[_0xd21e('0x17')](_0x47ee52);return squel['select']()[_0xd21e('0xc')](_0x193048['interactions'],'i')[_0xd21e('0x12')](_0xd21e('0x18'),'c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')[_0xd21e('0x12')]('users','o','o.id\x20=\x20i.UserId')[_0xd21e('0x12')](_0x193048[_0xd21e('0x19')],'a',_0xd21e('0x1a')+_0x2dd58b)[_0xd21e('0x12')](_0x193048[_0xd21e('0x1b')],'me',_0xd21e('0x1c')+_0x1b9009+_0xd21e('0x1d'))[_0xd21e('0x12')](_0x193048[_0xd21e('0x1e')],'it',_0xd21e('0x1f')+_0x1b9009+_0xd21e('0x1d'))[_0xd21e('0x12')](_0xd21e('0xd'),'t',_0xd21e('0x20'));}function getSqlClauses(){var _0x5016c4={'body':squel['expr'](),'contact':squel[_0xd21e('0x21')](),'default':squel[_0xd21e('0x21')](),'fields':squel[_0xd21e('0x21')](),'filter':squel[_0xd21e('0x21')](),'read':squel[_0xd21e('0x21')](),'tags':{'clause':squel['expr'](),'ids':null},'user':squel[_0xd21e('0x21')]()};return _0x5016c4;}function parseTagParameter(_0x5ee666){var _0x35fde6=squel['expr']();if(_0x5ee666){var _0xff0463=utils['getSelectedTags'](_0x5ee666);_0xff0463[_0xd21e('0x22')](function(_0x2ca262){_0x35fde6['or'](_0xd21e('0x23'),'%,'+_0x2ca262+',%');});}return _0x35fde6;}function parseReadParameter(_0x48d818){var _0x207f95='';if(_0x48d818){_0x207f95=_0xd21e('0x24');if(_0x48d818==='1'){_0x207f95=_0x207f95['replace'](_0xd21e('0x25'),'=');}else{_0x207f95=_0x207f95[_0xd21e('0x26')](_0xd21e('0x25'),'>');}}return _0x207f95;}function parseSearchFilter(_0x14f03a,_0x14fd2c){var _0x4057d8=squel[_0xd21e('0x21')]();if(_0x14fd2c){var _0x4967bd=_0x14fd2c[_0xd21e('0x26')]('\x5c','\x5c\x5c')[_0xd21e('0x26')](/'/g,'\x27\x27');if(qs[_0xd21e('0x27')](_0x4967bd)){_0x4057d8['or'](_0xd21e('0x28'),_0x4967bd+'%');if(['sms','whatsapp'][_0xd21e('0x29')](_0x14f03a)){_0x4057d8['or'](_0xd21e('0x2a'),_0x4967bd+'%');}else if(_0x14f03a===_0xd21e('0x2b')){_0x4057d8['or'](_0xd21e('0x2c'),_0x4967bd+'%');}else if(_0x14f03a===_0xd21e('0x2d')){_0x4057d8['or'](_0xd21e('0x2e'),_0x4967bd+'%');}}else if(_0x14f03a===_0xd21e('0x2f')&&qs[_0xd21e('0x30')](_0x4967bd)){_0x4057d8['or'](_0xd21e('0x31'),_0x4967bd+'%');}else{if(_0x14f03a===_0xd21e('0x2f')){_0x4057d8['or'](_0xd21e('0x32'),qs[_0xd21e('0x33')](_0x4967bd,!![]))['or'](_0xd21e('0x34'),qs[_0xd21e('0x33')](_0x4967bd));}else if(_0x14f03a!==_0xd21e('0x2b')){_0x4057d8['or']('MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0xd21e('0x33')](_0x4967bd));}_0x4057d8['or'](_0xd21e('0x35'),qs[_0xd21e('0x33')](_0x4967bd,!![]),null);}}return _0x4057d8;}function parseAdvancedSearchFilter(_0x1d9607,_0x24e431){var _0x57d832=getSqlClauses();var _0x53a8d5=as[_0xd21e('0x36')](_0x1d9607);var _0x3b16e0=_0x53a8d5[_0xd21e('0x37')];for(var _0x5dd764=0x0;_0x5dd764<_0x53a8d5['conditions'][_0xd21e('0x38')];_0x5dd764++){var _0x5d4248=_0x53a8d5[_0xd21e('0x39')][_0x5dd764];var _0x297f94='i';var _0xe911b0=_[_0xd21e('0x3a')](_0x24e431,[_0xd21e('0xb'),_0x5d4248['field']]);if(_0xe911b0){var _0xffd441=as[_0xd21e('0x3b')](_0x297f94,_0xe911b0[_0xd21e('0x3c')],_0x5d4248);_0x57d832['default'][_0x3b16e0](_0xffd441[_0xd21e('0x3d')],_0xffd441[_0xd21e('0x3e')][_0xd21e('0x3f')],_0xffd441[_0xd21e('0x3e')][_0xd21e('0x40')]);}else{switch(_0x5d4248['field']){case _0xd21e('0x41'):var _0x25462b=parseReadParameter(_0x5d4248[_0xd21e('0x3e')]);_0x57d832[_0xd21e('0x42')]['and'](_0x25462b);break;case'Contact':if(_0x5d4248[_0xd21e('0x43')]===_0xd21e('0x44')){if(_0x5d4248[_0xd21e('0x3e')][_0xd21e('0x45')]('\x20')[_0xd21e('0x38')]>0x1){_0x57d832[_0xd21e('0x46')][_0x3b16e0](_0xd21e('0x35'),qs['getFullTextValue'](_0x5d4248[_0xd21e('0x3e')],!![]),null);}else{var _0x36ff30='%'+_0x5d4248[_0xd21e('0x3e')]+'%';_0x57d832[_0xd21e('0x46')][_0x3b16e0](_0xd21e('0x47'),_0x36ff30,_0x36ff30,_0x36ff30);}}else{_0xe911b0=_[_0xd21e('0x3a')](_0x24e431,['name',_0xd21e('0x48')]);_0x5d4248[_0xd21e('0xa')]=_0xd21e('0x48');_0xffd441=as[_0xd21e('0x3b')](_0x297f94,_0xe911b0['type'],_0x5d4248);_0x57d832[_0xd21e('0x46')][_0x3b16e0](_0xffd441[_0xd21e('0x3d')],_0xffd441[_0xd21e('0x3e')][_0xd21e('0x3f')],_0xffd441[_0xd21e('0x3e')][_0xd21e('0x40')]);}break;case _0xd21e('0x49'):var _0x4b5c56=_0x5d4248['value'][_0xd21e('0x45')](',')[_0xd21e('0x15')](function(_0x5b74df){return Number(_0x5b74df);});var _0xa2b1f0=parseTagParameter(_0x4b5c56);_0x57d832[_0xd21e('0x4a')][_0xd21e('0x4b')]['and'](_0xa2b1f0);_0x57d832[_0xd21e('0x4a')][_0xd21e('0x4c')]=_0x4b5c56;break;case _0xd21e('0x4d'):if(_0x5d4248[_0xd21e('0x43')]===_0xd21e('0x44')){_0x57d832[_0xd21e('0x4e')][_0x3b16e0](_0xd21e('0x4f'),'%'+_0x5d4248[_0xd21e('0x3e')]+'%',null);}else{_0xe911b0=_[_0xd21e('0x3a')](_0x24e431,[_0xd21e('0xb'),_0xd21e('0x50')]);_0x5d4248[_0xd21e('0xa')]='UserId';_0xffd441=as[_0xd21e('0x3b')](_0x297f94,_0xe911b0['type'],_0x5d4248);_0x57d832[_0xd21e('0x4e')][_0x3b16e0](_0xffd441[_0xd21e('0x3d')],_0xffd441['value'][_0xd21e('0x3f')],_0xffd441[_0xd21e('0x3e')][_0xd21e('0x40')]);}break;case _0xd21e('0x51'):case _0xd21e('0x52'):_0xffd441=as['buildExpression']('me',null,_0x5d4248);_0x57d832[_0xd21e('0x51')][_0x3b16e0](_0xffd441[_0xd21e('0x3d')],_0xffd441[_0xd21e('0x3e')][_0xd21e('0x3f')],_0xffd441['value']['end']);break;}}}return _0x57d832;}function parseModelFields(_0x138179,_0x2f8698,_0x1d8e2c){var _0x42518f=utils[_0xd21e('0x6')](_0x138179);var _0x1ca714=squel[_0xd21e('0x21')]();var _0x40d88d=_(_0x2f8698)[_0xd21e('0x53')]()['map'](function(_0x4d8ab6){return _[_0xd21e('0x54')](_0x1d8e2c,['name',_0x4d8ab6])?_0x4d8ab6:undefined;})[_0xd21e('0x55')]()[_0xd21e('0x3e')]();if(_0x40d88d['length']>0x0){_0x40d88d['forEach'](function(_0x3ca2e7){if(_0x3ca2e7===_0x42518f){_0x1ca714[_0xd21e('0x56')]('i.'+_0x42518f+_0xd21e('0x14'),[]['concat'](_0x2f8698[_0x3ca2e7]));}else if(_0x3ca2e7===_0xd21e('0x57')){var _0x8bcd9a=JSON[_0xd21e('0x58')](_0x2f8698[_0x3ca2e7])[_0xd21e('0x59')];var _0x53f281=JSON[_0xd21e('0x58')](_0x2f8698[_0x3ca2e7])[_0xd21e('0x5a')];_0x1ca714[_0xd21e('0x56')](_0xd21e('0x5b'),_0x8bcd9a,_0x53f281);}else{if(_0x2f8698[_0x3ca2e7]===_0xd21e('0x5c')){_0x1ca714[_0xd21e('0x56')]('i.'+_0x3ca2e7+_0xd21e('0x5d'));}else{_0x1ca714[_0xd21e('0x56')]('i.'+_0x3ca2e7+_0xd21e('0x5e'),_0x2f8698[_0x3ca2e7]);}}});}return _0x1ca714;}function parseQueryParameters(_0x30b5d3,_0x477372,_0xeb8152){var _0x1502df=getSqlClauses();return Promise[_0xd21e('0x5f')]()[_0xd21e('0x60')](function(){return parseModelFields(_0x30b5d3,_0x477372,_0xeb8152);})['then'](function(_0x392669){_0x1502df[_0xd21e('0x61')][_0xd21e('0x56')](_0x392669);return parseReadParameter(_0x477372[_0xd21e('0x42')]);})['then'](function(_0x1bbbcf){_0x1502df[_0xd21e('0x42')][_0xd21e('0x56')](_0x1bbbcf);return parseTagParameter(_0x477372[_0xd21e('0x62')]);})[_0xd21e('0x60')](function(_0x1a74fc){_0x1502df[_0xd21e('0x4a')]['clause'][_0xd21e('0x56')](_0x1a74fc);return parseSearchFilter(_0x30b5d3,_0x477372[_0xd21e('0x63')]);})[_0xd21e('0x60')](function(_0x26c955){_0x1502df[_0xd21e('0x63')]=_0x26c955;return _0x1502df;});}function checkAccountsRestrictions(_0x11b5bd,_0x217b82,_0x29ca04){var _0x4d03e8=utils[_0xd21e('0x6')](_0x11b5bd);var _0x3bbd03=_0xd21e('0x64')+_['capitalize'](_0x11b5bd)+(_0x11b5bd==='chat'?_0xd21e('0x65'):_0xd21e('0x66'));var _0x1c23c3=squel[_0xd21e('0x21')]();return Promise[_0xd21e('0x5f')]()['then'](function(){if(_0x29ca04[_0xd21e('0x8')]&&_0x217b82[_0xd21e('0x67')]===_0xd21e('0x7')){return _0x217b82[_0x3bbd03]({'attributes':['id'],'raw':!![]});}})['then'](function(_0xcf0cda){if(_0xcf0cda){if(_0xcf0cda[_0xd21e('0x38')]===0x0){_0x1c23c3[_0xd21e('0x56')]('i.'+_0x4d03e8+_0xd21e('0x5d'));}else{_0x1c23c3[_0xd21e('0x56')]('i.'+_0x4d03e8+_0xd21e('0x14'),_[_0xd21e('0x15')](_0xcf0cda,'id'));}}else if(!_0x29ca04[_0x4d03e8]){_0x1c23c3[_0xd21e('0x56')]('i.'+_0x4d03e8+_0xd21e('0x68'));}})['then'](function(){return _0x1c23c3;});}function getClosedOrderClause(_0xde8631,_0x4cf002){var _0x204ef7='';var _0x5330dc=[_0xd21e('0x69'),'i.secondDisposition',_0xd21e('0x6a')];if(_0xde8631===_0xd21e('0x2f')){_0x5330dc[_0xd21e('0x6b')](_0xd21e('0x6c'));}if(_0x4cf002[_0xd21e('0x6d')]==='0'&&_0xde8631==='mail'){_0x204ef7=_0xd21e('0x6c');}else{if(_0x4cf002[_0xd21e('0x6d')]==='1'){_0x5330dc['shift']();}_0x204ef7=_0xd21e('0x6e')+_0x5330dc[_0xd21e('0x6f')](',\x20')+')';}return _0x204ef7;}function getFilteredInteractions(_0x55ab7f,_0x2114ea,_0x18f8b9,_0x180c11){var _0x514791=utils[_0xd21e('0x17')](_0x55ab7f);var _0x245cb7=_['capitalize'](_0x55ab7f)+'Interaction';var _0x51d8a6=[];var _0x524a84=getTagsQuery();var _0xa3fce={'type':db[_0xd21e('0x70')][_0xd21e('0x71')][_0xd21e('0x72')],'raw':!![]};var _0x53c078=[];var _0x155a8b=[];return db[_0xd21e('0x73')][_0xd21e('0x74')](_0x524a84['toString'](),_0xa3fce)[_0xd21e('0x60')](function(_0x2d90c6){_0x51d8a6=_[_0xd21e('0x75')](_0x2d90c6,'id');_0xa3fce=_[_0xd21e('0x76')](_0xa3fce,{'model':db[_0x245cb7],'mapToModel':!![],'nest':!![]});if(_0x18f8b9['fields']){_0x180c11['attributes'][_0xd21e('0x22')](function(_0x3c4f87){_0x2114ea['field']('i.'+_0x3c4f87);});}else{_0x2114ea[_0xd21e('0xa')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0xd21e('0x41'));_0x2114ea[_0xd21e('0xa')](_0xd21e('0x77'),_0xd21e('0x78'));_0x2114ea[_0xd21e('0xa')]('a.mandatoryDisposition',_0xd21e('0x79'));if(_0x55ab7f===_0xd21e('0x2f')){_0x2114ea[_0xd21e('0xa')]('a.email',_0xd21e('0x7a'));_0x2114ea['field'](_0xd21e('0x7b'),'contactName');_0x2114ea[_0xd21e('0xa')](_0xd21e('0x7c'));_0x2114ea[_0xd21e('0xa')]('i.createdAt');_0x2114ea[_0xd21e('0xa')]('i.updatedAt');_0x2114ea[_0xd21e('0xa')]('i.closed');_0x2114ea[_0xd21e('0xa')](_0xd21e('0x7d'));_0x2114ea['field'](_0xd21e('0x7e'));_0x2114ea[_0xd21e('0xa')](_0xd21e('0x7f'));_0x2114ea[_0xd21e('0xa')](_0xd21e('0x80'));_0x2114ea['field'](_0xd21e('0x81'));_0x2114ea['field']('i.disposition');_0x2114ea['field']('i.secondDisposition');_0x2114ea[_0xd21e('0xa')](_0xd21e('0x69'));_0x2114ea[_0xd21e('0xa')]('i.substatus');_0x2114ea['field'](_0xd21e('0x82'));_0x2114ea[_0xd21e('0xa')](_0xd21e('0x83'));_0x2114ea[_0xd21e('0xa')](_0xd21e('0x84'));_0x2114ea['field'](_0xd21e('0x85'));}else if(_0x55ab7f===_0xd21e('0x2d')){_0x2114ea[_0xd21e('0xa')]('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',_0xd21e('0x86'));}else{_0x2114ea[_0xd21e('0xa')](_0xd21e('0x87'),_0xd21e('0x86'));}if(_0x55ab7f!==_0xd21e('0x2f')){_0x2114ea[_0xd21e('0xa')]('i.*');}_0x2114ea[_0xd21e('0xa')](_0xd21e('0x88'),_0xd21e('0x89'));_0x2114ea[_0xd21e('0xa')](_0xd21e('0x8a'),_0xd21e('0x8b'));_0x2114ea[_0xd21e('0xa')](_0xd21e('0x8c'),'Contact.email');_0x2114ea['field'](_0xd21e('0x8d'),'Contact.phone');_0x2114ea['field'](_0xd21e('0x8e'),_0xd21e('0x8f'));_0x2114ea[_0xd21e('0xa')]('c.fax',_0xd21e('0x90'));_0x2114ea[_0xd21e('0xa')]('o.fullname',_0xd21e('0x91'));_0x2114ea[_0xd21e('0xa')](_0xd21e('0x92'),_0xd21e('0x93'));_0x2114ea[_0xd21e('0xa')](_0xd21e('0x94'),'TagIds');}if(_0x180c11[_0xd21e('0x95')]){_0x2114ea[_0xd21e('0x95')](_0x180c11[_0xd21e('0x95')]);}if(_0x180c11['offset']){_0x2114ea[_0xd21e('0x96')](_0x180c11[_0xd21e('0x96')]);}return db[_0xd21e('0x73')][_0xd21e('0x74')](_0x2114ea[_0xd21e('0x97')](),_0xa3fce);})[_0xd21e('0x60')](function(_0x5efae1){_0x53c078=_0x5efae1;var _0x49235e=getUsersQuery(_0x55ab7f,_0x53c078);return db['sequelize'][_0xd21e('0x74')](_0x49235e['toString'](),_0xa3fce);})[_0xd21e('0x60')](function(_0xf53c5b){_0x155a8b=_[_0xd21e('0x98')](_0xf53c5b,_0x514791);if(_0x55ab7f===_0xd21e('0x2f')){return db[_0xd21e('0x99')][_0xd21e('0x9a')]({'attributes':[_0xd21e('0x9b')],'raw':!![]});}})[_0xd21e('0x60')](function(_0x263eb1){var _0x58c2c6=_0x263eb1?_0x263eb1['enableEmailPreview']:undefined;var _0x1f8c7c=_0x53c078[_0xd21e('0x15')](function(_0x2a8c7f){return updateInteraction(_0x2a8c7f,_0x51d8a6,_0x155a8b,_0x58c2c6);});return Promise[_0xd21e('0x9c')](_0x1f8c7c);});}function countFilteredInteractions(_0x392de3,_0x3e1f81){var _0x361e19=_0x392de3['clone']();_0x361e19['field'](_0xd21e('0x9d'));_0x361e19[_0xd21e('0xa')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0xd21e('0x41'));var _0x15241b=utils[_0xd21e('0x9e')](_0x3e1f81);if(!_[_0xd21e('0x9f')](_0x15241b)){_0x361e19['where'](_0xd21e('0xa0'),_0x15241b);}var _0x4207f1={'type':db[_0xd21e('0x70')][_0xd21e('0x71')]['SELECT'],'raw':!![]};return db['sequelize']['query'](_0x361e19[_0xd21e('0x97')](),_0x4207f1);}module['exports']={'checkAccountsRestrictions':checkAccountsRestrictions,'countFilteredInteractions':countFilteredInteractions,'getClosedOrderClause':getClosedOrderClause,'getFilteredInteractions':getFilteredInteractions,'getInteractionsQuery':getInteractionsQuery,'parseAdvancedSearchFilter':parseAdvancedSearchFilter,'parseQueryParameters':parseQueryParameters,'skipInteractionsQuery':skipInteractionsQuery}; \ No newline at end of file +var _0x346b=['SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','Account.key','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.attach','i.lastMsgDirection','i.subject','i.secondDisposition','i.to','i.ContactId','i.MailAccountId','i.UserId','openchannel','i.*','c.firstName','Contact.firstName','c.lastName','Contact.lastName','Contact.email','c.phone','Contact.phone','c.mobile','c.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','TagIds','limit','offset','groupBy','findOne','enableEmailPreview','all','clone','COUNT(*)','isEmpty','t.id\x20IN\x20?','lodash','squel','../parsers/advancedSearch','../parsers/qs','./update-interaction','updateInteraction','./utils','getAccountFK','role','agent','search','select','field','color','from','tools_tags','getInteractionFK','user_has_','_interactions','u.id','u.fullname','left_join','users','u.id\x20=\x20ui.UserId','length','where','ui.','\x20IN\x20?','map','getInteractionsTables','interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','accounts','a.id\x20=\x20i.','messages','\x20=\x20i.id','interactionsTags','it.','expr','getSelectedTags','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','replace','{OPERATOR}','i.id\x20LIKE\x20?','sms','whatsapp','includes','fax','i.fax\x20LIKE\x20?','i.from\x20LIKE\x20?','mail','isEmail','c.email\x20LIKE\x20?','MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','conditions','find','name','buildExpression','type','text','start','value','end','unreadMessages','read','operator','$substring','split','contact','ContactId','tags','and','ids','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','user','plainBody','compact','concat','createdAt','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','\x20IS\x20NULL','\x20=\x20?','resolve','then','fields','filter','get','chat','Websites','Accounts','\x20IS\x20NOT\x20NULL','i.thirdDisposition','i.disposition','unshift','i.substatus','closed','shift','CONCAT_WS(\x27\x27,\x20','join','Interaction','Sequelize','QueryTypes','sequelize','query','toString','merge','attributes'];(function(_0x2ef44b,_0x553359){var _0x2405b9=function(_0x278290){while(--_0x278290){_0x2ef44b['push'](_0x2ef44b['shift']());}};_0x2405b9(++_0x553359);}(_0x346b,0x171));var _0xb346=function(_0x365046,_0x17d398){_0x365046=_0x365046-0x0;var _0x117548=_0x346b[_0x365046];return _0x117548;};'use strict';var _=require(_0xb346('0x0'));var squel=require(_0xb346('0x1'));var as=require(_0xb346('0x2'));var qs=require(_0xb346('0x3'));var updateInteraction=require(_0xb346('0x4'))[_0xb346('0x5')];var utils=require(_0xb346('0x6'));var db=require('../../mysqldb')['db'];function skipInteractionsQuery(_0x16e49b,_0xede466,_0x2e8da3){var _0x359c6e=![];var _0x1b4ec9=utils[_0xb346('0x7')](_0x16e49b);if(_0xede466[_0xb346('0x8')]===_0xb346('0x9')&&!_0x2e8da3[_0xb346('0xa')]&&!_0x2e8da3[_0x1b4ec9]){_0x359c6e=!![];}return _0x359c6e;}function getTagsQuery(){return squel[_0xb346('0xb')]()[_0xb346('0xc')]('id')['field']('name')[_0xb346('0xc')](_0xb346('0xd'))[_0xb346('0xe')](_0xb346('0xf'));}function getUsersQuery(_0xc09366,_0x369f27){var _0x15fe2f=utils[_0xb346('0x10')](_0xc09366);var _0x542715=_0xb346('0x11')+_0xc09366+_0xb346('0x12');var _0x5c375d=squel['select']()[_0xb346('0xc')](_0xb346('0x13'))[_0xb346('0xc')](_0xb346('0x14'))['field']('ui.'+_0x15fe2f)[_0xb346('0xe')](_0x542715,'ui')[_0xb346('0x15')](_0xb346('0x16'),'u',_0xb346('0x17'));if(_0x369f27[_0xb346('0x18')]>0x0){_0x5c375d[_0xb346('0x19')](_0xb346('0x1a')+_0x15fe2f+_0xb346('0x1b'),_[_0xb346('0x1c')](_0x369f27,'id'));}return _0x5c375d;}function getInteractionsQuery(_0x3899bd){var _0x253dd6=utils[_0xb346('0x1d')](_0x3899bd);var _0x517165=utils['getAccountFK'](_0x3899bd);var _0x387d8f=utils[_0xb346('0x10')](_0x3899bd);return squel['select']()[_0xb346('0xe')](_0x253dd6[_0xb346('0x1e')],'i')[_0xb346('0x15')](_0xb346('0x1f'),'c',_0xb346('0x20'))['left_join'](_0xb346('0x16'),'o',_0xb346('0x21'))[_0xb346('0x15')](_0x253dd6[_0xb346('0x22')],'a',_0xb346('0x23')+_0x517165)[_0xb346('0x15')](_0x253dd6[_0xb346('0x24')],'me','me.'+_0x387d8f+_0xb346('0x25'))[_0xb346('0x15')](_0x253dd6[_0xb346('0x26')],'it',_0xb346('0x27')+_0x387d8f+_0xb346('0x25'))[_0xb346('0x15')](_0xb346('0xf'),'t','t.id\x20=\x20it.TagId');}function getSqlClauses(){var _0x5af83c={'body':squel[_0xb346('0x28')](),'contact':squel['expr'](),'default':squel[_0xb346('0x28')](),'fields':squel[_0xb346('0x28')](),'filter':squel[_0xb346('0x28')](),'read':squel[_0xb346('0x28')](),'tags':{'clause':squel[_0xb346('0x28')](),'ids':null},'user':squel[_0xb346('0x28')]()};return _0x5af83c;}function parseTagParameter(_0x1c3f9e){var _0x3e7494=squel[_0xb346('0x28')]();if(_0x1c3f9e){var _0x42953e=utils[_0xb346('0x29')](_0x1c3f9e);_0x42953e[_0xb346('0x2a')](function(_0x37603c){_0x3e7494['or'](_0xb346('0x2b'),'%,'+_0x37603c+',%');});}return _0x3e7494;}function parseReadParameter(_0x5d47c4){var _0x4d29f9='';if(_0x5d47c4){_0x4d29f9='unreadMessages\x20{OPERATOR}\x200';if(_0x5d47c4==='1'){_0x4d29f9=_0x4d29f9[_0xb346('0x2c')](_0xb346('0x2d'),'=');}else{_0x4d29f9=_0x4d29f9['replace'](_0xb346('0x2d'),'>');}}return _0x4d29f9;}function parseSearchFilter(_0x3709fd,_0x2e682e){var _0xe1cd26=squel[_0xb346('0x28')]();if(_0x2e682e){var _0x1a82aa=_0x2e682e[_0xb346('0x2c')]('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(qs['isNumeric'](_0x1a82aa)){_0xe1cd26['or'](_0xb346('0x2e'),_0x1a82aa+'%');if([_0xb346('0x2f'),_0xb346('0x30')][_0xb346('0x31')](_0x3709fd)){_0xe1cd26['or']('i.phone\x20LIKE\x20?',_0x1a82aa+'%');}else if(_0x3709fd===_0xb346('0x32')){_0xe1cd26['or'](_0xb346('0x33'),_0x1a82aa+'%');}else if(_0x3709fd==='openchannel'){_0xe1cd26['or'](_0xb346('0x34'),_0x1a82aa+'%');}}else if(_0x3709fd===_0xb346('0x35')&&qs[_0xb346('0x36')](_0x1a82aa)){_0xe1cd26['or'](_0xb346('0x37'),_0x1a82aa+'%');}else{if(_0x3709fd==='mail'){_0xe1cd26['or']('MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs['getFullTextValue'](_0x1a82aa,!![]))['or'](_0xb346('0x38'),qs['getFullTextValue'](_0x1a82aa));}else if(_0x3709fd!=='fax'){_0xe1cd26['or'](_0xb346('0x39'),qs[_0xb346('0x3a')](_0x1a82aa));}_0xe1cd26['or'](_0xb346('0x3b'),qs[_0xb346('0x3a')](_0x1a82aa,!![]),null);}}return _0xe1cd26;}function parseAdvancedSearchFilter(_0x2229a7,_0x416e4d){var _0x16e90e=getSqlClauses();var _0x472ea6=as['parseSearch'](_0x2229a7);var _0x321222=_0x472ea6['sqlOperator'];for(var _0x40c761=0x0;_0x40c761<_0x472ea6[_0xb346('0x3c')][_0xb346('0x18')];_0x40c761++){var _0x53d8d8=_0x472ea6['conditions'][_0x40c761];var _0x52657a='i';var _0x1cd462=_[_0xb346('0x3d')](_0x416e4d,[_0xb346('0x3e'),_0x53d8d8[_0xb346('0xc')]]);if(_0x1cd462){var _0x2713ac=as[_0xb346('0x3f')](_0x52657a,_0x1cd462[_0xb346('0x40')],_0x53d8d8);_0x16e90e['default'][_0x321222](_0x2713ac[_0xb346('0x41')],_0x2713ac['value'][_0xb346('0x42')],_0x2713ac[_0xb346('0x43')][_0xb346('0x44')]);}else{switch(_0x53d8d8[_0xb346('0xc')]){case _0xb346('0x45'):var _0x4d0214=parseReadParameter(_0x53d8d8[_0xb346('0x43')]);_0x16e90e[_0xb346('0x46')]['and'](_0x4d0214);break;case'Contact':if(_0x53d8d8[_0xb346('0x47')]===_0xb346('0x48')){if(_0x53d8d8[_0xb346('0x43')][_0xb346('0x49')]('\x20')[_0xb346('0x18')]>0x1){_0x16e90e['contact'][_0x321222](_0xb346('0x3b'),qs['getFullTextValue'](_0x53d8d8[_0xb346('0x43')],!![]),null);}else{var _0x286573='%'+_0x53d8d8[_0xb346('0x43')]+'%';_0x16e90e[_0xb346('0x4a')][_0x321222]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x286573,_0x286573,_0x286573);}}else{_0x1cd462=_[_0xb346('0x3d')](_0x416e4d,['name',_0xb346('0x4b')]);_0x53d8d8[_0xb346('0xc')]=_0xb346('0x4b');_0x2713ac=as[_0xb346('0x3f')](_0x52657a,_0x1cd462[_0xb346('0x40')],_0x53d8d8);_0x16e90e[_0xb346('0x4a')][_0x321222](_0x2713ac[_0xb346('0x41')],_0x2713ac[_0xb346('0x43')]['start'],_0x2713ac[_0xb346('0x43')][_0xb346('0x44')]);}break;case'Tag':var _0x1da3ab=_0x53d8d8[_0xb346('0x43')][_0xb346('0x49')](',')[_0xb346('0x1c')](function(_0x2717f3){return Number(_0x2717f3);});var _0x490f1b=parseTagParameter(_0x1da3ab);_0x16e90e[_0xb346('0x4c')]['clause'][_0xb346('0x4d')](_0x490f1b);_0x16e90e[_0xb346('0x4c')][_0xb346('0x4e')]=_0x1da3ab;break;case _0xb346('0x4f'):if(_0x53d8d8[_0xb346('0x47')]===_0xb346('0x48')){_0x16e90e['user'][_0x321222](_0xb346('0x50'),'%'+_0x53d8d8['value']+'%',null);}else{_0x1cd462=_['find'](_0x416e4d,[_0xb346('0x3e'),_0xb346('0x51')]);_0x53d8d8[_0xb346('0xc')]='UserId';_0x2713ac=as[_0xb346('0x3f')](_0x52657a,_0x1cd462[_0xb346('0x40')],_0x53d8d8);_0x16e90e[_0xb346('0x52')][_0x321222](_0x2713ac[_0xb346('0x41')],_0x2713ac['value'][_0xb346('0x42')],_0x2713ac['value']['end']);}break;case'body':case _0xb346('0x53'):_0x2713ac=as[_0xb346('0x3f')]('me',null,_0x53d8d8);_0x16e90e['body'][_0x321222](_0x2713ac['text'],_0x2713ac[_0xb346('0x43')][_0xb346('0x42')],_0x2713ac[_0xb346('0x43')][_0xb346('0x44')]);break;}}}return _0x16e90e;}function parseModelFields(_0x41d995,_0x3b5fed,_0x462a4f){var _0x12bdce=utils[_0xb346('0x7')](_0x41d995);var _0x400831=squel[_0xb346('0x28')]();var _0x2e061a=_(_0x3b5fed)['keys']()[_0xb346('0x1c')](function(_0x1edec2){return _['some'](_0x462a4f,[_0xb346('0x3e'),_0x1edec2])?_0x1edec2:undefined;})[_0xb346('0x54')]()[_0xb346('0x43')]();if(_0x2e061a[_0xb346('0x18')]>0x0){_0x2e061a['forEach'](function(_0x30e7d4){if(_0x30e7d4===_0x12bdce){_0x400831[_0xb346('0x4d')]('i.'+_0x12bdce+'\x20IN\x20?',[][_0xb346('0x55')](_0x3b5fed[_0x30e7d4]));}else if(_0x30e7d4===_0xb346('0x56')){var _0x542e64=JSON['parse'](_0x3b5fed[_0x30e7d4])[_0xb346('0x57')];var _0x1dbf71=JSON['parse'](_0x3b5fed[_0x30e7d4])[_0xb346('0x58')];_0x400831[_0xb346('0x4d')](_0xb346('0x59'),_0x542e64,_0x1dbf71);}else{if(_0x3b5fed[_0x30e7d4]==='null'){_0x400831[_0xb346('0x4d')]('i.'+_0x30e7d4+_0xb346('0x5a'));}else{_0x400831[_0xb346('0x4d')]('i.'+_0x30e7d4+_0xb346('0x5b'),_0x3b5fed[_0x30e7d4]);}}});}return _0x400831;}function parseQueryParameters(_0x564fa0,_0x11b4a0,_0x33005f){var _0x35f1f0=getSqlClauses();return Promise[_0xb346('0x5c')]()[_0xb346('0x5d')](function(){return parseModelFields(_0x564fa0,_0x11b4a0,_0x33005f);})['then'](function(_0x4b79c2){_0x35f1f0[_0xb346('0x5e')][_0xb346('0x4d')](_0x4b79c2);return parseReadParameter(_0x11b4a0[_0xb346('0x46')]);})[_0xb346('0x5d')](function(_0x1ab9d9){_0x35f1f0['read'][_0xb346('0x4d')](_0x1ab9d9);return parseTagParameter(_0x11b4a0['tag']);})[_0xb346('0x5d')](function(_0x462530){_0x35f1f0[_0xb346('0x4c')]['clause']['and'](_0x462530);return parseSearchFilter(_0x564fa0,_0x11b4a0[_0xb346('0x5f')]);})[_0xb346('0x5d')](function(_0x1ec6be){_0x35f1f0[_0xb346('0x5f')]=_0x1ec6be;return _0x35f1f0;});}function checkAccountsRestrictions(_0x2bdd3c,_0x35f4b0,_0x38b239){var _0x212638=utils[_0xb346('0x7')](_0x2bdd3c);var _0x974fd6=_0xb346('0x60')+_['capitalize'](_0x2bdd3c)+(_0x2bdd3c===_0xb346('0x61')?_0xb346('0x62'):_0xb346('0x63'));var _0x49db7d=squel[_0xb346('0x28')]();return Promise[_0xb346('0x5c')]()[_0xb346('0x5d')](function(){if(_0x38b239[_0xb346('0xa')]&&_0x35f4b0[_0xb346('0x8')]===_0xb346('0x9')){return _0x35f4b0[_0x974fd6]({'attributes':['id'],'raw':!![]});}})['then'](function(_0x15fe75){if(_0x15fe75){if(_0x15fe75['length']===0x0){_0x49db7d[_0xb346('0x4d')]('i.'+_0x212638+_0xb346('0x5a'));}else{_0x49db7d[_0xb346('0x4d')]('i.'+_0x212638+_0xb346('0x1b'),_['map'](_0x15fe75,'id'));}}else if(!_0x38b239[_0x212638]){_0x49db7d[_0xb346('0x4d')]('i.'+_0x212638+_0xb346('0x64'));}})[_0xb346('0x5d')](function(){return _0x49db7d;});}function getClosedOrderClause(_0x3b7908,_0x5a99e8){var _0x2f12d4='';var _0x1cf984=[_0xb346('0x65'),'i.secondDisposition',_0xb346('0x66')];if(_0x3b7908===_0xb346('0x35')){_0x1cf984[_0xb346('0x67')](_0xb346('0x68'));}if(_0x5a99e8[_0xb346('0x69')]==='0'&&_0x3b7908===_0xb346('0x35')){_0x2f12d4=_0xb346('0x68');}else{if(_0x5a99e8['closed']==='1'){_0x1cf984[_0xb346('0x6a')]();}_0x2f12d4=_0xb346('0x6b')+_0x1cf984[_0xb346('0x6c')](',\x20')+')';}return _0x2f12d4;}function getFilteredInteractions(_0x528dc7,_0x4a0c78,_0x3924b3,_0x439b52){var _0x1093c3=utils['getInteractionFK'](_0x528dc7);var _0x378807=_['capitalize'](_0x528dc7)+_0xb346('0x6d');var _0x4df3d2=[];var _0x4209f4=getTagsQuery();var _0x477408={'type':db[_0xb346('0x6e')][_0xb346('0x6f')]['SELECT'],'raw':!![]};var _0x16b5a0=[];var _0x9a892d=[];return db[_0xb346('0x70')][_0xb346('0x71')](_0x4209f4[_0xb346('0x72')](),_0x477408)[_0xb346('0x5d')](function(_0x3be7b1){_0x4df3d2=_['keyBy'](_0x3be7b1,'id');_0x477408=_[_0xb346('0x73')](_0x477408,{'model':db[_0x378807],'mapToModel':!![],'nest':!![]});if(_0x3924b3[_0xb346('0x5e')]){_0x439b52[_0xb346('0x74')][_0xb346('0x2a')](function(_0x33f5cd){_0x4a0c78[_0xb346('0xc')]('i.'+_0x33f5cd);});}else{_0x4a0c78[_0xb346('0xc')](_0xb346('0x75'),_0xb346('0x45'));_0x4a0c78['field']('a.key',_0xb346('0x76'));_0x4a0c78[_0xb346('0xc')]('a.mandatoryDisposition',_0xb346('0x77'));if(_0x528dc7===_0xb346('0x35')){_0x4a0c78[_0xb346('0xc')](_0xb346('0x78'),_0xb346('0x79'));_0x4a0c78['field'](_0xb346('0x7a'),_0xb346('0x7b'));_0x4a0c78[_0xb346('0xc')](_0xb346('0x7c'));_0x4a0c78[_0xb346('0xc')](_0xb346('0x7d'));_0x4a0c78[_0xb346('0xc')]('i.updatedAt');_0x4a0c78[_0xb346('0xc')](_0xb346('0x7e'));_0x4a0c78['field']('i.closedAt');_0x4a0c78[_0xb346('0xc')](_0xb346('0x7f'));_0x4a0c78[_0xb346('0xc')]('i.lastMsgAt');_0x4a0c78['field'](_0xb346('0x80'));_0x4a0c78['field'](_0xb346('0x81'));_0x4a0c78[_0xb346('0xc')](_0xb346('0x66'));_0x4a0c78[_0xb346('0xc')](_0xb346('0x82'));_0x4a0c78['field']('i.thirdDisposition');_0x4a0c78['field'](_0xb346('0x68'));_0x4a0c78[_0xb346('0xc')](_0xb346('0x83'));_0x4a0c78[_0xb346('0xc')](_0xb346('0x84'));_0x4a0c78[_0xb346('0xc')](_0xb346('0x85'));_0x4a0c78[_0xb346('0xc')](_0xb346('0x86'));}else if(_0x528dc7===_0xb346('0x87')){_0x4a0c78[_0xb346('0xc')]('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',_0xb346('0x7b'));}else{_0x4a0c78[_0xb346('0xc')]('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',_0xb346('0x7b'));}if(_0x528dc7!==_0xb346('0x35')){_0x4a0c78['field'](_0xb346('0x88'));}_0x4a0c78['field'](_0xb346('0x89'),_0xb346('0x8a'));_0x4a0c78[_0xb346('0xc')](_0xb346('0x8b'),_0xb346('0x8c'));_0x4a0c78[_0xb346('0xc')]('c.email',_0xb346('0x8d'));_0x4a0c78[_0xb346('0xc')](_0xb346('0x8e'),_0xb346('0x8f'));_0x4a0c78[_0xb346('0xc')](_0xb346('0x90'),'Contact.mobile');_0x4a0c78['field'](_0xb346('0x91'),'Contact.fax');_0x4a0c78[_0xb346('0xc')](_0xb346('0x92'),_0xb346('0x93'));_0x4a0c78[_0xb346('0xc')](_0xb346('0x94'),_0xb346('0x95'));_0x4a0c78[_0xb346('0xc')](_0xb346('0x96'),_0xb346('0x97'));}if(_0x439b52['limit']){_0x4a0c78[_0xb346('0x98')](_0x439b52['limit']);}if(_0x439b52[_0xb346('0x99')]){_0x4a0c78[_0xb346('0x99')](_0x439b52[_0xb346('0x99')]);}return db[_0xb346('0x70')][_0xb346('0x71')](_0x4a0c78[_0xb346('0x72')](),_0x477408);})[_0xb346('0x5d')](function(_0x17912f){_0x16b5a0=_0x17912f;var _0x32894e=getUsersQuery(_0x528dc7,_0x16b5a0);return db[_0xb346('0x70')][_0xb346('0x71')](_0x32894e[_0xb346('0x72')](),_0x477408);})[_0xb346('0x5d')](function(_0x3a7cc5){_0x9a892d=_[_0xb346('0x9a')](_0x3a7cc5,_0x1093c3);if(_0x528dc7==='mail'){return db['Setting'][_0xb346('0x9b')]({'attributes':[_0xb346('0x9c')],'raw':!![]});}})[_0xb346('0x5d')](function(_0x4a28a1){var _0x38dc0f=_0x4a28a1?_0x4a28a1['enableEmailPreview']:undefined;var _0xece2d=_0x16b5a0[_0xb346('0x1c')](function(_0x4153a6){return updateInteraction(_0x4153a6,_0x4df3d2,_0x9a892d,_0x38dc0f);});return Promise[_0xb346('0x9d')](_0xece2d);});}function countFilteredInteractions(_0x3133fe,_0x4c4d67){var _0x1ca02b=_0x3133fe[_0xb346('0x9e')]();_0x1ca02b[_0xb346('0xc')](_0xb346('0x9f'));_0x1ca02b[_0xb346('0xc')](_0xb346('0x75'),_0xb346('0x45'));var _0x31e2d9=utils['getSelectedTags'](_0x4c4d67);if(!_[_0xb346('0xa0')](_0x31e2d9)){_0x1ca02b[_0xb346('0x19')](_0xb346('0xa1'),_0x31e2d9);}var _0x31a230={'type':db[_0xb346('0x6e')][_0xb346('0x6f')]['SELECT'],'raw':!![]};return db[_0xb346('0x70')][_0xb346('0x71')](_0x1ca02b[_0xb346('0x72')](),_0x31a230);}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 397e991..124133c 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 _0x51d4=['../../mysqldb','map','fullname','split','push','waiting','talking','answered','unmanaged','abandoned','total','closed','disposition','UserId','findOne','out','plainBody','lastMsgText','trimStart','catch','updateInteraction','then','TagIds','lodash'];(function(_0x307b82,_0x3b0016){var _0x41f399=function(_0x524d0c){while(--_0x524d0c){_0x307b82['push'](_0x307b82['shift']());}};_0x41f399(++_0x3b0016);}(_0x51d4,0x17f));var _0x451d=function(_0xce5ae8,_0xf5b703){_0xce5ae8=_0xce5ae8-0x0;var _0x320398=_0x51d4[_0xce5ae8];return _0x320398;};'use strict';var _=require(_0x451d('0x0'));var db=require(_0x451d('0x1'))['db'];function getInteractionUsers(_0x3f0ed4,_0x39536d){return new Promise(function(_0x16f06f,_0x39c754){try{var _0x3ce393=[];if(_0x39536d[_0x3f0ed4]){_0x3ce393=_0x39536d[_0x3f0ed4][_0x451d('0x2')](function(_0x2cd922){return{'id':_0x2cd922['id'],'fullname':_0x2cd922[_0x451d('0x3')]};});}return _0x16f06f(_0x3ce393);}catch(_0x598532){_0x39c754(_0x598532);}});}function getInteractionTags(_0x60070b,_0x3897b5){var _0x21d553=[];if(_0x60070b){_0x60070b[_0x451d('0x4')](',')['forEach'](function(_0x22983e){_0x21d553[_0x451d('0x5')](_0x3897b5[_0x22983e]);});}return _0x21d553;}function updateWaitingCounter(_0xd3f195){if(_0xd3f195['waiting']){_0xd3f195[_0x451d('0x6')]-=0x1;}}function updateInteractionCounters(_0x4754ea){_0x4754ea[_0x451d('0x6')]=0x0;_0x4754ea[_0x451d('0x7')]=0x0;_0x4754ea[_0x451d('0x8')]=0x0;_0x4754ea[_0x451d('0x9')]=0x0;_0x4754ea[_0x451d('0xa')]=0x0;_0x4754ea[_0x451d('0xb')]=0x0;if(_0x4754ea[_0x451d('0xc')]){if(_0x4754ea[_0x451d('0xd')]===_0x451d('0xa')){_0x4754ea['abandoned']+=0x1;updateWaitingCounter(_0x4754ea);}if(_0x4754ea[_0x451d('0xe')]){_0x4754ea[_0x451d('0x8')]+=0x1;if(_0x4754ea[_0x451d('0x7')]){_0x4754ea[_0x451d('0x7')]-=0x1;}}else{if(_0x4754ea[_0x451d('0xd')]){_0x4754ea['unmanaged']+=0x1;updateWaitingCounter(_0x4754ea);}}}else{if(!_0x4754ea['UserId']){_0x4754ea[_0x451d('0x6')]+=0x1;}if(_0x4754ea[_0x451d('0xe')]){_0x4754ea[_0x451d('0x7')]+=0x1;updateWaitingCounter(_0x4754ea);}}_0x4754ea[_0x451d('0xb')]+=0x1;return _0x4754ea;}function getLastMessageText(_0x1da595){return db['MailMessage'][_0x451d('0xf')]({'where':{'$and':[{'MailInteractionId':_0x1da595['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':_0x451d('0x10')},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':[_0x451d('0x11')],'order':'-id','raw':!![]})['then'](function(_0x5f1287){if(_0x5f1287&&_0x5f1287[_0x451d('0x11')]){_0x1da595[_0x451d('0x12')]=_[_0x451d('0x13')](_0x5f1287['plainBody']);}return _0x1da595;})[_0x451d('0x14')](function(_0x2a63c8){throw _0x2a63c8;});}exports[_0x451d('0x15')]=function(_0x4cf746,_0x412bff,_0x24e2c0,_0x9a6776){return new Promise(function(_0x2e11c3,_0x370557){return getInteractionUsers(_0x4cf746['id'],_0x24e2c0)['then'](function(_0x35854e){_0x4cf746['Users']=_0x35854e;return getInteractionTags(_0x4cf746['TagIds'],_0x412bff);})[_0x451d('0x16')](function(_0x2589f2){_0x4cf746['Tags']=_0x2589f2;delete _0x4cf746[_0x451d('0x17')];return updateInteractionCounters(_0x4cf746);})[_0x451d('0x16')](function(_0x47a3bd){if(_0x9a6776){return getLastMessageText(_0x47a3bd);}else{return _0x47a3bd;}})[_0x451d('0x16')](function(_0x59a7b0){_0x2e11c3(_0x59a7b0);})['catch'](function(_0x784f4a){_0x370557(_0x784f4a);});});}; \ No newline at end of file +var _0x88b3=['push','waiting','talking','answered','unmanaged','abandoned','total','closed','disposition','UserId','MailMessage','findOne','out','plainBody','-id','lastMsgText','trimStart','catch','then','Users','TagIds','Tags','lodash','../../mysqldb','map','split','forEach'];(function(_0x44166f,_0x3e71e2){var _0x5f390a=function(_0x4876fb){while(--_0x4876fb){_0x44166f['push'](_0x44166f['shift']());}};_0x5f390a(++_0x3e71e2);}(_0x88b3,0x67));var _0x388b=function(_0x4face7,_0x329177){_0x4face7=_0x4face7-0x0;var _0x159b31=_0x88b3[_0x4face7];return _0x159b31;};'use strict';var _=require(_0x388b('0x0'));var db=require(_0x388b('0x1'))['db'];function getInteractionUsers(_0x46860c,_0x3e9bd7){return new Promise(function(_0x29527c,_0x20c493){try{var _0x531bcb=[];if(_0x3e9bd7[_0x46860c]){_0x531bcb=_0x3e9bd7[_0x46860c][_0x388b('0x2')](function(_0x1e44aa){return{'id':_0x1e44aa['id'],'fullname':_0x1e44aa['fullname']};});}return _0x29527c(_0x531bcb);}catch(_0x5e2bcf){_0x20c493(_0x5e2bcf);}});}function getInteractionTags(_0x595384,_0x472b57){var _0x4013f0=[];if(_0x595384){_0x595384[_0x388b('0x3')](',')[_0x388b('0x4')](function(_0x3780ba){_0x4013f0[_0x388b('0x5')](_0x472b57[_0x3780ba]);});}return _0x4013f0;}function updateWaitingCounter(_0x13a0b5){if(_0x13a0b5[_0x388b('0x6')]){_0x13a0b5['waiting']-=0x1;}}function updateInteractionCounters(_0x52f01a){_0x52f01a[_0x388b('0x6')]=0x0;_0x52f01a[_0x388b('0x7')]=0x0;_0x52f01a[_0x388b('0x8')]=0x0;_0x52f01a[_0x388b('0x9')]=0x0;_0x52f01a[_0x388b('0xa')]=0x0;_0x52f01a[_0x388b('0xb')]=0x0;if(_0x52f01a[_0x388b('0xc')]){if(_0x52f01a[_0x388b('0xd')]===_0x388b('0xa')){_0x52f01a[_0x388b('0xa')]+=0x1;updateWaitingCounter(_0x52f01a);}if(_0x52f01a[_0x388b('0xe')]){_0x52f01a[_0x388b('0x8')]+=0x1;if(_0x52f01a[_0x388b('0x7')]){_0x52f01a['talking']-=0x1;}}else{if(_0x52f01a[_0x388b('0xd')]){_0x52f01a[_0x388b('0x9')]+=0x1;updateWaitingCounter(_0x52f01a);}}}else{if(!_0x52f01a['UserId']){_0x52f01a[_0x388b('0x6')]+=0x1;}if(_0x52f01a[_0x388b('0xe')]){_0x52f01a[_0x388b('0x7')]+=0x1;updateWaitingCounter(_0x52f01a);}}_0x52f01a[_0x388b('0xb')]+=0x1;return _0x52f01a;}function getLastMessageText(_0x5ad5b7){return db[_0x388b('0xf')][_0x388b('0x10')]({'where':{'$and':[{'MailInteractionId':_0x5ad5b7['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':_0x388b('0x11')},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':[_0x388b('0x12')],'order':_0x388b('0x13'),'raw':!![]})['then'](function(_0x5c8def){if(_0x5c8def&&_0x5c8def[_0x388b('0x12')]){_0x5ad5b7[_0x388b('0x14')]=_[_0x388b('0x15')](_0x5c8def[_0x388b('0x12')]);}return _0x5ad5b7;})[_0x388b('0x16')](function(_0x380789){throw _0x380789;});}exports['updateInteraction']=function(_0x458c47,_0x4e8cac,_0xfde9d,_0x534a69){return new Promise(function(_0x38cb4d,_0x55543a){return getInteractionUsers(_0x458c47['id'],_0xfde9d)[_0x388b('0x17')](function(_0x50a63f){_0x458c47[_0x388b('0x18')]=_0x50a63f;return getInteractionTags(_0x458c47[_0x388b('0x19')],_0x4e8cac);})['then'](function(_0x3d1660){_0x458c47[_0x388b('0x1a')]=_0x3d1660;delete _0x458c47['TagIds'];return updateInteractionCounters(_0x458c47);})['then'](function(_0x2b7fe0){if(_0x534a69){return getLastMessageText(_0x2b7fe0);}else{return _0x2b7fe0;}})['then'](function(_0x51365d){_0x38cb4d(_0x51365d);})[_0x388b('0x16')](function(_0xb8b508){_0x55543a(_0xb8b508);});});}; \ No newline at end of file diff --git a/server/components/interaction/utils.js b/server/components/interaction/utils.js index 6a0c516..2d3dab4 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 _0xd4bd=['Interaction','findOne','update','then','info','catch','exports','../../mysqldb','../../config/logger','fax-interactions','whatsapp-interactions','capitalize','chat','Website','Account','InteractionId','upperFirst','unknown','_interaction_has_tags','_messages','user_has_','_interactions','isArray','toLowerCase','[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','toUpperCase','role','null'];(function(_0x6c993a,_0x5ea3ab){var _0x27f547=function(_0x22df20){while(--_0x22df20){_0x6c993a['push'](_0x6c993a['shift']());}};_0x27f547(++_0x5ea3ab);}(_0xd4bd,0x1e3));var _0xdd4b=function(_0x48ca9d,_0x141284){_0x48ca9d=_0x48ca9d-0x0;var _0x451301=_0xd4bd[_0x48ca9d];return _0x451301;};'use strict';var _=require('lodash');var db=require(_0xdd4b('0x0'))['db'];var loggers={'openchannel':require(_0xdd4b('0x1'))('openchannel-interactions'),'mail':require(_0xdd4b('0x1'))('mail-interactions'),'fax':require(_0xdd4b('0x1'))(_0xdd4b('0x2')),'sms':require(_0xdd4b('0x1'))('sms-interactions'),'chat':require('../../config/logger')('chat-interactions'),'whatsapp':require(_0xdd4b('0x1'))(_0xdd4b('0x3'))};function getAccountFK(_0x559d9b){return _[_0xdd4b('0x4')](_0x559d9b)+(_0x559d9b===_0xdd4b('0x5')?_0xdd4b('0x6'):_0xdd4b('0x7'))+'Id';}function getInteractionFK(_0x3c3e8a){return _[_0xdd4b('0x4')](_0x3c3e8a)+_0xdd4b('0x8');}function getInteractionId(_0x1f29d0,_0x1f3af5,_0x2b2d30){if(_0x1f29d0&&_0x1f29d0[_[_0xdd4b('0x9')](_0x2b2d30)+'InteractionId']){return _0x1f29d0[_[_0xdd4b('0x9')](_0x2b2d30)+_0xdd4b('0x8')];}else if(_0x1f29d0&&_0x1f29d0['id']){return _0x1f29d0['id'];}else if(_0x1f3af5&&_0x1f3af5['id']){return _0x1f3af5['id'];}else{return _0xdd4b('0xa');}}function getInteractionsTables(_0x1cef66){return{'accounts':_0x1cef66+'_'+(_0x1cef66===_0xdd4b('0x5')?'websites':'accounts'),'interactions':_0x1cef66+'_interactions','interactionsTags':_0x1cef66+_0xdd4b('0xb'),'messages':_0x1cef66+_0xdd4b('0xc'),'userInteractions':_0xdd4b('0xd')+_0x1cef66+_0xdd4b('0xe')};}function getSelectedTags(_0x49f9b4){var _0xfb9627=[];if(_0x49f9b4){_0xfb9627=Array[_0xdd4b('0xf')](_0x49f9b4)?_0x49f9b4:[_0x49f9b4];}return _0xfb9627;}function log(_0x4481fe,_0x5e13ba,_0x51fa38,_0x4d7047,_0xf5808d,_0x1aa052){loggers[_0xf5808d[_0xdd4b('0x10')]()][_0x4481fe](_0xdd4b('0x11'),_0x1aa052[_0xdd4b('0x12')](),_0x5e13ba?_0x5e13ba['id']:null,_0x5e13ba?_0x5e13ba['name']:null,_0x5e13ba?_0x5e13ba[_0xdd4b('0x13')]:null,getInteractionId(_0x51fa38,_0x4d7047,_0xf5808d),_0x51fa38?JSON['stringify'](_0x51fa38):_0xdd4b('0x14'));}function updateUser(_0x2d4dfb,_0x30e1a5,_0x443c9d,_0x4d2854,_0x44b6c8){db[_[_0xdd4b('0x9')](_0x4d2854)+_0xdd4b('0x15')][_0xdd4b('0x16')]({'where':{'id':getInteractionId(_0x30e1a5,_0x443c9d,_0x4d2854)}})['then'](function(_0x42cda6){if(_0x42cda6){return _0x42cda6[_0xdd4b('0x17')]({'UserId':_0x2d4dfb?_0x2d4dfb['id']:null});}})[_0xdd4b('0x18')](function(_0x1842b2){if(_0x1842b2){log(_0xdd4b('0x19'),_0x2d4dfb,_0x30e1a5,_0x443c9d,_0x4d2854,_0x44b6c8);}})[_0xdd4b('0x1a')](function(){log('error',_0x2d4dfb,_0x30e1a5,_0x443c9d,_0x4d2854,_0x44b6c8);});}module[_0xdd4b('0x1b')]={'getAccountFK':getAccountFK,'getInteractionFK':getInteractionFK,'getInteractionsTables':getInteractionsTables,'getSelectedTags':getSelectedTags,'updateUser':updateUser}; \ No newline at end of file +var _0xd6ca=['sms-interactions','chat-interactions','whatsapp-interactions','capitalize','chat','Website','Account','InteractionId','upperFirst','unknown','websites','_interaction_has_tags','_messages','_interactions','isArray','[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','toUpperCase','role','stringify','null','Interaction','findOne','update','info','catch','error','exports','lodash','../../mysqldb','../../config/logger','mail-interactions','fax-interactions'];(function(_0x110c3d,_0x12ee06){var _0x226d67=function(_0x1fb6e1){while(--_0x1fb6e1){_0x110c3d['push'](_0x110c3d['shift']());}};_0x226d67(++_0x12ee06);}(_0xd6ca,0x1bb));var _0xad6c=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xd6ca[_0x3947c9];return _0x2e7871;};'use strict';var _=require(_0xad6c('0x0'));var db=require(_0xad6c('0x1'))['db'];var loggers={'openchannel':require(_0xad6c('0x2'))('openchannel-interactions'),'mail':require(_0xad6c('0x2'))(_0xad6c('0x3')),'fax':require('../../config/logger')(_0xad6c('0x4')),'sms':require(_0xad6c('0x2'))(_0xad6c('0x5')),'chat':require(_0xad6c('0x2'))(_0xad6c('0x6')),'whatsapp':require('../../config/logger')(_0xad6c('0x7'))};function getAccountFK(_0x265a99){return _[_0xad6c('0x8')](_0x265a99)+(_0x265a99===_0xad6c('0x9')?_0xad6c('0xa'):_0xad6c('0xb'))+'Id';}function getInteractionFK(_0x53186d){return _[_0xad6c('0x8')](_0x53186d)+_0xad6c('0xc');}function getInteractionId(_0x68b7c7,_0x38a1fe,_0x341bb1){if(_0x68b7c7&&_0x68b7c7[_[_0xad6c('0xd')](_0x341bb1)+_0xad6c('0xc')]){return _0x68b7c7[_[_0xad6c('0xd')](_0x341bb1)+_0xad6c('0xc')];}else if(_0x68b7c7&&_0x68b7c7['id']){return _0x68b7c7['id'];}else if(_0x38a1fe&&_0x38a1fe['id']){return _0x38a1fe['id'];}else{return _0xad6c('0xe');}}function getInteractionsTables(_0x310e76){return{'accounts':_0x310e76+'_'+(_0x310e76==='chat'?_0xad6c('0xf'):'accounts'),'interactions':_0x310e76+'_interactions','interactionsTags':_0x310e76+_0xad6c('0x10'),'messages':_0x310e76+_0xad6c('0x11'),'userInteractions':'user_has_'+_0x310e76+_0xad6c('0x12')};}function getSelectedTags(_0x57fd6e){var _0x535bfb=[];if(_0x57fd6e){_0x535bfb=Array[_0xad6c('0x13')](_0x57fd6e)?_0x57fd6e:[_0x57fd6e];}return _0x535bfb;}function log(_0x32812e,_0x2903a6,_0x2f4e34,_0x35c298,_0x26880d,_0x4a6f53){loggers[_0x26880d['toLowerCase']()][_0x32812e](_0xad6c('0x14'),_0x4a6f53[_0xad6c('0x15')](),_0x2903a6?_0x2903a6['id']:null,_0x2903a6?_0x2903a6['name']:null,_0x2903a6?_0x2903a6[_0xad6c('0x16')]:null,getInteractionId(_0x2f4e34,_0x35c298,_0x26880d),_0x2f4e34?JSON[_0xad6c('0x17')](_0x2f4e34):_0xad6c('0x18'));}function updateUser(_0x28815e,_0x1d5783,_0x5060dc,_0x44471c,_0x5944fd){db[_[_0xad6c('0xd')](_0x44471c)+_0xad6c('0x19')][_0xad6c('0x1a')]({'where':{'id':getInteractionId(_0x1d5783,_0x5060dc,_0x44471c)}})['then'](function(_0x553dfb){if(_0x553dfb){return _0x553dfb[_0xad6c('0x1b')]({'UserId':_0x28815e?_0x28815e['id']:null});}})['then'](function(_0x37b0b1){if(_0x37b0b1){log(_0xad6c('0x1c'),_0x28815e,_0x1d5783,_0x5060dc,_0x44471c,_0x5944fd);}})[_0xad6c('0x1d')](function(){log(_0xad6c('0x1e'),_0x28815e,_0x1d5783,_0x5060dc,_0x44471c,_0x5944fd);});}module[_0xad6c('0x1f')]={'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 44aebea..b3cf370 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 _0xf24b=['split','createDecipher','aes-256-ctr','format','%s:%s:%s','base64','utf8','parse','hasOwnProperty','use','License','findOne','then','Maximum\x20%s\x20limit\x20have\x20been\x20reached','catch','users','crypto','util','../../config/environment','data1','license'];(function(_0x1eb5f6,_0x869d5f){var _0x1a6272=function(_0x56b7d9){while(--_0x56b7d9){_0x1eb5f6['push'](_0x1eb5f6['shift']());}};_0x1a6272(++_0x869d5f);}(_0xf24b,0x64));var _0xbf24=function(_0x32d457,_0x1a39c9){_0x32d457=_0x32d457-0x0;var _0x338386=_0xf24b[_0x32d457];return _0x338386;};'use strict';var crypto=require(_0xbf24('0x0'));var util=require(_0xbf24('0x1'));var compose=require('composable-middleware');var db=require('../../mysqldb')['db'];var config=require(_0xbf24('0x2'));function getValueFromLicense(_0x83f0b8,_0x5079ec){if(_0x83f0b8&&_0x5079ec){if(_0x5079ec[_0xbf24('0x3')]&&_0x5079ec[_0xbf24('0x4')]){var _0x3af049=_0x5079ec[_0xbf24('0x3')];var _0xc77019=_0x5079ec[_0xbf24('0x4')];var _0x1775d2=_0x3af049[_0xbf24('0x5')]('-')[0x4];var _0x55ede0=_0x3af049[_0xbf24('0x5')]('-')[0x0];var _0x1089b2=crypto[_0xbf24('0x6')](_0xbf24('0x7'),util[_0xbf24('0x8')](_0xbf24('0x9'),_0x1775d2,_0x3af049,_0x55ede0));var _0x23fc2f=_0x1089b2['update'](_0xc77019,_0xbf24('0xa'),_0xbf24('0xb'));_0x23fc2f+=_0x1089b2['final'](_0xbf24('0xb'));var _0x43ffc4=JSON[_0xbf24('0xc')](_0x23fc2f);return _0x43ffc4[_0xbf24('0xd')](_0x83f0b8)?_0x43ffc4[_0x83f0b8]:null;}}return null;}function isLimit(_0x3c0648,_0x526413,_0x7cd51e,_0x187b9f){var _0xcf39ae=_0x526413;return compose()[_0xbf24('0xe')](function(_0x35a0dc,_0x5a4c4d,_0x4be7ec){return db[_0xbf24('0xf')][_0xbf24('0x10')]({'where':{'id':0x1},'raw':!![]})[_0xbf24('0x11')](function(_0x16d255){var _0x31fe86=getValueFromLicense(_0x3c0648,_0x16d255);return _0x31fe86?_0x31fe86:_0xcf39ae;})[_0xbf24('0x11')](function(_0x204c9f){_0xcf39ae=_0x204c9f;return _0x7cd51e['count'](_0x187b9f);})[_0xbf24('0x11')](function(_0x2ef844){if(_0x2ef844>=_0xcf39ae){return _0x5a4c4d['status'](0x193)['json']({'message':util[_0xbf24('0x8')](_0xbf24('0x12'),_0x3c0648)});}_0x4be7ec();})[_0xbf24('0x13')](function(_0x4a6b1d){_0x4be7ec(_0x4a6b1d);});});}function isUserLimit(){return isLimit(_0xbf24('0x14'),0x1,db['User'],{'where':{'$or':[{'role':'admin'},{'role':'user'}]}});}exports['isUserLimit']=isUserLimit; \ No newline at end of file +var _0xdc76=['parse','use','License','findOne','then','status','json','Maximum\x20%s\x20limit\x20have\x20been\x20reached','catch','admin','user','isUserLimit','composable-middleware','../../config/environment','data1','license','createDecipher','format','base64','utf8'];(function(_0x1ec235,_0x359459){var _0x367d2c=function(_0x2f18a5){while(--_0x2f18a5){_0x1ec235['push'](_0x1ec235['shift']());}};_0x367d2c(++_0x359459);}(_0xdc76,0x1ec));var _0x6dc7=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xdc76[_0x2dafbe];return _0x58a45a;};'use strict';var crypto=require('crypto');var util=require('util');var compose=require(_0x6dc7('0x0'));var db=require('../../mysqldb')['db'];var config=require(_0x6dc7('0x1'));function getValueFromLicense(_0x1e0c18,_0x5ec79d){if(_0x1e0c18&&_0x5ec79d){if(_0x5ec79d[_0x6dc7('0x2')]&&_0x5ec79d[_0x6dc7('0x3')]){var _0x8e65dc=_0x5ec79d['data1'];var _0x45e9a4=_0x5ec79d['license'];var _0x1ca254=_0x8e65dc['split']('-')[0x4];var _0x458e04=_0x8e65dc['split']('-')[0x0];var _0x17fa57=crypto[_0x6dc7('0x4')]('aes-256-ctr',util[_0x6dc7('0x5')]('%s:%s:%s',_0x1ca254,_0x8e65dc,_0x458e04));var _0x2df98b=_0x17fa57['update'](_0x45e9a4,_0x6dc7('0x6'),'utf8');_0x2df98b+=_0x17fa57['final'](_0x6dc7('0x7'));var _0x2a2e7f=JSON[_0x6dc7('0x8')](_0x2df98b);return _0x2a2e7f['hasOwnProperty'](_0x1e0c18)?_0x2a2e7f[_0x1e0c18]:null;}}return null;}function isLimit(_0x1e7639,_0x592512,_0x14148b,_0x49f343){var _0xa3ccc8=_0x592512;return compose()[_0x6dc7('0x9')](function(_0x2fa5dc,_0x416269,_0x8325ae){return db[_0x6dc7('0xa')][_0x6dc7('0xb')]({'where':{'id':0x1},'raw':!![]})[_0x6dc7('0xc')](function(_0xecd0e9){var _0x3b4d3b=getValueFromLicense(_0x1e7639,_0xecd0e9);return _0x3b4d3b?_0x3b4d3b:_0xa3ccc8;})[_0x6dc7('0xc')](function(_0x5addff){_0xa3ccc8=_0x5addff;return _0x14148b['count'](_0x49f343);})[_0x6dc7('0xc')](function(_0x32f0bb){if(_0x32f0bb>=_0xa3ccc8){return _0x416269[_0x6dc7('0xd')](0x193)[_0x6dc7('0xe')]({'message':util[_0x6dc7('0x5')](_0x6dc7('0xf'),_0x1e7639)});}_0x8325ae();})[_0x6dc7('0x10')](function(_0x1608f3){_0x8325ae(_0x1608f3);});});}function isUserLimit(){return isLimit('users',0x1,db['User'],{'where':{'$or':[{'role':_0x6dc7('0x11')},{'role':_0x6dc7('0x12')}]}});}exports[_0x6dc7('0x13')]=isUserLimit; \ No newline at end of file diff --git a/server/components/parsers/advancedSearch.js b/server/components/parsers/advancedSearch.js index eff915d..45cfbe8 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 _0x08da=['\x20OR\x20','\x20IS\x20NULL)','$in','IN\x20?','NOT\x20IN\x20?','=\x20?','$ne','<>\x20?','$substring','$startsWith','$endsWith','LIKE\x20?','$lt','<\x20?','$gt','>\x20?','$gte','>=\x20?','BETWEEN\x20?\x20AND\x20?','start','pop','utcOffset','hours','seconds','lodash','moment','parseSearch','sqlOperator','startsWith','[$or]','and','replace','[$and]','length','split','slice','forEach','shift','match','indexOf','map','conditions','push','buildExpression','DATE','$eq','$between','value','includes','operator','add','days','format','YYYY-MM-DD','castTo','text','field','\x20AS\x20','$notIn'];(function(_0x30ab8f,_0x43ecb9){var _0x338358=function(_0x44f465){while(--_0x44f465){_0x30ab8f['push'](_0x30ab8f['shift']());}};_0x338358(++_0x43ecb9);}(_0x08da,0xc9));var _0xa08d=function(_0x1da527,_0x2dc953){_0x1da527=_0x1da527-0x0;var _0x40fc7c=_0x08da[_0x1da527];return _0x40fc7c;};'use strict';var _=require(_0xa08d('0x0'));var moment=require(_0xa08d('0x1'));exports[_0xa08d('0x2')]=function(_0x241ffe){var _0x50d51e={'conditions':[]};_0x50d51e[_0xa08d('0x3')]=_[_0xa08d('0x4')](_0x241ffe,_0xa08d('0x5'))?'or':_0xa08d('0x6');var _0x59556f=_0x241ffe[_0xa08d('0x7')](_0xa08d('0x8'),'')[_0xa08d('0x7')](_0xa08d('0x5'),'')['split']('||');for(var _0x6ca568=0x0;_0x6ca568<_0x59556f[_0xa08d('0x9')];_0x6ca568++){var _0x563bf4=_0x59556f[_0x6ca568][_0xa08d('0xa')](':=');var _0x2081d4=_0x563bf4[0x0];var _0x2ccf8d=_0x563bf4[_0xa08d('0xb')](0x1);_0x2ccf8d[_0xa08d('0xc')](function(_0x50f666){var _0x1821e8=_0x50f666['split']('[')[_0xa08d('0xd')]();var _0x14da23=_0x50f666[_0xa08d('0xe')](/\[(.*?)\]/g);_0x14da23[_0xa08d('0xc')](function(_0x2becbe){var _0x3794ec=_0x2becbe['split']('[')['filter'](function(_0x1bfbad){return _0x1bfbad[_0xa08d('0xf')](']')>-0x1;})[_0xa08d('0x10')](function(_0x76514a){return _0x76514a['split'](']')[0x0];})[0x0];_0x50d51e[_0xa08d('0x11')][_0xa08d('0x12')]({'field':_0x2081d4,'operator':_0x1821e8,'value':_0x3794ec});});});}return _0x50d51e;};exports[_0xa08d('0x13')]=function(_0x1ad401,_0x11e491,_0x5383fc){var _0x438300={};if(_0x11e491===_0xa08d('0x14')){if(_0x5383fc['operator']===_0xa08d('0x15')){_0x5383fc['operator']=_0xa08d('0x16');_0x5383fc[_0xa08d('0x17')]+=','+_0x5383fc[_0xa08d('0x17')];}else if(_[_0xa08d('0x18')](['$gt','$lte'],_0x5383fc[_0xa08d('0x19')])){_0x5383fc[_0xa08d('0x17')]=moment(_0x5383fc[_0xa08d('0x17')])[_0xa08d('0x1a')](0x1,_0xa08d('0x1b'))[_0xa08d('0x1c')](_0xa08d('0x1d'));}}if(_0x5383fc[_0xa08d('0x1e')]){_0x11e491=_0x5383fc['castTo'];_0x438300[_0xa08d('0x1f')]='CAST('+_0x1ad401+'.'+_0x5383fc[_0xa08d('0x20')]+_0xa08d('0x21')+_0x5383fc[_0xa08d('0x1e')]+')\x20'+parseOperator(_0x5383fc[_0xa08d('0x19')]);}else{_0x438300[_0xa08d('0x1f')]=_0x1ad401+'.'+_0x5383fc['field']+'\x20'+parseOperator(_0x5383fc['operator']);}if(_[_0xa08d('0x18')](['$ne',_0xa08d('0x22')],_0x5383fc[_0xa08d('0x19')]))_0x438300[_0xa08d('0x1f')]='('+_0x438300[_0xa08d('0x1f')]+_0xa08d('0x23')+_0x1ad401+'.'+_0x5383fc['field']+_0xa08d('0x24');_0x438300[_0xa08d('0x17')]=parseValue(_0x11e491,_0x5383fc[_0xa08d('0x19')],_0x5383fc[_0xa08d('0x17')]);return _0x438300;};function parseOperator(_0x631a67){var _0xdb857b;switch(_0x631a67){case _0xa08d('0x25'):_0xdb857b=_0xa08d('0x26');break;case _0xa08d('0x22'):_0xdb857b=_0xa08d('0x27');break;case'$eq':_0xdb857b=_0xa08d('0x28');break;case _0xa08d('0x29'):_0xdb857b=_0xa08d('0x2a');break;case _0xa08d('0x2b'):case _0xa08d('0x2c'):case _0xa08d('0x2d'):_0xdb857b=_0xa08d('0x2e');break;case _0xa08d('0x2f'):_0xdb857b=_0xa08d('0x30');break;case _0xa08d('0x31'):_0xdb857b=_0xa08d('0x32');break;case'$lte':_0xdb857b='<=\x20?';break;case _0xa08d('0x33'):_0xdb857b=_0xa08d('0x34');break;case'$between':_0xdb857b=_0xa08d('0x35');break;}return _0xdb857b;}function parseValue(_0x451947,_0x5444b9,_0x1bf8e5){var _0x5e1fcb={'start':undefined,'end':undefined};switch(_0x5444b9){case _0xa08d('0x25'):case _0xa08d('0x22'):_0x5e1fcb[_0xa08d('0x36')]=_0x1bf8e5['split'](',');break;case'$substring':_0x5e1fcb[_0xa08d('0x36')]='%'+_0x1bf8e5+'%';break;case _0xa08d('0x2c'):_0x5e1fcb[_0xa08d('0x36')]=_0x1bf8e5+'%';break;case _0xa08d('0x2d'):_0x5e1fcb[_0xa08d('0x36')]='%'+_0x1bf8e5;break;case'$between':var _0x54ef75=_0x1bf8e5[_0xa08d('0xa')](',');var _0x1bf8e5=_0x54ef75[_0xa08d('0xd')]();var _0x37cfe2=_0x54ef75[_0xa08d('0x37')]();if(_0x451947===_0xa08d('0x14')){_0x1bf8e5=moment(_0x1bf8e5)[_0xa08d('0x38')](0x0,!![])[_0xa08d('0x1c')]();_0x37cfe2=moment(_0x37cfe2)['utcOffset'](0x0,!![])[_0xa08d('0x1a')](0x17,_0xa08d('0x39'))[_0xa08d('0x1a')](0x3b,'minutes')['add'](0x3b,_0xa08d('0x3a'))[_0xa08d('0x1c')]();}_0x5e1fcb={'start':_0x1bf8e5,'end':_0x37cfe2};break;default:_0x5e1fcb[_0xa08d('0x36')]=_0x1bf8e5;break;}return _0x5e1fcb;} \ No newline at end of file +var _0x43c9=['pop','utcOffset','hours','minutes','seconds','lodash','moment','parseSearch','sqlOperator','startsWith','[$or]','[$and]','replace','split','length','slice','shift','match','filter','indexOf','map','conditions','buildExpression','DATE','operator','$eq','value','includes','$gt','$lte','add','format','YYYY-MM-DD','castTo','CAST(','field','\x20AS\x20','text','$ne','\x20OR\x20','\x20IS\x20NULL)','$in','IN\x20?','$notIn','NOT\x20IN\x20?','=\x20?','$substring','LIKE\x20?','$lt','<\x20?','>=\x20?','$between','BETWEEN\x20?\x20AND\x20?','start','$startsWith'];(function(_0x580238,_0x2adec2){var _0x3d5608=function(_0x281c35){while(--_0x281c35){_0x580238['push'](_0x580238['shift']());}};_0x3d5608(++_0x2adec2);}(_0x43c9,0x118));var _0x943c=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x43c9[_0x42cae2];return _0x5f256f;};'use strict';var _=require(_0x943c('0x0'));var moment=require(_0x943c('0x1'));exports[_0x943c('0x2')]=function(_0xc596e){var _0x438389={'conditions':[]};_0x438389[_0x943c('0x3')]=_[_0x943c('0x4')](_0xc596e,_0x943c('0x5'))?'or':'and';var _0x33bcd4=_0xc596e['replace'](_0x943c('0x6'),'')[_0x943c('0x7')]('[$or]','')[_0x943c('0x8')]('||');for(var _0x25ed8c=0x0;_0x25ed8c<_0x33bcd4[_0x943c('0x9')];_0x25ed8c++){var _0x3e9fa4=_0x33bcd4[_0x25ed8c]['split'](':=');var _0x523dcb=_0x3e9fa4[0x0];var _0xe9dfb3=_0x3e9fa4[_0x943c('0xa')](0x1);_0xe9dfb3['forEach'](function(_0x206d43){var _0xe64542=_0x206d43[_0x943c('0x8')]('[')[_0x943c('0xb')]();var _0x4c76d8=_0x206d43[_0x943c('0xc')](/\[(.*?)\]/g);_0x4c76d8['forEach'](function(_0x3fedb5){var _0x3e3dad=_0x3fedb5[_0x943c('0x8')]('[')[_0x943c('0xd')](function(_0x28b9cc){return _0x28b9cc[_0x943c('0xe')](']')>-0x1;})[_0x943c('0xf')](function(_0x39c6db){return _0x39c6db[_0x943c('0x8')](']')[0x0];})[0x0];_0x438389[_0x943c('0x10')]['push']({'field':_0x523dcb,'operator':_0xe64542,'value':_0x3e3dad});});});}return _0x438389;};exports[_0x943c('0x11')]=function(_0x37c1f0,_0x524027,_0x3aec40){var _0x442923={};if(_0x524027===_0x943c('0x12')){if(_0x3aec40[_0x943c('0x13')]===_0x943c('0x14')){_0x3aec40['operator']='$between';_0x3aec40[_0x943c('0x15')]+=','+_0x3aec40[_0x943c('0x15')];}else if(_[_0x943c('0x16')]([_0x943c('0x17'),_0x943c('0x18')],_0x3aec40[_0x943c('0x13')])){_0x3aec40[_0x943c('0x15')]=moment(_0x3aec40[_0x943c('0x15')])[_0x943c('0x19')](0x1,'days')[_0x943c('0x1a')](_0x943c('0x1b'));}}if(_0x3aec40['castTo']){_0x524027=_0x3aec40[_0x943c('0x1c')];_0x442923['text']=_0x943c('0x1d')+_0x37c1f0+'.'+_0x3aec40[_0x943c('0x1e')]+_0x943c('0x1f')+_0x3aec40[_0x943c('0x1c')]+')\x20'+parseOperator(_0x3aec40[_0x943c('0x13')]);}else{_0x442923[_0x943c('0x20')]=_0x37c1f0+'.'+_0x3aec40['field']+'\x20'+parseOperator(_0x3aec40['operator']);}if(_[_0x943c('0x16')]([_0x943c('0x21'),'$notIn'],_0x3aec40['operator']))_0x442923[_0x943c('0x20')]='('+_0x442923[_0x943c('0x20')]+_0x943c('0x22')+_0x37c1f0+'.'+_0x3aec40[_0x943c('0x1e')]+_0x943c('0x23');_0x442923['value']=parseValue(_0x524027,_0x3aec40[_0x943c('0x13')],_0x3aec40[_0x943c('0x15')]);return _0x442923;};function parseOperator(_0xf59246){var _0x516408;switch(_0xf59246){case _0x943c('0x24'):_0x516408=_0x943c('0x25');break;case _0x943c('0x26'):_0x516408=_0x943c('0x27');break;case _0x943c('0x14'):_0x516408=_0x943c('0x28');break;case _0x943c('0x21'):_0x516408='<>\x20?';break;case _0x943c('0x29'):case'$startsWith':case'$endsWith':_0x516408=_0x943c('0x2a');break;case _0x943c('0x2b'):_0x516408=_0x943c('0x2c');break;case _0x943c('0x17'):_0x516408='>\x20?';break;case'$lte':_0x516408='<=\x20?';break;case'$gte':_0x516408=_0x943c('0x2d');break;case _0x943c('0x2e'):_0x516408=_0x943c('0x2f');break;}return _0x516408;}function parseValue(_0x200cbe,_0x42955d,_0x9fede1){var _0x54ac26={'start':undefined,'end':undefined};switch(_0x42955d){case'$in':case _0x943c('0x26'):_0x54ac26['start']=_0x9fede1[_0x943c('0x8')](',');break;case'$substring':_0x54ac26[_0x943c('0x30')]='%'+_0x9fede1+'%';break;case _0x943c('0x31'):_0x54ac26[_0x943c('0x30')]=_0x9fede1+'%';break;case'$endsWith':_0x54ac26['start']='%'+_0x9fede1;break;case'$between':var _0x16836a=_0x9fede1['split'](',');var _0x9fede1=_0x16836a[_0x943c('0xb')]();var _0x49b25c=_0x16836a[_0x943c('0x32')]();if(_0x200cbe===_0x943c('0x12')){_0x9fede1=moment(_0x9fede1)['utcOffset'](0x0,!![])['format']();_0x49b25c=moment(_0x49b25c)[_0x943c('0x33')](0x0,!![])[_0x943c('0x19')](0x17,_0x943c('0x34'))[_0x943c('0x19')](0x3b,_0x943c('0x35'))['add'](0x3b,_0x943c('0x36'))[_0x943c('0x1a')]();}_0x54ac26={'start':_0x9fede1,'end':_0x49b25c};break;default:_0x54ac26[_0x943c('0x30')]=_0x9fede1;break;}return _0x54ac26;} \ No newline at end of file diff --git a/server/components/parsers/qs.js b/server/components/parsers/qs.js index e07f2b7..ca66434 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 _0xaab2=['includes','columns','where','merge','map','type','VIRTUAL','lower','include','includeAll','sequelize','moment','../../mysqldb','parse','keys','model','alias','fields','filters','isEmpty','forOwn','find','isPlainObject','$gte','format','YYYY-MM-DD','utc','$lte','subtract','name','uniqueid','isArray','split','limit','offset','sort','indexOf','priority','col','unsigned','substr','DESC','cast','omit','length','isString','unset','hasOwnProperty','isNumeric','match','isEmail','getFullTextValue','\x22{EXPR}\x22','replace','join','getOptions','query','$id','intersection','attributes','nolimit','pick','filter','object'];(function(_0x4ed949,_0x53954b){var _0x441a62=function(_0x15d6e4){while(--_0x15d6e4){_0x4ed949['push'](_0x4ed949['shift']());}};_0x441a62(++_0x53954b);}(_0xaab2,0xca));var _0x2aab=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0xaab2[_0x3b380d];return _0x54502b;};'use strict';var _=require('lodash');var sequelize=require(_0x2aab('0x0'));var moment=require(_0x2aab('0x1'));var db=require(_0x2aab('0x2'))['db'];var LIMIT_VALUE=0xfa;function hasSequelizeOperator(_0x564a5a){var _0x149bb7=['ne'];try{var _0xc770d0=JSON[_0x2aab('0x3')](_0x564a5a);var _0x342fe5=Object[_0x2aab('0x4')](_0xc770d0)[0x0];return _0x149bb7['includes'](_0x342fe5);}catch(_0x1b01e0){return![];}}function getOperatorValue(_0x5b35ec){var _0x3af395=JSON[_0x2aab('0x3')](_0x5b35ec);var _0x4fe8a5=Object[_0x2aab('0x4')](_0x3af395)[0x0];var _0x494216=_0x3af395[_0x4fe8a5];return{['$'+_0x4fe8a5]:_0x494216};}function parseIncludeModel(_0xf6602a){var _0x2bd4e8=JSON[_0x2aab('0x3')](_0xf6602a);return{'model':db[_0x2bd4e8[_0x2aab('0x5')]],'as':_0x2bd4e8[_0x2aab('0x6')],'attributes':_0x2bd4e8[_0x2aab('0x7')],'raw':_0x2bd4e8['raw']};}exports['fields']=function(_0x205778){var _0x762dc5=null;if(_0x205778){_0x762dc5=_0x205778['split'](',');}return _0x762dc5;};exports[_0x2aab('0x8')]=function(_0x14dde1,_0x2a59bf){var _0x4bd48d={};if(!_[_0x2aab('0x9')](_0x14dde1)){_[_0x2aab('0xa')](_0x14dde1,function(_0x32d7ef,_0x355795){try{if(_0x2a59bf){var _0xc03782=_[_0x2aab('0xb')](_0x2a59bf,{'name':_0x355795})||{};if(hasSequelizeOperator(_0x32d7ef)){_0x4bd48d[_0x355795]=getOperatorValue(_0x32d7ef);}else if(_0xc03782['type']==='DATE'&&_[_0x2aab('0xc')](_0x32d7ef)){var _0x4c062d=JSON['parse'](_0x32d7ef);var _0x135345={'$gte':moment(moment(_0x4c062d[_0x2aab('0xd')])[_0x2aab('0xe')](_0x2aab('0xf')))[_0x2aab('0x10')]()[_0x2aab('0xe')](),'$lte':moment(moment(_0x4c062d[_0x2aab('0x11')])[_0x2aab('0xe')]('YYYY-MM-DD'))[_0x2aab('0x10')]()[_0x2aab('0x12')](0x1,'s')[_0x2aab('0xe')]()};_0x4bd48d[_0x355795]=_0x135345;}else if(_0xc03782[_0x2aab('0x13')]===_0x2aab('0x14')){_0x4bd48d[_0x355795]=_0x32d7ef;}else{_0x4bd48d[_0x355795]=_[_0x2aab('0x15')](_0x32d7ef)?_0x32d7ef:JSON[_0x2aab('0x3')](_0x32d7ef);}}else{_0x4bd48d[_0x355795]=_[_0x2aab('0x15')](_0x32d7ef)?_0x32d7ef:JSON[_0x2aab('0x3')](_0x32d7ef);}}catch(_0x35d69e){_0x4bd48d[_0x355795]=_0x32d7ef[_0x2aab('0x16')](',');}});}return _0x4bd48d;};exports[_0x2aab('0x17')]=function(_0x1ec2d8){_0x1ec2d8=parseInt(_0x1ec2d8,0xa);if(!_0x1ec2d8||_0x1ec2d8<0x0){_0x1ec2d8=LIMIT_VALUE;}return _0x1ec2d8;};exports[_0x2aab('0x18')]=function(_0x158859){_0x158859=parseInt(_0x158859,0xa);if(!_0x158859||_0x158859<0x0){_0x158859=0x0;}return _0x158859;};exports[_0x2aab('0x19')]=function(_0x40fb14){var _0x79cbaa,_0x1bb2bb=null;if(_0x40fb14){_0x79cbaa=_0x40fb14[_0x2aab('0x16')](',');_0x1bb2bb=_['map'](_0x79cbaa,function(_0x1b7ee2){if(_0x1b7ee2[_0x2aab('0x1a')]('-')===0x0){return[_0x1b7ee2===_0x2aab('0x1b')?sequelize['cast'](sequelize[_0x2aab('0x1c')](_0x2aab('0x1b')),_0x2aab('0x1d')):_0x1b7ee2[_0x2aab('0x1e')](0x1),_0x2aab('0x1f')];}else{return[_0x1b7ee2==='priority'?sequelize[_0x2aab('0x20')](sequelize[_0x2aab('0x1c')](_0x2aab('0x1b')),_0x2aab('0x1d')):_0x1b7ee2,'ASC'];}});}return _0x1bb2bb;};exports[_0x2aab('0x21')]=function(_0x117bbb,_0x571c6c){if(_[_0x2aab('0x9')](_0x117bbb)){return _0x117bbb;}if(_[_0x2aab('0x15')](_0x117bbb)){for(var _0x86cbd3=0x0;_0x86cbd3<_0x117bbb[_0x2aab('0x22')];_0x86cbd3+=0x1){_0x117bbb[_0x86cbd3]=this['omit'](_0x117bbb[_0x86cbd3],_0x571c6c);}return _0x117bbb;}if(!_['isObject'](_0x117bbb)){return _0x117bbb;}if(_[_0x2aab('0x23')](_0x571c6c)){_0x571c6c=[_0x571c6c];}if(!_[_0x2aab('0x15')](_0x571c6c)){return _0x117bbb;}for(var _0x3e7746=0x0;_0x3e7746<_0x571c6c[_0x2aab('0x22')];_0x3e7746+=0x1){_[_0x2aab('0x24')](_0x117bbb,_0x571c6c[_0x3e7746]);}for(var _0x1a5af5 in _0x117bbb){if(_0x117bbb[_0x2aab('0x25')](_0x1a5af5)){_0x117bbb[_0x1a5af5]=this[_0x2aab('0x21')](_0x117bbb[_0x1a5af5],_0x571c6c);}}return _0x117bbb;};exports[_0x2aab('0x26')]=function(_0x2986b9){return _0x2986b9[_0x2aab('0x27')](RegExp('^[+]?[0-9]*$'))?!![]:![];};exports[_0x2aab('0x28')]=function(_0x325cb9){return _0x325cb9[_0x2aab('0x27')](/^\S+@\S+$/)?!![]:![];};exports[_0x2aab('0x29')]=function(_0x576409,_0x325bca){var _0x341936=[];var _0x32acab=/[ `!@#$%^&*()_\-?~]/;var _0x2cddb8=_0x325bca?_0x2aab('0x2a'):'{EXPR}';_0x576409[_0x2aab('0x16')](/[ ,]+/)['forEach'](function(_0x392dcd){_0x392dcd=_0x392dcd[_0x2aab('0x2b')](/([^:]")"+/g,'$1');_0x392dcd='+'+_0x392dcd+'*';var _0x2ea1e3=_0x392dcd[_0x2aab('0x27')](_0x32acab);if(_0x2ea1e3){_0x392dcd='\x22'+_0x392dcd+'\x22';}_0x341936['push'](_0x392dcd);});_0x2cddb8=_0x2cddb8[_0x2aab('0x2b')]('{EXPR}',_0x341936[_0x2aab('0x2c')]('\x20'));return _0x2cddb8;};exports[_0x2aab('0x2d')]=function(_0x2c6a95,_0x1a9273,_0x37d262){var _0x458d86={},_0x23e4a4={};if(_0x1a9273[_0x2aab('0x2e')][_0x2aab('0x2f')]){_0x1a9273[_0x2aab('0x2e')]['id']=_0x1a9273[_0x2aab('0x2e')]['$id'];delete _0x1a9273[_0x2aab('0x2e')][_0x2aab('0x2f')];}_0x458d86['model']=_['map'](_0x2c6a95,_0x2aab('0x13'));_0x458d86[_0x2aab('0x2e')]=_[_0x2aab('0x4')](_0x1a9273['query']);_0x458d86['filters']=_[_0x2aab('0x30')](_0x458d86[_0x2aab('0x5')],_0x458d86[_0x2aab('0x2e')]);_0x23e4a4['attributes']=_['intersection'](_0x458d86['model'],this[_0x2aab('0x7')](_0x1a9273[_0x2aab('0x2e')][_0x2aab('0x7')]));_0x23e4a4[_0x2aab('0x31')]=_0x23e4a4[_0x2aab('0x31')][_0x2aab('0x22')]?_0x23e4a4['attributes']:_0x458d86['model'];if(!_0x1a9273[_0x2aab('0x2e')]['hasOwnProperty'](_0x2aab('0x32'))){_0x23e4a4[_0x2aab('0x17')]=this[_0x2aab('0x17')](_0x1a9273['query'][_0x2aab('0x17')]);_0x23e4a4['offset']=this[_0x2aab('0x18')](_0x1a9273[_0x2aab('0x2e')]['offset']);}_0x23e4a4['order']=this[_0x2aab('0x19')](_0x1a9273[_0x2aab('0x2e')][_0x2aab('0x19')]);_0x23e4a4['where']=this[_0x2aab('0x8')](_[_0x2aab('0x33')](_0x1a9273[_0x2aab('0x2e')],_0x458d86[_0x2aab('0x8')]),_0x2c6a95);if(_0x1a9273[_0x2aab('0x2e')][_0x2aab('0x34')]){var _0x484ee7=_0x2c6a95;var _0xdb9a44=_0x1a9273['query']['filter'];if(typeof _0xdb9a44===_0x2aab('0x35')){_0x484ee7=_[_0x2aab('0x34')](_0x2c6a95,function(_0x5b950e){return _[_0x2aab('0x36')](_0xdb9a44[_0x2aab('0x37')],_0x5b950e[_0x2aab('0x13')]);});_0xdb9a44=_0xdb9a44['value'];}_0x23e4a4[_0x2aab('0x38')]=_[_0x2aab('0x39')](_0x23e4a4[_0x2aab('0x38')],{'$or':_[_0x2aab('0x3a')](_0x484ee7,function(_0x4e00fb){if(_0x4e00fb[_0x2aab('0x3b')]!==_0x2aab('0x3c')){if(_0x37d262){return sequelize[_0x2aab('0x38')](sequelize['fn'](_0x2aab('0x3d'),sequelize[_0x2aab('0x1c')](_0x4e00fb[_0x2aab('0x13')])),{'$like':sequelize['fn'](_0x2aab('0x3d'),'%'+_0x1a9273[_0x2aab('0x2e')][_0x2aab('0x34')]+'%')});}else{var _0x19bb48={};_0x19bb48[_0x4e00fb['name']]={'$like':'%'+_0x1a9273[_0x2aab('0x2e')][_0x2aab('0x34')]+'%'};return _0x19bb48;}}})});}_0x23e4a4=_[_0x2aab('0x39')]({},_0x23e4a4,_0x1a9273['options']);return _0x23e4a4;};exports[_0x2aab('0x3e')]=function(_0x7601fa){var _0x42c40b=[];if(_0x7601fa[_0x2aab('0x3f')]){_0x42c40b['push']({'all':!![]});}else if(_0x7601fa[_0x2aab('0x3e')]){if(Array[_0x2aab('0x15')](_0x7601fa[_0x2aab('0x3e')])){_0x42c40b=Object[_0x2aab('0x4')](_0x7601fa[_0x2aab('0x3e')])['map'](function(_0x51209b){return parseIncludeModel(_0x7601fa[_0x2aab('0x3e')][_0x51209b]);});}else{var _0x2fe0b5=parseIncludeModel(_0x7601fa[_0x2aab('0x3e')]);_0x42c40b['push'](_0x2fe0b5);}}return _0x42c40b;}; \ No newline at end of file +var _0x89c9=['limit','offset','sort','map','priority','cast','col','unsigned','ASC','isEmpty','length','omit','isObject','isString','hasOwnProperty','isNumeric','match','^[+]?[0-9]*$','isEmail','getFullTextValue','\x22{EXPR}\x22','{EXPR}','split','forEach','replace','push','query','$id','model','name','intersection','attributes','nolimit','order','where','filters','pick','filter','object','includes','value','merge','VIRTUAL','options','include','includeAll','lodash','sequelize','moment','../../mysqldb','parse','keys','fields','raw','forOwn','find','type','DATE','$gte','format','YYYY-MM-DD','utc','$lte','uniqueid','isArray'];(function(_0x2fc012,_0x503e5b){var _0x2891f9=function(_0x295f5e){while(--_0x295f5e){_0x2fc012['push'](_0x2fc012['shift']());}};_0x2891f9(++_0x503e5b);}(_0x89c9,0xb0));var _0x989c=function(_0x4fadb8,_0x11b539){_0x4fadb8=_0x4fadb8-0x0;var _0x3c9e20=_0x89c9[_0x4fadb8];return _0x3c9e20;};'use strict';var _=require(_0x989c('0x0'));var sequelize=require(_0x989c('0x1'));var moment=require(_0x989c('0x2'));var db=require(_0x989c('0x3'))['db'];var LIMIT_VALUE=0xfa;function hasSequelizeOperator(_0x3edea2){var _0x1d5ece=['ne'];try{var _0x44f38d=JSON[_0x989c('0x4')](_0x3edea2);var _0x2996f1=Object['keys'](_0x44f38d)[0x0];return _0x1d5ece['includes'](_0x2996f1);}catch(_0x56fcd7){return![];}}function getOperatorValue(_0x468096){var _0x45871e=JSON[_0x989c('0x4')](_0x468096);var _0x415bad=Object[_0x989c('0x5')](_0x45871e)[0x0];var _0x15bd83=_0x45871e[_0x415bad];return{['$'+_0x415bad]:_0x15bd83};}function parseIncludeModel(_0x5aa575){var _0x3aca65=JSON[_0x989c('0x4')](_0x5aa575);return{'model':db[_0x3aca65['model']],'as':_0x3aca65['alias'],'attributes':_0x3aca65[_0x989c('0x6')],'raw':_0x3aca65[_0x989c('0x7')]};}exports[_0x989c('0x6')]=function(_0x11d1b4){var _0x25cd8b=null;if(_0x11d1b4){_0x25cd8b=_0x11d1b4['split'](',');}return _0x25cd8b;};exports['filters']=function(_0xe4370d,_0x4837ff){var _0x522433={};if(!_['isEmpty'](_0xe4370d)){_[_0x989c('0x8')](_0xe4370d,function(_0x459101,_0x2db6c0){try{if(_0x4837ff){var _0x784fd3=_[_0x989c('0x9')](_0x4837ff,{'name':_0x2db6c0})||{};if(hasSequelizeOperator(_0x459101)){_0x522433[_0x2db6c0]=getOperatorValue(_0x459101);}else if(_0x784fd3[_0x989c('0xa')]===_0x989c('0xb')&&_['isPlainObject'](_0x459101)){var _0x4db588=JSON[_0x989c('0x4')](_0x459101);var _0x40259c={'$gte':moment(moment(_0x4db588[_0x989c('0xc')])[_0x989c('0xd')](_0x989c('0xe')))[_0x989c('0xf')]()[_0x989c('0xd')](),'$lte':moment(moment(_0x4db588[_0x989c('0x10')])[_0x989c('0xd')](_0x989c('0xe')))[_0x989c('0xf')]()['subtract'](0x1,'s')['format']()};_0x522433[_0x2db6c0]=_0x40259c;}else if(_0x784fd3['name']===_0x989c('0x11')){_0x522433[_0x2db6c0]=_0x459101;}else{_0x522433[_0x2db6c0]=_['isArray'](_0x459101)?_0x459101:JSON['parse'](_0x459101);}}else{_0x522433[_0x2db6c0]=_[_0x989c('0x12')](_0x459101)?_0x459101:JSON['parse'](_0x459101);}}catch(_0x156492){_0x522433[_0x2db6c0]=_0x459101['split'](',');}});}return _0x522433;};exports[_0x989c('0x13')]=function(_0x4011d7){_0x4011d7=parseInt(_0x4011d7,0xa);if(!_0x4011d7||_0x4011d7<0x0){_0x4011d7=LIMIT_VALUE;}return _0x4011d7;};exports[_0x989c('0x14')]=function(_0x14c37e){_0x14c37e=parseInt(_0x14c37e,0xa);if(!_0x14c37e||_0x14c37e<0x0){_0x14c37e=0x0;}return _0x14c37e;};exports[_0x989c('0x15')]=function(_0x38f9f3){var _0xdb13fc,_0x4ed901=null;if(_0x38f9f3){_0xdb13fc=_0x38f9f3['split'](',');_0x4ed901=_[_0x989c('0x16')](_0xdb13fc,function(_0x1ebded){if(_0x1ebded['indexOf']('-')===0x0){return[_0x1ebded===_0x989c('0x17')?sequelize[_0x989c('0x18')](sequelize[_0x989c('0x19')](_0x989c('0x17')),_0x989c('0x1a')):_0x1ebded['substr'](0x1),'DESC'];}else{return[_0x1ebded===_0x989c('0x17')?sequelize['cast'](sequelize[_0x989c('0x19')]('priority'),_0x989c('0x1a')):_0x1ebded,_0x989c('0x1b')];}});}return _0x4ed901;};exports['omit']=function(_0x3faec3,_0x3a50cc){if(_[_0x989c('0x1c')](_0x3faec3)){return _0x3faec3;}if(_[_0x989c('0x12')](_0x3faec3)){for(var _0x32cef8=0x0;_0x32cef8<_0x3faec3[_0x989c('0x1d')];_0x32cef8+=0x1){_0x3faec3[_0x32cef8]=this[_0x989c('0x1e')](_0x3faec3[_0x32cef8],_0x3a50cc);}return _0x3faec3;}if(!_[_0x989c('0x1f')](_0x3faec3)){return _0x3faec3;}if(_[_0x989c('0x20')](_0x3a50cc)){_0x3a50cc=[_0x3a50cc];}if(!_[_0x989c('0x12')](_0x3a50cc)){return _0x3faec3;}for(var _0x2812d4=0x0;_0x2812d4<_0x3a50cc['length'];_0x2812d4+=0x1){_['unset'](_0x3faec3,_0x3a50cc[_0x2812d4]);}for(var _0x557c7c in _0x3faec3){if(_0x3faec3[_0x989c('0x21')](_0x557c7c)){_0x3faec3[_0x557c7c]=this[_0x989c('0x1e')](_0x3faec3[_0x557c7c],_0x3a50cc);}}return _0x3faec3;};exports[_0x989c('0x22')]=function(_0x3306c8){return _0x3306c8[_0x989c('0x23')](RegExp(_0x989c('0x24')))?!![]:![];};exports[_0x989c('0x25')]=function(_0x311433){return _0x311433['match'](/^\S+@\S+$/)?!![]:![];};exports[_0x989c('0x26')]=function(_0x27b309,_0x20530a){var _0x3b9bac=[];var _0x2c3b18=/[ `!@#$%^&*()_\-?~]/;var _0x3df2d4=_0x20530a?_0x989c('0x27'):_0x989c('0x28');_0x27b309[_0x989c('0x29')](/[ ,]+/)[_0x989c('0x2a')](function(_0x451e61){_0x451e61=_0x451e61[_0x989c('0x2b')](/([^:]")"+/g,'$1');_0x451e61='+'+_0x451e61+'*';var _0x216863=_0x451e61[_0x989c('0x23')](_0x2c3b18);if(_0x216863){_0x451e61='\x22'+_0x451e61+'\x22';}_0x3b9bac[_0x989c('0x2c')](_0x451e61);});_0x3df2d4=_0x3df2d4[_0x989c('0x2b')](_0x989c('0x28'),_0x3b9bac['join']('\x20'));return _0x3df2d4;};exports['getOptions']=function(_0x57309a,_0x95e2a3,_0x3b30c9){var _0x28cba5={},_0x50431a={};if(_0x95e2a3[_0x989c('0x2d')][_0x989c('0x2e')]){_0x95e2a3[_0x989c('0x2d')]['id']=_0x95e2a3[_0x989c('0x2d')][_0x989c('0x2e')];delete _0x95e2a3[_0x989c('0x2d')][_0x989c('0x2e')];}_0x28cba5[_0x989c('0x2f')]=_[_0x989c('0x16')](_0x57309a,_0x989c('0x30'));_0x28cba5[_0x989c('0x2d')]=_[_0x989c('0x5')](_0x95e2a3[_0x989c('0x2d')]);_0x28cba5['filters']=_[_0x989c('0x31')](_0x28cba5[_0x989c('0x2f')],_0x28cba5[_0x989c('0x2d')]);_0x50431a[_0x989c('0x32')]=_[_0x989c('0x31')](_0x28cba5[_0x989c('0x2f')],this[_0x989c('0x6')](_0x95e2a3['query'][_0x989c('0x6')]));_0x50431a[_0x989c('0x32')]=_0x50431a[_0x989c('0x32')][_0x989c('0x1d')]?_0x50431a['attributes']:_0x28cba5[_0x989c('0x2f')];if(!_0x95e2a3['query'][_0x989c('0x21')](_0x989c('0x33'))){_0x50431a['limit']=this[_0x989c('0x13')](_0x95e2a3[_0x989c('0x2d')][_0x989c('0x13')]);_0x50431a[_0x989c('0x14')]=this[_0x989c('0x14')](_0x95e2a3['query'][_0x989c('0x14')]);}_0x50431a[_0x989c('0x34')]=this[_0x989c('0x15')](_0x95e2a3[_0x989c('0x2d')][_0x989c('0x15')]);_0x50431a[_0x989c('0x35')]=this[_0x989c('0x36')](_[_0x989c('0x37')](_0x95e2a3[_0x989c('0x2d')],_0x28cba5[_0x989c('0x36')]),_0x57309a);if(_0x95e2a3[_0x989c('0x2d')][_0x989c('0x38')]){var _0x4cd4e4=_0x57309a;var _0x5bca11=_0x95e2a3[_0x989c('0x2d')][_0x989c('0x38')];if(typeof _0x5bca11===_0x989c('0x39')){_0x4cd4e4=_[_0x989c('0x38')](_0x57309a,function(_0x44b936){return _[_0x989c('0x3a')](_0x5bca11['columns'],_0x44b936[_0x989c('0x30')]);});_0x5bca11=_0x5bca11[_0x989c('0x3b')];}_0x50431a['where']=_[_0x989c('0x3c')](_0x50431a[_0x989c('0x35')],{'$or':_[_0x989c('0x16')](_0x4cd4e4,function(_0x2d1498){if(_0x2d1498[_0x989c('0xa')]!==_0x989c('0x3d')){if(_0x3b30c9){return sequelize['where'](sequelize['fn']('lower',sequelize[_0x989c('0x19')](_0x2d1498[_0x989c('0x30')])),{'$like':sequelize['fn']('lower','%'+_0x95e2a3[_0x989c('0x2d')][_0x989c('0x38')]+'%')});}else{var _0x5a1955={};_0x5a1955[_0x2d1498[_0x989c('0x30')]]={'$like':'%'+_0x95e2a3[_0x989c('0x2d')]['filter']+'%'};return _0x5a1955;}}})});}_0x50431a=_[_0x989c('0x3c')]({},_0x50431a,_0x95e2a3[_0x989c('0x3e')]);return _0x50431a;};exports[_0x989c('0x3f')]=function(_0x135b89){var _0x8934d0=[];if(_0x135b89[_0x989c('0x40')]){_0x8934d0['push']({'all':!![]});}else if(_0x135b89[_0x989c('0x3f')]){if(Array[_0x989c('0x12')](_0x135b89[_0x989c('0x3f')])){_0x8934d0=Object[_0x989c('0x5')](_0x135b89['include'])[_0x989c('0x16')](function(_0x49fca5){return parseIncludeModel(_0x135b89[_0x989c('0x3f')][_0x49fca5]);});}else{var _0x39db14=parseIncludeModel(_0x135b89[_0x989c('0x3f')]);_0x8934d0[_0x989c('0x2c')](_0x39db14);}}return _0x8934d0;}; \ No newline at end of file diff --git a/server/components/realtime/agents.js b/server/components/realtime/agents.js index 1d7ac47..6f39f09 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 _0x95e8=['getRealtimeAgents','pause','*pause','busy','getAgentStatus','isArray','startCase','Queue','map','all','then','flatten','uniq','value','getAgentIdsByQueues','filter','includes','resolve','User','findAll','fullname','pauseType','find','getSortedAgentsIdsByStatus','fields','globalStatus','order','startsWith','ASC','fullname,internal','substring','indexOf','internal','sort','DESC','toLowerCase','sortAgentsByStatus','userpic','online','lastLoginAt','lastPauseAt','address','chatCapacity','mailCapacity','smsCapacity','whatsappCapacity','chatCurrentCapacity','openchannelCurrentCapacity','mailCurrentCapacity','smsCurrentCapacity','faxCurrentCapacity','openchannelStatus','smsStatus','openchannelStatusTime','mailStatusTime','voiceStatusTime','queue','destconnectedlinenum','screenrecording','phoneBarEnableScreenRecordingByAgent','phoneBarEnableAutomaticScreenRecording','routealias','omit','filterAgentAttributes','lodash','jayson/promise','../../mysqldb','client','http','chatPause','faxPause','mailPause','openchannelPause','smsPause','whatsappPause','every','length','idle','unknown','isNil','voiceStatus','voicePause','chatStatus','faxStatus','mailStatus','whatsappStatus','request','error','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)','result','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)','merge','catch'];(function(_0x4257a1,_0x512d35){var _0x263b38=function(_0x895794){while(--_0x895794){_0x4257a1['push'](_0x4257a1['shift']());}};_0x263b38(++_0x512d35);}(_0x95e8,0x157));var _0x895e=function(_0x2a3405,_0x282cdf){_0x2a3405=_0x2a3405-0x0;var _0x467a0e=_0x95e8[_0x2a3405];return _0x467a0e;};'use strict';var _=require(_0x895e('0x0'));var jayson=require(_0x895e('0x1'));var db=require(_0x895e('0x2'))['db'];var amiClient=jayson[_0x895e('0x3')][_0x895e('0x4')]({'port':0x232a});var routingClient=jayson[_0x895e('0x3')]['http']({'port':0x232c});function isAgentPaused(_0x5b1aee,_0x3ce3c6){var _0x9453f=[_0x5b1aee[_0x895e('0x5')],_0x5b1aee[_0x895e('0x6')],_0x5b1aee[_0x895e('0x7')],_0x5b1aee[_0x895e('0x8')],_0x5b1aee[_0x895e('0x9')],_0x5b1aee['voicePause'],_0x5b1aee[_0x895e('0xa')]];if(!_0x3ce3c6)return _[_0x895e('0xb')](_0x9453f);var _0xf7f5bf=_['filter'](_0x9453f);return _0xf7f5bf[_0x895e('0xc')]>0x0&&_0xf7f5bf[_0x895e('0xc')]<_0x9453f[_0x895e('0xc')]?!![]:![];}function isIdle(_0x5d6899){return _0x5d6899===_0x895e('0xd')||_0x5d6899===_0x895e('0xe')||_0x5d6899==='unavailable'||_0x5d6899==='ringing'||_[_0x895e('0xf')](_0x5d6899);}function isAgentIdle(_0x196a74){if(_0x196a74[_0x895e('0x10')]!==_0x895e('0xd')&&_0x196a74[_0x895e('0x11')]){_0x196a74['voiceStatus']='pause';return![];}return _['every']([_0x196a74[_0x895e('0x12')],_0x196a74[_0x895e('0x13')],_0x196a74[_0x895e('0x14')],_0x196a74['openchannelStatus'],_0x196a74['smsStatus'],_0x196a74[_0x895e('0x10')],_0x196a74[_0x895e('0x15')]],isIdle);}function getRealtimeAgents(){return amiClient[_0x895e('0x16')]('Agents',{})['then'](function(_0x31387c){if(_0x31387c[_0x895e('0x17')]){throw new Error(_0x895e('0x18'));}var _0x56d647=_0x31387c[_0x895e('0x19')];return routingClient[_0x895e('0x16')]('Agents',{})['then'](function(_0x27613b){if(_0x27613b[_0x895e('0x17')]){throw new Error(_0x895e('0x1a'));}var _0x16093f=_0x27613b[_0x895e('0x19')];return _[_0x895e('0x1b')]({},_0x56d647,_0x16093f);});})[_0x895e('0x1c')](function(_0x1bb36c){throw _0x1bb36c;});}exports[_0x895e('0x1d')]=getRealtimeAgents;function getAgentStatus(_0x56f095){var _0x315434=_0x895e('0xe');if(isAgentPaused(_0x56f095))_0x315434=_0x895e('0x1e');else if(isAgentPaused(_0x56f095,!![]))_0x315434=_0x895e('0x1f');else if(isAgentIdle(_0x56f095))_0x315434=_0x895e('0xd');else _0x315434=_0x895e('0x20');return _0x315434;}exports[_0x895e('0x21')]=getAgentStatus;function getAgentIdsByQueues(_0x4c8e23,_0x1e0369){var _0x1bf61f=_[_0x895e('0x22')](_0x4c8e23)?_0x4c8e23:[_0x4c8e23];var _0x16a9f0=_[_0x895e('0x23')](_0x1e0369)+_0x895e('0x24');var _0x17f157=_[_0x895e('0x25')](_0x1bf61f,function(_0x1ec955){return db[_0x16a9f0]['findOne']({'where':{'id':_0x1ec955}})['then'](function(_0x282d77){if(!_0x282d77)return[];return _0x282d77['getAgents']({'attributes':['id'],'raw':!![]});});});return Promise[_0x895e('0x26')](_0x17f157)[_0x895e('0x27')](function(_0x513ae2){var _0x3d4540=_(_0x513ae2)[_0x895e('0x28')]()[_0x895e('0x25')]('id')[_0x895e('0x29')]()[_0x895e('0x2a')]();return _0x3d4540;});}exports[_0x895e('0x2b')]=getAgentIdsByQueues;function getAgentIdsByStatus(_0x3934c8,_0x1116dd,_0x342c8a){try{if(_0x1116dd[_0x895e('0xc')]>0x0){_0x3934c8=_0x3934c8[_0x895e('0x2c')](function(_0x5da652){return _0x1116dd[_0x895e('0x2d')](_0x5da652['id']);});}var _0x3c4b71=_0x3934c8[_0x895e('0x2c')](function(_0x2e3f99){var _0xafa039=_0x895e('0x20');if(isAgentIdle(_0x2e3f99)){_0xafa039=_0x895e('0xd');}return _0xafa039===_0x342c8a;});return _['map'](_0x3c4b71,'id');}catch(_0x2cfed5){throw _0x2cfed5;}}exports['getAgentIdsByStatus']=getAgentIdsByStatus;function getSortedAgentsIdsByStatus(_0x2bdb09,_0x9bcea9,_0x46cfd8){return Promise[_0x895e('0x2e')]()['then'](function(){if(_0x9bcea9[_0x895e('0xc')]>0x0){_0x2bdb09=_0x2bdb09[_0x895e('0x2c')](function(_0x43c56d){return _0x9bcea9[_0x895e('0x2d')](_0x43c56d['id']);});}return _0x2bdb09;})[_0x895e('0x27')](function(){return db[_0x895e('0x2f')][_0x895e('0x30')]({'attributes':['id','name',_0x895e('0x31'),_0x895e('0x5'),'faxPause','mailPause','openchannelPause',_0x895e('0x9'),_0x895e('0x11'),'whatsappPause',_0x895e('0x32')],'where':{'id':{'$in':_[_0x895e('0x25')](_0x2bdb09,'id')}},'raw':!![]});})[_0x895e('0x27')](function(_0x19aedc){return _0x19aedc[_0x895e('0x25')](function(_0x4f5d4a){var _0xb5277=_[_0x895e('0x33')](_0x2bdb09,['id',_0x4f5d4a['id']]);var _0x2e6653=filterAgentAttributes(_0xb5277);_[_0x895e('0x1b')](_0x4f5d4a,_0x2e6653);_0x4f5d4a['globalStatus']=getAgentStatus(_0x4f5d4a);return _0x4f5d4a;});})['then'](function(_0x226f34){var _0x53c309=sortAgentsByStatus(_0x226f34,_0x46cfd8);return _[_0x895e('0x25')](_0x53c309,'id');})[_0x895e('0x1c')](function(_0x3eeae8){throw _0x3eeae8;});}exports[_0x895e('0x34')]=getSortedAgentsIdsByStatus;function getUpdatedSortOptions(_0x31c482){var _0x2591ef={'fields':[],'order':null};var _0x200cae=_0x31c482['split'](',');_0x2591ef[_0x895e('0x35')]=_[_0x895e('0x2c')](_0x200cae,function(_0x3dda43){if(!_0x3dda43[_0x895e('0x2d')](_0x895e('0x36'))){return!![];}_0x2591ef[_0x895e('0x37')]=_[_0x895e('0x38')](_0x3dda43,'-')?'DESC':_0x895e('0x39');return![];});return _0x2591ef;}exports['getUpdatedSortOptions']=getUpdatedSortOptions;function validateSortParameter(_0x56d162){if(!_0x56d162){_0x56d162=_0x895e('0x3a');}if(_0x56d162[_0x895e('0x2d')]('fullname')&&!_0x56d162[_0x895e('0x2d')]('internal')){var _0x43fb31=_0x56d162[_0x895e('0x3b')](0x0,_0x56d162[_0x895e('0x3c')]('fullname'));_0x56d162+=','+_0x43fb31+_0x895e('0x3d');}return _0x56d162;}exports['validateSortParameter']=validateSortParameter;function sortAgentsByStatus(_0x52cf15,_0x517106){var _0x583e4b=_0x52cf15[_0x895e('0x3e')](function(_0x1a1eca,_0x51117f){if(_0x1a1eca[_0x895e('0x36')]===_0x51117f[_0x895e('0x36')]){if(_0x1a1eca[_0x895e('0x36')]===_0x895e('0x1e')){if(_0x517106===_0x895e('0x3f')){return(_0x1a1eca['pauseType']||'')<(_0x51117f[_0x895e('0x32')]||'')||_0x1a1eca[_0x895e('0x31')][_0x895e('0x40')]()>_0x51117f[_0x895e('0x31')][_0x895e('0x40')]()?0x1:-0x1;}else{return(_0x1a1eca[_0x895e('0x32')]||'')<(_0x51117f[_0x895e('0x32')]||'')||_0x1a1eca[_0x895e('0x31')][_0x895e('0x40')]()>_0x51117f['fullname'][_0x895e('0x40')]()?-0x1:0x1;}}else{if(_0x517106===_0x895e('0x3f')){return _0x1a1eca['fullname'][_0x895e('0x40')]()<_0x51117f['fullname'][_0x895e('0x40')]()?0x1:-0x1;}else{return _0x1a1eca[_0x895e('0x31')][_0x895e('0x40')]()<_0x51117f[_0x895e('0x31')][_0x895e('0x40')]()?-0x1:0x1;}}}else{if(_0x517106==='DESC'){return _0x1a1eca[_0x895e('0x36')]<_0x51117f[_0x895e('0x36')]?0x1:-0x1;}else{return _0x1a1eca[_0x895e('0x36')]<_0x51117f[_0x895e('0x36')]?-0x1:0x1;}}});return _0x583e4b;}exports[_0x895e('0x41')]=sortAgentsByStatus;function filterAgentAttributes(_0x2fdb45){var _0x570110=[_0x895e('0x42'),_0x895e('0x43'),_0x895e('0x44'),_0x895e('0x45'),'pauseType',_0x895e('0x45'),_0x895e('0x3d'),_0x895e('0x46'),_0x895e('0x5'),'openchannelPause','mailPause',_0x895e('0x9'),_0x895e('0xa'),_0x895e('0x6'),_0x895e('0x11'),_0x895e('0x47'),'openchannelCapacity',_0x895e('0x48'),_0x895e('0x49'),_0x895e('0x4a'),'faxCapacity',_0x895e('0x4b'),_0x895e('0x4c'),_0x895e('0x4d'),_0x895e('0x4e'),'whatsappCurrentCapacity',_0x895e('0x4f'),'chatStatus',_0x895e('0x50'),_0x895e('0x14'),_0x895e('0x51'),_0x895e('0x15'),_0x895e('0x13'),_0x895e('0x10'),'chatStatusTime',_0x895e('0x52'),_0x895e('0x53'),'smsStatusTime','whatsappStatusTime','faxStatusTime',_0x895e('0x54'),_0x895e('0x55'),_0x895e('0x56'),_0x895e('0x57'),_0x895e('0x58'),_0x895e('0x59'),_0x895e('0x5a')];var _0x386591=[_0x895e('0x5'),_0x895e('0x8'),'mailPause',_0x895e('0x9'),'whatsappPause',_0x895e('0x6'),_0x895e('0x11'),_0x895e('0x43')];var _0x3d2b45=_(_0x2fdb45)[_0x895e('0x5b')](_0x386591)['pick'](_0x570110)[_0x895e('0x2a')]();return _0x3d2b45;}exports[_0x895e('0x5c')]=filterAgentAttributes; \ No newline at end of file +var _0x8852=['fullname','internal','substring','validateSortParameter','toLowerCase','sortAgentsByStatus','userpic','online','lastLoginAt','lastPauseAt','chatCapacity','smsCapacity','whatsappCapacity','chatCurrentCapacity','openchannelCurrentCapacity','mailCurrentCapacity','smsCurrentCapacity','whatsappCurrentCapacity','faxCurrentCapacity','chatStatus','whatsappStatus','chatStatusTime','openchannelStatusTime','mailStatusTime','whatsappStatusTime','faxStatusTime','voiceStatusTime','screenrecording','phoneBarEnableScreenRecordingByAgent','phoneBarEnableAutomaticScreenRecording','routealias','mailPause','omit','pick','filterAgentAttributes','lodash','jayson/promise','../../mysqldb','client','http','chatPause','faxPause','smsPause','voicePause','every','length','unknown','unavailable','ringing','isNil','voiceStatus','faxStatus','mailStatus','openchannelStatus','smsStatus','request','Agents','then','error','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)','result','merge','catch','getRealtimeAgents','pause','*pause','busy','getAgentStatus','isArray','startCase','Queue','map','all','flatten','uniq','value','getAgentIdsByQueues','filter','includes','getAgentIdsByStatus','resolve','User','findAll','name','openchannelPause','whatsappPause','pauseType','find','globalStatus','getSortedAgentsIdsByStatus','split','fields','order','DESC','ASC','getUpdatedSortOptions'];(function(_0x124e8c,_0x28b175){var _0x311c78=function(_0xb1dda5){while(--_0xb1dda5){_0x124e8c['push'](_0x124e8c['shift']());}};_0x311c78(++_0x28b175);}(_0x8852,0x84));var _0x2885=function(_0x164eca,_0x555e28){_0x164eca=_0x164eca-0x0;var _0x2ce562=_0x8852[_0x164eca];return _0x2ce562;};'use strict';var _=require(_0x2885('0x0'));var jayson=require(_0x2885('0x1'));var db=require(_0x2885('0x2'))['db'];var amiClient=jayson[_0x2885('0x3')][_0x2885('0x4')]({'port':0x232a});var routingClient=jayson[_0x2885('0x3')][_0x2885('0x4')]({'port':0x232c});function isAgentPaused(_0x86ac8c,_0x296395){var _0x341636=[_0x86ac8c[_0x2885('0x5')],_0x86ac8c[_0x2885('0x6')],_0x86ac8c['mailPause'],_0x86ac8c['openchannelPause'],_0x86ac8c[_0x2885('0x7')],_0x86ac8c[_0x2885('0x8')],_0x86ac8c['whatsappPause']];if(!_0x296395)return _[_0x2885('0x9')](_0x341636);var _0x39e443=_['filter'](_0x341636);return _0x39e443[_0x2885('0xa')]>0x0&&_0x39e443[_0x2885('0xa')]<_0x341636[_0x2885('0xa')]?!![]:![];}function isIdle(_0x263b9c){return _0x263b9c==='idle'||_0x263b9c===_0x2885('0xb')||_0x263b9c===_0x2885('0xc')||_0x263b9c===_0x2885('0xd')||_[_0x2885('0xe')](_0x263b9c);}function isAgentIdle(_0x4fe982){if(_0x4fe982['voiceStatus']!=='idle'&&_0x4fe982[_0x2885('0x8')]){_0x4fe982[_0x2885('0xf')]='pause';return![];}return _[_0x2885('0x9')]([_0x4fe982['chatStatus'],_0x4fe982[_0x2885('0x10')],_0x4fe982[_0x2885('0x11')],_0x4fe982[_0x2885('0x12')],_0x4fe982[_0x2885('0x13')],_0x4fe982[_0x2885('0xf')],_0x4fe982['whatsappStatus']],isIdle);}function getRealtimeAgents(){return amiClient[_0x2885('0x14')](_0x2885('0x15'),{})[_0x2885('0x16')](function(_0x21d606){if(_0x21d606[_0x2885('0x17')]){throw new Error(_0x2885('0x18'));}var _0x102fb2=_0x21d606['result'];return routingClient['request']('Agents',{})['then'](function(_0x434938){if(_0x434938['error']){throw new Error(_0x2885('0x19'));}var _0x1d0141=_0x434938[_0x2885('0x1a')];return _[_0x2885('0x1b')]({},_0x102fb2,_0x1d0141);});})[_0x2885('0x1c')](function(_0x21a2e8){throw _0x21a2e8;});}exports[_0x2885('0x1d')]=getRealtimeAgents;function getAgentStatus(_0x3a925a){var _0x191b16='unknown';if(isAgentPaused(_0x3a925a))_0x191b16=_0x2885('0x1e');else if(isAgentPaused(_0x3a925a,!![]))_0x191b16=_0x2885('0x1f');else if(isAgentIdle(_0x3a925a))_0x191b16='idle';else _0x191b16=_0x2885('0x20');return _0x191b16;}exports[_0x2885('0x21')]=getAgentStatus;function getAgentIdsByQueues(_0x49e6b7,_0xf0266c){var _0x120d70=_[_0x2885('0x22')](_0x49e6b7)?_0x49e6b7:[_0x49e6b7];var _0x2e1561=_[_0x2885('0x23')](_0xf0266c)+_0x2885('0x24');var _0x30deb5=_[_0x2885('0x25')](_0x120d70,function(_0xba565b){return db[_0x2e1561]['findOne']({'where':{'id':_0xba565b}})[_0x2885('0x16')](function(_0x2a9de4){if(!_0x2a9de4)return[];return _0x2a9de4['getAgents']({'attributes':['id'],'raw':!![]});});});return Promise[_0x2885('0x26')](_0x30deb5)[_0x2885('0x16')](function(_0x96fa54){var _0x1e778d=_(_0x96fa54)[_0x2885('0x27')]()[_0x2885('0x25')]('id')[_0x2885('0x28')]()[_0x2885('0x29')]();return _0x1e778d;});}exports[_0x2885('0x2a')]=getAgentIdsByQueues;function getAgentIdsByStatus(_0x52e88f,_0x5d65d5,_0x24f72c){try{if(_0x5d65d5[_0x2885('0xa')]>0x0){_0x52e88f=_0x52e88f[_0x2885('0x2b')](function(_0x272222){return _0x5d65d5[_0x2885('0x2c')](_0x272222['id']);});}var _0x5dc0fb=_0x52e88f[_0x2885('0x2b')](function(_0x6f296e){var _0x5e01f6='busy';if(isAgentIdle(_0x6f296e)){_0x5e01f6='idle';}return _0x5e01f6===_0x24f72c;});return _[_0x2885('0x25')](_0x5dc0fb,'id');}catch(_0x4ff255){throw _0x4ff255;}}exports[_0x2885('0x2d')]=getAgentIdsByStatus;function getSortedAgentsIdsByStatus(_0x511211,_0x18ba9b,_0x41c4e4){return Promise[_0x2885('0x2e')]()['then'](function(){if(_0x18ba9b[_0x2885('0xa')]>0x0){_0x511211=_0x511211[_0x2885('0x2b')](function(_0x1f922d){return _0x18ba9b['includes'](_0x1f922d['id']);});}return _0x511211;})['then'](function(){return db[_0x2885('0x2f')][_0x2885('0x30')]({'attributes':['id',_0x2885('0x31'),'fullname',_0x2885('0x5'),'faxPause','mailPause',_0x2885('0x32'),_0x2885('0x7'),'voicePause',_0x2885('0x33'),_0x2885('0x34')],'where':{'id':{'$in':_[_0x2885('0x25')](_0x511211,'id')}},'raw':!![]});})[_0x2885('0x16')](function(_0x56ccad){return _0x56ccad[_0x2885('0x25')](function(_0x102af2){var _0x4e93a1=_[_0x2885('0x35')](_0x511211,['id',_0x102af2['id']]);var _0x5a5583=filterAgentAttributes(_0x4e93a1);_[_0x2885('0x1b')](_0x102af2,_0x5a5583);_0x102af2[_0x2885('0x36')]=getAgentStatus(_0x102af2);return _0x102af2;});})[_0x2885('0x16')](function(_0x50fe3c){var _0xf02def=sortAgentsByStatus(_0x50fe3c,_0x41c4e4);return _[_0x2885('0x25')](_0xf02def,'id');})['catch'](function(_0x56b631){throw _0x56b631;});}exports[_0x2885('0x37')]=getSortedAgentsIdsByStatus;function getUpdatedSortOptions(_0x34d3b2){var _0x80a69={'fields':[],'order':null};var _0x383e9d=_0x34d3b2[_0x2885('0x38')](',');_0x80a69[_0x2885('0x39')]=_[_0x2885('0x2b')](_0x383e9d,function(_0x34c190){if(!_0x34c190[_0x2885('0x2c')]('globalStatus')){return!![];}_0x80a69[_0x2885('0x3a')]=_['startsWith'](_0x34c190,'-')?_0x2885('0x3b'):_0x2885('0x3c');return![];});return _0x80a69;}exports[_0x2885('0x3d')]=getUpdatedSortOptions;function validateSortParameter(_0x552a0a){if(!_0x552a0a){_0x552a0a='fullname,internal';}if(_0x552a0a['includes'](_0x2885('0x3e'))&&!_0x552a0a['includes'](_0x2885('0x3f'))){var _0x529d89=_0x552a0a[_0x2885('0x40')](0x0,_0x552a0a['indexOf'](_0x2885('0x3e')));_0x552a0a+=','+_0x529d89+'internal';}return _0x552a0a;}exports[_0x2885('0x41')]=validateSortParameter;function sortAgentsByStatus(_0x2f10e5,_0x2210d0){var _0x5219ea=_0x2f10e5['sort'](function(_0x35ef18,_0x4cb058){if(_0x35ef18['globalStatus']===_0x4cb058['globalStatus']){if(_0x35ef18[_0x2885('0x36')]===_0x2885('0x1e')){if(_0x2210d0===_0x2885('0x3b')){return(_0x35ef18[_0x2885('0x34')]||'')<(_0x4cb058[_0x2885('0x34')]||'')||_0x35ef18[_0x2885('0x3e')][_0x2885('0x42')]()>_0x4cb058[_0x2885('0x3e')][_0x2885('0x42')]()?0x1:-0x1;}else{return(_0x35ef18[_0x2885('0x34')]||'')<(_0x4cb058[_0x2885('0x34')]||'')||_0x35ef18[_0x2885('0x3e')][_0x2885('0x42')]()>_0x4cb058[_0x2885('0x3e')][_0x2885('0x42')]()?-0x1:0x1;}}else{if(_0x2210d0===_0x2885('0x3b')){return _0x35ef18[_0x2885('0x3e')][_0x2885('0x42')]()<_0x4cb058[_0x2885('0x3e')][_0x2885('0x42')]()?0x1:-0x1;}else{return _0x35ef18[_0x2885('0x3e')]['toLowerCase']()<_0x4cb058[_0x2885('0x3e')]['toLowerCase']()?-0x1:0x1;}}}else{if(_0x2210d0===_0x2885('0x3b')){return _0x35ef18[_0x2885('0x36')]<_0x4cb058[_0x2885('0x36')]?0x1:-0x1;}else{return _0x35ef18[_0x2885('0x36')]<_0x4cb058[_0x2885('0x36')]?-0x1:0x1;}}});return _0x5219ea;}exports[_0x2885('0x43')]=sortAgentsByStatus;function filterAgentAttributes(_0x262153){var _0x30df47=[_0x2885('0x44'),_0x2885('0x45'),_0x2885('0x46'),'lastPauseAt',_0x2885('0x34'),_0x2885('0x47'),'internal','address',_0x2885('0x5'),_0x2885('0x32'),'mailPause',_0x2885('0x7'),_0x2885('0x33'),_0x2885('0x6'),_0x2885('0x8'),_0x2885('0x48'),'openchannelCapacity','mailCapacity',_0x2885('0x49'),_0x2885('0x4a'),'faxCapacity',_0x2885('0x4b'),_0x2885('0x4c'),_0x2885('0x4d'),_0x2885('0x4e'),_0x2885('0x4f'),_0x2885('0x50'),_0x2885('0x51'),_0x2885('0x12'),'mailStatus','smsStatus',_0x2885('0x52'),'faxStatus',_0x2885('0xf'),_0x2885('0x53'),_0x2885('0x54'),_0x2885('0x55'),'smsStatusTime',_0x2885('0x56'),_0x2885('0x57'),_0x2885('0x58'),'queue','destconnectedlinenum',_0x2885('0x59'),_0x2885('0x5a'),_0x2885('0x5b'),_0x2885('0x5c')];var _0x3fa2a8=[_0x2885('0x5'),_0x2885('0x32'),_0x2885('0x5d'),_0x2885('0x7'),_0x2885('0x33'),_0x2885('0x6'),_0x2885('0x8'),_0x2885('0x45')];var _0x240de=_(_0x262153)[_0x2885('0x5e')](_0x3fa2a8)[_0x2885('0x5f')](_0x30df47)[_0x2885('0x29')]();return _0x240de;}exports[_0x2885('0x60')]=filterAgentAttributes; \ No newline at end of file diff --git a/server/components/realtime/queues.js b/server/components/realtime/queues.js index c5709fc..86827ba 100644 --- a/server/components/realtime/queues.js +++ b/server/components/realtime/queues.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1078=['dialMethod','startPredictive','erlangCallToSecond','erlangBusyFactor','dialPredictiveInterval','dialPredictiveIntervalMaxThreshold','predictiveIntervalAvailable','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','voice','request','startCase','then','error','Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues','result','getRealtimeQueues','inbound','outbound','concat','map','merge','pick','lodash','jayson/promise','util','client','paused','busy','inUse','invalid','loggedInDb','notInUse','onHold','ringing','ringInUse','talking','unknown','pTalking','originated','message','statusMessage'];(function(_0x5194f3,_0x4136a6){var _0x5734a6=function(_0x192704){while(--_0x192704){_0x5194f3['push'](_0x5194f3['shift']());}};_0x5734a6(++_0x4136a6);}(_0x1078,0x1b9));var _0x8107=function(_0x25baf6,_0x35f025){_0x25baf6=_0x25baf6-0x0;var _0x2a2565=_0x1078[_0x25baf6];return _0x2a2565;};'use strict';var _=require(_0x8107('0x0'));var jayson=require(_0x8107('0x1'));var util=require(_0x8107('0x2'));var amiClient=jayson[_0x8107('0x3')]['http']({'port':0x232a});var routingClient=jayson['client']['http']({'port':0x232c});var DEFAULT_QUEUE_ATTRIBUTES=['available','loggedIn',_0x8107('0x4'),'waiting'];var VOICE_QUEUE_ATTRIBUTES=[_0x8107('0x5'),_0x8107('0x6'),_0x8107('0x7'),_0x8107('0x8'),_0x8107('0x9'),_0x8107('0xa'),_0x8107('0xb'),_0x8107('0xc'),_0x8107('0xd'),'unavailable',_0x8107('0xe')];var OUTBOUND_QUEUE_ATTRIBUTES=[_0x8107('0xf'),_0x8107('0x10'),_0x8107('0x11'),_0x8107('0x12'),'dialActive',_0x8107('0x13'),'Trunk',_0x8107('0x14'),'startProgressive','erlangCalls',_0x8107('0x15'),'erlangAbandonmentRate',_0x8107('0x16'),_0x8107('0x17'),_0x8107('0x18'),'dialPredictiveIntervalMinThreshold',_0x8107('0x19'),_0x8107('0x1a'),_0x8107('0x1b'),_0x8107('0x1c'),_0x8107('0x1d'),_0x8107('0x1e'),_0x8107('0x1f')];function getRealtimeQueues(_0x17dd05,_0x5c7573){var _0x59a754=_0x5c7573===_0x8107('0x20')?amiClient:routingClient;return _0x59a754[_0x8107('0x21')](_[_0x8107('0x22')](_0x5c7573)+'Queues',_0x17dd05)[_0x8107('0x23')](function(_0x2447e0){if(_0x2447e0[_0x8107('0x24')])throw new Error(util['format'](_0x8107('0x25'),_0x5c7573));return _0x2447e0[_0x8107('0x26')];})['catch'](function(_0x891896){throw _0x891896;});}exports[_0x8107('0x27')]=getRealtimeQueues;function initializeQueues(_0x3a46b6,_0x2753f0,_0x3853c8,_0x2d0b81){var _0x59733b=DEFAULT_QUEUE_ATTRIBUTES;if(_0x3853c8===_0x8107('0x20')){if(_0x2d0b81===_0x8107('0x28')){_0x59733b=_0x59733b['concat'](VOICE_QUEUE_ATTRIBUTES);}else if(_0x2d0b81===_0x8107('0x29')){_0x59733b=_0x59733b[_0x8107('0x2a')](VOICE_QUEUE_ATTRIBUTES,OUTBOUND_QUEUE_ATTRIBUTES);}}return _0x3a46b6[_0x8107('0x2b')](function(_0x1a680a){var _0x19eb78=_0x1a680a['get']({'plain':!![]});_0x19eb78[_0x8107('0x4')]=0x0;_0x19eb78[_0x8107('0x8')]=0x0;_0x19eb78['loggedIn']=0x0;_0x19eb78['available']=0x0;_0x19eb78['waiting']=0x0;if(_0x3853c8===_0x8107('0x20')){_0x19eb78[_0x8107('0xd')]=0x0;_0x19eb78[_0x8107('0x5')]=0x0;if(_0x2d0b81==='outbound'){_0x19eb78[_0x8107('0xf')]=0x0;_0x19eb78['originated']=0x0;}}var _0x4e59e3=_['find'](_0x2753f0,['id',_0x19eb78['id']]);if(_0x4e59e3){_[_0x8107('0x2c')](_0x19eb78,_[_0x8107('0x2d')](_0x4e59e3,_0x59733b));}return _0x19eb78;});}exports['initializeQueues']=initializeQueues; \ No newline at end of file +var _0x22e1=['talking','unavailable','unknown','originated','message','dialActive','Trunk','startPredictive','startProgressive','erlangCalls','erlangAbandonmentRate','erlangBusyFactor','dialPredictiveInterval','dialPredictiveIntervalMinThreshold','predictiveIntervalAvailable','predictiveIntervalTotalCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','request','startCase','getRealtimeQueues','voice','inbound','concat','outbound','map','get','loggedInDb','available','merge','pick','lodash','http','client','loggedIn','paused','waiting','busy','notInUse','onHold','ringInUse'];(function(_0x699871,_0x2b7b43){var _0x1de521=function(_0x115dab){while(--_0x115dab){_0x699871['push'](_0x699871['shift']());}};_0x1de521(++_0x2b7b43);}(_0x22e1,0x179));var _0x122e=function(_0x451cca,_0x2f5278){_0x451cca=_0x451cca-0x0;var _0x340d9c=_0x22e1[_0x451cca];return _0x340d9c;};'use strict';var _=require(_0x122e('0x0'));var jayson=require('jayson/promise');var util=require('util');var amiClient=jayson['client'][_0x122e('0x1')]({'port':0x232a});var routingClient=jayson[_0x122e('0x2')][_0x122e('0x1')]({'port':0x232c});var DEFAULT_QUEUE_ATTRIBUTES=['available',_0x122e('0x3'),_0x122e('0x4'),_0x122e('0x5')];var VOICE_QUEUE_ATTRIBUTES=[_0x122e('0x6'),'inUse','invalid','loggedInDb',_0x122e('0x7'),_0x122e('0x8'),'ringing',_0x122e('0x9'),_0x122e('0xa'),_0x122e('0xb'),_0x122e('0xc')];var OUTBOUND_QUEUE_ATTRIBUTES=['pTalking',_0x122e('0xd'),_0x122e('0xe'),'statusMessage',_0x122e('0xf'),'dialMethod',_0x122e('0x10'),_0x122e('0x11'),_0x122e('0x12'),_0x122e('0x13'),'erlangCallToSecond',_0x122e('0x14'),_0x122e('0x15'),_0x122e('0x16'),'dialPredictiveIntervalMaxThreshold',_0x122e('0x17'),_0x122e('0x18'),_0x122e('0x19'),'predictiveIntervalAnsweredCalls',_0x122e('0x1a'),_0x122e('0x1b'),_0x122e('0x1c'),_0x122e('0x1d')];function getRealtimeQueues(_0x3b9dab,_0x397850){var _0x295598=_0x397850==='voice'?amiClient:routingClient;return _0x295598[_0x122e('0x1e')](_[_0x122e('0x1f')](_0x397850)+'Queues',_0x3b9dab)['then'](function(_0x3abeca){if(_0x3abeca['error'])throw new Error(util['format']('Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues',_0x397850));return _0x3abeca['result'];})['catch'](function(_0x1dab10){throw _0x1dab10;});}exports[_0x122e('0x20')]=getRealtimeQueues;function initializeQueues(_0x4c6314,_0xcc6172,_0xac9f29,_0x4d6481){var _0x42a855=DEFAULT_QUEUE_ATTRIBUTES;if(_0xac9f29===_0x122e('0x21')){if(_0x4d6481===_0x122e('0x22')){_0x42a855=_0x42a855[_0x122e('0x23')](VOICE_QUEUE_ATTRIBUTES);}else if(_0x4d6481===_0x122e('0x24')){_0x42a855=_0x42a855[_0x122e('0x23')](VOICE_QUEUE_ATTRIBUTES,OUTBOUND_QUEUE_ATTRIBUTES);}}return _0x4c6314[_0x122e('0x25')](function(_0x2f8d57){var _0x1f1267=_0x2f8d57[_0x122e('0x26')]({'plain':!![]});_0x1f1267[_0x122e('0x4')]=0x0;_0x1f1267[_0x122e('0x27')]=0x0;_0x1f1267[_0x122e('0x3')]=0x0;_0x1f1267[_0x122e('0x28')]=0x0;_0x1f1267[_0x122e('0x5')]=0x0;if(_0xac9f29==='voice'){_0x1f1267['talking']=0x0;_0x1f1267['busy']=0x0;if(_0x4d6481==='outbound'){_0x1f1267['pTalking']=0x0;_0x1f1267[_0x122e('0xd')]=0x0;}}var _0x473c81=_['find'](_0xcc6172,['id',_0x1f1267['id']]);if(_0x473c81){_[_0x122e('0x29')](_0x1f1267,_[_0x122e('0x2a')](_0x473c81,_0x42a855));}return _0x1f1267;});}exports['initializeQueues']=initializeQueues; \ No newline at end of file diff --git a/server/config/express.js b/server/config/express.js index d416b40..35fe84c 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(_0x566a4e,_0xeeb3f6){var _0x36d409=function(_0x25960c){while(--_0x25960c){_0x566a4e['push'](_0x566a4e['shift']());}};_0x36d409(++_0xeeb3f6);}(_0x9957,0x93));var _0x7995=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x9957[_0x1ac595];return _0x455fff;};'use strict';var express=require(_0x7995('0x0'));var methodOverride=require(_0x7995('0x1'));var cookieParser=require(_0x7995('0x2'));var errorHandler=require(_0x7995('0x3'));var path=require('path');var passport=require(_0x7995('0x4'));var cors=require(_0x7995('0x5'));var config=require(_0x7995('0x6'));exports[_0x7995('0x7')]=function(_0x576d89){var _0x744bea=_0x576d89[_0x7995('0x8')](_0x7995('0x9'));if(_0x744bea===_0x7995('0xa')){_0x576d89[_0x7995('0xb')](_0x7995('0xc'),path['join'](config[_0x7995('0xd')],_0x7995('0xe')));}if(_0x744bea==='development'||_0x744bea===_0x7995('0xf')){_0x576d89[_0x7995('0xb')](_0x7995('0xc'),path[_0x7995('0x10')](config[_0x7995('0xd')],_0x7995('0x11')));_0x576d89[_0x7995('0x12')](errorHandler());}_0x576d89['set'](_0x7995('0x13'),function(_0x41c652,_0x581f22){if(this[_0x41c652]instanceof Date){_0x581f22=this[_0x41c652][_0x7995('0x14')]()[_0x7995('0x15')]('.')[0x0]+'Z';}return _0x581f22;});_0x576d89[_0x7995('0x12')](express[_0x7995('0x16')](_0x576d89[_0x7995('0x8')](_0x7995('0xc'))));_0x576d89[_0x7995('0xb')]('views',config['root']+_0x7995('0x17'));_0x576d89[_0x7995('0x18')](_0x7995('0x19'),require(_0x7995('0x1a'))[_0x7995('0x1b')]);_0x576d89[_0x7995('0xb')](_0x7995('0x1c'),_0x7995('0x19'));_0x576d89['use'](express[_0x7995('0x1d')]({'limit':'50mb','extended':!![]}));_0x576d89[_0x7995('0x12')](express[_0x7995('0x1e')]({'limit':_0x7995('0x1f')}));_0x576d89[_0x7995('0x12')](cors());_0x576d89[_0x7995('0x12')](methodOverride());_0x576d89[_0x7995('0x12')](cookieParser());_0x576d89['use'](passport['initialize']());}; \ No newline at end of file +var _0xa9e0=['get','production','set','appPath','public','join','root','client','use','toISOString','split','static','views','/server/views','engine','html','ejs','urlencoded','50mb','json','initialize','express','method-override','cookie-parser','passport','./environment','default'];(function(_0x1bda6c,_0x5440b1){var _0x501a86=function(_0x1de54c){while(--_0x1de54c){_0x1bda6c['push'](_0x1bda6c['shift']());}};_0x501a86(++_0x5440b1);}(_0xa9e0,0x123));var _0x0a9e=function(_0xae7c2f,_0xf31e04){_0xae7c2f=_0xae7c2f-0x0;var _0x5d7001=_0xa9e0[_0xae7c2f];return _0x5d7001;};'use strict';var express=require(_0x0a9e('0x0'));var methodOverride=require(_0x0a9e('0x1'));var cookieParser=require(_0x0a9e('0x2'));var errorHandler=require('errorhandler');var path=require('path');var passport=require(_0x0a9e('0x3'));var cors=require('cors');var config=require(_0x0a9e('0x4'));exports[_0x0a9e('0x5')]=function(_0x2ab90b){var _0x991246=_0x2ab90b[_0x0a9e('0x6')]('env');if(_0x991246===_0x0a9e('0x7')){_0x2ab90b[_0x0a9e('0x8')](_0x0a9e('0x9'),path['join'](config['root'],_0x0a9e('0xa')));}if(_0x991246==='development'||_0x991246==='test'){_0x2ab90b[_0x0a9e('0x8')](_0x0a9e('0x9'),path[_0x0a9e('0xb')](config[_0x0a9e('0xc')],_0x0a9e('0xd')));_0x2ab90b[_0x0a9e('0xe')](errorHandler());}_0x2ab90b['set']('json\x20replacer',function(_0x527cdd,_0x4cfe67){if(this[_0x527cdd]instanceof Date){_0x4cfe67=this[_0x527cdd][_0x0a9e('0xf')]()[_0x0a9e('0x10')]('.')[0x0]+'Z';}return _0x4cfe67;});_0x2ab90b[_0x0a9e('0xe')](express[_0x0a9e('0x11')](_0x2ab90b[_0x0a9e('0x6')](_0x0a9e('0x9'))));_0x2ab90b['set'](_0x0a9e('0x12'),config[_0x0a9e('0xc')]+_0x0a9e('0x13'));_0x2ab90b[_0x0a9e('0x14')](_0x0a9e('0x15'),require(_0x0a9e('0x16'))['renderFile']);_0x2ab90b[_0x0a9e('0x8')]('view\x20engine',_0x0a9e('0x15'));_0x2ab90b['use'](express[_0x0a9e('0x17')]({'limit':_0x0a9e('0x18'),'extended':!![]}));_0x2ab90b['use'](express[_0x0a9e('0x19')]({'limit':'50mb'}));_0x2ab90b[_0x0a9e('0xe')](cors());_0x2ab90b[_0x0a9e('0xe')](methodOverride());_0x2ab90b[_0x0a9e('0xe')](cookieParser());_0x2ab90b[_0x0a9e('0xe')](passport[_0x0a9e('0x1a')]());}; \ No newline at end of file diff --git a/server/config/license/hardware.js b/server/config/license/hardware.js index bf168cb..1611733 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 _0x3928=['ipAddress','substring','crypto','bimedia-machine-uuid','child_process','execSync','../environment','networkInterfaces','orderBy','keys','filter','family','IPv4','internal','concat','mac','00:00:00:00:00:00','address','127.0.0.1','getFirstInterface','cpus','map','model','join','createHash','md5','update','digest','hex','getUuid','licenseToken','test','win32','dmidecode\x20--string\x20system-uuid','utf8','macAddress'];(function(_0x456418,_0x513607){var _0x32ccd7=function(_0x3c8495){while(--_0x3c8495){_0x456418['push'](_0x456418['shift']());}};_0x32ccd7(++_0x513607);}(_0x3928,0x1d6));var _0x8392=function(_0x4a97b4,_0x486675){_0x4a97b4=_0x4a97b4-0x0;var _0x67c691=_0x3928[_0x4a97b4];return _0x67c691;};'use strict';var _=require('lodash');var os=require('os');var crypto=require(_0x8392('0x0'));var machine=require(_0x8392('0x1'));var exec=require(_0x8392('0x2'))[_0x8392('0x3')];var config=require(_0x8392('0x4'));function getInterfaces(){var _0x1c8845=[];var _0x310b9a=os[_0x8392('0x5')]();var _0x367c9d=_[_0x8392('0x6')](_[_0x8392('0x7')](_0x310b9a));for(var _0x326e89=0x0;_0x326e89<_0x367c9d['length'];_0x326e89++){var _0x342ad5=_0x310b9a[_0x367c9d[_0x326e89]][_0x8392('0x8')](function(_0xa14038){return _0xa14038[_0x8392('0x9')]===_0x8392('0xa')&&_0xa14038[_0x8392('0xb')]===![];});_0x1c8845=_0x1c8845[_0x8392('0xc')](_0x342ad5);}return _0x1c8845;}function getFirstInterface(){var _0x35a711=_['head'](getInterfaces());return{'macAddress':_0x35a711&&_0x35a711[_0x8392('0xd')]?_0x35a711['mac']:_0x8392('0xe'),'ipAddress':_0x35a711&&_0x35a711[_0x8392('0xf')]?_0x35a711[_0x8392('0xf')]:_0x8392('0x10')};}exports[_0x8392('0x11')]=getFirstInterface;function getCPUhash(){var _0x5804ab=_['orderBy'](os[_0x8392('0x12')]()[_0x8392('0x13')](function(_0x4607de){return _0x4607de[_0x8392('0x14')];}))[_0x8392('0x15')](':');return crypto[_0x8392('0x16')](_0x8392('0x17'))[_0x8392('0x18')](_0x5804ab)[_0x8392('0x19')](_0x8392('0x1a'));}exports[_0x8392('0x1b')]=function(){var _0xf01dd7=os['platform']();var _0x9bda16=/[0-9a-f-]{36}/;if(config[_0x8392('0x1c')]&&_0x9bda16[_0x8392('0x1d')](config['licenseToken'])){return config[_0x8392('0x1c')];}else if(_0xf01dd7===_0x8392('0x1e')){return exec(_0x8392('0x1f'),{'encoding':_0x8392('0x20')})['replace']('\x0d\x0a','');}else{var _0x1f44c2=getFirstInterface();var _0xbff0c1=getCPUhash();var _0x487d8c=_0xbff0c1+'|'+os['hostname']()+'|'+_0x1f44c2[_0x8392('0x21')]+'|'+_0x1f44c2[_0x8392('0x22')];var _0x149110=crypto['createHash']('md5')['update'](_0x487d8c)[_0x8392('0x19')](_0x8392('0x1a'));return _0x149110['substring'](0x0,0x8)+'-'+_0x149110[_0x8392('0x23')](0x8,0xc)+'-'+_0x149110['substring'](0xc,0x10)+'-'+_0x149110['substring'](0x10,0x14)+'-'+_0x149110['substring'](0x14);}}; \ No newline at end of file +var _0x4335=['getFirstInterface','cpus','map','join','md5','update','digest','getUuid','platform','licenseToken','test','win32','dmidecode\x20--string\x20system-uuid','utf8','replace','hostname','ipAddress','hex','substring','lodash','crypto','bimedia-machine-uuid','child_process','execSync','../environment','networkInterfaces','orderBy','keys','length','filter','family','IPv4','internal','concat','head','mac','00:00:00:00:00:00','address','127.0.0.1'];(function(_0x55f8b4,_0x43f30d){var _0x2475f9=function(_0xdd6f4a){while(--_0xdd6f4a){_0x55f8b4['push'](_0x55f8b4['shift']());}};_0x2475f9(++_0x43f30d);}(_0x4335,0x1e7));var _0x5433=function(_0xbe200f,_0x4b50eb){_0xbe200f=_0xbe200f-0x0;var _0x192597=_0x4335[_0xbe200f];return _0x192597;};'use strict';var _=require(_0x5433('0x0'));var os=require('os');var crypto=require(_0x5433('0x1'));var machine=require(_0x5433('0x2'));var exec=require(_0x5433('0x3'))[_0x5433('0x4')];var config=require(_0x5433('0x5'));function getInterfaces(){var _0x1ddd00=[];var _0x4e9da8=os[_0x5433('0x6')]();var _0x3c2ba4=_[_0x5433('0x7')](_[_0x5433('0x8')](_0x4e9da8));for(var _0x4ac69a=0x0;_0x4ac69a<_0x3c2ba4[_0x5433('0x9')];_0x4ac69a++){var _0x3b9b74=_0x4e9da8[_0x3c2ba4[_0x4ac69a]][_0x5433('0xa')](function(_0x20a638){return _0x20a638[_0x5433('0xb')]===_0x5433('0xc')&&_0x20a638[_0x5433('0xd')]===![];});_0x1ddd00=_0x1ddd00[_0x5433('0xe')](_0x3b9b74);}return _0x1ddd00;}function getFirstInterface(){var _0x4cca31=_[_0x5433('0xf')](getInterfaces());return{'macAddress':_0x4cca31&&_0x4cca31[_0x5433('0x10')]?_0x4cca31[_0x5433('0x10')]:_0x5433('0x11'),'ipAddress':_0x4cca31&&_0x4cca31[_0x5433('0x12')]?_0x4cca31[_0x5433('0x12')]:_0x5433('0x13')};}exports[_0x5433('0x14')]=getFirstInterface;function getCPUhash(){var _0x19da74=_['orderBy'](os[_0x5433('0x15')]()[_0x5433('0x16')](function(_0x5cbc30){return _0x5cbc30['model'];}))[_0x5433('0x17')](':');return crypto['createHash'](_0x5433('0x18'))[_0x5433('0x19')](_0x19da74)[_0x5433('0x1a')]('hex');}exports[_0x5433('0x1b')]=function(){var _0x4d6ced=os[_0x5433('0x1c')]();var _0x56e58f=/[0-9a-f-]{36}/;if(config[_0x5433('0x1d')]&&_0x56e58f[_0x5433('0x1e')](config['licenseToken'])){return config[_0x5433('0x1d')];}else if(_0x4d6ced===_0x5433('0x1f')){return exec(_0x5433('0x20'),{'encoding':_0x5433('0x21')})[_0x5433('0x22')]('\x0d\x0a','');}else{var _0x1da913=getFirstInterface();var _0x4f665b=getCPUhash();var _0x33b55f=_0x4f665b+'|'+os[_0x5433('0x23')]()+'|'+_0x1da913['macAddress']+'|'+_0x1da913[_0x5433('0x24')];var _0x5c683c=crypto['createHash']('md5')[_0x5433('0x19')](_0x33b55f)[_0x5433('0x1a')](_0x5433('0x25'));return _0x5c683c[_0x5433('0x26')](0x0,0x8)+'-'+_0x5c683c[_0x5433('0x26')](0x8,0xc)+'-'+_0x5c683c[_0x5433('0x26')](0xc,0x10)+'-'+_0x5c683c[_0x5433('0x26')](0x10,0x14)+'-'+_0x5c683c[_0x5433('0x26')](0x14);}}; \ No newline at end of file diff --git a/server/config/license/index.js b/server/config/license/index.js index cab8cc7..422438d 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 _0x3b60=['finally','getUuid','License','findOrCreate','spread','SERVICE\x20LICENSE\x20STARTED\x20%s','message','default','util','moment','request-promise','bluebird','pkginfo','version','../../mysqldb','../../components/encryptor','./hardware','../logger','license','format','%s/api/servers/%s/check?version=%s','exports','%s/api/servers/%s/check?version=%s&oldtoken=%s','then','catch','data1','data2','active','info','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED','update','Disabled','THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED','Changed','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','toUpperCase','YYYY-MM-DD\x20HH:mm','encryptString','days','error'];(function(_0x473ac3,_0xf8066a){var _0x563cfd=function(_0x54b0eb){while(--_0x54b0eb){_0x473ac3['push'](_0x473ac3['shift']());}};_0x563cfd(++_0xf8066a);}(_0x3b60,0xac));var _0x03b6=function(_0x5f1d7f,_0x3ce067){_0x5f1d7f=_0x5f1d7f-0x0;var _0x43dca9=_0x3b60[_0x5f1d7f];return _0x43dca9;};'use strict';var util=require(_0x03b6('0x0'));var moment=require(_0x03b6('0x1'));var rp=require(_0x03b6('0x2'));var BPromise=require(_0x03b6('0x3'));var pkginfo=require(_0x03b6('0x4'))(module,_0x03b6('0x5'));var db=require(_0x03b6('0x6'))['db'];var encryptor=require(_0x03b6('0x7'));var hardware=require(_0x03b6('0x8'));var logger=require(_0x03b6('0x9'))(_0x03b6('0xa'));var HOST='https://www.xcallymotion.com';var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x318384){return new BPromise(function(_0xf2144,_0x36cb60){var _0x1220d4=util[_0x03b6('0xb')](_0x03b6('0xc'),HOST,_0x318384,module[_0x03b6('0xd')][_0x03b6('0x5')]);if(oldToken){_0x1220d4=util[_0x03b6('0xb')](_0x03b6('0xe'),HOST,_0x318384,module[_0x03b6('0xd')]['version'],oldToken);}var _0x147a24={'uri':_0x1220d4,'method':'GET','timeout':0xea60,'json':!![]};return rp(_0x147a24)[_0x03b6('0xf')](function(_0x816151){_0xf2144(_0x816151);})[_0x03b6('0x10')](function(_0x4d0455){_0x36cb60(_0x4d0455);});});}function manageLicense(_0x4a9611,_0x271ff6){var _0x5d6924=_0x271ff6['get']({'plain':!![]});if(!isOldTokenSent&&_0x5d6924[_0x03b6('0x11')]!==_0x4a9611&&!_0x5d6924[_0x03b6('0x12')]){oldToken=_0x5d6924['data1'];}httpRequest(_0x4a9611)[_0x03b6('0xf')](function(_0x5cc52e){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x5cc52e[_0x03b6('0x13')]){isOldTokenSent=![];if(!_0x5d6924['license']&&_0x5d6924[_0x03b6('0xa')]!=_0x5cc52e[_0x03b6('0xa')]||_0x5d6924['license']&&_0x5d6924['data2']){logger[_0x03b6('0x14')](_0x03b6('0x15'));}if(_0x5d6924[_0x03b6('0xa')]&&!_0x5d6924[_0x03b6('0x12')]&&_0x5d6924[_0x03b6('0xa')]!=_0x5cc52e[_0x03b6('0xa')]){logger[_0x03b6('0x14')](_0x03b6('0x16'));}if(_0x5d6924[_0x03b6('0xa')]&&!_0x5d6924[_0x03b6('0x12')]&&_0x5d6924[_0x03b6('0xa')]==_0x5cc52e[_0x03b6('0xa')]){return _0x271ff6;}return _0x271ff6[_0x03b6('0x17')]({'data1':_0x4a9611,'data2':null,'license':_0x5cc52e['license']});}else{if(_0x5cc52e[_0x03b6('0xa')]||_0x5d6924[_0x03b6('0xa')]){if(!_0x5d6924[_0x03b6('0x12')]){if(_0x5d6924[_0x03b6('0x11')]==_0x4a9611){GRAY_PERIOD_REASON=_0x03b6('0x18');logger[_0x03b6('0x14')](_0x03b6('0x19'));}else{GRAY_PERIOD_REASON=_0x03b6('0x1a');logger[_0x03b6('0x14')](_0x03b6('0x1b'),_0x5d6924[_0x03b6('0x11')],_0x4a9611);}logger['info']('%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s',GRAY_PERIOD_REASON[_0x03b6('0x1c')](),moment()['format'](_0x03b6('0x1d')));return _0x271ff6[_0x03b6('0x17')]({'data2':encryptor[_0x03b6('0x1e')](moment()[_0x03b6('0xb')](_0x03b6('0x1d')))});}else{if(moment()['diff'](encryptor['decryptString'](_0x5d6924['data2']),_0x03b6('0x1f'))>DAYS){logger['info']('DEMO\x20START\x20AT\x20%s',moment()[_0x03b6('0xb')](_0x03b6('0x1d')));isOldTokenSent=![];return _0x271ff6['update']({'data1':_0x4a9611,'data2':null,'license':null});}}}else{if(_0x5d6924[_0x03b6('0x11')]!=_0x4a9611){logger[_0x03b6('0x14')](_0x03b6('0x1b'),_0x5d6924[_0x03b6('0x11')],_0x4a9611);return _0x271ff6[_0x03b6('0x17')]({'data1':_0x4a9611,'data2':null,'license':null});}}}return _0x271ff6;})[_0x03b6('0xf')](function(_0x4a6eba){_0x271ff6=_0x4a6eba;})[_0x03b6('0x10')](function(_0x1bcea9){logger[_0x03b6('0x20')](_0x1bcea9['message']);})[_0x03b6('0x21')](function(){setTimeout(function(){manageLicense(hardware[_0x03b6('0x22')](),_0x271ff6);},TIME);});}function defaultLicense(){var _0x5acaf8=hardware[_0x03b6('0x22')]();if(_0x5acaf8){return db[_0x03b6('0x23')][_0x03b6('0x24')]({'where':{'id':0x1},'defaults':{'data1':_0x5acaf8}})[_0x03b6('0x25')](function(_0xa059b1,_0x2f44a6){logger[_0x03b6('0x14')](_0x03b6('0x26'),_0x5acaf8);manageLicense(_0x5acaf8,_0xa059b1);})[_0x03b6('0x10')](function(_0x1ca286){logger[_0x03b6('0x20')](_0x1ca286[_0x03b6('0x27')]);});}}exports[_0x03b6('0x28')]=defaultLicense; \ No newline at end of file +var _0xac63=['%s/api/servers/%s/check?version=%s&oldtoken=%s','exports','GET','then','data2','data1','active','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','info','THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED','update','Changed','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s','format','YYYY-MM-DD\x20HH:mm','encryptString','diff','decryptString','days','DEMO\x20START\x20AT\x20%s','catch','error','finally','getUuid','License','findOrCreate','spread','SERVICE\x20LICENSE\x20STARTED\x20%s','default','util','bluebird','pkginfo','../../mysqldb','../../components/encryptor','./hardware','../logger','license','https://www.xcallymotion.com','%s/api/servers/%s/check?version=%s','version'];(function(_0x8250fc,_0x6099c5){var _0x9e37c4=function(_0x5858ae){while(--_0x5858ae){_0x8250fc['push'](_0x8250fc['shift']());}};_0x9e37c4(++_0x6099c5);}(_0xac63,0x1b8));var _0x3ac6=function(_0x43d16c,_0x2b5447){_0x43d16c=_0x43d16c-0x0;var _0x208cce=_0xac63[_0x43d16c];return _0x208cce;};'use strict';var util=require(_0x3ac6('0x0'));var moment=require('moment');var rp=require('request-promise');var BPromise=require(_0x3ac6('0x1'));var pkginfo=require(_0x3ac6('0x2'))(module,'version');var db=require(_0x3ac6('0x3'))['db'];var encryptor=require(_0x3ac6('0x4'));var hardware=require(_0x3ac6('0x5'));var logger=require(_0x3ac6('0x6'))(_0x3ac6('0x7'));var HOST=_0x3ac6('0x8');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x472c0d){return new BPromise(function(_0x105e8d,_0x1cf1fc){var _0x532848=util['format'](_0x3ac6('0x9'),HOST,_0x472c0d,module['exports'][_0x3ac6('0xa')]);if(oldToken){_0x532848=util['format'](_0x3ac6('0xb'),HOST,_0x472c0d,module[_0x3ac6('0xc')]['version'],oldToken);}var _0x54d2e4={'uri':_0x532848,'method':_0x3ac6('0xd'),'timeout':0xea60,'json':!![]};return rp(_0x54d2e4)[_0x3ac6('0xe')](function(_0x4583d0){_0x105e8d(_0x4583d0);})['catch'](function(_0x3223df){_0x1cf1fc(_0x3223df);});});}function manageLicense(_0x17ff10,_0x365dd7){var _0x25875c=_0x365dd7['get']({'plain':!![]});if(!isOldTokenSent&&_0x25875c['data1']!==_0x17ff10&&!_0x25875c[_0x3ac6('0xf')]){oldToken=_0x25875c[_0x3ac6('0x10')];}httpRequest(_0x17ff10)['then'](function(_0x4c2f52){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x4c2f52[_0x3ac6('0x11')]){isOldTokenSent=![];if(!_0x25875c[_0x3ac6('0x7')]&&_0x25875c[_0x3ac6('0x7')]!=_0x4c2f52[_0x3ac6('0x7')]||_0x25875c[_0x3ac6('0x7')]&&_0x25875c[_0x3ac6('0xf')]){logger['info'](_0x3ac6('0x12'));}if(_0x25875c[_0x3ac6('0x7')]&&!_0x25875c['data2']&&_0x25875c[_0x3ac6('0x7')]!=_0x4c2f52[_0x3ac6('0x7')]){logger[_0x3ac6('0x13')](_0x3ac6('0x14'));}if(_0x25875c[_0x3ac6('0x7')]&&!_0x25875c['data2']&&_0x25875c[_0x3ac6('0x7')]==_0x4c2f52[_0x3ac6('0x7')]){return _0x365dd7;}return _0x365dd7[_0x3ac6('0x15')]({'data1':_0x17ff10,'data2':null,'license':_0x4c2f52[_0x3ac6('0x7')]});}else{if(_0x4c2f52[_0x3ac6('0x7')]||_0x25875c[_0x3ac6('0x7')]){if(!_0x25875c[_0x3ac6('0xf')]){if(_0x25875c[_0x3ac6('0x10')]==_0x17ff10){GRAY_PERIOD_REASON='Disabled';logger['info']('THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED');}else{GRAY_PERIOD_REASON=_0x3ac6('0x16');logger[_0x3ac6('0x13')](_0x3ac6('0x17'),_0x25875c[_0x3ac6('0x10')],_0x17ff10);}logger[_0x3ac6('0x13')](_0x3ac6('0x18'),GRAY_PERIOD_REASON['toUpperCase'](),moment()[_0x3ac6('0x19')](_0x3ac6('0x1a')));return _0x365dd7['update']({'data2':encryptor[_0x3ac6('0x1b')](moment()['format'](_0x3ac6('0x1a')))});}else{if(moment()[_0x3ac6('0x1c')](encryptor[_0x3ac6('0x1d')](_0x25875c[_0x3ac6('0xf')]),_0x3ac6('0x1e'))>DAYS){logger[_0x3ac6('0x13')](_0x3ac6('0x1f'),moment()[_0x3ac6('0x19')]('YYYY-MM-DD\x20HH:mm'));isOldTokenSent=![];return _0x365dd7[_0x3ac6('0x15')]({'data1':_0x17ff10,'data2':null,'license':null});}}}else{if(_0x25875c['data1']!=_0x17ff10){logger[_0x3ac6('0x13')](_0x3ac6('0x17'),_0x25875c[_0x3ac6('0x10')],_0x17ff10);return _0x365dd7['update']({'data1':_0x17ff10,'data2':null,'license':null});}}}return _0x365dd7;})[_0x3ac6('0xe')](function(_0x3b8f67){_0x365dd7=_0x3b8f67;})[_0x3ac6('0x20')](function(_0x20533f){logger[_0x3ac6('0x21')](_0x20533f['message']);})[_0x3ac6('0x22')](function(){setTimeout(function(){manageLicense(hardware[_0x3ac6('0x23')](),_0x365dd7);},TIME);});}function defaultLicense(){var _0x4f3c8f=hardware[_0x3ac6('0x23')]();if(_0x4f3c8f){return db[_0x3ac6('0x24')][_0x3ac6('0x25')]({'where':{'id':0x1},'defaults':{'data1':_0x4f3c8f}})[_0x3ac6('0x26')](function(_0x547288,_0x1d34a6){logger[_0x3ac6('0x13')](_0x3ac6('0x27'),_0x4f3c8f);manageLicense(_0x4f3c8f,_0x547288);})[_0x3ac6('0x20')](function(_0x185749){logger[_0x3ac6('0x21')](_0x185749['message']);});}}exports[_0x3ac6('0x28')]=defaultLicense; \ No newline at end of file diff --git a/server/config/license/util.js b/server/config/license/util.js index 4e047dd..cedac7f 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 _0x8846=['role','user','users','forEach','admin','count','pick','countBy','telephone','License\x20limit\x20reached\x20for\x20users','License\x20limit\x20reached\x20for\x20telephones','util','lodash','moment','bluebird','./hardware','../../components/encryptor','2027-01-01T00:00:00.000Z','Demo\x20license','Breaking\x20license','getUuid','License','defaults','then','catch','data1','license','isEmpty','License\x20key\x20value\x20not\x20found','split','decryptString','format','parse','uuid','machineUuid','deadline','add','days','grayReason','changed','message','findAll','sequelize','COUNT','col'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x8846,0xec));var _0x6884=function(_0x59b475,_0x38e91f){_0x59b475=_0x59b475-0x0;var _0x377cc8=_0x8846[_0x59b475];return _0x377cc8;};'use strict';var util=require(_0x6884('0x0'));var _=require(_0x6884('0x1'));var moment=require(_0x6884('0x2'));var BPromise=require(_0x6884('0x3'));var hardware=require(_0x6884('0x4'));var encryptor=require(_0x6884('0x5'));var db=require('../../mysqldb')['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x6884('0x6'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':_0x6884('0x7'),'machineUuid':hardware['getUuid'](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x6884('0x6'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':_0x6884('0x8'),'machineUuid':hardware[_0x6884('0x9')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x294c17){return new BPromise(function(_0x3b025c,_0x2481e3){return db[_0x6884('0xa')]['find'](_[_0x6884('0xb')](_0x294c17,{'raw':!![],'where':{'id':0x1}}))['then'](function(_0xc8c3d8){return checkLicense(_0xc8c3d8,null);})[_0x6884('0xc')](function(_0x3e4bbe){_0x3b025c(_0x3e4bbe);return;})[_0x6884('0xd')](function(_0x58d158){_0x2481e3(_0x58d158);});});}function checkLicense(_0x1ed89c,_0x1fefd0){if(!_0x1ed89c){demoLicense['uuid']=_0x1ed89c[_0x6884('0xe')];return demoLicense;}try{var _0x5be9aa=_0x1fefd0||_0x1ed89c[_0x6884('0xf')];if(_[_0x6884('0x10')](_0x5be9aa)){throw new Error(_0x6884('0x11'));}var _0x325d4e=_0x1ed89c[_0x6884('0xe')];var _0x59a9ef=_0x1ed89c['data2'];var _0x48050c=_0x325d4e[_0x6884('0x12')]('-')[0x4];var _0x492683=_0x325d4e['split']('-')[0x0];var _0x409a97=encryptor[_0x6884('0x13')](_0x5be9aa,util[_0x6884('0x14')]('%s:%s:%s',_0x48050c,_0x325d4e,_0x492683));var _0x4b21c7=JSON[_0x6884('0x15')](_0x409a97);_0x4b21c7['demo']=![];_0x4b21c7[_0x6884('0x16')]=_0x325d4e;_0x4b21c7[_0x6884('0x17')]=hardware[_0x6884('0x9')]();if(_0x59a9ef){var _0x1999d4=encryptor['decryptString'](_0x59a9ef);_0x4b21c7['gray']=_0x1999d4;_0x4b21c7[_0x6884('0x18')]=moment(_0x1999d4)[_0x6884('0x19')](0x7,_0x6884('0x1a'))['format']();_0x4b21c7[_0x6884('0x1b')]=_0x4b21c7[_0x6884('0x16')]!=_0x4b21c7[_0x6884('0x17')]?_0x6884('0x1c'):'disabled';}return _0x4b21c7;}catch(_0x3179dd){breakingLicense[_0x6884('0x16')]=_0x1ed89c[_0x6884('0xe')];breakingLicense['message']=_0x3179dd[_0x6884('0x1d')];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x2b06a9,_0x4a2d65){getLicense()[_0x6884('0xc')](function(_0x45d080){return db['User'][_0x6884('0x1e')]({'attributes':['role',[db[_0x6884('0x1f')]['fn'](_0x6884('0x20'),db[_0x6884('0x1f')][_0x6884('0x21')](_0x6884('0x22'))),'count']],'group':_0x6884('0x22'),'where':{'role':{'$or':['admin',_0x6884('0x23'),'telephone']}},'raw':!![]})[_0x6884('0xc')](function(_0x18fe5e){var _0x370bc8={'user':_0x45d080[_0x6884('0x24')]||0x0,'telephone':_0x45d080['telephones']||0x0};_0x18fe5e[_0x6884('0x25')](function(_0xaaf0fe){var _0x2da727=_0xaaf0fe['role']===_0x6884('0x26')?_0x6884('0x23'):_0xaaf0fe[_0x6884('0x22')];_0x370bc8[_0x2da727]-=_0xaaf0fe[_0x6884('0x27')];if(_0x370bc8[_0x2da727]<0x0)_0x370bc8[_0x2da727]=0x0;});_0x2b06a9(_0x370bc8);return;});})[_0x6884('0xd')](function(_0x245467){_0x4a2d65(_0x245467);});});}function checkUserLimits(_0x4cc925){return new BPromise(function(_0x14f020,_0x438580){getLimits()[_0x6884('0xc')](function(_0x4b2264){var _0x33c305=_[_0x6884('0x28')](_[_0x6884('0x29')](_0x4cc925,_0x6884('0x22')),[_0x6884('0x26'),'user',_0x6884('0x2a')]);var _0x5eaf6e=(_0x33c305[_0x6884('0x26')]||0x0)+(_0x33c305['user']||0x0);var _0x459efc=_0x33c305[_0x6884('0x2a')]||0x0;if(_0x5eaf6e>_0x4b2264[_0x6884('0x23')])return _0x438580(_0x6884('0x2b'));if(_0x459efc>_0x4b2264[_0x6884('0x2a')])return _0x438580(_0x6884('0x2c'));return _0x14f020();})[_0x6884('0xd')](function(_0x172d43){_0x438580(_0x172d43);});});}module['exports']={'checkLicense':checkLicense,'checkUserLimits':checkUserLimits,'getLicense':getLicense}; \ No newline at end of file +var _0x1168=['License\x20key\x20value\x20not\x20found','data2','split','format','%s:%s:%s','machineUuid','decryptString','days','grayReason','changed','disabled','message','User','findAll','role','sequelize','COUNT','count','telephone','users','telephones','forEach','admin','user','pick','License\x20limit\x20reached\x20for\x20telephones','exports','util','moment','bluebird','./hardware','../../components/encryptor','../../mysqldb','getUuid','2027-01-01T00:00:00.000Z','Breaking\x20license','License','find','then','catch','uuid','data1','license','isEmpty'];(function(_0x389a4d,_0x271a9d){var _0x3df3d1=function(_0x5a0def){while(--_0x5a0def){_0x389a4d['push'](_0x389a4d['shift']());}};_0x3df3d1(++_0x271a9d);}(_0x1168,0xf7));var _0x8116=function(_0x3805e9,_0x33a4ed){_0x3805e9=_0x3805e9-0x0;var _0x207e20=_0x1168[_0x3805e9];return _0x207e20;};'use strict';var util=require(_0x8116('0x0'));var _=require('lodash');var moment=require(_0x8116('0x1'));var BPromise=require(_0x8116('0x2'));var hardware=require(_0x8116('0x3'));var encryptor=require(_0x8116('0x4'));var db=require(_0x8116('0x5'))['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':'Demo\x20license','machineUuid':hardware[_0x8116('0x6')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x8116('0x7'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':_0x8116('0x8'),'machineUuid':hardware[_0x8116('0x6')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x3372ac){return new BPromise(function(_0x2446d1,_0x4c555d){return db[_0x8116('0x9')][_0x8116('0xa')](_['defaults'](_0x3372ac,{'raw':!![],'where':{'id':0x1}}))[_0x8116('0xb')](function(_0x578277){return checkLicense(_0x578277,null);})[_0x8116('0xb')](function(_0x34d328){_0x2446d1(_0x34d328);return;})[_0x8116('0xc')](function(_0x513cbd){_0x4c555d(_0x513cbd);});});}function checkLicense(_0x59479a,_0x1bf739){if(!_0x59479a){demoLicense[_0x8116('0xd')]=_0x59479a[_0x8116('0xe')];return demoLicense;}try{var _0x3f42b9=_0x1bf739||_0x59479a[_0x8116('0xf')];if(_[_0x8116('0x10')](_0x3f42b9)){throw new Error(_0x8116('0x11'));}var _0x36666e=_0x59479a[_0x8116('0xe')];var _0x20335f=_0x59479a[_0x8116('0x12')];var _0x27301b=_0x36666e[_0x8116('0x13')]('-')[0x4];var _0x306eeb=_0x36666e[_0x8116('0x13')]('-')[0x0];var _0x5e6c80=encryptor['decryptString'](_0x3f42b9,util[_0x8116('0x14')](_0x8116('0x15'),_0x27301b,_0x36666e,_0x306eeb));var _0x39fbdb=JSON['parse'](_0x5e6c80);_0x39fbdb['demo']=![];_0x39fbdb['uuid']=_0x36666e;_0x39fbdb[_0x8116('0x16')]=hardware[_0x8116('0x6')]();if(_0x20335f){var _0x315f74=encryptor[_0x8116('0x17')](_0x20335f);_0x39fbdb['gray']=_0x315f74;_0x39fbdb['deadline']=moment(_0x315f74)['add'](0x7,_0x8116('0x18'))[_0x8116('0x14')]();_0x39fbdb[_0x8116('0x19')]=_0x39fbdb[_0x8116('0xd')]!=_0x39fbdb[_0x8116('0x16')]?_0x8116('0x1a'):_0x8116('0x1b');}return _0x39fbdb;}catch(_0x260a4f){breakingLicense[_0x8116('0xd')]=_0x59479a[_0x8116('0xe')];breakingLicense['message']=_0x260a4f[_0x8116('0x1c')];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x37d437,_0x48eb47){getLicense()[_0x8116('0xb')](function(_0x5d98f1){return db[_0x8116('0x1d')][_0x8116('0x1e')]({'attributes':[_0x8116('0x1f'),[db[_0x8116('0x20')]['fn'](_0x8116('0x21'),db['sequelize']['col'](_0x8116('0x1f'))),_0x8116('0x22')]],'group':_0x8116('0x1f'),'where':{'role':{'$or':['admin','user',_0x8116('0x23')]}},'raw':!![]})[_0x8116('0xb')](function(_0x4ced2e){var _0x7f28b1={'user':_0x5d98f1[_0x8116('0x24')]||0x0,'telephone':_0x5d98f1[_0x8116('0x25')]||0x0};_0x4ced2e[_0x8116('0x26')](function(_0x50ee27){var _0x455c6b=_0x50ee27['role']===_0x8116('0x27')?_0x8116('0x28'):_0x50ee27[_0x8116('0x1f')];_0x7f28b1[_0x455c6b]-=_0x50ee27[_0x8116('0x22')];if(_0x7f28b1[_0x455c6b]<0x0)_0x7f28b1[_0x455c6b]=0x0;});_0x37d437(_0x7f28b1);return;});})['catch'](function(_0x1f127b){_0x48eb47(_0x1f127b);});});}function checkUserLimits(_0x91dd1b){return new BPromise(function(_0x5d387d,_0x5a5870){getLimits()['then'](function(_0x2785e3){var _0x340521=_[_0x8116('0x29')](_['countBy'](_0x91dd1b,'role'),['admin',_0x8116('0x28'),_0x8116('0x23')]);var _0x528e01=(_0x340521[_0x8116('0x27')]||0x0)+(_0x340521['user']||0x0);var _0x50329c=_0x340521[_0x8116('0x23')]||0x0;if(_0x528e01>_0x2785e3[_0x8116('0x28')])return _0x5a5870('License\x20limit\x20reached\x20for\x20users');if(_0x50329c>_0x2785e3['telephone'])return _0x5a5870(_0x8116('0x2a'));return _0x5d387d();})['catch'](function(_0x196256){_0x5a5870(_0x196256);});});}module[_0x8116('0x2b')]={'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 a6143ac..d5cb14e 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 _0x4991=['secret','exports','myappanuglar-secret'];(function(_0x473658,_0x4683b1){var _0x16ffcb=function(_0x41744d){while(--_0x41744d){_0x473658['push'](_0x473658['shift']());}};_0x16ffcb(++_0x4683b1);}(_0x4991,0xf7));var _0x1499=function(_0x4a3ad6,_0x2debf4){_0x4a3ad6=_0x4a3ad6-0x0;var _0x528bb6=_0x4991[_0x4a3ad6];return _0x528bb6;};'use strict';module[_0x1499('0x0')]={'DOMAIN':'http://localhost:9000','SESSION_SECRET':_0x1499('0x1'),'GOOGLE_ID':'app-id','GOOGLE_SECRET':_0x1499('0x2'),'DEBUG':''}; \ No newline at end of file +var _0x0972=['http://localhost:9000','app-id'];(function(_0x5db12e,_0x35cf78){var _0x5c98f5=function(_0x4186bf){while(--_0x4186bf){_0x5db12e['push'](_0x5db12e['shift']());}};_0x5c98f5(++_0x35cf78);}(_0x0972,0x64));var _0x2097=function(_0x15258a,_0x30cd1e){_0x15258a=_0x15258a-0x0;var _0x54cbd2=_0x0972[_0x15258a];return _0x54cbd2;};'use strict';module['exports']={'DOMAIN':_0x2097('0x0'),'SESSION_SECRET':'myappanuglar-secret','GOOGLE_ID':_0x2097('0x1'),'GOOGLE_SECRET':'secret','DEBUG':''}; \ No newline at end of file diff --git a/server/config/logger.js b/server/config/logger.js index 259a3b8..e71799d 100644 --- a/server/config/logger.js +++ b/server/config/logger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4b83=['../utils/loggers'];(function(_0x5ee3d3,_0x537c30){var _0x4b272f=function(_0x3dc277){while(--_0x3dc277){_0x5ee3d3['push'](_0x5ee3d3['shift']());}};_0x4b272f(++_0x537c30);}(_0x4b83,0x16d));var _0x34b8=function(_0x57ad23,_0xade05){_0x57ad23=_0x57ad23-0x0;var _0x3d6220=_0x4b83[_0x57ad23];return _0x3d6220;};'use strict';var fileLogger=require(_0x34b8('0x0'))['fileLogger'];module['exports']=fileLogger; \ No newline at end of file +var _0x57f4=['fileLogger','exports','../utils/loggers'];(function(_0xcdd89b,_0x40b13f){var _0x1c525d=function(_0x39138c){while(--_0x39138c){_0xcdd89b['push'](_0xcdd89b['shift']());}};_0x1c525d(++_0x40b13f);}(_0x57f4,0xd1));var _0x457f=function(_0x530853,_0x4a579e){_0x530853=_0x530853-0x0;var _0x5cedfa=_0x57f4[_0x530853];return _0x5cedfa;};'use strict';var fileLogger=require(_0x457f('0x0'))[_0x457f('0x1')];module[_0x457f('0x2')]=fileLogger; \ No newline at end of file diff --git a/server/config/pm2/config.js b/server/config/pm2/config.js index 388b0fd..5f48638 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 _0x82db=['join','root','legacy-libs','express','../../services/express/index.js','ami','../../services/agi/index.js','../../services/email/index.js','routing','../../services/routing/index.js','path','../../config/environment','resolve'];(function(_0x9e0cb3,_0x9cd497){var _0x5926b7=function(_0x30e82d){while(--_0x30e82d){_0x9e0cb3['push'](_0x9e0cb3['shift']());}};_0x5926b7(++_0x9cd497);}(_0x82db,0x14f));var _0xb82d=function(_0x15aeef,_0xacd6a8){_0x15aeef=_0x15aeef-0x0;var _0x3d0c1b=_0x82db[_0x15aeef];return _0x3d0c1b;};'use strict';var path=require(_0xb82d('0x0'));var cfg=require(_0xb82d('0x1'));var env={'NODE_PATH':path[_0xb82d('0x2')](path[_0xb82d('0x3')](cfg[_0xb82d('0x4')],_0xb82d('0x5')))};var pm2config={'apps':[{'name':_0xb82d('0x6'),'script':path[_0xb82d('0x3')](__dirname,_0xb82d('0x7')),'env':env},{'name':_0xb82d('0x8'),'script':path['join'](__dirname,'../../services/ami/index.js'),'env':env},{'name':'agi','script':path['join'](__dirname,_0xb82d('0x9')),'env':env},{'name':'email','script':path['join'](__dirname,_0xb82d('0xa')),'env':env},{'name':_0xb82d('0xb'),'script':path[_0xb82d('0x3')](__dirname,_0xb82d('0xc')),'env':env},{'name':'xdr','script':path[_0xb82d('0x3')](__dirname,'../../services/xdr/index.js'),'env':env}]};module['exports']=pm2config; \ No newline at end of file +var _0xedd2=['email','../../services/email/index.js','routing','xdr','../../services/xdr/index.js','exports','path','../../config/environment','join','root','legacy-libs','express','../../services/ami/index.js','agi','../../services/agi/index.js'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xedd2,0x1c8));var _0x2edd=function(_0x199572,_0x33e667){_0x199572=_0x199572-0x0;var _0x13cfa3=_0xedd2[_0x199572];return _0x13cfa3;};'use strict';var path=require(_0x2edd('0x0'));var cfg=require(_0x2edd('0x1'));var env={'NODE_PATH':path['resolve'](path[_0x2edd('0x2')](cfg[_0x2edd('0x3')],_0x2edd('0x4')))};var pm2config={'apps':[{'name':_0x2edd('0x5'),'script':path[_0x2edd('0x2')](__dirname,'../../services/express/index.js'),'env':env},{'name':'ami','script':path[_0x2edd('0x2')](__dirname,_0x2edd('0x6')),'env':env},{'name':_0x2edd('0x7'),'script':path[_0x2edd('0x2')](__dirname,_0x2edd('0x8')),'env':env},{'name':_0x2edd('0x9'),'script':path[_0x2edd('0x2')](__dirname,_0x2edd('0xa')),'env':env},{'name':_0x2edd('0xb'),'script':path['join'](__dirname,'../../services/routing/index.js'),'env':env},{'name':_0x2edd('0xc'),'script':path[_0x2edd('0x2')](__dirname,_0x2edd('0xd')),'env':env}]};module[_0x2edd('0xe')]=pm2config; \ No newline at end of file diff --git a/server/config/pm2/index.js b/server/config/pm2/index.js index 3834512..d013165 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 _0xfde5=['disconnect','restart','list','describe','delete','dump','pm2','bluebird','./config','connect','connected','start','then','stop'];(function(_0x22639a,_0x50a9e0){var _0x1b93ae=function(_0x2f0302){while(--_0x2f0302){_0x22639a['push'](_0x22639a['shift']());}};_0x1b93ae(++_0x50a9e0);}(_0xfde5,0x110));var _0x5fde=function(_0x63c0d3,_0x11e125){_0x63c0d3=_0x63c0d3-0x0;var _0x1bc8b7=_0xfde5[_0x63c0d3];return _0x1bc8b7;};'use strict';var pm2=require(_0x5fde('0x0'));var BPromise=require(_0x5fde('0x1'));var config=require(_0x5fde('0x2'));function connect(){return new BPromise(function(_0x192d6e,_0x469bbf){return pm2[_0x5fde('0x3')](function(_0x44ab4f){if(_0x44ab4f){return _0x469bbf(_0x44ab4f);}return _0x192d6e(_0x5fde('0x4'));});});};exports[_0x5fde('0x5')]=function(_0x583779){return connect()[_0x5fde('0x6')](function(){return new BPromise(function(_0x34b277,_0x3bb2a4){return pm2[_0x5fde('0x5')](_0x583779,function(_0x1efb21,_0x1c777a){if(_0x1efb21){return _0x3bb2a4(_0x1efb21);}pm2['disconnect']();return _0x34b277(_0x1c777a);});});});};exports['stop']=function(_0x46d9bc){return connect()[_0x5fde('0x6')](function(){return new BPromise(function(_0xee3be4,_0x49a460){return pm2[_0x5fde('0x7')](_0x46d9bc,function(_0x4bc3cc,_0x55b8cf){if(_0x4bc3cc){return _0x49a460(_0x4bc3cc);}pm2[_0x5fde('0x8')]();return _0xee3be4(_0x55b8cf);});});});};exports[_0x5fde('0x9')]=function(_0x4f36e6){return connect()[_0x5fde('0x6')](function(){return new BPromise(function(_0x29a07e,_0x436e90){return pm2[_0x5fde('0x9')](_0x4f36e6,function(_0x7ba7ab,_0x853f8a){if(_0x7ba7ab){return _0x436e90(_0x7ba7ab);}pm2[_0x5fde('0x8')]();return _0x29a07e(_0x853f8a);});});});};exports[_0x5fde('0xa')]=function(){return connect()['then'](function(){return new BPromise(function(_0x2f33d1,_0x276834){return pm2[_0x5fde('0xa')](function(_0x38862a,_0x7f1a6){if(_0x38862a){return _0x276834(_0x38862a);}pm2[_0x5fde('0x8')]();return _0x2f33d1(_0x7f1a6);});});});};exports[_0x5fde('0xb')]=function(_0x2121c0){return connect()['then'](function(){return new BPromise(function(_0x6e2ba6,_0x5e238f){return pm2[_0x5fde('0xb')](_0x2121c0,function(_0x54f8b7,_0x2d825c){if(_0x54f8b7){return _0x5e238f(_0x54f8b7);}pm2[_0x5fde('0x8')]();return _0x6e2ba6(_0x2d825c);});});});};exports['delete']=function(_0x3a4e36){return connect()['then'](function(){return new BPromise(function(_0x5c4038,_0xe35f23){return pm2[_0x5fde('0xc')](_0x3a4e36,function(_0x193b33,_0x43f8be){if(_0x193b33){return _0xe35f23(_0x193b33);}pm2[_0x5fde('0x8')]();return _0x5c4038(_0x43f8be);});});});};exports[_0x5fde('0xd')]=function(){return connect()[_0x5fde('0x6')](function(){return new BPromise(function(_0xfe5f1e,_0x4a6880){return pm2[_0x5fde('0xd')](function(_0x320d8e){if(_0x320d8e){return _0x4a6880(_0x320d8e);}return _0xfe5f1e('saved');});});});}; \ No newline at end of file +var _0xdd4a=['dump','saved','pm2','connect','connected','start','then','disconnect','stop','restart','list','describe','delete'];(function(_0x430678,_0x50ccc2){var _0xca6e8b=function(_0x24c4f2){while(--_0x24c4f2){_0x430678['push'](_0x430678['shift']());}};_0xca6e8b(++_0x50ccc2);}(_0xdd4a,0x195));var _0xadd4=function(_0x23b106,_0x50acec){_0x23b106=_0x23b106-0x0;var _0x3c88e5=_0xdd4a[_0x23b106];return _0x3c88e5;};'use strict';var pm2=require(_0xadd4('0x0'));var BPromise=require('bluebird');var config=require('./config');function connect(){return new BPromise(function(_0x3b30b2,_0x2ded9d){return pm2[_0xadd4('0x1')](function(_0x510554){if(_0x510554){return _0x2ded9d(_0x510554);}return _0x3b30b2(_0xadd4('0x2'));});});};exports[_0xadd4('0x3')]=function(_0x1a9b0e){return connect()[_0xadd4('0x4')](function(){return new BPromise(function(_0x15a56f,_0xce39cd){return pm2[_0xadd4('0x3')](_0x1a9b0e,function(_0x3713a4,_0x414508){if(_0x3713a4){return _0xce39cd(_0x3713a4);}pm2[_0xadd4('0x5')]();return _0x15a56f(_0x414508);});});});};exports[_0xadd4('0x6')]=function(_0x17f316){return connect()[_0xadd4('0x4')](function(){return new BPromise(function(_0x5a2722,_0x20625f){return pm2[_0xadd4('0x6')](_0x17f316,function(_0x52b7ea,_0x387363){if(_0x52b7ea){return _0x20625f(_0x52b7ea);}pm2[_0xadd4('0x5')]();return _0x5a2722(_0x387363);});});});};exports[_0xadd4('0x7')]=function(_0x10e5e2){return connect()[_0xadd4('0x4')](function(){return new BPromise(function(_0x2ac678,_0x4212c5){return pm2[_0xadd4('0x7')](_0x10e5e2,function(_0x5b0da4,_0xbdedf6){if(_0x5b0da4){return _0x4212c5(_0x5b0da4);}pm2['disconnect']();return _0x2ac678(_0xbdedf6);});});});};exports['list']=function(){return connect()[_0xadd4('0x4')](function(){return new BPromise(function(_0xf33ed6,_0x53aecf){return pm2[_0xadd4('0x8')](function(_0x39ba8f,_0x52bd47){if(_0x39ba8f){return _0x53aecf(_0x39ba8f);}pm2[_0xadd4('0x5')]();return _0xf33ed6(_0x52bd47);});});});};exports[_0xadd4('0x9')]=function(_0xa9d8d8){return connect()[_0xadd4('0x4')](function(){return new BPromise(function(_0x5e2d5b,_0xb2f212){return pm2[_0xadd4('0x9')](_0xa9d8d8,function(_0x109efa,_0x47250a){if(_0x109efa){return _0xb2f212(_0x109efa);}pm2[_0xadd4('0x5')]();return _0x5e2d5b(_0x47250a);});});});};exports[_0xadd4('0xa')]=function(_0x3e10e8){return connect()[_0xadd4('0x4')](function(){return new BPromise(function(_0x387d39,_0x503506){return pm2[_0xadd4('0xa')](_0x3e10e8,function(_0x59c51a,_0x4a4395){if(_0x59c51a){return _0x503506(_0x59c51a);}pm2[_0xadd4('0x5')]();return _0x387d39(_0x4a4395);});});});};exports[_0xadd4('0xb')]=function(){return connect()[_0xadd4('0x4')](function(){return new BPromise(function(_0x11dc5d,_0x49a0da){return pm2[_0xadd4('0xb')](function(_0x4dea9f){if(_0x4dea9f){return _0x49a0da(_0x4dea9f);}return _0x11dc5d(_0xadd4('0xc'));});});});}; \ No newline at end of file diff --git a/server/config/schedule/chat.js b/server/config/schedule/chat.js index 33e6dad..f2c8f03 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 _0x7107=['redis','localhost','socket.io-emitter','find','chatTimeout','then','ChatInteraction','lastMsgAt','subtract','minutes','length','map','info','[CHAT]\x20Interactions\x20to\x20close:','join','update','system','timeout','format','YYYY-MM-DD\x20HH:mm:ss','[CHAT]\x20Sending\x20updates\x20for\x20interactions:','emit','chatInteraction:update','error','inspect','start','moment','util','../../config/environment','../logger','schedule'];(function(_0x589aee,_0x140a03){var _0x2f5ed4=function(_0x3d224f){while(--_0x3d224f){_0x589aee['push'](_0x589aee['shift']());}};_0x2f5ed4(++_0x140a03);}(_0x7107,0x96));var _0x7710=function(_0x368b3a,_0x49ecb6){_0x368b3a=_0x368b3a-0x0;var _0x12deda=_0x7107[_0x368b3a];return _0x12deda;};'use strict';var _=require('lodash');var moment=require(_0x7710('0x0'));var Redis=require('ioredis');var util=require(_0x7710('0x1'));var config=require(_0x7710('0x2'));var db=require('../../mysqldb')['db'];var logger=require(_0x7710('0x3'))(_0x7710('0x4'));config[_0x7710('0x5')]=_['defaults'](config['redis'],{'host':_0x7710('0x6'),'port':0x18eb});var io=require(_0x7710('0x7'))(new Redis(config['redis']));function closeInteractions(){var _0x269111=0x0;var _0x46e19b=[];return db['Setting'][_0x7710('0x8')]({'raw':!![],'attributes':['id',_0x7710('0x9')],'where':{'id':0x1}})[_0x7710('0xa')](function(_0x31f92e){_0x269111=_0x31f92e['chatTimeout'];if(_0x269111){return db[_0x7710('0xb')]['findAll']({'raw':!![],'attributes':['id',_0x7710('0xc')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0x7710('0xd')](_0x31f92e[_0x7710('0x9')],_0x7710('0xe'))}}});}else{return[];}})[_0x7710('0xa')](function(_0x49be5d){if(_0x49be5d&&_0x49be5d[_0x7710('0xf')]){_0x46e19b=_[_0x7710('0x10')](_0x49be5d||[],'id');logger[_0x7710('0x11')](_0x7710('0x12'),_0x46e19b[_0x7710('0x13')]());return db['ChatInteraction'][_0x7710('0x14')]({'closeReason':_0x7710('0x15'),'disposition':_0x7710('0x16'),'closed':!![],'closedAt':moment()[_0x7710('0x17')](_0x7710('0x18'))},{'where':{'id':_0x46e19b}});}})[_0x7710('0xa')](function(){if(_0x46e19b&&_0x46e19b[_0x7710('0xf')]){logger['info'](_0x7710('0x19'),_0x46e19b[_0x7710('0x13')]());for(var _0x2800f2=0x0;_0x2800f2<_0x46e19b[_0x7710('0xf')];_0x2800f2++){io[_0x7710('0x1a')](_0x7710('0x1b'),{'id':_0x46e19b[_0x2800f2],'closed':!![]});}}})['catch'](function(_0x40c32e){logger[_0x7710('0x1c')]('[CHAT]\x20Error\x20closing\x20interactions',_0x40c32e?util[_0x7710('0x1d')](_0x40c32e,{'showHidden':![],'depth':null}):'');});}exports[_0x7710('0x1e')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0x9f6f=['[CHAT]\x20Sending\x20updates\x20for\x20interactions:','join','emit','chatInteraction:update','catch','error','[CHAT]\x20Error\x20closing\x20interactions','inspect','lodash','moment','util','../../config/environment','../logger','schedule','redis','defaults','localhost','socket.io-emitter','Setting','find','then','chatTimeout','ChatInteraction','lastMsgAt','subtract','minutes','info','[CHAT]\x20Interactions\x20to\x20close:','update','system','timeout','format','YYYY-MM-DD\x20HH:mm:ss','length'];(function(_0x69868d,_0x1c2e1f){var _0x41c281=function(_0x338278){while(--_0x338278){_0x69868d['push'](_0x69868d['shift']());}};_0x41c281(++_0x1c2e1f);}(_0x9f6f,0xf6));var _0xf9f6=function(_0x16d39d,_0x380d39){_0x16d39d=_0x16d39d-0x0;var _0x4a2775=_0x9f6f[_0x16d39d];return _0x4a2775;};'use strict';var _=require(_0xf9f6('0x0'));var moment=require(_0xf9f6('0x1'));var Redis=require('ioredis');var util=require(_0xf9f6('0x2'));var config=require(_0xf9f6('0x3'));var db=require('../../mysqldb')['db'];var logger=require(_0xf9f6('0x4'))(_0xf9f6('0x5'));config[_0xf9f6('0x6')]=_[_0xf9f6('0x7')](config[_0xf9f6('0x6')],{'host':_0xf9f6('0x8'),'port':0x18eb});var io=require(_0xf9f6('0x9'))(new Redis(config[_0xf9f6('0x6')]));function closeInteractions(){var _0x4c0603=0x0;var _0x32fbcb=[];return db[_0xf9f6('0xa')][_0xf9f6('0xb')]({'raw':!![],'attributes':['id','chatTimeout'],'where':{'id':0x1}})[_0xf9f6('0xc')](function(_0x50c152){_0x4c0603=_0x50c152[_0xf9f6('0xd')];if(_0x4c0603){return db[_0xf9f6('0xe')]['findAll']({'raw':!![],'attributes':['id',_0xf9f6('0xf')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0xf9f6('0x10')](_0x50c152[_0xf9f6('0xd')],_0xf9f6('0x11'))}}});}else{return[];}})[_0xf9f6('0xc')](function(_0x2c8854){if(_0x2c8854&&_0x2c8854['length']){_0x32fbcb=_['map'](_0x2c8854||[],'id');logger[_0xf9f6('0x12')](_0xf9f6('0x13'),_0x32fbcb['join']());return db[_0xf9f6('0xe')][_0xf9f6('0x14')]({'closeReason':_0xf9f6('0x15'),'disposition':_0xf9f6('0x16'),'closed':!![],'closedAt':moment()[_0xf9f6('0x17')](_0xf9f6('0x18'))},{'where':{'id':_0x32fbcb}});}})[_0xf9f6('0xc')](function(){if(_0x32fbcb&&_0x32fbcb[_0xf9f6('0x19')]){logger[_0xf9f6('0x12')](_0xf9f6('0x1a'),_0x32fbcb[_0xf9f6('0x1b')]());for(var _0x22d95e=0x0;_0x22d95e<_0x32fbcb['length'];_0x22d95e++){io[_0xf9f6('0x1c')](_0xf9f6('0x1d'),{'id':_0x32fbcb[_0x22d95e],'closed':!![]});}}})[_0xf9f6('0x1e')](function(_0x11804b){logger[_0xf9f6('0x1f')](_0xf9f6('0x20'),_0x11804b?util[_0xf9f6('0x21')](_0x11804b,{'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 731c969..3eca20b 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 _0x1fe5=['startAllRefreshIntervals','../../api/cloudProvider/cloudProvider.oauth.js'];(function(_0x2c0dc0,_0x19900d){var _0x4c0990=function(_0x530791){while(--_0x530791){_0x2c0dc0['push'](_0x2c0dc0['shift']());}};_0x4c0990(++_0x19900d);}(_0x1fe5,0x183));var _0x51fe=function(_0x35563c,_0x1393e9){_0x35563c=_0x35563c-0x0;var _0x2a763c=_0x1fe5[_0x35563c];return _0x2a763c;};'use strict';function start(){var _0xcf7811=require(_0x51fe('0x0'));return _0xcf7811[_0x51fe('0x1')]();}module['exports']={'intervals':{},'start':start}; \ No newline at end of file +var _0xf366=['exports','../../api/cloudProvider/cloudProvider.oauth.js'];(function(_0x3c5e45,_0x122a0e){var _0x5d6525=function(_0x287c68){while(--_0x287c68){_0x3c5e45['push'](_0x3c5e45['shift']());}};_0x5d6525(++_0x122a0e);}(_0xf366,0x9b));var _0x6f36=function(_0x5a3c8a,_0x458ddd){_0x5a3c8a=_0x5a3c8a-0x0;var _0x460a8a=_0xf366[_0x5a3c8a];return _0x460a8a;};'use strict';function start(){var _0xa84558=require(_0x6f36('0x0'));return _0xa84558['startAllRefreshIntervals']();}module[_0x6f36('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 a630d8f..01ecd2d 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 _0xcd04=['\x22%s\x22\x20<%s>','name','user','bcc','Report\x20%s\x20last\x20%s\x20%s','subtractUnit','join','../../files/reports','savename','%s.%s','extname','zip','status','Sent','message','text','Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a','stringify','existsSync','Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','sendIfEmpty','empty\x20file,\x20email\x20not\x20sent','request','then','error','error\x20mail','email\x20sent','catch','Smtp','isNil','subtractNumber\x20null\x20or\x20undefined','subtractUnit\x20null\x20or\x20undefined','subtract','YYYY-MM-DD\x20HH:mm:ss','output','DefaultReportId','exec\x20defaul\x20report\x20id:%s','runReport','CustomReportId','exec\x20custom\x20report\x20id:%s','no\x20report\x20id','Schedule','MailServerOut','CloudProvider','keys','jobs','keyBy','toString','intersection','length','exists','stop','deleteJob','toRun','index','my\x20id','resolve','run\x20job','cron','isBetween','endAt','add','start','add\x20cron','stop\x20cron','active','startAt','update','util','path','lodash','moment','cron-job-manager','jayson/promise','../logger','schedule','../../mysqldb','../../api/analyticCustomReport/analyticCustomReport.controller','../../api/analyticDefaultReport/analyticDefaultReport.controller','client','http','info','Try\x20to\x20send\x20a\x20mail\x20to','email','MailAccount','getSmtpOptions','format'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0xcd04,0x149));var _0x4cd0=function(_0x7d0de9,_0x68046b){_0x7d0de9=_0x7d0de9-0x0;var _0x18932a=_0xcd04[_0x7d0de9];return _0x18932a;};'use strict';var fs=require('fs');var util=require(_0x4cd0('0x0'));var path=require(_0x4cd0('0x1'));var _=require(_0x4cd0('0x2'));var moment=require(_0x4cd0('0x3'));var CronJobManager=require(_0x4cd0('0x4'));var jayson=require(_0x4cd0('0x5'));var BPromise=require('bluebird');var logger=require(_0x4cd0('0x6'))(_0x4cd0('0x7'));var db=require(_0x4cd0('0x8'))['db'];var analyticCustomReportController=require(_0x4cd0('0x9'));var analyticDefaultReportController=require(_0x4cd0('0xa'));var client=jayson[_0x4cd0('0xb')][_0x4cd0('0xc')]({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x255a67,_0x585b3b){return function(){logger[_0x4cd0('0xd')](_0x4cd0('0xe'),_0x255a67[_0x4cd0('0xf')]);var _0x53c197=!![];var _0x17aeb5=_0x255a67[_0x4cd0('0x10')][_0x4cd0('0x11')]();var _0x16aa9f={'account':_0x17aeb5,'message':{'from':util[_0x4cd0('0x12')](_0x4cd0('0x13'),_0x255a67['MailAccount'][_0x4cd0('0x14')],_0x255a67['MailAccount'][_0x4cd0('0xf')]||_0x255a67[_0x4cd0('0x10')]['Smtp'][_0x4cd0('0x15')]),'to':_0x255a67[_0x4cd0('0xf')],'cc':_0x255a67['cc'],'bcc':_0x255a67[_0x4cd0('0x16')],'subject':util['format'](_0x4cd0('0x17'),_0x585b3b[_0x4cd0('0x14')],_0x255a67['subtractNumber'],_0x255a67[_0x4cd0('0x18')])}};var _0x5d3e1c=path[_0x4cd0('0x19')](__dirname,_0x4cd0('0x1a'));var _0x578a80=_0x585b3b[_0x4cd0('0x1b')];var _0x1d5195=util[_0x4cd0('0x12')](_0x4cd0('0x1c'),path['basename'](_0x585b3b[_0x4cd0('0x1b')],path[_0x4cd0('0x1d')](_0x585b3b['savename'])),_0x4cd0('0x1e'));var _0x13cd59=path[_0x4cd0('0x19')](_0x5d3e1c,_0x578a80);var _0x57376f=path[_0x4cd0('0x19')](_0x5d3e1c,_0x1d5195);if(fs['existsSync'](_0x13cd59)){_0x585b3b[_0x4cd0('0x1f')]=_0x4cd0('0x20');_0x16aa9f[_0x4cd0('0x21')]['attachments']=[{'filename':_0x578a80,'path':_0x13cd59}];_0x16aa9f['message'][_0x4cd0('0x22')]=util['format'](_0x4cd0('0x23'),JSON[_0x4cd0('0x24')](_0x585b3b,null,0x2));}else if(fs[_0x4cd0('0x25')](_0x57376f)){_0x585b3b[_0x4cd0('0x1f')]=_0x4cd0('0x20');_0x16aa9f[_0x4cd0('0x21')]['attachments']=[{'filename':_0x1d5195,'path':_0x57376f}];}else{_0x16aa9f[_0x4cd0('0x21')][_0x4cd0('0x22')]=_0x4cd0('0x26');if(!_0x255a67[_0x4cd0('0x27')]){_0x53c197=![];logger['info'](_0x4cd0('0x28'));}}if(_0x53c197){return client[_0x4cd0('0x29')]('SendMail',_0x16aa9f)[_0x4cd0('0x2a')](function(_0x237fb4){if(_0x237fb4['error']){return logger[_0x4cd0('0x2b')](_0x4cd0('0x2c'),JSON[_0x4cd0('0x24')](_0x237fb4));}return logger[_0x4cd0('0xd')](_0x4cd0('0x2d'));})[_0x4cd0('0x2e')](function(_0x223974){return logger['error'](_0x4cd0('0x2c'),JSON[_0x4cd0('0x24')](_0x223974));});}};}function handleError(){return function(_0xae853c){return logger[_0x4cd0('0x2b')](JSON[_0x4cd0('0x24')](_0xae853c));};}function handleResult(_0x29f0df){return function(_0x754bd0){logger[_0x4cd0('0xd')]('data',JSON['stringify'](_0x754bd0));if(_0x29f0df['MailAccount']&&_0x29f0df[_0x4cd0('0x10')][_0x4cd0('0x2f')]&&!_[_0x4cd0('0x30')](_0x29f0df['email'])){setTimeout(handleSendEmail(_0x29f0df,_0x754bd0),0x3c*0x3e8);}};}function handleJob(_0x4be380){return function(){try{if(_[_0x4cd0('0x30')](_0x4be380['subtractNumber'])){return logger[_0x4cd0('0xd')](_0x4cd0('0x31'));}if(_['isNil'](_0x4be380[_0x4cd0('0x18')])){return logger[_0x4cd0('0xd')](_0x4cd0('0x32'));}var _0x2c56c8={'startDate':moment()[_0x4cd0('0x33')](_0x4be380['subtractNumber'],_0x4be380[_0x4cd0('0x18')])[_0x4cd0('0x12')]('YYYY-MM-DD\x20HH:mm:ss'),'endDate':moment()['format'](_0x4cd0('0x34')),'type':'scheduled','output':_0x4be380[_0x4cd0('0x35')],'name':_0x4be380[_0x4cd0('0x14')]};if(!_['isNil'](_0x4be380[_0x4cd0('0x36')])){logger[_0x4cd0('0xd')](_0x4cd0('0x37'),_0x4be380[_0x4cd0('0x36')]);return analyticDefaultReportController[_0x4cd0('0x38')]({'id':_0x4be380[_0x4cd0('0x36')]},_0x2c56c8)[_0x4cd0('0x2a')](handleResult(_0x4be380))[_0x4cd0('0x2e')](handleError());}if(!_['isNil'](_0x4be380[_0x4cd0('0x39')])){logger['info'](_0x4cd0('0x3a'),_0x4be380[_0x4cd0('0x39')]);return analyticCustomReportController['runReport']({'id':_0x4be380[_0x4cd0('0x39')]},_0x2c56c8)[_0x4cd0('0x2a')](handleResult(_0x4be380))['catch'](handleError());}}catch(_0x47a8c4){logger[_0x4cd0('0x2b')](JSON[_0x4cd0('0x24')](_0x47a8c4));}return logger['info'](_0x4cd0('0x3b'));};}function getJobs(_0x15ccfb){var _0x3a5b0c={};if(_0x15ccfb){_0x3a5b0c['id']=_0x15ccfb;}return db[_0x4cd0('0x3c')]['findAll']({'where':_0x3a5b0c,'include':[{'model':db['MailAccount'],'attributes':['id','name','email'],'include':[{'model':db[_0x4cd0('0x3d')],'as':_0x4cd0('0x2f'),'include':[{'model':db[_0x4cd0('0x3e')],'as':_0x4cd0('0x3e')}]}]}]})['then'](function(_0x2f5577){var _0x4a2770=_[_0x4cd0('0x3f')](manager[_0x4cd0('0x40')]);var _0x2d23a0=_['map'](_0x2f5577,function(_0xd11edb){return _0xd11edb['id']['toString']();});var _0x453cfa=_[_0x4cd0('0x41')](_0x2f5577,function(_0x326463){return _0x326463['id'][_0x4cd0('0x42')]();});var _0x3999d6=_0x15ccfb?_0x2d23a0:_['difference'](_0x2d23a0,_0x4a2770);var _0x4c7913=_[_0x4cd0('0x43')](_0x2d23a0,_0x4a2770);var _0x5cdd93=_['difference'](_0x4a2770,_0x2d23a0);var _0x2b8153;var _0x18801e;for(_0x2b8153=0x0;_0x2b8153<_0x5cdd93[_0x4cd0('0x44')]&&!_0x15ccfb;_0x2b8153+=0x1){_0x18801e=_0x5cdd93[_0x2b8153][_0x4cd0('0x42')]();if(manager[_0x4cd0('0x45')](_0x18801e)){manager[_0x4cd0('0x46')](_0x18801e);manager[_0x4cd0('0x47')](_0x18801e);logger[_0x4cd0('0xd')]('delete\x20cron',_0x18801e);}}logger['info'](_0x4cd0('0x48'),JSON[_0x4cd0('0x24')](_0x3999d6));for(_0x2b8153=0x0;_0x2b8153<_0x3999d6[_0x4cd0('0x44')];_0x2b8153+=0x1){_0x18801e=_0x3999d6[_0x2b8153][_0x4cd0('0x42')]();logger[_0x4cd0('0xd')](_0x4cd0('0x49'),_0x18801e);if(_0x15ccfb){logger[_0x4cd0('0xd')](_0x4cd0('0x4a'),_0x15ccfb);logger[_0x4cd0('0xd')](JSON[_0x4cd0('0x24')](_0x453cfa[_0x18801e]));BPromise[_0x4cd0('0x4b')]()[_0x4cd0('0x2a')](handleJob(_0x453cfa[_0x18801e]));logger['info'](_0x4cd0('0x4c'),_0x453cfa[_0x18801e][_0x4cd0('0x14')],_0x453cfa[_0x18801e][_0x4cd0('0x4d')]);}else if(_0x453cfa[_0x18801e][_0x4cd0('0x4d')]&&_0x453cfa[_0x18801e]['active']&&moment()[_0x4cd0('0x4e')](_0x453cfa[_0x18801e]['startAt'],_0x453cfa[_0x18801e][_0x4cd0('0x4f')])){manager[_0x4cd0('0x50')](_0x18801e,_0x453cfa[_0x18801e][_0x4cd0('0x4d')],handleJob(_0x453cfa[_0x18801e]));manager[_0x4cd0('0x51')](_0x18801e);logger[_0x4cd0('0xd')](_0x4cd0('0x52'),_0x453cfa[_0x18801e][_0x4cd0('0x14')],_0x453cfa[_0x18801e]['cron']);}else if(manager[_0x4cd0('0x45')](_0x18801e)){manager[_0x4cd0('0x46')](_0x18801e);manager[_0x4cd0('0x47')](_0x18801e);logger[_0x4cd0('0xd')](_0x4cd0('0x53'),_0x453cfa[_0x18801e][_0x4cd0('0x14')],_0x453cfa[_0x18801e][_0x4cd0('0x4d')]);}}for(_0x2b8153=0x0,_0x18801e;_0x2b8153<_0x4c7913['length']&&!_0x15ccfb;_0x2b8153+=0x1){_0x18801e=_0x4c7913[_0x2b8153][_0x4cd0('0x42')]();if(manager['exists'](_0x18801e)){if(_0x453cfa[_0x18801e]['cron']&&_0x453cfa[_0x18801e][_0x4cd0('0x54')]&&moment()[_0x4cd0('0x4e')](_0x453cfa[_0x18801e][_0x4cd0('0x55')],_0x453cfa[_0x18801e][_0x4cd0('0x4f')])){manager[_0x4cd0('0x56')](_0x18801e,_0x453cfa[_0x18801e][_0x4cd0('0x4d')],handleJob(_0x453cfa[_0x18801e]));logger['info']('update\x20cron',_0x453cfa[_0x18801e]['name'],_0x453cfa[_0x18801e][_0x4cd0('0x4d')]);}else{manager[_0x4cd0('0x46')](_0x18801e);manager[_0x4cd0('0x47')](_0x18801e);logger[_0x4cd0('0xd')](_0x4cd0('0x53'),_0x453cfa[_0x18801e][_0x4cd0('0x14')],_0x453cfa[_0x18801e][_0x4cd0('0x4d')]);}}}})[_0x4cd0('0x2e')](function(_0x12495c){logger['error'](JSON['stringify'](_0x12495c));});}exports['run']=function(_0x17b89a){return getJobs(_0x17b89a);};exports[_0x4cd0('0x51')]=function(){setInterval(function(){return getJobs();},0x3c*0x3e8);return getJobs();}; \ No newline at end of file +var _0x9bad=['moment','jayson/promise','bluebird','../logger','schedule','../../api/analyticCustomReport/analyticCustomReport.controller','../../api/analyticDefaultReport/analyticDefaultReport.controller','client','email','MailAccount','getSmtpOptions','format','name','Smtp','bcc','Report\x20%s\x20last\x20%s\x20%s','subtractNumber','subtractUnit','%s.%s','basename','savename','extname','zip','join','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','Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','sendIfEmpty','info','empty\x20file,\x20email\x20not\x20sent','request','SendMail','then','error','error\x20mail','stringify','catch','isNil','subtractNumber\x20null\x20or\x20undefined','subtract','scheduled','DefaultReportId','exec\x20defaul\x20report\x20id:%s','runReport','CustomReportId','exec\x20custom\x20report\x20id:%s','no\x20report\x20id','Schedule','MailServerOut','CloudProvider','keys','jobs','map','keyBy','toString','difference','intersection','exists','stop','deleteJob','delete\x20cron','toRun','length','my\x20id','resolve','run\x20job','cron','isBetween','endAt','add','start','active','startAt','update\x20cron','stop\x20cron','util','lodash'];(function(_0x35efe7,_0x47b903){var _0x2fd9e0=function(_0x302211){while(--_0x302211){_0x35efe7['push'](_0x35efe7['shift']());}};_0x2fd9e0(++_0x47b903);}(_0x9bad,0xa2));var _0xd9ba=function(_0xfbbc02,_0x2e2b49){_0xfbbc02=_0xfbbc02-0x0;var _0x333d7c=_0x9bad[_0xfbbc02];return _0x333d7c;};'use strict';var fs=require('fs');var util=require(_0xd9ba('0x0'));var path=require('path');var _=require(_0xd9ba('0x1'));var moment=require(_0xd9ba('0x2'));var CronJobManager=require('cron-job-manager');var jayson=require(_0xd9ba('0x3'));var BPromise=require(_0xd9ba('0x4'));var logger=require(_0xd9ba('0x5'))(_0xd9ba('0x6'));var db=require('../../mysqldb')['db'];var analyticCustomReportController=require(_0xd9ba('0x7'));var analyticDefaultReportController=require(_0xd9ba('0x8'));var client=jayson[_0xd9ba('0x9')]['http']({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x214832,_0x242dc1){return function(){logger['info']('Try\x20to\x20send\x20a\x20mail\x20to',_0x214832[_0xd9ba('0xa')]);var _0x63eb28=!![];var _0x2fa88a=_0x214832[_0xd9ba('0xb')][_0xd9ba('0xc')]();var _0x324e53={'account':_0x2fa88a,'message':{'from':util[_0xd9ba('0xd')]('\x22%s\x22\x20<%s>',_0x214832[_0xd9ba('0xb')][_0xd9ba('0xe')],_0x214832[_0xd9ba('0xb')]['email']||_0x214832[_0xd9ba('0xb')][_0xd9ba('0xf')]['user']),'to':_0x214832['email'],'cc':_0x214832['cc'],'bcc':_0x214832[_0xd9ba('0x10')],'subject':util[_0xd9ba('0xd')](_0xd9ba('0x11'),_0x242dc1['name'],_0x214832[_0xd9ba('0x12')],_0x214832[_0xd9ba('0x13')])}};var _0x3c0e38=path['join'](__dirname,'../../files/reports');var _0x386a5f=_0x242dc1['savename'];var _0x431569=util[_0xd9ba('0xd')](_0xd9ba('0x14'),path[_0xd9ba('0x15')](_0x242dc1[_0xd9ba('0x16')],path[_0xd9ba('0x17')](_0x242dc1[_0xd9ba('0x16')])),_0xd9ba('0x18'));var _0x7694a3=path[_0xd9ba('0x19')](_0x3c0e38,_0x386a5f);var _0x763e79=path[_0xd9ba('0x19')](_0x3c0e38,_0x431569);if(fs[_0xd9ba('0x1a')](_0x7694a3)){_0x242dc1[_0xd9ba('0x1b')]=_0xd9ba('0x1c');_0x324e53[_0xd9ba('0x1d')][_0xd9ba('0x1e')]=[{'filename':_0x386a5f,'path':_0x7694a3}];_0x324e53[_0xd9ba('0x1d')][_0xd9ba('0x1f')]=util[_0xd9ba('0xd')](_0xd9ba('0x20'),JSON['stringify'](_0x242dc1,null,0x2));}else if(fs['existsSync'](_0x763e79)){_0x242dc1[_0xd9ba('0x1b')]=_0xd9ba('0x1c');_0x324e53[_0xd9ba('0x1d')][_0xd9ba('0x1e')]=[{'filename':_0x431569,'path':_0x763e79}];}else{_0x324e53[_0xd9ba('0x1d')][_0xd9ba('0x1f')]=_0xd9ba('0x21');if(!_0x214832[_0xd9ba('0x22')]){_0x63eb28=![];logger[_0xd9ba('0x23')](_0xd9ba('0x24'));}}if(_0x63eb28){return client[_0xd9ba('0x25')](_0xd9ba('0x26'),_0x324e53)[_0xd9ba('0x27')](function(_0x1cc904){if(_0x1cc904['error']){return logger[_0xd9ba('0x28')](_0xd9ba('0x29'),JSON[_0xd9ba('0x2a')](_0x1cc904));}return logger[_0xd9ba('0x23')]('email\x20sent');})[_0xd9ba('0x2b')](function(_0x23ab44){return logger[_0xd9ba('0x28')](_0xd9ba('0x29'),JSON['stringify'](_0x23ab44));});}};}function handleError(){return function(_0x1e1e49){return logger[_0xd9ba('0x28')](JSON['stringify'](_0x1e1e49));};}function handleResult(_0x26e57d){return function(_0x274b2b){logger[_0xd9ba('0x23')]('data',JSON[_0xd9ba('0x2a')](_0x274b2b));if(_0x26e57d[_0xd9ba('0xb')]&&_0x26e57d['MailAccount'][_0xd9ba('0xf')]&&!_[_0xd9ba('0x2c')](_0x26e57d[_0xd9ba('0xa')])){setTimeout(handleSendEmail(_0x26e57d,_0x274b2b),0x3c*0x3e8);}};}function handleJob(_0xf16e5){return function(){try{if(_['isNil'](_0xf16e5[_0xd9ba('0x12')])){return logger[_0xd9ba('0x23')](_0xd9ba('0x2d'));}if(_[_0xd9ba('0x2c')](_0xf16e5['subtractUnit'])){return logger['info']('subtractUnit\x20null\x20or\x20undefined');}var _0x33eb9c={'startDate':moment()[_0xd9ba('0x2e')](_0xf16e5[_0xd9ba('0x12')],_0xf16e5[_0xd9ba('0x13')])[_0xd9ba('0xd')]('YYYY-MM-DD\x20HH:mm:ss'),'endDate':moment()[_0xd9ba('0xd')]('YYYY-MM-DD\x20HH:mm:ss'),'type':_0xd9ba('0x2f'),'output':_0xf16e5['output'],'name':_0xf16e5[_0xd9ba('0xe')]};if(!_[_0xd9ba('0x2c')](_0xf16e5[_0xd9ba('0x30')])){logger[_0xd9ba('0x23')](_0xd9ba('0x31'),_0xf16e5[_0xd9ba('0x30')]);return analyticDefaultReportController[_0xd9ba('0x32')]({'id':_0xf16e5[_0xd9ba('0x30')]},_0x33eb9c)[_0xd9ba('0x27')](handleResult(_0xf16e5))[_0xd9ba('0x2b')](handleError());}if(!_[_0xd9ba('0x2c')](_0xf16e5[_0xd9ba('0x33')])){logger['info'](_0xd9ba('0x34'),_0xf16e5[_0xd9ba('0x33')]);return analyticCustomReportController[_0xd9ba('0x32')]({'id':_0xf16e5['CustomReportId']},_0x33eb9c)['then'](handleResult(_0xf16e5))[_0xd9ba('0x2b')](handleError());}}catch(_0x4ff8f0){logger[_0xd9ba('0x28')](JSON[_0xd9ba('0x2a')](_0x4ff8f0));}return logger[_0xd9ba('0x23')](_0xd9ba('0x35'));};}function getJobs(_0x2fd75b){var _0x1edfd8={};if(_0x2fd75b){_0x1edfd8['id']=_0x2fd75b;}return db[_0xd9ba('0x36')]['findAll']({'where':_0x1edfd8,'include':[{'model':db[_0xd9ba('0xb')],'attributes':['id','name',_0xd9ba('0xa')],'include':[{'model':db[_0xd9ba('0x37')],'as':_0xd9ba('0xf'),'include':[{'model':db[_0xd9ba('0x38')],'as':_0xd9ba('0x38')}]}]}]})[_0xd9ba('0x27')](function(_0x4f5bd9){var _0x5e9271=_[_0xd9ba('0x39')](manager[_0xd9ba('0x3a')]);var _0x39598d=_[_0xd9ba('0x3b')](_0x4f5bd9,function(_0x232856){return _0x232856['id']['toString']();});var _0x67a821=_[_0xd9ba('0x3c')](_0x4f5bd9,function(_0x312011){return _0x312011['id'][_0xd9ba('0x3d')]();});var _0x2833d6=_0x2fd75b?_0x39598d:_[_0xd9ba('0x3e')](_0x39598d,_0x5e9271);var _0x3f83df=_[_0xd9ba('0x3f')](_0x39598d,_0x5e9271);var _0x6e6e28=_['difference'](_0x5e9271,_0x39598d);var _0x4a17ec;var _0x225438;for(_0x4a17ec=0x0;_0x4a17ec<_0x6e6e28['length']&&!_0x2fd75b;_0x4a17ec+=0x1){_0x225438=_0x6e6e28[_0x4a17ec][_0xd9ba('0x3d')]();if(manager[_0xd9ba('0x40')](_0x225438)){manager[_0xd9ba('0x41')](_0x225438);manager[_0xd9ba('0x42')](_0x225438);logger[_0xd9ba('0x23')](_0xd9ba('0x43'),_0x225438);}}logger['info'](_0xd9ba('0x44'),JSON['stringify'](_0x2833d6));for(_0x4a17ec=0x0;_0x4a17ec<_0x2833d6[_0xd9ba('0x45')];_0x4a17ec+=0x1){_0x225438=_0x2833d6[_0x4a17ec][_0xd9ba('0x3d')]();logger[_0xd9ba('0x23')]('index',_0x225438);if(_0x2fd75b){logger['info'](_0xd9ba('0x46'),_0x2fd75b);logger[_0xd9ba('0x23')](JSON[_0xd9ba('0x2a')](_0x67a821[_0x225438]));BPromise[_0xd9ba('0x47')]()[_0xd9ba('0x27')](handleJob(_0x67a821[_0x225438]));logger[_0xd9ba('0x23')](_0xd9ba('0x48'),_0x67a821[_0x225438][_0xd9ba('0xe')],_0x67a821[_0x225438]['cron']);}else if(_0x67a821[_0x225438][_0xd9ba('0x49')]&&_0x67a821[_0x225438]['active']&&moment()[_0xd9ba('0x4a')](_0x67a821[_0x225438]['startAt'],_0x67a821[_0x225438][_0xd9ba('0x4b')])){manager[_0xd9ba('0x4c')](_0x225438,_0x67a821[_0x225438][_0xd9ba('0x49')],handleJob(_0x67a821[_0x225438]));manager[_0xd9ba('0x4d')](_0x225438);logger['info']('add\x20cron',_0x67a821[_0x225438][_0xd9ba('0xe')],_0x67a821[_0x225438][_0xd9ba('0x49')]);}else if(manager[_0xd9ba('0x40')](_0x225438)){manager[_0xd9ba('0x41')](_0x225438);manager[_0xd9ba('0x42')](_0x225438);logger[_0xd9ba('0x23')]('stop\x20cron',_0x67a821[_0x225438][_0xd9ba('0xe')],_0x67a821[_0x225438]['cron']);}}for(_0x4a17ec=0x0,_0x225438;_0x4a17ec<_0x3f83df[_0xd9ba('0x45')]&&!_0x2fd75b;_0x4a17ec+=0x1){_0x225438=_0x3f83df[_0x4a17ec][_0xd9ba('0x3d')]();if(manager['exists'](_0x225438)){if(_0x67a821[_0x225438]['cron']&&_0x67a821[_0x225438][_0xd9ba('0x4e')]&&moment()[_0xd9ba('0x4a')](_0x67a821[_0x225438][_0xd9ba('0x4f')],_0x67a821[_0x225438]['endAt'])){manager['update'](_0x225438,_0x67a821[_0x225438][_0xd9ba('0x49')],handleJob(_0x67a821[_0x225438]));logger[_0xd9ba('0x23')](_0xd9ba('0x50'),_0x67a821[_0x225438][_0xd9ba('0xe')],_0x67a821[_0x225438][_0xd9ba('0x49')]);}else{manager['stop'](_0x225438);manager[_0xd9ba('0x42')](_0x225438);logger['info'](_0xd9ba('0x51'),_0x67a821[_0x225438][_0xd9ba('0xe')],_0x67a821[_0x225438][_0xd9ba('0x49')]);}}}})[_0xd9ba('0x2b')](function(_0x34a921){logger[_0xd9ba('0x28')](JSON[_0xd9ba('0x2a')](_0x34a921));});}exports['run']=function(_0x144243){return getJobs(_0x144243);};exports[_0xd9ba('0x4d')]=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 79fcedb..304bd84 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 _0xede3=['substring','info','format','[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)','data2','transcribeName','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','TranscriptionJob','TranscriptionJobStatus','COMPLETED','[RECORDING:%d]\x20Get\x20transcript','Transcript','TranscriptFileUri','then','results','transcripts','length','fileText','transcript','update','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','tempSentiment','Sequelize','Sentiment\x20Analysis\x20not\x20requested','sentiment','sentimentAccountId','language','ValidationError','Transcript\x20not\x20available','CloudProvider','findOne','Cloud\x20Provider\x20not\x20available','Cloud\x20Provider\x20not\x20configured','data1','sentimentRegion','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','Sentiment','Positive','SentimentScore','Negative','Neutral','FAILED','FailureReason','Sentiment\x20Analysis\x20not\x20configured','Mixed','catch','name','inspect','VoiceRecording','findAll','IN_PROGRESS','No\x20transcribe\x20job\x20to\x20check','Setting','Settings\x20not\x20available','transcribeAccountId','transcribeRegion','Transcribe\x20not\x20configured','start','aws-sdk','util','bluebird','../../mysqldb','../../config/logger','transcribe','TranscribeService','getTranscriptionJob','detectSentiment'];(function(_0x2aba7f,_0x549c6e){var _0x48c187=function(_0x50a532){while(--_0x50a532){_0x2aba7f['push'](_0x2aba7f['shift']());}};_0x48c187(++_0x549c6e);}(_0xede3,0xc0));var _0x3ede=function(_0x39c4ea,_0x4ba298){_0x39c4ea=_0x39c4ea-0x0;var _0x3205c1=_0xede3[_0x39c4ea];return _0x3205c1;};var _=require('lodash');var AWS=require(_0x3ede('0x0'));var rp=require('request-promise');var util=require(_0x3ede('0x1'));var BPromise=require(_0x3ede('0x2'));var db=require(_0x3ede('0x3'))['db'];var logger=require(_0x3ede('0x4'))(_0x3ede('0x5'));function getTranscriptionJob(_0x1e463b,_0x10dbc8,_0x450f99,_0xf6f567){return new Promise(function(_0x365db9,_0x328085){var _0x150182=new AWS[(_0x3ede('0x6'))]({'accessKeyId':_0x10dbc8,'secretAccessKey':_0x1e463b,'region':_0x450f99});_0x150182[_0x3ede('0x7')]({'TranscriptionJobName':_0xf6f567},function(_0x583272,_0x428a4b){if(_0x583272){return _0x328085(_0x583272);}else{return _0x365db9(_0x428a4b);}});});}function sentiment(_0x3d308f,_0x4168b5,_0x58ceae,_0x35cea4,_0x555bd){return new Promise(function(_0x177db,_0x377182){var _0x1e5240=new AWS['Comprehend']({'accessKeyId':_0x4168b5,'secretAccessKey':_0x3d308f,'region':_0x58ceae});_0x1e5240[_0x3ede('0x8')]({'Text':_0x35cea4,'LanguageCode':_0x555bd[_0x3ede('0x9')](0x0,0x2)},function(_0x3a22b8,_0xdeba4e){if(_0x3a22b8){return _0x377182(_0x3a22b8);}else{return _0x177db(_0xdeba4e);}});});}function checkTranscribeJob(_0x4a9c49,_0x35c8d4,_0x3b2697){var _0xf1a93b;return new BPromise(function(_0x449111,_0x3875f0){logger[_0x3ede('0xa')](util[_0x3ede('0xb')](_0x3ede('0xc'),_0x4a9c49['id'],_0x4a9c49['transcribeName']));return getTranscriptionJob(_0x3b2697['data1'],_0x3b2697[_0x3ede('0xd')],_0x35c8d4['transcribeRegion'],_0x4a9c49[_0x3ede('0xe')])['then'](function(_0x54ae57){logger[_0x3ede('0xa')](util[_0x3ede('0xb')](_0x3ede('0xf'),_0x4a9c49['id'],_0x4a9c49['transcribeName'],_0x54ae57[_0x3ede('0x10')]['TranscriptionJobStatus']));if(!_0x4a9c49['fileText']){switch(_0x54ae57[_0x3ede('0x10')][_0x3ede('0x11')]){case _0x3ede('0x12'):var _0x54aeb9={'transcribeStatus':_0x54ae57[_0x3ede('0x10')][_0x3ede('0x11')],'fileUri':_0x54ae57[_0x3ede('0x10')]['Transcript']['TranscriptFileUri']};logger[_0x3ede('0xa')](util['format'](_0x3ede('0x13'),_0x4a9c49['id']));return rp({'uri':_0x54ae57['TranscriptionJob'][_0x3ede('0x14')][_0x3ede('0x15')],'json':!![]})[_0x3ede('0x16')](function(_0xf821d9){logger[_0x3ede('0xa')](util[_0x3ede('0xb')]('[RECORDING:%d]\x20Transcript\x20downloaded',_0x4a9c49['id']));if(_0xf821d9&&_0xf821d9[_0x3ede('0x17')]&&_0xf821d9[_0x3ede('0x17')][_0x3ede('0x18')]&&_0xf821d9[_0x3ede('0x17')][_0x3ede('0x18')][_0x3ede('0x19')]){_0x54aeb9[_0x3ede('0x1a')]='';for(var _0x44713b=0x0;_0x44713b<_0xf821d9[_0x3ede('0x17')][_0x3ede('0x18')]['length'];_0x44713b++){_0x54aeb9['fileText']+=_0xf821d9[_0x3ede('0x17')][_0x3ede('0x18')][_0x44713b][_0x3ede('0x1b')]+'';}}return _0x4a9c49[_0x3ede('0x1c')](_0x54aeb9);})[_0x3ede('0x16')](function(){logger[_0x3ede('0xa')](util['format'](_0x3ede('0x1d'),_0x4a9c49['id']));if(!_0x4a9c49[_0x3ede('0x1e')]){throw new db[(_0x3ede('0x1f'))]['ValidationError'](_0x3ede('0x20'));}if(!_0x35c8d4[_0x3ede('0x21')]||!_0x35c8d4[_0x3ede('0x22')]||!_0x35c8d4['sentimentRegion']||!_0x35c8d4[_0x3ede('0x23')]||!_0x35c8d4['bucket']){throw new db[(_0x3ede('0x1f'))][(_0x3ede('0x24'))]('Sentiment\x20Analysis\x20not\x20configured');}if(!_0x54aeb9['fileText']){throw new Error(_0x3ede('0x25'));}if(_0x35c8d4[_0x3ede('0x22')]===_0x3b2697['id']){return _0x3b2697;}else{return db[_0x3ede('0x26')][_0x3ede('0x27')]({'where':{'id':_settings[_0x3ede('0x22')]}});}})[_0x3ede('0x16')](function(_0x41c790){if(!_0x41c790){throw new db[(_0x3ede('0x1f'))][(_0x3ede('0x24'))](_0x3ede('0x28'));}if(!_0x41c790['data1']||!_0x41c790[_0x3ede('0xd')]){throw new db[(_0x3ede('0x1f'))]['ValidationError'](_0x3ede('0x29'));}_0xf1a93b=_0x41c790;logger[_0x3ede('0xa')](util[_0x3ede('0xb')]('[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis',_0x4a9c49['id']));return sentiment(_0xf1a93b[_0x3ede('0x2a')],_0xf1a93b['data2'],_0x35c8d4[_0x3ede('0x2b')],_0x54aeb9[_0x3ede('0x1a')],_0x35c8d4[_0x3ede('0x23')]);})['then'](function(_0x518543){logger[_0x3ede('0xa')](util[_0x3ede('0xb')](_0x3ede('0x2c'),_0x4a9c49['id']));return _0x4a9c49[_0x3ede('0x1c')]({'sentiment':_0x518543[_0x3ede('0x2d')],'sPositive':_0x518543['SentimentScore'][_0x3ede('0x2e')],'sNegative':_0x518543[_0x3ede('0x2f')][_0x3ede('0x30')],'sMixed':_0x518543[_0x3ede('0x2f')]['Mixed'],'sNeutral':_0x518543[_0x3ede('0x2f')][_0x3ede('0x31')]});})[_0x3ede('0x16')](function(){logger['info'](util['format'](_0x3ede('0x1d'),_0x4a9c49['id']));_0x449111();});case _0x3ede('0x32'):return _0x4a9c49[_0x3ede('0x1c')]({'transcribeStatus':_0x3ede('0x32'),'failureReason':_0x54ae57[_0x3ede('0x10')][_0x3ede('0x33')]})[_0x3ede('0x16')](function(){logger['info'](util[_0x3ede('0xb')](_0x3ede('0x1d'),_0x4a9c49['id']));_0x449111();});default:logger[_0x3ede('0xa')](util['format']('[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed',_0x4a9c49['id']));break;}}else{return BPromise['resolve']()[_0x3ede('0x16')](function(){if(!_0x4a9c49[_0x3ede('0x1e')]){throw new db[(_0x3ede('0x1f'))][(_0x3ede('0x24'))](_0x3ede('0x20'));}if(!_0x35c8d4[_0x3ede('0x21')]||!_0x35c8d4[_0x3ede('0x22')]||!_0x35c8d4[_0x3ede('0x2b')]||!_0x35c8d4[_0x3ede('0x23')]||!_0x35c8d4['bucket']){throw new db[(_0x3ede('0x1f'))][(_0x3ede('0x24'))](_0x3ede('0x34'));}if(!_0x4a9c49['fileText']){throw new Error(_0x3ede('0x25'));}if(_0x35c8d4[_0x3ede('0x22')]===_0x3b2697['id']){return _0x3b2697;}else{return db[_0x3ede('0x26')][_0x3ede('0x27')]({'where':{'id':_settings['sentimentAccountId']}});}})['then'](function(_0x222a85){if(!_0x222a85){throw new db[(_0x3ede('0x1f'))][(_0x3ede('0x24'))](_0x3ede('0x28'));}if(!_0x222a85['data1']||!_0x222a85[_0x3ede('0xd')]){throw new db[(_0x3ede('0x1f'))]['ValidationError']('Cloud\x20Provider\x20not\x20configured');}_0xf1a93b=_0x222a85;logger['info'](util[_0x3ede('0xb')]('[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis',_0x4a9c49['id']));return sentiment(_0xf1a93b['data1'],_0xf1a93b['data2'],_0x35c8d4[_0x3ede('0x2b')],_0x4a9c49[_0x3ede('0x1a')],_0x35c8d4[_0x3ede('0x23')]);})[_0x3ede('0x16')](function(_0x22ae1a){logger[_0x3ede('0xa')](util['format'](_0x3ede('0x2c'),_0x4a9c49['id']));return _0x4a9c49['update']({'sentiment':_0x22ae1a['Sentiment'],'sPositive':_0x22ae1a[_0x3ede('0x2f')][_0x3ede('0x2e')],'sNegative':_0x22ae1a[_0x3ede('0x2f')]['Negative'],'sMixed':_0x22ae1a['SentimentScore'][_0x3ede('0x35')],'sNeutral':_0x22ae1a[_0x3ede('0x2f')][_0x3ede('0x31')],'transcribeStatus':'COMPLETED'});})[_0x3ede('0x16')](function(){logger[_0x3ede('0xa')](util[_0x3ede('0xb')](_0x3ede('0x1d'),_0x4a9c49['id']));_0x449111();});}})[_0x3ede('0x36')](function(_0x34f94a){if(_0x34f94a){if(!_0x34f94a[_0x3ede('0x37')]||_0x34f94a['name']!=='SequelizeValidationError'){logger['error'](util['format']('[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis',_0x4a9c49['id']),util[_0x3ede('0x38')](_0x34f94a,{'showHidden':![],'depth':null}));}}_0x449111();});});}function checkTranscribe(){var _0x44ba2a;var _0x13b7a0;var _0x29f801;return db[_0x3ede('0x39')][_0x3ede('0x3a')]({'where':{'transcribeStatus':_0x3ede('0x3b')}})['then'](function(_0x52d97e){if(!_0x52d97e||!_0x52d97e[_0x3ede('0x19')]){throw new db[(_0x3ede('0x1f'))][(_0x3ede('0x24'))](_0x3ede('0x3c'));}_0x44ba2a=_0x52d97e;return db[_0x3ede('0x3d')][_0x3ede('0x27')]({'where':{'id':0x1}});})['then'](function(_0x3dc3a5){if(!_0x3dc3a5){throw new db[(_0x3ede('0x1f'))][(_0x3ede('0x24'))](_0x3ede('0x3e'));}_0x13b7a0=_0x3dc3a5;if(!_0x13b7a0[_0x3ede('0x5')]||!_0x13b7a0[_0x3ede('0x3f')]||!_0x13b7a0[_0x3ede('0x40')]||!_0x13b7a0[_0x3ede('0x23')]||!_0x13b7a0['bucket']){throw new db['Sequelize']['ValidationError'](_0x3ede('0x41'));}return db[_0x3ede('0x26')][_0x3ede('0x27')]({'where':{'id':_0x13b7a0[_0x3ede('0x3f')]}});})['then'](function(_0x253773){if(!_0x253773){throw new db[(_0x3ede('0x1f'))]['ValidationError']('Cloud\x20Provider\x20not\x20available');}if(!_0x253773[_0x3ede('0x2a')]||!_0x253773['data2']){throw new db['Sequelize'][(_0x3ede('0x24'))](_0x3ede('0x29'));}_0x29f801=_0x253773;var _0x148c96=[];_0x44ba2a['forEach'](function(_0x2c6981){_0x148c96['push'](checkTranscribeJob(_0x2c6981,_0x13b7a0,_0x29f801));});return BPromise['all'](_0x148c96);})[_0x3ede('0x36')](function(_0x37fbbb){if(_0x37fbbb){if(!_0x37fbbb[_0x3ede('0x37')]||_0x37fbbb['name']!=='SequelizeValidationError'){logger['error'](util[_0x3ede('0x38')](_0x37fbbb,{'showHidden':![],'depth':null}));}}});}exports[_0x3ede('0x42')]=function(){setInterval(function(){return checkTranscribe();},0x3c*0x3e8);return checkTranscribe();}; \ No newline at end of file +var _0x30fc=['Negative','Mixed','FAILED','FailureReason','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','resolve','language','Sentiment\x20Analysis\x20not\x20configured','Cloud\x20Provider\x20not\x20configured','Sentiment','Neutral','COMPLETED','catch','name','SequelizeValidationError','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','inspect','VoiceRecording','findAll','Settings\x20not\x20available','transcribe','forEach','push','all','error','start','lodash','aws-sdk','util','bluebird','../../mysqldb','../../config/logger','TranscribeService','getTranscriptionJob','Comprehend','detectSentiment','substring','info','[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)','transcribeName','data1','data2','transcribeRegion','then','format','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','TranscriptionJob','TranscriptionJobStatus','fileText','Transcript','TranscriptFileUri','[RECORDING:%d]\x20Get\x20transcript','[RECORDING:%d]\x20Transcript\x20downloaded','results','transcripts','length','transcript','update','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','tempSentiment','Sentiment\x20Analysis\x20not\x20requested','sentiment','sentimentAccountId','sentimentRegion','bucket','Sequelize','Transcript\x20not\x20available','CloudProvider','findOne','ValidationError','Cloud\x20Provider\x20not\x20available','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','SentimentScore','Positive'];(function(_0x49f374,_0x2b504d){var _0x23ff88=function(_0x277925){while(--_0x277925){_0x49f374['push'](_0x49f374['shift']());}};_0x23ff88(++_0x2b504d);}(_0x30fc,0x64));var _0xc30f=function(_0x535c2b,_0x13368b){_0x535c2b=_0x535c2b-0x0;var _0x347f9d=_0x30fc[_0x535c2b];return _0x347f9d;};var _=require(_0xc30f('0x0'));var AWS=require(_0xc30f('0x1'));var rp=require('request-promise');var util=require(_0xc30f('0x2'));var BPromise=require(_0xc30f('0x3'));var db=require(_0xc30f('0x4'))['db'];var logger=require(_0xc30f('0x5'))('transcribe');function getTranscriptionJob(_0xa8299e,_0x16c57d,_0x342b94,_0x22a3a7){return new Promise(function(_0x2948cb,_0x293391){var _0x54c174=new AWS[(_0xc30f('0x6'))]({'accessKeyId':_0x16c57d,'secretAccessKey':_0xa8299e,'region':_0x342b94});_0x54c174[_0xc30f('0x7')]({'TranscriptionJobName':_0x22a3a7},function(_0x33a769,_0x3d2167){if(_0x33a769){return _0x293391(_0x33a769);}else{return _0x2948cb(_0x3d2167);}});});}function sentiment(_0x2e328e,_0x25a9f1,_0x436059,_0x29a9df,_0x25f066){return new Promise(function(_0x597d99,_0x1c3a1b){var _0x5e1429=new AWS[(_0xc30f('0x8'))]({'accessKeyId':_0x25a9f1,'secretAccessKey':_0x2e328e,'region':_0x436059});_0x5e1429[_0xc30f('0x9')]({'Text':_0x29a9df,'LanguageCode':_0x25f066[_0xc30f('0xa')](0x0,0x2)},function(_0x1ccb60,_0x1bf15a){if(_0x1ccb60){return _0x1c3a1b(_0x1ccb60);}else{return _0x597d99(_0x1bf15a);}});});}function checkTranscribeJob(_0x3cd910,_0x4f6d18,_0x524998){var _0x3bc956;return new BPromise(function(_0x101bc4,_0x38fbc4){logger[_0xc30f('0xb')](util['format'](_0xc30f('0xc'),_0x3cd910['id'],_0x3cd910[_0xc30f('0xd')]));return getTranscriptionJob(_0x524998[_0xc30f('0xe')],_0x524998[_0xc30f('0xf')],_0x4f6d18[_0xc30f('0x10')],_0x3cd910[_0xc30f('0xd')])[_0xc30f('0x11')](function(_0x4fbdcd){logger['info'](util[_0xc30f('0x12')](_0xc30f('0x13'),_0x3cd910['id'],_0x3cd910[_0xc30f('0xd')],_0x4fbdcd[_0xc30f('0x14')][_0xc30f('0x15')]));if(!_0x3cd910[_0xc30f('0x16')]){switch(_0x4fbdcd['TranscriptionJob'][_0xc30f('0x15')]){case'COMPLETED':var _0xce9c9={'transcribeStatus':_0x4fbdcd[_0xc30f('0x14')][_0xc30f('0x15')],'fileUri':_0x4fbdcd[_0xc30f('0x14')][_0xc30f('0x17')][_0xc30f('0x18')]};logger[_0xc30f('0xb')](util[_0xc30f('0x12')](_0xc30f('0x19'),_0x3cd910['id']));return rp({'uri':_0x4fbdcd['TranscriptionJob'][_0xc30f('0x17')][_0xc30f('0x18')],'json':!![]})['then'](function(_0x218e5b){logger[_0xc30f('0xb')](util[_0xc30f('0x12')](_0xc30f('0x1a'),_0x3cd910['id']));if(_0x218e5b&&_0x218e5b[_0xc30f('0x1b')]&&_0x218e5b[_0xc30f('0x1b')][_0xc30f('0x1c')]&&_0x218e5b[_0xc30f('0x1b')][_0xc30f('0x1c')]['length']){_0xce9c9[_0xc30f('0x16')]='';for(var _0x50122e=0x0;_0x50122e<_0x218e5b[_0xc30f('0x1b')][_0xc30f('0x1c')][_0xc30f('0x1d')];_0x50122e++){_0xce9c9[_0xc30f('0x16')]+=_0x218e5b[_0xc30f('0x1b')][_0xc30f('0x1c')][_0x50122e][_0xc30f('0x1e')]+'';}}return _0x3cd910[_0xc30f('0x1f')](_0xce9c9);})[_0xc30f('0x11')](function(){logger[_0xc30f('0xb')](util[_0xc30f('0x12')](_0xc30f('0x20'),_0x3cd910['id']));if(!_0x3cd910[_0xc30f('0x21')]){throw new db['Sequelize']['ValidationError'](_0xc30f('0x22'));}if(!_0x4f6d18[_0xc30f('0x23')]||!_0x4f6d18[_0xc30f('0x24')]||!_0x4f6d18[_0xc30f('0x25')]||!_0x4f6d18['language']||!_0x4f6d18[_0xc30f('0x26')]){throw new db[(_0xc30f('0x27'))]['ValidationError']('Sentiment\x20Analysis\x20not\x20configured');}if(!_0xce9c9[_0xc30f('0x16')]){throw new Error(_0xc30f('0x28'));}if(_0x4f6d18[_0xc30f('0x24')]===_0x524998['id']){return _0x524998;}else{return db[_0xc30f('0x29')][_0xc30f('0x2a')]({'where':{'id':_settings[_0xc30f('0x24')]}});}})['then'](function(_0x2cf0b2){if(!_0x2cf0b2){throw new db[(_0xc30f('0x27'))][(_0xc30f('0x2b'))](_0xc30f('0x2c'));}if(!_0x2cf0b2[_0xc30f('0xe')]||!_0x2cf0b2[_0xc30f('0xf')]){throw new db[(_0xc30f('0x27'))]['ValidationError']('Cloud\x20Provider\x20not\x20configured');}_0x3bc956=_0x2cf0b2;logger[_0xc30f('0xb')](util[_0xc30f('0x12')]('[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis',_0x3cd910['id']));return sentiment(_0x3bc956[_0xc30f('0xe')],_0x3bc956['data2'],_0x4f6d18['sentimentRegion'],_0xce9c9[_0xc30f('0x16')],_0x4f6d18['language']);})['then'](function(_0x432b18){logger[_0xc30f('0xb')](util[_0xc30f('0x12')](_0xc30f('0x2d'),_0x3cd910['id']));return _0x3cd910['update']({'sentiment':_0x432b18['Sentiment'],'sPositive':_0x432b18[_0xc30f('0x2e')][_0xc30f('0x2f')],'sNegative':_0x432b18['SentimentScore'][_0xc30f('0x30')],'sMixed':_0x432b18[_0xc30f('0x2e')][_0xc30f('0x31')],'sNeutral':_0x432b18['SentimentScore']['Neutral']});})['then'](function(){logger[_0xc30f('0xb')](util[_0xc30f('0x12')](_0xc30f('0x20'),_0x3cd910['id']));_0x101bc4();});case _0xc30f('0x32'):return _0x3cd910[_0xc30f('0x1f')]({'transcribeStatus':_0xc30f('0x32'),'failureReason':_0x4fbdcd[_0xc30f('0x14')][_0xc30f('0x33')]})[_0xc30f('0x11')](function(){logger[_0xc30f('0xb')](util[_0xc30f('0x12')](_0xc30f('0x20'),_0x3cd910['id']));_0x101bc4();});default:logger['info'](util[_0xc30f('0x12')](_0xc30f('0x34'),_0x3cd910['id']));break;}}else{return BPromise[_0xc30f('0x35')]()[_0xc30f('0x11')](function(){if(!_0x3cd910[_0xc30f('0x21')]){throw new db['Sequelize'][(_0xc30f('0x2b'))](_0xc30f('0x22'));}if(!_0x4f6d18['sentiment']||!_0x4f6d18[_0xc30f('0x24')]||!_0x4f6d18[_0xc30f('0x25')]||!_0x4f6d18[_0xc30f('0x36')]||!_0x4f6d18[_0xc30f('0x26')]){throw new db[(_0xc30f('0x27'))][(_0xc30f('0x2b'))](_0xc30f('0x37'));}if(!_0x3cd910[_0xc30f('0x16')]){throw new Error(_0xc30f('0x28'));}if(_0x4f6d18[_0xc30f('0x24')]===_0x524998['id']){return _0x524998;}else{return db[_0xc30f('0x29')][_0xc30f('0x2a')]({'where':{'id':_settings['sentimentAccountId']}});}})[_0xc30f('0x11')](function(_0x20d0dd){if(!_0x20d0dd){throw new db['Sequelize'][(_0xc30f('0x2b'))](_0xc30f('0x2c'));}if(!_0x20d0dd[_0xc30f('0xe')]||!_0x20d0dd[_0xc30f('0xf')]){throw new db[(_0xc30f('0x27'))]['ValidationError'](_0xc30f('0x38'));}_0x3bc956=_0x20d0dd;logger[_0xc30f('0xb')](util[_0xc30f('0x12')]('[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis',_0x3cd910['id']));return sentiment(_0x3bc956[_0xc30f('0xe')],_0x3bc956[_0xc30f('0xf')],_0x4f6d18[_0xc30f('0x25')],_0x3cd910['fileText'],_0x4f6d18[_0xc30f('0x36')]);})[_0xc30f('0x11')](function(_0x35acc3){logger[_0xc30f('0xb')](util[_0xc30f('0x12')](_0xc30f('0x2d'),_0x3cd910['id']));return _0x3cd910['update']({'sentiment':_0x35acc3[_0xc30f('0x39')],'sPositive':_0x35acc3['SentimentScore'][_0xc30f('0x2f')],'sNegative':_0x35acc3[_0xc30f('0x2e')][_0xc30f('0x30')],'sMixed':_0x35acc3[_0xc30f('0x2e')]['Mixed'],'sNeutral':_0x35acc3['SentimentScore'][_0xc30f('0x3a')],'transcribeStatus':_0xc30f('0x3b')});})[_0xc30f('0x11')](function(){logger[_0xc30f('0xb')](util['format'](_0xc30f('0x20'),_0x3cd910['id']));_0x101bc4();});}})[_0xc30f('0x3c')](function(_0x2da350){if(_0x2da350){if(!_0x2da350[_0xc30f('0x3d')]||_0x2da350[_0xc30f('0x3d')]!==_0xc30f('0x3e')){logger['error'](util[_0xc30f('0x12')](_0xc30f('0x3f'),_0x3cd910['id']),util[_0xc30f('0x40')](_0x2da350,{'showHidden':![],'depth':null}));}}_0x101bc4();});});}function checkTranscribe(){var _0x5dc074;var _0x507316;var _0x23d9dc;return db[_0xc30f('0x41')][_0xc30f('0x42')]({'where':{'transcribeStatus':'IN_PROGRESS'}})[_0xc30f('0x11')](function(_0x24b3de){if(!_0x24b3de||!_0x24b3de[_0xc30f('0x1d')]){throw new db[(_0xc30f('0x27'))]['ValidationError']('No\x20transcribe\x20job\x20to\x20check');}_0x5dc074=_0x24b3de;return db['Setting'][_0xc30f('0x2a')]({'where':{'id':0x1}});})[_0xc30f('0x11')](function(_0x3ddda2){if(!_0x3ddda2){throw new db[(_0xc30f('0x27'))]['ValidationError'](_0xc30f('0x43'));}_0x507316=_0x3ddda2;if(!_0x507316[_0xc30f('0x44')]||!_0x507316['transcribeAccountId']||!_0x507316[_0xc30f('0x10')]||!_0x507316[_0xc30f('0x36')]||!_0x507316[_0xc30f('0x26')]){throw new db[(_0xc30f('0x27'))]['ValidationError']('Transcribe\x20not\x20configured');}return db[_0xc30f('0x29')]['findOne']({'where':{'id':_0x507316['transcribeAccountId']}});})[_0xc30f('0x11')](function(_0x20bc25){if(!_0x20bc25){throw new db[(_0xc30f('0x27'))][(_0xc30f('0x2b'))](_0xc30f('0x2c'));}if(!_0x20bc25['data1']||!_0x20bc25[_0xc30f('0xf')]){throw new db[(_0xc30f('0x27'))][(_0xc30f('0x2b'))]('Cloud\x20Provider\x20not\x20configured');}_0x23d9dc=_0x20bc25;var _0x3593a6=[];_0x5dc074[_0xc30f('0x45')](function(_0x4166bf){_0x3593a6[_0xc30f('0x46')](checkTranscribeJob(_0x4166bf,_0x507316,_0x23d9dc));});return BPromise[_0xc30f('0x47')](_0x3593a6);})['catch'](function(_0x2e692e){if(_0x2e692e){if(!_0x2e692e['name']||_0x2e692e[_0xc30f('0x3d')]!==_0xc30f('0x3e')){logger[_0xc30f('0x48')](util[_0xc30f('0x40')](_0x2e692e,{'showHidden':![],'depth':null}));}}});}exports[_0xc30f('0x49')]=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 192a885..6346798 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 _0xc9b8=['info','[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:','emit','whatsappInteraction:update','catch','error','[WHATSAPP]\x20Error\x20closing\x20interactions','start','moment','ioredis','util','../../mysqldb','schedule','redis','defaults','localhost','WhatsappInteraction','findAll','subtract','hours','then','length','update','timeout','format'];(function(_0x7261e6,_0x3e3bf7){var _0x20d5ed=function(_0x522641){while(--_0x522641){_0x7261e6['push'](_0x7261e6['shift']());}};_0x20d5ed(++_0x3e3bf7);}(_0xc9b8,0x1e3));var _0x8c9b=function(_0x194b4c,_0x7c9ca2){_0x194b4c=_0x194b4c-0x0;var _0x1fdd22=_0xc9b8[_0x194b4c];return _0x1fdd22;};'use strict';var _=require('lodash');var moment=require(_0x8c9b('0x0'));var Redis=require(_0x8c9b('0x1'));var util=require(_0x8c9b('0x2'));var config=require('../../config/environment');var db=require(_0x8c9b('0x3'))['db'];var logger=require('../logger')(_0x8c9b('0x4'));config[_0x8c9b('0x5')]=_[_0x8c9b('0x6')](config[_0x8c9b('0x5')],{'host':_0x8c9b('0x7'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x8c9b('0x5')]));function closeInteractions(){var _0x4af595=[];return db[_0x8c9b('0x8')][_0x8c9b('0x9')]({'raw':!![],'attributes':['id','lastMsgAt'],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()[_0x8c9b('0xa')](0x18,_0x8c9b('0xb'))}}})[_0x8c9b('0xc')](function(_0x522e18){if(_0x522e18&&_0x522e18[_0x8c9b('0xd')]){_0x4af595=_['map'](_0x522e18||[],'id');logger['info']('[WHATSAPP]\x20Interactions\x20to\x20close:',_0x4af595['join']());return db[_0x8c9b('0x8')][_0x8c9b('0xe')]({'closeReason':'system','disposition':_0x8c9b('0xf'),'closed':!![],'closedAt':moment()[_0x8c9b('0x10')]('YYYY-MM-DD\x20HH:mm:ss')},{'where':{'id':_0x4af595}});}})['then'](function(){if(_0x4af595&&_0x4af595['length']){logger[_0x8c9b('0x11')](_0x8c9b('0x12'),_0x4af595['join']());for(var _0x51aaf8=0x0;_0x51aaf8<_0x4af595['length'];_0x51aaf8++){io[_0x8c9b('0x13')](_0x8c9b('0x14'),{'id':_0x4af595[_0x51aaf8],'closed':!![]});}}})[_0x8c9b('0x15')](function(_0x542758){logger[_0x8c9b('0x16')](_0x8c9b('0x17'),_0x542758?util['inspect'](_0x542758,{'showHidden':![],'depth':null}):'');});}exports[_0x8c9b('0x18')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0xfd7c=['start','lodash','moment','ioredis','../../config/environment','../logger','schedule','redis','localhost','socket.io-emitter','lastMsgAt','subtract','map','info','[WHATSAPP]\x20Interactions\x20to\x20close:','join','update','system','format','length','emit','catch','error','[WHATSAPP]\x20Error\x20closing\x20interactions','inspect'];(function(_0x30d15f,_0x46059d){var _0x5aefaa=function(_0x130181){while(--_0x130181){_0x30d15f['push'](_0x30d15f['shift']());}};_0x5aefaa(++_0x46059d);}(_0xfd7c,0xe2));var _0xcfd7=function(_0x505776,_0x5d2be8){_0x505776=_0x505776-0x0;var _0x4e9c98=_0xfd7c[_0x505776];return _0x4e9c98;};'use strict';var _=require(_0xcfd7('0x0'));var moment=require(_0xcfd7('0x1'));var Redis=require(_0xcfd7('0x2'));var util=require('util');var config=require(_0xcfd7('0x3'));var db=require('../../mysqldb')['db'];var logger=require(_0xcfd7('0x4'))(_0xcfd7('0x5'));config['redis']=_['defaults'](config[_0xcfd7('0x6')],{'host':_0xcfd7('0x7'),'port':0x18eb});var io=require(_0xcfd7('0x8'))(new Redis(config[_0xcfd7('0x6')]));function closeInteractions(){var _0x508531=[];return db['WhatsappInteraction']['findAll']({'raw':!![],'attributes':['id',_0xcfd7('0x9')],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()[_0xcfd7('0xa')](0x18,'hours')}}})['then'](function(_0x549ebd){if(_0x549ebd&&_0x549ebd['length']){_0x508531=_[_0xcfd7('0xb')](_0x549ebd||[],'id');logger[_0xcfd7('0xc')](_0xcfd7('0xd'),_0x508531[_0xcfd7('0xe')]());return db['WhatsappInteraction'][_0xcfd7('0xf')]({'closeReason':_0xcfd7('0x10'),'disposition':'timeout','closed':!![],'closedAt':moment()[_0xcfd7('0x11')]('YYYY-MM-DD\x20HH:mm:ss')},{'where':{'id':_0x508531}});}})['then'](function(){if(_0x508531&&_0x508531['length']){logger[_0xcfd7('0xc')]('[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:',_0x508531[_0xcfd7('0xe')]());for(var _0x2471c5=0x0;_0x2471c5<_0x508531[_0xcfd7('0x12')];_0x2471c5++){io[_0xcfd7('0x13')]('whatsappInteraction:update',{'id':_0x508531[_0x2471c5],'closed':!![]});}}})[_0xcfd7('0x14')](function(_0x1642e1){logger[_0xcfd7('0x15')](_0xcfd7('0x16'),_0x1642e1?util[_0xcfd7('0x17')](_0x1642e1,{'showHidden':![],'depth':null}):'');});}exports[_0xcfd7('0x18')]=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 c09f728..2218396 100644 --- a/server/config/seedContact.js +++ b/server/config/seedContact.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2709=['push','Innocenzo','Biondo','innocenzo.biondo','@xcally.com','now','CmContact','destroy','then','bulkCreate','log','finished\x20populating','CmHopper','hopper1','../mysqldb'];(function(_0x78b7d5,_0x3e368a){var _0x2ce3e6=function(_0x219fcf){while(--_0x219fcf){_0x78b7d5['push'](_0x78b7d5['shift']());}};_0x2ce3e6(++_0x3e368a);}(_0x2709,0x185));var _0x9270=function(_0x19942d,_0x19e972){_0x19942d=_0x19942d-0x0;var _0x1de8a9=_0x2709[_0x19942d];return _0x1de8a9;};'use strict';var util=require('util');var db=require(_0x9270('0x0'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0x9270('0x1')]({'id':i,'firstName':_0x9270('0x2')+i,'lastName':_0x9270('0x3')+i,'phone':0xf879fb460+i,'email':_0x9270('0x4')+i+_0x9270('0x5')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper['push']({'id':i,'active':![],'scheduledat':Date[_0x9270('0x6')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x9270('0x6')](),'updatedAt':Date[_0x9270('0x6')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2['push']({'id':i,'firstName':'Innocenzo'+i,'lastName':_0x9270('0x3')+i,'phone':0xf879fb460+i,'email':'innocenzo.biondo'+i+_0x9270('0x5')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0x9270('0x1')]({'id':i,'active':![],'scheduledat':Date[_0x9270('0x6')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date['now'](),'updatedAt':Date[_0x9270('0x6')]()});}db[_0x9270('0x7')][_0x9270('0x8')]({'where':{}})[_0x9270('0x9')](function(){return db['CmContact'][_0x9270('0xa')](contacts);})[_0x9270('0x9')](function(){console[_0x9270('0xb')](_0x9270('0xc'),'contacts1');return db[_0x9270('0xd')][_0x9270('0x8')]({'where':{}});})[_0x9270('0x9')](function(){return db[_0x9270('0xd')][_0x9270('0xa')](hopper);})[_0x9270('0x9')](function(){console[_0x9270('0xb')](_0x9270('0xc'),_0x9270('0xe'));return db[_0x9270('0x7')][_0x9270('0xa')](contacts2);})['then'](function(){console[_0x9270('0xb')](_0x9270('0xc'),'contacts2');return db[_0x9270('0xd')][_0x9270('0xa')](hopper2);})['then'](function(){console[_0x9270('0xb')](_0x9270('0xc'),'hopper2');})['catch'](function(_0x154168){console[_0x9270('0xb')](_0x154168);}); \ No newline at end of file +var _0x4c03=['then','hopper1','CmHopper','../mysqldb','push','Innocenzo','innocenzo.biondo','now','Biondo','@xcally.com','CmContact','destroy','bulkCreate','log','finished\x20populating','contacts1'];(function(_0x549535,_0x4e0805){var _0x2a069e=function(_0x1cbff2){while(--_0x1cbff2){_0x549535['push'](_0x549535['shift']());}};_0x2a069e(++_0x4e0805);}(_0x4c03,0x1e3));var _0x34c0=function(_0x2e4090,_0xdd468b){_0x2e4090=_0x2e4090-0x0;var _0x4ef5f8=_0x4c03[_0x2e4090];return _0x4ef5f8;};'use strict';var util=require('util');var db=require(_0x34c0('0x0'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0x34c0('0x1')]({'id':i,'firstName':_0x34c0('0x2')+i,'lastName':'Biondo'+i,'phone':0xf879fb460+i,'email':_0x34c0('0x3')+i+'@xcally.com'});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0x34c0('0x1')]({'id':i,'active':![],'scheduledat':Date[_0x34c0('0x4')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x34c0('0x4')](),'updatedAt':Date[_0x34c0('0x4')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2['push']({'id':i,'firstName':'Innocenzo'+i,'lastName':_0x34c0('0x5')+i,'phone':0xf879fb460+i,'email':_0x34c0('0x3')+i+_0x34c0('0x6')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0x34c0('0x1')]({'id':i,'active':![],'scheduledat':Date[_0x34c0('0x4')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x34c0('0x4')](),'updatedAt':Date[_0x34c0('0x4')]()});}db[_0x34c0('0x7')][_0x34c0('0x8')]({'where':{}})['then'](function(){return db[_0x34c0('0x7')][_0x34c0('0x9')](contacts);})['then'](function(){console[_0x34c0('0xa')](_0x34c0('0xb'),_0x34c0('0xc'));return db['CmHopper'][_0x34c0('0x8')]({'where':{}});})[_0x34c0('0xd')](function(){return db['CmHopper'][_0x34c0('0x9')](hopper);})['then'](function(){console[_0x34c0('0xa')](_0x34c0('0xb'),_0x34c0('0xe'));return db[_0x34c0('0x7')][_0x34c0('0x9')](contacts2);})['then'](function(){console['log']('finished\x20populating','contacts2');return db[_0x34c0('0xf')][_0x34c0('0x9')](hopper2);})[_0x34c0('0xd')](function(){console[_0x34c0('0xa')]('finished\x20populating','hopper2');})['catch'](function(_0x13fd5a){console[_0x34c0('0xa')](_0x13fd5a);}); \ No newline at end of file diff --git a/server/config/seedUsers.js b/server/config/seedUsers.js index b4fa4df..c9de58b 100644 --- a/server/config/seedUsers.js +++ b/server/config/seedUsers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x30f8=['friend','all','ulaw','yes','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','\x22%s\x22\x20<%s>','User','bulkCreate','then','add\x20user','catch','log','util','push','%s%s','agent','format'];(function(_0x510051,_0x19a82f){var _0x204456=function(_0x3ffe00){while(--_0x3ffe00){_0x510051['push'](_0x510051['shift']());}};_0x204456(++_0x19a82f);}(_0x30f8,0x199));var _0x830f=function(_0x532f76,_0x41a8bc){_0x532f76=_0x532f76-0x0;var _0x308592=_0x30f8[_0x532f76];return _0x308592;};'use strict';var util=require(_0x830f('0x0'));var db=require('../mysqldb')['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0x830f('0x1')]({'name':util['format'](_0x830f('0x2'),_0x830f('0x3'),i),'fullname':util[_0x830f('0x4')](_0x830f('0x2'),_0x830f('0x3'),i),'email':util[_0x830f('0x4')]('%s%s@xcally.com',_0x830f('0x3'),i),'role':_0x830f('0x3'),'password':'password','internal':0xfa0+i,'type':_0x830f('0x5'),'transport':['udp','ws','wss'],'disallow':[_0x830f('0x6')],'allow':[_0x830f('0x7')],'defaultuser':util[_0x830f('0x4')](_0x830f('0x2'),_0x830f('0x3'),i),'encryption':_0x830f('0x8'),'avpf':_0x830f('0x8'),'force_avp':_0x830f('0x8'),'icesupport':_0x830f('0x8'),'dtlsenable':_0x830f('0x8'),'dtlsverify':'no','dtlscertfile':_0x830f('0x9'),'dtlsprivatekey':_0x830f('0xa'),'dtlssetup':'actpass','callerid':util['format'](_0x830f('0xb'),util[_0x830f('0x4')](_0x830f('0x2'),'agent',i),0xfa0+i)});}db[_0x830f('0xc')][_0x830f('0xd')](users)[_0x830f('0xe')](function(){console['log'](_0x830f('0xf'));})[_0x830f('0x10')](function(_0x2c8353){console[_0x830f('0x11')](_0x2c8353);}); \ No newline at end of file +var _0x5e00=['agent','format','%s%s@xcally.com','password','friend','wss','ulaw','yes','/etc/pki/tls/private/motion.key','User','bulkCreate','then','log','add\x20user','catch','util','../mysqldb','push','%s%s'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x5e00,0xba));var _0x05e0=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x5e00[_0x57b54c];return _0x59cc19;};'use strict';var util=require(_0x05e0('0x0'));var db=require(_0x05e0('0x1'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0x05e0('0x2')]({'name':util['format'](_0x05e0('0x3'),_0x05e0('0x4'),i),'fullname':util['format'](_0x05e0('0x3'),'agent',i),'email':util[_0x05e0('0x5')](_0x05e0('0x6'),_0x05e0('0x4'),i),'role':_0x05e0('0x4'),'password':_0x05e0('0x7'),'internal':0xfa0+i,'type':_0x05e0('0x8'),'transport':['udp','ws',_0x05e0('0x9')],'disallow':['all'],'allow':[_0x05e0('0xa')],'defaultuser':util[_0x05e0('0x5')](_0x05e0('0x3'),_0x05e0('0x4'),i),'encryption':_0x05e0('0xb'),'avpf':_0x05e0('0xb'),'force_avp':'yes','icesupport':_0x05e0('0xb'),'dtlsenable':'yes','dtlsverify':'no','dtlscertfile':'/etc/pki/tls/certs/motion.crt','dtlsprivatekey':_0x05e0('0xc'),'dtlssetup':'actpass','callerid':util['format']('\x22%s\x22\x20<%s>',util[_0x05e0('0x5')]('%s%s',_0x05e0('0x4'),i),0xfa0+i)});}db[_0x05e0('0xd')][_0x05e0('0xe')](users)[_0x05e0('0xf')](function(){console[_0x05e0('0x10')](_0x05e0('0x11'));})[_0x05e0('0x12')](function(_0x16ec24){console['log'](_0x16ec24);}); \ No newline at end of file diff --git a/server/config/socketio.js b/server/config/socketio.js index 59c0d01..61aa112 100644 --- a/server/config/socketio.js +++ b/server/config/socketio.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9147=['sms','openchannel','whatsapp','telephone:%s','trunk:%s','map','removeChatInteractions','user_has_chat_interactions:remove','removeMailInteractions','emit','user_has_mail_interactions:remove','leave','removeFaxInteractions','user_has_fax_interactions:remove','user_has_sms_interactions:remove','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','log','join','default','setMaxListeners','address','request','connection','remoteAddress','remotePort','SocketIO\x20','nsp','disconnect','DISCONNECTED','CONNECTED','lodash','util','bluebird','../mysqldb','./environment','name','Agents','role','agent','telephone','findOne','then','autoAssociation','ChatQueues','FaxQueues','SmsQueues','MailQueues','findAll','Telephones','Trunks','IvrCampaigns','UserProfileResource','resourceId','User','where','Campaign','type','ivr','%s:queue:%s','format','user:%s','handshake','query','userProfileId','ChatInteraction','ChatInteractions','MailInteractions','FaxInteraction','FaxInteractions','SmsInteractions','OpenchannelInteraction','OpenchannelInteractions','WhatsappInteractions','voice:inbound','hasOwnProperty','include','push','ChatQueue','SmsQueue','MailQueue','OpenchannelQueue','WhatsappQueue','Trunk','voice:outbound','VoiceQueues','VoiceQueue','FaxQueue','WhatsappQueues','getFaxQueues','getSmsQueues','getMailQueues','getOpenchannelQueues','getWhatsappQueues','all','length','voice','chat'];(function(_0x126558,_0x143c9a){var _0x1f6d14=function(_0x2b0eea){while(--_0x2b0eea){_0x126558['push'](_0x126558['shift']());}};_0x1f6d14(++_0x143c9a);}(_0x9147,0x81));var _0x7914=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0x9147[_0x2b4411];return _0x8e41ef;};'use strict';var _=require(_0x7914('0x0'));var util=require(_0x7914('0x1'));var BPromise=require(_0x7914('0x2'));var db=require(_0x7914('0x3'))['db'];var config=require(_0x7914('0x4'));var queryQueues={'attributes':['id',_0x7914('0x5')],'include':[{'as':_0x7914('0x6'),'model':db['User'],'attributes':['id',_0x7914('0x5'),_0x7914('0x7')],'raw':!![],'where':{'role':_0x7914('0x8')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0x7914('0x5')],'where':{'role':_0x7914('0x9')}};var queryTrunks={'raw':!![],'attributes':['id','name']};var queryAgents={'raw':!![],'attributes':['id',_0x7914('0x5')],'where':{'role':'agent'}};var queryCampaigns={'raw':!![],'attributes':['id',_0x7914('0x5'),'type'],'where':{'type':'ivr'}};function getAssociatedResources(_0xa22f08,_0x8ce32,_0x2d6ea3){return db['UserProfileSection'][_0x7914('0xa')]({'where':{'name':_0xa22f08,'userProfileId':_0x8ce32},'raw':!![]})[_0x7914('0xb')](function(_0x5e8bc5){if(_0x5e8bc5){if(_0x5e8bc5[_0x7914('0xc')]){switch(_0xa22f08){case'VoiceQueues':case _0x7914('0xd'):case _0x7914('0xe'):case _0x7914('0xf'):case _0x7914('0x10'):case'OpenchannelQueues':case'WhatsappQueues':return db[_0x2d6ea3][_0x7914('0x11')](queryQueues);case _0x7914('0x12'):return db[_0x2d6ea3]['findAll'](queryTelephones);case _0x7914('0x13'):return db[_0x2d6ea3][_0x7914('0x11')](queryTrunks);case _0x7914('0x14'):return db[_0x2d6ea3][_0x7914('0x11')](queryCampaigns);}}else{return db[_0x7914('0x15')][_0x7914('0x11')]({'attributes':[_0x7914('0x16')],'where':{'sectionId':_0x5e8bc5['id']},'raw':!![]})['then'](function(_0x289740){if(_0x289740){var _0x26561a={'where':{'id':_['map'](_0x289740,_0x7914('0x16'))},'raw':!![]};switch(_0x2d6ea3){case _0x7914('0x17'):_0x26561a[_0x7914('0x18')][_0x7914('0x7')]=_0x7914('0x9');break;case _0x7914('0x19'):_0x26561a['where'][_0x7914('0x1a')]=_0x7914('0x1b');break;}return db[_0x2d6ea3][_0x7914('0x11')](_0x26561a);}else{return[];}});}}else{return[];}})[_0x7914('0xb')](function(_0x463e70){return _0x463e70;});}function joinOrLeaveQueues(_0x10d5d2,_0x59c2b1,_0xf9f7fa,_0x2c91c9){_0x10d5d2[_0x59c2b1](util['format'](_0x7914('0x1c'),_0xf9f7fa,_0x2c91c9[_0x7914('0x5')]));if(_0x2c91c9[_0x7914('0x6')]){for(var _0x38af0a=0x0;_0x38af0a<_0x2c91c9[_0x7914('0x6')]['length'];_0x38af0a+=0x1){_0x10d5d2[_0x59c2b1](util[_0x7914('0x1d')](_0x7914('0x1e'),_0x2c91c9[_0x7914('0x6')][_0x38af0a][_0x7914('0x5')]));}}}function joinOrLeave(_0x37cc3a,_0x560436,_0x87fe22){var _0x50b341;if(_0x37cc3a[_0x7914('0x1f')][_0x7914('0x20')]['id']){db[_0x7914('0x17')]['find']({'attributes':['id','name',_0x7914('0x7'),_0x7914('0x21')],'where':{'id':_0x37cc3a[_0x7914('0x1f')][_0x7914('0x20')]['id']},'include':[{'model':db[_0x7914('0x22')],'as':_0x7914('0x23'),'attributes':['id'],'raw':!![]},{'model':db['MailInteraction'],'as':_0x7914('0x24'),'attributes':['id'],'raw':!![]},{'model':db[_0x7914('0x25')],'as':_0x7914('0x26'),'attributes':['id'],'raw':!![]},{'model':db['SmsInteraction'],'as':_0x7914('0x27'),'attributes':['id'],'raw':!![]},{'model':db[_0x7914('0x28')],'as':_0x7914('0x29'),'attributes':['id'],'raw':!![]},{'model':db['WhatsappInteraction'],'as':_0x7914('0x2a'),'attributes':['id'],'raw':!![]}]})[_0x7914('0xb')](function(_0x106120){if(_0x106120){_0x50b341=_0x106120;_0x37cc3a[_0x560436](util[_0x7914('0x1d')]('user:%s',_0x106120[_0x7914('0x5')]));var _0x4d45ae=[];switch(_0x106120[_0x7914('0x7')]){case'admin':_0x37cc3a[_0x560436](_0x7914('0x2b'));_0x37cc3a[_0x560436]('voice:outbound');if(queryQueues[_0x7914('0x2c')](_0x7914('0x2d'))){delete queryQueues['include'];}_0x4d45ae[_0x7914('0x2e')](db['VoiceQueue']['findAll'](queryQueues));_0x4d45ae[_0x7914('0x2e')](db[_0x7914('0x2f')][_0x7914('0x11')](queryQueues));_0x4d45ae[_0x7914('0x2e')](db['FaxQueue'][_0x7914('0x11')](queryQueues));_0x4d45ae['push'](db[_0x7914('0x30')][_0x7914('0x11')](queryQueues));_0x4d45ae[_0x7914('0x2e')](db[_0x7914('0x31')][_0x7914('0x11')](queryQueues));_0x4d45ae[_0x7914('0x2e')](db[_0x7914('0x32')][_0x7914('0x11')](queryQueues));_0x4d45ae[_0x7914('0x2e')](db[_0x7914('0x33')]['findAll'](queryQueues));_0x4d45ae[_0x7914('0x2e')](db[_0x7914('0x17')]['findAll'](queryTelephones));_0x4d45ae['push'](db[_0x7914('0x34')][_0x7914('0x11')](queryTrunks));_0x4d45ae[_0x7914('0x2e')](db[_0x7914('0x19')][_0x7914('0x11')](queryCampaigns));_0x4d45ae[_0x7914('0x2e')](db['User'][_0x7914('0x11')](queryAgents));break;case'user':_0x37cc3a[_0x560436]('voice:inbound');_0x37cc3a[_0x560436](_0x7914('0x35'));_0x4d45ae[_0x7914('0x2e')](getAssociatedResources(_0x7914('0x36'),_0x106120[_0x7914('0x21')],_0x7914('0x37')));_0x4d45ae['push'](getAssociatedResources(_0x7914('0xd'),_0x106120[_0x7914('0x21')],_0x7914('0x2f')));_0x4d45ae[_0x7914('0x2e')](getAssociatedResources(_0x7914('0xe'),_0x106120[_0x7914('0x21')],_0x7914('0x38')));_0x4d45ae[_0x7914('0x2e')](getAssociatedResources('SmsQueues',_0x106120[_0x7914('0x21')],'SmsQueue'));_0x4d45ae['push'](getAssociatedResources('MailQueues',_0x106120[_0x7914('0x21')],_0x7914('0x31')));_0x4d45ae['push'](getAssociatedResources('OpenchannelQueues',_0x106120['userProfileId'],_0x7914('0x32')));_0x4d45ae['push'](getAssociatedResources(_0x7914('0x39'),_0x106120[_0x7914('0x21')],_0x7914('0x33')));_0x4d45ae[_0x7914('0x2e')](getAssociatedResources(_0x7914('0x12'),_0x106120[_0x7914('0x21')],_0x7914('0x17')));_0x4d45ae[_0x7914('0x2e')](getAssociatedResources('Trunks',_0x106120['userProfileId'],_0x7914('0x34')));_0x4d45ae['push'](getAssociatedResources(_0x7914('0x14'),_0x106120['userProfileId'],_0x7914('0x19')));_0x4d45ae[_0x7914('0x2e')](db[_0x7914('0x17')]['findAll'](queryAgents));break;case'agent':_0x37cc3a[_0x560436](_0x7914('0x2b'));_0x37cc3a[_0x560436](_0x7914('0x35'));_0x4d45ae['push'](_0x106120['getVoiceQueues']({'attributes':['id',_0x7914('0x5')]}));_0x4d45ae['push'](_0x106120['getChatQueues']({'attributes':['id','name']}));_0x4d45ae[_0x7914('0x2e')](_0x106120[_0x7914('0x3a')]({'attributes':['id',_0x7914('0x5')]}));_0x4d45ae[_0x7914('0x2e')](_0x106120[_0x7914('0x3b')]({'attributes':['id',_0x7914('0x5')]}));_0x4d45ae[_0x7914('0x2e')](_0x106120[_0x7914('0x3c')]({'attributes':['id',_0x7914('0x5')]}));_0x4d45ae['push'](_0x106120[_0x7914('0x3d')]({'attributes':['id',_0x7914('0x5')]}));_0x4d45ae[_0x7914('0x2e')](_0x106120[_0x7914('0x3e')]({'attributes':['id','name']}));break;}return BPromise[_0x7914('0x3f')](_0x4d45ae);}})['then'](function(_0xa02ddc){if(_0xa02ddc&&_0xa02ddc[_0x7914('0x40')]){for(var _0x3e03f5=0x0;_0x3e03f5<_0xa02ddc[_0x7914('0x40')];_0x3e03f5+=0x1){for(var _0x12f05e=0x0;_0x12f05e<_0xa02ddc[_0x3e03f5][_0x7914('0x40')];_0x12f05e+=0x1){switch(_0x3e03f5){case 0x0:joinOrLeaveQueues(_0x37cc3a,_0x560436,_0x7914('0x41'),_0xa02ddc[_0x3e03f5][_0x12f05e]);break;case 0x1:joinOrLeaveQueues(_0x37cc3a,_0x560436,_0x7914('0x42'),_0xa02ddc[_0x3e03f5][_0x12f05e]);break;case 0x2:joinOrLeaveQueues(_0x37cc3a,_0x560436,'fax',_0xa02ddc[_0x3e03f5][_0x12f05e]);break;case 0x3:joinOrLeaveQueues(_0x37cc3a,_0x560436,_0x7914('0x43'),_0xa02ddc[_0x3e03f5][_0x12f05e]);break;case 0x4:joinOrLeaveQueues(_0x37cc3a,_0x560436,'mail',_0xa02ddc[_0x3e03f5][_0x12f05e]);break;case 0x5:joinOrLeaveQueues(_0x37cc3a,_0x560436,_0x7914('0x44'),_0xa02ddc[_0x3e03f5][_0x12f05e]);break;case 0x6:joinOrLeaveQueues(_0x37cc3a,_0x560436,_0x7914('0x45'),_0xa02ddc[_0x3e03f5][_0x12f05e]);break;case 0x7:if(_0x50b341[_0x7914('0x7')]!=='agent')_0x37cc3a[_0x560436](util[_0x7914('0x1d')](_0x7914('0x46'),_0xa02ddc[_0x3e03f5][_0x12f05e]['name']));break;case 0x8:if(_0x50b341[_0x7914('0x7')]!==_0x7914('0x8'))_0x37cc3a[_0x560436](util['format'](_0x7914('0x47'),_0xa02ddc[_0x3e03f5][_0x12f05e][_0x7914('0x5')]));break;case 0x9:if(_0x50b341[_0x7914('0x7')]!=='agent')_0x37cc3a[_0x560436](util[_0x7914('0x1d')]('campaign:%s:%s',_0xa02ddc[_0x3e03f5][_0x12f05e]['type'],_0xa02ddc[_0x3e03f5][_0x12f05e][_0x7914('0x5')]));break;case 0xa:_0x37cc3a[_0x560436](util[_0x7914('0x1d')](_0x7914('0x1e'),_0xa02ddc[_0x3e03f5][_0x12f05e][_0x7914('0x5')]));break;}}}}})[_0x7914('0xb')](function(){if(_0x560436==='leave'){var _0x24b773=_[_0x7914('0x48')](_0x50b341[_0x7914('0x23')],'id');return _0x50b341[_0x7914('0x49')](_0x24b773)[_0x7914('0xb')](function(){for(var _0x49c1f3=0x0;_0x49c1f3<_0x24b773[_0x7914('0x40')];_0x49c1f3+=0x1){_0x87fe22['emit'](_0x7914('0x4a'),{'ChatInteractionId':Number(_0x24b773[_0x49c1f3]),'UserId':Number(_0x50b341['id'])});}});}})[_0x7914('0xb')](function(){if(_0x560436==='leave'){var _0x72013e=_[_0x7914('0x48')](_0x50b341[_0x7914('0x24')],'id');return _0x50b341[_0x7914('0x4b')](_0x72013e)[_0x7914('0xb')](function(){for(var _0x3285fc=0x0;_0x3285fc<_0x72013e[_0x7914('0x40')];_0x3285fc+=0x1){_0x87fe22[_0x7914('0x4c')](_0x7914('0x4d'),{'MailInteractionId':Number(_0x72013e[_0x3285fc]),'UserId':Number(_0x50b341['id'])});}});}})[_0x7914('0xb')](function(){if(_0x560436===_0x7914('0x4e')){var _0x3b1fdb=_[_0x7914('0x48')](_0x50b341[_0x7914('0x26')],'id');return _0x50b341[_0x7914('0x4f')](_0x3b1fdb)[_0x7914('0xb')](function(){for(var _0x56a3d6=0x0;_0x56a3d6<_0x3b1fdb[_0x7914('0x40')];_0x56a3d6+=0x1){_0x87fe22[_0x7914('0x4c')](_0x7914('0x50'),{'FaxInteractionId':Number(_0x3b1fdb[_0x56a3d6]),'UserId':Number(_0x50b341['id'])});}});}})[_0x7914('0xb')](function(){if(_0x560436===_0x7914('0x4e')){var _0x44aa64=_[_0x7914('0x48')](_0x50b341[_0x7914('0x27')],'id');return _0x50b341['removeSmsInteractions'](_0x44aa64)['then'](function(){for(var _0x334f52=0x0;_0x334f52<_0x44aa64[_0x7914('0x40')];_0x334f52+=0x1){_0x87fe22[_0x7914('0x4c')](_0x7914('0x51'),{'SmsInteractionId':Number(_0x44aa64[_0x334f52]),'UserId':Number(_0x50b341['id'])});}});}})['then'](function(){if(_0x560436===_0x7914('0x4e')){var _0x5c3969=_[_0x7914('0x48')](_0x50b341['OpenchannelInteractions'],'id');return _0x50b341[_0x7914('0x52')](_0x5c3969)[_0x7914('0xb')](function(){for(var _0x3e94e0=0x0;_0x3e94e0<_0x5c3969[_0x7914('0x40')];_0x3e94e0+=0x1){_0x87fe22[_0x7914('0x4c')](_0x7914('0x53'),{'OpenchannelInteractionId':Number(_0x5c3969[_0x3e94e0]),'UserId':Number(_0x50b341['id'])});}});}})['then'](function(){if(_0x560436===_0x7914('0x4e')){var _0x59cf20=_[_0x7914('0x48')](_0x50b341[_0x7914('0x2a')],'id');return _0x50b341['removeWhatsappInteractions'](_0x59cf20)['then'](function(){for(var _0x401406=0x0;_0x401406<_0x59cf20[_0x7914('0x40')];_0x401406+=0x1){_0x87fe22['emit']('user_has_whatsapp_interactions:remove',{'WhatsappInteractionId':Number(_0x59cf20[_0x401406]),'UserId':Number(_0x50b341['id'])});}});}})['catch'](function(_0x191a05){_0x37cc3a[_0x7914('0x54')](_0x191a05);});}}function onDisconnect(_0x2612ac,_0x2467f4){joinOrLeave(_0x2612ac,'leave',_0x2467f4);}function onConnect(_0x33180b){joinOrLeave(_0x33180b,_0x7914('0x55'));}exports[_0x7914('0x56')]=function(_0x32f7f1){_0x32f7f1['on']('connection',function(_0xf2c3f5){_0xf2c3f5[_0x7914('0x57')](0x0);_0xf2c3f5[_0x7914('0x58')]=_0xf2c3f5[_0x7914('0x59')][_0x7914('0x5a')][_0x7914('0x5b')]+':'+_0xf2c3f5[_0x7914('0x59')][_0x7914('0x5a')][_0x7914('0x5c')];_0xf2c3f5['connectedAt']=new Date();_0xf2c3f5[_0x7914('0x54')]=function(_0x1ebce6){console[_0x7914('0x54')](_0x7914('0x5d')+_0xf2c3f5[_0x7914('0x5e')][_0x7914('0x5')]+'['+_0xf2c3f5[_0x7914('0x58')]+']',_0x1ebce6);};_0xf2c3f5['on'](_0x7914('0x5f'),function(){onDisconnect(_0xf2c3f5,_0x32f7f1);_0xf2c3f5[_0x7914('0x54')](_0x7914('0x60'));});onConnect(_0xf2c3f5);_0xf2c3f5[_0x7914('0x54')](_0x7914('0x61'));});}; \ No newline at end of file +var _0xcc58=['Campaign','format','find','handshake','ChatInteraction','MailInteraction','MailInteractions','FaxInteraction','FaxInteractions','SmsInteraction','SmsInteractions','OpenchannelInteraction','OpenchannelInteractions','WhatsappInteractions','user:%s','voice:inbound','voice:outbound','hasOwnProperty','include','push','ChatQueue','FaxQueue','MailQueue','WhatsappQueue','user','VoiceQueue','ChatQueues','userProfileId','SmsQueues','SmsQueue','OpenchannelQueues','OpenchannelQueue','Telephones','getVoiceQueues','getChatQueues','getFaxQueues','getSmsQueues','getOpenchannelQueues','getWhatsappQueues','all','length','voice','fax','sms','mail','openchannel','trunk:%s','campaign:%s:%s','leave','ChatInteractions','removeChatInteractions','emit','user_has_chat_interactions:remove','removeMailInteractions','user_has_mail_interactions:remove','removeFaxInteractions','user_has_fax_interactions:remove','removeSmsInteractions','user_has_sms_interactions:remove','user_has_openchannel_interactions:remove','removeWhatsappInteractions','user_has_whatsapp_interactions:remove','log','join','default','connection','address','request','remoteAddress','remotePort','SocketIO\x20','nsp','disconnect','DISCONNECTED','lodash','../mysqldb','./environment','name','Agents','role','agent','telephone','type','ivr','findOne','then','VoiceQueues','FaxQueues','MailQueues','findAll','Trunks','IvrCampaigns','UserProfileResource','resourceId','map','User','where'];(function(_0x25af3a,_0x4b9989){var _0x1d012b=function(_0x2b8d14){while(--_0x2b8d14){_0x25af3a['push'](_0x25af3a['shift']());}};_0x1d012b(++_0x4b9989);}(_0xcc58,0xab));var _0x8cc5=function(_0x12919e,_0x2cbd0b){_0x12919e=_0x12919e-0x0;var _0x26c230=_0xcc58[_0x12919e];return _0x26c230;};'use strict';var _=require(_0x8cc5('0x0'));var util=require('util');var BPromise=require('bluebird');var db=require(_0x8cc5('0x1'))['db'];var config=require(_0x8cc5('0x2'));var queryQueues={'attributes':['id',_0x8cc5('0x3')],'include':[{'as':_0x8cc5('0x4'),'model':db['User'],'attributes':['id','name',_0x8cc5('0x5')],'raw':!![],'where':{'role':_0x8cc5('0x6')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0x8cc5('0x3')],'where':{'role':_0x8cc5('0x7')}};var queryTrunks={'raw':!![],'attributes':['id',_0x8cc5('0x3')]};var queryAgents={'raw':!![],'attributes':['id',_0x8cc5('0x3')],'where':{'role':'agent'}};var queryCampaigns={'raw':!![],'attributes':['id',_0x8cc5('0x3'),_0x8cc5('0x8')],'where':{'type':_0x8cc5('0x9')}};function getAssociatedResources(_0x244203,_0x11fce6,_0x1c4dea){return db['UserProfileSection'][_0x8cc5('0xa')]({'where':{'name':_0x244203,'userProfileId':_0x11fce6},'raw':!![]})[_0x8cc5('0xb')](function(_0x3315d5){if(_0x3315d5){if(_0x3315d5['autoAssociation']){switch(_0x244203){case _0x8cc5('0xc'):case'ChatQueues':case _0x8cc5('0xd'):case'SmsQueues':case _0x8cc5('0xe'):case'OpenchannelQueues':case'WhatsappQueues':return db[_0x1c4dea][_0x8cc5('0xf')](queryQueues);case'Telephones':return db[_0x1c4dea][_0x8cc5('0xf')](queryTelephones);case _0x8cc5('0x10'):return db[_0x1c4dea]['findAll'](queryTrunks);case _0x8cc5('0x11'):return db[_0x1c4dea][_0x8cc5('0xf')](queryCampaigns);}}else{return db[_0x8cc5('0x12')][_0x8cc5('0xf')]({'attributes':[_0x8cc5('0x13')],'where':{'sectionId':_0x3315d5['id']},'raw':!![]})[_0x8cc5('0xb')](function(_0x10bbd7){if(_0x10bbd7){var _0x5a28c8={'where':{'id':_[_0x8cc5('0x14')](_0x10bbd7,_0x8cc5('0x13'))},'raw':!![]};switch(_0x1c4dea){case _0x8cc5('0x15'):_0x5a28c8[_0x8cc5('0x16')][_0x8cc5('0x5')]='telephone';break;case _0x8cc5('0x17'):_0x5a28c8[_0x8cc5('0x16')]['type']=_0x8cc5('0x9');break;}return db[_0x1c4dea][_0x8cc5('0xf')](_0x5a28c8);}else{return[];}});}}else{return[];}})[_0x8cc5('0xb')](function(_0xab691a){return _0xab691a;});}function joinOrLeaveQueues(_0x221c57,_0x323bab,_0x4f643e,_0x3a5b14){_0x221c57[_0x323bab](util[_0x8cc5('0x18')]('%s:queue:%s',_0x4f643e,_0x3a5b14[_0x8cc5('0x3')]));if(_0x3a5b14[_0x8cc5('0x4')]){for(var _0x7e91b8=0x0;_0x7e91b8<_0x3a5b14[_0x8cc5('0x4')]['length'];_0x7e91b8+=0x1){_0x221c57[_0x323bab](util[_0x8cc5('0x18')]('user:%s',_0x3a5b14[_0x8cc5('0x4')][_0x7e91b8][_0x8cc5('0x3')]));}}}function joinOrLeave(_0x35a471,_0x104f9f,_0x43cad3){var _0x2246f6;if(_0x35a471['handshake']['query']['id']){db[_0x8cc5('0x15')][_0x8cc5('0x19')]({'attributes':['id',_0x8cc5('0x3'),_0x8cc5('0x5'),'userProfileId'],'where':{'id':_0x35a471[_0x8cc5('0x1a')]['query']['id']},'include':[{'model':db[_0x8cc5('0x1b')],'as':'ChatInteractions','attributes':['id'],'raw':!![]},{'model':db[_0x8cc5('0x1c')],'as':_0x8cc5('0x1d'),'attributes':['id'],'raw':!![]},{'model':db[_0x8cc5('0x1e')],'as':_0x8cc5('0x1f'),'attributes':['id'],'raw':!![]},{'model':db[_0x8cc5('0x20')],'as':_0x8cc5('0x21'),'attributes':['id'],'raw':!![]},{'model':db[_0x8cc5('0x22')],'as':_0x8cc5('0x23'),'attributes':['id'],'raw':!![]},{'model':db['WhatsappInteraction'],'as':_0x8cc5('0x24'),'attributes':['id'],'raw':!![]}]})[_0x8cc5('0xb')](function(_0x1e8da5){if(_0x1e8da5){_0x2246f6=_0x1e8da5;_0x35a471[_0x104f9f](util[_0x8cc5('0x18')](_0x8cc5('0x25'),_0x1e8da5[_0x8cc5('0x3')]));var _0x5b9d92=[];switch(_0x1e8da5[_0x8cc5('0x5')]){case'admin':_0x35a471[_0x104f9f](_0x8cc5('0x26'));_0x35a471[_0x104f9f](_0x8cc5('0x27'));if(queryQueues[_0x8cc5('0x28')](_0x8cc5('0x29'))){delete queryQueues[_0x8cc5('0x29')];}_0x5b9d92[_0x8cc5('0x2a')](db['VoiceQueue'][_0x8cc5('0xf')](queryQueues));_0x5b9d92[_0x8cc5('0x2a')](db[_0x8cc5('0x2b')][_0x8cc5('0xf')](queryQueues));_0x5b9d92[_0x8cc5('0x2a')](db[_0x8cc5('0x2c')][_0x8cc5('0xf')](queryQueues));_0x5b9d92[_0x8cc5('0x2a')](db['SmsQueue'][_0x8cc5('0xf')](queryQueues));_0x5b9d92[_0x8cc5('0x2a')](db[_0x8cc5('0x2d')][_0x8cc5('0xf')](queryQueues));_0x5b9d92[_0x8cc5('0x2a')](db['OpenchannelQueue']['findAll'](queryQueues));_0x5b9d92[_0x8cc5('0x2a')](db[_0x8cc5('0x2e')][_0x8cc5('0xf')](queryQueues));_0x5b9d92[_0x8cc5('0x2a')](db[_0x8cc5('0x15')][_0x8cc5('0xf')](queryTelephones));_0x5b9d92[_0x8cc5('0x2a')](db['Trunk'][_0x8cc5('0xf')](queryTrunks));_0x5b9d92[_0x8cc5('0x2a')](db[_0x8cc5('0x17')][_0x8cc5('0xf')](queryCampaigns));_0x5b9d92[_0x8cc5('0x2a')](db[_0x8cc5('0x15')][_0x8cc5('0xf')](queryAgents));break;case _0x8cc5('0x2f'):_0x35a471[_0x104f9f](_0x8cc5('0x26'));_0x35a471[_0x104f9f](_0x8cc5('0x27'));_0x5b9d92[_0x8cc5('0x2a')](getAssociatedResources(_0x8cc5('0xc'),_0x1e8da5['userProfileId'],_0x8cc5('0x30')));_0x5b9d92[_0x8cc5('0x2a')](getAssociatedResources(_0x8cc5('0x31'),_0x1e8da5[_0x8cc5('0x32')],'ChatQueue'));_0x5b9d92[_0x8cc5('0x2a')](getAssociatedResources(_0x8cc5('0xd'),_0x1e8da5[_0x8cc5('0x32')],'FaxQueue'));_0x5b9d92['push'](getAssociatedResources(_0x8cc5('0x33'),_0x1e8da5[_0x8cc5('0x32')],_0x8cc5('0x34')));_0x5b9d92[_0x8cc5('0x2a')](getAssociatedResources(_0x8cc5('0xe'),_0x1e8da5['userProfileId'],'MailQueue'));_0x5b9d92[_0x8cc5('0x2a')](getAssociatedResources(_0x8cc5('0x35'),_0x1e8da5[_0x8cc5('0x32')],_0x8cc5('0x36')));_0x5b9d92[_0x8cc5('0x2a')](getAssociatedResources('WhatsappQueues',_0x1e8da5['userProfileId'],_0x8cc5('0x2e')));_0x5b9d92['push'](getAssociatedResources(_0x8cc5('0x37'),_0x1e8da5[_0x8cc5('0x32')],_0x8cc5('0x15')));_0x5b9d92[_0x8cc5('0x2a')](getAssociatedResources('Trunks',_0x1e8da5[_0x8cc5('0x32')],'Trunk'));_0x5b9d92[_0x8cc5('0x2a')](getAssociatedResources(_0x8cc5('0x11'),_0x1e8da5['userProfileId'],'Campaign'));_0x5b9d92['push'](db[_0x8cc5('0x15')]['findAll'](queryAgents));break;case _0x8cc5('0x6'):_0x35a471[_0x104f9f](_0x8cc5('0x26'));_0x35a471[_0x104f9f]('voice:outbound');_0x5b9d92[_0x8cc5('0x2a')](_0x1e8da5[_0x8cc5('0x38')]({'attributes':['id',_0x8cc5('0x3')]}));_0x5b9d92[_0x8cc5('0x2a')](_0x1e8da5[_0x8cc5('0x39')]({'attributes':['id',_0x8cc5('0x3')]}));_0x5b9d92[_0x8cc5('0x2a')](_0x1e8da5[_0x8cc5('0x3a')]({'attributes':['id','name']}));_0x5b9d92['push'](_0x1e8da5[_0x8cc5('0x3b')]({'attributes':['id',_0x8cc5('0x3')]}));_0x5b9d92[_0x8cc5('0x2a')](_0x1e8da5['getMailQueues']({'attributes':['id',_0x8cc5('0x3')]}));_0x5b9d92['push'](_0x1e8da5[_0x8cc5('0x3c')]({'attributes':['id',_0x8cc5('0x3')]}));_0x5b9d92['push'](_0x1e8da5[_0x8cc5('0x3d')]({'attributes':['id',_0x8cc5('0x3')]}));break;}return BPromise[_0x8cc5('0x3e')](_0x5b9d92);}})[_0x8cc5('0xb')](function(_0x289e6c){if(_0x289e6c&&_0x289e6c[_0x8cc5('0x3f')]){for(var _0x533b54=0x0;_0x533b54<_0x289e6c[_0x8cc5('0x3f')];_0x533b54+=0x1){for(var _0x2eb765=0x0;_0x2eb765<_0x289e6c[_0x533b54][_0x8cc5('0x3f')];_0x2eb765+=0x1){switch(_0x533b54){case 0x0:joinOrLeaveQueues(_0x35a471,_0x104f9f,_0x8cc5('0x40'),_0x289e6c[_0x533b54][_0x2eb765]);break;case 0x1:joinOrLeaveQueues(_0x35a471,_0x104f9f,'chat',_0x289e6c[_0x533b54][_0x2eb765]);break;case 0x2:joinOrLeaveQueues(_0x35a471,_0x104f9f,_0x8cc5('0x41'),_0x289e6c[_0x533b54][_0x2eb765]);break;case 0x3:joinOrLeaveQueues(_0x35a471,_0x104f9f,_0x8cc5('0x42'),_0x289e6c[_0x533b54][_0x2eb765]);break;case 0x4:joinOrLeaveQueues(_0x35a471,_0x104f9f,_0x8cc5('0x43'),_0x289e6c[_0x533b54][_0x2eb765]);break;case 0x5:joinOrLeaveQueues(_0x35a471,_0x104f9f,_0x8cc5('0x44'),_0x289e6c[_0x533b54][_0x2eb765]);break;case 0x6:joinOrLeaveQueues(_0x35a471,_0x104f9f,'whatsapp',_0x289e6c[_0x533b54][_0x2eb765]);break;case 0x7:if(_0x2246f6[_0x8cc5('0x5')]!==_0x8cc5('0x6'))_0x35a471[_0x104f9f](util[_0x8cc5('0x18')]('telephone:%s',_0x289e6c[_0x533b54][_0x2eb765][_0x8cc5('0x3')]));break;case 0x8:if(_0x2246f6[_0x8cc5('0x5')]!==_0x8cc5('0x6'))_0x35a471[_0x104f9f](util[_0x8cc5('0x18')](_0x8cc5('0x45'),_0x289e6c[_0x533b54][_0x2eb765][_0x8cc5('0x3')]));break;case 0x9:if(_0x2246f6[_0x8cc5('0x5')]!==_0x8cc5('0x6'))_0x35a471[_0x104f9f](util['format'](_0x8cc5('0x46'),_0x289e6c[_0x533b54][_0x2eb765][_0x8cc5('0x8')],_0x289e6c[_0x533b54][_0x2eb765][_0x8cc5('0x3')]));break;case 0xa:_0x35a471[_0x104f9f](util[_0x8cc5('0x18')]('user:%s',_0x289e6c[_0x533b54][_0x2eb765][_0x8cc5('0x3')]));break;}}}}})['then'](function(){if(_0x104f9f===_0x8cc5('0x47')){var _0x52ac4c=_[_0x8cc5('0x14')](_0x2246f6[_0x8cc5('0x48')],'id');return _0x2246f6[_0x8cc5('0x49')](_0x52ac4c)[_0x8cc5('0xb')](function(){for(var _0x56d739=0x0;_0x56d739<_0x52ac4c['length'];_0x56d739+=0x1){_0x43cad3[_0x8cc5('0x4a')](_0x8cc5('0x4b'),{'ChatInteractionId':Number(_0x52ac4c[_0x56d739]),'UserId':Number(_0x2246f6['id'])});}});}})[_0x8cc5('0xb')](function(){if(_0x104f9f===_0x8cc5('0x47')){var _0x5809e3=_['map'](_0x2246f6['MailInteractions'],'id');return _0x2246f6[_0x8cc5('0x4c')](_0x5809e3)[_0x8cc5('0xb')](function(){for(var _0x533c4d=0x0;_0x533c4d<_0x5809e3[_0x8cc5('0x3f')];_0x533c4d+=0x1){_0x43cad3[_0x8cc5('0x4a')](_0x8cc5('0x4d'),{'MailInteractionId':Number(_0x5809e3[_0x533c4d]),'UserId':Number(_0x2246f6['id'])});}});}})['then'](function(){if(_0x104f9f===_0x8cc5('0x47')){var _0x5a523b=_[_0x8cc5('0x14')](_0x2246f6[_0x8cc5('0x1f')],'id');return _0x2246f6[_0x8cc5('0x4e')](_0x5a523b)[_0x8cc5('0xb')](function(){for(var _0x2a2469=0x0;_0x2a2469<_0x5a523b[_0x8cc5('0x3f')];_0x2a2469+=0x1){_0x43cad3[_0x8cc5('0x4a')](_0x8cc5('0x4f'),{'FaxInteractionId':Number(_0x5a523b[_0x2a2469]),'UserId':Number(_0x2246f6['id'])});}});}})[_0x8cc5('0xb')](function(){if(_0x104f9f==='leave'){var _0x4d69a5=_[_0x8cc5('0x14')](_0x2246f6[_0x8cc5('0x21')],'id');return _0x2246f6[_0x8cc5('0x50')](_0x4d69a5)['then'](function(){for(var _0x3e2904=0x0;_0x3e2904<_0x4d69a5[_0x8cc5('0x3f')];_0x3e2904+=0x1){_0x43cad3[_0x8cc5('0x4a')](_0x8cc5('0x51'),{'SmsInteractionId':Number(_0x4d69a5[_0x3e2904]),'UserId':Number(_0x2246f6['id'])});}});}})['then'](function(){if(_0x104f9f===_0x8cc5('0x47')){var _0x2372a3=_[_0x8cc5('0x14')](_0x2246f6[_0x8cc5('0x23')],'id');return _0x2246f6['removeOpenchannelInteractions'](_0x2372a3)[_0x8cc5('0xb')](function(){for(var _0xe24a8c=0x0;_0xe24a8c<_0x2372a3[_0x8cc5('0x3f')];_0xe24a8c+=0x1){_0x43cad3['emit'](_0x8cc5('0x52'),{'OpenchannelInteractionId':Number(_0x2372a3[_0xe24a8c]),'UserId':Number(_0x2246f6['id'])});}});}})[_0x8cc5('0xb')](function(){if(_0x104f9f===_0x8cc5('0x47')){var _0x3045cb=_['map'](_0x2246f6[_0x8cc5('0x24')],'id');return _0x2246f6[_0x8cc5('0x53')](_0x3045cb)[_0x8cc5('0xb')](function(){for(var _0x2ceda5=0x0;_0x2ceda5<_0x3045cb[_0x8cc5('0x3f')];_0x2ceda5+=0x1){_0x43cad3[_0x8cc5('0x4a')](_0x8cc5('0x54'),{'WhatsappInteractionId':Number(_0x3045cb[_0x2ceda5]),'UserId':Number(_0x2246f6['id'])});}});}})['catch'](function(_0x26db3f){_0x35a471[_0x8cc5('0x55')](_0x26db3f);});}}function onDisconnect(_0x338675,_0x4de0e1){joinOrLeave(_0x338675,_0x8cc5('0x47'),_0x4de0e1);}function onConnect(_0x3b7f85){joinOrLeave(_0x3b7f85,_0x8cc5('0x56'));}exports[_0x8cc5('0x57')]=function(_0x17c5a6){_0x17c5a6['on'](_0x8cc5('0x58'),function(_0x3b134b){_0x3b134b['setMaxListeners'](0x0);_0x3b134b[_0x8cc5('0x59')]=_0x3b134b[_0x8cc5('0x5a')][_0x8cc5('0x58')][_0x8cc5('0x5b')]+':'+_0x3b134b['request']['connection'][_0x8cc5('0x5c')];_0x3b134b['connectedAt']=new Date();_0x3b134b[_0x8cc5('0x55')]=function(_0x68cf4e){console[_0x8cc5('0x55')](_0x8cc5('0x5d')+_0x3b134b[_0x8cc5('0x5e')][_0x8cc5('0x3')]+'['+_0x3b134b[_0x8cc5('0x59')]+']',_0x68cf4e);};_0x3b134b['on'](_0x8cc5('0x5f'),function(){onDisconnect(_0x3b134b,_0x17c5a6);_0x3b134b['log'](_0x8cc5('0x60'));});onConnect(_0x3b134b);_0x3b134b[_0x8cc5('0x55')]('CONNECTED');});}; \ No newline at end of file diff --git a/server/config/triggers/index.js b/server/config/triggers/index.js index c20a57f..3d3a67a 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 _0xb3cb=['outgoingmessage','AfterCreateMessage','get','event','offlineMessage','opened','QueryTypes','SIP/%s','name','changed','closed','substatus','User','find','fullname','email','default','length','hasOwnProperty','model','hook','callback','util','jayson/promise','../logger','http','Chat','ChatInteraction','newinteraction','afterUpdate','closedinteraction','ChatMessage','afterCreate','ChatOfflineMessage','newmessage','Sms','SmsInteraction','SmsMessage','Whatsapp','WhatsappInteraction','WhatsappMessage','FaxInteraction','Fax','Mail','MailInteraction','Openchannel','OpenchannelInteraction','OpenchannelMessage','request','EventManager','then','info','Trigger,\x20%s','error','code','catch','channel','motionChannel','direction','ContactId','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','query','Sequelize','SELECT','contact','UserId','undefined','interface','format','agent','incomingmessage'];(function(_0x351aac,_0x1c1233){var _0x27b9cb=function(_0x46d0cf){while(--_0x46d0cf){_0x351aac['push'](_0x351aac['shift']());}};_0x27b9cb(++_0x1c1233);}(_0xb3cb,0x136));var _0xbb3c=function(_0x402b49,_0x3d425d){_0x402b49=_0x402b49-0x0;var _0x2a0a1e=_0xb3cb[_0x402b49];return _0x2a0a1e;};'use strict';var util=require(_0xbb3c('0x0'));var db=require('../../mysqldb')['db'];var jayson=require(_0xbb3c('0x1'));var logger=require(_0xbb3c('0x2'))('triggers');var client=jayson['client'][_0xbb3c('0x3')]({'port':0x232a});var triggers=[{'channel':_0xbb3c('0x4'),'model':_0xbb3c('0x5'),'event':'afterCreate','condition':_0xbb3c('0x6'),'callback':afterCreate},{'channel':_0xbb3c('0x4'),'model':_0xbb3c('0x5'),'event':_0xbb3c('0x7'),'condition':_0xbb3c('0x8'),'callback':afterUpdate},{'channel':_0xbb3c('0x4'),'model':_0xbb3c('0x9'),'event':_0xbb3c('0xa'),'condition':'newmessage','callback':afterCreateMessage},{'channel':_0xbb3c('0x4'),'model':_0xbb3c('0xb'),'event':'afterCreate','condition':_0xbb3c('0xc'),'callback':afterCreateOfflineMessage},{'channel':_0xbb3c('0xd'),'model':_0xbb3c('0xe'),'event':_0xbb3c('0xa'),'condition':_0xbb3c('0x6'),'callback':afterCreate},{'channel':_0xbb3c('0xd'),'model':_0xbb3c('0xe'),'event':_0xbb3c('0x7'),'condition':_0xbb3c('0x8'),'callback':afterUpdate},{'channel':_0xbb3c('0xd'),'model':_0xbb3c('0xf'),'event':_0xbb3c('0xa'),'condition':_0xbb3c('0xc'),'callback':afterCreateMessage},{'channel':_0xbb3c('0x10'),'model':_0xbb3c('0x11'),'event':'afterCreate','condition':_0xbb3c('0x6'),'callback':afterCreate},{'channel':'Whatsapp','model':_0xbb3c('0x11'),'event':_0xbb3c('0x7'),'condition':_0xbb3c('0x8'),'callback':afterUpdate},{'channel':_0xbb3c('0x10'),'model':_0xbb3c('0x12'),'event':_0xbb3c('0xa'),'condition':_0xbb3c('0xc'),'callback':afterCreateMessage},{'channel':'Fax','model':_0xbb3c('0x13'),'event':_0xbb3c('0xa'),'condition':'newinteraction','callback':afterCreate},{'channel':'Fax','model':_0xbb3c('0x13'),'event':_0xbb3c('0x7'),'condition':_0xbb3c('0x8'),'callback':afterUpdate},{'channel':_0xbb3c('0x14'),'model':'FaxMessage','event':_0xbb3c('0xa'),'condition':'newmessage','callback':afterCreateMessage},{'channel':_0xbb3c('0x15'),'model':'MailInteraction','event':_0xbb3c('0xa'),'condition':_0xbb3c('0x6'),'callback':afterCreate},{'channel':_0xbb3c('0x15'),'model':_0xbb3c('0x16'),'event':_0xbb3c('0x7'),'condition':_0xbb3c('0x8'),'callback':afterUpdate},{'channel':_0xbb3c('0x15'),'model':'MailMessage','event':_0xbb3c('0xa'),'condition':_0xbb3c('0xc'),'callback':afterCreateMessage},{'channel':_0xbb3c('0x17'),'model':_0xbb3c('0x18'),'event':'afterCreate','condition':_0xbb3c('0x6'),'callback':afterCreate},{'channel':_0xbb3c('0x17'),'model':_0xbb3c('0x18'),'event':_0xbb3c('0x7'),'condition':'closedinteraction','callback':afterUpdate},{'channel':_0xbb3c('0x17'),'model':_0xbb3c('0x19'),'event':'afterCreate','condition':'newmessage','callback':afterCreateMessage}];function request(_0x28eff3){return client[_0xbb3c('0x1a')](_0xbb3c('0x1b'),_0x28eff3)[_0xbb3c('0x1c')](function(_0x976f63){logger[_0xbb3c('0x1d')](_0xbb3c('0x1e'),_0xbb3c('0x1b'),_0x976f63);if(_0x976f63[_0xbb3c('0x1f')]){if(_0x976f63[_0xbb3c('0x1f')][_0xbb3c('0x20')]===0x1f4){logger[_0xbb3c('0x1f')]('Trigger,\x20%s',_0xbb3c('0x1b'),_0x976f63[_0xbb3c('0x1f')]);}}})[_0xbb3c('0x21')](function(_0x509018){logger[_0xbb3c('0x1f')](_0xbb3c('0x1e'),_0xbb3c('0x1b'),_0x509018);});}function afterCreateMessage(_0x4ee1ae){return function(_0x491cb0){_0x491cb0=_0x491cb0['get']({'plain':!![]});_0x491cb0[_0xbb3c('0x22')]=_0x4ee1ae;_0x491cb0[_0xbb3c('0x23')]=_0x4ee1ae;_0x491cb0['event']=_0x491cb0[_0xbb3c('0x24')];Promise['resolve']()['then'](function(){if(typeof _0x491cb0[_0xbb3c('0x25')]==='undefined')return null;var _0x313dfd=_0xbb3c('0x26')+_0x491cb0['ContactId'];return db[_0xbb3c('0x27')][_0xbb3c('0x28')](_0x313dfd,{'type':db[_0xbb3c('0x29')]['QueryTypes'][_0xbb3c('0x2a')],'raw':!![]});})[_0xbb3c('0x1c')](function(_0x3adc1c){if(_0x3adc1c){_0x491cb0[_0xbb3c('0x2b')]=_0x3adc1c[0x0];}if(typeof _0x491cb0[_0xbb3c('0x2c')]===_0xbb3c('0x2d'))return;return getAgent(_0x491cb0[_0xbb3c('0x2c')]);})['then'](function(_0x23fa49){if(_0x23fa49){_0x491cb0[_0xbb3c('0x2e')]=util[_0xbb3c('0x2f')]('SIP/%s',_0x23fa49['name']);_0x491cb0[_0xbb3c('0x30')]=_0x23fa49;_0x491cb0['channel']=_0x4ee1ae;return request({'event':_0xbb3c('0x31'),'message':_0x491cb0});}else{return request({'event':_0xbb3c('0x32'),'message':_0x491cb0});}})[_0xbb3c('0x21')](function(_0x1fb8c3){logger[_0xbb3c('0x1f')](_0xbb3c('0x1e'),_0xbb3c('0x33'),_0x1fb8c3);});};}function afterCreateOfflineMessage(_0x38c30f){return function(_0x50eb3d){_0x50eb3d=_0x50eb3d[_0xbb3c('0x34')]({'plain':!![]});_0x50eb3d[_0xbb3c('0x22')]=_0x38c30f;_0x50eb3d[_0xbb3c('0x23')]=_0x38c30f;_0x50eb3d[_0xbb3c('0x35')]=_0xbb3c('0x36');return request({'event':_0x50eb3d[_0xbb3c('0x35')],'message':_0x50eb3d});};}function afterCreate(_0x24e5c7,_0x5b9f96){return function(_0x215c1a){_0x215c1a=_0x215c1a[_0xbb3c('0x34')]({'plain':!![]});_0x215c1a['channel']=_0x24e5c7;_0x215c1a[_0xbb3c('0x23')]=_0x24e5c7;_0x215c1a[_0xbb3c('0x35')]=_0xbb3c('0x37');Promise['resolve']()['then'](function(){var _0x11d7b7=_0xbb3c('0x26')+_0x215c1a[_0xbb3c('0x25')];return db['sequelize']['query'](_0x11d7b7,{'type':db['Sequelize'][_0xbb3c('0x38')][_0xbb3c('0x2a')],'raw':!![]});})[_0xbb3c('0x1c')](function(_0x542f87){if(_0x542f87){_0x215c1a[_0xbb3c('0x2b')]=_0x542f87[0x0];}if(typeof _0x215c1a['UserId']==='undefined')return;return getAgent(_0x215c1a[_0xbb3c('0x2c')]);})[_0xbb3c('0x1c')](function(_0x199c57){if(_0x199c57){_0x215c1a['interface']=util['format'](_0xbb3c('0x39'),_0x199c57[_0xbb3c('0x3a')]);_0x215c1a[_0xbb3c('0x30')]=_0x199c57;}return request({'event':_0x5b9f96,'message':_0x215c1a});})[_0xbb3c('0x21')](function(_0x51b66a){logger['error'](_0xbb3c('0x1e'),'AfterCreate',_0x51b66a);});};}function afterUpdate(_0x18edbf){return function(_0x5b7e79){var _0x5e48b5=_0x5b7e79[_0xbb3c('0x3b')](_0xbb3c('0x3c'))&&_0x5b7e79['closed'];var _0x3c20a3=_0x5b7e79[_0xbb3c('0x3b')]('substatus');if(_0x5e48b5||_0x3c20a3){var _0x556c12=_0x5e48b5?'closedinteraction':_0xbb3c('0x3d');var _0x17bb54=_0x5b7e79[_0xbb3c('0x34')]({'plain':!![]});_0x17bb54[_0xbb3c('0x22')]=_0x18edbf;_0x17bb54['motionChannel']=_0x18edbf;_0x17bb54[_0xbb3c('0x35')]=_0x5e48b5?_0xbb3c('0x3c'):_0xbb3c('0x3d');var _0x2f4b05=_0xbb3c('0x26')+_0x17bb54[_0xbb3c('0x25')];return db[_0xbb3c('0x27')][_0xbb3c('0x28')](_0x2f4b05,{'type':db['Sequelize'][_0xbb3c('0x38')]['SELECT'],'raw':!![]})['then'](function(_0x227cd7){if(_0x227cd7){_0x17bb54[_0xbb3c('0x2b')]=_0x227cd7[0x0];}if(typeof _0x17bb54[_0xbb3c('0x2c')]===_0xbb3c('0x2d'))return;return getAgent(_0x17bb54[_0xbb3c('0x2c')]);})[_0xbb3c('0x1c')](function(_0x1895f3){if(_0x1895f3){_0x17bb54[_0xbb3c('0x2e')]=util[_0xbb3c('0x2f')](_0xbb3c('0x39'),_0x1895f3['name']);_0x17bb54['agent']=_0x1895f3;}return request({'event':_0x556c12,'message':_0x17bb54});})[_0xbb3c('0x21')](function(_0x5ae0de){logger[_0xbb3c('0x1f')](_0xbb3c('0x1e'),'AfterUpdate',_0x5ae0de);});}};}function getAgent(_0x2f6362){return db[_0xbb3c('0x3e')][_0xbb3c('0x3f')]({'where':{'id':_0x2f6362},'attributes':['id',_0xbb3c('0x3a'),_0xbb3c('0x40'),_0xbb3c('0x41'),'internal'],'raw':!![]})[_0xbb3c('0x1c')](function(_0x31df85){return _0x31df85;});}exports[_0xbb3c('0x42')]=function(){for(var _0x537d1d=0x0;_0x537d1d=_0x2c4a25[_0x779d('0x11')]){throw Error(_0x779d('0x12'));}_0x5c981a(_0x2f8745);})[_0x779d('0x13')](function(_0x4e0edf){_0x2b8235(_0x4e0edf);});});}; \ No newline at end of file +var _0xb944=['whatsapp','isValidChannel','toLowerCase','includes','clearBlockUser','isUndefined','updateAttributes','getLicense','role','User','count','then','agents','lodash','./license/util','voice','mail','chat','fax','sms'];(function(_0x333800,_0x4b804f){var _0x378ac8=function(_0x538d15){while(--_0x538d15){_0x333800['push'](_0x333800['shift']());}};_0x378ac8(++_0x4b804f);}(_0xb944,0x139));var _0x4b94=function(_0x3e797d,_0x2bdf38){_0x3e797d=_0x3e797d-0x0;var _0x4f24dd=_0xb944[_0x3e797d];return _0x4f24dd;};'use strict';var _=require(_0x4b94('0x0'));var BPromise=require('bluebird');var db=require('../mysqldb')['db'];var util=require(_0x4b94('0x1'));var channels=[_0x4b94('0x2'),_0x4b94('0x3'),_0x4b94('0x4'),_0x4b94('0x5'),_0x4b94('0x6'),_0x4b94('0x7'),'openchannel'];exports['getChannels']=function(){return channels;};exports[_0x4b94('0x8')]=function(_0x1eadaf){_0x1eadaf=_0x1eadaf[_0x4b94('0x9')]();return _[_0x4b94('0xa')](channels,_0x1eadaf);};exports[_0x4b94('0xb')]=function(_0x3b6af0,_0x3ad5b0,_0x89a6e2,_0x3fe648){var _0x29f624={'loginAttempts':_0x3ad5b0,'blocked':_0x89a6e2};if(!_[_0x4b94('0xc')](_0x3fe648)){_0x29f624['blockedAt']=_0x3fe648;}return _0x3b6af0[_0x4b94('0xd')](_0x29f624);};exports[_0x4b94('0xe')]=function(_0x59969a){return new BPromise(function(_0x4b6c64,_0x1aa19b){var _0x5f1014=0x0;if(_0x59969a[_0x4b94('0xf')]!=='agent'){_0x4b6c64(_0x59969a);}db[_0x4b94('0x10')][_0x4b94('0x11')]({'where':{'role':'agent','online':!![],'id':{'$ne':_0x59969a['id']}}})[_0x4b94('0x12')](function(_0x4fcfd2){_0x5f1014=_0x4fcfd2;return util['getLicense']();})[_0x4b94('0x12')](function(_0x1cd598){if(_0x1cd598&&_0x1cd598['agents']&&_0x5f1014>=_0x1cd598[_0x4b94('0x13')]){throw Error('Maximum\x20login\x20has\x20been\x20reached');}_0x4b6c64(_0x59969a);})['catch'](function(_0x4cd55d){_0x1aa19b(_0x4cd55d);});});}; \ No newline at end of file diff --git a/server/errors/api.js b/server/errors/api.js index 223016b..3233657 100644 --- a/server/errors/api.js +++ b/server/errors/api.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc4aa=['stack','statusMessage','status','exports','util','../config/logger','api','message','inherits','Bad\x20Request','name','Not\x20Found','Message\x20sent\x20outside\x20a\x20valid\x20interval','Out\x20Of\x20Interval','error'];(function(_0x4c42b5,_0x1f219a){var _0x5b5cec=function(_0x439b60){while(--_0x439b60){_0x4c42b5['push'](_0x4c42b5['shift']());}};_0x5b5cec(++_0x1f219a);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x422905,_0x3bce3a){_0x422905=_0x422905-0x0;var _0x33dc6c=_0xc4aa[_0x422905];return _0x33dc6c;};'use strict';var util=require(_0xac4a('0x0'));var logger=require(_0xac4a('0x1'))(_0xac4a('0x2'));var APIError=function(_0x351dd5,_0x275161){this[_0xac4a('0x3')]=_0x351dd5||'Internal\x20Server\x20Error';this['name']=_0x275161||'Error';util[_0xac4a('0x4')](APIError,Error);};var APIBadRequestError=function(_0x15b967){this[_0xac4a('0x3')]=_0x15b967||_0xac4a('0x5');this[_0xac4a('0x6')]=_0xac4a('0x5');util[_0xac4a('0x4')](APIBadRequestError,APIError);};var APINotFoundError=function(_0x10525b){this['message']=_0x10525b||'Entity\x20not\x20found';this[_0xac4a('0x6')]=_0xac4a('0x7');util[_0xac4a('0x4')](APINotFoundError,APIError);};var APIOutOfIntervalError=function(_0x4f4146){this[_0xac4a('0x3')]=_0x4f4146||_0xac4a('0x8');this[_0xac4a('0x6')]='Out\x20Of\x20Interval';util[_0xac4a('0x4')](APIOutOfIntervalError,APIError);};function getStatusCode(_0x488e3c){switch(_0x488e3c){case _0xac4a('0x5'):return 0x190;case'Forbidden',_0xac4a('0x9'):return 0x193;case _0xac4a('0x7'):return 0x194;default:return 0x1f4;}}function getCustomStatusMessage(_0x24291d){if(_0x24291d==='Out\x20Of\x20Interval')return _0x24291d;return null;}function handleError(_0x21a79){return function(_0x68424a){logger[_0xac4a('0xa')](_0x68424a[_0xac4a('0xb')]);var _0x1b4313=getStatusCode(_0x68424a[_0xac4a('0x6')]);var _0x34bc01=getCustomStatusMessage(_0x68424a[_0xac4a('0x6')]);if(_0x68424a[_0xac4a('0x6')])delete _0x68424a[_0xac4a('0x6')];if(_0x34bc01)_0x21a79[_0xac4a('0xc')]=_0x34bc01;return _0x21a79[_0xac4a('0xd')](_0x1b4313)['send'](_0x68424a);};}module[_0xac4a('0xe')]={'APIError':APIError,'APIBadRequestError':APIBadRequestError,'APIOutOfIntervalError':APIOutOfIntervalError,'APINotFoundError':APINotFoundError,'handleError':handleError}; \ No newline at end of file +var _0x7a54=['Bad\x20Request','Forbidden','Out\x20Of\x20Interval','Not\x20Found','error','stack','statusMessage','status','send','exports','util','../config/logger','api','message','name','Error','inherits','Entity\x20not\x20found'];(function(_0x364831,_0xafd989){var _0x1b3f9e=function(_0x11c3ed){while(--_0x11c3ed){_0x364831['push'](_0x364831['shift']());}};_0x1b3f9e(++_0xafd989);}(_0x7a54,0x106));var _0x47a5=function(_0x5a8d85,_0x5787ff){_0x5a8d85=_0x5a8d85-0x0;var _0x1cab8a=_0x7a54[_0x5a8d85];return _0x1cab8a;};'use strict';var util=require(_0x47a5('0x0'));var logger=require(_0x47a5('0x1'))(_0x47a5('0x2'));var APIError=function(_0x58157c,_0x1d33e){this[_0x47a5('0x3')]=_0x58157c||'Internal\x20Server\x20Error';this[_0x47a5('0x4')]=_0x1d33e||_0x47a5('0x5');util[_0x47a5('0x6')](APIError,Error);};var APIBadRequestError=function(_0x3717e1){this[_0x47a5('0x3')]=_0x3717e1||'Bad\x20Request';this[_0x47a5('0x4')]='Bad\x20Request';util[_0x47a5('0x6')](APIBadRequestError,APIError);};var APINotFoundError=function(_0x30e405){this['message']=_0x30e405||_0x47a5('0x7');this['name']='Not\x20Found';util['inherits'](APINotFoundError,APIError);};var APIOutOfIntervalError=function(_0x2a0e98){this[_0x47a5('0x3')]=_0x2a0e98||'Message\x20sent\x20outside\x20a\x20valid\x20interval';this[_0x47a5('0x4')]='Out\x20Of\x20Interval';util['inherits'](APIOutOfIntervalError,APIError);};function getStatusCode(_0x1f47f4){switch(_0x1f47f4){case _0x47a5('0x8'):return 0x190;case _0x47a5('0x9'),_0x47a5('0xa'):return 0x193;case _0x47a5('0xb'):return 0x194;default:return 0x1f4;}}function getCustomStatusMessage(_0xd308b8){if(_0xd308b8===_0x47a5('0xa'))return _0xd308b8;return null;}function handleError(_0x5beb89){return function(_0x44bd3e){logger[_0x47a5('0xc')](_0x44bd3e[_0x47a5('0xd')]);var _0x711793=getStatusCode(_0x44bd3e[_0x47a5('0x4')]);var _0x620ee9=getCustomStatusMessage(_0x44bd3e[_0x47a5('0x4')]);if(_0x44bd3e[_0x47a5('0x4')])delete _0x44bd3e['name'];if(_0x620ee9)_0x5beb89[_0x47a5('0xe')]=_0x620ee9;return _0x5beb89[_0x47a5('0xf')](_0x711793)[_0x47a5('0x10')](_0x44bd3e);};}module[_0x47a5('0x11')]={'APIError':APIError,'APIBadRequestError':APIBadRequestError,'APIOutOfIntervalError':APIOutOfIntervalError,'APINotFoundError':APINotFoundError,'handleError':handleError}; \ No newline at end of file diff --git a/server/errors/index.js b/server/errors/index.js index 791dbd5..6c47162 100644 --- a/server/errors/index.js +++ b/server/errors/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1d3d=['exports','404','status','render','send'];(function(_0xecfc6,_0x4e3394){var _0x59f6b3=function(_0x2f6463){while(--_0x2f6463){_0xecfc6['push'](_0xecfc6['shift']());}};_0x59f6b3(++_0x4e3394);}(_0x1d3d,0x13b));var _0xd1d3=function(_0xa7ab86,_0x33a3b3){_0xa7ab86=_0xa7ab86-0x0;var _0x263679=_0x1d3d[_0xa7ab86];return _0x263679;};'use strict';module[_0xd1d3('0x0')][0x194]=function pageNotFound(_0x37c3ec,_0x1b4fb1){var _0x4db048=_0xd1d3('0x1');var _0x2da771=0x194;var _0x180080={'status':_0x2da771};_0x1b4fb1[_0xd1d3('0x2')](_0x180080[_0xd1d3('0x2')]);_0x1b4fb1[_0xd1d3('0x3')](_0x4db048,{},function(_0x176991,_0x3e8b8b){if(_0x176991){return _0x1b4fb1['status'](_0x180080[_0xd1d3('0x2')])['json'](_0x180080);}_0x1b4fb1[_0xd1d3('0x4')](_0x3e8b8b);});}; \ No newline at end of file +var _0x8166=['json','exports','status'];(function(_0x420ae4,_0x2f5b21){var _0x53b3bf=function(_0x2718cf){while(--_0x2718cf){_0x420ae4['push'](_0x420ae4['shift']());}};_0x53b3bf(++_0x2f5b21);}(_0x8166,0x100));var _0x6816=function(_0x119280,_0x439c3e){_0x119280=_0x119280-0x0;var _0x481797=_0x8166[_0x119280];return _0x481797;};'use strict';module[_0x6816('0x0')][0x194]=function pageNotFound(_0x4cbe91,_0x1a09c8){var _0x2ee5bd='404';var _0x1461e6=0x194;var _0x3b45d2={'status':_0x1461e6};_0x1a09c8[_0x6816('0x1')](_0x3b45d2[_0x6816('0x1')]);_0x1a09c8['render'](_0x2ee5bd,{},function(_0xf648f0,_0xf65343){if(_0xf648f0){return _0x1a09c8[_0x6816('0x1')](_0x3b45d2[_0x6816('0x1')])[_0x6816('0x2')](_0x3b45d2);}_0x1a09c8['send'](_0xf65343);});}; \ No newline at end of file diff --git a/server/mysqldb/index.js b/server/mysqldb/index.js index ee99571..0c3f3a3 100644 --- a/server/mysqldb/index.js +++ b/server/mysqldb/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['SquareRecording','../api/squareRecording/squareRecording.model','SquareMessage','../api/squareMessage/squareMessage.model','License','Migration','../api/migration/migration.model','Attachment','../api/attachment/attachment.model','Plugin','../api/plugin/plugin.model','ChatTransferReport','../api/chatTransferReport/chatTransferReport.model','FaxTransferReport','../api/faxTransferReport/faxTransferReport.model','OpenchannelTransferReport','../api/openchannelTransferReport/openchannelTransferReport.model','SmsTransferReport','../api/smsTransferReport/smsTransferReport.model','../api/cmList/cmList.model','VoicePrefix','UserProfile','UserProfileSection','UserProfileResource','UserNotification','../api/userNotification/userNotification.model','WhatsappAccount','../api/whatsappAccount/whatsappAccount.model','WhatsappApplication','../api/whatsappApplication/whatsappApplication.model','WhatsappInteraction','../api/whatsappInteraction/whatsappInteraction.model','WhatsappMessage','WhatsappQueueReport','../api/whatsappQueueReport/whatsappQueueReport.model','../api/whatsappTransferReport/whatsappTransferReport.model','WhatsappQueue','../api/whatsappQueue/whatsappQueue.model','CloudProvider','../api/cloudProvider/cloudProvider.model','TeamVoiceQueue','../api/teamVoiceQueue/teamVoiceQueue.model','TeamVoicePrefix','../api/teamVoicePrefix/teamVoicePrefix.model','UserVoicePrefix','../api/userVoicePrefix/userVoicePrefix.model','hasOne','VoiceMail','userSetting','cascade','UserId','hasMany','VoiceRecording','Recordings','VoiceQueuesRt','Extensions','HopperFinals','CmHopperHistory','HopperHistory','OpenchannelInteractions','ChatInteractions','SmsInteractions','FaxInteraction','MailInteraction','MailInteractions','WhatsappInteractions','UserNotifications','SenderId','belongsToMany','Groups','chat_group_has_users','CmContact','Contacts','cm_user_has_contacts','Lists','cm_user_has_lists','Team','user_has_teams','user_has_mail_interactions','FaxInteractions','user_has_fax_interactions','user_has_sms_interactions','user_has_openchannel_interactions','user_has_whatsapp_interactions','VoiceQueues','VoicePrefixes','ChatQueues','UserChatQueue','FaxQueues','SmsQueues','OpenchannelQueue','WhatsappQueues','CmList','ChatWebsites','user_has_chat_websites','user_has_fax_accounts','MailAccounts','user_has_mail_accounts','OpenchannelAccounts','user_has_openchannel_accounts','SmsAccounts','user_has_sms_accounts','WhatsappAccounts','user_has_whatsapp_accounts','ChanSpyId','VoiceContext','Applications','Sounds','moh_has_sounds','Members','VoiceQueueId','Hoppers','HopperBlacks','JscriptySessions','TrunkId','belongsTo','TrunkBackup','TrunkBackupId','IntervalId','mandatoryDispositionPauseId','Teams','BlackLists','voice_queues_has_cm_blacklists','Messages','mailbox','mailboxuser','VoiceCallReport','QueueCalls','uniqueid','VoiceAgentReport','AgentReports','Contact','MailAccountId','CloudProviderId','MailServerOut','restrict','Imap','Smtp','Disposition','Dispositions','Answers','Interactions','MailApplication','List','ListId','TemplateId','mandatoryDispositionPause','Agents','team_has_mail_queues','ContactId','mail_interaction_has_tags','Tags','ThroughTags','Users','MailInteractionId','Attachments','Interaction','ChatWebsiteId','Interval','MailQueueReport','Dashboard','CannedAnswer','FaxAccountId','Exntensions','TagId','FaxInteractionId','Account','Owner','fax_interaction_has_tags','AttachmentId','team_has_fax_queues','SmsAccountId','SmsInteractionId','sms_interaction_has_tags','SmsQueueId','team_has_sms_queues','OpenchannelAccountId','OpenchannelQueueId','OpenchannelInteractionId','team_has_openchannel_queues','ChatProactiveAction','ProactiveActions','Agent','Queue','ChatQueueId','Website','ChatInteractionId','chat_interaction_has_tags','user_has_chat_interactions','ChatOfflineMessageId','team_has_chat_queues','ChatGroupId','CmContactId','HopperHistories','CmCompany','Company','cm_contact_has_tags','CmHopperAdditionalPhone','AdditionalPhones','CmHopperId','Campaign','OwnerId','CampaignId','All','OneAll','OneAny','Actions','ParentId','Intervals','MailApplications','ChatApplications','FaxApplications','SmsApplications','DefaultReportId','CustomReportId','openchannel_interaction_has_tags','whatsapp_interaction_has_tags','CmContactHasItem','ItemType','ItemTypeId','Hopper','AllConditions','AllCondition','TriggerAllId','AnyConditions','AnyCondition','TriggerAnyId','AnalyticCustomReport','Fields','MetricId','Configurations','Subjects','DescriptionId','FieldId','AccountId','Subject','SubjectId','Description','Field','SugarcrmField','Descriptions','VariableId','DeskAccount','ZendeskConfiguration','int_zendesk_configuration_has_tags','FreshdeskAccount','FreshdeskConfiguration','int_freshdesk_configuration_has_tags','VtigerAccount','ServicenowField','ToId','JscriptyQuestionReport','JscriptyProject','ProjectId','MailQueues','OpenchannelQueues','team_has_whatsapp_queues','SquareProjectId','campaigns_has_cm_lists','campaigns_has_cm_blacklists','MailTransferReport','FromMailAccountId','FromAccount','FromAgent','ToUserId','ToAgent','ToMailAccountId','ToAccount','FromChatWebsiteId','FromUserId','ToChatQueueId','ToChatWebsiteId','FromFaxAccountId','ToFaxQueueId','ToQueue','FromSmsAccountId','CmCustomField','CustomFields','voice_queues_has_cm_lists','userProfileId','UserProfileSections','Resources','sectionId','WhatsappAccountId','WhatsappInteractionId','WhatsappTransferReport','FromWhatsappAccountId','ToWhatsappAccountId','ToQueueId','UserSetting','user','../config/environment','sequelize','lodash','motion2','xcall','xC@LL1234','127.0.0.1','utf8mb4','name','utf8','defaultsDeep','mysql','username','password','options','database','sequelizeHistory','User','import','VoiceChanSpy','../api/voiceChanSpy/voiceChanSpy.model','../api/voiceContext/voiceContext.model','VoiceExtension','../api/voiceExtension/voiceExtension.model','VoiceMusicOnHold','../api/voiceMusicOnHold/voiceMusicOnHold.model','VoiceQueue','../api/voiceQueue/voiceQueue.model','ScreenRecording','../api/screenRecording/screenRecording.model','../api/voiceMail/voiceMail.model','VoiceMailMessage','../api/voiceMailMessage/voiceMailMessage.model','../api/voiceCallReport/voiceCallReport.model','VoiceDialReport','../api/voiceDialReport/voiceDialReport.model','../api/voiceAgentReport/voiceAgentReport.model','VoiceQueueReport','../api/voiceQueueReport/voiceQueueReport.model','MemberReport','Trunk','../api/trunk/trunk.model','../api/voiceTransferReport/voiceTransferReport.model','UserVoiceQueueRt','../api/userVoiceQueueRt/userVoiceQueueRt.model','UserVoiceQueue','../api/userVoiceQueue/userVoiceQueue.model','../api/userChatQueue/userChatQueue.model','UserMailQueue','../api/userMailQueue/userMailQueue.model','UserFaxQueue','../api/userFaxQueue/userFaxQueue.model','UserSmsQueue','UserOpenchannelQueue','../api/userOpenchannelQueue/userOpenchannelQueue.model','UserWhatsappQueue','../api/userWhatsappQueue/userWhatsappQueue.model','MailServerIn','../api/mailServerOut/mailServerOut.model','MailAccount','MailQueue','MailSubstatus','MailMessage','../api/mailMessage/mailMessage.model','../api/mailApplication/mailApplication.model','../api/mailQueueReport/mailQueueReport.model','../api/dashboard/dashboard.model','DashboardItem','../api/dashboardItem/dashboardItem.model','FaxAccount','../api/faxAccount/faxAccount.model','FaxApplication','../api/faxApplication/faxApplication.model','../api/faxInteraction/faxInteraction.model','FaxMessage','../api/faxMessage/faxMessage.model','FaxQueue','../api/faxQueue/faxQueue.model','FaxQueueReport','../api/faxQueueReport/faxQueueReport.model','SmsAccount','../api/smsAccount/smsAccount.model','SmsApplication','SmsInteraction','../api/smsInteraction/smsInteraction.model','SmsMessage','../api/smsMessage/smsMessage.model','SmsQueue','../api/smsQueue/smsQueue.model','OpenchannelAccount','../api/openchannelAccount/openchannelAccount.model','OpenchannelApplication','../api/openchannelApplication/openchannelApplication.model','OpenchannelInteraction','OpenchannelMessage','../api/openchannelQueue/openchannelQueue.model','ChatWebsite','../api/chatWebsite/chatWebsite.model','OpenchannelQueueReport','ChatApplication','ChatInteraction','ChatMessage','ChatOfflineMessage','ChatQueue','ChatGroup','../api/chatGroup/chatGroup.model','../api/chatProactiveAction/chatProactiveAction.model','../api/cmCompany/cmCompany.model','../api/cmContact/cmContact.model','CmHopper','../api/cmHopper/cmHopper.model','CmHopperBlack','../api/cmHopperBlack/cmHopperBlack.model','CmHopperFinal','../api/cmHopperFinal/cmHopperFinal.model','ReportAgentPreview','Action','../api/action/action.model','Automation','../api/automation/automation.model','../api/cannedAnswer/cannedAnswer.model','../api/disposition/disposition.model','Condition','../api/condition/condition.model','../api/interval/interval.model','Pause','../api/pause/pause.model','Cdr','../api/cdr/cdr.model','../api/voiceQueuesLog/voiceQueuesLog.model','Schedule','../api/schedule/schedule.model','Sound','../api/sound/sound.model','Tag','../api/tag/tag.model','ContactItemType','../api/contactItemType/contactItemType.model','../api/cmContactHasItem/cmContactHasItem.model','Template','../api/template/template.model','Trigger','Variable','../api/variable/variable.model','Integration','../api/integration/integration.model','../api/integrationReport/integrationReport.model','../api/analyticCustomReport/analyticCustomReport.model','AnalyticDefaultReport','../api/analyticDefaultReport/analyticDefaultReport.model','AnalyticExtractedReport','../api/analyticExtractedReport/analyticExtractedReport.model','AnalyticMetric','AnalyticFieldReport','../api/analyticFieldReport/analyticFieldReport.model','../api/analyticTreeReport/analyticTreeReport.model','SalesforceAccount','../api/intSalesforceAccount/intSalesforceAccount.model','SalesforceConfiguration','../api/intSalesforceConfiguration/intSalesforceConfiguration.model','SalesforceField','SugarcrmAccount','SugarcrmConfiguration','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','../api/intSugarcrmField/intSugarcrmField.model','../api/intDeskAccount/intDeskAccount.model','DeskConfiguration','../api/intDeskConfiguration/intDeskConfiguration.model','DeskField','../api/intDeskField/intDeskField.model','ZohoAccount','../api/intZohoAccount/intZohoAccount.model','ZohoConfiguration','../api/intZohoConfiguration/intZohoConfiguration.model','ZohoField','ZendeskAccount','../api/intZendeskAccount/intZendeskAccount.model','../api/intZendeskConfiguration/intZendeskConfiguration.model','ZendeskField','../api/intZendeskField/intZendeskField.model','../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model','FreshdeskField','../api/intFreshdeskField/intFreshdeskField.model','../api/intVtigerAccount/intVtigerAccount.model','VtigerConfiguration','VtigerField','ServicenowAccount','../api/intServicenowAccount/intServicenowAccount.model','ServicenowConfiguration','../api/intServicenowConfiguration/intServicenowConfiguration.model','Dynamics365Account','Dynamics365Configuration','../api/intDynamics365Configuration/intDynamics365Configuration.model','Dynamics365Field','../api/intDynamics365Field/intDynamics365Field.model','FreshsalesAccount','../api/intFreshsalesAccount/intFreshsalesAccount.model','FreshsalesConfiguration','../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model','FreshsalesField','../api/intFreshsalesField/intFreshsalesField.model','../api/network/network.model','ChatQueueReport','../api/chatQueueReport/chatQueueReport.model','ChatInternalMessage','JscriptyAnswerReport','../api/jscriptyAnswerReport/jscriptyAnswerReport.model','../api/jscriptyQuestionReport/jscriptyQuestionReport.model','JscriptySessionReport','../api/jscriptySessionReport/jscriptySessionReport.model','SmsQueueReport','../api/smsQueueReport/smsQueueReport.model','SquareReport','../api/squareReport/squareReport.model','SquareDetailsReport','../api/squareReportDetail/squareReportDetail.model','../api/jscriptyProject/jscriptyProject.model','Setting','../api/setting/setting.model','../api/squareOdbc/squareOdbc.model','SquareProject'];(function(_0x3b0731,_0xcf9925){var _0x4204d7=function(_0x635ac5){while(--_0x635ac5){_0x3b0731['push'](_0x3b0731['shift']());}};_0x4204d7(++_0xcf9925);}(_0xa9e0,0x123));var _0x0a9e=function(_0x37c22c,_0x28a70d){_0x37c22c=_0x37c22c-0x0;var _0x119d79=_0xa9e0[_0x37c22c];return _0x119d79;};'use strict';var config=require(_0x0a9e('0x0'));var Sequelize=require(_0x0a9e('0x1'));var _=require(_0x0a9e('0x2'));var jstz=require('jstz');var timezone=jstz['determine']();config[_0x0a9e('0x1')]=_['defaultsDeep'](config[_0x0a9e('0x1')],{'database':_0x0a9e('0x3'),'username':_0x0a9e('0x4'),'password':_0x0a9e('0x5'),'options':{'host':_0x0a9e('0x6'),'port':0xcea,'dialect':'mysql','dialectOptions':{'charset':_0x0a9e('0x7')},'logging':![],'timezone':timezone[_0x0a9e('0x8')](),'define':{'charset':_0x0a9e('0x9'),'collate':'utf8_general_ci'}}});config['sequelizeHistory']=_[_0x0a9e('0xa')](config['sequelizeHistory'],{'database':'motion2','username':_0x0a9e('0x4'),'password':_0x0a9e('0x5'),'options':{'host':_0x0a9e('0x6'),'port':0xcea,'dialect':_0x0a9e('0xb'),'dialectOptions':{'charset':_0x0a9e('0x7')},'logging':![],'timezone':timezone[_0x0a9e('0x8')](),'define':{'charset':'utf8','collate':'utf8_general_ci'}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config['sequelize']['database'],config[_0x0a9e('0x1')][_0x0a9e('0xc')],config[_0x0a9e('0x1')][_0x0a9e('0xd')],config[_0x0a9e('0x1')][_0x0a9e('0xe')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config['sequelizeHistory'][_0x0a9e('0xf')],config[_0x0a9e('0x10')][_0x0a9e('0xc')],config[_0x0a9e('0x10')][_0x0a9e('0xd')],config[_0x0a9e('0x10')]['options'])};db[_0x0a9e('0x11')]=db['sequelize'][_0x0a9e('0x12')]('../api/user/user.model');db[_0x0a9e('0x13')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x14'));db['VoiceContext']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x15'));db[_0x0a9e('0x16')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x17'));db[_0x0a9e('0x18')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x19'));db[_0x0a9e('0x1a')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x1b'));db['VoiceRecording']=db[_0x0a9e('0x1')]['import']('../api/voiceRecording/voiceRecording.model');db[_0x0a9e('0x1c')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x1d'));db['VoiceMail']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x1e'));db[_0x0a9e('0x1f')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x20'));db['VoiceCallReport']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x21'));db[_0x0a9e('0x22')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x23'));db['VoiceAgentReport']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x24'));db[_0x0a9e('0x25')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x26'));db[_0x0a9e('0x27')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/memberReport/memberReport.model');db[_0x0a9e('0x28')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x29'));db['VoiceTransferReport']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x2a'));db[_0x0a9e('0x2b')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x2c'));db[_0x0a9e('0x2d')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x2e'));db['UserChatQueue']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x2f'));db[_0x0a9e('0x30')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x31'));db[_0x0a9e('0x32')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x33'));db[_0x0a9e('0x34')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/userSmsQueue/userSmsQueue.model');db[_0x0a9e('0x35')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x36'));db[_0x0a9e('0x37')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x38'));db[_0x0a9e('0x39')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/mailServerIn/mailServerIn.model');db['MailServerOut']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x3a'));db[_0x0a9e('0x3b')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/mailAccount/mailAccount.model');db[_0x0a9e('0x3c')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/mailQueue/mailQueue.model');db[_0x0a9e('0x3d')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/mailSubstatus/mailSubstatus.model');db['MailInteraction']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/mailInteraction/mailInteraction.model');db[_0x0a9e('0x3e')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x3f'));db['MailApplication']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x40'));db['MailQueueReport']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x41'));db['Dashboard']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x42'));db[_0x0a9e('0x43')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x44'));db[_0x0a9e('0x45')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x46'));db[_0x0a9e('0x47')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x48'));db['FaxInteraction']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x49'));db[_0x0a9e('0x4a')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x4b'));db[_0x0a9e('0x4c')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x4d'));db[_0x0a9e('0x4e')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x4f'));db[_0x0a9e('0x50')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x51'));db[_0x0a9e('0x52')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/smsApplication/smsApplication.model');db[_0x0a9e('0x53')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x54'));db[_0x0a9e('0x55')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x56'));db[_0x0a9e('0x57')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x58'));db[_0x0a9e('0x59')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x5a'));db[_0x0a9e('0x5b')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x5c'));db[_0x0a9e('0x5d')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/openchannelInteraction/openchannelInteraction.model');db[_0x0a9e('0x5e')]=db[_0x0a9e('0x1')]['import']('../api/openchannelMessage/openchannelMessage.model');db['OpenchannelQueue']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x5f'));db[_0x0a9e('0x60')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x61'));db[_0x0a9e('0x62')]=db['sequelize']['import']('../api/openchannelQueueReport/openchannelQueueReport.model');db[_0x0a9e('0x63')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/chatApplication/chatApplication.model');db[_0x0a9e('0x64')]=db[_0x0a9e('0x1')]['import']('../api/chatInteraction/chatInteraction.model');db[_0x0a9e('0x65')]=db['sequelize'][_0x0a9e('0x12')]('../api/chatMessage/chatMessage.model');db[_0x0a9e('0x66')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/chatOfflineMessage/chatOfflineMessage.model');db[_0x0a9e('0x67')]=db[_0x0a9e('0x1')]['import']('../api/chatQueue/chatQueue.model');db[_0x0a9e('0x68')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x69'));db['ChatProactiveAction']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x6a'));db['CmCompany']=db['sequelize']['import'](_0x0a9e('0x6b'));db['CmContact']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x6c'));db[_0x0a9e('0x6d')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x6e'));db[_0x0a9e('0x6f')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x70'));db[_0x0a9e('0x71')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x72'));db['CmHopperHistory']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/cmHopperHistory/cmHopperHistory.model');db[_0x0a9e('0x73')]=db['sequelize'][_0x0a9e('0x12')]('../api/reportAgentPreview/reportAgentPreview.model');db['CmCustomField']=db['sequelize'][_0x0a9e('0x12')]('../api/cmCustomField/cmCustomField.model');db[_0x0a9e('0x74')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x75'));db[_0x0a9e('0x76')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x77'));db['CannedAnswer']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x78'));db['Disposition']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x79'));db[_0x0a9e('0x7a')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x7b'));db['Interval']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x7c'));db[_0x0a9e('0x7d')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x7e'));db[_0x0a9e('0x7f')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x80'));db['VoiceQueuesLog']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x81'));db[_0x0a9e('0x82')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x83'));db[_0x0a9e('0x84')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x85'));db[_0x0a9e('0x86')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x87'));db[_0x0a9e('0x88')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x89'));db['CmContactHasItem']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x8a'));db['CmHopperAdditionalPhone']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model');db[_0x0a9e('0x8b')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x8c'));db[_0x0a9e('0x8d')]=db['sequelize']['import']('../api/trigger/trigger.model');db[_0x0a9e('0x8e')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x8f'));db[_0x0a9e('0x90')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x91'));db['IntegrationReport']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x92'));db['AnalyticCustomReport']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x93'));db[_0x0a9e('0x94')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x95'));db[_0x0a9e('0x96')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x97'));db[_0x0a9e('0x98')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/analyticMetric/analyticMetric.model');db[_0x0a9e('0x99')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x9a'));db['AnalyticTreeReport']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x9b'));db[_0x0a9e('0x9c')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x9d'));db[_0x0a9e('0x9e')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x9f'));db[_0x0a9e('0xa0')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/intSalesforceField/intSalesforceField.model');db[_0x0a9e('0xa1')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/intSugarcrmAccount/intSugarcrmAccount.model');db[_0x0a9e('0xa2')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xa3'));db['SugarcrmField']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xa4'));db['DeskAccount']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xa5'));db[_0x0a9e('0xa6')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xa7'));db[_0x0a9e('0xa8')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xa9'));db[_0x0a9e('0xaa')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xab'));db[_0x0a9e('0xac')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xad'));db[_0x0a9e('0xae')]=db['sequelize'][_0x0a9e('0x12')]('../api/intZohoField/intZohoField.model');db[_0x0a9e('0xaf')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xb0'));db['ZendeskConfiguration']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xb1'));db[_0x0a9e('0xb2')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xb3'));db['FreshdeskAccount']=db['sequelize'][_0x0a9e('0x12')]('../api/intFreshdeskAccount/intFreshdeskAccount.model');db['FreshdeskConfiguration']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xb4'));db[_0x0a9e('0xb5')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xb6'));db['VtigerAccount']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xb7'));db[_0x0a9e('0xb8')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/intVtigerConfiguration/intVtigerConfiguration.model');db[_0x0a9e('0xb9')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/intVtigerField/intVtigerField.model');db[_0x0a9e('0xba')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xbb'));db[_0x0a9e('0xbc')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xbd'));db['ServicenowField']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/intServicenowField/intServicenowField.model');db[_0x0a9e('0xbe')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/intDynamics365Account/intDynamics365Account.model');db[_0x0a9e('0xbf')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xc0'));db[_0x0a9e('0xc1')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xc2'));db[_0x0a9e('0xc3')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xc4'));db[_0x0a9e('0xc5')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xc6'));db[_0x0a9e('0xc7')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xc8'));db[_0x0a9e('0x90')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x91'));db['Network']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xc9'));db[_0x0a9e('0xca')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xcb'));db[_0x0a9e('0xcc')]=db['sequelize'][_0x0a9e('0x12')]('../api/chatInternalMessage/chatInternalMessage.model');db[_0x0a9e('0xcd')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xce'));db['JscriptyQuestionReport']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xcf'));db[_0x0a9e('0xd0')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xd1'));db[_0x0a9e('0xd2')]=db['sequelize']['import'](_0x0a9e('0xd3'));db[_0x0a9e('0xd4')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xd5'));db[_0x0a9e('0xd6')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xd7'));db['JscriptyProject']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xd8'));db[_0x0a9e('0xd9')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xda'));db['SquareOdbc']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xdb'));db[_0x0a9e('0xdc')]=db[_0x0a9e('0x1')]['import']('../api/squareProject/squareProject.model');db[_0x0a9e('0xdd')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xde'));db[_0x0a9e('0xdf')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xe0'));db['Team']=db['sequelize'][_0x0a9e('0x12')]('../api/team/team.model');db[_0x0a9e('0xe1')]=db['sequelize'][_0x0a9e('0x12')]('../api/license/license.model');db['Campaign']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/campaign/campaign.model');db[_0x0a9e('0xe2')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xe3'));db[_0x0a9e('0xe4')]=db['sequelize']['import'](_0x0a9e('0xe5'));db[_0x0a9e('0xe6')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xe7'));db['MailTransferReport']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/mailTransferReport/mailTransferReport.model');db[_0x0a9e('0xe8')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xe9'));db[_0x0a9e('0xea')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xeb'));db[_0x0a9e('0xec')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xed'));db[_0x0a9e('0xee')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xef'));db['CmList']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xf0'));db[_0x0a9e('0xf1')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/voicePrefix/voicePrefix.model');db[_0x0a9e('0xf2')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/userProfile/userProfile.model');db[_0x0a9e('0xf3')]=db['sequelize'][_0x0a9e('0x12')]('../api/userProfileSection/userProfileSection.model');db[_0x0a9e('0xf4')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/userProfileResource/userProfileResource.model');db[_0x0a9e('0xf5')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xf6'));db[_0x0a9e('0xf7')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xf8'));db[_0x0a9e('0xf9')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xfa'));db[_0x0a9e('0xfb')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xfc'));db[_0x0a9e('0xfd')]=db[_0x0a9e('0x1')]['import']('../api/whatsappMessage/whatsappMessage.model');db[_0x0a9e('0xfe')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xff'));db['WhatsappTransferReport']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x100'));db[_0x0a9e('0x101')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x102'));db[_0x0a9e('0x103')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x104'));db[_0x0a9e('0x105')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x106'));db[_0x0a9e('0x107')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x108'));db[_0x0a9e('0x109')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x10a'));db['UserSetting']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/user-setting/user-setting.model');db[_0x0a9e('0x11')][_0x0a9e('0x10b')](db[_0x0a9e('0x10c')],{'as':'VoiceMail','onDelete':'cascade','foreignKey':'UserId'});db[_0x0a9e('0x11')][_0x0a9e('0x10b')](db['UserSetting'],{'as':_0x0a9e('0x10d'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x10f')});db['User'][_0x0a9e('0x110')](db[_0x0a9e('0x111')],{'as':_0x0a9e('0x112'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x2b')],{'as':_0x0a9e('0x113'),'foreignKey':_0x0a9e('0x10f')});db['User'][_0x0a9e('0x110')](db['VoiceExtension'],{'as':_0x0a9e('0x114'),'onDelete':_0x0a9e('0x10e'),'hooks':!![]});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x71')],{'as':_0x0a9e('0x115'),'foreignKey':'UserId'});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x116')],{'as':_0x0a9e('0x117'),'foreignKey':'UserId'});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x73')],{'as':_0x0a9e('0x73'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x5d')],{'as':_0x0a9e('0x118'),'foreignKey':_0x0a9e('0x10f')});db['User'][_0x0a9e('0x110')](db[_0x0a9e('0x64')],{'as':_0x0a9e('0x119'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x53')],{'as':_0x0a9e('0x11a'),'foreignKey':'UserId'});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x11b')],{'as':'FaxInteractions','foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x11c')],{'as':_0x0a9e('0x11d'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0xfb')],{'as':_0x0a9e('0x11e'),'foreignKey':'UserId'});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0xf5')],{'as':_0x0a9e('0x11f'),'foreignKey':_0x0a9e('0x120')});db[_0x0a9e('0x11')]['belongsTo'](db[_0x0a9e('0xf2')],{'as':'UserProfile','foreignKey':'userProfileId'});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0x68')],{'as':_0x0a9e('0x122'),'through':_0x0a9e('0x123')});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x125'),'through':_0x0a9e('0x126')});db[_0x0a9e('0x11')]['belongsToMany'](db['CmList'],{'as':_0x0a9e('0x127'),'through':_0x0a9e('0x128')});db[_0x0a9e('0x11')]['belongsToMany'](db[_0x0a9e('0x129')],{'through':_0x0a9e('0x12a')});db[_0x0a9e('0x11')]['belongsToMany'](db[_0x0a9e('0x11c')],{'as':_0x0a9e('0x11d'),'through':_0x0a9e('0x12b')});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0x64')],{'as':_0x0a9e('0x119'),'through':'user_has_chat_interactions'});db['User']['belongsToMany'](db[_0x0a9e('0x11b')],{'as':_0x0a9e('0x12c'),'through':_0x0a9e('0x12d')});db[_0x0a9e('0x11')]['belongsToMany'](db[_0x0a9e('0x53')],{'as':'SmsInteractions','through':_0x0a9e('0x12e')});db[_0x0a9e('0x11')][_0x0a9e('0x121')](db['OpenchannelInteraction'],{'as':_0x0a9e('0x118'),'through':_0x0a9e('0x12f')});db[_0x0a9e('0x11')]['belongsToMany'](db[_0x0a9e('0xfb')],{'as':'WhatsappInteractions','through':_0x0a9e('0x130')});db['User'][_0x0a9e('0x121')](db['VoiceQueue'],{'as':_0x0a9e('0x131'),'through':_0x0a9e('0x2d'),'required':![]});db[_0x0a9e('0x11')][_0x0a9e('0x121')](db[_0x0a9e('0xf1')],{'as':_0x0a9e('0x132'),'through':_0x0a9e('0x109'),'required':![]});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0x3c')],{'as':'MailQueues','through':_0x0a9e('0x30'),'required':![]});db[_0x0a9e('0x11')]['belongsToMany'](db[_0x0a9e('0x67')],{'as':_0x0a9e('0x133'),'through':_0x0a9e('0x134'),'required':![],'hooks':!![]});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0x4c')],{'as':_0x0a9e('0x135'),'through':_0x0a9e('0x32'),'required':![]});db[_0x0a9e('0x11')][_0x0a9e('0x121')](db[_0x0a9e('0x57')],{'as':_0x0a9e('0x136'),'through':_0x0a9e('0x34'),'required':![]});db[_0x0a9e('0x11')]['belongsToMany'](db[_0x0a9e('0x137')],{'as':'OpenchannelQueues','through':_0x0a9e('0x35'),'required':![]});db[_0x0a9e('0x11')][_0x0a9e('0x121')](db[_0x0a9e('0x101')],{'as':_0x0a9e('0x138'),'through':_0x0a9e('0x37'),'required':![]});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0x139')],{'through':_0x0a9e('0x128')});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0x60')],{'as':_0x0a9e('0x13a'),'through':_0x0a9e('0x13b')});db[_0x0a9e('0x11')][_0x0a9e('0x121')](db[_0x0a9e('0x45')],{'as':'FaxAccounts','through':_0x0a9e('0x13c')});db[_0x0a9e('0x11')][_0x0a9e('0x121')](db[_0x0a9e('0x3b')],{'as':_0x0a9e('0x13d'),'through':_0x0a9e('0x13e')});db[_0x0a9e('0x11')]['belongsToMany'](db['OpenchannelAccount'],{'as':_0x0a9e('0x13f'),'through':_0x0a9e('0x140')});db[_0x0a9e('0x11')][_0x0a9e('0x121')](db[_0x0a9e('0x50')],{'as':_0x0a9e('0x141'),'through':_0x0a9e('0x142')});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0xf7')],{'as':_0x0a9e('0x143'),'through':_0x0a9e('0x144')});db[_0x0a9e('0x13')][_0x0a9e('0x110')](db[_0x0a9e('0x16')],{'as':'SpiedAgents','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x145')});db[_0x0a9e('0x146')]['hasMany'](db[_0x0a9e('0x16')],{'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x16')][_0x0a9e('0x110')](db['VoiceExtension'],{'as':_0x0a9e('0x147'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x18')][_0x0a9e('0x121')](db[_0x0a9e('0x84')],{'as':_0x0a9e('0x148'),'through':_0x0a9e('0x149')});db[_0x0a9e('0x1a')]['hasMany'](db[_0x0a9e('0x2b')],{'as':_0x0a9e('0x14a'),'foreignKey':_0x0a9e('0x14b')});db[_0x0a9e('0x1a')]['hasMany'](db['CmHopper'],{'as':_0x0a9e('0x14c'),'foreignKey':_0x0a9e('0x14b')});db[_0x0a9e('0x1a')]['hasMany'](db[_0x0a9e('0x71')],{'as':_0x0a9e('0x115'),'foreignKey':'VoiceQueueId'});db[_0x0a9e('0x1a')]['hasMany'](db[_0x0a9e('0x116')],{'as':'HopperHistories','foreignKey':'VoiceQueueId'});db['VoiceQueue'][_0x0a9e('0x110')](db[_0x0a9e('0x73')],{'as':_0x0a9e('0x73'),'foreignKey':_0x0a9e('0x14b')});db[_0x0a9e('0x1a')][_0x0a9e('0x110')](db['CmHopperBlack'],{'as':_0x0a9e('0x14d'),'foreignKey':_0x0a9e('0x14b')});db[_0x0a9e('0x1a')][_0x0a9e('0x110')](db[_0x0a9e('0xd0')],{'as':_0x0a9e('0x14e'),'foreignKey':_0x0a9e('0x14b')});db['VoiceQueue']['belongsTo'](db[_0x0a9e('0x28')],{'as':'Trunk','foreignKey':_0x0a9e('0x14f')});db[_0x0a9e('0x1a')][_0x0a9e('0x150')](db[_0x0a9e('0x28')],{'as':_0x0a9e('0x151'),'foreignKey':_0x0a9e('0x152')});db['VoiceQueue'][_0x0a9e('0x150')](db['Interval'],{'as':'Interval','foreignKey':_0x0a9e('0x153')});db['VoiceQueue'][_0x0a9e('0x150')](db['Pause'],{'as':'mandatoryDispositionPause','foreignKey':_0x0a9e('0x154')});db['VoiceQueue'][_0x0a9e('0x121')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x127'),'through':'voice_queues_has_cm_lists'});db[_0x0a9e('0x1a')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':'Agents','through':'UserVoiceQueue'});db[_0x0a9e('0x1a')][_0x0a9e('0x121')](db[_0x0a9e('0x129')],{'as':_0x0a9e('0x155'),'through':_0x0a9e('0x105')});db[_0x0a9e('0x1a')][_0x0a9e('0x121')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x156'),'through':_0x0a9e('0x157')});db['VoiceRecording']['belongsTo'](db['User'],{'as':_0x0a9e('0x11'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x1c')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x11'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x10c')]['hasMany'](db['VoiceMailMessage'],{'as':_0x0a9e('0x158'),'onDelete':_0x0a9e('0x10e'),'foreignKey':'mailboxuser','sourceKey':_0x0a9e('0x159')});db[_0x0a9e('0x1f')][_0x0a9e('0x150')](db[_0x0a9e('0x10c')],{'foreignKey':_0x0a9e('0x15a'),'targetKey':_0x0a9e('0x159')});db[_0x0a9e('0x15b')][_0x0a9e('0x110')](db[_0x0a9e('0x25')],{'as':_0x0a9e('0x15c'),'foreignKey':_0x0a9e('0x15d'),'constraints':![]});db[_0x0a9e('0x15b')]['hasMany'](db[_0x0a9e('0x15e')],{'as':_0x0a9e('0x15f'),'foreignKey':_0x0a9e('0x15d'),'constraints':![]});db[_0x0a9e('0x15b')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x11'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x15b')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':'ContactId'});db['MailServerIn'][_0x0a9e('0x150')](db[_0x0a9e('0x3b')],{'as':_0x0a9e('0x3b'),'foreignKey':_0x0a9e('0x161')});db[_0x0a9e('0x39')][_0x0a9e('0x150')](db[_0x0a9e('0x103')],{'as':'CloudProvider','foreignKey':_0x0a9e('0x162'),'onDelete':'restrict'});db[_0x0a9e('0x163')][_0x0a9e('0x150')](db[_0x0a9e('0x3b')],{'as':_0x0a9e('0x3b'),'foreignKey':_0x0a9e('0x161')});db[_0x0a9e('0x163')][_0x0a9e('0x150')](db[_0x0a9e('0x103')],{'as':_0x0a9e('0x103'),'foreignKey':_0x0a9e('0x162'),'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x3b')][_0x0a9e('0x10b')](db[_0x0a9e('0x39')],{'as':_0x0a9e('0x165'),'onDelete':_0x0a9e('0x10e')});db['MailAccount']['hasOne'](db[_0x0a9e('0x163')],{'as':_0x0a9e('0x166'),'onDelete':'cascade'});db['MailAccount'][_0x0a9e('0x110')](db[_0x0a9e('0x167')],{'as':_0x0a9e('0x168'),'foreignKey':'MailAccountId','onDelete':_0x0a9e('0x10e')});db['MailAccount'][_0x0a9e('0x110')](db['CannedAnswer'],{'as':_0x0a9e('0x169'),'foreignKey':'MailAccountId'});db[_0x0a9e('0x3b')][_0x0a9e('0x110')](db[_0x0a9e('0x3e')],{'as':'Messages','foreignKey':_0x0a9e('0x161')});db['MailAccount']['hasMany'](db[_0x0a9e('0x11c')],{'as':_0x0a9e('0x16a')});db[_0x0a9e('0x3b')][_0x0a9e('0x110')](db[_0x0a9e('0x16b')],{'as':_0x0a9e('0x147'),'foreignKey':_0x0a9e('0x161'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x3b')][_0x0a9e('0x150')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x3b')][_0x0a9e('0x150')](db[_0x0a9e('0x8b')],{'as':_0x0a9e('0x8b'),'foreignKey':_0x0a9e('0x16e')});db[_0x0a9e('0x3b')]['belongsTo'](db[_0x0a9e('0x7d')],{'as':_0x0a9e('0x16f'),'foreignKey':_0x0a9e('0x154')});db[_0x0a9e('0x3b')]['belongsToMany'](db['User'],{'as':'Agents','through':_0x0a9e('0x13e')});db['MailQueue'][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':_0x0a9e('0x30')});db[_0x0a9e('0x3c')][_0x0a9e('0x121')](db[_0x0a9e('0x129')],{'through':_0x0a9e('0x171'),'as':_0x0a9e('0x155')});db[_0x0a9e('0x11c')]['hasMany'](db[_0x0a9e('0x3e')],{'as':'Messages','onDelete':_0x0a9e('0x10e'),'foreignKey':'MailInteractionId'});db[_0x0a9e('0x11c')][_0x0a9e('0x150')](db[_0x0a9e('0x3b')],{'as':'Account','foreignKey':_0x0a9e('0x161')});db[_0x0a9e('0x11c')]['belongsTo'](db['CmContact'],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x11c')]['belongsTo'](db['User'],{'as':'Owner','foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x11c')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x173'),'as':_0x0a9e('0x174')});db[_0x0a9e('0x11c')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x173'),'as':_0x0a9e('0x175')});db[_0x0a9e('0x11c')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x176'),'through':_0x0a9e('0x12b'),'foreignKey':_0x0a9e('0x177')});db[_0x0a9e('0x3e')]['hasMany'](db[_0x0a9e('0xe4')],{'as':_0x0a9e('0x178'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x3e')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':'User'});db[_0x0a9e('0x3e')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'onDelete':_0x0a9e('0x10e'),'as':_0x0a9e('0x160')});db[_0x0a9e('0x3e')][_0x0a9e('0x150')](db[_0x0a9e('0x11c')],{'as':_0x0a9e('0x179'),'foreignKey':'MailInteractionId'});db['MailMessage'][_0x0a9e('0x150')](db[_0x0a9e('0x3b')],{'as':'Account','foreignKey':_0x0a9e('0x161')});db[_0x0a9e('0x3e')]['belongsTo'](db[_0x0a9e('0x60')],{'as':'ChatWebsite','foreignKey':_0x0a9e('0x17a')});db[_0x0a9e('0x3e')]['belongsTo'](db[_0x0a9e('0x66')],{'as':_0x0a9e('0x66'),'foreignKey':'ChatOfflineMessageId'});db[_0x0a9e('0x16b')][_0x0a9e('0x150')](db['User'],{'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x16b')][_0x0a9e('0x150')](db[_0x0a9e('0x3c')],{'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x16b')]['belongsTo'](db[_0x0a9e('0x3b')],{'onDelete':_0x0a9e('0x164')});db['MailApplication'][_0x0a9e('0x150')](db[_0x0a9e('0x17b')],{'onDelete':_0x0a9e('0x164'),'foreignKey':_0x0a9e('0x153')});db[_0x0a9e('0x16b')][_0x0a9e('0x150')](db[_0x0a9e('0x86')],{'onDelete':'restrict','foreignKey':'TagId'});db['MailQueueReport']['belongsTo'](db['MailAccount'],{});db[_0x0a9e('0x17c')][_0x0a9e('0x150')](db['CmList'],{'as':'List','foreignKey':_0x0a9e('0x16d')});db['MailQueueReport'][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x17c')][_0x0a9e('0x150')](db['MailInteraction'],{});db[_0x0a9e('0x17c')][_0x0a9e('0x150')](db['MailMessage'],{});db[_0x0a9e('0x17c')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{});db[_0x0a9e('0x17c')][_0x0a9e('0x150')](db[_0x0a9e('0x3c')],{});db[_0x0a9e('0x17d')]['hasMany'](db[_0x0a9e('0x43')],{'as':'Items','onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x45')]['hasMany'](db[_0x0a9e('0x167')],{'as':_0x0a9e('0x168'),'foreignKey':'FaxAccountId','onDelete':_0x0a9e('0x10e')});db['FaxAccount'][_0x0a9e('0x110')](db[_0x0a9e('0x17e')],{'as':'Answers','foreignKey':_0x0a9e('0x17f')});db['FaxAccount'][_0x0a9e('0x110')](db[_0x0a9e('0x11b')],{'as':_0x0a9e('0x16a')});db[_0x0a9e('0x45')][_0x0a9e('0x110')](db[_0x0a9e('0x47')],{'as':_0x0a9e('0x147'),'foreignKey':'FaxAccountId','onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x45')][_0x0a9e('0x110')](db[_0x0a9e('0x16')],{'as':_0x0a9e('0x180'),'onDelete':'cascade'});db[_0x0a9e('0x45')]['hasMany'](db['FaxMessage'],{'as':_0x0a9e('0x158')});db['FaxAccount'][_0x0a9e('0x150')](db[_0x0a9e('0x28')],{'as':'Trunk'});db[_0x0a9e('0x45')][_0x0a9e('0x150')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x45')][_0x0a9e('0x150')](db[_0x0a9e('0x7d')],{'as':_0x0a9e('0x16f'),'foreignKey':'mandatoryDispositionPauseId'});db[_0x0a9e('0x45')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':'user_has_fax_accounts'});db[_0x0a9e('0x47')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'onDelete':'restrict'});db[_0x0a9e('0x47')][_0x0a9e('0x150')](db[_0x0a9e('0x4c')],{'onDelete':'restrict'});db[_0x0a9e('0x47')]['belongsTo'](db[_0x0a9e('0x45')],{'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x47')][_0x0a9e('0x150')](db[_0x0a9e('0x86')],{'onDelete':_0x0a9e('0x164'),'foreignKey':_0x0a9e('0x181')});db['FaxInteraction'][_0x0a9e('0x110')](db[_0x0a9e('0x4a')],{'as':_0x0a9e('0x158'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x182')});db[_0x0a9e('0x11b')][_0x0a9e('0x150')](db[_0x0a9e('0x45')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x17f')});db[_0x0a9e('0x11b')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x11b')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x184'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x11b')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'through':'fax_interaction_has_tags','as':_0x0a9e('0x174')});db[_0x0a9e('0x11b')][_0x0a9e('0x121')](db['Tag'],{'through':_0x0a9e('0x185'),'as':'ThroughTags'});db[_0x0a9e('0x11b')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x176'),'through':_0x0a9e('0x12d'),'foreignKey':_0x0a9e('0x182')});db[_0x0a9e('0x4a')][_0x0a9e('0x150')](db['User'],{'onDelete':_0x0a9e('0x10e'),'as':_0x0a9e('0x11')});db['FaxMessage'][_0x0a9e('0x150')](db[_0x0a9e('0x11b')],{'as':_0x0a9e('0x179'),'foreignKey':'FaxInteractionId'});db[_0x0a9e('0x4a')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'onDelete':_0x0a9e('0x10e'),'as':'Contact'});db[_0x0a9e('0x4a')][_0x0a9e('0x150')](db[_0x0a9e('0xe4')],{'as':_0x0a9e('0xe4'),'foreignKey':_0x0a9e('0x186')});db['FaxMessage'][_0x0a9e('0x150')](db[_0x0a9e('0x45')],{'as':'Account','foreignKey':_0x0a9e('0x17f')});db[_0x0a9e('0x4c')][_0x0a9e('0x121')](db['User'],{'as':'Agents','through':_0x0a9e('0x32')});db[_0x0a9e('0x4c')][_0x0a9e('0x121')](db[_0x0a9e('0x129')],{'through':_0x0a9e('0x187'),'as':_0x0a9e('0x155')});db[_0x0a9e('0x4e')][_0x0a9e('0x150')](db['FaxAccount'],{});db['FaxQueueReport'][_0x0a9e('0x150')](db['CmList'],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x4e')][_0x0a9e('0x150')](db['CmContact'],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db['FaxQueueReport'][_0x0a9e('0x150')](db['FaxInteraction'],{});db[_0x0a9e('0x4e')][_0x0a9e('0x150')](db[_0x0a9e('0x4a')],{});db[_0x0a9e('0x4e')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{});db['FaxQueueReport'][_0x0a9e('0x150')](db['FaxQueue'],{});db[_0x0a9e('0x50')][_0x0a9e('0x110')](db[_0x0a9e('0x167')],{'as':_0x0a9e('0x168'),'foreignKey':_0x0a9e('0x188'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x50')]['hasMany'](db[_0x0a9e('0x17e')],{'as':_0x0a9e('0x169'),'foreignKey':_0x0a9e('0x188')});db[_0x0a9e('0x50')][_0x0a9e('0x110')](db['SmsMessage'],{'as':_0x0a9e('0x158'),'foreignKey':_0x0a9e('0x188')});db['SmsAccount']['hasMany'](db[_0x0a9e('0x53')],{'as':_0x0a9e('0x16a')});db[_0x0a9e('0x50')][_0x0a9e('0x110')](db[_0x0a9e('0x52')],{'as':_0x0a9e('0x147'),'foreignKey':'SmsAccountId','onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x50')][_0x0a9e('0x150')](db['CmList'],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x50')][_0x0a9e('0x150')](db['Pause'],{'as':'mandatoryDispositionPause','foreignKey':_0x0a9e('0x154')});db[_0x0a9e('0x50')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':_0x0a9e('0x142')});db[_0x0a9e('0x52')][_0x0a9e('0x150')](db['User'],{'onDelete':_0x0a9e('0x164')});db['SmsApplication'][_0x0a9e('0x150')](db[_0x0a9e('0x57')],{'onDelete':_0x0a9e('0x164')});db['SmsApplication']['belongsTo'](db[_0x0a9e('0x50')],{'onDelete':'restrict'});db[_0x0a9e('0x52')]['belongsTo'](db['Interval'],{'onDelete':_0x0a9e('0x164'),'foreignKey':_0x0a9e('0x153')});db[_0x0a9e('0x52')][_0x0a9e('0x150')](db[_0x0a9e('0x86')],{'onDelete':_0x0a9e('0x164'),'foreignKey':_0x0a9e('0x181')});db[_0x0a9e('0x53')][_0x0a9e('0x110')](db[_0x0a9e('0x55')],{'as':_0x0a9e('0x158'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x189')});db['SmsInteraction']['belongsTo'](db[_0x0a9e('0x50')],{'as':'Account','foreignKey':_0x0a9e('0x188')});db[_0x0a9e('0x53')][_0x0a9e('0x150')](db['CmContact'],{'as':'Contact','foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x53')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x184'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x53')]['belongsToMany'](db[_0x0a9e('0x86')],{'through':'sms_interaction_has_tags','as':_0x0a9e('0x174')});db[_0x0a9e('0x53')]['belongsToMany'](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x18a'),'as':_0x0a9e('0x175')});db[_0x0a9e('0x53')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':'Users','through':_0x0a9e('0x12e'),'foreignKey':_0x0a9e('0x189')});db[_0x0a9e('0x55')]['belongsTo'](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x11')});db[_0x0a9e('0x55')]['belongsTo'](db[_0x0a9e('0x124')],{'onDelete':_0x0a9e('0x10e'),'as':_0x0a9e('0x160')});db[_0x0a9e('0x55')][_0x0a9e('0x150')](db[_0x0a9e('0x53')],{'onDelete':'cascade','as':'Interaction','foreignKey':_0x0a9e('0x189')});db[_0x0a9e('0x55')]['belongsTo'](db[_0x0a9e('0x50')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x188')});db[_0x0a9e('0x57')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':'Agents','through':_0x0a9e('0x34'),'foreignKey':_0x0a9e('0x18b')});db[_0x0a9e('0x57')]['belongsToMany'](db[_0x0a9e('0x129')],{'through':_0x0a9e('0x18c'),'as':_0x0a9e('0x155')});db[_0x0a9e('0x59')]['hasMany'](db['Disposition'],{'as':_0x0a9e('0x168'),'foreignKey':_0x0a9e('0x18d'),'onDelete':_0x0a9e('0x10e')});db['OpenchannelAccount'][_0x0a9e('0x110')](db[_0x0a9e('0x17e')],{'as':_0x0a9e('0x169'),'foreignKey':_0x0a9e('0x18d')});db[_0x0a9e('0x59')][_0x0a9e('0x110')](db[_0x0a9e('0x5d')],{'as':_0x0a9e('0x16a'),'foreignKey':'OpenchannelAccountId'});db['OpenchannelAccount'][_0x0a9e('0x110')](db[_0x0a9e('0x5e')],{'as':'Messages','foreignKey':_0x0a9e('0x18d')});db['OpenchannelAccount'][_0x0a9e('0x110')](db[_0x0a9e('0x5b')],{'as':'Applications','foreignKey':_0x0a9e('0x18d'),'onDelete':_0x0a9e('0x10e')});db['OpenchannelAccount'][_0x0a9e('0x150')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x59')][_0x0a9e('0x150')](db[_0x0a9e('0x7d')],{'as':'mandatoryDispositionPause','foreignKey':_0x0a9e('0x154')});db[_0x0a9e('0x59')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':_0x0a9e('0x140')});db[_0x0a9e('0x5b')]['belongsTo'](db['User'],{'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x5b')][_0x0a9e('0x150')](db['OpenchannelQueue'],{'onDelete':'restrict','foreignKey':_0x0a9e('0x18e')});db['OpenchannelApplication'][_0x0a9e('0x150')](db[_0x0a9e('0x59')],{'onDelete':_0x0a9e('0x164'),'foreignKey':_0x0a9e('0x18d')});db[_0x0a9e('0x5b')][_0x0a9e('0x150')](db[_0x0a9e('0x17b')],{'onDelete':_0x0a9e('0x164'),'foreignKey':_0x0a9e('0x153')});db['OpenchannelApplication']['belongsTo'](db[_0x0a9e('0x86')],{'onDelete':'restrict','foreignKey':_0x0a9e('0x181')});db[_0x0a9e('0x5d')][_0x0a9e('0x110')](db[_0x0a9e('0x5e')],{'as':'Messages','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x18f')});db[_0x0a9e('0x5d')]['belongsTo'](db[_0x0a9e('0x59')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x18d')});db['OpenchannelInteraction'][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x5d')][_0x0a9e('0x150')](db['User'],{'as':'Owner','foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x5d')][_0x0a9e('0x121')](db['Tag'],{'through':'openchannel_interaction_has_tags','as':_0x0a9e('0x174')});db[_0x0a9e('0x5d')][_0x0a9e('0x121')](db['Tag'],{'through':'openchannel_interaction_has_tags','as':_0x0a9e('0x175')});db[_0x0a9e('0x5d')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x176'),'through':'user_has_openchannel_interactions','foreignKey':_0x0a9e('0x18f')});db['OpenchannelMessage'][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'onDelete':'cascade','as':_0x0a9e('0x11')});db['OpenchannelMessage'][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'onDelete':_0x0a9e('0x10e'),'as':_0x0a9e('0x160')});db[_0x0a9e('0x5e')]['belongsTo'](db[_0x0a9e('0x5d')],{'onDelete':_0x0a9e('0x10e'),'as':_0x0a9e('0x179'),'foreignKey':'OpenchannelInteractionId'});db[_0x0a9e('0x5e')]['belongsTo'](db[_0x0a9e('0xe4')],{'as':_0x0a9e('0xe4'),'foreignKey':_0x0a9e('0x186')});db['OpenchannelMessage'][_0x0a9e('0x150')](db[_0x0a9e('0x59')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x18d')});db[_0x0a9e('0x137')][_0x0a9e('0x121')](db['User'],{'as':_0x0a9e('0x170'),'through':_0x0a9e('0x35'),'foreignKey':_0x0a9e('0x18e')});db[_0x0a9e('0x137')][_0x0a9e('0x121')](db[_0x0a9e('0x129')],{'through':_0x0a9e('0x190'),'as':_0x0a9e('0x155')});db['ChatWebsite'][_0x0a9e('0x110')](db[_0x0a9e('0x167')],{'as':_0x0a9e('0x168'),'foreignKey':_0x0a9e('0x17a'),'onDelete':'cascade'});db[_0x0a9e('0x60')]['hasMany'](db[_0x0a9e('0x17e')],{'as':_0x0a9e('0x169'),'foreignKey':_0x0a9e('0x17a')});db['ChatWebsite'][_0x0a9e('0x110')](db[_0x0a9e('0x191')],{'as':_0x0a9e('0x192')});db[_0x0a9e('0x60')]['hasMany'](db[_0x0a9e('0x64')],{'as':_0x0a9e('0x16a')});db[_0x0a9e('0x60')][_0x0a9e('0x110')](db[_0x0a9e('0x63')],{'as':_0x0a9e('0x147'),'foreignKey':_0x0a9e('0x17a'),'onDelete':'cascade'});db[_0x0a9e('0x60')][_0x0a9e('0x110')](db[_0x0a9e('0x65')],{'as':_0x0a9e('0x158')});db['ChatWebsite'][_0x0a9e('0x150')](db['CmList'],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x60')][_0x0a9e('0x150')](db[_0x0a9e('0x17b')],{'as':_0x0a9e('0x17b'),'foreignKey':_0x0a9e('0x153')});db['ChatWebsite'][_0x0a9e('0x150')](db['MailAccount'],{'as':_0x0a9e('0x3b'),'foreignKey':_0x0a9e('0x161')});db['ChatWebsite'][_0x0a9e('0x150')](db[_0x0a9e('0x7d')],{'as':_0x0a9e('0x16f'),'foreignKey':_0x0a9e('0x154')});db['ChatWebsite'][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':'Agents','through':_0x0a9e('0x13b')});db['OpenchannelQueueReport']['belongsTo'](db['OpenchannelAccount'],{});db[_0x0a9e('0x62')][_0x0a9e('0x150')](db['CmList'],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db['OpenchannelQueueReport'][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x62')][_0x0a9e('0x150')](db[_0x0a9e('0x5d')],{});db['OpenchannelQueueReport'][_0x0a9e('0x150')](db['OpenchannelMessage'],{});db[_0x0a9e('0x62')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{});db[_0x0a9e('0x62')][_0x0a9e('0x150')](db[_0x0a9e('0x137')],{});db['ChatApplication'][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x193'),'foreignKey':'UserId','onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x63')][_0x0a9e('0x150')](db[_0x0a9e('0x67')],{'as':_0x0a9e('0x194'),'foreignKey':_0x0a9e('0x195'),'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x63')][_0x0a9e('0x150')](db[_0x0a9e('0x60')],{'as':_0x0a9e('0x196'),'foreignKey':_0x0a9e('0x17a'),'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x63')][_0x0a9e('0x150')](db[_0x0a9e('0x86')],{'onDelete':'restrict','foreignKey':_0x0a9e('0x181')});db[_0x0a9e('0x64')][_0x0a9e('0x110')](db['ChatMessage'],{'as':_0x0a9e('0x158'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x197')});db[_0x0a9e('0x64')]['belongsTo'](db[_0x0a9e('0x60')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x17a')});db[_0x0a9e('0x64')]['belongsTo'](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x64')]['belongsTo'](db['User'],{'as':_0x0a9e('0x184'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x64')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x198'),'as':_0x0a9e('0x174')});db[_0x0a9e('0x64')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x198'),'as':_0x0a9e('0x175')});db[_0x0a9e('0x64')][_0x0a9e('0x121')](db['User'],{'as':_0x0a9e('0x176'),'through':_0x0a9e('0x199'),'foreignKey':_0x0a9e('0x197')});db['ChatMessage']['belongsTo'](db[_0x0a9e('0x11')],{'onDelete':'cascade','as':_0x0a9e('0x11')});db[_0x0a9e('0x65')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'onDelete':'cascade','as':'Contact','foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x65')][_0x0a9e('0x150')](db[_0x0a9e('0x64')],{'onDelete':'cascade','as':_0x0a9e('0x179'),'foreignKey':_0x0a9e('0x197')});db[_0x0a9e('0x65')][_0x0a9e('0x150')](db[_0x0a9e('0xe4')],{'as':'Attachment','foreignKey':'AttachmentId'});db[_0x0a9e('0x65')][_0x0a9e('0x150')](db[_0x0a9e('0x60')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x17a')});db[_0x0a9e('0x66')][_0x0a9e('0x110')](db['Attachment'],{'as':_0x0a9e('0x178'),'foreignKey':_0x0a9e('0x19a'),'onDelete':_0x0a9e('0x10e'),'hooks':!![]});db['ChatOfflineMessage']['belongsTo'](db['CmContact'],{'onDelete':_0x0a9e('0x10e'),'as':_0x0a9e('0x160'),'foreignKey':'ContactId'});db[_0x0a9e('0x66')][_0x0a9e('0x150')](db[_0x0a9e('0x60')],{'as':'Account','foreignKey':'ChatWebsiteId'});db[_0x0a9e('0x67')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':'UserChatQueue','hooks':!![]});db[_0x0a9e('0x67')]['belongsToMany'](db['Team'],{'through':_0x0a9e('0x19b'),'as':'Teams'});db[_0x0a9e('0x68')][_0x0a9e('0x110')](db[_0x0a9e('0xcc')],{'as':'Messages','foreignKey':_0x0a9e('0x19c'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x68')]['belongsToMany'](db['User'],{'as':_0x0a9e('0x14a'),'through':_0x0a9e('0x123')});db[_0x0a9e('0x191')][_0x0a9e('0x150')](db[_0x0a9e('0x60')],{'as':_0x0a9e('0x196'),'foreignKey':'ChatWebsiteId'});db['CmCompany'][_0x0a9e('0x110')](db[_0x0a9e('0x124')],{'as':'Contacts','foreignKey':'CompanyId'});db['CmContact']['hasMany'](db['CmContactHasItem'],{'as':'Phones','foreignKey':_0x0a9e('0x19d')});db['CmContact'][_0x0a9e('0x110')](db[_0x0a9e('0x6d')],{'as':_0x0a9e('0x14c'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x124')][_0x0a9e('0x110')](db[_0x0a9e('0x71')],{'as':'HopperFinals','foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x124')][_0x0a9e('0x110')](db[_0x0a9e('0x116')],{'as':_0x0a9e('0x19e'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x124')][_0x0a9e('0x110')](db[_0x0a9e('0x73')],{'as':_0x0a9e('0x73'),'foreignKey':_0x0a9e('0x172')});db['CmContact'][_0x0a9e('0x110')](db[_0x0a9e('0xd0')],{'as':'JscriptySessions','foreignKey':_0x0a9e('0x172')});db['CmContact'][_0x0a9e('0x110')](db[_0x0a9e('0x5d')],{'as':'OpenchannelInteractions','foreignKey':'ContactId','onDelete':_0x0a9e('0x164')});db['CmContact'][_0x0a9e('0x110')](db[_0x0a9e('0x64')],{'as':_0x0a9e('0x119'),'foreignKey':_0x0a9e('0x172'),'onDelete':_0x0a9e('0x164')});db['CmContact'][_0x0a9e('0x110')](db['SmsInteraction'],{'as':'SmsInteractions','foreignKey':_0x0a9e('0x172'),'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x124')][_0x0a9e('0x110')](db[_0x0a9e('0x11b')],{'as':'FaxInteractions','foreignKey':_0x0a9e('0x172'),'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x124')][_0x0a9e('0x110')](db['MailInteraction'],{'as':_0x0a9e('0x11d'),'foreignKey':_0x0a9e('0x172'),'onDelete':'restrict'});db[_0x0a9e('0x124')][_0x0a9e('0x150')](db[_0x0a9e('0x19f')],{'as':_0x0a9e('0x1a0'),'foreignKey':'CompanyId'});db[_0x0a9e('0x124')][_0x0a9e('0x150')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d'),'onDelete':'cascade'});db[_0x0a9e('0x124')][_0x0a9e('0x121')](db['User'],{'as':_0x0a9e('0x176'),'through':'cm_user_has_contacts'});db[_0x0a9e('0x124')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'as':_0x0a9e('0x174'),'through':_0x0a9e('0x1a1')});db[_0x0a9e('0x124')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x1a1'),'as':_0x0a9e('0x175')});db[_0x0a9e('0x6d')][_0x0a9e('0x110')](db[_0x0a9e('0x1a2')],{'as':_0x0a9e('0x1a3'),'foreignKey':_0x0a9e('0x1a4')});db['CmHopper'][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x6d')][_0x0a9e('0x150')](db[_0x0a9e('0x139')],{'as':'List','foreignKey':'ListId','onDelete':'cascade'});db['CmHopper'][_0x0a9e('0x150')](db['User'],{'as':'Agent','foreignKey':'UserId'});db[_0x0a9e('0x6d')][_0x0a9e('0x150')](db[_0x0a9e('0x1a')],{'as':_0x0a9e('0x194'),'foreignKey':'VoiceQueueId','onDelete':'cascade'});db[_0x0a9e('0x6d')][_0x0a9e('0x150')](db[_0x0a9e('0x1a5')],{'as':_0x0a9e('0x1a5'),'foreignKey':'CampaignId','onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x6d')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x184'),'foreignKey':_0x0a9e('0x1a6')});db['CmHopperBlack'][_0x0a9e('0x150')](db['CmContact'],{'as':'Contact','foreignKey':_0x0a9e('0x172'),'onDelete':'cascade'});db[_0x0a9e('0x6f')][_0x0a9e('0x150')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x6f')][_0x0a9e('0x150')](db[_0x0a9e('0x1a')],{'as':'Queue','foreignKey':_0x0a9e('0x14b'),'onDelete':_0x0a9e('0x10e')});db['CmHopperBlack'][_0x0a9e('0x150')](db[_0x0a9e('0x1a5')],{'as':_0x0a9e('0x1a5'),'foreignKey':_0x0a9e('0x1a7'),'onDelete':'cascade'});db[_0x0a9e('0x76')][_0x0a9e('0x110')](db[_0x0a9e('0x7a')],{'as':{'plural':_0x0a9e('0x1a8'),'singular':_0x0a9e('0x1a9')},'foreignKey':'AutomationAllId','onDelete':'cascade','hooks':!![]});db[_0x0a9e('0x76')]['hasMany'](db[_0x0a9e('0x7a')],{'as':{'plural':'Any','singular':_0x0a9e('0x1aa')},'foreignKey':'AutomationAnyId','onDelete':_0x0a9e('0x10e'),'hooks':!![]});db['Automation'][_0x0a9e('0x110')](db[_0x0a9e('0x74')],{'as':_0x0a9e('0x1ab'),'foreignKey':'AutomationId','onDelete':'cascade','hooks':!![]});db[_0x0a9e('0x167')]['hasMany'](db[_0x0a9e('0x167')],{'as':'Dispositions','foreignKey':_0x0a9e('0x1ac'),'onDelete':'cascade'});db[_0x0a9e('0x17b')][_0x0a9e('0x110')](db['Interval'],{'as':_0x0a9e('0x1ad'),'foreignKey':_0x0a9e('0x153'),'onDelete':_0x0a9e('0x10e'),'hooks':!![],'required':![]});db[_0x0a9e('0x17b')][_0x0a9e('0x110')](db[_0x0a9e('0x16')],{'as':_0x0a9e('0x114'),'foreignKey':_0x0a9e('0x153'),'onDelete':_0x0a9e('0x164')});db['Interval'][_0x0a9e('0x110')](db[_0x0a9e('0x16b')],{'as':_0x0a9e('0x1ae'),'foreignKey':_0x0a9e('0x153')});db[_0x0a9e('0x17b')]['hasMany'](db['ChatApplication'],{'as':_0x0a9e('0x1af'),'foreignKey':'IntervalId'});db[_0x0a9e('0x17b')]['hasMany'](db[_0x0a9e('0x47')],{'as':_0x0a9e('0x1b0'),'foreignKey':_0x0a9e('0x153')});db[_0x0a9e('0x17b')][_0x0a9e('0x110')](db[_0x0a9e('0x52')],{'as':_0x0a9e('0x1b1'),'foreignKey':'IntervalId'});db['Schedule'][_0x0a9e('0x150')](db[_0x0a9e('0x3b')],{});db['Schedule'][_0x0a9e('0x150')](db[_0x0a9e('0x94')],{'foreignKey':_0x0a9e('0x1b2')});db['Schedule']['belongsTo'](db['AnalyticCustomReport'],{'foreignKey':_0x0a9e('0x1b3')});db[_0x0a9e('0x84')][_0x0a9e('0x121')](db[_0x0a9e('0x18')],{'as':'Mohs','through':_0x0a9e('0x149'),'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x86')]['belongsToMany'](db[_0x0a9e('0x124')],{'through':'cm_contact_has_tags'});db['Tag'][_0x0a9e('0x121')](db[_0x0a9e('0x64')],{'through':'chat_interaction_has_tags'});db['Tag'][_0x0a9e('0x121')](db['MailInteraction'],{'through':_0x0a9e('0x173')});db['Tag'][_0x0a9e('0x121')](db[_0x0a9e('0x53')],{'through':_0x0a9e('0x18a')});db['Tag']['belongsToMany'](db[_0x0a9e('0x11b')],{'through':_0x0a9e('0x185')});db[_0x0a9e('0x86')][_0x0a9e('0x121')](db['OpenchannelInteraction'],{'through':_0x0a9e('0x1b4')});db[_0x0a9e('0x86')]['belongsToMany'](db[_0x0a9e('0xfb')],{'through':_0x0a9e('0x1b5')});db[_0x0a9e('0x1b6')]['belongsTo'](db[_0x0a9e('0x88')],{'as':_0x0a9e('0x1b7'),'foreignKey':_0x0a9e('0x1b8')});db[_0x0a9e('0x1a2')][_0x0a9e('0x150')](db[_0x0a9e('0x6d')],{'as':_0x0a9e('0x1b9'),'foreignKey':_0x0a9e('0x1a4')});db[_0x0a9e('0x1b6')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x19d')});db[_0x0a9e('0x8d')][_0x0a9e('0x110')](db[_0x0a9e('0x7a')],{'as':{'plural':_0x0a9e('0x1ba'),'singular':_0x0a9e('0x1bb')},'foreignKey':_0x0a9e('0x1bc'),'onDelete':_0x0a9e('0x10e'),'hooks':!![]});db[_0x0a9e('0x8d')][_0x0a9e('0x110')](db['Condition'],{'as':{'plural':_0x0a9e('0x1bd'),'singular':_0x0a9e('0x1be')},'foreignKey':_0x0a9e('0x1bf'),'onDelete':'cascade','hooks':!![]});db[_0x0a9e('0x8d')][_0x0a9e('0x110')](db[_0x0a9e('0x74')],{'as':_0x0a9e('0x1ab'),'foreignKey':'TriggerId','onDelete':_0x0a9e('0x10e'),'hooks':!![]});db[_0x0a9e('0x1c0')]['hasMany'](db[_0x0a9e('0x99')],{'as':_0x0a9e('0x1c1'),'onDelete':_0x0a9e('0x10e'),'foreignKey':'CustomReportId','hooks':!![]});db['AnalyticDefaultReport'][_0x0a9e('0x110')](db[_0x0a9e('0x99')],{'as':_0x0a9e('0x1c1'),'onDelete':'cascade','foreignKey':'DefaultReportId'});db[_0x0a9e('0x98')][_0x0a9e('0x110')](db[_0x0a9e('0x99')],{'as':_0x0a9e('0x1c1'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c2')});db['AnalyticFieldReport']['belongsTo'](db[_0x0a9e('0x98')],{'foreignKey':_0x0a9e('0x1c2')});db[_0x0a9e('0x9c')]['hasMany'](db[_0x0a9e('0x9e')],{'as':_0x0a9e('0x1c3'),'onDelete':_0x0a9e('0x10e'),'foreignKey':'AccountId'});db['SalesforceConfiguration'][_0x0a9e('0x110')](db[_0x0a9e('0xa0')],{'as':_0x0a9e('0x1c4'),'onDelete':'cascade','foreignKey':'SubjectId'});db[_0x0a9e('0x9e')]['hasMany'](db['SalesforceField'],{'as':'Descriptions','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0x9e')]['hasMany'](db[_0x0a9e('0xa0')],{'as':_0x0a9e('0x1c1'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c6')});db['SalesforceConfiguration'][_0x0a9e('0x150')](db[_0x0a9e('0x9c')],{'as':'Account','foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xa0')][_0x0a9e('0x110')](db['SalesforceField'],{'as':_0x0a9e('0x1c8'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xa0')]['hasMany'](db[_0x0a9e('0xa0')],{'as':_0x0a9e('0x1ca'),'foreignKey':_0x0a9e('0x1c5')});db['SalesforceField'][_0x0a9e('0x110')](db[_0x0a9e('0xa0')],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xa0')][_0x0a9e('0x150')](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':'VariableId'});db[_0x0a9e('0xa1')][_0x0a9e('0x110')](db[_0x0a9e('0xa2')],{'as':_0x0a9e('0x1c3'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xa2')]['hasMany'](db[_0x0a9e('0x1cc')],{'as':_0x0a9e('0x1c4'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xa2')][_0x0a9e('0x110')](db[_0x0a9e('0x1cc')],{'as':_0x0a9e('0x1cd'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c5')});db['SugarcrmConfiguration'][_0x0a9e('0x110')](db[_0x0a9e('0x1cc')],{'as':'Fields','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c6')});db['SugarcrmConfiguration'][_0x0a9e('0x150')](db[_0x0a9e('0xa1')],{'as':'Account','foreignKey':_0x0a9e('0x1c7')});db['SugarcrmField']['hasMany'](db['SugarcrmField'],{'as':_0x0a9e('0x1c8'),'foreignKey':_0x0a9e('0x1c9')});db['SugarcrmField'][_0x0a9e('0x110')](db[_0x0a9e('0x1cc')],{'as':'Description','foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0x1cc')]['hasMany'](db[_0x0a9e('0x1cc')],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db['SugarcrmField'][_0x0a9e('0x150')](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1ce')});db[_0x0a9e('0x1cf')]['hasMany'](db[_0x0a9e('0xa6')],{'as':'Configurations','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xa6')][_0x0a9e('0x110')](db[_0x0a9e('0xa8')],{'as':_0x0a9e('0x1c4'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xa6')]['hasMany'](db[_0x0a9e('0xa8')],{'as':_0x0a9e('0x1cd'),'onDelete':_0x0a9e('0x10e'),'foreignKey':'DescriptionId'});db['DeskConfiguration']['hasMany'](db['DeskField'],{'as':'Fields','onDelete':_0x0a9e('0x10e'),'foreignKey':'FieldId'});db[_0x0a9e('0xa6')][_0x0a9e('0x150')](db[_0x0a9e('0x1cf')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xa6')]['belongsToMany'](db[_0x0a9e('0x86')],{'through':'int_desk_configuration_has_tags'});db['DeskField'][_0x0a9e('0x110')](db['DeskField'],{'as':_0x0a9e('0x1c8'),'foreignKey':'SubjectId'});db[_0x0a9e('0xa8')][_0x0a9e('0x110')](db[_0x0a9e('0xa8')],{'as':_0x0a9e('0x1ca'),'foreignKey':_0x0a9e('0x1c5')});db['DeskField'][_0x0a9e('0x110')](db[_0x0a9e('0xa8')],{'as':'Field','foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xa8')]['belongsTo'](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1ce')});db[_0x0a9e('0xaa')][_0x0a9e('0x110')](db[_0x0a9e('0xac')],{'as':_0x0a9e('0x1c3'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xac')][_0x0a9e('0x110')](db[_0x0a9e('0xae')],{'as':'Subjects','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xac')][_0x0a9e('0x110')](db[_0x0a9e('0xae')],{'as':_0x0a9e('0x1cd'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c5')});db['ZohoConfiguration'][_0x0a9e('0x110')](db[_0x0a9e('0xae')],{'as':_0x0a9e('0x1c1'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xac')][_0x0a9e('0x150')](db[_0x0a9e('0xaa')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xae')][_0x0a9e('0x110')](db[_0x0a9e('0xae')],{'as':_0x0a9e('0x1c8'),'foreignKey':'SubjectId'});db[_0x0a9e('0xae')][_0x0a9e('0x110')](db[_0x0a9e('0xae')],{'as':'Description','foreignKey':'DescriptionId'});db[_0x0a9e('0xae')][_0x0a9e('0x110')](db[_0x0a9e('0xae')],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xae')][_0x0a9e('0x150')](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':'VariableId'});db[_0x0a9e('0xaf')][_0x0a9e('0x110')](db['ZendeskConfiguration'],{'as':_0x0a9e('0x1c3'),'onDelete':_0x0a9e('0x10e'),'foreignKey':'AccountId'});db['ZendeskConfiguration'][_0x0a9e('0x110')](db[_0x0a9e('0xb2')],{'as':_0x0a9e('0x1c4'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0x1d0')]['hasMany'](db[_0x0a9e('0xb2')],{'as':'Descriptions','foreignKey':'DescriptionId'});db['ZendeskConfiguration'][_0x0a9e('0x110')](db['ZendeskField'],{'as':'Fields','foreignKey':'FieldId'});db[_0x0a9e('0x1d0')][_0x0a9e('0x150')](db[_0x0a9e('0xaf')],{'as':_0x0a9e('0x183'),'foreignKey':'AccountId'});db[_0x0a9e('0x1d0')]['belongsToMany'](db['Tag'],{'through':_0x0a9e('0x1d1')});db[_0x0a9e('0xb2')][_0x0a9e('0x110')](db['ZendeskField'],{'as':'Subject','foreignKey':'SubjectId'});db[_0x0a9e('0xb2')][_0x0a9e('0x110')](db[_0x0a9e('0xb2')],{'as':_0x0a9e('0x1ca'),'foreignKey':_0x0a9e('0x1c5')});db['ZendeskField'][_0x0a9e('0x110')](db[_0x0a9e('0xb2')],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xb2')][_0x0a9e('0x150')](db['Variable'],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1ce')});db[_0x0a9e('0x1d2')][_0x0a9e('0x110')](db[_0x0a9e('0x1d3')],{'as':_0x0a9e('0x1c3'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0x1d3')][_0x0a9e('0x110')](db[_0x0a9e('0xb5')],{'as':_0x0a9e('0x1c4'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0x1d3')][_0x0a9e('0x110')](db[_0x0a9e('0xb5')],{'as':_0x0a9e('0x1cd'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0x1d3')]['hasMany'](db['FreshdeskField'],{'as':'Fields','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c6')});db['FreshdeskConfiguration'][_0x0a9e('0x150')](db[_0x0a9e('0x1d2')],{'as':'Account','foreignKey':_0x0a9e('0x1c7')});db['FreshdeskConfiguration'][_0x0a9e('0x121')](db['Tag'],{'through':_0x0a9e('0x1d4')});db[_0x0a9e('0xb5')][_0x0a9e('0x110')](db[_0x0a9e('0xb5')],{'as':'Subject','foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xb5')][_0x0a9e('0x110')](db['FreshdeskField'],{'as':'Description','foreignKey':'DescriptionId'});db['FreshdeskField'][_0x0a9e('0x110')](db[_0x0a9e('0xb5')],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xb5')]['belongsTo'](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1ce')});db[_0x0a9e('0x1d5')]['hasMany'](db[_0x0a9e('0xb8')],{'as':_0x0a9e('0x1c3'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xb8')]['hasMany'](db[_0x0a9e('0xb9')],{'as':_0x0a9e('0x1c4'),'foreignKey':_0x0a9e('0x1c9')});db['VtigerConfiguration'][_0x0a9e('0x110')](db['VtigerField'],{'as':_0x0a9e('0x1cd'),'foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0xb8')][_0x0a9e('0x110')](db[_0x0a9e('0xb9')],{'as':'Fields','foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xb8')][_0x0a9e('0x150')](db[_0x0a9e('0x1d5')],{'as':_0x0a9e('0x183'),'foreignKey':'AccountId'});db[_0x0a9e('0xb9')][_0x0a9e('0x110')](db[_0x0a9e('0xb9')],{'as':'Subject','foreignKey':_0x0a9e('0x1c9')});db['VtigerField']['hasMany'](db[_0x0a9e('0xb9')],{'as':'Description','foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0xb9')][_0x0a9e('0x110')](db['VtigerField'],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xb9')][_0x0a9e('0x150')](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1ce')});db[_0x0a9e('0xba')]['hasMany'](db[_0x0a9e('0xbc')],{'as':_0x0a9e('0x1c3'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xbc')]['hasMany'](db['ServicenowField'],{'as':_0x0a9e('0x1c4'),'foreignKey':'SubjectId'});db[_0x0a9e('0xbc')][_0x0a9e('0x110')](db['ServicenowField'],{'as':_0x0a9e('0x1cd'),'foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0xbc')]['hasMany'](db[_0x0a9e('0x1d6')],{'as':_0x0a9e('0x1c1'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xbc')][_0x0a9e('0x150')](db[_0x0a9e('0xba')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x1c7')});db['ServicenowField'][_0x0a9e('0x110')](db[_0x0a9e('0x1d6')],{'as':_0x0a9e('0x1c8'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0x1d6')]['hasMany'](db[_0x0a9e('0x1d6')],{'as':'Description','foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0x1d6')][_0x0a9e('0x110')](db['ServicenowField'],{'as':_0x0a9e('0x1cb'),'foreignKey':'FieldId'});db[_0x0a9e('0x1d6')][_0x0a9e('0x150')](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':'VariableId'});db[_0x0a9e('0xbe')]['hasMany'](db[_0x0a9e('0xbf')],{'as':_0x0a9e('0x1c3'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xbe')][_0x0a9e('0x150')](db['CloudProvider'],{'as':_0x0a9e('0x103'),'foreignKey':'CloudProviderId'});db[_0x0a9e('0xbf')][_0x0a9e('0x110')](db['Dynamics365Field'],{'as':'Subjects','onDelete':'cascade','foreignKey':'SubjectId'});db[_0x0a9e('0xbf')][_0x0a9e('0x110')](db[_0x0a9e('0xc1')],{'as':_0x0a9e('0x1cd'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c5')});db['Dynamics365Configuration'][_0x0a9e('0x110')](db[_0x0a9e('0xc1')],{'as':'Fields','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xbf')][_0x0a9e('0x150')](db[_0x0a9e('0xbe')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x1c7')});db['Dynamics365Field'][_0x0a9e('0x110')](db[_0x0a9e('0xc1')],{'as':_0x0a9e('0x1c8'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xc1')][_0x0a9e('0x110')](db[_0x0a9e('0xc1')],{'as':_0x0a9e('0x1ca'),'foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0xc1')][_0x0a9e('0x110')](db['Dynamics365Field'],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xc1')][_0x0a9e('0x150')](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1ce')});db['FreshsalesAccount'][_0x0a9e('0x110')](db[_0x0a9e('0xc5')],{'as':_0x0a9e('0x1c3'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xc5')][_0x0a9e('0x110')](db['FreshsalesField'],{'as':'Subjects','foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xc5')][_0x0a9e('0x110')](db[_0x0a9e('0xc7')],{'as':_0x0a9e('0x1cd'),'foreignKey':'DescriptionId'});db[_0x0a9e('0xc5')]['hasMany'](db[_0x0a9e('0xc7')],{'as':_0x0a9e('0x1c1'),'foreignKey':'FieldId'});db[_0x0a9e('0xc5')]['belongsTo'](db[_0x0a9e('0xc3')],{'as':_0x0a9e('0x183'),'foreignKey':'AccountId'});db[_0x0a9e('0xc7')][_0x0a9e('0x110')](db[_0x0a9e('0xc7')],{'as':'Subject','foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xc7')][_0x0a9e('0x110')](db[_0x0a9e('0xc7')],{'as':_0x0a9e('0x1ca'),'foreignKey':_0x0a9e('0x1c5')});db['FreshsalesField'][_0x0a9e('0x110')](db[_0x0a9e('0xc7')],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db['FreshsalesField']['belongsTo'](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1ce')});db['ChatQueueReport']['belongsTo'](db[_0x0a9e('0x60')],{});db['ChatQueueReport']['belongsTo'](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x16c'),'foreignKey':'ListId'});db[_0x0a9e('0xca')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db['ChatQueueReport'][_0x0a9e('0x150')](db[_0x0a9e('0x64')],{});db['ChatQueueReport'][_0x0a9e('0x150')](db[_0x0a9e('0x65')],{});db[_0x0a9e('0xca')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{});db['ChatQueueReport'][_0x0a9e('0x150')](db[_0x0a9e('0x67')],{});db['ChatInternalMessage']['belongsTo'](db[_0x0a9e('0x11')],{'onDelete':_0x0a9e('0x10e'),'foreignKey':'FromId'});db['ChatInternalMessage'][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1d7')});db[_0x0a9e('0xd0')]['hasMany'](db[_0x0a9e('0x1d8')],{'foreignKey':'SessionId','onDelete':'cascade'});db[_0x0a9e('0xd0')]['hasMany'](db[_0x0a9e('0xcd')],{'foreignKey':'SessionId','onDelete':_0x0a9e('0x10e')});db['SmsQueueReport']['belongsTo'](db[_0x0a9e('0x50')],{});db[_0x0a9e('0xd2')][_0x0a9e('0x150')](db['CmList'],{'as':'List','foreignKey':'ListId'});db[_0x0a9e('0xd2')][_0x0a9e('0x150')](db['CmContact'],{'as':_0x0a9e('0x160'),'foreignKey':'ContactId'});db[_0x0a9e('0xd2')]['belongsTo'](db[_0x0a9e('0x53')],{});db[_0x0a9e('0xd2')]['belongsTo'](db['SmsMessage'],{});db['SmsQueueReport'][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{});db[_0x0a9e('0xd2')][_0x0a9e('0x150')](db[_0x0a9e('0x57')],{});db[_0x0a9e('0x1d9')][_0x0a9e('0x110')](db[_0x0a9e('0xd0')],{'foreignKey':_0x0a9e('0x1da')});db[_0x0a9e('0x1d9')][_0x0a9e('0x110')](db[_0x0a9e('0x1d8')],{'foreignKey':_0x0a9e('0x1da')});db[_0x0a9e('0x1d9')][_0x0a9e('0x110')](db['JscriptyAnswerReport'],{'foreignKey':'ProjectId'});db[_0x0a9e('0x129')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':'user_has_teams'});db[_0x0a9e('0x129')]['belongsToMany'](db[_0x0a9e('0x1a')],{'through':'TeamVoiceQueue','as':_0x0a9e('0x131')});db['Team']['belongsToMany'](db[_0x0a9e('0x3c')],{'through':_0x0a9e('0x171'),'as':_0x0a9e('0x1db')});db[_0x0a9e('0x129')]['belongsToMany'](db['ChatQueue'],{'through':_0x0a9e('0x19b'),'as':'ChatQueues'});db[_0x0a9e('0x129')][_0x0a9e('0x121')](db['FaxQueue'],{'through':_0x0a9e('0x187'),'as':'FaxQueues'});db[_0x0a9e('0x129')][_0x0a9e('0x121')](db[_0x0a9e('0x57')],{'through':_0x0a9e('0x18c'),'as':_0x0a9e('0x136')});db[_0x0a9e('0x129')][_0x0a9e('0x121')](db[_0x0a9e('0x137')],{'through':_0x0a9e('0x190'),'as':_0x0a9e('0x1dc')});db[_0x0a9e('0x129')][_0x0a9e('0x121')](db[_0x0a9e('0x101')],{'through':_0x0a9e('0x1dd'),'as':_0x0a9e('0x138')});db[_0x0a9e('0x129')]['belongsToMany'](db[_0x0a9e('0xf1')],{'through':_0x0a9e('0x107'),'as':_0x0a9e('0x132')});db['Campaign'][_0x0a9e('0x110')](db[_0x0a9e('0x6d')],{'as':_0x0a9e('0x14c'),'foreignKey':_0x0a9e('0x1a7')});db[_0x0a9e('0x1a5')][_0x0a9e('0x110')](db[_0x0a9e('0x71')],{'as':_0x0a9e('0x115'),'foreignKey':_0x0a9e('0x1a7')});db[_0x0a9e('0x1a5')][_0x0a9e('0x110')](db['CmHopperHistory'],{'as':_0x0a9e('0x19e'),'foreignKey':_0x0a9e('0x1a7')});db[_0x0a9e('0x1a5')]['hasMany'](db[_0x0a9e('0x6f')],{'as':'HopperBlacks','foreignKey':'CampaignId'});db[_0x0a9e('0x1a5')]['belongsTo'](db[_0x0a9e('0x28')],{'as':'Trunk','foreignKey':_0x0a9e('0x14f')});db[_0x0a9e('0x1a5')][_0x0a9e('0x150')](db['Trunk'],{'as':_0x0a9e('0x151'),'foreignKey':'TrunkBackupId'});db['Campaign'][_0x0a9e('0x150')](db[_0x0a9e('0x17b')],{'as':_0x0a9e('0x17b'),'foreignKey':_0x0a9e('0x153')});db[_0x0a9e('0x1a5')][_0x0a9e('0x150')](db['SquareProject'],{'as':_0x0a9e('0xdc'),'foreignKey':_0x0a9e('0x1de')});db[_0x0a9e('0x1a5')][_0x0a9e('0x121')](db[_0x0a9e('0x139')],{'as':'Lists','through':_0x0a9e('0x1df')});db[_0x0a9e('0x1a5')][_0x0a9e('0x121')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x156'),'through':_0x0a9e('0x1e0')});db[_0x0a9e('0xe4')][_0x0a9e('0x150')](db[_0x0a9e('0x66')],{'as':_0x0a9e('0x66'),'foreignKey':_0x0a9e('0x19a')});db[_0x0a9e('0x1e1')][_0x0a9e('0x150')](db['MailMessage'],{});db['MailTransferReport'][_0x0a9e('0x150')](db[_0x0a9e('0x11c')],{});db['MailTransferReport'][_0x0a9e('0x150')](db[_0x0a9e('0x3b')],{'foreignKey':_0x0a9e('0x1e2'),'as':_0x0a9e('0x1e3')});db[_0x0a9e('0x1e1')]['belongsTo'](db['User'],{'foreignKey':'FromUserId','as':_0x0a9e('0x1e4')});db[_0x0a9e('0x1e1')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'foreignKey':_0x0a9e('0x1e5'),'as':_0x0a9e('0x1e6')});db[_0x0a9e('0x1e1')][_0x0a9e('0x150')](db[_0x0a9e('0x3c')],{'foreignKey':'ToMailQueueId','as':'ToQueue'});db[_0x0a9e('0x1e1')][_0x0a9e('0x150')](db[_0x0a9e('0x3b')],{'foreignKey':_0x0a9e('0x1e7'),'as':_0x0a9e('0x1e8')});db[_0x0a9e('0xe8')][_0x0a9e('0x150')](db[_0x0a9e('0x65')],{});db[_0x0a9e('0xe8')][_0x0a9e('0x150')](db['ChatInteraction'],{});db[_0x0a9e('0xe8')]['belongsTo'](db['ChatWebsite'],{'foreignKey':_0x0a9e('0x1e9'),'as':_0x0a9e('0x1e3')});db[_0x0a9e('0xe8')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'foreignKey':_0x0a9e('0x1ea'),'as':_0x0a9e('0x1e4')});db[_0x0a9e('0xe8')][_0x0a9e('0x150')](db['User'],{'foreignKey':_0x0a9e('0x1e5'),'as':_0x0a9e('0x1e6')});db[_0x0a9e('0xe8')]['belongsTo'](db[_0x0a9e('0x67')],{'foreignKey':_0x0a9e('0x1eb'),'as':'ToQueue'});db['ChatTransferReport']['belongsTo'](db['ChatWebsite'],{'foreignKey':_0x0a9e('0x1ec'),'as':_0x0a9e('0x1e8')});db['FaxTransferReport'][_0x0a9e('0x150')](db['FaxMessage'],{});db[_0x0a9e('0xea')][_0x0a9e('0x150')](db[_0x0a9e('0x11b')],{});db['FaxTransferReport']['belongsTo'](db[_0x0a9e('0x45')],{'foreignKey':_0x0a9e('0x1ed'),'as':_0x0a9e('0x1e3')});db[_0x0a9e('0xea')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'foreignKey':_0x0a9e('0x1ea'),'as':_0x0a9e('0x1e4')});db[_0x0a9e('0xea')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'foreignKey':'ToUserId','as':_0x0a9e('0x1e6')});db[_0x0a9e('0xea')]['belongsTo'](db['FaxQueue'],{'foreignKey':_0x0a9e('0x1ee'),'as':_0x0a9e('0x1ef')});db[_0x0a9e('0xea')][_0x0a9e('0x150')](db[_0x0a9e('0x45')],{'foreignKey':'ToFaxAccountId','as':_0x0a9e('0x1e8')});db[_0x0a9e('0xec')]['belongsTo'](db[_0x0a9e('0x5e')],{});db['OpenchannelTransferReport']['belongsTo'](db['OpenchannelInteraction'],{});db[_0x0a9e('0xec')][_0x0a9e('0x150')](db['OpenchannelAccount'],{'foreignKey':'FromOpenchannelAccountId','as':_0x0a9e('0x1e3')});db[_0x0a9e('0xec')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'foreignKey':'FromUserId','as':_0x0a9e('0x1e4')});db[_0x0a9e('0xec')][_0x0a9e('0x150')](db['User'],{'foreignKey':_0x0a9e('0x1e5'),'as':_0x0a9e('0x1e6')});db[_0x0a9e('0xec')][_0x0a9e('0x150')](db[_0x0a9e('0x137')],{'foreignKey':'ToOpenchannelQueueId','as':'ToQueue'});db[_0x0a9e('0xec')][_0x0a9e('0x150')](db[_0x0a9e('0x59')],{'foreignKey':'ToOpenchannelAccountId','as':'ToAccount'});db['SmsTransferReport']['belongsTo'](db[_0x0a9e('0x55')],{});db[_0x0a9e('0xee')][_0x0a9e('0x150')](db[_0x0a9e('0x53')],{});db[_0x0a9e('0xee')]['belongsTo'](db[_0x0a9e('0x50')],{'foreignKey':_0x0a9e('0x1f0'),'as':_0x0a9e('0x1e3')});db[_0x0a9e('0xee')][_0x0a9e('0x150')](db['User'],{'foreignKey':_0x0a9e('0x1ea'),'as':_0x0a9e('0x1e4')});db[_0x0a9e('0xee')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'foreignKey':'ToUserId','as':_0x0a9e('0x1e6')});db[_0x0a9e('0xee')]['belongsTo'](db['SmsQueue'],{'foreignKey':'ToSmsQueueId','as':_0x0a9e('0x1ef')});db[_0x0a9e('0xee')]['belongsTo'](db[_0x0a9e('0x50')],{'foreignKey':'ToSmsAccountId','as':'ToAccount'});db['CmList']['hasMany'](db[_0x0a9e('0x167')],{'as':_0x0a9e('0x168'),'foreignKey':_0x0a9e('0x16d'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x139')][_0x0a9e('0x110')](db[_0x0a9e('0x1f1')],{'as':_0x0a9e('0x1f2'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x139')][_0x0a9e('0x110')](db['CmContact'],{'as':_0x0a9e('0x125'),'onDelete':'cascade','foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x139')][_0x0a9e('0x110')](db[_0x0a9e('0x71')],{'as':_0x0a9e('0x115'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x139')][_0x0a9e('0x110')](db[_0x0a9e('0x116')],{'as':'HopperHistory','foreignKey':'ListId'});db['CmList'][_0x0a9e('0x110')](db[_0x0a9e('0x73')],{'as':_0x0a9e('0x73'),'foreignKey':'ListId'});db[_0x0a9e('0x139')][_0x0a9e('0x121')](db[_0x0a9e('0x1a')],{'as':'Queues','through':_0x0a9e('0x1f3')});db[_0x0a9e('0x139')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':'Agents','through':_0x0a9e('0x128')});db[_0x0a9e('0xf1')][_0x0a9e('0x110')](db[_0x0a9e('0x16')],{'as':_0x0a9e('0x114'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0xf1')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':'UserVoicePrefix'});db[_0x0a9e('0xf1')]['belongsToMany'](db[_0x0a9e('0x129')],{'through':'TeamVoicePrefix','as':_0x0a9e('0x155')});db[_0x0a9e('0xf2')][_0x0a9e('0x110')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x176'),'foreignKey':_0x0a9e('0x1f4')});db['UserProfile'][_0x0a9e('0x110')](db['UserProfileSection'],{'as':_0x0a9e('0x1f5'),'foreignKey':_0x0a9e('0x1f4'),'onDelete':_0x0a9e('0x10e')});db['UserProfileSection']['hasMany'](db['UserProfileResource'],{'as':_0x0a9e('0x1f6'),'foreignKey':_0x0a9e('0x1f7'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0xf7')][_0x0a9e('0x110')](db[_0x0a9e('0x167')],{'as':'Dispositions','foreignKey':_0x0a9e('0x1f8'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0xf7')][_0x0a9e('0x110')](db['CannedAnswer'],{'as':_0x0a9e('0x169'),'foreignKey':_0x0a9e('0x1f8')});db['WhatsappAccount'][_0x0a9e('0x110')](db[_0x0a9e('0xfd')],{'as':_0x0a9e('0x158'),'foreignKey':'WhatsappAccountId'});db[_0x0a9e('0xf7')]['hasMany'](db[_0x0a9e('0xfb')],{'as':'Interactions'});db[_0x0a9e('0xf7')][_0x0a9e('0x110')](db['WhatsappApplication'],{'as':_0x0a9e('0x147'),'foreignKey':_0x0a9e('0x1f8'),'onDelete':_0x0a9e('0x10e')});db['WhatsappAccount'][_0x0a9e('0x150')](db['CmList'],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0xf7')][_0x0a9e('0x150')](db[_0x0a9e('0x7d')],{'as':'mandatoryDispositionPause','foreignKey':_0x0a9e('0x154')});db[_0x0a9e('0xf7')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':_0x0a9e('0x144')});db[_0x0a9e('0xf9')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0xf9')][_0x0a9e('0x150')](db[_0x0a9e('0x101')],{'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0xf9')][_0x0a9e('0x150')](db['WhatsappAccount'],{'onDelete':_0x0a9e('0x164')});db['WhatsappApplication'][_0x0a9e('0x150')](db[_0x0a9e('0x17b')],{'onDelete':'restrict','foreignKey':_0x0a9e('0x153')});db[_0x0a9e('0xf9')]['belongsTo'](db[_0x0a9e('0x86')],{'onDelete':_0x0a9e('0x164'),'foreignKey':_0x0a9e('0x181')});db['WhatsappInteraction'][_0x0a9e('0x110')](db['WhatsappMessage'],{'as':'Messages','onDelete':'cascade','foreignKey':_0x0a9e('0x1f9')});db[_0x0a9e('0xfb')][_0x0a9e('0x150')](db[_0x0a9e('0xf7')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x1f8')});db[_0x0a9e('0xfb')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0xfb')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x184'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0xfb')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x1b5'),'as':_0x0a9e('0x174')});db['WhatsappInteraction'][_0x0a9e('0x121')](db['Tag'],{'through':_0x0a9e('0x1b5'),'as':_0x0a9e('0x175')});db[_0x0a9e('0xfb')]['belongsToMany'](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x176'),'through':_0x0a9e('0x130'),'foreignKey':'WhatsappInteractionId'});db[_0x0a9e('0xfd')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x11')});db[_0x0a9e('0xfd')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'onDelete':'cascade','as':_0x0a9e('0x160')});db[_0x0a9e('0xfd')][_0x0a9e('0x150')](db['WhatsappInteraction'],{'onDelete':'cascade','as':_0x0a9e('0x179'),'foreignKey':_0x0a9e('0x1f9')});db[_0x0a9e('0xfd')]['belongsTo'](db[_0x0a9e('0xf7')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x1f8')});db[_0x0a9e('0xfe')][_0x0a9e('0x150')](db[_0x0a9e('0xf7')],{});db['WhatsappQueueReport'][_0x0a9e('0x150')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0xfe')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0xfe')][_0x0a9e('0x150')](db['WhatsappInteraction'],{});db['WhatsappQueueReport']['belongsTo'](db[_0x0a9e('0x101')],{});db[_0x0a9e('0xfe')]['belongsTo'](db['WhatsappMessage'],{});db[_0x0a9e('0xfe')][_0x0a9e('0x150')](db['User'],{});db['WhatsappTransferReport'][_0x0a9e('0x150')](db[_0x0a9e('0xfd')],{});db['WhatsappTransferReport'][_0x0a9e('0x150')](db[_0x0a9e('0xfb')],{});db[_0x0a9e('0x1fa')]['belongsTo'](db['WhatsappAccount'],{'foreignKey':_0x0a9e('0x1fb'),'as':_0x0a9e('0x1e3')});db['WhatsappTransferReport']['belongsTo'](db[_0x0a9e('0xf7')],{'foreignKey':_0x0a9e('0x1fc'),'as':'ToAccount'});db[_0x0a9e('0x1fa')]['belongsTo'](db['WhatsappQueue'],{'foreignKey':_0x0a9e('0x1fd'),'as':_0x0a9e('0x1ef')});db['WhatsappTransferReport']['belongsTo'](db['User'],{'foreignKey':_0x0a9e('0x1ea'),'as':'FromAgent'});db[_0x0a9e('0x1fa')][_0x0a9e('0x150')](db['User'],{'foreignKey':'ToUserId','as':_0x0a9e('0x1e6')});db[_0x0a9e('0x101')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':_0x0a9e('0x37'),'foreignKey':'WhatsappQueueId'});db[_0x0a9e('0x101')][_0x0a9e('0x121')](db[_0x0a9e('0x129')],{'through':_0x0a9e('0x1dd'),'as':'Teams'});db[_0x0a9e('0x1fe')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x1ff'),'foreignKey':_0x0a9e('0x10f'),'onDelete':_0x0a9e('0x10e'),'hooks':!![]});db[_0x0a9e('0x103')][_0x0a9e('0x10b')](db['Dynamics365Account'],{'as':_0x0a9e('0xbe'),'onDelete':_0x0a9e('0x164')});db['CloudProvider'][_0x0a9e('0x10b')](db['MailServerIn'],{'as':'Imap','onDelete':_0x0a9e('0x164')});db['CloudProvider']['hasOne'](db['MailServerOut'],{'as':'Smtp','onDelete':_0x0a9e('0x164')});module['exports']={'db':db,'dbH':dbH}; \ No newline at end of file +var _0xa9e0=['SquareRecording','../api/squareRecording/squareRecording.model','SquareMessage','../api/squareMessage/squareMessage.model','License','Migration','../api/migration/migration.model','Attachment','../api/attachment/attachment.model','Plugin','../api/plugin/plugin.model','ChatTransferReport','../api/chatTransferReport/chatTransferReport.model','FaxTransferReport','../api/faxTransferReport/faxTransferReport.model','OpenchannelTransferReport','../api/openchannelTransferReport/openchannelTransferReport.model','SmsTransferReport','../api/smsTransferReport/smsTransferReport.model','../api/cmList/cmList.model','VoicePrefix','UserProfile','UserProfileSection','UserProfileResource','UserNotification','../api/userNotification/userNotification.model','WhatsappAccount','../api/whatsappAccount/whatsappAccount.model','WhatsappApplication','../api/whatsappApplication/whatsappApplication.model','WhatsappInteraction','../api/whatsappInteraction/whatsappInteraction.model','WhatsappMessage','WhatsappQueueReport','../api/whatsappQueueReport/whatsappQueueReport.model','../api/whatsappTransferReport/whatsappTransferReport.model','WhatsappQueue','../api/whatsappQueue/whatsappQueue.model','CloudProvider','../api/cloudProvider/cloudProvider.model','TeamVoiceQueue','../api/teamVoiceQueue/teamVoiceQueue.model','TeamVoicePrefix','../api/teamVoicePrefix/teamVoicePrefix.model','UserVoicePrefix','../api/userVoicePrefix/userVoicePrefix.model','hasOne','VoiceMail','userSetting','cascade','UserId','hasMany','VoiceRecording','Recordings','VoiceQueuesRt','Extensions','HopperFinals','CmHopperHistory','HopperHistory','OpenchannelInteractions','ChatInteractions','SmsInteractions','FaxInteraction','MailInteraction','MailInteractions','WhatsappInteractions','UserNotifications','SenderId','belongsToMany','Groups','chat_group_has_users','CmContact','Contacts','cm_user_has_contacts','Lists','cm_user_has_lists','Team','user_has_teams','user_has_mail_interactions','FaxInteractions','user_has_fax_interactions','user_has_sms_interactions','user_has_openchannel_interactions','user_has_whatsapp_interactions','VoiceQueues','VoicePrefixes','ChatQueues','UserChatQueue','FaxQueues','SmsQueues','OpenchannelQueue','WhatsappQueues','CmList','ChatWebsites','user_has_chat_websites','user_has_fax_accounts','MailAccounts','user_has_mail_accounts','OpenchannelAccounts','user_has_openchannel_accounts','SmsAccounts','user_has_sms_accounts','WhatsappAccounts','user_has_whatsapp_accounts','ChanSpyId','VoiceContext','Applications','Sounds','moh_has_sounds','Members','VoiceQueueId','Hoppers','HopperBlacks','JscriptySessions','TrunkId','belongsTo','TrunkBackup','TrunkBackupId','IntervalId','mandatoryDispositionPauseId','Teams','BlackLists','voice_queues_has_cm_blacklists','Messages','mailbox','mailboxuser','VoiceCallReport','QueueCalls','uniqueid','VoiceAgentReport','AgentReports','Contact','MailAccountId','CloudProviderId','MailServerOut','restrict','Imap','Smtp','Disposition','Dispositions','Answers','Interactions','MailApplication','List','ListId','TemplateId','mandatoryDispositionPause','Agents','team_has_mail_queues','ContactId','mail_interaction_has_tags','Tags','ThroughTags','Users','MailInteractionId','Attachments','Interaction','ChatWebsiteId','Interval','MailQueueReport','Dashboard','CannedAnswer','FaxAccountId','Exntensions','TagId','FaxInteractionId','Account','Owner','fax_interaction_has_tags','AttachmentId','team_has_fax_queues','SmsAccountId','SmsInteractionId','sms_interaction_has_tags','SmsQueueId','team_has_sms_queues','OpenchannelAccountId','OpenchannelQueueId','OpenchannelInteractionId','team_has_openchannel_queues','ChatProactiveAction','ProactiveActions','Agent','Queue','ChatQueueId','Website','ChatInteractionId','chat_interaction_has_tags','user_has_chat_interactions','ChatOfflineMessageId','team_has_chat_queues','ChatGroupId','CmContactId','HopperHistories','CmCompany','Company','cm_contact_has_tags','CmHopperAdditionalPhone','AdditionalPhones','CmHopperId','Campaign','OwnerId','CampaignId','All','OneAll','OneAny','Actions','ParentId','Intervals','MailApplications','ChatApplications','FaxApplications','SmsApplications','DefaultReportId','CustomReportId','openchannel_interaction_has_tags','whatsapp_interaction_has_tags','CmContactHasItem','ItemType','ItemTypeId','Hopper','AllConditions','AllCondition','TriggerAllId','AnyConditions','AnyCondition','TriggerAnyId','AnalyticCustomReport','Fields','MetricId','Configurations','Subjects','DescriptionId','FieldId','AccountId','Subject','SubjectId','Description','Field','SugarcrmField','Descriptions','VariableId','DeskAccount','ZendeskConfiguration','int_zendesk_configuration_has_tags','FreshdeskAccount','FreshdeskConfiguration','int_freshdesk_configuration_has_tags','VtigerAccount','ServicenowField','ToId','JscriptyQuestionReport','JscriptyProject','ProjectId','MailQueues','OpenchannelQueues','team_has_whatsapp_queues','SquareProjectId','campaigns_has_cm_lists','campaigns_has_cm_blacklists','MailTransferReport','FromMailAccountId','FromAccount','FromAgent','ToUserId','ToAgent','ToMailAccountId','ToAccount','FromChatWebsiteId','FromUserId','ToChatQueueId','ToChatWebsiteId','FromFaxAccountId','ToFaxQueueId','ToQueue','FromSmsAccountId','CmCustomField','CustomFields','voice_queues_has_cm_lists','userProfileId','UserProfileSections','Resources','sectionId','WhatsappAccountId','WhatsappInteractionId','WhatsappTransferReport','FromWhatsappAccountId','ToWhatsappAccountId','ToQueueId','UserSetting','user','../config/environment','sequelize','lodash','motion2','xcall','xC@LL1234','127.0.0.1','utf8mb4','name','utf8','defaultsDeep','mysql','username','password','options','database','sequelizeHistory','User','import','VoiceChanSpy','../api/voiceChanSpy/voiceChanSpy.model','../api/voiceContext/voiceContext.model','VoiceExtension','../api/voiceExtension/voiceExtension.model','VoiceMusicOnHold','../api/voiceMusicOnHold/voiceMusicOnHold.model','VoiceQueue','../api/voiceQueue/voiceQueue.model','ScreenRecording','../api/screenRecording/screenRecording.model','../api/voiceMail/voiceMail.model','VoiceMailMessage','../api/voiceMailMessage/voiceMailMessage.model','../api/voiceCallReport/voiceCallReport.model','VoiceDialReport','../api/voiceDialReport/voiceDialReport.model','../api/voiceAgentReport/voiceAgentReport.model','VoiceQueueReport','../api/voiceQueueReport/voiceQueueReport.model','MemberReport','Trunk','../api/trunk/trunk.model','../api/voiceTransferReport/voiceTransferReport.model','UserVoiceQueueRt','../api/userVoiceQueueRt/userVoiceQueueRt.model','UserVoiceQueue','../api/userVoiceQueue/userVoiceQueue.model','../api/userChatQueue/userChatQueue.model','UserMailQueue','../api/userMailQueue/userMailQueue.model','UserFaxQueue','../api/userFaxQueue/userFaxQueue.model','UserSmsQueue','UserOpenchannelQueue','../api/userOpenchannelQueue/userOpenchannelQueue.model','UserWhatsappQueue','../api/userWhatsappQueue/userWhatsappQueue.model','MailServerIn','../api/mailServerOut/mailServerOut.model','MailAccount','MailQueue','MailSubstatus','MailMessage','../api/mailMessage/mailMessage.model','../api/mailApplication/mailApplication.model','../api/mailQueueReport/mailQueueReport.model','../api/dashboard/dashboard.model','DashboardItem','../api/dashboardItem/dashboardItem.model','FaxAccount','../api/faxAccount/faxAccount.model','FaxApplication','../api/faxApplication/faxApplication.model','../api/faxInteraction/faxInteraction.model','FaxMessage','../api/faxMessage/faxMessage.model','FaxQueue','../api/faxQueue/faxQueue.model','FaxQueueReport','../api/faxQueueReport/faxQueueReport.model','SmsAccount','../api/smsAccount/smsAccount.model','SmsApplication','SmsInteraction','../api/smsInteraction/smsInteraction.model','SmsMessage','../api/smsMessage/smsMessage.model','SmsQueue','../api/smsQueue/smsQueue.model','OpenchannelAccount','../api/openchannelAccount/openchannelAccount.model','OpenchannelApplication','../api/openchannelApplication/openchannelApplication.model','OpenchannelInteraction','OpenchannelMessage','../api/openchannelQueue/openchannelQueue.model','ChatWebsite','../api/chatWebsite/chatWebsite.model','OpenchannelQueueReport','ChatApplication','ChatInteraction','ChatMessage','ChatOfflineMessage','ChatQueue','ChatGroup','../api/chatGroup/chatGroup.model','../api/chatProactiveAction/chatProactiveAction.model','../api/cmCompany/cmCompany.model','../api/cmContact/cmContact.model','CmHopper','../api/cmHopper/cmHopper.model','CmHopperBlack','../api/cmHopperBlack/cmHopperBlack.model','CmHopperFinal','../api/cmHopperFinal/cmHopperFinal.model','ReportAgentPreview','Action','../api/action/action.model','Automation','../api/automation/automation.model','../api/cannedAnswer/cannedAnswer.model','../api/disposition/disposition.model','Condition','../api/condition/condition.model','../api/interval/interval.model','Pause','../api/pause/pause.model','Cdr','../api/cdr/cdr.model','../api/voiceQueuesLog/voiceQueuesLog.model','Schedule','../api/schedule/schedule.model','Sound','../api/sound/sound.model','Tag','../api/tag/tag.model','ContactItemType','../api/contactItemType/contactItemType.model','../api/cmContactHasItem/cmContactHasItem.model','Template','../api/template/template.model','Trigger','Variable','../api/variable/variable.model','Integration','../api/integration/integration.model','../api/integrationReport/integrationReport.model','../api/analyticCustomReport/analyticCustomReport.model','AnalyticDefaultReport','../api/analyticDefaultReport/analyticDefaultReport.model','AnalyticExtractedReport','../api/analyticExtractedReport/analyticExtractedReport.model','AnalyticMetric','AnalyticFieldReport','../api/analyticFieldReport/analyticFieldReport.model','../api/analyticTreeReport/analyticTreeReport.model','SalesforceAccount','../api/intSalesforceAccount/intSalesforceAccount.model','SalesforceConfiguration','../api/intSalesforceConfiguration/intSalesforceConfiguration.model','SalesforceField','SugarcrmAccount','SugarcrmConfiguration','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','../api/intSugarcrmField/intSugarcrmField.model','../api/intDeskAccount/intDeskAccount.model','DeskConfiguration','../api/intDeskConfiguration/intDeskConfiguration.model','DeskField','../api/intDeskField/intDeskField.model','ZohoAccount','../api/intZohoAccount/intZohoAccount.model','ZohoConfiguration','../api/intZohoConfiguration/intZohoConfiguration.model','ZohoField','ZendeskAccount','../api/intZendeskAccount/intZendeskAccount.model','../api/intZendeskConfiguration/intZendeskConfiguration.model','ZendeskField','../api/intZendeskField/intZendeskField.model','../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model','FreshdeskField','../api/intFreshdeskField/intFreshdeskField.model','../api/intVtigerAccount/intVtigerAccount.model','VtigerConfiguration','VtigerField','ServicenowAccount','../api/intServicenowAccount/intServicenowAccount.model','ServicenowConfiguration','../api/intServicenowConfiguration/intServicenowConfiguration.model','Dynamics365Account','Dynamics365Configuration','../api/intDynamics365Configuration/intDynamics365Configuration.model','Dynamics365Field','../api/intDynamics365Field/intDynamics365Field.model','FreshsalesAccount','../api/intFreshsalesAccount/intFreshsalesAccount.model','FreshsalesConfiguration','../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model','FreshsalesField','../api/intFreshsalesField/intFreshsalesField.model','../api/network/network.model','ChatQueueReport','../api/chatQueueReport/chatQueueReport.model','ChatInternalMessage','JscriptyAnswerReport','../api/jscriptyAnswerReport/jscriptyAnswerReport.model','../api/jscriptyQuestionReport/jscriptyQuestionReport.model','JscriptySessionReport','../api/jscriptySessionReport/jscriptySessionReport.model','SmsQueueReport','../api/smsQueueReport/smsQueueReport.model','SquareReport','../api/squareReport/squareReport.model','SquareDetailsReport','../api/squareReportDetail/squareReportDetail.model','../api/jscriptyProject/jscriptyProject.model','Setting','../api/setting/setting.model','../api/squareOdbc/squareOdbc.model','SquareProject'];(function(_0x2d460c,_0x4f08c0){var _0xf6fc4c=function(_0x4fb81c){while(--_0x4fb81c){_0x2d460c['push'](_0x2d460c['shift']());}};_0xf6fc4c(++_0x4f08c0);}(_0xa9e0,0x123));var _0x0a9e=function(_0x298ed3,_0x4ab5e1){_0x298ed3=_0x298ed3-0x0;var _0x5aad28=_0xa9e0[_0x298ed3];return _0x5aad28;};'use strict';var config=require(_0x0a9e('0x0'));var Sequelize=require(_0x0a9e('0x1'));var _=require(_0x0a9e('0x2'));var jstz=require('jstz');var timezone=jstz['determine']();config[_0x0a9e('0x1')]=_['defaultsDeep'](config[_0x0a9e('0x1')],{'database':_0x0a9e('0x3'),'username':_0x0a9e('0x4'),'password':_0x0a9e('0x5'),'options':{'host':_0x0a9e('0x6'),'port':0xcea,'dialect':'mysql','dialectOptions':{'charset':_0x0a9e('0x7')},'logging':![],'timezone':timezone[_0x0a9e('0x8')](),'define':{'charset':_0x0a9e('0x9'),'collate':'utf8_general_ci'}}});config['sequelizeHistory']=_[_0x0a9e('0xa')](config['sequelizeHistory'],{'database':'motion2','username':_0x0a9e('0x4'),'password':_0x0a9e('0x5'),'options':{'host':_0x0a9e('0x6'),'port':0xcea,'dialect':_0x0a9e('0xb'),'dialectOptions':{'charset':_0x0a9e('0x7')},'logging':![],'timezone':timezone[_0x0a9e('0x8')](),'define':{'charset':'utf8','collate':'utf8_general_ci'}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config['sequelize']['database'],config[_0x0a9e('0x1')][_0x0a9e('0xc')],config[_0x0a9e('0x1')][_0x0a9e('0xd')],config[_0x0a9e('0x1')][_0x0a9e('0xe')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config['sequelizeHistory'][_0x0a9e('0xf')],config[_0x0a9e('0x10')][_0x0a9e('0xc')],config[_0x0a9e('0x10')][_0x0a9e('0xd')],config[_0x0a9e('0x10')]['options'])};db[_0x0a9e('0x11')]=db['sequelize'][_0x0a9e('0x12')]('../api/user/user.model');db[_0x0a9e('0x13')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x14'));db['VoiceContext']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x15'));db[_0x0a9e('0x16')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x17'));db[_0x0a9e('0x18')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x19'));db[_0x0a9e('0x1a')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x1b'));db['VoiceRecording']=db[_0x0a9e('0x1')]['import']('../api/voiceRecording/voiceRecording.model');db[_0x0a9e('0x1c')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x1d'));db['VoiceMail']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x1e'));db[_0x0a9e('0x1f')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x20'));db['VoiceCallReport']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x21'));db[_0x0a9e('0x22')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x23'));db['VoiceAgentReport']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x24'));db[_0x0a9e('0x25')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x26'));db[_0x0a9e('0x27')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/memberReport/memberReport.model');db[_0x0a9e('0x28')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x29'));db['VoiceTransferReport']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x2a'));db[_0x0a9e('0x2b')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x2c'));db[_0x0a9e('0x2d')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x2e'));db['UserChatQueue']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x2f'));db[_0x0a9e('0x30')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x31'));db[_0x0a9e('0x32')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x33'));db[_0x0a9e('0x34')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/userSmsQueue/userSmsQueue.model');db[_0x0a9e('0x35')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x36'));db[_0x0a9e('0x37')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x38'));db[_0x0a9e('0x39')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/mailServerIn/mailServerIn.model');db['MailServerOut']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x3a'));db[_0x0a9e('0x3b')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/mailAccount/mailAccount.model');db[_0x0a9e('0x3c')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/mailQueue/mailQueue.model');db[_0x0a9e('0x3d')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/mailSubstatus/mailSubstatus.model');db['MailInteraction']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/mailInteraction/mailInteraction.model');db[_0x0a9e('0x3e')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x3f'));db['MailApplication']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x40'));db['MailQueueReport']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x41'));db['Dashboard']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x42'));db[_0x0a9e('0x43')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x44'));db[_0x0a9e('0x45')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x46'));db[_0x0a9e('0x47')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x48'));db['FaxInteraction']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x49'));db[_0x0a9e('0x4a')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x4b'));db[_0x0a9e('0x4c')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x4d'));db[_0x0a9e('0x4e')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x4f'));db[_0x0a9e('0x50')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x51'));db[_0x0a9e('0x52')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/smsApplication/smsApplication.model');db[_0x0a9e('0x53')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x54'));db[_0x0a9e('0x55')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x56'));db[_0x0a9e('0x57')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x58'));db[_0x0a9e('0x59')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x5a'));db[_0x0a9e('0x5b')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x5c'));db[_0x0a9e('0x5d')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/openchannelInteraction/openchannelInteraction.model');db[_0x0a9e('0x5e')]=db[_0x0a9e('0x1')]['import']('../api/openchannelMessage/openchannelMessage.model');db['OpenchannelQueue']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x5f'));db[_0x0a9e('0x60')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x61'));db[_0x0a9e('0x62')]=db['sequelize']['import']('../api/openchannelQueueReport/openchannelQueueReport.model');db[_0x0a9e('0x63')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/chatApplication/chatApplication.model');db[_0x0a9e('0x64')]=db[_0x0a9e('0x1')]['import']('../api/chatInteraction/chatInteraction.model');db[_0x0a9e('0x65')]=db['sequelize'][_0x0a9e('0x12')]('../api/chatMessage/chatMessage.model');db[_0x0a9e('0x66')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/chatOfflineMessage/chatOfflineMessage.model');db[_0x0a9e('0x67')]=db[_0x0a9e('0x1')]['import']('../api/chatQueue/chatQueue.model');db[_0x0a9e('0x68')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x69'));db['ChatProactiveAction']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x6a'));db['CmCompany']=db['sequelize']['import'](_0x0a9e('0x6b'));db['CmContact']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x6c'));db[_0x0a9e('0x6d')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x6e'));db[_0x0a9e('0x6f')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x70'));db[_0x0a9e('0x71')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x72'));db['CmHopperHistory']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/cmHopperHistory/cmHopperHistory.model');db[_0x0a9e('0x73')]=db['sequelize'][_0x0a9e('0x12')]('../api/reportAgentPreview/reportAgentPreview.model');db['CmCustomField']=db['sequelize'][_0x0a9e('0x12')]('../api/cmCustomField/cmCustomField.model');db[_0x0a9e('0x74')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x75'));db[_0x0a9e('0x76')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x77'));db['CannedAnswer']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x78'));db['Disposition']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x79'));db[_0x0a9e('0x7a')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x7b'));db['Interval']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x7c'));db[_0x0a9e('0x7d')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x7e'));db[_0x0a9e('0x7f')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x80'));db['VoiceQueuesLog']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x81'));db[_0x0a9e('0x82')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x83'));db[_0x0a9e('0x84')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x85'));db[_0x0a9e('0x86')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x87'));db[_0x0a9e('0x88')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x89'));db['CmContactHasItem']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x8a'));db['CmHopperAdditionalPhone']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model');db[_0x0a9e('0x8b')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x8c'));db[_0x0a9e('0x8d')]=db['sequelize']['import']('../api/trigger/trigger.model');db[_0x0a9e('0x8e')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x8f'));db[_0x0a9e('0x90')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x91'));db['IntegrationReport']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x92'));db['AnalyticCustomReport']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x93'));db[_0x0a9e('0x94')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x95'));db[_0x0a9e('0x96')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x97'));db[_0x0a9e('0x98')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/analyticMetric/analyticMetric.model');db[_0x0a9e('0x99')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x9a'));db['AnalyticTreeReport']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x9b'));db[_0x0a9e('0x9c')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x9d'));db[_0x0a9e('0x9e')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x9f'));db[_0x0a9e('0xa0')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/intSalesforceField/intSalesforceField.model');db[_0x0a9e('0xa1')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/intSugarcrmAccount/intSugarcrmAccount.model');db[_0x0a9e('0xa2')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xa3'));db['SugarcrmField']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xa4'));db['DeskAccount']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xa5'));db[_0x0a9e('0xa6')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xa7'));db[_0x0a9e('0xa8')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xa9'));db[_0x0a9e('0xaa')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xab'));db[_0x0a9e('0xac')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xad'));db[_0x0a9e('0xae')]=db['sequelize'][_0x0a9e('0x12')]('../api/intZohoField/intZohoField.model');db[_0x0a9e('0xaf')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xb0'));db['ZendeskConfiguration']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xb1'));db[_0x0a9e('0xb2')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xb3'));db['FreshdeskAccount']=db['sequelize'][_0x0a9e('0x12')]('../api/intFreshdeskAccount/intFreshdeskAccount.model');db['FreshdeskConfiguration']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xb4'));db[_0x0a9e('0xb5')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xb6'));db['VtigerAccount']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xb7'));db[_0x0a9e('0xb8')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/intVtigerConfiguration/intVtigerConfiguration.model');db[_0x0a9e('0xb9')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/intVtigerField/intVtigerField.model');db[_0x0a9e('0xba')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xbb'));db[_0x0a9e('0xbc')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xbd'));db['ServicenowField']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/intServicenowField/intServicenowField.model');db[_0x0a9e('0xbe')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/intDynamics365Account/intDynamics365Account.model');db[_0x0a9e('0xbf')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xc0'));db[_0x0a9e('0xc1')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xc2'));db[_0x0a9e('0xc3')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xc4'));db[_0x0a9e('0xc5')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xc6'));db[_0x0a9e('0xc7')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xc8'));db[_0x0a9e('0x90')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x91'));db['Network']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xc9'));db[_0x0a9e('0xca')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xcb'));db[_0x0a9e('0xcc')]=db['sequelize'][_0x0a9e('0x12')]('../api/chatInternalMessage/chatInternalMessage.model');db[_0x0a9e('0xcd')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xce'));db['JscriptyQuestionReport']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xcf'));db[_0x0a9e('0xd0')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xd1'));db[_0x0a9e('0xd2')]=db['sequelize']['import'](_0x0a9e('0xd3'));db[_0x0a9e('0xd4')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xd5'));db[_0x0a9e('0xd6')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xd7'));db['JscriptyProject']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xd8'));db[_0x0a9e('0xd9')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xda'));db['SquareOdbc']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xdb'));db[_0x0a9e('0xdc')]=db[_0x0a9e('0x1')]['import']('../api/squareProject/squareProject.model');db[_0x0a9e('0xdd')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xde'));db[_0x0a9e('0xdf')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xe0'));db['Team']=db['sequelize'][_0x0a9e('0x12')]('../api/team/team.model');db[_0x0a9e('0xe1')]=db['sequelize'][_0x0a9e('0x12')]('../api/license/license.model');db['Campaign']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/campaign/campaign.model');db[_0x0a9e('0xe2')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xe3'));db[_0x0a9e('0xe4')]=db['sequelize']['import'](_0x0a9e('0xe5'));db[_0x0a9e('0xe6')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xe7'));db['MailTransferReport']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/mailTransferReport/mailTransferReport.model');db[_0x0a9e('0xe8')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xe9'));db[_0x0a9e('0xea')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xeb'));db[_0x0a9e('0xec')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xed'));db[_0x0a9e('0xee')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xef'));db['CmList']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xf0'));db[_0x0a9e('0xf1')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/voicePrefix/voicePrefix.model');db[_0x0a9e('0xf2')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/userProfile/userProfile.model');db[_0x0a9e('0xf3')]=db['sequelize'][_0x0a9e('0x12')]('../api/userProfileSection/userProfileSection.model');db[_0x0a9e('0xf4')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/userProfileResource/userProfileResource.model');db[_0x0a9e('0xf5')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xf6'));db[_0x0a9e('0xf7')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xf8'));db[_0x0a9e('0xf9')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xfa'));db[_0x0a9e('0xfb')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xfc'));db[_0x0a9e('0xfd')]=db[_0x0a9e('0x1')]['import']('../api/whatsappMessage/whatsappMessage.model');db[_0x0a9e('0xfe')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xff'));db['WhatsappTransferReport']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x100'));db[_0x0a9e('0x101')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x102'));db[_0x0a9e('0x103')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x104'));db[_0x0a9e('0x105')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x106'));db[_0x0a9e('0x107')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x108'));db[_0x0a9e('0x109')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x10a'));db['UserSetting']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/user-setting/user-setting.model');db[_0x0a9e('0x11')][_0x0a9e('0x10b')](db[_0x0a9e('0x10c')],{'as':'VoiceMail','onDelete':'cascade','foreignKey':'UserId'});db[_0x0a9e('0x11')][_0x0a9e('0x10b')](db['UserSetting'],{'as':_0x0a9e('0x10d'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x10f')});db['User'][_0x0a9e('0x110')](db[_0x0a9e('0x111')],{'as':_0x0a9e('0x112'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x2b')],{'as':_0x0a9e('0x113'),'foreignKey':_0x0a9e('0x10f')});db['User'][_0x0a9e('0x110')](db['VoiceExtension'],{'as':_0x0a9e('0x114'),'onDelete':_0x0a9e('0x10e'),'hooks':!![]});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x71')],{'as':_0x0a9e('0x115'),'foreignKey':'UserId'});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x116')],{'as':_0x0a9e('0x117'),'foreignKey':'UserId'});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x73')],{'as':_0x0a9e('0x73'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x5d')],{'as':_0x0a9e('0x118'),'foreignKey':_0x0a9e('0x10f')});db['User'][_0x0a9e('0x110')](db[_0x0a9e('0x64')],{'as':_0x0a9e('0x119'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x53')],{'as':_0x0a9e('0x11a'),'foreignKey':'UserId'});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x11b')],{'as':'FaxInteractions','foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x11c')],{'as':_0x0a9e('0x11d'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0xfb')],{'as':_0x0a9e('0x11e'),'foreignKey':'UserId'});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0xf5')],{'as':_0x0a9e('0x11f'),'foreignKey':_0x0a9e('0x120')});db[_0x0a9e('0x11')]['belongsTo'](db[_0x0a9e('0xf2')],{'as':'UserProfile','foreignKey':'userProfileId'});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0x68')],{'as':_0x0a9e('0x122'),'through':_0x0a9e('0x123')});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x125'),'through':_0x0a9e('0x126')});db[_0x0a9e('0x11')]['belongsToMany'](db['CmList'],{'as':_0x0a9e('0x127'),'through':_0x0a9e('0x128')});db[_0x0a9e('0x11')]['belongsToMany'](db[_0x0a9e('0x129')],{'through':_0x0a9e('0x12a')});db[_0x0a9e('0x11')]['belongsToMany'](db[_0x0a9e('0x11c')],{'as':_0x0a9e('0x11d'),'through':_0x0a9e('0x12b')});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0x64')],{'as':_0x0a9e('0x119'),'through':'user_has_chat_interactions'});db['User']['belongsToMany'](db[_0x0a9e('0x11b')],{'as':_0x0a9e('0x12c'),'through':_0x0a9e('0x12d')});db[_0x0a9e('0x11')]['belongsToMany'](db[_0x0a9e('0x53')],{'as':'SmsInteractions','through':_0x0a9e('0x12e')});db[_0x0a9e('0x11')][_0x0a9e('0x121')](db['OpenchannelInteraction'],{'as':_0x0a9e('0x118'),'through':_0x0a9e('0x12f')});db[_0x0a9e('0x11')]['belongsToMany'](db[_0x0a9e('0xfb')],{'as':'WhatsappInteractions','through':_0x0a9e('0x130')});db['User'][_0x0a9e('0x121')](db['VoiceQueue'],{'as':_0x0a9e('0x131'),'through':_0x0a9e('0x2d'),'required':![]});db[_0x0a9e('0x11')][_0x0a9e('0x121')](db[_0x0a9e('0xf1')],{'as':_0x0a9e('0x132'),'through':_0x0a9e('0x109'),'required':![]});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0x3c')],{'as':'MailQueues','through':_0x0a9e('0x30'),'required':![]});db[_0x0a9e('0x11')]['belongsToMany'](db[_0x0a9e('0x67')],{'as':_0x0a9e('0x133'),'through':_0x0a9e('0x134'),'required':![],'hooks':!![]});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0x4c')],{'as':_0x0a9e('0x135'),'through':_0x0a9e('0x32'),'required':![]});db[_0x0a9e('0x11')][_0x0a9e('0x121')](db[_0x0a9e('0x57')],{'as':_0x0a9e('0x136'),'through':_0x0a9e('0x34'),'required':![]});db[_0x0a9e('0x11')]['belongsToMany'](db[_0x0a9e('0x137')],{'as':'OpenchannelQueues','through':_0x0a9e('0x35'),'required':![]});db[_0x0a9e('0x11')][_0x0a9e('0x121')](db[_0x0a9e('0x101')],{'as':_0x0a9e('0x138'),'through':_0x0a9e('0x37'),'required':![]});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0x139')],{'through':_0x0a9e('0x128')});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0x60')],{'as':_0x0a9e('0x13a'),'through':_0x0a9e('0x13b')});db[_0x0a9e('0x11')][_0x0a9e('0x121')](db[_0x0a9e('0x45')],{'as':'FaxAccounts','through':_0x0a9e('0x13c')});db[_0x0a9e('0x11')][_0x0a9e('0x121')](db[_0x0a9e('0x3b')],{'as':_0x0a9e('0x13d'),'through':_0x0a9e('0x13e')});db[_0x0a9e('0x11')]['belongsToMany'](db['OpenchannelAccount'],{'as':_0x0a9e('0x13f'),'through':_0x0a9e('0x140')});db[_0x0a9e('0x11')][_0x0a9e('0x121')](db[_0x0a9e('0x50')],{'as':_0x0a9e('0x141'),'through':_0x0a9e('0x142')});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0xf7')],{'as':_0x0a9e('0x143'),'through':_0x0a9e('0x144')});db[_0x0a9e('0x13')][_0x0a9e('0x110')](db[_0x0a9e('0x16')],{'as':'SpiedAgents','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x145')});db[_0x0a9e('0x146')]['hasMany'](db[_0x0a9e('0x16')],{'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x16')][_0x0a9e('0x110')](db['VoiceExtension'],{'as':_0x0a9e('0x147'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x18')][_0x0a9e('0x121')](db[_0x0a9e('0x84')],{'as':_0x0a9e('0x148'),'through':_0x0a9e('0x149')});db[_0x0a9e('0x1a')]['hasMany'](db[_0x0a9e('0x2b')],{'as':_0x0a9e('0x14a'),'foreignKey':_0x0a9e('0x14b')});db[_0x0a9e('0x1a')]['hasMany'](db['CmHopper'],{'as':_0x0a9e('0x14c'),'foreignKey':_0x0a9e('0x14b')});db[_0x0a9e('0x1a')]['hasMany'](db[_0x0a9e('0x71')],{'as':_0x0a9e('0x115'),'foreignKey':'VoiceQueueId'});db[_0x0a9e('0x1a')]['hasMany'](db[_0x0a9e('0x116')],{'as':'HopperHistories','foreignKey':'VoiceQueueId'});db['VoiceQueue'][_0x0a9e('0x110')](db[_0x0a9e('0x73')],{'as':_0x0a9e('0x73'),'foreignKey':_0x0a9e('0x14b')});db[_0x0a9e('0x1a')][_0x0a9e('0x110')](db['CmHopperBlack'],{'as':_0x0a9e('0x14d'),'foreignKey':_0x0a9e('0x14b')});db[_0x0a9e('0x1a')][_0x0a9e('0x110')](db[_0x0a9e('0xd0')],{'as':_0x0a9e('0x14e'),'foreignKey':_0x0a9e('0x14b')});db['VoiceQueue']['belongsTo'](db[_0x0a9e('0x28')],{'as':'Trunk','foreignKey':_0x0a9e('0x14f')});db[_0x0a9e('0x1a')][_0x0a9e('0x150')](db[_0x0a9e('0x28')],{'as':_0x0a9e('0x151'),'foreignKey':_0x0a9e('0x152')});db['VoiceQueue'][_0x0a9e('0x150')](db['Interval'],{'as':'Interval','foreignKey':_0x0a9e('0x153')});db['VoiceQueue'][_0x0a9e('0x150')](db['Pause'],{'as':'mandatoryDispositionPause','foreignKey':_0x0a9e('0x154')});db['VoiceQueue'][_0x0a9e('0x121')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x127'),'through':'voice_queues_has_cm_lists'});db[_0x0a9e('0x1a')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':'Agents','through':'UserVoiceQueue'});db[_0x0a9e('0x1a')][_0x0a9e('0x121')](db[_0x0a9e('0x129')],{'as':_0x0a9e('0x155'),'through':_0x0a9e('0x105')});db[_0x0a9e('0x1a')][_0x0a9e('0x121')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x156'),'through':_0x0a9e('0x157')});db['VoiceRecording']['belongsTo'](db['User'],{'as':_0x0a9e('0x11'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x1c')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x11'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x10c')]['hasMany'](db['VoiceMailMessage'],{'as':_0x0a9e('0x158'),'onDelete':_0x0a9e('0x10e'),'foreignKey':'mailboxuser','sourceKey':_0x0a9e('0x159')});db[_0x0a9e('0x1f')][_0x0a9e('0x150')](db[_0x0a9e('0x10c')],{'foreignKey':_0x0a9e('0x15a'),'targetKey':_0x0a9e('0x159')});db[_0x0a9e('0x15b')][_0x0a9e('0x110')](db[_0x0a9e('0x25')],{'as':_0x0a9e('0x15c'),'foreignKey':_0x0a9e('0x15d'),'constraints':![]});db[_0x0a9e('0x15b')]['hasMany'](db[_0x0a9e('0x15e')],{'as':_0x0a9e('0x15f'),'foreignKey':_0x0a9e('0x15d'),'constraints':![]});db[_0x0a9e('0x15b')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x11'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x15b')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':'ContactId'});db['MailServerIn'][_0x0a9e('0x150')](db[_0x0a9e('0x3b')],{'as':_0x0a9e('0x3b'),'foreignKey':_0x0a9e('0x161')});db[_0x0a9e('0x39')][_0x0a9e('0x150')](db[_0x0a9e('0x103')],{'as':'CloudProvider','foreignKey':_0x0a9e('0x162'),'onDelete':'restrict'});db[_0x0a9e('0x163')][_0x0a9e('0x150')](db[_0x0a9e('0x3b')],{'as':_0x0a9e('0x3b'),'foreignKey':_0x0a9e('0x161')});db[_0x0a9e('0x163')][_0x0a9e('0x150')](db[_0x0a9e('0x103')],{'as':_0x0a9e('0x103'),'foreignKey':_0x0a9e('0x162'),'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x3b')][_0x0a9e('0x10b')](db[_0x0a9e('0x39')],{'as':_0x0a9e('0x165'),'onDelete':_0x0a9e('0x10e')});db['MailAccount']['hasOne'](db[_0x0a9e('0x163')],{'as':_0x0a9e('0x166'),'onDelete':'cascade'});db['MailAccount'][_0x0a9e('0x110')](db[_0x0a9e('0x167')],{'as':_0x0a9e('0x168'),'foreignKey':'MailAccountId','onDelete':_0x0a9e('0x10e')});db['MailAccount'][_0x0a9e('0x110')](db['CannedAnswer'],{'as':_0x0a9e('0x169'),'foreignKey':'MailAccountId'});db[_0x0a9e('0x3b')][_0x0a9e('0x110')](db[_0x0a9e('0x3e')],{'as':'Messages','foreignKey':_0x0a9e('0x161')});db['MailAccount']['hasMany'](db[_0x0a9e('0x11c')],{'as':_0x0a9e('0x16a')});db[_0x0a9e('0x3b')][_0x0a9e('0x110')](db[_0x0a9e('0x16b')],{'as':_0x0a9e('0x147'),'foreignKey':_0x0a9e('0x161'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x3b')][_0x0a9e('0x150')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x3b')][_0x0a9e('0x150')](db[_0x0a9e('0x8b')],{'as':_0x0a9e('0x8b'),'foreignKey':_0x0a9e('0x16e')});db[_0x0a9e('0x3b')]['belongsTo'](db[_0x0a9e('0x7d')],{'as':_0x0a9e('0x16f'),'foreignKey':_0x0a9e('0x154')});db[_0x0a9e('0x3b')]['belongsToMany'](db['User'],{'as':'Agents','through':_0x0a9e('0x13e')});db['MailQueue'][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':_0x0a9e('0x30')});db[_0x0a9e('0x3c')][_0x0a9e('0x121')](db[_0x0a9e('0x129')],{'through':_0x0a9e('0x171'),'as':_0x0a9e('0x155')});db[_0x0a9e('0x11c')]['hasMany'](db[_0x0a9e('0x3e')],{'as':'Messages','onDelete':_0x0a9e('0x10e'),'foreignKey':'MailInteractionId'});db[_0x0a9e('0x11c')][_0x0a9e('0x150')](db[_0x0a9e('0x3b')],{'as':'Account','foreignKey':_0x0a9e('0x161')});db[_0x0a9e('0x11c')]['belongsTo'](db['CmContact'],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x11c')]['belongsTo'](db['User'],{'as':'Owner','foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x11c')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x173'),'as':_0x0a9e('0x174')});db[_0x0a9e('0x11c')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x173'),'as':_0x0a9e('0x175')});db[_0x0a9e('0x11c')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x176'),'through':_0x0a9e('0x12b'),'foreignKey':_0x0a9e('0x177')});db[_0x0a9e('0x3e')]['hasMany'](db[_0x0a9e('0xe4')],{'as':_0x0a9e('0x178'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x3e')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':'User'});db[_0x0a9e('0x3e')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'onDelete':_0x0a9e('0x10e'),'as':_0x0a9e('0x160')});db[_0x0a9e('0x3e')][_0x0a9e('0x150')](db[_0x0a9e('0x11c')],{'as':_0x0a9e('0x179'),'foreignKey':'MailInteractionId'});db['MailMessage'][_0x0a9e('0x150')](db[_0x0a9e('0x3b')],{'as':'Account','foreignKey':_0x0a9e('0x161')});db[_0x0a9e('0x3e')]['belongsTo'](db[_0x0a9e('0x60')],{'as':'ChatWebsite','foreignKey':_0x0a9e('0x17a')});db[_0x0a9e('0x3e')]['belongsTo'](db[_0x0a9e('0x66')],{'as':_0x0a9e('0x66'),'foreignKey':'ChatOfflineMessageId'});db[_0x0a9e('0x16b')][_0x0a9e('0x150')](db['User'],{'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x16b')][_0x0a9e('0x150')](db[_0x0a9e('0x3c')],{'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x16b')]['belongsTo'](db[_0x0a9e('0x3b')],{'onDelete':_0x0a9e('0x164')});db['MailApplication'][_0x0a9e('0x150')](db[_0x0a9e('0x17b')],{'onDelete':_0x0a9e('0x164'),'foreignKey':_0x0a9e('0x153')});db[_0x0a9e('0x16b')][_0x0a9e('0x150')](db[_0x0a9e('0x86')],{'onDelete':'restrict','foreignKey':'TagId'});db['MailQueueReport']['belongsTo'](db['MailAccount'],{});db[_0x0a9e('0x17c')][_0x0a9e('0x150')](db['CmList'],{'as':'List','foreignKey':_0x0a9e('0x16d')});db['MailQueueReport'][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x17c')][_0x0a9e('0x150')](db['MailInteraction'],{});db[_0x0a9e('0x17c')][_0x0a9e('0x150')](db['MailMessage'],{});db[_0x0a9e('0x17c')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{});db[_0x0a9e('0x17c')][_0x0a9e('0x150')](db[_0x0a9e('0x3c')],{});db[_0x0a9e('0x17d')]['hasMany'](db[_0x0a9e('0x43')],{'as':'Items','onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x45')]['hasMany'](db[_0x0a9e('0x167')],{'as':_0x0a9e('0x168'),'foreignKey':'FaxAccountId','onDelete':_0x0a9e('0x10e')});db['FaxAccount'][_0x0a9e('0x110')](db[_0x0a9e('0x17e')],{'as':'Answers','foreignKey':_0x0a9e('0x17f')});db['FaxAccount'][_0x0a9e('0x110')](db[_0x0a9e('0x11b')],{'as':_0x0a9e('0x16a')});db[_0x0a9e('0x45')][_0x0a9e('0x110')](db[_0x0a9e('0x47')],{'as':_0x0a9e('0x147'),'foreignKey':'FaxAccountId','onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x45')][_0x0a9e('0x110')](db[_0x0a9e('0x16')],{'as':_0x0a9e('0x180'),'onDelete':'cascade'});db[_0x0a9e('0x45')]['hasMany'](db['FaxMessage'],{'as':_0x0a9e('0x158')});db['FaxAccount'][_0x0a9e('0x150')](db[_0x0a9e('0x28')],{'as':'Trunk'});db[_0x0a9e('0x45')][_0x0a9e('0x150')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x45')][_0x0a9e('0x150')](db[_0x0a9e('0x7d')],{'as':_0x0a9e('0x16f'),'foreignKey':'mandatoryDispositionPauseId'});db[_0x0a9e('0x45')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':'user_has_fax_accounts'});db[_0x0a9e('0x47')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'onDelete':'restrict'});db[_0x0a9e('0x47')][_0x0a9e('0x150')](db[_0x0a9e('0x4c')],{'onDelete':'restrict'});db[_0x0a9e('0x47')]['belongsTo'](db[_0x0a9e('0x45')],{'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x47')][_0x0a9e('0x150')](db[_0x0a9e('0x86')],{'onDelete':_0x0a9e('0x164'),'foreignKey':_0x0a9e('0x181')});db['FaxInteraction'][_0x0a9e('0x110')](db[_0x0a9e('0x4a')],{'as':_0x0a9e('0x158'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x182')});db[_0x0a9e('0x11b')][_0x0a9e('0x150')](db[_0x0a9e('0x45')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x17f')});db[_0x0a9e('0x11b')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x11b')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x184'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x11b')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'through':'fax_interaction_has_tags','as':_0x0a9e('0x174')});db[_0x0a9e('0x11b')][_0x0a9e('0x121')](db['Tag'],{'through':_0x0a9e('0x185'),'as':'ThroughTags'});db[_0x0a9e('0x11b')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x176'),'through':_0x0a9e('0x12d'),'foreignKey':_0x0a9e('0x182')});db[_0x0a9e('0x4a')][_0x0a9e('0x150')](db['User'],{'onDelete':_0x0a9e('0x10e'),'as':_0x0a9e('0x11')});db['FaxMessage'][_0x0a9e('0x150')](db[_0x0a9e('0x11b')],{'as':_0x0a9e('0x179'),'foreignKey':'FaxInteractionId'});db[_0x0a9e('0x4a')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'onDelete':_0x0a9e('0x10e'),'as':'Contact'});db[_0x0a9e('0x4a')][_0x0a9e('0x150')](db[_0x0a9e('0xe4')],{'as':_0x0a9e('0xe4'),'foreignKey':_0x0a9e('0x186')});db['FaxMessage'][_0x0a9e('0x150')](db[_0x0a9e('0x45')],{'as':'Account','foreignKey':_0x0a9e('0x17f')});db[_0x0a9e('0x4c')][_0x0a9e('0x121')](db['User'],{'as':'Agents','through':_0x0a9e('0x32')});db[_0x0a9e('0x4c')][_0x0a9e('0x121')](db[_0x0a9e('0x129')],{'through':_0x0a9e('0x187'),'as':_0x0a9e('0x155')});db[_0x0a9e('0x4e')][_0x0a9e('0x150')](db['FaxAccount'],{});db['FaxQueueReport'][_0x0a9e('0x150')](db['CmList'],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x4e')][_0x0a9e('0x150')](db['CmContact'],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db['FaxQueueReport'][_0x0a9e('0x150')](db['FaxInteraction'],{});db[_0x0a9e('0x4e')][_0x0a9e('0x150')](db[_0x0a9e('0x4a')],{});db[_0x0a9e('0x4e')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{});db['FaxQueueReport'][_0x0a9e('0x150')](db['FaxQueue'],{});db[_0x0a9e('0x50')][_0x0a9e('0x110')](db[_0x0a9e('0x167')],{'as':_0x0a9e('0x168'),'foreignKey':_0x0a9e('0x188'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x50')]['hasMany'](db[_0x0a9e('0x17e')],{'as':_0x0a9e('0x169'),'foreignKey':_0x0a9e('0x188')});db[_0x0a9e('0x50')][_0x0a9e('0x110')](db['SmsMessage'],{'as':_0x0a9e('0x158'),'foreignKey':_0x0a9e('0x188')});db['SmsAccount']['hasMany'](db[_0x0a9e('0x53')],{'as':_0x0a9e('0x16a')});db[_0x0a9e('0x50')][_0x0a9e('0x110')](db[_0x0a9e('0x52')],{'as':_0x0a9e('0x147'),'foreignKey':'SmsAccountId','onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x50')][_0x0a9e('0x150')](db['CmList'],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x50')][_0x0a9e('0x150')](db['Pause'],{'as':'mandatoryDispositionPause','foreignKey':_0x0a9e('0x154')});db[_0x0a9e('0x50')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':_0x0a9e('0x142')});db[_0x0a9e('0x52')][_0x0a9e('0x150')](db['User'],{'onDelete':_0x0a9e('0x164')});db['SmsApplication'][_0x0a9e('0x150')](db[_0x0a9e('0x57')],{'onDelete':_0x0a9e('0x164')});db['SmsApplication']['belongsTo'](db[_0x0a9e('0x50')],{'onDelete':'restrict'});db[_0x0a9e('0x52')]['belongsTo'](db['Interval'],{'onDelete':_0x0a9e('0x164'),'foreignKey':_0x0a9e('0x153')});db[_0x0a9e('0x52')][_0x0a9e('0x150')](db[_0x0a9e('0x86')],{'onDelete':_0x0a9e('0x164'),'foreignKey':_0x0a9e('0x181')});db[_0x0a9e('0x53')][_0x0a9e('0x110')](db[_0x0a9e('0x55')],{'as':_0x0a9e('0x158'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x189')});db['SmsInteraction']['belongsTo'](db[_0x0a9e('0x50')],{'as':'Account','foreignKey':_0x0a9e('0x188')});db[_0x0a9e('0x53')][_0x0a9e('0x150')](db['CmContact'],{'as':'Contact','foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x53')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x184'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x53')]['belongsToMany'](db[_0x0a9e('0x86')],{'through':'sms_interaction_has_tags','as':_0x0a9e('0x174')});db[_0x0a9e('0x53')]['belongsToMany'](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x18a'),'as':_0x0a9e('0x175')});db[_0x0a9e('0x53')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':'Users','through':_0x0a9e('0x12e'),'foreignKey':_0x0a9e('0x189')});db[_0x0a9e('0x55')]['belongsTo'](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x11')});db[_0x0a9e('0x55')]['belongsTo'](db[_0x0a9e('0x124')],{'onDelete':_0x0a9e('0x10e'),'as':_0x0a9e('0x160')});db[_0x0a9e('0x55')][_0x0a9e('0x150')](db[_0x0a9e('0x53')],{'onDelete':'cascade','as':'Interaction','foreignKey':_0x0a9e('0x189')});db[_0x0a9e('0x55')]['belongsTo'](db[_0x0a9e('0x50')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x188')});db[_0x0a9e('0x57')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':'Agents','through':_0x0a9e('0x34'),'foreignKey':_0x0a9e('0x18b')});db[_0x0a9e('0x57')]['belongsToMany'](db[_0x0a9e('0x129')],{'through':_0x0a9e('0x18c'),'as':_0x0a9e('0x155')});db[_0x0a9e('0x59')]['hasMany'](db['Disposition'],{'as':_0x0a9e('0x168'),'foreignKey':_0x0a9e('0x18d'),'onDelete':_0x0a9e('0x10e')});db['OpenchannelAccount'][_0x0a9e('0x110')](db[_0x0a9e('0x17e')],{'as':_0x0a9e('0x169'),'foreignKey':_0x0a9e('0x18d')});db[_0x0a9e('0x59')][_0x0a9e('0x110')](db[_0x0a9e('0x5d')],{'as':_0x0a9e('0x16a'),'foreignKey':'OpenchannelAccountId'});db['OpenchannelAccount'][_0x0a9e('0x110')](db[_0x0a9e('0x5e')],{'as':'Messages','foreignKey':_0x0a9e('0x18d')});db['OpenchannelAccount'][_0x0a9e('0x110')](db[_0x0a9e('0x5b')],{'as':'Applications','foreignKey':_0x0a9e('0x18d'),'onDelete':_0x0a9e('0x10e')});db['OpenchannelAccount'][_0x0a9e('0x150')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x59')][_0x0a9e('0x150')](db[_0x0a9e('0x7d')],{'as':'mandatoryDispositionPause','foreignKey':_0x0a9e('0x154')});db[_0x0a9e('0x59')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':_0x0a9e('0x140')});db[_0x0a9e('0x5b')]['belongsTo'](db['User'],{'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x5b')][_0x0a9e('0x150')](db['OpenchannelQueue'],{'onDelete':'restrict','foreignKey':_0x0a9e('0x18e')});db['OpenchannelApplication'][_0x0a9e('0x150')](db[_0x0a9e('0x59')],{'onDelete':_0x0a9e('0x164'),'foreignKey':_0x0a9e('0x18d')});db[_0x0a9e('0x5b')][_0x0a9e('0x150')](db[_0x0a9e('0x17b')],{'onDelete':_0x0a9e('0x164'),'foreignKey':_0x0a9e('0x153')});db['OpenchannelApplication']['belongsTo'](db[_0x0a9e('0x86')],{'onDelete':'restrict','foreignKey':_0x0a9e('0x181')});db[_0x0a9e('0x5d')][_0x0a9e('0x110')](db[_0x0a9e('0x5e')],{'as':'Messages','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x18f')});db[_0x0a9e('0x5d')]['belongsTo'](db[_0x0a9e('0x59')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x18d')});db['OpenchannelInteraction'][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x5d')][_0x0a9e('0x150')](db['User'],{'as':'Owner','foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x5d')][_0x0a9e('0x121')](db['Tag'],{'through':'openchannel_interaction_has_tags','as':_0x0a9e('0x174')});db[_0x0a9e('0x5d')][_0x0a9e('0x121')](db['Tag'],{'through':'openchannel_interaction_has_tags','as':_0x0a9e('0x175')});db[_0x0a9e('0x5d')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x176'),'through':'user_has_openchannel_interactions','foreignKey':_0x0a9e('0x18f')});db['OpenchannelMessage'][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'onDelete':'cascade','as':_0x0a9e('0x11')});db['OpenchannelMessage'][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'onDelete':_0x0a9e('0x10e'),'as':_0x0a9e('0x160')});db[_0x0a9e('0x5e')]['belongsTo'](db[_0x0a9e('0x5d')],{'onDelete':_0x0a9e('0x10e'),'as':_0x0a9e('0x179'),'foreignKey':'OpenchannelInteractionId'});db[_0x0a9e('0x5e')]['belongsTo'](db[_0x0a9e('0xe4')],{'as':_0x0a9e('0xe4'),'foreignKey':_0x0a9e('0x186')});db['OpenchannelMessage'][_0x0a9e('0x150')](db[_0x0a9e('0x59')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x18d')});db[_0x0a9e('0x137')][_0x0a9e('0x121')](db['User'],{'as':_0x0a9e('0x170'),'through':_0x0a9e('0x35'),'foreignKey':_0x0a9e('0x18e')});db[_0x0a9e('0x137')][_0x0a9e('0x121')](db[_0x0a9e('0x129')],{'through':_0x0a9e('0x190'),'as':_0x0a9e('0x155')});db['ChatWebsite'][_0x0a9e('0x110')](db[_0x0a9e('0x167')],{'as':_0x0a9e('0x168'),'foreignKey':_0x0a9e('0x17a'),'onDelete':'cascade'});db[_0x0a9e('0x60')]['hasMany'](db[_0x0a9e('0x17e')],{'as':_0x0a9e('0x169'),'foreignKey':_0x0a9e('0x17a')});db['ChatWebsite'][_0x0a9e('0x110')](db[_0x0a9e('0x191')],{'as':_0x0a9e('0x192')});db[_0x0a9e('0x60')]['hasMany'](db[_0x0a9e('0x64')],{'as':_0x0a9e('0x16a')});db[_0x0a9e('0x60')][_0x0a9e('0x110')](db[_0x0a9e('0x63')],{'as':_0x0a9e('0x147'),'foreignKey':_0x0a9e('0x17a'),'onDelete':'cascade'});db[_0x0a9e('0x60')][_0x0a9e('0x110')](db[_0x0a9e('0x65')],{'as':_0x0a9e('0x158')});db['ChatWebsite'][_0x0a9e('0x150')](db['CmList'],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x60')][_0x0a9e('0x150')](db[_0x0a9e('0x17b')],{'as':_0x0a9e('0x17b'),'foreignKey':_0x0a9e('0x153')});db['ChatWebsite'][_0x0a9e('0x150')](db['MailAccount'],{'as':_0x0a9e('0x3b'),'foreignKey':_0x0a9e('0x161')});db['ChatWebsite'][_0x0a9e('0x150')](db[_0x0a9e('0x7d')],{'as':_0x0a9e('0x16f'),'foreignKey':_0x0a9e('0x154')});db['ChatWebsite'][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':'Agents','through':_0x0a9e('0x13b')});db['OpenchannelQueueReport']['belongsTo'](db['OpenchannelAccount'],{});db[_0x0a9e('0x62')][_0x0a9e('0x150')](db['CmList'],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db['OpenchannelQueueReport'][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x62')][_0x0a9e('0x150')](db[_0x0a9e('0x5d')],{});db['OpenchannelQueueReport'][_0x0a9e('0x150')](db['OpenchannelMessage'],{});db[_0x0a9e('0x62')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{});db[_0x0a9e('0x62')][_0x0a9e('0x150')](db[_0x0a9e('0x137')],{});db['ChatApplication'][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x193'),'foreignKey':'UserId','onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x63')][_0x0a9e('0x150')](db[_0x0a9e('0x67')],{'as':_0x0a9e('0x194'),'foreignKey':_0x0a9e('0x195'),'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x63')][_0x0a9e('0x150')](db[_0x0a9e('0x60')],{'as':_0x0a9e('0x196'),'foreignKey':_0x0a9e('0x17a'),'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x63')][_0x0a9e('0x150')](db[_0x0a9e('0x86')],{'onDelete':'restrict','foreignKey':_0x0a9e('0x181')});db[_0x0a9e('0x64')][_0x0a9e('0x110')](db['ChatMessage'],{'as':_0x0a9e('0x158'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x197')});db[_0x0a9e('0x64')]['belongsTo'](db[_0x0a9e('0x60')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x17a')});db[_0x0a9e('0x64')]['belongsTo'](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x64')]['belongsTo'](db['User'],{'as':_0x0a9e('0x184'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x64')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x198'),'as':_0x0a9e('0x174')});db[_0x0a9e('0x64')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x198'),'as':_0x0a9e('0x175')});db[_0x0a9e('0x64')][_0x0a9e('0x121')](db['User'],{'as':_0x0a9e('0x176'),'through':_0x0a9e('0x199'),'foreignKey':_0x0a9e('0x197')});db['ChatMessage']['belongsTo'](db[_0x0a9e('0x11')],{'onDelete':'cascade','as':_0x0a9e('0x11')});db[_0x0a9e('0x65')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'onDelete':'cascade','as':'Contact','foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x65')][_0x0a9e('0x150')](db[_0x0a9e('0x64')],{'onDelete':'cascade','as':_0x0a9e('0x179'),'foreignKey':_0x0a9e('0x197')});db[_0x0a9e('0x65')][_0x0a9e('0x150')](db[_0x0a9e('0xe4')],{'as':'Attachment','foreignKey':'AttachmentId'});db[_0x0a9e('0x65')][_0x0a9e('0x150')](db[_0x0a9e('0x60')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x17a')});db[_0x0a9e('0x66')][_0x0a9e('0x110')](db['Attachment'],{'as':_0x0a9e('0x178'),'foreignKey':_0x0a9e('0x19a'),'onDelete':_0x0a9e('0x10e'),'hooks':!![]});db['ChatOfflineMessage']['belongsTo'](db['CmContact'],{'onDelete':_0x0a9e('0x10e'),'as':_0x0a9e('0x160'),'foreignKey':'ContactId'});db[_0x0a9e('0x66')][_0x0a9e('0x150')](db[_0x0a9e('0x60')],{'as':'Account','foreignKey':'ChatWebsiteId'});db[_0x0a9e('0x67')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':'UserChatQueue','hooks':!![]});db[_0x0a9e('0x67')]['belongsToMany'](db['Team'],{'through':_0x0a9e('0x19b'),'as':'Teams'});db[_0x0a9e('0x68')][_0x0a9e('0x110')](db[_0x0a9e('0xcc')],{'as':'Messages','foreignKey':_0x0a9e('0x19c'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x68')]['belongsToMany'](db['User'],{'as':_0x0a9e('0x14a'),'through':_0x0a9e('0x123')});db[_0x0a9e('0x191')][_0x0a9e('0x150')](db[_0x0a9e('0x60')],{'as':_0x0a9e('0x196'),'foreignKey':'ChatWebsiteId'});db['CmCompany'][_0x0a9e('0x110')](db[_0x0a9e('0x124')],{'as':'Contacts','foreignKey':'CompanyId'});db['CmContact']['hasMany'](db['CmContactHasItem'],{'as':'Phones','foreignKey':_0x0a9e('0x19d')});db['CmContact'][_0x0a9e('0x110')](db[_0x0a9e('0x6d')],{'as':_0x0a9e('0x14c'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x124')][_0x0a9e('0x110')](db[_0x0a9e('0x71')],{'as':'HopperFinals','foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x124')][_0x0a9e('0x110')](db[_0x0a9e('0x116')],{'as':_0x0a9e('0x19e'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x124')][_0x0a9e('0x110')](db[_0x0a9e('0x73')],{'as':_0x0a9e('0x73'),'foreignKey':_0x0a9e('0x172')});db['CmContact'][_0x0a9e('0x110')](db[_0x0a9e('0xd0')],{'as':'JscriptySessions','foreignKey':_0x0a9e('0x172')});db['CmContact'][_0x0a9e('0x110')](db[_0x0a9e('0x5d')],{'as':'OpenchannelInteractions','foreignKey':'ContactId','onDelete':_0x0a9e('0x164')});db['CmContact'][_0x0a9e('0x110')](db[_0x0a9e('0x64')],{'as':_0x0a9e('0x119'),'foreignKey':_0x0a9e('0x172'),'onDelete':_0x0a9e('0x164')});db['CmContact'][_0x0a9e('0x110')](db['SmsInteraction'],{'as':'SmsInteractions','foreignKey':_0x0a9e('0x172'),'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x124')][_0x0a9e('0x110')](db[_0x0a9e('0x11b')],{'as':'FaxInteractions','foreignKey':_0x0a9e('0x172'),'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x124')][_0x0a9e('0x110')](db['MailInteraction'],{'as':_0x0a9e('0x11d'),'foreignKey':_0x0a9e('0x172'),'onDelete':'restrict'});db[_0x0a9e('0x124')][_0x0a9e('0x150')](db[_0x0a9e('0x19f')],{'as':_0x0a9e('0x1a0'),'foreignKey':'CompanyId'});db[_0x0a9e('0x124')][_0x0a9e('0x150')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d'),'onDelete':'cascade'});db[_0x0a9e('0x124')][_0x0a9e('0x121')](db['User'],{'as':_0x0a9e('0x176'),'through':'cm_user_has_contacts'});db[_0x0a9e('0x124')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'as':_0x0a9e('0x174'),'through':_0x0a9e('0x1a1')});db[_0x0a9e('0x124')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x1a1'),'as':_0x0a9e('0x175')});db[_0x0a9e('0x6d')][_0x0a9e('0x110')](db[_0x0a9e('0x1a2')],{'as':_0x0a9e('0x1a3'),'foreignKey':_0x0a9e('0x1a4')});db['CmHopper'][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x6d')][_0x0a9e('0x150')](db[_0x0a9e('0x139')],{'as':'List','foreignKey':'ListId','onDelete':'cascade'});db['CmHopper'][_0x0a9e('0x150')](db['User'],{'as':'Agent','foreignKey':'UserId'});db[_0x0a9e('0x6d')][_0x0a9e('0x150')](db[_0x0a9e('0x1a')],{'as':_0x0a9e('0x194'),'foreignKey':'VoiceQueueId','onDelete':'cascade'});db[_0x0a9e('0x6d')][_0x0a9e('0x150')](db[_0x0a9e('0x1a5')],{'as':_0x0a9e('0x1a5'),'foreignKey':'CampaignId','onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x6d')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x184'),'foreignKey':_0x0a9e('0x1a6')});db['CmHopperBlack'][_0x0a9e('0x150')](db['CmContact'],{'as':'Contact','foreignKey':_0x0a9e('0x172'),'onDelete':'cascade'});db[_0x0a9e('0x6f')][_0x0a9e('0x150')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x6f')][_0x0a9e('0x150')](db[_0x0a9e('0x1a')],{'as':'Queue','foreignKey':_0x0a9e('0x14b'),'onDelete':_0x0a9e('0x10e')});db['CmHopperBlack'][_0x0a9e('0x150')](db[_0x0a9e('0x1a5')],{'as':_0x0a9e('0x1a5'),'foreignKey':_0x0a9e('0x1a7'),'onDelete':'cascade'});db[_0x0a9e('0x76')][_0x0a9e('0x110')](db[_0x0a9e('0x7a')],{'as':{'plural':_0x0a9e('0x1a8'),'singular':_0x0a9e('0x1a9')},'foreignKey':'AutomationAllId','onDelete':'cascade','hooks':!![]});db[_0x0a9e('0x76')]['hasMany'](db[_0x0a9e('0x7a')],{'as':{'plural':'Any','singular':_0x0a9e('0x1aa')},'foreignKey':'AutomationAnyId','onDelete':_0x0a9e('0x10e'),'hooks':!![]});db['Automation'][_0x0a9e('0x110')](db[_0x0a9e('0x74')],{'as':_0x0a9e('0x1ab'),'foreignKey':'AutomationId','onDelete':'cascade','hooks':!![]});db[_0x0a9e('0x167')]['hasMany'](db[_0x0a9e('0x167')],{'as':'Dispositions','foreignKey':_0x0a9e('0x1ac'),'onDelete':'cascade'});db[_0x0a9e('0x17b')][_0x0a9e('0x110')](db['Interval'],{'as':_0x0a9e('0x1ad'),'foreignKey':_0x0a9e('0x153'),'onDelete':_0x0a9e('0x10e'),'hooks':!![],'required':![]});db[_0x0a9e('0x17b')][_0x0a9e('0x110')](db[_0x0a9e('0x16')],{'as':_0x0a9e('0x114'),'foreignKey':_0x0a9e('0x153'),'onDelete':_0x0a9e('0x164')});db['Interval'][_0x0a9e('0x110')](db[_0x0a9e('0x16b')],{'as':_0x0a9e('0x1ae'),'foreignKey':_0x0a9e('0x153')});db[_0x0a9e('0x17b')]['hasMany'](db['ChatApplication'],{'as':_0x0a9e('0x1af'),'foreignKey':'IntervalId'});db[_0x0a9e('0x17b')]['hasMany'](db[_0x0a9e('0x47')],{'as':_0x0a9e('0x1b0'),'foreignKey':_0x0a9e('0x153')});db[_0x0a9e('0x17b')][_0x0a9e('0x110')](db[_0x0a9e('0x52')],{'as':_0x0a9e('0x1b1'),'foreignKey':'IntervalId'});db['Schedule'][_0x0a9e('0x150')](db[_0x0a9e('0x3b')],{});db['Schedule'][_0x0a9e('0x150')](db[_0x0a9e('0x94')],{'foreignKey':_0x0a9e('0x1b2')});db['Schedule']['belongsTo'](db['AnalyticCustomReport'],{'foreignKey':_0x0a9e('0x1b3')});db[_0x0a9e('0x84')][_0x0a9e('0x121')](db[_0x0a9e('0x18')],{'as':'Mohs','through':_0x0a9e('0x149'),'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x86')]['belongsToMany'](db[_0x0a9e('0x124')],{'through':'cm_contact_has_tags'});db['Tag'][_0x0a9e('0x121')](db[_0x0a9e('0x64')],{'through':'chat_interaction_has_tags'});db['Tag'][_0x0a9e('0x121')](db['MailInteraction'],{'through':_0x0a9e('0x173')});db['Tag'][_0x0a9e('0x121')](db[_0x0a9e('0x53')],{'through':_0x0a9e('0x18a')});db['Tag']['belongsToMany'](db[_0x0a9e('0x11b')],{'through':_0x0a9e('0x185')});db[_0x0a9e('0x86')][_0x0a9e('0x121')](db['OpenchannelInteraction'],{'through':_0x0a9e('0x1b4')});db[_0x0a9e('0x86')]['belongsToMany'](db[_0x0a9e('0xfb')],{'through':_0x0a9e('0x1b5')});db[_0x0a9e('0x1b6')]['belongsTo'](db[_0x0a9e('0x88')],{'as':_0x0a9e('0x1b7'),'foreignKey':_0x0a9e('0x1b8')});db[_0x0a9e('0x1a2')][_0x0a9e('0x150')](db[_0x0a9e('0x6d')],{'as':_0x0a9e('0x1b9'),'foreignKey':_0x0a9e('0x1a4')});db[_0x0a9e('0x1b6')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x19d')});db[_0x0a9e('0x8d')][_0x0a9e('0x110')](db[_0x0a9e('0x7a')],{'as':{'plural':_0x0a9e('0x1ba'),'singular':_0x0a9e('0x1bb')},'foreignKey':_0x0a9e('0x1bc'),'onDelete':_0x0a9e('0x10e'),'hooks':!![]});db[_0x0a9e('0x8d')][_0x0a9e('0x110')](db['Condition'],{'as':{'plural':_0x0a9e('0x1bd'),'singular':_0x0a9e('0x1be')},'foreignKey':_0x0a9e('0x1bf'),'onDelete':'cascade','hooks':!![]});db[_0x0a9e('0x8d')][_0x0a9e('0x110')](db[_0x0a9e('0x74')],{'as':_0x0a9e('0x1ab'),'foreignKey':'TriggerId','onDelete':_0x0a9e('0x10e'),'hooks':!![]});db[_0x0a9e('0x1c0')]['hasMany'](db[_0x0a9e('0x99')],{'as':_0x0a9e('0x1c1'),'onDelete':_0x0a9e('0x10e'),'foreignKey':'CustomReportId','hooks':!![]});db['AnalyticDefaultReport'][_0x0a9e('0x110')](db[_0x0a9e('0x99')],{'as':_0x0a9e('0x1c1'),'onDelete':'cascade','foreignKey':'DefaultReportId'});db[_0x0a9e('0x98')][_0x0a9e('0x110')](db[_0x0a9e('0x99')],{'as':_0x0a9e('0x1c1'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c2')});db['AnalyticFieldReport']['belongsTo'](db[_0x0a9e('0x98')],{'foreignKey':_0x0a9e('0x1c2')});db[_0x0a9e('0x9c')]['hasMany'](db[_0x0a9e('0x9e')],{'as':_0x0a9e('0x1c3'),'onDelete':_0x0a9e('0x10e'),'foreignKey':'AccountId'});db['SalesforceConfiguration'][_0x0a9e('0x110')](db[_0x0a9e('0xa0')],{'as':_0x0a9e('0x1c4'),'onDelete':'cascade','foreignKey':'SubjectId'});db[_0x0a9e('0x9e')]['hasMany'](db['SalesforceField'],{'as':'Descriptions','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0x9e')]['hasMany'](db[_0x0a9e('0xa0')],{'as':_0x0a9e('0x1c1'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c6')});db['SalesforceConfiguration'][_0x0a9e('0x150')](db[_0x0a9e('0x9c')],{'as':'Account','foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xa0')][_0x0a9e('0x110')](db['SalesforceField'],{'as':_0x0a9e('0x1c8'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xa0')]['hasMany'](db[_0x0a9e('0xa0')],{'as':_0x0a9e('0x1ca'),'foreignKey':_0x0a9e('0x1c5')});db['SalesforceField'][_0x0a9e('0x110')](db[_0x0a9e('0xa0')],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xa0')][_0x0a9e('0x150')](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':'VariableId'});db[_0x0a9e('0xa1')][_0x0a9e('0x110')](db[_0x0a9e('0xa2')],{'as':_0x0a9e('0x1c3'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xa2')]['hasMany'](db[_0x0a9e('0x1cc')],{'as':_0x0a9e('0x1c4'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xa2')][_0x0a9e('0x110')](db[_0x0a9e('0x1cc')],{'as':_0x0a9e('0x1cd'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c5')});db['SugarcrmConfiguration'][_0x0a9e('0x110')](db[_0x0a9e('0x1cc')],{'as':'Fields','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c6')});db['SugarcrmConfiguration'][_0x0a9e('0x150')](db[_0x0a9e('0xa1')],{'as':'Account','foreignKey':_0x0a9e('0x1c7')});db['SugarcrmField']['hasMany'](db['SugarcrmField'],{'as':_0x0a9e('0x1c8'),'foreignKey':_0x0a9e('0x1c9')});db['SugarcrmField'][_0x0a9e('0x110')](db[_0x0a9e('0x1cc')],{'as':'Description','foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0x1cc')]['hasMany'](db[_0x0a9e('0x1cc')],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db['SugarcrmField'][_0x0a9e('0x150')](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1ce')});db[_0x0a9e('0x1cf')]['hasMany'](db[_0x0a9e('0xa6')],{'as':'Configurations','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xa6')][_0x0a9e('0x110')](db[_0x0a9e('0xa8')],{'as':_0x0a9e('0x1c4'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xa6')]['hasMany'](db[_0x0a9e('0xa8')],{'as':_0x0a9e('0x1cd'),'onDelete':_0x0a9e('0x10e'),'foreignKey':'DescriptionId'});db['DeskConfiguration']['hasMany'](db['DeskField'],{'as':'Fields','onDelete':_0x0a9e('0x10e'),'foreignKey':'FieldId'});db[_0x0a9e('0xa6')][_0x0a9e('0x150')](db[_0x0a9e('0x1cf')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xa6')]['belongsToMany'](db[_0x0a9e('0x86')],{'through':'int_desk_configuration_has_tags'});db['DeskField'][_0x0a9e('0x110')](db['DeskField'],{'as':_0x0a9e('0x1c8'),'foreignKey':'SubjectId'});db[_0x0a9e('0xa8')][_0x0a9e('0x110')](db[_0x0a9e('0xa8')],{'as':_0x0a9e('0x1ca'),'foreignKey':_0x0a9e('0x1c5')});db['DeskField'][_0x0a9e('0x110')](db[_0x0a9e('0xa8')],{'as':'Field','foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xa8')]['belongsTo'](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1ce')});db[_0x0a9e('0xaa')][_0x0a9e('0x110')](db[_0x0a9e('0xac')],{'as':_0x0a9e('0x1c3'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xac')][_0x0a9e('0x110')](db[_0x0a9e('0xae')],{'as':'Subjects','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xac')][_0x0a9e('0x110')](db[_0x0a9e('0xae')],{'as':_0x0a9e('0x1cd'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c5')});db['ZohoConfiguration'][_0x0a9e('0x110')](db[_0x0a9e('0xae')],{'as':_0x0a9e('0x1c1'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xac')][_0x0a9e('0x150')](db[_0x0a9e('0xaa')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xae')][_0x0a9e('0x110')](db[_0x0a9e('0xae')],{'as':_0x0a9e('0x1c8'),'foreignKey':'SubjectId'});db[_0x0a9e('0xae')][_0x0a9e('0x110')](db[_0x0a9e('0xae')],{'as':'Description','foreignKey':'DescriptionId'});db[_0x0a9e('0xae')][_0x0a9e('0x110')](db[_0x0a9e('0xae')],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xae')][_0x0a9e('0x150')](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':'VariableId'});db[_0x0a9e('0xaf')][_0x0a9e('0x110')](db['ZendeskConfiguration'],{'as':_0x0a9e('0x1c3'),'onDelete':_0x0a9e('0x10e'),'foreignKey':'AccountId'});db['ZendeskConfiguration'][_0x0a9e('0x110')](db[_0x0a9e('0xb2')],{'as':_0x0a9e('0x1c4'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0x1d0')]['hasMany'](db[_0x0a9e('0xb2')],{'as':'Descriptions','foreignKey':'DescriptionId'});db['ZendeskConfiguration'][_0x0a9e('0x110')](db['ZendeskField'],{'as':'Fields','foreignKey':'FieldId'});db[_0x0a9e('0x1d0')][_0x0a9e('0x150')](db[_0x0a9e('0xaf')],{'as':_0x0a9e('0x183'),'foreignKey':'AccountId'});db[_0x0a9e('0x1d0')]['belongsToMany'](db['Tag'],{'through':_0x0a9e('0x1d1')});db[_0x0a9e('0xb2')][_0x0a9e('0x110')](db['ZendeskField'],{'as':'Subject','foreignKey':'SubjectId'});db[_0x0a9e('0xb2')][_0x0a9e('0x110')](db[_0x0a9e('0xb2')],{'as':_0x0a9e('0x1ca'),'foreignKey':_0x0a9e('0x1c5')});db['ZendeskField'][_0x0a9e('0x110')](db[_0x0a9e('0xb2')],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xb2')][_0x0a9e('0x150')](db['Variable'],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1ce')});db[_0x0a9e('0x1d2')][_0x0a9e('0x110')](db[_0x0a9e('0x1d3')],{'as':_0x0a9e('0x1c3'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0x1d3')][_0x0a9e('0x110')](db[_0x0a9e('0xb5')],{'as':_0x0a9e('0x1c4'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0x1d3')][_0x0a9e('0x110')](db[_0x0a9e('0xb5')],{'as':_0x0a9e('0x1cd'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0x1d3')]['hasMany'](db['FreshdeskField'],{'as':'Fields','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c6')});db['FreshdeskConfiguration'][_0x0a9e('0x150')](db[_0x0a9e('0x1d2')],{'as':'Account','foreignKey':_0x0a9e('0x1c7')});db['FreshdeskConfiguration'][_0x0a9e('0x121')](db['Tag'],{'through':_0x0a9e('0x1d4')});db[_0x0a9e('0xb5')][_0x0a9e('0x110')](db[_0x0a9e('0xb5')],{'as':'Subject','foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xb5')][_0x0a9e('0x110')](db['FreshdeskField'],{'as':'Description','foreignKey':'DescriptionId'});db['FreshdeskField'][_0x0a9e('0x110')](db[_0x0a9e('0xb5')],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xb5')]['belongsTo'](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1ce')});db[_0x0a9e('0x1d5')]['hasMany'](db[_0x0a9e('0xb8')],{'as':_0x0a9e('0x1c3'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xb8')]['hasMany'](db[_0x0a9e('0xb9')],{'as':_0x0a9e('0x1c4'),'foreignKey':_0x0a9e('0x1c9')});db['VtigerConfiguration'][_0x0a9e('0x110')](db['VtigerField'],{'as':_0x0a9e('0x1cd'),'foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0xb8')][_0x0a9e('0x110')](db[_0x0a9e('0xb9')],{'as':'Fields','foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xb8')][_0x0a9e('0x150')](db[_0x0a9e('0x1d5')],{'as':_0x0a9e('0x183'),'foreignKey':'AccountId'});db[_0x0a9e('0xb9')][_0x0a9e('0x110')](db[_0x0a9e('0xb9')],{'as':'Subject','foreignKey':_0x0a9e('0x1c9')});db['VtigerField']['hasMany'](db[_0x0a9e('0xb9')],{'as':'Description','foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0xb9')][_0x0a9e('0x110')](db['VtigerField'],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xb9')][_0x0a9e('0x150')](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1ce')});db[_0x0a9e('0xba')]['hasMany'](db[_0x0a9e('0xbc')],{'as':_0x0a9e('0x1c3'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xbc')]['hasMany'](db['ServicenowField'],{'as':_0x0a9e('0x1c4'),'foreignKey':'SubjectId'});db[_0x0a9e('0xbc')][_0x0a9e('0x110')](db['ServicenowField'],{'as':_0x0a9e('0x1cd'),'foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0xbc')]['hasMany'](db[_0x0a9e('0x1d6')],{'as':_0x0a9e('0x1c1'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xbc')][_0x0a9e('0x150')](db[_0x0a9e('0xba')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x1c7')});db['ServicenowField'][_0x0a9e('0x110')](db[_0x0a9e('0x1d6')],{'as':_0x0a9e('0x1c8'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0x1d6')]['hasMany'](db[_0x0a9e('0x1d6')],{'as':'Description','foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0x1d6')][_0x0a9e('0x110')](db['ServicenowField'],{'as':_0x0a9e('0x1cb'),'foreignKey':'FieldId'});db[_0x0a9e('0x1d6')][_0x0a9e('0x150')](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':'VariableId'});db[_0x0a9e('0xbe')]['hasMany'](db[_0x0a9e('0xbf')],{'as':_0x0a9e('0x1c3'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xbe')][_0x0a9e('0x150')](db['CloudProvider'],{'as':_0x0a9e('0x103'),'foreignKey':'CloudProviderId'});db[_0x0a9e('0xbf')][_0x0a9e('0x110')](db['Dynamics365Field'],{'as':'Subjects','onDelete':'cascade','foreignKey':'SubjectId'});db[_0x0a9e('0xbf')][_0x0a9e('0x110')](db[_0x0a9e('0xc1')],{'as':_0x0a9e('0x1cd'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c5')});db['Dynamics365Configuration'][_0x0a9e('0x110')](db[_0x0a9e('0xc1')],{'as':'Fields','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xbf')][_0x0a9e('0x150')](db[_0x0a9e('0xbe')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x1c7')});db['Dynamics365Field'][_0x0a9e('0x110')](db[_0x0a9e('0xc1')],{'as':_0x0a9e('0x1c8'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xc1')][_0x0a9e('0x110')](db[_0x0a9e('0xc1')],{'as':_0x0a9e('0x1ca'),'foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0xc1')][_0x0a9e('0x110')](db['Dynamics365Field'],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xc1')][_0x0a9e('0x150')](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1ce')});db['FreshsalesAccount'][_0x0a9e('0x110')](db[_0x0a9e('0xc5')],{'as':_0x0a9e('0x1c3'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xc5')][_0x0a9e('0x110')](db['FreshsalesField'],{'as':'Subjects','foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xc5')][_0x0a9e('0x110')](db[_0x0a9e('0xc7')],{'as':_0x0a9e('0x1cd'),'foreignKey':'DescriptionId'});db[_0x0a9e('0xc5')]['hasMany'](db[_0x0a9e('0xc7')],{'as':_0x0a9e('0x1c1'),'foreignKey':'FieldId'});db[_0x0a9e('0xc5')]['belongsTo'](db[_0x0a9e('0xc3')],{'as':_0x0a9e('0x183'),'foreignKey':'AccountId'});db[_0x0a9e('0xc7')][_0x0a9e('0x110')](db[_0x0a9e('0xc7')],{'as':'Subject','foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xc7')][_0x0a9e('0x110')](db[_0x0a9e('0xc7')],{'as':_0x0a9e('0x1ca'),'foreignKey':_0x0a9e('0x1c5')});db['FreshsalesField'][_0x0a9e('0x110')](db[_0x0a9e('0xc7')],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db['FreshsalesField']['belongsTo'](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1ce')});db['ChatQueueReport']['belongsTo'](db[_0x0a9e('0x60')],{});db['ChatQueueReport']['belongsTo'](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x16c'),'foreignKey':'ListId'});db[_0x0a9e('0xca')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db['ChatQueueReport'][_0x0a9e('0x150')](db[_0x0a9e('0x64')],{});db['ChatQueueReport'][_0x0a9e('0x150')](db[_0x0a9e('0x65')],{});db[_0x0a9e('0xca')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{});db['ChatQueueReport'][_0x0a9e('0x150')](db[_0x0a9e('0x67')],{});db['ChatInternalMessage']['belongsTo'](db[_0x0a9e('0x11')],{'onDelete':_0x0a9e('0x10e'),'foreignKey':'FromId'});db['ChatInternalMessage'][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1d7')});db[_0x0a9e('0xd0')]['hasMany'](db[_0x0a9e('0x1d8')],{'foreignKey':'SessionId','onDelete':'cascade'});db[_0x0a9e('0xd0')]['hasMany'](db[_0x0a9e('0xcd')],{'foreignKey':'SessionId','onDelete':_0x0a9e('0x10e')});db['SmsQueueReport']['belongsTo'](db[_0x0a9e('0x50')],{});db[_0x0a9e('0xd2')][_0x0a9e('0x150')](db['CmList'],{'as':'List','foreignKey':'ListId'});db[_0x0a9e('0xd2')][_0x0a9e('0x150')](db['CmContact'],{'as':_0x0a9e('0x160'),'foreignKey':'ContactId'});db[_0x0a9e('0xd2')]['belongsTo'](db[_0x0a9e('0x53')],{});db[_0x0a9e('0xd2')]['belongsTo'](db['SmsMessage'],{});db['SmsQueueReport'][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{});db[_0x0a9e('0xd2')][_0x0a9e('0x150')](db[_0x0a9e('0x57')],{});db[_0x0a9e('0x1d9')][_0x0a9e('0x110')](db[_0x0a9e('0xd0')],{'foreignKey':_0x0a9e('0x1da')});db[_0x0a9e('0x1d9')][_0x0a9e('0x110')](db[_0x0a9e('0x1d8')],{'foreignKey':_0x0a9e('0x1da')});db[_0x0a9e('0x1d9')][_0x0a9e('0x110')](db['JscriptyAnswerReport'],{'foreignKey':'ProjectId'});db[_0x0a9e('0x129')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':'user_has_teams'});db[_0x0a9e('0x129')]['belongsToMany'](db[_0x0a9e('0x1a')],{'through':'TeamVoiceQueue','as':_0x0a9e('0x131')});db['Team']['belongsToMany'](db[_0x0a9e('0x3c')],{'through':_0x0a9e('0x171'),'as':_0x0a9e('0x1db')});db[_0x0a9e('0x129')]['belongsToMany'](db['ChatQueue'],{'through':_0x0a9e('0x19b'),'as':'ChatQueues'});db[_0x0a9e('0x129')][_0x0a9e('0x121')](db['FaxQueue'],{'through':_0x0a9e('0x187'),'as':'FaxQueues'});db[_0x0a9e('0x129')][_0x0a9e('0x121')](db[_0x0a9e('0x57')],{'through':_0x0a9e('0x18c'),'as':_0x0a9e('0x136')});db[_0x0a9e('0x129')][_0x0a9e('0x121')](db[_0x0a9e('0x137')],{'through':_0x0a9e('0x190'),'as':_0x0a9e('0x1dc')});db[_0x0a9e('0x129')][_0x0a9e('0x121')](db[_0x0a9e('0x101')],{'through':_0x0a9e('0x1dd'),'as':_0x0a9e('0x138')});db[_0x0a9e('0x129')]['belongsToMany'](db[_0x0a9e('0xf1')],{'through':_0x0a9e('0x107'),'as':_0x0a9e('0x132')});db['Campaign'][_0x0a9e('0x110')](db[_0x0a9e('0x6d')],{'as':_0x0a9e('0x14c'),'foreignKey':_0x0a9e('0x1a7')});db[_0x0a9e('0x1a5')][_0x0a9e('0x110')](db[_0x0a9e('0x71')],{'as':_0x0a9e('0x115'),'foreignKey':_0x0a9e('0x1a7')});db[_0x0a9e('0x1a5')][_0x0a9e('0x110')](db['CmHopperHistory'],{'as':_0x0a9e('0x19e'),'foreignKey':_0x0a9e('0x1a7')});db[_0x0a9e('0x1a5')]['hasMany'](db[_0x0a9e('0x6f')],{'as':'HopperBlacks','foreignKey':'CampaignId'});db[_0x0a9e('0x1a5')]['belongsTo'](db[_0x0a9e('0x28')],{'as':'Trunk','foreignKey':_0x0a9e('0x14f')});db[_0x0a9e('0x1a5')][_0x0a9e('0x150')](db['Trunk'],{'as':_0x0a9e('0x151'),'foreignKey':'TrunkBackupId'});db['Campaign'][_0x0a9e('0x150')](db[_0x0a9e('0x17b')],{'as':_0x0a9e('0x17b'),'foreignKey':_0x0a9e('0x153')});db[_0x0a9e('0x1a5')][_0x0a9e('0x150')](db['SquareProject'],{'as':_0x0a9e('0xdc'),'foreignKey':_0x0a9e('0x1de')});db[_0x0a9e('0x1a5')][_0x0a9e('0x121')](db[_0x0a9e('0x139')],{'as':'Lists','through':_0x0a9e('0x1df')});db[_0x0a9e('0x1a5')][_0x0a9e('0x121')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x156'),'through':_0x0a9e('0x1e0')});db[_0x0a9e('0xe4')][_0x0a9e('0x150')](db[_0x0a9e('0x66')],{'as':_0x0a9e('0x66'),'foreignKey':_0x0a9e('0x19a')});db[_0x0a9e('0x1e1')][_0x0a9e('0x150')](db['MailMessage'],{});db['MailTransferReport'][_0x0a9e('0x150')](db[_0x0a9e('0x11c')],{});db['MailTransferReport'][_0x0a9e('0x150')](db[_0x0a9e('0x3b')],{'foreignKey':_0x0a9e('0x1e2'),'as':_0x0a9e('0x1e3')});db[_0x0a9e('0x1e1')]['belongsTo'](db['User'],{'foreignKey':'FromUserId','as':_0x0a9e('0x1e4')});db[_0x0a9e('0x1e1')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'foreignKey':_0x0a9e('0x1e5'),'as':_0x0a9e('0x1e6')});db[_0x0a9e('0x1e1')][_0x0a9e('0x150')](db[_0x0a9e('0x3c')],{'foreignKey':'ToMailQueueId','as':'ToQueue'});db[_0x0a9e('0x1e1')][_0x0a9e('0x150')](db[_0x0a9e('0x3b')],{'foreignKey':_0x0a9e('0x1e7'),'as':_0x0a9e('0x1e8')});db[_0x0a9e('0xe8')][_0x0a9e('0x150')](db[_0x0a9e('0x65')],{});db[_0x0a9e('0xe8')][_0x0a9e('0x150')](db['ChatInteraction'],{});db[_0x0a9e('0xe8')]['belongsTo'](db['ChatWebsite'],{'foreignKey':_0x0a9e('0x1e9'),'as':_0x0a9e('0x1e3')});db[_0x0a9e('0xe8')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'foreignKey':_0x0a9e('0x1ea'),'as':_0x0a9e('0x1e4')});db[_0x0a9e('0xe8')][_0x0a9e('0x150')](db['User'],{'foreignKey':_0x0a9e('0x1e5'),'as':_0x0a9e('0x1e6')});db[_0x0a9e('0xe8')]['belongsTo'](db[_0x0a9e('0x67')],{'foreignKey':_0x0a9e('0x1eb'),'as':'ToQueue'});db['ChatTransferReport']['belongsTo'](db['ChatWebsite'],{'foreignKey':_0x0a9e('0x1ec'),'as':_0x0a9e('0x1e8')});db['FaxTransferReport'][_0x0a9e('0x150')](db['FaxMessage'],{});db[_0x0a9e('0xea')][_0x0a9e('0x150')](db[_0x0a9e('0x11b')],{});db['FaxTransferReport']['belongsTo'](db[_0x0a9e('0x45')],{'foreignKey':_0x0a9e('0x1ed'),'as':_0x0a9e('0x1e3')});db[_0x0a9e('0xea')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'foreignKey':_0x0a9e('0x1ea'),'as':_0x0a9e('0x1e4')});db[_0x0a9e('0xea')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'foreignKey':'ToUserId','as':_0x0a9e('0x1e6')});db[_0x0a9e('0xea')]['belongsTo'](db['FaxQueue'],{'foreignKey':_0x0a9e('0x1ee'),'as':_0x0a9e('0x1ef')});db[_0x0a9e('0xea')][_0x0a9e('0x150')](db[_0x0a9e('0x45')],{'foreignKey':'ToFaxAccountId','as':_0x0a9e('0x1e8')});db[_0x0a9e('0xec')]['belongsTo'](db[_0x0a9e('0x5e')],{});db['OpenchannelTransferReport']['belongsTo'](db['OpenchannelInteraction'],{});db[_0x0a9e('0xec')][_0x0a9e('0x150')](db['OpenchannelAccount'],{'foreignKey':'FromOpenchannelAccountId','as':_0x0a9e('0x1e3')});db[_0x0a9e('0xec')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'foreignKey':'FromUserId','as':_0x0a9e('0x1e4')});db[_0x0a9e('0xec')][_0x0a9e('0x150')](db['User'],{'foreignKey':_0x0a9e('0x1e5'),'as':_0x0a9e('0x1e6')});db[_0x0a9e('0xec')][_0x0a9e('0x150')](db[_0x0a9e('0x137')],{'foreignKey':'ToOpenchannelQueueId','as':'ToQueue'});db[_0x0a9e('0xec')][_0x0a9e('0x150')](db[_0x0a9e('0x59')],{'foreignKey':'ToOpenchannelAccountId','as':'ToAccount'});db['SmsTransferReport']['belongsTo'](db[_0x0a9e('0x55')],{});db[_0x0a9e('0xee')][_0x0a9e('0x150')](db[_0x0a9e('0x53')],{});db[_0x0a9e('0xee')]['belongsTo'](db[_0x0a9e('0x50')],{'foreignKey':_0x0a9e('0x1f0'),'as':_0x0a9e('0x1e3')});db[_0x0a9e('0xee')][_0x0a9e('0x150')](db['User'],{'foreignKey':_0x0a9e('0x1ea'),'as':_0x0a9e('0x1e4')});db[_0x0a9e('0xee')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'foreignKey':'ToUserId','as':_0x0a9e('0x1e6')});db[_0x0a9e('0xee')]['belongsTo'](db['SmsQueue'],{'foreignKey':'ToSmsQueueId','as':_0x0a9e('0x1ef')});db[_0x0a9e('0xee')]['belongsTo'](db[_0x0a9e('0x50')],{'foreignKey':'ToSmsAccountId','as':'ToAccount'});db['CmList']['hasMany'](db[_0x0a9e('0x167')],{'as':_0x0a9e('0x168'),'foreignKey':_0x0a9e('0x16d'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x139')][_0x0a9e('0x110')](db[_0x0a9e('0x1f1')],{'as':_0x0a9e('0x1f2'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x139')][_0x0a9e('0x110')](db['CmContact'],{'as':_0x0a9e('0x125'),'onDelete':'cascade','foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x139')][_0x0a9e('0x110')](db[_0x0a9e('0x71')],{'as':_0x0a9e('0x115'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x139')][_0x0a9e('0x110')](db[_0x0a9e('0x116')],{'as':'HopperHistory','foreignKey':'ListId'});db['CmList'][_0x0a9e('0x110')](db[_0x0a9e('0x73')],{'as':_0x0a9e('0x73'),'foreignKey':'ListId'});db[_0x0a9e('0x139')][_0x0a9e('0x121')](db[_0x0a9e('0x1a')],{'as':'Queues','through':_0x0a9e('0x1f3')});db[_0x0a9e('0x139')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':'Agents','through':_0x0a9e('0x128')});db[_0x0a9e('0xf1')][_0x0a9e('0x110')](db[_0x0a9e('0x16')],{'as':_0x0a9e('0x114'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0xf1')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':'UserVoicePrefix'});db[_0x0a9e('0xf1')]['belongsToMany'](db[_0x0a9e('0x129')],{'through':'TeamVoicePrefix','as':_0x0a9e('0x155')});db[_0x0a9e('0xf2')][_0x0a9e('0x110')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x176'),'foreignKey':_0x0a9e('0x1f4')});db['UserProfile'][_0x0a9e('0x110')](db['UserProfileSection'],{'as':_0x0a9e('0x1f5'),'foreignKey':_0x0a9e('0x1f4'),'onDelete':_0x0a9e('0x10e')});db['UserProfileSection']['hasMany'](db['UserProfileResource'],{'as':_0x0a9e('0x1f6'),'foreignKey':_0x0a9e('0x1f7'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0xf7')][_0x0a9e('0x110')](db[_0x0a9e('0x167')],{'as':'Dispositions','foreignKey':_0x0a9e('0x1f8'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0xf7')][_0x0a9e('0x110')](db['CannedAnswer'],{'as':_0x0a9e('0x169'),'foreignKey':_0x0a9e('0x1f8')});db['WhatsappAccount'][_0x0a9e('0x110')](db[_0x0a9e('0xfd')],{'as':_0x0a9e('0x158'),'foreignKey':'WhatsappAccountId'});db[_0x0a9e('0xf7')]['hasMany'](db[_0x0a9e('0xfb')],{'as':'Interactions'});db[_0x0a9e('0xf7')][_0x0a9e('0x110')](db['WhatsappApplication'],{'as':_0x0a9e('0x147'),'foreignKey':_0x0a9e('0x1f8'),'onDelete':_0x0a9e('0x10e')});db['WhatsappAccount'][_0x0a9e('0x150')](db['CmList'],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0xf7')][_0x0a9e('0x150')](db[_0x0a9e('0x7d')],{'as':'mandatoryDispositionPause','foreignKey':_0x0a9e('0x154')});db[_0x0a9e('0xf7')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':_0x0a9e('0x144')});db[_0x0a9e('0xf9')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0xf9')][_0x0a9e('0x150')](db[_0x0a9e('0x101')],{'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0xf9')][_0x0a9e('0x150')](db['WhatsappAccount'],{'onDelete':_0x0a9e('0x164')});db['WhatsappApplication'][_0x0a9e('0x150')](db[_0x0a9e('0x17b')],{'onDelete':'restrict','foreignKey':_0x0a9e('0x153')});db[_0x0a9e('0xf9')]['belongsTo'](db[_0x0a9e('0x86')],{'onDelete':_0x0a9e('0x164'),'foreignKey':_0x0a9e('0x181')});db['WhatsappInteraction'][_0x0a9e('0x110')](db['WhatsappMessage'],{'as':'Messages','onDelete':'cascade','foreignKey':_0x0a9e('0x1f9')});db[_0x0a9e('0xfb')][_0x0a9e('0x150')](db[_0x0a9e('0xf7')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x1f8')});db[_0x0a9e('0xfb')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0xfb')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x184'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0xfb')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x1b5'),'as':_0x0a9e('0x174')});db['WhatsappInteraction'][_0x0a9e('0x121')](db['Tag'],{'through':_0x0a9e('0x1b5'),'as':_0x0a9e('0x175')});db[_0x0a9e('0xfb')]['belongsToMany'](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x176'),'through':_0x0a9e('0x130'),'foreignKey':'WhatsappInteractionId'});db[_0x0a9e('0xfd')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x11')});db[_0x0a9e('0xfd')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'onDelete':'cascade','as':_0x0a9e('0x160')});db[_0x0a9e('0xfd')][_0x0a9e('0x150')](db['WhatsappInteraction'],{'onDelete':'cascade','as':_0x0a9e('0x179'),'foreignKey':_0x0a9e('0x1f9')});db[_0x0a9e('0xfd')]['belongsTo'](db[_0x0a9e('0xf7')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x1f8')});db[_0x0a9e('0xfe')][_0x0a9e('0x150')](db[_0x0a9e('0xf7')],{});db['WhatsappQueueReport'][_0x0a9e('0x150')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0xfe')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0xfe')][_0x0a9e('0x150')](db['WhatsappInteraction'],{});db['WhatsappQueueReport']['belongsTo'](db[_0x0a9e('0x101')],{});db[_0x0a9e('0xfe')]['belongsTo'](db['WhatsappMessage'],{});db[_0x0a9e('0xfe')][_0x0a9e('0x150')](db['User'],{});db['WhatsappTransferReport'][_0x0a9e('0x150')](db[_0x0a9e('0xfd')],{});db['WhatsappTransferReport'][_0x0a9e('0x150')](db[_0x0a9e('0xfb')],{});db[_0x0a9e('0x1fa')]['belongsTo'](db['WhatsappAccount'],{'foreignKey':_0x0a9e('0x1fb'),'as':_0x0a9e('0x1e3')});db['WhatsappTransferReport']['belongsTo'](db[_0x0a9e('0xf7')],{'foreignKey':_0x0a9e('0x1fc'),'as':'ToAccount'});db[_0x0a9e('0x1fa')]['belongsTo'](db['WhatsappQueue'],{'foreignKey':_0x0a9e('0x1fd'),'as':_0x0a9e('0x1ef')});db['WhatsappTransferReport']['belongsTo'](db['User'],{'foreignKey':_0x0a9e('0x1ea'),'as':'FromAgent'});db[_0x0a9e('0x1fa')][_0x0a9e('0x150')](db['User'],{'foreignKey':'ToUserId','as':_0x0a9e('0x1e6')});db[_0x0a9e('0x101')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':_0x0a9e('0x37'),'foreignKey':'WhatsappQueueId'});db[_0x0a9e('0x101')][_0x0a9e('0x121')](db[_0x0a9e('0x129')],{'through':_0x0a9e('0x1dd'),'as':'Teams'});db[_0x0a9e('0x1fe')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x1ff'),'foreignKey':_0x0a9e('0x10f'),'onDelete':_0x0a9e('0x10e'),'hooks':!![]});db[_0x0a9e('0x103')][_0x0a9e('0x10b')](db['Dynamics365Account'],{'as':_0x0a9e('0xbe'),'onDelete':_0x0a9e('0x164')});db['CloudProvider'][_0x0a9e('0x10b')](db['MailServerIn'],{'as':'Imap','onDelete':_0x0a9e('0x164')});db['CloudProvider']['hasOne'](db['MailServerOut'],{'as':'Smtp','onDelete':_0x0a9e('0x164')});module['exports']={'db':db,'dbH':dbH}; \ No newline at end of file diff --git a/server/routes.js b/server/routes.js index 6685059..3924cac 100644 --- a/server/routes.js +++ b/server/routes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdb76=['./api/contactItemType','./api/cmContactHasItem','/api/cm_hopper_additional_phones','/api/templates','./api/template','/api/triggers','./api/trigger','/api/variables','/api/integrations','./api/integration','./api/integrationReport','/api/analytics/custom_reports','./api/analyticCustomReport','/api/analytics/default_reports','./api/analyticDefaultReport','./api/analyticExtractedReport','/api/analytics/metrics','/api/analytics/field_reports','/api/analytics/tree_reports','./api/analyticTreeReport','/api/integrations/salesforce/accounts','./api/intSalesforceAccount','/api/integrations/salesforce/configurations','./api/intSalesforceConfiguration','/api/integrations/salesforce/fields','./api/intSalesforceField','/api/integrations/sugarcrm/accounts','./api/intSugarcrmAccount','/api/integrations/sugarcrm/configurations','./api/intSugarcrmConfiguration','/api/integrations/sugarcrm/fields','./api/intSugarcrmField','/api/integrations/desk/accounts','/api/integrations/desk/configurations','./api/intDeskConfiguration','/api/integrations/desk/fields','./api/intDeskField','/api/integrations/zoho/configurations','/api/integrations/zendesk/accounts','./api/intZendeskAccount','/api/integrations/zendesk/configurations','./api/intZendeskConfiguration','/api/integrations/zendesk/fields','./api/intZendeskField','/api/integrations/freshdesk/accounts','./api/intFreshdeskAccount','/api/integrations/freshdesk/configurations','/api/integrations/freshdesk/fields','./api/intFreshdeskField','/api/integrations/vtiger/accounts','./api/intVtigerConfiguration','/api/integrations/vtiger/fields','./api/intVtigerField','./api/intServicenowAccount','/api/integrations/servicenow/configurations','./api/intServicenowConfiguration','/api/integrations/servicenow/fields','./api/intServicenowField','/api/integrations/dynamics365/accounts','./api/intDynamics365Account','/api/integrations/dynamics365/configurations','./api/intDynamics365Configuration','/api/integrations/dynamics365/fields','/api/integrations/freshsales/accounts','./api/intFreshsalesAccount','/api/integrations/freshsales/configurations','/api/integrations/freshsales/fields','./api/intFreshsalesField','./api/network','/api/chat/reports/queue','./api/chatQueueReport','/api/chat/internal/messages','./api/chatInternalMessage','/api/jscripty/answers/reports','./api/jscriptyAnswerReport','/api/jscripty/questions/reports','./api/jscriptyQuestionReport','/api/jscripty/sessions/reports','/api/sms/reports/queue','./api/smsQueueReport','/api/square/reports','./api/squareReport','/api/square/details/reports','./api/squareReportDetail','/api/jscripty/projects','./api/jscriptyProject','/api/settings','./api/setting','/api/square/odbc','./api/squareOdbc','/api/square/projects','/api/square/recordings','./api/squareRecording','/api/square/messages','./api/squareMessage','/api/teams','./api/team','/api/license','./api/license','/api/campaigns','./api/campaign','./api/migration','./api/attachment','./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/smsTransferReport','/api/cm/lists','./api/cmList','/api/voice/prefixes','./api/voicePrefix','/api/userProfile/sections','./api/userProfileSection','/api/userNotifications','./api/userNotification','/api/whatsapp/accounts','/api/whatsapp/applications','./api/whatsappApplication','./api/whatsappInteraction','/api/whatsapp/messages','/api/whatsapp/reports/queue','./api/whatsappQueueReport','/api/whatsapp/reports/transfer','/api/whatsapp/queues','./api/whatsappQueue','/api/cloudProviders','/api/realtime','./api/realtime','/api/user-settings','./api/user-setting','/api/auth/local','./api/authLocal','/api/auth/google','./api/authGoogle','/api/auth/activedirectory','./api/authActiveDirectory','/api/rpc','./api/rpc','/api/version','./api/version','./api/system','./api/pm2','/api/webbar','./api/webbar','/api/logs','/apidoc','static','join','/www','/demo','root','snippet','3.5.0','/plugins','/server/files/plugins','get','route','resolve','/index.html','path','express','./errors','./config/environment','./utils/client-side-logger','./api/client-side-logs','default','then','/api/users','./api/user','use','/api/voice/chanspy','./api/voiceChanSpy','/api/voice/contexts','./api/voiceContext','/api/voice/extensions','./api/voiceExtension','/api/voice/mohs','./api/voiceMusicOnHold','/api/voice/recordings','/api/screen/recordings','./api/screenRecording','/api/voice/mails','./api/voiceMail','./api/voiceMailMessage','/api/voice/calls/reports','./api/voiceCallReport','/api/voice/dials/reports','./api/voiceDialReport','/api/voice/agents/reports','./api/voiceAgentReport','/api/voice/queues/reports','/api/members/reports','./api/memberReport','/api/trunks','./api/trunk','/api/voice/transfers/reports','./api/voiceTransferReport','/api/mail/out_servers','./api/mailServerOut','/api/mail/accounts','./api/mailAccount','/api/mail/queues','./api/mailQueue','./api/mailSubstatus','./api/mailInteraction','/api/mail/messages','/api/mail/applications','/api/mail/reports/queue','./api/mailQueueReport','./api/dashboard','/api/dashboards/items','/api/fax/accounts','/api/fax/applications','./api/faxApplication','/api/fax/interactions','./api/faxInteraction','./api/faxMessage','./api/faxQueue','/api/fax/reports/queue','./api/faxQueueReport','/api/sms/accounts','/api/sms/applications','./api/smsApplication','/api/sms/interactions','/api/sms/messages','./api/smsMessage','/api/sms/queues','./api/smsQueue','./api/openchannelAccount','/api/openchannel/applications','/api/openchannel/interactions','./api/openchannelInteraction','/api/openchannel/messages','/api/openchannel/queues','./api/openchannelQueue','/api/chat/websites','./api/openchannelQueueReport','./api/chatApplication','/api/chat/interactions','./api/chatInteraction','./api/chatMessage','/api/chat/offline_messages','./api/chatOfflineMessage','/api/chat/queues','/api/chat/groups','./api/chatGroup','/api/chat/proactive_actions','/api/cm/companies','./api/cmContact','/api/cm/hopper','./api/cmHopperBlack','/api/cm/hopper_final','./api/cmHopperFinal','./api/cmHopperHistory','/api/cm/custom_fields','/api/actions','./api/action','/api/automations','./api/automation','/api/canned_answers','./api/cannedAnswer','./api/disposition','/api/conditions','/api/intervals','./api/interval','/api/pauses','/api/cdr','./api/cdr','./api/voiceQueuesLog','/api/schedules','./api/schedule','./api/sound','/api/tags','./api/tag','/api/contact_item_types'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0xdb76,0x1be));var _0x6db7=function(_0x1c92b7,_0x42cd2b){_0x1c92b7=_0x1c92b7-0x0;var _0x3d234b=_0xdb76[_0x1c92b7];return _0x3d234b;};'use strict';var path=require(_0x6db7('0x0'));var express=require(_0x6db7('0x1'));var errors=require(_0x6db7('0x2'));var config=require(_0x6db7('0x3'));var setupLoggers=require(_0x6db7('0x4'))['setupLoggers'];var clientSideLogs=require(_0x6db7('0x5'));exports[_0x6db7('0x6')]=function(_0x3e17d8){return setupLoggers(_0x3e17d8)[_0x6db7('0x7')](function(){_0x3e17d8['use'](_0x6db7('0x8'),require(_0x6db7('0x9')));_0x3e17d8[_0x6db7('0xa')](_0x6db7('0xb'),require(_0x6db7('0xc')));_0x3e17d8['use'](_0x6db7('0xd'),require(_0x6db7('0xe')));_0x3e17d8['use'](_0x6db7('0xf'),require(_0x6db7('0x10')));_0x3e17d8[_0x6db7('0xa')](_0x6db7('0x11'),require(_0x6db7('0x12')));_0x3e17d8[_0x6db7('0xa')]('/api/voice/queues',require('./api/voiceQueue'));_0x3e17d8[_0x6db7('0xa')](_0x6db7('0x13'),require('./api/voiceRecording'));_0x3e17d8[_0x6db7('0xa')](_0x6db7('0x14'),require(_0x6db7('0x15')));_0x3e17d8[_0x6db7('0xa')](_0x6db7('0x16'),require(_0x6db7('0x17')));_0x3e17d8['use']('/api/voice/mails/messages',require(_0x6db7('0x18')));_0x3e17d8[_0x6db7('0xa')](_0x6db7('0x19'),require(_0x6db7('0x1a')));_0x3e17d8[_0x6db7('0xa')](_0x6db7('0x1b'),require(_0x6db7('0x1c')));_0x3e17d8[_0x6db7('0xa')](_0x6db7('0x1d'),require(_0x6db7('0x1e')));_0x3e17d8[_0x6db7('0xa')](_0x6db7('0x1f'),require('./api/voiceQueueReport'));_0x3e17d8[_0x6db7('0xa')](_0x6db7('0x20'),require(_0x6db7('0x21')));_0x3e17d8[_0x6db7('0xa')](_0x6db7('0x22'),require(_0x6db7('0x23')));_0x3e17d8[_0x6db7('0xa')](_0x6db7('0x24'),require(_0x6db7('0x25')));_0x3e17d8[_0x6db7('0xa')](_0x6db7('0x26'),require(_0x6db7('0x27')));_0x3e17d8['use'](_0x6db7('0x28'),require(_0x6db7('0x29')));_0x3e17d8[_0x6db7('0xa')](_0x6db7('0x2a'),require(_0x6db7('0x2b')));_0x3e17d8[_0x6db7('0xa')]('/api/mail/substatuses',require(_0x6db7('0x2c')));_0x3e17d8[_0x6db7('0xa')]('/api/mail/interactions',require(_0x6db7('0x2d')));_0x3e17d8[_0x6db7('0xa')](_0x6db7('0x2e'),require('./api/mailMessage'));_0x3e17d8[_0x6db7('0xa')](_0x6db7('0x2f'),require('./api/mailApplication'));_0x3e17d8[_0x6db7('0xa')](_0x6db7('0x30'),require(_0x6db7('0x31')));_0x3e17d8['use']('/api/dashboards',require(_0x6db7('0x32')));_0x3e17d8[_0x6db7('0xa')](_0x6db7('0x33'),require('./api/dashboardItem'));_0x3e17d8[_0x6db7('0xa')](_0x6db7('0x34'),require('./api/faxAccount'));_0x3e17d8['use'](_0x6db7('0x35'),require(_0x6db7('0x36')));_0x3e17d8[_0x6db7('0xa')](_0x6db7('0x37'),require(_0x6db7('0x38')));_0x3e17d8[_0x6db7('0xa')]('/api/fax/messages',require(_0x6db7('0x39')));_0x3e17d8[_0x6db7('0xa')]('/api/fax/queues',require(_0x6db7('0x3a')));_0x3e17d8['use'](_0x6db7('0x3b'),require(_0x6db7('0x3c')));_0x3e17d8[_0x6db7('0xa')](_0x6db7('0x3d'),require('./api/smsAccount'));_0x3e17d8[_0x6db7('0xa')](_0x6db7('0x3e'),require(_0x6db7('0x3f')));_0x3e17d8[_0x6db7('0xa')](_0x6db7('0x40'),require('./api/smsInteraction'));_0x3e17d8[_0x6db7('0xa')](_0x6db7('0x41'),require(_0x6db7('0x42')));_0x3e17d8['use'](_0x6db7('0x43'),require(_0x6db7('0x44')));_0x3e17d8[_0x6db7('0xa')]('/api/openchannel/accounts',require(_0x6db7('0x45')));_0x3e17d8['use'](_0x6db7('0x46'),require('./api/openchannelApplication'));_0x3e17d8['use'](_0x6db7('0x47'),require(_0x6db7('0x48')));_0x3e17d8[_0x6db7('0xa')](_0x6db7('0x49'),require('./api/openchannelMessage'));_0x3e17d8['use'](_0x6db7('0x4a'),require(_0x6db7('0x4b')));_0x3e17d8['use'](_0x6db7('0x4c'),require('./api/chatWebsite'));_0x3e17d8[_0x6db7('0xa')]('/api/openchannel/reports/queue',require(_0x6db7('0x4d')));_0x3e17d8['use']('/api/chat/applications',require(_0x6db7('0x4e')));_0x3e17d8[_0x6db7('0xa')](_0x6db7('0x4f'),require(_0x6db7('0x50')));_0x3e17d8[_0x6db7('0xa')]('/api/chat/messages',require(_0x6db7('0x51')));_0x3e17d8[_0x6db7('0xa')](_0x6db7('0x52'),require(_0x6db7('0x53')));_0x3e17d8[_0x6db7('0xa')](_0x6db7('0x54'),require('./api/chatQueue'));_0x3e17d8[_0x6db7('0xa')](_0x6db7('0x55'),require(_0x6db7('0x56')));_0x3e17d8['use'](_0x6db7('0x57'),require('./api/chatProactiveAction'));_0x3e17d8[_0x6db7('0xa')](_0x6db7('0x58'),require('./api/cmCompany'));_0x3e17d8[_0x6db7('0xa')]('/api/cm/contacts',require(_0x6db7('0x59')));_0x3e17d8['use'](_0x6db7('0x5a'),require('./api/cmHopper'));_0x3e17d8[_0x6db7('0xa')]('/api/cm/hopper_black',require(_0x6db7('0x5b')));_0x3e17d8['use'](_0x6db7('0x5c'),require(_0x6db7('0x5d')));_0x3e17d8[_0x6db7('0xa')]('/api/cm/hopper_history',require(_0x6db7('0x5e')));_0x3e17d8[_0x6db7('0xa')](_0x6db7('0x5f'),require('./api/cmCustomField'));_0x3e17d8[_0x6db7('0xa')](_0x6db7('0x60'),require(_0x6db7('0x61')));_0x3e17d8[_0x6db7('0xa')](_0x6db7('0x62'),require(_0x6db7('0x63')));_0x3e17d8['use'](_0x6db7('0x64'),require(_0x6db7('0x65')));_0x3e17d8['use']('/api/dispositions',require(_0x6db7('0x66')));_0x3e17d8[_0x6db7('0xa')](_0x6db7('0x67'),require('./api/condition'));_0x3e17d8[_0x6db7('0xa')](_0x6db7('0x68'),require(_0x6db7('0x69')));_0x3e17d8[_0x6db7('0xa')](_0x6db7('0x6a'),require('./api/pause'));_0x3e17d8[_0x6db7('0xa')](_0x6db7('0x6b'),require(_0x6db7('0x6c')));_0x3e17d8['use']('/api/voiceQueuesLog',require(_0x6db7('0x6d')));_0x3e17d8['use'](_0x6db7('0x6e'),require(_0x6db7('0x6f')));_0x3e17d8['use']('/api/sounds',require(_0x6db7('0x70')));_0x3e17d8[_0x6db7('0xa')](_0x6db7('0x71'),require(_0x6db7('0x72')));_0x3e17d8[_0x6db7('0xa')](_0x6db7('0x73'),require(_0x6db7('0x74')));_0x3e17d8[_0x6db7('0xa')]('/api/cm_contact_has_items',require(_0x6db7('0x75')));_0x3e17d8[_0x6db7('0xa')](_0x6db7('0x76'),require('./api/cmHopperAdditionalPhone'));_0x3e17d8['use'](_0x6db7('0x77'),require(_0x6db7('0x78')));_0x3e17d8[_0x6db7('0xa')](_0x6db7('0x79'),require(_0x6db7('0x7a')));_0x3e17d8[_0x6db7('0xa')](_0x6db7('0x7b'),require('./api/variable'));_0x3e17d8[_0x6db7('0xa')](_0x6db7('0x7c'),require(_0x6db7('0x7d')));_0x3e17d8[_0x6db7('0xa')]('/api/integrations/reports',require(_0x6db7('0x7e')));_0x3e17d8[_0x6db7('0xa')](_0x6db7('0x7f'),require(_0x6db7('0x80')));_0x3e17d8['use'](_0x6db7('0x81'),require(_0x6db7('0x82')));_0x3e17d8['use']('/api/analytics/extracted_reports',require(_0x6db7('0x83')));_0x3e17d8['use'](_0x6db7('0x84'),require('./api/analyticMetric'));_0x3e17d8[_0x6db7('0xa')](_0x6db7('0x85'),require('./api/analyticFieldReport'));_0x3e17d8[_0x6db7('0xa')](_0x6db7('0x86'),require(_0x6db7('0x87')));_0x3e17d8[_0x6db7('0xa')](_0x6db7('0x88'),require(_0x6db7('0x89')));_0x3e17d8['use'](_0x6db7('0x8a'),require(_0x6db7('0x8b')));_0x3e17d8[_0x6db7('0xa')](_0x6db7('0x8c'),require(_0x6db7('0x8d')));_0x3e17d8['use'](_0x6db7('0x8e'),require(_0x6db7('0x8f')));_0x3e17d8[_0x6db7('0xa')](_0x6db7('0x90'),require(_0x6db7('0x91')));_0x3e17d8[_0x6db7('0xa')](_0x6db7('0x92'),require(_0x6db7('0x93')));_0x3e17d8[_0x6db7('0xa')](_0x6db7('0x94'),require('./api/intDeskAccount'));_0x3e17d8['use'](_0x6db7('0x95'),require(_0x6db7('0x96')));_0x3e17d8[_0x6db7('0xa')](_0x6db7('0x97'),require(_0x6db7('0x98')));_0x3e17d8[_0x6db7('0xa')]('/api/integrations/zoho/accounts',require('./api/intZohoAccount'));_0x3e17d8[_0x6db7('0xa')](_0x6db7('0x99'),require('./api/intZohoConfiguration'));_0x3e17d8[_0x6db7('0xa')]('/api/integrations/zoho/fields',require('./api/intZohoField'));_0x3e17d8[_0x6db7('0xa')](_0x6db7('0x9a'),require(_0x6db7('0x9b')));_0x3e17d8[_0x6db7('0xa')](_0x6db7('0x9c'),require(_0x6db7('0x9d')));_0x3e17d8['use'](_0x6db7('0x9e'),require(_0x6db7('0x9f')));_0x3e17d8[_0x6db7('0xa')](_0x6db7('0xa0'),require(_0x6db7('0xa1')));_0x3e17d8['use'](_0x6db7('0xa2'),require('./api/intFreshdeskConfiguration'));_0x3e17d8[_0x6db7('0xa')](_0x6db7('0xa3'),require(_0x6db7('0xa4')));_0x3e17d8[_0x6db7('0xa')](_0x6db7('0xa5'),require('./api/intVtigerAccount'));_0x3e17d8[_0x6db7('0xa')]('/api/integrations/vtiger/configurations',require(_0x6db7('0xa6')));_0x3e17d8[_0x6db7('0xa')](_0x6db7('0xa7'),require(_0x6db7('0xa8')));_0x3e17d8[_0x6db7('0xa')]('/api/integrations/servicenow/accounts',require(_0x6db7('0xa9')));_0x3e17d8[_0x6db7('0xa')](_0x6db7('0xaa'),require(_0x6db7('0xab')));_0x3e17d8['use'](_0x6db7('0xac'),require(_0x6db7('0xad')));_0x3e17d8[_0x6db7('0xa')](_0x6db7('0xae'),require(_0x6db7('0xaf')));_0x3e17d8[_0x6db7('0xa')](_0x6db7('0xb0'),require(_0x6db7('0xb1')));_0x3e17d8[_0x6db7('0xa')](_0x6db7('0xb2'),require('./api/intDynamics365Field'));_0x3e17d8[_0x6db7('0xa')](_0x6db7('0xb3'),require(_0x6db7('0xb4')));_0x3e17d8[_0x6db7('0xa')](_0x6db7('0xb5'),require('./api/intFreshsalesConfiguration'));_0x3e17d8[_0x6db7('0xa')](_0x6db7('0xb6'),require(_0x6db7('0xb7')));_0x3e17d8[_0x6db7('0xa')]('/api/networks',require(_0x6db7('0xb8')));_0x3e17d8[_0x6db7('0xa')](_0x6db7('0xb9'),require(_0x6db7('0xba')));_0x3e17d8['use'](_0x6db7('0xbb'),require(_0x6db7('0xbc')));_0x3e17d8[_0x6db7('0xa')](_0x6db7('0xbd'),require(_0x6db7('0xbe')));_0x3e17d8[_0x6db7('0xa')](_0x6db7('0xbf'),require(_0x6db7('0xc0')));_0x3e17d8[_0x6db7('0xa')](_0x6db7('0xc1'),require('./api/jscriptySessionReport'));_0x3e17d8[_0x6db7('0xa')](_0x6db7('0xc2'),require(_0x6db7('0xc3')));_0x3e17d8[_0x6db7('0xa')](_0x6db7('0xc4'),require(_0x6db7('0xc5')));_0x3e17d8['use'](_0x6db7('0xc6'),require(_0x6db7('0xc7')));_0x3e17d8[_0x6db7('0xa')](_0x6db7('0xc8'),require(_0x6db7('0xc9')));_0x3e17d8[_0x6db7('0xa')](_0x6db7('0xca'),require(_0x6db7('0xcb')));_0x3e17d8['use'](_0x6db7('0xcc'),require(_0x6db7('0xcd')));_0x3e17d8[_0x6db7('0xa')](_0x6db7('0xce'),require('./api/squareProject'));_0x3e17d8[_0x6db7('0xa')](_0x6db7('0xcf'),require(_0x6db7('0xd0')));_0x3e17d8[_0x6db7('0xa')](_0x6db7('0xd1'),require(_0x6db7('0xd2')));_0x3e17d8[_0x6db7('0xa')](_0x6db7('0xd3'),require(_0x6db7('0xd4')));_0x3e17d8['use'](_0x6db7('0xd5'),require(_0x6db7('0xd6')));_0x3e17d8[_0x6db7('0xa')](_0x6db7('0xd7'),require(_0x6db7('0xd8')));_0x3e17d8[_0x6db7('0xa')]('/api/migrations',require(_0x6db7('0xd9')));_0x3e17d8[_0x6db7('0xa')]('/api/attachments',require(_0x6db7('0xda')));_0x3e17d8['use']('/api/plugins',require(_0x6db7('0xdb')));_0x3e17d8['use'](_0x6db7('0xdc'),require(_0x6db7('0xdd')));_0x3e17d8[_0x6db7('0xa')](_0x6db7('0xde'),require('./api/chatTransferReport'));_0x3e17d8[_0x6db7('0xa')](_0x6db7('0xdf'),require(_0x6db7('0xe0')));_0x3e17d8[_0x6db7('0xa')](_0x6db7('0xe1'),require(_0x6db7('0xe2')));_0x3e17d8[_0x6db7('0xa')](_0x6db7('0xe3'),require(_0x6db7('0xe4')));_0x3e17d8[_0x6db7('0xa')](_0x6db7('0xe5'),require(_0x6db7('0xe6')));_0x3e17d8[_0x6db7('0xa')](_0x6db7('0xe7'),require(_0x6db7('0xe8')));_0x3e17d8[_0x6db7('0xa')]('/api/userProfiles',require('./api/userProfile'));_0x3e17d8[_0x6db7('0xa')](_0x6db7('0xe9'),require(_0x6db7('0xea')));_0x3e17d8[_0x6db7('0xa')]('/api/userProfile/resources',require('./api/userProfileResource'));_0x3e17d8[_0x6db7('0xa')](_0x6db7('0xeb'),require(_0x6db7('0xec')));_0x3e17d8['use'](_0x6db7('0xed'),require('./api/whatsappAccount'));_0x3e17d8['use'](_0x6db7('0xee'),require(_0x6db7('0xef')));_0x3e17d8[_0x6db7('0xa')]('/api/whatsapp/interactions',require(_0x6db7('0xf0')));_0x3e17d8[_0x6db7('0xa')](_0x6db7('0xf1'),require('./api/whatsappMessage'));_0x3e17d8['use'](_0x6db7('0xf2'),require(_0x6db7('0xf3')));_0x3e17d8[_0x6db7('0xa')](_0x6db7('0xf4'),require('./api/whatsappTransferReport'));_0x3e17d8[_0x6db7('0xa')](_0x6db7('0xf5'),require(_0x6db7('0xf6')));_0x3e17d8[_0x6db7('0xa')](_0x6db7('0xf7'),require('./api/cloudProvider'));_0x3e17d8[_0x6db7('0xa')](_0x6db7('0xf8'),require(_0x6db7('0xf9')));_0x3e17d8[_0x6db7('0xa')](_0x6db7('0xfa'),require(_0x6db7('0xfb')));_0x3e17d8['use'](_0x6db7('0xfc'),require(_0x6db7('0xfd')));_0x3e17d8[_0x6db7('0xa')](_0x6db7('0xfe'),require(_0x6db7('0xff')));_0x3e17d8[_0x6db7('0xa')](_0x6db7('0x100'),require(_0x6db7('0x101')));_0x3e17d8[_0x6db7('0xa')]('/api/jira',require('./api/jira'));_0x3e17d8[_0x6db7('0xa')](_0x6db7('0x102'),require(_0x6db7('0x103')));_0x3e17d8[_0x6db7('0xa')](_0x6db7('0x104'),require(_0x6db7('0x105')));_0x3e17d8['use']('/api/system',require(_0x6db7('0x106')));_0x3e17d8['use']('/api/pm2',require(_0x6db7('0x107')));_0x3e17d8[_0x6db7('0xa')](_0x6db7('0x108'),require(_0x6db7('0x109')));_0x3e17d8[_0x6db7('0xa')](_0x6db7('0x10a'),clientSideLogs);_0x3e17d8['use'](_0x6db7('0x10b'),express[_0x6db7('0x10c')](path['join'](config['root'],_0x6db7('0x10b'))));_0x3e17d8['use']('/www',express[_0x6db7('0x10c')](path[_0x6db7('0x10d')](config['root'],_0x6db7('0x10e'))));_0x3e17d8['use'](_0x6db7('0x10f'),express[_0x6db7('0x10c')](path[_0x6db7('0x10d')](config['root'],_0x6db7('0x10f'))));_0x3e17d8[_0x6db7('0xa')]('/snippet',express['static'](path[_0x6db7('0x10d')](config[_0x6db7('0x110')],_0x6db7('0x111'),_0x6db7('0x112'))));_0x3e17d8[_0x6db7('0xa')](_0x6db7('0x113'),express['static'](path['join'](config[_0x6db7('0x110')],_0x6db7('0x114'))));_0x3e17d8['route']('/:url(api|auth|components|app|bower_components|assets)/*')[_0x6db7('0x115')](errors[0x194]);_0x3e17d8[_0x6db7('0x116')]('/*')['get'](function(_0x54f9d9,_0x1f3241){_0x1f3241['sendFile'](path[_0x6db7('0x117')](_0x3e17d8[_0x6db7('0x115')]('appPath')+_0x6db7('0x118')));});return _0x3e17d8;});}; \ No newline at end of file +var _0x7dc2=['./api/integrationReport','./api/analyticCustomReport','./api/analyticDefaultReport','/api/analytics/extracted_reports','./api/analyticExtractedReport','/api/analytics/metrics','/api/analytics/field_reports','/api/analytics/tree_reports','./api/intSalesforceAccount','./api/intSalesforceConfiguration','/api/integrations/salesforce/fields','./api/intSalesforceField','./api/intSugarcrmAccount','./api/intSugarcrmConfiguration','/api/integrations/sugarcrm/fields','./api/intSugarcrmField','/api/integrations/desk/accounts','./api/intDeskAccount','/api/integrations/desk/configurations','/api/integrations/desk/fields','./api/intDeskField','/api/integrations/zoho/accounts','./api/intZohoAccount','/api/integrations/zoho/configurations','./api/intZohoConfiguration','/api/integrations/zoho/fields','./api/intZohoField','/api/integrations/zendesk/accounts','./api/intZendeskAccount','./api/intZendeskConfiguration','/api/integrations/zendesk/fields','./api/intZendeskField','/api/integrations/freshdesk/accounts','/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/integrations/servicenow/accounts','/api/integrations/servicenow/configurations','./api/intServicenowConfiguration','/api/integrations/servicenow/fields','/api/integrations/dynamics365/accounts','./api/intDynamics365Account','/api/integrations/dynamics365/configurations','./api/intDynamics365Configuration','./api/intDynamics365Field','/api/integrations/freshsales/accounts','./api/intFreshsalesAccount','/api/integrations/freshsales/configurations','./api/intFreshsalesConfiguration','/api/integrations/freshsales/fields','./api/intFreshsalesField','./api/network','/api/chat/reports/queue','/api/chat/internal/messages','./api/chatInternalMessage','/api/jscripty/answers/reports','./api/jscriptyAnswerReport','/api/jscripty/questions/reports','./api/jscriptyQuestionReport','/api/jscripty/sessions/reports','./api/jscriptySessionReport','/api/sms/reports/queue','./api/smsQueueReport','/api/square/reports','./api/squareReport','/api/square/details/reports','./api/squareReportDetail','./api/setting','/api/square/recordings','./api/squareRecording','/api/teams','/api/license','./api/license','/api/campaigns','./api/campaign','/api/migrations','./api/migration','./api/plugin','/api/mail/reports/transfer','/api/chat/reports/transfer','/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/sections','./api/userProfileSection','/api/userProfile/resources','./api/userProfileResource','/api/userNotifications','./api/userNotification','/api/whatsapp/accounts','./api/whatsappAccount','/api/whatsapp/applications','/api/whatsapp/interactions','./api/whatsappInteraction','/api/whatsapp/messages','/api/whatsapp/reports/queue','./api/whatsappQueueReport','/api/whatsapp/reports/transfer','./api/whatsappTransferReport','./api/whatsappQueue','/api/cloudProviders','./api/cloudProvider','/api/realtime','/api/user-settings','./api/user-setting','/api/auth/local','./api/authLocal','./api/authGoogle','./api/authActiveDirectory','./api/jira','./api/rpc','/api/version','/api/system','./api/system','/api/webbar','/apidoc','static','root','/www','join','/demo','/snippet','snippet','3.5.0','/plugins','/server/files/plugins','route','resolve','get','appPath','./errors','./config/environment','./utils/client-side-logger','setupLoggers','default','use','/api/users','./api/voiceChanSpy','./api/voiceContext','/api/voice/extensions','./api/voiceExtension','/api/voice/mohs','/api/voice/queues','./api/voiceQueue','./api/voiceRecording','/api/screen/recordings','./api/screenRecording','/api/voice/mails','./api/voiceMailMessage','/api/voice/calls/reports','./api/voiceCallReport','/api/voice/dials/reports','./api/voiceDialReport','/api/voice/agents/reports','./api/voiceAgentReport','/api/voice/queues/reports','./api/voiceQueueReport','/api/members/reports','/api/trunks','./api/trunk','/api/voice/transfers/reports','./api/voiceTransferReport','/api/mail/out_servers','./api/mailServerOut','./api/mailAccount','./api/mailQueue','./api/mailSubstatus','/api/mail/interactions','/api/mail/messages','./api/mailApplication','/api/mail/reports/queue','./api/mailQueueReport','/api/dashboards','/api/dashboards/items','./api/dashboardItem','/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/fax/reports/queue','./api/faxQueueReport','/api/sms/accounts','/api/sms/applications','./api/smsApplication','/api/sms/interactions','./api/smsInteraction','/api/sms/messages','/api/sms/queues','./api/smsQueue','/api/openchannel/accounts','./api/openchannelAccount','/api/openchannel/applications','./api/openchannelApplication','/api/openchannel/interactions','./api/openchannelInteraction','/api/openchannel/messages','./api/openchannelMessage','./api/openchannelQueue','/api/chat/websites','./api/chatWebsite','./api/openchannelQueueReport','/api/chat/applications','./api/chatInteraction','/api/chat/messages','./api/chatMessage','/api/chat/offline_messages','./api/chatOfflineMessage','/api/chat/queues','./api/chatQueue','/api/chat/groups','./api/chatGroup','/api/chat/proactive_actions','./api/chatProactiveAction','./api/cmCompany','/api/cm/contacts','./api/cmContact','/api/cm/hopper','./api/cmHopper','/api/cm/hopper_black','./api/cmHopperBlack','/api/cm/hopper_history','./api/cmHopperHistory','/api/cm/custom_fields','/api/actions','/api/automations','./api/automation','/api/canned_answers','./api/cannedAnswer','/api/dispositions','/api/conditions','/api/intervals','./api/interval','/api/pauses','./api/pause','/api/cdr','./api/cdr','/api/voiceQueuesLog','/api/schedules','./api/schedule','/api/sounds','/api/tags','./api/tag','/api/contact_item_types','./api/contactItemType','/api/cm_contact_has_items','./api/cmContactHasItem','./api/cmHopperAdditionalPhone','./api/template','/api/variables','/api/integrations','./api/integration'];(function(_0x3b58d9,_0x3e02ec){var _0x28f2d4=function(_0x963ce3){while(--_0x963ce3){_0x3b58d9['push'](_0x3b58d9['shift']());}};_0x28f2d4(++_0x3e02ec);}(_0x7dc2,0x19d));var _0x27dc=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x7dc2[_0x20a584];return _0x4b41a8;};'use strict';var path=require('path');var express=require('express');var errors=require(_0x27dc('0x0'));var config=require(_0x27dc('0x1'));var setupLoggers=require(_0x27dc('0x2'))[_0x27dc('0x3')];var clientSideLogs=require('./api/client-side-logs');exports[_0x27dc('0x4')]=function(_0x29ba23){return setupLoggers(_0x29ba23)['then'](function(){_0x29ba23[_0x27dc('0x5')](_0x27dc('0x6'),require('./api/user'));_0x29ba23[_0x27dc('0x5')]('/api/voice/chanspy',require(_0x27dc('0x7')));_0x29ba23[_0x27dc('0x5')]('/api/voice/contexts',require(_0x27dc('0x8')));_0x29ba23[_0x27dc('0x5')](_0x27dc('0x9'),require(_0x27dc('0xa')));_0x29ba23['use'](_0x27dc('0xb'),require('./api/voiceMusicOnHold'));_0x29ba23[_0x27dc('0x5')](_0x27dc('0xc'),require(_0x27dc('0xd')));_0x29ba23['use']('/api/voice/recordings',require(_0x27dc('0xe')));_0x29ba23[_0x27dc('0x5')](_0x27dc('0xf'),require(_0x27dc('0x10')));_0x29ba23['use'](_0x27dc('0x11'),require('./api/voiceMail'));_0x29ba23[_0x27dc('0x5')]('/api/voice/mails/messages',require(_0x27dc('0x12')));_0x29ba23[_0x27dc('0x5')](_0x27dc('0x13'),require(_0x27dc('0x14')));_0x29ba23['use'](_0x27dc('0x15'),require(_0x27dc('0x16')));_0x29ba23[_0x27dc('0x5')](_0x27dc('0x17'),require(_0x27dc('0x18')));_0x29ba23['use'](_0x27dc('0x19'),require(_0x27dc('0x1a')));_0x29ba23[_0x27dc('0x5')](_0x27dc('0x1b'),require('./api/memberReport'));_0x29ba23[_0x27dc('0x5')](_0x27dc('0x1c'),require(_0x27dc('0x1d')));_0x29ba23[_0x27dc('0x5')](_0x27dc('0x1e'),require(_0x27dc('0x1f')));_0x29ba23[_0x27dc('0x5')](_0x27dc('0x20'),require(_0x27dc('0x21')));_0x29ba23[_0x27dc('0x5')]('/api/mail/accounts',require(_0x27dc('0x22')));_0x29ba23[_0x27dc('0x5')]('/api/mail/queues',require(_0x27dc('0x23')));_0x29ba23['use']('/api/mail/substatuses',require(_0x27dc('0x24')));_0x29ba23['use'](_0x27dc('0x25'),require('./api/mailInteraction'));_0x29ba23['use'](_0x27dc('0x26'),require('./api/mailMessage'));_0x29ba23[_0x27dc('0x5')]('/api/mail/applications',require(_0x27dc('0x27')));_0x29ba23[_0x27dc('0x5')](_0x27dc('0x28'),require(_0x27dc('0x29')));_0x29ba23['use'](_0x27dc('0x2a'),require('./api/dashboard'));_0x29ba23['use'](_0x27dc('0x2b'),require(_0x27dc('0x2c')));_0x29ba23['use'](_0x27dc('0x2d'),require(_0x27dc('0x2e')));_0x29ba23[_0x27dc('0x5')](_0x27dc('0x2f'),require(_0x27dc('0x30')));_0x29ba23[_0x27dc('0x5')](_0x27dc('0x31'),require(_0x27dc('0x32')));_0x29ba23[_0x27dc('0x5')](_0x27dc('0x33'),require(_0x27dc('0x34')));_0x29ba23['use'](_0x27dc('0x35'),require(_0x27dc('0x36')));_0x29ba23['use'](_0x27dc('0x37'),require(_0x27dc('0x38')));_0x29ba23[_0x27dc('0x5')](_0x27dc('0x39'),require('./api/smsAccount'));_0x29ba23[_0x27dc('0x5')](_0x27dc('0x3a'),require(_0x27dc('0x3b')));_0x29ba23['use'](_0x27dc('0x3c'),require(_0x27dc('0x3d')));_0x29ba23[_0x27dc('0x5')](_0x27dc('0x3e'),require('./api/smsMessage'));_0x29ba23[_0x27dc('0x5')](_0x27dc('0x3f'),require(_0x27dc('0x40')));_0x29ba23['use'](_0x27dc('0x41'),require(_0x27dc('0x42')));_0x29ba23[_0x27dc('0x5')](_0x27dc('0x43'),require(_0x27dc('0x44')));_0x29ba23['use'](_0x27dc('0x45'),require(_0x27dc('0x46')));_0x29ba23[_0x27dc('0x5')](_0x27dc('0x47'),require(_0x27dc('0x48')));_0x29ba23['use']('/api/openchannel/queues',require(_0x27dc('0x49')));_0x29ba23[_0x27dc('0x5')](_0x27dc('0x4a'),require(_0x27dc('0x4b')));_0x29ba23['use']('/api/openchannel/reports/queue',require(_0x27dc('0x4c')));_0x29ba23[_0x27dc('0x5')](_0x27dc('0x4d'),require('./api/chatApplication'));_0x29ba23[_0x27dc('0x5')]('/api/chat/interactions',require(_0x27dc('0x4e')));_0x29ba23['use'](_0x27dc('0x4f'),require(_0x27dc('0x50')));_0x29ba23[_0x27dc('0x5')](_0x27dc('0x51'),require(_0x27dc('0x52')));_0x29ba23[_0x27dc('0x5')](_0x27dc('0x53'),require(_0x27dc('0x54')));_0x29ba23['use'](_0x27dc('0x55'),require(_0x27dc('0x56')));_0x29ba23['use'](_0x27dc('0x57'),require(_0x27dc('0x58')));_0x29ba23[_0x27dc('0x5')]('/api/cm/companies',require(_0x27dc('0x59')));_0x29ba23[_0x27dc('0x5')](_0x27dc('0x5a'),require(_0x27dc('0x5b')));_0x29ba23['use'](_0x27dc('0x5c'),require(_0x27dc('0x5d')));_0x29ba23[_0x27dc('0x5')](_0x27dc('0x5e'),require(_0x27dc('0x5f')));_0x29ba23[_0x27dc('0x5')]('/api/cm/hopper_final',require('./api/cmHopperFinal'));_0x29ba23['use'](_0x27dc('0x60'),require(_0x27dc('0x61')));_0x29ba23[_0x27dc('0x5')](_0x27dc('0x62'),require('./api/cmCustomField'));_0x29ba23['use'](_0x27dc('0x63'),require('./api/action'));_0x29ba23[_0x27dc('0x5')](_0x27dc('0x64'),require(_0x27dc('0x65')));_0x29ba23['use'](_0x27dc('0x66'),require(_0x27dc('0x67')));_0x29ba23[_0x27dc('0x5')](_0x27dc('0x68'),require('./api/disposition'));_0x29ba23[_0x27dc('0x5')](_0x27dc('0x69'),require('./api/condition'));_0x29ba23[_0x27dc('0x5')](_0x27dc('0x6a'),require(_0x27dc('0x6b')));_0x29ba23[_0x27dc('0x5')](_0x27dc('0x6c'),require(_0x27dc('0x6d')));_0x29ba23[_0x27dc('0x5')](_0x27dc('0x6e'),require(_0x27dc('0x6f')));_0x29ba23['use'](_0x27dc('0x70'),require('./api/voiceQueuesLog'));_0x29ba23[_0x27dc('0x5')](_0x27dc('0x71'),require(_0x27dc('0x72')));_0x29ba23[_0x27dc('0x5')](_0x27dc('0x73'),require('./api/sound'));_0x29ba23[_0x27dc('0x5')](_0x27dc('0x74'),require(_0x27dc('0x75')));_0x29ba23[_0x27dc('0x5')](_0x27dc('0x76'),require(_0x27dc('0x77')));_0x29ba23[_0x27dc('0x5')](_0x27dc('0x78'),require(_0x27dc('0x79')));_0x29ba23['use']('/api/cm_hopper_additional_phones',require(_0x27dc('0x7a')));_0x29ba23[_0x27dc('0x5')]('/api/templates',require(_0x27dc('0x7b')));_0x29ba23[_0x27dc('0x5')]('/api/triggers',require('./api/trigger'));_0x29ba23['use'](_0x27dc('0x7c'),require('./api/variable'));_0x29ba23['use'](_0x27dc('0x7d'),require(_0x27dc('0x7e')));_0x29ba23[_0x27dc('0x5')]('/api/integrations/reports',require(_0x27dc('0x7f')));_0x29ba23[_0x27dc('0x5')]('/api/analytics/custom_reports',require(_0x27dc('0x80')));_0x29ba23[_0x27dc('0x5')]('/api/analytics/default_reports',require(_0x27dc('0x81')));_0x29ba23[_0x27dc('0x5')](_0x27dc('0x82'),require(_0x27dc('0x83')));_0x29ba23[_0x27dc('0x5')](_0x27dc('0x84'),require('./api/analyticMetric'));_0x29ba23[_0x27dc('0x5')](_0x27dc('0x85'),require('./api/analyticFieldReport'));_0x29ba23[_0x27dc('0x5')](_0x27dc('0x86'),require('./api/analyticTreeReport'));_0x29ba23[_0x27dc('0x5')]('/api/integrations/salesforce/accounts',require(_0x27dc('0x87')));_0x29ba23[_0x27dc('0x5')]('/api/integrations/salesforce/configurations',require(_0x27dc('0x88')));_0x29ba23[_0x27dc('0x5')](_0x27dc('0x89'),require(_0x27dc('0x8a')));_0x29ba23['use']('/api/integrations/sugarcrm/accounts',require(_0x27dc('0x8b')));_0x29ba23[_0x27dc('0x5')]('/api/integrations/sugarcrm/configurations',require(_0x27dc('0x8c')));_0x29ba23['use'](_0x27dc('0x8d'),require(_0x27dc('0x8e')));_0x29ba23['use'](_0x27dc('0x8f'),require(_0x27dc('0x90')));_0x29ba23[_0x27dc('0x5')](_0x27dc('0x91'),require('./api/intDeskConfiguration'));_0x29ba23[_0x27dc('0x5')](_0x27dc('0x92'),require(_0x27dc('0x93')));_0x29ba23[_0x27dc('0x5')](_0x27dc('0x94'),require(_0x27dc('0x95')));_0x29ba23[_0x27dc('0x5')](_0x27dc('0x96'),require(_0x27dc('0x97')));_0x29ba23[_0x27dc('0x5')](_0x27dc('0x98'),require(_0x27dc('0x99')));_0x29ba23[_0x27dc('0x5')](_0x27dc('0x9a'),require(_0x27dc('0x9b')));_0x29ba23[_0x27dc('0x5')]('/api/integrations/zendesk/configurations',require(_0x27dc('0x9c')));_0x29ba23['use'](_0x27dc('0x9d'),require(_0x27dc('0x9e')));_0x29ba23['use'](_0x27dc('0x9f'),require('./api/intFreshdeskAccount'));_0x29ba23['use'](_0x27dc('0xa0'),require(_0x27dc('0xa1')));_0x29ba23[_0x27dc('0x5')](_0x27dc('0xa2'),require(_0x27dc('0xa3')));_0x29ba23['use'](_0x27dc('0xa4'),require(_0x27dc('0xa5')));_0x29ba23[_0x27dc('0x5')](_0x27dc('0xa6'),require(_0x27dc('0xa7')));_0x29ba23[_0x27dc('0x5')](_0x27dc('0xa8'),require('./api/intVtigerField'));_0x29ba23[_0x27dc('0x5')](_0x27dc('0xa9'),require('./api/intServicenowAccount'));_0x29ba23[_0x27dc('0x5')](_0x27dc('0xaa'),require(_0x27dc('0xab')));_0x29ba23[_0x27dc('0x5')](_0x27dc('0xac'),require('./api/intServicenowField'));_0x29ba23[_0x27dc('0x5')](_0x27dc('0xad'),require(_0x27dc('0xae')));_0x29ba23[_0x27dc('0x5')](_0x27dc('0xaf'),require(_0x27dc('0xb0')));_0x29ba23[_0x27dc('0x5')]('/api/integrations/dynamics365/fields',require(_0x27dc('0xb1')));_0x29ba23[_0x27dc('0x5')](_0x27dc('0xb2'),require(_0x27dc('0xb3')));_0x29ba23[_0x27dc('0x5')](_0x27dc('0xb4'),require(_0x27dc('0xb5')));_0x29ba23[_0x27dc('0x5')](_0x27dc('0xb6'),require(_0x27dc('0xb7')));_0x29ba23[_0x27dc('0x5')]('/api/networks',require(_0x27dc('0xb8')));_0x29ba23[_0x27dc('0x5')](_0x27dc('0xb9'),require('./api/chatQueueReport'));_0x29ba23[_0x27dc('0x5')](_0x27dc('0xba'),require(_0x27dc('0xbb')));_0x29ba23[_0x27dc('0x5')](_0x27dc('0xbc'),require(_0x27dc('0xbd')));_0x29ba23[_0x27dc('0x5')](_0x27dc('0xbe'),require(_0x27dc('0xbf')));_0x29ba23[_0x27dc('0x5')](_0x27dc('0xc0'),require(_0x27dc('0xc1')));_0x29ba23[_0x27dc('0x5')](_0x27dc('0xc2'),require(_0x27dc('0xc3')));_0x29ba23[_0x27dc('0x5')](_0x27dc('0xc4'),require(_0x27dc('0xc5')));_0x29ba23[_0x27dc('0x5')](_0x27dc('0xc6'),require(_0x27dc('0xc7')));_0x29ba23[_0x27dc('0x5')]('/api/jscripty/projects',require('./api/jscriptyProject'));_0x29ba23[_0x27dc('0x5')]('/api/settings',require(_0x27dc('0xc8')));_0x29ba23[_0x27dc('0x5')]('/api/square/odbc',require('./api/squareOdbc'));_0x29ba23[_0x27dc('0x5')]('/api/square/projects',require('./api/squareProject'));_0x29ba23[_0x27dc('0x5')](_0x27dc('0xc9'),require(_0x27dc('0xca')));_0x29ba23[_0x27dc('0x5')]('/api/square/messages',require('./api/squareMessage'));_0x29ba23[_0x27dc('0x5')](_0x27dc('0xcb'),require('./api/team'));_0x29ba23['use'](_0x27dc('0xcc'),require(_0x27dc('0xcd')));_0x29ba23['use'](_0x27dc('0xce'),require(_0x27dc('0xcf')));_0x29ba23['use'](_0x27dc('0xd0'),require(_0x27dc('0xd1')));_0x29ba23[_0x27dc('0x5')]('/api/attachments',require('./api/attachment'));_0x29ba23[_0x27dc('0x5')]('/api/plugins',require(_0x27dc('0xd2')));_0x29ba23['use'](_0x27dc('0xd3'),require('./api/mailTransferReport'));_0x29ba23[_0x27dc('0x5')](_0x27dc('0xd4'),require('./api/chatTransferReport'));_0x29ba23[_0x27dc('0x5')](_0x27dc('0xd5'),require(_0x27dc('0xd6')));_0x29ba23[_0x27dc('0x5')](_0x27dc('0xd7'),require(_0x27dc('0xd8')));_0x29ba23[_0x27dc('0x5')](_0x27dc('0xd9'),require(_0x27dc('0xda')));_0x29ba23['use'](_0x27dc('0xdb'),require('./api/cmList'));_0x29ba23[_0x27dc('0x5')](_0x27dc('0xdc'),require(_0x27dc('0xdd')));_0x29ba23['use'](_0x27dc('0xde'),require('./api/userProfile'));_0x29ba23[_0x27dc('0x5')](_0x27dc('0xdf'),require(_0x27dc('0xe0')));_0x29ba23['use'](_0x27dc('0xe1'),require(_0x27dc('0xe2')));_0x29ba23['use'](_0x27dc('0xe3'),require(_0x27dc('0xe4')));_0x29ba23[_0x27dc('0x5')](_0x27dc('0xe5'),require(_0x27dc('0xe6')));_0x29ba23['use'](_0x27dc('0xe7'),require('./api/whatsappApplication'));_0x29ba23['use'](_0x27dc('0xe8'),require(_0x27dc('0xe9')));_0x29ba23[_0x27dc('0x5')](_0x27dc('0xea'),require('./api/whatsappMessage'));_0x29ba23[_0x27dc('0x5')](_0x27dc('0xeb'),require(_0x27dc('0xec')));_0x29ba23['use'](_0x27dc('0xed'),require(_0x27dc('0xee')));_0x29ba23[_0x27dc('0x5')]('/api/whatsapp/queues',require(_0x27dc('0xef')));_0x29ba23[_0x27dc('0x5')](_0x27dc('0xf0'),require(_0x27dc('0xf1')));_0x29ba23[_0x27dc('0x5')](_0x27dc('0xf2'),require('./api/realtime'));_0x29ba23['use'](_0x27dc('0xf3'),require(_0x27dc('0xf4')));_0x29ba23['use'](_0x27dc('0xf5'),require(_0x27dc('0xf6')));_0x29ba23[_0x27dc('0x5')]('/api/auth/google',require(_0x27dc('0xf7')));_0x29ba23['use']('/api/auth/activedirectory',require(_0x27dc('0xf8')));_0x29ba23[_0x27dc('0x5')]('/api/jira',require(_0x27dc('0xf9')));_0x29ba23['use']('/api/rpc',require(_0x27dc('0xfa')));_0x29ba23[_0x27dc('0x5')](_0x27dc('0xfb'),require('./api/version'));_0x29ba23[_0x27dc('0x5')](_0x27dc('0xfc'),require(_0x27dc('0xfd')));_0x29ba23[_0x27dc('0x5')]('/api/pm2',require('./api/pm2'));_0x29ba23[_0x27dc('0x5')](_0x27dc('0xfe'),require('./api/webbar'));_0x29ba23[_0x27dc('0x5')]('/api/logs',clientSideLogs);_0x29ba23[_0x27dc('0x5')](_0x27dc('0xff'),express[_0x27dc('0x100')](path['join'](config[_0x27dc('0x101')],'/apidoc')));_0x29ba23['use'](_0x27dc('0x102'),express[_0x27dc('0x100')](path[_0x27dc('0x103')](config[_0x27dc('0x101')],'/www')));_0x29ba23[_0x27dc('0x5')](_0x27dc('0x104'),express[_0x27dc('0x100')](path[_0x27dc('0x103')](config[_0x27dc('0x101')],_0x27dc('0x104'))));_0x29ba23[_0x27dc('0x5')](_0x27dc('0x105'),express[_0x27dc('0x100')](path['join'](config[_0x27dc('0x101')],_0x27dc('0x106'),_0x27dc('0x107'))));_0x29ba23[_0x27dc('0x5')](_0x27dc('0x108'),express[_0x27dc('0x100')](path[_0x27dc('0x103')](config['root'],_0x27dc('0x109'))));_0x29ba23[_0x27dc('0x10a')]('/:url(api|auth|components|app|bower_components|assets)/*')['get'](errors[0x194]);_0x29ba23[_0x27dc('0x10a')]('/*')['get'](function(_0x2345ae,_0x1f0832){_0x1f0832['sendFile'](path[_0x27dc('0x10b')](_0x29ba23[_0x27dc('0x10c')](_0x27dc('0x10d'))+'/index.html'));});return _0x29ba23;});}; \ No newline at end of file diff --git a/server/rpc/index.js b/server/rpc/index.js index 227f819..9a9c5f5 100644 --- a/server/rpc/index.js +++ b/server/rpc/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0497=['../api/chatInteraction/chatInteraction.rpc','../api/chatMessage/chatMessage.rpc','../api/cmContact/cmContact.rpc','../api/interval/interval.rpc','../api/pause/pause.rpc','../api/template/template.rpc','../api/trigger/trigger.rpc','../api/intSalesforceAccount/intSalesforceAccount.rpc','../api/intSugarcrmAccount/intSugarcrmAccount.rpc','../api/intZohoAccount/intZohoAccount.rpc','../api/intZendeskAccount/intZendeskAccount.rpc','../api/intServicenowAccount/intServicenowAccount.rpc','../api/intFreshsalesAccount/intFreshsalesAccount.rpc','../api/chatQueueReport/chatQueueReport.rpc','../api/squareReportDetail/squareReportDetail.rpc','../api/squareOdbc/squareOdbc.rpc','../api/squareProject/squareProject.rpc','../api/squareMessage/squareMessage.rpc','../api/campaign/campaign.rpc','../api/attachment/attachment.rpc','../api/plugin/plugin.rpc','../api/whatsappInteraction/whatsappInteraction.rpc','../api/whatsappQueueReport/whatsappQueueReport.rpc','rpc','port','error','Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!','../config/triggers','default','RPC\x20listening\x20on\x20','jayson/promise','lodash','listen','merge','../api/user/user.rpc','../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/memberReport/memberReport.rpc','../api/trunk/trunk.rpc','../api/mailServerIn/mailServerIn.rpc','../api/mailAccount/mailAccount.rpc','../api/mailQueue/mailQueue.rpc','../api/mailInteraction/mailInteraction.rpc','../api/mailMessage/mailMessage.rpc','../api/mailApplication/mailApplication.rpc','../api/mailQueueReport/mailQueueReport.rpc','../api/faxAccount/faxAccount.rpc','../api/faxApplication/faxApplication.rpc','../api/faxInteraction/faxInteraction.rpc','../api/faxMessage/faxMessage.rpc','../api/faxQueue/faxQueue.rpc','../api/faxQueueReport/faxQueueReport.rpc','../api/smsAccount/smsAccount.rpc','../api/smsInteraction/smsInteraction.rpc','../api/smsMessage/smsMessage.rpc','../api/smsQueue/smsQueue.rpc','../api/openchannelApplication/openchannelApplication.rpc','../api/openchannelInteraction/openchannelInteraction.rpc','../api/openchannelMessage/openchannelMessage.rpc','../api/openchannelQueue/openchannelQueue.rpc','../api/openchannelQueueReport/openchannelQueueReport.rpc'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0x0497,0xe1));var _0x7049=function(_0x10a12a,_0xee7529){_0x10a12a=_0x10a12a-0x0;var _0x1905af=_0x0497[_0x10a12a];return _0x1905af;};'use strict';var jayson=require(_0x7049('0x0'));var _=require(_0x7049('0x1'));var config=require('../config/environment');exports[_0x7049('0x2')]=function(){return new Promise(function(_0x122d5c,_0x455419){var _0x11bbf7={};_0x11bbf7=_[_0x7049('0x3')](_0x11bbf7,require(_0x7049('0x4')));_0x11bbf7=_[_0x7049('0x3')](_0x11bbf7,require(_0x7049('0x5')));_0x11bbf7=_[_0x7049('0x3')](_0x11bbf7,require(_0x7049('0x6')));_0x11bbf7=_[_0x7049('0x3')](_0x11bbf7,require(_0x7049('0x7')));_0x11bbf7=_['merge'](_0x11bbf7,require(_0x7049('0x8')));_0x11bbf7=_['merge'](_0x11bbf7,require(_0x7049('0x9')));_0x11bbf7=_[_0x7049('0x3')](_0x11bbf7,require(_0x7049('0xa')));_0x11bbf7=_[_0x7049('0x3')](_0x11bbf7,require('../api/voiceQueueReport/voiceQueueReport.rpc'));_0x11bbf7=_[_0x7049('0x3')](_0x11bbf7,require(_0x7049('0xb')));_0x11bbf7=_[_0x7049('0x3')](_0x11bbf7,require(_0x7049('0xc')));_0x11bbf7=_[_0x7049('0x3')](_0x11bbf7,require('../api/voiceTransferReport/voiceTransferReport.rpc'));_0x11bbf7=_[_0x7049('0x3')](_0x11bbf7,require('../api/userVoiceQueueRt/userVoiceQueueRt.rpc'));_0x11bbf7=_[_0x7049('0x3')](_0x11bbf7,require(_0x7049('0xd')));_0x11bbf7=_[_0x7049('0x3')](_0x11bbf7,require(_0x7049('0xe')));_0x11bbf7=_[_0x7049('0x3')](_0x11bbf7,require(_0x7049('0xf')));_0x11bbf7=_[_0x7049('0x3')](_0x11bbf7,require(_0x7049('0x10')));_0x11bbf7=_[_0x7049('0x3')](_0x11bbf7,require(_0x7049('0x11')));_0x11bbf7=_['merge'](_0x11bbf7,require(_0x7049('0x12')));_0x11bbf7=_['merge'](_0x11bbf7,require(_0x7049('0x13')));_0x11bbf7=_[_0x7049('0x3')](_0x11bbf7,require(_0x7049('0x14')));_0x11bbf7=_[_0x7049('0x3')](_0x11bbf7,require(_0x7049('0x15')));_0x11bbf7=_[_0x7049('0x3')](_0x11bbf7,require(_0x7049('0x16')));_0x11bbf7=_[_0x7049('0x3')](_0x11bbf7,require(_0x7049('0x17')));_0x11bbf7=_['merge'](_0x11bbf7,require(_0x7049('0x18')));_0x11bbf7=_[_0x7049('0x3')](_0x11bbf7,require(_0x7049('0x19')));_0x11bbf7=_[_0x7049('0x3')](_0x11bbf7,require(_0x7049('0x1a')));_0x11bbf7=_[_0x7049('0x3')](_0x11bbf7,require(_0x7049('0x1b')));_0x11bbf7=_[_0x7049('0x3')](_0x11bbf7,require(_0x7049('0x1c')));_0x11bbf7=_['merge'](_0x11bbf7,require(_0x7049('0x1d')));_0x11bbf7=_['merge'](_0x11bbf7,require(_0x7049('0x1e')));_0x11bbf7=_[_0x7049('0x3')](_0x11bbf7,require(_0x7049('0x1f')));_0x11bbf7=_[_0x7049('0x3')](_0x11bbf7,require(_0x7049('0x20')));_0x11bbf7=_[_0x7049('0x3')](_0x11bbf7,require(_0x7049('0x21')));_0x11bbf7=_[_0x7049('0x3')](_0x11bbf7,require(_0x7049('0x22')));_0x11bbf7=_[_0x7049('0x3')](_0x11bbf7,require(_0x7049('0x23')));_0x11bbf7=_[_0x7049('0x3')](_0x11bbf7,require(_0x7049('0x24')));_0x11bbf7=_['merge'](_0x11bbf7,require('../api/chatQueue/chatQueue.rpc'));_0x11bbf7=_[_0x7049('0x3')](_0x11bbf7,require(_0x7049('0x25')));_0x11bbf7=_[_0x7049('0x3')](_0x11bbf7,require('../api/cmHopper/cmHopper.rpc'));_0x11bbf7=_['merge'](_0x11bbf7,require('../api/cmHopperBlack/cmHopperBlack.rpc'));_0x11bbf7=_[_0x7049('0x3')](_0x11bbf7,require('../api/cmHopperFinal/cmHopperFinal.rpc'));_0x11bbf7=_['merge'](_0x11bbf7,require('../api/cmHopperHistory/cmHopperHistory.rpc'));_0x11bbf7=_[_0x7049('0x3')](_0x11bbf7,require('../api/reportAgentPreview/reportAgentPreview.rpc'));_0x11bbf7=_[_0x7049('0x3')](_0x11bbf7,require(_0x7049('0x26')));_0x11bbf7=_[_0x7049('0x3')](_0x11bbf7,require(_0x7049('0x27')));_0x11bbf7=_['merge'](_0x11bbf7,require('../api/sound/sound.rpc'));_0x11bbf7=_[_0x7049('0x3')](_0x11bbf7,require('../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc'));_0x11bbf7=_[_0x7049('0x3')](_0x11bbf7,require(_0x7049('0x28')));_0x11bbf7=_[_0x7049('0x3')](_0x11bbf7,require(_0x7049('0x29')));_0x11bbf7=_[_0x7049('0x3')](_0x11bbf7,require('../api/variable/variable.rpc'));_0x11bbf7=_[_0x7049('0x3')](_0x11bbf7,require(_0x7049('0x2a')));_0x11bbf7=_['merge'](_0x11bbf7,require(_0x7049('0x2b')));_0x11bbf7=_['merge'](_0x11bbf7,require('../api/intDeskAccount/intDeskAccount.rpc'));_0x11bbf7=_[_0x7049('0x3')](_0x11bbf7,require(_0x7049('0x2c')));_0x11bbf7=_[_0x7049('0x3')](_0x11bbf7,require(_0x7049('0x2d')));_0x11bbf7=_[_0x7049('0x3')](_0x11bbf7,require('../api/intFreshdeskAccount/intFreshdeskAccount.rpc'));_0x11bbf7=_[_0x7049('0x3')](_0x11bbf7,require('../api/intVtigerAccount/intVtigerAccount.rpc'));_0x11bbf7=_['merge'](_0x11bbf7,require(_0x7049('0x2e')));_0x11bbf7=_[_0x7049('0x3')](_0x11bbf7,require('../api/intDynamics365Account/intDynamics365Account.rpc'));_0x11bbf7=_[_0x7049('0x3')](_0x11bbf7,require(_0x7049('0x2f')));_0x11bbf7=_[_0x7049('0x3')](_0x11bbf7,require(_0x7049('0x30')));_0x11bbf7=_['merge'](_0x11bbf7,require('../api/smsQueueReport/smsQueueReport.rpc'));_0x11bbf7=_[_0x7049('0x3')](_0x11bbf7,require('../api/squareReport/squareReport.rpc'));_0x11bbf7=_[_0x7049('0x3')](_0x11bbf7,require(_0x7049('0x31')));_0x11bbf7=_['merge'](_0x11bbf7,require('../api/setting/setting.rpc'));_0x11bbf7=_[_0x7049('0x3')](_0x11bbf7,require(_0x7049('0x32')));_0x11bbf7=_[_0x7049('0x3')](_0x11bbf7,require(_0x7049('0x33')));_0x11bbf7=_[_0x7049('0x3')](_0x11bbf7,require('../api/squareRecording/squareRecording.rpc'));_0x11bbf7=_[_0x7049('0x3')](_0x11bbf7,require(_0x7049('0x34')));_0x11bbf7=_['merge'](_0x11bbf7,require(_0x7049('0x35')));_0x11bbf7=_[_0x7049('0x3')](_0x11bbf7,require(_0x7049('0x36')));_0x11bbf7=_[_0x7049('0x3')](_0x11bbf7,require(_0x7049('0x37')));_0x11bbf7=_[_0x7049('0x3')](_0x11bbf7,require('../api/whatsappAccount/whatsappAccount.rpc'));_0x11bbf7=_[_0x7049('0x3')](_0x11bbf7,require(_0x7049('0x38')));_0x11bbf7=_['merge'](_0x11bbf7,require('../api/whatsappMessage/whatsappMessage.rpc'));_0x11bbf7=_[_0x7049('0x3')](_0x11bbf7,require(_0x7049('0x39')));_0x11bbf7=_[_0x7049('0x3')](_0x11bbf7,require('../api/whatsappQueue/whatsappQueue.rpc'));var _0x44ef9d=jayson['server'](_0x11bbf7)['http']();var _0x520a01=config[_0x7049('0x3a')]['port']||config[_0x7049('0x3b')]+0x1;var _0x3ec3c5=config[_0x7049('0x3a')]['ip']||'localhost';_0x44ef9d['on'](_0x7049('0x3c'),function(_0x272c7f){return _0x455419(_0x272c7f);});_0x44ef9d[_0x7049('0x2')](_0x520a01,_0x3ec3c5,function(){console['log'](_0x7049('0x3d'),_0x3ec3c5,_0x520a01);require(_0x7049('0x3e'))[_0x7049('0x3f')]();return _0x122d5c(_0x7049('0x40')+_0x3ec3c5+':'+_0x520a01);});});}; \ No newline at end of file +var _0xa680=['../api/openchannelInteraction/openchannelInteraction.rpc','../api/openchannelMessage/openchannelMessage.rpc','../api/openchannelQueue/openchannelQueue.rpc','../api/openchannelQueueReport/openchannelQueueReport.rpc','../api/chatQueue/chatQueue.rpc','../api/cmHopperFinal/cmHopperFinal.rpc','../api/cmHopperHistory/cmHopperHistory.rpc','../api/interval/interval.rpc','../api/sound/sound.rpc','../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc','../api/trigger/trigger.rpc','../api/variable/variable.rpc','../api/intDeskAccount/intDeskAccount.rpc','../api/intZohoAccount/intZohoAccount.rpc','../api/intFreshdeskAccount/intFreshdeskAccount.rpc','../api/intVtigerAccount/intVtigerAccount.rpc','../api/intServicenowAccount/intServicenowAccount.rpc','../api/intFreshsalesAccount/intFreshsalesAccount.rpc','../api/chatQueueReport/chatQueueReport.rpc','../api/smsQueueReport/smsQueueReport.rpc','../api/squareReportDetail/squareReportDetail.rpc','../api/setting/setting.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/whatsappMessage/whatsappMessage.rpc','../api/whatsappQueueReport/whatsappQueueReport.rpc','../api/whatsappQueue/whatsappQueue.rpc','server','http','rpc','port','localhost','error','listen','../config/triggers','RPC\x20listening\x20on\x20','jayson/promise','lodash','merge','../api/voiceRecording/voiceRecording.rpc','../api/voiceCallReport/voiceCallReport.rpc','../api/voiceDialReport/voiceDialReport.rpc','../api/voiceQueueReport/voiceQueueReport.rpc','../api/memberReport/memberReport.rpc','../api/trunk/trunk.rpc','../api/voiceTransferReport/voiceTransferReport.rpc','../api/userVoiceQueueRt/userVoiceQueueRt.rpc','../api/mailServerIn/mailServerIn.rpc','../api/mailAccount/mailAccount.rpc','../api/mailQueue/mailQueue.rpc','../api/mailInteraction/mailInteraction.rpc','../api/mailApplication/mailApplication.rpc','../api/mailQueueReport/mailQueueReport.rpc','../api/faxAccount/faxAccount.rpc','../api/faxApplication/faxApplication.rpc','../api/faxMessage/faxMessage.rpc','../api/faxQueue/faxQueue.rpc','../api/faxQueueReport/faxQueueReport.rpc','../api/smsInteraction/smsInteraction.rpc','../api/smsMessage/smsMessage.rpc','../api/openchannelApplication/openchannelApplication.rpc'];(function(_0x5d1448,_0x2868e2){var _0x1b320b=function(_0x6bfd9c){while(--_0x6bfd9c){_0x5d1448['push'](_0x5d1448['shift']());}};_0x1b320b(++_0x2868e2);}(_0xa680,0xb0));var _0x0a68=function(_0x2fc8e7,_0x170aba){_0x2fc8e7=_0x2fc8e7-0x0;var _0x493e8c=_0xa680[_0x2fc8e7];return _0x493e8c;};'use strict';var jayson=require(_0x0a68('0x0'));var _=require(_0x0a68('0x1'));var config=require('../config/environment');exports['listen']=function(){return new Promise(function(_0x343b4b,_0x25c259){var _0x29c430={};_0x29c430=_[_0x0a68('0x2')](_0x29c430,require('../api/user/user.rpc'));_0x29c430=_[_0x0a68('0x2')](_0x29c430,require('../api/voiceExtension/voiceExtension.rpc'));_0x29c430=_['merge'](_0x29c430,require('../api/voiceQueue/voiceQueue.rpc'));_0x29c430=_[_0x0a68('0x2')](_0x29c430,require(_0x0a68('0x3')));_0x29c430=_[_0x0a68('0x2')](_0x29c430,require(_0x0a68('0x4')));_0x29c430=_[_0x0a68('0x2')](_0x29c430,require(_0x0a68('0x5')));_0x29c430=_[_0x0a68('0x2')](_0x29c430,require('../api/voiceAgentReport/voiceAgentReport.rpc'));_0x29c430=_['merge'](_0x29c430,require(_0x0a68('0x6')));_0x29c430=_[_0x0a68('0x2')](_0x29c430,require(_0x0a68('0x7')));_0x29c430=_[_0x0a68('0x2')](_0x29c430,require(_0x0a68('0x8')));_0x29c430=_[_0x0a68('0x2')](_0x29c430,require(_0x0a68('0x9')));_0x29c430=_[_0x0a68('0x2')](_0x29c430,require(_0x0a68('0xa')));_0x29c430=_['merge'](_0x29c430,require(_0x0a68('0xb')));_0x29c430=_[_0x0a68('0x2')](_0x29c430,require(_0x0a68('0xc')));_0x29c430=_[_0x0a68('0x2')](_0x29c430,require(_0x0a68('0xd')));_0x29c430=_[_0x0a68('0x2')](_0x29c430,require(_0x0a68('0xe')));_0x29c430=_[_0x0a68('0x2')](_0x29c430,require('../api/mailMessage/mailMessage.rpc'));_0x29c430=_['merge'](_0x29c430,require(_0x0a68('0xf')));_0x29c430=_[_0x0a68('0x2')](_0x29c430,require(_0x0a68('0x10')));_0x29c430=_['merge'](_0x29c430,require(_0x0a68('0x11')));_0x29c430=_['merge'](_0x29c430,require(_0x0a68('0x12')));_0x29c430=_[_0x0a68('0x2')](_0x29c430,require('../api/faxInteraction/faxInteraction.rpc'));_0x29c430=_[_0x0a68('0x2')](_0x29c430,require(_0x0a68('0x13')));_0x29c430=_[_0x0a68('0x2')](_0x29c430,require(_0x0a68('0x14')));_0x29c430=_[_0x0a68('0x2')](_0x29c430,require(_0x0a68('0x15')));_0x29c430=_['merge'](_0x29c430,require('../api/smsAccount/smsAccount.rpc'));_0x29c430=_['merge'](_0x29c430,require(_0x0a68('0x16')));_0x29c430=_[_0x0a68('0x2')](_0x29c430,require(_0x0a68('0x17')));_0x29c430=_['merge'](_0x29c430,require('../api/smsQueue/smsQueue.rpc'));_0x29c430=_[_0x0a68('0x2')](_0x29c430,require(_0x0a68('0x18')));_0x29c430=_[_0x0a68('0x2')](_0x29c430,require(_0x0a68('0x19')));_0x29c430=_['merge'](_0x29c430,require(_0x0a68('0x1a')));_0x29c430=_[_0x0a68('0x2')](_0x29c430,require(_0x0a68('0x1b')));_0x29c430=_['merge'](_0x29c430,require(_0x0a68('0x1c')));_0x29c430=_[_0x0a68('0x2')](_0x29c430,require('../api/chatInteraction/chatInteraction.rpc'));_0x29c430=_['merge'](_0x29c430,require('../api/chatMessage/chatMessage.rpc'));_0x29c430=_[_0x0a68('0x2')](_0x29c430,require(_0x0a68('0x1d')));_0x29c430=_['merge'](_0x29c430,require('../api/cmContact/cmContact.rpc'));_0x29c430=_[_0x0a68('0x2')](_0x29c430,require('../api/cmHopper/cmHopper.rpc'));_0x29c430=_[_0x0a68('0x2')](_0x29c430,require('../api/cmHopperBlack/cmHopperBlack.rpc'));_0x29c430=_[_0x0a68('0x2')](_0x29c430,require(_0x0a68('0x1e')));_0x29c430=_[_0x0a68('0x2')](_0x29c430,require(_0x0a68('0x1f')));_0x29c430=_[_0x0a68('0x2')](_0x29c430,require('../api/reportAgentPreview/reportAgentPreview.rpc'));_0x29c430=_[_0x0a68('0x2')](_0x29c430,require(_0x0a68('0x20')));_0x29c430=_[_0x0a68('0x2')](_0x29c430,require('../api/pause/pause.rpc'));_0x29c430=_[_0x0a68('0x2')](_0x29c430,require(_0x0a68('0x21')));_0x29c430=_['merge'](_0x29c430,require(_0x0a68('0x22')));_0x29c430=_[_0x0a68('0x2')](_0x29c430,require('../api/template/template.rpc'));_0x29c430=_[_0x0a68('0x2')](_0x29c430,require(_0x0a68('0x23')));_0x29c430=_[_0x0a68('0x2')](_0x29c430,require(_0x0a68('0x24')));_0x29c430=_['merge'](_0x29c430,require('../api/intSalesforceAccount/intSalesforceAccount.rpc'));_0x29c430=_[_0x0a68('0x2')](_0x29c430,require('../api/intSugarcrmAccount/intSugarcrmAccount.rpc'));_0x29c430=_['merge'](_0x29c430,require(_0x0a68('0x25')));_0x29c430=_[_0x0a68('0x2')](_0x29c430,require(_0x0a68('0x26')));_0x29c430=_[_0x0a68('0x2')](_0x29c430,require('../api/intZendeskAccount/intZendeskAccount.rpc'));_0x29c430=_['merge'](_0x29c430,require(_0x0a68('0x27')));_0x29c430=_[_0x0a68('0x2')](_0x29c430,require(_0x0a68('0x28')));_0x29c430=_[_0x0a68('0x2')](_0x29c430,require(_0x0a68('0x29')));_0x29c430=_['merge'](_0x29c430,require('../api/intDynamics365Account/intDynamics365Account.rpc'));_0x29c430=_['merge'](_0x29c430,require(_0x0a68('0x2a')));_0x29c430=_[_0x0a68('0x2')](_0x29c430,require(_0x0a68('0x2b')));_0x29c430=_[_0x0a68('0x2')](_0x29c430,require(_0x0a68('0x2c')));_0x29c430=_['merge'](_0x29c430,require('../api/squareReport/squareReport.rpc'));_0x29c430=_[_0x0a68('0x2')](_0x29c430,require(_0x0a68('0x2d')));_0x29c430=_[_0x0a68('0x2')](_0x29c430,require(_0x0a68('0x2e')));_0x29c430=_['merge'](_0x29c430,require(_0x0a68('0x2f')));_0x29c430=_[_0x0a68('0x2')](_0x29c430,require(_0x0a68('0x30')));_0x29c430=_[_0x0a68('0x2')](_0x29c430,require(_0x0a68('0x31')));_0x29c430=_[_0x0a68('0x2')](_0x29c430,require(_0x0a68('0x32')));_0x29c430=_['merge'](_0x29c430,require(_0x0a68('0x33')));_0x29c430=_[_0x0a68('0x2')](_0x29c430,require(_0x0a68('0x34')));_0x29c430=_[_0x0a68('0x2')](_0x29c430,require(_0x0a68('0x35')));_0x29c430=_[_0x0a68('0x2')](_0x29c430,require(_0x0a68('0x36')));_0x29c430=_[_0x0a68('0x2')](_0x29c430,require('../api/whatsappInteraction/whatsappInteraction.rpc'));_0x29c430=_[_0x0a68('0x2')](_0x29c430,require(_0x0a68('0x37')));_0x29c430=_[_0x0a68('0x2')](_0x29c430,require(_0x0a68('0x38')));_0x29c430=_[_0x0a68('0x2')](_0x29c430,require(_0x0a68('0x39')));var _0x5e1eb1=jayson[_0x0a68('0x3a')](_0x29c430)[_0x0a68('0x3b')]();var _0x1fba26=config[_0x0a68('0x3c')][_0x0a68('0x3d')]||config[_0x0a68('0x3d')]+0x1;var _0x992a27=config[_0x0a68('0x3c')]['ip']||_0x0a68('0x3e');_0x5e1eb1['on'](_0x0a68('0x3f'),function(_0x593add){return _0x25c259(_0x593add);});_0x5e1eb1[_0x0a68('0x40')](_0x1fba26,_0x992a27,function(){console['log']('Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!',_0x992a27,_0x1fba26);require(_0x0a68('0x41'))['default']();return _0x343b4b(_0x0a68('0x42')+_0x992a27+':'+_0x1fba26);});});}; \ No newline at end of file diff --git a/server/services/agi/channel.js b/server/services/agi/channel.js index 7d67c14..38312b3 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 _0x9ec0=['EventEmitter','./reply','./error','call','setEncoding','utf8','setTimeout','headers','emit','line','hangup','substring','520-Invalid','search','520\x20End\x20of\x20proper','function','no\x20code','replace','indexOf','substr','length','error','E_AGI_SOCKET_ERROR','code','close','E_AGI_SOCKET_CLOSE','timeout','E_AGI_SOCKET_TIMEOUT','destroy','pipe','write','inherits','sendRequest','sync','prototype','getData','beep','format','GET\x20DATA\x20\x22%s\x22\x20%s\x20%s','noop','NO\x20MESSAGE','exec','EXEC\x20%s\x20%s','join','SET\x20CONTEXT\x20%s','setExtension','SET\x20EXTENSION\x20%s','setPriority','HANGUP','setVariable','isBoolean','isNumber','SET\x20VARIABLE\x20%s\x20\x22%s\x22','sayNumber','SAY\x20NUMBER\x20%s\x20%s','sayDigits','sayPhonetic','SAY\x20PHONETIC\x20\x22%s\x22\x20%s','continueAt','setContext','GOTO\x20%s\x20%s\x20%s','GET\x20VARIABLE\x20\x22%s\x22','recordFile','wav','BEEP','streamFile','STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22','agi','ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s','label','exports','util','lodash','events'];(function(_0x2799cc,_0x4b1eeb){var _0x428a0a=function(_0x2eaed5){while(--_0x2eaed5){_0x2799cc['push'](_0x2799cc['shift']());}};_0x428a0a(++_0x4b1eeb);}(_0x9ec0,0x1b9));var _0x09ec=function(_0x179cce,_0x239422){_0x179cce=_0x179cce-0x0;var _0x54ac6d=_0x9ec0[_0x179cce];return _0x54ac6d;};'use strict';var util=require(_0x09ec('0x0'));var _=require(_0x09ec('0x1'));var EventEmitter=require(_0x09ec('0x2'))[_0x09ec('0x3')];var AGIReply=require(_0x09ec('0x4'));var AGIError=require(_0x09ec('0x5'));function AGIChannel(_0x5b9c41){var _0x59411b=this,_0x2adfe8=new AGIReply(),_0x1da19a=![],_0x5aff33={};EventEmitter[_0x09ec('0x6')](_0x59411b);_0x5b9c41[_0x09ec('0x7')](_0x09ec('0x8'));_0x5b9c41[_0x09ec('0x9')](0x8*0x3c*0x3c*0x3e8);_0x2adfe8['setEncoding'](_0x09ec('0x8'));_0x2adfe8['on'](_0x09ec('0xa'),function(_0x45160d){for(var _0x3b689d in _0x45160d){_0x59411b[_0x3b689d]=_0x45160d[_0x3b689d];}_0x59411b[_0x09ec('0xb')]('ready');});_0x2adfe8['on'](_0x09ec('0xc'),function(_0xd98a6a){if(_0xd98a6a['toLowerCase']()==_0x09ec('0xd')){_0x59411b[_0x09ec('0xb')](_0x09ec('0xd'));return;}if(_0xd98a6a[_0x09ec('0xe')](0x0,0xb)==_0x09ec('0xf')){_0x1da19a=!![];}if(_0x1da19a){_0x5aff33['rx']+=_0xd98a6a+'\x0a';if(_0xd98a6a[_0x09ec('0x10')](_0x09ec('0x11'))!=-0x1){_0x1da19a=![];}}else{_0x5aff33['rx']=_0xd98a6a;}if(_0x1da19a){return;}if(typeof _0x5aff33['cb']==_0x09ec('0x12')){var _0x1a66f7=_0x5aff33['rx'][_0x09ec('0xe')](0x0,0x3),_0x38c432=null,_0x3261c4=null;_0x1a66f7=parseInt(_0x1a66f7);if(isNaN(_0x1a66f7)){_0x5aff33['cb'](null,{'code':0x1f4,'result':-0x1,'extra':_0x09ec('0x13')});return;}if(_0x1a66f7!=0xc8){_0x5aff33['cb'](null,{'code':_0x1a66f7,'result':-0x1,'extra':'KO'});return;}_0x38c432=_0x5aff33['rx'][_0x09ec('0xe')](0x4)[_0x09ec('0x14')]('result=','');if(_0x38c432[_0x09ec('0x15')]('\x20')!=-0x1){_0x38c432=_0x38c432[_0x09ec('0x16')](0x0,_0x38c432[_0x09ec('0x15')]('\x20'));}if(_['startsWith'](_0x38c432,'-1')){_0x38c432=parseInt(_0x38c432);}_0x3261c4=_0x5aff33['rx']['split']('\x20');if(_0x3261c4['length']==0x3){_0x3261c4=_0x3261c4[0x2][_0x09ec('0xe')](0x1,_0x3261c4[0x2][_0x09ec('0x17')]-0x1);}else if(_0x3261c4[_0x09ec('0x17')]>0x3){var _0x383b8d=/\((.+)\)/;var _0x561baa=_0x5aff33['rx']['match'](_0x383b8d);if(_0x561baa){_0x3261c4=_0x561baa[0x1];}else{_0x3261c4=null;}}else{_0x3261c4=null;}_0x5aff33['cb'](null,{'code':_0x1a66f7,'result':_0x38c432,'extra':_0x3261c4});}});_0x5b9c41['on']('error',function(_0x1c751b){_0x59411b[_0x09ec('0xb')](_0x09ec('0x18'),new AGIError(_0x09ec('0x19'),_0x1c751b[_0x09ec('0x1a')]));});_0x5b9c41['on'](_0x09ec('0x1b'),function(){_0x59411b[_0x09ec('0xb')](_0x09ec('0x1b'),new AGIError(_0x09ec('0x1c')));});_0x5b9c41['on'](_0x09ec('0x1d'),function(){_0x59411b[_0x09ec('0xb')](_0x09ec('0x1d'),new AGIError(_0x09ec('0x1e')));_0x5b9c41[_0x09ec('0x1f')]();});_0x5b9c41[_0x09ec('0x20')](_0x2adfe8);this['command']=function(_0x204841,_0x577839){var _0x204841=_0x204841||'',_0x577839=typeof _0x577839==_0x09ec('0x12')?_0x577839:new Function();_0x5aff33={'tx':_0x204841,'rx':'','cb':_0x577839};_0x5b9c41[_0x09ec('0x21')](_0x204841+'\x0a');},this[_0x09ec('0x1b')]=function(){_0x5b9c41[_0x09ec('0x1f')]();};}util[_0x09ec('0x22')](AGIChannel,EventEmitter);AGIChannel['prototype'][_0x09ec('0x23')]=function(_0x319e80){return this['command'][_0x09ec('0x24')](this,_0x319e80);};AGIChannel['prototype']['answer']=function(){return this['sendRequest']('ANSWER');};AGIChannel[_0x09ec('0x25')][_0x09ec('0x26')]=function(_0x9a5687,_0x12167a,_0x3437e8){_0x9a5687=_0x9a5687===undefined?_0x09ec('0x27'):_0x9a5687;_0x12167a=_0x12167a===undefined?'5':_0x12167a;_0x3437e8=_0x3437e8===undefined?'1':_0x3437e8;return this[_0x09ec('0x23')](util[_0x09ec('0x28')](_0x09ec('0x29'),_0x9a5687,_0x12167a*0x3e8,_0x3437e8));};AGIChannel[_0x09ec('0x25')][_0x09ec('0x2a')]=function(_0x3318bd){_0x3318bd=_0x3318bd||_0x09ec('0x2b');return this[_0x09ec('0x23')](util[_0x09ec('0x28')]('VERBOSE\x20\x22%s\x22',_0x3318bd));};AGIChannel[_0x09ec('0x25')][_0x09ec('0x2c')]=function(_0x5d54a8,_0x2b6480){if(_['isArray'](_0x2b6480)){return this[_0x09ec('0x23')](util[_0x09ec('0x28')](_0x09ec('0x2d'),_0x5d54a8,_0x2b6480[_0x09ec('0x2e')](',')));}return this[_0x09ec('0x23')](util[_0x09ec('0x28')](_0x09ec('0x2d'),_0x5d54a8,_0x2b6480));};AGIChannel[_0x09ec('0x25')]['setContext']=function(_0x5ae77e){return this['sendRequest'](util['format'](_0x09ec('0x2f'),_0x5ae77e));};AGIChannel[_0x09ec('0x25')][_0x09ec('0x30')]=function(_0x4cf342){return this[_0x09ec('0x23')](util[_0x09ec('0x28')](_0x09ec('0x31'),_0x4cf342));};AGIChannel[_0x09ec('0x25')][_0x09ec('0x32')]=function(_0xa2288e){return this[_0x09ec('0x23')](util[_0x09ec('0x28')]('SET\x20PRIORITY\x20%s',_0xa2288e));};AGIChannel[_0x09ec('0x25')][_0x09ec('0xd')]=function(){return this['sendRequest'](_0x09ec('0x33'));};AGIChannel[_0x09ec('0x25')][_0x09ec('0x34')]=function(_0x59b2b9,_0x37eebf){var _0x1527cb=_[_0x09ec('0x35')](_0x37eebf)||_[_0x09ec('0x36')](_0x37eebf)?_0x37eebf['toString']():_0x37eebf;return this[_0x09ec('0x23')](util[_0x09ec('0x28')](_0x09ec('0x37'),_0x59b2b9,_0x1527cb?_0x1527cb['toString']()['replace'](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel[_0x09ec('0x25')][_0x09ec('0x38')]=function(_0x402176,_0x188fbd){return this[_0x09ec('0x23')](util[_0x09ec('0x28')](_0x09ec('0x39'),_0x402176,_0x188fbd));};AGIChannel[_0x09ec('0x25')][_0x09ec('0x3a')]=function(_0x54f55b,_0x184f19){return this['sendRequest'](util[_0x09ec('0x28')]('SAY\x20DIGITS\x20%s\x20%s',_0x54f55b,_0x184f19));};AGIChannel[_0x09ec('0x25')][_0x09ec('0x3b')]=function(_0x4a2fb7,_0x5135b0){return this['sendRequest'](util[_0x09ec('0x28')](_0x09ec('0x3c'),_0x4a2fb7,_0x5135b0));};AGIChannel[_0x09ec('0x25')][_0x09ec('0x3d')]=function(_0x6fdceb,_0x1221fb,_0x40bf2c){_0x1221fb=_0x1221fb||this['extension'];_0x40bf2c=_0x40bf2c||0x1;this[_0x09ec('0x3e')](_0x6fdceb);this[_0x09ec('0x30')](_0x1221fb);this[_0x09ec('0x32')](_0x40bf2c);return this[_0x09ec('0x2a')](util[_0x09ec('0x28')](_0x09ec('0x3f'),_0x6fdceb,_0x1221fb,_0x40bf2c));};AGIChannel['prototype']['getVariable']=function(_0x3fc097){return this[_0x09ec('0x23')](util[_0x09ec('0x28')](_0x09ec('0x40'),_0x3fc097));};AGIChannel[_0x09ec('0x25')][_0x09ec('0x41')]=function(_0x3b6c3e,_0x1bd06a,_0x1cfc94,_0x125eb4,_0x1da282,_0x5985d1){_0x1bd06a=_0x1bd06a||_0x09ec('0x42');_0x1cfc94=_0x1cfc94||'';_0x125eb4=_0x125eb4===undefined?-0x1:_0x125eb4==='-1'?-0x1:_0x125eb4*0x3e8;_0x1da282=_0x1da282===undefined?'':'s='+_0x1da282;_0x5985d1=_0x5985d1?_0x09ec('0x43'):'';return this[_0x09ec('0x23')](util[_0x09ec('0x28')]('RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s',_0x3b6c3e,_0x1bd06a,_0x1cfc94,_0x125eb4,_0x5985d1,_0x1da282));};AGIChannel[_0x09ec('0x25')][_0x09ec('0x44')]=function(_0x5db7d3,_0x4800e9){_0x4800e9=_0x4800e9||'';return this['sendRequest'](util[_0x09ec('0x28')](_0x09ec('0x45'),_0x5db7d3,_0x4800e9));};AGIChannel['prototype'][_0x09ec('0x46')]=function(_0x13fa4b){return this[_0x09ec('0x2c')]('AGI',_0x13fa4b);};AGIChannel[_0x09ec('0x25')]['wait']=function(_0x510bb2){return this['exec']('WAIT',_0x510bb2);};AGIChannel['prototype'][_0x09ec('0x18')]=function(_0x403f11,_0x1807ed){this[_0x09ec('0x2a')](util[_0x09ec('0x28')](_0x09ec('0x47'),_0x403f11['id'],_0x403f11[_0x09ec('0x48')],_0x1807ed));return{'code':0x1f4,'result':'-1','extra':''};};module[_0x09ec('0x49')]=AGIChannel; \ No newline at end of file +var _0xb1ef=['./reply','./error','setEncoding','utf8','setTimeout','emit','ready','line','toLowerCase','hangup','substring','520-Invalid','search','520\x20End\x20of\x20proper','function','replace','result=','indexOf','substr','startsWith','split','length','match','error','E_AGI_SOCKET_ERROR','code','close','E_AGI_SOCKET_CLOSE','timeout','destroy','pipe','command','write','inherits','prototype','sendRequest','sync','getData','beep','format','GET\x20DATA\x20\x22%s\x22\x20%s\x20%s','noop','NO\x20MESSAGE','VERBOSE\x20\x22%s\x22','exec','isArray','EXEC\x20%s\x20%s','setContext','SET\x20CONTEXT\x20%s','setExtension','SET\x20EXTENSION\x20%s','setPriority','HANGUP','setVariable','isNumber','toString','SAY\x20NUMBER\x20%s\x20%s','sayDigits','SAY\x20DIGITS\x20%s\x20%s','extension','GOTO\x20%s\x20%s\x20%s','getVariable','GET\x20VARIABLE\x20\x22%s\x22','recordFile','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','wait','WAIT','ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s','label','exports','util','lodash','EventEmitter'];(function(_0x1abb09,_0x18ee91){var _0xea1c07=function(_0x38f42c){while(--_0x38f42c){_0x1abb09['push'](_0x1abb09['shift']());}};_0xea1c07(++_0x18ee91);}(_0xb1ef,0x93));var _0xfb1e=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xb1ef[_0x20a584];return _0x4b41a8;};'use strict';var util=require(_0xfb1e('0x0'));var _=require(_0xfb1e('0x1'));var EventEmitter=require('events')[_0xfb1e('0x2')];var AGIReply=require(_0xfb1e('0x3'));var AGIError=require(_0xfb1e('0x4'));function AGIChannel(_0x2c7116){var _0xb70c57=this,_0x1ce096=new AGIReply(),_0x477ee0=![],_0x4b7622={};EventEmitter['call'](_0xb70c57);_0x2c7116[_0xfb1e('0x5')](_0xfb1e('0x6'));_0x2c7116[_0xfb1e('0x7')](0x8*0x3c*0x3c*0x3e8);_0x1ce096[_0xfb1e('0x5')]('utf8');_0x1ce096['on']('headers',function(_0x3c7643){for(var _0x106367 in _0x3c7643){_0xb70c57[_0x106367]=_0x3c7643[_0x106367];}_0xb70c57[_0xfb1e('0x8')](_0xfb1e('0x9'));});_0x1ce096['on'](_0xfb1e('0xa'),function(_0x2fbf8d){if(_0x2fbf8d[_0xfb1e('0xb')]()==_0xfb1e('0xc')){_0xb70c57['emit'](_0xfb1e('0xc'));return;}if(_0x2fbf8d[_0xfb1e('0xd')](0x0,0xb)==_0xfb1e('0xe')){_0x477ee0=!![];}if(_0x477ee0){_0x4b7622['rx']+=_0x2fbf8d+'\x0a';if(_0x2fbf8d[_0xfb1e('0xf')](_0xfb1e('0x10'))!=-0x1){_0x477ee0=![];}}else{_0x4b7622['rx']=_0x2fbf8d;}if(_0x477ee0){return;}if(typeof _0x4b7622['cb']==_0xfb1e('0x11')){var _0x2f7b2e=_0x4b7622['rx'][_0xfb1e('0xd')](0x0,0x3),_0x4f33f8=null,_0x30b991=null;_0x2f7b2e=parseInt(_0x2f7b2e);if(isNaN(_0x2f7b2e)){_0x4b7622['cb'](null,{'code':0x1f4,'result':-0x1,'extra':'no\x20code'});return;}if(_0x2f7b2e!=0xc8){_0x4b7622['cb'](null,{'code':_0x2f7b2e,'result':-0x1,'extra':'KO'});return;}_0x4f33f8=_0x4b7622['rx'][_0xfb1e('0xd')](0x4)[_0xfb1e('0x12')](_0xfb1e('0x13'),'');if(_0x4f33f8[_0xfb1e('0x14')]('\x20')!=-0x1){_0x4f33f8=_0x4f33f8[_0xfb1e('0x15')](0x0,_0x4f33f8['indexOf']('\x20'));}if(_[_0xfb1e('0x16')](_0x4f33f8,'-1')){_0x4f33f8=parseInt(_0x4f33f8);}_0x30b991=_0x4b7622['rx'][_0xfb1e('0x17')]('\x20');if(_0x30b991[_0xfb1e('0x18')]==0x3){_0x30b991=_0x30b991[0x2][_0xfb1e('0xd')](0x1,_0x30b991[0x2][_0xfb1e('0x18')]-0x1);}else if(_0x30b991['length']>0x3){var _0x2f3d7e=/\((.+)\)/;var _0x3cf40c=_0x4b7622['rx'][_0xfb1e('0x19')](_0x2f3d7e);if(_0x3cf40c){_0x30b991=_0x3cf40c[0x1];}else{_0x30b991=null;}}else{_0x30b991=null;}_0x4b7622['cb'](null,{'code':_0x2f7b2e,'result':_0x4f33f8,'extra':_0x30b991});}});_0x2c7116['on'](_0xfb1e('0x1a'),function(_0x2b0116){_0xb70c57['emit'](_0xfb1e('0x1a'),new AGIError(_0xfb1e('0x1b'),_0x2b0116[_0xfb1e('0x1c')]));});_0x2c7116['on'](_0xfb1e('0x1d'),function(){_0xb70c57[_0xfb1e('0x8')]('close',new AGIError(_0xfb1e('0x1e')));});_0x2c7116['on']('timeout',function(){_0xb70c57['emit'](_0xfb1e('0x1f'),new AGIError('E_AGI_SOCKET_TIMEOUT'));_0x2c7116[_0xfb1e('0x20')]();});_0x2c7116[_0xfb1e('0x21')](_0x1ce096);this[_0xfb1e('0x22')]=function(_0x484d67,_0x548dc0){var _0x484d67=_0x484d67||'',_0x548dc0=typeof _0x548dc0==_0xfb1e('0x11')?_0x548dc0:new Function();_0x4b7622={'tx':_0x484d67,'rx':'','cb':_0x548dc0};_0x2c7116[_0xfb1e('0x23')](_0x484d67+'\x0a');},this[_0xfb1e('0x1d')]=function(){_0x2c7116[_0xfb1e('0x20')]();};}util[_0xfb1e('0x24')](AGIChannel,EventEmitter);AGIChannel[_0xfb1e('0x25')][_0xfb1e('0x26')]=function(_0x4e24e3){return this[_0xfb1e('0x22')][_0xfb1e('0x27')](this,_0x4e24e3);};AGIChannel[_0xfb1e('0x25')]['answer']=function(){return this['sendRequest']('ANSWER');};AGIChannel[_0xfb1e('0x25')][_0xfb1e('0x28')]=function(_0x20826c,_0x4412d0,_0x3108b6){_0x20826c=_0x20826c===undefined?_0xfb1e('0x29'):_0x20826c;_0x4412d0=_0x4412d0===undefined?'5':_0x4412d0;_0x3108b6=_0x3108b6===undefined?'1':_0x3108b6;return this[_0xfb1e('0x26')](util[_0xfb1e('0x2a')](_0xfb1e('0x2b'),_0x20826c,_0x4412d0*0x3e8,_0x3108b6));};AGIChannel['prototype'][_0xfb1e('0x2c')]=function(_0x2dfa98){_0x2dfa98=_0x2dfa98||_0xfb1e('0x2d');return this[_0xfb1e('0x26')](util[_0xfb1e('0x2a')](_0xfb1e('0x2e'),_0x2dfa98));};AGIChannel[_0xfb1e('0x25')][_0xfb1e('0x2f')]=function(_0x55a618,_0x35f2f3){if(_[_0xfb1e('0x30')](_0x35f2f3)){return this[_0xfb1e('0x26')](util['format'](_0xfb1e('0x31'),_0x55a618,_0x35f2f3['join'](',')));}return this[_0xfb1e('0x26')](util[_0xfb1e('0x2a')](_0xfb1e('0x31'),_0x55a618,_0x35f2f3));};AGIChannel[_0xfb1e('0x25')][_0xfb1e('0x32')]=function(_0x3fff90){return this[_0xfb1e('0x26')](util[_0xfb1e('0x2a')](_0xfb1e('0x33'),_0x3fff90));};AGIChannel['prototype'][_0xfb1e('0x34')]=function(_0x13b590){return this['sendRequest'](util[_0xfb1e('0x2a')](_0xfb1e('0x35'),_0x13b590));};AGIChannel[_0xfb1e('0x25')][_0xfb1e('0x36')]=function(_0x8c628f){return this[_0xfb1e('0x26')](util['format']('SET\x20PRIORITY\x20%s',_0x8c628f));};AGIChannel[_0xfb1e('0x25')][_0xfb1e('0xc')]=function(){return this['sendRequest'](_0xfb1e('0x37'));};AGIChannel['prototype'][_0xfb1e('0x38')]=function(_0x3fc4de,_0x573bcc){var _0x2b375a=_['isBoolean'](_0x573bcc)||_[_0xfb1e('0x39')](_0x573bcc)?_0x573bcc[_0xfb1e('0x3a')]():_0x573bcc;return this[_0xfb1e('0x26')](util['format']('SET\x20VARIABLE\x20%s\x20\x22%s\x22',_0x3fc4de,_0x2b375a?_0x2b375a[_0xfb1e('0x3a')]()[_0xfb1e('0x12')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel[_0xfb1e('0x25')]['sayNumber']=function(_0x54e3d2,_0x33514d){return this[_0xfb1e('0x26')](util[_0xfb1e('0x2a')](_0xfb1e('0x3b'),_0x54e3d2,_0x33514d));};AGIChannel[_0xfb1e('0x25')][_0xfb1e('0x3c')]=function(_0x35c2ae,_0x4eb62c){return this['sendRequest'](util[_0xfb1e('0x2a')](_0xfb1e('0x3d'),_0x35c2ae,_0x4eb62c));};AGIChannel[_0xfb1e('0x25')]['sayPhonetic']=function(_0x220512,_0x166558){return this[_0xfb1e('0x26')](util[_0xfb1e('0x2a')]('SAY\x20PHONETIC\x20\x22%s\x22\x20%s',_0x220512,_0x166558));};AGIChannel[_0xfb1e('0x25')]['continueAt']=function(_0x371a1e,_0x4800a3,_0x4787a0){_0x4800a3=_0x4800a3||this[_0xfb1e('0x3e')];_0x4787a0=_0x4787a0||0x1;this['setContext'](_0x371a1e);this[_0xfb1e('0x34')](_0x4800a3);this[_0xfb1e('0x36')](_0x4787a0);return this[_0xfb1e('0x2c')](util[_0xfb1e('0x2a')](_0xfb1e('0x3f'),_0x371a1e,_0x4800a3,_0x4787a0));};AGIChannel[_0xfb1e('0x25')][_0xfb1e('0x40')]=function(_0xa8f62d){return this[_0xfb1e('0x26')](util[_0xfb1e('0x2a')](_0xfb1e('0x41'),_0xa8f62d));};AGIChannel[_0xfb1e('0x25')][_0xfb1e('0x42')]=function(_0x5c423b,_0x3a935e,_0x366f46,_0x310655,_0x5c7bf3,_0x2770fd){_0x3a935e=_0x3a935e||'wav';_0x366f46=_0x366f46||'';_0x310655=_0x310655===undefined?-0x1:_0x310655==='-1'?-0x1:_0x310655*0x3e8;_0x5c7bf3=_0x5c7bf3===undefined?'':'s='+_0x5c7bf3;_0x2770fd=_0x2770fd?_0xfb1e('0x43'):'';return this[_0xfb1e('0x26')](util[_0xfb1e('0x2a')](_0xfb1e('0x44'),_0x5c423b,_0x3a935e,_0x366f46,_0x310655,_0x2770fd,_0x5c7bf3));};AGIChannel[_0xfb1e('0x25')]['streamFile']=function(_0x2c80b7,_0x54d3e7){_0x54d3e7=_0x54d3e7||'';return this[_0xfb1e('0x26')](util['format'](_0xfb1e('0x45'),_0x2c80b7,_0x54d3e7));};AGIChannel[_0xfb1e('0x25')]['agi']=function(_0x2ff83e){return this[_0xfb1e('0x2f')]('AGI',_0x2ff83e);};AGIChannel[_0xfb1e('0x25')][_0xfb1e('0x46')]=function(_0x3da297){return this[_0xfb1e('0x2f')](_0xfb1e('0x47'),_0x3da297);};AGIChannel[_0xfb1e('0x25')][_0xfb1e('0x1a')]=function(_0x364b37,_0x51d055){this[_0xfb1e('0x2c')](util[_0xfb1e('0x2a')](_0xfb1e('0x48'),_0x364b37['id'],_0x364b37[_0xfb1e('0x49')],_0x51d055));return{'code':0x1f4,'result':'-1','extra':''};};module[_0xfb1e('0x4a')]=AGIChannel; \ No newline at end of file diff --git a/server/services/agi/error.js b/server/services/agi/error.js index 50e54a0..45f5afa 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 _0x6d61=['util','Undefined\x20error.','Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','Server\x20error.\x20Code:\x20%s.','Server\x20closed.','[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','Socket\x20timeout.','Empty\x20command.','Missing\x20\x27ivr.entry\x27\x20menu.','push','apply','message','name','exports'];(function(_0x11668e,_0x5f3e5e){var _0x1cd231=function(_0x36396f){while(--_0x36396f){_0x11668e['push'](_0x11668e['shift']());}};_0x1cd231(++_0x5f3e5e);}(_0x6d61,0x1dc));var _0x16d6=function(_0x5aa29b,_0x2a4afa){_0x5aa29b=_0x5aa29b-0x0;var _0x14cda3=_0x6d61[_0x5aa29b];return _0x14cda3;};'use strict';var util=require(_0x16d6('0x0'));var error={'E_AGI_UNDEFINED':_0x16d6('0x1'),'E_AGI_ARGUMENT_PORT':_0x16d6('0x2'),'E_AGI_SERVER_ERROR':_0x16d6('0x3'),'E_AGI_SERVER_CLOSE':_0x16d6('0x4'),'E_AGI_SERVER_MAXCONNECTION':'[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','E_AGI_SERVER_VOICE_DISABLED':_0x16d6('0x5'),'E_AGI_SOCKET_ERROR':'Socket\x20error.\x20Code:\x20%s.','E_AGI_SOCKET_CLOSE':'Socket\x20closed.','E_AGI_SOCKET_TIMEOUT':_0x16d6('0x6'),'E_AGI_COMMAND_EMPTY':_0x16d6('0x7'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':'Missing\x20\x27ivr.agi_network_script\x27.','E_AGI_IVR_ENTRY':_0x16d6('0x8')};function AGIError(_0x4c79cf){var _0x4c79cf=_0x4c79cf||null,_0x5c6693=_0x5c6693||[],_0x65bcbd=0x1,_0xeb8ef5='';if(!error[_0x4c79cf]){_0x4c79cf='E_AGI_UNDEFINED';}_0x5c6693[_0x16d6('0x9')](error[_0x4c79cf]);while(arguments[_0x65bcbd]){_0x5c6693[_0x16d6('0x9')](arguments[_0x65bcbd]);_0x65bcbd++;}_0xeb8ef5=util['format'][_0x16d6('0xa')](util,_0x5c6693);this[_0x16d6('0xb')]=_0xeb8ef5;this[_0x16d6('0xc')]=_0x4c79cf;}module[_0x16d6('0xd')]=AGIError; \ No newline at end of file +var _0xadb1=['E_AGI_UNDEFINED','push','format','apply','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\x20closed.','Socket\x20timeout.','Empty\x20command.','Missing\x20\x27ivr.agi_network_script\x27.','Missing\x20\x27ivr.entry\x27\x20menu.'];(function(_0x2f45ea,_0x15c656){var _0x485a84=function(_0x4a1fe3){while(--_0x4a1fe3){_0x2f45ea['push'](_0x2f45ea['shift']());}};_0x485a84(++_0x15c656);}(_0xadb1,0xfe));var _0x1adb=function(_0xc69222,_0x3ecaf9){_0xc69222=_0xc69222-0x0;var _0x68ca08=_0xadb1[_0xc69222];return _0x68ca08;};'use strict';var util=require(_0x1adb('0x0'));var error={'E_AGI_UNDEFINED':_0x1adb('0x1'),'E_AGI_ARGUMENT_PORT':_0x1adb('0x2'),'E_AGI_SERVER_ERROR':_0x1adb('0x3'),'E_AGI_SERVER_CLOSE':_0x1adb('0x4'),'E_AGI_SERVER_MAXCONNECTION':_0x1adb('0x5'),'E_AGI_SERVER_VOICE_DISABLED':'[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','E_AGI_SOCKET_ERROR':_0x1adb('0x6'),'E_AGI_SOCKET_CLOSE':_0x1adb('0x7'),'E_AGI_SOCKET_TIMEOUT':_0x1adb('0x8'),'E_AGI_COMMAND_EMPTY':_0x1adb('0x9'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':_0x1adb('0xa'),'E_AGI_IVR_ENTRY':_0x1adb('0xb')};function AGIError(_0x56adcd){var _0x56adcd=_0x56adcd||null,_0x1cc5a8=_0x1cc5a8||[],_0x1b178e=0x1,_0x26023e='';if(!error[_0x56adcd]){_0x56adcd=_0x1adb('0xc');}_0x1cc5a8[_0x1adb('0xd')](error[_0x56adcd]);while(arguments[_0x1b178e]){_0x1cc5a8['push'](arguments[_0x1b178e]);_0x1b178e++;}_0x26023e=util[_0x1adb('0xe')][_0x1adb('0xf')](util,_0x1cc5a8);this[_0x1adb('0x10')]=_0x26023e;this[_0x1adb('0x11')]=_0x56adcd;}module[_0x1adb('0x12')]=AGIError; \ No newline at end of file diff --git a/server/services/agi/events.js b/server/services/agi/events.js index c154d29..b5d188c 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 _0x91a3=['emit','error','message','parse','projectUpdate','E_AGI_SERVER_ERROR','lodash','events','EventEmitter','ioredis','../../config/environment','redis','defaults','localhost','agi'];(function(_0x39a4dc,_0x239b61){var _0x33a23e=function(_0xcf368f){while(--_0xcf368f){_0x39a4dc['push'](_0x39a4dc['shift']());}};_0x33a23e(++_0x239b61);}(_0x91a3,0x141));var _0x391a=function(_0x4e3a88,_0x2b9373){_0x4e3a88=_0x4e3a88-0x0;var _0x4620d9=_0x91a3[_0x4e3a88];return _0x4620d9;};'use strict';var _=require(_0x391a('0x0'));var EventEmitter=require(_0x391a('0x1'))[_0x391a('0x2')];var Redis=require(_0x391a('0x3'));var AGIError=require('./error');var config=require(_0x391a('0x4'));config[_0x391a('0x5')]=_[_0x391a('0x6')](config['redis'],{'host':_0x391a('0x7'),'port':0x18eb});var eventEmitter=new EventEmitter();var sub=new Redis(config[_0x391a('0x5')]);sub['subscribe'](_0x391a('0x8'),function(_0x21dd7d){if(_0x21dd7d)return eventEmitter[_0x391a('0x9')](_0x391a('0xa'),new AGIError('E_AGI_SERVER_ERROR',_0x21dd7d));});sub['on'](_0x391a('0xb'),function(_0x2c911c,_0x2050dc){if(_0x2c911c!==_0x391a('0x8'))return;try{var _0x1660f2=JSON[_0x391a('0xc')](_0x2050dc);eventEmitter[_0x391a('0x9')](_0x391a('0xd'),_0x1660f2);}catch(_0x2927d5){eventEmitter['emit'](_0x391a('0xa'),new AGIError(_0x391a('0xe'),_0x2927d5));}});module['exports']={'EventEmitter':eventEmitter}; \ No newline at end of file +var _0xd45c=['../../config/environment','redis','localhost','subscribe','agi','emit','E_AGI_SERVER_ERROR','message','projectUpdate','error','exports','lodash','events','EventEmitter','ioredis','./error'];(function(_0x5631ee,_0x183e33){var _0x5701f6=function(_0x412254){while(--_0x412254){_0x5631ee['push'](_0x5631ee['shift']());}};_0x5701f6(++_0x183e33);}(_0xd45c,0xcb));var _0xcd45=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0xd45c[_0x2c91e9];return _0x13f0ff;};'use strict';var _=require(_0xcd45('0x0'));var EventEmitter=require(_0xcd45('0x1'))[_0xcd45('0x2')];var Redis=require(_0xcd45('0x3'));var AGIError=require(_0xcd45('0x4'));var config=require(_0xcd45('0x5'));config[_0xcd45('0x6')]=_['defaults'](config[_0xcd45('0x6')],{'host':_0xcd45('0x7'),'port':0x18eb});var eventEmitter=new EventEmitter();var sub=new Redis(config[_0xcd45('0x6')]);sub[_0xcd45('0x8')](_0xcd45('0x9'),function(_0x14f4aa){if(_0x14f4aa)return eventEmitter[_0xcd45('0xa')]('error',new AGIError(_0xcd45('0xb'),_0x14f4aa));});sub['on'](_0xcd45('0xc'),function(_0x4e1cf1,_0x310070){if(_0x4e1cf1!=='agi')return;try{var _0x518659=JSON['parse'](_0x310070);eventEmitter[_0xcd45('0xa')](_0xcd45('0xd'),_0x518659);}catch(_0x5703c2){eventEmitter[_0xcd45('0xa')](_0xcd45('0xe'),new AGIError(_0xcd45('0xb'),_0x5703c2));}});module[_0xcd45('0xf')]={'EventEmitter':eventEmitter}; \ No newline at end of file diff --git a/server/services/agi/graph/index.js b/server/services/agi/graph/index.js index 3aee26e..b92db96 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 _0xdcc6=['split','target','default','agicommand','default\x20on\x20switch\x20not\x20found','includes','max\x20retry\x20reach','condition\x20not\x20found','exports','lodash','../../../config/logger','agi','menu','getdigits','getsecretdigits','vertices','numberOfEdges','prototype','addVertex','edges','addEdge','size','relations','getVertex','traverseBFS','info','stop\x20traverse','length','no\x20edge/s\x20available','condition'];(function(_0x4e62df,_0xd392ac){var _0x51e81e=function(_0x3b5c9f){while(--_0x3b5c9f){_0x4e62df['push'](_0x4e62df['shift']());}};_0x51e81e(++_0xd392ac);}(_0xdcc6,0xf9));var _0x6dcc=function(_0x33cf7d,_0x438f57){_0x33cf7d=_0x33cf7d-0x0;var _0x15e421=_0xdcc6[_0x33cf7d];return _0x15e421;};'use strict';var _=require(_0x6dcc('0x0'));var logger=require(_0x6dcc('0x1'))(_0x6dcc('0x2'));var verticesWithRetry=[_0x6dcc('0x3'),_0x6dcc('0x4'),_0x6dcc('0x5')];var Graph=function(){this[_0x6dcc('0x6')]={};this['edges']={};this[_0x6dcc('0x7')]=0x0;};Graph[_0x6dcc('0x8')][_0x6dcc('0x9')]=function(_0x4bc929){this[_0x6dcc('0x6')][_0x4bc929['id']]=_0x4bc929;this[_0x6dcc('0xa')][_0x4bc929['id']]=[];};Graph[_0x6dcc('0x8')][_0x6dcc('0xb')]=function(_0x46acdb,_0x55e5ea,_0x458dd0){this[_0x6dcc('0xa')][_0x46acdb]['push']({'target':_0x55e5ea,'condition':_0x458dd0});this['numberOfEdges']+=0x1;};Graph[_0x6dcc('0x8')]['size']=function(){return _[_0x6dcc('0xc')](this[_0x6dcc('0x6')]);};Graph[_0x6dcc('0x8')][_0x6dcc('0xd')]=function(){return this['numberOfEdges'];};Graph[_0x6dcc('0x8')][_0x6dcc('0xe')]=function(_0x24e0cb){return this[_0x6dcc('0x6')][_0x24e0cb];};Graph[_0x6dcc('0x8')][_0x6dcc('0xf')]=function(_0x3beaf9,_0x36f906){if(!this[_0x6dcc('0x6')][_0x3beaf9]){return logger['info']('no\x20vertex\x20found');}var _0x512d0d=_0x36f906(this[_0x6dcc('0x6')][_0x3beaf9]);if(!_0x512d0d){return logger[_0x6dcc('0x10')](_0x6dcc('0x11'));}if(this['edges'][_0x3beaf9][_0x6dcc('0x12')]===0x0){return logger[_0x6dcc('0x10')](_0x6dcc('0x13'));}for(var _0x1a7dbe=0x0,_0x486bd1=[],_0x1b7808=![];_0x1a7dbe\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','calleridname','callerid','dnid','uniqueid','[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','evtHangup','createSquareReport','then','hasOwnProperty','indexOf','agi_','substring','[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','timeout','hangup'];(function(_0x3fb90d,_0xf3be1b){var _0x41d208=function(_0x1e8983){while(--_0x1e8983){_0x3fb90d['push'](_0x3fb90d['shift']());}};_0x41d208(++_0xf3be1b);}(_0xdb47,0x145));var _0x7db4=function(_0x51eba4,_0x1ed011){_0x51eba4=_0x51eba4-0x0;var _0x3195ce=_0xdb47[_0x51eba4];return _0x3195ce;};'use strict';var _=require(_0x7db4('0x0'));var syncho=require(_0x7db4('0x1'));var util=require(_0x7db4('0x2'));var config=require(_0x7db4('0x3'));var logger=require(_0x7db4('0x4'))(_0x7db4('0x5'));var utilLicense=require('../../config/license/util');var rpc=require(_0x7db4('0x6'));var Project=require(_0x7db4('0x7'));var AGIEmitter=require(_0x7db4('0x8'))[_0x7db4('0x9')];var projects=[];config[_0x7db4('0x5')]=_[_0x7db4('0xa')](config[_0x7db4('0x5')],{'ip':_0x7db4('0xb'),'port':0x11dd});AGIEmitter['on'](_0x7db4('0xc'),projectUpdateHandler);function connectionHandler(_0x437645){process[_0x7db4('0xd')](function(){syncho(function(){try{setChannelVariables(_0x437645);agiHandler(_0x437645);}catch(_0x3d7ae5){logger[_0x7db4('0xe')](_0x3d7ae5[_0x7db4('0xf')]);}});});}function projectUpdateHandler(_0x5ec57f){try{var _0xc31447=_[_0x7db4('0x10')](projects,['id',_0x5ec57f['id']]);if(_0xc31447>-0x1){if(_0x5ec57f[_0x7db4('0x11')]===!![]){projects[_0x7db4('0x12')](_0xc31447,0x1);}else{projects[_0xc31447]=_0x5ec57f;}}else{projects['push'](_0x5ec57f);}}catch(_0x2cc6b5){logger['error'](_0x2cc6b5[_0x7db4('0xf')]);}}function listeningHandler(){console[_0x7db4('0x13')](_0x7db4('0x14'),config['agi'][_0x7db4('0x15')]);logger[_0x7db4('0x16')](util[_0x7db4('0x17')](_0x7db4('0x18'),config['agi']['ip'],config['agi'][_0x7db4('0x15')]));}function errorHandler(_0x4c65d6){if(_0x4c65d6&&_0x4c65d6[_0x7db4('0x19')]&&_0x4c65d6[_0x7db4('0x1a')]){logger['error'](util[_0x7db4('0x17')](_0x7db4('0x1b'),_0x4c65d6[_0x7db4('0x19')],_0x4c65d6['message']));}else{logger[_0x7db4('0xe')](util['format'](_0x7db4('0x1c'),_0x4c65d6[_0x7db4('0xf')]));}}function closeHandler(){logger[_0x7db4('0x16')](util[_0x7db4('0x17')](_0x7db4('0x1d'),this[_0x7db4('0x1e')],this[_0x7db4('0x1f')],this[_0x7db4('0x20')],this[_0x7db4('0x21')],this[_0x7db4('0x22')]));try{createSquareReport(this);}catch(_0x98ddc9){logger[_0x7db4('0xe')](_0x98ddc9[_0x7db4('0xf')]);}}function timeoutHandler(){logger[_0x7db4('0x16')](util[_0x7db4('0x17')](_0x7db4('0x23'),this[_0x7db4('0x1e')],this[_0x7db4('0x1f')],this['callerid'],this['dnid'],this['uniqueid']));}function hangupHandler(){logger[_0x7db4('0x16')](util[_0x7db4('0x17')](_0x7db4('0x24'),this[_0x7db4('0x1e')],this[_0x7db4('0x1f')],this[_0x7db4('0x20')],this[_0x7db4('0x21')],this[_0x7db4('0x22')]));this[_0x7db4('0x25')]=!![];}function createSquareReport(_0x1d560b,_0x227a2c){rpc[_0x7db4('0x26')](_0x1d560b)[_0x7db4('0x27')](function(_0x30861c){if(_0x227a2c){_0x227a2c(null,_0x30861c);}})['catch'](function(_0x5d904b){if(_0x227a2c){_0x227a2c(null,_0x5d904b);}});}function setChannelVariables(_0x2c8935){for(var _0x2de340 in _0x2c8935){if(_0x2c8935[_0x7db4('0x28')](_0x2de340)){if(_0x2de340[_0x7db4('0x29')](_0x7db4('0x2a'))===0x0){_0x2c8935[_0x2de340[_0x7db4('0x2b')](0x4)]=_0x2c8935[_0x2de340];delete _0x2c8935[_0x2de340];}}}}function agiHandler(_0x15f475){logger['debug']('variables',JSON['stringify'](_0x15f475,null,0x2));logger[_0x7db4('0x16')](util[_0x7db4('0x17')](_0x7db4('0x2c'),_0x15f475[_0x7db4('0x1e')],_0x15f475[_0x7db4('0x1f')],_0x15f475[_0x7db4('0x20')],_0x15f475[_0x7db4('0x21')],_0x15f475['uniqueid']));_0x15f475['on'](_0x7db4('0xe'),errorHandler);_0x15f475['on']('close',closeHandler);_0x15f475['on'](_0x7db4('0x2d'),timeoutHandler);_0x15f475[_0x7db4('0x25')]=![];_0x15f475['on'](_0x7db4('0x2e'),hangupHandler);var _0x40719f=_[_0x7db4('0x2f')](projects,[_0x7db4('0x19'),_0x15f475[_0x7db4('0x1e')]]);if(!_0x40719f)return Project[_0x7db4('0x30')](_0x15f475);if(!_0x40719f[_0x7db4('0x31')])return Project[_0x7db4('0x32')](_0x15f475);return Project[_0x7db4('0x33')](_0x40719f,_0x15f475);}function main(){var _0x41bfeb;return utilLicense[_0x7db4('0x34')]()[_0x7db4('0x27')](function(_0x36987a){if(!_0x36987a)return;if(_0x36987a[_0x7db4('0x35')]){if(_0x36987a['callysquare']&&_0x36987a[_0x7db4('0x36')]>0x0){logger[_0x7db4('0x16')](util[_0x7db4('0x17')]('[LICENSE]\x20CHANNELS:\x20%s',_0x36987a[_0x7db4('0x36')]));_0x41bfeb=_0x36987a['callysquare'];}else{logger[_0x7db4('0x16')](_0x7db4('0x37'));}}else{logger['info'](_0x7db4('0x38'));_0x41bfeb=-0x1;}})[_0x7db4('0x27')](function(){return Project['getAll']();})['then'](function(_0x1ae673){projects=_0x1ae673;return;})[_0x7db4('0x39')](function(_0x27cf1e){logger['error'](_0x7db4('0x3a'),_0x27cf1e[_0x7db4('0xf')]);})['finally'](function(){var _0x18b01a=require('./server')(config[_0x7db4('0x5')][_0x7db4('0x15')],config[_0x7db4('0x5')]['ip'],_0x41bfeb);_0x18b01a['on'](_0x7db4('0xe'),errorHandler);_0x18b01a['on'](_0x7db4('0x3b'),listeningHandler);_0x18b01a['on'](_0x7db4('0x3c'),connectionHandler);_0x18b01a['on'](_0x7db4('0x3d'),closeHandler);});}main(); \ No newline at end of file +var _0x3c5d=['stringify','[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','close','hangup','find','handleNotFound','handleUnpublished','initialize','getLicense','callysquare','[LICENSE]\x20CHANNELS:\x20UNLIMITED','[LICENSE]\x20VOICE\x20IS\x20DISABLED','getAll','[LICENSE]','finally','listening','connection','lodash','syncho','../../config/environment','../../config/logger','../../config/license/util','./project','agi','defaults','127.0.0.1','nextTick','error','stack','findIndex','deleted','splice','push','Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!','port','info','[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d','name','message','format','[%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','calleridname','callerid','uniqueid','[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','dnid','[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','evtHangup','createSquareReport','then','catch','hasOwnProperty','indexOf','agi_','substring','debug','variables'];(function(_0x1da46b,_0x109ac4){var _0x3a94ef=function(_0x31a2b4){while(--_0x31a2b4){_0x1da46b['push'](_0x1da46b['shift']());}};_0x3a94ef(++_0x109ac4);}(_0x3c5d,0x179));var _0xd3c5=function(_0x2704b1,_0x40755c){_0x2704b1=_0x2704b1-0x0;var _0x143d08=_0x3c5d[_0x2704b1];return _0x143d08;};'use strict';var _=require(_0xd3c5('0x0'));var syncho=require(_0xd3c5('0x1'));var util=require('util');var config=require(_0xd3c5('0x2'));var logger=require(_0xd3c5('0x3'))('agi');var utilLicense=require(_0xd3c5('0x4'));var rpc=require('./rpc');var Project=require(_0xd3c5('0x5'));var AGIEmitter=require('./events')['EventEmitter'];var projects=[];config[_0xd3c5('0x6')]=_[_0xd3c5('0x7')](config[_0xd3c5('0x6')],{'ip':_0xd3c5('0x8'),'port':0x11dd});AGIEmitter['on']('projectUpdate',projectUpdateHandler);function connectionHandler(_0x3652c6){process[_0xd3c5('0x9')](function(){syncho(function(){try{setChannelVariables(_0x3652c6);agiHandler(_0x3652c6);}catch(_0x2cdd5b){logger[_0xd3c5('0xa')](_0x2cdd5b[_0xd3c5('0xb')]);}});});}function projectUpdateHandler(_0x52fcb3){try{var _0x405d35=_[_0xd3c5('0xc')](projects,['id',_0x52fcb3['id']]);if(_0x405d35>-0x1){if(_0x52fcb3[_0xd3c5('0xd')]===!![]){projects[_0xd3c5('0xe')](_0x405d35,0x1);}else{projects[_0x405d35]=_0x52fcb3;}}else{projects[_0xd3c5('0xf')](_0x52fcb3);}}catch(_0x5bed47){logger[_0xd3c5('0xa')](_0x5bed47['stack']);}}function listeningHandler(){console['log'](_0xd3c5('0x10'),config[_0xd3c5('0x6')][_0xd3c5('0x11')]);logger[_0xd3c5('0x12')](util['format'](_0xd3c5('0x13'),config[_0xd3c5('0x6')]['ip'],config[_0xd3c5('0x6')]['port']));}function errorHandler(_0x156533){if(_0x156533&&_0x156533[_0xd3c5('0x14')]&&_0x156533[_0xd3c5('0x15')]){logger[_0xd3c5('0xa')](util[_0xd3c5('0x16')](_0xd3c5('0x17'),_0x156533[_0xd3c5('0x14')],_0x156533['message']));}else{logger['error'](util['format'](_0xd3c5('0x18'),_0x156533[_0xd3c5('0xb')]));}}function closeHandler(){logger['info'](util[_0xd3c5('0x16')](_0xd3c5('0x19'),this[_0xd3c5('0x1a')],this[_0xd3c5('0x1b')],this[_0xd3c5('0x1c')],this['dnid'],this[_0xd3c5('0x1d')]));try{createSquareReport(this);}catch(_0x4e3dbe){logger[_0xd3c5('0xa')](_0x4e3dbe['stack']);}}function timeoutHandler(){logger[_0xd3c5('0x12')](util[_0xd3c5('0x16')](_0xd3c5('0x1e'),this[_0xd3c5('0x1a')],this[_0xd3c5('0x1b')],this[_0xd3c5('0x1c')],this[_0xd3c5('0x1f')],this[_0xd3c5('0x1d')]));}function hangupHandler(){logger[_0xd3c5('0x12')](util['format'](_0xd3c5('0x20'),this['arg_1'],this['calleridname'],this[_0xd3c5('0x1c')],this[_0xd3c5('0x1f')],this[_0xd3c5('0x1d')]));this[_0xd3c5('0x21')]=!![];}function createSquareReport(_0x5c5ea9,_0x4b55e2){rpc[_0xd3c5('0x22')](_0x5c5ea9)[_0xd3c5('0x23')](function(_0x3db867){if(_0x4b55e2){_0x4b55e2(null,_0x3db867);}})[_0xd3c5('0x24')](function(_0xab2e88){if(_0x4b55e2){_0x4b55e2(null,_0xab2e88);}});}function setChannelVariables(_0x4ea64c){for(var _0x12276f in _0x4ea64c){if(_0x4ea64c[_0xd3c5('0x25')](_0x12276f)){if(_0x12276f[_0xd3c5('0x26')](_0xd3c5('0x27'))===0x0){_0x4ea64c[_0x12276f[_0xd3c5('0x28')](0x4)]=_0x4ea64c[_0x12276f];delete _0x4ea64c[_0x12276f];}}}}function agiHandler(_0x58124b){logger[_0xd3c5('0x29')](_0xd3c5('0x2a'),JSON[_0xd3c5('0x2b')](_0x58124b,null,0x2));logger[_0xd3c5('0x12')](util[_0xd3c5('0x16')](_0xd3c5('0x2c'),_0x58124b[_0xd3c5('0x1a')],_0x58124b['calleridname'],_0x58124b[_0xd3c5('0x1c')],_0x58124b[_0xd3c5('0x1f')],_0x58124b['uniqueid']));_0x58124b['on'](_0xd3c5('0xa'),errorHandler);_0x58124b['on'](_0xd3c5('0x2d'),closeHandler);_0x58124b['on']('timeout',timeoutHandler);_0x58124b[_0xd3c5('0x21')]=![];_0x58124b['on'](_0xd3c5('0x2e'),hangupHandler);var _0x31f7ff=_[_0xd3c5('0x2f')](projects,['name',_0x58124b['arg_1']]);if(!_0x31f7ff)return Project[_0xd3c5('0x30')](_0x58124b);if(!_0x31f7ff['production'])return Project[_0xd3c5('0x31')](_0x58124b);return Project[_0xd3c5('0x32')](_0x31f7ff,_0x58124b);}function main(){var _0x258f6c;return utilLicense[_0xd3c5('0x33')]()[_0xd3c5('0x23')](function(_0x3b8190){if(!_0x3b8190)return;if(_0x3b8190['voice']){if(_0x3b8190[_0xd3c5('0x34')]&&_0x3b8190[_0xd3c5('0x34')]>0x0){logger['info'](util[_0xd3c5('0x16')]('[LICENSE]\x20CHANNELS:\x20%s',_0x3b8190['callysquare']));_0x258f6c=_0x3b8190[_0xd3c5('0x34')];}else{logger['info'](_0xd3c5('0x35'));}}else{logger[_0xd3c5('0x12')](_0xd3c5('0x36'));_0x258f6c=-0x1;}})['then'](function(){return Project[_0xd3c5('0x37')]();})[_0xd3c5('0x23')](function(_0x5d6397){projects=_0x5d6397;return;})[_0xd3c5('0x24')](function(_0x1f7872){logger['error'](_0xd3c5('0x38'),_0x1f7872['stack']);})[_0xd3c5('0x39')](function(){var _0x29693d=require('./server')(config[_0xd3c5('0x6')][_0xd3c5('0x11')],config[_0xd3c5('0x6')]['ip'],_0x258f6c);_0x29693d['on'](_0xd3c5('0xa'),errorHandler);_0x29693d['on'](_0xd3c5('0x3a'),listeningHandler);_0x29693d['on'](_0xd3c5('0x3b'),connectionHandler);_0x29693d['on']('close',closeHandler);});}main(); \ No newline at end of file diff --git a/server/services/agi/mailRpc/index.js b/server/services/agi/mailRpc/index.js index f6e216e..19e2082 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 _0x7d4b=['bluebird','jayson/promise','http','request','then','error','message','result','catch','sendMailMessage','SendMail'];(function(_0x461b99,_0x187486){var _0x2dc278=function(_0x5d7689){while(--_0x5d7689){_0x461b99['push'](_0x461b99['shift']());}};_0x2dc278(++_0x187486);}(_0x7d4b,0x8f));var _0xb7d4=function(_0x4ee814,_0x5043ed){_0x4ee814=_0x4ee814-0x0;var _0x29ea69=_0x7d4b[_0x4ee814];return _0x29ea69;};'use strict';var BPromise=require(_0xb7d4('0x0'));var jayson=require(_0xb7d4('0x1'));var client=jayson['client'][_0xb7d4('0x2')]({'port':0x232b});function request(_0x270f4e,_0x4195df){return new BPromise(function(_0xfc71dd,_0x1b0bf6){return client[_0xb7d4('0x3')](_0x270f4e,_0x4195df)[_0xb7d4('0x4')](function(_0x58d7e0){if(_0x58d7e0[_0xb7d4('0x5')]){return _0x1b0bf6(_0x58d7e0[_0xb7d4('0x5')][_0xb7d4('0x6')]);}else{return _0xfc71dd(_0x58d7e0[_0xb7d4('0x7')]);}})[_0xb7d4('0x8')](function(_0x53999a){return _0x1b0bf6(_0x53999a);});});}exports[_0xb7d4('0x9')]=function(_0x4768fc,_0x2ddaa0){return request(_0xb7d4('0xa'),{'account':_0x4768fc,'message':_0x2ddaa0});}; \ No newline at end of file +var _0x9895=['then','error','message','result','sendMailMessage','SendMail','bluebird','client','http','request'];(function(_0x1a3a5d,_0x5db8f9){var _0x1c8fe5=function(_0x43f3d5){while(--_0x43f3d5){_0x1a3a5d['push'](_0x1a3a5d['shift']());}};_0x1c8fe5(++_0x5db8f9);}(_0x9895,0x15a));var _0x5989=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x9895[_0xfae23b];return _0x200640;};'use strict';var BPromise=require(_0x5989('0x0'));var jayson=require('jayson/promise');var client=jayson[_0x5989('0x1')][_0x5989('0x2')]({'port':0x232b});function request(_0x261519,_0x138f37){return new BPromise(function(_0x3528bb,_0x538ec4){return client[_0x5989('0x3')](_0x261519,_0x138f37)[_0x5989('0x4')](function(_0xeae5a4){if(_0xeae5a4[_0x5989('0x5')]){return _0x538ec4(_0xeae5a4[_0x5989('0x5')][_0x5989('0x6')]);}else{return _0x3528bb(_0xeae5a4[_0x5989('0x7')]);}})['catch'](function(_0x1c04cc){return _0x538ec4(_0x1c04cc);});});}exports[_0x5989('0x8')]=function(_0x56e289,_0x16a72e){return request(_0x5989('0x9'),{'account':_0x56e289,'message':_0x16a72e});}; \ No newline at end of file diff --git a/server/services/agi/project.js b/server/services/agi/project.js index d2c9e6c..1e8bbac 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 _0xca7d=['calleridname','isUndefined','[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s','continueAt','close','Project\x20%s\x20not\x20published','lodash','moment','util','agi','./rpc','./mailRpc','./graph','./vertices','catch','error','Unable\x20to\x20download\x20CallySquare\x20projects','agicommand','hasOwnProperty','maxRetry','retry','addVertex','omit','mxCell','isArray','length','source','target','addEdge','value','toJson','mxGraphModel','root','production','start','joinAt','YYYY-MM-DD\x20HH:mm:ss','info','format','[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','callerid','dnid','traverseBFS','clear','debug','vertex','stringify','gotoc\x20block\x20stop\x20traverse\x20BFS','context','extension','priority','response','code','result','toString','agicommand\x20not\x20found','stack','finally','[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s'];(function(_0x3e6f8f,_0x5d93fe){var _0x4cbeb6=function(_0x5421fe){while(--_0x5421fe){_0x3e6f8f['push'](_0x3e6f8f['shift']());}};_0x4cbeb6(++_0x5d93fe);}(_0xca7d,0xba));var _0xdca7=function(_0x27a3d0,_0x2b4214){_0x27a3d0=_0x27a3d0-0x0;var _0x4cc94d=_0xca7d[_0x27a3d0];return _0x4cc94d;};'use strict';var _=require(_0xdca7('0x0'));var moment=require(_0xdca7('0x1'));var parser=require('xml2json');var util=require(_0xdca7('0x2'));var logger=require('../../config/logger')(_0xdca7('0x3'));var rpc=require(_0xdca7('0x4'));var mailRpc=require(_0xdca7('0x5'));var Graph=require(_0xdca7('0x6'));var Vertices=require(_0xdca7('0x7'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;function getAll(){return rpc['getSquareProjects']()[_0xdca7('0x8')](function(_0x4bc69e){logger[_0xdca7('0x9')](_0xdca7('0xa'),_0x4bc69e['stack']);return[];});}function addVertex(_0x383946,_0x59500e,_0x4dff14){_0x59500e[_0xdca7('0xb')]=_0x4dff14;if(_0x59500e[_0xdca7('0xc')]('retry')){_0x59500e[_0xdca7('0xd')]=parseInt(_0x59500e[_0xdca7('0xe')],0xa);}_0x383946[_0xdca7('0xf')](_[_0xdca7('0x10')](_0x59500e,_0xdca7('0x11')));}function initGraph(_0x7d031f,_0x39bd3a){var _0x36cf5b=new Graph();for(var _0x4bf5fe in _0x7d031f){if(_0x7d031f[_0xdca7('0xc')](_0x4bf5fe)){if(_[_0xdca7('0x12')](_0x7d031f[_0x4bf5fe])){for(var _0x1f0804=0x0;_0x1f0804<_0x7d031f[_0x4bf5fe][_0xdca7('0x13')];_0x1f0804+=0x1){addVertex(_0x36cf5b,_0x7d031f[_0x4bf5fe][_0x1f0804],_0x4bf5fe);}}else{addVertex(_0x36cf5b,_0x7d031f[_0x4bf5fe],_0x4bf5fe);}}}for(var _0x2e508d=0x0;_0x2e508d<_0x39bd3a[_0xdca7('0x13')];_0x2e508d+=0x1){if(_0x39bd3a[_0x2e508d][_0xdca7('0x14')]&&_0x39bd3a[_0x2e508d][_0xdca7('0x15')]){_0x36cf5b[_0xdca7('0x16')](_0x39bd3a[_0x2e508d][_0xdca7('0x14')],_0x39bd3a[_0x2e508d][_0xdca7('0x15')],_0x39bd3a[_0x2e508d][_0xdca7('0x17')]);}}return _0x36cf5b;}function getRoot(_0x17a231){return parser[_0xdca7('0x18')](_0x17a231,{'object':!![]})[_0xdca7('0x19')][_0xdca7('0x1a')];}function inspect(_0x2f1c80){return util['inspect'](_0x2f1c80,{'showHidden':![],'depth':null});}function initialize(_0x3872ba,_0xc3e0){var _0x490474=getRoot(_0x3872ba[_0xdca7('0x1b')]);if(!_0x490474||!_0x490474[_0xdca7('0x1c')])return;var _0x131f1a,_0x783ba3,_0x2b6b93;logger['debug'](_0xdca7('0x1a'),JSON['stringify'](_0x490474,null,0x2));_0xc3e0[_0xdca7('0x1d')]=moment()['format'](_0xdca7('0x1e'));_0x131f1a=initGraph(_['omit'](_0x490474,'mxCell'),_0x490474[_0xdca7('0x11')]);_0x783ba3=new Vertices(_0xc3e0,rpc,mailRpc);logger[_0xdca7('0x1f')](util[_0xdca7('0x20')](_0xdca7('0x21'),_0xc3e0[_0xdca7('0x22')],_0xc3e0['calleridname'],_0xc3e0[_0xdca7('0x23')],_0xc3e0[_0xdca7('0x24')],_0xc3e0['uniqueid']));_0x131f1a[_0xdca7('0x25')](_0x490474[_0xdca7('0x1c')]['id'],function(_0x442a31){try{_0x442a31=_0x783ba3[_0xdca7('0x26')](_0x442a31);logger[_0xdca7('0x27')](_0xdca7('0x28'),JSON[_0xdca7('0x29')](_0x442a31,null,0x2));if(_0x442a31[_0xdca7('0xb')]==='gotoc'){logger[_0xdca7('0x1f')](_0xdca7('0x2a'));_0xc3e0[_0xdca7('0x2b')]=_0x442a31[_0xdca7('0x2b')]||_0xc3e0[_0xdca7('0x2b')];_0xc3e0[_0xdca7('0x2c')]=_0x442a31[_0xdca7('0x2c')];_0xc3e0['priority']=_0x442a31[_0xdca7('0x2d')]?_0x442a31['priority']-0x1:0x1;return null;}else if(_0x442a31&&_0x783ba3[_0x442a31[_0xdca7('0xb')]]){_0x2b6b93=_0x783ba3[_0x442a31[_0xdca7('0xb')]](_0x442a31);logger[_0xdca7('0x1f')](_0xdca7('0x2e'),JSON[_0xdca7('0x29')](_0x2b6b93,null,0x2));if(_0x2b6b93&&_0x2b6b93[_0xdca7('0x2f')]===AGI_CODE_SUCCESS&&_0x2b6b93[_0xdca7('0x30')]!==AGI_RESULT_ERROR&&!_0xc3e0['evtHangup']){logger[_0xdca7('0x27')]('response',inspect(_0x2b6b93));return _['isUndefined'](_0x2b6b93[_0xdca7('0x30')])?null:_0x2b6b93[_0xdca7('0x30')][_0xdca7('0x31')]();}else{logger[_0xdca7('0x9')](_0xdca7('0x2e'),inspect(_0x2b6b93));return null;}}else{logger[_0xdca7('0x9')](_0xdca7('0x32'));return null;}}catch(_0x1ec9e4){logger[_0xdca7('0x9')](_0x1ec9e4[_0xdca7('0x33')]);return null;}});if(_0x490474[_0xdca7('0x34')]){logger[_0xdca7('0x1f')](util['format'](_0xdca7('0x35'),_0xc3e0[_0xdca7('0x22')],_0xc3e0[_0xdca7('0x36')],_0xc3e0['callerid'],_0xc3e0[_0xdca7('0x24')],_0xc3e0['uniqueid']));_0x131f1a[_0xdca7('0x25')](_0x490474[_0xdca7('0x34')]['id'],function(_0x2a7d16){try{_0x2a7d16=_0x783ba3[_0xdca7('0x26')](_0x2a7d16);logger[_0xdca7('0x27')](_0xdca7('0x28'),JSON[_0xdca7('0x29')](_0x2a7d16,null,0x2));if(_0x2a7d16&&_0x783ba3[_0x2a7d16[_0xdca7('0xb')]]){_0x2b6b93=_0x783ba3[_0x2a7d16[_0xdca7('0xb')]](_0x2a7d16);if(_0x2b6b93){logger[_0xdca7('0x27')](_0xdca7('0x2e'),inspect(_0x2b6b93));return _[_0xdca7('0x37')](_0x2b6b93[_0xdca7('0x30')])?null:_0x2b6b93[_0xdca7('0x30')][_0xdca7('0x31')]();}else{logger['error']('response',inspect(_0x2b6b93));return null;}}else{logger['error'](_0xdca7('0x32'));return null;}}catch(_0x577980){logger[_0xdca7('0x9')](_0x577980['stack']);return null;}});}logger[_0xdca7('0x1f')](util['format']('[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0xc3e0[_0xdca7('0x22')],_0xc3e0[_0xdca7('0x36')],_0xc3e0[_0xdca7('0x23')],_0xc3e0[_0xdca7('0x24')],_0xc3e0['uniqueid']));logger['info'](util[_0xdca7('0x20')](_0xdca7('0x38'),_0xc3e0['context'],_0xc3e0['extension'],parseInt(_0xc3e0[_0xdca7('0x2d')],0xa)+0x1));_0xc3e0[_0xdca7('0x39')](_0xc3e0[_0xdca7('0x2b')],_0xc3e0[_0xdca7('0x2c')],parseInt(_0xc3e0['priority'],0xa)+0x1);_0xc3e0[_0xdca7('0x3a')]();}function handleNotFound(_0x2966ed){logger[_0xdca7('0x9')](util[_0xdca7('0x20')]('Project\x20%s\x20not\x20found',_0x2966ed[_0xdca7('0x22')]));_0x2966ed[_0xdca7('0x39')](_0x2966ed[_0xdca7('0x2b')],_0x2966ed[_0xdca7('0x2c')],parseInt(_0x2966ed[_0xdca7('0x2d')],0xa)+0x1);_0x2966ed['close']();}function handleUnpublished(_0x3d6e32){logger[_0xdca7('0x9')](util[_0xdca7('0x20')](_0xdca7('0x3b'),_0x3d6e32[_0xdca7('0x22')]));_0x3d6e32[_0xdca7('0x39')](_0x3d6e32[_0xdca7('0x2b')],_0x3d6e32[_0xdca7('0x2c')],parseInt(_0x3d6e32[_0xdca7('0x2d')],0xa)+0x1);_0x3d6e32['close']();}module['exports']={'getAll':getAll,'handleNotFound':handleNotFound,'handleUnpublished':handleUnpublished,'initialize':initialize}; \ No newline at end of file +var _0x7b5a=['clear','isUndefined','agicommand\x20not\x20found','[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s','continueAt','Project\x20%s\x20not\x20found','Project\x20%s\x20not\x20published','close','moment','xml2json','../../config/logger','agi','./rpc','./vertices','catch','stack','hasOwnProperty','maxRetry','retry','mxCell','isArray','length','source','target','addEdge','value','mxGraphModel','root','inspect','production','start','debug','stringify','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','uniqueid','traverseBFS','vertex','agicommand','gotoc','gotoc\x20block\x20stop\x20traverse\x20BFS','context','extension','priority','response','code','result','toString','error','finally'];(function(_0x5d097f,_0x2c5421){var _0x455378=function(_0x517998){while(--_0x517998){_0x5d097f['push'](_0x5d097f['shift']());}};_0x455378(++_0x2c5421);}(_0x7b5a,0xe9));var _0xa7b5=function(_0x1bb58c,_0x2c8a4d){_0x1bb58c=_0x1bb58c-0x0;var _0x277586=_0x7b5a[_0x1bb58c];return _0x277586;};'use strict';var _=require('lodash');var moment=require(_0xa7b5('0x0'));var parser=require(_0xa7b5('0x1'));var util=require('util');var logger=require(_0xa7b5('0x2'))(_0xa7b5('0x3'));var rpc=require(_0xa7b5('0x4'));var mailRpc=require('./mailRpc');var Graph=require('./graph');var Vertices=require(_0xa7b5('0x5'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;function getAll(){return rpc['getSquareProjects']()[_0xa7b5('0x6')](function(_0x3cd0b9){logger['error']('Unable\x20to\x20download\x20CallySquare\x20projects',_0x3cd0b9[_0xa7b5('0x7')]);return[];});}function addVertex(_0x857ba3,_0x447608,_0x3a3e6e){_0x447608['agicommand']=_0x3a3e6e;if(_0x447608[_0xa7b5('0x8')]('retry')){_0x447608[_0xa7b5('0x9')]=parseInt(_0x447608[_0xa7b5('0xa')],0xa);}_0x857ba3['addVertex'](_['omit'](_0x447608,_0xa7b5('0xb')));}function initGraph(_0x594e5f,_0x1892fb){var _0x16a8fe=new Graph();for(var _0x3cce05 in _0x594e5f){if(_0x594e5f[_0xa7b5('0x8')](_0x3cce05)){if(_[_0xa7b5('0xc')](_0x594e5f[_0x3cce05])){for(var _0x3c7917=0x0;_0x3c7917<_0x594e5f[_0x3cce05][_0xa7b5('0xd')];_0x3c7917+=0x1){addVertex(_0x16a8fe,_0x594e5f[_0x3cce05][_0x3c7917],_0x3cce05);}}else{addVertex(_0x16a8fe,_0x594e5f[_0x3cce05],_0x3cce05);}}}for(var _0x4dcf6a=0x0;_0x4dcf6a<_0x1892fb[_0xa7b5('0xd')];_0x4dcf6a+=0x1){if(_0x1892fb[_0x4dcf6a][_0xa7b5('0xe')]&&_0x1892fb[_0x4dcf6a][_0xa7b5('0xf')]){_0x16a8fe[_0xa7b5('0x10')](_0x1892fb[_0x4dcf6a]['source'],_0x1892fb[_0x4dcf6a][_0xa7b5('0xf')],_0x1892fb[_0x4dcf6a][_0xa7b5('0x11')]);}}return _0x16a8fe;}function getRoot(_0x569aeb){return parser['toJson'](_0x569aeb,{'object':!![]})[_0xa7b5('0x12')][_0xa7b5('0x13')];}function inspect(_0x288b6a){return util[_0xa7b5('0x14')](_0x288b6a,{'showHidden':![],'depth':null});}function initialize(_0x4b3ea3,_0x76264f){var _0x4555d5=getRoot(_0x4b3ea3[_0xa7b5('0x15')]);if(!_0x4555d5||!_0x4555d5[_0xa7b5('0x16')])return;var _0x442c24,_0x2cf3e2,_0x3929f8;logger[_0xa7b5('0x17')](_0xa7b5('0x13'),JSON[_0xa7b5('0x18')](_0x4555d5,null,0x2));_0x76264f['joinAt']=moment()[_0xa7b5('0x19')]('YYYY-MM-DD\x20HH:mm:ss');_0x442c24=initGraph(_['omit'](_0x4555d5,_0xa7b5('0xb')),_0x4555d5['mxCell']);_0x2cf3e2=new Vertices(_0x76264f,rpc,mailRpc);logger[_0xa7b5('0x1a')](util['format'](_0xa7b5('0x1b'),_0x76264f[_0xa7b5('0x1c')],_0x76264f[_0xa7b5('0x1d')],_0x76264f[_0xa7b5('0x1e')],_0x76264f[_0xa7b5('0x1f')],_0x76264f[_0xa7b5('0x20')]));_0x442c24[_0xa7b5('0x21')](_0x4555d5[_0xa7b5('0x16')]['id'],function(_0xce3477){try{_0xce3477=_0x2cf3e2['clear'](_0xce3477);logger[_0xa7b5('0x17')](_0xa7b5('0x22'),JSON[_0xa7b5('0x18')](_0xce3477,null,0x2));if(_0xce3477[_0xa7b5('0x23')]===_0xa7b5('0x24')){logger[_0xa7b5('0x1a')](_0xa7b5('0x25'));_0x76264f['context']=_0xce3477[_0xa7b5('0x26')]||_0x76264f[_0xa7b5('0x26')];_0x76264f[_0xa7b5('0x27')]=_0xce3477[_0xa7b5('0x27')];_0x76264f[_0xa7b5('0x28')]=_0xce3477[_0xa7b5('0x28')]?_0xce3477[_0xa7b5('0x28')]-0x1:0x1;return null;}else if(_0xce3477&&_0x2cf3e2[_0xce3477[_0xa7b5('0x23')]]){_0x3929f8=_0x2cf3e2[_0xce3477['agicommand']](_0xce3477);logger[_0xa7b5('0x1a')](_0xa7b5('0x29'),JSON[_0xa7b5('0x18')](_0x3929f8,null,0x2));if(_0x3929f8&&_0x3929f8[_0xa7b5('0x2a')]===AGI_CODE_SUCCESS&&_0x3929f8['result']!==AGI_RESULT_ERROR&&!_0x76264f['evtHangup']){logger['debug'](_0xa7b5('0x29'),inspect(_0x3929f8));return _['isUndefined'](_0x3929f8[_0xa7b5('0x2b')])?null:_0x3929f8[_0xa7b5('0x2b')][_0xa7b5('0x2c')]();}else{logger[_0xa7b5('0x2d')](_0xa7b5('0x29'),inspect(_0x3929f8));return null;}}else{logger[_0xa7b5('0x2d')]('agicommand\x20not\x20found');return null;}}catch(_0x31ce4c){logger[_0xa7b5('0x2d')](_0x31ce4c[_0xa7b5('0x7')]);return null;}});if(_0x4555d5[_0xa7b5('0x2e')]){logger[_0xa7b5('0x1a')](util[_0xa7b5('0x19')]('[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x76264f[_0xa7b5('0x1c')],_0x76264f[_0xa7b5('0x1d')],_0x76264f[_0xa7b5('0x1e')],_0x76264f[_0xa7b5('0x1f')],_0x76264f['uniqueid']));_0x442c24['traverseBFS'](_0x4555d5[_0xa7b5('0x2e')]['id'],function(_0x5ed51f){try{_0x5ed51f=_0x2cf3e2[_0xa7b5('0x2f')](_0x5ed51f);logger[_0xa7b5('0x17')]('vertex',JSON[_0xa7b5('0x18')](_0x5ed51f,null,0x2));if(_0x5ed51f&&_0x2cf3e2[_0x5ed51f[_0xa7b5('0x23')]]){_0x3929f8=_0x2cf3e2[_0x5ed51f['agicommand']](_0x5ed51f);if(_0x3929f8){logger['debug'](_0xa7b5('0x29'),inspect(_0x3929f8));return _[_0xa7b5('0x30')](_0x3929f8[_0xa7b5('0x2b')])?null:_0x3929f8[_0xa7b5('0x2b')][_0xa7b5('0x2c')]();}else{logger[_0xa7b5('0x2d')]('response',inspect(_0x3929f8));return null;}}else{logger[_0xa7b5('0x2d')](_0xa7b5('0x31'));return null;}}catch(_0x891ef1){logger['error'](_0x891ef1[_0xa7b5('0x7')]);return null;}});}logger['info'](util[_0xa7b5('0x19')](_0xa7b5('0x32'),_0x76264f[_0xa7b5('0x1c')],_0x76264f[_0xa7b5('0x1d')],_0x76264f[_0xa7b5('0x1e')],_0x76264f[_0xa7b5('0x1f')],_0x76264f[_0xa7b5('0x20')]));logger['info'](util['format'](_0xa7b5('0x33'),_0x76264f[_0xa7b5('0x26')],_0x76264f['extension'],parseInt(_0x76264f[_0xa7b5('0x28')],0xa)+0x1));_0x76264f[_0xa7b5('0x34')](_0x76264f[_0xa7b5('0x26')],_0x76264f[_0xa7b5('0x27')],parseInt(_0x76264f[_0xa7b5('0x28')],0xa)+0x1);_0x76264f['close']();}function handleNotFound(_0x192ccd){logger[_0xa7b5('0x2d')](util['format'](_0xa7b5('0x35'),_0x192ccd[_0xa7b5('0x1c')]));_0x192ccd[_0xa7b5('0x34')](_0x192ccd[_0xa7b5('0x26')],_0x192ccd['extension'],parseInt(_0x192ccd['priority'],0xa)+0x1);_0x192ccd['close']();}function handleUnpublished(_0x2178f1){logger[_0xa7b5('0x2d')](util[_0xa7b5('0x19')](_0xa7b5('0x36'),_0x2178f1['arg_1']));_0x2178f1['continueAt'](_0x2178f1[_0xa7b5('0x26')],_0x2178f1[_0xa7b5('0x27')],parseInt(_0x2178f1['priority'],0xa)+0x1);_0x2178f1[_0xa7b5('0x37')]();}module['exports']={'getAll':getAll,'handleNotFound':handleNotFound,'handleUnpublished':handleUnpublished,'initialize':initialize}; \ No newline at end of file diff --git a/server/services/agi/reply.js b/server/services/agi/reply.js index cc08b26..f33a3c7 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 _0x8a72=['line','Transform','call','_localBuffer','_inBody','_transform','\x0d\x0a\x0d\x0a','indexOf','substring','length','split','slice','trim','emit','headers'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8a72,0xa6));var _0x28a7=function(_0x5baa80,_0xbd60ab){_0x5baa80=_0x5baa80-0x0;var _0x817ac8=_0x8a72[_0x5baa80];return _0x817ac8;};'use strict';var util=require('util');var Transform=require('stream')[_0x28a7('0x0')];function AGIReply(_0x573016){Transform[_0x28a7('0x1')](this,_0x573016);this[_0x28a7('0x2')]='';this[_0x28a7('0x3')]=![];}util['inherits'](AGIReply,Transform);AGIReply['prototype'][_0x28a7('0x4')]=function(_0x294605,_0x57c71f,_0x49ff02){var _0x5681da='\x0a',_0x9b7041=['\x0a\x0a',_0x28a7('0x5')],_0x3d8924=-0x1,_0x576fd3=-0x1,_0x57fd04='',_0x3a6773=0x0,_0x141fcb='',_0x219585='';this[_0x28a7('0x2')]+=_0x294605['toString']();_0x141fcb=this[_0x28a7('0x2')];if(!this['_inBody']){_0x3a6773=0x0;while(_0x9b7041[_0x3a6773]){while((_0x576fd3=_0x141fcb[_0x28a7('0x6')](_0x9b7041[_0x3a6773]))!=-0x1){_0x57fd04=_0x9b7041[_0x3a6773];_0x219585=_0x141fcb[_0x28a7('0x7')](0x0,_0x576fd3);_0x141fcb=_0x141fcb[_0x28a7('0x7')](_0x576fd3+_0x57fd04[_0x28a7('0x8')]);var _0x343683=_0x219585[_0x28a7('0x9')](_0x5681da),_0x140235=0x0,_0x406f24={},_0x4aab57='',_0x580b70='',_0xebfc79=-0x1;while(_0x343683[_0x140235]){_0xebfc79=_0x343683[_0x140235][_0x28a7('0x6')](':');if(_0xebfc79!=-0x1){_0x4aab57=_0x343683[_0x140235][_0x28a7('0xa')](0x0,_0xebfc79)[_0x28a7('0xb')]();_0x580b70=_0x343683[_0x140235][_0x28a7('0xa')](_0xebfc79+0x1)[_0x28a7('0xb')]();if(_0x4aab57[_0x28a7('0x8')]>0x0){_0x406f24[_0x4aab57]=_0x580b70;}}else{}_0x140235++;}this[_0x28a7('0xc')](_0x28a7('0xd'),_0x406f24);this[_0x28a7('0x3')]=!![];}_0x3a6773++;}this[_0x28a7('0x2')]=_0x141fcb;}else{while((_0x3d8924=_0x141fcb[_0x28a7('0x6')](_0x5681da))!=-0x1){_0x219585=_0x141fcb['substring'](0x0,_0x3d8924);this[_0x28a7('0xc')](_0x28a7('0xe'),_0x219585);_0x141fcb=_0x141fcb[_0x28a7('0x7')](_0x3d8924+_0x5681da['length']);}this['_localBuffer']=_0x141fcb;}_0x49ff02();};module['exports']=AGIReply; \ No newline at end of file +var _0x1c81=['_localBuffer','toString','_inBody','indexOf','substring','split','slice','trim','emit','length','exports','util','call','prototype','_transform','\x0d\x0a\x0d\x0a'];(function(_0x160373,_0x56264e){var _0x37bea8=function(_0x339016){while(--_0x339016){_0x160373['push'](_0x160373['shift']());}};_0x37bea8(++_0x56264e);}(_0x1c81,0x8b));var _0x11c8=function(_0x3fa1ee,_0x1744ca){_0x3fa1ee=_0x3fa1ee-0x0;var _0x24996d=_0x1c81[_0x3fa1ee];return _0x24996d;};'use strict';var util=require(_0x11c8('0x0'));var Transform=require('stream')['Transform'];function AGIReply(_0x3f6ff5){Transform[_0x11c8('0x1')](this,_0x3f6ff5);this['_localBuffer']='';this['_inBody']=![];}util['inherits'](AGIReply,Transform);AGIReply[_0x11c8('0x2')][_0x11c8('0x3')]=function(_0x4da349,_0x34d2b2,_0x318930){var _0xa530f3='\x0a',_0xb42d50=['\x0a\x0a',_0x11c8('0x4')],_0x396d8e=-0x1,_0x118b5d=-0x1,_0x4504b7='',_0x116f13=0x0,_0x2621f4='',_0x17138e='';this[_0x11c8('0x5')]+=_0x4da349[_0x11c8('0x6')]();_0x2621f4=this[_0x11c8('0x5')];if(!this[_0x11c8('0x7')]){_0x116f13=0x0;while(_0xb42d50[_0x116f13]){while((_0x118b5d=_0x2621f4[_0x11c8('0x8')](_0xb42d50[_0x116f13]))!=-0x1){_0x4504b7=_0xb42d50[_0x116f13];_0x17138e=_0x2621f4[_0x11c8('0x9')](0x0,_0x118b5d);_0x2621f4=_0x2621f4[_0x11c8('0x9')](_0x118b5d+_0x4504b7['length']);var _0x5d1155=_0x17138e[_0x11c8('0xa')](_0xa530f3),_0x16c011=0x0,_0x3a90ec={},_0x4710f3='',_0x9fe0d6='',_0xc2b528=-0x1;while(_0x5d1155[_0x16c011]){_0xc2b528=_0x5d1155[_0x16c011][_0x11c8('0x8')](':');if(_0xc2b528!=-0x1){_0x4710f3=_0x5d1155[_0x16c011][_0x11c8('0xb')](0x0,_0xc2b528)['trim']();_0x9fe0d6=_0x5d1155[_0x16c011][_0x11c8('0xb')](_0xc2b528+0x1)[_0x11c8('0xc')]();if(_0x4710f3['length']>0x0){_0x3a90ec[_0x4710f3]=_0x9fe0d6;}}else{}_0x16c011++;}this[_0x11c8('0xd')]('headers',_0x3a90ec);this[_0x11c8('0x7')]=!![];}_0x116f13++;}this[_0x11c8('0x5')]=_0x2621f4;}else{while((_0x396d8e=_0x2621f4[_0x11c8('0x8')](_0xa530f3))!=-0x1){_0x17138e=_0x2621f4[_0x11c8('0x9')](0x0,_0x396d8e);this['emit']('line',_0x17138e);_0x2621f4=_0x2621f4[_0x11c8('0x9')](_0x396d8e+_0xa530f3[_0x11c8('0xe')]);}this[_0x11c8('0x5')]=_0x2621f4;}_0x318930();};module[_0x11c8('0xf')]=AGIReply; \ No newline at end of file diff --git a/server/services/agi/rpc/index.js b/server/services/agi/rpc/index.js index 98830c6..dd0f870 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 _0x1af3=['arg_2','format','createSquareRecording','createSquareMessage','CreateSquareMessage','createCmContact','ListId','then','CreateCmContact','getPauseById','ShowPause','agentLogin','agentPause','agentUnpause','UnpauseUser','agentLogout','LogoutUser','lodash','moment','jayson/promise','client','http','request','error','message','catch','getSquareProjects','name','production','getSquareProject','ShowSquareProject','getMailAccountById','MailServerOut','Smtp','CloudProvider','getSquareProjectById','getVoiceQueueById','ShowVoiceQueue','getVariableById','ShowVariable','getSquareOdbcById','ShowSquareOdbc','getUserById','ShowUser','getContactByPhone','GetContactByPhone','phone','getTrunkById','ShowTrunk','getSoundById','ShowSound','getIntervalById','ShowInterval','Interval','Intervals','getSmsAccountById','ShowSmsAccount','createSmsMessage','CreateSmsMessage','createSquareDetailsReport','CreateSquareDetailsReport','merge','arg_1'];(function(_0x1f816d,_0x2d44dc){var _0x92b0cd=function(_0x43d0ef){while(--_0x43d0ef){_0x1f816d['push'](_0x1f816d['shift']());}};_0x92b0cd(++_0x2d44dc);}(_0x1af3,0x1ca));var _0x31af=function(_0x32d457,_0x1a39c9){_0x32d457=_0x32d457-0x0;var _0x338386=_0x1af3[_0x32d457];return _0x338386;};'use strict';var _=require(_0x31af('0x0'));var moment=require(_0x31af('0x1'));var jayson=require(_0x31af('0x2'));var client=jayson[_0x31af('0x3')][_0x31af('0x4')]({'port':0x2329});function request(_0xf27e22,_0x3d693c){return new Promise(function(_0x1a6ea6,_0x3d64ae){return client[_0x31af('0x5')](_0xf27e22,_0x3d693c)['then'](function(_0x19acd1){if(_0x19acd1[_0x31af('0x6')]){return _0x3d64ae(_0x19acd1[_0x31af('0x6')][_0x31af('0x7')]);}else{return _0x1a6ea6(_0x19acd1['result']);}})[_0x31af('0x8')](function(_0x1833de){return _0x3d64ae(_0x1833de);});});}exports[_0x31af('0x9')]=function(){return request('GetSquareProjects',{'options':{'raw':![],'attributes':['id',_0x31af('0xa'),_0x31af('0xb')]}});};exports[_0x31af('0xc')]=function(_0x1d2cd0){return request(_0x31af('0xd'),{'options':{'raw':![],'where':{'name':_0x1d2cd0},'attributes':[_0x31af('0xb')]}});};exports[_0x31af('0xe')]=function(_0x33b4a5){return request('ShowMailAccount',{'options':{'raw':![],'where':{'id':_0x33b4a5},'include':[{'model':_0x31af('0xf'),'as':_0x31af('0x10'),'include':[{'model':_0x31af('0x11'),'as':_0x31af('0x11')}]}],'attributes':['id',_0x31af('0xa'),'email'],'smtp':!![]}});};exports[_0x31af('0x12')]=function(_0x4fc1ca){return request('ShowSquareProject',{'options':{'where':{'id':_0x4fc1ca},'attributes':['name']}});};exports[_0x31af('0x13')]=function(_0x46a494){return request(_0x31af('0x14'),{'options':{'where':{'id':_0x46a494},'attributes':[_0x31af('0xa')]}});};exports[_0x31af('0x15')]=function(_0x1d35fa){return request(_0x31af('0x16'),{'options':{'where':{'id':_0x1d35fa},'attributes':[_0x31af('0xa')]}});};exports[_0x31af('0x17')]=function(_0x5a651f){return request(_0x31af('0x18'),{'options':{'where':{'id':_0x5a651f},'attributes':['dsn']}});};exports[_0x31af('0x19')]=function(_0xd33b3f){return request(_0x31af('0x1a'),{'options':{'where':{'id':_0xd33b3f},'attributes':[_0x31af('0xa')]}});};exports[_0x31af('0x1b')]=function(_0x30a112){return request(_0x31af('0x1c'),{'options':{'where':{'phone':_0x30a112[_0x31af('0x1d')]},'attributes':['id']}});};exports[_0x31af('0x1e')]=function(_0x550870){return request(_0x31af('0x1f'),{'options':{'where':{'id':_0x550870},'attributes':[_0x31af('0xa')]}});};exports[_0x31af('0x20')]=function(_0x2ce4c2){return request(_0x31af('0x21'),{'options':{'where':{'id':_0x2ce4c2},'attributes':['save_name']}});};exports[_0x31af('0x22')]=function(_0x46b03e){return request(_0x31af('0x23'),{'options':{'raw':![],'where':{'id':_0x46b03e},'include':[{'model':_0x31af('0x24'),'as':_0x31af('0x25')}]}});};exports[_0x31af('0x26')]=function(_0x1ddfba){return request(_0x31af('0x27'),{'options':{'where':{'id':_0x1ddfba},'attributes':['id',_0x31af('0xa')]}});};exports[_0x31af('0x28')]=function(_0x40aa32){return request(_0x31af('0x29'),{'body':_0x40aa32});};exports[_0x31af('0x2a')]=function(_0x34a5a7){return request(_0x31af('0x2b'),{'body':_0x34a5a7});};exports['createSquareReport']=function(_0x5b74ca){return request('CreateSquareReport',{'body':_[_0x31af('0x2c')](_0x5b74ca,{'project_name':_0x5b74ca[_0x31af('0x2d')],'prev_project_name':_0x5b74ca['arg_2']||'','is_subproject':_0x5b74ca[_0x31af('0x2e')]?!![]:![],'leaveAt':moment()[_0x31af('0x2f')]('YYYY-MM-DD\x20HH:mm:ss')})});};exports[_0x31af('0x30')]=function(_0x21e227){return request('CreateSquareRecording',{'body':_0x21e227});};exports[_0x31af('0x31')]=function(_0x28bb13){return request(_0x31af('0x32'),{'body':_0x28bb13});};exports[_0x31af('0x33')]=function(_0x3326a7){return request('ShowCmHopper',{'options':{'raw':![],'where':{'phone':_0x3326a7[_0x31af('0x1d')],'ListId':_0x3326a7[_0x31af('0x34')]}}})[_0x31af('0x35')](function(_0x1f4eae){if(_0x1f4eae){return _0x1f4eae;}return request(_0x31af('0x36'),{'body':_0x3326a7});});};exports[_0x31af('0x37')]=function(_0x149d01){return request(_0x31af('0x38'),{'options':{'where':{'id':_0x149d01},'attributes':[_0x31af('0xa')]}});};exports[_0x31af('0x39')]=function(_0x388e9c,_0x27ad23){return request('LoginUser',{'body':{'interface':_0x27ad23},'options':{'where':_0x388e9c}});};exports[_0x31af('0x3a')]=function(_0xf58cfe,_0x4d5166,_0x4cabed){return request('PauseUser',{'body':{'type':_0x4d5166,'uniqueid':_0x4cabed},'options':{'where':_0xf58cfe}});};exports[_0x31af('0x3b')]=function(_0x49783f){return request(_0x31af('0x3c'),{'body':{},'options':{'where':_0x49783f}});};exports[_0x31af('0x3d')]=function(_0x2899a0){return request(_0x31af('0x3e'),{'body':{},'options':{'where':_0x2899a0}});}; \ No newline at end of file +var _0xf873=['getMailAccountById','ShowMailAccount','MailServerOut','Smtp','CloudProvider','email','getSquareProjectById','ShowVoiceQueue','getVariableById','ShowVariable','getSquareOdbcById','ShowSquareOdbc','dsn','getUserById','ShowUser','getContactByPhone','GetContactByPhone','phone','getTrunkById','ShowTrunk','getSoundById','ShowInterval','Interval','getSmsAccountById','ShowSmsAccount','createSmsMessage','CreateSmsMessage','createSquareDetailsReport','CreateSquareDetailsReport','createSquareReport','merge','arg_1','arg_2','YYYY-MM-DD\x20HH:mm:ss','createSquareRecording','CreateSquareRecording','createSquareMessage','CreateSquareMessage','createCmContact','ShowCmHopper','ListId','then','CreateCmContact','getPauseById','ShowPause','agentLogin','PauseUser','agentUnpause','UnpauseUser','LogoutUser','moment','jayson/promise','client','http','request','error','result','catch','getSquareProjects','GetSquareProjects','name','getSquareProject','ShowSquareProject','production'];(function(_0x498870,_0x5bee43){var _0xe32076=function(_0x28b1f7){while(--_0x28b1f7){_0x498870['push'](_0x498870['shift']());}};_0xe32076(++_0x5bee43);}(_0xf873,0xb2));var _0x3f87=function(_0x378331,_0x545782){_0x378331=_0x378331-0x0;var _0x2374dc=_0xf873[_0x378331];return _0x2374dc;};'use strict';var _=require('lodash');var moment=require(_0x3f87('0x0'));var jayson=require(_0x3f87('0x1'));var client=jayson[_0x3f87('0x2')][_0x3f87('0x3')]({'port':0x2329});function request(_0x1c56a3,_0xd4592c){return new Promise(function(_0x2fbb4f,_0x1d68dd){return client[_0x3f87('0x4')](_0x1c56a3,_0xd4592c)['then'](function(_0x2e2177){if(_0x2e2177[_0x3f87('0x5')]){return _0x1d68dd(_0x2e2177[_0x3f87('0x5')]['message']);}else{return _0x2fbb4f(_0x2e2177[_0x3f87('0x6')]);}})[_0x3f87('0x7')](function(_0x3b8e92){return _0x1d68dd(_0x3b8e92);});});}exports[_0x3f87('0x8')]=function(){return request(_0x3f87('0x9'),{'options':{'raw':![],'attributes':['id',_0x3f87('0xa'),'production']}});};exports[_0x3f87('0xb')]=function(_0x435ca8){return request(_0x3f87('0xc'),{'options':{'raw':![],'where':{'name':_0x435ca8},'attributes':[_0x3f87('0xd')]}});};exports[_0x3f87('0xe')]=function(_0xd41ca0){return request(_0x3f87('0xf'),{'options':{'raw':![],'where':{'id':_0xd41ca0},'include':[{'model':_0x3f87('0x10'),'as':_0x3f87('0x11'),'include':[{'model':_0x3f87('0x12'),'as':_0x3f87('0x12')}]}],'attributes':['id',_0x3f87('0xa'),_0x3f87('0x13')],'smtp':!![]}});};exports[_0x3f87('0x14')]=function(_0x5aff02){return request(_0x3f87('0xc'),{'options':{'where':{'id':_0x5aff02},'attributes':[_0x3f87('0xa')]}});};exports['getVoiceQueueById']=function(_0x1cfba3){return request(_0x3f87('0x15'),{'options':{'where':{'id':_0x1cfba3},'attributes':[_0x3f87('0xa')]}});};exports[_0x3f87('0x16')]=function(_0x3f192a){return request(_0x3f87('0x17'),{'options':{'where':{'id':_0x3f192a},'attributes':[_0x3f87('0xa')]}});};exports[_0x3f87('0x18')]=function(_0x5f0b2b){return request(_0x3f87('0x19'),{'options':{'where':{'id':_0x5f0b2b},'attributes':[_0x3f87('0x1a')]}});};exports[_0x3f87('0x1b')]=function(_0x4e1df8){return request(_0x3f87('0x1c'),{'options':{'where':{'id':_0x4e1df8},'attributes':['name']}});};exports[_0x3f87('0x1d')]=function(_0x13550c){return request(_0x3f87('0x1e'),{'options':{'where':{'phone':_0x13550c[_0x3f87('0x1f')]},'attributes':['id']}});};exports[_0x3f87('0x20')]=function(_0x4fe75c){return request(_0x3f87('0x21'),{'options':{'where':{'id':_0x4fe75c},'attributes':[_0x3f87('0xa')]}});};exports[_0x3f87('0x22')]=function(_0x3a602a){return request('ShowSound',{'options':{'where':{'id':_0x3a602a},'attributes':['save_name']}});};exports['getIntervalById']=function(_0x73aba6){return request(_0x3f87('0x23'),{'options':{'raw':![],'where':{'id':_0x73aba6},'include':[{'model':_0x3f87('0x24'),'as':'Intervals'}]}});};exports[_0x3f87('0x25')]=function(_0xb01673){return request(_0x3f87('0x26'),{'options':{'where':{'id':_0xb01673},'attributes':['id',_0x3f87('0xa')]}});};exports[_0x3f87('0x27')]=function(_0x46d773){return request(_0x3f87('0x28'),{'body':_0x46d773});};exports[_0x3f87('0x29')]=function(_0x197ff4){return request(_0x3f87('0x2a'),{'body':_0x197ff4});};exports[_0x3f87('0x2b')]=function(_0x37b8b9){return request('CreateSquareReport',{'body':_[_0x3f87('0x2c')](_0x37b8b9,{'project_name':_0x37b8b9[_0x3f87('0x2d')],'prev_project_name':_0x37b8b9[_0x3f87('0x2e')]||'','is_subproject':_0x37b8b9['arg_2']?!![]:![],'leaveAt':moment()['format'](_0x3f87('0x2f'))})});};exports[_0x3f87('0x30')]=function(_0x18df70){return request(_0x3f87('0x31'),{'body':_0x18df70});};exports[_0x3f87('0x32')]=function(_0x148d8e){return request(_0x3f87('0x33'),{'body':_0x148d8e});};exports[_0x3f87('0x34')]=function(_0x113e40){return request(_0x3f87('0x35'),{'options':{'raw':![],'where':{'phone':_0x113e40[_0x3f87('0x1f')],'ListId':_0x113e40[_0x3f87('0x36')]}}})[_0x3f87('0x37')](function(_0x241d88){if(_0x241d88){return _0x241d88;}return request(_0x3f87('0x38'),{'body':_0x113e40});});};exports[_0x3f87('0x39')]=function(_0x5d6fc2){return request(_0x3f87('0x3a'),{'options':{'where':{'id':_0x5d6fc2},'attributes':[_0x3f87('0xa')]}});};exports[_0x3f87('0x3b')]=function(_0x2f0f05,_0x5495ed){return request('LoginUser',{'body':{'interface':_0x5495ed},'options':{'where':_0x2f0f05}});};exports['agentPause']=function(_0x221800,_0xcafb7d,_0x1d90d4){return request(_0x3f87('0x3c'),{'body':{'type':_0xcafb7d,'uniqueid':_0x1d90d4},'options':{'where':_0x221800}});};exports[_0x3f87('0x3d')]=function(_0x5e4570){return request(_0x3f87('0x3e'),{'body':{},'options':{'where':_0x5e4570}});};exports['agentLogout']=function(_0x2e4bc7){return request(_0x3f87('0x3f'),{'body':{},'options':{'where':_0x2e4bc7}});}; \ 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 7bf27cb..e30ba83 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 _0x0763=['exports','./polly'];(function(_0x45e706,_0x42f0d6){var _0x1ac835=function(_0x41c770){while(--_0x41c770){_0x45e706['push'](_0x45e706['shift']());}};_0x1ac835(++_0x42f0d6);}(_0x0763,0x87));var _0x3076=function(_0x1653b1,_0x35b7d1){_0x1653b1=_0x1653b1-0x0;var _0x3e0b17=_0x0763[_0x1653b1];return _0x3e0b17;};var polly=require(_0x3076('0x0'));var lex=require('./lex');module[_0x3076('0x1')]={'polly':polly,'lex':lex}; \ No newline at end of file +var _0x2d2c=['./polly','./lex','exports'];(function(_0x515028,_0x30dfcc){var _0x133701=function(_0x1993c1){while(--_0x1993c1){_0x515028['push'](_0x515028['shift']());}};_0x133701(++_0x30dfcc);}(_0x2d2c,0x1d7));var _0xc2d2=function(_0x4b73a2,_0x40b5fe){_0x4b73a2=_0x4b73a2-0x0;var _0x383c66=_0x2d2c[_0x4b73a2];return _0x383c66;};var polly=require(_0xc2d2('0x0'));var lex=require(_0xc2d2('0x1'));module[_0xc2d2('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 b925ad5..5d9137c 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. * // * * // ************************************************************************* -'use strict';var lex=require('./lib/api');module['exports']=function(_0x26fe42,_0xe4a5bf,_0x17d4ec,_0x22c4b8,_0x4c37e8,_0x8c392f){return lex(_0x26fe42,_0xe4a5bf,_0x17d4ec,_0x22c4b8,_0x4c37e8,_0x8c392f);}; \ No newline at end of file +'use strict';var lex=require('./lib/api');module['exports']=function(_0x1c27bb,_0x4a4906,_0x3f643d,_0x306b6e,_0x2221f1,_0x10d2c4){return lex(_0x1c27bb,_0x4a4906,_0x3f643d,_0x306b6e,_0x2221f1,_0x10d2c4);}; \ 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 22bcd53..7dab313 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(_0x1efb4a,_0x5bd7e7){var _0x109341=function(_0x3c4e7d){while(--_0x3c4e7d){_0x1efb4a['push'](_0x1efb4a['shift']());}};_0x109341(++_0x5bd7e7);}(_0xa9e0,0x123));var _0x0a9e=function(_0x25bea7,_0x49ab45){_0x25bea7=_0x25bea7-0x0;var _0x175952=_0xa9e0[_0x25bea7];return _0x175952;};'use strict';var BPromise=require(_0x0a9e('0x0'));var AWS=require(_0x0a9e('0x1'));function lexResult(_0x29929c,_0x5dd881){return new BPromise(function(_0x550fbc,_0x18d5c9){_0x29929c['postText'](_0x5dd881,function(_0x333808,_0x432180){if(_0x333808){_0x18d5c9(_0x333808);}if(_0x432180[_0x0a9e('0x2')]){for(const _0x991246 in _0x432180[_0x0a9e('0x2')]){if(_0x432180['slots'][_0x0a9e('0x3')](_0x991246)){var _0x441e3a=_0x432180[_0x0a9e('0x2')][_0x991246];_0x432180['slot_'+_0x991246]=_0x441e3a;}}}_0x550fbc(_0x432180);});});}module['exports']=function(_0xe42b77,_0x56465b,_0x52cace,_0x39753a,_0xf81284,_0x307b3e){var _0x3ab53f=new AWS[(_0x0a9e('0x4'))]({'accessKeyId':_0x56465b,'secretAccessKey':_0x52cace,'region':_0x39753a});var _0xbd1168={'botAlias':'$LATEST','botName':_0x307b3e,'inputText':_0xf81284,'userId':_0xe42b77};return lexResult(_0x3ab53f,_0xbd1168);}; \ No newline at end of file +var _0xa9e0=['LexRuntime','bluebird','aws-sdk','slots','hasOwnProperty'];(function(_0x533f44,_0x2e49ca){var _0x94dfd8=function(_0x56b77c){while(--_0x56b77c){_0x533f44['push'](_0x533f44['shift']());}};_0x94dfd8(++_0x2e49ca);}(_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 08072d1..f93977b 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 _0xc5d1=['./lib/api','exports'];(function(_0x3cdcfb,_0x161e5c){var _0x59f5da=function(_0x337416){while(--_0x337416){_0x3cdcfb['push'](_0x3cdcfb['shift']());}};_0x59f5da(++_0x161e5c);}(_0xc5d1,0xb4));var _0x1c5d=function(_0x22133a,_0x21dfc2){_0x22133a=_0x22133a-0x0;var _0xffab4c=_0xc5d1[_0x22133a];return _0xffab4c;};'use strict';var polly=require(_0x1c5d('0x0'));module[_0x1c5d('0x1')]=function(_0x13f882,_0xd43f8b,_0xfba089,_0x3a70d5,_0x547bef,_0xc369fa,_0x49c0f4){return polly(_0x13f882,_0xd43f8b,_0xfba089,_0x3a70d5,_0x547bef,_0xc369fa,_0x49c0f4);}; \ No newline at end of file +var _0x6f08=['exports','./lib/api'];(function(_0xfc05ac,_0x48f5ed){var _0xa8cc6=function(_0x95526a){while(--_0x95526a){_0xfc05ac['push'](_0xfc05ac['shift']());}};_0xa8cc6(++_0x48f5ed);}(_0x6f08,0x161));var _0x86f0=function(_0x628767,_0x2bbf3e){_0x628767=_0x628767-0x0;var _0xbfdbc5=_0x6f08[_0x628767];return _0xbfdbc5;};'use strict';var polly=require(_0x86f0('0x0'));module[_0x86f0('0x1')]=function(_0xdfbc79,_0x1e6481,_0xa3321f,_0x14918c,_0x22d7bc,_0x56a13f,_0x16063f){return polly(_0xdfbc79,_0x1e6481,_0xa3321f,_0x14918c,_0x22d7bc,_0x56a13f,_0x16063f);}; \ 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 c48961e..cc51199 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 _0xd805=['writeFile','Invalid\x20data\x20response\x20from\x20aws\x20Polly!','No\x20data\x20response\x20from\x20aws\x20Polly!','Polly','mp3','path','bluebird','randomstring','aws-sdk','AudioStream'];(function(_0x286e63,_0x90bf8f){var _0x4535eb=function(_0x1d71b4){while(--_0x1d71b4){_0x286e63['push'](_0x286e63['shift']());}};_0x4535eb(++_0x90bf8f);}(_0xd805,0x16d));var _0x5d80=function(_0x4853fc,_0x52cd55){_0x4853fc=_0x4853fc-0x0;var _0x23be73=_0xd805[_0x4853fc];return _0x23be73;};'use strict';var fs=require('fs');var path=require(_0x5d80('0x0'));var BPromise=require(_0x5d80('0x1'));var rs=require(_0x5d80('0x2'));var AWS=require(_0x5d80('0x3'));function pollyResult(_0x142d23,_0x19217,_0x50c7db){return new BPromise(function(_0x22d76c,_0x413e6e){_0x142d23['synthesizeSpeech'](_0x19217,function(_0x1c3b5c,_0x153d4a){if(_0x1c3b5c){_0x413e6e(_0x1c3b5c);}else if(_0x153d4a){if(_0x153d4a[_0x5d80('0x4')]instanceof Buffer){fs[_0x5d80('0x5')](_0x50c7db,_0x153d4a[_0x5d80('0x4')],function(_0x4cbfff){if(_0x4cbfff){_0x413e6e(_0x4cbfff);}else{_0x22d76c();}});}else{_0x413e6e(new Error(_0x5d80('0x6')));}}else{_0x413e6e(new Error(_0x5d80('0x7')));}});});}module['exports']=function(_0x56cae8,_0x279c71,_0x4cf2ba,_0x17e2df,_0x1699b1,_0x4742cf,_0x387f36){var _0x1cb4b5=new AWS[(_0x5d80('0x8'))]({'accessKeyId':_0x56cae8,'secretAccessKey':_0x279c71,'region':_0x4cf2ba});var _0x3fbe66={'Text':_0x1699b1,'TextType':_0x4742cf||'text','OutputFormat':_0x5d80('0x9'),'VoiceId':_0x17e2df};return pollyResult(_0x1cb4b5,_0x3fbe66,_0x387f36);}; \ No newline at end of file +var _0x456c=['synthesizeSpeech','AudioStream','Invalid\x20data\x20response\x20from\x20aws\x20Polly!','No\x20data\x20response\x20from\x20aws\x20Polly!','exports','Polly','text','path','bluebird','randomstring','aws-sdk'];(function(_0x5d030b,_0x3638f1){var _0x3036b6=function(_0x11e4ed){while(--_0x11e4ed){_0x5d030b['push'](_0x5d030b['shift']());}};_0x3036b6(++_0x3638f1);}(_0x456c,0xf9));var _0xc456=function(_0x2d926d,_0x106492){_0x2d926d=_0x2d926d-0x0;var _0x2aa16c=_0x456c[_0x2d926d];return _0x2aa16c;};'use strict';var fs=require('fs');var path=require(_0xc456('0x0'));var BPromise=require(_0xc456('0x1'));var rs=require(_0xc456('0x2'));var AWS=require(_0xc456('0x3'));function pollyResult(_0x4f4cdc,_0x222f6c,_0x5b9e59){return new BPromise(function(_0x213adb,_0xafcaa4){_0x4f4cdc[_0xc456('0x4')](_0x222f6c,function(_0x72aea0,_0x23616b){if(_0x72aea0){_0xafcaa4(_0x72aea0);}else if(_0x23616b){if(_0x23616b[_0xc456('0x5')]instanceof Buffer){fs['writeFile'](_0x5b9e59,_0x23616b[_0xc456('0x5')],function(_0x2ae482){if(_0x2ae482){_0xafcaa4(_0x2ae482);}else{_0x213adb();}});}else{_0xafcaa4(new Error(_0xc456('0x6')));}}else{_0xafcaa4(new Error(_0xc456('0x7')));}});});}module[_0xc456('0x8')]=function(_0x1d77b0,_0x409242,_0x27eb70,_0x480d3b,_0x3104d8,_0x4ff962,_0x128124){var _0x1088bf=new AWS[(_0xc456('0x9'))]({'accessKeyId':_0x1d77b0,'secretAccessKey':_0x409242,'region':_0x27eb70});var _0x2eaa23={'Text':_0x3104d8,'TextType':_0x4ff962||_0xc456('0xa'),'OutputFormat':'mp3','VoiceId':_0x480d3b};return pollyResult(_0x1088bf,_0x2eaa23,_0x128124);}; \ 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 d9969be..1591954 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 _0x7d99=['./lib/api','exports'];(function(_0x3b7874,_0x5aed14){var _0xcb1ba8=function(_0x3f1ef6){while(--_0x3f1ef6){_0x3b7874['push'](_0x3b7874['shift']());}};_0xcb1ba8(++_0x5aed14);}(_0x7d99,0x138));var _0x97d9=function(_0x162a9b,_0x335d87){_0x162a9b=_0x162a9b-0x0;var _0x3623db=_0x7d99[_0x162a9b];return _0x3623db;};'use strict';var asr=require(_0x97d9('0x0'));module[_0x97d9('0x1')]=function(_0x4e888c,_0x20705a,_0x55f6cd,_0x172f84){return asr(_0x4e888c,_0x20705a,_0x55f6cd);}; \ No newline at end of file +var _0x119a=['./lib/api','exports'];(function(_0x407399,_0x28a31f){var _0x5e9ae9=function(_0x3cb0a1){while(--_0x3cb0a1){_0x407399['push'](_0x407399['shift']());}};_0x5e9ae9(++_0x28a31f);}(_0x119a,0x196));var _0xa119=function(_0x2d5ecf,_0xa1fb31){_0x2d5ecf=_0x2d5ecf-0x0;var _0x488a6a=_0x119a[_0x2d5ecf];return _0x488a6a;};'use strict';var asr=require(_0xa119('0x0'));module[_0xa119('0x1')]=function(_0x2082ba,_0x3ae6ca,_0x59c772,_0x2addef){return asr(_0x2082ba,_0x3ae6ca,_0x59c772);}; \ 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 47858d6..a041b95 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 _0xc36d=['bluebird','https://speech.googleapis.com','exports','string','length','filepath\x20should\x20be\x20a\x20string','undefined','lang\x20should\x20be\x20a\x20string','toString','base64','POST','/v1/speech:recognize?key=','LINEAR16','url'];(function(_0x3fc53b,_0x4c95a3){var _0x35c204=function(_0x4a8749){while(--_0x4a8749){_0x3fc53b['push'](_0x3fc53b['shift']());}};_0x35c204(++_0x4c95a3);}(_0xc36d,0x7d));var _0xdc36=function(_0x2c3a88,_0x48637e){_0x2c3a88=_0x2c3a88-0x0;var _0x4a7925=_0xc36d[_0x2c3a88];return _0x4a7925;};'use strict';var url=require(_0xdc36('0x0'));var BPromise=require(_0xdc36('0x1'));var fs=require('fs');var host=_0xdc36('0x2');module[_0xdc36('0x3')]=function(_0x471240,_0x2d5df5,_0x4c42dd){return new BPromise(function(_0x42522b,_0x3431f9){var _0x53ac17;if(typeof _0x471240!==_0xdc36('0x4')||_0x471240[_0xdc36('0x5')]===0x0){return _0x3431f9(_0xdc36('0x6'));}if(typeof _0x2d5df5!==_0xdc36('0x4')||_0x2d5df5[_0xdc36('0x5')]===0x0){return _0x3431f9('key\x20should\x20be\x20a\x20string');}if(typeof _0x4c42dd!==_0xdc36('0x7')&&(typeof _0x4c42dd!==_0xdc36('0x4')||_0x4c42dd[_0xdc36('0x5')]===0x0)){return _0x3431f9(_0xdc36('0x8'));}try{_0x53ac17=fs['readFileSync'](_0x471240)[_0xdc36('0x9')](_0xdc36('0xa'));}catch(_0x573f8e){return _0x3431f9(_0x573f8e);}return _0x42522b({'method':_0xdc36('0xb'),'uri':host+_0xdc36('0xc')+_0x2d5df5,'body':{'config':{'encoding':_0xdc36('0xd'),'sampleRateHertz':'8000','languageCode':_0x4c42dd},'audio':{'content':_0x53ac17}},'json':!![]});});}; \ No newline at end of file +var _0x0f9f=['readFileSync','toString','POST','/v1/speech:recognize?key=','bluebird','https://speech.googleapis.com','exports','string','length','filepath\x20should\x20be\x20a\x20string','undefined','lang\x20should\x20be\x20a\x20string'];(function(_0x3bdd36,_0x139fe0){var _0x4c3089=function(_0x3f6dcb){while(--_0x3f6dcb){_0x3bdd36['push'](_0x3bdd36['shift']());}};_0x4c3089(++_0x139fe0);}(_0x0f9f,0x1cc));var _0xf0f9=function(_0x2acd0f,_0x3ac736){_0x2acd0f=_0x2acd0f-0x0;var _0x434b3e=_0x0f9f[_0x2acd0f];return _0x434b3e;};'use strict';var url=require('url');var BPromise=require(_0xf0f9('0x0'));var fs=require('fs');var host=_0xf0f9('0x1');module[_0xf0f9('0x2')]=function(_0x48fa0e,_0x5cf55e,_0x45cc98){return new BPromise(function(_0x257b44,_0x17eab4){var _0x2f8d38;if(typeof _0x48fa0e!==_0xf0f9('0x3')||_0x48fa0e[_0xf0f9('0x4')]===0x0){return _0x17eab4(_0xf0f9('0x5'));}if(typeof _0x5cf55e!==_0xf0f9('0x3')||_0x5cf55e[_0xf0f9('0x4')]===0x0){return _0x17eab4('key\x20should\x20be\x20a\x20string');}if(typeof _0x45cc98!==_0xf0f9('0x6')&&(typeof _0x45cc98!==_0xf0f9('0x3')||_0x45cc98['length']===0x0)){return _0x17eab4(_0xf0f9('0x7'));}try{_0x2f8d38=fs[_0xf0f9('0x8')](_0x48fa0e)[_0xf0f9('0x9')]('base64');}catch(_0x196f21){return _0x17eab4(_0x196f21);}return _0x257b44({'method':_0xf0f9('0xa'),'uri':host+_0xf0f9('0xb')+_0x5cf55e,'body':{'config':{'encoding':'LINEAR16','sampleRateHertz':'8000','languageCode':_0x45cc98},'audio':{'content':_0x2f8d38}},'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 36206de..48a8901 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 _0xbd9b=['./asr'];(function(_0x8a2dae,_0x2a21a7){var _0x308f20=function(_0x701c92){while(--_0x701c92){_0x8a2dae['push'](_0x8a2dae['shift']());}};_0x308f20(++_0x2a21a7);}(_0xbd9b,0x67));var _0xbbd9=function(_0x598bb1,_0x41c397){_0x598bb1=_0x598bb1-0x0;var _0x5c00a1=_0xbd9b[_0x598bb1];return _0x5c00a1;};var asr=require(_0xbbd9('0x0'));module['exports']={'asr':asr}; \ No newline at end of file +var _0xb2b7=['./asr'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xb2b7,0x1b3));var _0x7b2b=function(_0x517d0a,_0x1b35c4){_0x517d0a=_0x517d0a-0x0;var _0x3c949d=_0xb2b7[_0x517d0a];return _0x3c949d;};var asr=require(_0x7b2b('0x0'));module['exports']={'asr':asr}; \ No newline at end of file diff --git a/server/services/agi/scripts/index.js b/server/services/agi/scripts/index.js index 7982c8f..ad3f0d2 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 _0xec01=['querystring','request-promise','randomstring','sox','parse','util','./aws','./google','./sestek','../../../config/logger','agi','https://api.ispeech.org/api/rest','protocol','https:','host','WHAT_EVER','get','request\x20to\x20','\x20failed,\x20status\x20code\x20=\x20','statusCode','statusMessage','createWriteStream','finish','info','finish\x20download\x20file','error','unlink','pipe','end','data','transcode','error\x20convert','finish\x20to\x20convert','start','resolve','tmp','generate','.wav','then','chmodSync','777','split','toString','base64','https://texttospeech.googleapis.com/v1/','ssml','input','voice','audioConfig','MP3','text:synthesize','POST','writeFile','googleCloudTTS\x20path','googleTTS','https://translate.google.com/_/TranslateWebserverUi/data/batchexecute','utf8','application/x-www-form-urlencoded','stringify','null','slice','parse\x20response\x20failed:\x0a','length','text\x20length\x20limit\x20reached','\x22\x20might\x20not\x20exist','.mp3','writeFileSync','goggleTTS\x20path','asr','results','alternatives','transcript','join','map','googleASR\x20transcription','catch','name','message','googleDialogflow','textRequest','source','result','resolvedQuery','actionIncomplete','fulfillment','speech','score','status','metadata','endConversation','sessionPath','Dialogflow\x20V2\x20response:','action','queryResult','diagnosticInfo','fields','end_conversation','boolValue','fulfillmentText','intent','languageCode','responseId','tildeASR','Tilde\x20ASR\x20transcription','Tilde\x20ASR\x20confidence','awsPolly','polly','awsLex','ispeechTTS','format','%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3','model=%s','freeform=3','nda','text','channelData','CustomAction','CustomActionData','AudioFromTts','Data','audiofile','apiai-promise','bluebird','dialogflow','http','https','path'];(function(_0x20ef64,_0x4a8fe9){var _0x3707d8=function(_0x5b9a88){while(--_0x5b9a88){_0x20ef64['push'](_0x20ef64['shift']());}};_0x3707d8(++_0x4a8fe9);}(_0xec01,0x79));var _0x1ec0=function(_0x2f76ea,_0xd08471){_0x2f76ea=_0x2f76ea-0x0;var _0x515879=_0xec01[_0x2f76ea];return _0x515879;};'use strict';var apiai=require(_0x1ec0('0x0'));var BPromise=require(_0x1ec0('0x1'));var dialogflow=require(_0x1ec0('0x2'));var fs=require('fs');var http=require(_0x1ec0('0x3'));var https=require(_0x1ec0('0x4'));var md5=require('md5');var path=require(_0x1ec0('0x5'));var querystring=require(_0x1ec0('0x6'));var rp=require(_0x1ec0('0x7'));var rs=require(_0x1ec0('0x8'));var sox=require(_0x1ec0('0x9'));var tts=require('google-tts-api');var urlParse=require('url')[_0x1ec0('0xa')];var util=require(_0x1ec0('0xb'));var aws=require(_0x1ec0('0xc'));var google=require(_0x1ec0('0xd'));var sestek=require(_0x1ec0('0xe'));var tilde=require('./tilde');var logger=require(_0x1ec0('0xf'))(_0x1ec0('0x10'));var ISPEECH_API=_0x1ec0('0x11');function downloadFile(_0x4ca034,_0x1a81e0){return new BPromise(function(_0x12a541,_0x2095bc){var _0x4822fb=urlParse(_0x4ca034);var _0x20cae8=_0x4822fb[_0x1ec0('0x12')]===_0x1ec0('0x13')?https:http;var _0x53ee24={'host':_0x4822fb[_0x1ec0('0x14')],'path':_0x4822fb[_0x1ec0('0x5')],'headers':{'user-agent':_0x1ec0('0x15')}};_0x20cae8[_0x1ec0('0x16')](_0x53ee24,function(_0x1e2285){if(_0x1e2285['statusCode']!==0xc8){logger['error'](_0x1ec0('0x17')+_0x4ca034+_0x1ec0('0x18')+_0x1e2285[_0x1ec0('0x19')]+'\x20('+_0x1e2285[_0x1ec0('0x1a')]+')');_0x2095bc(new Error(_0x1ec0('0x17')+_0x4ca034+'\x20failed,\x20status\x20code\x20=\x20'+_0x1e2285['statusCode']+'\x20('+_0x1e2285[_0x1ec0('0x1a')]+')'));return;}var _0x48c88b=fs[_0x1ec0('0x1b')](_0x1a81e0);_0x48c88b['on'](_0x1ec0('0x1c'),function(){logger[_0x1ec0('0x1d')](_0x1ec0('0x1e'));_0x48c88b['close'](_0x12a541);});_0x48c88b['on'](_0x1ec0('0x1f'),function(_0x35fce4){fs[_0x1ec0('0x20')](_0x1a81e0);logger[_0x1ec0('0x1f')]('download\x20error',_0x35fce4);_0x2095bc(_0x35fce4);});_0x1e2285[_0x1ec0('0x21')](_0x48c88b);})['on'](_0x1ec0('0x1f'),function(_0x2e8e96){logger['error'](_0x2e8e96);_0x2095bc(_0x2e8e96);})[_0x1ec0('0x22')]();});}function uploadFile(_0x48b624){return new BPromise(function(_0x17823a,_0x20e6c9){var _0x140d6=urlParse(_0x48b624);var _0x53219b=_0x140d6[_0x1ec0('0x12')]===_0x1ec0('0x13')?https:http;var _0x4f01f8={'host':_0x140d6['host'],'path':_0x140d6[_0x1ec0('0x5')],'headers':{'user-agent':_0x1ec0('0x15')}};_0x53219b[_0x1ec0('0x16')](_0x4f01f8,function(_0x2ebc9b){if(_0x2ebc9b[_0x1ec0('0x19')]!==0xc8){_0x20e6c9(new Error(_0x1ec0('0x17')+_0x48b624+_0x1ec0('0x18')+_0x2ebc9b[_0x1ec0('0x19')]+'\x20('+_0x2ebc9b['statusMessage']+')'));return;}var _0xf20cb2='';_0x2ebc9b['on'](_0x1ec0('0x23'),function(_0x108fce){_0xf20cb2+=_0x108fce;});_0x2ebc9b['on'](_0x1ec0('0x22'),function(){_0x17823a(_0xf20cb2);});})['on']('error',function(_0x1f62bc){_0x20e6c9(_0x1f62bc);})['end']();});}function convertFile(_0x24d109,_0x39b989){return new BPromise(function(_0x1b16d9,_0x505459){var _0x547e1b=sox[_0x1ec0('0x24')](_0x24d109,_0x39b989,{'sampleRate':0x1f40,'format':'wav','channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x547e1b['on'](_0x1ec0('0x1f'),function(_0x1897f5){logger[_0x1ec0('0x1f')](_0x1ec0('0x25'),_0x1897f5);_0x505459(_0x1897f5);});_0x547e1b['on']('end',function(){logger[_0x1ec0('0x1d')](_0x1ec0('0x26'));_0x1b16d9();});_0x547e1b[_0x1ec0('0x27')]();});}function base64Decode(_0x216bae,_0x2a30c8){var _0x1af9c4=path[_0x1ec0('0x28')](__dirname,_0x1ec0('0x29'),rs[_0x1ec0('0x2a')](0x4)+_0x1ec0('0x2b'));fs['writeFileSync'](_0x1af9c4,_0x216bae,'base64');return convertFile(_0x1af9c4,_0x2a30c8)[_0x1ec0('0x2c')](function(){try{fs['unlink'](_0x1af9c4);fs[_0x1ec0('0x2d')](_0x2a30c8,_0x1ec0('0x2e'));}catch(_0x2baed1){logger[_0x1ec0('0x1f')](_0x2baed1);}return _0x2a30c8[_0x1ec0('0x2f')]('.')[0x0];});}function base64Encode(_0x238c66){var _0x264be4=fs['readFileSync'](_0x238c66);return new Buffer(_0x264be4)[_0x1ec0('0x30')](_0x1ec0('0x31'));}exports['googleCloudTTS']=function(_0x59e6b1,_0x3d1554,_0x2818f4,_0x53546e,_0x2fa42e,_0x479e12){var _0x5d6a25,_0x1b756c;var _0x44f39e=_0x1ec0('0x32');var _0x3fa11f='?key='+_0x59e6b1;var _0x331c90={};if(_0x3d1554===_0x1ec0('0x33')){_0x331c90[_0x1ec0('0x34')]={'ssml':_0x2818f4};}else{_0x331c90[_0x1ec0('0x34')]={'text':_0x2818f4};};_0x331c90[_0x1ec0('0x35')]={'languageCode':_0x53546e,'ssmlGender':_0x2fa42e};_0x331c90[_0x1ec0('0x36')]={'audioEncoding':_0x1ec0('0x37'),'sampleRateHertz':0x1f40};var _0x450268={'url':_0x44f39e+_0x1ec0('0x38')+_0x3fa11f,'method':_0x1ec0('0x39'),'json':!![],'body':_0x331c90};return rp(_0x450268)[_0x1ec0('0x2c')](function(_0x2f5986){return new BPromise(function(_0x92e49e,_0x1dbfa4){_0x5d6a25=path[_0x1ec0('0x28')](__dirname,_0x1ec0('0x29'),rs[_0x1ec0('0x2a')](0x4)+'.mp3');var _0x37cb4c=Buffer['from'](_0x2f5986['audioContent'],_0x1ec0('0x31'));return fs[_0x1ec0('0x3a')](_0x5d6a25,_0x37cb4c,function(_0x30b150){_0x1dbfa4(_0x30b150);},function(_0xb464a4){fs[_0x1ec0('0x2d')](_0x5d6a25,_0x1ec0('0x2e'));_0x92e49e(_0xb464a4);});});})[_0x1ec0('0x2c')](function(_0x5f59a6){_0x1b756c=path[_0x1ec0('0x28')](__dirname,_0x1ec0('0x29'),rs[_0x1ec0('0x2a')](0x4)+_0x1ec0('0x2b'));return convertFile(_0x5d6a25,_0x1b756c);})[_0x1ec0('0x2c')](function(){try{fs['unlink'](_0x5d6a25);fs[_0x1ec0('0x2d')](_0x1b756c,_0x1ec0('0x2e'));}catch(_0x586d02){logger[_0x1ec0('0x1f')](_0x586d02);}logger['info'](_0x1ec0('0x3b'),_0x1b756c[_0x1ec0('0x2f')]('.')[0x0]);return _0x1b756c[_0x1ec0('0x2f')]('.')[0x0];});};exports[_0x1ec0('0x3c')]=function(_0x2c2572,_0x12054d){var _0x580c02=_0x1ec0('0x3d');var _0x1749f0,_0x27f815;var _0x288c16;var _0x5c3865={'encoding':_0x1ec0('0x3e'),'method':_0x1ec0('0x39'),'timeout':0x2710,'url':_0x580c02,'headers':{'Content-Type':_0x1ec0('0x3f')},'body':'f.req='+encodeURIComponent(JSON[_0x1ec0('0x40')]([[['jQ1olc',JSON[_0x1ec0('0x40')]([_0x2c2572,_0x12054d||'en',![],_0x1ec0('0x41')]),null,'generic']]]))};return rp(_0x5c3865)[_0x1ec0('0x2c')](function(_0x26f81c){try{_0x288c16=eval(_0x26f81c[_0x1ec0('0x42')](0x5))[0x0][0x2];}catch(_0x4e77c3){throw new Error(_0x1ec0('0x43')+_0x26f81c['data']);}if(!_0x288c16){if(_0x2c2572[_0x1ec0('0x44')]>0xc8){throw new Error(_0x1ec0('0x45'));}else{throw new Error('lang\x20\x22'+_0x12054d+_0x1ec0('0x46'));}}try{_0x288c16=eval(_0x288c16)[0x0];}catch(_0x209624){throw new Error(_0x1ec0('0x43')+res['data']);}const _0x6f4554=_0x288c16;_0x1749f0=path[_0x1ec0('0x28')](__dirname,_0x1ec0('0x29'),rs[_0x1ec0('0x2a')](0x4)+_0x1ec0('0x47'));fs[_0x1ec0('0x48')](_0x1749f0,_0x288c16,{'encoding':_0x1ec0('0x31')});_0x27f815=path[_0x1ec0('0x28')](__dirname,'tmp',rs[_0x1ec0('0x2a')](0x4)+_0x1ec0('0x2b'));return convertFile(_0x1749f0,_0x27f815);})[_0x1ec0('0x2c')](function(){try{fs[_0x1ec0('0x20')](_0x1749f0);fs[_0x1ec0('0x2d')](_0x27f815,_0x1ec0('0x2e'));}catch(_0x596ac2){logger[_0x1ec0('0x1f')](_0x596ac2);}logger[_0x1ec0('0x1d')](_0x1ec0('0x49'),_0x27f815[_0x1ec0('0x2f')]('.')[0x0]);return _0x27f815[_0x1ec0('0x2f')]('.')[0x0];});};exports['googleASR']=function(_0x1fdcbd,_0x557c2e,_0x50bcf3){return google[_0x1ec0('0x4a')](_0x1fdcbd,_0x557c2e,_0x50bcf3)[_0x1ec0('0x2c')](function(_0x14bf1b){logger['info'](_0x14bf1b['uri']);return rp(_0x14bf1b);})[_0x1ec0('0x2c')](function(_0x1baaa6){var _0x31be02='';var _0x2e6ca0=0x0;try{fs[_0x1ec0('0x20')](_0x1fdcbd);}catch(_0x28a9db){logger['error'](_0x28a9db);}if(_0x1baaa6&&_0x1baaa6[_0x1ec0('0x4b')]){_0x31be02=_0x1baaa6[_0x1ec0('0x4b')]['map'](function(_0x492c21){return _0x492c21&&_0x492c21[_0x1ec0('0x4c')][0x0]&&_0x492c21[_0x1ec0('0x4c')][0x0][_0x1ec0('0x4d')]?_0x492c21[_0x1ec0('0x4c')][0x0][_0x1ec0('0x4d')]:'';})[_0x1ec0('0x4e')]('\x0a');_0x2e6ca0=_0x1baaa6[_0x1ec0('0x4b')][_0x1ec0('0x4f')](function(_0x4b4c60){return _0x4b4c60&&_0x4b4c60['alternatives'][0x0]&&_0x4b4c60['alternatives'][0x0]['confidence']?_0x4b4c60[_0x1ec0('0x4c')][0x0]['confidence']:0x0;})[_0x1ec0('0x4e')]('\x0a');}logger[_0x1ec0('0x1d')](_0x1ec0('0x50'),_0x31be02);logger[_0x1ec0('0x1d')]('googleASR\x20confidence',_0x2e6ca0);return{'transcript':_0x31be02,'confidence':_0x2e6ca0};})[_0x1ec0('0x51')](function(_0x1d4004){logger['error']('[%s]\x20%s:%s',_0x1d4004['statusCode'],_0x1d4004[_0x1ec0('0x52')],_0x1d4004[_0x1ec0('0x53')]);});};exports[_0x1ec0('0x54')]=function(_0xeb2eaf,_0xe0e040,_0x171e75,_0x4614d3){var _0x52fe9e=apiai(_0xe0e040,{'language':_0x4614d3||'en'});return _0x52fe9e[_0x1ec0('0x55')](_0x171e75,{'sessionId':md5(_0xeb2eaf)})['then'](function(_0x197b77){logger['info'](JSON[_0x1ec0('0x40')](_0x197b77));return{'source':_0x197b77['result'][_0x1ec0('0x56')],'resolvedQuery':_0x197b77[_0x1ec0('0x57')][_0x1ec0('0x58')],'action':_0x197b77['result']['action'],'actionIncomplete':_0x197b77[_0x1ec0('0x57')][_0x1ec0('0x59')],'speech':_0x197b77[_0x1ec0('0x57')][_0x1ec0('0x5a')][_0x1ec0('0x5b')],'score':_0x197b77['result'][_0x1ec0('0x5c')],'statusCode':_0x197b77[_0x1ec0('0x5d')]['code'],'endConversation':_0x197b77[_0x1ec0('0x57')][_0x1ec0('0x5e')][_0x1ec0('0x5f')]||![],'isFallbackIntent':_0x197b77[_0x1ec0('0x57')][_0x1ec0('0x5e')]['isFallbackIntent']};});};exports['googleDialogflowV2']=function(_0x1d6cd4,_0x5b796e,_0x80234a,_0xfe4204,_0x3834b6,_0x4e59e0){var _0x355cff=_0xfe4204['replace'](/\\n/g,'\x0a');var _0x36a039={'credentials':{'private_key':_0x355cff,'client_email':_0x80234a}};var _0x83c79a=new dialogflow['SessionsClient'](_0x36a039);var _0x22edca=_0x83c79a[_0x1ec0('0x60')](_0x5b796e,md5(_0x1d6cd4));var _0x8fb216={'session':_0x22edca,'queryInput':{'text':{'text':_0x3834b6,'languageCode':_0x4e59e0}}};return _0x83c79a['detectIntent'](_0x8fb216)[_0x1ec0('0x2c')](function(_0x15b33e){if(_0x15b33e&&_0x15b33e[_0x1ec0('0x44')]){logger['info'](_0x1ec0('0x61'),JSON[_0x1ec0('0x40')](_0x15b33e));var _0x4fa6b7=_0x15b33e[0x0];if(_0x4fa6b7){var _0x234174={'action':_0x4fa6b7['queryResult'][_0x1ec0('0x62')],'allRequiredParamsPresent':_0x4fa6b7['queryResult']['allRequiredParamsPresent'],'endConversation':_0x4fa6b7[_0x1ec0('0x63')][_0x1ec0('0x64')]&&_0x4fa6b7[_0x1ec0('0x63')][_0x1ec0('0x64')]['fields']?_0x4fa6b7[_0x1ec0('0x63')][_0x1ec0('0x64')][_0x1ec0('0x65')][_0x1ec0('0x66')][_0x1ec0('0x67')]:![],'fulfillmentText':_0x4fa6b7[_0x1ec0('0x63')][_0x1ec0('0x68')],'intentName':_0x4fa6b7[_0x1ec0('0x63')]['intent'][_0x1ec0('0x52')],'intentDisplayName':_0x4fa6b7[_0x1ec0('0x63')][_0x1ec0('0x69')]['displayName'],'isFallbackIntent':_0x4fa6b7['queryResult'][_0x1ec0('0x69')]['isFallback'],'languageCode':_0x4fa6b7[_0x1ec0('0x63')][_0x1ec0('0x6a')],'queryText':_0x4fa6b7['queryResult']['queryText'],'responseId':_0x4fa6b7[_0x1ec0('0x6b')],'score':_0x4fa6b7[_0x1ec0('0x63')]['intentDetectionConfidence'],'speech':_0x4fa6b7[_0x1ec0('0x63')][_0x1ec0('0x68')],'providerResponse':JSON['stringify'](_0x15b33e)};return _0x234174;}}});};exports[_0x1ec0('0x6c')]=function(_0x2a792d,_0xaca625,_0x254ac7,_0x1924ed){return tilde[_0x1ec0('0x4a')](_0x2a792d,_0xaca625,_0x254ac7,_0x1924ed)['then'](function(_0x2f8292){try{fs[_0x1ec0('0x20')](_0x2a792d);}catch(_0x488474){logger[_0x1ec0('0x1f')](_0x488474);}logger['info'](_0x1ec0('0x6d'),_0x2f8292[_0x1ec0('0x4d')]);logger[_0x1ec0('0x1d')](_0x1ec0('0x6e'),_0x2f8292['confidence']);return _0x2f8292;});};exports[_0x1ec0('0x6f')]=function(_0x328f42,_0x4bae05,_0x173248,_0x3b9bdc,_0x4fdfdd,_0x1abdaf){var _0x15c4a6=path[_0x1ec0('0x28')](__dirname,_0x1ec0('0x29'),rs[_0x1ec0('0x2a')](0x4)+_0x1ec0('0x47'));var _0x47aa07;return aws[_0x1ec0('0x70')](_0x328f42,_0x4bae05,_0x173248,_0x3b9bdc,_0x4fdfdd,_0x1abdaf,_0x15c4a6)[_0x1ec0('0x2c')](function(){_0x47aa07=path[_0x1ec0('0x28')](__dirname,_0x1ec0('0x29'),rs[_0x1ec0('0x2a')](0x4)+_0x1ec0('0x2b'));return convertFile(_0x15c4a6,_0x47aa07);})[_0x1ec0('0x2c')](function(){try{fs[_0x1ec0('0x20')](_0x15c4a6);fs[_0x1ec0('0x2d')](_0x47aa07,_0x1ec0('0x2e'));}catch(_0x7124dd){logger[_0x1ec0('0x1f')](_0x7124dd);}return _0x47aa07['split']('.')[0x0];});};exports[_0x1ec0('0x71')]=function(_0x3035a4,_0x2d6d1e,_0x166b73,_0x1cad74,_0xea5a74,_0x2f2298){return aws['lex'](_0x3035a4,_0x2d6d1e,_0x166b73,_0x1cad74,_0xea5a74,_0x2f2298)[_0x1ec0('0x2c')](function(_0x3970d2){logger[_0x1ec0('0x1d')](JSON[_0x1ec0('0x40')](_0x3970d2));return _0x3970d2;});};exports[_0x1ec0('0x72')]=function(_0x3cf196,_0x2fe5b2,_0x18465b,_0x1815d0){var _0x39bd08=util[_0x1ec0('0x73')](_0x1ec0('0x74'),ISPEECH_API,_0x3cf196,encodeURIComponent(_0x2fe5b2),_0x18465b,_0x1815d0);var _0x41f90e=path[_0x1ec0('0x28')](__dirname,_0x1ec0('0x29'),rs[_0x1ec0('0x2a')](0x4)+_0x1ec0('0x47'));var _0x1e881a;return downloadFile(_0x39bd08,_0x41f90e)[_0x1ec0('0x2c')](function(){_0x1e881a=path[_0x1ec0('0x28')](__dirname,_0x1ec0('0x29'),rs['generate'](0x4)+_0x1ec0('0x2b'));return convertFile(_0x41f90e,_0x1e881a);})[_0x1ec0('0x2c')](function(){try{fs[_0x1ec0('0x20')](_0x41f90e);fs[_0x1ec0('0x2d')](_0x1e881a,_0x1ec0('0x2e'));}catch(_0x51b157){logger[_0x1ec0('0x1f')](_0x51b157);}return _0x1e881a[_0x1ec0('0x2f')]('.')[0x0];});};exports['ispeechASR']=function(_0x55c2e1,_0x48e209,_0x3aa0af,_0x753a85){var _0x2b5214=util[_0x1ec0('0x73')]('%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s',ISPEECH_API,_0x48e209,_0x3aa0af,base64Encode(_0x55c2e1),_0x753a85?util[_0x1ec0('0x73')](_0x1ec0('0x75'),encodeURIComponent(_0x753a85)):_0x1ec0('0x76'));return uploadFile(_0x2b5214)[_0x1ec0('0x2c')](function(_0x1345b5){return querystring[_0x1ec0('0xa')](_0x1345b5);});};exports['sestekNDA']=function(_0x101829,_0x4712dc){return sestek[_0x1ec0('0x77')](_0x101829,_0x4712dc)['then'](function(_0x196640){logger['info'](JSON[_0x1ec0('0x40')](_0x196640));var _0xf9c197={'speech':_0x196640[_0x1ec0('0x78')],'action':_0x196640[_0x1ec0('0x79')]?_0x196640[_0x1ec0('0x79')][_0x1ec0('0x7a')]:undefined,'actiondata':_0x196640[_0x1ec0('0x79')]?_0x196640[_0x1ec0('0x79')][_0x1ec0('0x7b')]:undefined};if(_0x196640[_0x1ec0('0x79')]&&_0x196640['channelData'][_0x1ec0('0x7c')]){return base64Decode(_0x196640[_0x1ec0('0x79')][_0x1ec0('0x7c')][_0x1ec0('0x7d')],path[_0x1ec0('0x28')](__dirname,'tmp',rs[_0x1ec0('0x2a')](0x4)+'.wav'))[_0x1ec0('0x2c')](function(_0x42c2c0){_0xf9c197[_0x1ec0('0x7e')]=_0x42c2c0;return _0xf9c197;});}return _0xf9c197;});};exports['dirName']=function(){return __dirname;}; \ No newline at end of file +var _0x3131=['intentDetectionConfidence','Tilde\x20ASR\x20transcription','Tilde\x20ASR\x20confidence','awsPolly','polly','lex','%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3','format','%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s','model=%s','sestekNDA','nda','text','channelData','AudioFromTts','Data','audiofile','dirName','apiai-promise','bluebird','http','https','md5','path','querystring','sox','url','parse','util','./aws','./google','./sestek','../../../config/logger','agi','protocol','host','get','statusCode','error','request\x20to\x20','statusMessage','createWriteStream','finish','info','unlink','pipe','end','WHAT_EVER','\x20failed,\x20status\x20code\x20=\x20','data','transcode','wav','error\x20convert','resolve','tmp','.wav','writeFileSync','base64','then','777','split','toString','googleCloudTTS','https://texttospeech.googleapis.com/v1/','?key=','ssml','input','voice','audioConfig','MP3','text:synthesize','POST','generate','from','audioContent','writeFile','chmodSync','googleCloudTTS\x20path','googleTTS','https://translate.google.com/_/TranslateWebserverUi/data/batchexecute','utf8','application/x-www-form-urlencoded','f.req=','stringify','jQ1olc','null','generic','slice','length','text\x20length\x20limit\x20reached','parse\x20response\x20failed:\x0a','.mp3','goggleTTS\x20path','googleASR','asr','uri','results','alternatives','transcript','join','confidence','googleASR\x20transcription','googleASR\x20confidence','catch','[%s]\x20%s:%s','name','message','googleDialogflow','textRequest','result','source','action','fulfillment','score','status','code','metadata','endConversation','isFallbackIntent','googleDialogflowV2','replace','sessionPath','detectIntent','Dialogflow\x20V2\x20response:','allRequiredParamsPresent','queryResult','diagnosticInfo','fields','boolValue','fulfillmentText','intent','displayName','languageCode','queryText','responseId'];(function(_0x2235b1,_0x1cf222){var _0x5e8411=function(_0x19ba1b){while(--_0x19ba1b){_0x2235b1['push'](_0x2235b1['shift']());}};_0x5e8411(++_0x1cf222);}(_0x3131,0x99));var _0x1313=function(_0x3773b5,_0x400b3f){_0x3773b5=_0x3773b5-0x0;var _0x3ade1d=_0x3131[_0x3773b5];return _0x3ade1d;};'use strict';var apiai=require(_0x1313('0x0'));var BPromise=require(_0x1313('0x1'));var dialogflow=require('dialogflow');var fs=require('fs');var http=require(_0x1313('0x2'));var https=require(_0x1313('0x3'));var md5=require(_0x1313('0x4'));var path=require(_0x1313('0x5'));var querystring=require(_0x1313('0x6'));var rp=require('request-promise');var rs=require('randomstring');var sox=require(_0x1313('0x7'));var tts=require('google-tts-api');var urlParse=require(_0x1313('0x8'))[_0x1313('0x9')];var util=require(_0x1313('0xa'));var aws=require(_0x1313('0xb'));var google=require(_0x1313('0xc'));var sestek=require(_0x1313('0xd'));var tilde=require('./tilde');var logger=require(_0x1313('0xe'))(_0x1313('0xf'));var ISPEECH_API='https://api.ispeech.org/api/rest';function downloadFile(_0x1660ab,_0x40f9cb){return new BPromise(function(_0xe7e6d2,_0x86f6f6){var _0x481c04=urlParse(_0x1660ab);var _0x4feffd=_0x481c04[_0x1313('0x10')]==='https:'?https:http;var _0x4db681={'host':_0x481c04[_0x1313('0x11')],'path':_0x481c04[_0x1313('0x5')],'headers':{'user-agent':'WHAT_EVER'}};_0x4feffd[_0x1313('0x12')](_0x4db681,function(_0x18c387){if(_0x18c387[_0x1313('0x13')]!==0xc8){logger[_0x1313('0x14')](_0x1313('0x15')+_0x1660ab+'\x20failed,\x20status\x20code\x20=\x20'+_0x18c387[_0x1313('0x13')]+'\x20('+_0x18c387[_0x1313('0x16')]+')');_0x86f6f6(new Error(_0x1313('0x15')+_0x1660ab+'\x20failed,\x20status\x20code\x20=\x20'+_0x18c387['statusCode']+'\x20('+_0x18c387[_0x1313('0x16')]+')'));return;}var _0x252d63=fs[_0x1313('0x17')](_0x40f9cb);_0x252d63['on'](_0x1313('0x18'),function(){logger[_0x1313('0x19')]('finish\x20download\x20file');_0x252d63['close'](_0xe7e6d2);});_0x252d63['on'](_0x1313('0x14'),function(_0x1da1fd){fs[_0x1313('0x1a')](_0x40f9cb);logger[_0x1313('0x14')]('download\x20error',_0x1da1fd);_0x86f6f6(_0x1da1fd);});_0x18c387[_0x1313('0x1b')](_0x252d63);})['on'](_0x1313('0x14'),function(_0x2895cb){logger['error'](_0x2895cb);_0x86f6f6(_0x2895cb);})[_0x1313('0x1c')]();});}function uploadFile(_0x2e7a37){return new BPromise(function(_0x250405,_0x220ef4){var _0x5188ff=urlParse(_0x2e7a37);var _0x5f0b23=_0x5188ff[_0x1313('0x10')]==='https:'?https:http;var _0x566d34={'host':_0x5188ff['host'],'path':_0x5188ff[_0x1313('0x5')],'headers':{'user-agent':_0x1313('0x1d')}};_0x5f0b23['get'](_0x566d34,function(_0x57ce59){if(_0x57ce59[_0x1313('0x13')]!==0xc8){_0x220ef4(new Error(_0x1313('0x15')+_0x2e7a37+_0x1313('0x1e')+_0x57ce59[_0x1313('0x13')]+'\x20('+_0x57ce59['statusMessage']+')'));return;}var _0x268af7='';_0x57ce59['on'](_0x1313('0x1f'),function(_0x352d27){_0x268af7+=_0x352d27;});_0x57ce59['on'](_0x1313('0x1c'),function(){_0x250405(_0x268af7);});})['on'](_0x1313('0x14'),function(_0x6fe28e){_0x220ef4(_0x6fe28e);})[_0x1313('0x1c')]();});}function convertFile(_0x3b565d,_0x27ba62){return new BPromise(function(_0x13b596,_0x55e8ce){var _0x42dd02=sox[_0x1313('0x20')](_0x3b565d,_0x27ba62,{'sampleRate':0x1f40,'format':_0x1313('0x21'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x42dd02['on'](_0x1313('0x14'),function(_0x107bd3){logger['error'](_0x1313('0x22'),_0x107bd3);_0x55e8ce(_0x107bd3);});_0x42dd02['on'](_0x1313('0x1c'),function(){logger[_0x1313('0x19')]('finish\x20to\x20convert');_0x13b596();});_0x42dd02['start']();});}function base64Decode(_0x546b21,_0x440340){var _0x42335f=path[_0x1313('0x23')](__dirname,_0x1313('0x24'),rs['generate'](0x4)+_0x1313('0x25'));fs[_0x1313('0x26')](_0x42335f,_0x546b21,_0x1313('0x27'));return convertFile(_0x42335f,_0x440340)[_0x1313('0x28')](function(){try{fs[_0x1313('0x1a')](_0x42335f);fs['chmodSync'](_0x440340,_0x1313('0x29'));}catch(_0x2b6999){logger[_0x1313('0x14')](_0x2b6999);}return _0x440340[_0x1313('0x2a')]('.')[0x0];});}function base64Encode(_0x6dc9a0){var _0x4dc158=fs['readFileSync'](_0x6dc9a0);return new Buffer(_0x4dc158)[_0x1313('0x2b')]('base64');}exports[_0x1313('0x2c')]=function(_0x1506ef,_0x5cb7c7,_0x458e33,_0x373847,_0x8128d7,_0x17581e){var _0x44b4e2,_0x1920d0;var _0x43fb79=_0x1313('0x2d');var _0x173109=_0x1313('0x2e')+_0x1506ef;var _0x3581b9={};if(_0x5cb7c7===_0x1313('0x2f')){_0x3581b9[_0x1313('0x30')]={'ssml':_0x458e33};}else{_0x3581b9['input']={'text':_0x458e33};};_0x3581b9[_0x1313('0x31')]={'languageCode':_0x373847,'ssmlGender':_0x8128d7};_0x3581b9[_0x1313('0x32')]={'audioEncoding':_0x1313('0x33'),'sampleRateHertz':0x1f40};var _0xf24cf2={'url':_0x43fb79+_0x1313('0x34')+_0x173109,'method':_0x1313('0x35'),'json':!![],'body':_0x3581b9};return rp(_0xf24cf2)['then'](function(_0x2abef9){return new BPromise(function(_0x4d0ac6,_0x228b7c){_0x44b4e2=path[_0x1313('0x23')](__dirname,_0x1313('0x24'),rs[_0x1313('0x36')](0x4)+'.mp3');var _0x571343=Buffer[_0x1313('0x37')](_0x2abef9[_0x1313('0x38')],_0x1313('0x27'));return fs[_0x1313('0x39')](_0x44b4e2,_0x571343,function(_0x2eff21){_0x228b7c(_0x2eff21);},function(_0xe80cbe){fs[_0x1313('0x3a')](_0x44b4e2,_0x1313('0x29'));_0x4d0ac6(_0xe80cbe);});});})[_0x1313('0x28')](function(_0x581b0c){_0x1920d0=path[_0x1313('0x23')](__dirname,'tmp',rs['generate'](0x4)+_0x1313('0x25'));return convertFile(_0x44b4e2,_0x1920d0);})[_0x1313('0x28')](function(){try{fs[_0x1313('0x1a')](_0x44b4e2);fs['chmodSync'](_0x1920d0,_0x1313('0x29'));}catch(_0x338683){logger[_0x1313('0x14')](_0x338683);}logger[_0x1313('0x19')](_0x1313('0x3b'),_0x1920d0[_0x1313('0x2a')]('.')[0x0]);return _0x1920d0['split']('.')[0x0];});};exports[_0x1313('0x3c')]=function(_0x21887f,_0x531a00){var _0x2862b7=_0x1313('0x3d');var _0x2893af,_0xdb5023;var _0x3d9160;var _0x4dd154={'encoding':_0x1313('0x3e'),'method':'POST','timeout':0x2710,'url':_0x2862b7,'headers':{'Content-Type':_0x1313('0x3f')},'body':_0x1313('0x40')+encodeURIComponent(JSON[_0x1313('0x41')]([[[_0x1313('0x42'),JSON['stringify']([_0x21887f,_0x531a00||'en',![],_0x1313('0x43')]),null,_0x1313('0x44')]]]))};return rp(_0x4dd154)[_0x1313('0x28')](function(_0x367e09){try{_0x3d9160=eval(_0x367e09[_0x1313('0x45')](0x5))[0x0][0x2];}catch(_0x20f7e7){throw new Error('parse\x20response\x20failed:\x0a'+_0x367e09[_0x1313('0x1f')]);}if(!_0x3d9160){if(_0x21887f[_0x1313('0x46')]>0xc8){throw new Error(_0x1313('0x47'));}else{throw new Error('lang\x20\x22'+_0x531a00+'\x22\x20might\x20not\x20exist');}}try{_0x3d9160=eval(_0x3d9160)[0x0];}catch(_0x1eeb20){throw new Error(_0x1313('0x48')+res[_0x1313('0x1f')]);}const _0x92db35=_0x3d9160;_0x2893af=path[_0x1313('0x23')](__dirname,'tmp',rs[_0x1313('0x36')](0x4)+_0x1313('0x49'));fs[_0x1313('0x26')](_0x2893af,_0x3d9160,{'encoding':'base64'});_0xdb5023=path['resolve'](__dirname,'tmp',rs['generate'](0x4)+_0x1313('0x25'));return convertFile(_0x2893af,_0xdb5023);})['then'](function(){try{fs['unlink'](_0x2893af);fs['chmodSync'](_0xdb5023,_0x1313('0x29'));}catch(_0x586b2e){logger[_0x1313('0x14')](_0x586b2e);}logger[_0x1313('0x19')](_0x1313('0x4a'),_0xdb5023[_0x1313('0x2a')]('.')[0x0]);return _0xdb5023[_0x1313('0x2a')]('.')[0x0];});};exports[_0x1313('0x4b')]=function(_0x2a5f56,_0x875c31,_0x5e934e){return google[_0x1313('0x4c')](_0x2a5f56,_0x875c31,_0x5e934e)['then'](function(_0x60455){logger[_0x1313('0x19')](_0x60455[_0x1313('0x4d')]);return rp(_0x60455);})[_0x1313('0x28')](function(_0x4e8296){var _0x2f9af9='';var _0x2904d5=0x0;try{fs[_0x1313('0x1a')](_0x2a5f56);}catch(_0x1244ef){logger[_0x1313('0x14')](_0x1244ef);}if(_0x4e8296&&_0x4e8296[_0x1313('0x4e')]){_0x2f9af9=_0x4e8296[_0x1313('0x4e')]['map'](function(_0x32c540){return _0x32c540&&_0x32c540[_0x1313('0x4f')][0x0]&&_0x32c540[_0x1313('0x4f')][0x0][_0x1313('0x50')]?_0x32c540[_0x1313('0x4f')][0x0][_0x1313('0x50')]:'';})[_0x1313('0x51')]('\x0a');_0x2904d5=_0x4e8296['results']['map'](function(_0x5131ad){return _0x5131ad&&_0x5131ad[_0x1313('0x4f')][0x0]&&_0x5131ad[_0x1313('0x4f')][0x0][_0x1313('0x52')]?_0x5131ad['alternatives'][0x0]['confidence']:0x0;})[_0x1313('0x51')]('\x0a');}logger[_0x1313('0x19')](_0x1313('0x53'),_0x2f9af9);logger[_0x1313('0x19')](_0x1313('0x54'),_0x2904d5);return{'transcript':_0x2f9af9,'confidence':_0x2904d5};})[_0x1313('0x55')](function(_0x56593d){logger[_0x1313('0x14')](_0x1313('0x56'),_0x56593d['statusCode'],_0x56593d[_0x1313('0x57')],_0x56593d[_0x1313('0x58')]);});};exports[_0x1313('0x59')]=function(_0x29fcc5,_0x5e2147,_0x38c0b7,_0x78ab74){var _0x2411e0=apiai(_0x5e2147,{'language':_0x78ab74||'en'});return _0x2411e0[_0x1313('0x5a')](_0x38c0b7,{'sessionId':md5(_0x29fcc5)})['then'](function(_0x1d355a){logger[_0x1313('0x19')](JSON[_0x1313('0x41')](_0x1d355a));return{'source':_0x1d355a[_0x1313('0x5b')][_0x1313('0x5c')],'resolvedQuery':_0x1d355a[_0x1313('0x5b')]['resolvedQuery'],'action':_0x1d355a['result'][_0x1313('0x5d')],'actionIncomplete':_0x1d355a[_0x1313('0x5b')]['actionIncomplete'],'speech':_0x1d355a[_0x1313('0x5b')][_0x1313('0x5e')]['speech'],'score':_0x1d355a[_0x1313('0x5b')][_0x1313('0x5f')],'statusCode':_0x1d355a[_0x1313('0x60')][_0x1313('0x61')],'endConversation':_0x1d355a[_0x1313('0x5b')][_0x1313('0x62')][_0x1313('0x63')]||![],'isFallbackIntent':_0x1d355a[_0x1313('0x5b')][_0x1313('0x62')][_0x1313('0x64')]};});};exports[_0x1313('0x65')]=function(_0x2fcf35,_0x1e48d3,_0x487338,_0x587cb1,_0x2a948c,_0x4effda){var _0x5432b3=_0x587cb1[_0x1313('0x66')](/\\n/g,'\x0a');var _0x48eb79={'credentials':{'private_key':_0x5432b3,'client_email':_0x487338}};var _0x5d06de=new dialogflow['SessionsClient'](_0x48eb79);var _0xc11265=_0x5d06de[_0x1313('0x67')](_0x1e48d3,md5(_0x2fcf35));var _0x2c3cfe={'session':_0xc11265,'queryInput':{'text':{'text':_0x2a948c,'languageCode':_0x4effda}}};return _0x5d06de[_0x1313('0x68')](_0x2c3cfe)[_0x1313('0x28')](function(_0x3e7804){if(_0x3e7804&&_0x3e7804[_0x1313('0x46')]){logger[_0x1313('0x19')](_0x1313('0x69'),JSON['stringify'](_0x3e7804));var _0x200756=_0x3e7804[0x0];if(_0x200756){var _0x3935c6={'action':_0x200756['queryResult'][_0x1313('0x5d')],'allRequiredParamsPresent':_0x200756['queryResult'][_0x1313('0x6a')],'endConversation':_0x200756['queryResult']['diagnosticInfo']&&_0x200756[_0x1313('0x6b')][_0x1313('0x6c')]['fields']?_0x200756[_0x1313('0x6b')][_0x1313('0x6c')][_0x1313('0x6d')]['end_conversation'][_0x1313('0x6e')]:![],'fulfillmentText':_0x200756[_0x1313('0x6b')][_0x1313('0x6f')],'intentName':_0x200756[_0x1313('0x6b')][_0x1313('0x70')][_0x1313('0x57')],'intentDisplayName':_0x200756[_0x1313('0x6b')][_0x1313('0x70')][_0x1313('0x71')],'isFallbackIntent':_0x200756[_0x1313('0x6b')][_0x1313('0x70')]['isFallback'],'languageCode':_0x200756[_0x1313('0x6b')][_0x1313('0x72')],'queryText':_0x200756[_0x1313('0x6b')][_0x1313('0x73')],'responseId':_0x200756[_0x1313('0x74')],'score':_0x200756[_0x1313('0x6b')][_0x1313('0x75')],'speech':_0x200756[_0x1313('0x6b')][_0x1313('0x6f')],'providerResponse':JSON[_0x1313('0x41')](_0x3e7804)};return _0x3935c6;}}});};exports['tildeASR']=function(_0x2d0713,_0x4964f1,_0x23c7a5,_0x232b2f){return tilde[_0x1313('0x4c')](_0x2d0713,_0x4964f1,_0x23c7a5,_0x232b2f)[_0x1313('0x28')](function(_0x125455){try{fs[_0x1313('0x1a')](_0x2d0713);}catch(_0x4f6225){logger['error'](_0x4f6225);}logger[_0x1313('0x19')](_0x1313('0x76'),_0x125455[_0x1313('0x50')]);logger[_0x1313('0x19')](_0x1313('0x77'),_0x125455['confidence']);return _0x125455;});};exports[_0x1313('0x78')]=function(_0x5012cb,_0x22a973,_0x52cc16,_0x4c25b4,_0x43d285,_0x393c3c){var _0x420cca=path[_0x1313('0x23')](__dirname,_0x1313('0x24'),rs[_0x1313('0x36')](0x4)+_0x1313('0x49'));var _0x5845b9;return aws[_0x1313('0x79')](_0x5012cb,_0x22a973,_0x52cc16,_0x4c25b4,_0x43d285,_0x393c3c,_0x420cca)[_0x1313('0x28')](function(){_0x5845b9=path[_0x1313('0x23')](__dirname,'tmp',rs[_0x1313('0x36')](0x4)+'.wav');return convertFile(_0x420cca,_0x5845b9);})['then'](function(){try{fs[_0x1313('0x1a')](_0x420cca);fs['chmodSync'](_0x5845b9,_0x1313('0x29'));}catch(_0x23aaf5){logger['error'](_0x23aaf5);}return _0x5845b9[_0x1313('0x2a')]('.')[0x0];});};exports['awsLex']=function(_0x25bbfe,_0x94dc91,_0x2efa14,_0x169a9a,_0x48e5a8,_0x2681bb){return aws[_0x1313('0x7a')](_0x25bbfe,_0x94dc91,_0x2efa14,_0x169a9a,_0x48e5a8,_0x2681bb)[_0x1313('0x28')](function(_0x5c751b){logger[_0x1313('0x19')](JSON[_0x1313('0x41')](_0x5c751b));return _0x5c751b;});};exports['ispeechTTS']=function(_0x41023b,_0x2bea55,_0xfbf9a8,_0x350013){var _0x4e689d=util['format'](_0x1313('0x7b'),ISPEECH_API,_0x41023b,encodeURIComponent(_0x2bea55),_0xfbf9a8,_0x350013);var _0x4ddb02=path[_0x1313('0x23')](__dirname,_0x1313('0x24'),rs[_0x1313('0x36')](0x4)+'.mp3');var _0x39c131;return downloadFile(_0x4e689d,_0x4ddb02)[_0x1313('0x28')](function(){_0x39c131=path[_0x1313('0x23')](__dirname,'tmp',rs[_0x1313('0x36')](0x4)+_0x1313('0x25'));return convertFile(_0x4ddb02,_0x39c131);})['then'](function(){try{fs[_0x1313('0x1a')](_0x4ddb02);fs[_0x1313('0x3a')](_0x39c131,_0x1313('0x29'));}catch(_0x287a9b){logger[_0x1313('0x14')](_0x287a9b);}return _0x39c131['split']('.')[0x0];});};exports['ispeechASR']=function(_0x4dc8ba,_0x8fd8d4,_0x2aafef,_0x3a37d7){var _0x1806aa=util[_0x1313('0x7c')](_0x1313('0x7d'),ISPEECH_API,_0x8fd8d4,_0x2aafef,base64Encode(_0x4dc8ba),_0x3a37d7?util[_0x1313('0x7c')](_0x1313('0x7e'),encodeURIComponent(_0x3a37d7)):'freeform=3');return uploadFile(_0x1806aa)[_0x1313('0x28')](function(_0x153fc5){return querystring[_0x1313('0x9')](_0x153fc5);});};exports[_0x1313('0x7f')]=function(_0xb2b3ff,_0x550f2b){return sestek[_0x1313('0x80')](_0xb2b3ff,_0x550f2b)[_0x1313('0x28')](function(_0x2d9971){logger['info'](JSON['stringify'](_0x2d9971));var _0x48ea70={'speech':_0x2d9971[_0x1313('0x81')],'action':_0x2d9971[_0x1313('0x82')]?_0x2d9971[_0x1313('0x82')]['CustomAction']:undefined,'actiondata':_0x2d9971[_0x1313('0x82')]?_0x2d9971['channelData']['CustomActionData']:undefined};if(_0x2d9971[_0x1313('0x82')]&&_0x2d9971[_0x1313('0x82')][_0x1313('0x83')]){return base64Decode(_0x2d9971[_0x1313('0x82')][_0x1313('0x83')][_0x1313('0x84')],path[_0x1313('0x23')](__dirname,'tmp',rs[_0x1313('0x36')](0x4)+_0x1313('0x25')))[_0x1313('0x28')](function(_0xeec1ce){_0x48ea70[_0x1313('0x85')]=_0xeec1ce;return _0x48ea70;});}return _0x48ea70;});};exports[_0x1313('0x86')]=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 8f34e03..e038611 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 nda=require('./nda');module['exports']={'nda':nda}; \ No newline at end of file +var _0xc553=['exports'];(function(_0x2b4411,_0x2625ed){var _0x8e41ef=function(_0x2aa8c1){while(--_0x2aa8c1){_0x2b4411['push'](_0x2b4411['shift']());}};_0x8e41ef(++_0x2625ed);}(_0xc553,0x172));var _0x3c55=function(_0x310dab,_0x20d5ea){_0x310dab=_0x310dab-0x0;var _0x18cf45=_0xc553[_0x310dab];return _0x18cf45;};var nda=require('./nda');module[_0x3c55('0x0')]={'nda':nda}; \ No newline at end of file diff --git a/server/services/agi/scripts/sestek/nda/index.js b/server/services/agi/scripts/sestek/nda/index.js index 06f71f1..f82ccf0 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 _0x6ae0=['Nda','callerid','calleridname','dnid','extension','text','Bearer\x20','access_token','ProjectName','ndagenerate_audio','body','channelData','AudioOutputSettings','CustomAction','custom_action','custom_action_data','info','stringify','request-promise','url','../../../../../config/logger','agi','POST','ndauth_url','/token','username','then','resolve','ndassistant_url','/api/NaturalDialogAssistant/v1/Run','ndaactivity_type','message'];(function(_0x3ae750,_0x2c37a9){var _0x484a18=function(_0x21bac4){while(--_0x21bac4){_0x3ae750['push'](_0x3ae750['shift']());}};_0x484a18(++_0x2c37a9);}(_0x6ae0,0x192));var _0x06ae=function(_0x47ae56,_0x13ec08){_0x47ae56=_0x47ae56-0x0;var _0x222aa2=_0x6ae0[_0x47ae56];return _0x222aa2;};'use strict';var rp=require(_0x06ae('0x0'));var url=require(_0x06ae('0x1'));var logger=require(_0x06ae('0x2'))(_0x06ae('0x3'));module['exports']=function(_0x52f385,_0x319535){var _0x58c780={'method':_0x06ae('0x4'),'uri':url['resolve'](_0x319535[_0x06ae('0x5')],_0x06ae('0x6')),'form':{'grant_type':'password','username':_0x319535[_0x06ae('0x7')],'password':_0x319535['password']},'json':!![]};return rp(_0x58c780)[_0x06ae('0x8')](function(_0x2bc2ad){var _0x591c0f={'method':_0x06ae('0x4'),'uri':url[_0x06ae('0x9')](_0x319535[_0x06ae('0xa')],_0x06ae('0xb')),'body':{'type':_0x319535[_0x06ae('0xc')]||_0x06ae('0xd'),'channelId':_0x06ae('0xe'),'conversation':{'id':_0x52f385['uniqueid']},'from':{'id':_0x52f385[_0x06ae('0xf')],'name':_0x52f385[_0x06ae('0x10')]},'recipient':{'id':_0x52f385[_0x06ae('0x11')],'name':_0x52f385[_0x06ae('0x12')]},'text':_0x319535[_0x06ae('0x13')],'channelData':{}},'headers':{'Authorization':_0x06ae('0x14')+_0x2bc2ad[_0x06ae('0x15')]},'json':!![]};if(_0x319535['project']){_0x591c0f['body']['channelData'][_0x06ae('0x16')]=_0x319535['project'];}if(_0x319535[_0x06ae('0x17')]=='1'){_0x591c0f[_0x06ae('0x18')][_0x06ae('0x19')][_0x06ae('0x1a')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':'audio/wav'};}if(_0x319535['custom_action']){_0x591c0f[_0x06ae('0x18')]['channelData'][_0x06ae('0x1b')]=_0x319535[_0x06ae('0x1c')];if(_0x319535[_0x06ae('0x1d')]){_0x591c0f['body']['channelData']['CustomActionData']=_0x319535[_0x06ae('0x1d')];}}logger[_0x06ae('0x1e')](JSON[_0x06ae('0x1f')](_0x591c0f));return rp(_0x591c0f);});}; \ No newline at end of file +var _0x0cee=['ndassistant_url','/api/NaturalDialogAssistant/v1/Run','ndaactivity_type','message','calleridname','dnid','extension','text','Bearer\x20','access_token','project','body','channelData','ProjectName','ndagenerate_audio','AudioOutputSettings','audio/wav','CustomAction','custom_action','custom_action_data','CustomActionData','info','stringify','request-promise','url','../../../../../config/logger','agi','exports','POST','resolve','ndauth_url','/token','password','username','then'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x0cee,0x12f));var _0xe0ce=function(_0x2f2b67,_0x4bc11c){_0x2f2b67=_0x2f2b67-0x0;var _0x220ae3=_0x0cee[_0x2f2b67];return _0x220ae3;};'use strict';var rp=require(_0xe0ce('0x0'));var url=require(_0xe0ce('0x1'));var logger=require(_0xe0ce('0x2'))(_0xe0ce('0x3'));module[_0xe0ce('0x4')]=function(_0x25ec67,_0x54f977){var _0x563553={'method':_0xe0ce('0x5'),'uri':url[_0xe0ce('0x6')](_0x54f977[_0xe0ce('0x7')],_0xe0ce('0x8')),'form':{'grant_type':_0xe0ce('0x9'),'username':_0x54f977[_0xe0ce('0xa')],'password':_0x54f977[_0xe0ce('0x9')]},'json':!![]};return rp(_0x563553)[_0xe0ce('0xb')](function(_0x494eca){var _0x27eea3={'method':_0xe0ce('0x5'),'uri':url['resolve'](_0x54f977[_0xe0ce('0xc')],_0xe0ce('0xd')),'body':{'type':_0x54f977[_0xe0ce('0xe')]||_0xe0ce('0xf'),'channelId':'Nda','conversation':{'id':_0x25ec67['uniqueid']},'from':{'id':_0x25ec67['callerid'],'name':_0x25ec67[_0xe0ce('0x10')]},'recipient':{'id':_0x25ec67[_0xe0ce('0x11')],'name':_0x25ec67[_0xe0ce('0x12')]},'text':_0x54f977[_0xe0ce('0x13')],'channelData':{}},'headers':{'Authorization':_0xe0ce('0x14')+_0x494eca[_0xe0ce('0x15')]},'json':!![]};if(_0x54f977[_0xe0ce('0x16')]){_0x27eea3[_0xe0ce('0x17')][_0xe0ce('0x18')][_0xe0ce('0x19')]=_0x54f977[_0xe0ce('0x16')];}if(_0x54f977[_0xe0ce('0x1a')]=='1'){_0x27eea3['body']['channelData'][_0xe0ce('0x1b')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0xe0ce('0x1c')};}if(_0x54f977['custom_action']){_0x27eea3['body'][_0xe0ce('0x18')][_0xe0ce('0x1d')]=_0x54f977[_0xe0ce('0x1e')];if(_0x54f977[_0xe0ce('0x1f')]){_0x27eea3[_0xe0ce('0x17')]['channelData'][_0xe0ce('0x20')]=_0x54f977['custom_action_data'];}}logger[_0xe0ce('0x21')](JSON[_0xe0ce('0x22')](_0x27eea3));return rp(_0x27eea3);});}; \ 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 0f21cc8..91a1d40 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 _0xd892=['exports','./lib/api'];(function(_0x37d145,_0x591195){var _0x273447=function(_0x1874a2){while(--_0x1874a2){_0x37d145['push'](_0x37d145['shift']());}};_0x273447(++_0x591195);}(_0xd892,0x1c9));var _0x2d89=function(_0x491a7f,_0x28bb80){_0x491a7f=_0x491a7f-0x0;var _0x3d8f44=_0xd892[_0x491a7f];return _0x3d8f44;};'use strict';var asr=require(_0x2d89('0x0'));module[_0x2d89('0x1')]=function(_0x149792,_0x470a3e,_0x217a5e,_0x560815){return asr(_0x149792,_0x470a3e,_0x217a5e,_0x560815);}; \ No newline at end of file +var _0x71d4=['exports','./lib/api'];(function(_0x48e4ad,_0x4a8b62){var _0x5c8167=function(_0x1f87e6){while(--_0x1f87e6){_0x48e4ad['push'](_0x48e4ad['shift']());}};_0x5c8167(++_0x4a8b62);}(_0x71d4,0x173));var _0x471d=function(_0x2ff88c,_0x444be2){_0x2ff88c=_0x2ff88c-0x0;var _0x5e3c4d=_0x71d4[_0x2ff88c];return _0x5e3c4d;};'use strict';var asr=require(_0x471d('0x0'));module[_0x471d('0x1')]=function(_0xb6853c,_0x510b4a,_0x17b58b,_0x494cc0){return asr(_0xb6853c,_0x510b4a,_0x17b58b,_0x494cc0);}; \ 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 30b5360..7cdea06 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 _0x96c4=['update','digest','stringify','data','send','close','EOS','error','terminate','parse','status','result','final','hypotheses','transcript','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','message','bluebird','lodash','moment','crypto','../../../../../../config/logger','agi','exports','info','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech'];(function(_0x2dc2ae,_0x180c1d){var _0x5c3c77=function(_0x551c67){while(--_0x551c67){_0x2dc2ae['push'](_0x2dc2ae['shift']());}};_0x5c3c77(++_0x180c1d);}(_0x96c4,0x10e));var _0x496c=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x96c4[_0x3dd15e];return _0x231fd0;};'use strict';var BPromise=require(_0x496c('0x0'));var _=require(_0x496c('0x1'));var fs=require('fs');var WebSocket=require('ws');var moment=require(_0x496c('0x2'));var crypto=require(_0x496c('0x3'));var logger=require(_0x496c('0x4'))(_0x496c('0x5'));module[_0x496c('0x6')]=function(_0x9f90ec,_0x1163b0,_0x3d3594,_0x14d614){return new BPromise(function(_0x1d43f2,_0x8e673f){logger[_0x496c('0x7')]('Tilde\x20URI',_0x14d614||_0x496c('0x8'));var _0x1b664c=new WebSocket(_0x14d614||_0x496c('0x8'),{'perMessageDeflate':![]});var _0x41e085='';var _0x421737='0';var _0x47729e='1';var _0x3f8769=_0x496c('0x9');function _0x244b5d(_0x4544ad){var _0x33d9f4=crypto['createHash']('sha1');_0x33d9f4[_0x496c('0xa')](_0x4544ad);return _0x33d9f4[_0x496c('0xb')]('hex');}function _0x8f86b3(){try{logger[_0x496c('0x7')]('Open\x20Tilde\x20ASR\x20socket');var _0x272f27=moment()['unix']();var _0x38c251=_0x244b5d(_0x272f27+_0x1163b0+_0x3d3594);_0x1b664c['send'](JSON[_0x496c('0xc')]({'appID':_0x1163b0,'timestamp':_0x272f27,'appKey':_0x38c251}));var _0x403423=fs['createReadStream'](_0x9f90ec);_0x403423['on'](_0x496c('0xd'),function(_0x1e7853){_0x1b664c[_0x496c('0xe')](_0x1e7853);});_0x403423['on'](_0x496c('0xf'),function(){_0x1b664c[_0x496c('0xe')](_0x496c('0x10'));});}catch(_0xd7a7f6){logger[_0x496c('0x11')]('Tilde\x20ASR\x20send\x20error',JSON[_0x496c('0xc')](_0xd7a7f6));_0x1b664c[_0x496c('0x12')]();}}function _0x559d60(_0x4aa395){try{if(_0x4aa395){var _0x46e623=JSON[_0x496c('0x13')](_0x4aa395);switch(_0x46e623[_0x496c('0x14')]){case 0x0:if(_0x46e623[_0x496c('0x15')]){if(_0x46e623['result'][_0x496c('0x16')]){logger['info']('Tilde\x20ASR\x20hypoteses',JSON[_0x496c('0xc')](_0x46e623['result'][_0x496c('0x17')]));_0x41e085=_0x46e623[_0x496c('0x15')][_0x496c('0x17')][0x0][_0x496c('0x18')];_0x421737=_0x46e623['result'][_0x496c('0x17')][0x0]['likelihood'];_0x47729e='0';_0x3f8769='Success.';_0x1b664c[_0x496c('0x12')]();}}break;case 0x1:logger['info']('No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech');_0x47729e='1';_0x3f8769=_0x496c('0x9');break;case 0x2:logger[_0x496c('0x7')](_0x496c('0x19'));_0x47729e='2';_0x3f8769=_0x496c('0x19');break;case 0x9:logger['info'](_0x496c('0x1a'));_0x47729e='9';_0x3f8769='Not\x20available.\x20Max\x20load\x20limit\x20reached.';break;case 0xa:logger[_0x496c('0x7')](_0x496c('0x1b'));_0x47729e='10';_0x3f8769=_0x496c('0x1b');break;case 0xb:logger[_0x496c('0x7')](_0x496c('0x1c'));_0x47729e='11';_0x3f8769='All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.';}}}catch(_0x2fa197){logger[_0x496c('0x11')](_0x496c('0x1d'),JSON[_0x496c('0xc')](_0x2fa197));_0x1b664c[_0x496c('0x12')]();}}function _0x3c66d6(){logger[_0x496c('0x7')](_0x496c('0x1e'));_0x1d43f2({'transcript':_0x41e085,'confidence':_0x421737,'status':_0x47729e,'status_message':_0x3f8769});}function _0x3cd5b1(_0x139310){logger[_0x496c('0x11')](_0x496c('0x1f'));if(!_[_0x496c('0x20')](_0x139310)){logger[_0x496c('0x11')](_[_0x496c('0x21')](_0x139310)?JSON[_0x496c('0xc')](_0x139310):_0x139310);}}_0x1b664c['on']('open',_0x8f86b3);_0x1b664c['on'](_0x496c('0x22'),_0x559d60);_0x1b664c['on']('close',_0x3c66d6);_0x1b664c['on'](_0x496c('0x11'),_0x3cd5b1);});}; \ No newline at end of file +var _0xa662=['../../../../../../config/logger','exports','info','Tilde\x20URI','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','createHash','sha1','update','hex','Open\x20Tilde\x20ASR\x20socket','unix','stringify','createReadStream','data','send','close','EOS','error','terminate','parse','final','Tilde\x20ASR\x20hypoteses','result','hypotheses','transcript','likelihood','Success.','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Not\x20available.\x20Max\x20load\x20limit\x20reached.','Authentication\x20failed.','All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','Error\x20Tilde\x20ASR\x20socket','isNil','isObject','open','message','bluebird','moment','crypto'];(function(_0x25b213,_0x4706fd){var _0x136413=function(_0x4a6fc9){while(--_0x4a6fc9){_0x25b213['push'](_0x25b213['shift']());}};_0x136413(++_0x4706fd);}(_0xa662,0xc5));var _0x2a66=function(_0x1e9e54,_0x56bf22){_0x1e9e54=_0x1e9e54-0x0;var _0x259995=_0xa662[_0x1e9e54];return _0x259995;};'use strict';var BPromise=require(_0x2a66('0x0'));var _=require('lodash');var fs=require('fs');var WebSocket=require('ws');var moment=require(_0x2a66('0x1'));var crypto=require(_0x2a66('0x2'));var logger=require(_0x2a66('0x3'))('agi');module[_0x2a66('0x4')]=function(_0x23a299,_0x43f603,_0x2e37de,_0x36c0e5){return new BPromise(function(_0x5c7699,_0x1ada9d){logger[_0x2a66('0x5')](_0x2a66('0x6'),_0x36c0e5||_0x2a66('0x7'));var _0x505c64=new WebSocket(_0x36c0e5||_0x2a66('0x7'),{'perMessageDeflate':![]});var _0x4e6140='';var _0x3c958a='0';var _0x136f7a='1';var _0x18e107='No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech';function _0x55336b(_0x3f66a1){var _0x5cbbbf=crypto[_0x2a66('0x8')](_0x2a66('0x9'));_0x5cbbbf[_0x2a66('0xa')](_0x3f66a1);return _0x5cbbbf['digest'](_0x2a66('0xb'));}function _0x41d5f0(){try{logger[_0x2a66('0x5')](_0x2a66('0xc'));var _0x3ac10b=moment()[_0x2a66('0xd')]();var _0x3ab6e6=_0x55336b(_0x3ac10b+_0x43f603+_0x2e37de);_0x505c64['send'](JSON[_0x2a66('0xe')]({'appID':_0x43f603,'timestamp':_0x3ac10b,'appKey':_0x3ab6e6}));var _0x1dd70d=fs[_0x2a66('0xf')](_0x23a299);_0x1dd70d['on'](_0x2a66('0x10'),function(_0x5b98ab){_0x505c64[_0x2a66('0x11')](_0x5b98ab);});_0x1dd70d['on'](_0x2a66('0x12'),function(){_0x505c64[_0x2a66('0x11')](_0x2a66('0x13'));});}catch(_0x32ff06){logger[_0x2a66('0x14')]('Tilde\x20ASR\x20send\x20error',JSON[_0x2a66('0xe')](_0x32ff06));_0x505c64[_0x2a66('0x15')]();}}function _0x14c4ef(_0x397380){try{if(_0x397380){var _0x28a94f=JSON[_0x2a66('0x16')](_0x397380);switch(_0x28a94f['status']){case 0x0:if(_0x28a94f['result']){if(_0x28a94f['result'][_0x2a66('0x17')]){logger[_0x2a66('0x5')](_0x2a66('0x18'),JSON['stringify'](_0x28a94f['result']['hypotheses']));_0x4e6140=_0x28a94f[_0x2a66('0x19')][_0x2a66('0x1a')][0x0][_0x2a66('0x1b')];_0x3c958a=_0x28a94f[_0x2a66('0x19')][_0x2a66('0x1a')][0x0][_0x2a66('0x1c')];_0x136f7a='0';_0x18e107=_0x2a66('0x1d');_0x505c64['terminate']();}}break;case 0x1:logger[_0x2a66('0x5')](_0x2a66('0x1e'));_0x136f7a='1';_0x18e107='No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech';break;case 0x2:logger[_0x2a66('0x5')]('Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.');_0x136f7a='2';_0x18e107=_0x2a66('0x1f');break;case 0x9:logger[_0x2a66('0x5')](_0x2a66('0x20'));_0x136f7a='9';_0x18e107='Not\x20available.\x20Max\x20load\x20limit\x20reached.';break;case 0xa:logger['info'](_0x2a66('0x21'));_0x136f7a='10';_0x18e107='Authentication\x20failed.';break;case 0xb:logger[_0x2a66('0x5')]('All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.');_0x136f7a='11';_0x18e107=_0x2a66('0x22');}}}catch(_0x478afd){logger['error']('Tilde\x20ASR\x20parse\x20error',JSON[_0x2a66('0xe')](_0x478afd));_0x505c64['terminate']();}}function _0x1daabb(){logger['info']('Close\x20Tilde\x20ASR\x20socket');_0x5c7699({'transcript':_0x4e6140,'confidence':_0x3c958a,'status':_0x136f7a,'status_message':_0x18e107});}function _0x16d2c9(_0x50cd2c){logger[_0x2a66('0x14')](_0x2a66('0x23'));if(!_[_0x2a66('0x24')](_0x50cd2c)){logger[_0x2a66('0x14')](_[_0x2a66('0x25')](_0x50cd2c)?JSON[_0x2a66('0xe')](_0x50cd2c):_0x50cd2c);}}_0x505c64['on'](_0x2a66('0x26'),_0x41d5f0);_0x505c64['on'](_0x2a66('0x27'),_0x14c4ef);_0x505c64['on'](_0x2a66('0x12'),_0x1daabb);_0x505c64['on']('error',_0x16d2c9);});}; \ 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 cda1597..785ea1d 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 _0x5d55=['./asr','exports'];(function(_0x5c88c8,_0x2c04cf){var _0x7b15d5=function(_0x3435dd){while(--_0x3435dd){_0x5c88c8['push'](_0x5c88c8['shift']());}};_0x7b15d5(++_0x2c04cf);}(_0x5d55,0x144));var _0x55d5=function(_0x29e06f,_0x3e37a3){_0x29e06f=_0x29e06f-0x0;var _0xbe5807=_0x5d55[_0x29e06f];return _0xbe5807;};var asr=require(_0x55d5('0x0'));module[_0x55d5('0x1')]={'asr':asr}; \ No newline at end of file +var _0x4a80=['exports','./asr'];(function(_0x3205a6,_0x177082){var _0x2e7a05=function(_0x16c54a){while(--_0x16c54a){_0x3205a6['push'](_0x3205a6['shift']());}};_0x2e7a05(++_0x177082);}(_0x4a80,0x175));var _0x04a8=function(_0x11c632,_0x37a6d1){_0x11c632=_0x11c632-0x0;var _0x552909=_0x4a80[_0x11c632];return _0x552909;};var asr=require(_0x04a8('0x0'));module[_0x04a8('0x1')]={'asr':asr}; \ No newline at end of file diff --git a/server/services/agi/server.js b/server/services/agi/server.js index 8477bc9..4e3fef3 100644 --- a/server/services/agi/server.js +++ b/server/services/agi/server.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['connection','getConnections','E_AGI_SERVER_ERROR','E_AGI_SERVER_VOICE_DISABLED','destroy','E_AGI_SERVER_MAXCONNECTION','close','nextTick','exports','util','net','events','./error','./channel','127.0.0.1','call','emit','error','E_AGI_ARGUMENT_PORT','createServer','listen','listening'];(function(_0x1ebd10,_0x4914b4){var _0x1004d3=function(_0x59e3ba){while(--_0x59e3ba){_0x1ebd10['push'](_0x1ebd10['shift']());}};_0x1004d3(++_0x4914b4);}(_0xe706,0xa3));var _0x6e70=function(_0xbebf50,_0x44ec09){_0xbebf50=_0xbebf50-0x0;var _0xce1496=_0xe706[_0xbebf50];return _0xce1496;};'use strict';var util=require(_0x6e70('0x0'));var net=require(_0x6e70('0x1'));var EventEmitter=require(_0x6e70('0x2'))['EventEmitter'];var AGIError=require(_0x6e70('0x3'));var AGIChannel=require(_0x6e70('0x4'));var AGIServer=function(_0x2ca810,_0x7dfbc3,_0x142c27){var _0x2164a4=this;var _0x376a8d=null;var _0x506db9=0x0;if(!_0x2ca810)_0x2ca810=0x11dd;if(!_0x7dfbc3)_0x7dfbc3=_0x6e70('0x5');EventEmitter[_0x6e70('0x6')](_0x2164a4);function _0x36357b(){if(!_0x2ca810){_0x2164a4[_0x6e70('0x7')](_0x6e70('0x8'),new AGIError(_0x6e70('0x9')));return![];}_0x376a8d=net[_0x6e70('0xa')]();_0x376a8d[_0x6e70('0xb')](_0x2ca810,_0x7dfbc3);_0x376a8d['on'](_0x6e70('0xc'),function(){_0x2164a4[_0x6e70('0x7')](_0x6e70('0xc'));});_0x376a8d['on'](_0x6e70('0xd'),function(_0x743eb5){_0x376a8d[_0x6e70('0xe')](function(_0x37b3e0,_0x4600f9){if(_0x37b3e0){_0x2164a4['emit']('error',new AGIError(_0x6e70('0xf'),_0x37b3e0));}else if(_0x142c27&&_0x142c27<0x0){_0x2164a4[_0x6e70('0x7')](_0x6e70('0x8'),new AGIError(_0x6e70('0x10')));_0x743eb5[_0x6e70('0x11')]();}else if(_0x142c27&&_0x142c27>0x0&&_0x142c27<_0x4600f9){_0x506db9+=0x1;_0x2164a4[_0x6e70('0x7')](_0x6e70('0x8'),new AGIError(_0x6e70('0x12'),_0x506db9));_0x743eb5['destroy']();}else{var _0x52737e=new AGIChannel(_0x743eb5);_0x52737e['on']('ready',function(){_0x2164a4[_0x6e70('0x7')]('connection',_0x52737e);});}});});_0x376a8d['on']('error',function(_0x304716){_0x2164a4[_0x6e70('0x7')]('error',new AGIError(_0x6e70('0xf'),_0x304716['code']));});_0x376a8d['on'](_0x6e70('0x13'),function(){_0x2164a4[_0x6e70('0x7')]('close',new AGIError('E_AGI_SERVER_CLOSE'));});}process[_0x6e70('0x14')](function(){_0x36357b();});};util['inherits'](AGIServer,EventEmitter);module[_0x6e70('0x15')]=function(_0x173afe,_0x53acdc,_0x497d61){return new AGIServer(_0x173afe,_0x53acdc,_0x497d61);}; \ No newline at end of file +var _0xe706=['connection','getConnections','E_AGI_SERVER_ERROR','E_AGI_SERVER_VOICE_DISABLED','destroy','E_AGI_SERVER_MAXCONNECTION','close','nextTick','exports','util','net','events','./error','./channel','127.0.0.1','call','emit','error','E_AGI_ARGUMENT_PORT','createServer','listen','listening'];(function(_0x3cb86b,_0x3c75f6){var _0x3c10a0=function(_0x71331f){while(--_0x71331f){_0x3cb86b['push'](_0x3cb86b['shift']());}};_0x3c10a0(++_0x3c75f6);}(_0xe706,0xa3));var _0x6e70=function(_0x5e42a7,_0x3eba35){_0x5e42a7=_0x5e42a7-0x0;var _0x36d21b=_0xe706[_0x5e42a7];return _0x36d21b;};'use strict';var util=require(_0x6e70('0x0'));var net=require(_0x6e70('0x1'));var EventEmitter=require(_0x6e70('0x2'))['EventEmitter'];var AGIError=require(_0x6e70('0x3'));var AGIChannel=require(_0x6e70('0x4'));var AGIServer=function(_0x2ca810,_0x7dfbc3,_0x142c27){var _0x2164a4=this;var _0x376a8d=null;var _0x506db9=0x0;if(!_0x2ca810)_0x2ca810=0x11dd;if(!_0x7dfbc3)_0x7dfbc3=_0x6e70('0x5');EventEmitter[_0x6e70('0x6')](_0x2164a4);function _0x36357b(){if(!_0x2ca810){_0x2164a4[_0x6e70('0x7')](_0x6e70('0x8'),new AGIError(_0x6e70('0x9')));return![];}_0x376a8d=net[_0x6e70('0xa')]();_0x376a8d[_0x6e70('0xb')](_0x2ca810,_0x7dfbc3);_0x376a8d['on'](_0x6e70('0xc'),function(){_0x2164a4[_0x6e70('0x7')](_0x6e70('0xc'));});_0x376a8d['on'](_0x6e70('0xd'),function(_0x743eb5){_0x376a8d[_0x6e70('0xe')](function(_0x37b3e0,_0x4600f9){if(_0x37b3e0){_0x2164a4['emit']('error',new AGIError(_0x6e70('0xf'),_0x37b3e0));}else if(_0x142c27&&_0x142c27<0x0){_0x2164a4[_0x6e70('0x7')](_0x6e70('0x8'),new AGIError(_0x6e70('0x10')));_0x743eb5[_0x6e70('0x11')]();}else if(_0x142c27&&_0x142c27>0x0&&_0x142c27<_0x4600f9){_0x506db9+=0x1;_0x2164a4[_0x6e70('0x7')](_0x6e70('0x8'),new AGIError(_0x6e70('0x12'),_0x506db9));_0x743eb5['destroy']();}else{var _0x52737e=new AGIChannel(_0x743eb5);_0x52737e['on']('ready',function(){_0x2164a4[_0x6e70('0x7')]('connection',_0x52737e);});}});});_0x376a8d['on']('error',function(_0x304716){_0x2164a4[_0x6e70('0x7')]('error',new AGIError(_0x6e70('0xf'),_0x304716['code']));});_0x376a8d['on'](_0x6e70('0x13'),function(){_0x2164a4[_0x6e70('0x7')]('close',new AGIError('E_AGI_SERVER_CLOSE'));});}process[_0x6e70('0x14')](function(){_0x36357b();});};util['inherits'](AGIServer,EventEmitter);module[_0x6e70('0x15')]=function(_0x173afe,_0x53acdc,_0x497d61){return new AGIServer(_0x173afe,_0x53acdc,_0x497d61);}; \ No newline at end of file diff --git a/server/services/agi/vertices.js b/server/services/agi/vertices.js index 8e2de5a..0f858f9 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 _0xf0ba=['set','no\x20variable\x20selected','variable_value','start','Enter\x20in\x20START\x20(%s)\x20block','START\x20CALLY\x20SQUARE','XMCS-UNIQUEID','Skipped\x20Answer','subproject','Enter\x20in\x20SUBPROJECT\x20(%s)\x20block','project_id','no\x20subproject\x20found\x20with\x20id\x20%d','project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project','AGI','host','127.0.0.1','system','Enter\x20in\x20SYSTEM\x20(%s)\x20block','command','sh\x20command:\x20%s\x20result\x20no\x20stored','google_cloud_tts','Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block','no\x20apiKey\x20configured','Trying\x20Google\x20Cloud\x20TTS\x20%s','Google\x20Cloud\x20TTS\x20is\x20unreachable','tts','Enter\x20in\x20GOOGLETTS\x20(%s)\x20block','Google\x20TTS\x20%s\x20file\x20created','Google\x20TTS\x20is\x20unreachable','Enter\x20in\x20UNPAUSE\x20(%s)\x20block','Enter\x20in\x20VOICEMAIL\x20(%s)\x20block','VOICEMAIL','vswitch','replaceAll','exports','util','lodash','shelljs','odbc','randomstring','mustache','request-promise','agi','./scripts','rawBody','menu','getdigits','getsecretdigits','channel','rpc','prototype','then','name','catch','getVoiceQueueById','getSquareProject','getSquareProjectById','getSquareOdbc','getSquareOdbcById','dsn','getUser','getUserById','getTrunk','getTrunkById','getSound','getSoundById','save_name','getMailAccount','getMailAccountById','sendMailMessage','mailRpc','getIntervalById','interval','map','Intervals','getSoundPath','format','error','Error\x20getting\x20ODBC\x20connection\x20%s','info','ODBC\x20connection\x20successfully','query','Error\x20executing\x20query\x20%s','Query\x20executed\x20correctly\x20%s','Error\x20closing\x20connection\x20to\x20odbc\x20%s','getSmsAccount','getSmsAccountById','createSmsMessage','createSquareDetailsReport','label','arg_1','callerid','createSquareRecording','uniqueid','calleridname','context','extension','priority','accountcode','dnid','createSquareMessage','createCmContact','isEmpty','random','lastName','phone','list_id','scheduledAt','callback','Callback\x20scheduled\x20at\x20','toString','getPause','getPauseById','agentPause','isNil','agentUnpause','agent','agentLogout','agentLogin','internal','shellCommand','exec','trim','replace','googleCloudTTS','apiKey','google_cloud_tts_text_type','text','ssmlGender','MALE','audioEncoding','googleTTS','restAPI','method','number','timeout','includes','PUT','body','parse','An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function','headers','rawHeaders','An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function','computedVariables','uri','url','render','stringify','statusCode','statusMessage','message','500\x20-\x20Internal\x20Server\x20Error','googleDialogflow','key','dialogflow_language','googleDialogflowV2','dialogflowV2_project_id','dialogflowV2_language','sestekNDA','ispeechTTS','ispeech_tts_language','en-US','speed','ispeechASR','ispeech_asr_language','isConfigured','model','awsPolly','aws_access_key_id','aws_secret_access_key','aws_polly_region','aws_polly_voice','Amy','aws_text_type','awsLex','aws_lex_region','aws_bot_name','googleASR','google_asr_language','appid','clear','agicommand','clone','isString','replaceAllVariables','isPlainObject','recursiveNodeIndex','isArray','length','saveRestApiResult','hasOwnProperty','%s.%s','setVariable','replaceObjectAllVariables','split','getVariable','extra','result','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','retry','maxRetry','Enter\x20in\x20MRCPSynth\x20(%s)\x20block','noop','no\x20text\x20configured','options','MRCPSynth','Executed\x20command\x20MRCPSynth\x20%s','mrcprecog','Enter\x20in\x20MRCPRecog\x20(%s)\x20block','no\x20grammar\x20configured','MRCPRecog','getAndSetVariable','MRCP_RECOG_CONFIDENCE','RECOG_INPUT()','RECOG_INSTANCE()','MRCP_RECOG_INSTANCE','Executed\x20command\x20MRCPRecog\x20%s','Enter\x20in\x20AGI\x20(%s)\x20block','args','answer','Enter\x20in\x20ANSWER\x20(%s)\x20block','Wait\x20%s\x20seconds\x20before\x20answer','wait','Enter\x20in\x20CALLBACK\x20(%s)\x20block','delay','add','callback_priority','sync','Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block','application','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','sestektts','lumenvoxasr','grammar','RECOG_CONFIDENCE()','LUMENVOX_ASR_CONFIDENCE','LUMENVOX_ASR_INSTANCE','sestekasr','Enter\x20in\x20SESTEKASR\x20(%s)\x20block','SESTEK_ASR_TRANSCRIPT','SESTEK_ASR_INSTANCE','odbc_id','no\x20database\x20selected','no\x20odbc\x20database\x20found','no\x20query\x20configured','query:\x20%s','variable_id','no\x20variable\x20selected\x20for\x20the\x20result','no\x20variable\x20found','forEach','keys','%s[%s][%s]','%s_ROWS_COUNT','variable\x20%s\x20set','dial','debug','Enter\x20in\x20DIAL\x20(%s)\x20block','no\x20user\x20selected','sip_id','no\x20user\x20found','DIAL','SIP/%s','dialogflow','no\x20key\x20configured','bot','Trying\x20Dialogflow:\x20%s','out','Dialogflow\x20Result\x20%s','speech','Dialogflow\x20is\x20unreachable','dialogflowV2','Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block','no\x20project_id\x20configured','client_email','no\x20client_email\x20configured','no\x20private_key\x20configured','no\x20anguage\x20configured','Trying\x20DialogflowV2:\x20%s','providerResponse','DIALOGFLOW_%s','toUpperCase','DialogflowV2\x20Result\x20%s','DialogflowV2\x20is\x20unreachable','sesteknda','Enter\x20in\x20SESTEKNDA\x20(%s)\x20block','ndauth_url','no\x20ndauth\x20url\x20configured','password','no\x20password\x20configured','Trying\x20SestekNDA:\x20%s','SESTEK_NDA_%s','audiofile','Sestek\x20NDA\x20%s\x20file\x20created','streamFile','unlink','SestekNDA\x20is\x20unreachable','end','Enter\x20in\x20END\x20(%s)\x20block','ext_dial','Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block','trunk_id','no\x20trunk\x20selected','no\x20trunk\x20found','trunk_name','SIP/%s/%s','opts','finally','Enter\x20in\x20FINALLY\x20(%s)\x20block','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','file_id','no\x20file\x20audio\x20selected','no\x20file\x20audio\x20found','getData','response','maxdigit','mindigit','hiddendigitsnum','hiddendigitspos','first','generate','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','goal','goalname','awspolly','[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block','no\x20valid\x20credentials\x20configured','Trying\x20aws\x20Polly\x20%s','aws\x20Polly\x20%s\x20file\x20created','.wav','aws\x20Polly\x20is\x20unreachable','awslex','Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block','Trying\x20Amazon\x20Lex:\x20%s','AWS_LEX_%s','Amazon\x20Lex\x20ready\x20for\x20fulfillment','amazonlex','Amazon\x20Lex\x20Result\x20%s','Amazon\x20Lex\x20is\x20unreachable','googleasr','wav','%s/recordings/%s','NOBEEP','intKey','google\x20%s\x20file\x20created','GOOGLE_ASR_%s','tildeasr','Enter\x20in\x20TILDEASR\x20(%s)\x20block','no\x20appid\x20configured','appsecret','no\x20appsecret\x20configured','beep','recordFile','tilde\x20%s\x20file\x20created','tildeASR','TILDE_ASR_%s','TildeASR\x20Result\x20%s','gotoc','Enter\x20in\x20GOTO\x20(%s)\x20block','continueAt','gotoif','Enter\x20in\x20GOTOIF\x20(%s)\x20block','no\x20condition\x20configured','true','condition','gotoiftime','Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block','interval_id','no\x20interval\x20configured','IFTIME(%s?true:false)','IFTIME\x20%s\x20%s','false','Enter\x20in\x20HANGUP\x20(%s)\x20block','hangup','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','ISPEECH_ASR_%s','IspeechASR\x20Result\x20%s','ispeechtts','Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block','ispeech\x20%s\x20file\x20created','ispeech\x20TTS\x20is\x20unreachable','login','Enter\x20in\x20LOGIN\x20(%s)\x20block','no\x20find\x20by\x20configured','FIND\x20AGENT\x20%s\x20BY\x20%s','findBy','AGENT\x20%s\x20FOUND\x20BY','success','AGENT\x20%s\x20NOT\x20FOUND\x20BY','failure','logout','Enter\x20in\x20LOGOUT\x20(%s)\x20block','Enter\x20in\x20MATH\x20(%s)\x20block','operation','no\x20operation\x20configured','math\x20%s','%s[%s]','variable\x20%s[key]\x20set','Enter\x20in\x20NOOP\x20(%s)\x20block','output','pause','Enter\x20in\x20PAUSE\x20(%s)\x20block','pause_id','playback','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','Executed\x20command\x20%s\x20%s','queue','queue_id','no\x20queue\x20selected','getVoiceQueue','XMCS-QUEUE','toLowerCase','QUEUE','macro','position','record','Enter\x20in\x20RECORD\x20(%s)\x20block','%s_%s','Recording\x20%s\x20%s\x20%s\x20%s','escape_digits','Enter\x20in\x20RESTAPI\x20(%s)\x20block','no\x20url\x20configured','Response:','inspect','no\x20variable\x20selected\x20for\x20the\x20response','%s_STATUS_CODE','200','%s_STATUS_MESSAGE','Unable\x20to\x20set\x20result\x20in\x20variable\x20%s','Enter\x20in\x20SAYDIGITS\x20(%s)\x20block','digits','saynumber','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','sayNumber','sayphonetic','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','Enter\x20in\x20SENDMAIL\x20(%s)\x20block','account_id','no\x20mail\x20account\x20configured','Smtp','no\x20mail\x20account\x20found','\x22%s\x22\x20<%s>','bcc','subject','template_id','sendMail\x20message','smtpOptions','Mail\x20message\x20added\x20to\x20outgoing\x20process','sendFax','Enter\x20in\x20SENDFAX\x20(%s)\x20block','SENDFAX\x20block\x20not\x20implemented','Enter\x20in\x20SENDSMS\x20(%s)\x20block','sms_account_id','no\x20sms\x20account\x20configured','no\x20sms\x20account\x20found','sms_text','sendSMS\x20message','Trying\x20SendSMS\x20with\x20account\x20%s'];(function(_0xf51c06,_0x388e5b){var _0x1d5420=function(_0x5e077b){while(--_0x5e077b){_0xf51c06['push'](_0xf51c06['shift']());}};_0x1d5420(++_0x388e5b);}(_0xf0ba,0x1ed));var _0xaf0b=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xf0ba[_0x14add3];return _0x4a174f;};'use strict';var fs=require('fs');var util=require(_0xaf0b('0x0'));var _=require(_0xaf0b('0x1'));var sh=require(_0xaf0b('0x2'));var odbc=require(_0xaf0b('0x3'))();var rs=require(_0xaf0b('0x4'));var moment=require('moment');var Mustache=require(_0xaf0b('0x5'));var rp=require(_0xaf0b('0x6'));var logger=require('../../config/logger')(_0xaf0b('0x7'));var config=require('../../config/environment');var scripts=require(_0xaf0b('0x8'));var FILES_PATH='/var/opt/motion2/server/files';var recursiveMapAttributes=['rawHeaders',_0xaf0b('0x9')];var verticesWithRetry=[_0xaf0b('0xa'),_0xaf0b('0xb'),_0xaf0b('0xc')];var AGIVertices=function(_0xd67a9,_0x5b7f0c,_0x2fac18){this[_0xaf0b('0xd')]=_0xd67a9;this[_0xaf0b('0xe')]=_0x5b7f0c;this['mailRpc']=_0x2fac18;};AGIVertices[_0xaf0b('0xf')]['getVariable']=function(_0x3261b8,_0x758a23){this[_0xaf0b('0xe')]['getVariableById'](_0x3261b8)[_0xaf0b('0x10')](function(_0x385633){_0x758a23(null,_0x385633?_0x385633[_0xaf0b('0x11')]:![]);})[_0xaf0b('0x12')](function(_0x283de8){_0x758a23(_0x283de8);});};AGIVertices[_0xaf0b('0xf')]['getVoiceQueue']=function(_0x16282b,_0xdbd3d6){this[_0xaf0b('0xe')][_0xaf0b('0x13')](_0x16282b)['then'](function(_0x317cbf){_0xdbd3d6(null,_0x317cbf?_0x317cbf[_0xaf0b('0x11')]:![]);})[_0xaf0b('0x12')](function(_0x2cb9a2){_0xdbd3d6(_0x2cb9a2);});};AGIVertices[_0xaf0b('0xf')][_0xaf0b('0x14')]=function(_0x2afbae,_0x1f1308){this['rpc'][_0xaf0b('0x15')](_0x2afbae)['then'](function(_0x152f69){_0x1f1308(null,_0x152f69?_0x152f69[_0xaf0b('0x11')]:![]);})[_0xaf0b('0x12')](function(_0xbe0d1e){_0x1f1308(_0xbe0d1e);});};AGIVertices[_0xaf0b('0xf')][_0xaf0b('0x16')]=function(_0x1a32c2,_0x217a08){this[_0xaf0b('0xe')][_0xaf0b('0x17')](_0x1a32c2)['then'](function(_0x29c3df){_0x217a08(null,_0x29c3df?_0x29c3df[_0xaf0b('0x18')]:![]);})[_0xaf0b('0x12')](function(_0x546303){_0x217a08(_0x546303);});};AGIVertices[_0xaf0b('0xf')][_0xaf0b('0x19')]=function(_0x4904b3,_0x3f77d5){this[_0xaf0b('0xe')][_0xaf0b('0x1a')](_0x4904b3)[_0xaf0b('0x10')](function(_0x1a7b68){_0x3f77d5(null,_0x1a7b68?_0x1a7b68['name']:![]);})['catch'](function(_0x4541c5){_0x3f77d5(_0x4541c5);});};AGIVertices[_0xaf0b('0xf')][_0xaf0b('0x1b')]=function(_0x24ca9d,_0x24f78c){this[_0xaf0b('0xe')][_0xaf0b('0x1c')](_0x24ca9d)[_0xaf0b('0x10')](function(_0x5396f2){_0x24f78c(null,_0x5396f2?_0x5396f2[_0xaf0b('0x11')]:![]);})[_0xaf0b('0x12')](function(_0x3a4820){_0x24f78c(_0x3a4820);});};AGIVertices['prototype'][_0xaf0b('0x1d')]=function(_0x3d1a23,_0x54c3be){var _0x5a3e1b=this;this['rpc'][_0xaf0b('0x1e')](_0x3d1a23)[_0xaf0b('0x10')](function(_0x862513){_0x54c3be(null,_0x862513?_0x5a3e1b['getSoundPath'](_0x862513[_0xaf0b('0x1f')]):![]);})[_0xaf0b('0x12')](function(_0x4b9031){_0x54c3be(_0x4b9031);});};AGIVertices[_0xaf0b('0xf')][_0xaf0b('0x20')]=function(_0x246e23,_0x159389){this['rpc'][_0xaf0b('0x21')](_0x246e23)[_0xaf0b('0x10')](function(_0x4beee6){_0x159389(null,_0x4beee6?_0x4beee6:![]);})[_0xaf0b('0x12')](function(_0x1dcd89){_0x159389(_0x1dcd89);});};AGIVertices[_0xaf0b('0xf')][_0xaf0b('0x22')]=function(_0x3935ca,_0x28d0a3,_0x3d6112){this[_0xaf0b('0x23')][_0xaf0b('0x22')](_0x3935ca,_0x28d0a3)['then'](function(){_0x3d6112(null);})[_0xaf0b('0x12')](function(_0x588726){_0x3d6112(_0x588726);});};AGIVertices['prototype']['getIntervals']=function(_0x1d6771,_0x3b0f51){this[_0xaf0b('0xe')][_0xaf0b('0x24')](_0x1d6771)[_0xaf0b('0x10')](function(_0x460e37){if(_0x460e37){if(_0x460e37['IntervalId']){_0x3b0f51(null,[_0x460e37[_0xaf0b('0x25')]]);}else{_0x3b0f51(null,_[_0xaf0b('0x26')](_0x460e37[_0xaf0b('0x27')],_0xaf0b('0x25')));}}else{_0x3b0f51(null,![]);}})[_0xaf0b('0x12')](function(_0x3a17e0){_0x3b0f51(_0x3a17e0);});};AGIVertices[_0xaf0b('0xf')][_0xaf0b('0x28')]=function(_0xf18f8){return util[_0xaf0b('0x29')]('%s/sounds/converted/%s',FILES_PATH,_0xf18f8);};AGIVertices[_0xaf0b('0xf')]['getQueryOdbc']=function(_0x2ed4bd,_0x478dec,_0x1f429d){odbc['open'](_0x2ed4bd,function(_0xc7ceff){if(_0xc7ceff){logger[_0xaf0b('0x2a')](_0xaf0b('0x2b'),_0xc7ceff);_0x1f429d(_0xc7ceff);}else{logger[_0xaf0b('0x2c')](_0xaf0b('0x2d'));odbc[_0xaf0b('0x2e')](_0x478dec,function(_0x39e8ec,_0x53df94){if(_0x39e8ec){logger[_0xaf0b('0x2c')](_0xaf0b('0x2f'),_0x478dec);_0x1f429d(_0x39e8ec);}else{logger[_0xaf0b('0x2c')](_0xaf0b('0x30'),_0x478dec);odbc['close'](function(_0xf44ffd){if(_0xf44ffd){logger[_0xaf0b('0x2a')](_0xaf0b('0x31'),_0xf44ffd);}_0x1f429d(null,_0x53df94);});}});}});};AGIVertices[_0xaf0b('0xf')][_0xaf0b('0x32')]=function(_0x5df6d2,_0x21ef80){this[_0xaf0b('0xe')][_0xaf0b('0x33')](_0x5df6d2)[_0xaf0b('0x10')](function(_0x185d64){_0x21ef80(null,_0x185d64?_0x185d64:![]);})[_0xaf0b('0x12')](function(_0x41e4c5){_0x21ef80(_0x41e4c5);});};AGIVertices['prototype'][_0xaf0b('0x34')]=function(_0x4a7160,_0x3d12b2){this[_0xaf0b('0xe')][_0xaf0b('0x34')](_0x4a7160)[_0xaf0b('0x10')](function(_0x3c0e4b){_0x3d12b2(null,_0x3c0e4b);})[_0xaf0b('0x12')](function(_0x29a249){_0x3d12b2(_0x29a249);});};AGIVertices[_0xaf0b('0xf')][_0xaf0b('0x35')]=function(_0x4b604d,_0x1e0743,_0x1521c1){this[_0xaf0b('0xe')][_0xaf0b('0x35')]({'uniqueid':this[_0xaf0b('0xd')]['uniqueid'],'node':_0x4b604d[_0xaf0b('0x36')],'application':_0x4b604d['agicommand'],'data':_0x1e0743||null,'project_name':this[_0xaf0b('0xd')][_0xaf0b('0x37')],'callerid':this[_0xaf0b('0xd')][_0xaf0b('0x38')]})[_0xaf0b('0x10')](function(_0x2fa23b){if(_0x1521c1){_0x1521c1(null,_0x2fa23b);}})[_0xaf0b('0x12')](function(_0x1acc55){if(_0x1521c1){_0x1521c1(_0x1acc55);}});};AGIVertices[_0xaf0b('0xf')]['createSquareRecording']=function(_0x2e314a,_0x3fa620,_0x4d5ced,_0x3dc17c){this[_0xaf0b('0xe')][_0xaf0b('0x39')]({'uniqueid':this[_0xaf0b('0xd')][_0xaf0b('0x3a')],'callerid':this[_0xaf0b('0xd')][_0xaf0b('0x38')],'calleridname':this[_0xaf0b('0xd')][_0xaf0b('0x3b')],'context':this[_0xaf0b('0xd')][_0xaf0b('0x3c')],'extension':this['channel'][_0xaf0b('0x3d')],'priority':this[_0xaf0b('0xd')][_0xaf0b('0x3e')],'accountcode':this[_0xaf0b('0xd')][_0xaf0b('0x3f')],'dnid':this[_0xaf0b('0xd')][_0xaf0b('0x40')],'projectName':this[_0xaf0b('0xd')][_0xaf0b('0x37')],'saveName':_0x3fa620,'filename':_0x2e314a['file']||_0x3fa620,'savePath':_0x4d5ced})[_0xaf0b('0x10')](function(_0x598904){_0x3dc17c(null,_0x598904);})[_0xaf0b('0x12')](function(_0x3f8e17){_0x3dc17c(_0x3f8e17);});};AGIVertices[_0xaf0b('0xf')][_0xaf0b('0x41')]=function(_0x2064b6,_0x2d865f,_0x4d3f0e,_0x54922c,_0x321181){this[_0xaf0b('0xe')][_0xaf0b('0x41')]({'uniqueid':this[_0xaf0b('0xd')][_0xaf0b('0x3a')],'body':_0x2064b6,'direction':_0x2d865f,'providerName':_0x4d3f0e,'providerResponse':_0x54922c})['then'](function(_0x3e9b52){if(_0x321181){_0x321181(null,_0x3e9b52);}})[_0xaf0b('0x12')](function(_0x3cc93f){if(_0x321181){_0x321181(_0x3cc93f);}});};AGIVertices[_0xaf0b('0xf')][_0xaf0b('0x42')]=function(_0x11c1d1,_0xc9d8c3){this['rpc'][_0xaf0b('0x42')]({'firstName':_[_0xaf0b('0x43')](_0x11c1d1[_0xaf0b('0x11')])||_['isNil'](_0x11c1d1[_0xaf0b('0x11')])?'callback_'+Math[_0xaf0b('0x44')]():_0x11c1d1[_0xaf0b('0x11')],'lastName':_[_0xaf0b('0x43')](_0x11c1d1[_0xaf0b('0x45')])||_['isNil'](_0x11c1d1[_0xaf0b('0x45')])?null:_0x11c1d1[_0xaf0b('0x45')],'phone':_0x11c1d1[_0xaf0b('0x46')],'ListId':_0x11c1d1[_0xaf0b('0x47')],'scheduledat':_0x11c1d1[_0xaf0b('0x48')],'callbackUniqueid':this[_0xaf0b('0xd')][_0xaf0b('0x3a')],'tags':_0xaf0b('0x49'),'description':_0xaf0b('0x4a')+_0x11c1d1['scheduledAt'][_0xaf0b('0x4b')](),'priority':_0x11c1d1['callback_priority']})[_0xaf0b('0x10')](function(_0x102da9){_0xc9d8c3(null,_0x102da9);})['catch'](function(_0x5e6d85){_0xc9d8c3(_0x5e6d85);});};AGIVertices[_0xaf0b('0xf')][_0xaf0b('0x4c')]=function(_0x586dd2,_0x2a229c){this['rpc'][_0xaf0b('0x4d')](_0x586dd2)[_0xaf0b('0x10')](function(_0x2d21ae){_0x2a229c(null,_0x2d21ae?_0x2d21ae['name']:![]);})[_0xaf0b('0x12')](function(_0xa6a4a2){_0x2a229c(_0xa6a4a2);});};AGIVertices[_0xaf0b('0xf')][_0xaf0b('0x4e')]=function(_0x29ea6b,_0x5e17d1,_0xfeddb9){var _0x1ce3ab={'role':'agent'};_0x1ce3ab[_0x29ea6b]=this[_0xaf0b('0xd')][_0xaf0b('0x38')];this[_0xaf0b('0xe')][_0xaf0b('0x4e')](_0x1ce3ab,_0x5e17d1,this[_0xaf0b('0xd')][_0xaf0b('0x3a')])[_0xaf0b('0x10')](function(_0x1aa20){_0xfeddb9(null,_[_0xaf0b('0x4f')](_0x1aa20)?![]:!![]);})[_0xaf0b('0x12')](function(_0x55cc97){logger[_0xaf0b('0x2a')](_0x55cc97);_0xfeddb9(null,![]);});};AGIVertices[_0xaf0b('0xf')][_0xaf0b('0x50')]=function(_0x42a4b4,_0x5ed57d){var _0x2189b7={'role':_0xaf0b('0x51')};_0x2189b7[_0x42a4b4]=this['channel']['callerid'];this[_0xaf0b('0xe')][_0xaf0b('0x50')](_0x2189b7)[_0xaf0b('0x10')](function(_0x486f73){_0x5ed57d(null,_['isNil'](_0x486f73)?![]:!![]);})['catch'](function(_0x4db608){logger['error'](_0x4db608);_0x5ed57d(null,![]);});};AGIVertices[_0xaf0b('0xf')][_0xaf0b('0x52')]=function(_0x9cf508,_0x939992){var _0x2db367={'role':'agent'};_0x2db367[_0x9cf508]=this[_0xaf0b('0xd')]['callerid'];this[_0xaf0b('0xe')][_0xaf0b('0x52')](_0x2db367)[_0xaf0b('0x10')](function(_0x409e41){_0x939992(null,_['isNil'](_0x409e41)?![]:!![]);})['catch'](function(_0x211d27){logger['error'](_0x211d27);_0x939992(null,![]);});};AGIVertices[_0xaf0b('0xf')][_0xaf0b('0x53')]=function(_0x5ce7c6,_0x2c5c3d){var _0x15d37e={'role':'agent'};_0x15d37e[_0x5ce7c6]=this['channel']['callerid'];var _0x16933c=_0x5ce7c6!=_0xaf0b('0x54')?util['format']('%s/%s@from-sip/n','LOCAL',this[_0xaf0b('0xd')]['callerid']):undefined;this['rpc'][_0xaf0b('0x53')](_0x15d37e,_0x16933c)[_0xaf0b('0x10')](function(_0x343073){_0x2c5c3d(null,_[_0xaf0b('0x4f')](_0x343073)?![]:!![]);})['catch'](function(_0x25554f){logger[_0xaf0b('0x2a')](_0x25554f);_0x2c5c3d(null,![]);});};AGIVertices[_0xaf0b('0xf')][_0xaf0b('0x55')]=function(_0x295ce6,_0x14d082){sh[_0xaf0b('0x56')](_[_0xaf0b('0x57')](_0x295ce6),function(_0x20a90c,_0x280534){var _0x4a5193=_0x280534[_0xaf0b('0x58')](/(\r\n|\n|\r)/gm,'');_0x14d082(null,_0x4a5193);});};AGIVertices[_0xaf0b('0xf')]['googleCloudTTS']=function(_0x2da4b4,_0x49f603){scripts[_0xaf0b('0x59')](_0x2da4b4[_0xaf0b('0x5a')],_0x2da4b4[_0xaf0b('0x5b')]||_0xaf0b('0x5c'),_0x2da4b4[_0xaf0b('0x5c')],_0x2da4b4['languageCode']||'en-US',_0x2da4b4[_0xaf0b('0x5d')]||_0xaf0b('0x5e'),_0x2da4b4[_0xaf0b('0x5f')]||'MP3')[_0xaf0b('0x10')](function(_0x2d4349){_0x49f603(null,_0x2d4349);})[_0xaf0b('0x12')](function(_0x270105){_0x49f603(_0x270105);});};AGIVertices['prototype'][_0xaf0b('0x60')]=function(_0x147a9a,_0x4d1a6e){scripts[_0xaf0b('0x60')](_0x147a9a[_0xaf0b('0x5c')],_0x147a9a['google_tts_language']||'en',0x1)[_0xaf0b('0x10')](function(_0xf9371f){_0x4d1a6e(null,_0xf9371f);})['catch'](function(_0x2bf83f){_0x4d1a6e(_0x2bf83f);});};AGIVertices[_0xaf0b('0xf')][_0xaf0b('0x61')]=function(_0x4caa18,_0x59d425){var _0x19ff45={'uri':_0x4caa18['url'],'method':_0x4caa18[_0xaf0b('0x62')],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0x4caa18['timeout'])===_0xaf0b('0x63')&&parseInt(_0x4caa18['timeout'])>=0x1?parseInt(_0x4caa18[_0xaf0b('0x64')])*0x3e8:0x5*0x3e8};if(_[_0xaf0b('0x65')](['POST',_0xaf0b('0x66')],_0x19ff45[_0xaf0b('0x62')]['toUpperCase']())){try{_0x19ff45[_0xaf0b('0x67')]=_0x4caa18[_0xaf0b('0x9')]?JSON[_0xaf0b('0x68')](_0x4caa18[_0xaf0b('0x9')]):{};}catch(_0x58c774){logger[_0xaf0b('0x2a')](_0xaf0b('0x69'),_0x58c774);}}try{_0x19ff45[_0xaf0b('0x6a')]=_0x4caa18['rawHeaders']?JSON[_0xaf0b('0x68')](_0x4caa18[_0xaf0b('0x6b')]):{};}catch(_0x20904a){logger[_0xaf0b('0x2a')](_0xaf0b('0x6c'),_0x20904a);}if(_0x4caa18['computedVariables']){try{var _0x4a9a7a=require(_0x4caa18[_0xaf0b('0x6d')])['sync'](this,_0x19ff45);_0x19ff45[_0xaf0b('0x6e')]=Mustache['render'](_0x4caa18[_0xaf0b('0x6f')],_0x4a9a7a,{},['$$','$$']);if(_0x19ff45[_0xaf0b('0x6a')]){_0x19ff45[_0xaf0b('0x6a')]=JSON[_0xaf0b('0x68')](Mustache[_0xaf0b('0x70')](JSON[_0xaf0b('0x71')](_0x19ff45[_0xaf0b('0x6a')]),_0x4a9a7a,{},['$$','$$']));}if(_0x19ff45[_0xaf0b('0x67')]){_0x19ff45['body']=JSON[_0xaf0b('0x68')](Mustache[_0xaf0b('0x70')](JSON[_0xaf0b('0x71')](_0x19ff45[_0xaf0b('0x67')]),_0x4a9a7a,{},['$$','$$']));}}catch(_0x3f7f1c){logger[_0xaf0b('0x2a')]('An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function',_0x3f7f1c);}}rp(_0x19ff45)[_0xaf0b('0x10')](function(_0x5c68ab){var _0x526039={'statusCode':_0x5c68ab[_0xaf0b('0x72')]||0xc8,'statusMessage':_0x5c68ab[_0xaf0b('0x73')]||'OK','headers':_0x5c68ab['headers']||{},'body':_0x5c68ab['body']||{}};_0x59d425(null,_0x526039);})[_0xaf0b('0x12')](function(_0x11fbfe){var _0x203019={'statusCode':_0x11fbfe[_0xaf0b('0x72')]||0x1f4,'statusMessage':_0x11fbfe[_0xaf0b('0x74')]||_0xaf0b('0x75'),'headers':_0x11fbfe['options'][_0xaf0b('0x6a')]||{},'body':_0x11fbfe['options'][_0xaf0b('0x67')]||{}};_0x59d425(null,_0x203019);});};AGIVertices[_0xaf0b('0xf')][_0xaf0b('0x76')]=function(_0x3a591d,_0x3334f8){scripts[_0xaf0b('0x76')](this['channel']['uniqueid'],_0x3a591d[_0xaf0b('0x77')],_0x3a591d[_0xaf0b('0x5c')],_0x3a591d[_0xaf0b('0x78')]||'en')['then'](function(_0x12e271){_0x3334f8(null,_0x12e271);})['catch'](function(_0x46a0d4){_0x3334f8(_0x46a0d4);});};AGIVertices['prototype'][_0xaf0b('0x79')]=function(_0x52ad66,_0x475268){scripts[_0xaf0b('0x79')](this[_0xaf0b('0xd')][_0xaf0b('0x3a')],_0x52ad66[_0xaf0b('0x7a')],_0x52ad66['client_email'],_0x52ad66['private_key'],_0x52ad66[_0xaf0b('0x5c')],_0x52ad66[_0xaf0b('0x7b')]||'en')['then'](function(_0x2d9af2){_0x475268(null,_0x2d9af2);})[_0xaf0b('0x12')](function(_0x2a5235){_0x475268(_0x2a5235);});};AGIVertices[_0xaf0b('0xf')][_0xaf0b('0x7c')]=function(_0x193b54,_0x221186){scripts[_0xaf0b('0x7c')](this[_0xaf0b('0xd')],_0x193b54)[_0xaf0b('0x10')](function(_0x5e7875){_0x221186(null,_0x5e7875);})[_0xaf0b('0x12')](function(_0x4a3f4a){_0x221186(_0x4a3f4a);});};AGIVertices['prototype'][_0xaf0b('0x7d')]=function(_0x4ce09c,_0x557671){scripts[_0xaf0b('0x7d')](_0x4ce09c[_0xaf0b('0x77')],_0x4ce09c[_0xaf0b('0x5c')],_0x4ce09c[_0xaf0b('0x7e')]||_0xaf0b('0x7f'),_0x4ce09c[_0xaf0b('0x80')])[_0xaf0b('0x10')](function(_0x383d9e){_0x557671(null,_0x383d9e);})[_0xaf0b('0x12')](function(_0x4bb377){_0x557671(_0x4bb377);});};AGIVertices[_0xaf0b('0xf')][_0xaf0b('0x81')]=function(_0xc26217,_0x1489d4,_0x2a6310){scripts[_0xaf0b('0x81')](_0x1489d4,_0xc26217[_0xaf0b('0x77')],_0xc26217[_0xaf0b('0x82')]||_0xaf0b('0x7f'),this[_0xaf0b('0x83')](_0xc26217[_0xaf0b('0x84')])?_0xc26217[_0xaf0b('0x84')]:undefined)[_0xaf0b('0x10')](function(_0x5317c7){_0x2a6310(null,_0x5317c7);})[_0xaf0b('0x12')](function(_0xa63fbb){_0x2a6310(_0xa63fbb);});};AGIVertices[_0xaf0b('0xf')][_0xaf0b('0x85')]=function(_0x1a97d2,_0x55003a){scripts[_0xaf0b('0x85')](_0x1a97d2[_0xaf0b('0x86')],_0x1a97d2[_0xaf0b('0x87')],_0x1a97d2[_0xaf0b('0x88')],_0x1a97d2[_0xaf0b('0x89')]||_0xaf0b('0x8a'),_0x1a97d2[_0xaf0b('0x5c')],_0x1a97d2[_0xaf0b('0x8b')]||_0xaf0b('0x5c'))[_0xaf0b('0x10')](function(_0x1f8e36){_0x55003a(null,_0x1f8e36);})[_0xaf0b('0x12')](function(_0x4a08b0){_0x55003a(_0x4a08b0);});};AGIVertices[_0xaf0b('0xf')][_0xaf0b('0x8c')]=function(_0x4b360c,_0x2e5f16){scripts['awsLex'](this[_0xaf0b('0xd')][_0xaf0b('0x3a')],_0x4b360c[_0xaf0b('0x86')],_0x4b360c[_0xaf0b('0x87')],_0x4b360c[_0xaf0b('0x8d')],_0x4b360c[_0xaf0b('0x5c')],_0x4b360c[_0xaf0b('0x8e')])[_0xaf0b('0x10')](function(_0x1ee7ed){_0x2e5f16(null,_0x1ee7ed);})[_0xaf0b('0x12')](function(_0x5beceb){_0x2e5f16(_0x5beceb);});};AGIVertices[_0xaf0b('0xf')]['googleASR']=function(_0x1ccdd5,_0x3e7bff,_0x402a82){scripts[_0xaf0b('0x8f')](_0x3e7bff,_0x1ccdd5[_0xaf0b('0x77')],_0x1ccdd5[_0xaf0b('0x90')]||'en-US')['then'](function(_0xbce52b){_0x402a82(null,_0xbce52b);})[_0xaf0b('0x12')](function(_0x28a66e){_0x402a82(_0x28a66e);});};AGIVertices[_0xaf0b('0xf')]['tildeASR']=function(_0x3c281d,_0x254392,_0x23e7d5){scripts['tildeASR'](_0x254392,_0x3c281d[_0xaf0b('0x91')],_0x3c281d['appsecret'],_0x3c281d[_0xaf0b('0x6e')])[_0xaf0b('0x10')](function(_0x54d554){_0x23e7d5(null,_0x54d554);})[_0xaf0b('0x12')](function(_0x1c3241){_0x23e7d5(_0x1c3241);});};AGIVertices[_0xaf0b('0xf')][_0xaf0b('0x92')]=function(_0x30095b){var _0x4a0f30=_[_0xaf0b('0x65')](verticesWithRetry,_0x30095b[_0xaf0b('0x93')])?_0x30095b:_[_0xaf0b('0x94')](_0x30095b);for(var _0x2eb732 in _0x4a0f30){if(_0x4a0f30['hasOwnProperty'](_0x2eb732)){if(_0x4a0f30[_0x2eb732]&&_[_0xaf0b('0x95')](_0x4a0f30[_0x2eb732])){if(_[_0xaf0b('0x65')](recursiveMapAttributes,_0x2eb732)){_0x4a0f30[_0x2eb732]=this['replaceObjectAllVariables'](_0x4a0f30[_0x2eb732]);}else{_0x4a0f30[_0x2eb732]=this[_0xaf0b('0x96')](_0x4a0f30[_0x2eb732]);}}}}return _0x4a0f30;};AGIVertices['prototype']['recursiveNodeIndex']=function(_0x499d78){for(var _0x2320fc in _0x499d78){if(_0x499d78['hasOwnProperty'](_0x2320fc)){if(_[_0xaf0b('0x97')](_0x499d78[_0x2320fc])){this[_0xaf0b('0x98')](_0x499d78[_0x2320fc]);}else if(_[_0xaf0b('0x99')](_0x499d78[_0x2320fc])){for(var _0x4d5550=0x0;_0x4d5550<_0x499d78[_0x2320fc][_0xaf0b('0x9a')];_0x4d5550++){this[_0xaf0b('0x98')](_0x499d78[_0x2320fc][_0x4d5550]);}}else if(_[_0xaf0b('0x95')](_0x499d78[_0x2320fc])){_0x499d78[_0x2320fc]=this['replaceAllVariables'](_0x499d78[_0x2320fc]);}}}};AGIVertices[_0xaf0b('0xf')][_0xaf0b('0x9b')]=function(_0x5d9a66,_0x47269f){for(var _0x3fc941 in _0x5d9a66){if(_0x5d9a66[_0xaf0b('0x9c')](_0x3fc941)){if(_[_0xaf0b('0x97')](_0x5d9a66[_0x3fc941])){if(!_[_0xaf0b('0x43')](_0x5d9a66[_0x3fc941])){this[_0xaf0b('0x9b')](_0x5d9a66[_0x3fc941],util['format'](_0xaf0b('0x9d'),_0x47269f,_0x3fc941));}}else if(_[_0xaf0b('0x99')](_0x5d9a66[_0x3fc941])){for(var _0x3560b8=0x0;_0x3560b8<_0x5d9a66[_0x3fc941][_0xaf0b('0x9a')];_0x3560b8++){this['saveRestApiResult'](_0x5d9a66[_0x3fc941][_0x3560b8],util[_0xaf0b('0x29')](_0xaf0b('0x9d'),_0x47269f,_0x3fc941+'['+_0x3560b8+']'));}}else{if(!_[_0xaf0b('0x4f')](_0x5d9a66[_0x3fc941])){this[_0xaf0b('0xd')][_0xaf0b('0x9e')](util['format'](_0xaf0b('0x9d'),_0x47269f,_0x3fc941),_0x5d9a66[_0x3fc941]);}}}}};AGIVertices[_0xaf0b('0xf')][_0xaf0b('0x9f')]=function(_0x37331e){try{var _0x147982=JSON[_0xaf0b('0x68')](_0x37331e);this[_0xaf0b('0x98')](_0x147982);return JSON[_0xaf0b('0x71')](_0x147982);}catch(_0x2eee90){return this[_0xaf0b('0x96')](_0x37331e);}};AGIVertices[_0xaf0b('0xf')][_0xaf0b('0x96')]=function(_0x673097){var _0x5d3b36=_0x673097[_0xaf0b('0xa0')]('{');for(var _0x5baa0a=0x1;_0x5baa0a<_0x5d3b36[_0xaf0b('0x9a')];_0x5baa0a+=0x1){var _0x2bfba1=_0x5d3b36[_0x5baa0a][_0xaf0b('0xa0')]('}');if(_0x2bfba1['length']>0x1){_0x673097=_0x673097['replaceAll']('{'+_0x2bfba1[0x0]+'}',this['channel'][_0xaf0b('0xa1')](_0x2bfba1[0x0])[_0xaf0b('0xa2')]||_0x2bfba1[0x0]);}}if(_0x5d3b36[_0xaf0b('0x9a')]===0x1){return _0x673097[_0xaf0b('0x4b')]();}return this[_0xaf0b('0x96')](_0x673097);};AGIVertices['prototype']['getAndSetVariable']=function(_0x56ef20,_0x22b98b){var _0x3c9df0=this[_0xaf0b('0xd')][_0xaf0b('0xa1')](_0x56ef20);if(_0x3c9df0[_0xaf0b('0xa3')]===-0x1){return _0x3c9df0;}logger[_0xaf0b('0x2c')](util[_0xaf0b('0x29')](_0xaf0b('0xa4'),_0x22b98b,_0x3c9df0[_0xaf0b('0xa2')]));return this['channel'][_0xaf0b('0x9e')](_0x22b98b,_0x3c9df0[_0xaf0b('0xa2')]);};AGIVertices['prototype']['isConfigured']=function(_0x543cfe){return _0x543cfe&&_0x543cfe!=='0'&&_0x543cfe!=='-1'&&_0x543cfe!=='';};AGIVertices[_0xaf0b('0xf')]['maxRetry']=function(_0x6092bc){this['createSquareDetailsReport']['sync'](this,_0x6092bc,'-');_0x6092bc[_0xaf0b('0xa5')]=_0x6092bc[_0xaf0b('0xa6')];return{'code':0xc8,'result':'-'};};AGIVertices['prototype']['mrcpsynth']=function(_0x430f76){logger['info'](util['format'](_0xaf0b('0xa7'),_0x430f76[_0xaf0b('0x36')]));if(!this['isConfigured'](_0x430f76[_0xaf0b('0x5c')])){return this[_0xaf0b('0xd')][_0xaf0b('0xa8')](_0xaf0b('0xa9'));}var _0x19f4ea='\x22'+_0x430f76[_0xaf0b('0x5c')]+'\x22';if(this[_0xaf0b('0x83')](_0x430f76[_0xaf0b('0xaa')])){_0x19f4ea+=','+_0x430f76['options'];}var _0x3ce1c0=this[_0xaf0b('0xd')][_0xaf0b('0x56')](_0xaf0b('0xab'),_0x19f4ea);if(_0x3ce1c0['result']===-0x1){return _0x3ce1c0;}return this[_0xaf0b('0xd')][_0xaf0b('0xa8')](util[_0xaf0b('0x29')](_0xaf0b('0xac'),_0x19f4ea));};AGIVertices[_0xaf0b('0xf')][_0xaf0b('0xad')]=function(_0x15f206){logger[_0xaf0b('0x2c')](util[_0xaf0b('0x29')](_0xaf0b('0xae'),_0x15f206[_0xaf0b('0x36')]));if(!this[_0xaf0b('0x83')](_0x15f206['grammar'])){return this[_0xaf0b('0xd')]['noop'](_0xaf0b('0xaf'));}var _0x304092=_0x15f206['grammar'];if(this[_0xaf0b('0x83')](_0x15f206[_0xaf0b('0xaa')])){_0x304092+=','+_0x15f206[_0xaf0b('0xaa')];}var _0x443e35=this[_0xaf0b('0xd')]['exec'](_0xaf0b('0xb0'),_0x304092);if(_0x443e35[_0xaf0b('0xa3')]===-0x1){return _0x443e35;}var _0x26979b=this[_0xaf0b('0xb1')]('RECOG_CONFIDENCE()',_0xaf0b('0xb2'));if(_0x26979b[_0xaf0b('0xa3')]===-0x1){return _0x26979b;}var _0x2ad8a7=this['getAndSetVariable'](_0xaf0b('0xb3'),'MRCP_RECOG_TRANSCRIPT');if(_0x2ad8a7[_0xaf0b('0xa3')]===-0x1){return _0x2ad8a7;}var _0x54da9a=this[_0xaf0b('0xb1')](_0xaf0b('0xb4'),_0xaf0b('0xb5'));if(_0x54da9a[_0xaf0b('0xa3')]===-0x1){return _0x54da9a;}return this[_0xaf0b('0xd')][_0xaf0b('0xa8')](util[_0xaf0b('0x29')](_0xaf0b('0xb6'),_0x304092));};AGIVertices[_0xaf0b('0xf')]['agi']=function(_0x3efef6){logger[_0xaf0b('0x2c')](util[_0xaf0b('0x29')](_0xaf0b('0xb7'),_0x3efef6[_0xaf0b('0x36')]));return this[_0xaf0b('0xd')][_0xaf0b('0x7')]([_0x3efef6['command'],_0x3efef6[_0xaf0b('0xb8')]]);};AGIVertices['prototype'][_0xaf0b('0xb9')]=function(_0x5b901b){logger[_0xaf0b('0x2c')](util[_0xaf0b('0x29')](_0xaf0b('0xba'),_0x5b901b[_0xaf0b('0x36')]));if(this[_0xaf0b('0x83')](_0x5b901b[_0xaf0b('0x64')])){logger[_0xaf0b('0x2c')](util[_0xaf0b('0x29')](_0xaf0b('0xbb'),_0x5b901b[_0xaf0b('0x64')]));var _0xea8245=this[_0xaf0b('0xd')][_0xaf0b('0xbc')](_0x5b901b[_0xaf0b('0x64')]);if(_0xea8245['result']===-0x1){return _0xea8245;}}return this[_0xaf0b('0xd')][_0xaf0b('0xb9')]();};AGIVertices[_0xaf0b('0xf')][_0xaf0b('0x49')]=function(_0xd38f01){logger[_0xaf0b('0x2c')](util['format'](_0xaf0b('0xbd'),_0xd38f01[_0xaf0b('0x36')]));if(!this[_0xaf0b('0x83')](_0xd38f01[_0xaf0b('0x47')])){return this[_0xaf0b('0xd')][_0xaf0b('0x2a')](_0xd38f01,'no\x20list\x20selected');}_0xd38f01[_0xaf0b('0x48')]=moment();if(this[_0xaf0b('0x83')](_0xd38f01[_0xaf0b('0xbe')])){_0xd38f01['scheduledAt']=moment()[_0xaf0b('0xbf')](_0xd38f01['delay'],'minutes');}if(!this['isConfigured'](_0xd38f01[_0xaf0b('0xc0')])){_0xd38f01[_0xaf0b('0xc0')]=0x2;}this['createCmContact'][_0xaf0b('0xc1')](this,_0xd38f01);return this[_0xaf0b('0xd')][_0xaf0b('0xa8')](util[_0xaf0b('0x29')]('CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s',_0xd38f01['phone'],_0xd38f01[_0xaf0b('0x47')],_0xd38f01['scheduledAt']));};AGIVertices[_0xaf0b('0xf')]['custom_app']=function(_0x5c8de4){logger['info'](util['format'](_0xaf0b('0xc2'),_0x5c8de4[_0xaf0b('0x36')]));var _0x1297d9=this['channel'][_0xaf0b('0x56')](_0x5c8de4[_0xaf0b('0xc3')],_0x5c8de4[_0xaf0b('0xaa')]);if(_0x1297d9[_0xaf0b('0xa3')]===-0x1){return _0x1297d9;}return this[_0xaf0b('0xd')][_0xaf0b('0xa8')](util['format']('Executed\x20command\x20%s\x20%s',_0x5c8de4[_0xaf0b('0xc3')],_0x5c8de4[_0xaf0b('0xaa')]));};AGIVertices[_0xaf0b('0xf')]['lumenvoxtts']=function(_0x98a5d3){logger[_0xaf0b('0x2c')](util[_0xaf0b('0x29')](_0xaf0b('0xc4'),_0x98a5d3[_0xaf0b('0x36')]));if(!this[_0xaf0b('0x83')](_0x98a5d3[_0xaf0b('0x5c')])){return this[_0xaf0b('0xd')][_0xaf0b('0xa8')]('no\x20text\x20configured');}var _0x49edca='\x22'+_0x98a5d3[_0xaf0b('0x5c')]+'\x22';if(this['isConfigured'](_0x98a5d3[_0xaf0b('0xaa')])){_0x49edca+=','+_0x98a5d3['options'];}var _0x3d551b=this[_0xaf0b('0xd')][_0xaf0b('0x56')](_0xaf0b('0xab'),_0x49edca);if(_0x3d551b[_0xaf0b('0xa3')]===-0x1){return _0x3d551b;}return this[_0xaf0b('0xd')][_0xaf0b('0xa8')](util[_0xaf0b('0x29')](_0xaf0b('0xac'),_0x49edca));};AGIVertices['prototype'][_0xaf0b('0xc5')]=function(_0x5bb93f){logger[_0xaf0b('0x2c')](util[_0xaf0b('0x29')]('Enter\x20in\x20SESTEKTTS\x20(%s)\x20block',_0x5bb93f[_0xaf0b('0x36')]));if(!this[_0xaf0b('0x83')](_0x5bb93f[_0xaf0b('0x5c')])){return this[_0xaf0b('0xd')][_0xaf0b('0xa8')]('no\x20text\x20configured');}var _0x19b9b3='\x22'+_0x5bb93f[_0xaf0b('0x5c')]+'\x22';if(this[_0xaf0b('0x83')](_0x5bb93f['options'])){_0x19b9b3+=','+_0x5bb93f['options'];}var _0x3042a7=this['channel'][_0xaf0b('0x56')](_0xaf0b('0xab'),_0x19b9b3);if(_0x3042a7[_0xaf0b('0xa3')]===-0x1){return _0x3042a7;}return this[_0xaf0b('0xd')][_0xaf0b('0xa8')](util['format'](_0xaf0b('0xac'),_0x19b9b3));};AGIVertices['prototype'][_0xaf0b('0xc6')]=function(_0x5d038f){logger[_0xaf0b('0x2c')](util[_0xaf0b('0x29')]('Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block',_0x5d038f[_0xaf0b('0x36')]));if(!this[_0xaf0b('0x83')](_0x5d038f[_0xaf0b('0xc7')])){return this[_0xaf0b('0xd')][_0xaf0b('0xa8')](_0xaf0b('0xaf'));}var _0x863398=_0x5d038f[_0xaf0b('0xc7')];if(this[_0xaf0b('0x83')](_0x5d038f[_0xaf0b('0xaa')])){_0x863398+=','+_0x5d038f[_0xaf0b('0xaa')];}var _0x4e540e=this[_0xaf0b('0xd')]['exec'](_0xaf0b('0xb0'),_0x863398);if(_0x4e540e[_0xaf0b('0xa3')]===-0x1){return _0x4e540e;}var _0x33edb2=this['getAndSetVariable'](_0xaf0b('0xc8'),_0xaf0b('0xc9'));if(_0x33edb2[_0xaf0b('0xa3')]===-0x1){return _0x33edb2;}var _0x24ea00=this[_0xaf0b('0xb1')](_0xaf0b('0xb3'),'LUMENVOX_ASR_TRANSCRIPT');if(_0x24ea00[_0xaf0b('0xa3')]===-0x1){return _0x24ea00;}var _0x443afc=this['getAndSetVariable'](_0xaf0b('0xb4'),_0xaf0b('0xca'));if(_0x443afc['result']===-0x1){return _0x443afc;}return this[_0xaf0b('0xd')][_0xaf0b('0xa8')](util['format'](_0xaf0b('0xb6'),_0x863398));};AGIVertices[_0xaf0b('0xf')][_0xaf0b('0xcb')]=function(_0x2aafa1){logger['info'](util[_0xaf0b('0x29')](_0xaf0b('0xcc'),_0x2aafa1[_0xaf0b('0x36')]));if(!this[_0xaf0b('0x83')](_0x2aafa1[_0xaf0b('0xc7')])){return this[_0xaf0b('0xd')][_0xaf0b('0xa8')]('no\x20grammar\x20configured');}var _0x989c3f=_0x2aafa1[_0xaf0b('0xc7')];if(this[_0xaf0b('0x83')](_0x2aafa1[_0xaf0b('0xaa')])){_0x989c3f+=','+_0x2aafa1[_0xaf0b('0xaa')];}var _0x25ed49=this[_0xaf0b('0xd')][_0xaf0b('0x56')](_0xaf0b('0xb0'),_0x989c3f);if(_0x25ed49['result']===-0x1){return _0x25ed49;}var _0x334d81=this['getAndSetVariable']('RECOG_CONFIDENCE()','SESTEK_ASR_CONFIDENCE');if(_0x334d81[_0xaf0b('0xa3')]===-0x1){return _0x334d81;}var _0x47b5dd=this[_0xaf0b('0xb1')](_0xaf0b('0xb3'),_0xaf0b('0xcd'));if(_0x47b5dd[_0xaf0b('0xa3')]===-0x1){return _0x47b5dd;}var _0x223350=this[_0xaf0b('0xb1')](_0xaf0b('0xb4'),_0xaf0b('0xce'));if(_0x223350['result']===-0x1){return _0x223350;}return this[_0xaf0b('0xd')]['noop'](util['format']('Executed\x20command\x20MRCPRecog\x20%s',_0x989c3f));};AGIVertices[_0xaf0b('0xf')]['database']=function(_0x13fbf4){logger[_0xaf0b('0x2c')](util[_0xaf0b('0x29')]('Enter\x20in\x20DATABASE\x20(%s)\x20block',_0x13fbf4[_0xaf0b('0x36')]));if(!this[_0xaf0b('0x83')](_0x13fbf4[_0xaf0b('0xcf')])){return this['channel'][_0xaf0b('0x2a')](_0x13fbf4,_0xaf0b('0xd0'));}var _0x38b9c6=this[_0xaf0b('0x16')][_0xaf0b('0xc1')](this,_0x13fbf4[_0xaf0b('0xcf')]);if(!_0x38b9c6){return this[_0xaf0b('0xd')][_0xaf0b('0x2a')](_0x13fbf4,_0xaf0b('0xd1'));}if(!this[_0xaf0b('0x83')](_0x13fbf4[_0xaf0b('0x2e')])){return this[_0xaf0b('0xd')][_0xaf0b('0x2a')](_0x13fbf4,_0xaf0b('0xd2'));}var _0x64eb5=_0x13fbf4[_0xaf0b('0x2e')][_0xaf0b('0x58')](/(\r\n|\n|\r)/gm,'\x20');this['channel']['noop'](util['format'](_0xaf0b('0xd3'),_0x64eb5));var _0x4f8c4d=this['getQueryOdbc'][_0xaf0b('0xc1')](this,_0x38b9c6,_0x64eb5);this[_0xaf0b('0x35')][_0xaf0b('0xc1')](this,_0x13fbf4,_0x64eb5);if(!this['isConfigured'](_0x13fbf4[_0xaf0b('0xd4')])){return this[_0xaf0b('0xd')][_0xaf0b('0xa8')](_0xaf0b('0xd5'));}var _0x599abc=this[_0xaf0b('0xa1')]['sync'](this,_0x13fbf4[_0xaf0b('0xd4')]);if(!_0x599abc){return this[_0xaf0b('0xd')][_0xaf0b('0x2a')](_0x13fbf4,_0xaf0b('0xd6'));}var _0x1e887e=this;_0x4f8c4d[_0xaf0b('0xd7')](function(_0x53a820,_0x31d5ad){Object[_0xaf0b('0xd8')](_0x53a820)[_0xaf0b('0xd7')](function(_0x2ae51c){_0x1e887e[_0xaf0b('0xd')][_0xaf0b('0x9e')](util[_0xaf0b('0x29')](_0xaf0b('0xd9'),_0x599abc,_0x31d5ad,_0x2ae51c),_0x53a820[_0x2ae51c]);});});this[_0xaf0b('0xd')][_0xaf0b('0x9e')](util[_0xaf0b('0x29')](_0xaf0b('0xda'),_0x599abc),_0x4f8c4d[_0xaf0b('0x9a')]);return this[_0xaf0b('0xd')][_0xaf0b('0xa8')](util[_0xaf0b('0x29')](_0xaf0b('0xdb'),_0x599abc));};AGIVertices['prototype'][_0xaf0b('0xdc')]=function(_0xc2f35b){logger[_0xaf0b('0xdd')](util[_0xaf0b('0x29')](_0xaf0b('0xde'),_0xc2f35b[_0xaf0b('0x36')]));if(!this[_0xaf0b('0x83')](_0xc2f35b['sip_id'])){return this[_0xaf0b('0xd')][_0xaf0b('0x2a')](_0xc2f35b,_0xaf0b('0xdf'));}var _0x1dcbbd=this[_0xaf0b('0x19')]['sync'](this,_0xc2f35b[_0xaf0b('0xe0')]);if(!_0x1dcbbd){return this[_0xaf0b('0xd')][_0xaf0b('0x2a')](_0xc2f35b,_0xaf0b('0xe1'));}var _0x87e133=this[_0xaf0b('0xd')][_0xaf0b('0x56')](_0xaf0b('0xe2'),[util[_0xaf0b('0x29')](_0xaf0b('0xe3'),_0x1dcbbd),_0xc2f35b[_0xaf0b('0x64')],_0xc2f35b['opts'],_0xc2f35b[_0xaf0b('0x6f')]]);if(_0x87e133[_0xaf0b('0xa3')]===-0x1){return _0x87e133;}return this[_0xaf0b('0xd')]['noop'](util['format']('Executed\x20command\x20%s',_0xaf0b('0xe2')));};AGIVertices[_0xaf0b('0xf')][_0xaf0b('0xe4')]=function(_0x5d7e06){logger['info'](util[_0xaf0b('0x29')]('Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block',_0x5d7e06['label']));if(!this[_0xaf0b('0x83')](_0x5d7e06[_0xaf0b('0x77')])){return this[_0xaf0b('0xd')]['noop'](_0xaf0b('0xe5'));}if(!this[_0xaf0b('0x83')](_0x5d7e06['text'])){return this[_0xaf0b('0xd')][_0xaf0b('0xa8')]('no\x20text\x20configured');}this['channel'][_0xaf0b('0xe6')]=!![];this[_0xaf0b('0x35')](_0x5d7e06);this[_0xaf0b('0x41')](_0x5d7e06[_0xaf0b('0x5c')],'in','','');this[_0xaf0b('0xd')]['noop'](util[_0xaf0b('0x29')](_0xaf0b('0xe7'),_0x5d7e06[_0xaf0b('0x5c')]));var _0x4195a9=this[_0xaf0b('0x76')][_0xaf0b('0xc1')](this,_0x5d7e06);if(_0x4195a9){for(var _0x326e32 in _0x4195a9){if(_0x4195a9[_0xaf0b('0x9c')](_0x326e32)){this[_0xaf0b('0xd')]['setVariable'](util[_0xaf0b('0x29')]('DIALOGFLOW_%s',_0x326e32['toUpperCase']()),_0x4195a9[_0x326e32]);}}this['createSquareMessage'](_0x4195a9['speech'],_0xaf0b('0xe8'),_0xaf0b('0xe4'),'');return this[_0xaf0b('0xd')][_0xaf0b('0xa8')](util[_0xaf0b('0x29')](_0xaf0b('0xe9'),_0x4195a9[_0xaf0b('0xea')]));}return this[_0xaf0b('0xd')][_0xaf0b('0x2a')](_0x5d7e06,_0xaf0b('0xeb'));};AGIVertices[_0xaf0b('0xf')][_0xaf0b('0xec')]=function(_0x2e3c37){logger[_0xaf0b('0x2c')](util['format'](_0xaf0b('0xed'),_0x2e3c37[_0xaf0b('0x36')]));if(!this['isConfigured'](_0x2e3c37[_0xaf0b('0x7a')])){return this[_0xaf0b('0xd')][_0xaf0b('0xa8')](_0xaf0b('0xee'));}if(!this['isConfigured'](_0x2e3c37[_0xaf0b('0xef')])){return this[_0xaf0b('0xd')]['noop'](_0xaf0b('0xf0'));}if(!this[_0xaf0b('0x83')](_0x2e3c37['private_key'])){return this[_0xaf0b('0xd')][_0xaf0b('0xa8')](_0xaf0b('0xf1'));}if(!this[_0xaf0b('0x83')](_0x2e3c37[_0xaf0b('0x7b')])){return this[_0xaf0b('0xd')]['noop'](_0xaf0b('0xf2'));}if(!this[_0xaf0b('0x83')](_0x2e3c37[_0xaf0b('0x5c')])){return this[_0xaf0b('0xd')][_0xaf0b('0xa8')](_0xaf0b('0xa9'));}this[_0xaf0b('0xd')][_0xaf0b('0xe6')]=!![];this[_0xaf0b('0x35')](_0x2e3c37);this[_0xaf0b('0x41')](_0x2e3c37[_0xaf0b('0x5c')],'in','','');this[_0xaf0b('0xd')][_0xaf0b('0xa8')](util['format'](_0xaf0b('0xf3'),_0x2e3c37[_0xaf0b('0x5c')]));var _0x1631eb=this[_0xaf0b('0x79')][_0xaf0b('0xc1')](this,_0x2e3c37);if(_0x1631eb){for(var _0x423213 in _0x1631eb){if(_0x1631eb[_0xaf0b('0x9c')](_0x423213)){if(_0x423213!==_0xaf0b('0xf4')){this['channel']['setVariable'](util[_0xaf0b('0x29')](_0xaf0b('0xf5'),_0x423213[_0xaf0b('0xf6')]()),_0x1631eb[_0x423213]);}}}this[_0xaf0b('0x41')](_0x1631eb[_0xaf0b('0xea')],'out','dialogflowV2',_0x1631eb[_0xaf0b('0xf4')]);return this[_0xaf0b('0xd')][_0xaf0b('0xa8')](util['format'](_0xaf0b('0xf7'),_0x1631eb[_0xaf0b('0xea')]));}return this['channel'][_0xaf0b('0x2a')](_0x2e3c37,_0xaf0b('0xf8'));};AGIVertices[_0xaf0b('0xf')][_0xaf0b('0xf9')]=function(_0x21626e){logger[_0xaf0b('0x2c')](util['format'](_0xaf0b('0xfa'),_0x21626e['label']));if(!this[_0xaf0b('0x83')](_0x21626e[_0xaf0b('0xfb')])){return this[_0xaf0b('0xd')][_0xaf0b('0xa8')](_0xaf0b('0xfc'));}if(!this[_0xaf0b('0x83')](_0x21626e['username'])){return this[_0xaf0b('0xd')][_0xaf0b('0xa8')]('no\x20username\x20configured');}if(!this['isConfigured'](_0x21626e[_0xaf0b('0xfd')])){return this[_0xaf0b('0xd')][_0xaf0b('0xa8')](_0xaf0b('0xfe'));}if(!this['isConfigured'](_0x21626e['ndassistant_url'])){return this[_0xaf0b('0xd')]['noop'](_0xaf0b('0xa9'));}this[_0xaf0b('0xd')][_0xaf0b('0xe6')]=!![];this[_0xaf0b('0x35')](_0x21626e);this[_0xaf0b('0x41')](_0x21626e['text'],'in','','');this[_0xaf0b('0xd')]['noop'](util[_0xaf0b('0x29')](_0xaf0b('0xff'),_0x21626e[_0xaf0b('0x5c')]));var _0x5e8d27=this[_0xaf0b('0x7c')][_0xaf0b('0xc1')](this,_0x21626e);if(_0x5e8d27){for(var _0x962fc0 in _0x5e8d27){if(_0x5e8d27[_0xaf0b('0x9c')](_0x962fc0)){this[_0xaf0b('0xd')][_0xaf0b('0x9e')](util['format'](_0xaf0b('0x100'),_0x962fc0['toUpperCase']()),_0x5e8d27[_0x962fc0]);}}this[_0xaf0b('0x41')](_0x5e8d27[_0xaf0b('0xea')],_0xaf0b('0xe8'),_0xaf0b('0xf9'),'');if(_0x5e8d27[_0xaf0b('0x101')]){this[_0xaf0b('0xd')][_0xaf0b('0xa8')](util['format'](_0xaf0b('0x102'),_0x5e8d27['audiofile']));var _0x96cc5d=this['channel'][_0xaf0b('0x103')](_0x5e8d27[_0xaf0b('0x101')]);try{fs[_0xaf0b('0x104')](_0x5e8d27['audiofile']+'.wav');}catch(_0x2bcf33){logger[_0xaf0b('0x2a')](_0x2bcf33);}return _0x96cc5d;}else{return this['channel']['noop'](util['format']('SestekNDA\x20Result\x20%s',_0x5e8d27[_0xaf0b('0xea')]));}}return this[_0xaf0b('0xd')][_0xaf0b('0x2a')](_0x21626e,_0xaf0b('0x105'));};AGIVertices[_0xaf0b('0xf')][_0xaf0b('0x106')]=function(_0x3a27cf){logger[_0xaf0b('0x2c')](util[_0xaf0b('0x29')](_0xaf0b('0x107'),_0x3a27cf['label']));return this['channel'][_0xaf0b('0xa8')](_0xaf0b('0x106'));};AGIVertices[_0xaf0b('0xf')][_0xaf0b('0x108')]=function(_0x1052e8){logger[_0xaf0b('0x2c')](util[_0xaf0b('0x29')](_0xaf0b('0x109'),_0x1052e8[_0xaf0b('0x36')]));var _0x4c8ae9='';if(_0x1052e8[_0xaf0b('0x10a')]){if(!this[_0xaf0b('0x83')](_0x1052e8[_0xaf0b('0x10a')])){return this['channel'][_0xaf0b('0x2a')](_0x1052e8,_0xaf0b('0x10b'));}else{var _0x3247b7=parseInt(_0x1052e8[_0xaf0b('0x10a')],0xa);if(isNaN(_0x3247b7)){_0x4c8ae9=_0x1052e8[_0xaf0b('0x10a')];}else{_0x4c8ae9=this[_0xaf0b('0x1b')]['sync'](this,_0x1052e8['trunk_id']);if(!_0x4c8ae9){return this[_0xaf0b('0xd')][_0xaf0b('0x2a')](_0x1052e8,_0xaf0b('0x10c'));}}}}else if(_0x1052e8[_0xaf0b('0x10d')]){_0x4c8ae9=_0x1052e8['trunk_name'];}else{return this[_0xaf0b('0xd')][_0xaf0b('0x2a')](_0x1052e8,'no\x20trunk\x20selected');}var _0x250cfa=this['channel']['exec']('DIAL',[util[_0xaf0b('0x29')](_0xaf0b('0x10e'),_0x4c8ae9,_0x1052e8['phone']),_0x1052e8[_0xaf0b('0x64')],_0x1052e8[_0xaf0b('0x10f')],_0x1052e8[_0xaf0b('0x6f')]]);if(_0x250cfa['result']===-0x1){return _0x250cfa;}return this['channel'][_0xaf0b('0xa8')](util['format']('Executed\x20command\x20%s','DIAL'));};AGIVertices[_0xaf0b('0xf')][_0xaf0b('0x110')]=function(_0x5ea2c8){logger['info'](util[_0xaf0b('0x29')](_0xaf0b('0x111'),_0x5ea2c8[_0xaf0b('0x36')]));return this[_0xaf0b('0xd')][_0xaf0b('0xa8')]('finally');};AGIVertices[_0xaf0b('0xf')][_0xaf0b('0xb')]=function(_0x382cdd){logger[_0xaf0b('0x2c')](util[_0xaf0b('0x29')](_0xaf0b('0x112'),_0x382cdd[_0xaf0b('0x36')]));if(_0x382cdd['retry']===0x0){return this['maxRetry'](_0x382cdd);}_0x382cdd[_0xaf0b('0xa5')]-=0x1;if(!this[_0xaf0b('0x83')](_0x382cdd[_0xaf0b('0x113')])){return this[_0xaf0b('0xd')][_0xaf0b('0x2a')](_0x382cdd,_0xaf0b('0x114'));}var _0x5f5b39=this['getSound'][_0xaf0b('0xc1')](this,_0x382cdd[_0xaf0b('0x113')]);if(!_0x5f5b39){return this[_0xaf0b('0xd')][_0xaf0b('0x2a')](_0x382cdd,_0xaf0b('0x115'));}if(!this[_0xaf0b('0x83')](_0x382cdd['variable_id'])){return this[_0xaf0b('0xd')][_0xaf0b('0x2a')](_0xaf0b('0xd5'));}var _0x59636d=this['channel'][_0xaf0b('0x116')](_0x5f5b39,_0x382cdd[_0xaf0b('0x117')],_0x382cdd[_0xaf0b('0x118')]);var _0x27511d=_0x59636d['result']?_0x59636d['result'][_0xaf0b('0x4b')]():'';logger[_0xaf0b('0x2c')]('test',JSON[_0xaf0b('0x71')](_0x59636d));if(_0x59636d[_0xaf0b('0xa3')]===-0x1){this[_0xaf0b('0x35')]['sync'](this,_0x382cdd,_0x27511d);return _0x59636d;}else if(_0x59636d['extra']===_0xaf0b('0x64')){_0x59636d[_0xaf0b('0xa3')]=_0x27511d[_0xaf0b('0x9a')]>=parseInt(_0x382cdd['mindigit'])?'x':'i';}else{_0x59636d[_0xaf0b('0xa3')]=_0x27511d[_0xaf0b('0x9a')]>=parseInt(_0x382cdd[_0xaf0b('0x119')])&&_0x27511d['length']<=parseInt(_0x382cdd[_0xaf0b('0x118')])?'x':'i';}var _0x2c84d6=this['getVariable'][_0xaf0b('0xc1')](this,_0x382cdd[_0xaf0b('0xd4')]);if(!_0x2c84d6){return this[_0xaf0b('0xd')]['error'](_0x382cdd,'no\x20variable\x20found');}this[_0xaf0b('0xd')][_0xaf0b('0x9e')](_0x2c84d6,_0x27511d);if(this[_0xaf0b('0x83')](_0x382cdd[_0xaf0b('0x11a')])){var _0x5dd16c=parseInt(_0x382cdd[_0xaf0b('0x11a')],0xa);var _0x58f374=rs['generate']({'charset':'*','length':_0x5dd16c});var _0x221e02=_0x27511d['length'];if(_0x221e02>0x0){if(_0x221e02>_0x5dd16c){this[_0xaf0b('0x35')][_0xaf0b('0xc1')](this,_0x382cdd,_0x382cdd[_0xaf0b('0x11b')]===_0xaf0b('0x11c')?_0x58f374+_0x27511d['substr'](_0x5dd16c):_0x27511d['substr'](0x0,_0x221e02-_0x5dd16c)+_0x58f374);}else{this[_0xaf0b('0x35')][_0xaf0b('0xc1')](this,_0x382cdd,rs[_0xaf0b('0x11d')]({'charset':'*','length':_0x221e02}));}}else{this[_0xaf0b('0x35')][_0xaf0b('0xc1')](this,_0x382cdd,'');}}else{this['createSquareDetailsReport'][_0xaf0b('0xc1')](this,_0x382cdd,_0x27511d);}return _0x59636d;};AGIVertices[_0xaf0b('0xf')][_0xaf0b('0xc')]=function(_0x4ae148){logger['info'](util['format'](_0xaf0b('0x11e'),_0x4ae148['label']));return this[_0xaf0b('0xb')](_0x4ae148);};AGIVertices[_0xaf0b('0xf')][_0xaf0b('0x11f')]=function(_0xabc144){logger[_0xaf0b('0x2c')](util[_0xaf0b('0x29')]('Enter\x20in\x20GOAL\x20(%s)\x20block',_0xabc144[_0xaf0b('0x36')]));this[_0xaf0b('0x35')][_0xaf0b('0xc1')](this,_0xabc144,_0xabc144['goalname']);return this[_0xaf0b('0xd')]['noop'](util[_0xaf0b('0x29')]('GOAL\x20%s',_0xabc144[_0xaf0b('0x120')]));};AGIVertices[_0xaf0b('0xf')][_0xaf0b('0x121')]=function(_0x33b66a){logger[_0xaf0b('0x2c')](util[_0xaf0b('0x29')](_0xaf0b('0x122'),_0x33b66a['label']));if(!this['isConfigured'](_0x33b66a[_0xaf0b('0x86')])||!this['isConfigured'](_0x33b66a[_0xaf0b('0x87')])){return this['channel'][_0xaf0b('0xa8')](_0xaf0b('0x123'));}if(!this[_0xaf0b('0x83')](_0x33b66a[_0xaf0b('0x5c')])){return this[_0xaf0b('0xd')][_0xaf0b('0xa8')](_0xaf0b('0xa9'));}this['channel'][_0xaf0b('0xa8')](util[_0xaf0b('0x29')](_0xaf0b('0x124'),_0x33b66a[_0xaf0b('0x5c')]));var _0x7f3c2f=this[_0xaf0b('0x85')][_0xaf0b('0xc1')](this,_0x33b66a);if(_0x7f3c2f){this[_0xaf0b('0xd')][_0xaf0b('0xa8')](util['format'](_0xaf0b('0x125'),_0x7f3c2f));var _0x2f8067=this[_0xaf0b('0xd')][_0xaf0b('0x103')](_0x7f3c2f);try{fs[_0xaf0b('0x104')](_0x7f3c2f+_0xaf0b('0x126'));}catch(_0x5cfb13){logger[_0xaf0b('0x2a')](_0x5cfb13);}return _0x2f8067;}return this[_0xaf0b('0xd')][_0xaf0b('0x2a')](_0x33b66a,_0xaf0b('0x127'));};AGIVertices[_0xaf0b('0xf')][_0xaf0b('0x128')]=function(_0x4b630d){logger[_0xaf0b('0x2c')](util[_0xaf0b('0x29')](_0xaf0b('0x129'),_0x4b630d[_0xaf0b('0x36')]));if(!this[_0xaf0b('0x83')](_0x4b630d[_0xaf0b('0x86')])||!this[_0xaf0b('0x83')](_0x4b630d['aws_secret_access_key'])){return this[_0xaf0b('0xd')]['noop']('no\x20valid\x20credentials\x20configured');}if(!this[_0xaf0b('0x83')](_0x4b630d['aws_bot_name'])){return this[_0xaf0b('0xd')]['noop']('no\x20bot\x20name\x20configured');}if(!this[_0xaf0b('0x83')](_0x4b630d['text'])){return this[_0xaf0b('0xd')][_0xaf0b('0xa8')](_0xaf0b('0xa9'));}this[_0xaf0b('0xd')][_0xaf0b('0xe6')]=!![];this[_0xaf0b('0x35')](_0x4b630d);this[_0xaf0b('0x41')](_0x4b630d[_0xaf0b('0x5c')],'in','','');this[_0xaf0b('0xd')][_0xaf0b('0xa8')](util[_0xaf0b('0x29')](_0xaf0b('0x12a'),_0x4b630d[_0xaf0b('0x5c')]));var _0x237b41=this[_0xaf0b('0x8c')][_0xaf0b('0xc1')](this,_0x4b630d);if(_0x237b41){for(var _0x4f4b03 in _0x237b41){if(_0x237b41[_0xaf0b('0x9c')](_0x4f4b03)&&_[_0xaf0b('0x95')](_0x237b41[_0x4f4b03])){this[_0xaf0b('0xd')][_0xaf0b('0x9e')](util[_0xaf0b('0x29')](_0xaf0b('0x12b'),_0x4f4b03[_0xaf0b('0xf6')]()),_0x237b41[_0x4f4b03]);}}if(_[_0xaf0b('0x4f')](_0x237b41['message'])){return this[_0xaf0b('0xd')][_0xaf0b('0xa8')](_0xaf0b('0x12c'));}else{this['createSquareMessage'](_0x237b41['message'],'out',_0xaf0b('0x12d'),'');return this[_0xaf0b('0xd')][_0xaf0b('0xa8')](util[_0xaf0b('0x29')](_0xaf0b('0x12e'),_0x237b41[_0xaf0b('0x74')]));}}return this[_0xaf0b('0xd')][_0xaf0b('0x2a')](_0x4b630d,_0xaf0b('0x12f'));};AGIVertices[_0xaf0b('0xf')][_0xaf0b('0x130')]=function(_0x2a158c){logger['info'](util[_0xaf0b('0x29')]('Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s',_0x2a158c[_0xaf0b('0x36')],_0x2a158c[_0xaf0b('0x64')]));if(!this['isConfigured'](_0x2a158c['key'])){return this[_0xaf0b('0xd')][_0xaf0b('0xa8')]('no\x20key\x20configured');}var _0x5a8d3f=_0xaf0b('0x131');var _0x24121a=util[_0xaf0b('0x29')](_0xaf0b('0x132'),FILES_PATH,rs[_0xaf0b('0x11d')](0x4));var _0x1a946b=util[_0xaf0b('0x29')](_0xaf0b('0x9d'),_0x24121a,_0x5a8d3f);var _0x12aa89=!![];if(_0x2a158c['beep']===_0xaf0b('0x133')){_0x12aa89=![];}var _0x44c532=this[_0xaf0b('0xd')]['recordFile'](_0x24121a,_0x5a8d3f,_0x2a158c[_0xaf0b('0x134')],_0x2a158c[_0xaf0b('0x64')],undefined,_0x12aa89);if(_0x44c532[_0xaf0b('0xa3')]!==-0x1){this[_0xaf0b('0xd')][_0xaf0b('0xa8')](util[_0xaf0b('0x29')](_0xaf0b('0x135'),_0x1a946b));var _0x59653e=this['googleASR'][_0xaf0b('0xc1')](this,_0x2a158c,_0x1a946b);if(_0x59653e){for(var _0xceb92 in _0x59653e){if(_0x59653e[_0xaf0b('0x9c')](_0xceb92)){this['channel'][_0xaf0b('0x9e')](util[_0xaf0b('0x29')](_0xaf0b('0x136'),_0xceb92[_0xaf0b('0xf6')]()),_0x59653e[_0xceb92]);}}return this['channel'][_0xaf0b('0xa8')](util[_0xaf0b('0x29')]('GoogleASR\x20Result\x20%s',JSON['stringify'](_0x59653e)));}}return _0x44c532;};AGIVertices[_0xaf0b('0xf')][_0xaf0b('0x137')]=function(_0x524651){logger[_0xaf0b('0x2c')](util[_0xaf0b('0x29')](_0xaf0b('0x138'),_0x524651[_0xaf0b('0x36')]));if(!this['isConfigured'](_0x524651[_0xaf0b('0x91')])){return this[_0xaf0b('0xd')][_0xaf0b('0xa8')](_0xaf0b('0x139'));}if(!this[_0xaf0b('0x83')](_0x524651[_0xaf0b('0x13a')])){return this[_0xaf0b('0xd')][_0xaf0b('0xa8')](_0xaf0b('0x13b'));}var _0x17e33d=_0xaf0b('0x131');var _0x199617=util[_0xaf0b('0x29')](_0xaf0b('0x132'),FILES_PATH,rs[_0xaf0b('0x11d')](0x4));var _0x281cea=util['format'](_0xaf0b('0x9d'),_0x199617,_0x17e33d);var _0x59694a=!![];if(_0x524651[_0xaf0b('0x13c')]==='NOBEEP'){_0x59694a=![];}var _0x18c7c9=this[_0xaf0b('0xd')][_0xaf0b('0x13d')](_0x199617,_0x17e33d,_0x524651['intKey'],_0x524651[_0xaf0b('0x64')],undefined,_0x59694a);if(_0x18c7c9[_0xaf0b('0xa3')]!==-0x1){this[_0xaf0b('0xd')][_0xaf0b('0xa8')](util[_0xaf0b('0x29')](_0xaf0b('0x13e'),_0x281cea));var _0x47270d=this[_0xaf0b('0x13f')][_0xaf0b('0xc1')](this,_0x524651,_0x281cea);if(_0x47270d){for(var _0x51d450 in _0x47270d){if(_0x47270d['hasOwnProperty'](_0x51d450)){this[_0xaf0b('0xd')][_0xaf0b('0x9e')](util[_0xaf0b('0x29')](_0xaf0b('0x140'),_0x51d450[_0xaf0b('0xf6')]()),_0x47270d[_0x51d450]);}}return this['channel'][_0xaf0b('0xa8')](util[_0xaf0b('0x29')](_0xaf0b('0x141'),JSON[_0xaf0b('0x71')](_0x47270d)));}}return _0x18c7c9;};AGIVertices['prototype'][_0xaf0b('0x142')]=function(_0x344cbe){logger['info'](util[_0xaf0b('0x29')](_0xaf0b('0x143'),_0x344cbe[_0xaf0b('0x36')]));return this[_0xaf0b('0xd')][_0xaf0b('0x144')](_0x344cbe[_0xaf0b('0x3c')],_0x344cbe['extension'],_0x344cbe[_0xaf0b('0x3e')]);};AGIVertices[_0xaf0b('0xf')][_0xaf0b('0x145')]=function(_0x27cf00){logger['info'](util[_0xaf0b('0x29')](_0xaf0b('0x146'),_0x27cf00[_0xaf0b('0x36')]));if(!this['isConfigured'](_0x27cf00['condition'])){return this[_0xaf0b('0xd')][_0xaf0b('0x2a')](_0x27cf00,_0xaf0b('0x147'));}try{var _0x1ec4a3=eval(_0x27cf00['condition'])?_0xaf0b('0x148'):'false';this[_0xaf0b('0xd')][_0xaf0b('0xa8')](util['format']('EVAL\x20CONDITION\x20%s\x20%s',_0x27cf00[_0xaf0b('0x149')],_0x1ec4a3));return{'code':0xc8,'result':_0x1ec4a3};}catch(_0x127f23){return{'code':0xc8,'result':'false'};}};AGIVertices['prototype'][_0xaf0b('0x14a')]=function(_0x26d341){logger['info'](util[_0xaf0b('0x29')](_0xaf0b('0x14b'),_0x26d341['label']));if(!this[_0xaf0b('0x83')](_0x26d341[_0xaf0b('0x14c')])){return this[_0xaf0b('0xd')]['error'](_0x26d341,_0xaf0b('0x14d'));}var _0x287f90=this['getIntervals'][_0xaf0b('0xc1')](this,_0x26d341[_0xaf0b('0x14c')]);if(!_0x287f90){return this[_0xaf0b('0xd')]['error'](_0x26d341,'no\x20intervals\x20found');}for(var _0x52d7e1=0x0;_0x52d7e1<_0x287f90[_0xaf0b('0x9a')];_0x52d7e1+=0x1){var _0x45a5ca=this[_0xaf0b('0xd')][_0xaf0b('0xa1')](util[_0xaf0b('0x29')](_0xaf0b('0x14e'),_0x287f90[_0x52d7e1]));if(_0x45a5ca[_0xaf0b('0xa3')]===-0x1){return _0x45a5ca;}logger['info'](util[_0xaf0b('0x29')](_0xaf0b('0x14f'),_0x287f90[_0x52d7e1],_0x45a5ca['extra']));if(_0x45a5ca[_0xaf0b('0xa2')]===_0xaf0b('0x148')){logger['info'](util['format'](_0xaf0b('0x14f'),_0x287f90[_0x52d7e1],_0xaf0b('0x148')));this[_0xaf0b('0xd')]['noop'](util[_0xaf0b('0x29')](_0xaf0b('0x14f'),_0x287f90[_0x52d7e1],_0xaf0b('0x148')));return{'code':0xc8,'result':'true'};}else{logger['info'](util[_0xaf0b('0x29')](_0xaf0b('0x14f'),_0x287f90[_0x52d7e1],_0xaf0b('0x150')));this[_0xaf0b('0xd')][_0xaf0b('0xa8')](util[_0xaf0b('0x29')](_0xaf0b('0x14f'),_0x287f90[_0x52d7e1],_0xaf0b('0x150')));}}return{'code':0xc8,'result':_0xaf0b('0x150')};};AGIVertices[_0xaf0b('0xf')]['hangup']=function(_0x10ac3a){logger[_0xaf0b('0x2c')](util['format'](_0xaf0b('0x151'),_0x10ac3a[_0xaf0b('0x36')]));return this[_0xaf0b('0xd')][_0xaf0b('0x152')]();};AGIVertices[_0xaf0b('0xf')]['ispeechasr']=function(_0x396d7c){logger[_0xaf0b('0x2c')](util[_0xaf0b('0x29')](_0xaf0b('0x153'),_0x396d7c['label']));if(!this[_0xaf0b('0x83')](_0x396d7c['key'])){return this['channel'][_0xaf0b('0xa8')](_0xaf0b('0xe5'));}var _0xb8bbfc=_0xaf0b('0x131');var _0x1ad010=util[_0xaf0b('0x29')](_0xaf0b('0x132'),FILES_PATH,rs[_0xaf0b('0x11d')](0x4));var _0x3f58be=util[_0xaf0b('0x29')](_0xaf0b('0x9d'),_0x1ad010,_0xb8bbfc);var _0x259392=!![];if(_0x396d7c[_0xaf0b('0x13c')]===_0xaf0b('0x133')){_0x259392=![];}var _0x874f5a=this[_0xaf0b('0xd')][_0xaf0b('0x13d')](_0x1ad010,_0xb8bbfc,_0x396d7c[_0xaf0b('0x134')],_0x396d7c['timeout'],undefined,_0x259392);if(_0x874f5a[_0xaf0b('0xa3')]!==-0x1){this[_0xaf0b('0xd')]['noop'](util['format']('ispeech\x20%s\x20file\x20created',_0x3f58be));var _0x24b8aa=this[_0xaf0b('0x81')]['sync'](this,_0x396d7c,_0x3f58be);if(_0x24b8aa){for(var _0x1a9126 in _0x24b8aa){if(_0x24b8aa['hasOwnProperty'](_0x1a9126)){this[_0xaf0b('0xd')]['setVariable'](util[_0xaf0b('0x29')](_0xaf0b('0x154'),_0x1a9126[_0xaf0b('0xf6')]()),_0x24b8aa[_0x1a9126]);}}return this['channel'][_0xaf0b('0xa8')](util[_0xaf0b('0x29')](_0xaf0b('0x155'),JSON['stringify'](_0x24b8aa)));}}return _0x874f5a;};AGIVertices['prototype'][_0xaf0b('0x156')]=function(_0x25e80d){logger[_0xaf0b('0x2c')](util[_0xaf0b('0x29')](_0xaf0b('0x157'),_0x25e80d[_0xaf0b('0x36')]));if(!this['isConfigured'](_0x25e80d[_0xaf0b('0x77')])){return this['channel'][_0xaf0b('0xa8')]('no\x20key\x20configured');}if(!this[_0xaf0b('0x83')](_0x25e80d['text'])){return this['channel'][_0xaf0b('0xa8')](_0xaf0b('0xa9'));}this[_0xaf0b('0xd')]['noop'](util[_0xaf0b('0x29')]('Trying\x20ispeech\x20TTS\x20%s',_0x25e80d[_0xaf0b('0x5c')]));var _0x4f5060=this[_0xaf0b('0x7d')][_0xaf0b('0xc1')](this,_0x25e80d);if(_0x4f5060){this[_0xaf0b('0xd')][_0xaf0b('0xa8')](util[_0xaf0b('0x29')](_0xaf0b('0x158'),_0x4f5060));var _0x445f25=this[_0xaf0b('0xd')][_0xaf0b('0x103')](_0x4f5060,_0x25e80d[_0xaf0b('0x134')]);try{fs[_0xaf0b('0x104')](_0x4f5060+_0xaf0b('0x126'));}catch(_0x3676a7){logger[_0xaf0b('0x2a')](_0x3676a7);}return _0x445f25;}return this['channel'][_0xaf0b('0x2a')](_0x25e80d,_0xaf0b('0x159'));};AGIVertices[_0xaf0b('0xf')][_0xaf0b('0x15a')]=function(_0x383d17){logger['info'](util['format'](_0xaf0b('0x15b'),_0x383d17[_0xaf0b('0x36')]));if(!this[_0xaf0b('0x83')](_0x383d17['findBy'])){return this[_0xaf0b('0xd')][_0xaf0b('0x2a')](_0x383d17,_0xaf0b('0x15c'));}logger[_0xaf0b('0x2c')](util[_0xaf0b('0x29')](_0xaf0b('0x15d'),this['channel']['callerid'],_0x383d17['findBy']));var _0x4b6358=this['agentLogin'][_0xaf0b('0xc1')](this,_0x383d17[_0xaf0b('0x15e')]);if(_0x4b6358){logger[_0xaf0b('0x2c')](util[_0xaf0b('0x29')](_0xaf0b('0x15f'),this[_0xaf0b('0xd')][_0xaf0b('0x38')],_0x383d17[_0xaf0b('0x15e')]));this[_0xaf0b('0xd')][_0xaf0b('0xa8')](util[_0xaf0b('0x29')]('AGENT\x20%s\x20FOUND\x20BY',this[_0xaf0b('0xd')][_0xaf0b('0x38')],_0x383d17[_0xaf0b('0x15e')]));return{'code':0xc8,'result':_0xaf0b('0x160')};}else{logger[_0xaf0b('0x2c')](util[_0xaf0b('0x29')](_0xaf0b('0x161'),this[_0xaf0b('0xd')][_0xaf0b('0x38')],_0x383d17[_0xaf0b('0x15e')]));this['channel'][_0xaf0b('0xa8')](util[_0xaf0b('0x29')](_0xaf0b('0x161'),this[_0xaf0b('0xd')]['callerid'],_0x383d17[_0xaf0b('0x15e')]));return{'code':0xc8,'result':_0xaf0b('0x162')};}};AGIVertices[_0xaf0b('0xf')][_0xaf0b('0x163')]=function(_0x9aa0f){logger['info'](util[_0xaf0b('0x29')](_0xaf0b('0x164'),_0x9aa0f[_0xaf0b('0x36')]));if(!this[_0xaf0b('0x83')](_0x9aa0f['findBy'])){return this[_0xaf0b('0xd')][_0xaf0b('0x2a')](_0x9aa0f,'no\x20find\x20by\x20configured');}logger['info'](util['format'](_0xaf0b('0x15d'),this[_0xaf0b('0xd')][_0xaf0b('0x38')],_0x9aa0f[_0xaf0b('0x15e')]));var _0x3cbaf0=this['agentLogout'][_0xaf0b('0xc1')](this,_0x9aa0f[_0xaf0b('0x15e')]);if(_0x3cbaf0){logger[_0xaf0b('0x2c')](util[_0xaf0b('0x29')](_0xaf0b('0x15f'),this['channel']['callerid'],_0x9aa0f[_0xaf0b('0x15e')]));this['channel'][_0xaf0b('0xa8')](util[_0xaf0b('0x29')](_0xaf0b('0x15f'),this['channel'][_0xaf0b('0x38')],_0x9aa0f[_0xaf0b('0x15e')]));return{'code':0xc8,'result':_0xaf0b('0x160')};}else{logger[_0xaf0b('0x2c')](util[_0xaf0b('0x29')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0xaf0b('0xd')]['callerid'],_0x9aa0f[_0xaf0b('0x15e')]));this[_0xaf0b('0xd')][_0xaf0b('0xa8')](util[_0xaf0b('0x29')](_0xaf0b('0x161'),this['channel'][_0xaf0b('0x38')],_0x9aa0f[_0xaf0b('0x15e')]));return{'code':0xc8,'result':_0xaf0b('0x162')};}};AGIVertices[_0xaf0b('0xf')]['math']=function(_0x30260a){logger['info'](util[_0xaf0b('0x29')](_0xaf0b('0x165'),_0x30260a[_0xaf0b('0x36')]));if(!this[_0xaf0b('0x83')](_0x30260a[_0xaf0b('0x166')])){return this[_0xaf0b('0xd')]['error'](_0x30260a,_0xaf0b('0x167'));}this[_0xaf0b('0xd')][_0xaf0b('0xa8')](util[_0xaf0b('0x29')](_0xaf0b('0x168'),_0x30260a['operation']));var _0x535ad8=eval(_0x30260a['operation']);if(!this[_0xaf0b('0x83')](_0x30260a[_0xaf0b('0xd4')])){return this['channel'][_0xaf0b('0xa8')](_0xaf0b('0xd5'));}var _0x5f2285=this[_0xaf0b('0xa1')][_0xaf0b('0xc1')](this,_0x30260a[_0xaf0b('0xd4')]);if(!_0x5f2285){return this[_0xaf0b('0xd')][_0xaf0b('0x2a')](_0x30260a,_0xaf0b('0xd6'));}if(_[_0xaf0b('0x99')](_0x535ad8)){var _0x3196b7=this;_0x535ad8[_0xaf0b('0xd7')](function(_0x59d4ae,_0x300466){_0x3196b7[_0xaf0b('0xd')][_0xaf0b('0x9e')](util[_0xaf0b('0x29')](_0xaf0b('0x169'),_0x5f2285,_0x300466),_0x59d4ae);});return this[_0xaf0b('0xd')]['noop'](util[_0xaf0b('0x29')](_0xaf0b('0x16a'),_0x5f2285));}else{return this[_0xaf0b('0xd')][_0xaf0b('0x9e')](_0x5f2285,_0x535ad8);}};AGIVertices[_0xaf0b('0xf')][_0xaf0b('0xa')]=function(_0x1fdb0d){logger['info'](util['format']('Enter\x20in\x20MENU\x20(%s)\x20block',_0x1fdb0d[_0xaf0b('0x36')]));if(_0x1fdb0d[_0xaf0b('0xa5')]===0x0){return this[_0xaf0b('0xa6')](_0x1fdb0d);}_0x1fdb0d[_0xaf0b('0xa5')]-=0x1;if(!this[_0xaf0b('0x83')](_0x1fdb0d['file_id'])){return this[_0xaf0b('0xd')]['error'](_0x1fdb0d,_0xaf0b('0x114'));}var _0x17ec96=this['getSound'][_0xaf0b('0xc1')](this,_0x1fdb0d[_0xaf0b('0x113')]);if(!_0x17ec96){return this[_0xaf0b('0xd')][_0xaf0b('0x2a')](_0x1fdb0d,_0xaf0b('0x115'));}var _0x4f18b8=this['channel'][_0xaf0b('0x116')](_0x17ec96,_0x1fdb0d['response'],_0x1fdb0d['digit']);var _0x53005a=_0x4f18b8[_0xaf0b('0xa3')];if(_0x4f18b8[_0xaf0b('0xa3')]===-0x1){this['createSquareDetailsReport'][_0xaf0b('0xc1')](this,_0x1fdb0d,'-1');return _0x4f18b8;}else if(_0x4f18b8[_0xaf0b('0xa2')]===_0xaf0b('0x64')){_0x4f18b8[_0xaf0b('0xa3')]=_0x4f18b8[_0xaf0b('0xa3')]['length']>0x0?_0x4f18b8[_0xaf0b('0xa3')]:'t';}else if(_[_0xaf0b('0x43')](_0x4f18b8[_0xaf0b('0xa3')])){_0x4f18b8[_0xaf0b('0xa3')]='#';_0x53005a='#';}if(!this[_0xaf0b('0x83')](_0x1fdb0d[_0xaf0b('0xd4')])){this['channel'][_0xaf0b('0xa8')](_0xaf0b('0xd5'));}else{var _0x4c1b05=this[_0xaf0b('0xa1')]['sync'](this,_0x1fdb0d[_0xaf0b('0xd4')]);if(!_0x4c1b05){return this[_0xaf0b('0xd')][_0xaf0b('0x2a')](_0x1fdb0d,'no\x20variable\x20found');}this[_0xaf0b('0xd')][_0xaf0b('0x9e')](_0x4c1b05,_0x53005a);}this[_0xaf0b('0x35')][_0xaf0b('0xc1')](this,_0x1fdb0d,_0x53005a);return _0x4f18b8;};AGIVertices['prototype'][_0xaf0b('0xa8')]=function(_0x46907a){logger[_0xaf0b('0x2c')](util[_0xaf0b('0x29')](_0xaf0b('0x16b'),_0x46907a['label']));return this[_0xaf0b('0xd')][_0xaf0b('0xa8')](_0x46907a[_0xaf0b('0x16c')]||_0x46907a[_0xaf0b('0x36')]);};AGIVertices['prototype'][_0xaf0b('0x16d')]=function(_0x5d03b1){logger[_0xaf0b('0x2c')](util[_0xaf0b('0x29')](_0xaf0b('0x16e'),_0x5d03b1[_0xaf0b('0x36')]));if(!this['isConfigured'](_0x5d03b1[_0xaf0b('0x15e')])){return this['channel'][_0xaf0b('0x2a')](_0x5d03b1,_0xaf0b('0x15c'));}logger[_0xaf0b('0x2c')](util[_0xaf0b('0x29')](_0xaf0b('0x15d'),this[_0xaf0b('0xd')][_0xaf0b('0x38')],_0x5d03b1[_0xaf0b('0x15e')]));var _0x33bdef=this['getPause']['sync'](this,_0x5d03b1[_0xaf0b('0x16f')]);var _0x542f73=this[_0xaf0b('0x4e')][_0xaf0b('0xc1')](this,_0x5d03b1[_0xaf0b('0x15e')],_0x33bdef);if(_0x542f73){logger[_0xaf0b('0x2c')](util['format'](_0xaf0b('0x15f'),this[_0xaf0b('0xd')][_0xaf0b('0x38')],_0x5d03b1['findBy']));this['channel'][_0xaf0b('0xa8')](util['format'](_0xaf0b('0x15f'),this[_0xaf0b('0xd')][_0xaf0b('0x38')],_0x5d03b1['findBy']));return{'code':0xc8,'result':_0xaf0b('0x160')};}else{logger['info'](util[_0xaf0b('0x29')](_0xaf0b('0x161'),this[_0xaf0b('0xd')][_0xaf0b('0x38')],_0x5d03b1[_0xaf0b('0x15e')]));this[_0xaf0b('0xd')][_0xaf0b('0xa8')](util[_0xaf0b('0x29')]('AGENT\x20%s\x20FOUND\x20BY',this[_0xaf0b('0xd')][_0xaf0b('0x38')],_0x5d03b1[_0xaf0b('0x15e')]));return{'code':0xc8,'result':_0xaf0b('0x162')};}};AGIVertices[_0xaf0b('0xf')][_0xaf0b('0x170')]=function(_0x5a1481){logger[_0xaf0b('0x2c')](util['format'](_0xaf0b('0x171'),_0x5a1481[_0xaf0b('0x36')]));if(!this[_0xaf0b('0x83')](_0x5a1481[_0xaf0b('0x113')])){return this[_0xaf0b('0xd')][_0xaf0b('0x2a')](_0x5a1481,'no\x20file\x20audio\x20selected');}var _0x2a1e74=this[_0xaf0b('0x1d')][_0xaf0b('0xc1')](this,_0x5a1481[_0xaf0b('0x113')]);if(!_0x2a1e74){return this[_0xaf0b('0xd')][_0xaf0b('0x2a')](_0x5a1481,'no\x20file\x20audio\x20found');}var _0x3f4db0=this[_0xaf0b('0xd')][_0xaf0b('0x56')]('PLAYBACK',[_0x2a1e74,_0x5a1481[_0xaf0b('0x10f')]]);if(_0x3f4db0[_0xaf0b('0xa3')]===-0x1){return _0x3f4db0;}return this['channel'][_0xaf0b('0xa8')](util[_0xaf0b('0x29')](_0xaf0b('0x172'),'PLAYBACK',_0x2a1e74));};AGIVertices[_0xaf0b('0xf')][_0xaf0b('0x173')]=function(_0x1183af){logger[_0xaf0b('0x2c')](util[_0xaf0b('0x29')]('Enter\x20in\x20QUEUE\x20(%s)\x20block',_0x1183af[_0xaf0b('0x36')]));if(!this[_0xaf0b('0x83')](_0x1183af[_0xaf0b('0x174')])){return this[_0xaf0b('0xd')][_0xaf0b('0x2a')](_0x1183af,_0xaf0b('0x175'));}var _0x49ff5d='';var _0x2b0b10=parseInt(_0x1183af['queue_id'],0xa);if(isNaN(_0x2b0b10)){_0x49ff5d=_0x1183af[_0xaf0b('0x174')];}else{_0x49ff5d=this[_0xaf0b('0x176')]['sync'](this,_0x1183af['queue_id']);if(!_0x49ff5d){return this[_0xaf0b('0xd')][_0xaf0b('0x2a')](_0x1183af,'no\x20queue\x20found');}}var _0x1d2dd3='';if(this[_0xaf0b('0x83')](_0x1183af[_0xaf0b('0x113')])){var _0x49cf0a=this[_0xaf0b('0x1d')][_0xaf0b('0xc1')](this,_0x1183af[_0xaf0b('0x113')]);if(_0x49cf0a){_0x1d2dd3=_0x49cf0a;}}this['createSquareDetailsReport'][_0xaf0b('0xc1')](this,_0x1183af,_0x49ff5d);if(_0x1183af[_0xaf0b('0x10f')]['indexOf']('x')<0x0){_0x1183af[_0xaf0b('0x10f')]+='x';}if(_0x1183af[_0xaf0b('0x10f')]['indexOf']('X')<0x0){_0x1183af[_0xaf0b('0x10f')]+='X';}this['channel'][_0xaf0b('0x9e')](_0xaf0b('0x177'),_0x49ff5d?_0x49ff5d[_0xaf0b('0x178')]():'');var _0x1084b8=this[_0xaf0b('0xd')]['exec'](_0xaf0b('0x179'),[_0x49ff5d,_0x1183af[_0xaf0b('0x10f')],_0x1183af['url'],_0x1d2dd3,_0x1183af[_0xaf0b('0x64')],_0x1183af[_0xaf0b('0x7')],_0x1183af[_0xaf0b('0x17a')],_0x1183af['gosub'],'',_0x1183af[_0xaf0b('0x17b')]]);if(_0x1084b8[_0xaf0b('0xa3')]===-0x1){return _0x1084b8;}return this[_0xaf0b('0xd')]['noop'](util['format'](_0xaf0b('0x172'),_0xaf0b('0x179'),_0x49ff5d));};AGIVertices[_0xaf0b('0xf')][_0xaf0b('0x17c')]=function(_0x4a8e65){logger[_0xaf0b('0x2c')](util[_0xaf0b('0x29')](_0xaf0b('0x17d'),_0x4a8e65[_0xaf0b('0x36')]));var _0x43f5e8=_0x4a8e65['recordingFormat']||_0xaf0b('0x131');var _0x107afd=util[_0xaf0b('0x29')](_0xaf0b('0x17e'),this[_0xaf0b('0xd')][_0xaf0b('0x3a')],rs[_0xaf0b('0x11d')](0x5));var _0x43df5a=util[_0xaf0b('0x29')]('%s/recordings/%s.%s',FILES_PATH,_0x107afd,_0x43f5e8);var _0x2375b2=util['format'](_0xaf0b('0x132'),FILES_PATH,_0x107afd);this['createSquareRecording'][_0xaf0b('0xc1')](this,_0x4a8e65,_0x107afd,_0x43df5a);this[_0xaf0b('0xd')][_0xaf0b('0x9e')]('RECORDING_SAVENAME',_0x107afd);logger[_0xaf0b('0x2c')](_0xaf0b('0x17f'),_0x2375b2,_0x43f5e8,_0x4a8e65['escape_digits'],_0x4a8e65[_0xaf0b('0x64')]);return this['channel'][_0xaf0b('0x13d')](_0x2375b2,_0x43f5e8,_0x4a8e65[_0xaf0b('0x180')],_0x4a8e65['timeout'],undefined,!![]);};AGIVertices[_0xaf0b('0xf')]['restapi']=function(_0x508362){logger[_0xaf0b('0x2c')](util[_0xaf0b('0x29')](_0xaf0b('0x181'),_0x508362['label']));if(!this[_0xaf0b('0x83')](_0x508362[_0xaf0b('0x6f')])){return this[_0xaf0b('0xd')]['noop'](_0xaf0b('0x182'));}var _0xf1cef9=this[_0xaf0b('0x61')][_0xaf0b('0xc1')](this,_0x508362);logger['info'](util[_0xaf0b('0x29')](_0xaf0b('0x183'),util[_0xaf0b('0x184')](_0xf1cef9,{'showHidden':![],'depth':null})));if(!this[_0xaf0b('0x83')](_0x508362['variable_id'])){return this[_0xaf0b('0xd')]['noop'](_0xaf0b('0x185'));}var _0x4f22f0=this[_0xaf0b('0xa1')][_0xaf0b('0xc1')](this,_0x508362[_0xaf0b('0xd4')]);if(!_0x4f22f0){return this[_0xaf0b('0xd')][_0xaf0b('0x2a')](_0x508362,_0xaf0b('0xd6'));}this[_0xaf0b('0xd')][_0xaf0b('0x9e')](util[_0xaf0b('0x29')](_0xaf0b('0x186'),_0x4f22f0),_0xf1cef9['statusCode']?_0xf1cef9['statusCode']:_0xaf0b('0x187'));this[_0xaf0b('0xd')][_0xaf0b('0x9e')](util[_0xaf0b('0x29')](_0xaf0b('0x188'),_0x4f22f0),_0xf1cef9[_0xaf0b('0x73')]?_0xf1cef9[_0xaf0b('0x73')]:'OK');if(_0xf1cef9[_0xaf0b('0x67')]){try{this[_0xaf0b('0x9b')](_0xf1cef9[_0xaf0b('0x67')],_0x4f22f0);}catch(_0x3bcb62){logger['error'](util[_0xaf0b('0x29')](_0xaf0b('0x189'),_0x4f22f0));}}return this['channel'][_0xaf0b('0xa8')](util['format'](_0xaf0b('0xdb'),_0x4f22f0));};AGIVertices[_0xaf0b('0xf')]['saydigits']=function(_0x51a627){logger[_0xaf0b('0x2c')](util[_0xaf0b('0x29')](_0xaf0b('0x18a'),_0x51a627['label']));return this['channel']['sayDigits'](_0x51a627[_0xaf0b('0x18b')]['replace'](/\s+/g,''),_0x51a627[_0xaf0b('0x180')]);};AGIVertices[_0xaf0b('0xf')][_0xaf0b('0x18c')]=function(_0x847437){logger['info'](util['format'](_0xaf0b('0x18d'),_0x847437[_0xaf0b('0x36')]));return this[_0xaf0b('0xd')][_0xaf0b('0x18e')](_0x847437[_0xaf0b('0x63')]['replace'](/\s+/g,''),_0x847437[_0xaf0b('0x180')]);};AGIVertices[_0xaf0b('0xf')][_0xaf0b('0x18f')]=function(_0x544cbb){logger[_0xaf0b('0x2c')](util[_0xaf0b('0x29')](_0xaf0b('0x190'),_0x544cbb['label']));return this['channel']['sayPhonetic'](_0x544cbb[_0xaf0b('0x5c')],_0x544cbb[_0xaf0b('0x180')]);};AGIVertices[_0xaf0b('0xf')]['sendMail']=function(_0xc9e164){logger['info'](util[_0xaf0b('0x29')](_0xaf0b('0x191'),_0xc9e164['label']));if(!this[_0xaf0b('0x83')](_0xc9e164[_0xaf0b('0x192')])){return this[_0xaf0b('0xd')][_0xaf0b('0xa8')](_0xaf0b('0x193'));}var _0x14e2c9=this['getMailAccount'][_0xaf0b('0xc1')](this,_0xc9e164[_0xaf0b('0x192')]);if(!_0x14e2c9||!_0x14e2c9[_0xaf0b('0x194')]){return this[_0xaf0b('0xd')]['error'](_0xc9e164,_0xaf0b('0x195'));}var _0x46e593={'from':util[_0xaf0b('0x29')](_0xaf0b('0x196'),_0x14e2c9[_0xaf0b('0x11')],_0x14e2c9['email']||_0x14e2c9[_0xaf0b('0x194')]['user']),'to':_0xc9e164['to']||'','cc':_0xc9e164['cc']||'','bcc':_0xc9e164[_0xaf0b('0x197')]||'','subject':_0xc9e164[_0xaf0b('0x198')],'html':_0xc9e164[_0xaf0b('0x5c')],'text':_0xc9e164[_0xaf0b('0x5c')]};if(this[_0xaf0b('0x83')](_0xc9e164[_0xaf0b('0x199')])){}logger[_0xaf0b('0xdd')](_0xaf0b('0x19a'),JSON[_0xaf0b('0x71')](_0x46e593));this[_0xaf0b('0x35')][_0xaf0b('0xc1')](this,_0xc9e164,_0xc9e164[_0xaf0b('0x192')]);this[_0xaf0b('0xd')][_0xaf0b('0xa8')](util[_0xaf0b('0x29')]('Trying\x20SendMail\x20with\x20account\x20%s',_0x14e2c9['name']));this[_0xaf0b('0x22')][_0xaf0b('0xc1')](this,_0x14e2c9[_0xaf0b('0x19b')],_0x46e593);return this[_0xaf0b('0xd')]['noop'](_0xaf0b('0x19c'));};AGIVertices[_0xaf0b('0xf')][_0xaf0b('0x19d')]=function(_0x3d4fa9){logger[_0xaf0b('0x2c')](util[_0xaf0b('0x29')](_0xaf0b('0x19e'),_0x3d4fa9[_0xaf0b('0x36')]));return this['channel'][_0xaf0b('0xa8')](_0xaf0b('0x19f'));};AGIVertices[_0xaf0b('0xf')]['sendSMS']=function(_0x57f536){logger['info'](util[_0xaf0b('0x29')](_0xaf0b('0x1a0'),_0x57f536[_0xaf0b('0x36')]));if(!this[_0xaf0b('0x83')](_0x57f536[_0xaf0b('0x1a1')])){return this['channel'][_0xaf0b('0xa8')](_0xaf0b('0x1a2'));}var _0x51043a=this[_0xaf0b('0x32')][_0xaf0b('0xc1')](this,_0x57f536['sms_account_id']);if(!_0x51043a){return this['channel'][_0xaf0b('0x2a')](_0x57f536,_0xaf0b('0x1a3'));}var _0xaef96a={'body':_0x57f536[_0xaf0b('0x1a4')],'phone':_0x57f536['to']||'','SmsAccountId':_0x51043a['id']};logger[_0xaf0b('0xdd')](_0xaf0b('0x1a5'),JSON['stringify'](_0xaef96a));this[_0xaf0b('0x35')][_0xaf0b('0xc1')](this,_0x57f536,_0x57f536[_0xaf0b('0x1a1')]);this['channel'][_0xaf0b('0xa8')](util[_0xaf0b('0x29')](_0xaf0b('0x1a6'),_0x51043a['name']));this['createSmsMessage'][_0xaf0b('0xc1')](this,_0xaef96a);return this['channel'][_0xaf0b('0xa8')]('Sms\x20message\x20added\x20to\x20outgoing\x20process');};AGIVertices[_0xaf0b('0xf')][_0xaf0b('0x1a7')]=function(_0x2dc10a){logger[_0xaf0b('0x2c')](util[_0xaf0b('0x29')]('Enter\x20in\x20SET\x20(%s)\x20block',_0x2dc10a[_0xaf0b('0x36')]));if(!this[_0xaf0b('0x83')](_0x2dc10a[_0xaf0b('0xd4')])){return this['channel'][_0xaf0b('0x2a')](_0x2dc10a,_0xaf0b('0x1a8'));}var _0x3a3bf8=this[_0xaf0b('0xa1')]['sync'](this,_0x2dc10a[_0xaf0b('0xd4')]);if(!_0x3a3bf8){return this[_0xaf0b('0xd')]['error'](_0x2dc10a,_0xaf0b('0xd6'));}return this[_0xaf0b('0xd')][_0xaf0b('0x9e')](_0x3a3bf8,_0x2dc10a[_0xaf0b('0x1a9')]);};AGIVertices['prototype'][_0xaf0b('0x1aa')]=function(_0x82e186){logger['info'](util[_0xaf0b('0x29')](_0xaf0b('0x1ab'),_0x82e186[_0xaf0b('0x36')]));this[_0xaf0b('0xd')][_0xaf0b('0xa8')](_0xaf0b('0x1ac'));var _0x392f6c=this['channel'][_0xaf0b('0xa1')](_0xaf0b('0x1ad'));if(!_[_0xaf0b('0x43')](_0x392f6c[_0xaf0b('0xa2')])){this[_0xaf0b('0xd')][_0xaf0b('0x3a')]=_0x392f6c[_0xaf0b('0xa2')];}if(_0x82e186[_0xaf0b('0xb9')]==='yes'){this[_0xaf0b('0xd')]['noop']('Answer');return this[_0xaf0b('0xd')][_0xaf0b('0xb9')]();}return this[_0xaf0b('0xd')][_0xaf0b('0xa8')](_0xaf0b('0x1ae'));};AGIVertices[_0xaf0b('0xf')][_0xaf0b('0x1af')]=function(_0x39aeb0){logger[_0xaf0b('0x2c')](util['format'](_0xaf0b('0x1b0'),_0x39aeb0['label']));if(!this['isConfigured'](_0x39aeb0['project_id'])){return this[_0xaf0b('0xd')][_0xaf0b('0x2a')](_0x39aeb0,'no\x20subproject\x20selected');}var _0x5d4986=this[_0xaf0b('0x14')][_0xaf0b('0xc1')](this,_0x39aeb0[_0xaf0b('0x1b1')]);if(!this['isConfigured'](_0x5d4986)){return this[_0xaf0b('0xd')][_0xaf0b('0x2a')](_0x39aeb0,util[_0xaf0b('0x29')](_0xaf0b('0x1b2'),_0x39aeb0[_0xaf0b('0x1b1')]));}if(_0x5d4986===this['channel'][_0xaf0b('0x37')]){return this[_0xaf0b('0xd')][_0xaf0b('0x2a')](_0x39aeb0,_0xaf0b('0x1b3'));}this['createSquareDetailsReport']['sync'](this,_0x39aeb0,_0x5d4986);var _0x533412=this['channel'][_0xaf0b('0x56')](_0xaf0b('0x1b4'),util['format']('agi://%s/square,\x22%s\x22,\x22%s\x22',config[_0xaf0b('0x7')][_0xaf0b('0x1b5')]||_0xaf0b('0x1b6'),_0x5d4986,this[_0xaf0b('0xd')]['arg_1']));if(_0x533412[_0xaf0b('0xa3')]===-0x1){return _0x533412;}return this[_0xaf0b('0xd')][_0xaf0b('0xa8')](util['format']('Executed\x20command\x20%s\x20%s','AGI',_0x5d4986));};AGIVertices[_0xaf0b('0xf')][_0xaf0b('0x1b7')]=function(_0x27c175){logger[_0xaf0b('0x2c')](util[_0xaf0b('0x29')](_0xaf0b('0x1b8'),_0x27c175[_0xaf0b('0x36')]));var _0x340b24=this[_0xaf0b('0x55')][_0xaf0b('0xc1')](this,_0x27c175[_0xaf0b('0x1b9')]);this['createSquareDetailsReport'][_0xaf0b('0xc1')](this,_0x27c175,_0x27c175[_0xaf0b('0x1b9')]);if(this['isConfigured'](_0x27c175['variable_id'])){var _0x1bfa6e=this[_0xaf0b('0xa1')]['sync'](this,_0x27c175[_0xaf0b('0xd4')]);if(_0x1bfa6e){this['channel']['setVariable'](_0x1bfa6e,_0x340b24);return this[_0xaf0b('0xd')][_0xaf0b('0xa8')](util[_0xaf0b('0x29')]('sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s',_0x27c175[_0xaf0b('0x1b9')],_0x1bfa6e));}}return this[_0xaf0b('0xd')][_0xaf0b('0xa8')](util[_0xaf0b('0x29')](_0xaf0b('0x1ba'),_0x27c175[_0xaf0b('0x1b9')]));};AGIVertices[_0xaf0b('0xf')][_0xaf0b('0x1bb')]=function(_0xd2b227){logger[_0xaf0b('0x2c')](util[_0xaf0b('0x29')](_0xaf0b('0x1bc'),_0xd2b227[_0xaf0b('0x36')]));_0xd2b227['text']=_0xd2b227[_0xaf0b('0x5c')][_0xaf0b('0x58')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0xaf0b('0x83')](_0xd2b227[_0xaf0b('0x5a')])){return this[_0xaf0b('0xd')][_0xaf0b('0xa8')](_0xaf0b('0x1bd'));}if(!this['isConfigured'](_0xd2b227['text'])){return this['channel']['noop'](_0xaf0b('0xa9'));}this[_0xaf0b('0xd')]['noop'](util['format'](_0xaf0b('0x1be'),_0xd2b227[_0xaf0b('0x5c')]));var _0x43be21=this[_0xaf0b('0x59')][_0xaf0b('0xc1')](this,_0xd2b227);if(_0x43be21){this[_0xaf0b('0xd')][_0xaf0b('0xa8')](util['format']('Google\x20Cloud\x20TTS\x20%s\x20file\x20created',_0x43be21));var _0x3cbf7b=this['channel'][_0xaf0b('0x103')](_0x43be21);try{fs[_0xaf0b('0x104')](_0x43be21+_0xaf0b('0x126'));}catch(_0x11d25b){logger[_0xaf0b('0x2a')](_0x11d25b);}return _0x3cbf7b;}return this[_0xaf0b('0xd')][_0xaf0b('0x2a')](_0xd2b227,_0xaf0b('0x1bf'));};AGIVertices[_0xaf0b('0xf')][_0xaf0b('0x1c0')]=function(_0x3864eb){logger['info'](util[_0xaf0b('0x29')](_0xaf0b('0x1c1'),_0x3864eb['label']));_0x3864eb['text']=_0x3864eb['text'][_0xaf0b('0x58')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0xaf0b('0x83')](_0x3864eb[_0xaf0b('0x5c')])){return this['channel']['noop']('no\x20text\x20configured');}this['channel']['noop'](util['format']('Trying\x20Google\x20TTS\x20%s',_0x3864eb['text']));var _0x5c0b32=this[_0xaf0b('0x60')]['sync'](this,_0x3864eb);if(_0x5c0b32){this[_0xaf0b('0xd')]['noop'](util[_0xaf0b('0x29')](_0xaf0b('0x1c2'),_0x5c0b32));var _0x4ba7eb=this[_0xaf0b('0xd')][_0xaf0b('0x103')](_0x5c0b32);try{fs['unlink'](_0x5c0b32+_0xaf0b('0x126'));}catch(_0x3fef3a){logger[_0xaf0b('0x2a')](_0x3fef3a);}return _0x4ba7eb;}return this[_0xaf0b('0xd')][_0xaf0b('0x2a')](_0x3864eb,_0xaf0b('0x1c3'));};AGIVertices[_0xaf0b('0xf')]['unpause']=function(_0x190dd4){logger[_0xaf0b('0x2c')](util[_0xaf0b('0x29')](_0xaf0b('0x1c4'),_0x190dd4[_0xaf0b('0x36')]));if(!this['isConfigured'](_0x190dd4[_0xaf0b('0x15e')])){return this[_0xaf0b('0xd')][_0xaf0b('0x2a')](_0x190dd4,'no\x20find\x20by\x20configured');}logger[_0xaf0b('0x2c')](util[_0xaf0b('0x29')](_0xaf0b('0x15d'),this['channel']['callerid'],_0x190dd4[_0xaf0b('0x15e')]));var _0x448956=this['agentUnpause'][_0xaf0b('0xc1')](this,_0x190dd4[_0xaf0b('0x15e')]);if(_0x448956){logger['info'](util[_0xaf0b('0x29')]('AGENT\x20%s\x20FOUND\x20BY',this[_0xaf0b('0xd')][_0xaf0b('0x38')],_0x190dd4[_0xaf0b('0x15e')]));this[_0xaf0b('0xd')][_0xaf0b('0xa8')](util['format']('AGENT\x20%s\x20FOUND\x20BY',this[_0xaf0b('0xd')][_0xaf0b('0x38')],_0x190dd4[_0xaf0b('0x15e')]));return{'code':0xc8,'result':_0xaf0b('0x160')};}else{logger['info'](util[_0xaf0b('0x29')](_0xaf0b('0x161'),this[_0xaf0b('0xd')]['callerid'],_0x190dd4['findBy']));this[_0xaf0b('0xd')][_0xaf0b('0xa8')](util['format'](_0xaf0b('0x161'),this[_0xaf0b('0xd')][_0xaf0b('0x38')],_0x190dd4['findBy']));return{'code':0xc8,'result':_0xaf0b('0x162')};}};AGIVertices[_0xaf0b('0xf')]['voicemail']=function(_0x521cc7){logger[_0xaf0b('0x2c')](util['format'](_0xaf0b('0x1c5'),_0x521cc7['label']));var _0x42a71e=this[_0xaf0b('0xd')]['exec'](_0xaf0b('0x1c6'),[_0x521cc7['mailbox'],_0x521cc7[_0xaf0b('0xaa')]]);if(_0x42a71e['result']===-0x1){return _0x42a71e;}return this[_0xaf0b('0xd')][_0xaf0b('0xa8')](util[_0xaf0b('0x29')](_0xaf0b('0x172'),'VOICEMAIL',_0x521cc7['mailbox']));};AGIVertices[_0xaf0b('0xf')][_0xaf0b('0x1c7')]=function(_0x583138){logger['info'](util[_0xaf0b('0x29')]('Enter\x20in\x20SWITCH\x20(%s)\x20block',_0x583138['label']));if(!this['isConfigured'](_0x583138[_0xaf0b('0xd4')])){return this[_0xaf0b('0xd')][_0xaf0b('0x2a')](_0x583138,_0xaf0b('0x1a8'));}var _0x26bc71=this[_0xaf0b('0xa1')][_0xaf0b('0xc1')](this,_0x583138[_0xaf0b('0xd4')]);if(!_0x26bc71){return this[_0xaf0b('0xd')][_0xaf0b('0x2a')](_0x583138,_0xaf0b('0xd6'));}var _0x2921b0=this[_0xaf0b('0xd')][_0xaf0b('0xa1')](_0x26bc71);return{'code':0xc8,'result':_0x2921b0[_0xaf0b('0xa2')]?_0x2921b0['extra']:'-'};};String[_0xaf0b('0xf')][_0xaf0b('0x1c8')]=function(_0x593376,_0x2f6741){return this[_0xaf0b('0xa0')](_0x593376)['join'](_0x2f6741);};module[_0xaf0b('0x1c9')]=AGIVertices; \ No newline at end of file +var _0xc978=['Enter\x20in\x20SESTEKNDA\x20(%s)\x20block','no\x20ndauth\x20url\x20configured','username','no\x20username\x20configured','password','no\x20password\x20configured','ndassistant_url','Trying\x20SestekNDA:\x20%s','SESTEK_NDA_%s','Sestek\x20NDA\x20%s\x20file\x20created','audiofile','streamFile','unlink','.wav','end','ext_dial','Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block','trunk_id','no\x20trunk\x20selected','no\x20trunk\x20found','trunk_name','SIP/%s/%s','finally','Enter\x20in\x20FINALLY\x20(%s)\x20block','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','maxRetry','no\x20file\x20audio\x20selected','no\x20file\x20audio\x20found','response','maxdigit','test','hiddendigitsnum','generate','hiddendigitspos','substr','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','goal','Enter\x20in\x20GOAL\x20(%s)\x20block','goalname','awspolly','[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block','no\x20valid\x20credentials\x20configured','aws\x20Polly\x20%s\x20file\x20created','aws\x20Polly\x20is\x20unreachable','Trying\x20Amazon\x20Lex:\x20%s','Amazon\x20Lex\x20ready\x20for\x20fulfillment','Amazon\x20Lex\x20is\x20unreachable','wav','%s/recordings/%s','beep','NOBEEP','recordFile','intKey','google\x20%s\x20file\x20created','googleASR','GOOGLE_ASR_%s','Enter\x20in\x20TILDEASR\x20(%s)\x20block','no\x20appid\x20configured','tilde\x20%s\x20file\x20created','TildeASR\x20Result\x20%s','gotoc','Enter\x20in\x20GOTO\x20(%s)\x20block','gotoif','Enter\x20in\x20GOTOIF\x20(%s)\x20block','condition','no\x20condition\x20configured','true','false','EVAL\x20CONDITION\x20%s\x20%s','Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block','no\x20interval\x20configured','interval_id','no\x20intervals\x20found','IFTIME(%s?true:false)','IFTIME\x20%s\x20%s','hangup','Enter\x20in\x20HANGUP\x20(%s)\x20block','ispeechasr','ispeech\x20%s\x20file\x20created','ISPEECH_ASR_%s','IspeechASR\x20Result\x20%s','ispeechtts','Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block','ispeech\x20TTS\x20is\x20unreachable','Enter\x20in\x20LOGIN\x20(%s)\x20block','findBy','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','math','operation','math\x20%s','variable\x20%s[key]\x20set','Enter\x20in\x20MENU\x20(%s)\x20block','file_id','getData','Enter\x20in\x20NOOP\x20(%s)\x20block','output','pause','Enter\x20in\x20PAUSE\x20(%s)\x20block','pause_id','failure','playback','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','PLAYBACK','queue','Enter\x20in\x20QUEUE\x20(%s)\x20block','queue_id','no\x20queue\x20selected','indexOf','XMCS-QUEUE','toLowerCase','QUEUE','macro','gosub','position','record','Enter\x20in\x20RECORD\x20(%s)\x20block','recordingFormat','%s_%s','%s/recordings/%s.%s','RECORDING_SAVENAME','Recording\x20%s\x20%s\x20%s\x20%s','escape_digits','restapi','Enter\x20in\x20RESTAPI\x20(%s)\x20block','Response:','inspect','no\x20variable\x20selected\x20for\x20the\x20response','%s_STATUS_CODE','200','%s_STATUS_MESSAGE','statusMessage','Unable\x20to\x20set\x20result\x20in\x20variable\x20%s','saydigits','Enter\x20in\x20SAYDIGITS\x20(%s)\x20block','sayDigits','saynumber','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','sayphonetic','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','user','bcc','subject','template_id','sendMail\x20message','Trying\x20SendMail\x20with\x20account\x20%s','Mail\x20message\x20added\x20to\x20outgoing\x20process','sendFax','Enter\x20in\x20SENDFAX\x20(%s)\x20block','SENDFAX\x20block\x20not\x20implemented','sendSMS','Enter\x20in\x20SENDSMS\x20(%s)\x20block','sms_account_id','no\x20sms\x20account\x20configured','no\x20sms\x20account\x20found','sms_text','sendSMS\x20message','Sms\x20message\x20added\x20to\x20outgoing\x20process','no\x20variable\x20selected','variable_value','XMCS-UNIQUEID','Skipped\x20Answer','subproject','project_id','no\x20subproject\x20selected','no\x20subproject\x20found\x20with\x20id\x20%d','project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project','agi://%s/square,\x22%s\x22,\x22%s\x22','host','127.0.0.1','AGI','system','Enter\x20in\x20SYSTEM\x20(%s)\x20block','command','sh\x20command:\x20%s\x20result\x20no\x20stored','google_cloud_tts','Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block','apiKey','no\x20apiKey\x20configured','Trying\x20Google\x20Cloud\x20TTS\x20%s','Google\x20Cloud\x20TTS\x20%s\x20file\x20created','Google\x20Cloud\x20TTS\x20is\x20unreachable','tts','Enter\x20in\x20GOOGLETTS\x20(%s)\x20block','Google\x20TTS\x20%s\x20file\x20created','Google\x20TTS\x20is\x20unreachable','unpause','Enter\x20in\x20UNPAUSE\x20(%s)\x20block','no\x20find\x20by\x20configured','Enter\x20in\x20VOICEMAIL\x20(%s)\x20block','mailbox','VOICEMAIL','replaceAll','join','exports','util','lodash','shelljs','odbc','randomstring','moment','request-promise','../../config/logger','agi','../../config/environment','./scripts','/var/opt/motion2/server/files','rawHeaders','menu','getdigits','getsecretdigits','channel','mailRpc','prototype','getVariable','rpc','getVariableById','then','catch','getVoiceQueue','name','getSquareProject','getSquareProjectById','getSquareOdbc','getSquareOdbcById','dsn','getTrunk','getSound','getSoundById','save_name','getMailAccountById','sendMailMessage','getIntervals','IntervalId','interval','map','Intervals','getSoundPath','format','%s/sounds/converted/%s','open','error','Error\x20getting\x20ODBC\x20connection\x20%s','info','ODBC\x20connection\x20successfully','Error\x20executing\x20query\x20%s','Query\x20executed\x20correctly\x20%s','Error\x20closing\x20connection\x20to\x20odbc\x20%s','getSmsAccount','getSmsAccountById','createSmsMessage','createSquareDetailsReport','uniqueid','label','agicommand','arg_1','calleridname','extension','accountcode','dnid','createSquareMessage','createCmContact','isEmpty','isNil','callback_','lastName','phone','list_id','scheduledAt','Callback\x20scheduled\x20at\x20','toString','callback_priority','getPause','getPauseById','agentPause','agent','callerid','agentLogout','agentLogin','internal','shellCommand','exec','trim','replace','googleCloudTTS','google_cloud_tts_text_type','text','languageCode','en-US','ssmlGender','audioEncoding','googleTTS','google_tts_language','restAPI','method','timeout','number','includes','PUT','toUpperCase','body','parse','rawBody','An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function','headers','computedVariables','sync','render','url','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','dialogflowV2_language','sestekNDA','ispeechTTS','key','ispeech_tts_language','speed','ispeechASR','ispeech_asr_language','isConfigured','model','awsPolly','aws_access_key_id','aws_secret_access_key','aws_polly_voice','awsLex','aws_lex_region','aws_bot_name','tildeASR','appid','appsecret','uri','clear','isString','replaceObjectAllVariables','replaceAllVariables','recursiveNodeIndex','hasOwnProperty','isPlainObject','isArray','length','saveRestApiResult','%s.%s','setVariable','split','getAndSetVariable','result','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','extra','retry','mrcpsynth','noop','MRCPSynth','mrcprecog','Enter\x20in\x20MRCPRecog\x20(%s)\x20block','grammar','no\x20grammar\x20configured','RECOG_CONFIDENCE()','MRCP_RECOG_CONFIDENCE','RECOG_INPUT()','MRCP_RECOG_TRANSCRIPT','RECOG_INSTANCE()','MRCP_RECOG_INSTANCE','Executed\x20command\x20MRCPRecog\x20%s','Enter\x20in\x20AGI\x20(%s)\x20block','args','Enter\x20in\x20ANSWER\x20(%s)\x20block','Wait\x20%s\x20seconds\x20before\x20answer','wait','answer','callback','no\x20list\x20selected','add','delay','minutes','CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s','Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block','Executed\x20command\x20%s\x20%s','application','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','Enter\x20in\x20SESTEKTTS\x20(%s)\x20block','no\x20text\x20configured','Executed\x20command\x20MRCPSynth\x20%s','lumenvoxasr','LUMENVOX_ASR_TRANSCRIPT','LUMENVOX_ASR_INSTANCE','sestekasr','Enter\x20in\x20SESTEKASR\x20(%s)\x20block','MRCPRecog','SESTEK_ASR_CONFIDENCE','SESTEK_ASR_TRANSCRIPT','database','Enter\x20in\x20DATABASE\x20(%s)\x20block','odbc_id','no\x20odbc\x20database\x20found','query','no\x20query\x20configured','query:\x20%s','getQueryOdbc','no\x20variable\x20selected\x20for\x20the\x20result','variable_id','no\x20variable\x20found','forEach','keys','%s[%s][%s]','variable\x20%s\x20set','dial','debug','sip_id','no\x20user\x20selected','getUser','no\x20user\x20found','DIAL','SIP/%s','opts','dialogflow','no\x20key\x20configured','bot','Trying\x20Dialogflow:\x20%s','speech','out','Dialogflow\x20Result\x20%s','Dialogflow\x20is\x20unreachable','dialogflowV2','no\x20project_id\x20configured','no\x20client_email\x20configured','no\x20anguage\x20configured','Trying\x20DialogflowV2:\x20%s','providerResponse','DialogflowV2\x20Result\x20%s','DialogflowV2\x20is\x20unreachable','sesteknda'];(function(_0x44c768,_0x552a5e){var _0x55daf5=function(_0x4958e8){while(--_0x4958e8){_0x44c768['push'](_0x44c768['shift']());}};_0x55daf5(++_0x552a5e);}(_0xc978,0xcd));var _0x8c97=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xc978[_0x20a584];return _0x4b41a8;};'use strict';var fs=require('fs');var util=require(_0x8c97('0x0'));var _=require(_0x8c97('0x1'));var sh=require(_0x8c97('0x2'));var odbc=require(_0x8c97('0x3'))();var rs=require(_0x8c97('0x4'));var moment=require(_0x8c97('0x5'));var Mustache=require('mustache');var rp=require(_0x8c97('0x6'));var logger=require(_0x8c97('0x7'))(_0x8c97('0x8'));var config=require(_0x8c97('0x9'));var scripts=require(_0x8c97('0xa'));var FILES_PATH=_0x8c97('0xb');var recursiveMapAttributes=[_0x8c97('0xc'),'rawBody'];var verticesWithRetry=[_0x8c97('0xd'),_0x8c97('0xe'),_0x8c97('0xf')];var AGIVertices=function(_0x26ff40,_0x12116e,_0x2be0b3){this[_0x8c97('0x10')]=_0x26ff40;this['rpc']=_0x12116e;this[_0x8c97('0x11')]=_0x2be0b3;};AGIVertices[_0x8c97('0x12')][_0x8c97('0x13')]=function(_0x3a34b2,_0x400eb6){this[_0x8c97('0x14')][_0x8c97('0x15')](_0x3a34b2)[_0x8c97('0x16')](function(_0x36a84b){_0x400eb6(null,_0x36a84b?_0x36a84b['name']:![]);})[_0x8c97('0x17')](function(_0x346274){_0x400eb6(_0x346274);});};AGIVertices['prototype'][_0x8c97('0x18')]=function(_0x34be9b,_0x4c6227){this[_0x8c97('0x14')]['getVoiceQueueById'](_0x34be9b)['then'](function(_0x57902c){_0x4c6227(null,_0x57902c?_0x57902c[_0x8c97('0x19')]:![]);})[_0x8c97('0x17')](function(_0x17065f){_0x4c6227(_0x17065f);});};AGIVertices[_0x8c97('0x12')][_0x8c97('0x1a')]=function(_0x29767b,_0x1ea67f){this[_0x8c97('0x14')][_0x8c97('0x1b')](_0x29767b)['then'](function(_0x3d9c35){_0x1ea67f(null,_0x3d9c35?_0x3d9c35[_0x8c97('0x19')]:![]);})[_0x8c97('0x17')](function(_0x3b57ed){_0x1ea67f(_0x3b57ed);});};AGIVertices[_0x8c97('0x12')][_0x8c97('0x1c')]=function(_0xb502e7,_0x400bbc){this[_0x8c97('0x14')][_0x8c97('0x1d')](_0xb502e7)[_0x8c97('0x16')](function(_0xb55f9b){_0x400bbc(null,_0xb55f9b?_0xb55f9b[_0x8c97('0x1e')]:![]);})[_0x8c97('0x17')](function(_0x3ea5a3){_0x400bbc(_0x3ea5a3);});};AGIVertices[_0x8c97('0x12')]['getUser']=function(_0x33a9a8,_0x29b396){this[_0x8c97('0x14')]['getUserById'](_0x33a9a8)['then'](function(_0xe5268d){_0x29b396(null,_0xe5268d?_0xe5268d['name']:![]);})[_0x8c97('0x17')](function(_0x1f2dd5){_0x29b396(_0x1f2dd5);});};AGIVertices[_0x8c97('0x12')][_0x8c97('0x1f')]=function(_0x354251,_0x42464a){this[_0x8c97('0x14')]['getTrunkById'](_0x354251)['then'](function(_0x3804d0){_0x42464a(null,_0x3804d0?_0x3804d0[_0x8c97('0x19')]:![]);})[_0x8c97('0x17')](function(_0x50d003){_0x42464a(_0x50d003);});};AGIVertices['prototype'][_0x8c97('0x20')]=function(_0x37986d,_0x34095){var _0x1609de=this;this[_0x8c97('0x14')][_0x8c97('0x21')](_0x37986d)['then'](function(_0x443dfd){_0x34095(null,_0x443dfd?_0x1609de['getSoundPath'](_0x443dfd[_0x8c97('0x22')]):![]);})['catch'](function(_0x245d15){_0x34095(_0x245d15);});};AGIVertices[_0x8c97('0x12')]['getMailAccount']=function(_0x3da4fc,_0x57fef8){this[_0x8c97('0x14')][_0x8c97('0x23')](_0x3da4fc)[_0x8c97('0x16')](function(_0x2ebba4){_0x57fef8(null,_0x2ebba4?_0x2ebba4:![]);})[_0x8c97('0x17')](function(_0x3644dd){_0x57fef8(_0x3644dd);});};AGIVertices['prototype']['sendMailMessage']=function(_0x12a7d0,_0x26d5dc,_0x2575d0){this['mailRpc'][_0x8c97('0x24')](_0x12a7d0,_0x26d5dc)['then'](function(){_0x2575d0(null);})['catch'](function(_0x27f76d){_0x2575d0(_0x27f76d);});};AGIVertices[_0x8c97('0x12')][_0x8c97('0x25')]=function(_0x1ff954,_0x1e5751){this[_0x8c97('0x14')]['getIntervalById'](_0x1ff954)[_0x8c97('0x16')](function(_0x3168ba){if(_0x3168ba){if(_0x3168ba[_0x8c97('0x26')]){_0x1e5751(null,[_0x3168ba[_0x8c97('0x27')]]);}else{_0x1e5751(null,_[_0x8c97('0x28')](_0x3168ba[_0x8c97('0x29')],_0x8c97('0x27')));}}else{_0x1e5751(null,![]);}})[_0x8c97('0x17')](function(_0x5e16d6){_0x1e5751(_0x5e16d6);});};AGIVertices[_0x8c97('0x12')][_0x8c97('0x2a')]=function(_0x2e07e6){return util[_0x8c97('0x2b')](_0x8c97('0x2c'),FILES_PATH,_0x2e07e6);};AGIVertices[_0x8c97('0x12')]['getQueryOdbc']=function(_0x473d52,_0x441612,_0x2beaaf){odbc[_0x8c97('0x2d')](_0x473d52,function(_0x19045e){if(_0x19045e){logger[_0x8c97('0x2e')](_0x8c97('0x2f'),_0x19045e);_0x2beaaf(_0x19045e);}else{logger[_0x8c97('0x30')](_0x8c97('0x31'));odbc['query'](_0x441612,function(_0x20fe2f,_0x3bcce3){if(_0x20fe2f){logger[_0x8c97('0x30')](_0x8c97('0x32'),_0x441612);_0x2beaaf(_0x20fe2f);}else{logger[_0x8c97('0x30')](_0x8c97('0x33'),_0x441612);odbc['close'](function(_0x20b9c3){if(_0x20b9c3){logger[_0x8c97('0x2e')](_0x8c97('0x34'),_0x20b9c3);}_0x2beaaf(null,_0x3bcce3);});}});}});};AGIVertices[_0x8c97('0x12')][_0x8c97('0x35')]=function(_0x4374c5,_0x1e3719){this[_0x8c97('0x14')][_0x8c97('0x36')](_0x4374c5)[_0x8c97('0x16')](function(_0x3220b7){_0x1e3719(null,_0x3220b7?_0x3220b7:![]);})[_0x8c97('0x17')](function(_0x3b41f6){_0x1e3719(_0x3b41f6);});};AGIVertices[_0x8c97('0x12')][_0x8c97('0x37')]=function(_0xdd2417,_0x44f204){this[_0x8c97('0x14')][_0x8c97('0x37')](_0xdd2417)[_0x8c97('0x16')](function(_0x4cf496){_0x44f204(null,_0x4cf496);})[_0x8c97('0x17')](function(_0x340060){_0x44f204(_0x340060);});};AGIVertices[_0x8c97('0x12')][_0x8c97('0x38')]=function(_0x35a230,_0x30da94,_0x541c69){this[_0x8c97('0x14')][_0x8c97('0x38')]({'uniqueid':this[_0x8c97('0x10')][_0x8c97('0x39')],'node':_0x35a230[_0x8c97('0x3a')],'application':_0x35a230[_0x8c97('0x3b')],'data':_0x30da94||null,'project_name':this[_0x8c97('0x10')][_0x8c97('0x3c')],'callerid':this[_0x8c97('0x10')]['callerid']})[_0x8c97('0x16')](function(_0x1a69fe){if(_0x541c69){_0x541c69(null,_0x1a69fe);}})[_0x8c97('0x17')](function(_0x42c0e0){if(_0x541c69){_0x541c69(_0x42c0e0);}});};AGIVertices[_0x8c97('0x12')]['createSquareRecording']=function(_0x50e565,_0x13bec2,_0x5b505b,_0x3039b9){this[_0x8c97('0x14')]['createSquareRecording']({'uniqueid':this[_0x8c97('0x10')][_0x8c97('0x39')],'callerid':this['channel']['callerid'],'calleridname':this[_0x8c97('0x10')][_0x8c97('0x3d')],'context':this['channel']['context'],'extension':this['channel'][_0x8c97('0x3e')],'priority':this['channel']['priority'],'accountcode':this[_0x8c97('0x10')][_0x8c97('0x3f')],'dnid':this[_0x8c97('0x10')][_0x8c97('0x40')],'projectName':this[_0x8c97('0x10')][_0x8c97('0x3c')],'saveName':_0x13bec2,'filename':_0x50e565['file']||_0x13bec2,'savePath':_0x5b505b})[_0x8c97('0x16')](function(_0x3703eb){_0x3039b9(null,_0x3703eb);})[_0x8c97('0x17')](function(_0x451d61){_0x3039b9(_0x451d61);});};AGIVertices[_0x8c97('0x12')][_0x8c97('0x41')]=function(_0x431e0f,_0x15d0ab,_0x460261,_0x1147f9,_0x478390){this[_0x8c97('0x14')][_0x8c97('0x41')]({'uniqueid':this['channel'][_0x8c97('0x39')],'body':_0x431e0f,'direction':_0x15d0ab,'providerName':_0x460261,'providerResponse':_0x1147f9})[_0x8c97('0x16')](function(_0x35d935){if(_0x478390){_0x478390(null,_0x35d935);}})[_0x8c97('0x17')](function(_0x1252e1){if(_0x478390){_0x478390(_0x1252e1);}});};AGIVertices[_0x8c97('0x12')][_0x8c97('0x42')]=function(_0x428a51,_0x3c4b55){this[_0x8c97('0x14')][_0x8c97('0x42')]({'firstName':_[_0x8c97('0x43')](_0x428a51['name'])||_[_0x8c97('0x44')](_0x428a51[_0x8c97('0x19')])?_0x8c97('0x45')+Math['random']():_0x428a51['name'],'lastName':_[_0x8c97('0x43')](_0x428a51['lastName'])||_[_0x8c97('0x44')](_0x428a51[_0x8c97('0x46')])?null:_0x428a51[_0x8c97('0x46')],'phone':_0x428a51[_0x8c97('0x47')],'ListId':_0x428a51[_0x8c97('0x48')],'scheduledat':_0x428a51[_0x8c97('0x49')],'callbackUniqueid':this[_0x8c97('0x10')][_0x8c97('0x39')],'tags':'callback','description':_0x8c97('0x4a')+_0x428a51[_0x8c97('0x49')][_0x8c97('0x4b')](),'priority':_0x428a51[_0x8c97('0x4c')]})['then'](function(_0x2440fd){_0x3c4b55(null,_0x2440fd);})['catch'](function(_0x5b5f3f){_0x3c4b55(_0x5b5f3f);});};AGIVertices['prototype'][_0x8c97('0x4d')]=function(_0x53b5e7,_0xe84472){this[_0x8c97('0x14')][_0x8c97('0x4e')](_0x53b5e7)[_0x8c97('0x16')](function(_0x30ff13){_0xe84472(null,_0x30ff13?_0x30ff13[_0x8c97('0x19')]:![]);})[_0x8c97('0x17')](function(_0x1ac60e){_0xe84472(_0x1ac60e);});};AGIVertices[_0x8c97('0x12')][_0x8c97('0x4f')]=function(_0x4ad6bd,_0x5bf9ae,_0x3e5186){var _0x48c9d7={'role':_0x8c97('0x50')};_0x48c9d7[_0x4ad6bd]=this['channel']['callerid'];this[_0x8c97('0x14')][_0x8c97('0x4f')](_0x48c9d7,_0x5bf9ae,this['channel']['uniqueid'])[_0x8c97('0x16')](function(_0x345e27){_0x3e5186(null,_[_0x8c97('0x44')](_0x345e27)?![]:!![]);})[_0x8c97('0x17')](function(_0x583527){logger[_0x8c97('0x2e')](_0x583527);_0x3e5186(null,![]);});};AGIVertices['prototype']['agentUnpause']=function(_0x3d9f53,_0x5485b0){var _0x315fc9={'role':_0x8c97('0x50')};_0x315fc9[_0x3d9f53]=this[_0x8c97('0x10')][_0x8c97('0x51')];this[_0x8c97('0x14')]['agentUnpause'](_0x315fc9)[_0x8c97('0x16')](function(_0x2f92df){_0x5485b0(null,_['isNil'](_0x2f92df)?![]:!![]);})[_0x8c97('0x17')](function(_0x29b90a){logger['error'](_0x29b90a);_0x5485b0(null,![]);});};AGIVertices[_0x8c97('0x12')][_0x8c97('0x52')]=function(_0x10f97d,_0x37b41a){var _0x55452e={'role':'agent'};_0x55452e[_0x10f97d]=this[_0x8c97('0x10')]['callerid'];this[_0x8c97('0x14')]['agentLogout'](_0x55452e)[_0x8c97('0x16')](function(_0x32ebca){_0x37b41a(null,_[_0x8c97('0x44')](_0x32ebca)?![]:!![]);})[_0x8c97('0x17')](function(_0xb3a9e7){logger[_0x8c97('0x2e')](_0xb3a9e7);_0x37b41a(null,![]);});};AGIVertices[_0x8c97('0x12')][_0x8c97('0x53')]=function(_0x13b923,_0x5da113){var _0x16ecda={'role':_0x8c97('0x50')};_0x16ecda[_0x13b923]=this[_0x8c97('0x10')][_0x8c97('0x51')];var _0x17cd47=_0x13b923!=_0x8c97('0x54')?util[_0x8c97('0x2b')]('%s/%s@from-sip/n','LOCAL',this[_0x8c97('0x10')][_0x8c97('0x51')]):undefined;this[_0x8c97('0x14')][_0x8c97('0x53')](_0x16ecda,_0x17cd47)['then'](function(_0x43e81a){_0x5da113(null,_['isNil'](_0x43e81a)?![]:!![]);})[_0x8c97('0x17')](function(_0x36d7e8){logger[_0x8c97('0x2e')](_0x36d7e8);_0x5da113(null,![]);});};AGIVertices[_0x8c97('0x12')][_0x8c97('0x55')]=function(_0x1b0f58,_0x1dc1c4){sh[_0x8c97('0x56')](_[_0x8c97('0x57')](_0x1b0f58),function(_0x546847,_0x44e8d8){var _0x917baf=_0x44e8d8[_0x8c97('0x58')](/(\r\n|\n|\r)/gm,'');_0x1dc1c4(null,_0x917baf);});};AGIVertices[_0x8c97('0x12')][_0x8c97('0x59')]=function(_0x371cdf,_0x5edf01){scripts[_0x8c97('0x59')](_0x371cdf['apiKey'],_0x371cdf[_0x8c97('0x5a')]||'text',_0x371cdf[_0x8c97('0x5b')],_0x371cdf[_0x8c97('0x5c')]||_0x8c97('0x5d'),_0x371cdf[_0x8c97('0x5e')]||'MALE',_0x371cdf[_0x8c97('0x5f')]||'MP3')['then'](function(_0x5ed38c){_0x5edf01(null,_0x5ed38c);})['catch'](function(_0x9d4290){_0x5edf01(_0x9d4290);});};AGIVertices[_0x8c97('0x12')][_0x8c97('0x60')]=function(_0x79a956,_0x1804ce){scripts['googleTTS'](_0x79a956['text'],_0x79a956[_0x8c97('0x61')]||'en',0x1)[_0x8c97('0x16')](function(_0x3572a0){_0x1804ce(null,_0x3572a0);})[_0x8c97('0x17')](function(_0x1f83fe){_0x1804ce(_0x1f83fe);});};AGIVertices[_0x8c97('0x12')][_0x8c97('0x62')]=function(_0x15fc3b,_0x5c2e61){var _0x4eb51d={'uri':_0x15fc3b['url'],'method':_0x15fc3b[_0x8c97('0x63')],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0x15fc3b[_0x8c97('0x64')])===_0x8c97('0x65')&&parseInt(_0x15fc3b[_0x8c97('0x64')])>=0x1?parseInt(_0x15fc3b['timeout'])*0x3e8:0x5*0x3e8};if(_[_0x8c97('0x66')](['POST',_0x8c97('0x67')],_0x4eb51d['method'][_0x8c97('0x68')]())){try{_0x4eb51d[_0x8c97('0x69')]=_0x15fc3b['rawBody']?JSON[_0x8c97('0x6a')](_0x15fc3b[_0x8c97('0x6b')]):{};}catch(_0x1e3c6c){logger[_0x8c97('0x2e')](_0x8c97('0x6c'),_0x1e3c6c);}}try{_0x4eb51d[_0x8c97('0x6d')]=_0x15fc3b[_0x8c97('0xc')]?JSON['parse'](_0x15fc3b[_0x8c97('0xc')]):{};}catch(_0x1d8ad6){logger[_0x8c97('0x2e')]('An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function',_0x1d8ad6);}if(_0x15fc3b[_0x8c97('0x6e')]){try{var _0x105d97=require(_0x15fc3b[_0x8c97('0x6e')])[_0x8c97('0x6f')](this,_0x4eb51d);_0x4eb51d['uri']=Mustache[_0x8c97('0x70')](_0x15fc3b[_0x8c97('0x71')],_0x105d97,{},['$$','$$']);if(_0x4eb51d[_0x8c97('0x6d')]){_0x4eb51d['headers']=JSON['parse'](Mustache[_0x8c97('0x70')](JSON[_0x8c97('0x72')](_0x4eb51d[_0x8c97('0x6d')]),_0x105d97,{},['$$','$$']));}if(_0x4eb51d[_0x8c97('0x69')]){_0x4eb51d[_0x8c97('0x69')]=JSON[_0x8c97('0x6a')](Mustache[_0x8c97('0x70')](JSON[_0x8c97('0x72')](_0x4eb51d['body']),_0x105d97,{},['$$','$$']));}}catch(_0x57274e){logger[_0x8c97('0x2e')](_0x8c97('0x73'),_0x57274e);}}rp(_0x4eb51d)['then'](function(_0x969c33){var _0x4694a9={'statusCode':_0x969c33[_0x8c97('0x74')]||0xc8,'statusMessage':_0x969c33['statusMessage']||'OK','headers':_0x969c33['headers']||{},'body':_0x969c33[_0x8c97('0x69')]||{}};_0x5c2e61(null,_0x4694a9);})[_0x8c97('0x17')](function(_0x48517d){var _0x132595={'statusCode':_0x48517d[_0x8c97('0x74')]||0x1f4,'statusMessage':_0x48517d[_0x8c97('0x75')]||_0x8c97('0x76'),'headers':_0x48517d[_0x8c97('0x77')][_0x8c97('0x6d')]||{},'body':_0x48517d['options'][_0x8c97('0x69')]||{}};_0x5c2e61(null,_0x132595);});};AGIVertices[_0x8c97('0x12')][_0x8c97('0x78')]=function(_0x5a3678,_0x5ec529){scripts[_0x8c97('0x78')](this[_0x8c97('0x10')][_0x8c97('0x39')],_0x5a3678['key'],_0x5a3678['text'],_0x5a3678[_0x8c97('0x79')]||'en')[_0x8c97('0x16')](function(_0x301ea3){_0x5ec529(null,_0x301ea3);})['catch'](function(_0x2b95c0){_0x5ec529(_0x2b95c0);});};AGIVertices['prototype'][_0x8c97('0x7a')]=function(_0x51d6d2,_0x502f7e){scripts[_0x8c97('0x7a')](this[_0x8c97('0x10')][_0x8c97('0x39')],_0x51d6d2[_0x8c97('0x7b')],_0x51d6d2[_0x8c97('0x7c')],_0x51d6d2[_0x8c97('0x7d')],_0x51d6d2[_0x8c97('0x5b')],_0x51d6d2[_0x8c97('0x7e')]||'en')[_0x8c97('0x16')](function(_0x4a8a3b){_0x502f7e(null,_0x4a8a3b);})[_0x8c97('0x17')](function(_0xc5ee2d){_0x502f7e(_0xc5ee2d);});};AGIVertices['prototype']['sestekNDA']=function(_0x2f72db,_0x33b02c){scripts[_0x8c97('0x7f')](this[_0x8c97('0x10')],_0x2f72db)[_0x8c97('0x16')](function(_0xb76642){_0x33b02c(null,_0xb76642);})[_0x8c97('0x17')](function(_0x12a6c9){_0x33b02c(_0x12a6c9);});};AGIVertices[_0x8c97('0x12')][_0x8c97('0x80')]=function(_0x426399,_0x1d91bc){scripts['ispeechTTS'](_0x426399[_0x8c97('0x81')],_0x426399[_0x8c97('0x5b')],_0x426399[_0x8c97('0x82')]||_0x8c97('0x5d'),_0x426399[_0x8c97('0x83')])[_0x8c97('0x16')](function(_0x3ee7eb){_0x1d91bc(null,_0x3ee7eb);})[_0x8c97('0x17')](function(_0x519788){_0x1d91bc(_0x519788);});};AGIVertices['prototype'][_0x8c97('0x84')]=function(_0x23b8bf,_0x4b5bac,_0xff547f){scripts[_0x8c97('0x84')](_0x4b5bac,_0x23b8bf[_0x8c97('0x81')],_0x23b8bf[_0x8c97('0x85')]||_0x8c97('0x5d'),this[_0x8c97('0x86')](_0x23b8bf[_0x8c97('0x87')])?_0x23b8bf[_0x8c97('0x87')]:undefined)[_0x8c97('0x16')](function(_0x25fabd){_0xff547f(null,_0x25fabd);})[_0x8c97('0x17')](function(_0xb1f550){_0xff547f(_0xb1f550);});};AGIVertices[_0x8c97('0x12')][_0x8c97('0x88')]=function(_0x180df4,_0x4b2cc8){scripts[_0x8c97('0x88')](_0x180df4[_0x8c97('0x89')],_0x180df4[_0x8c97('0x8a')],_0x180df4['aws_polly_region'],_0x180df4[_0x8c97('0x8b')]||'Amy',_0x180df4['text'],_0x180df4['aws_text_type']||'text')[_0x8c97('0x16')](function(_0xc478a3){_0x4b2cc8(null,_0xc478a3);})[_0x8c97('0x17')](function(_0x5a95f6){_0x4b2cc8(_0x5a95f6);});};AGIVertices[_0x8c97('0x12')][_0x8c97('0x8c')]=function(_0x242da3,_0x57df4b){scripts[_0x8c97('0x8c')](this[_0x8c97('0x10')][_0x8c97('0x39')],_0x242da3[_0x8c97('0x89')],_0x242da3[_0x8c97('0x8a')],_0x242da3[_0x8c97('0x8d')],_0x242da3[_0x8c97('0x5b')],_0x242da3[_0x8c97('0x8e')])[_0x8c97('0x16')](function(_0x2faf32){_0x57df4b(null,_0x2faf32);})['catch'](function(_0x21292b){_0x57df4b(_0x21292b);});};AGIVertices[_0x8c97('0x12')]['googleASR']=function(_0x238038,_0x43debf,_0xed8d5c){scripts['googleASR'](_0x43debf,_0x238038[_0x8c97('0x81')],_0x238038['google_asr_language']||_0x8c97('0x5d'))[_0x8c97('0x16')](function(_0x2c7af6){_0xed8d5c(null,_0x2c7af6);})[_0x8c97('0x17')](function(_0xae164d){_0xed8d5c(_0xae164d);});};AGIVertices[_0x8c97('0x12')][_0x8c97('0x8f')]=function(_0x3654a9,_0x4c254a,_0x2f36f5){scripts[_0x8c97('0x8f')](_0x4c254a,_0x3654a9[_0x8c97('0x90')],_0x3654a9[_0x8c97('0x91')],_0x3654a9[_0x8c97('0x92')])[_0x8c97('0x16')](function(_0x4beb4d){_0x2f36f5(null,_0x4beb4d);})['catch'](function(_0x2dfed9){_0x2f36f5(_0x2dfed9);});};AGIVertices[_0x8c97('0x12')][_0x8c97('0x93')]=function(_0x5b7dd6){var _0x2c8979=_['includes'](verticesWithRetry,_0x5b7dd6[_0x8c97('0x3b')])?_0x5b7dd6:_['clone'](_0x5b7dd6);for(var _0x48f47e in _0x2c8979){if(_0x2c8979['hasOwnProperty'](_0x48f47e)){if(_0x2c8979[_0x48f47e]&&_[_0x8c97('0x94')](_0x2c8979[_0x48f47e])){if(_['includes'](recursiveMapAttributes,_0x48f47e)){_0x2c8979[_0x48f47e]=this[_0x8c97('0x95')](_0x2c8979[_0x48f47e]);}else{_0x2c8979[_0x48f47e]=this[_0x8c97('0x96')](_0x2c8979[_0x48f47e]);}}}}return _0x2c8979;};AGIVertices[_0x8c97('0x12')][_0x8c97('0x97')]=function(_0x38aca5){for(var _0x48bb64 in _0x38aca5){if(_0x38aca5[_0x8c97('0x98')](_0x48bb64)){if(_[_0x8c97('0x99')](_0x38aca5[_0x48bb64])){this[_0x8c97('0x97')](_0x38aca5[_0x48bb64]);}else if(_[_0x8c97('0x9a')](_0x38aca5[_0x48bb64])){for(var _0x4926d6=0x0;_0x4926d6<_0x38aca5[_0x48bb64][_0x8c97('0x9b')];_0x4926d6++){this[_0x8c97('0x97')](_0x38aca5[_0x48bb64][_0x4926d6]);}}else if(_['isString'](_0x38aca5[_0x48bb64])){_0x38aca5[_0x48bb64]=this[_0x8c97('0x96')](_0x38aca5[_0x48bb64]);}}}};AGIVertices[_0x8c97('0x12')][_0x8c97('0x9c')]=function(_0xf5cce3,_0x108dc8){for(var _0x50ed2b in _0xf5cce3){if(_0xf5cce3[_0x8c97('0x98')](_0x50ed2b)){if(_['isPlainObject'](_0xf5cce3[_0x50ed2b])){if(!_[_0x8c97('0x43')](_0xf5cce3[_0x50ed2b])){this['saveRestApiResult'](_0xf5cce3[_0x50ed2b],util[_0x8c97('0x2b')](_0x8c97('0x9d'),_0x108dc8,_0x50ed2b));}}else if(_[_0x8c97('0x9a')](_0xf5cce3[_0x50ed2b])){for(var _0x410886=0x0;_0x410886<_0xf5cce3[_0x50ed2b][_0x8c97('0x9b')];_0x410886++){this[_0x8c97('0x9c')](_0xf5cce3[_0x50ed2b][_0x410886],util['format'](_0x8c97('0x9d'),_0x108dc8,_0x50ed2b+'['+_0x410886+']'));}}else{if(!_[_0x8c97('0x44')](_0xf5cce3[_0x50ed2b])){this['channel'][_0x8c97('0x9e')](util[_0x8c97('0x2b')]('%s.%s',_0x108dc8,_0x50ed2b),_0xf5cce3[_0x50ed2b]);}}}}};AGIVertices[_0x8c97('0x12')]['replaceObjectAllVariables']=function(_0x275439){try{var _0x5ca8ca=JSON[_0x8c97('0x6a')](_0x275439);this['recursiveNodeIndex'](_0x5ca8ca);return JSON['stringify'](_0x5ca8ca);}catch(_0x3817b1){return this['replaceAllVariables'](_0x275439);}};AGIVertices[_0x8c97('0x12')][_0x8c97('0x96')]=function(_0x56fa28){var _0x52f714=_0x56fa28[_0x8c97('0x9f')]('{');for(var _0x4b7f97=0x1;_0x4b7f97<_0x52f714[_0x8c97('0x9b')];_0x4b7f97+=0x1){var _0x3a2396=_0x52f714[_0x4b7f97]['split']('}');if(_0x3a2396[_0x8c97('0x9b')]>0x1){_0x56fa28=_0x56fa28['replaceAll']('{'+_0x3a2396[0x0]+'}',this['channel'][_0x8c97('0x13')](_0x3a2396[0x0])['extra']||_0x3a2396[0x0]);}}if(_0x52f714[_0x8c97('0x9b')]===0x1){return _0x56fa28[_0x8c97('0x4b')]();}return this['replaceAllVariables'](_0x56fa28);};AGIVertices[_0x8c97('0x12')][_0x8c97('0xa0')]=function(_0x3b1907,_0x3608ba){var _0x2f1ccc=this[_0x8c97('0x10')][_0x8c97('0x13')](_0x3b1907);if(_0x2f1ccc[_0x8c97('0xa1')]===-0x1){return _0x2f1ccc;}logger[_0x8c97('0x30')](util[_0x8c97('0x2b')](_0x8c97('0xa2'),_0x3608ba,_0x2f1ccc[_0x8c97('0xa3')]));return this[_0x8c97('0x10')][_0x8c97('0x9e')](_0x3608ba,_0x2f1ccc[_0x8c97('0xa3')]);};AGIVertices['prototype'][_0x8c97('0x86')]=function(_0x10cd3e){return _0x10cd3e&&_0x10cd3e!=='0'&&_0x10cd3e!=='-1'&&_0x10cd3e!=='';};AGIVertices['prototype']['maxRetry']=function(_0x5b1391){this[_0x8c97('0x38')][_0x8c97('0x6f')](this,_0x5b1391,'-');_0x5b1391[_0x8c97('0xa4')]=_0x5b1391['maxRetry'];return{'code':0xc8,'result':'-'};};AGIVertices[_0x8c97('0x12')][_0x8c97('0xa5')]=function(_0x41ba9a){logger[_0x8c97('0x30')](util[_0x8c97('0x2b')]('Enter\x20in\x20MRCPSynth\x20(%s)\x20block',_0x41ba9a[_0x8c97('0x3a')]));if(!this[_0x8c97('0x86')](_0x41ba9a[_0x8c97('0x5b')])){return this[_0x8c97('0x10')][_0x8c97('0xa6')]('no\x20text\x20configured');}var _0x3ae8b9='\x22'+_0x41ba9a[_0x8c97('0x5b')]+'\x22';if(this[_0x8c97('0x86')](_0x41ba9a[_0x8c97('0x77')])){_0x3ae8b9+=','+_0x41ba9a['options'];}var _0x446df3=this[_0x8c97('0x10')][_0x8c97('0x56')](_0x8c97('0xa7'),_0x3ae8b9);if(_0x446df3[_0x8c97('0xa1')]===-0x1){return _0x446df3;}return this[_0x8c97('0x10')]['noop'](util[_0x8c97('0x2b')]('Executed\x20command\x20MRCPSynth\x20%s',_0x3ae8b9));};AGIVertices[_0x8c97('0x12')][_0x8c97('0xa8')]=function(_0x158dd9){logger[_0x8c97('0x30')](util[_0x8c97('0x2b')](_0x8c97('0xa9'),_0x158dd9[_0x8c97('0x3a')]));if(!this['isConfigured'](_0x158dd9[_0x8c97('0xaa')])){return this['channel'][_0x8c97('0xa6')](_0x8c97('0xab'));}var _0x561388=_0x158dd9['grammar'];if(this['isConfigured'](_0x158dd9[_0x8c97('0x77')])){_0x561388+=','+_0x158dd9['options'];}var _0x1ada0d=this[_0x8c97('0x10')]['exec']('MRCPRecog',_0x561388);if(_0x1ada0d[_0x8c97('0xa1')]===-0x1){return _0x1ada0d;}var _0x299d58=this[_0x8c97('0xa0')](_0x8c97('0xac'),_0x8c97('0xad'));if(_0x299d58[_0x8c97('0xa1')]===-0x1){return _0x299d58;}var _0x29f39e=this[_0x8c97('0xa0')](_0x8c97('0xae'),_0x8c97('0xaf'));if(_0x29f39e[_0x8c97('0xa1')]===-0x1){return _0x29f39e;}var _0x405159=this[_0x8c97('0xa0')](_0x8c97('0xb0'),_0x8c97('0xb1'));if(_0x405159[_0x8c97('0xa1')]===-0x1){return _0x405159;}return this[_0x8c97('0x10')][_0x8c97('0xa6')](util[_0x8c97('0x2b')](_0x8c97('0xb2'),_0x561388));};AGIVertices[_0x8c97('0x12')][_0x8c97('0x8')]=function(_0x54c9ef){logger['info'](util['format'](_0x8c97('0xb3'),_0x54c9ef[_0x8c97('0x3a')]));return this[_0x8c97('0x10')][_0x8c97('0x8')]([_0x54c9ef['command'],_0x54c9ef[_0x8c97('0xb4')]]);};AGIVertices[_0x8c97('0x12')]['answer']=function(_0x203620){logger[_0x8c97('0x30')](util['format'](_0x8c97('0xb5'),_0x203620[_0x8c97('0x3a')]));if(this[_0x8c97('0x86')](_0x203620[_0x8c97('0x64')])){logger['info'](util[_0x8c97('0x2b')](_0x8c97('0xb6'),_0x203620[_0x8c97('0x64')]));var _0xddd9fe=this[_0x8c97('0x10')][_0x8c97('0xb7')](_0x203620[_0x8c97('0x64')]);if(_0xddd9fe[_0x8c97('0xa1')]===-0x1){return _0xddd9fe;}}return this[_0x8c97('0x10')][_0x8c97('0xb8')]();};AGIVertices['prototype'][_0x8c97('0xb9')]=function(_0x411b17){logger[_0x8c97('0x30')](util[_0x8c97('0x2b')]('Enter\x20in\x20CALLBACK\x20(%s)\x20block',_0x411b17[_0x8c97('0x3a')]));if(!this['isConfigured'](_0x411b17[_0x8c97('0x48')])){return this[_0x8c97('0x10')][_0x8c97('0x2e')](_0x411b17,_0x8c97('0xba'));}_0x411b17[_0x8c97('0x49')]=moment();if(this[_0x8c97('0x86')](_0x411b17['delay'])){_0x411b17[_0x8c97('0x49')]=moment()[_0x8c97('0xbb')](_0x411b17[_0x8c97('0xbc')],_0x8c97('0xbd'));}if(!this[_0x8c97('0x86')](_0x411b17[_0x8c97('0x4c')])){_0x411b17['callback_priority']=0x2;}this['createCmContact'][_0x8c97('0x6f')](this,_0x411b17);return this[_0x8c97('0x10')]['noop'](util[_0x8c97('0x2b')](_0x8c97('0xbe'),_0x411b17[_0x8c97('0x47')],_0x411b17['list_id'],_0x411b17[_0x8c97('0x49')]));};AGIVertices[_0x8c97('0x12')]['custom_app']=function(_0x3e4140){logger[_0x8c97('0x30')](util[_0x8c97('0x2b')](_0x8c97('0xbf'),_0x3e4140[_0x8c97('0x3a')]));var _0x4b0a66=this[_0x8c97('0x10')][_0x8c97('0x56')](_0x3e4140['application'],_0x3e4140[_0x8c97('0x77')]);if(_0x4b0a66[_0x8c97('0xa1')]===-0x1){return _0x4b0a66;}return this['channel'][_0x8c97('0xa6')](util[_0x8c97('0x2b')](_0x8c97('0xc0'),_0x3e4140[_0x8c97('0xc1')],_0x3e4140[_0x8c97('0x77')]));};AGIVertices[_0x8c97('0x12')]['lumenvoxtts']=function(_0x3b7254){logger['info'](util[_0x8c97('0x2b')](_0x8c97('0xc2'),_0x3b7254[_0x8c97('0x3a')]));if(!this[_0x8c97('0x86')](_0x3b7254[_0x8c97('0x5b')])){return this[_0x8c97('0x10')]['noop']('no\x20text\x20configured');}var _0x51647c='\x22'+_0x3b7254[_0x8c97('0x5b')]+'\x22';if(this['isConfigured'](_0x3b7254[_0x8c97('0x77')])){_0x51647c+=','+_0x3b7254['options'];}var _0x2875b7=this[_0x8c97('0x10')]['exec'](_0x8c97('0xa7'),_0x51647c);if(_0x2875b7[_0x8c97('0xa1')]===-0x1){return _0x2875b7;}return this[_0x8c97('0x10')][_0x8c97('0xa6')](util[_0x8c97('0x2b')]('Executed\x20command\x20MRCPSynth\x20%s',_0x51647c));};AGIVertices[_0x8c97('0x12')]['sestektts']=function(_0x46ee81){logger[_0x8c97('0x30')](util[_0x8c97('0x2b')](_0x8c97('0xc3'),_0x46ee81['label']));if(!this[_0x8c97('0x86')](_0x46ee81['text'])){return this[_0x8c97('0x10')][_0x8c97('0xa6')](_0x8c97('0xc4'));}var _0x3c523d='\x22'+_0x46ee81[_0x8c97('0x5b')]+'\x22';if(this[_0x8c97('0x86')](_0x46ee81[_0x8c97('0x77')])){_0x3c523d+=','+_0x46ee81[_0x8c97('0x77')];}var _0x5c1829=this[_0x8c97('0x10')]['exec'](_0x8c97('0xa7'),_0x3c523d);if(_0x5c1829[_0x8c97('0xa1')]===-0x1){return _0x5c1829;}return this[_0x8c97('0x10')][_0x8c97('0xa6')](util[_0x8c97('0x2b')](_0x8c97('0xc5'),_0x3c523d));};AGIVertices[_0x8c97('0x12')][_0x8c97('0xc6')]=function(_0x1bf6d1){logger['info'](util[_0x8c97('0x2b')]('Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block',_0x1bf6d1[_0x8c97('0x3a')]));if(!this[_0x8c97('0x86')](_0x1bf6d1[_0x8c97('0xaa')])){return this[_0x8c97('0x10')][_0x8c97('0xa6')]('no\x20grammar\x20configured');}var _0x13f67d=_0x1bf6d1['grammar'];if(this[_0x8c97('0x86')](_0x1bf6d1[_0x8c97('0x77')])){_0x13f67d+=','+_0x1bf6d1[_0x8c97('0x77')];}var _0x1950b7=this[_0x8c97('0x10')]['exec']('MRCPRecog',_0x13f67d);if(_0x1950b7['result']===-0x1){return _0x1950b7;}var _0x5a291c=this[_0x8c97('0xa0')]('RECOG_CONFIDENCE()','LUMENVOX_ASR_CONFIDENCE');if(_0x5a291c[_0x8c97('0xa1')]===-0x1){return _0x5a291c;}var _0xc5944e=this['getAndSetVariable'](_0x8c97('0xae'),_0x8c97('0xc7'));if(_0xc5944e[_0x8c97('0xa1')]===-0x1){return _0xc5944e;}var _0x49253e=this[_0x8c97('0xa0')]('RECOG_INSTANCE()',_0x8c97('0xc8'));if(_0x49253e['result']===-0x1){return _0x49253e;}return this['channel'][_0x8c97('0xa6')](util[_0x8c97('0x2b')](_0x8c97('0xb2'),_0x13f67d));};AGIVertices[_0x8c97('0x12')][_0x8c97('0xc9')]=function(_0x4e839a){logger[_0x8c97('0x30')](util[_0x8c97('0x2b')](_0x8c97('0xca'),_0x4e839a[_0x8c97('0x3a')]));if(!this['isConfigured'](_0x4e839a[_0x8c97('0xaa')])){return this[_0x8c97('0x10')][_0x8c97('0xa6')]('no\x20grammar\x20configured');}var _0x1ad561=_0x4e839a['grammar'];if(this[_0x8c97('0x86')](_0x4e839a['options'])){_0x1ad561+=','+_0x4e839a['options'];}var _0x26ecfd=this[_0x8c97('0x10')]['exec'](_0x8c97('0xcb'),_0x1ad561);if(_0x26ecfd[_0x8c97('0xa1')]===-0x1){return _0x26ecfd;}var _0x353add=this[_0x8c97('0xa0')](_0x8c97('0xac'),_0x8c97('0xcc'));if(_0x353add[_0x8c97('0xa1')]===-0x1){return _0x353add;}var _0x11da1f=this['getAndSetVariable'](_0x8c97('0xae'),_0x8c97('0xcd'));if(_0x11da1f[_0x8c97('0xa1')]===-0x1){return _0x11da1f;}var _0x46e6f9=this['getAndSetVariable'](_0x8c97('0xb0'),'SESTEK_ASR_INSTANCE');if(_0x46e6f9[_0x8c97('0xa1')]===-0x1){return _0x46e6f9;}return this['channel']['noop'](util[_0x8c97('0x2b')](_0x8c97('0xb2'),_0x1ad561));};AGIVertices[_0x8c97('0x12')][_0x8c97('0xce')]=function(_0x3932ca){logger[_0x8c97('0x30')](util[_0x8c97('0x2b')](_0x8c97('0xcf'),_0x3932ca[_0x8c97('0x3a')]));if(!this[_0x8c97('0x86')](_0x3932ca[_0x8c97('0xd0')])){return this[_0x8c97('0x10')][_0x8c97('0x2e')](_0x3932ca,'no\x20database\x20selected');}var _0x58dedc=this[_0x8c97('0x1c')][_0x8c97('0x6f')](this,_0x3932ca[_0x8c97('0xd0')]);if(!_0x58dedc){return this[_0x8c97('0x10')][_0x8c97('0x2e')](_0x3932ca,_0x8c97('0xd1'));}if(!this[_0x8c97('0x86')](_0x3932ca[_0x8c97('0xd2')])){return this[_0x8c97('0x10')][_0x8c97('0x2e')](_0x3932ca,_0x8c97('0xd3'));}var _0x13eac7=_0x3932ca['query'][_0x8c97('0x58')](/(\r\n|\n|\r)/gm,'\x20');this[_0x8c97('0x10')]['noop'](util[_0x8c97('0x2b')](_0x8c97('0xd4'),_0x13eac7));var _0x104ed4=this[_0x8c97('0xd5')][_0x8c97('0x6f')](this,_0x58dedc,_0x13eac7);this[_0x8c97('0x38')]['sync'](this,_0x3932ca,_0x13eac7);if(!this['isConfigured'](_0x3932ca['variable_id'])){return this[_0x8c97('0x10')][_0x8c97('0xa6')](_0x8c97('0xd6'));}var _0x2316db=this[_0x8c97('0x13')][_0x8c97('0x6f')](this,_0x3932ca[_0x8c97('0xd7')]);if(!_0x2316db){return this[_0x8c97('0x10')][_0x8c97('0x2e')](_0x3932ca,_0x8c97('0xd8'));}var _0x1cd37c=this;_0x104ed4[_0x8c97('0xd9')](function(_0x43e060,_0x3c5286){Object[_0x8c97('0xda')](_0x43e060)['forEach'](function(_0x52b56d){_0x1cd37c[_0x8c97('0x10')][_0x8c97('0x9e')](util[_0x8c97('0x2b')](_0x8c97('0xdb'),_0x2316db,_0x3c5286,_0x52b56d),_0x43e060[_0x52b56d]);});});this[_0x8c97('0x10')][_0x8c97('0x9e')](util['format']('%s_ROWS_COUNT',_0x2316db),_0x104ed4['length']);return this[_0x8c97('0x10')][_0x8c97('0xa6')](util['format'](_0x8c97('0xdc'),_0x2316db));};AGIVertices['prototype'][_0x8c97('0xdd')]=function(_0x4f695e){logger[_0x8c97('0xde')](util['format']('Enter\x20in\x20DIAL\x20(%s)\x20block',_0x4f695e[_0x8c97('0x3a')]));if(!this[_0x8c97('0x86')](_0x4f695e[_0x8c97('0xdf')])){return this[_0x8c97('0x10')][_0x8c97('0x2e')](_0x4f695e,_0x8c97('0xe0'));}var _0x5aca6a=this[_0x8c97('0xe1')][_0x8c97('0x6f')](this,_0x4f695e['sip_id']);if(!_0x5aca6a){return this[_0x8c97('0x10')][_0x8c97('0x2e')](_0x4f695e,_0x8c97('0xe2'));}var _0x39bcdb=this[_0x8c97('0x10')]['exec'](_0x8c97('0xe3'),[util[_0x8c97('0x2b')](_0x8c97('0xe4'),_0x5aca6a),_0x4f695e[_0x8c97('0x64')],_0x4f695e[_0x8c97('0xe5')],_0x4f695e['url']]);if(_0x39bcdb[_0x8c97('0xa1')]===-0x1){return _0x39bcdb;}return this['channel'][_0x8c97('0xa6')](util['format']('Executed\x20command\x20%s',_0x8c97('0xe3')));};AGIVertices[_0x8c97('0x12')][_0x8c97('0xe6')]=function(_0x5a041d){logger['info'](util[_0x8c97('0x2b')]('Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block',_0x5a041d['label']));if(!this[_0x8c97('0x86')](_0x5a041d['key'])){return this['channel'][_0x8c97('0xa6')](_0x8c97('0xe7'));}if(!this[_0x8c97('0x86')](_0x5a041d[_0x8c97('0x5b')])){return this[_0x8c97('0x10')][_0x8c97('0xa6')](_0x8c97('0xc4'));}this[_0x8c97('0x10')][_0x8c97('0xe8')]=!![];this[_0x8c97('0x38')](_0x5a041d);this['createSquareMessage'](_0x5a041d[_0x8c97('0x5b')],'in','','');this['channel'][_0x8c97('0xa6')](util[_0x8c97('0x2b')](_0x8c97('0xe9'),_0x5a041d[_0x8c97('0x5b')]));var _0x1b5f36=this[_0x8c97('0x78')][_0x8c97('0x6f')](this,_0x5a041d);if(_0x1b5f36){for(var _0x3d61a3 in _0x1b5f36){if(_0x1b5f36[_0x8c97('0x98')](_0x3d61a3)){this[_0x8c97('0x10')][_0x8c97('0x9e')](util[_0x8c97('0x2b')]('DIALOGFLOW_%s',_0x3d61a3['toUpperCase']()),_0x1b5f36[_0x3d61a3]);}}this[_0x8c97('0x41')](_0x1b5f36[_0x8c97('0xea')],_0x8c97('0xeb'),'dialogflow','');return this['channel'][_0x8c97('0xa6')](util[_0x8c97('0x2b')](_0x8c97('0xec'),_0x1b5f36['speech']));}return this['channel'][_0x8c97('0x2e')](_0x5a041d,_0x8c97('0xed'));};AGIVertices[_0x8c97('0x12')][_0x8c97('0xee')]=function(_0x3476c3){logger[_0x8c97('0x30')](util[_0x8c97('0x2b')]('Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block',_0x3476c3[_0x8c97('0x3a')]));if(!this[_0x8c97('0x86')](_0x3476c3[_0x8c97('0x7b')])){return this[_0x8c97('0x10')][_0x8c97('0xa6')](_0x8c97('0xef'));}if(!this[_0x8c97('0x86')](_0x3476c3[_0x8c97('0x7c')])){return this[_0x8c97('0x10')]['noop'](_0x8c97('0xf0'));}if(!this[_0x8c97('0x86')](_0x3476c3['private_key'])){return this[_0x8c97('0x10')][_0x8c97('0xa6')]('no\x20private_key\x20configured');}if(!this[_0x8c97('0x86')](_0x3476c3[_0x8c97('0x7e')])){return this[_0x8c97('0x10')][_0x8c97('0xa6')](_0x8c97('0xf1'));}if(!this['isConfigured'](_0x3476c3[_0x8c97('0x5b')])){return this['channel'][_0x8c97('0xa6')]('no\x20text\x20configured');}this[_0x8c97('0x10')][_0x8c97('0xe8')]=!![];this['createSquareDetailsReport'](_0x3476c3);this[_0x8c97('0x41')](_0x3476c3[_0x8c97('0x5b')],'in','','');this['channel'][_0x8c97('0xa6')](util[_0x8c97('0x2b')](_0x8c97('0xf2'),_0x3476c3['text']));var _0x54d366=this[_0x8c97('0x7a')][_0x8c97('0x6f')](this,_0x3476c3);if(_0x54d366){for(var _0x4330ec in _0x54d366){if(_0x54d366[_0x8c97('0x98')](_0x4330ec)){if(_0x4330ec!==_0x8c97('0xf3')){this[_0x8c97('0x10')][_0x8c97('0x9e')](util[_0x8c97('0x2b')]('DIALOGFLOW_%s',_0x4330ec['toUpperCase']()),_0x54d366[_0x4330ec]);}}}this[_0x8c97('0x41')](_0x54d366[_0x8c97('0xea')],_0x8c97('0xeb'),_0x8c97('0xee'),_0x54d366[_0x8c97('0xf3')]);return this[_0x8c97('0x10')][_0x8c97('0xa6')](util[_0x8c97('0x2b')](_0x8c97('0xf4'),_0x54d366[_0x8c97('0xea')]));}return this[_0x8c97('0x10')][_0x8c97('0x2e')](_0x3476c3,_0x8c97('0xf5'));};AGIVertices[_0x8c97('0x12')][_0x8c97('0xf6')]=function(_0xdfa917){logger['info'](util[_0x8c97('0x2b')](_0x8c97('0xf7'),_0xdfa917[_0x8c97('0x3a')]));if(!this[_0x8c97('0x86')](_0xdfa917['ndauth_url'])){return this[_0x8c97('0x10')]['noop'](_0x8c97('0xf8'));}if(!this['isConfigured'](_0xdfa917[_0x8c97('0xf9')])){return this[_0x8c97('0x10')][_0x8c97('0xa6')](_0x8c97('0xfa'));}if(!this[_0x8c97('0x86')](_0xdfa917[_0x8c97('0xfb')])){return this[_0x8c97('0x10')][_0x8c97('0xa6')](_0x8c97('0xfc'));}if(!this[_0x8c97('0x86')](_0xdfa917[_0x8c97('0xfd')])){return this[_0x8c97('0x10')][_0x8c97('0xa6')](_0x8c97('0xc4'));}this[_0x8c97('0x10')][_0x8c97('0xe8')]=!![];this[_0x8c97('0x38')](_0xdfa917);this[_0x8c97('0x41')](_0xdfa917['text'],'in','','');this[_0x8c97('0x10')][_0x8c97('0xa6')](util['format'](_0x8c97('0xfe'),_0xdfa917['text']));var _0x3d71a2=this['sestekNDA']['sync'](this,_0xdfa917);if(_0x3d71a2){for(var _0x336422 in _0x3d71a2){if(_0x3d71a2[_0x8c97('0x98')](_0x336422)){this[_0x8c97('0x10')][_0x8c97('0x9e')](util[_0x8c97('0x2b')](_0x8c97('0xff'),_0x336422[_0x8c97('0x68')]()),_0x3d71a2[_0x336422]);}}this[_0x8c97('0x41')](_0x3d71a2[_0x8c97('0xea')],'out',_0x8c97('0xf6'),'');if(_0x3d71a2['audiofile']){this[_0x8c97('0x10')][_0x8c97('0xa6')](util[_0x8c97('0x2b')](_0x8c97('0x100'),_0x3d71a2[_0x8c97('0x101')]));var _0x4964cb=this[_0x8c97('0x10')][_0x8c97('0x102')](_0x3d71a2[_0x8c97('0x101')]);try{fs[_0x8c97('0x103')](_0x3d71a2[_0x8c97('0x101')]+_0x8c97('0x104'));}catch(_0xa07b17){logger[_0x8c97('0x2e')](_0xa07b17);}return _0x4964cb;}else{return this[_0x8c97('0x10')][_0x8c97('0xa6')](util[_0x8c97('0x2b')]('SestekNDA\x20Result\x20%s',_0x3d71a2[_0x8c97('0xea')]));}}return this[_0x8c97('0x10')][_0x8c97('0x2e')](_0xdfa917,'SestekNDA\x20is\x20unreachable');};AGIVertices['prototype'][_0x8c97('0x105')]=function(_0x3b71c8){logger[_0x8c97('0x30')](util[_0x8c97('0x2b')]('Enter\x20in\x20END\x20(%s)\x20block',_0x3b71c8[_0x8c97('0x3a')]));return this[_0x8c97('0x10')]['noop']('end');};AGIVertices[_0x8c97('0x12')][_0x8c97('0x106')]=function(_0xe177c1){logger['info'](util[_0x8c97('0x2b')](_0x8c97('0x107'),_0xe177c1['label']));var _0x77985e='';if(_0xe177c1['trunk_id']){if(!this[_0x8c97('0x86')](_0xe177c1[_0x8c97('0x108')])){return this[_0x8c97('0x10')][_0x8c97('0x2e')](_0xe177c1,_0x8c97('0x109'));}else{var _0x1af38c=parseInt(_0xe177c1[_0x8c97('0x108')],0xa);if(isNaN(_0x1af38c)){_0x77985e=_0xe177c1[_0x8c97('0x108')];}else{_0x77985e=this[_0x8c97('0x1f')][_0x8c97('0x6f')](this,_0xe177c1[_0x8c97('0x108')]);if(!_0x77985e){return this[_0x8c97('0x10')][_0x8c97('0x2e')](_0xe177c1,_0x8c97('0x10a'));}}}}else if(_0xe177c1[_0x8c97('0x10b')]){_0x77985e=_0xe177c1[_0x8c97('0x10b')];}else{return this[_0x8c97('0x10')]['error'](_0xe177c1,_0x8c97('0x109'));}var _0x169b34=this[_0x8c97('0x10')][_0x8c97('0x56')](_0x8c97('0xe3'),[util[_0x8c97('0x2b')](_0x8c97('0x10c'),_0x77985e,_0xe177c1[_0x8c97('0x47')]),_0xe177c1[_0x8c97('0x64')],_0xe177c1[_0x8c97('0xe5')],_0xe177c1[_0x8c97('0x71')]]);if(_0x169b34[_0x8c97('0xa1')]===-0x1){return _0x169b34;}return this[_0x8c97('0x10')][_0x8c97('0xa6')](util['format']('Executed\x20command\x20%s',_0x8c97('0xe3')));};AGIVertices[_0x8c97('0x12')][_0x8c97('0x10d')]=function(_0x116aeb){logger['info'](util[_0x8c97('0x2b')](_0x8c97('0x10e'),_0x116aeb[_0x8c97('0x3a')]));return this[_0x8c97('0x10')][_0x8c97('0xa6')](_0x8c97('0x10d'));};AGIVertices['prototype']['getdigits']=function(_0x3e39d5){logger['info'](util[_0x8c97('0x2b')](_0x8c97('0x10f'),_0x3e39d5[_0x8c97('0x3a')]));if(_0x3e39d5[_0x8c97('0xa4')]===0x0){return this[_0x8c97('0x110')](_0x3e39d5);}_0x3e39d5[_0x8c97('0xa4')]-=0x1;if(!this[_0x8c97('0x86')](_0x3e39d5['file_id'])){return this['channel'][_0x8c97('0x2e')](_0x3e39d5,_0x8c97('0x111'));}var _0x50f643=this[_0x8c97('0x20')][_0x8c97('0x6f')](this,_0x3e39d5['file_id']);if(!_0x50f643){return this[_0x8c97('0x10')][_0x8c97('0x2e')](_0x3e39d5,_0x8c97('0x112'));}if(!this[_0x8c97('0x86')](_0x3e39d5[_0x8c97('0xd7')])){return this[_0x8c97('0x10')]['error']('no\x20variable\x20selected\x20for\x20the\x20result');}var _0x595efe=this['channel']['getData'](_0x50f643,_0x3e39d5[_0x8c97('0x113')],_0x3e39d5[_0x8c97('0x114')]);var _0x455361=_0x595efe[_0x8c97('0xa1')]?_0x595efe[_0x8c97('0xa1')][_0x8c97('0x4b')]():'';logger[_0x8c97('0x30')](_0x8c97('0x115'),JSON[_0x8c97('0x72')](_0x595efe));if(_0x595efe[_0x8c97('0xa1')]===-0x1){this[_0x8c97('0x38')][_0x8c97('0x6f')](this,_0x3e39d5,_0x455361);return _0x595efe;}else if(_0x595efe[_0x8c97('0xa3')]===_0x8c97('0x64')){_0x595efe[_0x8c97('0xa1')]=_0x455361[_0x8c97('0x9b')]>=parseInt(_0x3e39d5['mindigit'])?'x':'i';}else{_0x595efe['result']=_0x455361['length']>=parseInt(_0x3e39d5['mindigit'])&&_0x455361[_0x8c97('0x9b')]<=parseInt(_0x3e39d5['maxdigit'])?'x':'i';}var _0xfbe555=this[_0x8c97('0x13')][_0x8c97('0x6f')](this,_0x3e39d5[_0x8c97('0xd7')]);if(!_0xfbe555){return this['channel']['error'](_0x3e39d5,_0x8c97('0xd8'));}this[_0x8c97('0x10')]['setVariable'](_0xfbe555,_0x455361);if(this[_0x8c97('0x86')](_0x3e39d5[_0x8c97('0x116')])){var _0x2c1813=parseInt(_0x3e39d5[_0x8c97('0x116')],0xa);var _0x38490=rs[_0x8c97('0x117')]({'charset':'*','length':_0x2c1813});var _0x2a0f62=_0x455361['length'];if(_0x2a0f62>0x0){if(_0x2a0f62>_0x2c1813){this[_0x8c97('0x38')][_0x8c97('0x6f')](this,_0x3e39d5,_0x3e39d5[_0x8c97('0x118')]==='first'?_0x38490+_0x455361[_0x8c97('0x119')](_0x2c1813):_0x455361[_0x8c97('0x119')](0x0,_0x2a0f62-_0x2c1813)+_0x38490);}else{this[_0x8c97('0x38')][_0x8c97('0x6f')](this,_0x3e39d5,rs[_0x8c97('0x117')]({'charset':'*','length':_0x2a0f62}));}}else{this[_0x8c97('0x38')][_0x8c97('0x6f')](this,_0x3e39d5,'');}}else{this[_0x8c97('0x38')][_0x8c97('0x6f')](this,_0x3e39d5,_0x455361);}return _0x595efe;};AGIVertices[_0x8c97('0x12')][_0x8c97('0xf')]=function(_0x2172e4){logger[_0x8c97('0x30')](util[_0x8c97('0x2b')](_0x8c97('0x11a'),_0x2172e4[_0x8c97('0x3a')]));return this[_0x8c97('0xe')](_0x2172e4);};AGIVertices['prototype'][_0x8c97('0x11b')]=function(_0x55b4e4){logger['info'](util[_0x8c97('0x2b')](_0x8c97('0x11c'),_0x55b4e4['label']));this['createSquareDetailsReport'][_0x8c97('0x6f')](this,_0x55b4e4,_0x55b4e4[_0x8c97('0x11d')]);return this[_0x8c97('0x10')][_0x8c97('0xa6')](util['format']('GOAL\x20%s',_0x55b4e4[_0x8c97('0x11d')]));};AGIVertices['prototype'][_0x8c97('0x11e')]=function(_0x425ad8){logger['info'](util[_0x8c97('0x2b')](_0x8c97('0x11f'),_0x425ad8['label']));if(!this['isConfigured'](_0x425ad8['aws_access_key_id'])||!this[_0x8c97('0x86')](_0x425ad8[_0x8c97('0x8a')])){return this[_0x8c97('0x10')][_0x8c97('0xa6')](_0x8c97('0x120'));}if(!this[_0x8c97('0x86')](_0x425ad8[_0x8c97('0x5b')])){return this[_0x8c97('0x10')]['noop']('no\x20text\x20configured');}this['channel']['noop'](util[_0x8c97('0x2b')]('Trying\x20aws\x20Polly\x20%s',_0x425ad8[_0x8c97('0x5b')]));var _0x5d198f=this[_0x8c97('0x88')]['sync'](this,_0x425ad8);if(_0x5d198f){this[_0x8c97('0x10')][_0x8c97('0xa6')](util[_0x8c97('0x2b')](_0x8c97('0x121'),_0x5d198f));var _0x4d49e5=this[_0x8c97('0x10')]['streamFile'](_0x5d198f);try{fs[_0x8c97('0x103')](_0x5d198f+_0x8c97('0x104'));}catch(_0x278df3){logger[_0x8c97('0x2e')](_0x278df3);}return _0x4d49e5;}return this[_0x8c97('0x10')][_0x8c97('0x2e')](_0x425ad8,_0x8c97('0x122'));};AGIVertices[_0x8c97('0x12')]['awslex']=function(_0x7cb467){logger[_0x8c97('0x30')](util[_0x8c97('0x2b')]('Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block',_0x7cb467[_0x8c97('0x3a')]));if(!this[_0x8c97('0x86')](_0x7cb467[_0x8c97('0x89')])||!this[_0x8c97('0x86')](_0x7cb467['aws_secret_access_key'])){return this['channel'][_0x8c97('0xa6')](_0x8c97('0x120'));}if(!this[_0x8c97('0x86')](_0x7cb467[_0x8c97('0x8e')])){return this[_0x8c97('0x10')]['noop']('no\x20bot\x20name\x20configured');}if(!this[_0x8c97('0x86')](_0x7cb467[_0x8c97('0x5b')])){return this[_0x8c97('0x10')]['noop']('no\x20text\x20configured');}this[_0x8c97('0x10')][_0x8c97('0xe8')]=!![];this[_0x8c97('0x38')](_0x7cb467);this[_0x8c97('0x41')](_0x7cb467[_0x8c97('0x5b')],'in','','');this[_0x8c97('0x10')]['noop'](util[_0x8c97('0x2b')](_0x8c97('0x123'),_0x7cb467[_0x8c97('0x5b')]));var _0x4a84d2=this[_0x8c97('0x8c')][_0x8c97('0x6f')](this,_0x7cb467);if(_0x4a84d2){for(var _0x4e1282 in _0x4a84d2){if(_0x4a84d2['hasOwnProperty'](_0x4e1282)&&_[_0x8c97('0x94')](_0x4a84d2[_0x4e1282])){this[_0x8c97('0x10')]['setVariable'](util[_0x8c97('0x2b')]('AWS_LEX_%s',_0x4e1282[_0x8c97('0x68')]()),_0x4a84d2[_0x4e1282]);}}if(_['isNil'](_0x4a84d2[_0x8c97('0x75')])){return this['channel']['noop'](_0x8c97('0x124'));}else{this['createSquareMessage'](_0x4a84d2[_0x8c97('0x75')],'out','amazonlex','');return this[_0x8c97('0x10')]['noop'](util[_0x8c97('0x2b')]('Amazon\x20Lex\x20Result\x20%s',_0x4a84d2[_0x8c97('0x75')]));}}return this['channel'][_0x8c97('0x2e')](_0x7cb467,_0x8c97('0x125'));};AGIVertices[_0x8c97('0x12')]['googleasr']=function(_0x48cf73){logger['info'](util[_0x8c97('0x2b')]('Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s',_0x48cf73[_0x8c97('0x3a')],_0x48cf73[_0x8c97('0x64')]));if(!this['isConfigured'](_0x48cf73[_0x8c97('0x81')])){return this['channel'][_0x8c97('0xa6')]('no\x20key\x20configured');}var _0x2edd38=_0x8c97('0x126');var _0x464109=util[_0x8c97('0x2b')](_0x8c97('0x127'),FILES_PATH,rs[_0x8c97('0x117')](0x4));var _0x33ac0c=util[_0x8c97('0x2b')](_0x8c97('0x9d'),_0x464109,_0x2edd38);var _0x3dc671=!![];if(_0x48cf73[_0x8c97('0x128')]===_0x8c97('0x129')){_0x3dc671=![];}var _0x233038=this['channel'][_0x8c97('0x12a')](_0x464109,_0x2edd38,_0x48cf73[_0x8c97('0x12b')],_0x48cf73[_0x8c97('0x64')],undefined,_0x3dc671);if(_0x233038[_0x8c97('0xa1')]!==-0x1){this[_0x8c97('0x10')][_0x8c97('0xa6')](util[_0x8c97('0x2b')](_0x8c97('0x12c'),_0x33ac0c));var _0x563af6=this[_0x8c97('0x12d')][_0x8c97('0x6f')](this,_0x48cf73,_0x33ac0c);if(_0x563af6){for(var _0xa8ee0d in _0x563af6){if(_0x563af6[_0x8c97('0x98')](_0xa8ee0d)){this[_0x8c97('0x10')]['setVariable'](util[_0x8c97('0x2b')](_0x8c97('0x12e'),_0xa8ee0d[_0x8c97('0x68')]()),_0x563af6[_0xa8ee0d]);}}return this[_0x8c97('0x10')]['noop'](util[_0x8c97('0x2b')]('GoogleASR\x20Result\x20%s',JSON['stringify'](_0x563af6)));}}return _0x233038;};AGIVertices[_0x8c97('0x12')]['tildeasr']=function(_0x45f09f){logger[_0x8c97('0x30')](util[_0x8c97('0x2b')](_0x8c97('0x12f'),_0x45f09f[_0x8c97('0x3a')]));if(!this['isConfigured'](_0x45f09f[_0x8c97('0x90')])){return this['channel'][_0x8c97('0xa6')](_0x8c97('0x130'));}if(!this[_0x8c97('0x86')](_0x45f09f[_0x8c97('0x91')])){return this['channel']['noop']('no\x20appsecret\x20configured');}var _0x83594a='wav';var _0xf642ae=util[_0x8c97('0x2b')]('%s/recordings/%s',FILES_PATH,rs[_0x8c97('0x117')](0x4));var _0x1d5d55=util[_0x8c97('0x2b')](_0x8c97('0x9d'),_0xf642ae,_0x83594a);var _0x57d1cf=!![];if(_0x45f09f['beep']===_0x8c97('0x129')){_0x57d1cf=![];}var _0x54c56e=this['channel']['recordFile'](_0xf642ae,_0x83594a,_0x45f09f[_0x8c97('0x12b')],_0x45f09f['timeout'],undefined,_0x57d1cf);if(_0x54c56e[_0x8c97('0xa1')]!==-0x1){this[_0x8c97('0x10')][_0x8c97('0xa6')](util[_0x8c97('0x2b')](_0x8c97('0x131'),_0x1d5d55));var _0x52d57a=this[_0x8c97('0x8f')][_0x8c97('0x6f')](this,_0x45f09f,_0x1d5d55);if(_0x52d57a){for(var _0x1512b0 in _0x52d57a){if(_0x52d57a[_0x8c97('0x98')](_0x1512b0)){this[_0x8c97('0x10')][_0x8c97('0x9e')](util[_0x8c97('0x2b')]('TILDE_ASR_%s',_0x1512b0[_0x8c97('0x68')]()),_0x52d57a[_0x1512b0]);}}return this['channel'][_0x8c97('0xa6')](util[_0x8c97('0x2b')](_0x8c97('0x132'),JSON[_0x8c97('0x72')](_0x52d57a)));}}return _0x54c56e;};AGIVertices[_0x8c97('0x12')][_0x8c97('0x133')]=function(_0x3af3f9){logger[_0x8c97('0x30')](util['format'](_0x8c97('0x134'),_0x3af3f9['label']));return this[_0x8c97('0x10')]['continueAt'](_0x3af3f9['context'],_0x3af3f9[_0x8c97('0x3e')],_0x3af3f9['priority']);};AGIVertices['prototype'][_0x8c97('0x135')]=function(_0x33cad4){logger[_0x8c97('0x30')](util[_0x8c97('0x2b')](_0x8c97('0x136'),_0x33cad4[_0x8c97('0x3a')]));if(!this[_0x8c97('0x86')](_0x33cad4[_0x8c97('0x137')])){return this[_0x8c97('0x10')]['error'](_0x33cad4,_0x8c97('0x138'));}try{var _0x1095be=eval(_0x33cad4[_0x8c97('0x137')])?_0x8c97('0x139'):_0x8c97('0x13a');this[_0x8c97('0x10')][_0x8c97('0xa6')](util[_0x8c97('0x2b')](_0x8c97('0x13b'),_0x33cad4['condition'],_0x1095be));return{'code':0xc8,'result':_0x1095be};}catch(_0x486c8c){return{'code':0xc8,'result':'false'};}};AGIVertices[_0x8c97('0x12')]['gotoiftime']=function(_0x51361b){logger['info'](util['format'](_0x8c97('0x13c'),_0x51361b[_0x8c97('0x3a')]));if(!this[_0x8c97('0x86')](_0x51361b['interval_id'])){return this['channel'][_0x8c97('0x2e')](_0x51361b,_0x8c97('0x13d'));}var _0x270de5=this[_0x8c97('0x25')][_0x8c97('0x6f')](this,_0x51361b[_0x8c97('0x13e')]);if(!_0x270de5){return this[_0x8c97('0x10')][_0x8c97('0x2e')](_0x51361b,_0x8c97('0x13f'));}for(var _0x28fe84=0x0;_0x28fe84<_0x270de5[_0x8c97('0x9b')];_0x28fe84+=0x1){var _0x2a6296=this[_0x8c97('0x10')][_0x8c97('0x13')](util[_0x8c97('0x2b')](_0x8c97('0x140'),_0x270de5[_0x28fe84]));if(_0x2a6296[_0x8c97('0xa1')]===-0x1){return _0x2a6296;}logger['info'](util['format'](_0x8c97('0x141'),_0x270de5[_0x28fe84],_0x2a6296['extra']));if(_0x2a6296[_0x8c97('0xa3')]===_0x8c97('0x139')){logger['info'](util['format'](_0x8c97('0x141'),_0x270de5[_0x28fe84],_0x8c97('0x139')));this[_0x8c97('0x10')][_0x8c97('0xa6')](util[_0x8c97('0x2b')]('IFTIME\x20%s\x20%s',_0x270de5[_0x28fe84],_0x8c97('0x139')));return{'code':0xc8,'result':_0x8c97('0x139')};}else{logger['info'](util[_0x8c97('0x2b')](_0x8c97('0x141'),_0x270de5[_0x28fe84],_0x8c97('0x13a')));this[_0x8c97('0x10')]['noop'](util[_0x8c97('0x2b')](_0x8c97('0x141'),_0x270de5[_0x28fe84],_0x8c97('0x13a')));}}return{'code':0xc8,'result':'false'};};AGIVertices[_0x8c97('0x12')][_0x8c97('0x142')]=function(_0x675693){logger[_0x8c97('0x30')](util[_0x8c97('0x2b')](_0x8c97('0x143'),_0x675693[_0x8c97('0x3a')]));return this['channel'][_0x8c97('0x142')]();};AGIVertices[_0x8c97('0x12')][_0x8c97('0x144')]=function(_0x1a4c13){logger['info'](util[_0x8c97('0x2b')]('Enter\x20in\x20ISPEECHASR\x20(%s)\x20block',_0x1a4c13['label']));if(!this[_0x8c97('0x86')](_0x1a4c13['key'])){return this['channel'][_0x8c97('0xa6')](_0x8c97('0xe7'));}var _0x3fcce4='wav';var _0x20d097=util[_0x8c97('0x2b')](_0x8c97('0x127'),FILES_PATH,rs['generate'](0x4));var _0x2191af=util['format'](_0x8c97('0x9d'),_0x20d097,_0x3fcce4);var _0x44bf7e=!![];if(_0x1a4c13[_0x8c97('0x128')]==='NOBEEP'){_0x44bf7e=![];}var _0x5457bf=this[_0x8c97('0x10')][_0x8c97('0x12a')](_0x20d097,_0x3fcce4,_0x1a4c13[_0x8c97('0x12b')],_0x1a4c13['timeout'],undefined,_0x44bf7e);if(_0x5457bf[_0x8c97('0xa1')]!==-0x1){this[_0x8c97('0x10')]['noop'](util[_0x8c97('0x2b')](_0x8c97('0x145'),_0x2191af));var _0x3c227a=this[_0x8c97('0x84')][_0x8c97('0x6f')](this,_0x1a4c13,_0x2191af);if(_0x3c227a){for(var _0x18b83a in _0x3c227a){if(_0x3c227a[_0x8c97('0x98')](_0x18b83a)){this['channel']['setVariable'](util[_0x8c97('0x2b')](_0x8c97('0x146'),_0x18b83a[_0x8c97('0x68')]()),_0x3c227a[_0x18b83a]);}}return this[_0x8c97('0x10')][_0x8c97('0xa6')](util[_0x8c97('0x2b')](_0x8c97('0x147'),JSON[_0x8c97('0x72')](_0x3c227a)));}}return _0x5457bf;};AGIVertices[_0x8c97('0x12')][_0x8c97('0x148')]=function(_0x3c749e){logger[_0x8c97('0x30')](util[_0x8c97('0x2b')](_0x8c97('0x149'),_0x3c749e[_0x8c97('0x3a')]));if(!this[_0x8c97('0x86')](_0x3c749e[_0x8c97('0x81')])){return this[_0x8c97('0x10')][_0x8c97('0xa6')](_0x8c97('0xe7'));}if(!this[_0x8c97('0x86')](_0x3c749e[_0x8c97('0x5b')])){return this['channel'][_0x8c97('0xa6')](_0x8c97('0xc4'));}this[_0x8c97('0x10')][_0x8c97('0xa6')](util[_0x8c97('0x2b')]('Trying\x20ispeech\x20TTS\x20%s',_0x3c749e[_0x8c97('0x5b')]));var _0x1f85e8=this['ispeechTTS'][_0x8c97('0x6f')](this,_0x3c749e);if(_0x1f85e8){this[_0x8c97('0x10')]['noop'](util[_0x8c97('0x2b')](_0x8c97('0x145'),_0x1f85e8));var _0x4e726f=this[_0x8c97('0x10')][_0x8c97('0x102')](_0x1f85e8,_0x3c749e[_0x8c97('0x12b')]);try{fs[_0x8c97('0x103')](_0x1f85e8+_0x8c97('0x104'));}catch(_0x3c0413){logger[_0x8c97('0x2e')](_0x3c0413);}return _0x4e726f;}return this['channel'][_0x8c97('0x2e')](_0x3c749e,_0x8c97('0x14a'));};AGIVertices[_0x8c97('0x12')]['login']=function(_0x41c539){logger[_0x8c97('0x30')](util[_0x8c97('0x2b')](_0x8c97('0x14b'),_0x41c539[_0x8c97('0x3a')]));if(!this[_0x8c97('0x86')](_0x41c539[_0x8c97('0x14c')])){return this[_0x8c97('0x10')][_0x8c97('0x2e')](_0x41c539,'no\x20find\x20by\x20configured');}logger[_0x8c97('0x30')](util[_0x8c97('0x2b')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0x8c97('0x10')]['callerid'],_0x41c539['findBy']));var _0x2ff442=this[_0x8c97('0x53')][_0x8c97('0x6f')](this,_0x41c539['findBy']);if(_0x2ff442){logger[_0x8c97('0x30')](util['format'](_0x8c97('0x14d'),this['channel']['callerid'],_0x41c539[_0x8c97('0x14c')]));this[_0x8c97('0x10')][_0x8c97('0xa6')](util['format']('AGENT\x20%s\x20FOUND\x20BY',this[_0x8c97('0x10')][_0x8c97('0x51')],_0x41c539[_0x8c97('0x14c')]));return{'code':0xc8,'result':_0x8c97('0x14e')};}else{logger['info'](util[_0x8c97('0x2b')](_0x8c97('0x14f'),this[_0x8c97('0x10')]['callerid'],_0x41c539['findBy']));this['channel'][_0x8c97('0xa6')](util[_0x8c97('0x2b')](_0x8c97('0x14f'),this['channel'][_0x8c97('0x51')],_0x41c539['findBy']));return{'code':0xc8,'result':'failure'};}};AGIVertices[_0x8c97('0x12')]['logout']=function(_0x5cef9f){logger[_0x8c97('0x30')](util[_0x8c97('0x2b')](_0x8c97('0x150'),_0x5cef9f[_0x8c97('0x3a')]));if(!this[_0x8c97('0x86')](_0x5cef9f['findBy'])){return this[_0x8c97('0x10')][_0x8c97('0x2e')](_0x5cef9f,'no\x20find\x20by\x20configured');}logger['info'](util['format'](_0x8c97('0x151'),this[_0x8c97('0x10')][_0x8c97('0x51')],_0x5cef9f[_0x8c97('0x14c')]));var _0x463f66=this[_0x8c97('0x52')][_0x8c97('0x6f')](this,_0x5cef9f[_0x8c97('0x14c')]);if(_0x463f66){logger['info'](util[_0x8c97('0x2b')](_0x8c97('0x14d'),this[_0x8c97('0x10')][_0x8c97('0x51')],_0x5cef9f[_0x8c97('0x14c')]));this[_0x8c97('0x10')][_0x8c97('0xa6')](util[_0x8c97('0x2b')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x8c97('0x10')]['callerid'],_0x5cef9f[_0x8c97('0x14c')]));return{'code':0xc8,'result':_0x8c97('0x14e')};}else{logger['info'](util[_0x8c97('0x2b')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this['channel'][_0x8c97('0x51')],_0x5cef9f['findBy']));this['channel'][_0x8c97('0xa6')](util['format'](_0x8c97('0x14f'),this['channel'][_0x8c97('0x51')],_0x5cef9f[_0x8c97('0x14c')]));return{'code':0xc8,'result':'failure'};}};AGIVertices['prototype'][_0x8c97('0x152')]=function(_0xf7f9ca){logger[_0x8c97('0x30')](util[_0x8c97('0x2b')]('Enter\x20in\x20MATH\x20(%s)\x20block',_0xf7f9ca[_0x8c97('0x3a')]));if(!this['isConfigured'](_0xf7f9ca[_0x8c97('0x153')])){return this[_0x8c97('0x10')]['error'](_0xf7f9ca,'no\x20operation\x20configured');}this[_0x8c97('0x10')]['noop'](util[_0x8c97('0x2b')](_0x8c97('0x154'),_0xf7f9ca['operation']));var _0x420b2c=eval(_0xf7f9ca[_0x8c97('0x153')]);if(!this[_0x8c97('0x86')](_0xf7f9ca['variable_id'])){return this[_0x8c97('0x10')][_0x8c97('0xa6')](_0x8c97('0xd6'));}var _0x47c6a9=this[_0x8c97('0x13')][_0x8c97('0x6f')](this,_0xf7f9ca[_0x8c97('0xd7')]);if(!_0x47c6a9){return this[_0x8c97('0x10')][_0x8c97('0x2e')](_0xf7f9ca,_0x8c97('0xd8'));}if(_[_0x8c97('0x9a')](_0x420b2c)){var _0x1230c6=this;_0x420b2c[_0x8c97('0xd9')](function(_0x2eb4fb,_0x5da651){_0x1230c6[_0x8c97('0x10')][_0x8c97('0x9e')](util['format']('%s[%s]',_0x47c6a9,_0x5da651),_0x2eb4fb);});return this[_0x8c97('0x10')][_0x8c97('0xa6')](util['format'](_0x8c97('0x155'),_0x47c6a9));}else{return this[_0x8c97('0x10')][_0x8c97('0x9e')](_0x47c6a9,_0x420b2c);}};AGIVertices[_0x8c97('0x12')][_0x8c97('0xd')]=function(_0x535efd){logger[_0x8c97('0x30')](util[_0x8c97('0x2b')](_0x8c97('0x156'),_0x535efd[_0x8c97('0x3a')]));if(_0x535efd[_0x8c97('0xa4')]===0x0){return this[_0x8c97('0x110')](_0x535efd);}_0x535efd[_0x8c97('0xa4')]-=0x1;if(!this[_0x8c97('0x86')](_0x535efd[_0x8c97('0x157')])){return this[_0x8c97('0x10')][_0x8c97('0x2e')](_0x535efd,'no\x20file\x20audio\x20selected');}var _0x32963e=this[_0x8c97('0x20')][_0x8c97('0x6f')](this,_0x535efd[_0x8c97('0x157')]);if(!_0x32963e){return this['channel'][_0x8c97('0x2e')](_0x535efd,_0x8c97('0x112'));}var _0xefdd9d=this[_0x8c97('0x10')][_0x8c97('0x158')](_0x32963e,_0x535efd['response'],_0x535efd['digit']);var _0x5b806a=_0xefdd9d[_0x8c97('0xa1')];if(_0xefdd9d[_0x8c97('0xa1')]===-0x1){this[_0x8c97('0x38')][_0x8c97('0x6f')](this,_0x535efd,'-1');return _0xefdd9d;}else if(_0xefdd9d[_0x8c97('0xa3')]===_0x8c97('0x64')){_0xefdd9d[_0x8c97('0xa1')]=_0xefdd9d['result'][_0x8c97('0x9b')]>0x0?_0xefdd9d['result']:'t';}else if(_[_0x8c97('0x43')](_0xefdd9d[_0x8c97('0xa1')])){_0xefdd9d[_0x8c97('0xa1')]='#';_0x5b806a='#';}if(!this[_0x8c97('0x86')](_0x535efd[_0x8c97('0xd7')])){this['channel'][_0x8c97('0xa6')](_0x8c97('0xd6'));}else{var _0x35362e=this['getVariable'][_0x8c97('0x6f')](this,_0x535efd['variable_id']);if(!_0x35362e){return this['channel'][_0x8c97('0x2e')](_0x535efd,_0x8c97('0xd8'));}this[_0x8c97('0x10')][_0x8c97('0x9e')](_0x35362e,_0x5b806a);}this[_0x8c97('0x38')]['sync'](this,_0x535efd,_0x5b806a);return _0xefdd9d;};AGIVertices[_0x8c97('0x12')][_0x8c97('0xa6')]=function(_0x2d1cc3){logger['info'](util['format'](_0x8c97('0x159'),_0x2d1cc3['label']));return this[_0x8c97('0x10')][_0x8c97('0xa6')](_0x2d1cc3[_0x8c97('0x15a')]||_0x2d1cc3['label']);};AGIVertices[_0x8c97('0x12')][_0x8c97('0x15b')]=function(_0x472a19){logger[_0x8c97('0x30')](util[_0x8c97('0x2b')](_0x8c97('0x15c'),_0x472a19[_0x8c97('0x3a')]));if(!this[_0x8c97('0x86')](_0x472a19[_0x8c97('0x14c')])){return this['channel'][_0x8c97('0x2e')](_0x472a19,'no\x20find\x20by\x20configured');}logger[_0x8c97('0x30')](util['format']('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0x8c97('0x10')][_0x8c97('0x51')],_0x472a19['findBy']));var _0x1207f9=this[_0x8c97('0x4d')][_0x8c97('0x6f')](this,_0x472a19[_0x8c97('0x15d')]);var _0x765b31=this[_0x8c97('0x4f')]['sync'](this,_0x472a19['findBy'],_0x1207f9);if(_0x765b31){logger[_0x8c97('0x30')](util['format'](_0x8c97('0x14d'),this[_0x8c97('0x10')][_0x8c97('0x51')],_0x472a19[_0x8c97('0x14c')]));this[_0x8c97('0x10')][_0x8c97('0xa6')](util[_0x8c97('0x2b')](_0x8c97('0x14d'),this[_0x8c97('0x10')][_0x8c97('0x51')],_0x472a19['findBy']));return{'code':0xc8,'result':_0x8c97('0x14e')};}else{logger['info'](util[_0x8c97('0x2b')](_0x8c97('0x14f'),this['channel']['callerid'],_0x472a19[_0x8c97('0x14c')]));this[_0x8c97('0x10')][_0x8c97('0xa6')](util['format'](_0x8c97('0x14d'),this[_0x8c97('0x10')][_0x8c97('0x51')],_0x472a19[_0x8c97('0x14c')]));return{'code':0xc8,'result':_0x8c97('0x15e')};}};AGIVertices[_0x8c97('0x12')][_0x8c97('0x15f')]=function(_0x269d59){logger[_0x8c97('0x30')](util[_0x8c97('0x2b')](_0x8c97('0x160'),_0x269d59[_0x8c97('0x3a')]));if(!this['isConfigured'](_0x269d59[_0x8c97('0x157')])){return this[_0x8c97('0x10')]['error'](_0x269d59,_0x8c97('0x111'));}var _0x26018f=this[_0x8c97('0x20')][_0x8c97('0x6f')](this,_0x269d59[_0x8c97('0x157')]);if(!_0x26018f){return this[_0x8c97('0x10')]['error'](_0x269d59,_0x8c97('0x112'));}var _0x326d43=this[_0x8c97('0x10')][_0x8c97('0x56')]('PLAYBACK',[_0x26018f,_0x269d59[_0x8c97('0xe5')]]);if(_0x326d43[_0x8c97('0xa1')]===-0x1){return _0x326d43;}return this[_0x8c97('0x10')]['noop'](util[_0x8c97('0x2b')]('Executed\x20command\x20%s\x20%s',_0x8c97('0x161'),_0x26018f));};AGIVertices[_0x8c97('0x12')][_0x8c97('0x162')]=function(_0x5e23f7){logger['info'](util[_0x8c97('0x2b')](_0x8c97('0x163'),_0x5e23f7['label']));if(!this['isConfigured'](_0x5e23f7[_0x8c97('0x164')])){return this[_0x8c97('0x10')][_0x8c97('0x2e')](_0x5e23f7,_0x8c97('0x165'));}var _0x59340e='';var _0x32e47c=parseInt(_0x5e23f7[_0x8c97('0x164')],0xa);if(isNaN(_0x32e47c)){_0x59340e=_0x5e23f7[_0x8c97('0x164')];}else{_0x59340e=this['getVoiceQueue'][_0x8c97('0x6f')](this,_0x5e23f7[_0x8c97('0x164')]);if(!_0x59340e){return this[_0x8c97('0x10')]['error'](_0x5e23f7,'no\x20queue\x20found');}}var _0x5d1b39='';if(this['isConfigured'](_0x5e23f7['file_id'])){var _0x5430d2=this['getSound'][_0x8c97('0x6f')](this,_0x5e23f7[_0x8c97('0x157')]);if(_0x5430d2){_0x5d1b39=_0x5430d2;}}this[_0x8c97('0x38')]['sync'](this,_0x5e23f7,_0x59340e);if(_0x5e23f7[_0x8c97('0xe5')][_0x8c97('0x166')]('x')<0x0){_0x5e23f7['opts']+='x';}if(_0x5e23f7[_0x8c97('0xe5')][_0x8c97('0x166')]('X')<0x0){_0x5e23f7['opts']+='X';}this[_0x8c97('0x10')][_0x8c97('0x9e')](_0x8c97('0x167'),_0x59340e?_0x59340e[_0x8c97('0x168')]():'');var _0x26eece=this[_0x8c97('0x10')][_0x8c97('0x56')](_0x8c97('0x169'),[_0x59340e,_0x5e23f7[_0x8c97('0xe5')],_0x5e23f7[_0x8c97('0x71')],_0x5d1b39,_0x5e23f7['timeout'],_0x5e23f7['agi'],_0x5e23f7[_0x8c97('0x16a')],_0x5e23f7[_0x8c97('0x16b')],'',_0x5e23f7[_0x8c97('0x16c')]]);if(_0x26eece[_0x8c97('0xa1')]===-0x1){return _0x26eece;}return this[_0x8c97('0x10')][_0x8c97('0xa6')](util[_0x8c97('0x2b')]('Executed\x20command\x20%s\x20%s','QUEUE',_0x59340e));};AGIVertices['prototype'][_0x8c97('0x16d')]=function(_0x2c6152){logger[_0x8c97('0x30')](util[_0x8c97('0x2b')](_0x8c97('0x16e'),_0x2c6152['label']));var _0x1d38c5=_0x2c6152[_0x8c97('0x16f')]||_0x8c97('0x126');var _0x82e909=util[_0x8c97('0x2b')](_0x8c97('0x170'),this[_0x8c97('0x10')][_0x8c97('0x39')],rs[_0x8c97('0x117')](0x5));var _0x57aba2=util['format'](_0x8c97('0x171'),FILES_PATH,_0x82e909,_0x1d38c5);var _0x1e391d=util[_0x8c97('0x2b')]('%s/recordings/%s',FILES_PATH,_0x82e909);this['createSquareRecording'][_0x8c97('0x6f')](this,_0x2c6152,_0x82e909,_0x57aba2);this[_0x8c97('0x10')][_0x8c97('0x9e')](_0x8c97('0x172'),_0x82e909);logger[_0x8c97('0x30')](_0x8c97('0x173'),_0x1e391d,_0x1d38c5,_0x2c6152[_0x8c97('0x174')],_0x2c6152[_0x8c97('0x64')]);return this['channel']['recordFile'](_0x1e391d,_0x1d38c5,_0x2c6152['escape_digits'],_0x2c6152[_0x8c97('0x64')],undefined,!![]);};AGIVertices[_0x8c97('0x12')][_0x8c97('0x175')]=function(_0x3d0b07){logger[_0x8c97('0x30')](util[_0x8c97('0x2b')](_0x8c97('0x176'),_0x3d0b07[_0x8c97('0x3a')]));if(!this[_0x8c97('0x86')](_0x3d0b07[_0x8c97('0x71')])){return this[_0x8c97('0x10')]['noop']('no\x20url\x20configured');}var _0x220bba=this[_0x8c97('0x62')][_0x8c97('0x6f')](this,_0x3d0b07);logger['info'](util['format'](_0x8c97('0x177'),util[_0x8c97('0x178')](_0x220bba,{'showHidden':![],'depth':null})));if(!this[_0x8c97('0x86')](_0x3d0b07['variable_id'])){return this[_0x8c97('0x10')][_0x8c97('0xa6')](_0x8c97('0x179'));}var _0x4ef935=this[_0x8c97('0x13')][_0x8c97('0x6f')](this,_0x3d0b07[_0x8c97('0xd7')]);if(!_0x4ef935){return this[_0x8c97('0x10')][_0x8c97('0x2e')](_0x3d0b07,_0x8c97('0xd8'));}this[_0x8c97('0x10')][_0x8c97('0x9e')](util['format'](_0x8c97('0x17a'),_0x4ef935),_0x220bba[_0x8c97('0x74')]?_0x220bba[_0x8c97('0x74')]:_0x8c97('0x17b'));this['channel'][_0x8c97('0x9e')](util[_0x8c97('0x2b')](_0x8c97('0x17c'),_0x4ef935),_0x220bba[_0x8c97('0x17d')]?_0x220bba[_0x8c97('0x17d')]:'OK');if(_0x220bba[_0x8c97('0x69')]){try{this[_0x8c97('0x9c')](_0x220bba[_0x8c97('0x69')],_0x4ef935);}catch(_0x32d0d7){logger[_0x8c97('0x2e')](util[_0x8c97('0x2b')](_0x8c97('0x17e'),_0x4ef935));}}return this[_0x8c97('0x10')]['noop'](util[_0x8c97('0x2b')](_0x8c97('0xdc'),_0x4ef935));};AGIVertices['prototype'][_0x8c97('0x17f')]=function(_0x44d401){logger['info'](util[_0x8c97('0x2b')](_0x8c97('0x180'),_0x44d401[_0x8c97('0x3a')]));return this[_0x8c97('0x10')][_0x8c97('0x181')](_0x44d401['digits'][_0x8c97('0x58')](/\s+/g,''),_0x44d401[_0x8c97('0x174')]);};AGIVertices[_0x8c97('0x12')][_0x8c97('0x182')]=function(_0x6f29ef){logger[_0x8c97('0x30')](util[_0x8c97('0x2b')](_0x8c97('0x183'),_0x6f29ef[_0x8c97('0x3a')]));return this[_0x8c97('0x10')]['sayNumber'](_0x6f29ef[_0x8c97('0x65')][_0x8c97('0x58')](/\s+/g,''),_0x6f29ef[_0x8c97('0x174')]);};AGIVertices[_0x8c97('0x12')][_0x8c97('0x184')]=function(_0x3f7220){logger['info'](util['format'](_0x8c97('0x185'),_0x3f7220[_0x8c97('0x3a')]));return this[_0x8c97('0x10')][_0x8c97('0x186')](_0x3f7220[_0x8c97('0x5b')],_0x3f7220[_0x8c97('0x174')]);};AGIVertices[_0x8c97('0x12')]['sendMail']=function(_0x2f3f51){logger['info'](util[_0x8c97('0x2b')](_0x8c97('0x187'),_0x2f3f51[_0x8c97('0x3a')]));if(!this[_0x8c97('0x86')](_0x2f3f51[_0x8c97('0x188')])){return this[_0x8c97('0x10')]['noop'](_0x8c97('0x189'));}var _0x5e229c=this['getMailAccount'][_0x8c97('0x6f')](this,_0x2f3f51[_0x8c97('0x188')]);if(!_0x5e229c||!_0x5e229c['Smtp']){return this[_0x8c97('0x10')]['error'](_0x2f3f51,_0x8c97('0x18a'));}var _0x58a66b={'from':util[_0x8c97('0x2b')](_0x8c97('0x18b'),_0x5e229c[_0x8c97('0x19')],_0x5e229c[_0x8c97('0x18c')]||_0x5e229c['Smtp'][_0x8c97('0x18d')]),'to':_0x2f3f51['to']||'','cc':_0x2f3f51['cc']||'','bcc':_0x2f3f51[_0x8c97('0x18e')]||'','subject':_0x2f3f51[_0x8c97('0x18f')],'html':_0x2f3f51[_0x8c97('0x5b')],'text':_0x2f3f51[_0x8c97('0x5b')]};if(this[_0x8c97('0x86')](_0x2f3f51[_0x8c97('0x190')])){}logger['debug'](_0x8c97('0x191'),JSON['stringify'](_0x58a66b));this['createSquareDetailsReport'][_0x8c97('0x6f')](this,_0x2f3f51,_0x2f3f51[_0x8c97('0x188')]);this[_0x8c97('0x10')][_0x8c97('0xa6')](util[_0x8c97('0x2b')](_0x8c97('0x192'),_0x5e229c[_0x8c97('0x19')]));this[_0x8c97('0x24')]['sync'](this,_0x5e229c['smtpOptions'],_0x58a66b);return this[_0x8c97('0x10')][_0x8c97('0xa6')](_0x8c97('0x193'));};AGIVertices[_0x8c97('0x12')][_0x8c97('0x194')]=function(_0x1bb295){logger[_0x8c97('0x30')](util[_0x8c97('0x2b')](_0x8c97('0x195'),_0x1bb295[_0x8c97('0x3a')]));return this['channel'][_0x8c97('0xa6')](_0x8c97('0x196'));};AGIVertices[_0x8c97('0x12')][_0x8c97('0x197')]=function(_0xace51e){logger[_0x8c97('0x30')](util[_0x8c97('0x2b')](_0x8c97('0x198'),_0xace51e[_0x8c97('0x3a')]));if(!this[_0x8c97('0x86')](_0xace51e[_0x8c97('0x199')])){return this[_0x8c97('0x10')][_0x8c97('0xa6')](_0x8c97('0x19a'));}var _0x1552a2=this[_0x8c97('0x35')][_0x8c97('0x6f')](this,_0xace51e[_0x8c97('0x199')]);if(!_0x1552a2){return this[_0x8c97('0x10')]['error'](_0xace51e,_0x8c97('0x19b'));}var _0xc98f53={'body':_0xace51e[_0x8c97('0x19c')],'phone':_0xace51e['to']||'','SmsAccountId':_0x1552a2['id']};logger['debug'](_0x8c97('0x19d'),JSON[_0x8c97('0x72')](_0xc98f53));this[_0x8c97('0x38')][_0x8c97('0x6f')](this,_0xace51e,_0xace51e[_0x8c97('0x199')]);this[_0x8c97('0x10')][_0x8c97('0xa6')](util[_0x8c97('0x2b')]('Trying\x20SendSMS\x20with\x20account\x20%s',_0x1552a2[_0x8c97('0x19')]));this[_0x8c97('0x37')][_0x8c97('0x6f')](this,_0xc98f53);return this[_0x8c97('0x10')][_0x8c97('0xa6')](_0x8c97('0x19e'));};AGIVertices[_0x8c97('0x12')]['set']=function(_0x1878ef){logger[_0x8c97('0x30')](util['format']('Enter\x20in\x20SET\x20(%s)\x20block',_0x1878ef[_0x8c97('0x3a')]));if(!this[_0x8c97('0x86')](_0x1878ef[_0x8c97('0xd7')])){return this[_0x8c97('0x10')][_0x8c97('0x2e')](_0x1878ef,_0x8c97('0x19f'));}var _0x2285c7=this['getVariable'][_0x8c97('0x6f')](this,_0x1878ef['variable_id']);if(!_0x2285c7){return this[_0x8c97('0x10')][_0x8c97('0x2e')](_0x1878ef,_0x8c97('0xd8'));}return this['channel'][_0x8c97('0x9e')](_0x2285c7,_0x1878ef[_0x8c97('0x1a0')]);};AGIVertices[_0x8c97('0x12')]['start']=function(_0x2b406b){logger[_0x8c97('0x30')](util[_0x8c97('0x2b')]('Enter\x20in\x20START\x20(%s)\x20block',_0x2b406b[_0x8c97('0x3a')]));this[_0x8c97('0x10')]['noop']('START\x20CALLY\x20SQUARE');var _0x18246a=this[_0x8c97('0x10')][_0x8c97('0x13')](_0x8c97('0x1a1'));if(!_['isEmpty'](_0x18246a[_0x8c97('0xa3')])){this[_0x8c97('0x10')]['uniqueid']=_0x18246a[_0x8c97('0xa3')];}if(_0x2b406b['answer']==='yes'){this[_0x8c97('0x10')][_0x8c97('0xa6')]('Answer');return this['channel'][_0x8c97('0xb8')]();}return this[_0x8c97('0x10')][_0x8c97('0xa6')](_0x8c97('0x1a2'));};AGIVertices[_0x8c97('0x12')][_0x8c97('0x1a3')]=function(_0x3c13a8){logger['info'](util[_0x8c97('0x2b')]('Enter\x20in\x20SUBPROJECT\x20(%s)\x20block',_0x3c13a8[_0x8c97('0x3a')]));if(!this[_0x8c97('0x86')](_0x3c13a8[_0x8c97('0x1a4')])){return this['channel'][_0x8c97('0x2e')](_0x3c13a8,_0x8c97('0x1a5'));}var _0x3efa6c=this[_0x8c97('0x1a')]['sync'](this,_0x3c13a8['project_id']);if(!this['isConfigured'](_0x3efa6c)){return this[_0x8c97('0x10')][_0x8c97('0x2e')](_0x3c13a8,util[_0x8c97('0x2b')](_0x8c97('0x1a6'),_0x3c13a8[_0x8c97('0x1a4')]));}if(_0x3efa6c===this[_0x8c97('0x10')]['arg_1']){return this['channel'][_0x8c97('0x2e')](_0x3c13a8,_0x8c97('0x1a7'));}this[_0x8c97('0x38')][_0x8c97('0x6f')](this,_0x3c13a8,_0x3efa6c);var _0x278670=this[_0x8c97('0x10')]['exec']('AGI',util[_0x8c97('0x2b')](_0x8c97('0x1a8'),config['agi'][_0x8c97('0x1a9')]||_0x8c97('0x1aa'),_0x3efa6c,this[_0x8c97('0x10')][_0x8c97('0x3c')]));if(_0x278670[_0x8c97('0xa1')]===-0x1){return _0x278670;}return this['channel'][_0x8c97('0xa6')](util[_0x8c97('0x2b')]('Executed\x20command\x20%s\x20%s',_0x8c97('0x1ab'),_0x3efa6c));};AGIVertices[_0x8c97('0x12')][_0x8c97('0x1ac')]=function(_0x1352da){logger[_0x8c97('0x30')](util['format'](_0x8c97('0x1ad'),_0x1352da[_0x8c97('0x3a')]));var _0x1a6a6b=this[_0x8c97('0x55')][_0x8c97('0x6f')](this,_0x1352da[_0x8c97('0x1ae')]);this[_0x8c97('0x38')][_0x8c97('0x6f')](this,_0x1352da,_0x1352da[_0x8c97('0x1ae')]);if(this[_0x8c97('0x86')](_0x1352da[_0x8c97('0xd7')])){var _0x5be7ec=this[_0x8c97('0x13')]['sync'](this,_0x1352da['variable_id']);if(_0x5be7ec){this['channel']['setVariable'](_0x5be7ec,_0x1a6a6b);return this[_0x8c97('0x10')][_0x8c97('0xa6')](util[_0x8c97('0x2b')]('sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s',_0x1352da[_0x8c97('0x1ae')],_0x5be7ec));}}return this[_0x8c97('0x10')][_0x8c97('0xa6')](util[_0x8c97('0x2b')](_0x8c97('0x1af'),_0x1352da[_0x8c97('0x1ae')]));};AGIVertices[_0x8c97('0x12')][_0x8c97('0x1b0')]=function(_0x508d3d){logger['info'](util['format'](_0x8c97('0x1b1'),_0x508d3d[_0x8c97('0x3a')]));_0x508d3d[_0x8c97('0x5b')]=_0x508d3d['text'][_0x8c97('0x58')](/(\r\n|\n|\r)/gm,'\x20');if(!this['isConfigured'](_0x508d3d[_0x8c97('0x1b2')])){return this[_0x8c97('0x10')][_0x8c97('0xa6')](_0x8c97('0x1b3'));}if(!this[_0x8c97('0x86')](_0x508d3d[_0x8c97('0x5b')])){return this[_0x8c97('0x10')][_0x8c97('0xa6')]('no\x20text\x20configured');}this[_0x8c97('0x10')]['noop'](util[_0x8c97('0x2b')](_0x8c97('0x1b4'),_0x508d3d[_0x8c97('0x5b')]));var _0x2cf89e=this['googleCloudTTS'][_0x8c97('0x6f')](this,_0x508d3d);if(_0x2cf89e){this[_0x8c97('0x10')][_0x8c97('0xa6')](util[_0x8c97('0x2b')](_0x8c97('0x1b5'),_0x2cf89e));var _0x56122f=this[_0x8c97('0x10')][_0x8c97('0x102')](_0x2cf89e);try{fs[_0x8c97('0x103')](_0x2cf89e+_0x8c97('0x104'));}catch(_0x324246){logger[_0x8c97('0x2e')](_0x324246);}return _0x56122f;}return this[_0x8c97('0x10')][_0x8c97('0x2e')](_0x508d3d,_0x8c97('0x1b6'));};AGIVertices[_0x8c97('0x12')][_0x8c97('0x1b7')]=function(_0x54c3d6){logger[_0x8c97('0x30')](util[_0x8c97('0x2b')](_0x8c97('0x1b8'),_0x54c3d6[_0x8c97('0x3a')]));_0x54c3d6[_0x8c97('0x5b')]=_0x54c3d6[_0x8c97('0x5b')][_0x8c97('0x58')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x8c97('0x86')](_0x54c3d6[_0x8c97('0x5b')])){return this[_0x8c97('0x10')]['noop'](_0x8c97('0xc4'));}this[_0x8c97('0x10')][_0x8c97('0xa6')](util['format']('Trying\x20Google\x20TTS\x20%s',_0x54c3d6[_0x8c97('0x5b')]));var _0x302209=this['googleTTS'][_0x8c97('0x6f')](this,_0x54c3d6);if(_0x302209){this['channel']['noop'](util[_0x8c97('0x2b')](_0x8c97('0x1b9'),_0x302209));var _0x27896d=this[_0x8c97('0x10')][_0x8c97('0x102')](_0x302209);try{fs[_0x8c97('0x103')](_0x302209+_0x8c97('0x104'));}catch(_0x49594c){logger[_0x8c97('0x2e')](_0x49594c);}return _0x27896d;}return this['channel']['error'](_0x54c3d6,_0x8c97('0x1ba'));};AGIVertices['prototype'][_0x8c97('0x1bb')]=function(_0x2227dc){logger[_0x8c97('0x30')](util['format'](_0x8c97('0x1bc'),_0x2227dc['label']));if(!this['isConfigured'](_0x2227dc[_0x8c97('0x14c')])){return this['channel'][_0x8c97('0x2e')](_0x2227dc,_0x8c97('0x1bd'));}logger[_0x8c97('0x30')](util['format'](_0x8c97('0x151'),this[_0x8c97('0x10')]['callerid'],_0x2227dc[_0x8c97('0x14c')]));var _0x9916fd=this['agentUnpause'][_0x8c97('0x6f')](this,_0x2227dc['findBy']);if(_0x9916fd){logger[_0x8c97('0x30')](util[_0x8c97('0x2b')](_0x8c97('0x14d'),this[_0x8c97('0x10')]['callerid'],_0x2227dc[_0x8c97('0x14c')]));this[_0x8c97('0x10')][_0x8c97('0xa6')](util[_0x8c97('0x2b')](_0x8c97('0x14d'),this[_0x8c97('0x10')]['callerid'],_0x2227dc['findBy']));return{'code':0xc8,'result':'success'};}else{logger[_0x8c97('0x30')](util[_0x8c97('0x2b')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x8c97('0x10')][_0x8c97('0x51')],_0x2227dc['findBy']));this['channel'][_0x8c97('0xa6')](util[_0x8c97('0x2b')](_0x8c97('0x14f'),this['channel']['callerid'],_0x2227dc[_0x8c97('0x14c')]));return{'code':0xc8,'result':'failure'};}};AGIVertices[_0x8c97('0x12')]['voicemail']=function(_0x57efad){logger[_0x8c97('0x30')](util[_0x8c97('0x2b')](_0x8c97('0x1be'),_0x57efad[_0x8c97('0x3a')]));var _0xb09268=this['channel'][_0x8c97('0x56')]('VOICEMAIL',[_0x57efad[_0x8c97('0x1bf')],_0x57efad[_0x8c97('0x77')]]);if(_0xb09268[_0x8c97('0xa1')]===-0x1){return _0xb09268;}return this['channel'][_0x8c97('0xa6')](util[_0x8c97('0x2b')](_0x8c97('0xc0'),_0x8c97('0x1c0'),_0x57efad['mailbox']));};AGIVertices[_0x8c97('0x12')]['vswitch']=function(_0x2bbcb3){logger[_0x8c97('0x30')](util[_0x8c97('0x2b')]('Enter\x20in\x20SWITCH\x20(%s)\x20block',_0x2bbcb3[_0x8c97('0x3a')]));if(!this[_0x8c97('0x86')](_0x2bbcb3[_0x8c97('0xd7')])){return this[_0x8c97('0x10')][_0x8c97('0x2e')](_0x2bbcb3,_0x8c97('0x19f'));}var _0x9b2dbc=this[_0x8c97('0x13')][_0x8c97('0x6f')](this,_0x2bbcb3['variable_id']);if(!_0x9b2dbc){return this[_0x8c97('0x10')]['error'](_0x2bbcb3,_0x8c97('0xd8'));}var _0x8f2dd=this[_0x8c97('0x10')][_0x8c97('0x13')](_0x9b2dbc);return{'code':0xc8,'result':_0x8f2dd['extra']?_0x8f2dd['extra']:'-'};};String[_0x8c97('0x12')][_0x8c97('0x1c1')]=function(_0x2ac5d2,_0x1014d1){return this['split'](_0x2ac5d2)[_0x8c97('0x1c2')](_0x1014d1);};module[_0x8c97('0x1c3')]=AGIVertices; \ No newline at end of file diff --git a/server/services/ami/acw/index.js b/server/services/ami/acw/index.js index fe618b9..98e49b3 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 _0xee2c=['acwTimeout','stopAcw','format','YYYY-MM-DD\x20HH:mm:ss','[ACW][START]\x20%s','message','[ACW][TIMERS]','stringify','[ACW][STOP]\x20%s','syncAgentConnect','interface','[ACW][syncAgentConnect]\x20%s','syncAgentConnectPreview','[ACW][syncAgentConnectPreview]\x20%s','isUndefined','linkedid','[ACW][syncHangupRequest]\x20%s','[%s][HANGUPATTENDEDTRANSFER:LINKEDID]','[ACW][syncHangup]\x20%s','isNil','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','[ACW][syncAttendedTransfer]\x20%s','transfereruniqueid','[%s][BLINDTRANSFER:UNIQUEID]','transfererlinkedid','[%s][BLINDTRANSFER:LINKEDID]','[ACW][syncBlindTransfer]\x20%s','autopause','all','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','Auto-Pause','exports','lodash','../ami','../../../config/logger','acw','../rpc/user','voiceQueues','agents','timers','channels','agentconnect','hanguprequest','syncHangupRequest','bind','hangup','syncHangup','agentringnoanswer','syncAgentRingNoAnswer','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','custom:agentConnectPreview','milliseconds','seconds','prototype','updateAcw','lastPauseAt','timer','update','uniqueid','info','[%s][UPDATE][ACWTIME:%s]','catch','error','[%s][UPDATE][ERRORS:%s]','finally','startAcw','queue','ACW','mandatoryDisposition','mandatoryDispositionPause','resolve','getAgent','then','voicePause','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','[%s][START][AGENT:%s][QUEUE:%s]','attended','destlinkedid'];(function(_0x1abeb2,_0x79f462){var _0x48da20=function(_0x42a90b){while(--_0x42a90b){_0x1abeb2['push'](_0x1abeb2['shift']());}};_0x48da20(++_0x79f462);}(_0xee2c,0x1c7));var _0xcee2=function(_0x2112d4,_0x3c863c){_0x2112d4=_0x2112d4-0x0;var _0x434972=_0xee2c[_0x2112d4];return _0x434972;};'use strict';var _=require(_0xcee2('0x0'));var moment=require('moment');var ami=require(_0xcee2('0x1'));var logger=require(_0xcee2('0x2'))(_0xcee2('0x3'));var RpcUser=require(_0xcee2('0x4'));var RpcVoiceAgentReport=require('../rpc/voiceAgentReport');function Acw(_0x589e9d){this[_0xcee2('0x5')]=_0x589e9d[_0xcee2('0x5')];this['agents']=_0x589e9d[_0xcee2('0x6')];this[_0xcee2('0x7')]=_0x589e9d[_0xcee2('0x7')];this[_0xcee2('0x8')]={};ami['on'](_0xcee2('0x9'),this['syncAgentConnect']['bind'](this));ami['on'](_0xcee2('0xa'),this[_0xcee2('0xb')][_0xcee2('0xc')](this));ami['on'](_0xcee2('0xd'),this[_0xcee2('0xe')][_0xcee2('0xc')](this));ami['on'](_0xcee2('0xf'),this[_0xcee2('0x10')]['bind'](this));ami['on'](_0xcee2('0x11'),this[_0xcee2('0x12')][_0xcee2('0xc')](this));ami['on'](_0xcee2('0x13'),this[_0xcee2('0x14')]['bind'](this));ami['on'](_0xcee2('0x15'),this['syncAgentConnectPreview']['bind'](this));}function getDiff(_0x5dad1e){var _0xfa663a=moment()[_0xcee2('0x16')](0x0);var _0x2afc56=moment(_0x5dad1e)[_0xcee2('0x16')](0x0);return _0xfa663a['diff'](_0x2afc56,_0xcee2('0x17'));}Acw[_0xcee2('0x18')][_0xcee2('0x19')]=function(_0x238da0,_0x1787ec){var _0x21a182=this;var _0x25bdcf=getDiff(_0x21a182[_0xcee2('0x7')][_0x238da0][_0xcee2('0x1a')]);clearTimeout(_0x21a182['timers'][_0x238da0][_0xcee2('0x1b')]);_0x21a182['timers'][_0x238da0][_0xcee2('0x1b')]=![];return RpcVoiceAgentReport[_0xcee2('0x1c')]({'acwtime':_0x25bdcf},_0x21a182[_0xcee2('0x7')][_0x238da0][_0xcee2('0x1d')],_0x238da0)['then'](function(_0x245811){logger[_0xcee2('0x1e')](_0xcee2('0x1f'),_0x1787ec,_0x25bdcf,_0x245811);})[_0xcee2('0x20')](function(_0x3395b1){logger[_0xcee2('0x21')](_0xcee2('0x22'),_0x1787ec,_0x3395b1);})[_0xcee2('0x23')](function(){delete _0x21a182[_0xcee2('0x7')][_0x238da0];});};Acw[_0xcee2('0x18')][_0xcee2('0x24')]=function(_0x5d42aa){try{var _0x3f4f92=this;var _0x4864d7=this['channels'][_0x5d42aa]['interface'];var _0x2c1b27=this['channels'][_0x5d42aa][_0xcee2('0x25')];var _0x1a935a=this[_0xcee2('0x5')][_0x2c1b27];var _0x53bd9f=![];var _0x49b1a8=_0xcee2('0x26');if(_0x1a935a[_0xcee2('0x27')]&&_0x1a935a[_0xcee2('0x28')]['name']){_0x53bd9f=!![];_0x49b1a8=_0x1a935a[_0xcee2('0x28')]['name'];}if(!_0x3f4f92[_0xcee2('0x6')][_0x4864d7]){return Promise[_0xcee2('0x29')]();}return RpcUser[_0xcee2('0x2a')](_0x3f4f92[_0xcee2('0x6')][_0x4864d7]['id'])[_0xcee2('0x2b')](function(_0x31618c){if(!_0x31618c||_0x31618c[_0xcee2('0x2c')]){logger[_0xcee2('0x1e')](_0xcee2('0x2d'),_0x5d42aa,_0x4864d7,_0x2c1b27);return;}logger[_0xcee2('0x1e')](_0xcee2('0x2e'),_0x5d42aa,_0x4864d7,_0x2c1b27);var _0x483d22=_0x3f4f92[_0xcee2('0x8')][_0x5d42aa][_0xcee2('0x2f')]&&_0x3f4f92[_0xcee2('0x8')][_0x5d42aa]['destlinkedid']?_0x3f4f92[_0xcee2('0x8')][_0x5d42aa][_0xcee2('0x30')]:_0x5d42aa;return RpcUser['savePause'](_0x3f4f92[_0xcee2('0x6')][_0x4864d7],_0x49b1a8,_0x483d22);})[_0xcee2('0x2b')](function(_0x56e23b){if(_0x53bd9f||!_0x56e23b){return;}_0x3f4f92['timers'][_0x4864d7]={};logger[_0xcee2('0x1e')]('[%s][TIMER:%s][AGENT:%s][QUEUE:%s]',_0x5d42aa,_0x3f4f92['voiceQueues'][_0x2c1b27][_0xcee2('0x31')],_0x4864d7,_0x2c1b27);_0x3f4f92[_0xcee2('0x7')][_0x4864d7]['timer']=setTimeout(_0x3f4f92[_0xcee2('0x32')][_0xcee2('0xc')](_0x3f4f92,_0x4864d7),_0x3f4f92[_0xcee2('0x5')][_0x2c1b27][_0xcee2('0x31')]*0x3e8);_0x3f4f92[_0xcee2('0x7')][_0x4864d7][_0xcee2('0x1a')]=moment()[_0xcee2('0x33')](_0xcee2('0x34'));_0x3f4f92[_0xcee2('0x7')][_0x4864d7][_0xcee2('0x1d')]=_0x5d42aa;_0x3f4f92[_0xcee2('0x7')][_0x4864d7][_0xcee2('0x25')]=_0x2c1b27;_0x3f4f92['timers'][_0x4864d7][_0xcee2('0x19')]=_0x3f4f92[_0xcee2('0x19')]['bind'](_0x3f4f92,_0x4864d7,_0x5d42aa);})[_0xcee2('0x20')](function(){logger[_0xcee2('0x21')]('[%s][TIMER:%s][AGENT:%s][QUEUE:%s]',_0x5d42aa,_0x3f4f92[_0xcee2('0x5')][_0x2c1b27][_0xcee2('0x31')],_0x4864d7,_0x2c1b27);})[_0xcee2('0x23')](function(){delete _0x3f4f92['channels'][_0x5d42aa];});}catch(_0x590dd4){logger[_0xcee2('0x21')](_0xcee2('0x35'),_0x590dd4[_0xcee2('0x36')]);}};Acw[_0xcee2('0x18')][_0xcee2('0x32')]=function(_0x538984){try{var _0x457f39=this;if(_0x457f39[_0xcee2('0x7')][_0x538984]){_0x457f39[_0xcee2('0x7')][_0x538984]['timer']=![];var _0x1836cd=_0x457f39['timers'][_0x538984]['uniqueid'];var _0x42c307=_0x457f39[_0xcee2('0x7')][_0x538984][_0xcee2('0x25')];var _0x2abeb3=_0x457f39[_0xcee2('0x5')][_0x42c307][_0xcee2('0x31')];logger['info']('[%s][TIMER][STOP][AGENT:%s]',_0x1836cd,_0x538984);RpcUser['saveUnpause'](this[_0xcee2('0x6')][_0x538984]);RpcVoiceAgentReport['update']({'acwtime':_0x2abeb3,'agentacw':!![]},_0x1836cd,_0x538984)[_0xcee2('0x2b')](function(_0x157220){logger['info'](_0xcee2('0x1f'),_0x1836cd,_0x2abeb3,_0x157220);})['catch'](function(_0x54d75a){logger[_0xcee2('0x21')](_0xcee2('0x22'),_0x1836cd,_0x54d75a);});}else{logger['error']('[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer',_0x538984);if(_0x457f39[_0xcee2('0x7')]){logger[_0xcee2('0x1e')](_0xcee2('0x37'),JSON[_0xcee2('0x38')](_0x457f39[_0xcee2('0x7')]));}}}catch(_0x28bb5b){logger[_0xcee2('0x21')](_0xcee2('0x39'),_0x28bb5b[_0xcee2('0x36')]);}};Acw['prototype'][_0xcee2('0x3a')]=function(_0x395b2f){try{if(this[_0xcee2('0x5')][_0x395b2f[_0xcee2('0x25')]]&&(this['voiceQueues'][_0x395b2f[_0xcee2('0x25')]][_0xcee2('0x3')]||this[_0xcee2('0x5')][_0x395b2f[_0xcee2('0x25')]][_0xcee2('0x27')])){if(this[_0xcee2('0x6')][_0x395b2f[_0xcee2('0x3b')]]){this[_0xcee2('0x8')][_0x395b2f[_0xcee2('0x1d')]]={'queue':_0x395b2f['queue'],'interface':_0x395b2f[_0xcee2('0x3b')],'destlinkedid':_0x395b2f[_0xcee2('0x30')]};}}}catch(_0x1a6ff7){logger['error'](_0xcee2('0x3c'),_0x1a6ff7[_0xcee2('0x36')]);}};Acw[_0xcee2('0x18')][_0xcee2('0x3d')]=function(_0x64f54c){try{if(this[_0xcee2('0x5')][_0x64f54c[_0xcee2('0x25')]]&&(this[_0xcee2('0x5')][_0x64f54c[_0xcee2('0x25')]][_0xcee2('0x3')]||this[_0xcee2('0x5')][_0x64f54c[_0xcee2('0x25')]][_0xcee2('0x27')])){if(this[_0xcee2('0x6')][_0x64f54c['interface']]){this[_0xcee2('0x8')][_0x64f54c['uniqueid']]={'queue':_0x64f54c['queue'],'interface':_0x64f54c[_0xcee2('0x3b')]};}}}catch(_0x399291){logger[_0xcee2('0x21')](_0xcee2('0x3e'),_0x399291[_0xcee2('0x36')]);}};Acw['prototype'][_0xcee2('0xb')]=function(_0x4b9864){try{if(this[_0xcee2('0x8')][_0x4b9864[_0xcee2('0x1d')]]&&_[_0xcee2('0x3f')](this[_0xcee2('0x8')][_0x4b9864[_0xcee2('0x1d')]][_0xcee2('0x2f')])){logger[_0xcee2('0x1e')]('[%s][HANGUP:UNIQUEID]',_0x4b9864[_0xcee2('0x1d')]);this[_0xcee2('0x24')](_0x4b9864[_0xcee2('0x1d')]);}else if(this[_0xcee2('0x8')][_0x4b9864[_0xcee2('0x40')]]&&_[_0xcee2('0x3f')](this[_0xcee2('0x8')][_0x4b9864[_0xcee2('0x40')]][_0xcee2('0x2f')])){logger['info']('[%s][HANGUP:LINKEDID]',_0x4b9864[_0xcee2('0x40')]);this[_0xcee2('0x24')](_0x4b9864['linkedid']);}}catch(_0x21cfe0){logger[_0xcee2('0x21')](_0xcee2('0x41'),_0x21cfe0[_0xcee2('0x36')]);}};Acw[_0xcee2('0x18')][_0xcee2('0xe')]=function(_0x2ce4bd){try{if(this['channels'][_0x2ce4bd['uniqueid']]&&this['channels'][_0x2ce4bd[_0xcee2('0x1d')]][_0xcee2('0x2f')]){logger[_0xcee2('0x1e')]('[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]',_0x2ce4bd[_0xcee2('0x1d')]);this[_0xcee2('0x24')](_0x2ce4bd[_0xcee2('0x1d')]);}else if(this['channels'][_0x2ce4bd[_0xcee2('0x40')]]&&this[_0xcee2('0x8')][_0x2ce4bd[_0xcee2('0x40')]]['attended']){logger[_0xcee2('0x1e')](_0xcee2('0x42'),_0x2ce4bd[_0xcee2('0x40')]);this[_0xcee2('0x24')](_0x2ce4bd['linkedid']);}}catch(_0x4f5052){logger['error'](_0xcee2('0x43'),_0x4f5052[_0xcee2('0x36')]);}};Acw[_0xcee2('0x18')][_0xcee2('0x12')]=function(_0x1fb998){try{if(!_[_0xcee2('0x44')](this[_0xcee2('0x8')][_0x1fb998[_0xcee2('0x45')]])){this[_0xcee2('0x24')](_0x1fb998[_0xcee2('0x45')]);if(this[_0xcee2('0x8')][_0x1fb998['secondtransfereruniqueid']]){this[_0xcee2('0x8')][_0x1fb998[_0xcee2('0x46')]][_0xcee2('0x2f')]=!![];this[_0xcee2('0x8')][_0x1fb998[_0xcee2('0x47')]]=this[_0xcee2('0x8')][_0x1fb998[_0xcee2('0x46')]];delete this[_0xcee2('0x8')][_0x1fb998['secondtransfereruniqueid']];}}else if(!_[_0xcee2('0x44')](this[_0xcee2('0x8')][_0x1fb998[_0xcee2('0x47')]])){this[_0xcee2('0x24')](_0x1fb998[_0xcee2('0x47')]);if(this[_0xcee2('0x8')][_0x1fb998[_0xcee2('0x48')]]){this[_0xcee2('0x8')][_0x1fb998[_0xcee2('0x48')]][_0xcee2('0x2f')]=!![];this['channels'][_0x1fb998['transfereeuniqueid']]=this[_0xcee2('0x8')][_0x1fb998[_0xcee2('0x48')]];delete this[_0xcee2('0x8')][_0x1fb998['origtransfereruniqueid']];}}}catch(_0x5089e1){logger['error'](_0xcee2('0x49'),_0x5089e1['message']);}};Acw['prototype'][_0xcee2('0x14')]=function(_0x53bbc9){try{if(this[_0xcee2('0x8')][_0x53bbc9[_0xcee2('0x4a')]]){logger['info'](_0xcee2('0x4b'),JSON[_0xcee2('0x38')](_0x53bbc9['transfereruniqueid']));this['startAcw'](_0x53bbc9[_0xcee2('0x4a')]);}else if(this[_0xcee2('0x8')][_0x53bbc9[_0xcee2('0x4c')]]){logger[_0xcee2('0x1e')](_0xcee2('0x4d'),JSON['stringify'](_0x53bbc9[_0xcee2('0x4c')]));this[_0xcee2('0x24')](_0x53bbc9[_0xcee2('0x4c')]);}}catch(_0xa39d9a){logger[_0xcee2('0x21')](_0xcee2('0x4e'),_0xa39d9a[_0xcee2('0x36')]);}};Acw[_0xcee2('0x18')][_0xcee2('0x10')]=function(_0x4004f0){try{if(this[_0xcee2('0x5')][_0x4004f0[_0xcee2('0x25')]]&&this['voiceQueues'][_0x4004f0[_0xcee2('0x25')]][_0xcee2('0x4f')]===_0xcee2('0x50')){if(this['agents'][_0x4004f0['interface']]){logger[_0xcee2('0x1e')](_0xcee2('0x51'),_0x4004f0[_0xcee2('0x1d')],_0x4004f0[_0xcee2('0x3b')],_0x4004f0['queue']);return RpcUser['savePause'](this[_0xcee2('0x6')][_0x4004f0[_0xcee2('0x3b')]],_0xcee2('0x52'),_0x4004f0[_0xcee2('0x1d')]);}}}catch(_0xe75e6e){logger['error']('[ACW][syncAgentRingNoAnswer]\x20%s',_0xe75e6e[_0xcee2('0x36')]);}};module[_0xcee2('0x53')]=Acw; \ No newline at end of file +var _0x1967=['queue','ACW','mandatoryDisposition','mandatoryDispositionPause','name','resolve','getAgent','voicePause','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','[%s][START][AGENT:%s][QUEUE:%s]','destlinkedid','savePause','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','acwTimeout','stopAcw','format','updateAcw','error','message','uniqueid','[%s][TIMER][STOP][AGENT:%s]','[%s][UPDATE][ACWTIME:%s]','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','[ACW][TIMERS]','stringify','[ACW][STOP]\x20%s','attended','isUndefined','linkedid','startAcw','[ACW][syncHangupRequest]\x20%s','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','isNil','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','[ACW][syncAttendedTransfer]\x20%s','transfereruniqueid','[%s][BLINDTRANSFER:UNIQUEID]','transfererlinkedid','[ACW][syncBlindTransfer]\x20%s','autopause','all','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','Auto-Pause','exports','moment','../ami','../../../config/logger','acw','../rpc/user','../rpc/voiceAgentReport','voiceQueues','agents','timers','channels','agentconnect','syncAgentConnect','bind','syncHangupRequest','hangup','syncHangup','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','custom:agentConnectPreview','syncAgentConnectPreview','milliseconds','diff','prototype','lastPauseAt','timer','update','then','info','catch','[%s][UPDATE][ERRORS:%s]','finally','interface'];(function(_0x43a37c,_0x25a567){var _0x5d1d40=function(_0x3ec673){while(--_0x3ec673){_0x43a37c['push'](_0x43a37c['shift']());}};_0x5d1d40(++_0x25a567);}(_0x1967,0x173));var _0x7196=function(_0x530aeb,_0x373e0f){_0x530aeb=_0x530aeb-0x0;var _0x4590fa=_0x1967[_0x530aeb];return _0x4590fa;};'use strict';var _=require('lodash');var moment=require(_0x7196('0x0'));var ami=require(_0x7196('0x1'));var logger=require(_0x7196('0x2'))(_0x7196('0x3'));var RpcUser=require(_0x7196('0x4'));var RpcVoiceAgentReport=require(_0x7196('0x5'));function Acw(_0x302f34){this[_0x7196('0x6')]=_0x302f34[_0x7196('0x6')];this[_0x7196('0x7')]=_0x302f34['agents'];this[_0x7196('0x8')]=_0x302f34[_0x7196('0x8')];this[_0x7196('0x9')]={};ami['on'](_0x7196('0xa'),this[_0x7196('0xb')][_0x7196('0xc')](this));ami['on']('hanguprequest',this[_0x7196('0xd')][_0x7196('0xc')](this));ami['on'](_0x7196('0xe'),this[_0x7196('0xf')][_0x7196('0xc')](this));ami['on']('agentringnoanswer',this['syncAgentRingNoAnswer'][_0x7196('0xc')](this));ami['on'](_0x7196('0x10'),this[_0x7196('0x11')][_0x7196('0xc')](this));ami['on'](_0x7196('0x12'),this[_0x7196('0x13')][_0x7196('0xc')](this));ami['on'](_0x7196('0x14'),this[_0x7196('0x15')][_0x7196('0xc')](this));}function getDiff(_0x154101){var _0x4e8c4c=moment()[_0x7196('0x16')](0x0);var _0x3feccd=moment(_0x154101)[_0x7196('0x16')](0x0);return _0x4e8c4c[_0x7196('0x17')](_0x3feccd,'seconds');}Acw[_0x7196('0x18')]['updateAcw']=function(_0xe32933,_0x2590a6){var _0xf7e97=this;var _0x3ed1ad=getDiff(_0xf7e97[_0x7196('0x8')][_0xe32933][_0x7196('0x19')]);clearTimeout(_0xf7e97[_0x7196('0x8')][_0xe32933][_0x7196('0x1a')]);_0xf7e97[_0x7196('0x8')][_0xe32933][_0x7196('0x1a')]=![];return RpcVoiceAgentReport[_0x7196('0x1b')]({'acwtime':_0x3ed1ad},_0xf7e97['timers'][_0xe32933]['uniqueid'],_0xe32933)[_0x7196('0x1c')](function(_0x26b447){logger[_0x7196('0x1d')]('[%s][UPDATE][ACWTIME:%s]',_0x2590a6,_0x3ed1ad,_0x26b447);})[_0x7196('0x1e')](function(_0x539d8b){logger['error'](_0x7196('0x1f'),_0x2590a6,_0x539d8b);})[_0x7196('0x20')](function(){delete _0xf7e97[_0x7196('0x8')][_0xe32933];});};Acw['prototype']['startAcw']=function(_0x38d291){try{var _0x3cd8ff=this;var _0x598a26=this[_0x7196('0x9')][_0x38d291][_0x7196('0x21')];var _0x6e22e5=this[_0x7196('0x9')][_0x38d291][_0x7196('0x22')];var _0x549f34=this[_0x7196('0x6')][_0x6e22e5];var _0x520d01=![];var _0x3ce9a0=_0x7196('0x23');if(_0x549f34[_0x7196('0x24')]&&_0x549f34[_0x7196('0x25')][_0x7196('0x26')]){_0x520d01=!![];_0x3ce9a0=_0x549f34[_0x7196('0x25')]['name'];}if(!_0x3cd8ff['agents'][_0x598a26]){return Promise[_0x7196('0x27')]();}return RpcUser[_0x7196('0x28')](_0x3cd8ff[_0x7196('0x7')][_0x598a26]['id'])['then'](function(_0x5aa538){if(!_0x5aa538||_0x5aa538[_0x7196('0x29')]){logger[_0x7196('0x1d')](_0x7196('0x2a'),_0x38d291,_0x598a26,_0x6e22e5);return;}logger['info'](_0x7196('0x2b'),_0x38d291,_0x598a26,_0x6e22e5);var _0x4ecea1=_0x3cd8ff[_0x7196('0x9')][_0x38d291]['attended']&&_0x3cd8ff[_0x7196('0x9')][_0x38d291][_0x7196('0x2c')]?_0x3cd8ff[_0x7196('0x9')][_0x38d291]['destlinkedid']:_0x38d291;return RpcUser[_0x7196('0x2d')](_0x3cd8ff[_0x7196('0x7')][_0x598a26],_0x3ce9a0,_0x4ecea1);})[_0x7196('0x1c')](function(_0xf999e9){if(_0x520d01||!_0xf999e9){return;}_0x3cd8ff['timers'][_0x598a26]={};logger[_0x7196('0x1d')](_0x7196('0x2e'),_0x38d291,_0x3cd8ff[_0x7196('0x6')][_0x6e22e5][_0x7196('0x2f')],_0x598a26,_0x6e22e5);_0x3cd8ff[_0x7196('0x8')][_0x598a26][_0x7196('0x1a')]=setTimeout(_0x3cd8ff[_0x7196('0x30')][_0x7196('0xc')](_0x3cd8ff,_0x598a26),_0x3cd8ff[_0x7196('0x6')][_0x6e22e5][_0x7196('0x2f')]*0x3e8);_0x3cd8ff[_0x7196('0x8')][_0x598a26]['lastPauseAt']=moment()[_0x7196('0x31')]('YYYY-MM-DD\x20HH:mm:ss');_0x3cd8ff[_0x7196('0x8')][_0x598a26]['uniqueid']=_0x38d291;_0x3cd8ff[_0x7196('0x8')][_0x598a26][_0x7196('0x22')]=_0x6e22e5;_0x3cd8ff['timers'][_0x598a26][_0x7196('0x32')]=_0x3cd8ff[_0x7196('0x32')][_0x7196('0xc')](_0x3cd8ff,_0x598a26,_0x38d291);})[_0x7196('0x1e')](function(){logger[_0x7196('0x33')]('[%s][TIMER:%s][AGENT:%s][QUEUE:%s]',_0x38d291,_0x3cd8ff[_0x7196('0x6')][_0x6e22e5][_0x7196('0x2f')],_0x598a26,_0x6e22e5);})[_0x7196('0x20')](function(){delete _0x3cd8ff[_0x7196('0x9')][_0x38d291];});}catch(_0x3e8f98){logger[_0x7196('0x33')]('[ACW][START]\x20%s',_0x3e8f98[_0x7196('0x34')]);}};Acw[_0x7196('0x18')][_0x7196('0x30')]=function(_0x4f6b27){try{var _0x33831a=this;if(_0x33831a[_0x7196('0x8')][_0x4f6b27]){_0x33831a[_0x7196('0x8')][_0x4f6b27][_0x7196('0x1a')]=![];var _0x11d4ec=_0x33831a[_0x7196('0x8')][_0x4f6b27][_0x7196('0x35')];var _0x1ab720=_0x33831a[_0x7196('0x8')][_0x4f6b27][_0x7196('0x22')];var _0x5354d3=_0x33831a[_0x7196('0x6')][_0x1ab720][_0x7196('0x2f')];logger['info'](_0x7196('0x36'),_0x11d4ec,_0x4f6b27);RpcUser['saveUnpause'](this['agents'][_0x4f6b27]);RpcVoiceAgentReport[_0x7196('0x1b')]({'acwtime':_0x5354d3,'agentacw':!![]},_0x11d4ec,_0x4f6b27)[_0x7196('0x1c')](function(_0x4d03c9){logger['info'](_0x7196('0x37'),_0x11d4ec,_0x5354d3,_0x4d03c9);})[_0x7196('0x1e')](function(_0xed32cd){logger['error'](_0x7196('0x1f'),_0x11d4ec,_0xed32cd);});}else{logger[_0x7196('0x33')](_0x7196('0x38'),_0x4f6b27);if(_0x33831a[_0x7196('0x8')]){logger[_0x7196('0x1d')](_0x7196('0x39'),JSON[_0x7196('0x3a')](_0x33831a[_0x7196('0x8')]));}}}catch(_0x5cd903){logger[_0x7196('0x33')](_0x7196('0x3b'),_0x5cd903['message']);}};Acw[_0x7196('0x18')][_0x7196('0xb')]=function(_0x48178f){try{if(this[_0x7196('0x6')][_0x48178f[_0x7196('0x22')]]&&(this[_0x7196('0x6')][_0x48178f['queue']][_0x7196('0x3')]||this[_0x7196('0x6')][_0x48178f['queue']][_0x7196('0x24')])){if(this[_0x7196('0x7')][_0x48178f['interface']]){this[_0x7196('0x9')][_0x48178f['uniqueid']]={'queue':_0x48178f['queue'],'interface':_0x48178f['interface'],'destlinkedid':_0x48178f['destlinkedid']};}}}catch(_0x57060a){logger[_0x7196('0x33')]('[ACW][syncAgentConnect]\x20%s',_0x57060a[_0x7196('0x34')]);}};Acw[_0x7196('0x18')][_0x7196('0x15')]=function(_0x6766b8){try{if(this['voiceQueues'][_0x6766b8[_0x7196('0x22')]]&&(this['voiceQueues'][_0x6766b8[_0x7196('0x22')]][_0x7196('0x3')]||this[_0x7196('0x6')][_0x6766b8['queue']][_0x7196('0x24')])){if(this[_0x7196('0x7')][_0x6766b8[_0x7196('0x21')]]){this['channels'][_0x6766b8['uniqueid']]={'queue':_0x6766b8[_0x7196('0x22')],'interface':_0x6766b8['interface']};}}}catch(_0x29c7e8){logger['error']('[ACW][syncAgentConnectPreview]\x20%s',_0x29c7e8[_0x7196('0x34')]);}};Acw['prototype']['syncHangupRequest']=function(_0x516825){try{if(this[_0x7196('0x9')][_0x516825['uniqueid']]&&_['isUndefined'](this[_0x7196('0x9')][_0x516825[_0x7196('0x35')]][_0x7196('0x3c')])){logger[_0x7196('0x1d')]('[%s][HANGUP:UNIQUEID]',_0x516825[_0x7196('0x35')]);this['startAcw'](_0x516825[_0x7196('0x35')]);}else if(this[_0x7196('0x9')][_0x516825['linkedid']]&&_[_0x7196('0x3d')](this[_0x7196('0x9')][_0x516825[_0x7196('0x3e')]]['attended'])){logger[_0x7196('0x1d')]('[%s][HANGUP:LINKEDID]',_0x516825[_0x7196('0x3e')]);this[_0x7196('0x3f')](_0x516825[_0x7196('0x3e')]);}}catch(_0x1fd83f){logger[_0x7196('0x33')](_0x7196('0x40'),_0x1fd83f[_0x7196('0x34')]);}};Acw[_0x7196('0x18')]['syncHangup']=function(_0x54f39d){try{if(this[_0x7196('0x9')][_0x54f39d[_0x7196('0x35')]]&&this[_0x7196('0x9')][_0x54f39d[_0x7196('0x35')]]['attended']){logger[_0x7196('0x1d')](_0x7196('0x41'),_0x54f39d[_0x7196('0x35')]);this[_0x7196('0x3f')](_0x54f39d[_0x7196('0x35')]);}else if(this[_0x7196('0x9')][_0x54f39d[_0x7196('0x3e')]]&&this[_0x7196('0x9')][_0x54f39d[_0x7196('0x3e')]][_0x7196('0x3c')]){logger[_0x7196('0x1d')]('[%s][HANGUPATTENDEDTRANSFER:LINKEDID]',_0x54f39d[_0x7196('0x3e')]);this[_0x7196('0x3f')](_0x54f39d[_0x7196('0x3e')]);}}catch(_0x48f196){logger[_0x7196('0x33')]('[ACW][syncHangup]\x20%s',_0x48f196[_0x7196('0x34')]);}};Acw[_0x7196('0x18')][_0x7196('0x11')]=function(_0x3e74ef){try{if(!_[_0x7196('0x42')](this['channels'][_0x3e74ef[_0x7196('0x43')]])){this['startAcw'](_0x3e74ef['transfereeuniqueid']);if(this['channels'][_0x3e74ef[_0x7196('0x44')]]){this[_0x7196('0x9')][_0x3e74ef[_0x7196('0x44')]][_0x7196('0x3c')]=!![];this[_0x7196('0x9')][_0x3e74ef[_0x7196('0x45')]]=this[_0x7196('0x9')][_0x3e74ef['secondtransfereruniqueid']];delete this[_0x7196('0x9')][_0x3e74ef[_0x7196('0x44')]];}}else if(!_[_0x7196('0x42')](this[_0x7196('0x9')][_0x3e74ef[_0x7196('0x45')]])){this['startAcw'](_0x3e74ef['transfertargetuniqueid']);if(this[_0x7196('0x9')][_0x3e74ef[_0x7196('0x46')]]){this[_0x7196('0x9')][_0x3e74ef[_0x7196('0x46')]][_0x7196('0x3c')]=!![];this[_0x7196('0x9')][_0x3e74ef[_0x7196('0x43')]]=this[_0x7196('0x9')][_0x3e74ef[_0x7196('0x46')]];delete this[_0x7196('0x9')][_0x3e74ef[_0x7196('0x46')]];}}}catch(_0x57d729){logger[_0x7196('0x33')](_0x7196('0x47'),_0x57d729[_0x7196('0x34')]);}};Acw[_0x7196('0x18')]['syncBlindTransfer']=function(_0x4bd0f3){try{if(this[_0x7196('0x9')][_0x4bd0f3[_0x7196('0x48')]]){logger[_0x7196('0x1d')](_0x7196('0x49'),JSON[_0x7196('0x3a')](_0x4bd0f3[_0x7196('0x48')]));this['startAcw'](_0x4bd0f3[_0x7196('0x48')]);}else if(this[_0x7196('0x9')][_0x4bd0f3[_0x7196('0x4a')]]){logger[_0x7196('0x1d')]('[%s][BLINDTRANSFER:LINKEDID]',JSON[_0x7196('0x3a')](_0x4bd0f3[_0x7196('0x4a')]));this[_0x7196('0x3f')](_0x4bd0f3[_0x7196('0x4a')]);}}catch(_0x4673e9){logger[_0x7196('0x33')](_0x7196('0x4b'),_0x4673e9['message']);}};Acw['prototype']['syncAgentRingNoAnswer']=function(_0x72f6f1){try{if(this['voiceQueues'][_0x72f6f1[_0x7196('0x22')]]&&this[_0x7196('0x6')][_0x72f6f1[_0x7196('0x22')]][_0x7196('0x4c')]===_0x7196('0x4d')){if(this[_0x7196('0x7')][_0x72f6f1[_0x7196('0x21')]]){logger[_0x7196('0x1d')](_0x7196('0x4e'),_0x72f6f1['uniqueid'],_0x72f6f1['interface'],_0x72f6f1[_0x7196('0x22')]);return RpcUser[_0x7196('0x2d')](this[_0x7196('0x7')][_0x72f6f1[_0x7196('0x21')]],_0x7196('0x4f'),_0x72f6f1[_0x7196('0x35')]);}}}catch(_0xa55f4b){logger[_0x7196('0x33')]('[ACW][syncAgentRingNoAnswer]\x20%s',_0xa55f4b['message']);}};module[_0x7196('0x50')]=Acw; \ No newline at end of file diff --git a/server/services/ami/ami.js b/server/services/ami/ami.js index 6cf6c65..893e613 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 _0xbd5e=['Fullybooted\x20\x22%s\x22\x20to\x20%s:%s','resolve','then','actionSipShowRegistry','catch','[ami.js][fullybooted]','asterisk-manager','bluebird','util','../../config/logger','ami','../../config/environment','asterisk','port','username','password','Action','promisify','action','error','format','Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s','sipshowregistry','actionDeviceStateList','devicestatelist','actionSipPeerStatus','sippeerstatus','actionQueueSummary','queuesummary','actionCoreShowChannels','coreshowchannels','once','close','connect','shutdown','info','Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s','inspect','fullybooted'];(function(_0x89894b,_0xa075f5){var _0x3dd5a7=function(_0xb43319){while(--_0xb43319){_0x89894b['push'](_0x89894b['shift']());}};_0x3dd5a7(++_0xa075f5);}(_0xbd5e,0xf6));var _0xebd5=function(_0x15469f,_0xb86ad7){_0x15469f=_0x15469f-0x0;var _0x1c5f58=_0xbd5e[_0x15469f];return _0x1c5f58;};'use strict';var Manager=require(_0xebd5('0x0'));var BPromise=require(_0xebd5('0x1'));var util=require(_0xebd5('0x2'));var logger=require(_0xebd5('0x3'))(_0xebd5('0x4'));var config=require(_0xebd5('0x5'));var ami=new Manager(config[_0xebd5('0x6')][_0xebd5('0x7')],config[_0xebd5('0x6')]['ip'],config[_0xebd5('0x6')][_0xebd5('0x8')],config[_0xebd5('0x6')][_0xebd5('0x9')],!![]);ami['keepConnected']();ami[_0xebd5('0xa')]=BPromise[_0xebd5('0xb')](ami[_0xebd5('0xc')]);function error(_0x17da9c){logger[_0xebd5('0xd')](util[_0xebd5('0xe')](_0xebd5('0xf'),config[_0xebd5('0x6')][_0xebd5('0x8')],config[_0xebd5('0x6')]['ip'],config[_0xebd5('0x6')]['port'],util['inspect'](_0x17da9c,![],null)));}function close(){logger['error'](util['format'](_0xebd5('0x10'),config['asterisk'][_0xebd5('0x8')],config[_0xebd5('0x6')]['ip'],config[_0xebd5('0x6')][_0xebd5('0x7')]));}ami['actionSipShowRegistry']=function(){return function(){return ami[_0xebd5('0xa')]({'action':_0xebd5('0x11')});};};ami[_0xebd5('0x12')]=function(){return function(){return ami[_0xebd5('0xa')]({'action':_0xebd5('0x13')});};};ami[_0xebd5('0x14')]=function(){return function(){return ami['Action']({'action':_0xebd5('0x15')});};};ami[_0xebd5('0x16')]=function(){return function(){return ami['Action']({'action':_0xebd5('0x17')});};};ami[_0xebd5('0x18')]=function(){return function(){return ami[_0xebd5('0xa')]({'action':_0xebd5('0x19')});};};function connect(){logger['info'](util[_0xebd5('0xe')]('Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s',config[_0xebd5('0x6')][_0xebd5('0x8')],config[_0xebd5('0x6')]['ip'],config[_0xebd5('0x6')][_0xebd5('0x7')]));ami[_0xebd5('0x1a')]('error',error);ami['once'](_0xebd5('0x1b'),close);}ami['on'](_0xebd5('0x1c'),connect);ami['on'](_0xebd5('0x1d'),function(_0x499f9a){logger[_0xebd5('0x1e')](util[_0xebd5('0xe')](_0xebd5('0x1f'),config[_0xebd5('0x6')]['username'],config[_0xebd5('0x6')]['ip'],config[_0xebd5('0x6')][_0xebd5('0x7')],util[_0xebd5('0x20')](_0x499f9a,![],null)));});ami['on'](_0xebd5('0x21'),function(){logger[_0xebd5('0x1e')](util[_0xebd5('0xe')](_0xebd5('0x22'),config[_0xebd5('0x6')]['username'],config[_0xebd5('0x6')]['ip'],config['asterisk'][_0xebd5('0x7')]));return Promise[_0xebd5('0x23')]()[_0xebd5('0x24')](ami[_0xebd5('0x25')]())[_0xebd5('0x24')](ami['actionDeviceStateList']())[_0xebd5('0x24')](ami['actionSipPeerStatus']())[_0xebd5('0x24')](ami[_0xebd5('0x16')]())[_0xebd5('0x24')](ami[_0xebd5('0x18')]())[_0xebd5('0x26')](function(_0x5c989d){logger[_0xebd5('0xd')](_0xebd5('0x27'),util['inspect'](_0x5c989d,{'showHidden':![],'depth':null}));});});ami[_0xebd5('0x1a')]('error',error);ami[_0xebd5('0x1a')](_0xebd5('0x1b'),close);module['exports']=ami; \ No newline at end of file +var _0x5b95=['Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s','actionSipShowRegistry','sipshowregistry','devicestatelist','sippeerstatus','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','resolve','then','actionDeviceStateList','actionSipPeerStatus','catch','[ami.js][fullybooted]','exports','asterisk-manager','bluebird','util','../../config/logger','ami','../../config/environment','asterisk','port','password','Action','promisify','action','error','format','Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','username','inspect'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5b95,0xb7));var _0x55b9=function(_0x525c7b,_0x488fcc){_0x525c7b=_0x525c7b-0x0;var _0x27b33e=_0x5b95[_0x525c7b];return _0x27b33e;};'use strict';var Manager=require(_0x55b9('0x0'));var BPromise=require(_0x55b9('0x1'));var util=require(_0x55b9('0x2'));var logger=require(_0x55b9('0x3'))(_0x55b9('0x4'));var config=require(_0x55b9('0x5'));var ami=new Manager(config[_0x55b9('0x6')][_0x55b9('0x7')],config[_0x55b9('0x6')]['ip'],config[_0x55b9('0x6')]['username'],config[_0x55b9('0x6')][_0x55b9('0x8')],!![]);ami['keepConnected']();ami[_0x55b9('0x9')]=BPromise[_0x55b9('0xa')](ami[_0x55b9('0xb')]);function error(_0x5f1d7d){logger[_0x55b9('0xc')](util[_0x55b9('0xd')](_0x55b9('0xe'),config[_0x55b9('0x6')][_0x55b9('0xf')],config[_0x55b9('0x6')]['ip'],config[_0x55b9('0x6')][_0x55b9('0x7')],util[_0x55b9('0x10')](_0x5f1d7d,![],null)));}function close(){logger[_0x55b9('0xc')](util['format'](_0x55b9('0x11'),config[_0x55b9('0x6')][_0x55b9('0xf')],config['asterisk']['ip'],config[_0x55b9('0x6')]['port']));}ami[_0x55b9('0x12')]=function(){return function(){return ami['Action']({'action':_0x55b9('0x13')});};};ami['actionDeviceStateList']=function(){return function(){return ami[_0x55b9('0x9')]({'action':_0x55b9('0x14')});};};ami['actionSipPeerStatus']=function(){return function(){return ami[_0x55b9('0x9')]({'action':_0x55b9('0x15')});};};ami['actionQueueSummary']=function(){return function(){return ami['Action']({'action':_0x55b9('0x16')});};};ami[_0x55b9('0x17')]=function(){return function(){return ami[_0x55b9('0x9')]({'action':_0x55b9('0x18')});};};function connect(){logger[_0x55b9('0x19')](util[_0x55b9('0xd')](_0x55b9('0x1a'),config['asterisk'][_0x55b9('0xf')],config[_0x55b9('0x6')]['ip'],config[_0x55b9('0x6')][_0x55b9('0x7')]));ami[_0x55b9('0x1b')](_0x55b9('0xc'),error);ami['once'](_0x55b9('0x1c'),close);}ami['on'](_0x55b9('0x1d'),connect);ami['on'](_0x55b9('0x1e'),function(_0x149e63){logger['info'](util[_0x55b9('0xd')](_0x55b9('0x1f'),config['asterisk']['username'],config[_0x55b9('0x6')]['ip'],config['asterisk'][_0x55b9('0x7')],util['inspect'](_0x149e63,![],null)));});ami['on'](_0x55b9('0x20'),function(){logger['info'](util['format']('Fullybooted\x20\x22%s\x22\x20to\x20%s:%s',config[_0x55b9('0x6')][_0x55b9('0xf')],config[_0x55b9('0x6')]['ip'],config[_0x55b9('0x6')][_0x55b9('0x7')]));return Promise[_0x55b9('0x21')]()[_0x55b9('0x22')](ami[_0x55b9('0x12')]())['then'](ami[_0x55b9('0x23')]())[_0x55b9('0x22')](ami[_0x55b9('0x24')]())[_0x55b9('0x22')](ami['actionQueueSummary']())[_0x55b9('0x22')](ami[_0x55b9('0x17')]())[_0x55b9('0x25')](function(_0x4bc74b){logger[_0x55b9('0xc')](_0x55b9('0x26'),util[_0x55b9('0x10')](_0x4bc74b,{'showHidden':![],'depth':null}));});});ami[_0x55b9('0x1b')](_0x55b9('0xc'),error);ami[_0x55b9('0x1b')](_0x55b9('0x1c'),close);module[_0x55b9('0x27')]=ami; \ No newline at end of file diff --git a/server/services/ami/client.js b/server/services/ami/client.js index ca3f335..601928e 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 _0xcb91=['request','debug','memberReport','error','rpc','message','result','catch','exports','../../config/logger','ami','client','http'];(function(_0xd7b0a4,_0x53c7d3){var _0x184e9e=function(_0x325bbd){while(--_0x325bbd){_0xd7b0a4['push'](_0xd7b0a4['shift']());}};_0x184e9e(++_0x53c7d3);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x3b0912,_0x39d739){_0x3b0912=_0x3b0912-0x0;var _0xa8f339=_0xcb91[_0x3b0912];return _0xa8f339;};'use strict';var jayson=require('jayson/promise');var BPromise=require('bluebird');var logger=require(_0x1cb9('0x0'))(_0x1cb9('0x1'));var client=jayson[_0x1cb9('0x2')][_0x1cb9('0x3')]({'port':0x2329});client['Request']=function(_0x8c392f,_0x2c17b8){return new BPromise(function(_0x545a34,_0x13d5fd){return client[_0x1cb9('0x4')](_0x8c392f,_0x2c17b8)['then'](function(_0x226b69){logger[_0x1cb9('0x5')]('rpc',_0x1cb9('0x6'),_0x8c392f,_0x2c17b8,_0x226b69);if(_0x226b69[_0x1cb9('0x7')]){logger['error'](_0x1cb9('0x8'),'memberReport',_0x8c392f,_0x226b69['error'][_0x1cb9('0x9')],_0x2c17b8);return _0x13d5fd(_0x226b69[_0x1cb9('0x7')][_0x1cb9('0x9')]);}else{return _0x545a34(_0x226b69[_0x1cb9('0xa')]);}})[_0x1cb9('0xb')](function(_0x50ce71){logger[_0x1cb9('0x7')](_0x1cb9('0x8'),_0x1cb9('0x6'),_0x8c392f,_0x50ce71,_0x2c17b8);return _0x13d5fd(_0x50ce71);});});};module[_0x1cb9('0xc')]=client; \ No newline at end of file +var _0x70e0=['catch','exports','jayson/promise','bluebird','../../config/logger','http','Request','then','memberReport','error','rpc','message','result'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x70e0,0x17b));var _0x070e=function(_0x38cd2f,_0x2f1d44){_0x38cd2f=_0x38cd2f-0x0;var _0x41fab3=_0x70e0[_0x38cd2f];return _0x41fab3;};'use strict';var jayson=require(_0x070e('0x0'));var BPromise=require(_0x070e('0x1'));var logger=require(_0x070e('0x2'))('ami');var client=jayson['client'][_0x070e('0x3')]({'port':0x2329});client[_0x070e('0x4')]=function(_0x277d32,_0x2593e5){return new BPromise(function(_0x5c90fc,_0x7bce9b){return client['request'](_0x277d32,_0x2593e5)[_0x070e('0x5')](function(_0x4b041d){logger['debug']('rpc',_0x070e('0x6'),_0x277d32,_0x2593e5,_0x4b041d);if(_0x4b041d[_0x070e('0x7')]){logger[_0x070e('0x7')](_0x070e('0x8'),_0x070e('0x6'),_0x277d32,_0x4b041d[_0x070e('0x7')][_0x070e('0x9')],_0x2593e5);return _0x7bce9b(_0x4b041d['error']['message']);}else{return _0x5c90fc(_0x4b041d[_0x070e('0xa')]);}})[_0x070e('0xb')](function(_0x12bb37){logger[_0x070e('0x7')](_0x070e('0x8'),_0x070e('0x6'),_0x277d32,_0x12bb37,_0x2593e5);return _0x7bce9b(_0x12bb37);});});};module[_0x070e('0xc')]=client; \ No newline at end of file diff --git a/server/services/ami/dialer/index.js b/server/services/ami/dialer/index.js index 6d26dc2..57bad3d 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 _0x6fef=['dialAMDActive','value','HANGUP','outboundAnswerCallsDay','HangupInAMD','membername','AMD','emit','custom:amd','buildObj','saveInDb','[syncHangupInAMD][createHistory]','outboundAnswerAgiCallsDay','countmachineretry','amd','[syncAgentComplete][createHistory][0]','countbusyretry','countnoanswerretry','countnosuchnumberretry','countagentrejectretry','dialGlobalMaxRetry','stateGlobal','reason19\x20machine....','dialMachineMaxRetry','createStateFinal','dialMachineRetryFrequency','[rescheduleContact][Machine]','[syncHangupInAMDIvr]','MACHINE','Machine','countcongestionretry','reason\x2019\x20machine....','ivrAnswerCallsDay','[syncHangupIvr][createHistory]','[syncHangupIvr]','dialQueueProject','AnswerAGI','AGI','cause-txt','running','isPreviewCampaign','statusMessage','getQueueCampaignStatusMessage','resolve','available','inUse','talking','pTalking','ACTIVE','[syncQueueSummary]','compareToOutboundQueue','queueSummaryCountersUpdated','updateReportFromOutboundQueue','assign','throttle','filter','online','handlePreviewRecallNotifications','map','Agent','user:%s','user:dialPreviewRecallReminder','checkPreviewRecallReminder','loopClearZombieChannels','[uniqueid]','clearZombieChannels','[actions]','Action','No\x20such\x20channel','[Dialer][checkChannel]','getVoiceQueueRtPauses','[getVoiceQueueRtPauses]\x20','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','loggerHandler','emptyContact','notFound','[emptyContact][createHistory]','[syncQueueCallerAbandon]\x20[Drop]','handleIvr','object','originate','voiceQueue\x20is\x20undefine','phone','contact\x20is\x20undefine','getCaller','\x22agi://%s/square,%s\x22','NONE','isOutboundQueue','\x22%s,%s%s,,,%s\x22','dialQueueOptions','dialAMDInitialSilence','dialAMDGreeting','XMD-AMDAFTERGREETINGSILENCE','dialAMDAfterGreetingSilence','XMD-AMDTOTALANALYSISTIME','dialAMDTotalAnalysisTime','XMD-AMDMINWORDLENGTH','dialAMDMinWordLength','XMD-AMDBETWEENWORDSSILENCE','dialAMDBetweenWordsSilence','XMD-AMDMAXIMUMNUMBEROFWORDS','XMD-AMDSILENCETHRESHOLD','dialAMDSilenceThreshold','dialAMDMaximumWordLength','setXMDContactVariables','Trunk','getCallerId','callerid','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','dialOriginateCallerIdNumber','originatecalleridname','XMD-ORIGINATECALLERIDNUM','variables','dialPrefix','trim','substring','SIP/%s/%s%s','dialCutDigit','dialOriginateTimeout','outboundOriginateFailureCallsDay','[originateError]:\x20%s','OriginateError','[originate][error]','originate\x20action\x20Error','checkRetriveMax','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialBusyMaxRetry','[rescheduleContact]\x20[Busy]','dialCongestionMaxRetry','dialCongestionRetryFrequency','[rescheduleContact]\x20[Congestion]','[rescheduleContact][NoSuchNumber]','dialAgentRejectRetryFrequency','[rescheduleContact][AgentReject]','[callProgressDetecting]','evt\x20is\x20undefine','outboundNoSuchCallsDay','NoSuchNumber','custom:agentnosuchnumber','nosuchnumber','dialNoSuchNumberMaxRetry','reason\x200\x20no\x20such\x20number....','outboundNoAnswerCallsDay','NoAnswer','buildNoAnswerEventPayload','custom:agentnoanswer','reason\x203\x20ringing\x20no\x20answer','outboundBusyCallsDay','Busy','custom:agentbusy','busy','dialBusyRetryFrequency','[syncAgentComplete][createHistory][5]','reason\x205\x20busy','outboundCongestionCallsDay','Congestion','congestion','[syncAgentComplete][createHistory][8]','reason\x208\x20congestion','outboundAbandonedCallsDay','reason\x2011\x20abandoned','AgentReject','custom:agentreject','agentreject','[syncAgentComplete][createHistory][20]','reason\x2020\x20agentreject','outboundUnknownCallsDay','[syncAgentComplete][createHistory][?]','Global','contact\x20not\x20moved','dialPredictiveOptimizationPercentage','outboundDropCallsDayTimeout','round','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','floor','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','[startMethodPredictive][StartProgressive]','check\x20predictive\x20is\x20not\x20undefine','check\x20handlePredictive\x20is\x20not\x20undefine','collection\x20data\x20in\x20progressive\x20at','dialPredictiveInterval','[startMethodPredictive][StartProgressive][Loop]','dropRate','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','dialPredictiveOptimization','Drop\x20in\x20this\x20interval','started\x20in\x20predictive\x20at','getDataPredictive','Predictive\x20after\x20first\x20interval','recalculate\x20predictive\x20at','avgHandleTime','Predictive\x20for\x20every\x20interval',')\x20are\x20less\x20than\x20threshold\x20(','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20more\x20than\x20threshold\x20(','abandonmentRate','agentBusyFactor','busyFactor','[getDataPredictive]','Unknown\x20Predictive','getDataPredictiveOld','loggedIn','outboundQueuePauses','[CatchErlangB]','predictiveIntervalPauses','check\x20failure','startMethodPredictive','one\x20call\x20every:','milliseconds','[handlePredictive]','fail\x20to\x20scheduled\x20calls','checkContactBlack','UserId','queueStatusComplete:\x20','queuestatus','[booked][checkContactBlack][else]','Queue:\x20','[unlockOriginate][syncQueueStatusComplete]','actionOriginate','getSeconds','scheduledat','dialRecallMeTimeout','voicePause','outboundReCallsDay','dialRecallInQueue','[rescheduleContact][dialRecallInQueue]','QUEUE_RECALL','[Originate][HistoryDialRecallInQueue][historyCatch]','RecallFailedTimeout','outboundBlacklistCallsDay','BLACKLIST','[Originate][historyBlacklist]','[Originate][MoveBlacklist]','inBlackList','limitCalls','temp','checkContactEmpty','RUNNING','ivrTotalCallsDays','Contact','[actionOriginate]\x20','checkIsBlackListIvr','[actionOriginateIvr]\x20','[getContactCampaign2]','getContactDialer','countReScheduled','[countReScheduled]\x20','checkIsBlackList','[getContactDialer2]','dialLimitQueue','tryOriginatePredictive','not_inuse','dialOrderByScheduledAt','[actionOriginatePredictive]\x20','[getContactDialerPredictive]','--------\x20Drop\x20Rate\x20--------','M:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[abandonmentRate]','m\x20=\x20','Ts\x20=\x20','p\x20=\x20','Amax\x20=\x20','erlangb','----\x20Agent\x20Busy\x20Factor\x20----','Ts:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','P:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[busyFactor]','Umin\x20=\x20','exports','util','lodash','uuid','moment','ioredis','./utils','./utils/hopper','../../../config/environment/','../../../config/logger','booked','predictive','predictiveCalls','../ami','defaults','redis','localhost','socket.io-emitter','../rpc/setting','../rpc/interval','./models/action','./models/hangup','env','XCALLY_IP_AGI','prototype','enqueue','tail','finally','sequence','preview','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','channels','actions','contactsId','uniqueId','optionPredictive','startProgressive','ivrOriginated','queueBooked','queueBookedRR','queuesSummary','bind','syncQueueCallerAbandon','originateresponse','agentcomplete','syncAgentComplete','custom:queuesummary','syncQueueSummary','custom:queuesummarycomplete','syncQueueSummaryComplete','syncHangup','syncNewExten','varset','syncVarSet','queuemember','syncQueueMember','queuestatuscomplete','loopCampaigns','getSettings','then','previewRecallmeReminderInterval','isUndefined','type','outbound','debug','[voiceQueueReport][queuesummary]\x20sending\x20voice_queue:save\x20event:','inspect','format','voice:queue:%s','name','voice_queue:save','isEmpty','info','-----\x20Stats\x20Predictive\x20---','Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalTotalCalls','Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAnsweredCalls','Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalDroppedCallsTimeout','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgHoldtime','AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','---------------------------','predictiveIntervalAvgTalktime','Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive','---------\x20ErlangB\x20---------','Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangCalls','One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangCallToSecond','Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangAbandonmentRate','Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangBusyFactor','merge','startPredictive','startPredictive\x20value\x20cleared','handlePredictive','error','checkContactLowerLimitOriginate','contactsRescheduled','message','CAMPAIGN_STATUS','CONTACTS_RESCHEDULED','[getContactDialer2][ReScheduled]','NO_AVAILABLE_CONTACTS','state','statedesc','endtime','starttime','queueStatusComplete','[unlockQueueStatus][undefined]','[booked][unlockQueueStatus]','stringify','\x20INTERVAL_IS_NULL','Interval','Intervals','NULL_INTERVAL','isIVRCampaignActive','INACTIVE','isIVRCampaign','campaign:ivr:%s','originated','sendMessageOneNotActive','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','is\x20not\x20active','DISACTIVED','is\x20disactive','[ifTime][Action]','Error','isTrunkReachable','active','SIP/%s','status','reachable','checkIsTrunkReachable','TrunkBackup','TRUNK_NOT_REACHABLE','checkIfTime','ifTimeIvr','checkIfTimeIntervals','ifTime','Failure','\x20Intervals\x20is\x20null\x20','EMPTY_INTERVAL','timezones','UNKNOWN_TIMEZONE','\x20Timezone\x20unknow\x20','isArray','length','push','command','iftime\x20%s,%s','interval','content','catch','indexOf','true','all','some','OVERTIME_GLOBAL_INTERVAL','OVERTIME_INTERVAL','[ifTime][promiseAll]','\x20Interval\x20is\x20overtime:\x20','Timezone:\x20','resetActiveCalls','syncCampaigns','undefined','[syncCampaigns]','checkDialMethod','dialMethod','handlePower','dialPowerLevel','Queue','method\x20not\x20recognized','dialTimezone','dialGlobalInterval','silly','intervalIftime','isGlobal','AMI\x20IfTime','syncAgentConnect','queue','uniqueid','ivr','updateOriginated','YYYY-MM-DD\x20HH:mm:ss','reason','agent','dialQueueProject2','dialAgiAfterHangupAgent','createHistory','[syncAgentComplete][createHistory]','moveContactManagedDialer','[syncAgentComplete]','droptime','responsetime','dialQueueTimeout','predictiveIntervalErlangCallsDroppedCalls','Drop','dropreason','TIMEOUT','agiafterat','countglobal','dialDropRetryFrequency','callAdditionalPhoneAfterMin','verifyAdditionalPhones','voiceQueue','additional','dialDropMaxRetry','queueCallerAbandonCreateState','rescheduleContact','countdropretry','minutes','ContactId','ListId','VoiceQueueId','CampaignId','[rescheduleContact][Drop]','calleridname','calleridnum','[syncAgentComplete][createHistory][10]','swapAdditionalPhones','Abandoned','countabandonedretry','dialAbandonedRetryFrequency','dialAbandonedMaxRetry','add','[rescheduleContact][Abandoned]','[syncAgentComplete][createHistory][11]','channel','rrmemory','roundrobin','actionid','isNil','paused','stateinterface','locked','pick','idHopper','syncQueueStatusComplete','strategy','[Catch][Preview][syncQueueStatusComplete]','[unlock][syncQueueStatusComplete]','_rr','Agent:\x20','unlockRR','contactAgent-idHopper:\x20','run','[booked][RR][finaly]','[booked][unlock]','[booked][unlock2]','[unlock2][syncQueueStatusComplete]','[booked][unlock3]','[unlock3][syncQueueStatusComplete]','syncOriginateResponse','response','Success','callProgressDetecting','[callProgressDetecting]\x20','variable','amdstatus','exten','xcally-motion-dialer'];(function(_0x542657,_0x58f77d){var _0x5dbdcb=function(_0x46451d){while(--_0x46451d){_0x542657['push'](_0x542657['shift']());}};_0x5dbdcb(++_0x58f77d);}(_0x6fef,0x116));var _0xf6fe=function(_0x5df346,_0xe55672){_0x5df346=_0x5df346-0x0;var _0x5e1119=_0x6fef[_0x5df346];return _0x5e1119;};'use strict';var util=require(_0xf6fe('0x0'));var _=require(_0xf6fe('0x1'));var uuid=require(_0xf6fe('0x2'));var moment=require(_0xf6fe('0x3'));var rr=require('rr');var Redis=require(_0xf6fe('0x4'));var utils=require(_0xf6fe('0x5'));var hopperUtils=require(_0xf6fe('0x6'));var ut=require('../preview/util/util');var config=require(_0xf6fe('0x7'));var logger=require(_0xf6fe('0x8'))('dialer');var loggerBooked=require(_0xf6fe('0x8'))(_0xf6fe('0x9'));var loggerPredictive=require(_0xf6fe('0x8'))(_0xf6fe('0xa'));var loggerPredictiveCalls=require(_0xf6fe('0x8'))(_0xf6fe('0xb'));var loggerSyncQueueSummary=require(_0xf6fe('0x8'))('syncQueueSummary');var ami=require(_0xf6fe('0xc'));config['redis']=_[_0xf6fe('0xd')](config[_0xf6fe('0xe')],{'host':_0xf6fe('0xf'),'port':0x18eb});var io=require(_0xf6fe('0x10'))(new Redis(config[_0xf6fe('0xe')]));var cmHopper=require('../rpc/cmHopper');var voiceQueueRt=require('../rpc/voiceQueueRt');var RpcSetting=require(_0xf6fe('0x11'));var Interval=require(_0xf6fe('0x12'));var Action=require(_0xf6fe('0x13'));var History=require('./models/history');var Final=require('./models/final');var AgentComplete=require('./models/agentComplete');var QueueCallerAbandon=require('./models/queueCallerAbandon');var Hangup=require(_0xf6fe('0x14'));var ipAgi=process[_0xf6fe('0x15')][_0xf6fe('0x16')]||'127.0.0.1';var previewRecallmeReminderInterval=0x1;var Sequence=function(){};Sequence[_0xf6fe('0x17')][_0xf6fe('0x18')]=function(_0x2da878){this[_0xf6fe('0x19')]=this[_0xf6fe('0x19')]?this[_0xf6fe('0x19')][_0xf6fe('0x1a')](_0x2da878):_0x2da878();};function Dialer(_0x176907,_0x19fb37){this[_0xf6fe('0x1b')]=new Sequence();this[_0xf6fe('0x1c')]=_0x19fb37;this[_0xf6fe('0x1d')]=_0x176907['voiceQueues'];this[_0xf6fe('0x1e')]=_0x176907[_0xf6fe('0x1e')];this[_0xf6fe('0x1f')]=_0x176907[_0xf6fe('0x1f')];this[_0xf6fe('0x20')]=_0x176907['trunks'];this[_0xf6fe('0x21')]=config[_0xf6fe('0x21')]||0x2;this[_0xf6fe('0x22')]={};this[_0xf6fe('0x23')]={};this[_0xf6fe('0x24')]={};this[_0xf6fe('0x25')]={};this[_0xf6fe('0x26')]={};this['startPredictive']={};this[_0xf6fe('0x27')]={};this[_0xf6fe('0x28')]={};this[_0xf6fe('0x29')]={};this[_0xf6fe('0x2a')]={};this[_0xf6fe('0x2b')]={};ami['on']('agentconnect',this['syncAgentConnect'][_0xf6fe('0x2c')](this));ami['on']('queuecallerabandon',this[_0xf6fe('0x2d')][_0xf6fe('0x2c')](this));ami['on'](_0xf6fe('0x2e'),this['syncOriginateResponse'][_0xf6fe('0x2c')](this));ami['on'](_0xf6fe('0x2f'),this[_0xf6fe('0x30')]['bind'](this));ami['on'](_0xf6fe('0x31'),this[_0xf6fe('0x32')]['bind'](this));ami['on'](_0xf6fe('0x33'),this[_0xf6fe('0x34')][_0xf6fe('0x2c')](this));ami['on']('hangup',this[_0xf6fe('0x35')][_0xf6fe('0x2c')](this));ami['on']('newexten',this[_0xf6fe('0x36')]['bind'](this));ami['on'](_0xf6fe('0x37'),this[_0xf6fe('0x38')][_0xf6fe('0x2c')](this));ami['on'](_0xf6fe('0x39'),this[_0xf6fe('0x3a')]['bind'](this));ami['on'](_0xf6fe('0x3b'),this['syncQueueStatusComplete'][_0xf6fe('0x2c')](this));this[_0xf6fe('0x3c')]();this['loopClearZombieChannels']();RpcSetting[_0xf6fe('0x3d')]()[_0xf6fe('0x3e')](function(_0x426d5b){previewRecallmeReminderInterval=_0x426d5b[_0xf6fe('0x3f')];});}function isNotNull(_0x22ebfb){return _0x22ebfb!==null&&!_[_0xf6fe('0x40')](_0x22ebfb);}function msgResponse(_0x4cc812,_0x5553f7,_0x36ca2a){return{'action':_0x4cc812,'response':_0x5553f7,'message':_0x36ca2a,'stack':_0x36ca2a};}function emit(_0x44f8ef,_0x2d533b,_0x3949e1){io['to'](_0x44f8ef)['emit'](_0x2d533b,_0x3949e1);}function emitOutboundVoiceQueueSummary(_0x3f4118){if(_0x3f4118[_0xf6fe('0x41')]===_0xf6fe('0x42')){logger[_0xf6fe('0x43')](_0xf6fe('0x44'),util[_0xf6fe('0x45')](_0x3f4118,{'showHidden':![],'depth':null}));emit(util[_0xf6fe('0x46')](_0xf6fe('0x47'),_0x3f4118[_0xf6fe('0x48')]),_0xf6fe('0x49'),_0x3f4118);}}function checkGetDataPredictive(_0x13bdf7){if(isNotNull(_0x13bdf7)&&!_[_0xf6fe('0x4a')](_0x13bdf7)){loggerPredictive[_0xf6fe('0x4b')](_0xf6fe('0x4c'));loggerPredictive[_0xf6fe('0x4b')](_0xf6fe('0x4d'),_0x13bdf7[_0xf6fe('0x4e')]);loggerPredictive['info'](_0xf6fe('0x4f'),_0x13bdf7[_0xf6fe('0x50')]);loggerPredictive['info'](_0xf6fe('0x51'),_0x13bdf7[_0xf6fe('0x52')]);loggerPredictive[_0xf6fe('0x4b')]('Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x13bdf7[_0xf6fe('0x53')]);loggerPredictive[_0xf6fe('0x4b')]('AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x13bdf7[_0xf6fe('0x54')]);loggerPredictive[_0xf6fe('0x4b')](_0xf6fe('0x55'),_0x13bdf7['predictiveIntervalAvgTalktime']);loggerPredictive[_0xf6fe('0x4b')](_0xf6fe('0x56'));if(_0x13bdf7['predictiveIntervalTotalCalls']>0x0){if(!_[_0xf6fe('0x40')](_0x13bdf7['predictiveIntervalAvgTalktime'])&&_0x13bdf7[_0xf6fe('0x57')]>0x0){return!![];}loggerPredictive[_0xf6fe('0x4b')]('Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive');if(!_['isUndefined'](_0x13bdf7[_0xf6fe('0x54')])&&_0x13bdf7[_0xf6fe('0x54')]>0x0){return!![];}loggerPredictive[_0xf6fe('0x4b')](_0xf6fe('0x58'));}else{loggerPredictive[_0xf6fe('0x4b')]('Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive');}}else{loggerPredictive[_0xf6fe('0x4b')]('History\x20information\x20are\x20empty');}return![];}function mergeDataErlangB(_0x402a6b){return function(_0xf8fe08){loggerPredictive[_0xf6fe('0x4b')](_0xf6fe('0x59'));loggerPredictive[_0xf6fe('0x4b')](_0xf6fe('0x5a'),_0xf8fe08[_0xf6fe('0x5b')]);loggerPredictive[_0xf6fe('0x4b')](_0xf6fe('0x5c'),_0xf8fe08[_0xf6fe('0x5d')]);loggerPredictive[_0xf6fe('0x4b')](_0xf6fe('0x5e'),_0xf8fe08[_0xf6fe('0x5f')]);loggerPredictive[_0xf6fe('0x4b')](_0xf6fe('0x60'),_0xf8fe08[_0xf6fe('0x61')]);loggerPredictive[_0xf6fe('0x4b')](_0xf6fe('0x5e'),_0xf8fe08['erlangAbandonmentRate']);loggerPredictive[_0xf6fe('0x4b')](_0xf6fe('0x56'));_[_0xf6fe('0x62')](_0x402a6b,_0xf8fe08);};}function ifInterval(_0x372185,_0x25a7fe){if(_[_0xf6fe('0x40')](_0x25a7fe)){return![];}return utils['getSeconds'](undefined,_0x25a7fe)<_0x372185*0x3c;}function clearPredictiveAttributes(_0x4094a9){if(_0x4094a9['startProgressive']){_0x4094a9[_0xf6fe('0x27')]=undefined;loggerPredictive[_0xf6fe('0x43')](_0x4094a9[_0xf6fe('0x48')],'startProgressive\x20value\x20cleared');}if(_0x4094a9['startPredictive']){_0x4094a9[_0xf6fe('0x63')]=undefined;loggerPredictive[_0xf6fe('0x43')](_0x4094a9['name'],_0xf6fe('0x64'));}if(_0x4094a9[_0xf6fe('0x65')]){clearInterval(_0x4094a9['handlePredictive']);_0x4094a9['handlePredictive']=undefined;loggerPredictive[_0xf6fe('0x43')](_0x4094a9['name'],'handlePredictive\x20interval\x20cleared');}}function loggerCatchPredictive(_0x19c157,_0x42e1f7){return function(_0x2e85c4){loggerPredictive['error'](_0x42e1f7[_0xf6fe('0x48')],_0x19c157);loggerPredictive['error'](_0x2e85c4['stack']);clearPredictiveAttributes(_0x42e1f7);};}function loggerCatch(_0x73512a){return function(_0xbf9af3){logger[_0xf6fe('0x66')](_0x73512a,util[_0xf6fe('0x45')](_0xbf9af3,{'showHidden':![],'depth':null}));};}function loggerGetContactDialer(_0x5aac98,_0x16e678,_0x4a0e4f){return function(_0x57036f){utils[_0xf6fe('0x67')](_0x16e678,_0x4a0e4f,0x0);_0x16e678['temp']=0x0;logger[_0xf6fe('0x66')](_0x5aac98,util[_0xf6fe('0x45')](_0x57036f,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x24b2df){return function(_0x42423a){if(isNotNull(_0x42423a)&&isNotNull(_0x42423a[0x0])){if(_0x42423a[0x0][_0xf6fe('0x68')]>0x0){_0x24b2df[_0xf6fe('0x69')]=utils[_0xf6fe('0x6a')][_0xf6fe('0x6b')];logger[_0xf6fe('0x4b')](_0xf6fe('0x6c')+_0x24b2df['name'],_0x42423a[0x0][_0xf6fe('0x68')],'contacts');}else{_0x24b2df['message']=utils[_0xf6fe('0x6a')][_0xf6fe('0x6d')];logger[_0xf6fe('0x4b')]('[getContactDialer2][Empty]'+_0x24b2df[_0xf6fe('0x48')]);}}};}function createObjHistory(_0x5e3ad3,_0x1bb76a,_0x109133,_0x112918,_0x19e2df){_0x5e3ad3[_0xf6fe('0x69')]=_0x109133;var _0x62cdc0=new Action(_0x5e3ad3,_0x1bb76a);var _0xb1883d=new History(_0x62cdc0);_0xb1883d[_0xf6fe('0x6e')]=_0x112918;_0xb1883d[_0xf6fe('0x6f')]=_0x19e2df;_0xb1883d[_0xf6fe('0x70')]=_0x62cdc0[_0xf6fe('0x71')];return _0xb1883d;}function unlockQueueStatus(_0x4af7a6,_0x4c1ffd){setTimeout(function(){if(_[_0xf6fe('0x40')](_0x4af7a6[_0xf6fe('0x72')])){loggerBooked[_0xf6fe('0x66')](_0xf6fe('0x73'),_0x4c1ffd);}_0x4af7a6['queueStatusComplete']=!![];loggerBooked[_0xf6fe('0x4b')](_0xf6fe('0x74'),_0x4c1ffd,JSON[_0xf6fe('0x75')](_['pick'](_0x4af7a6,['name',_0xf6fe('0x72')])));},0x1f3);}function checkInterval(_0x168d6e){return function(){if(!isNotNull(_0x168d6e['Interval'])){_0x168d6e[_0xf6fe('0x69')]=utils[_0xf6fe('0x6a')]['NULL_INTERVAL'];throw _0x168d6e[_0xf6fe('0x48')]+_0xf6fe('0x76');}if(!isNotNull(_0x168d6e[_0xf6fe('0x77')][_0xf6fe('0x78')])){_0x168d6e[_0xf6fe('0x69')]=utils[_0xf6fe('0x6a')][_0xf6fe('0x79')];throw _0x168d6e['name']+_0xf6fe('0x76');}if(!isNotNull(_[_0xf6fe('0x4a')](_0x168d6e[_0xf6fe('0x77')][_0xf6fe('0x78')]))){_0x168d6e[_0xf6fe('0x69')]=utils[_0xf6fe('0x6a')][_0xf6fe('0x79')];throw _0x168d6e[_0xf6fe('0x48')]+_0xf6fe('0x76');}};}function checkIsIVRCampaignActive(_0x527d68){return function(){if(!utils[_0xf6fe('0x7a')](_0x527d68)){_0x527d68[_0xf6fe('0x69')]=utils['CAMPAIGN_STATUS'][_0xf6fe('0x7b')];throw _0x527d68[_0xf6fe('0x48')]+'\x20NOT\x20Active';}};}function emitCampaignSummary(_0x36da19){if(utils[_0xf6fe('0x7c')](_0x36da19)){emit(util[_0xf6fe('0x46')](_0xf6fe('0x7d'),_0x36da19['name']),'campaign:save',_0x36da19);}}function loggerCatchQueueSummary(_0x4e2451,_0x2524d8){return function(_0x760897){clearPredictiveAttributes(_0x2524d8);emitCampaignSummary(_0x2524d8);loggerSyncQueueSummary[_0xf6fe('0x43')](_0x4e2451,util['inspect'](_0x760897,{'showHidden':![],'depth':null}));};}function notSendMessagesCampaign(_0x1e0589){if(_0x1e0589['sendMessageOneNotActive']){if(_0x1e0589[_0xf6fe('0x7e')]===0x0){_0x1e0589[_0xf6fe('0x7f')]=![];_0x1e0589[_0xf6fe('0x69')]=utils[_0xf6fe('0x6a')][_0xf6fe('0x7b')];loggerSyncQueueSummary['debug'](_0xf6fe('0x80'),_0x1e0589['name'],_0xf6fe('0x81'));}else{_0x1e0589['message']=utils[_0xf6fe('0x6a')][_0xf6fe('0x82')];loggerSyncQueueSummary['debug'](_0xf6fe('0x80'),_0x1e0589[_0xf6fe('0x48')],_0xf6fe('0x83'));}emitCampaignSummary(_0x1e0589);}}function myreject(_0x53402b){return function(_0x2420d9){return _0x53402b(msgResponse(_0xf6fe('0x84'),_0xf6fe('0x85'),JSON[_0xf6fe('0x75')](_0x2420d9)));};}Dialer[_0xf6fe('0x17')][_0xf6fe('0x86')]=function(_0x2d18ad){return!_[_0xf6fe('0x40')](_0x2d18ad)&&_0x2d18ad&&!_[_0xf6fe('0x40')](_0x2d18ad[_0xf6fe('0x48')])&&!_[_0xf6fe('0x40')](_0x2d18ad['active'])&&_0x2d18ad[_0xf6fe('0x87')]&&(this[_0xf6fe('0x20')][util[_0xf6fe('0x46')](_0xf6fe('0x88'),_0x2d18ad[_0xf6fe('0x48')])][_0xf6fe('0x89')]===_0xf6fe('0x8a')||this['trunks'][util[_0xf6fe('0x46')]('SIP/%s',_0x2d18ad[_0xf6fe('0x48')])][_0xf6fe('0x89')]==='unmonitored');};Dialer[_0xf6fe('0x17')][_0xf6fe('0x8b')]=function(_0x1d505e){var _0x4114ee=this;return function(){if(!_0x4114ee['isTrunkReachable'](_0x1d505e['Trunk'])){if(!_0x4114ee[_0xf6fe('0x86')](_0x1d505e[_0xf6fe('0x8c')])){_0x1d505e['message']=utils[_0xf6fe('0x6a')][_0xf6fe('0x8d')];throw _0x1d505e[_0xf6fe('0x48')]+'\x20trunk\x20is\x20not\x20reachable';}}};};Dialer[_0xf6fe('0x17')][_0xf6fe('0x8e')]=function(_0x4b5d2b,_0x2eb479,_0x1adf76,_0x3ba408){var _0x120f34=this;return function(){var _0x19d97e=!![];return _0x120f34[_0xf6fe('0x8f')](_0x4b5d2b,_0x2eb479,_0x1adf76,_0x3ba408,_0x19d97e);};};Dialer[_0xf6fe('0x17')][_0xf6fe('0x90')]=function(_0x5c63f2,_0x1498dd,_0x333df2,_0x3e8b8b){var _0x27909c=this;return function(){var _0x2358be=![];return _0x27909c['ifTimeIvr'](_0x5c63f2[_0xf6fe('0x78')],_0x1498dd,_0x333df2,_0x3e8b8b,_0x2358be);};};Dialer[_0xf6fe('0x17')][_0xf6fe('0x8f')]=function(_0x306abf,_0x11d069,_0x2b8ce3,_0x5989f8,_0x5bed8f){var _0x29c2a5=[];return new Promise(function(_0x4a377c,_0x4dff4f){if(!isNotNull(_0x306abf)){_0x5989f8['message']=utils[_0xf6fe('0x6a')]['NULL_INTERVAL'];return _0x4dff4f(msgResponse(_0xf6fe('0x91'),_0xf6fe('0x92'),_0x2b8ce3+_0xf6fe('0x93')));}if(_[_0xf6fe('0x4a')](_0x306abf)){_0x5989f8[_0xf6fe('0x69')]=utils[_0xf6fe('0x6a')][_0xf6fe('0x94')];return _0x4dff4f(msgResponse(_0xf6fe('0x91'),_0xf6fe('0x92'),_0x2b8ce3+'\x20Intervals\x20is\x20empty\x20'));}if(_0x11d069&&_[_0xf6fe('0x40')](config[_0xf6fe('0x95')][_0x11d069])){_0x5989f8[_0xf6fe('0x69')]=utils[_0xf6fe('0x6a')][_0xf6fe('0x96')];return _0x4dff4f(msgResponse(_0xf6fe('0x91'),'Failure',_0x2b8ce3+_0xf6fe('0x97')+_0x11d069));}if(_[_0xf6fe('0x98')](_0x306abf)){for(var _0x5c9b7e=0x0;_0x5c9b7e<_0x306abf[_0xf6fe('0x99')];_0x5c9b7e+=0x1){_0x29c2a5[_0xf6fe('0x9a')](ami['Action']({'action':_0xf6fe('0x9b'),'command':util[_0xf6fe('0x46')](_0xf6fe('0x9c'),_0x306abf[_0x5c9b7e][_0xf6fe('0x9d')],!_[_0xf6fe('0x40')](config[_0xf6fe('0x95')][_0x11d069])?_0x11d069:'')})[_0xf6fe('0x3e')](function(_0x5df198){return _0x5df198[_0xf6fe('0x9e')]['indexOf']('true')>=0x0;})[_0xf6fe('0x9f')](myreject(_0x4dff4f)));}}else{_0x29c2a5['push'](ami['Action']({'action':_0xf6fe('0x9b'),'command':util[_0xf6fe('0x46')](_0xf6fe('0x9c'),_0x306abf,!_['isUndefined'](config[_0xf6fe('0x95')][_0x11d069])?_0x11d069:'')})[_0xf6fe('0x3e')](function(_0x53a702){return _0x53a702[_0xf6fe('0x9e')][_0xf6fe('0xa0')](_0xf6fe('0xa1'))>=0x0;})['catch'](myreject(_0x4dff4f)));}Promise[_0xf6fe('0xa2')](_0x29c2a5)[_0xf6fe('0x3e')](function(_0x3116bf){var _0x6c8422=_[_0xf6fe('0xa3')](_0x3116bf);if(_0x6c8422){return _0x4a377c(_0x6c8422);}else{_0x5989f8[_0xf6fe('0x69')]=_0x5bed8f?utils[_0xf6fe('0x6a')][_0xf6fe('0xa4')]:utils['CAMPAIGN_STATUS'][_0xf6fe('0xa5')];return _0x4dff4f(msgResponse(_0xf6fe('0xa6'),'Failure','Global:\x20'+_0x5bed8f+'\x20'+_0x2b8ce3+_0xf6fe('0xa7')+util[_0xf6fe('0x45')](_0x306abf,{'showHidden':![],'depth':null})+_0xf6fe('0xa8')+_0x11d069));}})[_0xf6fe('0x9f')](function(_0x1e6988){return _0x4dff4f(msgResponse(_0xf6fe('0x91'),_0xf6fe('0x92'),JSON[_0xf6fe('0x75')](_0x1e6988)));});});};Dialer[_0xf6fe('0x17')][_0xf6fe('0x3c')]=function(){var _0x3ff5e5=this;return cmHopper[_0xf6fe('0xa9')]({'active':![]},{'where':{'active':!![]}})[_0xf6fe('0x3e')](function(){setInterval(function(){_0x3ff5e5[_0xf6fe('0xaa')]();},0x3e8);});};Dialer['prototype']['syncCampaigns']=function(){var _0x16d23f=this;var _0x27f597;for(var _0x389da0 in this[_0xf6fe('0x1e')]){if(typeof this[_0xf6fe('0x1e')][_0x389da0]!==_0xf6fe('0xab')){_0x27f597=this['campaigns'][_0x389da0];if(utils['isIVRCampaign'](_0x27f597)&&utils[_0xf6fe('0x7a')](_0x27f597)){_0x27f597[_0xf6fe('0x7f')]=!![];Promise['resolve']()['then'](checkIsIVRCampaignActive(_0x27f597))['then'](checkInterval(_0x27f597))[_0xf6fe('0x3e')](_0x16d23f[_0xf6fe('0x8b')](_0x27f597))[_0xf6fe('0x3e')](_0x16d23f[_0xf6fe('0x8e')](_0x27f597['dialGlobalInterval'],_0x27f597['dialTimezone'],_0x27f597[_0xf6fe('0x48')],_0x27f597))[_0xf6fe('0x3e')](_0x16d23f[_0xf6fe('0x90')](_0x27f597[_0xf6fe('0x77')],_0x27f597['dialTimezone'],_0x27f597['name'],_0x27f597))[_0xf6fe('0x3e')](_0x16d23f['launchHandleIvr'](_0x27f597))[_0xf6fe('0x9f')](loggerCatchQueueSummary(_0xf6fe('0xac'),_0x27f597));}else{notSendMessagesCampaign(_0x27f597);}}}};Dialer['prototype'][_0xf6fe('0xad')]=function(_0x1616cb){if(_0x1616cb[_0xf6fe('0xae')]!==_0xf6fe('0xa')){clearPredictiveAttributes(_0x1616cb);}switch(_0x1616cb[_0xf6fe('0xae')]){case'progressive':this[_0xf6fe('0xaf')](_0x1616cb,0x1);break;case'power':this[_0xf6fe('0xaf')](_0x1616cb,_0x1616cb[_0xf6fe('0xb0')]);break;case _0xf6fe('0xa'):this[_0xf6fe('0xa')](_0x1616cb);break;case _0xf6fe('0x9'):this[_0xf6fe('0xaf')](_0x1616cb,0x1);break;default:logger[_0xf6fe('0x66')](_0xf6fe('0xb1'),_0x1616cb[_0xf6fe('0x48')],_0xf6fe('0xb2'));}};Dialer[_0xf6fe('0x17')][_0xf6fe('0x91')]=function(_0x36e940,_0x469efb){var _0x148197=_0x36e940[_0xf6fe('0xb3')];var _0x2d287c=_0x469efb?_0x36e940[_0xf6fe('0xb4')]:_0x36e940['Interval'][_0xf6fe('0x78')];logger[_0xf6fe('0xb5')]('Dialer::ifTime()',_0x2d287c,_0x148197,_0x36e940['name'],util[_0xf6fe('0x46')]('Voice\x20Queue\x20%s\x20$s',_0x36e940[_0xf6fe('0x48')],_0x36e940['id']));var _0x287fe7=null;return Interval[_0xf6fe('0xb6')](_0x2d287c,_0x148197)['then'](function(_0x3b7eab){if(_0x3b7eab===!![]){return _0x3b7eab;}else{_0x36e940[_0xf6fe('0x69')]=_0x469efb?utils[_0xf6fe('0x6a')][_0xf6fe('0xa4')]:utils[_0xf6fe('0x6a')][_0xf6fe('0xa5')];_0x287fe7=msgResponse(_0xf6fe('0xa6'),_0xf6fe('0x92'),'Global:\x20'+_0x469efb+'\x20'+_0x36e940['name']+_0xf6fe('0xa7')+util['inspect'](_0x2d287c,{'showHidden':![],'depth':null})+'Timezone:\x20'+_0x148197);}if(_0x287fe7!==null){logger[_0xf6fe('0xb5')]('Dialer::ifTime()\x20errResponse\x20NOT\x20NULL:',_0x287fe7);_0x287fe7[_0xf6fe('0xb7')]=_0x469efb;throw _0x287fe7;}})[_0xf6fe('0x9f')](function(_0x3a260b){logger[_0xf6fe('0x66')](_0xf6fe('0xb8'),_0x3a260b);throw msgResponse('[ifTime][Action]',_0xf6fe('0x85'),util[_0xf6fe('0x45')](_0x3a260b,{'showHidden':![],'depth':null}));});};Dialer[_0xf6fe('0x17')][_0xf6fe('0xb9')]=function(_0x5c87a9){if(this[_0xf6fe('0x1d')][_0x5c87a9[_0xf6fe('0xba')]]){if(this['uniqueId'][_0x5c87a9['uniqueid']]&&this[_0xf6fe('0x25')][_0x5c87a9[_0xf6fe('0xbb')]][_0xf6fe('0x41')]!==_0xf6fe('0xbc')){this[_0xf6fe('0xbd')](this[_0xf6fe('0x1d')][_0x5c87a9[_0xf6fe('0xba')]]);this[_0xf6fe('0x25')][_0x5c87a9['uniqueid']]['answertime']=moment()['format'](_0xf6fe('0xbe'));}}};Dialer['prototype'][_0xf6fe('0x30')]=function(_0x23efc8){var _0x144d30=this[_0xf6fe('0x25')][_0x23efc8[_0xf6fe('0xbb')]];if(this[_0xf6fe('0x1d')][_0x23efc8[_0xf6fe('0xba')]]){if(_0x144d30&&_0x144d30[_0xf6fe('0x41')]!==_0xf6fe('0xbc')){delete this[_0xf6fe('0x25')][_0x23efc8['uniqueid']];this[_0xf6fe('0x1d')][_0x23efc8[_0xf6fe('0xba')]]['outboundAnswerCallsDay']+=0x1;var _0x2c3d0e=new AgentComplete(_0x144d30,_0x23efc8);if(_0x23efc8[_0xf6fe('0xbf')]===_0xf6fe('0xc0')){_0x2c3d0e['agiafterat']=this['voiceQueues'][_0x23efc8[_0xf6fe('0xba')]][_0xf6fe('0xc1')]&&this[_0xf6fe('0x1d')][_0x23efc8[_0xf6fe('0xba')]][_0xf6fe('0xc2')]?moment()[_0xf6fe('0x46')](_0xf6fe('0xbe')):undefined;}hopperUtils[_0xf6fe('0xc3')](_0x2c3d0e)[_0xf6fe('0x9f')](loggerCatch(_0xf6fe('0xc4')));hopperUtils[_0xf6fe('0xc5')](_0x2c3d0e)[_0xf6fe('0x9f')](loggerCatch(_0xf6fe('0xc6')));}}};Dialer[_0xf6fe('0x17')][_0xf6fe('0x2d')]=function(_0x493203){var _0x19196e=this[_0xf6fe('0x25')][_0x493203[_0xf6fe('0xbb')]];var _0x13009e=this;var _0x1fa3de=![];var _0x10544e;var _0x3fe154;if(this[_0xf6fe('0x1d')][_0x493203['queue']]){if(_0x19196e&&_0x19196e[_0xf6fe('0x41')]!==_0xf6fe('0xbc')){delete this[_0xf6fe('0x25')][_0x493203[_0xf6fe('0xbb')]];this[_0xf6fe('0xbd')](this[_0xf6fe('0x1d')][_0x493203[_0xf6fe('0xba')]]);_0x19196e[_0xf6fe('0xc7')]=moment()[_0xf6fe('0x46')]('YYYY-MM-DD\x20HH:mm:ss');var _0x40bf7c=new QueueCallerAbandon(_0x19196e,_0x493203);if(utils['getSeconds'](_0x19196e[_0xf6fe('0xc7')],_0x19196e[_0xf6fe('0xc8')])>=_0x19196e[_0xf6fe('0xc9')]){this[_0xf6fe('0x1d')][_0x493203[_0xf6fe('0xba')]][_0xf6fe('0x52')]+=0x1;this[_0xf6fe('0x1d')][_0x493203[_0xf6fe('0xba')]]['outboundDropCallsDayTimeout']+=0x1;this[_0xf6fe('0x1d')][_0x493203['queue']][_0xf6fe('0xca')]+=0x1;_0x40bf7c[_0xf6fe('0x6e')]=0xa;_0x40bf7c[_0xf6fe('0x6f')]=_0xf6fe('0xcb');_0x40bf7c[_0xf6fe('0xcc')]=_0xf6fe('0xcd');_0x40bf7c[_0xf6fe('0xce')]=this[_0xf6fe('0x1d')][_0x493203[_0xf6fe('0xba')]]['dialQueueProject2']?moment()['format'](_0xf6fe('0xbe')):undefined;_0x40bf7c['countdropretry']+=0x1;_0x40bf7c[_0xf6fe('0xcf')]+=0x1;_0x10544e=this[_0xf6fe('0x1d')][_0x493203['queue']][_0xf6fe('0xd0')];_0x3fe154=this[_0xf6fe('0x1d')][_0x493203[_0xf6fe('0xba')]][_0xf6fe('0xd1')];hopperUtils[_0xf6fe('0xd2')](_0x40bf7c,_0x40bf7c[_0xf6fe('0x6e')],_0x19196e[_0xf6fe('0xd3')])[_0xf6fe('0x3e')](function(_0x40cb8d){_0x1fa3de=_0x40cb8d[_0xf6fe('0xd4')]==0x1;if(_0x40bf7c['countdropretry']>=_0x13009e[_0xf6fe('0x1d')][_0x493203[_0xf6fe('0xba')]][_0xf6fe('0xd5')]){_0x13009e[_0xf6fe('0xd6')](_0x40bf7c,_0x40cb8d[_0xf6fe('0xd4')]);}else{hopperUtils[_0xf6fe('0xd7')]({'active':![],'countdropretry':_0x40bf7c[_0xf6fe('0xd8')],'scheduledat':moment()['add'](_0x13009e['voiceQueues'][_0x493203[_0xf6fe('0xba')]][_0xf6fe('0xd0')],_0xf6fe('0xd9'))['format'](_0xf6fe('0xbe')),'ContactId':_0x19196e[_0xf6fe('0xda')],'ListId':_0x19196e[_0xf6fe('0xdb')],'VoiceQueueId':_0x19196e[_0xf6fe('0xdc')]||undefined,'CampaignId':_0x19196e[_0xf6fe('0xdd')]||undefined})[_0xf6fe('0x9f')](loggerCatch(_0xf6fe('0xde')));var _0x4012f0=new History(_0x40bf7c);_0x4012f0[_0xf6fe('0x6e')]=0xa;_0x4012f0[_0xf6fe('0x6f')]='Drop';_0x4012f0[_0xf6fe('0x71')]=moment()[_0xf6fe('0x46')]('YYYY-MM-DD\x20HH:mm:ss');_0x4012f0[_0xf6fe('0x70')]=_0x4012f0[_0xf6fe('0x71')];_0x4012f0[_0xf6fe('0xdf')]=_0x40bf7c[_0xf6fe('0xdf')];_0x4012f0['calleridnum']=_0x40bf7c[_0xf6fe('0xe0')];hopperUtils[_0xf6fe('0xc3')](_0x4012f0)[_0xf6fe('0x9f')](loggerCatch(_0xf6fe('0xe1')));}})[_0xf6fe('0x3e')](function(){if(_0x1fa3de)hopperUtils[_0xf6fe('0xe2')](_0x40bf7c,_0x10544e,_0x3fe154)[_0xf6fe('0x3e')](function(){return 0x1;});});}else{this[_0xf6fe('0x1d')][_0x493203[_0xf6fe('0xba')]][_0xf6fe('0x53')]+=0x1;this[_0xf6fe('0x1d')][_0x493203[_0xf6fe('0xba')]]['outboundDropCallsDayCallersExit']+=0x1;_0x40bf7c['state']=0xb;_0x40bf7c[_0xf6fe('0x6f')]=_0xf6fe('0xe3');_0x40bf7c[_0xf6fe('0xcc')]='CALLEREXIT';_0x40bf7c[_0xf6fe('0xe4')]+=0x1;_0x40bf7c[_0xf6fe('0xcf')]+=0x1;_0x10544e=this[_0xf6fe('0x1d')][_0x493203[_0xf6fe('0xba')]][_0xf6fe('0xe5')];_0x3fe154=this[_0xf6fe('0x1d')][_0x493203[_0xf6fe('0xba')]]['callAdditionalPhoneAfterMin'];hopperUtils[_0xf6fe('0xd2')](_0x40bf7c,_0x40bf7c[_0xf6fe('0x6e')],_0x19196e[_0xf6fe('0xd3')])[_0xf6fe('0x3e')](function(_0x3c65d9){if(_0x40bf7c['countabandonedretry']>=_0x13009e[_0xf6fe('0x1d')][_0x493203['queue']][_0xf6fe('0xe6')]){_0x13009e['queueCallerAbandonCreateState'](_0x40bf7c,_0x3c65d9[_0xf6fe('0xd4')]);}else{hopperUtils[_0xf6fe('0xd7')]({'active':![],'countabandonedretry':_0x40bf7c[_0xf6fe('0xe4')],'scheduledat':moment()[_0xf6fe('0xe7')](_0x13009e[_0xf6fe('0x1d')][_0x493203[_0xf6fe('0xba')]][_0xf6fe('0xe5')],_0xf6fe('0xd9'))[_0xf6fe('0x46')](_0xf6fe('0xbe')),'ContactId':_0x19196e[_0xf6fe('0xda')],'ListId':_0x19196e[_0xf6fe('0xdb')],'VoiceQueueId':_0x19196e[_0xf6fe('0xdc')]||undefined,'CampaignId':_0x19196e['CampaignId']||undefined})[_0xf6fe('0x9f')](loggerCatch(_0xf6fe('0xe8')));var _0xa64c71=new History(_0x40bf7c);_0xa64c71['state']=0xb;_0xa64c71['statedesc']='Abandoned';_0xa64c71['starttime']=moment()['format'](_0xf6fe('0xbe'));_0xa64c71[_0xf6fe('0x70')]=_0xa64c71[_0xf6fe('0x71')];_0xa64c71[_0xf6fe('0xdf')]=_0x40bf7c[_0xf6fe('0xdf')];_0xa64c71['calleridnum']=_0x40bf7c['calleridnum'];hopperUtils[_0xf6fe('0xc3')](_0xa64c71)[_0xf6fe('0x9f')](loggerCatch(_0xf6fe('0xe9')));}})['then'](function(){if(_0x1fa3de)hopperUtils[_0xf6fe('0xe2')](_0x40bf7c,_0x10544e,_0x3fe154)[_0xf6fe('0x3e')](function(){return 0x1;});});}}}};Dialer[_0xf6fe('0x17')][_0xf6fe('0x36')]=function(_0x2dcd84){if(this[_0xf6fe('0x23')][_0x2dcd84[_0xf6fe('0xbb')]]){this[_0xf6fe('0x23')][_0x2dcd84[_0xf6fe('0xbb')]][_0xf6fe('0xea')]=_0x2dcd84['channel'];}if(this['uniqueId'][_0x2dcd84[_0xf6fe('0xbb')]]){this[_0xf6fe('0x25')][_0x2dcd84[_0xf6fe('0xbb')]][_0xf6fe('0xea')]=_0x2dcd84[_0xf6fe('0xea')];}};Dialer[_0xf6fe('0x17')][_0xf6fe('0x3a')]=function(_0x541662){if(!this[_0xf6fe('0x23')][_0x541662['actionid']]){return;}var _0x707a9c=this[_0xf6fe('0x1d')][this[_0xf6fe('0x23')][_0x541662['actionid']][_0xf6fe('0xba')]]['strategy']||_0xf6fe('0xeb');if(_0x707a9c===_0xf6fe('0xec')){if(this[_0xf6fe('0x23')][_0x541662[_0xf6fe('0xed')]]&&_[_0xf6fe('0xee')](this[_0xf6fe('0x23')][_0x541662['actionid']]['locked'])&&_0x541662[_0xf6fe('0x89')]==='1'&&_0x541662[_0xf6fe('0xef')]==='0'){if(this['agents'][_0x541662[_0xf6fe('0xf0')]]){if(!this['agents'][_0x541662[_0xf6fe('0xf0')]]['locked']){this['agents'][_0x541662[_0xf6fe('0xf0')]]['locked']=!![];this['actions'][_0x541662[_0xf6fe('0xed')]][_0xf6fe('0xf1')]=!![];this['actions'][_0x541662[_0xf6fe('0xed')]][_0xf6fe('0xf0')]=_0x541662[_0xf6fe('0xf0')];}}}}else if(_0x707a9c===_0xf6fe('0xeb')){if(this['actions'][_0x541662[_0xf6fe('0xed')]]){if(this[_0xf6fe('0x1f')][_0x541662[_0xf6fe('0xf0')]]){this['actions'][_0x541662[_0xf6fe('0xed')]][_0xf6fe('0xf0')]=_0x541662['stateinterface'];if(_[_0xf6fe('0xee')](this[_0xf6fe('0x29')][this[_0xf6fe('0x23')][_0x541662['actionid']][_0xf6fe('0xba')]])){this['queueBooked'][this[_0xf6fe('0x23')][_0x541662[_0xf6fe('0xed')]][_0xf6fe('0xba')]]=[];}this[_0xf6fe('0x29')][this[_0xf6fe('0x23')][_0x541662[_0xf6fe('0xed')]][_0xf6fe('0xba')]][_0xf6fe('0x9a')](_[_0xf6fe('0x62')](_[_0xf6fe('0xf2')](this['actions'][_0x541662[_0xf6fe('0xed')]],[_0xf6fe('0xf3'),_0xf6fe('0xf0')]),{'status':_0x541662[_0xf6fe('0x89')],'paused':_0x541662['paused']}));}}}};Dialer[_0xf6fe('0x17')][_0xf6fe('0xf4')]=function(_0x15064f){if(!this[_0xf6fe('0x23')][_0x15064f[_0xf6fe('0xed')]]){return;}var _0xbe89d=this;var _0x29efbb=this[_0xf6fe('0x1d')][this[_0xf6fe('0x23')][_0x15064f[_0xf6fe('0xed')]][_0xf6fe('0xba')]];var _0x4262c1=_0x29efbb[_0xf6fe('0xf5')]||_0xf6fe('0xeb');if(_0x4262c1==='roundrobin'){if(this[_0xf6fe('0x23')][_0x15064f['actionid']]&&this[_0xf6fe('0x23')][_0x15064f[_0xf6fe('0xed')]][_0xf6fe('0xf0')]){this['preview']['run'](this[_0xf6fe('0x23')][_0x15064f[_0xf6fe('0xed')]][_0xf6fe('0xf3')],this['actions'][_0x15064f[_0xf6fe('0xed')]]['stateinterface'])['catch'](function(_0xc0398e){logger[_0xf6fe('0x66')](_0xf6fe('0xf6'),util[_0xf6fe('0x45')](_0xc0398e,{'showHidden':![],'depth':null}));})[_0xf6fe('0x1a')](function(){_0xbe89d['updateOriginated'](_0xbe89d[_0xf6fe('0x1d')][_0xbe89d[_0xf6fe('0x23')][_0x15064f[_0xf6fe('0xed')]][_0xf6fe('0xba')]]);_0xbe89d[_0xf6fe('0x1f')][_0xbe89d[_0xf6fe('0x23')][_0x15064f[_0xf6fe('0xed')]][_0xf6fe('0xf0')]][_0xf6fe('0xf1')]=![];delete _0xbe89d['actions'][_0x15064f[_0xf6fe('0xed')]];unlockQueueStatus(_0x29efbb);});}else{this[_0xf6fe('0xbd')](this[_0xf6fe('0x1d')][this[_0xf6fe('0x23')][_0x15064f[_0xf6fe('0xed')]]['queue']]);hopperUtils['rescheduleContact']({'active':![],'ContactId':this[_0xf6fe('0x23')][_0x15064f[_0xf6fe('0xed')]]['ContactId'],'ListId':this[_0xf6fe('0x23')][_0x15064f[_0xf6fe('0xed')]][_0xf6fe('0xdb')],'VoiceQueueId':this[_0xf6fe('0x23')][_0x15064f['actionid']][_0xf6fe('0xdc')]||undefined,'CampaignId':this[_0xf6fe('0x23')][_0x15064f[_0xf6fe('0xed')]][_0xf6fe('0xdd')]||undefined})['catch'](loggerCatch(_0xf6fe('0xf7')));delete this[_0xf6fe('0x23')][_0x15064f[_0xf6fe('0xed')]];unlockQueueStatus(_0x29efbb);}}else if(_0x4262c1===_0xf6fe('0xeb')){var _0x3f1f86;if(this[_0xf6fe('0x23')][_0x15064f[_0xf6fe('0xed')]]&&!_[_0xf6fe('0x4a')](this['queueBooked'][this[_0xf6fe('0x23')][_0x15064f[_0xf6fe('0xed')]]['queue']])){if(this['queueBookedRR'][_0xbe89d[_0xf6fe('0x23')][_0x15064f[_0xf6fe('0xed')]][_0xf6fe('0xba')]]){this[_0xf6fe('0x2a')][_0xbe89d[_0xf6fe('0x23')][_0x15064f[_0xf6fe('0xed')]]['queue']]=this[_0xf6fe('0x2a')][this[_0xf6fe('0x23')][_0x15064f[_0xf6fe('0xed')]]['queue']]?this[_0xf6fe('0x2a')][this['actions'][_0x15064f[_0xf6fe('0xed')]][_0xf6fe('0xba')]]:this[_0xf6fe('0x29')][this[_0xf6fe('0x23')][_0x15064f[_0xf6fe('0xed')]][_0xf6fe('0xba')]]?this[_0xf6fe('0x29')][this[_0xf6fe('0x23')][_0x15064f[_0xf6fe('0xed')]][_0xf6fe('0xba')]][_0xf6fe('0xf8')]||0x0:0x0;}this[_0xf6fe('0x29')][this[_0xf6fe('0x23')][_0x15064f[_0xf6fe('0xed')]][_0xf6fe('0xba')]][_0xf6fe('0xf8')]=this[_0xf6fe('0x2a')][this[_0xf6fe('0x23')][_0x15064f[_0xf6fe('0xed')]][_0xf6fe('0xba')]];for(var _0x49a813=0x0;_0x49a813=_0x34f31e[_0xf6fe('0x120')]){_0x5e19c1[_0xf6fe('0x121')](_0x15e1a8,_0x2a79b5,_0x3b7dd2,_0xf6fe('0x122'));}else{if(_0x15e1a8[_0xf6fe('0x119')]>=_0x34f31e[_0xf6fe('0x123')]){_0x5e19c1[_0xf6fe('0x124')](_0x15e1a8,_0x2a79b5,_0x3b7dd2,'reason\x2019\x20machine....');}else{hopperUtils[_0xf6fe('0xd7')]({'active':![],'countmachineretry':_0x15e1a8[_0xf6fe('0x119')],'scheduledat':moment()['add'](_0x34f31e[_0xf6fe('0x125')],_0xf6fe('0xd9'))[_0xf6fe('0x46')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x15e1a8[_0xf6fe('0xda')],'ListId':_0x15e1a8[_0xf6fe('0xdb')],'VoiceQueueId':_0x15e1a8[_0xf6fe('0xdc')]||undefined,'CampaignId':_0x15e1a8['CampaignId']||undefined})['catch'](loggerCatch(_0xf6fe('0x126')));_0x2a79b5({'reschedule':0x1});}}});}if(_0x13a18e[_0xf6fe('0x41')]===_0xf6fe('0xbc')&&this[_0xf6fe('0x1e')][_0x13a18e[_0xf6fe('0xba')]][_0xf6fe('0x10c')]&&_0x518844['value']==='HANGUP'){delete this[_0xf6fe('0x25')][_0x518844[_0xf6fe('0xbb')]];this[_0xf6fe('0xbd')](this[_0xf6fe('0x1e')][_0x13a18e[_0xf6fe('0xba')]]);_0x52ccfb=new Hangup(_0x13a18e,_0x518844);_0x52ccfb[_0xf6fe('0x6e')]=0x12;_0x52ccfb['statedesc']='HangupInAMD';_0x52ccfb[_0xf6fe('0x111')]=_0xf6fe('0x112');ami[_0xf6fe('0x113')]('custom:amd',ut[_0xf6fe('0x115')](_0x52ccfb,_0xf6fe('0x11a')));this[_0xf6fe('0x116')](_0x52ccfb,'[syncHangupInAMDIvr][createHistory]',_0xf6fe('0x127'));}if(_0x13a18e[_0xf6fe('0x41')]===_0xf6fe('0xbc')&&this['campaigns'][_0x13a18e[_0xf6fe('0xba')]]['dialAMDActive']&&_0x518844[_0xf6fe('0x10d')]===_0xf6fe('0x128')){return new Promise(function(_0x18d648,_0x4a0391){delete _0x5e19c1[_0xf6fe('0x25')][_0x518844[_0xf6fe('0xbb')]];_0x5e19c1['updateOriginated'](_0x5e19c1[_0xf6fe('0x1e')][_0x13a18e[_0xf6fe('0xba')]]);_0x5e19c1[_0xf6fe('0x1e')][_0x13a18e[_0xf6fe('0xba')]]['outboundAnswerCallsDay']+=0x1;_0x5e19c1[_0xf6fe('0x1e')][_0x13a18e[_0xf6fe('0xba')]][_0xf6fe('0x118')]+=0x1;var _0x493ffc=_0x5e19c1[_0xf6fe('0x1e')][_0x13a18e[_0xf6fe('0xba')]];var _0xbb1af4=new Hangup(_0x13a18e,_0x518844);_0xbb1af4[_0xf6fe('0x6e')]=0x13;_0xbb1af4[_0xf6fe('0x6f')]=_0xf6fe('0x129');_0xbb1af4[_0xf6fe('0x111')]='AMD';_0xbb1af4[_0xf6fe('0x119')]+=0x1;_0xbb1af4[_0xf6fe('0xcf')]+=0x1;_0xbb1af4[_0xf6fe('0x11a')]=!![];ami['emit'](_0xf6fe('0x114'),ut['buildObj'](_0xbb1af4,_0xf6fe('0x11a')));hopperUtils[_0xf6fe('0xc3')](_0xbb1af4)[_0xf6fe('0x9f')](loggerCatch(_0xf6fe('0x11b')));if(_0xbb1af4[_0xf6fe('0x11c')]+_0xbb1af4[_0xf6fe('0x12a')]+_0xbb1af4[_0xf6fe('0x11d')]+_0xbb1af4[_0xf6fe('0x11e')]+_0xbb1af4[_0xf6fe('0xd8')]+_0xbb1af4[_0xf6fe('0xe4')]+_0xbb1af4[_0xf6fe('0x119')]+_0xbb1af4[_0xf6fe('0x11f')]>=_0x493ffc[_0xf6fe('0x120')]){_0x5e19c1[_0xf6fe('0x121')](_0xbb1af4,_0x18d648,_0x4a0391,_0xf6fe('0x122'));}else{if(_0xbb1af4[_0xf6fe('0x119')]>=_0x493ffc[_0xf6fe('0x123')]){_0x5e19c1[_0xf6fe('0x124')](_0xbb1af4,_0x18d648,_0x4a0391,_0xf6fe('0x12b'));}else{hopperUtils['rescheduleContact']({'active':![],'countmachineretry':_0xbb1af4[_0xf6fe('0x119')],'scheduledat':moment()[_0xf6fe('0xe7')](_0x493ffc[_0xf6fe('0x125')],'minutes')[_0xf6fe('0x46')](_0xf6fe('0xbe')),'ContactId':_0xbb1af4[_0xf6fe('0xda')],'ListId':_0xbb1af4['ListId'],'VoiceQueueId':_0xbb1af4[_0xf6fe('0xdc')]||undefined,'CampaignId':_0xbb1af4['CampaignId']||undefined})[_0xf6fe('0x9f')](loggerCatch(_0xf6fe('0x126')));_0x18d648({'reschedule':0x1});}}});}}};Dialer['prototype']['syncHangup']=function(_0x5570e3){var _0xe12d15=this[_0xf6fe('0x25')][_0x5570e3[_0xf6fe('0xbb')]];var _0x161cd9;if(_0xe12d15&&_0xe12d15['type']===_0xf6fe('0xbc')){delete this[_0xf6fe('0x25')][_0x5570e3[_0xf6fe('0xbb')]];this[_0xf6fe('0xbd')](this['campaigns'][_0xe12d15[_0xf6fe('0xba')]]);this[_0xf6fe('0x1e')][_0xe12d15[_0xf6fe('0xba')]][_0xf6fe('0x12c')]+=0x1;_0x161cd9=new Hangup(_0xe12d15,_0x5570e3);hopperUtils[_0xf6fe('0xc3')](_0x161cd9)[_0xf6fe('0x9f')](loggerCatch(_0xf6fe('0x12d')));hopperUtils[_0xf6fe('0xc5')](_0x161cd9)[_0xf6fe('0x9f')](loggerCatch(_0xf6fe('0x12e')));}if(_0xe12d15&&_0xe12d15[_0xf6fe('0x41')]!==_0xf6fe('0xbc')&&isNotNull(this['voiceQueues'][_0xe12d15[_0xf6fe('0xba')]][_0xf6fe('0x12f')])){delete this[_0xf6fe('0x25')][_0x5570e3[_0xf6fe('0xbb')]];this[_0xf6fe('0xbd')](this[_0xf6fe('0x1d')][_0xe12d15['queue']]);this[_0xf6fe('0x1d')][_0xe12d15[_0xf6fe('0xba')]][_0xf6fe('0x10f')]+=0x1;this[_0xf6fe('0x1d')][_0xe12d15['queue']]['outboundAnswerAgiCallsDay']+=0x1;_0x161cd9=new Hangup(_0xe12d15,_0x5570e3);_0x161cd9[_0xf6fe('0x6e')]=0x10;_0x161cd9[_0xf6fe('0x6f')]=_0xf6fe('0x130');_0x161cd9[_0xf6fe('0x111')]=_0xf6fe('0x131');hopperUtils[_0xf6fe('0xc3')](_0x161cd9)['catch'](loggerCatch(_0xf6fe('0x12d')));hopperUtils[_0xf6fe('0xc5')](_0x161cd9)[_0xf6fe('0x9f')](loggerCatch('[syncHangupIvr]'));}if(_0xe12d15&&_0xe12d15[_0xf6fe('0x41')]!==_0xf6fe('0xbc')&&!isNotNull(this[_0xf6fe('0x1d')][_0xe12d15[_0xf6fe('0xba')]][_0xf6fe('0x12f')])){delete this['uniqueId'][_0x5570e3[_0xf6fe('0xbb')]];this[_0xf6fe('0xbd')](this[_0xf6fe('0x1d')][_0xe12d15[_0xf6fe('0xba')]]);this[_0xf6fe('0x1d')][_0xe12d15[_0xf6fe('0xba')]]['outboundUnknownCallsDay']+=0x1;_0x161cd9=new Hangup(_0xe12d15,_0x5570e3);_0x161cd9[_0xf6fe('0x6e')]=0xc;_0x161cd9[_0xf6fe('0x6f')]=_0x5570e3[_0xf6fe('0x132')];_0x161cd9[_0xf6fe('0x111')]='Unknow';hopperUtils[_0xf6fe('0xc3')](_0x161cd9)[_0xf6fe('0x9f')](loggerCatch(_0xf6fe('0x12d')));hopperUtils[_0xf6fe('0xc5')](_0x161cd9)[_0xf6fe('0x9f')](loggerCatch('[syncHangupIvr]'));}};Dialer[_0xf6fe('0x17')]['syncQueueSummary']=function(_0x1418f9){var _0x589b70=this;if(!_0x589b70[_0xf6fe('0x2b')][_0x1418f9[_0xf6fe('0x48')]]){_0x589b70[_0xf6fe('0x2b')][_0x1418f9[_0xf6fe('0x48')]]={'running':![]};}else if(_0x589b70[_0xf6fe('0x2b')][_0x1418f9[_0xf6fe('0x48')]][_0xf6fe('0x133')]===!![]){return;}else if(_0x589b70[_0xf6fe('0x2b')][_0x1418f9[_0xf6fe('0x48')]][_0xf6fe('0x133')]===![]){_0x589b70[_0xf6fe('0x2b')][_0x1418f9[_0xf6fe('0x48')]][_0xf6fe('0x133')]=!![];}var _0x1e7288=_0x589b70[_0xf6fe('0x1d')][_0x1418f9[_0xf6fe('0x48')]];var _0x4e1442=_0x1e7288['message']!==utils[_0xf6fe('0x6a')]['INACTIVE'];var _0x5c92c7=utils[_0xf6fe('0x134')](_0x1e7288);_0x1e7288[_0xf6fe('0x135')]=utils[_0xf6fe('0x136')](_0x1e7288,_0x589b70[_0xf6fe('0x20')]);Promise[_0xf6fe('0x137')]()[_0xf6fe('0x3e')](function(){if(_0x1e7288[_0xf6fe('0x135')]===utils[_0xf6fe('0x6a')][_0xf6fe('0x7b')]){if(_0x4e1442){clearPredictiveAttributes(_0x1e7288);_0x1418f9[_0xf6fe('0x63')]=undefined;_0x1418f9[_0xf6fe('0x27')]=undefined;}if(_0x1e7288[_0xf6fe('0x135')]===utils[_0xf6fe('0x6a')][_0xf6fe('0x7b')]){_0x1418f9[_0xf6fe('0x138')]=0x0;_0x1418f9[_0xf6fe('0xef')]=0x0;_0x1418f9[_0xf6fe('0x139')]=0x0;_0x1418f9[_0xf6fe('0x13a')]=0x0;_0x1418f9[_0xf6fe('0x13b')]=0x0;}}else if(_0x1e7288[_0xf6fe('0x135')]===utils['CAMPAIGN_STATUS'][_0xf6fe('0x13c')]&&!_0x5c92c7){return _0x589b70['ifTime'](_0x1e7288,!![])[_0xf6fe('0x3e')](function(){return _0x589b70[_0xf6fe('0x91')](_0x1e7288,![]);})['then'](function(){return _0x589b70[_0xf6fe('0xad')](_0x1e7288);})[_0xf6fe('0x9f')](function(_0x4ee0aa){loggerSyncQueueSummary[_0xf6fe('0x43')](_0xf6fe('0x13d'),util['inspect'](_0x4ee0aa,{'showHidden':![],'depth':null}));clearPredictiveAttributes(_0x1e7288);});}else{clearPredictiveAttributes(_0x1e7288);}})[_0xf6fe('0x3e')](function(){var _0x3751fc=_0x1418f9[_0xf6fe('0x13e')](_0x1e7288);if(_0x3751fc||_0x1e7288['queueSummaryCountersUpdated']){_0x1e7288[_0xf6fe('0x13f')]=![];_0x1418f9[_0xf6fe('0x140')](_0x1e7288);Object[_0xf6fe('0x141')](_0x1e7288,_0x1418f9);emitOutboundVoiceQueueSummary(_0x1418f9);}_0x589b70[_0xf6fe('0x2b')][_0x1e7288[_0xf6fe('0x48')]][_0xf6fe('0x133')]=![];})[_0xf6fe('0x9f')](function(_0x596ded){logger['error']('[syncQueueSummary]',util[_0xf6fe('0x45')](_0x596ded,{'showHidden':![],'depth':null}));_0x589b70['queuesSummary'][_0x1e7288[_0xf6fe('0x48')]][_0xf6fe('0x133')]=![];});};Dialer['prototype'][_0xf6fe('0x34')]=_[_0xf6fe('0x142')](function(){var _0x5b1f84=_[_0xf6fe('0x143')](this['voiceQueues'],function(_0x2d84f6){return _0x2d84f6['dialPreviewRecallmeReminder'];});var _0x586655=_['filter'](this[_0xf6fe('0x1f')],function(_0x202503){return _0x202503[_0xf6fe('0x144')]&&_0x202503['status']===_0xf6fe('0x8a');});if(_0x5b1f84[_0xf6fe('0x99')]>0x0&&_0x586655[_0xf6fe('0x99')]>0x0){return Promise[_0xf6fe('0x137')]()[_0xf6fe('0x3e')](cmHopper[_0xf6fe('0x145')](_[_0xf6fe('0x146')](_0x5b1f84,'id'),previewRecallmeReminderInterval,_[_0xf6fe('0x146')](_0x586655,'id')))[_0xf6fe('0x3e')](function(_0xa735f8){for(var _0x143782=0x0;_0x143782<_0xa735f8[_0xf6fe('0x99')];_0x143782++){var _0x31d3d1=_0xa735f8[_0x143782][_0xf6fe('0x147')][_0xf6fe('0x48')];if(_0x31d3d1)io['to'](util['format'](_0xf6fe('0x148'),_0x31d3d1))[_0xf6fe('0x113')](_0xf6fe('0x149'),{'hopper':_0xa735f8[_0x143782]});}})[_0xf6fe('0x9f')](function(_0x1b10f5){logger[_0xf6fe('0x66')](_0xf6fe('0x14a'),_0x1b10f5);});}},0x3c*0x3e8,{'leading':!![]});Dialer[_0xf6fe('0x17')][_0xf6fe('0x14b')]=function(){var _0x190092=this;setInterval(function(){_0x190092['clearZombieChannels'](_0x190092[_0xf6fe('0x25')],_0xf6fe('0x14c'));_0x190092[_0xf6fe('0x14d')](_0x190092[_0xf6fe('0x23')],_0xf6fe('0x14e'));},0x32c8);};Dialer['prototype'][_0xf6fe('0x14d')]=function(_0x4cd9fd,_0xf9a91b){var _0x46d325=this;for(var _0x5e5a4a in _0x4cd9fd){if(typeof _0x4cd9fd[_0x5e5a4a]!=='undefined'){this[_0xf6fe('0x1b')]['enqueue'](function(){if(!_[_0xf6fe('0xee')](_0x4cd9fd[_0x5e5a4a])){return ami[_0xf6fe('0x14f')]({'action':_0xf6fe('0x89'),'channel':_0x4cd9fd[_0x5e5a4a][_0xf6fe('0xea')]})[_0xf6fe('0x9f')](function(_0x30d07b){if(_0x30d07b['message']===_0xf6fe('0x150')){setTimeout(function(){if(_0x4cd9fd[_0x5e5a4a]&&_0x4cd9fd[_0x5e5a4a][_0xf6fe('0x41')]!==_0xf6fe('0xbc')){_0x46d325[_0xf6fe('0xbd')](_0x46d325[_0xf6fe('0x1d')][_0x4cd9fd[_0x5e5a4a][_0xf6fe('0xba')]]);logger[_0xf6fe('0x66')](_0xf6fe('0x151'),_0xf9a91b,_0x5e5a4a,_0x4cd9fd[_0x5e5a4a][_0xf6fe('0xba')]);delete _0x4cd9fd[_0x5e5a4a];}if(_0x4cd9fd[_0x5e5a4a]&&_0x4cd9fd[_0x5e5a4a][_0xf6fe('0x41')]===_0xf6fe('0xbc')){_0x46d325[_0xf6fe('0xbd')](_0x46d325[_0xf6fe('0x1e')][_0x4cd9fd[_0x5e5a4a]['queue']]);logger[_0xf6fe('0x66')]('[Dialer][checkChannel][ivr]',_0xf9a91b,_0x5e5a4a,_0x4cd9fd[_0x5e5a4a][_0xf6fe('0xba')]);delete _0x4cd9fd[_0x5e5a4a];}},0x2328);}});}});}}};Dialer['prototype'][_0xf6fe('0x152')]=function(_0x570d0d){return Promise['resolve']()['then'](voiceQueueRt['getVoiceQueueRtPauses'](_0x570d0d))[_0xf6fe('0x9f')](loggerCatch(_0xf6fe('0x153')));};Dialer[_0xf6fe('0x17')]['updateOriginated']=function(_0x562b67){if(!_[_0xf6fe('0x40')](_0x562b67)&&_0x562b67!==null){if(typeof _0x562b67[_0xf6fe('0x7e')]!=='undefined'){if(_0x562b67[_0xf6fe('0x7e')]>0x0){_0x562b67[_0xf6fe('0x7e')]-=0x1;}else{logger['error'](_0xf6fe('0x154'));}}}else{logger[_0xf6fe('0x66')](_0xf6fe('0x155'));}};Dialer['prototype'][_0xf6fe('0x156')]=function(_0x4839ab,_0x36d318){var _0x3ce70e=this;return function(_0x781ca8){_0x3ce70e[_0xf6fe('0xbd')](_0x36d318);logger[_0xf6fe('0x66')](_0x4839ab,util[_0xf6fe('0x45')](_0x781ca8,{'showHidden':![],'depth':null}));};};Dialer[_0xf6fe('0x17')][_0xf6fe('0x157')]=function(_0x13e890,_0x12a978,_0x2c0bc0){var _0x500896={'state':0x19,'statedesc':_0xf6fe('0x158')};this[_0xf6fe('0xbd')](_0x12a978);this[_0xf6fe('0x116')](_[_0xf6fe('0x62')](_0x500896,_[_0xf6fe('0xf2')](_0x2c0bc0,['ContactId',_0xf6fe('0xdb'),'UserId',_0xf6fe('0xdc'),'CampaignId'])),_0xf6fe('0x159'),'[emptyContact]');logger[_0xf6fe('0x66')](_0x13e890);};Dialer[_0xf6fe('0x17')][_0xf6fe('0x116')]=function(_0x42cd3f,_0x53d8d5,_0x4f9bb7){hopperUtils[_0xf6fe('0xc3')](_0x42cd3f)[_0xf6fe('0x9f')](loggerCatch(_0x53d8d5));hopperUtils['moveContactManagedDialer'](_0x42cd3f)['catch'](loggerCatch(_0x4f9bb7));};Dialer[_0xf6fe('0x17')][_0xf6fe('0xd6')]=function(_0x25fdb9,_0x362ae9){hopperUtils[_0xf6fe('0xc3')](_0x25fdb9)[_0xf6fe('0x9f')](loggerCatch(_0xf6fe('0xc4')));if(_0x362ae9==0x0){hopperUtils[_0xf6fe('0xc5')](_0x25fdb9)['catch'](loggerCatch(_0xf6fe('0x15a')));}};Dialer[_0xf6fe('0x17')][_0xf6fe('0x14a')]=function(_0x24bd44){return Promise[_0xf6fe('0x137')]()['then'](cmHopper[_0xf6fe('0x145')](_0x24bd44['id'],previewRecallmeReminderInterval))[_0xf6fe('0x3e')](function(_0x562bf7){for(var _0x30e15d=0x0;_0x30e15d<_0x562bf7[_0xf6fe('0x99')];_0x30e15d++){var _0x1e7dab=_0x562bf7[_0x30e15d]['Agent'][_0xf6fe('0x48')];if(_0x1e7dab)io['to'](util[_0xf6fe('0x46')]('user:%s',_0x1e7dab))[_0xf6fe('0x113')](_0xf6fe('0x149'),{'hopper':_0x562bf7[_0x30e15d]});}})['catch'](function(){});};Dialer[_0xf6fe('0x17')]['launchHandleIvr']=function(_0x2ffe28){var _0x156775=this;return function(){_0x156775[_0xf6fe('0x15b')](_0x2ffe28);};};Dialer['prototype']['actionOriginate']=function(_0x151a8b,_0x344df0){var _0x45f2f2=this;var _0x1f0414=uuid['v4']();this[_0xf6fe('0x23')][_0x1f0414]=new Action(_0x151a8b,_0x344df0,_0x1f0414);return new Promise(function(_0x24913b,_0x4a7689){if(_['isUndefined'](_0x151a8b)&&typeof _0x151a8b!==_0xf6fe('0x15c')){return _0x4a7689(msgResponse(_0xf6fe('0x15d'),_0xf6fe('0x92'),_0xf6fe('0x15e')));}if(_['isUndefined'](_0x344df0['phone'])||_0x344df0[_0xf6fe('0x15f')]===null){return _0x4a7689(msgResponse(_0xf6fe('0x15d'),_0xf6fe('0x92'),_0xf6fe('0x160')));}var _0x50aafb={'XMD-CALLERID':_0x45f2f2[_0xf6fe('0x23')][_0x1f0414][_0xf6fe('0x161')](),'XMD-AGI':_0x151a8b[_0xf6fe('0x12f')]?util['format'](_0xf6fe('0x162'),ipAgi,_0x151a8b[_0xf6fe('0x12f')]):_0xf6fe('0x163'),'XMD-AGIAFTER':_0x151a8b['dialQueueProject2']?util[_0xf6fe('0x46')](_0xf6fe('0x162'),ipAgi,_0x151a8b['dialQueueProject2']):_0xf6fe('0x163'),'XMD-QUEUE':utils[_0xf6fe('0x164')](_0x151a8b)?util[_0xf6fe('0x46')](_0xf6fe('0x165'),_0x151a8b['name'],_0x151a8b[_0xf6fe('0x166')]||'',_0x151a8b['dialAgiAfterHangupAgent']?'c':'',_0x151a8b[_0xf6fe('0xc9')]||0x3):_0xf6fe('0x163'),'XMD-CONTACTID':_0x344df0[_0xf6fe('0xda')],'XMD-CDRTYPE':'dialer','CALLERID(all)':_0x45f2f2[_0xf6fe('0x23')][_0x1f0414][_0xf6fe('0x161')](),'XMD-AMD':_0x151a8b['dialAMDActive']?'ACTIVE':_0xf6fe('0x163'),'XMD-DESTINATION':_0xf6fe('0x10b')};if(_0x151a8b[_0xf6fe('0x10c')]){_0x50aafb['XMD-AMDINITIALSILENCE']=_0x151a8b[_0xf6fe('0x167')]||0x9c4;_0x50aafb['XMD-AMDGREETING']=_0x151a8b[_0xf6fe('0x168')]||0x5dc;_0x50aafb[_0xf6fe('0x169')]=_0x151a8b[_0xf6fe('0x16a')]||0x320;_0x50aafb[_0xf6fe('0x16b')]=_0x151a8b[_0xf6fe('0x16c')]||0x1388;_0x50aafb[_0xf6fe('0x16d')]=_0x151a8b[_0xf6fe('0x16e')]||0x64;_0x50aafb[_0xf6fe('0x16f')]=_0x151a8b[_0xf6fe('0x170')]||0x32;_0x50aafb[_0xf6fe('0x171')]=_0x151a8b['dialAMDMaximumNumberOfWords']||0x3;_0x50aafb[_0xf6fe('0x172')]=_0x151a8b[_0xf6fe('0x173')]||0x100;_0x50aafb['XMD-AMDMAXIMUMWORDLENGTH']=_0x151a8b[_0xf6fe('0x174')]||0x1388;}if(utils[_0xf6fe('0x164')](_0x151a8b)){_0x50aafb['XMD-VOICEQUEUEID']=_0x344df0[_0xf6fe('0xdc')];}else{_0x50aafb['XMD-CAMPAIGNID']=_0x344df0[_0xf6fe('0xdd')];}var _0x309c10=utils[_0xf6fe('0x175')](_0x344df0['Contact']);Object[_0xf6fe('0x141')](_0x50aafb,_0x309c10);var _0x426f45=_0x45f2f2[_0xf6fe('0x86')](_0x151a8b[_0xf6fe('0x176')])?utils[_0xf6fe('0x177')](_0x151a8b[_0xf6fe('0x176')][_0xf6fe('0x178')],_0x151a8b[_0xf6fe('0x179')],_0x151a8b[_0xf6fe('0x17a')]>0x0?utils['getCallerIdRandom'](_0x151a8b[_0xf6fe('0x17b')],_0x151a8b[_0xf6fe('0x17a')]):_0x151a8b[_0xf6fe('0x17b')]):utils[_0xf6fe('0x177')](_[_0xf6fe('0xee')](_0x151a8b[_0xf6fe('0x8c')])?_0x151a8b[_0xf6fe('0x176')]['callerid']:_0x151a8b[_0xf6fe('0x8c')][_0xf6fe('0x178')],_0x151a8b[_0xf6fe('0x179')],_0x151a8b[_0xf6fe('0x17a')]>0x0?utils['getCallerIdRandom'](_0x151a8b[_0xf6fe('0x17b')],_0x151a8b[_0xf6fe('0x17a')]):_0x151a8b[_0xf6fe('0x17b')]);if(_0x426f45){_0x50aafb['XMD-ORIGINATECALLERIDNAME']=_0x45f2f2[_0xf6fe('0x23')][_0x1f0414][_0xf6fe('0x17c')]=utils['extractCalleridName'](_0x426f45);_0x50aafb[_0xf6fe('0x17d')]=_0x344df0['phone'];}_0x151a8b[_0xf6fe('0x17e')]=_0x50aafb;return ami['Action']({'actionid':_0x1f0414,'action':_0xf6fe('0x15d'),'channel':_0x45f2f2[_0xf6fe('0x86')](_0x151a8b[_0xf6fe('0x176')])?util['format']('SIP/%s/%s%s',_0x151a8b['Trunk'][_0xf6fe('0x48')],isNotNull(_0x151a8b[_0xf6fe('0x17f')])?_0x151a8b[_0xf6fe('0x17f')][_0xf6fe('0x180')]()||'':'',_0x151a8b['dialCutDigit']>0x0?_0x344df0['phone'][_0xf6fe('0x181')](_0x151a8b['dialCutDigit']):_0x344df0[_0xf6fe('0x15f')]):util[_0xf6fe('0x46')](_0xf6fe('0x182'),_[_0xf6fe('0xee')](_0x151a8b['TrunkBackup'])?_0x151a8b[_0xf6fe('0x176')][_0xf6fe('0x48')]:_0x151a8b[_0xf6fe('0x8c')][_0xf6fe('0x48')],isNotNull(_0x151a8b[_0xf6fe('0x17f')])?_0x151a8b[_0xf6fe('0x17f')][_0xf6fe('0x180')]()||'':'',_0x151a8b[_0xf6fe('0x183')]>0x0?_0x344df0['phone']['substring'](_0x151a8b[_0xf6fe('0x183')]):_0x344df0[_0xf6fe('0x15f')]),'callerid':_0x426f45,'Exten':_0xf6fe('0x10b'),'Context':'from-sip','Priority':'1','variable':_0x50aafb,'timeout':(_0x151a8b[_0xf6fe('0x184')]||0x1e)*0x3e8,'async':!![],'channelid':_0x1f0414})[_0xf6fe('0x3e')](function(_0x2d138e){return _0x24913b(_0x2d138e);})['catch'](function(_0x3239f4){_0x151a8b[_0xf6fe('0x185')]+=0x1;var _0x8048b5=new History(_0x45f2f2[_0xf6fe('0x23')][_0x1f0414]);logger[_0xf6fe('0x66')](util[_0xf6fe('0x46')](_0xf6fe('0x186'),JSON[_0xf6fe('0x75')](_0x3239f4)));_0x8048b5[_0xf6fe('0x6e')]=0xe;_0x8048b5['statedesc']=_0xf6fe('0x187');_0x8048b5[_0xf6fe('0x71')]=moment()[_0xf6fe('0x46')]('YYYY-MM-DD\x20HH:mm:ss');_0x8048b5['endtime']=_0x8048b5['starttime'];hopperUtils[_0xf6fe('0xc3')](_0x8048b5)[_0xf6fe('0x9f')](loggerCatch(_0xf6fe('0x188')));_0x45f2f2[_0xf6fe('0xc5')](_0x8048b5)[_0xf6fe('0x9f')](loggerCatch(_0xf6fe('0x188')))['finally'](function(){delete _0x45f2f2[_0xf6fe('0x23')][_0x1f0414];return _0x4a7689(msgResponse(_0xf6fe('0x15d'),'Error',_0xf6fe('0x189')));});});});};Dialer['prototype'][_0xf6fe('0x18a')]=function(_0x32931c,_0x517456,_0x50447f){var _0x3114d5=new History(_0x517456);if(_0x3114d5[_0xf6fe('0x11c')]+_0x3114d5[_0xf6fe('0x12a')]+_0x3114d5['countnoanswerretry']+_0x3114d5[_0xf6fe('0x11e')]+_0x3114d5[_0xf6fe('0xd8')]+_0x3114d5[_0xf6fe('0xe4')]+_0x3114d5['countmachineretry']+_0x3114d5[_0xf6fe('0x11f')]>=_0x50447f[_0xf6fe('0x120')]-0x1){return!![];}switch(_0x32931c){case 0x3:if(_0x3114d5[_0xf6fe('0x11d')]>=_0x50447f[_0xf6fe('0x18b')]-0x1){return!![];}hopperUtils[_0xf6fe('0xd7')]({'active':![],'countnoanswerretry':_0x3114d5[_0xf6fe('0x11d')]+=0x1,'scheduledat':moment()[_0xf6fe('0xe7')](_0x50447f[_0xf6fe('0x18c')],_0xf6fe('0xd9'))['format'](_0xf6fe('0xbe')),'ContactId':_0x3114d5[_0xf6fe('0xda')],'ListId':_0x3114d5[_0xf6fe('0xdb')],'VoiceQueueId':_0x3114d5[_0xf6fe('0xdc')]||undefined,'CampaignId':_0x3114d5[_0xf6fe('0xdd')]||undefined})['catch'](loggerCatch('[rescheduleContact][NoAnswer]'));break;case 0x5:if(_0x3114d5[_0xf6fe('0x11c')]>=_0x50447f[_0xf6fe('0x18d')]-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countbusyretry':_0x3114d5[_0xf6fe('0x11c')]+=0x1,'scheduledat':moment()[_0xf6fe('0xe7')](_0x50447f['dialBusyRetryFrequency'],_0xf6fe('0xd9'))['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x3114d5[_0xf6fe('0xda')],'ListId':_0x3114d5[_0xf6fe('0xdb')],'VoiceQueueId':_0x3114d5[_0xf6fe('0xdc')]||undefined,'CampaignId':_0x3114d5[_0xf6fe('0xdd')]||undefined})[_0xf6fe('0x9f')](loggerCatch(_0xf6fe('0x18e')));break;case 0x8:if(_0x3114d5['countcongestionretry']>=_0x50447f[_0xf6fe('0x18f')]-0x1){return!![];}hopperUtils[_0xf6fe('0xd7')]({'active':![],'countcongestionretry':_0x3114d5[_0xf6fe('0x12a')]+=0x1,'scheduledat':moment()['add'](_0x50447f[_0xf6fe('0x190')],'minutes')[_0xf6fe('0x46')](_0xf6fe('0xbe')),'ContactId':_0x3114d5[_0xf6fe('0xda')],'ListId':_0x3114d5[_0xf6fe('0xdb')],'VoiceQueueId':_0x3114d5[_0xf6fe('0xdc')]||undefined,'CampaignId':_0x3114d5[_0xf6fe('0xdd')]||undefined})[_0xf6fe('0x9f')](loggerCatch(_0xf6fe('0x191')));break;case 0x0:if(_0x3114d5[_0xf6fe('0x11e')]>=_0x50447f['dialNoSuchNumberMaxRetry']-0x1){return!![];}else{hopperUtils[_0xf6fe('0xd7')]({'active':![],'countnosuchnumberretry':_0x3114d5[_0xf6fe('0x11e')]+=0x1,'scheduledat':moment()[_0xf6fe('0xe7')](_0x50447f['dialNoSuchNumberRetryFrequency'],_0xf6fe('0xd9'))[_0xf6fe('0x46')](_0xf6fe('0xbe')),'ContactId':_0x3114d5[_0xf6fe('0xda')],'ListId':_0x3114d5[_0xf6fe('0xdb')],'VoiceQueueId':_0x3114d5[_0xf6fe('0xdc')]||undefined,'CampaignId':_0x3114d5[_0xf6fe('0xdd')]||undefined})[_0xf6fe('0x9f')](loggerCatch(_0xf6fe('0x192')));}break;case 0xa:if(_0x3114d5['countdropretry']>=_0x50447f['dialDropMaxRetry']-0x1){return!![];}hopperUtils[_0xf6fe('0xd7')]({'active':![],'countdropretry':_0x3114d5[_0xf6fe('0xd8')]+=0x1,'scheduledat':moment()[_0xf6fe('0xe7')](_0x50447f[_0xf6fe('0xd0')],'minutes')[_0xf6fe('0x46')](_0xf6fe('0xbe')),'ContactId':_0x3114d5[_0xf6fe('0xda')],'ListId':_0x3114d5[_0xf6fe('0xdb')],'VoiceQueueId':_0x3114d5[_0xf6fe('0xdc')]||undefined,'CampaignId':_0x3114d5[_0xf6fe('0xdd')]||undefined})[_0xf6fe('0x9f')](loggerCatch(_0xf6fe('0xde')));break;case 0xb:if(_0x3114d5['countabandonedretry']>=_0x50447f[_0xf6fe('0xe6')]-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countabandonedretry':_0x3114d5['countabandonedretry']+=0x1,'scheduledat':moment()[_0xf6fe('0xe7')](_0x50447f[_0xf6fe('0xe5')],_0xf6fe('0xd9'))[_0xf6fe('0x46')](_0xf6fe('0xbe')),'ContactId':_0x3114d5[_0xf6fe('0xda')],'ListId':_0x3114d5[_0xf6fe('0xdb')],'VoiceQueueId':_0x3114d5[_0xf6fe('0xdc')]||undefined,'CampaignId':_0x3114d5['CampaignId']||undefined})['catch'](loggerCatch(_0xf6fe('0xe8')));break;case 0x13:if(_0x3114d5[_0xf6fe('0x119')]>=_0x50447f[_0xf6fe('0x123')]-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countmachineretry':_0x3114d5[_0xf6fe('0x119')]+=0x1,'scheduledat':moment()[_0xf6fe('0xe7')](_0x50447f[_0xf6fe('0x125')],_0xf6fe('0xd9'))[_0xf6fe('0x46')](_0xf6fe('0xbe')),'ContactId':_0x3114d5[_0xf6fe('0xda')],'ListId':_0x3114d5[_0xf6fe('0xdb')],'VoiceQueueId':_0x3114d5[_0xf6fe('0xdc')]||undefined,'CampaignId':_0x3114d5[_0xf6fe('0xdd')]||undefined})[_0xf6fe('0x9f')](loggerCatch('[rescheduleContact][Machine]'));break;case 0x14:if(_0x3114d5['countagentrejectretry']>=_0x50447f['dialAgentRejectMaxRetry']-0x1){return!![];}hopperUtils[_0xf6fe('0xd7')]({'active':![],'countagentrejectretry':_0x3114d5[_0xf6fe('0x11f')]+=0x1,'scheduledat':moment()[_0xf6fe('0xe7')](_0x50447f[_0xf6fe('0x193')],'minutes')[_0xf6fe('0x46')](_0xf6fe('0xbe')),'ContactId':_0x3114d5[_0xf6fe('0xda')],'ListId':_0x3114d5[_0xf6fe('0xdb')],'VoiceQueueId':_0x3114d5['VoiceQueueId']||undefined,'CampaignId':_0x3114d5[_0xf6fe('0xdd')]||undefined})['catch'](loggerCatch(_0xf6fe('0x194')));break;default:return!![];}};Dialer[_0xf6fe('0x17')][_0xf6fe('0x106')]=function(_0x325680,_0x565803,_0x345fb1){var _0x450247=this;var _0x45e88e=new History(_0x325680);var _0x4538ff=![];var _0x43ed70;var _0x14d1c7;return new Promise(function(_0x2fa574,_0x42f7bc){if(_[_0xf6fe('0x40')](_0x565803)&&typeof _0x565803!==_0xf6fe('0x15c')){return _0x42f7bc(msgResponse(_0xf6fe('0x195'),_0xf6fe('0x92'),'entity\x20is\x20undefine'));}if(_['isUndefined'](_0x345fb1)&&typeof _0x345fb1!==_0xf6fe('0x15c')){return _0x42f7bc(msgResponse(_0xf6fe('0x195'),_0xf6fe('0x92'),_0xf6fe('0x196')));}hopperUtils[_0xf6fe('0xd2')](_0x45e88e,_0x345fb1[_0xf6fe('0xbf')],_0x565803)[_0xf6fe('0x3e')](function(_0x5653ec){if(_0x5653ec[_0xf6fe('0xd4')]==0x1)_0x4538ff=!![];switch(_0x345fb1[_0xf6fe('0xbf')]){case'0':_0x565803[_0xf6fe('0x197')]+=0x1;_0x45e88e[_0xf6fe('0x6e')]=0x0;_0x45e88e['statedesc']=_0xf6fe('0x198');_0x45e88e[_0xf6fe('0x11e')]+=0x1;_0x45e88e[_0xf6fe('0xcf')]+=0x1;ami[_0xf6fe('0x113')](_0xf6fe('0x199'),ut['buildObj'](_0x325680,_0xf6fe('0x19a')));_0x43ed70=_0x565803['dialNoSuchNumberRetryFrequency'];_0x14d1c7=_0x565803[_0xf6fe('0xd1')];hopperUtils[_0xf6fe('0xc3')](_0x45e88e)[_0xf6fe('0x9f')](loggerCatch(_0xf6fe('0x11b')));if(_0x450247['checkRetriveMax'](0x0,_0x325680,_0x565803)&&!_0x4538ff){if(_0x45e88e['countnosuchnumberretry']>=_0x565803[_0xf6fe('0x19b')]){_0x450247['createStateFinal'](_0x45e88e,_0x2fa574,_0x42f7bc,_0xf6fe('0x19c'));}else{_0x450247[_0xf6fe('0x121')](_0x45e88e,_0x2fa574,_0x42f7bc,'reason\x200\x20no\x20such\x20number....');}}break;case'3':_0x565803[_0xf6fe('0x19d')]+=0x1;_0x45e88e[_0xf6fe('0x6e')]=0x3;_0x45e88e[_0xf6fe('0x6f')]=_0xf6fe('0x19e');_0x45e88e['countnoanswerretry']+=0x1;_0x45e88e['countglobal']+=0x1;var _0x3fa7d8=ut[_0xf6fe('0x19f')](_0x325680,_0x565803);ami[_0xf6fe('0x113')](_0xf6fe('0x1a0'),_0x3fa7d8);_0x43ed70=_0x565803[_0xf6fe('0x18c')];_0x14d1c7=_0x565803[_0xf6fe('0xd1')];hopperUtils[_0xf6fe('0xc3')](_0x45e88e)[_0xf6fe('0x9f')](loggerCatch('[syncAgentComplete][createHistory][3]'));if(_0x450247[_0xf6fe('0x18a')](0x3,_0x325680,_0x565803)&&!_0x4538ff){if(_0x45e88e[_0xf6fe('0x11d')]>=_0x565803['dialNoAnswerMaxRetry']){_0x450247[_0xf6fe('0x124')](_0x45e88e,_0x2fa574,_0x42f7bc,_0xf6fe('0x1a1'));}else{_0x450247[_0xf6fe('0x121')](_0x45e88e,_0x2fa574,_0x42f7bc,_0xf6fe('0x1a1'));}}break;case'5':_0x565803[_0xf6fe('0x1a2')]+=0x1;_0x45e88e['state']=0x5;_0x45e88e['statedesc']=_0xf6fe('0x1a3');_0x45e88e[_0xf6fe('0x11c')]+=0x1;_0x45e88e[_0xf6fe('0xcf')]+=0x1;ami[_0xf6fe('0x113')](_0xf6fe('0x1a4'),ut[_0xf6fe('0x115')](_0x325680,_0xf6fe('0x1a5')));_0x43ed70=_0x565803[_0xf6fe('0x1a6')];_0x14d1c7=_0x565803[_0xf6fe('0xd1')];hopperUtils['createHistory'](_0x45e88e)[_0xf6fe('0x9f')](loggerCatch(_0xf6fe('0x1a7')));if(_0x450247[_0xf6fe('0x18a')](0x5,_0x325680,_0x565803)&&!_0x4538ff){if(_0x45e88e['countbusyretry']>=_0x565803[_0xf6fe('0x18d')]){_0x450247['createStateFinal'](_0x45e88e,_0x2fa574,_0x42f7bc,_0xf6fe('0x1a8'));}else{_0x450247[_0xf6fe('0x121')](_0x45e88e,_0x2fa574,_0x42f7bc,_0xf6fe('0x1a8'));}}break;case'8':_0x565803[_0xf6fe('0x1a9')]+=0x1;_0x45e88e[_0xf6fe('0x6e')]=0x8;_0x45e88e[_0xf6fe('0x6f')]=_0xf6fe('0x1aa');_0x45e88e[_0xf6fe('0x12a')]+=0x1;_0x45e88e[_0xf6fe('0xcf')]+=0x1;_0x43ed70=_0x565803['dialCongestionRetryFrequency'];_0x14d1c7=_0x565803[_0xf6fe('0xd1')];ami[_0xf6fe('0x113')]('custom:agentcongestion',ut['buildObj'](_0x325680,_0xf6fe('0x1ab')));hopperUtils[_0xf6fe('0xc3')](_0x45e88e)[_0xf6fe('0x9f')](loggerCatch(_0xf6fe('0x1ac')));if(_0x450247['checkRetriveMax'](0x8,_0x325680,_0x565803)&&!_0x4538ff){if(_0x45e88e['countcongestionretry']>=_0x565803[_0xf6fe('0x18f')]){_0x450247[_0xf6fe('0x124')](_0x45e88e,_0x2fa574,_0x42f7bc,_0xf6fe('0x1ad'));}else{_0x450247[_0xf6fe('0x121')](_0x45e88e,_0x2fa574,_0x42f7bc,_0xf6fe('0x1ad'));}}break;case'11':_0x565803[_0xf6fe('0x1ae')]+=0x1;_0x45e88e[_0xf6fe('0x6e')]=0xb;_0x45e88e['statedesc']='Abandoned';_0x45e88e[_0xf6fe('0xe4')]+=0x1;_0x45e88e[_0xf6fe('0xcf')]+=0x1;_0x43ed70=_0x565803[_0xf6fe('0xe5')];_0x14d1c7=_0x565803[_0xf6fe('0xd1')];hopperUtils[_0xf6fe('0xc3')](_0x45e88e)[_0xf6fe('0x9f')](loggerCatch('[syncAgentComplete][createHistory][11]'));if(_0x450247[_0xf6fe('0x18a')](0xb,_0x325680,_0x565803)&&!_0x4538ff){if(_0x45e88e[_0xf6fe('0xe4')]>=_0x565803['dialAbandonedMaxRetry']){_0x450247['createStateFinal'](_0x45e88e,_0x2fa574,_0x42f7bc,_0xf6fe('0x1af'));}else{_0x450247[_0xf6fe('0x121')](_0x45e88e,_0x2fa574,_0x42f7bc,_0xf6fe('0x1af'));}}break;case'20':_0x565803['outboundRejectCallsDay']+=0x1;_0x45e88e[_0xf6fe('0x6e')]=0x14;_0x45e88e[_0xf6fe('0x6f')]=_0xf6fe('0x1b0');_0x45e88e[_0xf6fe('0x11f')]+=0x1;_0x45e88e[_0xf6fe('0xcf')]+=0x1;_0x43ed70=_0x565803[_0xf6fe('0x193')];_0x14d1c7=_0x565803[_0xf6fe('0xd1')];ami[_0xf6fe('0x113')](_0xf6fe('0x1b1'),ut['buildObj'](_0x325680,_0xf6fe('0x1b2')));hopperUtils[_0xf6fe('0xc3')](_0x45e88e)[_0xf6fe('0x9f')](loggerCatch(_0xf6fe('0x1b3')));if(_0x450247[_0xf6fe('0x18a')](0x14,_0x325680,_0x565803)&&!_0x4538ff){if(_0x45e88e[_0xf6fe('0x11f')]>=_0x565803['dialAgentRejectMaxRetry']){_0x450247[_0xf6fe('0x124')](_0x45e88e,_0x2fa574,_0x42f7bc,_0xf6fe('0x1b4'));}else{_0x450247[_0xf6fe('0x121')](_0x45e88e,_0x2fa574,_0x42f7bc,_0xf6fe('0x1b4'));}}break;default:_0x565803[_0xf6fe('0x1b5')]+=0x1;_0x45e88e[_0xf6fe('0x6e')]=0xc;_0x45e88e['statedesc']=_0x345fb1[_0xf6fe('0xbf')];_0x43ed70=_0x565803['dialAgentRejectRetryFrequency'];_0x14d1c7=_0x565803[_0xf6fe('0xd1')];hopperUtils['createHistory'](_0x45e88e)[_0xf6fe('0x9f')](loggerCatch(_0xf6fe('0x1b6')));if(_0x450247[_0xf6fe('0x18a')](_0x345fb1['reason'],_0x325680,_0x565803)&&!_0x4538ff){if(_0x45e88e['countbusyretry']+_0x45e88e[_0xf6fe('0x12a')]+_0x45e88e[_0xf6fe('0x11d')]+_0x45e88e[_0xf6fe('0x11e')]+_0x45e88e['countdropretry']+_0x45e88e[_0xf6fe('0xe4')]+_0x45e88e[_0xf6fe('0x119')]+_0x45e88e[_0xf6fe('0x11f')]>=_0x565803[_0xf6fe('0x120')]){_0x450247[_0xf6fe('0x121')](_0x45e88e,_0x2fa574,_0x42f7bc,_0x345fb1[_0xf6fe('0xbf')]);}else{_0x450247[_0xf6fe('0x124')](_0x45e88e,_0x2fa574,_0x42f7bc,_0x345fb1[_0xf6fe('0xbf')]);}}}})[_0xf6fe('0x3e')](function(){if(_0x4538ff){hopperUtils[_0xf6fe('0xe2')](_0x45e88e,_0x43ed70,_0x14d1c7)[_0xf6fe('0x3e')](function(){return _0x2fa574(0x1);});}});});};Dialer[_0xf6fe('0x17')][_0xf6fe('0x121')]=function(_0x2a2883,_0x35e81b,_0x2335da,_0x338ac2){var _0x187c04=new Final(_0x2a2883);_0x187c04['state']=0xf;_0x187c04[_0xf6fe('0x6f')]=_0xf6fe('0x1b7');this[_0xf6fe('0x124')](_0x187c04,_0x35e81b,_0x2335da,_0x338ac2);};Dialer[_0xf6fe('0x17')][_0xf6fe('0x124')]=function(_0x3875eb,_0x4239cd,_0x18e374,_0x545d96){hopperUtils['moveContactManagedDialer'](_0x3875eb)[_0xf6fe('0x3e')](function(){return _0x4239cd(msgResponse(_0xf6fe('0x195'),_0xf6fe('0x105'),_0x545d96));})[_0xf6fe('0x9f')](function(){return _0x18e374(msgResponse('[moveContactManagedDialer][0]',_0xf6fe('0x92'),_0xf6fe('0x1b8')));});};Dialer[_0xf6fe('0x17')]['predictive']=function(_0x4692c4){var _0x4b8b07=_0x4692c4[_0xf6fe('0x1b9')]/0x64;var _0x4e5516=_0x4692c4[_0xf6fe('0x1ba')]/(_0x4692c4[_0xf6fe('0x1ba')]+_0x4692c4['outboundAnswerCallsDay']);var _0x37356=Math[_0xf6fe('0x1bb')](_0x4692c4[_0xf6fe('0x1bc')]*(_0x4692c4[_0xf6fe('0x1bd')]/0x64));var _0xae3410=Math['round'](_0x4692c4[_0xf6fe('0x1bc')]*(_0x4692c4[_0xf6fe('0x1be')]/0x64));var _0x2df739=_0x4692c4['available']+_0x4692c4['talking'];var _0x4a878b=Math[_0xf6fe('0x1bf')](_0x4692c4[_0xf6fe('0x5b')]*_0x4692c4[_0xf6fe('0x5f')]*_0x4692c4[_0xf6fe('0x1c0')]*_0x4692c4[_0xf6fe('0x1c1')]);if(_[_0xf6fe('0x40')](_0x4692c4[_0xf6fe('0x27')])){if(!_[_0xf6fe('0x40')](_0x4692c4[_0xf6fe('0x63')])){_0x4692c4['startPredictive']=undefined;loggerPredictive[_0xf6fe('0x66')](_0xf6fe('0x1c2'),_0xf6fe('0x1c3'));}if(!_[_0xf6fe('0x40')](_0x4692c4['handlePredictive'])){loggerPredictive[_0xf6fe('0x66')](_0xf6fe('0x1c2'),_0xf6fe('0x1c4'));clearInterval(_0x4692c4[_0xf6fe('0x65')]);_0x4692c4[_0xf6fe('0x65')]=undefined;}_0x4692c4[_0xf6fe('0x27')]=moment()[_0xf6fe('0x46')](_0xf6fe('0xbe'));loggerPredictive[_0xf6fe('0x4b')](_0x4692c4[_0xf6fe('0x48')],_0xf6fe('0x1c5'),_0x4692c4[_0xf6fe('0x27')]);this['handlePower'](_0x4692c4,0x1);}else if(ifInterval(_0x4692c4[_0xf6fe('0x1c6')],_0x4692c4['startProgressive'])){this[_0xf6fe('0xaf')](_0x4692c4,0x1);loggerPredictiveCalls[_0xf6fe('0x4b')](_0xf6fe('0x1c7'),_0x4692c4['startProgressive'],_0x4692c4[_0xf6fe('0x48')]);_0x4692c4[_0xf6fe('0x5b')]=0x0;_0x4692c4[_0xf6fe('0xca')]=0x0;}else if(_0x4b8b07<_0x4e5516&&_0x4692c4['dialPredictiveOptimization']===_0xf6fe('0x1c8')){clearPredictiveAttributes(_0x4692c4);loggerPredictive['info'](_0xf6fe('0x1c9'),'Dropped\x20calls\x20day',_0x4e5516,_0xf6fe('0x27'),_0x4692c4[_0xf6fe('0x48')]);}else if(_0x4a878b<_0x4692c4[_0xf6fe('0xca')]&&_0x4692c4[_0xf6fe('0x1ca')]===_0xf6fe('0x1c8')){clearPredictiveAttributes(_0x4692c4);loggerPredictive[_0xf6fe('0x4b')]('[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Max\x20Drop\x20',_0x4a878b,_0xf6fe('0x1cb'),_0x4692c4[_0xf6fe('0xca')],_0xf6fe('0x27'),_0x4692c4[_0xf6fe('0x48')]);}else if(!ifInterval(_0x4692c4['dialPredictiveInterval'],_0x4692c4['startProgressive'])&&_[_0xf6fe('0x40')](_0x4692c4['startPredictive'])&&!_[_0xf6fe('0x40')](_0x4692c4[_0xf6fe('0x27')])){_0x4692c4[_0xf6fe('0x63')]=moment()[_0xf6fe('0x46')](_0xf6fe('0xbe'));loggerPredictive[_0xf6fe('0x4b')](_0x4692c4[_0xf6fe('0x48')],_0xf6fe('0x1cc'),_0x4692c4[_0xf6fe('0x63')]);hopperUtils['avgHandleTime'](_0x4692c4[_0xf6fe('0x1c6')])['then'](this[_0xf6fe('0x1cd')](_0x4692c4))[_0xf6fe('0x3e')](mergeDataErlangB(_0x4692c4))[_0xf6fe('0x3e')](this['startMethodPredictive'](_0x4692c4))['catch'](loggerCatchPredictive(_0xf6fe('0x1ce'),_0x4692c4));}else if(!ifInterval(_0x4692c4[_0xf6fe('0x1c6')],_0x4692c4['startPredictive'])){_0x4692c4[_0xf6fe('0xca')]=0x0;_0x4692c4['startPredictive']=moment()['format'](_0xf6fe('0xbe'));loggerPredictive[_0xf6fe('0x4b')](_0x4692c4[_0xf6fe('0x48')],_0xf6fe('0x1cf'),_0x4692c4['startPredictive']);clearInterval(_0x4692c4['handlePredictive']);_0x4692c4[_0xf6fe('0x65')]=undefined;hopperUtils[_0xf6fe('0x1d0')](_0x4692c4[_0xf6fe('0x1c6')])['then'](this[_0xf6fe('0x1cd')](_0x4692c4))['then'](mergeDataErlangB(_0x4692c4))['then'](this['startMethodPredictive'](_0x4692c4))[_0xf6fe('0x9f')](loggerCatchPredictive(_0xf6fe('0x1d1'),_0x4692c4));}else if(_0x4692c4[_0xf6fe('0x1bc')]&&_0x2df739<_0x4692c4[_0xf6fe('0x1bc')]-_0xae3410){clearPredictiveAttributes(_0x4692c4);loggerPredictive['info'](_0x4692c4[_0xf6fe('0x48')],'switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',_0x2df739,_0xf6fe('0x1d2'),_0x4692c4[_0xf6fe('0x1bc')],'-',_0xae3410,'=',_0x4692c4[_0xf6fe('0x1bc')]-_0xae3410,')');}else if(_0x4692c4[_0xf6fe('0x1bc')]&&_0x2df739>_0x4692c4[_0xf6fe('0x1bc')]+_0x37356){clearPredictiveAttributes(_0x4692c4);loggerPredictive[_0xf6fe('0x4b')](_0x4692c4[_0xf6fe('0x48')],_0xf6fe('0x1d3'),_0x2df739,_0xf6fe('0x1d4'),_0x4692c4[_0xf6fe('0x1bc')],'+',_0x37356,'=',_0x4692c4[_0xf6fe('0x1bc')]+_0x37356,')');}};Dialer['prototype'][_0xf6fe('0x1cd')]=function(_0x3b8253){var _0x2a0216=this;return function(_0x266f7f){return new Promise(function(_0x4af9cf,_0x5bb619){_[_0xf6fe('0x62')](_0x3b8253,_0x266f7f[0x0]);if(checkGetDataPredictive(_0x266f7f[0x0])){var _0x2edda4=_0x3b8253['predictiveIntervalAvailable']=_0x3b8253['talking']+_0x3b8253[_0xf6fe('0x138')];var _0x233eb3=_0x3b8253[_0xf6fe('0x1c6')]*0x3c;var _0x4ba459=_0x266f7f[0x0]['predictiveIntervalAvgTalktime']+_0x266f7f[0x0][_0xf6fe('0x54')];var _0x52424d=(_0x266f7f[0x0][_0xf6fe('0x50')]+_0x266f7f[0x0][_0xf6fe('0x52')]+_0x266f7f[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0x266f7f[0x0][_0xf6fe('0x4e')];_0x3b8253[_0xf6fe('0x1c0')]=_0x52424d>0x0?_0x52424d:0x1;switch(_0x3b8253[_0xf6fe('0x1ca')]){case'dropRate':var _0x1e4905=_0x3b8253[_0xf6fe('0x1b9')]/0x64;return _0x2a0216[_0xf6fe('0x1d5')](_0x2edda4,_0x233eb3,_0x4ba459,_0x52424d,_0x1e4905)[_0xf6fe('0x3e')](function(_0x1d8219){return _0x4af9cf(_0x1d8219);});case _0xf6fe('0x1d6'):var _0x3ebf76=_0x3b8253[_0xf6fe('0x1b9')]/0x64;return _0x2a0216[_0xf6fe('0x1d7')](_0x2edda4,_0x233eb3,_0x4ba459,_0x52424d,_0x3ebf76)[_0xf6fe('0x3e')](function(_0x1e6ec4){return _0x4af9cf(_0x1e6ec4);});default:return _0x5bb619(msgResponse(_0xf6fe('0x1d8'),_0xf6fe('0x92'),_0xf6fe('0x1d9')));}}else{return _0x5bb619(msgResponse(_0xf6fe('0x1d8'),_0xf6fe('0x92'),'check\x20failure'));}});};};Dialer['prototype'][_0xf6fe('0x1da')]=function(_0xdb014){var _0x424fbe=this;return function(_0x5bceb8){return new Promise(function(_0x1c51bb,_0x422929){_[_0xf6fe('0x62')](_0xdb014,_0x5bceb8[0x0]);if(checkGetDataPredictive(_0x5bceb8[0x0])){loggerPredictive[_0xf6fe('0x4b')](JSON['stringify'](_0x5bceb8[0x0]));if(_0xdb014[_0xf6fe('0x1ca')]===_0xf6fe('0x1c8')){return _0x424fbe['getVoiceQueueRtPauses'](_0xdb014['id'])['then'](function(_0x2784d8){var _0x307d42=_0xdb014[_0xf6fe('0x1db')]-_0x2784d8[0x0]['outboundQueuePauses'];var _0x14e2cf=_0xdb014['dialPredictiveInterval']*0x3c;var _0x20d963=_0x5bceb8[0x0][_0xf6fe('0x57')]+_0x5bceb8[0x0]['predictiveIntervalAvgHoldtime'];var _0x3c287b=(_0x5bceb8[0x0]['predictiveIntervalAnsweredCalls']+_0x5bceb8[0x0]['predictiveIntervalDroppedCallsTimeout']+_0x5bceb8[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0x5bceb8[0x0]['predictiveIntervalTotalCalls'];var _0x4ee8ef=_0xdb014[_0xf6fe('0x1b9')]/0x64;_0xdb014['predictiveIntervalPauses']=_0x2784d8[0x0][_0xf6fe('0x1dc')]||0x0;_0xdb014[_0xf6fe('0x1c0')]=_0x3c287b>0x0?_0x3c287b:0x1;return _0x424fbe[_0xf6fe('0x1d5')](_0x307d42,_0x14e2cf,_0x20d963,_0x3c287b,_0x4ee8ef);})[_0xf6fe('0x3e')](function(_0x2b486c){return _0x1c51bb(_0x2b486c);})[_0xf6fe('0x9f')](function(_0x359751){return _0x422929(msgResponse(_0xf6fe('0x1dd'),_0xf6fe('0x92'),JSON[_0xf6fe('0x75')](_0x359751)));});}if(_0xdb014[_0xf6fe('0x1ca')]==='agentBusyFactor'){return _0x424fbe['getVoiceQueueRtPauses'](_0xdb014['id'])[_0xf6fe('0x3e')](function(_0x4b43ff){var _0x291df9=_0xdb014['loggedIn']-_0x4b43ff[0x0][_0xf6fe('0x1dc')];var _0x191986=_0xdb014[_0xf6fe('0x1c6')]*0x3c;var _0x38d214=_0x5bceb8[0x0][_0xf6fe('0x57')]+_0x5bceb8[0x0]['predictiveIntervalAvgHoldtime'];var _0x263758=(_0x5bceb8[0x0][_0xf6fe('0x50')]+_0x5bceb8[0x0][_0xf6fe('0x52')]+_0x5bceb8[0x0][_0xf6fe('0x53')])/_0x5bceb8[0x0]['predictiveIntervalTotalCalls'];var _0x38dd4a=_0xdb014['dialPredictiveOptimizationPercentage']/0x64;_0xdb014[_0xf6fe('0x1de')]=_0x4b43ff[0x0]['outboundQueuePauses']||0x0;_0xdb014['predictiveIntervalHitRate']=_0x263758>0x0?_0x263758:0x1;return _0x424fbe[_0xf6fe('0x1d7')](_0x291df9,_0x191986,_0x38d214,_0x263758,_0x38dd4a);})[_0xf6fe('0x3e')](function(_0x2ce5a9){return _0x1c51bb(_0x2ce5a9);})['catch'](function(_0x323bb4){return _0x422929(msgResponse(_0xf6fe('0x1dd'),_0xf6fe('0x92'),JSON[_0xf6fe('0x75')](_0x323bb4)));});}}else{return _0x422929(msgResponse('[getDataPredictive]',_0xf6fe('0x92'),_0xf6fe('0x1df')));}});};};Dialer[_0xf6fe('0x17')][_0xf6fe('0x1e0')]=function(_0x457649){var _0x25a4eb=this;return function(){var _0x1f6024=0x0;var _0x49f12e=Math[_0xf6fe('0x1bf')](_0x457649[_0xf6fe('0x5d')]*0x3e8);if(_0x49f12e>0x0){_0x49f12e=_0x49f12e<0x64?0x64:_0x49f12e;loggerPredictive[_0xf6fe('0x4b')](_0x457649['name'],_0xf6fe('0x1e1'),_0x49f12e,_0xf6fe('0x1e2'));_0x457649['handlePredictive']=setInterval(function(){_0x25a4eb[_0xf6fe('0x65')](_0x457649);loggerPredictiveCalls[_0xf6fe('0x4b')](_0xf6fe('0x1e3'),_0x1f6024+=0x1);},_0x49f12e);}else{loggerPredictive[_0xf6fe('0x4b')](_0x457649[_0xf6fe('0x48')],_0xf6fe('0x1e4'));}};};Dialer['prototype'][_0xf6fe('0x1e5')]=function(_0x4f34f9,_0x5e5731){var _0x4aedd1=this;return function(_0x5d9a67){if(_['isEmpty'](_0x5d9a67)){if(_[_0xf6fe('0xee')](_0x5e5731[_0xf6fe('0x1e6')])||!_0x5e5731['recallme']){if(_0x4f34f9['dialMethod']===_0xf6fe('0x9')){_0x4f34f9[_0xf6fe('0x72')]=_[_0xf6fe('0x40')](_0x4f34f9['queueStatusComplete'])?!![]:_0x4f34f9['queueStatusComplete'];var _0x1176aa=uuid['v4']();_0x4aedd1[_0xf6fe('0x23')][_0x1176aa]=new Action(_0x4f34f9,_0x5e5731,_0x1176aa);loggerBooked[_0xf6fe('0x4b')]('[booked][checkContactBlack]',_0x1176aa,_0xf6fe('0x1e7'),JSON['stringify'](_0x4f34f9[_0xf6fe('0x72')]),'Queue:\x20',_0x4f34f9[_0xf6fe('0x48')]);if(_0x4f34f9[_0xf6fe('0x72')]){_0x4f34f9[_0xf6fe('0x72')]=![];_0x4aedd1['queueBooked'][_0x4aedd1[_0xf6fe('0x23')][_0x1176aa][_0xf6fe('0xba')]]=[];ami['Action']({'actionid':_0x1176aa,'action':_0xf6fe('0x1e8'),'queue':_0x4f34f9[_0xf6fe('0x48')]})[_0xf6fe('0x9f')](function(){_0x4aedd1[_0xf6fe('0xbd')](_0x4f34f9);hopperUtils[_0xf6fe('0xd7')]({'active':![],'ContactId':_0x4aedd1['actions'][_0x1176aa][_0xf6fe('0xda')],'ListId':_0x4aedd1[_0xf6fe('0x23')][_0x1176aa]['ListId'],'VoiceQueueId':_0x4aedd1[_0xf6fe('0x23')][_0x1176aa][_0xf6fe('0xdc')]||undefined,'CampaignId':_0x4aedd1[_0xf6fe('0x23')][_0x1176aa][_0xf6fe('0xdd')]||undefined})[_0xf6fe('0x9f')](loggerCatch('[unlockOriginate][syncQueueStatusComplete]'));delete _0x4aedd1[_0xf6fe('0x23')][_0x1176aa];});}else{loggerBooked[_0xf6fe('0x4b')](_0xf6fe('0x1e9'),JSON[_0xf6fe('0x75')](_0x4f34f9[_0xf6fe('0x72')]),_0xf6fe('0x1ea'),_0x4f34f9[_0xf6fe('0x48')]);_0x4aedd1[_0xf6fe('0xbd')](_0x4f34f9);hopperUtils[_0xf6fe('0xd7')]({'active':![],'ContactId':_0x4aedd1[_0xf6fe('0x23')][_0x1176aa]['ContactId'],'ListId':_0x4aedd1['actions'][_0x1176aa][_0xf6fe('0xdb')],'VoiceQueueId':_0x4aedd1['actions'][_0x1176aa]['VoiceQueueId']||undefined,'CampaignId':_0x4aedd1[_0xf6fe('0x23')][_0x1176aa][_0xf6fe('0xdd')]||undefined})[_0xf6fe('0x9f')](loggerCatch(_0xf6fe('0x1eb')));delete _0x4aedd1[_0xf6fe('0x23')][_0x1176aa];}}else{return _0x4aedd1[_0xf6fe('0x1ec')](_0x4f34f9,_0x5e5731);}}else{if(utils[_0xf6fe('0x1ed')](undefined,_0x5e5731[_0xf6fe('0x1ee')])<_0x4f34f9[_0xf6fe('0x1ef')]*0x3c){if(_0x5e5731[_0xf6fe('0x147')]&&!_0x5e5731[_0xf6fe('0x147')][_0xf6fe('0x1f0')]){_0x4aedd1['preview'][_0xf6fe('0xfc')](_0x5e5731['id'])['finally'](function(){_0x4aedd1['updateOriginated'](_0x4f34f9);});}else{hopperUtils['unlockContact']({'active':![]},_0x5e5731['id'],0x1)['finally'](function(){_0x4aedd1[_0xf6fe('0xbd')](_0x4f34f9);});}}else{_0x4f34f9[_0xf6fe('0x1f1')]+=0x1;_0x4aedd1[_0xf6fe('0xbd')](_0x4f34f9);if(_0x4f34f9[_0xf6fe('0x1f2')]){hopperUtils[_0xf6fe('0xd7')]({'active':![],'recallme':![],'UserId':null,'ContactId':_0x5e5731[_0xf6fe('0xda')],'ListId':_0x5e5731[_0xf6fe('0xdb')],'VoiceQueueId':_0x5e5731[_0xf6fe('0xdc')]||undefined,'CampaignId':_0x5e5731[_0xf6fe('0xdd')]||undefined})[_0xf6fe('0x9f')](loggerCatch(_0xf6fe('0x1f3')));hopperUtils[_0xf6fe('0xc3')](createObjHistory(_0x4f34f9,_0x5e5731,utils[_0xf6fe('0x6a')][_0xf6fe('0x1f4')],0x17,'RecallInQueue'))[_0xf6fe('0x9f')](loggerCatch(_0xf6fe('0x1f5')));}else{_0x4aedd1[_0xf6fe('0x116')](createObjHistory(_0x4f34f9,_0x5e5731,utils['CAMPAIGN_STATUS']['RECALL_TIMEOUT'],0x16,_0xf6fe('0x1f6')),'[Originate][HistoryRecallClose][historyCatch]','[Originate][HistoryRecallClose]');}}}}else{_0x4f34f9[_0xf6fe('0x1f7')]+=0x1;_0x4aedd1['saveInDb'](createObjHistory(_0x4f34f9,_0x5e5731,utils[_0xf6fe('0x6a')][_0xf6fe('0x1f8')],0xd,'Blacklist'),_0xf6fe('0x1f9'),_0xf6fe('0x1fa'));throw _0xf6fe('0x1fb');}};};Dialer['prototype'][_0xf6fe('0x15b')]=function(_0x5c4ad2){var _0x5c5ffc=this;var _0x2fc7ca=_0x5c4ad2[_0xf6fe('0x1fc')]-_0x5c4ad2['originated'];emitCampaignSummary(_0x5c4ad2);if(_0x2fc7ca>0x0&&_0x5c4ad2['temp']==0x0){if(_0x2fc7ca>this[_0xf6fe('0x21')]){_0x2fc7ca=this['maxNumberOriginate'];}_0x5c4ad2['temp']=0x1;hopperUtils['getContactDialerIvr'](_0x5c4ad2,_0x2fc7ca)[_0xf6fe('0x3e')](function(_0x1523d7){_0x5c4ad2[_0xf6fe('0x1fd')]=0x0;if(_0x1523d7){if(!utils[_0xf6fe('0x1fe')](_0x1523d7)){_0x5c4ad2[_0xf6fe('0x69')]=utils['CAMPAIGN_STATUS'][_0xf6fe('0x6d')];logger[_0xf6fe('0x4b')]('[getContactCampaign2][Empty]'+_0x5c4ad2['name']);}else{_0x5c4ad2['originated']+=_0x1523d7[_0xf6fe('0x99')];_0x5c4ad2[_0xf6fe('0x69')]=utils['CAMPAIGN_STATUS'][_0xf6fe('0x1ff')];for(var _0x5b51db=0x0;_0x5b51db<_0x1523d7['length'];_0x5b51db+=0x1){_0x5c4ad2[_0xf6fe('0x200')]+=0x1;if(_[_0xf6fe('0xee')](_0x1523d7[_0x5b51db])||_[_0xf6fe('0xee')](_0x1523d7[_0x5b51db][_0xf6fe('0x201')])||_['isNil'](_0x1523d7[_0x5b51db][_0xf6fe('0x15f')])){_0x5c5ffc[_0xf6fe('0x157')](_0xf6fe('0x202'),_0x5c4ad2,_0x1523d7[_0x5b51db]);}else{hopperUtils[_0xf6fe('0x203')](_[_0xf6fe('0xf2')](_0x1523d7[_0x5b51db],['CampaignId','phone']))[_0xf6fe('0x3e')](_0x5c5ffc[_0xf6fe('0x1e5')](_0x5c4ad2,_0x1523d7[_0x5b51db]))[_0xf6fe('0x9f')](_0x5c5ffc['loggerHandler'](_0xf6fe('0x204'),_0x5c4ad2));}}}}})[_0xf6fe('0x9f')](loggerGetContactDialer(_0xf6fe('0x205'),_0x5c4ad2,_0x2fc7ca));}};Dialer[_0xf6fe('0x17')][_0xf6fe('0xaf')]=function(_0x454a6d,_0x59f6ea){var _0x884fe4=this;var _0x3424c5=[];if(_0x59f6ea<0x1||_0x454a6d[_0xf6fe('0xae')]==='booked'){_0x59f6ea=0x1;}var _0x574091=Math['floor'](_0x454a6d[_0xf6fe('0x138')]*_0x59f6ea)-_0x454a6d[_0xf6fe('0x7e')];if(_0x454a6d['dialLimitQueue']>0x0){var _0x3ef8a6=_0x454a6d['dialLimitQueue']-_0x454a6d[_0xf6fe('0x7e')]-_0x454a6d[_0xf6fe('0x13a')]-_0x454a6d[_0xf6fe('0x13b')];if(_0x574091>_0x3ef8a6){_0x574091=_0x3ef8a6;}}if(_0x574091>0x0&&_0x454a6d[_0xf6fe('0x1fd')]==0x0){if(_0x454a6d[_0xf6fe('0xae')]===_0xf6fe('0x9')){_0x574091=0x1;}if(_0x574091>this['maxNumberOriginate']){_0x574091=this[_0xf6fe('0x21')];}for(var _0x381dea in this[_0xf6fe('0x1f')]){if(typeof this[_0xf6fe('0x1f')][_0x381dea]!==_0xf6fe('0xab')){if(this[_0xf6fe('0x1f')][_0x381dea][_0xf6fe('0x6e')]==='not_inuse'&&this['agents'][_0x381dea][_0xf6fe('0x89')]==='reachable'){_0x3424c5['push'](this['agents'][_0x381dea]['id']);}}}_0x454a6d['temp']=0x1;hopperUtils[_0xf6fe('0x206')](_0x454a6d,_0x3424c5,_0x574091)[_0xf6fe('0x3e')](function(_0x7b1c3d){_0x454a6d['temp']=0x0;if(_0x7b1c3d){if(!utils[_0xf6fe('0x1fe')](_0x7b1c3d)){hopperUtils[_0xf6fe('0x207')](_0x454a6d)[_0xf6fe('0x3e')](sendMessageReschedule(_0x454a6d))[_0xf6fe('0x9f')](loggerCatch(_0xf6fe('0x208')));}else{_0x454a6d[_0xf6fe('0x7e')]+=_0x7b1c3d[_0xf6fe('0x99')];_0x454a6d[_0xf6fe('0x69')]=_0x454a6d[_0xf6fe('0xae')]===_0xf6fe('0x9')?utils['CAMPAIGN_STATUS'][_0xf6fe('0x13c')]:utils['CAMPAIGN_STATUS'][_0xf6fe('0x1ff')];for(var _0x10d337=0x0;_0x10d337<_0x7b1c3d[_0xf6fe('0x99')];_0x10d337+=0x1){if(_[_0xf6fe('0xee')](_0x7b1c3d[_0x10d337])||_[_0xf6fe('0xee')](_0x7b1c3d[_0x10d337]['Contact'])||_[_0xf6fe('0xee')](_0x7b1c3d[_0x10d337][_0xf6fe('0x15f')])){_0x884fe4[_0xf6fe('0x157')](_0xf6fe('0x202'),_0x454a6d,_0x7b1c3d[_0x10d337]);}else{hopperUtils[_0xf6fe('0x209')](_[_0xf6fe('0xf2')](_0x7b1c3d[_0x10d337],['VoiceQueueId',_0xf6fe('0x15f')]))[_0xf6fe('0x3e')](_0x884fe4[_0xf6fe('0x1e5')](_0x454a6d,_0x7b1c3d[_0x10d337]))['catch'](_0x884fe4[_0xf6fe('0x156')](_0xf6fe('0x202'),_0x454a6d));}}}}})[_0xf6fe('0x9f')](loggerGetContactDialer(_0xf6fe('0x20a'),_0x454a6d,_0x574091));}};Dialer[_0xf6fe('0x17')][_0xf6fe('0x65')]=function(_0x2edb7c){if(_0x2edb7c[_0xf6fe('0x20b')]>0x0){var _0x5a5c55=_0x2edb7c[_0xf6fe('0x20b')]-_0x2edb7c[_0xf6fe('0x7e')]-_0x2edb7c[_0xf6fe('0x13a')];if(_0x5a5c55>0x0&&_0x2edb7c[_0xf6fe('0x1fd')]==0x0){this[_0xf6fe('0x20c')](_0x2edb7c);}else{loggerPredictiveCalls[_0xf6fe('0x4b')]('[handlePredictive][limitChannel]');}}else{this[_0xf6fe('0x20c')](_0x2edb7c);}};Dialer[_0xf6fe('0x17')][_0xf6fe('0x20c')]=function(_0x3c8cb3){var _0x254c90=this;var _0x43465a=[];_0x3c8cb3[_0xf6fe('0x7e')]+=0x1;for(var _0x2561c1 in this[_0xf6fe('0x1f')]){if(typeof this[_0xf6fe('0x1f')][_0x2561c1]!==_0xf6fe('0xab')){if(this[_0xf6fe('0x1f')][_0x2561c1][_0xf6fe('0x6e')]===_0xf6fe('0x20d')&&this['agents'][_0x2561c1][_0xf6fe('0x89')]===_0xf6fe('0x8a')){_0x43465a[_0xf6fe('0x9a')](this['agents'][_0x2561c1]['id']);}}}_0x3c8cb3['temp']=0x1;return this[_0xf6fe('0x206')](_0x3c8cb3['id'],_0x43465a,0x1,_0x3c8cb3[_0xf6fe('0x20e')],_0x3c8cb3)[_0xf6fe('0x3e')](function(_0xa28ed2){_0x3c8cb3[_0xf6fe('0x1fd')]=0x1;if(_0xa28ed2){if(!utils['checkContactEmpty'](_0xa28ed2)){utils[_0xf6fe('0x67')](_0x3c8cb3,0x1,0x0);return hopperUtils[_0xf6fe('0x207')](_0x3c8cb3)[_0xf6fe('0x3e')](sendMessageReschedule(_0x3c8cb3))[_0xf6fe('0x9f')](loggerCatch(_0xf6fe('0x208')));}else{_0x3c8cb3['message']=utils['CAMPAIGN_STATUS'][_0xf6fe('0x1ff')];if(_[_0xf6fe('0xee')](_0xa28ed2[0x0])||_['isNil'](_0xa28ed2[0x0]['Contact'])||_['isNil'](_0xa28ed2[0x0][_0xf6fe('0x15f')])){_0x254c90[_0xf6fe('0x157')](_0xf6fe('0x202'),_0x3c8cb3,_0xa28ed2[0x0]);}else{return hopperUtils[_0xf6fe('0x209')](_['pick'](_0xa28ed2[0x0],[_0xf6fe('0xdc'),_0xf6fe('0x15f')]))[_0xf6fe('0x3e')](_0x254c90[_0xf6fe('0x1e5')](_0x3c8cb3,_0xa28ed2[0x0]))[_0xf6fe('0x9f')](_0x254c90[_0xf6fe('0x156')](_0xf6fe('0x20f'),_0x3c8cb3));}}}})[_0xf6fe('0x9f')](loggerGetContactDialer(_0xf6fe('0x210'),_0x3c8cb3,0x1));};Dialer[_0xf6fe('0x17')]['abandonmentRate']=function(_0x5d5c2b,_0x54d4ba,_0x1fe411,_0x4e2a90,_0x32901f,_0x45b0e3){loggerPredictive[_0xf6fe('0x4b')](_0xf6fe('0x211'));loggerPredictive[_0xf6fe('0x4b')](_0xf6fe('0x212'),_0x5d5c2b);loggerPredictive[_0xf6fe('0x4b')](_0xf6fe('0x213'),_0x54d4ba);loggerPredictive['info']('Ts:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x1fe411);loggerPredictive[_0xf6fe('0x4b')]('P:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x4e2a90);loggerPredictive[_0xf6fe('0x4b')](_0xf6fe('0x214'),_0x32901f);loggerPredictive[_0xf6fe('0x4b')]('---------------------------');return new Promise(function(_0x5bdf59,_0x1c1b79){if(_0x5d5c2b<=0x0||isNaN(_0x5d5c2b)){return _0x1c1b79(msgResponse(_0xf6fe('0x215'),'Error',_0xf6fe('0x216')+_0x5d5c2b));}if(_0x1fe411<=0x0||isNaN(_0x1fe411)){return _0x1c1b79(msgResponse(_0xf6fe('0x215'),_0xf6fe('0x85'),_0xf6fe('0x217')+_0x1fe411));}if(_0x4e2a90<=0x0||isNaN(_0x4e2a90)){return _0x1c1b79(msgResponse(_0xf6fe('0x215'),_0xf6fe('0x85'),_0xf6fe('0x218')+_0x4e2a90));}if(_0x54d4ba<=0x0||isNaN(_0x54d4ba)){return _0x1c1b79(msgResponse(_0xf6fe('0x215'),'Error','interval\x20=\x20'+_0x54d4ba));}if(_0x32901f<=0x0||isNaN(_0x32901f)){return _0x1c1b79(msgResponse('[abandonmentRate]','Error',_0xf6fe('0x219')+_0x32901f));}_0x45b0e3=_0x45b0e3||0x0;var _0x4dcf5b=0x1/_0x1fe411;var _0x5169b0=0x0;var _0x52f3be=0x0;var _0x5c2cf3=0x0;var _0x2b9479=0x0;for(var _0x3933ea=0x0;_0x5c2cf3<_0x32901f;_0x3933ea+=0x1){_0x52f3be=_0x3933ea/_0x54d4ba;_0x5169b0=(_0x4e2a90*_0x52f3be+_0x45b0e3)/_0x4dcf5b;_0x5c2cf3=utils[_0xf6fe('0x21a')](_0x5169b0,_0x5d5c2b);_0x2b9479=_0x5169b0/_0x5d5c2b*(0x1-utils[_0xf6fe('0x21a')](_0x5169b0,_0x5d5c2b));}return _0x5bdf59({'erlangCalls':_0x3933ea,'erlangCallToSecond':_0x54d4ba/_0x3933ea,'erlangAbandonmentRate':_0x5c2cf3,'erlangBusyFactor':_0x2b9479});});};Dialer['prototype'][_0xf6fe('0x1d7')]=function(_0x2f8d52,_0x42df2d,_0x1be4d2,_0x217207,_0x1ad750,_0xd8b923){loggerPredictive[_0xf6fe('0x4b')](_0xf6fe('0x21b'));loggerPredictive['info'](_0xf6fe('0x212'),_0x2f8d52);loggerPredictive[_0xf6fe('0x4b')](_0xf6fe('0x213'),_0x42df2d);loggerPredictive[_0xf6fe('0x4b')](_0xf6fe('0x21c'),_0x1be4d2);loggerPredictive[_0xf6fe('0x4b')](_0xf6fe('0x21d'),_0x217207);loggerPredictive['info'](_0xf6fe('0x21e'),_0x1ad750);loggerPredictive[_0xf6fe('0x4b')](_0xf6fe('0x56'));return new Promise(function(_0x2f0b33,_0x39b87a){if(_0x2f8d52<=0x0||isNaN(_0x2f8d52)){return _0x39b87a(msgResponse('[busyFactor]',_0xf6fe('0x85'),_0xf6fe('0x216')+_0x2f8d52));}if(_0x1be4d2<=0x0||isNaN(_0x1be4d2)){return _0x39b87a(msgResponse(_0xf6fe('0x21f'),'Error',_0xf6fe('0x217')+_0x1be4d2));}if(_0x217207<=0x0||isNaN(_0x217207)){return _0x39b87a(msgResponse(_0xf6fe('0x21f'),'Error',_0xf6fe('0x218')+_0x217207));}if(_0x42df2d<=0x0||isNaN(_0x42df2d)){return _0x39b87a(msgResponse(_0xf6fe('0x21f'),_0xf6fe('0x85'),'interval\x20=\x20'+_0x42df2d));}if(_0x1ad750<=0x0||isNaN(_0x1ad750)){return _0x39b87a(msgResponse(_0xf6fe('0x21f'),_0xf6fe('0x85'),_0xf6fe('0x220')+_0x1ad750));}_0xd8b923=_0xd8b923||0x0;var _0x424f5d=0x1/_0x1be4d2;var _0x401b54=0x0;var _0xd7d185=0x0;var _0x1ea585=0x0;var _0x73f6c4=0x0;for(var _0x31bd8b=0x0;_0x73f6c4<_0x1ad750;_0x31bd8b+=0x1){_0xd7d185=_0x31bd8b/_0x42df2d;_0x401b54=(_0x217207*_0xd7d185+_0xd8b923)/_0x424f5d;_0x1ea585=utils['erlangb'](_0x401b54,_0x2f8d52);_0x73f6c4=_0x401b54/_0x2f8d52*(0x1-utils[_0xf6fe('0x21a')](_0x401b54,_0x2f8d52));}return _0x2f0b33({'erlangCalls':_0x31bd8b,'erlangCallToSecond':_0x42df2d/_0x31bd8b,'erlangAbandonmentRate':_0x1ea585,'erlangBusyFactor':_0x73f6c4});});};module[_0xf6fe('0x221')]=Dialer; \ No newline at end of file +var _0x50db=['type','outbound','[voiceQueueReport][queuesummary]\x20sending\x20voice_queue:save\x20event:','inspect','format','voice:queue:%s','voice_queue:save','info','-----\x20Stats\x20Predictive\x20---','Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalTotalCalls','Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAnsweredCalls','Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalDroppedCallsCallersExit','AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAvgHoldtime','AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAvgTalktime','Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive','isUndefined','Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive','History\x20information\x20are\x20empty','erlangCalls','One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangCallToSecond','Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangAbandonmentRate','erlangBusyFactor','---------------------------','getSeconds','debug','name','startProgressive\x20value\x20cleared','startPredictive\x20value\x20cleared','handlePredictive','handlePredictive\x20interval\x20cleared','error','checkContactLowerLimitOriginate','contactsRescheduled','message','CAMPAIGN_STATUS','contacts','NO_AVAILABLE_CONTACTS','[getContactDialer2][Empty]','state','statedesc','starttime','queueStatusComplete','stringify','pick','Interval','NULL_INTERVAL','\x20INTERVAL_IS_NULL','Intervals','isEmpty','isIVRCampaignActive','INACTIVE','\x20NOT\x20Active','isIVRCampaign','campaign:save','originated','sendMessageOneNotActive','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','is\x20not\x20active','is\x20disactive','prototype','isTrunkReachable','active','SIP/%s','status','unmonitored','checkIsTrunkReachable','Trunk','TrunkBackup','TRUNK_NOT_REACHABLE','\x20trunk\x20is\x20not\x20reachable','checkIfTime','ifTimeIvr','checkIfTimeIntervals','ifTime','Failure','EMPTY_INTERVAL','\x20Intervals\x20is\x20empty\x20','timezones','UNKNOWN_TIMEZONE','\x20Timezone\x20unknow\x20','length','Action','command','iftime\x20%s,%s','interval','indexOf','true','content','catch','all','some','OVERTIME_GLOBAL_INTERVAL','OVERTIME_INTERVAL','Global:\x20','\x20Interval\x20is\x20overtime:\x20','Timezone:\x20','resetActiveCalls','syncCampaigns','resolve','dialGlobalInterval','dialTimezone','launchHandleIvr','[syncCampaigns]','checkDialMethod','dialMethod','predictive','power','handlePower','dialPowerLevel','Queue','silly','Dialer::ifTime()','intervalIftime','[ifTime][promiseAll]','isGlobal','Error','queue','uniqueId','ivr','uniqueid','answertime','YYYY-MM-DD\x20HH:mm:ss','outboundAnswerCallsDay','reason','agent','agiafterat','dialQueueProject2','dialAgiAfterHangupAgent','createHistory','[syncAgentComplete]','updateOriginated','droptime','responsetime','outboundDropCallsDayTimeout','predictiveIntervalErlangCallsDroppedCalls','Drop','countdropretry','countglobal','verifyAdditionalPhones','voiceQueue','queueCallerAbandonCreateState','rescheduleContact','add','dialDropRetryFrequency','minutes','ContactId','ListId','VoiceQueueId','[rescheduleContact][Drop]','calleridname','calleridnum','[syncAgentComplete][createHistory][10]','swapAdditionalPhones','dropreason','CALLEREXIT','callAdditionalPhoneAfterMin','dialAbandonedMaxRetry','additional','countabandonedretry','CampaignId','Abandoned','endtime','[syncAgentComplete][createHistory][11]','channel','actionid','strategy','rrmemory','isNil','paused','stateinterface','locked','queueBooked','push','merge','idHopper','roundrobin','[Catch][Preview][syncQueueStatusComplete]','finally','[unlock][syncQueueStatusComplete]','_rr','unlockRR','[booked][RR]','run','Agent:\x20','[booked][unlock2]','[unlock2][syncQueueStatusComplete]','[booked][unlock3]','[unlock3][syncQueueStatusComplete]','response','Success','[callProgressDetecting]\x20','syncVarSet','amdstatus','exten','dialAMDActive','HANGUP','outboundAnswerAgiCallsDay','HangupInAMD','custom:amd','buildObj','amd','saveInDb','[syncHangupInAMD][createHistory]','value','[syncAgentComplete][createHistory][0]','countbusyretry','countcongestionretry','countnosuchnumberretry','countmachineretry','countagentrejectretry','dialGlobalMaxRetry','stateGlobal','reason19\x20machine....','dialMachineMaxRetry','createStateFinal','reason\x2019\x20machine....','dialMachineRetryFrequency','membername','AMD','[syncHangupInAMDIvr][createHistory]','MACHINE','Machine','countnoanswerretry','[rescheduleContact][Machine]','ivrAnswerCallsDay','[syncHangupIvr][createHistory]','moveContactManagedDialer','[syncHangupIvr]','AnswerAGI','AGI','dialQueueProject','outboundUnknownCallsDay','cause-txt','queuesSummary','running','isPreviewCampaign','getQueueCampaignStatusMessage','statusMessage','inUse','talking','pTalking','ACTIVE','[syncQueueSummary]','compareToOutboundQueue','queueSummaryCountersUpdated','updateReportFromOutboundQueue','assign','filter','dialPreviewRecallmeReminder','reachable','map','Agent','user:%s','clearZombieChannels','[actions]','sequence','enqueue','[Dialer][checkChannel]','getVoiceQueueRtPauses','undefined','[updateOriginated]\x20object\x20originated\x20is\x20negative','emptyContact','notFound','UserId','[emptyContact][createHistory]','[emptyContact]','checkPreviewRecallReminder','actionOriginate','object','originate','voiceQueue\x20is\x20undefine','phone','getCaller','\x22agi://%s/square,%s\x22','NONE','isOutboundQueue','\x22%s,%s%s,,,%s\x22','dialQueueOptions','dialQueueTimeout','XMD-AMDGREETING','dialAMDGreeting','XMD-AMDAFTERGREETINGSILENCE','XMD-AMDTOTALANALYSISTIME','XMD-AMDMINWORDLENGTH','dialAMDMinWordLength','XMD-AMDBETWEENWORDSSILENCE','dialAMDBetweenWordsSilence','XMD-AMDMAXIMUMNUMBEROFWORDS','dialAMDMaximumNumberOfWords','XMD-AMDMAXIMUMWORDLENGTH','XMD-VOICEQUEUEID','setXMDContactVariables','Contact','getCallerId','callerid','dialOriginateCallerIdNumber','dialRandomLastDigitCallerIdNumber','dialOriginateCallerIdName','getCallerIdRandom','XMD-ORIGINATECALLERIDNAME','extractCalleridName','XMD-ORIGINATECALLERIDNUM','variables','SIP/%s/%s%s','dialPrefix','dialCutDigit','dialOriginateTimeout','outboundOriginateFailureCallsDay','[originateError]:\x20%s','[originate][error]','originate\x20action\x20Error','checkRetriveMax','dialNoAnswerRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','[rescheduleContact]\x20[Busy]','[rescheduleContact]\x20[Congestion]','dialNoSuchNumberMaxRetry','[rescheduleContact][NoSuchNumber]','dialAbandonedRetryFrequency','[rescheduleContact][Abandoned]','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','outboundNoSuchCallsDay','NoSuchNumber','reason\x200\x20no\x20such\x20number....','outboundNoAnswerCallsDay','NoAnswer','buildNoAnswerEventPayload','custom:agentnoanswer','outboundBusyCallsDay','Busy','custom:agentbusy','busy','reason\x205\x20busy','outboundCongestionCallsDay','Congestion','dialCongestionRetryFrequency','custom:agentcongestion','congestion','[syncAgentComplete][createHistory][8]','dialCongestionMaxRetry','reason\x208\x20congestion','outboundAbandonedCallsDay','reason\x2011\x20abandoned','outboundRejectCallsDay','AgentReject','agentreject','[syncAgentComplete][createHistory][20]','[syncAgentComplete][createHistory][?]','Global','[callProgressDetecting]','[moveContactManagedDialer][0]','contact\x20not\x20moved','round','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','available','floor','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','[startMethodPredictive][StartProgressive]','check\x20predictive\x20is\x20not\x20undefine','dialPredictiveInterval','[startMethodPredictive][StartProgressive][Loop]','dialPredictiveOptimization','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','Dropped\x20calls\x20day','dropRate','Max\x20Drop\x20','Drop\x20in\x20this\x20interval','started\x20in\x20predictive\x20at','startMethodPredictive','Predictive\x20after\x20first\x20interval','recalculate\x20predictive\x20at','avgHandleTime','getDataPredictive','Predictive\x20for\x20every\x20interval','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20less\x20than\x20threshold\x20(',')\x20are\x20more\x20than\x20threshold\x20(','dialPredictiveOptimizationPercentage','abandonmentRate','agentBusyFactor','busyFactor','[getDataPredictive]','Unknown\x20Predictive','check\x20failure','loggedIn','outboundQueuePauses','predictiveIntervalDroppedCallsTimeout','predictiveIntervalPauses','one\x20call\x20every:','milliseconds','[handlePredictive]','recallme','[booked][checkContactBlack]','queueStatusComplete:\x20','Queue:\x20','[unlockOriginate][syncQueueStatusComplete]','[booked][checkContactBlack][else]','scheduledat','dialRecallMeTimeout','voicePause','unlockContact','outboundReCallsDay','dialRecallInQueue','[rescheduleContact][dialRecallInQueue]','QUEUE_RECALL','RecallInQueue','[Originate][HistoryDialRecallInQueue][historyCatch]','RECALL_TIMEOUT','RecallFailedTimeout','[Originate][HistoryRecallClose]','outboundBlacklistCallsDay','BLACKLIST','Blacklist','[Originate][historyBlacklist]','[Originate][MoveBlacklist]','inBlackList','limitCalls','temp','getContactDialerIvr','checkContactEmpty','[getContactCampaign2][Empty]','RUNNING','ivrTotalCallsDays','checkContactBlack','[actionOriginateIvr]\x20','[getContactCampaign2]','dialLimitQueue','not_inuse','getContactDialer','loggerHandler','[actionOriginate]\x20','[getContactDialer2]','tryOriginatePredictive','[handlePredictive][limitChannel]','dialOrderByScheduledAt','countReScheduled','[countReScheduled]\x20','checkIsBlackList','[getContactDialerPredictive]','--------\x20Drop\x20Rate\x20--------','M:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Ts:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','P:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[abandonmentRate]','m\x20=\x20','Ts\x20=\x20','interval\x20=\x20','Amax\x20=\x20','----\x20Agent\x20Busy\x20Factor\x20----','Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[busyFactor]','p\x20=\x20','Umin\x20=\x20','erlangb','exports','lodash','moment','ioredis','./utils','./utils/hopper','dialer','../../../config/logger','booked','predictiveCalls','syncQueueSummary','redis','defaults','localhost','socket.io-emitter','../rpc/cmHopper','../rpc/voiceQueueRt','../rpc/setting','./models/action','./models/history','./models/final','./models/agentComplete','./models/queueCallerAbandon','env','XCALLY_IP_AGI','127.0.0.1','tail','preview','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','channels','actions','contactsId','optionPredictive','startPredictive','startProgressive','queueBookedRR','agentconnect','syncAgentConnect','queuecallerabandon','syncQueueCallerAbandon','bind','originateresponse','syncOriginateResponse','agentcomplete','syncAgentComplete','custom:queuesummarycomplete','syncQueueSummaryComplete','syncHangup','syncNewExten','varset','queuemember','syncQueueMember','queuestatuscomplete','syncQueueStatusComplete','loopCampaigns','loopClearZombieChannels','getSettings','then','emit'];(function(_0x488ca1,_0xf6858e){var _0x4dd0a4=function(_0x40fb65){while(--_0x40fb65){_0x488ca1['push'](_0x488ca1['shift']());}};_0x4dd0a4(++_0xf6858e);}(_0x50db,0x1d6));var _0xb50d=function(_0x1eac47,_0x943cea){_0x1eac47=_0x1eac47-0x0;var _0x460b89=_0x50db[_0x1eac47];return _0x460b89;};'use strict';var util=require('util');var _=require(_0xb50d('0x0'));var uuid=require('uuid');var moment=require(_0xb50d('0x1'));var rr=require('rr');var Redis=require(_0xb50d('0x2'));var utils=require(_0xb50d('0x3'));var hopperUtils=require(_0xb50d('0x4'));var ut=require('../preview/util/util');var config=require('../../../config/environment/');var logger=require('../../../config/logger')(_0xb50d('0x5'));var loggerBooked=require(_0xb50d('0x6'))(_0xb50d('0x7'));var loggerPredictive=require(_0xb50d('0x6'))('predictive');var loggerPredictiveCalls=require(_0xb50d('0x6'))(_0xb50d('0x8'));var loggerSyncQueueSummary=require(_0xb50d('0x6'))(_0xb50d('0x9'));var ami=require('../ami');config[_0xb50d('0xa')]=_[_0xb50d('0xb')](config[_0xb50d('0xa')],{'host':_0xb50d('0xc'),'port':0x18eb});var io=require(_0xb50d('0xd'))(new Redis(config[_0xb50d('0xa')]));var cmHopper=require(_0xb50d('0xe'));var voiceQueueRt=require(_0xb50d('0xf'));var RpcSetting=require(_0xb50d('0x10'));var Interval=require('../rpc/interval');var Action=require(_0xb50d('0x11'));var History=require(_0xb50d('0x12'));var Final=require(_0xb50d('0x13'));var AgentComplete=require(_0xb50d('0x14'));var QueueCallerAbandon=require(_0xb50d('0x15'));var Hangup=require('./models/hangup');var ipAgi=process[_0xb50d('0x16')][_0xb50d('0x17')]||_0xb50d('0x18');var previewRecallmeReminderInterval=0x1;var Sequence=function(){};Sequence['prototype']['enqueue']=function(_0x2153e5){this[_0xb50d('0x19')]=this[_0xb50d('0x19')]?this[_0xb50d('0x19')]['finally'](_0x2153e5):_0x2153e5();};function Dialer(_0x385dfb,_0x360c37){this['sequence']=new Sequence();this[_0xb50d('0x1a')]=_0x360c37;this[_0xb50d('0x1b')]=_0x385dfb[_0xb50d('0x1b')];this[_0xb50d('0x1c')]=_0x385dfb[_0xb50d('0x1c')];this[_0xb50d('0x1d')]=_0x385dfb['agents'];this[_0xb50d('0x1e')]=_0x385dfb['trunks'];this[_0xb50d('0x1f')]=config[_0xb50d('0x1f')]||0x2;this[_0xb50d('0x20')]={};this[_0xb50d('0x21')]={};this[_0xb50d('0x22')]={};this['uniqueId']={};this[_0xb50d('0x23')]={};this[_0xb50d('0x24')]={};this[_0xb50d('0x25')]={};this['ivrOriginated']={};this['queueBooked']={};this[_0xb50d('0x26')]={};this['queuesSummary']={};ami['on'](_0xb50d('0x27'),this[_0xb50d('0x28')]['bind'](this));ami['on'](_0xb50d('0x29'),this[_0xb50d('0x2a')][_0xb50d('0x2b')](this));ami['on'](_0xb50d('0x2c'),this[_0xb50d('0x2d')][_0xb50d('0x2b')](this));ami['on'](_0xb50d('0x2e'),this[_0xb50d('0x2f')][_0xb50d('0x2b')](this));ami['on']('custom:queuesummary',this[_0xb50d('0x9')]['bind'](this));ami['on'](_0xb50d('0x30'),this[_0xb50d('0x31')][_0xb50d('0x2b')](this));ami['on']('hangup',this[_0xb50d('0x32')][_0xb50d('0x2b')](this));ami['on']('newexten',this[_0xb50d('0x33')]['bind'](this));ami['on'](_0xb50d('0x34'),this['syncVarSet'][_0xb50d('0x2b')](this));ami['on'](_0xb50d('0x35'),this[_0xb50d('0x36')][_0xb50d('0x2b')](this));ami['on'](_0xb50d('0x37'),this[_0xb50d('0x38')]['bind'](this));this[_0xb50d('0x39')]();this[_0xb50d('0x3a')]();RpcSetting[_0xb50d('0x3b')]()[_0xb50d('0x3c')](function(_0x5234c7){previewRecallmeReminderInterval=_0x5234c7['previewRecallmeReminderInterval'];});}function isNotNull(_0x35b5a2){return _0x35b5a2!==null&&!_['isUndefined'](_0x35b5a2);}function msgResponse(_0x317021,_0x2703be,_0x4c105f){return{'action':_0x317021,'response':_0x2703be,'message':_0x4c105f,'stack':_0x4c105f};}function emit(_0x15ca94,_0x4af06d,_0x45c87c){io['to'](_0x15ca94)[_0xb50d('0x3d')](_0x4af06d,_0x45c87c);}function emitOutboundVoiceQueueSummary(_0x2b75d3){if(_0x2b75d3[_0xb50d('0x3e')]===_0xb50d('0x3f')){logger['debug'](_0xb50d('0x40'),util[_0xb50d('0x41')](_0x2b75d3,{'showHidden':![],'depth':null}));emit(util[_0xb50d('0x42')](_0xb50d('0x43'),_0x2b75d3['name']),_0xb50d('0x44'),_0x2b75d3);}}function checkGetDataPredictive(_0x359140){if(isNotNull(_0x359140)&&!_['isEmpty'](_0x359140)){loggerPredictive[_0xb50d('0x45')](_0xb50d('0x46'));loggerPredictive[_0xb50d('0x45')](_0xb50d('0x47'),_0x359140[_0xb50d('0x48')]);loggerPredictive[_0xb50d('0x45')](_0xb50d('0x49'),_0x359140[_0xb50d('0x4a')]);loggerPredictive[_0xb50d('0x45')]('Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x359140['predictiveIntervalDroppedCallsTimeout']);loggerPredictive['info'](_0xb50d('0x4b'),_0x359140[_0xb50d('0x4c')]);loggerPredictive[_0xb50d('0x45')](_0xb50d('0x4d'),_0x359140[_0xb50d('0x4e')]);loggerPredictive['info'](_0xb50d('0x4f'),_0x359140[_0xb50d('0x50')]);loggerPredictive[_0xb50d('0x45')]('---------------------------');if(_0x359140['predictiveIntervalTotalCalls']>0x0){if(!_['isUndefined'](_0x359140[_0xb50d('0x50')])&&_0x359140[_0xb50d('0x50')]>0x0){return!![];}loggerPredictive[_0xb50d('0x45')](_0xb50d('0x51'));if(!_[_0xb50d('0x52')](_0x359140[_0xb50d('0x4e')])&&_0x359140[_0xb50d('0x4e')]>0x0){return!![];}loggerPredictive[_0xb50d('0x45')](_0xb50d('0x53'));}else{loggerPredictive[_0xb50d('0x45')](_0xb50d('0x54'));}}else{loggerPredictive[_0xb50d('0x45')](_0xb50d('0x55'));}return![];}function mergeDataErlangB(_0x16063a){return function(_0x250a61){loggerPredictive[_0xb50d('0x45')]('---------\x20ErlangB\x20---------');loggerPredictive[_0xb50d('0x45')]('Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x250a61[_0xb50d('0x56')]);loggerPredictive[_0xb50d('0x45')](_0xb50d('0x57'),_0x250a61[_0xb50d('0x58')]);loggerPredictive[_0xb50d('0x45')](_0xb50d('0x59'),_0x250a61[_0xb50d('0x5a')]);loggerPredictive[_0xb50d('0x45')]('Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x250a61[_0xb50d('0x5b')]);loggerPredictive[_0xb50d('0x45')]('Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x250a61['erlangAbandonmentRate']);loggerPredictive[_0xb50d('0x45')](_0xb50d('0x5c'));_['merge'](_0x16063a,_0x250a61);};}function ifInterval(_0x35ab54,_0x1b0a40){if(_[_0xb50d('0x52')](_0x1b0a40)){return![];}return utils[_0xb50d('0x5d')](undefined,_0x1b0a40)<_0x35ab54*0x3c;}function clearPredictiveAttributes(_0x546c13){if(_0x546c13[_0xb50d('0x25')]){_0x546c13[_0xb50d('0x25')]=undefined;loggerPredictive[_0xb50d('0x5e')](_0x546c13[_0xb50d('0x5f')],_0xb50d('0x60'));}if(_0x546c13[_0xb50d('0x24')]){_0x546c13[_0xb50d('0x24')]=undefined;loggerPredictive[_0xb50d('0x5e')](_0x546c13[_0xb50d('0x5f')],_0xb50d('0x61'));}if(_0x546c13[_0xb50d('0x62')]){clearInterval(_0x546c13['handlePredictive']);_0x546c13[_0xb50d('0x62')]=undefined;loggerPredictive[_0xb50d('0x5e')](_0x546c13[_0xb50d('0x5f')],_0xb50d('0x63'));}}function loggerCatchPredictive(_0x6b39a5,_0x1c4afa){return function(_0x4e2bcd){loggerPredictive[_0xb50d('0x64')](_0x1c4afa[_0xb50d('0x5f')],_0x6b39a5);loggerPredictive[_0xb50d('0x64')](_0x4e2bcd['stack']);clearPredictiveAttributes(_0x1c4afa);};}function loggerCatch(_0x4f7df6){return function(_0x1c1e07){logger[_0xb50d('0x64')](_0x4f7df6,util['inspect'](_0x1c1e07,{'showHidden':![],'depth':null}));};}function loggerGetContactDialer(_0x26a65e,_0x582767,_0x3429bb){return function(_0x149815){utils[_0xb50d('0x65')](_0x582767,_0x3429bb,0x0);_0x582767['temp']=0x0;logger[_0xb50d('0x64')](_0x26a65e,util['inspect'](_0x149815,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x4be67f){return function(_0x4b5ac0){if(isNotNull(_0x4b5ac0)&&isNotNull(_0x4b5ac0[0x0])){if(_0x4b5ac0[0x0][_0xb50d('0x66')]>0x0){_0x4be67f[_0xb50d('0x67')]=utils[_0xb50d('0x68')]['CONTACTS_RESCHEDULED'];logger[_0xb50d('0x45')]('[getContactDialer2][ReScheduled]'+_0x4be67f['name'],_0x4b5ac0[0x0][_0xb50d('0x66')],_0xb50d('0x69'));}else{_0x4be67f[_0xb50d('0x67')]=utils[_0xb50d('0x68')][_0xb50d('0x6a')];logger[_0xb50d('0x45')](_0xb50d('0x6b')+_0x4be67f['name']);}}};}function createObjHistory(_0x18d9d0,_0x5ef6c2,_0x20048e,_0x50946b,_0x255db5){_0x18d9d0[_0xb50d('0x67')]=_0x20048e;var _0xe32142=new Action(_0x18d9d0,_0x5ef6c2);var _0x34aa94=new History(_0xe32142);_0x34aa94[_0xb50d('0x6c')]=_0x50946b;_0x34aa94[_0xb50d('0x6d')]=_0x255db5;_0x34aa94['endtime']=_0xe32142[_0xb50d('0x6e')];return _0x34aa94;}function unlockQueueStatus(_0x1e1194,_0x111bb4){setTimeout(function(){if(_['isUndefined'](_0x1e1194[_0xb50d('0x6f')])){loggerBooked[_0xb50d('0x64')]('[unlockQueueStatus][undefined]',_0x111bb4);}_0x1e1194['queueStatusComplete']=!![];loggerBooked[_0xb50d('0x45')]('[booked][unlockQueueStatus]',_0x111bb4,JSON[_0xb50d('0x70')](_[_0xb50d('0x71')](_0x1e1194,[_0xb50d('0x5f'),_0xb50d('0x6f')])));},0x1f3);}function checkInterval(_0x2a8ef2){return function(){if(!isNotNull(_0x2a8ef2[_0xb50d('0x72')])){_0x2a8ef2[_0xb50d('0x67')]=utils[_0xb50d('0x68')][_0xb50d('0x73')];throw _0x2a8ef2[_0xb50d('0x5f')]+_0xb50d('0x74');}if(!isNotNull(_0x2a8ef2[_0xb50d('0x72')][_0xb50d('0x75')])){_0x2a8ef2[_0xb50d('0x67')]=utils[_0xb50d('0x68')][_0xb50d('0x73')];throw _0x2a8ef2[_0xb50d('0x5f')]+_0xb50d('0x74');}if(!isNotNull(_[_0xb50d('0x76')](_0x2a8ef2[_0xb50d('0x72')][_0xb50d('0x75')]))){_0x2a8ef2[_0xb50d('0x67')]=utils[_0xb50d('0x68')][_0xb50d('0x73')];throw _0x2a8ef2[_0xb50d('0x5f')]+_0xb50d('0x74');}};}function checkIsIVRCampaignActive(_0x3c1c40){return function(){if(!utils[_0xb50d('0x77')](_0x3c1c40)){_0x3c1c40['message']=utils[_0xb50d('0x68')][_0xb50d('0x78')];throw _0x3c1c40['name']+_0xb50d('0x79');}};}function emitCampaignSummary(_0x2dd1ca){if(utils[_0xb50d('0x7a')](_0x2dd1ca)){emit(util['format']('campaign:ivr:%s',_0x2dd1ca[_0xb50d('0x5f')]),_0xb50d('0x7b'),_0x2dd1ca);}}function loggerCatchQueueSummary(_0x5e9357,_0x4754b8){return function(_0x28fce9){clearPredictiveAttributes(_0x4754b8);emitCampaignSummary(_0x4754b8);loggerSyncQueueSummary['debug'](_0x5e9357,util['inspect'](_0x28fce9,{'showHidden':![],'depth':null}));};}function notSendMessagesCampaign(_0x523d82){if(_0x523d82['sendMessageOneNotActive']){if(_0x523d82[_0xb50d('0x7c')]===0x0){_0x523d82[_0xb50d('0x7d')]=![];_0x523d82[_0xb50d('0x67')]=utils[_0xb50d('0x68')]['INACTIVE'];loggerSyncQueueSummary[_0xb50d('0x5e')](_0xb50d('0x7e'),_0x523d82[_0xb50d('0x5f')],_0xb50d('0x7f'));}else{_0x523d82[_0xb50d('0x67')]=utils[_0xb50d('0x68')]['DISACTIVED'];loggerSyncQueueSummary[_0xb50d('0x5e')](_0xb50d('0x7e'),_0x523d82[_0xb50d('0x5f')],_0xb50d('0x80'));}emitCampaignSummary(_0x523d82);}}function myreject(_0xd9cca0){return function(_0x5bb7b8){return _0xd9cca0(msgResponse('[ifTime][Action]','Error',JSON[_0xb50d('0x70')](_0x5bb7b8)));};}Dialer[_0xb50d('0x81')][_0xb50d('0x82')]=function(_0x28efd8){return!_['isUndefined'](_0x28efd8)&&_0x28efd8&&!_[_0xb50d('0x52')](_0x28efd8['name'])&&!_[_0xb50d('0x52')](_0x28efd8['active'])&&_0x28efd8[_0xb50d('0x83')]&&(this[_0xb50d('0x1e')][util[_0xb50d('0x42')]('SIP/%s',_0x28efd8[_0xb50d('0x5f')])]['status']==='reachable'||this[_0xb50d('0x1e')][util[_0xb50d('0x42')](_0xb50d('0x84'),_0x28efd8[_0xb50d('0x5f')])][_0xb50d('0x85')]===_0xb50d('0x86'));};Dialer[_0xb50d('0x81')][_0xb50d('0x87')]=function(_0x4ff61f){var _0x11f38a=this;return function(){if(!_0x11f38a[_0xb50d('0x82')](_0x4ff61f[_0xb50d('0x88')])){if(!_0x11f38a[_0xb50d('0x82')](_0x4ff61f[_0xb50d('0x89')])){_0x4ff61f[_0xb50d('0x67')]=utils[_0xb50d('0x68')][_0xb50d('0x8a')];throw _0x4ff61f[_0xb50d('0x5f')]+_0xb50d('0x8b');}}};};Dialer['prototype'][_0xb50d('0x8c')]=function(_0x32c5c5,_0x4d170a,_0x1d46d1,_0x1a0fcc){var _0x47aecb=this;return function(){var _0x44e88a=!![];return _0x47aecb[_0xb50d('0x8d')](_0x32c5c5,_0x4d170a,_0x1d46d1,_0x1a0fcc,_0x44e88a);};};Dialer[_0xb50d('0x81')][_0xb50d('0x8e')]=function(_0x223977,_0x3e3941,_0xc368c,_0x2c0ee6){var _0x173c5c=this;return function(){var _0x92258=![];return _0x173c5c['ifTimeIvr'](_0x223977[_0xb50d('0x75')],_0x3e3941,_0xc368c,_0x2c0ee6,_0x92258);};};Dialer[_0xb50d('0x81')][_0xb50d('0x8d')]=function(_0x3f629e,_0x250bac,_0x4b82f2,_0x303732,_0xb43ca5){var _0x2ddb82=[];return new Promise(function(_0x2d6294,_0x22f0a0){if(!isNotNull(_0x3f629e)){_0x303732[_0xb50d('0x67')]=utils[_0xb50d('0x68')][_0xb50d('0x73')];return _0x22f0a0(msgResponse(_0xb50d('0x8f'),_0xb50d('0x90'),_0x4b82f2+'\x20Intervals\x20is\x20null\x20'));}if(_[_0xb50d('0x76')](_0x3f629e)){_0x303732['message']=utils[_0xb50d('0x68')][_0xb50d('0x91')];return _0x22f0a0(msgResponse(_0xb50d('0x8f'),'Failure',_0x4b82f2+_0xb50d('0x92')));}if(_0x250bac&&_[_0xb50d('0x52')](config[_0xb50d('0x93')][_0x250bac])){_0x303732[_0xb50d('0x67')]=utils[_0xb50d('0x68')][_0xb50d('0x94')];return _0x22f0a0(msgResponse(_0xb50d('0x8f'),'Failure',_0x4b82f2+_0xb50d('0x95')+_0x250bac));}if(_['isArray'](_0x3f629e)){for(var _0x114994=0x0;_0x114994<_0x3f629e[_0xb50d('0x96')];_0x114994+=0x1){_0x2ddb82['push'](ami[_0xb50d('0x97')]({'action':_0xb50d('0x98'),'command':util['format'](_0xb50d('0x99'),_0x3f629e[_0x114994][_0xb50d('0x9a')],!_[_0xb50d('0x52')](config[_0xb50d('0x93')][_0x250bac])?_0x250bac:'')})[_0xb50d('0x3c')](function(_0x8b7eb9){return _0x8b7eb9['content'][_0xb50d('0x9b')](_0xb50d('0x9c'))>=0x0;})['catch'](myreject(_0x22f0a0)));}}else{_0x2ddb82['push'](ami['Action']({'action':'command','command':util['format']('iftime\x20%s,%s',_0x3f629e,!_['isUndefined'](config[_0xb50d('0x93')][_0x250bac])?_0x250bac:'')})[_0xb50d('0x3c')](function(_0x33e977){return _0x33e977[_0xb50d('0x9d')]['indexOf'](_0xb50d('0x9c'))>=0x0;})[_0xb50d('0x9e')](myreject(_0x22f0a0)));}Promise[_0xb50d('0x9f')](_0x2ddb82)[_0xb50d('0x3c')](function(_0x3b8a18){var _0x5b2e99=_[_0xb50d('0xa0')](_0x3b8a18);if(_0x5b2e99){return _0x2d6294(_0x5b2e99);}else{_0x303732[_0xb50d('0x67')]=_0xb43ca5?utils['CAMPAIGN_STATUS'][_0xb50d('0xa1')]:utils[_0xb50d('0x68')][_0xb50d('0xa2')];return _0x22f0a0(msgResponse('[ifTime][promiseAll]',_0xb50d('0x90'),_0xb50d('0xa3')+_0xb43ca5+'\x20'+_0x4b82f2+_0xb50d('0xa4')+util['inspect'](_0x3f629e,{'showHidden':![],'depth':null})+_0xb50d('0xa5')+_0x250bac));}})[_0xb50d('0x9e')](function(_0x2654b9){return _0x22f0a0(msgResponse('ifTime',_0xb50d('0x90'),JSON[_0xb50d('0x70')](_0x2654b9)));});});};Dialer[_0xb50d('0x81')][_0xb50d('0x39')]=function(){var _0x5cdfb6=this;return cmHopper[_0xb50d('0xa6')]({'active':![]},{'where':{'active':!![]}})[_0xb50d('0x3c')](function(){setInterval(function(){_0x5cdfb6[_0xb50d('0xa7')]();},0x3e8);});};Dialer[_0xb50d('0x81')][_0xb50d('0xa7')]=function(){var _0x29cb0f=this;var _0x1b506c;for(var _0x26956c in this[_0xb50d('0x1c')]){if(typeof this[_0xb50d('0x1c')][_0x26956c]!=='undefined'){_0x1b506c=this[_0xb50d('0x1c')][_0x26956c];if(utils['isIVRCampaign'](_0x1b506c)&&utils['isIVRCampaignActive'](_0x1b506c)){_0x1b506c['sendMessageOneNotActive']=!![];Promise[_0xb50d('0xa8')]()[_0xb50d('0x3c')](checkIsIVRCampaignActive(_0x1b506c))['then'](checkInterval(_0x1b506c))[_0xb50d('0x3c')](_0x29cb0f[_0xb50d('0x87')](_0x1b506c))[_0xb50d('0x3c')](_0x29cb0f[_0xb50d('0x8c')](_0x1b506c[_0xb50d('0xa9')],_0x1b506c[_0xb50d('0xaa')],_0x1b506c['name'],_0x1b506c))[_0xb50d('0x3c')](_0x29cb0f[_0xb50d('0x8e')](_0x1b506c['Interval'],_0x1b506c[_0xb50d('0xaa')],_0x1b506c['name'],_0x1b506c))[_0xb50d('0x3c')](_0x29cb0f[_0xb50d('0xab')](_0x1b506c))[_0xb50d('0x9e')](loggerCatchQueueSummary(_0xb50d('0xac'),_0x1b506c));}else{notSendMessagesCampaign(_0x1b506c);}}}};Dialer[_0xb50d('0x81')][_0xb50d('0xad')]=function(_0x2141b1){if(_0x2141b1[_0xb50d('0xae')]!==_0xb50d('0xaf')){clearPredictiveAttributes(_0x2141b1);}switch(_0x2141b1[_0xb50d('0xae')]){case'progressive':this['handlePower'](_0x2141b1,0x1);break;case _0xb50d('0xb0'):this[_0xb50d('0xb1')](_0x2141b1,_0x2141b1[_0xb50d('0xb2')]);break;case _0xb50d('0xaf'):this[_0xb50d('0xaf')](_0x2141b1);break;case _0xb50d('0x7'):this['handlePower'](_0x2141b1,0x1);break;default:logger[_0xb50d('0x64')](_0xb50d('0xb3'),_0x2141b1['name'],'method\x20not\x20recognized');}};Dialer[_0xb50d('0x81')]['ifTime']=function(_0x214a5e,_0x24984b){var _0x638e1b=_0x214a5e[_0xb50d('0xaa')];var _0x207a5a=_0x24984b?_0x214a5e[_0xb50d('0xa9')]:_0x214a5e[_0xb50d('0x72')]['Intervals'];logger[_0xb50d('0xb4')](_0xb50d('0xb5'),_0x207a5a,_0x638e1b,_0x214a5e['name'],util['format']('Voice\x20Queue\x20%s\x20$s',_0x214a5e['name'],_0x214a5e['id']));var _0x43063f=null;return Interval[_0xb50d('0xb6')](_0x207a5a,_0x638e1b)[_0xb50d('0x3c')](function(_0x59e804){if(_0x59e804===!![]){return _0x59e804;}else{_0x214a5e[_0xb50d('0x67')]=_0x24984b?utils['CAMPAIGN_STATUS'][_0xb50d('0xa1')]:utils[_0xb50d('0x68')]['OVERTIME_INTERVAL'];_0x43063f=msgResponse(_0xb50d('0xb7'),_0xb50d('0x90'),_0xb50d('0xa3')+_0x24984b+'\x20'+_0x214a5e[_0xb50d('0x5f')]+_0xb50d('0xa4')+util['inspect'](_0x207a5a,{'showHidden':![],'depth':null})+_0xb50d('0xa5')+_0x638e1b);}if(_0x43063f!==null){logger['silly']('Dialer::ifTime()\x20errResponse\x20NOT\x20NULL:',_0x43063f);_0x43063f[_0xb50d('0xb8')]=_0x24984b;throw _0x43063f;}})[_0xb50d('0x9e')](function(_0x3c9073){logger[_0xb50d('0x64')]('AMI\x20IfTime',_0x3c9073);throw msgResponse('[ifTime][Action]',_0xb50d('0xb9'),util[_0xb50d('0x41')](_0x3c9073,{'showHidden':![],'depth':null}));});};Dialer['prototype'][_0xb50d('0x28')]=function(_0x4cbc6e){if(this['voiceQueues'][_0x4cbc6e[_0xb50d('0xba')]]){if(this[_0xb50d('0xbb')][_0x4cbc6e['uniqueid']]&&this[_0xb50d('0xbb')][_0x4cbc6e['uniqueid']][_0xb50d('0x3e')]!==_0xb50d('0xbc')){this['updateOriginated'](this[_0xb50d('0x1b')][_0x4cbc6e['queue']]);this[_0xb50d('0xbb')][_0x4cbc6e[_0xb50d('0xbd')]][_0xb50d('0xbe')]=moment()[_0xb50d('0x42')](_0xb50d('0xbf'));}}};Dialer['prototype'][_0xb50d('0x2f')]=function(_0x5d1e8b){var _0x53dc88=this[_0xb50d('0xbb')][_0x5d1e8b[_0xb50d('0xbd')]];if(this[_0xb50d('0x1b')][_0x5d1e8b[_0xb50d('0xba')]]){if(_0x53dc88&&_0x53dc88[_0xb50d('0x3e')]!==_0xb50d('0xbc')){delete this[_0xb50d('0xbb')][_0x5d1e8b[_0xb50d('0xbd')]];this[_0xb50d('0x1b')][_0x5d1e8b['queue']][_0xb50d('0xc0')]+=0x1;var _0x5cdfb2=new AgentComplete(_0x53dc88,_0x5d1e8b);if(_0x5d1e8b[_0xb50d('0xc1')]===_0xb50d('0xc2')){_0x5cdfb2[_0xb50d('0xc3')]=this[_0xb50d('0x1b')][_0x5d1e8b['queue']][_0xb50d('0xc4')]&&this[_0xb50d('0x1b')][_0x5d1e8b['queue']][_0xb50d('0xc5')]?moment()[_0xb50d('0x42')](_0xb50d('0xbf')):undefined;}hopperUtils[_0xb50d('0xc6')](_0x5cdfb2)['catch'](loggerCatch('[syncAgentComplete][createHistory]'));hopperUtils['moveContactManagedDialer'](_0x5cdfb2)[_0xb50d('0x9e')](loggerCatch(_0xb50d('0xc7')));}}};Dialer['prototype'][_0xb50d('0x2a')]=function(_0x4af234){var _0x440247=this[_0xb50d('0xbb')][_0x4af234['uniqueid']];var _0x5a82f5=this;var _0x41fda4=![];var _0x39d639;var _0x379cc1;if(this['voiceQueues'][_0x4af234[_0xb50d('0xba')]]){if(_0x440247&&_0x440247[_0xb50d('0x3e')]!==_0xb50d('0xbc')){delete this[_0xb50d('0xbb')][_0x4af234['uniqueid']];this[_0xb50d('0xc8')](this[_0xb50d('0x1b')][_0x4af234[_0xb50d('0xba')]]);_0x440247[_0xb50d('0xc9')]=moment()['format'](_0xb50d('0xbf'));var _0x41d1a1=new QueueCallerAbandon(_0x440247,_0x4af234);if(utils[_0xb50d('0x5d')](_0x440247[_0xb50d('0xc9')],_0x440247[_0xb50d('0xca')])>=_0x440247['dialQueueTimeout']){this[_0xb50d('0x1b')][_0x4af234[_0xb50d('0xba')]]['predictiveIntervalDroppedCallsTimeout']+=0x1;this[_0xb50d('0x1b')][_0x4af234[_0xb50d('0xba')]][_0xb50d('0xcb')]+=0x1;this[_0xb50d('0x1b')][_0x4af234[_0xb50d('0xba')]][_0xb50d('0xcc')]+=0x1;_0x41d1a1[_0xb50d('0x6c')]=0xa;_0x41d1a1[_0xb50d('0x6d')]=_0xb50d('0xcd');_0x41d1a1['dropreason']='TIMEOUT';_0x41d1a1[_0xb50d('0xc3')]=this[_0xb50d('0x1b')][_0x4af234[_0xb50d('0xba')]]['dialQueueProject2']?moment()[_0xb50d('0x42')](_0xb50d('0xbf')):undefined;_0x41d1a1[_0xb50d('0xce')]+=0x1;_0x41d1a1[_0xb50d('0xcf')]+=0x1;_0x39d639=this[_0xb50d('0x1b')][_0x4af234[_0xb50d('0xba')]]['dialDropRetryFrequency'];_0x379cc1=this[_0xb50d('0x1b')][_0x4af234['queue']]['callAdditionalPhoneAfterMin'];hopperUtils[_0xb50d('0xd0')](_0x41d1a1,_0x41d1a1[_0xb50d('0x6c')],_0x440247[_0xb50d('0xd1')])[_0xb50d('0x3c')](function(_0x3007bd){_0x41fda4=_0x3007bd['additional']==0x1;if(_0x41d1a1[_0xb50d('0xce')]>=_0x5a82f5[_0xb50d('0x1b')][_0x4af234[_0xb50d('0xba')]]['dialDropMaxRetry']){_0x5a82f5[_0xb50d('0xd2')](_0x41d1a1,_0x3007bd['additional']);}else{hopperUtils[_0xb50d('0xd3')]({'active':![],'countdropretry':_0x41d1a1['countdropretry'],'scheduledat':moment()[_0xb50d('0xd4')](_0x5a82f5['voiceQueues'][_0x4af234['queue']][_0xb50d('0xd5')],_0xb50d('0xd6'))['format'](_0xb50d('0xbf')),'ContactId':_0x440247[_0xb50d('0xd7')],'ListId':_0x440247[_0xb50d('0xd8')],'VoiceQueueId':_0x440247[_0xb50d('0xd9')]||undefined,'CampaignId':_0x440247['CampaignId']||undefined})[_0xb50d('0x9e')](loggerCatch(_0xb50d('0xda')));var _0x4141e9=new History(_0x41d1a1);_0x4141e9[_0xb50d('0x6c')]=0xa;_0x4141e9['statedesc']=_0xb50d('0xcd');_0x4141e9[_0xb50d('0x6e')]=moment()[_0xb50d('0x42')](_0xb50d('0xbf'));_0x4141e9['endtime']=_0x4141e9[_0xb50d('0x6e')];_0x4141e9[_0xb50d('0xdb')]=_0x41d1a1[_0xb50d('0xdb')];_0x4141e9[_0xb50d('0xdc')]=_0x41d1a1['calleridnum'];hopperUtils[_0xb50d('0xc6')](_0x4141e9)[_0xb50d('0x9e')](loggerCatch(_0xb50d('0xdd')));}})[_0xb50d('0x3c')](function(){if(_0x41fda4)hopperUtils[_0xb50d('0xde')](_0x41d1a1,_0x39d639,_0x379cc1)[_0xb50d('0x3c')](function(){return 0x1;});});}else{this[_0xb50d('0x1b')][_0x4af234[_0xb50d('0xba')]][_0xb50d('0x4c')]+=0x1;this[_0xb50d('0x1b')][_0x4af234['queue']]['outboundDropCallsDayCallersExit']+=0x1;_0x41d1a1[_0xb50d('0x6c')]=0xb;_0x41d1a1[_0xb50d('0x6d')]='Abandoned';_0x41d1a1[_0xb50d('0xdf')]=_0xb50d('0xe0');_0x41d1a1['countabandonedretry']+=0x1;_0x41d1a1[_0xb50d('0xcf')]+=0x1;_0x39d639=this[_0xb50d('0x1b')][_0x4af234[_0xb50d('0xba')]]['dialAbandonedRetryFrequency'];_0x379cc1=this['voiceQueues'][_0x4af234[_0xb50d('0xba')]][_0xb50d('0xe1')];hopperUtils['verifyAdditionalPhones'](_0x41d1a1,_0x41d1a1[_0xb50d('0x6c')],_0x440247[_0xb50d('0xd1')])[_0xb50d('0x3c')](function(_0x634a5d){if(_0x41d1a1['countabandonedretry']>=_0x5a82f5[_0xb50d('0x1b')][_0x4af234['queue']][_0xb50d('0xe2')]){_0x5a82f5[_0xb50d('0xd2')](_0x41d1a1,_0x634a5d[_0xb50d('0xe3')]);}else{hopperUtils[_0xb50d('0xd3')]({'active':![],'countabandonedretry':_0x41d1a1[_0xb50d('0xe4')],'scheduledat':moment()['add'](_0x5a82f5[_0xb50d('0x1b')][_0x4af234['queue']]['dialAbandonedRetryFrequency'],_0xb50d('0xd6'))['format'](_0xb50d('0xbf')),'ContactId':_0x440247['ContactId'],'ListId':_0x440247['ListId'],'VoiceQueueId':_0x440247[_0xb50d('0xd9')]||undefined,'CampaignId':_0x440247[_0xb50d('0xe5')]||undefined})['catch'](loggerCatch('[rescheduleContact][Abandoned]'));var _0x3cdef7=new History(_0x41d1a1);_0x3cdef7[_0xb50d('0x6c')]=0xb;_0x3cdef7[_0xb50d('0x6d')]=_0xb50d('0xe6');_0x3cdef7[_0xb50d('0x6e')]=moment()[_0xb50d('0x42')]('YYYY-MM-DD\x20HH:mm:ss');_0x3cdef7[_0xb50d('0xe7')]=_0x3cdef7[_0xb50d('0x6e')];_0x3cdef7[_0xb50d('0xdb')]=_0x41d1a1[_0xb50d('0xdb')];_0x3cdef7[_0xb50d('0xdc')]=_0x41d1a1[_0xb50d('0xdc')];hopperUtils['createHistory'](_0x3cdef7)['catch'](loggerCatch(_0xb50d('0xe8')));}})[_0xb50d('0x3c')](function(){if(_0x41fda4)hopperUtils[_0xb50d('0xde')](_0x41d1a1,_0x39d639,_0x379cc1)['then'](function(){return 0x1;});});}}}};Dialer[_0xb50d('0x81')][_0xb50d('0x33')]=function(_0x511ea4){if(this[_0xb50d('0x21')][_0x511ea4['uniqueid']]){this['actions'][_0x511ea4[_0xb50d('0xbd')]]['channel']=_0x511ea4[_0xb50d('0xe9')];}if(this[_0xb50d('0xbb')][_0x511ea4[_0xb50d('0xbd')]]){this['uniqueId'][_0x511ea4['uniqueid']][_0xb50d('0xe9')]=_0x511ea4['channel'];}};Dialer[_0xb50d('0x81')]['syncQueueMember']=function(_0xd0f62d){if(!this[_0xb50d('0x21')][_0xd0f62d[_0xb50d('0xea')]]){return;}var _0x6a84e=this[_0xb50d('0x1b')][this[_0xb50d('0x21')][_0xd0f62d[_0xb50d('0xea')]][_0xb50d('0xba')]][_0xb50d('0xeb')]||_0xb50d('0xec');if(_0x6a84e==='roundrobin'){if(this[_0xb50d('0x21')][_0xd0f62d[_0xb50d('0xea')]]&&_[_0xb50d('0xed')](this[_0xb50d('0x21')][_0xd0f62d[_0xb50d('0xea')]]['locked'])&&_0xd0f62d['status']==='1'&&_0xd0f62d[_0xb50d('0xee')]==='0'){if(this[_0xb50d('0x1d')][_0xd0f62d[_0xb50d('0xef')]]){if(!this[_0xb50d('0x1d')][_0xd0f62d['stateinterface']][_0xb50d('0xf0')]){this[_0xb50d('0x1d')][_0xd0f62d[_0xb50d('0xef')]]['locked']=!![];this[_0xb50d('0x21')][_0xd0f62d[_0xb50d('0xea')]]['locked']=!![];this[_0xb50d('0x21')][_0xd0f62d['actionid']]['stateinterface']=_0xd0f62d[_0xb50d('0xef')];}}}}else if(_0x6a84e===_0xb50d('0xec')){if(this[_0xb50d('0x21')][_0xd0f62d[_0xb50d('0xea')]]){if(this[_0xb50d('0x1d')][_0xd0f62d[_0xb50d('0xef')]]){this['actions'][_0xd0f62d[_0xb50d('0xea')]][_0xb50d('0xef')]=_0xd0f62d[_0xb50d('0xef')];if(_[_0xb50d('0xed')](this[_0xb50d('0xf1')][this['actions'][_0xd0f62d[_0xb50d('0xea')]][_0xb50d('0xba')]])){this[_0xb50d('0xf1')][this[_0xb50d('0x21')][_0xd0f62d[_0xb50d('0xea')]][_0xb50d('0xba')]]=[];}this['queueBooked'][this[_0xb50d('0x21')][_0xd0f62d['actionid']][_0xb50d('0xba')]][_0xb50d('0xf2')](_[_0xb50d('0xf3')](_[_0xb50d('0x71')](this[_0xb50d('0x21')][_0xd0f62d[_0xb50d('0xea')]],[_0xb50d('0xf4'),_0xb50d('0xef')]),{'status':_0xd0f62d[_0xb50d('0x85')],'paused':_0xd0f62d[_0xb50d('0xee')]}));}}}};Dialer['prototype'][_0xb50d('0x38')]=function(_0x4e1795){if(!this['actions'][_0x4e1795['actionid']]){return;}var _0x22a42c=this;var _0x474e09=this['voiceQueues'][this[_0xb50d('0x21')][_0x4e1795['actionid']][_0xb50d('0xba')]];var _0x55210e=_0x474e09[_0xb50d('0xeb')]||_0xb50d('0xec');if(_0x55210e===_0xb50d('0xf5')){if(this[_0xb50d('0x21')][_0x4e1795[_0xb50d('0xea')]]&&this['actions'][_0x4e1795['actionid']]['stateinterface']){this[_0xb50d('0x1a')]['run'](this[_0xb50d('0x21')][_0x4e1795['actionid']][_0xb50d('0xf4')],this[_0xb50d('0x21')][_0x4e1795[_0xb50d('0xea')]][_0xb50d('0xef')])[_0xb50d('0x9e')](function(_0x478192){logger[_0xb50d('0x64')](_0xb50d('0xf6'),util[_0xb50d('0x41')](_0x478192,{'showHidden':![],'depth':null}));})[_0xb50d('0xf7')](function(){_0x22a42c[_0xb50d('0xc8')](_0x22a42c[_0xb50d('0x1b')][_0x22a42c['actions'][_0x4e1795[_0xb50d('0xea')]][_0xb50d('0xba')]]);_0x22a42c['agents'][_0x22a42c[_0xb50d('0x21')][_0x4e1795['actionid']][_0xb50d('0xef')]]['locked']=![];delete _0x22a42c[_0xb50d('0x21')][_0x4e1795['actionid']];unlockQueueStatus(_0x474e09);});}else{this[_0xb50d('0xc8')](this[_0xb50d('0x1b')][this['actions'][_0x4e1795[_0xb50d('0xea')]][_0xb50d('0xba')]]);hopperUtils[_0xb50d('0xd3')]({'active':![],'ContactId':this[_0xb50d('0x21')][_0x4e1795['actionid']][_0xb50d('0xd7')],'ListId':this[_0xb50d('0x21')][_0x4e1795[_0xb50d('0xea')]]['ListId'],'VoiceQueueId':this[_0xb50d('0x21')][_0x4e1795[_0xb50d('0xea')]][_0xb50d('0xd9')]||undefined,'CampaignId':this[_0xb50d('0x21')][_0x4e1795[_0xb50d('0xea')]][_0xb50d('0xe5')]||undefined})[_0xb50d('0x9e')](loggerCatch(_0xb50d('0xf8')));delete this['actions'][_0x4e1795[_0xb50d('0xea')]];unlockQueueStatus(_0x474e09);}}else if(_0x55210e===_0xb50d('0xec')){var _0x1d74d3;if(this[_0xb50d('0x21')][_0x4e1795['actionid']]&&!_['isEmpty'](this[_0xb50d('0xf1')][this[_0xb50d('0x21')][_0x4e1795[_0xb50d('0xea')]][_0xb50d('0xba')]])){if(this[_0xb50d('0x26')][_0x22a42c['actions'][_0x4e1795['actionid']][_0xb50d('0xba')]]){this[_0xb50d('0x26')][_0x22a42c[_0xb50d('0x21')][_0x4e1795['actionid']][_0xb50d('0xba')]]=this[_0xb50d('0x26')][this[_0xb50d('0x21')][_0x4e1795[_0xb50d('0xea')]][_0xb50d('0xba')]]?this['queueBookedRR'][this['actions'][_0x4e1795['actionid']]['queue']]:this[_0xb50d('0xf1')][this[_0xb50d('0x21')][_0x4e1795[_0xb50d('0xea')]][_0xb50d('0xba')]]?this[_0xb50d('0xf1')][this[_0xb50d('0x21')][_0x4e1795[_0xb50d('0xea')]][_0xb50d('0xba')]]['_rr']||0x0:0x0;}this[_0xb50d('0xf1')][this[_0xb50d('0x21')][_0x4e1795[_0xb50d('0xea')]]['queue']][_0xb50d('0xf9')]=this[_0xb50d('0x26')][this['actions'][_0x4e1795[_0xb50d('0xea')]][_0xb50d('0xba')]];for(var _0x15673d=0x0;_0x15673d=_0x581e63[_0xb50d('0x118')]){_0x3a9ecc[_0xb50d('0x119')](_0x5081ce,_0x541776,_0x303257,_0xb50d('0x11a'));}else{if(_0x5081ce[_0xb50d('0x116')]>=_0x581e63[_0xb50d('0x11b')]){_0x3a9ecc[_0xb50d('0x11c')](_0x5081ce,_0x541776,_0x303257,_0xb50d('0x11d'));}else{hopperUtils[_0xb50d('0xd3')]({'active':![],'countmachineretry':_0x5081ce[_0xb50d('0x116')],'scheduledat':moment()['add'](_0x581e63[_0xb50d('0x11e')],_0xb50d('0xd6'))[_0xb50d('0x42')](_0xb50d('0xbf')),'ContactId':_0x5081ce[_0xb50d('0xd7')],'ListId':_0x5081ce[_0xb50d('0xd8')],'VoiceQueueId':_0x5081ce[_0xb50d('0xd9')]||undefined,'CampaignId':_0x5081ce[_0xb50d('0xe5')]||undefined})[_0xb50d('0x9e')](loggerCatch('[rescheduleContact][Machine]'));_0x541776({'reschedule':0x1});}}});}if(_0x50ce37[_0xb50d('0x3e')]===_0xb50d('0xbc')&&this[_0xb50d('0x1c')][_0x50ce37['queue']][_0xb50d('0x108')]&&_0x407566[_0xb50d('0x111')]===_0xb50d('0x109')){delete this[_0xb50d('0xbb')][_0x407566['uniqueid']];this['updateOriginated'](this[_0xb50d('0x1c')][_0x50ce37[_0xb50d('0xba')]]);_0x3717cc=new Hangup(_0x50ce37,_0x407566);_0x3717cc[_0xb50d('0x6c')]=0x12;_0x3717cc[_0xb50d('0x6d')]=_0xb50d('0x10b');_0x3717cc[_0xb50d('0x11f')]=_0xb50d('0x120');ami[_0xb50d('0x3d')](_0xb50d('0x10c'),ut[_0xb50d('0x10d')](_0x3717cc,_0xb50d('0x10e')));this['saveInDb'](_0x3717cc,_0xb50d('0x121'),'[syncHangupInAMDIvr]');}if(_0x50ce37['type']===_0xb50d('0xbc')&&this[_0xb50d('0x1c')][_0x50ce37[_0xb50d('0xba')]]['dialAMDActive']&&_0x407566[_0xb50d('0x111')]===_0xb50d('0x122')){return new Promise(function(_0x493ef5,_0x14a07d){delete _0x3a9ecc[_0xb50d('0xbb')][_0x407566['uniqueid']];_0x3a9ecc[_0xb50d('0xc8')](_0x3a9ecc[_0xb50d('0x1c')][_0x50ce37[_0xb50d('0xba')]]);_0x3a9ecc[_0xb50d('0x1c')][_0x50ce37[_0xb50d('0xba')]]['outboundAnswerCallsDay']+=0x1;_0x3a9ecc[_0xb50d('0x1c')][_0x50ce37[_0xb50d('0xba')]][_0xb50d('0x10a')]+=0x1;var _0x1a5d87=_0x3a9ecc[_0xb50d('0x1c')][_0x50ce37[_0xb50d('0xba')]];var _0x1dde59=new Hangup(_0x50ce37,_0x407566);_0x1dde59[_0xb50d('0x6c')]=0x13;_0x1dde59[_0xb50d('0x6d')]=_0xb50d('0x123');_0x1dde59[_0xb50d('0x11f')]=_0xb50d('0x120');_0x1dde59[_0xb50d('0x116')]+=0x1;_0x1dde59[_0xb50d('0xcf')]+=0x1;_0x1dde59[_0xb50d('0x10e')]=!![];ami[_0xb50d('0x3d')](_0xb50d('0x10c'),ut[_0xb50d('0x10d')](_0x1dde59,_0xb50d('0x10e')));hopperUtils['createHistory'](_0x1dde59)[_0xb50d('0x9e')](loggerCatch('[syncAgentComplete][createHistory][0]'));if(_0x1dde59['countbusyretry']+_0x1dde59[_0xb50d('0x114')]+_0x1dde59[_0xb50d('0x124')]+_0x1dde59[_0xb50d('0x115')]+_0x1dde59[_0xb50d('0xce')]+_0x1dde59[_0xb50d('0xe4')]+_0x1dde59['countmachineretry']+_0x1dde59['countagentrejectretry']>=_0x1a5d87[_0xb50d('0x118')]){_0x3a9ecc[_0xb50d('0x119')](_0x1dde59,_0x493ef5,_0x14a07d,_0xb50d('0x11a'));}else{if(_0x1dde59['countmachineretry']>=_0x1a5d87[_0xb50d('0x11b')]){_0x3a9ecc[_0xb50d('0x11c')](_0x1dde59,_0x493ef5,_0x14a07d,_0xb50d('0x11d'));}else{hopperUtils[_0xb50d('0xd3')]({'active':![],'countmachineretry':_0x1dde59[_0xb50d('0x116')],'scheduledat':moment()[_0xb50d('0xd4')](_0x1a5d87[_0xb50d('0x11e')],_0xb50d('0xd6'))[_0xb50d('0x42')](_0xb50d('0xbf')),'ContactId':_0x1dde59[_0xb50d('0xd7')],'ListId':_0x1dde59['ListId'],'VoiceQueueId':_0x1dde59[_0xb50d('0xd9')]||undefined,'CampaignId':_0x1dde59[_0xb50d('0xe5')]||undefined})[_0xb50d('0x9e')](loggerCatch(_0xb50d('0x125')));_0x493ef5({'reschedule':0x1});}}});}}};Dialer[_0xb50d('0x81')][_0xb50d('0x32')]=function(_0x38ae74){var _0x58dc65=this[_0xb50d('0xbb')][_0x38ae74[_0xb50d('0xbd')]];var _0x2f8617;if(_0x58dc65&&_0x58dc65[_0xb50d('0x3e')]===_0xb50d('0xbc')){delete this[_0xb50d('0xbb')][_0x38ae74[_0xb50d('0xbd')]];this['updateOriginated'](this['campaigns'][_0x58dc65[_0xb50d('0xba')]]);this['campaigns'][_0x58dc65[_0xb50d('0xba')]][_0xb50d('0x126')]+=0x1;_0x2f8617=new Hangup(_0x58dc65,_0x38ae74);hopperUtils['createHistory'](_0x2f8617)[_0xb50d('0x9e')](loggerCatch(_0xb50d('0x127')));hopperUtils[_0xb50d('0x128')](_0x2f8617)[_0xb50d('0x9e')](loggerCatch(_0xb50d('0x129')));}if(_0x58dc65&&_0x58dc65[_0xb50d('0x3e')]!==_0xb50d('0xbc')&&isNotNull(this[_0xb50d('0x1b')][_0x58dc65[_0xb50d('0xba')]]['dialQueueProject'])){delete this['uniqueId'][_0x38ae74[_0xb50d('0xbd')]];this[_0xb50d('0xc8')](this['voiceQueues'][_0x58dc65[_0xb50d('0xba')]]);this[_0xb50d('0x1b')][_0x58dc65[_0xb50d('0xba')]]['outboundAnswerCallsDay']+=0x1;this[_0xb50d('0x1b')][_0x58dc65[_0xb50d('0xba')]][_0xb50d('0x10a')]+=0x1;_0x2f8617=new Hangup(_0x58dc65,_0x38ae74);_0x2f8617[_0xb50d('0x6c')]=0x10;_0x2f8617['statedesc']=_0xb50d('0x12a');_0x2f8617[_0xb50d('0x11f')]=_0xb50d('0x12b');hopperUtils[_0xb50d('0xc6')](_0x2f8617)[_0xb50d('0x9e')](loggerCatch(_0xb50d('0x127')));hopperUtils[_0xb50d('0x128')](_0x2f8617)[_0xb50d('0x9e')](loggerCatch(_0xb50d('0x129')));}if(_0x58dc65&&_0x58dc65['type']!==_0xb50d('0xbc')&&!isNotNull(this['voiceQueues'][_0x58dc65[_0xb50d('0xba')]][_0xb50d('0x12c')])){delete this[_0xb50d('0xbb')][_0x38ae74[_0xb50d('0xbd')]];this[_0xb50d('0xc8')](this['voiceQueues'][_0x58dc65[_0xb50d('0xba')]]);this[_0xb50d('0x1b')][_0x58dc65[_0xb50d('0xba')]][_0xb50d('0x12d')]+=0x1;_0x2f8617=new Hangup(_0x58dc65,_0x38ae74);_0x2f8617['state']=0xc;_0x2f8617['statedesc']=_0x38ae74[_0xb50d('0x12e')];_0x2f8617['membername']='Unknow';hopperUtils['createHistory'](_0x2f8617)[_0xb50d('0x9e')](loggerCatch('[syncHangupIvr][createHistory]'));hopperUtils[_0xb50d('0x128')](_0x2f8617)[_0xb50d('0x9e')](loggerCatch(_0xb50d('0x129')));}};Dialer[_0xb50d('0x81')][_0xb50d('0x9')]=function(_0x17f2c8){var _0x3528a2=this;if(!_0x3528a2['queuesSummary'][_0x17f2c8[_0xb50d('0x5f')]]){_0x3528a2[_0xb50d('0x12f')][_0x17f2c8[_0xb50d('0x5f')]]={'running':![]};}else if(_0x3528a2['queuesSummary'][_0x17f2c8[_0xb50d('0x5f')]][_0xb50d('0x130')]===!![]){return;}else if(_0x3528a2[_0xb50d('0x12f')][_0x17f2c8[_0xb50d('0x5f')]][_0xb50d('0x130')]===![]){_0x3528a2[_0xb50d('0x12f')][_0x17f2c8[_0xb50d('0x5f')]][_0xb50d('0x130')]=!![];}var _0x592c6e=_0x3528a2['voiceQueues'][_0x17f2c8[_0xb50d('0x5f')]];var _0x1dec28=_0x592c6e[_0xb50d('0x67')]!==utils[_0xb50d('0x68')][_0xb50d('0x78')];var _0x572d53=utils[_0xb50d('0x131')](_0x592c6e);_0x592c6e['statusMessage']=utils[_0xb50d('0x132')](_0x592c6e,_0x3528a2[_0xb50d('0x1e')]);Promise[_0xb50d('0xa8')]()['then'](function(){if(_0x592c6e[_0xb50d('0x133')]===utils[_0xb50d('0x68')][_0xb50d('0x78')]){if(_0x1dec28){clearPredictiveAttributes(_0x592c6e);_0x17f2c8['startPredictive']=undefined;_0x17f2c8[_0xb50d('0x25')]=undefined;}if(_0x592c6e[_0xb50d('0x133')]===utils[_0xb50d('0x68')][_0xb50d('0x78')]){_0x17f2c8['available']=0x0;_0x17f2c8[_0xb50d('0xee')]=0x0;_0x17f2c8[_0xb50d('0x134')]=0x0;_0x17f2c8[_0xb50d('0x135')]=0x0;_0x17f2c8[_0xb50d('0x136')]=0x0;}}else if(_0x592c6e[_0xb50d('0x133')]===utils[_0xb50d('0x68')][_0xb50d('0x137')]&&!_0x572d53){return _0x3528a2['ifTime'](_0x592c6e,!![])['then'](function(){return _0x3528a2[_0xb50d('0x8f')](_0x592c6e,![]);})[_0xb50d('0x3c')](function(){return _0x3528a2[_0xb50d('0xad')](_0x592c6e);})['catch'](function(_0x21ede4){loggerSyncQueueSummary[_0xb50d('0x5e')](_0xb50d('0x138'),util[_0xb50d('0x41')](_0x21ede4,{'showHidden':![],'depth':null}));clearPredictiveAttributes(_0x592c6e);});}else{clearPredictiveAttributes(_0x592c6e);}})['then'](function(){var _0x49580d=_0x17f2c8[_0xb50d('0x139')](_0x592c6e);if(_0x49580d||_0x592c6e[_0xb50d('0x13a')]){_0x592c6e[_0xb50d('0x13a')]=![];_0x17f2c8[_0xb50d('0x13b')](_0x592c6e);Object[_0xb50d('0x13c')](_0x592c6e,_0x17f2c8);emitOutboundVoiceQueueSummary(_0x17f2c8);}_0x3528a2[_0xb50d('0x12f')][_0x592c6e['name']][_0xb50d('0x130')]=![];})[_0xb50d('0x9e')](function(_0x4a157d){logger[_0xb50d('0x64')](_0xb50d('0x138'),util['inspect'](_0x4a157d,{'showHidden':![],'depth':null}));_0x3528a2[_0xb50d('0x12f')][_0x592c6e[_0xb50d('0x5f')]]['running']=![];});};Dialer[_0xb50d('0x81')]['syncQueueSummaryComplete']=_['throttle'](function(){var _0xa80b75=_[_0xb50d('0x13d')](this['voiceQueues'],function(_0x316cf5){return _0x316cf5[_0xb50d('0x13e')];});var _0x450fd4=_[_0xb50d('0x13d')](this['agents'],function(_0x4e23fc){return _0x4e23fc['online']&&_0x4e23fc['status']===_0xb50d('0x13f');});if(_0xa80b75['length']>0x0&&_0x450fd4[_0xb50d('0x96')]>0x0){return Promise[_0xb50d('0xa8')]()[_0xb50d('0x3c')](cmHopper['handlePreviewRecallNotifications'](_[_0xb50d('0x140')](_0xa80b75,'id'),previewRecallmeReminderInterval,_[_0xb50d('0x140')](_0x450fd4,'id')))[_0xb50d('0x3c')](function(_0x3cba18){for(var _0x4d4164=0x0;_0x4d4164<_0x3cba18[_0xb50d('0x96')];_0x4d4164++){var _0x5e809e=_0x3cba18[_0x4d4164][_0xb50d('0x141')][_0xb50d('0x5f')];if(_0x5e809e)io['to'](util[_0xb50d('0x42')](_0xb50d('0x142'),_0x5e809e))[_0xb50d('0x3d')]('user:dialPreviewRecallReminder',{'hopper':_0x3cba18[_0x4d4164]});}})[_0xb50d('0x9e')](function(_0x6bc4b9){logger[_0xb50d('0x64')]('checkPreviewRecallReminder',_0x6bc4b9);});}},0x3c*0x3e8,{'leading':!![]});Dialer[_0xb50d('0x81')][_0xb50d('0x3a')]=function(){var _0x4429eb=this;setInterval(function(){_0x4429eb[_0xb50d('0x143')](_0x4429eb['uniqueId'],'[uniqueid]');_0x4429eb[_0xb50d('0x143')](_0x4429eb[_0xb50d('0x21')],_0xb50d('0x144'));},0x32c8);};Dialer[_0xb50d('0x81')][_0xb50d('0x143')]=function(_0x4dee01,_0x1b48de){var _0x6b8097=this;for(var _0x36109d in _0x4dee01){if(typeof _0x4dee01[_0x36109d]!=='undefined'){this[_0xb50d('0x145')][_0xb50d('0x146')](function(){if(!_[_0xb50d('0xed')](_0x4dee01[_0x36109d])){return ami['Action']({'action':_0xb50d('0x85'),'channel':_0x4dee01[_0x36109d]['channel']})[_0xb50d('0x9e')](function(_0x430851){if(_0x430851['message']==='No\x20such\x20channel'){setTimeout(function(){if(_0x4dee01[_0x36109d]&&_0x4dee01[_0x36109d][_0xb50d('0x3e')]!==_0xb50d('0xbc')){_0x6b8097[_0xb50d('0xc8')](_0x6b8097[_0xb50d('0x1b')][_0x4dee01[_0x36109d][_0xb50d('0xba')]]);logger[_0xb50d('0x64')](_0xb50d('0x147'),_0x1b48de,_0x36109d,_0x4dee01[_0x36109d][_0xb50d('0xba')]);delete _0x4dee01[_0x36109d];}if(_0x4dee01[_0x36109d]&&_0x4dee01[_0x36109d][_0xb50d('0x3e')]===_0xb50d('0xbc')){_0x6b8097[_0xb50d('0xc8')](_0x6b8097[_0xb50d('0x1c')][_0x4dee01[_0x36109d][_0xb50d('0xba')]]);logger['error']('[Dialer][checkChannel][ivr]',_0x1b48de,_0x36109d,_0x4dee01[_0x36109d][_0xb50d('0xba')]);delete _0x4dee01[_0x36109d];}},0x2328);}});}});}}};Dialer[_0xb50d('0x81')][_0xb50d('0x148')]=function(_0x8e76f2){return Promise[_0xb50d('0xa8')]()[_0xb50d('0x3c')](voiceQueueRt['getVoiceQueueRtPauses'](_0x8e76f2))[_0xb50d('0x9e')](loggerCatch('[getVoiceQueueRtPauses]\x20'));};Dialer[_0xb50d('0x81')][_0xb50d('0xc8')]=function(_0x27d63f){if(!_['isUndefined'](_0x27d63f)&&_0x27d63f!==null){if(typeof _0x27d63f[_0xb50d('0x7c')]!==_0xb50d('0x149')){if(_0x27d63f[_0xb50d('0x7c')]>0x0){_0x27d63f['originated']-=0x1;}else{logger['error'](_0xb50d('0x14a'));}}}else{logger[_0xb50d('0x64')]('[updateOriginated]\x20is\x20null\x20or\x20undefined');}};Dialer[_0xb50d('0x81')]['loggerHandler']=function(_0x29c75b,_0x413b2a){var _0xd926aa=this;return function(_0x28eb44){_0xd926aa[_0xb50d('0xc8')](_0x413b2a);logger[_0xb50d('0x64')](_0x29c75b,util[_0xb50d('0x41')](_0x28eb44,{'showHidden':![],'depth':null}));};};Dialer[_0xb50d('0x81')][_0xb50d('0x14b')]=function(_0x22f5cd,_0x24a51b,_0x352c70){var _0x13fe5a={'state':0x19,'statedesc':_0xb50d('0x14c')};this[_0xb50d('0xc8')](_0x24a51b);this[_0xb50d('0x10f')](_[_0xb50d('0xf3')](_0x13fe5a,_['pick'](_0x352c70,[_0xb50d('0xd7'),_0xb50d('0xd8'),_0xb50d('0x14d'),'VoiceQueueId',_0xb50d('0xe5')])),_0xb50d('0x14e'),_0xb50d('0x14f'));logger[_0xb50d('0x64')](_0x22f5cd);};Dialer['prototype']['saveInDb']=function(_0x585289,_0x25dc52,_0x5a9286){hopperUtils['createHistory'](_0x585289)[_0xb50d('0x9e')](loggerCatch(_0x25dc52));hopperUtils['moveContactManagedDialer'](_0x585289)[_0xb50d('0x9e')](loggerCatch(_0x5a9286));};Dialer[_0xb50d('0x81')][_0xb50d('0xd2')]=function(_0x506883,_0x3f4512){hopperUtils[_0xb50d('0xc6')](_0x506883)[_0xb50d('0x9e')](loggerCatch('[syncAgentComplete][createHistory]'));if(_0x3f4512==0x0){hopperUtils[_0xb50d('0x128')](_0x506883)[_0xb50d('0x9e')](loggerCatch('[syncQueueCallerAbandon]\x20[Drop]'));}};Dialer[_0xb50d('0x81')][_0xb50d('0x150')]=function(_0x5502a4){return Promise[_0xb50d('0xa8')]()[_0xb50d('0x3c')](cmHopper['handlePreviewRecallNotifications'](_0x5502a4['id'],previewRecallmeReminderInterval))['then'](function(_0x2a1d31){for(var _0x246954=0x0;_0x246954<_0x2a1d31[_0xb50d('0x96')];_0x246954++){var _0x41ba41=_0x2a1d31[_0x246954][_0xb50d('0x141')]['name'];if(_0x41ba41)io['to'](util['format'](_0xb50d('0x142'),_0x41ba41))[_0xb50d('0x3d')]('user:dialPreviewRecallReminder',{'hopper':_0x2a1d31[_0x246954]});}})[_0xb50d('0x9e')](function(){});};Dialer[_0xb50d('0x81')]['launchHandleIvr']=function(_0x4255bd){var _0x57b452=this;return function(){_0x57b452['handleIvr'](_0x4255bd);};};Dialer[_0xb50d('0x81')][_0xb50d('0x151')]=function(_0x4f1d45,_0x1f8381){var _0x569afe=this;var _0x48b194=uuid['v4']();this[_0xb50d('0x21')][_0x48b194]=new Action(_0x4f1d45,_0x1f8381,_0x48b194);return new Promise(function(_0x223789,_0x308fe6){if(_[_0xb50d('0x52')](_0x4f1d45)&&typeof _0x4f1d45!==_0xb50d('0x152')){return _0x308fe6(msgResponse(_0xb50d('0x153'),_0xb50d('0x90'),_0xb50d('0x154')));}if(_['isUndefined'](_0x1f8381['phone'])||_0x1f8381[_0xb50d('0x155')]===null){return _0x308fe6(msgResponse('originate',_0xb50d('0x90'),'contact\x20is\x20undefine'));}var _0x300e9c={'XMD-CALLERID':_0x569afe[_0xb50d('0x21')][_0x48b194][_0xb50d('0x156')](),'XMD-AGI':_0x4f1d45[_0xb50d('0x12c')]?util['format']('\x22agi://%s/square,%s\x22',ipAgi,_0x4f1d45['dialQueueProject']):'NONE','XMD-AGIAFTER':_0x4f1d45[_0xb50d('0xc4')]?util[_0xb50d('0x42')](_0xb50d('0x157'),ipAgi,_0x4f1d45['dialQueueProject2']):_0xb50d('0x158'),'XMD-QUEUE':utils[_0xb50d('0x159')](_0x4f1d45)?util[_0xb50d('0x42')](_0xb50d('0x15a'),_0x4f1d45['name'],_0x4f1d45[_0xb50d('0x15b')]||'',_0x4f1d45[_0xb50d('0xc5')]?'c':'',_0x4f1d45[_0xb50d('0x15c')]||0x3):'NONE','XMD-CONTACTID':_0x1f8381[_0xb50d('0xd7')],'XMD-CDRTYPE':'dialer','CALLERID(all)':_0x569afe[_0xb50d('0x21')][_0x48b194]['getCaller'](),'XMD-AMD':_0x4f1d45['dialAMDActive']?_0xb50d('0x137'):_0xb50d('0x158'),'XMD-DESTINATION':'xcally-motion-dialer'};if(_0x4f1d45[_0xb50d('0x108')]){_0x300e9c['XMD-AMDINITIALSILENCE']=_0x4f1d45['dialAMDInitialSilence']||0x9c4;_0x300e9c[_0xb50d('0x15d')]=_0x4f1d45[_0xb50d('0x15e')]||0x5dc;_0x300e9c[_0xb50d('0x15f')]=_0x4f1d45['dialAMDAfterGreetingSilence']||0x320;_0x300e9c[_0xb50d('0x160')]=_0x4f1d45['dialAMDTotalAnalysisTime']||0x1388;_0x300e9c[_0xb50d('0x161')]=_0x4f1d45[_0xb50d('0x162')]||0x64;_0x300e9c[_0xb50d('0x163')]=_0x4f1d45[_0xb50d('0x164')]||0x32;_0x300e9c[_0xb50d('0x165')]=_0x4f1d45[_0xb50d('0x166')]||0x3;_0x300e9c['XMD-AMDSILENCETHRESHOLD']=_0x4f1d45['dialAMDSilenceThreshold']||0x100;_0x300e9c[_0xb50d('0x167')]=_0x4f1d45['dialAMDMaximumWordLength']||0x1388;}if(utils[_0xb50d('0x159')](_0x4f1d45)){_0x300e9c[_0xb50d('0x168')]=_0x1f8381[_0xb50d('0xd9')];}else{_0x300e9c['XMD-CAMPAIGNID']=_0x1f8381[_0xb50d('0xe5')];}var _0xc1d4c3=utils[_0xb50d('0x169')](_0x1f8381[_0xb50d('0x16a')]);Object[_0xb50d('0x13c')](_0x300e9c,_0xc1d4c3);var _0x2dfd9d=_0x569afe[_0xb50d('0x82')](_0x4f1d45['Trunk'])?utils[_0xb50d('0x16b')](_0x4f1d45['Trunk'][_0xb50d('0x16c')],_0x4f1d45['dialOriginateCallerIdName'],_0x4f1d45['dialRandomLastDigitCallerIdNumber']>0x0?utils['getCallerIdRandom'](_0x4f1d45[_0xb50d('0x16d')],_0x4f1d45[_0xb50d('0x16e')]):_0x4f1d45['dialOriginateCallerIdNumber']):utils[_0xb50d('0x16b')](_[_0xb50d('0xed')](_0x4f1d45['TrunkBackup'])?_0x4f1d45[_0xb50d('0x88')][_0xb50d('0x16c')]:_0x4f1d45[_0xb50d('0x89')][_0xb50d('0x16c')],_0x4f1d45[_0xb50d('0x16f')],_0x4f1d45[_0xb50d('0x16e')]>0x0?utils[_0xb50d('0x170')](_0x4f1d45[_0xb50d('0x16d')],_0x4f1d45['dialRandomLastDigitCallerIdNumber']):_0x4f1d45['dialOriginateCallerIdNumber']);if(_0x2dfd9d){_0x300e9c[_0xb50d('0x171')]=_0x569afe[_0xb50d('0x21')][_0x48b194]['originatecalleridname']=utils[_0xb50d('0x172')](_0x2dfd9d);_0x300e9c[_0xb50d('0x173')]=_0x1f8381['phone'];}_0x4f1d45[_0xb50d('0x174')]=_0x300e9c;return ami[_0xb50d('0x97')]({'actionid':_0x48b194,'action':_0xb50d('0x153'),'channel':_0x569afe['isTrunkReachable'](_0x4f1d45[_0xb50d('0x88')])?util[_0xb50d('0x42')](_0xb50d('0x175'),_0x4f1d45[_0xb50d('0x88')][_0xb50d('0x5f')],isNotNull(_0x4f1d45['dialPrefix'])?_0x4f1d45[_0xb50d('0x176')]['trim']()||'':'',_0x4f1d45['dialCutDigit']>0x0?_0x1f8381[_0xb50d('0x155')]['substring'](_0x4f1d45[_0xb50d('0x177')]):_0x1f8381[_0xb50d('0x155')]):util['format'](_0xb50d('0x175'),_[_0xb50d('0xed')](_0x4f1d45[_0xb50d('0x89')])?_0x4f1d45[_0xb50d('0x88')][_0xb50d('0x5f')]:_0x4f1d45[_0xb50d('0x89')][_0xb50d('0x5f')],isNotNull(_0x4f1d45[_0xb50d('0x176')])?_0x4f1d45['dialPrefix']['trim']()||'':'',_0x4f1d45['dialCutDigit']>0x0?_0x1f8381[_0xb50d('0x155')]['substring'](_0x4f1d45[_0xb50d('0x177')]):_0x1f8381[_0xb50d('0x155')]),'callerid':_0x2dfd9d,'Exten':'xcally-motion-dialer','Context':'from-sip','Priority':'1','variable':_0x300e9c,'timeout':(_0x4f1d45[_0xb50d('0x178')]||0x1e)*0x3e8,'async':!![],'channelid':_0x48b194})[_0xb50d('0x3c')](function(_0x1cf01e){return _0x223789(_0x1cf01e);})[_0xb50d('0x9e')](function(_0x320ba0){_0x4f1d45[_0xb50d('0x179')]+=0x1;var _0x1a7c50=new History(_0x569afe[_0xb50d('0x21')][_0x48b194]);logger[_0xb50d('0x64')](util[_0xb50d('0x42')](_0xb50d('0x17a'),JSON[_0xb50d('0x70')](_0x320ba0)));_0x1a7c50[_0xb50d('0x6c')]=0xe;_0x1a7c50[_0xb50d('0x6d')]='OriginateError';_0x1a7c50['starttime']=moment()[_0xb50d('0x42')](_0xb50d('0xbf'));_0x1a7c50[_0xb50d('0xe7')]=_0x1a7c50['starttime'];hopperUtils[_0xb50d('0xc6')](_0x1a7c50)['catch'](loggerCatch(_0xb50d('0x17b')));_0x569afe['moveContactManagedDialer'](_0x1a7c50)[_0xb50d('0x9e')](loggerCatch(_0xb50d('0x17b')))['finally'](function(){delete _0x569afe[_0xb50d('0x21')][_0x48b194];return _0x308fe6(msgResponse(_0xb50d('0x153'),_0xb50d('0xb9'),_0xb50d('0x17c')));});});});};Dialer[_0xb50d('0x81')][_0xb50d('0x17d')]=function(_0x1ad833,_0x19b5f6,_0x27afee){var _0x3a7be2=new History(_0x19b5f6);if(_0x3a7be2[_0xb50d('0x113')]+_0x3a7be2['countcongestionretry']+_0x3a7be2[_0xb50d('0x124')]+_0x3a7be2[_0xb50d('0x115')]+_0x3a7be2['countdropretry']+_0x3a7be2[_0xb50d('0xe4')]+_0x3a7be2['countmachineretry']+_0x3a7be2[_0xb50d('0x117')]>=_0x27afee[_0xb50d('0x118')]-0x1){return!![];}switch(_0x1ad833){case 0x3:if(_0x3a7be2['countnoanswerretry']>=_0x27afee['dialNoAnswerMaxRetry']-0x1){return!![];}hopperUtils[_0xb50d('0xd3')]({'active':![],'countnoanswerretry':_0x3a7be2[_0xb50d('0x124')]+=0x1,'scheduledat':moment()[_0xb50d('0xd4')](_0x27afee[_0xb50d('0x17e')],_0xb50d('0xd6'))[_0xb50d('0x42')](_0xb50d('0xbf')),'ContactId':_0x3a7be2['ContactId'],'ListId':_0x3a7be2[_0xb50d('0xd8')],'VoiceQueueId':_0x3a7be2[_0xb50d('0xd9')]||undefined,'CampaignId':_0x3a7be2[_0xb50d('0xe5')]||undefined})[_0xb50d('0x9e')](loggerCatch('[rescheduleContact][NoAnswer]'));break;case 0x5:if(_0x3a7be2[_0xb50d('0x113')]>=_0x27afee[_0xb50d('0x17f')]-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countbusyretry':_0x3a7be2[_0xb50d('0x113')]+=0x1,'scheduledat':moment()[_0xb50d('0xd4')](_0x27afee[_0xb50d('0x180')],_0xb50d('0xd6'))[_0xb50d('0x42')](_0xb50d('0xbf')),'ContactId':_0x3a7be2[_0xb50d('0xd7')],'ListId':_0x3a7be2['ListId'],'VoiceQueueId':_0x3a7be2[_0xb50d('0xd9')]||undefined,'CampaignId':_0x3a7be2[_0xb50d('0xe5')]||undefined})[_0xb50d('0x9e')](loggerCatch(_0xb50d('0x181')));break;case 0x8:if(_0x3a7be2[_0xb50d('0x114')]>=_0x27afee['dialCongestionMaxRetry']-0x1){return!![];}hopperUtils[_0xb50d('0xd3')]({'active':![],'countcongestionretry':_0x3a7be2[_0xb50d('0x114')]+=0x1,'scheduledat':moment()[_0xb50d('0xd4')](_0x27afee['dialCongestionRetryFrequency'],'minutes')[_0xb50d('0x42')](_0xb50d('0xbf')),'ContactId':_0x3a7be2[_0xb50d('0xd7')],'ListId':_0x3a7be2['ListId'],'VoiceQueueId':_0x3a7be2[_0xb50d('0xd9')]||undefined,'CampaignId':_0x3a7be2[_0xb50d('0xe5')]||undefined})[_0xb50d('0x9e')](loggerCatch(_0xb50d('0x182')));break;case 0x0:if(_0x3a7be2['countnosuchnumberretry']>=_0x27afee[_0xb50d('0x183')]-0x1){return!![];}else{hopperUtils[_0xb50d('0xd3')]({'active':![],'countnosuchnumberretry':_0x3a7be2[_0xb50d('0x115')]+=0x1,'scheduledat':moment()[_0xb50d('0xd4')](_0x27afee['dialNoSuchNumberRetryFrequency'],_0xb50d('0xd6'))[_0xb50d('0x42')](_0xb50d('0xbf')),'ContactId':_0x3a7be2[_0xb50d('0xd7')],'ListId':_0x3a7be2[_0xb50d('0xd8')],'VoiceQueueId':_0x3a7be2[_0xb50d('0xd9')]||undefined,'CampaignId':_0x3a7be2['CampaignId']||undefined})[_0xb50d('0x9e')](loggerCatch(_0xb50d('0x184')));}break;case 0xa:if(_0x3a7be2['countdropretry']>=_0x27afee['dialDropMaxRetry']-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countdropretry':_0x3a7be2[_0xb50d('0xce')]+=0x1,'scheduledat':moment()[_0xb50d('0xd4')](_0x27afee[_0xb50d('0xd5')],'minutes')[_0xb50d('0x42')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x3a7be2['ContactId'],'ListId':_0x3a7be2[_0xb50d('0xd8')],'VoiceQueueId':_0x3a7be2[_0xb50d('0xd9')]||undefined,'CampaignId':_0x3a7be2[_0xb50d('0xe5')]||undefined})[_0xb50d('0x9e')](loggerCatch('[rescheduleContact][Drop]'));break;case 0xb:if(_0x3a7be2[_0xb50d('0xe4')]>=_0x27afee['dialAbandonedMaxRetry']-0x1){return!![];}hopperUtils[_0xb50d('0xd3')]({'active':![],'countabandonedretry':_0x3a7be2[_0xb50d('0xe4')]+=0x1,'scheduledat':moment()[_0xb50d('0xd4')](_0x27afee[_0xb50d('0x185')],_0xb50d('0xd6'))[_0xb50d('0x42')](_0xb50d('0xbf')),'ContactId':_0x3a7be2['ContactId'],'ListId':_0x3a7be2['ListId'],'VoiceQueueId':_0x3a7be2[_0xb50d('0xd9')]||undefined,'CampaignId':_0x3a7be2[_0xb50d('0xe5')]||undefined})[_0xb50d('0x9e')](loggerCatch(_0xb50d('0x186')));break;case 0x13:if(_0x3a7be2[_0xb50d('0x116')]>=_0x27afee['dialMachineMaxRetry']-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countmachineretry':_0x3a7be2[_0xb50d('0x116')]+=0x1,'scheduledat':moment()[_0xb50d('0xd4')](_0x27afee[_0xb50d('0x11e')],_0xb50d('0xd6'))[_0xb50d('0x42')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x3a7be2[_0xb50d('0xd7')],'ListId':_0x3a7be2['ListId'],'VoiceQueueId':_0x3a7be2[_0xb50d('0xd9')]||undefined,'CampaignId':_0x3a7be2[_0xb50d('0xe5')]||undefined})[_0xb50d('0x9e')](loggerCatch(_0xb50d('0x125')));break;case 0x14:if(_0x3a7be2[_0xb50d('0x117')]>=_0x27afee[_0xb50d('0x187')]-0x1){return!![];}hopperUtils[_0xb50d('0xd3')]({'active':![],'countagentrejectretry':_0x3a7be2[_0xb50d('0x117')]+=0x1,'scheduledat':moment()[_0xb50d('0xd4')](_0x27afee[_0xb50d('0x188')],_0xb50d('0xd6'))['format'](_0xb50d('0xbf')),'ContactId':_0x3a7be2[_0xb50d('0xd7')],'ListId':_0x3a7be2[_0xb50d('0xd8')],'VoiceQueueId':_0x3a7be2[_0xb50d('0xd9')]||undefined,'CampaignId':_0x3a7be2[_0xb50d('0xe5')]||undefined})[_0xb50d('0x9e')](loggerCatch('[rescheduleContact][AgentReject]'));break;default:return!![];}};Dialer[_0xb50d('0x81')]['callProgressDetecting']=function(_0x2feea1,_0x23230d,_0x4763f4){var _0x29d450=this;var _0x254956=new History(_0x2feea1);var _0x14fb59=![];var _0x3fe44;var _0x29eb13;return new Promise(function(_0xbc4e3b,_0x54071e){if(_['isUndefined'](_0x23230d)&&typeof _0x23230d!=='object'){return _0x54071e(msgResponse('[callProgressDetecting]',_0xb50d('0x90'),'entity\x20is\x20undefine'));}if(_[_0xb50d('0x52')](_0x4763f4)&&typeof _0x4763f4!==_0xb50d('0x152')){return _0x54071e(msgResponse('[callProgressDetecting]',_0xb50d('0x90'),'evt\x20is\x20undefine'));}hopperUtils[_0xb50d('0xd0')](_0x254956,_0x4763f4[_0xb50d('0xc1')],_0x23230d)['then'](function(_0x21cf7c){if(_0x21cf7c[_0xb50d('0xe3')]==0x1)_0x14fb59=!![];switch(_0x4763f4[_0xb50d('0xc1')]){case'0':_0x23230d[_0xb50d('0x189')]+=0x1;_0x254956[_0xb50d('0x6c')]=0x0;_0x254956[_0xb50d('0x6d')]=_0xb50d('0x18a');_0x254956[_0xb50d('0x115')]+=0x1;_0x254956['countglobal']+=0x1;ami[_0xb50d('0x3d')]('custom:agentnosuchnumber',ut['buildObj'](_0x2feea1,'nosuchnumber'));_0x3fe44=_0x23230d['dialNoSuchNumberRetryFrequency'];_0x29eb13=_0x23230d[_0xb50d('0xe1')];hopperUtils[_0xb50d('0xc6')](_0x254956)[_0xb50d('0x9e')](loggerCatch(_0xb50d('0x112')));if(_0x29d450['checkRetriveMax'](0x0,_0x2feea1,_0x23230d)&&!_0x14fb59){if(_0x254956[_0xb50d('0x115')]>=_0x23230d[_0xb50d('0x183')]){_0x29d450[_0xb50d('0x11c')](_0x254956,_0xbc4e3b,_0x54071e,_0xb50d('0x18b'));}else{_0x29d450[_0xb50d('0x119')](_0x254956,_0xbc4e3b,_0x54071e,_0xb50d('0x18b'));}}break;case'3':_0x23230d[_0xb50d('0x18c')]+=0x1;_0x254956[_0xb50d('0x6c')]=0x3;_0x254956['statedesc']=_0xb50d('0x18d');_0x254956['countnoanswerretry']+=0x1;_0x254956[_0xb50d('0xcf')]+=0x1;var _0x3efdb8=ut[_0xb50d('0x18e')](_0x2feea1,_0x23230d);ami[_0xb50d('0x3d')](_0xb50d('0x18f'),_0x3efdb8);_0x3fe44=_0x23230d[_0xb50d('0x17e')];_0x29eb13=_0x23230d[_0xb50d('0xe1')];hopperUtils[_0xb50d('0xc6')](_0x254956)[_0xb50d('0x9e')](loggerCatch('[syncAgentComplete][createHistory][3]'));if(_0x29d450['checkRetriveMax'](0x3,_0x2feea1,_0x23230d)&&!_0x14fb59){if(_0x254956[_0xb50d('0x124')]>=_0x23230d['dialNoAnswerMaxRetry']){_0x29d450[_0xb50d('0x11c')](_0x254956,_0xbc4e3b,_0x54071e,'reason\x203\x20ringing\x20no\x20answer');}else{_0x29d450[_0xb50d('0x119')](_0x254956,_0xbc4e3b,_0x54071e,'reason\x203\x20ringing\x20no\x20answer');}}break;case'5':_0x23230d[_0xb50d('0x190')]+=0x1;_0x254956[_0xb50d('0x6c')]=0x5;_0x254956[_0xb50d('0x6d')]=_0xb50d('0x191');_0x254956['countbusyretry']+=0x1;_0x254956[_0xb50d('0xcf')]+=0x1;ami[_0xb50d('0x3d')](_0xb50d('0x192'),ut[_0xb50d('0x10d')](_0x2feea1,_0xb50d('0x193')));_0x3fe44=_0x23230d[_0xb50d('0x180')];_0x29eb13=_0x23230d[_0xb50d('0xe1')];hopperUtils[_0xb50d('0xc6')](_0x254956)['catch'](loggerCatch('[syncAgentComplete][createHistory][5]'));if(_0x29d450['checkRetriveMax'](0x5,_0x2feea1,_0x23230d)&&!_0x14fb59){if(_0x254956[_0xb50d('0x113')]>=_0x23230d[_0xb50d('0x17f')]){_0x29d450[_0xb50d('0x11c')](_0x254956,_0xbc4e3b,_0x54071e,_0xb50d('0x194'));}else{_0x29d450[_0xb50d('0x119')](_0x254956,_0xbc4e3b,_0x54071e,_0xb50d('0x194'));}}break;case'8':_0x23230d[_0xb50d('0x195')]+=0x1;_0x254956[_0xb50d('0x6c')]=0x8;_0x254956[_0xb50d('0x6d')]=_0xb50d('0x196');_0x254956[_0xb50d('0x114')]+=0x1;_0x254956['countglobal']+=0x1;_0x3fe44=_0x23230d[_0xb50d('0x197')];_0x29eb13=_0x23230d[_0xb50d('0xe1')];ami[_0xb50d('0x3d')](_0xb50d('0x198'),ut[_0xb50d('0x10d')](_0x2feea1,_0xb50d('0x199')));hopperUtils[_0xb50d('0xc6')](_0x254956)[_0xb50d('0x9e')](loggerCatch(_0xb50d('0x19a')));if(_0x29d450[_0xb50d('0x17d')](0x8,_0x2feea1,_0x23230d)&&!_0x14fb59){if(_0x254956[_0xb50d('0x114')]>=_0x23230d[_0xb50d('0x19b')]){_0x29d450[_0xb50d('0x11c')](_0x254956,_0xbc4e3b,_0x54071e,_0xb50d('0x19c'));}else{_0x29d450['stateGlobal'](_0x254956,_0xbc4e3b,_0x54071e,'reason\x208\x20congestion');}}break;case'11':_0x23230d[_0xb50d('0x19d')]+=0x1;_0x254956['state']=0xb;_0x254956[_0xb50d('0x6d')]='Abandoned';_0x254956[_0xb50d('0xe4')]+=0x1;_0x254956['countglobal']+=0x1;_0x3fe44=_0x23230d[_0xb50d('0x185')];_0x29eb13=_0x23230d[_0xb50d('0xe1')];hopperUtils[_0xb50d('0xc6')](_0x254956)[_0xb50d('0x9e')](loggerCatch(_0xb50d('0xe8')));if(_0x29d450[_0xb50d('0x17d')](0xb,_0x2feea1,_0x23230d)&&!_0x14fb59){if(_0x254956[_0xb50d('0xe4')]>=_0x23230d[_0xb50d('0xe2')]){_0x29d450[_0xb50d('0x11c')](_0x254956,_0xbc4e3b,_0x54071e,_0xb50d('0x19e'));}else{_0x29d450[_0xb50d('0x119')](_0x254956,_0xbc4e3b,_0x54071e,_0xb50d('0x19e'));}}break;case'20':_0x23230d[_0xb50d('0x19f')]+=0x1;_0x254956[_0xb50d('0x6c')]=0x14;_0x254956[_0xb50d('0x6d')]=_0xb50d('0x1a0');_0x254956[_0xb50d('0x117')]+=0x1;_0x254956[_0xb50d('0xcf')]+=0x1;_0x3fe44=_0x23230d['dialAgentRejectRetryFrequency'];_0x29eb13=_0x23230d['callAdditionalPhoneAfterMin'];ami[_0xb50d('0x3d')]('custom:agentreject',ut['buildObj'](_0x2feea1,_0xb50d('0x1a1')));hopperUtils[_0xb50d('0xc6')](_0x254956)[_0xb50d('0x9e')](loggerCatch(_0xb50d('0x1a2')));if(_0x29d450[_0xb50d('0x17d')](0x14,_0x2feea1,_0x23230d)&&!_0x14fb59){if(_0x254956['countagentrejectretry']>=_0x23230d['dialAgentRejectMaxRetry']){_0x29d450[_0xb50d('0x11c')](_0x254956,_0xbc4e3b,_0x54071e,'reason\x2020\x20agentreject');}else{_0x29d450[_0xb50d('0x119')](_0x254956,_0xbc4e3b,_0x54071e,'reason\x2020\x20agentreject');}}break;default:_0x23230d[_0xb50d('0x12d')]+=0x1;_0x254956[_0xb50d('0x6c')]=0xc;_0x254956[_0xb50d('0x6d')]=_0x4763f4['reason'];_0x3fe44=_0x23230d[_0xb50d('0x188')];_0x29eb13=_0x23230d['callAdditionalPhoneAfterMin'];hopperUtils[_0xb50d('0xc6')](_0x254956)['catch'](loggerCatch(_0xb50d('0x1a3')));if(_0x29d450[_0xb50d('0x17d')](_0x4763f4[_0xb50d('0xc1')],_0x2feea1,_0x23230d)&&!_0x14fb59){if(_0x254956[_0xb50d('0x113')]+_0x254956[_0xb50d('0x114')]+_0x254956[_0xb50d('0x124')]+_0x254956['countnosuchnumberretry']+_0x254956[_0xb50d('0xce')]+_0x254956[_0xb50d('0xe4')]+_0x254956[_0xb50d('0x116')]+_0x254956[_0xb50d('0x117')]>=_0x23230d['dialGlobalMaxRetry']){_0x29d450[_0xb50d('0x119')](_0x254956,_0xbc4e3b,_0x54071e,_0x4763f4['reason']);}else{_0x29d450[_0xb50d('0x11c')](_0x254956,_0xbc4e3b,_0x54071e,_0x4763f4[_0xb50d('0xc1')]);}}}})[_0xb50d('0x3c')](function(){if(_0x14fb59){hopperUtils['swapAdditionalPhones'](_0x254956,_0x3fe44,_0x29eb13)[_0xb50d('0x3c')](function(){return _0xbc4e3b(0x1);});}});});};Dialer[_0xb50d('0x81')][_0xb50d('0x119')]=function(_0x5da79e,_0x560665,_0x53429c,_0x10ead4){var _0x242d5b=new Final(_0x5da79e);_0x242d5b['state']=0xf;_0x242d5b['statedesc']=_0xb50d('0x1a4');this[_0xb50d('0x11c')](_0x242d5b,_0x560665,_0x53429c,_0x10ead4);};Dialer[_0xb50d('0x81')][_0xb50d('0x11c')]=function(_0x178e60,_0x38286a,_0x1d22af,_0x145cd5){hopperUtils[_0xb50d('0x128')](_0x178e60)[_0xb50d('0x3c')](function(){return _0x38286a(msgResponse(_0xb50d('0x1a5'),'Success',_0x145cd5));})[_0xb50d('0x9e')](function(){return _0x1d22af(msgResponse(_0xb50d('0x1a6'),'Failure',_0xb50d('0x1a7')));});};Dialer[_0xb50d('0x81')][_0xb50d('0xaf')]=function(_0x5d08a2){var _0x2a827d=_0x5d08a2['dialPredictiveOptimizationPercentage']/0x64;var _0xcbe4bf=_0x5d08a2[_0xb50d('0xcb')]/(_0x5d08a2[_0xb50d('0xcb')]+_0x5d08a2['outboundAnswerCallsDay']);var _0x463ca9=Math[_0xb50d('0x1a8')](_0x5d08a2[_0xb50d('0x1a9')]*(_0x5d08a2[_0xb50d('0x1aa')]/0x64));var _0x5bd9a5=Math[_0xb50d('0x1a8')](_0x5d08a2[_0xb50d('0x1a9')]*(_0x5d08a2[_0xb50d('0x1ab')]/0x64));var _0x305648=_0x5d08a2[_0xb50d('0x1ac')]+_0x5d08a2[_0xb50d('0x135')];var _0x4df61e=Math[_0xb50d('0x1ad')](_0x5d08a2[_0xb50d('0x56')]*_0x5d08a2[_0xb50d('0x5a')]*_0x5d08a2[_0xb50d('0x1ae')]*_0x5d08a2[_0xb50d('0x1af')]);if(_[_0xb50d('0x52')](_0x5d08a2[_0xb50d('0x25')])){if(!_[_0xb50d('0x52')](_0x5d08a2[_0xb50d('0x24')])){_0x5d08a2[_0xb50d('0x24')]=undefined;loggerPredictive[_0xb50d('0x64')](_0xb50d('0x1b0'),_0xb50d('0x1b1'));}if(!_[_0xb50d('0x52')](_0x5d08a2['handlePredictive'])){loggerPredictive['error'](_0xb50d('0x1b0'),'check\x20handlePredictive\x20is\x20not\x20undefine');clearInterval(_0x5d08a2[_0xb50d('0x62')]);_0x5d08a2[_0xb50d('0x62')]=undefined;}_0x5d08a2[_0xb50d('0x25')]=moment()['format'](_0xb50d('0xbf'));loggerPredictive[_0xb50d('0x45')](_0x5d08a2[_0xb50d('0x5f')],'collection\x20data\x20in\x20progressive\x20at',_0x5d08a2[_0xb50d('0x25')]);this[_0xb50d('0xb1')](_0x5d08a2,0x1);}else if(ifInterval(_0x5d08a2[_0xb50d('0x1b2')],_0x5d08a2['startProgressive'])){this['handlePower'](_0x5d08a2,0x1);loggerPredictiveCalls[_0xb50d('0x45')](_0xb50d('0x1b3'),_0x5d08a2[_0xb50d('0x25')],_0x5d08a2[_0xb50d('0x5f')]);_0x5d08a2[_0xb50d('0x56')]=0x0;_0x5d08a2['predictiveIntervalErlangCallsDroppedCalls']=0x0;}else if(_0x2a827d<_0xcbe4bf&&_0x5d08a2[_0xb50d('0x1b4')]==='dropRate'){clearPredictiveAttributes(_0x5d08a2);loggerPredictive[_0xb50d('0x45')](_0xb50d('0x1b5'),_0xb50d('0x1b6'),_0xcbe4bf,_0xb50d('0x25'),_0x5d08a2[_0xb50d('0x5f')]);}else if(_0x4df61e<_0x5d08a2[_0xb50d('0xcc')]&&_0x5d08a2['dialPredictiveOptimization']===_0xb50d('0x1b7')){clearPredictiveAttributes(_0x5d08a2);loggerPredictive[_0xb50d('0x45')]('[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]',_0xb50d('0x1b8'),_0x4df61e,_0xb50d('0x1b9'),_0x5d08a2[_0xb50d('0xcc')],'startProgressive',_0x5d08a2[_0xb50d('0x5f')]);}else if(!ifInterval(_0x5d08a2[_0xb50d('0x1b2')],_0x5d08a2[_0xb50d('0x25')])&&_[_0xb50d('0x52')](_0x5d08a2[_0xb50d('0x24')])&&!_[_0xb50d('0x52')](_0x5d08a2[_0xb50d('0x25')])){_0x5d08a2[_0xb50d('0x24')]=moment()[_0xb50d('0x42')](_0xb50d('0xbf'));loggerPredictive[_0xb50d('0x45')](_0x5d08a2['name'],_0xb50d('0x1ba'),_0x5d08a2['startPredictive']);hopperUtils['avgHandleTime'](_0x5d08a2[_0xb50d('0x1b2')])[_0xb50d('0x3c')](this['getDataPredictive'](_0x5d08a2))[_0xb50d('0x3c')](mergeDataErlangB(_0x5d08a2))[_0xb50d('0x3c')](this[_0xb50d('0x1bb')](_0x5d08a2))['catch'](loggerCatchPredictive(_0xb50d('0x1bc'),_0x5d08a2));}else if(!ifInterval(_0x5d08a2[_0xb50d('0x1b2')],_0x5d08a2[_0xb50d('0x24')])){_0x5d08a2[_0xb50d('0xcc')]=0x0;_0x5d08a2['startPredictive']=moment()['format'](_0xb50d('0xbf'));loggerPredictive[_0xb50d('0x45')](_0x5d08a2[_0xb50d('0x5f')],_0xb50d('0x1bd'),_0x5d08a2[_0xb50d('0x24')]);clearInterval(_0x5d08a2[_0xb50d('0x62')]);_0x5d08a2[_0xb50d('0x62')]=undefined;hopperUtils[_0xb50d('0x1be')](_0x5d08a2['dialPredictiveInterval'])[_0xb50d('0x3c')](this[_0xb50d('0x1bf')](_0x5d08a2))['then'](mergeDataErlangB(_0x5d08a2))[_0xb50d('0x3c')](this['startMethodPredictive'](_0x5d08a2))['catch'](loggerCatchPredictive(_0xb50d('0x1c0'),_0x5d08a2));}else if(_0x5d08a2[_0xb50d('0x1a9')]&&_0x305648<_0x5d08a2[_0xb50d('0x1a9')]-_0x5bd9a5){clearPredictiveAttributes(_0x5d08a2);loggerPredictive[_0xb50d('0x45')](_0x5d08a2[_0xb50d('0x5f')],_0xb50d('0x1c1'),_0x305648,_0xb50d('0x1c2'),_0x5d08a2['predictiveIntervalAvailable'],'-',_0x5bd9a5,'=',_0x5d08a2[_0xb50d('0x1a9')]-_0x5bd9a5,')');}else if(_0x5d08a2[_0xb50d('0x1a9')]&&_0x305648>_0x5d08a2[_0xb50d('0x1a9')]+_0x463ca9){clearPredictiveAttributes(_0x5d08a2);loggerPredictive[_0xb50d('0x45')](_0x5d08a2[_0xb50d('0x5f')],_0xb50d('0x1c1'),_0x305648,_0xb50d('0x1c3'),_0x5d08a2['predictiveIntervalAvailable'],'+',_0x463ca9,'=',_0x5d08a2[_0xb50d('0x1a9')]+_0x463ca9,')');}};Dialer[_0xb50d('0x81')][_0xb50d('0x1bf')]=function(_0x53f314){var _0x232719=this;return function(_0x4b4e7a){return new Promise(function(_0x12840b,_0x346fce){_['merge'](_0x53f314,_0x4b4e7a[0x0]);if(checkGetDataPredictive(_0x4b4e7a[0x0])){var _0x10fdef=_0x53f314[_0xb50d('0x1a9')]=_0x53f314[_0xb50d('0x135')]+_0x53f314[_0xb50d('0x1ac')];var _0x285f4f=_0x53f314['dialPredictiveInterval']*0x3c;var _0x4b4d81=_0x4b4e7a[0x0][_0xb50d('0x50')]+_0x4b4e7a[0x0]['predictiveIntervalAvgHoldtime'];var _0x3de10f=(_0x4b4e7a[0x0]['predictiveIntervalAnsweredCalls']+_0x4b4e7a[0x0]['predictiveIntervalDroppedCallsTimeout']+_0x4b4e7a[0x0][_0xb50d('0x4c')])/_0x4b4e7a[0x0][_0xb50d('0x48')];_0x53f314[_0xb50d('0x1ae')]=_0x3de10f>0x0?_0x3de10f:0x1;switch(_0x53f314[_0xb50d('0x1b4')]){case _0xb50d('0x1b7'):var _0x36d9ae=_0x53f314[_0xb50d('0x1c4')]/0x64;return _0x232719[_0xb50d('0x1c5')](_0x10fdef,_0x285f4f,_0x4b4d81,_0x3de10f,_0x36d9ae)[_0xb50d('0x3c')](function(_0x55f10f){return _0x12840b(_0x55f10f);});case _0xb50d('0x1c6'):var _0x500bbf=_0x53f314[_0xb50d('0x1c4')]/0x64;return _0x232719[_0xb50d('0x1c7')](_0x10fdef,_0x285f4f,_0x4b4d81,_0x3de10f,_0x500bbf)[_0xb50d('0x3c')](function(_0x27fafe){return _0x12840b(_0x27fafe);});default:return _0x346fce(msgResponse(_0xb50d('0x1c8'),_0xb50d('0x90'),_0xb50d('0x1c9')));}}else{return _0x346fce(msgResponse(_0xb50d('0x1c8'),_0xb50d('0x90'),_0xb50d('0x1ca')));}});};};Dialer[_0xb50d('0x81')]['getDataPredictiveOld']=function(_0x1ecc53){var _0x1334e0=this;return function(_0x476a35){return new Promise(function(_0x1a96a1,_0xe807c3){_[_0xb50d('0xf3')](_0x1ecc53,_0x476a35[0x0]);if(checkGetDataPredictive(_0x476a35[0x0])){loggerPredictive[_0xb50d('0x45')](JSON[_0xb50d('0x70')](_0x476a35[0x0]));if(_0x1ecc53[_0xb50d('0x1b4')]===_0xb50d('0x1b7')){return _0x1334e0[_0xb50d('0x148')](_0x1ecc53['id'])[_0xb50d('0x3c')](function(_0x382736){var _0x2a78da=_0x1ecc53[_0xb50d('0x1cb')]-_0x382736[0x0][_0xb50d('0x1cc')];var _0xe79b61=_0x1ecc53[_0xb50d('0x1b2')]*0x3c;var _0x2ef181=_0x476a35[0x0]['predictiveIntervalAvgTalktime']+_0x476a35[0x0][_0xb50d('0x4e')];var _0xc15060=(_0x476a35[0x0]['predictiveIntervalAnsweredCalls']+_0x476a35[0x0][_0xb50d('0x1cd')]+_0x476a35[0x0][_0xb50d('0x4c')])/_0x476a35[0x0][_0xb50d('0x48')];var _0x2b2d3b=_0x1ecc53[_0xb50d('0x1c4')]/0x64;_0x1ecc53[_0xb50d('0x1ce')]=_0x382736[0x0]['outboundQueuePauses']||0x0;_0x1ecc53[_0xb50d('0x1ae')]=_0xc15060>0x0?_0xc15060:0x1;return _0x1334e0[_0xb50d('0x1c5')](_0x2a78da,_0xe79b61,_0x2ef181,_0xc15060,_0x2b2d3b);})[_0xb50d('0x3c')](function(_0x1f616b){return _0x1a96a1(_0x1f616b);})[_0xb50d('0x9e')](function(_0x31a4b1){return _0xe807c3(msgResponse('[CatchErlangB]',_0xb50d('0x90'),JSON[_0xb50d('0x70')](_0x31a4b1)));});}if(_0x1ecc53['dialPredictiveOptimization']===_0xb50d('0x1c6')){return _0x1334e0['getVoiceQueueRtPauses'](_0x1ecc53['id'])['then'](function(_0x2e4ae6){var _0x30987b=_0x1ecc53[_0xb50d('0x1cb')]-_0x2e4ae6[0x0][_0xb50d('0x1cc')];var _0x274979=_0x1ecc53[_0xb50d('0x1b2')]*0x3c;var _0x8d5239=_0x476a35[0x0][_0xb50d('0x50')]+_0x476a35[0x0][_0xb50d('0x4e')];var _0x148dd4=(_0x476a35[0x0]['predictiveIntervalAnsweredCalls']+_0x476a35[0x0][_0xb50d('0x1cd')]+_0x476a35[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0x476a35[0x0]['predictiveIntervalTotalCalls'];var _0x461b91=_0x1ecc53[_0xb50d('0x1c4')]/0x64;_0x1ecc53['predictiveIntervalPauses']=_0x2e4ae6[0x0][_0xb50d('0x1cc')]||0x0;_0x1ecc53[_0xb50d('0x1ae')]=_0x148dd4>0x0?_0x148dd4:0x1;return _0x1334e0[_0xb50d('0x1c7')](_0x30987b,_0x274979,_0x8d5239,_0x148dd4,_0x461b91);})[_0xb50d('0x3c')](function(_0x47de47){return _0x1a96a1(_0x47de47);})[_0xb50d('0x9e')](function(_0x5bf7f4){return _0xe807c3(msgResponse('[CatchErlangB]',_0xb50d('0x90'),JSON['stringify'](_0x5bf7f4)));});}}else{return _0xe807c3(msgResponse('[getDataPredictive]',_0xb50d('0x90'),_0xb50d('0x1ca')));}});};};Dialer['prototype'][_0xb50d('0x1bb')]=function(_0x3eed4b){var _0x80cda=this;return function(){var _0x4eb057=0x0;var _0x5595c5=Math['floor'](_0x3eed4b[_0xb50d('0x58')]*0x3e8);if(_0x5595c5>0x0){_0x5595c5=_0x5595c5<0x64?0x64:_0x5595c5;loggerPredictive[_0xb50d('0x45')](_0x3eed4b['name'],_0xb50d('0x1cf'),_0x5595c5,_0xb50d('0x1d0'));_0x3eed4b['handlePredictive']=setInterval(function(){_0x80cda[_0xb50d('0x62')](_0x3eed4b);loggerPredictiveCalls[_0xb50d('0x45')](_0xb50d('0x1d1'),_0x4eb057+=0x1);},_0x5595c5);}else{loggerPredictive[_0xb50d('0x45')](_0x3eed4b[_0xb50d('0x5f')],'fail\x20to\x20scheduled\x20calls');}};};Dialer[_0xb50d('0x81')]['checkContactBlack']=function(_0x38f5d6,_0xfac0bd){var _0x28b3d6=this;return function(_0x59b4f0){if(_[_0xb50d('0x76')](_0x59b4f0)){if(_[_0xb50d('0xed')](_0xfac0bd[_0xb50d('0x14d')])||!_0xfac0bd[_0xb50d('0x1d2')]){if(_0x38f5d6[_0xb50d('0xae')]==='booked'){_0x38f5d6['queueStatusComplete']=_[_0xb50d('0x52')](_0x38f5d6[_0xb50d('0x6f')])?!![]:_0x38f5d6[_0xb50d('0x6f')];var _0x376f58=uuid['v4']();_0x28b3d6[_0xb50d('0x21')][_0x376f58]=new Action(_0x38f5d6,_0xfac0bd,_0x376f58);loggerBooked['info'](_0xb50d('0x1d3'),_0x376f58,_0xb50d('0x1d4'),JSON[_0xb50d('0x70')](_0x38f5d6[_0xb50d('0x6f')]),_0xb50d('0x1d5'),_0x38f5d6['name']);if(_0x38f5d6['queueStatusComplete']){_0x38f5d6[_0xb50d('0x6f')]=![];_0x28b3d6[_0xb50d('0xf1')][_0x28b3d6[_0xb50d('0x21')][_0x376f58]['queue']]=[];ami['Action']({'actionid':_0x376f58,'action':'queuestatus','queue':_0x38f5d6[_0xb50d('0x5f')]})[_0xb50d('0x9e')](function(){_0x28b3d6[_0xb50d('0xc8')](_0x38f5d6);hopperUtils[_0xb50d('0xd3')]({'active':![],'ContactId':_0x28b3d6[_0xb50d('0x21')][_0x376f58][_0xb50d('0xd7')],'ListId':_0x28b3d6[_0xb50d('0x21')][_0x376f58][_0xb50d('0xd8')],'VoiceQueueId':_0x28b3d6[_0xb50d('0x21')][_0x376f58][_0xb50d('0xd9')]||undefined,'CampaignId':_0x28b3d6[_0xb50d('0x21')][_0x376f58][_0xb50d('0xe5')]||undefined})[_0xb50d('0x9e')](loggerCatch(_0xb50d('0x1d6')));delete _0x28b3d6[_0xb50d('0x21')][_0x376f58];});}else{loggerBooked[_0xb50d('0x45')](_0xb50d('0x1d7'),JSON[_0xb50d('0x70')](_0x38f5d6['queueStatusComplete']),_0xb50d('0x1d5'),_0x38f5d6[_0xb50d('0x5f')]);_0x28b3d6[_0xb50d('0xc8')](_0x38f5d6);hopperUtils[_0xb50d('0xd3')]({'active':![],'ContactId':_0x28b3d6[_0xb50d('0x21')][_0x376f58]['ContactId'],'ListId':_0x28b3d6[_0xb50d('0x21')][_0x376f58]['ListId'],'VoiceQueueId':_0x28b3d6[_0xb50d('0x21')][_0x376f58][_0xb50d('0xd9')]||undefined,'CampaignId':_0x28b3d6[_0xb50d('0x21')][_0x376f58][_0xb50d('0xe5')]||undefined})[_0xb50d('0x9e')](loggerCatch(_0xb50d('0x1d6')));delete _0x28b3d6[_0xb50d('0x21')][_0x376f58];}}else{return _0x28b3d6[_0xb50d('0x151')](_0x38f5d6,_0xfac0bd);}}else{if(utils['getSeconds'](undefined,_0xfac0bd[_0xb50d('0x1d8')])<_0x38f5d6[_0xb50d('0x1d9')]*0x3c){if(_0xfac0bd['Agent']&&!_0xfac0bd[_0xb50d('0x141')][_0xb50d('0x1da')]){_0x28b3d6[_0xb50d('0x1a')][_0xb50d('0xfc')](_0xfac0bd['id'])[_0xb50d('0xf7')](function(){_0x28b3d6[_0xb50d('0xc8')](_0x38f5d6);});}else{hopperUtils[_0xb50d('0x1db')]({'active':![]},_0xfac0bd['id'],0x1)[_0xb50d('0xf7')](function(){_0x28b3d6['updateOriginated'](_0x38f5d6);});}}else{_0x38f5d6[_0xb50d('0x1dc')]+=0x1;_0x28b3d6[_0xb50d('0xc8')](_0x38f5d6);if(_0x38f5d6[_0xb50d('0x1dd')]){hopperUtils[_0xb50d('0xd3')]({'active':![],'recallme':![],'UserId':null,'ContactId':_0xfac0bd[_0xb50d('0xd7')],'ListId':_0xfac0bd[_0xb50d('0xd8')],'VoiceQueueId':_0xfac0bd[_0xb50d('0xd9')]||undefined,'CampaignId':_0xfac0bd[_0xb50d('0xe5')]||undefined})[_0xb50d('0x9e')](loggerCatch(_0xb50d('0x1de')));hopperUtils[_0xb50d('0xc6')](createObjHistory(_0x38f5d6,_0xfac0bd,utils[_0xb50d('0x68')][_0xb50d('0x1df')],0x17,_0xb50d('0x1e0')))['catch'](loggerCatch(_0xb50d('0x1e1')));}else{_0x28b3d6['saveInDb'](createObjHistory(_0x38f5d6,_0xfac0bd,utils[_0xb50d('0x68')][_0xb50d('0x1e2')],0x16,_0xb50d('0x1e3')),'[Originate][HistoryRecallClose][historyCatch]',_0xb50d('0x1e4'));}}}}else{_0x38f5d6[_0xb50d('0x1e5')]+=0x1;_0x28b3d6[_0xb50d('0x10f')](createObjHistory(_0x38f5d6,_0xfac0bd,utils[_0xb50d('0x68')][_0xb50d('0x1e6')],0xd,_0xb50d('0x1e7')),_0xb50d('0x1e8'),_0xb50d('0x1e9'));throw _0xb50d('0x1ea');}};};Dialer[_0xb50d('0x81')]['handleIvr']=function(_0x229a7b){var _0x187c3d=this;var _0x324050=_0x229a7b[_0xb50d('0x1eb')]-_0x229a7b[_0xb50d('0x7c')];emitCampaignSummary(_0x229a7b);if(_0x324050>0x0&&_0x229a7b['temp']==0x0){if(_0x324050>this[_0xb50d('0x1f')]){_0x324050=this['maxNumberOriginate'];}_0x229a7b[_0xb50d('0x1ec')]=0x1;hopperUtils[_0xb50d('0x1ed')](_0x229a7b,_0x324050)['then'](function(_0x480462){_0x229a7b[_0xb50d('0x1ec')]=0x0;if(_0x480462){if(!utils[_0xb50d('0x1ee')](_0x480462)){_0x229a7b[_0xb50d('0x67')]=utils[_0xb50d('0x68')][_0xb50d('0x6a')];logger[_0xb50d('0x45')](_0xb50d('0x1ef')+_0x229a7b[_0xb50d('0x5f')]);}else{_0x229a7b['originated']+=_0x480462[_0xb50d('0x96')];_0x229a7b['message']=utils[_0xb50d('0x68')][_0xb50d('0x1f0')];for(var _0x99e9a1=0x0;_0x99e9a1<_0x480462[_0xb50d('0x96')];_0x99e9a1+=0x1){_0x229a7b[_0xb50d('0x1f1')]+=0x1;if(_['isNil'](_0x480462[_0x99e9a1])||_[_0xb50d('0xed')](_0x480462[_0x99e9a1][_0xb50d('0x16a')])||_['isNil'](_0x480462[_0x99e9a1][_0xb50d('0x155')])){_0x187c3d[_0xb50d('0x14b')]('[actionOriginate]\x20',_0x229a7b,_0x480462[_0x99e9a1]);}else{hopperUtils['checkIsBlackListIvr'](_[_0xb50d('0x71')](_0x480462[_0x99e9a1],[_0xb50d('0xe5'),_0xb50d('0x155')]))['then'](_0x187c3d[_0xb50d('0x1f2')](_0x229a7b,_0x480462[_0x99e9a1]))[_0xb50d('0x9e')](_0x187c3d['loggerHandler'](_0xb50d('0x1f3'),_0x229a7b));}}}}})['catch'](loggerGetContactDialer(_0xb50d('0x1f4'),_0x229a7b,_0x324050));}};Dialer[_0xb50d('0x81')][_0xb50d('0xb1')]=function(_0x3590d9,_0x25c0e3){var _0x1a0be5=this;var _0xb9d693=[];if(_0x25c0e3<0x1||_0x3590d9[_0xb50d('0xae')]===_0xb50d('0x7')){_0x25c0e3=0x1;}var _0x15b241=Math['floor'](_0x3590d9['available']*_0x25c0e3)-_0x3590d9['originated'];if(_0x3590d9['dialLimitQueue']>0x0){var _0x33324=_0x3590d9[_0xb50d('0x1f5')]-_0x3590d9[_0xb50d('0x7c')]-_0x3590d9[_0xb50d('0x135')]-_0x3590d9[_0xb50d('0x136')];if(_0x15b241>_0x33324){_0x15b241=_0x33324;}}if(_0x15b241>0x0&&_0x3590d9[_0xb50d('0x1ec')]==0x0){if(_0x3590d9[_0xb50d('0xae')]==='booked'){_0x15b241=0x1;}if(_0x15b241>this['maxNumberOriginate']){_0x15b241=this[_0xb50d('0x1f')];}for(var _0x17f1f2 in this[_0xb50d('0x1d')]){if(typeof this[_0xb50d('0x1d')][_0x17f1f2]!=='undefined'){if(this['agents'][_0x17f1f2][_0xb50d('0x6c')]===_0xb50d('0x1f6')&&this['agents'][_0x17f1f2][_0xb50d('0x85')]===_0xb50d('0x13f')){_0xb9d693[_0xb50d('0xf2')](this['agents'][_0x17f1f2]['id']);}}}_0x3590d9['temp']=0x1;hopperUtils[_0xb50d('0x1f7')](_0x3590d9,_0xb9d693,_0x15b241)[_0xb50d('0x3c')](function(_0x1dba48){_0x3590d9['temp']=0x0;if(_0x1dba48){if(!utils[_0xb50d('0x1ee')](_0x1dba48)){hopperUtils['countReScheduled'](_0x3590d9)[_0xb50d('0x3c')](sendMessageReschedule(_0x3590d9))[_0xb50d('0x9e')](loggerCatch('[countReScheduled]\x20'));}else{_0x3590d9[_0xb50d('0x7c')]+=_0x1dba48[_0xb50d('0x96')];_0x3590d9[_0xb50d('0x67')]=_0x3590d9[_0xb50d('0xae')]==='booked'?utils[_0xb50d('0x68')][_0xb50d('0x137')]:utils['CAMPAIGN_STATUS']['RUNNING'];for(var _0x4b431f=0x0;_0x4b431f<_0x1dba48[_0xb50d('0x96')];_0x4b431f+=0x1){if(_[_0xb50d('0xed')](_0x1dba48[_0x4b431f])||_['isNil'](_0x1dba48[_0x4b431f][_0xb50d('0x16a')])||_[_0xb50d('0xed')](_0x1dba48[_0x4b431f]['phone'])){_0x1a0be5[_0xb50d('0x14b')]('[actionOriginate]\x20',_0x3590d9,_0x1dba48[_0x4b431f]);}else{hopperUtils['checkIsBlackList'](_[_0xb50d('0x71')](_0x1dba48[_0x4b431f],['VoiceQueueId',_0xb50d('0x155')]))['then'](_0x1a0be5['checkContactBlack'](_0x3590d9,_0x1dba48[_0x4b431f]))[_0xb50d('0x9e')](_0x1a0be5[_0xb50d('0x1f8')](_0xb50d('0x1f9'),_0x3590d9));}}}}})[_0xb50d('0x9e')](loggerGetContactDialer(_0xb50d('0x1fa'),_0x3590d9,_0x15b241));}};Dialer[_0xb50d('0x81')][_0xb50d('0x62')]=function(_0x439183){if(_0x439183['dialLimitQueue']>0x0){var _0x34c03b=_0x439183[_0xb50d('0x1f5')]-_0x439183[_0xb50d('0x7c')]-_0x439183['talking'];if(_0x34c03b>0x0&&_0x439183[_0xb50d('0x1ec')]==0x0){this[_0xb50d('0x1fb')](_0x439183);}else{loggerPredictiveCalls[_0xb50d('0x45')](_0xb50d('0x1fc'));}}else{this[_0xb50d('0x1fb')](_0x439183);}};Dialer[_0xb50d('0x81')][_0xb50d('0x1fb')]=function(_0x12a02d){var _0x19740f=this;var _0x5c538a=[];_0x12a02d[_0xb50d('0x7c')]+=0x1;for(var _0x3d480c in this['agents']){if(typeof this[_0xb50d('0x1d')][_0x3d480c]!==_0xb50d('0x149')){if(this['agents'][_0x3d480c][_0xb50d('0x6c')]==='not_inuse'&&this['agents'][_0x3d480c][_0xb50d('0x85')]===_0xb50d('0x13f')){_0x5c538a[_0xb50d('0xf2')](this['agents'][_0x3d480c]['id']);}}}_0x12a02d['temp']=0x1;return this[_0xb50d('0x1f7')](_0x12a02d['id'],_0x5c538a,0x1,_0x12a02d[_0xb50d('0x1fd')],_0x12a02d)[_0xb50d('0x3c')](function(_0x54887b){_0x12a02d[_0xb50d('0x1ec')]=0x1;if(_0x54887b){if(!utils[_0xb50d('0x1ee')](_0x54887b)){utils[_0xb50d('0x65')](_0x12a02d,0x1,0x0);return hopperUtils[_0xb50d('0x1fe')](_0x12a02d)['then'](sendMessageReschedule(_0x12a02d))[_0xb50d('0x9e')](loggerCatch(_0xb50d('0x1ff')));}else{_0x12a02d[_0xb50d('0x67')]=utils[_0xb50d('0x68')][_0xb50d('0x1f0')];if(_['isNil'](_0x54887b[0x0])||_['isNil'](_0x54887b[0x0][_0xb50d('0x16a')])||_[_0xb50d('0xed')](_0x54887b[0x0][_0xb50d('0x155')])){_0x19740f[_0xb50d('0x14b')]('[actionOriginate]\x20',_0x12a02d,_0x54887b[0x0]);}else{return hopperUtils[_0xb50d('0x200')](_['pick'](_0x54887b[0x0],[_0xb50d('0xd9'),_0xb50d('0x155')]))['then'](_0x19740f['checkContactBlack'](_0x12a02d,_0x54887b[0x0]))[_0xb50d('0x9e')](_0x19740f['loggerHandler']('[actionOriginatePredictive]\x20',_0x12a02d));}}}})[_0xb50d('0x9e')](loggerGetContactDialer(_0xb50d('0x201'),_0x12a02d,0x1));};Dialer[_0xb50d('0x81')]['abandonmentRate']=function(_0x265dc5,_0xb22e,_0x1e7bc9,_0x391198,_0x139c7d,_0x5a5b82){loggerPredictive[_0xb50d('0x45')](_0xb50d('0x202'));loggerPredictive[_0xb50d('0x45')](_0xb50d('0x203'),_0x265dc5);loggerPredictive[_0xb50d('0x45')](_0xb50d('0x204'),_0xb22e);loggerPredictive[_0xb50d('0x45')](_0xb50d('0x205'),_0x1e7bc9);loggerPredictive[_0xb50d('0x45')](_0xb50d('0x206'),_0x391198);loggerPredictive[_0xb50d('0x45')](_0xb50d('0x207'),_0x139c7d);loggerPredictive['info'](_0xb50d('0x5c'));return new Promise(function(_0x21af94,_0xd741ca){if(_0x265dc5<=0x0||isNaN(_0x265dc5)){return _0xd741ca(msgResponse(_0xb50d('0x208'),_0xb50d('0xb9'),_0xb50d('0x209')+_0x265dc5));}if(_0x1e7bc9<=0x0||isNaN(_0x1e7bc9)){return _0xd741ca(msgResponse(_0xb50d('0x208'),_0xb50d('0xb9'),_0xb50d('0x20a')+_0x1e7bc9));}if(_0x391198<=0x0||isNaN(_0x391198)){return _0xd741ca(msgResponse(_0xb50d('0x208'),'Error','p\x20=\x20'+_0x391198));}if(_0xb22e<=0x0||isNaN(_0xb22e)){return _0xd741ca(msgResponse(_0xb50d('0x208'),_0xb50d('0xb9'),_0xb50d('0x20b')+_0xb22e));}if(_0x139c7d<=0x0||isNaN(_0x139c7d)){return _0xd741ca(msgResponse(_0xb50d('0x208'),_0xb50d('0xb9'),_0xb50d('0x20c')+_0x139c7d));}_0x5a5b82=_0x5a5b82||0x0;var _0x34ac69=0x1/_0x1e7bc9;var _0x2b5979=0x0;var _0x298889=0x0;var _0x1e27a6=0x0;var _0x570c07=0x0;for(var _0x405bf6=0x0;_0x1e27a6<_0x139c7d;_0x405bf6+=0x1){_0x298889=_0x405bf6/_0xb22e;_0x2b5979=(_0x391198*_0x298889+_0x5a5b82)/_0x34ac69;_0x1e27a6=utils['erlangb'](_0x2b5979,_0x265dc5);_0x570c07=_0x2b5979/_0x265dc5*(0x1-utils['erlangb'](_0x2b5979,_0x265dc5));}return _0x21af94({'erlangCalls':_0x405bf6,'erlangCallToSecond':_0xb22e/_0x405bf6,'erlangAbandonmentRate':_0x1e27a6,'erlangBusyFactor':_0x570c07});});};Dialer['prototype'][_0xb50d('0x1c7')]=function(_0x18640d,_0x4d610f,_0xb1a43d,_0x26923c,_0x216fa8,_0x152b75){loggerPredictive[_0xb50d('0x45')](_0xb50d('0x20d'));loggerPredictive['info']('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',_0x18640d);loggerPredictive[_0xb50d('0x45')]('Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x4d610f);loggerPredictive[_0xb50d('0x45')]('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',_0xb1a43d);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',_0x26923c);loggerPredictive[_0xb50d('0x45')](_0xb50d('0x20e'),_0x216fa8);loggerPredictive[_0xb50d('0x45')](_0xb50d('0x5c'));return new Promise(function(_0x3a3fb7,_0x1d9a7d){if(_0x18640d<=0x0||isNaN(_0x18640d)){return _0x1d9a7d(msgResponse(_0xb50d('0x20f'),_0xb50d('0xb9'),_0xb50d('0x209')+_0x18640d));}if(_0xb1a43d<=0x0||isNaN(_0xb1a43d)){return _0x1d9a7d(msgResponse(_0xb50d('0x20f'),_0xb50d('0xb9'),_0xb50d('0x20a')+_0xb1a43d));}if(_0x26923c<=0x0||isNaN(_0x26923c)){return _0x1d9a7d(msgResponse(_0xb50d('0x20f'),'Error',_0xb50d('0x210')+_0x26923c));}if(_0x4d610f<=0x0||isNaN(_0x4d610f)){return _0x1d9a7d(msgResponse(_0xb50d('0x20f'),_0xb50d('0xb9'),_0xb50d('0x20b')+_0x4d610f));}if(_0x216fa8<=0x0||isNaN(_0x216fa8)){return _0x1d9a7d(msgResponse(_0xb50d('0x20f'),_0xb50d('0xb9'),_0xb50d('0x211')+_0x216fa8));}_0x152b75=_0x152b75||0x0;var _0x289318=0x1/_0xb1a43d;var _0x540a8d=0x0;var _0x290c7e=0x0;var _0x30e35e=0x0;var _0xebc97f=0x0;for(var _0x177971=0x0;_0xebc97f<_0x216fa8;_0x177971+=0x1){_0x290c7e=_0x177971/_0x4d610f;_0x540a8d=(_0x26923c*_0x290c7e+_0x152b75)/_0x289318;_0x30e35e=utils[_0xb50d('0x212')](_0x540a8d,_0x18640d);_0xebc97f=_0x540a8d/_0x18640d*(0x1-utils[_0xb50d('0x212')](_0x540a8d,_0x18640d));}return _0x3a3fb7({'erlangCalls':_0x177971,'erlangCallToSecond':_0x4d610f/_0x177971,'erlangAbandonmentRate':_0x30e35e,'erlangBusyFactor':_0xebc97f});});};module[_0xb50d('0x213')]=Dialer; \ No newline at end of file diff --git a/server/services/ami/dialer/models/action.js b/server/services/ami/dialer/models/action.js index 87b2729..f2769ef 100644 --- a/server/services/ami/dialer/models/action.js +++ b/server/services/ami/dialer/models/action.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x11fc=['idHopper','format','YYYY-MM-DD\x20HH:mm:ss','callback','callbackuniqueid','callbackat','recallme','originatecalleridnum','originatecalleridname','prototype','getCaller','\x22%s\x22\x20<%s>','dialCutDigit','substring','getQueue','queue','exports','util','moment','isNil','string','voiceQueue','uniqueid','name','Contact','phone','firstName','lastName','number','active','type','dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','ContactId','ListId','UserId','VoiceQueueId','CampaignId'];(function(_0x2ef51e,_0xbc63ab){var _0x3c9895=function(_0x73cc79){while(--_0x73cc79){_0x2ef51e['push'](_0x2ef51e['shift']());}};_0x3c9895(++_0xbc63ab);}(_0x11fc,0x1dd));var _0xc11f=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0x11fc[_0x618414];return _0x21c19a;};'use strict';var util=require(_0xc11f('0x0'));var _=require('lodash');var moment=require(_0xc11f('0x1'));function checkNameSurname(_0x397229,_0x31cb6c,_0x10b72c){var _0x5d442a='';if(!_[_0xc11f('0x2')](_0x31cb6c)&&_0xc11f('0x3')===typeof _0x31cb6c){_0x5d442a+=_0x31cb6c;}if(!_['isNil'](_0x10b72c)&&_0xc11f('0x3')===typeof _0x10b72c){_0x5d442a+='\x20'+_0x10b72c;}if(_0x5d442a!==''){return _0x5d442a;}return _0x397229;}function Action(_0x2d7d4b,_0x3e9bc2,_0x5f2626){this[_0xc11f('0x4')]=_0x2d7d4b;this[_0xc11f('0x5')]=_0x5f2626||undefined;this[_0xc11f('0x6')]=checkNameSurname(_0x3e9bc2[_0xc11f('0x7')][_0xc11f('0x8')],_0x3e9bc2[_0xc11f('0x7')][_0xc11f('0x9')],_0x3e9bc2['Contact'][_0xc11f('0xa')]);this[_0xc11f('0xb')]=_0x3e9bc2[_0xc11f('0x8')];this['queue']=_0x2d7d4b[_0xc11f('0x6')];this[_0xc11f('0xc')]=_0x3e9bc2['active']||![];this[_0xc11f('0xd')]=_0x2d7d4b['type'];this['dialQueueTimeout']=_0x2d7d4b[_0xc11f('0xe')]||0x3;this[_0xc11f('0xf')]=_0x3e9bc2[_0xc11f('0xf')];this[_0xc11f('0x10')]=_0x3e9bc2[_0xc11f('0x10')];this[_0xc11f('0x11')]=_0x3e9bc2[_0xc11f('0x11')];this[_0xc11f('0x12')]=_0x3e9bc2[_0xc11f('0x12')];this['countnosuchnumberretry']=_0x3e9bc2[_0xc11f('0x13')];this[_0xc11f('0x14')]=_0x3e9bc2[_0xc11f('0x14')];this[_0xc11f('0x15')]=_0x3e9bc2[_0xc11f('0x15')];this[_0xc11f('0x16')]=_0x3e9bc2[_0xc11f('0x16')];this[_0xc11f('0x17')]=_0x3e9bc2[_0xc11f('0x17')];this[_0xc11f('0x18')]=_0x3e9bc2[_0xc11f('0x18')];this[_0xc11f('0x19')]=_0x3e9bc2['ListId'];this[_0xc11f('0x1a')]=_0x3e9bc2[_0xc11f('0x1a')];this[_0xc11f('0x1b')]=_0x3e9bc2['VoiceQueueId'];this[_0xc11f('0x1c')]=_0x3e9bc2[_0xc11f('0x1c')];this[_0xc11f('0x1d')]=_0x3e9bc2['id'];this['ContactFirstName']=_0x3e9bc2[_0xc11f('0x7')][_0xc11f('0x9')]||'';this['starttime']=moment()[_0xc11f('0x1e')](_0xc11f('0x1f'));this[_0xc11f('0x20')]=_0x3e9bc2[_0xc11f('0x20')];this[_0xc11f('0x21')]=_0x3e9bc2[_0xc11f('0x21')];this[_0xc11f('0x22')]=_0x3e9bc2[_0xc11f('0x22')];this[_0xc11f('0x23')]=_0x3e9bc2[_0xc11f('0x23')];this[_0xc11f('0x24')]='';this[_0xc11f('0x25')]='';}Action[_0xc11f('0x26')][_0xc11f('0x27')]=function(){return util['format'](_0xc11f('0x28'),this[_0xc11f('0x6')],this[_0xc11f('0x4')][_0xc11f('0x29')]>0x0?this[_0xc11f('0xb')][_0xc11f('0x2a')](this[_0xc11f('0x4')][_0xc11f('0x29')]):this['number']);};Action[_0xc11f('0x26')][_0xc11f('0x2b')]=function(){return this[_0xc11f('0x2c')];};module[_0xc11f('0x2d')]=Action; \ No newline at end of file +var _0xa735=['originatecalleridname','getCaller','\x22%s\x22\x20<%s>','dialCutDigit','prototype','queue','exports','util','lodash','moment','isNil','string','voiceQueue','uniqueid','name','Contact','phone','firstName','number','active','dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','ContactId','ListId','UserId','VoiceQueueId','CampaignId','idHopper','ContactFirstName','format','YYYY-MM-DD\x20HH:mm:ss','callback','callbackuniqueid','callbackat','recallme','originatecalleridnum'];(function(_0x30001c,_0x1078f3){var _0x3332fb=function(_0x3476a9){while(--_0x3476a9){_0x30001c['push'](_0x30001c['shift']());}};_0x3332fb(++_0x1078f3);}(_0xa735,0xe3));var _0x5a73=function(_0x42220a,_0x35c311){_0x42220a=_0x42220a-0x0;var _0x5a23ec=_0xa735[_0x42220a];return _0x5a23ec;};'use strict';var util=require(_0x5a73('0x0'));var _=require(_0x5a73('0x1'));var moment=require(_0x5a73('0x2'));function checkNameSurname(_0x156115,_0x4fbb76,_0x556ac3){var _0x51f509='';if(!_[_0x5a73('0x3')](_0x4fbb76)&&_0x5a73('0x4')===typeof _0x4fbb76){_0x51f509+=_0x4fbb76;}if(!_[_0x5a73('0x3')](_0x556ac3)&&'string'===typeof _0x556ac3){_0x51f509+='\x20'+_0x556ac3;}if(_0x51f509!==''){return _0x51f509;}return _0x156115;}function Action(_0x55acf2,_0xe064c8,_0x35b524){this[_0x5a73('0x5')]=_0x55acf2;this[_0x5a73('0x6')]=_0x35b524||undefined;this[_0x5a73('0x7')]=checkNameSurname(_0xe064c8[_0x5a73('0x8')][_0x5a73('0x9')],_0xe064c8['Contact'][_0x5a73('0xa')],_0xe064c8[_0x5a73('0x8')]['lastName']);this[_0x5a73('0xb')]=_0xe064c8['phone'];this['queue']=_0x55acf2[_0x5a73('0x7')];this[_0x5a73('0xc')]=_0xe064c8[_0x5a73('0xc')]||![];this['type']=_0x55acf2['type'];this[_0x5a73('0xd')]=_0x55acf2[_0x5a73('0xd')]||0x3;this[_0x5a73('0xe')]=_0xe064c8[_0x5a73('0xe')];this[_0x5a73('0xf')]=_0xe064c8[_0x5a73('0xf')];this[_0x5a73('0x10')]=_0xe064c8[_0x5a73('0x10')];this[_0x5a73('0x11')]=_0xe064c8['countnoanswerretry'];this[_0x5a73('0x12')]=_0xe064c8[_0x5a73('0x12')];this[_0x5a73('0x13')]=_0xe064c8[_0x5a73('0x13')];this[_0x5a73('0x14')]=_0xe064c8[_0x5a73('0x14')];this[_0x5a73('0x15')]=_0xe064c8[_0x5a73('0x15')];this[_0x5a73('0x16')]=_0xe064c8['countagentrejectretry'];this[_0x5a73('0x17')]=_0xe064c8[_0x5a73('0x17')];this['ListId']=_0xe064c8[_0x5a73('0x18')];this['UserId']=_0xe064c8[_0x5a73('0x19')];this[_0x5a73('0x1a')]=_0xe064c8[_0x5a73('0x1a')];this[_0x5a73('0x1b')]=_0xe064c8['CampaignId'];this[_0x5a73('0x1c')]=_0xe064c8['id'];this[_0x5a73('0x1d')]=_0xe064c8[_0x5a73('0x8')][_0x5a73('0xa')]||'';this['starttime']=moment()[_0x5a73('0x1e')](_0x5a73('0x1f'));this[_0x5a73('0x20')]=_0xe064c8[_0x5a73('0x20')];this[_0x5a73('0x21')]=_0xe064c8['callbackuniqueid'];this[_0x5a73('0x22')]=_0xe064c8[_0x5a73('0x22')];this['recallme']=_0xe064c8[_0x5a73('0x23')];this[_0x5a73('0x24')]='';this[_0x5a73('0x25')]='';}Action['prototype'][_0x5a73('0x26')]=function(){return util[_0x5a73('0x1e')](_0x5a73('0x27'),this['name'],this[_0x5a73('0x5')][_0x5a73('0x28')]>0x0?this['number']['substring'](this[_0x5a73('0x5')][_0x5a73('0x28')]):this['number']);};Action[_0x5a73('0x29')]['getQueue']=function(){return this[_0x5a73('0x2a')];};module[_0x5a73('0x2b')]=Action; \ No newline at end of file diff --git a/server/services/ami/dialer/models/agentComplete.js b/server/services/ami/dialer/models/agentComplete.js index 977ae18..10c90bf 100644 --- a/server/services/ami/dialer/models/agentComplete.js +++ b/server/services/ami/dialer/models/agentComplete.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x94c8=['responsetime','answertime','endtime','YYYY-MM-DD\x20HH:mm:ss','ringtime','holdtime','getSeconds','talktime','membername','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','agiafterat','../utils','state','statedesc','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countmachineretry','countagentrejectretry','countabandonedretry','uniqueid','calleridname','name','calleridnum','number','starttime'];(function(_0x1a0daa,_0x2a4634){var _0x1dbe15=function(_0xa8ab22){while(--_0xa8ab22){_0x1a0daa['push'](_0x1a0daa['shift']());}};_0x1dbe15(++_0x2a4634);}(_0x94c8,0xca));var _0x894c=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x94c8[_0x2641f9];return _0x585741;};'use strict';var moment=require('moment');var utils=require(_0x894c('0x0'));function AgentComplete(_0x1049ab,_0x5860aa){this[_0x894c('0x1')]=0x4;this[_0x894c('0x2')]='Answer';this[_0x894c('0x3')]=_0x1049ab[_0x894c('0x3')];this['type']=_0x1049ab[_0x894c('0x4')];this[_0x894c('0x5')]=_0x1049ab[_0x894c('0x4')]===_0x894c('0x6')?_0x894c('0x7'):_0x1049ab[_0x894c('0x4')];this[_0x894c('0x8')]=_0x1049ab[_0x894c('0x8')];this['countcongestionretry']=_0x1049ab[_0x894c('0x9')];this['countnoanswerretry']=_0x1049ab[_0x894c('0xa')];this[_0x894c('0xb')]=_0x1049ab[_0x894c('0x8')]+_0x1049ab[_0x894c('0x9')]+_0x1049ab[_0x894c('0xa')]+_0x1049ab[_0x894c('0xc')]+_0x1049ab[_0x894c('0xd')]+_0x1049ab['countabandonedretry']+_0x1049ab[_0x894c('0xe')]+_0x1049ab[_0x894c('0xf')];this[_0x894c('0xc')]=_0x1049ab[_0x894c('0xc')];this[_0x894c('0xd')]=_0x1049ab[_0x894c('0xd')];this[_0x894c('0x10')]=_0x1049ab['countabandonedretry'];this['countmachineretry']=_0x1049ab['countmachineretry'];this[_0x894c('0xf')]=_0x1049ab['countagentrejectretry'];this[_0x894c('0x11')]=_0x5860aa['uniqueid'];this[_0x894c('0x12')]=_0x1049ab[_0x894c('0x13')];this[_0x894c('0x14')]=_0x1049ab[_0x894c('0x15')];this['starttime']=_0x1049ab[_0x894c('0x16')];this[_0x894c('0x17')]=_0x1049ab[_0x894c('0x17')];this[_0x894c('0x18')]=_0x1049ab[_0x894c('0x18')];this[_0x894c('0x19')]=moment()['format'](_0x894c('0x1a'));this[_0x894c('0x1b')]=utils['getSeconds'](_0x1049ab[_0x894c('0x17')],_0x1049ab[_0x894c('0x16')]);this[_0x894c('0x1c')]=utils[_0x894c('0x1d')](_0x1049ab[_0x894c('0x18')],_0x1049ab[_0x894c('0x17')]);this[_0x894c('0x1e')]=utils[_0x894c('0x1d')](this[_0x894c('0x19')],_0x1049ab[_0x894c('0x18')]);this['queue']=_0x5860aa[_0x894c('0x7')];this[_0x894c('0x1f')]=_0x5860aa[_0x894c('0x1f')];this[_0x894c('0x20')]=_0x5860aa[_0x894c('0x20')];this[_0x894c('0x21')]=_0x1049ab[_0x894c('0x21')];this['callbackuniqueid']=_0x1049ab[_0x894c('0x22')];this[_0x894c('0x23')]=_0x1049ab[_0x894c('0x23')];this[_0x894c('0x24')]=_0x1049ab[_0x894c('0x24')];this['ContactId']=_0x1049ab[_0x894c('0x25')];this[_0x894c('0x26')]=_0x1049ab[_0x894c('0x26')];this[_0x894c('0x27')]=_0x1049ab['UserId'];this[_0x894c('0x28')]=_0x1049ab['VoiceQueueId'];this[_0x894c('0x29')]=_0x1049ab[_0x894c('0x29')];this[_0x894c('0x2a')]=_0x1049ab[_0x894c('0x2a')]||'';this[_0x894c('0x2b')]=_0x1049ab[_0x894c('0x2b')]||'';this[_0x894c('0x2c')]=_0x1049ab[_0x894c('0x2c')];}module['exports']=AgentComplete; \ No newline at end of file +var _0x0bfd=['countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridname','number','starttime','responsetime','answertime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','holdtime','getSeconds','endtime','membername','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','agiafterat','moment','../utils','state','statedesc','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry'];(function(_0x24a618,_0x23af9b){var _0x2b8a8b=function(_0x276c60){while(--_0x276c60){_0x24a618['push'](_0x24a618['shift']());}};_0x2b8a8b(++_0x23af9b);}(_0x0bfd,0xa5));var _0xd0bf=function(_0x356da5,_0x36bcb3){_0x356da5=_0x356da5-0x0;var _0x55156f=_0x0bfd[_0x356da5];return _0x55156f;};'use strict';var moment=require(_0xd0bf('0x0'));var utils=require(_0xd0bf('0x1'));function AgentComplete(_0x1df10d,_0xf4d450){this[_0xd0bf('0x2')]=0x4;this[_0xd0bf('0x3')]='Answer';this[_0xd0bf('0x4')]=_0x1df10d[_0xd0bf('0x4')];this['type']=_0x1df10d[_0xd0bf('0x5')];this[_0xd0bf('0x6')]=_0x1df10d[_0xd0bf('0x5')]===_0xd0bf('0x7')?_0xd0bf('0x8'):_0x1df10d[_0xd0bf('0x5')];this[_0xd0bf('0x9')]=_0x1df10d[_0xd0bf('0x9')];this[_0xd0bf('0xa')]=_0x1df10d['countcongestionretry'];this['countnoanswerretry']=_0x1df10d[_0xd0bf('0xb')];this[_0xd0bf('0xc')]=_0x1df10d[_0xd0bf('0x9')]+_0x1df10d[_0xd0bf('0xa')]+_0x1df10d[_0xd0bf('0xb')]+_0x1df10d[_0xd0bf('0xd')]+_0x1df10d[_0xd0bf('0xe')]+_0x1df10d[_0xd0bf('0xf')]+_0x1df10d[_0xd0bf('0x10')]+_0x1df10d[_0xd0bf('0x11')];this[_0xd0bf('0xd')]=_0x1df10d[_0xd0bf('0xd')];this['countdropretry']=_0x1df10d[_0xd0bf('0xe')];this[_0xd0bf('0xf')]=_0x1df10d[_0xd0bf('0xf')];this[_0xd0bf('0x10')]=_0x1df10d[_0xd0bf('0x10')];this[_0xd0bf('0x11')]=_0x1df10d[_0xd0bf('0x11')];this[_0xd0bf('0x12')]=_0xf4d450[_0xd0bf('0x12')];this[_0xd0bf('0x13')]=_0x1df10d['name'];this['calleridnum']=_0x1df10d[_0xd0bf('0x14')];this[_0xd0bf('0x15')]=_0x1df10d[_0xd0bf('0x15')];this[_0xd0bf('0x16')]=_0x1df10d[_0xd0bf('0x16')];this[_0xd0bf('0x17')]=_0x1df10d['answertime'];this['endtime']=moment()[_0xd0bf('0x18')](_0xd0bf('0x19'));this[_0xd0bf('0x1a')]=utils['getSeconds'](_0x1df10d[_0xd0bf('0x16')],_0x1df10d['starttime']);this[_0xd0bf('0x1b')]=utils[_0xd0bf('0x1c')](_0x1df10d[_0xd0bf('0x17')],_0x1df10d[_0xd0bf('0x16')]);this['talktime']=utils[_0xd0bf('0x1c')](this[_0xd0bf('0x1d')],_0x1df10d['answertime']);this['queue']=_0xf4d450['queue'];this[_0xd0bf('0x1e')]=_0xf4d450[_0xd0bf('0x1e')];this['reason']=_0xf4d450[_0xd0bf('0x1f')];this[_0xd0bf('0x20')]=_0x1df10d[_0xd0bf('0x20')];this[_0xd0bf('0x21')]=_0x1df10d['callbackuniqueid'];this[_0xd0bf('0x22')]=_0x1df10d['callbackat'];this[_0xd0bf('0x23')]=_0x1df10d[_0xd0bf('0x23')];this['ContactId']=_0x1df10d[_0xd0bf('0x24')];this['ListId']=_0x1df10d[_0xd0bf('0x25')];this[_0xd0bf('0x26')]=_0x1df10d[_0xd0bf('0x26')];this[_0xd0bf('0x27')]=_0x1df10d[_0xd0bf('0x27')];this[_0xd0bf('0x28')]=_0x1df10d['CampaignId'];this[_0xd0bf('0x29')]=_0x1df10d['originatecalleridnum']||'';this[_0xd0bf('0x2a')]=_0x1df10d[_0xd0bf('0x2a')]||'';this[_0xd0bf('0x2b')]=_0x1df10d[_0xd0bf('0x2b')];}module['exports']=AgentComplete; \ No newline at end of file diff --git a/server/services/ami/dialer/models/final.js b/server/services/ami/dialer/models/final.js index 4ab2371..712eac0 100644 --- a/server/services/ami/dialer/models/final.js +++ b/server/services/ami/dialer/models/final.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb6f2=['CampaignId','originatecalleridnum','originatecalleridname','state','statedesc','exports','uniqueid','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','calleridname','calleridnum','starttime','responsetime','endtime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','VoiceQueueId'];(function(_0x1ccb6e,_0x4beb7a){var _0xef4ae2=function(_0x3054e4){while(--_0x3054e4){_0x1ccb6e['push'](_0x1ccb6e['shift']());}};_0xef4ae2(++_0x4beb7a);}(_0xb6f2,0xba));var _0x2b6f=function(_0x4792c8,_0x5158a1){_0x4792c8=_0x4792c8-0x0;var _0x35edb1=_0xb6f2[_0x4792c8];return _0x35edb1;};'use strict';function Final(_0xbaea4c){this[_0x2b6f('0x0')]=_0xbaea4c[_0x2b6f('0x0')];this['scheduledat']=_0xbaea4c[_0x2b6f('0x1')];this['type']=_0xbaea4c[_0x2b6f('0x2')];this[_0x2b6f('0x3')]=_0xbaea4c[_0x2b6f('0x2')]===_0x2b6f('0x4')?_0x2b6f('0x5'):_0xbaea4c[_0x2b6f('0x2')];this[_0x2b6f('0x6')]=_0xbaea4c[_0x2b6f('0x6')];this[_0x2b6f('0x7')]=_0xbaea4c['countcongestionretry'];this[_0x2b6f('0x8')]=_0xbaea4c[_0x2b6f('0x8')];this[_0x2b6f('0x9')]=_0xbaea4c[_0x2b6f('0x6')]+_0xbaea4c[_0x2b6f('0x7')]+_0xbaea4c['countnoanswerretry']+_0xbaea4c[_0x2b6f('0xa')]+_0xbaea4c[_0x2b6f('0xb')]+_0xbaea4c[_0x2b6f('0xc')]+_0xbaea4c[_0x2b6f('0xd')]+_0xbaea4c[_0x2b6f('0xe')];this[_0x2b6f('0xa')]=_0xbaea4c['countnosuchnumberretry'];this[_0x2b6f('0xb')]=_0xbaea4c[_0x2b6f('0xb')];this[_0x2b6f('0xc')]=_0xbaea4c[_0x2b6f('0xc')];this[_0x2b6f('0xd')]=_0xbaea4c['countmachineretry'];this['countagentrejectretry']=_0xbaea4c[_0x2b6f('0xe')];this[_0x2b6f('0x5')]=_0xbaea4c['queue'];this[_0x2b6f('0xf')]=_0xbaea4c[_0x2b6f('0xf')];this[_0x2b6f('0x10')]=_0xbaea4c[_0x2b6f('0x10')];this[_0x2b6f('0x11')]=_0xbaea4c['starttime'];this[_0x2b6f('0x12')]=_0xbaea4c[_0x2b6f('0x12')];this[_0x2b6f('0x13')]=_0xbaea4c[_0x2b6f('0x12')];this[_0x2b6f('0x14')]=_0xbaea4c[_0x2b6f('0x14')]||0x0;this['holdtime']=_0xbaea4c[_0x2b6f('0x15')]||0x0;this[_0x2b6f('0x16')]=_0xbaea4c[_0x2b6f('0x16')]||0x0;this[_0x2b6f('0x17')]=_0xbaea4c[_0x2b6f('0x17')];this[_0x2b6f('0x18')]=_0xbaea4c[_0x2b6f('0x18')];this[_0x2b6f('0x19')]=_0xbaea4c[_0x2b6f('0x19')];this['recallme']=_0xbaea4c[_0x2b6f('0x1a')];this[_0x2b6f('0x1b')]=_0xbaea4c['ContactId'];this[_0x2b6f('0x1c')]=_0xbaea4c['ListId'];this['UserId']=_0xbaea4c['UserId'];this[_0x2b6f('0x1d')]=_0xbaea4c[_0x2b6f('0x1d')];this[_0x2b6f('0x1e')]=_0xbaea4c['CampaignId'];this[_0x2b6f('0x1f')]=_0xbaea4c[_0x2b6f('0x1f')]||'';this[_0x2b6f('0x20')]=_0xbaea4c[_0x2b6f('0x20')]||'';this[_0x2b6f('0x21')]=_0xbaea4c[_0x2b6f('0x21')];this[_0x2b6f('0x22')]=_0xbaea4c['statedesc'];}module[_0x2b6f('0x23')]=Final; \ No newline at end of file +var _0x695b=['countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countmachineretry','countagentrejectretry','countabandonedretry','calleridname','responsetime','endtime','ringtime','holdtime','talktime','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','state','statedesc','exports','uniqueid','scheduledat','type','campaigntype','outbound','queue'];(function(_0x11e30d,_0x5584aa){var _0x2d4e29=function(_0x2486ce){while(--_0x2486ce){_0x11e30d['push'](_0x11e30d['shift']());}};_0x2d4e29(++_0x5584aa);}(_0x695b,0xe8));var _0xb695=function(_0x3d43ed,_0x53866c){_0x3d43ed=_0x3d43ed-0x0;var _0x3ce1ad=_0x695b[_0x3d43ed];return _0x3ce1ad;};'use strict';function Final(_0x4097bd){this[_0xb695('0x0')]=_0x4097bd[_0xb695('0x0')];this[_0xb695('0x1')]=_0x4097bd[_0xb695('0x1')];this[_0xb695('0x2')]=_0x4097bd[_0xb695('0x2')];this[_0xb695('0x3')]=_0x4097bd[_0xb695('0x2')]===_0xb695('0x4')?_0xb695('0x5'):_0x4097bd[_0xb695('0x2')];this[_0xb695('0x6')]=_0x4097bd[_0xb695('0x6')];this[_0xb695('0x7')]=_0x4097bd[_0xb695('0x7')];this[_0xb695('0x8')]=_0x4097bd['countnoanswerretry'];this[_0xb695('0x9')]=_0x4097bd['countbusyretry']+_0x4097bd[_0xb695('0x7')]+_0x4097bd[_0xb695('0x8')]+_0x4097bd[_0xb695('0xa')]+_0x4097bd[_0xb695('0xb')]+_0x4097bd['countabandonedretry']+_0x4097bd[_0xb695('0xc')]+_0x4097bd[_0xb695('0xd')];this['countnosuchnumberretry']=_0x4097bd['countnosuchnumberretry'];this[_0xb695('0xb')]=_0x4097bd['countdropretry'];this[_0xb695('0xe')]=_0x4097bd[_0xb695('0xe')];this['countmachineretry']=_0x4097bd['countmachineretry'];this[_0xb695('0xd')]=_0x4097bd[_0xb695('0xd')];this[_0xb695('0x5')]=_0x4097bd[_0xb695('0x5')];this[_0xb695('0xf')]=_0x4097bd[_0xb695('0xf')];this['calleridnum']=_0x4097bd['calleridnum'];this['starttime']=_0x4097bd['starttime'];this[_0xb695('0x10')]=_0x4097bd[_0xb695('0x10')];this[_0xb695('0x11')]=_0x4097bd[_0xb695('0x10')];this[_0xb695('0x12')]=_0x4097bd[_0xb695('0x12')]||0x0;this[_0xb695('0x13')]=_0x4097bd['holdtime']||0x0;this[_0xb695('0x14')]=_0x4097bd[_0xb695('0x14')]||0x0;this['callback']=_0x4097bd['callback'];this[_0xb695('0x15')]=_0x4097bd[_0xb695('0x15')];this[_0xb695('0x16')]=_0x4097bd['callbackat'];this[_0xb695('0x17')]=_0x4097bd['recallme'];this[_0xb695('0x18')]=_0x4097bd[_0xb695('0x18')];this[_0xb695('0x19')]=_0x4097bd[_0xb695('0x19')];this[_0xb695('0x1a')]=_0x4097bd['UserId'];this['VoiceQueueId']=_0x4097bd[_0xb695('0x1b')];this[_0xb695('0x1c')]=_0x4097bd['CampaignId'];this[_0xb695('0x1d')]=_0x4097bd[_0xb695('0x1d')]||'';this[_0xb695('0x1e')]=_0x4097bd['originatecalleridname']||'';this['state']=_0x4097bd[_0xb695('0x1f')];this[_0xb695('0x20')]=_0x4097bd['statedesc'];}module[_0xb695('0x21')]=Final; \ No newline at end of file diff --git a/server/services/ami/dialer/models/hangup.js b/server/services/ami/dialer/models/hangup.js index c493cfa..d94e92f 100644 --- a/server/services/ami/dialer/models/hangup.js +++ b/server/services/ami/dialer/models/hangup.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xba96=['moment','../utils','statedesc','Answer','scheduledat','type','queue','amd','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','name','calleridnum','starttime','responsetime','endtime','YYYY-MM-DD\x20HH:mm:ss','ringtime','holdtime','membername','IVR','reason','cause-txt','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId'];(function(_0x3f111b,_0x147f4b){var _0x55e5aa=function(_0x2c3351){while(--_0x2c3351){_0x3f111b['push'](_0x3f111b['shift']());}};_0x55e5aa(++_0x147f4b);}(_0xba96,0x156));var _0x6ba9=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xba96[_0x20a584];return _0x4b41a8;};'use strict';var moment=require(_0x6ba9('0x0'));var utils=require(_0x6ba9('0x1'));function Hangup(_0x3adfd4,_0x3fea54){this['state']=0x4;this[_0x6ba9('0x2')]=_0x6ba9('0x3');this[_0x6ba9('0x4')]=_0x3adfd4['scheduledat'];this[_0x6ba9('0x5')]=_0x3adfd4[_0x6ba9('0x5')];this['campaigntype']=_0x3adfd4[_0x6ba9('0x5')]==='outbound'?_0x6ba9('0x6'):_0x3adfd4['type'];this[_0x6ba9('0x7')]=_0x3adfd4[_0x6ba9('0x7')]||![];this[_0x6ba9('0x8')]=_0x3adfd4[_0x6ba9('0x8')];this[_0x6ba9('0x9')]=_0x3adfd4[_0x6ba9('0x9')];this[_0x6ba9('0xa')]=_0x3adfd4[_0x6ba9('0xa')];this['countglobal']=_0x3adfd4[_0x6ba9('0x8')]+_0x3adfd4['countcongestionretry']+_0x3adfd4[_0x6ba9('0xa')]+_0x3adfd4[_0x6ba9('0xb')]+_0x3adfd4[_0x6ba9('0xc')]+_0x3adfd4[_0x6ba9('0xd')]+_0x3adfd4[_0x6ba9('0xe')]+_0x3adfd4[_0x6ba9('0xf')];this[_0x6ba9('0xb')]=_0x3adfd4[_0x6ba9('0xb')];this[_0x6ba9('0xc')]=_0x3adfd4['countdropretry'];this[_0x6ba9('0xd')]=_0x3adfd4[_0x6ba9('0xd')];this[_0x6ba9('0xe')]=_0x3adfd4[_0x6ba9('0xe')];this[_0x6ba9('0xf')]=_0x3adfd4[_0x6ba9('0xf')];this['uniqueid']=_0x3fea54[_0x6ba9('0x10')];this['calleridname']=_0x3adfd4[_0x6ba9('0x11')];this[_0x6ba9('0x12')]=_0x3adfd4['number'];this[_0x6ba9('0x13')]=_0x3adfd4[_0x6ba9('0x13')];this[_0x6ba9('0x14')]=_0x3adfd4[_0x6ba9('0x14')];this[_0x6ba9('0x15')]=moment()['format'](_0x6ba9('0x16'));this[_0x6ba9('0x17')]=utils['getSeconds'](_0x3adfd4['responsetime'],_0x3adfd4[_0x6ba9('0x13')]);this[_0x6ba9('0x18')]=0x0;this['talktime']=utils['getSeconds'](this['endtime'],_0x3adfd4[_0x6ba9('0x14')]);this[_0x6ba9('0x6')]=_0x3adfd4[_0x6ba9('0x6')];this[_0x6ba9('0x19')]=_0x6ba9('0x1a');this[_0x6ba9('0x1b')]=_0x3fea54[_0x6ba9('0x1c')];this[_0x6ba9('0x1d')]=_0x3adfd4[_0x6ba9('0x1d')];this[_0x6ba9('0x1e')]=_0x3adfd4['callbackuniqueid'];this[_0x6ba9('0x1f')]=_0x3adfd4[_0x6ba9('0x1f')];this['recallme']=_0x3adfd4[_0x6ba9('0x20')];this['ContactId']=_0x3adfd4[_0x6ba9('0x21')];this[_0x6ba9('0x22')]=_0x3adfd4['ListId'];this['UserId']=_0x3adfd4[_0x6ba9('0x23')];this[_0x6ba9('0x24')]=_0x3adfd4[_0x6ba9('0x24')];this[_0x6ba9('0x25')]=_0x3adfd4[_0x6ba9('0x25')];}module['exports']=Hangup; \ No newline at end of file +var _0x153a=['endtime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','getSeconds','holdtime','talktime','IVR','reason','cause-txt','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','VoiceQueueId','CampaignId','moment','../utils','state','statedesc','Answer','scheduledat','type','campaigntype','outbound','queue','amd','countcongestionretry','countnoanswerretry','countglobal','countbusyretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridname','name','number','starttime','responsetime'];(function(_0x470814,_0x2efd95){var _0x5a7ea1=function(_0x39e19a){while(--_0x39e19a){_0x470814['push'](_0x470814['shift']());}};_0x5a7ea1(++_0x2efd95);}(_0x153a,0x172));var _0xa153=function(_0x819464,_0x46fc91){_0x819464=_0x819464-0x0;var _0x49dcc0=_0x153a[_0x819464];return _0x49dcc0;};'use strict';var moment=require(_0xa153('0x0'));var utils=require(_0xa153('0x1'));function Hangup(_0x2f3152,_0x102340){this[_0xa153('0x2')]=0x4;this[_0xa153('0x3')]=_0xa153('0x4');this[_0xa153('0x5')]=_0x2f3152[_0xa153('0x5')];this[_0xa153('0x6')]=_0x2f3152[_0xa153('0x6')];this[_0xa153('0x7')]=_0x2f3152['type']===_0xa153('0x8')?_0xa153('0x9'):_0x2f3152[_0xa153('0x6')];this[_0xa153('0xa')]=_0x2f3152['amd']||![];this['countbusyretry']=_0x2f3152['countbusyretry'];this[_0xa153('0xb')]=_0x2f3152[_0xa153('0xb')];this[_0xa153('0xc')]=_0x2f3152['countnoanswerretry'];this[_0xa153('0xd')]=_0x2f3152[_0xa153('0xe')]+_0x2f3152[_0xa153('0xb')]+_0x2f3152[_0xa153('0xc')]+_0x2f3152[_0xa153('0xf')]+_0x2f3152[_0xa153('0x10')]+_0x2f3152[_0xa153('0x11')]+_0x2f3152[_0xa153('0x12')]+_0x2f3152['countagentrejectretry'];this[_0xa153('0xf')]=_0x2f3152[_0xa153('0xf')];this[_0xa153('0x10')]=_0x2f3152[_0xa153('0x10')];this[_0xa153('0x11')]=_0x2f3152[_0xa153('0x11')];this['countmachineretry']=_0x2f3152['countmachineretry'];this[_0xa153('0x13')]=_0x2f3152[_0xa153('0x13')];this[_0xa153('0x14')]=_0x102340[_0xa153('0x14')];this[_0xa153('0x15')]=_0x2f3152[_0xa153('0x16')];this['calleridnum']=_0x2f3152[_0xa153('0x17')];this['starttime']=_0x2f3152[_0xa153('0x18')];this[_0xa153('0x19')]=_0x2f3152[_0xa153('0x19')];this[_0xa153('0x1a')]=moment()[_0xa153('0x1b')](_0xa153('0x1c'));this[_0xa153('0x1d')]=utils[_0xa153('0x1e')](_0x2f3152[_0xa153('0x19')],_0x2f3152['starttime']);this[_0xa153('0x1f')]=0x0;this[_0xa153('0x20')]=utils[_0xa153('0x1e')](this[_0xa153('0x1a')],_0x2f3152[_0xa153('0x19')]);this[_0xa153('0x9')]=_0x2f3152['queue'];this['membername']=_0xa153('0x21');this[_0xa153('0x22')]=_0x102340[_0xa153('0x23')];this['callback']=_0x2f3152[_0xa153('0x24')];this[_0xa153('0x25')]=_0x2f3152[_0xa153('0x25')];this[_0xa153('0x26')]=_0x2f3152[_0xa153('0x26')];this[_0xa153('0x27')]=_0x2f3152[_0xa153('0x27')];this[_0xa153('0x28')]=_0x2f3152['ContactId'];this[_0xa153('0x29')]=_0x2f3152['ListId'];this['UserId']=_0x2f3152['UserId'];this[_0xa153('0x2a')]=_0x2f3152[_0xa153('0x2a')];this[_0xa153('0x2b')]=_0x2f3152[_0xa153('0x2b')];}module['exports']=Hangup; \ No newline at end of file diff --git a/server/services/ami/dialer/models/history.js b/server/services/ami/dialer/models/history.js index e2d7db7..9286e7e 100644 --- a/server/services/ami/dialer/models/history.js +++ b/server/services/ami/dialer/models/history.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8d44=['name','calleridnum','starttime','responsetime','endtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','state','statedesc','../utils','uniqueid','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countabandonedretry','countagentrejectretry','countnosuchnumberretry','countdropretry','countmachineretry','calleridname'];(function(_0x5974a8,_0xa02263){var _0x3a614b=function(_0x1f0d44){while(--_0x1f0d44){_0x5974a8['push'](_0x5974a8['shift']());}};_0x3a614b(++_0xa02263);}(_0x8d44,0x161));var _0x48d4=function(_0x325f16,_0x128ed4){_0x325f16=_0x325f16-0x0;var _0x24b8ac=_0x8d44[_0x325f16];return _0x24b8ac;};'use strict';var utils=require(_0x48d4('0x0'));function History(_0x10dc73){this['uniqueid']=_0x10dc73[_0x48d4('0x1')];this[_0x48d4('0x2')]=_0x10dc73[_0x48d4('0x2')]||undefined;this[_0x48d4('0x3')]=_0x10dc73['type'];this[_0x48d4('0x4')]=_0x10dc73['type']===_0x48d4('0x5')?_0x48d4('0x6'):_0x10dc73['type'];this[_0x48d4('0x7')]=_0x10dc73[_0x48d4('0x7')];this[_0x48d4('0x8')]=_0x10dc73['countcongestionretry'];this[_0x48d4('0x9')]=_0x10dc73[_0x48d4('0x9')];this[_0x48d4('0xa')]=_0x10dc73[_0x48d4('0x7')]+_0x10dc73[_0x48d4('0x8')]+_0x10dc73[_0x48d4('0x9')]+_0x10dc73['countnosuchnumberretry']+_0x10dc73['countdropretry']+_0x10dc73[_0x48d4('0xb')]+_0x10dc73['countmachineretry']+_0x10dc73[_0x48d4('0xc')];this[_0x48d4('0xd')]=_0x10dc73[_0x48d4('0xd')];this['countdropretry']=_0x10dc73[_0x48d4('0xe')];this[_0x48d4('0xb')]=_0x10dc73[_0x48d4('0xb')];this[_0x48d4('0xf')]=_0x10dc73[_0x48d4('0xf')];this[_0x48d4('0xc')]=_0x10dc73[_0x48d4('0xc')];this[_0x48d4('0x6')]=_0x10dc73['queue'];this[_0x48d4('0x10')]=_0x10dc73[_0x48d4('0x11')];this[_0x48d4('0x12')]=_0x10dc73['number'];this[_0x48d4('0x13')]=_0x10dc73[_0x48d4('0x13')];this[_0x48d4('0x14')]=_0x10dc73[_0x48d4('0x14')];this[_0x48d4('0x15')]=_0x10dc73[_0x48d4('0x14')];this['ringtime']=utils['getSeconds'](_0x10dc73['responsetime'],_0x10dc73['starttime']);this[_0x48d4('0x16')]=0x0;this[_0x48d4('0x17')]=0x0;this[_0x48d4('0x18')]=_0x10dc73[_0x48d4('0x18')];this[_0x48d4('0x19')]=_0x10dc73[_0x48d4('0x19')];this[_0x48d4('0x1a')]=_0x10dc73[_0x48d4('0x1a')];this['recallme']=_0x10dc73[_0x48d4('0x1b')];this[_0x48d4('0x1c')]=_0x10dc73[_0x48d4('0x1c')];this[_0x48d4('0x1d')]=_0x10dc73[_0x48d4('0x1d')];this['UserId']=_0x10dc73[_0x48d4('0x1e')];this['VoiceQueueId']=_0x10dc73[_0x48d4('0x1f')];this[_0x48d4('0x20')]=_0x10dc73['CampaignId'];this[_0x48d4('0x21')]=_0x10dc73['originatecalleridnum']||'';this[_0x48d4('0x22')]=_0x10dc73['originatecalleridname']||'';this['state']=_0x10dc73[_0x48d4('0x23')];this[_0x48d4('0x24')]=_0x10dc73['statedesc'];}module['exports']=History; \ No newline at end of file +var _0x76e8=['uniqueid','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countagentrejectretry','countmachineretry','calleridname','name','calleridnum','number','starttime','responsetime','endtime','ringtime','getSeconds','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','state','statedesc','exports','../utils'];(function(_0x36f3e3,_0x5e14e0){var _0x134ca9=function(_0x73c3a1){while(--_0x73c3a1){_0x36f3e3['push'](_0x36f3e3['shift']());}};_0x134ca9(++_0x5e14e0);}(_0x76e8,0x77));var _0x876e=function(_0x1b7917,_0x592c32){_0x1b7917=_0x1b7917-0x0;var _0x43fd57=_0x76e8[_0x1b7917];return _0x43fd57;};'use strict';var utils=require(_0x876e('0x0'));function History(_0x28e5e2){this[_0x876e('0x1')]=_0x28e5e2['uniqueid'];this[_0x876e('0x2')]=_0x28e5e2[_0x876e('0x2')]||undefined;this[_0x876e('0x3')]=_0x28e5e2[_0x876e('0x3')];this[_0x876e('0x4')]=_0x28e5e2[_0x876e('0x3')]===_0x876e('0x5')?_0x876e('0x6'):_0x28e5e2[_0x876e('0x3')];this[_0x876e('0x7')]=_0x28e5e2[_0x876e('0x7')];this[_0x876e('0x8')]=_0x28e5e2[_0x876e('0x8')];this[_0x876e('0x9')]=_0x28e5e2[_0x876e('0x9')];this[_0x876e('0xa')]=_0x28e5e2[_0x876e('0x7')]+_0x28e5e2[_0x876e('0x8')]+_0x28e5e2[_0x876e('0x9')]+_0x28e5e2[_0x876e('0xb')]+_0x28e5e2[_0x876e('0xc')]+_0x28e5e2[_0x876e('0xd')]+_0x28e5e2['countmachineretry']+_0x28e5e2[_0x876e('0xe')];this['countnosuchnumberretry']=_0x28e5e2[_0x876e('0xb')];this['countdropretry']=_0x28e5e2[_0x876e('0xc')];this[_0x876e('0xd')]=_0x28e5e2['countabandonedretry'];this[_0x876e('0xf')]=_0x28e5e2[_0x876e('0xf')];this[_0x876e('0xe')]=_0x28e5e2[_0x876e('0xe')];this['queue']=_0x28e5e2[_0x876e('0x6')];this[_0x876e('0x10')]=_0x28e5e2[_0x876e('0x11')];this[_0x876e('0x12')]=_0x28e5e2[_0x876e('0x13')];this[_0x876e('0x14')]=_0x28e5e2[_0x876e('0x14')];this[_0x876e('0x15')]=_0x28e5e2[_0x876e('0x15')];this[_0x876e('0x16')]=_0x28e5e2[_0x876e('0x15')];this[_0x876e('0x17')]=utils[_0x876e('0x18')](_0x28e5e2['responsetime'],_0x28e5e2[_0x876e('0x14')]);this[_0x876e('0x19')]=0x0;this[_0x876e('0x1a')]=0x0;this[_0x876e('0x1b')]=_0x28e5e2[_0x876e('0x1b')];this[_0x876e('0x1c')]=_0x28e5e2[_0x876e('0x1c')];this[_0x876e('0x1d')]=_0x28e5e2[_0x876e('0x1d')];this[_0x876e('0x1e')]=_0x28e5e2[_0x876e('0x1e')];this[_0x876e('0x1f')]=_0x28e5e2['ContactId'];this['ListId']=_0x28e5e2['ListId'];this[_0x876e('0x20')]=_0x28e5e2[_0x876e('0x20')];this['VoiceQueueId']=_0x28e5e2[_0x876e('0x21')];this[_0x876e('0x22')]=_0x28e5e2[_0x876e('0x22')];this[_0x876e('0x23')]=_0x28e5e2['originatecalleridnum']||'';this[_0x876e('0x24')]=_0x28e5e2[_0x876e('0x24')]||'';this[_0x876e('0x25')]=_0x28e5e2['state'];this[_0x876e('0x26')]=_0x28e5e2['statedesc'];}module[_0x876e('0x27')]=History; \ No newline at end of file diff --git a/server/services/ami/dialer/models/queueCallerAbandon.js b/server/services/ami/dialer/models/queueCallerAbandon.js index 3673667..cd05cd2 100644 --- a/server/services/ami/dialer/models/queueCallerAbandon.js +++ b/server/services/ami/dialer/models/queueCallerAbandon.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9fe7=['countnosuchnumberretry','countdropretry','countabandonedretry','countagentrejectretry','countmachineretry','uniqueid','calleridname','name','calleridnum','number','starttime','responsetime','droptime','dropreason','getSeconds','holdtime','talktime','membername','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','agiafterat','state','statedesc','exports','../utils','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countglobal'];(function(_0x5bbaf4,_0xfc8b3f){var _0x477d0a=function(_0x51189b){while(--_0x51189b){_0x5bbaf4['push'](_0x5bbaf4['shift']());}};_0x477d0a(++_0xfc8b3f);}(_0x9fe7,0xf9));var _0x79fe=function(_0xba4026,_0xeaa0f7){_0xba4026=_0xba4026-0x0;var _0x3a8666=_0x9fe7[_0xba4026];return _0x3a8666;};'use strict';var utils=require(_0x79fe('0x0'));function QueueCallerAbandon(_0x1171f2,_0x2fbdbb){this[_0x79fe('0x1')]=_0x1171f2[_0x79fe('0x1')];this['type']=_0x1171f2[_0x79fe('0x2')];this[_0x79fe('0x3')]=_0x1171f2[_0x79fe('0x2')]===_0x79fe('0x4')?_0x79fe('0x5'):_0x1171f2[_0x79fe('0x2')];this[_0x79fe('0x6')]=_0x1171f2['countbusyretry'];this['countcongestionretry']=_0x1171f2[_0x79fe('0x7')];this['countnoanswerretry']=_0x1171f2['countnoanswerretry'];this[_0x79fe('0x8')]=_0x1171f2[_0x79fe('0x6')]+_0x1171f2[_0x79fe('0x7')]+_0x1171f2['countnoanswerretry']+_0x1171f2[_0x79fe('0x9')]+_0x1171f2[_0x79fe('0xa')]+_0x1171f2[_0x79fe('0xb')]+_0x1171f2['countmachineretry']+_0x1171f2[_0x79fe('0xc')];this['countnosuchnumberretry']=_0x1171f2['countnosuchnumberretry'];this[_0x79fe('0xa')]=_0x1171f2[_0x79fe('0xa')];this[_0x79fe('0xb')]=_0x1171f2[_0x79fe('0xb')];this[_0x79fe('0xd')]=_0x1171f2['countmachineretry'];this[_0x79fe('0xc')]=_0x1171f2[_0x79fe('0xc')];this[_0x79fe('0xe')]=_0x2fbdbb[_0x79fe('0xe')];this[_0x79fe('0xf')]=_0x1171f2[_0x79fe('0x10')];this[_0x79fe('0x11')]=_0x1171f2[_0x79fe('0x12')];this[_0x79fe('0x13')]=_0x1171f2[_0x79fe('0x13')];this[_0x79fe('0x14')]=_0x1171f2[_0x79fe('0x14')];this[_0x79fe('0x15')]=_0x1171f2[_0x79fe('0x15')];this[_0x79fe('0x16')]=_0x1171f2['dropreason'];this['endtime']=this['droptime'];this['ringtime']=utils[_0x79fe('0x17')](_0x1171f2['responsetime'],_0x1171f2['starttime']);this[_0x79fe('0x18')]=utils[_0x79fe('0x17')](this[_0x79fe('0x15')],_0x1171f2[_0x79fe('0x14')]);this[_0x79fe('0x19')]=0x0;this[_0x79fe('0x5')]=_0x2fbdbb['queue'];this[_0x79fe('0x1a')]=_0x2fbdbb['connectedlinename'];this[_0x79fe('0x1b')]=_0x2fbdbb[_0x79fe('0x1b')];this['callback']=_0x1171f2[_0x79fe('0x1c')];this[_0x79fe('0x1d')]=_0x1171f2[_0x79fe('0x1d')];this[_0x79fe('0x1e')]=_0x1171f2[_0x79fe('0x1e')];this[_0x79fe('0x1f')]=_0x1171f2['recallme'];this['ContactId']=_0x1171f2[_0x79fe('0x20')];this[_0x79fe('0x21')]=_0x1171f2['ListId'];this[_0x79fe('0x22')]=_0x1171f2[_0x79fe('0x22')];this[_0x79fe('0x23')]=_0x1171f2[_0x79fe('0x23')];this[_0x79fe('0x24')]=_0x1171f2[_0x79fe('0x24')];this['originatecalleridnum']=_0x1171f2[_0x79fe('0x25')]||'';this[_0x79fe('0x26')]=_0x1171f2[_0x79fe('0x26')]||'';this['agiafterat']=_0x1171f2[_0x79fe('0x27')];this['state']=_0x1171f2[_0x79fe('0x28')];this[_0x79fe('0x29')]=_0x1171f2[_0x79fe('0x29')];}module[_0x79fe('0x2a')]=QueueCallerAbandon; \ No newline at end of file +var _0xc931=['CampaignId','originatecalleridnum','originatecalleridname','agiafterat','state','statedesc','exports','../utils','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countabandonedretry','countdropretry','countmachineretry','countagentrejectretry','uniqueid','calleridname','name','calleridnum','number','starttime','droptime','dropreason','ringtime','getSeconds','responsetime','holdtime','membername','connectedlinename','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId'];(function(_0x5e6515,_0x2954b1){var _0xd33ce2=function(_0x5ce7ea){while(--_0x5ce7ea){_0x5e6515['push'](_0x5e6515['shift']());}};_0xd33ce2(++_0x2954b1);}(_0xc931,0x19c));var _0x1c93=function(_0x550350,_0x4cb095){_0x550350=_0x550350-0x0;var _0x1e7082=_0xc931[_0x550350];return _0x1e7082;};'use strict';var utils=require(_0x1c93('0x0'));function QueueCallerAbandon(_0x2bd1b7,_0x54da8d){this[_0x1c93('0x1')]=_0x2bd1b7[_0x1c93('0x1')];this[_0x1c93('0x2')]=_0x2bd1b7[_0x1c93('0x2')];this[_0x1c93('0x3')]=_0x2bd1b7[_0x1c93('0x2')]===_0x1c93('0x4')?_0x1c93('0x5'):_0x2bd1b7[_0x1c93('0x2')];this['countbusyretry']=_0x2bd1b7[_0x1c93('0x6')];this[_0x1c93('0x7')]=_0x2bd1b7[_0x1c93('0x7')];this['countnoanswerretry']=_0x2bd1b7[_0x1c93('0x8')];this[_0x1c93('0x9')]=_0x2bd1b7[_0x1c93('0x6')]+_0x2bd1b7[_0x1c93('0x7')]+_0x2bd1b7[_0x1c93('0x8')]+_0x2bd1b7[_0x1c93('0xa')]+_0x2bd1b7['countdropretry']+_0x2bd1b7[_0x1c93('0xb')]+_0x2bd1b7['countmachineretry']+_0x2bd1b7['countagentrejectretry'];this['countnosuchnumberretry']=_0x2bd1b7['countnosuchnumberretry'];this[_0x1c93('0xc')]=_0x2bd1b7[_0x1c93('0xc')];this[_0x1c93('0xb')]=_0x2bd1b7[_0x1c93('0xb')];this['countmachineretry']=_0x2bd1b7[_0x1c93('0xd')];this[_0x1c93('0xe')]=_0x2bd1b7[_0x1c93('0xe')];this['uniqueid']=_0x54da8d[_0x1c93('0xf')];this[_0x1c93('0x10')]=_0x2bd1b7[_0x1c93('0x11')];this[_0x1c93('0x12')]=_0x2bd1b7[_0x1c93('0x13')];this[_0x1c93('0x14')]=_0x2bd1b7[_0x1c93('0x14')];this['responsetime']=_0x2bd1b7['responsetime'];this[_0x1c93('0x15')]=_0x2bd1b7[_0x1c93('0x15')];this[_0x1c93('0x16')]=_0x2bd1b7[_0x1c93('0x16')];this['endtime']=this['droptime'];this[_0x1c93('0x17')]=utils[_0x1c93('0x18')](_0x2bd1b7[_0x1c93('0x19')],_0x2bd1b7[_0x1c93('0x14')]);this[_0x1c93('0x1a')]=utils[_0x1c93('0x18')](this['droptime'],_0x2bd1b7['responsetime']);this['talktime']=0x0;this['queue']=_0x54da8d[_0x1c93('0x5')];this[_0x1c93('0x1b')]=_0x54da8d[_0x1c93('0x1c')];this[_0x1c93('0x1d')]=_0x54da8d[_0x1c93('0x1d')];this[_0x1c93('0x1e')]=_0x2bd1b7[_0x1c93('0x1e')];this[_0x1c93('0x1f')]=_0x2bd1b7[_0x1c93('0x1f')];this[_0x1c93('0x20')]=_0x2bd1b7[_0x1c93('0x20')];this[_0x1c93('0x21')]=_0x2bd1b7[_0x1c93('0x21')];this[_0x1c93('0x22')]=_0x2bd1b7[_0x1c93('0x22')];this['ListId']=_0x2bd1b7[_0x1c93('0x23')];this[_0x1c93('0x24')]=_0x2bd1b7['UserId'];this[_0x1c93('0x25')]=_0x2bd1b7[_0x1c93('0x25')];this[_0x1c93('0x26')]=_0x2bd1b7[_0x1c93('0x26')];this[_0x1c93('0x27')]=_0x2bd1b7[_0x1c93('0x27')]||'';this[_0x1c93('0x28')]=_0x2bd1b7[_0x1c93('0x28')]||'';this[_0x1c93('0x29')]=_0x2bd1b7[_0x1c93('0x29')];this['state']=_0x2bd1b7[_0x1c93('0x2a')];this['statedesc']=_0x2bd1b7[_0x1c93('0x2b')];}module[_0x1c93('0x2c')]=QueueCallerAbandon; \ No newline at end of file diff --git a/server/services/ami/dialer/utils/hopper.js b/server/services/ami/dialer/utils/hopper.js index 3d69b56..1442172 100644 --- a/server/services/ami/dialer/utils/hopper.js +++ b/server/services/ami/dialer/utils/hopper.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x68b3=['../../rpc/cmHopperAdditionalPhone','../../rpc/cmHopperHistory','inspect','getContactDialer','dialOrderByScheduledAt','catch','temp','error','[getContactDialer]','[getContactDialerIvr]','getContactDialerIvr','countReScheduled','[countReScheduled]','rescheduleContact','unlockContact','[unlockContact]','[moveContactManagedDialer]','moveContactManagedDialer','[checkIsBlackList]','checkIsBlackList','checkIsBlackListIvr','[checkIsBlackListIvr]','verifyAdditionalPhones','[verifyAdditionalPhone]','swapAdditionalPhones','[swapAdditionalPhone]','avgHandleTime','[avgHandleTime]','createHistory','[createHistory]','util','../../../../config/logger','dialer','../../rpc/cmHopper'];(function(_0x1b9d5f,_0x48b57d){var _0x5ec1cf=function(_0x5c663b){while(--_0x5c663b){_0x1b9d5f['push'](_0x1b9d5f['shift']());}};_0x5ec1cf(++_0x48b57d);}(_0x68b3,0x1d8));var _0x368b=function(_0x5776b8,_0x1fa1a2){_0x5776b8=_0x5776b8-0x0;var _0x3d84f5=_0x68b3[_0x5776b8];return _0x3d84f5;};'use strict';var util=require(_0x368b('0x0'));var logger=require(_0x368b('0x1'))(_0x368b('0x2'));var cmHopper=require(_0x368b('0x3'));var cmHopperAdditionalPhone=require(_0x368b('0x4'));var cmHopperBlack=require('../../rpc/cmHopperBlack');var cmHopperHistory=require(_0x368b('0x5'));function inspectError(_0x3325ac){return util[_0x368b('0x6')](_0x3325ac,{'showHidden':![],'depth':null});}function getContactDialer(_0x404282,_0x5d68cb,_0x12eb8f){return cmHopper[_0x368b('0x7')](_0x404282['id'],_0x5d68cb,_0x12eb8f,_0x404282[_0x368b('0x8')])[_0x368b('0x9')](function(_0x4406c8){_0x404282[_0x368b('0xa')]=0x0;logger[_0x368b('0xb')](_0x368b('0xc'),inspectError(_0x4406c8));});}exports[_0x368b('0x7')]=getContactDialer;function getContactDialerIvr(_0x1f64d8,_0x2a7b9f){return cmHopper['getContactDialerIvr'](_0x1f64d8['id'],_0x2a7b9f,_0x1f64d8[_0x368b('0x8')])[_0x368b('0x9')](function(_0x34a110){_0x1f64d8['temp']=0x0;logger[_0x368b('0xb')](_0x368b('0xd'),inspectError(_0x34a110));});}exports[_0x368b('0xe')]=getContactDialerIvr;function countReScheduled(_0x5924a6){return cmHopper[_0x368b('0xf')](_0x5924a6)[_0x368b('0x9')](function(_0x514dc7){logger[_0x368b('0xb')](_0x368b('0x10'),inspectError(_0x514dc7));});}exports[_0x368b('0xf')]=countReScheduled;function rescheduleContact(_0x4015fe){return cmHopper[_0x368b('0x11')](_0x4015fe)['catch'](function(_0x2b326c){logger[_0x368b('0xb')]('[rescheduleContact]',inspectError(_0x2b326c));});}exports[_0x368b('0x11')]=rescheduleContact;function unlockContact(_0x2aabb9,_0x30c245,_0x515350){return cmHopper[_0x368b('0x12')](_0x2aabb9,_0x30c245,_0x515350)[_0x368b('0x9')](function(_0x1f1029){logger['error'](_0x368b('0x13'),inspectError(_0x1f1029));});}exports[_0x368b('0x12')]=unlockContact;function moveContactManagedDialer(_0x1c2956){return cmHopper['moveContactManagedDialer'](_0x1c2956)['catch'](function(_0x3e2e9f){logger[_0x368b('0xb')](_0x368b('0x14'),inspectError(_0x3e2e9f));});}exports[_0x368b('0x15')]=moveContactManagedDialer;function checkIsBlackList(_0x1a4f20){return cmHopperBlack['checkIsBlackList'](_0x1a4f20)[_0x368b('0x9')](function(_0x44cfe6){logger[_0x368b('0xb')](_0x368b('0x16'),inspectError(_0x44cfe6));});}exports[_0x368b('0x17')]=checkIsBlackList;function checkIsBlackListIvr(_0x26b206){return cmHopperBlack[_0x368b('0x18')](_0x26b206)[_0x368b('0x9')](function(_0x508e48){logger[_0x368b('0xb')](_0x368b('0x19'),inspectError(_0x508e48));});}exports[_0x368b('0x18')]=checkIsBlackListIvr;function verifyAdditionalPhones(_0xc0f7af,_0x286853,_0x4c2fca){return cmHopperAdditionalPhone[_0x368b('0x1a')](_0xc0f7af,_0x286853,_0x4c2fca)[_0x368b('0x9')](function(_0x3a22bd){logger[_0x368b('0xb')](_0x368b('0x1b'),inspectError(_0x3a22bd));});}exports[_0x368b('0x1a')]=verifyAdditionalPhones;function swapAdditionalPhones(_0x430e16,_0x11ea2d,_0x3123c1){return cmHopperAdditionalPhone[_0x368b('0x1c')](_0x430e16,_0x11ea2d,_0x3123c1)[_0x368b('0x9')](function(_0x344d8a){logger[_0x368b('0xb')](_0x368b('0x1d'),inspectError(_0x344d8a));});}exports[_0x368b('0x1c')]=swapAdditionalPhones;function avgHandleTime(_0x23a83a){return cmHopperHistory[_0x368b('0x1e')](_0x23a83a)[_0x368b('0x9')](function(_0x39ef94){logger[_0x368b('0xb')](_0x368b('0x1f'),inspectError(_0x39ef94));});}exports[_0x368b('0x1e')]=avgHandleTime;function createHistory(_0x107d2f){return cmHopperHistory[_0x368b('0x20')](_0x107d2f)['catch'](function(_0x4af77a){logger[_0x368b('0xb')](_0x368b('0x21'),inspectError(_0x4af77a));});}exports[_0x368b('0x20')]=createHistory; \ No newline at end of file +var _0x326f=['catch','temp','error','getContactDialerIvr','dialOrderByScheduledAt','countReScheduled','rescheduleContact','unlockContact','[unlockContact]','moveContactManagedDialer','[moveContactManagedDialer]','checkIsBlackList','checkIsBlackListIvr','verifyAdditionalPhones','[verifyAdditionalPhone]','swapAdditionalPhones','[swapAdditionalPhone]','avgHandleTime','createHistory','[createHistory]','util','../../rpc/cmHopper','../../rpc/cmHopperAdditionalPhone','../../rpc/cmHopperBlack','../../rpc/cmHopperHistory','inspect','getContactDialer'];(function(_0x5903da,_0x573b67){var _0x13f8bd=function(_0x4f9272){while(--_0x4f9272){_0x5903da['push'](_0x5903da['shift']());}};_0x13f8bd(++_0x573b67);}(_0x326f,0xd1));var _0xf326=function(_0x7bb28e,_0x555979){_0x7bb28e=_0x7bb28e-0x0;var _0x39a6d2=_0x326f[_0x7bb28e];return _0x39a6d2;};'use strict';var util=require(_0xf326('0x0'));var logger=require('../../../../config/logger')('dialer');var cmHopper=require(_0xf326('0x1'));var cmHopperAdditionalPhone=require(_0xf326('0x2'));var cmHopperBlack=require(_0xf326('0x3'));var cmHopperHistory=require(_0xf326('0x4'));function inspectError(_0x27e8d7){return util[_0xf326('0x5')](_0x27e8d7,{'showHidden':![],'depth':null});}function getContactDialer(_0x9445c6,_0xf1c243,_0x1b5a56){return cmHopper[_0xf326('0x6')](_0x9445c6['id'],_0xf1c243,_0x1b5a56,_0x9445c6['dialOrderByScheduledAt'])[_0xf326('0x7')](function(_0x3851eb){_0x9445c6[_0xf326('0x8')]=0x0;logger[_0xf326('0x9')]('[getContactDialer]',inspectError(_0x3851eb));});}exports['getContactDialer']=getContactDialer;function getContactDialerIvr(_0x592975,_0x3bacf2){return cmHopper[_0xf326('0xa')](_0x592975['id'],_0x3bacf2,_0x592975[_0xf326('0xb')])[_0xf326('0x7')](function(_0x1f3a33){_0x592975['temp']=0x0;logger[_0xf326('0x9')]('[getContactDialerIvr]',inspectError(_0x1f3a33));});}exports[_0xf326('0xa')]=getContactDialerIvr;function countReScheduled(_0x4aaf3a){return cmHopper[_0xf326('0xc')](_0x4aaf3a)['catch'](function(_0x3162f9){logger[_0xf326('0x9')]('[countReScheduled]',inspectError(_0x3162f9));});}exports[_0xf326('0xc')]=countReScheduled;function rescheduleContact(_0x472632){return cmHopper[_0xf326('0xd')](_0x472632)[_0xf326('0x7')](function(_0x5c8483){logger[_0xf326('0x9')]('[rescheduleContact]',inspectError(_0x5c8483));});}exports['rescheduleContact']=rescheduleContact;function unlockContact(_0xdf21d9,_0x11f6d2,_0x1f2e5a){return cmHopper[_0xf326('0xe')](_0xdf21d9,_0x11f6d2,_0x1f2e5a)[_0xf326('0x7')](function(_0x287a2a){logger[_0xf326('0x9')](_0xf326('0xf'),inspectError(_0x287a2a));});}exports['unlockContact']=unlockContact;function moveContactManagedDialer(_0x3ad7da){return cmHopper[_0xf326('0x10')](_0x3ad7da)[_0xf326('0x7')](function(_0x31ffb9){logger[_0xf326('0x9')](_0xf326('0x11'),inspectError(_0x31ffb9));});}exports['moveContactManagedDialer']=moveContactManagedDialer;function checkIsBlackList(_0x4a5b6c){return cmHopperBlack['checkIsBlackList'](_0x4a5b6c)[_0xf326('0x7')](function(_0x289f4b){logger['error']('[checkIsBlackList]',inspectError(_0x289f4b));});}exports[_0xf326('0x12')]=checkIsBlackList;function checkIsBlackListIvr(_0x4dfa76){return cmHopperBlack['checkIsBlackListIvr'](_0x4dfa76)[_0xf326('0x7')](function(_0x18ead3){logger['error']('[checkIsBlackListIvr]',inspectError(_0x18ead3));});}exports[_0xf326('0x13')]=checkIsBlackListIvr;function verifyAdditionalPhones(_0xb1efcf,_0x5f21a2,_0x337ed5){return cmHopperAdditionalPhone[_0xf326('0x14')](_0xb1efcf,_0x5f21a2,_0x337ed5)[_0xf326('0x7')](function(_0x295752){logger[_0xf326('0x9')](_0xf326('0x15'),inspectError(_0x295752));});}exports['verifyAdditionalPhones']=verifyAdditionalPhones;function swapAdditionalPhones(_0x55b9f4,_0x4f31f6,_0x520d85){return cmHopperAdditionalPhone[_0xf326('0x16')](_0x55b9f4,_0x4f31f6,_0x520d85)[_0xf326('0x7')](function(_0x1ff2b5){logger[_0xf326('0x9')](_0xf326('0x17'),inspectError(_0x1ff2b5));});}exports['swapAdditionalPhones']=swapAdditionalPhones;function avgHandleTime(_0x201d28){return cmHopperHistory[_0xf326('0x18')](_0x201d28)[_0xf326('0x7')](function(_0x581531){logger[_0xf326('0x9')]('[avgHandleTime]',inspectError(_0x581531));});}exports['avgHandleTime']=avgHandleTime;function createHistory(_0x6a8e89){return cmHopperHistory[_0xf326('0x19')](_0x6a8e89)[_0xf326('0x7')](function(_0x5dbe63){logger[_0xf326('0x9')](_0xf326('0x1a'),inspectError(_0x5dbe63));});}exports['createHistory']=createHistory; \ No newline at end of file diff --git a/server/services/ami/dialer/utils/index.js b/server/services/ami/dialer/utils/index.js index 0aeb138..48f157c 100644 --- a/server/services/ami/dialer/utils/index.js +++ b/server/services/ami/dialer/utils/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0731=['available','loggedIn','loggedInDb','paused','talking','pTalking','waiting','inUse','originated','Trunk','name','active','isNil','dialGlobalInterval','Interval','Intervals','NULL_INTERVAL','isEmpty','EMPTY_INTERVAL','UNKNOWN_TIMEZONE','reachable','unmonitored','includes','status','TrunkBackup','INACTIVE','DISACTIVED','NO_AGENTS_LOGGED','UNREACHABLE_TRUNK','getQueueCampaignStatusMessage','getQueueCampaignActiveStatusMessage','match','extractCalleridName','isUndefined','string','format','\x22%s\x22\x20<%s>','getCallerId','\x5cw{0,','pow','replace','random','toString','getCallerIdRandom','error','length','checkContactEmpty','erlangb','checkContactLowerLimitOriginate','description','tags','updatedAt','undefined','%s%s','XMD-','toUpperCase','setXMDContactVariables','lodash','util','dialer','timezones','ACTIVE','BLACKLIST','RESCHEDULED_CONTACTS','DEACTIVATED','INTERVAL_IS_EMPTY','AGENTS_NOT_LOGGED','AVAILABLE_CONTACTS_FINISHED','INTERVAL_IS_NULL','INTERVAL_IS_OVERTIME','GLOBAL_INTERVAL_IS_OVERTIME','RECALLINQUEUE','RECALLFAILEDTIMEOUT','TIMEZONE_UNKNOW','TRUNK_IS_NOT_REACHABLE','CAMPAIGN_STATUS','dialMethod','preview','isPreviewCampaign','type','ivr','isIVRCampaign','outbound','dialActive','isQueueCampaignActive','isIVRCampaignActive','milliseconds','diff','seconds','getSeconds','message'];(function(_0x5932c7,_0x49c434){var _0xf5d6ef=function(_0x416f6b){while(--_0x416f6b){_0x5932c7['push'](_0x5932c7['shift']());}};_0xf5d6ef(++_0x49c434);}(_0x0731,0x14a));var _0x1073=function(_0x46a827,_0x8d79fe){_0x46a827=_0x46a827-0x0;var _0x396d8b=_0x0731[_0x46a827];return _0x396d8b;};'use strict';var _=require(_0x1073('0x0'));var moment=require('moment');var util=require(_0x1073('0x1'));var logger=require('../../../../config/logger')(_0x1073('0x2'));var timezones=require('../../../../config/environment/shared')[_0x1073('0x3')];var CAMPAIGN_STATUS={'ACTIVE':_0x1073('0x4'),'BLACKLIST':_0x1073('0x5'),'CONTACTS_RESCHEDULED':_0x1073('0x6'),'DEACTIVATED':_0x1073('0x7'),'DISACTIVED':'IS_DISACTIVED','EMPTY_INTERVAL':_0x1073('0x8'),'INACTIVE':'NOT_ACTIVE','NO_AGENTS_LOGGED':_0x1073('0x9'),'NO_AVAILABLE_CONTACTS':_0x1073('0xa'),'NULL_INTERVAL':_0x1073('0xb'),'OVERTIME_INTERVAL':_0x1073('0xc'),'OVERTIME_GLOBAL_INTERVAL':_0x1073('0xd'),'QUEUE_RECALL':_0x1073('0xe'),'RECALL_TIMEOUT':_0x1073('0xf'),'RUNNING':'RUNNING','UNKNOWN_TIMEZONE':_0x1073('0x10'),'UNREACHABLE_TRUNK':_0x1073('0x11')};exports[_0x1073('0x12')]=CAMPAIGN_STATUS;function isPreviewCampaign(_0x2f27f9){return _0x2f27f9[_0x1073('0x13')]===_0x1073('0x14');}exports[_0x1073('0x15')]=isPreviewCampaign;function isIVRCampaign(_0x392a0d){return _0x392a0d[_0x1073('0x16')]===_0x1073('0x17');}exports[_0x1073('0x18')]=isIVRCampaign;function isOutboundQueue(_0x1addf3){return _0x1addf3[_0x1073('0x16')]===_0x1073('0x19');}exports['isOutboundQueue']=isOutboundQueue;function isQueueCampaignActive(_0x1bed65){return _0x1bed65[_0x1073('0x1a')];}exports[_0x1073('0x1b')]=isQueueCampaignActive;function isIVRCampaignActive(_0x2a9240){return _0x2a9240['active'];}exports[_0x1073('0x1c')]=isIVRCampaignActive;function getSeconds(_0x3f1b3e,_0x38ab1c){var _0x481244=moment(_0x3f1b3e)[_0x1073('0x1d')](0x0);var _0x3edb6d=moment(_0x38ab1c)[_0x1073('0x1d')](0x0);return _0x481244[_0x1073('0x1e')](_0x3edb6d,_0x1073('0x1f'));}exports[_0x1073('0x20')]=getSeconds;function hasQueueCampaignDataChanged(_0x28fb21,_0x2571f5){var _0x482422=![];var _0x2cd2b1=_0x28fb21[_0x1073('0x13')]!==_0x2571f5[_0x1073('0x13')]||_0x28fb21[_0x1073('0x1a')]!==_0x2571f5[_0x1073('0x1a')]||_0x28fb21['message']!==_0x2571f5[_0x1073('0x21')];var _0x17765c=_0x28fb21['available']!==_0x2571f5[_0x1073('0x22')]||_0x28fb21['loggedIn']!==_0x2571f5[_0x1073('0x23')]||_0x28fb21[_0x1073('0x24')]!==_0x2571f5[_0x1073('0x24')]||_0x28fb21[_0x1073('0x25')]!==_0x2571f5[_0x1073('0x25')]||_0x28fb21['talking']!==_0x2571f5[_0x1073('0x26')]||_0x28fb21[_0x1073('0x27')]!==_0x2571f5[_0x1073('0x27')]||_0x28fb21[_0x1073('0x28')]!==_0x2571f5['waiting']||_0x28fb21[_0x1073('0x29')]!==_0x2571f5[_0x1073('0x29')]||_0x28fb21[_0x1073('0x2a')]!==_0x2571f5['originated'];if(_0x28fb21[_0x1073('0x2b')]&&_0x2571f5[_0x1073('0x2b')]){_0x482422=_0x28fb21[_0x1073('0x2b')][_0x1073('0x2c')]!==_0x2571f5['Trunk']['name']||_0x28fb21[_0x1073('0x2b')][_0x1073('0x2d')]!==_0x2571f5['Trunk'][_0x1073('0x2d')];}return _0x2cd2b1||_0x17765c||_0x482422;}exports['hasQueueCampaignDataChanged']=hasQueueCampaignDataChanged;function checkAnyValidQueueCampaignInterval(_0x4f9037){var _0xbba0ac=null;var _0x345fcd=_0x4f9037['dialTimezone'];if(_[_0x1073('0x2e')](_0x4f9037[_0x1073('0x2f')])||_[_0x1073('0x2e')](_0x4f9037[_0x1073('0x30')])||_['isNil'](_0x4f9037[_0x1073('0x30')][_0x1073('0x31')])){_0xbba0ac=CAMPAIGN_STATUS[_0x1073('0x32')];}else if(_['isEmpty'](_0x4f9037['dialGlobalInterval'])||_[_0x1073('0x33')](_0x4f9037[_0x1073('0x30')][_0x1073('0x31')])){_0xbba0ac=CAMPAIGN_STATUS[_0x1073('0x34')];}else if(_0x345fcd&&!timezones[_0x345fcd]){_0xbba0ac=CAMPAIGN_STATUS[_0x1073('0x35')];}return _0xbba0ac;}function checkAnyValidTrunk(_0x2e9edc,_0x3579a4){var _0xc99353=null;var _0x2b59d2='SIP/';var _0x4437d1=[_0x1073('0x36'),_0x1073('0x37')];var _0x572270=!![];if(_0x2e9edc[_0x1073('0x2b')]&&_0x2e9edc['Trunk'][_0x1073('0x2d')]){_0x2b59d2+=_0x2e9edc[_0x1073('0x2b')][_0x1073('0x2c')];_0xc99353=_0x3579a4[_0x2b59d2];_0x572270=_0x4437d1[_0x1073('0x38')](_0xc99353[_0x1073('0x39')]);}else if(_0x2e9edc[_0x1073('0x3a')]&&_0x2e9edc[_0x1073('0x3a')][_0x1073('0x2d')]){_0x2b59d2+=_0x2e9edc[_0x1073('0x3a')][_0x1073('0x2c')];_0xc99353=_0x3579a4[_0x2b59d2];_0x572270=_0x4437d1[_0x1073('0x38')](_0xc99353['status']);}return _0x572270;}function getQueueCampaignStatusMessage(_0x5a103f,_0x3aa3f4){var _0x1d3d97=CAMPAIGN_STATUS[_0x1073('0x4')];var _0x2411d7=isPreviewCampaign(_0x5a103f);if(!isQueueCampaignActive(_0x5a103f)){if(_0x2411d7){_0x1d3d97=CAMPAIGN_STATUS[_0x1073('0x3b')];}else{if(_0x5a103f[_0x1073('0x2a')]===0x0&&_0x5a103f[_0x1073('0x26')]===0x0&&_0x5a103f[_0x1073('0x28')]===0x0&&(_0x5a103f[_0x1073('0x27')]||0x0)===0x0){_0x1d3d97=CAMPAIGN_STATUS['INACTIVE'];}else{_0x1d3d97=CAMPAIGN_STATUS[_0x1073('0x3c')];}}}else if(_0x5a103f['loggedIn']===0x0){_0x1d3d97=CAMPAIGN_STATUS[_0x1073('0x3d')];}else if(!checkAnyValidTrunk(_0x5a103f,_0x3aa3f4)){_0x1d3d97=CAMPAIGN_STATUS[_0x1073('0x3e')];}else if(!isPreviewCampaign(_0x5a103f)){var _0x3c3e60=checkAnyValidQueueCampaignInterval(_0x5a103f);if(_0x3c3e60){_0x1d3d97=_0x3c3e60;}}return _0x1d3d97;}exports[_0x1073('0x3f')]=getQueueCampaignStatusMessage;function getQueueCampaignActiveStatusMessage(_0x500188){var _0x32b993=CAMPAIGN_STATUS['DISACTIVED'];if(_0x500188['originated']===0x0&&_0x500188[_0x1073('0x26')]===0x0&&_0x500188[_0x1073('0x28')]===0x0&&(_0x500188[_0x1073('0x27')]||0x0)===0x0){_0x32b993=CAMPAIGN_STATUS['INACTIVE'];}return _0x32b993;}exports[_0x1073('0x40')]=getQueueCampaignActiveStatusMessage;function extractCalleridName(_0x413f8f){var _0x385adb=_0x413f8f[_0x1073('0x41')](/"(.*?)"/);return _0x385adb?_0x385adb[0x1]:_0x413f8f;}exports[_0x1073('0x42')]=extractCalleridName;function getCallerId(_0x402ebd,_0x35ab16,_0x3f6a15){if(!_[_0x1073('0x43')](_0x3f6a15)&&typeof _0x3f6a15===_0x1073('0x44')&&!_[_0x1073('0x33')](_0x3f6a15)){if(!_[_0x1073('0x43')](_0x35ab16)&&typeof _0x35ab16===_0x1073('0x44')&&!_[_0x1073('0x33')](_0x35ab16)){return util[_0x1073('0x45')](_0x1073('0x46'),_0x35ab16,_0x3f6a15);}return util[_0x1073('0x45')](_0x1073('0x46'),_0x3f6a15,_0x3f6a15);}if(!_[_0x1073('0x43')](_0x402ebd)&&typeof _0x402ebd===_0x1073('0x44')&&!_[_0x1073('0x33')](_0x402ebd)){return _0x402ebd;}return'\x22\x22\x20<>';}exports[_0x1073('0x47')]=getCallerId;function getCallerIdRandom(_0x47215a,_0x36c526){var _0x277589;var _0x16c7be;var _0x5ab8a7;if(_0x36c526<=0x0){_0x36c526=0x1;}_0x277589=new RegExp(_0x1073('0x48')+_0x36c526+'}$');_0x16c7be=Math['pow'](0xa,_0x36c526-0x1);_0x5ab8a7=Math[_0x1073('0x49')](0xa,_0x36c526)-0x1;return util[_0x1073('0x45')]('%s',_[_0x1073('0x4a')](_0x47215a,_0x277589,_[_0x1073('0x4b')](_0x16c7be,_0x5ab8a7)[_0x1073('0x4c')]()));}exports[_0x1073('0x4d')]=getCallerIdRandom;function decrementOriginate(_0x318099){if(_0x318099['originated']&&_0x318099[_0x1073('0x2a')]>0x0){_0x318099[_0x1073('0x2a')]-=0x1;}else{logger[_0x1073('0x4e')]('[decrementOriginate]\x20queue\x20originate\x20value\x20is\x20negative');}}exports['decrementOriginate']=decrementOriginate;function checkContactEmpty(_0x574fb0){return _0x574fb0&&_0x574fb0[_0x1073('0x4f')]>0x0;}exports[_0x1073('0x50')]=checkContactEmpty;function erlangb(_0x20f627,_0x7a0a17){if(_0x7a0a17===0x0){return 0x0;}var _0x3362d1=0x1;for(var _0x665013=0x1;_0x665013<=_0x7a0a17;_0x665013+=0x1){_0x3362d1=0x1+_0x3362d1*_0x665013/_0x20f627;}return 0x1/_0x3362d1;}exports[_0x1073('0x51')]=erlangb;function checkContactLowerLimitOriginate(_0x154f39,_0x44d120,_0x3a5920){if(_0x44d120>_0x3a5920){for(var _0x2fb235=0x0;_0x2fb235<_0x44d120-_0x3a5920;_0x2fb235+=0x1){decrementOriginate(_0x154f39);}}}exports[_0x1073('0x52')]=checkContactLowerLimitOriginate;function setXMDContactVariables(_0x444571){var _0x3e9cfe={};var _0x54c36a=['id','createdAt',_0x1073('0x53'),_0x1073('0x54'),_0x1073('0x55')];if(_0x444571){for(var _0x851ff7 in _0x444571){if(typeof _0x444571[_0x851ff7]!==_0x1073('0x56')){if(!_[_0x1073('0x2e')](_0x444571[_0x851ff7])&&!_0x54c36a[_0x1073('0x38')](_0x851ff7)){_0x3e9cfe[util[_0x1073('0x45')](_0x1073('0x57'),_0x1073('0x58'),_0x851ff7[_0x1073('0x59')]())]=_0x444571[_0x851ff7];}}}}return _0x3e9cfe;}exports[_0x1073('0x5a')]=setXMDContactVariables; \ No newline at end of file +var _0x3491=['status','TrunkBackup','INACTIVE','NO_AGENTS_LOGGED','UNREACHABLE_TRUNK','getQueueCampaignStatusMessage','DISACTIVED','getQueueCampaignActiveStatusMessage','match','extractCalleridName','isUndefined','string','format','\x22%s\x22\x20<%s>','\x22\x22\x20<>','\x5cw{0,','pow','random','getCallerIdRandom','error','[decrementOriginate]\x20queue\x20originate\x20value\x20is\x20negative','decrementOriginate','length','checkContactEmpty','erlangb','checkContactLowerLimitOriginate','createdAt','tags','updatedAt','undefined','%s%s','XMD-','toUpperCase','setXMDContactVariables','lodash','util','dialer','../../../../config/environment/shared','timezones','ACTIVE','BLACKLIST','IS_DISACTIVED','INTERVAL_IS_EMPTY','AVAILABLE_CONTACTS_FINISHED','INTERVAL_IS_OVERTIME','RECALLINQUEUE','RECALLFAILEDTIMEOUT','RUNNING','TIMEZONE_UNKNOW','TRUNK_IS_NOT_REACHABLE','CAMPAIGN_STATUS','dialMethod','isPreviewCampaign','type','ivr','isIVRCampaign','outbound','isOutboundQueue','dialActive','isQueueCampaignActive','active','isIVRCampaignActive','milliseconds','diff','seconds','getSeconds','message','available','loggedIn','loggedInDb','paused','talking','pTalking','waiting','inUse','originated','Trunk','name','hasQueueCampaignDataChanged','isNil','dialGlobalInterval','Intervals','NULL_INTERVAL','isEmpty','EMPTY_INTERVAL','UNKNOWN_TIMEZONE','SIP/','unmonitored','includes'];(function(_0x2ff622,_0x21c8f8){var _0x4d5317=function(_0x5651fe){while(--_0x5651fe){_0x2ff622['push'](_0x2ff622['shift']());}};_0x4d5317(++_0x21c8f8);}(_0x3491,0x7b));var _0x1349=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x3491[_0x2c91e9];return _0x13f0ff;};'use strict';var _=require(_0x1349('0x0'));var moment=require('moment');var util=require(_0x1349('0x1'));var logger=require('../../../../config/logger')(_0x1349('0x2'));var timezones=require(_0x1349('0x3'))[_0x1349('0x4')];var CAMPAIGN_STATUS={'ACTIVE':_0x1349('0x5'),'BLACKLIST':_0x1349('0x6'),'CONTACTS_RESCHEDULED':'RESCHEDULED_CONTACTS','DEACTIVATED':'DEACTIVATED','DISACTIVED':_0x1349('0x7'),'EMPTY_INTERVAL':_0x1349('0x8'),'INACTIVE':'NOT_ACTIVE','NO_AGENTS_LOGGED':'AGENTS_NOT_LOGGED','NO_AVAILABLE_CONTACTS':_0x1349('0x9'),'NULL_INTERVAL':'INTERVAL_IS_NULL','OVERTIME_INTERVAL':_0x1349('0xa'),'OVERTIME_GLOBAL_INTERVAL':'GLOBAL_INTERVAL_IS_OVERTIME','QUEUE_RECALL':_0x1349('0xb'),'RECALL_TIMEOUT':_0x1349('0xc'),'RUNNING':_0x1349('0xd'),'UNKNOWN_TIMEZONE':_0x1349('0xe'),'UNREACHABLE_TRUNK':_0x1349('0xf')};exports[_0x1349('0x10')]=CAMPAIGN_STATUS;function isPreviewCampaign(_0x264e39){return _0x264e39[_0x1349('0x11')]==='preview';}exports[_0x1349('0x12')]=isPreviewCampaign;function isIVRCampaign(_0x43646f){return _0x43646f[_0x1349('0x13')]===_0x1349('0x14');}exports[_0x1349('0x15')]=isIVRCampaign;function isOutboundQueue(_0x5a39c2){return _0x5a39c2['type']===_0x1349('0x16');}exports[_0x1349('0x17')]=isOutboundQueue;function isQueueCampaignActive(_0x5dcba8){return _0x5dcba8[_0x1349('0x18')];}exports[_0x1349('0x19')]=isQueueCampaignActive;function isIVRCampaignActive(_0x520d2f){return _0x520d2f[_0x1349('0x1a')];}exports[_0x1349('0x1b')]=isIVRCampaignActive;function getSeconds(_0x3a1fb4,_0x5bd78d){var _0x34b85d=moment(_0x3a1fb4)[_0x1349('0x1c')](0x0);var _0x13dce=moment(_0x5bd78d)[_0x1349('0x1c')](0x0);return _0x34b85d[_0x1349('0x1d')](_0x13dce,_0x1349('0x1e'));}exports[_0x1349('0x1f')]=getSeconds;function hasQueueCampaignDataChanged(_0x1106cb,_0x5a3219){var _0x44693f=![];var _0x1e8937=_0x1106cb[_0x1349('0x11')]!==_0x5a3219['dialMethod']||_0x1106cb['dialActive']!==_0x5a3219[_0x1349('0x18')]||_0x1106cb['message']!==_0x5a3219[_0x1349('0x20')];var _0x13c9e2=_0x1106cb[_0x1349('0x21')]!==_0x5a3219[_0x1349('0x21')]||_0x1106cb['loggedIn']!==_0x5a3219[_0x1349('0x22')]||_0x1106cb['loggedInDb']!==_0x5a3219[_0x1349('0x23')]||_0x1106cb[_0x1349('0x24')]!==_0x5a3219[_0x1349('0x24')]||_0x1106cb['talking']!==_0x5a3219[_0x1349('0x25')]||_0x1106cb[_0x1349('0x26')]!==_0x5a3219[_0x1349('0x26')]||_0x1106cb[_0x1349('0x27')]!==_0x5a3219[_0x1349('0x27')]||_0x1106cb['inUse']!==_0x5a3219[_0x1349('0x28')]||_0x1106cb[_0x1349('0x29')]!==_0x5a3219['originated'];if(_0x1106cb[_0x1349('0x2a')]&&_0x5a3219['Trunk']){_0x44693f=_0x1106cb[_0x1349('0x2a')][_0x1349('0x2b')]!==_0x5a3219[_0x1349('0x2a')][_0x1349('0x2b')]||_0x1106cb['Trunk']['active']!==_0x5a3219[_0x1349('0x2a')][_0x1349('0x1a')];}return _0x1e8937||_0x13c9e2||_0x44693f;}exports[_0x1349('0x2c')]=hasQueueCampaignDataChanged;function checkAnyValidQueueCampaignInterval(_0x2bedb3){var _0x527450=null;var _0x588d6=_0x2bedb3['dialTimezone'];if(_[_0x1349('0x2d')](_0x2bedb3[_0x1349('0x2e')])||_[_0x1349('0x2d')](_0x2bedb3['Interval'])||_[_0x1349('0x2d')](_0x2bedb3['Interval'][_0x1349('0x2f')])){_0x527450=CAMPAIGN_STATUS[_0x1349('0x30')];}else if(_[_0x1349('0x31')](_0x2bedb3['dialGlobalInterval'])||_[_0x1349('0x31')](_0x2bedb3['Interval'][_0x1349('0x2f')])){_0x527450=CAMPAIGN_STATUS[_0x1349('0x32')];}else if(_0x588d6&&!timezones[_0x588d6]){_0x527450=CAMPAIGN_STATUS[_0x1349('0x33')];}return _0x527450;}function checkAnyValidTrunk(_0x4b599e,_0x2244de){var _0x32af92=null;var _0x2a4cf9=_0x1349('0x34');var _0x14cdce=['reachable',_0x1349('0x35')];var _0x1a003e=!![];if(_0x4b599e[_0x1349('0x2a')]&&_0x4b599e['Trunk'][_0x1349('0x1a')]){_0x2a4cf9+=_0x4b599e[_0x1349('0x2a')]['name'];_0x32af92=_0x2244de[_0x2a4cf9];_0x1a003e=_0x14cdce[_0x1349('0x36')](_0x32af92[_0x1349('0x37')]);}else if(_0x4b599e[_0x1349('0x38')]&&_0x4b599e[_0x1349('0x38')][_0x1349('0x1a')]){_0x2a4cf9+=_0x4b599e[_0x1349('0x38')][_0x1349('0x2b')];_0x32af92=_0x2244de[_0x2a4cf9];_0x1a003e=_0x14cdce[_0x1349('0x36')](_0x32af92[_0x1349('0x37')]);}return _0x1a003e;}function getQueueCampaignStatusMessage(_0x151765,_0x416894){var _0x3d8e50=CAMPAIGN_STATUS[_0x1349('0x5')];var _0x24fac6=isPreviewCampaign(_0x151765);if(!isQueueCampaignActive(_0x151765)){if(_0x24fac6){_0x3d8e50=CAMPAIGN_STATUS[_0x1349('0x39')];}else{if(_0x151765[_0x1349('0x29')]===0x0&&_0x151765[_0x1349('0x25')]===0x0&&_0x151765[_0x1349('0x27')]===0x0&&(_0x151765[_0x1349('0x26')]||0x0)===0x0){_0x3d8e50=CAMPAIGN_STATUS['INACTIVE'];}else{_0x3d8e50=CAMPAIGN_STATUS['DISACTIVED'];}}}else if(_0x151765[_0x1349('0x22')]===0x0){_0x3d8e50=CAMPAIGN_STATUS[_0x1349('0x3a')];}else if(!checkAnyValidTrunk(_0x151765,_0x416894)){_0x3d8e50=CAMPAIGN_STATUS[_0x1349('0x3b')];}else if(!isPreviewCampaign(_0x151765)){var _0x44a9ab=checkAnyValidQueueCampaignInterval(_0x151765);if(_0x44a9ab){_0x3d8e50=_0x44a9ab;}}return _0x3d8e50;}exports[_0x1349('0x3c')]=getQueueCampaignStatusMessage;function getQueueCampaignActiveStatusMessage(_0x17dbf1){var _0x38697e=CAMPAIGN_STATUS[_0x1349('0x3d')];if(_0x17dbf1['originated']===0x0&&_0x17dbf1[_0x1349('0x25')]===0x0&&_0x17dbf1[_0x1349('0x27')]===0x0&&(_0x17dbf1[_0x1349('0x26')]||0x0)===0x0){_0x38697e=CAMPAIGN_STATUS['INACTIVE'];}return _0x38697e;}exports[_0x1349('0x3e')]=getQueueCampaignActiveStatusMessage;function extractCalleridName(_0x22d23a){var _0x23aab8=_0x22d23a[_0x1349('0x3f')](/"(.*?)"/);return _0x23aab8?_0x23aab8[0x1]:_0x22d23a;}exports[_0x1349('0x40')]=extractCalleridName;function getCallerId(_0x21d8f0,_0x5a0f77,_0x854286){if(!_[_0x1349('0x41')](_0x854286)&&typeof _0x854286===_0x1349('0x42')&&!_[_0x1349('0x31')](_0x854286)){if(!_[_0x1349('0x41')](_0x5a0f77)&&typeof _0x5a0f77==='string'&&!_[_0x1349('0x31')](_0x5a0f77)){return util[_0x1349('0x43')]('\x22%s\x22\x20<%s>',_0x5a0f77,_0x854286);}return util['format'](_0x1349('0x44'),_0x854286,_0x854286);}if(!_[_0x1349('0x41')](_0x21d8f0)&&typeof _0x21d8f0==='string'&&!_[_0x1349('0x31')](_0x21d8f0)){return _0x21d8f0;}return _0x1349('0x45');}exports['getCallerId']=getCallerId;function getCallerIdRandom(_0x5f305c,_0x279ba8){var _0x399260;var _0x3ff97c;var _0x3b0aaf;if(_0x279ba8<=0x0){_0x279ba8=0x1;}_0x399260=new RegExp(_0x1349('0x46')+_0x279ba8+'}$');_0x3ff97c=Math[_0x1349('0x47')](0xa,_0x279ba8-0x1);_0x3b0aaf=Math['pow'](0xa,_0x279ba8)-0x1;return util[_0x1349('0x43')]('%s',_['replace'](_0x5f305c,_0x399260,_[_0x1349('0x48')](_0x3ff97c,_0x3b0aaf)['toString']()));}exports[_0x1349('0x49')]=getCallerIdRandom;function decrementOriginate(_0x35a372){if(_0x35a372[_0x1349('0x29')]&&_0x35a372[_0x1349('0x29')]>0x0){_0x35a372[_0x1349('0x29')]-=0x1;}else{logger[_0x1349('0x4a')](_0x1349('0x4b'));}}exports[_0x1349('0x4c')]=decrementOriginate;function checkContactEmpty(_0x99428){return _0x99428&&_0x99428[_0x1349('0x4d')]>0x0;}exports[_0x1349('0x4e')]=checkContactEmpty;function erlangb(_0x46fdf7,_0x242e97){if(_0x242e97===0x0){return 0x0;}var _0x187ebb=0x1;for(var _0x2a5e86=0x1;_0x2a5e86<=_0x242e97;_0x2a5e86+=0x1){_0x187ebb=0x1+_0x187ebb*_0x2a5e86/_0x46fdf7;}return 0x1/_0x187ebb;}exports[_0x1349('0x4f')]=erlangb;function checkContactLowerLimitOriginate(_0x344c67,_0x1b0674,_0x42f3c1){if(_0x1b0674>_0x42f3c1){for(var _0x22aece=0x0;_0x22aece<_0x1b0674-_0x42f3c1;_0x22aece+=0x1){decrementOriginate(_0x344c67);}}}exports[_0x1349('0x50')]=checkContactLowerLimitOriginate;function setXMDContactVariables(_0xde6620){var _0x5ee18a={};var _0x5d1508=['id',_0x1349('0x51'),'description',_0x1349('0x52'),_0x1349('0x53')];if(_0xde6620){for(var _0x184252 in _0xde6620){if(typeof _0xde6620[_0x184252]!==_0x1349('0x54')){if(!_['isNil'](_0xde6620[_0x184252])&&!_0x5d1508[_0x1349('0x36')](_0x184252)){_0x5ee18a[util['format'](_0x1349('0x55'),_0x1349('0x56'),_0x184252[_0x1349('0x57')]())]=_0xde6620[_0x184252];}}}}return _0x5ee18a;}exports[_0x1349('0x58')]=setXMDContactVariables; \ No newline at end of file diff --git a/server/services/ami/fax/action.js b/server/services/ami/fax/action.js index ca40e2c..6016143 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(_0x36a98f,_0x40e71b){var _0xf5f0e1=function(_0x4dbb3b){while(--_0x4dbb3b){_0x36a98f['push'](_0x36a98f['shift']());}};_0xf5f0e1(++_0x40e71b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2160a9,_0x3cbd9e){_0x2160a9=_0x2160a9-0x0;var _0xa88cf7=_0xa9e0[_0x2160a9];return _0xa88cf7;};'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(_0x17bbe5,_0x2784bb){var _0x453863=function(_0x49f5e3){while(--_0x49f5e3){_0x17bbe5['push'](_0x17bbe5['shift']());}};_0x453863(++_0x2784bb);}(_0xa9e0,0x123));var _0x0a9e=function(_0x45e98e,_0x169b60){_0x45e98e=_0x45e98e-0x0;var _0x374dba=_0xa9e0[_0x45e98e];return _0x374dba;};'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 8b0cd2e..8d54858 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 _0x075e=['name','info','\x20syncNewchannel\x20','prototype','value','channelstate','channelstatedesc','variable','status','filename','\x20syncFaxStatus\x20','remotestationid','pagestransferred','resolution','transferrate','calleridnum','\x20result\x20conversion\x20file\x20','message','parse','.pdf','then','notify','catch','\x20notify\x20','stringify','\x20receiveFax\x20','merge','response','reason','AttachmentId','update','SENDING\x20FAILED\x20','logger','[Fax][Message][Error][Updated]','[Fax][Message][Error][NoUpdate2]','updateStatus','[Fax][Message][Updated]','[Fax][Message][NoUpdate1]','finally','[Fax][Message][NoUpdate2]','faxpages','faxstatusstring','SENDING\x20FAILED','send','execOriginate','FaxAccountId','Fax\x20received','[Fax][execOriginate][failure]','Fax\x20failed','checkAfterSend','checkTrunk','Trunk','isValid','format','gs\x20-q\x20-dNOPAUSE\x20-dBATCH\x20-sDEVICE=tiffg4\x20-sPAPERSIZE=letter\x20-sOutputFile=/var/opt/motion2/server/files/attachments/%s.tif\x20\x20%s\x20-c\x20quit','execute','%s/%s.tif','dir','Convert\x20pdf\x20to\x20tif','Action','variablesAction','addVariables','ext','isTrunkReachable','isNil','active','SIP/%s','reachable','unmonitored','[Fax][checkTrunk][Trunk\x20not\x20working\x20correctly]','\x20Trunk\x20is\x20not\x20active','Trunk\x20not\x20working\x20correctly','[Fax][checkTrunk][Empty\x20Fax]','Empty\x20Fax','[Fax][checkTrunk][Empty\x20path]','Empty\x20path','Is\x20Valid','exports','bluebird','uuid','path','tiff2pdf','./util/gs','fax','../ami','./rpcDb','./channel','./util/util','./action','../rpc/faxAccount','../rpc/attachment','channels','faxAccounts','trunks','actions','syncNewchannel','varset','syncVarSet','syncNewState','bind','newexten','faxstatus','syncFaxStatus','receivefax','syncReceiveFax','hangup','syncHangup','syncOriginateResponse','context','from-voip-provider','exten','localstationid','uniqueid','channel'];(function(_0x37ffea,_0x25b006){var _0x2e2615=function(_0x5e6c74){while(--_0x5e6c74){_0x37ffea['push'](_0x37ffea['shift']());}};_0x2e2615(++_0x25b006);}(_0x075e,0x1a4));var _0xe075=function(_0x267e68,_0x47d360){_0x267e68=_0x267e68-0x0;var _0x436784=_0x075e[_0x267e68];return _0x436784;};'use strict';var util=require('util');var _=require('lodash');var BPromise=require(_0xe075('0x0'));var uuid=require(_0xe075('0x1'));var moment=require('moment');var path=require(_0xe075('0x2'));var tiff2pdf=require(_0xe075('0x3'));var gs=require(_0xe075('0x4'));var logger=require('../../../config/logger')(_0xe075('0x5'));var ami=require(_0xe075('0x6'));var rpcDb=require(_0xe075('0x7'));var Channel=require(_0xe075('0x8'));var ut=require(_0xe075('0x9'));var Action=require(_0xe075('0xa'));var faxAccount=require(_0xe075('0xb'));var attachment=require(_0xe075('0xc'));var faxMessage=require('../rpc/faxMessage');function Fax(_0x5f2635){this[_0xe075('0xd')]={};this['faxAccounts']=_0x5f2635[_0xe075('0xe')];this[_0xe075('0xf')]=_0x5f2635['trunks'];this[_0xe075('0x10')]={};ami['on']('newchannel',this[_0xe075('0x11')]['bind'](this));ami['on'](_0xe075('0x12'),this[_0xe075('0x13')]['bind'](this));ami['on']('newstate',this[_0xe075('0x14')][_0xe075('0x15')](this));ami['on'](_0xe075('0x16'),this['syncNewExten'][_0xe075('0x15')](this));ami['on'](_0xe075('0x17'),this[_0xe075('0x18')][_0xe075('0x15')](this));ami['on'](_0xe075('0x19'),this[_0xe075('0x1a')][_0xe075('0x15')](this));ami['on'](_0xe075('0x1b'),this[_0xe075('0x1c')][_0xe075('0x15')](this));ami['on']('originateresponse',this[_0xe075('0x1d')][_0xe075('0x15')](this));}Fax['prototype'][_0xe075('0x11')]=function(_0x57081a){if(_0x57081a[_0xe075('0x1e')]===_0xe075('0x1f')){for(var _0x5151bc in this[_0xe075('0xe')]){if(this[_0xe075('0xe')]['hasOwnProperty'](_0x5151bc)){if(_0x57081a[_0xe075('0x20')]===this[_0xe075('0xe')][_0x5151bc][_0xe075('0x21')]){this[_0xe075('0xd')][_0x57081a[_0xe075('0x22')]]={};this[_0xe075('0xd')][_0x57081a[_0xe075('0x22')]][_0xe075('0x23')]=_0x57081a[_0xe075('0x23')];this[_0xe075('0xd')][_0x57081a[_0xe075('0x22')]]['id']=this[_0xe075('0xe')][_0x5151bc]['id'];this['channels'][_0x57081a[_0xe075('0x22')]][_0xe075('0x24')]=this['faxAccounts'][_0x5151bc]['name'];logger[_0xe075('0x25')](_0x57081a[_0xe075('0x22')],_0xe075('0x26'));}}}}if(this[_0xe075('0x10')][_0x57081a['uniqueid']]){this[_0xe075('0xd')][_0x57081a[_0xe075('0x22')]]={};this[_0xe075('0xd')][_0x57081a[_0xe075('0x22')]]['channel']=_0x57081a[_0xe075('0x23')];logger['info'](_0x57081a[_0xe075('0x22')],_0xe075('0x26'));}};Fax[_0xe075('0x27')][_0xe075('0x13')]=function(_0x1116ee){if(this[_0xe075('0xd')][_0x1116ee[_0xe075('0x22')]]){for(var _0x43f663 in _0x1116ee['variable']){if(_0x1116ee['variable']['hasOwnProperty'](_0x43f663)){this[_0xe075('0xd')][_0x1116ee['uniqueid']][_0x43f663]=_0x1116ee[_0xe075('0x28')];}}}};Fax[_0xe075('0x27')]['syncNewState']=function(_0x4a8dfd){if(this[_0xe075('0xd')][_0x4a8dfd[_0xe075('0x22')]]){this['channels'][_0x4a8dfd[_0xe075('0x22')]][_0xe075('0x29')]=_0x4a8dfd[_0xe075('0x29')];this[_0xe075('0xd')][_0x4a8dfd[_0xe075('0x22')]][_0xe075('0x2a')]=_0x4a8dfd['channelstatedesc'];}};Fax[_0xe075('0x27')]['syncNewExten']=function(_0x5dedfa){if(this['channels'][_0x5dedfa[_0xe075('0x22')]]){for(var _0x1fe825 in _0x5dedfa[_0xe075('0x2b')]){if(_0x5dedfa[_0xe075('0x2b')]['hasOwnProperty'](_0x1fe825)){this[_0xe075('0xd')][_0x5dedfa[_0xe075('0x22')]][_0x1fe825]=_0x5dedfa['value'];}}}};Fax['prototype'][_0xe075('0x18')]=function(_0x1723db){if(this['channels'][_0x1723db[_0xe075('0x22')]]){this['channels'][_0x1723db[_0xe075('0x22')]]['operation']=_0x1723db['operation'];this['channels'][_0x1723db[_0xe075('0x22')]][_0xe075('0x2c')]=_0x1723db[_0xe075('0x2c')];this['channels'][_0x1723db[_0xe075('0x22')]][_0xe075('0x21')]=_0x1723db[_0xe075('0x21')];this[_0xe075('0xd')][_0x1723db[_0xe075('0x22')]][_0xe075('0x2d')]=_0x1723db[_0xe075('0x2d')];logger[_0xe075('0x25')](_0x1723db[_0xe075('0x22')],_0xe075('0x2e'));}};Fax['prototype'][_0xe075('0x1a')]=function(_0x40c8a2){var _0x57d8eb=this;if(this[_0xe075('0xd')][_0x40c8a2[_0xe075('0x22')]]){var _0x3809b2=this[_0xe075('0xd')][_0x40c8a2[_0xe075('0x22')]]['id'];this['channels'][_0x40c8a2['uniqueid']][_0xe075('0x2f')]=_0x40c8a2['remotestationid'];this[_0xe075('0xd')][_0x40c8a2[_0xe075('0x22')]][_0xe075('0x30')]=_0x40c8a2[_0xe075('0x30')];this[_0xe075('0xd')][_0x40c8a2[_0xe075('0x22')]]['localstationid']=_0x40c8a2[_0xe075('0x21')];this[_0xe075('0xd')][_0x40c8a2[_0xe075('0x22')]][_0xe075('0x31')]=_0x40c8a2['resolution'];this[_0xe075('0xd')][_0x40c8a2[_0xe075('0x22')]][_0xe075('0x32')]=_0x40c8a2[_0xe075('0x32')];this[_0xe075('0xd')][_0x40c8a2[_0xe075('0x22')]]['filename']=_0x40c8a2[_0xe075('0x2d')];this['channels'][_0x40c8a2[_0xe075('0x22')]]['calleridnum']=_0x40c8a2[_0xe075('0x33')];if(this[_0xe075('0xd')][_0x40c8a2[_0xe075('0x22')]]['pagestransferred']>0x0){tiff2pdf(_0x40c8a2['filename'],'/var/opt/motion2/server/files/attachments/',function(_0x460d99){logger[_0xe075('0x25')](_0x40c8a2[_0xe075('0x22')],_0xe075('0x34'),_0x460d99[_0xe075('0x35')]);attachment['create']({'name':path[_0xe075('0x36')](_0x40c8a2[_0xe075('0x2d')])['name'],'basename':path[_0xe075('0x36')](_0x40c8a2['filename'])['name']+_0xe075('0x37'),'type':'application/pdf'})[_0xe075('0x38')](function(_0x59cdb6){faxAccount[_0xe075('0x39')](_0x3809b2,{'from':_0x40c8a2['calleridnum'],'mapKey':_0xe075('0x5'),'body':path[_0xe075('0x36')](_0x40c8a2[_0xe075('0x2d')])[_0xe075('0x24')]+_0xe075('0x37'),'AttachmentId':_0x59cdb6['id']})[_0xe075('0x3a')](function(_0x3e6f50){logger['error'](_0x40c8a2[_0xe075('0x22')],_0xe075('0x3b'),JSON[_0xe075('0x3c')](_0x3e6f50));});})['catch'](function(_0x2ba6f7){logger['error'](_0x40c8a2['uniqueid'],_0xe075('0x3d'),JSON['stringify'](_0x2ba6f7));});});}logger[_0xe075('0x25')](_0x40c8a2[_0xe075('0x22')],_0xe075('0x3d'));}};Fax['prototype'][_0xe075('0x1d')]=function(_0x3b5f87){if(this[_0xe075('0x10')][_0x3b5f87['uniqueid']]){_[_0xe075('0x3e')](this[_0xe075('0xd')][_0x3b5f87[_0xe075('0x22')]],_['pick'](_0x3b5f87,[_0xe075('0x3f'),_0xe075('0x40')]));}};function updateStatus(_0x281f27){if(_0x281f27[_0xe075('0x41')]){faxMessage[_0xe075('0x42')](_0x281f27[_0xe075('0x41')],{'failMessage':_0xe075('0x43')})[_0xe075('0x38')](function(_0x1d0235){ut[_0xe075('0x44')](_0xe075('0x45'),_0x1d0235);})[_0xe075('0x3a')](function(_0x2eddac){ut[_0xe075('0x44')]('[Fax][Message][Error][NoUpdate1]',_0x2eddac);});}else{ut[_0xe075('0x44')](_0xe075('0x46'));}}Fax[_0xe075('0x27')][_0xe075('0x47')]=function(_0x32b69f,_0x5ca797,_0x435ac0){var _0x33480e=this;var _0x467078={};if(_0x5ca797){_0x467078={'read':_0x5ca797};}else{_0x467078={'failMessage':_0x435ac0};}if(this['actions'][_0x32b69f][_0xe075('0x41')]){faxMessage['update'](this[_0xe075('0x10')][_0x32b69f]['AttachmentId'],_0x467078)[_0xe075('0x38')](function(_0x24a1b8){ut[_0xe075('0x44')](_0xe075('0x48'),_0x24a1b8);})[_0xe075('0x3a')](function(_0x31cd5b){ut[_0xe075('0x44')](_0xe075('0x49'),_0x31cd5b);})[_0xe075('0x4a')](function(){delete _0x33480e[_0xe075('0xd')][_0x32b69f];delete _0x33480e['actions'][_0x32b69f];});}else{ut['logger'](_0xe075('0x4b'));delete this[_0xe075('0xd')][_0x32b69f];delete this[_0xe075('0x10')][_0x32b69f];}};Fax[_0xe075('0x27')]['syncHangup']=function(_0x1c22a3){var _0x41242d=this;if(this[_0xe075('0xd')][_0x1c22a3[_0xe075('0x22')]]){if(this[_0xe075('0x10')][_0x1c22a3[_0xe075('0x22')]]){this['channels'][_0x1c22a3[_0xe075('0x22')]]['id']=this[_0xe075('0x10')][_0x1c22a3[_0xe075('0x22')]]['id'];this[_0xe075('0xd')][_0x1c22a3[_0xe075('0x22')]][_0xe075('0x24')]=this['actions'][_0x1c22a3[_0xe075('0x22')]][_0xe075('0x24')];}logger[_0xe075('0x25')](_0x1c22a3[_0xe075('0x22')],this['actions'][_0x1c22a3[_0xe075('0x22')]]?'\x20hangup\x20sendFile\x20':'\x20hangup\x20faxRiceive\x20',JSON[_0xe075('0x3c')](this['channels'][_0x1c22a3[_0xe075('0x22')]]));if(this['actions'][_0x1c22a3[_0xe075('0x22')]]){if(this['channels'][_0x1c22a3[_0xe075('0x22')]][_0xe075('0x4c')]>0x0&&this[_0xe075('0xd')][_0x1c22a3[_0xe075('0x22')]]['faxstatus']==='SUCCESS'){this[_0xe075('0x47')](_0x1c22a3['uniqueid'],!![]);}else{this[_0xe075('0x47')](_0x1c22a3[_0xe075('0x22')],![],this[_0xe075('0xd')][_0x1c22a3[_0xe075('0x22')]][_0xe075('0x4d')]?'SENDING\x20FAILED:\x20'+this['channels'][_0x1c22a3[_0xe075('0x22')]]['faxstatusstring']:_0xe075('0x4e'));}}}};Fax[_0xe075('0x27')][_0xe075('0x4f')]=function(_0x10c5b1){var _0x1bcce4=this;return new BPromise(function(_0x2d3e53,_0x59c30e){_0x1bcce4[_0xe075('0x50')](_0x10c5b1,_0x1bcce4[_0xe075('0xe')][_0x10c5b1[_0xe075('0x51')]])[_0xe075('0x38')](function(_0x4523f0){ut[_0xe075('0x44')]('[Fax][execOriginate][success]',_0x4523f0);_0x2d3e53(ut['message'](_0xe075('0x52')));})[_0xe075('0x3a')](function(_0x3b2085){ut[_0xe075('0x44')](_0xe075('0x53'),_0x3b2085);updateStatus(_0x10c5b1);_0x59c30e(ut['message'](_0xe075('0x54')));});});};Fax[_0xe075('0x27')][_0xe075('0x55')]=function(_0x2f8851){var _0x4cf95e=this;return new BPromise(function(_0xe830d4,_0x1a2c8e){var _0x4ac650=_0x4cf95e[_0xe075('0x56')](_0x4cf95e[_0xe075('0xe')][_0x2f8851[_0xe075('0x51')]][_0xe075('0x57')],_0x2f8851);if(_0x4ac650[_0xe075('0x58')]){_0xe830d4(ut['message']('Trunk\x20Reachable'));}else{_0x1a2c8e(ut[_0xe075('0x35')](_0x4ac650[_0xe075('0x35')]));}});};function originate(_0x3ae091,_0x3331a3,_0x55770f){return new BPromise(function(_0x3c07bd,_0x586dd0){if(_0x55770f){var _0x1a2eae=util[_0xe075('0x59')](_0xe075('0x5a'),path[_0xe075('0x36')](_0x3ae091[_0xe075('0x2')])[_0xe075('0x24')],_0x3ae091[_0xe075('0x2')]);gs[_0xe075('0x5b')](_0x1a2eae)[_0xe075('0x38')](function(){_0x3ae091[_0xe075('0x2')]=util['format'](_0xe075('0x5c'),path[_0xe075('0x36')](_0x3ae091[_0xe075('0x2')])[_0xe075('0x5d')],path['parse'](_0x3ae091[_0xe075('0x2')])[_0xe075('0x24')]);_0x3331a3['XMF-PATH']=_0x3ae091[_0xe075('0x2')];ut[_0xe075('0x44')](_0xe075('0x5e'),'');ami[_0xe075('0x5f')](ut[_0xe075('0x60')](_0x3ae091,_0x3331a3))['then'](function(_0xfceb91){_0x3c07bd(_0xfceb91);})[_0xe075('0x3a')](function(_0x1c88f1){_0x586dd0(_0x1c88f1);});})['catch'](function(_0x378366){_0x586dd0(_0x378366);});}else{ami[_0xe075('0x5f')](ut[_0xe075('0x60')](_0x3ae091,_0x3331a3))['then'](function(_0x3a9e08){_0x3c07bd(_0x3a9e08);})[_0xe075('0x3a')](function(_0x2e3ed9){_0x586dd0(_0x2e3ed9);});}});}Fax[_0xe075('0x27')][_0xe075('0x50')]=function(_0x34d003,_0x5d33bd){var _0x57e871=this;return new BPromise(function(_0x2bcf2d,_0x371eef){var _0x1f7995=uuid['v4']();var _0x164d9b=ut[_0xe075('0x61')](_0x34d003,_0x5d33bd);_0x57e871[_0xe075('0x10')][_0x1f7995]=new Action(_0x1f7995,_0x5d33bd,_0x34d003);var _0x1f9a95=_0x57e871[_0xe075('0x10')][_0x1f7995];if(path['parse'](_0x34d003[_0xe075('0x2')])[_0xe075('0x62')]===_0xe075('0x37')){originate(_0x1f9a95,_0x164d9b,!![])['then'](function(_0x17d95b){_0x2bcf2d(_0x17d95b);})[_0xe075('0x3a')](function(_0x6fe55a){_0x371eef(_0x6fe55a);});}else{originate(_0x1f9a95,_0x164d9b,![])[_0xe075('0x38')](function(_0x49a664){_0x2bcf2d(_0x49a664);})[_0xe075('0x3a')](function(_0x4a3501){_0x371eef(_0x4a3501);});}});};Fax['prototype'][_0xe075('0x63')]=function(_0x284f98){return!_['isNil'](_0x284f98)&&!_['isNil'](_0x284f98[_0xe075('0x24')])&&!_[_0xe075('0x64')](_0x284f98[_0xe075('0x65')])&&_0x284f98[_0xe075('0x65')]&&!_[_0xe075('0x64')](this[_0xe075('0xf')][util[_0xe075('0x59')]('SIP/%s',_0x284f98['name'])])&&!_[_0xe075('0x64')](this[_0xe075('0xf')][util['format'](_0xe075('0x66'),_0x284f98[_0xe075('0x24')])]['status'])&&(this['trunks'][util['format'](_0xe075('0x66'),_0x284f98[_0xe075('0x24')])]['status']===_0xe075('0x67')||this[_0xe075('0xf')][util[_0xe075('0x59')](_0xe075('0x66'),_0x284f98[_0xe075('0x24')])][_0xe075('0x2c')]===_0xe075('0x68'));};Fax['prototype'][_0xe075('0x56')]=function(_0x50f3ba,_0x2f3b49){if(!this[_0xe075('0x63')](_0x50f3ba)){ut[_0xe075('0x44')](_0xe075('0x69'),_[_0xe075('0x64')](_0x50f3ba)?'':_0x50f3ba[_0xe075('0x24')]+_0xe075('0x6a'));return{'isValid':![],'message':_0xe075('0x6b')};}if(_[_0xe075('0x64')](_0x2f3b49[_0xe075('0x5')])){ut[_0xe075('0x44')](_0xe075('0x6c'),JSON[_0xe075('0x3c')](_0x2f3b49));return{'isValid':![],'message':_0xe075('0x6d')};}if(_[_0xe075('0x64')](_0x2f3b49[_0xe075('0x2')])){ut[_0xe075('0x44')](_0xe075('0x6e'),JSON[_0xe075('0x3c')](_0x2f3b49));return{'isValid':![],'message':_0xe075('0x6f')};}return{'isValid':!![],'message':_0xe075('0x70')};};module[_0xe075('0x71')]=Fax; \ No newline at end of file +var _0xc594=['updateStatus','[Fax][Message][Updated]','[Fax][Message][NoUpdate1]','\x20hangup\x20sendFile\x20','faxpages','SUCCESS','SENDING\x20FAILED:\x20','faxstatusstring','send','execOriginate','FaxAccountId','[Fax][execOriginate][success]','Fax\x20received','[Fax][execOriginate][failure]','message','checkTrunk','isValid','Trunk\x20Reachable','format','gs\x20-q\x20-dNOPAUSE\x20-dBATCH\x20-sDEVICE=tiffg4\x20-sPAPERSIZE=letter\x20-sOutputFile=/var/opt/motion2/server/files/attachments/%s.tif\x20\x20%s\x20-c\x20quit','execute','dir','XMF-PATH','Convert\x20pdf\x20to\x20tif','Action','variablesAction','addVariables','ext','isNil','active','SIP/%s','unmonitored','isTrunkReachable','[Fax][checkTrunk][Trunk\x20not\x20working\x20correctly]','\x20Trunk\x20is\x20not\x20active','[Fax][checkTrunk][Empty\x20Fax]','Empty\x20Fax','[Fax][checkTrunk][Empty\x20path]','Empty\x20path','exports','util','lodash','uuid','moment','path','tiff2pdf','./util/gs','../../../config/logger','fax','../ami','./channel','./action','../rpc/faxAccount','../rpc/attachment','../rpc/faxMessage','faxAccounts','trunks','actions','syncNewchannel','syncVarSet','bind','newstate','syncNewState','faxstatus','syncReceiveFax','hangup','syncHangup','originateresponse','syncOriginateResponse','context','from-voip-provider','hasOwnProperty','exten','localstationid','channels','uniqueid','channel','name','info','\x20syncNewchannel\x20','prototype','value','channelstate','channelstatedesc','syncNewExten','variable','operation','status','filename','\x20syncFaxStatus\x20','remotestationid','pagestransferred','resolution','transferrate','calleridnum','/var/opt/motion2/server/files/attachments/','\x20result\x20conversion\x20file\x20','parse','.pdf','application/pdf','then','notify','catch','\x20notify\x20','stringify','error','\x20receiveFax\x20','merge','pick','response','reason','AttachmentId','update','SENDING\x20FAILED\x20','logger','[Fax][Message][Error][Updated]','[Fax][Message][Error][NoUpdate1]'];(function(_0x2d69e1,_0x43f881){var _0x9b5140=function(_0x374b86){while(--_0x374b86){_0x2d69e1['push'](_0x2d69e1['shift']());}};_0x9b5140(++_0x43f881);}(_0xc594,0x9d));var _0x4c59=function(_0x387934,_0x1a8221){_0x387934=_0x387934-0x0;var _0x227ea9=_0xc594[_0x387934];return _0x227ea9;};'use strict';var util=require(_0x4c59('0x0'));var _=require(_0x4c59('0x1'));var BPromise=require('bluebird');var uuid=require(_0x4c59('0x2'));var moment=require(_0x4c59('0x3'));var path=require(_0x4c59('0x4'));var tiff2pdf=require(_0x4c59('0x5'));var gs=require(_0x4c59('0x6'));var logger=require(_0x4c59('0x7'))(_0x4c59('0x8'));var ami=require(_0x4c59('0x9'));var rpcDb=require('./rpcDb');var Channel=require(_0x4c59('0xa'));var ut=require('./util/util');var Action=require(_0x4c59('0xb'));var faxAccount=require(_0x4c59('0xc'));var attachment=require(_0x4c59('0xd'));var faxMessage=require(_0x4c59('0xe'));function Fax(_0xea1132){this['channels']={};this[_0x4c59('0xf')]=_0xea1132[_0x4c59('0xf')];this[_0x4c59('0x10')]=_0xea1132[_0x4c59('0x10')];this[_0x4c59('0x11')]={};ami['on']('newchannel',this[_0x4c59('0x12')]['bind'](this));ami['on']('varset',this[_0x4c59('0x13')][_0x4c59('0x14')](this));ami['on'](_0x4c59('0x15'),this[_0x4c59('0x16')][_0x4c59('0x14')](this));ami['on']('newexten',this['syncNewExten'][_0x4c59('0x14')](this));ami['on'](_0x4c59('0x17'),this['syncFaxStatus'][_0x4c59('0x14')](this));ami['on']('receivefax',this[_0x4c59('0x18')][_0x4c59('0x14')](this));ami['on'](_0x4c59('0x19'),this[_0x4c59('0x1a')][_0x4c59('0x14')](this));ami['on'](_0x4c59('0x1b'),this[_0x4c59('0x1c')][_0x4c59('0x14')](this));}Fax['prototype'][_0x4c59('0x12')]=function(_0x33775f){if(_0x33775f[_0x4c59('0x1d')]===_0x4c59('0x1e')){for(var _0x24d1e7 in this['faxAccounts']){if(this['faxAccounts'][_0x4c59('0x1f')](_0x24d1e7)){if(_0x33775f[_0x4c59('0x20')]===this[_0x4c59('0xf')][_0x24d1e7][_0x4c59('0x21')]){this['channels'][_0x33775f['uniqueid']]={};this[_0x4c59('0x22')][_0x33775f[_0x4c59('0x23')]][_0x4c59('0x24')]=_0x33775f[_0x4c59('0x24')];this['channels'][_0x33775f[_0x4c59('0x23')]]['id']=this[_0x4c59('0xf')][_0x24d1e7]['id'];this[_0x4c59('0x22')][_0x33775f[_0x4c59('0x23')]][_0x4c59('0x25')]=this[_0x4c59('0xf')][_0x24d1e7][_0x4c59('0x25')];logger[_0x4c59('0x26')](_0x33775f['uniqueid'],_0x4c59('0x27'));}}}}if(this[_0x4c59('0x11')][_0x33775f[_0x4c59('0x23')]]){this[_0x4c59('0x22')][_0x33775f['uniqueid']]={};this['channels'][_0x33775f[_0x4c59('0x23')]][_0x4c59('0x24')]=_0x33775f['channel'];logger['info'](_0x33775f[_0x4c59('0x23')],_0x4c59('0x27'));}};Fax[_0x4c59('0x28')]['syncVarSet']=function(_0x9da0f7){if(this[_0x4c59('0x22')][_0x9da0f7[_0x4c59('0x23')]]){for(var _0x53f575 in _0x9da0f7['variable']){if(_0x9da0f7['variable'][_0x4c59('0x1f')](_0x53f575)){this['channels'][_0x9da0f7[_0x4c59('0x23')]][_0x53f575]=_0x9da0f7[_0x4c59('0x29')];}}}};Fax['prototype'][_0x4c59('0x16')]=function(_0xd37b00){if(this[_0x4c59('0x22')][_0xd37b00[_0x4c59('0x23')]]){this['channels'][_0xd37b00[_0x4c59('0x23')]][_0x4c59('0x2a')]=_0xd37b00[_0x4c59('0x2a')];this['channels'][_0xd37b00['uniqueid']]['channelstatedesc']=_0xd37b00[_0x4c59('0x2b')];}};Fax[_0x4c59('0x28')][_0x4c59('0x2c')]=function(_0x20852c){if(this[_0x4c59('0x22')][_0x20852c['uniqueid']]){for(var _0xe07382 in _0x20852c[_0x4c59('0x2d')]){if(_0x20852c['variable']['hasOwnProperty'](_0xe07382)){this['channels'][_0x20852c[_0x4c59('0x23')]][_0xe07382]=_0x20852c['value'];}}}};Fax[_0x4c59('0x28')]['syncFaxStatus']=function(_0x4a71cf){if(this[_0x4c59('0x22')][_0x4a71cf[_0x4c59('0x23')]]){this['channels'][_0x4a71cf[_0x4c59('0x23')]]['operation']=_0x4a71cf[_0x4c59('0x2e')];this[_0x4c59('0x22')][_0x4a71cf[_0x4c59('0x23')]]['status']=_0x4a71cf[_0x4c59('0x2f')];this[_0x4c59('0x22')][_0x4a71cf[_0x4c59('0x23')]][_0x4c59('0x21')]=_0x4a71cf[_0x4c59('0x21')];this[_0x4c59('0x22')][_0x4a71cf[_0x4c59('0x23')]][_0x4c59('0x30')]=_0x4a71cf[_0x4c59('0x30')];logger[_0x4c59('0x26')](_0x4a71cf[_0x4c59('0x23')],_0x4c59('0x31'));}};Fax[_0x4c59('0x28')][_0x4c59('0x18')]=function(_0x23f8c9){var _0x3a0138=this;if(this[_0x4c59('0x22')][_0x23f8c9[_0x4c59('0x23')]]){var _0x488b9b=this[_0x4c59('0x22')][_0x23f8c9[_0x4c59('0x23')]]['id'];this[_0x4c59('0x22')][_0x23f8c9[_0x4c59('0x23')]][_0x4c59('0x32')]=_0x23f8c9['remotestationid'];this['channels'][_0x23f8c9[_0x4c59('0x23')]]['pagestransferred']=_0x23f8c9[_0x4c59('0x33')];this[_0x4c59('0x22')][_0x23f8c9[_0x4c59('0x23')]][_0x4c59('0x21')]=_0x23f8c9[_0x4c59('0x21')];this[_0x4c59('0x22')][_0x23f8c9[_0x4c59('0x23')]][_0x4c59('0x34')]=_0x23f8c9[_0x4c59('0x34')];this[_0x4c59('0x22')][_0x23f8c9[_0x4c59('0x23')]][_0x4c59('0x35')]=_0x23f8c9[_0x4c59('0x35')];this[_0x4c59('0x22')][_0x23f8c9[_0x4c59('0x23')]]['filename']=_0x23f8c9[_0x4c59('0x30')];this[_0x4c59('0x22')][_0x23f8c9[_0x4c59('0x23')]][_0x4c59('0x36')]=_0x23f8c9[_0x4c59('0x36')];if(this[_0x4c59('0x22')][_0x23f8c9['uniqueid']]['pagestransferred']>0x0){tiff2pdf(_0x23f8c9['filename'],_0x4c59('0x37'),function(_0x2bb7c8){logger[_0x4c59('0x26')](_0x23f8c9[_0x4c59('0x23')],_0x4c59('0x38'),_0x2bb7c8['message']);attachment['create']({'name':path['parse'](_0x23f8c9[_0x4c59('0x30')])[_0x4c59('0x25')],'basename':path[_0x4c59('0x39')](_0x23f8c9[_0x4c59('0x30')])['name']+_0x4c59('0x3a'),'type':_0x4c59('0x3b')})[_0x4c59('0x3c')](function(_0x2d81cf){faxAccount[_0x4c59('0x3d')](_0x488b9b,{'from':_0x23f8c9[_0x4c59('0x36')],'mapKey':_0x4c59('0x8'),'body':path[_0x4c59('0x39')](_0x23f8c9[_0x4c59('0x30')])['name']+_0x4c59('0x3a'),'AttachmentId':_0x2d81cf['id']})[_0x4c59('0x3e')](function(_0x3b0899){logger['error'](_0x23f8c9[_0x4c59('0x23')],_0x4c59('0x3f'),JSON[_0x4c59('0x40')](_0x3b0899));});})[_0x4c59('0x3e')](function(_0x4b8778){logger[_0x4c59('0x41')](_0x23f8c9[_0x4c59('0x23')],_0x4c59('0x42'),JSON[_0x4c59('0x40')](_0x4b8778));});});}logger['info'](_0x23f8c9[_0x4c59('0x23')],_0x4c59('0x42'));}};Fax[_0x4c59('0x28')][_0x4c59('0x1c')]=function(_0xdac5c1){if(this['actions'][_0xdac5c1['uniqueid']]){_[_0x4c59('0x43')](this[_0x4c59('0x22')][_0xdac5c1[_0x4c59('0x23')]],_[_0x4c59('0x44')](_0xdac5c1,[_0x4c59('0x45'),_0x4c59('0x46')]));}};function updateStatus(_0x5744b5){if(_0x5744b5[_0x4c59('0x47')]){faxMessage[_0x4c59('0x48')](_0x5744b5[_0x4c59('0x47')],{'failMessage':_0x4c59('0x49')})[_0x4c59('0x3c')](function(_0x42e158){ut[_0x4c59('0x4a')](_0x4c59('0x4b'),_0x42e158);})[_0x4c59('0x3e')](function(_0x2a6c78){ut['logger'](_0x4c59('0x4c'),_0x2a6c78);});}else{ut[_0x4c59('0x4a')]('[Fax][Message][Error][NoUpdate2]');}}Fax[_0x4c59('0x28')][_0x4c59('0x4d')]=function(_0x28cbbc,_0x371832,_0x2346fa){var _0x295f6e=this;var _0x195882={};if(_0x371832){_0x195882={'read':_0x371832};}else{_0x195882={'failMessage':_0x2346fa};}if(this[_0x4c59('0x11')][_0x28cbbc][_0x4c59('0x47')]){faxMessage[_0x4c59('0x48')](this[_0x4c59('0x11')][_0x28cbbc][_0x4c59('0x47')],_0x195882)[_0x4c59('0x3c')](function(_0x493381){ut['logger'](_0x4c59('0x4e'),_0x493381);})[_0x4c59('0x3e')](function(_0x14f898){ut['logger'](_0x4c59('0x4f'),_0x14f898);})['finally'](function(){delete _0x295f6e[_0x4c59('0x22')][_0x28cbbc];delete _0x295f6e['actions'][_0x28cbbc];});}else{ut[_0x4c59('0x4a')]('[Fax][Message][NoUpdate2]');delete this['channels'][_0x28cbbc];delete this[_0x4c59('0x11')][_0x28cbbc];}};Fax['prototype'][_0x4c59('0x1a')]=function(_0x40a38f){var _0xf51464=this;if(this[_0x4c59('0x22')][_0x40a38f['uniqueid']]){if(this['actions'][_0x40a38f[_0x4c59('0x23')]]){this['channels'][_0x40a38f['uniqueid']]['id']=this['actions'][_0x40a38f[_0x4c59('0x23')]]['id'];this[_0x4c59('0x22')][_0x40a38f[_0x4c59('0x23')]]['name']=this[_0x4c59('0x11')][_0x40a38f[_0x4c59('0x23')]][_0x4c59('0x25')];}logger[_0x4c59('0x26')](_0x40a38f[_0x4c59('0x23')],this[_0x4c59('0x11')][_0x40a38f[_0x4c59('0x23')]]?_0x4c59('0x50'):'\x20hangup\x20faxRiceive\x20',JSON[_0x4c59('0x40')](this[_0x4c59('0x22')][_0x40a38f[_0x4c59('0x23')]]));if(this[_0x4c59('0x11')][_0x40a38f[_0x4c59('0x23')]]){if(this[_0x4c59('0x22')][_0x40a38f[_0x4c59('0x23')]][_0x4c59('0x51')]>0x0&&this[_0x4c59('0x22')][_0x40a38f[_0x4c59('0x23')]]['faxstatus']===_0x4c59('0x52')){this['updateStatus'](_0x40a38f[_0x4c59('0x23')],!![]);}else{this[_0x4c59('0x4d')](_0x40a38f[_0x4c59('0x23')],![],this['channels'][_0x40a38f['uniqueid']]['faxstatusstring']?_0x4c59('0x53')+this[_0x4c59('0x22')][_0x40a38f[_0x4c59('0x23')]][_0x4c59('0x54')]:'SENDING\x20FAILED');}}}};Fax[_0x4c59('0x28')][_0x4c59('0x55')]=function(_0x1a39a3){var _0xefe8c2=this;return new BPromise(function(_0x264871,_0x31a4ed){_0xefe8c2[_0x4c59('0x56')](_0x1a39a3,_0xefe8c2[_0x4c59('0xf')][_0x1a39a3[_0x4c59('0x57')]])['then'](function(_0x2518c0){ut[_0x4c59('0x4a')](_0x4c59('0x58'),_0x2518c0);_0x264871(ut['message'](_0x4c59('0x59')));})[_0x4c59('0x3e')](function(_0x48a974){ut[_0x4c59('0x4a')](_0x4c59('0x5a'),_0x48a974);updateStatus(_0x1a39a3);_0x31a4ed(ut[_0x4c59('0x5b')]('Fax\x20failed'));});});};Fax['prototype']['checkAfterSend']=function(_0xc7c48){var _0x429e4e=this;return new BPromise(function(_0x22d9c5,_0x4598f7){var _0x232341=_0x429e4e[_0x4c59('0x5c')](_0x429e4e[_0x4c59('0xf')][_0xc7c48[_0x4c59('0x57')]]['Trunk'],_0xc7c48);if(_0x232341[_0x4c59('0x5d')]){_0x22d9c5(ut['message'](_0x4c59('0x5e')));}else{_0x4598f7(ut[_0x4c59('0x5b')](_0x232341[_0x4c59('0x5b')]));}});};function originate(_0x36de1d,_0x51edd1,_0x1f907b){return new BPromise(function(_0x78d489,_0x2300b8){if(_0x1f907b){var _0x56fa3f=util[_0x4c59('0x5f')](_0x4c59('0x60'),path[_0x4c59('0x39')](_0x36de1d['path'])[_0x4c59('0x25')],_0x36de1d['path']);gs[_0x4c59('0x61')](_0x56fa3f)[_0x4c59('0x3c')](function(){_0x36de1d[_0x4c59('0x4')]=util[_0x4c59('0x5f')]('%s/%s.tif',path['parse'](_0x36de1d[_0x4c59('0x4')])[_0x4c59('0x62')],path[_0x4c59('0x39')](_0x36de1d[_0x4c59('0x4')])[_0x4c59('0x25')]);_0x51edd1[_0x4c59('0x63')]=_0x36de1d[_0x4c59('0x4')];ut[_0x4c59('0x4a')](_0x4c59('0x64'),'');ami[_0x4c59('0x65')](ut[_0x4c59('0x66')](_0x36de1d,_0x51edd1))['then'](function(_0x4eb59e){_0x78d489(_0x4eb59e);})['catch'](function(_0x12618e){_0x2300b8(_0x12618e);});})[_0x4c59('0x3e')](function(_0x40e8d4){_0x2300b8(_0x40e8d4);});}else{ami[_0x4c59('0x65')](ut[_0x4c59('0x66')](_0x36de1d,_0x51edd1))[_0x4c59('0x3c')](function(_0x11d5d6){_0x78d489(_0x11d5d6);})[_0x4c59('0x3e')](function(_0x53cc57){_0x2300b8(_0x53cc57);});}});}Fax[_0x4c59('0x28')][_0x4c59('0x56')]=function(_0x238105,_0x5d87e1){var _0xeb551a=this;return new BPromise(function(_0x3025ff,_0x5a3fc2){var _0x36d74a=uuid['v4']();var _0x51f2db=ut[_0x4c59('0x67')](_0x238105,_0x5d87e1);_0xeb551a[_0x4c59('0x11')][_0x36d74a]=new Action(_0x36d74a,_0x5d87e1,_0x238105);var _0x570064=_0xeb551a['actions'][_0x36d74a];if(path['parse'](_0x238105['path'])[_0x4c59('0x68')]===_0x4c59('0x3a')){originate(_0x570064,_0x51f2db,!![])[_0x4c59('0x3c')](function(_0x33d5b0){_0x3025ff(_0x33d5b0);})[_0x4c59('0x3e')](function(_0x55ce1a){_0x5a3fc2(_0x55ce1a);});}else{originate(_0x570064,_0x51f2db,![])[_0x4c59('0x3c')](function(_0x57b3ad){_0x3025ff(_0x57b3ad);})['catch'](function(_0x2efe35){_0x5a3fc2(_0x2efe35);});}});};Fax[_0x4c59('0x28')]['isTrunkReachable']=function(_0x52a61a){return!_[_0x4c59('0x69')](_0x52a61a)&&!_[_0x4c59('0x69')](_0x52a61a[_0x4c59('0x25')])&&!_['isNil'](_0x52a61a[_0x4c59('0x6a')])&&_0x52a61a['active']&&!_[_0x4c59('0x69')](this[_0x4c59('0x10')][util['format']('SIP/%s',_0x52a61a[_0x4c59('0x25')])])&&!_['isNil'](this[_0x4c59('0x10')][util[_0x4c59('0x5f')]('SIP/%s',_0x52a61a[_0x4c59('0x25')])][_0x4c59('0x2f')])&&(this[_0x4c59('0x10')][util[_0x4c59('0x5f')]('SIP/%s',_0x52a61a[_0x4c59('0x25')])][_0x4c59('0x2f')]==='reachable'||this[_0x4c59('0x10')][util['format'](_0x4c59('0x6b'),_0x52a61a['name'])][_0x4c59('0x2f')]===_0x4c59('0x6c'));};Fax['prototype'][_0x4c59('0x5c')]=function(_0x395e66,_0x48d71c){if(!this[_0x4c59('0x6d')](_0x395e66)){ut[_0x4c59('0x4a')](_0x4c59('0x6e'),_[_0x4c59('0x69')](_0x395e66)?'':_0x395e66[_0x4c59('0x25')]+_0x4c59('0x6f'));return{'isValid':![],'message':'Trunk\x20not\x20working\x20correctly'};}if(_[_0x4c59('0x69')](_0x48d71c[_0x4c59('0x8')])){ut[_0x4c59('0x4a')](_0x4c59('0x70'),JSON['stringify'](_0x48d71c));return{'isValid':![],'message':_0x4c59('0x71')};}if(_['isNil'](_0x48d71c['path'])){ut[_0x4c59('0x4a')](_0x4c59('0x72'),JSON[_0x4c59('0x40')](_0x48d71c));return{'isValid':![],'message':_0x4c59('0x73')};}return{'isValid':!![],'message':'Is\x20Valid'};};module[_0x4c59('0x74')]=Fax; \ No newline at end of file diff --git a/server/services/ami/fax/rpcDb.js b/server/services/ami/fax/rpcDb.js index 0546fe9..809cd7a 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 _0xaa2c=['preview','lodash','error','inspect','notify','resolve','then','catch','[Notify]\x20','bluebird','../../../config/logger'];(function(_0x6f463f,_0x69340a){var _0x5d8a9f=function(_0x17b2e2){while(--_0x17b2e2){_0x6f463f['push'](_0x6f463f['shift']());}};_0x5d8a9f(++_0x69340a);}(_0xaa2c,0x6c));var _0xcaa2=function(_0x5b3a84,_0x3a8d78){_0x5b3a84=_0x5b3a84-0x0;var _0x593ef1=_0xaa2c[_0x5b3a84];return _0x593ef1;};'use strict';var util=require('util');var BPromise=require(_0xcaa2('0x0'));var logger=require(_0xcaa2('0x1'))(_0xcaa2('0x2'));var _=require(_0xcaa2('0x3'));var faxAccount=require('../rpc/faxAccount');function loggerCatch(_0x534938){return function(_0x3639cc){logger[_0xcaa2('0x4')](_0x534938,util[_0xcaa2('0x5')](_0x3639cc,{'showHidden':![],'depth':null}));};}exports[_0xcaa2('0x6')]=function(_0x98f42c,_0x419223){return BPromise[_0xcaa2('0x7')]()[_0xcaa2('0x8')](faxAccount[_0xcaa2('0x6')](_0x98f42c,_0x419223))[_0xcaa2('0x9')](loggerCatch(_0xcaa2('0xa')));}; \ No newline at end of file +var _0x827a=['util','bluebird','../../../config/logger','preview','lodash','../rpc/faxAccount','error','inspect','notify','then'];(function(_0x3cafb8,_0x32860e){var _0x4b7f85=function(_0x31b11d){while(--_0x31b11d){_0x3cafb8['push'](_0x3cafb8['shift']());}};_0x4b7f85(++_0x32860e);}(_0x827a,0xf0));var _0xa827=function(_0x515ed6,_0x5655e5){_0x515ed6=_0x515ed6-0x0;var _0x302e1a=_0x827a[_0x515ed6];return _0x302e1a;};'use strict';var util=require(_0xa827('0x0'));var BPromise=require(_0xa827('0x1'));var logger=require(_0xa827('0x2'))(_0xa827('0x3'));var _=require(_0xa827('0x4'));var faxAccount=require(_0xa827('0x5'));function loggerCatch(_0x4cba08){return function(_0x4979a5){logger[_0xa827('0x6')](_0x4cba08,util[_0xa827('0x7')](_0x4979a5,{'showHidden':![],'depth':null}));};}exports[_0xa827('0x8')]=function(_0x2f58fb,_0x3dcbf9){return BPromise['resolve']()[_0xa827('0x9')](faxAccount[_0xa827('0x8')](_0x2f58fb,_0x3dcbf9))['catch'](loggerCatch('[Notify]\x20'));}; \ No newline at end of file diff --git a/server/services/ami/fax/util/gs.js b/server/services/ami/fax/util/gs.js index 8339343..c007501 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 _0x2903=['util','../../../../config/logger','fax','bluebird','child_process','exec','execute','inspect'];(function(_0x2859f2,_0x1e3102){var _0x4974cd=function(_0x13ec65){while(--_0x13ec65){_0x2859f2['push'](_0x2859f2['shift']());}};_0x4974cd(++_0x1e3102);}(_0x2903,0x1d0));var _0x3290=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x2903[_0x321bb2];return _0x9c12ed;};'use strict';var util=require(_0x3290('0x0'));var logger=require(_0x3290('0x1'))(_0x3290('0x2'));var BPromise=require(_0x3290('0x3'));var exec=require(_0x3290('0x4'))[_0x3290('0x5')];exports[_0x3290('0x6')]=function(_0x4ebc9a){return new BPromise(function(_0xd1b140,_0x181300){exec(_0x4ebc9a,function(_0xcacb94,_0x504c69,_0x5efb65){logger['info']('Exec\x20gs',_0x504c69);if(_0xcacb94){logger['info']('Exec\x20gs','\x20Error\x20:',util[_0x3290('0x7')](_0xcacb94,{'showHidden':![],'depth':null}),_0x504c69,_0x5efb65);_0x181300(_0xcacb94);}_0xd1b140(_0x504c69);});});}; \ No newline at end of file +var _0x263c=['info','\x20Error\x20:','inspect','util','bluebird','child_process','exec','Exec\x20gs'];(function(_0x2abd03,_0x15bd78){var _0x397306=function(_0x203b1e){while(--_0x203b1e){_0x2abd03['push'](_0x2abd03['shift']());}};_0x397306(++_0x15bd78);}(_0x263c,0x11b));var _0xc263=function(_0x374f59,_0x5c2098){_0x374f59=_0x374f59-0x0;var _0x408ead=_0x263c[_0x374f59];return _0x408ead;};'use strict';var util=require(_0xc263('0x0'));var logger=require('../../../../config/logger')('fax');var BPromise=require(_0xc263('0x1'));var exec=require(_0xc263('0x2'))[_0xc263('0x3')];exports['execute']=function(_0x25b7c4){return new BPromise(function(_0x3c6d8c,_0x20f470){exec(_0x25b7c4,function(_0x5bd539,_0x58d8f3,_0xa17e82){logger['info'](_0xc263('0x4'),_0x58d8f3);if(_0x5bd539){logger[_0xc263('0x5')](_0xc263('0x4'),_0xc263('0x6'),util[_0xc263('0x7')](_0x5bd539,{'showHidden':![],'depth':null}),_0x58d8f3,_0xa17e82);_0x20f470(_0x5bd539);}_0x3c6d8c(_0x58d8f3);});});}; \ 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 64539ba..71cdb6e 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 _0x5a38=['path','variablesAction','uniqueid','originate','channel','from-sip','\x22%s\x22\x20<%s>','util','lodash','moment','../../../../config/logger','fax','message','logger','info','inspect','addVariables','ecm','headerinfo','minrate','maxrate','format','\x22%s\x22','modem','gateway','faxdetect','t38timeout','localstationid'];(function(_0x39ffd1,_0x299703){var _0x31267e=function(_0x11b420){while(--_0x11b420){_0x39ffd1['push'](_0x39ffd1['shift']());}};_0x31267e(++_0x299703);}(_0x5a38,0xaf));var _0x85a3=function(_0x57c872,_0x63a1fa){_0x57c872=_0x57c872-0x0;var _0x3ce770=_0x5a38[_0x57c872];return _0x3ce770;};'use strict';var util=require(_0x85a3('0x0'));var _=require(_0x85a3('0x1'));var moment=require(_0x85a3('0x2'));var logger=require(_0x85a3('0x3'))(_0x85a3('0x4'));exports[_0x85a3('0x5')]=function(_0x120bf0){return{'message':_0x120bf0};};exports[_0x85a3('0x6')]=function(_0x4d8997,_0x2af2dc){logger[_0x85a3('0x7')](_0x4d8997,util[_0x85a3('0x8')](_0x2af2dc,{'showHidden':![],'depth':null}));};exports[_0x85a3('0x9')]=function(_0x381bc9,_0x2895f9){var _0x454637={'XMF-ECM':_0x2895f9[_0x85a3('0xa')],'XMF-HEADERINFO':_0x2895f9[_0x85a3('0xb')],'XMF-MINRATE':_0x2895f9[_0x85a3('0xc')],'XMF-MAXRATE':_0x2895f9[_0x85a3('0xd')],'XMF-MODEM':util[_0x85a3('0xe')](_0x85a3('0xf'),_0x2895f9[_0x85a3('0x10')]),'XMF-GATEWAY':_0x2895f9[_0x85a3('0x11')],'XMF-FAXDETECT':_0x2895f9[_0x85a3('0x12')],'XMF-T38TIMEOUT':_0x2895f9[_0x85a3('0x13')],'XMF-LOCALSTATIONID':_0x2895f9[_0x85a3('0x14')],'XMF-PATH':_0x381bc9[_0x85a3('0x15')]};return _0x454637;};exports[_0x85a3('0x16')]=function(_0x35b6d2,_0x497708){return{'actionid':_0x35b6d2[_0x85a3('0x17')],'action':_0x85a3('0x18'),'channel':_0x35b6d2[_0x85a3('0x19')],'Exten':'xcally-motion-fax','Context':_0x85a3('0x1a'),'Priority':'1','callerid':util[_0x85a3('0xe')](_0x85a3('0x1b'),_0x35b6d2[_0x85a3('0xb')]?_0x35b6d2[_0x85a3('0xb')]:'',_0x35b6d2[_0x85a3('0x14')]),'variable':_0x497708,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x35b6d2[_0x85a3('0x17')]};}; \ No newline at end of file +var _0x1dd4=['lodash','fax','message','logger','info','inspect','addVariables','ecm','format','\x22%s\x22','gateway','faxdetect','localstationid','variablesAction','uniqueid','originate','channel','xcally-motion-fax','from-sip','\x22%s\x22\x20<%s>','util'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x1dd4,0xa7));var _0x41dd=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1dd4[_0x3dd15e];return _0x231fd0;};'use strict';var util=require(_0x41dd('0x0'));var _=require(_0x41dd('0x1'));var moment=require('moment');var logger=require('../../../../config/logger')(_0x41dd('0x2'));exports[_0x41dd('0x3')]=function(_0x3f836e){return{'message':_0x3f836e};};exports[_0x41dd('0x4')]=function(_0xf1be6e,_0x2671d4){logger[_0x41dd('0x5')](_0xf1be6e,util[_0x41dd('0x6')](_0x2671d4,{'showHidden':![],'depth':null}));};exports[_0x41dd('0x7')]=function(_0x5cb6f3,_0x397beb){var _0x47fa3b={'XMF-ECM':_0x397beb[_0x41dd('0x8')],'XMF-HEADERINFO':_0x397beb['headerinfo'],'XMF-MINRATE':_0x397beb['minrate'],'XMF-MAXRATE':_0x397beb['maxrate'],'XMF-MODEM':util[_0x41dd('0x9')](_0x41dd('0xa'),_0x397beb['modem']),'XMF-GATEWAY':_0x397beb[_0x41dd('0xb')],'XMF-FAXDETECT':_0x397beb[_0x41dd('0xc')],'XMF-T38TIMEOUT':_0x397beb['t38timeout'],'XMF-LOCALSTATIONID':_0x397beb[_0x41dd('0xd')],'XMF-PATH':_0x5cb6f3['path']};return _0x47fa3b;};exports[_0x41dd('0xe')]=function(_0x4391b9,_0xaa6bf){return{'actionid':_0x4391b9[_0x41dd('0xf')],'action':_0x41dd('0x10'),'channel':_0x4391b9[_0x41dd('0x11')],'Exten':_0x41dd('0x12'),'Context':_0x41dd('0x13'),'Priority':'1','callerid':util[_0x41dd('0x9')](_0x41dd('0x14'),_0x4391b9['headerinfo']?_0x4391b9['headerinfo']:'',_0x4391b9[_0x41dd('0xd')]),'variable':_0xaa6bf,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x4391b9[_0x41dd('0xf')]};}; \ No newline at end of file diff --git a/server/services/ami/index.js b/server/services/ami/index.js index fd8ecee..01adce5 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 _0x6fd8=['initCampaigns','getVoiceExtensions','initFaxAccounts','getVoiceQueueReports','initVoiceQueueReports','getCampaignHopperHistory','initCampaignHopperHistory','initVoiceCallReports','catch','[index.js][initParams]','inspect','listen','sync','error','[index.js][main]','util','./server','./realtime','./report','./acw','./preview','./fax','./rpc/user','./rpc/voiceQueue','./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/sugarcrm','./rpc/integrations/freshdesk','./rpc/integrations/zoho','./rpc/integrations/vtiger','./rpc/integrations/freshsales','../../config/logger','ami','hour','get','resolve','getAgents','then','initAgents','getTrunks','initTrunks','getVoiceQueues','initVoiceQueues','getTriggers','initTriggers','getTemplates','initTemplates','getZendeskAccounts','getSalesforceAccounts','initSalesforceAccounts','getSugarcrmAccounts','initSugarcrmAccounts','getFreshdeskAccounts','initFreshdeskAccounts','getDeskAccounts','initZohoAccounts','getVtigerAccounts','initVtigerAccounts','getFreshsalesAccounts','getServicenowAccounts','initServicenowAccounts','getDynamics365Accounts','initDynamics365Accounts','getCampaigns'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x6fd8,0xea));var _0x86fd=function(_0x1c6bd2,_0x56e81e){_0x1c6bd2=_0x1c6bd2-0x0;var _0x195830=_0x6fd8[_0x1c6bd2];return _0x195830;};'use strict';var util=require(_0x86fd('0x0'));var moment=require('moment');var server=require(_0x86fd('0x1'));var Realtime=require(_0x86fd('0x2'));var Report=require(_0x86fd('0x3'));var Acw=require(_0x86fd('0x4'));var Trigger=require('./trigger');var Dialer=require('./dialer');var Preview=require(_0x86fd('0x5'));var Fax=require(_0x86fd('0x6'));var user=require(_0x86fd('0x7'));var voiceQueue=require(_0x86fd('0x8'));var voiceQueueReport=require(_0x86fd('0x9'));var voiceCallReport=require(_0x86fd('0xa'));var trunk=require(_0x86fd('0xb'));var trigger=require(_0x86fd('0xc'));var template=require(_0x86fd('0xd'));var cmHopperHistory=require(_0x86fd('0xe'));var campaign=require(_0x86fd('0xf'));var voiceExtension=require(_0x86fd('0x10'));var faxAccount=require(_0x86fd('0x11'));var zendesk=require(_0x86fd('0x12'));var salesforce=require(_0x86fd('0x13'));var sugarcrm=require(_0x86fd('0x14'));var freshdesk=require(_0x86fd('0x15'));var desk=require('./rpc/integrations/desk');var zoho=require(_0x86fd('0x16'));var vtiger=require(_0x86fd('0x17'));var freshsales=require(_0x86fd('0x18'));var servicenow=require('./rpc/integrations/servicenow');var dynamics365=require('./rpc/integrations/dynamics365');var realtime=new Realtime();var report=new Report(realtime);var acw=new Acw(realtime);var channelTrigger=new Trigger(realtime);var preview=new Preview(realtime);var dialer=new Dialer(realtime,preview);var fax=new Fax(realtime);var logger=require(_0x86fd('0x19'))(_0x86fd('0x1a'));var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()['get'](_0x86fd('0x1b'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0x86fd('0x1c')](_0x86fd('0x1b'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return Promise[_0x86fd('0x1d')]()['then'](user[_0x86fd('0x1e')]())[_0x86fd('0x1f')](realtime[_0x86fd('0x20')]())[_0x86fd('0x1f')](user['getTelephones']())['then'](realtime['initTelephones']())[_0x86fd('0x1f')](trunk[_0x86fd('0x21')]())[_0x86fd('0x1f')](realtime[_0x86fd('0x22')]())['then'](voiceQueue[_0x86fd('0x23')]())[_0x86fd('0x1f')](realtime[_0x86fd('0x24')]())['then'](trigger[_0x86fd('0x25')]())['then'](realtime[_0x86fd('0x26')]())[_0x86fd('0x1f')](template[_0x86fd('0x27')]())[_0x86fd('0x1f')](realtime[_0x86fd('0x28')]())[_0x86fd('0x1f')](zendesk[_0x86fd('0x29')]())[_0x86fd('0x1f')](realtime['initZendeskAccounts']())[_0x86fd('0x1f')](salesforce[_0x86fd('0x2a')]())[_0x86fd('0x1f')](realtime[_0x86fd('0x2b')]())[_0x86fd('0x1f')](sugarcrm[_0x86fd('0x2c')]())['then'](realtime[_0x86fd('0x2d')]())['then'](freshdesk[_0x86fd('0x2e')]())[_0x86fd('0x1f')](realtime[_0x86fd('0x2f')]())[_0x86fd('0x1f')](desk[_0x86fd('0x30')]())[_0x86fd('0x1f')](realtime['initDeskAccounts']())[_0x86fd('0x1f')](zoho['getZohoAccounts']())[_0x86fd('0x1f')](realtime[_0x86fd('0x31')]())[_0x86fd('0x1f')](vtiger[_0x86fd('0x32')]())[_0x86fd('0x1f')](realtime[_0x86fd('0x33')]())['then'](freshsales[_0x86fd('0x34')]())[_0x86fd('0x1f')](realtime['initFreshsalesAccounts']())[_0x86fd('0x1f')](servicenow[_0x86fd('0x35')]())[_0x86fd('0x1f')](realtime[_0x86fd('0x36')]())['then'](dynamics365[_0x86fd('0x37')]())[_0x86fd('0x1f')](realtime[_0x86fd('0x38')]())[_0x86fd('0x1f')](campaign[_0x86fd('0x39')]())['then'](realtime[_0x86fd('0x3a')]())[_0x86fd('0x1f')](voiceExtension[_0x86fd('0x3b')]())[_0x86fd('0x1f')](realtime['initVoiceExtensions']())[_0x86fd('0x1f')](faxAccount['getFaxAccounts']())[_0x86fd('0x1f')](realtime[_0x86fd('0x3c')]())[_0x86fd('0x1f')](function(){return realtime;});}function initParams(){return Promise[_0x86fd('0x1d')]()[_0x86fd('0x1f')](voiceQueueReport[_0x86fd('0x3d')]())[_0x86fd('0x1f')](realtime[_0x86fd('0x3e')]())[_0x86fd('0x1f')](cmHopperHistory['getVoiceQueueHopperHistory']())[_0x86fd('0x1f')](realtime['initVoiceQueueHopperHistory']())[_0x86fd('0x1f')](cmHopperHistory[_0x86fd('0x3f')]())['then'](realtime[_0x86fd('0x40')]())[_0x86fd('0x1f')](voiceCallReport['getVoiceCallReports']())[_0x86fd('0x1f')](realtime[_0x86fd('0x41')]())[_0x86fd('0x42')](function(_0x4c1c54){logger['error'](_0x86fd('0x43'),util[_0x86fd('0x44')](_0x4c1c54,{'showHidden':![],'depth':null}));});}function main(){return server[_0x86fd('0x45')](realtime,preview,fax)[_0x86fd('0x1f')](function(){return initRealtime();})[_0x86fd('0x1f')](function(){return initParams();})['then'](function(){report[_0x86fd('0x46')]();setInterval(initRealtime,0x1388);})['catch'](function(_0x3383f9){logger[_0x86fd('0x47')](_0x86fd('0x48'),util[_0x86fd('0x44')](_0x3383f9,{'showHidden':![],'depth':null}));});}main(); \ No newline at end of file +var _0x7f17=['./rpc/integrations/zoho','./rpc/integrations/freshsales','./rpc/integrations/servicenow','./rpc/integrations/dynamics365','../../config/logger','ami','get','hour','then','getAgents','initAgents','getTelephones','initTelephones','getTrunks','initTrunks','getVoiceQueues','initVoiceQueues','getTriggers','getTemplates','initTemplates','initZendeskAccounts','getSalesforceAccounts','initSalesforceAccounts','getSugarcrmAccounts','getFreshdeskAccounts','getDeskAccounts','initDeskAccounts','getZohoAccounts','initZohoAccounts','getVtigerAccounts','initVtigerAccounts','getFreshsalesAccounts','initFreshsalesAccounts','getServicenowAccounts','initServicenowAccounts','getDynamics365Accounts','initDynamics365Accounts','getCampaigns','initCampaigns','getVoiceExtensions','initVoiceExtensions','getFaxAccounts','initFaxAccounts','resolve','getVoiceQueueReports','initVoiceQueueReports','initVoiceQueueHopperHistory','initCampaignHopperHistory','getVoiceCallReports','initVoiceCallReports','catch','error','inspect','listen','sync','[index.js][main]','util','moment','./realtime','./trigger','./preview','./fax','./rpc/user','./rpc/voiceQueue','./rpc/trunk','./rpc/template','./rpc/cmHopperHistory','./rpc/campaign','./rpc/voiceExtension','./rpc/faxAccount','./rpc/integrations/zendesk','./rpc/integrations/sugarcrm','./rpc/integrations/freshdesk','./rpc/integrations/desk'];(function(_0x1b2ac9,_0x5371e8){var _0x3da279=function(_0x880506){while(--_0x880506){_0x1b2ac9['push'](_0x1b2ac9['shift']());}};_0x3da279(++_0x5371e8);}(_0x7f17,0x1f4));var _0x77f1=function(_0x2e409e,_0x2d227e){_0x2e409e=_0x2e409e-0x0;var _0xe6e039=_0x7f17[_0x2e409e];return _0xe6e039;};'use strict';var util=require(_0x77f1('0x0'));var moment=require(_0x77f1('0x1'));var server=require('./server');var Realtime=require(_0x77f1('0x2'));var Report=require('./report');var Acw=require('./acw');var Trigger=require(_0x77f1('0x3'));var Dialer=require('./dialer');var Preview=require(_0x77f1('0x4'));var Fax=require(_0x77f1('0x5'));var user=require(_0x77f1('0x6'));var voiceQueue=require(_0x77f1('0x7'));var voiceQueueReport=require('./rpc/voiceQueueReport');var voiceCallReport=require('./rpc/voiceCallReport');var trunk=require(_0x77f1('0x8'));var trigger=require('./rpc/trigger');var template=require(_0x77f1('0x9'));var cmHopperHistory=require(_0x77f1('0xa'));var campaign=require(_0x77f1('0xb'));var voiceExtension=require(_0x77f1('0xc'));var faxAccount=require(_0x77f1('0xd'));var zendesk=require(_0x77f1('0xe'));var salesforce=require('./rpc/integrations/salesforce');var sugarcrm=require(_0x77f1('0xf'));var freshdesk=require(_0x77f1('0x10'));var desk=require(_0x77f1('0x11'));var zoho=require(_0x77f1('0x12'));var vtiger=require('./rpc/integrations/vtiger');var freshsales=require(_0x77f1('0x13'));var servicenow=require(_0x77f1('0x14'));var dynamics365=require(_0x77f1('0x15'));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(_0x77f1('0x16'))(_0x77f1('0x17'));var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()[_0x77f1('0x18')](_0x77f1('0x19'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0x77f1('0x18')](_0x77f1('0x19'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return Promise['resolve']()[_0x77f1('0x1a')](user[_0x77f1('0x1b')]())[_0x77f1('0x1a')](realtime[_0x77f1('0x1c')]())[_0x77f1('0x1a')](user[_0x77f1('0x1d')]())['then'](realtime[_0x77f1('0x1e')]())[_0x77f1('0x1a')](trunk[_0x77f1('0x1f')]())['then'](realtime[_0x77f1('0x20')]())[_0x77f1('0x1a')](voiceQueue[_0x77f1('0x21')]())[_0x77f1('0x1a')](realtime[_0x77f1('0x22')]())[_0x77f1('0x1a')](trigger[_0x77f1('0x23')]())[_0x77f1('0x1a')](realtime['initTriggers']())[_0x77f1('0x1a')](template[_0x77f1('0x24')]())[_0x77f1('0x1a')](realtime[_0x77f1('0x25')]())['then'](zendesk['getZendeskAccounts']())[_0x77f1('0x1a')](realtime[_0x77f1('0x26')]())[_0x77f1('0x1a')](salesforce[_0x77f1('0x27')]())[_0x77f1('0x1a')](realtime[_0x77f1('0x28')]())['then'](sugarcrm[_0x77f1('0x29')]())[_0x77f1('0x1a')](realtime['initSugarcrmAccounts']())['then'](freshdesk[_0x77f1('0x2a')]())[_0x77f1('0x1a')](realtime['initFreshdeskAccounts']())[_0x77f1('0x1a')](desk[_0x77f1('0x2b')]())[_0x77f1('0x1a')](realtime[_0x77f1('0x2c')]())[_0x77f1('0x1a')](zoho[_0x77f1('0x2d')]())[_0x77f1('0x1a')](realtime[_0x77f1('0x2e')]())[_0x77f1('0x1a')](vtiger[_0x77f1('0x2f')]())['then'](realtime[_0x77f1('0x30')]())[_0x77f1('0x1a')](freshsales[_0x77f1('0x31')]())['then'](realtime[_0x77f1('0x32')]())[_0x77f1('0x1a')](servicenow[_0x77f1('0x33')]())[_0x77f1('0x1a')](realtime[_0x77f1('0x34')]())['then'](dynamics365[_0x77f1('0x35')]())[_0x77f1('0x1a')](realtime[_0x77f1('0x36')]())[_0x77f1('0x1a')](campaign[_0x77f1('0x37')]())['then'](realtime[_0x77f1('0x38')]())[_0x77f1('0x1a')](voiceExtension[_0x77f1('0x39')]())[_0x77f1('0x1a')](realtime[_0x77f1('0x3a')]())[_0x77f1('0x1a')](faxAccount[_0x77f1('0x3b')]())[_0x77f1('0x1a')](realtime[_0x77f1('0x3c')]())['then'](function(){return realtime;});}function initParams(){return Promise[_0x77f1('0x3d')]()['then'](voiceQueueReport[_0x77f1('0x3e')]())[_0x77f1('0x1a')](realtime[_0x77f1('0x3f')]())[_0x77f1('0x1a')](cmHopperHistory['getVoiceQueueHopperHistory']())[_0x77f1('0x1a')](realtime[_0x77f1('0x40')]())[_0x77f1('0x1a')](cmHopperHistory['getCampaignHopperHistory']())[_0x77f1('0x1a')](realtime[_0x77f1('0x41')]())[_0x77f1('0x1a')](voiceCallReport[_0x77f1('0x42')]())[_0x77f1('0x1a')](realtime[_0x77f1('0x43')]())[_0x77f1('0x44')](function(_0x5eb4f0){logger[_0x77f1('0x45')]('[index.js][initParams]',util[_0x77f1('0x46')](_0x5eb4f0,{'showHidden':![],'depth':null}));});}function main(){return server[_0x77f1('0x47')](realtime,preview,fax)[_0x77f1('0x1a')](function(){return initRealtime();})['then'](function(){return initParams();})[_0x77f1('0x1a')](function(){report[_0x77f1('0x48')]();setInterval(initRealtime,0x1388);})[_0x77f1('0x44')](function(_0x57f133){logger[_0x77f1('0x45')](_0x77f1('0x49'),util[_0x77f1('0x46')](_0x57f133,{'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 99936e0..0d840e8 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 _0xffe1=['user:ami:update','emit','user:presence','lodash','util','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','email','accountcode','state','unknown','stateTime','status','address','phone','mobile','interface','online','voiceStatus','voiceStatusCallerIdNumber','voiceStatusQueue','local','prototype','updateStatusRealtime','toLowerCase','idle','talking','statePause','toNumber','fullname','voiceStatusTime','format','user:%s'];(function(_0x413feb,_0x10477f){var _0x40ee88=function(_0x32a3f6){while(--_0x32a3f6){_0x413feb['push'](_0x413feb['shift']());}};_0x40ee88(++_0x10477f);}(_0xffe1,0x175));var _0x1ffe=function(_0x5e8e29,_0x4c2aea){_0x5e8e29=_0x5e8e29-0x0;var _0x1b9c84=_0xffe1[_0x5e8e29];return _0x1b9c84;};'use strict';var _=require(_0x1ffe('0x0'));var util=require(_0x1ffe('0x1'));var moment=require('moment');var Redis=require('ioredis');var config=require(_0x1ffe('0x2'));config[_0x1ffe('0x3')]=_[_0x1ffe('0x4')](config['redis'],{'host':_0x1ffe('0x5'),'port':0x18eb});var io=require(_0x1ffe('0x6'))(new Redis(config[_0x1ffe('0x3')]));function Agent(_0x5a5912){this['id']=_0x5a5912['id']||0x0;this[_0x1ffe('0x7')]=_0x5a5912[_0x1ffe('0x7')]||'';this[_0x1ffe('0x8')]=_0x5a5912[_0x1ffe('0x8')]||'';this[_0x1ffe('0x9')]=_0x5a5912[_0x1ffe('0x9')]||'';this['fullname']=_0x5a5912['fullname']||'';this[_0x1ffe('0xa')]=_0x1ffe('0xb');this[_0x1ffe('0xc')]=0x0;this[_0x1ffe('0xd')]='unknown';this[_0x1ffe('0xe')]='';this[_0x1ffe('0xf')]='';this[_0x1ffe('0x10')]='';this[_0x1ffe('0x11')]='';this[_0x1ffe('0x12')]=_0x5a5912[_0x1ffe('0x12')]||![];this[_0x1ffe('0x13')]=_0x1ffe('0xb');this['voiceStatusTime']=0x0;this[_0x1ffe('0x14')]='';this[_0x1ffe('0x15')]='';this['onhold']=![];this[_0x1ffe('0x16')]=![];}Agent[_0x1ffe('0x17')][_0x1ffe('0x18')]=function(_0xae23bf){if(!_0xae23bf[_0x1ffe('0xa')]){return;}var _0x5ab4b4=null;var _0x972599=_0xae23bf[_0x1ffe('0xa')][_0x1ffe('0x19')]();switch(_0x972599){case'not_inuse':_0x972599=_0x1ffe('0x1a');break;case'inuse':_0x972599=_0x1ffe('0x1b');break;}if(this['voiceStatus']!==_0x972599||_0xae23bf[_0x1ffe('0x1c')]){_0x5ab4b4=_[_0x1ffe('0x1d')](moment()['format']('x'));}var _0x561670={'id':this['id'],'name':this['name'],'email':this[_0x1ffe('0x8')],'accountcode':this[_0x1ffe('0x9')],'fullname':this[_0x1ffe('0x1e')],'state':this[_0x1ffe('0xa')],'stateTime':this[_0x1ffe('0xc')],'status':this[_0x1ffe('0xd')],'address':this[_0x1ffe('0xe')],'voiceStatus':_0x972599||this[_0x1ffe('0x13')],'voiceStatusTime':_0x5ab4b4||this[_0x1ffe('0x1f')],'voiceStatusCallerIdNumber':this[_0x1ffe('0x14')],'voiceStatusQueue':this[_0x1ffe('0x15')],'interface':this[_0x1ffe('0x11')],'onhold':this['onhold']};if(this['voiceStatus']!==_0x972599){this[_0x1ffe('0x13')]=_0x972599;io['to'](util[_0x1ffe('0x20')](_0x1ffe('0x21'),_0x561670['name']))['emit'](_0x1ffe('0x22'),_0x561670);io[_0x1ffe('0x23')](_0x1ffe('0x24'),_0x561670);}};module['exports']=Agent; \ No newline at end of file +var _0x55a5=['state','unknown','stateTime','status','address','mobile','interface','online','voiceStatus','onhold','local','prototype','updateStatusRealtime','idle','inuse','talking','statePause','toNumber','format','voiceStatusTime','voiceStatusQueue','emit','user:ami:update','user:presence','exports','lodash','moment','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','email','accountcode','fullname'];(function(_0x280cd6,_0xf6a99e){var _0x3e69e7=function(_0x520b75){while(--_0x520b75){_0x280cd6['push'](_0x280cd6['shift']());}};_0x3e69e7(++_0xf6a99e);}(_0x55a5,0xf7));var _0x555a=function(_0xeadc11,_0x27e378){_0xeadc11=_0xeadc11-0x0;var _0x4257b6=_0x55a5[_0xeadc11];return _0x4257b6;};'use strict';var _=require(_0x555a('0x0'));var util=require('util');var moment=require(_0x555a('0x1'));var Redis=require(_0x555a('0x2'));var config=require(_0x555a('0x3'));config[_0x555a('0x4')]=_[_0x555a('0x5')](config[_0x555a('0x4')],{'host':_0x555a('0x6'),'port':0x18eb});var io=require(_0x555a('0x7'))(new Redis(config[_0x555a('0x4')]));function Agent(_0x262aee){this['id']=_0x262aee['id']||0x0;this[_0x555a('0x8')]=_0x262aee[_0x555a('0x8')]||'';this[_0x555a('0x9')]=_0x262aee[_0x555a('0x9')]||'';this[_0x555a('0xa')]=_0x262aee['accountcode']||'';this[_0x555a('0xb')]=_0x262aee[_0x555a('0xb')]||'';this[_0x555a('0xc')]=_0x555a('0xd');this[_0x555a('0xe')]=0x0;this[_0x555a('0xf')]=_0x555a('0xd');this[_0x555a('0x10')]='';this['phone']='';this[_0x555a('0x11')]='';this[_0x555a('0x12')]='';this[_0x555a('0x13')]=_0x262aee[_0x555a('0x13')]||![];this[_0x555a('0x14')]='unknown';this['voiceStatusTime']=0x0;this['voiceStatusCallerIdNumber']='';this['voiceStatusQueue']='';this[_0x555a('0x15')]=![];this[_0x555a('0x16')]=![];}Agent[_0x555a('0x17')][_0x555a('0x18')]=function(_0x1c5016){if(!_0x1c5016[_0x555a('0xc')]){return;}var _0x3fe691=null;var _0x29ad45=_0x1c5016['state']['toLowerCase']();switch(_0x29ad45){case'not_inuse':_0x29ad45=_0x555a('0x19');break;case _0x555a('0x1a'):_0x29ad45=_0x555a('0x1b');break;}if(this['voiceStatus']!==_0x29ad45||_0x1c5016[_0x555a('0x1c')]){_0x3fe691=_[_0x555a('0x1d')](moment()[_0x555a('0x1e')]('x'));}var _0x59e2e4={'id':this['id'],'name':this[_0x555a('0x8')],'email':this['email'],'accountcode':this[_0x555a('0xa')],'fullname':this[_0x555a('0xb')],'state':this[_0x555a('0xc')],'stateTime':this[_0x555a('0xe')],'status':this[_0x555a('0xf')],'address':this[_0x555a('0x10')],'voiceStatus':_0x29ad45||this[_0x555a('0x14')],'voiceStatusTime':_0x3fe691||this[_0x555a('0x1f')],'voiceStatusCallerIdNumber':this['voiceStatusCallerIdNumber'],'voiceStatusQueue':this[_0x555a('0x20')],'interface':this[_0x555a('0x12')],'onhold':this[_0x555a('0x15')]};if(this['voiceStatus']!==_0x29ad45){this[_0x555a('0x14')]=_0x29ad45;io['to'](util[_0x555a('0x1e')]('user:%s',_0x59e2e4[_0x555a('0x8')]))[_0x555a('0x21')](_0x555a('0x22'),_0x59e2e4);io[_0x555a('0x21')](_0x555a('0x23'),_0x59e2e4);}};module[_0x555a('0x24')]=Agent; \ No newline at end of file diff --git a/server/services/ami/model/campaign.js b/server/services/ami/model/campaign.js index e664389..707c747 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 _0x2aa7=['dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','DESC','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','name','type','campaign','originated','ivrAnswerCallsDay','ivrTotalCallsDays','message','sendMessageOneNotActive','active','limitCalls','dialTimezone','dialGlobalInterval'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x2aa7,0xe4));var _0x72aa=function(_0x20b0fe,_0x3ebb0a){_0x20b0fe=_0x20b0fe-0x0;var _0x5c50cc=_0x2aa7[_0x20b0fe];return _0x5c50cc;};'use strict';function Campaign(_0x1fb44d){this['id']=_0x1fb44d['id']||0x0;this['name']=_0x1fb44d[_0x72aa('0x0')]||'';this[_0x72aa('0x1')]=_0x1fb44d[_0x72aa('0x1')]||_0x72aa('0x2');this[_0x72aa('0x3')]=0x0;this['temp']=0x0;this[_0x72aa('0x4')]=0x0;this[_0x72aa('0x5')]=0x0;this[_0x72aa('0x6')]='';this[_0x72aa('0x7')]=!![];this[_0x72aa('0x8')]=_0x1fb44d[_0x72aa('0x8')];this[_0x72aa('0x9')]=_0x1fb44d['limitCalls'];this[_0x72aa('0xa')]=_0x1fb44d[_0x72aa('0xa')]||null;this[_0x72aa('0xb')]=_0x1fb44d[_0x72aa('0xb')]?_0x1fb44d['dialGlobalInterval']:null;this['dialOriginateCallerIdName']=_0x1fb44d[_0x72aa('0xc')];this[_0x72aa('0xd')]=_0x1fb44d['dialOriginateCallerIdNumber'];this['dialOriginateTimeout']=_0x1fb44d[_0x72aa('0xe')]||0x1e;this[_0x72aa('0xf')]=_0x1fb44d[_0x72aa('0xf')];this[_0x72aa('0x10')]=_0x1fb44d[_0x72aa('0x10')];this[_0x72aa('0x11')]=_0x1fb44d['dialBusyMaxRetry'];this['dialBusyRetryFrequency']=_0x1fb44d[_0x72aa('0x12')];this['dialNoAnswerMaxRetry']=_0x1fb44d['dialNoAnswerMaxRetry'];this[_0x72aa('0x13')]=_0x1fb44d[_0x72aa('0x13')];this[_0x72aa('0x14')]=_0x1fb44d['dialGlobalMaxRetry'];this[_0x72aa('0x15')]=_0x1fb44d[_0x72aa('0x15')]||0x3;this[_0x72aa('0x16')]=_0x1fb44d[_0x72aa('0x16')]||0x96;this['dialDropMaxRetry']=_0x1fb44d[_0x72aa('0x17')]||0x3;this['dialDropRetryFrequency']=_0x1fb44d['dialDropRetryFrequency']||0x96;this[_0x72aa('0x18')]=_0x1fb44d['dialAbandonedMaxRetry']||0x3;this[_0x72aa('0x19')]=_0x1fb44d['dialAbandonedRetryFrequency']||0x96;this[_0x72aa('0x1a')]=_0x1fb44d[_0x72aa('0x1a')]||0x3;this[_0x72aa('0x1b')]=_0x1fb44d[_0x72aa('0x1b')]||0x96;this[_0x72aa('0x1c')]=_0x1fb44d[_0x72aa('0x1c')]||0x3;this[_0x72aa('0x1d')]=_0x1fb44d[_0x72aa('0x1d')]||0x96;this[_0x72aa('0x1e')]=_0x1fb44d['dialOrderByScheduledAt']||_0x72aa('0x1f');this[_0x72aa('0x20')]=_0x1fb44d['dialPrefix']||undefined;this[_0x72aa('0x21')]=_0x1fb44d['dialRandomLastDigitCallerIdNumber']||undefined;this[_0x72aa('0x22')]=_0x1fb44d[_0x72aa('0x22')]||undefined;this['TrunkBackup']=_0x1fb44d[_0x72aa('0x23')]?_0x1fb44d[_0x72aa('0x23')]:undefined;this['Trunk']=_0x1fb44d['Trunk']?_0x1fb44d[_0x72aa('0x24')]:undefined;this[_0x72aa('0x25')]=_0x1fb44d[_0x72aa('0x25')]?_0x1fb44d[_0x72aa('0x25')]:undefined;this[_0x72aa('0x26')]=_0x1fb44d[_0x72aa('0x26')]?_0x1fb44d['SquareProject']:undefined;this['dialQueueProject']=_0x1fb44d[_0x72aa('0x26')]?_0x1fb44d[_0x72aa('0x26')]['name']:undefined;this[_0x72aa('0x27')]=_0x1fb44d[_0x72aa('0x27')]||![];this[_0x72aa('0x28')]=_0x1fb44d[_0x72aa('0x28')];this[_0x72aa('0x29')]=_0x1fb44d['dialAMDGreeting'];this[_0x72aa('0x2a')]=_0x1fb44d[_0x72aa('0x2a')];this[_0x72aa('0x2b')]=_0x1fb44d[_0x72aa('0x2b')];this[_0x72aa('0x2c')]=_0x1fb44d[_0x72aa('0x2c')];this[_0x72aa('0x2d')]=_0x1fb44d[_0x72aa('0x2d')];this[_0x72aa('0x2e')]=_0x1fb44d[_0x72aa('0x2e')];this['dialAMDSilenceThreshold']=_0x1fb44d[_0x72aa('0x2f')];this['dialAMDMaximumWordLength']=_0x1fb44d['dialAMDMaximumWordLength'];}module['exports']=Campaign; \ No newline at end of file +var _0xc9d8=['dialQueueProject','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','name','type','campaign','ivrAnswerCallsDay','ivrTotalCallsDays','active','limitCalls','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','DESC','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject'];(function(_0x45c48f,_0x4aa891){var _0xaf5037=function(_0x3e3c1f){while(--_0x3e3c1f){_0x45c48f['push'](_0x45c48f['shift']());}};_0xaf5037(++_0x4aa891);}(_0xc9d8,0xc2));var _0x8c9d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc9d8[_0x3dd15e];return _0x231fd0;};'use strict';function Campaign(_0x230d61){this['id']=_0x230d61['id']||0x0;this[_0x8c9d('0x0')]=_0x230d61[_0x8c9d('0x0')]||'';this[_0x8c9d('0x1')]=_0x230d61['type']||_0x8c9d('0x2');this['originated']=0x0;this['temp']=0x0;this[_0x8c9d('0x3')]=0x0;this[_0x8c9d('0x4')]=0x0;this['message']='';this['sendMessageOneNotActive']=!![];this[_0x8c9d('0x5')]=_0x230d61[_0x8c9d('0x5')];this[_0x8c9d('0x6')]=_0x230d61[_0x8c9d('0x6')];this['dialTimezone']=_0x230d61['dialTimezone']||null;this[_0x8c9d('0x7')]=_0x230d61[_0x8c9d('0x7')]?_0x230d61[_0x8c9d('0x7')]:null;this[_0x8c9d('0x8')]=_0x230d61[_0x8c9d('0x8')];this[_0x8c9d('0x9')]=_0x230d61['dialOriginateCallerIdNumber'];this[_0x8c9d('0xa')]=_0x230d61[_0x8c9d('0xa')]||0x1e;this[_0x8c9d('0xb')]=_0x230d61['dialCongestionMaxRetry'];this[_0x8c9d('0xc')]=_0x230d61[_0x8c9d('0xc')];this[_0x8c9d('0xd')]=_0x230d61['dialBusyMaxRetry'];this[_0x8c9d('0xe')]=_0x230d61[_0x8c9d('0xe')];this[_0x8c9d('0xf')]=_0x230d61['dialNoAnswerMaxRetry'];this[_0x8c9d('0x10')]=_0x230d61[_0x8c9d('0x10')];this[_0x8c9d('0x11')]=_0x230d61[_0x8c9d('0x11')];this[_0x8c9d('0x12')]=_0x230d61[_0x8c9d('0x12')]||0x3;this[_0x8c9d('0x13')]=_0x230d61[_0x8c9d('0x13')]||0x96;this[_0x8c9d('0x14')]=_0x230d61[_0x8c9d('0x14')]||0x3;this[_0x8c9d('0x15')]=_0x230d61[_0x8c9d('0x15')]||0x96;this[_0x8c9d('0x16')]=_0x230d61[_0x8c9d('0x16')]||0x3;this[_0x8c9d('0x17')]=_0x230d61[_0x8c9d('0x17')]||0x96;this[_0x8c9d('0x18')]=_0x230d61[_0x8c9d('0x18')]||0x3;this['dialMachineRetryFrequency']=_0x230d61[_0x8c9d('0x19')]||0x96;this[_0x8c9d('0x1a')]=_0x230d61[_0x8c9d('0x1a')]||0x3;this['dialAgentRejectRetryFrequency']=_0x230d61[_0x8c9d('0x1b')]||0x96;this['dialOrderByScheduledAt']=_0x230d61['dialOrderByScheduledAt']||_0x8c9d('0x1c');this[_0x8c9d('0x1d')]=_0x230d61[_0x8c9d('0x1d')]||undefined;this[_0x8c9d('0x1e')]=_0x230d61[_0x8c9d('0x1e')]||undefined;this[_0x8c9d('0x1f')]=_0x230d61[_0x8c9d('0x1f')]||undefined;this[_0x8c9d('0x20')]=_0x230d61['TrunkBackup']?_0x230d61[_0x8c9d('0x20')]:undefined;this[_0x8c9d('0x21')]=_0x230d61[_0x8c9d('0x21')]?_0x230d61['Trunk']:undefined;this['Interval']=_0x230d61[_0x8c9d('0x22')]?_0x230d61[_0x8c9d('0x22')]:undefined;this[_0x8c9d('0x23')]=_0x230d61[_0x8c9d('0x23')]?_0x230d61[_0x8c9d('0x23')]:undefined;this[_0x8c9d('0x24')]=_0x230d61[_0x8c9d('0x23')]?_0x230d61[_0x8c9d('0x23')][_0x8c9d('0x0')]:undefined;this['dialAMDActive']=_0x230d61[_0x8c9d('0x25')]||![];this[_0x8c9d('0x26')]=_0x230d61[_0x8c9d('0x26')];this[_0x8c9d('0x27')]=_0x230d61[_0x8c9d('0x27')];this[_0x8c9d('0x28')]=_0x230d61[_0x8c9d('0x28')];this['dialAMDTotalAnalysisTime']=_0x230d61[_0x8c9d('0x29')];this[_0x8c9d('0x2a')]=_0x230d61[_0x8c9d('0x2a')];this['dialAMDBetweenWordsSilence']=_0x230d61['dialAMDBetweenWordsSilence'];this[_0x8c9d('0x2b')]=_0x230d61[_0x8c9d('0x2b')];this['dialAMDSilenceThreshold']=_0x230d61[_0x8c9d('0x2c')];this[_0x8c9d('0x2d')]=_0x230d61[_0x8c9d('0x2d')];}module['exports']=Campaign; \ No newline at end of file diff --git a/server/services/ami/model/channel.js b/server/services/ami/model/channel.js index d2ab6ef..f41c758 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 _0x1267=['channel','calleridname','connectedlinenum','connectedlinename','accountcode','context','uniqueid','linkedid','answered','answertime','endtime','unmanaged','lastapplication','duration','holdtime','type','tag','disposition','monitor','monitors','transfercalleridnum','transferconnectedlinenum','transferType','mohtime','exports','starttime'];(function(_0x3326d2,_0xda9655){var _0x5004b7=function(_0x2d3e30){while(--_0x2d3e30){_0x3326d2['push'](_0x3326d2['shift']());}};_0x5004b7(++_0xda9655);}(_0x1267,0xb5));var _0x7126=function(_0x448f4e,_0x258f8f){_0x448f4e=_0x448f4e-0x0;var _0x589b2c=_0x1267[_0x448f4e];return _0x589b2c;};'use strict';function Channel(){this[_0x7126('0x0')]=null;this[_0x7126('0x1')]='';this['destinationchannel']='';this['calleridnum']=0x0;this[_0x7126('0x2')]='';this[_0x7126('0x3')]=undefined;this[_0x7126('0x4')]=undefined;this[_0x7126('0x5')]=0x0;this[_0x7126('0x6')]='';this[_0x7126('0x7')]=0x0;this[_0x7126('0x8')]=0x0;this['exten']=0x0;this[_0x7126('0x9')]=![];this[_0x7126('0xa')]=null;this[_0x7126('0xb')]=null;this[_0x7126('0xc')]=![];this['abandoned']=![];this[_0x7126('0xd')]='';this['lastdata']='';this[_0x7126('0xe')]=0x0;this['billableseconds']=0x0;this[_0x7126('0xf')]=0x0;this[_0x7126('0x10')]=null;this[_0x7126('0x11')]=null;this[_0x7126('0x12')]=null;this[_0x7126('0x13')]=![];this['monitorFilename']=null;this['queue']=null;this[_0x7126('0x14')]=[];this[_0x7126('0x15')]=undefined;this[_0x7126('0x16')]=undefined;this[_0x7126('0x17')]=undefined;this[_0x7126('0x18')]=0x0;}module[_0x7126('0x19')]=Channel; \ No newline at end of file +var _0x7292=['queue','monitors','transfercalleridnum','transferconnectedlinenum','exports','starttime','channel','destinationchannel','calleridnum','calleridname','connectedlinenum','accountcode','context','uniqueid','linkedid','exten','answertime','endtime','unmanaged','abandoned','lastapplication','lastdata','billableseconds','type','monitor','monitorFilename'];(function(_0x15e1d3,_0xa81e3d){var _0x1b8c3c=function(_0xaa126a){while(--_0xaa126a){_0x15e1d3['push'](_0x15e1d3['shift']());}};_0x1b8c3c(++_0xa81e3d);}(_0x7292,0x6d));var _0x2729=function(_0x1ccdf7,_0x215d5a){_0x1ccdf7=_0x1ccdf7-0x0;var _0x52a0ae=_0x7292[_0x1ccdf7];return _0x52a0ae;};'use strict';function Channel(){this[_0x2729('0x0')]=null;this[_0x2729('0x1')]='';this[_0x2729('0x2')]='';this[_0x2729('0x3')]=0x0;this[_0x2729('0x4')]='';this[_0x2729('0x5')]=undefined;this['connectedlinename']=undefined;this[_0x2729('0x6')]=0x0;this[_0x2729('0x7')]='';this[_0x2729('0x8')]=0x0;this[_0x2729('0x9')]=0x0;this[_0x2729('0xa')]=0x0;this['answered']=![];this[_0x2729('0xb')]=null;this[_0x2729('0xc')]=null;this[_0x2729('0xd')]=![];this[_0x2729('0xe')]=![];this[_0x2729('0xf')]='';this[_0x2729('0x10')]='';this['duration']=0x0;this[_0x2729('0x11')]=0x0;this['holdtime']=0x0;this[_0x2729('0x12')]=null;this['tag']=null;this['disposition']=null;this[_0x2729('0x13')]=![];this[_0x2729('0x14')]=null;this[_0x2729('0x15')]=null;this[_0x2729('0x16')]=[];this[_0x2729('0x17')]=undefined;this[_0x2729('0x18')]=undefined;this['transferType']=undefined;this['mohtime']=0x0;}module[_0x2729('0x19')]=Channel; \ No newline at end of file diff --git a/server/services/ami/model/deskAccount.js b/server/services/ami/model/deskAccount.js index d1d6235..208d9d4 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 _0x6c8f=['remoteUri','authType','password','consumerKey','consumerSecret','token','tokenSecret','type','serverUrl','Configurations','exports','name','username'];(function(_0x439ebd,_0x52d087){var _0x3e6c51=function(_0x28b88e){while(--_0x28b88e){_0x439ebd['push'](_0x439ebd['shift']());}};_0x3e6c51(++_0x52d087);}(_0x6c8f,0x19e));var _0xf6c8=function(_0x47f7a6,_0x51552b){_0x47f7a6=_0x47f7a6-0x0;var _0x793094=_0x6c8f[_0x47f7a6];return _0x793094;};'use strict';function DeskAccount(_0x16eba2){this['id']=_0x16eba2['id']||0x0;this['name']=_0x16eba2[_0xf6c8('0x0')]||'';this[_0xf6c8('0x1')]=_0x16eba2['username']||'';this['remoteUri']=_0x16eba2[_0xf6c8('0x2')]||'';this[_0xf6c8('0x3')]=_0x16eba2[_0xf6c8('0x3')]||'';this[_0xf6c8('0x4')]=_0x16eba2[_0xf6c8('0x4')]||'';this['consumerKey']=_0x16eba2[_0xf6c8('0x5')]||'';this['consumerSecret']=_0x16eba2[_0xf6c8('0x6')]||'';this[_0xf6c8('0x7')]=_0x16eba2['token']||'';this[_0xf6c8('0x8')]=_0x16eba2['tokenSecret']||'';this[_0xf6c8('0x9')]=_0x16eba2[_0xf6c8('0x9')]||'';this['serverUrl']=_0x16eba2[_0xf6c8('0xa')]||'';this[_0xf6c8('0xb')]=_0x16eba2[_0xf6c8('0xb')]||{};}module[_0xf6c8('0xc')]=DeskAccount; \ No newline at end of file +var _0x02bd=['tokenSecret','type','serverUrl','Configurations','exports','name','username','remoteUri','authType','password','consumerKey','consumerSecret','token'];(function(_0x3f5102,_0x4797aa){var _0x1835fa=function(_0x114ddb){while(--_0x114ddb){_0x3f5102['push'](_0x3f5102['shift']());}};_0x1835fa(++_0x4797aa);}(_0x02bd,0x1bf));var _0xd02b=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x02bd[_0x4b369d];return _0x571a98;};'use strict';function DeskAccount(_0x4ddba0){this['id']=_0x4ddba0['id']||0x0;this[_0xd02b('0x0')]=_0x4ddba0[_0xd02b('0x0')]||'';this[_0xd02b('0x1')]=_0x4ddba0[_0xd02b('0x1')]||'';this[_0xd02b('0x2')]=_0x4ddba0[_0xd02b('0x2')]||'';this[_0xd02b('0x3')]=_0x4ddba0['authType']||'';this[_0xd02b('0x4')]=_0x4ddba0['password']||'';this[_0xd02b('0x5')]=_0x4ddba0['consumerKey']||'';this[_0xd02b('0x6')]=_0x4ddba0[_0xd02b('0x6')]||'';this[_0xd02b('0x7')]=_0x4ddba0[_0xd02b('0x7')]||'';this[_0xd02b('0x8')]=_0x4ddba0[_0xd02b('0x8')]||'';this[_0xd02b('0x9')]=_0x4ddba0[_0xd02b('0x9')]||'';this[_0xd02b('0xa')]=_0x4ddba0[_0xd02b('0xa')]||'';this[_0xd02b('0xb')]=_0x4ddba0[_0xd02b('0xb')]||{};}module[_0xd02b('0xc')]=DeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/dynamics365Account.js b/server/services/ami/model/dynamics365Account.js index edc29e6..c716e44 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 _0xc1fd=['name','username','password','remoteUri','tenantId','clientId','clientSecret','modernAuthentication','Configurations','CloudProvider','exports'];(function(_0x23e25b,_0x4f60a0){var _0x933e34=function(_0x3fe3e){while(--_0x3fe3e){_0x23e25b['push'](_0x23e25b['shift']());}};_0x933e34(++_0x4f60a0);}(_0xc1fd,0xbb));var _0xdc1f=function(_0x4ba74e,_0x51fdbf){_0x4ba74e=_0x4ba74e-0x0;var _0x2b137b=_0xc1fd[_0x4ba74e];return _0x2b137b;};'use strict';function Dynamics365Account(_0x4875d5){this['id']=_0x4875d5['id']||0x0;this[_0xdc1f('0x0')]=_0x4875d5[_0xdc1f('0x0')]||'';this[_0xdc1f('0x1')]=_0x4875d5[_0xdc1f('0x1')]||'';this['password']=_0x4875d5[_0xdc1f('0x2')]||'';this['remoteUri']=_0x4875d5[_0xdc1f('0x3')]||'';this[_0xdc1f('0x4')]=_0x4875d5[_0xdc1f('0x4')]||'';this[_0xdc1f('0x5')]=_0x4875d5['clientId']||'';this[_0xdc1f('0x6')]=_0x4875d5[_0xdc1f('0x6')]||{};this['serverUrl']=_0x4875d5['serverUrl']||'';this[_0xdc1f('0x7')]=_0x4875d5[_0xdc1f('0x7')]||![];this['Configurations']=_0x4875d5[_0xdc1f('0x8')]||{};this[_0xdc1f('0x9')]=_0x4875d5[_0xdc1f('0x9')]||{};}module[_0xdc1f('0xa')]=Dynamics365Account; \ No newline at end of file +var _0x5696=['clientId','clientSecret','serverUrl','modernAuthentication','Configurations','CloudProvider','name','username','password','remoteUri'];(function(_0x4d8023,_0x201da7){var _0x723969=function(_0x3c206e){while(--_0x3c206e){_0x4d8023['push'](_0x4d8023['shift']());}};_0x723969(++_0x201da7);}(_0x5696,0x1b4));var _0x6569=function(_0xda7efc,_0x33708c){_0xda7efc=_0xda7efc-0x0;var _0x5cdf85=_0x5696[_0xda7efc];return _0x5cdf85;};'use strict';function Dynamics365Account(_0x2c2a41){this['id']=_0x2c2a41['id']||0x0;this[_0x6569('0x0')]=_0x2c2a41[_0x6569('0x0')]||'';this[_0x6569('0x1')]=_0x2c2a41[_0x6569('0x1')]||'';this[_0x6569('0x2')]=_0x2c2a41['password']||'';this[_0x6569('0x3')]=_0x2c2a41['remoteUri']||'';this['tenantId']=_0x2c2a41['tenantId']||'';this[_0x6569('0x4')]=_0x2c2a41[_0x6569('0x4')]||'';this[_0x6569('0x5')]=_0x2c2a41[_0x6569('0x5')]||{};this[_0x6569('0x6')]=_0x2c2a41['serverUrl']||'';this['modernAuthentication']=_0x2c2a41[_0x6569('0x7')]||![];this[_0x6569('0x8')]=_0x2c2a41['Configurations']||{};this[_0x6569('0x9')]=_0x2c2a41['CloudProvider']||{};}module['exports']=Dynamics365Account; \ No newline at end of file diff --git a/server/services/ami/model/faxAccount.js b/server/services/ami/model/faxAccount.js index 8ab8b31..947e798 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 _0xdb47=['t38timeout','tech','SIP','Trunk','ListId','key','exports','name','description','ecm','localstationid','maxrate','modem','gateway','faxdetect'];(function(_0x50f66c,_0x6ce2da){var _0x2d612c=function(_0x50c1ae){while(--_0x50c1ae){_0x50f66c['push'](_0x50f66c['shift']());}};_0x2d612c(++_0x6ce2da);}(_0xdb47,0x16f));var _0x7db4=function(_0x22b02e,_0x27861c){_0x22b02e=_0x22b02e-0x0;var _0x417a4a=_0xdb47[_0x22b02e];return _0x417a4a;};'use strict';function FaxAccount(_0x2cd7f9){this['id']=_0x2cd7f9['id']||0x0;this[_0x7db4('0x0')]=_0x2cd7f9['name']||'';this[_0x7db4('0x1')]=_0x2cd7f9[_0x7db4('0x1')];this['ecm']=_0x2cd7f9[_0x7db4('0x2')];this['headerinfo']=_0x2cd7f9['headerinfo'];this[_0x7db4('0x3')]=_0x2cd7f9[_0x7db4('0x3')];this['minrate']=_0x2cd7f9['minrate']||0x960;this[_0x7db4('0x4')]=_0x2cd7f9[_0x7db4('0x4')]||0x3840;this[_0x7db4('0x5')]=_0x2cd7f9[_0x7db4('0x5')]||'v17,v27,v29';this['gateway']=_0x2cd7f9[_0x7db4('0x6')]||'no';this[_0x7db4('0x7')]=_0x2cd7f9['faxdetect']||'no';this[_0x7db4('0x8')]=_0x2cd7f9['t38timeout']||0x1388;this[_0x7db4('0x9')]=_0x2cd7f9[_0x7db4('0x9')]||_0x7db4('0xa');this[_0x7db4('0xb')]=_0x2cd7f9[_0x7db4('0xb')]?_0x2cd7f9[_0x7db4('0xb')]:undefined;this[_0x7db4('0xc')]=_0x2cd7f9['ListId'];this[_0x7db4('0xd')]=_0x2cd7f9[_0x7db4('0xd')];}module[_0x7db4('0xe')]=FaxAccount; \ No newline at end of file +var _0xd3e1=['localstationid','minrate','maxrate','modem','v17,v27,v29','gateway','faxdetect','t38timeout','tech','SIP','Trunk','ListId','key','exports','name','description','ecm','headerinfo'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0xd3e1,0x7a));var _0x1d3e=function(_0x571c1e,_0x3b5f56){_0x571c1e=_0x571c1e-0x0;var _0x4b2fd9=_0xd3e1[_0x571c1e];return _0x4b2fd9;};'use strict';function FaxAccount(_0x1e26f3){this['id']=_0x1e26f3['id']||0x0;this[_0x1d3e('0x0')]=_0x1e26f3[_0x1d3e('0x0')]||'';this[_0x1d3e('0x1')]=_0x1e26f3[_0x1d3e('0x1')];this[_0x1d3e('0x2')]=_0x1e26f3[_0x1d3e('0x2')];this[_0x1d3e('0x3')]=_0x1e26f3[_0x1d3e('0x3')];this[_0x1d3e('0x4')]=_0x1e26f3[_0x1d3e('0x4')];this[_0x1d3e('0x5')]=_0x1e26f3['minrate']||0x960;this[_0x1d3e('0x6')]=_0x1e26f3[_0x1d3e('0x6')]||0x3840;this[_0x1d3e('0x7')]=_0x1e26f3[_0x1d3e('0x7')]||_0x1d3e('0x8');this['gateway']=_0x1e26f3[_0x1d3e('0x9')]||'no';this['faxdetect']=_0x1e26f3[_0x1d3e('0xa')]||'no';this[_0x1d3e('0xb')]=_0x1e26f3[_0x1d3e('0xb')]||0x1388;this[_0x1d3e('0xc')]=_0x1e26f3[_0x1d3e('0xc')]||_0x1d3e('0xd');this['Trunk']=_0x1e26f3[_0x1d3e('0xe')]?_0x1e26f3[_0x1d3e('0xe')]:undefined;this[_0x1d3e('0xf')]=_0x1e26f3[_0x1d3e('0xf')];this['key']=_0x1e26f3[_0x1d3e('0x10')];}module[_0x1d3e('0x11')]=FaxAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshdeskAccount.js b/server/services/ami/model/freshdeskAccount.js index 761fe57..a5d8783 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 _0x0fc8=['Configurations','exports','name','username','apiKey','token','serverUrl'];(function(_0x34cfcd,_0x360e5a){var _0x2f961e=function(_0x3d1b5a){while(--_0x3d1b5a){_0x34cfcd['push'](_0x34cfcd['shift']());}};_0x2f961e(++_0x360e5a);}(_0x0fc8,0x79));var _0x80fc=function(_0x53b413,_0x50e8ed){_0x53b413=_0x53b413-0x0;var _0x495f1d=_0x0fc8[_0x53b413];return _0x495f1d;};'use strict';function FreshdeskAccount(_0x2dd2c8){this['id']=_0x2dd2c8['id']||0x0;this['name']=_0x2dd2c8[_0x80fc('0x0')]||'';this['username']=_0x2dd2c8[_0x80fc('0x1')]||'';this[_0x80fc('0x2')]=_0x2dd2c8[_0x80fc('0x3')]||'';this['remoteUri']=_0x2dd2c8['remoteUri']||'';this[_0x80fc('0x4')]=_0x2dd2c8[_0x80fc('0x4')]||'';this[_0x80fc('0x5')]=_0x2dd2c8[_0x80fc('0x5')]||{};}module[_0x80fc('0x6')]=FreshdeskAccount; \ No newline at end of file +var _0x2ce6=['username','apiKey','token','remoteUri','serverUrl','Configurations','exports','name'];(function(_0x104ada,_0xc16fff){var _0x70ab44=function(_0x5f2d8b){while(--_0x5f2d8b){_0x104ada['push'](_0x104ada['shift']());}};_0x70ab44(++_0xc16fff);}(_0x2ce6,0x1d7));var _0x62ce=function(_0x33e566,_0x3e90f4){_0x33e566=_0x33e566-0x0;var _0x828b80=_0x2ce6[_0x33e566];return _0x828b80;};'use strict';function FreshdeskAccount(_0x4e59b1){this['id']=_0x4e59b1['id']||0x0;this[_0x62ce('0x0')]=_0x4e59b1[_0x62ce('0x0')]||'';this[_0x62ce('0x1')]=_0x4e59b1[_0x62ce('0x1')]||'';this[_0x62ce('0x2')]=_0x4e59b1[_0x62ce('0x3')]||'';this[_0x62ce('0x4')]=_0x4e59b1[_0x62ce('0x4')]||'';this[_0x62ce('0x5')]=_0x4e59b1[_0x62ce('0x5')]||'';this[_0x62ce('0x6')]=_0x4e59b1[_0x62ce('0x6')]||{};}module[_0x62ce('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 49dcad6..68aa962 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 _0xf842=['Configurations','exports','name','username','apiKey','token','remoteUri','serverUrl'];(function(_0x39bc06,_0x1d91af){var _0x40dc5f=function(_0x29e8be){while(--_0x29e8be){_0x39bc06['push'](_0x39bc06['shift']());}};_0x40dc5f(++_0x1d91af);}(_0xf842,0x172));var _0x2f84=function(_0x503950,_0x5022eb){_0x503950=_0x503950-0x0;var _0x1657a9=_0xf842[_0x503950];return _0x1657a9;};'use strict';function FreshsalesAccount(_0x3344){this['id']=_0x3344['id']||0x0;this[_0x2f84('0x0')]=_0x3344[_0x2f84('0x0')]||'';this[_0x2f84('0x1')]=_0x3344['username']||'';this[_0x2f84('0x2')]=_0x3344[_0x2f84('0x3')]||'';this[_0x2f84('0x4')]=_0x3344[_0x2f84('0x4')]||'';this[_0x2f84('0x5')]=_0x3344['serverUrl']||'';this[_0x2f84('0x6')]=_0x3344[_0x2f84('0x6')]||{};}module[_0x2f84('0x7')]=FreshsalesAccount; \ No newline at end of file +var _0xab3f=['serverUrl','Configurations','name','username','apiKey','token','remoteUri'];(function(_0x1c36f9,_0x14139c){var _0x36d105=function(_0x905955){while(--_0x905955){_0x1c36f9['push'](_0x1c36f9['shift']());}};_0x36d105(++_0x14139c);}(_0xab3f,0x72));var _0xfab3=function(_0x48d4c5,_0xc0140e){_0x48d4c5=_0x48d4c5-0x0;var _0x258d98=_0xab3f[_0x48d4c5];return _0x258d98;};'use strict';function FreshsalesAccount(_0x2cd0f4){this['id']=_0x2cd0f4['id']||0x0;this['name']=_0x2cd0f4[_0xfab3('0x0')]||'';this[_0xfab3('0x1')]=_0x2cd0f4[_0xfab3('0x1')]||'';this[_0xfab3('0x2')]=_0x2cd0f4[_0xfab3('0x3')]||'';this[_0xfab3('0x4')]=_0x2cd0f4[_0xfab3('0x4')]||'';this[_0xfab3('0x5')]=_0x2cd0f4[_0xfab3('0x5')]||'';this[_0xfab3('0x6')]=_0x2cd0f4[_0xfab3('0x6')]||{};}module['exports']=FreshsalesAccount; \ No newline at end of file diff --git a/server/services/ami/model/queueReport.js b/server/services/ami/model/queueReport.js index 5b03fb5..9290892 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 _0x9b9c=['accountcode','exten','priority','holdtime','assigned','lastAssignedTo','motionChannel','routealias','mohtime','variables','exports','type','inbound','calleridnum','calleridname','queue','position','count','queuecallercomplete','queuecallercompleteAt','channel','connectedlinename'];(function(_0x18b8ec,_0x7b7c07){var _0x2a1df5=function(_0x511837){while(--_0x511837){_0x18b8ec['push'](_0x18b8ec['shift']());}};_0x2a1df5(++_0x7b7c07);}(_0x9b9c,0x129));var _0xc9b9=function(_0x4f6021,_0x23ccfa){_0x4f6021=_0x4f6021-0x0;var _0x398dbe=_0x9b9c[_0x4f6021];return _0x398dbe;};'use strict';function QueueReport(){this[_0xc9b9('0x0')]=_0xc9b9('0x1');this['uniqueid']='';this[_0xc9b9('0x2')]='';this[_0xc9b9('0x3')]='';this[_0xc9b9('0x4')]='';this['queuecallerjoinAt']=null;this['queuecallerleaveAt']=null;this[_0xc9b9('0x5')]=0x1;this[_0xc9b9('0x6')]=0x1;this['queuecallerabandon']=![];this['queuecallerabandonAt']=null;this[_0xc9b9('0x7')]=![];this[_0xc9b9('0x8')]=null;this['queuecallerexit']=![];this['queuecallerexitAt']=null;this['originalposition']=0x1;this[_0xc9b9('0x9')]='';this['connectedlinenum']='';this[_0xc9b9('0xa')]='';this[_0xc9b9('0xb')]='';this['context']='';this[_0xc9b9('0xc')]='';this[_0xc9b9('0xd')]='';this[_0xc9b9('0xe')]=0x0;this[_0xc9b9('0xf')]=![];this[_0xc9b9('0x10')]='';this[_0xc9b9('0x11')]='voice';this[_0xc9b9('0x12')]=null;this[_0xc9b9('0x13')]=0x0;this[_0xc9b9('0x14')]={};}module[_0xc9b9('0x15')]=QueueReport; \ No newline at end of file +var _0x44ef=['calleridname','queuecallerjoinAt','queuecallerleaveAt','position','count','queuecallerabandonAt','queuecallercomplete','queuecallerexit','queuecallerexitAt','channel','connectedlinename','accountcode','context','exten','holdtime','assigned','lastAssignedTo','motionChannel','voice','routealias','variables','exports','type','inbound','calleridnum'];(function(_0x2491a0,_0x5528d7){var _0x3d21e9=function(_0x54d373){while(--_0x54d373){_0x2491a0['push'](_0x2491a0['shift']());}};_0x3d21e9(++_0x5528d7);}(_0x44ef,0x142));var _0xf44e=function(_0x1fe605,_0x40b736){_0x1fe605=_0x1fe605-0x0;var _0x3a6f6c=_0x44ef[_0x1fe605];return _0x3a6f6c;};'use strict';function QueueReport(){this[_0xf44e('0x0')]=_0xf44e('0x1');this['uniqueid']='';this[_0xf44e('0x2')]='';this[_0xf44e('0x3')]='';this['queue']='';this[_0xf44e('0x4')]=null;this[_0xf44e('0x5')]=null;this[_0xf44e('0x6')]=0x1;this[_0xf44e('0x7')]=0x1;this['queuecallerabandon']=![];this[_0xf44e('0x8')]=null;this[_0xf44e('0x9')]=![];this['queuecallercompleteAt']=null;this[_0xf44e('0xa')]=![];this[_0xf44e('0xb')]=null;this['originalposition']=0x1;this[_0xf44e('0xc')]='';this['connectedlinenum']='';this[_0xf44e('0xd')]='';this[_0xf44e('0xe')]='';this[_0xf44e('0xf')]='';this[_0xf44e('0x10')]='';this['priority']='';this[_0xf44e('0x11')]=0x0;this[_0xf44e('0x12')]=![];this[_0xf44e('0x13')]='';this[_0xf44e('0x14')]=_0xf44e('0x15');this[_0xf44e('0x16')]=null;this['mohtime']=0x0;this[_0xf44e('0x17')]={};}module[_0xf44e('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 a4430ac..45573df 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 _0x9a69=['remoteUri','password','clientId','clientSecret','type','integrationTab','serverUrl','Configurations','name','username'];(function(_0x1699e9,_0x1f2652){var _0x14b104=function(_0x319079){while(--_0x319079){_0x1699e9['push'](_0x1699e9['shift']());}};_0x14b104(++_0x1f2652);}(_0x9a69,0x9e));var _0x99a6=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x9a69[_0x2641f9];return _0x585741;};'use strict';function SalesforceAccount(_0x3d45b6){this['id']=_0x3d45b6['id']||0x0;this[_0x99a6('0x0')]=_0x3d45b6[_0x99a6('0x0')]||'';this[_0x99a6('0x1')]=_0x3d45b6[_0x99a6('0x1')]||'';this[_0x99a6('0x2')]=_0x3d45b6[_0x99a6('0x2')]||'';this[_0x99a6('0x3')]=_0x3d45b6[_0x99a6('0x3')]||'';this[_0x99a6('0x4')]=_0x3d45b6['clientId']||'';this[_0x99a6('0x5')]=_0x3d45b6[_0x99a6('0x5')]||'';this['securityToken']=_0x3d45b6['securityToken']||'';this[_0x99a6('0x6')]=_0x3d45b6[_0x99a6('0x6')]||_0x99a6('0x7');this[_0x99a6('0x8')]=_0x3d45b6[_0x99a6('0x8')]||'';this[_0x99a6('0x9')]=_0x3d45b6['Configurations']||{};}module['exports']=SalesforceAccount; \ No newline at end of file +var _0x4c41=['type','serverUrl','Configurations','exports','name','remoteUri','password','clientId','clientSecret'];(function(_0x5a95fa,_0x4a2fc9){var _0x1a61b8=function(_0x59f119){while(--_0x59f119){_0x5a95fa['push'](_0x5a95fa['shift']());}};_0x1a61b8(++_0x4a2fc9);}(_0x4c41,0xf7));var _0x14c4=function(_0x195894,_0x39f89f){_0x195894=_0x195894-0x0;var _0x2c1cbf=_0x4c41[_0x195894];return _0x2c1cbf;};'use strict';function SalesforceAccount(_0x536b58){this['id']=_0x536b58['id']||0x0;this[_0x14c4('0x0')]=_0x536b58['name']||'';this['username']=_0x536b58['username']||'';this['remoteUri']=_0x536b58[_0x14c4('0x1')]||'';this[_0x14c4('0x2')]=_0x536b58['password']||'';this[_0x14c4('0x3')]=_0x536b58[_0x14c4('0x3')]||'';this['clientSecret']=_0x536b58[_0x14c4('0x4')]||'';this['securityToken']=_0x536b58['securityToken']||'';this['type']=_0x536b58[_0x14c4('0x5')]||'integrationTab';this['serverUrl']=_0x536b58[_0x14c4('0x6')]||'';this['Configurations']=_0x536b58[_0x14c4('0x7')]||{};}module[_0x14c4('0x8')]=SalesforceAccount; \ No newline at end of file diff --git a/server/services/ami/model/servicenowAccount.js b/server/services/ami/model/servicenowAccount.js index e9fddd3..6b90666 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 _0x897f=['Configurations','name','username','password','remoteUri','serverUrl'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x897f,0x12d));var _0xf897=function(_0x279e6f,_0x566574){_0x279e6f=_0x279e6f-0x0;var _0x489a5f=_0x897f[_0x279e6f];return _0x489a5f;};'use strict';function ServicenowAccount(_0x5ba042){this['id']=_0x5ba042['id']||0x0;this[_0xf897('0x0')]=_0x5ba042['name']||'';this['username']=_0x5ba042[_0xf897('0x1')]||'';this[_0xf897('0x2')]=_0x5ba042[_0xf897('0x2')]||'';this[_0xf897('0x3')]=_0x5ba042['remoteUri']||'';this[_0xf897('0x4')]=_0x5ba042[_0xf897('0x4')]||'';this[_0xf897('0x5')]=_0x5ba042[_0xf897('0x5')]||{};}module['exports']=ServicenowAccount; \ No newline at end of file +var _0x4a92=['name','username','password','remoteUri','serverUrl','Configurations','exports'];(function(_0x4f8ef3,_0x27f00a){var _0x15471e=function(_0x3b20a1){while(--_0x3b20a1){_0x4f8ef3['push'](_0x4f8ef3['shift']());}};_0x15471e(++_0x27f00a);}(_0x4a92,0x85));var _0x24a9=function(_0x5d6482,_0x1c9b00){_0x5d6482=_0x5d6482-0x0;var _0x32e681=_0x4a92[_0x5d6482];return _0x32e681;};'use strict';function ServicenowAccount(_0x458e8f){this['id']=_0x458e8f['id']||0x0;this['name']=_0x458e8f[_0x24a9('0x0')]||'';this['username']=_0x458e8f[_0x24a9('0x1')]||'';this[_0x24a9('0x2')]=_0x458e8f['password']||'';this[_0x24a9('0x3')]=_0x458e8f[_0x24a9('0x3')]||'';this[_0x24a9('0x4')]=_0x458e8f[_0x24a9('0x4')]||'';this['Configurations']=_0x458e8f[_0x24a9('0x5')]||{};}module[_0x24a9('0x6')]=ServicenowAccount; \ No newline at end of file diff --git a/server/services/ami/model/sugarcrmAccount.js b/server/services/ami/model/sugarcrmAccount.js index e93a469..6247326 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 _0xa7c4=['name','username','password','serverUrl','Configurations','exports'];(function(_0x1910c8,_0x2c13c6){var _0x335da0=function(_0x4b6332){while(--_0x4b6332){_0x1910c8['push'](_0x1910c8['shift']());}};_0x335da0(++_0x2c13c6);}(_0xa7c4,0x1b0));var _0x4a7c=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa7c4[_0x3dd15e];return _0x231fd0;};'use strict';function SugarcrmAccount(_0x4edc78){this['id']=_0x4edc78['id']||0x0;this[_0x4a7c('0x0')]=_0x4edc78[_0x4a7c('0x0')]||'';this[_0x4a7c('0x1')]=_0x4edc78['username']||'';this[_0x4a7c('0x2')]=_0x4edc78[_0x4a7c('0x2')]||'';this['remoteUri']=_0x4edc78['remoteUri']||'';this[_0x4a7c('0x3')]=_0x4edc78[_0x4a7c('0x3')]||'';this[_0x4a7c('0x4')]=_0x4edc78[_0x4a7c('0x4')]||{};}module[_0x4a7c('0x5')]=SugarcrmAccount; \ No newline at end of file +var _0xe9fd=['password','remoteUri','serverUrl','Configurations','exports','name','username'];(function(_0x13c69c,_0x5098e1){var _0x61b436=function(_0x2823df){while(--_0x2823df){_0x13c69c['push'](_0x13c69c['shift']());}};_0x61b436(++_0x5098e1);}(_0xe9fd,0x14e));var _0xde9f=function(_0x102970,_0x205fa4){_0x102970=_0x102970-0x0;var _0x1f5219=_0xe9fd[_0x102970];return _0x1f5219;};'use strict';function SugarcrmAccount(_0x3773a9){this['id']=_0x3773a9['id']||0x0;this['name']=_0x3773a9[_0xde9f('0x0')]||'';this[_0xde9f('0x1')]=_0x3773a9[_0xde9f('0x1')]||'';this[_0xde9f('0x2')]=_0x3773a9[_0xde9f('0x2')]||'';this[_0xde9f('0x3')]=_0x3773a9[_0xde9f('0x3')]||'';this[_0xde9f('0x4')]=_0x3773a9[_0xde9f('0x4')]||'';this['Configurations']=_0x3773a9[_0xde9f('0x5')]||{};}module[_0xde9f('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 7084578..f31f89d 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 _0xa68c=['accountcode','state','unknown','stateTime','status','exports','name'];(function(_0x40bded,_0x379ee1){var _0x2ea61f=function(_0x29e75f){while(--_0x29e75f){_0x40bded['push'](_0x40bded['shift']());}};_0x2ea61f(++_0x379ee1);}(_0xa68c,0x187));var _0xca68=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0xa68c[_0x3b380d];return _0x54502b;};'use strict';function Telephone(_0x542521){this['id']=_0x542521['id']||0x0;this[_0xca68('0x0')]=_0x542521[_0xca68('0x0')]||'';this[_0xca68('0x1')]=_0x542521[_0xca68('0x1')]||'';this[_0xca68('0x2')]=_0xca68('0x3');this[_0xca68('0x4')]=0x0;this[_0xca68('0x5')]='unknown';this['address']='';}module[_0xca68('0x6')]=Telephone; \ No newline at end of file +var _0x3f9b=['state','unknown','address','exports','name','accountcode'];(function(_0x310d30,_0x5e7481){var _0x2975e0=function(_0x2b719d){while(--_0x2b719d){_0x310d30['push'](_0x310d30['shift']());}};_0x2975e0(++_0x5e7481);}(_0x3f9b,0x11e));var _0xb3f9=function(_0x4ab768,_0x364ab2){_0x4ab768=_0x4ab768-0x0;var _0x561258=_0x3f9b[_0x4ab768];return _0x561258;};'use strict';function Telephone(_0x47caab){this['id']=_0x47caab['id']||0x0;this['name']=_0x47caab[_0xb3f9('0x0')]||'';this['accountcode']=_0x47caab[_0xb3f9('0x1')]||'';this[_0xb3f9('0x2')]='unknown';this['stateTime']=0x0;this['status']=_0xb3f9('0x3');this[_0xb3f9('0x4')]='';}module[_0xb3f9('0x5')]=Telephone; \ No newline at end of file diff --git a/server/services/ami/model/template.js b/server/services/ami/model/template.js index f314a28..059287a 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(_0x4b4717,_0x12a287){var _0x15b0d2=function(_0x66602){while(--_0x66602){_0x4b4717['push'](_0x4b4717['shift']());}};_0x15b0d2(++_0x12a287);}(_0xa9e0,0x123));var _0x0a9e=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xa9e0[_0x19e35c];return _0x3e1fe8;};'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(_0x408cd8,_0x1329dc){var _0x2a3288=function(_0x2c55af){while(--_0x2c55af){_0x408cd8['push'](_0x408cd8['shift']());}};_0x2a3288(++_0x1329dc);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2b10c6,_0x185590){_0x2b10c6=_0x2b10c6-0x0;var _0x3789d2=_0xa9e0[_0x2b10c6];return _0x3789d2;};'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 b1d90d4..90920bd 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(_0x22bdd3,_0x552e50){var _0x44d9d9=function(_0x2b4ab9){while(--_0x2b4ab9){_0x22bdd3['push'](_0x22bdd3['shift']());}};_0x44d9d9(++_0x552e50);}(_0xbaf0,0x12a));var _0x0baf=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xbaf0[_0x14add3];return _0x4a174f;};'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(_0x426438,_0x48b0dc){var _0x393cb4=function(_0x3c17c7){while(--_0x3c17c7){_0x426438['push'](_0x426438['shift']());}};_0x393cb4(++_0x48b0dc);}(_0xda2d,0x102));var _0xdda2=function(_0x39984e,_0x224977){_0x39984e=_0x39984e-0x0;var _0x40bb6b=_0xda2d[_0x39984e];return _0x40bb6b;};'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 b8d6161..42164b8 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 _0x1458=['stateRegistry','registrationtime','defaultuser','exports','active','name','state','unknown','stateTime','registry','indexOf','split','host','port','domain','refresh'];(function(_0x97f96f,_0x1a3d1b){var _0x41af19=function(_0x4cc24f){while(--_0x4cc24f){_0x97f96f['push'](_0x97f96f['shift']());}};_0x41af19(++_0x1a3d1b);}(_0x1458,0x144));var _0x8145=function(_0x4ff41c,_0x483c21){_0x4ff41c=_0x4ff41c-0x0;var _0x275644=_0x1458[_0x4ff41c];return _0x275644;};'use strict';function Trunk(_0x334e3c){this['id']=_0x334e3c['id']||0x0;this[_0x8145('0x0')]=_0x334e3c['active']||![];this['name']=_0x334e3c[_0x8145('0x1')]||'';this[_0x8145('0x2')]=_0x8145('0x3');this[_0x8145('0x4')]=0x0;this['status']='unknown';this[_0x8145('0x5')]=_0x334e3c[_0x8145('0x5')]&&_0x334e3c['registry'][_0x8145('0x6')](':')?_0x334e3c[_0x8145('0x5')][_0x8145('0x7')](':')[0x0]:'';this[_0x8145('0x8')]='';this[_0x8145('0x9')]='';this[_0x8145('0xa')]='';this['domainport']='';this[_0x8145('0xb')]='';this[_0x8145('0xc')]=_0x8145('0x3');this[_0x8145('0xd')]='';this['address']='';this[_0x8145('0xe')]=_0x334e3c[_0x8145('0xe')]||'';}module[_0x8145('0xf')]=Trunk; \ No newline at end of file +var _0x12a8=['stateTime','registry','indexOf','host','port','domain','domainport','refresh','registrationtime','address','defaultuser','exports','active','name','state','unknown'];(function(_0xdc754d,_0x4706f7){var _0x4c3eaa=function(_0x5de152){while(--_0x5de152){_0xdc754d['push'](_0xdc754d['shift']());}};_0x4c3eaa(++_0x4706f7);}(_0x12a8,0x17c));var _0x812a=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x12a8[_0x57b54c];return _0x59cc19;};'use strict';function Trunk(_0x10d8ce){this['id']=_0x10d8ce['id']||0x0;this[_0x812a('0x0')]=_0x10d8ce[_0x812a('0x0')]||![];this[_0x812a('0x1')]=_0x10d8ce[_0x812a('0x1')]||'';this[_0x812a('0x2')]=_0x812a('0x3');this[_0x812a('0x4')]=0x0;this['status']=_0x812a('0x3');this[_0x812a('0x5')]=_0x10d8ce['registry']&&_0x10d8ce[_0x812a('0x5')][_0x812a('0x6')](':')?_0x10d8ce[_0x812a('0x5')]['split'](':')[0x0]:'';this[_0x812a('0x7')]='';this[_0x812a('0x8')]='';this[_0x812a('0x9')]='';this[_0x812a('0xa')]='';this[_0x812a('0xb')]='';this['stateRegistry']=_0x812a('0x3');this[_0x812a('0xc')]='';this[_0x812a('0xd')]='';this[_0x812a('0xe')]=_0x10d8ce[_0x812a('0xe')]||'';}module[_0x812a('0xf')]=Trunk; \ No newline at end of file diff --git a/server/services/ami/model/voiceExtension.js b/server/services/ami/model/voiceExtension.js index 3c0b9aa..bdaba85 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 _0x7459=['recordingFormat','none','mandatoryDisposition','exten'];(function(_0x48c5ee,_0x293504){var _0xb039b=function(_0x5e47f6){while(--_0x5e47f6){_0x48c5ee['push'](_0x48c5ee['shift']());}};_0xb039b(++_0x293504);}(_0x7459,0x173));var _0x9745=function(_0x3dd67,_0xdef602){_0x3dd67=_0x3dd67-0x0;var _0x2b33ea=_0x7459[_0x3dd67];return _0x2b33ea;};'use strict';function voiceExtension(_0x59d506){this['id']=_0x59d506['id']||0x0;this[_0x9745('0x0')]=_0x59d506[_0x9745('0x0')]||'';this[_0x9745('0x1')]=_0x59d506['recordingFormat']||_0x9745('0x2');this['mandatoryDisposition']=_0x59d506[_0x9745('0x3')]||![];}module['exports']=voiceExtension; \ No newline at end of file +var _0x22b5=['none','mandatoryDisposition','exports','exten','recordingFormat'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x22b5,0x12a));var _0x522b=function(_0x3cb7dd,_0xe37eef){_0x3cb7dd=_0x3cb7dd-0x0;var _0x19a965=_0x22b5[_0x3cb7dd];return _0x19a965;};'use strict';function voiceExtension(_0x1c7a9f){this['id']=_0x1c7a9f['id']||0x0;this[_0x522b('0x0')]=_0x1c7a9f[_0x522b('0x0')]||'';this[_0x522b('0x1')]=_0x1c7a9f['recordingFormat']||_0x522b('0x2');this[_0x522b('0x3')]=_0x1c7a9f['mandatoryDisposition']||![];}module[_0x522b('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 774435d..2e92161 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 _0xbcba=['abandoned','available','busy','inUse','invalid','loggedIn','notInUse','paused','ringing','ringInUse','talking','unavailable','unknown','acw','acwTimeout','autopause','sendMessageOneNotActive','message','statusMessage','originated','temp','dialTimezone','dialGlobalInterval','dialActive','dialMethod','progressive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dropRate','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','anonymous','dialOriginateTimeout','dialQueueOptions','tTxX','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','outboundRejectCallsDay','pTalking','timeout','outboundAnswerCallsDay','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundBlacklistCallsDay','outboundDropCallsDayTimeout','outboundReCallsDay','handlePredictive','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalPauses','dialPredictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','erlangCalls','erlangAbandonmentRate','erlangBusyFactor','dialRecallMeTimeout','dialRecallInQueue','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','queueSummaryCountersUpdated','exports','wav','wav49','fewestcalls','leastrecent','linear','random','ringall','roundrobin','wrandom','monitor_format','inbound','total','answered','sumDuration','sumHoldTime','unmanaged'];(function(_0x3ec74e,_0x2f6536){var _0x5a53f9=function(_0x461459){while(--_0x461459){_0x3ec74e['push'](_0x3ec74e['shift']());}};_0x5a53f9(++_0x2f6536);}(_0xbcba,0x6d));var _0xabcb=function(_0x21eb86,_0x10141a){_0x21eb86=_0x21eb86-0x0;var _0x33924a=_0xbcba[_0x21eb86];return _0x33924a;};'use strict';var monitorFormat={'wav':_0xabcb('0x0'),'wav49':_0xabcb('0x1'),'gsm':'gsm'};var strategy={'fewestcalls':_0xabcb('0x2'),'leastrecent':_0xabcb('0x3'),'linear':_0xabcb('0x4'),'random':_0xabcb('0x5'),'ringall':_0xabcb('0x6'),'rr':_0xabcb('0x7'),'rrmemory':'rrmemory','rrordered':'rrordered','wrandom':_0xabcb('0x8')};function VoiceQueue(_0x1290b2){this['id']=_0x1290b2['id']||0x0;this['name']=_0x1290b2['name']||'';this[_0xabcb('0x9')]=_0x1290b2[_0xabcb('0x9')]||'';this['type']=_0x1290b2['type']||_0xabcb('0xa');this['waiting']=0x0;this[_0xabcb('0xb')]=0x0;this[_0xabcb('0xc')]=0x0;this[_0xabcb('0xd')]=0x0;this[_0xabcb('0xe')]=0x0;this['sumBillable']=0x0;this[_0xabcb('0xf')]=0x0;this[_0xabcb('0x10')]=0x0;this[_0xabcb('0x11')]=0x0;this[_0xabcb('0x12')]=0x0;this[_0xabcb('0x13')]=0x0;this[_0xabcb('0x14')]=0x0;this[_0xabcb('0x15')]=0x0;this[_0xabcb('0x16')]=0x0;this['onHold']=0x0;this[_0xabcb('0x17')]=0x0;this[_0xabcb('0x18')]=0x0;this[_0xabcb('0x19')]=0x0;this[_0xabcb('0x1a')]=0x0;this[_0xabcb('0x1b')]=0x0;this[_0xabcb('0x1c')]=0x0;this['acw']=_0x1290b2[_0xabcb('0x1d')]||![];this[_0xabcb('0x1e')]=_0x1290b2[_0xabcb('0x1e')]||0xa;this[_0xabcb('0x1f')]=_0x1290b2[_0xabcb('0x1f')]||'no';this[_0xabcb('0x20')]=!![];this[_0xabcb('0x21')]='';this[_0xabcb('0x22')]='';this[_0xabcb('0x23')]=0x0;this[_0xabcb('0x24')]=0x0;this['dialTimezone']=_0x1290b2[_0xabcb('0x25')]||null;this[_0xabcb('0x26')]=_0x1290b2[_0xabcb('0x26')]?_0x1290b2[_0xabcb('0x26')]:null;this[_0xabcb('0x27')]=_0x1290b2[_0xabcb('0x27')];this[_0xabcb('0x28')]=_0x1290b2[_0xabcb('0x28')]||_0xabcb('0x29');this[_0xabcb('0x2a')]=_0x1290b2[_0xabcb('0x2a')]||0x0;this[_0xabcb('0x2b')]=_0x1290b2[_0xabcb('0x2b')]||0x0;this[_0xabcb('0x2c')]=_0x1290b2['dialPowerLevel']||0x1;this['dialPredictiveOptimization']=_0x1290b2['dialPredictiveOptimization']||_0xabcb('0x2d');this[_0xabcb('0x2e')]=_0x1290b2[_0xabcb('0x2e')]||0.03;this[_0xabcb('0x2f')]=_0x1290b2[_0xabcb('0x2f')]||0x258;this['dialOriginateCallerIdName']=_0x1290b2[_0xabcb('0x30')]||'anonymous';this['dialOriginateCallerIdNumber']=_0x1290b2[_0xabcb('0x31')]||_0xabcb('0x32');this[_0xabcb('0x33')]=_0x1290b2[_0xabcb('0x33')]||0x1e;this['dialQueueOptions']=_0x1290b2[_0xabcb('0x34')]||_0xabcb('0x35');this[_0xabcb('0x36')]=_0x1290b2[_0xabcb('0x36')]||0x3;this['dialQueueProject']=_0x1290b2[_0xabcb('0x37')]||undefined;this[_0xabcb('0x38')]=_0x1290b2['dialCongestionMaxRetry']||0x3;this['dialCongestionRetryFrequency']=_0x1290b2[_0xabcb('0x39')]||0x96;this['dialBusyMaxRetry']=_0x1290b2[_0xabcb('0x3a')]||0x3;this[_0xabcb('0x3b')]=_0x1290b2[_0xabcb('0x3b')]||0x96;this[_0xabcb('0x3c')]=_0x1290b2[_0xabcb('0x3c')]||0x3;this[_0xabcb('0x3d')]=_0x1290b2[_0xabcb('0x3d')]||0x96;this['dialNoSuchNumberMaxRetry']=_0x1290b2['dialNoSuchNumberMaxRetry']||0x3;this[_0xabcb('0x3e')]=_0x1290b2[_0xabcb('0x3e')]||0x96;this['dialDropMaxRetry']=_0x1290b2[_0xabcb('0x3f')]||0x3;this[_0xabcb('0x40')]=_0x1290b2[_0xabcb('0x40')]||0x96;this[_0xabcb('0x41')]=_0x1290b2[_0xabcb('0x41')]||0x3;this[_0xabcb('0x42')]=_0x1290b2['dialAbandonedRetryFrequency']||0x96;this[_0xabcb('0x43')]=_0x1290b2[_0xabcb('0x43')]||0x3;this['dialMachineRetryFrequency']=_0x1290b2[_0xabcb('0x44')]||0x96;this[_0xabcb('0x45')]=_0x1290b2['dialAgentRejectMaxRetry']||0x3;this[_0xabcb('0x46')]=_0x1290b2[_0xabcb('0x46')]||0x96;this['callAdditionalPhoneAfterMin']=_0x1290b2['callAdditionalPhoneAfterMin']||0x3;this[_0xabcb('0x47')]=_0x1290b2['dialGlobalMaxRetry']||0x4;this[_0xabcb('0x48')]=_0x1290b2['Trunk']?_0x1290b2['Trunk']:undefined;this['TrunkBackup']=_0x1290b2[_0xabcb('0x49')]?_0x1290b2[_0xabcb('0x49')]:undefined;this[_0xabcb('0x4a')]=_0x1290b2['dialPrefix']||undefined;this[_0xabcb('0x4b')]=_0x1290b2[_0xabcb('0x4b')]?_0x1290b2[_0xabcb('0x4b')]:undefined;this[_0xabcb('0x4c')]=_0x1290b2['dialOrderByScheduledAt']||'DESC';this[_0xabcb('0x4d')]=_0x1290b2[_0xabcb('0x4d')]||undefined;this['dialCutDigit']=_0x1290b2[_0xabcb('0x4e')]||undefined;this[_0xabcb('0x4f')]=strategy[_0x1290b2[_0xabcb('0x4f')]];this['queueStatusComplete']=!![];this[_0xabcb('0x50')]=_0x1290b2[_0xabcb('0x50')]||![];this[_0xabcb('0x51')]=_0x1290b2['dialAMDInitialSilence'];this[_0xabcb('0x52')]=_0x1290b2[_0xabcb('0x52')];this[_0xabcb('0x53')]=_0x1290b2['dialAMDAfterGreetingSilence'];this[_0xabcb('0x54')]=_0x1290b2[_0xabcb('0x54')];this[_0xabcb('0x55')]=_0x1290b2[_0xabcb('0x55')];this[_0xabcb('0x56')]=_0x1290b2['dialAMDBetweenWordsSilence'];this[_0xabcb('0x57')]=_0x1290b2[_0xabcb('0x57')];this[_0xabcb('0x58')]=_0x1290b2[_0xabcb('0x58')];this[_0xabcb('0x59')]=_0x1290b2['dialAMDMaximumWordLength'];this[_0xabcb('0x5a')]=0x0;this[_0xabcb('0x5b')]=0x0;this[_0xabcb('0x5c')]=_0x1290b2[_0xabcb('0x5c')];this[_0xabcb('0x5d')]=0x0;this[_0xabcb('0x5e')]=0x0;this[_0xabcb('0x5f')]=0x0;this[_0xabcb('0x60')]=0x0;this[_0xabcb('0x61')]=0x0;this[_0xabcb('0x62')]=0x0;this[_0xabcb('0x63')]=0x0;this[_0xabcb('0x64')]=0x0;this['outboundOriginateFailureCallsDay']=0x0;this['outboundDropCallsDayCallersExit']=0x0;this[_0xabcb('0x65')]=0x0;this['outboundDropCallsDayACS']=0x0;this[_0xabcb('0x66')]=0x0;this['outboundAbandonedDay']=0x0;this['startProgressive']=undefined;this['startPredictive']=undefined;this[_0xabcb('0x67')]=undefined;this['predictiveIntervalMultiplicativeFactor']=1.05;this['predictiveIntervalTotalCalls']=0x0;this[_0xabcb('0x68')]=0x0;this[_0xabcb('0x69')]=0x0;this['predictiveIntervalDroppedCallsTimeout']=0x0;this[_0xabcb('0x6a')]=0x0;this[_0xabcb('0x6b')]=0x0;this[_0xabcb('0x6c')]=0x0;this['predictiveIntervalAvailable']=0x0;this['predictiveIntervalMaxThreshold']=_0x1290b2[_0xabcb('0x6d')]||0x14;this[_0xabcb('0x6e')]=_0x1290b2[_0xabcb('0x6d')]||0xa;this['predictiveIntervalErlangCalls']=0x0;this['predictiveIntervalErlangCallsDroppedCalls']=0x0;this['predictiveIntervalHitRate']=0x1;this[_0xabcb('0x6f')]=0x0;this['erlangCallToSecond']=0x0;this[_0xabcb('0x70')]=0x0;this[_0xabcb('0x71')]=0x0;this[_0xabcb('0x72')]=_0x1290b2['dialRecallMeTimeout']||0x1e;this[_0xabcb('0x73')]=_0x1290b2['dialRecallInQueue']||![];this[_0xabcb('0x74')]=!!_0x1290b2['dialPreviewAutoRecallMe']||![];this['dialPreviewRecallmeReminder']=!!_0x1290b2[_0xabcb('0x75')]||![];this[_0xabcb('0x76')]=_0x1290b2[_0xabcb('0x76')]||undefined;this['dialAgiAfterHangupClient']=_0x1290b2[_0xabcb('0x77')]||![];this[_0xabcb('0x78')]=_0x1290b2['dialAgiAfterHangupAgent']||![];this['monitor_format']=monitorFormat[_0x1290b2[_0xabcb('0x9')]]?monitorFormat[_0x1290b2[_0xabcb('0x9')]]:undefined;this[_0xabcb('0x79')]=_0x1290b2['mandatoryDisposition']||![];this[_0xabcb('0x7a')]=_0x1290b2[_0xabcb('0x7a')]?_0x1290b2[_0xabcb('0x7a')]:undefined;this[_0xabcb('0x7b')]=![];}module[_0xabcb('0x7c')]=VoiceQueue; \ No newline at end of file +var _0xb091=['unknown','acw','acwTimeout','autopause','sendMessageOneNotActive','message','statusMessage','originated','temp','dialTimezone','dialGlobalInterval','dialActive','dialMethod','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dropRate','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','anonymous','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','tTxX','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','callAdditionalPhoneAfterMin','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','DESC','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','queueStatusComplete','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','outboundRejectCallsDay','timeout','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundBlacklistCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundDropCallsDayACS','outboundReCallsDay','startProgressive','startPredictive','predictiveIntervalMultiplicativeFactor','predictiveIntervalTotalCalls','predictiveIntervalAvgTalktime','predictiveIntervalPauses','predictiveIntervalAvailable','dialPredictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','dialRecallMeTimeout','dialRecallInQueue','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','queueSummaryCountersUpdated','wav49','gsm','fewestcalls','leastrecent','random','rrmemory','rrordered','name','monitor_format','type','inbound','waiting','total','answered','sumDuration','sumHoldTime','sumBillable','unmanaged','available','busy','loggedIn','notInUse','onHold','paused','ringing','ringInUse','talking'];(function(_0x4e90e3,_0x570a1d){var _0x295e5b=function(_0x754043){while(--_0x754043){_0x4e90e3['push'](_0x4e90e3['shift']());}};_0x295e5b(++_0x570a1d);}(_0xb091,0x16e));var _0x1b09=function(_0x497816,_0x59408f){_0x497816=_0x497816-0x0;var _0x1872fc=_0xb091[_0x497816];return _0x1872fc;};'use strict';var monitorFormat={'wav':'wav','wav49':_0x1b09('0x0'),'gsm':_0x1b09('0x1')};var strategy={'fewestcalls':_0x1b09('0x2'),'leastrecent':_0x1b09('0x3'),'linear':'linear','random':_0x1b09('0x4'),'ringall':'ringall','rr':'roundrobin','rrmemory':_0x1b09('0x5'),'rrordered':_0x1b09('0x6'),'wrandom':'wrandom'};function VoiceQueue(_0xda8caa){this['id']=_0xda8caa['id']||0x0;this[_0x1b09('0x7')]=_0xda8caa[_0x1b09('0x7')]||'';this['monitor_format']=_0xda8caa[_0x1b09('0x8')]||'';this[_0x1b09('0x9')]=_0xda8caa[_0x1b09('0x9')]||_0x1b09('0xa');this[_0x1b09('0xb')]=0x0;this[_0x1b09('0xc')]=0x0;this[_0x1b09('0xd')]=0x0;this[_0x1b09('0xe')]=0x0;this[_0x1b09('0xf')]=0x0;this[_0x1b09('0x10')]=0x0;this[_0x1b09('0x11')]=0x0;this['abandoned']=0x0;this[_0x1b09('0x12')]=0x0;this[_0x1b09('0x13')]=0x0;this['inUse']=0x0;this['invalid']=0x0;this[_0x1b09('0x14')]=0x0;this[_0x1b09('0x15')]=0x0;this[_0x1b09('0x16')]=0x0;this[_0x1b09('0x17')]=0x0;this[_0x1b09('0x18')]=0x0;this[_0x1b09('0x19')]=0x0;this[_0x1b09('0x1a')]=0x0;this['unavailable']=0x0;this[_0x1b09('0x1b')]=0x0;this['acw']=_0xda8caa[_0x1b09('0x1c')]||![];this[_0x1b09('0x1d')]=_0xda8caa[_0x1b09('0x1d')]||0xa;this[_0x1b09('0x1e')]=_0xda8caa[_0x1b09('0x1e')]||'no';this[_0x1b09('0x1f')]=!![];this[_0x1b09('0x20')]='';this[_0x1b09('0x21')]='';this[_0x1b09('0x22')]=0x0;this[_0x1b09('0x23')]=0x0;this[_0x1b09('0x24')]=_0xda8caa[_0x1b09('0x24')]||null;this[_0x1b09('0x25')]=_0xda8caa['dialGlobalInterval']?_0xda8caa[_0x1b09('0x25')]:null;this[_0x1b09('0x26')]=_0xda8caa['dialActive'];this['dialMethod']=_0xda8caa[_0x1b09('0x27')]||'progressive';this[_0x1b09('0x28')]=_0xda8caa['dialLimitChannel']||0x0;this[_0x1b09('0x29')]=_0xda8caa[_0x1b09('0x29')]||0x0;this[_0x1b09('0x2a')]=_0xda8caa[_0x1b09('0x2a')]||0x1;this[_0x1b09('0x2b')]=_0xda8caa[_0x1b09('0x2b')]||_0x1b09('0x2c');this[_0x1b09('0x2d')]=_0xda8caa['dialPredictiveOptimizationPercentage']||0.03;this['dialPredictiveInterval']=_0xda8caa[_0x1b09('0x2e')]||0x258;this[_0x1b09('0x2f')]=_0xda8caa['dialOriginateCallerIdName']||_0x1b09('0x30');this[_0x1b09('0x31')]=_0xda8caa[_0x1b09('0x31')]||_0x1b09('0x30');this['dialOriginateTimeout']=_0xda8caa[_0x1b09('0x32')]||0x1e;this[_0x1b09('0x33')]=_0xda8caa['dialQueueOptions']||_0x1b09('0x34');this[_0x1b09('0x35')]=_0xda8caa['dialQueueTimeout']||0x3;this[_0x1b09('0x36')]=_0xda8caa[_0x1b09('0x36')]||undefined;this[_0x1b09('0x37')]=_0xda8caa[_0x1b09('0x37')]||0x3;this['dialCongestionRetryFrequency']=_0xda8caa[_0x1b09('0x38')]||0x96;this[_0x1b09('0x39')]=_0xda8caa['dialBusyMaxRetry']||0x3;this[_0x1b09('0x3a')]=_0xda8caa[_0x1b09('0x3a')]||0x96;this[_0x1b09('0x3b')]=_0xda8caa[_0x1b09('0x3b')]||0x3;this[_0x1b09('0x3c')]=_0xda8caa[_0x1b09('0x3c')]||0x96;this[_0x1b09('0x3d')]=_0xda8caa['dialNoSuchNumberMaxRetry']||0x3;this[_0x1b09('0x3e')]=_0xda8caa[_0x1b09('0x3e')]||0x96;this['dialDropMaxRetry']=_0xda8caa[_0x1b09('0x3f')]||0x3;this[_0x1b09('0x40')]=_0xda8caa[_0x1b09('0x40')]||0x96;this[_0x1b09('0x41')]=_0xda8caa[_0x1b09('0x41')]||0x3;this['dialAbandonedRetryFrequency']=_0xda8caa[_0x1b09('0x42')]||0x96;this['dialMachineMaxRetry']=_0xda8caa[_0x1b09('0x43')]||0x3;this['dialMachineRetryFrequency']=_0xda8caa[_0x1b09('0x44')]||0x96;this[_0x1b09('0x45')]=_0xda8caa[_0x1b09('0x45')]||0x3;this[_0x1b09('0x46')]=_0xda8caa[_0x1b09('0x46')]||0x96;this[_0x1b09('0x47')]=_0xda8caa[_0x1b09('0x47')]||0x3;this[_0x1b09('0x48')]=_0xda8caa[_0x1b09('0x48')]||0x4;this[_0x1b09('0x49')]=_0xda8caa['Trunk']?_0xda8caa[_0x1b09('0x49')]:undefined;this[_0x1b09('0x4a')]=_0xda8caa[_0x1b09('0x4a')]?_0xda8caa['TrunkBackup']:undefined;this[_0x1b09('0x4b')]=_0xda8caa[_0x1b09('0x4b')]||undefined;this[_0x1b09('0x4c')]=_0xda8caa[_0x1b09('0x4c')]?_0xda8caa[_0x1b09('0x4c')]:undefined;this[_0x1b09('0x4d')]=_0xda8caa[_0x1b09('0x4d')]||_0x1b09('0x4e');this['dialRandomLastDigitCallerIdNumber']=_0xda8caa[_0x1b09('0x4f')]||undefined;this['dialCutDigit']=_0xda8caa[_0x1b09('0x50')]||undefined;this['strategy']=strategy[_0xda8caa[_0x1b09('0x51')]];this[_0x1b09('0x52')]=!![];this[_0x1b09('0x53')]=_0xda8caa[_0x1b09('0x53')]||![];this[_0x1b09('0x54')]=_0xda8caa[_0x1b09('0x54')];this[_0x1b09('0x55')]=_0xda8caa[_0x1b09('0x55')];this[_0x1b09('0x56')]=_0xda8caa[_0x1b09('0x56')];this[_0x1b09('0x57')]=_0xda8caa[_0x1b09('0x57')];this[_0x1b09('0x58')]=_0xda8caa['dialAMDMinWordLength'];this['dialAMDBetweenWordsSilence']=_0xda8caa[_0x1b09('0x59')];this[_0x1b09('0x5a')]=_0xda8caa[_0x1b09('0x5a')];this[_0x1b09('0x5b')]=_0xda8caa[_0x1b09('0x5b')];this[_0x1b09('0x5c')]=_0xda8caa[_0x1b09('0x5c')];this[_0x1b09('0x5d')]=0x0;this['pTalking']=0x0;this['timeout']=_0xda8caa[_0x1b09('0x5e')];this['outboundAnswerCallsDay']=0x0;this[_0x1b09('0x5f')]=0x0;this[_0x1b09('0x60')]=0x0;this[_0x1b09('0x61')]=0x0;this['outboundCongestionCallsDay']=0x0;this[_0x1b09('0x62')]=0x0;this[_0x1b09('0x63')]=0x0;this[_0x1b09('0x64')]=0x0;this['outboundOriginateFailureCallsDay']=0x0;this[_0x1b09('0x65')]=0x0;this[_0x1b09('0x66')]=0x0;this[_0x1b09('0x67')]=0x0;this[_0x1b09('0x68')]=0x0;this['outboundAbandonedDay']=0x0;this[_0x1b09('0x69')]=undefined;this[_0x1b09('0x6a')]=undefined;this['handlePredictive']=undefined;this[_0x1b09('0x6b')]=1.05;this[_0x1b09('0x6c')]=0x0;this['predictiveIntervalAnsweredCalls']=0x0;this['predictiveIntervalDroppedCallsCallersExit']=0x0;this['predictiveIntervalDroppedCallsTimeout']=0x0;this['predictiveIntervalAvgHoldtime']=0x0;this[_0x1b09('0x6d')]=0x0;this[_0x1b09('0x6e')]=0x0;this[_0x1b09('0x6f')]=0x0;this['predictiveIntervalMaxThreshold']=_0xda8caa[_0x1b09('0x70')]||0x14;this[_0x1b09('0x71')]=_0xda8caa['dialPredictiveIntervalMaxThreshold']||0xa;this[_0x1b09('0x72')]=0x0;this[_0x1b09('0x73')]=0x0;this[_0x1b09('0x74')]=0x1;this[_0x1b09('0x75')]=0x0;this[_0x1b09('0x76')]=0x0;this[_0x1b09('0x77')]=0x0;this[_0x1b09('0x78')]=0x0;this[_0x1b09('0x79')]=_0xda8caa[_0x1b09('0x79')]||0x1e;this[_0x1b09('0x7a')]=_0xda8caa['dialRecallInQueue']||![];this[_0x1b09('0x7b')]=!!_0xda8caa[_0x1b09('0x7b')]||![];this[_0x1b09('0x7c')]=!!_0xda8caa['dialPreviewRecallmeReminder']||![];this[_0x1b09('0x7d')]=_0xda8caa['dialQueueProject2']||undefined;this[_0x1b09('0x7e')]=_0xda8caa[_0x1b09('0x7e')]||![];this['dialAgiAfterHangupAgent']=_0xda8caa[_0x1b09('0x7f')]||![];this[_0x1b09('0x8')]=monitorFormat[_0xda8caa[_0x1b09('0x8')]]?monitorFormat[_0xda8caa[_0x1b09('0x8')]]:undefined;this[_0x1b09('0x80')]=_0xda8caa[_0x1b09('0x80')]||![];this['mandatoryDispositionPause']=_0xda8caa[_0x1b09('0x81')]?_0xda8caa['mandatoryDispositionPause']:undefined;this[_0x1b09('0x82')]=![];}module['exports']=VoiceQueue; \ No newline at end of file diff --git a/server/services/ami/model/voiceQueueSummary.js b/server/services/ami/model/voiceQueueSummary.js index e26a9fc..769df65 100644 --- a/server/services/ami/model/voiceQueueSummary.js +++ b/server/services/ami/model/voiceQueueSummary.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x00b3=['ringInUse','total','type','unavailable','unknown','unmanaged','outbound','pTalking','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','temp','outboundAnswerAgiCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundOriginateFailureCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','message','statusMessage','Trunk','name','prototype','createReport','busy','loggedin','callers','length','SIP/','online','incall','includes','booked','queue','dialer','exten','xcally-motion-preview','compareToInboundQueue','some','active','updateReportFromOutboundQueue','preview','exports','available','paused','ringing','answered','inUse','loggedInDb','originated','outboundAbandonedCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','talking','sumBillable','sumDuration','waiting','strategy','abandoned','invalid','loggedIn','onHold','notInUse'];(function(_0x422f01,_0x9fb359){var _0x115795=function(_0x989190){while(--_0x989190){_0x422f01['push'](_0x422f01['shift']());}};_0x115795(++_0x9fb359);}(_0x00b3,0x97));var _0x300b=function(_0xcaf859,_0x453a51){_0xcaf859=_0xcaf859-0x0;var _0x29ca3c=_0x00b3[_0xcaf859];return _0x29ca3c;};'use strict';var INBOUND_COUNTERS=[_0x300b('0x0'),'loggedIn','loggedInDb',_0x300b('0x1'),_0x300b('0x2'),'talking','waiting'];var OUTBOUND_COUNTERS=[_0x300b('0x0'),_0x300b('0x3'),_0x300b('0x4'),'loggedIn',_0x300b('0x5'),_0x300b('0x6'),_0x300b('0x7'),_0x300b('0x8'),_0x300b('0x9'),_0x300b('0xa'),_0x300b('0xb'),_0x300b('0xc'),_0x300b('0xd'),_0x300b('0xe'),_0x300b('0xf'),_0x300b('0x10'),_0x300b('0x1'),'pTalking',_0x300b('0x11'),_0x300b('0x12'),_0x300b('0x13'),'total',_0x300b('0x14')];function VoiceQueueSummary(_0x1ab63f){this['id']=_0x1ab63f['id'];this['name']=_0x1ab63f['name'];this[_0x300b('0x15')]=_0x1ab63f['strategy'];this[_0x300b('0x16')]=_0x1ab63f[_0x300b('0x16')]||0x0;this[_0x300b('0x3')]=_0x1ab63f[_0x300b('0x3')]||0x0;this[_0x300b('0x0')]=_0x1ab63f[_0x300b('0x0')]||0x0;this['busy']=_0x1ab63f['busy']||0x0;this[_0x300b('0x4')]=_0x1ab63f[_0x300b('0x4')]||0x0;this[_0x300b('0x17')]=_0x1ab63f[_0x300b('0x17')]||0x0;this[_0x300b('0x18')]=_0x1ab63f[_0x300b('0x18')]||0x0;this[_0x300b('0x5')]=_0x1ab63f[_0x300b('0x5')]||0x0;this['onHold']=_0x1ab63f[_0x300b('0x19')]||0x0;this[_0x300b('0x1a')]=_0x1ab63f['notInUse']||0x0;this[_0x300b('0x1')]=_0x1ab63f[_0x300b('0x1')]||0x0;this[_0x300b('0x2')]=_0x1ab63f[_0x300b('0x2')]||0x0;this['ringInUse']=_0x1ab63f[_0x300b('0x1b')];this[_0x300b('0x12')]=_0x1ab63f[_0x300b('0x12')];this[_0x300b('0x13')]=_0x1ab63f['sumDuration'];this['sumHoldTime']=_0x1ab63f['sumHoldTime']||0x0;this['talking']=_0x1ab63f[_0x300b('0x11')]||0x0;this[_0x300b('0x1c')]=_0x1ab63f[_0x300b('0x1c')]||0x0;this[_0x300b('0x1d')]=_0x1ab63f['type'];this[_0x300b('0x1e')]=_0x1ab63f[_0x300b('0x1e')]||0x0;this[_0x300b('0x1f')]=_0x1ab63f[_0x300b('0x1f')]||0x0;this[_0x300b('0x20')]=_0x1ab63f['unmanaged']||0x0;this[_0x300b('0x14')]=_0x1ab63f[_0x300b('0x14')]||0x0;if(_0x1ab63f[_0x300b('0x1d')]===_0x300b('0x21')){this[_0x300b('0x22')]=_0x1ab63f[_0x300b('0x22')]||0x0;this[_0x300b('0x23')]=_0x1ab63f[_0x300b('0x23')];this[_0x300b('0x24')]=_0x1ab63f['dialMethod'];this['dialOriginateCallerIdName']=_0x1ab63f[_0x300b('0x25')];this['dialOriginateCallerIdNumber']=_0x1ab63f[_0x300b('0x26')];this[_0x300b('0x27')]=_0x1ab63f[_0x300b('0x27')];this[_0x300b('0x28')]=_0x1ab63f['dialPrefix'];this[_0x300b('0x29')]=_0x1ab63f[_0x300b('0x29')];this['outboundAnswerAgiCallsDay']=_0x1ab63f[_0x300b('0x2a')];this[_0x300b('0x8')]=_0x1ab63f[_0x300b('0x8')];this[_0x300b('0x9')]=_0x1ab63f['outboundBlacklistCallsDay'];this['outboundBusyCallsDay']=_0x1ab63f[_0x300b('0xa')];this[_0x300b('0xb')]=_0x1ab63f[_0x300b('0xb')];this['outboundDropCallsDayACS']=_0x1ab63f['outboundDropCallsDayACS'];this[_0x300b('0x2b')]=_0x1ab63f[_0x300b('0x2b')];this[_0x300b('0x2c')]=_0x1ab63f[_0x300b('0x2c')];this[_0x300b('0xc')]=_0x1ab63f[_0x300b('0xc')];this['outboundNoSuchCallsDay']=_0x1ab63f[_0x300b('0xd')];this[_0x300b('0x2d')]=_0x1ab63f[_0x300b('0x2d')];this[_0x300b('0xe')]=_0x1ab63f[_0x300b('0xe')];this['outboundRejectCallsDay']=_0x1ab63f['outboundRejectCallsDay'];this[_0x300b('0x10')]=_0x1ab63f[_0x300b('0x10')];this['predictiveIntervalAnsweredCalls']=_0x1ab63f[_0x300b('0x2e')];this[_0x300b('0x2f')]=_0x1ab63f['predictiveIntervalAvgHoldtime'];this[_0x300b('0x30')]=_0x1ab63f['predictiveIntervalAvgTalktime'];this[_0x300b('0x31')]=_0x1ab63f[_0x300b('0x31')];this['predictiveIntervalDroppedCallsTimeout']=_0x1ab63f[_0x300b('0x32')];this[_0x300b('0x33')]=_0x1ab63f[_0x300b('0x33')];this[_0x300b('0x34')]=_0x1ab63f[_0x300b('0x34')];this[_0x300b('0x35')]=_0x1ab63f[_0x300b('0x35')];this[_0x300b('0x36')]=_0x1ab63f[_0x300b('0x36')];this[_0x300b('0x37')]=_0x1ab63f[_0x300b('0x37')];this[_0x300b('0x38')]=_0x1ab63f['predictiveIntervalAvailable'];this[_0x300b('0x39')]=_0x1ab63f['predictiveIntervalTotalCalls'];this['originated']=_0x1ab63f[_0x300b('0x6')];this[_0x300b('0x3a')]=_0x1ab63f['erlangCalls'];this[_0x300b('0x3b')]=_0x1ab63f['erlangCallToSecond'];this[_0x300b('0x3c')]=_0x1ab63f[_0x300b('0x3c')];this['erlangBusyFactor']=_0x1ab63f[_0x300b('0x3d')];this[_0x300b('0x3e')]=_0x1ab63f[_0x300b('0x3e')];this[_0x300b('0x3f')]=_0x1ab63f[_0x300b('0x3f')];this[_0x300b('0x40')]=_0x1ab63f['message'];this[_0x300b('0x41')]=_0x1ab63f[_0x300b('0x41')];}if(_0x1ab63f[_0x300b('0x42')]){this['Trunk']={'id':_0x1ab63f['Trunk']['id'],'name':_0x1ab63f[_0x300b('0x42')][_0x300b('0x43')],'active':_0x1ab63f[_0x300b('0x42')]['active'],'callerid':_0x1ab63f[_0x300b('0x42')]['callerid']};}}VoiceQueueSummary[_0x300b('0x44')][_0x300b('0x45')]=function(_0x4ab488,_0x3ac962,_0x2151c1,_0x4d7314){this['loggedInDb']=0x0;this[_0x300b('0x11')]=0x0;this[_0x300b('0x1')]=0x0;this['unknown']=0x0;this[_0x300b('0x1a')]=0x0;this['inUse']=0x0;this[_0x300b('0x46')]=0x0;this[_0x300b('0x17')]=0x0;this[_0x300b('0x1e')]=0x0;this[_0x300b('0x2')]=0x0;this[_0x300b('0x1b')]=0x0;this[_0x300b('0x19')]=0x0;if(_0x2151c1){if(_0x2151c1['available']){this[_0x300b('0x0')]=Number(_0x2151c1[_0x300b('0x0')]);}if(_0x2151c1[_0x300b('0x47')]){this[_0x300b('0x18')]=Number(_0x2151c1[_0x300b('0x47')]);}if(_0x2151c1[_0x300b('0x48')]){this[_0x300b('0x14')]=Number(_0x2151c1['callers']);}}for(var _0x20261d=0x0;_0x20261d<_0x4ab488[_0x300b('0x49')];_0x20261d++){var _0x863365=_0x3ac962[_0x300b('0x4a')+_0x4ab488[_0x20261d]['name']];if(_0x863365&&_0x863365[_0x300b('0x4b')]){this[_0x300b('0x5')]+=0x1;}if(_0x4ab488[_0x20261d][_0x300b('0x4c')]==='1'){this[_0x300b('0x11')]+=0x1;}if(_0x4ab488[_0x20261d]['paused']==='1'&&!['2','7','8'][_0x300b('0x4d')](_0x4ab488[_0x20261d]['status'])){this['paused']+=0x1;}switch(_0x4ab488[_0x20261d]['status']){case'0':this[_0x300b('0x1f')]+=0x1;break;case'1':this[_0x300b('0x1a')]+=0x1;break;case'2':this['inUse']+=0x1;break;case'3':this[_0x300b('0x46')]+=0x1;break;case'4':this[_0x300b('0x17')]+=0x1;break;case'5':this['unavailable']+=0x1;break;case'6':this['ringing']+=0x1;break;case'7':this[_0x300b('0x1b')]+=0x1;break;case'8':this[_0x300b('0x19')]+=0x1;break;}}if(this[_0x300b('0x24')]===_0x300b('0x4e')){var _0x574731=Object['keys'](_0x4d7314);for(var _0x58a114=0x0;_0x58a114<_0x574731['length'];_0x58a114++){var _0x2db2b7=_0x574731[_0x58a114];var _0x380cda=_0x4d7314[_0x2db2b7];if(_0x380cda[_0x300b('0x4f')]===this[_0x300b('0x43')]&&_0x380cda[_0x300b('0x1d')]===_0x300b('0x50')&&_0x380cda[_0x300b('0x51')]===_0x300b('0x52')){this['talking']+=0x1;}}if(this[_0x300b('0x11')]>this[_0x300b('0x4')]){this['talking']=this[_0x300b('0x4')];}this['pTalking']=0x0;}return this;};VoiceQueueSummary['prototype'][_0x300b('0x53')]=function(_0x358616){var _0x5e6010=![];if(_0x358616){_0x5e6010=INBOUND_COUNTERS[_0x300b('0x54')](function(_0x33c352){return this[_0x33c352]!==_0x358616[_0x33c352];},this);}return _0x5e6010;};VoiceQueueSummary[_0x300b('0x44')]['compareToOutboundQueue']=function(_0xdb8d13){var _0x9250b=![];var _0x4f8536=![];var _0x18f4ee=![];if(_0xdb8d13){_0x9250b=this['dialMethod']!==_0xdb8d13[_0x300b('0x24')]||this[_0x300b('0x23')]!==_0xdb8d13[_0x300b('0x23')]||this[_0x300b('0x40')]!==_0xdb8d13['message']||this[_0x300b('0x41')]!==_0xdb8d13['statusMessage'];_0x4f8536=OUTBOUND_COUNTERS['some'](function(_0x3db941){return this[_0x3db941]!==_0xdb8d13[_0x3db941];},this);if(this[_0x300b('0x42')]&&_0xdb8d13[_0x300b('0x42')]){_0x18f4ee=this[_0x300b('0x42')]['name']!==_0xdb8d13['Trunk'][_0x300b('0x43')]||this['Trunk'][_0x300b('0x55')]!==_0xdb8d13[_0x300b('0x42')][_0x300b('0x55')];}}return _0x9250b||_0x4f8536||_0x18f4ee;};VoiceQueueSummary['prototype'][_0x300b('0x56')]=function(_0x3ce55f){this[_0x300b('0x3')]=_0x3ce55f['answered'];this[_0x300b('0x40')]=_0x3ce55f[_0x300b('0x40')];this[_0x300b('0x41')]=_0x3ce55f[_0x300b('0x41')];this['originated']=_0x3ce55f['originated'];this['outboundAbandonedCallsDay']=_0x3ce55f[_0x300b('0x7')];this['outboundAnswerCallsDay']=_0x3ce55f[_0x300b('0x8')];this['outboundBlacklistCallsDay']=_0x3ce55f[_0x300b('0x9')];this[_0x300b('0xa')]=_0x3ce55f['outboundBusyCallsDay'];this[_0x300b('0xb')]=_0x3ce55f[_0x300b('0xb')];this[_0x300b('0xc')]=_0x3ce55f[_0x300b('0xc')];this[_0x300b('0xd')]=_0x3ce55f[_0x300b('0xd')];this[_0x300b('0xe')]=_0x3ce55f['outboundReCallsDay'];this[_0x300b('0xf')]=_0x3ce55f[_0x300b('0xf')];this[_0x300b('0x10')]=_0x3ce55f[_0x300b('0x10')];this['sumBillable']=_0x3ce55f[_0x300b('0x12')];this[_0x300b('0x13')]=_0x3ce55f[_0x300b('0x13')];this[_0x300b('0x1c')]=_0x3ce55f[_0x300b('0x1c')];if(this[_0x300b('0x24')]===_0x300b('0x57')){this[_0x300b('0x22')]=_0x3ce55f[_0x300b('0x22')];}};module[_0x300b('0x58')]=VoiceQueueSummary; \ No newline at end of file +var _0x29b1=['outboundBlacklistCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundRejectCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','message','statusMessage','Trunk','active','callerid','prototype','createReport','callers','length','SIP/','includes','status','keys','queue','exten','xcally-motion-preview','compareToInboundQueue','some','compareToOutboundQueue','updateReportFromOutboundQueue','outboundAbandonedCallsDay','preview','exports','loggedInDb','paused','ringing','talking','waiting','available','answered','inUse','loggedIn','originated','outboundAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundReCallsDay','outboundUnknownCallsDay','pTalking','sumBillable','sumDuration','name','strategy','abandoned','busy','invalid','onHold','notInUse','ringInUse','sumHoldTime','total','type','unavailable','unknown','unmanaged','outbound','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','temp','outboundAnswerAgiCallsDay'];(function(_0x3d86a4,_0x43dc05){var _0x100df5=function(_0x24d968){while(--_0x24d968){_0x3d86a4['push'](_0x3d86a4['shift']());}};_0x100df5(++_0x43dc05);}(_0x29b1,0x13b));var _0x129b=function(_0x4b2863,_0x494899){_0x4b2863=_0x4b2863-0x0;var _0x567d67=_0x29b1[_0x4b2863];return _0x567d67;};'use strict';var INBOUND_COUNTERS=['available','loggedIn',_0x129b('0x0'),_0x129b('0x1'),_0x129b('0x2'),_0x129b('0x3'),_0x129b('0x4')];var OUTBOUND_COUNTERS=[_0x129b('0x5'),_0x129b('0x6'),_0x129b('0x7'),_0x129b('0x8'),_0x129b('0x0'),_0x129b('0x9'),'outboundAbandonedCallsDay',_0x129b('0xa'),'outboundBlacklistCallsDay',_0x129b('0xb'),_0x129b('0xc'),'outboundNoAnswerCallsDay','outboundNoSuchCallsDay',_0x129b('0xd'),'outboundRejectCallsDay',_0x129b('0xe'),_0x129b('0x1'),_0x129b('0xf'),_0x129b('0x3'),_0x129b('0x10'),_0x129b('0x11'),'total',_0x129b('0x4')];function VoiceQueueSummary(_0x16c6fd){this['id']=_0x16c6fd['id'];this['name']=_0x16c6fd[_0x129b('0x12')];this[_0x129b('0x13')]=_0x16c6fd['strategy'];this[_0x129b('0x14')]=_0x16c6fd[_0x129b('0x14')]||0x0;this[_0x129b('0x6')]=_0x16c6fd[_0x129b('0x6')]||0x0;this[_0x129b('0x5')]=_0x16c6fd['available']||0x0;this[_0x129b('0x15')]=_0x16c6fd[_0x129b('0x15')]||0x0;this[_0x129b('0x7')]=_0x16c6fd['inUse']||0x0;this[_0x129b('0x16')]=_0x16c6fd[_0x129b('0x16')]||0x0;this['loggedIn']=_0x16c6fd[_0x129b('0x8')]||0x0;this['loggedInDb']=_0x16c6fd[_0x129b('0x0')]||0x0;this[_0x129b('0x17')]=_0x16c6fd[_0x129b('0x17')]||0x0;this[_0x129b('0x18')]=_0x16c6fd[_0x129b('0x18')]||0x0;this[_0x129b('0x1')]=_0x16c6fd['paused']||0x0;this[_0x129b('0x2')]=_0x16c6fd[_0x129b('0x2')]||0x0;this['ringInUse']=_0x16c6fd[_0x129b('0x19')];this[_0x129b('0x10')]=_0x16c6fd[_0x129b('0x10')];this[_0x129b('0x11')]=_0x16c6fd[_0x129b('0x11')];this[_0x129b('0x1a')]=_0x16c6fd['sumHoldTime']||0x0;this[_0x129b('0x3')]=_0x16c6fd[_0x129b('0x3')]||0x0;this['total']=_0x16c6fd[_0x129b('0x1b')]||0x0;this['type']=_0x16c6fd[_0x129b('0x1c')];this['unavailable']=_0x16c6fd[_0x129b('0x1d')]||0x0;this['unknown']=_0x16c6fd[_0x129b('0x1e')]||0x0;this[_0x129b('0x1f')]=_0x16c6fd[_0x129b('0x1f')]||0x0;this['waiting']=_0x16c6fd[_0x129b('0x4')]||0x0;if(_0x16c6fd[_0x129b('0x1c')]===_0x129b('0x20')){this['pTalking']=_0x16c6fd['pTalking']||0x0;this[_0x129b('0x21')]=_0x16c6fd[_0x129b('0x21')];this['dialMethod']=_0x16c6fd[_0x129b('0x22')];this[_0x129b('0x23')]=_0x16c6fd[_0x129b('0x23')];this[_0x129b('0x24')]=_0x16c6fd[_0x129b('0x24')];this[_0x129b('0x25')]=_0x16c6fd[_0x129b('0x25')];this[_0x129b('0x26')]=_0x16c6fd[_0x129b('0x26')];this[_0x129b('0x27')]=_0x16c6fd[_0x129b('0x27')];this[_0x129b('0x28')]=_0x16c6fd[_0x129b('0x28')];this[_0x129b('0xa')]=_0x16c6fd[_0x129b('0xa')];this[_0x129b('0x29')]=_0x16c6fd['outboundBlacklistCallsDay'];this[_0x129b('0xb')]=_0x16c6fd[_0x129b('0xb')];this['outboundCongestionCallsDay']=_0x16c6fd[_0x129b('0xc')];this[_0x129b('0x2a')]=_0x16c6fd['outboundDropCallsDayACS'];this['outboundDropCallsDayCallersExit']=_0x16c6fd[_0x129b('0x2b')];this['outboundDropCallsDayTimeout']=_0x16c6fd[_0x129b('0x2c')];this[_0x129b('0x2d')]=_0x16c6fd[_0x129b('0x2d')];this[_0x129b('0x2e')]=_0x16c6fd[_0x129b('0x2e')];this[_0x129b('0x2f')]=_0x16c6fd[_0x129b('0x2f')];this[_0x129b('0xd')]=_0x16c6fd[_0x129b('0xd')];this[_0x129b('0x30')]=_0x16c6fd[_0x129b('0x30')];this['outboundUnknownCallsDay']=_0x16c6fd['outboundUnknownCallsDay'];this[_0x129b('0x31')]=_0x16c6fd[_0x129b('0x31')];this['predictiveIntervalAvgHoldtime']=_0x16c6fd[_0x129b('0x32')];this[_0x129b('0x33')]=_0x16c6fd['predictiveIntervalAvgTalktime'];this['predictiveIntervalDroppedCallsCallersExit']=_0x16c6fd['predictiveIntervalDroppedCallsCallersExit'];this[_0x129b('0x34')]=_0x16c6fd[_0x129b('0x34')];this[_0x129b('0x35')]=_0x16c6fd['predictiveIntervalErlangCalls'];this['predictiveIntervalErlangCallsDroppedCalls']=_0x16c6fd[_0x129b('0x36')];this[_0x129b('0x37')]=_0x16c6fd[_0x129b('0x37')];this[_0x129b('0x38')]=_0x16c6fd[_0x129b('0x38')];this[_0x129b('0x39')]=_0x16c6fd[_0x129b('0x39')];this['predictiveIntervalAvailable']=_0x16c6fd[_0x129b('0x3a')];this[_0x129b('0x3b')]=_0x16c6fd[_0x129b('0x3b')];this[_0x129b('0x9')]=_0x16c6fd[_0x129b('0x9')];this[_0x129b('0x3c')]=_0x16c6fd[_0x129b('0x3c')];this[_0x129b('0x3d')]=_0x16c6fd[_0x129b('0x3d')];this[_0x129b('0x3e')]=_0x16c6fd[_0x129b('0x3e')];this[_0x129b('0x3f')]=_0x16c6fd['erlangBusyFactor'];this[_0x129b('0x40')]=_0x16c6fd[_0x129b('0x40')];this[_0x129b('0x41')]=_0x16c6fd[_0x129b('0x41')];this['message']=_0x16c6fd[_0x129b('0x42')];this[_0x129b('0x43')]=_0x16c6fd[_0x129b('0x43')];}if(_0x16c6fd[_0x129b('0x44')]){this[_0x129b('0x44')]={'id':_0x16c6fd[_0x129b('0x44')]['id'],'name':_0x16c6fd[_0x129b('0x44')][_0x129b('0x12')],'active':_0x16c6fd[_0x129b('0x44')][_0x129b('0x45')],'callerid':_0x16c6fd['Trunk'][_0x129b('0x46')]};}}VoiceQueueSummary[_0x129b('0x47')][_0x129b('0x48')]=function(_0x49bdce,_0x3dfe1d,_0xb16c52,_0x36d2e2){this[_0x129b('0x0')]=0x0;this[_0x129b('0x3')]=0x0;this[_0x129b('0x1')]=0x0;this['unknown']=0x0;this['notInUse']=0x0;this[_0x129b('0x7')]=0x0;this[_0x129b('0x15')]=0x0;this['invalid']=0x0;this['unavailable']=0x0;this['ringing']=0x0;this[_0x129b('0x19')]=0x0;this['onHold']=0x0;if(_0xb16c52){if(_0xb16c52['available']){this[_0x129b('0x5')]=Number(_0xb16c52[_0x129b('0x5')]);}if(_0xb16c52['loggedin']){this[_0x129b('0x8')]=Number(_0xb16c52['loggedin']);}if(_0xb16c52[_0x129b('0x49')]){this['waiting']=Number(_0xb16c52['callers']);}}for(var _0x457c70=0x0;_0x457c70<_0x49bdce[_0x129b('0x4a')];_0x457c70++){var _0x2fea05=_0x3dfe1d[_0x129b('0x4b')+_0x49bdce[_0x457c70][_0x129b('0x12')]];if(_0x2fea05&&_0x2fea05['online']){this[_0x129b('0x0')]+=0x1;}if(_0x49bdce[_0x457c70]['incall']==='1'){this[_0x129b('0x3')]+=0x1;}if(_0x49bdce[_0x457c70][_0x129b('0x1')]==='1'&&!['2','7','8'][_0x129b('0x4c')](_0x49bdce[_0x457c70][_0x129b('0x4d')])){this[_0x129b('0x1')]+=0x1;}switch(_0x49bdce[_0x457c70]['status']){case'0':this[_0x129b('0x1e')]+=0x1;break;case'1':this['notInUse']+=0x1;break;case'2':this[_0x129b('0x7')]+=0x1;break;case'3':this[_0x129b('0x15')]+=0x1;break;case'4':this[_0x129b('0x16')]+=0x1;break;case'5':this[_0x129b('0x1d')]+=0x1;break;case'6':this[_0x129b('0x2')]+=0x1;break;case'7':this[_0x129b('0x19')]+=0x1;break;case'8':this[_0x129b('0x17')]+=0x1;break;}}if(this['dialMethod']==='booked'){var _0x1bb7de=Object[_0x129b('0x4e')](_0x36d2e2);for(var _0x1989f6=0x0;_0x1989f6<_0x1bb7de[_0x129b('0x4a')];_0x1989f6++){var _0xc33582=_0x1bb7de[_0x1989f6];var _0x1cf89e=_0x36d2e2[_0xc33582];if(_0x1cf89e[_0x129b('0x4f')]===this[_0x129b('0x12')]&&_0x1cf89e[_0x129b('0x1c')]==='dialer'&&_0x1cf89e[_0x129b('0x50')]===_0x129b('0x51')){this['talking']+=0x1;}}if(this[_0x129b('0x3')]>this[_0x129b('0x7')]){this[_0x129b('0x3')]=this[_0x129b('0x7')];}this['pTalking']=0x0;}return this;};VoiceQueueSummary['prototype'][_0x129b('0x52')]=function(_0x18ffcf){var _0x4543d9=![];if(_0x18ffcf){_0x4543d9=INBOUND_COUNTERS[_0x129b('0x53')](function(_0x22560b){return this[_0x22560b]!==_0x18ffcf[_0x22560b];},this);}return _0x4543d9;};VoiceQueueSummary[_0x129b('0x47')][_0x129b('0x54')]=function(_0x17c311){var _0x647f99=![];var _0x241a27=![];var _0x357b3a=![];if(_0x17c311){_0x647f99=this[_0x129b('0x22')]!==_0x17c311['dialMethod']||this[_0x129b('0x21')]!==_0x17c311[_0x129b('0x21')]||this['message']!==_0x17c311[_0x129b('0x42')]||this['statusMessage']!==_0x17c311['statusMessage'];_0x241a27=OUTBOUND_COUNTERS['some'](function(_0x1ef884){return this[_0x1ef884]!==_0x17c311[_0x1ef884];},this);if(this[_0x129b('0x44')]&&_0x17c311[_0x129b('0x44')]){_0x357b3a=this[_0x129b('0x44')][_0x129b('0x12')]!==_0x17c311[_0x129b('0x44')][_0x129b('0x12')]||this[_0x129b('0x44')][_0x129b('0x45')]!==_0x17c311[_0x129b('0x44')][_0x129b('0x45')];}}return _0x647f99||_0x241a27||_0x357b3a;};VoiceQueueSummary['prototype'][_0x129b('0x55')]=function(_0xed7396){this['answered']=_0xed7396[_0x129b('0x6')];this['message']=_0xed7396['message'];this['statusMessage']=_0xed7396[_0x129b('0x43')];this['originated']=_0xed7396['originated'];this[_0x129b('0x56')]=_0xed7396['outboundAbandonedCallsDay'];this[_0x129b('0xa')]=_0xed7396[_0x129b('0xa')];this['outboundBlacklistCallsDay']=_0xed7396[_0x129b('0x29')];this['outboundBusyCallsDay']=_0xed7396[_0x129b('0xb')];this[_0x129b('0xc')]=_0xed7396[_0x129b('0xc')];this['outboundNoAnswerCallsDay']=_0xed7396[_0x129b('0x2d')];this[_0x129b('0x2e')]=_0xed7396[_0x129b('0x2e')];this[_0x129b('0xd')]=_0xed7396[_0x129b('0xd')];this['outboundRejectCallsDay']=_0xed7396['outboundRejectCallsDay'];this[_0x129b('0xe')]=_0xed7396[_0x129b('0xe')];this[_0x129b('0x10')]=_0xed7396[_0x129b('0x10')];this['sumDuration']=_0xed7396['sumDuration'];this[_0x129b('0x1b')]=_0xed7396[_0x129b('0x1b')];if(this[_0x129b('0x22')]===_0x129b('0x57')){this[_0x129b('0xf')]=_0xed7396[_0x129b('0xf')];}};module[_0x129b('0x58')]=VoiceQueueSummary; \ No newline at end of file diff --git a/server/services/ami/model/vtigerAccount.js b/server/services/ami/model/vtigerAccount.js index ab489a0..3605dca 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 _0xd0fc=['username','accessKey','remoteUri','serverUrl','Configurations','exports','name'];(function(_0x29b609,_0x19d388){var _0x54c952=function(_0xb3c38d){while(--_0xb3c38d){_0x29b609['push'](_0x29b609['shift']());}};_0x54c952(++_0x19d388);}(_0xd0fc,0x1a3));var _0xcd0f=function(_0x4d6f07,_0xd498d3){_0x4d6f07=_0x4d6f07-0x0;var _0x5c23a4=_0xd0fc[_0x4d6f07];return _0x5c23a4;};'use strict';function VtigerAccount(_0x192eae){this['id']=_0x192eae['id']||0x0;this[_0xcd0f('0x0')]=_0x192eae[_0xcd0f('0x0')]||'';this[_0xcd0f('0x1')]=_0x192eae[_0xcd0f('0x1')]||'';this[_0xcd0f('0x2')]=_0x192eae[_0xcd0f('0x2')]||'';this[_0xcd0f('0x3')]=_0x192eae[_0xcd0f('0x3')]||'';this[_0xcd0f('0x4')]=_0x192eae[_0xcd0f('0x4')]||'';this[_0xcd0f('0x5')]=_0x192eae['Configurations']||{};}module[_0xcd0f('0x6')]=VtigerAccount; \ No newline at end of file +var _0x680d=['exports','name','accessKey','remoteUri','serverUrl','Configurations'];(function(_0x51447c,_0x585d42){var _0x486889=function(_0x1b60a6){while(--_0x1b60a6){_0x51447c['push'](_0x51447c['shift']());}};_0x486889(++_0x585d42);}(_0x680d,0x6d));var _0xd680=function(_0x47b70e,_0x556109){_0x47b70e=_0x47b70e-0x0;var _0x2cb0b3=_0x680d[_0x47b70e];return _0x2cb0b3;};'use strict';function VtigerAccount(_0x3f24e5){this['id']=_0x3f24e5['id']||0x0;this[_0xd680('0x0')]=_0x3f24e5['name']||'';this['username']=_0x3f24e5['username']||'';this[_0xd680('0x1')]=_0x3f24e5[_0xd680('0x1')]||'';this[_0xd680('0x2')]=_0x3f24e5[_0xd680('0x2')]||'';this[_0xd680('0x3')]=_0x3f24e5['serverUrl']||'';this[_0xd680('0x4')]=_0x3f24e5[_0xd680('0x4')]||{};}module[_0xd680('0x5')]=VtigerAccount; \ No newline at end of file diff --git a/server/services/ami/model/zendeskAccount.js b/server/services/ami/model/zendeskAccount.js index 918c2d1..d9cbf45 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 _0x24cd=['token','remoteUri','authType','integrationTab','serverUrl','Configurations','exports','name','username','password'];(function(_0x9e54b5,_0x5c10ea){var _0x44dee2=function(_0x5e4a0c){while(--_0x5e4a0c){_0x9e54b5['push'](_0x9e54b5['shift']());}};_0x44dee2(++_0x5c10ea);}(_0x24cd,0xcf));var _0xd24c=function(_0x3fd1cd,_0x3dc978){_0x3fd1cd=_0x3fd1cd-0x0;var _0x40db2e=_0x24cd[_0x3fd1cd];return _0x40db2e;};'use strict';function ZendeskAccount(_0x3afc67){this['id']=_0x3afc67['id']||0x0;this['name']=_0x3afc67[_0xd24c('0x0')]||'';this[_0xd24c('0x1')]=_0x3afc67[_0xd24c('0x1')]||'';this[_0xd24c('0x2')]=_0x3afc67['password']||'';this[_0xd24c('0x3')]=_0x3afc67['token']||'';this[_0xd24c('0x4')]=_0x3afc67['remoteUri']||'';this[_0xd24c('0x5')]=_0x3afc67['authType']||'';this['type']=_0x3afc67['type']||_0xd24c('0x6');this[_0xd24c('0x7')]=_0x3afc67[_0xd24c('0x7')]||'';this[_0xd24c('0x8')]=_0x3afc67['Configurations']||{};}module[_0xd24c('0x9')]=ZendeskAccount; \ No newline at end of file +var _0x4150=['authType','type','integrationTab','serverUrl','exports','name','username','password','token','remoteUri'];(function(_0x1adc50,_0x2ec177){var _0x2bfee4=function(_0x2bc695){while(--_0x2bc695){_0x1adc50['push'](_0x1adc50['shift']());}};_0x2bfee4(++_0x2ec177);}(_0x4150,0x131));var _0x0415=function(_0x872a17,_0x279f85){_0x872a17=_0x872a17-0x0;var _0x295b95=_0x4150[_0x872a17];return _0x295b95;};'use strict';function ZendeskAccount(_0x17c7cc){this['id']=_0x17c7cc['id']||0x0;this[_0x0415('0x0')]=_0x17c7cc[_0x0415('0x0')]||'';this['username']=_0x17c7cc[_0x0415('0x1')]||'';this['password']=_0x17c7cc[_0x0415('0x2')]||'';this[_0x0415('0x3')]=_0x17c7cc[_0x0415('0x3')]||'';this[_0x0415('0x4')]=_0x17c7cc[_0x0415('0x4')]||'';this[_0x0415('0x5')]=_0x17c7cc[_0x0415('0x5')]||'';this['type']=_0x17c7cc[_0x0415('0x6')]||_0x0415('0x7');this[_0x0415('0x8')]=_0x17c7cc[_0x0415('0x8')]||'';this['Configurations']=_0x17c7cc['Configurations']||{};}module[_0x0415('0x9')]=ZendeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/zohoAccount.js b/server/services/ami/model/zohoAccount.js index 6db9917..2046a1f 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 _0x981f=['serverUrl','code','refreshToken','Configurations','exports','name','description','host','clientId','clientSecret'];(function(_0x466d24,_0x3a3d6c){var _0x535da6=function(_0x241c41){while(--_0x241c41){_0x466d24['push'](_0x466d24['shift']());}};_0x535da6(++_0x3a3d6c);}(_0x981f,0x145));var _0xf981=function(_0x1b40df,_0x48fbea){_0x1b40df=_0x1b40df-0x0;var _0x115723=_0x981f[_0x1b40df];return _0x115723;};'use strict';function ZohoAccount(_0x965a83){this['id']=_0x965a83['id']||0x0;this['name']=_0x965a83[_0xf981('0x0')]||'';this[_0xf981('0x1')]=_0x965a83[_0xf981('0x1')]||'';this[_0xf981('0x2')]=_0x965a83[_0xf981('0x2')]||'';this['zone']=_0x965a83['zone']||'';this[_0xf981('0x3')]=_0x965a83[_0xf981('0x3')]||'';this[_0xf981('0x4')]=_0x965a83['clientSecret']||'';this['serverUrl']=_0x965a83[_0xf981('0x5')]||'';this[_0xf981('0x6')]=_0x965a83['code']||'';this[_0xf981('0x7')]=_0x965a83['refreshToken']||'';this[_0xf981('0x8')]=_0x965a83[_0xf981('0x8')]||{};}module[_0xf981('0x9')]=ZohoAccount; \ No newline at end of file +var _0x7167=['name','description','host','zone','clientId','clientSecret','serverUrl','code','refreshToken','Configurations','exports'];(function(_0x349148,_0x31eabb){var _0x2f2b0f=function(_0x44726e){while(--_0x44726e){_0x349148['push'](_0x349148['shift']());}};_0x2f2b0f(++_0x31eabb);}(_0x7167,0x113));var _0x7716=function(_0x3d80ae,_0x115102){_0x3d80ae=_0x3d80ae-0x0;var _0x5be6cc=_0x7167[_0x3d80ae];return _0x5be6cc;};'use strict';function ZohoAccount(_0x5c92a5){this['id']=_0x5c92a5['id']||0x0;this[_0x7716('0x0')]=_0x5c92a5['name']||'';this[_0x7716('0x1')]=_0x5c92a5['description']||'';this['host']=_0x5c92a5[_0x7716('0x2')]||'';this['zone']=_0x5c92a5[_0x7716('0x3')]||'';this[_0x7716('0x4')]=_0x5c92a5[_0x7716('0x4')]||'';this['clientSecret']=_0x5c92a5[_0x7716('0x5')]||'';this[_0x7716('0x6')]=_0x5c92a5[_0x7716('0x6')]||'';this[_0x7716('0x7')]=_0x5c92a5['code']||'';this[_0x7716('0x8')]=_0x5c92a5[_0x7716('0x8')]||'';this[_0x7716('0x9')]=_0x5c92a5[_0x7716('0x9')]||{};}module[_0x7716('0xa')]=ZohoAccount; \ No newline at end of file diff --git a/server/services/ami/preview/action.js b/server/services/ami/preview/action.js index 12dc0f6..c5feed7 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 _0x8952=['originatecalleridnum','originatecalleridname','getCaller','exports','lodash','moment','isNil','string','uniqueid','idContact','queue','name','type','campaigntype','dialAnswer','Agent','channelAgent','format','SIP/%s','calleridname','Contact','firstName','active','calleridnum','phone','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','callback','callbackuniqueid','callbackat','ContactId','ListId','UserId','VoiceQueueId'];(function(_0x1888f8,_0x14fa68){var _0x2c3c15=function(_0x175f14){while(--_0x175f14){_0x1888f8['push'](_0x1888f8['shift']());}};_0x2c3c15(++_0x14fa68);}(_0x8952,0x17e));var _0x2895=function(_0x5d4723,_0x539f69){_0x5d4723=_0x5d4723-0x0;var _0x194fa8=_0x8952[_0x5d4723];return _0x194fa8;};'use strict';var util=require('util');var _=require(_0x2895('0x0'));var moment=require(_0x2895('0x1'));function checkNameSurname(_0x43e8d9,_0x2d485c,_0x2454c5){var _0x58085b='';if(!_[_0x2895('0x2')](_0x2d485c)&&_0x2895('0x3')===typeof _0x2d485c){_0x58085b+=_0x2d485c;}if(!_[_0x2895('0x2')](_0x2454c5)&&'string'===typeof _0x2454c5){_0x58085b+='\x20'+_0x2454c5;}if(_0x58085b!==''){return _0x58085b;}return _0x43e8d9;}function Action(_0x32429c,_0x73c245,_0x37305b,_0x4ea619,_0x526c32){this[_0x2895('0x4')]=_0x37305b||undefined;this[_0x2895('0x5')]=_0x32429c['id'];this[_0x2895('0x6')]=_0x73c245[_0x2895('0x7')];this[_0x2895('0x8')]=_0x73c245['type'];this[_0x2895('0x9')]='queue';this[_0x2895('0xa')]=![];this['membername']=_['isNil'](_0x32429c['Agent'])?undefined:_0x32429c[_0x2895('0xb')][_0x2895('0x7')];this[_0x2895('0xc')]=this['membername']?util[_0x2895('0xd')](_0x2895('0xe'),this['membername']):_0x4ea619||undefined;this[_0x2895('0xf')]=checkNameSurname(_0x32429c[_0x2895('0x10')]['phone'],_0x32429c['Contact'][_0x2895('0x11')],_0x32429c[_0x2895('0x10')]['lastName']);this[_0x2895('0x12')]=_0x32429c[_0x2895('0x12')]||![];this[_0x2895('0x13')]=_0x32429c[_0x2895('0x14')];this[_0x2895('0x15')]=_0x32429c[_0x2895('0x15')];this[_0x2895('0x16')]=_0x32429c[_0x2895('0x16')]||0x0;this[_0x2895('0x17')]=_0x32429c[_0x2895('0x17')]||0x0;this[_0x2895('0x18')]=_0x32429c[_0x2895('0x18')]||0x0;this[_0x2895('0x19')]=(_0x32429c[_0x2895('0x16')]||0x0)+(_0x32429c[_0x2895('0x17')]||0x0)+(_0x32429c[_0x2895('0x18')]||0x0)+(_0x32429c[_0x2895('0x1a')]||0x0)+(_0x32429c[_0x2895('0x1b')]||0x0)+(_0x32429c['countabandonedretry']||0x0)+(_0x32429c['countmachineretry']||0x0)+(_0x32429c['countagentrejectretry']||0x0);this[_0x2895('0x1a')]=_0x32429c[_0x2895('0x1a')]||0x0;this[_0x2895('0x1b')]=_0x32429c['countdropretry']||0x0;this[_0x2895('0x1c')]=_0x32429c[_0x2895('0x1c')]||0x0;this[_0x2895('0x1d')]=_0x32429c[_0x2895('0x1d')]||0x0;this[_0x2895('0x1e')]=_0x32429c['countagentrejectretry']||0x0;this[_0x2895('0x1f')]=_0x32429c[_0x2895('0x1f')];this['callbackuniqueid']=_0x32429c[_0x2895('0x20')];this[_0x2895('0x21')]=_0x32429c[_0x2895('0x21')];this['recallme']=_0x32429c['recallme'];this[_0x2895('0x22')]=_0x32429c[_0x2895('0x22')];this[_0x2895('0x23')]=_0x32429c['ListId'];this[_0x2895('0x24')]=_[_0x2895('0x2')](_0x32429c['Agent'])?_0x32429c[_0x2895('0x24')]:_0x32429c[_0x2895('0xb')]['id'];this[_0x2895('0x25')]=_0x32429c['VoiceQueueId'];this[_0x2895('0x26')]='';this[_0x2895('0x27')]='';}Action['prototype'][_0x2895('0x28')]=function(){return util['format']('\x22%s\x22\x20<%s>',this[_0x2895('0xf')],this['number']);};module[_0x2895('0x29')]=Action; \ No newline at end of file +var _0x3423=['Agent','membername','SIP/%s','Contact','phone','firstName','lastName','active','calleridnum','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countmachineretry','countagentrejectretry','countabandonedretry','callback','callbackuniqueid','callbackat','recallme','ContactId','UserId','VoiceQueueId','prototype','getCaller','format','calleridname','number','exports','moment','isNil','string','uniqueid','idContact','queue','name','type'];(function(_0x4fc9e6,_0xc51915){var _0x551d28=function(_0x1a603b){while(--_0x1a603b){_0x4fc9e6['push'](_0x4fc9e6['shift']());}};_0x551d28(++_0xc51915);}(_0x3423,0x188));var _0x3342=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3423[_0x3dd15e];return _0x231fd0;};'use strict';var util=require('util');var _=require('lodash');var moment=require(_0x3342('0x0'));function checkNameSurname(_0x16bdb3,_0x3477de,_0x3b763d){var _0x21bdc2='';if(!_[_0x3342('0x1')](_0x3477de)&&_0x3342('0x2')===typeof _0x3477de){_0x21bdc2+=_0x3477de;}if(!_[_0x3342('0x1')](_0x3b763d)&&_0x3342('0x2')===typeof _0x3b763d){_0x21bdc2+='\x20'+_0x3b763d;}if(_0x21bdc2!==''){return _0x21bdc2;}return _0x16bdb3;}function Action(_0x19206f,_0x467453,_0x2ccbe0,_0x29c40c,_0x420d4b){this[_0x3342('0x3')]=_0x2ccbe0||undefined;this[_0x3342('0x4')]=_0x19206f['id'];this[_0x3342('0x5')]=_0x467453[_0x3342('0x6')];this[_0x3342('0x7')]=_0x467453['type'];this['campaigntype']=_0x3342('0x5');this['dialAnswer']=![];this['membername']=_['isNil'](_0x19206f['Agent'])?undefined:_0x19206f[_0x3342('0x8')][_0x3342('0x6')];this['channelAgent']=this[_0x3342('0x9')]?util['format'](_0x3342('0xa'),this[_0x3342('0x9')]):_0x29c40c||undefined;this['calleridname']=checkNameSurname(_0x19206f[_0x3342('0xb')][_0x3342('0xc')],_0x19206f[_0x3342('0xb')][_0x3342('0xd')],_0x19206f[_0x3342('0xb')][_0x3342('0xe')]);this[_0x3342('0xf')]=_0x19206f['active']||![];this[_0x3342('0x10')]=_0x19206f[_0x3342('0xc')];this['scheduledat']=_0x19206f[_0x3342('0x11')];this[_0x3342('0x12')]=_0x19206f['countbusyretry']||0x0;this['countcongestionretry']=_0x19206f[_0x3342('0x13')]||0x0;this[_0x3342('0x14')]=_0x19206f[_0x3342('0x14')]||0x0;this[_0x3342('0x15')]=(_0x19206f[_0x3342('0x12')]||0x0)+(_0x19206f[_0x3342('0x13')]||0x0)+(_0x19206f[_0x3342('0x14')]||0x0)+(_0x19206f[_0x3342('0x16')]||0x0)+(_0x19206f[_0x3342('0x17')]||0x0)+(_0x19206f['countabandonedretry']||0x0)+(_0x19206f[_0x3342('0x18')]||0x0)+(_0x19206f[_0x3342('0x19')]||0x0);this[_0x3342('0x16')]=_0x19206f['countnosuchnumberretry']||0x0;this[_0x3342('0x17')]=_0x19206f[_0x3342('0x17')]||0x0;this['countabandonedretry']=_0x19206f[_0x3342('0x1a')]||0x0;this[_0x3342('0x18')]=_0x19206f['countmachineretry']||0x0;this[_0x3342('0x19')]=_0x19206f['countagentrejectretry']||0x0;this[_0x3342('0x1b')]=_0x19206f[_0x3342('0x1b')];this[_0x3342('0x1c')]=_0x19206f[_0x3342('0x1c')];this[_0x3342('0x1d')]=_0x19206f[_0x3342('0x1d')];this[_0x3342('0x1e')]=_0x19206f[_0x3342('0x1e')];this['ContactId']=_0x19206f[_0x3342('0x1f')];this['ListId']=_0x19206f['ListId'];this[_0x3342('0x20')]=_['isNil'](_0x19206f['Agent'])?_0x19206f[_0x3342('0x20')]:_0x19206f['Agent']['id'];this[_0x3342('0x21')]=_0x19206f['VoiceQueueId'];this['originatecalleridnum']='';this['originatecalleridname']='';}Action[_0x3342('0x22')][_0x3342('0x23')]=function(){return util[_0x3342('0x24')]('\x22%s\x22\x20<%s>',this[_0x3342('0x25')],this[_0x3342('0x26')]);};module[_0x3342('0x27')]=Action; \ No newline at end of file diff --git a/server/services/ami/preview/index.js b/server/services/ami/preview/index.js index 2a122ba..a0b96b7 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 _0xbac8=['answered','decrementTalkink','[16]','[callProgressDetectingCustomer][logAnswerGlobal]','talktime','sumBillable','[syncHangup][talking][decrement]','BUSY','outboundBusyCallsDay','countbusyretry','Busy','dialBusyRetryFrequency','custom:agentbusy','busy','[callProgressDetectingCustomer][logBusy]','verifyAdditionalPhones','dialGlobalMaxRetry','Global','dialBusyMaxRetry','NOANSWER','outboundNoAnswerCallsDay','countnoanswerretry','NoAnswer','dialNoAnswerRetryFrequency','buildNoAnswerEventPayload','[callProgressDetectingCustomer][logNoAnswer]','dialNoAnswerMaxRetry','incrementPreviewCounters','CONGESTION','outboundCongestionCallsDay','countcongestionretry','Congestion','congestion','dialCongestionMaxRetry','[callProgressDetectingCustomer][logCongestion]','CANCEL','outboundRejectCallsDay','countagentrejectretry','dialAgentRejectRetryFrequency','custom:agentreject','agentreject','[syncHangupRequest][logAgentReject]','AgentReject','[callProgressDetectingCustomer][logAgentReject]','dialAgentRejectMaxRetry','ABANDONED','outboundAbandonedCallsDay','countabandonedretry','Abandoned','[callProgressDetectingCustomer][logAbandoned]','countabandonedetry','dialAbandonedMaxRety','dialAbandonedRetryFrequency','countmachineretry','dialstatus','custom:amd','amd','[callProgressDetectingCustomer][hangupInAMD]','cause-txt','[callProgressDetectingCustomer][machine]','[default]','outboundUnknownCallsDay','[callProgressDetectingCustomer][logUnknown]','[callProgressDetectingCustomer][logUnknownGlobal]','[originated][decrement][callProgressDetectingCustomer]','destlinkedid','queueSummaryCountersUpdated','callProgressDetectingAgent','object','isUndefined','logAgent','createAgentHistory','[callProgressDetectingAgent][logNoSuch]','[callProgressDetectingAgent][logBusy]','AnswerAGI','[callProgressDetectingAgent][logCongestion]','[callProgressDetectingAgent]','[originated][decrement][callProgressDetectingAgent]','[verifyAdditionalPhone]\x20','[swapAdditionalPhone]\x20','[incrementPreviewCounters]\x20','checkInBlack','Contact','Contact\x20is\x20undefined','isEmpty','execCall','[Preview][execCall][success]','Queue:\x20','\x20IdHopper:\x20','called','Calling','[Preview][execCall][failure]','Call\x20failed','outboundBlacklistCallsDay','logBlacklist','createHistory','[Blacklist][error]','active','SIP/%s','reachable','unmonitored','run','execRun','pick','unlock','unlockContact','getContactPreview','recallme','validateContact','isValid','checkIsBlackList','phone','[Preview][checkIsBlackList]','[Preview][getContactPreview]','Call\x20unsuccessful','[Preview][validateContact][Empty\x20Contact]','Empty\x20Contact','Empty\x20Campaign','[Preview][validateContact][Trunk\x20not\x20working\x20correctly]','\x20Trunk\x20Backup\x20is\x20not\x20active','Trunk\x20not\x20working\x20correctly','isActive','[Preview][validateContact][Campaign\x20Active]','\x20Not\x20Active','Is\x20Valid','SIP/%s/%s%s','dialPrefix','dialCutDigit','substring','getCallerId','callerid','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','dialOriginateCallerIdNumber','dialOriginateCallerIdName','originatecalleridname','extractCalleridName','originatecalleridnum','extractCalleridNumber','addVariables','setXMDContactVariables','assign','merge','toLowerVariables','variables','OriginateError','actionid','lookAgent','custom:agentringnoanswer','rejected','Answer','[callProgressDetectingAgent][logAnswer]','syncHangup','cause','channelstate','transfer','[syncHangup][talking][transfer]','syncDialEnd','addVariable','syncVarSet','filterKey','keys','variable','value','error','[syncVarSet][Preview]','inspect','transfertargetlinkedid','transfererlinkedid','exports','lodash','uuid','moment','ioredis','../../../config/environment','../../../config/logger','preview','../rpc/cmHopperAdditionalPhone','./action','./util/util','../dialer/utils','redis','localhost','socket.io-emitter','prototype','enqueue','tail','sequence','campaignsPreview','voiceQueues','trunks','actions','agents','clockClearZombieChannels','syncOriginateResponse','bind','hanguprequest','syncHangupRequest','dialend','newexten','syncNewExten','varset','syncAttendedTransfer','blindtransfer','syncBlindTransfer','loopCampaigns','emit','info','[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event','stringify','format','name','voice_queue_channel:remove','voice_queue_presence:remove','sendMessageOneNotActive','originated','CAMPAIGN_STATUS','INACTIVE','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20not\x20active','logger','\x20is\x20deactivated','dialMethod','booked','type','outbound','clearZombieChannels','hasOwnProperty','dialActive','setMessage','dialPreviewAutoRecallMe','recallMe','clearZombieChannel','isNil','[clearZombieChannels][talking]','Queue','queue','originated:\x20','pTalking:\x20','pTalking','dialAnswer','contactId','VoiceQueueId','Action','status','channel','catch','message','No\x20such\x20channel','updateOriginated','[clearZombieChannel]','loggerError','[Dialer][checkChannel][pTalking][Preview]','[Dialer][checkChannel][Preview]','[action]','size','getContactRecallMe','then','length','getDiff','scheduledat','dialRecallMeTimeout','Agent','logger2','[RecallMe]','disableContact','starttime','YYYY-MM-DD\x20HH:mm:ss','outboundReCallsDay','logCustomer','RecallInQueue','dialRecallInQueue','rescheduleContactInQueue','createBody','createCustomerHistory','[HistoryDialRecallInQueue][historyCatch]','RecallFailedTimeout','[HistoryRecallClose]','[getContactRecallMe]','IsNotLoggedIn','loggedIn','isTrunkReachable','Trunk','TrunkBackup','UNREACHABLE_TRUNK','ACTIVE','callProgressDetectingCustomer','outboundNoSuchCallsDay','countnosuchnumberretry','countglobal','totalGlobal','NoSuchNumber','nosuchnumber','additional','callAdditionalPhoneAfterMin','cloneAction','dialNoSuchNumberMaxRetry','createCustomerFinal','[callProgressDetectingCustomer][logNoSuchGlobal]','rescheduleContact','scheduledAt','unlockAgent','activeContact','linkedid','actioncountonusuch','idContact','swapAdditionalPhones','ANSWER','responsetime','answertime','[syncHangup][talking][increment]','uniqueid','\x20Queue','buildObj','connect','acw','custom:agentConnectPreview','buildAcw','custom:agentcomplete','complete','outboundAnswerCallsDay','total'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xbac8,0x1ec));var _0x8bac=function(_0x2c778b,_0x144e2d){_0x2c778b=_0x2c778b-0x0;var _0x11181b=_0xbac8[_0x2c778b];return _0x11181b;};'use strict';var util=require('util');var _=require(_0x8bac('0x0'));var uuid=require(_0x8bac('0x1'));var moment=require(_0x8bac('0x2'));var Redis=require(_0x8bac('0x3'));var config=require(_0x8bac('0x4'));var logger=require(_0x8bac('0x5'))(_0x8bac('0x6'));var loggerAction=require(_0x8bac('0x5'))('actionPreview');var ami=require('../ami');var rpcDb=require('./rpcDb');var cmHopperAdditionalPhone=require(_0x8bac('0x7'));var Action=require(_0x8bac('0x8'));var ut=require(_0x8bac('0x9'));var utils=require(_0x8bac('0xa'));config[_0x8bac('0xb')]=_['defaults'](config[_0x8bac('0xb')],{'host':_0x8bac('0xc'),'port':0x18eb});var io=require(_0x8bac('0xd'))(new Redis(config[_0x8bac('0xb')]));var Sequence=function(){};Sequence[_0x8bac('0xe')][_0x8bac('0xf')]=function(_0x270ebc){this[_0x8bac('0x10')]=this['tail']?this[_0x8bac('0x10')]['finally'](_0x270ebc):_0x270ebc();};function Preview(_0x1dac07){this[_0x8bac('0x11')]=new Sequence();this[_0x8bac('0x12')]=_0x1dac07[_0x8bac('0x13')];this[_0x8bac('0x14')]=_0x1dac07['trunks'];this[_0x8bac('0x15')]={};this[_0x8bac('0x16')]=_0x1dac07['agents'];this[_0x8bac('0x17')]=0x0;ami['on']('originateresponse',this[_0x8bac('0x18')][_0x8bac('0x19')](this));ami['on']('hangup',this['syncHangup'][_0x8bac('0x19')](this));ami['on'](_0x8bac('0x1a'),this[_0x8bac('0x1b')][_0x8bac('0x19')](this));ami['on'](_0x8bac('0x1c'),this['syncDialEnd']['bind'](this));ami['on'](_0x8bac('0x1d'),this[_0x8bac('0x1e')]['bind'](this));ami['on'](_0x8bac('0x1f'),this['syncVarSet'][_0x8bac('0x19')](this));ami['on']('attendedtransfer',this[_0x8bac('0x20')][_0x8bac('0x19')](this));ami['on'](_0x8bac('0x21'),this[_0x8bac('0x22')][_0x8bac('0x19')](this));this[_0x8bac('0x23')](this[_0x8bac('0x12')]);}function emit(_0x4c0cf3,_0x6e46cf,_0x2da984){io['to'](_0x4c0cf3)[_0x8bac('0x24')](_0x6e46cf,_0x2da984);}function emitVoiceQueueChannelRemove(_0x21fdaa){logger[_0x8bac('0x25')](_0x8bac('0x26'),JSON[_0x8bac('0x27')](_0x21fdaa));emit(util[_0x8bac('0x28')]('voice:queue:%s',_0x21fdaa[_0x8bac('0x29')]),_0x8bac('0x2a'),_0x21fdaa);io[_0x8bac('0x24')](_0x8bac('0x2b'),_0x21fdaa);}function notSendMessagesQueue(_0x4adf41){if(_0x4adf41[_0x8bac('0x2c')]){if(_0x4adf41[_0x8bac('0x2d')]===0x0&&_0x4adf41['pTalking']===0x0){_0x4adf41['sendMessageOneNotActive']=![];_0x4adf41['available']=0x0;_0x4adf41['paused']=0x0;_0x4adf41['message']=utils[_0x8bac('0x2e')][_0x8bac('0x2f')];ut['logger'](_0x8bac('0x30'),_0x4adf41[_0x8bac('0x29')]+_0x8bac('0x31'));}else{_0x4adf41['message']=utils[_0x8bac('0x2e')]['DEACTIVATED'];ut[_0x8bac('0x32')](_0x8bac('0x30'),_0x4adf41[_0x8bac('0x29')]+_0x8bac('0x33'));}}}Preview[_0x8bac('0xe')]['loopCampaigns']=function(){var _0x41c2c3=this;setInterval(function(){_0x41c2c3['syncCampaigns']();},0x7cf);};Preview['prototype']['syncCampaigns']=function(){var _0x2e85bd=this[_0x8bac('0x12')];this[_0x8bac('0x17')]+=0x1;for(var _0x33a493 in _0x2e85bd){if(_0x2e85bd['hasOwnProperty'](_0x33a493)&&(_0x2e85bd[_0x33a493][_0x8bac('0x34')]===_0x8bac('0x6')||_0x2e85bd[_0x33a493][_0x8bac('0x34')]===_0x8bac('0x35'))&&_0x2e85bd[_0x33a493][_0x8bac('0x36')]===_0x8bac('0x37')){if(this[_0x8bac('0x17')]>0x7){this['clockClearZombieChannels']=0x0;this[_0x8bac('0x38')]();}}if(_0x2e85bd[_0x8bac('0x39')](_0x33a493)&&_0x2e85bd[_0x33a493][_0x8bac('0x34')]===_0x8bac('0x6')&&_0x2e85bd[_0x33a493][_0x8bac('0x36')]==='outbound'){if(_0x2e85bd[_0x33a493][_0x8bac('0x3a')]){this[_0x8bac('0x3b')](_0x2e85bd[_0x33a493]);if(_0x2e85bd[_0x33a493][_0x8bac('0x3c')])this[_0x8bac('0x3d')](_0x2e85bd[_0x33a493]);}else{notSendMessagesQueue(_0x2e85bd[_0x33a493]);}}}};Preview[_0x8bac('0xe')][_0x8bac('0x3e')]=function(_0x433cce){var _0x529009=this;this[_0x8bac('0x11')][_0x8bac('0xf')](function(){if(!_[_0x8bac('0x3f')](_0x529009[_0x8bac('0x15')][_0x433cce])){loggerAction['info'](_0x8bac('0x40'),_0x433cce,_0x8bac('0x41'),_0x529009[_0x8bac('0x15')][_0x433cce][_0x8bac('0x42')],_0x8bac('0x43'),JSON[_0x8bac('0x27')](_0x529009[_0x8bac('0x12')][_0x529009[_0x8bac('0x15')][_0x433cce]['queue']][_0x8bac('0x2d')]),_0x8bac('0x44'),JSON[_0x8bac('0x27')](_0x529009[_0x8bac('0x12')][_0x529009[_0x8bac('0x15')][_0x433cce][_0x8bac('0x42')]][_0x8bac('0x45')]),JSON[_0x8bac('0x27')](_0x529009[_0x8bac('0x15')][_0x433cce][_0x8bac('0x46')]),JSON[_0x8bac('0x27')](_['pick'](_0x529009[_0x8bac('0x15')][_0x433cce],[_0x8bac('0x47'),'UserId',_0x8bac('0x48'),'ListId'])));return ami[_0x8bac('0x49')]({'action':_0x8bac('0x4a'),'channel':_0x529009['actions'][_0x433cce][_0x8bac('0x4b')]})[_0x8bac('0x4c')](function(_0x33d4b1){if(_0x33d4b1[_0x8bac('0x4d')]===_0x8bac('0x4e')){setTimeout(function(){if(_0x529009[_0x8bac('0x15')][_0x433cce]){ut[_0x8bac('0x4f')](_0x529009['campaignsPreview'][_0x529009['actions'][_0x433cce][_0x8bac('0x42')]],_0x8bac('0x50'));if(_0x529009[_0x8bac('0x15')][_0x433cce][_0x8bac('0x46')]===!![]){ut['decrementTalkink'](_0x529009[_0x8bac('0x12')][_0x529009[_0x8bac('0x15')][_0x433cce][_0x8bac('0x42')]],_0x8bac('0x50'));ut[_0x8bac('0x51')](_0x8bac('0x52')+_0x433cce,_0x529009[_0x8bac('0x15')][_0x433cce]['queue']);}ut[_0x8bac('0x51')](_0x8bac('0x53')+_0x433cce,_0x529009[_0x8bac('0x15')][_0x433cce][_0x8bac('0x42')]);delete _0x529009[_0x8bac('0x15')][_0x433cce];}},0x2328);}});}});};Preview['prototype'][_0x8bac('0x38')]=function(){var _0x238b7d=this;loggerAction['info'](_0x8bac('0x54'),_[_0x8bac('0x55')](this[_0x8bac('0x15')]));for(var _0x52adaf in this['actions']){if(_0x238b7d[_0x8bac('0x15')][_0x8bac('0x39')](_0x52adaf)){_0x238b7d['clearZombieChannel'](_0x52adaf);}}};Preview[_0x8bac('0xe')][_0x8bac('0x3d')]=function(_0x1a7218){var _0x141bbe=this;rpcDb[_0x8bac('0x56')](_0x1a7218['id'],ut['agentReadyId'](this['agents']))[_0x8bac('0x57')](function(_0x438221){if(!_[_0x8bac('0x3f')](_0x438221)){for(var _0x311acd=0x0;_0x311acd<_0x438221[_0x8bac('0x58')];_0x311acd+=0x1){if(ut[_0x8bac('0x59')](_0x438221[_0x311acd][_0x8bac('0x5a')])<_0x1a7218[_0x8bac('0x5b')]*0x3c){if(_0x438221[_0x311acd][_0x8bac('0x5c')]&&!_0x438221[_0x311acd][_0x8bac('0x5c')]['voicePause']){_0x141bbe['run'](_0x438221[_0x311acd]['id'])[_0x8bac('0x57')](ut[_0x8bac('0x5d')](_0x8bac('0x5e')))[_0x8bac('0x4c')](ut['logger2'](_0x8bac('0x5e')));}else{rpcDb[_0x8bac('0x5f')](_0x438221[_0x311acd]['id']);}}else{var _0x5e6efd=new Action(_0x438221[_0x311acd],_0x1a7218);_0x5e6efd[_0x8bac('0x60')]=moment()['format'](_0x8bac('0x61'));_0x1a7218[_0x8bac('0x62')]+=0x1;ut[_0x8bac('0x63')](_0x5e6efd,0x17,_0x8bac('0x64'));if(_0x1a7218[_0x8bac('0x65')]){rpcDb[_0x8bac('0x66')](ut[_0x8bac('0x67')](_0x438221[_0x311acd]));rpcDb[_0x8bac('0x68')](_0x5e6efd,_0x8bac('0x69'));}else{ut[_0x8bac('0x63')](_0x5e6efd,0x16,_0x8bac('0x6a'));rpcDb[_0x8bac('0x68')](_0x5e6efd,'[HistoryRecallClose]');rpcDb['createCustomerFinal'](_0x5e6efd,_0x8bac('0x6b'));}}}}})['catch'](ut['logger2'](_0x8bac('0x6c')));};Preview['prototype'][_0x8bac('0x3b')]=function(_0x26683b){_0x26683b['sendMessageOneNotActive']=!![];if(ut[_0x8bac('0x6d')](_0x26683b[_0x8bac('0x6e')])){_0x26683b[_0x8bac('0x4d')]=utils[_0x8bac('0x2e')]['NO_AGENTS_LOGGED'];}else if(!ut['isActive'](_0x26683b[_0x8bac('0x3a')])){_0x26683b[_0x8bac('0x4d')]=utils['CAMPAIGN_STATUS']['INACTIVE'];}else if(!this[_0x8bac('0x6f')](_0x26683b[_0x8bac('0x70')])){if(!this[_0x8bac('0x6f')](_0x26683b[_0x8bac('0x71')])){_0x26683b[_0x8bac('0x4d')]=utils[_0x8bac('0x2e')][_0x8bac('0x72')];}else{_0x26683b[_0x8bac('0x4d')]=utils[_0x8bac('0x2e')]['ACTIVE'];}}else{_0x26683b[_0x8bac('0x4d')]=utils[_0x8bac('0x2e')][_0x8bac('0x73')];}};Preview[_0x8bac('0xe')][_0x8bac('0x74')]=function(_0xf6c4e0,_0x13e846,_0x35380d){var _0x31e457=this;var _0x15d8b6=this[_0x8bac('0x15')][_0x13e846];var _0x22a814=this[_0x8bac('0x12')][_0x15d8b6['queue']];var _0x23df7f;var _0x222729=![];var _0x627f9e=0x2;var _0x24e08b=0x3;if(_0x22a814){switch(_0x35380d){case'1':_0x22a814[_0x8bac('0x75')]+=0x1;_0x15d8b6[_0x8bac('0x76')]+=0x1;_0x15d8b6[_0x8bac('0x77')]=ut[_0x8bac('0x78')](_0x15d8b6);ut[_0x8bac('0x63')](_0x15d8b6,0x0,_0x8bac('0x79'));ami['emit']('custom:agentnosuchnumber',ut['buildObj'](_0x15d8b6,_0x8bac('0x7a')));rpcDb[_0x8bac('0x68')](_0x15d8b6,'[callProgressDetectingCustomer][logNoSuch]');_0x31e457['verifyAdditionalPhones'](_0x15d8b6,'0',_0x22a814)[_0x8bac('0x57')](function(_0x1ecad4){_0x222729=_0x1ecad4[_0x8bac('0x7b')]==0x1;_0x627f9e=_0x22a814['dialNoSuchNumberRetryFrequency'];_0x24e08b=_0x22a814[_0x8bac('0x7c')];if(!_0x222729){if(ut[_0x8bac('0x78')](_0x15d8b6)>=_0x22a814['dialGlobalMaxRetry']){_0x23df7f=ut[_0x8bac('0x7d')](_0x15d8b6,0xf,'Global');rpcDb['createCustomerFinal'](_0x23df7f,'[callProgressDetectingCustomer][logNoSuchGlobal]');}else{if(_0x15d8b6[_0x8bac('0x76')]>=_0x22a814[_0x8bac('0x7e')]){rpcDb[_0x8bac('0x7f')](_0x15d8b6,_0x8bac('0x80'));}else{rpcDb[_0x8bac('0x81')](ut[_0x8bac('0x82')](_0x15d8b6,'countnosuchnumberretry',_0x22a814['dialNoSuchNumberRetryFrequency']),_0x15d8b6[_0x8bac('0x83')],_0x15d8b6[_0x8bac('0x84')]);}}delete this['actions'][_0xf6c4e0[_0x8bac('0x85')]];}else{_0x15d8b6[_0x8bac('0x76')]++;logger['info'](_0x8bac('0x86'),_0x15d8b6['countnosuchnumberretry']);logger[_0x8bac('0x25')]('id',_0x15d8b6[_0x8bac('0x87')]);_0x31e457['incrementPreviewCounters']({'id':_0x15d8b6[_0x8bac('0x87')],'field':{'countnosuchnumberretry':_0x15d8b6[_0x8bac('0x76')]}})[_0x8bac('0x57')](function(){_0x31e457[_0x8bac('0x88')](_0x15d8b6,_0x627f9e,_0x24e08b)[_0x8bac('0x57')](function(){});});}});break;case _0x8bac('0x89'):var _0x2020ad=moment()[_0x8bac('0x28')](_0x8bac('0x61'));_0x15d8b6[_0x8bac('0x8a')]=_0x2020ad;_0x15d8b6[_0x8bac('0x8b')]=_0x2020ad;_0x15d8b6[_0x8bac('0x46')]=!![];_0x22a814[_0x8bac('0x45')]+=0x1;logger[_0x8bac('0x25')](_0x8bac('0x8c'),_0x15d8b6[_0x8bac('0x8d')],_0x8bac('0x8e'),_0x22a814[_0x8bac('0x29')],_0x8bac('0x44'),_0x22a814[_0x8bac('0x45')]);ami['emit']('custom:agentconnect',ut[_0x8bac('0x8f')](_0x15d8b6,_0x8bac('0x90'),this['campaignsPreview'][_0x15d8b6[_0x8bac('0x42')]]));if(_0x22a814[_0x8bac('0x91')]){ami[_0x8bac('0x24')](_0x8bac('0x92'),ut[_0x8bac('0x93')](_0x15d8b6));}break;case'16':ami[_0x8bac('0x24')](_0x8bac('0x94'),ut[_0x8bac('0x8f')](_0x15d8b6,_0x8bac('0x95'),this[_0x8bac('0x12')][_0x15d8b6[_0x8bac('0x42')]]));emitVoiceQueueChannelRemove(ut[_0x8bac('0x8f')](_0x15d8b6,'complete'));_0x22a814[_0x8bac('0x96')]+=0x1;_0x22a814[_0x8bac('0x97')]+=0x1;_0x22a814[_0x8bac('0x98')]+=0x1;ut[_0x8bac('0x99')](_0x22a814,_0x8bac('0x9a'));_0x15d8b6[_0x8bac('0x77')]=ut[_0x8bac('0x78')](_0x15d8b6);ut[_0x8bac('0x63')](_0x15d8b6,0x4,'Answer');rpcDb[_0x8bac('0x68')](_0x15d8b6,'[callProgressDetectingCustomer][logAnswer]');rpcDb[_0x8bac('0x7f')](_0x15d8b6,_0x8bac('0x9b'));rpcDb['crateCustomerReportQueue'](_0x15d8b6);_0x22a814['sumDuration']+=_0x15d8b6[_0x8bac('0x9c')];_0x22a814[_0x8bac('0x9d')]+=_0x15d8b6['talktime'];logger['info'](_0x8bac('0x9e'),_0x15d8b6[_0x8bac('0x8d')],_0x8bac('0x8e'),_0x22a814[_0x8bac('0x29')],_0x8bac('0x44'),_0x22a814[_0x8bac('0x45')]);delete this['actions'][_0xf6c4e0[_0x8bac('0x85')]];break;case _0x8bac('0x9f'):_0x22a814[_0x8bac('0xa0')]+=0x1;_0x15d8b6[_0x8bac('0xa1')]+=0x1;_0x15d8b6['countglobal']=ut[_0x8bac('0x78')](_0x15d8b6);ut[_0x8bac('0x63')](_0x15d8b6,0x5,_0x8bac('0xa2'));_0x627f9e=_0x22a814[_0x8bac('0xa3')];_0x24e08b=_0x22a814[_0x8bac('0x7c')];ami[_0x8bac('0x24')](_0x8bac('0xa4'),ut[_0x8bac('0x8f')](_0x15d8b6,_0x8bac('0xa5')));rpcDb[_0x8bac('0x68')](_0x15d8b6,_0x8bac('0xa6'));_0x31e457[_0x8bac('0xa7')](_0x15d8b6,'5',_0x22a814)[_0x8bac('0x57')](function(_0x23b3ab){_0x222729=_0x23b3ab[_0x8bac('0x7b')]==0x1;if(!_0x222729){if(ut[_0x8bac('0x78')](_0x15d8b6)>=_0x22a814[_0x8bac('0xa8')]){_0x23df7f=ut['cloneAction'](_0x15d8b6,0xf,_0x8bac('0xa9'));rpcDb[_0x8bac('0x7f')](_0x23df7f,'[callProgressDetectingCustomer][logBusyGlobal]');}else{if(_0x15d8b6[_0x8bac('0xa1')]>=_0x22a814[_0x8bac('0xaa')]){rpcDb[_0x8bac('0x7f')](_0x15d8b6,_0x8bac('0xa6'));}else{rpcDb[_0x8bac('0x81')](ut[_0x8bac('0x82')](_0x15d8b6,_0x8bac('0xa1'),_0x22a814['dialBusyRetryFrequency']),_0x15d8b6[_0x8bac('0x83')],_0x15d8b6['activeContact']);}}}else{_0x15d8b6[_0x8bac('0xa1')]++;_0x31e457['incrementPreviewCounters']({'id':_0x15d8b6[_0x8bac('0x87')],'field':{'countbusyretry':_0x15d8b6['countbusyretry']}})[_0x8bac('0x57')](function(){_0x31e457['swapAdditionalPhones'](_0x15d8b6,_0x627f9e,_0x24e08b)[_0x8bac('0x57')](function(){});});}});break;case _0x8bac('0xab'):_0x22a814[_0x8bac('0xac')]+=0x1;_0x15d8b6[_0x8bac('0xad')]+=0x1;_0x15d8b6[_0x8bac('0x77')]=ut['totalGlobal'](_0x15d8b6);ut['logCustomer'](_0x15d8b6,0x3,_0x8bac('0xae'));_0x627f9e=_0x22a814[_0x8bac('0xaf')];_0x24e08b=_0x22a814[_0x8bac('0x7c')];var _0x3ba69c=ut[_0x8bac('0xb0')](_0x15d8b6,_0x22a814);ami[_0x8bac('0x24')]('custom:agentnoanswer',_0x3ba69c);rpcDb[_0x8bac('0x68')](_0x15d8b6,_0x8bac('0xb1'));_0x31e457[_0x8bac('0xa7')](_0x15d8b6,'3',_0x22a814)[_0x8bac('0x57')](function(_0x4d2e14){_0x222729=_0x4d2e14[_0x8bac('0x7b')]==0x1;if(!_0x222729){if(ut[_0x8bac('0x78')](_0x15d8b6)>=_0x22a814[_0x8bac('0xa8')]){_0x23df7f=ut[_0x8bac('0x7d')](_0x15d8b6,0xf,'Global');rpcDb[_0x8bac('0x7f')](_0x23df7f,'[callProgressDetectingCustomer][logNoAnswerGlobal]');}else{if(_0x15d8b6[_0x8bac('0xad')]>=_0x22a814[_0x8bac('0xb2')]){rpcDb[_0x8bac('0x7f')](_0x15d8b6,_0x8bac('0xb1'));}else{rpcDb[_0x8bac('0x81')](ut[_0x8bac('0x82')](_0x15d8b6,_0x8bac('0xad'),_0x22a814[_0x8bac('0xaf')]),_0x15d8b6[_0x8bac('0x83')],_0x15d8b6[_0x8bac('0x84')]);}}}else{_0x15d8b6[_0x8bac('0xad')]++;_0x31e457[_0x8bac('0xb3')]({'id':_0x15d8b6[_0x8bac('0x87')],'field':{'countnoanswerretry':_0x15d8b6['countnoanswerretry']}})[_0x8bac('0x57')](function(){_0x31e457[_0x8bac('0x88')](_0x15d8b6,_0x627f9e,_0x24e08b)['then'](function(){});});}});break;case _0x8bac('0xb4'):_0x22a814[_0x8bac('0xb5')]+=0x1;_0x15d8b6[_0x8bac('0xb6')]+=0x1;_0x15d8b6[_0x8bac('0x77')]=ut[_0x8bac('0x78')](_0x15d8b6);ut[_0x8bac('0x63')](_0x15d8b6,0x8,_0x8bac('0xb7'));_0x627f9e=_0x22a814['dialCongestionRetryFrequency'];_0x24e08b=_0x22a814[_0x8bac('0x7c')];ami[_0x8bac('0x24')]('custom:agentcongestion',ut[_0x8bac('0x8f')](_0x15d8b6,_0x8bac('0xb8')));rpcDb[_0x8bac('0x68')](_0x15d8b6,'[callProgressDetectingCustomer][logCongestion]');_0x31e457[_0x8bac('0xa7')](_0x15d8b6,'8',_0x22a814)[_0x8bac('0x57')](function(_0x5ec602){_0x222729=_0x5ec602[_0x8bac('0x7b')]==0x1;if(!_0x222729){if(ut[_0x8bac('0x78')](_0x15d8b6)>=_0x22a814[_0x8bac('0xa8')]){_0x23df7f=ut['cloneAction'](_0x15d8b6,0xf,_0x8bac('0xa9'));rpcDb['createCustomerFinal'](_0x23df7f,'[callProgressDetectingCustomer][logCongestionGlobal]');}else{if(_0x15d8b6[_0x8bac('0xb6')]>=_0x22a814[_0x8bac('0xb9')]){rpcDb['createCustomerFinal'](_0x15d8b6,_0x8bac('0xba'));}else{rpcDb[_0x8bac('0x81')](ut[_0x8bac('0x82')](_0x15d8b6,_0x8bac('0xb6'),_0x22a814['dialBusyRetryFrequency']),_0x15d8b6[_0x8bac('0x83')],_0x15d8b6[_0x8bac('0x84')]);}}}else{_0x15d8b6[_0x8bac('0xb6')]++;_0x31e457[_0x8bac('0xb3')]({'id':_0x15d8b6['idContact'],'field':{'countcongestionretry':_0x15d8b6[_0x8bac('0xb6')]}})[_0x8bac('0x57')](function(){_0x31e457[_0x8bac('0x88')](_0x15d8b6,_0x627f9e,_0x24e08b)[_0x8bac('0x57')](function(){});});}});break;case _0x8bac('0xbb'):_0x22a814[_0x8bac('0xbc')]+=0x1;_0x15d8b6[_0x8bac('0xbd')]+=0x1;_0x15d8b6[_0x8bac('0x77')]=ut['totalGlobal'](_0x15d8b6);ut[_0x8bac('0x63')](_0x15d8b6,0x14,'AgentReject');_0x627f9e=_0x22a814[_0x8bac('0xbe')];_0x24e08b=_0x22a814[_0x8bac('0x7c')];ami[_0x8bac('0x24')](_0x8bac('0xbf'),ut[_0x8bac('0x8f')](_0x15d8b6,_0x8bac('0xc0')));rpcDb[_0x8bac('0x68')](_0x15d8b6,_0x8bac('0xc1'));_0x31e457['verifyAdditionalPhones'](_0x15d8b6,'20',_0x22a814)[_0x8bac('0x57')](function(_0x2ecae1){_0x222729=_0x2ecae1['additional']==0x1;if(!_0x222729){if(ut[_0x8bac('0x78')](_0x15d8b6)>=_0x22a814[_0x8bac('0xa8')]){_0x23df7f=ut[_0x8bac('0x7d')](_0x15d8b6,0x14,_0x8bac('0xc2'));rpcDb['createCustomerFinal'](_0x23df7f,_0x8bac('0xc3'));}else{if(_0x15d8b6[_0x8bac('0xbd')]>=_0x22a814[_0x8bac('0xc4')]){rpcDb[_0x8bac('0x7f')](_0x15d8b6,_0x8bac('0xc3'));}else{rpcDb[_0x8bac('0x81')](ut[_0x8bac('0x82')](_0x15d8b6,'countagentrejectretry',_0x22a814[_0x8bac('0xbe')]),_0x15d8b6[_0x8bac('0x83')],_0x15d8b6['activeContact']);}}}else{_0x15d8b6[_0x8bac('0xad')]++;_0x31e457[_0x8bac('0xb3')]({'id':_0x15d8b6[_0x8bac('0x87')],'field':{'countnoanswerretry':_0x15d8b6['countnoanswerretry']}})[_0x8bac('0x57')](function(){_0x31e457[_0x8bac('0x88')](_0x15d8b6,_0x627f9e,_0x24e08b)['then'](function(){});});}});break;case _0x8bac('0xc5'):_0x22a814[_0x8bac('0xc6')]+=0x1;_0x15d8b6[_0x8bac('0xc7')]+=0x1;_0x15d8b6[_0x8bac('0x77')]=ut[_0x8bac('0x78')](_0x15d8b6);ut[_0x8bac('0x63')](_0x15d8b6,0xb,_0x8bac('0xc8'));rpcDb[_0x8bac('0x68')](_0x15d8b6,_0x8bac('0xc9'));_0x31e457[_0x8bac('0xa7')](_0x15d8b6,'11',_0x22a814)[_0x8bac('0x57')](function(_0xe59d53){_0x222729=_0xe59d53[_0x8bac('0x7b')]==0x1;if(!_0x222729){if(ut[_0x8bac('0x78')](_0x15d8b6)>=_0x22a814[_0x8bac('0xa8')]){_0x23df7f=ut[_0x8bac('0x7d')](_0x15d8b6,0xf,_0x8bac('0xa9'));rpcDb[_0x8bac('0x7f')](_0x23df7f,'[callProgressDetectingCustomer][logAbandoned]');}else{if(_0x15d8b6[_0x8bac('0xca')]>=_0x22a814[_0x8bac('0xcb')]){rpcDb[_0x8bac('0x7f')](_0x15d8b6,_0x8bac('0xc9'));}else{rpcDb['rescheduleContact'](ut[_0x8bac('0x82')](_0x15d8b6,_0x8bac('0xc7'),_0x22a814[_0x8bac('0xcc')]),_0x15d8b6[_0x8bac('0x83')],_0x15d8b6['activeContact']);}}}else{_0x15d8b6['countnoanswerretry']++;_0x31e457[_0x8bac('0xb3')]({'id':_0x15d8b6[_0x8bac('0x87')],'field':{'countnoanswerretry':_0x15d8b6[_0x8bac('0xad')]}})['then'](function(){_0x31e457[_0x8bac('0x88')](_0x15d8b6,_0x627f9e,_0x24e08b)[_0x8bac('0x57')](function(){});});}});break;case'18':_0x22a814['outboundUnknownCallsDay']+=0x1;_0x15d8b6[_0x8bac('0xcd')]+=0x1;_0x15d8b6[_0x8bac('0x77')]=ut[_0x8bac('0x78')](_0x15d8b6);ut[_0x8bac('0x63')](_0x15d8b6,0x12,_0xf6c4e0['cause-txt']||_0xf6c4e0[_0x8bac('0xce')]);ami[_0x8bac('0x24')](_0x8bac('0xcf'),ut[_0x8bac('0x8f')](_0x15d8b6,_0x8bac('0xd0')));rpcDb[_0x8bac('0x68')](_0x15d8b6,_0x8bac('0xd1'));_0x31e457[_0x8bac('0xa7')](_0x15d8b6,'18',_0x22a814)[_0x8bac('0x57')](function(_0x44c55f){_0x222729=_0x44c55f[_0x8bac('0x7b')]==0x1;if(!_0x222729){if(ut['totalGlobal'](_0x15d8b6)>=_0x22a814[_0x8bac('0xa8')]){_0x23df7f=ut[_0x8bac('0x7d')](_0x15d8b6,0x12,_0x8bac('0xa9'));rpcDb[_0x8bac('0x7f')](_0x23df7f,'[callProgressDetectingCustomer][hangupInAMD]');}else{rpcDb[_0x8bac('0x7f')](_0x15d8b6,_0x8bac('0xd1'));}}else{_0x15d8b6['countnoanswerretry']++;_0x31e457[_0x8bac('0xb3')]({'id':_0x15d8b6['idContact'],'field':{'countnoanswerretry':_0x15d8b6[_0x8bac('0xad')]}})[_0x8bac('0x57')](function(){_0x31e457[_0x8bac('0x88')](_0x15d8b6,_0x627f9e,_0x24e08b)['then'](function(){});});}});delete this[_0x8bac('0x15')][_0xf6c4e0[_0x8bac('0x85')]];break;case'19':_0x22a814['outboundUnknownCallsDay']+=0x1;_0x15d8b6[_0x8bac('0x77')]=ut[_0x8bac('0x78')](_0x15d8b6);ut[_0x8bac('0x63')](_0x15d8b6,0x13,_0xf6c4e0[_0x8bac('0xd2')]||_0xf6c4e0[_0x8bac('0xce')]);ami[_0x8bac('0x24')]('custom:amd',ut['buildObj'](_0x15d8b6,_0x8bac('0xd0')));rpcDb[_0x8bac('0x68')](_0x15d8b6,'[callProgressDetectingCustomer][machine]');_0x31e457[_0x8bac('0xa7')](_0x15d8b6,'18',_0x22a814)['then'](function(_0x2746f9){_0x222729=_0x2746f9[_0x8bac('0x7b')]==0x1;if(!_0x222729){if(ut[_0x8bac('0x78')](_0x15d8b6)>=_0x22a814[_0x8bac('0xa8')]){_0x23df7f=ut['cloneAction'](_0x15d8b6,0xf,_0x8bac('0xa9'));rpcDb[_0x8bac('0x7f')](_0x23df7f,'[callProgressDetectingCustomer][machine]');}else{rpcDb[_0x8bac('0x7f')](_0x15d8b6,_0x8bac('0xd3'));}}else{_0x15d8b6[_0x8bac('0xad')]++;_0x31e457[_0x8bac('0xb3')]({'id':_0x15d8b6[_0x8bac('0x87')],'field':{'countnoanswerretry':_0x15d8b6['countnoanswerretry']}})[_0x8bac('0x57')](function(){_0x31e457[_0x8bac('0x88')](_0x15d8b6,_0x627f9e,_0x24e08b)[_0x8bac('0x57')](function(){});});}});delete this[_0x8bac('0x15')][_0xf6c4e0['linkedid']];break;default:if(_0x15d8b6[_0x8bac('0x46')]){ut[_0x8bac('0x99')](_0x22a814,_0x8bac('0xd4'));ut[_0x8bac('0x51')]('[Dialer][decrementTalkink][no\x20Hangup][Preview]'+_0x22a814[_0x8bac('0x29')],_0xf6c4e0);}_0x22a814[_0x8bac('0xd5')]+=0x1;_0x15d8b6[_0x8bac('0x77')]=ut['totalGlobal'](_0x15d8b6);ut[_0x8bac('0x63')](_0x15d8b6,0xc,_0xf6c4e0[_0x8bac('0xd2')]||_0xf6c4e0['dialstatus']);_0x627f9e=_0x22a814[_0x8bac('0xbe')];_0x24e08b=_0x22a814[_0x8bac('0x7c')];rpcDb[_0x8bac('0x68')](_0x15d8b6,_0x8bac('0xd6'));_0x31e457[_0x8bac('0xa7')](_0x15d8b6,'20',_0x22a814)['then'](function(_0x43b682){_0x222729=_0x43b682['additional']==0x1;if(!_0x222729){if(ut[_0x8bac('0x78')](_0x15d8b6)>=_0x22a814[_0x8bac('0xa8')]){_0x23df7f=ut[_0x8bac('0x7d')](_0x15d8b6,0xf,'Global');rpcDb[_0x8bac('0x7f')](_0x23df7f,_0x8bac('0xd7'));}else{rpcDb[_0x8bac('0x7f')](_0x15d8b6,_0x8bac('0xd7'));}delete this['actions'][_0xf6c4e0['linkedid']];}else{_0x31e457[_0x8bac('0x88')](_0x15d8b6,_0x627f9e,_0x24e08b)[_0x8bac('0x57')](function(){});}});}if(!(_0x15d8b6[_0x8bac('0x46')]&&_0x35380d==='16')){ut[_0x8bac('0x4f')](_0x22a814,'[callProgressDetectingCustomer]');logger[_0x8bac('0x25')](_0x8bac('0xd8'),_0x15d8b6['uniqueid'],_0x8bac('0x8e'),_0x22a814[_0x8bac('0x29')],_0x8bac('0x43'),_0x22a814[_0x8bac('0x2d')]);}if(_0x35380d!==_0x8bac('0x89')){delete this[_0x8bac('0x15')][_0xf6c4e0[_0x8bac('0x85')]];delete this['actions'][_0xf6c4e0[_0x8bac('0xd9')]];}_0x22a814[_0x8bac('0xda')]=!![];}};Preview[_0x8bac('0xe')][_0x8bac('0xdb')]=function(_0x1f5bca,_0x149546,_0x5230cf){if(_['isUndefined'](_0x149546)&&_0x8bac('0xdc')!==typeof _0x149546){return;}if(_[_0x8bac('0xdd')](_0x5230cf)&&_0x8bac('0xdc')!==typeof _0x5230cf){return;}switch(_0x5230cf['reason']){case'0':ut[_0x8bac('0xde')](_0x1f5bca,0x0,'NoSuchNumber');rpcDb[_0x8bac('0xdf')](_0x1f5bca,_0x8bac('0xe0'));break;case'3':ut[_0x8bac('0xde')](_0x1f5bca,0x3,_0x8bac('0xae'));rpcDb[_0x8bac('0xdf')](_0x1f5bca,'[callProgressDetectingAgent][logNoAnswer]');break;case'5':ut[_0x8bac('0xde')](_0x1f5bca,0x5,_0x8bac('0xa2'));rpcDb[_0x8bac('0xdf')](_0x1f5bca,_0x8bac('0xe1'));break;case'8':ut['logAgent'](_0x1f5bca,0x8,_0x8bac('0xb7'));rpcDb[_0x8bac('0xdf')](_0x1f5bca,'[callProgressDetectingAgent][logCongestion]');break;case'22':ut[_0x8bac('0xde')](_0x1f5bca,0x16,_0x8bac('0xe2'));rpcDb[_0x8bac('0xdf')](_0x1f5bca,'[callProgressDetectingAgent][logAnswerAGI]');break;default:ut[_0x8bac('0xde')](_0x1f5bca,0xc,_0x5230cf['reason']);rpcDb[_0x8bac('0xdf')](_0x1f5bca,_0x8bac('0xe3'));}ut[_0x8bac('0x4f')](_0x149546,_0x8bac('0xe4'));logger[_0x8bac('0x25')](_0x8bac('0xe5'),_0x1f5bca['uniqueid'],_0x8bac('0x8e'),_0x149546[_0x8bac('0x29')],_0x8bac('0x43'),_0x149546[_0x8bac('0x2d')]);delete this['actions'][_0x1f5bca[_0x8bac('0x8d')]];};Preview[_0x8bac('0xe')]['verifyAdditionalPhones']=function(_0x2d067e,_0x21fe97,_0x3aabed){return cmHopperAdditionalPhone[_0x8bac('0xa7')](_0x2d067e,_0x21fe97,_0x3aabed)[_0x8bac('0x4c')](logger['info'](_0x8bac('0xe6')));};Preview[_0x8bac('0xe')][_0x8bac('0x88')]=function(_0x2b9449,_0x435b1c,_0x48b727){return cmHopperAdditionalPhone[_0x8bac('0x88')](_0x2b9449,_0x435b1c,_0x48b727)[_0x8bac('0x4c')](logger[_0x8bac('0x25')](_0x8bac('0xe7')));};Preview[_0x8bac('0xe')]['incrementPreviewCounters']=function(_0xa0d3e7){return Promise['resolve']()[_0x8bac('0x57')](cmHopperAdditionalPhone[_0x8bac('0xb3')](_0xa0d3e7))[_0x8bac('0x4c')](logger[_0x8bac('0x25')](_0x8bac('0xe8')));};Preview[_0x8bac('0xe')][_0x8bac('0xe9')]=function(_0x277d46,_0x465d3b,_0x5bdfbe,_0x171c5e,_0x497d7a){var _0x565ea8=this;return new Promise(function(_0x49e8a5,_0x5d7e7b){if(_[_0x8bac('0x3f')](_0x465d3b)||_[_0x8bac('0x3f')](_0x465d3b[_0x8bac('0xea')])||_[_0x8bac('0x3f')](_0x465d3b['phone'])||_[_0x8bac('0x3f')](_0x465d3b[_0x8bac('0x48')])){_0x5d7e7b(ut[_0x8bac('0x4d')](_0x8bac('0xeb'),_0x171c5e,_0x497d7a));return;}var _0x572ec6=uuid['v4']();var _0x5eb725=_0x565ea8['campaignsPreview'][_0x465d3b['Queue']['name']];var _0x453361=_0x5bdfbe?_0x565ea8[_0x8bac('0x16')][_0x5bdfbe]['id']:undefined;_0x565ea8[_0x8bac('0x15')][_0x572ec6]=new Action(_0x465d3b,_0x5eb725,_0x572ec6,_0x5bdfbe,_0x453361);var _0x515175=_0x565ea8['actions'][_0x572ec6];_0x515175['unlockAgent']=_0x171c5e;_0x515175[_0x8bac('0x84')]=_0x497d7a;_0x515175['lookAgent']=_0x5bdfbe;if(_[_0x8bac('0xec')](_0x277d46)){_0x565ea8[_0x8bac('0xed')](_0x515175,_0x5eb725,_0x465d3b,_0x5bdfbe)[_0x8bac('0x57')](function(_0x7e3421){logger[_0x8bac('0x25')](_0x8bac('0xee'),_0x8bac('0xef')+_0x515175[_0x8bac('0x42')]+_0x8bac('0xf0')+_0x515175[_0x8bac('0x87')],JSON[_0x8bac('0x27')](_0x7e3421));ami[_0x8bac('0x24')]('custom:agentcalled',ut[_0x8bac('0x8f')](_0x515175,_0x8bac('0xf1'),_0x565ea8[_0x8bac('0x12')][_0x515175['queue']]));_0x49e8a5(ut['message'](_0x8bac('0xf2')));})[_0x8bac('0x4c')](function(_0x2be671){ut[_0x8bac('0x32')](_0x8bac('0xf3'),_0x2be671);_0x5d7e7b(ut[_0x8bac('0x4d')](_0x8bac('0xf4'),_0x171c5e,_0x497d7a));});}else{_0x5eb725[_0x8bac('0xf5')]+=0x1;ut[_0x8bac('0xf6')](_0x515175);rpcDb[_0x8bac('0xf7')](_0x515175,_0x8bac('0xf8'));delete _0x565ea8[_0x8bac('0x15')][_0x572ec6];_0x5d7e7b(ut[_0x8bac('0x4d')]('Contact\x20in\x20black\x20List',_0x171c5e,_0x497d7a));}});};Preview[_0x8bac('0xe')][_0x8bac('0x6f')]=function(_0x2d4642){return!_[_0x8bac('0x3f')](_0x2d4642)&&!_[_0x8bac('0x3f')](_0x2d4642['name'])&&!_[_0x8bac('0x3f')](_0x2d4642[_0x8bac('0xf9')])&&_0x2d4642[_0x8bac('0xf9')]&&!_[_0x8bac('0x3f')](this[_0x8bac('0x14')][util['format'](_0x8bac('0xfa'),_0x2d4642[_0x8bac('0x29')])])&&!_[_0x8bac('0x3f')](this[_0x8bac('0x14')][util[_0x8bac('0x28')]('SIP/%s',_0x2d4642[_0x8bac('0x29')])][_0x8bac('0x4a')])&&(this['trunks'][util[_0x8bac('0x28')](_0x8bac('0xfa'),_0x2d4642[_0x8bac('0x29')])][_0x8bac('0x4a')]===_0x8bac('0xfb')||this[_0x8bac('0x14')][util[_0x8bac('0x28')]('SIP/%s',_0x2d4642[_0x8bac('0x29')])][_0x8bac('0x4a')]===_0x8bac('0xfc'));};Preview[_0x8bac('0xe')][_0x8bac('0xfd')]=function(_0x517a11,_0x15f15e){return this[_0x8bac('0xfe')](_0x517a11,_0x15f15e)[_0x8bac('0x57')](function(_0x3d4ea8){return _[_0x8bac('0xff')](_0x3d4ea8,[_0x8bac('0x4d')]);})[_0x8bac('0x4c')](function(_0x46c3dd){if(_0x46c3dd[_0x8bac('0x100')]){rpcDb[_0x8bac('0x101')](_0x517a11);}if(_0x46c3dd[_0x8bac('0xf9')]){rpcDb[_0x8bac('0x5f')](_0x517a11);}throw _[_0x8bac('0xff')](_0x46c3dd,[_0x8bac('0x4d')]);});};Preview['prototype'][_0x8bac('0xfe')]=function(_0x4fe6df,_0x534e86){var _0x2fe20b=this;var _0x20d043,_0x137e9b;return rpcDb[_0x8bac('0x102')](_0x4fe6df)[_0x8bac('0x57')](function(_0x5555f0){if(!_[_0x8bac('0x3f')](_0x5555f0[0x0])){_0x137e9b=_0x5555f0[0x0][_0x8bac('0x103')]?![]:!![];_0x20d043=_0x5555f0[0x0][_0x8bac('0x103')]?!![]:![];_0x20d043=_0x534e86?!![]:_0x20d043;}var _0x59377b=_0x2fe20b[_0x8bac('0x104')](_0x5555f0);if(_0x59377b[_0x8bac('0x105')]){rpcDb[_0x8bac('0x106')](_['pick'](_0x5555f0[0x0],[_0x8bac('0x48'),_0x8bac('0x107')]))[_0x8bac('0x57')](function(_0x15d3b6){_0x2fe20b[_0x8bac('0xe9')](_0x15d3b6,_0x5555f0[0x0],_0x534e86,_0x137e9b,_0x20d043)[_0x8bac('0x57')](function(_0x479795){return _0x479795;})['catch'](function(_0x400b09){throw _0x400b09;});})[_0x8bac('0x4c')](function(_0xb0f3e5){ut[_0x8bac('0x32')](_0x8bac('0x108'),_0xb0f3e5);throw ut[_0x8bac('0x4d')]('Call\x20unsuccessful',_0x137e9b,_0x20d043);});}else{throw ut[_0x8bac('0x4d')](_0x59377b[_0x8bac('0x4d')],_0x137e9b,_0x20d043);}})[_0x8bac('0x4c')](function(_0x35842b){ut[_0x8bac('0x32')](_0x8bac('0x109'),_0x35842b);throw ut['message'](_0x8bac('0x10a'),![],!![]);});};Preview[_0x8bac('0xe')][_0x8bac('0x104')]=function(_0x1e7f37){if(_['isNil'](_0x1e7f37)||_[_0x8bac('0xec')](_0x1e7f37)||!_[_0x8bac('0x3f')](_0x1e7f37[0x0][_0x8bac('0x5c')])&&_[_0x8bac('0x3f')](_0x1e7f37[0x0][_0x8bac('0x5c')]['name'])){ut[_0x8bac('0x32')](_0x8bac('0x10b'),_0x1e7f37);return{'isValid':![],'message':_0x8bac('0x10c')};}var _0x489695=this[_0x8bac('0x12')][_0x1e7f37[0x0]['Queue'][_0x8bac('0x29')]];_0x489695['message']=utils[_0x8bac('0x2e')][_0x8bac('0x73')];if(_[_0x8bac('0x3f')](_0x489695)){ut[_0x8bac('0x32')]('[Preview][validateContact][Empty\x20Campaign]',_0x489695);return{'isValid':![],'message':_0x8bac('0x10d')};}if(!this[_0x8bac('0x6f')](_0x489695['Trunk'])){ut[_0x8bac('0x32')](_0x8bac('0x10e'),'campaign\x20Name:\x20'+_0x489695['name']+'\x20Trunk\x20is\x20not\x20active');if(!this[_0x8bac('0x6f')](_0x489695[_0x8bac('0x71')])){ut[_0x8bac('0x32')](_0x8bac('0x10e'),_0x489695['name']+_0x8bac('0x10f'));return{'isValid':![],'message':_0x8bac('0x110')};}}if(!ut[_0x8bac('0x111')](_0x489695[_0x8bac('0x3a')])){ut[_0x8bac('0x32')](_0x8bac('0x112'),_0x489695[_0x8bac('0x29')]+_0x8bac('0x113'));return{'isValid':![],'message':'campaign\x20Name:\x20'+_0x489695[_0x8bac('0x29')]+_0x8bac('0x113')};}return{'isValid':!![],'message':_0x8bac('0x114')};};Preview[_0x8bac('0xe')]['execCall']=function(_0x4ab612,_0xe95cf0,_0xf9954c,_0x2a5e7d){var _0x29d111=this;return new Promise(function(_0x288b76,_0x4ed9ca){var _0x305979=_0x4ab612[_0x8bac('0x8d')];var _0x12111a=_0x29d111['isTrunkReachable'](_0xe95cf0[_0x8bac('0x70')])?util[_0x8bac('0x28')](_0x8bac('0x115'),_0xe95cf0[_0x8bac('0x70')][_0x8bac('0x29')],_[_0x8bac('0x3f')](_0xe95cf0['dialPrefix'])?'':_0xe95cf0[_0x8bac('0x116')]['trim']()||'',_0xe95cf0[_0x8bac('0x117')]>0x0?_0xf9954c[_0x8bac('0x107')][_0x8bac('0x118')](_0xe95cf0['dialCutDigit']):_0xf9954c['phone']):util[_0x8bac('0x28')](_0x8bac('0x115'),_[_0x8bac('0x3f')](_0xe95cf0['TrunkBackup'])?_0xe95cf0[_0x8bac('0x70')][_0x8bac('0x29')]:_0xe95cf0[_0x8bac('0x71')][_0x8bac('0x29')],_[_0x8bac('0x3f')](_0xe95cf0[_0x8bac('0x116')])?'':_0xe95cf0[_0x8bac('0x116')]['trim']()||'',_0xe95cf0[_0x8bac('0x117')]>0x0?_0xf9954c[_0x8bac('0x107')]['substring'](_0xe95cf0['dialCutDigit']):_0xf9954c[_0x8bac('0x107')]);var _0x2c49ef=_0x29d111[_0x8bac('0x6f')](_0xe95cf0[_0x8bac('0x70')])?ut[_0x8bac('0x119')](_0xe95cf0['Trunk'][_0x8bac('0x11a')],_0xe95cf0['dialOriginateCallerIdName'],_0xe95cf0[_0x8bac('0x11b')]>0x0?ut[_0x8bac('0x11c')](_0xe95cf0[_0x8bac('0x11d')],_0xe95cf0['dialRandomLastDigitCallerIdNumber']):_0xe95cf0['dialOriginateCallerIdNumber']):ut[_0x8bac('0x119')](_[_0x8bac('0x3f')](_0xe95cf0[_0x8bac('0x71')])?_0xe95cf0[_0x8bac('0x70')][_0x8bac('0x11a')]:_0xe95cf0[_0x8bac('0x71')][_0x8bac('0x11a')],_0xe95cf0[_0x8bac('0x11e')],_0xe95cf0[_0x8bac('0x11b')]>0x0?ut['getCallerIdRandom'](_0xe95cf0['dialOriginateCallerIdNumber'],_0xe95cf0[_0x8bac('0x11b')]):_0xe95cf0[_0x8bac('0x11d')]);if(_0x2c49ef){_0x4ab612[_0x8bac('0x11f')]=ut[_0x8bac('0x120')](_0x2c49ef);_0x4ab612[_0x8bac('0x121')]=ut[_0x8bac('0x122')](_0x2c49ef);}var _0x42f423=ut[_0x8bac('0x123')](_0xe95cf0,_0xf9954c,_0x12111a,_0x2c49ef,_0x305979,_0x4ab612);var _0x2a576b=utils[_0x8bac('0x124')](_0xf9954c[_0x8bac('0xea')]);Object[_0x8bac('0x125')](_0x42f423,_0x2a576b);_[_0x8bac('0x126')](_0x4ab612,ut[_0x8bac('0x127')](_0x42f423));_0x4ab612[_0x8bac('0x60')]=moment()['format'](_0x8bac('0x61'));_0xe95cf0[_0x8bac('0x128')]=_0x42f423;var _0x236e29=ut['variablesAction'](_0x4ab612,_0xe95cf0,_0x42f423,_0x4ab612['activeContact'],_0x2a5e7d);return ami[_0x8bac('0x49')](_0x236e29)[_0x8bac('0x57')](function(_0x32412f){_0xe95cf0[_0x8bac('0x2d')]+=0x1;logger['info']('[originated][increment]',_0x305979,'\x20Queue',_0xe95cf0['name'],_0x8bac('0x43'),_0xe95cf0[_0x8bac('0x2d')]);_0x288b76(_0x32412f);})[_0x8bac('0x4c')](function(_0x1f964e){ut[_0x8bac('0xde')](_0x4ab612,0xe,_0x8bac('0x129'));rpcDb[_0x8bac('0xdf')](_0x4ab612,'[originateFailure][logOriginateFailure]');_0x4ed9ca(_0x1f964e);});});};Preview[_0x8bac('0xe')]['syncNewExten']=function(_0x2d05c3){if(this[_0x8bac('0x15')][_0x2d05c3[_0x8bac('0x85')]]){this[_0x8bac('0x15')][_0x2d05c3['linkedid']][_0x8bac('0x4b')]=_0x2d05c3[_0x8bac('0x4b')];}};Preview[_0x8bac('0xe')][_0x8bac('0x18')]=function(_0x59ba4c){var _0x31ab77=this;var _0x53f960=this[_0x8bac('0x15')][_0x59ba4c[_0x8bac('0x12a')]];if(_0x53f960){if(_0x53f960[_0x8bac('0x12b')]&&this[_0x8bac('0x16')][_0x53f960['lookAgent']]){ut['logLookAgent'](_0x53f960,this[_0x8bac('0x16')][_0x53f960[_0x8bac('0x12b')]]['name'],this[_0x8bac('0x16')][_0x53f960['lookAgent']]['id']);}var _0x54eef0=_['clone'](_0x53f960);_0x54eef0[_0x8bac('0x8a')]=moment()[_0x8bac('0x28')](_0x8bac('0x61'));var _0xcd0364=_0x31ab77[_0x8bac('0x12')][_0x53f960[_0x8bac('0x42')]];if(ut['isFailure'](_0x59ba4c['response'])){if(_0x53f960[_0x8bac('0x83')]){rpcDb['unlockContact'](_0x53f960[_0x8bac('0x87')]);}if(_0x53f960[_0x8bac('0x84')]){rpcDb[_0x8bac('0x5f')](_0x53f960[_0x8bac('0x87')]);}ami[_0x8bac('0x24')](_0x8bac('0x12c'),ut[_0x8bac('0x8f')](_0x53f960,_0x8bac('0x12d'),this[_0x8bac('0x12')][_0x53f960[_0x8bac('0x42')]]));this[_0x8bac('0xdb')](_0x54eef0,_0xcd0364,_0x59ba4c);}else{_0x53f960[_0x8bac('0x60')]=moment()[_0x8bac('0x28')](_0x8bac('0x61'));ut['logAgent'](_0x54eef0,0x4,_0x8bac('0x12e'));rpcDb[_0x8bac('0xdf')](_0x54eef0,_0x8bac('0x12f'));}}};Preview[_0x8bac('0xe')][_0x8bac('0x130')]=function(_0x301695){var _0x553f42=this[_0x8bac('0x15')][_0x301695[_0x8bac('0x85')]];var _0x193a67;if(_0x553f42){_0x193a67=this[_0x8bac('0x12')][_0x553f42['queue']];logger[_0x8bac('0x25')]('[syncHangup][talking]',_0x301695['linkedid'],_0x8bac('0x8e'),_0x193a67[_0x8bac('0x29')],_0x8bac('0x44'),_0x193a67['pTalking']);}if(this[_0x8bac('0x15')][_0x301695[_0x8bac('0x85')]]&&_0x301695[_0x8bac('0x85')]!==_0x301695[_0x8bac('0x8d')]){if(_0x301695[_0x8bac('0x131')]==='16'&&this[_0x8bac('0x15')][_0x301695[_0x8bac('0x85')]][_0x8bac('0x46')]){this[_0x8bac('0x74')](_0x301695,_0x301695['linkedid'],_0x301695[_0x8bac('0x131')]);}else if(this['actions'][_0x301695['linkedid']][_0x8bac('0x46')]){logger[_0x8bac('0x25')]('[syncHangup][talking][cause]',_0x301695[_0x8bac('0x85')],_0x301695[_0x8bac('0x131')],'\x20Queue',_0x193a67[_0x8bac('0x29')],_0x8bac('0x44'),_0x193a67['pTalking']);this['callProgressDetectingCustomer'](_0x301695,_0x301695[_0x8bac('0x85')],_0x301695['cause']);}}else if(_0x553f42&&_[_0x8bac('0x3f')](_0x553f42['statedesc'])&&_0x193a67['dialQueueProject']&&_0x301695[_0x8bac('0x85')]===_0x301695['uniqueid']&&_[_0x8bac('0x3f')](_0x301695['reason'])&&_0x301695[_0x8bac('0x131')]==='16'&&_0x301695[_0x8bac('0x132')]==='6'&&_['isUndefined'](_0x553f42['transfer'])){if(_0x553f42[_0x8bac('0x83')]){rpcDb[_0x8bac('0x101')](_0x553f42[_0x8bac('0x87')]);}if(_0x553f42[_0x8bac('0x84')]){rpcDb[_0x8bac('0x5f')](_0x553f42[_0x8bac('0x87')]);}_0x301695['reason']='22';this[_0x8bac('0xdb')](_0x553f42,_0x193a67,_0x301695);}else if(_0x553f42&&_0x553f42[_0x8bac('0x133')]){if(_0x301695[_0x8bac('0x131')]==='16'&&this[_0x8bac('0x15')][_0x301695[_0x8bac('0x85')]][_0x8bac('0x46')]){logger[_0x8bac('0x25')](_0x8bac('0x134'),_0x301695[_0x8bac('0x85')],_0x301695[_0x8bac('0x131')],_0x8bac('0x8e'),_0x193a67[_0x8bac('0x29')],_0x8bac('0x44'),_0x193a67['pTalking']);this[_0x8bac('0x74')](_0x301695,_0x301695['linkedid'],_0x301695['cause']);}else if(this['actions'][_0x301695[_0x8bac('0x85')]][_0x8bac('0x46')]){logger[_0x8bac('0x25')]('[syncHangup][talking][cause]',_0x301695['linkedid'],_0x301695[_0x8bac('0x131')],'\x20Queue',_0x193a67[_0x8bac('0x29')],_0x8bac('0x44'),_0x193a67[_0x8bac('0x45')]);this[_0x8bac('0x74')](_0x301695,_0x301695[_0x8bac('0x85')],_0x301695['cause']);}}};Preview['prototype'][_0x8bac('0x135')]=function(_0x4f44e8){if(this['actions'][_0x4f44e8[_0x8bac('0xd9')]]&&_0x4f44e8[_0x8bac('0xd9')]!==_0x4f44e8['destuniqueid']){this[_0x8bac('0x74')](_0x4f44e8,_0x4f44e8[_0x8bac('0xd9')],_0x4f44e8[_0x8bac('0xce')]);}};Preview['prototype'][_0x8bac('0x1b')]=function(_0x30f209){if(this[_0x8bac('0x15')][_0x30f209[_0x8bac('0x85')]]&&_0x30f209['linkedid']!==_0x30f209[_0x8bac('0x8d')]&&!this[_0x8bac('0x15')][_0x30f209['linkedid']][_0x8bac('0x46')]){if(_0x30f209['cause']==='1'){this[_0x8bac('0x74')](_0x30f209,_0x30f209[_0x8bac('0x85')],_0x30f209['cause']);}}};Preview[_0x8bac('0xe')][_0x8bac('0x136')]=function(_0x494530,_0x36a217,_0x26b5e9){if(this[_0x8bac('0x15')][_0x494530]){if(_[_0x8bac('0x3f')](this[_0x8bac('0x15')][_0x494530][_0x8bac('0x128')])){this[_0x8bac('0x15')][_0x494530]['variables']={};}this[_0x8bac('0x15')][_0x494530][_0x8bac('0x128')][_0x36a217]=_0x26b5e9;}};Preview[_0x8bac('0xe')][_0x8bac('0x137')]=function(_0x494141){try{if(!_[_0x8bac('0x3f')](_0x494141)){if(ut[_0x8bac('0x138')](_[_0x8bac('0x139')](_0x494141['variable'])[0x0])){this['addVariable'](_0x494141[_0x8bac('0x8d')],_[_0x8bac('0x139')](_0x494141[_0x8bac('0x13a')])[0x0],_0x494141[_0x8bac('0x13b')]);}}}catch(_0xe97389){logger[_0x8bac('0x13c')](_0x8bac('0x13d'),util[_0x8bac('0x13e')](_0xe97389,{'showHidden':![],'depth':null}));}};Preview[_0x8bac('0xe')][_0x8bac('0x20')]=function(_0x3ae3e6){if(_0x3ae3e6){if(this[_0x8bac('0x15')][_0x3ae3e6[_0x8bac('0x13f')]]){this[_0x8bac('0x15')][_0x3ae3e6['transfertargetlinkedid']][_0x8bac('0x133')]=!![];}}};Preview[_0x8bac('0xe')][_0x8bac('0x22')]=function(_0xc9f438){if(_0xc9f438){if(this[_0x8bac('0x15')][_0xc9f438[_0x8bac('0x140')]]){this[_0x8bac('0x15')][_0xc9f438['transfererlinkedid']][_0x8bac('0x133')]=!![];}}};module[_0x8bac('0x141')]=Preview; \ No newline at end of file +var _0xc71b=['originatecalleridnum','extractCalleridNumber','setXMDContactVariables','assign','merge','toLowerVariables','variables','OriginateError','syncNewExten','lookAgent','logLookAgent','clone','isFailure','response','custom:agentringnoanswer','rejected','[callProgressDetectingAgent][logAnswer]','[syncHangup][talking]','cause','[syncHangup][talking][cause]','statedesc','dialQueueProject','channelstate','transfer','disableContact','destuniqueid','keys','variable','value','error','transfertargetlinkedid','transfererlinkedid','exports','util','lodash','uuid','moment','../../../config/environment','preview','../../../config/logger','actionPreview','./action','./util/util','defaults','redis','localhost','prototype','enqueue','tail','finally','sequence','campaignsPreview','voiceQueues','trunks','agents','clockClearZombieChannels','originateresponse','syncOriginateResponse','bind','hangup','syncHangup','hanguprequest','syncHangupRequest','dialend','syncDialEnd','newexten','varset','syncVarSet','attendedtransfer','syncAttendedTransfer','emit','info','[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event','stringify','format','voice:queue:%s','voice_queue_channel:remove','voice_queue_presence:remove','sendMessageOneNotActive','originated','pTalking','available','paused','CAMPAIGN_STATUS','INACTIVE','logger','[CampaignPreview]\x20Campaign\x20Queue:\x20','name','\x20is\x20not\x20active','message','DEACTIVATED','\x20is\x20deactivated','syncCampaigns','hasOwnProperty','dialMethod','booked','type','outbound','clearZombieChannels','dialActive','setMessage','recallMe','isNil','actions','queue','originated:\x20','pTalking:\x20','contactId','UserId','VoiceQueueId','ListId','Action','status','channel','catch','[clearZombieChannel]','dialAnswer','decrementTalkink','[Dialer][checkChannel][pTalking][Preview]','loggerError','[Dialer][checkChannel][Preview]','[action]','size','clearZombieChannel','getContactRecallMe','agentReadyId','length','scheduledat','dialRecallMeTimeout','Agent','voicePause','run','logger2','[RecallMe]','starttime','YYYY-MM-DD\x20HH:mm:ss','outboundReCallsDay','rescheduleContactInQueue','createBody','createCustomerHistory','[HistoryDialRecallInQueue][historyCatch]','RecallFailedTimeout','[HistoryRecallClose]','createCustomerFinal','[getContactRecallMe]','IsNotLoggedIn','loggedIn','NO_AGENTS_LOGGED','isTrunkReachable','Trunk','TrunkBackup','UNREACHABLE_TRUNK','ACTIVE','callProgressDetectingCustomer','outboundNoSuchCallsDay','countnosuchnumberretry','countglobal','totalGlobal','logCustomer','NoSuchNumber','custom:agentnosuchnumber','buildObj','nosuchnumber','verifyAdditionalPhones','then','additional','dialNoSuchNumberRetryFrequency','callAdditionalPhoneAfterMin','dialGlobalMaxRetry','Global','dialNoSuchNumberMaxRetry','[callProgressDetectingCustomer][logNoSuchGlobal]','rescheduleContact','scheduledAt','unlockAgent','activeContact','actioncountonusuch','idContact','incrementPreviewCounters','swapAdditionalPhones','ANSWER','responsetime','[syncHangup][talking][increment]','uniqueid','custom:agentconnect','connect','acw','custom:agentConnectPreview','buildAcw','custom:agentcomplete','total','[16]','Answer','[callProgressDetectingCustomer][logAnswerGlobal]','crateCustomerReportQueue','sumBillable','talktime','[syncHangup][talking][decrement]','\x20Queue','linkedid','BUSY','outboundBusyCallsDay','countbusyretry','Busy','dialBusyRetryFrequency','custom:agentbusy','[callProgressDetectingCustomer][logBusy]','cloneAction','[callProgressDetectingCustomer][logBusyGlobal]','NOANSWER','outboundNoAnswerCallsDay','custom:agentnoanswer','[callProgressDetectingCustomer][logNoAnswer]','countnoanswerretry','dialNoAnswerMaxRetry','CONGESTION','countcongestionretry','Congestion','dialCongestionRetryFrequency','custom:agentcongestion','congestion','[callProgressDetectingCustomer][logCongestionGlobal]','dialCongestionMaxRetry','[callProgressDetectingCustomer][logCongestion]','outboundRejectCallsDay','countagentrejectretry','AgentReject','dialAgentRejectRetryFrequency','custom:agentreject','[syncHangupRequest][logAgentReject]','[callProgressDetectingCustomer][logAgentReject]','dialAgentRejectMaxRetry','ABANDONED','outboundAbandonedCallsDay','Abandoned','[callProgressDetectingCustomer][logAbandoned]','countabandonedretry','outboundUnknownCallsDay','countmachineretry','cause-txt','dialstatus','amd','[callProgressDetectingCustomer][hangupInAMD]','custom:amd','[callProgressDetectingCustomer][machine]','[default]','[callProgressDetectingCustomer][logUnknownGlobal]','updateOriginated','[callProgressDetectingCustomer]','[originated][decrement][callProgressDetectingCustomer]','destlinkedid','queueSummaryCountersUpdated','callProgressDetectingAgent','isUndefined','object','reason','logAgent','createAgentHistory','[callProgressDetectingAgent][logNoSuch]','[callProgressDetectingAgent][logBusy]','[callProgressDetectingAgent][logCongestion]','AnswerAGI','[callProgressDetectingAgent][logAnswerAGI]','[callProgressDetectingAgent]','[originated][decrement][callProgressDetectingAgent]','[swapAdditionalPhone]\x20','[incrementPreviewCounters]\x20','checkInBlack','Contact','phone','Contact\x20is\x20undefined','execCall','[Preview][execCall][success]','Queue:\x20','custom:agentcalled','called','Calling','[Preview][execCall][failure]','Call\x20failed','outboundBlacklistCallsDay','logBlacklist','createHistory','[Blacklist][error]','Contact\x20in\x20black\x20List','active','SIP/%s','reachable','unmonitored','execRun','pick','unlock','unlockContact','recallme','isValid','checkIsBlackList','[Preview][checkIsBlackList]','[Preview][getContactPreview]','Call\x20unsuccessful','isEmpty','[Preview][validateContact][Empty\x20Contact]','Empty\x20Contact','Queue','[Preview][validateContact][Empty\x20Campaign]','Empty\x20Campaign','[Preview][validateContact][Trunk\x20not\x20working\x20correctly]','campaign\x20Name:\x20','\x20Trunk\x20Backup\x20is\x20not\x20active','Trunk\x20not\x20working\x20correctly','isActive','[Preview][validateContact][Campaign\x20Active]','\x20Not\x20Active','Is\x20Valid','SIP/%s/%s%s','dialPrefix','trim','substring','dialCutDigit','getCallerId','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','dialOriginateCallerIdNumber','callerid','getCallerIdRandom'];(function(_0x4d973c,_0x36153f){var _0x33d408=function(_0x4e1fc3){while(--_0x4e1fc3){_0x4d973c['push'](_0x4d973c['shift']());}};_0x33d408(++_0x36153f);}(_0xc71b,0x164));var _0xbc71=function(_0xf2c1d7,_0x3b0708){_0xf2c1d7=_0xf2c1d7-0x0;var _0x40f855=_0xc71b[_0xf2c1d7];return _0x40f855;};'use strict';var util=require(_0xbc71('0x0'));var _=require(_0xbc71('0x1'));var uuid=require(_0xbc71('0x2'));var moment=require(_0xbc71('0x3'));var Redis=require('ioredis');var config=require(_0xbc71('0x4'));var logger=require('../../../config/logger')(_0xbc71('0x5'));var loggerAction=require(_0xbc71('0x6'))(_0xbc71('0x7'));var ami=require('../ami');var rpcDb=require('./rpcDb');var cmHopperAdditionalPhone=require('../rpc/cmHopperAdditionalPhone');var Action=require(_0xbc71('0x8'));var ut=require(_0xbc71('0x9'));var utils=require('../dialer/utils');config['redis']=_[_0xbc71('0xa')](config[_0xbc71('0xb')],{'host':_0xbc71('0xc'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xbc71('0xb')]));var Sequence=function(){};Sequence[_0xbc71('0xd')][_0xbc71('0xe')]=function(_0x28f610){this[_0xbc71('0xf')]=this[_0xbc71('0xf')]?this[_0xbc71('0xf')][_0xbc71('0x10')](_0x28f610):_0x28f610();};function Preview(_0x543cb6){this[_0xbc71('0x11')]=new Sequence();this[_0xbc71('0x12')]=_0x543cb6[_0xbc71('0x13')];this[_0xbc71('0x14')]=_0x543cb6['trunks'];this['actions']={};this[_0xbc71('0x15')]=_0x543cb6[_0xbc71('0x15')];this[_0xbc71('0x16')]=0x0;ami['on'](_0xbc71('0x17'),this[_0xbc71('0x18')][_0xbc71('0x19')](this));ami['on'](_0xbc71('0x1a'),this[_0xbc71('0x1b')][_0xbc71('0x19')](this));ami['on'](_0xbc71('0x1c'),this[_0xbc71('0x1d')]['bind'](this));ami['on'](_0xbc71('0x1e'),this[_0xbc71('0x1f')][_0xbc71('0x19')](this));ami['on'](_0xbc71('0x20'),this['syncNewExten'][_0xbc71('0x19')](this));ami['on'](_0xbc71('0x21'),this[_0xbc71('0x22')]['bind'](this));ami['on'](_0xbc71('0x23'),this[_0xbc71('0x24')][_0xbc71('0x19')](this));ami['on']('blindtransfer',this['syncBlindTransfer'][_0xbc71('0x19')](this));this['loopCampaigns'](this[_0xbc71('0x12')]);}function emit(_0x8008c0,_0x415862,_0x4d06e4){io['to'](_0x8008c0)[_0xbc71('0x25')](_0x415862,_0x4d06e4);}function emitVoiceQueueChannelRemove(_0x395e33){logger[_0xbc71('0x26')](_0xbc71('0x27'),JSON[_0xbc71('0x28')](_0x395e33));emit(util[_0xbc71('0x29')](_0xbc71('0x2a'),_0x395e33['name']),_0xbc71('0x2b'),_0x395e33);io['emit'](_0xbc71('0x2c'),_0x395e33);}function notSendMessagesQueue(_0x1b226f){if(_0x1b226f[_0xbc71('0x2d')]){if(_0x1b226f[_0xbc71('0x2e')]===0x0&&_0x1b226f[_0xbc71('0x2f')]===0x0){_0x1b226f['sendMessageOneNotActive']=![];_0x1b226f[_0xbc71('0x30')]=0x0;_0x1b226f[_0xbc71('0x31')]=0x0;_0x1b226f['message']=utils[_0xbc71('0x32')][_0xbc71('0x33')];ut[_0xbc71('0x34')](_0xbc71('0x35'),_0x1b226f[_0xbc71('0x36')]+_0xbc71('0x37'));}else{_0x1b226f[_0xbc71('0x38')]=utils[_0xbc71('0x32')][_0xbc71('0x39')];ut[_0xbc71('0x34')](_0xbc71('0x35'),_0x1b226f[_0xbc71('0x36')]+_0xbc71('0x3a'));}}}Preview['prototype']['loopCampaigns']=function(){var _0x20c1a8=this;setInterval(function(){_0x20c1a8[_0xbc71('0x3b')]();},0x7cf);};Preview[_0xbc71('0xd')][_0xbc71('0x3b')]=function(){var _0x3c59e7=this[_0xbc71('0x12')];this['clockClearZombieChannels']+=0x1;for(var _0x50b051 in _0x3c59e7){if(_0x3c59e7[_0xbc71('0x3c')](_0x50b051)&&(_0x3c59e7[_0x50b051][_0xbc71('0x3d')]===_0xbc71('0x5')||_0x3c59e7[_0x50b051]['dialMethod']===_0xbc71('0x3e'))&&_0x3c59e7[_0x50b051][_0xbc71('0x3f')]===_0xbc71('0x40')){if(this[_0xbc71('0x16')]>0x7){this[_0xbc71('0x16')]=0x0;this[_0xbc71('0x41')]();}}if(_0x3c59e7[_0xbc71('0x3c')](_0x50b051)&&_0x3c59e7[_0x50b051]['dialMethod']===_0xbc71('0x5')&&_0x3c59e7[_0x50b051][_0xbc71('0x3f')]==='outbound'){if(_0x3c59e7[_0x50b051][_0xbc71('0x42')]){this[_0xbc71('0x43')](_0x3c59e7[_0x50b051]);if(_0x3c59e7[_0x50b051]['dialPreviewAutoRecallMe'])this[_0xbc71('0x44')](_0x3c59e7[_0x50b051]);}else{notSendMessagesQueue(_0x3c59e7[_0x50b051]);}}}};Preview[_0xbc71('0xd')]['clearZombieChannel']=function(_0x538d5f){var _0x7c69c=this;this['sequence']['enqueue'](function(){if(!_[_0xbc71('0x45')](_0x7c69c[_0xbc71('0x46')][_0x538d5f])){loggerAction[_0xbc71('0x26')]('[clearZombieChannels][talking]',_0x538d5f,'Queue',_0x7c69c[_0xbc71('0x46')][_0x538d5f][_0xbc71('0x47')],_0xbc71('0x48'),JSON['stringify'](_0x7c69c['campaignsPreview'][_0x7c69c['actions'][_0x538d5f][_0xbc71('0x47')]][_0xbc71('0x2e')]),_0xbc71('0x49'),JSON[_0xbc71('0x28')](_0x7c69c['campaignsPreview'][_0x7c69c[_0xbc71('0x46')][_0x538d5f]['queue']][_0xbc71('0x2f')]),JSON[_0xbc71('0x28')](_0x7c69c[_0xbc71('0x46')][_0x538d5f]['dialAnswer']),JSON['stringify'](_['pick'](_0x7c69c['actions'][_0x538d5f],[_0xbc71('0x4a'),_0xbc71('0x4b'),_0xbc71('0x4c'),_0xbc71('0x4d')])));return ami[_0xbc71('0x4e')]({'action':_0xbc71('0x4f'),'channel':_0x7c69c['actions'][_0x538d5f][_0xbc71('0x50')]})[_0xbc71('0x51')](function(_0x503001){if(_0x503001['message']==='No\x20such\x20channel'){setTimeout(function(){if(_0x7c69c[_0xbc71('0x46')][_0x538d5f]){ut['updateOriginated'](_0x7c69c[_0xbc71('0x12')][_0x7c69c[_0xbc71('0x46')][_0x538d5f][_0xbc71('0x47')]],_0xbc71('0x52'));if(_0x7c69c[_0xbc71('0x46')][_0x538d5f][_0xbc71('0x53')]===!![]){ut[_0xbc71('0x54')](_0x7c69c[_0xbc71('0x12')][_0x7c69c[_0xbc71('0x46')][_0x538d5f]['queue']],_0xbc71('0x52'));ut['loggerError'](_0xbc71('0x55')+_0x538d5f,_0x7c69c[_0xbc71('0x46')][_0x538d5f][_0xbc71('0x47')]);}ut[_0xbc71('0x56')](_0xbc71('0x57')+_0x538d5f,_0x7c69c[_0xbc71('0x46')][_0x538d5f]['queue']);delete _0x7c69c[_0xbc71('0x46')][_0x538d5f];}},0x2328);}});}});};Preview['prototype'][_0xbc71('0x41')]=function(){var _0x1284fb=this;loggerAction[_0xbc71('0x26')](_0xbc71('0x58'),_[_0xbc71('0x59')](this[_0xbc71('0x46')]));for(var _0x3ebb4d in this[_0xbc71('0x46')]){if(_0x1284fb[_0xbc71('0x46')][_0xbc71('0x3c')](_0x3ebb4d)){_0x1284fb[_0xbc71('0x5a')](_0x3ebb4d);}}};Preview['prototype'][_0xbc71('0x44')]=function(_0x1bc170){var _0x3033df=this;rpcDb[_0xbc71('0x5b')](_0x1bc170['id'],ut[_0xbc71('0x5c')](this['agents']))['then'](function(_0x2cb981){if(!_[_0xbc71('0x45')](_0x2cb981)){for(var _0x163d67=0x0;_0x163d67<_0x2cb981[_0xbc71('0x5d')];_0x163d67+=0x1){if(ut['getDiff'](_0x2cb981[_0x163d67][_0xbc71('0x5e')])<_0x1bc170[_0xbc71('0x5f')]*0x3c){if(_0x2cb981[_0x163d67]['Agent']&&!_0x2cb981[_0x163d67][_0xbc71('0x60')][_0xbc71('0x61')]){_0x3033df[_0xbc71('0x62')](_0x2cb981[_0x163d67]['id'])['then'](ut[_0xbc71('0x63')](_0xbc71('0x64')))[_0xbc71('0x51')](ut[_0xbc71('0x63')](_0xbc71('0x64')));}else{rpcDb['disableContact'](_0x2cb981[_0x163d67]['id']);}}else{var _0x570dd3=new Action(_0x2cb981[_0x163d67],_0x1bc170);_0x570dd3[_0xbc71('0x65')]=moment()[_0xbc71('0x29')](_0xbc71('0x66'));_0x1bc170[_0xbc71('0x67')]+=0x1;ut['logCustomer'](_0x570dd3,0x17,'RecallInQueue');if(_0x1bc170['dialRecallInQueue']){rpcDb[_0xbc71('0x68')](ut[_0xbc71('0x69')](_0x2cb981[_0x163d67]));rpcDb[_0xbc71('0x6a')](_0x570dd3,_0xbc71('0x6b'));}else{ut['logCustomer'](_0x570dd3,0x16,_0xbc71('0x6c'));rpcDb[_0xbc71('0x6a')](_0x570dd3,_0xbc71('0x6d'));rpcDb[_0xbc71('0x6e')](_0x570dd3,_0xbc71('0x6d'));}}}}})[_0xbc71('0x51')](ut[_0xbc71('0x63')](_0xbc71('0x6f')));};Preview[_0xbc71('0xd')]['setMessage']=function(_0x4314f1){_0x4314f1[_0xbc71('0x2d')]=!![];if(ut[_0xbc71('0x70')](_0x4314f1[_0xbc71('0x71')])){_0x4314f1[_0xbc71('0x38')]=utils[_0xbc71('0x32')][_0xbc71('0x72')];}else if(!ut['isActive'](_0x4314f1[_0xbc71('0x42')])){_0x4314f1[_0xbc71('0x38')]=utils['CAMPAIGN_STATUS']['INACTIVE'];}else if(!this[_0xbc71('0x73')](_0x4314f1[_0xbc71('0x74')])){if(!this[_0xbc71('0x73')](_0x4314f1[_0xbc71('0x75')])){_0x4314f1[_0xbc71('0x38')]=utils[_0xbc71('0x32')][_0xbc71('0x76')];}else{_0x4314f1[_0xbc71('0x38')]=utils[_0xbc71('0x32')]['ACTIVE'];}}else{_0x4314f1[_0xbc71('0x38')]=utils['CAMPAIGN_STATUS'][_0xbc71('0x77')];}};Preview[_0xbc71('0xd')][_0xbc71('0x78')]=function(_0x1ae9b7,_0x4b0b78,_0x284705){var _0xc1c91=this;var _0x7c1a90=this[_0xbc71('0x46')][_0x4b0b78];var _0x3a022f=this[_0xbc71('0x12')][_0x7c1a90[_0xbc71('0x47')]];var _0x174de0;var _0x1ea2a9=![];var _0x4b7011=0x2;var _0x1b6253=0x3;if(_0x3a022f){switch(_0x284705){case'1':_0x3a022f[_0xbc71('0x79')]+=0x1;_0x7c1a90[_0xbc71('0x7a')]+=0x1;_0x7c1a90[_0xbc71('0x7b')]=ut[_0xbc71('0x7c')](_0x7c1a90);ut[_0xbc71('0x7d')](_0x7c1a90,0x0,_0xbc71('0x7e'));ami[_0xbc71('0x25')](_0xbc71('0x7f'),ut[_0xbc71('0x80')](_0x7c1a90,_0xbc71('0x81')));rpcDb[_0xbc71('0x6a')](_0x7c1a90,'[callProgressDetectingCustomer][logNoSuch]');_0xc1c91[_0xbc71('0x82')](_0x7c1a90,'0',_0x3a022f)[_0xbc71('0x83')](function(_0x5a9e74){_0x1ea2a9=_0x5a9e74[_0xbc71('0x84')]==0x1;_0x4b7011=_0x3a022f[_0xbc71('0x85')];_0x1b6253=_0x3a022f[_0xbc71('0x86')];if(!_0x1ea2a9){if(ut['totalGlobal'](_0x7c1a90)>=_0x3a022f[_0xbc71('0x87')]){_0x174de0=ut['cloneAction'](_0x7c1a90,0xf,_0xbc71('0x88'));rpcDb[_0xbc71('0x6e')](_0x174de0,'[callProgressDetectingCustomer][logNoSuchGlobal]');}else{if(_0x7c1a90['countnosuchnumberretry']>=_0x3a022f[_0xbc71('0x89')]){rpcDb[_0xbc71('0x6e')](_0x7c1a90,_0xbc71('0x8a'));}else{rpcDb[_0xbc71('0x8b')](ut[_0xbc71('0x8c')](_0x7c1a90,_0xbc71('0x7a'),_0x3a022f['dialNoSuchNumberRetryFrequency']),_0x7c1a90[_0xbc71('0x8d')],_0x7c1a90[_0xbc71('0x8e')]);}}delete this[_0xbc71('0x46')][_0x1ae9b7['linkedid']];}else{_0x7c1a90[_0xbc71('0x7a')]++;logger[_0xbc71('0x26')](_0xbc71('0x8f'),_0x7c1a90[_0xbc71('0x7a')]);logger[_0xbc71('0x26')]('id',_0x7c1a90[_0xbc71('0x90')]);_0xc1c91[_0xbc71('0x91')]({'id':_0x7c1a90['idContact'],'field':{'countnosuchnumberretry':_0x7c1a90[_0xbc71('0x7a')]}})[_0xbc71('0x83')](function(){_0xc1c91[_0xbc71('0x92')](_0x7c1a90,_0x4b7011,_0x1b6253)['then'](function(){});});}});break;case _0xbc71('0x93'):var _0x13d3b3=moment()[_0xbc71('0x29')](_0xbc71('0x66'));_0x7c1a90[_0xbc71('0x94')]=_0x13d3b3;_0x7c1a90['answertime']=_0x13d3b3;_0x7c1a90['dialAnswer']=!![];_0x3a022f['pTalking']+=0x1;logger[_0xbc71('0x26')](_0xbc71('0x95'),_0x7c1a90[_0xbc71('0x96')],'\x20Queue',_0x3a022f['name'],_0xbc71('0x49'),_0x3a022f['pTalking']);ami[_0xbc71('0x25')](_0xbc71('0x97'),ut[_0xbc71('0x80')](_0x7c1a90,_0xbc71('0x98'),this[_0xbc71('0x12')][_0x7c1a90[_0xbc71('0x47')]]));if(_0x3a022f[_0xbc71('0x99')]){ami[_0xbc71('0x25')](_0xbc71('0x9a'),ut[_0xbc71('0x9b')](_0x7c1a90));}break;case'16':ami[_0xbc71('0x25')](_0xbc71('0x9c'),ut['buildObj'](_0x7c1a90,'complete',this[_0xbc71('0x12')][_0x7c1a90['queue']]));emitVoiceQueueChannelRemove(ut[_0xbc71('0x80')](_0x7c1a90,'complete'));_0x3a022f['outboundAnswerCallsDay']+=0x1;_0x3a022f[_0xbc71('0x9d')]+=0x1;_0x3a022f['answered']+=0x1;ut[_0xbc71('0x54')](_0x3a022f,_0xbc71('0x9e'));_0x7c1a90[_0xbc71('0x7b')]=ut['totalGlobal'](_0x7c1a90);ut[_0xbc71('0x7d')](_0x7c1a90,0x4,_0xbc71('0x9f'));rpcDb[_0xbc71('0x6a')](_0x7c1a90,'[callProgressDetectingCustomer][logAnswer]');rpcDb[_0xbc71('0x6e')](_0x7c1a90,_0xbc71('0xa0'));rpcDb[_0xbc71('0xa1')](_0x7c1a90);_0x3a022f['sumDuration']+=_0x7c1a90['talktime'];_0x3a022f[_0xbc71('0xa2')]+=_0x7c1a90[_0xbc71('0xa3')];logger[_0xbc71('0x26')](_0xbc71('0xa4'),_0x7c1a90[_0xbc71('0x96')],_0xbc71('0xa5'),_0x3a022f[_0xbc71('0x36')],_0xbc71('0x49'),_0x3a022f[_0xbc71('0x2f')]);delete this[_0xbc71('0x46')][_0x1ae9b7[_0xbc71('0xa6')]];break;case _0xbc71('0xa7'):_0x3a022f[_0xbc71('0xa8')]+=0x1;_0x7c1a90[_0xbc71('0xa9')]+=0x1;_0x7c1a90[_0xbc71('0x7b')]=ut['totalGlobal'](_0x7c1a90);ut['logCustomer'](_0x7c1a90,0x5,_0xbc71('0xaa'));_0x4b7011=_0x3a022f[_0xbc71('0xab')];_0x1b6253=_0x3a022f[_0xbc71('0x86')];ami[_0xbc71('0x25')](_0xbc71('0xac'),ut[_0xbc71('0x80')](_0x7c1a90,'busy'));rpcDb['createCustomerHistory'](_0x7c1a90,_0xbc71('0xad'));_0xc1c91[_0xbc71('0x82')](_0x7c1a90,'5',_0x3a022f)[_0xbc71('0x83')](function(_0x44c40a){_0x1ea2a9=_0x44c40a[_0xbc71('0x84')]==0x1;if(!_0x1ea2a9){if(ut['totalGlobal'](_0x7c1a90)>=_0x3a022f[_0xbc71('0x87')]){_0x174de0=ut[_0xbc71('0xae')](_0x7c1a90,0xf,_0xbc71('0x88'));rpcDb[_0xbc71('0x6e')](_0x174de0,_0xbc71('0xaf'));}else{if(_0x7c1a90[_0xbc71('0xa9')]>=_0x3a022f['dialBusyMaxRetry']){rpcDb[_0xbc71('0x6e')](_0x7c1a90,_0xbc71('0xad'));}else{rpcDb[_0xbc71('0x8b')](ut[_0xbc71('0x8c')](_0x7c1a90,'countbusyretry',_0x3a022f['dialBusyRetryFrequency']),_0x7c1a90['unlockAgent'],_0x7c1a90['activeContact']);}}}else{_0x7c1a90['countbusyretry']++;_0xc1c91['incrementPreviewCounters']({'id':_0x7c1a90[_0xbc71('0x90')],'field':{'countbusyretry':_0x7c1a90[_0xbc71('0xa9')]}})[_0xbc71('0x83')](function(){_0xc1c91[_0xbc71('0x92')](_0x7c1a90,_0x4b7011,_0x1b6253)['then'](function(){});});}});break;case _0xbc71('0xb0'):_0x3a022f[_0xbc71('0xb1')]+=0x1;_0x7c1a90['countnoanswerretry']+=0x1;_0x7c1a90[_0xbc71('0x7b')]=ut['totalGlobal'](_0x7c1a90);ut[_0xbc71('0x7d')](_0x7c1a90,0x3,'NoAnswer');_0x4b7011=_0x3a022f['dialNoAnswerRetryFrequency'];_0x1b6253=_0x3a022f[_0xbc71('0x86')];var _0x360ea8=ut['buildNoAnswerEventPayload'](_0x7c1a90,_0x3a022f);ami[_0xbc71('0x25')](_0xbc71('0xb2'),_0x360ea8);rpcDb[_0xbc71('0x6a')](_0x7c1a90,_0xbc71('0xb3'));_0xc1c91[_0xbc71('0x82')](_0x7c1a90,'3',_0x3a022f)[_0xbc71('0x83')](function(_0x13f4ba){_0x1ea2a9=_0x13f4ba[_0xbc71('0x84')]==0x1;if(!_0x1ea2a9){if(ut[_0xbc71('0x7c')](_0x7c1a90)>=_0x3a022f[_0xbc71('0x87')]){_0x174de0=ut[_0xbc71('0xae')](_0x7c1a90,0xf,'Global');rpcDb[_0xbc71('0x6e')](_0x174de0,'[callProgressDetectingCustomer][logNoAnswerGlobal]');}else{if(_0x7c1a90[_0xbc71('0xb4')]>=_0x3a022f[_0xbc71('0xb5')]){rpcDb[_0xbc71('0x6e')](_0x7c1a90,_0xbc71('0xb3'));}else{rpcDb[_0xbc71('0x8b')](ut[_0xbc71('0x8c')](_0x7c1a90,_0xbc71('0xb4'),_0x3a022f['dialNoAnswerRetryFrequency']),_0x7c1a90[_0xbc71('0x8d')],_0x7c1a90[_0xbc71('0x8e')]);}}}else{_0x7c1a90[_0xbc71('0xb4')]++;_0xc1c91[_0xbc71('0x91')]({'id':_0x7c1a90[_0xbc71('0x90')],'field':{'countnoanswerretry':_0x7c1a90[_0xbc71('0xb4')]}})[_0xbc71('0x83')](function(){_0xc1c91['swapAdditionalPhones'](_0x7c1a90,_0x4b7011,_0x1b6253)[_0xbc71('0x83')](function(){});});}});break;case _0xbc71('0xb6'):_0x3a022f['outboundCongestionCallsDay']+=0x1;_0x7c1a90[_0xbc71('0xb7')]+=0x1;_0x7c1a90[_0xbc71('0x7b')]=ut[_0xbc71('0x7c')](_0x7c1a90);ut[_0xbc71('0x7d')](_0x7c1a90,0x8,_0xbc71('0xb8'));_0x4b7011=_0x3a022f[_0xbc71('0xb9')];_0x1b6253=_0x3a022f[_0xbc71('0x86')];ami[_0xbc71('0x25')](_0xbc71('0xba'),ut[_0xbc71('0x80')](_0x7c1a90,_0xbc71('0xbb')));rpcDb[_0xbc71('0x6a')](_0x7c1a90,'[callProgressDetectingCustomer][logCongestion]');_0xc1c91['verifyAdditionalPhones'](_0x7c1a90,'8',_0x3a022f)['then'](function(_0x467aaf){_0x1ea2a9=_0x467aaf[_0xbc71('0x84')]==0x1;if(!_0x1ea2a9){if(ut['totalGlobal'](_0x7c1a90)>=_0x3a022f[_0xbc71('0x87')]){_0x174de0=ut[_0xbc71('0xae')](_0x7c1a90,0xf,_0xbc71('0x88'));rpcDb['createCustomerFinal'](_0x174de0,_0xbc71('0xbc'));}else{if(_0x7c1a90[_0xbc71('0xb7')]>=_0x3a022f[_0xbc71('0xbd')]){rpcDb[_0xbc71('0x6e')](_0x7c1a90,_0xbc71('0xbe'));}else{rpcDb[_0xbc71('0x8b')](ut['scheduledAt'](_0x7c1a90,_0xbc71('0xb7'),_0x3a022f[_0xbc71('0xab')]),_0x7c1a90[_0xbc71('0x8d')],_0x7c1a90[_0xbc71('0x8e')]);}}}else{_0x7c1a90['countcongestionretry']++;_0xc1c91[_0xbc71('0x91')]({'id':_0x7c1a90[_0xbc71('0x90')],'field':{'countcongestionretry':_0x7c1a90['countcongestionretry']}})[_0xbc71('0x83')](function(){_0xc1c91[_0xbc71('0x92')](_0x7c1a90,_0x4b7011,_0x1b6253)[_0xbc71('0x83')](function(){});});}});break;case'CANCEL':_0x3a022f[_0xbc71('0xbf')]+=0x1;_0x7c1a90[_0xbc71('0xc0')]+=0x1;_0x7c1a90[_0xbc71('0x7b')]=ut[_0xbc71('0x7c')](_0x7c1a90);ut[_0xbc71('0x7d')](_0x7c1a90,0x14,_0xbc71('0xc1'));_0x4b7011=_0x3a022f[_0xbc71('0xc2')];_0x1b6253=_0x3a022f[_0xbc71('0x86')];ami[_0xbc71('0x25')](_0xbc71('0xc3'),ut[_0xbc71('0x80')](_0x7c1a90,'agentreject'));rpcDb[_0xbc71('0x6a')](_0x7c1a90,_0xbc71('0xc4'));_0xc1c91[_0xbc71('0x82')](_0x7c1a90,'20',_0x3a022f)[_0xbc71('0x83')](function(_0x56038a){_0x1ea2a9=_0x56038a[_0xbc71('0x84')]==0x1;if(!_0x1ea2a9){if(ut['totalGlobal'](_0x7c1a90)>=_0x3a022f['dialGlobalMaxRetry']){_0x174de0=ut[_0xbc71('0xae')](_0x7c1a90,0x14,'AgentReject');rpcDb[_0xbc71('0x6e')](_0x174de0,_0xbc71('0xc5'));}else{if(_0x7c1a90[_0xbc71('0xc0')]>=_0x3a022f[_0xbc71('0xc6')]){rpcDb[_0xbc71('0x6e')](_0x7c1a90,_0xbc71('0xc5'));}else{rpcDb[_0xbc71('0x8b')](ut['scheduledAt'](_0x7c1a90,_0xbc71('0xc0'),_0x3a022f[_0xbc71('0xc2')]),_0x7c1a90[_0xbc71('0x8d')],_0x7c1a90[_0xbc71('0x8e')]);}}}else{_0x7c1a90['countnoanswerretry']++;_0xc1c91[_0xbc71('0x91')]({'id':_0x7c1a90[_0xbc71('0x90')],'field':{'countnoanswerretry':_0x7c1a90[_0xbc71('0xb4')]}})['then'](function(){_0xc1c91['swapAdditionalPhones'](_0x7c1a90,_0x4b7011,_0x1b6253)['then'](function(){});});}});break;case _0xbc71('0xc7'):_0x3a022f[_0xbc71('0xc8')]+=0x1;_0x7c1a90['countabandonedretry']+=0x1;_0x7c1a90['countglobal']=ut[_0xbc71('0x7c')](_0x7c1a90);ut[_0xbc71('0x7d')](_0x7c1a90,0xb,_0xbc71('0xc9'));rpcDb[_0xbc71('0x6a')](_0x7c1a90,'[callProgressDetectingCustomer][logAbandoned]');_0xc1c91[_0xbc71('0x82')](_0x7c1a90,'11',_0x3a022f)[_0xbc71('0x83')](function(_0x2292b8){_0x1ea2a9=_0x2292b8[_0xbc71('0x84')]==0x1;if(!_0x1ea2a9){if(ut[_0xbc71('0x7c')](_0x7c1a90)>=_0x3a022f[_0xbc71('0x87')]){_0x174de0=ut[_0xbc71('0xae')](_0x7c1a90,0xf,'Global');rpcDb[_0xbc71('0x6e')](_0x174de0,_0xbc71('0xca'));}else{if(_0x7c1a90['countabandonedetry']>=_0x3a022f['dialAbandonedMaxRety']){rpcDb['createCustomerFinal'](_0x7c1a90,_0xbc71('0xca'));}else{rpcDb['rescheduleContact'](ut[_0xbc71('0x8c')](_0x7c1a90,_0xbc71('0xcb'),_0x3a022f['dialAbandonedRetryFrequency']),_0x7c1a90[_0xbc71('0x8d')],_0x7c1a90['activeContact']);}}}else{_0x7c1a90[_0xbc71('0xb4')]++;_0xc1c91['incrementPreviewCounters']({'id':_0x7c1a90[_0xbc71('0x90')],'field':{'countnoanswerretry':_0x7c1a90[_0xbc71('0xb4')]}})[_0xbc71('0x83')](function(){_0xc1c91[_0xbc71('0x92')](_0x7c1a90,_0x4b7011,_0x1b6253)['then'](function(){});});}});break;case'18':_0x3a022f[_0xbc71('0xcc')]+=0x1;_0x7c1a90[_0xbc71('0xcd')]+=0x1;_0x7c1a90[_0xbc71('0x7b')]=ut['totalGlobal'](_0x7c1a90);ut[_0xbc71('0x7d')](_0x7c1a90,0x12,_0x1ae9b7[_0xbc71('0xce')]||_0x1ae9b7[_0xbc71('0xcf')]);ami[_0xbc71('0x25')]('custom:amd',ut['buildObj'](_0x7c1a90,_0xbc71('0xd0')));rpcDb[_0xbc71('0x6a')](_0x7c1a90,_0xbc71('0xd1'));_0xc1c91['verifyAdditionalPhones'](_0x7c1a90,'18',_0x3a022f)[_0xbc71('0x83')](function(_0x4ca9cb){_0x1ea2a9=_0x4ca9cb[_0xbc71('0x84')]==0x1;if(!_0x1ea2a9){if(ut['totalGlobal'](_0x7c1a90)>=_0x3a022f[_0xbc71('0x87')]){_0x174de0=ut[_0xbc71('0xae')](_0x7c1a90,0x12,_0xbc71('0x88'));rpcDb[_0xbc71('0x6e')](_0x174de0,_0xbc71('0xd1'));}else{rpcDb[_0xbc71('0x6e')](_0x7c1a90,'[callProgressDetectingCustomer][hangupInAMD]');}}else{_0x7c1a90[_0xbc71('0xb4')]++;_0xc1c91['incrementPreviewCounters']({'id':_0x7c1a90['idContact'],'field':{'countnoanswerretry':_0x7c1a90[_0xbc71('0xb4')]}})['then'](function(){_0xc1c91[_0xbc71('0x92')](_0x7c1a90,_0x4b7011,_0x1b6253)['then'](function(){});});}});delete this['actions'][_0x1ae9b7[_0xbc71('0xa6')]];break;case'19':_0x3a022f[_0xbc71('0xcc')]+=0x1;_0x7c1a90[_0xbc71('0x7b')]=ut[_0xbc71('0x7c')](_0x7c1a90);ut[_0xbc71('0x7d')](_0x7c1a90,0x13,_0x1ae9b7[_0xbc71('0xce')]||_0x1ae9b7['dialstatus']);ami['emit'](_0xbc71('0xd2'),ut[_0xbc71('0x80')](_0x7c1a90,_0xbc71('0xd0')));rpcDb[_0xbc71('0x6a')](_0x7c1a90,'[callProgressDetectingCustomer][machine]');_0xc1c91['verifyAdditionalPhones'](_0x7c1a90,'18',_0x3a022f)[_0xbc71('0x83')](function(_0x4ba718){_0x1ea2a9=_0x4ba718[_0xbc71('0x84')]==0x1;if(!_0x1ea2a9){if(ut[_0xbc71('0x7c')](_0x7c1a90)>=_0x3a022f[_0xbc71('0x87')]){_0x174de0=ut[_0xbc71('0xae')](_0x7c1a90,0xf,_0xbc71('0x88'));rpcDb[_0xbc71('0x6e')](_0x174de0,_0xbc71('0xd3'));}else{rpcDb[_0xbc71('0x6e')](_0x7c1a90,'[callProgressDetectingCustomer][machine]');}}else{_0x7c1a90[_0xbc71('0xb4')]++;_0xc1c91[_0xbc71('0x91')]({'id':_0x7c1a90[_0xbc71('0x90')],'field':{'countnoanswerretry':_0x7c1a90[_0xbc71('0xb4')]}})[_0xbc71('0x83')](function(){_0xc1c91[_0xbc71('0x92')](_0x7c1a90,_0x4b7011,_0x1b6253)['then'](function(){});});}});delete this[_0xbc71('0x46')][_0x1ae9b7[_0xbc71('0xa6')]];break;default:if(_0x7c1a90[_0xbc71('0x53')]){ut[_0xbc71('0x54')](_0x3a022f,_0xbc71('0xd4'));ut['loggerError']('[Dialer][decrementTalkink][no\x20Hangup][Preview]'+_0x3a022f[_0xbc71('0x36')],_0x1ae9b7);}_0x3a022f['outboundUnknownCallsDay']+=0x1;_0x7c1a90[_0xbc71('0x7b')]=ut['totalGlobal'](_0x7c1a90);ut[_0xbc71('0x7d')](_0x7c1a90,0xc,_0x1ae9b7[_0xbc71('0xce')]||_0x1ae9b7[_0xbc71('0xcf')]);_0x4b7011=_0x3a022f[_0xbc71('0xc2')];_0x1b6253=_0x3a022f[_0xbc71('0x86')];rpcDb[_0xbc71('0x6a')](_0x7c1a90,'[callProgressDetectingCustomer][logUnknown]');_0xc1c91['verifyAdditionalPhones'](_0x7c1a90,'20',_0x3a022f)['then'](function(_0x2a15d1){_0x1ea2a9=_0x2a15d1[_0xbc71('0x84')]==0x1;if(!_0x1ea2a9){if(ut[_0xbc71('0x7c')](_0x7c1a90)>=_0x3a022f['dialGlobalMaxRetry']){_0x174de0=ut[_0xbc71('0xae')](_0x7c1a90,0xf,_0xbc71('0x88'));rpcDb[_0xbc71('0x6e')](_0x174de0,_0xbc71('0xd5'));}else{rpcDb[_0xbc71('0x6e')](_0x7c1a90,'[callProgressDetectingCustomer][logUnknownGlobal]');}delete this[_0xbc71('0x46')][_0x1ae9b7['linkedid']];}else{_0xc1c91['swapAdditionalPhones'](_0x7c1a90,_0x4b7011,_0x1b6253)[_0xbc71('0x83')](function(){});}});}if(!(_0x7c1a90[_0xbc71('0x53')]&&_0x284705==='16')){ut[_0xbc71('0xd6')](_0x3a022f,_0xbc71('0xd7'));logger['info'](_0xbc71('0xd8'),_0x7c1a90[_0xbc71('0x96')],'\x20Queue',_0x3a022f[_0xbc71('0x36')],_0xbc71('0x48'),_0x3a022f[_0xbc71('0x2e')]);}if(_0x284705!==_0xbc71('0x93')){delete this['actions'][_0x1ae9b7[_0xbc71('0xa6')]];delete this['actions'][_0x1ae9b7[_0xbc71('0xd9')]];}_0x3a022f[_0xbc71('0xda')]=!![];}};Preview[_0xbc71('0xd')][_0xbc71('0xdb')]=function(_0x1a0b46,_0x30f101,_0x2f8777){if(_[_0xbc71('0xdc')](_0x30f101)&&_0xbc71('0xdd')!==typeof _0x30f101){return;}if(_['isUndefined'](_0x2f8777)&&'object'!==typeof _0x2f8777){return;}switch(_0x2f8777[_0xbc71('0xde')]){case'0':ut[_0xbc71('0xdf')](_0x1a0b46,0x0,_0xbc71('0x7e'));rpcDb[_0xbc71('0xe0')](_0x1a0b46,_0xbc71('0xe1'));break;case'3':ut[_0xbc71('0xdf')](_0x1a0b46,0x3,'NoAnswer');rpcDb[_0xbc71('0xe0')](_0x1a0b46,'[callProgressDetectingAgent][logNoAnswer]');break;case'5':ut[_0xbc71('0xdf')](_0x1a0b46,0x5,_0xbc71('0xaa'));rpcDb['createAgentHistory'](_0x1a0b46,_0xbc71('0xe2'));break;case'8':ut[_0xbc71('0xdf')](_0x1a0b46,0x8,_0xbc71('0xb8'));rpcDb['createAgentHistory'](_0x1a0b46,_0xbc71('0xe3'));break;case'22':ut['logAgent'](_0x1a0b46,0x16,_0xbc71('0xe4'));rpcDb['createAgentHistory'](_0x1a0b46,_0xbc71('0xe5'));break;default:ut[_0xbc71('0xdf')](_0x1a0b46,0xc,_0x2f8777['reason']);rpcDb[_0xbc71('0xe0')](_0x1a0b46,_0xbc71('0xe3'));}ut[_0xbc71('0xd6')](_0x30f101,_0xbc71('0xe6'));logger[_0xbc71('0x26')](_0xbc71('0xe7'),_0x1a0b46[_0xbc71('0x96')],_0xbc71('0xa5'),_0x30f101['name'],_0xbc71('0x48'),_0x30f101[_0xbc71('0x2e')]);delete this[_0xbc71('0x46')][_0x1a0b46[_0xbc71('0x96')]];};Preview[_0xbc71('0xd')][_0xbc71('0x82')]=function(_0x31f227,_0x16f52c,_0xdf12e7){return cmHopperAdditionalPhone['verifyAdditionalPhones'](_0x31f227,_0x16f52c,_0xdf12e7)['catch'](logger['info']('[verifyAdditionalPhone]\x20'));};Preview['prototype']['swapAdditionalPhones']=function(_0x4c800c,_0xbf0e52,_0x259f0b){return cmHopperAdditionalPhone[_0xbc71('0x92')](_0x4c800c,_0xbf0e52,_0x259f0b)[_0xbc71('0x51')](logger[_0xbc71('0x26')](_0xbc71('0xe8')));};Preview[_0xbc71('0xd')][_0xbc71('0x91')]=function(_0x5a164e){return Promise['resolve']()[_0xbc71('0x83')](cmHopperAdditionalPhone[_0xbc71('0x91')](_0x5a164e))['catch'](logger[_0xbc71('0x26')](_0xbc71('0xe9')));};Preview[_0xbc71('0xd')][_0xbc71('0xea')]=function(_0x346692,_0x4a6b1f,_0x966ee0,_0x268317,_0x1f9c51){var _0x409e68=this;return new Promise(function(_0x308776,_0x2ae8fc){if(_[_0xbc71('0x45')](_0x4a6b1f)||_['isNil'](_0x4a6b1f[_0xbc71('0xeb')])||_[_0xbc71('0x45')](_0x4a6b1f[_0xbc71('0xec')])||_[_0xbc71('0x45')](_0x4a6b1f[_0xbc71('0x4c')])){_0x2ae8fc(ut['message'](_0xbc71('0xed'),_0x268317,_0x1f9c51));return;}var _0x446635=uuid['v4']();var _0x5274bf=_0x409e68[_0xbc71('0x12')][_0x4a6b1f['Queue'][_0xbc71('0x36')]];var _0x597701=_0x966ee0?_0x409e68[_0xbc71('0x15')][_0x966ee0]['id']:undefined;_0x409e68[_0xbc71('0x46')][_0x446635]=new Action(_0x4a6b1f,_0x5274bf,_0x446635,_0x966ee0,_0x597701);var _0xce2eca=_0x409e68[_0xbc71('0x46')][_0x446635];_0xce2eca[_0xbc71('0x8d')]=_0x268317;_0xce2eca[_0xbc71('0x8e')]=_0x1f9c51;_0xce2eca['lookAgent']=_0x966ee0;if(_['isEmpty'](_0x346692)){_0x409e68[_0xbc71('0xee')](_0xce2eca,_0x5274bf,_0x4a6b1f,_0x966ee0)[_0xbc71('0x83')](function(_0xa940eb){logger[_0xbc71('0x26')](_0xbc71('0xef'),_0xbc71('0xf0')+_0xce2eca[_0xbc71('0x47')]+'\x20IdHopper:\x20'+_0xce2eca[_0xbc71('0x90')],JSON['stringify'](_0xa940eb));ami[_0xbc71('0x25')](_0xbc71('0xf1'),ut[_0xbc71('0x80')](_0xce2eca,_0xbc71('0xf2'),_0x409e68[_0xbc71('0x12')][_0xce2eca[_0xbc71('0x47')]]));_0x308776(ut[_0xbc71('0x38')](_0xbc71('0xf3')));})[_0xbc71('0x51')](function(_0x57fc19){ut['logger'](_0xbc71('0xf4'),_0x57fc19);_0x2ae8fc(ut[_0xbc71('0x38')](_0xbc71('0xf5'),_0x268317,_0x1f9c51));});}else{_0x5274bf[_0xbc71('0xf6')]+=0x1;ut[_0xbc71('0xf7')](_0xce2eca);rpcDb[_0xbc71('0xf8')](_0xce2eca,_0xbc71('0xf9'));delete _0x409e68[_0xbc71('0x46')][_0x446635];_0x2ae8fc(ut[_0xbc71('0x38')](_0xbc71('0xfa'),_0x268317,_0x1f9c51));}});};Preview[_0xbc71('0xd')][_0xbc71('0x73')]=function(_0x90d6d){return!_[_0xbc71('0x45')](_0x90d6d)&&!_['isNil'](_0x90d6d[_0xbc71('0x36')])&&!_[_0xbc71('0x45')](_0x90d6d['active'])&&_0x90d6d[_0xbc71('0xfb')]&&!_[_0xbc71('0x45')](this['trunks'][util[_0xbc71('0x29')](_0xbc71('0xfc'),_0x90d6d['name'])])&&!_[_0xbc71('0x45')](this['trunks'][util[_0xbc71('0x29')]('SIP/%s',_0x90d6d[_0xbc71('0x36')])]['status'])&&(this[_0xbc71('0x14')][util[_0xbc71('0x29')](_0xbc71('0xfc'),_0x90d6d[_0xbc71('0x36')])][_0xbc71('0x4f')]===_0xbc71('0xfd')||this[_0xbc71('0x14')][util[_0xbc71('0x29')](_0xbc71('0xfc'),_0x90d6d['name'])][_0xbc71('0x4f')]===_0xbc71('0xfe'));};Preview['prototype'][_0xbc71('0x62')]=function(_0x29433e,_0x41904c){return this[_0xbc71('0xff')](_0x29433e,_0x41904c)[_0xbc71('0x83')](function(_0x5d9f4d){return _[_0xbc71('0x100')](_0x5d9f4d,[_0xbc71('0x38')]);})['catch'](function(_0x4a159b){if(_0x4a159b[_0xbc71('0x101')]){rpcDb[_0xbc71('0x102')](_0x29433e);}if(_0x4a159b[_0xbc71('0xfb')]){rpcDb['disableContact'](_0x29433e);}throw _['pick'](_0x4a159b,['message']);});};Preview['prototype'][_0xbc71('0xff')]=function(_0x48db2b,_0x449f87){var _0x5f107a=this;var _0x35d47d,_0x4286ce;return rpcDb['getContactPreview'](_0x48db2b)[_0xbc71('0x83')](function(_0x1d2e5e){if(!_['isNil'](_0x1d2e5e[0x0])){_0x4286ce=_0x1d2e5e[0x0]['recallme']?![]:!![];_0x35d47d=_0x1d2e5e[0x0][_0xbc71('0x103')]?!![]:![];_0x35d47d=_0x449f87?!![]:_0x35d47d;}var _0x5f3d34=_0x5f107a['validateContact'](_0x1d2e5e);if(_0x5f3d34[_0xbc71('0x104')]){rpcDb[_0xbc71('0x105')](_[_0xbc71('0x100')](_0x1d2e5e[0x0],['VoiceQueueId',_0xbc71('0xec')]))['then'](function(_0x10e2cb){_0x5f107a[_0xbc71('0xea')](_0x10e2cb,_0x1d2e5e[0x0],_0x449f87,_0x4286ce,_0x35d47d)[_0xbc71('0x83')](function(_0x40daf9){return _0x40daf9;})[_0xbc71('0x51')](function(_0xd1c47e){throw _0xd1c47e;});})[_0xbc71('0x51')](function(_0x314884){ut[_0xbc71('0x34')](_0xbc71('0x106'),_0x314884);throw ut[_0xbc71('0x38')]('Call\x20unsuccessful',_0x4286ce,_0x35d47d);});}else{throw ut['message'](_0x5f3d34['message'],_0x4286ce,_0x35d47d);}})['catch'](function(_0x19641c){ut[_0xbc71('0x34')](_0xbc71('0x107'),_0x19641c);throw ut[_0xbc71('0x38')](_0xbc71('0x108'),![],!![]);});};Preview[_0xbc71('0xd')]['validateContact']=function(_0x3b61e8){if(_[_0xbc71('0x45')](_0x3b61e8)||_[_0xbc71('0x109')](_0x3b61e8)||!_[_0xbc71('0x45')](_0x3b61e8[0x0]['Agent'])&&_[_0xbc71('0x45')](_0x3b61e8[0x0]['Agent']['name'])){ut['logger'](_0xbc71('0x10a'),_0x3b61e8);return{'isValid':![],'message':_0xbc71('0x10b')};}var _0x43960e=this['campaignsPreview'][_0x3b61e8[0x0][_0xbc71('0x10c')][_0xbc71('0x36')]];_0x43960e[_0xbc71('0x38')]=utils['CAMPAIGN_STATUS']['ACTIVE'];if(_[_0xbc71('0x45')](_0x43960e)){ut['logger'](_0xbc71('0x10d'),_0x43960e);return{'isValid':![],'message':_0xbc71('0x10e')};}if(!this['isTrunkReachable'](_0x43960e[_0xbc71('0x74')])){ut[_0xbc71('0x34')](_0xbc71('0x10f'),_0xbc71('0x110')+_0x43960e[_0xbc71('0x36')]+'\x20Trunk\x20is\x20not\x20active');if(!this[_0xbc71('0x73')](_0x43960e['TrunkBackup'])){ut[_0xbc71('0x34')](_0xbc71('0x10f'),_0x43960e[_0xbc71('0x36')]+_0xbc71('0x111'));return{'isValid':![],'message':_0xbc71('0x112')};}}if(!ut[_0xbc71('0x113')](_0x43960e['dialActive'])){ut[_0xbc71('0x34')](_0xbc71('0x114'),_0x43960e[_0xbc71('0x36')]+_0xbc71('0x115'));return{'isValid':![],'message':_0xbc71('0x110')+_0x43960e[_0xbc71('0x36')]+_0xbc71('0x115')};}return{'isValid':!![],'message':_0xbc71('0x116')};};Preview[_0xbc71('0xd')][_0xbc71('0xee')]=function(_0x9dd522,_0x4dae31,_0x118fae,_0x51026e){var _0x5c27d8=this;return new Promise(function(_0x296434,_0x4d8fb5){var _0x3bab69=_0x9dd522[_0xbc71('0x96')];var _0x5e606a=_0x5c27d8['isTrunkReachable'](_0x4dae31[_0xbc71('0x74')])?util['format'](_0xbc71('0x117'),_0x4dae31[_0xbc71('0x74')][_0xbc71('0x36')],_[_0xbc71('0x45')](_0x4dae31[_0xbc71('0x118')])?'':_0x4dae31[_0xbc71('0x118')][_0xbc71('0x119')]()||'',_0x4dae31['dialCutDigit']>0x0?_0x118fae[_0xbc71('0xec')][_0xbc71('0x11a')](_0x4dae31[_0xbc71('0x11b')]):_0x118fae[_0xbc71('0xec')]):util[_0xbc71('0x29')](_0xbc71('0x117'),_['isNil'](_0x4dae31[_0xbc71('0x75')])?_0x4dae31['Trunk'][_0xbc71('0x36')]:_0x4dae31[_0xbc71('0x75')][_0xbc71('0x36')],_['isNil'](_0x4dae31[_0xbc71('0x118')])?'':_0x4dae31['dialPrefix']['trim']()||'',_0x4dae31[_0xbc71('0x11b')]>0x0?_0x118fae[_0xbc71('0xec')][_0xbc71('0x11a')](_0x4dae31[_0xbc71('0x11b')]):_0x118fae['phone']);var _0x5ce1cb=_0x5c27d8['isTrunkReachable'](_0x4dae31[_0xbc71('0x74')])?ut[_0xbc71('0x11c')](_0x4dae31[_0xbc71('0x74')]['callerid'],_0x4dae31[_0xbc71('0x11d')],_0x4dae31[_0xbc71('0x11e')]>0x0?ut['getCallerIdRandom'](_0x4dae31[_0xbc71('0x11f')],_0x4dae31[_0xbc71('0x11e')]):_0x4dae31['dialOriginateCallerIdNumber']):ut[_0xbc71('0x11c')](_[_0xbc71('0x45')](_0x4dae31[_0xbc71('0x75')])?_0x4dae31[_0xbc71('0x74')]['callerid']:_0x4dae31[_0xbc71('0x75')][_0xbc71('0x120')],_0x4dae31[_0xbc71('0x11d')],_0x4dae31[_0xbc71('0x11e')]>0x0?ut[_0xbc71('0x121')](_0x4dae31[_0xbc71('0x11f')],_0x4dae31[_0xbc71('0x11e')]):_0x4dae31[_0xbc71('0x11f')]);if(_0x5ce1cb){_0x9dd522['originatecalleridname']=ut['extractCalleridName'](_0x5ce1cb);_0x9dd522[_0xbc71('0x122')]=ut[_0xbc71('0x123')](_0x5ce1cb);}var _0x327ebc=ut['addVariables'](_0x4dae31,_0x118fae,_0x5e606a,_0x5ce1cb,_0x3bab69,_0x9dd522);var _0x4e69a9=utils[_0xbc71('0x124')](_0x118fae[_0xbc71('0xeb')]);Object[_0xbc71('0x125')](_0x327ebc,_0x4e69a9);_[_0xbc71('0x126')](_0x9dd522,ut[_0xbc71('0x127')](_0x327ebc));_0x9dd522[_0xbc71('0x65')]=moment()[_0xbc71('0x29')](_0xbc71('0x66'));_0x4dae31[_0xbc71('0x128')]=_0x327ebc;var _0x38f932=ut['variablesAction'](_0x9dd522,_0x4dae31,_0x327ebc,_0x9dd522[_0xbc71('0x8e')],_0x51026e);return ami[_0xbc71('0x4e')](_0x38f932)['then'](function(_0x3aa7e1){_0x4dae31[_0xbc71('0x2e')]+=0x1;logger['info']('[originated][increment]',_0x3bab69,_0xbc71('0xa5'),_0x4dae31[_0xbc71('0x36')],_0xbc71('0x48'),_0x4dae31[_0xbc71('0x2e')]);_0x296434(_0x3aa7e1);})[_0xbc71('0x51')](function(_0x5923d3){ut['logAgent'](_0x9dd522,0xe,_0xbc71('0x129'));rpcDb[_0xbc71('0xe0')](_0x9dd522,'[originateFailure][logOriginateFailure]');_0x4d8fb5(_0x5923d3);});});};Preview[_0xbc71('0xd')][_0xbc71('0x12a')]=function(_0x3df9a){if(this['actions'][_0x3df9a['linkedid']]){this['actions'][_0x3df9a['linkedid']][_0xbc71('0x50')]=_0x3df9a[_0xbc71('0x50')];}};Preview[_0xbc71('0xd')][_0xbc71('0x18')]=function(_0x54c906){var _0x8cd55e=this;var _0x4190d8=this['actions'][_0x54c906['actionid']];if(_0x4190d8){if(_0x4190d8['lookAgent']&&this[_0xbc71('0x15')][_0x4190d8[_0xbc71('0x12b')]]){ut[_0xbc71('0x12c')](_0x4190d8,this[_0xbc71('0x15')][_0x4190d8['lookAgent']][_0xbc71('0x36')],this[_0xbc71('0x15')][_0x4190d8['lookAgent']]['id']);}var _0x1bc37b=_[_0xbc71('0x12d')](_0x4190d8);_0x1bc37b[_0xbc71('0x94')]=moment()[_0xbc71('0x29')]('YYYY-MM-DD\x20HH:mm:ss');var _0xf5c52=_0x8cd55e['campaignsPreview'][_0x4190d8[_0xbc71('0x47')]];if(ut[_0xbc71('0x12e')](_0x54c906[_0xbc71('0x12f')])){if(_0x4190d8['unlockAgent']){rpcDb[_0xbc71('0x102')](_0x4190d8[_0xbc71('0x90')]);}if(_0x4190d8['activeContact']){rpcDb['disableContact'](_0x4190d8[_0xbc71('0x90')]);}ami[_0xbc71('0x25')](_0xbc71('0x130'),ut[_0xbc71('0x80')](_0x4190d8,_0xbc71('0x131'),this[_0xbc71('0x12')][_0x4190d8[_0xbc71('0x47')]]));this[_0xbc71('0xdb')](_0x1bc37b,_0xf5c52,_0x54c906);}else{_0x4190d8['starttime']=moment()[_0xbc71('0x29')](_0xbc71('0x66'));ut[_0xbc71('0xdf')](_0x1bc37b,0x4,_0xbc71('0x9f'));rpcDb[_0xbc71('0xe0')](_0x1bc37b,_0xbc71('0x132'));}}};Preview[_0xbc71('0xd')][_0xbc71('0x1b')]=function(_0x5a7758){var _0x5d9e15=this['actions'][_0x5a7758[_0xbc71('0xa6')]];var _0x38f473;if(_0x5d9e15){_0x38f473=this[_0xbc71('0x12')][_0x5d9e15[_0xbc71('0x47')]];logger[_0xbc71('0x26')](_0xbc71('0x133'),_0x5a7758[_0xbc71('0xa6')],_0xbc71('0xa5'),_0x38f473[_0xbc71('0x36')],_0xbc71('0x49'),_0x38f473[_0xbc71('0x2f')]);}if(this[_0xbc71('0x46')][_0x5a7758[_0xbc71('0xa6')]]&&_0x5a7758[_0xbc71('0xa6')]!==_0x5a7758[_0xbc71('0x96')]){if(_0x5a7758[_0xbc71('0x134')]==='16'&&this[_0xbc71('0x46')][_0x5a7758[_0xbc71('0xa6')]][_0xbc71('0x53')]){this['callProgressDetectingCustomer'](_0x5a7758,_0x5a7758['linkedid'],_0x5a7758[_0xbc71('0x134')]);}else if(this[_0xbc71('0x46')][_0x5a7758[_0xbc71('0xa6')]][_0xbc71('0x53')]){logger['info'](_0xbc71('0x135'),_0x5a7758[_0xbc71('0xa6')],_0x5a7758[_0xbc71('0x134')],_0xbc71('0xa5'),_0x38f473[_0xbc71('0x36')],_0xbc71('0x49'),_0x38f473[_0xbc71('0x2f')]);this[_0xbc71('0x78')](_0x5a7758,_0x5a7758[_0xbc71('0xa6')],_0x5a7758[_0xbc71('0x134')]);}}else if(_0x5d9e15&&_[_0xbc71('0x45')](_0x5d9e15[_0xbc71('0x136')])&&_0x38f473[_0xbc71('0x137')]&&_0x5a7758['linkedid']===_0x5a7758[_0xbc71('0x96')]&&_[_0xbc71('0x45')](_0x5a7758[_0xbc71('0xde')])&&_0x5a7758['cause']==='16'&&_0x5a7758[_0xbc71('0x138')]==='6'&&_[_0xbc71('0xdc')](_0x5d9e15[_0xbc71('0x139')])){if(_0x5d9e15['unlockAgent']){rpcDb[_0xbc71('0x102')](_0x5d9e15[_0xbc71('0x90')]);}if(_0x5d9e15[_0xbc71('0x8e')]){rpcDb[_0xbc71('0x13a')](_0x5d9e15[_0xbc71('0x90')]);}_0x5a7758[_0xbc71('0xde')]='22';this[_0xbc71('0xdb')](_0x5d9e15,_0x38f473,_0x5a7758);}else if(_0x5d9e15&&_0x5d9e15[_0xbc71('0x139')]){if(_0x5a7758[_0xbc71('0x134')]==='16'&&this[_0xbc71('0x46')][_0x5a7758[_0xbc71('0xa6')]]['dialAnswer']){logger['info']('[syncHangup][talking][transfer]',_0x5a7758[_0xbc71('0xa6')],_0x5a7758[_0xbc71('0x134')],_0xbc71('0xa5'),_0x38f473['name'],'pTalking:\x20',_0x38f473[_0xbc71('0x2f')]);this[_0xbc71('0x78')](_0x5a7758,_0x5a7758[_0xbc71('0xa6')],_0x5a7758[_0xbc71('0x134')]);}else if(this[_0xbc71('0x46')][_0x5a7758['linkedid']][_0xbc71('0x53')]){logger[_0xbc71('0x26')]('[syncHangup][talking][cause]',_0x5a7758[_0xbc71('0xa6')],_0x5a7758[_0xbc71('0x134')],_0xbc71('0xa5'),_0x38f473[_0xbc71('0x36')],_0xbc71('0x49'),_0x38f473[_0xbc71('0x2f')]);this['callProgressDetectingCustomer'](_0x5a7758,_0x5a7758['linkedid'],_0x5a7758[_0xbc71('0x134')]);}}};Preview[_0xbc71('0xd')]['syncDialEnd']=function(_0xd29273){if(this[_0xbc71('0x46')][_0xd29273[_0xbc71('0xd9')]]&&_0xd29273[_0xbc71('0xd9')]!==_0xd29273[_0xbc71('0x13b')]){this['callProgressDetectingCustomer'](_0xd29273,_0xd29273[_0xbc71('0xd9')],_0xd29273[_0xbc71('0xcf')]);}};Preview[_0xbc71('0xd')][_0xbc71('0x1d')]=function(_0x1afa88){if(this['actions'][_0x1afa88[_0xbc71('0xa6')]]&&_0x1afa88[_0xbc71('0xa6')]!==_0x1afa88[_0xbc71('0x96')]&&!this['actions'][_0x1afa88[_0xbc71('0xa6')]]['dialAnswer']){if(_0x1afa88[_0xbc71('0x134')]==='1'){this[_0xbc71('0x78')](_0x1afa88,_0x1afa88['linkedid'],_0x1afa88[_0xbc71('0x134')]);}}};Preview[_0xbc71('0xd')]['addVariable']=function(_0x44739a,_0x11bb46,_0xc727eb){if(this[_0xbc71('0x46')][_0x44739a]){if(_[_0xbc71('0x45')](this[_0xbc71('0x46')][_0x44739a]['variables'])){this[_0xbc71('0x46')][_0x44739a]['variables']={};}this['actions'][_0x44739a]['variables'][_0x11bb46]=_0xc727eb;}};Preview['prototype'][_0xbc71('0x22')]=function(_0x2dac44){try{if(!_['isNil'](_0x2dac44)){if(ut['filterKey'](_[_0xbc71('0x13c')](_0x2dac44['variable'])[0x0])){this['addVariable'](_0x2dac44[_0xbc71('0x96')],_[_0xbc71('0x13c')](_0x2dac44[_0xbc71('0x13d')])[0x0],_0x2dac44[_0xbc71('0x13e')]);}}}catch(_0x5b0e25){logger[_0xbc71('0x13f')]('[syncVarSet][Preview]',util['inspect'](_0x5b0e25,{'showHidden':![],'depth':null}));}};Preview['prototype'][_0xbc71('0x24')]=function(_0x5bd558){if(_0x5bd558){if(this[_0xbc71('0x46')][_0x5bd558[_0xbc71('0x140')]]){this[_0xbc71('0x46')][_0x5bd558[_0xbc71('0x140')]]['transfer']=!![];}}};Preview[_0xbc71('0xd')]['syncBlindTransfer']=function(_0x257ddc){if(_0x257ddc){if(this[_0xbc71('0x46')][_0x257ddc[_0xbc71('0x141')]]){this[_0xbc71('0x46')][_0x257ddc[_0xbc71('0x141')]][_0xbc71('0x139')]=!![];}}};module[_0xbc71('0x142')]=Preview; \ No newline at end of file diff --git a/server/services/ami/preview/rpcDb.js b/server/services/ami/preview/rpcDb.js index 82a383d..34e7f0e 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 _0x5aa1=['../rpc/agentReportPreview','../rpc/voiceQueueReport','error','inspect','createHistory','catch','[createHistory]\x20','resolve','then','moveContactManagedDialer','checkIsBlackList','[checkIsBlackList]\x20','getContactPreview','createAgentHistory','createCustomerHistory','createCustomerFinal','rescheduleContact','UserId','active','countReScheduled','[countReScheduled]\x20','unlockContact','crateCustomerReportQueue','type','uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','queuecallerleaveAt','answertime','queuecallercomplete','queuecallercompleteAt','endtime','connectedlinename','membername','context','from-sip','exten','xcally-motion-preview','assigned','lastAssignedTo','COMPLETED','create','[voiceQueueReport]\x20','getContactRecallMe','[GetContactRecallMe]\x20','rescheduleContactInQueue','[rescheduleContactInQueue]\x20','util','preview','../rpc/cmHopper','../rpc/cmHopperHistory'];(function(_0x821e12,_0x464e62){var _0x162c6d=function(_0x1f2970){while(--_0x1f2970){_0x821e12['push'](_0x821e12['shift']());}};_0x162c6d(++_0x464e62);}(_0x5aa1,0x16f));var _0x15aa=function(_0x1b6c96,_0x30bd30){_0x1b6c96=_0x1b6c96-0x0;var _0x80e240=_0x5aa1[_0x1b6c96];return _0x80e240;};'use strict';var util=require(_0x15aa('0x0'));var BPromise=require('bluebird');var logger=require('../../../config/logger')(_0x15aa('0x1'));var cmHopper=require(_0x15aa('0x2'));var cmHopperHistory=require(_0x15aa('0x3'));var cmHopperBlack=require('../rpc/cmHopperBlack');var agentReportPreview=require(_0x15aa('0x4'));var voiceQueueReport=require(_0x15aa('0x5'));function loggerCatch(_0x1c101d){return function(_0x47c8bd){logger[_0x15aa('0x6')](_0x1c101d,util[_0x15aa('0x7')](_0x47c8bd,{'showHidden':![],'depth':null}));};}function create(_0x28d76f){return cmHopperHistory[_0x15aa('0x8')](_0x28d76f)[_0x15aa('0x9')](loggerCatch(_0x15aa('0xa')));}function createAgent(_0x3583c4){return BPromise[_0x15aa('0xb')]()[_0x15aa('0xc')](agentReportPreview[_0x15aa('0x8')](_0x3583c4))[_0x15aa('0x9')](loggerCatch(_0x15aa('0xa')));}function moveContact(_0x16e9ab){return cmHopper[_0x15aa('0xd')](_0x16e9ab,!![])['catch'](loggerCatch('[moveContactManagedDialer]\x20'));}exports['checkIsBlackList']=function(_0x48e33f){return cmHopperBlack[_0x15aa('0xe')](_0x48e33f)[_0x15aa('0x9')](loggerCatch(_0x15aa('0xf')));};exports['getContactPreview']=function(_0x34ae45){return BPromise[_0x15aa('0xb')]()['then'](cmHopper[_0x15aa('0x10')](_0x34ae45))[_0x15aa('0x9')](loggerCatch('[getContactPreview]\x20'));};exports['createHistory']=function(_0x469ff3,_0x23202f){create(_0x469ff3)[_0x15aa('0x9')](loggerCatch(_0x23202f));moveContact(_0x469ff3)[_0x15aa('0x9')](loggerCatch(_0x23202f));};exports[_0x15aa('0x11')]=function(_0x313e55,_0x7f2dfb){createAgent(_0x313e55)[_0x15aa('0x9')](loggerCatch(_0x7f2dfb));};exports[_0x15aa('0x12')]=function(_0x5f2b35,_0x2f066c){create(_0x5f2b35)[_0x15aa('0x9')](loggerCatch(_0x2f066c));};exports[_0x15aa('0x13')]=function(_0x3c63a3,_0x48e41f){moveContact(_0x3c63a3)['catch'](loggerCatch(_0x48e41f));};exports[_0x15aa('0x14')]=function(_0x4625b5,_0xcd6794,_0xd78f7f){if(_0xcd6794){_0x4625b5[_0x15aa('0x15')]=null;}if(_0xd78f7f){_0x4625b5[_0x15aa('0x16')]=![];}return cmHopper['rescheduleContact'](_0x4625b5)[_0x15aa('0x9')](loggerCatch('[rescheduleContact]\x20'));};exports[_0x15aa('0x17')]=function(_0x32740e){return cmHopper['countReScheduled'](_0x32740e)[_0x15aa('0x9')](loggerCatch(_0x15aa('0x18')));};exports[_0x15aa('0x19')]=function(_0x3029c5){return cmHopper['unlockContact']({'UserId':null},_0x3029c5,0x1)[_0x15aa('0x9')](loggerCatch('[unlockContact]\x20'));};exports['disableContact']=function(_0x16f5ae){return cmHopper['unlockContact']({'active':![]},_0x16f5ae,0x1)[_0x15aa('0x9')](loggerCatch('[activeContact]\x20'));};exports[_0x15aa('0x1a')]=function(_0x1defe8){var _0xae4222={};_0xae4222[_0x15aa('0x1b')]=_0x1defe8['type'];_0xae4222['uniqueid']=_0x1defe8[_0x15aa('0x1c')];_0xae4222[_0x15aa('0x1d')]=_0x1defe8[_0x15aa('0x1d')];_0xae4222[_0x15aa('0x1e')]=_0x1defe8[_0x15aa('0x1e')];_0xae4222[_0x15aa('0x1f')]=_0x1defe8[_0x15aa('0x1f')];_0xae4222[_0x15aa('0x20')]=_0x1defe8['answertime'];_0xae4222[_0x15aa('0x21')]=_0x1defe8[_0x15aa('0x22')];_0xae4222[_0x15aa('0x23')]=0x1;_0xae4222[_0x15aa('0x24')]=_0x1defe8[_0x15aa('0x25')];_0xae4222[_0x15aa('0x26')]=_0x1defe8[_0x15aa('0x27')];_0xae4222[_0x15aa('0x28')]=_0x15aa('0x29');_0xae4222[_0x15aa('0x2a')]=_0x15aa('0x2b');_0xae4222['holdtime']=0x0;_0xae4222[_0x15aa('0x2c')]=0x1;_0xae4222[_0x15aa('0x2d')]=_0x1defe8['membername'];_0xae4222['queuecallerexitreason']=_0x15aa('0x2e');return BPromise['resolve']()[_0x15aa('0xc')](voiceQueueReport[_0x15aa('0x2f')](_0xae4222))[_0x15aa('0x9')](loggerCatch(_0x15aa('0x30')));};exports[_0x15aa('0x31')]=function(_0x1b8666,_0x2eea60){return BPromise[_0x15aa('0xb')]()[_0x15aa('0xc')](cmHopper[_0x15aa('0x31')](_0x1b8666,_0x2eea60))[_0x15aa('0x9')](loggerCatch(_0x15aa('0x32')));};exports[_0x15aa('0x33')]=function(_0x4f9631){return cmHopper[_0x15aa('0x14')](_0x4f9631,!![],!![])[_0x15aa('0x9')](loggerCatch(_0x15aa('0x34')));}; \ No newline at end of file +var _0xf9f4=['checkIsBlackList','[checkIsBlackList]\x20','getContactPreview','[getContactPreview]\x20','createAgentHistory','createCustomerFinal','rescheduleContact','countReScheduled','[countReScheduled]\x20','unlockContact','[unlockContact]\x20','[activeContact]\x20','crateCustomerReportQueue','type','uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','answertime','queuecallerleaveAt','queuecallercomplete','queuecallercompleteAt','endtime','connectedlinename','membername','from-sip','exten','holdtime','assigned','queuecallerexitreason','create','getContactRecallMe','[GetContactRecallMe]\x20','rescheduleContactInQueue','../../../config/logger','../rpc/cmHopper','../rpc/cmHopperBlack','../rpc/agentReportPreview','../rpc/voiceQueueReport','error','inspect','createHistory','catch','resolve','then','moveContactManagedDialer','[moveContactManagedDialer]\x20'];(function(_0x55677b,_0x3e5655){var _0x104b88=function(_0x78d34f){while(--_0x78d34f){_0x55677b['push'](_0x55677b['shift']());}};_0x104b88(++_0x3e5655);}(_0xf9f4,0x173));var _0x4f9f=function(_0x4e7473,_0x33f381){_0x4e7473=_0x4e7473-0x0;var _0x5a155b=_0xf9f4[_0x4e7473];return _0x5a155b;};'use strict';var util=require('util');var BPromise=require('bluebird');var logger=require(_0x4f9f('0x0'))('preview');var cmHopper=require(_0x4f9f('0x1'));var cmHopperHistory=require('../rpc/cmHopperHistory');var cmHopperBlack=require(_0x4f9f('0x2'));var agentReportPreview=require(_0x4f9f('0x3'));var voiceQueueReport=require(_0x4f9f('0x4'));function loggerCatch(_0x2bba94){return function(_0x325856){logger[_0x4f9f('0x5')](_0x2bba94,util[_0x4f9f('0x6')](_0x325856,{'showHidden':![],'depth':null}));};}function create(_0x4f21a4){return cmHopperHistory[_0x4f9f('0x7')](_0x4f21a4)[_0x4f9f('0x8')](loggerCatch('[createHistory]\x20'));}function createAgent(_0x39ea07){return BPromise[_0x4f9f('0x9')]()[_0x4f9f('0xa')](agentReportPreview[_0x4f9f('0x7')](_0x39ea07))[_0x4f9f('0x8')](loggerCatch('[createHistory]\x20'));}function moveContact(_0x52e76c){return cmHopper[_0x4f9f('0xb')](_0x52e76c,!![])['catch'](loggerCatch(_0x4f9f('0xc')));}exports['checkIsBlackList']=function(_0x2f3b5a){return cmHopperBlack[_0x4f9f('0xd')](_0x2f3b5a)[_0x4f9f('0x8')](loggerCatch(_0x4f9f('0xe')));};exports[_0x4f9f('0xf')]=function(_0x35a3c5){return BPromise[_0x4f9f('0x9')]()['then'](cmHopper[_0x4f9f('0xf')](_0x35a3c5))[_0x4f9f('0x8')](loggerCatch(_0x4f9f('0x10')));};exports['createHistory']=function(_0x2d0c3c,_0x19b7b6){create(_0x2d0c3c)[_0x4f9f('0x8')](loggerCatch(_0x19b7b6));moveContact(_0x2d0c3c)['catch'](loggerCatch(_0x19b7b6));};exports[_0x4f9f('0x11')]=function(_0x4ad03e,_0x357e94){createAgent(_0x4ad03e)['catch'](loggerCatch(_0x357e94));};exports['createCustomerHistory']=function(_0x20d2d7,_0x481277){create(_0x20d2d7)[_0x4f9f('0x8')](loggerCatch(_0x481277));};exports[_0x4f9f('0x12')]=function(_0x300344,_0x2b0d0b){moveContact(_0x300344)['catch'](loggerCatch(_0x2b0d0b));};exports[_0x4f9f('0x13')]=function(_0x544958,_0xeb23da,_0x1b8d62){if(_0xeb23da){_0x544958['UserId']=null;}if(_0x1b8d62){_0x544958['active']=![];}return cmHopper[_0x4f9f('0x13')](_0x544958)[_0x4f9f('0x8')](loggerCatch('[rescheduleContact]\x20'));};exports[_0x4f9f('0x14')]=function(_0x1ba25e){return cmHopper[_0x4f9f('0x14')](_0x1ba25e)[_0x4f9f('0x8')](loggerCatch(_0x4f9f('0x15')));};exports[_0x4f9f('0x16')]=function(_0x38578c){return cmHopper['unlockContact']({'UserId':null},_0x38578c,0x1)[_0x4f9f('0x8')](loggerCatch(_0x4f9f('0x17')));};exports['disableContact']=function(_0x330a40){return cmHopper[_0x4f9f('0x16')]({'active':![]},_0x330a40,0x1)[_0x4f9f('0x8')](loggerCatch(_0x4f9f('0x18')));};exports[_0x4f9f('0x19')]=function(_0x130aa9){var _0x22b552={};_0x22b552[_0x4f9f('0x1a')]=_0x130aa9[_0x4f9f('0x1a')];_0x22b552[_0x4f9f('0x1b')]=_0x130aa9[_0x4f9f('0x1b')];_0x22b552['calleridnum']=_0x130aa9[_0x4f9f('0x1c')];_0x22b552[_0x4f9f('0x1d')]=_0x130aa9['calleridname'];_0x22b552[_0x4f9f('0x1e')]=_0x130aa9[_0x4f9f('0x1e')];_0x22b552[_0x4f9f('0x1f')]=_0x130aa9[_0x4f9f('0x20')];_0x22b552[_0x4f9f('0x21')]=_0x130aa9['answertime'];_0x22b552[_0x4f9f('0x22')]=0x1;_0x22b552[_0x4f9f('0x23')]=_0x130aa9[_0x4f9f('0x24')];_0x22b552[_0x4f9f('0x25')]=_0x130aa9[_0x4f9f('0x26')];_0x22b552['context']=_0x4f9f('0x27');_0x22b552[_0x4f9f('0x28')]='xcally-motion-preview';_0x22b552[_0x4f9f('0x29')]=0x0;_0x22b552[_0x4f9f('0x2a')]=0x1;_0x22b552['lastAssignedTo']=_0x130aa9['membername'];_0x22b552[_0x4f9f('0x2b')]='COMPLETED';return BPromise[_0x4f9f('0x9')]()['then'](voiceQueueReport[_0x4f9f('0x2c')](_0x22b552))[_0x4f9f('0x8')](loggerCatch('[voiceQueueReport]\x20'));};exports[_0x4f9f('0x2d')]=function(_0x1b367a,_0x2cbe70){return BPromise['resolve']()[_0x4f9f('0xa')](cmHopper[_0x4f9f('0x2d')](_0x1b367a,_0x2cbe70))['catch'](loggerCatch(_0x4f9f('0x2e')));};exports[_0x4f9f('0x2f')]=function(_0x208d0a){return cmHopper[_0x4f9f('0x13')](_0x208d0a,!![],!![])[_0x4f9f('0x8')](loggerCatch('[rescheduleContactInQueue]\x20'));}; \ No newline at end of file diff --git a/server/services/ami/preview/util/util.js b/server/services/ami/preview/util/util.js index 77c7b5b..45efc5f 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 _0x8d52=['RECALL','BOOKED','uniqueid','originate','channelAgent','from-sip','timeout','totalGlobal','countbusyretry','countcongestionretry','countnoanswerretry','countagentrejectretry','countnosuchnumberretry','clone','Global','scheduledAt','scheduledat','add','minutes','ListId','decrementTalkink','pTalking','[decrementTalkink]\x20object\x20talking\x20is\x20negative','[decrementTalkink]\x20is\x20null\x20or\x20undefined','IsNotLoggedIn','lastevent','queue','interface','motionChannel','voice','mandatoryDisposition','buildObj','buildAcw','agentReadyId','not_inuse','status','reachable','push','getDiff','milliseconds','diff','createBody','CampaignId','type','campaigntype','dialAnswer','active','countglobal','callback','callbackat','recallme','UserId','sipcallid','xmd-voicequeueid','xmd-phone','xmd-listid','xmd-dialurl','xmd-dialoptions','xmd-dialid','xmd-contactid','xmd-cdrtype','xmd-callerid','rtpaudioqos','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqosrttbridged','rtpaudioqoslossbridged','rtpaudioqosrtt','bridgepeer','getCallerIdRandom','\x5cw{0,','replace','random','extractCalleridName','extractCalleridNumber','match','noanswer','variables','keys','forEach','buildNoAnswerEventPayload','util','lodash','moment','../../../../config/logger','preview','env','XCALLY_IP_AGI','127.0.0.1','../../dialer/utils','loggerCatch','inspect','logger','info','loggerError','error','logger2','message','getCallerId','isUndefined','string','isEmpty','format','\x22%s\x22\x20<%s>','isActive','isNil','addVariables','Queue','name','calleridname','calleridnum','ContactId','dialer','VoiceQueueId','dialOriginateTimeout','\x22rtTxX%s%s\x22','dialQueueProject2','monitor_format','U(xcally-mixmonitor-context)','dialPreviewUrl','dialQueueProject','NONE','\x22agi://%s/square,%s\x22','originatecalleridnum','originatecalleridname','xcally-motion-preview','Call-Type:\x20PREVIEW','toLowerVariables','hasOwnProperty','toLower','updateOriginated','originated','logBlacklist','state','statedesc','Blacklist','starttime','responsetime','logAgent','YYYY-MM-DD\x20HH:mm:ss','ringtime','getSeconds','membername','endtime','answertime','isFailure'];(function(_0x43b861,_0x5074ef){var _0xcd330=function(_0x484e3){while(--_0x484e3){_0x43b861['push'](_0x43b861['shift']());}};_0xcd330(++_0x5074ef);}(_0x8d52,0xe5));var _0x28d5=function(_0xc2e3bf,_0x1b0b7f){_0xc2e3bf=_0xc2e3bf-0x0;var _0x2a6b3f=_0x8d52[_0xc2e3bf];return _0x2a6b3f;};'use strict';var util=require(_0x28d5('0x0'));var _=require(_0x28d5('0x1'));var moment=require(_0x28d5('0x2'));var logger=require(_0x28d5('0x3'))(_0x28d5('0x4'));var ipAgi=process[_0x28d5('0x5')][_0x28d5('0x6')]||_0x28d5('0x7');var utils=require(_0x28d5('0x8'));exports[_0x28d5('0x9')]=function(_0x278ba7){return function(_0x43b39c){logger['error'](_0x278ba7,util[_0x28d5('0xa')](_0x43b39c,{'showHidden':![],'depth':null}));};};exports[_0x28d5('0xb')]=function(_0x3fd55c,_0x3734dd){logger[_0x28d5('0xc')](_0x3fd55c,util['inspect'](_0x3734dd,{'showHidden':![],'depth':null}));};exports[_0x28d5('0xd')]=function(_0xde47ff,_0x4bee44){logger[_0x28d5('0xe')](_0xde47ff,util[_0x28d5('0xa')](_0x4bee44,{'showHidden':![],'depth':null}));};exports[_0x28d5('0xf')]=function(_0x1462c9){return function(_0x63c32){logger[_0x28d5('0xc')](_0x1462c9,util['inspect'](_0x63c32,{'showHidden':![],'depth':null}));};};exports[_0x28d5('0x10')]=function(_0x179416,_0x115c1d,_0x1af68d){return{'message':_0x179416,'unlock':_0x115c1d,'active':_0x1af68d};};exports[_0x28d5('0x11')]=function(_0x53ec4e,_0x268919,_0x58d6b6){if(!_[_0x28d5('0x12')](_0x58d6b6)&&_0x28d5('0x13')===typeof _0x58d6b6&&!_[_0x28d5('0x14')](_0x58d6b6)){if(!_[_0x28d5('0x12')](_0x268919)&&_0x28d5('0x13')===typeof _0x268919&&!_[_0x28d5('0x14')](_0x268919)){return util[_0x28d5('0x15')](_0x28d5('0x16'),_0x268919,_0x58d6b6);}return util[_0x28d5('0x15')]('\x22%s\x22\x20<%s>',_0x58d6b6,_0x58d6b6);}if(!_[_0x28d5('0x12')](_0x53ec4e)&&_0x28d5('0x13')===typeof _0x53ec4e&&!_[_0x28d5('0x14')](_0x53ec4e)){return _0x53ec4e;}return'\x22\x22\x20<>';};exports[_0x28d5('0x17')]=function(_0x1fae1d){if(_[_0x28d5('0x18')](_0x1fae1d)){return![];}return _0x1fae1d;};exports[_0x28d5('0x19')]=function(_0x15714d,_0x32a735,_0x5e79ed,_0x503b90,_0x59d482,_0x41fa96){var _0x26185a={'XMD-QUEUE':_0x32a735[_0x28d5('0x1a')]?_0x32a735['Queue'][_0x28d5('0x1b')]:'','XMD-CALLERID':_0x503b90,'XMD-CALLERID-PREVIEW':_0x41fa96?util[_0x28d5('0x15')](_0x28d5('0x16'),_0x41fa96[_0x28d5('0x1c')],_0x41fa96[_0x28d5('0x1d')]):_0x503b90,'XMD-DIALID':_0x59d482,'XMD-CONTACTID':_0x32a735[_0x28d5('0x1e')],'XMD-CDRTYPE':_0x28d5('0x1f'),'CALLERID(all)':_0x503b90,'XMD-VOICEQUEUEID':_0x32a735[_0x28d5('0x20')],'XMD-DIALCHANNEL':_0x5e79ed,'XMD-DIALTIMEOUT':_0x15714d[_0x28d5('0x21')]||0x1e,'XMD-DIALOPTIONS':util[_0x28d5('0x15')](_0x28d5('0x22'),_0x15714d[_0x28d5('0x23')]?'g':'',_['isEmpty'](_0x15714d[_0x28d5('0x24')])?'':_0x28d5('0x25')),'XMD-DIALURL':_0x15714d[_0x28d5('0x26')]||'','XMD-AGI':_0x15714d[_0x28d5('0x27')]?util[_0x28d5('0x15')]('\x22agi://%s/square,%s\x22',ipAgi,_0x15714d[_0x28d5('0x27')]):_0x28d5('0x28'),'XMD-AGIAFTER':_0x15714d[_0x28d5('0x23')]?util['format'](_0x28d5('0x29'),ipAgi,_0x15714d[_0x28d5('0x23')]):_0x28d5('0x28'),'XMD-ORIGINATECALLERIDNUM':_0x41fa96?_0x41fa96[_0x28d5('0x2a')]:'','XMD-ORIGINATECALLERIDNAME':_0x41fa96?_0x41fa96[_0x28d5('0x2b')]:'','XMD-DESTINATION':_0x28d5('0x2c'),'SIPADDHEADER':_0x28d5('0x2d')};if(!_[_0x28d5('0x14')](_0x15714d[_0x28d5('0x24')])){_0x26185a[util['format']('%s','_XCALLY_MIXMONITOR_FORMAT')]=_0x15714d[_0x28d5('0x24')];_0x26185a[util[_0x28d5('0x15')]('%s','_XCALLY_MIXMONITOR_UNIQUEID')]=_0x59d482;}return _0x26185a;};exports[_0x28d5('0x2e')]=function(_0x3740c5){var _0x47840d={};for(var _0x27d4d7 in _0x3740c5){if(_0x3740c5[_0x28d5('0x2f')](_0x27d4d7)){_0x47840d[util[_0x28d5('0x15')]('%s',_[_0x28d5('0x30')](_0x27d4d7))]=_0x3740c5[_0x27d4d7];}}return{'variables':_0x47840d};};exports[_0x28d5('0x31')]=function(_0x259c48,_0x26b288){if(!_[_0x28d5('0x18')](_0x259c48)){if(_0x259c48['hasOwnProperty'](_0x28d5('0x32'))){if(_0x259c48['originated']>0x0){_0x259c48[_0x28d5('0x32')]-=0x1;}else{logger['error']('[updateOriginated]\x20object\x20originated\x20is\x20negative',_0x26b288);}}}else{logger[_0x28d5('0xe')]('[updateOriginated]\x20is\x20null\x20or\x20undefined',_0x26b288);}};exports[_0x28d5('0x33')]=function(_0x4d0044){var _0x534fdf=moment()[_0x28d5('0x15')]('YYYY-MM-DD\x20HH:mm:ss');_0x4d0044[_0x28d5('0x34')]=0xd;_0x4d0044[_0x28d5('0x35')]=_0x28d5('0x36');_0x4d0044[_0x28d5('0x37')]=_0x534fdf;_0x4d0044[_0x28d5('0x38')]=_0x534fdf;_0x4d0044['endtime']=_0x534fdf;};exports[_0x28d5('0x39')]=function(_0x349d79,_0x135366,_0x5373c8){var _0x17812f=moment()['format'](_0x28d5('0x3a'));_0x349d79[_0x28d5('0x34')]=_0x135366;_0x349d79[_0x28d5('0x35')]=_0x5373c8;_0x349d79[_0x28d5('0x38')]=_0x17812f;_0x349d79[_0x28d5('0x3b')]=utils[_0x28d5('0x3c')](_0x349d79[_0x28d5('0x38')],_0x349d79[_0x28d5('0x37')]);};exports['logLookAgent']=function(_0x53bc2a,_0xae740b,_0x20c738){_0x53bc2a[_0x28d5('0x3d')]=_0xae740b;_0x53bc2a['UserId']=_0x20c738;};exports['logCustomer']=function(_0x2e028e,_0x3adf13,_0xc8009b){var _0x4d2b9e=moment()[_0x28d5('0x15')]('YYYY-MM-DD\x20HH:mm:ss');_0x2e028e[_0x28d5('0x34')]=_0x3adf13;_0x2e028e[_0x28d5('0x35')]=_0xc8009b;_0x2e028e[_0x28d5('0x38')]=_0x2e028e[_0x28d5('0x38')]?_0x2e028e[_0x28d5('0x38')]:_0x4d2b9e;_0x2e028e[_0x28d5('0x3e')]=_0x2e028e[_0x28d5('0x3e')]?_0x2e028e[_0x28d5('0x3e')]:_0x4d2b9e;_0x2e028e['ringtime']=utils['getSeconds'](_0x2e028e[_0x28d5('0x38')]||0x0,_0x2e028e[_0x28d5('0x37')]||0x0);_0x2e028e['talktime']=_0x2e028e[_0x28d5('0x3f')]?utils[_0x28d5('0x3c')](_0x2e028e[_0x28d5('0x3e')],_0x2e028e[_0x28d5('0x3f')]):0x0;};exports[_0x28d5('0x40')]=function(_0x32d0b5){return _0x32d0b5==='Failure';};exports['variablesAction']=function(_0x5c9dab,_0x1e9748,_0x5dc029,_0x5d8f4c,_0x155c78){var _0x5111cf=_0x5d8f4c?_0x28d5('0x41'):_0x5c9dab[_0x28d5('0x1c')];_0x5111cf=_0x155c78?_0x28d5('0x42'):_0x5111cf;return{'actionid':_0x5c9dab[_0x28d5('0x43')],'action':_0x28d5('0x44'),'channel':_0x5c9dab[_0x28d5('0x45')],'callerid':util[_0x28d5('0x15')]('\x22%s\x22\x20<%s>',_0x5111cf,_0x5c9dab[_0x28d5('0x1d')]),'Exten':'xcally-motion-preview','Context':_0x28d5('0x46'),'Priority':'1','variable':_0x5dc029,'timeout':(_0x1e9748[_0x28d5('0x47')]||0x1e)*0x3e8,'async':!![],'channelid':_0x5c9dab[_0x28d5('0x43')]};};exports[_0x28d5('0x48')]=function(_0x4dcc9d){return _0x4dcc9d[_0x28d5('0x49')]+_0x4dcc9d[_0x28d5('0x4a')]+_0x4dcc9d[_0x28d5('0x4b')]+_0x4dcc9d[_0x28d5('0x4c')]+_0x4dcc9d[_0x28d5('0x4d')];};exports['cloneAction']=function(_0x5e9f79){var _0x3b8ae1=_[_0x28d5('0x4e')](_0x5e9f79);_0x3b8ae1[_0x28d5('0x34')]=0xf;_0x3b8ae1['statedesc']=_0x28d5('0x4f');return _0x3b8ae1;};exports[_0x28d5('0x50')]=function(_0xd5e090,_0x363c59,_0x170a6a){var _0x364a66={};_0x364a66[_0x363c59]=_0xd5e090[_0x363c59];_0x364a66['active']=![];_0x364a66[_0x28d5('0x51')]=moment()[_0x28d5('0x52')](_0x170a6a,_0x28d5('0x53'))[_0x28d5('0x15')]('YYYY-MM-DD\x20HH:mm:ss');_0x364a66[_0x28d5('0x1e')]=_0xd5e090[_0x28d5('0x1e')];_0x364a66[_0x28d5('0x54')]=_0xd5e090[_0x28d5('0x54')];_0x364a66[_0x28d5('0x20')]=_0xd5e090[_0x28d5('0x20')]||undefined;return _0x364a66;};exports[_0x28d5('0x55')]=function(_0x1460ce,_0xbf63f4){if(!_[_0x28d5('0x18')](_0x1460ce)){if(_0x1460ce[_0x28d5('0x56')]>0x0){_0x1460ce[_0x28d5('0x56')]-=0x1;}else{logger[_0x28d5('0xe')](_0xbf63f4,_0x28d5('0x57'));}}else{logger[_0x28d5('0xe')](_0xbf63f4,_0x28d5('0x58'));}};exports[_0x28d5('0x59')]=function(_0x28ca67){if(_0x28ca67<=0x0){return!![];}return![];};function buildObj(_0x1c4c22,_0x48b278,_0x1dc71d){_0x1c4c22[_0x28d5('0x5a')]=_0x48b278;_0x1c4c22[_0x28d5('0x1b')]=_0x1c4c22[_0x28d5('0x5b')];_0x1c4c22[_0x28d5('0x5c')]=_0x1c4c22['channelAgent'];_0x1c4c22[_0x28d5('0x5d')]=_0x28d5('0x5e');if(_0x1dc71d){_0x1c4c22[_0x28d5('0x5f')]=_0x1dc71d[_0x28d5('0x5f')];}return _0x1c4c22;}exports[_0x28d5('0x60')]=buildObj;exports[_0x28d5('0x61')]=function(_0x396b11){var _0x4f7138={};_0x4f7138[_0x28d5('0x5b')]=_0x396b11[_0x28d5('0x5b')];_0x4f7138[_0x28d5('0x5c')]=_0x396b11[_0x28d5('0x45')];_0x4f7138[_0x28d5('0x43')]=_0x396b11[_0x28d5('0x43')];return _0x4f7138;};exports[_0x28d5('0x62')]=function(_0x2cf61a){var _0x1da03e=[];for(var _0x5de2fa in _0x2cf61a){if(_0x2cf61a[_0x28d5('0x2f')](_0x5de2fa)){if(!_[_0x28d5('0x18')](_0x2cf61a[_0x5de2fa])&&_0x2cf61a[_0x5de2fa][_0x28d5('0x34')]===_0x28d5('0x63')&&_0x2cf61a[_0x5de2fa][_0x28d5('0x64')]===_0x28d5('0x65')){_0x1da03e[_0x28d5('0x66')](_0x2cf61a[_0x5de2fa]['id']);}}}return _0x1da03e;};exports[_0x28d5('0x67')]=function(_0x563d81){var _0x5c1c4b=moment()[_0x28d5('0x68')](0x0);var _0x50889e=moment(_0x563d81)[_0x28d5('0x68')](0x0);return _0x5c1c4b[_0x28d5('0x69')](_0x50889e,'seconds');};exports[_0x28d5('0x6a')]=function(_0x5b8006){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x5b8006[_0x28d5('0x1e')],'ListId':_0x5b8006[_0x28d5('0x54')],'VoiceQueueId':_0x5b8006[_0x28d5('0x20')]||undefined,'CampaignId':_0x5b8006[_0x28d5('0x6b')]||undefined};};exports['filterKey']=function(_0x54f833){if(_0x54f833==='uniqueid'||_0x54f833==='idContact'||_0x54f833==='queue'||_0x54f833===_0x28d5('0x6c')||_0x54f833===_0x28d5('0x6d')||_0x54f833===_0x28d5('0x6e')||_0x54f833===_0x28d5('0x3d')||_0x54f833===_0x28d5('0x45')||_0x54f833===_0x28d5('0x1c')||_0x54f833===_0x28d5('0x6f')||_0x54f833==='calleridnum'||_0x54f833===_0x28d5('0x51')||_0x54f833===_0x28d5('0x49')||_0x54f833===_0x28d5('0x4a')||_0x54f833===_0x28d5('0x4b')||_0x54f833===_0x28d5('0x70')||_0x54f833===_0x28d5('0x71')||_0x54f833==='callbackuniqueid'||_0x54f833===_0x28d5('0x72')||_0x54f833===_0x28d5('0x73')||_0x54f833===_0x28d5('0x1e')||_0x54f833===_0x28d5('0x54')||_0x54f833===_0x28d5('0x74')||_0x54f833===_0x28d5('0x20')||_0x54f833===_0x28d5('0x75')||_0x54f833===_0x28d5('0x76')||_0x54f833==='xmd-queue'||_0x54f833===_0x28d5('0x77')||_0x54f833===_0x28d5('0x78')||_0x54f833===_0x28d5('0x79')||_0x54f833==='xmd-dialtimeout'||_0x54f833===_0x28d5('0x7a')||_0x54f833===_0x28d5('0x7b')||_0x54f833==='xmd-dialchannel'||_0x54f833===_0x28d5('0x7c')||_0x54f833===_0x28d5('0x7d')||_0x54f833===_0x28d5('0x7e')||_0x54f833==='xmd-agiafter'||_0x54f833==='xmd-agi'||_0x54f833===_0x28d5('0x7f')||_0x54f833==='rtpaudioqosbridged'||_0x54f833===_0x28d5('0x80')||_0x54f833===_0x28d5('0x81')||_0x54f833===_0x28d5('0x82')||_0x54f833==='rtpaudioqoslossbridged'||_0x54f833==='rtpaudioqosrtt'||_0x54f833===_0x28d5('0x83')||_0x54f833===_0x28d5('0x7f')||_0x54f833==='rtpaudioqosbridged'||_0x54f833===_0x28d5('0x80')||_0x54f833==='rtpaudioqosjitterbridged'||_0x54f833===_0x28d5('0x82')||_0x54f833===_0x28d5('0x84')||_0x54f833===_0x28d5('0x85')||_0x54f833===_0x28d5('0x83')||_0x54f833===_0x28d5('0x86')||_0x54f833==='bridgepvtcallid'||_0x54f833===_0x28d5('0x34')||_0x54f833===_0x28d5('0x35')){return![];}return!![];};exports[_0x28d5('0x87')]=function(_0x226440,_0x13bcce){var _0x343846,_0x440745,_0x5cb73d;if(_0x13bcce<=0x0){_0x13bcce=0x1;}_0x343846=new RegExp(_0x28d5('0x88')+_0x13bcce+'}$');_0x440745=Math['pow'](0xa,_0x13bcce-0x1);_0x5cb73d=Math['pow'](0xa,_0x13bcce)-0x1;return util[_0x28d5('0x15')]('%s',_[_0x28d5('0x89')](_0x226440,_0x343846,_[_0x28d5('0x8a')](_0x440745,_0x5cb73d)));};exports[_0x28d5('0x8b')]=function(_0x35e214){var _0x256367=_0x35e214['match'](/"(.*?)"/);return _0x256367?_0x256367[0x1]:_0x35e214;};exports[_0x28d5('0x8c')]=function(_0x3032a8){var _0x11e2cd=_0x3032a8[_0x28d5('0x8d')](/<(.*?)>/);return _0x11e2cd?_0x11e2cd[0x1]:_0x3032a8;};function buildNoAnswerEventPayload(_0x2b846c,_0x4e7c53){var _0x4a9549=buildObj(_0x2b846c,_0x28d5('0x8e'));if(!_[_0x28d5('0x14')](_0x4e7c53[_0x28d5('0x8f')])){Object[_0x28d5('0x90')](_0x4e7c53['variables'])[_0x28d5('0x91')](function(_0x3108da){_0x4a9549[_0x3108da['toLowerCase']()]=_0x4e7c53['variables'][_0x3108da];});}return _0x4a9549;}exports[_0x28d5('0x92')]=buildNoAnswerEventPayload; \ No newline at end of file +var _0xc7b7=['xmd-agiafter','xmd-agi','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosloss','bridgepeer','bridgepvtcallid','\x5cw{0,','pow','random','extractCalleridName','extractCalleridNumber','match','noanswer','variables','forEach','toLowerCase','buildNoAnswerEventPayload','util','moment','preview','env','XCALLY_IP_AGI','../../dialer/utils','loggerCatch','error','inspect','logger','info','logger2','message','getCallerId','string','isEmpty','isUndefined','format','\x22%s\x22\x20<%s>','\x22\x22\x20<>','isActive','isNil','addVariables','Queue','name','calleridnum','VoiceQueueId','dialOriginateTimeout','\x22rtTxX%s%s\x22','dialQueueProject2','monitor_format','dialPreviewUrl','dialQueueProject','\x22agi://%s/square,%s\x22','NONE','originatecalleridnum','originatecalleridname','xcally-motion-preview','_XCALLY_MIXMONITOR_FORMAT','toLowerVariables','toLower','hasOwnProperty','originated','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','logBlacklist','YYYY-MM-DD\x20HH:mm:ss','Blacklist','logAgent','state','statedesc','responsetime','ringtime','starttime','UserId','endtime','getSeconds','answertime','isFailure','Failure','variablesAction','BOOKED','uniqueid','channelAgent','from-sip','timeout','totalGlobal','countcongestionretry','countnoanswerretry','countagentrejectretry','countnosuchnumberretry','cloneAction','Global','scheduledAt','active','add','minutes','ContactId','ListId','decrementTalkink','IsNotLoggedIn','lastevent','motionChannel','mandatoryDisposition','buildObj','buildAcw','queue','interface','not_inuse','status','push','getDiff','milliseconds','diff','createBody','filterKey','idContact','type','campaigntype','dialAnswer','membername','calleridname','scheduledat','countbusyretry','countglobal','callback','callbackuniqueid','callbackat','xmd-voicequeueid','xmd-queue','xmd-listid','xmd-dialurl','xmd-dialtimeout','xmd-dialoptions','xmd-dialchannel','xmd-contactid','xmd-callerid'];(function(_0x167ecb,_0xa9299){var _0x1148c7=function(_0x13c445){while(--_0x13c445){_0x167ecb['push'](_0x167ecb['shift']());}};_0x1148c7(++_0xa9299);}(_0xc7b7,0xa3));var _0x7c7b=function(_0x29e35f,_0x4859ef){_0x29e35f=_0x29e35f-0x0;var _0x266b74=_0xc7b7[_0x29e35f];return _0x266b74;};'use strict';var util=require(_0x7c7b('0x0'));var _=require('lodash');var moment=require(_0x7c7b('0x1'));var logger=require('../../../../config/logger')(_0x7c7b('0x2'));var ipAgi=process[_0x7c7b('0x3')][_0x7c7b('0x4')]||'127.0.0.1';var utils=require(_0x7c7b('0x5'));exports[_0x7c7b('0x6')]=function(_0x5a5b85){return function(_0x13159e){logger[_0x7c7b('0x7')](_0x5a5b85,util[_0x7c7b('0x8')](_0x13159e,{'showHidden':![],'depth':null}));};};exports[_0x7c7b('0x9')]=function(_0x12bb1c,_0x1afdde){logger[_0x7c7b('0xa')](_0x12bb1c,util[_0x7c7b('0x8')](_0x1afdde,{'showHidden':![],'depth':null}));};exports['loggerError']=function(_0x259232,_0x14daf5){logger[_0x7c7b('0x7')](_0x259232,util[_0x7c7b('0x8')](_0x14daf5,{'showHidden':![],'depth':null}));};exports[_0x7c7b('0xb')]=function(_0x33a703){return function(_0x53136b){logger['info'](_0x33a703,util['inspect'](_0x53136b,{'showHidden':![],'depth':null}));};};exports[_0x7c7b('0xc')]=function(_0x2cc4b5,_0x5ed3fa,_0x2677f3){return{'message':_0x2cc4b5,'unlock':_0x5ed3fa,'active':_0x2677f3};};exports[_0x7c7b('0xd')]=function(_0x58c6c3,_0x218ece,_0x1bbfe4){if(!_['isUndefined'](_0x1bbfe4)&&_0x7c7b('0xe')===typeof _0x1bbfe4&&!_[_0x7c7b('0xf')](_0x1bbfe4)){if(!_[_0x7c7b('0x10')](_0x218ece)&&'string'===typeof _0x218ece&&!_[_0x7c7b('0xf')](_0x218ece)){return util[_0x7c7b('0x11')](_0x7c7b('0x12'),_0x218ece,_0x1bbfe4);}return util['format'](_0x7c7b('0x12'),_0x1bbfe4,_0x1bbfe4);}if(!_['isUndefined'](_0x58c6c3)&&_0x7c7b('0xe')===typeof _0x58c6c3&&!_[_0x7c7b('0xf')](_0x58c6c3)){return _0x58c6c3;}return _0x7c7b('0x13');};exports[_0x7c7b('0x14')]=function(_0x2f4494){if(_[_0x7c7b('0x15')](_0x2f4494)){return![];}return _0x2f4494;};exports[_0x7c7b('0x16')]=function(_0x54a7a2,_0x39942a,_0x18abcc,_0x525b43,_0x1afbde,_0x361c66){var _0x65ac09={'XMD-QUEUE':_0x39942a['Queue']?_0x39942a[_0x7c7b('0x17')][_0x7c7b('0x18')]:'','XMD-CALLERID':_0x525b43,'XMD-CALLERID-PREVIEW':_0x361c66?util[_0x7c7b('0x11')](_0x7c7b('0x12'),_0x361c66['calleridname'],_0x361c66[_0x7c7b('0x19')]):_0x525b43,'XMD-DIALID':_0x1afbde,'XMD-CONTACTID':_0x39942a['ContactId'],'XMD-CDRTYPE':'dialer','CALLERID(all)':_0x525b43,'XMD-VOICEQUEUEID':_0x39942a[_0x7c7b('0x1a')],'XMD-DIALCHANNEL':_0x18abcc,'XMD-DIALTIMEOUT':_0x54a7a2[_0x7c7b('0x1b')]||0x1e,'XMD-DIALOPTIONS':util[_0x7c7b('0x11')](_0x7c7b('0x1c'),_0x54a7a2[_0x7c7b('0x1d')]?'g':'',_[_0x7c7b('0xf')](_0x54a7a2[_0x7c7b('0x1e')])?'':'U(xcally-mixmonitor-context)'),'XMD-DIALURL':_0x54a7a2[_0x7c7b('0x1f')]||'','XMD-AGI':_0x54a7a2[_0x7c7b('0x20')]?util['format'](_0x7c7b('0x21'),ipAgi,_0x54a7a2[_0x7c7b('0x20')]):_0x7c7b('0x22'),'XMD-AGIAFTER':_0x54a7a2[_0x7c7b('0x1d')]?util[_0x7c7b('0x11')](_0x7c7b('0x21'),ipAgi,_0x54a7a2['dialQueueProject2']):_0x7c7b('0x22'),'XMD-ORIGINATECALLERIDNUM':_0x361c66?_0x361c66[_0x7c7b('0x23')]:'','XMD-ORIGINATECALLERIDNAME':_0x361c66?_0x361c66[_0x7c7b('0x24')]:'','XMD-DESTINATION':_0x7c7b('0x25'),'SIPADDHEADER':'Call-Type:\x20PREVIEW'};if(!_[_0x7c7b('0xf')](_0x54a7a2[_0x7c7b('0x1e')])){_0x65ac09[util[_0x7c7b('0x11')]('%s',_0x7c7b('0x26'))]=_0x54a7a2[_0x7c7b('0x1e')];_0x65ac09[util['format']('%s','_XCALLY_MIXMONITOR_UNIQUEID')]=_0x1afbde;}return _0x65ac09;};exports[_0x7c7b('0x27')]=function(_0x24e954){var _0x2c9b98={};for(var _0x562b51 in _0x24e954){if(_0x24e954['hasOwnProperty'](_0x562b51)){_0x2c9b98[util[_0x7c7b('0x11')]('%s',_[_0x7c7b('0x28')](_0x562b51))]=_0x24e954[_0x562b51];}}return{'variables':_0x2c9b98};};exports['updateOriginated']=function(_0x23917d,_0x2b72c3){if(!_['isNil'](_0x23917d)){if(_0x23917d[_0x7c7b('0x29')](_0x7c7b('0x2a'))){if(_0x23917d[_0x7c7b('0x2a')]>0x0){_0x23917d['originated']-=0x1;}else{logger[_0x7c7b('0x7')](_0x7c7b('0x2b'),_0x2b72c3);}}}else{logger['error'](_0x7c7b('0x2c'),_0x2b72c3);}};exports[_0x7c7b('0x2d')]=function(_0x223cf2){var _0x4a2254=moment()['format'](_0x7c7b('0x2e'));_0x223cf2['state']=0xd;_0x223cf2['statedesc']=_0x7c7b('0x2f');_0x223cf2['starttime']=_0x4a2254;_0x223cf2['responsetime']=_0x4a2254;_0x223cf2['endtime']=_0x4a2254;};exports[_0x7c7b('0x30')]=function(_0x196b27,_0x44ace4,_0x1546f2){var _0x48a908=moment()['format'](_0x7c7b('0x2e'));_0x196b27[_0x7c7b('0x31')]=_0x44ace4;_0x196b27[_0x7c7b('0x32')]=_0x1546f2;_0x196b27[_0x7c7b('0x33')]=_0x48a908;_0x196b27[_0x7c7b('0x34')]=utils['getSeconds'](_0x196b27[_0x7c7b('0x33')],_0x196b27[_0x7c7b('0x35')]);};exports['logLookAgent']=function(_0x2f690f,_0x1b8f73,_0xfaacd1){_0x2f690f['membername']=_0x1b8f73;_0x2f690f[_0x7c7b('0x36')]=_0xfaacd1;};exports['logCustomer']=function(_0x108d37,_0x987698,_0x27ca5a){var _0x3e9b9e=moment()[_0x7c7b('0x11')](_0x7c7b('0x2e'));_0x108d37[_0x7c7b('0x31')]=_0x987698;_0x108d37[_0x7c7b('0x32')]=_0x27ca5a;_0x108d37['responsetime']=_0x108d37[_0x7c7b('0x33')]?_0x108d37['responsetime']:_0x3e9b9e;_0x108d37[_0x7c7b('0x37')]=_0x108d37['endtime']?_0x108d37['endtime']:_0x3e9b9e;_0x108d37['ringtime']=utils[_0x7c7b('0x38')](_0x108d37[_0x7c7b('0x33')]||0x0,_0x108d37[_0x7c7b('0x35')]||0x0);_0x108d37['talktime']=_0x108d37[_0x7c7b('0x39')]?utils[_0x7c7b('0x38')](_0x108d37[_0x7c7b('0x37')],_0x108d37[_0x7c7b('0x39')]):0x0;};exports[_0x7c7b('0x3a')]=function(_0x7e2252){return _0x7e2252===_0x7c7b('0x3b');};exports[_0x7c7b('0x3c')]=function(_0x362d2f,_0x1db314,_0x1059dc,_0x261ef1,_0x581bba){var _0xcbb87a=_0x261ef1?'RECALL':_0x362d2f['calleridname'];_0xcbb87a=_0x581bba?_0x7c7b('0x3d'):_0xcbb87a;return{'actionid':_0x362d2f[_0x7c7b('0x3e')],'action':'originate','channel':_0x362d2f[_0x7c7b('0x3f')],'callerid':util['format'](_0x7c7b('0x12'),_0xcbb87a,_0x362d2f[_0x7c7b('0x19')]),'Exten':'xcally-motion-preview','Context':_0x7c7b('0x40'),'Priority':'1','variable':_0x1059dc,'timeout':(_0x1db314[_0x7c7b('0x41')]||0x1e)*0x3e8,'async':!![],'channelid':_0x362d2f[_0x7c7b('0x3e')]};};exports[_0x7c7b('0x42')]=function(_0x11b661){return _0x11b661['countbusyretry']+_0x11b661[_0x7c7b('0x43')]+_0x11b661[_0x7c7b('0x44')]+_0x11b661[_0x7c7b('0x45')]+_0x11b661[_0x7c7b('0x46')];};exports[_0x7c7b('0x47')]=function(_0x24b38c){var _0x3d9d5c=_['clone'](_0x24b38c);_0x3d9d5c['state']=0xf;_0x3d9d5c[_0x7c7b('0x32')]=_0x7c7b('0x48');return _0x3d9d5c;};exports[_0x7c7b('0x49')]=function(_0x6a2471,_0xb2ca3,_0x1af013){var _0x4d84b1={};_0x4d84b1[_0xb2ca3]=_0x6a2471[_0xb2ca3];_0x4d84b1[_0x7c7b('0x4a')]=![];_0x4d84b1['scheduledat']=moment()[_0x7c7b('0x4b')](_0x1af013,_0x7c7b('0x4c'))[_0x7c7b('0x11')](_0x7c7b('0x2e'));_0x4d84b1[_0x7c7b('0x4d')]=_0x6a2471['ContactId'];_0x4d84b1[_0x7c7b('0x4e')]=_0x6a2471['ListId'];_0x4d84b1[_0x7c7b('0x1a')]=_0x6a2471[_0x7c7b('0x1a')]||undefined;return _0x4d84b1;};exports[_0x7c7b('0x4f')]=function(_0xacc56c,_0x13041e){if(!_[_0x7c7b('0x15')](_0xacc56c)){if(_0xacc56c['pTalking']>0x0){_0xacc56c['pTalking']-=0x1;}else{logger[_0x7c7b('0x7')](_0x13041e,'[decrementTalkink]\x20object\x20talking\x20is\x20negative');}}else{logger[_0x7c7b('0x7')](_0x13041e,'[decrementTalkink]\x20is\x20null\x20or\x20undefined');}};exports[_0x7c7b('0x50')]=function(_0x2e38d1){if(_0x2e38d1<=0x0){return!![];}return![];};function buildObj(_0x285acc,_0x2a5212,_0x4b561f){_0x285acc[_0x7c7b('0x51')]=_0x2a5212;_0x285acc[_0x7c7b('0x18')]=_0x285acc['queue'];_0x285acc['interface']=_0x285acc[_0x7c7b('0x3f')];_0x285acc[_0x7c7b('0x52')]='voice';if(_0x4b561f){_0x285acc[_0x7c7b('0x53')]=_0x4b561f['mandatoryDisposition'];}return _0x285acc;}exports[_0x7c7b('0x54')]=buildObj;exports[_0x7c7b('0x55')]=function(_0x9ec362){var _0x3e57c4={};_0x3e57c4['queue']=_0x9ec362[_0x7c7b('0x56')];_0x3e57c4[_0x7c7b('0x57')]=_0x9ec362[_0x7c7b('0x3f')];_0x3e57c4[_0x7c7b('0x3e')]=_0x9ec362[_0x7c7b('0x3e')];return _0x3e57c4;};exports['agentReadyId']=function(_0x5c2ad4){var _0x3e8a6b=[];for(var _0xc47ef0 in _0x5c2ad4){if(_0x5c2ad4['hasOwnProperty'](_0xc47ef0)){if(!_[_0x7c7b('0x15')](_0x5c2ad4[_0xc47ef0])&&_0x5c2ad4[_0xc47ef0]['state']===_0x7c7b('0x58')&&_0x5c2ad4[_0xc47ef0][_0x7c7b('0x59')]==='reachable'){_0x3e8a6b[_0x7c7b('0x5a')](_0x5c2ad4[_0xc47ef0]['id']);}}}return _0x3e8a6b;};exports[_0x7c7b('0x5b')]=function(_0x2252fb){var _0x37318e=moment()[_0x7c7b('0x5c')](0x0);var _0x260bf6=moment(_0x2252fb)[_0x7c7b('0x5c')](0x0);return _0x37318e[_0x7c7b('0x5d')](_0x260bf6,'seconds');};exports[_0x7c7b('0x5e')]=function(_0x1171e2){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x1171e2[_0x7c7b('0x4d')],'ListId':_0x1171e2[_0x7c7b('0x4e')],'VoiceQueueId':_0x1171e2[_0x7c7b('0x1a')]||undefined,'CampaignId':_0x1171e2['CampaignId']||undefined};};exports[_0x7c7b('0x5f')]=function(_0x4b0c03){if(_0x4b0c03===_0x7c7b('0x3e')||_0x4b0c03===_0x7c7b('0x60')||_0x4b0c03===_0x7c7b('0x56')||_0x4b0c03===_0x7c7b('0x61')||_0x4b0c03===_0x7c7b('0x62')||_0x4b0c03===_0x7c7b('0x63')||_0x4b0c03===_0x7c7b('0x64')||_0x4b0c03===_0x7c7b('0x3f')||_0x4b0c03===_0x7c7b('0x65')||_0x4b0c03===_0x7c7b('0x4a')||_0x4b0c03===_0x7c7b('0x19')||_0x4b0c03===_0x7c7b('0x66')||_0x4b0c03===_0x7c7b('0x67')||_0x4b0c03===_0x7c7b('0x43')||_0x4b0c03===_0x7c7b('0x44')||_0x4b0c03===_0x7c7b('0x68')||_0x4b0c03===_0x7c7b('0x69')||_0x4b0c03===_0x7c7b('0x6a')||_0x4b0c03===_0x7c7b('0x6b')||_0x4b0c03==='recallme'||_0x4b0c03===_0x7c7b('0x4d')||_0x4b0c03==='ListId'||_0x4b0c03===_0x7c7b('0x36')||_0x4b0c03===_0x7c7b('0x1a')||_0x4b0c03==='sipcallid'||_0x4b0c03===_0x7c7b('0x6c')||_0x4b0c03===_0x7c7b('0x6d')||_0x4b0c03==='xmd-phone'||_0x4b0c03===_0x7c7b('0x6e')||_0x4b0c03===_0x7c7b('0x6f')||_0x4b0c03===_0x7c7b('0x70')||_0x4b0c03===_0x7c7b('0x71')||_0x4b0c03==='xmd-dialid'||_0x4b0c03===_0x7c7b('0x72')||_0x4b0c03===_0x7c7b('0x73')||_0x4b0c03==='xmd-cdrtype'||_0x4b0c03===_0x7c7b('0x74')||_0x4b0c03===_0x7c7b('0x75')||_0x4b0c03===_0x7c7b('0x76')||_0x4b0c03==='rtpaudioqos'||_0x4b0c03==='rtpaudioqosbridged'||_0x4b0c03===_0x7c7b('0x77')||_0x4b0c03===_0x7c7b('0x78')||_0x4b0c03==='rtpaudioqosloss'||_0x4b0c03===_0x7c7b('0x79')||_0x4b0c03===_0x7c7b('0x7a')||_0x4b0c03===_0x7c7b('0x7b')||_0x4b0c03===_0x7c7b('0x7c')||_0x4b0c03===_0x7c7b('0x7d')||_0x4b0c03===_0x7c7b('0x77')||_0x4b0c03===_0x7c7b('0x78')||_0x4b0c03===_0x7c7b('0x7e')||_0x4b0c03===_0x7c7b('0x79')||_0x4b0c03===_0x7c7b('0x7a')||_0x4b0c03==='rtpaudioqosrttbridged'||_0x4b0c03===_0x7c7b('0x7f')||_0x4b0c03===_0x7c7b('0x80')||_0x4b0c03===_0x7c7b('0x31')||_0x4b0c03===_0x7c7b('0x32')){return![];}return!![];};exports['getCallerIdRandom']=function(_0x53db9c,_0x2ed2ea){var _0x49d1ad,_0x305026,_0x375ea5;if(_0x2ed2ea<=0x0){_0x2ed2ea=0x1;}_0x49d1ad=new RegExp(_0x7c7b('0x81')+_0x2ed2ea+'}$');_0x305026=Math[_0x7c7b('0x82')](0xa,_0x2ed2ea-0x1);_0x375ea5=Math[_0x7c7b('0x82')](0xa,_0x2ed2ea)-0x1;return util[_0x7c7b('0x11')]('%s',_['replace'](_0x53db9c,_0x49d1ad,_[_0x7c7b('0x83')](_0x305026,_0x375ea5)));};exports[_0x7c7b('0x84')]=function(_0x409a72){var _0x4ab986=_0x409a72['match'](/"(.*?)"/);return _0x4ab986?_0x4ab986[0x1]:_0x409a72;};exports[_0x7c7b('0x85')]=function(_0x449a32){var _0x2025c0=_0x449a32[_0x7c7b('0x86')](/<(.*?)>/);return _0x2025c0?_0x2025c0[0x1]:_0x449a32;};function buildNoAnswerEventPayload(_0x60a757,_0x894222){var _0xbd943d=buildObj(_0x60a757,_0x7c7b('0x87'));if(!_[_0x7c7b('0xf')](_0x894222[_0x7c7b('0x88')])){Object['keys'](_0x894222[_0x7c7b('0x88')])[_0x7c7b('0x89')](function(_0x601ae6){_0xbd943d[_0x601ae6[_0x7c7b('0x8a')]()]=_0x894222[_0x7c7b('0x88')][_0x601ae6];});}return _0xbd943d;}exports[_0x7c7b('0x8b')]=buildNoAnswerEventPayload; \ No newline at end of file diff --git a/server/services/ami/properties.js b/server/services/ami/properties.js index ba8678c..8dd646a 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 _0x5088=['string','number','boolean','queueremove','reload','voicequeuechannel','voicechannel','voicequeuechannelhangup','voicequeuechannelredirect','queueadd'];(function(_0x331085,_0x46ef3b){var _0x1547f4=function(_0x549b5d){while(--_0x549b5d){_0x331085['push'](_0x331085['shift']());}};_0x1547f4(++_0x46ef3b);}(_0x5088,0x1a3));var _0x8508=function(_0x385b70,_0x52974f){_0x385b70=_0x385b70-0x0;var _0x33e2ef=_0x5088[_0x385b70];return _0x33e2ef;};'use strict';exports[_0x8508('0x0')]={'queue':{'type':_0x8508('0x1'),'required':!![]},'interface':{'type':_0x8508('0x1'),'required':!![]},'membername':{'type':'string','required':!![]},'penalty':{'type':_0x8508('0x2'),'required':![]},'paused':{'type':_0x8508('0x3'),'required':![]}};exports[_0x8508('0x4')]={'queue':{'type':'string','required':!![]},'interface':{'type':_0x8508('0x1'),'required':!![]}};exports['queuepause']={'interface':{'type':_0x8508('0x1'),'required':!![]},'paused':{'type':_0x8508('0x3')},'reason':{'type':_0x8508('0x1'),'required':![]}};exports[_0x8508('0x5')]={'module':{'type':_0x8508('0x1'),'required':![]}};exports[_0x8508('0x6')]={'uniqueid':{'type':'string','required':!![]}};exports[_0x8508('0x7')]={'uniqueid':{'type':_0x8508('0x1'),'required':!![]},'filename':{'type':'string'},'format':{'type':'string'},'mixmonitorid':{'type':_0x8508('0x1')}};exports[_0x8508('0x8')]={'uniqueid':{'type':_0x8508('0x1'),'required':!![]}};exports[_0x8508('0x9')]={'uniqueid':{'type':'string','required':!![]},'exten':{'type':_0x8508('0x1'),'required':!![]},'context':{'type':_0x8508('0x1')}}; \ No newline at end of file +var _0x4022=['queuepause','voicechannel','voicequeuechannelhangup','string','number','queueremove'];(function(_0x3d0e09,_0x3b2db7){var _0x16e7bd=function(_0x4dab73){while(--_0x4dab73){_0x3d0e09['push'](_0x3d0e09['shift']());}};_0x16e7bd(++_0x3b2db7);}(_0x4022,0xed));var _0x2402=function(_0x1c12e1,_0x22c6e4){_0x1c12e1=_0x1c12e1-0x0;var _0x37a21c=_0x4022[_0x1c12e1];return _0x37a21c;};'use strict';exports['queueadd']={'queue':{'type':_0x2402('0x0'),'required':!![]},'interface':{'type':_0x2402('0x0'),'required':!![]},'membername':{'type':_0x2402('0x0'),'required':!![]},'penalty':{'type':_0x2402('0x1'),'required':![]},'paused':{'type':'boolean','required':![]}};exports[_0x2402('0x2')]={'queue':{'type':_0x2402('0x0'),'required':!![]},'interface':{'type':'string','required':!![]}};exports[_0x2402('0x3')]={'interface':{'type':_0x2402('0x0'),'required':!![]},'paused':{'type':'boolean'},'reason':{'type':_0x2402('0x0'),'required':![]}};exports['reload']={'module':{'type':_0x2402('0x0'),'required':![]}};exports['voicequeuechannel']={'uniqueid':{'type':_0x2402('0x0'),'required':!![]}};exports[_0x2402('0x4')]={'uniqueid':{'type':'string','required':!![]},'filename':{'type':_0x2402('0x0')},'format':{'type':_0x2402('0x0')},'mixmonitorid':{'type':_0x2402('0x0')}};exports[_0x2402('0x5')]={'uniqueid':{'type':_0x2402('0x0'),'required':!![]}};exports['voicequeuechannelredirect']={'uniqueid':{'type':'string','required':!![]},'exten':{'type':_0x2402('0x0'),'required':!![]},'context':{'type':_0x2402('0x0')}}; \ No newline at end of file diff --git a/server/services/ami/realtime/index.js b/server/services/ami/realtime/index.js index 161eb0f..be2ba50 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 _0x5f66=['diff','seconds','disposition','ANSWERED','outbound','duration','billableseconds','initCampaigns','campaigns','dialQueueProject','SquareProject','voiceExtensions','initCampaignHopperHistory','initFaxAccounts','initVoiceQueues','exports','moment','../model/agent','../model/telephone','../model/trunk','../model/voiceQueue','../model/trigger','../model/campaign','../model/zendeskAccount','../model/salesforceAccount','../model/zohoAccount','../model/deskAccount','../model/vtigerAccount','../model/servicenowAccount','../model/dynamics365Account','../model/freshsalesAccount','telephones','trunks','voiceQueues','triggers','templates','channels','outboundChannels','settings','zendeskAccounts','salesforceAccounts','sugarcrmAccounts','freshdeskAccounts','zohoAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','faxAccounts','mapKeys','hasOwnProperty','isNil','format','interface','total','answered','sumHoldTime','sumBillable','isEmpty','ivrAnswerCallsDay','unmanaged','abandoned','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundDropCallsDayTimeout','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundAnswerCallsDay','queueStatusComplete','prototype','mergeFromDatabase','initAgents','agents','length','name','isUndefined','initTelephones','SIP/%s','initTriggers','initSalesforceAccounts','initFreshdeskAccounts','initDeskAccounts','initSugarcrmAccounts','initVtigerAccounts','initServicenowAccounts','freshsalesAccounts','initVoiceQueueHopperHistory','initVoiceQueueReports','groupBy','queuecallerexit','queuecallerabandon','queuecallerleaveAt','queuecallerjoinAt','sumDuration','queuecallercompleteAt','queuecallerexitAt'];(function(_0x101ce2,_0x2f3ef5){var _0x9dc5eb=function(_0x45a2ef){while(--_0x45a2ef){_0x101ce2['push'](_0x101ce2['shift']());}};_0x9dc5eb(++_0x2f3ef5);}(_0x5f66,0x1a0));var _0x65f6=function(_0x31e29a,_0x349c9b){_0x31e29a=_0x31e29a-0x0;var _0x32d892=_0x5f66[_0x31e29a];return _0x32d892;};'use strict';var _=require('lodash');var moment=require(_0x65f6('0x0'));var util=require('util');var Agent=require(_0x65f6('0x1'));var Telephone=require(_0x65f6('0x2'));var Trunk=require(_0x65f6('0x3'));var VoiceQueue=require(_0x65f6('0x4'));var Trigger=require(_0x65f6('0x5'));var Template=require('../model/template');var Campaign=require(_0x65f6('0x6'));var VoiceExtension=require('../model/voiceExtension');var ZendeskAccount=require(_0x65f6('0x7'));var SalesforceAccount=require(_0x65f6('0x8'));var FreshdeskAccount=require('../model/freshdeskAccount');var SugarcrmAccount=require('../model/sugarcrmAccount');var ZohoAccount=require(_0x65f6('0x9'));var DeskAccount=require(_0x65f6('0xa'));var VtigerAccount=require(_0x65f6('0xb'));var ServicenowAccount=require(_0x65f6('0xc'));var Dynamics365Account=require(_0x65f6('0xd'));var FreshsalesAccount=require(_0x65f6('0xe'));var FaxAccount=require('../model/faxAccount');function Realtime(){this['agents']={};this[_0x65f6('0xf')]={};this[_0x65f6('0x10')]={};this[_0x65f6('0x11')]={};this[_0x65f6('0x12')]={};this['campaigns']={};this[_0x65f6('0x13')]={};this['outbound']={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this['voiceExtensions']={};this[_0x65f6('0x14')]={};this['queueChannels']={};this[_0x65f6('0x15')]={};this['timers']={};this[_0x65f6('0x16')]={};this[_0x65f6('0x17')]={};this[_0x65f6('0x18')]={};this[_0x65f6('0x19')]={};this[_0x65f6('0x1a')]={};this[_0x65f6('0x1b')]={};this[_0x65f6('0x1c')]={};this[_0x65f6('0x1d')]={};this[_0x65f6('0x1e')]={};this[_0x65f6('0x1f')]={};this['freshsalesAccounts']={};this[_0x65f6('0x20')]={};}function freeIsNotKey(_0x49a913,_0x5dd324,_0x1693e6){var _0x5c69f8=_[_0x65f6('0x21')](_0x49a913,function(_0x1c955c){return _0x1c955c[_0x1693e6];});for(var _0x1b1cbb in _0x5dd324){if(_0x5dd324[_0x65f6('0x22')](_0x1b1cbb)){if(!_0x5c69f8[_0x1b1cbb]){delete _0x5dd324[_0x1b1cbb];}}}}function freeIsNotKeySip(_0xc8660c,_0x18380e){var _0x495dd6=_['mapKeys'](_0xc8660c,function(_0x2d538c){return util['format']('SIP/%s',_0x2d538c['name']);});for(var _0x365159 in _0x18380e){if(_0x18380e[_0x65f6('0x22')](_0x365159)){if(!_0x495dd6[_0x365159]){delete _0x18380e[_0x365159];}}}}function freeIsNotKeyAgent(_0x5114a4,_0x39e19f){var _0x270893=_[_0x65f6('0x21')](_0x5114a4,function(_0x3876ed){var _0x219ab2=_[_0x65f6('0x23')](_0x3876ed['interface'])?util[_0x65f6('0x24')]('SIP/%s',_0x3876ed['name']):_0x3876ed[_0x65f6('0x25')];return _0x219ab2;});for(var _0xd173f4 in _0x39e19f){if(_0x39e19f['hasOwnProperty'](_0xd173f4)){if(!_0x270893[_0xd173f4]){delete _0x39e19f[_0xd173f4];}}}}function clearVoiceCallReports(_0x1eeaaa){_0x1eeaaa[_0x65f6('0x26')]=0x0;_0x1eeaaa[_0x65f6('0x27')]=0x0;_0x1eeaaa[_0x65f6('0x28')]=0x0;_0x1eeaaa['sumDuration']=0x0;_0x1eeaaa[_0x65f6('0x29')]=0x0;}function clearCampaigns(_0x59ea32){if(!_[_0x65f6('0x2a')](_0x59ea32)){for(var _0x5963e0 in _0x59ea32){if(_0x59ea32['hasOwnProperty'](_0x5963e0)){_0x59ea32[_0x5963e0]['ivrTotalCallsDays']=0x0;_0x59ea32[_0x5963e0][_0x65f6('0x2b')]=0x0;}}}}function clearVoiceQueues(_0x16cde8){if(!_['isEmpty'](_0x16cde8)){for(var _0x296cd9 in _0x16cde8){if(_0x16cde8[_0x65f6('0x22')](_0x296cd9)){_0x16cde8[_0x296cd9]['total']=0x0;_0x16cde8[_0x296cd9][_0x65f6('0x27')]=0x0;_0x16cde8[_0x296cd9][_0x65f6('0x2c')]=0x0;_0x16cde8[_0x296cd9][_0x65f6('0x2d')]=0x0;_0x16cde8[_0x296cd9]['sumHoldTime']=0x0;_0x16cde8[_0x296cd9]['sumDuration']=0x0;_0x16cde8[_0x296cd9]['sumBillable']=0x0;_0x16cde8[_0x296cd9][_0x65f6('0x2e')]=0x0;_0x16cde8[_0x296cd9][_0x65f6('0x2f')]=0x0;_0x16cde8[_0x296cd9][_0x65f6('0x30')]=0x0;_0x16cde8[_0x296cd9][_0x65f6('0x31')]=0x0;_0x16cde8[_0x296cd9][_0x65f6('0x32')]=0x0;_0x16cde8[_0x296cd9][_0x65f6('0x33')]=0x0;_0x16cde8[_0x296cd9][_0x65f6('0x34')]=0x0;_0x16cde8[_0x296cd9]['outboundDropCallsDayCallersExit']=0x0;_0x16cde8[_0x296cd9]['outboundBlacklistCallsDay']=0x0;_0x16cde8[_0x296cd9][_0x65f6('0x35')]=0x0;_0x16cde8[_0x296cd9][_0x65f6('0x36')]=0x0;_0x16cde8[_0x296cd9]['outboundReCallsDay']=0x0;_0x16cde8[_0x296cd9]['outboundAnswerAgiCallsDay']=0x0;_0x16cde8[_0x296cd9][_0x65f6('0x37')]=0x0;_0x16cde8[_0x296cd9][_0x65f6('0x38')]=!![];}}}}Realtime[_0x65f6('0x39')][_0x65f6('0x3a')]=function(_0x1217fd,_0x2d32be){for(var _0x5792a0 in _0x2d32be){if(_0x1217fd[_0x65f6('0x22')](_0x5792a0)){_0x1217fd[_0x5792a0]=_0x2d32be[_0x5792a0];}}};Realtime[_0x65f6('0x39')][_0x65f6('0x3b')]=function(){var _0x4bc037=this;return function(_0x217f35){if(_0x217f35){freeIsNotKeyAgent(_0x217f35,_0x4bc037[_0x65f6('0x3c')]);for(var _0xbaed3c=0x0,_0x45510a={};_0xbaed3c<_0x217f35[_0x65f6('0x3d')];_0xbaed3c+=0x1){_0x45510a=_0x217f35[_0xbaed3c];var _0x2f054c=_['isNil'](_0x45510a[_0x65f6('0x25')])?util[_0x65f6('0x24')]('SIP/%s',_0x45510a[_0x65f6('0x3e')]):_0x45510a['interface'];if(_[_0x65f6('0x3f')](_0x4bc037['agents'][_0x2f054c])){_0x4bc037[_0x65f6('0x3c')][_0x2f054c]=new Agent(_0x45510a);}else{_0x4bc037[_0x65f6('0x3a')](_0x4bc037['agents'][_0x2f054c],_0x45510a);}}}return _0x4bc037[_0x65f6('0x3c')];};};Realtime[_0x65f6('0x39')][_0x65f6('0x40')]=function(){var _0x515648=this;return function(_0x582c7e){if(_0x582c7e){freeIsNotKeySip(_0x582c7e,_0x515648[_0x65f6('0xf')]);for(var _0x4c0df4=0x0,_0x26de30={};_0x4c0df4<_0x582c7e['length'];_0x4c0df4+=0x1){_0x26de30=_0x582c7e[_0x4c0df4];if(_[_0x65f6('0x3f')](_0x515648[_0x65f6('0xf')][util['format'](_0x65f6('0x41'),_0x26de30['name'])])){_0x515648['telephones'][util[_0x65f6('0x24')](_0x65f6('0x41'),_0x26de30[_0x65f6('0x3e')])]=new Telephone(_0x26de30);}else{_0x515648[_0x65f6('0x3a')](_0x515648[_0x65f6('0xf')][util[_0x65f6('0x24')](_0x65f6('0x41'),_0x26de30[_0x65f6('0x3e')])],_0x26de30);}}}return _0x515648['telephones'];};};Realtime[_0x65f6('0x39')]['initTrunks']=function(){var _0x12a589=this;return function(_0xa4394a){if(_0xa4394a){freeIsNotKeySip(_0xa4394a,_0x12a589[_0x65f6('0x10')]);for(var _0x2ea7f7=0x0,_0x5ef5c2={};_0x2ea7f7<_0xa4394a[_0x65f6('0x3d')];_0x2ea7f7+=0x1){_0x5ef5c2=_0xa4394a[_0x2ea7f7];if(_[_0x65f6('0x3f')](_0x12a589[_0x65f6('0x10')][util[_0x65f6('0x24')](_0x65f6('0x41'),_0x5ef5c2[_0x65f6('0x3e')])])){_0x12a589[_0x65f6('0x10')][util[_0x65f6('0x24')](_0x65f6('0x41'),_0x5ef5c2['name'])]=new Trunk(_0x5ef5c2);}else{_0x12a589[_0x65f6('0x3a')](_0x12a589[_0x65f6('0x10')][util[_0x65f6('0x24')](_0x65f6('0x41'),_0x5ef5c2[_0x65f6('0x3e')])],_0x5ef5c2);}}}return _0x12a589[_0x65f6('0x10')];};};Realtime[_0x65f6('0x39')][_0x65f6('0x42')]=function(){var _0x461393=this;return function(_0x2abbed){if(_0x2abbed){freeIsNotKey(_0x2abbed,_0x461393[_0x65f6('0x12')],'id');for(var _0x2c008a=0x0,_0x6c4d94={};_0x2c008a<_0x2abbed[_0x65f6('0x3d')];_0x2c008a+=0x1){_0x6c4d94=_0x2abbed[_0x2c008a];if(_[_0x65f6('0x3f')](_0x461393[_0x65f6('0x12')][_0x6c4d94['id']])){_0x461393['triggers'][_0x6c4d94['id']]=new Trigger(_0x6c4d94);}else{_0x461393[_0x65f6('0x3a')](_0x461393[_0x65f6('0x12')][_0x6c4d94['id']],_0x6c4d94);}}}return _0x461393[_0x65f6('0x12')];};};Realtime[_0x65f6('0x39')]['initTemplates']=function(){var _0x1bf5bf=this;return function(_0x2d0dac){if(_0x2d0dac){freeIsNotKey(_0x2d0dac,_0x1bf5bf[_0x65f6('0x13')],'id');for(var _0x5e69b4=0x0,_0x2dbab3={};_0x5e69b4<_0x2d0dac[_0x65f6('0x3d')];_0x5e69b4+=0x1){_0x2dbab3=_0x2d0dac[_0x5e69b4];if(_[_0x65f6('0x3f')](_0x1bf5bf[_0x65f6('0x13')][_0x2dbab3['id']])){_0x1bf5bf['templates'][_0x2dbab3['id']]=new Template(_0x2dbab3);}else{_0x1bf5bf[_0x65f6('0x3a')](_0x1bf5bf['templates'][_0x2dbab3['id']],_0x2dbab3);}}}return _0x1bf5bf[_0x65f6('0x13')];};};Realtime[_0x65f6('0x39')]['initZendeskAccounts']=function(){var _0xf754ee=this;return function(_0x5085db){if(_0x5085db){freeIsNotKey(_0x5085db,_0xf754ee[_0x65f6('0x17')],'id');for(var _0x4d9b76=0x0,_0x2d1706={};_0x4d9b76<_0x5085db[_0x65f6('0x3d')];_0x4d9b76+=0x1){_0x2d1706=_0x5085db[_0x4d9b76];if(_[_0x65f6('0x3f')](_0xf754ee[_0x65f6('0x17')][_0x2d1706['id']])){_0xf754ee['zendeskAccounts'][_0x2d1706['id']]=new ZendeskAccount(_0x2d1706);}else{_0xf754ee['mergeFromDatabase'](_0xf754ee[_0x65f6('0x17')][_0x2d1706['id']],_0x2d1706);}}}return _0xf754ee[_0x65f6('0x17')];};};Realtime[_0x65f6('0x39')][_0x65f6('0x43')]=function(){var _0x3b907c=this;return function(_0x2d6ab9){if(_0x2d6ab9){freeIsNotKey(_0x2d6ab9,_0x3b907c[_0x65f6('0x18')],'id');for(var _0x41690c=0x0,_0x414f49={};_0x41690c<_0x2d6ab9['length'];_0x41690c+=0x1){_0x414f49=_0x2d6ab9[_0x41690c];if(_[_0x65f6('0x3f')](_0x3b907c[_0x65f6('0x18')][_0x414f49['id']])){_0x3b907c[_0x65f6('0x18')][_0x414f49['id']]=new SalesforceAccount(_0x414f49);}else{_0x3b907c['mergeFromDatabase'](_0x3b907c[_0x65f6('0x18')][_0x414f49['id']],_0x414f49);}}}return _0x3b907c[_0x65f6('0x18')];};};Realtime['prototype'][_0x65f6('0x44')]=function(){var _0x253d52=this;return function(_0x57eb04){if(_0x57eb04){freeIsNotKey(_0x57eb04,_0x253d52[_0x65f6('0x1a')],'id');for(var _0x4f96c4=0x0,_0x247be3={};_0x4f96c4<_0x57eb04[_0x65f6('0x3d')];_0x4f96c4+=0x1){_0x247be3=_0x57eb04[_0x4f96c4];if(_[_0x65f6('0x3f')](_0x253d52['freshdeskAccounts'][_0x247be3['id']])){_0x253d52[_0x65f6('0x1a')][_0x247be3['id']]=new FreshdeskAccount(_0x247be3);}else{_0x253d52[_0x65f6('0x3a')](_0x253d52['freshdeskAccounts'][_0x247be3['id']],_0x247be3);}}}return _0x253d52[_0x65f6('0x1a')];};};Realtime[_0x65f6('0x39')]['initZohoAccounts']=function(){var _0x34d6a9=this;return function(_0x344c0e){if(_0x344c0e){freeIsNotKey(_0x344c0e,_0x34d6a9[_0x65f6('0x1b')],'id');for(var _0x25d504=0x0,_0x234fa7={};_0x25d504<_0x344c0e[_0x65f6('0x3d')];_0x25d504+=0x1){_0x234fa7=_0x344c0e[_0x25d504];if(_[_0x65f6('0x3f')](_0x34d6a9[_0x65f6('0x1b')][_0x234fa7['id']])){_0x34d6a9['zohoAccounts'][_0x234fa7['id']]=new ZohoAccount(_0x234fa7);}else{_0x34d6a9['mergeFromDatabase'](_0x34d6a9['zohoAccounts'][_0x234fa7['id']],_0x234fa7);}}}return _0x34d6a9[_0x65f6('0x1b')];};};Realtime[_0x65f6('0x39')][_0x65f6('0x45')]=function(){var _0x20c322=this;return function(_0x545445){if(_0x545445){freeIsNotKey(_0x545445,_0x20c322[_0x65f6('0x1c')],'id');for(var _0x2032b9=0x0,_0x9ff849={};_0x2032b9<_0x545445['length'];_0x2032b9+=0x1){_0x9ff849=_0x545445[_0x2032b9];if(_[_0x65f6('0x3f')](_0x20c322[_0x65f6('0x1c')][_0x9ff849['id']])){_0x20c322[_0x65f6('0x1c')][_0x9ff849['id']]=new DeskAccount(_0x9ff849);}else{_0x20c322['mergeFromDatabase'](_0x20c322['deskAccounts'][_0x9ff849['id']],_0x9ff849);}}}return _0x20c322[_0x65f6('0x1c')];};};Realtime[_0x65f6('0x39')][_0x65f6('0x46')]=function(){var _0x39364f=this;return function(_0x2a76b3){if(_0x2a76b3){freeIsNotKey(_0x2a76b3,_0x39364f[_0x65f6('0x19')],'id');for(var _0x35d77f=0x0,_0x138334={};_0x35d77f<_0x2a76b3[_0x65f6('0x3d')];_0x35d77f+=0x1){_0x138334=_0x2a76b3[_0x35d77f];if(_[_0x65f6('0x3f')](_0x39364f[_0x65f6('0x19')][_0x138334['id']])){_0x39364f[_0x65f6('0x19')][_0x138334['id']]=new SugarcrmAccount(_0x138334);}else{_0x39364f[_0x65f6('0x3a')](_0x39364f[_0x65f6('0x19')][_0x138334['id']],_0x138334);}}}return _0x39364f['sugarcrmAccounts'];};};Realtime[_0x65f6('0x39')][_0x65f6('0x47')]=function(){var _0x42a805=this;return function(_0x4b4efe){if(_0x4b4efe){freeIsNotKey(_0x4b4efe,_0x42a805[_0x65f6('0x1d')],'id');for(var _0x16dec0=0x0,_0x4638c9={};_0x16dec0<_0x4b4efe[_0x65f6('0x3d')];_0x16dec0+=0x1){_0x4638c9=_0x4b4efe[_0x16dec0];if(_['isUndefined'](_0x42a805[_0x65f6('0x1d')][_0x4638c9['id']])){_0x42a805[_0x65f6('0x1d')][_0x4638c9['id']]=new VtigerAccount(_0x4638c9);}else{_0x42a805[_0x65f6('0x3a')](_0x42a805[_0x65f6('0x1d')][_0x4638c9['id']],_0x4638c9);}}}return _0x42a805['vtigerAccounts'];};};Realtime[_0x65f6('0x39')][_0x65f6('0x48')]=function(){var _0x5c55e4=this;return function(_0x28682b){if(_0x28682b){freeIsNotKey(_0x28682b,_0x5c55e4[_0x65f6('0x1e')],'id');for(var _0x36c316=0x0,_0x51549d={};_0x36c316<_0x28682b[_0x65f6('0x3d')];_0x36c316+=0x1){_0x51549d=_0x28682b[_0x36c316];if(_[_0x65f6('0x3f')](_0x5c55e4[_0x65f6('0x1e')][_0x51549d['id']])){_0x5c55e4[_0x65f6('0x1e')][_0x51549d['id']]=new ServicenowAccount(_0x51549d);}else{_0x5c55e4[_0x65f6('0x3a')](_0x5c55e4[_0x65f6('0x1e')][_0x51549d['id']],_0x51549d);}}}return _0x5c55e4['servicenowAccounts'];};};Realtime['prototype']['initDynamics365Accounts']=function(){var _0x336a7d=this;return function(_0x367d95){if(_0x367d95){freeIsNotKey(_0x367d95,_0x336a7d[_0x65f6('0x1f')],'id');for(var _0x471bec=0x0,_0xab6f0={};_0x471bec<_0x367d95[_0x65f6('0x3d')];_0x471bec+=0x1){_0xab6f0=_0x367d95[_0x471bec];if(_['isUndefined'](_0x336a7d[_0x65f6('0x1f')][_0xab6f0['id']])){_0x336a7d[_0x65f6('0x1f')][_0xab6f0['id']]=new Dynamics365Account(_0xab6f0);}else{_0x336a7d['mergeFromDatabase'](_0x336a7d[_0x65f6('0x1f')][_0xab6f0['id']],_0xab6f0);}}}return _0x336a7d[_0x65f6('0x1f')];};};Realtime[_0x65f6('0x39')]['initFreshsalesAccounts']=function(){var _0x23c441=this;return function(_0x448c9a){if(_0x448c9a){freeIsNotKey(_0x448c9a,_0x23c441['freshsalesAccounts'],'id');for(var _0x271d76=0x0,_0x3edc6b={};_0x271d76<_0x448c9a[_0x65f6('0x3d')];_0x271d76+=0x1){_0x3edc6b=_0x448c9a[_0x271d76];if(_[_0x65f6('0x3f')](_0x23c441[_0x65f6('0x49')][_0x3edc6b['id']])){_0x23c441[_0x65f6('0x49')][_0x3edc6b['id']]=new FreshsalesAccount(_0x3edc6b);}else{_0x23c441[_0x65f6('0x3a')](_0x23c441['freshsalesAccounts'][_0x3edc6b['id']],_0x3edc6b);}}}return _0x23c441['freshsalesAccounts'];};};Realtime[_0x65f6('0x39')][_0x65f6('0x4a')]=function(){var _0x4a9524=this;return function(_0x417ba5){for(var _0x5f3df9=0x0;_0x5f3df9<_0x417ba5[_0x65f6('0x3d')];_0x5f3df9+=0x1){_['merge'](_0x4a9524[_0x65f6('0x11')][_0x417ba5[_0x5f3df9][_0x65f6('0x3e')]],_0x417ba5[_0x5f3df9]);}return _0x4a9524[_0x65f6('0x11')];};};Realtime[_0x65f6('0x39')][_0x65f6('0x4b')]=function(){var _0x264e6c=this;return function(_0x1aaf75){clearVoiceQueues(_0x264e6c[_0x65f6('0x11')]);if(_0x1aaf75){_0x1aaf75=_[_0x65f6('0x4c')](_0x1aaf75,'uniqueid');for(var _0x480190 in _0x1aaf75){if(_0x1aaf75[_0x65f6('0x22')](_0x480190)){for(var _0x13ee4b=0x0;_0x13ee4b<_0x1aaf75[_0x480190][_0x65f6('0x3d')];_0x13ee4b+=0x1){var _0x51497f=_0x1aaf75[_0x480190][_0x13ee4b]['queue'];if(_0x264e6c[_0x65f6('0x11')][_0x51497f]){if(_0x1aaf75[_0x480190][_0x13ee4b][_0x65f6('0x4d')]){_0x264e6c[_0x65f6('0x11')][_0x51497f][_0x65f6('0x2c')]+=0x1;}if(_0x1aaf75[_0x480190][_0x13ee4b][_0x65f6('0x4e')]){_0x264e6c[_0x65f6('0x11')][_0x51497f]['abandoned']+=0x1;}_0x264e6c['voiceQueues'][_0x51497f][_0x65f6('0x28')]+=moment(_0x1aaf75[_0x480190][_0x13ee4b][_0x65f6('0x4f')])['diff'](moment(_0x1aaf75[_0x480190][_0x13ee4b][_0x65f6('0x50')]),'seconds')||0x0;if(_0x13ee4b===_0x1aaf75[_0x480190][_0x65f6('0x3d')]-0x1){_0x264e6c[_0x65f6('0x11')][_0x51497f][_0x65f6('0x51')]+=moment(_0x1aaf75[_0x480190][_0x13ee4b][_0x65f6('0x52')]||_0x1aaf75[_0x480190][_0x13ee4b]['queuecallerabandonAt']||_0x1aaf75[_0x480190][_0x13ee4b][_0x65f6('0x53')])[_0x65f6('0x54')](moment(_0x1aaf75[_0x480190][_0x13ee4b][_0x65f6('0x50')]),'seconds')||0x0;_0x264e6c['voiceQueues'][_0x51497f][_0x65f6('0x26')]+=0x1;if(_0x1aaf75[_0x480190][_0x13ee4b]['queuecallercomplete']){_0x264e6c[_0x65f6('0x11')][_0x51497f][_0x65f6('0x27')]+=0x1;_0x264e6c[_0x65f6('0x11')][_0x51497f][_0x65f6('0x29')]+=moment(_0x1aaf75[_0x480190][_0x13ee4b]['queuecallercompleteAt'])['diff'](moment(_0x1aaf75[_0x480190][_0x13ee4b]['queuecallerleaveAt']),_0x65f6('0x55'))||0x0;}}else{_0x264e6c[_0x65f6('0x11')][_0x51497f][_0x65f6('0x51')]+=_0x264e6c['voiceQueues'][_0x51497f][_0x65f6('0x28')]||0x0;}}}}}}return _0x264e6c[_0x65f6('0x11')];};};Realtime[_0x65f6('0x39')]['initVoiceCallReports']=function(){var _0x40d0f7=this;return function(_0x15809e){clearVoiceCallReports(_0x40d0f7['outbound']);if(_0x15809e){for(var _0x758e80=0x0;_0x758e80<_0x15809e[_0x65f6('0x3d')];_0x758e80+=0x1){_0x40d0f7['outbound'][_0x65f6('0x26')]+=0x1;_0x40d0f7['outbound'][_0x65f6('0x51')]+=_0x15809e[_0x758e80]['duration'];if(_0x15809e[_0x758e80][_0x65f6('0x56')]===_0x65f6('0x57')){_0x40d0f7['outbound'][_0x65f6('0x27')]+=0x1;_0x40d0f7[_0x65f6('0x58')][_0x65f6('0x28')]+=_0x15809e[_0x758e80][_0x65f6('0x59')]-_0x15809e[_0x758e80][_0x65f6('0x5a')]||0x0;_0x40d0f7[_0x65f6('0x58')][_0x65f6('0x29')]+=_0x15809e[_0x758e80][_0x65f6('0x5a')];}}}return _0x40d0f7[_0x65f6('0x58')];};};Realtime[_0x65f6('0x39')][_0x65f6('0x5b')]=function(){var _0x574d84=this;return function(_0x10a661){if(_0x10a661){freeIsNotKey(_0x10a661,_0x574d84[_0x65f6('0x5c')],_0x65f6('0x3e'));for(var _0x219e42=0x0,_0x5694f9={};_0x219e42<_0x10a661[_0x65f6('0x3d')];_0x219e42+=0x1){_0x5694f9=_0x10a661[_0x219e42];if(_[_0x65f6('0x3f')](_0x574d84['campaigns'][_0x5694f9[_0x65f6('0x3e')]])){_0x574d84['campaigns'][_0x5694f9[_0x65f6('0x3e')]]=new Campaign(_0x5694f9);}else{_0x574d84['mergeFromDatabase'](_0x574d84[_0x65f6('0x5c')][_0x5694f9[_0x65f6('0x3e')]],_0x5694f9);_0x574d84['campaigns'][_0x5694f9['name']][_0x65f6('0x5d')]=_0x5694f9[_0x65f6('0x5e')]?_0x5694f9['SquareProject'][_0x65f6('0x3e')]:undefined;}}}return _0x574d84[_0x65f6('0x5c')];};};Realtime[_0x65f6('0x39')]['initVoiceExtensions']=function(){var _0x1348ec=this;return function(_0x246510){if(_0x246510){freeIsNotKey(_0x246510,_0x1348ec['voiceExtensions'],'id');for(var _0x36b8de=0x0,_0x504b39={};_0x36b8de<_0x246510[_0x65f6('0x3d')];_0x36b8de+=0x1){_0x504b39=_0x246510[_0x36b8de];if(_['isUndefined'](_0x1348ec['voiceExtensions'][_0x504b39['id']])){_0x1348ec[_0x65f6('0x5f')][_0x504b39['id']]=new VoiceExtension(_0x504b39);}else{_0x1348ec[_0x65f6('0x3a')](_0x1348ec[_0x65f6('0x5f')][_0x504b39['id']],_0x504b39);}}}return _0x1348ec[_0x65f6('0x5f')];};};Realtime[_0x65f6('0x39')][_0x65f6('0x60')]=function(){var _0x1ac46f=this;return function(_0x1f4e2c){clearCampaigns(_0x1ac46f['campaigns']);for(var _0x494904=0x0;_0x494904<_0x1f4e2c[_0x65f6('0x3d')];_0x494904+=0x1){_['merge'](_0x1ac46f[_0x65f6('0x5c')][_0x1f4e2c[_0x494904][_0x65f6('0x3e')]],_0x1f4e2c[_0x494904]);}return _0x1ac46f[_0x65f6('0x5c')];};};Realtime[_0x65f6('0x39')][_0x65f6('0x61')]=function(){var _0x56bd9d=this;return function(_0x398cac){if(_0x398cac){freeIsNotKey(_0x398cac,_0x56bd9d[_0x65f6('0x20')],'id');for(var _0x14c908=0x0,_0x576ecd={};_0x14c908<_0x398cac[_0x65f6('0x3d')];_0x14c908+=0x1){_0x576ecd=_0x398cac[_0x14c908];if(_[_0x65f6('0x3f')](_0x56bd9d[_0x65f6('0x20')][_0x576ecd['id']])){_0x56bd9d[_0x65f6('0x20')][_0x576ecd['id']]=new FaxAccount(_0x576ecd);}else{_0x56bd9d[_0x65f6('0x3a')](_0x56bd9d[_0x65f6('0x20')][_0x576ecd['id']],_0x576ecd);}}}return _0x56bd9d['faxAccounts'];};};Realtime['prototype'][_0x65f6('0x62')]=function(){var _0x10d744=this;return function(_0x10c916){if(_0x10c916){freeIsNotKey(_0x10c916,_0x10d744[_0x65f6('0x11')],'name');for(var _0x4bda86=0x0,_0x336076={};_0x4bda86<_0x10c916[_0x65f6('0x3d')];_0x4bda86+=0x1){_0x336076=_0x10c916[_0x4bda86];if(_[_0x65f6('0x3f')](_0x10d744[_0x65f6('0x11')][_0x336076[_0x65f6('0x3e')]])){_0x10d744[_0x65f6('0x11')][_0x336076['name']]=new VoiceQueue(_0x336076);}else{_0x10d744['mergeFromDatabase'](_0x10d744['voiceQueues'][_0x336076[_0x65f6('0x3e')]],_0x336076);}}}return _0x10d744[_0x65f6('0x11')];};};module[_0x65f6('0x63')]=Realtime; \ No newline at end of file +var _0xb10b=['../model/voiceExtension','../model/zendeskAccount','../model/freshdeskAccount','../model/sugarcrmAccount','../model/deskAccount','../model/vtigerAccount','../model/servicenowAccount','../model/dynamics365Account','../model/freshsalesAccount','../model/faxAccount','agents','telephones','triggers','campaigns','templates','voiceExtensions','queueChannels','outboundChannels','timers','settings','zendeskAccounts','salesforceAccounts','freshdeskAccounts','zohoAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','faxAccounts','mapKeys','hasOwnProperty','SIP/%s','name','interface','format','total','answered','sumHoldTime','sumDuration','ivrTotalCallsDays','isEmpty','unmanaged','sumBillable','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundNoSuchCallsDay','outboundDropCallsDayTimeout','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundAnswerCallsDay','queueStatusComplete','mergeFromDatabase','prototype','initAgents','length','isNil','isUndefined','initTelephones','trunks','initTemplates','initZendeskAccounts','initSalesforceAccounts','initFreshdeskAccounts','initDeskAccounts','initSugarcrmAccounts','sugarcrmAccounts','initVtigerAccounts','initVoiceQueueHopperHistory','voiceQueues','groupBy','uniqueid','queue','queuecallerexit','abandoned','queuecallerleaveAt','diff','seconds','queuecallercompleteAt','queuecallerabandonAt','queuecallerexitAt','queuecallercomplete','initVoiceCallReports','outbound','duration','billableseconds','initCampaigns','dialQueueProject','initCampaignHopperHistory','merge','initFaxAccounts','initVoiceQueues','lodash','util','../model/agent','../model/telephone','../model/voiceQueue','../model/trigger','../model/template','../model/campaign'];(function(_0x3b06c8,_0x397e2f){var _0x57beed=function(_0x1c71cb){while(--_0x1c71cb){_0x3b06c8['push'](_0x3b06c8['shift']());}};_0x57beed(++_0x397e2f);}(_0xb10b,0x12a));var _0xbb10=function(_0x532b5b,_0xce6ec8){_0x532b5b=_0x532b5b-0x0;var _0x169ff9=_0xb10b[_0x532b5b];return _0x169ff9;};'use strict';var _=require(_0xbb10('0x0'));var moment=require('moment');var util=require(_0xbb10('0x1'));var Agent=require(_0xbb10('0x2'));var Telephone=require(_0xbb10('0x3'));var Trunk=require('../model/trunk');var VoiceQueue=require(_0xbb10('0x4'));var Trigger=require(_0xbb10('0x5'));var Template=require(_0xbb10('0x6'));var Campaign=require(_0xbb10('0x7'));var VoiceExtension=require(_0xbb10('0x8'));var ZendeskAccount=require(_0xbb10('0x9'));var SalesforceAccount=require('../model/salesforceAccount');var FreshdeskAccount=require(_0xbb10('0xa'));var SugarcrmAccount=require(_0xbb10('0xb'));var ZohoAccount=require('../model/zohoAccount');var DeskAccount=require(_0xbb10('0xc'));var VtigerAccount=require(_0xbb10('0xd'));var ServicenowAccount=require(_0xbb10('0xe'));var Dynamics365Account=require(_0xbb10('0xf'));var FreshsalesAccount=require(_0xbb10('0x10'));var FaxAccount=require(_0xbb10('0x11'));function Realtime(){this[_0xbb10('0x12')]={};this[_0xbb10('0x13')]={};this['trunks']={};this['voiceQueues']={};this[_0xbb10('0x14')]={};this[_0xbb10('0x15')]={};this[_0xbb10('0x16')]={};this['outbound']={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this[_0xbb10('0x17')]={};this['channels']={};this[_0xbb10('0x18')]={};this[_0xbb10('0x19')]={};this[_0xbb10('0x1a')]={};this[_0xbb10('0x1b')]={};this[_0xbb10('0x1c')]={};this[_0xbb10('0x1d')]={};this['sugarcrmAccounts']={};this[_0xbb10('0x1e')]={};this[_0xbb10('0x1f')]={};this[_0xbb10('0x20')]={};this[_0xbb10('0x21')]={};this[_0xbb10('0x22')]={};this[_0xbb10('0x23')]={};this[_0xbb10('0x24')]={};this[_0xbb10('0x25')]={};}function freeIsNotKey(_0x3e26f4,_0x2b184e,_0x4a2bfc){var _0x2eca0f=_[_0xbb10('0x26')](_0x3e26f4,function(_0x133ac2){return _0x133ac2[_0x4a2bfc];});for(var _0x42db98 in _0x2b184e){if(_0x2b184e[_0xbb10('0x27')](_0x42db98)){if(!_0x2eca0f[_0x42db98]){delete _0x2b184e[_0x42db98];}}}}function freeIsNotKeySip(_0x1682a4,_0x575cca){var _0x30efc6=_[_0xbb10('0x26')](_0x1682a4,function(_0xe1c665){return util['format'](_0xbb10('0x28'),_0xe1c665[_0xbb10('0x29')]);});for(var _0x388fab in _0x575cca){if(_0x575cca[_0xbb10('0x27')](_0x388fab)){if(!_0x30efc6[_0x388fab]){delete _0x575cca[_0x388fab];}}}}function freeIsNotKeyAgent(_0xdf237d,_0x44e563){var _0x4deb49=_[_0xbb10('0x26')](_0xdf237d,function(_0x12ef77){var _0x50aea1=_['isNil'](_0x12ef77[_0xbb10('0x2a')])?util[_0xbb10('0x2b')](_0xbb10('0x28'),_0x12ef77[_0xbb10('0x29')]):_0x12ef77[_0xbb10('0x2a')];return _0x50aea1;});for(var _0x1824b7 in _0x44e563){if(_0x44e563[_0xbb10('0x27')](_0x1824b7)){if(!_0x4deb49[_0x1824b7]){delete _0x44e563[_0x1824b7];}}}}function clearVoiceCallReports(_0x436104){_0x436104[_0xbb10('0x2c')]=0x0;_0x436104[_0xbb10('0x2d')]=0x0;_0x436104[_0xbb10('0x2e')]=0x0;_0x436104[_0xbb10('0x2f')]=0x0;_0x436104['sumBillable']=0x0;}function clearCampaigns(_0x4fedac){if(!_['isEmpty'](_0x4fedac)){for(var _0xc93a04 in _0x4fedac){if(_0x4fedac[_0xbb10('0x27')](_0xc93a04)){_0x4fedac[_0xc93a04][_0xbb10('0x30')]=0x0;_0x4fedac[_0xc93a04]['ivrAnswerCallsDay']=0x0;}}}}function clearVoiceQueues(_0x2fdde9){if(!_[_0xbb10('0x31')](_0x2fdde9)){for(var _0x6ed43b in _0x2fdde9){if(_0x2fdde9[_0xbb10('0x27')](_0x6ed43b)){_0x2fdde9[_0x6ed43b][_0xbb10('0x2c')]=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x2d')]=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x32')]=0x0;_0x2fdde9[_0x6ed43b]['abandoned']=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x2e')]=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x2f')]=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x33')]=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x34')]=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x35')]=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x36')]=0x0;_0x2fdde9[_0x6ed43b]['outboundCongestionCallsDay']=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x37')]=0x0;_0x2fdde9[_0x6ed43b]['outboundUnknownCallsDay']=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x38')]=0x0;_0x2fdde9[_0x6ed43b]['outboundDropCallsDayCallersExit']=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x39')]=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x3a')]=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x3b')]=0x0;_0x2fdde9[_0x6ed43b]['outboundReCallsDay']=0x0;_0x2fdde9[_0x6ed43b]['outboundAnswerAgiCallsDay']=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x3c')]=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x3d')]=!![];}}}}Realtime['prototype'][_0xbb10('0x3e')]=function(_0x37dde7,_0x2f653f){for(var _0x1c0b57 in _0x2f653f){if(_0x37dde7[_0xbb10('0x27')](_0x1c0b57)){_0x37dde7[_0x1c0b57]=_0x2f653f[_0x1c0b57];}}};Realtime[_0xbb10('0x3f')][_0xbb10('0x40')]=function(){var _0x4975f5=this;return function(_0x25acb3){if(_0x25acb3){freeIsNotKeyAgent(_0x25acb3,_0x4975f5[_0xbb10('0x12')]);for(var _0x441d15=0x0,_0x8c1ce6={};_0x441d15<_0x25acb3[_0xbb10('0x41')];_0x441d15+=0x1){_0x8c1ce6=_0x25acb3[_0x441d15];var _0x9de708=_[_0xbb10('0x42')](_0x8c1ce6[_0xbb10('0x2a')])?util[_0xbb10('0x2b')]('SIP/%s',_0x8c1ce6[_0xbb10('0x29')]):_0x8c1ce6[_0xbb10('0x2a')];if(_[_0xbb10('0x43')](_0x4975f5[_0xbb10('0x12')][_0x9de708])){_0x4975f5['agents'][_0x9de708]=new Agent(_0x8c1ce6);}else{_0x4975f5[_0xbb10('0x3e')](_0x4975f5['agents'][_0x9de708],_0x8c1ce6);}}}return _0x4975f5['agents'];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x44')]=function(){var _0x26e76a=this;return function(_0x120d21){if(_0x120d21){freeIsNotKeySip(_0x120d21,_0x26e76a[_0xbb10('0x13')]);for(var _0x29d11a=0x0,_0x547062={};_0x29d11a<_0x120d21[_0xbb10('0x41')];_0x29d11a+=0x1){_0x547062=_0x120d21[_0x29d11a];if(_[_0xbb10('0x43')](_0x26e76a['telephones'][util['format']('SIP/%s',_0x547062[_0xbb10('0x29')])])){_0x26e76a[_0xbb10('0x13')][util[_0xbb10('0x2b')]('SIP/%s',_0x547062[_0xbb10('0x29')])]=new Telephone(_0x547062);}else{_0x26e76a[_0xbb10('0x3e')](_0x26e76a[_0xbb10('0x13')][util['format'](_0xbb10('0x28'),_0x547062[_0xbb10('0x29')])],_0x547062);}}}return _0x26e76a[_0xbb10('0x13')];};};Realtime[_0xbb10('0x3f')]['initTrunks']=function(){var _0xd238e9=this;return function(_0x110eb5){if(_0x110eb5){freeIsNotKeySip(_0x110eb5,_0xd238e9['trunks']);for(var _0xe2040f=0x0,_0x2e3214={};_0xe2040f<_0x110eb5[_0xbb10('0x41')];_0xe2040f+=0x1){_0x2e3214=_0x110eb5[_0xe2040f];if(_[_0xbb10('0x43')](_0xd238e9[_0xbb10('0x45')][util[_0xbb10('0x2b')]('SIP/%s',_0x2e3214[_0xbb10('0x29')])])){_0xd238e9[_0xbb10('0x45')][util[_0xbb10('0x2b')](_0xbb10('0x28'),_0x2e3214['name'])]=new Trunk(_0x2e3214);}else{_0xd238e9[_0xbb10('0x3e')](_0xd238e9[_0xbb10('0x45')][util[_0xbb10('0x2b')](_0xbb10('0x28'),_0x2e3214['name'])],_0x2e3214);}}}return _0xd238e9[_0xbb10('0x45')];};};Realtime[_0xbb10('0x3f')]['initTriggers']=function(){var _0x5d9a4f=this;return function(_0x38d78f){if(_0x38d78f){freeIsNotKey(_0x38d78f,_0x5d9a4f['triggers'],'id');for(var _0x318984=0x0,_0x180933={};_0x318984<_0x38d78f['length'];_0x318984+=0x1){_0x180933=_0x38d78f[_0x318984];if(_[_0xbb10('0x43')](_0x5d9a4f[_0xbb10('0x14')][_0x180933['id']])){_0x5d9a4f[_0xbb10('0x14')][_0x180933['id']]=new Trigger(_0x180933);}else{_0x5d9a4f['mergeFromDatabase'](_0x5d9a4f[_0xbb10('0x14')][_0x180933['id']],_0x180933);}}}return _0x5d9a4f[_0xbb10('0x14')];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x46')]=function(){var _0x36e1fa=this;return function(_0x19f94d){if(_0x19f94d){freeIsNotKey(_0x19f94d,_0x36e1fa[_0xbb10('0x16')],'id');for(var _0x3efa96=0x0,_0x205bb4={};_0x3efa96<_0x19f94d[_0xbb10('0x41')];_0x3efa96+=0x1){_0x205bb4=_0x19f94d[_0x3efa96];if(_[_0xbb10('0x43')](_0x36e1fa[_0xbb10('0x16')][_0x205bb4['id']])){_0x36e1fa['templates'][_0x205bb4['id']]=new Template(_0x205bb4);}else{_0x36e1fa[_0xbb10('0x3e')](_0x36e1fa[_0xbb10('0x16')][_0x205bb4['id']],_0x205bb4);}}}return _0x36e1fa['templates'];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x47')]=function(){var _0x1a7df6=this;return function(_0x5a5226){if(_0x5a5226){freeIsNotKey(_0x5a5226,_0x1a7df6[_0xbb10('0x1c')],'id');for(var _0x39f0de=0x0,_0x3e06b0={};_0x39f0de<_0x5a5226['length'];_0x39f0de+=0x1){_0x3e06b0=_0x5a5226[_0x39f0de];if(_['isUndefined'](_0x1a7df6[_0xbb10('0x1c')][_0x3e06b0['id']])){_0x1a7df6[_0xbb10('0x1c')][_0x3e06b0['id']]=new ZendeskAccount(_0x3e06b0);}else{_0x1a7df6[_0xbb10('0x3e')](_0x1a7df6['zendeskAccounts'][_0x3e06b0['id']],_0x3e06b0);}}}return _0x1a7df6['zendeskAccounts'];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x48')]=function(){var _0x1bd054=this;return function(_0xf820fe){if(_0xf820fe){freeIsNotKey(_0xf820fe,_0x1bd054[_0xbb10('0x1d')],'id');for(var _0x22b315=0x0,_0x2f2552={};_0x22b315<_0xf820fe[_0xbb10('0x41')];_0x22b315+=0x1){_0x2f2552=_0xf820fe[_0x22b315];if(_[_0xbb10('0x43')](_0x1bd054[_0xbb10('0x1d')][_0x2f2552['id']])){_0x1bd054['salesforceAccounts'][_0x2f2552['id']]=new SalesforceAccount(_0x2f2552);}else{_0x1bd054['mergeFromDatabase'](_0x1bd054[_0xbb10('0x1d')][_0x2f2552['id']],_0x2f2552);}}}return _0x1bd054[_0xbb10('0x1d')];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x49')]=function(){var _0x36aa7d=this;return function(_0x440f9e){if(_0x440f9e){freeIsNotKey(_0x440f9e,_0x36aa7d[_0xbb10('0x1e')],'id');for(var _0x445870=0x0,_0x1c0d8f={};_0x445870<_0x440f9e[_0xbb10('0x41')];_0x445870+=0x1){_0x1c0d8f=_0x440f9e[_0x445870];if(_[_0xbb10('0x43')](_0x36aa7d[_0xbb10('0x1e')][_0x1c0d8f['id']])){_0x36aa7d[_0xbb10('0x1e')][_0x1c0d8f['id']]=new FreshdeskAccount(_0x1c0d8f);}else{_0x36aa7d[_0xbb10('0x3e')](_0x36aa7d[_0xbb10('0x1e')][_0x1c0d8f['id']],_0x1c0d8f);}}}return _0x36aa7d['freshdeskAccounts'];};};Realtime[_0xbb10('0x3f')]['initZohoAccounts']=function(){var _0x33d60a=this;return function(_0x2e21a0){if(_0x2e21a0){freeIsNotKey(_0x2e21a0,_0x33d60a[_0xbb10('0x1f')],'id');for(var _0x3f27ce=0x0,_0x26e66e={};_0x3f27ce<_0x2e21a0[_0xbb10('0x41')];_0x3f27ce+=0x1){_0x26e66e=_0x2e21a0[_0x3f27ce];if(_[_0xbb10('0x43')](_0x33d60a[_0xbb10('0x1f')][_0x26e66e['id']])){_0x33d60a[_0xbb10('0x1f')][_0x26e66e['id']]=new ZohoAccount(_0x26e66e);}else{_0x33d60a[_0xbb10('0x3e')](_0x33d60a[_0xbb10('0x1f')][_0x26e66e['id']],_0x26e66e);}}}return _0x33d60a[_0xbb10('0x1f')];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x4a')]=function(){var _0x4475e1=this;return function(_0x5de0cc){if(_0x5de0cc){freeIsNotKey(_0x5de0cc,_0x4475e1[_0xbb10('0x20')],'id');for(var _0x466eb7=0x0,_0x1b83a9={};_0x466eb7<_0x5de0cc[_0xbb10('0x41')];_0x466eb7+=0x1){_0x1b83a9=_0x5de0cc[_0x466eb7];if(_[_0xbb10('0x43')](_0x4475e1[_0xbb10('0x20')][_0x1b83a9['id']])){_0x4475e1['deskAccounts'][_0x1b83a9['id']]=new DeskAccount(_0x1b83a9);}else{_0x4475e1[_0xbb10('0x3e')](_0x4475e1[_0xbb10('0x20')][_0x1b83a9['id']],_0x1b83a9);}}}return _0x4475e1[_0xbb10('0x20')];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x4b')]=function(){var _0x22de7f=this;return function(_0x175872){if(_0x175872){freeIsNotKey(_0x175872,_0x22de7f[_0xbb10('0x4c')],'id');for(var _0x205e01=0x0,_0x40c4fb={};_0x205e01<_0x175872[_0xbb10('0x41')];_0x205e01+=0x1){_0x40c4fb=_0x175872[_0x205e01];if(_[_0xbb10('0x43')](_0x22de7f[_0xbb10('0x4c')][_0x40c4fb['id']])){_0x22de7f['sugarcrmAccounts'][_0x40c4fb['id']]=new SugarcrmAccount(_0x40c4fb);}else{_0x22de7f['mergeFromDatabase'](_0x22de7f[_0xbb10('0x4c')][_0x40c4fb['id']],_0x40c4fb);}}}return _0x22de7f[_0xbb10('0x4c')];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x4d')]=function(){var _0x5573bb=this;return function(_0x506498){if(_0x506498){freeIsNotKey(_0x506498,_0x5573bb[_0xbb10('0x21')],'id');for(var _0xaf2cc3=0x0,_0x410bef={};_0xaf2cc3<_0x506498[_0xbb10('0x41')];_0xaf2cc3+=0x1){_0x410bef=_0x506498[_0xaf2cc3];if(_[_0xbb10('0x43')](_0x5573bb[_0xbb10('0x21')][_0x410bef['id']])){_0x5573bb[_0xbb10('0x21')][_0x410bef['id']]=new VtigerAccount(_0x410bef);}else{_0x5573bb['mergeFromDatabase'](_0x5573bb[_0xbb10('0x21')][_0x410bef['id']],_0x410bef);}}}return _0x5573bb[_0xbb10('0x21')];};};Realtime['prototype']['initServicenowAccounts']=function(){var _0x5a231f=this;return function(_0x32c1e8){if(_0x32c1e8){freeIsNotKey(_0x32c1e8,_0x5a231f[_0xbb10('0x22')],'id');for(var _0x155dc5=0x0,_0x5bd1c0={};_0x155dc5<_0x32c1e8['length'];_0x155dc5+=0x1){_0x5bd1c0=_0x32c1e8[_0x155dc5];if(_['isUndefined'](_0x5a231f[_0xbb10('0x22')][_0x5bd1c0['id']])){_0x5a231f[_0xbb10('0x22')][_0x5bd1c0['id']]=new ServicenowAccount(_0x5bd1c0);}else{_0x5a231f[_0xbb10('0x3e')](_0x5a231f['servicenowAccounts'][_0x5bd1c0['id']],_0x5bd1c0);}}}return _0x5a231f[_0xbb10('0x22')];};};Realtime[_0xbb10('0x3f')]['initDynamics365Accounts']=function(){var _0x4a560c=this;return function(_0x27d7b9){if(_0x27d7b9){freeIsNotKey(_0x27d7b9,_0x4a560c[_0xbb10('0x23')],'id');for(var _0xd77753=0x0,_0x237246={};_0xd77753<_0x27d7b9['length'];_0xd77753+=0x1){_0x237246=_0x27d7b9[_0xd77753];if(_[_0xbb10('0x43')](_0x4a560c[_0xbb10('0x23')][_0x237246['id']])){_0x4a560c[_0xbb10('0x23')][_0x237246['id']]=new Dynamics365Account(_0x237246);}else{_0x4a560c['mergeFromDatabase'](_0x4a560c[_0xbb10('0x23')][_0x237246['id']],_0x237246);}}}return _0x4a560c[_0xbb10('0x23')];};};Realtime[_0xbb10('0x3f')]['initFreshsalesAccounts']=function(){var _0x2ca491=this;return function(_0x31e85e){if(_0x31e85e){freeIsNotKey(_0x31e85e,_0x2ca491[_0xbb10('0x24')],'id');for(var _0x37b65f=0x0,_0x5e4a6e={};_0x37b65f<_0x31e85e[_0xbb10('0x41')];_0x37b65f+=0x1){_0x5e4a6e=_0x31e85e[_0x37b65f];if(_[_0xbb10('0x43')](_0x2ca491[_0xbb10('0x24')][_0x5e4a6e['id']])){_0x2ca491[_0xbb10('0x24')][_0x5e4a6e['id']]=new FreshsalesAccount(_0x5e4a6e);}else{_0x2ca491['mergeFromDatabase'](_0x2ca491[_0xbb10('0x24')][_0x5e4a6e['id']],_0x5e4a6e);}}}return _0x2ca491[_0xbb10('0x24')];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x4e')]=function(){var _0x12f750=this;return function(_0x17807e){for(var _0x1e4694=0x0;_0x1e4694<_0x17807e['length'];_0x1e4694+=0x1){_['merge'](_0x12f750['voiceQueues'][_0x17807e[_0x1e4694][_0xbb10('0x29')]],_0x17807e[_0x1e4694]);}return _0x12f750[_0xbb10('0x4f')];};};Realtime[_0xbb10('0x3f')]['initVoiceQueueReports']=function(){var _0x5cd089=this;return function(_0x46f462){clearVoiceQueues(_0x5cd089[_0xbb10('0x4f')]);if(_0x46f462){_0x46f462=_[_0xbb10('0x50')](_0x46f462,_0xbb10('0x51'));for(var _0x260e06 in _0x46f462){if(_0x46f462[_0xbb10('0x27')](_0x260e06)){for(var _0x4cf2f3=0x0;_0x4cf2f3<_0x46f462[_0x260e06][_0xbb10('0x41')];_0x4cf2f3+=0x1){var _0x15fae2=_0x46f462[_0x260e06][_0x4cf2f3][_0xbb10('0x52')];if(_0x5cd089[_0xbb10('0x4f')][_0x15fae2]){if(_0x46f462[_0x260e06][_0x4cf2f3][_0xbb10('0x53')]){_0x5cd089['voiceQueues'][_0x15fae2]['unmanaged']+=0x1;}if(_0x46f462[_0x260e06][_0x4cf2f3]['queuecallerabandon']){_0x5cd089[_0xbb10('0x4f')][_0x15fae2][_0xbb10('0x54')]+=0x1;}_0x5cd089[_0xbb10('0x4f')][_0x15fae2][_0xbb10('0x2e')]+=moment(_0x46f462[_0x260e06][_0x4cf2f3][_0xbb10('0x55')])[_0xbb10('0x56')](moment(_0x46f462[_0x260e06][_0x4cf2f3]['queuecallerjoinAt']),_0xbb10('0x57'))||0x0;if(_0x4cf2f3===_0x46f462[_0x260e06]['length']-0x1){_0x5cd089['voiceQueues'][_0x15fae2]['sumDuration']+=moment(_0x46f462[_0x260e06][_0x4cf2f3][_0xbb10('0x58')]||_0x46f462[_0x260e06][_0x4cf2f3][_0xbb10('0x59')]||_0x46f462[_0x260e06][_0x4cf2f3][_0xbb10('0x5a')])[_0xbb10('0x56')](moment(_0x46f462[_0x260e06][_0x4cf2f3]['queuecallerjoinAt']),_0xbb10('0x57'))||0x0;_0x5cd089['voiceQueues'][_0x15fae2]['total']+=0x1;if(_0x46f462[_0x260e06][_0x4cf2f3][_0xbb10('0x5b')]){_0x5cd089[_0xbb10('0x4f')][_0x15fae2][_0xbb10('0x2d')]+=0x1;_0x5cd089[_0xbb10('0x4f')][_0x15fae2][_0xbb10('0x33')]+=moment(_0x46f462[_0x260e06][_0x4cf2f3]['queuecallercompleteAt'])[_0xbb10('0x56')](moment(_0x46f462[_0x260e06][_0x4cf2f3][_0xbb10('0x55')]),_0xbb10('0x57'))||0x0;}}else{_0x5cd089[_0xbb10('0x4f')][_0x15fae2][_0xbb10('0x2f')]+=_0x5cd089[_0xbb10('0x4f')][_0x15fae2][_0xbb10('0x2e')]||0x0;}}}}}}return _0x5cd089['voiceQueues'];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x5c')]=function(){var _0x30f3ea=this;return function(_0x322b41){clearVoiceCallReports(_0x30f3ea[_0xbb10('0x5d')]);if(_0x322b41){for(var _0x172be3=0x0;_0x172be3<_0x322b41[_0xbb10('0x41')];_0x172be3+=0x1){_0x30f3ea[_0xbb10('0x5d')]['total']+=0x1;_0x30f3ea[_0xbb10('0x5d')][_0xbb10('0x2f')]+=_0x322b41[_0x172be3][_0xbb10('0x5e')];if(_0x322b41[_0x172be3]['disposition']==='ANSWERED'){_0x30f3ea['outbound'][_0xbb10('0x2d')]+=0x1;_0x30f3ea['outbound']['sumHoldTime']+=_0x322b41[_0x172be3][_0xbb10('0x5e')]-_0x322b41[_0x172be3][_0xbb10('0x5f')]||0x0;_0x30f3ea[_0xbb10('0x5d')][_0xbb10('0x33')]+=_0x322b41[_0x172be3][_0xbb10('0x5f')];}}}return _0x30f3ea[_0xbb10('0x5d')];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x60')]=function(){var _0x188b97=this;return function(_0x5206e1){if(_0x5206e1){freeIsNotKey(_0x5206e1,_0x188b97[_0xbb10('0x15')],_0xbb10('0x29'));for(var _0x46b6d2=0x0,_0x35b811={};_0x46b6d2<_0x5206e1['length'];_0x46b6d2+=0x1){_0x35b811=_0x5206e1[_0x46b6d2];if(_['isUndefined'](_0x188b97[_0xbb10('0x15')][_0x35b811[_0xbb10('0x29')]])){_0x188b97[_0xbb10('0x15')][_0x35b811[_0xbb10('0x29')]]=new Campaign(_0x35b811);}else{_0x188b97['mergeFromDatabase'](_0x188b97[_0xbb10('0x15')][_0x35b811[_0xbb10('0x29')]],_0x35b811);_0x188b97[_0xbb10('0x15')][_0x35b811[_0xbb10('0x29')]][_0xbb10('0x61')]=_0x35b811['SquareProject']?_0x35b811['SquareProject'][_0xbb10('0x29')]:undefined;}}}return _0x188b97[_0xbb10('0x15')];};};Realtime[_0xbb10('0x3f')]['initVoiceExtensions']=function(){var _0x256b35=this;return function(_0x13e2ab){if(_0x13e2ab){freeIsNotKey(_0x13e2ab,_0x256b35['voiceExtensions'],'id');for(var _0x5caa06=0x0,_0x2f667f={};_0x5caa06<_0x13e2ab[_0xbb10('0x41')];_0x5caa06+=0x1){_0x2f667f=_0x13e2ab[_0x5caa06];if(_[_0xbb10('0x43')](_0x256b35['voiceExtensions'][_0x2f667f['id']])){_0x256b35[_0xbb10('0x17')][_0x2f667f['id']]=new VoiceExtension(_0x2f667f);}else{_0x256b35[_0xbb10('0x3e')](_0x256b35[_0xbb10('0x17')][_0x2f667f['id']],_0x2f667f);}}}return _0x256b35[_0xbb10('0x17')];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x62')]=function(){var _0x45bd4e=this;return function(_0x226363){clearCampaigns(_0x45bd4e[_0xbb10('0x15')]);for(var _0x479d51=0x0;_0x479d51<_0x226363[_0xbb10('0x41')];_0x479d51+=0x1){_[_0xbb10('0x63')](_0x45bd4e[_0xbb10('0x15')][_0x226363[_0x479d51][_0xbb10('0x29')]],_0x226363[_0x479d51]);}return _0x45bd4e[_0xbb10('0x15')];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x64')]=function(){var _0x305d52=this;return function(_0x17ed20){if(_0x17ed20){freeIsNotKey(_0x17ed20,_0x305d52[_0xbb10('0x25')],'id');for(var _0x15e043=0x0,_0x2a4278={};_0x15e043<_0x17ed20['length'];_0x15e043+=0x1){_0x2a4278=_0x17ed20[_0x15e043];if(_['isUndefined'](_0x305d52[_0xbb10('0x25')][_0x2a4278['id']])){_0x305d52[_0xbb10('0x25')][_0x2a4278['id']]=new FaxAccount(_0x2a4278);}else{_0x305d52[_0xbb10('0x3e')](_0x305d52[_0xbb10('0x25')][_0x2a4278['id']],_0x2a4278);}}}return _0x305d52[_0xbb10('0x25')];};};Realtime['prototype'][_0xbb10('0x65')]=function(){var _0x332fbe=this;return function(_0x3b4d0b){if(_0x3b4d0b){freeIsNotKey(_0x3b4d0b,_0x332fbe[_0xbb10('0x4f')],_0xbb10('0x29'));for(var _0x379d49=0x0,_0x546db5={};_0x379d49<_0x3b4d0b[_0xbb10('0x41')];_0x379d49+=0x1){_0x546db5=_0x3b4d0b[_0x379d49];if(_[_0xbb10('0x43')](_0x332fbe['voiceQueues'][_0x546db5[_0xbb10('0x29')]])){_0x332fbe['voiceQueues'][_0x546db5[_0xbb10('0x29')]]=new VoiceQueue(_0x546db5);}else{_0x332fbe[_0xbb10('0x3e')](_0x332fbe[_0xbb10('0x4f')][_0x546db5[_0xbb10('0x29')]],_0x546db5);}}}return _0x332fbe[_0xbb10('0x4f')];};};module['exports']=Realtime; \ No newline at end of file diff --git a/server/services/ami/realtime/utils.js b/server/services/ami/realtime/utils.js index d239b7b..3775322 100644 --- a/server/services/ami/realtime/utils.js +++ b/server/services/ami/realtime/utils.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4724=['hasOwnProperty','mergeDBDataToRealtime','assign'];(function(_0xcc27e3,_0xf159c4){var _0x1c4ba1=function(_0x4e2d8b){while(--_0x4e2d8b){_0xcc27e3['push'](_0xcc27e3['shift']());}};_0x1c4ba1(++_0xf159c4);}(_0x4724,0xc2));var _0x4472=function(_0x58379a,_0x1840de){_0x58379a=_0x58379a-0x0;var _0xf88d78=_0x4724[_0x58379a];return _0xf88d78;};'use strict';function mergeDBDataToRealtime(_0x589b21,_0x2d7c98){var _0x4965f6=Object[_0x4472('0x0')]({},_0x589b21);for(var _0x1fcacc in _0x2d7c98){if(_0x4965f6[_0x4472('0x1')](_0x1fcacc)){_0x4965f6[_0x1fcacc]=_0x2d7c98[_0x1fcacc];}}return _0x4965f6;}exports[_0x4472('0x2')]=mergeDBDataToRealtime; \ No newline at end of file +var _0xee4f=['mergeDBDataToRealtime','assign','hasOwnProperty'];(function(_0x3855fd,_0x26003f){var _0x226a53=function(_0x14186f){while(--_0x14186f){_0x3855fd['push'](_0x3855fd['shift']());}};_0x226a53(++_0x26003f);}(_0xee4f,0x1b4));var _0xfee4=function(_0x2e4dd3,_0x418e03){_0x2e4dd3=_0x2e4dd3-0x0;var _0x216815=_0xee4f[_0x2e4dd3];return _0x216815;};'use strict';function mergeDBDataToRealtime(_0x342e55,_0x5d4452){var _0x2d0cdc=Object[_0xfee4('0x0')]({},_0x342e55);for(var _0x2f7531 in _0x5d4452){if(_0x2d0cdc[_0xfee4('0x1')](_0x2f7531)){_0x2d0cdc[_0x2f7531]=_0x5d4452[_0x2f7531];}}return _0x2d0cdc;}exports[_0xfee4('0x2')]=mergeDBDataToRealtime; \ No newline at end of file diff --git a/server/services/ami/report/index.js b/server/services/ami/report/index.js index 110de0e..d26e1d6 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 _0x75f7=['substring','indexOf','phone','lastIndexOf','transfererlinkedid','attendedTransfer','exports','lodash','moment','util','../../../config/environment','../ami','../rpc/voiceCallReport','../rpc/voiceDialReport','../rpc/memberReport','../rpc/voiceQueueReport','../rpc/voiceRecording','../rpc/voiceTransferReport','./voiceQueueReport','./voiceAgentReport','./voiceDialReport','./userReport','realtime','agents','telephones','prototype','sync','xdr','custom:voiceQueueReport','voiceQueueReport','custom:voiceCallReport','voiceCallReport','voiceAgentReport','bind','custom:voiceDialReport','voiceDialReport','blindtransfer','blindTransfer','findAgent','accountcode','isNil','find','name','interface','SIP/%s','length','connectedlinenum','assigned','lastAssignedTo','format','queuecallercomplete','queuecallercompleteAt','YYYY-MM-DD\x20HH:mm:ss','queuecallerexit','create','getAgentByInternal','keys','getCallType','channel','outbound','destination','type','dialer','queue','context','from-voip-provider','callerid','from-sip','xcally-motion-preview','calleridnum','destinationchannel','calleridpreview','originatecalleridnum','disposition','\x22%s\x22\x20<%s>','calleridname','transfers','linkedid','uniqueid','UserId','membername','monitors','filename','createdAt','exten','connectedlinename','xcally-motion-dialer','forEach','startsWith','Local'];(function(_0x310bc2,_0x453c97){var _0x353226=function(_0x28d173){while(--_0x28d173){_0x310bc2['push'](_0x310bc2['shift']());}};_0x353226(++_0x453c97);}(_0x75f7,0x1c9));var _0x775f=function(_0x33c7de,_0x3f6793){_0x33c7de=_0x33c7de-0x0;var _0xe6a895=_0x75f7[_0x33c7de];return _0xe6a895;};'use strict';var _=require(_0x775f('0x0'));var moment=require(_0x775f('0x1'));var util=require(_0x775f('0x2'));var config=require(_0x775f('0x3'));var ami=require(_0x775f('0x4'));var RpcVoiceAgentReport=require('../rpc/voiceAgentReport');var RpcVoiceCallReport=require(_0x775f('0x5'));var RpcVoiceDialReport=require(_0x775f('0x6'));var RpcMemberReport=require(_0x775f('0x7'));var RpcVoiceQueueReport=require(_0x775f('0x8'));var RpcVoiceRecording=require(_0x775f('0x9'));var RpcVoiceTransferReport=require(_0x775f('0xa'));var VoiceQueueReport=require(_0x775f('0xb'));var VoiceCallReport=require('./voiceCallReport');var VoiceAgentReport=require(_0x775f('0xc'));var VoiceDialReport=require(_0x775f('0xd'));var UserReport=require(_0x775f('0xe'));function Report(_0x2c9715){this[_0x775f('0xf')]=_0x2c9715;this[_0x775f('0x10')]=_0x2c9715[_0x775f('0x10')];this[_0x775f('0x11')]=_0x2c9715[_0x775f('0x11')];}Report[_0x775f('0x12')][_0x775f('0x13')]=function(_0x359b7a){var _0xd3a72e=new VoiceQueueReport(this[_0x775f('0xf')]);var _0xd73b5e=new VoiceAgentReport(this['realtime']);var _0x45885e=new VoiceDialReport(this[_0x775f('0xf')]);var _0xfb6ca9=new VoiceCallReport(this[_0x775f('0xf')]);var _0x224cca=new UserReport(this[_0x775f('0xf')]);if(config[_0x775f('0x14')]&&config[_0x775f('0x14')]['disabled']){ami['on'](_0x775f('0x15'),this[_0x775f('0x16')]['bind'](this));ami['on'](_0x775f('0x17'),this[_0x775f('0x18')]['bind'](this));ami['on']('custom:voiceAgentReport',this[_0x775f('0x19')][_0x775f('0x1a')](this));ami['on'](_0x775f('0x1b'),this[_0x775f('0x1c')][_0x775f('0x1a')](this));ami['on'](_0x775f('0x1d'),this[_0x775f('0x1e')][_0x775f('0x1a')](this));ami['on']('attendedtransfer',this['attendedTransfer'][_0x775f('0x1a')](this));}};Report[_0x775f('0x12')][_0x775f('0x1f')]=function(_0x52c567){var _0x5d477a;_0x5d477a=_['find'](this[_0x775f('0x10')],function(_0x37b645){return _0x37b645[_0x775f('0x20')]==_0x52c567||_0x37b645['name']==_0x52c567;});if(_[_0x775f('0x21')](_0x5d477a)){var _0x442b1c=_[_0x775f('0x22')](this[_0x775f('0x11')],function(_0x232283){return _0x232283[_0x775f('0x20')]==_0x52c567||_0x232283[_0x775f('0x23')]==_0x52c567;});if(_0x442b1c){_0x5d477a=_[_0x775f('0x22')](this[_0x775f('0x10')],function(_0x388aa2){return _0x388aa2[_0x775f('0x24')]==util['format'](_0x775f('0x25'),_0x442b1c[_0x775f('0x23')]);});}}return _0x5d477a;};Report['prototype'][_0x775f('0x16')]=function(_0x33d0c1){for(var _0xe19fb5=0x0;_0xe19fb5<_0x33d0c1[_0x775f('0x26')];_0xe19fb5+=0x1){var _0x54fa3=this[_0x775f('0x1f')](_0x33d0c1[_0xe19fb5][_0x775f('0x27')]);if(_0x54fa3){_0x33d0c1[_0xe19fb5][_0x775f('0x20')]=_0x54fa3['accountcode'];_0x33d0c1[_0xe19fb5][_0x775f('0x28')]=!![];_0x33d0c1[_0xe19fb5][_0x775f('0x29')]=_0x54fa3[_0x775f('0x23')];_0x33d0c1[_0xe19fb5]['interface']=_['isNil'](_0x54fa3['interface'])?util[_0x775f('0x2a')](_0x775f('0x25'),_0x54fa3['name']):_0x54fa3[_0x775f('0x24')];if(_0x33d0c1[_0xe19fb5][_0x775f('0x2b')]){_0x33d0c1[_0xe19fb5][_0x775f('0x2c')]=moment()[_0x775f('0x2a')](_0x775f('0x2d'));}if(_0x33d0c1[_0xe19fb5][_0x775f('0x2e')]){_0x33d0c1[_0xe19fb5]['queuecallerexitAt']=moment()[_0x775f('0x2a')](_0x775f('0x2d'));}RpcMemberReport['voiceQueueReport'](_0x33d0c1[_0xe19fb5]);}RpcVoiceQueueReport[_0x775f('0x2f')](_0x33d0c1[_0xe19fb5]);}};function extractCalleridNumber(_0x8fde96){var _0x4f0955=_0x8fde96['match'](/<(.*?)>/);return _0x4f0955?_0x4f0955[0x1]:_0x8fde96;}Report[_0x775f('0x12')][_0x775f('0x30')]=function(_0x22267e){for(var _0x466117=0x0;_0x466117','calleridname','transfers','linkedid','transfereelinkedid','blindTransfer','UserId','split','membername','monitor','monitors','monitorFilename','filename','createdAt','connectedlinename','isArray','forEach','startsWith','Local','substring','indexOf','mobile','phone','transfererlinkedid','exports','lodash','moment','../../../config/environment','../ami','../rpc/voiceAgentReport','../rpc/voiceCallReport','../rpc/memberReport','../rpc/voiceQueueReport','../rpc/voiceTransferReport','./voiceQueueReport','./voiceCallReport','./voiceAgentReport','./voiceDialReport','./userReport','realtime','agents','prototype','sync','xdr','disabled','custom:voiceQueueReport','voiceQueueReport','bind','custom:voiceAgentReport','voiceAgentReport','custom:voiceDialReport','voiceDialReport','blindtransfer','attendedtransfer','attendedTransfer','findAgent','find','accountcode','name','isNil','telephones','interface','format','SIP/%s','length','connectedlinenum','assigned','queuecallercomplete','queuecallercompleteAt'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x6bc8,0x8e));var _0x86bc=function(_0x2cdb69,_0x3f999e){_0x2cdb69=_0x2cdb69-0x0;var _0xd5ea7e=_0x6bc8[_0x2cdb69];return _0xd5ea7e;};'use strict';var _=require(_0x86bc('0x0'));var moment=require(_0x86bc('0x1'));var util=require('util');var config=require(_0x86bc('0x2'));var ami=require(_0x86bc('0x3'));var RpcVoiceAgentReport=require(_0x86bc('0x4'));var RpcVoiceCallReport=require(_0x86bc('0x5'));var RpcVoiceDialReport=require('../rpc/voiceDialReport');var RpcMemberReport=require(_0x86bc('0x6'));var RpcVoiceQueueReport=require(_0x86bc('0x7'));var RpcVoiceRecording=require('../rpc/voiceRecording');var RpcVoiceTransferReport=require(_0x86bc('0x8'));var VoiceQueueReport=require(_0x86bc('0x9'));var VoiceCallReport=require(_0x86bc('0xa'));var VoiceAgentReport=require(_0x86bc('0xb'));var VoiceDialReport=require(_0x86bc('0xc'));var UserReport=require(_0x86bc('0xd'));function Report(_0x5cefe7){this[_0x86bc('0xe')]=_0x5cefe7;this[_0x86bc('0xf')]=_0x5cefe7['agents'];this['telephones']=_0x5cefe7['telephones'];}Report[_0x86bc('0x10')][_0x86bc('0x11')]=function(_0x3b1d2a){var _0x35949e=new VoiceQueueReport(this[_0x86bc('0xe')]);var _0x4bea68=new VoiceAgentReport(this['realtime']);var _0x100e6f=new VoiceDialReport(this['realtime']);var _0x4c2812=new VoiceCallReport(this[_0x86bc('0xe')]);var _0x3660e3=new UserReport(this[_0x86bc('0xe')]);if(config[_0x86bc('0x12')]&&config[_0x86bc('0x12')][_0x86bc('0x13')]){ami['on'](_0x86bc('0x14'),this[_0x86bc('0x15')][_0x86bc('0x16')](this));ami['on']('custom:voiceCallReport',this['voiceCallReport'][_0x86bc('0x16')](this));ami['on'](_0x86bc('0x17'),this[_0x86bc('0x18')][_0x86bc('0x16')](this));ami['on'](_0x86bc('0x19'),this[_0x86bc('0x1a')][_0x86bc('0x16')](this));ami['on'](_0x86bc('0x1b'),this['blindTransfer'][_0x86bc('0x16')](this));ami['on'](_0x86bc('0x1c'),this[_0x86bc('0x1d')][_0x86bc('0x16')](this));}};Report[_0x86bc('0x10')][_0x86bc('0x1e')]=function(_0xd3bc63){var _0x4338cc;_0x4338cc=_[_0x86bc('0x1f')](this[_0x86bc('0xf')],function(_0x5ccd42){return _0x5ccd42[_0x86bc('0x20')]==_0xd3bc63||_0x5ccd42[_0x86bc('0x21')]==_0xd3bc63;});if(_[_0x86bc('0x22')](_0x4338cc)){var _0x17af4e=_['find'](this[_0x86bc('0x23')],function(_0x5485fb){return _0x5485fb[_0x86bc('0x20')]==_0xd3bc63||_0x5485fb[_0x86bc('0x21')]==_0xd3bc63;});if(_0x17af4e){_0x4338cc=_[_0x86bc('0x1f')](this[_0x86bc('0xf')],function(_0x566f9d){return _0x566f9d[_0x86bc('0x24')]==util[_0x86bc('0x25')](_0x86bc('0x26'),_0x17af4e[_0x86bc('0x21')]);});}}return _0x4338cc;};Report[_0x86bc('0x10')][_0x86bc('0x15')]=function(_0x1e6b94){for(var _0x513ae3=0x0;_0x513ae3<_0x1e6b94[_0x86bc('0x27')];_0x513ae3+=0x1){var _0x19f4ea=this[_0x86bc('0x1e')](_0x1e6b94[_0x513ae3][_0x86bc('0x28')]);if(_0x19f4ea){_0x1e6b94[_0x513ae3][_0x86bc('0x20')]=_0x19f4ea['accountcode'];_0x1e6b94[_0x513ae3][_0x86bc('0x29')]=!![];_0x1e6b94[_0x513ae3]['lastAssignedTo']=_0x19f4ea['name'];_0x1e6b94[_0x513ae3][_0x86bc('0x24')]=_[_0x86bc('0x22')](_0x19f4ea[_0x86bc('0x24')])?util['format'](_0x86bc('0x26'),_0x19f4ea[_0x86bc('0x21')]):_0x19f4ea['interface'];if(_0x1e6b94[_0x513ae3][_0x86bc('0x2a')]){_0x1e6b94[_0x513ae3][_0x86bc('0x2b')]=moment()['format'](_0x86bc('0x2c'));}if(_0x1e6b94[_0x513ae3][_0x86bc('0x2d')]){_0x1e6b94[_0x513ae3]['queuecallerexitAt']=moment()['format'](_0x86bc('0x2c'));}RpcMemberReport[_0x86bc('0x15')](_0x1e6b94[_0x513ae3]);}RpcVoiceQueueReport[_0x86bc('0x2e')](_0x1e6b94[_0x513ae3]);}};function extractCalleridNumber(_0x13511d){var _0x4a7731=_0x13511d[_0x86bc('0x2f')](/<(.*?)>/);return _0x4a7731?_0x4a7731[0x1]:_0x13511d;}Report[_0x86bc('0x10')][_0x86bc('0x30')]=function(_0x487e80){for(var _0x3123f6=0x0;_0x3123f60x0?!![]:![];if(!_0x4d5121){return this[_0x44b6('0x19')](this[_0x44b6('0x40')][_0x44b6('0x65')]);}};VoiceQueueReport[_0x44b6('0xc')]['syncQueueMember']=function(_0xd020a4){var _0xe578c4=this['summary']['id'];if(this[_0x44b6('0x40')][_0x44b6('0x5c')][_0xe578c4]&&this[_0x44b6('0x40')]['queuestatus'][_0xe578c4][_0xd020a4['actionid']]){this[_0x44b6('0x40')][_0x44b6('0x5c')][_0xe578c4][_0xd020a4['actionid']]['agents'][_0x44b6('0x66')](_0xd020a4);}};VoiceQueueReport[_0x44b6('0xc')][_0x44b6('0x67')]=function(_0x180009){var _0x2353d0=this;try{if(this[_0x44b6('0x54')](_0x180009)&&this[_0x44b6('0x54')](_0x180009['queue'])){logger[_0x44b6('0x4d')]('[voiceQueueReport][queuesummary]\x20event:',util[_0x44b6('0x3e')](_0x180009,{'showHidden':![],'depth':null}));var _0x4dea1c=this[_0x44b6('0x15')][_0x180009[_0x44b6('0x4a')]];if(_0x4dea1c){logger[_0x44b6('0x4d')](_0x44b6('0x68'),_0x4dea1c['name']);this[_0x44b6('0x40')][_0x44b6('0x5f')][_0x4dea1c[_0x44b6('0x53')]]={'summaryEvent':_0x180009};this[_0x44b6('0x40')][_0x44b6('0x69')]+=0x1;return ami[_0x44b6('0x56')]({'action':_0x44b6('0x5c'),'queue':_0x4dea1c['name']})['then'](function(_0x3ba1eb){if(!_0x2353d0[_0x44b6('0x40')][_0x44b6('0x5c')][_0x180009[_0x44b6('0x5a')]]){_0x2353d0[_0x44b6('0x40')][_0x44b6('0x5c')][_0x180009[_0x44b6('0x5a')]]={};}_0x2353d0[_0x44b6('0x40')]['queuestatus'][_0x180009['actionid']][_0x3ba1eb['actionid']]={'queue':_0x4dea1c[_0x44b6('0x53')],'agents':[]};})[_0x44b6('0x3a')](function(_0x1fd38c){throw _0x1fd38c;});}}}catch(_0x15cbeb){logger[_0x44b6('0x3c')](_0x44b6('0x5d'),util[_0x44b6('0x3e')](_0x15cbeb,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x44b6('0xc')][_0x44b6('0x19')]=function(_0x38ace1){if(this['summary'][_0x44b6('0x69')]>0x0){this['summary'][_0x44b6('0x65')]=_0x38ace1;return;}logger[_0x44b6('0x4d')]('[voiceQueueReport][queuesummarycomplete]\x20event:',util['inspect'](_0x38ace1,{'showHidden':![],'depth':null}));this[_0x44b6('0x40')]=initializeSummary();ami[_0x44b6('0x43')]('custom:queuesummarycomplete',{});};VoiceQueueReport[_0x44b6('0xc')][_0x44b6('0x1e')]=function(_0x298d58){try{if(this[_0x44b6('0x54')](_0x298d58)){logger[_0x44b6('0x4d')](_0x44b6('0x6a'),_0x298d58['uniqueid'],util['inspect'](_0x298d58,{'showHidden':![],'depth':null}));if(_[_0x44b6('0x55')](this['queueReports'][_0x298d58[_0x44b6('0x47')]])){this[_0x44b6('0x10')][_0x298d58[_0x44b6('0x47')]]=[];}if(_['isUndefined'](this[_0x44b6('0x13')][_0x298d58[_0x44b6('0x47')]])){this[_0x44b6('0x13')][_0x298d58[_0x44b6('0x47')]]={};}var _0x43bb3f=new QueueReport();_0x43bb3f[_0x44b6('0x4a')]=_0x298d58['queue'];_0x43bb3f[_0x44b6('0x52')]=this[_0x44b6('0x15')][_0x43bb3f[_0x44b6('0x4a')]]&&this['voiceQueues'][_0x43bb3f[_0x44b6('0x4a')]][_0x44b6('0x52')]?this['voiceQueues'][_0x43bb3f[_0x44b6('0x4a')]][_0x44b6('0x52')]||_0x44b6('0x6b'):_0x44b6('0x6b');_0x43bb3f[_0x44b6('0x6c')]=moment()[_0x44b6('0x48')]('YYYY-MM-DD\x20HH:mm:ss');_0x43bb3f[_0x44b6('0x6d')]=_0x298d58['position'];_0x43bb3f['count']=_0x298d58[_0x44b6('0x6e')];_0x43bb3f['uniqueid']=_0x298d58[_0x44b6('0x47')];_0x43bb3f['routealias']=this[_0x44b6('0x13')][_0x298d58[_0x44b6('0x47')]][_0x44b6('0x6f')];logger[_0x44b6('0x70')](_0x44b6('0x71'),_0x43bb3f[_0x44b6('0x4a')],_0x43bb3f[_0x44b6('0x52')]);Object[_0x44b6('0x63')](_0x43bb3f,_[_0x44b6('0x72')](_0x298d58,_[_0x44b6('0x73')](_0x43bb3f)));this['queueReports'][_0x298d58['uniqueid']][_0x44b6('0x66')](_0x43bb3f);this['channels'][_0x298d58[_0x44b6('0x47')]]=_0x43bb3f;this[_0x44b6('0x44')](_0x43bb3f,'queuecallerjoin');}}catch(_0x39f6c1){logger['error']('[%s][voiceQueueReport][queuecallerjoin]',_0x298d58['uniqueid'],util[_0x44b6('0x3e')](_0x39f6c1,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x44b6('0xc')][_0x44b6('0x20')]=function(_0x1f742a){try{if(this[_0x44b6('0x54')](_0x1f742a)){logger[_0x44b6('0x4d')]('[%s][voiceQueueReport][queuecallerabandon]',_0x1f742a['uniqueid'],util[_0x44b6('0x3e')](_0x1f742a,{'showHidden':![],'depth':null}));if(this[_0x44b6('0x10')][_0x1f742a['uniqueid']]){var _0x467cd1=_[_0x44b6('0x74')](this[_0x44b6('0x10')][_0x1f742a[_0x44b6('0x47')]]);_0x467cd1[_0x44b6('0x36')]=![];_0x467cd1[_0x44b6('0x75')]=null;_0x467cd1[_0x44b6('0x76')]=_0x1f742a[_0x44b6('0x76')];_0x467cd1[_0x44b6('0x77')]=_0x1f742a[_0x44b6('0x77')];_0x467cd1['queuecallerabandon']=!![];_0x467cd1[_0x44b6('0x78')]=moment()['format'](_0x44b6('0x79'));_0x467cd1[_0x44b6('0x7a')]=_0x44b6('0x7b');_0x467cd1[_0x44b6('0x7c')]=null;logger['info'](_0x44b6('0x7d'),_0x467cd1['queue'],_0x467cd1[_0x44b6('0x52')]);this[_0x44b6('0x13')][_0x1f742a['uniqueid']]=_0x467cd1;this[_0x44b6('0x42')](_0x467cd1,_0x44b6('0x1f'));}}}catch(_0x52bd66){logger['error'](_0x44b6('0x7e'),_0x1f742a[_0x44b6('0x47')],util[_0x44b6('0x3e')](_0x52bd66,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x44b6('0xc')][_0x44b6('0x7f')]=function(_0x864afe){try{if(this[_0x44b6('0x54')](_0x864afe)){logger[_0x44b6('0x4d')]('[%s][voiceQueueReport][queuecallerleave]',_0x864afe[_0x44b6('0x47')],util['inspect'](_0x864afe,{'showHidden':![],'depth':null}));if(this[_0x44b6('0x10')][_0x864afe[_0x44b6('0x47')]]){var _0xa2fe52=_[_0x44b6('0x74')](this[_0x44b6('0x10')][_0x864afe[_0x44b6('0x47')]]);_0xa2fe52['queuecallerleaveAt']=moment()[_0x44b6('0x48')]('YYYY-MM-DD\x20HH:mm:ss');_0xa2fe52[_0x44b6('0x80')]=_0x864afe[_0x44b6('0x80')];_0xa2fe52[_0x44b6('0x81')]=_0x864afe[_0x44b6('0x81')];logger['info'](_0x44b6('0x82'),_0xa2fe52[_0x44b6('0x4a')],_0xa2fe52[_0x44b6('0x52')],_0x864afe[_0x44b6('0x80')],_0x864afe['connectedlinename']);this[_0x44b6('0x13')][_0x864afe[_0x44b6('0x47')]]=_0xa2fe52;this[_0x44b6('0x44')](_0xa2fe52,_0x44b6('0x21'));}}}catch(_0x2ba6ec){logger[_0x44b6('0x3c')]('[%s][voiceQueueReport][queuecallerleave]',_0x864afe[_0x44b6('0x47')],util[_0x44b6('0x3e')](_0x2ba6ec,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x44b6('0xc')][_0x44b6('0x83')]=function(_0x1ca2c2){try{if(this[_0x44b6('0x54')](_0x1ca2c2)){logger[_0x44b6('0x4d')](_0x44b6('0x84'),_0x1ca2c2['uniqueid'],util[_0x44b6('0x3e')](_0x1ca2c2,{'showHidden':![],'depth':null}));if(this[_0x44b6('0x10')][_0x1ca2c2[_0x44b6('0x47')]]){var _0x554d9e=_[_0x44b6('0x74')](this[_0x44b6('0x10')][_0x1ca2c2[_0x44b6('0x47')]]);_0x554d9e[_0x44b6('0x36')]=!![];_0x554d9e[_0x44b6('0x7a')]=_0x44b6('0x85');logger['info']('[voiceQueueReport][agentconnect]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETEDBYAGENT',_0x554d9e[_0x44b6('0x4a')],_0x554d9e[_0x44b6('0x52')]);}}}catch(_0x54544c){logger[_0x44b6('0x3c')](_0x44b6('0x84'),_0x1ca2c2['uniqueid'],util['inspect'](_0x54544c,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x44b6('0xc')][_0x44b6('0x86')]=function(_0x5c1272){try{if(this[_0x44b6('0x54')](_0x5c1272)){logger[_0x44b6('0x4d')](_0x44b6('0x87'),_0x5c1272['uniqueid'],util[_0x44b6('0x3e')](_0x5c1272,{'showHidden':![],'depth':null}));if(this[_0x44b6('0x10')][_0x5c1272[_0x44b6('0x47')]]){var _0x52683a=_['last'](this['queueReports'][_0x5c1272[_0x44b6('0x47')]]);_0x52683a[_0x44b6('0x1f')]=![];_0x52683a[_0x44b6('0x78')]=null;_0x52683a['assigned']=!![];_0x52683a['lastAssignedTo']=_0x5c1272[_0x44b6('0x88')];_0x52683a[_0x44b6('0x76')]=_0x5c1272['holdtime'];_0x52683a[_0x44b6('0x36')]=!![];_0x52683a[_0x44b6('0x35')]=![];_0x52683a[_0x44b6('0x89')]=null;if(!_0x52683a[_0x44b6('0x8a')]){if(_0x5c1272['reason']==_0x44b6('0x8a')){_0x52683a['queuecallerexitreason']='COMPLETED';logger[_0x44b6('0x70')](_0x44b6('0x8b'),_0x52683a[_0x44b6('0x4a')],_0x52683a[_0x44b6('0x52')]);}else{if(_['startsWith'](_0x5c1272['channel'][_0x44b6('0x8c')](),'local/')){if(this[_0x44b6('0x10')][_0x5c1272[_0x44b6('0x8d')]]){var _0xecd5e9=_[_0x44b6('0x74')](this[_0x44b6('0x10')][_0x5c1272[_0x44b6('0x8d')]]);_0xecd5e9[_0x44b6('0x36')]=![];_0xecd5e9[_0x44b6('0x35')]=!![];_0xecd5e9['queuecallerexitAt']=moment(_0x52683a['queuecallerjoinAt'])[_0x44b6('0x8e')](_0x5c1272[_0x44b6('0x76')],_0x44b6('0x8f'))['format'](_0x44b6('0x79'));_0xecd5e9[_0x44b6('0x7a')]=_0x44b6('0x90');_0xecd5e9[_0x44b6('0x8a')]=!![];_0xecd5e9['transfertype']=_0x44b6('0x91');_0xecd5e9[_0x44b6('0x92')]=_0x5c1272[_0x44b6('0x93')];_0xecd5e9['transferuniqueid']=_0x5c1272['uniqueid'];logger[_0x44b6('0x70')](_0x44b6('0x94'),_0xecd5e9[_0x44b6('0x4a')],_0xecd5e9[_0x44b6('0x52')]);var _0x5b8200=this[_0x44b6('0x10')][_0x5c1272[_0x44b6('0x8d')]];this[_0x44b6('0x10')][_0x5c1272[_0x44b6('0x8d')]]=this[_0x44b6('0x10')][_0x5c1272['uniqueid']];this[_0x44b6('0x10')][_0x5c1272[_0x44b6('0x47')]]=_0x5b8200;}}else{_0x52683a[_0x44b6('0x7a')]=_0x44b6('0x95')+_0x5c1272[_0x44b6('0x96')][_0x44b6('0x97')]();logger[_0x44b6('0x70')]('[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:%s',_0x52683a[_0x44b6('0x4a')],_0x52683a[_0x44b6('0x52')],_0x52683a[_0x44b6('0x7a')]);}}}this['channels'][_0x5c1272[_0x44b6('0x47')]]=_0x52683a;}}}catch(_0x2f207a){logger[_0x44b6('0x3c')]('[%s][voiceQueueReport][agentcomplete]',_0x5c1272[_0x44b6('0x47')],util[_0x44b6('0x3e')](_0x2f207a,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x44b6('0x25')]=function(_0x3dc16e){try{if(this[_0x44b6('0x54')](_0x3dc16e)){logger[_0x44b6('0x4d')](_0x44b6('0x98'),_0x3dc16e['uniqueid'],util[_0x44b6('0x3e')](_0x3dc16e,{'showHidden':![],'depth':null}));this[_0x44b6('0x99')](_0x3dc16e[_0x44b6('0x47')],_[_0x44b6('0x73')](_0x3dc16e[_0x44b6('0x9a')])[0x0],_0x3dc16e[_0x44b6('0x9b')]);if(this['queueReports'][_0x3dc16e[_0x44b6('0x47')]]){var _0x524549=_['last'](this[_0x44b6('0x10')][_0x3dc16e[_0x44b6('0x47')]]);if(_0x524549){if(this['isNotNull'](_0x3dc16e['variable'])&&this[_0x44b6('0x54')](_0x3dc16e[_0x44b6('0x9a')][_0x44b6('0x5c')])){switch(_0x3dc16e[_0x44b6('0x9b')]){case'CONTINUE':_0x524549[_0x44b6('0x35')]=![];_0x524549[_0x44b6('0x89')]=null;break;case'TIMEOUT':_0x524549[_0x44b6('0x9c')]=_0x44b6('0x9d');_0x524549[_0x44b6('0x35')]=!![];_0x524549['queuecallerexitAt']=moment()[_0x44b6('0x48')]('YYYY-MM-DD\x20HH:mm:ss');_0x524549['queuecallerleaveAt']=moment()[_0x44b6('0x48')](_0x44b6('0x79'));logger[_0x44b6('0x4d')](_0x44b6('0x9e'),_0x3dc16e[_0x44b6('0x47')],util['inspect'](_0x524549,{'showHidden':![],'depth':null}));ami[_0x44b6('0x43')](_0x44b6('0x9f'),_0x524549);break;default:_0x524549[_0x44b6('0x35')]=!![];_0x524549['queuecallerexitAt']=moment()['format'](_0x44b6('0x79'));_0x524549['queuecallerleaveAt']=moment()['format'](_0x44b6('0x79'));}_0x524549[_0x44b6('0x1f')]=![];_0x524549['queuecallerabandonAt']=null;_0x524549['queuecallerexitreason']=_0x3dc16e[_0x44b6('0x9b')];this[_0x44b6('0x13')][_0x3dc16e[_0x44b6('0x47')]]=_0x524549;this[_0x44b6('0x42')](_0x524549,_0x44b6('0x24'));}else if(this[_0x44b6('0x54')](_0x3dc16e[_0x44b6('0x9a')])&&this['isNotNull'](_0x3dc16e[_0x44b6('0x9a')]['queueposition'])){if(!_0x524549[_0x44b6('0x1f')]){_0x524549['queuecallerexit']=!![];_0x524549[_0x44b6('0x89')]=moment()[_0x44b6('0x48')]('YYYY-MM-DD\x20HH:mm:ss');_0x524549[_0x44b6('0x7a')]=_0x44b6('0xa0');_0x524549[_0x44b6('0xa1')]=moment()[_0x44b6('0x48')](_0x44b6('0x79'));this[_0x44b6('0x13')][_0x3dc16e['uniqueid']]=_0x524549;}}logger[_0x44b6('0x70')](_0x44b6('0xa2'),_0x3dc16e[_0x44b6('0x47')],_0x524549['queue'],_0x524549[_0x44b6('0x52')],_[_0x44b6('0x73')](_0x3dc16e[_0x44b6('0x9a')])[0x0],_0x3dc16e[_0x44b6('0x9b')]);_0x524549[_0x44b6('0x17')]=this['variables'][_0x3dc16e[_0x44b6('0x47')]];}}}}catch(_0x3c3f4d){logger[_0x44b6('0x3c')]('[%s][voiceQueueReport][varset]',_0x3dc16e['uniqueid'],util['inspect'](_0x3c3f4d,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype']['addVariable']=function(_0x1a2304,_0x408af5,_0xabc176){var _0x595b95=[_0x44b6('0xa3'),_0x44b6('0xa4'),_0x44b6('0xa5'),'rtpaudioqosjitterbridged',_0x44b6('0xa6'),'rtpaudioqoslossbridged',_0x44b6('0xa7'),'rtpaudioqosrttbridged','sipcallid',_0x44b6('0xa8'),_0x44b6('0xa9'),_0x44b6('0xaa'),_0x44b6('0xab'),_0x44b6('0xac'),_0x44b6('0xad'),_0x44b6('0xae'),'membername',_0x44b6('0xaf'),_0x44b6('0xb0')];if(!_[_0x44b6('0xb1')](_0x408af5)&&!_[_0x44b6('0xb2')](_0x595b95,_0x408af5)){if(_[_0x44b6('0x55')](this[_0x44b6('0x17')][_0x1a2304])){this['variables'][_0x1a2304]={};}this[_0x44b6('0x17')][_0x1a2304][_0x408af5]=_0xabc176;}};VoiceQueueReport[_0x44b6('0xc')]['handleHangup']=function(_0x489a27,_0x192ff9,_0x21db22){try{var _0xeda642={};if(this[_0x44b6('0x10')][_0x489a27]){for(var _0x5855f9=0x0;_0x5855f90x0?!![]:![];if(!_0x4eb013){return this[_0x56fa('0x6c')](this[_0x56fa('0x17')][_0x56fa('0x6d')]);}};VoiceQueueReport[_0x56fa('0xd')][_0x56fa('0x1c')]=function(_0x3d5544){var _0x4aabaf=this[_0x56fa('0x17')]['id'];if(this['summary']['queuestatus'][_0x4aabaf]&&this[_0x56fa('0x17')]['queuestatus'][_0x4aabaf][_0x3d5544['actionid']]){this['summary'][_0x56fa('0x63')][_0x4aabaf][_0x3d5544[_0x56fa('0x62')]]['agents'][_0x56fa('0x6e')](_0x3d5544);}};VoiceQueueReport[_0x56fa('0xd')]['syncQueueSummary']=function(_0x2871ea){var _0x269976=this;try{if(this[_0x56fa('0x6f')](_0x2871ea)&&this[_0x56fa('0x6f')](_0x2871ea[_0x56fa('0x50')])){logger[_0x56fa('0x53')](_0x56fa('0x70'),util[_0x56fa('0x45')](_0x2871ea,{'showHidden':![],'depth':null}));var _0x2c3b8b=this[_0x56fa('0x15')][_0x2871ea[_0x56fa('0x50')]];if(_0x2c3b8b){logger[_0x56fa('0x53')](_0x56fa('0x71'),_0x2c3b8b[_0x56fa('0x5a')]);this[_0x56fa('0x17')][_0x56fa('0x5d')][_0x2c3b8b[_0x56fa('0x5a')]]={'summaryEvent':_0x2871ea};this[_0x56fa('0x17')][_0x56fa('0x6b')]+=0x1;return ami['Action']({'action':'queuestatus','queue':_0x2c3b8b[_0x56fa('0x5a')]})[_0x56fa('0x61')](function(_0x31e4cb){if(!_0x269976[_0x56fa('0x17')]['queuestatus'][_0x2871ea[_0x56fa('0x62')]]){_0x269976[_0x56fa('0x17')][_0x56fa('0x63')][_0x2871ea[_0x56fa('0x62')]]={};}_0x269976[_0x56fa('0x17')]['queuestatus'][_0x2871ea['actionid']][_0x31e4cb[_0x56fa('0x62')]]={'queue':_0x2c3b8b[_0x56fa('0x5a')],'agents':[]};})[_0x56fa('0x40')](function(_0x271f09){throw _0x271f09;});}}}catch(_0x23144a){logger[_0x56fa('0x42')](_0x56fa('0x72'),util[_0x56fa('0x45')](_0x23144a,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype']['syncQueueSummaryComplete']=function(_0x318633){if(this[_0x56fa('0x17')][_0x56fa('0x6b')]>0x0){this['summary'][_0x56fa('0x6d')]=_0x318633;return;}logger[_0x56fa('0x53')]('[voiceQueueReport][queuesummarycomplete]\x20event:',util[_0x56fa('0x45')](_0x318633,{'showHidden':![],'depth':null}));this[_0x56fa('0x17')]=initializeSummary();ami[_0x56fa('0x4a')](_0x56fa('0x73'),{});};VoiceQueueReport[_0x56fa('0xd')]['syncQueueCallerJoin']=function(_0x46dc18){try{if(this['isNotNull'](_0x46dc18)){logger[_0x56fa('0x53')](_0x56fa('0x74'),_0x46dc18[_0x56fa('0x4d')],util[_0x56fa('0x45')](_0x46dc18,{'showHidden':![],'depth':null}));if(_[_0x56fa('0x5c')](this['queueReports'][_0x46dc18['uniqueid']])){this[_0x56fa('0x11')][_0x46dc18[_0x56fa('0x4d')]]=[];}if(_[_0x56fa('0x5c')](this[_0x56fa('0x3b')][_0x46dc18[_0x56fa('0x4d')]])){this['channels'][_0x46dc18[_0x56fa('0x4d')]]={};}var _0x38f164=new QueueReport();_0x38f164['queue']=_0x46dc18[_0x56fa('0x50')];_0x38f164[_0x56fa('0x57')]=this[_0x56fa('0x15')][_0x38f164[_0x56fa('0x50')]]&&this[_0x56fa('0x15')][_0x38f164[_0x56fa('0x50')]][_0x56fa('0x57')]?this[_0x56fa('0x15')][_0x38f164['queue']][_0x56fa('0x57')]||_0x56fa('0x58'):_0x56fa('0x58');_0x38f164[_0x56fa('0x75')]=moment()[_0x56fa('0x4e')](_0x56fa('0x76'));_0x38f164[_0x56fa('0x77')]=_0x46dc18[_0x56fa('0x77')];_0x38f164[_0x56fa('0x78')]=_0x46dc18[_0x56fa('0x78')];_0x38f164[_0x56fa('0x4d')]=_0x46dc18[_0x56fa('0x4d')];_0x38f164[_0x56fa('0x79')]=this['channels'][_0x46dc18[_0x56fa('0x4d')]][_0x56fa('0x79')];logger[_0x56fa('0x7a')](_0x56fa('0x7b'),_0x38f164[_0x56fa('0x50')],_0x38f164['type']);Object[_0x56fa('0x68')](_0x38f164,_[_0x56fa('0x7c')](_0x46dc18,_[_0x56fa('0x7d')](_0x38f164)));this[_0x56fa('0x11')][_0x46dc18[_0x56fa('0x4d')]][_0x56fa('0x6e')](_0x38f164);this[_0x56fa('0x3b')][_0x46dc18[_0x56fa('0x4d')]]=_0x38f164;this[_0x56fa('0x7e')](_0x38f164,'queuecallerjoin');}}catch(_0x553f56){logger[_0x56fa('0x42')](_0x56fa('0x74'),_0x46dc18[_0x56fa('0x4d')],util[_0x56fa('0x45')](_0x553f56,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x56fa('0xd')][_0x56fa('0x21')]=function(_0x440e26){try{if(this[_0x56fa('0x6f')](_0x440e26)){logger['debug'](_0x56fa('0x7f'),_0x440e26[_0x56fa('0x4d')],util['inspect'](_0x440e26,{'showHidden':![],'depth':null}));if(this[_0x56fa('0x11')][_0x440e26['uniqueid']]){var _0x486b40=_['last'](this[_0x56fa('0x11')][_0x440e26[_0x56fa('0x4d')]]);_0x486b40[_0x56fa('0x80')]=![];_0x486b40[_0x56fa('0x81')]=null;_0x486b40[_0x56fa('0x82')]=_0x440e26[_0x56fa('0x82')];_0x486b40[_0x56fa('0x83')]=_0x440e26[_0x56fa('0x83')];_0x486b40[_0x56fa('0x20')]=!![];_0x486b40[_0x56fa('0x84')]=moment()[_0x56fa('0x4e')](_0x56fa('0x76'));_0x486b40[_0x56fa('0x85')]=_0x56fa('0x86');_0x486b40['lastAssignedTo']=null;logger[_0x56fa('0x7a')](_0x56fa('0x87'),_0x486b40['queue'],_0x486b40['type']);this[_0x56fa('0x3b')][_0x440e26[_0x56fa('0x4d')]]=_0x486b40;this['emitVoiceQueueChannelRemove'](_0x486b40,_0x56fa('0x20'));}}}catch(_0x3c0a88){logger[_0x56fa('0x42')]('[%s][voiceQueueReport][queuecallerabandon]',_0x440e26[_0x56fa('0x4d')],util[_0x56fa('0x45')](_0x3c0a88,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x56fa('0xd')]['syncQueueCallerLeave']=function(_0x202ca0){try{if(this[_0x56fa('0x6f')](_0x202ca0)){logger[_0x56fa('0x53')](_0x56fa('0x88'),_0x202ca0[_0x56fa('0x4d')],util['inspect'](_0x202ca0,{'showHidden':![],'depth':null}));if(this[_0x56fa('0x11')][_0x202ca0[_0x56fa('0x4d')]]){var _0x341c04=_[_0x56fa('0x89')](this['queueReports'][_0x202ca0[_0x56fa('0x4d')]]);_0x341c04[_0x56fa('0x8a')]=moment()[_0x56fa('0x4e')]('YYYY-MM-DD\x20HH:mm:ss');_0x341c04[_0x56fa('0x8b')]=_0x202ca0[_0x56fa('0x8b')];_0x341c04[_0x56fa('0x8c')]=_0x202ca0[_0x56fa('0x8c')];logger[_0x56fa('0x7a')]('[voiceQueueReport][queuecallerleave]\x20name:%s\x20type:%s\x20connectedlinenum:%s\x20connectedlinename:%s',_0x341c04[_0x56fa('0x50')],_0x341c04[_0x56fa('0x57')],_0x202ca0[_0x56fa('0x8b')],_0x202ca0[_0x56fa('0x8c')]);this['channels'][_0x202ca0[_0x56fa('0x4d')]]=_0x341c04;this[_0x56fa('0x7e')](_0x341c04,'queuecallerleave');}}}catch(_0x1c1d80){logger[_0x56fa('0x42')](_0x56fa('0x88'),_0x202ca0['uniqueid'],util[_0x56fa('0x45')](_0x1c1d80,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x56fa('0xd')][_0x56fa('0x25')]=function(_0x394176){try{if(this['isNotNull'](_0x394176)){logger['debug']('[%s][voiceQueueReport][agentconnect]',_0x394176['uniqueid'],util[_0x56fa('0x45')](_0x394176,{'showHidden':![],'depth':null}));if(this[_0x56fa('0x11')][_0x394176[_0x56fa('0x4d')]]){var _0x5a9ca8=_[_0x56fa('0x89')](this[_0x56fa('0x11')][_0x394176['uniqueid']]);_0x5a9ca8[_0x56fa('0x80')]=!![];_0x5a9ca8[_0x56fa('0x85')]=_0x56fa('0x8d');logger[_0x56fa('0x7a')](_0x56fa('0x8e'),_0x5a9ca8[_0x56fa('0x50')],_0x5a9ca8[_0x56fa('0x57')]);}}}catch(_0x1704d3){logger[_0x56fa('0x42')](_0x56fa('0x8f'),_0x394176['uniqueid'],util[_0x56fa('0x45')](_0x1704d3,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x56fa('0xd')][_0x56fa('0x24')]=function(_0x161a63){try{if(this[_0x56fa('0x6f')](_0x161a63)){logger['debug'](_0x56fa('0x90'),_0x161a63['uniqueid'],util['inspect'](_0x161a63,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x161a63[_0x56fa('0x4d')]]){var _0x3030a0=_['last'](this[_0x56fa('0x11')][_0x161a63[_0x56fa('0x4d')]]);_0x3030a0[_0x56fa('0x20')]=![];_0x3030a0['queuecallerabandonAt']=null;_0x3030a0['assigned']=!![];_0x3030a0['lastAssignedTo']=_0x161a63[_0x56fa('0x91')];_0x3030a0[_0x56fa('0x82')]=_0x161a63['holdtime'];_0x3030a0[_0x56fa('0x80')]=!![];_0x3030a0[_0x56fa('0x92')]=![];_0x3030a0[_0x56fa('0x93')]=null;if(!_0x3030a0[_0x56fa('0x94')]){if(_0x161a63[_0x56fa('0x95')]==_0x56fa('0x94')){_0x3030a0['queuecallerexitreason']='COMPLETED';logger[_0x56fa('0x7a')]('[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETED',_0x3030a0['queue'],_0x3030a0[_0x56fa('0x57')]);}else{if(_[_0x56fa('0x96')](_0x161a63[_0x56fa('0x3f')][_0x56fa('0x97')](),_0x56fa('0x98'))){if(this[_0x56fa('0x11')][_0x161a63[_0x56fa('0x99')]]){var _0xd6467=_[_0x56fa('0x89')](this['queueReports'][_0x161a63['linkedid']]);_0xd6467[_0x56fa('0x80')]=![];_0xd6467[_0x56fa('0x92')]=!![];_0xd6467[_0x56fa('0x93')]=moment(_0x3030a0[_0x56fa('0x75')])[_0x56fa('0x9a')](_0x161a63[_0x56fa('0x82')],_0x56fa('0x9b'))['format'](_0x56fa('0x76'));_0xd6467[_0x56fa('0x85')]=_0x56fa('0x9c');_0xd6467['transfer']=!![];_0xd6467[_0x56fa('0x9d')]=_0x56fa('0x9e');_0xd6467[_0x56fa('0x9f')]=_0x161a63[_0x56fa('0xa0')];_0xd6467[_0x56fa('0xa1')]=_0x161a63[_0x56fa('0x4d')];logger[_0x56fa('0x7a')](_0x56fa('0xa2'),_0xd6467[_0x56fa('0x50')],_0xd6467[_0x56fa('0x57')]);var _0x61eedd=this[_0x56fa('0x11')][_0x161a63[_0x56fa('0x99')]];this[_0x56fa('0x11')][_0x161a63[_0x56fa('0x99')]]=this[_0x56fa('0x11')][_0x161a63['uniqueid']];this['queueReports'][_0x161a63[_0x56fa('0x4d')]]=_0x61eedd;}}else{_0x3030a0[_0x56fa('0x85')]=_0x56fa('0xa3')+_0x161a63[_0x56fa('0x95')]['toUpperCase']();logger[_0x56fa('0x7a')](_0x56fa('0xa4'),_0x3030a0['queue'],_0x3030a0[_0x56fa('0x57')],_0x3030a0[_0x56fa('0x85')]);}}}this[_0x56fa('0x3b')][_0x161a63[_0x56fa('0x4d')]]=_0x3030a0;}}}catch(_0x4d7b36){logger[_0x56fa('0x42')](_0x56fa('0x90'),_0x161a63['uniqueid'],util['inspect'](_0x4d7b36,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x56fa('0xd')][_0x56fa('0x27')]=function(_0x1011e2){try{if(this[_0x56fa('0x6f')](_0x1011e2)){logger[_0x56fa('0x53')](_0x56fa('0xa5'),_0x1011e2['uniqueid'],util['inspect'](_0x1011e2,{'showHidden':![],'depth':null}));this[_0x56fa('0xa6')](_0x1011e2[_0x56fa('0x4d')],_[_0x56fa('0x7d')](_0x1011e2['variable'])[0x0],_0x1011e2[_0x56fa('0xa7')]);if(this[_0x56fa('0x11')][_0x1011e2[_0x56fa('0x4d')]]){var _0x3b5be5=_[_0x56fa('0x89')](this[_0x56fa('0x11')][_0x1011e2[_0x56fa('0x4d')]]);if(_0x3b5be5){if(this[_0x56fa('0x6f')](_0x1011e2[_0x56fa('0xa8')])&&this['isNotNull'](_0x1011e2[_0x56fa('0xa8')][_0x56fa('0x63')])){switch(_0x1011e2[_0x56fa('0xa7')]){case'CONTINUE':_0x3b5be5[_0x56fa('0x92')]=![];_0x3b5be5[_0x56fa('0x93')]=null;break;case _0x56fa('0xa9'):_0x3b5be5[_0x56fa('0xaa')]=_0x56fa('0xab');_0x3b5be5['queuecallerexit']=!![];_0x3b5be5[_0x56fa('0x93')]=moment()[_0x56fa('0x4e')]('YYYY-MM-DD\x20HH:mm:ss');_0x3b5be5['queuecallerleaveAt']=moment()[_0x56fa('0x4e')](_0x56fa('0x76'));logger['debug']('[%s][voiceQueueReport][varset]\x20sending\x20timeout\x20event:',_0x1011e2[_0x56fa('0x4d')],util[_0x56fa('0x45')](_0x3b5be5,{'showHidden':![],'depth':null}));ami[_0x56fa('0x4a')](_0x56fa('0xac'),_0x3b5be5);break;default:_0x3b5be5['queuecallerexit']=!![];_0x3b5be5['queuecallerexitAt']=moment()['format'](_0x56fa('0x76'));_0x3b5be5[_0x56fa('0x8a')]=moment()[_0x56fa('0x4e')](_0x56fa('0x76'));}_0x3b5be5[_0x56fa('0x20')]=![];_0x3b5be5['queuecallerabandonAt']=null;_0x3b5be5[_0x56fa('0x85')]=_0x1011e2[_0x56fa('0xa7')];this[_0x56fa('0x3b')][_0x1011e2[_0x56fa('0x4d')]]=_0x3b5be5;this['emitVoiceQueueChannelRemove'](_0x3b5be5,_0x56fa('0x26'));}else if(this[_0x56fa('0x6f')](_0x1011e2[_0x56fa('0xa8')])&&this[_0x56fa('0x6f')](_0x1011e2[_0x56fa('0xa8')]['queueposition'])){if(!_0x3b5be5[_0x56fa('0x20')]){_0x3b5be5[_0x56fa('0x92')]=!![];_0x3b5be5[_0x56fa('0x93')]=moment()[_0x56fa('0x4e')](_0x56fa('0x76'));_0x3b5be5[_0x56fa('0x85')]=_0x56fa('0xad');_0x3b5be5[_0x56fa('0x8a')]=moment()[_0x56fa('0x4e')](_0x56fa('0x76'));this[_0x56fa('0x3b')][_0x1011e2[_0x56fa('0x4d')]]=_0x3b5be5;}}logger[_0x56fa('0x7a')](_0x56fa('0xae'),_0x1011e2[_0x56fa('0x4d')],_0x3b5be5[_0x56fa('0x50')],_0x3b5be5[_0x56fa('0x57')],_[_0x56fa('0x7d')](_0x1011e2[_0x56fa('0xa8')])[0x0],_0x1011e2[_0x56fa('0xa7')]);_0x3b5be5[_0x56fa('0x18')]=this[_0x56fa('0x18')][_0x1011e2[_0x56fa('0x4d')]];}}}}catch(_0x5712ea){logger[_0x56fa('0x42')](_0x56fa('0xa5'),_0x1011e2['uniqueid'],util[_0x56fa('0x45')](_0x5712ea,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x56fa('0xd')][_0x56fa('0xa6')]=function(_0x42e99d,_0x278e66,_0x5ef55b){var _0x1d40b9=['rtpaudioqos',_0x56fa('0xaf'),_0x56fa('0xb0'),_0x56fa('0xb1'),_0x56fa('0xb2'),_0x56fa('0xb3'),'rtpaudioqosrtt','rtpaudioqosrttbridged',_0x56fa('0xb4'),_0x56fa('0xb5'),_0x56fa('0xb6'),_0x56fa('0xb7'),_0x56fa('0xb8'),_0x56fa('0xb9'),'memberinterface','memberlastcall',_0x56fa('0x91'),_0x56fa('0xba'),_0x56fa('0xbb')];if(!_[_0x56fa('0x3d')](_0x278e66)&&!_[_0x56fa('0xbc')](_0x1d40b9,_0x278e66)){if(_[_0x56fa('0x5c')](this[_0x56fa('0x18')][_0x42e99d])){this['variables'][_0x42e99d]={};}this[_0x56fa('0x18')][_0x42e99d][_0x278e66]=_0x5ef55b;}};VoiceQueueReport['prototype'][_0x56fa('0xbd')]=function(_0x4567c2,_0x350a4e,_0x559b48){try{var _0x30c649={};if(this[_0x56fa('0x11')][_0x4567c2]){for(var _0x208b24=0x0;_0x208b24=0x0?moment(_0x5e64d5[_0x2ad5('0x18')])[_0x2ad5('0xc')](_0x5e64d5[_0x2ad5('0x19')],_0x2ad5('0xe')):null,'data1':_0x2ad5('0x1a'),'data2':_0x5e64d5[_0x2ad5('0x14')],'data3':_0x5e64d5[_0x2ad5('0x11')],'data4':_0x5e64d5[_0x2ad5('0x1b')]||null,'role':_0x2ad5('0x13'),'internal':_0x5e64d5[_0x2ad5('0x14')]?_[_0x2ad5('0x15')](_0x5e64d5[_0x2ad5('0x14')]):undefined,'uniqueid':_0x5e64d5[_0x2ad5('0x16')]},'log':_0x2ad5('0x5')});}; \ No newline at end of file +var _0xc56c=['moment','lodash','util','../client','voiceQueueReport','queuecallercompleteAt','queuecallerexitAt','CreateMemberReport','voice','lastAssignedTo','isNil','interface','format','TALKING','queuecallerleaveAt','inbound','calleridnum','exten','queue','agent','accountcode','toNumber','voiceDialReport','Request','membername','starttime','endtime','diff','seconds','outbound','dialstring','uniqueid'];(function(_0x126a1f,_0x74b42f){var _0xdf6c3d=function(_0x479165){while(--_0x479165){_0x126a1f['push'](_0x126a1f['shift']());}};_0xdf6c3d(++_0x74b42f);}(_0xc56c,0x160));var _0xcc56=function(_0x459fa1,_0x4ab54a){_0x459fa1=_0x459fa1-0x0;var _0x1684bf=_0xc56c[_0x459fa1];return _0x1684bf;};'use strict';var moment=require(_0xcc56('0x0'));var _=require(_0xcc56('0x1'));var util=require(_0xcc56('0x2'));var client=require(_0xcc56('0x3'));exports[_0xcc56('0x4')]=function(_0x4f8d18){var _0x2065ce=_0x4f8d18[_0xcc56('0x5')]||_0x4f8d18[_0xcc56('0x6')];return client['Request'](_0xcc56('0x7'),{'body':{'channel':_0xcc56('0x8'),'membername':_0x4f8d18[_0xcc56('0x9')],'interface':_[_0xcc56('0xa')](_0x4f8d18[_0xcc56('0xb')])?util[_0xcc56('0xc')]('SIP/%s',_0x4f8d18[_0xcc56('0x9')]):_0x4f8d18['interface'],'type':_0xcc56('0xd'),'enterAt':_0x4f8d18['queuecallerleaveAt'],'exitAt':_0x2065ce,'duration':moment(_0x2065ce)['diff'](_0x4f8d18[_0xcc56('0xe')],'seconds'),'data1':_0xcc56('0xf'),'data2':_0x4f8d18[_0xcc56('0x10')],'data3':_0x4f8d18[_0xcc56('0x11')],'data4':null,'data5':_0x4f8d18[_0xcc56('0x12')],'role':_0xcc56('0x13'),'internal':_0x4f8d18[_0xcc56('0x14')]?_[_0xcc56('0x15')](_0x4f8d18[_0xcc56('0x14')]):undefined,'uniqueid':_0x4f8d18['uniqueid']},'log':'CreateMemberReport'});};exports[_0xcc56('0x16')]=function(_0x30b762){return client[_0xcc56('0x17')](_0xcc56('0x7'),{'body':{'channel':'voice','membername':_0x30b762[_0xcc56('0x18')],'interface':_0x30b762['interface'],'type':_0xcc56('0xd'),'enterAt':_0x30b762[_0xcc56('0x19')],'exitAt':_0x30b762[_0xcc56('0x1a')],'duration':moment(_0x30b762[_0xcc56('0x1a')])[_0xcc56('0x1b')](_0x30b762[_0xcc56('0x19')],_0xcc56('0x1c'))>=0x0?moment(_0x30b762[_0xcc56('0x1a')])[_0xcc56('0x1b')](_0x30b762[_0xcc56('0x19')],'seconds'):null,'data1':_0xcc56('0x1d'),'data2':_0x30b762[_0xcc56('0x14')],'data3':_0x30b762[_0xcc56('0x11')],'data4':_0x30b762[_0xcc56('0x1e')]||null,'role':_0xcc56('0x13'),'internal':_0x30b762[_0xcc56('0x14')]?_['toNumber'](_0x30b762[_0xcc56('0x14')]):undefined,'uniqueid':_0x30b762[_0xcc56('0x1f')]},'log':_0xcc56('0x7')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/setting.js b/server/services/ami/rpc/setting.js index 526695a..86fee05 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 _0xe1e8=['Request','previewRecallmeReminderInterval','GetSettings','../client'];(function(_0x3ff085,_0x27c92e){var _0x2b68c3=function(_0x37811e){while(--_0x37811e){_0x3ff085['push'](_0x3ff085['shift']());}};_0x2b68c3(++_0x27c92e);}(_0xe1e8,0x1cb));var _0x8e1e=function(_0x10bd0e,_0x264ead){_0x10bd0e=_0x10bd0e-0x0;var _0x57b4bd=_0xe1e8[_0x10bd0e];return _0x57b4bd;};'use strict';var client=require(_0x8e1e('0x0'));exports['getSettings']=function(){return client[_0x8e1e('0x1')]('ShowSetting',{'options':{'raw':!![],'where':{'id':0x1},'attributes':['stopRecordingOnTransfer',_0x8e1e('0x2')]},'log':_0x8e1e('0x3')});}; \ No newline at end of file +var _0x8ba6=['stopRecordingOnTransfer','previewRecallmeReminderInterval','GetSettings','../client','Request'];(function(_0x42498f,_0x48186c){var _0x1a7382=function(_0x5ccebb){while(--_0x5ccebb){_0x42498f['push'](_0x42498f['shift']());}};_0x1a7382(++_0x48186c);}(_0x8ba6,0x11b));var _0x68ba=function(_0xdbb707,_0x31c33c){_0xdbb707=_0xdbb707-0x0;var _0xfc5508=_0x8ba6[_0xdbb707];return _0xfc5508;};'use strict';var client=require(_0x68ba('0x0'));exports['getSettings']=function(){return client[_0x68ba('0x1')]('ShowSetting',{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0x68ba('0x2'),_0x68ba('0x3')]},'log':_0x68ba('0x4')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/template.js b/server/services/ami/rpc/template.js index 040a28f..d2edc44 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 _0xd0d5=['GetTemplate','name','html','../client','Request'];(function(_0x17de8f,_0x2d5177){var _0xc19ec4=function(_0x3424c0){while(--_0x3424c0){_0x17de8f['push'](_0x17de8f['shift']());}};_0xc19ec4(++_0x2d5177);}(_0xd0d5,0x1e3));var _0x5d0d=function(_0x4d91ed,_0x30c529){_0x4d91ed=_0x4d91ed-0x0;var _0x26f2b3=_0xd0d5[_0x4d91ed];return _0x26f2b3;};'use strict';var client=require(_0x5d0d('0x0'));exports['getTemplates']=function(_0x1def69){return function(_0x27d433){return client[_0x5d0d('0x1')](_0x5d0d('0x2'),{'options':{'raw':!![],'attributes':['id',_0x5d0d('0x3'),_0x5d0d('0x4')]},'log':_0x5d0d('0x2')});};}; \ No newline at end of file +var _0xf5fe=['../client','getTemplates','Request','name','html','GetTemplate'];(function(_0x1265ed,_0x4b85e8){var _0x5ac459=function(_0xf0c114){while(--_0xf0c114){_0x1265ed['push'](_0x1265ed['shift']());}};_0x5ac459(++_0x4b85e8);}(_0xf5fe,0x1da));var _0xef5f=function(_0x467599,_0x10804a){_0x467599=_0x467599-0x0;var _0x4ae44c=_0xf5fe[_0x467599];return _0x4ae44c;};'use strict';var client=require(_0xef5f('0x0'));exports[_0xef5f('0x1')]=function(_0x23606a){return function(_0x1a61a6){return client[_0xef5f('0x2')]('GetTemplate',{'options':{'raw':!![],'attributes':['id',_0xef5f('0x3'),_0xef5f('0x4')]},'log':_0xef5f('0x5')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trigger.js b/server/services/ami/rpc/trigger.js index 1a2e685..1215def 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 _0xa64a=['Condition','AnyConditions','value','Action','data1','data2','data4','data5','data7','GetTrigger','../client','Request','channel','AllConditions','field','operator'];(function(_0x276015,_0x57eb3d){var _0x385345=function(_0x3c5bb4){while(--_0x3c5bb4){_0x276015['push'](_0x276015['shift']());}};_0x385345(++_0x57eb3d);}(_0xa64a,0x12a));var _0xaa64=function(_0x8e44b8,_0x1f2d62){_0x8e44b8=_0x8e44b8-0x0;var _0x3f3a12=_0xa64a[_0x8e44b8];return _0x3f3a12;};'use strict';var client=require(_0xaa64('0x0'));exports['getTriggers']=function(_0x2db718){return function(_0x1f9c3e){return client[_0xaa64('0x1')]('GetTrigger',{'options':{'raw':![],'attributes':['id','name',_0xaa64('0x2'),'status'],'include':[{'model':'Condition','as':_0xaa64('0x3'),'attributes':['id',_0xaa64('0x4'),_0xaa64('0x5'),'value']},{'model':_0xaa64('0x6'),'as':_0xaa64('0x7'),'attributes':['id',_0xaa64('0x4'),'operator',_0xaa64('0x8')]},{'model':_0xaa64('0x9'),'as':'Actions','attributes':['id','action',_0xaa64('0xa'),_0xaa64('0xb'),'data3',_0xaa64('0xc'),_0xaa64('0xd'),'data6',_0xaa64('0xe')]}]},'log':_0xaa64('0xf')});};}; \ No newline at end of file +var _0xd67f=['GetTrigger','name','channel','AllConditions','operator','value','AnyConditions','field','Action','Actions','action','data1','data2','data3','data4','data5','data6','../client','Request'];(function(_0x57e019,_0x108434){var _0x419297=function(_0x492a3f){while(--_0x492a3f){_0x57e019['push'](_0x57e019['shift']());}};_0x419297(++_0x108434);}(_0xd67f,0x1a0));var _0xfd67=function(_0x2104a5,_0x268e07){_0x2104a5=_0x2104a5-0x0;var _0x45c970=_0xd67f[_0x2104a5];return _0x45c970;};'use strict';var client=require(_0xfd67('0x0'));exports['getTriggers']=function(_0x1ae1e7){return function(_0x23a881){return client[_0xfd67('0x1')](_0xfd67('0x2'),{'options':{'raw':![],'attributes':['id',_0xfd67('0x3'),_0xfd67('0x4'),'status'],'include':[{'model':'Condition','as':_0xfd67('0x5'),'attributes':['id','field',_0xfd67('0x6'),_0xfd67('0x7')]},{'model':'Condition','as':_0xfd67('0x8'),'attributes':['id',_0xfd67('0x9'),_0xfd67('0x6'),_0xfd67('0x7')]},{'model':_0xfd67('0xa'),'as':_0xfd67('0xb'),'attributes':['id',_0xfd67('0xc'),_0xfd67('0xd'),_0xfd67('0xe'),_0xfd67('0xf'),_0xfd67('0x10'),_0xfd67('0x11'),_0xfd67('0x12'),'data7']}]},'log':_0xfd67('0x2')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trunk.js b/server/services/ami/rpc/trunk.js index 336f425..d0037c2 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 _0x0748=['registry','../client','getTrunks','Request','GetTrunk','name'];(function(_0xb05c7c,_0x1c7e9c){var _0x226468=function(_0x47e9b6){while(--_0x47e9b6){_0xb05c7c['push'](_0xb05c7c['shift']());}};_0x226468(++_0x1c7e9c);}(_0x0748,0xc7));var _0x8074=function(_0x2f3794,_0x3c3bec){_0x2f3794=_0x2f3794-0x0;var _0x1c9fbe=_0x0748[_0x2f3794];return _0x1c9fbe;};'use strict';var client=require(_0x8074('0x0'));exports[_0x8074('0x1')]=function(_0x56b450){return function(_0x1f570f){return client[_0x8074('0x2')](_0x8074('0x3'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0x8074('0x4'),_0x8074('0x5'),'defaultuser']},'log':_0x8074('0x3')});};}; \ No newline at end of file +var _0x98d3=['defaultuser','../client','getTrunks','GetTrunk','registry'];(function(_0x4f72a3,_0xa2faeb){var _0x126a73=function(_0x755da4){while(--_0x755da4){_0x4f72a3['push'](_0x4f72a3['shift']());}};_0x126a73(++_0xa2faeb);}(_0x98d3,0x173));var _0x398d=function(_0x2e1f11,_0x2e454d){_0x2e1f11=_0x2e1f11-0x0;var _0x11d005=_0x98d3[_0x2e1f11];return _0x11d005;};'use strict';var client=require(_0x398d('0x0'));exports[_0x398d('0x1')]=function(_0x58c1f9){return function(_0x35bbe1){return client['Request'](_0x398d('0x2'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id','name',_0x398d('0x3'),_0x398d('0x4')]},'log':'GetTrunk'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/user.js b/server/services/ami/rpc/user.js index e55f330..bce8539 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 _0x9c44=['online','pauseType','Request','GetUser','agent','name','email','accountcode','lastLoginAt','lastPauseAt','voicePause','phone','mobile','interface','getTelephones','telephone','internal','PauseUser','savePause','getAgent','ShowUser','fullname'];(function(_0x3cb28,_0x2fff70){var _0x232e0c=function(_0x1b3ef3){while(--_0x1b3ef3){_0x3cb28['push'](_0x3cb28['shift']());}};_0x232e0c(++_0x2fff70);}(_0x9c44,0x178));var _0x49c4=function(_0x2e4aa2,_0x11956a){_0x2e4aa2=_0x2e4aa2-0x0;var _0x5e6092=_0x9c44[_0x2e4aa2];return _0x5e6092;};'use strict';var client=require('../client');exports['getAgents']=function(){return function(){return client[_0x49c4('0x0')](_0x49c4('0x1'),{'options':{'raw':![],'where':{'role':_0x49c4('0x2')},'attributes':['id',_0x49c4('0x3'),_0x49c4('0x4'),_0x49c4('0x5'),'fullname','online',_0x49c4('0x6'),'pauseType',_0x49c4('0x7'),_0x49c4('0x8'),_0x49c4('0x9'),_0x49c4('0xa'),_0x49c4('0xb')]},'log':'getAgents'});};};exports[_0x49c4('0xc')]=function(){return function(){return client[_0x49c4('0x0')](_0x49c4('0x1'),{'options':{'raw':!![],'where':{'role':_0x49c4('0xd')},'attributes':['id','name','accountcode',_0x49c4('0xe')]},'log':_0x49c4('0xc')});};};exports['savePause']=function(_0xb611a1,_0x459d09,_0x4adb3c){return client['Request'](_0x49c4('0xf'),{'body':{'type':_0x459d09,'uniqueid':_0x4adb3c},'options':{'where':{'id':_0xb611a1['id']}},'log':_0x49c4('0x10')});};exports['saveUnpause']=function(_0x7df3a9){return client[_0x49c4('0x0')]('UnpauseUser',{'body':{},'options':{'where':{'id':_0x7df3a9['id']}},'log':_0x49c4('0x10')});};exports[_0x49c4('0x11')]=function(_0x21f15a){return client[_0x49c4('0x0')](_0x49c4('0x12'),{'options':{'raw':![],'where':{'role':_0x49c4('0x2'),'id':_0x21f15a},'attributes':['id',_0x49c4('0x3'),_0x49c4('0x4'),'accountcode',_0x49c4('0x13'),_0x49c4('0x14'),_0x49c4('0x6'),_0x49c4('0x15'),_0x49c4('0x7'),'voicePause',_0x49c4('0xb')]},'log':_0x49c4('0x11')});}; \ No newline at end of file +var _0x34e8=['../client','getAgents','Request','GetUser','name','email','accountcode','fullname','online','lastLoginAt','pauseType','voicePause','mobile','interface','getTelephones','telephone','internal','savePause','PauseUser','saveUnpause','UnpauseUser','getAgent','ShowUser','agent','lastPauseAt'];(function(_0x4e35a2,_0x4bd134){var _0x24def6=function(_0x2bb4bd){while(--_0x2bb4bd){_0x4e35a2['push'](_0x4e35a2['shift']());}};_0x24def6(++_0x4bd134);}(_0x34e8,0x12c));var _0x834e=function(_0x263eb8,_0x1aa925){_0x263eb8=_0x263eb8-0x0;var _0x284802=_0x34e8[_0x263eb8];return _0x284802;};'use strict';var client=require(_0x834e('0x0'));exports[_0x834e('0x1')]=function(){return function(){return client[_0x834e('0x2')](_0x834e('0x3'),{'options':{'raw':![],'where':{'role':'agent'},'attributes':['id',_0x834e('0x4'),_0x834e('0x5'),_0x834e('0x6'),_0x834e('0x7'),_0x834e('0x8'),_0x834e('0x9'),_0x834e('0xa'),'lastPauseAt',_0x834e('0xb'),'phone',_0x834e('0xc'),_0x834e('0xd')]},'log':_0x834e('0x1')});};};exports[_0x834e('0xe')]=function(){return function(){return client[_0x834e('0x2')](_0x834e('0x3'),{'options':{'raw':!![],'where':{'role':_0x834e('0xf')},'attributes':['id',_0x834e('0x4'),_0x834e('0x6'),_0x834e('0x10')]},'log':_0x834e('0xe')});};};exports[_0x834e('0x11')]=function(_0x14038b,_0x2e1a37,_0x293514){return client[_0x834e('0x2')](_0x834e('0x12'),{'body':{'type':_0x2e1a37,'uniqueid':_0x293514},'options':{'where':{'id':_0x14038b['id']}},'log':'savePause'});};exports[_0x834e('0x13')]=function(_0x6cd9b9){return client['Request'](_0x834e('0x14'),{'body':{},'options':{'where':{'id':_0x6cd9b9['id']}},'log':_0x834e('0x11')});};exports[_0x834e('0x15')]=function(_0x21cc0a){return client['Request'](_0x834e('0x16'),{'options':{'raw':![],'where':{'role':_0x834e('0x17'),'id':_0x21cc0a},'attributes':['id','name',_0x834e('0x5'),'accountcode',_0x834e('0x7'),_0x834e('0x8'),'lastLoginAt',_0x834e('0xa'),_0x834e('0x18'),_0x834e('0xb'),'interface']},'log':_0x834e('0x15')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceAgentReport.js b/server/services/ami/rpc/voiceAgentReport.js index 6f583df..1dba29d 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 _0xa1bd=['../client','Request','CreateVoiceAgentReport','UpdateVoiceAgentReport'];(function(_0x5b328e,_0x1d1d24){var _0x45a9cc=function(_0x59f067){while(--_0x59f067){_0x5b328e['push'](_0x5b328e['shift']());}};_0x45a9cc(++_0x1d1d24);}(_0xa1bd,0x158));var _0xda1b=function(_0x44787c,_0x37a8f){_0x44787c=_0x44787c-0x0;var _0x3ec69f=_0xa1bd[_0x44787c];return _0x3ec69f;};'use strict';var client=require(_0xda1b('0x0'));exports['create']=function(_0x49f19d){return client[_0xda1b('0x1')](_0xda1b('0x2'),{'body':_0x49f19d,'log':_0xda1b('0x2')});};exports['update']=function(_0x22402c,_0x14e5c4,_0x32df03){return client[_0xda1b('0x1')](_0xda1b('0x3'),{'body':_0x22402c,'options':{'where':{'uniqueid':_0x14e5c4,'interface':_0x32df03,'agentcomplete':!![]}},'log':_0xda1b('0x3')});}; \ No newline at end of file +var _0xd119=['../client','create','Request','CreateVoiceAgentReport','update','UpdateVoiceAgentReport'];(function(_0x5848a7,_0x1decea){var _0x5b32e2=function(_0x34b72d){while(--_0x34b72d){_0x5848a7['push'](_0x5848a7['shift']());}};_0x5b32e2(++_0x1decea);}(_0xd119,0xd2));var _0x9d11=function(_0x19c5f2,_0x44ed13){_0x19c5f2=_0x19c5f2-0x0;var _0xb94caf=_0xd119[_0x19c5f2];return _0xb94caf;};'use strict';var client=require(_0x9d11('0x0'));exports[_0x9d11('0x1')]=function(_0x45b4a6){return client[_0x9d11('0x2')](_0x9d11('0x3'),{'body':_0x45b4a6,'log':_0x9d11('0x3')});};exports[_0x9d11('0x4')]=function(_0x20f050,_0x255eb1,_0x11660d){return client[_0x9d11('0x2')]('UpdateVoiceAgentReport',{'body':_0x20f050,'options':{'where':{'uniqueid':_0x255eb1,'interface':_0x11660d,'agentcomplete':!![]}},'log':_0x9d11('0x5')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceCallReport.js b/server/services/ami/rpc/voiceCallReport.js index f11ca93..7a9525c 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 _0x6ec2=['lodash','../client','Request','CreateVoiceCallReport','merge','context','callerid','getVoiceCallReports','GetVoiceCallReport','outbound','day','format','YYYY-MM-DD\x20HH:mm:ss','endOf','type','disposition','duration','GetVoiceCallReports','util'];(function(_0x38080e,_0x95512d){var _0x4e4c87=function(_0x2be6b3){while(--_0x2be6b3){_0x38080e['push'](_0x38080e['shift']());}};_0x4e4c87(++_0x95512d);}(_0x6ec2,0xf6));var _0x26ec=function(_0x22fd5d,_0x13afb5){_0x22fd5d=_0x22fd5d-0x0;var _0x39153c=_0x6ec2[_0x22fd5d];return _0x39153c;};'use strict';var moment=require('moment');var util=require(_0x26ec('0x0'));var _=require(_0x26ec('0x1'));var client=require(_0x26ec('0x2'));exports['create']=function(_0x294adc){return client[_0x26ec('0x3')](_0x26ec('0x4'),{'body':_[_0x26ec('0x5')](_0x294adc,{'source':_0x294adc['calleridnum'],'destinationcontext':_0x294adc[_0x26ec('0x6')],'callerid':_0x294adc[_0x26ec('0x7')],'amaflags':'DOCUMENTATION'}),'log':'CreateVoiceCallReport'});};exports[_0x26ec('0x8')]=function(){return function(){return client[_0x26ec('0x3')](_0x26ec('0x9'),{'options':{'where':{'type':[_0x26ec('0xa')],'createdAt':{'$between':[moment()['startOf'](_0x26ec('0xb'))[_0x26ec('0xc')](_0x26ec('0xd')),moment()[_0x26ec('0xe')]('day')[_0x26ec('0xc')]('YYYY-MM-DD\x20HH:mm:ss')]}},'attributes':[_0x26ec('0xf'),_0x26ec('0x10'),_0x26ec('0x11'),'billableseconds']},'log':_0x26ec('0x12')});};}; \ No newline at end of file +var _0xf0ba=['disposition','duration','util','lodash','create','Request','merge','callerid','DOCUMENTATION','CreateVoiceCallReport','getVoiceCallReports','GetVoiceCallReport','outbound','format','YYYY-MM-DD\x20HH:mm:ss','endOf','day','type'];(function(_0x432821,_0x3b1d70){var _0x552583=function(_0x2f226f){while(--_0x2f226f){_0x432821['push'](_0x432821['shift']());}};_0x552583(++_0x3b1d70);}(_0xf0ba,0x110));var _0xaf0b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xf0ba[_0x20a584];return _0x4b41a8;};'use strict';var moment=require('moment');var util=require(_0xaf0b('0x0'));var _=require(_0xaf0b('0x1'));var client=require('../client');exports[_0xaf0b('0x2')]=function(_0x54b79f){return client[_0xaf0b('0x3')]('CreateVoiceCallReport',{'body':_[_0xaf0b('0x4')](_0x54b79f,{'source':_0x54b79f['calleridnum'],'destinationcontext':_0x54b79f['context'],'callerid':_0x54b79f[_0xaf0b('0x5')],'amaflags':_0xaf0b('0x6')}),'log':_0xaf0b('0x7')});};exports[_0xaf0b('0x8')]=function(){return function(){return client[_0xaf0b('0x3')](_0xaf0b('0x9'),{'options':{'where':{'type':[_0xaf0b('0xa')],'createdAt':{'$between':[moment()['startOf']('day')[_0xaf0b('0xb')](_0xaf0b('0xc')),moment()[_0xaf0b('0xd')](_0xaf0b('0xe'))['format'](_0xaf0b('0xc'))]}},'attributes':[_0xaf0b('0xf'),_0xaf0b('0x10'),_0xaf0b('0x11'),'billableseconds']},'log':'GetVoiceCallReports'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceDialReport.js b/server/services/ami/rpc/voiceDialReport.js index cdf48b2..eb5f850 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 _0x8d0f=['Request','CreateVoiceDialReport','../client','create'];(function(_0x19779d,_0x32f029){var _0x5cfc06=function(_0x54ba1e){while(--_0x54ba1e){_0x19779d['push'](_0x19779d['shift']());}};_0x5cfc06(++_0x32f029);}(_0x8d0f,0x72));var _0xf8d0=function(_0x59a549,_0x2fe2bb){_0x59a549=_0x59a549-0x0;var _0x12adbe=_0x8d0f[_0x59a549];return _0x12adbe;};'use strict';var client=require(_0xf8d0('0x0'));exports[_0xf8d0('0x1')]=function(_0x399cf8){return client[_0xf8d0('0x2')]('CreateVoiceDialReport',{'body':_0x399cf8,'log':_0xf8d0('0x3')});}; \ No newline at end of file +var _0xdeeb=['CreateVoiceDialReport','create','Request'];(function(_0x25d2fb,_0x18a774){var _0x1ded53=function(_0x4c0715){while(--_0x4c0715){_0x25d2fb['push'](_0x25d2fb['shift']());}};_0x1ded53(++_0x18a774);}(_0xdeeb,0x1d2));var _0xbdee=function(_0x16771d,_0x224c60){_0x16771d=_0x16771d-0x0;var _0x386f11=_0xdeeb[_0x16771d];return _0x386f11;};'use strict';var client=require('../client');exports[_0xbdee('0x0')]=function(_0x36268a){return client[_0xbdee('0x1')](_0xbdee('0x2'),{'body':_0x36268a,'log':_0xbdee('0x2')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceExtension.js b/server/services/ami/rpc/voiceExtension.js index 5192b5c..5d6e38b 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 _0xeea4=['../client','getVoiceExtensions','Request','GetVoiceExtension','exten','recordingFormat'];(function(_0x48ccc1,_0x55e9cb){var _0x9ffe13=function(_0x323a36){while(--_0x323a36){_0x48ccc1['push'](_0x48ccc1['shift']());}};_0x9ffe13(++_0x55e9cb);}(_0xeea4,0x19e));var _0x4eea=function(_0x37f29b,_0x4419e4){_0x37f29b=_0x37f29b-0x0;var _0x2389da=_0xeea4[_0x37f29b];return _0x2389da;};'use strict';var client=require(_0x4eea('0x0'));exports[_0x4eea('0x1')]=function(){return function(){return client[_0x4eea('0x2')](_0x4eea('0x3'),{'options':{'raw':!![],'attributes':['id',_0x4eea('0x4'),_0x4eea('0x5')],'where':{'VoiceExtensionId':null}},'log':_0x4eea('0x1')});};}; \ No newline at end of file +var _0xde9d=['GetVoiceExtension','exten','../client','getVoiceExtensions','Request'];(function(_0x413feb,_0x10477f){var _0x40ee88=function(_0x32a3f6){while(--_0x32a3f6){_0x413feb['push'](_0x413feb['shift']());}};_0x40ee88(++_0x10477f);}(_0xde9d,0x156));var _0xdde9=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xde9d[_0xa464c9];return _0x3d73c4;};'use strict';var client=require(_0xdde9('0x0'));exports[_0xdde9('0x1')]=function(){return function(){return client[_0xdde9('0x2')](_0xdde9('0x3'),{'options':{'raw':!![],'attributes':['id',_0xdde9('0x4'),'recordingFormat'],'where':{'VoiceExtensionId':null}},'log':_0xdde9('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueue.js b/server/services/ami/rpc/voiceQueue.js index ddace2c..d480d7b 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 _0x62b6=['Trunk','callerid','active','Pause','Interval','interval','../client','GetVoiceQueue','name','acw','acwTimeout','autopause','monitor_format','type','dialActive','dialMethod','dialPowerLevel','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialTimezone','dialPrefix','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDBetweenWordsSilence','dialAMDSilenceThreshold','dialAMDMaximumWordLength','dialRecallMeTimeout','dialOrderByScheduledAt','dialAgiAfterHangupClient','dialQueueProject2','strategy','dialRandomLastDigitCallerIdNumber','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','mandatoryDisposition','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder'];(function(_0x3c5fd9,_0x40ce3b){var _0x2a245d=function(_0x32f619){while(--_0x32f619){_0x3c5fd9['push'](_0x3c5fd9['shift']());}};_0x2a245d(++_0x40ce3b);}(_0x62b6,0x19c));var _0x662b=function(_0x1c2d5d,_0x441658){_0x1c2d5d=_0x1c2d5d-0x0;var _0x24f987=_0x62b6[_0x1c2d5d];return _0x24f987;};'use strict';var client=require(_0x662b('0x0'));exports['getVoiceQueues']=function(){return function(){return client['Request'](_0x662b('0x1'),{'options':{'raw':![],'attributes':['id',_0x662b('0x2'),_0x662b('0x3'),_0x662b('0x4'),_0x662b('0x5'),_0x662b('0x6'),_0x662b('0x7'),_0x662b('0x8'),_0x662b('0x9'),'dialLimitChannel','dialLimitQueue',_0x662b('0xa'),'dialPredictiveOptimization',_0x662b('0xb'),_0x662b('0xc'),_0x662b('0xd'),_0x662b('0xe'),_0x662b('0xf'),'dialQueueOptions',_0x662b('0x10'),_0x662b('0x11'),_0x662b('0x12'),_0x662b('0x13'),_0x662b('0x14'),_0x662b('0x15'),'dialNoAnswerMaxRetry',_0x662b('0x16'),_0x662b('0x17'),_0x662b('0x18'),'dialGlobalInterval',_0x662b('0x19'),'dialCheckDuplicateType',_0x662b('0x1a'),_0x662b('0x1b'),_0x662b('0x1c'),_0x662b('0x1d'),_0x662b('0x1e'),'dialAMDMinWordLength',_0x662b('0x1f'),'dialAMDMaximumNumberOfWords',_0x662b('0x20'),_0x662b('0x21'),'timeout',_0x662b('0x22'),'dialRecallInQueue',_0x662b('0x23'),'dialAgiAfterHangupAgent',_0x662b('0x24'),_0x662b('0x25'),_0x662b('0x6'),_0x662b('0x26'),_0x662b('0x27'),'dialCutDigit',_0x662b('0x28'),_0x662b('0x29'),_0x662b('0x2a'),'dialDropRetryFrequency',_0x662b('0x2b'),_0x662b('0x2c'),'dialMachineMaxRetry','dialMachineRetryFrequency',_0x662b('0x2d'),_0x662b('0x2e'),_0x662b('0x2f'),_0x662b('0x30'),_0x662b('0x31'),_0x662b('0x32'),_0x662b('0x33')],'include':[{'model':_0x662b('0x34'),'as':_0x662b('0x34'),'attributes':['id','name',_0x662b('0x35'),_0x662b('0x36')]},{'model':_0x662b('0x37'),'as':'mandatoryDispositionPause','attributes':['id',_0x662b('0x2')]},{'model':_0x662b('0x34'),'as':'TrunkBackup','attributes':['id',_0x662b('0x2'),_0x662b('0x35'),_0x662b('0x36')]},{'model':_0x662b('0x38'),'as':_0x662b('0x38'),'attributes':['id',_0x662b('0x2')],'include':[{'model':_0x662b('0x38'),'as':'Intervals','attributes':['id',_0x662b('0x2'),_0x662b('0x39')]}]}]},'log':'getVoiceQueues'});};}; \ No newline at end of file +var _0xa9ae=['callerid','Interval','Intervals','interval','../client','getVoiceQueues','Request','GetVoiceQueue','acw','acwTimeout','monitor_format','type','dialActive','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialQueueOptions','dialQueueTimeout','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerRetryFrequency','dialTimezone','dialGlobalInterval','dialPrefix','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDMaximumWordLength','timeout','dialRecallMeTimeout','dialRecallInQueue','dialOrderByScheduledAt','dialAgiAfterHangupAgent','dialAgiAfterHangupClient','strategy','dialCutDigit','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','dialPreviewAutoRecallMe','Trunk','name','active','Pause','mandatoryDispositionPause','TrunkBackup'];(function(_0x3236be,_0x47eb9b){var _0x40a904=function(_0x14301c){while(--_0x14301c){_0x3236be['push'](_0x3236be['shift']());}};_0x40a904(++_0x47eb9b);}(_0xa9ae,0x193));var _0xea9a=function(_0x34cf4a,_0x5605fd){_0x34cf4a=_0x34cf4a-0x0;var _0x4339b2=_0xa9ae[_0x34cf4a];return _0x4339b2;};'use strict';var client=require(_0xea9a('0x0'));exports[_0xea9a('0x1')]=function(){return function(){return client[_0xea9a('0x2')](_0xea9a('0x3'),{'options':{'raw':![],'attributes':['id','name',_0xea9a('0x4'),_0xea9a('0x5'),'autopause',_0xea9a('0x6'),_0xea9a('0x7'),_0xea9a('0x8'),'dialMethod','dialLimitChannel',_0xea9a('0x9'),_0xea9a('0xa'),_0xea9a('0xb'),_0xea9a('0xc'),'dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout',_0xea9a('0xd'),_0xea9a('0xe'),'dialQueueProject','dialCongestionMaxRetry',_0xea9a('0xf'),_0xea9a('0x10'),_0xea9a('0x11'),'dialNoAnswerMaxRetry',_0xea9a('0x12'),'dialGlobalMaxRetry',_0xea9a('0x13'),_0xea9a('0x14'),_0xea9a('0x15'),'dialCheckDuplicateType','dialAMDActive','dialAMDInitialSilence',_0xea9a('0x16'),_0xea9a('0x17'),_0xea9a('0x18'),_0xea9a('0x19'),_0xea9a('0x1a'),_0xea9a('0x1b'),'dialAMDSilenceThreshold',_0xea9a('0x1c'),_0xea9a('0x1d'),_0xea9a('0x1e'),_0xea9a('0x1f'),_0xea9a('0x20'),_0xea9a('0x21'),_0xea9a('0x22'),'dialQueueProject2',_0xea9a('0x6'),_0xea9a('0x23'),'dialRandomLastDigitCallerIdNumber',_0xea9a('0x24'),_0xea9a('0x25'),_0xea9a('0x26'),'dialDropMaxRetry',_0xea9a('0x27'),_0xea9a('0x28'),_0xea9a('0x29'),'dialMachineMaxRetry','dialMachineRetryFrequency',_0xea9a('0x2a'),_0xea9a('0x2b'),'mandatoryDisposition',_0xea9a('0x2c'),_0xea9a('0x2d'),_0xea9a('0x2e'),'dialPreviewRecallmeReminder'],'include':[{'model':_0xea9a('0x2f'),'as':_0xea9a('0x2f'),'attributes':['id',_0xea9a('0x30'),'callerid',_0xea9a('0x31')]},{'model':_0xea9a('0x32'),'as':_0xea9a('0x33'),'attributes':['id',_0xea9a('0x30')]},{'model':_0xea9a('0x2f'),'as':_0xea9a('0x34'),'attributes':['id',_0xea9a('0x30'),_0xea9a('0x35'),_0xea9a('0x31')]},{'model':'Interval','as':_0xea9a('0x36'),'attributes':['id',_0xea9a('0x30')],'include':[{'model':_0xea9a('0x36'),'as':_0xea9a('0x37'),'attributes':['id','name',_0xea9a('0x38')]}]}]},'log':_0xea9a('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueueReport.js b/server/services/ami/rpc/voiceQueueReport.js index 4a21eab..0e5beb2 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(_0x4788c3,_0x4c7c22){var _0x486a0f=function(_0x44773d){while(--_0x44773d){_0x4788c3['push'](_0x4788c3['shift']());}};_0x486a0f(++_0x4c7c22);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4bfac3,_0x58324d){_0x4bfac3=_0x4bfac3-0x0;var _0x15f0f2=_0xa9e0[_0x4bfac3];return _0x15f0f2;};'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(_0x17835f,_0x58d892){var _0x1b6426=function(_0x212f46){while(--_0x212f46){_0x17835f['push'](_0x17835f['shift']());}};_0x1b6426(++_0x58d892);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0xa9e0[_0x4cf98e];return _0x1623ac;};'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 a913a90..12cfad4 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 _0x4a90=['GetVoiceQueueRtPauses','../client','getVoiceQueueRtPauses','Request'];(function(_0x17cb01,_0xad4fd6){var _0x1786ce=function(_0x91faa6){while(--_0x91faa6){_0x17cb01['push'](_0x17cb01['shift']());}};_0x1786ce(++_0xad4fd6);}(_0x4a90,0x129));var _0x04a9=function(_0x3743cf,_0x51579e){_0x3743cf=_0x3743cf-0x0;var _0x32358f=_0x4a90[_0x3743cf];return _0x32358f;};'use strict';var client=require(_0x04a9('0x0'));exports[_0x04a9('0x1')]=function(_0x16b014){return function(){return client[_0x04a9('0x2')](_0x04a9('0x3'),{'options':{'where':{'VoiceQueueId':_0x16b014,'paused':!![]},'raw':!![]},'log':_0x04a9('0x1')});};}; \ No newline at end of file +var _0xe169=['getVoiceQueueRtPauses','../client','Request','GetVoiceQueueRtPauses'];(function(_0x330821,_0x1e53f1){var _0x2aa30c=function(_0x3680ff){while(--_0x3680ff){_0x330821['push'](_0x330821['shift']());}};_0x2aa30c(++_0x1e53f1);}(_0xe169,0x10d));var _0x9e16=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0xe169[_0x4b369d];return _0x571a98;};'use strict';var client=require(_0x9e16('0x0'));exports['getVoiceQueueRtPauses']=function(_0x35a023){return function(){return client[_0x9e16('0x1')](_0x9e16('0x2'),{'options':{'where':{'VoiceQueueId':_0x35a023,'paused':!![]},'raw':!![]},'log':_0x9e16('0x3')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceRecording.js b/server/services/ami/rpc/voiceRecording.js index c591b40..f63946f 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(_0x456dc4,_0x39f6a4){var _0x437250=function(_0x168ed3){while(--_0x168ed3){_0x456dc4['push'](_0x456dc4['shift']());}};_0x437250(++_0x39f6a4);}(_0x7a54,0x106));var _0x47a5=function(_0x1c49bc,_0x19c921){_0x1c49bc=_0x1c49bc-0x0;var _0x4b064e=_0x7a54[_0x1c49bc];return _0x4b064e;};'use strict';var _=require(_0x47a5('0x0'));var client=require(_0x47a5('0x1'));exports[_0x47a5('0x2')]=function(_0x58157c){return client[_0x47a5('0x3')](_0x47a5('0x4'),{'body':_['merge'](_0x58157c,{'value':_0x58157c[_0x47a5('0x5')]}),'log':_0x47a5('0x4')});}; \ No newline at end of file +var _0x9957=['CreateVoiceRecording','merge','monitorFilename','lodash','../client','create'];(function(_0x2146d9,_0x50cab5){var _0x5ed8dc=function(_0x3c58e3){while(--_0x3c58e3){_0x2146d9['push'](_0x2146d9['shift']());}};_0x5ed8dc(++_0x50cab5);}(_0x9957,0x93));var _0x7995=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x9957[_0x3b380d];return _0x54502b;};'use strict';var _=require(_0x7995('0x0'));var client=require(_0x7995('0x1'));exports[_0x7995('0x2')]=function(_0x10a05d){return client['Request'](_0x7995('0x3'),{'body':_[_0x7995('0x4')](_0x10a05d,{'value':_0x10a05d[_0x7995('0x5')]}),'log':_0x7995('0x3')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceTransferReport.js b/server/services/ami/rpc/voiceTransferReport.js index 044cd1b..df67c13 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 _0x0597=['transfererconnectedlinenum','transfererconnectedlinename','transfereraccountcode','transfererlinkedid','transfereechannel','transfereecalleridnum','transfereecalleridname','transfereeconnectedlinenum','transfereeconnectedlinename','transfereeaccountcode','transfereeexten','transfereelinkedid','isexternal','context','blind','attendedTransfer','origtransfererchannel','origtransferercalleridnum','secondtransfererconnectedlinenum','origtransfereraccountcode','secondtransfererexten','transfertargetchannel','transfertargetcalleridnum','transfertargetcalleridname','transfertargetexten','origtransferercontext','origtransfererexten','attended','../client','transfers','Request','CreateVoiceTransferReport','result','transfererchannel','transferercalleridname'];(function(_0x59857d,_0x16f4fa){var _0x17b121=function(_0x434329){while(--_0x434329){_0x59857d['push'](_0x59857d['shift']());}};_0x17b121(++_0x16f4fa);}(_0x0597,0x1c0));var _0x7059=function(_0x4517f6,_0x2db9a5){_0x4517f6=_0x4517f6-0x0;var _0xd2e6ff=_0x0597[_0x4517f6];return _0xd2e6ff;};'use strict';var client=require(_0x7059('0x0'));exports[_0x7059('0x1')]={};exports['blindTransfer']=function(_0x707737){return client[_0x7059('0x2')](_0x7059('0x3'),{'body':{'result':_0x707737[_0x7059('0x4')],'transfererchannel':_0x707737[_0x7059('0x5')],'transferercalleridnum':_0x707737['transferercalleridnum'],'transferercalleridname':_0x707737[_0x7059('0x6')],'transfererconnectedlinenum':_0x707737[_0x7059('0x7')],'transfererconnectedlinename':_0x707737[_0x7059('0x8')],'transfereraccountcode':_0x707737[_0x7059('0x9')],'transferercontext':_0x707737['transferercontext'],'transfererexten':_0x707737['transfererexten'],'transfererlinkedid':_0x707737[_0x7059('0xa')],'transfereechannel':_0x707737[_0x7059('0xb')],'transfereecalleridnum':_0x707737[_0x7059('0xc')],'transfereecalleridname':_0x707737[_0x7059('0xd')],'transfereeconnectedlinenum':_0x707737[_0x7059('0xe')],'transfereeconnectedlinename':_0x707737[_0x7059('0xf')],'transfereeaccountcode':_0x707737[_0x7059('0x10')],'transfereecontext':_0x707737['transfereecontext'],'transfereeexten':_0x707737[_0x7059('0x11')],'transfereelinkedid':_0x707737[_0x7059('0x12')],'isexternal':_0x707737[_0x7059('0x13')],'context':_0x707737[_0x7059('0x14')],'extension':_0x707737['extension'],'type':_0x7059('0x15')},'log':_0x7059('0x3')});};exports[_0x7059('0x16')]=function(_0x2aaa09){return client[_0x7059('0x2')]('CreateVoiceTransferReport',{'body':{'result':_0x2aaa09[_0x7059('0x4')],'transfererchannel':_0x2aaa09[_0x7059('0x17')],'transferercalleridnum':_0x2aaa09[_0x7059('0x18')],'transferercalleridname':_0x2aaa09['origtransferercalleridname'],'transfererconnectedlinenum':_0x2aaa09[_0x7059('0x19')],'transfererconnectedlinename':_0x2aaa09['secondtransfererconnectedlinename'],'transfereraccountcode':_0x2aaa09[_0x7059('0x1a')],'transferercontext':_0x2aaa09['secondtransferercontext'],'transfererexten':_0x2aaa09[_0x7059('0x1b')],'transfererlinkedid':_0x2aaa09['origtransfererlinkedid'],'transfereechannel':_0x2aaa09[_0x7059('0x1c')],'transfereecalleridnum':_0x2aaa09[_0x7059('0x1d')],'transfereecalleridname':_0x2aaa09[_0x7059('0x1e')],'transfereeconnectedlinenum':_0x2aaa09['transfertargetconnectedlinenum'],'transfereeconnectedlinename':_0x2aaa09['transfertargetconnectedlinename'],'transfereeaccountcode':_0x2aaa09['transfertargetaccountcode'],'transfereecontext':_0x2aaa09['transfertargetcontext'],'transfereeexten':_0x2aaa09[_0x7059('0x1f')],'transfereelinkedid':_0x2aaa09['transfertargetlinkedid'],'isexternal':_0x2aaa09[_0x7059('0x13')],'context':_0x2aaa09[_0x7059('0x20')],'extension':_0x2aaa09[_0x7059('0x21')],'type':_0x7059('0x22')},'log':_0x7059('0x3')});}; \ No newline at end of file +var _0x9472=['origtransfererchannel','origtransferercalleridnum','origtransferercalleridname','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','secondtransfererexten','origtransfererlinkedid','transfertargetchannel','transfertargetcalleridnum','transfertargetaccountcode','transfertargetcontext','transfertargetexten','transfertargetlinkedid','origtransferercontext','attended','../client','transfers','CreateVoiceTransferReport','result','transferercalleridname','transfererconnectedlinenum','transfererconnectedlinename','transfereraccountcode','transferercontext','transfererexten','transfererlinkedid','transfereechannel','transfereecalleridnum','transfereecalleridname','transfereeconnectedlinenum','transfereeaccountcode','transfereecontext','transfereeexten','transfereelinkedid','isexternal','extension','attendedTransfer','Request'];(function(_0x495560,_0xde54bf){var _0x319c9d=function(_0xfb14fb){while(--_0xfb14fb){_0x495560['push'](_0x495560['shift']());}};_0x319c9d(++_0xde54bf);}(_0x9472,0x89));var _0x2947=function(_0x4cef44,_0x140814){_0x4cef44=_0x4cef44-0x0;var _0x22b699=_0x9472[_0x4cef44];return _0x22b699;};'use strict';var client=require(_0x2947('0x0'));exports[_0x2947('0x1')]={};exports['blindTransfer']=function(_0x4e655d){return client['Request'](_0x2947('0x2'),{'body':{'result':_0x4e655d[_0x2947('0x3')],'transfererchannel':_0x4e655d['transfererchannel'],'transferercalleridnum':_0x4e655d['transferercalleridnum'],'transferercalleridname':_0x4e655d[_0x2947('0x4')],'transfererconnectedlinenum':_0x4e655d[_0x2947('0x5')],'transfererconnectedlinename':_0x4e655d[_0x2947('0x6')],'transfereraccountcode':_0x4e655d[_0x2947('0x7')],'transferercontext':_0x4e655d[_0x2947('0x8')],'transfererexten':_0x4e655d[_0x2947('0x9')],'transfererlinkedid':_0x4e655d[_0x2947('0xa')],'transfereechannel':_0x4e655d[_0x2947('0xb')],'transfereecalleridnum':_0x4e655d[_0x2947('0xc')],'transfereecalleridname':_0x4e655d[_0x2947('0xd')],'transfereeconnectedlinenum':_0x4e655d[_0x2947('0xe')],'transfereeconnectedlinename':_0x4e655d['transfereeconnectedlinename'],'transfereeaccountcode':_0x4e655d[_0x2947('0xf')],'transfereecontext':_0x4e655d[_0x2947('0x10')],'transfereeexten':_0x4e655d[_0x2947('0x11')],'transfereelinkedid':_0x4e655d[_0x2947('0x12')],'isexternal':_0x4e655d[_0x2947('0x13')],'context':_0x4e655d['context'],'extension':_0x4e655d[_0x2947('0x14')],'type':'blind'},'log':_0x2947('0x2')});};exports[_0x2947('0x15')]=function(_0x56a7e6){return client[_0x2947('0x16')](_0x2947('0x2'),{'body':{'result':_0x56a7e6['result'],'transfererchannel':_0x56a7e6[_0x2947('0x17')],'transferercalleridnum':_0x56a7e6[_0x2947('0x18')],'transferercalleridname':_0x56a7e6[_0x2947('0x19')],'transfererconnectedlinenum':_0x56a7e6[_0x2947('0x1a')],'transfererconnectedlinename':_0x56a7e6[_0x2947('0x1b')],'transfereraccountcode':_0x56a7e6[_0x2947('0x1c')],'transferercontext':_0x56a7e6[_0x2947('0x1d')],'transfererexten':_0x56a7e6[_0x2947('0x1e')],'transfererlinkedid':_0x56a7e6[_0x2947('0x1f')],'transfereechannel':_0x56a7e6[_0x2947('0x20')],'transfereecalleridnum':_0x56a7e6[_0x2947('0x21')],'transfereecalleridname':_0x56a7e6['transfertargetcalleridname'],'transfereeconnectedlinenum':_0x56a7e6['transfertargetconnectedlinenum'],'transfereeconnectedlinename':_0x56a7e6['transfertargetconnectedlinename'],'transfereeaccountcode':_0x56a7e6[_0x2947('0x22')],'transfereecontext':_0x56a7e6[_0x2947('0x23')],'transfereeexten':_0x56a7e6[_0x2947('0x24')],'transfereelinkedid':_0x56a7e6[_0x2947('0x25')],'isexternal':_0x56a7e6[_0x2947('0x13')],'context':_0x56a7e6[_0x2947('0x26')],'extension':_0x56a7e6['origtransfererexten'],'type':_0x2947('0x27')},'log':'CreateVoiceTransferReport'});}; \ No newline at end of file diff --git a/server/services/ami/server/index.js b/server/services/ami/server/index.js index 56681d1..9d17920 100644 --- a/server/services/ami/server/index.js +++ b/server/services/ami/server/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['type','Invalid\x20type\x20parameter.\x20Allowed\x20values:\x20inbound,\x20outbound','filter','count','rows','voicequeuechannel','voicequeuechannelhangup','Hangup','voicequeuechannelredirect','Redirect','telephones','trunks','run','event','Event\x20name\x20mandatory','faxAccounts','send','checkAfterSend','server','http','127.0.0.1','RPC\x20listening\x20on\x20port:','lodash','jayson/promise','validate','moment','../properties','../ami','../model/voiceQueueSummary','listen','format','%s/%s','SIP','name','timers','timer','updateAcw','agents','voiceStatus','pause','QueuePause','isConnected','error','asterisk','username','ami\x20disconnected','join','pick','keys','module','action','Reload','Action','then','message','catch','command','Command','content','voiceQueues','hasOwnProperty','push','length','find','omit','undefined','values','voicechannel','map','channels','uniqueid','channel','%s.%s','filename','wav','ai(mixmonitorid)','/var/spool/asterisk/monitor/','toLowerCase','mixmonitorid','rec','status','MixMonitor\x20Success','Channel\x20doesn\x27t\x20exist','resolve','StopMixMonitor','destinationchannel','monitors','stop','queueChannels','inbound','outbound','includes'];(function(_0x3ceca5,_0x5c9695){var _0x4207d9=function(_0x5537b9){while(--_0x5537b9){_0x3ceca5['push'](_0x3ceca5['shift']());}};_0x4207d9(++_0x5c9695);}(_0xb10b,0x12a));var _0xbb10=function(_0x509b99,_0x3ff1f0){_0x509b99=_0x509b99-0x0;var _0x383d46=_0xb10b[_0x509b99];return _0x383d46;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var jayson=require(_0xbb10('0x1'));var schema=require(_0xbb10('0x2'));var moment=require(_0xbb10('0x3'));var config=require('../../../config/environment');var properties=require(_0xbb10('0x4'));var ami=require(_0xbb10('0x5'));var VoiceQueueSummary=require(_0xbb10('0x6'));exports[_0xbb10('0x7')]=function(_0x49baf4,_0x312b72,_0x481979){return new Promise(function(_0x328583,_0x3cdd53){var _0x513741={'QueuePause':function(_0x1b9e94){return new Promise(function(_0x3fb675){var _0x21370f=util[_0xbb10('0x8')](_0xbb10('0x9'),_0xbb10('0xa'),_0x1b9e94[_0xbb10('0xb')]);if(_0x49baf4[_0xbb10('0xc')]&&_0x49baf4['timers'][_0x21370f]&&_0x49baf4['timers'][_0x21370f][_0xbb10('0xd')]){_0x49baf4[_0xbb10('0xc')][_0x21370f][_0xbb10('0xe')]();}if(_0x49baf4['agents'][_0x21370f]){_0x49baf4[_0xbb10('0xf')][_0x21370f]['updateStatusRealtime']({'state':_0x49baf4[_0xbb10('0xf')][_0x21370f][_0xbb10('0x10')],'statePause':_0x1b9e94[_0xbb10('0x11')]?!![]:![]});}_0x3fb675({'code':0xc8,'message':_0xbb10('0x12')});});},'Reload':function(_0x442548){var _0x147230=this;return new Promise(function(_0x58a612,_0x26e021){if(ami[_0xbb10('0x13')]()==![]){return _0x26e021(_0x147230[_0xbb10('0x14')](0x1f4,[config[_0xbb10('0x15')]['ip'],config[_0xbb10('0x15')][_0xbb10('0x16')],_0xbb10('0x17')][_0xbb10('0x18')]('\x20')));}_0x442548=_[_0xbb10('0x19')](_0x442548,_[_0xbb10('0x1a')](properties['reload'][_0xbb10('0x1b')]));_0x442548[_0xbb10('0x1c')]=_0xbb10('0x1d');return ami[_0xbb10('0x1e')](_0x442548)[_0xbb10('0x1f')](function(_0x1682a4){_0x58a612({'code':0xc8,'message':_0x1682a4[_0xbb10('0x20')]});})[_0xbb10('0x21')](function(_0xbf2906){_0x26e021(_0x147230[_0xbb10('0x14')](0x1f5,_0xbf2906['message']));});});},'Command':function(_0x5ff0cf){var _0x19f48d=this;return new Promise(function(_0x388fab,_0x109908){if(ami[_0xbb10('0x13')]()==![]){return _0x109908(_0x19f48d[_0xbb10('0x14')](0x1f4,[config['asterisk']['ip'],config[_0xbb10('0x15')][_0xbb10('0x16')],'ami\x20disconnected']['join']('\x20')));}_0x5ff0cf=_[_0xbb10('0x19')](_0x5ff0cf,_0xbb10('0x22'));_0x5ff0cf[_0xbb10('0x1c')]=_0xbb10('0x23');return ami[_0xbb10('0x1e')](_0x5ff0cf)[_0xbb10('0x1f')](function(_0x407cb4){_0x388fab({'code':0xc8,'message':_0x407cb4[_0xbb10('0x24')]});})[_0xbb10('0x21')](function(_0x395404){_0x109908(_0x19f48d[_0xbb10('0x14')](0x1f5,_0x395404[_0xbb10('0x20')]));});});},'VoiceQueues':function(){return new Promise(function(_0x537898){var _0x4fedac=[];for(var _0x4fb5e0 in _0x49baf4[_0xbb10('0x25')]){if(_0x49baf4[_0xbb10('0x25')][_0xbb10('0x26')](_0x4fb5e0)){var _0x4e25ff=_0x49baf4[_0xbb10('0x25')][_0x4fb5e0];var _0x24d586=new VoiceQueueSummary(_0x4e25ff);_0x4fedac[_0xbb10('0x27')](_0x24d586);}}_0x537898({'count':_0x4fedac[_0xbb10('0x28')],'rows':_0x4fedac});});},'UpdateVoiceQueue':function(_0x1acce9){return new Promise(function(_0x20d946,_0x2a0e8b){var _0x4aabb9=_[_0xbb10('0x29')](_0x49baf4[_0xbb10('0x25')],{'id':parseInt(_0x1acce9['id'])});var _0xfc3595=_[_0xbb10('0x2a')](_0x1acce9,['id']);if(_0x4aabb9){for(var _0x1d30aa in _0xfc3595){if(typeof _0xfc3595[_0x1d30aa]!==_0xbb10('0x2b')&&typeof _0x4aabb9[_0x1d30aa]!=='undefined'){_0x4aabb9[_0x1d30aa]=_0xfc3595[_0x1d30aa];}}_0x20d946(_0x4aabb9);}else{_0x2a0e8b();}});},'VoiceChannels':function(){return new Promise(function(_0x221624){var _0x4ee02e=_[_0xbb10('0x2c')](_0x49baf4['channels']);_0x221624({'count':_0x4ee02e[_0xbb10('0x28')],'rows':_0x4ee02e});});},'VoiceChannelMixMonitor':function(_0x1dcc9c){var _0x1b59f9=this;return new Promise(function(_0x491db4,_0x518d47){if(ami[_0xbb10('0x13')]()==![]){return _0x518d47(_0x1b59f9[_0xbb10('0x14')](0x1f4,[config['asterisk']['ip'],config[_0xbb10('0x15')][_0xbb10('0x16')],_0xbb10('0x17')][_0xbb10('0x18')]('\x20')));}var _0x37a83f=schema(properties[_0xbb10('0x2d')])[_0xbb10('0x2')](_0x1dcc9c);if(_0x37a83f['length']>0x0){return _0x518d47(_0x1b59f9[_0xbb10('0x14')](0x1f4,_[_0xbb10('0x2e')](_0x37a83f,_0xbb10('0x20'))[_0xbb10('0x18')](',\x20')));}var _0xfb2c5e=_[_0xbb10('0x29')](_0x49baf4[_0xbb10('0x2f')],{'uniqueid':_0x1dcc9c[_0xbb10('0x30')]});if(_0xfb2c5e&&_0xfb2c5e[_0xbb10('0x31')]){var _0x56943c=util[_0xbb10('0x8')](_0xbb10('0x32'),_0x1dcc9c[_0xbb10('0x33')]||_0x1dcc9c[_0xbb10('0x30')],_0x1dcc9c['format']||_0xbb10('0x34'));return ami['Action']({'action':'MixMonitor','channel':_0xfb2c5e[_0xbb10('0x31')],'file':_0x56943c,'options':_0xbb10('0x35')})[_0xbb10('0x1f')](function(_0x120d21){var _0x15d895=_[_0xbb10('0x29')](_0xfb2c5e['monitors'],{'filename':_0xbb10('0x36')+_0x56943c[_0xbb10('0x37')]()});if(_['isNil'](_0x15d895)){_0xfb2c5e['monitors']['push']({'filename':_0xbb10('0x36')+_0x56943c[_0xbb10('0x37')](),'createdAt':moment()[_0xbb10('0x8')]('YYYY-MM-DD\x20HH:mm:ss'),'mixmonitorid':_0x120d21[_0xbb10('0x38')],'status':_0xbb10('0x39')});}else{_0x15d895[_0xbb10('0x38')]=_0x120d21['mixmonitorid'];_0x15d895[_0xbb10('0x3a')]=_0xbb10('0x39');}_0x491db4({'code':0xc8,'message':[_0x1dcc9c[_0xbb10('0x30')],_0xbb10('0x3b'),_0x120d21['mixmonitorid']][_0xbb10('0x18')]('\x20'),'mixmonitorid':_0x120d21[_0xbb10('0x38')]});})['catch'](function(_0xe2040f){_0x518d47(_0x1b59f9[_0xbb10('0x14')](0x1f5,[_0x1dcc9c[_0xbb10('0x30')],_0xe2040f[_0xbb10('0x20')][_0xbb10('0x37')]()][_0xbb10('0x18')]('\x20')));});}else{return _0x518d47(_0x1b59f9['error'](0x1f5,_0xbb10('0x3c')));}});},'VoiceChannelStopMixMonitor':function(_0x1c7fae){var _0x3e7b4c=this;return new Promise(function(_0x3d3c41,_0x4943d9){if(ami[_0xbb10('0x13')]()==![]){return _0x4943d9(_0x3e7b4c[_0xbb10('0x14')](0x1f4,[config[_0xbb10('0x15')]['ip'],config[_0xbb10('0x15')]['username'],_0xbb10('0x17')][_0xbb10('0x18')]('\x20')));}var _0x54ac18=schema(properties['voicechannel'])[_0xbb10('0x2')](_0x1c7fae);if(_0x54ac18['length']>0x0){return _0x4943d9(_0x3e7b4c[_0xbb10('0x14')](0x1f4,_[_0xbb10('0x2e')](_0x54ac18,'message')[_0xbb10('0x18')](',\x20')));}var _0x1d82bf=_[_0xbb10('0x29')](_0x49baf4['channels'],{'uniqueid':_0x1c7fae[_0xbb10('0x30')]});if(_0x1d82bf){return Promise[_0xbb10('0x3d')]()[_0xbb10('0x1f')](function(){if(_0x1d82bf[_0xbb10('0x31')]){return ami[_0xbb10('0x1e')]({'action':_0xbb10('0x3e'),'channel':_0x1d82bf[_0xbb10('0x31')],'mixmonitorid':_0x1c7fae[_0xbb10('0x38')]})[_0xbb10('0x21')](function(){});}})[_0xbb10('0x1f')](function(){if(_0x1d82bf[_0xbb10('0x3f')]){return ami[_0xbb10('0x1e')]({'action':'StopMixMonitor','channel':_0x1d82bf[_0xbb10('0x3f')],'mixmonitorid':_0x1c7fae[_0xbb10('0x38')]})['catch'](function(){});}})[_0xbb10('0x1f')](function(){var _0x2f5027=_[_0xbb10('0x29')](_0x1d82bf[_0xbb10('0x40')],{'mixmonitorid':_0x1c7fae[_0xbb10('0x38')]});if(_0x2f5027){_0x2f5027[_0xbb10('0x3a')]=_0xbb10('0x41');}})['then'](function(){var _0x4a9793=util[_0xbb10('0x8')](_0xbb10('0x32'),_0x1c7fae[_0xbb10('0x33')]||_0x1c7fae['uniqueid'],_0x1c7fae['format']||_0xbb10('0x34'));var _0x34cf4e=_[_0xbb10('0x29')](_0x1d82bf[_0xbb10('0x40')],{'filename':_0xbb10('0x36')+_0x4a9793[_0xbb10('0x37')]()});if(_0x34cf4e){_0x34cf4e[_0xbb10('0x3a')]=_0xbb10('0x41');}})[_0xbb10('0x1f')](function(){_0x3d3c41({'code':0xc8,'message':[_0x1c7fae[_0xbb10('0x30')],'StopMixMonitor\x20Success']['join']('\x20')});})[_0xbb10('0x21')](function(_0x467dba){_0x4943d9(_0x3e7b4c[_0xbb10('0x14')](0x1f5,[_0x1c7fae[_0xbb10('0x30')],_0x467dba[_0xbb10('0x20')][_0xbb10('0x37')]()][_0xbb10('0x18')]('\x20')));});}else{return _0x4943d9(_0x3e7b4c[_0xbb10('0x14')](0x1f5,_0xbb10('0x3c')));}});},'VoiceQueuesChannels':function(_0x1214f7){var _0x19ca3e=this;return new Promise(function(_0x20e18a){var _0x61e689=_[_0xbb10('0x2c')](_0x49baf4[_0xbb10('0x42')]);var _0x547a7a={'count':_0x61e689[_0xbb10('0x28')],'rows':_0x61e689};if(_0x1214f7&&_0x1214f7['type']){if(![_0xbb10('0x43'),_0xbb10('0x44')][_0xbb10('0x45')](_0x1214f7[_0xbb10('0x46')])){return _0x3cdd53(_0x19ca3e[_0xbb10('0x14')](0x190,_0xbb10('0x47')));}var _0x2e3326=_[_0xbb10('0x48')](_0x61e689,function(_0x180400){return _0x180400[_0xbb10('0x46')]===_0x1214f7[_0xbb10('0x46')];});_0x547a7a[_0xbb10('0x49')]=_0x2e3326[_0xbb10('0x28')];_0x547a7a[_0xbb10('0x4a')]=_0x2e3326;}_0x20e18a(_0x547a7a);});},'VoiceQueuesChannel':function(_0x4475e1){var _0x5de0cc=this;return new Promise(function(_0x4571b6,_0x466eb7){var _0x1b83a9=schema(properties[_0xbb10('0x4b')])[_0xbb10('0x2')](_0x4475e1);if(_0x1b83a9[_0xbb10('0x28')]>0x0){return _0x466eb7(_0x5de0cc['error'](0x1f4,_[_0xbb10('0x2e')](_0x1b83a9,_0xbb10('0x20'))[_0xbb10('0x18')](',\x20')));}var _0x14fed3=_[_0xbb10('0x29')](_0x49baf4[_0xbb10('0x42')],{'uniqueid':_0x4475e1[_0xbb10('0x30')]});if(_0x14fed3){_0x4571b6(_0x14fed3);}else{return _0x466eb7(_0x5de0cc[_0xbb10('0x14')](0x1f5,_0xbb10('0x3c')));}});},'VoiceQueuesChannelHangup':function(_0x40c4fb){var _0x2eb05a=this;return new Promise(function(_0x2a1ce1,_0x16932f){if(ami['isConnected']()==![]){return _0x16932f(_0x2eb05a['error'](0x1f4,[config[_0xbb10('0x15')]['ip'],config[_0xbb10('0x15')][_0xbb10('0x16')],_0xbb10('0x17')]['join']('\x20')));}var _0x506498=schema(properties[_0xbb10('0x4c')])[_0xbb10('0x2')](_0x40c4fb);if(_0x506498[_0xbb10('0x28')]>0x0){return _0x16932f(_0x2eb05a[_0xbb10('0x14')](0x1f4,_[_0xbb10('0x2e')](_0x506498,_0xbb10('0x20'))[_0xbb10('0x18')](',\x20')));}var _0x4a5fb9=_[_0xbb10('0x29')](_0x49baf4[_0xbb10('0x42')],{'uniqueid':_0x40c4fb['uniqueid']});if(_0x4a5fb9&&_0x4a5fb9['channel']){return ami['Action']({'action':_0xbb10('0x4d'),'channel':_0x4a5fb9[_0xbb10('0x31')]})[_0xbb10('0x1f')](function(_0x5bd1c0){_0x2a1ce1({'code':0xc8,'message':[_0x40c4fb['uniqueid'],_0x5bd1c0['message'][_0xbb10('0x37')]()][_0xbb10('0x18')]('\x20')});})[_0xbb10('0x21')](function(_0x4e9fbd){_0x16932f(_0x2eb05a[_0xbb10('0x14')](0x1f5,[_0x40c4fb[_0xbb10('0x30')],_0x4e9fbd['message']['toLowerCase']()][_0xbb10('0x18')]('\x20')));});}else{return _0x16932f(_0x2eb05a[_0xbb10('0x14')](0x1f5,_0xbb10('0x3c')));}});},'VoiceQueuesChannelRedirect':function(_0x237246){var _0x54b7c5=this;return new Promise(function(_0x43eaec,_0xec48ac){if(ami[_0xbb10('0x13')]()==![]){return _0xec48ac(_0x54b7c5['error'](0x1f4,[config[_0xbb10('0x15')]['ip'],config[_0xbb10('0x15')][_0xbb10('0x16')],'ami\x20disconnected'][_0xbb10('0x18')]('\x20')));}var _0x31e85e=schema(properties[_0xbb10('0x4e')])[_0xbb10('0x2')](_0x237246);if(_0x31e85e['length']>0x0){return _0xec48ac(_0x54b7c5[_0xbb10('0x14')](0x1f4,_[_0xbb10('0x2e')](_0x31e85e,_0xbb10('0x20'))[_0xbb10('0x18')](',\x20')));}var _0x56b3a3=_[_0xbb10('0x29')](_0x49baf4[_0xbb10('0x42')],{'uniqueid':_0x237246[_0xbb10('0x30')]});if(_0x56b3a3&&_0x56b3a3[_0xbb10('0x31')]){return ami[_0xbb10('0x1e')]({'action':_0xbb10('0x4f'),'channel':_0x56b3a3[_0xbb10('0x31')],'exten':_0x237246['exten'],'context':_0x237246['context']||_0x56b3a3['context'],'priority':0x1})[_0xbb10('0x1f')](function(_0x9c672d){_0x43eaec({'code':0xc8,'message':[_0x237246[_0xbb10('0x30')],_0x9c672d['message']['toLowerCase']()][_0xbb10('0x18')]('\x20')});})[_0xbb10('0x21')](function(_0xd9e743){_0xec48ac(_0x54b7c5[_0xbb10('0x14')](0x1f5,[_0x237246[_0xbb10('0x30')],_0xd9e743[_0xbb10('0x20')]['toLowerCase']()][_0xbb10('0x18')]('\x20')));});}else{return _0xec48ac(_0x54b7c5[_0xbb10('0x14')](0x1f5,_0xbb10('0x3c')));}});},'Agents':function(_0x14f16b){return new Promise(function(_0x2aaaa6){var _0x5bfc68=_['values'](_0x49baf4['agents']);if(_0x14f16b&&_0x14f16b['id']){var _0x329da7=_[_0xbb10('0x29')](_0x5bfc68,function(_0x36917f){return _0x36917f['id']===_0x14f16b['id'];});_0x2aaaa6(_0x329da7);}else{_0x2aaaa6({'count':_0x5bfc68[_0xbb10('0x28')],'rows':_0x5bfc68});}});},'Telephones':function(){return new Promise(function(_0x2f7d2a){var _0x1d40b8=_['values'](_0x49baf4[_0xbb10('0x50')]);_0x2f7d2a({'count':_0x1d40b8['length'],'rows':_0x1d40b8});});},'Trunks':function(){return new Promise(function(_0x4fe3b5){var _0x519a54=_[_0xbb10('0x2c')](_0x49baf4[_0xbb10('0x51')]);_0x4fe3b5({'count':_0x519a54[_0xbb10('0x28')],'rows':_0x519a54});});},'OutboundChannels':function(){return new Promise(function(_0x108f99){var _0x5ce94f=_[_0xbb10('0x2c')](_0x49baf4['outboundChannels']);_0x108f99({'count':_0x5ce94f['length'],'rows':_0x5ce94f});});},'Outbound':function(){return new Promise(function(_0x165fe9){_0x165fe9(_0x49baf4[_0xbb10('0x44')]);});},'Campaigns':function(){return new Promise(function(_0x29529c){var _0x2bd2ab=_[_0xbb10('0x2c')](_0x49baf4['campaigns']);_0x29529c({'count':_0x2bd2ab[_0xbb10('0x28')],'rows':_0x2bd2ab});});},'VoiceQueuesPreview':function(_0x19fcec){var _0x2c6429=this;return new Promise(function(_0x3f3d38,_0x43cdb7){_0x312b72[_0xbb10('0x52')](_0x19fcec['id'])[_0xbb10('0x1f')](function(_0x53fa98){_0x3f3d38({'code':0xc8,'message':_0x53fa98[_0xbb10('0x20')]});})[_0xbb10('0x21')](function(_0x30f3ea){_0x43cdb7(_0x2c6429[_0xbb10('0x14')](0x1f4,_0x30f3ea[_0xbb10('0x20')]));});});},'EventManager':function(_0x172be3){var _0xa3b23=this;return new Promise(function(_0x312a08,_0x5a4429){if(!_0x172be3[_0xbb10('0x53')]){return _0x5a4429(_0xa3b23[_0xbb10('0x14')](0x1f4,_0xbb10('0x54')));}ami['emit']('custom:'+_0x172be3['event'],_0x172be3[_0xbb10('0x20')]);_0x312a08({'code':0xc8,'message':_0x172be3});});},'FaxAccounts':function(){return new Promise(function(_0x5a3c44){var _0x4e3d6a=_[_0xbb10('0x2c')](_0x49baf4[_0xbb10('0x55')]);_0x5a3c44({'count':_0x4e3d6a[_0xbb10('0x28')],'rows':_0x4e3d6a});});},'SendFax':function(_0x12ed63){var _0x32ec27=this;return new Promise(function(_0x24dca6,_0x33116){_0x481979[_0xbb10('0x56')](_0x12ed63)[_0xbb10('0x1f')](function(_0x5206e1){_0x24dca6({'code':0xc8,'message':_0x5206e1[_0xbb10('0x20')]});})[_0xbb10('0x21')](function(_0x46b6d2){_0x33116(_0x32ec27[_0xbb10('0x14')](0x1f4,_0x46b6d2['message']));});});},'CheckAfterSend':function(_0x4c0795){var _0x3547a3=this;return new Promise(function(_0x2280bd,_0x30f0a4){_0x481979[_0xbb10('0x57')](_0x4c0795)['then'](function(_0x17d596){_0x2280bd({'code':0xc8,'message':_0x17d596[_0xbb10('0x20')]});})[_0xbb10('0x21')](function(_0xf7b3e1){_0x30f0a4(_0x3547a3[_0xbb10('0x14')](0x1f4,_0xf7b3e1['message']));});});}};var _0x5f0691=jayson[_0xbb10('0x58')](_0x513741)[_0xbb10('0x59')]();_0x5f0691['on'](_0xbb10('0x14'),function(_0x5239da){return _0x3cdd53(_0x5239da);});_0x5f0691[_0xbb10('0x7')](0x232a,_0xbb10('0x5a'),function(){console['log']('AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!',0x232a);return _0x328583(_0xbb10('0x5b')+0x232a);});});}; \ No newline at end of file +var _0xb10b=['type','Invalid\x20type\x20parameter.\x20Allowed\x20values:\x20inbound,\x20outbound','filter','count','rows','voicequeuechannel','voicequeuechannelhangup','Hangup','voicequeuechannelredirect','Redirect','telephones','trunks','run','event','Event\x20name\x20mandatory','faxAccounts','send','checkAfterSend','server','http','127.0.0.1','RPC\x20listening\x20on\x20port:','lodash','jayson/promise','validate','moment','../properties','../ami','../model/voiceQueueSummary','listen','format','%s/%s','SIP','name','timers','timer','updateAcw','agents','voiceStatus','pause','QueuePause','isConnected','error','asterisk','username','ami\x20disconnected','join','pick','keys','module','action','Reload','Action','then','message','catch','command','Command','content','voiceQueues','hasOwnProperty','push','length','find','omit','undefined','values','voicechannel','map','channels','uniqueid','channel','%s.%s','filename','wav','ai(mixmonitorid)','/var/spool/asterisk/monitor/','toLowerCase','mixmonitorid','rec','status','MixMonitor\x20Success','Channel\x20doesn\x27t\x20exist','resolve','StopMixMonitor','destinationchannel','monitors','stop','queueChannels','inbound','outbound','includes'];(function(_0x128f54,_0x92ec19){var _0x575c7e=function(_0x1fc4cb){while(--_0x1fc4cb){_0x128f54['push'](_0x128f54['shift']());}};_0x575c7e(++_0x92ec19);}(_0xb10b,0x12a));var _0xbb10=function(_0x57d500,_0xf52c67){_0x57d500=_0x57d500-0x0;var _0x142c14=_0xb10b[_0x57d500];return _0x142c14;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var jayson=require(_0xbb10('0x1'));var schema=require(_0xbb10('0x2'));var moment=require(_0xbb10('0x3'));var config=require('../../../config/environment');var properties=require(_0xbb10('0x4'));var ami=require(_0xbb10('0x5'));var VoiceQueueSummary=require(_0xbb10('0x6'));exports[_0xbb10('0x7')]=function(_0x49baf4,_0x312b72,_0x481979){return new Promise(function(_0x328583,_0x3cdd53){var _0x513741={'QueuePause':function(_0x1b9e94){return new Promise(function(_0x3fb675){var _0x21370f=util[_0xbb10('0x8')](_0xbb10('0x9'),_0xbb10('0xa'),_0x1b9e94[_0xbb10('0xb')]);if(_0x49baf4[_0xbb10('0xc')]&&_0x49baf4['timers'][_0x21370f]&&_0x49baf4['timers'][_0x21370f][_0xbb10('0xd')]){_0x49baf4[_0xbb10('0xc')][_0x21370f][_0xbb10('0xe')]();}if(_0x49baf4['agents'][_0x21370f]){_0x49baf4[_0xbb10('0xf')][_0x21370f]['updateStatusRealtime']({'state':_0x49baf4[_0xbb10('0xf')][_0x21370f][_0xbb10('0x10')],'statePause':_0x1b9e94[_0xbb10('0x11')]?!![]:![]});}_0x3fb675({'code':0xc8,'message':_0xbb10('0x12')});});},'Reload':function(_0x442548){var _0x147230=this;return new Promise(function(_0x58a612,_0x26e021){if(ami[_0xbb10('0x13')]()==![]){return _0x26e021(_0x147230[_0xbb10('0x14')](0x1f4,[config[_0xbb10('0x15')]['ip'],config[_0xbb10('0x15')][_0xbb10('0x16')],_0xbb10('0x17')][_0xbb10('0x18')]('\x20')));}_0x442548=_[_0xbb10('0x19')](_0x442548,_[_0xbb10('0x1a')](properties['reload'][_0xbb10('0x1b')]));_0x442548[_0xbb10('0x1c')]=_0xbb10('0x1d');return ami[_0xbb10('0x1e')](_0x442548)[_0xbb10('0x1f')](function(_0x1682a4){_0x58a612({'code':0xc8,'message':_0x1682a4[_0xbb10('0x20')]});})[_0xbb10('0x21')](function(_0xbf2906){_0x26e021(_0x147230[_0xbb10('0x14')](0x1f5,_0xbf2906['message']));});});},'Command':function(_0x5ff0cf){var _0x19f48d=this;return new Promise(function(_0x388fab,_0x109908){if(ami[_0xbb10('0x13')]()==![]){return _0x109908(_0x19f48d[_0xbb10('0x14')](0x1f4,[config['asterisk']['ip'],config[_0xbb10('0x15')][_0xbb10('0x16')],'ami\x20disconnected']['join']('\x20')));}_0x5ff0cf=_[_0xbb10('0x19')](_0x5ff0cf,_0xbb10('0x22'));_0x5ff0cf[_0xbb10('0x1c')]=_0xbb10('0x23');return ami[_0xbb10('0x1e')](_0x5ff0cf)[_0xbb10('0x1f')](function(_0x407cb4){_0x388fab({'code':0xc8,'message':_0x407cb4[_0xbb10('0x24')]});})[_0xbb10('0x21')](function(_0x395404){_0x109908(_0x19f48d[_0xbb10('0x14')](0x1f5,_0x395404[_0xbb10('0x20')]));});});},'VoiceQueues':function(){return new Promise(function(_0x537898){var _0x4fedac=[];for(var _0x4fb5e0 in _0x49baf4[_0xbb10('0x25')]){if(_0x49baf4[_0xbb10('0x25')][_0xbb10('0x26')](_0x4fb5e0)){var _0x4e25ff=_0x49baf4[_0xbb10('0x25')][_0x4fb5e0];var _0x24d586=new VoiceQueueSummary(_0x4e25ff);_0x4fedac[_0xbb10('0x27')](_0x24d586);}}_0x537898({'count':_0x4fedac[_0xbb10('0x28')],'rows':_0x4fedac});});},'UpdateVoiceQueue':function(_0x1acce9){return new Promise(function(_0x20d946,_0x2a0e8b){var _0x4aabb9=_[_0xbb10('0x29')](_0x49baf4[_0xbb10('0x25')],{'id':parseInt(_0x1acce9['id'])});var _0xfc3595=_[_0xbb10('0x2a')](_0x1acce9,['id']);if(_0x4aabb9){for(var _0x1d30aa in _0xfc3595){if(typeof _0xfc3595[_0x1d30aa]!==_0xbb10('0x2b')&&typeof _0x4aabb9[_0x1d30aa]!=='undefined'){_0x4aabb9[_0x1d30aa]=_0xfc3595[_0x1d30aa];}}_0x20d946(_0x4aabb9);}else{_0x2a0e8b();}});},'VoiceChannels':function(){return new Promise(function(_0x221624){var _0x4ee02e=_[_0xbb10('0x2c')](_0x49baf4['channels']);_0x221624({'count':_0x4ee02e[_0xbb10('0x28')],'rows':_0x4ee02e});});},'VoiceChannelMixMonitor':function(_0x1dcc9c){var _0x1b59f9=this;return new Promise(function(_0x491db4,_0x518d47){if(ami[_0xbb10('0x13')]()==![]){return _0x518d47(_0x1b59f9[_0xbb10('0x14')](0x1f4,[config['asterisk']['ip'],config[_0xbb10('0x15')][_0xbb10('0x16')],_0xbb10('0x17')][_0xbb10('0x18')]('\x20')));}var _0x37a83f=schema(properties[_0xbb10('0x2d')])[_0xbb10('0x2')](_0x1dcc9c);if(_0x37a83f['length']>0x0){return _0x518d47(_0x1b59f9[_0xbb10('0x14')](0x1f4,_[_0xbb10('0x2e')](_0x37a83f,_0xbb10('0x20'))[_0xbb10('0x18')](',\x20')));}var _0xfb2c5e=_[_0xbb10('0x29')](_0x49baf4[_0xbb10('0x2f')],{'uniqueid':_0x1dcc9c[_0xbb10('0x30')]});if(_0xfb2c5e&&_0xfb2c5e[_0xbb10('0x31')]){var _0x56943c=util[_0xbb10('0x8')](_0xbb10('0x32'),_0x1dcc9c[_0xbb10('0x33')]||_0x1dcc9c[_0xbb10('0x30')],_0x1dcc9c['format']||_0xbb10('0x34'));return ami['Action']({'action':'MixMonitor','channel':_0xfb2c5e[_0xbb10('0x31')],'file':_0x56943c,'options':_0xbb10('0x35')})[_0xbb10('0x1f')](function(_0x120d21){var _0x15d895=_[_0xbb10('0x29')](_0xfb2c5e['monitors'],{'filename':_0xbb10('0x36')+_0x56943c[_0xbb10('0x37')]()});if(_['isNil'](_0x15d895)){_0xfb2c5e['monitors']['push']({'filename':_0xbb10('0x36')+_0x56943c[_0xbb10('0x37')](),'createdAt':moment()[_0xbb10('0x8')]('YYYY-MM-DD\x20HH:mm:ss'),'mixmonitorid':_0x120d21[_0xbb10('0x38')],'status':_0xbb10('0x39')});}else{_0x15d895[_0xbb10('0x38')]=_0x120d21['mixmonitorid'];_0x15d895[_0xbb10('0x3a')]=_0xbb10('0x39');}_0x491db4({'code':0xc8,'message':[_0x1dcc9c[_0xbb10('0x30')],_0xbb10('0x3b'),_0x120d21['mixmonitorid']][_0xbb10('0x18')]('\x20'),'mixmonitorid':_0x120d21[_0xbb10('0x38')]});})['catch'](function(_0xe2040f){_0x518d47(_0x1b59f9[_0xbb10('0x14')](0x1f5,[_0x1dcc9c[_0xbb10('0x30')],_0xe2040f[_0xbb10('0x20')][_0xbb10('0x37')]()][_0xbb10('0x18')]('\x20')));});}else{return _0x518d47(_0x1b59f9['error'](0x1f5,_0xbb10('0x3c')));}});},'VoiceChannelStopMixMonitor':function(_0x1c7fae){var _0x3e7b4c=this;return new Promise(function(_0x3d3c41,_0x4943d9){if(ami[_0xbb10('0x13')]()==![]){return _0x4943d9(_0x3e7b4c[_0xbb10('0x14')](0x1f4,[config[_0xbb10('0x15')]['ip'],config[_0xbb10('0x15')]['username'],_0xbb10('0x17')][_0xbb10('0x18')]('\x20')));}var _0x54ac18=schema(properties['voicechannel'])[_0xbb10('0x2')](_0x1c7fae);if(_0x54ac18['length']>0x0){return _0x4943d9(_0x3e7b4c[_0xbb10('0x14')](0x1f4,_[_0xbb10('0x2e')](_0x54ac18,'message')[_0xbb10('0x18')](',\x20')));}var _0x1d82bf=_[_0xbb10('0x29')](_0x49baf4['channels'],{'uniqueid':_0x1c7fae[_0xbb10('0x30')]});if(_0x1d82bf){return Promise[_0xbb10('0x3d')]()[_0xbb10('0x1f')](function(){if(_0x1d82bf[_0xbb10('0x31')]){return ami[_0xbb10('0x1e')]({'action':_0xbb10('0x3e'),'channel':_0x1d82bf[_0xbb10('0x31')],'mixmonitorid':_0x1c7fae[_0xbb10('0x38')]})[_0xbb10('0x21')](function(){});}})[_0xbb10('0x1f')](function(){if(_0x1d82bf[_0xbb10('0x3f')]){return ami[_0xbb10('0x1e')]({'action':'StopMixMonitor','channel':_0x1d82bf[_0xbb10('0x3f')],'mixmonitorid':_0x1c7fae[_0xbb10('0x38')]})['catch'](function(){});}})[_0xbb10('0x1f')](function(){var _0x2f5027=_[_0xbb10('0x29')](_0x1d82bf[_0xbb10('0x40')],{'mixmonitorid':_0x1c7fae[_0xbb10('0x38')]});if(_0x2f5027){_0x2f5027[_0xbb10('0x3a')]=_0xbb10('0x41');}})['then'](function(){var _0x4a9793=util[_0xbb10('0x8')](_0xbb10('0x32'),_0x1c7fae[_0xbb10('0x33')]||_0x1c7fae['uniqueid'],_0x1c7fae['format']||_0xbb10('0x34'));var _0x34cf4e=_[_0xbb10('0x29')](_0x1d82bf[_0xbb10('0x40')],{'filename':_0xbb10('0x36')+_0x4a9793[_0xbb10('0x37')]()});if(_0x34cf4e){_0x34cf4e[_0xbb10('0x3a')]=_0xbb10('0x41');}})[_0xbb10('0x1f')](function(){_0x3d3c41({'code':0xc8,'message':[_0x1c7fae[_0xbb10('0x30')],'StopMixMonitor\x20Success']['join']('\x20')});})[_0xbb10('0x21')](function(_0x467dba){_0x4943d9(_0x3e7b4c[_0xbb10('0x14')](0x1f5,[_0x1c7fae[_0xbb10('0x30')],_0x467dba[_0xbb10('0x20')][_0xbb10('0x37')]()][_0xbb10('0x18')]('\x20')));});}else{return _0x4943d9(_0x3e7b4c[_0xbb10('0x14')](0x1f5,_0xbb10('0x3c')));}});},'VoiceQueuesChannels':function(_0x1214f7){var _0x19ca3e=this;return new Promise(function(_0x20e18a){var _0x61e689=_[_0xbb10('0x2c')](_0x49baf4[_0xbb10('0x42')]);var _0x547a7a={'count':_0x61e689[_0xbb10('0x28')],'rows':_0x61e689};if(_0x1214f7&&_0x1214f7['type']){if(![_0xbb10('0x43'),_0xbb10('0x44')][_0xbb10('0x45')](_0x1214f7[_0xbb10('0x46')])){return _0x3cdd53(_0x19ca3e[_0xbb10('0x14')](0x190,_0xbb10('0x47')));}var _0x2e3326=_[_0xbb10('0x48')](_0x61e689,function(_0x180400){return _0x180400[_0xbb10('0x46')]===_0x1214f7[_0xbb10('0x46')];});_0x547a7a[_0xbb10('0x49')]=_0x2e3326[_0xbb10('0x28')];_0x547a7a[_0xbb10('0x4a')]=_0x2e3326;}_0x20e18a(_0x547a7a);});},'VoiceQueuesChannel':function(_0x4475e1){var _0x5de0cc=this;return new Promise(function(_0x4571b6,_0x466eb7){var _0x1b83a9=schema(properties[_0xbb10('0x4b')])[_0xbb10('0x2')](_0x4475e1);if(_0x1b83a9[_0xbb10('0x28')]>0x0){return _0x466eb7(_0x5de0cc['error'](0x1f4,_[_0xbb10('0x2e')](_0x1b83a9,_0xbb10('0x20'))[_0xbb10('0x18')](',\x20')));}var _0x14fed3=_[_0xbb10('0x29')](_0x49baf4[_0xbb10('0x42')],{'uniqueid':_0x4475e1[_0xbb10('0x30')]});if(_0x14fed3){_0x4571b6(_0x14fed3);}else{return _0x466eb7(_0x5de0cc[_0xbb10('0x14')](0x1f5,_0xbb10('0x3c')));}});},'VoiceQueuesChannelHangup':function(_0x40c4fb){var _0x2eb05a=this;return new Promise(function(_0x2a1ce1,_0x16932f){if(ami['isConnected']()==![]){return _0x16932f(_0x2eb05a['error'](0x1f4,[config[_0xbb10('0x15')]['ip'],config[_0xbb10('0x15')][_0xbb10('0x16')],_0xbb10('0x17')]['join']('\x20')));}var _0x506498=schema(properties[_0xbb10('0x4c')])[_0xbb10('0x2')](_0x40c4fb);if(_0x506498[_0xbb10('0x28')]>0x0){return _0x16932f(_0x2eb05a[_0xbb10('0x14')](0x1f4,_[_0xbb10('0x2e')](_0x506498,_0xbb10('0x20'))[_0xbb10('0x18')](',\x20')));}var _0x4a5fb9=_[_0xbb10('0x29')](_0x49baf4[_0xbb10('0x42')],{'uniqueid':_0x40c4fb['uniqueid']});if(_0x4a5fb9&&_0x4a5fb9['channel']){return ami['Action']({'action':_0xbb10('0x4d'),'channel':_0x4a5fb9[_0xbb10('0x31')]})[_0xbb10('0x1f')](function(_0x5bd1c0){_0x2a1ce1({'code':0xc8,'message':[_0x40c4fb['uniqueid'],_0x5bd1c0['message'][_0xbb10('0x37')]()][_0xbb10('0x18')]('\x20')});})[_0xbb10('0x21')](function(_0x4e9fbd){_0x16932f(_0x2eb05a[_0xbb10('0x14')](0x1f5,[_0x40c4fb[_0xbb10('0x30')],_0x4e9fbd['message']['toLowerCase']()][_0xbb10('0x18')]('\x20')));});}else{return _0x16932f(_0x2eb05a[_0xbb10('0x14')](0x1f5,_0xbb10('0x3c')));}});},'VoiceQueuesChannelRedirect':function(_0x237246){var _0x54b7c5=this;return new Promise(function(_0x43eaec,_0xec48ac){if(ami[_0xbb10('0x13')]()==![]){return _0xec48ac(_0x54b7c5['error'](0x1f4,[config[_0xbb10('0x15')]['ip'],config[_0xbb10('0x15')][_0xbb10('0x16')],'ami\x20disconnected'][_0xbb10('0x18')]('\x20')));}var _0x31e85e=schema(properties[_0xbb10('0x4e')])[_0xbb10('0x2')](_0x237246);if(_0x31e85e['length']>0x0){return _0xec48ac(_0x54b7c5[_0xbb10('0x14')](0x1f4,_[_0xbb10('0x2e')](_0x31e85e,_0xbb10('0x20'))[_0xbb10('0x18')](',\x20')));}var _0x56b3a3=_[_0xbb10('0x29')](_0x49baf4[_0xbb10('0x42')],{'uniqueid':_0x237246[_0xbb10('0x30')]});if(_0x56b3a3&&_0x56b3a3[_0xbb10('0x31')]){return ami[_0xbb10('0x1e')]({'action':_0xbb10('0x4f'),'channel':_0x56b3a3[_0xbb10('0x31')],'exten':_0x237246['exten'],'context':_0x237246['context']||_0x56b3a3['context'],'priority':0x1})[_0xbb10('0x1f')](function(_0x9c672d){_0x43eaec({'code':0xc8,'message':[_0x237246[_0xbb10('0x30')],_0x9c672d['message']['toLowerCase']()][_0xbb10('0x18')]('\x20')});})[_0xbb10('0x21')](function(_0xd9e743){_0xec48ac(_0x54b7c5[_0xbb10('0x14')](0x1f5,[_0x237246[_0xbb10('0x30')],_0xd9e743[_0xbb10('0x20')]['toLowerCase']()][_0xbb10('0x18')]('\x20')));});}else{return _0xec48ac(_0x54b7c5[_0xbb10('0x14')](0x1f5,_0xbb10('0x3c')));}});},'Agents':function(_0x14f16b){return new Promise(function(_0x2aaaa6){var _0x5bfc68=_['values'](_0x49baf4['agents']);if(_0x14f16b&&_0x14f16b['id']){var _0x329da7=_[_0xbb10('0x29')](_0x5bfc68,function(_0x36917f){return _0x36917f['id']===_0x14f16b['id'];});_0x2aaaa6(_0x329da7);}else{_0x2aaaa6({'count':_0x5bfc68[_0xbb10('0x28')],'rows':_0x5bfc68});}});},'Telephones':function(){return new Promise(function(_0x2f7d2a){var _0x1d40b8=_['values'](_0x49baf4[_0xbb10('0x50')]);_0x2f7d2a({'count':_0x1d40b8['length'],'rows':_0x1d40b8});});},'Trunks':function(){return new Promise(function(_0x4fe3b5){var _0x519a54=_[_0xbb10('0x2c')](_0x49baf4[_0xbb10('0x51')]);_0x4fe3b5({'count':_0x519a54[_0xbb10('0x28')],'rows':_0x519a54});});},'OutboundChannels':function(){return new Promise(function(_0x108f99){var _0x5ce94f=_[_0xbb10('0x2c')](_0x49baf4['outboundChannels']);_0x108f99({'count':_0x5ce94f['length'],'rows':_0x5ce94f});});},'Outbound':function(){return new Promise(function(_0x165fe9){_0x165fe9(_0x49baf4[_0xbb10('0x44')]);});},'Campaigns':function(){return new Promise(function(_0x29529c){var _0x2bd2ab=_[_0xbb10('0x2c')](_0x49baf4['campaigns']);_0x29529c({'count':_0x2bd2ab[_0xbb10('0x28')],'rows':_0x2bd2ab});});},'VoiceQueuesPreview':function(_0x19fcec){var _0x2c6429=this;return new Promise(function(_0x3f3d38,_0x43cdb7){_0x312b72[_0xbb10('0x52')](_0x19fcec['id'])[_0xbb10('0x1f')](function(_0x53fa98){_0x3f3d38({'code':0xc8,'message':_0x53fa98[_0xbb10('0x20')]});})[_0xbb10('0x21')](function(_0x30f3ea){_0x43cdb7(_0x2c6429[_0xbb10('0x14')](0x1f4,_0x30f3ea[_0xbb10('0x20')]));});});},'EventManager':function(_0x172be3){var _0xa3b23=this;return new Promise(function(_0x312a08,_0x5a4429){if(!_0x172be3[_0xbb10('0x53')]){return _0x5a4429(_0xa3b23[_0xbb10('0x14')](0x1f4,_0xbb10('0x54')));}ami['emit']('custom:'+_0x172be3['event'],_0x172be3[_0xbb10('0x20')]);_0x312a08({'code':0xc8,'message':_0x172be3});});},'FaxAccounts':function(){return new Promise(function(_0x5a3c44){var _0x4e3d6a=_[_0xbb10('0x2c')](_0x49baf4[_0xbb10('0x55')]);_0x5a3c44({'count':_0x4e3d6a[_0xbb10('0x28')],'rows':_0x4e3d6a});});},'SendFax':function(_0x12ed63){var _0x32ec27=this;return new Promise(function(_0x24dca6,_0x33116){_0x481979[_0xbb10('0x56')](_0x12ed63)[_0xbb10('0x1f')](function(_0x5206e1){_0x24dca6({'code':0xc8,'message':_0x5206e1[_0xbb10('0x20')]});})[_0xbb10('0x21')](function(_0x46b6d2){_0x33116(_0x32ec27[_0xbb10('0x14')](0x1f4,_0x46b6d2['message']));});});},'CheckAfterSend':function(_0x4c0795){var _0x3547a3=this;return new Promise(function(_0x2280bd,_0x30f0a4){_0x481979[_0xbb10('0x57')](_0x4c0795)['then'](function(_0x17d596){_0x2280bd({'code':0xc8,'message':_0x17d596[_0xbb10('0x20')]});})[_0xbb10('0x21')](function(_0xf7b3e1){_0x30f0a4(_0x3547a3[_0xbb10('0x14')](0x1f4,_0xf7b3e1['message']));});});}};var _0x5f0691=jayson[_0xbb10('0x58')](_0x513741)[_0xbb10('0x59')]();_0x5f0691['on'](_0xbb10('0x14'),function(_0x5239da){return _0x3cdd53(_0x5239da);});_0x5f0691[_0xbb10('0x7')](0x232a,_0xbb10('0x5a'),function(){console['log']('AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!',0x232a);return _0x328583(_0xbb10('0x5b')+0x232a);});});}; \ No newline at end of file diff --git a/server/services/ami/trigger/cmContact/index.js b/server/services/ami/trigger/cmContact/index.js index 35fb474..58e3578 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 _0x1f3d=['../../../../config/logger','trigger','../../rpc/cmContact','redis','localhost','socket.io-emitter','info','[CM][%s][%s]','emit','exec','data1','data2','data5','xmd-contactid','data3','split','phone','$or','map','routeId','destcalleridnum','calleridnum','firstName','lastName','fax','ListId','createdAt','updatedAt','union','resolve','getContacts','then','isEmpty','length','[CM][%s][%s]\x20Contact\x20found:%s','[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]','join','uniqueid','data4','isNil','calleridname','','destcalleridname','Unknown','createContact','push','[CM][%s][%s]\x20Contact\x20created:%s','format','name','toLowerCase','merge','lodash','bluebird','ioredis','../../../../config/environment'];(function(_0x5635d9,_0x2da3ef){var _0x401308=function(_0x3d5b41){while(--_0x3d5b41){_0x5635d9['push'](_0x5635d9['shift']());}};_0x401308(++_0x2da3ef);}(_0x1f3d,0x10f));var _0xd1f3=function(_0x558790,_0x237bd2){_0x558790=_0x558790-0x0;var _0x78ccf9=_0x1f3d[_0x558790];return _0x78ccf9;};'use strict';var _=require(_0xd1f3('0x0'));var BPromise=require(_0xd1f3('0x1'));var Redis=require(_0xd1f3('0x2'));var util=require('util');var config=require(_0xd1f3('0x3'));var logger=require(_0xd1f3('0x4'))(_0xd1f3('0x5'));var cmContactRpc=require(_0xd1f3('0x6'));config[_0xd1f3('0x7')]=_['defaults'](config[_0xd1f3('0x7')],{'host':_0xd1f3('0x8'),'port':0x18eb});var io=require(_0xd1f3('0x9'))(new Redis(config['redis']));function emit(_0x3358fc,_0x372296,_0x53bd7d,_0x4a4711,_0x240dc4){logger[_0xd1f3('0xa')](_0xd1f3('0xb'),_0x3358fc,_0x372296['id'],_0x53bd7d,_0x4a4711,JSON['stringify'](_0x240dc4));io['to'](_0x53bd7d)[_0xd1f3('0xc')](_0x4a4711,_0x240dc4);}exports[_0xd1f3('0xd')]=function(_0x230e13,_0x2b50c6,_0x415107,_0xec5588){var _0x36aeb5,_0x2fc121;var _0x3a378a={};var _0x3cdfa0;var _0x24598e=Number(_0x415107[_0xd1f3('0xe')]);var _0x43df58=_0x415107[_0xd1f3('0xf')]?Boolean(Number(_0x415107[_0xd1f3('0xf')])):![];var _0x1c514c;var _0x5c47a5=![];if(!_['isNil'](_0x415107['data5'])){if(_0x415107[_0xd1f3('0x10')]=='1')_0x5c47a5=!![];}if(!_0x5c47a5){if(_0xec5588[_0xd1f3('0x11')]){_0x3a378a['id']=_0xec5588['xmd-contactid'];}}if(!_0x3a378a['id']){_0x3a378a['ListId']=_0x24598e;_0x1c514c=_0x415107[_0xd1f3('0x12')]&&_0x415107[_0xd1f3('0x12')]!=='0'?_0x415107[_0xd1f3('0x12')][_0xd1f3('0x13')](','):[_0xd1f3('0x14')];_0x3a378a[_0xd1f3('0x15')]=_[_0xd1f3('0x16')](_0x1c514c,function(_0xbb1a7b){var _0x38bb2d={};_0x38bb2d[_0xbb1a7b]=_0xec5588[_0xd1f3('0x17')]?_0xec5588[_0xd1f3('0x18')]:_0xec5588['calleridnum'];return _0x38bb2d;});_0x3cdfa0=_0xec5588[_0xd1f3('0x17')]?_0xec5588['destcalleridnum']:_0xec5588[_0xd1f3('0x19')];}var _0x30b6b3=['id',_0xd1f3('0x1a'),_0xd1f3('0x1b'),_0xd1f3('0x14'),'mobile',_0xd1f3('0x1c'),_0xd1f3('0x1d'),_0xd1f3('0x1e'),'scheduledAt',_0xd1f3('0x1f')];var _0x5557a5=_[_0xd1f3('0x20')](_0x30b6b3,_0x1c514c);BPromise[_0xd1f3('0x21')]()['then'](cmContactRpc[_0xd1f3('0x22')]({'attributes':_0x5557a5,'where':_0x3a378a,'phone':_0x3cdfa0}))[_0xd1f3('0x23')](function(_0x402e5f){_0x2fc121=_0x402e5f;if(!_[_0xd1f3('0x24')](_0x2fc121)){if(_0x2fc121[_0xd1f3('0x25')]===0x1){_0x36aeb5=_0x2fc121[0x0];logger[_0xd1f3('0xa')](_0xd1f3('0x26'),_0xec5588['uniqueid'],_0x2b50c6['id'],_0x36aeb5['id']);}else{logger[_0xd1f3('0xa')](_0xd1f3('0x27'),_0xec5588['uniqueid'],_0x2b50c6['id'],_[_0xd1f3('0x16')](_0x2fc121,'id')[_0xd1f3('0x28')](','));}return;}else{logger[_0xd1f3('0xa')]('[CM][%s][%s]\x20Contact\x20not\x20found',_0xec5588[_0xd1f3('0x29')],_0x2b50c6['id']);var _0x314da3={'ListId':_0x24598e};var _0x3a6ec0=_0x415107[_0xd1f3('0x2a')]&&_0x415107[_0xd1f3('0x2a')]!=='0'?_0x415107[_0xd1f3('0x2a')]:_0xd1f3('0x14');if(_0x43df58){logger[_0xd1f3('0xa')]('[CM][%s][%s]\x20Autocreate\x20enabled',_0xec5588[_0xd1f3('0x29')],_0x2b50c6['id']);_0x314da3[_0x3a6ec0]=_['isNil'](_0xec5588['routeId'])?_0xec5588[_0xd1f3('0x19')]:_0xec5588['destcalleridnum'];if(_[_0xd1f3('0x2b')](_0xec5588[_0xd1f3('0x17')])){_0x314da3['firstName']=_0xec5588[_0xd1f3('0x2c')]&&_0xec5588[_0xd1f3('0x2c')]!==_0xd1f3('0x2d')?_0xec5588[_0xd1f3('0x2c')]:'Unknown';}else{_0x314da3[_0xd1f3('0x1a')]=_0xec5588[_0xd1f3('0x2e')]&&_0xec5588[_0xd1f3('0x2e')]!==_0xd1f3('0x2d')?_0xec5588[_0xd1f3('0x2e')]:_0xd1f3('0x2f');}return BPromise[_0xd1f3('0x21')]()[_0xd1f3('0x23')](cmContactRpc[_0xd1f3('0x30')](_0x314da3))[_0xd1f3('0x23')](function(_0x80141b){_0x36aeb5=_0x80141b;_0x2fc121[_0xd1f3('0x31')](_0x80141b);if(_0x36aeb5){logger['info'](_0xd1f3('0x32'),_0xec5588[_0xd1f3('0x29')],_0x2b50c6['id'],_0x36aeb5['id']);}return;});}else{logger['info']('[CM][%s][%s]\x20Autocreate\x20disabled',_0xec5588[_0xd1f3('0x29')],_0x2b50c6['id']);_0x314da3[_0x3a6ec0]=_[_0xd1f3('0x2b')](_0xec5588[_0xd1f3('0x17')])?_0xec5588['calleridnum']:_0xec5588[_0xd1f3('0x18')];if(_['isNil'](_0xec5588[_0xd1f3('0x17')])){_0x314da3[_0xd1f3('0x1a')]=_0xec5588[_0xd1f3('0x2c')]&&_0xec5588[_0xd1f3('0x2c')]!==_0xd1f3('0x2d')?_0xec5588[_0xd1f3('0x2c')]:_0xd1f3('0x2f');}else{_0x314da3[_0xd1f3('0x1a')]=_0xec5588[_0xd1f3('0x2e')]&&_0xec5588[_0xd1f3('0x2e')]!==_0xd1f3('0x2d')?_0xec5588[_0xd1f3('0x2e')]:'Unknown';}_0x36aeb5=_0x314da3;_0x2fc121[_0xd1f3('0x31')](_0x314da3);return;}}})[_0xd1f3('0x23')](function(){if(_0x230e13){emit(_0xec5588[_0xd1f3('0x29')],_0x2b50c6,util[_0xd1f3('0x33')]('user:%s',_0x230e13[_0xd1f3('0x34')]),util[_0xd1f3('0x33')]('trigger:%s',_0x415107['action'][_0xd1f3('0x35')]()),{'evt':_[_0xd1f3('0x36')](_0xec5588,{'autoCreate':_0x43df58}),'contact':_0x36aeb5===undefined?{}:_0x36aeb5,'contacts':_0x2fc121['length']===0x0?undefined:_0x2fc121});}});}; \ No newline at end of file +var _0x3fa0=['scheduledAt','updatedAt','union','resolve','then','isEmpty','length','[CM][%s][%s]\x20Contact\x20found:%s','[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]','map','join','[CM][%s][%s]\x20Contact\x20not\x20found','uniqueid','data4','[CM][%s][%s]\x20Autocreate\x20enabled','isNil','','calleridname','firstName','destcalleridname','Unknown','createContact','push','[CM][%s][%s]\x20Contact\x20created:%s','[CM][%s][%s]\x20Autocreate\x20disabled','format','user:%s','name','trigger:%s','action','toLowerCase','merge','bluebird','ioredis','util','../../../../config/environment','defaults','redis','localhost','info','[CM][%s][%s]','emit','data1','data2','data5','xmd-contactid','ListId','data3','split','phone','$or','routeId','destcalleridnum','calleridnum','lastName','createdAt'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x3fa0,0x100));var _0x03fa=function(_0x44ce21,_0x1bb925){_0x44ce21=_0x44ce21-0x0;var _0x183514=_0x3fa0[_0x44ce21];return _0x183514;};'use strict';var _=require('lodash');var BPromise=require(_0x03fa('0x0'));var Redis=require(_0x03fa('0x1'));var util=require(_0x03fa('0x2'));var config=require(_0x03fa('0x3'));var logger=require('../../../../config/logger')('trigger');var cmContactRpc=require('../../rpc/cmContact');config['redis']=_[_0x03fa('0x4')](config[_0x03fa('0x5')],{'host':_0x03fa('0x6'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x03fa('0x5')]));function emit(_0xa6d7cf,_0x217e31,_0x1ee1d8,_0x347656,_0xca04ea){logger[_0x03fa('0x7')](_0x03fa('0x8'),_0xa6d7cf,_0x217e31['id'],_0x1ee1d8,_0x347656,JSON['stringify'](_0xca04ea));io['to'](_0x1ee1d8)[_0x03fa('0x9')](_0x347656,_0xca04ea);}exports['exec']=function(_0x5d120b,_0x220c1e,_0xa592f3,_0x32e743){var _0x25aa61,_0x1566c4;var _0xda0c0a={};var _0x530ba3;var _0x750328=Number(_0xa592f3[_0x03fa('0xa')]);var _0x20e759=_0xa592f3['data2']?Boolean(Number(_0xa592f3[_0x03fa('0xb')])):![];var _0x43e1cb;var _0x40ef8e=![];if(!_['isNil'](_0xa592f3[_0x03fa('0xc')])){if(_0xa592f3['data5']=='1')_0x40ef8e=!![];}if(!_0x40ef8e){if(_0x32e743[_0x03fa('0xd')]){_0xda0c0a['id']=_0x32e743[_0x03fa('0xd')];}}if(!_0xda0c0a['id']){_0xda0c0a[_0x03fa('0xe')]=_0x750328;_0x43e1cb=_0xa592f3[_0x03fa('0xf')]&&_0xa592f3[_0x03fa('0xf')]!=='0'?_0xa592f3[_0x03fa('0xf')][_0x03fa('0x10')](','):[_0x03fa('0x11')];_0xda0c0a[_0x03fa('0x12')]=_['map'](_0x43e1cb,function(_0x14155d){var _0x2a044c={};_0x2a044c[_0x14155d]=_0x32e743[_0x03fa('0x13')]?_0x32e743[_0x03fa('0x14')]:_0x32e743[_0x03fa('0x15')];return _0x2a044c;});_0x530ba3=_0x32e743[_0x03fa('0x13')]?_0x32e743[_0x03fa('0x14')]:_0x32e743[_0x03fa('0x15')];}var _0x401700=['id','firstName',_0x03fa('0x16'),_0x03fa('0x11'),'mobile','fax','ListId',_0x03fa('0x17'),_0x03fa('0x18'),_0x03fa('0x19')];var _0x395949=_[_0x03fa('0x1a')](_0x401700,_0x43e1cb);BPromise[_0x03fa('0x1b')]()[_0x03fa('0x1c')](cmContactRpc['getContacts']({'attributes':_0x395949,'where':_0xda0c0a,'phone':_0x530ba3}))[_0x03fa('0x1c')](function(_0x45feb0){_0x1566c4=_0x45feb0;if(!_[_0x03fa('0x1d')](_0x1566c4)){if(_0x1566c4[_0x03fa('0x1e')]===0x1){_0x25aa61=_0x1566c4[0x0];logger[_0x03fa('0x7')](_0x03fa('0x1f'),_0x32e743['uniqueid'],_0x220c1e['id'],_0x25aa61['id']);}else{logger[_0x03fa('0x7')](_0x03fa('0x20'),_0x32e743['uniqueid'],_0x220c1e['id'],_[_0x03fa('0x21')](_0x1566c4,'id')[_0x03fa('0x22')](','));}return;}else{logger[_0x03fa('0x7')](_0x03fa('0x23'),_0x32e743[_0x03fa('0x24')],_0x220c1e['id']);var _0x3efa21={'ListId':_0x750328};var _0x1ba132=_0xa592f3[_0x03fa('0x25')]&&_0xa592f3[_0x03fa('0x25')]!=='0'?_0xa592f3[_0x03fa('0x25')]:_0x03fa('0x11');if(_0x20e759){logger['info'](_0x03fa('0x26'),_0x32e743[_0x03fa('0x24')],_0x220c1e['id']);_0x3efa21[_0x1ba132]=_[_0x03fa('0x27')](_0x32e743['routeId'])?_0x32e743['calleridnum']:_0x32e743[_0x03fa('0x14')];if(_[_0x03fa('0x27')](_0x32e743[_0x03fa('0x13')])){_0x3efa21['firstName']=_0x32e743['calleridname']&&_0x32e743['calleridname']!==_0x03fa('0x28')?_0x32e743[_0x03fa('0x29')]:'Unknown';}else{_0x3efa21[_0x03fa('0x2a')]=_0x32e743[_0x03fa('0x2b')]&&_0x32e743[_0x03fa('0x2b')]!==_0x03fa('0x28')?_0x32e743[_0x03fa('0x2b')]:_0x03fa('0x2c');}return BPromise['resolve']()['then'](cmContactRpc[_0x03fa('0x2d')](_0x3efa21))[_0x03fa('0x1c')](function(_0x5532b2){_0x25aa61=_0x5532b2;_0x1566c4[_0x03fa('0x2e')](_0x5532b2);if(_0x25aa61){logger[_0x03fa('0x7')](_0x03fa('0x2f'),_0x32e743[_0x03fa('0x24')],_0x220c1e['id'],_0x25aa61['id']);}return;});}else{logger['info'](_0x03fa('0x30'),_0x32e743[_0x03fa('0x24')],_0x220c1e['id']);_0x3efa21[_0x1ba132]=_[_0x03fa('0x27')](_0x32e743[_0x03fa('0x13')])?_0x32e743[_0x03fa('0x15')]:_0x32e743['destcalleridnum'];if(_['isNil'](_0x32e743['routeId'])){_0x3efa21[_0x03fa('0x2a')]=_0x32e743[_0x03fa('0x29')]&&_0x32e743[_0x03fa('0x29')]!==_0x03fa('0x28')?_0x32e743[_0x03fa('0x29')]:_0x03fa('0x2c');}else{_0x3efa21['firstName']=_0x32e743[_0x03fa('0x2b')]&&_0x32e743[_0x03fa('0x2b')]!==_0x03fa('0x28')?_0x32e743[_0x03fa('0x2b')]:'Unknown';}_0x25aa61=_0x3efa21;_0x1566c4[_0x03fa('0x2e')](_0x3efa21);return;}}})[_0x03fa('0x1c')](function(){if(_0x5d120b){emit(_0x32e743[_0x03fa('0x24')],_0x220c1e,util[_0x03fa('0x31')](_0x03fa('0x32'),_0x5d120b[_0x03fa('0x33')]),util['format'](_0x03fa('0x34'),_0xa592f3[_0x03fa('0x35')][_0x03fa('0x36')]()),{'evt':_[_0x03fa('0x37')](_0x32e743,{'autoCreate':_0x20e759}),'contact':_0x25aa61===undefined?{}:_0x25aa61,'contacts':_0x1566c4[_0x03fa('0x1e')]===0x0?undefined:_0x1566c4});}});}; \ No newline at end of file diff --git a/server/services/ami/trigger/index.js b/server/services/ami/trigger/index.js index e1eba7b..5e23ce3 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 _0x613e=['servicenowAccounts','dynamics365Accounts','freshsalesAccounts','accounts','zendeskAccounts','custom:agentcalled','bind','custom:agentconnect','syncCustomEvent','custom:agentcomplete','custom:agentnosuchnumber','custom:agentcongestion','custom:agentreject','custom:amd','custom:queuecallerabandon','custom:timeout','custom:dialbegin','syncAgentDial','custom:dialconnect','custom:dialend','custom:newinteraction','custom:closedinteraction','custom:substatus','custom:incomingmessage','custom:outgoingmessage','custom:rejectmessage','custom:offlineMessage','emit','info','stringify','prototype','clone','motionChannel','voice','debug','agents','interface','checkTriggers','hasOwnProperty','status','merge','Actions','contactmanager','motionbar','browser','data1','data2','render','html','template\x20not\x20found','uri','isNil','data3','data4','location','windowWidth','data5','800','data6','winapp','winApplication','winArguments','format','user:%s','name','trigger:%s:%s','action','jscripty','trigger:%s','toLowerCase','exec','integration','queue','routeId','script','query','search','replace','checkTrigger','channel','length','every','AllConditions','AnyConditions','some','evt','checkConditions','ChatWebsiteId','operator','upperFirst','AccountId','value','interaction','message','agent','membername','lastevent','null','undefined','substatus','offlineMessage','equals','exports','util','lodash','ioredis','./integration','../../../config/environment','../../../config/logger','trigger','redis','defaults','localhost','socket.io-emitter','popup','url','triggers','voiceQueues','templates','voiceExtensions','freshdeskAccounts','salesforceAccounts','sugarcrmAccounts','zohoAccounts','deskAccounts','vtigerAccounts'];(function(_0x1a8094,_0x1ac44c){var _0x123631=function(_0x5725ae){while(--_0x5725ae){_0x1a8094['push'](_0x1a8094['shift']());}};_0x123631(++_0x1ac44c);}(_0x613e,0x1e1));var _0xe613=function(_0x51340c,_0x4fa765){_0x51340c=_0x51340c-0x0;var _0xa8a6cb=_0x613e[_0x51340c];return _0xa8a6cb;};'use strict';var util=require(_0xe613('0x0'));var _=require(_0xe613('0x1'));var url=require('url');var Mustache=require('mustache');var Redis=require(_0xe613('0x2'));var urlforward=require('./urlforward');var integration=require(_0xe613('0x3'));var cmContact=require('./cmContact');var script=require('./script');var config=require(_0xe613('0x4'));var logger=require(_0xe613('0x5'))(_0xe613('0x6'));var ami=require('../ami');config[_0xe613('0x7')]=_[_0xe613('0x8')](config[_0xe613('0x7')],{'host':_0xe613('0x9'),'port':0x18eb});var io=require(_0xe613('0xa'))(new Redis(config[_0xe613('0x7')]));var operators={'equals':function(_0x25086c,_0x29330c){return _0x25086c==_0x29330c;},'not_equals':function(_0x4b2d41,_0x34fdf9){return _0x4b2d41!=_0x34fdf9;}};var barAndWebActions=[_0xe613('0xb'),_0xe613('0xc'),'winapp'];function Trigger(_0x533cf3){this[_0xe613('0xd')]=_0x533cf3[_0xe613('0xd')];this['agents']=_0x533cf3['agents'];this[_0xe613('0xe')]=_0x533cf3[_0xe613('0xe')];this[_0xe613('0xf')]=_0x533cf3[_0xe613('0xf')];this[_0xe613('0x10')]=_0x533cf3[_0xe613('0x10')];this['zendeskAccounts']=_0x533cf3['zendeskAccounts'];this[_0xe613('0x11')]=_0x533cf3[_0xe613('0x11')];this[_0xe613('0x12')]=_0x533cf3[_0xe613('0x12')];this[_0xe613('0x13')]=_0x533cf3[_0xe613('0x13')];this[_0xe613('0x14')]=_0x533cf3['zohoAccounts'];this['deskAccounts']=_0x533cf3[_0xe613('0x15')];this['vtigerAccounts']=_0x533cf3[_0xe613('0x16')];this[_0xe613('0x17')]=_0x533cf3['servicenowAccounts'];this[_0xe613('0x18')]=_0x533cf3[_0xe613('0x18')];this['freshsalesAccounts']=_0x533cf3[_0xe613('0x19')];this[_0xe613('0x1a')]={'zendesk':this[_0xe613('0x1b')],'salesforce':this['salesforceAccounts'],'freshdesk':this[_0xe613('0x11')],'sugarcrm':this['sugarcrmAccounts'],'zoho':this[_0xe613('0x14')],'desk':this['deskAccounts'],'vtiger':this[_0xe613('0x16')],'dynamics365':this['dynamics365Accounts'],'freshsales':this[_0xe613('0x19')],'servicenow':this['servicenowAccounts']};ami['on'](_0xe613('0x1c'),this['syncCustomEvent'][_0xe613('0x1d')](this));ami['on'](_0xe613('0x1e'),this['syncCustomEvent'][_0xe613('0x1d')](this));ami['on']('custom:agentringnoanswer',this[_0xe613('0x1f')][_0xe613('0x1d')](this));ami['on'](_0xe613('0x20'),this[_0xe613('0x1f')]['bind'](this));ami['on'](_0xe613('0x21'),this[_0xe613('0x1f')][_0xe613('0x1d')](this));ami['on']('custom:agentnoanswer',this[_0xe613('0x1f')][_0xe613('0x1d')](this));ami['on']('custom:agentbusy',this['syncCustomEvent'][_0xe613('0x1d')](this));ami['on'](_0xe613('0x22'),this['syncCustomEvent'][_0xe613('0x1d')](this));ami['on'](_0xe613('0x23'),this[_0xe613('0x1f')][_0xe613('0x1d')](this));ami['on'](_0xe613('0x24'),this['syncCustomEvent'][_0xe613('0x1d')](this));ami['on'](_0xe613('0x25'),this[_0xe613('0x1f')][_0xe613('0x1d')](this));ami['on'](_0xe613('0x26'),this[_0xe613('0x1f')][_0xe613('0x1d')](this));ami['on'](_0xe613('0x27'),this[_0xe613('0x28')]['bind'](this));ami['on'](_0xe613('0x29'),this['syncAgentDial'][_0xe613('0x1d')](this));ami['on'](_0xe613('0x2a'),this[_0xe613('0x28')][_0xe613('0x1d')](this));ami['on'](_0xe613('0x2b'),this[_0xe613('0x1f')][_0xe613('0x1d')](this));ami['on'](_0xe613('0x2c'),this[_0xe613('0x1f')][_0xe613('0x1d')](this));ami['on'](_0xe613('0x2d'),this['syncCustomEvent']['bind'](this));ami['on'](_0xe613('0x2e'),this[_0xe613('0x1f')][_0xe613('0x1d')](this));ami['on'](_0xe613('0x2f'),this['syncCustomEvent'][_0xe613('0x1d')](this));ami['on']('custom:acceptmessage',this['syncCustomEvent']['bind'](this));ami['on'](_0xe613('0x30'),this['syncCustomEvent'][_0xe613('0x1d')](this));ami['on'](_0xe613('0x31'),this['syncCustomEvent'][_0xe613('0x1d')](this));}Trigger['prototype'][_0xe613('0x32')]=function(_0x5e8993,_0x61295b,_0x22b3c5){logger[_0xe613('0x33')](_0x5e8993,_0x61295b,JSON[_0xe613('0x34')](_0x22b3c5));io['to'](_0x5e8993)[_0xe613('0x32')](_0x61295b,_0x22b3c5);};Trigger[_0xe613('0x35')][_0xe613('0x1f')]=function(_0x1a7ba6){var _0x34483b=_[_0xe613('0x36')](_0x1a7ba6);if(typeof _0x34483b[_0xe613('0x37')]==='undefined'){_0x34483b['motionChannel']=_0xe613('0x38');}logger[_0xe613('0x39')](_0xe613('0x1f'),util['inspect'](_0x34483b,{'showHidden':!![],'depth':null}));this['checkTriggers'](_0x34483b);};Trigger[_0xe613('0x35')][_0xe613('0x28')]=function(_0xa04d84){if(this[_0xe613('0x3a')][_0xa04d84[_0xe613('0x3b')]]){this[_0xe613('0x1f')](_0xa04d84);}};Trigger[_0xe613('0x35')][_0xe613('0x3c')]=function(_0x499bc5){var _0x50fe63;for(var _0x5a089a in this[_0xe613('0xd')]){if(this[_0xe613('0xd')][_0xe613('0x3d')](_0x5a089a)){if(this[_0xe613('0xd')][_0x5a089a][_0xe613('0x3e')]){_0x50fe63=this['checkTrigger'](this[_0xe613('0xd')][_0x5a089a],_0x499bc5);if(_0x50fe63){_[_0xe613('0x3f')](_0x499bc5,_0x499bc5['variables']);for(var _0x26671f=0x0,_0x4cf83c,_0x300fc1,_0x4b236b;_0x26671f0x0){_0x55ad0f=_[_0xf326('0x25')](_0x581531,_0x1617d2);}return _0x55ad0f;}function getCustomFields(_0x1ae23a,_0x2fa28e){var _0x5dbe63=[];var _0xc115d9={'custom_fields':{}};if(_0x1ae23a[_0xf326('0x26')]>0x0){_['forEach'](_0x1ae23a,function(_0x225776){if(_[_0xf326('0x27')]([_0xf326('0x28'),_0xf326('0x29')],_0x225776[_0xf326('0x2a')])&&_0x225776[_0xf326('0x2b')]&&!_0x225776[_0xf326('0x2c')]){_0xc115d9[_0x225776[_0xf326('0x2b')][_0xf326('0x2d')]()]=_0x225776[_0xf326('0x2e')]['toString']();}else if(_[_0xf326('0x27')]([_0xf326('0x28'),_0xf326('0x29')],_0x225776['type'])&&_0x225776[_0xf326('0x2f')]&&_0x225776[_0xf326('0x2c')]){_0xc115d9[_0xf326('0x30')][_0x225776['idField']]=_0x225776['content'][_0xf326('0x31')]();}else if(_0x225776[_0xf326('0x2a')]===_0xf326('0x32')&&_0x225776[_0xf326('0x33')]&&_0x225776[_0xf326('0x2f')]&&_0x225776[_0xf326('0x2c')]){_0x2fa28e[_0x225776[_0xf326('0x33')]]&&(_0xc115d9[_0xf326('0x30')][_0x225776['idField']]=_0x2fa28e[_0x225776[_0xf326('0x33')]][_0xf326('0x31')]());}else if(_0x225776['type']===_0xf326('0x34')&&_0x225776['Variable']&&_0x225776[_0xf326('0x35')]['name']&&_0x225776['idField']&&_0x225776[_0xf326('0x2c')]){_0x2fa28e[_0x225776['Variable'][_0xf326('0x36')]['toLowerCase']()]&&(_0xc115d9[_0xf326('0x30')][_0x225776[_0xf326('0x2f')]]=_0x2fa28e[_0x225776[_0xf326('0x35')]['name'][_0xf326('0x2d')]()][_0xf326('0x31')]());}});}if(_0xc115d9['priority']){_0xc115d9[_0xf326('0x37')]=Number(_0xc115d9[_0xf326('0x37')]);}return _0xc115d9;}function getTicket(_0x40fa7a,_0xaf65e0,_0x51076c,_0x2c4416,_0xb1ef35){logger[_0xf326('0xb')](_0xf326('0x38'));var _0x1d88ed=_['merge']({'subject':intUtil[_0xf326('0x39')](_0x2c4416[_0xf326('0x3a')],_0xb1ef35,'\x20'),'type':'phone','status':'new','labels':[_0xf326('0x3b'),'Motion','CTI'][_0xf326('0x3c')](getTags(_0x2c4416['Tags'],_0xf326('0x36'))),'description':intUtil[_0xf326('0x39')](_0x2c4416[_0xf326('0x3d')],_0xb1ef35,'\x0a'),'_links':{'assigned_user':{'href':util[_0xf326('0x13')]('/api/v2/users/%d',_0xaf65e0['id']),'class':_0xf326('0x3e')}},'message':{'direction':'in','body':intUtil[_0xf326('0x39')](_0x2c4416[_0xf326('0x3d')],_0xb1ef35,'\x0a')}},getCustomFields(_0x2c4416[_0xf326('0x3f')],_0xb1ef35));return request({'uri':util[_0xf326('0x13')](_0xf326('0x40'),_0x40fa7a[_0xf326('0x16')],_0x51076c['id']),'method':_0xf326('0x23'),'body':_0x1d88ed});}exports[_0xf326('0x41')]=function(_0x1227d3,_0x361776,_0x2bab13,_0x50d63f,_0x1b6126,_0x1637dc){var _0x2ed1a7,_0x270288;_0x1637dc[_0xf326('0x16')]=intUtil[_0xf326('0x42')](_0x1637dc['remoteUri']);_0x1637dc[_0xf326('0x43')]=intUtil[_0xf326('0x42')](_0x1637dc['serverUrl']);if(_0x1b6126&&_0x1b6126[_0xf326('0x44')]){logger[_0xf326('0xb')](_0xf326('0x45'),_0xf326('0x46'));_0x361776[_0xf326('0x47')]=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x1637dc[_0xf326('0x43')],_0x361776[_0xf326('0x48')],md5(_0x361776['uniqueid']));}else{_0x361776['recordingURL']='';}headers[_0xf326('0x49')]=getAuth(_0x1637dc);return getUser(_0x1637dc,_0x50d63f[_0xf326('0x4a')])[_0xf326('0xe')](function(_0x5b3705){_0x2ed1a7=_0x5b3705;logger[_0xf326('0xb')](_0xf326('0x4b'),_0x2ed1a7['id']);return getEndUser(_0x1637dc,_0x361776[_0xf326('0x4c')],_0x361776[_0xf326('0x4d')]);})[_0xf326('0xe')](function(_0x2d9bba){_0x270288=_0x2d9bba;logger[_0xf326('0xb')](_0xf326('0x4e'),_0x270288['id']);return getTicket(_0x1637dc,_0x2ed1a7,_0x270288,_0x2bab13,_0x361776);})[_0xf326('0xe')](function(_0x27ced1){if(_0x27ced1){logger[_0xf326('0xb')](_0xf326('0x4f'));logger[_0xf326('0xb')](_0xf326('0x50'),_0x27ced1['id']);switch(_0x1637dc[_0xf326('0x2a')]){case'integrationTab':logger[_0xf326('0xb')](_0xf326('0x45'),_0xf326('0x51'));emit(util[_0xf326('0x13')]('user:%s',_0x50d63f[_0xf326('0x36')]),_0xf326('0x52'),{'recordId':_0x27ced1['id']});break;case _0xf326('0x53'):logger[_0xf326('0xb')]('[QUEUE]',_0xf326('0x54'));emit(util[_0xf326('0x13')](_0xf326('0x55'),_0x50d63f[_0xf326('0x36')]),_0xf326('0x56'),{'uri':util['format']('https://xcally.desk.com/web/agent/case/%d',_0x27ced1['id'])});break;default:logger[_0xf326('0x57')](_0xf326('0x45'),_0xf326('0x58'));}}})['catch'](function(_0x102fba){console[_0xf326('0x57')](_0x102fba);logger[_0xf326('0x57')]('[QUEUE]',JSON['stringify'](_0x102fba));});};exports[_0xf326('0x59')]=function(_0x5b4832,_0x1cf58f,_0x554277,_0x458e5f,_0x7ee57,_0x28c959,_0x25e091){var _0x212594,_0x35d3c8;_0x28c959[_0xf326('0x16')]=intUtil['stripTrailingSlash'](_0x28c959[_0xf326('0x16')]);_0x28c959[_0xf326('0x43')]=intUtil[_0xf326('0x42')](_0x28c959['serverUrl']);if(_0x25e091&&_0x25e091[_0xf326('0x5a')]&&_0x25e091[_0xf326('0x5a')]!==_0xf326('0x5b')){logger[_0xf326('0xb')](_0xf326('0x5c'),'Recording\x20is\x20enabled!');_0x1cf58f[_0xf326('0x47')]=util[_0xf326('0x13')](_0xf326('0x5d'),_0x28c959[_0xf326('0x43')],_0x1cf58f['uniqueid'],md5(_0x1cf58f[_0xf326('0x48')]));}headers[_0xf326('0x49')]=getAuth(_0x28c959);return getUser(_0x28c959,_0x458e5f[_0xf326('0x4a')])[_0xf326('0xe')](function(_0x4d3b9e){_0x212594=_0x4d3b9e;logger['info'](_0xf326('0x4b'),_0x212594['id']);return getEndUser(_0x28c959,_0x1cf58f[_0xf326('0x5e')],_0x1cf58f['destcalleridnum']);})[_0xf326('0xe')](function(_0x29de71){_0x35d3c8=_0x29de71;logger[_0xf326('0xb')](_0xf326('0x4e'),_0x35d3c8['id']);return getTicket(_0x28c959,_0x212594,_0x35d3c8,_0x554277,_0x1cf58f);})['then'](function(_0xb1c18c){if(_0xb1c18c){logger['info']('Ticket\x20created!');logger[_0xf326('0xb')]('The\x20Ticket\x20ID\x20is:',_0xb1c18c['id']);switch(_0x28c959[_0xf326('0x2a')]){case _0xf326('0x5f'):logger[_0xf326('0xb')]('[QUEUE]','Displaying\x20ticket\x20to\x20agent...');emit(util[_0xf326('0x13')](_0xf326('0x55'),_0x458e5f[_0xf326('0x36')]),'trigger:desk:display',{'recordId':_0xb1c18c['id']});break;case _0xf326('0x53'):logger['info'](_0xf326('0x45'),_0xf326('0x54'));emit(util[_0xf326('0x13')](_0xf326('0x55'),_0x458e5f[_0xf326('0x36')]),_0xf326('0x56'),{'uri':util[_0xf326('0x13')](_0xf326('0x60'),_0x28c959[_0xf326('0x16')],_0xb1c18c['id'])});break;default:logger[_0xf326('0x57')](_0xf326('0x5c'),_0xf326('0x58'));}}})[_0xf326('0x61')](function(_0x4ca1b8){logger[_0xf326('0x57')]('[OUTBOUND]',JSON[_0xf326('0x62')](_0x4ca1b8));});};exports[_0xf326('0x63')]=function(_0x5e858d,_0x2b770c,_0x5283da,_0x3255b2,_0xd55246,_0x28f3cb){var _0x2d45c9,_0x31b6dd;_0x28f3cb['remoteUri']=intUtil['stripTrailingSlash'](_0x28f3cb[_0xf326('0x16')]);_0x28f3cb[_0xf326('0x43')]=intUtil[_0xf326('0x42')](_0x28f3cb[_0xf326('0x43')]);if(_0xd55246&&_0xd55246[_0xf326('0x44')]){logger['info']('['+_0x2b770c[_0xf326('0x64')][_0xf326('0x65')]()+']','Recording\x20is\x20enabled!');_0x2b770c['recordingURL']=util['format'](_0xf326('0x5d'),_0x28f3cb[_0xf326('0x43')],_0x2b770c[_0xf326('0x48')],md5(_0x2b770c[_0xf326('0x48')]));}else{_0x2b770c[_0xf326('0x47')]='';}headers[_0xf326('0x49')]=getAuth(_0x28f3cb);return getUser(_0x28f3cb)[_0xf326('0xe')](function(_0x4b9013){_0x2d45c9=_0x4b9013;logger[_0xf326('0xb')](_0xf326('0x4b'),_0x2d45c9['id']);return getEndUser(_0x28f3cb,_0x2b770c[_0xf326('0x4c')],_0x2b770c[_0xf326('0x4d')]);})['then'](function(_0x3717fe){_0x31b6dd=_0x3717fe;logger['info']('The\x20Enduser\x20ID\x20is:',_0x31b6dd['id']);return getTicket(_0x28f3cb,_0x2d45c9,_0x31b6dd,_0x5283da,_0x2b770c);})[_0xf326('0xe')](function(_0x540fa0){if(_0x540fa0){logger[_0xf326('0xb')](_0xf326('0x4f'));logger[_0xf326('0xb')](_0xf326('0x50'),_0x540fa0['id']);}})[_0xf326('0x61')](function(_0x541491){logger['error']('['+_0x2b770c['lastevent'][_0xf326('0x65')]()+']',JSON[_0xf326('0x62')](_0x541491));});}; \ 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(_0x19c94f,_0x576465){var _0x37f0f6=function(_0x30ab37){while(--_0x30ab37){_0x19c94f['push'](_0x19c94f['shift']());}};_0x37f0f6(++_0x576465);}(_0x814b,0x1a2));var _0xb814=function(_0x58381c,_0x3b9374){_0x58381c=_0x58381c-0x0;var _0x1a7440=_0x814b[_0x58381c];return _0x1a7440;};'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 67be53f..909cb5a 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 _0x49d1=['phonecalls','Subjects','format','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','user:%s','trigger:browser:url','remoteUri','stripTrailingSlash','serverUrl','unmanaged','outbound','modernAuthentication','%s/api/data/v9.0/','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','[OUTBOUND]',']\x20The\x20User\x20ID\x20is:',']\x20The\x20User\x20email\x20is:','moduleCreate',']\x20The\x20%s\x20ID\x20is:\x20%s','ticketId','openNewTab','Displaying\x20call\x20in\x20a\x20new\x20tab...','name','error',']\x20Error\x20running\x20Dynamics365\x20integration','Error\x20running\x20Dynamics365\x20integration','request-promise','./util','md5','ioredis','../../../../config/logger','dynamics365','redis','defaults','localhost','CloudProvider','data7','tenantId','data2','resolve','data5','POST','username','password','catch','toUpperCase',']\x20Wrong\x20credentials!','then','GET','systemusers?$select=internalemailaddress,isdisabled,systemuserid','Bearer\x20','4.0','value','isNil','email','userEmail','length','internalemailaddress','info',']\x20Agent\x20found\x20','userId','systemuserid',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','message','toLowerCase','/systemusers(','body','headers','odata-entityid','substring','lastIndexOf','enduserId','destcalleridnum','calleridnum','telephone1','contacts?$select=','\x20eq\x20\x27','replace','%2b','contactid','nothing',']\x20Enduser\x20NOT\x20Created\x20-\x20ModuleCreate\x20=\x20Nothing','forEach','includes','string','picklist','type','nameField','customField','indexOf','content','ticketType','incident','incidents','assign','getString','Descriptions','/contacts(','Fields','phonecall','callDirection','queue'];(function(_0x146af4,_0xe414cc){var _0x728a8a=function(_0x18b3e0){while(--_0x18b3e0){_0x146af4['push'](_0x146af4['shift']());}};_0x728a8a(++_0xe414cc);}(_0x49d1,0xf8));var _0x149d=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x49d1[_0x321bb2];return _0x9c12ed;};'use strict';var _=require('lodash');var rp=require(_0x149d('0x0'));var util=require('util');var intUtil=require(_0x149d('0x1'));var md5=require(_0x149d('0x2'));var Redis=require(_0x149d('0x3'));var logger=require(_0x149d('0x4'))(_0x149d('0x5'));var config=require('../../../../config/environment');config[_0x149d('0x6')]=_[_0x149d('0x7')](config['redis'],{'host':_0x149d('0x8'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x149d('0x6')]));function getAuthToken(_0x2b4a85,_0x115f8f,_0x3bd56c){if(_0x2b4a85['modernAuthentication']){_0x2b4a85['remoteUri']=_0x2b4a85[_0x149d('0x9')][_0x149d('0xa')];_0x2b4a85[_0x149d('0xb')]=_0x2b4a85[_0x149d('0x9')][_0x149d('0xc')];return Promise[_0x149d('0xd')](_0x2b4a85[_0x149d('0x9')][_0x149d('0xe')]);}var _0x22f7dd={'method':_0x149d('0xf'),'uri':_0x115f8f,'form':{'client_id':_0x2b4a85['clientId'],'resource':_0x2b4a85['remoteUri'],'username':_0x2b4a85[_0x149d('0x10')],'password':_0x2b4a85[_0x149d('0x11')],'grant_type':_0x149d('0x11'),'client_secret':_0x2b4a85['clientSecret']},'json':!![]};return rp(_0x22f7dd)['then'](function(_0x1910da){return _0x1910da['access_token'];})[_0x149d('0x12')](function(_0x383a51){logger['error']('['+[_0x3bd56c[_0x149d('0x13')]()]+_0x149d('0x14'));return _0x383a51['message'];});}function getUser(_0x1e0952,_0x49377d,_0x79c43c,_0x1d75b6,_0x11aa0d,_0x41c87c){return new Promise(function(_0x4e51d8,_0x9f9169){return getAuthToken(_0x49377d,_0x1d75b6,_0x41c87c)[_0x149d('0x15')](function(_0x41fa4c){var _0x1c2afe={'method':_0x149d('0x16'),'uri':_0x11aa0d+_0x149d('0x17'),'headers':{'Authorization':_0x149d('0x18')+_0x41fa4c,'OData-Version':_0x149d('0x19')},'json':!![]};return rp(_0x1c2afe);})['then'](function(_0x117e31){var _0x3bcf01=_0x117e31[_0x149d('0x1a')];var _0x5cff23=![];var _0x4fa931=null;if(!_[_0x149d('0x1b')](_0x79c43c)){if(intUtil['validateEmail'](_0x79c43c[_0x149d('0x1c')])){_0x1e0952[_0x149d('0x1d')]=_0x79c43c[_0x149d('0x1c')];for(_0x4fa931=0x0;_0x4fa931<_0x3bcf01[_0x149d('0x1e')];_0x4fa931++){if(_0x3bcf01[_0x4fa931][_0x149d('0x1f')]===_0x79c43c[_0x149d('0x1c')]&&!_0x3bcf01[_0x4fa931]['isdisabled']){_0x5cff23=!![];logger[_0x149d('0x20')]('['+[_0x41c87c[_0x149d('0x13')]()]+_0x149d('0x21')+_0x3bcf01[_0x4fa931]['systemuserid']+'!');_0x1e0952[_0x149d('0x22')]=_0x3bcf01[_0x4fa931][_0x149d('0x23')];}}}}if(!_0x5cff23){logger['info']('['+[_0x41c87c[_0x149d('0x13')]()]+_0x149d('0x24'));_0x1e0952[_0x149d('0x1d')]=_0x49377d[_0x149d('0x10')];for(_0x4fa931=0x0;_0x4fa931<_0x3bcf01['length'];_0x4fa931++){if(_0x3bcf01[_0x4fa931]['internalemailaddress']===_0x49377d['username']){_0x1e0952[_0x149d('0x22')]=_0x3bcf01[_0x4fa931][_0x149d('0x23')];}}}_0x4e51d8(_0x1e0952);})[_0x149d('0x12')](function(_0x24dffa){_0x9f9169(_0x24dffa[_0x149d('0x25')]);});});}function createEndUser(_0x361b4c,_0x493afe,_0x1bfef4,_0x3abb8a,_0x365099,_0x417553,_0x1a5bb7){return new Promise(function(_0xd5b41b,_0x305ea9){return getAuthToken(_0x493afe,_0x1bfef4,_0x417553)[_0x149d('0x15')](function(_0xc3c492){var _0xb9609d=_0x417553[_0x149d('0x26')]()==='outbound'?_0x365099['destcalleridnum']:_0x365099['calleridnum'];var _0x556949={'method':_0x149d('0xf'),'uri':_0x3abb8a+'contacts','body':{'fullname':_0xb9609d,'firstname':_0xb9609d,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0x149d('0x27')+_0x361b4c['userId']+')'},'headers':{'Authorization':_0x149d('0x18')+_0xc3c492,'OData-Version':'4.0'},'json':!![],'resolveWithFullResponse':!![]};_0x556949[_0x149d('0x28')][_0x1a5bb7]=_0xb9609d;return rp(_0x556949);})[_0x149d('0x15')](function(_0x3b57b1){var _0x21cc0c=_0x3b57b1[_0x149d('0x29')][_0x149d('0x2a')];var _0x173cd1=_0x21cc0c[_0x149d('0x2b')](_0x21cc0c['lastIndexOf']('(')+0x1,_0x21cc0c[_0x149d('0x2c')](')'));_0x361b4c[_0x149d('0x2d')]=_0x173cd1;_0xd5b41b(_0x361b4c);})['catch'](function(_0x232023){_0x305ea9(_0x232023['message']);});});}function getEndUser(_0x4546f3,_0x28d6f3,_0xc0d408,_0x8bccc4,_0x3c4340,_0x8eb272,_0x584bb9,_0x2d6386){var _0x596521=_0x8eb272[_0x149d('0x26')]()==='outbound'?_0x3c4340[_0x149d('0x2e')]:_0x3c4340[_0x149d('0x2f')];return getAuthToken(_0x28d6f3,_0xc0d408,_0x8eb272)[_0x149d('0x15')](function(_0x75d395){_0x2d6386=_0x2d6386?_0x2d6386:_0x149d('0x30');var _0x5c0494={'method':_0x149d('0x16'),'uri':_0x8bccc4+_0x149d('0x31')+_0x2d6386+'&$filter='+_0x2d6386+_0x149d('0x32')+_0x596521[_0x149d('0x33')]('+',_0x149d('0x34'))+'\x27','headers':{'Authorization':_0x149d('0x18')+_0x75d395,'If-None-Match':null,'OData-Version':_0x149d('0x19')},'json':!![]};return rp(_0x5c0494);})['then'](function(_0x4c87c7){var _0x2b42d1=![];if(!_0x4c87c7)return _0x2b42d1;var _0x343586=_0x4c87c7[_0x149d('0x1a')];for(var _0x52026d=0x0;_0x52026d<_0x343586[_0x149d('0x1e')];_0x52026d++){if(_0x343586[_0x52026d][_0x2d6386]===_0x596521){_0x2b42d1=!![];_0x4546f3[_0x149d('0x2d')]=_0x343586[_0x52026d][_0x149d('0x35')];}}return _0x2b42d1;})['then'](function(_0x5d4019){if(_0x5d4019)return _0x4546f3;if(_0x584bb9===_0x149d('0x36')){logger[_0x149d('0x20')]('['+[_0x8eb272['toUpperCase']()]+_0x149d('0x37'));return _0x4546f3;}return createEndUser(_0x4546f3,_0x28d6f3,_0xc0d408,_0x8bccc4,_0x3c4340,_0x8eb272,_0x2d6386)[_0x149d('0x15')](function(_0x20c44c){logger[_0x149d('0x20')]('['+[_0x8eb272[_0x149d('0x13')]()]+']\x20Enduser\x20created!',_0x20c44c[_0x149d('0x2d')]);return _0x20c44c;});});}function getCustomFields(_0x134aa3,_0x32cab7,_0x5adf71){var _0x29929d={};if(_0x134aa3['length']>0x0){_[_0x149d('0x38')](_0x134aa3,function(_0x204411){if(_[_0x149d('0x39')]([_0x149d('0x3a'),_0x149d('0x3b')],_0x204411[_0x149d('0x3c')])&&_0x204411[_0x149d('0x3d')]&&!_0x204411[_0x149d('0x3e')]){var _0x4f682d=_0x204411['idField']['toLowerCase']();var _0x4f144b=_0x4f682d['substring'](0x0,_0x4f682d[_0x149d('0x3f')]('_'));var _0x167108=_0x4f682d[_0x149d('0x2b')](_0x4f682d[_0x149d('0x3f')]('_')+0x1);if(_0x4f144b===_0x5adf71){_0x29929d[_0x167108]=_0x204411[_0x149d('0x40')];}}});}return _0x29929d;}function getTicket(_0x4b1742,_0x5e5430,_0x3aa47d,_0x27517f,_0x2e2268,_0x400f08,_0xf2bd3a){return new Promise(function(_0x12db64,_0x3d4406){var _0x269e2f;return getAuthToken(_0x5e5430,_0x3aa47d,_0xf2bd3a)[_0x149d('0x15')](function(_0x27daf4){if(_0x400f08[_0x149d('0x41')]===_0x149d('0x42')){_0x269e2f={'method':_0x149d('0xf'),'uri':_0x27517f+_0x149d('0x43'),'body':Object[_0x149d('0x44')]({},{'title':intUtil['getString'](_0x400f08['Subjects'],_0x2e2268,'\x20'),'description':intUtil[_0x149d('0x45')](_0x400f08[_0x149d('0x46')],_0x2e2268,'\x0a'),'customerid_contact@odata.bind':_0x4b1742[_0x149d('0x2d')]?_0x149d('0x47')+_0x4b1742['enduserId']+')':undefined,'ownerid@odata.bind':_0x149d('0x27')+_0x4b1742[_0x149d('0x22')]+')','caseorigincode':'1'},getCustomFields(_0x400f08[_0x149d('0x48')],_0x2e2268,_0x400f08[_0x149d('0x41')])),'headers':{'Authorization':_0x149d('0x18')+_0x27daf4,'OData-Version':_0x149d('0x19')},'json':!![],'resolveWithFullResponse':!![]};}if(_0x400f08['ticketType']===_0x149d('0x49')){var _0x9d5ce5=_0x4b1742[_0x149d('0x2d')]?[{'partyid_systemuser@odata.bind':_0x149d('0x27')+_0x4b1742[_0x149d('0x22')]+')','participationtypemask':_0x4b1742[_0x149d('0x4a')]==='queue'?0x2:0x1},{'partyid_contact@odata.bind':'/contacts('+_0x4b1742[_0x149d('0x2d')]+')','participationtypemask':_0x4b1742[_0x149d('0x4a')]===_0x149d('0x4b')?0x1:0x2}]:[{'partyid_systemuser@odata.bind':'/systemusers('+_0x4b1742[_0x149d('0x22')]+')','participationtypemask':_0x4b1742[_0x149d('0x4a')]===_0x149d('0x4b')?0x2:0x1}];_0x269e2f={'method':'POST','uri':_0x27517f+_0x149d('0x4c'),'body':Object['assign']({},{'subject':intUtil[_0x149d('0x45')](_0x400f08[_0x149d('0x4d')],_0x2e2268,'\x20'),'phonenumber':String(_0x2e2268[_0x149d('0x2f')]),'description':intUtil[_0x149d('0x45')](_0x400f08['Descriptions'],_0x2e2268,'\x0a'),'regardingobjectid_contact@odata.bind':_0x4b1742[_0x149d('0x2d')]?_0x149d('0x47')+_0x4b1742['enduserId']+')':undefined,'ownerid@odata.bind':_0x149d('0x27')+_0x4b1742[_0x149d('0x22')]+')','directioncode':_0x4b1742[_0x149d('0x4a')]===_0x149d('0x4b')?![]:!![],'phonecall_activity_parties':_0x9d5ce5},getCustomFields(_0x400f08[_0x149d('0x48')],_0x2e2268,_0x400f08[_0x149d('0x41')])),'headers':{'Authorization':_0x149d('0x18')+_0x27daf4,'OData-Version':_0x149d('0x19')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x269e2f);})[_0x149d('0x15')](function(_0x43377f){var _0x5f44d0=_0x43377f[_0x149d('0x29')]['odata-entityid'];var _0x519509=_0x5f44d0[_0x149d('0x2b')](_0x5f44d0[_0x149d('0x2c')]('(')+0x1,_0x5f44d0['lastIndexOf'](')'));_0x4b1742['ticketId']=_0x519509;_0x12db64(_0x4b1742);})[_0x149d('0x12')](function(_0x3503db){_0x3d4406(_0x3503db[_0x149d('0x25')]);});});}function emit(_0x5e065d,_0x5bbd8d,_0x2606e0,_0x37bc98){var _0x4cffc8={'uri':util[_0x149d('0x4e')](_0x149d('0x4f'),_0x5e065d,_0x2606e0,_0x37bc98)};io['to'](util['format'](_0x149d('0x50'),_0x5bbd8d))['emit'](_0x149d('0x51'),_0x4cffc8);}exports['cs']=function(_0xbe3857,_0x1fca3c,_0x299dd6,_0x2f65e3,_0x363901,_0x33f383,_0x4559e1,_0x2791d9){var _0x3a0cc9={};_0x33f383[_0x149d('0x52')]=_0x33f383['modernAuthentication']?intUtil[_0x149d('0x53')](_0x33f383['CloudProvider'][_0x149d('0xa')]):intUtil[_0x149d('0x53')](_0x33f383['remoteUri']);_0x33f383[_0x149d('0x54')]=intUtil[_0x149d('0x53')](_0x33f383[_0x149d('0x54')]);_0x3a0cc9['callDirection']=_0x2791d9===_0x149d('0x4b')||_0x2791d9===_0x149d('0x55')?'queue':_0x149d('0x56');var _0x3041d4=_0x33f383[_0x149d('0x57')]?util[_0x149d('0x4e')](_0x149d('0x58'),_0x33f383['CloudProvider']['data7']):util[_0x149d('0x4e')](_0x149d('0x58'),_0x33f383[_0x149d('0x52')]);var _0x440a28=util[_0x149d('0x4e')]('https://login.microsoftonline.com/%s/oauth2/token',_0x33f383[_0x149d('0xb')]);var _0x4d13ad=util[_0x149d('0x4e')](_0x149d('0x59'),_0x33f383[_0x149d('0x54')],_0x1fca3c[_0x149d('0x5a')],md5(_0x1fca3c[_0x149d('0x5a')]));if(_0x363901&&_0x363901[_0x149d('0x5b')]){logger['info'](_0x149d('0x5c'),_0x149d('0x5d'));_0x1fca3c[_0x149d('0x5e')]=_0x4d13ad;}else if(_0x4559e1&&_0x4559e1[_0x149d('0x5f')]&&_0x4559e1[_0x149d('0x5f')]!=='none'){logger[_0x149d('0x20')](_0x149d('0x60'),'Recording\x20is\x20enabled!');_0x1fca3c['recordingURL']=_0x4d13ad;}else{_0x1fca3c['recordingURL']='';}return getUser(_0x3a0cc9,_0x33f383,_0x2f65e3,_0x440a28,_0x3041d4,_0x2791d9)['then'](function(_0x384872){logger[_0x149d('0x20')]('['+_0x2791d9[_0x149d('0x13')]()+_0x149d('0x61'),_0x384872[_0x149d('0x22')]);logger[_0x149d('0x20')]('['+_0x2791d9[_0x149d('0x13')]()+_0x149d('0x62'),_0x384872['userEmail']);return getEndUser(_0x384872,_0x33f383,_0x440a28,_0x3041d4,_0x1fca3c,_0x2791d9,_0x299dd6[_0x149d('0x63')],_0x299dd6['additionalSearchContact']);})['then'](function(_0x2942f4){logger['info']('['+_0x2791d9[_0x149d('0x13')]()+']\x20The\x20Enduser\x20ID\x20is:',_0x2942f4[_0x149d('0x2d')]);logger[_0x149d('0x20')]('['+_0x2791d9[_0x149d('0x13')]()+']\x20The\x20Enduser\x20phone\x20is:',_0x1fca3c[_0x149d('0x2f')]);return getTicket(_0x2942f4,_0x33f383,_0x440a28,_0x3041d4,_0x1fca3c,_0x299dd6,_0x2791d9);})[_0x149d('0x15')](function(_0x3c1132){logger[_0x149d('0x20')](util[_0x149d('0x4e')]('['+_0x2791d9[_0x149d('0x13')]()+_0x149d('0x64'),_0x299dd6[_0x149d('0x41')],_0x3c1132[_0x149d('0x65')]));logger[_0x149d('0x20')](util[_0x149d('0x4e')]('['+_0x2791d9[_0x149d('0x13')]()+']\x20Call\x20direction:\x20%s',_0x2791d9));if(_0x2791d9!=='unmanaged'&&_0x299dd6[_0x149d('0x66')]){logger[_0x149d('0x20')]('['+_0x2791d9[_0x149d('0x13')]()+']',_0x149d('0x67'));emit(_0x33f383[_0x149d('0x52')],_0x2f65e3[_0x149d('0x68')],_0x299dd6['ticketType'],_0x3c1132[_0x149d('0x65')]);}})['catch'](function(_0x5cf175){logger[_0x149d('0x69')]('['+_0x2791d9['toUpperCase']()+_0x149d('0x6a'),_0x5cf175['message']);console[_0x149d('0x69')](_0x149d('0x6b'),_0x5cf175);});}; \ No newline at end of file +var _0x6eb2=['toLowerCase','outbound','destcalleridnum','/systemusers(','4.0','body','headers','substring','lastIndexOf','enduserId','calleridnum','telephone1','contacts?$select=','&$filter=','replace','%2b','value',']\x20Enduser\x20NOT\x20Created\x20-\x20ModuleCreate\x20=\x20Nothing','info',']\x20Enduser\x20created!','forEach','includes','string','picklist','nameField','customField','idField','indexOf','content','incidents','assign','getString','Descriptions','/contacts(','Fields','ticketType','callDirection','queue','phonecalls','Subjects','ticketId','format','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','user:%s','emit','stripTrailingSlash','serverUrl','unmanaged','%s/api/data/v9.0/','https://login.microsoftonline.com/%s/oauth2/token','uniqueid','monitor_format','Recording\x20is\x20enabled!','recordingFormat','none','[OUTBOUND]','recordingURL',']\x20The\x20User\x20ID\x20is:',']\x20The\x20User\x20email\x20is:','userEmail','moduleCreate',']\x20The\x20Enduser\x20ID\x20is:',']\x20The\x20Enduser\x20phone\x20is:',']\x20The\x20%s\x20ID\x20is:\x20%s',']\x20Call\x20direction:\x20%s','openNewTab','Displaying\x20call\x20in\x20a\x20new\x20tab...','name','Error\x20running\x20Dynamics365\x20integration','lodash','request-promise','util','./util','md5','ioredis','../../../../config/logger','dynamics365','../../../../config/environment','redis','defaults','modernAuthentication','remoteUri','data7','data2','CloudProvider','POST','username','password','clientSecret','access_token','error',']\x20Wrong\x20credentials!','message','then','GET','systemusers?$select=internalemailaddress,isdisabled,systemuserid','Bearer\x20','email','length','internalemailaddress','toUpperCase',']\x20Agent\x20found\x20','systemuserid','userId',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','catch'];(function(_0x316994,_0x5ceead){var _0x225a4a=function(_0x5536ee){while(--_0x5536ee){_0x316994['push'](_0x316994['shift']());}};_0x225a4a(++_0x5ceead);}(_0x6eb2,0x1ed));var _0x26eb=function(_0x4be774,_0x5b2d48){_0x4be774=_0x4be774-0x0;var _0x31d1c9=_0x6eb2[_0x4be774];return _0x31d1c9;};'use strict';var _=require(_0x26eb('0x0'));var rp=require(_0x26eb('0x1'));var util=require(_0x26eb('0x2'));var intUtil=require(_0x26eb('0x3'));var md5=require(_0x26eb('0x4'));var Redis=require(_0x26eb('0x5'));var logger=require(_0x26eb('0x6'))(_0x26eb('0x7'));var config=require(_0x26eb('0x8'));config[_0x26eb('0x9')]=_[_0x26eb('0xa')](config['redis'],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x26eb('0x9')]));function getAuthToken(_0x3aef2c,_0x5489e2,_0x45b538){if(_0x3aef2c[_0x26eb('0xb')]){_0x3aef2c[_0x26eb('0xc')]=_0x3aef2c['CloudProvider'][_0x26eb('0xd')];_0x3aef2c['tenantId']=_0x3aef2c['CloudProvider'][_0x26eb('0xe')];return Promise['resolve'](_0x3aef2c[_0x26eb('0xf')]['data5']);}var _0x19301d={'method':_0x26eb('0x10'),'uri':_0x5489e2,'form':{'client_id':_0x3aef2c['clientId'],'resource':_0x3aef2c['remoteUri'],'username':_0x3aef2c[_0x26eb('0x11')],'password':_0x3aef2c[_0x26eb('0x12')],'grant_type':_0x26eb('0x12'),'client_secret':_0x3aef2c[_0x26eb('0x13')]},'json':!![]};return rp(_0x19301d)['then'](function(_0x380d24){return _0x380d24[_0x26eb('0x14')];})['catch'](function(_0x384568){logger[_0x26eb('0x15')]('['+[_0x45b538['toUpperCase']()]+_0x26eb('0x16'));return _0x384568[_0x26eb('0x17')];});}function getUser(_0x48adea,_0x216c2c,_0x248b2b,_0x44c02c,_0x2e4cae,_0x4015dc){return new Promise(function(_0x2e5db9,_0x4c24cd){return getAuthToken(_0x216c2c,_0x44c02c,_0x4015dc)[_0x26eb('0x18')](function(_0x278c55){var _0x286485={'method':_0x26eb('0x19'),'uri':_0x2e4cae+_0x26eb('0x1a'),'headers':{'Authorization':_0x26eb('0x1b')+_0x278c55,'OData-Version':'4.0'},'json':!![]};return rp(_0x286485);})[_0x26eb('0x18')](function(_0x149be1){var _0x1570e3=_0x149be1['value'];var _0x503276=![];var _0x438e77=null;if(!_['isNil'](_0x248b2b)){if(intUtil['validateEmail'](_0x248b2b[_0x26eb('0x1c')])){_0x48adea['userEmail']=_0x248b2b[_0x26eb('0x1c')];for(_0x438e77=0x0;_0x438e77<_0x1570e3[_0x26eb('0x1d')];_0x438e77++){if(_0x1570e3[_0x438e77][_0x26eb('0x1e')]===_0x248b2b[_0x26eb('0x1c')]&&!_0x1570e3[_0x438e77]['isdisabled']){_0x503276=!![];logger['info']('['+[_0x4015dc[_0x26eb('0x1f')]()]+_0x26eb('0x20')+_0x1570e3[_0x438e77][_0x26eb('0x21')]+'!');_0x48adea[_0x26eb('0x22')]=_0x1570e3[_0x438e77][_0x26eb('0x21')];}}}}if(!_0x503276){logger['info']('['+[_0x4015dc[_0x26eb('0x1f')]()]+_0x26eb('0x23'));_0x48adea['userEmail']=_0x216c2c[_0x26eb('0x11')];for(_0x438e77=0x0;_0x438e77<_0x1570e3[_0x26eb('0x1d')];_0x438e77++){if(_0x1570e3[_0x438e77][_0x26eb('0x1e')]===_0x216c2c[_0x26eb('0x11')]){_0x48adea[_0x26eb('0x22')]=_0x1570e3[_0x438e77]['systemuserid'];}}}_0x2e5db9(_0x48adea);})[_0x26eb('0x24')](function(_0x1e6ef1){_0x4c24cd(_0x1e6ef1[_0x26eb('0x17')]);});});}function createEndUser(_0x439cd0,_0x271de4,_0x2162c1,_0x1c5aa6,_0x5a5534,_0x1b8d7c,_0x2893a8){return new Promise(function(_0x22ddb3,_0x1fb115){return getAuthToken(_0x271de4,_0x2162c1,_0x1b8d7c)[_0x26eb('0x18')](function(_0x1609b2){var _0x4d50e8=_0x1b8d7c[_0x26eb('0x25')]()===_0x26eb('0x26')?_0x5a5534[_0x26eb('0x27')]:_0x5a5534['calleridnum'];var _0x4dff74={'method':_0x26eb('0x10'),'uri':_0x1c5aa6+'contacts','body':{'fullname':_0x4d50e8,'firstname':_0x4d50e8,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0x26eb('0x28')+_0x439cd0[_0x26eb('0x22')]+')'},'headers':{'Authorization':_0x26eb('0x1b')+_0x1609b2,'OData-Version':_0x26eb('0x29')},'json':!![],'resolveWithFullResponse':!![]};_0x4dff74[_0x26eb('0x2a')][_0x2893a8]=_0x4d50e8;return rp(_0x4dff74);})[_0x26eb('0x18')](function(_0xe1873){var _0x17fdca=_0xe1873[_0x26eb('0x2b')]['odata-entityid'];var _0x4caeb8=_0x17fdca[_0x26eb('0x2c')](_0x17fdca['lastIndexOf']('(')+0x1,_0x17fdca[_0x26eb('0x2d')](')'));_0x439cd0[_0x26eb('0x2e')]=_0x4caeb8;_0x22ddb3(_0x439cd0);})['catch'](function(_0x25e473){_0x1fb115(_0x25e473[_0x26eb('0x17')]);});});}function getEndUser(_0x588547,_0x1efcd1,_0x1f2457,_0x5c8b15,_0x172658,_0x2fc711,_0x48c4d6,_0xd40cb9){var _0x144026=_0x2fc711[_0x26eb('0x25')]()===_0x26eb('0x26')?_0x172658[_0x26eb('0x27')]:_0x172658[_0x26eb('0x2f')];return getAuthToken(_0x1efcd1,_0x1f2457,_0x2fc711)[_0x26eb('0x18')](function(_0x2892fc){_0xd40cb9=_0xd40cb9?_0xd40cb9:_0x26eb('0x30');var _0x1c10f8={'method':_0x26eb('0x19'),'uri':_0x5c8b15+_0x26eb('0x31')+_0xd40cb9+_0x26eb('0x32')+_0xd40cb9+'\x20eq\x20\x27'+_0x144026[_0x26eb('0x33')]('+',_0x26eb('0x34'))+'\x27','headers':{'Authorization':_0x26eb('0x1b')+_0x2892fc,'If-None-Match':null,'OData-Version':_0x26eb('0x29')},'json':!![]};return rp(_0x1c10f8);})[_0x26eb('0x18')](function(_0x23d7f8){var _0x23c638=![];if(!_0x23d7f8)return _0x23c638;var _0x41e542=_0x23d7f8[_0x26eb('0x35')];for(var _0x54f696=0x0;_0x54f696<_0x41e542[_0x26eb('0x1d')];_0x54f696++){if(_0x41e542[_0x54f696][_0xd40cb9]===_0x144026){_0x23c638=!![];_0x588547[_0x26eb('0x2e')]=_0x41e542[_0x54f696]['contactid'];}}return _0x23c638;})[_0x26eb('0x18')](function(_0x206fa7){if(_0x206fa7)return _0x588547;if(_0x48c4d6==='nothing'){logger['info']('['+[_0x2fc711[_0x26eb('0x1f')]()]+_0x26eb('0x36'));return _0x588547;}return createEndUser(_0x588547,_0x1efcd1,_0x1f2457,_0x5c8b15,_0x172658,_0x2fc711,_0xd40cb9)[_0x26eb('0x18')](function(_0x365651){logger[_0x26eb('0x37')]('['+[_0x2fc711[_0x26eb('0x1f')]()]+_0x26eb('0x38'),_0x365651[_0x26eb('0x2e')]);return _0x365651;});});}function getCustomFields(_0x32589a,_0x1247d2,_0x3938d3){var _0x1626bb={};if(_0x32589a[_0x26eb('0x1d')]>0x0){_[_0x26eb('0x39')](_0x32589a,function(_0x3aed92){if(_[_0x26eb('0x3a')]([_0x26eb('0x3b'),_0x26eb('0x3c')],_0x3aed92['type'])&&_0x3aed92[_0x26eb('0x3d')]&&!_0x3aed92[_0x26eb('0x3e')]){var _0x9b662a=_0x3aed92[_0x26eb('0x3f')][_0x26eb('0x25')]();var _0x488e1a=_0x9b662a['substring'](0x0,_0x9b662a[_0x26eb('0x40')]('_'));var _0x128ba1=_0x9b662a[_0x26eb('0x2c')](_0x9b662a[_0x26eb('0x40')]('_')+0x1);if(_0x488e1a===_0x3938d3){_0x1626bb[_0x128ba1]=_0x3aed92[_0x26eb('0x41')];}}});}return _0x1626bb;}function getTicket(_0x5171a4,_0x331ce5,_0x1a3d66,_0x2cbde2,_0x378b5c,_0xb8133b,_0x9b2489){return new Promise(function(_0x59755f,_0x274649){var _0x2045c4;return getAuthToken(_0x331ce5,_0x1a3d66,_0x9b2489)['then'](function(_0x2eba4e){if(_0xb8133b['ticketType']==='incident'){_0x2045c4={'method':'POST','uri':_0x2cbde2+_0x26eb('0x42'),'body':Object[_0x26eb('0x43')]({},{'title':intUtil[_0x26eb('0x44')](_0xb8133b['Subjects'],_0x378b5c,'\x20'),'description':intUtil['getString'](_0xb8133b[_0x26eb('0x45')],_0x378b5c,'\x0a'),'customerid_contact@odata.bind':_0x5171a4[_0x26eb('0x2e')]?_0x26eb('0x46')+_0x5171a4[_0x26eb('0x2e')]+')':undefined,'ownerid@odata.bind':_0x26eb('0x28')+_0x5171a4[_0x26eb('0x22')]+')','caseorigincode':'1'},getCustomFields(_0xb8133b[_0x26eb('0x47')],_0x378b5c,_0xb8133b['ticketType'])),'headers':{'Authorization':'Bearer\x20'+_0x2eba4e,'OData-Version':_0x26eb('0x29')},'json':!![],'resolveWithFullResponse':!![]};}if(_0xb8133b[_0x26eb('0x48')]==='phonecall'){var _0x3ab100=_0x5171a4['enduserId']?[{'partyid_systemuser@odata.bind':_0x26eb('0x28')+_0x5171a4[_0x26eb('0x22')]+')','participationtypemask':_0x5171a4[_0x26eb('0x49')]===_0x26eb('0x4a')?0x2:0x1},{'partyid_contact@odata.bind':_0x26eb('0x46')+_0x5171a4[_0x26eb('0x2e')]+')','participationtypemask':_0x5171a4[_0x26eb('0x49')]===_0x26eb('0x4a')?0x1:0x2}]:[{'partyid_systemuser@odata.bind':'/systemusers('+_0x5171a4[_0x26eb('0x22')]+')','participationtypemask':_0x5171a4['callDirection']===_0x26eb('0x4a')?0x2:0x1}];_0x2045c4={'method':_0x26eb('0x10'),'uri':_0x2cbde2+_0x26eb('0x4b'),'body':Object['assign']({},{'subject':intUtil['getString'](_0xb8133b[_0x26eb('0x4c')],_0x378b5c,'\x20'),'phonenumber':String(_0x378b5c[_0x26eb('0x2f')]),'description':intUtil[_0x26eb('0x44')](_0xb8133b[_0x26eb('0x45')],_0x378b5c,'\x0a'),'regardingobjectid_contact@odata.bind':_0x5171a4[_0x26eb('0x2e')]?'/contacts('+_0x5171a4[_0x26eb('0x2e')]+')':undefined,'ownerid@odata.bind':_0x26eb('0x28')+_0x5171a4['userId']+')','directioncode':_0x5171a4['callDirection']===_0x26eb('0x4a')?![]:!![],'phonecall_activity_parties':_0x3ab100},getCustomFields(_0xb8133b[_0x26eb('0x47')],_0x378b5c,_0xb8133b[_0x26eb('0x48')])),'headers':{'Authorization':_0x26eb('0x1b')+_0x2eba4e,'OData-Version':_0x26eb('0x29')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x2045c4);})['then'](function(_0x2ed308){var _0x485cf2=_0x2ed308[_0x26eb('0x2b')]['odata-entityid'];var _0x15313c=_0x485cf2[_0x26eb('0x2c')](_0x485cf2[_0x26eb('0x2d')]('(')+0x1,_0x485cf2[_0x26eb('0x2d')](')'));_0x5171a4[_0x26eb('0x4d')]=_0x15313c;_0x59755f(_0x5171a4);})[_0x26eb('0x24')](function(_0x580f0d){_0x274649(_0x580f0d[_0x26eb('0x17')]);});});}function emit(_0x1a4c40,_0x5e7ff3,_0x25526d,_0x486861){var _0x169e5e={'uri':util[_0x26eb('0x4e')](_0x26eb('0x4f'),_0x1a4c40,_0x25526d,_0x486861)};io['to'](util[_0x26eb('0x4e')](_0x26eb('0x50'),_0x5e7ff3))[_0x26eb('0x51')]('trigger:browser:url',_0x169e5e);}exports['cs']=function(_0x171bde,_0x4a6b5e,_0x47f885,_0x532cab,_0x4da5d3,_0x120257,_0x3ff16f,_0x933e38){var _0x284f7e={};_0x120257[_0x26eb('0xc')]=_0x120257[_0x26eb('0xb')]?intUtil['stripTrailingSlash'](_0x120257[_0x26eb('0xf')][_0x26eb('0xd')]):intUtil[_0x26eb('0x52')](_0x120257[_0x26eb('0xc')]);_0x120257[_0x26eb('0x53')]=intUtil[_0x26eb('0x52')](_0x120257['serverUrl']);_0x284f7e[_0x26eb('0x49')]=_0x933e38===_0x26eb('0x4a')||_0x933e38===_0x26eb('0x54')?_0x26eb('0x4a'):_0x26eb('0x26');var _0x6cc329=_0x120257['modernAuthentication']?util[_0x26eb('0x4e')]('%s/api/data/v9.0/',_0x120257['CloudProvider']['data7']):util[_0x26eb('0x4e')](_0x26eb('0x55'),_0x120257[_0x26eb('0xc')]);var _0x14c9a8=util[_0x26eb('0x4e')](_0x26eb('0x56'),_0x120257['tenantId']);var _0x27ea46=util[_0x26eb('0x4e')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x120257['serverUrl'],_0x4a6b5e[_0x26eb('0x57')],md5(_0x4a6b5e[_0x26eb('0x57')]));if(_0x4da5d3&&_0x4da5d3[_0x26eb('0x58')]){logger[_0x26eb('0x37')]('[QUEUE]',_0x26eb('0x59'));_0x4a6b5e['recordingURL']=_0x27ea46;}else if(_0x3ff16f&&_0x3ff16f[_0x26eb('0x5a')]&&_0x3ff16f['recordingFormat']!==_0x26eb('0x5b')){logger[_0x26eb('0x37')](_0x26eb('0x5c'),_0x26eb('0x59'));_0x4a6b5e[_0x26eb('0x5d')]=_0x27ea46;}else{_0x4a6b5e[_0x26eb('0x5d')]='';}return getUser(_0x284f7e,_0x120257,_0x532cab,_0x14c9a8,_0x6cc329,_0x933e38)[_0x26eb('0x18')](function(_0x597d93){logger[_0x26eb('0x37')]('['+_0x933e38[_0x26eb('0x1f')]()+_0x26eb('0x5e'),_0x597d93[_0x26eb('0x22')]);logger[_0x26eb('0x37')]('['+_0x933e38[_0x26eb('0x1f')]()+_0x26eb('0x5f'),_0x597d93[_0x26eb('0x60')]);return getEndUser(_0x597d93,_0x120257,_0x14c9a8,_0x6cc329,_0x4a6b5e,_0x933e38,_0x47f885[_0x26eb('0x61')],_0x47f885['additionalSearchContact']);})['then'](function(_0x530c57){logger[_0x26eb('0x37')]('['+_0x933e38[_0x26eb('0x1f')]()+_0x26eb('0x62'),_0x530c57[_0x26eb('0x2e')]);logger['info']('['+_0x933e38[_0x26eb('0x1f')]()+_0x26eb('0x63'),_0x4a6b5e[_0x26eb('0x2f')]);return getTicket(_0x530c57,_0x120257,_0x14c9a8,_0x6cc329,_0x4a6b5e,_0x47f885,_0x933e38);})[_0x26eb('0x18')](function(_0x29dda4){logger['info'](util[_0x26eb('0x4e')]('['+_0x933e38[_0x26eb('0x1f')]()+_0x26eb('0x64'),_0x47f885['ticketType'],_0x29dda4[_0x26eb('0x4d')]));logger[_0x26eb('0x37')](util[_0x26eb('0x4e')]('['+_0x933e38['toUpperCase']()+_0x26eb('0x65'),_0x933e38));if(_0x933e38!==_0x26eb('0x54')&&_0x47f885[_0x26eb('0x66')]){logger[_0x26eb('0x37')]('['+_0x933e38[_0x26eb('0x1f')]()+']',_0x26eb('0x67'));emit(_0x120257[_0x26eb('0xc')],_0x532cab[_0x26eb('0x68')],_0x47f885[_0x26eb('0x48')],_0x29dda4[_0x26eb('0x4d')]);}})[_0x26eb('0x24')](function(_0x4fb50f){logger[_0x26eb('0x15')]('['+_0x933e38[_0x26eb('0x1f')]()+']\x20Error\x20running\x20Dynamics365\x20integration',_0x4fb50f[_0x26eb('0x17')]);console[_0x26eb('0x15')](_0x26eb('0x69'),_0x4fb50f);});}; \ 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 eb57da1..98f8526 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 _0x8ff6=['includes','string','picklist','nameField','customField','toLowerCase','content','type','push','idField','variable','variableName','customVariable','Variable','queue','serverUrl','stripTrailingSlash','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','%s/helpdesk/tickets/%d','catch','error','outbound','recordingFormat','[OUTBOUND]','uniqueid','Authorization','destcalleridname','destcalleridnum','unmanaged','lastevent','toUpperCase','The\x20User\x20ID\x20is:','request-promise','ioredis','./util','../../../../config/environment','../../../../config/logger','freshdesk','redis','defaults','localhost','application/json','emit','info','Creating\x20new\x20ticket...','merge','format','Caller\x20-\x20%s','calleridname','calleridnum','getString','Subjects','
','name','Fields','custom_fields','mapValues','keyBy','value','%s/api/v2/tickets','remoteUri','POST','then','Ticket\x20created!','validateEmail','%s/api/v2/agents','find','email','%s/api/v2/agents/me','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','Admin\x20account\x20selected.','Searching\x20enduser\x20with\x20phone','%s/api/v2/contacts','length','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','apiKey','toString','base64','[HTTP]','stringify','GET','map'];(function(_0x11a55c,_0x4eced9){var _0x26c390=function(_0x5b0662){while(--_0x5b0662){_0x11a55c['push'](_0x11a55c['shift']());}};_0x26c390(++_0x4eced9);}(_0x8ff6,0xde));var _0x68ff=function(_0x47b58b,_0x41a189){_0x47b58b=_0x47b58b-0x0;var _0x46bebe=_0x8ff6[_0x47b58b];return _0x46bebe;};'use strict';var _=require('lodash');var rp=require(_0x68ff('0x0'));var md5=require('md5');var util=require('util');var Redis=require(_0x68ff('0x1'));var intUtil=require(_0x68ff('0x2'));var config=require(_0x68ff('0x3'));var logger=require(_0x68ff('0x4'))(_0x68ff('0x5'));config[_0x68ff('0x6')]=_[_0x68ff('0x7')](config['redis'],{'host':_0x68ff('0x8'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x68ff('0x6')]));var headers={'Content-Type':'application/json','Accept':_0x68ff('0x9')};function emit(_0x2d78b7,_0x1f5347,_0xada381){io['to'](_0x2d78b7)[_0x68ff('0xa')](_0x1f5347,_0xada381);}function getTicket(_0x310167,_0x26ce69,_0x27db3d,_0x1bace2,_0xd05c){logger[_0x68ff('0xb')](_0x68ff('0xc'));var _0x308740=_[_0x68ff('0xd')]({'responder_id':_0x26ce69['id'],'requester_id':_0x27db3d['id'],'name':util[_0x68ff('0xe')](_0x68ff('0xf'),_0xd05c[_0x68ff('0x10')]),'phone':_0xd05c[_0x68ff('0x11')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0x68ff('0x12')](_0x1bace2[_0x68ff('0x13')],_0xd05c,'\x20'),'description':intUtil[_0x68ff('0x12')](_0x1bace2['Descriptions'],_0xd05c,_0x68ff('0x14')),'tags':getTags(_0x1bace2['Tags'],_0x68ff('0x15'))},getCustomFields(_0x1bace2[_0x68ff('0x16')],_0xd05c));_0x308740[_0x68ff('0x17')]=_[_0x68ff('0x18')](_[_0x68ff('0x19')](_0x308740[_0x68ff('0x17')],'id'),_0x68ff('0x1a'));return request({'uri':util[_0x68ff('0xe')](_0x68ff('0x1b'),_0x310167[_0x68ff('0x1c')]),'method':_0x68ff('0x1d'),'body':_0x308740})[_0x68ff('0x1e')](function(_0x1fd609){logger[_0x68ff('0xb')](_0x68ff('0x1f'));return _0x1fd609;});}function getUser(_0x47088e,_0x1166cf){if(intUtil[_0x68ff('0x20')](_0x1166cf)){return request({'uri':util['format'](_0x68ff('0x21'),_0x47088e['remoteUri']),'qs':{'email':_0x1166cf}})[_0x68ff('0x1e')](function(_0x5d27ed){if(_0x5d27ed['length']){logger[_0x68ff('0xb')]('Agent\x20found!');return _[_0x68ff('0x22')](_0x5d27ed,function(_0x4211f5){return _0x4211f5['contact'][_0x68ff('0x23')]===_0x1166cf;});}else{logger['info']('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util['format'](_0x68ff('0x24'),_0x47088e[_0x68ff('0x1c')])})[_0x68ff('0x1e')](function(_0x2e6e62){logger[_0x68ff('0xb')]('Admin\x20account\x20selected.');return _0x2e6e62;});}});}else{logger[_0x68ff('0xb')](_0x68ff('0x25'));return request({'uri':util['format'](_0x68ff('0x24'),_0x47088e['remoteUri'])})[_0x68ff('0x1e')](function(_0x5a2dc0){logger[_0x68ff('0xb')](_0x68ff('0x26'));return _0x5a2dc0;});}}function getEndUser(_0x1f36d7,_0x455c60,_0x2f9e22){logger[_0x68ff('0xb')](_0x68ff('0x27'),_0x2f9e22);return request({'uri':util[_0x68ff('0xe')](_0x68ff('0x28'),_0x1f36d7[_0x68ff('0x1c')]),'qs':{'phone':_0x2f9e22}})[_0x68ff('0x1e')](function(_0x196ca5){if(_0x196ca5[_0x68ff('0x29')]){logger[_0x68ff('0xb')](_0x68ff('0x2a'));return _[_0x68ff('0x22')](_0x196ca5,{'phone':_0x2f9e22});}else{logger['info'](_0x68ff('0x2b'));return request({'uri':util[_0x68ff('0xe')]('%s/api/v2/contacts',_0x1f36d7[_0x68ff('0x1c')]),'method':_0x68ff('0x1d'),'body':{'name':_0x455c60,'phone':_0x2f9e22}})[_0x68ff('0x1e')](function(_0x4b6a7c){logger[_0x68ff('0xb')]('Enduser\x20created.');return _0x4b6a7c;});}});}function getAuth(_0x2e932f){return util[_0x68ff('0xe')]('Basic\x20%s',new Buffer(_0x2e932f[_0x68ff('0x2c')]+':X')[_0x68ff('0x2d')](_0x68ff('0x2e')));}function request(_0x578792){logger['debug'](_0x68ff('0x2f'),JSON[_0x68ff('0x30')](_0x578792));return rp(_[_0x68ff('0x7')](_0x578792,{'method':_0x68ff('0x31'),'headers':headers,'json':!![]}));}function getTags(_0x5a59d2,_0x1f8c83){var _0x1efccc=[];if(_0x5a59d2&&_0x5a59d2[_0x68ff('0x29')]>0x0){_0x1efccc=_[_0x68ff('0x32')](_0x5a59d2,_0x1f8c83);}return _0x1efccc;}function getCustomFields(_0x4aa8b3,_0x311c74){var _0x2a379f=[];var _0x9b4a4c={'custom_fields':[]};if(_0x4aa8b3[_0x68ff('0x29')]>0x0){_['forEach'](_0x4aa8b3,function(_0x528383){if(_[_0x68ff('0x33')]([_0x68ff('0x34'),_0x68ff('0x35')],_0x528383['type'])&&_0x528383[_0x68ff('0x36')]&&!_0x528383[_0x68ff('0x37')]){_0x9b4a4c[_0x528383[_0x68ff('0x36')][_0x68ff('0x38')]()]=_0x528383[_0x68ff('0x39')][_0x68ff('0x2d')]();}else if(_[_0x68ff('0x33')]([_0x68ff('0x34'),_0x68ff('0x35')],_0x528383[_0x68ff('0x3a')])&&_0x528383['idField']&&_0x528383[_0x68ff('0x37')]){_0x9b4a4c[_0x68ff('0x17')][_0x68ff('0x3b')]({'id':_0x528383[_0x68ff('0x3c')],'value':_0x528383[_0x68ff('0x39')][_0x68ff('0x2d')]()});}else if(_0x528383[_0x68ff('0x3a')]===_0x68ff('0x3d')&&_0x528383[_0x68ff('0x3e')]&&_0x528383['idField']&&_0x528383[_0x68ff('0x37')]){_0x311c74[_0x528383['variableName']]&&_0x9b4a4c[_0x68ff('0x17')][_0x68ff('0x3b')]({'id':_0x528383[_0x68ff('0x3c')],'value':_0x311c74[_0x528383[_0x68ff('0x3e')]][_0x68ff('0x2d')]()});}else if(_0x528383[_0x68ff('0x3a')]===_0x68ff('0x3f')&&_0x528383[_0x68ff('0x40')]&&_0x528383[_0x68ff('0x40')][_0x68ff('0x15')]&&_0x528383[_0x68ff('0x3c')]&&_0x528383[_0x68ff('0x37')]){_0x311c74[_0x528383[_0x68ff('0x40')][_0x68ff('0x15')][_0x68ff('0x38')]()]&&_0x9b4a4c[_0x68ff('0x17')]['push']({'id':_0x528383[_0x68ff('0x3c')],'value':_0x311c74[_0x528383['Variable'][_0x68ff('0x15')]['toLowerCase']()][_0x68ff('0x2d')]()});}});}return _0x9b4a4c;}exports[_0x68ff('0x41')]=function(_0x5a5c16,_0x172a47,_0x16b683,_0x187201,_0x1d6bf8,_0x1c3b47){var _0x13ae22,_0x3a8e1a;_0x1c3b47[_0x68ff('0x1c')]=intUtil['stripTrailingSlash'](_0x1c3b47[_0x68ff('0x1c')]);_0x1c3b47[_0x68ff('0x42')]=intUtil[_0x68ff('0x43')](_0x1c3b47[_0x68ff('0x42')]);if(_0x1d6bf8&&_0x1d6bf8[_0x68ff('0x44')]){logger[_0x68ff('0xb')](_0x68ff('0x45'),_0x68ff('0x46'));_0x172a47[_0x68ff('0x47')]=util['format'](_0x68ff('0x48'),_0x1c3b47[_0x68ff('0x42')],_0x172a47['uniqueid'],md5(_0x172a47['uniqueid']));}else{_0x172a47[_0x68ff('0x47')]='';}headers['Authorization']=getAuth(_0x1c3b47);return getUser(_0x1c3b47,_0x187201[_0x68ff('0x23')])['then'](function(_0x1bba9a){_0x13ae22=_0x1bba9a;logger[_0x68ff('0xb')]('The\x20User\x20ID\x20is:',_0x13ae22['id']);return getEndUser(_0x1c3b47,_0x172a47[_0x68ff('0x10')],_0x172a47[_0x68ff('0x11')]);})[_0x68ff('0x1e')](function(_0x5cfcff){_0x3a8e1a=_0x5cfcff;logger[_0x68ff('0xb')](_0x68ff('0x49'),_0x3a8e1a['id']);return getTicket(_0x1c3b47,_0x13ae22,_0x3a8e1a,_0x16b683,_0x172a47);})['then'](function(_0x5e3686){if(_0x5e3686&&_0x5e3686['id']){logger[_0x68ff('0xb')](_0x68ff('0x1f'));logger[_0x68ff('0xb')](_0x68ff('0x4a'),_0x5e3686['id']);logger[_0x68ff('0xb')]('[QUEUE]',_0x68ff('0x4b'));emit(util[_0x68ff('0xe')]('user:%s',_0x187201[_0x68ff('0x15')]),_0x68ff('0x4c'),{'uri':util[_0x68ff('0xe')](_0x68ff('0x4d'),_0x1c3b47[_0x68ff('0x1c')],_0x5e3686['id'])});}})[_0x68ff('0x4e')](function(_0x114c4d){logger[_0x68ff('0x4f')](_0x68ff('0x45'),JSON[_0x68ff('0x30')](_0x114c4d));});};exports[_0x68ff('0x50')]=function(_0x307ca1,_0x439920,_0x54b128,_0x563f69,_0x463ac4,_0x3bc189,_0xc22e6a){var _0x34f951,_0x2b1a7d;_0x3bc189[_0x68ff('0x1c')]=intUtil[_0x68ff('0x43')](_0x3bc189['remoteUri']);_0x3bc189[_0x68ff('0x42')]=intUtil['stripTrailingSlash'](_0x3bc189[_0x68ff('0x42')]);if(_0xc22e6a&&_0xc22e6a[_0x68ff('0x51')]&&_0xc22e6a[_0x68ff('0x51')]!=='none'){logger[_0x68ff('0xb')](_0x68ff('0x52'),_0x68ff('0x46'));_0x439920[_0x68ff('0x47')]=util[_0x68ff('0xe')](_0x68ff('0x48'),_0x3bc189[_0x68ff('0x42')],_0x439920['uniqueid'],md5(_0x439920[_0x68ff('0x53')]));}headers[_0x68ff('0x54')]=getAuth(_0x3bc189);return getUser(_0x3bc189,_0x563f69[_0x68ff('0x23')])[_0x68ff('0x1e')](function(_0x10e842){_0x34f951=_0x10e842;logger[_0x68ff('0xb')]('The\x20User\x20ID\x20is:',_0x34f951['id']);return getEndUser(_0x3bc189,_0x439920[_0x68ff('0x55')],_0x439920[_0x68ff('0x56')]);})[_0x68ff('0x1e')](function(_0x3e394d){_0x2b1a7d=_0x3e394d;logger['info'](_0x68ff('0x49'),_0x2b1a7d['id']);return getTicket(_0x3bc189,_0x34f951,_0x2b1a7d,_0x54b128,_0x439920);})[_0x68ff('0x1e')](function(_0x59c768){if(_0x59c768&&_0x59c768['id']){logger[_0x68ff('0xb')]('Ticket\x20created!');logger[_0x68ff('0xb')]('The\x20Ticket\x20ID\x20is:',_0x59c768['id']);logger[_0x68ff('0xb')](_0x68ff('0x52'),_0x68ff('0x4b'));emit(util[_0x68ff('0xe')]('user:%s',_0x563f69[_0x68ff('0x15')]),_0x68ff('0x4c'),{'uri':util[_0x68ff('0xe')](_0x68ff('0x4d'),_0x3bc189[_0x68ff('0x1c')],_0x59c768['id'])});}})[_0x68ff('0x4e')](function(_0x47e9cc){logger[_0x68ff('0x4f')](_0x68ff('0x52'),JSON[_0x68ff('0x30')](_0x47e9cc));});};exports[_0x68ff('0x57')]=function(_0x36b244,_0x193a4b,_0x407107,_0x22600c,_0x1aff8d,_0x228daa){var _0x14a901,_0x7157fb;_0x228daa[_0x68ff('0x1c')]=intUtil['stripTrailingSlash'](_0x228daa[_0x68ff('0x1c')]);_0x228daa[_0x68ff('0x42')]=intUtil[_0x68ff('0x43')](_0x228daa[_0x68ff('0x42')]);if(_0x1aff8d&&_0x1aff8d[_0x68ff('0x44')]){logger[_0x68ff('0xb')]('['+_0x193a4b[_0x68ff('0x58')][_0x68ff('0x59')]()+']',_0x68ff('0x46'));_0x193a4b[_0x68ff('0x47')]=util[_0x68ff('0xe')](_0x68ff('0x48'),_0x228daa['serverUrl'],_0x193a4b[_0x68ff('0x53')],md5(_0x193a4b[_0x68ff('0x53')]));}else{_0x193a4b[_0x68ff('0x47')]='';}headers['Authorization']=getAuth(_0x228daa);return getUser(_0x228daa,'')[_0x68ff('0x1e')](function(_0x216778){_0x14a901=_0x216778;logger[_0x68ff('0xb')](_0x68ff('0x5a'),_0x14a901['id']);return getEndUser(_0x228daa,_0x193a4b[_0x68ff('0x10')],_0x193a4b[_0x68ff('0x11')]);})[_0x68ff('0x1e')](function(_0x20c233){_0x7157fb=_0x20c233;logger['info'](_0x68ff('0x49'),_0x7157fb['id']);return getTicket(_0x228daa,_0x14a901,_0x7157fb,_0x407107,_0x193a4b);})[_0x68ff('0x1e')](function(_0x282d33){if(_0x282d33){logger[_0x68ff('0xb')](_0x68ff('0x1f'));logger[_0x68ff('0xb')](_0x68ff('0x4a'),_0x282d33['id']);}})['catch'](function(_0x46ea26){logger[_0x68ff('0x4f')]('['+_0x193a4b[_0x68ff('0x58')][_0x68ff('0x59')]()+']',JSON[_0x68ff('0x30')](_0x46ea26));});}; \ No newline at end of file +var _0xe7ec=['variableName','customVariable','name','Variable','queue','stripTrailingSlash','serverUrl','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','email','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','user:%s','trigger:browser:url','%s/helpdesk/tickets/%d','catch','error','outbound','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','Authorization','destcalleridname','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','unmanaged','monitor_format','lastevent','toUpperCase','The\x20User\x20ID\x20is:','lodash','md5','util','ioredis','../../../../config/logger','redis','localhost','socket.io-emitter','application/json','emit','info','merge','Caller\x20-\x20%s','calleridname','calleridnum','getString','Subjects','Descriptions','Tags','Fields','custom_fields','mapValues','keyBy','value','remoteUri','POST','then','Ticket\x20created!','validateEmail','%s/api/v2/agents','length','find','contact','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','format','%s/api/v2/agents/me','Admin\x20account\x20selected.','Searching\x20enduser\x20with\x20phone','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/api/v2/contacts','Basic\x20%s','toString','debug','[HTTP]','stringify','GET','map','forEach','string','picklist','customField','nameField','toLowerCase','content','includes','type','idField','push','variable'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xe7ec,0x1ec));var _0xce7e=function(_0x496333,_0x1c47d6){_0x496333=_0x496333-0x0;var _0x44256e=_0xe7ec[_0x496333];return _0x44256e;};'use strict';var _=require(_0xce7e('0x0'));var rp=require('request-promise');var md5=require(_0xce7e('0x1'));var util=require(_0xce7e('0x2'));var Redis=require(_0xce7e('0x3'));var intUtil=require('./util');var config=require('../../../../config/environment');var logger=require(_0xce7e('0x4'))('freshdesk');config[_0xce7e('0x5')]=_['defaults'](config[_0xce7e('0x5')],{'host':_0xce7e('0x6'),'port':0x18eb});var io=require(_0xce7e('0x7'))(new Redis(config[_0xce7e('0x5')]));var headers={'Content-Type':_0xce7e('0x8'),'Accept':'application/json'};function emit(_0x193a27,_0x3a60c2,_0x1e4343){io['to'](_0x193a27)[_0xce7e('0x9')](_0x3a60c2,_0x1e4343);}function getTicket(_0x1ec03a,_0x21c7d9,_0x6cc4e7,_0x2e5d75,_0x5c07ab){logger[_0xce7e('0xa')]('Creating\x20new\x20ticket...');var _0x19f563=_[_0xce7e('0xb')]({'responder_id':_0x21c7d9['id'],'requester_id':_0x6cc4e7['id'],'name':util['format'](_0xce7e('0xc'),_0x5c07ab[_0xce7e('0xd')]),'phone':_0x5c07ab[_0xce7e('0xe')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0xce7e('0xf')](_0x2e5d75[_0xce7e('0x10')],_0x5c07ab,'\x20'),'description':intUtil[_0xce7e('0xf')](_0x2e5d75[_0xce7e('0x11')],_0x5c07ab,'
'),'tags':getTags(_0x2e5d75[_0xce7e('0x12')],'name')},getCustomFields(_0x2e5d75[_0xce7e('0x13')],_0x5c07ab));_0x19f563[_0xce7e('0x14')]=_[_0xce7e('0x15')](_[_0xce7e('0x16')](_0x19f563['custom_fields'],'id'),_0xce7e('0x17'));return request({'uri':util['format']('%s/api/v2/tickets',_0x1ec03a[_0xce7e('0x18')]),'method':_0xce7e('0x19'),'body':_0x19f563})[_0xce7e('0x1a')](function(_0x284b70){logger[_0xce7e('0xa')](_0xce7e('0x1b'));return _0x284b70;});}function getUser(_0x179e8d,_0x5b9d77){if(intUtil[_0xce7e('0x1c')](_0x5b9d77)){return request({'uri':util['format'](_0xce7e('0x1d'),_0x179e8d[_0xce7e('0x18')]),'qs':{'email':_0x5b9d77}})[_0xce7e('0x1a')](function(_0x1de742){if(_0x1de742[_0xce7e('0x1e')]){logger[_0xce7e('0xa')]('Agent\x20found!');return _[_0xce7e('0x1f')](_0x1de742,function(_0x1eff62){return _0x1eff62[_0xce7e('0x20')]['email']===_0x5b9d77;});}else{logger['info'](_0xce7e('0x21'));return request({'uri':util[_0xce7e('0x22')](_0xce7e('0x23'),_0x179e8d[_0xce7e('0x18')])})[_0xce7e('0x1a')](function(_0x69e427){logger[_0xce7e('0xa')](_0xce7e('0x24'));return _0x69e427;});}});}else{logger[_0xce7e('0xa')]('Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!');return request({'uri':util['format'](_0xce7e('0x23'),_0x179e8d[_0xce7e('0x18')])})[_0xce7e('0x1a')](function(_0x271e0b){logger[_0xce7e('0xa')]('Admin\x20account\x20selected.');return _0x271e0b;});}}function getEndUser(_0x5ed482,_0x21c4f5,_0x4315d8){logger[_0xce7e('0xa')](_0xce7e('0x25'),_0x4315d8);return request({'uri':util[_0xce7e('0x22')]('%s/api/v2/contacts',_0x5ed482[_0xce7e('0x18')]),'qs':{'phone':_0x4315d8}})[_0xce7e('0x1a')](function(_0x1bb1f5){if(_0x1bb1f5['length']){logger[_0xce7e('0xa')](_0xce7e('0x26'));return _['find'](_0x1bb1f5,{'phone':_0x4315d8});}else{logger[_0xce7e('0xa')](_0xce7e('0x27'));return request({'uri':util[_0xce7e('0x22')](_0xce7e('0x28'),_0x5ed482[_0xce7e('0x18')]),'method':_0xce7e('0x19'),'body':{'name':_0x21c4f5,'phone':_0x4315d8}})['then'](function(_0x42a3c4){logger[_0xce7e('0xa')]('Enduser\x20created.');return _0x42a3c4;});}});}function getAuth(_0x69c313){return util[_0xce7e('0x22')](_0xce7e('0x29'),new Buffer(_0x69c313['apiKey']+':X')[_0xce7e('0x2a')]('base64'));}function request(_0x236400){logger[_0xce7e('0x2b')](_0xce7e('0x2c'),JSON[_0xce7e('0x2d')](_0x236400));return rp(_['defaults'](_0x236400,{'method':_0xce7e('0x2e'),'headers':headers,'json':!![]}));}function getTags(_0x316e64,_0xfe5470){var _0x2b639c=[];if(_0x316e64&&_0x316e64[_0xce7e('0x1e')]>0x0){_0x2b639c=_[_0xce7e('0x2f')](_0x316e64,_0xfe5470);}return _0x2b639c;}function getCustomFields(_0x23ecc0,_0x1c6ecc){var _0x5ec705=[];var _0x14f5b2={'custom_fields':[]};if(_0x23ecc0[_0xce7e('0x1e')]>0x0){_[_0xce7e('0x30')](_0x23ecc0,function(_0x344f2a){if(_['includes']([_0xce7e('0x31'),_0xce7e('0x32')],_0x344f2a['type'])&&_0x344f2a['nameField']&&!_0x344f2a[_0xce7e('0x33')]){_0x14f5b2[_0x344f2a[_0xce7e('0x34')][_0xce7e('0x35')]()]=_0x344f2a[_0xce7e('0x36')][_0xce7e('0x2a')]();}else if(_[_0xce7e('0x37')]([_0xce7e('0x31'),_0xce7e('0x32')],_0x344f2a[_0xce7e('0x38')])&&_0x344f2a[_0xce7e('0x39')]&&_0x344f2a[_0xce7e('0x33')]){_0x14f5b2[_0xce7e('0x14')][_0xce7e('0x3a')]({'id':_0x344f2a['idField'],'value':_0x344f2a[_0xce7e('0x36')][_0xce7e('0x2a')]()});}else if(_0x344f2a[_0xce7e('0x38')]===_0xce7e('0x3b')&&_0x344f2a[_0xce7e('0x3c')]&&_0x344f2a[_0xce7e('0x39')]&&_0x344f2a[_0xce7e('0x33')]){_0x1c6ecc[_0x344f2a[_0xce7e('0x3c')]]&&_0x14f5b2[_0xce7e('0x14')]['push']({'id':_0x344f2a[_0xce7e('0x39')],'value':_0x1c6ecc[_0x344f2a[_0xce7e('0x3c')]][_0xce7e('0x2a')]()});}else if(_0x344f2a[_0xce7e('0x38')]===_0xce7e('0x3d')&&_0x344f2a['Variable']&&_0x344f2a['Variable'][_0xce7e('0x3e')]&&_0x344f2a[_0xce7e('0x39')]&&_0x344f2a[_0xce7e('0x33')]){_0x1c6ecc[_0x344f2a['Variable'][_0xce7e('0x3e')][_0xce7e('0x35')]()]&&_0x14f5b2['custom_fields'][_0xce7e('0x3a')]({'id':_0x344f2a['idField'],'value':_0x1c6ecc[_0x344f2a[_0xce7e('0x3f')][_0xce7e('0x3e')][_0xce7e('0x35')]()][_0xce7e('0x2a')]()});}});}return _0x14f5b2;}exports[_0xce7e('0x40')]=function(_0x19672f,_0x36b051,_0x46c415,_0x341847,_0x5935bf,_0x239561){var _0x17cc09,_0x366143;_0x239561[_0xce7e('0x18')]=intUtil[_0xce7e('0x41')](_0x239561[_0xce7e('0x18')]);_0x239561[_0xce7e('0x42')]=intUtil['stripTrailingSlash'](_0x239561[_0xce7e('0x42')]);if(_0x5935bf&&_0x5935bf['monitor_format']){logger[_0xce7e('0xa')](_0xce7e('0x43'),'Recording\x20is\x20enabled!');_0x36b051[_0xce7e('0x44')]=util[_0xce7e('0x22')](_0xce7e('0x45'),_0x239561[_0xce7e('0x42')],_0x36b051['uniqueid'],md5(_0x36b051[_0xce7e('0x46')]));}else{_0x36b051['recordingURL']='';}headers['Authorization']=getAuth(_0x239561);return getUser(_0x239561,_0x341847[_0xce7e('0x47')])[_0xce7e('0x1a')](function(_0x1ab444){_0x17cc09=_0x1ab444;logger[_0xce7e('0xa')]('The\x20User\x20ID\x20is:',_0x17cc09['id']);return getEndUser(_0x239561,_0x36b051[_0xce7e('0xd')],_0x36b051[_0xce7e('0xe')]);})[_0xce7e('0x1a')](function(_0x4feb8a){_0x366143=_0x4feb8a;logger[_0xce7e('0xa')](_0xce7e('0x48'),_0x366143['id']);return getTicket(_0x239561,_0x17cc09,_0x366143,_0x46c415,_0x36b051);})['then'](function(_0xd79671){if(_0xd79671&&_0xd79671['id']){logger[_0xce7e('0xa')](_0xce7e('0x1b'));logger[_0xce7e('0xa')](_0xce7e('0x49'),_0xd79671['id']);logger[_0xce7e('0xa')](_0xce7e('0x43'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util['format'](_0xce7e('0x4a'),_0x341847['name']),_0xce7e('0x4b'),{'uri':util['format'](_0xce7e('0x4c'),_0x239561[_0xce7e('0x18')],_0xd79671['id'])});}})[_0xce7e('0x4d')](function(_0x4bc6c7){logger[_0xce7e('0x4e')](_0xce7e('0x43'),JSON[_0xce7e('0x2d')](_0x4bc6c7));});};exports[_0xce7e('0x4f')]=function(_0x53ebca,_0x5079f7,_0x4828a1,_0x164b5b,_0x30ffce,_0x363777,_0x22ea2d){var _0x3ddad6,_0x242c05;_0x363777['remoteUri']=intUtil[_0xce7e('0x41')](_0x363777[_0xce7e('0x18')]);_0x363777[_0xce7e('0x42')]=intUtil[_0xce7e('0x41')](_0x363777[_0xce7e('0x42')]);if(_0x22ea2d&&_0x22ea2d[_0xce7e('0x50')]&&_0x22ea2d[_0xce7e('0x50')]!==_0xce7e('0x51')){logger[_0xce7e('0xa')](_0xce7e('0x52'),_0xce7e('0x53'));_0x5079f7[_0xce7e('0x44')]=util[_0xce7e('0x22')](_0xce7e('0x45'),_0x363777[_0xce7e('0x42')],_0x5079f7[_0xce7e('0x46')],md5(_0x5079f7[_0xce7e('0x46')]));}headers[_0xce7e('0x54')]=getAuth(_0x363777);return getUser(_0x363777,_0x164b5b[_0xce7e('0x47')])[_0xce7e('0x1a')](function(_0x662082){_0x3ddad6=_0x662082;logger[_0xce7e('0xa')]('The\x20User\x20ID\x20is:',_0x3ddad6['id']);return getEndUser(_0x363777,_0x5079f7[_0xce7e('0x55')],_0x5079f7['destcalleridnum']);})[_0xce7e('0x1a')](function(_0x33e23d){_0x242c05=_0x33e23d;logger[_0xce7e('0xa')](_0xce7e('0x48'),_0x242c05['id']);return getTicket(_0x363777,_0x3ddad6,_0x242c05,_0x4828a1,_0x5079f7);})['then'](function(_0x49bbae){if(_0x49bbae&&_0x49bbae['id']){logger[_0xce7e('0xa')](_0xce7e('0x1b'));logger[_0xce7e('0xa')](_0xce7e('0x49'),_0x49bbae['id']);logger[_0xce7e('0xa')]('[OUTBOUND]',_0xce7e('0x56'));emit(util[_0xce7e('0x22')](_0xce7e('0x4a'),_0x164b5b[_0xce7e('0x3e')]),'trigger:browser:url',{'uri':util['format']('%s/helpdesk/tickets/%d',_0x363777[_0xce7e('0x18')],_0x49bbae['id'])});}})[_0xce7e('0x4d')](function(_0x480a6f){logger[_0xce7e('0x4e')](_0xce7e('0x52'),JSON['stringify'](_0x480a6f));});};exports[_0xce7e('0x57')]=function(_0x346994,_0x1a0c18,_0x283f57,_0x6bafe1,_0x3ca5f2,_0x2b78ba){var _0x3f2ec3,_0x5e27e4;_0x2b78ba['remoteUri']=intUtil[_0xce7e('0x41')](_0x2b78ba[_0xce7e('0x18')]);_0x2b78ba['serverUrl']=intUtil[_0xce7e('0x41')](_0x2b78ba['serverUrl']);if(_0x3ca5f2&&_0x3ca5f2[_0xce7e('0x58')]){logger[_0xce7e('0xa')]('['+_0x1a0c18[_0xce7e('0x59')][_0xce7e('0x5a')]()+']',_0xce7e('0x53'));_0x1a0c18['recordingURL']=util[_0xce7e('0x22')](_0xce7e('0x45'),_0x2b78ba[_0xce7e('0x42')],_0x1a0c18['uniqueid'],md5(_0x1a0c18[_0xce7e('0x46')]));}else{_0x1a0c18[_0xce7e('0x44')]='';}headers[_0xce7e('0x54')]=getAuth(_0x2b78ba);return getUser(_0x2b78ba,'')[_0xce7e('0x1a')](function(_0x3d90d4){_0x3f2ec3=_0x3d90d4;logger[_0xce7e('0xa')](_0xce7e('0x5b'),_0x3f2ec3['id']);return getEndUser(_0x2b78ba,_0x1a0c18[_0xce7e('0xd')],_0x1a0c18['calleridnum']);})['then'](function(_0x52f25d){_0x5e27e4=_0x52f25d;logger[_0xce7e('0xa')](_0xce7e('0x48'),_0x5e27e4['id']);return getTicket(_0x2b78ba,_0x3f2ec3,_0x5e27e4,_0x283f57,_0x1a0c18);})['then'](function(_0x1b1981){if(_0x1b1981){logger['info'](_0xce7e('0x1b'));logger[_0xce7e('0xa')](_0xce7e('0x49'),_0x1b1981['id']);}})['catch'](function(_0x20272d){logger[_0xce7e('0x4e')]('['+_0x1a0c18[_0xce7e('0x59')][_0xce7e('0x5a')]()+']',JSON[_0xce7e('0x2d')](_0x20272d));});}; \ 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 64c85ea..3558eda 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 _0x7020=['stripTrailingSlash','serverUrl','toLowerCase','destcalleridnum','calleridnum','callDirection','queue','outbound','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','Displaying\x20task\x20in\x20a\x20new\x20tab...','name',']\x20Error\x20running\x20Freshsales\x20integration','inspect','lodash','request-promise','md5','util','moment','bluebird','../../../../config/environment','freshsales','redis','defaults','localhost','socket.io-emitter','GET','Getting\x20admin\x20information','then','users','length','adminEmail','adminId','info','Admin\x20found:','Requested\x20Resource\x20not\x20Found','catch','error','toUpperCase','message','/api/selector/owners','headers','Getting\x20user\x20list','agentEmail','Getting\x20user\x20with\x20email','email','User\x20found:','userId','Admin\x20selected','/api/lookup?q=','&f=','&entities=contact','find','contacts','format','Searching\x20contact\x20with\x20phone\x20%s','contactNumber','endUserId','Contact\x20found\x20mobile_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','Contact','add','task','ticketId','/contacts/','emit','apiKey','remoteUri'];(function(_0x11114b,_0x43f0fa){var _0x24f0a1=function(_0x55826e){while(--_0x55826e){_0x11114b['push'](_0x11114b['shift']());}};_0x24f0a1(++_0x43f0fa);}(_0x7020,0x105));var _0x0702=function(_0x49615f,_0x4a27ab){_0x49615f=_0x49615f-0x0;var _0x4845ae=_0x7020[_0x49615f];return _0x4845ae;};'use strict';var _=require(_0x0702('0x0'));var rp=require(_0x0702('0x1'));var md5=require(_0x0702('0x2'));var util=require(_0x0702('0x3'));var moment=require(_0x0702('0x4'));var Promise=require(_0x0702('0x5'));var Redis=require('ioredis');var intUtil=require('./util');var config=require(_0x0702('0x6'));var logger=require('../../../../config/logger')(_0x0702('0x7'));config[_0x0702('0x8')]=_[_0x0702('0x9')](config[_0x0702('0x8')],{'host':_0x0702('0xa'),'port':0x18eb});var io=require(_0x0702('0xb'))(new Redis(config[_0x0702('0x8')]));function getAdminId(_0x484cbd,_0x4d26e9,_0x4b07d9,_0x3233d6){return new Promise(function(_0x1091c9,_0x27423d){var _0x2463ea=![];var _0x555435={'method':_0x0702('0xc'),'uri':_0x3233d6+'/api/selector/owners','json':!![]};_0x555435['headers']=_0x4b07d9;logger['info'](_0x0702('0xd'));return rp(_0x555435)[_0x0702('0xe')](function(_0xc76b36){if(_0xc76b36){var _0x463056=_0xc76b36[_0x0702('0xf')];var _0x99d680=null;for(_0x99d680=0x0;_0x99d680<_0x463056[_0x0702('0x10')];_0x99d680++){if(_0x463056[_0x99d680]['email']===_0x484cbd[_0x0702('0x11')]){_0x484cbd[_0x0702('0x12')]=_0x463056[_0x99d680]['id'];_0x2463ea=!![];}}if(_0x2463ea){logger[_0x0702('0x13')](_0x0702('0x14'),_0x484cbd['adminId']);_0x1091c9(_0x484cbd);}else{_0x27423d({'statusCode':0x194,'message':_0x0702('0x15')});}}else{_0x27423d({'statusCode':0x194,'message':_0x0702('0x15')});}})[_0x0702('0x16')](function(_0x1330da){logger[_0x0702('0x17')]('['+[_0x4d26e9[_0x0702('0x18')]()]+']',_0x1330da[_0x0702('0x19')]);_0x27423d(_0x1330da);});});}function getUser(_0x329577,_0x228423,_0x1fd196){return function(_0x3f9d5c){return new Promise(function(_0xdb4dd4,_0x1a409c){var _0x37b362={'method':_0x0702('0xc'),'uri':_0x1fd196+_0x0702('0x1a'),'json':!![]};_0x37b362[_0x0702('0x1b')]=_0x228423;logger['info'](_0x0702('0x1c'));return rp(_0x37b362)[_0x0702('0xe')](function(_0x20a179){if(_0x20a179){var _0x3239ee=_0x20a179[_0x0702('0xf')];var _0x1da5d2=![];var _0x35acb0=null;if(_0x3f9d5c[_0x0702('0x1d')]!==null){logger[_0x0702('0x13')](_0x0702('0x1e'),_0x3f9d5c[_0x0702('0x1d')]);_0x3f9d5c['userEmail']=_0x3f9d5c['agentEmail'];for(_0x35acb0=0x0;_0x35acb0<_0x3239ee[_0x0702('0x10')];_0x35acb0++){if(_0x3239ee[_0x35acb0][_0x0702('0x1f')]===_0x3f9d5c[_0x0702('0x1d')]){_0x1da5d2=!![];_0x3f9d5c['userId']=_0x3239ee[_0x35acb0]['id'];logger['info'](_0x0702('0x20'),_0x3f9d5c[_0x0702('0x21')]);}}}if(!_0x1da5d2){logger[_0x0702('0x13')](_0x0702('0x22'));_0x3f9d5c['userEmail']=_0x3f9d5c['adminEmail'];_0x3f9d5c[_0x0702('0x21')]=_0x3f9d5c[_0x0702('0x12')];_0x1da5d2=!![];}if(_0x1da5d2){_0xdb4dd4(_0x3f9d5c);}else{_0x1a409c({'statusCode':0x194,'message':_0x0702('0x15')});}}else{_0x1a409c({'statusCode':0x194,'message':_0x0702('0x15')});}})[_0x0702('0x16')](function(_0x2d3275){logger[_0x0702('0x17')]('['+[_0x329577[_0x0702('0x18')]()]+']',_0x2d3275[_0x0702('0x19')]);_0x1a409c(_0x2d3275);});});};}function searchContact(_0x488fe3,_0x3db295,_0xa170aa,_0x35725b){return new Promise(function(_0x2cebcb,_0x29b43d){var _0x8b2e55={'method':_0x0702('0xc'),'headers':_0x3db295,'uri':_0x488fe3+_0x0702('0x23')+_0x35725b+_0x0702('0x24')+_0xa170aa+_0x0702('0x25'),'json':!![]};rp(_0x8b2e55)[_0x0702('0xe')](function(_0x488cef){var _0x229df3=_[_0x0702('0x26')](_0x488cef[_0x0702('0x27')][_0x0702('0x27')],[_0xa170aa,_0x35725b]);_0x2cebcb(_0x229df3);})['catch'](function(_0x4c5324){_0x29b43d(_0x4c5324);});});}function getEndUser(_0x33e8fe,_0x5e0487,_0x4073ad){return function(_0x56ed20){return new Promise(function(_0x5a7762,_0x415c6a){logger[_0x0702('0x13')](util[_0x0702('0x28')](_0x0702('0x29'),_0x56ed20['contactNumber']));searchContact(_0x4073ad,_0x5e0487,'mobile_number',_0x56ed20[_0x0702('0x2a')])[_0x0702('0xe')](function(_0x3e8b1c){if(_0x3e8b1c){_0x56ed20[_0x0702('0x2b')]=_0x3e8b1c['id'];logger[_0x0702('0x13')](_0x0702('0x2c'),_0x56ed20[_0x0702('0x2b')]);return _0x5a7762(_0x56ed20);}searchContact(_0x4073ad,_0x5e0487,'work_number',_0x56ed20[_0x0702('0x2a')])[_0x0702('0xe')](function(_0xc081d3){if(_0xc081d3){_0x56ed20[_0x0702('0x2b')]=_0xc081d3['id'];logger[_0x0702('0x13')](_0x0702('0x2d'),_0x56ed20[_0x0702('0x2b')]);return _0x5a7762(_0x56ed20);}createEndUser(_0x56ed20,_0x33e8fe,_0x5e0487,_0x4073ad)['then'](function(_0x52f691){logger[_0x0702('0x13')](_0x0702('0x2e'),_0x52f691[_0x0702('0x2b')]);return _0x5a7762(_0x52f691);});});})[_0x0702('0x16')](function(_0x163cea){_0x415c6a(_0x163cea);});});};}function createEndUser(_0x1cb9ec,_0x4909d6,_0x1aa28b,_0x5e4fe3){return new Promise(function(_0x395390,_0x32c1c7){var _0x47b964=moment();var _0xe7a6df={'method':_0x0702('0x2f'),'uri':_0x5e4fe3+_0x0702('0x30'),'body':{'contact':{'last_name':_0x1cb9ec[_0x0702('0x2a')],'work_number':_0x1cb9ec[_0x0702('0x2a')],'mobile_number':_0x1cb9ec[_0x0702('0x2a')],'owner_id':_0x1cb9ec[_0x0702('0x21')],'created_at':_0x47b964[_0x0702('0x28')](_0x0702('0x31'))}},'json':!![]};_0xe7a6df[_0x0702('0x1b')]=_0x1aa28b;logger[_0x0702('0x13')](_0x0702('0x32'));return rp(_0xe7a6df)[_0x0702('0xe')](function(_0x54c7e6){_0x1cb9ec[_0x0702('0x2b')]=_0x54c7e6[_0x0702('0x33')]['id'];_0x395390(_0x1cb9ec);})['catch'](function(_0x5114dd){logger[_0x0702('0x17')]('['+[_0x4909d6[_0x0702('0x18')]()]+']',_0x5114dd[_0x0702('0x19')]);_0x32c1c7(_0x5114dd[_0x0702('0x19')]);});});}function getTicket(_0x1ee91f,_0xcaa610,_0x25b03c,_0x37266f,_0x399ec6){return function(_0x1d57aa){logger['info'](_0x0702('0x34'));return new Promise(function(_0x261529,_0x10b75b){var _0x24ed08=moment();var _0x4e64e1={'method':_0x0702('0x2f'),'uri':_0x25b03c+_0x0702('0x35'),'body':{'title':intUtil[_0x0702('0x36')](_0x37266f['Subjects'],_0x399ec6,'\x20'),'description':intUtil[_0x0702('0x36')](_0x37266f['Descriptions'],_0x399ec6,'\x0a'),'owner_id':_0x1d57aa[_0x0702('0x21')],'creater_id':_0x1d57aa[_0x0702('0x12')],'targetable_id':_0x1d57aa[_0x0702('0x2b')],'targetable_type':_0x0702('0x37'),'created_at':_0x24ed08[_0x0702('0x28')](_0x0702('0x31')),'due_date':_0x24ed08[_0x0702('0x38')](0x1e,'m')[_0x0702('0x28')]('YYYY-MM-DDTHH:mm:ss')},'json':!![]};_0x4e64e1[_0x0702('0x1b')]=_0xcaa610;return rp(_0x4e64e1)[_0x0702('0xe')](function(_0x212d13){_0x1d57aa['ticketId']=_0x212d13[_0x0702('0x39')]['id'];logger[_0x0702('0x13')]('Task\x20created:',_0x1d57aa[_0x0702('0x3a')]);_0x261529(_0x1d57aa);})[_0x0702('0x16')](function(_0x3a4d2a){logger[_0x0702('0x17')]('['+[_0x1ee91f['toUpperCase']()]+']',_0x3a4d2a[_0x0702('0x19')]);_0x10b75b(_0x3a4d2a[_0x0702('0x19')]);});});};}function emit(_0xc94293,_0x3f705a,_0x394ecf){var _0x5b6fbe={'uri':_0xc94293+_0x0702('0x3b')+_0x394ecf};io['to'](util['format']('user:%s',_0x3f705a))[_0x0702('0x3c')]('trigger:browser:url',_0x5b6fbe);}exports['cs']=function(_0x2517b3,_0x29ddf8,_0x287710,_0x25b606,_0x5776eb,_0x4b8f15,_0x54b7f4,_0x1f3feb){var _0x64525d={};var _0x209861={'Authorization':'Token\x20token='+_0x4b8f15[_0x0702('0x3d')]};_0x4b8f15[_0x0702('0x3e')]=intUtil[_0x0702('0x3f')](_0x4b8f15[_0x0702('0x3e')]);_0x4b8f15[_0x0702('0x40')]=intUtil[_0x0702('0x3f')](_0x4b8f15[_0x0702('0x40')]);var _0x412cba=_0x4b8f15[_0x0702('0x3e')];_0x64525d[_0x0702('0x11')]=_0x4b8f15['username'];_0x64525d[_0x0702('0x2a')]=_0x1f3feb[_0x0702('0x41')]()==='outbound'?_0x29ddf8[_0x0702('0x42')]:_0x29ddf8[_0x0702('0x43')];_0x64525d[_0x0702('0x44')]=_0x1f3feb===_0x0702('0x45')||_0x1f3feb==='unmanaged'?_0x0702('0x45'):_0x0702('0x46');if(_0x25b606){_0x64525d[_0x0702('0x1d')]=_0x25b606[_0x0702('0x1f')];}var _0x5f19b1=util[_0x0702('0x28')](_0x0702('0x47'),_0x4b8f15[_0x0702('0x40')],_0x29ddf8[_0x0702('0x48')],md5(_0x29ddf8[_0x0702('0x48')]));if(_0x5776eb&&_0x5776eb['monitor_format']){logger[_0x0702('0x13')](_0x0702('0x49'),_0x0702('0x4a'));_0x29ddf8[_0x0702('0x4b')]=_0x5f19b1;}else if(_0x54b7f4&&_0x54b7f4[_0x0702('0x4c')]&&_0x54b7f4[_0x0702('0x4c')]!=='none'){logger[_0x0702('0x13')]('[OUTBOUND]',_0x0702('0x4a'));_0x29ddf8[_0x0702('0x4b')]=_0x5f19b1;}else{_0x29ddf8[_0x0702('0x4b')]='';}return getAdminId(_0x64525d,_0x1f3feb,_0x209861,_0x412cba)[_0x0702('0xe')](getUser(_0x1f3feb,_0x209861,_0x412cba))[_0x0702('0xe')](getEndUser(_0x1f3feb,_0x209861,_0x412cba))['then'](getTicket(_0x1f3feb,_0x209861,_0x412cba,_0x287710,_0x29ddf8))[_0x0702('0xe')](function(_0x39b9a6){logger[_0x0702('0x13')](util[_0x0702('0x28')]('The\x20ticket\x20ID\x20is:\x20%s',_0x39b9a6[_0x0702('0x3a')]));if(_0x1f3feb!=='unmanaged'){logger[_0x0702('0x13')]('['+[_0x1f3feb[_0x0702('0x18')]()]+']',_0x0702('0x4d'));emit(_0x412cba,_0x25b606[_0x0702('0x4e')],_0x39b9a6['endUserId']);}})['catch'](function(_0x94065c){logger[_0x0702('0x17')]('['+[_0x1f3feb[_0x0702('0x18')]()]+_0x0702('0x4f'),util[_0x0702('0x50')](_0x94065c,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x2f4d=['&entities=contact','find','contacts','format','Searching\x20contact\x20with\x20phone\x20%s','contactNumber','mobile_number','endUserId','Contact\x20found\x20mobile_number:','work_number','Contact\x20found\x20work_number:','POST','/api/contacts','YYYY-MM-DDTHH:mm:ss','headers','contact','Creating\x20new\x20task','getString','Subjects','Contact','add','ticketId','task','user:%s','emit','trigger:browser:url','Token\x20token=','apiKey','remoteUri','stripTrailingSlash','serverUrl','username','toLowerCase','outbound','destcalleridnum','calleridnum','callDirection','queue','unmanaged','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]','The\x20ticket\x20ID\x20is:\x20%s','Displaying\x20task\x20in\x20a\x20new\x20tab...','name',']\x20Error\x20running\x20Freshsales\x20integration','inspect','lodash','util','moment','bluebird','ioredis','./util','../../../../config/environment','freshsales','redis','defaults','localhost','/api/selector/owners','info','Getting\x20admin\x20information','then','users','length','adminEmail','adminId','Requested\x20Resource\x20not\x20Found','catch','error','toUpperCase','message','GET','Getting\x20user\x20list','agentEmail','Getting\x20user\x20with\x20email','userEmail','email','userId','User\x20found:','Admin\x20selected','/api/lookup?q=','&f='];(function(_0x22f8ab,_0x15d8ff){var _0x2a70e5=function(_0x5e6895){while(--_0x5e6895){_0x22f8ab['push'](_0x22f8ab['shift']());}};_0x2a70e5(++_0x15d8ff);}(_0x2f4d,0x1ed));var _0xd2f4=function(_0x14d712,_0x4ef832){_0x14d712=_0x14d712-0x0;var _0x27457f=_0x2f4d[_0x14d712];return _0x27457f;};'use strict';var _=require(_0xd2f4('0x0'));var rp=require('request-promise');var md5=require('md5');var util=require(_0xd2f4('0x1'));var moment=require(_0xd2f4('0x2'));var Promise=require(_0xd2f4('0x3'));var Redis=require(_0xd2f4('0x4'));var intUtil=require(_0xd2f4('0x5'));var config=require(_0xd2f4('0x6'));var logger=require('../../../../config/logger')(_0xd2f4('0x7'));config[_0xd2f4('0x8')]=_[_0xd2f4('0x9')](config[_0xd2f4('0x8')],{'host':_0xd2f4('0xa'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function getAdminId(_0x33d63f,_0xa8b04f,_0x23e2b0,_0x30b535){return new Promise(function(_0x152b25,_0x222b18){var _0x5c9d81=![];var _0x4a616e={'method':'GET','uri':_0x30b535+_0xd2f4('0xb'),'json':!![]};_0x4a616e['headers']=_0x23e2b0;logger[_0xd2f4('0xc')](_0xd2f4('0xd'));return rp(_0x4a616e)[_0xd2f4('0xe')](function(_0x54ee2b){if(_0x54ee2b){var _0xd21ae0=_0x54ee2b[_0xd2f4('0xf')];var _0x424544=null;for(_0x424544=0x0;_0x424544<_0xd21ae0[_0xd2f4('0x10')];_0x424544++){if(_0xd21ae0[_0x424544]['email']===_0x33d63f[_0xd2f4('0x11')]){_0x33d63f[_0xd2f4('0x12')]=_0xd21ae0[_0x424544]['id'];_0x5c9d81=!![];}}if(_0x5c9d81){logger[_0xd2f4('0xc')]('Admin\x20found:',_0x33d63f[_0xd2f4('0x12')]);_0x152b25(_0x33d63f);}else{_0x222b18({'statusCode':0x194,'message':_0xd2f4('0x13')});}}else{_0x222b18({'statusCode':0x194,'message':_0xd2f4('0x13')});}})[_0xd2f4('0x14')](function(_0x1b0baa){logger[_0xd2f4('0x15')]('['+[_0xa8b04f[_0xd2f4('0x16')]()]+']',_0x1b0baa[_0xd2f4('0x17')]);_0x222b18(_0x1b0baa);});});}function getUser(_0x1e8f7a,_0x53bba7,_0x341542){return function(_0x4f399a){return new Promise(function(_0x449abc,_0x21b3d0){var _0x372246={'method':_0xd2f4('0x18'),'uri':_0x341542+_0xd2f4('0xb'),'json':!![]};_0x372246['headers']=_0x53bba7;logger[_0xd2f4('0xc')](_0xd2f4('0x19'));return rp(_0x372246)[_0xd2f4('0xe')](function(_0x5d79df){if(_0x5d79df){var _0xd26ecb=_0x5d79df[_0xd2f4('0xf')];var _0x586a4c=![];var _0x5402d7=null;if(_0x4f399a[_0xd2f4('0x1a')]!==null){logger[_0xd2f4('0xc')](_0xd2f4('0x1b'),_0x4f399a[_0xd2f4('0x1a')]);_0x4f399a[_0xd2f4('0x1c')]=_0x4f399a[_0xd2f4('0x1a')];for(_0x5402d7=0x0;_0x5402d7<_0xd26ecb[_0xd2f4('0x10')];_0x5402d7++){if(_0xd26ecb[_0x5402d7][_0xd2f4('0x1d')]===_0x4f399a[_0xd2f4('0x1a')]){_0x586a4c=!![];_0x4f399a[_0xd2f4('0x1e')]=_0xd26ecb[_0x5402d7]['id'];logger['info'](_0xd2f4('0x1f'),_0x4f399a[_0xd2f4('0x1e')]);}}}if(!_0x586a4c){logger[_0xd2f4('0xc')](_0xd2f4('0x20'));_0x4f399a[_0xd2f4('0x1c')]=_0x4f399a['adminEmail'];_0x4f399a['userId']=_0x4f399a['adminId'];_0x586a4c=!![];}if(_0x586a4c){_0x449abc(_0x4f399a);}else{_0x21b3d0({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}else{_0x21b3d0({'statusCode':0x194,'message':_0xd2f4('0x13')});}})[_0xd2f4('0x14')](function(_0x31cbe9){logger[_0xd2f4('0x15')]('['+[_0x1e8f7a[_0xd2f4('0x16')]()]+']',_0x31cbe9[_0xd2f4('0x17')]);_0x21b3d0(_0x31cbe9);});});};}function searchContact(_0x3ffb83,_0x195034,_0x3f85e5,_0x4af9fe){return new Promise(function(_0x19f75e,_0x23a39c){var _0x523cbf={'method':'GET','headers':_0x195034,'uri':_0x3ffb83+_0xd2f4('0x21')+_0x4af9fe+_0xd2f4('0x22')+_0x3f85e5+_0xd2f4('0x23'),'json':!![]};rp(_0x523cbf)[_0xd2f4('0xe')](function(_0x30e04f){var _0x252a6d=_[_0xd2f4('0x24')](_0x30e04f[_0xd2f4('0x25')]['contacts'],[_0x3f85e5,_0x4af9fe]);_0x19f75e(_0x252a6d);})[_0xd2f4('0x14')](function(_0x43c72c){_0x23a39c(_0x43c72c);});});}function getEndUser(_0x549ff1,_0x36fd46,_0x5d18ac){return function(_0x5d4332){return new Promise(function(_0x276a0e,_0x2ea711){logger[_0xd2f4('0xc')](util[_0xd2f4('0x26')](_0xd2f4('0x27'),_0x5d4332[_0xd2f4('0x28')]));searchContact(_0x5d18ac,_0x36fd46,_0xd2f4('0x29'),_0x5d4332[_0xd2f4('0x28')])['then'](function(_0x443ba5){if(_0x443ba5){_0x5d4332[_0xd2f4('0x2a')]=_0x443ba5['id'];logger[_0xd2f4('0xc')](_0xd2f4('0x2b'),_0x5d4332['endUserId']);return _0x276a0e(_0x5d4332);}searchContact(_0x5d18ac,_0x36fd46,_0xd2f4('0x2c'),_0x5d4332[_0xd2f4('0x28')])[_0xd2f4('0xe')](function(_0x28ef12){if(_0x28ef12){_0x5d4332['endUserId']=_0x28ef12['id'];logger[_0xd2f4('0xc')](_0xd2f4('0x2d'),_0x5d4332[_0xd2f4('0x2a')]);return _0x276a0e(_0x5d4332);}createEndUser(_0x5d4332,_0x549ff1,_0x36fd46,_0x5d18ac)['then'](function(_0x177faf){logger[_0xd2f4('0xc')]('Contact\x20created:',_0x177faf[_0xd2f4('0x2a')]);return _0x276a0e(_0x177faf);});});})[_0xd2f4('0x14')](function(_0x4f565c){_0x2ea711(_0x4f565c);});});};}function createEndUser(_0x400a46,_0x3b22f4,_0x2a6074,_0x3463a2){return new Promise(function(_0x2440a3,_0x35bd61){var _0x5b3559=moment();var _0x5750c7={'method':_0xd2f4('0x2e'),'uri':_0x3463a2+_0xd2f4('0x2f'),'body':{'contact':{'last_name':_0x400a46['contactNumber'],'work_number':_0x400a46[_0xd2f4('0x28')],'mobile_number':_0x400a46[_0xd2f4('0x28')],'owner_id':_0x400a46[_0xd2f4('0x1e')],'created_at':_0x5b3559['format'](_0xd2f4('0x30'))}},'json':!![]};_0x5750c7[_0xd2f4('0x31')]=_0x2a6074;logger[_0xd2f4('0xc')]('Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact');return rp(_0x5750c7)[_0xd2f4('0xe')](function(_0x1e01b5){_0x400a46[_0xd2f4('0x2a')]=_0x1e01b5[_0xd2f4('0x32')]['id'];_0x2440a3(_0x400a46);})[_0xd2f4('0x14')](function(_0x1b8b2f){logger[_0xd2f4('0x15')]('['+[_0x3b22f4[_0xd2f4('0x16')]()]+']',_0x1b8b2f[_0xd2f4('0x17')]);_0x35bd61(_0x1b8b2f[_0xd2f4('0x17')]);});});}function getTicket(_0x1b9a1c,_0x245a5c,_0x4ca418,_0x2926ad,_0x40ccd0){return function(_0x38bde0){logger[_0xd2f4('0xc')](_0xd2f4('0x33'));return new Promise(function(_0x1b7f05,_0x10dd51){var _0x18b069=moment();var _0xbffab1={'method':'POST','uri':_0x4ca418+'/api/tasks','body':{'title':intUtil[_0xd2f4('0x34')](_0x2926ad[_0xd2f4('0x35')],_0x40ccd0,'\x20'),'description':intUtil['getString'](_0x2926ad['Descriptions'],_0x40ccd0,'\x0a'),'owner_id':_0x38bde0[_0xd2f4('0x1e')],'creater_id':_0x38bde0[_0xd2f4('0x12')],'targetable_id':_0x38bde0[_0xd2f4('0x2a')],'targetable_type':_0xd2f4('0x36'),'created_at':_0x18b069[_0xd2f4('0x26')](_0xd2f4('0x30')),'due_date':_0x18b069[_0xd2f4('0x37')](0x1e,'m')[_0xd2f4('0x26')](_0xd2f4('0x30'))},'json':!![]};_0xbffab1[_0xd2f4('0x31')]=_0x245a5c;return rp(_0xbffab1)[_0xd2f4('0xe')](function(_0x526a8b){_0x38bde0[_0xd2f4('0x38')]=_0x526a8b[_0xd2f4('0x39')]['id'];logger[_0xd2f4('0xc')]('Task\x20created:',_0x38bde0[_0xd2f4('0x38')]);_0x1b7f05(_0x38bde0);})[_0xd2f4('0x14')](function(_0x1b847d){logger['error']('['+[_0x1b9a1c[_0xd2f4('0x16')]()]+']',_0x1b847d[_0xd2f4('0x17')]);_0x10dd51(_0x1b847d[_0xd2f4('0x17')]);});});};}function emit(_0x32ad7c,_0x38acd5,_0x52b746){var _0x3e2617={'uri':_0x32ad7c+'/contacts/'+_0x52b746};io['to'](util[_0xd2f4('0x26')](_0xd2f4('0x3a'),_0x38acd5))[_0xd2f4('0x3b')](_0xd2f4('0x3c'),_0x3e2617);}exports['cs']=function(_0x13caa1,_0x5361df,_0x21d24a,_0x5c81d9,_0x5ce141,_0x101f3b,_0xf5969b,_0x2c25fc){var _0x17b760={};var _0x35b59d={'Authorization':_0xd2f4('0x3d')+_0x101f3b[_0xd2f4('0x3e')]};_0x101f3b[_0xd2f4('0x3f')]=intUtil[_0xd2f4('0x40')](_0x101f3b[_0xd2f4('0x3f')]);_0x101f3b['serverUrl']=intUtil[_0xd2f4('0x40')](_0x101f3b[_0xd2f4('0x41')]);var _0x3216a9=_0x101f3b[_0xd2f4('0x3f')];_0x17b760[_0xd2f4('0x11')]=_0x101f3b[_0xd2f4('0x42')];_0x17b760[_0xd2f4('0x28')]=_0x2c25fc[_0xd2f4('0x43')]()===_0xd2f4('0x44')?_0x5361df[_0xd2f4('0x45')]:_0x5361df[_0xd2f4('0x46')];_0x17b760[_0xd2f4('0x47')]=_0x2c25fc===_0xd2f4('0x48')||_0x2c25fc===_0xd2f4('0x49')?_0xd2f4('0x48'):_0xd2f4('0x44');if(_0x5c81d9){_0x17b760[_0xd2f4('0x1a')]=_0x5c81d9[_0xd2f4('0x1d')];}var _0x2ced45=util[_0xd2f4('0x26')](_0xd2f4('0x4a'),_0x101f3b[_0xd2f4('0x41')],_0x5361df[_0xd2f4('0x4b')],md5(_0x5361df[_0xd2f4('0x4b')]));if(_0x5ce141&&_0x5ce141[_0xd2f4('0x4c')]){logger[_0xd2f4('0xc')](_0xd2f4('0x4d'),_0xd2f4('0x4e'));_0x5361df[_0xd2f4('0x4f')]=_0x2ced45;}else if(_0xf5969b&&_0xf5969b[_0xd2f4('0x50')]&&_0xf5969b['recordingFormat']!==_0xd2f4('0x51')){logger[_0xd2f4('0xc')](_0xd2f4('0x52'),_0xd2f4('0x4e'));_0x5361df[_0xd2f4('0x4f')]=_0x2ced45;}else{_0x5361df[_0xd2f4('0x4f')]='';}return getAdminId(_0x17b760,_0x2c25fc,_0x35b59d,_0x3216a9)[_0xd2f4('0xe')](getUser(_0x2c25fc,_0x35b59d,_0x3216a9))['then'](getEndUser(_0x2c25fc,_0x35b59d,_0x3216a9))['then'](getTicket(_0x2c25fc,_0x35b59d,_0x3216a9,_0x21d24a,_0x5361df))[_0xd2f4('0xe')](function(_0x323fce){logger['info'](util[_0xd2f4('0x26')](_0xd2f4('0x53'),_0x323fce[_0xd2f4('0x38')]));if(_0x2c25fc!==_0xd2f4('0x49')){logger[_0xd2f4('0xc')]('['+[_0x2c25fc[_0xd2f4('0x16')]()]+']',_0xd2f4('0x54'));emit(_0x3216a9,_0x5c81d9[_0xd2f4('0x55')],_0x323fce[_0xd2f4('0x2a')]);}})[_0xd2f4('0x14')](function(_0x42f364){logger[_0xd2f4('0x15')]('['+[_0x2c25fc[_0xd2f4('0x16')]()]+_0xd2f4('0x56'),util[_0xd2f4('0x57')](_0x42f364,{'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 bd012da..8c64495 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 _0x9f83=['lodash','./zendesk','./salesforce','./sugarcrm','./freshdesk','./zoho','./servicenow','./dynamics365','./freshsales','zendesk','freshdesk','zoho','desk','vtiger','dynamics365','freshsales','servicenow','includes','data1','toLowerCase','data2','find','Configurations','data3','queue','routeId','outbound','log','EVENT\x20UNKNOWN','unmanaged','salesforce','error','[EXEC]','format','%s\x20configuration\x20#%s\x20not\x20found','../../../../config/logger'];(function(_0x5027ce,_0x195cdf){var _0x4e7232=function(_0xe2e3e2){while(--_0xe2e3e2){_0x5027ce['push'](_0x5027ce['shift']());}};_0x4e7232(++_0x195cdf);}(_0x9f83,0x144));var _0x39f8=function(_0x1514fd,_0x4804b6){_0x1514fd=_0x1514fd-0x0;var _0x43f74d=_0x9f83[_0x1514fd];return _0x43f74d;};'use strict';var _=require(_0x39f8('0x0'));var util=require('util');var zendesk=require(_0x39f8('0x1'));var salesforce=require(_0x39f8('0x2'));var sugarcrm=require(_0x39f8('0x3'));var freshdesk=require(_0x39f8('0x4'));var zoho=require(_0x39f8('0x5'));var desk=require('./desk');var vtiger=require('./vtiger');var servicenow=require(_0x39f8('0x6'));var dynamics365=require(_0x39f8('0x7'));var freshsales=require(_0x39f8('0x8'));var integrations=[_0x39f8('0x9'),'salesforce','sugarcrm',_0x39f8('0xa'),_0x39f8('0xb'),_0x39f8('0xc'),_0x39f8('0xd'),_0x39f8('0xe'),_0x39f8('0xf'),_0x39f8('0x10')];exports['exec']=function(_0x4af978,_0x4bc404,_0x423e7f,_0xfb4f28,_0x22766d,_0x5cec50){if(_0x423e7f){if(_[_0x39f8('0x11')](integrations,_0x4af978[_0x39f8('0x12')][_0x39f8('0x13')]())){try{var _0xea34d8=null;var _0x56356b='';var _0x432c29=_0x423e7f[_0x4af978[_0x39f8('0x12')]['toLowerCase']()];if(_0x432c29){var _0x4cc9f8=_0x432c29[_0x4af978[_0x39f8('0x14')]];if(_0x4cc9f8){var _0x40f547=_[_0x39f8('0x15')](_0x4cc9f8[_0x39f8('0x16')],{'id':parseInt(_0x4af978[_0x39f8('0x17')],0xa)});if(_0x40f547){if(_0xfb4f28){if(_0x22766d&&_0x4bc404[_0x39f8('0x18')]){_0x56356b=_0x39f8('0x18');}else if(_0x4bc404[_0x39f8('0x19')]){_0x56356b=_0x39f8('0x1a');}else{console[_0x39f8('0x1b')](_0x39f8('0x1c'),_0x4bc404);}}else{_0x56356b=_0x39f8('0x1d');}switch(_0x4af978[_0x39f8('0x12')][_0x39f8('0x13')]()){case _0x39f8('0x9'):zendesk[_0x56356b](_0x4af978,_0x4bc404,_0x40f547,_0xfb4f28,_0x22766d,_0x4cc9f8,_0x5cec50);break;case _0x39f8('0x1e'):salesforce[_0x56356b](_0x4af978,_0x4bc404,_0x40f547,_0xfb4f28,_0x22766d,_0x4cc9f8,_0x5cec50);break;case'sugarcrm':sugarcrm[_0x56356b](_0x4af978,_0x4bc404,_0x40f547,_0xfb4f28,_0x22766d,_0x4cc9f8,_0x5cec50);break;case _0x39f8('0xa'):freshdesk[_0x56356b](_0x4af978,_0x4bc404,_0x40f547,_0xfb4f28,_0x22766d,_0x4cc9f8,_0x5cec50);break;case _0x39f8('0xb'):zoho[_0x56356b](_0x4af978,_0x4bc404,_0x40f547,_0xfb4f28,_0x22766d,_0x4cc9f8,_0x5cec50);break;case _0x39f8('0xc'):desk[_0x56356b](_0x4af978,_0x4bc404,_0x40f547,_0xfb4f28,_0x22766d,_0x4cc9f8,_0x5cec50);break;case'vtiger':vtiger[_0x56356b](_0x4af978,_0x4bc404,_0x40f547,_0xfb4f28,_0x22766d,_0x4cc9f8,_0x5cec50);break;case _0x39f8('0xf'):freshsales['cs'](_0x4af978,_0x4bc404,_0x40f547,_0xfb4f28,_0x22766d,_0x4cc9f8,_0x5cec50,_0x56356b);break;case'servicenow':servicenow['cs'](_0x4af978,_0x4bc404,_0x40f547,_0xfb4f28,_0x22766d,_0x4cc9f8,_0x5cec50,_0x56356b);break;case _0x39f8('0xe'):dynamics365['cs'](_0x4af978,_0x4bc404,_0x40f547,_0xfb4f28,_0x22766d,_0x4cc9f8,_0x5cec50,_0x56356b);break;default:console['log']('unknown\x20integration');}}else{_0xea34d8=require('../../../../config/logger')(_0x4af978['data1']['toLowerCase']());_0xea34d8[_0x39f8('0x1f')](_0x39f8('0x20'),util[_0x39f8('0x21')](_0x39f8('0x22'),_0x4af978['data1'][_0x39f8('0x13')](),_0x4af978[_0x39f8('0x17')]));}}else{_0xea34d8=require(_0x39f8('0x23'))(_0x4af978['data1'][_0x39f8('0x13')]());_0xea34d8[_0x39f8('0x1f')](_0x39f8('0x20'),util['format']('%s\x20account\x20#%s\x20not\x20found',_0x4af978[_0x39f8('0x12')][_0x39f8('0x13')](),_0x4af978['data2']));}}else{}}catch(_0x4a0a70){console[_0x39f8('0x1f')](_0x4a0a70);}}}}; \ No newline at end of file +var _0x17c9=['data3','queue','routeId','outbound','log','EVENT\x20UNKNOWN','unmanaged','sugarcrm','desk','freshsales','servicenow','dynamics365','unknown\x20integration','../../../../config/logger','error','[EXEC]','format','lodash','util','./zendesk','./salesforce','./sugarcrm','./servicenow','./dynamics365','zendesk','salesforce','freshdesk','zoho','vtiger','exec','toLowerCase','data1','data2','find','Configurations'];(function(_0x1927af,_0x28fbf5){var _0x3d5c39=function(_0x1071b7){while(--_0x1071b7){_0x1927af['push'](_0x1927af['shift']());}};_0x3d5c39(++_0x28fbf5);}(_0x17c9,0xc0));var _0x917c=function(_0x599f41,_0x4db732){_0x599f41=_0x599f41-0x0;var _0x2e4d58=_0x17c9[_0x599f41];return _0x2e4d58;};'use strict';var _=require(_0x917c('0x0'));var util=require(_0x917c('0x1'));var zendesk=require(_0x917c('0x2'));var salesforce=require(_0x917c('0x3'));var sugarcrm=require(_0x917c('0x4'));var freshdesk=require('./freshdesk');var zoho=require('./zoho');var desk=require('./desk');var vtiger=require('./vtiger');var servicenow=require(_0x917c('0x5'));var dynamics365=require(_0x917c('0x6'));var freshsales=require('./freshsales');var integrations=[_0x917c('0x7'),_0x917c('0x8'),'sugarcrm',_0x917c('0x9'),_0x917c('0xa'),'desk',_0x917c('0xb'),'dynamics365','freshsales','servicenow'];exports[_0x917c('0xc')]=function(_0x337396,_0x359b23,_0x16fc2a,_0x4fe371,_0x501702,_0x1c0144){if(_0x16fc2a){if(_['includes'](integrations,_0x337396['data1'][_0x917c('0xd')]())){try{var _0x30cb2a=null;var _0x2ee628='';var _0x3b13d2=_0x16fc2a[_0x337396[_0x917c('0xe')][_0x917c('0xd')]()];if(_0x3b13d2){var _0x41b1fa=_0x3b13d2[_0x337396[_0x917c('0xf')]];if(_0x41b1fa){var _0x59234e=_[_0x917c('0x10')](_0x41b1fa[_0x917c('0x11')],{'id':parseInt(_0x337396[_0x917c('0x12')],0xa)});if(_0x59234e){if(_0x4fe371){if(_0x501702&&_0x359b23[_0x917c('0x13')]){_0x2ee628='queue';}else if(_0x359b23[_0x917c('0x14')]){_0x2ee628=_0x917c('0x15');}else{console[_0x917c('0x16')](_0x917c('0x17'),_0x359b23);}}else{_0x2ee628=_0x917c('0x18');}switch(_0x337396[_0x917c('0xe')][_0x917c('0xd')]()){case _0x917c('0x7'):zendesk[_0x2ee628](_0x337396,_0x359b23,_0x59234e,_0x4fe371,_0x501702,_0x41b1fa,_0x1c0144);break;case'salesforce':salesforce[_0x2ee628](_0x337396,_0x359b23,_0x59234e,_0x4fe371,_0x501702,_0x41b1fa,_0x1c0144);break;case _0x917c('0x19'):sugarcrm[_0x2ee628](_0x337396,_0x359b23,_0x59234e,_0x4fe371,_0x501702,_0x41b1fa,_0x1c0144);break;case _0x917c('0x9'):freshdesk[_0x2ee628](_0x337396,_0x359b23,_0x59234e,_0x4fe371,_0x501702,_0x41b1fa,_0x1c0144);break;case _0x917c('0xa'):zoho[_0x2ee628](_0x337396,_0x359b23,_0x59234e,_0x4fe371,_0x501702,_0x41b1fa,_0x1c0144);break;case _0x917c('0x1a'):desk[_0x2ee628](_0x337396,_0x359b23,_0x59234e,_0x4fe371,_0x501702,_0x41b1fa,_0x1c0144);break;case _0x917c('0xb'):vtiger[_0x2ee628](_0x337396,_0x359b23,_0x59234e,_0x4fe371,_0x501702,_0x41b1fa,_0x1c0144);break;case _0x917c('0x1b'):freshsales['cs'](_0x337396,_0x359b23,_0x59234e,_0x4fe371,_0x501702,_0x41b1fa,_0x1c0144,_0x2ee628);break;case _0x917c('0x1c'):servicenow['cs'](_0x337396,_0x359b23,_0x59234e,_0x4fe371,_0x501702,_0x41b1fa,_0x1c0144,_0x2ee628);break;case _0x917c('0x1d'):dynamics365['cs'](_0x337396,_0x359b23,_0x59234e,_0x4fe371,_0x501702,_0x41b1fa,_0x1c0144,_0x2ee628);break;default:console[_0x917c('0x16')](_0x917c('0x1e'));}}else{_0x30cb2a=require(_0x917c('0x1f'))(_0x337396[_0x917c('0xe')]['toLowerCase']());_0x30cb2a[_0x917c('0x20')](_0x917c('0x21'),util[_0x917c('0x22')]('%s\x20configuration\x20#%s\x20not\x20found',_0x337396[_0x917c('0xe')][_0x917c('0xd')](),_0x337396[_0x917c('0x12')]));}}else{_0x30cb2a=require(_0x917c('0x1f'))(_0x337396['data1'][_0x917c('0xd')]());_0x30cb2a[_0x917c('0x20')](_0x917c('0x21'),util[_0x917c('0x22')]('%s\x20account\x20#%s\x20not\x20found',_0x337396[_0x917c('0xe')][_0x917c('0xd')](),_0x337396[_0x917c('0xf')]));}}else{}}catch(_0x2c01d6){console['error'](_0x2c01d6);}}}}; \ 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 e7ba0af..2a4d0cd 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 _0xc775=['clientId','clientSecret','login','username','Connection\x20established.','queue','serverUrl','stripTrailingSlash','remoteUri','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','email','calleridname','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','%s/%s/e','error','[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','catch','recordingFormat','none','[OUTBOUND]','destcalleridname','outbound','[OUTBOUND]\x20Ticket\x20%s\x20created.','trigger:salesforce:display','Salesforce\x20account\x20type\x20not\x20recognized','unmanaged','lastevent','calleridnum','toUpperCase',']\x20Ticket\x20%s\x20created.',']\x20Integration\x20account\x20type\x20%s.','lodash','moment','md5','jsforce','util','./util','../../../../config/environment','../../../../config/logger','defaults','localhost','socket.io-emitter','emit','assign','Subjects','getString','Descriptions','ticketType','utc','IsReminderSet','IsRecurrence','endUserType','contact','lead','WhoId','WhatId','Case','ContactId','account','AccountId','leadId','info','Association\x20between\x20Case\x20and\x20Lead\x20skipped','sobject','create','isNil','validateEmail','User','execute','then','length','find','Agent\x20%s\x20found.','resolve','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','user_id','display_name','identity','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','moduleSearch','additionalSearchContact','merge','Contact','cloneDeep','additionalSearchLead','$or','Lead','account_contact_lead','additionalSearchAccount','Name','Phone','attributes','Enduser\x20(%s)\x20with\x20phone\x20%s\x20found','Enduser\x20with\x20phone\x20%s\x20not\x20found','moduleCreate','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','','format','Caller\x20-\x20%s','LastName','No\x20Company','includes','string','picklist','idField','content','toString','type','variableName','customVariable','Variable','name','toLowerCase','password','concat','securityToken'];(function(_0x478e79,_0x3d51de){var _0x38f3d7=function(_0x3625af){while(--_0x3625af){_0x478e79['push'](_0x478e79['shift']());}};_0x38f3d7(++_0x3d51de);}(_0xc775,0x128));var _0x5c77=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0xc775[_0x21a9d9];return _0x46adce;};'use strict';var _=require(_0x5c77('0x0'));var rp=require('request-promise');var moment=require(_0x5c77('0x1'));var BPromise=require('bluebird');var md5=require(_0x5c77('0x2'));var jsforce=require(_0x5c77('0x3'));var util=require(_0x5c77('0x4'));var Redis=require('ioredis');var intUtil=require(_0x5c77('0x5'));var config=require(_0x5c77('0x6'));var logger=require(_0x5c77('0x7'))('salesforce');config['redis']=_[_0x5c77('0x8')](config['redis'],{'host':_0x5c77('0x9'),'port':0x18eb});var io=require(_0x5c77('0xa'))(new Redis(config['redis']));function emit(_0x597679,_0x3fccd8,_0x35df40){io['to'](_0x597679)[_0x5c77('0xb')](_0x3fccd8,_0x35df40);}function getTicket(_0x202c91,_0x3de9e5,_0x146625,_0x520bdd,_0x45c315,_0x4a3108,_0x1bbc89,_0x4812c1){var _0x51eda0=Object[_0x5c77('0xc')]({},{'OwnerId':_0x3de9e5['id'],'Subject':intUtil['getString'](_0x520bdd[_0x5c77('0xd')],_0x45c315,'\x20'),'Description':intUtil[_0x5c77('0xe')](_0x520bdd[_0x5c77('0xf')],_0x45c315,'\x0a')},getCustomFields(_0x4a3108,_0x45c315));if(_0x146625){if(_0x520bdd[_0x5c77('0x10')]==='Task'){_0x51eda0['ActivityDate']=moment[_0x5c77('0x11')]();_0x51eda0[_0x5c77('0x12')]=![];_0x51eda0[_0x5c77('0x13')]=![];if(_0x146625[_0x5c77('0x14')]===_0x5c77('0x15')||_0x146625[_0x5c77('0x14')]===_0x5c77('0x16')){_0x51eda0[_0x5c77('0x17')]=_0x146625['id'];}else if(_0x146625[_0x5c77('0x14')]==='account'){_0x51eda0[_0x5c77('0x18')]=_0x146625['id'];}}else if(_0x520bdd[_0x5c77('0x10')]===_0x5c77('0x19')){if(_0x146625[_0x5c77('0x14')]==='contact'){_0x51eda0[_0x5c77('0x1a')]=_0x146625['id'];}else if(_0x146625[_0x5c77('0x14')]===_0x5c77('0x1b')){_0x51eda0[_0x5c77('0x1c')]=_0x146625['id'];}else if(_0x146625[_0x5c77('0x14')]===_0x5c77('0x16')&&_0x520bdd[_0x5c77('0x1d')]){_0x51eda0[_0x520bdd[_0x5c77('0x1d')]]=_0x146625['id'];}else{logger[_0x5c77('0x1e')](_0x5c77('0x1f'));}}}return _0x1bbc89[_0x5c77('0x20')](_0x520bdd['ticketType'])[_0x5c77('0x21')](_0x51eda0);}function getUser(_0x4e72c5,_0x3cdc94,_0x59ae2e){if(!_[_0x5c77('0x22')](_0x3cdc94)&&intUtil[_0x5c77('0x23')](_0x3cdc94)){var _0x41a1d5={'Email':_0x3cdc94};var _0x4b09b2={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x59ae2e[_0x5c77('0x20')](_0x5c77('0x24'))['find'](_0x41a1d5,_0x4b09b2)[_0x5c77('0x25')]()[_0x5c77('0x26')](function(_0x51102b){if(_0x51102b[_0x5c77('0x27')]){var _0x2d9980=_[_0x5c77('0x28')](_0x51102b,function(_0x21cca4){return _0x21cca4['Email']===_0x3cdc94;});if(_0x2d9980){logger['info'](_0x5c77('0x29'),_0x3cdc94);return BPromise[_0x5c77('0x2a')]({'id':_0x2d9980['Id'],'name':_0x2d9980['Name']});}}else{logger[_0x5c77('0x1e')](_0x5c77('0x2b'),_0x3cdc94);return _0x59ae2e['identity']()[_0x5c77('0x26')](function(_0x3b3ae4){return BPromise[_0x5c77('0x2a')]({'id':_0x3b3ae4[_0x5c77('0x2c')],'name':_0x3b3ae4[_0x5c77('0x2d')]});});}});}else{logger[_0x5c77('0x1e')]('Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.',_0x3cdc94);return _0x59ae2e[_0x5c77('0x2e')]()[_0x5c77('0x26')](function(_0x61f098){return BPromise[_0x5c77('0x2a')]({'id':_0x61f098['user_id'],'name':_0x61f098['display_name']});});}}function getEndUser(_0x289a0b,_0x510cc5,_0xf96a2d,_0x49acdf,_0x4e582a){var _0x19928a={'$or':{'Phone':_0x49acdf}};var _0x401060={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0x5c77('0x2a')]()[_0x5c77('0x26')](function(){logger[_0x5c77('0x1e')](_0x5c77('0x2f'),_0x49acdf,_0x510cc5[_0x5c77('0x30')]);switch(_0x510cc5[_0x5c77('0x30')]){case'contact_lead':var _0x586689=_['cloneDeep'](_0x19928a);if(_0x510cc5[_0x5c77('0x31')]){var _0x386afd={};_0x386afd[_0x510cc5['additionalSearchContact']]=_0x49acdf;_[_0x5c77('0x32')](_0x586689['$or'],_0x386afd);}return _0x4e582a[_0x5c77('0x20')](_0x5c77('0x33'))[_0x5c77('0x28')](_0x586689,_0x401060)['execute']()[_0x5c77('0x26')](function(_0x1ae049){if(_0x1ae049&&_0x1ae049[_0x5c77('0x27')]){return _0x1ae049;}else{var _0x33d21d=_[_0x5c77('0x34')](_0x19928a);if(_0x510cc5[_0x5c77('0x35')]){var _0x4b58ef={};_0x4b58ef[_0x510cc5[_0x5c77('0x35')]]=_0x49acdf;_[_0x5c77('0x32')](_0x33d21d[_0x5c77('0x36')],_0x4b58ef);}return _0x4e582a[_0x5c77('0x20')](_0x5c77('0x37'))[_0x5c77('0x28')](_0x33d21d,_0x401060);}});case _0x5c77('0x38'):var _0x2f439b=_[_0x5c77('0x34')](_0x19928a);if(_0x510cc5[_0x5c77('0x39')]){var _0x386afd={};_0x386afd[_0x510cc5[_0x5c77('0x39')]]=_0x49acdf;_[_0x5c77('0x32')](_0x2f439b[_0x5c77('0x36')],_0x386afd);}return _0x4e582a[_0x5c77('0x20')]('Account')[_0x5c77('0x28')](_0x2f439b,_0x401060)['execute']()[_0x5c77('0x26')](function(_0x90b38){if(_0x90b38&&_0x90b38[_0x5c77('0x27')]){return _0x90b38;}else{var _0x55efa9=_[_0x5c77('0x34')](_0x19928a);if(_0x510cc5[_0x5c77('0x31')]){var _0xeaa34c={};_0xeaa34c[_0x510cc5['additionalSearchContact']]=_0x49acdf;_[_0x5c77('0x32')](_0x55efa9['$or'],_0xeaa34c);}return _0x4e582a[_0x5c77('0x20')]('Contact')[_0x5c77('0x28')](_0x55efa9,_0x401060)['then'](function(_0x3407a5){if(_0x3407a5&&_0x3407a5['length']){return _0x3407a5;}else{var _0x5184a0=_[_0x5c77('0x34')](_0x19928a);if(_0x510cc5[_0x5c77('0x35')]){var _0x2c8e0e={};_0x2c8e0e[_0x510cc5[_0x5c77('0x35')]]=_0x49acdf;_[_0x5c77('0x32')](_0x5184a0[_0x5c77('0x36')],_0x2c8e0e);}return _0x4e582a['sobject'](_0x5c77('0x37'))[_0x5c77('0x28')](_0x5184a0,_0x401060);}});}});case _0x5c77('0x15'):var _0x586689=_[_0x5c77('0x34')](_0x19928a);if(_0x510cc5[_0x5c77('0x31')]){var _0x386afd={};_0x386afd[_0x510cc5['additionalSearchContact']]=_0x49acdf;_[_0x5c77('0x32')](_0x586689[_0x5c77('0x36')],_0x386afd);}return _0x4e582a['sobject'](_0x5c77('0x33'))[_0x5c77('0x28')](_0x586689,_0x401060)[_0x5c77('0x25')]();case _0x5c77('0x16'):var _0x156376=_[_0x5c77('0x34')](_0x19928a);if(_0x510cc5[_0x5c77('0x35')]){var _0x386afd={};_0x386afd[_0x510cc5[_0x5c77('0x35')]]=_0x49acdf;_[_0x5c77('0x32')](_0x156376[_0x5c77('0x36')],_0x386afd);}return _0x4e582a[_0x5c77('0x20')](_0x5c77('0x37'))[_0x5c77('0x28')](_0x156376,_0x401060);case _0x5c77('0x1b'):var _0x2f439b=_['cloneDeep'](_0x19928a);if(_0x510cc5['additionalSearchAccount']){var _0x386afd={};_0x386afd[_0x510cc5[_0x5c77('0x39')]]=_0x49acdf;_[_0x5c77('0x32')](_0x2f439b[_0x5c77('0x36')],_0x386afd);}return _0x4e582a[_0x5c77('0x20')]('Account')[_0x5c77('0x28')](_0x2f439b,_0x401060);default:return null;}})['then'](function(_0x40df00){if(_0x40df00&&_0x40df00[_0x5c77('0x27')]){var _0x5af7a5=_['first'](_0x40df00);if(_0x5af7a5){return BPromise[_0x5c77('0x2a')]({'id':_0x5af7a5['Id'],'name':_0x5af7a5[_0x5c77('0x3a')],'phone':_0x5af7a5[_0x5c77('0x3b')],'endUserType':_0x5af7a5[_0x5c77('0x3c')]['type']['toLowerCase']()});}}})[_0x5c77('0x26')](function(_0x29c424){if(_0x29c424){logger[_0x5c77('0x1e')](_0x5c77('0x3d'),_0x29c424[_0x5c77('0x14')],_0x49acdf);return BPromise['resolve'](_0x29c424);}else{logger[_0x5c77('0x1e')](_0x5c77('0x3e'),_0x49acdf);var _0x507dfc={'Phone':_0x49acdf};if(_0x510cc5[_0x5c77('0x3f')]){if(_0x510cc5[_0x5c77('0x3f')]===_0x5c77('0x15')){logger[_0x5c77('0x1e')](_0x5c77('0x40'),_0x49acdf,_0x510cc5[_0x5c77('0x3f')]);_0x507dfc['LastName']=_0xf96a2d!==_0x5c77('0x41')?_0xf96a2d:util[_0x5c77('0x42')](_0x5c77('0x43'),_0x49acdf);}else if(_0x510cc5[_0x5c77('0x3f')]===_0x5c77('0x16')){logger[_0x5c77('0x1e')](_0x5c77('0x40'),_0x49acdf,_0x510cc5['moduleCreate']);_0x507dfc[_0x5c77('0x44')]=_0xf96a2d!==''?_0xf96a2d:util[_0x5c77('0x42')](_0x5c77('0x43'),_0x49acdf);_0x507dfc['Company']=_0x5c77('0x45');}else if(_0x510cc5['moduleCreate']==='account'){logger[_0x5c77('0x1e')](_0x5c77('0x40'),_0x49acdf,_0x510cc5[_0x5c77('0x3f')]);_0x507dfc['Name']=_0xf96a2d!==''?_0xf96a2d:util[_0x5c77('0x42')](_0x5c77('0x43'),_0x49acdf);}else{return null;}}return _0x4e582a[_0x5c77('0x20')](_['upperFirst'](_0x510cc5[_0x5c77('0x3f')]))[_0x5c77('0x21')](_0x507dfc)[_0x5c77('0x26')](function(_0x10e348){return BPromise[_0x5c77('0x2a')]({'id':_0x10e348['id'],'endUserType':_0x510cc5[_0x5c77('0x3f')]});});}});}function getCustomFields(_0xf1c133,_0x304ce4){var _0x883beb={};if(_0xf1c133['length']>0x0){_['forEach'](_0xf1c133,function(_0x58e99a){if(_[_0x5c77('0x46')]([_0x5c77('0x47'),_0x5c77('0x48')],_0x58e99a['type'])&&_0x58e99a['idField']){_0x883beb[_0x58e99a[_0x5c77('0x49')]]=_0x58e99a[_0x5c77('0x4a')][_0x5c77('0x4b')]();}else if(_0x58e99a[_0x5c77('0x4c')]==='variable'&&_0x58e99a[_0x5c77('0x4d')]&&_0x58e99a[_0x5c77('0x49')]){_0x304ce4[_0x58e99a[_0x5c77('0x4d')]]&&(_0x883beb[_0x58e99a['idField']]=_0x304ce4[_0x58e99a[_0x5c77('0x4d')]][_0x5c77('0x4b')]());}else if(_0x58e99a[_0x5c77('0x4c')]===_0x5c77('0x4e')&&_0x58e99a[_0x5c77('0x4f')]&&_0x58e99a[_0x5c77('0x4f')][_0x5c77('0x50')]&&_0x58e99a[_0x5c77('0x49')]){_0x304ce4[_0x58e99a[_0x5c77('0x4f')][_0x5c77('0x50')][_0x5c77('0x51')]()]&&(_0x883beb[_0x58e99a['idField']]=_0x304ce4[_0x58e99a[_0x5c77('0x4f')][_0x5c77('0x50')]['toLowerCase']()][_0x5c77('0x4b')]());}});}return _0x883beb;}function getConnection(_0x48b060){var _0x22e738=_0x48b060[_0x5c77('0x52')][_0x5c77('0x53')](_0x48b060[_0x5c77('0x54')]);var _0xb34751=new jsforce['Connection']({'oauth2':{'loginUrl':_0x48b060['remoteUri']||'https://login.salesforce.com','clientId':_0x48b060[_0x5c77('0x55')],'clientSecret':_0x48b060[_0x5c77('0x56')]}});return _0xb34751[_0x5c77('0x57')](_0x48b060[_0x5c77('0x58')],_0x22e738)[_0x5c77('0x26')](function(){logger[_0x5c77('0x1e')](_0x5c77('0x59'));return _0xb34751;});}exports[_0x5c77('0x5a')]=function(_0x59e994,_0x232f09,_0xfdc741,_0x3c4c14,_0x2b68ac,_0x58bf04){var _0x2cc66c,_0x588ec1,_0x233d6c,_0x5e14e0;_0x58bf04[_0x5c77('0x5b')]=intUtil[_0x5c77('0x5c')](_0x58bf04['serverUrl']);_0x58bf04['remoteUri']=intUtil['stripTrailingSlash'](_0x58bf04[_0x5c77('0x5d')]);if(_0x2b68ac&&_0x2b68ac[_0x5c77('0x5e')]){logger[_0x5c77('0x1e')](_0x5c77('0x5f'),_0x5c77('0x60'));_0x232f09[_0x5c77('0x61')]=util[_0x5c77('0x42')](_0x5c77('0x62'),_0x58bf04[_0x5c77('0x5b')],_0x232f09['uniqueid'],md5(_0x232f09[_0x5c77('0x63')]));}else{_0x232f09[_0x5c77('0x61')]='';}return getConnection(_0x58bf04)[_0x5c77('0x26')](function(_0xfe818e){_0x5e14e0=_0xfe818e;return getUser(_0x58bf04,_0x3c4c14[_0x5c77('0x64')],_0x5e14e0);})['then'](function(_0x11ea8d){_0x2cc66c=_0x11ea8d;return getEndUser(_0x58bf04,_0xfdc741,_0x232f09[_0x5c77('0x65')],_0x232f09['calleridnum'],_0x5e14e0);})['then'](function(_0x1eecef){_0x588ec1=_0x1eecef;return getTicket(_0x58bf04,_0x2cc66c,_0x588ec1,_0xfdc741,_0x232f09,_0xfdc741[_0x5c77('0x66')],_0x5e14e0,'queue');})[_0x5c77('0x26')](function(_0x2b3125){_0x233d6c=_0x2b3125;logger[_0x5c77('0x1e')](_0x5c77('0x67'),_0x233d6c['id']);logger[_0x5c77('0x1e')](_0x5c77('0x68'),_0x233d6c['id'],_0x3c4c14[_0x5c77('0x50')],_0x58bf04[_0x5c77('0x4c')]);switch(_0x58bf04[_0x5c77('0x4c')]){case _0x5c77('0x69'):emit(util[_0x5c77('0x42')](_0x5c77('0x6a'),_0x3c4c14[_0x5c77('0x50')]),'trigger:salesforce:display',{'recordId':_0x233d6c['id']});break;case _0x5c77('0x6b'):emit(util[_0x5c77('0x42')](_0x5c77('0x6a'),_0x3c4c14[_0x5c77('0x50')]),_0x5c77('0x6c'),{'uri':util[_0x5c77('0x42')](_0x5c77('0x6d'),_0x5e14e0['instanceUrl'],_0x233d6c['id'])});break;default:logger[_0x5c77('0x6e')](_0x5c77('0x6f'));}})[_0x5c77('0x70')](function(_0x84d3dc){logger[_0x5c77('0x6e')](_0x5c77('0x5f'),_0x84d3dc);});};exports['outbound']=function(_0x5af2cb,_0x30efaa,_0x1943eb,_0x5e45e9,_0x511375,_0x13c44b,_0x245ba1){var _0x39dfc,_0x2089fa,_0xa109b4,_0x19d02d;_0x13c44b[_0x5c77('0x5b')]=intUtil['stripTrailingSlash'](_0x13c44b[_0x5c77('0x5b')]);_0x13c44b[_0x5c77('0x5d')]=intUtil[_0x5c77('0x5c')](_0x13c44b[_0x5c77('0x5d')]);if(_0x245ba1&&_0x245ba1[_0x5c77('0x71')]&&_0x245ba1[_0x5c77('0x71')]!==_0x5c77('0x72')){logger[_0x5c77('0x1e')](_0x5c77('0x73'),_0x5c77('0x60'));_0x30efaa['recordingURL']=util['format'](_0x5c77('0x62'),_0x13c44b['serverUrl'],_0x30efaa[_0x5c77('0x63')],md5(_0x30efaa[_0x5c77('0x63')]));}return getConnection(_0x13c44b)['then'](function(_0xea4b1){_0x19d02d=_0xea4b1;return getUser(_0x13c44b,_0x5e45e9['email'],_0x19d02d);})[_0x5c77('0x26')](function(_0x3436f0){_0x39dfc=_0x3436f0;return getEndUser(_0x13c44b,_0x1943eb,_0x30efaa[_0x5c77('0x74')],_0x30efaa['destcalleridnum'],_0x19d02d);})[_0x5c77('0x26')](function(_0x60f874){_0x2089fa=_0x60f874;return getTicket(_0x13c44b,_0x39dfc,_0x2089fa,_0x1943eb,_0x30efaa,_0x1943eb['Fields'],_0x19d02d,_0x5c77('0x75'));})[_0x5c77('0x26')](function(_0x312eb5){_0xa109b4=_0x312eb5;logger['info'](_0x5c77('0x76'),_0xa109b4['id']);logger[_0x5c77('0x1e')]('[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.',_0xa109b4['id'],_0x5e45e9[_0x5c77('0x50')],_0x13c44b['type']);switch(_0x13c44b[_0x5c77('0x4c')]){case _0x5c77('0x69'):emit(util['format']('user:%s',_0x5e45e9[_0x5c77('0x50')]),_0x5c77('0x77'),{'recordId':_0xa109b4['id']});break;case _0x5c77('0x6b'):emit(util['format']('user:%s',_0x5e45e9['name']),_0x5c77('0x6c'),{'uri':util[_0x5c77('0x42')](_0x5c77('0x6d'),_0x19d02d['instanceUrl'],_0xa109b4['id'])});break;default:logger[_0x5c77('0x6e')](_0x5c77('0x73'),_0x5c77('0x78'));}})['catch'](function(_0x3919d7){logger[_0x5c77('0x6e')](_0x5c77('0x73'),_0x3919d7);});};exports[_0x5c77('0x79')]=function(_0x5f1f73,_0x53ec58,_0x4a0e03,_0x25d6ee,_0x8b22aa,_0x20d91a){var _0x313503,_0xd91d40,_0x5c01ae,_0x12b5ca;_0x20d91a['serverUrl']=intUtil[_0x5c77('0x5c')](_0x20d91a['serverUrl']);_0x20d91a[_0x5c77('0x5d')]=intUtil[_0x5c77('0x5c')](_0x20d91a['remoteUri']);if(_0x8b22aa&&_0x8b22aa[_0x5c77('0x5e')]){logger['info']('['+_0x53ec58[_0x5c77('0x7a')]['toUpperCase']()+']',_0x5c77('0x60'));_0x53ec58[_0x5c77('0x61')]=util['format'](_0x5c77('0x62'),_0x20d91a[_0x5c77('0x5b')],_0x53ec58[_0x5c77('0x63')],md5(_0x53ec58['uniqueid']));}else{_0x53ec58[_0x5c77('0x61')]='';}return getConnection(_0x20d91a)['then'](function(_0x4f7b69){_0x12b5ca=_0x4f7b69;if(!_['isNil'](_0x25d6ee)){return getUser(_0x20d91a,_0x25d6ee[_0x5c77('0x50')],_0x12b5ca);}else{return getUser(_0x20d91a,null,_0x12b5ca);}})[_0x5c77('0x26')](function(_0x3e9b18){_0x313503=_0x3e9b18;return getEndUser(_0x20d91a,_0x4a0e03,_0x53ec58[_0x5c77('0x65')],_0x53ec58[_0x5c77('0x7b')],_0x12b5ca);})[_0x5c77('0x26')](function(_0x79fc9e){_0xd91d40=_0x79fc9e;return getTicket(_0x20d91a,_0x313503,_0xd91d40,_0x4a0e03,_0x53ec58,_0x4a0e03[_0x5c77('0x66')],_0x12b5ca);})['then'](function(_0x74ee2){_0x5c01ae=_0x74ee2;logger[_0x5c77('0x1e')]('['+_0x53ec58[_0x5c77('0x7a')][_0x5c77('0x7c')]()+_0x5c77('0x7d'),_0x5c01ae['id']);logger[_0x5c77('0x1e')]('['+_0x53ec58[_0x5c77('0x7a')][_0x5c77('0x7c')]()+_0x5c77('0x7e'),_0x20d91a['type']);})[_0x5c77('0x70')](function(_0x2e75bf){logger['error']('['+_0x53ec58['lastevent'][_0x5c77('0x7c')]()+']',_0x2e75bf);});}; \ No newline at end of file +var _0xf97b=['toLowerCase','Enduser\x20(%s)\x20with\x20phone\x20%s\x20found','Enduser\x20with\x20phone\x20%s\x20not\x20found','moduleCreate','LastName','','format','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','Caller\x20-\x20%s','No\x20Company','upperFirst','forEach','includes','picklist','idField','content','toString','variableName','customVariable','Variable','name','password','concat','securityToken','remoteUri','https://login.salesforce.com','clientId','clientSecret','username','Connection\x20established.','queue','stripTrailingSlash','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','email','calleridnum','Fields','[QUEUE]\x20Ticket\x20%s\x20created','integrationTab','newTab','user:%s','trigger:browser:url','instanceUrl','error','[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','catch','[QUEUE]','outbound','recordingFormat','none','destcalleridname','destcalleridnum','[OUTBOUND]\x20Ticket\x20%s\x20created.','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','trigger:salesforce:display','[OUTBOUND]','Salesforce\x20account\x20type\x20not\x20recognized','unmanaged','monitor_format','lastevent','toUpperCase','Recording\x20is\x20enabled!','calleridname',']\x20Ticket\x20%s\x20created.','request-promise','moment','bluebird','jsforce','../../../../config/environment','salesforce','redis','defaults','localhost','socket.io-emitter','emit','assign','getString','Subjects','Descriptions','Task','IsReminderSet','IsRecurrence','endUserType','lead','WhoId','account','ticketType','Case','contact','AccountId','leadId','info','Association\x20between\x20Case\x20and\x20Lead\x20skipped','sobject','create','isNil','User','find','then','length','Email','Agent\x20%s\x20found.','resolve','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','identity','user_id','display_name','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','moduleSearch','contact_lead','cloneDeep','additionalSearchContact','merge','execute','additionalSearchLead','$or','Lead','account_contact_lead','additionalSearchAccount','Contact','Account','Name','attributes','type'];(function(_0x16863e,_0x2b522d){var _0x37c914=function(_0x27b427){while(--_0x27b427){_0x16863e['push'](_0x16863e['shift']());}};_0x37c914(++_0x2b522d);}(_0xf97b,0x13e));var _0xbf97=function(_0x2be8c2,_0x14a4b5){_0x2be8c2=_0x2be8c2-0x0;var _0x97f531=_0xf97b[_0x2be8c2];return _0x97f531;};'use strict';var _=require('lodash');var rp=require(_0xbf97('0x0'));var moment=require(_0xbf97('0x1'));var BPromise=require(_0xbf97('0x2'));var md5=require('md5');var jsforce=require(_0xbf97('0x3'));var util=require('util');var Redis=require('ioredis');var intUtil=require('./util');var config=require(_0xbf97('0x4'));var logger=require('../../../../config/logger')(_0xbf97('0x5'));config[_0xbf97('0x6')]=_[_0xbf97('0x7')](config[_0xbf97('0x6')],{'host':_0xbf97('0x8'),'port':0x18eb});var io=require(_0xbf97('0x9'))(new Redis(config[_0xbf97('0x6')]));function emit(_0x2d8e93,_0x50c08b,_0x387c8f){io['to'](_0x2d8e93)[_0xbf97('0xa')](_0x50c08b,_0x387c8f);}function getTicket(_0x188766,_0x4617a7,_0x33a4aa,_0x3320a7,_0x15f5b4,_0x19e277,_0x74ed98,_0x46fa63){var _0x34b1c8=Object[_0xbf97('0xb')]({},{'OwnerId':_0x4617a7['id'],'Subject':intUtil[_0xbf97('0xc')](_0x3320a7[_0xbf97('0xd')],_0x15f5b4,'\x20'),'Description':intUtil['getString'](_0x3320a7[_0xbf97('0xe')],_0x15f5b4,'\x0a')},getCustomFields(_0x19e277,_0x15f5b4));if(_0x33a4aa){if(_0x3320a7['ticketType']===_0xbf97('0xf')){_0x34b1c8['ActivityDate']=moment['utc']();_0x34b1c8[_0xbf97('0x10')]=![];_0x34b1c8[_0xbf97('0x11')]=![];if(_0x33a4aa[_0xbf97('0x12')]==='contact'||_0x33a4aa[_0xbf97('0x12')]===_0xbf97('0x13')){_0x34b1c8[_0xbf97('0x14')]=_0x33a4aa['id'];}else if(_0x33a4aa[_0xbf97('0x12')]===_0xbf97('0x15')){_0x34b1c8['WhatId']=_0x33a4aa['id'];}}else if(_0x3320a7[_0xbf97('0x16')]===_0xbf97('0x17')){if(_0x33a4aa[_0xbf97('0x12')]===_0xbf97('0x18')){_0x34b1c8['ContactId']=_0x33a4aa['id'];}else if(_0x33a4aa[_0xbf97('0x12')]===_0xbf97('0x15')){_0x34b1c8[_0xbf97('0x19')]=_0x33a4aa['id'];}else if(_0x33a4aa['endUserType']===_0xbf97('0x13')&&_0x3320a7[_0xbf97('0x1a')]){_0x34b1c8[_0x3320a7[_0xbf97('0x1a')]]=_0x33a4aa['id'];}else{logger[_0xbf97('0x1b')](_0xbf97('0x1c'));}}}return _0x74ed98[_0xbf97('0x1d')](_0x3320a7['ticketType'])[_0xbf97('0x1e')](_0x34b1c8);}function getUser(_0x3f3d87,_0x4d7631,_0x526ffc){if(!_[_0xbf97('0x1f')](_0x4d7631)&&intUtil['validateEmail'](_0x4d7631)){var _0x35b56e={'Email':_0x4d7631};var _0x2deab3={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x526ffc['sobject'](_0xbf97('0x20'))[_0xbf97('0x21')](_0x35b56e,_0x2deab3)['execute']()[_0xbf97('0x22')](function(_0x4a0f15){if(_0x4a0f15[_0xbf97('0x23')]){var _0x45f574=_[_0xbf97('0x21')](_0x4a0f15,function(_0x465c86){return _0x465c86[_0xbf97('0x24')]===_0x4d7631;});if(_0x45f574){logger['info'](_0xbf97('0x25'),_0x4d7631);return BPromise[_0xbf97('0x26')]({'id':_0x45f574['Id'],'name':_0x45f574['Name']});}}else{logger[_0xbf97('0x1b')](_0xbf97('0x27'),_0x4d7631);return _0x526ffc[_0xbf97('0x28')]()[_0xbf97('0x22')](function(_0x43dd3f){return BPromise[_0xbf97('0x26')]({'id':_0x43dd3f[_0xbf97('0x29')],'name':_0x43dd3f[_0xbf97('0x2a')]});});}});}else{logger['info']('Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.',_0x4d7631);return _0x526ffc[_0xbf97('0x28')]()[_0xbf97('0x22')](function(_0x68b53f){return BPromise[_0xbf97('0x26')]({'id':_0x68b53f[_0xbf97('0x29')],'name':_0x68b53f['display_name']});});}}function getEndUser(_0xae6067,_0x4f3193,_0x8b8376,_0x321456,_0x144610){var _0x3aaa26={'$or':{'Phone':_0x321456}};var _0x3e487b={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0xbf97('0x26')]()['then'](function(){logger[_0xbf97('0x1b')](_0xbf97('0x2b'),_0x321456,_0x4f3193[_0xbf97('0x2c')]);switch(_0x4f3193[_0xbf97('0x2c')]){case _0xbf97('0x2d'):var _0x1bfd9e=_[_0xbf97('0x2e')](_0x3aaa26);if(_0x4f3193[_0xbf97('0x2f')]){var _0x3e2f1c={};_0x3e2f1c[_0x4f3193['additionalSearchContact']]=_0x321456;_[_0xbf97('0x30')](_0x1bfd9e['$or'],_0x3e2f1c);}return _0x144610['sobject']('Contact')['find'](_0x1bfd9e,_0x3e487b)[_0xbf97('0x31')]()['then'](function(_0x26d727){if(_0x26d727&&_0x26d727['length']){return _0x26d727;}else{var _0x1baacb=_['cloneDeep'](_0x3aaa26);if(_0x4f3193[_0xbf97('0x32')]){var _0xe77bee={};_0xe77bee[_0x4f3193['additionalSearchLead']]=_0x321456;_[_0xbf97('0x30')](_0x1baacb[_0xbf97('0x33')],_0xe77bee);}return _0x144610['sobject'](_0xbf97('0x34'))['find'](_0x1baacb,_0x3e487b);}});case _0xbf97('0x35'):var _0x26b01c=_[_0xbf97('0x2e')](_0x3aaa26);if(_0x4f3193[_0xbf97('0x36')]){var _0x3e2f1c={};_0x3e2f1c[_0x4f3193[_0xbf97('0x36')]]=_0x321456;_[_0xbf97('0x30')](_0x26b01c[_0xbf97('0x33')],_0x3e2f1c);}return _0x144610[_0xbf97('0x1d')]('Account')[_0xbf97('0x21')](_0x26b01c,_0x3e487b)[_0xbf97('0x31')]()[_0xbf97('0x22')](function(_0x1a0af4){if(_0x1a0af4&&_0x1a0af4[_0xbf97('0x23')]){return _0x1a0af4;}else{var _0x2a1786=_['cloneDeep'](_0x3aaa26);if(_0x4f3193['additionalSearchContact']){var _0x3cf0ce={};_0x3cf0ce[_0x4f3193[_0xbf97('0x2f')]]=_0x321456;_[_0xbf97('0x30')](_0x2a1786[_0xbf97('0x33')],_0x3cf0ce);}return _0x144610[_0xbf97('0x1d')](_0xbf97('0x37'))[_0xbf97('0x21')](_0x2a1786,_0x3e487b)[_0xbf97('0x22')](function(_0x35ce42){if(_0x35ce42&&_0x35ce42[_0xbf97('0x23')]){return _0x35ce42;}else{var _0x56d22f=_[_0xbf97('0x2e')](_0x3aaa26);if(_0x4f3193['additionalSearchLead']){var _0x20de46={};_0x20de46[_0x4f3193[_0xbf97('0x32')]]=_0x321456;_[_0xbf97('0x30')](_0x56d22f[_0xbf97('0x33')],_0x20de46);}return _0x144610['sobject']('Lead')[_0xbf97('0x21')](_0x56d22f,_0x3e487b);}});}});case _0xbf97('0x18'):var _0x1bfd9e=_[_0xbf97('0x2e')](_0x3aaa26);if(_0x4f3193[_0xbf97('0x2f')]){var _0x3e2f1c={};_0x3e2f1c[_0x4f3193['additionalSearchContact']]=_0x321456;_[_0xbf97('0x30')](_0x1bfd9e['$or'],_0x3e2f1c);}return _0x144610[_0xbf97('0x1d')]('Contact')[_0xbf97('0x21')](_0x1bfd9e,_0x3e487b)[_0xbf97('0x31')]();case'lead':var _0x3daac3=_[_0xbf97('0x2e')](_0x3aaa26);if(_0x4f3193[_0xbf97('0x32')]){var _0x3e2f1c={};_0x3e2f1c[_0x4f3193[_0xbf97('0x32')]]=_0x321456;_['merge'](_0x3daac3[_0xbf97('0x33')],_0x3e2f1c);}return _0x144610[_0xbf97('0x1d')](_0xbf97('0x34'))[_0xbf97('0x21')](_0x3daac3,_0x3e487b);case _0xbf97('0x15'):var _0x26b01c=_['cloneDeep'](_0x3aaa26);if(_0x4f3193['additionalSearchAccount']){var _0x3e2f1c={};_0x3e2f1c[_0x4f3193[_0xbf97('0x36')]]=_0x321456;_[_0xbf97('0x30')](_0x26b01c['$or'],_0x3e2f1c);}return _0x144610[_0xbf97('0x1d')](_0xbf97('0x38'))[_0xbf97('0x21')](_0x26b01c,_0x3e487b);default:return null;}})[_0xbf97('0x22')](function(_0xea2530){if(_0xea2530&&_0xea2530[_0xbf97('0x23')]){var _0x1ddfbc=_['first'](_0xea2530);if(_0x1ddfbc){return BPromise[_0xbf97('0x26')]({'id':_0x1ddfbc['Id'],'name':_0x1ddfbc[_0xbf97('0x39')],'phone':_0x1ddfbc['Phone'],'endUserType':_0x1ddfbc[_0xbf97('0x3a')][_0xbf97('0x3b')][_0xbf97('0x3c')]()});}}})[_0xbf97('0x22')](function(_0x376d92){if(_0x376d92){logger[_0xbf97('0x1b')](_0xbf97('0x3d'),_0x376d92[_0xbf97('0x12')],_0x321456);return BPromise[_0xbf97('0x26')](_0x376d92);}else{logger[_0xbf97('0x1b')](_0xbf97('0x3e'),_0x321456);var _0x4cd6b6={'Phone':_0x321456};if(_0x4f3193[_0xbf97('0x3f')]){if(_0x4f3193['moduleCreate']===_0xbf97('0x18')){logger[_0xbf97('0x1b')]('Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.',_0x321456,_0x4f3193[_0xbf97('0x3f')]);_0x4cd6b6[_0xbf97('0x40')]=_0x8b8376!==_0xbf97('0x41')?_0x8b8376:util[_0xbf97('0x42')]('Caller\x20-\x20%s',_0x321456);}else if(_0x4f3193['moduleCreate']==='lead'){logger['info'](_0xbf97('0x43'),_0x321456,_0x4f3193[_0xbf97('0x3f')]);_0x4cd6b6[_0xbf97('0x40')]=_0x8b8376!==_0xbf97('0x41')?_0x8b8376:util[_0xbf97('0x42')](_0xbf97('0x44'),_0x321456);_0x4cd6b6['Company']=_0xbf97('0x45');}else if(_0x4f3193[_0xbf97('0x3f')]==='account'){logger[_0xbf97('0x1b')](_0xbf97('0x43'),_0x321456,_0x4f3193[_0xbf97('0x3f')]);_0x4cd6b6[_0xbf97('0x39')]=_0x8b8376!==_0xbf97('0x41')?_0x8b8376:util[_0xbf97('0x42')]('Caller\x20-\x20%s',_0x321456);}else{return null;}}return _0x144610[_0xbf97('0x1d')](_[_0xbf97('0x46')](_0x4f3193[_0xbf97('0x3f')]))[_0xbf97('0x1e')](_0x4cd6b6)[_0xbf97('0x22')](function(_0x49dc1c){return BPromise[_0xbf97('0x26')]({'id':_0x49dc1c['id'],'endUserType':_0x4f3193[_0xbf97('0x3f')]});});}});}function getCustomFields(_0x127573,_0x3b9253){var _0x542628={};if(_0x127573[_0xbf97('0x23')]>0x0){_[_0xbf97('0x47')](_0x127573,function(_0x4fc21a){if(_[_0xbf97('0x48')](['string',_0xbf97('0x49')],_0x4fc21a[_0xbf97('0x3b')])&&_0x4fc21a[_0xbf97('0x4a')]){_0x542628[_0x4fc21a[_0xbf97('0x4a')]]=_0x4fc21a[_0xbf97('0x4b')][_0xbf97('0x4c')]();}else if(_0x4fc21a['type']==='variable'&&_0x4fc21a[_0xbf97('0x4d')]&&_0x4fc21a[_0xbf97('0x4a')]){_0x3b9253[_0x4fc21a[_0xbf97('0x4d')]]&&(_0x542628[_0x4fc21a[_0xbf97('0x4a')]]=_0x3b9253[_0x4fc21a['variableName']][_0xbf97('0x4c')]());}else if(_0x4fc21a[_0xbf97('0x3b')]===_0xbf97('0x4e')&&_0x4fc21a[_0xbf97('0x4f')]&&_0x4fc21a[_0xbf97('0x4f')][_0xbf97('0x50')]&&_0x4fc21a[_0xbf97('0x4a')]){_0x3b9253[_0x4fc21a[_0xbf97('0x4f')][_0xbf97('0x50')]['toLowerCase']()]&&(_0x542628[_0x4fc21a[_0xbf97('0x4a')]]=_0x3b9253[_0x4fc21a['Variable'][_0xbf97('0x50')]['toLowerCase']()][_0xbf97('0x4c')]());}});}return _0x542628;}function getConnection(_0x4bafb1){var _0xc8bfb3=_0x4bafb1[_0xbf97('0x51')][_0xbf97('0x52')](_0x4bafb1[_0xbf97('0x53')]);var _0x42b583=new jsforce['Connection']({'oauth2':{'loginUrl':_0x4bafb1[_0xbf97('0x54')]||_0xbf97('0x55'),'clientId':_0x4bafb1[_0xbf97('0x56')],'clientSecret':_0x4bafb1[_0xbf97('0x57')]}});return _0x42b583['login'](_0x4bafb1[_0xbf97('0x58')],_0xc8bfb3)['then'](function(){logger[_0xbf97('0x1b')](_0xbf97('0x59'));return _0x42b583;});}exports[_0xbf97('0x5a')]=function(_0x40b32b,_0x3d5f1c,_0x4360d6,_0x3214d3,_0x1cb6fb,_0x2bce2a){var _0x5559d2,_0x2fda6d,_0x4769f9,_0x42cbf2;_0x2bce2a['serverUrl']=intUtil[_0xbf97('0x5b')](_0x2bce2a['serverUrl']);_0x2bce2a['remoteUri']=intUtil[_0xbf97('0x5b')](_0x2bce2a[_0xbf97('0x54')]);if(_0x1cb6fb&&_0x1cb6fb['monitor_format']){logger[_0xbf97('0x1b')]('[QUEUE]','Recording\x20is\x20enabled!');_0x3d5f1c[_0xbf97('0x5c')]=util[_0xbf97('0x42')](_0xbf97('0x5d'),_0x2bce2a[_0xbf97('0x5e')],_0x3d5f1c[_0xbf97('0x5f')],md5(_0x3d5f1c['uniqueid']));}else{_0x3d5f1c[_0xbf97('0x5c')]='';}return getConnection(_0x2bce2a)[_0xbf97('0x22')](function(_0x34448c){_0x42cbf2=_0x34448c;return getUser(_0x2bce2a,_0x3214d3[_0xbf97('0x60')],_0x42cbf2);})[_0xbf97('0x22')](function(_0x3f3f77){_0x5559d2=_0x3f3f77;return getEndUser(_0x2bce2a,_0x4360d6,_0x3d5f1c['calleridname'],_0x3d5f1c[_0xbf97('0x61')],_0x42cbf2);})[_0xbf97('0x22')](function(_0x4ac01e){_0x2fda6d=_0x4ac01e;return getTicket(_0x2bce2a,_0x5559d2,_0x2fda6d,_0x4360d6,_0x3d5f1c,_0x4360d6[_0xbf97('0x62')],_0x42cbf2,_0xbf97('0x5a'));})[_0xbf97('0x22')](function(_0xfb636b){_0x4769f9=_0xfb636b;logger['info'](_0xbf97('0x63'),_0x4769f9['id']);logger['info']('[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.',_0x4769f9['id'],_0x3214d3[_0xbf97('0x50')],_0x2bce2a[_0xbf97('0x3b')]);switch(_0x2bce2a['type']){case _0xbf97('0x64'):emit(util[_0xbf97('0x42')]('user:%s',_0x3214d3[_0xbf97('0x50')]),'trigger:salesforce:display',{'recordId':_0x4769f9['id']});break;case _0xbf97('0x65'):emit(util['format'](_0xbf97('0x66'),_0x3214d3[_0xbf97('0x50')]),_0xbf97('0x67'),{'uri':util['format']('%s/%s/e',_0x42cbf2[_0xbf97('0x68')],_0x4769f9['id'])});break;default:logger[_0xbf97('0x69')](_0xbf97('0x6a'));}})[_0xbf97('0x6b')](function(_0x40ab3c){logger[_0xbf97('0x69')](_0xbf97('0x6c'),_0x40ab3c);});};exports[_0xbf97('0x6d')]=function(_0x145e90,_0x52a00b,_0x56368d,_0x44178c,_0x1bc6ee,_0x126056,_0x10d8c8){var _0x505790,_0x58eef8,_0x5a10af,_0x55aa17;_0x126056[_0xbf97('0x5e')]=intUtil[_0xbf97('0x5b')](_0x126056[_0xbf97('0x5e')]);_0x126056[_0xbf97('0x54')]=intUtil['stripTrailingSlash'](_0x126056[_0xbf97('0x54')]);if(_0x10d8c8&&_0x10d8c8['recordingFormat']&&_0x10d8c8[_0xbf97('0x6e')]!==_0xbf97('0x6f')){logger[_0xbf97('0x1b')]('[OUTBOUND]','Recording\x20is\x20enabled!');_0x52a00b[_0xbf97('0x5c')]=util[_0xbf97('0x42')](_0xbf97('0x5d'),_0x126056['serverUrl'],_0x52a00b[_0xbf97('0x5f')],md5(_0x52a00b[_0xbf97('0x5f')]));}return getConnection(_0x126056)[_0xbf97('0x22')](function(_0x46e2e2){_0x55aa17=_0x46e2e2;return getUser(_0x126056,_0x44178c[_0xbf97('0x60')],_0x55aa17);})['then'](function(_0x6dc744){_0x505790=_0x6dc744;return getEndUser(_0x126056,_0x56368d,_0x52a00b[_0xbf97('0x70')],_0x52a00b[_0xbf97('0x71')],_0x55aa17);})[_0xbf97('0x22')](function(_0x2e37b1){_0x58eef8=_0x2e37b1;return getTicket(_0x126056,_0x505790,_0x58eef8,_0x56368d,_0x52a00b,_0x56368d[_0xbf97('0x62')],_0x55aa17,_0xbf97('0x6d'));})['then'](function(_0x2c3823){_0x5a10af=_0x2c3823;logger[_0xbf97('0x1b')](_0xbf97('0x72'),_0x5a10af['id']);logger[_0xbf97('0x1b')](_0xbf97('0x73'),_0x5a10af['id'],_0x44178c[_0xbf97('0x50')],_0x126056['type']);switch(_0x126056['type']){case _0xbf97('0x64'):emit(util[_0xbf97('0x42')](_0xbf97('0x66'),_0x44178c[_0xbf97('0x50')]),_0xbf97('0x74'),{'recordId':_0x5a10af['id']});break;case _0xbf97('0x65'):emit(util['format'](_0xbf97('0x66'),_0x44178c[_0xbf97('0x50')]),_0xbf97('0x67'),{'uri':util[_0xbf97('0x42')]('%s/%s/e',_0x55aa17[_0xbf97('0x68')],_0x5a10af['id'])});break;default:logger[_0xbf97('0x69')](_0xbf97('0x75'),_0xbf97('0x76'));}})[_0xbf97('0x6b')](function(_0x3d3b29){logger[_0xbf97('0x69')](_0xbf97('0x75'),_0x3d3b29);});};exports[_0xbf97('0x77')]=function(_0x3f7d82,_0x200df6,_0x4e0fc0,_0xd254a3,_0x131eac,_0x10b544){var _0x1e15b5,_0x10a6ba,_0x2df506,_0x3b3848;_0x10b544[_0xbf97('0x5e')]=intUtil['stripTrailingSlash'](_0x10b544[_0xbf97('0x5e')]);_0x10b544['remoteUri']=intUtil[_0xbf97('0x5b')](_0x10b544[_0xbf97('0x54')]);if(_0x131eac&&_0x131eac[_0xbf97('0x78')]){logger[_0xbf97('0x1b')]('['+_0x200df6[_0xbf97('0x79')][_0xbf97('0x7a')]()+']',_0xbf97('0x7b'));_0x200df6[_0xbf97('0x5c')]=util['format'](_0xbf97('0x5d'),_0x10b544['serverUrl'],_0x200df6[_0xbf97('0x5f')],md5(_0x200df6[_0xbf97('0x5f')]));}else{_0x200df6['recordingURL']='';}return getConnection(_0x10b544)[_0xbf97('0x22')](function(_0x297235){_0x3b3848=_0x297235;if(!_['isNil'](_0xd254a3)){return getUser(_0x10b544,_0xd254a3['name'],_0x3b3848);}else{return getUser(_0x10b544,null,_0x3b3848);}})[_0xbf97('0x22')](function(_0x349bae){_0x1e15b5=_0x349bae;return getEndUser(_0x10b544,_0x4e0fc0,_0x200df6[_0xbf97('0x7c')],_0x200df6[_0xbf97('0x61')],_0x3b3848);})[_0xbf97('0x22')](function(_0x54508a){_0x10a6ba=_0x54508a;return getTicket(_0x10b544,_0x1e15b5,_0x10a6ba,_0x4e0fc0,_0x200df6,_0x4e0fc0[_0xbf97('0x62')],_0x3b3848);})[_0xbf97('0x22')](function(_0x3cf609){_0x2df506=_0x3cf609;logger['info']('['+_0x200df6[_0xbf97('0x79')][_0xbf97('0x7a')]()+_0xbf97('0x7d'),_0x2df506['id']);logger[_0xbf97('0x1b')]('['+_0x200df6['lastevent']['toUpperCase']()+']\x20Integration\x20account\x20type\x20%s.',_0x10b544[_0xbf97('0x3b')]);})[_0xbf97('0x6b')](function(_0x28d6e0){logger[_0xbf97('0x69')]('['+_0x200df6[_0xbf97('0x79')][_0xbf97('0x7a')]()+']',_0x28d6e0);});}; \ 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 7e506bf..c0cb612 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 _0xfc15=[']\x20getTicket\x20crm','label','label_entry','Incident\x20-\x20','push','all','Tags','map','%26sysparm_record_target%3Dincident','%255EORDERBYDESCnumber','/nav_to.do?uri=incident.do?sys_id%3D','format','user:%s','trigger:browser:url','username','password','sysparm_limit=1','remoteUri','stripTrailingSlash','serverUrl','isNil','email','destcalleridnum','calleridnum','callDirection','queue','unmanaged','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','The\x20ticket\x20ID\x20is:\x20%s','call\x20direction:\x20%s',']\x20Error\x20running\x20ServiceNow\x20integration','inspect','lodash','request-promise','util','./util','../../../../config/environment','../../../../config/logger','servicenow','defaults','localhost','socket.io-emitter','redis','GET','sys_user?sysparm_query=user_name%3Dadmin','length','adminId','sys_id','info','],\x20getAdminUser\x20crm','catch','error','message','userEmail','sys_user?sysparm_query=email%3D','toUpperCase','],\x20getUser\x20rp\x20obj','then','],\x20getUser\x20entity','result','active','true','userId','adminEmail','],\x20getUser\x20crm',']\x20using\x20admin\x20profile','POST','sys_user?','endUserNumber','],\x20EndUser\x20schema','endUserId','],\x20getEndUser\x20input\x20crm','],\x20getEndUser\x20crm','],\x20createEndUser\x20crm','forEach','includes','string','picklist','type','nameField','customField','toLowerCase','idField','toString','variableName','Variable','name',']\x20getTicket\x20input\x20crm','outbound','incident','getString','Subjects','Descriptions',']\x20POST\x20incident\x20entity\x20schema','ticketId'];(function(_0xa1e3e3,_0x29fe0e){var _0xc980e9=function(_0x1f5adc){while(--_0x1f5adc){_0xa1e3e3['push'](_0xa1e3e3['shift']());}};_0xc980e9(++_0x29fe0e);}(_0xfc15,0xf3));var _0x5fc1=function(_0x24f31b,_0x44b8f3){_0x24f31b=_0x24f31b-0x0;var _0x488401=_0xfc15[_0x24f31b];return _0x488401;};'use strict';var _=require(_0x5fc1('0x0'));var Promise=require('bluebird');var rp=require(_0x5fc1('0x1'));var util=require(_0x5fc1('0x2'));var md5=require('md5');var Redis=require('ioredis');var intUtil=require(_0x5fc1('0x3'));var config=require(_0x5fc1('0x4'));var logger=require(_0x5fc1('0x5'))(_0x5fc1('0x6'));config['redis']=_[_0x5fc1('0x7')](config['redis'],{'host':_0x5fc1('0x8'),'port':0x18eb});var io=require(_0x5fc1('0x9'))(new Redis(config[_0x5fc1('0xa')]));function getAdminUser(_0x488fe0,_0x5b1254,_0x2b025c,_0x2fcfd4,_0x2124cb,_0x18c65d){return new Promise(function(_0xa853fb,_0x2038ab){var _0xc16571={'method':_0x5fc1('0xb'),'uri':_0x2fcfd4+_0x5fc1('0xc')+'&'+_0x2124cb+'&'+_0x18c65d,'auth':_0x5b1254,'json':!![]};return rp(_0xc16571)['then'](function(_0x5e8064){if(_0x5e8064['result'][_0x5fc1('0xd')]>0x0){_0x2b025c[_0x5fc1('0xe')]=_0x5e8064['result'][0x0][_0x5fc1('0xf')];}logger[_0x5fc1('0x10')]('['+[_0x488fe0['toUpperCase']()]+_0x5fc1('0x11'),_0x2b025c);_0xa853fb(_0x2b025c);})[_0x5fc1('0x12')](function(_0x340f37){logger[_0x5fc1('0x13')]('['+[_0x488fe0['toUpperCase']()]+']',_0x340f37['message']);_0x2038ab(_0x340f37[_0x5fc1('0x14')]);});});}function getUser(_0xdda755,_0x2e5c4d,_0xf8a7df,_0x1e5ca6,_0x28b2d0){return function(_0x43f9c5){logger[_0x5fc1('0x10')]('['+[_0xdda755['toUpperCase']()]+'],\x20getUser\x20input\x20crm',_0x43f9c5);return new Promise(function(_0x5573b9,_0x224c10){if(intUtil['validateEmail'](_0x43f9c5[_0x5fc1('0x15')])){var _0x2d7aa0={'method':'GET','uri':_0xf8a7df+_0x5fc1('0x16')+_0x43f9c5[_0x5fc1('0x15')]+'&'+_0x1e5ca6+'&'+_0x28b2d0,'auth':_0x2e5c4d,'json':!![]};logger['info']('['+[_0xdda755[_0x5fc1('0x17')]()]+_0x5fc1('0x18'),_0x2d7aa0);return rp(_0x2d7aa0)[_0x5fc1('0x19')](function(_0x1e8d5c){logger[_0x5fc1('0x10')]('['+[_0xdda755[_0x5fc1('0x17')]()]+_0x5fc1('0x1a'),_0x1e8d5c);if(_0x1e8d5c['result'][_0x5fc1('0xd')]>0x0&&String(_0x1e8d5c[_0x5fc1('0x1b')][0x0][_0x5fc1('0x1c')])===_0x5fc1('0x1d')){_0x43f9c5[_0x5fc1('0x1e')]=_0x1e8d5c[_0x5fc1('0x1b')][0x0][_0x5fc1('0xf')];}else{_0x43f9c5[_0x5fc1('0x1e')]=_0x43f9c5[_0x5fc1('0xe')];_0x43f9c5[_0x5fc1('0x15')]=_0x43f9c5[_0x5fc1('0x1f')];}logger[_0x5fc1('0x10')]('['+[_0xdda755[_0x5fc1('0x17')]()]+_0x5fc1('0x20'),_0x43f9c5);_0x5573b9(_0x43f9c5);})[_0x5fc1('0x12')](function(_0x3ef126){logger['error']('['+[_0xdda755['toUpperCase']()]+']',_0x3ef126[_0x5fc1('0x14')]);_0x224c10(_0x3ef126[_0x5fc1('0x14')]);});}else{logger[_0x5fc1('0x10')]('['+[_0xdda755[_0x5fc1('0x17')]()]+_0x5fc1('0x21'));_0x43f9c5[_0x5fc1('0x1e')]=_0x43f9c5[_0x5fc1('0xe')];_0x43f9c5[_0x5fc1('0x15')]=_0x43f9c5[_0x5fc1('0x1f')];_0x5573b9(_0x43f9c5);}});};}function createEndUser(_0x1092dd,_0x2e50f6,_0x10de1a,_0x310541,_0x3fd3e1){logger[_0x5fc1('0x10')]('['+[_0x1092dd[_0x5fc1('0x17')]()]+'],\x20createEndUser\x20input\x20crm',_0x10de1a);return new Promise(function(_0x423636,_0x168a2a){var _0x4e16ac={'method':_0x5fc1('0x22'),'uri':_0x310541+_0x5fc1('0x23')+_0x3fd3e1,'body':{'user_name':_0x10de1a[_0x5fc1('0x24')],'roles':'user','first_name':_0x10de1a['endUserNumber'],'active':_0x5fc1('0x1d'),'date_format':'System','phone':_0x10de1a[_0x5fc1('0x24')]},'auth':_0x2e50f6,'json':!![]};return rp(_0x4e16ac)[_0x5fc1('0x19')](function(_0x2e83ae){logger[_0x5fc1('0x10')]('['+[_0x1092dd['toUpperCase']()]+_0x5fc1('0x25'),_0x2e83ae[_0x5fc1('0x1b')]);_0x10de1a[_0x5fc1('0x26')]=_0x2e83ae['result'][_0x5fc1('0xf')];_0x423636(_0x10de1a);})[_0x5fc1('0x12')](function(_0x506f7c){logger[_0x5fc1('0x13')]('['+[_0x1092dd[_0x5fc1('0x17')]()]+']',_0x506f7c[_0x5fc1('0x14')]);_0x168a2a(_0x506f7c[_0x5fc1('0x14')]);});});}function getEndUser(_0x4fd804,_0x2b844b,_0x425c88,_0x58c0a9,_0x3c552f){return function(_0x467006){logger[_0x5fc1('0x10')]('['+[_0x4fd804[_0x5fc1('0x17')]()]+_0x5fc1('0x27'),_0x467006);return new Promise(function(_0x2e77f0,_0x105b5c){var _0x1fd75={'method':_0x5fc1('0xb'),'uri':_0x425c88+'sys_user?sysparm_query=phone%3D'+_0x467006[_0x5fc1('0x24')]+'&'+_0x58c0a9+'&'+_0x3c552f,'auth':_0x2b844b,'json':!![]};return rp(_0x1fd75)[_0x5fc1('0x19')](function(_0x1c2ce6){if(_0x1c2ce6[_0x5fc1('0x1b')][_0x5fc1('0xd')]>0x0){_0x467006[_0x5fc1('0x26')]=_0x1c2ce6[_0x5fc1('0x1b')][0x0]['sys_id'];logger['info']('['+[_0x4fd804[_0x5fc1('0x17')]()]+_0x5fc1('0x28'),_0x467006);_0x2e77f0(_0x467006);}else{return createEndUser(_0x4fd804,_0x2b844b,_0x467006,_0x425c88,_0x58c0a9)['then'](function(_0x1efcaf){logger[_0x5fc1('0x10')]('['+[_0x4fd804[_0x5fc1('0x17')]()]+_0x5fc1('0x29'),_0x1efcaf);_0x2e77f0(_0x1efcaf);});}})[_0x5fc1('0x12')](function(_0x20d7dc){logger['error']('['+[_0x4fd804[_0x5fc1('0x17')]()]+']',_0x20d7dc[_0x5fc1('0x14')]);_0x105b5c(_0x20d7dc[_0x5fc1('0x14')]);});});};}function getCustomFields(_0x3a5b7b,_0x13b0d6){var _0x1646f0={};if(_0x3a5b7b['length']>0x0){_[_0x5fc1('0x2a')](_0x3a5b7b,function(_0x32450f){if(_[_0x5fc1('0x2b')]([_0x5fc1('0x2c'),_0x5fc1('0x2d')],_0x32450f[_0x5fc1('0x2e')])&&_0x32450f[_0x5fc1('0x2f')]&&!_0x32450f[_0x5fc1('0x30')]){_0x1646f0[_0x32450f[_0x5fc1('0x2f')][_0x5fc1('0x31')]()]=_0x32450f['content']['toString']();}else if(_['includes']([_0x5fc1('0x2c'),_0x5fc1('0x2d')],_0x32450f[_0x5fc1('0x2e')])&&_0x32450f[_0x5fc1('0x32')]&&_0x32450f[_0x5fc1('0x30')]){_0x1646f0[_0x32450f[_0x5fc1('0x32')][_0x5fc1('0x31')]()]=_0x32450f['content'][_0x5fc1('0x33')]();}else if(_0x32450f[_0x5fc1('0x2e')]==='variable'&&_0x32450f[_0x5fc1('0x34')]&&_0x32450f[_0x5fc1('0x32')]&&_0x32450f[_0x5fc1('0x30')]){_0x1646f0[_0x32450f[_0x5fc1('0x32')][_0x5fc1('0x31')]()]=_0x13b0d6[_0x32450f[_0x5fc1('0x34')]][_0x5fc1('0x33')]();}else if(_0x32450f[_0x5fc1('0x2e')]==='customVariable'&&_0x32450f[_0x5fc1('0x35')]&&_0x32450f['Variable'][_0x5fc1('0x36')]&&_0x32450f['idField']&&_0x32450f[_0x5fc1('0x30')]){_0x1646f0[_0x32450f[_0x5fc1('0x32')][_0x5fc1('0x31')]()]=_0x13b0d6[_0x32450f['Variable']['name'][_0x5fc1('0x31')]()][_0x5fc1('0x33')]();}});}return _0x1646f0;}function getTicket(_0x2f8b24,_0x3755f3,_0x14db55,_0x468c0d,_0x23c525,_0x3e926e){return function(_0x572490){logger[_0x5fc1('0x10')]('['+[_0x2f8b24[_0x5fc1('0x17')]()]+_0x5fc1('0x37'),_0x572490);return new Promise(function(_0x1f11cf,_0x13a714){var _0xd1aeb3=_0x2f8b24['toLowerCase']()===_0x5fc1('0x38')?_0x572490[_0x5fc1('0x1e')]:_0x572490[_0x5fc1('0x26')];var _0x1f3415={'method':'POST','uri':_0x14db55+_0x5fc1('0x39')+'?'+_0x3e926e,'body':Object['assign']({},{'active':'true','caller_id':_0xd1aeb3,'assigned_to':_0x572490[_0x5fc1('0x1e')],'short_description':intUtil[_0x5fc1('0x3a')](_0x468c0d[_0x5fc1('0x3b')],_0x23c525,'\x20'),'description':intUtil[_0x5fc1('0x3a')](_0x468c0d[_0x5fc1('0x3c')],_0x23c525,'\x0a')},getCustomFields(_0x468c0d['Fields'],_0x23c525)),'auth':_0x3755f3,'json':!![]};return rp(_0x1f3415)['then'](function(_0x18112a){logger['info']('['+[_0x2f8b24[_0x5fc1('0x17')]()]+_0x5fc1('0x3d'),_0x18112a[_0x5fc1('0x1b')]);_0x572490[_0x5fc1('0x3e')]=_0x18112a['result'][_0x5fc1('0xf')];_0x572490['ticketNumber']=_0x18112a[_0x5fc1('0x1b')]['number'];logger[_0x5fc1('0x10')]('['+[_0x2f8b24['toUpperCase']()]+_0x5fc1('0x3f'),_0x572490);_0x1f11cf(_0x572490);})[_0x5fc1('0x12')](function(_0x3c5887){logger[_0x5fc1('0x13')]('['+[_0x2f8b24['toUpperCase']()]+']',_0x3c5887[_0x5fc1('0x14')]);_0x13a714(_0x3c5887[_0x5fc1('0x14')]);});});};}function createRemoteTag(_0x57480c,_0x103982,_0xda3bec,_0x2fd97f){return new Promise(function(_0x52bab1,_0x149116){var _0x13d071={'method':_0x5fc1('0x22'),'uri':_0xda3bec+'label'+'?'+_0x2fd97f,'body':{'short_description':_0x57480c,'global':!![],'active':!![],'name':_0x57480c},'auth':_0x103982,'json':!![]};return rp(_0x13d071)[_0x5fc1('0x19')](function(_0x240aee){var _0x5e89eb=_0x240aee[_0x5fc1('0x1b')][_0x5fc1('0xf')];_0x52bab1(_0x5e89eb);});});}function getRemoteTag(_0x3593e2,_0x2ae726,_0x108ce2,_0x2207ed,_0x2ada13){return new Promise(function(_0x4da82d,_0x59d9fa){var _0x36dfb4={'method':_0x5fc1('0xb'),'uri':_0x108ce2+_0x5fc1('0x40')+'?sysparm_query=name%3D'+_0x3593e2+'&'+_0x2207ed,'auth':_0x2ae726,'json':!![]};return rp(_0x36dfb4)['then'](function(_0x431187){if(_0x431187[_0x5fc1('0x1b')]['length']>0x0){var _0x3e6e71=_0x431187[_0x5fc1('0x1b')][0x0][_0x5fc1('0xf')];_0x4da82d(_0x3e6e71);}else{return createRemoteTag(_0x3593e2,_0x2ae726,_0x108ce2,_0x2207ed)['then'](function(_0x3d98f3){_0x4da82d(_0x3d98f3);});}});});}function assignTagToIncident(_0x35f629,_0x30136c,_0x3bfdc4,_0x4db143,_0x2086bc){return new Promise(function(_0x57899d,_0x1ef96e){var _0x573f31={'method':_0x5fc1('0x22'),'uri':_0x3bfdc4+_0x5fc1('0x41')+'?'+_0x2086bc,'body':{'label':_0x35f629,'table':_0x5fc1('0x39'),'id_type':'Incident','table_key':_0x4db143[_0x5fc1('0x3e')],'title':_0x5fc1('0x42')+_0x4db143['ticketNumber'],'id_display':_0x4db143['ticketNumber']},'auth':_0x30136c,'json':!![]};return rp(_0x573f31)[_0x5fc1('0x19')](function(_0x8156ab){_0x57899d();})[_0x5fc1('0x12')](function(){_0x57899d();});});}function manageTags(_0x48bce6,_0x32c5a1,_0x251030,_0x177384,_0x55be84,_0x433096,_0x2f2f2c){return new Promise(function(_0x4a0442,_0x563d00){var _0x4c5bd6=[];_0x32c5a1['forEach'](function(_0x264e2c){_0x4c5bd6[_0x5fc1('0x43')](getRemoteTag(_0x264e2c,_0x251030,_0x177384,_0x433096,_0x2f2f2c));});return Promise['all'](_0x4c5bd6)[_0x5fc1('0x19')](function(_0x131a49){if(_0x131a49[_0x5fc1('0xd')]){logger[_0x5fc1('0x10')]('['+[_0x48bce6[_0x5fc1('0x17')]()]+']\x20arrayPromises:\x20IDs\x20in\x20table\x20label',_0x131a49);var _0xe849b0=[];_0x131a49[_0x5fc1('0x2a')](function(_0x462b76){_0xe849b0[_0x5fc1('0x43')](assignTagToIncident(_0x462b76,_0x251030,_0x177384,_0x55be84,_0x433096));});return Promise[_0x5fc1('0x44')](_0xe849b0)['then'](function(){_0x4a0442();})[_0x5fc1('0x12')](function(){_0x4a0442();});}else{_0x4a0442();}});});}function getTags(_0x3fe37c,_0x2048a5,_0x53885e,_0x53d45d,_0x8c21e7,_0x3b8842){return function(_0x302003){return new Promise(function(_0x26dd66,_0x53f778){var _0x4c5d38=[];var _0x170950=_0x53d45d[_0x5fc1('0x45')];if(_0x170950&&_0x170950[_0x5fc1('0xd')]>0x0){_0x4c5d38=_[_0x5fc1('0x46')](_0x170950,'name');}if(_0x4c5d38['length']>0x0){return manageTags(_0x3fe37c,_0x4c5d38,_0x2048a5,_0x53885e,_0x302003,_0x8c21e7,_0x3b8842)['then'](function(){_0x26dd66(_0x302003);});}else{_0x26dd66(_0x302003);}});};}function emit(_0x103e30,_0x2b21d1,_0x52b04c){var _0x331f1a=_0x5fc1('0x47')+'%26sysparm_record_row%3D1%26sysparm_record_rows%3D39'+'%26sysparm_record_list%3Dactive%253Dtrue'+_0x5fc1('0x48');var _0xf5ed01={'uri':_0x103e30+_0x5fc1('0x49')+_0x52b04c+_0x331f1a};io['to'](util[_0x5fc1('0x4a')](_0x5fc1('0x4b'),_0x2b21d1))['emit'](_0x5fc1('0x4c'),_0xf5ed01);}exports['cs']=function(_0x13a1f7,_0x10bf58,_0x1f3fb0,_0x2ee4e3,_0x5e71be,_0x21d3f2,_0x164e86,_0x187482){var _0x3ede52={};var _0x2ed274={'user':_0x21d3f2[_0x5fc1('0x4d')],'pass':_0x21d3f2[_0x5fc1('0x4e')]};var _0x2286d3=_0x5fc1('0x4f');var _0x11eeac='sysparm_display_value=true';_0x21d3f2[_0x5fc1('0x50')]=intUtil[_0x5fc1('0x51')](_0x21d3f2[_0x5fc1('0x50')]);_0x21d3f2[_0x5fc1('0x52')]=intUtil[_0x5fc1('0x51')](_0x21d3f2[_0x5fc1('0x52')]);var _0x51574c=util[_0x5fc1('0x4a')]('%s/api/now/table/',_0x21d3f2['remoteUri']);_0x3ede52[_0x5fc1('0x15')]=!_[_0x5fc1('0x53')](_0x2ee4e3)?_0x2ee4e3['email']:null;_0x3ede52[_0x5fc1('0x1f')]=_0x21d3f2[_0x5fc1('0x54')];_0x3ede52[_0x5fc1('0x24')]=_0x187482[_0x5fc1('0x31')]()===_0x5fc1('0x38')?_0x10bf58[_0x5fc1('0x55')]:_0x10bf58[_0x5fc1('0x56')];_0x3ede52[_0x5fc1('0x57')]=_0x187482===_0x5fc1('0x58')||_0x187482===_0x5fc1('0x59')?_0x5fc1('0x58'):_0x5fc1('0x38');var _0x2fa91b=util[_0x5fc1('0x4a')](_0x5fc1('0x5a'),_0x21d3f2[_0x5fc1('0x52')],_0x10bf58[_0x5fc1('0x5b')],md5(_0x10bf58[_0x5fc1('0x5b')]));if(_0x5e71be&&_0x5e71be[_0x5fc1('0x5c')]){logger[_0x5fc1('0x10')](_0x5fc1('0x5d'),_0x5fc1('0x5e'));_0x10bf58[_0x5fc1('0x5f')]=_0x2fa91b;}else if(_0x164e86&&_0x164e86[_0x5fc1('0x60')]&&_0x164e86[_0x5fc1('0x60')]!==_0x5fc1('0x61')){logger[_0x5fc1('0x10')]('[OUTBOUND]',_0x5fc1('0x5e'));_0x10bf58[_0x5fc1('0x5f')]=_0x2fa91b;}else{_0x10bf58['recordingURL']='';}return getAdminUser(_0x187482,_0x2ed274,_0x3ede52,_0x51574c,_0x11eeac,_0x2286d3)[_0x5fc1('0x19')](getUser(_0x187482,_0x2ed274,_0x51574c,_0x11eeac,_0x2286d3))[_0x5fc1('0x19')](getEndUser(_0x187482,_0x2ed274,_0x51574c,_0x11eeac,_0x2286d3))[_0x5fc1('0x19')](getTicket(_0x187482,_0x2ed274,_0x51574c,_0x1f3fb0,_0x10bf58,_0x11eeac))[_0x5fc1('0x19')](function(_0x9f7ab4){logger[_0x5fc1('0x10')](util[_0x5fc1('0x4a')](_0x5fc1('0x62'),_0x9f7ab4['ticketId']));logger['info'](util[_0x5fc1('0x4a')](_0x5fc1('0x63'),_0x187482));if(_0x187482!==_0x5fc1('0x59')){logger['info']('['+[_0x187482['toUpperCase']()]+']','Displaying\x20call\x20in\x20a\x20new\x20tab...');emit(_0x21d3f2[_0x5fc1('0x50')],_0x2ee4e3['name'],_0x9f7ab4['ticketId']);}})[_0x5fc1('0x12')](function(_0x1e841e){logger['error']('['+[_0x187482[_0x5fc1('0x17')]()]+_0x5fc1('0x64'),util[_0x5fc1('0x65')](_0x1e841e,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x025a=['ioredis','../../../../config/logger','redis','defaults','localhost','socket.io-emitter','GET','sys_user?sysparm_query=user_name%3Dadmin','result','length','sys_id','toUpperCase','catch','error','message','info','],\x20getUser\x20input\x20crm','validateEmail','userEmail','then','],\x20getUser\x20entity','active','true','userId','adminId','adminEmail','],\x20getUser\x20crm','],\x20createEndUser\x20input\x20crm','POST','sys_user?','endUserNumber','user','System','],\x20EndUser\x20schema','],\x20getEndUser\x20input\x20crm','sys_user?sysparm_query=phone%3D','endUserId','],\x20createEndUser\x20crm','includes','string','type','customField','nameField','content','toString','picklist','idField','variable','variableName','toLowerCase','customVariable','name',']\x20getTicket\x20input\x20crm','outbound','incident','assign','Subjects','getString','Descriptions','ticketNumber','number','label','label_entry','Incident','ticketId','forEach','push','all',']\x20arrayPromises:\x20IDs\x20in\x20table\x20label','Tags','map','%26sysparm_record_target%3Dincident','%26sysparm_record_list%3Dactive%253Dtrue','/nav_to.do?uri=incident.do?sys_id%3D','format','user:%s','emit','trigger:browser:url','username','sysparm_limit=1','sysparm_display_value=true','remoteUri','stripTrailingSlash','serverUrl','%s/api/now/table/','email','destcalleridnum','calleridnum','callDirection','queue','unmanaged','uniqueid','monitor_format','Recording\x20is\x20enabled!','recordingFormat','none','[OUTBOUND]','recordingURL','call\x20direction:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20ServiceNow\x20integration','inspect','lodash','bluebird','request-promise','md5'];(function(_0xe22cb,_0x40c0b6){var _0x59b903=function(_0x5d7eb5){while(--_0x5d7eb5){_0xe22cb['push'](_0xe22cb['shift']());}};_0x59b903(++_0x40c0b6);}(_0x025a,0x66));var _0xa025=function(_0x469665,_0x394876){_0x469665=_0x469665-0x0;var _0x291ab5=_0x025a[_0x469665];return _0x291ab5;};'use strict';var _=require(_0xa025('0x0'));var Promise=require(_0xa025('0x1'));var rp=require(_0xa025('0x2'));var util=require('util');var md5=require(_0xa025('0x3'));var Redis=require(_0xa025('0x4'));var intUtil=require('./util');var config=require('../../../../config/environment');var logger=require(_0xa025('0x5'))('servicenow');config[_0xa025('0x6')]=_[_0xa025('0x7')](config[_0xa025('0x6')],{'host':_0xa025('0x8'),'port':0x18eb});var io=require(_0xa025('0x9'))(new Redis(config['redis']));function getAdminUser(_0x4145ae,_0xcdf287,_0x89f3f2,_0xd5bbda,_0x5c53c7,_0x2559be){return new Promise(function(_0xa9b27d,_0x315e27){var _0x121aa1={'method':_0xa025('0xa'),'uri':_0xd5bbda+_0xa025('0xb')+'&'+_0x5c53c7+'&'+_0x2559be,'auth':_0xcdf287,'json':!![]};return rp(_0x121aa1)['then'](function(_0x3aa7a7){if(_0x3aa7a7[_0xa025('0xc')][_0xa025('0xd')]>0x0){_0x89f3f2['adminId']=_0x3aa7a7[_0xa025('0xc')][0x0][_0xa025('0xe')];}logger['info']('['+[_0x4145ae[_0xa025('0xf')]()]+'],\x20getAdminUser\x20crm',_0x89f3f2);_0xa9b27d(_0x89f3f2);})[_0xa025('0x10')](function(_0x3173e3){logger[_0xa025('0x11')]('['+[_0x4145ae[_0xa025('0xf')]()]+']',_0x3173e3[_0xa025('0x12')]);_0x315e27(_0x3173e3['message']);});});}function getUser(_0xa1b64f,_0x5e56d3,_0x1824ea,_0x4e6897,_0x12e235){return function(_0x4a09aa){logger[_0xa025('0x13')]('['+[_0xa1b64f[_0xa025('0xf')]()]+_0xa025('0x14'),_0x4a09aa);return new Promise(function(_0x4c83ad,_0x4dee37){if(intUtil[_0xa025('0x15')](_0x4a09aa[_0xa025('0x16')])){var _0x28f50f={'method':_0xa025('0xa'),'uri':_0x1824ea+'sys_user?sysparm_query=email%3D'+_0x4a09aa['userEmail']+'&'+_0x4e6897+'&'+_0x12e235,'auth':_0x5e56d3,'json':!![]};logger[_0xa025('0x13')]('['+[_0xa1b64f[_0xa025('0xf')]()]+'],\x20getUser\x20rp\x20obj',_0x28f50f);return rp(_0x28f50f)[_0xa025('0x17')](function(_0x97c8c6){logger[_0xa025('0x13')]('['+[_0xa1b64f['toUpperCase']()]+_0xa025('0x18'),_0x97c8c6);if(_0x97c8c6[_0xa025('0xc')][_0xa025('0xd')]>0x0&&String(_0x97c8c6[_0xa025('0xc')][0x0][_0xa025('0x19')])===_0xa025('0x1a')){_0x4a09aa[_0xa025('0x1b')]=_0x97c8c6[_0xa025('0xc')][0x0][_0xa025('0xe')];}else{_0x4a09aa[_0xa025('0x1b')]=_0x4a09aa[_0xa025('0x1c')];_0x4a09aa[_0xa025('0x16')]=_0x4a09aa[_0xa025('0x1d')];}logger[_0xa025('0x13')]('['+[_0xa1b64f['toUpperCase']()]+_0xa025('0x1e'),_0x4a09aa);_0x4c83ad(_0x4a09aa);})[_0xa025('0x10')](function(_0xf39ac2){logger[_0xa025('0x11')]('['+[_0xa1b64f['toUpperCase']()]+']',_0xf39ac2['message']);_0x4dee37(_0xf39ac2[_0xa025('0x12')]);});}else{logger[_0xa025('0x13')]('['+[_0xa1b64f[_0xa025('0xf')]()]+']\x20using\x20admin\x20profile');_0x4a09aa[_0xa025('0x1b')]=_0x4a09aa['adminId'];_0x4a09aa['userEmail']=_0x4a09aa[_0xa025('0x1d')];_0x4c83ad(_0x4a09aa);}});};}function createEndUser(_0x27651c,_0x48850d,_0x551f90,_0xaabfbe,_0x1c047b){logger['info']('['+[_0x27651c['toUpperCase']()]+_0xa025('0x1f'),_0x551f90);return new Promise(function(_0x282400,_0x33e217){var _0xaa8a75={'method':_0xa025('0x20'),'uri':_0xaabfbe+_0xa025('0x21')+_0x1c047b,'body':{'user_name':_0x551f90[_0xa025('0x22')],'roles':_0xa025('0x23'),'first_name':_0x551f90[_0xa025('0x22')],'active':_0xa025('0x1a'),'date_format':_0xa025('0x24'),'phone':_0x551f90['endUserNumber']},'auth':_0x48850d,'json':!![]};return rp(_0xaa8a75)[_0xa025('0x17')](function(_0x2cbc89){logger[_0xa025('0x13')]('['+[_0x27651c[_0xa025('0xf')]()]+_0xa025('0x25'),_0x2cbc89['result']);_0x551f90['endUserId']=_0x2cbc89[_0xa025('0xc')][_0xa025('0xe')];_0x282400(_0x551f90);})[_0xa025('0x10')](function(_0x202706){logger[_0xa025('0x11')]('['+[_0x27651c['toUpperCase']()]+']',_0x202706[_0xa025('0x12')]);_0x33e217(_0x202706[_0xa025('0x12')]);});});}function getEndUser(_0x1c72ee,_0x46fb56,_0x35b3b9,_0x594dc9,_0x43d2d6){return function(_0xe7a13b){logger['info']('['+[_0x1c72ee[_0xa025('0xf')]()]+_0xa025('0x26'),_0xe7a13b);return new Promise(function(_0x3e5263,_0x557692){var _0x569857={'method':_0xa025('0xa'),'uri':_0x35b3b9+_0xa025('0x27')+_0xe7a13b[_0xa025('0x22')]+'&'+_0x594dc9+'&'+_0x43d2d6,'auth':_0x46fb56,'json':!![]};return rp(_0x569857)['then'](function(_0x511052){if(_0x511052[_0xa025('0xc')][_0xa025('0xd')]>0x0){_0xe7a13b[_0xa025('0x28')]=_0x511052[_0xa025('0xc')][0x0]['sys_id'];logger['info']('['+[_0x1c72ee['toUpperCase']()]+'],\x20getEndUser\x20crm',_0xe7a13b);_0x3e5263(_0xe7a13b);}else{return createEndUser(_0x1c72ee,_0x46fb56,_0xe7a13b,_0x35b3b9,_0x594dc9)[_0xa025('0x17')](function(_0x2dbbf4){logger['info']('['+[_0x1c72ee[_0xa025('0xf')]()]+_0xa025('0x29'),_0x2dbbf4);_0x3e5263(_0x2dbbf4);});}})[_0xa025('0x10')](function(_0x175c76){logger[_0xa025('0x11')]('['+[_0x1c72ee['toUpperCase']()]+']',_0x175c76[_0xa025('0x12')]);_0x557692(_0x175c76[_0xa025('0x12')]);});});};}function getCustomFields(_0x4a7d56,_0x4f81d0){var _0x2163bf={};if(_0x4a7d56[_0xa025('0xd')]>0x0){_['forEach'](_0x4a7d56,function(_0x4d5e80){if(_[_0xa025('0x2a')]([_0xa025('0x2b'),'picklist'],_0x4d5e80[_0xa025('0x2c')])&&_0x4d5e80['nameField']&&!_0x4d5e80[_0xa025('0x2d')]){_0x2163bf[_0x4d5e80[_0xa025('0x2e')]['toLowerCase']()]=_0x4d5e80[_0xa025('0x2f')][_0xa025('0x30')]();}else if(_[_0xa025('0x2a')]([_0xa025('0x2b'),_0xa025('0x31')],_0x4d5e80[_0xa025('0x2c')])&&_0x4d5e80['idField']&&_0x4d5e80[_0xa025('0x2d')]){_0x2163bf[_0x4d5e80[_0xa025('0x32')]['toLowerCase']()]=_0x4d5e80[_0xa025('0x2f')][_0xa025('0x30')]();}else if(_0x4d5e80[_0xa025('0x2c')]===_0xa025('0x33')&&_0x4d5e80[_0xa025('0x34')]&&_0x4d5e80['idField']&&_0x4d5e80[_0xa025('0x2d')]){_0x2163bf[_0x4d5e80[_0xa025('0x32')][_0xa025('0x35')]()]=_0x4f81d0[_0x4d5e80[_0xa025('0x34')]]['toString']();}else if(_0x4d5e80[_0xa025('0x2c')]===_0xa025('0x36')&&_0x4d5e80['Variable']&&_0x4d5e80['Variable']['name']&&_0x4d5e80[_0xa025('0x32')]&&_0x4d5e80[_0xa025('0x2d')]){_0x2163bf[_0x4d5e80[_0xa025('0x32')][_0xa025('0x35')]()]=_0x4f81d0[_0x4d5e80['Variable'][_0xa025('0x37')][_0xa025('0x35')]()][_0xa025('0x30')]();}});}return _0x2163bf;}function getTicket(_0x51c67c,_0x362188,_0x1ca6cf,_0x2b1369,_0x502b78,_0x29177e){return function(_0x24db57){logger['info']('['+[_0x51c67c[_0xa025('0xf')]()]+_0xa025('0x38'),_0x24db57);return new Promise(function(_0x2833c4,_0x1f938d){var _0x5e1df8=_0x51c67c[_0xa025('0x35')]()===_0xa025('0x39')?_0x24db57[_0xa025('0x1b')]:_0x24db57[_0xa025('0x28')];var _0x3c9a9a={'method':_0xa025('0x20'),'uri':_0x1ca6cf+_0xa025('0x3a')+'?'+_0x29177e,'body':Object[_0xa025('0x3b')]({},{'active':_0xa025('0x1a'),'caller_id':_0x5e1df8,'assigned_to':_0x24db57['userId'],'short_description':intUtil['getString'](_0x2b1369[_0xa025('0x3c')],_0x502b78,'\x20'),'description':intUtil[_0xa025('0x3d')](_0x2b1369[_0xa025('0x3e')],_0x502b78,'\x0a')},getCustomFields(_0x2b1369['Fields'],_0x502b78)),'auth':_0x362188,'json':!![]};return rp(_0x3c9a9a)[_0xa025('0x17')](function(_0x2bfaab){logger[_0xa025('0x13')]('['+[_0x51c67c[_0xa025('0xf')]()]+']\x20POST\x20incident\x20entity\x20schema',_0x2bfaab[_0xa025('0xc')]);_0x24db57['ticketId']=_0x2bfaab[_0xa025('0xc')][_0xa025('0xe')];_0x24db57[_0xa025('0x3f')]=_0x2bfaab[_0xa025('0xc')][_0xa025('0x40')];logger[_0xa025('0x13')]('['+[_0x51c67c['toUpperCase']()]+']\x20getTicket\x20crm',_0x24db57);_0x2833c4(_0x24db57);})[_0xa025('0x10')](function(_0x3997f9){logger[_0xa025('0x11')]('['+[_0x51c67c['toUpperCase']()]+']',_0x3997f9[_0xa025('0x12')]);_0x1f938d(_0x3997f9[_0xa025('0x12')]);});});};}function createRemoteTag(_0x394a04,_0x3032be,_0x3f907d,_0xed1be6){return new Promise(function(_0x1df54f,_0x438e0c){var _0x4815ae={'method':'POST','uri':_0x3f907d+_0xa025('0x41')+'?'+_0xed1be6,'body':{'short_description':_0x394a04,'global':!![],'active':!![],'name':_0x394a04},'auth':_0x3032be,'json':!![]};return rp(_0x4815ae)['then'](function(_0x4e961f){var _0x52fc36=_0x4e961f['result'][_0xa025('0xe')];_0x1df54f(_0x52fc36);});});}function getRemoteTag(_0x565731,_0x2707e4,_0x4c0e03,_0x5de128,_0x330693){return new Promise(function(_0xacfa49,_0x38990d){var _0x3dc257={'method':'GET','uri':_0x4c0e03+'label'+'?sysparm_query=name%3D'+_0x565731+'&'+_0x5de128,'auth':_0x2707e4,'json':!![]};return rp(_0x3dc257)['then'](function(_0x33c47e){if(_0x33c47e[_0xa025('0xc')]['length']>0x0){var _0x376b22=_0x33c47e[_0xa025('0xc')][0x0][_0xa025('0xe')];_0xacfa49(_0x376b22);}else{return createRemoteTag(_0x565731,_0x2707e4,_0x4c0e03,_0x5de128)['then'](function(_0x1c59e5){_0xacfa49(_0x1c59e5);});}});});}function assignTagToIncident(_0x288c64,_0x1340f6,_0x3d7eab,_0x52384d,_0x154843){return new Promise(function(_0x50575c,_0x4dc6d9){var _0x479bc5={'method':_0xa025('0x20'),'uri':_0x3d7eab+_0xa025('0x42')+'?'+_0x154843,'body':{'label':_0x288c64,'table':_0xa025('0x3a'),'id_type':_0xa025('0x43'),'table_key':_0x52384d[_0xa025('0x44')],'title':'Incident\x20-\x20'+_0x52384d['ticketNumber'],'id_display':_0x52384d['ticketNumber']},'auth':_0x1340f6,'json':!![]};return rp(_0x479bc5)['then'](function(_0x8ed859){_0x50575c();})[_0xa025('0x10')](function(){_0x50575c();});});}function manageTags(_0x2de0bb,_0x2f8eb9,_0x26bfa4,_0x50686e,_0x196cd4,_0xeb38d7,_0x4890d6){return new Promise(function(_0xc06cc8,_0x360adc){var _0x1e585c=[];_0x2f8eb9[_0xa025('0x45')](function(_0x4140d5){_0x1e585c[_0xa025('0x46')](getRemoteTag(_0x4140d5,_0x26bfa4,_0x50686e,_0xeb38d7,_0x4890d6));});return Promise[_0xa025('0x47')](_0x1e585c)[_0xa025('0x17')](function(_0x5a6b7a){if(_0x5a6b7a[_0xa025('0xd')]){logger[_0xa025('0x13')]('['+[_0x2de0bb[_0xa025('0xf')]()]+_0xa025('0x48'),_0x5a6b7a);var _0x3d68ea=[];_0x5a6b7a['forEach'](function(_0x4d1469){_0x3d68ea[_0xa025('0x46')](assignTagToIncident(_0x4d1469,_0x26bfa4,_0x50686e,_0x196cd4,_0xeb38d7));});return Promise[_0xa025('0x47')](_0x3d68ea)[_0xa025('0x17')](function(){_0xc06cc8();})[_0xa025('0x10')](function(){_0xc06cc8();});}else{_0xc06cc8();}});});}function getTags(_0x3af05e,_0x4fc4e7,_0x4187e9,_0x2ea089,_0x9fe76c,_0x2ddfb6){return function(_0x56a0ca){return new Promise(function(_0x427712,_0x48f856){var _0x25d59c=[];var _0x13c963=_0x2ea089[_0xa025('0x49')];if(_0x13c963&&_0x13c963[_0xa025('0xd')]>0x0){_0x25d59c=_[_0xa025('0x4a')](_0x13c963,'name');}if(_0x25d59c[_0xa025('0xd')]>0x0){return manageTags(_0x3af05e,_0x25d59c,_0x4fc4e7,_0x4187e9,_0x56a0ca,_0x9fe76c,_0x2ddfb6)[_0xa025('0x17')](function(){_0x427712(_0x56a0ca);});}else{_0x427712(_0x56a0ca);}});};}function emit(_0x5bf5a7,_0x258acc,_0x3743f4){var _0x3635a1=_0xa025('0x4b')+'%26sysparm_record_row%3D1%26sysparm_record_rows%3D39'+_0xa025('0x4c')+'%255EORDERBYDESCnumber';var _0x524792={'uri':_0x5bf5a7+_0xa025('0x4d')+_0x3743f4+_0x3635a1};io['to'](util[_0xa025('0x4e')](_0xa025('0x4f'),_0x258acc))[_0xa025('0x50')](_0xa025('0x51'),_0x524792);}exports['cs']=function(_0x17a93a,_0x24718a,_0x5c59b0,_0x3cb05a,_0x44251f,_0x853f44,_0x1964b6,_0x1736c9){var _0x2ebf07={};var _0x5d1afb={'user':_0x853f44[_0xa025('0x52')],'pass':_0x853f44['password']};var _0x363b03=_0xa025('0x53');var _0x1b66ed=_0xa025('0x54');_0x853f44[_0xa025('0x55')]=intUtil[_0xa025('0x56')](_0x853f44[_0xa025('0x55')]);_0x853f44[_0xa025('0x57')]=intUtil[_0xa025('0x56')](_0x853f44[_0xa025('0x57')]);var _0x5d06e0=util[_0xa025('0x4e')](_0xa025('0x58'),_0x853f44[_0xa025('0x55')]);_0x2ebf07['userEmail']=!_['isNil'](_0x3cb05a)?_0x3cb05a[_0xa025('0x59')]:null;_0x2ebf07['adminEmail']=_0x853f44['email'];_0x2ebf07['endUserNumber']=_0x1736c9[_0xa025('0x35')]()===_0xa025('0x39')?_0x24718a[_0xa025('0x5a')]:_0x24718a[_0xa025('0x5b')];_0x2ebf07[_0xa025('0x5c')]=_0x1736c9===_0xa025('0x5d')||_0x1736c9===_0xa025('0x5e')?'queue':_0xa025('0x39');var _0x2d6ea9=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x853f44[_0xa025('0x57')],_0x24718a[_0xa025('0x5f')],md5(_0x24718a[_0xa025('0x5f')]));if(_0x44251f&&_0x44251f[_0xa025('0x60')]){logger[_0xa025('0x13')]('[QUEUE]',_0xa025('0x61'));_0x24718a['recordingURL']=_0x2d6ea9;}else if(_0x1964b6&&_0x1964b6[_0xa025('0x62')]&&_0x1964b6[_0xa025('0x62')]!==_0xa025('0x63')){logger[_0xa025('0x13')](_0xa025('0x64'),_0xa025('0x61'));_0x24718a[_0xa025('0x65')]=_0x2d6ea9;}else{_0x24718a['recordingURL']='';}return getAdminUser(_0x1736c9,_0x5d1afb,_0x2ebf07,_0x5d06e0,_0x1b66ed,_0x363b03)[_0xa025('0x17')](getUser(_0x1736c9,_0x5d1afb,_0x5d06e0,_0x1b66ed,_0x363b03))[_0xa025('0x17')](getEndUser(_0x1736c9,_0x5d1afb,_0x5d06e0,_0x1b66ed,_0x363b03))['then'](getTicket(_0x1736c9,_0x5d1afb,_0x5d06e0,_0x5c59b0,_0x24718a,_0x1b66ed))[_0xa025('0x17')](function(_0x511d1f){logger[_0xa025('0x13')](util['format']('The\x20ticket\x20ID\x20is:\x20%s',_0x511d1f[_0xa025('0x44')]));logger[_0xa025('0x13')](util[_0xa025('0x4e')](_0xa025('0x66'),_0x1736c9));if(_0x1736c9!==_0xa025('0x5e')){logger[_0xa025('0x13')]('['+[_0x1736c9[_0xa025('0xf')]()]+']',_0xa025('0x67'));emit(_0x853f44[_0xa025('0x55')],_0x3cb05a[_0xa025('0x37')],_0x511d1f[_0xa025('0x44')]);}})[_0xa025('0x10')](function(_0x5aeeaf){logger[_0xa025('0x11')]('['+[_0x1736c9[_0xa025('0xf')]()]+_0xa025('0x68'),util[_0xa025('0x69')](_0x5aeeaf,{'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 7a98623..58eda8d 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 _0xf07c=['debug','merge','map','type','string','nameField','content','custom_fields','variable','customField','customVariable','Variable','toLowerCase','POST','login','username','password','PLAIN','sessionID','Account\x20%d\x20is\x20not\x20valid','set_relationship','queue','remoteUri','stripTrailingSlash','serverUrl','uri','%s/service/v4_1/rest.php','monitor_format','[QUEUE]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','recordingURL','The\x20User\x20ID\x20is:','calleridnum','Fields','Inbound','Ticket\x20created!','users','contacts','charAt','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','catch','outbound','recordingFormat','none','Recording\x20is\x20enabled!','destcalleridname','destcalleridnum','The\x20Enduser\x20ID\x20is:','Outbound','The\x20Ticket\x20ID\x20is:','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','[OUTBOUND]','user:%s','error','lastevent','toUpperCase','calleridname','lodash','request-promise','md5','util','ioredis','./util','../../../../config/environment','../../../../config/logger','sugarcrm','redis','localhost','emit','info','name','Subjects','assigned_user_id','created_by','description','getString','Descriptions','date_start','slice','replace','duration_minutes','Contacts','parent_name','direction','length','forEach','variableName','push','idField','set_entry','JSON','stringify','Calls','format','apiKey','toString','get_server_info','isNil','get_entry_list','Employees','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','then','entry_list','find','value','Agent\x20found!','resolve','name_value_list','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','user_id','user_name','Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','contacts.phone_home\x20=\x20\x22%s\x22','phone_home','Enduser\x20found!','first_name','','Caller\x20-\x20%s','Enduser\x20created.'];(function(_0x1de64c,_0x25c467){var _0x3f6d6f=function(_0x1fa98d){while(--_0x1fa98d){_0x1de64c['push'](_0x1de64c['shift']());}};_0x3f6d6f(++_0x25c467);}(_0xf07c,0xb9));var _0xcf07=function(_0x39e84d,_0x11931d){_0x39e84d=_0x39e84d-0x0;var _0x1991bc=_0xf07c[_0x39e84d];return _0x1991bc;};'use strict';var _=require(_0xcf07('0x0'));var rp=require(_0xcf07('0x1'));var BPromise=require('bluebird');var md5=require(_0xcf07('0x2'));var util=require(_0xcf07('0x3'));var Redis=require(_0xcf07('0x4'));var intUtil=require(_0xcf07('0x5'));var config=require(_0xcf07('0x6'));var logger=require(_0xcf07('0x7'))(_0xcf07('0x8'));config[_0xcf07('0x9')]=_['defaults'](config[_0xcf07('0x9')],{'host':_0xcf07('0xa'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xcf07('0x9')]));var def={'method':'POST','json':!![]};function emit(_0x33da33,_0x36d650,_0x3c7499){io['to'](_0x33da33)[_0xcf07('0xb')](_0x36d650,_0x3c7499);}function getTicket(_0x4d1ac8,_0x25e30e,_0xc0c247,_0x39c4fd,_0x401f6a,_0x6d1c66,_0x401c46,_0x30af47){logger[_0xcf07('0xc')]('Creating\x20new\x20ticket...');var _0x1e6625=new Date();var _0x2f5064=[{'name':_0xcf07('0xd'),'value':intUtil['getString'](_0x39c4fd[_0xcf07('0xe')],_0x401f6a,'\x20')},{'name':_0xcf07('0xf'),'value':_0x25e30e['id']},{'name':_0xcf07('0x10'),'value':_0x25e30e['id']},{'name':_0xcf07('0x11'),'value':intUtil[_0xcf07('0x12')](_0x39c4fd[_0xcf07('0x13')],_0x401f6a,'\x0a')},{'name':_0xcf07('0x14'),'value':_0x1e6625['toISOString']()[_0xcf07('0x15')](0x0,0x13)[_0xcf07('0x16')]('T','\x20')},{'name':'duration_hours','value':'0'},{'name':_0xcf07('0x17'),'value':'15'},{'name':'parent_id','value':_0xc0c247['id']},{'name':'parent_type','value':_0xcf07('0x18')},{'name':_0xcf07('0x19'),'value':_0xc0c247[_0xcf07('0xd')]},{'name':_0xcf07('0x1a'),'value':_0x30af47}];if(_0x6d1c66[_0xcf07('0x1b')]){_[_0xcf07('0x1c')](_0x6d1c66,function(_0x211e7e){if(_0x401f6a[_0x211e7e[_0xcf07('0x1d')]]){_0x2f5064[_0xcf07('0x1e')]({'name':_0x211e7e[_0xcf07('0x1f')],'value':_0x401f6a[_0x211e7e['variableName']]});}});}return request({'form':{'method':_0xcf07('0x20'),'input_type':_0xcf07('0x21'),'response_type':_0xcf07('0x21'),'rest_data':JSON[_0xcf07('0x22')]({'session':_0x401c46['id'],'module_name':_0xcf07('0x23'),'name_value_list':_0x2f5064})}});}function getAuth(_0x379bd1){return util[_0xcf07('0x24')]('Basic\x20%s',new Buffer(_0x379bd1[_0xcf07('0x25')]+':X')[_0xcf07('0x26')]('base64'));}function getServerInfo(_0x3730eb){return request({'form':{'method':_0xcf07('0x27'),'input_type':_0xcf07('0x21'),'response_type':_0xcf07('0x21'),'rest_data':JSON[_0xcf07('0x22')]({'session':_0x3730eb['id']})}});}function getUser(_0x29b469,_0x2d7cd6,_0x151098){if(!_[_0xcf07('0x28')](_0x2d7cd6)){logger[_0xcf07('0xc')]('Getting\x20agent\x20with\x20name',_0x2d7cd6);return request({'form':{'method':_0xcf07('0x29'),'input_type':_0xcf07('0x21'),'response_type':_0xcf07('0x21'),'rest_data':JSON['stringify']({'session':_0x151098['id'],'module_name':_0xcf07('0x2a'),'query':util['format'](_0xcf07('0x2b'),_0x2d7cd6),'order_by':'','offset':'0','select_fields':['id',_0xcf07('0xd'),'user_name'],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0xcf07('0x2c')](function(_0x2e3e5e){if(_0x2e3e5e[_0xcf07('0x2d')][_0xcf07('0x1b')]){var _0x4a6a49=_[_0xcf07('0x2e')](_0x2e3e5e[_0xcf07('0x2d')],function(_0x10e5b8){return _0x10e5b8['name_value_list']['user_name'][_0xcf07('0x2f')]===_0x2d7cd6;});if(_0x4a6a49){logger[_0xcf07('0xc')](_0xcf07('0x30'));return BPromise[_0xcf07('0x31')]({'id':_0x4a6a49['name_value_list']['id'][_0xcf07('0x2f')],'name':_0x4a6a49[_0xcf07('0x32')][_0xcf07('0xd')][_0xcf07('0x2f')]});}}logger[_0xcf07('0xc')](_0xcf07('0x33'));return BPromise[_0xcf07('0x31')]({'id':_0x151098[_0xcf07('0x32')][_0xcf07('0x34')][_0xcf07('0x2f')],'name':_0x151098[_0xcf07('0x32')][_0xcf07('0x35')][_0xcf07('0x2f')]});});}else{logger[_0xcf07('0xc')](_0xcf07('0x36'));return BPromise[_0xcf07('0x31')]({'id':_0x151098[_0xcf07('0x32')][_0xcf07('0x34')]['value'],'name':_0x151098[_0xcf07('0x32')][_0xcf07('0x35')][_0xcf07('0x2f')]});}}function getEndUser(_0x46d1b9,_0x5f1a0c,_0x5c4bb9,_0x334584){logger[_0xcf07('0xc')](_0xcf07('0x37'),_0x5c4bb9);return request({'form':{'method':_0xcf07('0x29'),'input_type':_0xcf07('0x21'),'response_type':_0xcf07('0x21'),'rest_data':JSON[_0xcf07('0x22')]({'session':_0x334584['id'],'module_name':'Contacts','query':util[_0xcf07('0x24')](_0xcf07('0x38'),_0x5c4bb9),'order_by':'','offset':'0','select_fields':['id',_0xcf07('0xd'),'phone_home'],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0xcf07('0x2c')](function(_0x490e0c){if(_0x490e0c['entry_list'][_0xcf07('0x1b')]){var _0x1a6b66=_[_0xcf07('0x2e')](_0x490e0c[_0xcf07('0x2d')],function(_0x24e57b){return _0x24e57b['name_value_list'][_0xcf07('0x39')][_0xcf07('0x2f')]===_0x5c4bb9;});if(_0x1a6b66){logger['info'](_0xcf07('0x3a'));return BPromise[_0xcf07('0x31')]({'id':_0x1a6b66[_0xcf07('0x32')]['id'][_0xcf07('0x2f')],'name':_0x1a6b66[_0xcf07('0x32')][_0xcf07('0xd')][_0xcf07('0x2f')],'phone':_0x1a6b66['name_value_list'][_0xcf07('0x39')][_0xcf07('0x2f')]});}}else{logger['info']('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'form':{'method':_0xcf07('0x20'),'input_type':'JSON','response_type':_0xcf07('0x21'),'rest_data':JSON[_0xcf07('0x22')]({'session':_0x334584['id'],'module_name':_0xcf07('0x18'),'name_value_list':[{'name':_0xcf07('0x3b'),'value':_0x5f1a0c!==_0xcf07('0x3c')?_0x5f1a0c:util['format'](_0xcf07('0x3d'),_0x5c4bb9)},{'name':'phone_home','value':_0x5c4bb9}]})}})[_0xcf07('0x2c')](function(_0x745e75){logger[_0xcf07('0xc')](_0xcf07('0x3e'));return BPromise['resolve']({'id':_0x745e75['id'],'name':_0x745e75['entry_list']['first_name']['value'],'phone':_0x745e75[_0xcf07('0x2d')][_0xcf07('0x39')][_0xcf07('0x2f')]});});}});}function request(_0x4039a5){logger[_0xcf07('0x3f')]('[HTTP]',JSON[_0xcf07('0x22')](_0x4039a5));return rp(_[_0xcf07('0x40')](def,_0x4039a5));}function getTags(_0x1b123f,_0x185f7a){var _0x32923f=[];if(_0x1b123f&&_0x1b123f[_0xcf07('0x1b')]>0x0){_0x32923f=_[_0xcf07('0x41')](_0x1b123f,_0x185f7a);}return _0x32923f;}function getCustomFields(_0x478cc9,_0x1d7bd3){var _0x36a730=[];var _0x1a736e={'custom_fields':[]};if(_0x478cc9[_0xcf07('0x1b')]>0x0){_[_0xcf07('0x1c')](_0x478cc9,function(_0x5c71b0){if(_0x5c71b0[_0xcf07('0x42')]===_0xcf07('0x43')&&_0x5c71b0[_0xcf07('0x44')]&&!_0x5c71b0['customField']){_0x1a736e[_0x5c71b0[_0xcf07('0x44')]['toLowerCase']()]=_0x5c71b0[_0xcf07('0x45')][_0xcf07('0x26')]();}else if(_0x5c71b0[_0xcf07('0x42')]===_0xcf07('0x43')&&_0x5c71b0[_0xcf07('0x1f')]&&_0x5c71b0['customField']){_0x1a736e[_0xcf07('0x46')][_0xcf07('0x1e')]({'id':_0x5c71b0[_0xcf07('0x1f')],'value':_0x5c71b0[_0xcf07('0x45')][_0xcf07('0x26')]()});}else if(_0x5c71b0[_0xcf07('0x42')]===_0xcf07('0x47')&&_0x5c71b0['variableName']&&_0x5c71b0[_0xcf07('0x1f')]&&_0x5c71b0[_0xcf07('0x48')]){_0x1d7bd3[_0x5c71b0[_0xcf07('0x1d')]]&&_0x1a736e[_0xcf07('0x46')][_0xcf07('0x1e')]({'id':_0x5c71b0[_0xcf07('0x1f')],'value':_0x1d7bd3[_0x5c71b0[_0xcf07('0x1d')]][_0xcf07('0x26')]()});}else if(_0x5c71b0[_0xcf07('0x42')]===_0xcf07('0x49')&&_0x5c71b0[_0xcf07('0x4a')]&&_0x5c71b0[_0xcf07('0x4a')]['name']&&_0x5c71b0[_0xcf07('0x1f')]&&_0x5c71b0['customField']){_0x1d7bd3[_0x5c71b0[_0xcf07('0x4a')]['name'][_0xcf07('0x4b')]()]&&_0x1a736e[_0xcf07('0x46')][_0xcf07('0x1e')]({'id':_0x5c71b0[_0xcf07('0x1f')],'value':_0x1d7bd3[_0x5c71b0['Variable'][_0xcf07('0xd')][_0xcf07('0x4b')]()]['toString']()});}});}return _0x1a736e;}function getConnection(_0x4c716c){return request({'method':_0xcf07('0x4c'),'form':{'method':_0xcf07('0x4d'),'input_type':_0xcf07('0x21'),'response_type':'JSON','rest_data':JSON[_0xcf07('0x22')]({'user_auth':{'user_name':_0x4c716c[_0xcf07('0x4e')],'password':_0x4c716c[_0xcf07('0x4f')],'encryption':_0xcf07('0x50')},'application':'xCALLY\x20Motion\x20integration'})}})[_0xcf07('0x2c')](function(_0x4bd689){var _0x47460f=_0x4bd689;if(_0x47460f['id']){def[_0xcf07('0x51')]=_0x47460f['id'];return BPromise[_0xcf07('0x31')](_0x47460f);}else{throw new Error(util[_0xcf07('0x24')](_0xcf07('0x52'),_0x4c716c['id']));}});}function setRelationship(_0x3754b4,_0x110a57,_0x51f336,_0x4e375d){return request({'form':{'method':_0xcf07('0x53'),'input_type':_0xcf07('0x21'),'response_type':_0xcf07('0x21'),'rest_data':JSON['stringify']({'session':_0x3754b4['id'],'module_name':_0xcf07('0x23'),'module_id':_0x51f336['id'],'link_field_name':_0x4e375d,'related_ids':[_0x110a57['id']],'name_value_list':[],'delete':0x0})}});}exports[_0xcf07('0x54')]=function(_0x1dd462,_0x17ed4e,_0x529f6b,_0x17c691,_0x5c290f,_0x10048a){var _0xca1143,_0x52823d,_0x191ea0,_0x445de;_0x10048a[_0xcf07('0x55')]=intUtil[_0xcf07('0x56')](_0x10048a[_0xcf07('0x55')]);_0x10048a[_0xcf07('0x57')]=intUtil['stripTrailingSlash'](_0x10048a[_0xcf07('0x57')]);def[_0xcf07('0x58')]=util[_0xcf07('0x24')](_0xcf07('0x59'),_0x10048a[_0xcf07('0x55')]);if(_0x5c290f&&_0x5c290f[_0xcf07('0x5a')]){logger[_0xcf07('0xc')](_0xcf07('0x5b'),'Recording\x20is\x20enabled!');_0x17ed4e['recordingURL']=util[_0xcf07('0x24')](_0xcf07('0x5c'),_0x10048a[_0xcf07('0x57')],_0x17ed4e[_0xcf07('0x5d')],md5(_0x17ed4e[_0xcf07('0x5d')]));}else{_0x17ed4e[_0xcf07('0x5e')]='';}return getConnection(_0x10048a)[_0xcf07('0x2c')](function(_0x51f42c){_0x445de=_0x51f42c;return getUser(_0x10048a,_0x17c691['name'],_0x445de);})['then'](function(_0x386408){_0xca1143=_0x386408;logger[_0xcf07('0xc')](_0xcf07('0x5f'),_0xca1143['id']);return getEndUser(_0x10048a,_0x17ed4e['calleridname'],_0x17ed4e[_0xcf07('0x60')],_0x445de);})[_0xcf07('0x2c')](function(_0x23b340){_0x52823d=_0x23b340;logger[_0xcf07('0xc')]('The\x20Enduser\x20ID\x20is:',_0x52823d['id']);return getTicket(_0x10048a,_0xca1143,_0x52823d,_0x529f6b,_0x17ed4e,_0x529f6b[_0xcf07('0x61')],_0x445de,_0xcf07('0x62'));})[_0xcf07('0x2c')](function(_0x1a0b2c){_0x191ea0=_0x1a0b2c;logger[_0xcf07('0xc')](_0xcf07('0x63'));logger[_0xcf07('0xc')]('The\x20Ticket\x20ID\x20is:',_0x191ea0['id']);return setRelationship(_0x445de,_0xca1143,_0x191ea0,_0xcf07('0x64'));})['then'](function(){return setRelationship(_0x445de,_0x52823d,_0x191ea0,_0xcf07('0x65'));})['then'](function(){return getServerInfo(_0x445de);})['then'](function(_0x2473f6){var _0x4cceed=parseInt(_0x2473f6['version'][_0xcf07('0x66')](0x0));var _0x224a5e=util[_0xcf07('0x24')]('%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s',_0x10048a['remoteUri'],_0x191ea0['id']);if(_0x4cceed>0x6){_0x224a5e=util[_0xcf07('0x24')]('%s/#bwc/index.php?module=Calls&action=EditView&record=%s',_0x10048a['remoteUri'],_0x191ea0['id']);}logger[_0xcf07('0xc')](_0xcf07('0x5b'),_0xcf07('0x67'));emit(util[_0xcf07('0x24')]('user:%s',_0x17c691['name']),_0xcf07('0x68'),{'uri':_0x224a5e});})[_0xcf07('0x69')](function(_0x1aa297){logger['error'](_0xcf07('0x5b'),JSON[_0xcf07('0x22')](_0x1aa297));});};exports[_0xcf07('0x6a')]=function(_0x26da38,_0x42ad66,_0x46ed48,_0x344bee,_0x481ba7,_0x524bc6,_0x1210d8){var _0x24de7e,_0x4073d3,_0x507c7a,_0x377ead;_0x524bc6[_0xcf07('0x55')]=intUtil[_0xcf07('0x56')](_0x524bc6[_0xcf07('0x55')]);_0x524bc6[_0xcf07('0x57')]=intUtil[_0xcf07('0x56')](_0x524bc6[_0xcf07('0x57')]);def[_0xcf07('0x58')]=util[_0xcf07('0x24')](_0xcf07('0x59'),_0x524bc6[_0xcf07('0x55')]);if(_0x1210d8&&_0x1210d8[_0xcf07('0x6b')]&&_0x1210d8[_0xcf07('0x6b')]!==_0xcf07('0x6c')){logger[_0xcf07('0xc')]('[OUTBOUND]',_0xcf07('0x6d'));_0x42ad66[_0xcf07('0x5e')]=util[_0xcf07('0x24')](_0xcf07('0x5c'),_0x524bc6[_0xcf07('0x57')],_0x42ad66[_0xcf07('0x5d')],md5(_0x42ad66[_0xcf07('0x5d')]));}return getConnection(_0x524bc6)['then'](function(_0x368c36){_0x377ead=_0x368c36;return getUser(_0x524bc6,_0x344bee['name'],_0x377ead);})[_0xcf07('0x2c')](function(_0x15f7f0){_0x24de7e=_0x15f7f0;logger[_0xcf07('0xc')](_0xcf07('0x5f'),_0x24de7e['id']);return getEndUser(_0x524bc6,_0x42ad66[_0xcf07('0x6e')],_0x42ad66[_0xcf07('0x6f')],_0x377ead);})[_0xcf07('0x2c')](function(_0x3d8d03){_0x4073d3=_0x3d8d03;logger[_0xcf07('0xc')](_0xcf07('0x70'),_0x4073d3['id']);return getTicket(_0x524bc6,_0x24de7e,_0x4073d3,_0x46ed48,_0x42ad66,_0x46ed48[_0xcf07('0x61')],_0x377ead,_0xcf07('0x71'));})[_0xcf07('0x2c')](function(_0x4a8fca){_0x507c7a=_0x4a8fca;logger[_0xcf07('0xc')]('Ticket\x20created!');logger[_0xcf07('0xc')](_0xcf07('0x72'),_0x507c7a['id']);return setRelationship(_0x377ead,_0x24de7e,_0x507c7a,_0xcf07('0x64'));})[_0xcf07('0x2c')](function(){return setRelationship(_0x377ead,_0x4073d3,_0x507c7a,'contacts');})[_0xcf07('0x2c')](function(){return getServerInfo(_0x377ead);})[_0xcf07('0x2c')](function(_0x4942c9){var _0x501183=parseInt(_0x4942c9[_0xcf07('0x73')][_0xcf07('0x66')](0x0));var _0x5e2ca7=util[_0xcf07('0x24')](_0xcf07('0x74'),_0x524bc6[_0xcf07('0x55')],_0x507c7a['id']);if(_0x501183>0x6){_0x5e2ca7=util['format'](_0xcf07('0x75'),_0x524bc6['remoteUri'],_0x507c7a['id']);}logger[_0xcf07('0xc')](_0xcf07('0x76'),_0xcf07('0x67'));emit(util[_0xcf07('0x24')](_0xcf07('0x77'),_0x344bee[_0xcf07('0xd')]),'trigger:browser:url',{'uri':_0x5e2ca7});})['catch'](function(_0xcaaf43){logger[_0xcf07('0x78')]('[OUTBOUND]',JSON[_0xcf07('0x22')](_0xcaaf43));});};exports['unmanaged']=function(_0x224ef2,_0x4f70ab,_0x439d51,_0x170921,_0x53d0b4,_0x222250){var _0x565e49,_0x533f52,_0x42fdc8,_0x52008e;_0x222250[_0xcf07('0x55')]=intUtil[_0xcf07('0x56')](_0x222250[_0xcf07('0x55')]);_0x222250[_0xcf07('0x57')]=intUtil[_0xcf07('0x56')](_0x222250[_0xcf07('0x57')]);def[_0xcf07('0x58')]=util[_0xcf07('0x24')](_0xcf07('0x59'),_0x222250[_0xcf07('0x55')]);if(_0x53d0b4&&_0x53d0b4[_0xcf07('0x5a')]){logger[_0xcf07('0xc')]('['+_0x4f70ab[_0xcf07('0x79')][_0xcf07('0x7a')]()+']',_0xcf07('0x6d'));_0x4f70ab[_0xcf07('0x5e')]=util['format'](_0xcf07('0x5c'),_0x222250[_0xcf07('0x57')],_0x4f70ab[_0xcf07('0x5d')],md5(_0x4f70ab[_0xcf07('0x5d')]));}else{_0x4f70ab[_0xcf07('0x5e')]='';}return getConnection(_0x222250)['then'](function(_0x329be5){_0x52008e=_0x329be5;if(!_[_0xcf07('0x28')](_0x170921)){return getUser(_0x222250,_0x170921[_0xcf07('0xd')],_0x52008e);}else{return getUser(_0x222250,null,_0x52008e);}})[_0xcf07('0x2c')](function(_0x9e261e){_0x565e49=_0x9e261e;logger[_0xcf07('0xc')]('The\x20User\x20ID\x20is:',_0x565e49['id']);return getEndUser(_0x222250,_0x4f70ab[_0xcf07('0x7b')],_0x4f70ab[_0xcf07('0x60')],_0x52008e);})['then'](function(_0x15e63c){_0x533f52=_0x15e63c;logger['info']('The\x20Enduser\x20ID\x20is:',_0x533f52['id']);return getTicket(_0x222250,_0x565e49,_0x533f52,_0x439d51,_0x4f70ab,_0x439d51[_0xcf07('0x61')],_0x52008e,_0xcf07('0x62'));})[_0xcf07('0x2c')](function(_0x600efa){_0x42fdc8=_0x600efa;logger[_0xcf07('0xc')](_0xcf07('0x63'));logger[_0xcf07('0xc')](_0xcf07('0x72'),_0x42fdc8['id']);return setRelationship(_0x52008e,_0x565e49,_0x42fdc8,'users');})['then'](function(){return setRelationship(_0x52008e,_0x533f52,_0x42fdc8,_0xcf07('0x65'));})['then'](function(){return getServerInfo(_0x52008e);})['catch'](function(_0x39db66){logger[_0xcf07('0x78')]('['+_0x4f70ab['lastevent']['toUpperCase']()+']',JSON['stringify'](_0x39db66));});}; \ No newline at end of file +var _0x7421=['value','Agent\x20found!','resolve','name_value_list','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','user_id','Searching\x20enduser\x20with\x20phone','contacts.phone_home\x20=\x20\x22%s\x22','phone_home','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','first_name','','Caller\x20-\x20%s','debug','[HTTP]','merge','map','nameField','customField','content','toString','type','string','custom_fields','push','idField','variable','customVariable','Variable','toLowerCase','login','username','PLAIN','xCALLY\x20Motion\x20integration','Account\x20%d\x20is\x20not\x20valid','queue','remoteUri','stripTrailingSlash','serverUrl','uri','%s/service/v4_1/rest.php','monitor_format','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Fields','Inbound','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','[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','outbound','recordingFormat','none','[OUTBOUND]','destcalleridname','destcalleridnum','Outbound','catch','unmanaged','lastevent','toUpperCase','error','request-promise','bluebird','md5','util','ioredis','./util','../../../../config/logger','sugarcrm','defaults','redis','localhost','socket.io-emitter','POST','emit','info','Creating\x20new\x20ticket...','name','getString','Subjects','created_by','description','Descriptions','date_start','toISOString','duration_hours','duration_minutes','parent_id','Contacts','parent_name','direction','length','forEach','variableName','set_entry','JSON','stringify','Calls','format','Basic\x20%s','apiKey','base64','isNil','get_entry_list','Employees','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','user_name','then','entry_list','find'];(function(_0xd5ea1c,_0x5222ee){var _0x37c9e8=function(_0x2a2c5f){while(--_0x2a2c5f){_0xd5ea1c['push'](_0xd5ea1c['shift']());}};_0x37c9e8(++_0x5222ee);}(_0x7421,0x149));var _0x1742=function(_0x303959,_0x12aa60){_0x303959=_0x303959-0x0;var _0x3d0d33=_0x7421[_0x303959];return _0x3d0d33;};'use strict';var _=require('lodash');var rp=require(_0x1742('0x0'));var BPromise=require(_0x1742('0x1'));var md5=require(_0x1742('0x2'));var util=require(_0x1742('0x3'));var Redis=require(_0x1742('0x4'));var intUtil=require(_0x1742('0x5'));var config=require('../../../../config/environment');var logger=require(_0x1742('0x6'))(_0x1742('0x7'));config['redis']=_[_0x1742('0x8')](config[_0x1742('0x9')],{'host':_0x1742('0xa'),'port':0x18eb});var io=require(_0x1742('0xb'))(new Redis(config[_0x1742('0x9')]));var def={'method':_0x1742('0xc'),'json':!![]};function emit(_0x2d6f37,_0x67da7a,_0x38ea3b){io['to'](_0x2d6f37)[_0x1742('0xd')](_0x67da7a,_0x38ea3b);}function getTicket(_0xd66644,_0x2f498d,_0x3986f4,_0xd62e30,_0x11bf76,_0x57fb94,_0x6cecd,_0x1a23aa){logger[_0x1742('0xe')](_0x1742('0xf'));var _0x47f42e=new Date();var _0x14de16=[{'name':_0x1742('0x10'),'value':intUtil[_0x1742('0x11')](_0xd62e30[_0x1742('0x12')],_0x11bf76,'\x20')},{'name':'assigned_user_id','value':_0x2f498d['id']},{'name':_0x1742('0x13'),'value':_0x2f498d['id']},{'name':_0x1742('0x14'),'value':intUtil[_0x1742('0x11')](_0xd62e30[_0x1742('0x15')],_0x11bf76,'\x0a')},{'name':_0x1742('0x16'),'value':_0x47f42e[_0x1742('0x17')]()['slice'](0x0,0x13)['replace']('T','\x20')},{'name':_0x1742('0x18'),'value':'0'},{'name':_0x1742('0x19'),'value':'15'},{'name':_0x1742('0x1a'),'value':_0x3986f4['id']},{'name':'parent_type','value':_0x1742('0x1b')},{'name':_0x1742('0x1c'),'value':_0x3986f4[_0x1742('0x10')]},{'name':_0x1742('0x1d'),'value':_0x1a23aa}];if(_0x57fb94[_0x1742('0x1e')]){_[_0x1742('0x1f')](_0x57fb94,function(_0x26b109){if(_0x11bf76[_0x26b109['variableName']]){_0x14de16['push']({'name':_0x26b109['idField'],'value':_0x11bf76[_0x26b109[_0x1742('0x20')]]});}});}return request({'form':{'method':_0x1742('0x21'),'input_type':_0x1742('0x22'),'response_type':'JSON','rest_data':JSON[_0x1742('0x23')]({'session':_0x6cecd['id'],'module_name':_0x1742('0x24'),'name_value_list':_0x14de16})}});}function getAuth(_0x2d77b1){return util[_0x1742('0x25')](_0x1742('0x26'),new Buffer(_0x2d77b1[_0x1742('0x27')]+':X')['toString'](_0x1742('0x28')));}function getServerInfo(_0x458507){return request({'form':{'method':'get_server_info','input_type':_0x1742('0x22'),'response_type':_0x1742('0x22'),'rest_data':JSON['stringify']({'session':_0x458507['id']})}});}function getUser(_0x3ad750,_0x2b35a3,_0x517e8b){if(!_[_0x1742('0x29')](_0x2b35a3)){logger['info']('Getting\x20agent\x20with\x20name',_0x2b35a3);return request({'form':{'method':_0x1742('0x2a'),'input_type':_0x1742('0x22'),'response_type':_0x1742('0x22'),'rest_data':JSON[_0x1742('0x23')]({'session':_0x517e8b['id'],'module_name':_0x1742('0x2b'),'query':util['format'](_0x1742('0x2c'),_0x2b35a3),'order_by':'','offset':'0','select_fields':['id',_0x1742('0x10'),_0x1742('0x2d')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x1742('0x2e')](function(_0x154f44){if(_0x154f44[_0x1742('0x2f')][_0x1742('0x1e')]){var _0x381d77=_[_0x1742('0x30')](_0x154f44[_0x1742('0x2f')],function(_0x4696d8){return _0x4696d8['name_value_list'][_0x1742('0x2d')][_0x1742('0x31')]===_0x2b35a3;});if(_0x381d77){logger[_0x1742('0xe')](_0x1742('0x32'));return BPromise[_0x1742('0x33')]({'id':_0x381d77[_0x1742('0x34')]['id'][_0x1742('0x31')],'name':_0x381d77[_0x1742('0x34')]['name'][_0x1742('0x31')]});}}logger['info'](_0x1742('0x35'));return BPromise[_0x1742('0x33')]({'id':_0x517e8b[_0x1742('0x34')][_0x1742('0x36')][_0x1742('0x31')],'name':_0x517e8b['name_value_list']['user_name'][_0x1742('0x31')]});});}else{logger[_0x1742('0xe')]('Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!');return BPromise[_0x1742('0x33')]({'id':_0x517e8b['name_value_list']['user_id'][_0x1742('0x31')],'name':_0x517e8b[_0x1742('0x34')]['user_name'][_0x1742('0x31')]});}}function getEndUser(_0x175939,_0xc673b,_0x5a21aa,_0x437640){logger[_0x1742('0xe')](_0x1742('0x37'),_0x5a21aa);return request({'form':{'method':_0x1742('0x2a'),'input_type':_0x1742('0x22'),'response_type':'JSON','rest_data':JSON['stringify']({'session':_0x437640['id'],'module_name':'Contacts','query':util[_0x1742('0x25')](_0x1742('0x38'),_0x5a21aa),'order_by':'','offset':'0','select_fields':['id',_0x1742('0x10'),_0x1742('0x39')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x1742('0x2e')](function(_0x1cf9ce){if(_0x1cf9ce[_0x1742('0x2f')][_0x1742('0x1e')]){var _0x57ef49=_[_0x1742('0x30')](_0x1cf9ce['entry_list'],function(_0x1463ec){return _0x1463ec[_0x1742('0x34')][_0x1742('0x39')][_0x1742('0x31')]===_0x5a21aa;});if(_0x57ef49){logger['info'](_0x1742('0x3a'));return BPromise[_0x1742('0x33')]({'id':_0x57ef49[_0x1742('0x34')]['id'][_0x1742('0x31')],'name':_0x57ef49[_0x1742('0x34')][_0x1742('0x10')][_0x1742('0x31')],'phone':_0x57ef49[_0x1742('0x34')]['phone_home']['value']});}}else{logger[_0x1742('0xe')](_0x1742('0x3b'));return request({'form':{'method':_0x1742('0x21'),'input_type':_0x1742('0x22'),'response_type':_0x1742('0x22'),'rest_data':JSON['stringify']({'session':_0x437640['id'],'module_name':'Contacts','name_value_list':[{'name':_0x1742('0x3c'),'value':_0xc673b!==_0x1742('0x3d')?_0xc673b:util['format'](_0x1742('0x3e'),_0x5a21aa)},{'name':_0x1742('0x39'),'value':_0x5a21aa}]})}})['then'](function(_0x5e084a){logger['info']('Enduser\x20created.');return BPromise['resolve']({'id':_0x5e084a['id'],'name':_0x5e084a[_0x1742('0x2f')][_0x1742('0x3c')][_0x1742('0x31')],'phone':_0x5e084a['entry_list'][_0x1742('0x39')][_0x1742('0x31')]});});}});}function request(_0x36036c){logger[_0x1742('0x3f')](_0x1742('0x40'),JSON['stringify'](_0x36036c));return rp(_[_0x1742('0x41')](def,_0x36036c));}function getTags(_0x1c56e8,_0x1bb136){var _0xb85a2f=[];if(_0x1c56e8&&_0x1c56e8[_0x1742('0x1e')]>0x0){_0xb85a2f=_[_0x1742('0x42')](_0x1c56e8,_0x1bb136);}return _0xb85a2f;}function getCustomFields(_0x5d2318,_0x37b5fc){var _0x5b088c=[];var _0x807f2c={'custom_fields':[]};if(_0x5d2318[_0x1742('0x1e')]>0x0){_[_0x1742('0x1f')](_0x5d2318,function(_0x46283d){if(_0x46283d['type']==='string'&&_0x46283d[_0x1742('0x43')]&&!_0x46283d[_0x1742('0x44')]){_0x807f2c[_0x46283d[_0x1742('0x43')]['toLowerCase']()]=_0x46283d[_0x1742('0x45')][_0x1742('0x46')]();}else if(_0x46283d[_0x1742('0x47')]===_0x1742('0x48')&&_0x46283d['idField']&&_0x46283d[_0x1742('0x44')]){_0x807f2c[_0x1742('0x49')][_0x1742('0x4a')]({'id':_0x46283d[_0x1742('0x4b')],'value':_0x46283d[_0x1742('0x45')][_0x1742('0x46')]()});}else if(_0x46283d[_0x1742('0x47')]===_0x1742('0x4c')&&_0x46283d[_0x1742('0x20')]&&_0x46283d[_0x1742('0x4b')]&&_0x46283d[_0x1742('0x44')]){_0x37b5fc[_0x46283d[_0x1742('0x20')]]&&_0x807f2c[_0x1742('0x49')][_0x1742('0x4a')]({'id':_0x46283d[_0x1742('0x4b')],'value':_0x37b5fc[_0x46283d[_0x1742('0x20')]][_0x1742('0x46')]()});}else if(_0x46283d[_0x1742('0x47')]===_0x1742('0x4d')&&_0x46283d[_0x1742('0x4e')]&&_0x46283d[_0x1742('0x4e')][_0x1742('0x10')]&&_0x46283d['idField']&&_0x46283d[_0x1742('0x44')]){_0x37b5fc[_0x46283d[_0x1742('0x4e')]['name'][_0x1742('0x4f')]()]&&_0x807f2c[_0x1742('0x49')][_0x1742('0x4a')]({'id':_0x46283d[_0x1742('0x4b')],'value':_0x37b5fc[_0x46283d[_0x1742('0x4e')][_0x1742('0x10')]['toLowerCase']()]['toString']()});}});}return _0x807f2c;}function getConnection(_0x432b4d){return request({'method':'POST','form':{'method':_0x1742('0x50'),'input_type':'JSON','response_type':'JSON','rest_data':JSON[_0x1742('0x23')]({'user_auth':{'user_name':_0x432b4d[_0x1742('0x51')],'password':_0x432b4d['password'],'encryption':_0x1742('0x52')},'application':_0x1742('0x53')})}})['then'](function(_0x14a0ad){var _0x404440=_0x14a0ad;if(_0x404440['id']){def['sessionID']=_0x404440['id'];return BPromise[_0x1742('0x33')](_0x404440);}else{throw new Error(util[_0x1742('0x25')](_0x1742('0x54'),_0x432b4d['id']));}});}function setRelationship(_0x54e8ec,_0xb3aa0b,_0x5ca2a6,_0x522500){return request({'form':{'method':'set_relationship','input_type':_0x1742('0x22'),'response_type':_0x1742('0x22'),'rest_data':JSON[_0x1742('0x23')]({'session':_0x54e8ec['id'],'module_name':_0x1742('0x24'),'module_id':_0x5ca2a6['id'],'link_field_name':_0x522500,'related_ids':[_0xb3aa0b['id']],'name_value_list':[],'delete':0x0})}});}exports[_0x1742('0x55')]=function(_0x235f0a,_0x3089b6,_0x45a00b,_0x5e64bb,_0x2d8057,_0xb6ea61){var _0x1bdb72,_0x675196,_0x40d503,_0x1ff857;_0xb6ea61[_0x1742('0x56')]=intUtil[_0x1742('0x57')](_0xb6ea61['remoteUri']);_0xb6ea61[_0x1742('0x58')]=intUtil['stripTrailingSlash'](_0xb6ea61[_0x1742('0x58')]);def[_0x1742('0x59')]=util[_0x1742('0x25')](_0x1742('0x5a'),_0xb6ea61[_0x1742('0x56')]);if(_0x2d8057&&_0x2d8057[_0x1742('0x5b')]){logger[_0x1742('0xe')]('[QUEUE]',_0x1742('0x5c'));_0x3089b6[_0x1742('0x5d')]=util[_0x1742('0x25')](_0x1742('0x5e'),_0xb6ea61['serverUrl'],_0x3089b6['uniqueid'],md5(_0x3089b6[_0x1742('0x5f')]));}else{_0x3089b6[_0x1742('0x5d')]='';}return getConnection(_0xb6ea61)[_0x1742('0x2e')](function(_0x25e5c9){_0x1ff857=_0x25e5c9;return getUser(_0xb6ea61,_0x5e64bb['name'],_0x1ff857);})[_0x1742('0x2e')](function(_0x55148d){_0x1bdb72=_0x55148d;logger[_0x1742('0xe')](_0x1742('0x60'),_0x1bdb72['id']);return getEndUser(_0xb6ea61,_0x3089b6[_0x1742('0x61')],_0x3089b6[_0x1742('0x62')],_0x1ff857);})[_0x1742('0x2e')](function(_0x57d7a0){_0x675196=_0x57d7a0;logger[_0x1742('0xe')](_0x1742('0x63'),_0x675196['id']);return getTicket(_0xb6ea61,_0x1bdb72,_0x675196,_0x45a00b,_0x3089b6,_0x45a00b[_0x1742('0x64')],_0x1ff857,_0x1742('0x65'));})['then'](function(_0x3461d7){_0x40d503=_0x3461d7;logger[_0x1742('0xe')](_0x1742('0x66'));logger['info'](_0x1742('0x67'),_0x40d503['id']);return setRelationship(_0x1ff857,_0x1bdb72,_0x40d503,_0x1742('0x68'));})[_0x1742('0x2e')](function(){return setRelationship(_0x1ff857,_0x675196,_0x40d503,_0x1742('0x69'));})[_0x1742('0x2e')](function(){return getServerInfo(_0x1ff857);})[_0x1742('0x2e')](function(_0x564c0c){var _0x2550c5=parseInt(_0x564c0c[_0x1742('0x6a')][_0x1742('0x6b')](0x0));var _0x17a404=util[_0x1742('0x25')](_0x1742('0x6c'),_0xb6ea61['remoteUri'],_0x40d503['id']);if(_0x2550c5>0x6){_0x17a404=util['format'](_0x1742('0x6d'),_0xb6ea61['remoteUri'],_0x40d503['id']);}logger['info'](_0x1742('0x6e'),_0x1742('0x6f'));emit(util['format'](_0x1742('0x70'),_0x5e64bb[_0x1742('0x10')]),_0x1742('0x71'),{'uri':_0x17a404});})['catch'](function(_0xfe92f6){logger['error'](_0x1742('0x6e'),JSON[_0x1742('0x23')](_0xfe92f6));});};exports[_0x1742('0x72')]=function(_0x3b0fbf,_0x42d07e,_0x3f7e46,_0x256f4b,_0x199cc2,_0x6c4a0e,_0x5b3c8e){var _0x4adcbd,_0x55f7d7,_0x217c54,_0x414693;_0x6c4a0e[_0x1742('0x56')]=intUtil[_0x1742('0x57')](_0x6c4a0e['remoteUri']);_0x6c4a0e[_0x1742('0x58')]=intUtil[_0x1742('0x57')](_0x6c4a0e[_0x1742('0x58')]);def[_0x1742('0x59')]=util[_0x1742('0x25')](_0x1742('0x5a'),_0x6c4a0e[_0x1742('0x56')]);if(_0x5b3c8e&&_0x5b3c8e[_0x1742('0x73')]&&_0x5b3c8e[_0x1742('0x73')]!==_0x1742('0x74')){logger['info'](_0x1742('0x75'),_0x1742('0x5c'));_0x42d07e[_0x1742('0x5d')]=util['format'](_0x1742('0x5e'),_0x6c4a0e['serverUrl'],_0x42d07e[_0x1742('0x5f')],md5(_0x42d07e[_0x1742('0x5f')]));}return getConnection(_0x6c4a0e)[_0x1742('0x2e')](function(_0x912718){_0x414693=_0x912718;return getUser(_0x6c4a0e,_0x256f4b[_0x1742('0x10')],_0x414693);})[_0x1742('0x2e')](function(_0x2de098){_0x4adcbd=_0x2de098;logger['info'](_0x1742('0x60'),_0x4adcbd['id']);return getEndUser(_0x6c4a0e,_0x42d07e[_0x1742('0x76')],_0x42d07e[_0x1742('0x77')],_0x414693);})[_0x1742('0x2e')](function(_0xa186fe){_0x55f7d7=_0xa186fe;logger[_0x1742('0xe')]('The\x20Enduser\x20ID\x20is:',_0x55f7d7['id']);return getTicket(_0x6c4a0e,_0x4adcbd,_0x55f7d7,_0x3f7e46,_0x42d07e,_0x3f7e46[_0x1742('0x64')],_0x414693,_0x1742('0x78'));})[_0x1742('0x2e')](function(_0x484b2d){_0x217c54=_0x484b2d;logger[_0x1742('0xe')](_0x1742('0x66'));logger[_0x1742('0xe')](_0x1742('0x67'),_0x217c54['id']);return setRelationship(_0x414693,_0x4adcbd,_0x217c54,_0x1742('0x68'));})['then'](function(){return setRelationship(_0x414693,_0x55f7d7,_0x217c54,_0x1742('0x69'));})[_0x1742('0x2e')](function(){return getServerInfo(_0x414693);})[_0x1742('0x2e')](function(_0x5efd8){var _0x30584e=parseInt(_0x5efd8['version'][_0x1742('0x6b')](0x0));var _0x175859=util[_0x1742('0x25')]('%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s',_0x6c4a0e[_0x1742('0x56')],_0x217c54['id']);if(_0x30584e>0x6){_0x175859=util[_0x1742('0x25')](_0x1742('0x6d'),_0x6c4a0e[_0x1742('0x56')],_0x217c54['id']);}logger[_0x1742('0xe')]('[OUTBOUND]',_0x1742('0x6f'));emit(util[_0x1742('0x25')](_0x1742('0x70'),_0x256f4b[_0x1742('0x10')]),'trigger:browser:url',{'uri':_0x175859});})[_0x1742('0x79')](function(_0x22abc){logger['error'](_0x1742('0x75'),JSON[_0x1742('0x23')](_0x22abc));});};exports[_0x1742('0x7a')]=function(_0x2585bd,_0x503945,_0x3b0091,_0x849674,_0x150cad,_0x2a2a3d){var _0x50a8d2,_0x1525e0,_0x29d5a6,_0x3ad6f8;_0x2a2a3d['remoteUri']=intUtil['stripTrailingSlash'](_0x2a2a3d[_0x1742('0x56')]);_0x2a2a3d['serverUrl']=intUtil[_0x1742('0x57')](_0x2a2a3d[_0x1742('0x58')]);def[_0x1742('0x59')]=util[_0x1742('0x25')]('%s/service/v4_1/rest.php',_0x2a2a3d[_0x1742('0x56')]);if(_0x150cad&&_0x150cad[_0x1742('0x5b')]){logger['info']('['+_0x503945[_0x1742('0x7b')][_0x1742('0x7c')]()+']',_0x1742('0x5c'));_0x503945[_0x1742('0x5d')]=util[_0x1742('0x25')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x2a2a3d[_0x1742('0x58')],_0x503945[_0x1742('0x5f')],md5(_0x503945[_0x1742('0x5f')]));}else{_0x503945[_0x1742('0x5d')]='';}return getConnection(_0x2a2a3d)[_0x1742('0x2e')](function(_0x7c5b5b){_0x3ad6f8=_0x7c5b5b;if(!_[_0x1742('0x29')](_0x849674)){return getUser(_0x2a2a3d,_0x849674[_0x1742('0x10')],_0x3ad6f8);}else{return getUser(_0x2a2a3d,null,_0x3ad6f8);}})[_0x1742('0x2e')](function(_0x9f36bc){_0x50a8d2=_0x9f36bc;logger[_0x1742('0xe')](_0x1742('0x60'),_0x50a8d2['id']);return getEndUser(_0x2a2a3d,_0x503945['calleridname'],_0x503945[_0x1742('0x62')],_0x3ad6f8);})[_0x1742('0x2e')](function(_0x4ae9e4){_0x1525e0=_0x4ae9e4;logger[_0x1742('0xe')](_0x1742('0x63'),_0x1525e0['id']);return getTicket(_0x2a2a3d,_0x50a8d2,_0x1525e0,_0x3b0091,_0x503945,_0x3b0091[_0x1742('0x64')],_0x3ad6f8,_0x1742('0x65'));})[_0x1742('0x2e')](function(_0x25222d){_0x29d5a6=_0x25222d;logger[_0x1742('0xe')](_0x1742('0x66'));logger['info']('The\x20Ticket\x20ID\x20is:',_0x29d5a6['id']);return setRelationship(_0x3ad6f8,_0x50a8d2,_0x29d5a6,_0x1742('0x68'));})[_0x1742('0x2e')](function(){return setRelationship(_0x3ad6f8,_0x1525e0,_0x29d5a6,_0x1742('0x69'));})[_0x1742('0x2e')](function(){return getServerInfo(_0x3ad6f8);})[_0x1742('0x79')](function(_0x3e277f){logger[_0x1742('0x7d')]('['+_0x503945[_0x1742('0x7b')][_0x1742('0x7c')]()+']',JSON[_0x1742('0x23')](_0x3e277f));});}; \ 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 2606aca..69b1ac6 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 _0x05cb=['toLowerCase','keyValue','keyType','string','key','format','%s:\x20%s','join','slice','substring','lastIndexOf','validateEmail','test','lodash','sortBy','length','type','variable','variableName','toString','customVariable','Variable','name','push'];(function(_0x18cb99,_0x5deff4){var _0x582edc=function(_0x543c8c){while(--_0x543c8c){_0x18cb99['push'](_0x18cb99['shift']());}};_0x582edc(++_0x5deff4);}(_0x05cb,0x85));var _0xb05c=function(_0x85ab2b,_0x516a9d){_0x85ab2b=_0x85ab2b-0x0;var _0x37fd3b=_0x05cb[_0x85ab2b];return _0x37fd3b;};'use strict';var _=require(_0xb05c('0x0'));var util=require('util');exports['getString']=function(_0x1bb9d5,_0x57a6c9,_0x40f32f){var _0x257c07=[];if(_0x1bb9d5['length']>0x0){var _0x4aa000=_[_0xb05c('0x1')](_0x1bb9d5,['id']);for(var _0x46c075=0x0;_0x46c075<_0x4aa000[_0xb05c('0x2')];_0x46c075++){var _0xb173a1=_0x4aa000[_0x46c075];if(_0xb173a1[_0xb05c('0x3')]==='string'){_0x257c07['push'](_0xb173a1['content']);}else if(_0xb173a1[_0xb05c('0x3')]===_0xb05c('0x4')&&_0xb173a1[_0xb05c('0x5')]){_0x57a6c9[_0xb173a1['variableName']]&&_0x257c07['push'](_0x57a6c9[_0xb173a1['variableName']][_0xb05c('0x6')]());}else if(_0xb173a1[_0xb05c('0x3')]===_0xb05c('0x7')&&_0xb173a1[_0xb05c('0x8')]&&_0xb173a1['Variable'][_0xb05c('0x9')]){_0x57a6c9[_0xb173a1[_0xb05c('0x8')][_0xb05c('0x9')]['toLowerCase']()]&&_0x257c07[_0xb05c('0xa')](_0x57a6c9[_0xb173a1[_0xb05c('0x8')]['name'][_0xb05c('0xb')]()][_0xb05c('0x6')]());}else if(_0xb173a1[_0xb05c('0x3')]===_0xb05c('0xc')){if(_0xb173a1[_0xb05c('0xd')]===_0xb05c('0xe')&&_0xb173a1[_0xb05c('0xf')]){_0x257c07[_0xb05c('0xa')](util[_0xb05c('0x10')]('%s:\x20%s',_0xb173a1['key'],_0xb173a1['keyContent']));}else if(_0xb173a1[_0xb05c('0xd')]===_0xb05c('0x4')&&_0xb173a1[_0xb05c('0x5')]&&_0xb173a1['key']){_0x57a6c9[_0xb173a1[_0xb05c('0x5')]]&&_0x257c07[_0xb05c('0xa')](util[_0xb05c('0x10')](_0xb05c('0x11'),_0xb173a1[_0xb05c('0xf')],_0x57a6c9[_0xb173a1['variableName']]));}else if(_0xb173a1['keyType']===_0xb05c('0x7')&&_0xb173a1[_0xb05c('0x8')]&&_0xb173a1[_0xb05c('0x8')][_0xb05c('0x9')]&&_0xb173a1['key']){_0x57a6c9[_0xb173a1[_0xb05c('0x8')][_0xb05c('0x9')][_0xb05c('0xb')]()]&&_0x257c07['push'](util[_0xb05c('0x10')](_0xb05c('0x11'),_0xb173a1[_0xb05c('0xf')],_0x57a6c9[_0xb173a1[_0xb05c('0x8')]['name']['toLowerCase']()]));}}}}return _0x257c07[_0xb05c('0x12')](_0x40f32f);};exports['stripTrailingSlash']=function(_0x546215){var _0x338c63=_0x546215[_0xb05c('0x13')](-0x1);if(_0x338c63==='/'){_0x546215=_0x546215[_0xb05c('0x14')](0x0,_0x546215[_0xb05c('0x15')](_0x338c63));}return _0x546215;};exports[_0xb05c('0x16')]=function(_0x56fc6c){if(!_['isNil'](_0x56fc6c)&&_0x56fc6c!==''){var _0x4b3fc8=/^(([^<>()\[\]\\.,;:\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 _0x4b3fc8[_0xb05c('0x17')](String(_0x56fc6c)['toLowerCase']());}else{return![];}}; \ No newline at end of file +var _0x34b9=['push','customVariable','Variable','name','toLowerCase','toString','keyValue','keyType','key','keyContent','%s:\x20%s','format','join','stripTrailingSlash','slice','substring','lastIndexOf','test','getString','length','sortBy','type','string','content','variable','variableName'];(function(_0x34d012,_0x4bb7bc){var _0x2aaaef=function(_0x199c78){while(--_0x199c78){_0x34d012['push'](_0x34d012['shift']());}};_0x2aaaef(++_0x4bb7bc);}(_0x34b9,0x1b2));var _0x934b=function(_0x3c1045,_0xe39ccb){_0x3c1045=_0x3c1045-0x0;var _0x23a897=_0x34b9[_0x3c1045];return _0x23a897;};'use strict';var _=require('lodash');var util=require('util');exports[_0x934b('0x0')]=function(_0xd708e9,_0xf646b9,_0x35f001){var _0x420cbb=[];if(_0xd708e9[_0x934b('0x1')]>0x0){var _0x193827=_[_0x934b('0x2')](_0xd708e9,['id']);for(var _0x2abd86=0x0;_0x2abd86<_0x193827[_0x934b('0x1')];_0x2abd86++){var _0x1820cd=_0x193827[_0x2abd86];if(_0x1820cd[_0x934b('0x3')]===_0x934b('0x4')){_0x420cbb['push'](_0x1820cd[_0x934b('0x5')]);}else if(_0x1820cd['type']===_0x934b('0x6')&&_0x1820cd[_0x934b('0x7')]){_0xf646b9[_0x1820cd[_0x934b('0x7')]]&&_0x420cbb[_0x934b('0x8')](_0xf646b9[_0x1820cd[_0x934b('0x7')]]['toString']());}else if(_0x1820cd[_0x934b('0x3')]===_0x934b('0x9')&&_0x1820cd['Variable']&&_0x1820cd[_0x934b('0xa')][_0x934b('0xb')]){_0xf646b9[_0x1820cd[_0x934b('0xa')][_0x934b('0xb')][_0x934b('0xc')]()]&&_0x420cbb[_0x934b('0x8')](_0xf646b9[_0x1820cd[_0x934b('0xa')][_0x934b('0xb')][_0x934b('0xc')]()][_0x934b('0xd')]());}else if(_0x1820cd['type']===_0x934b('0xe')){if(_0x1820cd[_0x934b('0xf')]===_0x934b('0x4')&&_0x1820cd['key']){_0x420cbb[_0x934b('0x8')](util['format']('%s:\x20%s',_0x1820cd[_0x934b('0x10')],_0x1820cd[_0x934b('0x11')]));}else if(_0x1820cd[_0x934b('0xf')]==='variable'&&_0x1820cd[_0x934b('0x7')]&&_0x1820cd[_0x934b('0x10')]){_0xf646b9[_0x1820cd[_0x934b('0x7')]]&&_0x420cbb[_0x934b('0x8')](util['format'](_0x934b('0x12'),_0x1820cd[_0x934b('0x10')],_0xf646b9[_0x1820cd[_0x934b('0x7')]]));}else if(_0x1820cd[_0x934b('0xf')]===_0x934b('0x9')&&_0x1820cd[_0x934b('0xa')]&&_0x1820cd[_0x934b('0xa')][_0x934b('0xb')]&&_0x1820cd[_0x934b('0x10')]){_0xf646b9[_0x1820cd['Variable']['name'][_0x934b('0xc')]()]&&_0x420cbb[_0x934b('0x8')](util[_0x934b('0x13')](_0x934b('0x12'),_0x1820cd[_0x934b('0x10')],_0xf646b9[_0x1820cd['Variable'][_0x934b('0xb')]['toLowerCase']()]));}}}}return _0x420cbb[_0x934b('0x14')](_0x35f001);};exports[_0x934b('0x15')]=function(_0x171550){var _0xfa133b=_0x171550[_0x934b('0x16')](-0x1);if(_0xfa133b==='/'){_0x171550=_0x171550[_0x934b('0x17')](0x0,_0x171550[_0x934b('0x18')](_0xfa133b));}return _0x171550;};exports['validateEmail']=function(_0x2f4b0e){if(!_['isNil'](_0x2f4b0e)&&_0x2f4b0e!==''){var _0x549b9b=/^(([^<>()\[\]\\.,;:\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 _0x549b9b[_0x934b('0x19')](String(_0x2f4b0e)[_0x934b('0xc')]());}else{return![];}}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/vtiger.js b/server/services/ami/trigger/integration/vtiger.js index c16f7e1..b759689 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(_0x1da215,_0x420eb7){var _0x36f1a1=function(_0x38a02b){while(--_0x38a02b){_0x1da215['push'](_0x1da215['shift']());}};_0x36f1a1(++_0x420eb7);}(_0x9c44,0x178));var _0x49c4=function(_0x50a0c2,_0x4befab){_0x50a0c2=_0x50a0c2-0x0;var _0x5ebadd=_0x9c44[_0x50a0c2];return _0x5ebadd;};'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 _0x34e8=['redis','defaults','localhost','emit','length','forEach','includes','string','picklist','type','idField','toString','variableName','Variable','name','toLowerCase','info','Creating\x20new\x20ticket...','merge','Normal','getString','Subjects','POST','format','remoteUri','create','sessionName','HelpDesk','stringify','success','error','catch','statusCode','Getting\x20agent\x20with\x20email','GET','%s/webservice.php','query','username','SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;','result','Agent\x20found!','resolve','email1','first_name','last_name','userId','[vTiger],\x20%s,\x20%s,\x20%s','getUser','admin','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!','phone','getEndUser','accessKey','getchallenge','then','login','token','Account\x20%d\x20is\x20not\x20valid','getConnection','[HTTP]','queue','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','recordingURL','email','The\x20User\x20ID\x20is:','calleridnum','Fields','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','outbound','stripTrailingSlash','recordingFormat','none','[OUTBOUND]','uniqueid','destcalleridname','destcalleridnum','The\x20Enduser\x20ID\x20is:','split','unmanaged','lastevent','toUpperCase','calleridname','lodash','request-promise','bluebird','md5','ioredis','./util','../../../../config/environment','../../../../config/logger','vTiger'];(function(_0x19d73b,_0x4faf4f){var _0x551496=function(_0x646799){while(--_0x646799){_0x19d73b['push'](_0x19d73b['shift']());}};_0x551496(++_0x4faf4f);}(_0x34e8,0x12c));var _0x834e=function(_0x4eca73,_0x4fa9a0){_0x4eca73=_0x4eca73-0x0;var _0x4ed3cc=_0x34e8[_0x4eca73];return _0x4ed3cc;};'use strict';var _=require(_0x834e('0x0'));var rp=require(_0x834e('0x1'));var BPromise=require(_0x834e('0x2'));var md5=require(_0x834e('0x3'));var util=require('util');var Redis=require(_0x834e('0x4'));var intUtil=require(_0x834e('0x5'));var config=require(_0x834e('0x6'));var logger=require(_0x834e('0x7'))(_0x834e('0x8'));config[_0x834e('0x9')]=_[_0x834e('0xa')](config['redis'],{'host':_0x834e('0xb'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x834e('0x9')]));function emit(_0x3cc2e3,_0x3a3ef6,_0x2e69e2){io['to'](_0x3cc2e3)[_0x834e('0xc')](_0x3a3ef6,_0x2e69e2);}function getCustomFields(_0x23501c,_0x363786){var _0x1af45a={};if(_0x23501c[_0x834e('0xd')]>0x0){_[_0x834e('0xe')](_0x23501c,function(_0x1e41fe){if(_[_0x834e('0xf')]([_0x834e('0x10'),_0x834e('0x11')],_0x1e41fe[_0x834e('0x12')])&&_0x1e41fe[_0x834e('0x13')]){_0x1af45a[_0x1e41fe[_0x834e('0x13')]]=_0x1e41fe['content'][_0x834e('0x14')]();}else if(_0x1e41fe[_0x834e('0x12')]==='variable'&&_0x1e41fe[_0x834e('0x15')]&&_0x1e41fe[_0x834e('0x13')]&&_0x363786[_0x1e41fe[_0x834e('0x15')]]){_0x1af45a[_0x1e41fe[_0x834e('0x13')]]=_0x363786[_0x1e41fe['variableName']][_0x834e('0x14')]();}else if(_0x1e41fe[_0x834e('0x12')]==='customVariable'&&_0x1e41fe[_0x834e('0x16')]&&_0x1e41fe['Variable'][_0x834e('0x17')]&&_0x1e41fe[_0x834e('0x13')]&&_0x363786[_0x1e41fe['Variable'][_0x834e('0x17')][_0x834e('0x18')]()]){_0x1af45a[_0x1e41fe[_0x834e('0x13')]]=_0x363786[_0x1e41fe['Variable'][_0x834e('0x17')][_0x834e('0x18')]()][_0x834e('0x14')]();}});}return _0x1af45a;}function createTicket(_0xb993a1,_0x237947,_0x254677,_0x1dd214,_0x595515,_0x2545b4,_0x1fd2c6){logger[_0x834e('0x19')](_0x834e('0x1a'));var _0x4ab05d=_[_0x834e('0x1b')]({'parent_id':'','assigned_user_id':_0x237947['id'],'ticketpriorities':_0x834e('0x1c'),'ticketstatus':'Open','ticket_title':intUtil[_0x834e('0x1d')](_0x1dd214[_0x834e('0x1e')],_0x595515,'\x20'),'description':intUtil[_0x834e('0x1d')](_0x1dd214['Descriptions'],_0x595515,'\x0a'),'contact_id':_0x254677['id']},getCustomFields(_0x2545b4,_0x595515));var _0x4e3f48={'method':_0x834e('0x1f'),'uri':util[_0x834e('0x20')]('%s/webservice.php',_0xb993a1[_0x834e('0x21')]),'form':{'operation':_0x834e('0x22'),'username':_0xb993a1['username'],'sessionName':_0x1fd2c6[_0x834e('0x23')],'elementType':_0x834e('0x24'),'element':JSON[_0x834e('0x25')](_0x4ab05d)},'json':!![]};return request(_0x4e3f48)['then'](function(_0x24fcf7){if(_0x24fcf7[_0x834e('0x26')]){return BPromise['resolve']({'id':_0x24fcf7['result']['id']});}else{throw new Error(util[_0x834e('0x20')]('Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s',JSON[_0x834e('0x25')](_0x24fcf7[_0x834e('0x27')])));}})[_0x834e('0x28')](function(_0x2cc2eb){var _0x3cd928=_0x2cc2eb[_0x834e('0x29')]||0x1f4;logger['error']('[vTiger],\x20%s,\x20%s,\x20%s','createTicket',_0x3cd928,JSON['stringify'](_0x2cc2eb));});}function getUser(_0x2c7a8d,_0x567cea,_0x106d6a){if(intUtil['validateEmail'](_0x567cea)){logger[_0x834e('0x19')](_0x834e('0x2a'),_0x567cea);return request({'method':_0x834e('0x2b'),'uri':util[_0x834e('0x20')](_0x834e('0x2c'),_0x2c7a8d[_0x834e('0x21')]),'qs':{'operation':_0x834e('0x2d'),'username':_0x2c7a8d[_0x834e('0x2e')],'sessionName':_0x106d6a[_0x834e('0x23')],'query':util['format'](_0x834e('0x2f'),_0x567cea)},'json':!![]})['then'](function(_0x2c75c2){if(_0x2c75c2[_0x834e('0x26')]&&_0x2c75c2[_0x834e('0x30')][_0x834e('0xd')]){logger[_0x834e('0x19')](_0x834e('0x31'));return BPromise[_0x834e('0x32')]({'id':_0x2c75c2[_0x834e('0x30')][0x0]['id'],'email':_0x2c75c2[_0x834e('0x30')][0x0][_0x834e('0x33')],'name':_0x2c75c2['result'][0x0][_0x834e('0x34')]+'\x20'+_0x2c75c2[_0x834e('0x30')][_0x834e('0x35')]});}else{logger[_0x834e('0x19')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise[_0x834e('0x32')]({'id':_0x106d6a[_0x834e('0x36')],'email':_0x2c7a8d['username'],'name':'admin'});}})['catch'](function(_0x3e58fa){var _0x41bf4d=_0x3e58fa[_0x834e('0x29')]||0x1f4;logger[_0x834e('0x27')](_0x834e('0x37'),_0x834e('0x38'),_0x41bf4d,JSON['stringify'](_0x3e58fa));});}else{logger[_0x834e('0x19')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise[_0x834e('0x32')]({'id':_0x106d6a[_0x834e('0x36')],'email':_0x2c7a8d['username'],'name':_0x834e('0x39')})[_0x834e('0x28')](function(_0x491c28){var _0x481f70=_0x491c28[_0x834e('0x29')]||0x1f4;logger[_0x834e('0x27')](_0x834e('0x37'),_0x834e('0x38'),_0x481f70,JSON[_0x834e('0x25')](_0x491c28));});}}function getEndUser(_0x4ca43c,_0x1c5ed6,_0x548d1d,_0x50c243){logger[_0x834e('0x19')]('Searching\x20end\x20user\x20with\x20phone',_0x548d1d);return request({'method':_0x834e('0x2b'),'uri':util[_0x834e('0x20')](_0x834e('0x2c'),_0x4ca43c[_0x834e('0x21')]),'qs':{'operation':_0x834e('0x2d'),'username':_0x4ca43c['username'],'sessionName':_0x50c243[_0x834e('0x23')],'query':util[_0x834e('0x20')](_0x834e('0x3a'),_0x548d1d,_0x548d1d,_0x548d1d,_0x548d1d,_0x548d1d)},'json':!![]})['then'](function(_0x35380e){if(_0x35380e[_0x834e('0x26')]&&_0x35380e['result'][_0x834e('0xd')]){logger['info'](_0x834e('0x3b'));return BPromise[_0x834e('0x32')]({'id':_0x35380e['result'][0x0]['id'],'name':_0x35380e['result'][0x0][_0x834e('0x3c')]+'\x20'+_0x35380e[_0x834e('0x30')][0x0][_0x834e('0x3d')],'phone':_0x548d1d});}else{logger[_0x834e('0x19')](_0x834e('0x3e'));return request({'method':_0x834e('0x1f'),'uri':util[_0x834e('0x20')]('%s/webservice.php',_0x4ca43c[_0x834e('0x21')]),'form':{'operation':'create','sessionName':_0x50c243[_0x834e('0x23')],'elementType':'Contacts','element':JSON[_0x834e('0x25')]({'lastname':_0x1c5ed6,'phone':_0x548d1d,'assigned_user_id':'\x20'})},'json':!![]})['then'](function(_0x361f60){logger[_0x834e('0x19')]('Enduser\x20created.');return BPromise[_0x834e('0x32')]({'id':_0x361f60[_0x834e('0x30')]['id'],'name':_0x361f60[_0x834e('0x30')][_0x834e('0x3d')],'phone':_0x361f60[_0x834e('0x30')][_0x834e('0x3f')]});})[_0x834e('0x28')](function(_0x3ccd8e){var _0x5dc63b=_0x3ccd8e[_0x834e('0x29')]||0x1f4;logger['error'](_0x834e('0x37'),_0x834e('0x40'),_0x5dc63b,JSON['stringify'](_0x3ccd8e));});}});}function getConnection(_0x112306){var _0x42fd90=_0x112306[_0x834e('0x2e')];var _0x2112d5=_0x112306[_0x834e('0x41')];return request({'method':_0x834e('0x2b'),'uri':util['format']('%s/webservice.php',_0x112306[_0x834e('0x21')]),'qs':{'operation':_0x834e('0x42'),'username':_0x42fd90},'json':!![]})[_0x834e('0x43')](function(_0x40ff5a){if(_0x40ff5a[_0x834e('0x26')]){return request({'method':_0x834e('0x1f'),'uri':util[_0x834e('0x20')](_0x834e('0x2c'),_0x112306[_0x834e('0x21')]),'form':{'operation':_0x834e('0x44'),'username':_0x42fd90,'accessKey':md5(_0x40ff5a[_0x834e('0x30')][_0x834e('0x45')]+_0x2112d5)},'json':!![]});}})[_0x834e('0x43')](function(_0x1a3237){if(_0x1a3237[_0x834e('0x26')]){return BPromise[_0x834e('0x32')](_0x1a3237[_0x834e('0x30')]);}else{throw new Error(util[_0x834e('0x20')](_0x834e('0x46'),_0x112306['id']));}})[_0x834e('0x28')](function(_0x4cfacd){var _0x1cc0b8=_0x4cfacd[_0x834e('0x29')]||0x1f4;logger['error'](_0x834e('0x37'),_0x834e('0x47'),_0x1cc0b8,JSON['stringify'](_0x4cfacd));});}function request(_0x3dcca3){logger[_0x834e('0x19')](_0x834e('0x48'),JSON[_0x834e('0x25')](_0x3dcca3));return rp(_0x3dcca3);}exports[_0x834e('0x49')]=function(_0xb77aab,_0x4549ba,_0x4a8b32,_0x1ad7fe,_0x8bc6c6,_0x3e0550){var _0x363675,_0x86ad2b,_0x396bbe,_0x344b51;_0x3e0550[_0x834e('0x21')]=intUtil['stripTrailingSlash'](_0x3e0550[_0x834e('0x21')]);if(_0x8bc6c6&&_0x8bc6c6['monitor_format']){logger[_0x834e('0x19')]('[QUEUE]',_0x834e('0x4a'));_0x4549ba['recordingURL']=util['format'](_0x834e('0x4b'),_0x3e0550[_0x834e('0x4c')],_0x4549ba['uniqueid'],md5(_0x4549ba['uniqueid']));}else{_0x4549ba[_0x834e('0x4d')]='';}return getConnection(_0x3e0550)[_0x834e('0x43')](function(_0x138ed2){_0x344b51=_0x138ed2;return getUser(_0x3e0550,_0x1ad7fe[_0x834e('0x4e')],_0x344b51);})[_0x834e('0x43')](function(_0x315858){_0x363675=_0x315858;logger[_0x834e('0x19')](_0x834e('0x4f'),_0x363675['id']);return getEndUser(_0x3e0550,_0x4549ba['calleridname'],_0x4549ba[_0x834e('0x50')],_0x344b51);})[_0x834e('0x43')](function(_0x5d5ac2){_0x86ad2b=_0x5d5ac2;logger[_0x834e('0x19')]('The\x20Enduser\x20ID\x20is:',_0x86ad2b['id']);return createTicket(_0x3e0550,_0x363675,_0x86ad2b,_0x4a8b32,_0x4549ba,_0x4a8b32[_0x834e('0x51')],_0x344b51);})[_0x834e('0x43')](function(_0x5160c4){_0x396bbe=_0x5160c4;logger[_0x834e('0x19')](_0x834e('0x52'));logger[_0x834e('0x19')](_0x834e('0x53'),_0x396bbe['id']);var _0x5a2924=util[_0x834e('0x20')](_0x834e('0x54'),_0x3e0550[_0x834e('0x21')],_['split'](_0x396bbe['id'],'x')[0x1]);logger[_0x834e('0x19')](_0x834e('0x55'),_0x834e('0x56'));emit(util[_0x834e('0x20')](_0x834e('0x57'),_0x1ad7fe[_0x834e('0x17')]),_0x834e('0x58'),{'uri':_0x5a2924});})[_0x834e('0x28')](function(_0x208c21){logger[_0x834e('0x27')](_0x834e('0x55'),JSON[_0x834e('0x25')](_0x208c21));});};exports[_0x834e('0x59')]=function(_0x1659c8,_0x460a7a,_0x17b8e3,_0x297cce,_0x14ed83,_0x193a15,_0x3e3467){var _0xed4081,_0x2cb233,_0x5c83eb,_0x2145cf;_0x193a15[_0x834e('0x21')]=intUtil[_0x834e('0x5a')](_0x193a15[_0x834e('0x21')]);_0x193a15['serverUrl']=intUtil[_0x834e('0x5a')](_0x193a15['serverUrl']);if(_0x3e3467&&_0x3e3467['recordingFormat']&&_0x3e3467[_0x834e('0x5b')]!==_0x834e('0x5c')){logger[_0x834e('0x19')](_0x834e('0x5d'),_0x834e('0x4a'));_0x460a7a[_0x834e('0x4d')]=util[_0x834e('0x20')](_0x834e('0x4b'),_0x193a15['serverUrl'],_0x460a7a[_0x834e('0x5e')],md5(_0x460a7a['uniqueid']));}return getConnection(_0x193a15)[_0x834e('0x43')](function(_0xd35dda){_0x2145cf=_0xd35dda;return getUser(_0x193a15,_0x297cce['email'],_0x2145cf);})['then'](function(_0x4a4def){_0xed4081=_0x4a4def;logger[_0x834e('0x19')](_0x834e('0x4f'),_0xed4081['id']);return getEndUser(_0x193a15,_0x460a7a[_0x834e('0x5f')],_0x460a7a[_0x834e('0x60')],_0x2145cf);})['then'](function(_0x2b0d93){_0x2cb233=_0x2b0d93;logger[_0x834e('0x19')](_0x834e('0x61'),_0x2cb233['id']);return createTicket(_0x193a15,_0xed4081,_0x2cb233,_0x17b8e3,_0x460a7a,_0x17b8e3[_0x834e('0x51')],_0x2145cf);})[_0x834e('0x43')](function(_0x28b5c9){_0x5c83eb=_0x28b5c9;logger[_0x834e('0x19')](_0x834e('0x52'));logger[_0x834e('0x19')](_0x834e('0x53'),_0x5c83eb['id']);var _0x5b2bf6=util[_0x834e('0x20')](_0x834e('0x54'),_0x193a15[_0x834e('0x21')],_[_0x834e('0x62')](_0x5c83eb['id'],'x')[0x1]);logger['info'](_0x834e('0x5d'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util['format']('user:%s',_0x297cce[_0x834e('0x17')]),_0x834e('0x58'),{'uri':_0x5b2bf6});})['catch'](function(_0x2645df){logger[_0x834e('0x27')]('[OUTBOUND]',JSON[_0x834e('0x25')](_0x2645df));});};exports[_0x834e('0x63')]=function(_0x4b88e7,_0x5df169,_0x346be5,_0x2a42a3,_0x8bc7d9,_0x44c909){var _0x1d8e7,_0x493239,_0x264a6f,_0x520367;_0x44c909[_0x834e('0x21')]=intUtil[_0x834e('0x5a')](_0x44c909[_0x834e('0x21')]);_0x44c909['serverUrl']=intUtil[_0x834e('0x5a')](_0x44c909[_0x834e('0x4c')]);if(_0x8bc7d9&&_0x8bc7d9['monitor_format']){logger[_0x834e('0x19')]('['+_0x5df169[_0x834e('0x64')][_0x834e('0x65')]()+']','Recording\x20is\x20enabled!');_0x5df169[_0x834e('0x4d')]=util[_0x834e('0x20')](_0x834e('0x4b'),_0x44c909[_0x834e('0x4c')],_0x5df169[_0x834e('0x5e')],md5(_0x5df169[_0x834e('0x5e')]));}else{_0x5df169[_0x834e('0x4d')]='';}return getConnection(_0x44c909)[_0x834e('0x43')](function(_0xd49002){_0x520367=_0xd49002;return getUser(_0x44c909,'',_0x520367);})[_0x834e('0x43')](function(_0x57d898){_0x1d8e7=_0x57d898;logger['info']('The\x20User\x20ID\x20is:',_0x1d8e7['id']);return getEndUser(_0x44c909,_0x5df169[_0x834e('0x66')],_0x5df169[_0x834e('0x50')],_0x520367);})[_0x834e('0x43')](function(_0x37fa2c){_0x493239=_0x37fa2c;logger[_0x834e('0x19')]('The\x20Enduser\x20ID\x20is:',_0x493239['id']);return createTicket(_0x44c909,_0x1d8e7,_0x493239,_0x346be5,_0x5df169,_0x346be5['Fields'],_0x520367);})[_0x834e('0x43')](function(_0x1ad428){_0x264a6f=_0x1ad428;logger[_0x834e('0x19')](_0x834e('0x52'));logger[_0x834e('0x19')]('The\x20Ticket\x20ID\x20is:',_0x264a6f['id']);})[_0x834e('0x28')](function(_0x2b162a){logger[_0x834e('0x27')]('['+_0x5df169['lastevent'][_0x834e('0x65')]()+']',JSON[_0x834e('0x25')](_0x2b162a));});}; \ 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 7a4054d..7b8bea1 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 _0x82ab=['email','The\x20User\x20ID\x20is:','calleridname','The\x20Ticket\x20ID\x20is:','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','%s/agent/tickets/%s','/api/v2','Zendesk\x20account\x20type\x20not\x20recognized','catch','error','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','inspect','outbound','recordingFormat','[OUTBOUND]','destcalleridname','replace','unmanaged','lastevent','toUpperCase','calleridnum','The\x20Enduser\x20ID\x20is:','\x20Error\x20running\x20Zendesk\x20integration','lodash','md5','util','./util','../../../../config/environment','zendesk','redis','defaults','localhost','socket.io-emitter','application/json','Creating\x20new\x20ticket...','format','remoteUri','POST','getString','Subjects','Descriptions','Fields','info','Ticket\x20created!','ticket','Getting\x20agent\x20with\x20email','%s/search.json','type:user\x20role:agent\x20email:%s','then','count','Agent\x20found!','find','results','agent','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','user','Admin\x20account\x20selected.','Searching\x20enduser\x20with\x20phone','type:user\x20role:end-user\x20phone:%s','length','end-user','first','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/users.json','Caller\x20-\x20%s','password','%s:%s','token','Basic\x20%s','toString','base64','debug','[HTTP]','stringify','GET','map','forEach','includes','string','picklist','type','toLowerCase','content','idField','custom_fields','push','variable','variableName','customField','customVariable','Variable','name','queue','serverUrl','stripTrailingSlash','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x82ab,0x1cc));var _0xb82a=function(_0x3ca1f8,_0x4afa33){_0x3ca1f8=_0x3ca1f8-0x0;var _0x94fb6b=_0x82ab[_0x3ca1f8];return _0x94fb6b;};'use strict';var _=require(_0xb82a('0x0'));var rp=require('request-promise');var md5=require(_0xb82a('0x1'));var util=require(_0xb82a('0x2'));var Redis=require('ioredis');var intUtil=require(_0xb82a('0x3'));var config=require(_0xb82a('0x4'));var logger=require('../../../../config/logger')(_0xb82a('0x5'));config[_0xb82a('0x6')]=_[_0xb82a('0x7')](config[_0xb82a('0x6')],{'host':_0xb82a('0x8'),'port':0x18eb});var io=require(_0xb82a('0x9'))(new Redis(config[_0xb82a('0x6')]));function emit(_0xe842ac,_0x14f326,_0x5f2ab6){io['to'](_0xe842ac)['emit'](_0x14f326,_0x5f2ab6);}var headers={'Content-Type':_0xb82a('0xa'),'Accept':'application/json'};function getTicket(_0x325b53,_0x348e57,_0x37bc22,_0x5737f0,_0x5e9a3b){logger['info'](_0xb82a('0xb'));return request({'uri':util[_0xb82a('0xc')]('%s/tickets.json',_0x325b53[_0xb82a('0xd')]),'method':_0xb82a('0xe'),'body':{'ticket':_['merge']({'requester_id':_0x37bc22['id'],'submitter_id':_0x348e57?_0x348e57['id']:undefined,'assignee_id':_0x348e57?_0x348e57['id']:undefined,'tags':getTags(_0x5737f0['Tags'],'name'),'subject':intUtil[_0xb82a('0xf')](_0x5737f0[_0xb82a('0x10')],_0x5e9a3b,'\x20'),'description':intUtil[_0xb82a('0xf')](_0x5737f0[_0xb82a('0x11')],_0x5e9a3b,'\x0a'),'comment':{'public':![],'body':intUtil[_0xb82a('0xf')](_0x5737f0[_0xb82a('0x11')],_0x5e9a3b,'\x0a')}},getCustomFields(_0x5737f0[_0xb82a('0x12')],_0x5e9a3b))}})['then'](function(_0x981526){logger[_0xb82a('0x13')](_0xb82a('0x14'));return _0x981526[_0xb82a('0x15')];});}function getUser(_0x3cf222,_0xca117c){if(intUtil['validateEmail'](_0xca117c)){logger['info'](_0xb82a('0x16'),_0xca117c);return request({'uri':util[_0xb82a('0xc')](_0xb82a('0x17'),_0x3cf222[_0xb82a('0xd')]),'qs':{'query':util[_0xb82a('0xc')](_0xb82a('0x18'),_0xca117c)}})[_0xb82a('0x19')](function(_0x405de2){if(_0x405de2[_0xb82a('0x1a')]){logger['info'](_0xb82a('0x1b'));return _[_0xb82a('0x1c')](_0x405de2[_0xb82a('0x1d')],{'email':_0xca117c,'role':_0xb82a('0x1e')});}else{logger[_0xb82a('0x13')](_0xb82a('0x1f'));return request({'uri':util[_0xb82a('0xc')]('%s/users/me.json',_0x3cf222[_0xb82a('0xd')])})[_0xb82a('0x19')](function(_0xc9927){logger[_0xb82a('0x13')]('Admin\x20account\x20selected.');return _0xc9927[_0xb82a('0x20')];});}});}else{logger[_0xb82a('0x13')](_0xb82a('0x1f'));return request({'uri':util[_0xb82a('0xc')]('%s/users/me.json',_0x3cf222[_0xb82a('0xd')])})['then'](function(_0x3c1000){logger[_0xb82a('0x13')](_0xb82a('0x21'));return _0x3c1000['user'];});}}function getEndUser(_0xa015b2,_0x314457,_0x1684e6){logger['info'](_0xb82a('0x22'),_0x1684e6);return request({'uri':util[_0xb82a('0xc')](_0xb82a('0x17'),_0xa015b2['remoteUri']),'qs':{'query':util[_0xb82a('0xc')](_0xb82a('0x23'),_0x1684e6)}})[_0xb82a('0x19')](function(_0x27b0ba){var _0xe1f31a;if(_0x27b0ba['results'][_0xb82a('0x24')]){_0x27b0ba[_0xb82a('0x1d')]=_['filter'](_0x27b0ba['results'],{'suspended':![],'role':_0xb82a('0x25')});if(_0x27b0ba[_0xb82a('0x1d')][_0xb82a('0x24')]){_0xe1f31a=_[_0xb82a('0x26')](_0x27b0ba[_0xb82a('0x1d')]);}}if(_0xe1f31a){logger[_0xb82a('0x13')](_0xb82a('0x27'));return _0xe1f31a;}else{logger[_0xb82a('0x13')](_0xb82a('0x28'));return request({'uri':util[_0xb82a('0xc')](_0xb82a('0x29'),_0xa015b2[_0xb82a('0xd')]),'method':'POST','body':{'user':{'role':_0xb82a('0x25'),'name':util[_0xb82a('0xc')](_0xb82a('0x2a'),_0x314457||_0x1684e6),'phone':_0x1684e6}}})[_0xb82a('0x19')](function(_0x18c262){logger[_0xb82a('0x13')]('Enduser\x20created.');return _0x18c262['user'];});}});}function getAuth(_0x27622d){var _0x535bb5;if(_0x27622d['authType']===_0xb82a('0x2b')){_0x535bb5=util[_0xb82a('0xc')](_0xb82a('0x2c'),_0x27622d['username'],_0x27622d[_0xb82a('0x2b')]);}else if(_0x27622d['authType']===_0xb82a('0x2d')){_0x535bb5=util[_0xb82a('0xc')]('%s/token:%s',_0x27622d['username'],_0x27622d[_0xb82a('0x2d')]);}return util[_0xb82a('0xc')](_0xb82a('0x2e'),new Buffer(_0x535bb5)[_0xb82a('0x2f')](_0xb82a('0x30')));}function request(_0x10472f){logger[_0xb82a('0x31')](_0xb82a('0x32'),JSON[_0xb82a('0x33')](_0x10472f));return rp(_[_0xb82a('0x7')](_0x10472f,{'method':_0xb82a('0x34'),'headers':headers,'json':!![]}));}function getTags(_0x5a9950,_0x27ff98){var _0x2fa0b7=[];if(_0x5a9950&&_0x5a9950['length']>0x0){_0x2fa0b7=_[_0xb82a('0x35')](_0x5a9950,_0x27ff98);}return _0x2fa0b7;}function getCustomFields(_0x3bef16,_0x131856){var _0x4dca8c=[];var _0x2ec3bf={'custom_fields':[]};if(_0x3bef16['length']>0x0){_[_0xb82a('0x36')](_0x3bef16,function(_0x43939f){if(_[_0xb82a('0x37')]([_0xb82a('0x38'),_0xb82a('0x39')],_0x43939f[_0xb82a('0x3a')])&&_0x43939f['nameField']&&!_0x43939f['customField']){_0x2ec3bf[_0x43939f['nameField'][_0xb82a('0x3b')]()]=_0x43939f[_0xb82a('0x3c')][_0xb82a('0x2f')]();}else if(_[_0xb82a('0x37')]([_0xb82a('0x38'),_0xb82a('0x39')],_0x43939f['type'])&&_0x43939f[_0xb82a('0x3d')]&&_0x43939f['customField']){_0x2ec3bf[_0xb82a('0x3e')][_0xb82a('0x3f')]({'id':_0x43939f[_0xb82a('0x3d')],'value':_0x43939f[_0xb82a('0x3c')][_0xb82a('0x2f')]()});}else if(_0x43939f['type']===_0xb82a('0x40')&&_0x43939f[_0xb82a('0x41')]&&_0x43939f[_0xb82a('0x3d')]&&_0x43939f[_0xb82a('0x42')]){_0x131856[_0x43939f[_0xb82a('0x41')]]&&_0x2ec3bf[_0xb82a('0x3e')][_0xb82a('0x3f')]({'id':_0x43939f['idField'],'value':_0x131856[_0x43939f[_0xb82a('0x41')]][_0xb82a('0x2f')]()});}else if(_0x43939f[_0xb82a('0x3a')]===_0xb82a('0x43')&&_0x43939f['Variable']&&_0x43939f[_0xb82a('0x44')][_0xb82a('0x45')]&&_0x43939f[_0xb82a('0x3d')]&&_0x43939f[_0xb82a('0x42')]){_0x131856[_0x43939f[_0xb82a('0x44')][_0xb82a('0x45')][_0xb82a('0x3b')]()]&&_0x2ec3bf['custom_fields'][_0xb82a('0x3f')]({'id':_0x43939f[_0xb82a('0x3d')],'value':_0x131856[_0x43939f[_0xb82a('0x44')][_0xb82a('0x45')]['toLowerCase']()][_0xb82a('0x2f')]()});}});}return _0x2ec3bf;}exports[_0xb82a('0x46')]=function(_0x1595f9,_0x2b876d,_0x2cb8d3,_0x8c1df5,_0x584843,_0xd518fe){var _0x166699,_0x5f1725;_0xd518fe[_0xb82a('0xd')]=intUtil['stripTrailingSlash'](_0xd518fe['remoteUri']);_0xd518fe[_0xb82a('0x47')]=intUtil[_0xb82a('0x48')](_0xd518fe[_0xb82a('0x47')]);if(_0x584843&&_0x584843[_0xb82a('0x49')]){logger[_0xb82a('0x13')](_0xb82a('0x4a'),_0xb82a('0x4b'));_0x2b876d[_0xb82a('0x4c')]=util[_0xb82a('0xc')](_0xb82a('0x4d'),_0xd518fe[_0xb82a('0x47')],_0x2b876d[_0xb82a('0x4e')],md5(_0x2b876d[_0xb82a('0x4e')]));}else{_0x2b876d[_0xb82a('0x4c')]='';}headers[_0xb82a('0x4f')]=getAuth(_0xd518fe);return getUser(_0xd518fe,_0x8c1df5[_0xb82a('0x50')])[_0xb82a('0x19')](function(_0x30db1c){_0x166699=_0x30db1c;logger[_0xb82a('0x13')](_0xb82a('0x51'),_0x166699['id']);return getEndUser(_0xd518fe,_0x2b876d[_0xb82a('0x52')],_0x2b876d['calleridnum']);})[_0xb82a('0x19')](function(_0x52e3ac){_0x5f1725=_0x52e3ac;logger[_0xb82a('0x13')]('The\x20Enduser\x20ID\x20is:',_0x5f1725['id']);return getTicket(_0xd518fe,_0x166699,_0x5f1725,_0x2cb8d3,_0x2b876d);})[_0xb82a('0x19')](function(_0x1f4c58){if(_0x1f4c58){logger['info'](_0xb82a('0x53'),_0x1f4c58['id']);switch(_0xd518fe[_0xb82a('0x3a')]){case'integrationTab':logger[_0xb82a('0x13')](_0xb82a('0x4a'),_0xb82a('0x54'));return request({'uri':util[_0xb82a('0xc')](_0xb82a('0x55'),_0xd518fe['remoteUri'],_0x166699['id'],_0x1f4c58['id']),'method':_0xb82a('0xe')});case _0xb82a('0x56'):logger[_0xb82a('0x13')]('[QUEUE]',_0xb82a('0x57'));emit(util['format'](_0xb82a('0x58'),_0x8c1df5[_0xb82a('0x45')]),_0xb82a('0x59'),{'uri':util[_0xb82a('0xc')](_0xb82a('0x5a'),_0xd518fe[_0xb82a('0xd')]['replace'](_0xb82a('0x5b'),''),_0x1f4c58['id'])});break;default:logger['error'](_0xb82a('0x4a'),_0xb82a('0x5c'));}}})[_0xb82a('0x5d')](function(_0x375912){logger[_0xb82a('0x5e')](_0xb82a('0x5f'),util[_0xb82a('0x60')](_0x375912,{'showHidden':!![],'depth':null}));});};exports[_0xb82a('0x61')]=function(_0x5b9950,_0x596032,_0x2cf764,_0x75fa7a,_0x578a5d,_0x5ea13d,_0x485fa8){var _0x10606c,_0x60031b;_0x5ea13d[_0xb82a('0xd')]=intUtil[_0xb82a('0x48')](_0x5ea13d[_0xb82a('0xd')]);_0x5ea13d['serverUrl']=intUtil[_0xb82a('0x48')](_0x5ea13d[_0xb82a('0x47')]);if(_0x485fa8&&_0x485fa8[_0xb82a('0x62')]&&_0x485fa8['recordingFormat']!=='none'){logger['info'](_0xb82a('0x63'),'Recording\x20is\x20enabled!');_0x596032[_0xb82a('0x4c')]=util[_0xb82a('0xc')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x5ea13d[_0xb82a('0x47')],_0x596032['uniqueid'],md5(_0x596032[_0xb82a('0x4e')]));}headers['Authorization']=getAuth(_0x5ea13d);return getUser(_0x5ea13d,_0x75fa7a[_0xb82a('0x50')])[_0xb82a('0x19')](function(_0x1e8fa7){_0x10606c=_0x1e8fa7;logger[_0xb82a('0x13')](_0xb82a('0x51'),_0x10606c['id']);return getEndUser(_0x5ea13d,_0x596032[_0xb82a('0x64')],_0x596032['destcalleridnum']);})['then'](function(_0x4a9d9d){_0x60031b=_0x4a9d9d;logger['info']('The\x20Enduser\x20ID\x20is:',_0x60031b['id']);return getTicket(_0x5ea13d,_0x10606c,_0x60031b,_0x2cf764,_0x596032);})[_0xb82a('0x19')](function(_0x174286){if(_0x174286){logger[_0xb82a('0x13')](_0xb82a('0x53'),_0x174286['id']);switch(_0x5ea13d[_0xb82a('0x3a')]){case'integrationTab':logger[_0xb82a('0x13')](_0xb82a('0x63'),'Displaying\x20ticket\x20to\x20agent...');return request({'uri':util['format']('%s/channels/voice/agents/%d/tickets/%d/display.json',_0x5ea13d[_0xb82a('0xd')],_0x10606c['id'],_0x174286['id']),'method':'POST'});case _0xb82a('0x56'):logger['info'](_0xb82a('0x63'),_0xb82a('0x57'));emit(util['format']('user:%s',_0x75fa7a[_0xb82a('0x45')]),_0xb82a('0x59'),{'uri':util[_0xb82a('0xc')](_0xb82a('0x5a'),_0x5ea13d[_0xb82a('0xd')][_0xb82a('0x65')](_0xb82a('0x5b'),''),_0x174286['id'])});break;default:logger[_0xb82a('0x5e')]('[OUTBOUND]',_0xb82a('0x5c'));}}})[_0xb82a('0x5d')](function(_0x48e9cb){logger['error']('[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration',util[_0xb82a('0x60')](_0x48e9cb,{'showHidden':!![],'depth':null}));});};exports[_0xb82a('0x66')]=function(_0x2c3c06,_0x1da3f6,_0x232509,_0x5d9c4f,_0x3d2444,_0x513882){var _0x492339,_0x49af75;_0x513882['remoteUri']=intUtil[_0xb82a('0x48')](_0x513882[_0xb82a('0xd')]);_0x513882[_0xb82a('0x47')]=intUtil[_0xb82a('0x48')](_0x513882[_0xb82a('0x47')]);if(_0x3d2444&&_0x3d2444[_0xb82a('0x49')]){logger['info']('['+_0x1da3f6[_0xb82a('0x67')][_0xb82a('0x68')]()+']',_0xb82a('0x4b'));_0x1da3f6[_0xb82a('0x4c')]=util['format'](_0xb82a('0x4d'),_0x513882['serverUrl'],_0x1da3f6[_0xb82a('0x4e')],md5(_0x1da3f6[_0xb82a('0x4e')]));}else{_0x1da3f6[_0xb82a('0x4c')]='';}headers['Authorization']=getAuth(_0x513882);return getUser(_0x513882)[_0xb82a('0x19')](function(_0x2183cc){_0x492339=_0x2183cc;logger[_0xb82a('0x13')](_0xb82a('0x51'),_0x492339['id']);return getEndUser(_0x513882,_0x1da3f6['calleridname'],_0x1da3f6[_0xb82a('0x69')]);})['then'](function(_0x28338d){_0x49af75=_0x28338d;logger[_0xb82a('0x13')](_0xb82a('0x6a'),_0x49af75['id']);return getTicket(_0x513882,_0x492339,_0x49af75,_0x232509,_0x1da3f6);})['then'](function(_0x39d7e5){if(_0x39d7e5){logger[_0xb82a('0x13')]('The\x20Ticket\x20ID\x20is:',_0x39d7e5['id']);}})['catch'](function(_0x484ad2){logger[_0xb82a('0x5e')]('['+_0x1da3f6[_0xb82a('0x67')][_0xb82a('0x68')]()+']'+_0xb82a('0x6b'),util['inspect'](_0x484ad2,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0xe8b5=['Variable','name','queue','stripTrailingSlash','serverUrl','monitor_format','Recording\x20is\x20enabled!','recordingURL','uniqueid','calleridnum','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','integrationTab','[QUEUE]','Displaying\x20ticket\x20to\x20agent...','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','%s/agent/tickets/%s','replace','/api/v2','error','Zendesk\x20account\x20type\x20not\x20recognized','catch','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','inspect','outbound','recordingFormat','none','[OUTBOUND]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','Authorization','email','The\x20User\x20ID\x20is:','destcalleridnum','%s/channels/voice/agents/%d/tickets/%d/display.json','trigger:browser:url','unmanaged','lastevent','toUpperCase','calleridname','lodash','md5','util','ioredis','./util','../../../../config/environment','../../../../config/logger','defaults','socket.io-emitter','emit','application/json','info','Creating\x20new\x20ticket...','format','%s/tickets.json','remoteUri','POST','merge','Tags','Subjects','getString','Descriptions','Fields','then','Ticket\x20created!','Getting\x20agent\x20with\x20email','%s/search.json','type:user\x20role:agent\x20email:%s','count','Agent\x20found!','results','agent','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me.json','Admin\x20account\x20selected.','user','Searching\x20enduser\x20with\x20phone','type:user\x20role:end-user\x20phone:%s','length','filter','end-user','Enduser\x20found!','Caller\x20-\x20%s','authType','password','%s:%s','username','token','%s/token:%s','Basic\x20%s','toString','debug','[HTTP]','stringify','GET','map','forEach','includes','string','picklist','type','nameField','customField','toLowerCase','content','custom_fields','push','idField','variable','variableName','customVariable'];(function(_0x25f4c1,_0x44497e){var _0x282b09=function(_0x4dc45a){while(--_0x4dc45a){_0x25f4c1['push'](_0x25f4c1['shift']());}};_0x282b09(++_0x44497e);}(_0xe8b5,0x109));var _0x5e8b=function(_0x4bd67a,_0x4f9725){_0x4bd67a=_0x4bd67a-0x0;var _0x2be5fb=_0xe8b5[_0x4bd67a];return _0x2be5fb;};'use strict';var _=require(_0x5e8b('0x0'));var rp=require('request-promise');var md5=require(_0x5e8b('0x1'));var util=require(_0x5e8b('0x2'));var Redis=require(_0x5e8b('0x3'));var intUtil=require(_0x5e8b('0x4'));var config=require(_0x5e8b('0x5'));var logger=require(_0x5e8b('0x6'))('zendesk');config['redis']=_[_0x5e8b('0x7')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x5e8b('0x8'))(new Redis(config['redis']));function emit(_0x28defc,_0x27418d,_0xa0aa4d){io['to'](_0x28defc)[_0x5e8b('0x9')](_0x27418d,_0xa0aa4d);}var headers={'Content-Type':_0x5e8b('0xa'),'Accept':'application/json'};function getTicket(_0x13da07,_0x3ef0da,_0x1f244b,_0xe245a8,_0x3dd25c){logger[_0x5e8b('0xb')](_0x5e8b('0xc'));return request({'uri':util[_0x5e8b('0xd')](_0x5e8b('0xe'),_0x13da07[_0x5e8b('0xf')]),'method':_0x5e8b('0x10'),'body':{'ticket':_[_0x5e8b('0x11')]({'requester_id':_0x1f244b['id'],'submitter_id':_0x3ef0da?_0x3ef0da['id']:undefined,'assignee_id':_0x3ef0da?_0x3ef0da['id']:undefined,'tags':getTags(_0xe245a8[_0x5e8b('0x12')],'name'),'subject':intUtil['getString'](_0xe245a8[_0x5e8b('0x13')],_0x3dd25c,'\x20'),'description':intUtil[_0x5e8b('0x14')](_0xe245a8[_0x5e8b('0x15')],_0x3dd25c,'\x0a'),'comment':{'public':![],'body':intUtil[_0x5e8b('0x14')](_0xe245a8['Descriptions'],_0x3dd25c,'\x0a')}},getCustomFields(_0xe245a8[_0x5e8b('0x16')],_0x3dd25c))}})[_0x5e8b('0x17')](function(_0x648fbe){logger[_0x5e8b('0xb')](_0x5e8b('0x18'));return _0x648fbe['ticket'];});}function getUser(_0x5cbca7,_0x504127){if(intUtil['validateEmail'](_0x504127)){logger['info'](_0x5e8b('0x19'),_0x504127);return request({'uri':util[_0x5e8b('0xd')](_0x5e8b('0x1a'),_0x5cbca7[_0x5e8b('0xf')]),'qs':{'query':util[_0x5e8b('0xd')](_0x5e8b('0x1b'),_0x504127)}})['then'](function(_0x3c3ceb){if(_0x3c3ceb[_0x5e8b('0x1c')]){logger[_0x5e8b('0xb')](_0x5e8b('0x1d'));return _['find'](_0x3c3ceb[_0x5e8b('0x1e')],{'email':_0x504127,'role':_0x5e8b('0x1f')});}else{logger[_0x5e8b('0xb')](_0x5e8b('0x20'));return request({'uri':util[_0x5e8b('0xd')](_0x5e8b('0x21'),_0x5cbca7[_0x5e8b('0xf')])})[_0x5e8b('0x17')](function(_0x25abca){logger['info']('Admin\x20account\x20selected.');return _0x25abca['user'];});}});}else{logger['info']('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0x5e8b('0xd')](_0x5e8b('0x21'),_0x5cbca7[_0x5e8b('0xf')])})[_0x5e8b('0x17')](function(_0xb5ed97){logger[_0x5e8b('0xb')](_0x5e8b('0x22'));return _0xb5ed97[_0x5e8b('0x23')];});}}function getEndUser(_0x21b0a5,_0x105532,_0x365f35){logger['info'](_0x5e8b('0x24'),_0x365f35);return request({'uri':util[_0x5e8b('0xd')]('%s/search.json',_0x21b0a5[_0x5e8b('0xf')]),'qs':{'query':util[_0x5e8b('0xd')](_0x5e8b('0x25'),_0x365f35)}})[_0x5e8b('0x17')](function(_0x5bb851){var _0x3f3ba0;if(_0x5bb851['results'][_0x5e8b('0x26')]){_0x5bb851[_0x5e8b('0x1e')]=_[_0x5e8b('0x27')](_0x5bb851[_0x5e8b('0x1e')],{'suspended':![],'role':_0x5e8b('0x28')});if(_0x5bb851[_0x5e8b('0x1e')][_0x5e8b('0x26')]){_0x3f3ba0=_['first'](_0x5bb851[_0x5e8b('0x1e')]);}}if(_0x3f3ba0){logger[_0x5e8b('0xb')](_0x5e8b('0x29'));return _0x3f3ba0;}else{logger[_0x5e8b('0xb')]('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'uri':util[_0x5e8b('0xd')]('%s/users.json',_0x21b0a5[_0x5e8b('0xf')]),'method':'POST','body':{'user':{'role':_0x5e8b('0x28'),'name':util[_0x5e8b('0xd')](_0x5e8b('0x2a'),_0x105532||_0x365f35),'phone':_0x365f35}}})[_0x5e8b('0x17')](function(_0x49a0d5){logger['info']('Enduser\x20created.');return _0x49a0d5[_0x5e8b('0x23')];});}});}function getAuth(_0x11b5c9){var _0x41cb5a;if(_0x11b5c9[_0x5e8b('0x2b')]===_0x5e8b('0x2c')){_0x41cb5a=util['format'](_0x5e8b('0x2d'),_0x11b5c9[_0x5e8b('0x2e')],_0x11b5c9['password']);}else if(_0x11b5c9[_0x5e8b('0x2b')]===_0x5e8b('0x2f')){_0x41cb5a=util['format'](_0x5e8b('0x30'),_0x11b5c9[_0x5e8b('0x2e')],_0x11b5c9[_0x5e8b('0x2f')]);}return util[_0x5e8b('0xd')](_0x5e8b('0x31'),new Buffer(_0x41cb5a)[_0x5e8b('0x32')]('base64'));}function request(_0x231055){logger[_0x5e8b('0x33')](_0x5e8b('0x34'),JSON[_0x5e8b('0x35')](_0x231055));return rp(_[_0x5e8b('0x7')](_0x231055,{'method':_0x5e8b('0x36'),'headers':headers,'json':!![]}));}function getTags(_0x89d25f,_0x186a7b){var _0x189c7a=[];if(_0x89d25f&&_0x89d25f['length']>0x0){_0x189c7a=_[_0x5e8b('0x37')](_0x89d25f,_0x186a7b);}return _0x189c7a;}function getCustomFields(_0x3c5a85,_0x33576c){var _0x56d883=[];var _0x3ac407={'custom_fields':[]};if(_0x3c5a85[_0x5e8b('0x26')]>0x0){_[_0x5e8b('0x38')](_0x3c5a85,function(_0xde1fcc){if(_[_0x5e8b('0x39')]([_0x5e8b('0x3a'),_0x5e8b('0x3b')],_0xde1fcc[_0x5e8b('0x3c')])&&_0xde1fcc[_0x5e8b('0x3d')]&&!_0xde1fcc[_0x5e8b('0x3e')]){_0x3ac407[_0xde1fcc[_0x5e8b('0x3d')][_0x5e8b('0x3f')]()]=_0xde1fcc[_0x5e8b('0x40')][_0x5e8b('0x32')]();}else if(_[_0x5e8b('0x39')](['string',_0x5e8b('0x3b')],_0xde1fcc[_0x5e8b('0x3c')])&&_0xde1fcc['idField']&&_0xde1fcc[_0x5e8b('0x3e')]){_0x3ac407[_0x5e8b('0x41')][_0x5e8b('0x42')]({'id':_0xde1fcc[_0x5e8b('0x43')],'value':_0xde1fcc[_0x5e8b('0x40')][_0x5e8b('0x32')]()});}else if(_0xde1fcc['type']===_0x5e8b('0x44')&&_0xde1fcc[_0x5e8b('0x45')]&&_0xde1fcc['idField']&&_0xde1fcc[_0x5e8b('0x3e')]){_0x33576c[_0xde1fcc['variableName']]&&_0x3ac407[_0x5e8b('0x41')][_0x5e8b('0x42')]({'id':_0xde1fcc[_0x5e8b('0x43')],'value':_0x33576c[_0xde1fcc[_0x5e8b('0x45')]][_0x5e8b('0x32')]()});}else if(_0xde1fcc[_0x5e8b('0x3c')]===_0x5e8b('0x46')&&_0xde1fcc[_0x5e8b('0x47')]&&_0xde1fcc[_0x5e8b('0x47')][_0x5e8b('0x48')]&&_0xde1fcc[_0x5e8b('0x43')]&&_0xde1fcc[_0x5e8b('0x3e')]){_0x33576c[_0xde1fcc[_0x5e8b('0x47')]['name']['toLowerCase']()]&&_0x3ac407[_0x5e8b('0x41')][_0x5e8b('0x42')]({'id':_0xde1fcc[_0x5e8b('0x43')],'value':_0x33576c[_0xde1fcc[_0x5e8b('0x47')][_0x5e8b('0x48')][_0x5e8b('0x3f')]()][_0x5e8b('0x32')]()});}});}return _0x3ac407;}exports[_0x5e8b('0x49')]=function(_0x23a9cd,_0x52d949,_0x8fb992,_0x396e06,_0x230cfa,_0x3aaf13){var _0x179aa6,_0x240be4;_0x3aaf13[_0x5e8b('0xf')]=intUtil[_0x5e8b('0x4a')](_0x3aaf13[_0x5e8b('0xf')]);_0x3aaf13[_0x5e8b('0x4b')]=intUtil['stripTrailingSlash'](_0x3aaf13[_0x5e8b('0x4b')]);if(_0x230cfa&&_0x230cfa[_0x5e8b('0x4c')]){logger['info']('[QUEUE]',_0x5e8b('0x4d'));_0x52d949[_0x5e8b('0x4e')]=util[_0x5e8b('0xd')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x3aaf13[_0x5e8b('0x4b')],_0x52d949[_0x5e8b('0x4f')],md5(_0x52d949['uniqueid']));}else{_0x52d949[_0x5e8b('0x4e')]='';}headers['Authorization']=getAuth(_0x3aaf13);return getUser(_0x3aaf13,_0x396e06['email'])[_0x5e8b('0x17')](function(_0x432bca){_0x179aa6=_0x432bca;logger['info']('The\x20User\x20ID\x20is:',_0x179aa6['id']);return getEndUser(_0x3aaf13,_0x52d949['calleridname'],_0x52d949[_0x5e8b('0x50')]);})[_0x5e8b('0x17')](function(_0x4414b3){_0x240be4=_0x4414b3;logger[_0x5e8b('0xb')](_0x5e8b('0x51'),_0x240be4['id']);return getTicket(_0x3aaf13,_0x179aa6,_0x240be4,_0x8fb992,_0x52d949);})[_0x5e8b('0x17')](function(_0x409d7c){if(_0x409d7c){logger['info'](_0x5e8b('0x52'),_0x409d7c['id']);switch(_0x3aaf13[_0x5e8b('0x3c')]){case _0x5e8b('0x53'):logger[_0x5e8b('0xb')](_0x5e8b('0x54'),_0x5e8b('0x55'));return request({'uri':util[_0x5e8b('0xd')]('%s/channels/voice/agents/%d/tickets/%d/display.json',_0x3aaf13[_0x5e8b('0xf')],_0x179aa6['id'],_0x409d7c['id']),'method':'POST'});case _0x5e8b('0x56'):logger[_0x5e8b('0xb')](_0x5e8b('0x54'),_0x5e8b('0x57'));emit(util['format'](_0x5e8b('0x58'),_0x396e06[_0x5e8b('0x48')]),'trigger:browser:url',{'uri':util[_0x5e8b('0xd')](_0x5e8b('0x59'),_0x3aaf13[_0x5e8b('0xf')][_0x5e8b('0x5a')](_0x5e8b('0x5b'),''),_0x409d7c['id'])});break;default:logger[_0x5e8b('0x5c')]('[QUEUE]',_0x5e8b('0x5d'));}}})[_0x5e8b('0x5e')](function(_0x489222){logger[_0x5e8b('0x5c')](_0x5e8b('0x5f'),util[_0x5e8b('0x60')](_0x489222,{'showHidden':!![],'depth':null}));});};exports[_0x5e8b('0x61')]=function(_0x592db2,_0x4fd493,_0x181ff0,_0x4717b9,_0xa8d108,_0x20fa43,_0x4f68ac){var _0x42f254,_0x23dd6c;_0x20fa43[_0x5e8b('0xf')]=intUtil[_0x5e8b('0x4a')](_0x20fa43['remoteUri']);_0x20fa43['serverUrl']=intUtil[_0x5e8b('0x4a')](_0x20fa43[_0x5e8b('0x4b')]);if(_0x4f68ac&&_0x4f68ac[_0x5e8b('0x62')]&&_0x4f68ac[_0x5e8b('0x62')]!==_0x5e8b('0x63')){logger['info'](_0x5e8b('0x64'),_0x5e8b('0x4d'));_0x4fd493['recordingURL']=util[_0x5e8b('0xd')](_0x5e8b('0x65'),_0x20fa43[_0x5e8b('0x4b')],_0x4fd493[_0x5e8b('0x4f')],md5(_0x4fd493[_0x5e8b('0x4f')]));}headers[_0x5e8b('0x66')]=getAuth(_0x20fa43);return getUser(_0x20fa43,_0x4717b9[_0x5e8b('0x67')])[_0x5e8b('0x17')](function(_0x46528d){_0x42f254=_0x46528d;logger[_0x5e8b('0xb')](_0x5e8b('0x68'),_0x42f254['id']);return getEndUser(_0x20fa43,_0x4fd493['destcalleridname'],_0x4fd493[_0x5e8b('0x69')]);})[_0x5e8b('0x17')](function(_0x55bcc9){_0x23dd6c=_0x55bcc9;logger[_0x5e8b('0xb')]('The\x20Enduser\x20ID\x20is:',_0x23dd6c['id']);return getTicket(_0x20fa43,_0x42f254,_0x23dd6c,_0x181ff0,_0x4fd493);})[_0x5e8b('0x17')](function(_0x1acf69){if(_0x1acf69){logger['info'](_0x5e8b('0x52'),_0x1acf69['id']);switch(_0x20fa43['type']){case _0x5e8b('0x53'):logger[_0x5e8b('0xb')]('[OUTBOUND]',_0x5e8b('0x55'));return request({'uri':util[_0x5e8b('0xd')](_0x5e8b('0x6a'),_0x20fa43[_0x5e8b('0xf')],_0x42f254['id'],_0x1acf69['id']),'method':'POST'});case _0x5e8b('0x56'):logger['info'](_0x5e8b('0x64'),_0x5e8b('0x57'));emit(util['format'](_0x5e8b('0x58'),_0x4717b9['name']),_0x5e8b('0x6b'),{'uri':util[_0x5e8b('0xd')]('%s/agent/tickets/%s',_0x20fa43[_0x5e8b('0xf')][_0x5e8b('0x5a')]('/api/v2',''),_0x1acf69['id'])});break;default:logger[_0x5e8b('0x5c')](_0x5e8b('0x64'),_0x5e8b('0x5d'));}}})[_0x5e8b('0x5e')](function(_0x50fd51){logger[_0x5e8b('0x5c')]('[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration',util[_0x5e8b('0x60')](_0x50fd51,{'showHidden':!![],'depth':null}));});};exports[_0x5e8b('0x6c')]=function(_0xa1c9df,_0x59fbd4,_0x5eb72e,_0xe3bafd,_0x5e6b93,_0x3eeca4){var _0x3f652e,_0x10690f;_0x3eeca4[_0x5e8b('0xf')]=intUtil[_0x5e8b('0x4a')](_0x3eeca4[_0x5e8b('0xf')]);_0x3eeca4[_0x5e8b('0x4b')]=intUtil['stripTrailingSlash'](_0x3eeca4['serverUrl']);if(_0x5e6b93&&_0x5e6b93[_0x5e8b('0x4c')]){logger[_0x5e8b('0xb')]('['+_0x59fbd4[_0x5e8b('0x6d')][_0x5e8b('0x6e')]()+']','Recording\x20is\x20enabled!');_0x59fbd4[_0x5e8b('0x4e')]=util[_0x5e8b('0xd')](_0x5e8b('0x65'),_0x3eeca4[_0x5e8b('0x4b')],_0x59fbd4[_0x5e8b('0x4f')],md5(_0x59fbd4['uniqueid']));}else{_0x59fbd4[_0x5e8b('0x4e')]='';}headers[_0x5e8b('0x66')]=getAuth(_0x3eeca4);return getUser(_0x3eeca4)['then'](function(_0x4b119e){_0x3f652e=_0x4b119e;logger['info'](_0x5e8b('0x68'),_0x3f652e['id']);return getEndUser(_0x3eeca4,_0x59fbd4[_0x5e8b('0x6f')],_0x59fbd4[_0x5e8b('0x50')]);})['then'](function(_0x1fdfd4){_0x10690f=_0x1fdfd4;logger[_0x5e8b('0xb')]('The\x20Enduser\x20ID\x20is:',_0x10690f['id']);return getTicket(_0x3eeca4,_0x3f652e,_0x10690f,_0x5eb72e,_0x59fbd4);})[_0x5e8b('0x17')](function(_0x830587){if(_0x830587){logger[_0x5e8b('0xb')]('The\x20Ticket\x20ID\x20is:',_0x830587['id']);}})['catch'](function(_0x292f40){logger[_0x5e8b('0x5c')]('['+_0x59fbd4[_0x5e8b('0x6d')][_0x5e8b('0x6e')]()+']'+'\x20Error\x20running\x20Zendesk\x20integration',util['inspect'](_0x292f40,{'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 3f10568..70d63c2 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 _0xa446=['abandoned','timeout','Timeout','Call_Start_Time','outbound','starttime','agentcalledAt','merge','Fields','Call\x20created!','err','stack','queue','host','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','/api/voice/recordings/','uniqueid','/downloads?type=uniqueid&token=','zoho.eu','com','calleridname','Inbound','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','https://crm.','/crm/EntityInfo.do?module=Calls&id=','recordingFormat','none','[OUTBOUND]','The\x20User\x20ID\x20is:','destcalleridname','destcalleridnum','Outbound','The\x20Call\x20ID\x20is:','unmanaged','lastevent','toUpperCase','calleridnum','lodash','request-promise','util','moment','bluebird','../../../../config/logger','zoho','redis','defaults','localhost','emit','debug','[HTTP]','stringify','length','includes','picklist','type','idField','content','toString','variable','variableName','customVariable','Variable','name','toLowerCase','isNil','access_token','isBefore','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','https://accounts.zoho.com.cn','POST','/oauth/v2/token','refreshToken','clientId','refresh_token','add','expires_in','seconds','catch','error','Search\x20user','GET','format','ActiveUsers','then','isArrayLikeObject','users','email','info','Using\x20the\x20admin\x20account!','findIndex','profile','Administrator','user','The\x20failing\x20result\x20is','data','https://www.zohoapis.','/crm/v2/','moduleCreate','role','last_name','Zoho-oauthtoken\x20','details','startCase','Error:\x20','log','CREATE\x20ERROR','moduleSearch','uri','/crm/v2/Contacts/search?criteria=((Phone:equals:','Contacts','Leads','nothing','lead','/crm/v2/Leads/search?criteria=((Phone:equals:','Creating\x20new\x20call...','Owner','administrator','first_name','Subject','getString','Subjects','Description','Descriptions','enduserType','Who_Id','Full_Name','First_Name','Last_Name','What_Id','$se_module','Call_Duration','utc','talktime','mm:ss','endtime','YYYY-MM-DDTHH:mm:ss','diff','called','Call_Result','Called','complete','Answered','Rejected'];(function(_0x5077c9,_0x3ecbbb){var _0x649f09=function(_0x587379){while(--_0x587379){_0x5077c9['push'](_0x5077c9['shift']());}};_0x649f09(++_0x3ecbbb);}(_0xa446,0xc6));var _0x6a44=function(_0xa1608a,_0x2db3de){_0xa1608a=_0xa1608a-0x0;var _0x1595f2=_0xa446[_0xa1608a];return _0x1595f2;};'use strict';var _=require(_0x6a44('0x0'));var rp=require(_0x6a44('0x1'));var md5=require('md5');var util=require(_0x6a44('0x2'));var intUtil=require('./util');var moment=require(_0x6a44('0x3'));var Redis=require('ioredis');var BPromise=require(_0x6a44('0x4'));var config=require('../../../../config/environment');var logger=require(_0x6a44('0x5'))(_0x6a44('0x6'));config[_0x6a44('0x7')]=_[_0x6a44('0x8')](config[_0x6a44('0x7')],{'host':_0x6a44('0x9'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x6a44('0x7')]));function emit(_0x36a426,_0x4f72f8,_0x78c684){io['to'](_0x36a426)[_0x6a44('0xa')](_0x4f72f8,_0x78c684);}function request(_0x5596eb){logger[_0x6a44('0xb')](_0x6a44('0xc'),JSON[_0x6a44('0xd')](_0x5596eb));return rp(_0x5596eb);}function getCustomFields(_0x2e07df,_0xb69bdd){var _0x159d5d={};if(_0x2e07df[_0x6a44('0xe')]>0x0){_['forEach'](_0x2e07df,function(_0xdecea8){if(_[_0x6a44('0xf')](['string',_0x6a44('0x10')],_0xdecea8[_0x6a44('0x11')])&&_0xdecea8[_0x6a44('0x12')]){_0x159d5d[_0xdecea8['idField']]=_0xdecea8[_0x6a44('0x13')][_0x6a44('0x14')]();}else if(_0xdecea8[_0x6a44('0x11')]===_0x6a44('0x15')&&_0xdecea8[_0x6a44('0x16')]&&_0xdecea8[_0x6a44('0x12')]&&_0xb69bdd[_0xdecea8['variableName']]){_0x159d5d[_0xdecea8['idField']]=_0xb69bdd[_0xdecea8[_0x6a44('0x16')]][_0x6a44('0x14')]();}else if(_0xdecea8['type']===_0x6a44('0x17')&&_0xdecea8[_0x6a44('0x18')]&&_0xdecea8[_0x6a44('0x18')][_0x6a44('0x19')]&&_0xdecea8[_0x6a44('0x12')]&&_0xb69bdd[_0xdecea8[_0x6a44('0x18')][_0x6a44('0x19')][_0x6a44('0x1a')]()]){_0x159d5d[_0xdecea8[_0x6a44('0x12')]]=_0xb69bdd[_0xdecea8[_0x6a44('0x18')][_0x6a44('0x19')][_0x6a44('0x1a')]()][_0x6a44('0x14')]();}});}return _0x159d5d;}function getName(_0x108c4b){if(_0x108c4b['indexOf']('\x20')>0x0){var _0x49ae81=_0x108c4b['split'](/ (.+)/);if(_0x49ae81[0x1]){return _0x49ae81;}}return[_0x108c4b,_0x108c4b];}var accountsTokens={};function getAccessToken(_0x2d279b){return new Promise(function(_0x19410f,_0x2ef3cf){if(!_[_0x6a44('0x1b')](accountsTokens[_0x2d279b['id']])&&!_['isNil'](accountsTokens[_0x2d279b['id']][_0x6a44('0x1c')])){if(moment()[_0x6a44('0x1d')](accountsTokens[_0x2d279b['id']]['expires_in'])){_0x19410f(accountsTokens[_0x2d279b['id']][_0x6a44('0x1c')]);}}var _0x24c04a;switch(_0x2d279b[_0x6a44('0x1e')]){case'US':_0x24c04a=_0x6a44('0x1f');break;case'AU':_0x24c04a=_0x6a44('0x20');break;case'EU':_0x24c04a=_0x6a44('0x21');break;case'IN':_0x24c04a=_0x6a44('0x22');break;case'CN':_0x24c04a=_0x6a44('0x23');break;default:_0x24c04a=_0x6a44('0x21');break;}var _0x4b5762={'method':_0x6a44('0x24'),'uri':_0x24c04a+_0x6a44('0x25'),'qs':{'refresh_token':_0x2d279b[_0x6a44('0x26')],'client_id':_0x2d279b[_0x6a44('0x27')],'client_secret':_0x2d279b['clientSecret'],'grant_type':_0x6a44('0x28')},'json':!![]};return rp(_0x4b5762)['then'](function(_0x3ad23e){accountsTokens[_0x2d279b['id']]={'access_token':_0x3ad23e[_0x6a44('0x1c')],'expires_in':moment()[_0x6a44('0x29')](_0x3ad23e[_0x6a44('0x2a')],_0x6a44('0x2b'))};_0x19410f(_0x3ad23e[_0x6a44('0x1c')]);})[_0x6a44('0x2c')](function(_0x3fc846){logger[_0x6a44('0x2d')]('Failing\x20creating\x20the\x20access_token',_0x3fc846['stack']);_0x2ef3cf(_0x3fc846);});});}function getUser(_0x265f9d,_0x5abc23,_0xaef746,_0x5b46cd){logger['info'](_0x6a44('0x2e'));return request({'method':_0x6a44('0x2f'),'uri':util[_0x6a44('0x30')]('https://www.zohoapis.%s/crm/v2/users',_0x5abc23),'qs':{'type':_0x6a44('0x31')},'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x265f9d},'json':!![]})[_0x6a44('0x32')](function(_0x2c0dcd){if(_0x2c0dcd['users']){var _0x58a1b4=-0x1;if(_[_0x6a44('0x33')](_0x2c0dcd[_0x6a44('0x34')])){if(!_[_0x6a44('0x1b')](_0x5b46cd)){_0x58a1b4=_['findIndex'](_0x2c0dcd['users'],function(_0xe98554){return _0xe98554[_0x6a44('0x35')]===_0x5b46cd;});}if(_0x58a1b4>=0x0){logger[_0x6a44('0x36')]('Agent\x20found!');}else{logger[_0x6a44('0x36')](_0x6a44('0x37'));_0x58a1b4=_[_0x6a44('0x38')](_0x2c0dcd[_0x6a44('0x34')],function(_0x3a2e5f){return _0x3a2e5f[_0x6a44('0x39')][_0x6a44('0x19')]===_0x6a44('0x3a');});}return _0x2c0dcd[_0x6a44('0x34')][_0x58a1b4];}else{if(_0x2c0dcd[_0x6a44('0x3b')][_0x6a44('0x39')][_0x6a44('0x19')]==='Administrator'){logger[_0x6a44('0x36')]('Using\x20the\x20admin\x20account!');user=_0x2c0dcd['user'];return user;}else{logger['error']('The\x20failing\x20result\x20is',JSON[_0x6a44('0xd')](_0x2c0dcd));throw new Error('Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20'+JSON[_0x6a44('0xd')](_0x2c0dcd));}}}else{logger['error'](_0x6a44('0x3c'),JSON[_0x6a44('0xd')](_0x2c0dcd));throw new Error('Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20'+JSON['stringify'](_0x2c0dcd));}})[_0x6a44('0x2c')](function(_0x3918b3){console[_0x6a44('0x2d')](_0x3918b3);});}function getZohoUser(_0x4a0611,_0x48d4bb){return new BPromise(function(_0x309237,_0xf7d957){request(_0x4a0611)[_0x6a44('0x32')](function(_0x4738cb){var _0x2c2d74=null;if(_0x4738cb){_0x2c2d74=_0x4738cb[_0x6a44('0x3d')][0x0];_0x2c2d74['enduserType']=_0x48d4bb;}_0x309237(_0x2c2d74);})[_0x6a44('0x2c')](function(_0x3b3adc){_0xf7d957(_0x3b3adc);});});}function createEndUser(_0x58d3bf,_0x334195,_0x4e3223,_0xcd852f,_0x527df6,_0x34dcc6){var _0x4e3223=getName(_0x4e3223);return request({'method':_0x6a44('0x24'),'uri':_0x6a44('0x3e')+_0x334195+_0x6a44('0x3f')+_['startCase'](_0x34dcc6[_0x6a44('0x40')])+'s','body':{'data':[{'Last_Name':_0x4e3223[0x1],'First_Name':_0x4e3223[0x0],'Phone':_0xcd852f,'Owner':{'name':!_[_0x6a44('0x1b')](_0x527df6[_0x6a44('0x41')]['name'])?_0x527df6[_0x6a44('0x41')][_0x6a44('0x19')]:!_['isNil'](_0x527df6['first_name'])?_0x527df6['first_name']+'\x20'+_0x527df6['last_name']:_0x527df6[_0x6a44('0x42')],'id':_0x527df6['id']}}]},'headers':{'Authorization':_0x6a44('0x43')+_0x58d3bf},'json':!![]})[_0x6a44('0x32')](function(_0x18315e){if(_0x18315e&&_0x18315e[_0x6a44('0x3d')][0x0]['code']==='SUCCESS'){var _0x25b742=_0x18315e[_0x6a44('0x3d')][0x0][_0x6a44('0x44')];_0x25b742['enduserType']=_[_0x6a44('0x45')](_0x34dcc6[_0x6a44('0x40')])+'s';return _0x25b742;}logger[_0x6a44('0x2d')]('The\x20failing\x20result\x20is',JSON[_0x6a44('0xd')](data));throw new Error(_0x6a44('0x46')+JSON[_0x6a44('0xd')](data));})[_0x6a44('0x2c')](function(_0xf91df9){console[_0x6a44('0x47')](_0x6a44('0x48'),_0xf91df9);});}function getEndUser(_0xb169f,_0x4bf874,_0xa74584,_0x3767c9,_0x2ccdbc,_0x446fbf,_0x1362c7){var _0x3fcb0b={'method':_0x6a44('0x2f'),'uri':'','headers':{'Authorization':_0x6a44('0x43')+_0xb169f},'json':!![]};switch(_0x1362c7[_0x6a44('0x49')]){case'contact_lead':_0x3fcb0b[_0x6a44('0x4a')]=_0x6a44('0x3e')+_0x4bf874+_0x6a44('0x4b')+_0x2ccdbc+'))';return getZohoUser(_0x3fcb0b,_0x6a44('0x4c'))[_0x6a44('0x32')](function(_0x215b77){if(_0x215b77)return _0x215b77;_0x3fcb0b[_0x6a44('0x4a')]=_0x6a44('0x3e')+_0x4bf874+'/crm/v2/Leads/search?criteria=((Phone:equals:'+_0x2ccdbc+'))';return getZohoUser(_0x3fcb0b,_0x6a44('0x4d'))[_0x6a44('0x32')](function(_0x59377e){if(_0x59377e)return _0x59377e;if(_0x1362c7['moduleCreate']!=_0x6a44('0x4e')){return createEndUser(_0xb169f,_0x4bf874,_0x3767c9,_0x2ccdbc,_0x446fbf,_0x1362c7);}else{return{};}});});break;case'contact':_0x3fcb0b['uri']=_0x6a44('0x3e')+_0x4bf874+_0x6a44('0x4b')+_0x2ccdbc+'))';return getZohoUser(_0x3fcb0b,'Contacts')['then'](function(_0x32fe47){if(_0x32fe47)return _0x32fe47;if(_0x1362c7[_0x6a44('0x40')]!='nothing'){return createEndUser(_0xb169f,_0x4bf874,_0x3767c9,_0x2ccdbc,_0x446fbf,_0x1362c7);}else{return{};}});break;case _0x6a44('0x4f'):_0x3fcb0b['uri']=_0x6a44('0x3e')+_0x4bf874+_0x6a44('0x50')+_0x2ccdbc+'))';return getZohoUser(_0x3fcb0b,_0x6a44('0x4d'))['then'](function(_0x52b343){if(_0x52b343)return _0x52b343;if(_0x1362c7['moduleCreate']!='nothing'){return createEndUser(_0xb169f,_0x4bf874,_0x3767c9,_0x2ccdbc,_0x446fbf,_0x1362c7);}else{return{};}});break;}}function getCall(_0x267fe8,_0xa393fc,_0x428a08,_0x21b457,_0x213478,_0x598d7a,_0x288224,_0x560ab2){logger[_0x6a44('0x36')](_0x6a44('0x51'));var _0x4a33d0={};_0x4a33d0[_0x6a44('0x52')]={'name':!_[_0x6a44('0x1b')](_0x21b457['role'][_0x6a44('0x19')])&&!_[_0x6a44('0x1b')](_0x21b457[_0x6a44('0x39')][_0x6a44('0x19')])&&_0x21b457[_0x6a44('0x39')][_0x6a44('0x19')]===_0x6a44('0x53')?_0x21b457[_0x6a44('0x41')][_0x6a44('0x19')]:!_[_0x6a44('0x1b')](_0x21b457['first_name'])?_0x21b457[_0x6a44('0x54')]+'\x20'+_0x21b457['last_name']:_0x21b457[_0x6a44('0x42')],'id':_0x21b457['id']};_0x4a33d0[_0x6a44('0x55')]=intUtil[_0x6a44('0x56')](_0x598d7a[_0x6a44('0x57')],_0x288224,'\x20');_0x4a33d0[_0x6a44('0x58')]=intUtil['getString'](_0x598d7a[_0x6a44('0x59')],_0x288224,'\x0a');if(_0x213478[_0x6a44('0x5a')]===_0x6a44('0x4c')){_0x4a33d0[_0x6a44('0x5b')]={'name':!_[_0x6a44('0x1b')](_0x213478[_0x6a44('0x5c')])?_0x213478[_0x6a44('0x5c')]:!_[_0x6a44('0x1b')](_0x213478[_0x6a44('0x5d')])?_0x213478[_0x6a44('0x5d')]+'\x20'+_0x213478[_0x6a44('0x5e')]:_0x213478['Last_Name'],'id':_0x213478['id']};}if(_0x213478[_0x6a44('0x5a')]===_0x6a44('0x4d')){_0x4a33d0[_0x6a44('0x5f')]={'name':!_[_0x6a44('0x1b')](_0x213478[_0x6a44('0x5c')])?_0x213478[_0x6a44('0x5c')]:!_[_0x6a44('0x1b')](_0x213478[_0x6a44('0x5d')])?_0x213478[_0x6a44('0x5d')]+'\x20'+_0x213478['Last_Name']:_0x213478[_0x6a44('0x5e')],'id':_0x213478['id']};_0x4a33d0[_0x6a44('0x60')]=_[_0x6a44('0x45')](_0x213478[_0x6a44('0x5a')]);}if(_0x288224['talktime']){_0x4a33d0[_0x6a44('0x61')]=moment[_0x6a44('0x62')](parseInt(_0x288224[_0x6a44('0x63')])*0x3e8)['format'](_0x6a44('0x64'));}else if(_0x288224['answertime']&&_0x288224['endtime']){_0x4a33d0[_0x6a44('0x61')]=moment[_0x6a44('0x62')](moment(_0x288224[_0x6a44('0x65')],_0x6a44('0x66'))[_0x6a44('0x67')](moment(_0x288224['starttime'],_0x6a44('0x66'))))[_0x6a44('0x30')]('mm:ss');}switch(_0x288224['lastevent']){case _0x6a44('0x68'):_0x4a33d0[_0x6a44('0x69')]=_0x6a44('0x6a');break;case _0x6a44('0x6b'):case'connect':_0x4a33d0[_0x6a44('0x69')]=_0x6a44('0x6c');break;case'rejected':_0x4a33d0['Call_Result']=_0x6a44('0x6d');break;case _0x6a44('0x6e'):_0x4a33d0[_0x6a44('0x69')]='Abandoned';break;case _0x6a44('0x6f'):_0x4a33d0[_0x6a44('0x69')]=_0x6a44('0x70');default:}_0x4a33d0[_0x6a44('0x71')]=(_0x560ab2===_0x6a44('0x72')?moment(_0x288224[_0x6a44('0x73')])['format'](_0x6a44('0x66')):moment(_0x288224[_0x6a44('0x74')])['format'](_0x6a44('0x66')))||moment()[_0x6a44('0x30')](_0x6a44('0x66'));_0x4a33d0['Call_Type']=_0x560ab2||'Inbound';_0x4a33d0=_[_0x6a44('0x75')](_0x4a33d0,getCustomFields(_0x598d7a[_0x6a44('0x76')],_0x288224));return request({'method':'POST','uri':_0x6a44('0x3e')+_0xa393fc+'/crm/v2/Calls','headers':{'Authorization':_0x6a44('0x43')+_0x267fe8},'body':{'data':[_0x4a33d0]},'json':!![]})[_0x6a44('0x32')](function(_0x3a46b2){if(_0x3a46b2&&_0x3a46b2[_0x6a44('0x3d')][0x0]['code']==='SUCCESS'){logger[_0x6a44('0x36')](_0x6a44('0x77'));return{'id':_0x3a46b2[_0x6a44('0x3d')][0x0][_0x6a44('0x44')]['id']};}})[_0x6a44('0x2c')](function(_0x15a310){logger[_0x6a44('0x36')](_0x6a44('0x78'),_0x15a310[_0x6a44('0x79')]);console[_0x6a44('0x47')](_0x6a44('0x78'),_0x15a310);});}exports[_0x6a44('0x7a')]=function(_0x19de84,_0x238eb3,_0x1490be,_0xfee628,_0x2f4d68,_0x38238e){var _0x566c17,_0x35459e,_0x5374f2;_0x38238e[_0x6a44('0x7b')]=intUtil[_0x6a44('0x7c')](_0x38238e[_0x6a44('0x7b')]);_0x38238e[_0x6a44('0x7d')]=intUtil['stripTrailingSlash'](_0x38238e[_0x6a44('0x7d')]);if(_0x2f4d68&&_0x2f4d68[_0x6a44('0x7e')]){logger[_0x6a44('0x36')](_0x6a44('0x7f'),_0x6a44('0x80'));_0x238eb3[_0x6a44('0x81')]=_0x38238e['serverUrl']+_0x6a44('0x82')+_0x238eb3[_0x6a44('0x83')]+_0x6a44('0x84')+md5(_0x238eb3[_0x6a44('0x83')]);}else{_0x238eb3[_0x6a44('0x81')]='';}var _0x13aead=_0x38238e['host']===_0x6a44('0x85')?'eu':_0x6a44('0x86');return getAccessToken(_0x38238e)['then'](function(_0x36543d){_0x5374f2=_0x36543d;return getUser(_0x5374f2,_0x13aead,_0x38238e,_0xfee628[_0x6a44('0x35')]);})[_0x6a44('0x32')](function(_0x4cd9f5){_0x566c17=_0x4cd9f5;logger[_0x6a44('0x36')]('The\x20User\x20ID\x20is:',_0x566c17['id']);return getEndUser(_0x5374f2,_0x13aead,_0x38238e,_0x238eb3[_0x6a44('0x87')],_0x238eb3['calleridnum'],_0x566c17,_0x1490be);})[_0x6a44('0x32')](function(_0x5a5d31){_0x35459e=_0x5a5d31;return getCall(_0x5374f2,_0x13aead,_0x38238e,_0x566c17,_0x35459e,_0x1490be,_0x238eb3,_0x6a44('0x88'));})[_0x6a44('0x32')](function(_0xeba1e2){if(_0xeba1e2){logger['info']('The\x20Call\x20ID\x20is:',_0xeba1e2['id']);logger[_0x6a44('0x36')](_0x6a44('0x7f'),_0x6a44('0x89'));emit(util[_0x6a44('0x30')](_0x6a44('0x8a'),_0xfee628['name']),_0x6a44('0x8b'),{'uri':_0x6a44('0x8c')+_0x38238e[_0x6a44('0x7b')]+_0x6a44('0x8d')+_0xeba1e2['id']});}})[_0x6a44('0x2c')](function(_0x3580b0){logger[_0x6a44('0x2d')]('[QUEUE]',JSON[_0x6a44('0xd')](_0x3580b0));});};exports[_0x6a44('0x72')]=function(_0x2ec199,_0x7c3bc7,_0x1c3f75,_0x188ca8,_0x1fb454,_0x2f383e,_0x13f364){var _0x49d513,_0x4781fb,_0x4d9102;_0x2f383e['host']=intUtil['stripTrailingSlash'](_0x2f383e[_0x6a44('0x7b')]);_0x2f383e[_0x6a44('0x7d')]=intUtil[_0x6a44('0x7c')](_0x2f383e[_0x6a44('0x7d')]);if(_0x13f364&&_0x13f364[_0x6a44('0x8e')]&&_0x13f364['recordingFormat']!==_0x6a44('0x8f')){logger['info'](_0x6a44('0x90'),_0x6a44('0x80'));_0x7c3bc7[_0x6a44('0x81')]=_0x2f383e['serverUrl']+_0x6a44('0x82')+_0x7c3bc7[_0x6a44('0x83')]+_0x6a44('0x84')+md5(_0x7c3bc7[_0x6a44('0x83')]);}var _0x114eb0=_0x2f383e[_0x6a44('0x7b')]==='zoho.eu'?'eu':_0x6a44('0x86');return getAccessToken(_0x2f383e)['then'](function(_0x48fec3){_0x4d9102=_0x48fec3;return getUser(_0x4d9102,_0x114eb0,_0x2f383e,_0x188ca8[_0x6a44('0x35')]);})[_0x6a44('0x32')](function(_0x51880a){_0x49d513=_0x51880a;logger['info'](_0x6a44('0x91'),_0x49d513['id']);return getEndUser(_0x4d9102,_0x114eb0,_0x2f383e,_0x7c3bc7[_0x6a44('0x92')],_0x7c3bc7[_0x6a44('0x93')],_0x49d513,_0x1c3f75);})[_0x6a44('0x32')](function(_0x1d312c){_0x4781fb=_0x1d312c;return getCall(_0x4d9102,_0x114eb0,_0x2f383e,_0x49d513,_0x4781fb,_0x1c3f75,_0x7c3bc7,_0x6a44('0x94'));})[_0x6a44('0x32')](function(_0x110922){if(_0x110922){logger[_0x6a44('0x36')](_0x6a44('0x95'),_0x110922['id']);logger[_0x6a44('0x36')](_0x6a44('0x90'),_0x6a44('0x89'));emit(util[_0x6a44('0x30')](_0x6a44('0x8a'),_0x188ca8[_0x6a44('0x19')]),'trigger:browser:url',{'uri':_0x6a44('0x8c')+_0x2f383e[_0x6a44('0x7b')]+'/crm/EntityInfo.do?module=Calls&id='+_0x110922['id']});}})[_0x6a44('0x2c')](function(_0x38fcb1){logger['error'](_0x6a44('0x90'),JSON['stringify'](_0x38fcb1));});};exports[_0x6a44('0x96')]=function(_0x3bd5a3,_0x350915,_0x2b22f3,_0x3e3513,_0x159c82,_0x4aac1c){var _0x437f5b,_0x3d45ad,_0x455bea;_0x4aac1c[_0x6a44('0x7b')]=intUtil['stripTrailingSlash'](_0x4aac1c[_0x6a44('0x7b')]);_0x4aac1c[_0x6a44('0x7d')]=intUtil[_0x6a44('0x7c')](_0x4aac1c[_0x6a44('0x7d')]);if(_0x159c82&&_0x159c82['monitor_format']){logger[_0x6a44('0x36')]('['+_0x350915[_0x6a44('0x97')][_0x6a44('0x98')]()+']',_0x6a44('0x80'));_0x350915[_0x6a44('0x81')]=_0x4aac1c[_0x6a44('0x7d')]+_0x6a44('0x82')+_0x350915[_0x6a44('0x83')]+_0x6a44('0x84')+md5(_0x350915[_0x6a44('0x83')]);}else{_0x350915[_0x6a44('0x81')]='';}var _0x33931c=_0x4aac1c['host']===_0x6a44('0x85')?'eu':_0x6a44('0x86');return getAccessToken(_0x4aac1c)['then'](function(_0xd00b93){_0x455bea=_0xd00b93;return getUser(_0x455bea,_0x33931c,_0x4aac1c);})[_0x6a44('0x32')](function(_0x4e2a6c){_0x437f5b=_0x4e2a6c;logger[_0x6a44('0x36')](_0x6a44('0x91'),_0x437f5b['id']);return getEndUser(_0x455bea,_0x33931c,_0x4aac1c,_0x350915[_0x6a44('0x87')],_0x350915[_0x6a44('0x99')],_0x437f5b,_0x2b22f3);})[_0x6a44('0x32')](function(_0x8b9d16){_0x3d45ad=_0x8b9d16;return getCall(_0x455bea,_0x33931c,_0x4aac1c,_0x437f5b,_0x3d45ad,_0x2b22f3,_0x350915,_0x6a44('0x88'));})[_0x6a44('0x32')](function(_0x149fc3){if(_0x149fc3){logger[_0x6a44('0x36')](_0x6a44('0x95'),_0x149fc3['id']);}})[_0x6a44('0x2c')](function(_0xcc57b0){logger[_0x6a44('0x2d')]('['+_0x350915[_0x6a44('0x97')][_0x6a44('0x98')]()+']',JSON[_0x6a44('0xd')](_0xcc57b0));});}; \ No newline at end of file +var _0x544a=['toLowerCase','indexOf','split','isNil','expires_in','access_token','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','POST','/oauth/v2/token','refreshToken','clientId','clientSecret','then','add','seconds','catch','error','info','Search\x20user','format','https://www.zohoapis.%s/crm/v2/users','users','isArrayLikeObject','findIndex','Agent\x20found!','Using\x20the\x20admin\x20account!','profile','user','Administrator','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','stringify','The\x20failing\x20result\x20is','data','enduserType','https://www.zohoapis.','moduleCreate','role','first_name','last_name','Zoho-oauthtoken\x20','code','SUCCESS','details','startCase','Error:\x20','CREATE\x20ERROR','GET','moduleSearch','contact_lead','uri','/crm/v2/Contacts/search?criteria=((Phone:equals:','Leads','nothing','contact','lead','/crm/v2/Leads/search?criteria=((Phone:equals:','Creating\x20new\x20call...','Owner','administrator','Subjects','getString','Contacts','Who_Id','Full_Name','First_Name','Last_Name','$se_module','talktime','Call_Duration','utc','answertime','endtime','YYYY-MM-DDTHH:mm:ss','diff','starttime','lastevent','Called','complete','Call_Result','Answered','rejected','Rejected','abandoned','Abandoned','timeout','Call_Start_Time','outbound','agentcalledAt','merge','Fields','/crm/v2/Calls','err','stack','log','queue','host','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','recordingURL','/api/voice/recordings/','/downloads?type=uniqueid&token=','uniqueid','com','The\x20User\x20ID\x20is:','calleridnum','Inbound','The\x20Call\x20ID\x20is:','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','https://crm.','/crm/EntityInfo.do?module=Calls&id=','recordingFormat','none','[OUTBOUND]','zoho.eu','email','destcalleridname','destcalleridnum','trigger:browser:url','unmanaged','toUpperCase','Recording\x20is\x20enabled!','lodash','request-promise','md5','moment','ioredis','bluebird','../../../../config/environment','defaults','redis','localhost','emit','debug','[HTTP]','length','forEach','includes','idField','variable','variableName','toString','type','customVariable','Variable','name'];(function(_0x58dc86,_0x361cef){var _0xe1857f=function(_0x23b1ac){while(--_0x23b1ac){_0x58dc86['push'](_0x58dc86['shift']());}};_0xe1857f(++_0x361cef);}(_0x544a,0x118));var _0xa544=function(_0x5bdcc4,_0x84ac61){_0x5bdcc4=_0x5bdcc4-0x0;var _0x482ed2=_0x544a[_0x5bdcc4];return _0x482ed2;};'use strict';var _=require(_0xa544('0x0'));var rp=require(_0xa544('0x1'));var md5=require(_0xa544('0x2'));var util=require('util');var intUtil=require('./util');var moment=require(_0xa544('0x3'));var Redis=require(_0xa544('0x4'));var BPromise=require(_0xa544('0x5'));var config=require(_0xa544('0x6'));var logger=require('../../../../config/logger')('zoho');config['redis']=_[_0xa544('0x7')](config[_0xa544('0x8')],{'host':_0xa544('0x9'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xa544('0x8')]));function emit(_0x13ce7a,_0x35abfd,_0x4a0b98){io['to'](_0x13ce7a)[_0xa544('0xa')](_0x35abfd,_0x4a0b98);}function request(_0x3066dd){logger[_0xa544('0xb')](_0xa544('0xc'),JSON['stringify'](_0x3066dd));return rp(_0x3066dd);}function getCustomFields(_0x295267,_0x1c961e){var _0xee3ce7={};if(_0x295267[_0xa544('0xd')]>0x0){_[_0xa544('0xe')](_0x295267,function(_0x49e946){if(_[_0xa544('0xf')](['string','picklist'],_0x49e946['type'])&&_0x49e946[_0xa544('0x10')]){_0xee3ce7[_0x49e946[_0xa544('0x10')]]=_0x49e946['content']['toString']();}else if(_0x49e946['type']===_0xa544('0x11')&&_0x49e946[_0xa544('0x12')]&&_0x49e946[_0xa544('0x10')]&&_0x1c961e[_0x49e946['variableName']]){_0xee3ce7[_0x49e946[_0xa544('0x10')]]=_0x1c961e[_0x49e946[_0xa544('0x12')]][_0xa544('0x13')]();}else if(_0x49e946[_0xa544('0x14')]===_0xa544('0x15')&&_0x49e946[_0xa544('0x16')]&&_0x49e946['Variable'][_0xa544('0x17')]&&_0x49e946[_0xa544('0x10')]&&_0x1c961e[_0x49e946['Variable']['name'][_0xa544('0x18')]()]){_0xee3ce7[_0x49e946[_0xa544('0x10')]]=_0x1c961e[_0x49e946[_0xa544('0x16')][_0xa544('0x17')][_0xa544('0x18')]()][_0xa544('0x13')]();}});}return _0xee3ce7;}function getName(_0x1c9b5d){if(_0x1c9b5d[_0xa544('0x19')]('\x20')>0x0){var _0x34ed6d=_0x1c9b5d[_0xa544('0x1a')](/ (.+)/);if(_0x34ed6d[0x1]){return _0x34ed6d;}}return[_0x1c9b5d,_0x1c9b5d];}var accountsTokens={};function getAccessToken(_0x19912e){return new Promise(function(_0x317d10,_0x415637){if(!_[_0xa544('0x1b')](accountsTokens[_0x19912e['id']])&&!_[_0xa544('0x1b')](accountsTokens[_0x19912e['id']]['access_token'])){if(moment()['isBefore'](accountsTokens[_0x19912e['id']][_0xa544('0x1c')])){_0x317d10(accountsTokens[_0x19912e['id']][_0xa544('0x1d')]);}}var _0x52e614;switch(_0x19912e[_0xa544('0x1e')]){case'US':_0x52e614=_0xa544('0x1f');break;case'AU':_0x52e614=_0xa544('0x20');break;case'EU':_0x52e614=_0xa544('0x21');break;case'IN':_0x52e614=_0xa544('0x22');break;case'CN':_0x52e614='https://accounts.zoho.com.cn';break;default:_0x52e614='https://accounts.zoho.eu';break;}var _0xe9bea3={'method':_0xa544('0x23'),'uri':_0x52e614+_0xa544('0x24'),'qs':{'refresh_token':_0x19912e[_0xa544('0x25')],'client_id':_0x19912e[_0xa544('0x26')],'client_secret':_0x19912e[_0xa544('0x27')],'grant_type':'refresh_token'},'json':!![]};return rp(_0xe9bea3)[_0xa544('0x28')](function(_0x3ec847){accountsTokens[_0x19912e['id']]={'access_token':_0x3ec847[_0xa544('0x1d')],'expires_in':moment()[_0xa544('0x29')](_0x3ec847[_0xa544('0x1c')],_0xa544('0x2a'))};_0x317d10(_0x3ec847[_0xa544('0x1d')]);})[_0xa544('0x2b')](function(_0x3f422d){logger[_0xa544('0x2c')]('Failing\x20creating\x20the\x20access_token',_0x3f422d['stack']);_0x415637(_0x3f422d);});});}function getUser(_0x1360e2,_0x416e88,_0x28d835,_0xe9357a){logger[_0xa544('0x2d')](_0xa544('0x2e'));return request({'method':'GET','uri':util[_0xa544('0x2f')](_0xa544('0x30'),_0x416e88),'qs':{'type':'ActiveUsers'},'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x1360e2},'json':!![]})['then'](function(_0x424065){if(_0x424065[_0xa544('0x31')]){var _0x83bfb2=-0x1;if(_[_0xa544('0x32')](_0x424065[_0xa544('0x31')])){if(!_['isNil'](_0xe9357a)){_0x83bfb2=_[_0xa544('0x33')](_0x424065[_0xa544('0x31')],function(_0x314c56){return _0x314c56['email']===_0xe9357a;});}if(_0x83bfb2>=0x0){logger[_0xa544('0x2d')](_0xa544('0x34'));}else{logger[_0xa544('0x2d')](_0xa544('0x35'));_0x83bfb2=_[_0xa544('0x33')](_0x424065[_0xa544('0x31')],function(_0x5915ba){return _0x5915ba[_0xa544('0x36')][_0xa544('0x17')]==='Administrator';});}return _0x424065['users'][_0x83bfb2];}else{if(_0x424065[_0xa544('0x37')][_0xa544('0x36')][_0xa544('0x17')]===_0xa544('0x38')){logger[_0xa544('0x2d')](_0xa544('0x35'));user=_0x424065[_0xa544('0x37')];return user;}else{logger[_0xa544('0x2c')]('The\x20failing\x20result\x20is',JSON['stringify'](_0x424065));throw new Error(_0xa544('0x39')+JSON[_0xa544('0x3a')](_0x424065));}}}else{logger[_0xa544('0x2c')](_0xa544('0x3b'),JSON[_0xa544('0x3a')](_0x424065));throw new Error(_0xa544('0x39')+JSON[_0xa544('0x3a')](_0x424065));}})[_0xa544('0x2b')](function(_0xe54eb1){console[_0xa544('0x2c')](_0xe54eb1);});}function getZohoUser(_0x5ed660,_0x5b0730){return new BPromise(function(_0x57a4d0,_0x53eabc){request(_0x5ed660)[_0xa544('0x28')](function(_0x1f912c){var _0x3c6ed3=null;if(_0x1f912c){_0x3c6ed3=_0x1f912c[_0xa544('0x3c')][0x0];_0x3c6ed3[_0xa544('0x3d')]=_0x5b0730;}_0x57a4d0(_0x3c6ed3);})[_0xa544('0x2b')](function(_0x195079){_0x53eabc(_0x195079);});});}function createEndUser(_0x5d6441,_0x55ba3f,_0x586b02,_0x42d9b6,_0x20b5f1,_0x527a3b){var _0x586b02=getName(_0x586b02);return request({'method':'POST','uri':_0xa544('0x3e')+_0x55ba3f+'/crm/v2/'+_['startCase'](_0x527a3b[_0xa544('0x3f')])+'s','body':{'data':[{'Last_Name':_0x586b02[0x1],'First_Name':_0x586b02[0x0],'Phone':_0x42d9b6,'Owner':{'name':!_[_0xa544('0x1b')](_0x20b5f1[_0xa544('0x40')][_0xa544('0x17')])?_0x20b5f1[_0xa544('0x40')][_0xa544('0x17')]:!_[_0xa544('0x1b')](_0x20b5f1[_0xa544('0x41')])?_0x20b5f1[_0xa544('0x41')]+'\x20'+_0x20b5f1[_0xa544('0x42')]:_0x20b5f1['last_name'],'id':_0x20b5f1['id']}}]},'headers':{'Authorization':_0xa544('0x43')+_0x5d6441},'json':!![]})[_0xa544('0x28')](function(_0x2dd803){if(_0x2dd803&&_0x2dd803[_0xa544('0x3c')][0x0][_0xa544('0x44')]===_0xa544('0x45')){var _0x13eb1e=_0x2dd803['data'][0x0][_0xa544('0x46')];_0x13eb1e[_0xa544('0x3d')]=_[_0xa544('0x47')](_0x527a3b['moduleCreate'])+'s';return _0x13eb1e;}logger['error'](_0xa544('0x3b'),JSON['stringify'](data));throw new Error(_0xa544('0x48')+JSON[_0xa544('0x3a')](data));})[_0xa544('0x2b')](function(_0x2048f8){console['log'](_0xa544('0x49'),_0x2048f8);});}function getEndUser(_0xb2b4c8,_0x48c333,_0x356b3e,_0x1567f8,_0x447249,_0x34511d,_0x18c457){var _0x4d26dc={'method':_0xa544('0x4a'),'uri':'','headers':{'Authorization':_0xa544('0x43')+_0xb2b4c8},'json':!![]};switch(_0x18c457[_0xa544('0x4b')]){case _0xa544('0x4c'):_0x4d26dc[_0xa544('0x4d')]='https://www.zohoapis.'+_0x48c333+_0xa544('0x4e')+_0x447249+'))';return getZohoUser(_0x4d26dc,'Contacts')['then'](function(_0x1a8e51){if(_0x1a8e51)return _0x1a8e51;_0x4d26dc[_0xa544('0x4d')]=_0xa544('0x3e')+_0x48c333+'/crm/v2/Leads/search?criteria=((Phone:equals:'+_0x447249+'))';return getZohoUser(_0x4d26dc,_0xa544('0x4f'))[_0xa544('0x28')](function(_0x2b0f4a){if(_0x2b0f4a)return _0x2b0f4a;if(_0x18c457[_0xa544('0x3f')]!=_0xa544('0x50')){return createEndUser(_0xb2b4c8,_0x48c333,_0x1567f8,_0x447249,_0x34511d,_0x18c457);}else{return{};}});});break;case _0xa544('0x51'):_0x4d26dc[_0xa544('0x4d')]='https://www.zohoapis.'+_0x48c333+_0xa544('0x4e')+_0x447249+'))';return getZohoUser(_0x4d26dc,'Contacts')[_0xa544('0x28')](function(_0x359333){if(_0x359333)return _0x359333;if(_0x18c457[_0xa544('0x3f')]!='nothing'){return createEndUser(_0xb2b4c8,_0x48c333,_0x1567f8,_0x447249,_0x34511d,_0x18c457);}else{return{};}});break;case _0xa544('0x52'):_0x4d26dc[_0xa544('0x4d')]=_0xa544('0x3e')+_0x48c333+_0xa544('0x53')+_0x447249+'))';return getZohoUser(_0x4d26dc,_0xa544('0x4f'))[_0xa544('0x28')](function(_0x54e052){if(_0x54e052)return _0x54e052;if(_0x18c457['moduleCreate']!=_0xa544('0x50')){return createEndUser(_0xb2b4c8,_0x48c333,_0x1567f8,_0x447249,_0x34511d,_0x18c457);}else{return{};}});break;}}function getCall(_0x5dad55,_0xbd97eb,_0x3fc50e,_0x57e817,_0x265224,_0x360d50,_0x227587,_0x1c6865){logger[_0xa544('0x2d')](_0xa544('0x54'));var _0x7a4f3a={};_0x7a4f3a[_0xa544('0x55')]={'name':!_[_0xa544('0x1b')](_0x57e817[_0xa544('0x40')][_0xa544('0x17')])&&!_[_0xa544('0x1b')](_0x57e817['profile']['name'])&&_0x57e817[_0xa544('0x36')][_0xa544('0x17')]===_0xa544('0x56')?_0x57e817['role']['name']:!_['isNil'](_0x57e817[_0xa544('0x41')])?_0x57e817[_0xa544('0x41')]+'\x20'+_0x57e817['last_name']:_0x57e817[_0xa544('0x42')],'id':_0x57e817['id']};_0x7a4f3a['Subject']=intUtil['getString'](_0x360d50[_0xa544('0x57')],_0x227587,'\x20');_0x7a4f3a['Description']=intUtil[_0xa544('0x58')](_0x360d50['Descriptions'],_0x227587,'\x0a');if(_0x265224['enduserType']===_0xa544('0x59')){_0x7a4f3a[_0xa544('0x5a')]={'name':!_['isNil'](_0x265224[_0xa544('0x5b')])?_0x265224[_0xa544('0x5b')]:!_['isNil'](_0x265224[_0xa544('0x5c')])?_0x265224[_0xa544('0x5c')]+'\x20'+_0x265224[_0xa544('0x5d')]:_0x265224[_0xa544('0x5d')],'id':_0x265224['id']};}if(_0x265224[_0xa544('0x3d')]===_0xa544('0x4f')){_0x7a4f3a['What_Id']={'name':!_[_0xa544('0x1b')](_0x265224['Full_Name'])?_0x265224[_0xa544('0x5b')]:!_[_0xa544('0x1b')](_0x265224[_0xa544('0x5c')])?_0x265224[_0xa544('0x5c')]+'\x20'+_0x265224[_0xa544('0x5d')]:_0x265224[_0xa544('0x5d')],'id':_0x265224['id']};_0x7a4f3a[_0xa544('0x5e')]=_[_0xa544('0x47')](_0x265224[_0xa544('0x3d')]);}if(_0x227587[_0xa544('0x5f')]){_0x7a4f3a[_0xa544('0x60')]=moment[_0xa544('0x61')](parseInt(_0x227587[_0xa544('0x5f')])*0x3e8)[_0xa544('0x2f')]('mm:ss');}else if(_0x227587[_0xa544('0x62')]&&_0x227587[_0xa544('0x63')]){_0x7a4f3a['Call_Duration']=moment[_0xa544('0x61')](moment(_0x227587['endtime'],_0xa544('0x64'))[_0xa544('0x65')](moment(_0x227587[_0xa544('0x66')],'YYYY-MM-DDTHH:mm:ss')))[_0xa544('0x2f')]('mm:ss');}switch(_0x227587[_0xa544('0x67')]){case'called':_0x7a4f3a['Call_Result']=_0xa544('0x68');break;case _0xa544('0x69'):case'connect':_0x7a4f3a[_0xa544('0x6a')]=_0xa544('0x6b');break;case _0xa544('0x6c'):_0x7a4f3a[_0xa544('0x6a')]=_0xa544('0x6d');break;case _0xa544('0x6e'):_0x7a4f3a[_0xa544('0x6a')]=_0xa544('0x6f');break;case _0xa544('0x70'):_0x7a4f3a[_0xa544('0x6a')]='Timeout';default:}_0x7a4f3a[_0xa544('0x71')]=(_0x1c6865===_0xa544('0x72')?moment(_0x227587[_0xa544('0x66')])[_0xa544('0x2f')](_0xa544('0x64')):moment(_0x227587[_0xa544('0x73')])[_0xa544('0x2f')](_0xa544('0x64')))||moment()[_0xa544('0x2f')](_0xa544('0x64'));_0x7a4f3a['Call_Type']=_0x1c6865||'Inbound';_0x7a4f3a=_[_0xa544('0x74')](_0x7a4f3a,getCustomFields(_0x360d50[_0xa544('0x75')],_0x227587));return request({'method':_0xa544('0x23'),'uri':_0xa544('0x3e')+_0xbd97eb+_0xa544('0x76'),'headers':{'Authorization':_0xa544('0x43')+_0x5dad55},'body':{'data':[_0x7a4f3a]},'json':!![]})[_0xa544('0x28')](function(_0x101d66){if(_0x101d66&&_0x101d66['data'][0x0][_0xa544('0x44')]==='SUCCESS'){logger[_0xa544('0x2d')]('Call\x20created!');return{'id':_0x101d66['data'][0x0]['details']['id']};}})[_0xa544('0x2b')](function(_0xaf8e4c){logger['info'](_0xa544('0x77'),_0xaf8e4c[_0xa544('0x78')]);console[_0xa544('0x79')](_0xa544('0x77'),_0xaf8e4c);});}exports[_0xa544('0x7a')]=function(_0x1bb4b0,_0x402a29,_0x131f2d,_0x43eb4f,_0x26d1b9,_0x22faee){var _0x2e2740,_0x5a27c9,_0x55904b;_0x22faee[_0xa544('0x7b')]=intUtil[_0xa544('0x7c')](_0x22faee['host']);_0x22faee[_0xa544('0x7d')]=intUtil[_0xa544('0x7c')](_0x22faee[_0xa544('0x7d')]);if(_0x26d1b9&&_0x26d1b9[_0xa544('0x7e')]){logger[_0xa544('0x2d')](_0xa544('0x7f'),'Recording\x20is\x20enabled!');_0x402a29[_0xa544('0x80')]=_0x22faee[_0xa544('0x7d')]+_0xa544('0x81')+_0x402a29['uniqueid']+_0xa544('0x82')+md5(_0x402a29[_0xa544('0x83')]);}else{_0x402a29[_0xa544('0x80')]='';}var _0x352239=_0x22faee[_0xa544('0x7b')]==='zoho.eu'?'eu':_0xa544('0x84');return getAccessToken(_0x22faee)[_0xa544('0x28')](function(_0x11cd45){_0x55904b=_0x11cd45;return getUser(_0x55904b,_0x352239,_0x22faee,_0x43eb4f['email']);})[_0xa544('0x28')](function(_0x37a77e){_0x2e2740=_0x37a77e;logger[_0xa544('0x2d')](_0xa544('0x85'),_0x2e2740['id']);return getEndUser(_0x55904b,_0x352239,_0x22faee,_0x402a29['calleridname'],_0x402a29[_0xa544('0x86')],_0x2e2740,_0x131f2d);})[_0xa544('0x28')](function(_0x57d085){_0x5a27c9=_0x57d085;return getCall(_0x55904b,_0x352239,_0x22faee,_0x2e2740,_0x5a27c9,_0x131f2d,_0x402a29,_0xa544('0x87'));})[_0xa544('0x28')](function(_0x563038){if(_0x563038){logger[_0xa544('0x2d')](_0xa544('0x88'),_0x563038['id']);logger[_0xa544('0x2d')](_0xa544('0x7f'),_0xa544('0x89'));emit(util[_0xa544('0x2f')](_0xa544('0x8a'),_0x43eb4f[_0xa544('0x17')]),'trigger:browser:url',{'uri':_0xa544('0x8b')+_0x22faee[_0xa544('0x7b')]+_0xa544('0x8c')+_0x563038['id']});}})['catch'](function(_0x1190e2){logger[_0xa544('0x2c')](_0xa544('0x7f'),JSON[_0xa544('0x3a')](_0x1190e2));});};exports[_0xa544('0x72')]=function(_0x3a691c,_0x10c7da,_0x30aca8,_0x3f7137,_0x296989,_0x44362f,_0x5e35bd){var _0x327857,_0x1fcdb1,_0x4ab4e9;_0x44362f[_0xa544('0x7b')]=intUtil['stripTrailingSlash'](_0x44362f[_0xa544('0x7b')]);_0x44362f['serverUrl']=intUtil[_0xa544('0x7c')](_0x44362f[_0xa544('0x7d')]);if(_0x5e35bd&&_0x5e35bd[_0xa544('0x8d')]&&_0x5e35bd[_0xa544('0x8d')]!==_0xa544('0x8e')){logger[_0xa544('0x2d')](_0xa544('0x8f'),'Recording\x20is\x20enabled!');_0x10c7da['recordingURL']=_0x44362f[_0xa544('0x7d')]+_0xa544('0x81')+_0x10c7da['uniqueid']+'/downloads?type=uniqueid&token='+md5(_0x10c7da[_0xa544('0x83')]);}var _0x30df45=_0x44362f[_0xa544('0x7b')]===_0xa544('0x90')?'eu':_0xa544('0x84');return getAccessToken(_0x44362f)[_0xa544('0x28')](function(_0x57360c){_0x4ab4e9=_0x57360c;return getUser(_0x4ab4e9,_0x30df45,_0x44362f,_0x3f7137[_0xa544('0x91')]);})[_0xa544('0x28')](function(_0x109cca){_0x327857=_0x109cca;logger[_0xa544('0x2d')](_0xa544('0x85'),_0x327857['id']);return getEndUser(_0x4ab4e9,_0x30df45,_0x44362f,_0x10c7da[_0xa544('0x92')],_0x10c7da[_0xa544('0x93')],_0x327857,_0x30aca8);})['then'](function(_0x2fc878){_0x1fcdb1=_0x2fc878;return getCall(_0x4ab4e9,_0x30df45,_0x44362f,_0x327857,_0x1fcdb1,_0x30aca8,_0x10c7da,'Outbound');})[_0xa544('0x28')](function(_0x4032ce){if(_0x4032ce){logger['info'](_0xa544('0x88'),_0x4032ce['id']);logger[_0xa544('0x2d')](_0xa544('0x8f'),_0xa544('0x89'));emit(util[_0xa544('0x2f')](_0xa544('0x8a'),_0x3f7137[_0xa544('0x17')]),_0xa544('0x94'),{'uri':_0xa544('0x8b')+_0x44362f['host']+_0xa544('0x8c')+_0x4032ce['id']});}})[_0xa544('0x2b')](function(_0x8552a1){logger[_0xa544('0x2c')](_0xa544('0x8f'),JSON[_0xa544('0x3a')](_0x8552a1));});};exports[_0xa544('0x95')]=function(_0x5aed4b,_0x358966,_0x31aaac,_0x360017,_0x5d94f6,_0x54b46d){var _0x5cec72,_0x1764fa,_0x85d2fb;_0x54b46d[_0xa544('0x7b')]=intUtil[_0xa544('0x7c')](_0x54b46d[_0xa544('0x7b')]);_0x54b46d['serverUrl']=intUtil['stripTrailingSlash'](_0x54b46d[_0xa544('0x7d')]);if(_0x5d94f6&&_0x5d94f6[_0xa544('0x7e')]){logger['info']('['+_0x358966['lastevent'][_0xa544('0x96')]()+']',_0xa544('0x97'));_0x358966['recordingURL']=_0x54b46d[_0xa544('0x7d')]+_0xa544('0x81')+_0x358966[_0xa544('0x83')]+_0xa544('0x82')+md5(_0x358966[_0xa544('0x83')]);}else{_0x358966[_0xa544('0x80')]='';}var _0x2b68c9=_0x54b46d['host']==='zoho.eu'?'eu':_0xa544('0x84');return getAccessToken(_0x54b46d)[_0xa544('0x28')](function(_0x555038){_0x85d2fb=_0x555038;return getUser(_0x85d2fb,_0x2b68c9,_0x54b46d);})[_0xa544('0x28')](function(_0x1f9dcf){_0x5cec72=_0x1f9dcf;logger[_0xa544('0x2d')](_0xa544('0x85'),_0x5cec72['id']);return getEndUser(_0x85d2fb,_0x2b68c9,_0x54b46d,_0x358966['calleridname'],_0x358966[_0xa544('0x86')],_0x5cec72,_0x31aaac);})[_0xa544('0x28')](function(_0x5968f5){_0x1764fa=_0x5968f5;return getCall(_0x85d2fb,_0x2b68c9,_0x54b46d,_0x5cec72,_0x1764fa,_0x31aaac,_0x358966,_0xa544('0x87'));})[_0xa544('0x28')](function(_0x5cc790){if(_0x5cc790){logger['info'](_0xa544('0x88'),_0x5cc790['id']);}})['catch'](function(_0x402c67){logger[_0xa544('0x2c')]('['+_0x358966['lastevent'][_0xa544('0x96')]()+']',JSON[_0xa544('0x3a')](_0x402c67));});}; \ 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 5b93399..27d468d 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 _0x9b87=['format','info','mustache','../../../../config/logger','trigger','exec','data2','data3','render','error'];(function(_0x4d7116,_0xdb8175){var _0x4593dc=function(_0x51d44e){while(--_0x51d44e){_0x4d7116['push'](_0x4d7116['shift']());}};_0x4593dc(++_0xdb8175);}(_0x9b87,0x17e));var _0x79b8=function(_0xe17893,_0x5b2192){_0xe17893=_0xe17893-0x0;var _0x529162=_0x9b87[_0xe17893];return _0x529162;};'use strict';var util=require('util');var sh=require('shelljs');var Mustache=require(_0x79b8('0x0'));var logger=require(_0x79b8('0x1'))(_0x79b8('0x2'));exports[_0x79b8('0x3')]=function(_0x5f4023,_0x5b0114){var _0x4231ea=_0x5f4023[_0x79b8('0x4')]?_0x5f4023[_0x79b8('0x4')]:'Script';var _0x44dd23=_0x5f4023[_0x79b8('0x5')]?Mustache[_0x79b8('0x6')](_0x5f4023[_0x79b8('0x5')],_0x5b0114):_0x5b0114;sh[_0x79b8('0x3')](_0x44dd23,function(_0x54375f,_0x2526d7,_0x7df195){if(_0x54375f!==0x0){logger[_0x79b8('0x7')](util[_0x79b8('0x8')]('%s\x20\x27%s\x27\x20failed\x20with\x20code\x20%d\x20and\x20error:\x20%s',_0x4231ea,_0x44dd23,_0x54375f,_0x7df195));}else{logger[_0x79b8('0x9')](util[_0x79b8('0x8')]('%s\x20\x27%s\x27\x20succeeded\x20with\x20output:\x20%s',_0x4231ea,_0x44dd23,_0x2526d7));}});}; \ No newline at end of file +var _0xb5eb=['%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','trigger','exec','data2','Script','data3','render','format'];(function(_0x3d9d90,_0x562154){var _0xa0979b=function(_0xef61c7){while(--_0xef61c7){_0x3d9d90['push'](_0x3d9d90['shift']());}};_0xa0979b(++_0x562154);}(_0xb5eb,0x14d));var _0xbb5e=function(_0x2ac1ee,_0x5ec3af){_0x2ac1ee=_0x2ac1ee-0x0;var _0x1cc46c=_0xb5eb[_0x2ac1ee];return _0x1cc46c;};'use strict';var util=require(_0xbb5e('0x0'));var sh=require('shelljs');var Mustache=require('mustache');var logger=require('../../../../config/logger')(_0xbb5e('0x1'));exports[_0xbb5e('0x2')]=function(_0x1e24c6,_0x31764b){var _0x23c603=_0x1e24c6[_0xbb5e('0x3')]?_0x1e24c6['data2']:_0xbb5e('0x4');var _0x349e1c=_0x1e24c6[_0xbb5e('0x5')]?Mustache[_0xbb5e('0x6')](_0x1e24c6[_0xbb5e('0x5')],_0x31764b):_0x31764b;sh['exec'](_0x349e1c,function(_0x1cd744,_0x3bf1f6,_0x4f2644){if(_0x1cd744!==0x0){logger['error'](util[_0xbb5e('0x7')](_0xbb5e('0x8'),_0x23c603,_0x349e1c,_0x1cd744,_0x4f2644));}else{logger[_0xbb5e('0x9')](util[_0xbb5e('0x7')](_0xbb5e('0xa'),_0x23c603,_0x349e1c,_0x3bf1f6));}});}; \ 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 35cc89a..568d5a4 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 _0xb45c=['body','error','body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format','info','format','stringify','isNil',',\x20request\x20body:\x20','object','%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s','statusCode','catch','%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s','name','message','request-promise','lodash','mustache','../../../../config/logger','trigger','exec','data1','toUpperCase','render','data2','number','data5','headers','data6','parse','stack','GET','DELETE','data7'];(function(_0x87b0ff,_0x314389){var _0x3bc0b2=function(_0x41682b){while(--_0x41682b){_0x87b0ff['push'](_0x87b0ff['shift']());}};_0x3bc0b2(++_0x314389);}(_0xb45c,0x185));var _0xcb45=function(_0x599586,_0x506cab){_0x599586=_0x599586-0x0;var _0x28ffb1=_0xb45c[_0x599586];return _0x28ffb1;};'use strict';var rp=require(_0xcb45('0x0'));var util=require('util');var _=require(_0xcb45('0x1'));var Mustache=require(_0xcb45('0x2'));var logger=require(_0xcb45('0x3'))(_0xcb45('0x4'));exports[_0xcb45('0x5')]=function(_0x56d2b4,_0x37fee0){var _0x37214f,_0x4d30ab;var _0x4c967d={'method':_0x56d2b4[_0xcb45('0x6')][_0xcb45('0x7')](),'uri':Mustache[_0xcb45('0x8')](_0x56d2b4[_0xcb45('0x9')],_0x37fee0),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x56d2b4['data5'])===_0xcb45('0xa')&&parseInt(_0x56d2b4[_0xcb45('0xb')])>=0x1&&parseInt(_0x56d2b4[_0xcb45('0xb')])<=0xa?parseInt(_0x56d2b4[_0xcb45('0xb')])*0x3e8:0x5*0x3e8};try{_0x4c967d[_0xcb45('0xc')]=_0x56d2b4[_0xcb45('0xd')]?JSON[_0xcb45('0xe')](Mustache['render'](_0x56d2b4[_0xcb45('0xd')],_0x37fee0)):{};}catch(_0x234503){logger['error'](_0x234503[_0xcb45('0xf')]);}switch(_0x56d2b4['data1'][_0xcb45('0x7')]()){case _0xcb45('0x10'):case _0xcb45('0x11'):_0x37214f=null;_0x4c967d['qs']=_0x37fee0;break;case'POST':case'PUT':if(_0x56d2b4[_0xcb45('0x12')]){try{_0x37214f=JSON[_0xcb45('0xe')](Mustache['render'](_0x56d2b4[_0xcb45('0x12')],_0x37fee0));_0x4c967d[_0xcb45('0x13')]=_0x37214f;}catch(_0x46ae98){logger[_0xcb45('0x14')](_0x46ae98[_0xcb45('0xf')]);logger[_0xcb45('0x14')](_0xcb45('0x15'));}}else{_0x37214f=_0x37fee0;_0x4c967d[_0xcb45('0x13')]=_0x37214f;}break;}logger[_0xcb45('0x16')](util[_0xcb45('0x17')]('%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s',_0x56d2b4[_0xcb45('0x6')],_0x56d2b4[_0xcb45('0x9')],JSON[_0xcb45('0x18')](_0x4c967d)));rp(_0x4c967d)['then'](function(_0x28c416){_0x37214f=!_[_0xcb45('0x19')](_0x37214f)?_0xcb45('0x1a')+_0x37214f:'';_0x4d30ab=typeof _0x28c416[_0xcb45('0x13')]===_0xcb45('0x1b')?JSON[_0xcb45('0x18')](_0x28c416[_0xcb45('0x13')]):_0x28c416[_0xcb45('0x13')];logger[_0xcb45('0x16')](util[_0xcb45('0x17')](_0xcb45('0x1c'),_0x56d2b4[_0xcb45('0x6')],_0x56d2b4[_0xcb45('0x9')],_0x28c416[_0xcb45('0x1d')],_0x4d30ab));})[_0xcb45('0x1e')](function(_0x3d334e){logger['error'](util[_0xcb45('0x17')](_0xcb45('0x1f'),_0x56d2b4['data1'],_0x56d2b4['data2'],_0x3d334e[_0xcb45('0x1d')],_0x3d334e[_0xcb45('0x20')],_0x3d334e[_0xcb45('0x21')]));});}; \ No newline at end of file +var _0x7aac=['number','data5','headers','data6','parse','stack','POST','PUT','data7','error','body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format','body','info','format','stringify','then','isNil',',\x20request\x20body:\x20','object','%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s','statusCode','catch','%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s','name','message','util','lodash','exec','data1','toUpperCase','render','data2'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x7aac,0x159));var _0xc7aa=function(_0x121420,_0x252320){_0x121420=_0x121420-0x0;var _0x409d63=_0x7aac[_0x121420];return _0x409d63;};'use strict';var rp=require('request-promise');var util=require(_0xc7aa('0x0'));var _=require(_0xc7aa('0x1'));var Mustache=require('mustache');var logger=require('../../../../config/logger')('trigger');exports[_0xc7aa('0x2')]=function(_0xfaffa9,_0x57f3b7){var _0x2f129c,_0x35ba22;var _0x977fa7={'method':_0xfaffa9[_0xc7aa('0x3')][_0xc7aa('0x4')](),'uri':Mustache[_0xc7aa('0x5')](_0xfaffa9[_0xc7aa('0x6')],_0x57f3b7),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0xfaffa9['data5'])===_0xc7aa('0x7')&&parseInt(_0xfaffa9[_0xc7aa('0x8')])>=0x1&&parseInt(_0xfaffa9['data5'])<=0xa?parseInt(_0xfaffa9['data5'])*0x3e8:0x5*0x3e8};try{_0x977fa7[_0xc7aa('0x9')]=_0xfaffa9[_0xc7aa('0xa')]?JSON[_0xc7aa('0xb')](Mustache['render'](_0xfaffa9[_0xc7aa('0xa')],_0x57f3b7)):{};}catch(_0x54076b){logger['error'](_0x54076b[_0xc7aa('0xc')]);}switch(_0xfaffa9[_0xc7aa('0x3')][_0xc7aa('0x4')]()){case'GET':case'DELETE':_0x2f129c=null;_0x977fa7['qs']=_0x57f3b7;break;case _0xc7aa('0xd'):case _0xc7aa('0xe'):if(_0xfaffa9[_0xc7aa('0xf')]){try{_0x2f129c=JSON[_0xc7aa('0xb')](Mustache[_0xc7aa('0x5')](_0xfaffa9[_0xc7aa('0xf')],_0x57f3b7));_0x977fa7['body']=_0x2f129c;}catch(_0x11df57){logger[_0xc7aa('0x10')](_0x11df57[_0xc7aa('0xc')]);logger[_0xc7aa('0x10')](_0xc7aa('0x11'));}}else{_0x2f129c=_0x57f3b7;_0x977fa7[_0xc7aa('0x12')]=_0x2f129c;}break;}logger[_0xc7aa('0x13')](util[_0xc7aa('0x14')]('%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s',_0xfaffa9['data1'],_0xfaffa9[_0xc7aa('0x6')],JSON[_0xc7aa('0x15')](_0x977fa7)));rp(_0x977fa7)[_0xc7aa('0x16')](function(_0x7cc15b){_0x2f129c=!_[_0xc7aa('0x17')](_0x2f129c)?_0xc7aa('0x18')+_0x2f129c:'';_0x35ba22=typeof _0x7cc15b[_0xc7aa('0x12')]===_0xc7aa('0x19')?JSON['stringify'](_0x7cc15b[_0xc7aa('0x12')]):_0x7cc15b[_0xc7aa('0x12')];logger['info'](util[_0xc7aa('0x14')](_0xc7aa('0x1a'),_0xfaffa9[_0xc7aa('0x3')],_0xfaffa9[_0xc7aa('0x6')],_0x7cc15b[_0xc7aa('0x1b')],_0x35ba22));})[_0xc7aa('0x1c')](function(_0x5065fe){logger[_0xc7aa('0x10')](util[_0xc7aa('0x14')](_0xc7aa('0x1d'),_0xfaffa9[_0xc7aa('0x3')],_0xfaffa9[_0xc7aa('0x6')],_0x5065fe[_0xc7aa('0x1b')],_0x5065fe[_0xc7aa('0x1e')],_0x5065fe[_0xc7aa('0x1f')]));});}; \ No newline at end of file diff --git a/server/services/email/client.js b/server/services/email/client.js index 74b4701..6f6cb42 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 _0x1da0=['error','rpc','routing','message','result','bluebird','../../config/logger','client','http','Request','request','then'];(function(_0x382ee9,_0x357044){var _0x3252d=function(_0x5455df){while(--_0x5455df){_0x382ee9['push'](_0x382ee9['shift']());}};_0x3252d(++_0x357044);}(_0x1da0,0xf5));var _0x01da=function(_0x1b7368,_0x3286ed){_0x1b7368=_0x1b7368-0x0;var _0x25d54c=_0x1da0[_0x1b7368];return _0x25d54c;};'use strict';var jayson=require('jayson/promise');var BPromise=require(_0x01da('0x0'));var logger=require(_0x01da('0x1'))('routing');var client=jayson[_0x01da('0x2')][_0x01da('0x3')]({'port':0x2329});client[_0x01da('0x4')]=function(_0x8c7f6f,_0x372003){return new BPromise(function(_0x275d81,_0x5b9cc2){return client[_0x01da('0x5')](_0x8c7f6f,_0x372003)[_0x01da('0x6')](function(_0x1d9329){logger['debug']('rpc','routing',_0x8c7f6f,_0x372003,_0x1d9329);if(_0x1d9329[_0x01da('0x7')]){logger['error'](_0x01da('0x8'),_0x01da('0x9'),_0x8c7f6f,_0x1d9329[_0x01da('0x7')][_0x01da('0xa')],_0x372003);return _0x5b9cc2(_0x1d9329['error'][_0x01da('0xa')]);}else{return _0x275d81(_0x1d9329[_0x01da('0xb')]);}})['catch'](function(_0x4cb42f){logger['error'](_0x01da('0x8'),_0x01da('0x9'),_0x8c7f6f,_0x4cb42f,_0x372003);return _0x5b9cc2(_0x4cb42f);});});};module['exports']=client; \ No newline at end of file +var _0x4eb0=['then','debug','rpc','error','message','result','exports','bluebird','../../config/logger','routing','client','Request'];(function(_0x2eda7d,_0x162382){var _0x2fd21d=function(_0x3bf4d0){while(--_0x3bf4d0){_0x2eda7d['push'](_0x2eda7d['shift']());}};_0x2fd21d(++_0x162382);}(_0x4eb0,0x8b));var _0x04eb=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x4eb0[_0x3ab51d];return _0x29a04e;};'use strict';var jayson=require('jayson/promise');var BPromise=require(_0x04eb('0x0'));var logger=require(_0x04eb('0x1'))(_0x04eb('0x2'));var client=jayson[_0x04eb('0x3')]['http']({'port':0x2329});client[_0x04eb('0x4')]=function(_0x1e2d4d,_0x5bd301){return new BPromise(function(_0x36163e,_0x20fdb8){return client['request'](_0x1e2d4d,_0x5bd301)[_0x04eb('0x5')](function(_0x128da2){logger[_0x04eb('0x6')](_0x04eb('0x7'),_0x04eb('0x2'),_0x1e2d4d,_0x5bd301,_0x128da2);if(_0x128da2[_0x04eb('0x8')]){logger['error']('rpc',_0x04eb('0x2'),_0x1e2d4d,_0x128da2[_0x04eb('0x8')]['message'],_0x5bd301);return _0x20fdb8(_0x128da2['error'][_0x04eb('0x9')]);}else{return _0x36163e(_0x128da2[_0x04eb('0xa')]);}})['catch'](function(_0xd42da5){logger[_0x04eb('0x8')](_0x04eb('0x7'),_0x04eb('0x2'),_0x1e2d4d,_0xd42da5,_0x5bd301);return _0x20fdb8(_0xd42da5);});});};module[_0x04eb('0xb')]=client; \ No newline at end of file diff --git a/server/services/email/index.js b/server/services/email/index.js index 40e557f..7e7046d 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 _0x6a07=['getMailAccounts','mailAccounts','listen','catch','Email\x20service\x20initialization','./server','./realtime','./lib/email','./rpc/mailAccount','./rpc/setting','../../config/logger','resolve','then'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x6a07,0x1e6));var _0x76a0=function(_0x50a9af,_0x24df09){_0x50a9af=_0x50a9af-0x0;var _0x3478f9=_0x6a07[_0x50a9af];return _0x3478f9;};'use strict';var server=require(_0x76a0('0x0'));var Realtime=require(_0x76a0('0x1'));var EmailChannel=require(_0x76a0('0x2'));var mailAccount=require(_0x76a0('0x3'));var setting=require(_0x76a0('0x4'));var logger=require(_0x76a0('0x5'))('email');var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return Promise[_0x76a0('0x6')]()[_0x76a0('0x7')](mailAccount[_0x76a0('0x8')]())[_0x76a0('0x7')](realtime['initMailAccounts']())[_0x76a0('0x7')](function(){email['refresh'](realtime[_0x76a0('0x9')]);return realtime;});}function main(){return server[_0x76a0('0xa')](realtime,email)[_0x76a0('0x7')](function(){return initRealtime();})[_0x76a0('0x7')](function(){return setting['getSettings']();})[_0x76a0('0x7')](function(_0x4bf467){return setInterval(initRealtime,_0x4bf467['loginMailFrequency']*0x3e8);})[_0x76a0('0xb')](function(_0xc7ef93){logger['error'](_0x76a0('0xc'),_0xc7ef93);});}main(); \ No newline at end of file +var _0x24e9=['Email\x20service\x20initialization','./realtime','./lib/email','./rpc/mailAccount','./rpc/setting','../../config/logger','email','then','refresh','mailAccounts','listen','getSettings','loginMailFrequency','error'];(function(_0x3dd3de,_0x54508f){var _0x30c8da=function(_0x2502b6){while(--_0x2502b6){_0x3dd3de['push'](_0x3dd3de['shift']());}};_0x30c8da(++_0x54508f);}(_0x24e9,0xb7));var _0x924e=function(_0x43b06b,_0x1929c7){_0x43b06b=_0x43b06b-0x0;var _0x2c555b=_0x24e9[_0x43b06b];return _0x2c555b;};'use strict';var server=require('./server');var Realtime=require(_0x924e('0x0'));var EmailChannel=require(_0x924e('0x1'));var mailAccount=require(_0x924e('0x2'));var setting=require(_0x924e('0x3'));var logger=require(_0x924e('0x4'))(_0x924e('0x5'));var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return Promise['resolve']()[_0x924e('0x6')](mailAccount['getMailAccounts']())[_0x924e('0x6')](realtime['initMailAccounts']())[_0x924e('0x6')](function(){email[_0x924e('0x7')](realtime[_0x924e('0x8')]);return realtime;});}function main(){return server[_0x924e('0x9')](realtime,email)[_0x924e('0x6')](function(){return initRealtime();})[_0x924e('0x6')](function(){return setting[_0x924e('0xa')]();})[_0x924e('0x6')](function(_0x47c878){return setInterval(initRealtime,_0x47c878[_0x924e('0xb')]*0x3e8);})['catch'](function(_0x4492ba){logger[_0x924e('0xc')](_0x924e('0xd'),_0x4492ba);});}main(); \ No newline at end of file diff --git a/server/services/email/lib/email.js b/server/services/email/lib/email.js index e17bd12..9dfeb21 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 _0xe1f7=['./smtp','info','start\x20email\x20channel','mailAccounts','imapAccounts','prototype','key','active','Imap','status','messageStatus','total','isNil','stringify','emit','mailAccount:update','custom','provider','hasOwnProperty','box','handleImapBox','bind','end','handleImapEnd','error','disabled','connected','name','messages','handleImapEmail','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','lastName','from','notify','lastSync','sendMail','smtp','send','Smtp','verify','then','verified','exports','lodash','bluebird','../../../config/logger','email','redis','defaults','localhost','./imap'];(function(_0x2f5a87,_0x471130){var _0xe6886f=function(_0x4f4cb6){while(--_0x4f4cb6){_0x2f5a87['push'](_0x2f5a87['shift']());}};_0xe6886f(++_0x471130);}(_0xe1f7,0x190));var _0x7e1f=function(_0x3eb4a9,_0x359d73){_0x3eb4a9=_0x3eb4a9-0x0;var _0x48dbad=_0xe1f7[_0x3eb4a9];return _0x48dbad;};'use strict';var _=require(_0x7e1f('0x0'));var moment=require('moment');var BPromise=require(_0x7e1f('0x1'));var md5=require('md5');var Redis=require('ioredis');var config=require('../../../config/environment');var logger=require(_0x7e1f('0x2'))(_0x7e1f('0x3'));config[_0x7e1f('0x4')]=_[_0x7e1f('0x5')](config[_0x7e1f('0x4')],{'host':_0x7e1f('0x6'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));var EmailImap=require(_0x7e1f('0x7'));var EmailSmtp=require(_0x7e1f('0x8'));var mailAccount=require('../rpc/mailAccount');var md5Accounts={};function EmailChannel(_0x55155d){logger[_0x7e1f('0x9')](_0x7e1f('0xa'));this[_0x7e1f('0xb')]=_0x55155d[_0x7e1f('0xb')];this[_0x7e1f('0xc')]={};this['smtp']=new EmailSmtp();}EmailChannel[_0x7e1f('0xd')]['emit']=function(_0x11a4cd){var _0x11dce7=this['mailAccounts'][_0x11a4cd];var _0x54f902={'id':_0x11dce7['id'],'name':_0x11dce7['name'],'key':_0x11dce7[_0x7e1f('0xe')],'active':_0x11dce7[_0x7e1f('0xf')],'Imap':{'status':_0x11dce7[_0x7e1f('0x10')][_0x7e1f('0x11')],'messageStatus':_0x11dce7[_0x7e1f('0x10')][_0x7e1f('0x12')],'total':_0x11dce7[_0x7e1f('0x10')][_0x7e1f('0x13')]}};if(_[_0x7e1f('0x14')](md5Accounts[_0x11a4cd])){md5Accounts[_0x11a4cd]={};}var _0x41fdbf=md5(JSON[_0x7e1f('0x15')](_0x54f902));if(md5Accounts[_0x11a4cd]['md5']!==_0x41fdbf){md5Accounts[_0x11a4cd]['md5']=_0x41fdbf;io[_0x7e1f('0x16')](_0x7e1f('0x17'),_0x54f902);}};EmailChannel[_0x7e1f('0xd')]['refresh']=function(_0x44f70d){for(var _0x1ea040 in _0x44f70d){if(_0x44f70d['hasOwnProperty'](_0x1ea040)){if(_0x44f70d[_0x1ea040][_0x7e1f('0x10')]&&_0x44f70d[_0x1ea040][_0x7e1f('0xf')]){var _0x28d562=_0x44f70d[_0x1ea040][_0x7e1f('0x10')];if(!_0x28d562['service']&&_0x44f70d[_0x1ea040]['provider']!==_0x7e1f('0x18'))_0x28d562['service']=_0x44f70d[_0x1ea040][_0x7e1f('0x19')];if(!this['imapAccounts'][_0x7e1f('0x1a')](_0x28d562['id'])){this[_0x7e1f('0xc')][_0x28d562['id']]=new EmailImap(_0x28d562,_0x44f70d[_0x1ea040][_0x7e1f('0x3')]);this[_0x7e1f('0xc')][_0x28d562['id']]['on'](_0x7e1f('0x1b'),this[_0x7e1f('0x1c')][_0x7e1f('0x1d')](this,_0x1ea040));this[_0x7e1f('0xc')][_0x28d562['id']]['on'](_0x7e1f('0x3'),this['handleImapEmail']['bind'](this,_0x1ea040));this[_0x7e1f('0xc')][_0x28d562['id']]['on'](_0x7e1f('0x1e'),this[_0x7e1f('0x1f')]['bind'](this,_0x1ea040));this['imapAccounts'][_0x28d562['id']]['on'](_0x7e1f('0x20'),this['handleImapError']['bind'](this,_0x1ea040));}}else{if(_['isNil'](this[_0x7e1f('0xb')][_0x1ea040][_0x7e1f('0x10')])){this['mailAccounts'][_0x1ea040]['Imap']={};}this[_0x7e1f('0xb')][_0x1ea040][_0x7e1f('0x10')]['status']=_0x7e1f('0x21');this[_0x7e1f('0xb')][_0x1ea040][_0x7e1f('0x10')][_0x7e1f('0x12')]='';this[_0x7e1f('0x16')](_0x1ea040);}}}};EmailChannel['prototype'][_0x7e1f('0x1c')]=function(_0x3c26c8,_0x3c7c4a){if(this['mailAccounts'][_0x3c26c8]){this[_0x7e1f('0xb')][_0x3c26c8][_0x7e1f('0x10')][_0x7e1f('0x11')]=_0x7e1f('0x22');this[_0x7e1f('0xb')][_0x3c26c8]['Imap']['messageStatus']=_0x3c7c4a[_0x7e1f('0x23')];if(_0x3c7c4a[_0x7e1f('0x24')]){this[_0x7e1f('0xb')][_0x3c26c8][_0x7e1f('0x10')][_0x7e1f('0x13')]=_0x3c7c4a[_0x7e1f('0x24')][_0x7e1f('0x13')];}return this[_0x7e1f('0x16')](_0x3c26c8);}};EmailChannel[_0x7e1f('0xd')][_0x7e1f('0x25')]=function(_0x4bf1f6,_0x1c8bff){logger[_0x7e1f('0x9')](_0x7e1f('0x26'),_0x1c8bff['firstName'],_0x1c8bff[_0x7e1f('0x27')],_0x1c8bff[_0x7e1f('0x28')],_0x4bf1f6);if(this[_0x7e1f('0xb')][_0x4bf1f6]){return mailAccount[_0x7e1f('0x29')](_0x4bf1f6,_0x1c8bff)['then'](function(_0x54135e){if(_0x54135e){logger[_0x7e1f('0x9')]('Mail\x20accepted\x20from\x20routing');}})['catch'](function(_0x42948f){logger[_0x7e1f('0x20')]('Mail\x20not\x20accepted\x20from\x20routing\x20%s',JSON[_0x7e1f('0x15')](_0x42948f));});}};EmailChannel[_0x7e1f('0xd')][_0x7e1f('0x1f')]=function(_0x30d126){if(this[_0x7e1f('0xb')][_0x30d126]&&this[_0x7e1f('0xb')][_0x30d126]['Imap']){if(this['imapAccounts'][this[_0x7e1f('0xb')][_0x30d126]['Imap']['id']]){delete this[_0x7e1f('0xc')][this[_0x7e1f('0xb')][_0x30d126][_0x7e1f('0x10')]['id']];}this[_0x7e1f('0xb')][_0x30d126]['Imap'][_0x7e1f('0x2a')]=moment();this[_0x7e1f('0x16')](_0x30d126);}};EmailChannel[_0x7e1f('0xd')]['handleImapError']=function(_0xcbfcd6,_0x3fa4bb){if(this[_0x7e1f('0xb')][_0xcbfcd6]){this[_0x7e1f('0xb')][_0xcbfcd6][_0x7e1f('0x10')]['status']='error';this[_0x7e1f('0xb')][_0xcbfcd6][_0x7e1f('0x10')]['messageStatus']=_0x3fa4bb;return this['emit'](_0xcbfcd6);}};EmailChannel[_0x7e1f('0xd')][_0x7e1f('0x2b')]=function(_0x631b34,_0x1eeb2a){return this[_0x7e1f('0x2c')][_0x7e1f('0x2d')](_0x631b34,_0x1eeb2a);};EmailChannel[_0x7e1f('0xd')]['verifySmtp']=function(_0x56cf76){var _0x4e84d9=this;if(this[_0x7e1f('0xb')][_0x56cf76['id']]){if(_[_0x7e1f('0x14')](this[_0x7e1f('0xb')][_0x56cf76['id']][_0x7e1f('0x2e')])){this[_0x7e1f('0xb')][_0x56cf76['id']][_0x7e1f('0x2e')]={};}this[_0x7e1f('0xb')][_0x56cf76['id']]['Smtp'][_0x7e1f('0x2a')]=moment();return new BPromise(function(_0x1ea118,_0x47f1d3){return _0x4e84d9[_0x7e1f('0x2c')][_0x7e1f('0x2f')](_0x56cf76)[_0x7e1f('0x30')](function(_0x4cf3ed){_0x4e84d9[_0x7e1f('0xb')][_0x56cf76['id']][_0x7e1f('0x2e')][_0x7e1f('0x11')]=_0x7e1f('0x31');_0x4e84d9[_0x7e1f('0xb')][_0x56cf76['id']][_0x7e1f('0x2e')][_0x7e1f('0x12')]='';_0x4e84d9[_0x7e1f('0x16')](_0x56cf76['id']);_0x1ea118(_0x4cf3ed);})['catch'](function(_0x2376f8){_0x4e84d9['mailAccounts'][_0x56cf76['id']][_0x7e1f('0x2e')][_0x7e1f('0x11')]='error';_0x4e84d9[_0x7e1f('0xb')][_0x56cf76['id']]['Smtp'][_0x7e1f('0x12')]=_0x2376f8;_0x4e84d9[_0x7e1f('0x16')](_0x56cf76['id']);_0x47f1d3(_0x2376f8);});});}return this[_0x7e1f('0x2c')][_0x7e1f('0x2f')](_0x56cf76);};module[_0x7e1f('0x32')]=EmailChannel; \ No newline at end of file +var _0xb54d=['../../../config/environment','../../../config/logger','email','defaults','redis','./imap','./smtp','start\x20email\x20channel','mailAccounts','smtp','prototype','emit','name','key','active','status','Imap','messageStatus','total','stringify','mailAccount:update','refresh','service','provider','custom','hasOwnProperty','imapAccounts','box','handleImapBox','bind','handleImapEmail','error','isNil','messages','info','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','firstName','from','then','Mail\x20accepted\x20from\x20routing','catch','Mail\x20not\x20accepted\x20from\x20routing\x20%s','handleImapError','sendMail','send','Smtp','lastSync','exports','bluebird','md5','ioredis'];(function(_0xd1d19a,_0x1933f0){var _0x52a79d=function(_0x5199e2){while(--_0x5199e2){_0xd1d19a['push'](_0xd1d19a['shift']());}};_0x52a79d(++_0x1933f0);}(_0xb54d,0x1c8));var _0xdb54=function(_0x5311a1,_0x304912){_0x5311a1=_0x5311a1-0x0;var _0x2acb9f=_0xb54d[_0x5311a1];return _0x2acb9f;};'use strict';var _=require('lodash');var moment=require('moment');var BPromise=require(_0xdb54('0x0'));var md5=require(_0xdb54('0x1'));var Redis=require(_0xdb54('0x2'));var config=require(_0xdb54('0x3'));var logger=require(_0xdb54('0x4'))(_0xdb54('0x5'));config['redis']=_[_0xdb54('0x6')](config[_0xdb54('0x7')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xdb54('0x7')]));var EmailImap=require(_0xdb54('0x8'));var EmailSmtp=require(_0xdb54('0x9'));var mailAccount=require('../rpc/mailAccount');var md5Accounts={};function EmailChannel(_0x423121){logger['info'](_0xdb54('0xa'));this[_0xdb54('0xb')]=_0x423121[_0xdb54('0xb')];this['imapAccounts']={};this[_0xdb54('0xc')]=new EmailSmtp();}EmailChannel[_0xdb54('0xd')][_0xdb54('0xe')]=function(_0x3d61db){var _0x7f694c=this[_0xdb54('0xb')][_0x3d61db];var _0x3b40be={'id':_0x7f694c['id'],'name':_0x7f694c[_0xdb54('0xf')],'key':_0x7f694c[_0xdb54('0x10')],'active':_0x7f694c[_0xdb54('0x11')],'Imap':{'status':_0x7f694c['Imap'][_0xdb54('0x12')],'messageStatus':_0x7f694c[_0xdb54('0x13')][_0xdb54('0x14')],'total':_0x7f694c[_0xdb54('0x13')][_0xdb54('0x15')]}};if(_['isNil'](md5Accounts[_0x3d61db])){md5Accounts[_0x3d61db]={};}var _0x4fe7fa=md5(JSON[_0xdb54('0x16')](_0x3b40be));if(md5Accounts[_0x3d61db][_0xdb54('0x1')]!==_0x4fe7fa){md5Accounts[_0x3d61db][_0xdb54('0x1')]=_0x4fe7fa;io['emit'](_0xdb54('0x17'),_0x3b40be);}};EmailChannel[_0xdb54('0xd')][_0xdb54('0x18')]=function(_0x59fecf){for(var _0x3bf918 in _0x59fecf){if(_0x59fecf['hasOwnProperty'](_0x3bf918)){if(_0x59fecf[_0x3bf918][_0xdb54('0x13')]&&_0x59fecf[_0x3bf918][_0xdb54('0x11')]){var _0x169495=_0x59fecf[_0x3bf918][_0xdb54('0x13')];if(!_0x169495[_0xdb54('0x19')]&&_0x59fecf[_0x3bf918][_0xdb54('0x1a')]!==_0xdb54('0x1b'))_0x169495[_0xdb54('0x19')]=_0x59fecf[_0x3bf918][_0xdb54('0x1a')];if(!this['imapAccounts'][_0xdb54('0x1c')](_0x169495['id'])){this[_0xdb54('0x1d')][_0x169495['id']]=new EmailImap(_0x169495,_0x59fecf[_0x3bf918][_0xdb54('0x5')]);this[_0xdb54('0x1d')][_0x169495['id']]['on'](_0xdb54('0x1e'),this[_0xdb54('0x1f')][_0xdb54('0x20')](this,_0x3bf918));this[_0xdb54('0x1d')][_0x169495['id']]['on'](_0xdb54('0x5'),this[_0xdb54('0x21')][_0xdb54('0x20')](this,_0x3bf918));this[_0xdb54('0x1d')][_0x169495['id']]['on']('end',this['handleImapEnd'][_0xdb54('0x20')](this,_0x3bf918));this[_0xdb54('0x1d')][_0x169495['id']]['on'](_0xdb54('0x22'),this['handleImapError'][_0xdb54('0x20')](this,_0x3bf918));}}else{if(_[_0xdb54('0x23')](this[_0xdb54('0xb')][_0x3bf918][_0xdb54('0x13')])){this['mailAccounts'][_0x3bf918][_0xdb54('0x13')]={};}this[_0xdb54('0xb')][_0x3bf918][_0xdb54('0x13')]['status']='disabled';this[_0xdb54('0xb')][_0x3bf918]['Imap']['messageStatus']='';this[_0xdb54('0xe')](_0x3bf918);}}}};EmailChannel['prototype']['handleImapBox']=function(_0x57a5f3,_0x33141d){if(this[_0xdb54('0xb')][_0x57a5f3]){this['mailAccounts'][_0x57a5f3][_0xdb54('0x13')][_0xdb54('0x12')]='connected';this[_0xdb54('0xb')][_0x57a5f3]['Imap'][_0xdb54('0x14')]=_0x33141d['name'];if(_0x33141d[_0xdb54('0x24')]){this[_0xdb54('0xb')][_0x57a5f3][_0xdb54('0x13')][_0xdb54('0x15')]=_0x33141d[_0xdb54('0x24')]['total'];}return this[_0xdb54('0xe')](_0x57a5f3);}};EmailChannel[_0xdb54('0xd')][_0xdb54('0x21')]=function(_0x363711,_0x4cc69a){logger[_0xdb54('0x25')](_0xdb54('0x26'),_0x4cc69a[_0xdb54('0x27')],_0x4cc69a['lastName'],_0x4cc69a[_0xdb54('0x28')],_0x363711);if(this['mailAccounts'][_0x363711]){return mailAccount['notify'](_0x363711,_0x4cc69a)[_0xdb54('0x29')](function(_0x41d22a){if(_0x41d22a){logger[_0xdb54('0x25')](_0xdb54('0x2a'));}})[_0xdb54('0x2b')](function(_0x18c167){logger[_0xdb54('0x22')](_0xdb54('0x2c'),JSON[_0xdb54('0x16')](_0x18c167));});}};EmailChannel[_0xdb54('0xd')]['handleImapEnd']=function(_0x571e32){if(this['mailAccounts'][_0x571e32]&&this[_0xdb54('0xb')][_0x571e32][_0xdb54('0x13')]){if(this[_0xdb54('0x1d')][this[_0xdb54('0xb')][_0x571e32][_0xdb54('0x13')]['id']]){delete this['imapAccounts'][this[_0xdb54('0xb')][_0x571e32]['Imap']['id']];}this[_0xdb54('0xb')][_0x571e32][_0xdb54('0x13')]['lastSync']=moment();this[_0xdb54('0xe')](_0x571e32);}};EmailChannel['prototype'][_0xdb54('0x2d')]=function(_0x5a0e92,_0x40feae){if(this[_0xdb54('0xb')][_0x5a0e92]){this[_0xdb54('0xb')][_0x5a0e92][_0xdb54('0x13')][_0xdb54('0x12')]=_0xdb54('0x22');this['mailAccounts'][_0x5a0e92][_0xdb54('0x13')][_0xdb54('0x14')]=_0x40feae;return this[_0xdb54('0xe')](_0x5a0e92);}};EmailChannel[_0xdb54('0xd')][_0xdb54('0x2e')]=function(_0xd2b1d4,_0x13a098){return this[_0xdb54('0xc')][_0xdb54('0x2f')](_0xd2b1d4,_0x13a098);};EmailChannel[_0xdb54('0xd')]['verifySmtp']=function(_0x233e1){var _0x522723=this;if(this[_0xdb54('0xb')][_0x233e1['id']]){if(_[_0xdb54('0x23')](this[_0xdb54('0xb')][_0x233e1['id']][_0xdb54('0x30')])){this[_0xdb54('0xb')][_0x233e1['id']][_0xdb54('0x30')]={};}this[_0xdb54('0xb')][_0x233e1['id']][_0xdb54('0x30')][_0xdb54('0x31')]=moment();return new BPromise(function(_0x90c964,_0x5809f8){return _0x522723[_0xdb54('0xc')]['verify'](_0x233e1)['then'](function(_0x3c698b){_0x522723[_0xdb54('0xb')][_0x233e1['id']]['Smtp']['status']='verified';_0x522723['mailAccounts'][_0x233e1['id']]['Smtp'][_0xdb54('0x14')]='';_0x522723[_0xdb54('0xe')](_0x233e1['id']);_0x90c964(_0x3c698b);})[_0xdb54('0x2b')](function(_0xece700){_0x522723[_0xdb54('0xb')][_0x233e1['id']][_0xdb54('0x30')]['status']='error';_0x522723['mailAccounts'][_0x233e1['id']][_0xdb54('0x30')][_0xdb54('0x14')]=_0xece700;_0x522723[_0xdb54('0xe')](_0x233e1['id']);_0x5809f8(_0xece700);});});}return this['smtp']['verify'](_0x233e1);};module[_0xdb54('0x32')]=EmailChannel; \ No newline at end of file diff --git a/server/services/email/lib/imap.js b/server/services/email/lib/imap.js index 5b7bc1e..0cd6028 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 _0x6386=['emit','handleFetchEnd','handleEnd','stringify','textCode','hasOwnProperty','exports','util','imap','mailparser','simpleParser','iconv','Iconv','events','./utils','../../../config/logger','mailbox','account','getAccount','once','handleReady','end','bind','error','handleError','connect','connTimeout','authTimeout','service','user','modernAuthentication','xoauth2','generateXOAuth2Token','CloudProvider','data5','password','authentication','email','anonymous@xcally.com','host','port','tls','autotls','required','prototype','openBox','handleOpenBox','box','readUnseen','search','UNSEEN','handleReadUnseen','length','fetch','message','handleFetchMessage','handleFetchError','closeBox','handleCloseBox','body','handleMessageBody','attributes','handleMessageAttributes','handleMessageEnd','handleSimpleParser'];(function(_0x214bdc,_0x3f398c){var _0x3ee5df=function(_0x4c5eec){while(--_0x4c5eec){_0x214bdc['push'](_0x214bdc['shift']());}};_0x3ee5df(++_0x3f398c);}(_0x6386,0x18d));var _0x6638=function(_0x1122a4,_0x5dff81){_0x1122a4=_0x1122a4-0x0;var _0x505498=_0x6386[_0x1122a4];return _0x505498;};'use strict';var _=require('lodash');var util=require(_0x6638('0x0'));var Imap=require(_0x6638('0x1'));var simpleParser=require(_0x6638('0x2'))[_0x6638('0x3')];var Iconv=require(_0x6638('0x4'))[_0x6638('0x5')];var EventEmitter=require(_0x6638('0x6'))['EventEmitter'];var utils=require(_0x6638('0x7'));var logger=require(_0x6638('0x8'))('email');function EmailImap(_0x5aaa35,_0x35de5e){this[_0x6638('0x9')]=_0x5aaa35['mailbox'];this[_0x6638('0xa')]=this[_0x6638('0xb')](_0x5aaa35,_0x35de5e);this[_0x6638('0x1')]=new Imap(this[_0x6638('0xa')]);this[_0x6638('0x1')][_0x6638('0xc')]('ready',this[_0x6638('0xd')]['bind'](this));this['imap'][_0x6638('0xc')](_0x6638('0xe'),this['handleEnd'][_0x6638('0xf')](this));this['imap']['on'](_0x6638('0x10'),this[_0x6638('0x11')][_0x6638('0xf')](this));this['imap'][_0x6638('0x12')]();}util['inherits'](EmailImap,EventEmitter);EmailImap['prototype'][_0x6638('0xb')]=function(_0x62a01b,_0x437e8){var _0x577434={'connTimeout':_0x62a01b[_0x6638('0x13')]?_0x62a01b[_0x6638('0x13')]*0x3e8:0x2710,'authTimeout':_0x62a01b['authTimeout']?_0x62a01b[_0x6638('0x14')]*0x3e8:0x1388};if(_0x62a01b[_0x6638('0x15')]){_0x577434[_0x6638('0x16')]=_0x62a01b[_0x6638('0x16')];if(_0x62a01b[_0x6638('0x17')]){_0x577434[_0x6638('0x18')]=utils[_0x6638('0x19')](_0x62a01b[_0x6638('0x1a')][_0x6638('0x1b')],_0x62a01b[_0x6638('0x16')]);}else{_0x577434[_0x6638('0x1c')]=_0x62a01b[_0x6638('0x1c')];}}else{if(_0x62a01b[_0x6638('0x1d')]){_0x577434['user']=_0x62a01b[_0x6638('0x16')];_0x577434[_0x6638('0x1c')]=_0x62a01b[_0x6638('0x1c')];}}_0x577434[_0x6638('0x1e')]=_0x437e8||_0x62a01b[_0x6638('0x16')]||_0x6638('0x1f');_0x577434[_0x6638('0x20')]=_0x62a01b[_0x6638('0x20')];_0x577434[_0x6638('0x21')]=_0x62a01b['port']||0x3e1;if(_0x62a01b[_0x6638('0x22')]){_0x577434[_0x6638('0x22')]=!![];}else{_0x577434[_0x6638('0x22')]=![];_0x577434[_0x6638('0x23')]=_0x6638('0x24');}return _0x577434;};EmailImap[_0x6638('0x25')][_0x6638('0xd')]=function(){this[_0x6638('0x1')][_0x6638('0x26')](this[_0x6638('0x9')],![],this[_0x6638('0x27')][_0x6638('0xf')](this));};EmailImap['prototype'][_0x6638('0x27')]=function(_0x11cb9a,_0x1a52dd){if(_0x11cb9a){this[_0x6638('0x11')](_0x11cb9a,!![]);}else{this['emit'](_0x6638('0x28'),_0x1a52dd);this[_0x6638('0x29')]();}};EmailImap[_0x6638('0x25')]['handleCloseBox']=function(_0x43cb57){if(_0x43cb57){this[_0x6638('0x11')](_0x43cb57,!![]);}else{this[_0x6638('0x1')]['end']();}};EmailImap[_0x6638('0x25')]['readUnseen']=function(){this[_0x6638('0x1')][_0x6638('0x2a')]([_0x6638('0x2b')],this['handleReadUnseen']['bind'](this));};EmailImap['prototype'][_0x6638('0x2c')]=function(_0x406ed6,_0x2f6bdf){if(_0x406ed6){this['handleError'](_0x406ed6,!![]);}else{if(_0x2f6bdf[_0x6638('0x2d')]){try{var _0x38fded=this['imap'][_0x6638('0x2e')](_0x2f6bdf,{'bodies':'','markSeen':!![]});_0x38fded['on'](_0x6638('0x2f'),this[_0x6638('0x30')]['bind'](this));_0x38fded['once'](_0x6638('0x10'),this[_0x6638('0x31')][_0x6638('0xf')](this));_0x38fded[_0x6638('0xc')](_0x6638('0xe'),this['handleFetchEnd'][_0x6638('0xf')](this));}catch(_0x1185a0){logger['error'](_0x1185a0);}}else{this[_0x6638('0x1')][_0x6638('0x32')](!![],this[_0x6638('0x33')]['bind'](this));}}};EmailImap[_0x6638('0x25')]['handleFetchMessage']=function(_0x4da6c8){_0x4da6c8['on'](_0x6638('0x34'),this[_0x6638('0x35')][_0x6638('0xf')](this));_0x4da6c8[_0x6638('0xc')](_0x6638('0x36'),this[_0x6638('0x37')][_0x6638('0xf')](this));_0x4da6c8['once'](_0x6638('0xe'),this[_0x6638('0x38')][_0x6638('0xf')](this));};EmailImap['prototype'][_0x6638('0x35')]=function(_0x224024){simpleParser(_0x224024,{'Iconv':Iconv},this[_0x6638('0x39')][_0x6638('0xf')](this));};EmailImap[_0x6638('0x25')][_0x6638('0x37')]=function(){};EmailImap[_0x6638('0x25')][_0x6638('0x38')]=function(){};EmailImap[_0x6638('0x25')][_0x6638('0x39')]=function(_0x4d9497,_0x468a8e){if(_0x4d9497){logger[_0x6638('0x10')](_0x4d9497);}else{var _0x28d68a=this;utils['parser'](this[_0x6638('0xa')],_0x468a8e,function(_0x499f99){_0x28d68a[_0x6638('0x3a')](_0x6638('0x1e'),_0x499f99);});}};EmailImap['prototype'][_0x6638('0x3b')]=function(){this['imap']['closeBox'](!![],this[_0x6638('0x33')][_0x6638('0xf')](this));};EmailImap[_0x6638('0x25')][_0x6638('0x31')]=function(_0x386bb8){this[_0x6638('0x11')](_0x386bb8);this['imap'][_0x6638('0x32')](!![],this[_0x6638('0x33')][_0x6638('0xf')](this));};EmailImap[_0x6638('0x25')][_0x6638('0x3c')]=function(){this[_0x6638('0x3a')]('end');};EmailImap[_0x6638('0x25')][_0x6638('0x11')]=function(_0x418a9c,_0x4838e7){logger['error'](_0x6638('0x11'),this[_0x6638('0xa')][_0x6638('0x1e')],JSON[_0x6638('0x3d')](_0x418a9c));var _0xe8fad5='';if(_0x418a9c){if(_0x418a9c[_0x6638('0x3e')]){_0xe8fad5=_0x418a9c['textCode'];}else{for(var _0x4e125f in _0x418a9c){if(_0x418a9c[_0x6638('0x3f')](_0x4e125f)){_0xe8fad5+=_['upperFirst'](_0x4e125f)+':\x20'+_0x418a9c[_0x4e125f]+'\x0a';}}}}if(_0x4838e7){this[_0x6638('0x1')]['end']();}else{this[_0x6638('0x3a')](_0x6638('0x10'),_0xe8fad5);this['emit']('end');}};module[_0x6638('0x40')]=EmailImap; \ No newline at end of file +var _0x9db5=['bind','end','handleEnd','error','handleError','inherits','connTimeout','authTimeout','user','xoauth2','generateXOAuth2Token','password','anonymous@xcally.com','tls','autotls','required','prototype','openBox','handleOpenBox','box','readUnseen','handleCloseBox','search','handleReadUnseen','length','fetch','message','handleFetchError','handleFetchEnd','closeBox','handleFetchMessage','body','handleMessageBody','attributes','handleMessageEnd','handleMessageAttributes','parser','emit','stringify','textCode','hasOwnProperty','upperFirst','exports','lodash','imap','iconv','Iconv','events','EventEmitter','./utils','../../../config/logger','email','mailbox','account','getAccount','once','ready','handleReady'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x9db5,0x113));var _0x59db=function(_0x4e5e7b,_0x444760){_0x4e5e7b=_0x4e5e7b-0x0;var _0x2831b7=_0x9db5[_0x4e5e7b];return _0x2831b7;};'use strict';var _=require(_0x59db('0x0'));var util=require('util');var Imap=require(_0x59db('0x1'));var simpleParser=require('mailparser')['simpleParser'];var Iconv=require(_0x59db('0x2'))[_0x59db('0x3')];var EventEmitter=require(_0x59db('0x4'))[_0x59db('0x5')];var utils=require(_0x59db('0x6'));var logger=require(_0x59db('0x7'))(_0x59db('0x8'));function EmailImap(_0x2e4c6c,_0x3ca9fe){this[_0x59db('0x9')]=_0x2e4c6c[_0x59db('0x9')];this[_0x59db('0xa')]=this[_0x59db('0xb')](_0x2e4c6c,_0x3ca9fe);this[_0x59db('0x1')]=new Imap(this['account']);this[_0x59db('0x1')][_0x59db('0xc')](_0x59db('0xd'),this[_0x59db('0xe')][_0x59db('0xf')](this));this[_0x59db('0x1')]['once'](_0x59db('0x10'),this[_0x59db('0x11')]['bind'](this));this[_0x59db('0x1')]['on'](_0x59db('0x12'),this[_0x59db('0x13')]['bind'](this));this[_0x59db('0x1')]['connect']();}util[_0x59db('0x14')](EmailImap,EventEmitter);EmailImap['prototype']['getAccount']=function(_0x39b5ff,_0x46c5b7){var _0xd31f58={'connTimeout':_0x39b5ff[_0x59db('0x15')]?_0x39b5ff[_0x59db('0x15')]*0x3e8:0x2710,'authTimeout':_0x39b5ff[_0x59db('0x16')]?_0x39b5ff[_0x59db('0x16')]*0x3e8:0x1388};if(_0x39b5ff['service']){_0xd31f58['user']=_0x39b5ff[_0x59db('0x17')];if(_0x39b5ff['modernAuthentication']){_0xd31f58[_0x59db('0x18')]=utils[_0x59db('0x19')](_0x39b5ff['CloudProvider']['data5'],_0x39b5ff['user']);}else{_0xd31f58[_0x59db('0x1a')]=_0x39b5ff['password'];}}else{if(_0x39b5ff['authentication']){_0xd31f58[_0x59db('0x17')]=_0x39b5ff[_0x59db('0x17')];_0xd31f58[_0x59db('0x1a')]=_0x39b5ff[_0x59db('0x1a')];}}_0xd31f58[_0x59db('0x8')]=_0x46c5b7||_0x39b5ff[_0x59db('0x17')]||_0x59db('0x1b');_0xd31f58['host']=_0x39b5ff['host'];_0xd31f58['port']=_0x39b5ff['port']||0x3e1;if(_0x39b5ff[_0x59db('0x1c')]){_0xd31f58[_0x59db('0x1c')]=!![];}else{_0xd31f58[_0x59db('0x1c')]=![];_0xd31f58[_0x59db('0x1d')]=_0x59db('0x1e');}return _0xd31f58;};EmailImap[_0x59db('0x1f')]['handleReady']=function(){this[_0x59db('0x1')][_0x59db('0x20')](this[_0x59db('0x9')],![],this[_0x59db('0x21')][_0x59db('0xf')](this));};EmailImap['prototype'][_0x59db('0x21')]=function(_0x5408ae,_0xb0abb8){if(_0x5408ae){this[_0x59db('0x13')](_0x5408ae,!![]);}else{this['emit'](_0x59db('0x22'),_0xb0abb8);this[_0x59db('0x23')]();}};EmailImap[_0x59db('0x1f')][_0x59db('0x24')]=function(_0x121866){if(_0x121866){this[_0x59db('0x13')](_0x121866,!![]);}else{this['imap'][_0x59db('0x10')]();}};EmailImap['prototype'][_0x59db('0x23')]=function(){this[_0x59db('0x1')][_0x59db('0x25')](['UNSEEN'],this[_0x59db('0x26')]['bind'](this));};EmailImap['prototype'][_0x59db('0x26')]=function(_0x1be17e,_0x4e912b){if(_0x1be17e){this[_0x59db('0x13')](_0x1be17e,!![]);}else{if(_0x4e912b[_0x59db('0x27')]){try{var _0x33a760=this[_0x59db('0x1')][_0x59db('0x28')](_0x4e912b,{'bodies':'','markSeen':!![]});_0x33a760['on'](_0x59db('0x29'),this['handleFetchMessage'][_0x59db('0xf')](this));_0x33a760[_0x59db('0xc')](_0x59db('0x12'),this[_0x59db('0x2a')]['bind'](this));_0x33a760[_0x59db('0xc')](_0x59db('0x10'),this[_0x59db('0x2b')][_0x59db('0xf')](this));}catch(_0x321dee){logger[_0x59db('0x12')](_0x321dee);}}else{this[_0x59db('0x1')][_0x59db('0x2c')](!![],this[_0x59db('0x24')][_0x59db('0xf')](this));}}};EmailImap[_0x59db('0x1f')][_0x59db('0x2d')]=function(_0x48c6e1){_0x48c6e1['on'](_0x59db('0x2e'),this[_0x59db('0x2f')][_0x59db('0xf')](this));_0x48c6e1[_0x59db('0xc')](_0x59db('0x30'),this['handleMessageAttributes'][_0x59db('0xf')](this));_0x48c6e1[_0x59db('0xc')](_0x59db('0x10'),this[_0x59db('0x31')]['bind'](this));};EmailImap[_0x59db('0x1f')]['handleMessageBody']=function(_0x1a1339){simpleParser(_0x1a1339,{'Iconv':Iconv},this['handleSimpleParser']['bind'](this));};EmailImap[_0x59db('0x1f')][_0x59db('0x32')]=function(){};EmailImap[_0x59db('0x1f')][_0x59db('0x31')]=function(){};EmailImap[_0x59db('0x1f')]['handleSimpleParser']=function(_0x3b6315,_0x5b2490){if(_0x3b6315){logger['error'](_0x3b6315);}else{var _0x9dfee2=this;utils[_0x59db('0x33')](this[_0x59db('0xa')],_0x5b2490,function(_0x20425a){_0x9dfee2[_0x59db('0x34')]('email',_0x20425a);});}};EmailImap[_0x59db('0x1f')][_0x59db('0x2b')]=function(){this[_0x59db('0x1')]['closeBox'](!![],this[_0x59db('0x24')][_0x59db('0xf')](this));};EmailImap[_0x59db('0x1f')][_0x59db('0x2a')]=function(_0x587fdc){this['handleError'](_0x587fdc);this[_0x59db('0x1')][_0x59db('0x2c')](!![],this[_0x59db('0x24')][_0x59db('0xf')](this));};EmailImap['prototype'][_0x59db('0x11')]=function(){this[_0x59db('0x34')](_0x59db('0x10'));};EmailImap[_0x59db('0x1f')]['handleError']=function(_0x2cb959,_0x38a3de){logger[_0x59db('0x12')](_0x59db('0x13'),this[_0x59db('0xa')][_0x59db('0x8')],JSON[_0x59db('0x35')](_0x2cb959));var _0x34e36d='';if(_0x2cb959){if(_0x2cb959[_0x59db('0x36')]){_0x34e36d=_0x2cb959['textCode'];}else{for(var _0x448030 in _0x2cb959){if(_0x2cb959[_0x59db('0x37')](_0x448030)){_0x34e36d+=_[_0x59db('0x38')](_0x448030)+':\x20'+_0x2cb959[_0x448030]+'\x0a';}}}}if(_0x38a3de){this[_0x59db('0x1')][_0x59db('0x10')]();}else{this[_0x59db('0x34')](_0x59db('0x12'),_0x34e36d);this[_0x59db('0x34')](_0x59db('0x10'));}};module[_0x59db('0x39')]=EmailImap; \ No newline at end of file diff --git a/server/services/email/lib/smtp.js b/server/services/email/lib/smtp.js index 880b341..6d23383 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 _0xe5dc=['nodemailer','prototype','send','createTransport','use','compile','sendMail','toString','Not\x20verifired','exports'];(function(_0x4b7b62,_0x4920a9){var _0x2280df=function(_0x21e1f8){while(--_0x21e1f8){_0x4b7b62['push'](_0x4b7b62['shift']());}};_0x2280df(++_0x4920a9);}(_0xe5dc,0x1cc));var _0xce5d=function(_0x1b8c74,_0x413446){_0x1b8c74=_0x1b8c74-0x0;var _0x24a27a=_0xe5dc[_0x1b8c74];return _0x24a27a;};'use strict';var nodemailer=require(_0xce5d('0x0'));var inlineBase64=require('nodemailer-plugin-inline-base64');function EmailSmtp(){}EmailSmtp[_0xce5d('0x1')][_0xce5d('0x2')]=function(_0x53df7c,_0x225dff){return new Promise(function(_0x37117b,_0x1fca32){var _0x16ca82=nodemailer[_0xce5d('0x3')](_0x53df7c);_0x16ca82[_0xce5d('0x4')](_0xce5d('0x5'),inlineBase64());_0x16ca82[_0xce5d('0x6')](_0x225dff,function(_0x372efe,_0x21ecf0){if(_0x372efe){_0x1fca32(_0x372efe[_0xce5d('0x7')]());}else{_0x37117b(_0x21ecf0);}});});};EmailSmtp['prototype']['verify']=function(_0x47081d){return new Promise(function(_0x20fade,_0x576e51){var _0x4b7df1=nodemailer[_0xce5d('0x3')](_0x47081d);_0x4b7df1['verify'](function(_0x5d2c4a,_0x47f1ed){if(_0x5d2c4a){_0x576e51(_0x5d2c4a[_0xce5d('0x7')]());}else{if(_0x47f1ed){_0x20fade(_0x47f1ed);}else{_0x576e51(_0xce5d('0x8'));}}});});};module[_0xce5d('0x9')]=EmailSmtp; \ No newline at end of file +var _0x24f7=['sendMail','toString','prototype','verify','exports','nodemailer-plugin-inline-base64','send','createTransport','use','compile'];(function(_0x34e40f,_0x2e3780){var _0x3e5246=function(_0x7970ea){while(--_0x7970ea){_0x34e40f['push'](_0x34e40f['shift']());}};_0x3e5246(++_0x2e3780);}(_0x24f7,0x19f));var _0x724f=function(_0x27af45,_0x1b57aa){_0x27af45=_0x27af45-0x0;var _0x18df21=_0x24f7[_0x27af45];return _0x18df21;};'use strict';var nodemailer=require('nodemailer');var inlineBase64=require(_0x724f('0x0'));function EmailSmtp(){}EmailSmtp['prototype'][_0x724f('0x1')]=function(_0x1e2ecb,_0x18cd48){return new Promise(function(_0x4f5015,_0x47b00f){var _0x2c3d9a=nodemailer[_0x724f('0x2')](_0x1e2ecb);_0x2c3d9a[_0x724f('0x3')](_0x724f('0x4'),inlineBase64());_0x2c3d9a[_0x724f('0x5')](_0x18cd48,function(_0x290e32,_0x597dcb){if(_0x290e32){_0x47b00f(_0x290e32[_0x724f('0x6')]());}else{_0x4f5015(_0x597dcb);}});});};EmailSmtp[_0x724f('0x7')][_0x724f('0x8')]=function(_0x3f9710){return new Promise(function(_0x2f7a55,_0x24f11a){var _0x1ae2e2=nodemailer['createTransport'](_0x3f9710);_0x1ae2e2[_0x724f('0x8')](function(_0x235f5c,_0x2087a2){if(_0x235f5c){_0x24f11a(_0x235f5c[_0x724f('0x6')]());}else{if(_0x2087a2){_0x2f7a55(_0x2087a2);}else{_0x24f11a('Not\x20verifired');}}});});};module[_0x724f('0x9')]=EmailSmtp; \ No newline at end of file diff --git a/server/services/email/lib/utils.js b/server/services/email/lib/utils.js index 16bee85..30b4bae 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 _0xc202=['format','now','join','root','server/files/attachments/','writeFileSync','content','contentType','headerLines','X-Auto-Response-Suppress:\x20All','Precedence:\x20auto_reply','line','isAutoreply','from','subject','messageId','date','YYYY-MM-DD\x20HH:mm:ss','application/ms-tnef','info','parseBuffer','first','BodyHTML','

Empty\x20message

','Attachments','Title','Data','generateXOAuth2Token','user=','auth=Bearer\x20','utf-8','toString','base64','lodash','moment','randomstring','path','util','node-tnef','../../../config/logger','email','head','address','anonymous','generate','@xcally.com','value','name','substring','indexOf','split','length','slice','pop','html','test','replace','\x20[Attachment:\x20','body','textAsHtml','0x1?_0x236dff[_0x2c20('0x13')](0x0,-0x1)['join']('\x20'):_0x976572[_0x2c20('0xe')];}return'Anonymous';}function getLastName(_0x54fbba){var _0x53fc8a=_['head'](_0x54fbba[_0x2c20('0xd')]);if(_0x53fc8a&&_0x53fc8a[_0x2c20('0xe')]){var _0x567f72=_0x53fc8a['name'][_0x2c20('0x11')](/\s+/);return _0x567f72[_0x2c20('0x12')]>0x1?_0x567f72[_0x2c20('0x14')]():'';}return'';}function getMails(_0x20f556,_0x127b54){var _0x3606a1='';for(var _0x3b6005=0x0;_0x3b6005<_0x127b54['value'][_0x2c20('0x12')];_0x3b6005+=0x1){if(_0x127b54[_0x2c20('0xd')][_0x3b6005][_0x2c20('0x9')]!==_0x20f556){if(!_['isEmpty'](_0x3606a1)){_0x3606a1+=',';}_0x3606a1+=_0x127b54['value'][_0x3b6005][_0x2c20('0xe')]||_0x127b54[_0x2c20('0xd')][_0x3b6005][_0x2c20('0x9')]||'';_0x3606a1+='\x20<';_0x3606a1+=_0x127b54[_0x2c20('0xd')][_0x3b6005]['address']?_0x127b54[_0x2c20('0xd')][_0x3b6005]['address']:'anonymous'+random[_0x2c20('0xb')](0x6)+_0x2c20('0xc');_0x3606a1+='>';}}return _0x3606a1;}function parseEmail(_0x328efe,_0x4e2891,_0x121df6){if(_0x4e2891[_0x2c20('0x15')]){var _0x594850=/)<[^<]*)*<\/script>/gi;while(_0x594850[_0x2c20('0x16')](_0x4e2891[_0x2c20('0x15')])){_0x4e2891['html']=_0x4e2891[_0x2c20('0x15')][_0x2c20('0x17')](_0x594850,'');}if(_0x4e2891[_0x2c20('0x15')]['includes'](_0x2c20('0x18'))){var _0x1f8e02=[];_0x4e2891[_0x2c20('0x19')][_0x2c20('0x1a')](_0x137076=>{_0x1f8e02[_0x2c20('0x1b')](_0x137076[_0x2c20('0x1c')]);});var _0x21d39d=/]+>/g;var _0x4a5971=/src="data:image\/([a-zA-Z]*);base64,([^"]*)"/g;var _0x3700a0=_0x4e2891[_0x2c20('0x15')][_0x2c20('0x17')](_0x4a5971,_0x2c20('0x1d'));var _0x100c41=_0x3700a0['replace'](_0x21d39d,_0x2c20('0x1e'));for(let _0x5267f2=0x0;_0x5267f2<_0x1f8e02['length'];_0x5267f2++){var _0x3e2999=_0x100c41['replace'](_0x2c20('0x1e'),_0x2c20('0x1f')+_0x1f8e02[_0x5267f2]+'\x20]');_0x100c41=_0x3e2999;}_0x4e2891[_0x2c20('0x15')]=_0x100c41;}_0x121df6[_0x2c20('0x20')]=_0x4e2891[_0x2c20('0x15')];}else{_0x121df6[_0x2c20('0x20')]=_0x4e2891[_0x2c20('0x21')];}if(_0x121df6[_0x2c20('0x20')]){_0x121df6['body']=_0x121df6['body'][_0x2c20('0x17')](/0x0){var _0x41958b=['Auto-Submitted:\x20auto-replied',_0x2c20('0x35'),_0x2c20('0x36')];for(var _0x4c7e3d=0x0;_0x4c7e3d<_0x4e2891[_0x2c20('0x34')][_0x2c20('0x12')];_0x4c7e3d++){var _0x1b71a8=_['indexOf'](_0x41958b,_0x4e2891[_0x2c20('0x34')][_0x4c7e3d][_0x2c20('0x37')]);if(_0x1b71a8>=0x0){_0x121df6[_0x2c20('0x38')]=!![];}}}return _0x121df6;}exports['parser']=function(_0x2b9958,_0x5ca3a9,_0x1a0a66){var _0x354de8={'from':getAddress(_0x5ca3a9[_0x2c20('0x39')]),'firstName':getFirstName(_0x5ca3a9[_0x2c20('0x39')]),'lastName':getLastName(_0x5ca3a9['from']),'mapKey':'email','message':{'from':getMails(_0x2b9958[_0x2c20('0x7')],_0x5ca3a9[_0x2c20('0x39')]),'to':_0x2b9958[_0x2c20('0x7')],'cc':'','subject':_0x5ca3a9[_0x2c20('0x3a')]||'','messageId':_0x5ca3a9[_0x2c20('0x3b')],'inReplyTo':_0x5ca3a9['inReplyTo'],'sentAt':moment(_0x5ca3a9[_0x2c20('0x3c')])['format'](_0x2c20('0x3d')),'attach':![],'attachments':[]}};if(!_0x5ca3a9['html']&&!_0x5ca3a9['textAsHtml']){var _0x30a54a=_['filter'](_0x5ca3a9['attachments'],{'contentType':_0x2c20('0x3e')});if(_0x30a54a[_0x2c20('0x12')]){logger[_0x2c20('0x3f')](util[_0x2c20('0x2c')]('Email\x20message\x20%s\x20is\x20in\x20TNEF\x20format:\x20message\x20content\x20will\x20be\x20converted\x20by\x20the\x20system',_0x5ca3a9[_0x2c20('0x3b')]));tnef[_0x2c20('0x40')](_[_0x2c20('0x41')](_0x30a54a)[_0x2c20('0x32')],function(_0x33bfef,_0x5324e5){if(_0x5324e5){_0x5ca3a9[_0x2c20('0x15')]=_0x5324e5[_0x2c20('0x42')]||_0x2c20('0x43');if(_0x5324e5[_0x2c20('0x44')]){for(var _0x5f5b26=0x0;_0x5f5b26<_0x5324e5[_0x2c20('0x44')][_0x2c20('0x12')];_0x5f5b26++){var _0x534e19=_0x5324e5[_0x2c20('0x44')][_0x5f5b26];_0x354de8[_0x2c20('0x25')][_0x2c20('0x19')][_0x2c20('0x1b')]({'filename':_0x534e19[_0x2c20('0x45')],'content':Buffer[_0x2c20('0x39')](_0x534e19[_0x2c20('0x46')])});}}}_0x1a0a66(parseEmail(_0x2b9958,_0x5ca3a9,_0x354de8));});}else{_0x5ca3a9['html']=_0x2c20('0x43');_0x1a0a66(parseEmail(_0x2b9958,_0x5ca3a9,_0x354de8));}}else{_0x1a0a66(parseEmail(_0x2b9958,_0x5ca3a9,_0x354de8));}};exports[_0x2c20('0x47')]=function(_0x120ee2,_0x25e4ae){var _0x591757=[_0x2c20('0x48')+(_0x25e4ae||''),_0x2c20('0x49')+_0x120ee2,'',''];return Buffer['from'](_0x591757[_0x2c20('0x2e')](''),_0x2c20('0x4a'))[_0x2c20('0x4b')](_0x2c20('0x4c'));}; \ No newline at end of file +var _0xfce6=['Data','generateXOAuth2Token','auth=Bearer\x20','utf-8','base64','lodash','randomstring','path','util','node-tnef','../../../config/logger','email','../../../config/environment','head','value','address','anonymous','generate','@xcally.com','name','substring','indexOf','split','length','slice','isEmpty','html','test','replace','includes','\x20[Attachment:\x20','\x20]','body','textAsHtml','Empty\x20message

','Attachments','Title'];(function(_0x33a5ec,_0x10c014){var _0x38f89c=function(_0x15f7ee){while(--_0x15f7ee){_0x33a5ec['push'](_0x33a5ec['shift']());}};_0x38f89c(++_0x10c014);}(_0xfce6,0xd7));var _0x6fce=function(_0x38806d,_0x176c25){_0x38806d=_0x38806d-0x0;var _0x235ec0=_0xfce6[_0x38806d];return _0x235ec0;};'use strict';var _=require(_0x6fce('0x0'));var moment=require('moment');var random=require(_0x6fce('0x1'));var fs=require('fs');var path=require(_0x6fce('0x2'));var util=require(_0x6fce('0x3'));var tnef=require(_0x6fce('0x4'));var logger=require(_0x6fce('0x5'))(_0x6fce('0x6'));var config=require(_0x6fce('0x7'));function getAddress(_0x18efed){var _0x10506e=_[_0x6fce('0x8')](_0x18efed[_0x6fce('0x9')]);return _0x10506e&&_0x10506e[_0x6fce('0xa')]?_0x10506e[_0x6fce('0xa')]:_0x6fce('0xb')+random[_0x6fce('0xc')](0x6)+_0x6fce('0xd');}function getFirstName(_0x479834){var _0x12d043=_[_0x6fce('0x8')](_0x479834['value']);if(_0x12d043&&_0x12d043[_0x6fce('0xe')]){if(_0x12d043[_0x6fce('0xe')]==_0x12d043[_0x6fce('0xa')]){return _0x12d043[_0x6fce('0xe')][_0x6fce('0xf')](0x0,_0x12d043[_0x6fce('0xe')][_0x6fce('0x10')]('@'));}var _0x21a264=_0x12d043['name'][_0x6fce('0x11')](/\s+/);return _0x21a264[_0x6fce('0x12')]>0x1?_0x21a264[_0x6fce('0x13')](0x0,-0x1)['join']('\x20'):_0x12d043[_0x6fce('0xe')];}return'Anonymous';}function getLastName(_0x426f7e){var _0x5f42bf=_[_0x6fce('0x8')](_0x426f7e['value']);if(_0x5f42bf&&_0x5f42bf[_0x6fce('0xe')]){var _0x23baef=_0x5f42bf['name'][_0x6fce('0x11')](/\s+/);return _0x23baef[_0x6fce('0x12')]>0x1?_0x23baef['pop']():'';}return'';}function getMails(_0x2c7b4e,_0x481928){var _0x4a5d95='';for(var _0x4182a3=0x0;_0x4182a3<_0x481928[_0x6fce('0x9')][_0x6fce('0x12')];_0x4182a3+=0x1){if(_0x481928['value'][_0x4182a3][_0x6fce('0xa')]!==_0x2c7b4e){if(!_[_0x6fce('0x14')](_0x4a5d95)){_0x4a5d95+=',';}_0x4a5d95+=_0x481928[_0x6fce('0x9')][_0x4182a3][_0x6fce('0xe')]||_0x481928[_0x6fce('0x9')][_0x4182a3][_0x6fce('0xa')]||'';_0x4a5d95+='\x20<';_0x4a5d95+=_0x481928[_0x6fce('0x9')][_0x4182a3][_0x6fce('0xa')]?_0x481928[_0x6fce('0x9')][_0x4182a3][_0x6fce('0xa')]:'anonymous'+random[_0x6fce('0xc')](0x6)+_0x6fce('0xd');_0x4a5d95+='>';}}return _0x4a5d95;}function parseEmail(_0x11d76a,_0x4dd695,_0x5556d3){if(_0x4dd695[_0x6fce('0x15')]){var _0x554b57=/)<[^<]*)*<\/script>/gi;while(_0x554b57[_0x6fce('0x16')](_0x4dd695[_0x6fce('0x15')])){_0x4dd695[_0x6fce('0x15')]=_0x4dd695[_0x6fce('0x15')][_0x6fce('0x17')](_0x554b57,'');}if(_0x4dd695['html'][_0x6fce('0x18')](_0x6fce('0x19'))){var _0x3e6ee9=[];_0x4dd695[_0x6fce('0x1a')]['forEach'](_0x2d81cb=>{_0x3e6ee9[_0x6fce('0x1b')](_0x2d81cb[_0x6fce('0x1c')]);});var _0x5e3ec3=/]+>/g;var _0x42035b=/src="data:image\/([a-zA-Z]*);base64,([^"]*)"/g;var _0xbd6c40=_0x4dd695[_0x6fce('0x15')][_0x6fce('0x17')](_0x42035b,_0x6fce('0x1d'));var _0x1d4f7a=_0xbd6c40[_0x6fce('0x17')](_0x5e3ec3,_0x6fce('0x1e'));for(let _0xcfee47=0x0;_0xcfee47<_0x3e6ee9[_0x6fce('0x12')];_0xcfee47++){var _0x553ded=_0x1d4f7a['replace'](_0x6fce('0x1e'),_0x6fce('0x1f')+_0x3e6ee9[_0xcfee47]+_0x6fce('0x20'));_0x1d4f7a=_0x553ded;}_0x4dd695[_0x6fce('0x15')]=_0x1d4f7a;}_0x5556d3[_0x6fce('0x21')]=_0x4dd695[_0x6fce('0x15')];}else{_0x5556d3[_0x6fce('0x21')]=_0x4dd695[_0x6fce('0x22')];}if(_0x5556d3[_0x6fce('0x21')]){_0x5556d3[_0x6fce('0x21')]=_0x5556d3[_0x6fce('0x21')][_0x6fce('0x17')](/0x0){var _0x113190=[_0x6fce('0x30'),_0x6fce('0x31'),'Precedence:\x20auto_reply'];for(var _0x13fc25=0x0;_0x13fc25<_0x4dd695['headerLines'][_0x6fce('0x12')];_0x13fc25++){var _0x160ce6=_[_0x6fce('0x10')](_0x113190,_0x4dd695[_0x6fce('0x2f')][_0x13fc25][_0x6fce('0x32')]);if(_0x160ce6>=0x0){_0x5556d3['isAutoreply']=!![];}}}return _0x5556d3;}exports[_0x6fce('0x33')]=function(_0x12bef8,_0x4f8cb1,_0x46db40){var _0x1c56b1={'from':getAddress(_0x4f8cb1[_0x6fce('0x34')]),'firstName':getFirstName(_0x4f8cb1[_0x6fce('0x34')]),'lastName':getLastName(_0x4f8cb1['from']),'mapKey':_0x6fce('0x6'),'message':{'from':getMails(_0x12bef8[_0x6fce('0x6')],_0x4f8cb1[_0x6fce('0x34')]),'to':_0x12bef8[_0x6fce('0x6')],'cc':'','subject':_0x4f8cb1[_0x6fce('0x35')]||'','messageId':_0x4f8cb1[_0x6fce('0x36')],'inReplyTo':_0x4f8cb1[_0x6fce('0x37')],'sentAt':moment(_0x4f8cb1[_0x6fce('0x38')])[_0x6fce('0x28')](_0x6fce('0x39')),'attach':![],'attachments':[]}};if(!_0x4f8cb1[_0x6fce('0x15')]&&!_0x4f8cb1[_0x6fce('0x22')]){var _0x3ff4c2=_['filter'](_0x4f8cb1[_0x6fce('0x1a')],{'contentType':'application/ms-tnef'});if(_0x3ff4c2[_0x6fce('0x12')]){logger[_0x6fce('0x3a')](util[_0x6fce('0x28')]('Email\x20message\x20%s\x20is\x20in\x20TNEF\x20format:\x20message\x20content\x20will\x20be\x20converted\x20by\x20the\x20system',_0x4f8cb1[_0x6fce('0x36')]));tnef[_0x6fce('0x3b')](_[_0x6fce('0x3c')](_0x3ff4c2)[_0x6fce('0x2e')],function(_0x2aa4ba,_0x1b03e1){if(_0x1b03e1){_0x4f8cb1['html']=_0x1b03e1[_0x6fce('0x3d')]||_0x6fce('0x3e');if(_0x1b03e1[_0x6fce('0x3f')]){for(var _0x14b0f4=0x0;_0x14b0f4<_0x1b03e1['Attachments'][_0x6fce('0x12')];_0x14b0f4++){var _0x205a6a=_0x1b03e1[_0x6fce('0x3f')][_0x14b0f4];_0x1c56b1[_0x6fce('0x24')][_0x6fce('0x1a')]['push']({'filename':_0x205a6a[_0x6fce('0x40')],'content':Buffer[_0x6fce('0x34')](_0x205a6a[_0x6fce('0x41')])});}}}_0x46db40(parseEmail(_0x12bef8,_0x4f8cb1,_0x1c56b1));});}else{_0x4f8cb1[_0x6fce('0x15')]=_0x6fce('0x3e');_0x46db40(parseEmail(_0x12bef8,_0x4f8cb1,_0x1c56b1));}}else{_0x46db40(parseEmail(_0x12bef8,_0x4f8cb1,_0x1c56b1));}};exports[_0x6fce('0x42')]=function(_0x4b4b80,_0x3af264){var _0x45fb86=['user='+(_0x3af264||''),_0x6fce('0x43')+_0x4b4b80,'',''];return Buffer[_0x6fce('0x34')](_0x45fb86[_0x6fce('0x2a')](''),_0x6fce('0x44'))['toString'](_0x6fce('0x45'));}; \ No newline at end of file diff --git a/server/services/email/model/mailAccount.js b/server/services/email/model/mailAccount.js index d8fdcf4..8b80349 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 _0x9674=['Smtp','exports','lodash','name','Service','key','SERV','active','Imap'];(function(_0x5391a1,_0xc617ff){var _0xb454de=function(_0x2b5772){while(--_0x2b5772){_0x5391a1['push'](_0x5391a1['shift']());}};_0xb454de(++_0xc617ff);}(_0x9674,0x197));var _0x4967=function(_0x43fda2,_0x1c5662){_0x43fda2=_0x43fda2-0x0;var _0xa492a2=_0x9674[_0x43fda2];return _0xa492a2;};'use strict';var _=require(_0x4967('0x0'));function MailAccount(_0x311546){this['id']=_0x311546['id']||0x0;this['name']=_0x311546[_0x4967('0x1')]||_0x4967('0x2');this['key']=_0x311546[_0x4967('0x3')]||_0x4967('0x4');this[_0x4967('0x5')]=_0x311546[_0x4967('0x5')]||![];this[_0x4967('0x6')]=_0x311546['Imap']||[];this[_0x4967('0x7')]=_0x311546[_0x4967('0x7')]||[];}module[_0x4967('0x8')]=MailAccount; \ No newline at end of file +var _0xefff=['name','Service','key','SERV','active','Imap','Smtp','exports','lodash'];(function(_0x3ee7e2,_0x15cf09){var _0x1c1f18=function(_0x3426e0){while(--_0x3426e0){_0x3ee7e2['push'](_0x3ee7e2['shift']());}};_0x1c1f18(++_0x15cf09);}(_0xefff,0x6b));var _0xfeff=function(_0x36c87e,_0x4bb6c7){_0x36c87e=_0x36c87e-0x0;var _0xe380a0=_0xefff[_0x36c87e];return _0xe380a0;};'use strict';var _=require(_0xfeff('0x0'));function MailAccount(_0x24280f){this['id']=_0x24280f['id']||0x0;this[_0xfeff('0x1')]=_0x24280f[_0xfeff('0x1')]||_0xfeff('0x2');this[_0xfeff('0x3')]=_0x24280f['key']||_0xfeff('0x4');this[_0xfeff('0x5')]=_0x24280f[_0xfeff('0x5')]||![];this[_0xfeff('0x6')]=_0x24280f[_0xfeff('0x6')]||[];this[_0xfeff('0x7')]=_0x24280f['Smtp']||[];}module[_0xfeff('0x8')]=MailAccount; \ No newline at end of file diff --git a/server/services/email/realtime/index.js b/server/services/email/realtime/index.js index 40b1ea2..f0a4e91 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 _0xe933=['mergeFromDatabase','prototype','length','exports','../model/mailAccount','mailAccounts','mapKeys','hasOwnProperty'];(function(_0x38c817,_0x88a47e){var _0x3a1e4e=function(_0x5b3638){while(--_0x5b3638){_0x38c817['push'](_0x38c817['shift']());}};_0x3a1e4e(++_0x88a47e);}(_0xe933,0x174));var _0x3e93=function(_0x5d6456,_0x58ecc7){_0x5d6456=_0x5d6456-0x0;var _0x4d66c1=_0xe933[_0x5d6456];return _0x4d66c1;};'use strict';var _=require('lodash');var MailAccount=require(_0x3e93('0x0'));var Realtime=function(){this[_0x3e93('0x1')]={};};function freeIsNotKey(_0x1aca45,_0x2b6a06,_0x1c898f){var _0x2568f4=_[_0x3e93('0x2')](_0x1aca45,function(_0x5863f8,_0x1610b9){return _0x5863f8[_0x1c898f];});for(var _0x498153 in _0x2b6a06){if(_0x2b6a06[_0x3e93('0x3')](_0x498153)){if(!_0x2568f4[_0x498153]){delete _0x2b6a06[_0x498153];}}}}Realtime['prototype'][_0x3e93('0x4')]=function(_0x1eefed,_0x3c61ec){for(var _0x3c7a55 in _0x3c61ec){if(_0x1eefed[_0x3e93('0x3')](_0x3c7a55)){_0x1eefed[_0x3c7a55]=_0x3c61ec[_0x3c7a55];}}};Realtime[_0x3e93('0x5')]['initMailAccounts']=function(){var _0x2d22e0=this;return function(_0x171255){if(_0x171255){freeIsNotKey(_0x171255,_0x2d22e0['mailAccounts'],'id');for(var _0x3e125f=0x0,_0x48a1c6={},_0x474512={};_0x3e125f<_0x171255[_0x3e93('0x6')];_0x3e125f+=0x1){_0x48a1c6=_0x171255[_0x3e125f];if(_['isUndefined'](_0x2d22e0[_0x3e93('0x1')][_0x48a1c6['id']])){_0x2d22e0[_0x3e93('0x1')][_0x48a1c6['id']]=new MailAccount(_0x48a1c6);}else{_['merge'](_0x2d22e0[_0x3e93('0x1')][_0x48a1c6['id']],_0x48a1c6);}}}return _0x2d22e0[_0x3e93('0x1')];};};module[_0x3e93('0x7')]=Realtime; \ No newline at end of file +var _0xcbe2=['merge','lodash','../model/mailAccount','mailAccounts','mapKeys','hasOwnProperty','prototype','mergeFromDatabase','initMailAccounts','isUndefined'];(function(_0x2dea24,_0x2fc021){var _0x309d58=function(_0x2eb89f){while(--_0x2eb89f){_0x2dea24['push'](_0x2dea24['shift']());}};_0x309d58(++_0x2fc021);}(_0xcbe2,0x119));var _0x2cbe=function(_0x3cc161,_0x33132f){_0x3cc161=_0x3cc161-0x0;var _0xea7289=_0xcbe2[_0x3cc161];return _0xea7289;};'use strict';var _=require(_0x2cbe('0x0'));var MailAccount=require(_0x2cbe('0x1'));var Realtime=function(){this[_0x2cbe('0x2')]={};};function freeIsNotKey(_0x2ac26f,_0x2569bf,_0x43c311){var _0x1eb900=_[_0x2cbe('0x3')](_0x2ac26f,function(_0xeb9161,_0x78a1f5){return _0xeb9161[_0x43c311];});for(var _0x2036c7 in _0x2569bf){if(_0x2569bf[_0x2cbe('0x4')](_0x2036c7)){if(!_0x1eb900[_0x2036c7]){delete _0x2569bf[_0x2036c7];}}}}Realtime[_0x2cbe('0x5')][_0x2cbe('0x6')]=function(_0x53bd31,_0x5a5c84){for(var _0x1729d3 in _0x5a5c84){if(_0x53bd31[_0x2cbe('0x4')](_0x1729d3)){_0x53bd31[_0x1729d3]=_0x5a5c84[_0x1729d3];}}};Realtime['prototype'][_0x2cbe('0x7')]=function(){var _0x451f2f=this;return function(_0x47c3b7){if(_0x47c3b7){freeIsNotKey(_0x47c3b7,_0x451f2f[_0x2cbe('0x2')],'id');for(var _0x258da0=0x0,_0x38fd53={},_0xf9d4b7={};_0x258da0<_0x47c3b7['length'];_0x258da0+=0x1){_0x38fd53=_0x47c3b7[_0x258da0];if(_[_0x2cbe('0x8')](_0x451f2f['mailAccounts'][_0x38fd53['id']])){_0x451f2f['mailAccounts'][_0x38fd53['id']]=new MailAccount(_0x38fd53);}else{_[_0x2cbe('0x9')](_0x451f2f[_0x2cbe('0x2')][_0x38fd53['id']],_0x38fd53);}}}return _0x451f2f['mailAccounts'];};};module['exports']=Realtime; \ No newline at end of file diff --git a/server/services/email/rpc/mailAccount.js b/server/services/email/rpc/mailAccount.js index 0c39d3d..1278428 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 _0xdb82=['email','active','key','ListId','Imap','type','data5','CloudProvider','name','getMailAccount','notify','NotifyMailAccount','../client','Request','GetMailAccount','service'];(function(_0xfe5765,_0x15557c){var _0x3ebbcc=function(_0x484c06){while(--_0x484c06){_0xfe5765['push'](_0xfe5765['shift']());}};_0x3ebbcc(++_0x15557c);}(_0xdb82,0x1dc));var _0x2db8=function(_0x117a6b,_0x103d7e){_0x117a6b=_0x117a6b-0x0;var _0x402379=_0xdb82[_0x117a6b];return _0x402379;};'use strict';var client=require(_0x2db8('0x0'));exports['getMailAccounts']=function(){return function(){return client[_0x2db8('0x1')](_0x2db8('0x2'),{'options':{'attributes':['id','name','provider',_0x2db8('0x3'),_0x2db8('0x4'),_0x2db8('0x5'),_0x2db8('0x6'),_0x2db8('0x7'),'TemplateId'],'raw':![],'include':[{'model':'MailServerIn','as':_0x2db8('0x8'),'include':[{'model':'CloudProvider','attributes':['id','name','service',_0x2db8('0x9'),_0x2db8('0xa')],'as':'CloudProvider'}]},{'model':'MailServerOut','as':'Smtp','include':[{'model':_0x2db8('0xb'),'attributes':['id',_0x2db8('0xc'),_0x2db8('0x3'),_0x2db8('0x9'),'data5'],'as':_0x2db8('0xb')}]}]},'log':_0x2db8('0xd')});};};exports[_0x2db8('0xe')]=function(_0x50086c,_0x502a9b){return client[_0x2db8('0x1')](_0x2db8('0xf'),{'account':{'id':_0x50086c},'body':_0x502a9b,'log':_0x2db8('0xf')});}; \ No newline at end of file +var _0xf40b=['Smtp','type','getMailAccount','notify','NotifyMailAccount','getMailAccounts','Request','GetMailAccount','name','service','email','active','key','ListId','MailServerIn','Imap','CloudProvider','data5','MailServerOut'];(function(_0x4b4638,_0xe99cda){var _0x59e92b=function(_0x2817ea){while(--_0x2817ea){_0x4b4638['push'](_0x4b4638['shift']());}};_0x59e92b(++_0xe99cda);}(_0xf40b,0xb0));var _0xbf40=function(_0x35aeb5,_0x4e8855){_0x35aeb5=_0x35aeb5-0x0;var _0x18fcec=_0xf40b[_0x35aeb5];return _0x18fcec;};'use strict';var client=require('../client');exports[_0xbf40('0x0')]=function(){return function(){return client[_0xbf40('0x1')](_0xbf40('0x2'),{'options':{'attributes':['id',_0xbf40('0x3'),'provider',_0xbf40('0x4'),_0xbf40('0x5'),_0xbf40('0x6'),_0xbf40('0x7'),_0xbf40('0x8'),'TemplateId'],'raw':![],'include':[{'model':_0xbf40('0x9'),'as':_0xbf40('0xa'),'include':[{'model':_0xbf40('0xb'),'attributes':['id',_0xbf40('0x3'),_0xbf40('0x4'),'type',_0xbf40('0xc')],'as':_0xbf40('0xb')}]},{'model':_0xbf40('0xd'),'as':_0xbf40('0xe'),'include':[{'model':_0xbf40('0xb'),'attributes':['id',_0xbf40('0x3'),_0xbf40('0x4'),_0xbf40('0xf'),'data5'],'as':_0xbf40('0xb')}]}]},'log':_0xbf40('0x10')});};};exports[_0xbf40('0x11')]=function(_0x3118d9,_0x380a1e){return client[_0xbf40('0x1')](_0xbf40('0x12'),{'account':{'id':_0x3118d9},'body':_0x380a1e,'log':_0xbf40('0x12')});}; \ No newline at end of file diff --git a/server/services/email/rpc/setting.js b/server/services/email/rpc/setting.js index 9cd08a5..394a01d 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 _0xedf5=['ShowSetting','loginMailFrequency','GetSettings','../client','getSettings'];(function(_0x49d41c,_0x2bdc35){var _0xb64c5f=function(_0x28f535){while(--_0x28f535){_0x49d41c['push'](_0x49d41c['shift']());}};_0xb64c5f(++_0x2bdc35);}(_0xedf5,0xc6));var _0x5edf=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xedf5[_0x3dd15e];return _0x231fd0;};'use strict';var client=require(_0x5edf('0x0'));exports[_0x5edf('0x1')]=function(){return client['Request'](_0x5edf('0x2'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0x5edf('0x3')]},'log':_0x5edf('0x4')});}; \ No newline at end of file +var _0x1612=['../client','Request','ShowSetting','loginMailFrequency'];(function(_0x4a39f2,_0x4ef331){var _0x1d8bc9=function(_0x44aa39){while(--_0x44aa39){_0x4a39f2['push'](_0x4a39f2['shift']());}};_0x1d8bc9(++_0x4ef331);}(_0x1612,0xe0));var _0x2161=function(_0x265bc8,_0x4c88f4){_0x265bc8=_0x265bc8-0x0;var _0x4ee96a=_0x1612[_0x265bc8];return _0x4ee96a;};'use strict';var client=require(_0x2161('0x0'));exports['getSettings']=function(){return client[_0x2161('0x1')](_0x2161('0x2'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0x2161('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 87d4bed..223efbc 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(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0xa9e0[_0x6c993a];return _0x27f547;};'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(_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 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 9134f11..2ec5c58 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 _0x3b19=['../../config/environment','timeout','listen','port','defaults','redis','localhost','adapter','socket.io-redis','../../config/triggers','default','../../config/socketio','../../config/express','../../routes','once','listening','log','Express\x20server\x20listening\x20on\x20port\x20%d!','exports','lodash','http','express','sticky-session','ioredis'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x3b19,0x8b));var _0x93b1=function(_0x64397d,_0xc17569){_0x64397d=_0x64397d-0x0;var _0x5de5cc=_0x3b19[_0x64397d];return _0x5de5cc;};'use strict';var _=require(_0x93b1('0x0'));var http=require(_0x93b1('0x1'));var express=require(_0x93b1('0x2'));var sticky=require(_0x93b1('0x3'));var Redis=require(_0x93b1('0x4'));var config=require(_0x93b1('0x5'));var app=express();var server=http['createServer'](app);server[_0x93b1('0x6')]=0xdbba0;if(sticky[_0x93b1('0x7')](server,config[_0x93b1('0x8')])){var socketio=require('socket.io')(server,{'transports':['websocket','polling']});config['redis']=_[_0x93b1('0x9')](config[_0x93b1('0xa')],{'host':_0x93b1('0xb'),'port':0x18eb});socketio[_0x93b1('0xc')](require(_0x93b1('0xd'))({'pubClient':new Redis(config[_0x93b1('0xa')]),'subClient':new Redis(config[_0x93b1('0xa')])}));require(_0x93b1('0xe'))[_0x93b1('0xf')]();require(_0x93b1('0x10'))[_0x93b1('0xf')](socketio);require(_0x93b1('0x11'))[_0x93b1('0xf')](app);require(_0x93b1('0x12'))['default'](app);}else{server[_0x93b1('0x13')](_0x93b1('0x14'),function(){console[_0x93b1('0x15')](_0x93b1('0x16'),config['port']);});}exports=module[_0x93b1('0x17')]=app; \ No newline at end of file +var _0xac20=['websocket','polling','defaults','redis','localhost','adapter','socket.io-redis','../../config/triggers','default','../../config/socketio','../../routes','Express\x20server\x20listening\x20on\x20port\x20%d!','exports','lodash','http','express','ioredis','createServer','timeout','listen','port','socket.io'];(function(_0x11df3a,_0x244119){var _0x3dc03c=function(_0x2e62f6){while(--_0x2e62f6){_0x11df3a['push'](_0x11df3a['shift']());}};_0x3dc03c(++_0x244119);}(_0xac20,0xd3));var _0x0ac2=function(_0x333dbb,_0xbcc410){_0x333dbb=_0x333dbb-0x0;var _0x15bd7d=_0xac20[_0x333dbb];return _0x15bd7d;};'use strict';var _=require(_0x0ac2('0x0'));var http=require(_0x0ac2('0x1'));var express=require(_0x0ac2('0x2'));var sticky=require('sticky-session');var Redis=require(_0x0ac2('0x3'));var config=require('../../config/environment');var app=express();var server=http[_0x0ac2('0x4')](app);server[_0x0ac2('0x5')]=0xdbba0;if(sticky[_0x0ac2('0x6')](server,config[_0x0ac2('0x7')])){var socketio=require(_0x0ac2('0x8'))(server,{'transports':[_0x0ac2('0x9'),_0x0ac2('0xa')]});config['redis']=_[_0x0ac2('0xb')](config[_0x0ac2('0xc')],{'host':_0x0ac2('0xd'),'port':0x18eb});socketio[_0x0ac2('0xe')](require(_0x0ac2('0xf'))({'pubClient':new Redis(config[_0x0ac2('0xc')]),'subClient':new Redis(config[_0x0ac2('0xc')])}));require(_0x0ac2('0x10'))[_0x0ac2('0x11')]();require(_0x0ac2('0x12'))[_0x0ac2('0x11')](socketio);require('../../config/express')[_0x0ac2('0x11')](app);require(_0x0ac2('0x13'))[_0x0ac2('0x11')](app);}else{server['once']('listening',function(){console['log'](_0x0ac2('0x14'),config[_0x0ac2('0x7')]);});}exports=module[_0x0ac2('0x15')]=app; \ No newline at end of file diff --git a/server/services/routing/client.js b/server/services/routing/client.js index faf962a..a0a350f 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 _0x75b6=['Request','request','debug','rpc','error','message','result','catch','jayson/promise','bluebird','routing','client','http'];(function(_0x4f0111,_0x10ed84){var _0x3d3781=function(_0x1d2be9){while(--_0x1d2be9){_0x4f0111['push'](_0x4f0111['shift']());}};_0x3d3781(++_0x10ed84);}(_0x75b6,0xa4));var _0x675b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x75b6[_0x3dd15e];return _0x231fd0;};'use strict';var jayson=require(_0x675b('0x0'));var BPromise=require(_0x675b('0x1'));var logger=require('../../config/logger')(_0x675b('0x2'));var client=jayson[_0x675b('0x3')][_0x675b('0x4')]({'port':0x2329});client[_0x675b('0x5')]=function(_0x510420,_0x52f48f){return new BPromise(function(_0x1730a1,_0x293799){return client[_0x675b('0x6')](_0x510420,_0x52f48f)['then'](function(_0x570dd9){logger[_0x675b('0x7')](_0x675b('0x8'),_0x675b('0x2'),_0x510420,_0x52f48f,_0x570dd9);if(_0x570dd9[_0x675b('0x9')]){logger[_0x675b('0x9')](_0x675b('0x8'),_0x675b('0x2'),_0x510420,_0x570dd9[_0x675b('0x9')][_0x675b('0xa')],_0x52f48f);return _0x293799(_0x570dd9[_0x675b('0x9')][_0x675b('0xa')]);}else{return _0x1730a1(_0x570dd9[_0x675b('0xb')]);}})[_0x675b('0xc')](function(_0x1bf874){logger['error'](_0x675b('0x8'),'routing',_0x510420,_0x1bf874,_0x52f48f);return _0x293799(_0x1bf874);});});};module['exports']=client; \ No newline at end of file +var _0xa197=['result','catch','exports','jayson/promise','routing','client','http','Request','request','then','debug','rpc','error','message'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0xa197,0x153));var _0x7a19=function(_0x2dbce7,_0x57cb8d){_0x2dbce7=_0x2dbce7-0x0;var _0x3a3ed0=_0xa197[_0x2dbce7];return _0x3a3ed0;};'use strict';var jayson=require(_0x7a19('0x0'));var BPromise=require('bluebird');var logger=require('../../config/logger')(_0x7a19('0x1'));var client=jayson[_0x7a19('0x2')][_0x7a19('0x3')]({'port':0x2329});client[_0x7a19('0x4')]=function(_0x5d9662,_0x5dd30a){return new BPromise(function(_0x4c792e,_0x2150e3){return client[_0x7a19('0x5')](_0x5d9662,_0x5dd30a)[_0x7a19('0x6')](function(_0x166237){logger[_0x7a19('0x7')](_0x7a19('0x8'),_0x7a19('0x1'),_0x5d9662,_0x5dd30a,_0x166237);if(_0x166237[_0x7a19('0x9')]){logger['error']('rpc','routing',_0x5d9662,_0x166237[_0x7a19('0x9')]['message'],_0x5dd30a);return _0x2150e3(_0x166237['error'][_0x7a19('0xa')]);}else{return _0x4c792e(_0x166237[_0x7a19('0xb')]);}})[_0x7a19('0xc')](function(_0x10fe85){logger[_0x7a19('0x9')](_0x7a19('0x8'),'routing',_0x5d9662,_0x10fe85,_0x5dd30a);return _0x2150e3(_0x10fe85);});});};module[_0x7a19('0xd')]=client; \ No newline at end of file diff --git a/server/services/routing/index.js b/server/services/routing/index.js index d88da82..d8348d4 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 _0x3cf8=['initFaxQueues','getWhatsappQueues','initWhatsappQueues','listen','log','./server','./realtime','./rpc/user','./rpc/interval','./rpc/openchannelQueue','./rpc/smsQueue','./rpc/mailQueue','./rpc/faxQueue','./rpc/whatsappQueue','resolve','getAgents','then','getIntervals','initIntervals','getOpenchannelQueues','initOpenchannelQueues','initChatQueues','getSmsQueues','initSmsQueues','getFaxQueues'];(function(_0x202c99,_0x121caf){var _0x256a0f=function(_0x3a55fa){while(--_0x3a55fa){_0x202c99['push'](_0x202c99['shift']());}};_0x256a0f(++_0x121caf);}(_0x3cf8,0x17c));var _0x83cf=function(_0x26eca8,_0x38a131){_0x26eca8=_0x26eca8-0x0;var _0x46f327=_0x3cf8[_0x26eca8];return _0x46f327;};'use strict';var BPromise=require('bluebird');var server=require(_0x83cf('0x0'));var Realtime=require(_0x83cf('0x1'));var user=require(_0x83cf('0x2'));var interval=require(_0x83cf('0x3'));var openchannelQueue=require(_0x83cf('0x4'));var chatQueue=require('./rpc/chatQueue');var smsQueue=require(_0x83cf('0x5'));var mailQueue=require(_0x83cf('0x6'));var faxQueue=require(_0x83cf('0x7'));var whatsappQueue=require(_0x83cf('0x8'));var realtime=new Realtime();function initRealtime(){return BPromise[_0x83cf('0x9')]()['then'](user[_0x83cf('0xa')]())[_0x83cf('0xb')](realtime['initAgents']())[_0x83cf('0xb')](interval[_0x83cf('0xc')]())[_0x83cf('0xb')](realtime[_0x83cf('0xd')]())[_0x83cf('0xb')](openchannelQueue[_0x83cf('0xe')]())[_0x83cf('0xb')](realtime[_0x83cf('0xf')]())[_0x83cf('0xb')](chatQueue['getChatQueues']())['then'](realtime[_0x83cf('0x10')]())['then'](smsQueue[_0x83cf('0x11')]())[_0x83cf('0xb')](realtime[_0x83cf('0x12')]())[_0x83cf('0xb')](mailQueue['getMailQueues']())['then'](realtime['initMailQueues']())[_0x83cf('0xb')](faxQueue[_0x83cf('0x13')]())[_0x83cf('0xb')](realtime[_0x83cf('0x14')]())['then'](whatsappQueue[_0x83cf('0x15')]())[_0x83cf('0xb')](realtime[_0x83cf('0x16')]())[_0x83cf('0xb')](function(){return realtime;});}function main(){return server[_0x83cf('0x17')](realtime)[_0x83cf('0xb')](function(_0x2c2b16){return initRealtime();})[_0x83cf('0xb')](function(_0x50140d){return setInterval(initRealtime,0x1388);})['catch'](function(_0x449494){console[_0x83cf('0x18')](_0x449494);});}main(); \ No newline at end of file +var _0xec50=['then','initAgents','getIntervals','initIntervals','getOpenchannelQueues','initOpenchannelQueues','getChatQueues','getSmsQueues','getMailQueues','initMailQueues','getFaxQueues','initFaxQueues','getWhatsappQueues','listen','catch','log','bluebird','./server','./realtime','./rpc/interval','./rpc/openchannelQueue','./rpc/chatQueue','./rpc/smsQueue','./rpc/mailQueue','./rpc/faxQueue','./rpc/whatsappQueue','resolve','getAgents'];(function(_0x16b9ed,_0x56517a){var _0x66b1f8=function(_0x1c883){while(--_0x1c883){_0x16b9ed['push'](_0x16b9ed['shift']());}};_0x66b1f8(++_0x56517a);}(_0xec50,0x1b4));var _0x0ec5=function(_0x3a412f,_0x1634db){_0x3a412f=_0x3a412f-0x0;var _0x41ddbf=_0xec50[_0x3a412f];return _0x41ddbf;};'use strict';var BPromise=require(_0x0ec5('0x0'));var server=require(_0x0ec5('0x1'));var Realtime=require(_0x0ec5('0x2'));var user=require('./rpc/user');var interval=require(_0x0ec5('0x3'));var openchannelQueue=require(_0x0ec5('0x4'));var chatQueue=require(_0x0ec5('0x5'));var smsQueue=require(_0x0ec5('0x6'));var mailQueue=require(_0x0ec5('0x7'));var faxQueue=require(_0x0ec5('0x8'));var whatsappQueue=require(_0x0ec5('0x9'));var realtime=new Realtime();function initRealtime(){return BPromise[_0x0ec5('0xa')]()['then'](user[_0x0ec5('0xb')]())[_0x0ec5('0xc')](realtime[_0x0ec5('0xd')]())[_0x0ec5('0xc')](interval[_0x0ec5('0xe')]())[_0x0ec5('0xc')](realtime[_0x0ec5('0xf')]())[_0x0ec5('0xc')](openchannelQueue[_0x0ec5('0x10')]())[_0x0ec5('0xc')](realtime[_0x0ec5('0x11')]())[_0x0ec5('0xc')](chatQueue[_0x0ec5('0x12')]())[_0x0ec5('0xc')](realtime['initChatQueues']())['then'](smsQueue[_0x0ec5('0x13')]())[_0x0ec5('0xc')](realtime['initSmsQueues']())['then'](mailQueue[_0x0ec5('0x14')]())[_0x0ec5('0xc')](realtime[_0x0ec5('0x15')]())[_0x0ec5('0xc')](faxQueue[_0x0ec5('0x16')]())[_0x0ec5('0xc')](realtime[_0x0ec5('0x17')]())[_0x0ec5('0xc')](whatsappQueue[_0x0ec5('0x18')]())[_0x0ec5('0xc')](realtime['initWhatsappQueues']())[_0x0ec5('0xc')](function(){return realtime;});}function main(){return server[_0x0ec5('0x19')](realtime)[_0x0ec5('0xc')](function(_0x5f7f3c){return initRealtime();})[_0x0ec5('0xc')](function(_0x4e4ccd){return setInterval(initRealtime,0x1388);})[_0x0ec5('0x1a')](function(_0x5938d0){console[_0x0ec5('0x1b')](_0x5938d0);});}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 69d451b..e4780b7 100644 --- a/server/services/routing/lib/rule-engine.js +++ b/server/services/routing/lib/rule-engine.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5fc3=['lodash','util','EventEmitter','init','isNil','ignoreFactChanges','inherits','activeRules','prototype','register','isArray','rules','isObject','sync','orderBy','asc','execute','clone','ruleRef','name','index_','push','call','nextTick','next','isEqual','restart','length','condition','matchPath','noop','findRules','filter','prioritize','priority','toJSON','map','consequence','toString','fromJSON','isString','parse'];(function(_0x4ede00,_0x16905f){var _0x5455a6=function(_0x404b61){while(--_0x404b61){_0x4ede00['push'](_0x4ede00['shift']());}};_0x5455a6(++_0x16905f);}(_0x5fc3,0xa8));var _0x35fc=function(_0x377a6e,_0x59b99d){_0x377a6e=_0x377a6e-0x0;var _0x37f751=_0x5fc3[_0x377a6e];return _0x37f751;};'use strict';var _=require(_0x35fc('0x0'));var util=require(_0x35fc('0x1'));var EventEmitter=require('events')[_0x35fc('0x2')];function RuleEngine(_0x2ac6da,_0x196bc2){this[_0x35fc('0x3')]();if(!_[_0x35fc('0x4')](_0x2ac6da)){this['register'](_0x2ac6da);}if(_0x196bc2){this[_0x35fc('0x5')]=_0x196bc2[_0x35fc('0x5')];}return this;}util[_0x35fc('0x6')](RuleEngine,EventEmitter);RuleEngine['prototype']['init']=function(_0x19a0d1){this['rules']=[];this[_0x35fc('0x7')]=[];};RuleEngine[_0x35fc('0x8')][_0x35fc('0x9')]=function(_0x1e5f90){if(Array[_0x35fc('0xa')](_0x1e5f90)){this[_0x35fc('0xb')]=this[_0x35fc('0xb')]['concat'](_0x1e5f90);}else if(_0x1e5f90!==null&&_[_0x35fc('0xc')](_0x1e5f90)){this[_0x35fc('0xb')]['push'](_0x1e5f90);}this[_0x35fc('0xd')]();};RuleEngine[_0x35fc('0x8')]['sync']=function(){this[_0x35fc('0x7')]=this[_0x35fc('0xb')]['filter'](function(_0x4cbe74){if(_[_0x35fc('0x4')](_0x4cbe74['on'])){_0x4cbe74['on']=!![];}if(_0x4cbe74['on']===!![]){return _0x4cbe74;}});this['activeRules']=_[_0x35fc('0xe')](this[_0x35fc('0x7')],['p'],[_0x35fc('0xf')]);};RuleEngine[_0x35fc('0x8')][_0x35fc('0x10')]=function(_0x5cfe94,_0x59507a){var _0x5eac0f=![];_0x5cfe94['result']=!![];var _0x398b67=_[_0x35fc('0x11')](_0x5cfe94);var _0x53b898=_[_0x35fc('0x11')](_0x5cfe94);var _0x227a49=this[_0x35fc('0x7')];var _0x480851=[];var _0x26ba54=this[_0x35fc('0x5')];(function FnRuleLoop(_0x553677){var _0x41e165={'rules':function(){return _0x227a49;},'rule':function(){return _0x227a49[_0x553677];},'when':function(_0x363e47){if(_0x363e47){var _0x2e513b=_0x227a49[_0x553677]['consequence'];_0x2e513b[_0x35fc('0x12')]=_0x227a49[_0x553677]['id']||_0x227a49[_0x553677][_0x35fc('0x13')]||_0x35fc('0x14')+_0x553677;process['nextTick'](function(){_0x480851[_0x35fc('0x15')](_0x2e513b[_0x35fc('0x12')]);_0x2e513b[_0x35fc('0x16')](_0x398b67,_0x41e165);});}else{process[_0x35fc('0x17')](function(){_0x41e165[_0x35fc('0x18')]();});}},'restart':function(){return FnRuleLoop(0x0);},'stop':function(){_0x5eac0f=!![];return FnRuleLoop(0x0);},'next':function(_0x21f1a9){if(!_0x26ba54&&!_[_0x35fc('0x19')](_0x53b898,_0x398b67)){_0x53b898=_[_0x35fc('0x11')](_0x398b67);process[_0x35fc('0x17')](function(){_0x41e165[_0x35fc('0x1a')]();});}else{process['nextTick'](function(){if(_[_0x35fc('0x4')](_0x21f1a9)){return FnRuleLoop(_0x553677+0x1);}else{return FnRuleLoop(_0x21f1a9);}});}}};if(_0x553677<_0x227a49[_0x35fc('0x1b')]&&_0x5eac0f===![]){var _0x257719=_0x227a49[_0x553677][_0x35fc('0x1c')];_0x257719[_0x35fc('0x16')](_0x398b67,_0x41e165);}else{process['nextTick'](function(){_0x398b67[_0x35fc('0x1d')]=_0x480851;return _0x59507a?_0x59507a(_0x398b67):_[_0x35fc('0x1e')]();});}}(0x0));};RuleEngine['prototype'][_0x35fc('0x1f')]=function(_0x5a93df){if(_[_0x35fc('0x4')](_0x5a93df)){return this['rules'];}else{var _0x4086e9=_['matches'](_0x5a93df);return _[_0x35fc('0x20')](this[_0x35fc('0xb')],_0x4086e9);}};RuleEngine['prototype']['turn']=function(_0x47774c,_0x58edb6){var _0x274208=_0x47774c==='on'||_0x47774c==='ON'?!![]:![];var _0x1a5d92=this['findRules'](_0x58edb6);for(var _0x26b7cb=0x0,_0x645eac=_0x1a5d92[_0x35fc('0x1b')];_0x26b7cb<_0x645eac;_0x26b7cb+=0x1){_0x1a5d92[_0x26b7cb]['on']=_0x274208;}this[_0x35fc('0xd')]();};RuleEngine[_0x35fc('0x8')][_0x35fc('0x21')]=function(_0x11ccdb,_0x451f0c){_0x11ccdb=parseInt(_0x11ccdb,0xa);var _0x54aedc=this[_0x35fc('0x1f')](_0x451f0c);for(var _0x220931=0x0,_0x22af18=_0x54aedc['length'];_0x220931<_0x22af18;_0x220931+=0x1){_0x54aedc[_0x220931][_0x35fc('0x22')]=_0x11ccdb;}this[_0x35fc('0xd')]();};RuleEngine[_0x35fc('0x8')][_0x35fc('0x23')]=function(){var _0xd8a4ca=this[_0x35fc('0xb')];if(_0xd8a4ca instanceof Array){_0xd8a4ca=_0xd8a4ca[_0x35fc('0x24')](function(_0x37b435){_0x37b435[_0x35fc('0x1c')]=_0x37b435[_0x35fc('0x1c')]['toString']();_0x37b435['consequence']=_0x37b435[_0x35fc('0x25')]['toString']();return _0x37b435;});}else if(!_[_0x35fc('0x4')](_0xd8a4ca)){_0xd8a4ca[_0x35fc('0x1c')]=_0xd8a4ca[_0x35fc('0x1c')][_0x35fc('0x26')]();_0xd8a4ca[_0x35fc('0x25')]=_0xd8a4ca[_0x35fc('0x25')]['toString']();}return _0xd8a4ca;};RuleEngine[_0x35fc('0x8')][_0x35fc('0x27')]=function(_0x46b9ef){this[_0x35fc('0x3')]();if(_[_0x35fc('0x28')](_0x46b9ef)){_0x46b9ef=JSON[_0x35fc('0x29')](_0x46b9ef);}if(_0x46b9ef instanceof Array){_0x46b9ef=_0x46b9ef['map'](function(_0x2483be){_0x2483be[_0x35fc('0x1c')]=eval('('+_0x2483be[_0x35fc('0x1c')]+')');_0x2483be['consequence']=eval('('+_0x2483be[_0x35fc('0x25')]+')');return _0x2483be;});}else if(_0x46b9ef!==null&&typeof _0x46b9ef=='object'){_0x46b9ef[_0x35fc('0x1c')]=eval('('+_0x46b9ef[_0x35fc('0x1c')]+')');_0x46b9ef[_0x35fc('0x25')]=eval('('+_0x46b9ef[_0x35fc('0x25')]+')');}this['register'](_0x46b9ef);};module['exports']=RuleEngine; \ No newline at end of file +var _0x814b=['init','parse','map','object','lodash','util','events','EventEmitter','isNil','register','ignoreFactChanges','inherits','prototype','rules','isArray','concat','isObject','push','sync','filter','activeRules','orderBy','asc','execute','result','clone','name','ruleRef','call','next','isEqual','nextTick','restart','length','condition','matchPath','noop','findRules','matches','turn','prioritize','priority','toJSON','toString','consequence','fromJSON'];(function(_0x11dc6c,_0x21bdfe){var _0xddae9c=function(_0x11f846){while(--_0x11f846){_0x11dc6c['push'](_0x11dc6c['shift']());}};_0xddae9c(++_0x21bdfe);}(_0x814b,0x1a2));var _0xb814=function(_0x2cfb48,_0x24b83b){_0x2cfb48=_0x2cfb48-0x0;var _0xc4594f=_0x814b[_0x2cfb48];return _0xc4594f;};'use strict';var _=require(_0xb814('0x0'));var util=require(_0xb814('0x1'));var EventEmitter=require(_0xb814('0x2'))[_0xb814('0x3')];function RuleEngine(_0xfbb64b,_0x477725){this['init']();if(!_[_0xb814('0x4')](_0xfbb64b)){this[_0xb814('0x5')](_0xfbb64b);}if(_0x477725){this[_0xb814('0x6')]=_0x477725[_0xb814('0x6')];}return this;}util[_0xb814('0x7')](RuleEngine,EventEmitter);RuleEngine[_0xb814('0x8')]['init']=function(_0x3b0829){this[_0xb814('0x9')]=[];this['activeRules']=[];};RuleEngine[_0xb814('0x8')][_0xb814('0x5')]=function(_0x186d5a){if(Array[_0xb814('0xa')](_0x186d5a)){this[_0xb814('0x9')]=this[_0xb814('0x9')][_0xb814('0xb')](_0x186d5a);}else if(_0x186d5a!==null&&_[_0xb814('0xc')](_0x186d5a)){this[_0xb814('0x9')][_0xb814('0xd')](_0x186d5a);}this[_0xb814('0xe')]();};RuleEngine['prototype'][_0xb814('0xe')]=function(){this['activeRules']=this[_0xb814('0x9')][_0xb814('0xf')](function(_0x35b10d){if(_[_0xb814('0x4')](_0x35b10d['on'])){_0x35b10d['on']=!![];}if(_0x35b10d['on']===!![]){return _0x35b10d;}});this[_0xb814('0x10')]=_[_0xb814('0x11')](this[_0xb814('0x10')],['p'],[_0xb814('0x12')]);};RuleEngine[_0xb814('0x8')][_0xb814('0x13')]=function(_0x3f4881,_0x44fb96){var _0x17f5bd=![];_0x3f4881[_0xb814('0x14')]=!![];var _0x303aca=_[_0xb814('0x15')](_0x3f4881);var _0x45e0d0=_[_0xb814('0x15')](_0x3f4881);var _0x125ce2=this[_0xb814('0x10')];var _0x7a21ef=[];var _0x48c9df=this[_0xb814('0x6')];(function FnRuleLoop(_0x55ba16){var _0x270598={'rules':function(){return _0x125ce2;},'rule':function(){return _0x125ce2[_0x55ba16];},'when':function(_0xfac75b){if(_0xfac75b){var _0x4c3007=_0x125ce2[_0x55ba16]['consequence'];_0x4c3007['ruleRef']=_0x125ce2[_0x55ba16]['id']||_0x125ce2[_0x55ba16][_0xb814('0x16')]||'index_'+_0x55ba16;process['nextTick'](function(){_0x7a21ef[_0xb814('0xd')](_0x4c3007[_0xb814('0x17')]);_0x4c3007[_0xb814('0x18')](_0x303aca,_0x270598);});}else{process['nextTick'](function(){_0x270598[_0xb814('0x19')]();});}},'restart':function(){return FnRuleLoop(0x0);},'stop':function(){_0x17f5bd=!![];return FnRuleLoop(0x0);},'next':function(_0x531032){if(!_0x48c9df&&!_[_0xb814('0x1a')](_0x45e0d0,_0x303aca)){_0x45e0d0=_[_0xb814('0x15')](_0x303aca);process[_0xb814('0x1b')](function(){_0x270598[_0xb814('0x1c')]();});}else{process[_0xb814('0x1b')](function(){if(_[_0xb814('0x4')](_0x531032)){return FnRuleLoop(_0x55ba16+0x1);}else{return FnRuleLoop(_0x531032);}});}}};if(_0x55ba16<_0x125ce2[_0xb814('0x1d')]&&_0x17f5bd===![]){var _0x594470=_0x125ce2[_0x55ba16][_0xb814('0x1e')];_0x594470['call'](_0x303aca,_0x270598);}else{process[_0xb814('0x1b')](function(){_0x303aca[_0xb814('0x1f')]=_0x7a21ef;return _0x44fb96?_0x44fb96(_0x303aca):_[_0xb814('0x20')]();});}}(0x0));};RuleEngine[_0xb814('0x8')][_0xb814('0x21')]=function(_0xb9e57d){if(_[_0xb814('0x4')](_0xb9e57d)){return this['rules'];}else{var _0x392222=_[_0xb814('0x22')](_0xb9e57d);return _[_0xb814('0xf')](this[_0xb814('0x9')],_0x392222);}};RuleEngine[_0xb814('0x8')][_0xb814('0x23')]=function(_0x3f0150,_0x1e4e89){var _0x5a6291=_0x3f0150==='on'||_0x3f0150==='ON'?!![]:![];var _0x271aa8=this[_0xb814('0x21')](_0x1e4e89);for(var _0x52ed64=0x0,_0x9008b2=_0x271aa8[_0xb814('0x1d')];_0x52ed64<_0x9008b2;_0x52ed64+=0x1){_0x271aa8[_0x52ed64]['on']=_0x5a6291;}this[_0xb814('0xe')]();};RuleEngine['prototype'][_0xb814('0x24')]=function(_0x2051d0,_0x58c3ca){_0x2051d0=parseInt(_0x2051d0,0xa);var _0x338a28=this['findRules'](_0x58c3ca);for(var _0x6efe9a=0x0,_0x5f3e9b=_0x338a28['length'];_0x6efe9a<_0x5f3e9b;_0x6efe9a+=0x1){_0x338a28[_0x6efe9a][_0xb814('0x25')]=_0x2051d0;}this['sync']();};RuleEngine[_0xb814('0x8')][_0xb814('0x26')]=function(){var _0x2b91bd=this['rules'];if(_0x2b91bd instanceof Array){_0x2b91bd=_0x2b91bd['map'](function(_0x26d3a9){_0x26d3a9[_0xb814('0x1e')]=_0x26d3a9['condition'][_0xb814('0x27')]();_0x26d3a9[_0xb814('0x28')]=_0x26d3a9[_0xb814('0x28')][_0xb814('0x27')]();return _0x26d3a9;});}else if(!_[_0xb814('0x4')](_0x2b91bd)){_0x2b91bd[_0xb814('0x1e')]=_0x2b91bd[_0xb814('0x1e')]['toString']();_0x2b91bd[_0xb814('0x28')]=_0x2b91bd[_0xb814('0x28')][_0xb814('0x27')]();}return _0x2b91bd;};RuleEngine[_0xb814('0x8')][_0xb814('0x29')]=function(_0x4ff31a){this[_0xb814('0x2a')]();if(_['isString'](_0x4ff31a)){_0x4ff31a=JSON[_0xb814('0x2b')](_0x4ff31a);}if(_0x4ff31a instanceof Array){_0x4ff31a=_0x4ff31a[_0xb814('0x2c')](function(_0xe0f509){_0xe0f509['condition']=eval('('+_0xe0f509[_0xb814('0x1e')]+')');_0xe0f509[_0xb814('0x28')]=eval('('+_0xe0f509['consequence']+')');return _0xe0f509;});}else if(_0x4ff31a!==null&&typeof _0x4ff31a==_0xb814('0x2d')){_0x4ff31a[_0xb814('0x1e')]=eval('('+_0x4ff31a[_0xb814('0x1e')]+')');_0x4ff31a[_0xb814('0x28')]=eval('('+_0x4ff31a[_0xb814('0x28')]+')');}this[_0xb814('0x5')](_0x4ff31a);};module['exports']=RuleEngine; \ No newline at end of file diff --git a/server/services/routing/mailRpc/index.js b/server/services/routing/mailRpc/index.js index b79fe6f..f350ef7 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 _0x0836=['http','request','then','error','result','sendMailMessage','SendMail','bluebird','jayson/promise','client'];(function(_0x17f7c1,_0x2fa7b9){var _0x13c24a=function(_0x4a7f44){while(--_0x4a7f44){_0x17f7c1['push'](_0x17f7c1['shift']());}};_0x13c24a(++_0x2fa7b9);}(_0x0836,0x9d));var _0x6083=function(_0x414996,_0x335997){_0x414996=_0x414996-0x0;var _0x5b06a1=_0x0836[_0x414996];return _0x5b06a1;};'use strict';var BPromise=require(_0x6083('0x0'));var jayson=require(_0x6083('0x1'));var client=jayson[_0x6083('0x2')][_0x6083('0x3')]({'port':0x232b});function request(_0x26e04f,_0x2dd76c){return new BPromise(function(_0x543c96,_0x1e2650){return client[_0x6083('0x4')](_0x26e04f,_0x2dd76c)[_0x6083('0x5')](function(_0x28bb7e){if(_0x28bb7e[_0x6083('0x6')]){return _0x1e2650(_0x28bb7e[_0x6083('0x6')]['message']);}else{return _0x543c96(_0x28bb7e[_0x6083('0x7')]);}})['catch'](function(_0x3a3e32){return _0x1e2650(_0x3a3e32);});});}exports[_0x6083('0x8')]=function(_0x18909b,_0x1a70f3){return request(_0x6083('0x9'),{'account':_0x18909b,'message':_0x1a70f3});}; \ No newline at end of file +var _0xca7b=['bluebird','jayson/promise','http','then','error','message','catch','SendMail'];(function(_0x487ab4,_0x1e24e8){var _0x3bef77=function(_0x5ce664){while(--_0x5ce664){_0x487ab4['push'](_0x487ab4['shift']());}};_0x3bef77(++_0x1e24e8);}(_0xca7b,0x70));var _0xbca7=function(_0x38d118,_0x33e77a){_0x38d118=_0x38d118-0x0;var _0x268a16=_0xca7b[_0x38d118];return _0x268a16;};'use strict';var BPromise=require(_0xbca7('0x0'));var jayson=require(_0xbca7('0x1'));var client=jayson['client'][_0xbca7('0x2')]({'port':0x232b});function request(_0x1a7e95,_0x3dc0b3){return new BPromise(function(_0x544a4a,_0x40d31f){return client['request'](_0x1a7e95,_0x3dc0b3)[_0xbca7('0x3')](function(_0x207cad){if(_0x207cad['error']){return _0x40d31f(_0x207cad[_0xbca7('0x4')][_0xbca7('0x5')]);}else{return _0x544a4a(_0x207cad['result']);}})[_0xbca7('0x6')](function(_0x35fbad){return _0x40d31f(_0x35fbad);});});}exports['sendMailMessage']=function(_0x3affd9,_0x2105bb){return request(_0xbca7('0x7'),{'account':_0x3affd9,'message':_0x2105bb});}; \ No newline at end of file diff --git a/server/services/routing/model/agent.js b/server/services/routing/model/agent.js index b435f2a..4451ce4 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 _0x83b8=['faxStatus','faxStatusTime','faxCapacity','faxCurrentCapacity','smsStatusTime','smsCapacity','whatsappStatus','whatsappStatusTime','whatsappCapacity','whatsappCurrentCapacity','openchannelStatus','openchannelStatusTime','openchannelCapacity','openchannelCurrentCapacity','busyQueue','chatWaitingInteractions','faxWaitingInteractions','mailWaitingInteractions','smsWaitingInteractions','whatsappWaitingInteractions','updateRealtime','getChannelStatus','CurrentCapacity','Capacity','maxcapacity','working','idle','prototype','openchannel','fax','sms','whatsapp','length','Status','StatusTime','toNumber','format','online','chatCapacity','mailCurrentCapacity','smsStatus','openchannelWaitingInteractions','stringify','emit','user:routing:update','exports','lodash','moment','md5','ioredis','../../../config/environment','redis','localhost','name','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','chatStatus','unknown','chatStatusTime','chatCurrentCapacity','mailStatus','mailStatusTime','mailCapacity'];(function(_0x3878bd,_0x51e3e5){var _0x359e60=function(_0xe70276){while(--_0xe70276){_0x3878bd['push'](_0x3878bd['shift']());}};_0x359e60(++_0x51e3e5);}(_0x83b8,0xb4));var _0x883b=function(_0x48dd43,_0x585fbe){_0x48dd43=_0x48dd43-0x0;var _0x5617d4=_0x83b8[_0x48dd43];return _0x5617d4;};'use strict';var _=require(_0x883b('0x0'));var moment=require(_0x883b('0x1'));var md5=require(_0x883b('0x2'));var Redis=require(_0x883b('0x3'));var config=require(_0x883b('0x4'));config[_0x883b('0x5')]=_['defaults'](config[_0x883b('0x5')],{'host':_0x883b('0x6'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x883b('0x5')]));function Agent(_0x17b7ba){this['id']=_0x17b7ba['id']||0x0;this['name']=_0x17b7ba[_0x883b('0x7')]||'';this[_0x883b('0x8')]=_0x17b7ba[_0x883b('0x8')]||![];this[_0x883b('0x9')]=_0x17b7ba[_0x883b('0x9')]||![];this[_0x883b('0xa')]=_0x17b7ba[_0x883b('0xa')]||![];this['faxPause']=_0x17b7ba[_0x883b('0xb')]||![];this[_0x883b('0xc')]=_0x17b7ba['smsPause']||![];this[_0x883b('0xd')]=_0x17b7ba[_0x883b('0xd')]||![];this[_0x883b('0xe')]=_0x883b('0xf');this[_0x883b('0x10')]=0x0;this['chatCapacity']=_0x17b7ba['chatCapacity']||0x0;this[_0x883b('0x11')]=0x0;this[_0x883b('0x12')]=_0x883b('0xf');this[_0x883b('0x13')]=0x0;this[_0x883b('0x14')]=_0x17b7ba[_0x883b('0x14')]||0x0;this['mailCurrentCapacity']=0x0;this[_0x883b('0x15')]='unknown';this[_0x883b('0x16')]=0x0;this['faxCapacity']=_0x17b7ba[_0x883b('0x17')]||0x0;this[_0x883b('0x18')]=0x0;this['smsStatus']=_0x883b('0xf');this[_0x883b('0x19')]=0x0;this[_0x883b('0x1a')]=_0x17b7ba['smsCapacity']||0x0;this['smsCurrentCapacity']=0x0;this[_0x883b('0x1b')]=_0x883b('0xf');this[_0x883b('0x1c')]=0x0;this[_0x883b('0x1d')]=_0x17b7ba[_0x883b('0x1d')]||0x0;this[_0x883b('0x1e')]=0x0;this[_0x883b('0x1f')]=_0x883b('0xf');this[_0x883b('0x20')]=0x0;this[_0x883b('0x21')]=_0x17b7ba['openchannelCapacity']||0x0;this[_0x883b('0x22')]=0x0;this['busy']=![];this[_0x883b('0x23')]=undefined;this[_0x883b('0x2')]='';this[_0x883b('0x24')]={};this[_0x883b('0x25')]={};this[_0x883b('0x26')]={};this['openchannelWaitingInteractions']={};this[_0x883b('0x27')]={};this[_0x883b('0x28')]={};this[_0x883b('0x29')]();}Agent['prototype'][_0x883b('0x2a')]=function(_0x428975){if(this[_0x428975+_0x883b('0x2b')]>0x0){if(this[_0x428975+_0x883b('0x2c')]>0x0&&this[_0x428975+_0x883b('0x2b')]>=this[_0x428975+_0x883b('0x2c')]){return _0x883b('0x2d');}else{return _0x883b('0x2e');}}else{return _0x883b('0x2f');}};Agent[_0x883b('0x30')][_0x883b('0x29')]=function(){var _0x57f84e=['mail','chat',_0x883b('0x31'),_0x883b('0x32'),_0x883b('0x33'),_0x883b('0x34')];for(var _0x241da9=0x0;_0x241da9<_0x57f84e[_0x883b('0x35')];_0x241da9+=0x1){var _0x5592d0=this[_0x883b('0x2a')](_0x57f84e[_0x241da9]);if(this[_0x57f84e[_0x241da9]+_0x883b('0x36')]!==_0x5592d0){this[_0x57f84e[_0x241da9]+_0x883b('0x37')]=_[_0x883b('0x38')](moment()[_0x883b('0x39')]('x'));}this[_0x57f84e[_0x241da9]+_0x883b('0x36')]=_0x5592d0;}var _0x103f4f={'id':this['id'],'name':this[_0x883b('0x7')],'online':this[_0x883b('0x3a')],'voicePause':this['voicePause'],'chatPause':this['chatPause'],'mailPause':this[_0x883b('0xa')],'smsPause':this['smsPause'],'faxPause':this['faxPause'],'openchannelPause':this[_0x883b('0xd')],'chatStatus':this[_0x883b('0xe')],'chatStatusTime':this[_0x883b('0x10')],'chatCapacity':this[_0x883b('0x3b')],'chatCurrentCapacity':this[_0x883b('0x11')],'mailStatus':this[_0x883b('0x12')],'mailStatusTime':this[_0x883b('0x13')],'mailCapacity':this[_0x883b('0x14')],'mailCurrentCapacity':this[_0x883b('0x3c')],'faxStatus':this[_0x883b('0x15')],'faxStatusTime':this[_0x883b('0x16')],'faxCapacity':this[_0x883b('0x17')],'faxCurrentCapacity':this[_0x883b('0x18')],'smsStatus':this[_0x883b('0x3d')],'smsStatusTime':this['smsStatusTime'],'smsCapacity':this[_0x883b('0x1a')],'smsCurrentCapacity':this['smsCurrentCapacity'],'whatsappStatus':this[_0x883b('0x1b')],'whatsappStatusTime':this[_0x883b('0x1c')],'whatsappCapacity':this[_0x883b('0x1d')],'whatsappCurrentCapacity':this['whatsappCurrentCapacity'],'openchannelStatus':this[_0x883b('0x1f')],'openchannelStatusTime':this['openchannelStatusTime'],'openchannelCapacity':this['openchannelCapacity'],'openchannelCurrentCapacity':this['openchannelCurrentCapacity'],'busy':this['busy'],'busyQueue':this['busyQueue'],'chatWaitingInteractions':this[_0x883b('0x24')],'faxWaitingInteractions':this[_0x883b('0x25')],'mailWaitingInteractions':this[_0x883b('0x26')],'openchannelWaitingInteractions':this[_0x883b('0x3e')],'smsWaitingInteractions':this[_0x883b('0x27')],'whatsappWaitingInteractions':this['whatsappWaitingInteractions']};var _0x4307e9=md5(JSON[_0x883b('0x3f')](_0x103f4f));if(this[_0x883b('0x2')]!==_0x4307e9){this[_0x883b('0x2')]=_0x4307e9;io[_0x883b('0x40')](_0x883b('0x41'),_0x103f4f);}};module[_0x883b('0x42')]=Agent; \ No newline at end of file +var _0x142f=['lodash','md5','moment','ioredis','../../../config/environment','redis','socket.io-emitter','name','voicePause','mailPause','faxPause','smsPause','openchannelPause','chatStatus','unknown','chatStatusTime','chatCapacity','mailStatusTime','mailCapacity','mailCurrentCapacity','faxStatus','faxStatusTime','faxCapacity','faxCurrentCapacity','smsStatus','smsStatusTime','smsCapacity','smsCurrentCapacity','whatsappStatus','whatsappStatusTime','whatsappCapacity','openchannelStatus','openchannelStatusTime','openchannelCapacity','openchannelCurrentCapacity','busy','busyQueue','chatWaitingInteractions','faxWaitingInteractions','mailWaitingInteractions','smsWaitingInteractions','prototype','CurrentCapacity','Capacity','maxcapacity','working','idle','updateRealtime','mail','chat','openchannel','fax','sms','length','Status','StatusTime','toNumber','format','online','chatPause','chatCurrentCapacity','whatsappCurrentCapacity','whatsappWaitingInteractions','emit','user:routing:update','omit','exports'];(function(_0x3872db,_0x421b76){var _0x22b54b=function(_0x136b5e){while(--_0x136b5e){_0x3872db['push'](_0x3872db['shift']());}};_0x22b54b(++_0x421b76);}(_0x142f,0x14f));var _0xf142=function(_0x510313,_0xd493e1){_0x510313=_0x510313-0x0;var _0xd9ad55=_0x142f[_0x510313];return _0xd9ad55;};'use strict';var _=require(_0xf142('0x0'));var md5=require(_0xf142('0x1'));var moment=require(_0xf142('0x2'));var Redis=require(_0xf142('0x3'));var config=require(_0xf142('0x4'));config['redis']=_['defaults'](config[_0xf142('0x5')],{'host':'localhost','port':0x18eb});var io=require(_0xf142('0x6'))(new Redis(config[_0xf142('0x5')]));function Agent(_0x1e6cc9){this['id']=_0x1e6cc9['id']||0x0;this[_0xf142('0x7')]=_0x1e6cc9['name']||'';this[_0xf142('0x8')]=_0x1e6cc9['voicePause']||![];this['chatPause']=_0x1e6cc9['chatPause']||![];this['mailPause']=_0x1e6cc9[_0xf142('0x9')]||![];this[_0xf142('0xa')]=_0x1e6cc9[_0xf142('0xa')]||![];this[_0xf142('0xb')]=_0x1e6cc9[_0xf142('0xb')]||![];this[_0xf142('0xc')]=_0x1e6cc9['openchannelPause']||![];this[_0xf142('0xd')]=_0xf142('0xe');this[_0xf142('0xf')]=0x0;this[_0xf142('0x10')]=_0x1e6cc9[_0xf142('0x10')]||0x0;this['chatCurrentCapacity']=0x0;this['mailStatus']='unknown';this[_0xf142('0x11')]=0x0;this[_0xf142('0x12')]=_0x1e6cc9['mailCapacity']||0x0;this[_0xf142('0x13')]=0x0;this[_0xf142('0x14')]='unknown';this[_0xf142('0x15')]=0x0;this[_0xf142('0x16')]=_0x1e6cc9[_0xf142('0x16')]||0x0;this[_0xf142('0x17')]=0x0;this[_0xf142('0x18')]=_0xf142('0xe');this[_0xf142('0x19')]=0x0;this['smsCapacity']=_0x1e6cc9[_0xf142('0x1a')]||0x0;this[_0xf142('0x1b')]=0x0;this[_0xf142('0x1c')]='unknown';this[_0xf142('0x1d')]=0x0;this[_0xf142('0x1e')]=_0x1e6cc9['whatsappCapacity']||0x0;this['whatsappCurrentCapacity']=0x0;this[_0xf142('0x1f')]=_0xf142('0xe');this[_0xf142('0x20')]=0x0;this[_0xf142('0x21')]=_0x1e6cc9[_0xf142('0x21')]||0x0;this[_0xf142('0x22')]=0x0;this[_0xf142('0x23')]=![];this[_0xf142('0x24')]=undefined;this['md5']='';this[_0xf142('0x25')]={};this[_0xf142('0x26')]={};this[_0xf142('0x27')]={};this['openchannelWaitingInteractions']={};this[_0xf142('0x28')]={};this['whatsappWaitingInteractions']={};this['updateRealtime']();}Agent[_0xf142('0x29')]['getChannelStatus']=function(_0x14296f){if(this[_0x14296f+_0xf142('0x2a')]>0x0){if(this[_0x14296f+_0xf142('0x2b')]>0x0&&this[_0x14296f+_0xf142('0x2a')]>=this[_0x14296f+_0xf142('0x2b')]){return _0xf142('0x2c');}else{return _0xf142('0x2d');}}else{return _0xf142('0x2e');}};Agent[_0xf142('0x29')][_0xf142('0x2f')]=function(){var _0x5208fd=[_0xf142('0x30'),_0xf142('0x31'),_0xf142('0x32'),_0xf142('0x33'),_0xf142('0x34'),'whatsapp'];for(var _0x1b86e7=0x0;_0x1b86e7<_0x5208fd[_0xf142('0x35')];_0x1b86e7+=0x1){var _0x1c039b=this['getChannelStatus'](_0x5208fd[_0x1b86e7]);if(this[_0x5208fd[_0x1b86e7]+_0xf142('0x36')]!==_0x1c039b){this[_0x5208fd[_0x1b86e7]+_0xf142('0x37')]=_[_0xf142('0x38')](moment()[_0xf142('0x39')]('x'));}this[_0x5208fd[_0x1b86e7]+_0xf142('0x36')]=_0x1c039b;}var _0x230f6c={'id':this['id'],'name':this[_0xf142('0x7')],'online':this[_0xf142('0x3a')],'voicePause':this[_0xf142('0x8')],'chatPause':this[_0xf142('0x3b')],'mailPause':this[_0xf142('0x9')],'smsPause':this[_0xf142('0xb')],'faxPause':this[_0xf142('0xa')],'openchannelPause':this[_0xf142('0xc')],'chatStatus':this['chatStatus'],'chatStatusTime':this['chatStatusTime'],'chatCapacity':this['chatCapacity'],'chatCurrentCapacity':this[_0xf142('0x3c')],'mailStatus':this['mailStatus'],'mailStatusTime':this[_0xf142('0x11')],'mailCapacity':this[_0xf142('0x12')],'mailCurrentCapacity':this[_0xf142('0x13')],'faxStatus':this['faxStatus'],'faxStatusTime':this[_0xf142('0x15')],'faxCapacity':this[_0xf142('0x16')],'faxCurrentCapacity':this[_0xf142('0x17')],'smsStatus':this['smsStatus'],'smsStatusTime':this['smsStatusTime'],'smsCapacity':this[_0xf142('0x1a')],'smsCurrentCapacity':this[_0xf142('0x1b')],'whatsappStatus':this[_0xf142('0x1c')],'whatsappStatusTime':this['whatsappStatusTime'],'whatsappCapacity':this['whatsappCapacity'],'whatsappCurrentCapacity':this[_0xf142('0x3d')],'openchannelStatus':this[_0xf142('0x1f')],'openchannelStatusTime':this[_0xf142('0x20')],'openchannelCapacity':this[_0xf142('0x21')],'openchannelCurrentCapacity':this[_0xf142('0x22')],'busy':this['busy'],'busyQueue':this['busyQueue'],'chatWaitingInteractions':this[_0xf142('0x25')],'faxWaitingInteractions':this[_0xf142('0x26')],'mailWaitingInteractions':this['mailWaitingInteractions'],'openchannelWaitingInteractions':this['openchannelWaitingInteractions'],'smsWaitingInteractions':this[_0xf142('0x28')],'whatsappWaitingInteractions':this[_0xf142('0x3e')]};var _0x53f553=md5(JSON['stringify'](_0x230f6c));if(this['md5']!==_0x53f553){this[_0xf142('0x1')]=_0x53f553;io[_0xf142('0x3f')](_0xf142('0x40'),_[_0xf142('0x41')](_0x230f6c,[_0xf142('0x3a')]));}};module[_0xf142('0x42')]=Agent; \ No newline at end of file diff --git a/server/services/routing/model/chatQueue.js b/server/services/routing/model/chatQueue.js index 19510ff..80bfecb 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 _0x7e4a=['waiting','updateRouting','_rr','mapAgentsId','map','Agents','loggedIn','paused','online','chatPause','available','stringify','format','emit','chat_queue:save','exports','lodash','md5','util','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall'];(function(_0x582d5a,_0x3b57c0){var _0x5625ef=function(_0x509d83){while(--_0x509d83){_0x582d5a['push'](_0x582d5a['shift']());}};_0x5625ef(++_0x3b57c0);}(_0x7e4a,0x1b4));var _0xa7e4=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x7e4a[_0x1ac595];return _0x455fff;};'use strict';var _=require(_0xa7e4('0x0'));var md5=require(_0xa7e4('0x1'));var util=require(_0xa7e4('0x2'));var Redis=require('ioredis');var config=require(_0xa7e4('0x3'));config[_0xa7e4('0x4')]=_[_0xa7e4('0x5')](config['redis'],{'host':_0xa7e4('0x6'),'port':0x18eb});var io=require(_0xa7e4('0x7'))(new Redis(config[_0xa7e4('0x4')]));function ChatQueue(_0x23cf57){this['id']=_0x23cf57['id']||0x0;this[_0xa7e4('0x8')]=_0x23cf57['name']||'';this[_0xa7e4('0x9')]=_0x23cf57[_0xa7e4('0x9')]||0xa;this['strategy']=_0x23cf57[_0xa7e4('0xa')]||_0xa7e4('0xb');this['Agents']=_0x23cf57['Agents'];this['mapAgentsId']={};this[_0xa7e4('0xc')]=0x0;this['md5']='';this[_0xa7e4('0xd')]();this['updateRealtime']();}ChatQueue['prototype'][_0xa7e4('0xd')]=function(){var _0x1656e7=this['mapAgentsId'][_0xa7e4('0xe')];this[_0xa7e4('0xf')]=_[_0xa7e4('0x10')](this[_0xa7e4('0x11')],'id');this['mapAgentsId'][_0xa7e4('0xe')]=_0x1656e7;};ChatQueue['prototype']['updateRealtime']=function(){this[_0xa7e4('0x12')]=0x0;this[_0xa7e4('0x13')]=0x0;for(var _0x13586e=0x0;_0x13586e=0x0?this[_0xa7e4('0x16')]:0x0;var _0x4db3db={'id':this['id'],'available':this[_0xa7e4('0x16')],'loggedIn':this[_0xa7e4('0x12')],'name':this[_0xa7e4('0x8')],'paused':this[_0xa7e4('0x13')],'waiting':this[_0xa7e4('0xc')]};var _0x54327e=md5(JSON[_0xa7e4('0x17')](_0x4db3db));if(this[_0xa7e4('0x1')]!==_0x54327e){this[_0xa7e4('0x1')]=_0x54327e;io['to'](util[_0xa7e4('0x18')]('chat:queue:%s',_0x4db3db[_0xa7e4('0x8')]))[_0xa7e4('0x19')](_0xa7e4('0x1a'),_0x4db3db);}};module[_0xa7e4('0x1b')]=ChatQueue; \ No newline at end of file +var _0x2741=['redis','localhost','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','md5','updateRouting','updateRealtime','prototype','map','_rr','loggedIn','paused','online','chatPause','available','stringify','format','emit','chat_queue:save','lodash','ioredis','../../../config/environment'];(function(_0x41e8f2,_0x17797c){var _0x20e3fc=function(_0x28a52d){while(--_0x28a52d){_0x41e8f2['push'](_0x41e8f2['shift']());}};_0x20e3fc(++_0x17797c);}(_0x2741,0x126));var _0x1274=function(_0x27276a,_0x58dcaa){_0x27276a=_0x27276a-0x0;var _0x44a298=_0x2741[_0x27276a];return _0x44a298;};'use strict';var _=require(_0x1274('0x0'));var md5=require('md5');var util=require('util');var Redis=require(_0x1274('0x1'));var config=require(_0x1274('0x2'));config['redis']=_['defaults'](config[_0x1274('0x3')],{'host':_0x1274('0x4'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x1274('0x3')]));function ChatQueue(_0x4bc8ea){this['id']=_0x4bc8ea['id']||0x0;this[_0x1274('0x5')]=_0x4bc8ea[_0x1274('0x5')]||'';this[_0x1274('0x6')]=_0x4bc8ea[_0x1274('0x6')]||0xa;this['strategy']=_0x4bc8ea[_0x1274('0x7')]||_0x1274('0x8');this['Agents']=_0x4bc8ea[_0x1274('0x9')];this[_0x1274('0xa')]={};this[_0x1274('0xb')]=0x0;this[_0x1274('0xc')]='';this[_0x1274('0xd')]();this[_0x1274('0xe')]();}ChatQueue[_0x1274('0xf')]['updateRouting']=function(){var _0x2dc124=this[_0x1274('0xa')]['_rr'];this[_0x1274('0xa')]=_[_0x1274('0x10')](this['Agents'],'id');this[_0x1274('0xa')][_0x1274('0x11')]=_0x2dc124;};ChatQueue[_0x1274('0xf')][_0x1274('0xe')]=function(){this[_0x1274('0x12')]=0x0;this[_0x1274('0x13')]=0x0;for(var _0x21c9f4=0x0;_0x21c9f4=0x0?this[_0x1274('0x16')]:0x0;var _0x517ba2={'id':this['id'],'available':this[_0x1274('0x16')],'loggedIn':this[_0x1274('0x12')],'name':this['name'],'paused':this[_0x1274('0x13')],'waiting':this[_0x1274('0xb')]};var _0x2168e1=md5(JSON[_0x1274('0x17')](_0x517ba2));if(this[_0x1274('0xc')]!==_0x2168e1){this[_0x1274('0xc')]=_0x2168e1;io['to'](util[_0x1274('0x18')]('chat:queue:%s',_0x517ba2[_0x1274('0x5')]))[_0x1274('0x19')](_0x1274('0x1a'),_0x517ba2);}};module['exports']=ChatQueue; \ No newline at end of file diff --git a/server/services/routing/model/faxQueue.js b/server/services/routing/model/faxQueue.js index 9d8f3e8..dbc51f7 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 _0x57ee=['updateRealtime','prototype','updateRouting','_rr','loggedIn','paused','length','online','faxPause','available','md5','format','fax:queue:%s','emit','fax_queue:save','exports','util','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting'];(function(_0x308d25,_0x41fd23){var _0x18fc27=function(_0x1d5bef){while(--_0x1d5bef){_0x308d25['push'](_0x308d25['shift']());}};_0x18fc27(++_0x41fd23);}(_0x57ee,0x15a));var _0xe57e=function(_0x19a96c,_0x1eccba){_0x19a96c=_0x19a96c-0x0;var _0x2c3050=_0x57ee[_0x19a96c];return _0x2c3050;};'use strict';var _=require('lodash');var md5=require('md5');var util=require(_0xe57e('0x0'));var Redis=require(_0xe57e('0x1'));var config=require(_0xe57e('0x2'));config[_0xe57e('0x3')]=_[_0xe57e('0x4')](config[_0xe57e('0x3')],{'host':_0xe57e('0x5'),'port':0x18eb});var io=require(_0xe57e('0x6'))(new Redis(config['redis']));function FaxQueue(_0x9ee7fe){this['id']=_0x9ee7fe['id']||0x0;this['name']=_0x9ee7fe[_0xe57e('0x7')]||'';this[_0xe57e('0x8')]=_0x9ee7fe['timeout']||0xa;this[_0xe57e('0x9')]=_0x9ee7fe['strategy']||_0xe57e('0xa');this[_0xe57e('0xb')]=_0x9ee7fe[_0xe57e('0xb')];this[_0xe57e('0xc')]={};this[_0xe57e('0xd')]=0x0;this['md5']='';this['updateRouting']();this[_0xe57e('0xe')]();}FaxQueue[_0xe57e('0xf')][_0xe57e('0x10')]=function(){var _0x54a2a5=this[_0xe57e('0xc')][_0xe57e('0x11')];this['mapAgentsId']=_['map'](this['Agents'],'id');this[_0xe57e('0xc')]['_rr']=_0x54a2a5;};FaxQueue[_0xe57e('0xf')]['updateRealtime']=function(){this[_0xe57e('0x12')]=0x0;this[_0xe57e('0x13')]=0x0;for(var _0x2c9515=0x0;_0x2c9515=0x0?this['available']:0x0;var _0xcc3144={'id':this['id'],'available':this[_0xe57e('0x17')],'loggedIn':this[_0xe57e('0x12')],'name':this[_0xe57e('0x7')],'paused':this['paused'],'waiting':this[_0xe57e('0xd')]};var _0xb2c521=md5(JSON['stringify'](_0xcc3144));if(this['md5']!==_0xb2c521){this[_0xe57e('0x18')]=_0xb2c521;io['to'](util[_0xe57e('0x19')](_0xe57e('0x1a'),_0xcc3144['name']))[_0xe57e('0x1b')](_0xe57e('0x1c'),_0xcc3144);}};module[_0xe57e('0x1d')]=FaxQueue; \ No newline at end of file +var _0xbbc1=['format','emit','exports','util','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','Agents','waiting','md5','updateRouting','prototype','mapAgentsId','_rr','map','updateRealtime','loggedIn','paused','length','online','faxPause','available','stringify'];(function(_0x3e00e0,_0x40aba1){var _0x6930ef=function(_0x127a34){while(--_0x127a34){_0x3e00e0['push'](_0x3e00e0['shift']());}};_0x6930ef(++_0x40aba1);}(_0xbbc1,0xb1));var _0x1bbc=function(_0x2ddd9d,_0x3eef84){_0x2ddd9d=_0x2ddd9d-0x0;var _0x2fb5fa=_0xbbc1[_0x2ddd9d];return _0x2fb5fa;};'use strict';var _=require('lodash');var md5=require('md5');var util=require(_0x1bbc('0x0'));var Redis=require(_0x1bbc('0x1'));var config=require(_0x1bbc('0x2'));config[_0x1bbc('0x3')]=_[_0x1bbc('0x4')](config[_0x1bbc('0x3')],{'host':_0x1bbc('0x5'),'port':0x18eb});var io=require(_0x1bbc('0x6'))(new Redis(config[_0x1bbc('0x3')]));function FaxQueue(_0x2adee7){this['id']=_0x2adee7['id']||0x0;this[_0x1bbc('0x7')]=_0x2adee7[_0x1bbc('0x7')]||'';this[_0x1bbc('0x8')]=_0x2adee7[_0x1bbc('0x8')]||0xa;this[_0x1bbc('0x9')]=_0x2adee7['strategy']||'beepall';this[_0x1bbc('0xa')]=_0x2adee7[_0x1bbc('0xa')];this['mapAgentsId']={};this[_0x1bbc('0xb')]=0x0;this[_0x1bbc('0xc')]='';this[_0x1bbc('0xd')]();this['updateRealtime']();}FaxQueue[_0x1bbc('0xe')]['updateRouting']=function(){var _0x2952fe=this[_0x1bbc('0xf')][_0x1bbc('0x10')];this['mapAgentsId']=_[_0x1bbc('0x11')](this[_0x1bbc('0xa')],'id');this[_0x1bbc('0xf')][_0x1bbc('0x10')]=_0x2952fe;};FaxQueue['prototype'][_0x1bbc('0x12')]=function(){this[_0x1bbc('0x13')]=0x0;this[_0x1bbc('0x14')]=0x0;for(var _0x26138e=0x0;_0x26138e=0x0?this[_0x1bbc('0x18')]:0x0;var _0x2fb217={'id':this['id'],'available':this[_0x1bbc('0x18')],'loggedIn':this[_0x1bbc('0x13')],'name':this[_0x1bbc('0x7')],'paused':this['paused'],'waiting':this[_0x1bbc('0xb')]};var _0x430976=md5(JSON[_0x1bbc('0x19')](_0x2fb217));if(this['md5']!==_0x430976){this['md5']=_0x430976;io['to'](util[_0x1bbc('0x1a')]('fax:queue:%s',_0x2fb217[_0x1bbc('0x7')]))[_0x1bbc('0x1b')]('fax_queue:save',_0x2fb217);}};module[_0x1bbc('0x1c')]=FaxQueue; \ No newline at end of file diff --git a/server/services/routing/model/interval.js b/server/services/routing/model/interval.js index 7e76e39..1c7085a 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 _0x617c=['exports','name','Intervals'];(function(_0x5e3b04,_0xbb6795){var _0x1fc44d=function(_0x3472a1){while(--_0x3472a1){_0x5e3b04['push'](_0x5e3b04['shift']());}};_0x1fc44d(++_0xbb6795);}(_0x617c,0x12a));var _0xc617=function(_0x593564,_0x43583f){_0x593564=_0x593564-0x0;var _0x211a89=_0x617c[_0x593564];return _0x211a89;};'use strict';function Interval(_0x8ea606){this['id']=_0x8ea606['id']||0x0;this['name']=_0x8ea606[_0xc617('0x0')]||'';this[_0xc617('0x1')]=_0x8ea606[_0xc617('0x1')]||{};}module[_0xc617('0x2')]=Interval; \ No newline at end of file +var _0x1603=['exports','name','Intervals'];(function(_0x2685c2,_0x2464ed){var _0x5c38f2=function(_0x235f5d){while(--_0x235f5d){_0x2685c2['push'](_0x2685c2['shift']());}};_0x5c38f2(++_0x2464ed);}(_0x1603,0x1bd));var _0x3160=function(_0x3f1842,_0x1e1a6f){_0x3f1842=_0x3f1842-0x0;var _0x23cad2=_0x1603[_0x3f1842];return _0x23cad2;};'use strict';function Interval(_0x46d9d4){this['id']=_0x46d9d4['id']||0x0;this['name']=_0x46d9d4[_0x3160('0x0')]||'';this[_0x3160('0x1')]=_0x46d9d4['Intervals']||{};}module[_0x3160('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 0489a40..4d0f15f 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 _0x70a9=['available','stringify','mail_queue:save','exports','lodash','md5','util','../../../config/environment','redis','defaults','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','_rr','map','loggedIn','paused','length'];(function(_0xba7fba,_0x47539d){var _0x8c73bb=function(_0x4b56f5){while(--_0x4b56f5){_0xba7fba['push'](_0xba7fba['shift']());}};_0x8c73bb(++_0x47539d);}(_0x70a9,0x1ad));var _0x970a=function(_0x1788af,_0x278e47){_0x1788af=_0x1788af-0x0;var _0x4c186e=_0x70a9[_0x1788af];return _0x4c186e;};'use strict';var _=require(_0x970a('0x0'));var md5=require(_0x970a('0x1'));var util=require(_0x970a('0x2'));var Redis=require('ioredis');var config=require(_0x970a('0x3'));config[_0x970a('0x4')]=_[_0x970a('0x5')](config[_0x970a('0x4')],{'host':'localhost','port':0x18eb});var io=require(_0x970a('0x6'))(new Redis(config[_0x970a('0x4')]));function MailQueue(_0x28401e){this['id']=_0x28401e['id']||0x0;this[_0x970a('0x7')]=_0x28401e[_0x970a('0x7')]||'';this[_0x970a('0x8')]=_0x28401e[_0x970a('0x8')]||0xa;this['strategy']=_0x28401e[_0x970a('0x9')]||_0x970a('0xa');this[_0x970a('0xb')]=_0x28401e['Agents'];this[_0x970a('0xc')]={};this[_0x970a('0xd')]=0x0;this[_0x970a('0x1')]='';this[_0x970a('0xe')]();this[_0x970a('0xf')]();}MailQueue['prototype']['updateRouting']=function(){var _0x4c9ba4=this[_0x970a('0xc')][_0x970a('0x10')];this[_0x970a('0xc')]=_[_0x970a('0x11')](this[_0x970a('0xb')],'id');this[_0x970a('0xc')][_0x970a('0x10')]=_0x4c9ba4;};MailQueue['prototype'][_0x970a('0xf')]=function(){this[_0x970a('0x12')]=0x0;this[_0x970a('0x13')]=0x0;for(var _0x5da2c6=0x0;_0x5da2c6=0x0?this['available']:0x0;var _0x11ae8a={'id':this['id'],'available':this[_0x970a('0x15')],'loggedIn':this[_0x970a('0x12')],'name':this[_0x970a('0x7')],'paused':this[_0x970a('0x13')],'waiting':this[_0x970a('0xd')]};var _0x2922f2=md5(JSON[_0x970a('0x16')](_0x11ae8a));if(this[_0x970a('0x1')]!==_0x2922f2){this[_0x970a('0x1')]=_0x2922f2;io['to'](util['format']('mail:queue:%s',_0x11ae8a[_0x970a('0x7')]))['emit'](_0x970a('0x17'),_0x11ae8a);}};module[_0x970a('0x18')]=MailQueue; \ No newline at end of file +var _0xed5a=['_rr','map','paused','length','loggedIn','available','stringify','md5','format','emit','mail_queue:save','exports','lodash','util','ioredis','../../../config/environment','defaults','redis','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype'];(function(_0xfc0976,_0x33776f){var _0x23579f=function(_0x4143d9){while(--_0x4143d9){_0xfc0976['push'](_0xfc0976['shift']());}};_0x23579f(++_0x33776f);}(_0xed5a,0x84));var _0xaed5=function(_0x55821d,_0x27a22e){_0x55821d=_0x55821d-0x0;var _0x58ea8a=_0xed5a[_0x55821d];return _0x58ea8a;};'use strict';var _=require(_0xaed5('0x0'));var md5=require('md5');var util=require(_0xaed5('0x1'));var Redis=require(_0xaed5('0x2'));var config=require(_0xaed5('0x3'));config['redis']=_[_0xaed5('0x4')](config[_0xaed5('0x5')],{'host':_0xaed5('0x6'),'port':0x18eb});var io=require(_0xaed5('0x7'))(new Redis(config['redis']));function MailQueue(_0xc866ca){this['id']=_0xc866ca['id']||0x0;this[_0xaed5('0x8')]=_0xc866ca[_0xaed5('0x8')]||'';this[_0xaed5('0x9')]=_0xc866ca[_0xaed5('0x9')]||0xa;this[_0xaed5('0xa')]=_0xc866ca[_0xaed5('0xa')]||_0xaed5('0xb');this[_0xaed5('0xc')]=_0xc866ca[_0xaed5('0xc')];this[_0xaed5('0xd')]={};this[_0xaed5('0xe')]=0x0;this['md5']='';this[_0xaed5('0xf')]();this[_0xaed5('0x10')]();}MailQueue[_0xaed5('0x11')][_0xaed5('0xf')]=function(){var _0x3b3836=this[_0xaed5('0xd')][_0xaed5('0x12')];this['mapAgentsId']=_[_0xaed5('0x13')](this['Agents'],'id');this[_0xaed5('0xd')][_0xaed5('0x12')]=_0x3b3836;};MailQueue['prototype'][_0xaed5('0x10')]=function(){this['loggedIn']=0x0;this[_0xaed5('0x14')]=0x0;for(var _0x4c82db=0x0;_0x4c82db=0x0?this[_0xaed5('0x17')]:0x0;var _0x3f04e1={'id':this['id'],'available':this[_0xaed5('0x17')],'loggedIn':this['loggedIn'],'name':this['name'],'paused':this[_0xaed5('0x14')],'waiting':this[_0xaed5('0xe')]};var _0x5377ca=md5(JSON[_0xaed5('0x18')](_0x3f04e1));if(this[_0xaed5('0x19')]!==_0x5377ca){this[_0xaed5('0x19')]=_0x5377ca;io['to'](util[_0xaed5('0x1a')]('mail:queue:%s',_0x3f04e1['name']))[_0xaed5('0x1b')](_0xaed5('0x1c'),_0x3f04e1);}};module[_0xaed5('0x1d')]=MailQueue; \ No newline at end of file diff --git a/server/services/routing/model/openchannelQueue.js b/server/services/routing/model/openchannelQueue.js index 834d8e2..e59f10e 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(_0x3fdee7,_0x259d89){var _0x5aa868=function(_0x122583){while(--_0x122583){_0x3fdee7['push'](_0x3fdee7['shift']());}};_0x5aa868(++_0x259d89);}(_0x814b,0x1a2));var _0xb814=function(_0x3c1ca2,_0x3428ae){_0x3c1ca2=_0x3c1ca2-0x0;var _0x310c01=_0x814b[_0x3c1ca2];return _0x310c01;};'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 _0xc4aa=['strategy','Agents','mapAgentsId','updateRouting','updateRealtime','map','_rr','prototype','loggedIn','paused','length','online','available','waiting','stringify','format','openchannel:queue:%s','emit','openchannel_queue:save','lodash','md5','util','ioredis','../../../config/environment','redis','socket.io-emitter','name','timeout'];(function(_0x4c445a,_0x4ee80f){var _0x2f611c=function(_0x4f3699){while(--_0x4f3699){_0x4c445a['push'](_0x4c445a['shift']());}};_0x2f611c(++_0x4ee80f);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x3511d3,_0x4107ae){_0x3511d3=_0x3511d3-0x0;var _0x5d6321=_0xc4aa[_0x3511d3];return _0x5d6321;};'use strict';var _=require(_0xac4a('0x0'));var md5=require(_0xac4a('0x1'));var util=require(_0xac4a('0x2'));var Redis=require(_0xac4a('0x3'));var config=require(_0xac4a('0x4'));config[_0xac4a('0x5')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0xac4a('0x6'))(new Redis(config[_0xac4a('0x5')]));function OpenchannelQueue(_0x730a38){this['id']=_0x730a38['id']||0x0;this[_0xac4a('0x7')]=_0x730a38[_0xac4a('0x7')]||'';this[_0xac4a('0x8')]=_0x730a38[_0xac4a('0x8')]||0xa;this[_0xac4a('0x9')]=_0x730a38['strategy']||'beepall';this[_0xac4a('0xa')]=_0x730a38[_0xac4a('0xa')];this[_0xac4a('0xb')]={};this['waiting']=0x0;this[_0xac4a('0x1')]='';this[_0xac4a('0xc')]();this[_0xac4a('0xd')]();}OpenchannelQueue['prototype'][_0xac4a('0xc')]=function(){var _0x488e3c=this[_0xac4a('0xb')]['_rr'];this[_0xac4a('0xb')]=_[_0xac4a('0xe')](this[_0xac4a('0xa')],'id');this['mapAgentsId'][_0xac4a('0xf')]=_0x488e3c;};OpenchannelQueue[_0xac4a('0x10')][_0xac4a('0xd')]=function(){this[_0xac4a('0x11')]=0x0;this[_0xac4a('0x12')]=0x0;for(var _0x3b71c0=0x0;_0x3b71c0=0x0?this[_0xac4a('0x15')]:0x0;var _0x44ec59={'id':this['id'],'available':this['available'],'loggedIn':this['loggedIn'],'name':this[_0xac4a('0x7')],'paused':this[_0xac4a('0x12')],'waiting':this[_0xac4a('0x16')]};var _0x4d837c=md5(JSON[_0xac4a('0x17')](_0x44ec59));if(this[_0xac4a('0x1')]!==_0x4d837c){this[_0xac4a('0x1')]=_0x4d837c;io['to'](util[_0xac4a('0x18')](_0xac4a('0x19'),_0x44ec59[_0xac4a('0x7')]))[_0xac4a('0x1a')](_0xac4a('0x1b'),_0x44ec59);}};module['exports']=OpenchannelQueue; \ No newline at end of file diff --git a/server/services/routing/model/smsQueue.js b/server/services/routing/model/smsQueue.js index 6feb9b8..78dacb7 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 _0x0269=['util','../../../config/environment','defaults','redis','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','_rr','map','loggedIn','length','online','smsPause','available','paused','md5','format','sms:queue:%s','emit','sms_queue:save','exports','lodash'];(function(_0x203cbf,_0x41885c){var _0x2ef4ce=function(_0x25c437){while(--_0x25c437){_0x203cbf['push'](_0x203cbf['shift']());}};_0x2ef4ce(++_0x41885c);}(_0x0269,0x135));var _0x9026=function(_0x5f260f,_0x3e449f){_0x5f260f=_0x5f260f-0x0;var _0x54ec0d=_0x0269[_0x5f260f];return _0x54ec0d;};'use strict';var _=require(_0x9026('0x0'));var md5=require('md5');var util=require(_0x9026('0x1'));var Redis=require('ioredis');var config=require(_0x9026('0x2'));config['redis']=_[_0x9026('0x3')](config[_0x9026('0x4')],{'host':_0x9026('0x5'),'port':0x18eb});var io=require(_0x9026('0x6'))(new Redis(config['redis']));function SmsQueue(_0x314458){this['id']=_0x314458['id']||0x0;this[_0x9026('0x7')]=_0x314458['name']||'';this['timeout']=_0x314458[_0x9026('0x8')]||0xa;this[_0x9026('0x9')]=_0x314458[_0x9026('0x9')]||_0x9026('0xa');this['Agents']=_0x314458[_0x9026('0xb')];this[_0x9026('0xc')]={};this[_0x9026('0xd')]=0x0;this['md5']='';this[_0x9026('0xe')]();this[_0x9026('0xf')]();}SmsQueue[_0x9026('0x10')]['updateRouting']=function(){var _0x2c1dd2=this['mapAgentsId'][_0x9026('0x11')];this[_0x9026('0xc')]=_[_0x9026('0x12')](this[_0x9026('0xb')],'id');this[_0x9026('0xc')][_0x9026('0x11')]=_0x2c1dd2;};SmsQueue[_0x9026('0x10')]['updateRealtime']=function(){this[_0x9026('0x13')]=0x0;this['paused']=0x0;for(var _0x385afc=0x0;_0x385afc=0x0?this[_0x9026('0x17')]:0x0;var _0x4e37d0={'id':this['id'],'available':this[_0x9026('0x17')],'loggedIn':this[_0x9026('0x13')],'name':this[_0x9026('0x7')],'paused':this[_0x9026('0x18')],'waiting':this['waiting']};var _0x7985=md5(JSON['stringify'](_0x4e37d0));if(this[_0x9026('0x19')]!==_0x7985){this['md5']=_0x7985;io['to'](util[_0x9026('0x1a')](_0x9026('0x1b'),_0x4e37d0[_0x9026('0x7')]))[_0x9026('0x1c')](_0x9026('0x1d'),_0x4e37d0);}};module[_0x9026('0x1e')]=SmsQueue; \ No newline at end of file +var _0x9f94=['loggedIn','length','online','Agents','smsPause','available','paused','waiting','stringify','sms:queue:%s','emit','lodash','md5','util','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','mapAgentsId','updateRouting','updateRealtime','_rr','map','prototype'];(function(_0x348d44,_0x1392c6){var _0x59d011=function(_0x568db4){while(--_0x568db4){_0x348d44['push'](_0x348d44['shift']());}};_0x59d011(++_0x1392c6);}(_0x9f94,0x1e7));var _0x49f9=function(_0x4e676e,_0x2a7c6d){_0x4e676e=_0x4e676e-0x0;var _0x336a3c=_0x9f94[_0x4e676e];return _0x336a3c;};'use strict';var _=require(_0x49f9('0x0'));var md5=require(_0x49f9('0x1'));var util=require(_0x49f9('0x2'));var Redis=require('ioredis');var config=require('../../../config/environment');config[_0x49f9('0x3')]=_[_0x49f9('0x4')](config[_0x49f9('0x3')],{'host':_0x49f9('0x5'),'port':0x18eb});var io=require(_0x49f9('0x6'))(new Redis(config['redis']));function SmsQueue(_0x6dbeac){this['id']=_0x6dbeac['id']||0x0;this[_0x49f9('0x7')]=_0x6dbeac[_0x49f9('0x7')]||'';this[_0x49f9('0x8')]=_0x6dbeac[_0x49f9('0x8')]||0xa;this[_0x49f9('0x9')]=_0x6dbeac[_0x49f9('0x9')]||_0x49f9('0xa');this['Agents']=_0x6dbeac['Agents'];this[_0x49f9('0xb')]={};this['waiting']=0x0;this[_0x49f9('0x1')]='';this[_0x49f9('0xc')]();this[_0x49f9('0xd')]();}SmsQueue['prototype'][_0x49f9('0xc')]=function(){var _0x59bb47=this[_0x49f9('0xb')][_0x49f9('0xe')];this[_0x49f9('0xb')]=_[_0x49f9('0xf')](this['Agents'],'id');this['mapAgentsId'][_0x49f9('0xe')]=_0x59bb47;};SmsQueue[_0x49f9('0x10')][_0x49f9('0xd')]=function(){this[_0x49f9('0x11')]=0x0;this['paused']=0x0;for(var _0x4e7790=0x0;_0x4e7790=0x0?this[_0x49f9('0x16')]:0x0;var _0x3cc45e={'id':this['id'],'available':this[_0x49f9('0x16')],'loggedIn':this[_0x49f9('0x11')],'name':this[_0x49f9('0x7')],'paused':this[_0x49f9('0x17')],'waiting':this[_0x49f9('0x18')]};var _0xa9b24c=md5(JSON[_0x49f9('0x19')](_0x3cc45e));if(this[_0x49f9('0x1')]!==_0xa9b24c){this['md5']=_0xa9b24c;io['to'](util['format'](_0x49f9('0x1a'),_0x3cc45e['name']))[_0x49f9('0x1b')]('sms_queue:save',_0x3cc45e);}};module['exports']=SmsQueue; \ No newline at end of file diff --git a/server/services/routing/model/whatsappQueue.js b/server/services/routing/model/whatsappQueue.js index 7034edd..ab6d427 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 _0x5010=['map','loggedIn','paused','length','whatsappPause','available','stringify','whatsapp:queue:%s','emit','whatsapp_queue:save','exports','md5','util','redis','defaults','localhost','socket.io-emitter','name','strategy','beepall','Agents','waiting','updateRouting','prototype','mapAgentsId'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5010,0x137));var _0x0501=function(_0xc18a4b,_0x3312a6){_0xc18a4b=_0xc18a4b-0x0;var _0x1db4f1=_0x5010[_0xc18a4b];return _0x1db4f1;};'use strict';var _=require('lodash');var md5=require(_0x0501('0x0'));var util=require(_0x0501('0x1'));var Redis=require('ioredis');var config=require('../../../config/environment');config[_0x0501('0x2')]=_[_0x0501('0x3')](config[_0x0501('0x2')],{'host':_0x0501('0x4'),'port':0x18eb});var io=require(_0x0501('0x5'))(new Redis(config['redis']));function WhatsappQueue(_0x5cde32){this['id']=_0x5cde32['id']||0x0;this[_0x0501('0x6')]=_0x5cde32[_0x0501('0x6')]||'';this['timeout']=_0x5cde32['timeout']||0xa;this[_0x0501('0x7')]=_0x5cde32['strategy']||_0x0501('0x8');this['Agents']=_0x5cde32[_0x0501('0x9')];this['mapAgentsId']={};this[_0x0501('0xa')]=0x0;this[_0x0501('0x0')]='';this[_0x0501('0xb')]();this['updateRealtime']();}WhatsappQueue[_0x0501('0xc')][_0x0501('0xb')]=function(){var _0x71b156=this[_0x0501('0xd')]['_rr'];this[_0x0501('0xd')]=_[_0x0501('0xe')](this[_0x0501('0x9')],'id');this[_0x0501('0xd')]['_rr']=_0x71b156;};WhatsappQueue[_0x0501('0xc')]['updateRealtime']=function(){this[_0x0501('0xf')]=0x0;this[_0x0501('0x10')]=0x0;for(var _0x37dc75=0x0;_0x37dc75=0x0?this['available']:0x0;var _0x2c164a={'id':this['id'],'available':this['available'],'loggedIn':this[_0x0501('0xf')],'name':this[_0x0501('0x6')],'paused':this[_0x0501('0x10')],'waiting':this[_0x0501('0xa')]};var _0x29e946=md5(JSON[_0x0501('0x14')](_0x2c164a));if(this['md5']!==_0x29e946){this['md5']=_0x29e946;io['to'](util['format'](_0x0501('0x15'),_0x2c164a[_0x0501('0x6')]))[_0x0501('0x16')](_0x0501('0x17'),_0x2c164a);}};module[_0x0501('0x18')]=WhatsappQueue; \ No newline at end of file +var _0xb38c=['../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','md5','updateRouting','updateRealtime','prototype','_rr','map','loggedIn','paused','online','available','waiting','format','whatsapp:queue:%s','whatsapp_queue:save','exports','util','ioredis'];(function(_0x24237f,_0x4cf32c){var _0x48298e=function(_0x3f7511){while(--_0x3f7511){_0x24237f['push'](_0x24237f['shift']());}};_0x48298e(++_0x4cf32c);}(_0xb38c,0xfa));var _0xcb38=function(_0x151381,_0x97b314){_0x151381=_0x151381-0x0;var _0x2afab6=_0xb38c[_0x151381];return _0x2afab6;};'use strict';var _=require('lodash');var md5=require('md5');var util=require(_0xcb38('0x0'));var Redis=require(_0xcb38('0x1'));var config=require(_0xcb38('0x2'));config[_0xcb38('0x3')]=_[_0xcb38('0x4')](config[_0xcb38('0x3')],{'host':_0xcb38('0x5'),'port':0x18eb});var io=require(_0xcb38('0x6'))(new Redis(config[_0xcb38('0x3')]));function WhatsappQueue(_0x27eb4a){this['id']=_0x27eb4a['id']||0x0;this[_0xcb38('0x7')]=_0x27eb4a[_0xcb38('0x7')]||'';this[_0xcb38('0x8')]=_0x27eb4a[_0xcb38('0x8')]||0xa;this[_0xcb38('0x9')]=_0x27eb4a[_0xcb38('0x9')]||_0xcb38('0xa');this['Agents']=_0x27eb4a[_0xcb38('0xb')];this[_0xcb38('0xc')]={};this['waiting']=0x0;this[_0xcb38('0xd')]='';this[_0xcb38('0xe')]();this[_0xcb38('0xf')]();}WhatsappQueue[_0xcb38('0x10')]['updateRouting']=function(){var _0x3414b4=this[_0xcb38('0xc')][_0xcb38('0x11')];this[_0xcb38('0xc')]=_[_0xcb38('0x12')](this[_0xcb38('0xb')],'id');this[_0xcb38('0xc')][_0xcb38('0x11')]=_0x3414b4;};WhatsappQueue[_0xcb38('0x10')][_0xcb38('0xf')]=function(){this[_0xcb38('0x13')]=0x0;this[_0xcb38('0x14')]=0x0;for(var _0x28aaa0=0x0;_0x28aaa0=0x0?this[_0xcb38('0x16')]:0x0;var _0x4d643d={'id':this['id'],'available':this[_0xcb38('0x16')],'loggedIn':this[_0xcb38('0x13')],'name':this['name'],'paused':this['paused'],'waiting':this[_0xcb38('0x17')]};var _0x9f4702=md5(JSON['stringify'](_0x4d643d));if(this[_0xcb38('0xd')]!==_0x9f4702){this['md5']=_0x9f4702;io['to'](util[_0xcb38('0x18')](_0xcb38('0x19'),_0x4d643d[_0xcb38('0x7')]))['emit'](_0xcb38('0x1a'),_0x4d643d);}};module[_0xcb38('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 da48263..652ead3 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(_0x158f5d,_0x1be83e){var _0x1d42bd=function(_0x27317b){while(--_0x27317b){_0x158f5d['push'](_0x158f5d['shift']());}};_0x1d42bd(++_0x1be83e);}(_0xb10b,0x12a));var _0xbb10=function(_0x374ada,_0x27b3a5){_0x374ada=_0x374ada-0x0;var _0x449ed8=_0xb10b[_0x374ada];return _0x449ed8;};'use strict';var BPromise=require(_0xbb10('0x0'));var util=require('util');var _=require(_0xbb10('0x1'));var moment=require(_0xbb10('0x2'));var Agent=require(_0xbb10('0x3'));var Interval=require('../model/interval');var OpenchannelQueue=require(_0xbb10('0x4'));var ChatQueue=require(_0xbb10('0x5'));var SmsQueue=require(_0xbb10('0x6'));var MailQueue=require(_0xbb10('0x7'));var FaxQueue=require(_0xbb10('0x8'));var WhatsappQueue=require(_0xbb10('0x9'));var Realtime=function(){this['agents']={};this[_0xbb10('0xa')]={};this[_0xbb10('0xb')]={};this['chatQueues']={};this[_0xbb10('0xc')]={};this[_0xbb10('0xd')]={};this[_0xbb10('0xe')]={};this[_0xbb10('0xf')]={};this[_0xbb10('0x10')]={};this[_0xbb10('0x11')]={};this[_0xbb10('0x12')]={};this[_0xbb10('0x13')]={};this['faxQueuesWaitingInteractions']={};this['whatsappQueuesWaitingInteractions']={};};function freeIsNotKey(_0x20bd61,_0x118a74,_0xce64f3){var _0x5e136d=_[_0xbb10('0x14')](_0x20bd61,function(_0x5be7e0,_0x44fb19){return _0x5be7e0[_0xce64f3];});for(var _0x916a32 in _0x118a74){if(_0x118a74[_0xbb10('0x15')](_0x916a32)){if(!_0x5e136d[_0x916a32]){delete _0x118a74[_0x916a32];}}}}Realtime[_0xbb10('0x16')][_0xbb10('0x17')]=function(_0x147230,_0x58a612){for(var _0x26e021 in _0x58a612){if(_0x147230[_0xbb10('0x15')](_0x26e021)){_0x147230[_0x26e021]=_0x58a612[_0x26e021];}}};Realtime[_0xbb10('0x16')][_0xbb10('0x18')]=function(){var _0x3df17b=this;return function(_0x2f2ebf){if(_0x2f2ebf){freeIsNotKey(_0x2f2ebf,_0x3df17b[_0xbb10('0x19')],'id');for(var _0x36b5e8=0x0,_0x3e26f4={},_0x2b184e={};_0x36b5e8<_0x2f2ebf['length'];_0x36b5e8+=0x1){_0x3e26f4=_0x2f2ebf[_0x36b5e8];if(_[_0xbb10('0x1a')](_0x3df17b[_0xbb10('0x19')][_0x3e26f4['id']])){_0x3df17b[_0xbb10('0x19')][_0x3e26f4['id']]=new Agent(_0x3e26f4);}else{_0x3df17b[_0xbb10('0x17')](_0x3df17b[_0xbb10('0x19')][_0x3e26f4['id']],_0x3e26f4);}}}return _0x3df17b[_0xbb10('0x19')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x1b')]=function(){var _0xbf2906=this;return function(_0xe1c665){if(_0xe1c665){freeIsNotKey(_0xe1c665,_0xbf2906['intervals'],'id');for(var _0x5ff0cf=0x0,_0x19f48d={},_0x388fab={};_0x5ff0cf<_0xe1c665[_0xbb10('0x1c')];_0x5ff0cf+=0x1){_0x19f48d=_0xe1c665[_0x5ff0cf];if(_[_0xbb10('0x1a')](_0xbf2906[_0xbb10('0xa')][_0x19f48d['id']])){_0xbf2906['intervals'][_0x19f48d['id']]=new Interval(_0x19f48d);}else{_0xbf2906[_0xbb10('0x17')](_0xbf2906[_0xbb10('0xa')][_0x19f48d['id']],_0x19f48d);}}}return _0xbf2906['intervals'];};};Realtime['prototype'][_0xbb10('0x1d')]=function(){var _0x311abe=this;return function(_0x2e911d){if(_0x2e911d){freeIsNotKey(_0x2e911d,_0x311abe[_0xbb10('0xb')],'id');for(var _0x445761=0x0,_0x1824b7={},_0x407cb4={};_0x445761<_0x2e911d[_0xbb10('0x1c')];_0x445761+=0x1){_0x1824b7=_0x2e911d[_0x445761];if(_[_0xbb10('0x1a')](_0x311abe[_0xbb10('0xb')][_0x1824b7['id']])){_0x311abe[_0xbb10('0xb')][_0x1824b7['id']]=new OpenchannelQueue(_0x1824b7);}else{_0x311abe[_0xbb10('0x17')](_0x311abe['openchannelQueues'][_0x1824b7['id']],_0x1824b7);}_0x311abe['openchannelQueues'][_0x1824b7['id']]['updateRouting']();_0x311abe[_0xbb10('0xb')][_0x1824b7['id']][_0xbb10('0x1e')]();}}return _0x311abe[_0xbb10('0xb')];};};Realtime['prototype'][_0xbb10('0x1f')]=function(){var _0x24d586=this;return function(_0x6ed43b){if(_0x6ed43b){freeIsNotKey(_0x6ed43b,_0x24d586[_0xbb10('0x20')],'id');for(var _0x1acce9=0x0,_0x20d946={},_0x2a0e8b={};_0x1acce9<_0x6ed43b['length'];_0x1acce9+=0x1){_0x20d946=_0x6ed43b[_0x1acce9];if(_[_0xbb10('0x1a')](_0x24d586[_0xbb10('0x20')][_0x20d946['id']])){_0x24d586[_0xbb10('0x20')][_0x20d946['id']]=new ChatQueue(_0x20d946);}else{_0x24d586[_0xbb10('0x17')](_0x24d586[_0xbb10('0x20')][_0x20d946['id']],_0x20d946);}_0x24d586[_0xbb10('0x20')][_0x20d946['id']]['updateRouting']();_0x24d586[_0xbb10('0x20')][_0x20d946['id']]['updateRealtime']();}}return _0x24d586[_0xbb10('0x20')];};};Realtime['prototype'][_0xbb10('0x21')]=function(){var _0x1dcc9c=this;return function(_0x1b59f9){if(_0x1b59f9){freeIsNotKey(_0x1b59f9,_0x1dcc9c['smsQueues'],'id');for(var _0x518d47=0x0,_0x4c3744={},_0x34f65e={};_0x518d47<_0x1b59f9['length'];_0x518d47+=0x1){_0x4c3744=_0x1b59f9[_0x518d47];if(_[_0xbb10('0x1a')](_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']])){_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']]=new SmsQueue(_0x4c3744);}else{_0x1dcc9c[_0xbb10('0x17')](_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']],_0x4c3744);}_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']][_0xbb10('0x22')]();_0x1dcc9c['smsQueues'][_0x4c3744['id']][_0xbb10('0x1e')]();}}return _0x1dcc9c[_0xbb10('0xc')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x23')]=function(){var _0xfb2c5e=this;return function(_0x9de708){if(_0x9de708){freeIsNotKey(_0x9de708,_0xfb2c5e[_0xbb10('0xd')],'id');for(var _0x10202c=0x0,_0x3c8d7d={},_0x56943c={};_0x10202c<_0x9de708[_0xbb10('0x1c')];_0x10202c+=0x1){_0x3c8d7d=_0x9de708[_0x10202c];if(_[_0xbb10('0x1a')](_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']])){_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']]=new MailQueue(_0x3c8d7d);}else{_0xfb2c5e['mergeFromDatabase'](_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']],_0x3c8d7d);}_0xfb2c5e['mailQueues'][_0x3c8d7d['id']]['updateRouting']();_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']][_0xbb10('0x1e')]();}}return _0xfb2c5e[_0xbb10('0xd')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x24')]=function(){var _0x29d11a=this;return function(_0x547062){if(_0x547062){freeIsNotKey(_0x547062,_0x29d11a[_0xbb10('0xe')],'id');for(var _0x25d72f=0x0,_0x52de31={},_0x5e3fbd={};_0x25d72f<_0x547062['length'];_0x25d72f+=0x1){_0x52de31=_0x547062[_0x25d72f];if(_[_0xbb10('0x1a')](_0x29d11a[_0xbb10('0xe')][_0x52de31['id']])){_0x29d11a[_0xbb10('0xe')][_0x52de31['id']]=new FaxQueue(_0x52de31);}else{_0x29d11a['mergeFromDatabase'](_0x29d11a[_0xbb10('0xe')][_0x52de31['id']],_0x52de31);}_0x29d11a[_0xbb10('0xe')][_0x52de31['id']][_0xbb10('0x22')]();_0x29d11a['faxQueues'][_0x52de31['id']][_0xbb10('0x1e')]();}}return _0x29d11a[_0xbb10('0xe')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x25')]=function(){var _0x4f1cdd=this;return function(_0xd238e9){if(_0xd238e9){freeIsNotKey(_0xd238e9,_0x4f1cdd[_0xbb10('0xf')],'id');for(var _0x5835fd=0x0,_0xe2040f={},_0x2e3214={};_0x5835fd<_0xd238e9[_0xbb10('0x1c')];_0x5835fd+=0x1){_0xe2040f=_0xd238e9[_0x5835fd];if(_[_0xbb10('0x1a')](_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']])){_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']]=new WhatsappQueue(_0xe2040f);}else{_0x4f1cdd['mergeFromDatabase'](_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']],_0xe2040f);}_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']][_0xbb10('0x22')]();_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']]['updateRealtime']();}}return _0x4f1cdd[_0xbb10('0xf')];};};module[_0xbb10('0x26')]=Realtime; \ No newline at end of file +var _0xa9e0=['isUndefined','initIntervals','updateRealtime','updateRouting','initSmsQueues','smsQueues','initMailQueues','mailQueues','initWhatsappQueues','whatsappQueues','exports','bluebird','util','lodash','../model/interval','../model/chatQueue','../model/smsQueue','../model/mailQueue','../model/faxQueue','../model/whatsappQueue','intervals','openchannelQueues','chatQueues','faxQueues','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','hasOwnProperty','prototype','mergeFromDatabase','initAgents','agents','length'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0xa9e0[_0x5b644e];return _0x49c6bf;};'use strict';var BPromise=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var _=require(_0x0a9e('0x2'));var moment=require('moment');var Agent=require('../model/agent');var Interval=require(_0x0a9e('0x3'));var OpenchannelQueue=require('../model/openchannelQueue');var ChatQueue=require(_0x0a9e('0x4'));var SmsQueue=require(_0x0a9e('0x5'));var MailQueue=require(_0x0a9e('0x6'));var FaxQueue=require(_0x0a9e('0x7'));var WhatsappQueue=require(_0x0a9e('0x8'));var Realtime=function(){this['agents']={};this[_0x0a9e('0x9')]={};this[_0x0a9e('0xa')]={};this[_0x0a9e('0xb')]={};this['smsQueues']={};this['mailQueues']={};this[_0x0a9e('0xc')]={};this['whatsappQueues']={};this['chatQueuesWaitingInteractions']={};this[_0x0a9e('0xd')]={};this[_0x0a9e('0xe')]={};this[_0x0a9e('0xf')]={};this[_0x0a9e('0x10')]={};this[_0x0a9e('0x11')]={};};function freeIsNotKey(_0xbd1168,_0x4a4c56,_0x50dfb2){var _0x527cdd=_['mapKeys'](_0xbd1168,function(_0x273d4d,_0x36471c){return _0x273d4d[_0x50dfb2];});for(var _0xd5b662 in _0x4a4c56){if(_0x4a4c56[_0x0a9e('0x12')](_0xd5b662)){if(!_0x527cdd[_0xd5b662]){delete _0x4a4c56[_0xd5b662];}}}}Realtime[_0x0a9e('0x13')][_0x0a9e('0x14')]=function(_0x5db4b0,_0x4283ce){for(var _0x239b12 in _0x4283ce){if(_0x5db4b0[_0x0a9e('0x12')](_0x239b12)){_0x5db4b0[_0x239b12]=_0x4283ce[_0x239b12];}}};Realtime[_0x0a9e('0x13')][_0x0a9e('0x15')]=function(){var _0x4d5611=this;return function(_0x52a03d){if(_0x52a03d){freeIsNotKey(_0x52a03d,_0x4d5611[_0x0a9e('0x16')],'id');for(var _0x5d0880=0x0,_0x1985b6={},_0x519dfd={};_0x5d0880<_0x52a03d[_0x0a9e('0x17')];_0x5d0880+=0x1){_0x1985b6=_0x52a03d[_0x5d0880];if(_[_0x0a9e('0x18')](_0x4d5611['agents'][_0x1985b6['id']])){_0x4d5611[_0x0a9e('0x16')][_0x1985b6['id']]=new Agent(_0x1985b6);}else{_0x4d5611['mergeFromDatabase'](_0x4d5611[_0x0a9e('0x16')][_0x1985b6['id']],_0x1985b6);}}}return _0x4d5611[_0x0a9e('0x16')];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x19')]=function(){var _0x31b1ca=this;return function(_0x2eb11f){if(_0x2eb11f){freeIsNotKey(_0x2eb11f,_0x31b1ca[_0x0a9e('0x9')],'id');for(var _0x20559e=0x0,_0x1314ae={},_0x112016={};_0x20559e<_0x2eb11f[_0x0a9e('0x17')];_0x20559e+=0x1){_0x1314ae=_0x2eb11f[_0x20559e];if(_[_0x0a9e('0x18')](_0x31b1ca['intervals'][_0x1314ae['id']])){_0x31b1ca[_0x0a9e('0x9')][_0x1314ae['id']]=new Interval(_0x1314ae);}else{_0x31b1ca[_0x0a9e('0x14')](_0x31b1ca['intervals'][_0x1314ae['id']],_0x1314ae);}}}return _0x31b1ca[_0x0a9e('0x9')];};};Realtime['prototype']['initOpenchannelQueues']=function(){var _0x3a02e1=this;return function(_0x432e56){if(_0x432e56){freeIsNotKey(_0x432e56,_0x3a02e1[_0x0a9e('0xa')],'id');for(var _0x30bae6=0x0,_0x4abc77={},_0xfb6e48={};_0x30bae6<_0x432e56[_0x0a9e('0x17')];_0x30bae6+=0x1){_0x4abc77=_0x432e56[_0x30bae6];if(_[_0x0a9e('0x18')](_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']])){_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']]=new OpenchannelQueue(_0x4abc77);}else{_0x3a02e1[_0x0a9e('0x14')](_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']],_0x4abc77);}_0x3a02e1['openchannelQueues'][_0x4abc77['id']]['updateRouting']();_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']][_0x0a9e('0x1a')]();}}return _0x3a02e1[_0x0a9e('0xa')];};};Realtime[_0x0a9e('0x13')]['initChatQueues']=function(){var _0x384319=this;return function(_0x479bc4){if(_0x479bc4){freeIsNotKey(_0x479bc4,_0x384319[_0x0a9e('0xb')],'id');for(var _0x5bfb33=0x0,_0x1dc186={},_0x34dc65={};_0x5bfb33<_0x479bc4[_0x0a9e('0x17')];_0x5bfb33+=0x1){_0x1dc186=_0x479bc4[_0x5bfb33];if(_[_0x0a9e('0x18')](_0x384319[_0x0a9e('0xb')][_0x1dc186['id']])){_0x384319[_0x0a9e('0xb')][_0x1dc186['id']]=new ChatQueue(_0x1dc186);}else{_0x384319[_0x0a9e('0x14')](_0x384319[_0x0a9e('0xb')][_0x1dc186['id']],_0x1dc186);}_0x384319['chatQueues'][_0x1dc186['id']][_0x0a9e('0x1b')]();_0x384319[_0x0a9e('0xb')][_0x1dc186['id']][_0x0a9e('0x1a')]();}}return _0x384319[_0x0a9e('0xb')];};};Realtime['prototype'][_0x0a9e('0x1c')]=function(){var _0x40e7a3=this;return function(_0x1843b2){if(_0x1843b2){freeIsNotKey(_0x1843b2,_0x40e7a3[_0x0a9e('0x1d')],'id');for(var _0x58b06f=0x0,_0x563b45={},_0x296f41={};_0x58b06f<_0x1843b2[_0x0a9e('0x17')];_0x58b06f+=0x1){_0x563b45=_0x1843b2[_0x58b06f];if(_[_0x0a9e('0x18')](_0x40e7a3['smsQueues'][_0x563b45['id']])){_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']]=new SmsQueue(_0x563b45);}else{_0x40e7a3['mergeFromDatabase'](_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']],_0x563b45);}_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']][_0x0a9e('0x1b')]();_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']][_0x0a9e('0x1a')]();}}return _0x40e7a3['smsQueues'];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x1e')]=function(){var _0x40cb85=this;return function(_0x2da5c0){if(_0x2da5c0){freeIsNotKey(_0x2da5c0,_0x40cb85[_0x0a9e('0x1f')],'id');for(var _0x409319=0x0,_0x332d35={},_0x39e565={};_0x409319<_0x2da5c0['length'];_0x409319+=0x1){_0x332d35=_0x2da5c0[_0x409319];if(_[_0x0a9e('0x18')](_0x40cb85['mailQueues'][_0x332d35['id']])){_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']]=new MailQueue(_0x332d35);}else{_0x40cb85[_0x0a9e('0x14')](_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']],_0x332d35);}_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']]['updateRouting']();_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']][_0x0a9e('0x1a')]();}}return _0x40cb85[_0x0a9e('0x1f')];};};Realtime[_0x0a9e('0x13')]['initFaxQueues']=function(){var _0x54135e=this;return function(_0x1e8694){if(_0x1e8694){freeIsNotKey(_0x1e8694,_0x54135e['faxQueues'],'id');for(var _0x24936a=0x0,_0x3d9717={},_0x381c37={};_0x24936a<_0x1e8694[_0x0a9e('0x17')];_0x24936a+=0x1){_0x3d9717=_0x1e8694[_0x24936a];if(_['isUndefined'](_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']])){_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']]=new FaxQueue(_0x3d9717);}else{_0x54135e[_0x0a9e('0x14')](_0x54135e['faxQueues'][_0x3d9717['id']],_0x3d9717);}_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']][_0x0a9e('0x1b')]();_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']]['updateRealtime']();}}return _0x54135e['faxQueues'];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x20')]=function(){var _0x5adda1=this;return function(_0x2b814e){if(_0x2b814e){freeIsNotKey(_0x2b814e,_0x5adda1[_0x0a9e('0x21')],'id');for(var _0x2e1b3a=0x0,_0x148f55={},_0x4b38d9={};_0x2e1b3a<_0x2b814e['length'];_0x2e1b3a+=0x1){_0x148f55=_0x2b814e[_0x2e1b3a];if(_[_0x0a9e('0x18')](_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']])){_0x5adda1['whatsappQueues'][_0x148f55['id']]=new WhatsappQueue(_0x148f55);}else{_0x5adda1[_0x0a9e('0x14')](_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']],_0x148f55);}_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']]['updateRouting']();_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']][_0x0a9e('0x1a')]();}}return _0x5adda1[_0x0a9e('0x21')];};};module[_0x0a9e('0x22')]=Realtime; \ No newline at end of file diff --git a/server/services/routing/rpc/chatInteraction.js b/server/services/routing/rpc/chatInteraction.js index e6da28a..a97cdac 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 _0xa27f=['addTags','AddTagsToChatInteraction','addTagsToChatInteraction','../client','Request','UpdateChatInteraction','updateChatInteraction'];(function(_0x1418b5,_0x3c92bf){var _0x4708f2=function(_0x3d9413){while(--_0x3d9413){_0x1418b5['push'](_0x1418b5['shift']());}};_0x4708f2(++_0x3c92bf);}(_0xa27f,0x14c));var _0xfa27=function(_0x10542c,_0x1001a4){_0x10542c=_0x10542c-0x0;var _0x2a468b=_0xa27f[_0x10542c];return _0x2a468b;};'use strict';var client=require(_0xfa27('0x0'));exports['update']=function(_0x434e60,_0x30abaa){return client[_0xfa27('0x1')](_0xfa27('0x2'),{'body':_0x30abaa,'options':{'where':{'id':_0x434e60}},'log':_0xfa27('0x3')});};exports[_0xfa27('0x4')]=function(_0x39d234,_0x584dba){return client['Request'](_0xfa27('0x5'),{'body':_0x584dba,'options':{'where':{'id':_0x39d234}},'log':_0xfa27('0x6')});}; \ No newline at end of file +var _0xc859=['UpdateChatInteraction','updateChatInteraction','addTags','Request','AddTagsToChatInteraction','../client','update'];(function(_0x2207fc,_0x424044){var _0x3d7025=function(_0x43ccb9){while(--_0x43ccb9){_0x2207fc['push'](_0x2207fc['shift']());}};_0x3d7025(++_0x424044);}(_0xc859,0x1c5));var _0x9c85=function(_0x4d07cc,_0x587613){_0x4d07cc=_0x4d07cc-0x0;var _0x42de3b=_0xc859[_0x4d07cc];return _0x42de3b;};'use strict';var client=require(_0x9c85('0x0'));exports[_0x9c85('0x1')]=function(_0x38f2c,_0x57b49f){return client['Request'](_0x9c85('0x2'),{'body':_0x57b49f,'options':{'where':{'id':_0x38f2c}},'log':_0x9c85('0x3')});};exports[_0x9c85('0x4')]=function(_0xc5806f,_0x67a59){return client[_0x9c85('0x5')](_0x9c85('0x6'),{'body':_0x67a59,'options':{'where':{'id':_0xc5806f}},'log':'addTagsToChatInteraction'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatMessage.js b/server/services/routing/rpc/chatMessage.js index 7b37004..d7d3e9b 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 _0xa5da=['CreateChatMessage','createChatMessage','../client','create','Request'];(function(_0xc5a279,_0x155360){var _0xc755d3=function(_0x15051c){while(--_0x15051c){_0xc5a279['push'](_0xc5a279['shift']());}};_0xc755d3(++_0x155360);}(_0xa5da,0x1bf));var _0xaa5d=function(_0x1cdc0c,_0x29b3e7){_0x1cdc0c=_0x1cdc0c-0x0;var _0x4e659d=_0xa5da[_0x1cdc0c];return _0x4e659d;};'use strict';var client=require(_0xaa5d('0x0'));exports[_0xaa5d('0x1')]=function(_0x33c867){return client[_0xaa5d('0x2')](_0xaa5d('0x3'),{'body':_0x33c867,'log':_0xaa5d('0x4')});}; \ No newline at end of file +var _0x94a5=['CreateChatMessage'];(function(_0x57cd19,_0x376ac7){var _0x21ea00=function(_0x1b6c98){while(--_0x1b6c98){_0x57cd19['push'](_0x57cd19['shift']());}};_0x21ea00(++_0x376ac7);}(_0x94a5,0x166));var _0x594a=function(_0x1babed,_0x3ed74b){_0x1babed=_0x1babed-0x0;var _0x4e9b0a=_0x94a5[_0x1babed];return _0x4e9b0a;};'use strict';var client=require('../client');exports['create']=function(_0x329b7a){return client['Request'](_0x594a('0x0'),{'body':_0x329b7a,'log':'createChatMessage'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueue.js b/server/services/routing/rpc/chatQueue.js index 8f08060..c2c4287 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 _0x1db9=['name','timeout','User','Agents','chatPause','../client','getChatQueues','Request','GetChatQueue'];(function(_0x173be0,_0x208005){var _0x15dc3f=function(_0x14a12c){while(--_0x14a12c){_0x173be0['push'](_0x173be0['shift']());}};_0x15dc3f(++_0x208005);}(_0x1db9,0x176));var _0x91db=function(_0x5110f2,_0x24a600){_0x5110f2=_0x5110f2-0x0;var _0x3743a2=_0x1db9[_0x5110f2];return _0x3743a2;};'use strict';var client=require(_0x91db('0x0'));exports[_0x91db('0x1')]=function(){return function(){return client[_0x91db('0x2')](_0x91db('0x3'),{'options':{'raw':![],'attributes':['id',_0x91db('0x4'),_0x91db('0x5'),'strategy'],'include':[{'model':_0x91db('0x6'),'as':_0x91db('0x7'),'attributes':['id','name','online',_0x91db('0x8')]}]},'log':'getChatQueues'});};}; \ No newline at end of file +var _0x1052=['strategy','User','Agents','chatPause','../client','getChatQueues','Request','GetChatQueue','name','timeout'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x1052,0xf4));var _0x2105=function(_0x3c9741,_0x557e3d){_0x3c9741=_0x3c9741-0x0;var _0x72aa01=_0x1052[_0x3c9741];return _0x72aa01;};'use strict';var client=require(_0x2105('0x0'));exports[_0x2105('0x1')]=function(){return function(){return client[_0x2105('0x2')](_0x2105('0x3'),{'options':{'raw':![],'attributes':['id',_0x2105('0x4'),_0x2105('0x5'),_0x2105('0x6')],'include':[{'model':_0x2105('0x7'),'as':_0x2105('0x8'),'attributes':['id','name','online',_0x2105('0x9')]}]},'log':'getChatQueues'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueueReport.js b/server/services/routing/rpc/chatQueueReport.js index c808012..65deb8b 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 _0x87f8=['update','UpdateChatQueueReport','DESC','Request','CreateChatQueueReport'];(function(_0x525b28,_0x5cf5a0){var _0x180178=function(_0x43e066){while(--_0x43e066){_0x525b28['push'](_0x525b28['shift']());}};_0x180178(++_0x5cf5a0);}(_0x87f8,0x152));var _0x887f=function(_0xa53285,_0xd34aae){_0xa53285=_0xa53285-0x0;var _0x5f30f6=_0x87f8[_0xa53285];return _0x5f30f6;};'use strict';var client=require('../client');exports['create']=function(_0x52e3a6){return client[_0x887f('0x0')](_0x887f('0x1'),{'body':_0x52e3a6,'log':'CreateChatQueueReport'});};exports[_0x887f('0x2')]=function(_0x591ca0,_0x46a51e){return client[_0x887f('0x0')](_0x887f('0x3'),{'body':_0x46a51e,'options':{'where':{'uniqueid':_0x591ca0},'order':[['id',_0x887f('0x4')]],'limit':0x1},'log':'UpdateChatQueueReport'});}; \ No newline at end of file +var _0x9d02=['update','Request','UpdateChatQueueReport','DESC','../client','CreateChatQueueReport'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x9d02,0x118));var _0x29d0=function(_0x10fe31,_0x51c669){_0x10fe31=_0x10fe31-0x0;var _0x72eb43=_0x9d02[_0x10fe31];return _0x72eb43;};'use strict';var client=require(_0x29d0('0x0'));exports['create']=function(_0x38b711){return client['Request'](_0x29d0('0x1'),{'body':_0x38b711,'log':'CreateChatQueueReport'});};exports[_0x29d0('0x2')]=function(_0x13171d,_0x58e99e){return client[_0x29d0('0x3')](_0x29d0('0x4'),{'body':_0x58e99e,'options':{'where':{'uniqueid':_0x13171d},'order':[['id',_0x29d0('0x5')]],'limit':0x1},'log':'UpdateChatQueueReport'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxInteraction.js b/server/services/routing/rpc/faxInteraction.js index aa8688c..e7024fa 100644 --- a/server/services/routing/rpc/faxInteraction.js +++ b/server/services/routing/rpc/faxInteraction.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['Request','AddTagsToFaxInteraction','addTagsToFaxInteraction','../client','update','UpdateFaxInteraction','updateFaxInteraction','addTags'];(function(_0x29cd56,_0x4cb885){var _0x1512b7=function(_0x5cd8ed){while(--_0x5cd8ed){_0x29cd56['push'](_0x29cd56['shift']());}};_0x1512b7(++_0x4cb885);}(_0x9957,0x93));var _0x7995=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x9957[_0x1facfa];return _0x9ec701;};'use strict';var client=require(_0x7995('0x0'));exports[_0x7995('0x1')]=function(_0x2722a3,_0x10a05d){return client['Request'](_0x7995('0x2'),{'body':_0x10a05d,'options':{'where':{'id':_0x2722a3}},'log':_0x7995('0x3')});};exports[_0x7995('0x4')]=function(_0x462a03,_0x576d89){return client[_0x7995('0x5')](_0x7995('0x6'),{'body':_0x576d89,'options':{'where':{'id':_0x462a03}},'log':_0x7995('0x7')});}; \ No newline at end of file +var _0x9957=['Request','AddTagsToFaxInteraction','addTagsToFaxInteraction','../client','update','UpdateFaxInteraction','updateFaxInteraction','addTags'];(function(_0x9ad1e1,_0x375db7){var _0x5da13d=function(_0x4f1556){while(--_0x4f1556){_0x9ad1e1['push'](_0x9ad1e1['shift']());}};_0x5da13d(++_0x375db7);}(_0x9957,0x93));var _0x7995=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x9957[_0x4cf98e];return _0x1623ac;};'use strict';var client=require(_0x7995('0x0'));exports[_0x7995('0x1')]=function(_0x2722a3,_0x10a05d){return client['Request'](_0x7995('0x2'),{'body':_0x10a05d,'options':{'where':{'id':_0x2722a3}},'log':_0x7995('0x3')});};exports[_0x7995('0x4')]=function(_0x462a03,_0x576d89){return client[_0x7995('0x5')](_0x7995('0x6'),{'body':_0x576d89,'options':{'where':{'id':_0x462a03}},'log':_0x7995('0x7')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxMessage.js b/server/services/routing/rpc/faxMessage.js index 4e5072c..88d8694 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 _0xbff8=['Request','CreateFaxMessage','createFaxMessage','../client'];(function(_0x3a21c0,_0x348451){var _0x411e84=function(_0xdd7b02){while(--_0xdd7b02){_0x3a21c0['push'](_0x3a21c0['shift']());}};_0x411e84(++_0x348451);}(_0xbff8,0xdf));var _0x8bff=function(_0x2dbcd7,_0x34005c){_0x2dbcd7=_0x2dbcd7-0x0;var _0x44cb66=_0xbff8[_0x2dbcd7];return _0x44cb66;};'use strict';var client=require(_0x8bff('0x0'));exports['create']=function(_0x50eaae){return client[_0x8bff('0x1')](_0x8bff('0x2'),{'body':_0x50eaae,'log':_0x8bff('0x3')});}; \ No newline at end of file +var _0x9f7e=['CreateFaxMessage','../client','create','Request'];(function(_0x40be86,_0x68fe5d){var _0xda3c3b=function(_0x39deab){while(--_0x39deab){_0x40be86['push'](_0x40be86['shift']());}};_0xda3c3b(++_0x68fe5d);}(_0x9f7e,0xe5));var _0xe9f7=function(_0x2d7150,_0x1d32ed){_0x2d7150=_0x2d7150-0x0;var _0x4976e0=_0x9f7e[_0x2d7150];return _0x4976e0;};'use strict';var client=require(_0xe9f7('0x0'));exports[_0xe9f7('0x1')]=function(_0x2ceb26){return client[_0xe9f7('0x2')](_0xe9f7('0x3'),{'body':_0x2ceb26,'log':'createFaxMessage'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueue.js b/server/services/routing/rpc/faxQueue.js index 4166d38..d74f55f 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 _0xcb76=['Agents','name','online','faxPause','getFaxQueues','Request','GetFaxQueue','timeout','strategy','User'];(function(_0x5a7420,_0x4e5cb5){var _0x3dc1bb=function(_0x210570){while(--_0x210570){_0x5a7420['push'](_0x5a7420['shift']());}};_0x3dc1bb(++_0x4e5cb5);}(_0xcb76,0x11c));var _0x6cb7=function(_0x125ff8,_0x41925f){_0x125ff8=_0x125ff8-0x0;var _0x2d9ef=_0xcb76[_0x125ff8];return _0x2d9ef;};'use strict';var client=require('../client');exports[_0x6cb7('0x0')]=function(){return function(){return client[_0x6cb7('0x1')](_0x6cb7('0x2'),{'options':{'raw':![],'attributes':['id','name',_0x6cb7('0x3'),_0x6cb7('0x4')],'include':[{'model':_0x6cb7('0x5'),'as':_0x6cb7('0x6'),'attributes':['id',_0x6cb7('0x7'),_0x6cb7('0x8'),_0x6cb7('0x9')]}]},'log':'getFaxQueues'});};}; \ No newline at end of file +var _0xbe44=['timeout','online','getFaxQueues','Request','GetFaxQueue','name'];(function(_0x1f2d6f,_0x2fff33){var _0x573615=function(_0x292845){while(--_0x292845){_0x1f2d6f['push'](_0x1f2d6f['shift']());}};_0x573615(++_0x2fff33);}(_0xbe44,0x1e8));var _0x4be4=function(_0x5b04a3,_0xfda4fd){_0x5b04a3=_0x5b04a3-0x0;var _0x1adf11=_0xbe44[_0x5b04a3];return _0x1adf11;};'use strict';var client=require('../client');exports[_0x4be4('0x0')]=function(){return function(){return client[_0x4be4('0x1')](_0x4be4('0x2'),{'options':{'raw':![],'attributes':['id',_0x4be4('0x3'),_0x4be4('0x4'),'strategy'],'include':[{'model':'User','as':'Agents','attributes':['id','name',_0x4be4('0x5'),'faxPause']}]},'log':_0x4be4('0x0')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueueReport.js b/server/services/routing/rpc/faxQueueReport.js index cbdc84b..b1049de 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 _0xc885=['../client','create','CreateFaxQueueReport','update','Request','UpdateFaxQueueReport','DESC'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xc885,0xfc));var _0x5c88=function(_0x597b4f,_0x2cf4b1){_0x597b4f=_0x597b4f-0x0;var _0x20a53b=_0xc885[_0x597b4f];return _0x20a53b;};'use strict';var client=require(_0x5c88('0x0'));exports[_0x5c88('0x1')]=function(_0x148228){return client['Request'](_0x5c88('0x2'),{'body':_0x148228,'log':'CreateFaxQueueReport'});};exports[_0x5c88('0x3')]=function(_0x5b6ec5,_0x335e08){return client[_0x5c88('0x4')](_0x5c88('0x5'),{'body':_0x335e08,'options':{'where':{'uniqueid':_0x5b6ec5},'order':[['id',_0x5c88('0x6')]],'limit':0x1},'log':'UpdateFaxQueueReport'});}; \ No newline at end of file +var _0xea30=['UpdateFaxQueueReport','DESC','../client','Request','CreateFaxQueueReport','update'];(function(_0x11b92e,_0x382de4){var _0xde41c2=function(_0x20d2cd){while(--_0x20d2cd){_0x11b92e['push'](_0x11b92e['shift']());}};_0xde41c2(++_0x382de4);}(_0xea30,0xc2));var _0x0ea3=function(_0x4bcb0d,_0x389a59){_0x4bcb0d=_0x4bcb0d-0x0;var _0x5b41c5=_0xea30[_0x4bcb0d];return _0x5b41c5;};'use strict';var client=require(_0x0ea3('0x0'));exports['create']=function(_0x356822){return client[_0x0ea3('0x1')](_0x0ea3('0x2'),{'body':_0x356822,'log':'CreateFaxQueueReport'});};exports[_0x0ea3('0x3')]=function(_0x345630,_0x4f037e){return client[_0x0ea3('0x1')](_0x0ea3('0x4'),{'body':_0x4f037e,'options':{'where':{'uniqueid':_0x345630},'order':[['id',_0x0ea3('0x5')]],'limit':0x1},'log':_0x0ea3('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/interval.js b/server/services/routing/rpc/interval.js index f21e1f7..afbfcff 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 _0xfea2=['GetInterval','name','Interval','Intervals','interval','../client','getIntervals'];(function(_0x29172f,_0x18cca6){var _0x2d9b04=function(_0x19d302){while(--_0x19d302){_0x29172f['push'](_0x29172f['shift']());}};_0x2d9b04(++_0x18cca6);}(_0xfea2,0x155));var _0x2fea=function(_0x371ffc,_0x361b2d){_0x371ffc=_0x371ffc-0x0;var _0x3fa4d3=_0xfea2[_0x371ffc];return _0x3fa4d3;};'use strict';var client=require(_0x2fea('0x0'));exports[_0x2fea('0x1')]=function(){return function(){return client['Request'](_0x2fea('0x2'),{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id',_0x2fea('0x3')],'include':[{'model':_0x2fea('0x4'),'as':_0x2fea('0x5'),'attributes':['id','name',_0x2fea('0x6')]}]},'log':_0x2fea('0x1')});};}; \ No newline at end of file +var _0xa1d2=['Request','GetInterval','name','Interval','Intervals','interval','../client','getIntervals'];(function(_0x384bbe,_0x1fb31d){var _0x49e066=function(_0x552b87){while(--_0x552b87){_0x384bbe['push'](_0x384bbe['shift']());}};_0x49e066(++_0x1fb31d);}(_0xa1d2,0x10e));var _0x2a1d=function(_0x5c7dea,_0x460e53){_0x5c7dea=_0x5c7dea-0x0;var _0x3975fb=_0xa1d2[_0x5c7dea];return _0x3975fb;};'use strict';var client=require(_0x2a1d('0x0'));exports[_0x2a1d('0x1')]=function(){return function(){return client[_0x2a1d('0x2')](_0x2a1d('0x3'),{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id',_0x2a1d('0x4')],'include':[{'model':_0x2a1d('0x5'),'as':_0x2a1d('0x6'),'attributes':['id',_0x2a1d('0x4'),_0x2a1d('0x7')]}]},'log':_0x2a1d('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailInteraction.js b/server/services/routing/rpc/mailInteraction.js index 296016c..892a3b1 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 _0xadb5=['Request','UpdateMailInteraction','addTags','AddTagsToMailInteraction','addTagsToChatInteraction','update'];(function(_0x6228e9,_0x9490cb){var _0x343f7f=function(_0x386ef7){while(--_0x386ef7){_0x6228e9['push'](_0x6228e9['shift']());}};_0x343f7f(++_0x9490cb);}(_0xadb5,0xad));var _0x5adb=function(_0x263dbe,_0x1ff858){_0x263dbe=_0x263dbe-0x0;var _0xeef9a8=_0xadb5[_0x263dbe];return _0xeef9a8;};'use strict';var client=require('../client');exports[_0x5adb('0x0')]=function(_0x49fc17,_0x3d6340){return client[_0x5adb('0x1')](_0x5adb('0x2'),{'body':_0x3d6340,'options':{'where':{'id':_0x49fc17}},'log':'updateMailInteraction'});};exports[_0x5adb('0x3')]=function(_0x31457,_0x2e3ef4){return client['Request'](_0x5adb('0x4'),{'body':_0x2e3ef4,'options':{'where':{'id':_0x31457}},'log':_0x5adb('0x5')});}; \ No newline at end of file +var _0x896e=['update','Request','UpdateMailInteraction','updateMailInteraction','addTags','AddTagsToMailInteraction','../client'];(function(_0x2c7618,_0x26be9c){var _0x5ce3f0=function(_0x1837b3){while(--_0x1837b3){_0x2c7618['push'](_0x2c7618['shift']());}};_0x5ce3f0(++_0x26be9c);}(_0x896e,0x1e9));var _0xe896=function(_0x470933,_0x4a87b4){_0x470933=_0x470933-0x0;var _0x4354f9=_0x896e[_0x470933];return _0x4354f9;};'use strict';var client=require(_0xe896('0x0'));exports[_0xe896('0x1')]=function(_0x3feebe,_0x229b59){return client[_0xe896('0x2')](_0xe896('0x3'),{'body':_0x229b59,'options':{'where':{'id':_0x3feebe}},'log':_0xe896('0x4')});};exports[_0xe896('0x5')]=function(_0x3f85e5,_0x2d3521){return client[_0xe896('0x2')](_0xe896('0x6'),{'body':_0x2d3521,'options':{'where':{'id':_0x3f85e5}},'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 ae039a1..81a0da0 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 _0x3743=['createMailMessage','../client','create','CreateMailMessage'];(function(_0x1ce7d8,_0x1b1c3b){var _0x36ecea=function(_0x3c48e3){while(--_0x3c48e3){_0x1ce7d8['push'](_0x1ce7d8['shift']());}};_0x36ecea(++_0x1b1c3b);}(_0x3743,0x159));var _0x3374=function(_0x1ae491,_0x5b83b9){_0x1ae491=_0x1ae491-0x0;var _0x4958a5=_0x3743[_0x1ae491];return _0x4958a5;};'use strict';var client=require(_0x3374('0x0'));exports[_0x3374('0x1')]=function(_0x24cdd7){return client['Request'](_0x3374('0x2'),{'body':_0x24cdd7,'log':_0x3374('0x3')});}; \ No newline at end of file +var _0x8230=['create','CreateMailMessage','createMailMessage','../client'];(function(_0x423097,_0x8a09f4){var _0x3a73f1=function(_0x9314f0){while(--_0x9314f0){_0x423097['push'](_0x423097['shift']());}};_0x3a73f1(++_0x8a09f4);}(_0x8230,0x137));var _0x0823=function(_0x1de3ce,_0x57c0ad){_0x1de3ce=_0x1de3ce-0x0;var _0x669651=_0x8230[_0x1de3ce];return _0x669651;};'use strict';var client=require(_0x0823('0x0'));exports[_0x0823('0x1')]=function(_0x4063e7){return client['Request'](_0x0823('0x2'),{'body':_0x4063e7,'log':_0x0823('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueue.js b/server/services/routing/rpc/mailQueue.js index bcfe771..0efe2ad 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 _0xfcf2=['name','strategy','online','getMailQueues','../client','Request'];(function(_0x3eb1d0,_0x3a94eb){var _0x593715=function(_0x2e3909){while(--_0x2e3909){_0x3eb1d0['push'](_0x3eb1d0['shift']());}};_0x593715(++_0x3a94eb);}(_0xfcf2,0x1a2));var _0x2fcf=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xfcf2[_0x20a584];return _0x4b41a8;};'use strict';var client=require(_0x2fcf('0x0'));exports['getMailQueues']=function(){return function(){return client[_0x2fcf('0x1')]('GetMailQueue',{'options':{'raw':![],'attributes':['id',_0x2fcf('0x2'),'timeout',_0x2fcf('0x3')],'include':[{'model':'User','as':'Agents','attributes':['id',_0x2fcf('0x2'),_0x2fcf('0x4'),'mailPause']}]},'log':_0x2fcf('0x5')});};}; \ No newline at end of file +var _0x401d=['GetMailQueue','name','strategy','User','Agents','online','mailPause','../client','getMailQueues','Request'];(function(_0x4b95bb,_0x24ca5c){var _0x5bc320=function(_0x122f7b){while(--_0x122f7b){_0x4b95bb['push'](_0x4b95bb['shift']());}};_0x5bc320(++_0x24ca5c);}(_0x401d,0x1c9));var _0xd401=function(_0x1b3505,_0x5a33a5){_0x1b3505=_0x1b3505-0x0;var _0x5936ae=_0x401d[_0x1b3505];return _0x5936ae;};'use strict';var client=require(_0xd401('0x0'));exports[_0xd401('0x1')]=function(){return function(){return client[_0xd401('0x2')](_0xd401('0x3'),{'options':{'raw':![],'attributes':['id',_0xd401('0x4'),'timeout',_0xd401('0x5')],'include':[{'model':_0xd401('0x6'),'as':_0xd401('0x7'),'attributes':['id',_0xd401('0x4'),_0xd401('0x8'),_0xd401('0x9')]}]},'log':'getMailQueues'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueueReport.js b/server/services/routing/rpc/mailQueueReport.js index 00cf5d6..c06d220 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 _0x53b2=['Request','UpdateMailQueueReport','../client','create','CreateMailQueueReport'];(function(_0x39daef,_0x25e8b5){var _0x2e0447=function(_0x2934d8){while(--_0x2934d8){_0x39daef['push'](_0x39daef['shift']());}};_0x2e0447(++_0x25e8b5);}(_0x53b2,0x138));var _0x253b=function(_0x4b0bbc,_0x3855f7){_0x4b0bbc=_0x4b0bbc-0x0;var _0x4a641c=_0x53b2[_0x4b0bbc];return _0x4a641c;};'use strict';var client=require(_0x253b('0x0'));exports[_0x253b('0x1')]=function(_0x4cccf2){return client['Request'](_0x253b('0x2'),{'body':_0x4cccf2,'log':'CreateMailQueueReport'});};exports['update']=function(_0x574042,_0x31abdb){return client[_0x253b('0x3')]('UpdateMailQueueReport',{'body':_0x31abdb,'options':{'where':{'uniqueid':_0x574042},'order':[['id','DESC']],'limit':0x1},'log':_0x253b('0x4')});}; \ No newline at end of file +var _0x8548=['create','Request','CreateMailQueueReport','update','UpdateMailQueueReport','../client'];(function(_0x658a4c,_0x1f2c66){var _0x3e7d40=function(_0x3d387b){while(--_0x3d387b){_0x658a4c['push'](_0x658a4c['shift']());}};_0x3e7d40(++_0x1f2c66);}(_0x8548,0x155));var _0x8854=function(_0x3a47c7,_0x416b17){_0x3a47c7=_0x3a47c7-0x0;var _0x9b7d65=_0x8548[_0x3a47c7];return _0x9b7d65;};'use strict';var client=require(_0x8854('0x0'));exports[_0x8854('0x1')]=function(_0x363a4b){return client[_0x8854('0x2')](_0x8854('0x3'),{'body':_0x363a4b,'log':'CreateMailQueueReport'});};exports[_0x8854('0x4')]=function(_0x4fd420,_0x560dd8){return client[_0x8854('0x2')](_0x8854('0x5'),{'body':_0x560dd8,'options':{'where':{'uniqueid':_0x4fd420},'order':[['id','DESC']],'limit':0x1},'log':_0x8854('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelInteraction.js b/server/services/routing/rpc/openchannelInteraction.js index 97ff7b9..50c369d 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 _0xac8c=['AddTagsToOpenchannelInteraction','Request','addTags'];(function(_0x5bd935,_0xc4909b){var _0x314efc=function(_0x143c34){while(--_0x143c34){_0x5bd935['push'](_0x5bd935['shift']());}};_0x314efc(++_0xc4909b);}(_0xac8c,0xd6));var _0xcac8=function(_0x36d703,_0x55b354){_0x36d703=_0x36d703-0x0;var _0x12c909=_0xac8c[_0x36d703];return _0x12c909;};'use strict';var client=require('../client');exports['update']=function(_0x576bf4,_0xe43da6){return client[_0xcac8('0x0')]('UpdateOpenchannelInteraction',{'body':_0xe43da6,'options':{'where':{'id':_0x576bf4}},'log':'updateOpenchannelInteraction'});};exports[_0xcac8('0x1')]=function(_0x5e3e6b,_0x253578){return client['Request'](_0xcac8('0x2'),{'body':_0x253578,'options':{'where':{'id':_0x5e3e6b}},'log':'addTagsToChatInteraction'});}; \ No newline at end of file +var _0x55e7=['addTagsToChatInteraction','../client','update','Request','UpdateOpenchannelInteraction','updateOpenchannelInteraction','AddTagsToOpenchannelInteraction'];(function(_0x3b25f7,_0x305c1e){var _0x36988e=function(_0x339b6e){while(--_0x339b6e){_0x3b25f7['push'](_0x3b25f7['shift']());}};_0x36988e(++_0x305c1e);}(_0x55e7,0xa2));var _0x755e=function(_0xcec27,_0x1fcf1a){_0xcec27=_0xcec27-0x0;var _0x110f9c=_0x55e7[_0xcec27];return _0x110f9c;};'use strict';var client=require(_0x755e('0x0'));exports[_0x755e('0x1')]=function(_0x13d05c,_0x182001){return client[_0x755e('0x2')](_0x755e('0x3'),{'body':_0x182001,'options':{'where':{'id':_0x13d05c}},'log':_0x755e('0x4')});};exports['addTags']=function(_0x478ee6,_0x39da46){return client[_0x755e('0x2')](_0x755e('0x5'),{'body':_0x39da46,'options':{'where':{'id':_0x478ee6}},'log':_0x755e('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelMessage.js b/server/services/routing/rpc/openchannelMessage.js index 3567846..e944f45 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 _0x5055=['createOpenchannelMessage','../client','CreateOpenchannelMessage'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x5055,0x97));var _0x5505=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5055[_0x3dd15e];return _0x231fd0;};'use strict';var client=require(_0x5505('0x0'));exports['create']=function(_0x36e592){return client['Request'](_0x5505('0x1'),{'body':_0x36e592,'log':_0x5505('0x2')});}; \ No newline at end of file +var _0x6bba=['CreateOpenchannelMessage','createOpenchannelMessage','../client'];(function(_0x3cc96f,_0x4b41e5){var _0x43a2c0=function(_0x55ca2c){while(--_0x55ca2c){_0x3cc96f['push'](_0x3cc96f['shift']());}};_0x43a2c0(++_0x4b41e5);}(_0x6bba,0x194));var _0xa6bb=function(_0x1c1798,_0x24812b){_0x1c1798=_0x1c1798-0x0;var _0x4f235e=_0x6bba[_0x1c1798];return _0x4f235e;};'use strict';var client=require(_0xa6bb('0x0'));exports['create']=function(_0x289210){return client['Request'](_0xa6bb('0x1'),{'body':_0x289210,'log':_0xa6bb('0x2')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueue.js b/server/services/routing/rpc/openchannelQueue.js index 59637c0..30d5ead 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 _0x67ae=['GetOpenchannelQueue','name','timeout','User','online','openchannelPause','getOpenchannelQueues','Request'];(function(_0x45cfc3,_0x48abd5){var _0x338cd6=function(_0x84af01){while(--_0x84af01){_0x45cfc3['push'](_0x45cfc3['shift']());}};_0x338cd6(++_0x48abd5);}(_0x67ae,0xbe));var _0xe67a=function(_0x182def,_0x49c59f){_0x182def=_0x182def-0x0;var _0x2c4caf=_0x67ae[_0x182def];return _0x2c4caf;};'use strict';var client=require('../client');exports[_0xe67a('0x0')]=function(){return function(){return client[_0xe67a('0x1')](_0xe67a('0x2'),{'options':{'raw':![],'attributes':['id',_0xe67a('0x3'),_0xe67a('0x4'),'strategy'],'include':[{'model':_0xe67a('0x5'),'as':'Agents','attributes':['id',_0xe67a('0x3'),_0xe67a('0x6'),_0xe67a('0x7')]}]},'log':_0xe67a('0x0')});};}; \ No newline at end of file +var _0xd506=['online','openchannelPause','../client','getOpenchannelQueues','GetOpenchannelQueue','User','name'];(function(_0x306a91,_0x3f288f){var _0xe1e52a=function(_0xd097ea){while(--_0xd097ea){_0x306a91['push'](_0x306a91['shift']());}};_0xe1e52a(++_0x3f288f);}(_0xd506,0x11a));var _0x6d50=function(_0xaa0309,_0x1c8008){_0xaa0309=_0xaa0309-0x0;var _0x5de7ce=_0xd506[_0xaa0309];return _0x5de7ce;};'use strict';var client=require(_0x6d50('0x0'));exports[_0x6d50('0x1')]=function(){return function(){return client['Request'](_0x6d50('0x2'),{'options':{'raw':![],'attributes':['id','name','timeout','strategy'],'include':[{'model':_0x6d50('0x3'),'as':'Agents','attributes':['id',_0x6d50('0x4'),_0x6d50('0x5'),_0x6d50('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 c330c9c..2f6c716 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 _0x1a58=['update','Request','UpdateOpenchannelQueueReport','../client','CreateOpenchannelQueueReport'];(function(_0x362035,_0x2e444e){var _0x88f8b6=function(_0x17cc18){while(--_0x17cc18){_0x362035['push'](_0x362035['shift']());}};_0x88f8b6(++_0x2e444e);}(_0x1a58,0x1b6));var _0x81a5=function(_0x388146,_0x3daa4a){_0x388146=_0x388146-0x0;var _0x5edd1f=_0x1a58[_0x388146];return _0x5edd1f;};'use strict';var client=require(_0x81a5('0x0'));exports['create']=function(_0x5e28a6){return client['Request'](_0x81a5('0x1'),{'body':_0x5e28a6,'log':_0x81a5('0x1')});};exports[_0x81a5('0x2')]=function(_0x22aa27,_0x2c324a){return client[_0x81a5('0x3')](_0x81a5('0x4'),{'body':_0x2c324a,'options':{'where':{'uniqueid':_0x22aa27},'order':[['id','DESC']],'limit':0x1},'log':_0x81a5('0x4')});}; \ No newline at end of file +var _0x88fa=['Request','CreateOpenchannelQueueReport','update','UpdateOpenchannelQueueReport','DESC','../client'];(function(_0x1cc8fe,_0x105328){var _0x230054=function(_0x1a1b56){while(--_0x1a1b56){_0x1cc8fe['push'](_0x1cc8fe['shift']());}};_0x230054(++_0x105328);}(_0x88fa,0x1d3));var _0xa88f=function(_0x18da3b,_0x5c3808){_0x18da3b=_0x18da3b-0x0;var _0x54806b=_0x88fa[_0x18da3b];return _0x54806b;};'use strict';var client=require(_0xa88f('0x0'));exports['create']=function(_0x3a9105){return client[_0xa88f('0x1')](_0xa88f('0x2'),{'body':_0x3a9105,'log':_0xa88f('0x2')});};exports[_0xa88f('0x3')]=function(_0x5be83c,_0x53a4e8){return client[_0xa88f('0x1')](_0xa88f('0x4'),{'body':_0x53a4e8,'options':{'where':{'uniqueid':_0x5be83c},'order':[['id',_0xa88f('0x5')]],'limit':0x1},'log':_0xa88f('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsInteraction.js b/server/services/routing/rpc/smsInteraction.js index 13bc3c3..0861524 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 _0xc569=['AddTagsToSmsInteraction','addTagsToSmsInteraction','../client','update','Request','UpdateSmsInteraction','addTags'];(function(_0x40a9dd,_0x118850){var _0x200037=function(_0x38197f){while(--_0x38197f){_0x40a9dd['push'](_0x40a9dd['shift']());}};_0x200037(++_0x118850);}(_0xc569,0x159));var _0x9c56=function(_0x1741f2,_0x1ffcd8){_0x1741f2=_0x1741f2-0x0;var _0x330bc8=_0xc569[_0x1741f2];return _0x330bc8;};'use strict';var client=require(_0x9c56('0x0'));exports[_0x9c56('0x1')]=function(_0x78e9ad,_0x5e6b42){return client[_0x9c56('0x2')](_0x9c56('0x3'),{'body':_0x5e6b42,'options':{'where':{'id':_0x78e9ad}},'log':'updateSmsInteraction'});};exports[_0x9c56('0x4')]=function(_0x24527a,_0x23402b){return client['Request'](_0x9c56('0x5'),{'body':_0x23402b,'options':{'where':{'id':_0x24527a}},'log':_0x9c56('0x6')});}; \ No newline at end of file +var _0x1247=['../client','update','Request','UpdateSmsInteraction','updateSmsInteraction','AddTagsToSmsInteraction','addTagsToSmsInteraction'];(function(_0x5ddb1c,_0x5ea4df){var _0x354adc=function(_0x2dfb1f){while(--_0x2dfb1f){_0x5ddb1c['push'](_0x5ddb1c['shift']());}};_0x354adc(++_0x5ea4df);}(_0x1247,0xb6));var _0x7124=function(_0x323d87,_0x4ef3f9){_0x323d87=_0x323d87-0x0;var _0x5e8f74=_0x1247[_0x323d87];return _0x5e8f74;};'use strict';var client=require(_0x7124('0x0'));exports[_0x7124('0x1')]=function(_0x498325,_0x4d37c0){return client[_0x7124('0x2')](_0x7124('0x3'),{'body':_0x4d37c0,'options':{'where':{'id':_0x498325}},'log':_0x7124('0x4')});};exports['addTags']=function(_0x3bdce3,_0x3ab32e){return client[_0x7124('0x2')](_0x7124('0x5'),{'body':_0x3ab32e,'options':{'where':{'id':_0x3bdce3}},'log':_0x7124('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsMessage.js b/server/services/routing/rpc/smsMessage.js index cba5f5f..ef54dc5 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 _0x73fe=['Request','create'];(function(_0xa0308,_0x2ef9cc){var _0x145297=function(_0x552bbe){while(--_0x552bbe){_0xa0308['push'](_0xa0308['shift']());}};_0x145297(++_0x2ef9cc);}(_0x73fe,0x1bd));var _0xe73f=function(_0x9667d,_0x1beba2){_0x9667d=_0x9667d-0x0;var _0x495d88=_0x73fe[_0x9667d];return _0x495d88;};'use strict';var client=require('../client');exports[_0xe73f('0x0')]=function(_0x39cad7){return client[_0xe73f('0x1')]('CreateSmsMessage',{'body':_0x39cad7,'log':'createSmsMessage'});}; \ No newline at end of file +var _0xfc62=['../client'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xfc62,0x1c4));var _0x2fc6=function(_0x18ab2a,_0x4debcd){_0x18ab2a=_0x18ab2a-0x0;var _0x16dcee=_0xfc62[_0x18ab2a];return _0x16dcee;};'use strict';var client=require(_0x2fc6('0x0'));exports['create']=function(_0xa1845f){return client['Request']('CreateSmsMessage',{'body':_0xa1845f,'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 5abd9cf..7e346cf 100644 --- a/server/services/routing/rpc/smsQueue.js +++ b/server/services/routing/rpc/smsQueue.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['Agents','online','smsPause','../client','getSmsQueues','Request','name','timeout','strategy','User'];(function(_0x26a287,_0x111002){var _0x41b86f=function(_0x36dbb9){while(--_0x36dbb9){_0x26a287['push'](_0x26a287['shift']());}};_0x41b86f(++_0x111002);}(_0xe706,0xa3));var _0x6e70=function(_0x3a87c1,_0x27326f){_0x3a87c1=_0x3a87c1-0x0;var _0x2117c2=_0xe706[_0x3a87c1];return _0x2117c2;};'use strict';var client=require(_0x6e70('0x0'));exports[_0x6e70('0x1')]=function(){return function(){return client[_0x6e70('0x2')]('GetSmsQueue',{'options':{'raw':![],'attributes':['id',_0x6e70('0x3'),_0x6e70('0x4'),_0x6e70('0x5')],'include':[{'model':_0x6e70('0x6'),'as':_0x6e70('0x7'),'attributes':['id',_0x6e70('0x3'),_0x6e70('0x8'),_0x6e70('0x9')]}]},'log':_0x6e70('0x1')});};}; \ No newline at end of file +var _0xe706=['Agents','online','smsPause','../client','getSmsQueues','Request','name','timeout','strategy','User'];(function(_0x1a987f,_0x2b1fd8){var _0x5382cb=function(_0x552bb2){while(--_0x552bb2){_0x1a987f['push'](_0x1a987f['shift']());}};_0x5382cb(++_0x2b1fd8);}(_0xe706,0xa3));var _0x6e70=function(_0x13b392,_0x3481f2){_0x13b392=_0x13b392-0x0;var _0x39db24=_0xe706[_0x13b392];return _0x39db24;};'use strict';var client=require(_0x6e70('0x0'));exports[_0x6e70('0x1')]=function(){return function(){return client[_0x6e70('0x2')]('GetSmsQueue',{'options':{'raw':![],'attributes':['id',_0x6e70('0x3'),_0x6e70('0x4'),_0x6e70('0x5')],'include':[{'model':_0x6e70('0x6'),'as':_0x6e70('0x7'),'attributes':['id',_0x6e70('0x3'),_0x6e70('0x8'),_0x6e70('0x9')]}]},'log':_0x6e70('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueueReport.js b/server/services/routing/rpc/smsQueueReport.js index 98d4734..f3965dd 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 _0x008c=['../client','create','Request','CreateSmsQueueReport','update','UpdateSmsQueueReport','DESC'];(function(_0x244a5f,_0x3652c3){var _0x115943=function(_0x3f21bc){while(--_0x3f21bc){_0x244a5f['push'](_0x244a5f['shift']());}};_0x115943(++_0x3652c3);}(_0x008c,0x188));var _0xc008=function(_0x283152,_0x468a35){_0x283152=_0x283152-0x0;var _0x6cb80d=_0x008c[_0x283152];return _0x6cb80d;};'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 +var _0xedd9=['create','Request','CreateSmsQueueReport','update','UpdateSmsQueueReport','DESC'];(function(_0x4706a6,_0x5a1c63){var _0x1bb705=function(_0x484ebb){while(--_0x484ebb){_0x4706a6['push'](_0x4706a6['shift']());}};_0x1bb705(++_0x5a1c63);}(_0xedd9,0xfc));var _0x9edd=function(_0x100066,_0x72dbf5){_0x100066=_0x100066-0x0;var _0x1c76c9=_0xedd9[_0x100066];return _0x1c76c9;};'use strict';var client=require('../client');exports[_0x9edd('0x0')]=function(_0x2d7989){return client[_0x9edd('0x1')](_0x9edd('0x2'),{'body':_0x2d7989,'log':_0x9edd('0x2')});};exports[_0x9edd('0x3')]=function(_0x3e6d3a,_0x36b53f){return client['Request'](_0x9edd('0x4'),{'body':_0x36b53f,'options':{'where':{'uniqueid':_0x3e6d3a},'order':[['id',_0x9edd('0x5')]],'limit':0x1},'log':_0x9edd('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/user.js b/server/services/routing/rpc/user.js index 1379151..a8c91db 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(_0x317ef7,_0x3edd1b){var _0x23da83=function(_0x18ee4e){while(--_0x18ee4e){_0x317ef7['push'](_0x317ef7['shift']());}};_0x23da83(++_0x3edd1b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2160a9,_0x3cbd9e){_0x2160a9=_0x2160a9-0x0;var _0xa88cf7=_0xa9e0[_0x2160a9];return _0xa88cf7;};'use strict';var client=require(_0x0a9e('0x0'));exports[_0x0a9e('0x1')]=function(){return function(){return client[_0x0a9e('0x2')]('GetUser',{'options':{'raw':!![],'where':{'role':'agent'},'attributes':['id',_0x0a9e('0x3'),'online',_0x0a9e('0x4'),_0x0a9e('0x5'),_0x0a9e('0x6'),_0x0a9e('0x7'),_0x0a9e('0x8'),'faxPause',_0x0a9e('0x9'),_0x0a9e('0xa'),_0x0a9e('0xb'),'chatCapacity','mailCapacity',_0x0a9e('0xc'),'smsCapacity','whatsappCapacity',_0x0a9e('0xd')]},'log':_0x0a9e('0x1')});};}; \ No newline at end of file +var _0xa9e0=['name','pauseType','lastPauseAt','voicePause','chatPause','mailPause','smsPause','whatsappPause','openchannelPause','faxCapacity','openchannelCapacity','../client','getAgents','Request'];(function(_0x25fe8e,_0x5811f0){var _0xe8d307=function(_0x17c596){while(--_0x17c596){_0x25fe8e['push'](_0x25fe8e['shift']());}};_0xe8d307(++_0x5811f0);}(_0xa9e0,0x123));var _0x0a9e=function(_0x37bd26,_0x5ad346){_0x37bd26=_0x37bd26-0x0;var _0xe83dc4=_0xa9e0[_0x37bd26];return _0xe83dc4;};'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 38d92e0..75deb9d 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 _0x90b5=['UpdateWhatsappInteraction','AddTagsToWhatsappInteraction','addTagsToWhatsappInteraction','../client','Request'];(function(_0x3070bd,_0x3ed386){var _0x424ee7=function(_0x3d4580){while(--_0x3d4580){_0x3070bd['push'](_0x3070bd['shift']());}};_0x424ee7(++_0x3ed386);}(_0x90b5,0x139));var _0x590b=function(_0x385bc1,_0x1328eb){_0x385bc1=_0x385bc1-0x0;var _0x34dc48=_0x90b5[_0x385bc1];return _0x34dc48;};'use strict';var client=require(_0x590b('0x0'));exports['update']=function(_0x3f8e11,_0xe39dc){return client[_0x590b('0x1')](_0x590b('0x2'),{'body':_0xe39dc,'options':{'where':{'id':_0x3f8e11}},'log':'updateWhatsappInteraction'});};exports['addTags']=function(_0x2318b8,_0x27e96f){return client['Request'](_0x590b('0x3'),{'body':_0x27e96f,'options':{'where':{'id':_0x2318b8}},'log':_0x590b('0x4')});}; \ No newline at end of file +var _0x4975=['addTags','AddTagsToWhatsappInteraction','../client','Request','UpdateWhatsappInteraction','updateWhatsappInteraction'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x4975,0x86));var _0x5497=function(_0x1639d8,_0x2732ca){_0x1639d8=_0x1639d8-0x0;var _0x4c397e=_0x4975[_0x1639d8];return _0x4c397e;};'use strict';var client=require(_0x5497('0x0'));exports['update']=function(_0x474989,_0x3f9e37){return client[_0x5497('0x1')](_0x5497('0x2'),{'body':_0x3f9e37,'options':{'where':{'id':_0x474989}},'log':_0x5497('0x3')});};exports[_0x5497('0x4')]=function(_0x14cecb,_0xeb31af){return client[_0x5497('0x1')](_0x5497('0x5'),{'body':_0xeb31af,'options':{'where':{'id':_0x14cecb}},'log':'addTagsToWhatsappInteraction'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappMessage.js b/server/services/routing/rpc/whatsappMessage.js index d579a98..157354a 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 _0xe856=['CreateWhatsappMessage','createWhatsappMessage'];(function(_0xc0f19a,_0x16c024){var _0x420d50=function(_0x50427a){while(--_0x50427a){_0xc0f19a['push'](_0xc0f19a['shift']());}};_0x420d50(++_0x16c024);}(_0xe856,0xdc));var _0x6e85=function(_0x4b055c,_0x4b870b){_0x4b055c=_0x4b055c-0x0;var _0x4b62bb=_0xe856[_0x4b055c];return _0x4b62bb;};'use strict';var client=require('../client');exports['create']=function(_0x347b4a){return client['Request'](_0x6e85('0x0'),{'body':_0x347b4a,'log':_0x6e85('0x1')});}; \ No newline at end of file +var _0xa5b0=['../client','create','Request','CreateWhatsappMessage','createWhatsappMessage'];(function(_0xf5b712,_0x5487bf){var _0x410413=function(_0x5209ce){while(--_0x5209ce){_0xf5b712['push'](_0xf5b712['shift']());}};_0x410413(++_0x5487bf);}(_0xa5b0,0xf0));var _0x0a5b=function(_0x53e19d,_0x604957){_0x53e19d=_0x53e19d-0x0;var _0x5ba332=_0xa5b0[_0x53e19d];return _0x5ba332;};'use strict';var client=require(_0x0a5b('0x0'));exports[_0x0a5b('0x1')]=function(_0x3043c3){return client[_0x0a5b('0x2')](_0x0a5b('0x3'),{'body':_0x3043c3,'log':_0x0a5b('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueue.js b/server/services/routing/rpc/whatsappQueue.js index cb9fc8c..62e6bb6 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 _0xc0e6=['GetWhatsappQueue','name','timeout','strategy','User','Agents','online','../client','getWhatsappQueues','Request'];(function(_0x445b7e,_0x3ea85f){var _0x17d997=function(_0x805f31){while(--_0x805f31){_0x445b7e['push'](_0x445b7e['shift']());}};_0x17d997(++_0x3ea85f);}(_0xc0e6,0x115));var _0x6c0e=function(_0x17406a,_0x1e2320){_0x17406a=_0x17406a-0x0;var _0x1501ff=_0xc0e6[_0x17406a];return _0x1501ff;};'use strict';var client=require(_0x6c0e('0x0'));exports[_0x6c0e('0x1')]=function(){return function(){return client[_0x6c0e('0x2')](_0x6c0e('0x3'),{'options':{'raw':![],'attributes':['id',_0x6c0e('0x4'),_0x6c0e('0x5'),_0x6c0e('0x6')],'include':[{'model':_0x6c0e('0x7'),'as':_0x6c0e('0x8'),'attributes':['id',_0x6c0e('0x4'),_0x6c0e('0x9'),'whatsappPause']}]},'log':'getWhatsappQueues'});};}; \ No newline at end of file +var _0xc407=['Request','GetWhatsappQueue','name','timeout','strategy','online','whatsappPause','getWhatsappQueues','../client'];(function(_0xd050c6,_0x58ffb4){var _0x7278a=function(_0x16d03e){while(--_0x16d03e){_0xd050c6['push'](_0xd050c6['shift']());}};_0x7278a(++_0x58ffb4);}(_0xc407,0xaa));var _0x7c40=function(_0x330414,_0x4f3207){_0x330414=_0x330414-0x0;var _0x99dbff=_0xc407[_0x330414];return _0x99dbff;};'use strict';var client=require(_0x7c40('0x0'));exports['getWhatsappQueues']=function(){return function(){return client[_0x7c40('0x1')](_0x7c40('0x2'),{'options':{'raw':![],'attributes':['id',_0x7c40('0x3'),_0x7c40('0x4'),_0x7c40('0x5')],'include':[{'model':'User','as':'Agents','attributes':['id',_0x7c40('0x3'),_0x7c40('0x6'),_0x7c40('0x7')]}]},'log':_0x7c40('0x8')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueueReport.js b/server/services/routing/rpc/whatsappQueueReport.js index a67b907..dcb11b8 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 _0x24bc=['DESC','UpdateWhatsappQueueReport','create','Request','CreateWhatsappQueueReport','update'];(function(_0x264545,_0x214037){var _0x114d10=function(_0x9e3461){while(--_0x9e3461){_0x264545['push'](_0x264545['shift']());}};_0x114d10(++_0x214037);}(_0x24bc,0xd4));var _0xc24b=function(_0x2509b9,_0x3d86e0){_0x2509b9=_0x2509b9-0x0;var _0x20b762=_0x24bc[_0x2509b9];return _0x20b762;};'use strict';var client=require('../client');exports[_0xc24b('0x0')]=function(_0x5e4d24){return client[_0xc24b('0x1')](_0xc24b('0x2'),{'body':_0x5e4d24,'log':_0xc24b('0x2')});};exports[_0xc24b('0x3')]=function(_0x235029,_0x3d091f){return client[_0xc24b('0x1')]('UpdateWhatsappQueueReport',{'body':_0x3d091f,'options':{'where':{'uniqueid':_0x235029},'order':[['id',_0xc24b('0x4')]],'limit':0x1},'log':_0xc24b('0x5')});}; \ No newline at end of file +var _0xc5dc=['DESC','UpdateWhatsappQueueReport','../client','create','Request','CreateWhatsappQueueReport','update'];(function(_0x3903df,_0x4fae4c){var _0x1a2ac5=function(_0x3fa0c4){while(--_0x3fa0c4){_0x3903df['push'](_0x3903df['shift']());}};_0x1a2ac5(++_0x4fae4c);}(_0xc5dc,0x9c));var _0xcc5d=function(_0xe42667,_0x3021e9){_0xe42667=_0xe42667-0x0;var _0x5567d1=_0xc5dc[_0xe42667];return _0x5567d1;};'use strict';var client=require(_0xcc5d('0x0'));exports[_0xcc5d('0x1')]=function(_0x21a2ca){return client[_0xcc5d('0x2')](_0xcc5d('0x3'),{'body':_0x21a2ca,'log':_0xcc5d('0x3')});};exports[_0xcc5d('0x4')]=function(_0x20a850,_0x5da5ba){return client[_0xcc5d('0x2')]('UpdateWhatsappQueueReport',{'body':_0x5da5ba,'options':{'where':{'uniqueid':_0x20a850},'order':[['id',_0xcc5d('0x5')]],'limit':0x1},'log':_0xcc5d('0x6')});}; \ 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 ca63c13..a65edba 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 _0xaaeb=['stack','validate','lodash','util','seq-queue','../../../../config/logger','routing','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number','info','format','[%s][AGENT][NAME:%s][STATUS:%s]','name','toLowerCase','consequence','length','error','map','message','join','timeout','createQueue','channel','rules','[%s][AGENT]\x20ROUTING\x20STOPPED','close','stop','complete','[%s][AGENT]\x20ROUTING\x20END','next','agent','[%s][QUEUE]\x20%s'];(function(_0x4abf64,_0x464409){var _0x1fbe4e=function(_0x337348){while(--_0x337348){_0x4abf64['push'](_0x4abf64['shift']());}};_0x1fbe4e(++_0x464409);}(_0xaaeb,0x177));var _0xbaae=function(_0x3a7db0,_0xe93c50){_0x3a7db0=_0x3a7db0-0x0;var _0x17cbba=_0xaaeb[_0x3a7db0];return _0x17cbba;};'use strict';var schema=require(_0xbaae('0x0'));var _=require(_0xbaae('0x1'));var util=require(_0xbaae('0x2'));var seqqueue=require(_0xbaae('0x3'));var logger=require(_0xbaae('0x4'))(_0xbaae('0x5'));var strategy=require('./strategy');var queue=schema({'name':{'type':_0xbaae('0x6'),'required':!![],'message':_0xbaae('0x7')},'timeout':{'type':_0xbaae('0x8'),'message':_0xbaae('0x9')}});function writeLog(_0x49032a,_0x318720,_0x592673){return logger[_0xbaae('0xa')](util[_0xbaae('0xb')](_0xbaae('0xc'),_0x49032a,_0x318720[_0xbaae('0xd')],_0x592673));}function handleFindAgent(_0x45a39d){return function(_0x431c3d){return _0x431c3d[_0xbaae('0xd')]['toLowerCase']()===_0x45a39d[_0xbaae('0xe')]();};}exports[_0xbaae('0xf')]=function(_0x5e3f12,_0x483f86,_0x3616f6,_0x40f782){return function(_0x3f75ad){try{var _0x5bf854={'name':_0x483f86[0x0],'timeout':_0x483f86[0x1]};var _0x2f55af=queue[_0xbaae('0x0')](_0x5bf854,{'typecast':!![]});if(_0x2f55af[_0xbaae('0x10')]){logger[_0xbaae('0x11')]('[%s][AGENT]\x20%s',_0x5e3f12,_[_0xbaae('0x12')](_0x2f55af,_0xbaae('0x13'))[_0xbaae('0x14')](',\x20'));_0x3f75ad['stop']();}else{var _0xb0e357=_['find'](_0x3616f6['agents'],handleFindAgent(_0x5bf854[_0xbaae('0xd')]));if(_0xb0e357){var _0x4c2974=(_0x5bf854[_0xbaae('0x15')]||0xa)*0x3e8;var _0x52357b,_0x184df8;var _0xde2a42=seqqueue[_0xbaae('0x16')](_0x4c2974);_0xde2a42['id']=_0x5e3f12;_0xde2a42['atimeout']=_0x4c2974;_0xde2a42[_0xbaae('0x17')]=_0x40f782['channel'];writeLog(_0x5e3f12,_0xb0e357,util['format']('START:%s',_0x4c2974));_0x3616f6[_0xbaae('0x18')][_0x5e3f12]['on']('end',function(){logger['info'](_0xbaae('0x19'),_0x5e3f12);clearTimeout(_0x184df8);_0x184df8=undefined;_0xde2a42[_0xbaae('0x1a')]();if(_0x3616f6[_0xbaae('0x18')][_0x5e3f12]){delete _0x3616f6[_0xbaae('0x18')][_0x5e3f12];}_0x3f75ad[_0xbaae('0x1b')]();});_0x3616f6[_0xbaae('0x18')][_0x5e3f12]['on'](_0xbaae('0x1c'),function(){if(_0x3616f6[_0xbaae('0x18')][_0x5e3f12]){delete _0x3616f6[_0xbaae('0x18')][_0x5e3f12];}});_0x184df8=setTimeout(function(){logger[_0xbaae('0xa')](_0xbaae('0x1d'),_0x5e3f12);clearTimeout(_0x184df8);_0xde2a42[_0xbaae('0x1a')]();_0x3f75ad[_0xbaae('0x1e')]();},_0x4c2974);strategy[_0xbaae('0x1f')](_0xde2a42,_0xb0e357,_0x3616f6,_0x40f782);}else{logger['error']('[%s][AGENT]\x20agent\x20not\x20found\x20%s',_0x5e3f12,_0x5bf854[_0xbaae('0xd')]);_0x3f75ad['stop']();}}}catch(_0x43853a){console['log'](_0x43853a);logger[_0xbaae('0x11')](_0xbaae('0x20'),_0x5e3f12,_0x43853a[_0xbaae('0x21')]);_0x3f75ad[_0xbaae('0x1b')]();}};}; \ No newline at end of file +var _0xee49=['stack','validate','lodash','seq-queue','../../../../config/logger','routing','./strategy','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','timeout\x20is\x20a\x20number','info','format','[%s][AGENT][NAME:%s][STATUS:%s]','name','toLowerCase','consequence','error','map','message','stop','find','agents','createQueue','channel','rules','end','[%s][AGENT]\x20ROUTING\x20STOPPED','close','complete','next','[%s][AGENT]\x20agent\x20not\x20found\x20%s','log'];(function(_0x34a063,_0xc906a6){var _0x1a7081=function(_0x1b01bd){while(--_0x1b01bd){_0x34a063['push'](_0x34a063['shift']());}};_0x1a7081(++_0xc906a6);}(_0xee49,0xe1));var _0x9ee4=function(_0x1d5476,_0x2f8795){_0x1d5476=_0x1d5476-0x0;var _0x4ac71f=_0xee49[_0x1d5476];return _0x4ac71f;};'use strict';var schema=require(_0x9ee4('0x0'));var _=require(_0x9ee4('0x1'));var util=require('util');var seqqueue=require(_0x9ee4('0x2'));var logger=require(_0x9ee4('0x3'))(_0x9ee4('0x4'));var strategy=require(_0x9ee4('0x5'));var queue=schema({'name':{'type':_0x9ee4('0x6'),'required':!![],'message':_0x9ee4('0x7')},'timeout':{'type':'number','message':_0x9ee4('0x8')}});function writeLog(_0x2f8dfc,_0x293a25,_0x5a4991){return logger[_0x9ee4('0x9')](util[_0x9ee4('0xa')](_0x9ee4('0xb'),_0x2f8dfc,_0x293a25['name'],_0x5a4991));}function handleFindAgent(_0x940c36){return function(_0x5b790c){return _0x5b790c[_0x9ee4('0xc')][_0x9ee4('0xd')]()===_0x940c36[_0x9ee4('0xd')]();};}exports[_0x9ee4('0xe')]=function(_0x2b6f7b,_0x4d4ee6,_0x3fa0c6,_0x23608b){return function(_0x5bd1f3){try{var _0xa345ae={'name':_0x4d4ee6[0x0],'timeout':_0x4d4ee6[0x1]};var _0x467e86=queue[_0x9ee4('0x0')](_0xa345ae,{'typecast':!![]});if(_0x467e86['length']){logger[_0x9ee4('0xf')]('[%s][AGENT]\x20%s',_0x2b6f7b,_[_0x9ee4('0x10')](_0x467e86,_0x9ee4('0x11'))['join'](',\x20'));_0x5bd1f3[_0x9ee4('0x12')]();}else{var _0x3cd944=_[_0x9ee4('0x13')](_0x3fa0c6[_0x9ee4('0x14')],handleFindAgent(_0xa345ae[_0x9ee4('0xc')]));if(_0x3cd944){var _0x5dee91=(_0xa345ae['timeout']||0xa)*0x3e8;var _0x552c71,_0x59b9f4;var _0x3846fd=seqqueue[_0x9ee4('0x15')](_0x5dee91);_0x3846fd['id']=_0x2b6f7b;_0x3846fd['atimeout']=_0x5dee91;_0x3846fd[_0x9ee4('0x16')]=_0x23608b[_0x9ee4('0x16')];writeLog(_0x2b6f7b,_0x3cd944,util['format']('START:%s',_0x5dee91));_0x3fa0c6[_0x9ee4('0x17')][_0x2b6f7b]['on'](_0x9ee4('0x18'),function(){logger['info'](_0x9ee4('0x19'),_0x2b6f7b);clearTimeout(_0x59b9f4);_0x59b9f4=undefined;_0x3846fd[_0x9ee4('0x1a')]();if(_0x3fa0c6[_0x9ee4('0x17')][_0x2b6f7b]){delete _0x3fa0c6[_0x9ee4('0x17')][_0x2b6f7b];}_0x5bd1f3[_0x9ee4('0x12')]();});_0x3fa0c6[_0x9ee4('0x17')][_0x2b6f7b]['on'](_0x9ee4('0x1b'),function(){if(_0x3fa0c6[_0x9ee4('0x17')][_0x2b6f7b]){delete _0x3fa0c6[_0x9ee4('0x17')][_0x2b6f7b];}});_0x59b9f4=setTimeout(function(){logger[_0x9ee4('0x9')]('[%s][AGENT]\x20ROUTING\x20END',_0x2b6f7b);clearTimeout(_0x59b9f4);_0x3846fd['close']();_0x5bd1f3[_0x9ee4('0x1c')]();},_0x5dee91);strategy['agent'](_0x3846fd,_0x3cd944,_0x3fa0c6,_0x23608b);}else{logger[_0x9ee4('0xf')](_0x9ee4('0x1d'),_0x2b6f7b,_0xa345ae['name']);_0x5bd1f3['stop']();}}}catch(_0x12da58){console[_0x9ee4('0x1e')](_0x12da58);logger[_0x9ee4('0xf')]('[%s][QUEUE]\x20%s',_0x2b6f7b,_0x12da58[_0x9ee4('0x1f')]);_0x5bd1f3['stop']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/amazonlex.js b/server/services/routing/server/applications/amazonlex.js index 5e56714..a232518 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 _0xe263=['consequence','info','[%s][AMAZONLEX]\x20%s','next','contact','format','out','channel','whatsapp','phone','interaction','chat','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','created','isEmpty','body','getMustacheRender','Message','create','then','catch','error','stringify','stop','LexRuntime','$LATEST','toString','message','amazonlex','providerResponse','dialogState','Failed','lodash','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage'];(function(_0x261c6f,_0x31215c){var _0x542ced=function(_0x194cf4){while(--_0x194cf4){_0x261c6f['push'](_0x261c6f['shift']());}};_0x542ced(++_0x31215c);}(_0xe263,0x166));var _0x3e26=function(_0x364e13,_0x5e4e64){_0x364e13=_0x364e13-0x0;var _0x5dbaa2=_0xe263[_0x364e13];return _0x5dbaa2;};'use strict';var _=require(_0x3e26('0x0'));var moment=require('moment');var AWS=require('aws-sdk');var utils=require(_0x3e26('0x1'));var logger=require(_0x3e26('0x2'))(_0x3e26('0x3'));var rpc={'chatMessage':require(_0x3e26('0x4')),'openchannelMessage':require(_0x3e26('0x5')),'mailMessage':require(_0x3e26('0x6')),'smsMessage':require(_0x3e26('0x7')),'faxMessage':require(_0x3e26('0x8')),'whatsappMessage':require(_0x3e26('0x9'))};exports[_0x3e26('0xa')]=function(_0x53e57b,_0x4eaed9){return function(_0x2617fd){try{if(!_['isNil'](this['interaction']['UserId'])){logger[_0x3e26('0xb')](_0x3e26('0xc'),_0x53e57b,'Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.');return _0x2617fd[_0x3e26('0xd')]();}var _0x52801b={'ContactId':this[_0x3e26('0xe')]['id'],'sentAt':moment()[_0x3e26('0xf')]('YYYY-MM-DD\x20HH:mm:ss'),'direction':_0x3e26('0x10')};if(this[_0x3e26('0x11')]==='sms'||this[_0x3e26('0x11')]===_0x3e26('0x12')){_0x52801b[_0x3e26('0x13')]=this[_0x3e26('0x14')][_0x3e26('0x13')];}var _0x582b1c=this[_0x3e26('0x11')];if(_0x582b1c===_0x3e26('0x15')){_0x52801b[_0x3e26('0x16')]=this[_0x3e26('0x17')]['id'];}else{_0x52801b[_[_0x3e26('0x18')](_0x582b1c)+_0x3e26('0x19')]=this[_0x3e26('0x17')]['id'];}_0x52801b[_[_0x3e26('0x18')](_0x582b1c)+_0x3e26('0x1a')]=this[_0x3e26('0x14')]['id'];if(this[_0x3e26('0x14')][_0x3e26('0x1b')]){var _0x34d97c=_0x4eaed9[0x4];if(!_[_0x3e26('0x1c')](_0x34d97c)){_0x52801b[_0x3e26('0x1d')]=utils[_0x3e26('0x1e')](_0x34d97c,this);return rpc[_0x582b1c+_0x3e26('0x1f')][_0x3e26('0x20')](_0x52801b)[_0x3e26('0x21')](function(_0x8da351){logger[_0x3e26('0xb')]('[%s][AMAZONLEX]\x20%s',_0x53e57b,_0x52801b[_0x3e26('0x1d')]);})[_0x3e26('0x22')](function(_0xcf4b0e){logger[_0x3e26('0x23')](_0x3e26('0xc'),_0x53e57b,JSON[_0x3e26('0x24')](_0xcf4b0e));})['finally'](function(){logger['info']('[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!',_0x53e57b);_0x2617fd[_0x3e26('0x25')]();});}else{logger[_0x3e26('0xb')]('[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!',_0x53e57b);_0x2617fd['stop']();}}else{var _0x31ffe4=this;var _0x21cce6=new AWS[(_0x3e26('0x26'))]({'accessKeyId':_0x4eaed9[0x0],'secretAccessKey':_0x4eaed9[0x1],'region':_0x4eaed9[0x2]});var _0x28c391={'botAlias':_0x3e26('0x27'),'botName':_0x4eaed9[0x3],'inputText':this['message'][_0x3e26('0x1d')],'userId':this[_0x3e26('0x11')]+':'+this[_0x3e26('0x14')]['id'][_0x3e26('0x28')]()};_0x21cce6['postText'](_0x28c391,function(_0x4be5e1,_0x4a683f){if(_0x4be5e1){logger['error'](_0x3e26('0xc'),_0x53e57b,_0x4be5e1[_0x3e26('0x29')]);_0x2617fd['next']();}else if(_0x4a683f&&_0x4a683f[_0x3e26('0x29')]){_0x31ffe4[_0x3e26('0x1d')][_0x3e26('0x2a')]=_0x4a683f;_0x52801b['body']=_0x4a683f[_0x3e26('0x29')];_0x52801b['providerName']=_0x3e26('0x2a');_0x52801b[_0x3e26('0x2b')]=JSON[_0x3e26('0x24')](_0x4a683f);return rpc[_0x582b1c+'Message'][_0x3e26('0x20')](_0x52801b)[_0x3e26('0x21')](function(_0x2e94a3){logger[_0x3e26('0xb')](_0x3e26('0xc'),_0x53e57b,_0x52801b['body']);if(_0x4a683f[_0x3e26('0x2c')]==_0x3e26('0x2d')){_0x2617fd[_0x3e26('0xd')]();}else{_0x2617fd['stop']();}})[_0x3e26('0x22')](function(_0x13eed5){logger[_0x3e26('0x23')](_0x3e26('0xc'),_0x53e57b,JSON[_0x3e26('0x24')](_0x13eed5));_0x2617fd[_0x3e26('0xd')]();});}else{_0x2617fd[_0x3e26('0xd')]();}});}}catch(_0x52f91e){logger[_0x3e26('0x23')]('[%s][AMAZONLEX]\x20%s',_0x53e57b,JSON[_0x3e26('0x24')](_0x52f91e));_0x2617fd[_0x3e26('0x25')]();}};}; \ No newline at end of file +var _0x2e3f=['whatsapp','phone','chat','ChatWebsiteId','account','upperFirst','AccountId','created','body','getMustacheRender','Message','create','info','error','stringify','finally','[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','LexRuntime','$LATEST','message','toString','postText','amazonlex','providerName','providerResponse','dialogState','Failed','catch','lodash','moment','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','isNil','interaction','[%s][AMAZONLEX]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','sms'];(function(_0x34ed22,_0x8c2101){var _0x48c653=function(_0x4e77bc){while(--_0x4e77bc){_0x34ed22['push'](_0x34ed22['shift']());}};_0x48c653(++_0x8c2101);}(_0x2e3f,0x122));var _0xf2e3=function(_0x352623,_0x4680f8){_0x352623=_0x352623-0x0;var _0xcffaa9=_0x2e3f[_0x352623];return _0xcffaa9;};'use strict';var _=require(_0xf2e3('0x0'));var moment=require(_0xf2e3('0x1'));var AWS=require('aws-sdk');var utils=require(_0xf2e3('0x2'));var logger=require(_0xf2e3('0x3'))(_0xf2e3('0x4'));var rpc={'chatMessage':require(_0xf2e3('0x5')),'openchannelMessage':require(_0xf2e3('0x6')),'mailMessage':require(_0xf2e3('0x7')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0xf2e3('0x8')),'whatsappMessage':require(_0xf2e3('0x9'))};exports[_0xf2e3('0xa')]=function(_0x542c97,_0xac5f31){return function(_0x5e9bda){try{if(!_[_0xf2e3('0xb')](this[_0xf2e3('0xc')]['UserId'])){logger['info'](_0xf2e3('0xd'),_0x542c97,_0xf2e3('0xe'));return _0x5e9bda[_0xf2e3('0xf')]();}var _0x5ebc6e={'ContactId':this[_0xf2e3('0x10')]['id'],'sentAt':moment()[_0xf2e3('0x11')](_0xf2e3('0x12')),'direction':_0xf2e3('0x13')};if(this[_0xf2e3('0x14')]===_0xf2e3('0x15')||this[_0xf2e3('0x14')]===_0xf2e3('0x16')){_0x5ebc6e[_0xf2e3('0x17')]=this['interaction']['phone'];}var _0x5ea8ec=this['channel'];if(_0x5ea8ec===_0xf2e3('0x18')){_0x5ebc6e[_0xf2e3('0x19')]=this[_0xf2e3('0x1a')]['id'];}else{_0x5ebc6e[_[_0xf2e3('0x1b')](_0x5ea8ec)+_0xf2e3('0x1c')]=this[_0xf2e3('0x1a')]['id'];}_0x5ebc6e[_[_0xf2e3('0x1b')](_0x5ea8ec)+'InteractionId']=this['interaction']['id'];if(this[_0xf2e3('0xc')][_0xf2e3('0x1d')]){var _0x10af95=_0xac5f31[0x4];if(!_['isEmpty'](_0x10af95)){_0x5ebc6e[_0xf2e3('0x1e')]=utils[_0xf2e3('0x1f')](_0x10af95,this);return rpc[_0x5ea8ec+_0xf2e3('0x20')][_0xf2e3('0x21')](_0x5ebc6e)['then'](function(_0x6ae49b){logger[_0xf2e3('0x22')](_0xf2e3('0xd'),_0x542c97,_0x5ebc6e[_0xf2e3('0x1e')]);})['catch'](function(_0x4a90b1){logger[_0xf2e3('0x23')](_0xf2e3('0xd'),_0x542c97,JSON[_0xf2e3('0x24')](_0x4a90b1));})[_0xf2e3('0x25')](function(){logger[_0xf2e3('0x22')](_0xf2e3('0x26'),_0x542c97);_0x5e9bda[_0xf2e3('0x27')]();});}else{logger[_0xf2e3('0x22')](_0xf2e3('0x28'),_0x542c97);_0x5e9bda[_0xf2e3('0x27')]();}}else{var _0x34773d=this;var _0x5c7366=new AWS[(_0xf2e3('0x29'))]({'accessKeyId':_0xac5f31[0x0],'secretAccessKey':_0xac5f31[0x1],'region':_0xac5f31[0x2]});var _0x1702b2={'botAlias':_0xf2e3('0x2a'),'botName':_0xac5f31[0x3],'inputText':this[_0xf2e3('0x2b')][_0xf2e3('0x1e')],'userId':this[_0xf2e3('0x14')]+':'+this['interaction']['id'][_0xf2e3('0x2c')]()};_0x5c7366[_0xf2e3('0x2d')](_0x1702b2,function(_0x329080,_0x43fb74){if(_0x329080){logger['error']('[%s][AMAZONLEX]\x20%s',_0x542c97,_0x329080[_0xf2e3('0x2b')]);_0x5e9bda[_0xf2e3('0xf')]();}else if(_0x43fb74&&_0x43fb74['message']){_0x34773d[_0xf2e3('0x1e')][_0xf2e3('0x2e')]=_0x43fb74;_0x5ebc6e[_0xf2e3('0x1e')]=_0x43fb74[_0xf2e3('0x2b')];_0x5ebc6e[_0xf2e3('0x2f')]='amazonlex';_0x5ebc6e[_0xf2e3('0x30')]=JSON['stringify'](_0x43fb74);return rpc[_0x5ea8ec+'Message'][_0xf2e3('0x21')](_0x5ebc6e)['then'](function(_0x5eae57){logger['info']('[%s][AMAZONLEX]\x20%s',_0x542c97,_0x5ebc6e['body']);if(_0x43fb74[_0xf2e3('0x31')]==_0xf2e3('0x32')){_0x5e9bda[_0xf2e3('0xf')]();}else{_0x5e9bda[_0xf2e3('0x27')]();}})[_0xf2e3('0x33')](function(_0x86ef26){logger[_0xf2e3('0x23')](_0xf2e3('0xd'),_0x542c97,JSON[_0xf2e3('0x24')](_0x86ef26));_0x5e9bda[_0xf2e3('0xf')]();});}else{_0x5e9bda['next']();}});}}catch(_0x227015){logger['error'](_0xf2e3('0xd'),_0x542c97,JSON[_0xf2e3('0x24')](_0x227015));_0x5e9bda[_0xf2e3('0x27')]();}};}; \ 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 f11dd19..e2af8e6 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 _0x1ffd=['[%s][AUTOREPLY]\x20SMTP\x20SENT','create','catch','error','[RPC][%s][AUTOREPLY]\x20%s','stringify','finally','resolve','Interaction','[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s','next','stop','lodash','moment','../../../../config/logger','routing','../../rpc/openchannelMessage','../../rpc/faxMessage','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/mailInteraction','../../rpc/smsInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','../../mailRpc','consequence','body','isAutoreply','info','[%s][AUTOREPLY]\x20%s','Autoreply\x20not\x20executed\x20(message\x20is\x20autoreply)','isNil','interaction','created','Autoreply\x20already\x20sent','[%s][AUTOREPLY][autoreplyExecuted]\x20%s','One\x20Time\x20already\x20sent','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','mail','getMustacheRender','message','from','phone','subject','startsWith','Re:','chat','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','Message','inReplyTo','messageId','html','','replace','';_0x2171f6[_0xd1ff('0x34')]={'Auto-Submitted':_0xd1ff('0x35'),'X-Auto-Response-Suppress':_0xd1ff('0x36'),'Precedence':_0xd1ff('0x37')};return mailRpc[_0xd1ff('0x38')](this['account'][_0xd1ff('0x39')],_0x2171f6)[_0xd1ff('0x3a')](function(_0x91bbb6){logger[_0xd1ff('0x10')](_0xd1ff('0x3b'),_0x313af1);_0x2171f6['messageId']=_0x91bbb6[_0xd1ff('0x20')][_0xd1ff('0x2e')];return rpc[_0x13a70d+'Message'][_0xd1ff('0x3c')](_0x2171f6);})[_0xd1ff('0x3a')](function(_0x25238b){logger[_0xd1ff('0x10')](_0xd1ff('0x11'),_0x313af1,JSON['stringify'](_0x25238b));})[_0xd1ff('0x3d')](function(_0x1f4506){logger[_0xd1ff('0x3e')](_0xd1ff('0x3f'),_0x313af1,JSON[_0xd1ff('0x40')](_0x1f4506));})[_0xd1ff('0x41')](function(){Promise[_0xd1ff('0x42')]()[_0xd1ff('0x3a')](function(){if(_0xb43993[0x0]!=='2'||_0xb48533['autoreplyExecuted'])return;return rpc[_0x13a70d+_0xd1ff('0x43')]['update'](_0xb48533['id'],{'autoreplyExecuted':!![]})[_0xd1ff('0x3a')](function(_0x10efd3){logger[_0xd1ff('0x10')](_0xd1ff('0x17'),_0x313af1,JSON[_0xd1ff('0x40')](_0x10efd3));})[_0xd1ff('0x3d')](function(_0x53d9d3){logger[_0xd1ff('0x3e')](_0xd1ff('0x44'),_0x313af1,JSON[_0xd1ff('0x40')](_0x53d9d3));});})[_0xd1ff('0x3a')](function(){_0x434776[_0xd1ff('0x45')]();});});}else{return rpc[this[_0xd1ff('0x1d')]+_0xd1ff('0x2c')][_0xd1ff('0x3c')](_0x2171f6)[_0xd1ff('0x3a')](function(){logger['info']('[%s][AUTOREPLY]\x20%s',_0x313af1,_0x2171f6['body']);})['catch'](function(_0x333d56){logger[_0xd1ff('0x3e')](_0xd1ff('0x11'),_0x313af1,JSON['stringify'](_0x333d56));})[_0xd1ff('0x41')](function(){Promise[_0xd1ff('0x42')]()[_0xd1ff('0x3a')](function(){if(_0xb43993[0x0]!=='2'||_0xb48533['autoreplyExecuted'])return;return rpc[_0x13a70d+_0xd1ff('0x43')]['update'](_0xb48533['id'],{'autoreplyExecuted':!![]})[_0xd1ff('0x3a')](function(_0x24cf49){logger['info'](_0xd1ff('0x17'),_0x313af1,JSON[_0xd1ff('0x40')](_0x24cf49));})[_0xd1ff('0x3d')](function(_0x2617c2){logger[_0xd1ff('0x3e')](_0xd1ff('0x44'),_0x313af1,JSON['stringify'](_0x2617c2));});})['then'](function(){_0x434776[_0xd1ff('0x45')]();});});}}}catch(_0x480023){logger[_0xd1ff('0x3e')](_0xd1ff('0x11'),_0x313af1,JSON[_0xd1ff('0x40')](_0x480023));_0x434776[_0xd1ff('0x46')]();}};}; \ No newline at end of file +var _0x126d=['smtpOptions','then','[%s][AUTOREPLY]\x20SMTP\x20SENT','[%s][AUTOREPLY]\x20%s','stringify','catch','error','[RPC][%s][AUTOREPLY]\x20%s','resolve','Interaction','update','create','[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s','stop','moment','./utils','routing','../../rpc/chatMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','../../mailRpc','consequence','channel','mail','body','isAutoreply','info','Autoreply\x20not\x20executed\x20(message\x20is\x20autoreply)','isNil','created','interaction','autoreplyExecuted','[%s][AUTOREPLY][autoreplyExecuted]\x20%s','One\x20Time\x20already\x20sent','next','contact','format','YYYY-MM-DD\x20HH:mm:ss','getMustacheRender','message','from','phone','read','subject','startsWith','Re:\x20','chat','ChatWebsiteId','account','upperFirst','AccountId','Message','inReplyTo','messageId','html','','replace','','headers','auto-replied','All','auto_reply','sendMailMessage'];(function(_0x556109,_0x18bc57){var _0x4b8364=function(_0x57bf28){while(--_0x57bf28){_0x556109['push'](_0x556109['shift']());}};_0x4b8364(++_0x18bc57);}(_0x126d,0x1b2));var _0xd126=function(_0x4c93b9,_0x442904){_0x4c93b9=_0x4c93b9-0x0;var _0x40141c=_0x126d[_0x4c93b9];return _0x40141c;};'use strict';var _=require('lodash');var moment=require(_0xd126('0x0'));var utils=require(_0xd126('0x1'));var logger=require('../../../../config/logger')(_0xd126('0x2'));var rpc={'chatMessage':require(_0xd126('0x3')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0xd126('0x4')),'smsMessage':require(_0xd126('0x5')),'faxMessage':require(_0xd126('0x6')),'whatsappMessage':require('../../rpc/whatsappMessage'),'chatInteraction':require(_0xd126('0x7')),'openchannelInteraction':require(_0xd126('0x8')),'mailInteraction':require('../../rpc/mailInteraction'),'smsInteraction':require(_0xd126('0x9')),'faxInteraction':require(_0xd126('0xa')),'whatsappInteraction':require(_0xd126('0xb'))};var mailRpc=require(_0xd126('0xc'));exports[_0xd126('0xd')]=function(_0x2be103,_0x437a78,_0x436b50,_0x56bc56){return function(_0xe6c82){try{var _0x5902f1=this[_0xd126('0xe')];if(_0x5902f1===_0xd126('0xf')&&_0x56bc56[_0xd126('0x10')][_0xd126('0x11')]){logger[_0xd126('0x12')]('[%s][AUTOREPLY]\x20%s',_0x2be103,_0xd126('0x13'));return _0xe6c82['next']();}if(_0x437a78[0x0]==='1'&&(_[_0xd126('0x14')](this['interaction'][_0xd126('0x15')])||!this['interaction'][_0xd126('0x15')])){logger[_0xd126('0x12')]('[%s][AUTOREPLY]\x20%s',_0x2be103,'Autoreply\x20already\x20sent');return _0xe6c82['next']();}if(_0x437a78[0x0]==='2'&&this[_0xd126('0x16')][_0xd126('0x17')]){logger[_0xd126('0x12')](_0xd126('0x18'),_0x2be103,_0xd126('0x19'));return _0xe6c82[_0xd126('0x1a')]();}var _0x21ee72={'ContactId':this[_0xd126('0x1b')]['id'],'sentAt':moment()[_0xd126('0x1c')](_0xd126('0x1d')),'direction':'out'};if(this[_0xd126('0xe')]==='mail'){_0x21ee72['body']=utils[_0xd126('0x1e')](_0x437a78[0x2],this);}else{_0x21ee72[_0xd126('0x10')]=utils[_0xd126('0x1e')](_0x437a78[0x1],this);}if(this['message']){_0x21ee72['to']=this[_0xd126('0x1f')][_0xd126('0x20')]||'';if(this['channel']===_0xd126('0xf')&&_0x437a78[0x1]==='1'){_0x21ee72['cc']=this['message']['cc']||'';}_0x21ee72[_0xd126('0x20')]=this[_0xd126('0x1f')]['to']||'';_0x21ee72[_0xd126('0x21')]=this['message']['phone']||'';_0x21ee72[_0xd126('0x22')]=!![];if(this[_0xd126('0x1f')]['subject']){_0x21ee72[_0xd126('0x23')]='';_0x21ee72['subject']+=_[_0xd126('0x24')](this[_0xd126('0x1f')][_0xd126('0x23')],'Re:')?'':_0xd126('0x25');_0x21ee72[_0xd126('0x23')]+=this['message'][_0xd126('0x23')];}}if(this[_0xd126('0xe')]===_0xd126('0x26')){_0x21ee72[_0xd126('0x27')]=this[_0xd126('0x28')]['id'];}else{_0x21ee72[_[_0xd126('0x29')](this['channel'])+_0xd126('0x2a')]=this[_0xd126('0x28')]['id'];}_0x21ee72[_['upperFirst'](this[_0xd126('0xe')])+'InteractionId']=this['interaction']['id'];var _0x50c457=this['interaction'];if(rpc[this[_0xd126('0xe')]+_0xd126('0x2b')]){if(this[_0xd126('0xe')]===_0xd126('0xf')){_0x21ee72[_0xd126('0x2c')]=this[_0xd126('0x1f')][_0xd126('0x2d')];_0x21ee72[_0xd126('0x2e')]=_0xd126('0x2f')+_[_0xd126('0x30')](_0x21ee72[_0xd126('0x10')],']+(>|$)/g,''),'priorityTrue':_0x542f94[0x1],'priorityFalse':_0x542f94[0x2]};var _0x2822b9=gotoif['validate'](_0x1e3255,{'typecast':!![]});if(_0x2822b9[_0x449d('0xa')]){logger[_0x449d('0xb')](_0x449d('0xc'),_0x4615fb,_[_0x449d('0xd')](_0x2822b9,_0x449d('0xe'))[_0x449d('0xf')](',\x20'));_0x13573c['stop']();}else{try{var _0x33f8e8=eval('('+_0x1e3255['condition']+')');var _0x30e11f=_0x33f8e8?_0x1e3255[_0x449d('0x10')]:_0x1e3255[_0x449d('0x11')];logger[_0x449d('0x12')](_0x449d('0x13'),_0x4615fb,_0x1e3255[_0x449d('0x14')],_0x33f8e8,_0x30e11f||_0x449d('0x15'));if(_0x30e11f){var _0x59752d=_[_0x449d('0x16')](_0x13573c[_0x449d('0x17')](),{'p':_0x30e11f});if(_0x59752d>=0x0){logger[_0x449d('0x12')]('[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s',_0x4615fb,_0x30e11f||_0x449d('0x15'),_0x59752d);_0x13573c['next'](_0x59752d);}else{logger[_0x449d('0x12')](_0x449d('0x18'),_0x4615fb,_0x30e11f||_0x449d('0x15'));_0x13573c[_0x449d('0x19')]();}}else{_0x13573c[_0x449d('0x15')]();}}catch(_0x310c17){logger[_0x449d('0xb')]('[%s][GOTOIF]\x20eval\x20error:\x20%s',_0x4615fb,_0x310c17[_0x449d('0xe')]);_0x13573c['stop']();}}}catch(_0x1f0fbc){logger[_0x449d('0xb')](_0x449d('0xc'),_0x4615fb,JSON[_0x449d('0x1a')](_0x1f0fbc));_0x13573c[_0x449d('0x19')]();}};}; \ No newline at end of file +var _0xa8cf=['[%s][GOTOIF]\x20eval\x20error:\x20%s','stringify','validate','lodash','html-to-text','./utils','../../../../config/logger','routing','string','condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required','priority\x20true\x20is\x20a\x20number','number','priority\x20false\x20is\x20a\x20number','consequence','length','error','[%s][GOTOIF]\x20%s','map','message','join','condition','priorityFalse','[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s','rules','info','[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','[%s][GOTOIF]\x20priority\x20%s\x20not\x20found','stop'];(function(_0x1b9f11,_0x3be3de){var _0x3311d2=function(_0x1a5150){while(--_0x1a5150){_0x1b9f11['push'](_0x1b9f11['shift']());}};_0x3311d2(++_0x3be3de);}(_0xa8cf,0x198));var _0xfa8c=function(_0x2fb22b,_0xa4226e){_0x2fb22b=_0x2fb22b-0x0;var _0x14f065=_0xa8cf[_0x2fb22b];return _0x14f065;};'use strict';var schema=require(_0xfa8c('0x0'));var _=require(_0xfa8c('0x1'));var htmlToText=require(_0xfa8c('0x2'));var utils=require(_0xfa8c('0x3'));var logger=require(_0xfa8c('0x4'))(_0xfa8c('0x5'));var gotoif=schema({'condition':{'type':_0xfa8c('0x6'),'required':!![],'message':_0xfa8c('0x7')},'priorityTrue':{'type':'number','message':_0xfa8c('0x8')},'priorityFalse':{'type':_0xfa8c('0x9'),'message':_0xfa8c('0xa')}});exports[_0xfa8c('0xb')]=function(_0xb57914,_0x1facda){return function(_0x574415){try{var _0xf82358={'condition':htmlToText['fromString'](utils['getMustacheRender'](_0x1facda[0x0],this),{'wordwrap':![]})['replace'](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x1facda[0x1],'priorityFalse':_0x1facda[0x2]};var _0x94f689=gotoif[_0xfa8c('0x0')](_0xf82358,{'typecast':!![]});if(_0x94f689[_0xfa8c('0xc')]){logger[_0xfa8c('0xd')](_0xfa8c('0xe'),_0xb57914,_[_0xfa8c('0xf')](_0x94f689,_0xfa8c('0x10'))[_0xfa8c('0x11')](',\x20'));_0x574415['stop']();}else{try{var _0x465f34=eval('('+_0xf82358[_0xfa8c('0x12')]+')');var _0x54b9a4=_0x465f34?_0xf82358['priorityTrue']:_0xf82358[_0xfa8c('0x13')];logger['info'](_0xfa8c('0x14'),_0xb57914,_0xf82358[_0xfa8c('0x12')],_0x465f34,_0x54b9a4||'next');if(_0x54b9a4){var _0x12cac4=_['findIndex'](_0x574415[_0xfa8c('0x15')](),{'p':_0x54b9a4});if(_0x12cac4>=0x0){logger[_0xfa8c('0x16')](_0xfa8c('0x17'),_0xb57914,_0x54b9a4||_0xfa8c('0x18'),_0x12cac4);_0x574415['next'](_0x12cac4);}else{logger[_0xfa8c('0x16')](_0xfa8c('0x19'),_0xb57914,_0x54b9a4||_0xfa8c('0x18'));_0x574415[_0xfa8c('0x1a')]();}}else{_0x574415[_0xfa8c('0x18')]();}}catch(_0x12e50c){logger[_0xfa8c('0xd')](_0xfa8c('0x1b'),_0xb57914,_0x12e50c[_0xfa8c('0x10')]);_0x574415[_0xfa8c('0x1a')]();}}}catch(_0x306861){logger['error'](_0xfa8c('0xe'),_0xb57914,JSON[_0xfa8c('0x1c')](_0x306861));_0x574415[_0xfa8c('0x1a')]();}};}; \ 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 7253612..ae0f576 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 _0xddb5=['next','[%s][GOTOP]\x20priority\x20%s\x20not\x20found','stringify','lodash','../../../../config/logger','routing','number','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','consequence','length','error','[%s][GOTOP]\x20%s','map','message','stop','info','priority','findIndex','rules','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s'];(function(_0x112626,_0x2c5b3b){var _0x17bd38=function(_0x5b957d){while(--_0x5b957d){_0x112626['push'](_0x112626['shift']());}};_0x17bd38(++_0x2c5b3b);}(_0xddb5,0x8f));var _0x5ddb=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0xddb5[_0x502c7d];return _0x30b7ed;};'use strict';var schema=require('validate');var _=require(_0x5ddb('0x0'));var logger=require(_0x5ddb('0x1'))(_0x5ddb('0x2'));var gotop=schema({'priority':{'type':_0x5ddb('0x3'),'required':!![],'message':_0x5ddb('0x4')}});exports[_0x5ddb('0x5')]=function(_0x10b7f1,_0x55a8c7){return function(_0x46c4f7){try{var _0x584fba={'priority':_0x55a8c7[0x0]};var _0x34ffc2=gotop['validate'](_0x584fba,{'typecast':!![]});if(_0x34ffc2[_0x5ddb('0x6')]){logger[_0x5ddb('0x7')](_0x5ddb('0x8'),_0x10b7f1,_[_0x5ddb('0x9')](_0x34ffc2,_0x5ddb('0xa'))['join'](',\x20'));_0x46c4f7[_0x5ddb('0xb')]();}else{logger[_0x5ddb('0xc')]('[%s][GOTOP]\x20priority\x20%s',_0x10b7f1,_0x584fba['priority']);if(_0x584fba[_0x5ddb('0xd')]){var _0x257e36=_[_0x5ddb('0xe')](_0x46c4f7[_0x5ddb('0xf')](),{'p':_0x584fba[_0x5ddb('0xd')]});if(_0x257e36>=0x0){logger[_0x5ddb('0xc')](_0x5ddb('0x10'),_0x10b7f1,_0x584fba[_0x5ddb('0xd')]||_0x5ddb('0x11'),_0x257e36);_0x46c4f7[_0x5ddb('0x11')](_0x257e36);}else{logger['info'](_0x5ddb('0x12'),_0x10b7f1,_0x584fba[_0x5ddb('0xd')]||'next');_0x46c4f7[_0x5ddb('0xb')]();}}else{_0x46c4f7[_0x5ddb('0x11')]();}}}catch(_0x5156da){logger[_0x5ddb('0x7')](_0x5ddb('0x8'),_0x10b7f1,JSON[_0x5ddb('0x13')](_0x5156da));_0x46c4f7['stop']();}};}; \ No newline at end of file +var _0x0c1f=['next','[%s][GOTOP]\x20priority\x20%s\x20not\x20found','stringify','validate','lodash','../../../../config/logger','routing','number','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','consequence','length','error','[%s][GOTOP]\x20%s','message','join','stop','info','[%s][GOTOP]\x20priority\x20%s','priority','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s'];(function(_0x1d046a,_0x30db41){var _0x2c0b0c=function(_0x30a3c5){while(--_0x30a3c5){_0x1d046a['push'](_0x1d046a['shift']());}};_0x2c0b0c(++_0x30db41);}(_0x0c1f,0x8f));var _0xf0c1=function(_0x408b34,_0xb7d872){_0x408b34=_0x408b34-0x0;var _0x1182aa=_0x0c1f[_0x408b34];return _0x1182aa;};'use strict';var schema=require(_0xf0c1('0x0'));var _=require(_0xf0c1('0x1'));var logger=require(_0xf0c1('0x2'))(_0xf0c1('0x3'));var gotop=schema({'priority':{'type':_0xf0c1('0x4'),'required':!![],'message':_0xf0c1('0x5')}});exports[_0xf0c1('0x6')]=function(_0x8d87d6,_0x4487bc){return function(_0x4d332c){try{var _0x2d8c14={'priority':_0x4487bc[0x0]};var _0x22415b=gotop[_0xf0c1('0x0')](_0x2d8c14,{'typecast':!![]});if(_0x22415b[_0xf0c1('0x7')]){logger[_0xf0c1('0x8')](_0xf0c1('0x9'),_0x8d87d6,_['map'](_0x22415b,_0xf0c1('0xa'))[_0xf0c1('0xb')](',\x20'));_0x4d332c[_0xf0c1('0xc')]();}else{logger[_0xf0c1('0xd')](_0xf0c1('0xe'),_0x8d87d6,_0x2d8c14['priority']);if(_0x2d8c14[_0xf0c1('0xf')]){var _0x2af868=_['findIndex'](_0x4d332c['rules'](),{'p':_0x2d8c14[_0xf0c1('0xf')]});if(_0x2af868>=0x0){logger[_0xf0c1('0xd')](_0xf0c1('0x10'),_0x8d87d6,_0x2d8c14[_0xf0c1('0xf')]||_0xf0c1('0x11'),_0x2af868);_0x4d332c['next'](_0x2af868);}else{logger[_0xf0c1('0xd')](_0xf0c1('0x12'),_0x8d87d6,_0x2d8c14[_0xf0c1('0xf')]||_0xf0c1('0x11'));_0x4d332c['stop']();}}else{_0x4d332c[_0xf0c1('0x11')]();}}}catch(_0x345999){logger[_0xf0c1('0x8')](_0xf0c1('0x9'),_0x8d87d6,JSON[_0xf0c1('0x13')](_0x345999));_0x4d332c[_0xf0c1('0xc')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/message.js b/server/services/routing/server/applications/message.js index 55be3ef..6745408 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 _0x755e=['../../rpc/mailMessage','../../rpc/faxMessage','consequence','contact','chat','account','upperFirst','channel','AccountId','InteractionId','interaction','Message','create','then','info','[%s][MESSAGE]\x20%s','body','catch','stringify','stop','lodash','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x755e,0x96));var _0xe755=function(_0x32c04b,_0x187085){_0x32c04b=_0x32c04b-0x0;var _0x2947b1=_0x755e[_0x32c04b];return _0x2947b1;};'use strict';var _=require(_0xe755('0x0'));var utils=require(_0xe755('0x1'));var logger=require(_0xe755('0x2'))(_0xe755('0x3'));var rpc={'chatMessage':require(_0xe755('0x4')),'openchannelMessage':require(_0xe755('0x5')),'mailMessage':require(_0xe755('0x6')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0xe755('0x7')),'whatsappMessage':require('../../rpc/whatsappMessage')};exports[_0xe755('0x8')]=function(_0x36eb84,_0xe29839){return function(_0x3b82da){try{var _0x3184c3={'body':utils['getMustacheRender'](_0xe29839[0x0],this),'ContactId':this[_0xe755('0x9')]['id']};if(this['channel']===_0xe755('0xa')){_0x3184c3['ChatWebsiteId']=this[_0xe755('0xb')]['id'];}else{_0x3184c3[_[_0xe755('0xc')](this[_0xe755('0xd')])+_0xe755('0xe')]=this[_0xe755('0xb')]['id'];}_0x3184c3[_[_0xe755('0xc')](this[_0xe755('0xd')])+_0xe755('0xf')]=this[_0xe755('0x10')]['id'];if(rpc[this[_0xe755('0xd')]+_0xe755('0x11')]){return rpc[this[_0xe755('0xd')]+'Message'][_0xe755('0x12')](_0x3184c3)[_0xe755('0x13')](function(_0x48d347){logger[_0xe755('0x14')](_0xe755('0x15'),_0x36eb84,_0x3184c3[_0xe755('0x16')]);_0x3b82da['next']();})[_0xe755('0x17')](function(_0x306ddc){logger['error'](_0xe755('0x15'),_0x36eb84,JSON[_0xe755('0x18')](_0x306ddc));_0x3b82da['stop']();});}}catch(_0x245763){logger['error'](_0xe755('0x15'),_0x36eb84,JSON[_0xe755('0x18')](_0x245763));_0x3b82da[_0xe755('0x19')]();}};}; \ No newline at end of file +var _0x95a9=['info','[%s][MESSAGE]\x20%s','next','catch','error','stringify','stop','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','getMustacheRender','contact','chat','ChatWebsiteId','account','channel','AccountId','upperFirst','InteractionId','interaction','Message','create'];(function(_0x5447fd,_0x52a6b5){var _0x15b28a=function(_0x370d4f){while(--_0x370d4f){_0x5447fd['push'](_0x5447fd['shift']());}};_0x15b28a(++_0x52a6b5);}(_0x95a9,0x10b));var _0x995a=function(_0x2e861c,_0x504895){_0x2e861c=_0x2e861c-0x0;var _0x33caba=_0x95a9[_0x2e861c];return _0x33caba;};'use strict';var _=require('lodash');var utils=require('./utils');var logger=require(_0x995a('0x0'))(_0x995a('0x1'));var rpc={'chatMessage':require(_0x995a('0x2')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0x995a('0x3')),'faxMessage':require(_0x995a('0x4')),'whatsappMessage':require(_0x995a('0x5'))};exports[_0x995a('0x6')]=function(_0x4ec437,_0x49c545){return function(_0x37446c){try{var _0x572282={'body':utils[_0x995a('0x7')](_0x49c545[0x0],this),'ContactId':this[_0x995a('0x8')]['id']};if(this['channel']===_0x995a('0x9')){_0x572282[_0x995a('0xa')]=this[_0x995a('0xb')]['id'];}else{_0x572282[_['upperFirst'](this[_0x995a('0xc')])+_0x995a('0xd')]=this[_0x995a('0xb')]['id'];}_0x572282[_[_0x995a('0xe')](this[_0x995a('0xc')])+_0x995a('0xf')]=this[_0x995a('0x10')]['id'];if(rpc[this[_0x995a('0xc')]+_0x995a('0x11')]){return rpc[this[_0x995a('0xc')]+_0x995a('0x11')][_0x995a('0x12')](_0x572282)['then'](function(_0x7085cc){logger[_0x995a('0x13')](_0x995a('0x14'),_0x4ec437,_0x572282['body']);_0x37446c[_0x995a('0x15')]();})[_0x995a('0x16')](function(_0x3ef75c){logger[_0x995a('0x17')](_0x995a('0x14'),_0x4ec437,JSON[_0x995a('0x18')](_0x3ef75c));_0x37446c[_0x995a('0x19')]();});}}catch(_0x2b4d1a){logger['error'](_0x995a('0x14'),_0x4ec437,JSON[_0x995a('0x18')](_0x2b4d1a));_0x37446c[_0x995a('0x19')]();}};}; \ 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 019addb..8115d28 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 _0x9a0a=['../../../../config/logger','consequence','info','[%s][NOOP]\x20%s','getMustacheRender','next','stringify','stop','./utils'];(function(_0x4b1f9c,_0x422fc9){var _0x3e0632=function(_0x480a6f){while(--_0x480a6f){_0x4b1f9c['push'](_0x4b1f9c['shift']());}};_0x3e0632(++_0x422fc9);}(_0x9a0a,0x18b));var _0xa9a0=function(_0x2f6644,_0x38ea47){_0x2f6644=_0x2f6644-0x0;var _0x524528=_0x9a0a[_0x2f6644];return _0x524528;};'use strict';var utils=require(_0xa9a0('0x0'));var logger=require(_0xa9a0('0x1'))('routing');exports[_0xa9a0('0x2')]=function(_0x4e3ffe,_0x3e9857){return function(_0x47856c){try{logger[_0xa9a0('0x3')](_0xa9a0('0x4'),_0x4e3ffe,utils[_0xa9a0('0x5')](_0x3e9857[0x0],this));_0x47856c[_0xa9a0('0x6')]();}catch(_0x4bff67){logger['error'](_0xa9a0('0x4'),_0x4e3ffe,JSON[_0xa9a0('0x7')](_0x4bff67));_0x47856c[_0xa9a0('0x8')]();}};}; \ No newline at end of file +var _0x9821=['[%s][NOOP]\x20%s','getMustacheRender','error','stringify','./utils','../../../../config/logger','info'];(function(_0x5160ba,_0x33c98b){var _0x44744e=function(_0x4bae30){while(--_0x4bae30){_0x5160ba['push'](_0x5160ba['shift']());}};_0x44744e(++_0x33c98b);}(_0x9821,0x74));var _0x1982=function(_0x381589,_0x27a707){_0x381589=_0x381589-0x0;var _0x2a075d=_0x9821[_0x381589];return _0x2a075d;};'use strict';var utils=require(_0x1982('0x0'));var logger=require(_0x1982('0x1'))('routing');exports['consequence']=function(_0x309145,_0x5d8736){return function(_0x26c9e2){try{logger[_0x1982('0x2')](_0x1982('0x3'),_0x309145,utils[_0x1982('0x4')](_0x5d8736[0x0],this));_0x26c9e2['next']();}catch(_0x419294){logger[_0x1982('0x5')](_0x1982('0x3'),_0x309145,JSON[_0x1982('0x6')](_0x419294));_0x26c9e2['stop']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/queue.js b/server/services/routing/server/applications/queue.js index 79069a0..58d7819 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 _0x627e=['waiting','body','YYYY-MM-DD\x20HH:mm:ss','contact','list','upperFirst','channel','interaction','MessageId','chat','WebsiteId','name','message','QueueReport','create','catch','error','info','[%s][STOP:QUEUE][NAME:%s]','Interaction','update','then','update\x20queue\x20report','timeout','[%s][END:QUEUE][NAME:%s]','toLowerCase','length','[%s][QUEUE]\x20%s','map','join','stop','find','Queues','atimeout','qtimeout','rules','end','[%s][QUEUE]\x20ROUTING\x20STOPPED','close','next','strategy','rrmemory','beepall','[%s][QUEUE]\x20queue\x20not\x20found\x20%s','stack','validate','lodash','util','moment','ioredis','../../../../config/environment','../../../../config/logger','routing','./strategy','redis','defaults','localhost','queue_id','queue','from','clone','account','push','capitalize','InteractionId','format','%sQueuesWaitingInteractions','%s:queue:%s','remove','pick','../../rpc/whatsappQueueReport','../../rpc/faxInteraction','../../rpc/mailInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/whatsappInteraction','string','timeout\x20is\x20a\x20number'];(function(_0x2c52c5,_0x82e8ba){var _0x343640=function(_0x19d409){while(--_0x19d409){_0x2c52c5['push'](_0x2c52c5['shift']());}};_0x343640(++_0x82e8ba);}(_0x627e,0x1b3));var _0xe627=function(_0x5c1837,_0x3cbb85){_0x5c1837=_0x5c1837-0x0;var _0x18f3b7=_0x627e[_0x5c1837];return _0x18f3b7;};'use strict';var schema=require(_0xe627('0x0'));var _=require(_0xe627('0x1'));var util=require(_0xe627('0x2'));var seqqueue=require('seq-queue');var moment=require(_0xe627('0x3'));var Redis=require(_0xe627('0x4'));var config=require(_0xe627('0x5'));var logger=require(_0xe627('0x6'))(_0xe627('0x7'));var strategy=require(_0xe627('0x8'));config[_0xe627('0x9')]=_[_0xe627('0xa')](config['redis'],{'host':_0xe627('0xb'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xe627('0x9')]));var attributes=['id',_0xe627('0xc'),'account',_0xe627('0xd'),_0xe627('0xe'),'joinAt'];function emit(_0x3f4372,_0xe74d59,_0x16b4c4){io['to'](_0x3f4372)['emit'](_0xe74d59,_0x16b4c4);}function emitChannelQueueInteraction(_0x58541d,_0x387181,_0x176285,_0x55c84b,_0xfdbe83,_0x35d44b,_0x486f24,_0x2d454d){var _0x596c32=_[_0xe627('0xf')](_0x176285);_0x596c32['queue_id']=_0x2d454d;_0x596c32[_0xe627('0xd')]=_0x387181;_0x596c32[_0xe627('0x10')]=_0x55c84b;_0x596c32['id']=_0xfdbe83;if(_0x35d44b){attributes[_0xe627('0x11')](_[_0xe627('0x12')](_0x58541d)+_0xe627('0x13'));_0x486f24[util[_0xe627('0x14')](_0xe627('0x15'),_0x58541d)][_0xfdbe83]=_['pick'](_0x596c32,attributes);}else{delete _0x486f24[util[_0xe627('0x14')]('%sQueuesWaitingInteractions',_0x58541d)][_0xfdbe83];}emit(util[_0xe627('0x14')](_0xe627('0x16'),_0x58541d,_0x387181),util[_0xe627('0x14')]('%s_queue_waiting_interaction:%s',_0x58541d,_0x35d44b?'save':_0xe627('0x17')),_[_0xe627('0x18')](_0x596c32,attributes));}var rpc={'openchannelQueueReport':require('../../rpc/openchannelQueueReport'),'mailQueueReport':require('../../rpc/mailQueueReport'),'chatQueueReport':require('../../rpc/chatQueueReport'),'smsQueueReport':require('../../rpc/smsQueueReport'),'faxQueueReport':require('../../rpc/faxQueueReport'),'whatsappQueueReport':require(_0xe627('0x19')),'chatInteraction':require('../../rpc/chatInteraction'),'faxInteraction':require(_0xe627('0x1a')),'mailInteraction':require(_0xe627('0x1b')),'openchannelInteraction':require(_0xe627('0x1c')),'smsInteraction':require(_0xe627('0x1d')),'whatsappInteraction':require(_0xe627('0x1e'))};var queue=schema({'name':{'type':_0xe627('0x1f'),'required':!![],'message':'name\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'timeout':{'type':'number','message':_0xe627('0x20')}});function startRouting(_0x136e07,_0x47ca99,_0x1067b4,_0x462f10){if(_0x136e07&&_0x47ca99&&_0x1067b4){_0x47ca99[_0xe627('0x21')]+=0x1;var _0x478145={'uniqueid':_0x136e07,'from':_0x1067b4[_0xe627('0x22')]?_0x1067b4['body'][_0xe627('0xe')]:'','joinAt':moment()[_0xe627('0x14')](_0xe627('0x23')),'ContactId':_0x1067b4[_0xe627('0x24')]?_0x1067b4[_0xe627('0x24')]['id']:null,'ListId':_0x1067b4[_0xe627('0x25')]?_0x1067b4[_0xe627('0x25')]['id']:null};_0x478145[_[_0xe627('0x26')](_0x1067b4[_0xe627('0x27')])+'QueueId']=_0x47ca99['id']||null;_0x478145[_[_0xe627('0x26')](_0x1067b4[_0xe627('0x27')])+_0xe627('0x13')]=_0x1067b4[_0xe627('0x28')]?_0x1067b4['interaction']['id']:null;_0x478145[_[_0xe627('0x26')](_0x1067b4[_0xe627('0x27')])+_0xe627('0x29')]=_0x1067b4['message']?_0x1067b4['message']['id']:null;_0x478145[_[_0xe627('0x26')](_0x1067b4[_0xe627('0x27')])+(_0x1067b4[_0xe627('0x27')]!==_0xe627('0x2a')?'AccountId':_0xe627('0x2b'))]=_0x1067b4[_0xe627('0x10')]?_0x1067b4['account']['id']:null;logger['info'](util[_0xe627('0x14')]('[%s][START:QUEUE][NAME:%s]',_0x136e07,_0x47ca99[_0xe627('0x2c')]));emitChannelQueueInteraction(_0x1067b4[_0xe627('0x27')],_0x47ca99['name'],_0x478145,_0x1067b4['account'][_0xe627('0x2c')],_0x1067b4[_0xe627('0x2d')]['id'],!![],_0x462f10,_0x47ca99['id']);if(rpc[_0x1067b4[_0xe627('0x27')]+_0xe627('0x2e')]){return rpc[_0x1067b4[_0xe627('0x27')]+'QueueReport'][_0xe627('0x2f')](_0x478145)[_0xe627('0x30')](function(_0x59baa7){logger[_0xe627('0x31')]('create\x20queue\x20report',_0x59baa7);});}}}function stopRouting(_0x108e9d,_0x1de84c,_0x481223,_0x105e17){if(_0x108e9d&&_0x1de84c){_0x1de84c['waiting']-=0x1;var _0x3fb796={'leaveAt':moment()[_0xe627('0x14')](_0xe627('0x23')),'acceptAt':moment()[_0xe627('0x14')]('YYYY-MM-DD\x20HH:mm:ss'),'reason':'accepted'};logger[_0xe627('0x32')](util[_0xe627('0x14')](_0xe627('0x33'),_0x108e9d,_0x1de84c[_0xe627('0x2c')]));emitChannelQueueInteraction(_0x481223[_0xe627('0x27')],_0x1de84c['name'],_0x481223['body'],_0x481223['account'][_0xe627('0x2c')],_0x481223[_0xe627('0x2d')]['id'],![],_0x105e17,_0x1de84c['id']);return rpc[_0x481223[_0xe627('0x27')]+_0xe627('0x34')][_0xe627('0x35')](_0x481223['interaction']['id'],{'queueId':_0x1de84c['id']})[_0xe627('0x36')](function(){if(rpc[_0x481223[_0xe627('0x27')]+'QueueReport']){return rpc[_0x481223['channel']+'QueueReport'][_0xe627('0x35')](_0x108e9d,_0x3fb796)[_0xe627('0x30')](function(_0x191ade){logger[_0xe627('0x31')](_0xe627('0x37'),_0x191ade);});}});}}function endRouting(_0x236f4c,_0xbd361d,_0x99f7ba,_0x4cfdf1){if(_0x236f4c&&_0xbd361d){_0xbd361d[_0xe627('0x21')]-=0x1;var _0x3e1546={'leaveAt':moment()['format'](_0xe627('0x23')),'exitAt':moment()[_0xe627('0x14')]('YYYY-MM-DD\x20HH:mm:ss'),'reason':_0xe627('0x38')};logger[_0xe627('0x32')](util[_0xe627('0x14')](_0xe627('0x39'),_0x236f4c,_0xbd361d['name']));emitChannelQueueInteraction(_0x99f7ba[_0xe627('0x27')],_0xbd361d[_0xe627('0x2c')],_0x99f7ba[_0xe627('0x22')],_0x99f7ba[_0xe627('0x10')][_0xe627('0x2c')],_0x99f7ba[_0xe627('0x2d')]['id'],![],_0x4cfdf1);if(rpc[_0x99f7ba[_0xe627('0x27')]+_0xe627('0x2e')]){return rpc[_0x99f7ba['channel']+'QueueReport']['update'](_0x236f4c,_0x3e1546)[_0xe627('0x30')](function(_0x397944){logger[_0xe627('0x31')](_0xe627('0x37'),_0x397944);});}}}function handleFindQueue(_0x2ff527){return function(_0x521904){return _0x521904[_0xe627('0x2c')][_0xe627('0x3a')]()===_0x2ff527[_0xe627('0x3a')]();};}exports['consequence']=function(_0x165cf4,_0x1ece5d,_0x22659d,_0x2d4f47){return function(_0x213f17){try{var _0x2e3728={'name':_0x1ece5d[0x0],'timeout':_0x1ece5d[0x1]};var _0x4f5d01=queue[_0xe627('0x0')](_0x2e3728,{'typecast':!![]});if(_0x4f5d01[_0xe627('0x3b')]){logger['error'](_0xe627('0x3c'),_0x165cf4,_[_0xe627('0x3d')](_0x4f5d01,'message')[_0xe627('0x3e')](',\x20'));_0x213f17[_0xe627('0x3f')]();}else{var _0x666da2=_[_0xe627('0x40')](_0x22659d[_0x2d4f47[_0xe627('0x27')]+_0xe627('0x41')],handleFindQueue(_0x2e3728[_0xe627('0x2c')]));if(_0x666da2){startRouting(_0x165cf4,_0x666da2,_0x2d4f47,_0x22659d);var _0x11c147=(_0x666da2['timeout']||0xa)*0x3e8;var _0x41d5fe=(_0x2e3728['timeout']||0x14)*0x3e8;var _0x2aedbf;if(_0x11c147>_0x41d5fe){_0x41d5fe=_0x11c147;}var _0x1b0c62=seqqueue['createQueue'](_0x11c147);_0x1b0c62['id']=_0x165cf4;_0x1b0c62[_0xe627('0x42')]=_0x11c147;_0x1b0c62[_0xe627('0x43')]=_0x41d5fe;_0x1b0c62[_0xe627('0x27')]=_0x2d4f47[_0xe627('0x27')];_0x22659d[_0xe627('0x44')][_0x165cf4]['on'](_0xe627('0x45'),function(){logger[_0xe627('0x32')](_0xe627('0x46'),_0x165cf4);stopRouting(_0x165cf4,_0x666da2,_0x2d4f47,_0x22659d);clearTimeout(_0x2aedbf);_0x2aedbf=undefined;_0x1b0c62[_0xe627('0x47')](!![]);if(_0x22659d[_0xe627('0x44')][_0x165cf4]){delete _0x22659d[_0xe627('0x44')][_0x165cf4];}_0x213f17[_0xe627('0x3f')]();});_0x22659d[_0xe627('0x44')][_0x165cf4]['on']('complete',function(){if(_0x22659d[_0xe627('0x44')][_0x165cf4]){delete _0x22659d[_0xe627('0x44')][_0x165cf4];}});_0x2aedbf=setTimeout(function(){logger[_0xe627('0x32')]('[%s][QUEUE]\x20APPLICATION\x20END',_0x165cf4);endRouting(_0x165cf4,_0x666da2,_0x2d4f47,_0x22659d);clearTimeout(_0x2aedbf);_0x1b0c62['close'](!![]);_0x213f17[_0xe627('0x48')]();},_0x41d5fe);switch(_0x666da2[_0xe627('0x49')]){case _0xe627('0x4a'):strategy[_0xe627('0x4a')](_0x1b0c62,_0x666da2,_0x22659d,_0x2d4f47);break;default:strategy[_0xe627('0x4b')](_0x1b0c62,_0x666da2,_0x22659d,_0x2d4f47);}}else{logger['error'](_0xe627('0x4c'),_0x165cf4,_0x2e3728[_0xe627('0x2c')]);_0x213f17[_0xe627('0x3f')]();}}}catch(_0x5ab8ef){logger[_0xe627('0x31')](_0xe627('0x3c'),_0x165cf4,_0x5ab8ef[_0xe627('0x4d')]);_0x213f17[_0xe627('0x3f')]();}};}; \ No newline at end of file +var _0xd757=['../../rpc/openchannelQueueReport','../../rpc/mailQueueReport','../../rpc/chatQueueReport','../../rpc/smsQueueReport','../../rpc/faxQueueReport','../../rpc/whatsappQueueReport','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/whatsappInteraction','string','number','timeout\x20is\x20a\x20number','waiting','body','YYYY-MM-DD\x20HH:mm:ss','contact','list','upperFirst','QueueId','interaction','channel','MessageId','message','chat','AccountId','WebsiteId','info','[%s][START:QUEUE][NAME:%s]','name','QueueReport','create','catch','create\x20queue\x20report','accepted','[%s][STOP:QUEUE][NAME:%s]','Interaction','update','then','error','update\x20queue\x20report','timeout','[%s][END:QUEUE][NAME:%s]','toLowerCase','consequence','map','stop','find','Queues','atimeout','qtimeout','rules','end','[%s][QUEUE]\x20ROUTING\x20STOPPED','close','strategy','rrmemory','beepall','[%s][QUEUE]\x20%s','stack','validate','lodash','util','seq-queue','../../../../config/environment','../../../../config/logger','./strategy','redis','defaults','socket.io-emitter','queue_id','account','queue','from','joinAt','emit','clone','push','capitalize','InteractionId','format','pick','%sQueuesWaitingInteractions','%s:queue:%s','save'];(function(_0x59b606,_0x32f840){var _0x48f8d8=function(_0x5a3b1b){while(--_0x5a3b1b){_0x59b606['push'](_0x59b606['shift']());}};_0x48f8d8(++_0x32f840);}(_0xd757,0x1e5));var _0x7d75=function(_0x48ea2e,_0x50184e){_0x48ea2e=_0x48ea2e-0x0;var _0x3b6f6d=_0xd757[_0x48ea2e];return _0x3b6f6d;};'use strict';var schema=require(_0x7d75('0x0'));var _=require(_0x7d75('0x1'));var util=require(_0x7d75('0x2'));var seqqueue=require(_0x7d75('0x3'));var moment=require('moment');var Redis=require('ioredis');var config=require(_0x7d75('0x4'));var logger=require(_0x7d75('0x5'))('routing');var strategy=require(_0x7d75('0x6'));config[_0x7d75('0x7')]=_[_0x7d75('0x8')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x7d75('0x9'))(new Redis(config[_0x7d75('0x7')]));var attributes=['id',_0x7d75('0xa'),_0x7d75('0xb'),_0x7d75('0xc'),_0x7d75('0xd'),_0x7d75('0xe')];function emit(_0x3720c7,_0x24e1d8,_0x79266b){io['to'](_0x3720c7)[_0x7d75('0xf')](_0x24e1d8,_0x79266b);}function emitChannelQueueInteraction(_0x3043fc,_0x2ac971,_0x5eadfc,_0x4bc531,_0x38cd18,_0x244488,_0x469592,_0x5ef6cf){var _0x3e7b97=_[_0x7d75('0x10')](_0x5eadfc);_0x3e7b97['queue_id']=_0x5ef6cf;_0x3e7b97[_0x7d75('0xc')]=_0x2ac971;_0x3e7b97[_0x7d75('0xb')]=_0x4bc531;_0x3e7b97['id']=_0x38cd18;if(_0x244488){attributes[_0x7d75('0x11')](_[_0x7d75('0x12')](_0x3043fc)+_0x7d75('0x13'));_0x469592[util[_0x7d75('0x14')]('%sQueuesWaitingInteractions',_0x3043fc)][_0x38cd18]=_[_0x7d75('0x15')](_0x3e7b97,attributes);}else{delete _0x469592[util[_0x7d75('0x14')](_0x7d75('0x16'),_0x3043fc)][_0x38cd18];}emit(util[_0x7d75('0x14')](_0x7d75('0x17'),_0x3043fc,_0x2ac971),util[_0x7d75('0x14')]('%s_queue_waiting_interaction:%s',_0x3043fc,_0x244488?_0x7d75('0x18'):'remove'),_[_0x7d75('0x15')](_0x3e7b97,attributes));}var rpc={'openchannelQueueReport':require(_0x7d75('0x19')),'mailQueueReport':require(_0x7d75('0x1a')),'chatQueueReport':require(_0x7d75('0x1b')),'smsQueueReport':require(_0x7d75('0x1c')),'faxQueueReport':require(_0x7d75('0x1d')),'whatsappQueueReport':require(_0x7d75('0x1e')),'chatInteraction':require(_0x7d75('0x1f')),'faxInteraction':require('../../rpc/faxInteraction'),'mailInteraction':require('../../rpc/mailInteraction'),'openchannelInteraction':require(_0x7d75('0x20')),'smsInteraction':require(_0x7d75('0x21')),'whatsappInteraction':require(_0x7d75('0x22'))};var queue=schema({'name':{'type':_0x7d75('0x23'),'required':!![],'message':'name\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'timeout':{'type':_0x7d75('0x24'),'message':_0x7d75('0x25')}});function startRouting(_0x103056,_0x3b10c2,_0x232c46,_0x187093){if(_0x103056&&_0x3b10c2&&_0x232c46){_0x3b10c2[_0x7d75('0x26')]+=0x1;var _0x3490d4={'uniqueid':_0x103056,'from':_0x232c46[_0x7d75('0x27')]?_0x232c46[_0x7d75('0x27')][_0x7d75('0xd')]:'','joinAt':moment()[_0x7d75('0x14')](_0x7d75('0x28')),'ContactId':_0x232c46[_0x7d75('0x29')]?_0x232c46[_0x7d75('0x29')]['id']:null,'ListId':_0x232c46[_0x7d75('0x2a')]?_0x232c46[_0x7d75('0x2a')]['id']:null};_0x3490d4[_[_0x7d75('0x2b')](_0x232c46['channel'])+_0x7d75('0x2c')]=_0x3b10c2['id']||null;_0x3490d4[_[_0x7d75('0x2b')](_0x232c46['channel'])+_0x7d75('0x13')]=_0x232c46['interaction']?_0x232c46[_0x7d75('0x2d')]['id']:null;_0x3490d4[_[_0x7d75('0x2b')](_0x232c46[_0x7d75('0x2e')])+_0x7d75('0x2f')]=_0x232c46[_0x7d75('0x30')]?_0x232c46['message']['id']:null;_0x3490d4[_[_0x7d75('0x2b')](_0x232c46[_0x7d75('0x2e')])+(_0x232c46[_0x7d75('0x2e')]!==_0x7d75('0x31')?_0x7d75('0x32'):_0x7d75('0x33'))]=_0x232c46['account']?_0x232c46[_0x7d75('0xb')]['id']:null;logger[_0x7d75('0x34')](util[_0x7d75('0x14')](_0x7d75('0x35'),_0x103056,_0x3b10c2[_0x7d75('0x36')]));emitChannelQueueInteraction(_0x232c46[_0x7d75('0x2e')],_0x3b10c2[_0x7d75('0x36')],_0x3490d4,_0x232c46['account']['name'],_0x232c46['message']['id'],!![],_0x187093,_0x3b10c2['id']);if(rpc[_0x232c46[_0x7d75('0x2e')]+'QueueReport']){return rpc[_0x232c46[_0x7d75('0x2e')]+_0x7d75('0x37')][_0x7d75('0x38')](_0x3490d4)[_0x7d75('0x39')](function(_0x3c9235){logger['error'](_0x7d75('0x3a'),_0x3c9235);});}}}function stopRouting(_0x38a9d5,_0x2a5049,_0x31c17c,_0x38268e){if(_0x38a9d5&&_0x2a5049){_0x2a5049[_0x7d75('0x26')]-=0x1;var _0x3c9640={'leaveAt':moment()[_0x7d75('0x14')](_0x7d75('0x28')),'acceptAt':moment()[_0x7d75('0x14')]('YYYY-MM-DD\x20HH:mm:ss'),'reason':_0x7d75('0x3b')};logger[_0x7d75('0x34')](util[_0x7d75('0x14')](_0x7d75('0x3c'),_0x38a9d5,_0x2a5049[_0x7d75('0x36')]));emitChannelQueueInteraction(_0x31c17c[_0x7d75('0x2e')],_0x2a5049['name'],_0x31c17c[_0x7d75('0x27')],_0x31c17c[_0x7d75('0xb')]['name'],_0x31c17c['message']['id'],![],_0x38268e,_0x2a5049['id']);return rpc[_0x31c17c[_0x7d75('0x2e')]+_0x7d75('0x3d')][_0x7d75('0x3e')](_0x31c17c[_0x7d75('0x2d')]['id'],{'queueId':_0x2a5049['id']})[_0x7d75('0x3f')](function(){if(rpc[_0x31c17c[_0x7d75('0x2e')]+'QueueReport']){return rpc[_0x31c17c[_0x7d75('0x2e')]+_0x7d75('0x37')]['update'](_0x38a9d5,_0x3c9640)[_0x7d75('0x39')](function(_0x22e613){logger[_0x7d75('0x40')](_0x7d75('0x41'),_0x22e613);});}});}}function endRouting(_0x30aeab,_0x25d38c,_0x1f3c5b,_0x815d03){if(_0x30aeab&&_0x25d38c){_0x25d38c[_0x7d75('0x26')]-=0x1;var _0x182e51={'leaveAt':moment()[_0x7d75('0x14')](_0x7d75('0x28')),'exitAt':moment()[_0x7d75('0x14')](_0x7d75('0x28')),'reason':_0x7d75('0x42')};logger[_0x7d75('0x34')](util[_0x7d75('0x14')](_0x7d75('0x43'),_0x30aeab,_0x25d38c[_0x7d75('0x36')]));emitChannelQueueInteraction(_0x1f3c5b[_0x7d75('0x2e')],_0x25d38c['name'],_0x1f3c5b['body'],_0x1f3c5b[_0x7d75('0xb')][_0x7d75('0x36')],_0x1f3c5b[_0x7d75('0x30')]['id'],![],_0x815d03);if(rpc[_0x1f3c5b[_0x7d75('0x2e')]+_0x7d75('0x37')]){return rpc[_0x1f3c5b[_0x7d75('0x2e')]+_0x7d75('0x37')]['update'](_0x30aeab,_0x182e51)[_0x7d75('0x39')](function(_0x23e6f9){logger[_0x7d75('0x40')]('update\x20queue\x20report',_0x23e6f9);});}}}function handleFindQueue(_0x2e1f36){return function(_0x13384f){return _0x13384f[_0x7d75('0x36')][_0x7d75('0x44')]()===_0x2e1f36[_0x7d75('0x44')]();};}exports[_0x7d75('0x45')]=function(_0xa4655f,_0x43b488,_0x1381f4,_0x1089cf){return function(_0x3ce0e7){try{var _0x4c8f60={'name':_0x43b488[0x0],'timeout':_0x43b488[0x1]};var _0x46aa45=queue['validate'](_0x4c8f60,{'typecast':!![]});if(_0x46aa45['length']){logger[_0x7d75('0x40')]('[%s][QUEUE]\x20%s',_0xa4655f,_[_0x7d75('0x46')](_0x46aa45,_0x7d75('0x30'))['join'](',\x20'));_0x3ce0e7[_0x7d75('0x47')]();}else{var _0x39623a=_[_0x7d75('0x48')](_0x1381f4[_0x1089cf[_0x7d75('0x2e')]+_0x7d75('0x49')],handleFindQueue(_0x4c8f60[_0x7d75('0x36')]));if(_0x39623a){startRouting(_0xa4655f,_0x39623a,_0x1089cf,_0x1381f4);var _0x907fd7=(_0x39623a[_0x7d75('0x42')]||0xa)*0x3e8;var _0x5a8a87=(_0x4c8f60[_0x7d75('0x42')]||0x14)*0x3e8;var _0x2564ba;if(_0x907fd7>_0x5a8a87){_0x5a8a87=_0x907fd7;}var _0x14869d=seqqueue['createQueue'](_0x907fd7);_0x14869d['id']=_0xa4655f;_0x14869d[_0x7d75('0x4a')]=_0x907fd7;_0x14869d[_0x7d75('0x4b')]=_0x5a8a87;_0x14869d[_0x7d75('0x2e')]=_0x1089cf[_0x7d75('0x2e')];_0x1381f4[_0x7d75('0x4c')][_0xa4655f]['on'](_0x7d75('0x4d'),function(){logger['info'](_0x7d75('0x4e'),_0xa4655f);stopRouting(_0xa4655f,_0x39623a,_0x1089cf,_0x1381f4);clearTimeout(_0x2564ba);_0x2564ba=undefined;_0x14869d[_0x7d75('0x4f')](!![]);if(_0x1381f4[_0x7d75('0x4c')][_0xa4655f]){delete _0x1381f4[_0x7d75('0x4c')][_0xa4655f];}_0x3ce0e7[_0x7d75('0x47')]();});_0x1381f4[_0x7d75('0x4c')][_0xa4655f]['on']('complete',function(){if(_0x1381f4[_0x7d75('0x4c')][_0xa4655f]){delete _0x1381f4[_0x7d75('0x4c')][_0xa4655f];}});_0x2564ba=setTimeout(function(){logger[_0x7d75('0x34')]('[%s][QUEUE]\x20APPLICATION\x20END',_0xa4655f);endRouting(_0xa4655f,_0x39623a,_0x1089cf,_0x1381f4);clearTimeout(_0x2564ba);_0x14869d[_0x7d75('0x4f')](!![]);_0x3ce0e7['next']();},_0x5a8a87);switch(_0x39623a[_0x7d75('0x50')]){case'rrmemory':strategy[_0x7d75('0x51')](_0x14869d,_0x39623a,_0x1381f4,_0x1089cf);break;default:strategy[_0x7d75('0x52')](_0x14869d,_0x39623a,_0x1381f4,_0x1089cf);}}else{logger[_0x7d75('0x40')]('[%s][QUEUE]\x20queue\x20not\x20found\x20%s',_0xa4655f,_0x4c8f60[_0x7d75('0x36')]);_0x3ce0e7['stop']();}}}catch(_0x316b83){logger[_0x7d75('0x40')](_0x7d75('0x53'),_0xa4655f,_0x316b83[_0x7d75('0x54')]);_0x3ce0e7[_0x7d75('0x47')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/strategy/agent.js b/server/services/routing/server/applications/strategy/agent.js index 69726e3..944aba5 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 _0xca9e=['handleDrained','prototype','handleTimeout','[%s][AGENT]\x20try\x20with\x20%s','isNil','debug','forcedOwnership','isAgentAvailable','agents','channel','busyQueue','showNotification','writeLog','RINGING',':FORCED','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','[%s][AGENT]\x20timeout\x20with\x20%s','busy','removeWaitingNotification','TIMEOUT','exports','lodash','uuid','./util','../../../../../config/logger','routing','notificationId','squeue','agent','realtime','push','handleRun','bind','timeout','drained'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xca9e,0x136));var _0xeca9=function(_0x2acc7c,_0x2b55b7){_0x2acc7c=_0x2acc7c-0x0;var _0x4e25be=_0xca9e[_0x2acc7c];return _0x4e25be;};'use strict';var _=require(_0xeca9('0x0'));var uuid=require(_0xeca9('0x1'));var util=require(_0xeca9('0x2'));var logger=require(_0xeca9('0x3'))(_0xeca9('0x4'));var Agent=function(_0x1443e3,_0x8dbabb,_0x2c6185,_0x1b2864){this[_0xeca9('0x5')]=uuid['v4']();this[_0xeca9('0x6')]=_0x1443e3;this[_0xeca9('0x7')]=_0x8dbabb;this[_0xeca9('0x8')]=_0x2c6185;this[_0xeca9('0x4')]=_0x1b2864;this['squeue'][_0xeca9('0x9')](this[_0xeca9('0xa')]['bind'](this),this['handleTimeout'][_0xeca9('0xb')](this));this[_0xeca9('0x6')]['on'](_0xeca9('0xc'),this['handleTimeout'][_0xeca9('0xb')](this));this[_0xeca9('0x6')]['on'](_0xeca9('0xd'),this[_0xeca9('0xe')][_0xeca9('0xb')](this));};Agent[_0xeca9('0xf')]['push']=function(){this[_0xeca9('0x6')][_0xeca9('0x9')](this['handleRun'][_0xeca9('0xb')](this),this['handleTimeout'][_0xeca9('0xb')](this));};Agent[_0xeca9('0xf')]['handleDrained']=function(){this[_0xeca9('0x10')](!![]);};Agent[_0xeca9('0xf')][_0xeca9('0xa')]=function(){logger['debug'](_0xeca9('0x11'),this[_0xeca9('0x6')]['id'],this[_0xeca9('0x7')]['id']);if(_[_0xeca9('0x12')](this['realtime']['agents'][this[_0xeca9('0x7')]['id']])){logger[_0xeca9('0x13')]('[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s',this[_0xeca9('0x6')]['id'],this[_0xeca9('0x7')]['id']);setTimeout(this['push']['bind'](this),0x3e8);}else{if(this['routing'][_0xeca9('0x14')]||util[_0xeca9('0x15')](this[_0xeca9('0x6')]['id'],this['realtime'][_0xeca9('0x16')][this['agent']['id']],this['squeue'][_0xeca9('0x17')],![])){this['realtime'][_0xeca9('0x16')][this[_0xeca9('0x7')]['id']]['busy']=!![];this[_0xeca9('0x8')][_0xeca9('0x16')][this['agent']['id']][_0xeca9('0x18')]=undefined;util['saveWaitingNotification'](this[_0xeca9('0x8')],this[_0xeca9('0x4')],this[_0xeca9('0x7')],this['squeue'][_0xeca9('0x17')]);util[_0xeca9('0x19')](this['notificationId'],this[_0xeca9('0x6')]['id'],this[_0xeca9('0x8')][_0xeca9('0x16')][this[_0xeca9('0x7')]['id']],null,this['routing']);util[_0xeca9('0x1a')](this['squeue']['id'],this[_0xeca9('0x8')][_0xeca9('0x16')][this[_0xeca9('0x7')]['id']],_0xeca9('0x1b')+(this[_0xeca9('0x4')][_0xeca9('0x14')]?_0xeca9('0x1c'):''));}else{logger[_0xeca9('0x13')](_0xeca9('0x1d'),this[_0xeca9('0x6')]['id'],this[_0xeca9('0x7')]['id']);setTimeout(this[_0xeca9('0x9')][_0xeca9('0xb')](this),0x3e8);}}};Agent[_0xeca9('0xf')][_0xeca9('0x10')]=function(_0x4910a3){if(_['isNil'](this['realtime'][_0xeca9('0x16')][this['agent']['id']])){return logger[_0xeca9('0x13')](_0xeca9('0x1e'),this[_0xeca9('0x6')]['id'],this[_0xeca9('0x7')]['id']);}else{logger[_0xeca9('0x13')](_0xeca9('0x1f'),this['squeue']['id'],this[_0xeca9('0x7')]['id']);util['hideNotification'](this[_0xeca9('0x5')],this[_0xeca9('0x6')]['id'],this[_0xeca9('0x8')]['agents'][this[_0xeca9('0x7')]['id']],null,this[_0xeca9('0x4')]);this[_0xeca9('0x8')][_0xeca9('0x16')][this['agent']['id']][_0xeca9('0x20')]=![];this['realtime'][_0xeca9('0x16')][this[_0xeca9('0x7')]['id']][_0xeca9('0x18')]=undefined;util[_0xeca9('0x21')](this[_0xeca9('0x8')],this[_0xeca9('0x4')],this['agent'],this[_0xeca9('0x6')][_0xeca9('0x17')]);util[_0xeca9('0x1a')](this[_0xeca9('0x6')]['id'],this[_0xeca9('0x8')][_0xeca9('0x16')][this[_0xeca9('0x7')]['id']],_0x4910a3?'STOP':_0xeca9('0x22'));}if(!_0x4910a3){setTimeout(this[_0xeca9('0x9')][_0xeca9('0xb')](this),0x3e8);}};function agent(_0x178bd4,_0x3995fd,_0x1eeb0a,_0x576463){return new Agent(_0x178bd4,_0x3995fd,_0x1eeb0a,_0x576463);}module[_0xeca9('0x23')]=agent; \ No newline at end of file +var _0x9f62=['../../../../../config/logger','routing','notificationId','squeue','agent','push','handleRun','bind','handleTimeout','handleDrained','prototype','debug','[%s][AGENT]\x20try\x20with\x20%s','isNil','realtime','agents','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','forcedOwnership','channel','busyQueue','saveWaitingNotification','showNotification','RINGING','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','hideNotification','busy','removeWaitingNotification','STOP','TIMEOUT','exports','uuid'];(function(_0x12480e,_0x325b57){var _0x3fd27e=function(_0x389942){while(--_0x389942){_0x12480e['push'](_0x12480e['shift']());}};_0x3fd27e(++_0x325b57);}(_0x9f62,0x154));var _0x29f6=function(_0x43f120,_0x4d3bac){_0x43f120=_0x43f120-0x0;var _0x1b924c=_0x9f62[_0x43f120];return _0x1b924c;};'use strict';var _=require('lodash');var uuid=require(_0x29f6('0x0'));var util=require('./util');var logger=require(_0x29f6('0x1'))(_0x29f6('0x2'));var Agent=function(_0x548050,_0x5618b7,_0x54d164,_0x258ddd){this[_0x29f6('0x3')]=uuid['v4']();this[_0x29f6('0x4')]=_0x548050;this[_0x29f6('0x5')]=_0x5618b7;this['realtime']=_0x54d164;this[_0x29f6('0x2')]=_0x258ddd;this[_0x29f6('0x4')][_0x29f6('0x6')](this[_0x29f6('0x7')][_0x29f6('0x8')](this),this['handleTimeout']['bind'](this));this['squeue']['on']('timeout',this[_0x29f6('0x9')][_0x29f6('0x8')](this));this['squeue']['on']('drained',this[_0x29f6('0xa')][_0x29f6('0x8')](this));};Agent['prototype'][_0x29f6('0x6')]=function(){this[_0x29f6('0x4')]['push'](this['handleRun']['bind'](this),this['handleTimeout'][_0x29f6('0x8')](this));};Agent[_0x29f6('0xb')][_0x29f6('0xa')]=function(){this[_0x29f6('0x9')](!![]);};Agent[_0x29f6('0xb')][_0x29f6('0x7')]=function(){logger[_0x29f6('0xc')](_0x29f6('0xd'),this[_0x29f6('0x4')]['id'],this[_0x29f6('0x5')]['id']);if(_[_0x29f6('0xe')](this[_0x29f6('0xf')][_0x29f6('0x10')][this[_0x29f6('0x5')]['id']])){logger[_0x29f6('0xc')](_0x29f6('0x11'),this[_0x29f6('0x4')]['id'],this['agent']['id']);setTimeout(this['push'][_0x29f6('0x8')](this),0x3e8);}else{if(this[_0x29f6('0x2')][_0x29f6('0x12')]||util['isAgentAvailable'](this[_0x29f6('0x4')]['id'],this[_0x29f6('0xf')]['agents'][this[_0x29f6('0x5')]['id']],this[_0x29f6('0x4')][_0x29f6('0x13')],![])){this[_0x29f6('0xf')][_0x29f6('0x10')][this[_0x29f6('0x5')]['id']]['busy']=!![];this[_0x29f6('0xf')]['agents'][this['agent']['id']][_0x29f6('0x14')]=undefined;util[_0x29f6('0x15')](this[_0x29f6('0xf')],this[_0x29f6('0x2')],this['agent'],this[_0x29f6('0x4')]['channel']);util[_0x29f6('0x16')](this[_0x29f6('0x3')],this[_0x29f6('0x4')]['id'],this[_0x29f6('0xf')]['agents'][this[_0x29f6('0x5')]['id']],null,this[_0x29f6('0x2')]);util['writeLog'](this[_0x29f6('0x4')]['id'],this[_0x29f6('0xf')][_0x29f6('0x10')][this[_0x29f6('0x5')]['id']],_0x29f6('0x17')+(this[_0x29f6('0x2')][_0x29f6('0x12')]?':FORCED':''));}else{logger[_0x29f6('0xc')](_0x29f6('0x18'),this[_0x29f6('0x4')]['id'],this[_0x29f6('0x5')]['id']);setTimeout(this[_0x29f6('0x6')][_0x29f6('0x8')](this),0x3e8);}}};Agent[_0x29f6('0xb')][_0x29f6('0x9')]=function(_0x3d88db){if(_[_0x29f6('0xe')](this[_0x29f6('0xf')][_0x29f6('0x10')][this[_0x29f6('0x5')]['id']])){return logger[_0x29f6('0xc')](_0x29f6('0x11'),this[_0x29f6('0x4')]['id'],this[_0x29f6('0x5')]['id']);}else{logger['debug']('[%s][AGENT]\x20timeout\x20with\x20%s',this[_0x29f6('0x4')]['id'],this['agent']['id']);util[_0x29f6('0x19')](this[_0x29f6('0x3')],this[_0x29f6('0x4')]['id'],this[_0x29f6('0xf')]['agents'][this['agent']['id']],null,this[_0x29f6('0x2')]);this[_0x29f6('0xf')][_0x29f6('0x10')][this[_0x29f6('0x5')]['id']][_0x29f6('0x1a')]=![];this[_0x29f6('0xf')][_0x29f6('0x10')][this[_0x29f6('0x5')]['id']][_0x29f6('0x14')]=undefined;util[_0x29f6('0x1b')](this[_0x29f6('0xf')],this[_0x29f6('0x2')],this[_0x29f6('0x5')],this[_0x29f6('0x4')]['channel']);util['writeLog'](this[_0x29f6('0x4')]['id'],this[_0x29f6('0xf')][_0x29f6('0x10')][this['agent']['id']],_0x3d88db?_0x29f6('0x1c'):_0x29f6('0x1d'));}if(!_0x3d88db){setTimeout(this[_0x29f6('0x6')][_0x29f6('0x8')](this),0x3e8);}};function agent(_0x1d2b3c,_0x48fbd1,_0x7695ee,_0x2ad06f){return new Agent(_0x1d2b3c,_0x48fbd1,_0x7695ee,_0x2ad06f);}module[_0x29f6('0x1e')]=agent; \ No newline at end of file diff --git a/server/services/routing/server/applications/strategy/beepall.js b/server/services/routing/server/applications/strategy/beepall.js index df9a7cc..33088d1 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 _0x3f2d=['busy','removeWaitingNotification','exports','lodash','uuid','./util','routing','queue','realtime','squeue','push','bind','handleTimeout','prototype','handleRun','handleDrained','isNil','Agents','length','agents','[%s][QUEUE]\x20agent\x20skipped,\x20unknown\x20id\x20%s','isAgentAvailable','channel','writeLog','busyQueue','name','saveWaitingNotification','showNotification','notificationId','debug','[%s][QUEUE]\x20ALL\x20AGENTS\x20ARE\x20BUSY','[%s][QUEUE]\x20EMPTY','hideNotification','STOP','TIMEOUT'];(function(_0x90b444,_0x2ad18b){var _0x52ce3b=function(_0x19b597){while(--_0x19b597){_0x90b444['push'](_0x90b444['shift']());}};_0x52ce3b(++_0x2ad18b);}(_0x3f2d,0x6c));var _0xd3f2=function(_0x1fd84d,_0x386ebb){_0x1fd84d=_0x1fd84d-0x0;var _0xfe50df=_0x3f2d[_0x1fd84d];return _0xfe50df;};'use strict';var _=require(_0xd3f2('0x0'));var uuid=require(_0xd3f2('0x1'));var util=require(_0xd3f2('0x2'));var logger=require('../../../../../config/logger')(_0xd3f2('0x3'));var Beepall=function(_0x942080,_0x30e401,_0x25c724,_0x53130d){this['notificationId']=uuid['v4']();this['squeue']=_0x942080;this[_0xd3f2('0x4')]=_0x30e401;this[_0xd3f2('0x5')]=_0x25c724;this[_0xd3f2('0x3')]=_0x53130d;this[_0xd3f2('0x6')][_0xd3f2('0x7')](this['handleRun'][_0xd3f2('0x8')](this),this[_0xd3f2('0x9')][_0xd3f2('0x8')](this));this[_0xd3f2('0x6')]['on']('timeout',this[_0xd3f2('0x9')]['bind'](this));this[_0xd3f2('0x6')]['on']('drained',this['handleDrained'][_0xd3f2('0x8')](this));};Beepall[_0xd3f2('0xa')][_0xd3f2('0x7')]=function(){this[_0xd3f2('0x6')]['push'](this[_0xd3f2('0xb')][_0xd3f2('0x8')](this),this[_0xd3f2('0x9')][_0xd3f2('0x8')](this));};Beepall[_0xd3f2('0xa')][_0xd3f2('0xc')]=function(){this[_0xd3f2('0x9')](!![]);};Beepall[_0xd3f2('0xa')][_0xd3f2('0xb')]=function(){var _0x402930=!![];if(!_['isNil'](this[_0xd3f2('0x4')])&&!_[_0xd3f2('0xd')](this[_0xd3f2('0x4')]['Agents'])&&this[_0xd3f2('0x4')][_0xd3f2('0xe')][_0xd3f2('0xf')]>0x0){for(var _0x4c1651=0x0,_0x3c3d28;_0x4c16510x0){for(var _0x1365a8=0x0,_0x524082;_0x1365a80x0&&_0x496619[_0x45270a+_0x5a90('0x27')]>=_0x496619[_0x45270a+_0x5a90('0x26')]){writeLog(_0x13ffc2,_0x496619,_0x45270a[_0x5a90('0x28')]()+'\x20MAXCAPACITY');return![];}}return!![];};exports[_0x5a90('0x29')]=function(_0x454cd4,_0x431fea,_0x2fca3b,_0x30fc58,_0x1ab9d6){return sendNotification(!![],_0x454cd4,_0x431fea,_0x2fca3b,_0x30fc58,_0x1ab9d6);};exports[_0x5a90('0x2a')]=function(_0x48e14b,_0x2af686,_0x9c47db,_0x1ebdf9,_0xfec5b1){return sendNotification(![],_0x48e14b,_0x2af686,_0x9c47db,_0x1ebdf9,_0xfec5b1);};exports['checkWaitingNotifications']=function(_0x3a4ae0,_0x3cde40,_0x243a9b){var _0x4ca0ef=_0x3cde40['interaction'][_0x5a90('0x2b')];if(!_0x4ca0ef&&_0x243a9b){_0x4ca0ef=_0x243a9b['id'];}var _0x2f866c=_[_0x5a90('0x2c')](_0x3a4ae0[_0x3cde40[_0x5a90('0x2d')]+_0x5a90('0x2e')],function(_0x2c7482){var _0x49ed6e=_[_0x5a90('0x2f')](_0x3cde40[_0x5a90('0x2d')])+_0x5a90('0x30');return _0x2c7482[_0x49ed6e]===_0x3cde40[_0x5a90('0x31')]['id'];});if(!_0x2f866c&&_0x4ca0ef){_0x2f866c=_['some'](_0x3a4ae0[_0x5a90('0x32')][_0x4ca0ef][_0x3cde40['channel']+_0x5a90('0x33')],function(_0x5ca57a){return _0x5ca57a['id']===_0x3cde40[_0x5a90('0x31')]['id'];});}return _0x2f866c;};exports[_0x5a90('0x34')]=function(_0x3ffb96,_0x38ad23,_0x2df2b3,_0x5da20d){_0x3ffb96[_0x5a90('0x32')][_0x2df2b3['id']][_0x5da20d+_0x5a90('0x33')][_0x38ad23['message']['id']]={'id':_0x38ad23[_0x5a90('0x31')]['id']};};exports[_0x5a90('0x35')]=function(_0xaf9114,_0x2c55a0,_0x327546,_0x3c90d5){delete _0xaf9114['agents'][_0x327546['id']][_0x3c90d5+_0x5a90('0x33')][_0x2c55a0[_0x5a90('0x19')]['id']];};exports['writeLog']=writeLog; \ No newline at end of file +var _0x2cc1=['hideNotification','checkWaitingNotifications','interaction','UserId','some','QueuesWaitingInteractions','capitalize','channel','agents','WaitingInteractions','saveWaitingNotification','removeWaitingNotification','writeLog','lodash','util','../utils','ioredis','../../../../../config/environment','../../../../../config/logger','routing','redis','localhost','socket.io-emitter','format','user:%s','name','emit','user:save','split','\x20interaction','account','notificationSound','notificationShake','body','msg','getMustacheRender','notificationTemplate','error','message','notification:%s','save','remove','debug','[%s][QUEUE][AGENT:%s][STATUS:%s]','isAgentAvailable','BUSY','OFFLINE','Pause','PAUSE','hasOwnProperty','Capacity','toUpperCase','\x20MAXCAPACITY','showNotification'];(function(_0x445767,_0x214144){var _0x2ac4be=function(_0x53cd48){while(--_0x53cd48){_0x445767['push'](_0x445767['shift']());}};_0x2ac4be(++_0x214144);}(_0x2cc1,0x1bd));var _0x12cc=function(_0x152999,_0x1dd83b){_0x152999=_0x152999-0x0;var _0x32ef67=_0x2cc1[_0x152999];return _0x32ef67;};'use strict';var _=require(_0x12cc('0x0'));var util=require(_0x12cc('0x1'));var utils=require(_0x12cc('0x2'));var Redis=require(_0x12cc('0x3'));var config=require(_0x12cc('0x4'));var logger=require(_0x12cc('0x5'))(_0x12cc('0x6'));config[_0x12cc('0x7')]=_['defaults'](config['redis'],{'host':_0x12cc('0x8'),'port':0x18eb});var io=require(_0x12cc('0x9'))(new Redis(config['redis']));function sendNotification(_0x496867,_0x3dee73,_0x132370,_0x21d042,_0x286d82,_0x1f9d00){io['to'](util[_0x12cc('0xa')](_0x12cc('0xb'),_0x21d042[_0x12cc('0xc')]))[_0x12cc('0xd')](_0x12cc('0xe'),_0x21d042);var _0x1a4192=_0x1f9d00||{};var _0x27adee=_0x132370[_0x12cc('0xf')]('.');var _0x4fcf41={'uniqueid':_0x3dee73,'channel':_0x27adee[0x0],'id':_0x27adee[0x1],'title':_0x27adee[0x0]+_0x12cc('0x10'),'interactionId':_0x27adee[0x2],'queue':_0x286d82?_0x286d82['name']:null,'sound':_0x1a4192[_0x12cc('0x11')][_0x12cc('0x12')],'shake':_0x1a4192[_0x12cc('0x11')][_0x12cc('0x13')]};try{if(!_0x1a4192[_0x12cc('0x14')]){_0x1a4192[_0x12cc('0x14')]={};}if(_0x286d82){_0x1a4192['body']['queue']=_0x286d82;}else if(_0x1a4192[_0x12cc('0x14')]['queue']){delete _0x1a4192[_0x12cc('0x14')]['queue'];}_0x4fcf41[_0x12cc('0x15')]=utils[_0x12cc('0x16')](_0x1a4192[_0x12cc('0x11')][_0x12cc('0x17')],_0x1a4192);}catch(_0x10e22a){_0x4fcf41[_0x12cc('0x15')]='I\x20can\x27t\x20render\x20your\x20template';logger[_0x12cc('0x18')](util[_0x12cc('0xa')]('[%s][QUEUE]\x20%s',_0x3dee73,_0x10e22a[_0x12cc('0x19')]));}io['to'](util[_0x12cc('0xa')](_0x12cc('0xb'),_0x21d042[_0x12cc('0xc')]))[_0x12cc('0xd')](util[_0x12cc('0xa')](_0x12cc('0x1a'),_0x496867?_0x12cc('0x1b'):_0x12cc('0x1c')),_0x4fcf41);}function writeLog(_0x50e077,_0x4deea0,_0x4898ee){return logger[_0x12cc('0x1d')](util[_0x12cc('0xa')](_0x12cc('0x1e'),_0x50e077,_0x4deea0[_0x12cc('0xc')],_0x4898ee));}exports[_0x12cc('0x1f')]=function(_0xd92481,_0x2d18d6,_0x1d99b7,_0x2837bf){if(_0x2d18d6['busy']){writeLog(_0xd92481,_0x2d18d6,_0x12cc('0x20'));return![];}if(!_0x2d18d6['online']){writeLog(_0xd92481,_0x2d18d6,_0x12cc('0x21'));return![];}if(_0x2d18d6[_0x1d99b7+_0x12cc('0x22')]){writeLog(_0xd92481,_0x2d18d6,_0x12cc('0x23'));return![];}if(_0x2837bf&&_0x2d18d6[_0x12cc('0x24')](_0x1d99b7+_0x12cc('0x25'))&&_0x2d18d6['hasOwnProperty'](_0x1d99b7+'CurrentCapacity')){if(_0x2d18d6[_0x1d99b7+_0x12cc('0x25')]>0x0&&_0x2d18d6[_0x1d99b7+'CurrentCapacity']>=_0x2d18d6[_0x1d99b7+_0x12cc('0x25')]){writeLog(_0xd92481,_0x2d18d6,_0x1d99b7[_0x12cc('0x26')]()+_0x12cc('0x27'));return![];}}return!![];};exports[_0x12cc('0x28')]=function(_0x448b5a,_0x281da6,_0x30439d,_0x17a66b,_0x12c139){return sendNotification(!![],_0x448b5a,_0x281da6,_0x30439d,_0x17a66b,_0x12c139);};exports[_0x12cc('0x29')]=function(_0x283977,_0x102654,_0x420222,_0x435a28,_0x214f24){return sendNotification(![],_0x283977,_0x102654,_0x420222,_0x435a28,_0x214f24);};exports[_0x12cc('0x2a')]=function(_0x5cb159,_0x38413b,_0xfbb4f2){var _0x781b72=_0x38413b[_0x12cc('0x2b')][_0x12cc('0x2c')];if(!_0x781b72&&_0xfbb4f2){_0x781b72=_0xfbb4f2['id'];}var _0x3acd5c=_[_0x12cc('0x2d')](_0x5cb159[_0x38413b['channel']+_0x12cc('0x2e')],function(_0x290586){var _0x3070bf=_[_0x12cc('0x2f')](_0x38413b[_0x12cc('0x30')])+'InteractionId';return _0x290586[_0x3070bf]===_0x38413b[_0x12cc('0x2b')]['id'];});if(!_0x3acd5c&&_0x781b72&&_0x5cb159[_0x12cc('0x31')][_0x781b72]){_0x3acd5c=_[_0x12cc('0x2d')](_0x5cb159[_0x12cc('0x31')][_0x781b72][_0x38413b[_0x12cc('0x30')]+_0x12cc('0x32')],function(_0x14b661){return _0x14b661['id']===_0x38413b[_0x12cc('0x2b')]['id'];});}return _0x3acd5c;};exports[_0x12cc('0x33')]=function(_0x3bcaa0,_0x13ea36,_0x3af6a7,_0x44fa34){if(_0x3af6a7&&_0x3af6a7['id']&&_0x3bcaa0[_0x12cc('0x31')]&&_0x3bcaa0[_0x12cc('0x31')][_0x3af6a7['id']]){_0x3bcaa0['agents'][_0x3af6a7['id']][_0x44fa34+_0x12cc('0x32')][_0x13ea36[_0x12cc('0x19')]['id']]={'id':_0x13ea36[_0x12cc('0x2b')]['id']};}};exports[_0x12cc('0x34')]=function(_0x2c8a95,_0x751ce7,_0x5d9eeb,_0x2f148a){if(_0x5d9eeb&&_0x5d9eeb['id']&&_0x2c8a95[_0x12cc('0x31')]&&_0x2c8a95[_0x12cc('0x31')][_0x5d9eeb['id']]){delete _0x2c8a95['agents'][_0x5d9eeb['id']][_0x2f148a+_0x12cc('0x32')][_0x751ce7[_0x12cc('0x19')]['id']];}};exports[_0x12cc('0x35')]=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 cf0c3cd..c4f5dff 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 _0xb5ed=['[%s][SYSTEM]\x20result\x20code:\x20%s','replace','isNil','isEmpty','body','stringify','validate','shelljs','lodash','./utils','routing','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','length','error','[%s][SYSTEM]\x20%s','map','message','join','info','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','next','[%s][SYSTEM]\x20commnad:\x20%s','exec'];(function(_0x43945d,_0x43d61c){var _0xfda9cb=function(_0x3898ed){while(--_0x3898ed){_0x43945d['push'](_0x43945d['shift']());}};_0xfda9cb(++_0x43d61c);}(_0xb5ed,0x1a4));var _0xdb5e=function(_0x29e163,_0x22e166){_0x29e163=_0x29e163-0x0;var _0x577fe5=_0xb5ed[_0x29e163];return _0x577fe5;};'use strict';var schema=require(_0xdb5e('0x0'));var sh=require(_0xdb5e('0x1'));var _=require(_0xdb5e('0x2'));var utils=require(_0xdb5e('0x3'));var logger=require('../../../../config/logger')(_0xdb5e('0x4'));var system=schema({'command':{'type':'string','required':!![],'message':_0xdb5e('0x5')}});exports['consequence']=function(_0x55ee9d,_0x51bb08){return function(_0xe94989){try{var _0x1269bc={'command':_0x51bb08[0x0]};var _0x12a4ea=system[_0xdb5e('0x0')](_0x1269bc,{'typecast':!![]});if(_0x12a4ea[_0xdb5e('0x6')]){logger[_0xdb5e('0x7')](_0xdb5e('0x8'),_0x55ee9d,_[_0xdb5e('0x9')](_0x12a4ea,_0xdb5e('0xa'))[_0xdb5e('0xb')](',\x20'));logger[_0xdb5e('0xc')](_0xdb5e('0xd'),_0x55ee9d);_0xe94989[_0xdb5e('0xe')]();}else{var _0x5e5101=this;var _0x2df7c5=utils['getMustacheRender'](_0x51bb08[0x0],this);logger['info'](_0xdb5e('0xf'),_0x55ee9d,_0x2df7c5);sh[_0xdb5e('0x10')](_['trim'](_0x2df7c5),function(_0x529bda,_0x55d3c4){logger[_0xdb5e('0xc')](_0xdb5e('0x11'),_0x55ee9d,_0x529bda);if(_0x529bda==0x0){var _0x53528a=_0x55d3c4[_0xdb5e('0x12')](/(\r\n|\n|\r)/gm,'');if(_[_0xdb5e('0x13')](_0x51bb08[0x1])||_[_0xdb5e('0x14')](_0x51bb08[0x1])){logger[_0xdb5e('0xc')]('[%s][SYSTEM]\x20no\x20variable',_0x55ee9d);_0x5e5101[_0xdb5e('0x15')][_0x51bb08[0x1]]=_0x53528a;}else{logger[_0xdb5e('0xc')]('[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s',_0x55ee9d,_0x51bb08[0x1],_0x53528a);_0x5e5101[_0xdb5e('0x15')][_0x51bb08[0x1]]=_0x53528a;}}_0xe94989['next']();});}}catch(_0x444cb9){logger['error'](_0xdb5e('0x8'),_0x55ee9d,_['isObject'](_0x444cb9)?JSON[_0xdb5e('0x16')](_0x444cb9):_0x444cb9);logger[_0xdb5e('0xc')](_0xdb5e('0xd'),_0x55ee9d);_0xe94989[_0xdb5e('0xe')]();}};}; \ No newline at end of file +var _0x2b95=['replace','isEmpty','[%s][SYSTEM]\x20no\x20variable','body','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','[%s][SYSTEM]\x20%s','isObject','lodash','./utils','../../../../config/logger','routing','string','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','length','error','map','message','join','info','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','next','getMustacheRender','[%s][SYSTEM]\x20commnad:\x20%s','exec','[%s][SYSTEM]\x20result\x20code:\x20%s'];(function(_0x4e9628,_0x250573){var _0x27bc8c=function(_0xb3b7ae){while(--_0xb3b7ae){_0x4e9628['push'](_0x4e9628['shift']());}};_0x27bc8c(++_0x250573);}(_0x2b95,0x159));var _0x52b9=function(_0x2a9f4,_0x25c14a){_0x2a9f4=_0x2a9f4-0x0;var _0x3c39e0=_0x2b95[_0x2a9f4];return _0x3c39e0;};'use strict';var schema=require('validate');var sh=require('shelljs');var _=require(_0x52b9('0x0'));var utils=require(_0x52b9('0x1'));var logger=require(_0x52b9('0x2'))(_0x52b9('0x3'));var system=schema({'command':{'type':_0x52b9('0x4'),'required':!![],'message':_0x52b9('0x5')}});exports[_0x52b9('0x6')]=function(_0x3d7e4b,_0x16b0b4){return function(_0x3df583){try{var _0x1b62d6={'command':_0x16b0b4[0x0]};var _0x49a291=system['validate'](_0x1b62d6,{'typecast':!![]});if(_0x49a291[_0x52b9('0x7')]){logger[_0x52b9('0x8')]('[%s][SYSTEM]\x20%s',_0x3d7e4b,_[_0x52b9('0x9')](_0x49a291,_0x52b9('0xa'))[_0x52b9('0xb')](',\x20'));logger[_0x52b9('0xc')](_0x52b9('0xd'),_0x3d7e4b);_0x3df583[_0x52b9('0xe')]();}else{var _0xbc2516=this;var _0x1e15f5=utils[_0x52b9('0xf')](_0x16b0b4[0x0],this);logger['info'](_0x52b9('0x10'),_0x3d7e4b,_0x1e15f5);sh[_0x52b9('0x11')](_['trim'](_0x1e15f5),function(_0x3c9668,_0x239314){logger['info'](_0x52b9('0x12'),_0x3d7e4b,_0x3c9668);if(_0x3c9668==0x0){var _0x5b6924=_0x239314[_0x52b9('0x13')](/(\r\n|\n|\r)/gm,'');if(_['isNil'](_0x16b0b4[0x1])||_[_0x52b9('0x14')](_0x16b0b4[0x1])){logger[_0x52b9('0xc')](_0x52b9('0x15'),_0x3d7e4b);_0xbc2516[_0x52b9('0x16')][_0x16b0b4[0x1]]=_0x5b6924;}else{logger[_0x52b9('0xc')](_0x52b9('0x17'),_0x3d7e4b,_0x16b0b4[0x1],_0x5b6924);_0xbc2516[_0x52b9('0x16')][_0x16b0b4[0x1]]=_0x5b6924;}}_0x3df583[_0x52b9('0xe')]();});}}catch(_0x32fe60){logger[_0x52b9('0x8')](_0x52b9('0x18'),_0x3d7e4b,_[_0x52b9('0x19')](_0x32fe60)?JSON['stringify'](_0x32fe60):_0x32fe60);logger[_0x52b9('0xc')]('[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next',_0x3d7e4b);_0x3df583[_0x52b9('0xe')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/tag.js b/server/services/routing/server/applications/tag.js index 322dece..37f5d3a 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 _0x01ba=['next','channel','addTags','interaction','then','[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s','catch','stringify','finally','isObject','validate','lodash','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','../../../../config/logger','routing','number','TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','length','error','[%s][TAG]\x20%s','map','join','info','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x01ba,0xdc));var _0xa01b=function(_0x50e536,_0x2b5d3a){_0x50e536=_0x50e536-0x0;var _0x119a46=_0x01ba[_0x50e536];return _0x119a46;};'use strict';var schema=require(_0xa01b('0x0'));var _=require(_0xa01b('0x1'));var rpc={'chatInteraction':require(_0xa01b('0x2')),'openchannelInteraction':require(_0xa01b('0x3')),'smsInteraction':require(_0xa01b('0x4')),'mailInteraction':require(_0xa01b('0x5')),'faxInteraction':require(_0xa01b('0x6')),'whatsappInteraction':require(_0xa01b('0x7'))};var logger=require(_0xa01b('0x8'))(_0xa01b('0x9'));var tag=schema({'tag':{'type':_0xa01b('0xa'),'required':!![],'message':_0xa01b('0xb')}});exports[_0xa01b('0xc')]=function(_0x165b08,_0x36eb39,_0x5e8ef7,_0x3f4406){return function(_0x1ab586){try{var _0x4bb998={'tag':_0x36eb39[0x0]};var _0x5c90d2=tag['validate'](_0x4bb998,{'typecast':!![]});if(_0x5c90d2[_0xa01b('0xd')]){logger[_0xa01b('0xe')](_0xa01b('0xf'),_0x165b08,_[_0xa01b('0x10')](_0x5c90d2,'message')[_0xa01b('0x11')](',\x20'));logger[_0xa01b('0x12')](_0xa01b('0x13'),_0x165b08);_0x1ab586[_0xa01b('0x14')]();}else{var _0x1bda25={'ids':[_0x36eb39[0x0]]};if(rpc[_0x3f4406['channel']+'Interaction']){rpc[_0x3f4406[_0xa01b('0x15')]+'Interaction'][_0xa01b('0x16')](_0x3f4406[_0xa01b('0x17')]['id'],_0x1bda25)[_0xa01b('0x18')](function(_0x2c22e3){logger[_0xa01b('0x12')](_0xa01b('0x19'),_0x165b08,_0x36eb39[0x1],_0x3f4406['channel'],_0x3f4406[_0xa01b('0x17')]['id']);})[_0xa01b('0x1a')](function(_0x48f35f){logger[_0xa01b('0xe')]('[%s][TAG]\x20%s',_0x165b08,JSON[_0xa01b('0x1b')](_0x48f35f));logger[_0xa01b('0x12')](_0xa01b('0x13'),_0x165b08);})[_0xa01b('0x1c')](function(){_0x1ab586[_0xa01b('0x14')]();});}}}catch(_0x5912c6){logger[_0xa01b('0xe')]('[%s][TAG]\x20%s',_0x165b08,_[_0xa01b('0x1d')](_0x5912c6)?JSON['stringify'](_0x5912c6):_0x5912c6);logger[_0xa01b('0x12')](_0xa01b('0x13'),_0x165b08);_0x1ab586[_0xa01b('0x14')]();}};}; \ No newline at end of file +var _0x3b73=['stringify','finally','next','isObject','validate','lodash','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/mailInteraction','TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','error','[%s][TAG]\x20%s','map','message','info','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','channel','Interaction','addTags','interaction','[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s','catch'];(function(_0x3aacfb,_0x233658){var _0x42cc0c=function(_0x3f6fb5){while(--_0x3f6fb5){_0x3aacfb['push'](_0x3aacfb['shift']());}};_0x42cc0c(++_0x233658);}(_0x3b73,0x174));var _0x33b7=function(_0x12ce70,_0x45a795){_0x12ce70=_0x12ce70-0x0;var _0xa47da5=_0x3b73[_0x12ce70];return _0xa47da5;};'use strict';var schema=require(_0x33b7('0x0'));var _=require(_0x33b7('0x1'));var rpc={'chatInteraction':require(_0x33b7('0x2')),'openchannelInteraction':require(_0x33b7('0x3')),'smsInteraction':require('../../rpc/smsInteraction'),'mailInteraction':require(_0x33b7('0x4')),'faxInteraction':require('../../rpc/faxInteraction'),'whatsappInteraction':require('../../rpc/whatsappInteraction')};var logger=require('../../../../config/logger')('routing');var tag=schema({'tag':{'type':'number','required':!![],'message':_0x33b7('0x5')}});exports[_0x33b7('0x6')]=function(_0x48d237,_0xae3288,_0x3559a6,_0x4134c0){return function(_0x556e67){try{var _0x433614={'tag':_0xae3288[0x0]};var _0x2cf8b2=tag[_0x33b7('0x0')](_0x433614,{'typecast':!![]});if(_0x2cf8b2['length']){logger[_0x33b7('0x7')](_0x33b7('0x8'),_0x48d237,_[_0x33b7('0x9')](_0x2cf8b2,_0x33b7('0xa'))['join'](',\x20'));logger[_0x33b7('0xb')](_0x33b7('0xc'),_0x48d237);_0x556e67['next']();}else{var _0x5a10d2={'ids':[_0xae3288[0x0]]};if(rpc[_0x4134c0[_0x33b7('0xd')]+'Interaction']){rpc[_0x4134c0[_0x33b7('0xd')]+_0x33b7('0xe')][_0x33b7('0xf')](_0x4134c0[_0x33b7('0x10')]['id'],_0x5a10d2)['then'](function(_0x1f0d29){logger[_0x33b7('0xb')](_0x33b7('0x11'),_0x48d237,_0xae3288[0x1],_0x4134c0[_0x33b7('0xd')],_0x4134c0[_0x33b7('0x10')]['id']);})[_0x33b7('0x12')](function(_0x112b41){logger['error'](_0x33b7('0x8'),_0x48d237,JSON[_0x33b7('0x13')](_0x112b41));logger[_0x33b7('0xb')](_0x33b7('0xc'),_0x48d237);})[_0x33b7('0x14')](function(){_0x556e67[_0x33b7('0x15')]();});}}}catch(_0x3771c6){logger[_0x33b7('0x7')]('[%s][TAG]\x20%s',_0x48d237,_[_0x33b7('0x16')](_0x3771c6)?JSON[_0x33b7('0x13')](_0x3771c6):_0x3771c6);logger[_0x33b7('0xb')](_0x33b7('0xc'),_0x48d237);_0x556e67[_0x33b7('0x15')]();}};}; \ 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 169d505..345a6ae 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 _0xd35d=['utf8','POST','application/json-rpc','then','parse','logged','&sessionId=','info','[%s][TVOX]\x20Request\x20sent\x20to\x20TVox:\x20%s','stop','catch','error','next','request-promise','../../../../config/logger','lodash','consequence','replace','urlOnAnswer','?params=','urlOnRing','title','jsonrpc','method','login','push','params','stringify'];(function(_0x599299,_0x343dce){var _0x4668bf=function(_0x300b3f){while(--_0x300b3f){_0x599299['push'](_0x599299['shift']());}};_0x4668bf(++_0x343dce);}(_0xd35d,0xd1));var _0xdd35=function(_0x31a37b,_0x826249){_0x31a37b=_0x31a37b-0x0;var _0x49ae16=_0xd35d[_0x31a37b];return _0x49ae16;};'use strict';var rp=require(_0xdd35('0x0'));var logger=require(_0xdd35('0x1'))('routing');var _=require(_0xdd35('0x2'));var arr=[];exports[_0xdd35('0x3')]=function(_0x368c07,_0x373b5e){return function(_0x15a4af){var _0x12a53d=_0x373b5e[0xa];var _0xbe7bb=_0x373b5e[0xb];var _0x5293a5=_0x373b5e[0xc];var _0x4d811c=_0x373b5e[0xd];var _0x341da5=_0x373b5e[0xe];var _0x475a2d=_0x373b5e[0xf]['replace'](/\n/g,'\x20-\x20');var _0x64f367=_0x373b5e[0x10][_0xdd35('0x4')](/\n/g,'\x20');if(!arr['includes'](_0xbe7bb)){arr['push'](_0xbe7bb);var _0x251b44=_0x373b5e[0x3];var _0x254c86=_0x373b5e[0x4];var _0x962db1=_0x373b5e[0x1];var _0x46332a=_0x373b5e[0x0];var _0x31bbcb={};_0x31bbcb[_0xdd35('0x5')]=_0x373b5e[0x8]+_0xdd35('0x6')+_0x5293a5+'|'+_0x12a53d+'|'+_0x4d811c+'|'+_0xbe7bb+'|'+_0x341da5;_0x31bbcb[_0xdd35('0x7')]=_0x373b5e[0x7]+'?params='+_0x5293a5+'|'+_0x12a53d+'|'+_0x4d811c+'|'+_0xbe7bb+'|'+_0x341da5+'|'+_0x475a2d+'|'+_0x64f367;_0x31bbcb[_0xdd35('0x8')]=_0x373b5e[0x9];var _0x28589b={};_0x28589b[_0xdd35('0x9')]='2.0';_0x28589b[_0xdd35('0xa')]=_0xdd35('0xb');var _0x501464=[];_0x501464[_0xdd35('0xc')](_0x373b5e[0x2]);_0x501464['push'](_0x373b5e[0x5]);_0x501464[_0xdd35('0xc')](_0x373b5e[0x6]);_0x28589b[_0xdd35('0xd')]=_0x501464;_0x28589b['id']=0x1;var _0x2560f3=JSON[_0xdd35('0xe')](_0x28589b);var _0x1ffd1f={'encoding':_0xdd35('0xf'),'method':_0xdd35('0x10'),'timeout':0x2710,'url':_0x251b44,'headers':{'Content-Type':_0xdd35('0x11')},'body':_0x2560f3};return rp(_0x1ffd1f)[_0xdd35('0x12')](function(_0x109316){const _0x196818=JSON[_0xdd35('0x13')](_0x109316);if(!_0x196818['result'][_0xdd35('0x14')]){throw new Error('Unable\x20to\x20login\x20with\x20TVox\x20application');}var _0x28e58a=_0xbe7bb;var _0x40e0a5='channelId='+_0x962db1+'&serviceId='+_0x46332a+_0xdd35('0x15')+_0x28e58a+'&data='+JSON[_0xdd35('0xe')](_0x31bbcb);var _0x453331=_0x254c86+'?'+_0x40e0a5;return rp(_0x453331);})[_0xdd35('0x12')](function(_0x522da0){logger[_0xdd35('0x16')](_0xdd35('0x17'),_0x368c07,_0x522da0);_0x15a4af[_0xdd35('0x18')]();})[_0xdd35('0x19')](function(_0x52ca0f){logger[_0xdd35('0x1a')]('[%s][TVOX]\x20%s',_0x368c07,_['isObject'](_0x52ca0f)?JSON[_0xdd35('0xe')](_0x52ca0f):_0x52ca0f);_0x15a4af[_0xdd35('0x18')]();});}else{logger[_0xdd35('0x16')]('[%s][TVOX]\x20Application\x20already\x20executed\x20for\x20the\x20current\x20session,\x20force\x20next',_0x368c07);_0x15a4af[_0xdd35('0x1b')]();}};}; \ No newline at end of file +var _0x4d44=['push','urlOnRing','title','jsonrpc','2.0','method','login','params','stringify','utf8','POST','application/json-rpc','then','parse','logged','&data=','[%s][TVOX]\x20Request\x20sent\x20to\x20TVox:\x20%s','stop','catch','[%s][TVOX]\x20%s','info','[%s][TVOX]\x20Application\x20already\x20executed\x20for\x20the\x20current\x20session,\x20force\x20next','next','request-promise','../../../../config/logger','routing','lodash','consequence','replace','\x20-\x20','includes'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x4d44,0xb2));var _0x44d4=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x4d44[_0x42cae2];return _0x5f256f;};'use strict';var rp=require(_0x44d4('0x0'));var logger=require(_0x44d4('0x1'))(_0x44d4('0x2'));var _=require(_0x44d4('0x3'));var arr=[];exports[_0x44d4('0x4')]=function(_0x19b283,_0x59555a){return function(_0x4832f9){var _0x381070=_0x59555a[0xa];var _0x293913=_0x59555a[0xb];var _0x797e20=_0x59555a[0xc];var _0x5c15b6=_0x59555a[0xd];var _0x1a183b=_0x59555a[0xe];var _0x3eaec=_0x59555a[0xf][_0x44d4('0x5')](/\n/g,_0x44d4('0x6'));var _0x2cda3b=_0x59555a[0x10]['replace'](/\n/g,'\x20');if(!arr[_0x44d4('0x7')](_0x293913)){arr[_0x44d4('0x8')](_0x293913);var _0x51f622=_0x59555a[0x3];var _0x8ef452=_0x59555a[0x4];var _0x4ef374=_0x59555a[0x1];var _0x44000b=_0x59555a[0x0];var _0x19ee39={};_0x19ee39['urlOnAnswer']=_0x59555a[0x8]+'?params='+_0x797e20+'|'+_0x381070+'|'+_0x5c15b6+'|'+_0x293913+'|'+_0x1a183b;_0x19ee39[_0x44d4('0x9')]=_0x59555a[0x7]+'?params='+_0x797e20+'|'+_0x381070+'|'+_0x5c15b6+'|'+_0x293913+'|'+_0x1a183b+'|'+_0x3eaec+'|'+_0x2cda3b;_0x19ee39[_0x44d4('0xa')]=_0x59555a[0x9];var _0x1ad8f7={};_0x1ad8f7[_0x44d4('0xb')]=_0x44d4('0xc');_0x1ad8f7[_0x44d4('0xd')]=_0x44d4('0xe');var _0x377285=[];_0x377285['push'](_0x59555a[0x2]);_0x377285[_0x44d4('0x8')](_0x59555a[0x5]);_0x377285[_0x44d4('0x8')](_0x59555a[0x6]);_0x1ad8f7[_0x44d4('0xf')]=_0x377285;_0x1ad8f7['id']=0x1;var _0x290d36=JSON[_0x44d4('0x10')](_0x1ad8f7);var _0x1431b4={'encoding':_0x44d4('0x11'),'method':_0x44d4('0x12'),'timeout':0x2710,'url':_0x51f622,'headers':{'Content-Type':_0x44d4('0x13')},'body':_0x290d36};return rp(_0x1431b4)[_0x44d4('0x14')](function(_0x1a22b8){const _0x2c9857=JSON[_0x44d4('0x15')](_0x1a22b8);if(!_0x2c9857['result'][_0x44d4('0x16')]){throw new Error('Unable\x20to\x20login\x20with\x20TVox\x20application');}var _0x331d01=_0x293913;var _0x61d182='channelId='+_0x4ef374+'&serviceId='+_0x44000b+'&sessionId='+_0x331d01+_0x44d4('0x17')+JSON['stringify'](_0x19ee39);var _0x1ea8bf=_0x8ef452+'?'+_0x61d182;return rp(_0x1ea8bf);})['then'](function(_0x281a77){logger['info'](_0x44d4('0x18'),_0x19b283,_0x281a77);_0x4832f9[_0x44d4('0x19')]();})[_0x44d4('0x1a')](function(_0x4a704b){logger['error'](_0x44d4('0x1b'),_0x19b283,_['isObject'](_0x4a704b)?JSON[_0x44d4('0x10')](_0x4a704b):_0x4a704b);_0x4832f9[_0x44d4('0x19')]();});}else{logger[_0x44d4('0x1c')](_0x44d4('0x1d'),_0x19b283);_0x4832f9[_0x44d4('0x1e')]();}};}; \ 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 c9644e1..2bd0a4c 100644 --- a/server/services/routing/server/applications/utils.js +++ b/server/services/routing/server/applications/utils.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9c44=['merge','body','account','list','exports','render'];(function(_0x2152d4,_0x239aad){var _0x173d83=function(_0x93f00d){while(--_0x93f00d){_0x2152d4['push'](_0x2152d4['shift']());}};_0x173d83(++_0x239aad);}(_0x9c44,0x178));var _0x49c4=function(_0x24061a,_0x1c9f4d){_0x24061a=_0x24061a-0x0;var _0x82054e=_0x9c44[_0x24061a];return _0x82054e;};'use strict';var Mustache=require('mustache');var _=require('lodash');module[_0x49c4('0x0')]={'getMustacheRender':function(_0x18bf2d,_0x26844b){return Mustache[_0x49c4('0x1')](_0x18bf2d,_[_0x49c4('0x2')](_0x26844b[_0x49c4('0x3')],{'contact':_0x26844b['contact'],'message':_0x26844b['message'],'account':_0x26844b[_0x49c4('0x4')],'interaction':_0x26844b['interaction'],'list':_0x26844b[_0x49c4('0x5')]}))||'';}}; \ No newline at end of file +var _0xe706=['exports','render','merge','body','contact','message','account','interaction','list','mustache','lodash'];(function(_0x45d264,_0x1bc55d){var _0x3ec9c8=function(_0x4aa424){while(--_0x4aa424){_0x45d264['push'](_0x45d264['shift']());}};_0x3ec9c8(++_0x1bc55d);}(_0xe706,0xa3));var _0x6e70=function(_0xf10ab2,_0x4139fa){_0xf10ab2=_0xf10ab2-0x0;var _0x4c6629=_0xe706[_0xf10ab2];return _0x4c6629;};'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 b9a8281..313aa35 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 _0x4bc6=['body','%s:%s:%s','./interval','intervals','./applications/','consequence','priority','info','Push\x20new\x20rule','\x20|\x20','Please\x20create\x20a\x20new\x20file\x20under','execute','Applications\x20executed','stringify','emit','complete','Skipped\x20routing\x20for\x20%s','No\x20applications\x20to\x20execute','error','stack','agent','agents','QueueReport','update','UserId','message\x20is\x20empty','busy','busyQueue','capacity','hasOwnProperty','CurrentCapacity','updateRealtime','agent\x20not\x20found','values','chatQueues','available','loggedIn','waiting','mailQueues','name','paused','openchannelQueues','smsQueues','faxQueues','whatsappQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','server','http','127.0.0.1','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','lodash','util','path','./applications/strategy/util','../../../config/logger','routing','../rpc/openchannelQueueReport','../rpc/mailQueueReport','../rpc/faxQueueReport','../lib/rule-engine','format','%s.%s.%s','isNil','IntervalId','map','Intervals','interval','listen','rules','channel','interaction','checkWaitingNotifications','isArray','length','applications','existsSync','join','app','.js','toLowerCase','split','mail','push','slice','dialogflow','appdata','dialogflowv2','amazonlex','message','tag','TagId','getMustacheRender','account','notificationTemplate','ChatWebsiteId','ContactId'];(function(_0x186d17,_0x9fa8ef){var _0x5d4b89=function(_0x57bd70){while(--_0x57bd70){_0x186d17['push'](_0x186d17['shift']());}};_0x5d4b89(++_0x9fa8ef);}(_0x4bc6,0xfe));var _0x64bc=function(_0x4792c8,_0x5158a1){_0x4792c8=_0x4792c8-0x0;var _0x35edb1=_0x4bc6[_0x4792c8];return _0x35edb1;};'use strict';var _=require(_0x64bc('0x0'));var util=require(_0x64bc('0x1'));var path=require(_0x64bc('0x2'));var fs=require('fs');var jayson=require('jayson/promise');var BPromise=require('bluebird');var utils=require('./applications/utils');var sUtils=require(_0x64bc('0x3'));var logger=require(_0x64bc('0x4'))(_0x64bc('0x5'));var rpc={'openchannelQueueReport':require(_0x64bc('0x6')),'mailQueueReport':require(_0x64bc('0x7')),'chatQueueReport':require('../rpc/chatQueueReport'),'smsQueueReport':require('../rpc/smsQueueReport'),'faxQueueReport':require(_0x64bc('0x8')),'whatsappQueueReport':require('../rpc/whatsappQueueReport')};var RuleEngine=require(_0x64bc('0x9'));function getId(_0x49394d,_0x410eb5,_0x453748){return util[_0x64bc('0xa')](_0x64bc('0xb'),_0x49394d,_0x410eb5||0x0,_0x453748||0x0);}function getIntervals(_0x1a5b9b,_0x1453b9){var _0x3010d9=[];if(!_[_0x64bc('0xc')](_0x1453b9[_0x64bc('0xd')])&&!_['isNil'](_0x1a5b9b[_0x1453b9[_0x64bc('0xd')]])&&!_[_0x64bc('0xc')](_0x1a5b9b[_0x1453b9[_0x64bc('0xd')]]['Intervals'])){_0x3010d9=_[_0x64bc('0xe')](_0x1a5b9b[_0x1453b9[_0x64bc('0xd')]][_0x64bc('0xf')],'interval');}else if(!_[_0x64bc('0xc')](_0x1453b9[_0x64bc('0x10')])){_0x3010d9=[_0x1453b9[_0x64bc('0x10')]];}return _0x3010d9;}exports[_0x64bc('0x11')]=function(_0x5775a2){_0x5775a2[_0x64bc('0x12')]={};return new BPromise(function(_0x372664,_0x55bb60){var _0x40cc0a={'Start':function(_0x1c3967){var _0x4f3505=this;return new Promise(function(_0x21c775,_0x5b34d7){if(_0x1c3967){try{var _0x4376d1=[];var _0x51a9cc=getId(_0x1c3967[_0x64bc('0x13')],_0x1c3967['message']?_0x1c3967['message']['id']:0x0,_0x1c3967[_0x64bc('0x14')]?_0x1c3967['interaction']['id']:0x0);var _0x31ec61=sUtils[_0x64bc('0x15')](_0x5775a2,_0x1c3967);if(!_0x31ec61&&_0x1c3967['applications']&&_[_0x64bc('0x16')](_0x1c3967['applications'])&&_0x1c3967['applications'][_0x64bc('0x17')]){for(var _0x549844=0x0;_0x549844<_0x1c3967[_0x64bc('0x18')][_0x64bc('0x17')];_0x549844+=0x1){var _0x2172b8=_0x1c3967[_0x64bc('0x18')][_0x549844];if(fs[_0x64bc('0x19')](path[_0x64bc('0x1a')](__dirname,'applications',_0x2172b8[_0x64bc('0x1b')]+_0x64bc('0x1c')))){var _0x35ba38=[];switch(_0x2172b8[_0x64bc('0x1b')][_0x64bc('0x1d')]()){case'autoreply':var _0x4b0afd=_0x2172b8['appdata'][_0x64bc('0x1e')](',');if(_0x1c3967[_0x64bc('0x13')]===_0x64bc('0x1f')){_0x35ba38['push'](_0x4b0afd[0x0]);_0x35ba38[_0x64bc('0x20')](_0x4b0afd[0x1]);_0x35ba38[_0x64bc('0x20')](_0x4b0afd[_0x64bc('0x21')](0x2,_0x4b0afd[_0x64bc('0x17')])['join'](','));}else{_0x35ba38[_0x64bc('0x20')](_0x4b0afd[0x0]);_0x35ba38[_0x64bc('0x20')](_0x4b0afd[_0x64bc('0x21')](0x1,_0x4b0afd[_0x64bc('0x17')])[_0x64bc('0x1a')](','));}break;case _0x64bc('0x22'):var _0x26fdbc=_0x2172b8[_0x64bc('0x23')]['split'](',');_0x35ba38[_0x64bc('0x20')](_0x26fdbc[0x0]);_0x35ba38[_0x64bc('0x20')](_0x26fdbc[0x1]);_0x35ba38[_0x64bc('0x20')](_0x26fdbc[_0x64bc('0x21')](0x2,_0x26fdbc[_0x64bc('0x17')])['join'](','));break;case _0x64bc('0x24'):var _0x4bcf97=_0x2172b8[_0x64bc('0x23')][_0x64bc('0x1e')](',');_0x35ba38[_0x64bc('0x20')](_0x4bcf97[0x0]);_0x35ba38[_0x64bc('0x20')](_0x4bcf97[0x1]);_0x35ba38[_0x64bc('0x20')](_0x4bcf97[0x2]);_0x35ba38[_0x64bc('0x20')](_0x4bcf97[0x3]);_0x35ba38[_0x64bc('0x20')](_0x4bcf97[_0x64bc('0x21')](0x4,_0x4bcf97[_0x64bc('0x17')])[_0x64bc('0x1a')](','));break;case _0x64bc('0x25'):var _0x5c22b3=_0x2172b8[_0x64bc('0x23')]['split'](',');_0x35ba38[_0x64bc('0x20')](_0x5c22b3[0x0]);_0x35ba38[_0x64bc('0x20')](_0x5c22b3[0x1]);_0x35ba38['push'](_0x5c22b3[0x2]);_0x35ba38['push'](_0x5c22b3[0x3]);_0x35ba38[_0x64bc('0x20')](_0x5c22b3[_0x64bc('0x21')](0x4,_0x5c22b3[_0x64bc('0x17')])[_0x64bc('0x1a')](','));break;case _0x64bc('0x26'):_0x35ba38[_0x64bc('0x20')](_0x2172b8[_0x64bc('0x23')]);break;case _0x64bc('0x27'):_0x35ba38[_0x64bc('0x20')](_0x2172b8[_0x64bc('0x28')]);_0x35ba38['push'](_0x2172b8[_0x64bc('0x23')]);break;case'tvox':var _0x283ac7=utils[_0x64bc('0x29')](_0x1c3967[_0x64bc('0x2a')][_0x64bc('0x2b')],_0x1c3967);var _0x176d6c=_0x2172b8[_0x64bc('0x23')]['split'](',');_0x35ba38[_0x64bc('0x20')](_0x176d6c[0x0]);_0x35ba38[_0x64bc('0x20')](_0x176d6c[0x1]);_0x35ba38['push'](_0x176d6c[0x2]);_0x35ba38[_0x64bc('0x20')](_0x176d6c[0x3]);_0x35ba38['push'](_0x176d6c[0x4]);_0x35ba38[_0x64bc('0x20')](_0x176d6c[0x5]);_0x35ba38['push'](_0x176d6c[0x6]);_0x35ba38[_0x64bc('0x20')](_0x176d6c[0x7]);_0x35ba38[_0x64bc('0x20')](_0x176d6c[0x8]);_0x35ba38[_0x64bc('0x20')](_0x176d6c[0x9]);_0x35ba38[_0x64bc('0x20')](_0x176d6c[0xa]);_0x35ba38[_0x64bc('0x20')](_0x1c3967['interaction']['id']);_0x35ba38['push'](_0x1c3967['message']['id']);_0x35ba38[_0x64bc('0x20')](_0x2172b8[_0x64bc('0x2c')]);_0x35ba38[_0x64bc('0x20')](_0x1c3967[_0x64bc('0x14')][_0x64bc('0x2d')]);_0x35ba38['push'](_0x1c3967['body'][_0x64bc('0x2e')]);_0x35ba38['push'](_0x283ac7);break;default:_0x35ba38=_[_0x64bc('0xc')](_0x2172b8[_0x64bc('0x23')])?[]:_0x2172b8[_0x64bc('0x23')][_0x64bc('0x1e')](',');}var _0xb02451={'id':util[_0x64bc('0xa')](_0x64bc('0x2f'),_0x51a9cc,_0x2172b8['id'],_0x2172b8[_0x64bc('0x1b')]),'condition':require(_0x64bc('0x30'))['condition'](_0x51a9cc,getIntervals(_0x5775a2[_0x64bc('0x31')],_0x2172b8),_0x5775a2),'consequence':require(_0x64bc('0x32')+_0x2172b8[_0x64bc('0x1b')])[_0x64bc('0x33')](_0x51a9cc,_0x35ba38,_0x5775a2,_0x1c3967),'p':_0x2172b8[_0x64bc('0x34')]||0x0};logger[_0x64bc('0x35')](_0x64bc('0x36'),_0xb02451['id'],'on\x20interval',getIntervals(_0x5775a2['intervals'],_0x2172b8)['join'](_0x64bc('0x37')));_0x4376d1[_0x64bc('0x20')](_0xb02451);}else{logger['error'](_0x64bc('0x38'),path[_0x64bc('0x1a')](__dirname,_0x64bc('0x18'),_0x2172b8[_0x64bc('0x1b')]+_0x64bc('0x1c')));}}_0x5775a2['rules'][_0x51a9cc]=new RuleEngine(_0x4376d1);_0x5775a2[_0x64bc('0x12')][_0x51a9cc][_0x64bc('0x39')](_0x1c3967,function(_0x51e0cd){logger[_0x64bc('0x35')](_0x64bc('0x3a'),JSON[_0x64bc('0x3b')](_0x51e0cd['matchPath']));if(_0x5775a2['rules'][_0x51a9cc]){_0x5775a2['rules'][_0x51a9cc][_0x64bc('0x3c')](_0x64bc('0x3d'));}});return _0x21c775({'code':0xc8,'message':_0x1c3967});}else{if(_0x31ec61){logger[_0x64bc('0x35')](util['format'](_0x64bc('0x3e'),_0x51a9cc));}else{logger[_0x64bc('0x35')](_0x64bc('0x3f'));}return _0x21c775({'code':0xc8,'message':_0x1c3967});}}catch(_0x2db069){logger[_0x64bc('0x40')](_0x2db069[_0x64bc('0x41')]);return _0x5b34d7(_0x4f3505[_0x64bc('0x40')](0x1f4,_0x2db069));}}return _0x5b34d7('routing\x20is\x20empty');});},'AcceptMessage':function(_0x4f354a){var _0x20f719=this;return new Promise(function(_0x26f5cd,_0x511c17){if(_0x4f354a[_0x64bc('0x42')]&&_0x4f354a[_0x64bc('0x42')]['id']){if(_0x5775a2['agents'][_0x4f354a[_0x64bc('0x42')]['id']]){_0x5775a2[_0x64bc('0x43')][_0x4f354a['agent']['id']]['busy']=![];_0x5775a2[_0x64bc('0x43')][_0x4f354a[_0x64bc('0x42')]['id']]['busyQueue']=undefined;}}if(_0x4f354a[_0x64bc('0x26')]&&_0x4f354a[_0x64bc('0x26')]['id']){try{var _0x353751=getId(_0x4f354a['channel'],_0x4f354a['message']?_0x4f354a[_0x64bc('0x26')]['id']:0x0,_0x4f354a[_0x64bc('0x14')]?_0x4f354a['interaction']['id']:0x0);if(_0x5775a2[_0x64bc('0x12')][_0x353751]){_0x5775a2[_0x64bc('0x12')][_0x353751][_0x64bc('0x3c')]('end');if(rpc[_0x4f354a[_0x64bc('0x13')]+'QueueReport']){rpc[_0x4f354a['channel']+_0x64bc('0x44')][_0x64bc('0x45')](_0x353751,{'UserId':_0x4f354a[_0x64bc('0x26')][_0x64bc('0x46')]})['catch'](function(){logger['error']('error\x20update\x20queue\x20report');});}}return _0x26f5cd({'code':0xc8,'message':_0x4f354a});}catch(_0x28dab8){logger[_0x64bc('0x40')](_0x28dab8['stack']);return _0x511c17(_0x20f719[_0x64bc('0x40')](0x1f4,_0x28dab8));}}logger[_0x64bc('0x40')]('message\x20is\x20empty');return _0x511c17(_0x20f719[_0x64bc('0x40')](0x1f4,_0x64bc('0x47')));});},'RejectMessage':function(_0x370574){var _0x784942=this;return new Promise(function(_0x2c0516,_0xb959ac){if(_0x370574[_0x64bc('0x42')]&&_0x370574['agent']['id']){try{if(_0x5775a2[_0x64bc('0x43')][_0x370574[_0x64bc('0x42')]['id']]){_0x5775a2['agents'][_0x370574[_0x64bc('0x42')]['id']][_0x64bc('0x48')]=![];_0x5775a2[_0x64bc('0x43')][_0x370574['agent']['id']][_0x64bc('0x49')]=undefined;}return _0x2c0516({'code':0xc8,'message':_0x370574});}catch(_0x593cea){logger[_0x64bc('0x40')](_0x593cea['stack']);return _0xb959ac(_0x784942['error'](0x1f4,_0x593cea));}}logger[_0x64bc('0x40')](_0x64bc('0x47'));return _0xb959ac(_0x784942[_0x64bc('0x40')](0x1f4,_0x64bc('0x47')));});},'AbandonInteraction':function(_0x3b551c){var _0x28d51d=this;return new Promise(function(_0x1256d0,_0x571e6f){if(_0x3b551c[_0x64bc('0x13')]&&_0x3b551c[_0x64bc('0x14')]&&_0x3b551c[_0x64bc('0x14')]['id']){try{var _0x3119cc=getId(_0x3b551c[_0x64bc('0x13')],_0x3b551c[_0x64bc('0x26')]?_0x3b551c['message']['id']:0x0,_0x3b551c[_0x64bc('0x14')]?_0x3b551c[_0x64bc('0x14')]['id']:0x0);if(_0x5775a2[_0x64bc('0x12')][_0x3119cc]){_0x5775a2['rules'][_0x3119cc]['emit']('end');}return _0x1256d0({'code':0xc8,'message':_0x3b551c});}catch(_0x1c75f0){logger[_0x64bc('0x40')](_0x1c75f0['stack']);return _0x571e6f(_0x28d51d['error'](0x1f4,_0x1c75f0));}}logger['error']('message\x20is\x20empty');return _0x571e6f(_0x28d51d['error'](0x1f4,_0x64bc('0x47')));});},'AgentCapacity':function(_0x4efe0b){var _0x3a83cc=this;return new Promise(function(_0x3840ef,_0x35ab86){if(_0x5775a2[_0x64bc('0x43')]['hasOwnProperty'](_0x4efe0b['id'])){for(var _0x26ba15 in _0x4efe0b[_0x64bc('0x4a')]){if(_0x4efe0b[_0x64bc('0x4a')]['hasOwnProperty'](_0x26ba15)){if(_0x5775a2[_0x64bc('0x43')][_0x4efe0b['id']][_0x64bc('0x4b')](_0x26ba15+_0x64bc('0x4c'))){_0x5775a2['agents'][_0x4efe0b['id']][_0x26ba15+_0x64bc('0x4c')]=parseInt(_0x4efe0b['capacity'][_0x26ba15],0xa);}}}_0x5775a2[_0x64bc('0x43')][_0x4efe0b['id']][_0x64bc('0x4d')]();return _0x3840ef({'code':0xc8,'message':_0x5775a2['agents'][_0x4efe0b['id']]});}else{return _0x35ab86(_0x3a83cc[_0x64bc('0x40')](0x1f4,_0x64bc('0x4e')));}});},'Agents':function(_0x10023e){return new Promise(function(_0xd8b5e4){var _0x132410=_[_0x64bc('0x4f')](_0x5775a2['agents']);if(_0x10023e&&_0x10023e['id']){var _0x271882=_['find'](_0x132410,function(_0x44b97d){return _0x44b97d['id']===_0x10023e['id'];});_0xd8b5e4(_0x271882);}else{_0xd8b5e4({'count':_0x132410['length'],'rows':_0x132410});}});},'ChatQueues':function(){return new Promise(function(_0x40948d){var _0x5970e4=[];for(var _0xfa2b33 in _0x5775a2[_0x64bc('0x50')]){if(_0x5775a2[_0x64bc('0x50')][_0x64bc('0x4b')](_0xfa2b33)){var _0x5e6bfc=_0x5775a2[_0x64bc('0x50')][_0xfa2b33];var _0x4f6a35={'id':_0x5e6bfc['id'],'available':_0x5e6bfc[_0x64bc('0x51')],'loggedIn':_0x5e6bfc[_0x64bc('0x52')],'name':_0x5e6bfc['name'],'paused':_0x5e6bfc['paused'],'waiting':_0x5e6bfc[_0x64bc('0x53')]};_0x5970e4[_0x64bc('0x20')](_0x4f6a35);}}_0x40948d({'count':_0x5970e4['length'],'rows':_0x5970e4});});},'MailQueues':function(){return new Promise(function(_0x25e026){var _0x51d2dd=[];for(var _0x275fb8 in _0x5775a2[_0x64bc('0x54')]){if(_0x5775a2['mailQueues'][_0x64bc('0x4b')](_0x275fb8)){var _0x3671ca=_0x5775a2[_0x64bc('0x54')][_0x275fb8];var _0x2a9935={'id':_0x3671ca['id'],'available':_0x3671ca[_0x64bc('0x51')],'loggedIn':_0x3671ca['loggedIn'],'name':_0x3671ca[_0x64bc('0x55')],'paused':_0x3671ca[_0x64bc('0x56')],'waiting':_0x3671ca['waiting']};_0x51d2dd['push'](_0x2a9935);}}_0x25e026({'count':_0x51d2dd['length'],'rows':_0x51d2dd});});},'OpenchannelQueues':function(){return new Promise(function(_0x5d36eb){var _0xc11ed8=[];for(var _0x564f51 in _0x5775a2[_0x64bc('0x57')]){if(_0x5775a2[_0x64bc('0x57')][_0x64bc('0x4b')](_0x564f51)){var _0x14f86b=_0x5775a2['openchannelQueues'][_0x564f51];var _0x210492={'id':_0x14f86b['id'],'available':_0x14f86b['available'],'loggedIn':_0x14f86b['loggedIn'],'name':_0x14f86b[_0x64bc('0x55')],'paused':_0x14f86b['paused'],'waiting':_0x14f86b['waiting']};_0xc11ed8[_0x64bc('0x20')](_0x210492);}}_0x5d36eb({'count':_0xc11ed8[_0x64bc('0x17')],'rows':_0xc11ed8});});},'SmsQueues':function(){return new Promise(function(_0x1bfd1e){var _0xaecb27=[];for(var _0x4c284c in _0x5775a2[_0x64bc('0x58')]){if(_0x5775a2[_0x64bc('0x58')]['hasOwnProperty'](_0x4c284c)){var _0x1488be=_0x5775a2[_0x64bc('0x58')][_0x4c284c];var _0x5030f8={'id':_0x1488be['id'],'available':_0x1488be[_0x64bc('0x51')],'loggedIn':_0x1488be[_0x64bc('0x52')],'name':_0x1488be['name'],'paused':_0x1488be['paused'],'waiting':_0x1488be['waiting']};_0xaecb27[_0x64bc('0x20')](_0x5030f8);}}_0x1bfd1e({'count':_0xaecb27[_0x64bc('0x17')],'rows':_0xaecb27});});},'FaxQueues':function(){return new Promise(function(_0x435b9f){var _0x15db02=[];for(var _0x2ca8d2 in _0x5775a2[_0x64bc('0x59')]){if(_0x5775a2[_0x64bc('0x59')][_0x64bc('0x4b')](_0x2ca8d2)){var _0x22e327=_0x5775a2[_0x64bc('0x59')][_0x2ca8d2];var _0x63cb1c={'id':_0x22e327['id'],'available':_0x22e327[_0x64bc('0x51')],'loggedIn':_0x22e327['loggedIn'],'name':_0x22e327[_0x64bc('0x55')],'paused':_0x22e327['paused'],'waiting':_0x22e327[_0x64bc('0x53')]};_0x15db02[_0x64bc('0x20')](_0x63cb1c);}}_0x435b9f({'count':_0x15db02[_0x64bc('0x17')],'rows':_0x15db02});});},'WhatsappQueues':function(){return new Promise(function(_0x4c8ab7){var _0x42ec5c=[];for(var _0xcd8656 in _0x5775a2[_0x64bc('0x5a')]){if(_0x5775a2[_0x64bc('0x5a')][_0x64bc('0x4b')](_0xcd8656)){var _0x2c1d7b=_0x5775a2[_0x64bc('0x5a')][_0xcd8656];var _0xe0f995={'id':_0x2c1d7b['id'],'available':_0x2c1d7b[_0x64bc('0x51')],'loggedIn':_0x2c1d7b[_0x64bc('0x52')],'name':_0x2c1d7b[_0x64bc('0x55')],'paused':_0x2c1d7b['paused'],'waiting':_0x2c1d7b['waiting']};_0x42ec5c['push'](_0xe0f995);}}_0x4c8ab7({'count':_0x42ec5c[_0x64bc('0x17')],'rows':_0x42ec5c});});},'ChatQueuesWaitingInteractions':function(){return new Promise(function(_0x2ee7c5){var _0x25837a=_[_0x64bc('0x4f')](_0x5775a2[_0x64bc('0x5b')]);_0x2ee7c5({'count':_0x25837a[_0x64bc('0x17')],'rows':_0x25837a});});},'MailQueuesWaitingInteractions':function(){return new Promise(function(_0x10a7d9){var _0x2a4f79=_['values'](_0x5775a2[_0x64bc('0x5c')]);_0x10a7d9({'count':_0x2a4f79[_0x64bc('0x17')],'rows':_0x2a4f79});});},'OpenchannelQueuesWaitingInteractions':function(){return new Promise(function(_0x1531a3){var _0x3287c9=_[_0x64bc('0x4f')](_0x5775a2[_0x64bc('0x5d')]);_0x1531a3({'count':_0x3287c9['length'],'rows':_0x3287c9});});},'SmsQueuesWaitingInteractions':function(){return new Promise(function(_0x3b09a4){var _0x2d469b=_[_0x64bc('0x4f')](_0x5775a2[_0x64bc('0x5e')]);_0x3b09a4({'count':_0x2d469b['length'],'rows':_0x2d469b});});},'FaxQueuesWaitingInteractions':function(){return new Promise(function(_0x411720){var _0x31ac01=_[_0x64bc('0x4f')](_0x5775a2[_0x64bc('0x5f')]);_0x411720({'count':_0x31ac01['length'],'rows':_0x31ac01});});},'WhatsappQueuesWaitingInteractions':function(){return new Promise(function(_0x1dbada){var _0x21f015=_[_0x64bc('0x4f')](_0x5775a2['whatsappQueuesWaitingInteractions']);_0x1dbada({'count':_0x21f015[_0x64bc('0x17')],'rows':_0x21f015});});}};var _0x4e7aac=jayson[_0x64bc('0x60')](_0x40cc0a)[_0x64bc('0x61')]();_0x4e7aac['on']('error',function(_0x3bccfc){logger[_0x64bc('0x40')](JSON[_0x64bc('0x3b')](_0x3bccfc));return _0x55bb60(_0x3bccfc);});_0x4e7aac[_0x64bc('0x11')](0x232c,_0x64bc('0x62'),function(){console['log'](_0x64bc('0x63'),0x232c);return _0x372664('RPC\x20listening\x20on\x20port:'+0x232c);});});}; \ No newline at end of file +var _0xe54c=['capacity','CurrentCapacity','updateRealtime','agent\x20not\x20found','find','chatQueues','available','loggedIn','name','paused','waiting','mailQueues','openchannelQueues','smsQueues','faxQueues','whatsappQueues','values','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','lodash','util','path','jayson/promise','bluebird','./applications/utils','./applications/strategy/util','../../../config/logger','../rpc/openchannelQueueReport','../rpc/chatQueueReport','../rpc/smsQueueReport','../rpc/whatsappQueueReport','format','%s.%s.%s','isNil','IntervalId','Intervals','map','interval','listen','channel','message','interaction','transfer','isArray','applications','length','existsSync','join','app','.js','toLowerCase','appdata','split','mail','push','slice','amazonlex','tag','TagId','tvox','getMustacheRender','ChatWebsiteId','ContactId','body','./applications/','priority','info','Push\x20new\x20rule','intervals','error','Please\x20create\x20a\x20new\x20file\x20under','rules','execute','stringify','matchPath','emit','complete','Skipped\x20routing\x20for\x20%s','No\x20applications\x20to\x20execute','stack','routing\x20is\x20empty','agent','agents','busy','end','QueueReport','UserId','catch','error\x20update\x20queue\x20report','message\x20is\x20empty','busyQueue','hasOwnProperty'];(function(_0x3fe440,_0x18d0cb){var _0x30cf95=function(_0x1f7af5){while(--_0x1f7af5){_0x3fe440['push'](_0x3fe440['shift']());}};_0x30cf95(++_0x18d0cb);}(_0xe54c,0x79));var _0xce54=function(_0xabb8a1,_0x5ed479){_0xabb8a1=_0xabb8a1-0x0;var _0x9a4673=_0xe54c[_0xabb8a1];return _0x9a4673;};'use strict';var _=require(_0xce54('0x0'));var util=require(_0xce54('0x1'));var path=require(_0xce54('0x2'));var fs=require('fs');var jayson=require(_0xce54('0x3'));var BPromise=require(_0xce54('0x4'));var utils=require(_0xce54('0x5'));var sUtils=require(_0xce54('0x6'));var logger=require(_0xce54('0x7'))('routing');var rpc={'openchannelQueueReport':require(_0xce54('0x8')),'mailQueueReport':require('../rpc/mailQueueReport'),'chatQueueReport':require(_0xce54('0x9')),'smsQueueReport':require(_0xce54('0xa')),'faxQueueReport':require('../rpc/faxQueueReport'),'whatsappQueueReport':require(_0xce54('0xb'))};var RuleEngine=require('../lib/rule-engine');function getId(_0x2b192d,_0x2d9821,_0x5940e9){return util[_0xce54('0xc')](_0xce54('0xd'),_0x2b192d,_0x2d9821||0x0,_0x5940e9||0x0);}function getIntervals(_0x14f326,_0x18fff5){var _0xb0f2df=[];if(!_[_0xce54('0xe')](_0x18fff5[_0xce54('0xf')])&&!_[_0xce54('0xe')](_0x14f326[_0x18fff5[_0xce54('0xf')]])&&!_[_0xce54('0xe')](_0x14f326[_0x18fff5[_0xce54('0xf')]][_0xce54('0x10')])){_0xb0f2df=_[_0xce54('0x11')](_0x14f326[_0x18fff5[_0xce54('0xf')]]['Intervals'],'interval');}else if(!_['isNil'](_0x18fff5[_0xce54('0x12')])){_0xb0f2df=[_0x18fff5['interval']];}return _0xb0f2df;}exports[_0xce54('0x13')]=function(_0x1f7a09){_0x1f7a09['rules']={};return new BPromise(function(_0x586520,_0x355e0f){var _0x14befa={'Start':function(_0x14b863){var _0x19724c=this;return new Promise(function(_0x3c8569,_0x57effb){if(_0x14b863){try{var _0x4fafc0=[];var _0x3eee0d=getId(_0x14b863[_0xce54('0x14')],_0x14b863[_0xce54('0x15')]?_0x14b863['message']['id']:0x0,_0x14b863[_0xce54('0x16')]?_0x14b863['interaction']['id']:0x0);var _0x340e8e=sUtils['checkWaitingNotifications'](_0x1f7a09,_0x14b863);if(_0x14b863[_0xce54('0x17')]||!_0x340e8e&&_0x14b863['applications']&&_[_0xce54('0x18')](_0x14b863[_0xce54('0x19')])&&_0x14b863[_0xce54('0x19')][_0xce54('0x1a')]){for(var _0x287530=0x0;_0x287530<_0x14b863['applications']['length'];_0x287530+=0x1){var _0x375ae4=_0x14b863[_0xce54('0x19')][_0x287530];if(fs[_0xce54('0x1b')](path[_0xce54('0x1c')](__dirname,_0xce54('0x19'),_0x375ae4[_0xce54('0x1d')]+_0xce54('0x1e')))){var _0x486d35=[];switch(_0x375ae4['app'][_0xce54('0x1f')]()){case'autoreply':var _0x3a6649=_0x375ae4[_0xce54('0x20')][_0xce54('0x21')](',');if(_0x14b863[_0xce54('0x14')]===_0xce54('0x22')){_0x486d35[_0xce54('0x23')](_0x3a6649[0x0]);_0x486d35['push'](_0x3a6649[0x1]);_0x486d35[_0xce54('0x23')](_0x3a6649[_0xce54('0x24')](0x2,_0x3a6649['length'])[_0xce54('0x1c')](','));}else{_0x486d35[_0xce54('0x23')](_0x3a6649[0x0]);_0x486d35[_0xce54('0x23')](_0x3a6649[_0xce54('0x24')](0x1,_0x3a6649[_0xce54('0x1a')])[_0xce54('0x1c')](','));}break;case'dialogflow':var _0x3e1a28=_0x375ae4['appdata']['split'](',');_0x486d35[_0xce54('0x23')](_0x3e1a28[0x0]);_0x486d35[_0xce54('0x23')](_0x3e1a28[0x1]);_0x486d35[_0xce54('0x23')](_0x3e1a28['slice'](0x2,_0x3e1a28[_0xce54('0x1a')])[_0xce54('0x1c')](','));break;case'dialogflowv2':var _0x5a9ba7=_0x375ae4[_0xce54('0x20')][_0xce54('0x21')](',');_0x486d35[_0xce54('0x23')](_0x5a9ba7[0x0]);_0x486d35['push'](_0x5a9ba7[0x1]);_0x486d35[_0xce54('0x23')](_0x5a9ba7[0x2]);_0x486d35[_0xce54('0x23')](_0x5a9ba7[0x3]);_0x486d35[_0xce54('0x23')](_0x5a9ba7[_0xce54('0x24')](0x4,_0x5a9ba7[_0xce54('0x1a')])[_0xce54('0x1c')](','));break;case _0xce54('0x25'):var _0x182741=_0x375ae4[_0xce54('0x20')][_0xce54('0x21')](',');_0x486d35[_0xce54('0x23')](_0x182741[0x0]);_0x486d35[_0xce54('0x23')](_0x182741[0x1]);_0x486d35['push'](_0x182741[0x2]);_0x486d35['push'](_0x182741[0x3]);_0x486d35['push'](_0x182741[_0xce54('0x24')](0x4,_0x182741[_0xce54('0x1a')])['join'](','));break;case'message':_0x486d35[_0xce54('0x23')](_0x375ae4[_0xce54('0x20')]);break;case _0xce54('0x26'):_0x486d35[_0xce54('0x23')](_0x375ae4[_0xce54('0x27')]);_0x486d35[_0xce54('0x23')](_0x375ae4[_0xce54('0x20')]);break;case _0xce54('0x28'):var _0x29824b=utils[_0xce54('0x29')](_0x14b863['account']['notificationTemplate'],_0x14b863);var _0x52e664=_0x375ae4['appdata'][_0xce54('0x21')](',');_0x486d35[_0xce54('0x23')](_0x52e664[0x0]);_0x486d35[_0xce54('0x23')](_0x52e664[0x1]);_0x486d35[_0xce54('0x23')](_0x52e664[0x2]);_0x486d35['push'](_0x52e664[0x3]);_0x486d35[_0xce54('0x23')](_0x52e664[0x4]);_0x486d35['push'](_0x52e664[0x5]);_0x486d35[_0xce54('0x23')](_0x52e664[0x6]);_0x486d35[_0xce54('0x23')](_0x52e664[0x7]);_0x486d35[_0xce54('0x23')](_0x52e664[0x8]);_0x486d35['push'](_0x52e664[0x9]);_0x486d35['push'](_0x52e664[0xa]);_0x486d35[_0xce54('0x23')](_0x14b863['interaction']['id']);_0x486d35['push'](_0x14b863[_0xce54('0x15')]['id']);_0x486d35[_0xce54('0x23')](_0x375ae4[_0xce54('0x2a')]);_0x486d35[_0xce54('0x23')](_0x14b863[_0xce54('0x16')][_0xce54('0x2b')]);_0x486d35[_0xce54('0x23')](_0x14b863[_0xce54('0x2c')][_0xce54('0x2c')]);_0x486d35[_0xce54('0x23')](_0x29824b);break;default:_0x486d35=_[_0xce54('0xe')](_0x375ae4[_0xce54('0x20')])?[]:_0x375ae4[_0xce54('0x20')][_0xce54('0x21')](',');}var _0x3f13a5={'id':util[_0xce54('0xc')]('%s:%s:%s',_0x3eee0d,_0x375ae4['id'],_0x375ae4[_0xce54('0x1d')]),'condition':require('./interval')['condition'](_0x3eee0d,getIntervals(_0x1f7a09['intervals'],_0x375ae4),_0x1f7a09),'consequence':require(_0xce54('0x2d')+_0x375ae4['app'])['consequence'](_0x3eee0d,_0x486d35,_0x1f7a09,_0x14b863),'p':_0x375ae4[_0xce54('0x2e')]||0x0};logger[_0xce54('0x2f')](_0xce54('0x30'),_0x3f13a5['id'],'on\x20interval',getIntervals(_0x1f7a09[_0xce54('0x31')],_0x375ae4)[_0xce54('0x1c')]('\x20|\x20'));_0x4fafc0[_0xce54('0x23')](_0x3f13a5);}else{logger[_0xce54('0x32')](_0xce54('0x33'),path[_0xce54('0x1c')](__dirname,'applications',_0x375ae4[_0xce54('0x1d')]+'.js'));}}_0x1f7a09['rules'][_0x3eee0d]=new RuleEngine(_0x4fafc0);_0x1f7a09[_0xce54('0x34')][_0x3eee0d][_0xce54('0x35')](_0x14b863,function(_0x5b0e58){logger['info']('Applications\x20executed',JSON[_0xce54('0x36')](_0x5b0e58[_0xce54('0x37')]));if(_0x1f7a09[_0xce54('0x34')][_0x3eee0d]){_0x1f7a09[_0xce54('0x34')][_0x3eee0d][_0xce54('0x38')](_0xce54('0x39'));}});return _0x3c8569({'code':0xc8,'message':_0x14b863});}else{if(_0x340e8e){logger[_0xce54('0x2f')](util[_0xce54('0xc')](_0xce54('0x3a'),_0x3eee0d));}else{logger[_0xce54('0x2f')](_0xce54('0x3b'));}return _0x3c8569({'code':0xc8,'message':_0x14b863});}}catch(_0x342551){logger['error'](_0x342551[_0xce54('0x3c')]);return _0x57effb(_0x19724c[_0xce54('0x32')](0x1f4,_0x342551));}}return _0x57effb(_0xce54('0x3d'));});},'AcceptMessage':function(_0x478fc3){var _0x3fee4f=this;return new Promise(function(_0x446a17,_0x21151f){if(_0x478fc3[_0xce54('0x3e')]&&_0x478fc3[_0xce54('0x3e')]['id']){if(_0x1f7a09[_0xce54('0x3f')][_0x478fc3[_0xce54('0x3e')]['id']]){_0x1f7a09[_0xce54('0x3f')][_0x478fc3[_0xce54('0x3e')]['id']][_0xce54('0x40')]=![];_0x1f7a09[_0xce54('0x3f')][_0x478fc3[_0xce54('0x3e')]['id']]['busyQueue']=undefined;}}if(_0x478fc3['message']&&_0x478fc3['message']['id']){try{var _0x4cc9cb=getId(_0x478fc3[_0xce54('0x14')],_0x478fc3[_0xce54('0x15')]?_0x478fc3[_0xce54('0x15')]['id']:0x0,_0x478fc3[_0xce54('0x16')]?_0x478fc3[_0xce54('0x16')]['id']:0x0);if(_0x1f7a09[_0xce54('0x34')][_0x4cc9cb]){_0x1f7a09['rules'][_0x4cc9cb][_0xce54('0x38')](_0xce54('0x41'));if(rpc[_0x478fc3[_0xce54('0x14')]+_0xce54('0x42')]){rpc[_0x478fc3[_0xce54('0x14')]+_0xce54('0x42')]['update'](_0x4cc9cb,{'UserId':_0x478fc3['message'][_0xce54('0x43')]})[_0xce54('0x44')](function(){logger['error'](_0xce54('0x45'));});}}return _0x446a17({'code':0xc8,'message':_0x478fc3});}catch(_0x53d950){logger[_0xce54('0x32')](_0x53d950[_0xce54('0x3c')]);return _0x21151f(_0x3fee4f[_0xce54('0x32')](0x1f4,_0x53d950));}}logger['error'](_0xce54('0x46'));return _0x21151f(_0x3fee4f[_0xce54('0x32')](0x1f4,_0xce54('0x46')));});},'RejectMessage':function(_0x13f78b){var _0x208943=this;return new Promise(function(_0xdaa118,_0x43fda2){if(_0x13f78b['agent']&&_0x13f78b[_0xce54('0x3e')]['id']){try{if(_0x1f7a09[_0xce54('0x3f')][_0x13f78b[_0xce54('0x3e')]['id']]){_0x1f7a09[_0xce54('0x3f')][_0x13f78b[_0xce54('0x3e')]['id']][_0xce54('0x40')]=![];_0x1f7a09['agents'][_0x13f78b[_0xce54('0x3e')]['id']][_0xce54('0x47')]=undefined;}return _0xdaa118({'code':0xc8,'message':_0x13f78b});}catch(_0x5ed03d){logger[_0xce54('0x32')](_0x5ed03d[_0xce54('0x3c')]);return _0x43fda2(_0x208943[_0xce54('0x32')](0x1f4,_0x5ed03d));}}logger[_0xce54('0x32')](_0xce54('0x46'));return _0x43fda2(_0x208943[_0xce54('0x32')](0x1f4,_0xce54('0x46')));});},'AbandonInteraction':function(_0x511919){var _0x3d996f=this;return new Promise(function(_0xa58008,_0x2a18d2){if(_0x511919['channel']&&_0x511919['interaction']&&_0x511919[_0xce54('0x16')]['id']){try{var _0x5c5303=getId(_0x511919[_0xce54('0x14')],_0x511919[_0xce54('0x15')]?_0x511919[_0xce54('0x15')]['id']:0x0,_0x511919['interaction']?_0x511919['interaction']['id']:0x0);if(_0x1f7a09[_0xce54('0x34')][_0x5c5303]){_0x1f7a09[_0xce54('0x34')][_0x5c5303][_0xce54('0x38')](_0xce54('0x41'));}return _0xa58008({'code':0xc8,'message':_0x511919});}catch(_0x3bc1df){logger[_0xce54('0x32')](_0x3bc1df[_0xce54('0x3c')]);return _0x2a18d2(_0x3d996f['error'](0x1f4,_0x3bc1df));}}logger[_0xce54('0x32')](_0xce54('0x46'));return _0x2a18d2(_0x3d996f[_0xce54('0x32')](0x1f4,_0xce54('0x46')));});},'AgentCapacity':function(_0x4ecc5f){var _0x5e2c97=this;return new Promise(function(_0x520b48,_0x7cac35){if(_0x1f7a09[_0xce54('0x3f')][_0xce54('0x48')](_0x4ecc5f['id'])){for(var _0x24ecb5 in _0x4ecc5f[_0xce54('0x49')]){if(_0x4ecc5f['capacity']['hasOwnProperty'](_0x24ecb5)){if(_0x1f7a09[_0xce54('0x3f')][_0x4ecc5f['id']]['hasOwnProperty'](_0x24ecb5+_0xce54('0x4a'))){_0x1f7a09[_0xce54('0x3f')][_0x4ecc5f['id']][_0x24ecb5+_0xce54('0x4a')]=parseInt(_0x4ecc5f['capacity'][_0x24ecb5],0xa);}}}_0x1f7a09['agents'][_0x4ecc5f['id']][_0xce54('0x4b')]();return _0x520b48({'code':0xc8,'message':_0x1f7a09[_0xce54('0x3f')][_0x4ecc5f['id']]});}else{return _0x7cac35(_0x5e2c97[_0xce54('0x32')](0x1f4,_0xce54('0x4c')));}});},'Agents':function(_0x51a685){return new Promise(function(_0x55a911){var _0x34361a=_['values'](_0x1f7a09[_0xce54('0x3f')]);if(_0x51a685&&_0x51a685['id']){var _0x41dfec=_[_0xce54('0x4d')](_0x34361a,function(_0x18996c){return _0x18996c['id']===_0x51a685['id'];});_0x55a911(_0x41dfec);}else{_0x55a911({'count':_0x34361a[_0xce54('0x1a')],'rows':_0x34361a});}});},'ChatQueues':function(){return new Promise(function(_0x519345){var _0x376ee8=[];for(var _0x122c70 in _0x1f7a09['chatQueues']){if(_0x1f7a09[_0xce54('0x4e')][_0xce54('0x48')](_0x122c70)){var _0x144765=_0x1f7a09[_0xce54('0x4e')][_0x122c70];var _0x3b940a={'id':_0x144765['id'],'available':_0x144765[_0xce54('0x4f')],'loggedIn':_0x144765[_0xce54('0x50')],'name':_0x144765[_0xce54('0x51')],'paused':_0x144765[_0xce54('0x52')],'waiting':_0x144765[_0xce54('0x53')]};_0x376ee8[_0xce54('0x23')](_0x3b940a);}}_0x519345({'count':_0x376ee8[_0xce54('0x1a')],'rows':_0x376ee8});});},'MailQueues':function(){return new Promise(function(_0x3cc676){var _0x4d74e3=[];for(var _0xf01211 in _0x1f7a09[_0xce54('0x54')]){if(_0x1f7a09[_0xce54('0x54')]['hasOwnProperty'](_0xf01211)){var _0x5bb2a5=_0x1f7a09[_0xce54('0x54')][_0xf01211];var _0x389b09={'id':_0x5bb2a5['id'],'available':_0x5bb2a5['available'],'loggedIn':_0x5bb2a5[_0xce54('0x50')],'name':_0x5bb2a5[_0xce54('0x51')],'paused':_0x5bb2a5[_0xce54('0x52')],'waiting':_0x5bb2a5['waiting']};_0x4d74e3['push'](_0x389b09);}}_0x3cc676({'count':_0x4d74e3['length'],'rows':_0x4d74e3});});},'OpenchannelQueues':function(){return new Promise(function(_0x592e6e){var _0x48fd7e=[];for(var _0x3f49a8 in _0x1f7a09[_0xce54('0x55')]){if(_0x1f7a09[_0xce54('0x55')][_0xce54('0x48')](_0x3f49a8)){var _0x306092=_0x1f7a09[_0xce54('0x55')][_0x3f49a8];var _0x95205b={'id':_0x306092['id'],'available':_0x306092[_0xce54('0x4f')],'loggedIn':_0x306092[_0xce54('0x50')],'name':_0x306092[_0xce54('0x51')],'paused':_0x306092[_0xce54('0x52')],'waiting':_0x306092[_0xce54('0x53')]};_0x48fd7e[_0xce54('0x23')](_0x95205b);}}_0x592e6e({'count':_0x48fd7e['length'],'rows':_0x48fd7e});});},'SmsQueues':function(){return new Promise(function(_0x5cf85c){var _0x53cfaa=[];for(var _0x20cc5a in _0x1f7a09[_0xce54('0x56')]){if(_0x1f7a09[_0xce54('0x56')][_0xce54('0x48')](_0x20cc5a)){var _0x3a8cd0=_0x1f7a09[_0xce54('0x56')][_0x20cc5a];var _0x29bbdb={'id':_0x3a8cd0['id'],'available':_0x3a8cd0[_0xce54('0x4f')],'loggedIn':_0x3a8cd0[_0xce54('0x50')],'name':_0x3a8cd0[_0xce54('0x51')],'paused':_0x3a8cd0[_0xce54('0x52')],'waiting':_0x3a8cd0[_0xce54('0x53')]};_0x53cfaa[_0xce54('0x23')](_0x29bbdb);}}_0x5cf85c({'count':_0x53cfaa[_0xce54('0x1a')],'rows':_0x53cfaa});});},'FaxQueues':function(){return new Promise(function(_0x49988a){var _0x1dd073=[];for(var _0x36b3f6 in _0x1f7a09['faxQueues']){if(_0x1f7a09['faxQueues'][_0xce54('0x48')](_0x36b3f6)){var _0x165c44=_0x1f7a09[_0xce54('0x57')][_0x36b3f6];var _0x85ae1e={'id':_0x165c44['id'],'available':_0x165c44[_0xce54('0x4f')],'loggedIn':_0x165c44['loggedIn'],'name':_0x165c44['name'],'paused':_0x165c44['paused'],'waiting':_0x165c44[_0xce54('0x53')]};_0x1dd073[_0xce54('0x23')](_0x85ae1e);}}_0x49988a({'count':_0x1dd073[_0xce54('0x1a')],'rows':_0x1dd073});});},'WhatsappQueues':function(){return new Promise(function(_0x1c41e4){var _0x2beaef=[];for(var _0x8ce65c in _0x1f7a09[_0xce54('0x58')]){if(_0x1f7a09[_0xce54('0x58')][_0xce54('0x48')](_0x8ce65c)){var _0x4c2507=_0x1f7a09[_0xce54('0x58')][_0x8ce65c];var _0x3ff153={'id':_0x4c2507['id'],'available':_0x4c2507['available'],'loggedIn':_0x4c2507[_0xce54('0x50')],'name':_0x4c2507[_0xce54('0x51')],'paused':_0x4c2507[_0xce54('0x52')],'waiting':_0x4c2507[_0xce54('0x53')]};_0x2beaef[_0xce54('0x23')](_0x3ff153);}}_0x1c41e4({'count':_0x2beaef[_0xce54('0x1a')],'rows':_0x2beaef});});},'ChatQueuesWaitingInteractions':function(){return new Promise(function(_0x12a82b){var _0xfa301f=_[_0xce54('0x59')](_0x1f7a09[_0xce54('0x5a')]);_0x12a82b({'count':_0xfa301f[_0xce54('0x1a')],'rows':_0xfa301f});});},'MailQueuesWaitingInteractions':function(){return new Promise(function(_0x9623a0){var _0x3716ec=_[_0xce54('0x59')](_0x1f7a09[_0xce54('0x5b')]);_0x9623a0({'count':_0x3716ec['length'],'rows':_0x3716ec});});},'OpenchannelQueuesWaitingInteractions':function(){return new Promise(function(_0x185a2b){var _0x4a8bea=_[_0xce54('0x59')](_0x1f7a09['openchannelQueuesWaitingInteractions']);_0x185a2b({'count':_0x4a8bea[_0xce54('0x1a')],'rows':_0x4a8bea});});},'SmsQueuesWaitingInteractions':function(){return new Promise(function(_0x4dce8b){var _0x14e5f6=_['values'](_0x1f7a09[_0xce54('0x5c')]);_0x4dce8b({'count':_0x14e5f6[_0xce54('0x1a')],'rows':_0x14e5f6});});},'FaxQueuesWaitingInteractions':function(){return new Promise(function(_0x62c7c1){var _0x1dc888=_[_0xce54('0x59')](_0x1f7a09[_0xce54('0x5d')]);_0x62c7c1({'count':_0x1dc888[_0xce54('0x1a')],'rows':_0x1dc888});});},'WhatsappQueuesWaitingInteractions':function(){return new Promise(function(_0x2b3ceb){var _0x58129a=_[_0xce54('0x59')](_0x1f7a09[_0xce54('0x5e')]);_0x2b3ceb({'count':_0x58129a[_0xce54('0x1a')],'rows':_0x58129a});});}};var _0x495480=jayson['server'](_0x14befa)['http']();_0x495480['on'](_0xce54('0x32'),function(_0x1ec0c0){logger[_0xce54('0x32')](JSON[_0xce54('0x36')](_0x1ec0c0));return _0x355e0f(_0x1ec0c0);});_0x495480[_0xce54('0x13')](0x232c,'127.0.0.1',function(){console['log'](_0xce54('0x5f'),0x232c);return _0x586520(_0xce54('0x60')+0x232c);});});}; \ No newline at end of file diff --git a/server/services/routing/server/interval.js b/server/services/routing/server/interval.js index 4abad9f..03b2479 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 _0x62cf=['client','http','request','then','error','condition','rules','info','[%s][INTERVAL]\x20ROUTING\x20STOPPED','stop','push','Command','format','iftime\x20%s','message','indexOf','true','[%s][INTERVAL]\x20%s','all','some','[%s][INTERVAL]\x20%s\x20%s','join','\x20|\x20','catch','log','stack','bluebird','jayson/promise','lodash','../../../config/logger'];(function(_0xf67957,_0x17ab63){var _0x26f414=function(_0x3353ea){while(--_0x3353ea){_0xf67957['push'](_0xf67957['shift']());}};_0x26f414(++_0x17ab63);}(_0x62cf,0x164));var _0xf62c=function(_0x958575,_0x368ef1){_0x958575=_0x958575-0x0;var _0x31f929=_0x62cf[_0x958575];return _0x31f929;};'use strict';var util=require('util');var BPromise=require(_0xf62c('0x0'));var jayson=require(_0xf62c('0x1'));var _=require(_0xf62c('0x2'));var logger=require(_0xf62c('0x3'))('routing');var client=jayson[_0xf62c('0x4')][_0xf62c('0x5')]({'port':0x232a});function request(_0x108b74,_0x6cb15b){return new BPromise(function(_0xec9cfc,_0x1c21ce){return client[_0xf62c('0x6')](_0x108b74,_0x6cb15b)[_0xf62c('0x7')](function(_0x2b83d0){if(_0x2b83d0[_0xf62c('0x8')]){return _0x1c21ce(_0x2b83d0[_0xf62c('0x8')]['message']);}else{return _0xec9cfc(_0x2b83d0['result']);}})['catch'](function(_0x346b81){return _0x1c21ce(_0x346b81);});});}exports[_0xf62c('0x9')]=function(_0xeda78a,_0x389edb,_0x3d729d){return function(_0x2b1e28){if(_0x3d729d[_0xf62c('0xa')]&&!_0x3d729d[_0xf62c('0xa')][_0xeda78a]){logger[_0xf62c('0xb')](_0xf62c('0xc'),_0xeda78a);return _0x2b1e28[_0xf62c('0xd')]();}var _0x3253d7=[];for(var _0x4759dd=0x0;_0x4759dd<_0x389edb['length'];_0x4759dd+=0x1){_0x3253d7[_0xf62c('0xe')](request(_0xf62c('0xf'),{'command':util[_0xf62c('0x10')](_0xf62c('0x11'),_0x389edb[_0x4759dd])})[_0xf62c('0x7')](function(_0xa609b9){return _0xa609b9&&_0xa609b9[_0xf62c('0x12')]&&_0xa609b9[_0xf62c('0x12')][_0xf62c('0x13')](_0xf62c('0x14'))>=0x0?!![]:![];})['catch'](function(_0xe97f58){logger[_0xf62c('0x8')](_0xf62c('0x15'),_0xeda78a,_0x389edb[_0x4759dd]);}));}BPromise[_0xf62c('0x16')](_0x3253d7)[_0xf62c('0x7')](function(_0x18fb49){var _0x1784f7=_[_0xf62c('0x17')](_0x18fb49);logger[_0xf62c('0xb')](_0xf62c('0x18'),_0xeda78a,_0x389edb[_0xf62c('0x19')](_0xf62c('0x1a')),_0x1784f7);_0x2b1e28['when'](_0x1784f7);})[_0xf62c('0x1b')](function(_0x5d18f3){console[_0xf62c('0x1c')](_0x5d18f3);logger[_0xf62c('0x8')]('[%s][INTERVAL]\x20%s\x20%s',_0xeda78a,_0x389edb[_0xf62c('0x19')]('\x20|\x20'),_0x5d18f3[_0xf62c('0x1d')]);_0x2b1e28['stop']();});};}; \ No newline at end of file +var _0x0879=['rules','info','[%s][INTERVAL]\x20ROUTING\x20STOPPED','stop','map','join','[%s][INTERVAL\x20NOT\x20VALID]\x20%s\x20%s','\x20|\x20','lodash','../../../utils/iftime','../../../config/logger','routing','condition'];(function(_0x23413b,_0xa8aa31){var _0x395459=function(_0x466153){while(--_0x466153){_0x23413b['push'](_0x23413b['shift']());}};_0x395459(++_0xa8aa31);}(_0x0879,0x1e9));var _0x9087=function(_0x5d689d,_0x3fac90){_0x5d689d=_0x5d689d-0x0;var _0x33a7a7=_0x0879[_0x5d689d];return _0x33a7a7;};'use strict';var _=require(_0x9087('0x0'));var iftime=require(_0x9087('0x1'))['iftime'];var logger=require(_0x9087('0x2'))(_0x9087('0x3'));exports[_0x9087('0x4')]=function(_0x58061e,_0x712373,_0x389bc2){return function(_0x440d77){if(_0x389bc2[_0x9087('0x5')]&&!_0x389bc2['rules'][_0x58061e]){logger[_0x9087('0x6')](_0x9087('0x7'),_0x58061e);return _0x440d77[_0x9087('0x8')]();}var _0x1f2a9a=_0x712373[_0x9087('0x9')](function(_0x174a24){return iftime(_0x174a24);});var _0x3608c6=_['some'](_0x1f2a9a);if(_0x3608c6){logger[_0x9087('0x6')]('[%s][INTERVAL\x20VALID]\x20%s\x20%s',_0x58061e,_0x712373[_0x9087('0xa')]('\x20|\x20'),_0x3608c6);_0x440d77['when'](_0x3608c6);}else{logger[_0x9087('0x6')](_0x9087('0xb'),_0x58061e,_0x712373['join'](_0x9087('0xc')));_0x440d77[_0x9087('0x8')]();}};}; \ No newline at end of file diff --git a/server/services/xdr/agents.controller.js b/server/services/xdr/agents.controller.js index dd63070..7610c34 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 _0x153f=['type','agentacw','agentcomplete','acw','acwTimeout','request','CreateVoiceAgentReport','destuniqueid','agentcalled','debug','[%s][agents][agentcalled]','agentcalledAt','now','lastevent','called','[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','error','agentringnoanswer','isNil','[%s][agents][agentringnoanswer]','[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout','agentringnoanswerAt','timeout','reason','holdtime','ringtime','talktime','queuecallerabandon','forIn','includes','abandoned','[%s][agents][queuecallerabandon]','agentconnect','[%s][agents][agentconnect]','[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','connectedlinename','connect','answered_elsewhere','answeredelsewheredestinationuniqueid','answeredelsewheremembername','[%s][agents][agentcomplete]','[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','diffTime','agentconnectAt','complete','blindtransfer','transfereruniqueid','[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s','transfer','blind','transferuniqueid','[%s][agents][blindtransfer]','attendedtransfer','[%s][agents][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','secondtransfereruniqueid','[%s][agents][attendedtransfer]\x20agent:%s','transfertype','ATTENDED','transferexten','origtransfererexten','transfereeuniqueid','agententerreason','clone','calleridname','secondtransfererlinkedid','secondtransfererexten','transfertargetuniqueid','hangup','[%s][agents][hangup]','cause','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','indexOf','splice','agentcompleteAt','agent','lodash','util','./utils','info','format','uniqueid','queue','membername','interface','calleridnum','connectedlinenum','getVoiceQueueByName','then'];(function(_0x55f8b4,_0x43f30d){var _0x2475f9=function(_0xdd6f4a){while(--_0xdd6f4a){_0x55f8b4['push'](_0x55f8b4['shift']());}};_0x2475f9(++_0x43f30d);}(_0x153f,0x15b));var _0xf153=function(_0x56da73,_0x5add2b){_0x56da73=_0x56da73-0x0;var _0x5a7d25=_0x153f[_0x56da73];return _0x5a7d25;};'use strict';var _=require(_0xf153('0x0'));var util=require(_0xf153('0x1'));var utils=require(_0xf153('0x2'));var agents={};var transfers={};var unanswered=[];function writeDB(_0x44cea3,_0x2afb9a){utils[_0xf153('0x3')](util[_0xf153('0x4')]('[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s',_0x44cea3[_0xf153('0x5')],_0x44cea3['channel'],_0x44cea3[_0xf153('0x6')],_0x44cea3[_0xf153('0x7')],_0x44cea3[_0xf153('0x8')],_0x44cea3[_0xf153('0x9')],_0x44cea3[_0xf153('0xa')],_0x44cea3['lastevent']));if(_0x44cea3[_0xf153('0x6')]){utils[_0xf153('0xb')](_0x44cea3[_0xf153('0x6')])[_0xf153('0xc')](function(_0x253fd3){if(_0x253fd3){_0x44cea3[_0xf153('0xd')]=_0x253fd3[_0xf153('0xd')];_0x44cea3[_0xf153('0xe')]=_0x44cea3[_0xf153('0xf')]?_0x253fd3[_0xf153('0x10')]:![];_0x44cea3['acwtime']=_0x44cea3[_0xf153('0xe')]?_0x253fd3[_0xf153('0x11')]:0x0;}utils[_0xf153('0x12')]('CreateVoiceAgentReport',_0x44cea3);});}else{utils[_0xf153('0x12')](_0xf153('0x13'),_0x44cea3);}if(_0x2afb9a){delete transfers[_0x44cea3[_0xf153('0x5')]];}else{delete agents[_0x44cea3[_0xf153('0x14')]];}}exports[_0xf153('0x15')]=function(_0x107d31){try{utils[_0xf153('0x16')](util[_0xf153('0x4')](_0xf153('0x17'),_0x107d31['uniqueid']),_0x107d31);agents[_0x107d31[_0xf153('0x14')]]=_0x107d31;agents[_0x107d31[_0xf153('0x14')]][_0xf153('0x18')]=utils[_0xf153('0x19')]();agents[_0x107d31[_0xf153('0x14')]][_0xf153('0x1a')]=_0xf153('0x1b');agents[_0x107d31[_0xf153('0x14')]]['connectedlinenum']=null;agents[_0x107d31[_0xf153('0x14')]]['connectedlinename']=null;utils[_0xf153('0x3')](util[_0xf153('0x4')](_0xf153('0x1c'),_0x107d31[_0xf153('0x5')],agents[_0x107d31['destuniqueid']][_0xf153('0x7')],_0x107d31[_0xf153('0x14')]));}catch(_0x41946a){utils[_0xf153('0x1d')](util[_0xf153('0x4')](_0xf153('0x17'),_0x107d31[_0xf153('0x5')]),_0x41946a);}};exports[_0xf153('0x1e')]=function(_0x3735a7){try{if(!_[_0xf153('0x1f')](agents[_0x3735a7[_0xf153('0x14')]])){utils[_0xf153('0x16')](util['format'](_0xf153('0x20'),_0x3735a7[_0xf153('0x5')]),_0x3735a7);utils[_0xf153('0x3')](util[_0xf153('0x4')](_0xf153('0x21'),_0x3735a7[_0xf153('0x5')],agents[_0x3735a7[_0xf153('0x14')]][_0xf153('0x7')],_0x3735a7[_0xf153('0x14')]));agents[_0x3735a7[_0xf153('0x14')]][_0xf153('0x1e')]=!![];agents[_0x3735a7[_0xf153('0x14')]][_0xf153('0x22')]=utils[_0xf153('0x19')]();agents[_0x3735a7[_0xf153('0x14')]][_0xf153('0x1a')]=_0xf153('0x23');agents[_0x3735a7[_0xf153('0x14')]][_0xf153('0x24')]=_0xf153('0x23');agents[_0x3735a7['destuniqueid']][_0xf153('0x25')]=_0x3735a7[_0xf153('0x26')]?parseInt(_0x3735a7['ringtime'])/0x3e8:0x0;agents[_0x3735a7[_0xf153('0x14')]][_0xf153('0x27')]=0x0;unanswered['push'](_0x3735a7[_0xf153('0x14')]);}}catch(_0x10295e){utils[_0xf153('0x1d')](util[_0xf153('0x4')](_0xf153('0x20'),_0x3735a7[_0xf153('0x5')]),_0x10295e);}};exports[_0xf153('0x28')]=function(_0x3b5f4f){try{_[_0xf153('0x29')](agents,function(_0x8e31bf,_0x13b541){if(_0x8e31bf[_0xf153('0x5')]==_0x3b5f4f['uniqueid']&&!_[_0xf153('0x2a')](unanswered,_0x8e31bf[_0xf153('0x14')])){utils[_0xf153('0x16')](util[_0xf153('0x4')]('[%s][agents][queuecallerabandon]',_0x3b5f4f['uniqueid']),_0x3b5f4f);utils[_0xf153('0x3')](util['format']('[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned',_0x3b5f4f[_0xf153('0x5')],_0x8e31bf['membername'],_0x8e31bf[_0xf153('0x14')]));_0x8e31bf['agentringnoanswer']=!![];_0x8e31bf[_0xf153('0x22')]=utils[_0xf153('0x19')]();_0x8e31bf['lastevent']=_0xf153('0x2b');_0x8e31bf[_0xf153('0x24')]=_0xf153('0x2b');_0x8e31bf[_0xf153('0x25')]=_0x3b5f4f[_0xf153('0x25')];_0x8e31bf[_0xf153('0x27')]=0x0;writeDB(_0x8e31bf);}});}catch(_0x4ab69c){utils[_0xf153('0x1d')](util['format'](_0xf153('0x2c'),_0x3b5f4f[_0xf153('0x5')]),_0x4ab69c);}};exports[_0xf153('0x2d')]=function(_0x1820c3){try{if(agents[_0x1820c3[_0xf153('0x14')]]){utils[_0xf153('0x16')](util['format'](_0xf153('0x2e'),_0x1820c3[_0xf153('0x5')]),_0x1820c3);utils[_0xf153('0x3')](util['format'](_0xf153('0x2f'),_0x1820c3[_0xf153('0x5')],agents[_0x1820c3[_0xf153('0x14')]][_0xf153('0x7')],_0x1820c3[_0xf153('0x14')]));agents[_0x1820c3[_0xf153('0x14')]]['agentconnectAt']=utils[_0xf153('0x19')]();agents[_0x1820c3[_0xf153('0x14')]]['connectedlinenum']=_0x1820c3[_0xf153('0xa')];agents[_0x1820c3[_0xf153('0x14')]][_0xf153('0x30')]=_0x1820c3[_0xf153('0x30')];agents[_0x1820c3[_0xf153('0x14')]][_0xf153('0x25')]=_0x1820c3[_0xf153('0x26')];agents[_0x1820c3['destuniqueid']][_0xf153('0x1a')]=_0xf153('0x31');_[_0xf153('0x29')](agents,function(_0x352e7c,_0x25657a){if(_0x352e7c[_0xf153('0x14')]!=_0x1820c3['destuniqueid']&&_0x352e7c['uniqueid']==_0x1820c3[_0xf153('0x5')]){_0x352e7c['talktime']=0x0;_0x352e7c[_0xf153('0x25')]=_0x1820c3[_0xf153('0x26')];_0x352e7c[_0xf153('0x1e')]=!![];_0x352e7c[_0xf153('0x22')]=utils[_0xf153('0x19')]();_0x352e7c[_0xf153('0x1a')]='answered_elsewhere';_0x352e7c['reason']=_0xf153('0x32');_0x352e7c[_0xf153('0x33')]=_0x1820c3['destuniqueid'];_0x352e7c[_0xf153('0x34')]=_0x1820c3[_0xf153('0x7')];writeDB(_0x352e7c);}});}}catch(_0x1edf65){utils[_0xf153('0x1d')](util[_0xf153('0x4')](_0xf153('0x2e'),_0x1820c3[_0xf153('0x5')]),_0x1edf65);}};exports[_0xf153('0xf')]=function(_0x1b453f){try{if(!_[_0xf153('0x1f')](agents[_0x1b453f[_0xf153('0x14')]])){utils[_0xf153('0x16')](util['format'](_0xf153('0x35'),_0x1b453f[_0xf153('0x5')]),_0x1b453f);utils[_0xf153('0x3')](util['format'](_0xf153('0x36'),_0x1b453f[_0xf153('0x5')],agents[_0x1b453f['destuniqueid']][_0xf153('0x7')],_0x1b453f['destuniqueid']));agents[_0x1b453f[_0xf153('0x14')]][_0xf153('0xf')]=!![];agents[_0x1b453f[_0xf153('0x14')]]['agentcompleteAt']=utils[_0xf153('0x19')]();agents[_0x1b453f[_0xf153('0x14')]][_0xf153('0x27')]=utils[_0xf153('0x37')](agents[_0x1b453f[_0xf153('0x14')]]['agentcompleteAt'],agents[_0x1b453f[_0xf153('0x14')]][_0xf153('0x38')]);agents[_0x1b453f['destuniqueid']][_0xf153('0x24')]=_0x1b453f[_0xf153('0x24')];agents[_0x1b453f[_0xf153('0x14')]]['lastevent']=_0xf153('0x39');writeDB(agents[_0x1b453f[_0xf153('0x14')]]);}}catch(_0x82dc34){utils[_0xf153('0x1d')](util[_0xf153('0x4')](_0xf153('0x35'),_0x1b453f[_0xf153('0x5')]),_0x82dc34);}};exports[_0xf153('0x3a')]=function(_0x3b91ed){try{if(!_['isNil'](agents[_0x3b91ed[_0xf153('0x3b')]])){utils['debug'](util['format']('[%s][agents][blindtransfer]',_0x3b91ed[_0xf153('0x5')]),_0x3b91ed);utils[_0xf153('0x3')](util['format'](_0xf153('0x3c'),_0x3b91ed[_0xf153('0x5')],agents[_0x3b91ed['transfereruniqueid']][_0xf153('0x7')],agents[_0x3b91ed[_0xf153('0x3b')]][_0xf153('0x5')]));agents[_0x3b91ed[_0xf153('0x3b')]][_0xf153('0x3d')]=!![];agents[_0x3b91ed[_0xf153('0x3b')]]['transfertype']=_0xf153('0x3e');agents[_0x3b91ed[_0xf153('0x3b')]]['transferexten']=_0x3b91ed['extension'];agents[_0x3b91ed[_0xf153('0x3b')]][_0xf153('0x3f')]=agents[_0x3b91ed[_0xf153('0x3b')]][_0xf153('0x5')];}}catch(_0x419e7e){utils[_0xf153('0x1d')](util['format'](_0xf153('0x40'),_0x3b91ed['uniqueid']),_0x419e7e);}};exports[_0xf153('0x41')]=function(_0x365209){try{utils[_0xf153('0x16')](util['format'](_0xf153('0x42'),_0x365209[_0xf153('0x43')]),_0x365209);if(_0x365209[_0xf153('0x43')]==_0x365209[_0xf153('0x44')]){if(!_[_0xf153('0x1f')](agents[_0x365209[_0xf153('0x45')]])){utils[_0xf153('0x3')](util['format'](_0xf153('0x46'),_0x365209[_0xf153('0x43')],agents[_0x365209[_0xf153('0x45')]]['membername']));agents[_0x365209[_0xf153('0x45')]][_0xf153('0x3d')]=!![];agents[_0x365209[_0xf153('0x45')]][_0xf153('0x47')]=_0xf153('0x48');agents[_0x365209[_0xf153('0x45')]][_0xf153('0x49')]=_0x365209[_0xf153('0x4a')];agents[_0x365209['secondtransfereruniqueid']][_0xf153('0x3f')]=_0x365209[_0xf153('0x43')];}if(_0x365209['transfereeuniqueid']&&agents[_0x365209[_0xf153('0x4b')]]){agents[_0x365209[_0xf153('0x4b')]][_0xf153('0x4c')]=0x1;transfers[_0x365209[_0xf153('0x4b')]]=_[_0xf153('0x4d')](agents[_0x365209[_0xf153('0x4b')]]);transfers[_0x365209[_0xf153('0x4b')]][_0xf153('0x9')]=agents[_0x365209[_0xf153('0x45')]][_0xf153('0x9')];transfers[_0x365209[_0xf153('0x4b')]]['calleridname']=agents[_0x365209[_0xf153('0x45')]][_0xf153('0x4e')];transfers[_0x365209['transfereeuniqueid']][_0xf153('0x18')]=utils[_0xf153('0x19')]();transfers[_0x365209[_0xf153('0x4b')]][_0xf153('0x38')]=utils[_0xf153('0x19')]();transfers[_0x365209[_0xf153('0x4b')]][_0xf153('0x25')]=0x0;transfers[_0x365209['transfereeuniqueid']][_0xf153('0x4c')]=0x2;}}else if(_0x365209[_0xf153('0x45')]==_0x365209[_0xf153('0x4f')]){if(!_[_0xf153('0x1f')](agents[_0x365209[_0xf153('0x43')]])){utils[_0xf153('0x3')](util[_0xf153('0x4')](_0xf153('0x46'),_0x365209[_0xf153('0x43')],agents[_0x365209['origtransfereruniqueid']][_0xf153('0x7')]));agents[_0x365209[_0xf153('0x43')]]['transfer']=!![];agents[_0x365209[_0xf153('0x43')]]['transfertype']=_0xf153('0x48');agents[_0x365209[_0xf153('0x43')]]['transferexten']=_0x365209[_0xf153('0x50')];agents[_0x365209['origtransfereruniqueid']][_0xf153('0x3f')]=_0x365209[_0xf153('0x45')];}if(_0x365209[_0xf153('0x51')]&&agents[_0x365209[_0xf153('0x51')]]){agents[_0x365209['transfertargetuniqueid']][_0xf153('0x4c')]=0x1;transfers[_0x365209[_0xf153('0x51')]]=_['clone'](agents[_0x365209[_0xf153('0x51')]]);transfers[_0x365209[_0xf153('0x51')]][_0xf153('0x9')]=agents[_0x365209[_0xf153('0x43')]][_0xf153('0x9')];transfers[_0x365209['transfertargetuniqueid']][_0xf153('0x4e')]=agents[_0x365209['origtransfereruniqueid']][_0xf153('0x4e')];transfers[_0x365209[_0xf153('0x51')]]['agentcalledAt']=utils['now']();transfers[_0x365209[_0xf153('0x51')]][_0xf153('0x38')]=utils['now']();transfers[_0x365209[_0xf153('0x51')]][_0xf153('0x25')]=0x0;transfers[_0x365209[_0xf153('0x51')]]['agententerreason']=0x2;}}}catch(_0x671efe){utils[_0xf153('0x1d')](util[_0xf153('0x4')](_0xf153('0x42'),_0x365209[_0xf153('0x43')]),_0x671efe);}};exports[_0xf153('0x52')]=function(_0x37443f){try{utils[_0xf153('0x16')](util[_0xf153('0x4')](_0xf153('0x53'),_0x37443f[_0xf153('0x5')]),_0x37443f);if(agents[_0x37443f[_0xf153('0x5')]]&&agents[_0x37443f[_0xf153('0x5')]][_0xf153('0x24')]===_0xf153('0x23')){if(_0x37443f[_0xf153('0x54')]==='21'){agents[_0x37443f['uniqueid']][_0xf153('0x24')]='rejected';agents[_0x37443f['uniqueid']][_0xf153('0x1a')]='rejected';}utils[_0xf153('0x3')](util[_0xf153('0x4')](_0xf153('0x55'),_0x37443f[_0xf153('0x5')],agents[_0x37443f[_0xf153('0x5')]][_0xf153('0x7')],agents[_0x37443f['uniqueid']][_0xf153('0x24')],agents[_0x37443f[_0xf153('0x5')]][_0xf153('0x1a')]));writeDB(agents[_0x37443f['uniqueid']]);var _0x59e22d=unanswered[_0xf153('0x56')](_0x37443f[_0xf153('0x5')]);if(_0x59e22d>-0x1){unanswered[_0xf153('0x57')](_0x59e22d,0x1);}}if(transfers[_0x37443f['uniqueid']]){transfers[_0x37443f[_0xf153('0x5')]]['agentcomplete']=!![];transfers[_0x37443f['uniqueid']][_0xf153('0x58')]=utils[_0xf153('0x19')]();transfers[_0x37443f[_0xf153('0x5')]]['talktime']=utils[_0xf153('0x37')](transfers[_0x37443f[_0xf153('0x5')]]['agentcompleteAt'],transfers[_0x37443f[_0xf153('0x5')]][_0xf153('0x38')]);transfers[_0x37443f[_0xf153('0x5')]][_0xf153('0x24')]=_0xf153('0x59');transfers[_0x37443f['uniqueid']][_0xf153('0x1a')]=_0xf153('0x39');utils[_0xf153('0x3')](util[_0xf153('0x4')](_0xf153('0x55'),_0x37443f[_0xf153('0x5')],transfers[_0x37443f[_0xf153('0x5')]]['membername'],transfers[_0x37443f[_0xf153('0x5')]][_0xf153('0x24')],transfers[_0x37443f[_0xf153('0x5')]][_0xf153('0x1a')]));writeDB(transfers[_0x37443f[_0xf153('0x5')]],!![]);}if(agents[_0x37443f[_0xf153('0x5')]]&&agents[_0x37443f['uniqueid']][_0xf153('0x38')]){agents[_0x37443f[_0xf153('0x5')]][_0xf153('0xf')]=!![];agents[_0x37443f[_0xf153('0x5')]][_0xf153('0x58')]=utils[_0xf153('0x19')]();agents[_0x37443f[_0xf153('0x5')]][_0xf153('0x27')]=utils[_0xf153('0x37')](agents[_0x37443f[_0xf153('0x5')]]['agentcompleteAt'],agents[_0x37443f['uniqueid']]['agentconnectAt']);agents[_0x37443f['uniqueid']][_0xf153('0x24')]=agents[_0x37443f[_0xf153('0x5')]][_0xf153('0x3d')]?_0xf153('0x3d'):_0xf153('0x59');agents[_0x37443f['uniqueid']][_0xf153('0x1a')]=_0xf153('0x39');utils[_0xf153('0x3')](util[_0xf153('0x4')]('[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s',_0x37443f[_0xf153('0x5')],agents[_0x37443f[_0xf153('0x5')]][_0xf153('0x7')],agents[_0x37443f['uniqueid']][_0xf153('0x24')],agents[_0x37443f['uniqueid']][_0xf153('0x1a')]));writeDB(agents[_0x37443f[_0xf153('0x5')]]);}}catch(_0x2651ff){utils['error'](util['format']('[%s][agents][hangup]',_0x37443f[_0xf153('0x5')]),_0x2651ff);}}; \ No newline at end of file +var _0xbdb7=['push','queuecallerabandon','forIn','includes','[%s][agents][queuecallerabandon]','abandoned','agentconnect','[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','connectedlinename','connect','answered_elsewhere','answeredelsewheredestinationuniqueid','isNil','[%s][agents][agentcomplete]','agentcompleteAt','diffTime','agentconnectAt','complete','blindtransfer','transfereruniqueid','[%s][agents][blindtransfer]','transfer','transfertype','blind','transferexten','transferuniqueid','attendedtransfer','[%s][agents][attendedtransfer]','origtransfererlinkedid','secondtransfereruniqueid','[%s][agents][attendedtransfer]\x20agent:%s','origtransfererexten','origtransfereruniqueid','transfereeuniqueid','agententerreason','calleridname','secondtransfererlinkedid','ATTENDED','secondtransfererexten','transfertargetuniqueid','clone','[%s][agents][hangup]','cause','rejected','indexOf','agent','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','lodash','util','./utils','info','format','[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','uniqueid','queue','calleridnum','connectedlinenum','getVoiceQueueByName','type','agentacw','agentcomplete','acw','acwtime','acwTimeout','CreateVoiceAgentReport','agentcalled','[%s][agents][agentcalled]','agentcalledAt','now','destuniqueid','lastevent','called','[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','membername','error','agentringnoanswer','debug','[%s][agents][agentringnoanswer]','[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout','agentringnoanswerAt','timeout','reason','holdtime','ringtime','talktime'];(function(_0x575a38,_0x2e83d7){var _0x5a7bdd=function(_0x1bf478){while(--_0x1bf478){_0x575a38['push'](_0x575a38['shift']());}};_0x5a7bdd(++_0x2e83d7);}(_0xbdb7,0x12e));var _0x7bdb=function(_0x264b61,_0x4a5017){_0x264b61=_0x264b61-0x0;var _0x8fff4f=_0xbdb7[_0x264b61];return _0x8fff4f;};'use strict';var _=require(_0x7bdb('0x0'));var util=require(_0x7bdb('0x1'));var utils=require(_0x7bdb('0x2'));var agents={};var transfers={};var unanswered=[];function writeDB(_0x2a2c1c,_0x23c326){utils[_0x7bdb('0x3')](util[_0x7bdb('0x4')](_0x7bdb('0x5'),_0x2a2c1c[_0x7bdb('0x6')],_0x2a2c1c['channel'],_0x2a2c1c[_0x7bdb('0x7')],_0x2a2c1c['membername'],_0x2a2c1c['interface'],_0x2a2c1c[_0x7bdb('0x8')],_0x2a2c1c[_0x7bdb('0x9')],_0x2a2c1c['lastevent']));if(_0x2a2c1c['queue']){utils[_0x7bdb('0xa')](_0x2a2c1c[_0x7bdb('0x7')])['then'](function(_0x4a3116){if(_0x4a3116){_0x2a2c1c[_0x7bdb('0xb')]=_0x4a3116[_0x7bdb('0xb')];_0x2a2c1c[_0x7bdb('0xc')]=_0x2a2c1c[_0x7bdb('0xd')]?_0x4a3116[_0x7bdb('0xe')]:![];_0x2a2c1c[_0x7bdb('0xf')]=_0x2a2c1c[_0x7bdb('0xc')]?_0x4a3116[_0x7bdb('0x10')]:0x0;}utils['request']('CreateVoiceAgentReport',_0x2a2c1c);});}else{utils['request'](_0x7bdb('0x11'),_0x2a2c1c);}if(_0x23c326){delete transfers[_0x2a2c1c[_0x7bdb('0x6')]];}else{delete agents[_0x2a2c1c['destuniqueid']];}}exports[_0x7bdb('0x12')]=function(_0x53021d){try{utils['debug'](util[_0x7bdb('0x4')](_0x7bdb('0x13'),_0x53021d['uniqueid']),_0x53021d);agents[_0x53021d['destuniqueid']]=_0x53021d;agents[_0x53021d['destuniqueid']][_0x7bdb('0x14')]=utils[_0x7bdb('0x15')]();agents[_0x53021d[_0x7bdb('0x16')]][_0x7bdb('0x17')]=_0x7bdb('0x18');agents[_0x53021d[_0x7bdb('0x16')]][_0x7bdb('0x9')]=null;agents[_0x53021d[_0x7bdb('0x16')]]['connectedlinename']=null;utils[_0x7bdb('0x3')](util[_0x7bdb('0x4')](_0x7bdb('0x19'),_0x53021d[_0x7bdb('0x6')],agents[_0x53021d['destuniqueid']][_0x7bdb('0x1a')],_0x53021d[_0x7bdb('0x16')]));}catch(_0x5b8481){utils[_0x7bdb('0x1b')](util[_0x7bdb('0x4')](_0x7bdb('0x13'),_0x53021d[_0x7bdb('0x6')]),_0x5b8481);}};exports[_0x7bdb('0x1c')]=function(_0x5bfc35){try{if(!_['isNil'](agents[_0x5bfc35[_0x7bdb('0x16')]])){utils[_0x7bdb('0x1d')](util['format'](_0x7bdb('0x1e'),_0x5bfc35[_0x7bdb('0x6')]),_0x5bfc35);utils[_0x7bdb('0x3')](util[_0x7bdb('0x4')](_0x7bdb('0x1f'),_0x5bfc35['uniqueid'],agents[_0x5bfc35[_0x7bdb('0x16')]][_0x7bdb('0x1a')],_0x5bfc35[_0x7bdb('0x16')]));agents[_0x5bfc35[_0x7bdb('0x16')]]['agentringnoanswer']=!![];agents[_0x5bfc35['destuniqueid']][_0x7bdb('0x20')]=utils['now']();agents[_0x5bfc35['destuniqueid']]['lastevent']=_0x7bdb('0x21');agents[_0x5bfc35['destuniqueid']][_0x7bdb('0x22')]=_0x7bdb('0x21');agents[_0x5bfc35[_0x7bdb('0x16')]][_0x7bdb('0x23')]=_0x5bfc35[_0x7bdb('0x24')]?parseInt(_0x5bfc35['ringtime'])/0x3e8:0x0;agents[_0x5bfc35[_0x7bdb('0x16')]][_0x7bdb('0x25')]=0x0;unanswered[_0x7bdb('0x26')](_0x5bfc35[_0x7bdb('0x16')]);}}catch(_0x371e8a){utils[_0x7bdb('0x1b')](util[_0x7bdb('0x4')](_0x7bdb('0x1e'),_0x5bfc35[_0x7bdb('0x6')]),_0x371e8a);}};exports[_0x7bdb('0x27')]=function(_0x9ec48d){try{_[_0x7bdb('0x28')](agents,function(_0x5b386d,_0x388a45){if(_0x5b386d[_0x7bdb('0x6')]==_0x9ec48d[_0x7bdb('0x6')]&&!_[_0x7bdb('0x29')](unanswered,_0x5b386d[_0x7bdb('0x16')])){utils['debug'](util[_0x7bdb('0x4')](_0x7bdb('0x2a'),_0x9ec48d[_0x7bdb('0x6')]),_0x9ec48d);utils[_0x7bdb('0x3')](util['format']('[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned',_0x9ec48d['uniqueid'],_0x5b386d[_0x7bdb('0x1a')],_0x5b386d['destuniqueid']));_0x5b386d[_0x7bdb('0x1c')]=!![];_0x5b386d['agentringnoanswerAt']=utils[_0x7bdb('0x15')]();_0x5b386d[_0x7bdb('0x17')]=_0x7bdb('0x2b');_0x5b386d['reason']=_0x7bdb('0x2b');_0x5b386d['holdtime']=_0x9ec48d['holdtime'];_0x5b386d[_0x7bdb('0x25')]=0x0;writeDB(_0x5b386d);}});}catch(_0x5611f5){utils[_0x7bdb('0x1b')](util['format']('[%s][agents][queuecallerabandon]',_0x9ec48d[_0x7bdb('0x6')]),_0x5611f5);}};exports[_0x7bdb('0x2c')]=function(_0x3ddee4){try{if(agents[_0x3ddee4[_0x7bdb('0x16')]]){utils[_0x7bdb('0x1d')](util[_0x7bdb('0x4')]('[%s][agents][agentconnect]',_0x3ddee4[_0x7bdb('0x6')]),_0x3ddee4);utils[_0x7bdb('0x3')](util[_0x7bdb('0x4')](_0x7bdb('0x2d'),_0x3ddee4[_0x7bdb('0x6')],agents[_0x3ddee4[_0x7bdb('0x16')]][_0x7bdb('0x1a')],_0x3ddee4[_0x7bdb('0x16')]));agents[_0x3ddee4[_0x7bdb('0x16')]]['agentconnectAt']=utils['now']();agents[_0x3ddee4[_0x7bdb('0x16')]][_0x7bdb('0x9')]=_0x3ddee4[_0x7bdb('0x9')];agents[_0x3ddee4[_0x7bdb('0x16')]][_0x7bdb('0x2e')]=_0x3ddee4['connectedlinename'];agents[_0x3ddee4['destuniqueid']][_0x7bdb('0x23')]=_0x3ddee4['ringtime'];agents[_0x3ddee4[_0x7bdb('0x16')]]['lastevent']=_0x7bdb('0x2f');_['forIn'](agents,function(_0x4cf3fa,_0x21dae7){if(_0x4cf3fa[_0x7bdb('0x16')]!=_0x3ddee4[_0x7bdb('0x16')]&&_0x4cf3fa[_0x7bdb('0x6')]==_0x3ddee4[_0x7bdb('0x6')]){_0x4cf3fa[_0x7bdb('0x25')]=0x0;_0x4cf3fa[_0x7bdb('0x23')]=_0x3ddee4['ringtime'];_0x4cf3fa['agentringnoanswer']=!![];_0x4cf3fa[_0x7bdb('0x20')]=utils[_0x7bdb('0x15')]();_0x4cf3fa[_0x7bdb('0x17')]=_0x7bdb('0x30');_0x4cf3fa[_0x7bdb('0x22')]=_0x7bdb('0x30');_0x4cf3fa[_0x7bdb('0x31')]=_0x3ddee4['destuniqueid'];_0x4cf3fa['answeredelsewheremembername']=_0x3ddee4[_0x7bdb('0x1a')];writeDB(_0x4cf3fa);}});}}catch(_0x8e893e){utils[_0x7bdb('0x1b')](util[_0x7bdb('0x4')]('[%s][agents][agentconnect]',_0x3ddee4[_0x7bdb('0x6')]),_0x8e893e);}};exports['agentcomplete']=function(_0x37029b){try{if(!_[_0x7bdb('0x32')](agents[_0x37029b[_0x7bdb('0x16')]])){utils[_0x7bdb('0x1d')](util[_0x7bdb('0x4')](_0x7bdb('0x33'),_0x37029b[_0x7bdb('0x6')]),_0x37029b);utils[_0x7bdb('0x3')](util[_0x7bdb('0x4')]('[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete',_0x37029b[_0x7bdb('0x6')],agents[_0x37029b[_0x7bdb('0x16')]]['membername'],_0x37029b[_0x7bdb('0x16')]));agents[_0x37029b['destuniqueid']][_0x7bdb('0xd')]=!![];agents[_0x37029b[_0x7bdb('0x16')]][_0x7bdb('0x34')]=utils[_0x7bdb('0x15')]();agents[_0x37029b[_0x7bdb('0x16')]]['talktime']=utils[_0x7bdb('0x35')](agents[_0x37029b[_0x7bdb('0x16')]][_0x7bdb('0x34')],agents[_0x37029b[_0x7bdb('0x16')]][_0x7bdb('0x36')]);agents[_0x37029b['destuniqueid']][_0x7bdb('0x22')]=_0x37029b[_0x7bdb('0x22')];agents[_0x37029b[_0x7bdb('0x16')]][_0x7bdb('0x17')]=_0x7bdb('0x37');writeDB(agents[_0x37029b[_0x7bdb('0x16')]]);}}catch(_0x1895b6){utils[_0x7bdb('0x1b')](util[_0x7bdb('0x4')](_0x7bdb('0x33'),_0x37029b['uniqueid']),_0x1895b6);}};exports[_0x7bdb('0x38')]=function(_0x58c4bc){try{if(!_['isNil'](agents[_0x58c4bc[_0x7bdb('0x39')]])){utils[_0x7bdb('0x1d')](util['format'](_0x7bdb('0x3a'),_0x58c4bc[_0x7bdb('0x6')]),_0x58c4bc);utils['info'](util['format']('[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s',_0x58c4bc[_0x7bdb('0x6')],agents[_0x58c4bc[_0x7bdb('0x39')]][_0x7bdb('0x1a')],agents[_0x58c4bc[_0x7bdb('0x39')]][_0x7bdb('0x6')]));agents[_0x58c4bc[_0x7bdb('0x39')]][_0x7bdb('0x3b')]=!![];agents[_0x58c4bc[_0x7bdb('0x39')]][_0x7bdb('0x3c')]=_0x7bdb('0x3d');agents[_0x58c4bc['transfereruniqueid']][_0x7bdb('0x3e')]=_0x58c4bc['extension'];agents[_0x58c4bc[_0x7bdb('0x39')]][_0x7bdb('0x3f')]=agents[_0x58c4bc[_0x7bdb('0x39')]][_0x7bdb('0x6')];}}catch(_0x493d23){utils[_0x7bdb('0x1b')](util['format']('[%s][agents][blindtransfer]',_0x58c4bc[_0x7bdb('0x6')]),_0x493d23);}};exports[_0x7bdb('0x40')]=function(_0x5065ae){try{utils['debug'](util['format'](_0x7bdb('0x41'),_0x5065ae['origtransfereruniqueid']),_0x5065ae);if(_0x5065ae['origtransfereruniqueid']==_0x5065ae[_0x7bdb('0x42')]){if(!_[_0x7bdb('0x32')](agents[_0x5065ae[_0x7bdb('0x43')]])){utils[_0x7bdb('0x3')](util['format'](_0x7bdb('0x44'),_0x5065ae['origtransfereruniqueid'],agents[_0x5065ae[_0x7bdb('0x43')]][_0x7bdb('0x1a')]));agents[_0x5065ae[_0x7bdb('0x43')]][_0x7bdb('0x3b')]=!![];agents[_0x5065ae[_0x7bdb('0x43')]][_0x7bdb('0x3c')]='ATTENDED';agents[_0x5065ae[_0x7bdb('0x43')]][_0x7bdb('0x3e')]=_0x5065ae[_0x7bdb('0x45')];agents[_0x5065ae['secondtransfereruniqueid']][_0x7bdb('0x3f')]=_0x5065ae[_0x7bdb('0x46')];}if(_0x5065ae['transfereeuniqueid']&&agents[_0x5065ae[_0x7bdb('0x47')]]){agents[_0x5065ae['transfereeuniqueid']][_0x7bdb('0x48')]=0x1;transfers[_0x5065ae[_0x7bdb('0x47')]]=_['clone'](agents[_0x5065ae['transfereeuniqueid']]);transfers[_0x5065ae[_0x7bdb('0x47')]][_0x7bdb('0x8')]=agents[_0x5065ae['secondtransfereruniqueid']][_0x7bdb('0x8')];transfers[_0x5065ae['transfereeuniqueid']][_0x7bdb('0x49')]=agents[_0x5065ae['secondtransfereruniqueid']]['calleridname'];transfers[_0x5065ae[_0x7bdb('0x47')]][_0x7bdb('0x14')]=utils[_0x7bdb('0x15')]();transfers[_0x5065ae[_0x7bdb('0x47')]][_0x7bdb('0x36')]=utils[_0x7bdb('0x15')]();transfers[_0x5065ae[_0x7bdb('0x47')]][_0x7bdb('0x23')]=0x0;transfers[_0x5065ae[_0x7bdb('0x47')]][_0x7bdb('0x48')]=0x2;}}else if(_0x5065ae[_0x7bdb('0x43')]==_0x5065ae[_0x7bdb('0x4a')]){if(!_['isNil'](agents[_0x5065ae[_0x7bdb('0x46')]])){utils[_0x7bdb('0x3')](util['format'](_0x7bdb('0x44'),_0x5065ae[_0x7bdb('0x46')],agents[_0x5065ae[_0x7bdb('0x46')]][_0x7bdb('0x1a')]));agents[_0x5065ae[_0x7bdb('0x46')]]['transfer']=!![];agents[_0x5065ae[_0x7bdb('0x46')]][_0x7bdb('0x3c')]=_0x7bdb('0x4b');agents[_0x5065ae['origtransfereruniqueid']][_0x7bdb('0x3e')]=_0x5065ae[_0x7bdb('0x4c')];agents[_0x5065ae[_0x7bdb('0x46')]][_0x7bdb('0x3f')]=_0x5065ae[_0x7bdb('0x43')];}if(_0x5065ae[_0x7bdb('0x4d')]&&agents[_0x5065ae[_0x7bdb('0x4d')]]){agents[_0x5065ae[_0x7bdb('0x4d')]][_0x7bdb('0x48')]=0x1;transfers[_0x5065ae['transfertargetuniqueid']]=_[_0x7bdb('0x4e')](agents[_0x5065ae[_0x7bdb('0x4d')]]);transfers[_0x5065ae[_0x7bdb('0x4d')]][_0x7bdb('0x8')]=agents[_0x5065ae[_0x7bdb('0x46')]][_0x7bdb('0x8')];transfers[_0x5065ae[_0x7bdb('0x4d')]][_0x7bdb('0x49')]=agents[_0x5065ae[_0x7bdb('0x46')]][_0x7bdb('0x49')];transfers[_0x5065ae[_0x7bdb('0x4d')]][_0x7bdb('0x14')]=utils[_0x7bdb('0x15')]();transfers[_0x5065ae['transfertargetuniqueid']][_0x7bdb('0x36')]=utils['now']();transfers[_0x5065ae[_0x7bdb('0x4d')]][_0x7bdb('0x23')]=0x0;transfers[_0x5065ae[_0x7bdb('0x4d')]]['agententerreason']=0x2;}}}catch(_0xd57d33){utils[_0x7bdb('0x1b')](util['format'](_0x7bdb('0x41'),_0x5065ae[_0x7bdb('0x46')]),_0xd57d33);}};exports['hangup']=function(_0x1c4525){try{utils[_0x7bdb('0x1d')](util['format'](_0x7bdb('0x4f'),_0x1c4525[_0x7bdb('0x6')]),_0x1c4525);if(agents[_0x1c4525['uniqueid']]&&agents[_0x1c4525[_0x7bdb('0x6')]][_0x7bdb('0x22')]==='timeout'){if(_0x1c4525[_0x7bdb('0x50')]==='21'){agents[_0x1c4525['uniqueid']][_0x7bdb('0x22')]=_0x7bdb('0x51');agents[_0x1c4525[_0x7bdb('0x6')]][_0x7bdb('0x17')]=_0x7bdb('0x51');}utils['info'](util['format']('[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s',_0x1c4525[_0x7bdb('0x6')],agents[_0x1c4525['uniqueid']][_0x7bdb('0x1a')],agents[_0x1c4525[_0x7bdb('0x6')]][_0x7bdb('0x22')],agents[_0x1c4525['uniqueid']]['lastevent']));writeDB(agents[_0x1c4525[_0x7bdb('0x6')]]);var _0x10b3c4=unanswered[_0x7bdb('0x52')](_0x1c4525[_0x7bdb('0x6')]);if(_0x10b3c4>-0x1){unanswered['splice'](_0x10b3c4,0x1);}}if(transfers[_0x1c4525[_0x7bdb('0x6')]]){transfers[_0x1c4525[_0x7bdb('0x6')]][_0x7bdb('0xd')]=!![];transfers[_0x1c4525[_0x7bdb('0x6')]][_0x7bdb('0x34')]=utils[_0x7bdb('0x15')]();transfers[_0x1c4525['uniqueid']][_0x7bdb('0x25')]=utils['diffTime'](transfers[_0x1c4525[_0x7bdb('0x6')]]['agentcompleteAt'],transfers[_0x1c4525[_0x7bdb('0x6')]][_0x7bdb('0x36')]);transfers[_0x1c4525[_0x7bdb('0x6')]][_0x7bdb('0x22')]=_0x7bdb('0x53');transfers[_0x1c4525['uniqueid']]['lastevent']=_0x7bdb('0x37');utils[_0x7bdb('0x3')](util['format'](_0x7bdb('0x54'),_0x1c4525[_0x7bdb('0x6')],transfers[_0x1c4525['uniqueid']][_0x7bdb('0x1a')],transfers[_0x1c4525[_0x7bdb('0x6')]]['reason'],transfers[_0x1c4525[_0x7bdb('0x6')]]['lastevent']));writeDB(transfers[_0x1c4525['uniqueid']],!![]);}if(agents[_0x1c4525[_0x7bdb('0x6')]]&&agents[_0x1c4525[_0x7bdb('0x6')]]['agentconnectAt']){agents[_0x1c4525['uniqueid']][_0x7bdb('0xd')]=!![];agents[_0x1c4525['uniqueid']][_0x7bdb('0x34')]=utils['now']();agents[_0x1c4525[_0x7bdb('0x6')]][_0x7bdb('0x25')]=utils[_0x7bdb('0x35')](agents[_0x1c4525[_0x7bdb('0x6')]]['agentcompleteAt'],agents[_0x1c4525[_0x7bdb('0x6')]][_0x7bdb('0x36')]);agents[_0x1c4525['uniqueid']][_0x7bdb('0x22')]=agents[_0x1c4525[_0x7bdb('0x6')]]['transfer']?_0x7bdb('0x3b'):_0x7bdb('0x53');agents[_0x1c4525[_0x7bdb('0x6')]][_0x7bdb('0x17')]='complete';utils[_0x7bdb('0x3')](util['format'](_0x7bdb('0x54'),_0x1c4525[_0x7bdb('0x6')],agents[_0x1c4525[_0x7bdb('0x6')]]['membername'],agents[_0x1c4525[_0x7bdb('0x6')]][_0x7bdb('0x22')],agents[_0x1c4525[_0x7bdb('0x6')]][_0x7bdb('0x17')]));writeDB(agents[_0x1c4525[_0x7bdb('0x6')]]);}}catch(_0x393baa){utils[_0x7bdb('0x1b')](util[_0x7bdb('0x4')](_0x7bdb('0x4f'),_0x1c4525[_0x7bdb('0x6')]),_0x393baa);}}; \ No newline at end of file diff --git a/server/services/xdr/calls.controller.js b/server/services/xdr/calls.controller.js index 4a25d65..6269cc4 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 _0xbc0d=['channel','queue','membername','interface','calleridnum','connectedlinenum','lastevent','accountcode','getUserByInternal','then','UserId','CreateVoiceCallReport','request','debug','[%s][calls][newchannel]','OutgoingSpoolFailed','format','[%s][calls][newchannel]\x20context:%s\x20exten:%s','context','exten','now','DOCUMENTATION','error','newstate','[%s][calls][newstate]','isNil','channelstate','[%s][calls][newstate]\x20context:%s\x20channel:%s','systemanswertime','linkedid','answertime','disposition','toNumber','hangup','[%s][calls][hangup]','callerid','calleridname','cause-txt','endtime','duration','diffTime','starttime','billableseconds','localtwolinkedid','transfereechannel','origtransfereruniqueid','secondtransfererchannel','userfield','_attended','transfertargetchannel','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','origtransfererchannel','destinationchannel','[%s][calls][attendedtransfer]','musiconholdstart','[%s][calls][musiconholdstart]','musiconholdstartAt','[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s','musiconholdstop','[%s][calls][musiconholdstop]','mohtime','[%s][calls][musiconholdstop]\x20mohtime:%s','varset','[%s][calls][varset]','xmd-originatecalleridnum','[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','value','source','xmd-phone','destination','\x22\x20<','variable','xmd-callerid-preview','xmd-callerid','[%s][calls][varset]\x20variable:%s\x20value:%s','xmd-queue','xmcs-queue','lastapplication','lastdata','[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s','ContactId','xmd-cdrtype','[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s','outboundrouteid','[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s','routeid','sipcallid','[%s][calls][newexten]','[%s][calls][newexten]\x20application:%s\x20appdata:%s','appdata','application','toLowerCase','cdr','split','substring','lastIndexOf','includes','noop','set','gotoif','./utils','NO\x20ANSWER','FAILED','ANSWERED','BUSY','info','[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','uniqueid'];(function(_0x321333,_0x1bdc80){var _0x5b8862=function(_0x17af08){while(--_0x17af08){_0x321333['push'](_0x321333['shift']());}};_0x5b8862(++_0x1bdc80);}(_0xbc0d,0x64));var _0xdbc0=function(_0x173441,_0x26b0d9){_0x173441=_0x173441-0x0;var _0x2423a8=_0xbc0d[_0x173441];return _0x2423a8;};'use strict';var _=require('lodash');var util=require('util');var utils=require(_0xdbc0('0x0'));var dispositions=[_0xdbc0('0x1'),_0xdbc0('0x2'),'FAILED',_0xdbc0('0x1'),_0xdbc0('0x1'),_0xdbc0('0x1'),_0xdbc0('0x3'),_0xdbc0('0x4'),'FAILED',_0xdbc0('0x2'),'FAILED'];var channels={};function writeDB(_0x1fe34e){utils[_0xdbc0('0x5')](util['format'](_0xdbc0('0x6'),_0x1fe34e[_0xdbc0('0x7')],_0x1fe34e[_0xdbc0('0x8')],_0x1fe34e[_0xdbc0('0x9')],_0x1fe34e[_0xdbc0('0xa')],_0x1fe34e[_0xdbc0('0xb')],_0x1fe34e[_0xdbc0('0xc')],_0x1fe34e[_0xdbc0('0xd')],_0x1fe34e[_0xdbc0('0xe')]));if(_0x1fe34e[_0xdbc0('0xf')]){utils[_0xdbc0('0x10')](_0x1fe34e[_0xdbc0('0xf')])[_0xdbc0('0x11')](function(_0x5e3240){if(_0x5e3240){_0x1fe34e[_0xdbc0('0x12')]=_0x5e3240['id'];}utils['request'](_0xdbc0('0x13'),_0x1fe34e);});}else{utils[_0xdbc0('0x14')](_0xdbc0('0x13'),_0x1fe34e);}if(channels[_0x1fe34e[_0xdbc0('0x7')]]){delete channels[_0x1fe34e[_0xdbc0('0x7')]];}}exports['newchannel']=function(_0x372d84){try{utils[_0xdbc0('0x15')](util['format'](_0xdbc0('0x16'),_0x372d84['uniqueid']),_0x372d84);if(_0x372d84['uniqueid']==_0x372d84['linkedid']&&_0x372d84['channel']!=_0xdbc0('0x17')){utils['info'](util[_0xdbc0('0x18')](_0xdbc0('0x19'),_0x372d84[_0xdbc0('0x7')],_0x372d84[_0xdbc0('0x1a')],_0x372d84[_0xdbc0('0x1b')]));channels[_0x372d84[_0xdbc0('0x7')]]={'uniqueid':_0x372d84[_0xdbc0('0x7')],'accountcode':_0x372d84[_0xdbc0('0xf')],'source':_0x372d84[_0xdbc0('0xc')],'destination':_0x372d84[_0xdbc0('0x1b')],'destinationcontext':_0x372d84['context'],'channel':_0x372d84[_0xdbc0('0x8')],'starttime':utils[_0xdbc0('0x1c')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0xdbc0('0x1'),'amaflags':_0xdbc0('0x1d')};}}catch(_0x2aef67){utils[_0xdbc0('0x1e')](util[_0xdbc0('0x18')](_0xdbc0('0x16'),_0x372d84['uniqueid']),_0x2aef67);}};exports[_0xdbc0('0x1f')]=function(_0x2866c5){try{utils['debug'](util[_0xdbc0('0x18')](_0xdbc0('0x20'),_0x2866c5[_0xdbc0('0x7')]),_0x2866c5);if(!_[_0xdbc0('0x21')](channels[_0x2866c5['uniqueid']])&&_0x2866c5[_0xdbc0('0x22')]==0x6){utils[_0xdbc0('0x5')](util[_0xdbc0('0x18')](_0xdbc0('0x23'),_0x2866c5[_0xdbc0('0x7')],_0x2866c5[_0xdbc0('0x1a')],_0x2866c5[_0xdbc0('0x8')]));if(_[_0xdbc0('0x21')](channels[_0x2866c5['uniqueid']][_0xdbc0('0x24')])){channels[_0x2866c5['uniqueid']][_0xdbc0('0x24')]=utils[_0xdbc0('0x1c')]();}}else if(!_[_0xdbc0('0x21')](channels[_0x2866c5[_0xdbc0('0x25')]])&&_0x2866c5[_0xdbc0('0x22')]==0x6&&_0x2866c5[_0xdbc0('0x1a')]!='transfer'){utils[_0xdbc0('0x5')](util['format']('[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s',_0x2866c5[_0xdbc0('0x7')],_0x2866c5['linkedid'],_0x2866c5['context'],_0x2866c5[_0xdbc0('0x8')]));channels[_0x2866c5[_0xdbc0('0x25')]][_0xdbc0('0xf')]=_0x2866c5[_0xdbc0('0xf')];channels[_0x2866c5['linkedid']]['destinationchannel']=_0x2866c5[_0xdbc0('0x8')];if(_[_0xdbc0('0x21')](channels[_0x2866c5[_0xdbc0('0x25')]][_0xdbc0('0x26')])){channels[_0x2866c5[_0xdbc0('0x25')]][_0xdbc0('0x26')]=utils[_0xdbc0('0x1c')]();}channels[_0x2866c5['linkedid']][_0xdbc0('0x27')]=dispositions[_[_0xdbc0('0x28')](_0x2866c5['channelstate'])]||'ANSWERED';}}catch(_0x183007){utils[_0xdbc0('0x1e')](util['format'](_0xdbc0('0x20'),_0x2866c5[_0xdbc0('0x7')]),_0x183007);}};exports[_0xdbc0('0x29')]=function(_0x401f19){try{if(!_[_0xdbc0('0x21')](channels[_0x401f19[_0xdbc0('0x7')]])){utils[_0xdbc0('0x15')](util['format'](_0xdbc0('0x2a'),_0x401f19[_0xdbc0('0x7')]),_0x401f19);if(_[_0xdbc0('0x21')](channels[_0x401f19[_0xdbc0('0x7')]][_0xdbc0('0x2b')])){channels[_0x401f19[_0xdbc0('0x7')]][_0xdbc0('0x2b')]=_0x401f19[_0xdbc0('0x2c')]+'\x20<'+_0x401f19[_0xdbc0('0xc')]+'>';}utils[_0xdbc0('0x5')](util['format']('[%s][calls][hangup]\x20callerid:%s\x20reason:%s',_0x401f19[_0xdbc0('0x7')],channels[_0x401f19[_0xdbc0('0x7')]][_0xdbc0('0x2b')],_0x401f19[_0xdbc0('0x2d')]));channels[_0x401f19[_0xdbc0('0x7')]][_0xdbc0('0x2e')]=utils[_0xdbc0('0x1c')]();channels[_0x401f19[_0xdbc0('0x7')]][_0xdbc0('0x2f')]=utils[_0xdbc0('0x30')](channels[_0x401f19[_0xdbc0('0x7')]]['endtime'],channels[_0x401f19[_0xdbc0('0x7')]][_0xdbc0('0x31')]);channels[_0x401f19[_0xdbc0('0x7')]][_0xdbc0('0x32')]=channels[_0x401f19[_0xdbc0('0x7')]][_0xdbc0('0x26')]?utils[_0xdbc0('0x30')](channels[_0x401f19[_0xdbc0('0x7')]]['endtime'],channels[_0x401f19[_0xdbc0('0x7')]][_0xdbc0('0x26')]):0x0;writeDB(channels[_0x401f19['uniqueid']]);}}catch(_0x30275c){utils[_0xdbc0('0x1e')](util[_0xdbc0('0x18')]('[%s][calls][hangup]',_0x401f19[_0xdbc0('0x7')]),_0x30275c);}};exports['attendedtransfer']=function(_0x156755){try{if(!_[_0xdbc0('0x21')](channels[_0x156755['localtwolinkedid']])){utils['debug'](util[_0xdbc0('0x18')]('[%s][calls][attendedtransfer]',_0x156755['origtransfereruniqueid']),_0x156755);if(channels[_0x156755[_0xdbc0('0x33')]][_0xdbc0('0x8')]==_0x156755[_0xdbc0('0x34')]){utils[_0xdbc0('0x5')](util['format']('[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s',_0x156755[_0xdbc0('0x35')],_0x156755['localtwolinkedid'],_0x156755[_0xdbc0('0x36')]));channels[_0x156755[_0xdbc0('0x33')]]['destinationchannel']=_0x156755[_0xdbc0('0x36')];channels[_0x156755[_0xdbc0('0x33')]][_0xdbc0('0x37')]=_0xdbc0('0x38');}else if(channels[_0x156755[_0xdbc0('0x33')]]['channel']=_0x156755[_0xdbc0('0x39')]){utils[_0xdbc0('0x5')](util[_0xdbc0('0x18')](_0xdbc0('0x3a'),_0x156755[_0xdbc0('0x35')],_0x156755[_0xdbc0('0x33')],_0x156755[_0xdbc0('0x3b')]));channels[_0x156755[_0xdbc0('0x33')]][_0xdbc0('0x3c')]=_0x156755['origtransfererchannel'];channels[_0x156755[_0xdbc0('0x33')]][_0xdbc0('0x37')]='_attended';}}}catch(_0x4accc3){utils[_0xdbc0('0x1e')](util['format'](_0xdbc0('0x3d'),_0x156755[_0xdbc0('0x35')]),_0x4accc3);}};exports[_0xdbc0('0x3e')]=function(_0xc46ad7){try{if(!_[_0xdbc0('0x21')](channels[_0xc46ad7['uniqueid']])){utils[_0xdbc0('0x15')](util['format'](_0xdbc0('0x3f'),_0xc46ad7[_0xdbc0('0x7')]),_0xc46ad7);channels[_0xc46ad7[_0xdbc0('0x7')]][_0xdbc0('0x40')]=utils[_0xdbc0('0x1c')]();utils[_0xdbc0('0x5')](util[_0xdbc0('0x18')](_0xdbc0('0x41'),_0xc46ad7['uniqueid'],channels[_0xc46ad7['uniqueid']][_0xdbc0('0x40')]));}}catch(_0x4c5458){utils['error'](util[_0xdbc0('0x18')]('[%s][calls][musiconholdstart]',_0xc46ad7[_0xdbc0('0x7')]),_0x4c5458);}};exports[_0xdbc0('0x42')]=function(_0x4d9161){try{if(!_[_0xdbc0('0x21')](channels[_0x4d9161[_0xdbc0('0x7')]])){utils[_0xdbc0('0x15')](util[_0xdbc0('0x18')](_0xdbc0('0x43'),_0x4d9161['uniqueid']),_0x4d9161);if(!_[_0xdbc0('0x21')](channels[_0x4d9161[_0xdbc0('0x7')]]['musiconholdstartAt'])){channels[_0x4d9161[_0xdbc0('0x7')]][_0xdbc0('0x44')]+=utils['diffTime'](utils[_0xdbc0('0x1c')](),channels[_0x4d9161[_0xdbc0('0x7')]][_0xdbc0('0x40')]);utils[_0xdbc0('0x5')](util[_0xdbc0('0x18')](_0xdbc0('0x45'),_0x4d9161[_0xdbc0('0x7')],channels[_0x4d9161['uniqueid']][_0xdbc0('0x44')]));delete channels[_0x4d9161[_0xdbc0('0x7')]]['musiconholdstartAt'];}}}catch(_0x372b31){utils['error'](util[_0xdbc0('0x18')](_0xdbc0('0x43'),_0x4d9161[_0xdbc0('0x7')]),_0x372b31);}};exports[_0xdbc0('0x46')]=function(_0x1394f3){try{if(!_[_0xdbc0('0x21')](channels[_0x1394f3[_0xdbc0('0x7')]])){utils[_0xdbc0('0x15')](util['format'](_0xdbc0('0x47'),_0x1394f3[_0xdbc0('0x7')]),_0x1394f3);if(!_['isNil'](_0x1394f3['variable'][_0xdbc0('0x48')])){utils[_0xdbc0('0x5')](util[_0xdbc0('0x18')](_0xdbc0('0x49'),_0x1394f3['uniqueid'],_0x1394f3[_0xdbc0('0x4a')]));channels[_0x1394f3[_0xdbc0('0x7')]][_0xdbc0('0x4b')]=_0x1394f3[_0xdbc0('0x4a')];}if(!_[_0xdbc0('0x21')](_0x1394f3['variable'][_0xdbc0('0x4c')])){utils[_0xdbc0('0x5')](util[_0xdbc0('0x18')]('[%s][calls][varset]\x20variable:xmd-phone\x20value:%s',_0x1394f3[_0xdbc0('0x7')],_0x1394f3[_0xdbc0('0x4a')]));channels[_0x1394f3[_0xdbc0('0x7')]][_0xdbc0('0x4d')]=_0x1394f3[_0xdbc0('0x4a')];channels[_0x1394f3[_0xdbc0('0x7')]]['callerid']='\x22'+_0x1394f3[_0xdbc0('0x4a')]+_0xdbc0('0x4e')+_0x1394f3[_0xdbc0('0x4a')]+'>';}if(!_['isNil'](_0x1394f3[_0xdbc0('0x4f')][_0xdbc0('0x50')])||!_['isNil'](_0x1394f3['variable'][_0xdbc0('0x51')])){utils['info'](util[_0xdbc0('0x18')](_0xdbc0('0x52'),_0x1394f3[_0xdbc0('0x7')],!_[_0xdbc0('0x21')](_0x1394f3['variable']['xmd-callerid-preview'])?_0xdbc0('0x50'):'xmd-callerid',_0x1394f3[_0xdbc0('0x4a')]));channels[_0x1394f3[_0xdbc0('0x7')]][_0xdbc0('0x2b')]=_0x1394f3[_0xdbc0('0x4a')];}if(!_[_0xdbc0('0x21')](_0x1394f3[_0xdbc0('0x4f')][_0xdbc0('0x53')])||!_[_0xdbc0('0x21')](_0x1394f3['variable'][_0xdbc0('0x54')])){utils[_0xdbc0('0x5')](util[_0xdbc0('0x18')]('[%s][calls][varset]\x20variable:%s\x20value:%s',_0x1394f3[_0xdbc0('0x7')],!_['isNil'](_0x1394f3[_0xdbc0('0x4f')][_0xdbc0('0x53')])?_0xdbc0('0x53'):_0xdbc0('0x54'),_0x1394f3[_0xdbc0('0x4a')]));channels[_0x1394f3[_0xdbc0('0x7')]][_0xdbc0('0x55')]='Queue';channels[_0x1394f3[_0xdbc0('0x7')]][_0xdbc0('0x56')]=_0x1394f3[_0xdbc0('0x4a')];channels[_0x1394f3['uniqueid']][_0xdbc0('0x9')]=!![];}if(!_[_0xdbc0('0x21')](_0x1394f3[_0xdbc0('0x4f')]['xmd-contactid'])){utils[_0xdbc0('0x5')](util['format'](_0xdbc0('0x57'),_0x1394f3[_0xdbc0('0x7')],_0x1394f3[_0xdbc0('0x4a')]));channels[_0x1394f3[_0xdbc0('0x7')]][_0xdbc0('0x58')]=_0x1394f3[_0xdbc0('0x4a')];}if(!_[_0xdbc0('0x21')](_0x1394f3['variable'][_0xdbc0('0x59')])){utils[_0xdbc0('0x5')](util[_0xdbc0('0x18')](_0xdbc0('0x5a'),_0x1394f3[_0xdbc0('0x7')],_0x1394f3[_0xdbc0('0x4a')]));channels[_0x1394f3[_0xdbc0('0x7')]]['type']=_0x1394f3[_0xdbc0('0x4a')];}if(!_['isNil'](_0x1394f3[_0xdbc0('0x4f')][_0xdbc0('0x5b')])){utils[_0xdbc0('0x5')](util[_0xdbc0('0x18')](_0xdbc0('0x5c'),_0x1394f3['uniqueid'],_0x1394f3[_0xdbc0('0x4a')]));channels[_0x1394f3[_0xdbc0('0x7')]][_0xdbc0('0x5d')]=_0x1394f3[_0xdbc0('0x4a')];}if(!_['isNil'](_0x1394f3[_0xdbc0('0x4f')][_0xdbc0('0x5e')])){utils[_0xdbc0('0x5')](util[_0xdbc0('0x18')]('[%s][calls][varset]\x20variable:sipcallid\x20value:%s',_0x1394f3[_0xdbc0('0x7')],_0x1394f3['value']));channels[_0x1394f3[_0xdbc0('0x7')]][_0xdbc0('0x5e')]=_0x1394f3[_0xdbc0('0x4a')];}}}catch(_0x5511b3){utils[_0xdbc0('0x1e')](util[_0xdbc0('0x18')](_0xdbc0('0x47'),_0x1394f3[_0xdbc0('0x7')]),_0x5511b3);}};exports['newexten']=function(_0x5a6e83){try{if(!_['isNil'](channels[_0x5a6e83[_0xdbc0('0x7')]])){utils[_0xdbc0('0x15')](util[_0xdbc0('0x18')](_0xdbc0('0x5f'),_0x5a6e83[_0xdbc0('0x7')]),_0x5a6e83);utils[_0xdbc0('0x5')](util[_0xdbc0('0x18')](_0xdbc0('0x60'),_0x5a6e83[_0xdbc0('0x7')],_0x5a6e83['application'],_0x5a6e83[_0xdbc0('0x61')]));if(_0x5a6e83[_0xdbc0('0x62')][_0xdbc0('0x63')]()=='set'&&_['startsWith'](_0x5a6e83['appdata'][_0xdbc0('0x63')](),_0xdbc0('0x64'))){var _0x4803ee=_0x5a6e83['appdata'][_0xdbc0('0x65')]('=');var _0x303aad=_0x4803ee[0x0][_0xdbc0('0x66')](_0x4803ee[0x0][_0xdbc0('0x67')]('(')+0x1,_0x4803ee[0x0][_0xdbc0('0x67')](')'));var _0x548f8a=_0x4803ee[0x1];channels[_0x5a6e83[_0xdbc0('0x7')]][_0x303aad]=_0x548f8a;}if(!_[_0xdbc0('0x68')]([_0xdbc0('0x29'),_0xdbc0('0x69'),'execif',_0xdbc0('0x6a'),_0xdbc0('0x6b')],_0x5a6e83['application'][_0xdbc0('0x63')]())){channels[_0x5a6e83['uniqueid']][_0xdbc0('0x55')]=_0x5a6e83[_0xdbc0('0x62')];channels[_0x5a6e83['uniqueid']][_0xdbc0('0x56')]=_0x5a6e83[_0xdbc0('0x61')];}}}catch(_0x3819b9){utils['error'](util[_0xdbc0('0x18')](_0xdbc0('0x5f'),_0x5a6e83[_0xdbc0('0x7')]),_0x3819b9);}}; \ No newline at end of file +var _0x362a=['ContactId','[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s','outboundrouteid','[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s','routeid','sipcallid','[%s][calls][varset]\x20variable:sipcallid\x20value:%s','newexten','[%s][calls][newexten]','application','appdata','toLowerCase','set','startsWith','split','lastIndexOf','includes','noop','gotoif','lodash','util','NO\x20ANSWER','FAILED','info','[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','uniqueid','channel','membername','calleridnum','connectedlinenum','lastevent','accountcode','then','UserId','request','CreateVoiceCallReport','newchannel','debug','format','[%s][calls][newchannel]','linkedid','OutgoingSpoolFailed','[%s][calls][newchannel]\x20context:%s\x20exten:%s','exten','DOCUMENTATION','error','newstate','[%s][calls][newstate]','channelstate','[%s][calls][newstate]\x20context:%s\x20channel:%s','context','isNil','now','transfer','[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','answertime','disposition','toNumber','hangup','[%s][calls][hangup]','callerid','calleridname','cause-txt','endtime','duration','diffTime','starttime','billableseconds','localtwolinkedid','[%s][calls][attendedtransfer]','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','secondtransfererchannel','destinationchannel','userfield','transfertargetchannel','origtransfereruniqueid','origtransfererchannel','_attended','musiconholdstartAt','[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s','[%s][calls][musiconholdstart]','musiconholdstop','[%s][calls][musiconholdstop]','[%s][calls][musiconholdstop]\x20mohtime:%s','mohtime','varset','[%s][calls][varset]','variable','value','xmd-phone','[%s][calls][varset]\x20variable:xmd-phone\x20value:%s','destination','\x22\x20<','xmd-callerid-preview','xmd-callerid','xmd-queue','xmcs-queue','[%s][calls][varset]\x20variable:%s\x20value:%s','Queue','lastdata','queue','xmd-contactid','[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s'];(function(_0x303d49,_0x31689b){var _0x30624f=function(_0x2e91fc){while(--_0x2e91fc){_0x303d49['push'](_0x303d49['shift']());}};_0x30624f(++_0x31689b);}(_0x362a,0xe1));var _0xa362=function(_0xf5541e,_0x53a22f){_0xf5541e=_0xf5541e-0x0;var _0x3aed8e=_0x362a[_0xf5541e];return _0x3aed8e;};'use strict';var _=require(_0xa362('0x0'));var util=require(_0xa362('0x1'));var utils=require('./utils');var dispositions=[_0xa362('0x2'),_0xa362('0x3'),_0xa362('0x3'),_0xa362('0x2'),_0xa362('0x2'),_0xa362('0x2'),'ANSWERED','BUSY',_0xa362('0x3'),'FAILED',_0xa362('0x3')];var channels={};function writeDB(_0x5a35d0){utils[_0xa362('0x4')](util['format'](_0xa362('0x5'),_0x5a35d0[_0xa362('0x6')],_0x5a35d0[_0xa362('0x7')],_0x5a35d0['queue'],_0x5a35d0[_0xa362('0x8')],_0x5a35d0['interface'],_0x5a35d0[_0xa362('0x9')],_0x5a35d0[_0xa362('0xa')],_0x5a35d0[_0xa362('0xb')]));if(_0x5a35d0[_0xa362('0xc')]){utils['getUserByInternal'](_0x5a35d0[_0xa362('0xc')])[_0xa362('0xd')](function(_0x53d8d4){if(_0x53d8d4){_0x5a35d0[_0xa362('0xe')]=_0x53d8d4['id'];}utils['request']('CreateVoiceCallReport',_0x5a35d0);});}else{utils[_0xa362('0xf')](_0xa362('0x10'),_0x5a35d0);}if(channels[_0x5a35d0['uniqueid']]){delete channels[_0x5a35d0['uniqueid']];}}exports[_0xa362('0x11')]=function(_0x35e6c3){try{utils[_0xa362('0x12')](util[_0xa362('0x13')](_0xa362('0x14'),_0x35e6c3[_0xa362('0x6')]),_0x35e6c3);if(_0x35e6c3[_0xa362('0x6')]==_0x35e6c3[_0xa362('0x15')]&&_0x35e6c3[_0xa362('0x7')]!=_0xa362('0x16')){utils['info'](util[_0xa362('0x13')](_0xa362('0x17'),_0x35e6c3['uniqueid'],_0x35e6c3['context'],_0x35e6c3[_0xa362('0x18')]));channels[_0x35e6c3[_0xa362('0x6')]]={'uniqueid':_0x35e6c3[_0xa362('0x6')],'accountcode':_0x35e6c3[_0xa362('0xc')],'source':_0x35e6c3[_0xa362('0x9')],'destination':_0x35e6c3[_0xa362('0x18')],'destinationcontext':_0x35e6c3['context'],'channel':_0x35e6c3[_0xa362('0x7')],'starttime':utils['now'](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0xa362('0x2'),'amaflags':_0xa362('0x19')};}}catch(_0xb857da){utils[_0xa362('0x1a')](util['format'](_0xa362('0x14'),_0x35e6c3[_0xa362('0x6')]),_0xb857da);}};exports[_0xa362('0x1b')]=function(_0x4585d1){try{utils[_0xa362('0x12')](util[_0xa362('0x13')](_0xa362('0x1c'),_0x4585d1[_0xa362('0x6')]),_0x4585d1);if(!_['isNil'](channels[_0x4585d1[_0xa362('0x6')]])&&_0x4585d1[_0xa362('0x1d')]==0x6){utils[_0xa362('0x4')](util[_0xa362('0x13')](_0xa362('0x1e'),_0x4585d1[_0xa362('0x6')],_0x4585d1[_0xa362('0x1f')],_0x4585d1['channel']));if(_[_0xa362('0x20')](channels[_0x4585d1['uniqueid']]['systemanswertime'])){channels[_0x4585d1['uniqueid']]['systemanswertime']=utils[_0xa362('0x21')]();}}else if(!_[_0xa362('0x20')](channels[_0x4585d1[_0xa362('0x15')]])&&_0x4585d1[_0xa362('0x1d')]==0x6&&_0x4585d1[_0xa362('0x1f')]!=_0xa362('0x22')){utils[_0xa362('0x4')](util[_0xa362('0x13')](_0xa362('0x23'),_0x4585d1[_0xa362('0x6')],_0x4585d1['linkedid'],_0x4585d1[_0xa362('0x1f')],_0x4585d1[_0xa362('0x7')]));channels[_0x4585d1[_0xa362('0x15')]][_0xa362('0xc')]=_0x4585d1[_0xa362('0xc')];channels[_0x4585d1[_0xa362('0x15')]]['destinationchannel']=_0x4585d1[_0xa362('0x7')];if(_[_0xa362('0x20')](channels[_0x4585d1[_0xa362('0x15')]][_0xa362('0x24')])){channels[_0x4585d1['linkedid']][_0xa362('0x24')]=utils[_0xa362('0x21')]();}channels[_0x4585d1[_0xa362('0x15')]][_0xa362('0x25')]=dispositions[_[_0xa362('0x26')](_0x4585d1[_0xa362('0x1d')])]||'ANSWERED';}}catch(_0x1f94a9){utils[_0xa362('0x1a')](util['format'](_0xa362('0x1c'),_0x4585d1['uniqueid']),_0x1f94a9);}};exports[_0xa362('0x27')]=function(_0x29473b){try{if(!_['isNil'](channels[_0x29473b[_0xa362('0x6')]])){utils[_0xa362('0x12')](util[_0xa362('0x13')](_0xa362('0x28'),_0x29473b[_0xa362('0x6')]),_0x29473b);if(_['isNil'](channels[_0x29473b[_0xa362('0x6')]][_0xa362('0x29')])){channels[_0x29473b[_0xa362('0x6')]][_0xa362('0x29')]=_0x29473b[_0xa362('0x2a')]+'\x20<'+_0x29473b['calleridnum']+'>';}utils[_0xa362('0x4')](util[_0xa362('0x13')]('[%s][calls][hangup]\x20callerid:%s\x20reason:%s',_0x29473b[_0xa362('0x6')],channels[_0x29473b[_0xa362('0x6')]][_0xa362('0x29')],_0x29473b[_0xa362('0x2b')]));channels[_0x29473b['uniqueid']][_0xa362('0x2c')]=utils[_0xa362('0x21')]();channels[_0x29473b['uniqueid']][_0xa362('0x2d')]=utils[_0xa362('0x2e')](channels[_0x29473b[_0xa362('0x6')]][_0xa362('0x2c')],channels[_0x29473b[_0xa362('0x6')]][_0xa362('0x2f')]);channels[_0x29473b[_0xa362('0x6')]][_0xa362('0x30')]=channels[_0x29473b[_0xa362('0x6')]][_0xa362('0x24')]?utils['diffTime'](channels[_0x29473b[_0xa362('0x6')]][_0xa362('0x2c')],channels[_0x29473b[_0xa362('0x6')]][_0xa362('0x24')]):0x0;writeDB(channels[_0x29473b['uniqueid']]);}}catch(_0x28261e){utils['error'](util[_0xa362('0x13')](_0xa362('0x28'),_0x29473b['uniqueid']),_0x28261e);}};exports['attendedtransfer']=function(_0x1bb624){try{if(!_['isNil'](channels[_0x1bb624[_0xa362('0x31')]])){utils[_0xa362('0x12')](util[_0xa362('0x13')](_0xa362('0x32'),_0x1bb624['origtransfereruniqueid']),_0x1bb624);if(channels[_0x1bb624['localtwolinkedid']][_0xa362('0x7')]==_0x1bb624['transfereechannel']){utils[_0xa362('0x4')](util[_0xa362('0x13')](_0xa362('0x33'),_0x1bb624['origtransfereruniqueid'],_0x1bb624['localtwolinkedid'],_0x1bb624[_0xa362('0x34')]));channels[_0x1bb624['localtwolinkedid']][_0xa362('0x35')]=_0x1bb624[_0xa362('0x34')];channels[_0x1bb624[_0xa362('0x31')]][_0xa362('0x36')]='_attended';}else if(channels[_0x1bb624[_0xa362('0x31')]][_0xa362('0x7')]=_0x1bb624[_0xa362('0x37')]){utils['info'](util[_0xa362('0x13')](_0xa362('0x33'),_0x1bb624[_0xa362('0x38')],_0x1bb624[_0xa362('0x31')],_0x1bb624[_0xa362('0x39')]));channels[_0x1bb624[_0xa362('0x31')]]['destinationchannel']=_0x1bb624[_0xa362('0x39')];channels[_0x1bb624[_0xa362('0x31')]][_0xa362('0x36')]=_0xa362('0x3a');}}}catch(_0x1b2d60){utils[_0xa362('0x1a')](util[_0xa362('0x13')](_0xa362('0x32'),_0x1bb624[_0xa362('0x38')]),_0x1b2d60);}};exports['musiconholdstart']=function(_0x4983ec){try{if(!_[_0xa362('0x20')](channels[_0x4983ec[_0xa362('0x6')]])){utils[_0xa362('0x12')](util[_0xa362('0x13')]('[%s][calls][musiconholdstart]',_0x4983ec[_0xa362('0x6')]),_0x4983ec);channels[_0x4983ec[_0xa362('0x6')]][_0xa362('0x3b')]=utils[_0xa362('0x21')]();utils[_0xa362('0x4')](util[_0xa362('0x13')](_0xa362('0x3c'),_0x4983ec[_0xa362('0x6')],channels[_0x4983ec['uniqueid']][_0xa362('0x3b')]));}}catch(_0x5bf87f){utils[_0xa362('0x1a')](util[_0xa362('0x13')](_0xa362('0x3d'),_0x4983ec['uniqueid']),_0x5bf87f);}};exports[_0xa362('0x3e')]=function(_0x1d995b){try{if(!_[_0xa362('0x20')](channels[_0x1d995b[_0xa362('0x6')]])){utils['debug'](util[_0xa362('0x13')](_0xa362('0x3f'),_0x1d995b[_0xa362('0x6')]),_0x1d995b);if(!_[_0xa362('0x20')](channels[_0x1d995b[_0xa362('0x6')]]['musiconholdstartAt'])){channels[_0x1d995b[_0xa362('0x6')]]['mohtime']+=utils[_0xa362('0x2e')](utils[_0xa362('0x21')](),channels[_0x1d995b[_0xa362('0x6')]][_0xa362('0x3b')]);utils[_0xa362('0x4')](util[_0xa362('0x13')](_0xa362('0x40'),_0x1d995b[_0xa362('0x6')],channels[_0x1d995b['uniqueid']][_0xa362('0x41')]));delete channels[_0x1d995b[_0xa362('0x6')]][_0xa362('0x3b')];}}}catch(_0x357268){utils[_0xa362('0x1a')](util[_0xa362('0x13')](_0xa362('0x3f'),_0x1d995b[_0xa362('0x6')]),_0x357268);}};exports[_0xa362('0x42')]=function(_0x1a3096){try{if(!_['isNil'](channels[_0x1a3096[_0xa362('0x6')]])){utils['debug'](util[_0xa362('0x13')](_0xa362('0x43'),_0x1a3096[_0xa362('0x6')]),_0x1a3096);if(!_['isNil'](_0x1a3096[_0xa362('0x44')]['xmd-originatecalleridnum'])){utils[_0xa362('0x4')](util['format']('[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s',_0x1a3096[_0xa362('0x6')],_0x1a3096[_0xa362('0x45')]));channels[_0x1a3096[_0xa362('0x6')]]['source']=_0x1a3096[_0xa362('0x45')];}if(!_[_0xa362('0x20')](_0x1a3096[_0xa362('0x44')][_0xa362('0x46')])){utils['info'](util[_0xa362('0x13')](_0xa362('0x47'),_0x1a3096[_0xa362('0x6')],_0x1a3096['value']));channels[_0x1a3096['uniqueid']][_0xa362('0x48')]=_0x1a3096[_0xa362('0x45')];channels[_0x1a3096['uniqueid']][_0xa362('0x29')]='\x22'+_0x1a3096['value']+_0xa362('0x49')+_0x1a3096[_0xa362('0x45')]+'>';}if(!_[_0xa362('0x20')](_0x1a3096[_0xa362('0x44')]['xmd-callerid-preview'])||!_[_0xa362('0x20')](_0x1a3096['variable']['xmd-callerid'])){utils[_0xa362('0x4')](util['format']('[%s][calls][varset]\x20variable:%s\x20value:%s',_0x1a3096[_0xa362('0x6')],!_['isNil'](_0x1a3096['variable']['xmd-callerid-preview'])?_0xa362('0x4a'):_0xa362('0x4b'),_0x1a3096['value']));channels[_0x1a3096[_0xa362('0x6')]][_0xa362('0x29')]=_0x1a3096['value'];}if(!_[_0xa362('0x20')](_0x1a3096[_0xa362('0x44')][_0xa362('0x4c')])||!_[_0xa362('0x20')](_0x1a3096[_0xa362('0x44')][_0xa362('0x4d')])){utils[_0xa362('0x4')](util[_0xa362('0x13')](_0xa362('0x4e'),_0x1a3096[_0xa362('0x6')],!_['isNil'](_0x1a3096[_0xa362('0x44')][_0xa362('0x4c')])?_0xa362('0x4c'):_0xa362('0x4d'),_0x1a3096['value']));channels[_0x1a3096['uniqueid']]['lastapplication']=_0xa362('0x4f');channels[_0x1a3096[_0xa362('0x6')]][_0xa362('0x50')]=_0x1a3096[_0xa362('0x45')];channels[_0x1a3096[_0xa362('0x6')]][_0xa362('0x51')]=!![];}if(!_['isNil'](_0x1a3096[_0xa362('0x44')][_0xa362('0x52')])){utils[_0xa362('0x4')](util[_0xa362('0x13')](_0xa362('0x53'),_0x1a3096[_0xa362('0x6')],_0x1a3096[_0xa362('0x45')]));channels[_0x1a3096['uniqueid']][_0xa362('0x54')]=_0x1a3096[_0xa362('0x45')];}if(!_[_0xa362('0x20')](_0x1a3096[_0xa362('0x44')]['xmd-cdrtype'])){utils['info'](util['format'](_0xa362('0x55'),_0x1a3096['uniqueid'],_0x1a3096[_0xa362('0x45')]));channels[_0x1a3096[_0xa362('0x6')]]['type']=_0x1a3096[_0xa362('0x45')];}if(!_[_0xa362('0x20')](_0x1a3096[_0xa362('0x44')][_0xa362('0x56')])){utils['info'](util[_0xa362('0x13')](_0xa362('0x57'),_0x1a3096['uniqueid'],_0x1a3096[_0xa362('0x45')]));channels[_0x1a3096[_0xa362('0x6')]][_0xa362('0x58')]=_0x1a3096['value'];}if(!_[_0xa362('0x20')](_0x1a3096[_0xa362('0x44')][_0xa362('0x59')])){utils[_0xa362('0x4')](util['format'](_0xa362('0x5a'),_0x1a3096[_0xa362('0x6')],_0x1a3096[_0xa362('0x45')]));channels[_0x1a3096[_0xa362('0x6')]][_0xa362('0x59')]=_0x1a3096[_0xa362('0x45')];}}}catch(_0x1e63a9){utils[_0xa362('0x1a')](util[_0xa362('0x13')](_0xa362('0x43'),_0x1a3096[_0xa362('0x6')]),_0x1e63a9);}};exports[_0xa362('0x5b')]=function(_0x46bc5c){try{if(!_[_0xa362('0x20')](channels[_0x46bc5c[_0xa362('0x6')]])){utils[_0xa362('0x12')](util[_0xa362('0x13')](_0xa362('0x5c'),_0x46bc5c[_0xa362('0x6')]),_0x46bc5c);utils[_0xa362('0x4')](util['format']('[%s][calls][newexten]\x20application:%s\x20appdata:%s',_0x46bc5c[_0xa362('0x6')],_0x46bc5c[_0xa362('0x5d')],_0x46bc5c[_0xa362('0x5e')]));if(_0x46bc5c[_0xa362('0x5d')][_0xa362('0x5f')]()==_0xa362('0x60')&&_[_0xa362('0x61')](_0x46bc5c[_0xa362('0x5e')][_0xa362('0x5f')](),'cdr')){var _0x3b8f33=_0x46bc5c[_0xa362('0x5e')][_0xa362('0x62')]('=');var _0x26dcab=_0x3b8f33[0x0]['substring'](_0x3b8f33[0x0][_0xa362('0x63')]('(')+0x1,_0x3b8f33[0x0][_0xa362('0x63')](')'));var _0x1e7bb9=_0x3b8f33[0x1];channels[_0x46bc5c[_0xa362('0x6')]][_0x26dcab]=_0x1e7bb9;}if(!_[_0xa362('0x64')]([_0xa362('0x27'),_0xa362('0x65'),'execif','set',_0xa362('0x66')],_0x46bc5c['application'][_0xa362('0x5f')]())){channels[_0x46bc5c[_0xa362('0x6')]]['lastapplication']=_0x46bc5c[_0xa362('0x5d')];channels[_0x46bc5c[_0xa362('0x6')]]['lastdata']=_0x46bc5c[_0xa362('0x5e')];}}}catch(_0x572d2d){utils[_0xa362('0x1a')](util['format'](_0xa362('0x5c'),_0x46bc5c[_0xa362('0x6')]),_0x572d2d);}}; \ No newline at end of file diff --git a/server/services/xdr/core.controller.js b/server/services/xdr/core.controller.js index e0593c6..8225ec0 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 _0xa3b8=['managerevent','info','[core]\x20connected','shutdown','[core]\x20shutdown','fullybooted','[core]\x20fullybooted','error','[core]\x20close'];(function(_0x4ac5e4,_0x21e521){var _0x3baebe=function(_0x2cecaf){while(--_0x2cecaf){_0x4ac5e4['push'](_0x4ac5e4['shift']());}};_0x3baebe(++_0x21e521);}(_0xa3b8,0x118));var _0x8a3b=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xa3b8[_0x1facfa];return _0x9ec701;};'use strict';var utils=require('./utils');exports['connect']=function(){utils[_0x8a3b('0x0')](_0x8a3b('0x1'));};exports[_0x8a3b('0x2')]=function(){utils[_0x8a3b('0x0')](_0x8a3b('0x3'));};exports[_0x8a3b('0x4')]=function(){utils[_0x8a3b('0x0')](_0x8a3b('0x5'));};exports[_0x8a3b('0x6')]=function(_0x4e1689){utils[_0x8a3b('0x6')]('[core]\x20error',_0x4e1689);};exports['close']=function(){utils['info'](_0x8a3b('0x7'));};exports[_0x8a3b('0x8')]=function(_0x55cd80){}; \ No newline at end of file +var _0x90ee=['managerevent','./utils','connect','info','[core]\x20connected','shutdown','[core]\x20shutdown','[core]\x20fullybooted','error','[core]\x20error','close','[core]\x20close'];(function(_0x3c54d3,_0x9719e3){var _0xd67c8f=function(_0x4be75d){while(--_0x4be75d){_0x3c54d3['push'](_0x3c54d3['shift']());}};_0xd67c8f(++_0x9719e3);}(_0x90ee,0xd9));var _0xe90e=function(_0x503be0,_0x254ab5){_0x503be0=_0x503be0-0x0;var _0x2300f6=_0x90ee[_0x503be0];return _0x2300f6;};'use strict';var utils=require(_0xe90e('0x0'));exports[_0xe90e('0x1')]=function(){utils[_0xe90e('0x2')](_0xe90e('0x3'));};exports[_0xe90e('0x4')]=function(){utils[_0xe90e('0x2')](_0xe90e('0x5'));};exports['fullybooted']=function(){utils[_0xe90e('0x2')](_0xe90e('0x6'));};exports['error']=function(_0x3c7a1a){utils[_0xe90e('0x7')](_0xe90e('0x8'),_0x3c7a1a);};exports[_0xe90e('0x9')]=function(){utils[_0xe90e('0x2')](_0xe90e('0xa'));};exports[_0xe90e('0xb')]=function(_0x288668){}; \ No newline at end of file diff --git a/server/services/xdr/dials.controller.js b/server/services/xdr/dials.controller.js index 1f12b9d..7dbb5c3 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 _0xbaa2=['split','error','[%s][dials][newexten]','varset','[%s][dials][varset]','isNil','outboundrouteid','value','debug','[%s][dials][dialbegin]','starttime','[%s][dials][hangup]\x20starttime:%s\x20lastevent:called','dialend','[%s][dials][dialend]','ANSWER','answertime','now','lastevent','[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect','hangup','[%s][dials][hangup]','[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s','calleridname','cause-txt','duration','diffTime','endtime','holdtime','billableseconds','lodash','util','format','[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s','uniqueid','dialstring','calleridnum','connectedlinenum','dialstatus','CreateVoiceDialReport','newexten','info','[%s][dials][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','set','cdr(routeid)'];(function(_0x409ad2,_0x5129c1){var _0x595b5f=function(_0x592974){while(--_0x592974){_0x409ad2['push'](_0x409ad2['shift']());}};_0x595b5f(++_0x5129c1);}(_0xbaa2,0x137));var _0x2baa=function(_0x3f2ce5,_0x7e3097){_0x3f2ce5=_0x3f2ce5-0x0;var _0x3afeea=_0xbaa2[_0x3f2ce5];return _0x3afeea;};'use strict';var _=require(_0x2baa('0x0'));var util=require(_0x2baa('0x1'));var utils=require('./utils');var dials={};function writeDB(_0x2138f7){utils['info'](util[_0x2baa('0x2')](_0x2baa('0x3'),_0x2138f7[_0x2baa('0x4')],_0x2138f7['channel'],_0x2138f7[_0x2baa('0x5')],_0x2138f7[_0x2baa('0x6')],_0x2138f7[_0x2baa('0x7')],_0x2138f7[_0x2baa('0x8')]));utils['request'](_0x2baa('0x9'),_0x2138f7);delete dials[_0x2138f7[_0x2baa('0x4')]];}exports[_0x2baa('0xa')]=function(_0x52c3e5){try{utils['debug'](util['format']('[%s][dials][newexten]',_0x52c3e5[_0x2baa('0x4')]),_0x52c3e5);utils[_0x2baa('0xb')](util[_0x2baa('0x2')](_0x2baa('0xc'),_0x52c3e5[_0x2baa('0x4')],_0x52c3e5[_0x2baa('0xd')],_0x52c3e5[_0x2baa('0xe')]));if(_0x52c3e5['application'][_0x2baa('0xf')]()==_0x2baa('0x10')&&_['startsWith'](_0x52c3e5[_0x2baa('0xe')][_0x2baa('0xf')](),_0x2baa('0x11'))){var _0x309994=_0x52c3e5['appdata'][_0x2baa('0x12')]('=');dials[_0x52c3e5['uniqueid']]={'routeId':_0x309994[0x1]};}}catch(_0x18aab8){utils[_0x2baa('0x13')](util['format'](_0x2baa('0x14'),_0x52c3e5[_0x2baa('0x4')]),_0x18aab8);}};exports[_0x2baa('0x15')]=function(_0x30237e){try{utils['debug'](util[_0x2baa('0x2')](_0x2baa('0x16'),_0x30237e[_0x2baa('0x4')]),_0x30237e);if(!_[_0x2baa('0x17')](_0x30237e['variable'][_0x2baa('0x18')])){utils['info'](util[_0x2baa('0x2')]('[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s',_0x30237e[_0x2baa('0x4')],_0x30237e[_0x2baa('0x19')]));dials[_0x30237e[_0x2baa('0x4')]]={'routeId':_0x30237e['value']};}}catch(_0x50befe){utils[_0x2baa('0x13')](util['format'](_0x2baa('0x16'),_0x30237e[_0x2baa('0x4')]),_0x50befe);}};exports['dialbegin']=function(_0x2f8650){try{if(!_[_0x2baa('0x17')](dials[_0x2f8650['uniqueid']])){utils[_0x2baa('0x1a')](util[_0x2baa('0x2')](_0x2baa('0x1b'),_0x2f8650[_0x2baa('0x4')]),_0x2f8650);dials[_0x2f8650[_0x2baa('0x4')]]=_['assign'](dials[_0x2f8650[_0x2baa('0x4')]],_0x2f8650);dials[_0x2f8650[_0x2baa('0x4')]][_0x2baa('0x1c')]=utils['now']();dials[_0x2f8650[_0x2baa('0x4')]]['lastevent']='called';utils[_0x2baa('0xb')](util[_0x2baa('0x2')](_0x2baa('0x1d'),_0x2f8650[_0x2baa('0x4')],dials[_0x2f8650[_0x2baa('0x4')]][_0x2baa('0x1c')]));}}catch(_0x25c6f9){utils[_0x2baa('0x13')](util['format'](_0x2baa('0x1b'),_0x2f8650['uniqueid']),_0x25c6f9);}};exports[_0x2baa('0x1e')]=function(_0xce52ca){try{if(!_[_0x2baa('0x17')](dials[_0xce52ca[_0x2baa('0x4')]])){utils[_0x2baa('0x1a')](util[_0x2baa('0x2')](_0x2baa('0x1f'),_0xce52ca['uniqueid']),_0xce52ca);dials[_0xce52ca[_0x2baa('0x4')]][_0x2baa('0x8')]=_0xce52ca[_0x2baa('0x8')];if(_0xce52ca['dialstatus']==_0x2baa('0x20')){dials[_0xce52ca['uniqueid']]=_['assign'](dials[_0xce52ca['uniqueid']],_0xce52ca);dials[_0xce52ca['uniqueid']][_0x2baa('0x21')]=utils[_0x2baa('0x22')]();dials[_0xce52ca[_0x2baa('0x4')]][_0x2baa('0x23')]='connect';utils[_0x2baa('0xb')](util[_0x2baa('0x2')](_0x2baa('0x24'),_0xce52ca[_0x2baa('0x4')],_0xce52ca[_0x2baa('0x8')],dials[_0xce52ca['uniqueid']][_0x2baa('0x21')]));}else{utils[_0x2baa('0xb')](util[_0x2baa('0x2')]('[%s][dials][dialend]\x20dialstatus:%s',_0xce52ca['uniqueid'],_0xce52ca[_0x2baa('0x8')]));}}}catch(_0x13c07d){utils[_0x2baa('0x13')](util['format'](_0x2baa('0x1f'),_0xce52ca['uniqueid']),_0x13c07d);}};exports[_0x2baa('0x25')]=function(_0x7676cb){try{if(!_['isNil'](dials[_0x7676cb[_0x2baa('0x4')]])){utils['debug'](util[_0x2baa('0x2')](_0x2baa('0x26'),_0x7676cb[_0x2baa('0x4')]),_0x7676cb);utils[_0x2baa('0xb')](util[_0x2baa('0x2')](_0x2baa('0x27'),_0x7676cb[_0x2baa('0x4')],_0x7676cb[_0x2baa('0x6')],_0x7676cb[_0x2baa('0x28')],_0x7676cb[_0x2baa('0x29')]));dials[_0x7676cb[_0x2baa('0x4')]]=_['assign'](dials[_0x7676cb[_0x2baa('0x4')]],{'endtime':utils[_0x2baa('0x22')](),'lastevent':'complete'});dials[_0x7676cb[_0x2baa('0x4')]][_0x2baa('0x2a')]=utils[_0x2baa('0x2b')](dials[_0x7676cb[_0x2baa('0x4')]][_0x2baa('0x2c')],dials[_0x7676cb['uniqueid']][_0x2baa('0x1c')]);dials[_0x7676cb[_0x2baa('0x4')]][_0x2baa('0x2d')]=utils['diffTime'](dials[_0x7676cb[_0x2baa('0x4')]][_0x2baa('0x21')]||dials[_0x7676cb[_0x2baa('0x4')]][_0x2baa('0x2c')],dials[_0x7676cb['uniqueid']][_0x2baa('0x1c')]);dials[_0x7676cb[_0x2baa('0x4')]][_0x2baa('0x2e')]=dials[_0x7676cb[_0x2baa('0x4')]][_0x2baa('0x21')]?utils[_0x2baa('0x2b')](dials[_0x7676cb[_0x2baa('0x4')]][_0x2baa('0x2c')],dials[_0x7676cb[_0x2baa('0x4')]][_0x2baa('0x21')]):0x0;writeDB(dials[_0x7676cb['uniqueid']]);}}catch(_0x20899a){utils['error'](util['format'](_0x2baa('0x26'),_0x7676cb['uniqueid']),_0x20899a);}}; \ No newline at end of file +var _0xba5a=['connect','[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect','[%s][dials][dialend]\x20dialstatus:%s','hangup','[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s','calleridname','cause-txt','duration','diffTime','endtime','holdtime','util','format','[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s','uniqueid','dialstring','calleridnum','dialstatus','CreateVoiceDialReport','newexten','debug','info','[%s][dials][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','set','startsWith','cdr(routeid)','split','error','[%s][dials][varset]','isNil','variable','outboundrouteid','[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s','value','dialbegin','[%s][dials][dialbegin]','assign','now','called','[%s][dials][hangup]\x20starttime:%s\x20lastevent:called','starttime','dialend','[%s][dials][dialend]','ANSWER','answertime'];(function(_0x1301aa,_0x4da5c4){var _0x5146a1=function(_0x417cd1){while(--_0x417cd1){_0x1301aa['push'](_0x1301aa['shift']());}};_0x5146a1(++_0x4da5c4);}(_0xba5a,0x6b));var _0xaba5=function(_0x10244a,_0x3e96f4){_0x10244a=_0x10244a-0x0;var _0x4daacd=_0xba5a[_0x10244a];return _0x4daacd;};'use strict';var _=require('lodash');var util=require(_0xaba5('0x0'));var utils=require('./utils');var dials={};function writeDB(_0x5e5f82){utils['info'](util[_0xaba5('0x1')](_0xaba5('0x2'),_0x5e5f82[_0xaba5('0x3')],_0x5e5f82['channel'],_0x5e5f82[_0xaba5('0x4')],_0x5e5f82[_0xaba5('0x5')],_0x5e5f82['connectedlinenum'],_0x5e5f82[_0xaba5('0x6')]));utils['request'](_0xaba5('0x7'),_0x5e5f82);delete dials[_0x5e5f82[_0xaba5('0x3')]];}exports[_0xaba5('0x8')]=function(_0x48d762){try{utils[_0xaba5('0x9')](util[_0xaba5('0x1')]('[%s][dials][newexten]',_0x48d762[_0xaba5('0x3')]),_0x48d762);utils[_0xaba5('0xa')](util[_0xaba5('0x1')](_0xaba5('0xb'),_0x48d762['uniqueid'],_0x48d762[_0xaba5('0xc')],_0x48d762[_0xaba5('0xd')]));if(_0x48d762['application'][_0xaba5('0xe')]()==_0xaba5('0xf')&&_[_0xaba5('0x10')](_0x48d762[_0xaba5('0xd')][_0xaba5('0xe')](),_0xaba5('0x11'))){var _0x48555c=_0x48d762[_0xaba5('0xd')][_0xaba5('0x12')]('=');dials[_0x48d762['uniqueid']]={'routeId':_0x48555c[0x1]};}}catch(_0x4ab0c0){utils[_0xaba5('0x13')](util['format']('[%s][dials][newexten]',_0x48d762['uniqueid']),_0x4ab0c0);}};exports['varset']=function(_0x57f6e5){try{utils['debug'](util[_0xaba5('0x1')](_0xaba5('0x14'),_0x57f6e5[_0xaba5('0x3')]),_0x57f6e5);if(!_[_0xaba5('0x15')](_0x57f6e5[_0xaba5('0x16')][_0xaba5('0x17')])){utils[_0xaba5('0xa')](util[_0xaba5('0x1')](_0xaba5('0x18'),_0x57f6e5[_0xaba5('0x3')],_0x57f6e5[_0xaba5('0x19')]));dials[_0x57f6e5[_0xaba5('0x3')]]={'routeId':_0x57f6e5[_0xaba5('0x19')]};}}catch(_0x3e0768){utils[_0xaba5('0x13')](util[_0xaba5('0x1')](_0xaba5('0x14'),_0x57f6e5[_0xaba5('0x3')]),_0x3e0768);}};exports[_0xaba5('0x1a')]=function(_0x5f21d2){try{if(!_[_0xaba5('0x15')](dials[_0x5f21d2[_0xaba5('0x3')]])){utils[_0xaba5('0x9')](util[_0xaba5('0x1')](_0xaba5('0x1b'),_0x5f21d2[_0xaba5('0x3')]),_0x5f21d2);dials[_0x5f21d2[_0xaba5('0x3')]]=_[_0xaba5('0x1c')](dials[_0x5f21d2['uniqueid']],_0x5f21d2);dials[_0x5f21d2[_0xaba5('0x3')]]['starttime']=utils[_0xaba5('0x1d')]();dials[_0x5f21d2[_0xaba5('0x3')]]['lastevent']=_0xaba5('0x1e');utils['info'](util[_0xaba5('0x1')](_0xaba5('0x1f'),_0x5f21d2[_0xaba5('0x3')],dials[_0x5f21d2[_0xaba5('0x3')]][_0xaba5('0x20')]));}}catch(_0x48b646){utils['error'](util[_0xaba5('0x1')](_0xaba5('0x1b'),_0x5f21d2[_0xaba5('0x3')]),_0x48b646);}};exports[_0xaba5('0x21')]=function(_0x59f3de){try{if(!_['isNil'](dials[_0x59f3de['uniqueid']])){utils['debug'](util['format'](_0xaba5('0x22'),_0x59f3de[_0xaba5('0x3')]),_0x59f3de);dials[_0x59f3de[_0xaba5('0x3')]][_0xaba5('0x6')]=_0x59f3de[_0xaba5('0x6')];if(_0x59f3de[_0xaba5('0x6')]==_0xaba5('0x23')){dials[_0x59f3de[_0xaba5('0x3')]]=_[_0xaba5('0x1c')](dials[_0x59f3de[_0xaba5('0x3')]],_0x59f3de);dials[_0x59f3de['uniqueid']][_0xaba5('0x24')]=utils[_0xaba5('0x1d')]();dials[_0x59f3de[_0xaba5('0x3')]]['lastevent']=_0xaba5('0x25');utils['info'](util[_0xaba5('0x1')](_0xaba5('0x26'),_0x59f3de['uniqueid'],_0x59f3de[_0xaba5('0x6')],dials[_0x59f3de[_0xaba5('0x3')]][_0xaba5('0x24')]));}else{utils[_0xaba5('0xa')](util['format'](_0xaba5('0x27'),_0x59f3de[_0xaba5('0x3')],_0x59f3de[_0xaba5('0x6')]));}}}catch(_0x2125af){utils[_0xaba5('0x13')](util[_0xaba5('0x1')](_0xaba5('0x22'),_0x59f3de[_0xaba5('0x3')]),_0x2125af);}};exports[_0xaba5('0x28')]=function(_0x1158d3){try{if(!_['isNil'](dials[_0x1158d3[_0xaba5('0x3')]])){utils[_0xaba5('0x9')](util[_0xaba5('0x1')]('[%s][dials][hangup]',_0x1158d3[_0xaba5('0x3')]),_0x1158d3);utils[_0xaba5('0xa')](util[_0xaba5('0x1')](_0xaba5('0x29'),_0x1158d3['uniqueid'],_0x1158d3[_0xaba5('0x5')],_0x1158d3[_0xaba5('0x2a')],_0x1158d3[_0xaba5('0x2b')]));dials[_0x1158d3['uniqueid']]=_[_0xaba5('0x1c')](dials[_0x1158d3[_0xaba5('0x3')]],{'endtime':utils[_0xaba5('0x1d')](),'lastevent':'complete'});dials[_0x1158d3['uniqueid']][_0xaba5('0x2c')]=utils[_0xaba5('0x2d')](dials[_0x1158d3[_0xaba5('0x3')]][_0xaba5('0x2e')],dials[_0x1158d3[_0xaba5('0x3')]]['starttime']);dials[_0x1158d3[_0xaba5('0x3')]][_0xaba5('0x2f')]=utils[_0xaba5('0x2d')](dials[_0x1158d3[_0xaba5('0x3')]][_0xaba5('0x24')]||dials[_0x1158d3[_0xaba5('0x3')]][_0xaba5('0x2e')],dials[_0x1158d3['uniqueid']]['starttime']);dials[_0x1158d3['uniqueid']]['billableseconds']=dials[_0x1158d3[_0xaba5('0x3')]]['answertime']?utils[_0xaba5('0x2d')](dials[_0x1158d3[_0xaba5('0x3')]]['endtime'],dials[_0x1158d3[_0xaba5('0x3')]][_0xaba5('0x24')]):0x0;writeDB(dials[_0x1158d3['uniqueid']]);}}catch(_0x242fc1){utils[_0xaba5('0x13')](util[_0xaba5('0x1')]('[%s][dials][hangup]',_0x1158d3['uniqueid']),_0x242fc1);}}; \ No newline at end of file diff --git a/server/services/xdr/index.js b/server/services/xdr/index.js index 59d9ce9..111654a 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 _0x5296=['XDR\x20DISABLED','Asterisk\x20disabled\x20on\x20localhost','./agents.controller','./calls.controller','./queues.controller','./recordings.controller','./members.controller','./dials.controller','./transfers.controller','./core.controller','connect','shutdown','fullybooted','error','close','managerevent','devicestatechange','debug','[%s][index][devicestatechange]','format','device','agentcalled','uniqueid','[%s][index][agentcalled]','agentringnoanswer','[%s][index][agentringnoanswer]','agentconnect','[%s][index][agentcomplete]','agentcomplete','queuecallerabandon','[%s][index][queuecallerabandon]','queuecallerjoin','[%s][index][queuecallerjoin]','[%s][index][queuecallerleave]','queuecallerleave','musiconholdstart','[%s][index][musiconholdstart]','musiconholdstop','[%s][index][musiconholdstop]','[%s][index][newstate]','newstate','hangup','[%s][index][hangup]','cdr','[%s][index][cdr]','blindtransfer','[%s][index][blindtransfer]','attendedtransfer','origtransfereruniqueid','[%s][index][attendedtransfer]','varset','[%s][index][varset]','newexten','[%s][index][newexten]','[%s][index][newchannel]','newchannel','dialbegin','[%s][index][dialbegin]','dialend','[%s][index][dialend]','asterisk-manager','./utils','util','xdr','disabled','env','production','local','asterisk','username','keepConnected','info'];(function(_0x3cb6dc,_0x120dd3){var _0x47ec89=function(_0x55150a){while(--_0x55150a){_0x3cb6dc['push'](_0x3cb6dc['shift']());}};_0x47ec89(++_0x120dd3);}(_0x5296,0x1a4));var _0x6529=function(_0x366bfe,_0x2cc28b){_0x366bfe=_0x366bfe-0x0;var _0x156f93=_0x5296[_0x366bfe];return _0x156f93;};var AsteriskManager=require(_0x6529('0x0'));var config=require('../../config/environment');var utils=require(_0x6529('0x1'));var util=require(_0x6529('0x2'));var isXDREnabled=config['xdr']&&config[_0x6529('0x3')]['disabled']?!config[_0x6529('0x3')][_0x6529('0x4')]:!![];var isProduction=config[_0x6529('0x5')]===_0x6529('0x6')||![];var isLocalAsterisk=config[_0x6529('0x3')]&&config['xdr'][_0x6529('0x7')]===!![]||![];var ami=new AsteriskManager(config[_0x6529('0x8')]['port'],config[_0x6529('0x8')]['ip'],config[_0x6529('0x8')][_0x6529('0x9')],config[_0x6529('0x8')]['password'],!![]);ami[_0x6529('0xa')]();if(!isXDREnabled){utils[_0x6529('0xb')](_0x6529('0xc'));}else if(!isProduction&&!isLocalAsterisk){utils[_0x6529('0xb')](_0x6529('0xd'));}else{var agents=require(_0x6529('0xe'));var calls=require(_0x6529('0xf'));var queues=require(_0x6529('0x10'));var recordings=require(_0x6529('0x11'));var members=require(_0x6529('0x12'));var dials=require(_0x6529('0x13'));var transfers=require(_0x6529('0x14'));var core=require(_0x6529('0x15'));ami['on'](_0x6529('0x16'),core[_0x6529('0x16')]);ami['on'](_0x6529('0x17'),core[_0x6529('0x17')]);ami['on'](_0x6529('0x18'),core[_0x6529('0x18')]);ami['on'](_0x6529('0x19'),core[_0x6529('0x19')]);ami['on']('close',core[_0x6529('0x1a')]);ami['on'](_0x6529('0x1b'),core[_0x6529('0x1b')]);ami['on'](_0x6529('0x1c'),function(_0x50f8fb){try{utils[_0x6529('0x1d')](util['format'](_0x6529('0x1e'),_0x50f8fb['device']),_0x50f8fb);members[_0x6529('0x1c')](_0x50f8fb);}catch(_0x56ad32){utils[_0x6529('0x19')](util[_0x6529('0x1f')]('[%s][index][devicestatechange]',_0x50f8fb[_0x6529('0x20')]),_0x56ad32);}});ami['on'](_0x6529('0x21'),function(_0x3eb92d){try{utils[_0x6529('0x1d')](util[_0x6529('0x1f')]('[%s][index][agentcalled]',_0x3eb92d[_0x6529('0x22')]),_0x3eb92d);agents[_0x6529('0x21')](_0x3eb92d);}catch(_0x412ede){utils[_0x6529('0x19')](util[_0x6529('0x1f')](_0x6529('0x23'),_0x3eb92d[_0x6529('0x22')]),_0x412ede);}});ami['on'](_0x6529('0x24'),function(_0x5099ac){try{utils[_0x6529('0x1d')](util[_0x6529('0x1f')](_0x6529('0x25'),_0x5099ac[_0x6529('0x22')]),_0x5099ac);agents[_0x6529('0x24')](_0x5099ac);}catch(_0x5aeb43){utils[_0x6529('0x19')](util[_0x6529('0x1f')]('[%s][index][agentringnoanswer]',_0x5099ac[_0x6529('0x22')]),_0x5aeb43);}});ami['on'](_0x6529('0x26'),function(_0x213295){try{utils['debug'](util[_0x6529('0x1f')]('[%s][index][agentconnect]',_0x213295[_0x6529('0x22')]),_0x213295);agents[_0x6529('0x26')](_0x213295);queues['agentconnect'](_0x213295);}catch(_0xdebbe4){utils['error'](util[_0x6529('0x1f')]('[%s][index][agentconnect]',_0x213295['uniqueid']),_0xdebbe4);}});ami['on']('agentcomplete',function(_0x1dc664){try{utils[_0x6529('0x1d')](util[_0x6529('0x1f')](_0x6529('0x27'),_0x1dc664[_0x6529('0x22')]),_0x1dc664);agents[_0x6529('0x28')](_0x1dc664);queues[_0x6529('0x28')](_0x1dc664);members[_0x6529('0x28')](_0x1dc664);}catch(_0x279434){utils['error'](util['format'](_0x6529('0x27'),_0x1dc664[_0x6529('0x22')]),_0x279434);}});ami['on'](_0x6529('0x29'),function(_0x323e26){try{utils[_0x6529('0x1d')](util[_0x6529('0x1f')](_0x6529('0x2a'),_0x323e26[_0x6529('0x22')]),_0x323e26);agents[_0x6529('0x29')](_0x323e26);queues[_0x6529('0x29')](_0x323e26);}catch(_0x178cde){utils[_0x6529('0x19')](util[_0x6529('0x1f')](_0x6529('0x2a'),_0x323e26['uniqueid']),_0x178cde);}});ami['on']('queuecallerjoin',function(_0xca28b4){try{utils[_0x6529('0x1d')](util[_0x6529('0x1f')]('[%s][index][queuecallerjoin]',_0xca28b4['uniqueid']),_0xca28b4);queues[_0x6529('0x2b')](_0xca28b4);recordings[_0x6529('0x2b')](_0xca28b4);}catch(_0x1c7fe0){utils['error'](util['format'](_0x6529('0x2c'),_0xca28b4[_0x6529('0x22')]),_0x1c7fe0);}});ami['on']('queuecallerleave',function(_0xda75af){try{utils[_0x6529('0x1d')](util[_0x6529('0x1f')](_0x6529('0x2d'),_0xda75af['uniqueid']),_0xda75af);queues[_0x6529('0x2e')](_0xda75af);}catch(_0x41beac){utils[_0x6529('0x19')](util[_0x6529('0x1f')](_0x6529('0x2d'),_0xda75af['uniqueid']),_0x41beac);}});ami['on'](_0x6529('0x2f'),function(_0x5cf4c4){try{utils[_0x6529('0x1d')](util['format'](_0x6529('0x30'),_0x5cf4c4['uniqueid']),_0x5cf4c4);queues[_0x6529('0x2f')](_0x5cf4c4);calls[_0x6529('0x2f')](_0x5cf4c4);}catch(_0x1c9724){utils[_0x6529('0x19')](util[_0x6529('0x1f')](_0x6529('0x30'),_0x5cf4c4[_0x6529('0x22')]),_0x1c9724);}});ami['on'](_0x6529('0x31'),function(_0x27f960){try{utils[_0x6529('0x1d')](util[_0x6529('0x1f')](_0x6529('0x32'),_0x27f960[_0x6529('0x22')]),_0x27f960);queues['musiconholdstop'](_0x27f960);calls[_0x6529('0x31')](_0x27f960);}catch(_0x1a1d95){utils[_0x6529('0x19')](util[_0x6529('0x1f')](_0x6529('0x32'),_0x27f960[_0x6529('0x22')]),_0x1a1d95);}});ami['on']('newstate',function(_0x696bb0){try{utils[_0x6529('0x1d')](util[_0x6529('0x1f')](_0x6529('0x33'),_0x696bb0[_0x6529('0x22')]),_0x696bb0);calls[_0x6529('0x34')](_0x696bb0);recordings['newstate'](_0x696bb0);}catch(_0x1bd167){utils[_0x6529('0x19')](util[_0x6529('0x1f')](_0x6529('0x33'),_0x696bb0[_0x6529('0x22')]),_0x1bd167);}});ami['on'](_0x6529('0x35'),function(_0x1b7af8){try{utils[_0x6529('0x1d')](util['format'](_0x6529('0x36'),_0x1b7af8[_0x6529('0x22')]),_0x1b7af8);calls[_0x6529('0x35')](_0x1b7af8);recordings['hangup'](_0x1b7af8);dials['hangup'](_0x1b7af8);agents[_0x6529('0x35')](_0x1b7af8);queues[_0x6529('0x35')](_0x1b7af8);}catch(_0x1459ef){utils[_0x6529('0x19')](util[_0x6529('0x1f')](_0x6529('0x36'),_0x1b7af8[_0x6529('0x22')]),_0x1459ef);}});ami['on'](_0x6529('0x37'),function(_0x115de6){try{utils[_0x6529('0x1d')](util[_0x6529('0x1f')]('[%s][index][cdr]',_0x115de6['uniqueid']),_0x115de6);members[_0x6529('0x37')](_0x115de6);}catch(_0x54bb71){utils[_0x6529('0x19')](util[_0x6529('0x1f')](_0x6529('0x38'),_0x115de6[_0x6529('0x22')]),_0x54bb71);}});ami['on'](_0x6529('0x39'),function(_0x4065fb){try{utils[_0x6529('0x1d')](util[_0x6529('0x1f')]('[%s][index][blindtransfer]',_0x4065fb[_0x6529('0x22')]),_0x4065fb);queues[_0x6529('0x39')](_0x4065fb);agents['blindtransfer'](_0x4065fb);transfers[_0x6529('0x39')](_0x4065fb);}catch(_0x30473a){utils[_0x6529('0x19')](util['format'](_0x6529('0x3a'),_0x4065fb[_0x6529('0x22')]),_0x30473a);}});ami['on'](_0x6529('0x3b'),function(_0x58bf48){try{utils[_0x6529('0x1d')](util[_0x6529('0x1f')]('[%s][index][attendedtransfer]',_0x58bf48[_0x6529('0x3c')]),_0x58bf48);queues[_0x6529('0x3b')](_0x58bf48);transfers['attendedtransfer'](_0x58bf48);agents[_0x6529('0x3b')](_0x58bf48);calls['attendedtransfer'](_0x58bf48);}catch(_0x419f71){utils[_0x6529('0x19')](util[_0x6529('0x1f')](_0x6529('0x3d'),_0x58bf48['origtransfereruniqueid']),_0x419f71);}});ami['on'](_0x6529('0x3e'),function(_0xdbfcab){try{utils[_0x6529('0x1d')](util['format'](_0x6529('0x3f'),_0xdbfcab[_0x6529('0x22')]),_0xdbfcab);queues[_0x6529('0x3e')](_0xdbfcab);recordings['varset'](_0xdbfcab);calls[_0x6529('0x3e')](_0xdbfcab);dials[_0x6529('0x3e')](_0xdbfcab);}catch(_0x2101c1){utils[_0x6529('0x19')](util[_0x6529('0x1f')](_0x6529('0x3f'),_0xdbfcab[_0x6529('0x22')]),_0x2101c1);}});ami['on'](_0x6529('0x40'),function(_0x35f9c1){try{utils[_0x6529('0x1d')](util['format'](_0x6529('0x41'),_0x35f9c1['uniqueid']),_0x35f9c1);calls[_0x6529('0x40')](_0x35f9c1);recordings['newexten'](_0x35f9c1);dials[_0x6529('0x40')](_0x35f9c1);}catch(_0x5ada40){utils['error'](util[_0x6529('0x1f')](_0x6529('0x41'),_0x35f9c1[_0x6529('0x22')]),_0x5ada40);}});ami['on']('newchannel',function(_0x405633){try{utils[_0x6529('0x1d')](util[_0x6529('0x1f')](_0x6529('0x42'),_0x405633[_0x6529('0x22')]),_0x405633);calls[_0x6529('0x43')](_0x405633);recordings[_0x6529('0x43')](_0x405633);}catch(_0x4b96af){utils[_0x6529('0x19')](util[_0x6529('0x1f')]('[%s][index][newchannel]',_0x405633[_0x6529('0x22')]),_0x4b96af);}});ami['on'](_0x6529('0x44'),function(_0x1ed84e){try{utils[_0x6529('0x1d')](util['format'](_0x6529('0x45'),_0x1ed84e[_0x6529('0x22')]),_0x1ed84e);dials[_0x6529('0x44')](_0x1ed84e);}catch(_0x57d5cf){utils[_0x6529('0x19')](util['format']('[%s]dialbegin',_0x1ed84e['uniqueid']),_0x57d5cf);}});ami['on'](_0x6529('0x46'),function(_0x36f563){try{utils[_0x6529('0x1d')](util[_0x6529('0x1f')](_0x6529('0x47'),_0x36f563[_0x6529('0x22')]),_0x36f563);dials[_0x6529('0x46')](_0x36f563);}catch(_0x3f823b){utils[_0x6529('0x19')](util[_0x6529('0x1f')](_0x6529('0x47'),_0x36f563[_0x6529('0x22')]),_0x3f823b);}});} \ No newline at end of file +var _0x90ee=['./core.controller','connect','shutdown','fullybooted','error','close','managerevent','devicestatechange','debug','format','[%s][index][devicestatechange]','device','agentcalled','uniqueid','agentringnoanswer','[%s][index][agentringnoanswer]','agentconnect','[%s][index][agentconnect]','[%s][index][agentcomplete]','agentcomplete','queuecallerabandon','[%s][index][queuecallerabandon]','queuecallerjoin','[%s][index][queuecallerjoin]','queuecallerleave','[%s][index][queuecallerleave]','musiconholdstart','[%s][index][musiconholdstart]','musiconholdstop','[%s][index][musiconholdstop]','[%s][index][newstate]','newstate','[%s][index][hangup]','hangup','cdr','[%s][index][cdr]','blindtransfer','[%s][index][blindtransfer]','attendedtransfer','origtransfereruniqueid','[%s][index][attendedtransfer]','varset','[%s][index][varset]','newexten','[%s][index][newexten]','newchannel','[%s][index][newchannel]','[%s][index][dialbegin]','dialbegin','[%s]dialbegin','dialend','[%s][index][dialend]','asterisk-manager','./utils','xdr','disabled','env','production','local','asterisk','port','password','keepConnected','XDR\x20DISABLED','./agents.controller','./members.controller'];(function(_0x42cbb6,_0x16680a){var _0x516d69=function(_0x3c58ec){while(--_0x3c58ec){_0x42cbb6['push'](_0x42cbb6['shift']());}};_0x516d69(++_0x16680a);}(_0x90ee,0xb8));var _0xe90e=function(_0x3d7022,_0x59dfd5){_0x3d7022=_0x3d7022-0x0;var _0x40870b=_0x90ee[_0x3d7022];return _0x40870b;};var AsteriskManager=require(_0xe90e('0x0'));var config=require('../../config/environment');var utils=require(_0xe90e('0x1'));var util=require('util');var isXDREnabled=config[_0xe90e('0x2')]&&config[_0xe90e('0x2')][_0xe90e('0x3')]?!config[_0xe90e('0x2')]['disabled']:!![];var isProduction=config[_0xe90e('0x4')]===_0xe90e('0x5')||![];var isLocalAsterisk=config[_0xe90e('0x2')]&&config[_0xe90e('0x2')][_0xe90e('0x6')]===!![]||![];var ami=new AsteriskManager(config[_0xe90e('0x7')][_0xe90e('0x8')],config[_0xe90e('0x7')]['ip'],config[_0xe90e('0x7')]['username'],config['asterisk'][_0xe90e('0x9')],!![]);ami[_0xe90e('0xa')]();if(!isXDREnabled){utils['info'](_0xe90e('0xb'));}else if(!isProduction&&!isLocalAsterisk){utils['info']('Asterisk\x20disabled\x20on\x20localhost');}else{var agents=require(_0xe90e('0xc'));var calls=require('./calls.controller');var queues=require('./queues.controller');var recordings=require('./recordings.controller');var members=require(_0xe90e('0xd'));var dials=require('./dials.controller');var transfers=require('./transfers.controller');var core=require(_0xe90e('0xe'));ami['on'](_0xe90e('0xf'),core[_0xe90e('0xf')]);ami['on'](_0xe90e('0x10'),core['shutdown']);ami['on'](_0xe90e('0x11'),core[_0xe90e('0x11')]);ami['on'](_0xe90e('0x12'),core[_0xe90e('0x12')]);ami['on'](_0xe90e('0x13'),core[_0xe90e('0x13')]);ami['on'](_0xe90e('0x14'),core[_0xe90e('0x14')]);ami['on'](_0xe90e('0x15'),function(_0x156a96){try{utils[_0xe90e('0x16')](util[_0xe90e('0x17')](_0xe90e('0x18'),_0x156a96[_0xe90e('0x19')]),_0x156a96);members[_0xe90e('0x15')](_0x156a96);}catch(_0x38714f){utils['error'](util[_0xe90e('0x17')](_0xe90e('0x18'),_0x156a96[_0xe90e('0x19')]),_0x38714f);}});ami['on'](_0xe90e('0x1a'),function(_0x41a9dc){try{utils[_0xe90e('0x16')](util[_0xe90e('0x17')]('[%s][index][agentcalled]',_0x41a9dc[_0xe90e('0x1b')]),_0x41a9dc);agents['agentcalled'](_0x41a9dc);}catch(_0x1d911b){utils[_0xe90e('0x12')](util[_0xe90e('0x17')]('[%s][index][agentcalled]',_0x41a9dc[_0xe90e('0x1b')]),_0x1d911b);}});ami['on'](_0xe90e('0x1c'),function(_0x55f2dd){try{utils[_0xe90e('0x16')](util['format'](_0xe90e('0x1d'),_0x55f2dd['uniqueid']),_0x55f2dd);agents[_0xe90e('0x1c')](_0x55f2dd);}catch(_0x1268ec){utils[_0xe90e('0x12')](util[_0xe90e('0x17')](_0xe90e('0x1d'),_0x55f2dd[_0xe90e('0x1b')]),_0x1268ec);}});ami['on'](_0xe90e('0x1e'),function(_0x48983c){try{utils[_0xe90e('0x16')](util[_0xe90e('0x17')](_0xe90e('0x1f'),_0x48983c[_0xe90e('0x1b')]),_0x48983c);agents['agentconnect'](_0x48983c);queues[_0xe90e('0x1e')](_0x48983c);}catch(_0x4afa77){utils[_0xe90e('0x12')](util[_0xe90e('0x17')](_0xe90e('0x1f'),_0x48983c[_0xe90e('0x1b')]),_0x4afa77);}});ami['on']('agentcomplete',function(_0x2f32c5){try{utils[_0xe90e('0x16')](util[_0xe90e('0x17')](_0xe90e('0x20'),_0x2f32c5[_0xe90e('0x1b')]),_0x2f32c5);agents[_0xe90e('0x21')](_0x2f32c5);queues[_0xe90e('0x21')](_0x2f32c5);members[_0xe90e('0x21')](_0x2f32c5);}catch(_0x1b616d){utils['error'](util[_0xe90e('0x17')](_0xe90e('0x20'),_0x2f32c5['uniqueid']),_0x1b616d);}});ami['on'](_0xe90e('0x22'),function(_0x42530b){try{utils[_0xe90e('0x16')](util['format'](_0xe90e('0x23'),_0x42530b[_0xe90e('0x1b')]),_0x42530b);agents[_0xe90e('0x22')](_0x42530b);queues[_0xe90e('0x22')](_0x42530b);}catch(_0x5031c4){utils[_0xe90e('0x12')](util[_0xe90e('0x17')]('[%s][index][queuecallerabandon]',_0x42530b['uniqueid']),_0x5031c4);}});ami['on'](_0xe90e('0x24'),function(_0x4a0290){try{utils[_0xe90e('0x16')](util[_0xe90e('0x17')]('[%s][index][queuecallerjoin]',_0x4a0290['uniqueid']),_0x4a0290);queues[_0xe90e('0x24')](_0x4a0290);recordings[_0xe90e('0x24')](_0x4a0290);}catch(_0x5edaea){utils['error'](util[_0xe90e('0x17')](_0xe90e('0x25'),_0x4a0290[_0xe90e('0x1b')]),_0x5edaea);}});ami['on'](_0xe90e('0x26'),function(_0x225f8e){try{utils['debug'](util[_0xe90e('0x17')]('[%s][index][queuecallerleave]',_0x225f8e[_0xe90e('0x1b')]),_0x225f8e);queues[_0xe90e('0x26')](_0x225f8e);}catch(_0x432bfb){utils[_0xe90e('0x12')](util[_0xe90e('0x17')](_0xe90e('0x27'),_0x225f8e['uniqueid']),_0x432bfb);}});ami['on'](_0xe90e('0x28'),function(_0x555f81){try{utils[_0xe90e('0x16')](util[_0xe90e('0x17')]('[%s][index][musiconholdstart]',_0x555f81[_0xe90e('0x1b')]),_0x555f81);queues[_0xe90e('0x28')](_0x555f81);calls[_0xe90e('0x28')](_0x555f81);}catch(_0x15e9a6){utils[_0xe90e('0x12')](util[_0xe90e('0x17')](_0xe90e('0x29'),_0x555f81[_0xe90e('0x1b')]),_0x15e9a6);}});ami['on'](_0xe90e('0x2a'),function(_0x34914f){try{utils[_0xe90e('0x16')](util['format'](_0xe90e('0x2b'),_0x34914f[_0xe90e('0x1b')]),_0x34914f);queues[_0xe90e('0x2a')](_0x34914f);calls[_0xe90e('0x2a')](_0x34914f);}catch(_0x2c2479){utils[_0xe90e('0x12')](util['format'](_0xe90e('0x2b'),_0x34914f[_0xe90e('0x1b')]),_0x2c2479);}});ami['on']('newstate',function(_0xc390e3){try{utils[_0xe90e('0x16')](util[_0xe90e('0x17')](_0xe90e('0x2c'),_0xc390e3[_0xe90e('0x1b')]),_0xc390e3);calls[_0xe90e('0x2d')](_0xc390e3);recordings[_0xe90e('0x2d')](_0xc390e3);}catch(_0x333778){utils[_0xe90e('0x12')](util[_0xe90e('0x17')](_0xe90e('0x2c'),_0xc390e3[_0xe90e('0x1b')]),_0x333778);}});ami['on']('hangup',function(_0x2585a5){try{utils['debug'](util[_0xe90e('0x17')](_0xe90e('0x2e'),_0x2585a5['uniqueid']),_0x2585a5);calls[_0xe90e('0x2f')](_0x2585a5);recordings[_0xe90e('0x2f')](_0x2585a5);dials[_0xe90e('0x2f')](_0x2585a5);agents['hangup'](_0x2585a5);queues[_0xe90e('0x2f')](_0x2585a5);}catch(_0x1eef24){utils[_0xe90e('0x12')](util[_0xe90e('0x17')]('[%s][index][hangup]',_0x2585a5[_0xe90e('0x1b')]),_0x1eef24);}});ami['on'](_0xe90e('0x30'),function(_0x24681f){try{utils['debug'](util[_0xe90e('0x17')](_0xe90e('0x31'),_0x24681f['uniqueid']),_0x24681f);members[_0xe90e('0x30')](_0x24681f);}catch(_0x226c28){utils[_0xe90e('0x12')](util[_0xe90e('0x17')](_0xe90e('0x31'),_0x24681f[_0xe90e('0x1b')]),_0x226c28);}});ami['on'](_0xe90e('0x32'),function(_0x1ec293){try{utils[_0xe90e('0x16')](util['format'](_0xe90e('0x33'),_0x1ec293[_0xe90e('0x1b')]),_0x1ec293);queues['blindtransfer'](_0x1ec293);agents[_0xe90e('0x32')](_0x1ec293);transfers[_0xe90e('0x32')](_0x1ec293);}catch(_0x987315){utils[_0xe90e('0x12')](util[_0xe90e('0x17')](_0xe90e('0x33'),_0x1ec293[_0xe90e('0x1b')]),_0x987315);}});ami['on'](_0xe90e('0x34'),function(_0x40adea){try{utils[_0xe90e('0x16')](util[_0xe90e('0x17')]('[%s][index][attendedtransfer]',_0x40adea[_0xe90e('0x35')]),_0x40adea);queues[_0xe90e('0x34')](_0x40adea);transfers[_0xe90e('0x34')](_0x40adea);agents[_0xe90e('0x34')](_0x40adea);calls[_0xe90e('0x34')](_0x40adea);}catch(_0x5597cd){utils[_0xe90e('0x12')](util[_0xe90e('0x17')](_0xe90e('0x36'),_0x40adea[_0xe90e('0x35')]),_0x5597cd);}});ami['on'](_0xe90e('0x37'),function(_0x529a68){try{utils[_0xe90e('0x16')](util['format'](_0xe90e('0x38'),_0x529a68[_0xe90e('0x1b')]),_0x529a68);queues['varset'](_0x529a68);recordings[_0xe90e('0x37')](_0x529a68);calls[_0xe90e('0x37')](_0x529a68);dials[_0xe90e('0x37')](_0x529a68);}catch(_0x173ad4){utils[_0xe90e('0x12')](util[_0xe90e('0x17')](_0xe90e('0x38'),_0x529a68['uniqueid']),_0x173ad4);}});ami['on'](_0xe90e('0x39'),function(_0x3b6e79){try{utils[_0xe90e('0x16')](util[_0xe90e('0x17')](_0xe90e('0x3a'),_0x3b6e79[_0xe90e('0x1b')]),_0x3b6e79);calls['newexten'](_0x3b6e79);recordings['newexten'](_0x3b6e79);dials[_0xe90e('0x39')](_0x3b6e79);}catch(_0x3b328c){utils[_0xe90e('0x12')](util[_0xe90e('0x17')](_0xe90e('0x3a'),_0x3b6e79['uniqueid']),_0x3b328c);}});ami['on']('newchannel',function(_0x25bf50){try{utils['debug'](util[_0xe90e('0x17')]('[%s][index][newchannel]',_0x25bf50['uniqueid']),_0x25bf50);calls[_0xe90e('0x3b')](_0x25bf50);recordings[_0xe90e('0x3b')](_0x25bf50);}catch(_0x48d804){utils[_0xe90e('0x12')](util[_0xe90e('0x17')](_0xe90e('0x3c'),_0x25bf50[_0xe90e('0x1b')]),_0x48d804);}});ami['on']('dialbegin',function(_0x439e77){try{utils[_0xe90e('0x16')](util[_0xe90e('0x17')](_0xe90e('0x3d'),_0x439e77[_0xe90e('0x1b')]),_0x439e77);dials[_0xe90e('0x3e')](_0x439e77);}catch(_0x58cd70){utils[_0xe90e('0x12')](util['format'](_0xe90e('0x3f'),_0x439e77[_0xe90e('0x1b')]),_0x58cd70);}});ami['on'](_0xe90e('0x40'),function(_0x59f9bd){try{utils[_0xe90e('0x16')](util['format'](_0xe90e('0x41'),_0x59f9bd['uniqueid']),_0x59f9bd);dials['dialend'](_0x59f9bd);}catch(_0x1f853e){utils[_0xe90e('0x12')](util['format'](_0xe90e('0x41'),_0x59f9bd[_0xe90e('0x1b')]),_0x1f853e);}});} \ No newline at end of file diff --git a/server/services/xdr/members.controller.js b/server/services/xdr/members.controller.js index a373ff9..5d3ac22 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 _0x4eaf=['CreateMemberReport','getUserByName','split','name','request','error','[%s][members][writeDB]','some','startsWith','debug','device','state','BUSY','voice','TALKING','NOT_INUSE','isNil','exitAt','now','duration','enterAt','[%s][members][devicestatechange]','[%s][members][agentcomplete]','queue','assign','cdr','[%s][members][cdr]','type','data3','destination','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','data1','data2','destinationchannel','lodash','./utils','Local/_attended@transfer','Queue:','info','format','[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s','uniqueid','interface','channel','getUserByInterface','then','membername','internal'];(function(_0x686cd1,_0x252bf2){var _0x11eaa3=function(_0x1e67a8){while(--_0x1e67a8){_0x686cd1['push'](_0x686cd1['shift']());}};_0x11eaa3(++_0x252bf2);}(_0x4eaf,0x112));var _0xf4ea=function(_0x1f988a,_0x101b33){_0x1f988a=_0x1f988a-0x0;var _0x3cdfe7=_0x4eaf[_0x1f988a];return _0x3cdfe7;};'use strict';var _=require(_0xf4ea('0x0'));var util=require('util');var utils=require(_0xf4ea('0x1'));var members={};var exclude=[_0xf4ea('0x2'),_0xf4ea('0x3')];function writeDB(_0x57fb45){utils[_0xf4ea('0x4')](util[_0xf4ea('0x5')](_0xf4ea('0x6'),_0x57fb45[_0xf4ea('0x7')],_0x57fb45[_0xf4ea('0x8')],_0x57fb45[_0xf4ea('0x9')],_0x57fb45['data2'],_0x57fb45['membername'],_0x57fb45['type']));if(_0x57fb45[_0xf4ea('0x8')]){utils[_0xf4ea('0xa')](_0x57fb45['interface'])[_0xf4ea('0xb')](function(_0x4ad8e8){if(_0x4ad8e8){_0x57fb45[_0xf4ea('0xc')]=_0x4ad8e8['name'];_0x57fb45[_0xf4ea('0xd')]=_0x4ad8e8[_0xf4ea('0xd')];utils['request'](_0xf4ea('0xe'),_0x57fb45);}else{utils[_0xf4ea('0xf')](_0x57fb45[_0xf4ea('0x8')][_0xf4ea('0x10')]('/')[0x1])[_0xf4ea('0xb')](function(_0x1ff0dd){if(_0x1ff0dd){_0x57fb45[_0xf4ea('0xc')]=_0x1ff0dd[_0xf4ea('0x11')];_0x57fb45[_0xf4ea('0xd')]=_0x1ff0dd[_0xf4ea('0xd')];utils[_0xf4ea('0x12')](_0xf4ea('0xe'),_0x57fb45);}});}})['catch'](function(_0x5b718b){utils[_0xf4ea('0x13')](util[_0xf4ea('0x5')](_0xf4ea('0x14'),_0x57fb45[_0xf4ea('0x7')]),_0x5b718b);});}delete members[_0x57fb45[_0xf4ea('0x8')]];}function startsWith(_0x4bb768,_0x3a5bae){return _[_0xf4ea('0x15')](_0x4bb768,function(_0x400adf){return _[_0xf4ea('0x16')](_0x3a5bae,_0x400adf);});}exports['devicestatechange']=function(_0x4cf764){try{utils[_0xf4ea('0x17')](util[_0xf4ea('0x5')]('[%s][members][devicestatechange]',members[_0x4cf764['device']]?members[_0x4cf764[_0xf4ea('0x18')]]['uniqueid']:_0x4cf764[_0xf4ea('0x18')]),_0x4cf764);utils[_0xf4ea('0x4')](util['format']('[%s][members][devicestatechange]\x20state:%s\x20interface:%s',members[_0x4cf764[_0xf4ea('0x18')]]?members[_0x4cf764[_0xf4ea('0x18')]][_0xf4ea('0x7')]:_0x4cf764['device'],_0x4cf764['state'],_0x4cf764['device']));switch(_0x4cf764[_0xf4ea('0x19')]){case'INUSE':case _0xf4ea('0x1a'):if(!startsWith(exclude,_0x4cf764['device'])){members[_0x4cf764[_0xf4ea('0x18')]]={'channel':_0xf4ea('0x1b'),'interface':_0x4cf764['device'],'type':_0xf4ea('0x1c'),'enterAt':utils['now'](),'role':'agent'};}break;case _0xf4ea('0x1d'):if(!_[_0xf4ea('0x1e')](members[_0x4cf764[_0xf4ea('0x18')]])){members[_0x4cf764[_0xf4ea('0x18')]][_0xf4ea('0x1f')]=utils[_0xf4ea('0x20')]();members[_0x4cf764['device']][_0xf4ea('0x21')]=utils['diffTime'](members[_0x4cf764[_0xf4ea('0x18')]][_0xf4ea('0x1f')],members[_0x4cf764[_0xf4ea('0x18')]][_0xf4ea('0x22')]);if(members[_0x4cf764[_0xf4ea('0x18')]][_0xf4ea('0x7')]){writeDB(members[_0x4cf764[_0xf4ea('0x18')]]);}}break;default:break;}}catch(_0x4ad299){utils['error'](util[_0xf4ea('0x5')](_0xf4ea('0x23'),members[_0x4cf764[_0xf4ea('0x18')]]?members[_0x4cf764[_0xf4ea('0x18')]]['uniqueid']:_0x4cf764[_0xf4ea('0x18')]),_0x4ad299);}};exports['agentcomplete']=function(_0x3f7307){try{if(!_['isNil'](members[_0x3f7307[_0xf4ea('0x8')]])){utils[_0xf4ea('0x17')](util[_0xf4ea('0x5')](_0xf4ea('0x24'),_0x3f7307[_0xf4ea('0x7')]),_0x3f7307);utils['info'](util[_0xf4ea('0x5')]('[%s][members][agentcomplete]\x20interface:%s\x20queue:%s',_0x3f7307[_0xf4ea('0x7')],_0x3f7307[_0xf4ea('0x8')],_0x3f7307[_0xf4ea('0x25')]));members[_0x3f7307[_0xf4ea('0x8')]]=_[_0xf4ea('0x26')](members[_0x3f7307[_0xf4ea('0x8')]],{'data4':_0x3f7307[_0xf4ea('0x25')],'uniqueid':_0x3f7307[_0xf4ea('0x7')]});}}catch(_0xe62dc1){utils[_0xf4ea('0x13')](util['format']('[%s][members][agentcomplete]',_0x3f7307[_0xf4ea('0x7')]),_0xe62dc1);}};exports[_0xf4ea('0x27')]=function(_0x7c5976){try{utils[_0xf4ea('0x17')](util[_0xf4ea('0x5')](_0xf4ea('0x28'),_0x7c5976[_0xf4ea('0x7')]),_0x7c5976);if(_0x7c5976[_0xf4ea('0x9')]){var _0xbf8183=_0x7c5976[_0xf4ea('0x9')][_0xf4ea('0x10')]('-')[0x0];if(!_['isNil'](members[_0xbf8183])){members[_0xbf8183]=_[_0xf4ea('0x26')](members[_0xbf8183],{'data1':members[_0xbf8183]['data1']||_0x7c5976[_0xf4ea('0x29')],'data2':members[_0xbf8183]['data2']||_0x7c5976['source'],'data3':members[_0xbf8183][_0xf4ea('0x2a')]||_0x7c5976[_0xf4ea('0x2b')],'uniqueid':members[_0xbf8183][_0xf4ea('0x7')]||_0x7c5976['uniqueid']});utils[_0xf4ea('0x4')](util[_0xf4ea('0x5')](_0xf4ea('0x2c'),_0x7c5976[_0xf4ea('0x7')],members[_0xbf8183][_0xf4ea('0x2d')],members[_0xbf8183][_0xf4ea('0x2e')],members[_0xbf8183][_0xf4ea('0x2a')]));if(members[_0xbf8183][_0xf4ea('0x1f')]){writeDB(members[_0xbf8183]);}}}if(_0x7c5976[_0xf4ea('0x2f')]){var _0x2ee057=_0x7c5976[_0xf4ea('0x2f')][_0xf4ea('0x10')]('-')[0x0];if(!_[_0xf4ea('0x1e')](members[_0x2ee057])){members[_0x2ee057]=_[_0xf4ea('0x26')](members[_0x2ee057],{'data1':members[_0x2ee057][_0xf4ea('0x2d')]||_0x7c5976[_0xf4ea('0x29')],'data2':members[_0x2ee057][_0xf4ea('0x2e')]||_0x7c5976['source'],'data3':members[_0x2ee057][_0xf4ea('0x2a')]||_0x7c5976['destination'],'uniqueid':members[_0x2ee057]['uniqueid']||_0x7c5976[_0xf4ea('0x7')]});utils['info'](util[_0xf4ea('0x5')]('[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s',_0x7c5976[_0xf4ea('0x7')],members[_0x2ee057][_0xf4ea('0x2d')],members[_0x2ee057][_0xf4ea('0x2e')],members[_0x2ee057][_0xf4ea('0x2a')]));if(members[_0x2ee057]['exitAt']){writeDB(members[_0x2ee057]);}}}}catch(_0x150820){utils[_0xf4ea('0x13')](util['format'](_0xf4ea('0x28'),_0x7c5976[_0xf4ea('0x7')]),_0x150820);}}; \ No newline at end of file +var _0x0b8f=['state','INUSE','BUSY','voice','TALKING','now','isNil','exitAt','duration','diffTime','enterAt','[%s][members][agentcomplete]','queue','assign','cdr','data1','source','data3','destination','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','destinationchannel','[%s][members][cdr]','lodash','./utils','Local/_attended@transfer','Queue:','info','format','[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s','uniqueid','interface','channel','data2','type','membername','name','internal','request','CreateMemberReport','getUserByName','split','error','[%s][members][writeDB]','some','startsWith','devicestatechange','debug','[%s][members][devicestatechange]','device','[%s][members][devicestatechange]\x20state:%s\x20interface:%s'];(function(_0xcb1a33,_0x5f72f0){var _0x4fe585=function(_0x4bf99f){while(--_0x4bf99f){_0xcb1a33['push'](_0xcb1a33['shift']());}};_0x4fe585(++_0x5f72f0);}(_0x0b8f,0x174));var _0xf0b8=function(_0x5bd120,_0x9bf0c0){_0x5bd120=_0x5bd120-0x0;var _0x4c2b2e=_0x0b8f[_0x5bd120];return _0x4c2b2e;};'use strict';var _=require(_0xf0b8('0x0'));var util=require('util');var utils=require(_0xf0b8('0x1'));var members={};var exclude=[_0xf0b8('0x2'),_0xf0b8('0x3')];function writeDB(_0x1dd890){utils[_0xf0b8('0x4')](util[_0xf0b8('0x5')](_0xf0b8('0x6'),_0x1dd890[_0xf0b8('0x7')],_0x1dd890[_0xf0b8('0x8')],_0x1dd890[_0xf0b8('0x9')],_0x1dd890[_0xf0b8('0xa')],_0x1dd890['membername'],_0x1dd890[_0xf0b8('0xb')]));if(_0x1dd890['interface']){utils['getUserByInterface'](_0x1dd890['interface'])['then'](function(_0x4ac0e9){if(_0x4ac0e9){_0x1dd890[_0xf0b8('0xc')]=_0x4ac0e9[_0xf0b8('0xd')];_0x1dd890[_0xf0b8('0xe')]=_0x4ac0e9['internal'];utils[_0xf0b8('0xf')](_0xf0b8('0x10'),_0x1dd890);}else{utils[_0xf0b8('0x11')](_0x1dd890['interface'][_0xf0b8('0x12')]('/')[0x1])['then'](function(_0x70b20d){if(_0x70b20d){_0x1dd890[_0xf0b8('0xc')]=_0x70b20d[_0xf0b8('0xd')];_0x1dd890[_0xf0b8('0xe')]=_0x70b20d[_0xf0b8('0xe')];utils['request'](_0xf0b8('0x10'),_0x1dd890);}});}})['catch'](function(_0x1a0e2d){utils[_0xf0b8('0x13')](util[_0xf0b8('0x5')](_0xf0b8('0x14'),_0x1dd890['uniqueid']),_0x1a0e2d);});}delete members[_0x1dd890['interface']];}function startsWith(_0x298141,_0x532258){return _[_0xf0b8('0x15')](_0x298141,function(_0x26d0e2){return _[_0xf0b8('0x16')](_0x532258,_0x26d0e2);});}exports[_0xf0b8('0x17')]=function(_0x45176c){try{utils[_0xf0b8('0x18')](util['format'](_0xf0b8('0x19'),members[_0x45176c[_0xf0b8('0x1a')]]?members[_0x45176c[_0xf0b8('0x1a')]][_0xf0b8('0x7')]:_0x45176c['device']),_0x45176c);utils[_0xf0b8('0x4')](util[_0xf0b8('0x5')](_0xf0b8('0x1b'),members[_0x45176c[_0xf0b8('0x1a')]]?members[_0x45176c[_0xf0b8('0x1a')]][_0xf0b8('0x7')]:_0x45176c[_0xf0b8('0x1a')],_0x45176c['state'],_0x45176c['device']));switch(_0x45176c[_0xf0b8('0x1c')]){case _0xf0b8('0x1d'):case _0xf0b8('0x1e'):if(!startsWith(exclude,_0x45176c['device'])){members[_0x45176c[_0xf0b8('0x1a')]]={'channel':_0xf0b8('0x1f'),'interface':_0x45176c[_0xf0b8('0x1a')],'type':_0xf0b8('0x20'),'enterAt':utils[_0xf0b8('0x21')](),'role':'agent'};}break;case'NOT_INUSE':if(!_[_0xf0b8('0x22')](members[_0x45176c[_0xf0b8('0x1a')]])){members[_0x45176c[_0xf0b8('0x1a')]][_0xf0b8('0x23')]=utils['now']();members[_0x45176c[_0xf0b8('0x1a')]][_0xf0b8('0x24')]=utils[_0xf0b8('0x25')](members[_0x45176c[_0xf0b8('0x1a')]][_0xf0b8('0x23')],members[_0x45176c['device']][_0xf0b8('0x26')]);if(members[_0x45176c[_0xf0b8('0x1a')]][_0xf0b8('0x7')]){writeDB(members[_0x45176c['device']]);}}break;default:break;}}catch(_0x13457b){utils['error'](util[_0xf0b8('0x5')](_0xf0b8('0x19'),members[_0x45176c[_0xf0b8('0x1a')]]?members[_0x45176c[_0xf0b8('0x1a')]][_0xf0b8('0x7')]:_0x45176c[_0xf0b8('0x1a')]),_0x13457b);}};exports['agentcomplete']=function(_0x79af9e){try{if(!_[_0xf0b8('0x22')](members[_0x79af9e[_0xf0b8('0x8')]])){utils[_0xf0b8('0x18')](util['format'](_0xf0b8('0x27'),_0x79af9e[_0xf0b8('0x7')]),_0x79af9e);utils[_0xf0b8('0x4')](util['format']('[%s][members][agentcomplete]\x20interface:%s\x20queue:%s',_0x79af9e[_0xf0b8('0x7')],_0x79af9e[_0xf0b8('0x8')],_0x79af9e[_0xf0b8('0x28')]));members[_0x79af9e['interface']]=_[_0xf0b8('0x29')](members[_0x79af9e['interface']],{'data4':_0x79af9e[_0xf0b8('0x28')],'uniqueid':_0x79af9e[_0xf0b8('0x7')]});}}catch(_0x527667){utils[_0xf0b8('0x13')](util['format'](_0xf0b8('0x27'),_0x79af9e[_0xf0b8('0x7')]),_0x527667);}};exports[_0xf0b8('0x2a')]=function(_0x568d30){try{utils[_0xf0b8('0x18')](util[_0xf0b8('0x5')]('[%s][members][cdr]',_0x568d30[_0xf0b8('0x7')]),_0x568d30);if(_0x568d30[_0xf0b8('0x9')]){var _0x396bd6=_0x568d30[_0xf0b8('0x9')][_0xf0b8('0x12')]('-')[0x0];if(!_[_0xf0b8('0x22')](members[_0x396bd6])){members[_0x396bd6]=_[_0xf0b8('0x29')](members[_0x396bd6],{'data1':members[_0x396bd6][_0xf0b8('0x2b')]||_0x568d30[_0xf0b8('0xb')],'data2':members[_0x396bd6]['data2']||_0x568d30[_0xf0b8('0x2c')],'data3':members[_0x396bd6][_0xf0b8('0x2d')]||_0x568d30[_0xf0b8('0x2e')],'uniqueid':members[_0x396bd6][_0xf0b8('0x7')]||_0x568d30[_0xf0b8('0x7')]});utils[_0xf0b8('0x4')](util['format'](_0xf0b8('0x2f'),_0x568d30[_0xf0b8('0x7')],members[_0x396bd6]['data1'],members[_0x396bd6]['data2'],members[_0x396bd6][_0xf0b8('0x2d')]));if(members[_0x396bd6][_0xf0b8('0x23')]){writeDB(members[_0x396bd6]);}}}if(_0x568d30[_0xf0b8('0x30')]){var _0x52d2fb=_0x568d30[_0xf0b8('0x30')][_0xf0b8('0x12')]('-')[0x0];if(!_[_0xf0b8('0x22')](members[_0x52d2fb])){members[_0x52d2fb]=_[_0xf0b8('0x29')](members[_0x52d2fb],{'data1':members[_0x52d2fb][_0xf0b8('0x2b')]||_0x568d30[_0xf0b8('0xb')],'data2':members[_0x52d2fb][_0xf0b8('0xa')]||_0x568d30['source'],'data3':members[_0x52d2fb][_0xf0b8('0x2d')]||_0x568d30[_0xf0b8('0x2e')],'uniqueid':members[_0x52d2fb][_0xf0b8('0x7')]||_0x568d30['uniqueid']});utils[_0xf0b8('0x4')](util[_0xf0b8('0x5')](_0xf0b8('0x2f'),_0x568d30[_0xf0b8('0x7')],members[_0x52d2fb]['data1'],members[_0x52d2fb]['data2'],members[_0x52d2fb][_0xf0b8('0x2d')]));if(members[_0x52d2fb][_0xf0b8('0x23')]){writeDB(members[_0x52d2fb]);}}}}catch(_0x9c9f30){utils[_0xf0b8('0x13')](util['format'](_0xf0b8('0x31'),_0x568d30['uniqueid']),_0x9c9f30);}}; \ No newline at end of file diff --git a/server/services/xdr/queues.controller.js b/server/services/xdr/queues.controller.js index df4feaf..aee3c65 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 _0x6b66=['origtransfereruniqueid','origtransfererlinkedid','secondtransfererlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','origtransfererexten','ATTENDED','ATTENDEDTRANSFER','transfereelinkedid','queuecallerenterreason','clone','calleridname','holdtime','mohtime','[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s','secondtransfereruniqueid','[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','secondtransfererexten','transferuniqueid','transfertargetlinkedid','transfertargetuniqueid','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s','[%s][queues][musiconholdstart]','musiconholdstartAt','musiconholdstop','[%s][queues][musiconholdstop]','lodash','uniqueid','channel','queue','lastAssignedTo','calleridnum','accountcode','queuecallerexitreason','getVoiceQueueByName','then','type','request','CreateVoiceQueueReport','transfereduniqueid','queuecallerjoin','debug','info','format','[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s','position','assign','error','[%s][queues][queuecallerjoin]','hangup','isNil','[%s][queues][hangup]','queuecallerabandon','queuecallercompleteAt','now','COMPLETEDBYAGENT','[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s','name','[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s','varset','[%s][queues][varset]','queuestatus','value','toUpperCase','CONTINUE','queuecallerabandonAt','queuecallerexit','queuecallerexitAt','variable','queueposition','EXITWITHKEY','[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s','[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s','queuecallerleave','[%s][queues][queuecallerleave]','connectedlinenum','connectedlinename','queuecallerleaveAt','diffTime','queuecallerjoinAt','count','agentconnect','[%s][queues][agentconnect]','[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s','membername','assigned','agentcomplete','[%s][queues][agentcomplete]','queuecallercomplete','transfer','TRANSFER','COMPLETEDBY','blindtransfer','transfereeuniqueid','[%s][queues][blindtransfer]','transfertype','BLIND','transferexten','extension','BLINDTRANSFER','attendedtransfer','[%s][queues][attendedtransfer]'];(function(_0x3747ae,_0x408e61){var _0x339035=function(_0x83be87){while(--_0x83be87){_0x3747ae['push'](_0x3747ae['shift']());}};_0x339035(++_0x408e61);}(_0x6b66,0x80));var _0x66b6=function(_0x1541ac,_0x180340){_0x1541ac=_0x1541ac-0x0;var _0x52fe13=_0x6b66[_0x1541ac];return _0x52fe13;};'use strict';var _=require(_0x66b6('0x0'));var util=require('util');var utils=require('./utils');var queues={};function writeDB(_0x22cc3d){utils['info'](util['format']('[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s',_0x22cc3d[_0x66b6('0x1')],_0x22cc3d[_0x66b6('0x2')],_0x22cc3d[_0x66b6('0x3')],_0x22cc3d[_0x66b6('0x4')],_0x22cc3d[_0x66b6('0x5')],_0x22cc3d[_0x66b6('0x6')],_0x22cc3d[_0x66b6('0x7')]));if(_0x22cc3d[_0x66b6('0x3')]){utils[_0x66b6('0x8')](_0x22cc3d[_0x66b6('0x3')])[_0x66b6('0x9')](function(_0x1d6d90){if(_0x1d6d90){_0x22cc3d[_0x66b6('0xa')]=_0x1d6d90[_0x66b6('0xa')];}utils[_0x66b6('0xb')]('CreateVoiceQueueReport',_0x22cc3d);});}else{utils[_0x66b6('0xb')](_0x66b6('0xc'),_0x22cc3d);}if(_0x22cc3d['transfereduniqueid']){delete queues[_0x22cc3d[_0x66b6('0xd')]];}else{delete queues[_0x22cc3d['uniqueid']];}}exports[_0x66b6('0xe')]=function(_0x193b67){try{utils[_0x66b6('0xf')](util['format']('[%s][queues][queuecallerjoin]',_0x193b67[_0x66b6('0x1')]),_0x193b67);utils[_0x66b6('0x10')](util[_0x66b6('0x11')](_0x66b6('0x12'),_0x193b67['uniqueid'],_0x193b67[_0x66b6('0x3')],_0x193b67[_0x66b6('0x13')]));queues[_0x193b67['uniqueid']]=_[_0x66b6('0x14')](_0x193b67,{'originalposition':_0x193b67[_0x66b6('0x13')],'queuecallerjoinAt':utils['now'](),'mohtime':0x0});}catch(_0x3eda8f){utils[_0x66b6('0x15')](util[_0x66b6('0x11')](_0x66b6('0x16'),_0x193b67[_0x66b6('0x1')]),_0x3eda8f);}};exports[_0x66b6('0x17')]=function(_0xec7392){try{if(!_[_0x66b6('0x18')](queues[_0xec7392[_0x66b6('0x1')]])){utils[_0x66b6('0xf')](util['format'](_0x66b6('0x19'),_0xec7392[_0x66b6('0x1')]),_0xec7392);if(queues[_0xec7392[_0x66b6('0x1')]]['queuecallerleaveAt']){if(!queues[_0xec7392[_0x66b6('0x1')]][_0x66b6('0x1a')]&&!queues[_0xec7392['uniqueid']]['queuecallerexit']){queues[_0xec7392['uniqueid']]['queuecallercomplete']=!![];queues[_0xec7392[_0x66b6('0x1')]][_0x66b6('0x1b')]=utils[_0x66b6('0x1c')]();queues[_0xec7392[_0x66b6('0x1')]][_0x66b6('0x7')]=_0x66b6('0x1d');}utils['info'](util[_0x66b6('0x11')](_0x66b6('0x1e'),_0xec7392[_0x66b6('0x1')],queues[_0xec7392[_0x66b6('0x1')]][_0x66b6('0x1f')],queues[_0xec7392[_0x66b6('0x1')]][_0x66b6('0x7')]));writeDB(queues[_0xec7392[_0x66b6('0x1')]]);}else if(queues[_0xec7392[_0x66b6('0x1')]][_0x66b6('0xd')]){utils['info'](util[_0x66b6('0x11')](_0x66b6('0x20'),_0xec7392['uniqueid'],queues[_0xec7392[_0x66b6('0x1')]][_0x66b6('0x1f')],queues[_0xec7392['uniqueid']][_0x66b6('0xd')]));queues[queues[_0xec7392[_0x66b6('0x1')]][_0x66b6('0xd')]]=queues[_0xec7392[_0x66b6('0x1')]];queues[queues[_0xec7392[_0x66b6('0x1')]][_0x66b6('0xd')]]['queuecallerenterreason']=0x2;delete queues[_0xec7392[_0x66b6('0x1')]];}}}catch(_0x4f4a96){utils[_0x66b6('0x15')](util[_0x66b6('0x11')](_0x66b6('0x19'),_0xec7392[_0x66b6('0x1')]),_0x4f4a96);}};exports[_0x66b6('0x21')]=function(_0x5217a5){try{utils[_0x66b6('0xf')](util[_0x66b6('0x11')](_0x66b6('0x22'),_0x5217a5['uniqueid']),_0x5217a5);if(!_['isNil'](_0x5217a5['variable'][_0x66b6('0x23')])&&_0x5217a5[_0x66b6('0x24')][_0x66b6('0x25')]()!==_0x66b6('0x26')){if(!_[_0x66b6('0x18')](queues[_0x5217a5['uniqueid']])){queues[_0x5217a5['uniqueid']][_0x66b6('0x1a')]=![];queues[_0x5217a5[_0x66b6('0x1')]][_0x66b6('0x27')]=null;queues[_0x5217a5[_0x66b6('0x1')]][_0x66b6('0x28')]=!![];queues[_0x5217a5[_0x66b6('0x1')]][_0x66b6('0x29')]=utils[_0x66b6('0x1c')]();queues[_0x5217a5[_0x66b6('0x1')]][_0x66b6('0x7')]=_0x5217a5[_0x66b6('0x24')][_0x66b6('0x25')]();utils[_0x66b6('0x10')](util[_0x66b6('0x11')]('[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s',_0x5217a5['uniqueid'],queues[_0x5217a5['uniqueid']]['name'],_0x5217a5[_0x66b6('0x24')],queues[_0x5217a5[_0x66b6('0x1')]][_0x66b6('0x7')]));writeDB(queues[_0x5217a5[_0x66b6('0x1')]]);}}else if(!_['isNil'](_0x5217a5[_0x66b6('0x2a')][_0x66b6('0x2b')])){if(!_[_0x66b6('0x18')](queues[_0x5217a5[_0x66b6('0x1')]])&&!queues[_0x5217a5[_0x66b6('0x1')]][_0x66b6('0x1a')]){queues[_0x5217a5[_0x66b6('0x1')]]['queuecallerabandon']=![];queues[_0x5217a5[_0x66b6('0x1')]][_0x66b6('0x27')]=null;queues[_0x5217a5[_0x66b6('0x1')]][_0x66b6('0x28')]=!![];queues[_0x5217a5[_0x66b6('0x1')]][_0x66b6('0x29')]=utils[_0x66b6('0x1c')]();queues[_0x5217a5['uniqueid']][_0x66b6('0x7')]=_0x66b6('0x2c');utils[_0x66b6('0x10')](util[_0x66b6('0x11')](_0x66b6('0x2d'),_0x5217a5[_0x66b6('0x1')],queues[_0x5217a5[_0x66b6('0x1')]][_0x66b6('0x1f')],_0x5217a5[_0x66b6('0x24')],queues[_0x5217a5[_0x66b6('0x1')]][_0x66b6('0x7')]));}}}catch(_0x4fe325){utils[_0x66b6('0x15')](util[_0x66b6('0x11')](_0x66b6('0x22'),_0x5217a5[_0x66b6('0x1')]),_0x4fe325);}};exports[_0x66b6('0x1a')]=function(_0x5835aa){try{if(!_[_0x66b6('0x18')](queues[_0x5835aa['uniqueid']])){utils['debug'](util[_0x66b6('0x11')]('[%s][queues][queuecallerabandon]',_0x5835aa[_0x66b6('0x1')]),_0x5835aa);queues[_0x5835aa[_0x66b6('0x1')]][_0x66b6('0x28')]=![];queues[_0x5835aa[_0x66b6('0x1')]][_0x66b6('0x29')]=null;queues[_0x5835aa[_0x66b6('0x1')]][_0x66b6('0x1a')]=!![];queues[_0x5835aa[_0x66b6('0x1')]][_0x66b6('0x27')]=utils[_0x66b6('0x1c')]();queues[_0x5835aa[_0x66b6('0x1')]][_0x66b6('0x7')]='ABANDONED';utils[_0x66b6('0x10')](util['format'](_0x66b6('0x2e'),_0x5835aa['uniqueid'],queues[_0x5835aa[_0x66b6('0x1')]][_0x66b6('0x1f')],queues[_0x5835aa[_0x66b6('0x1')]][_0x66b6('0x7')]));}}catch(_0x1ac3d7){utils[_0x66b6('0x15')](util[_0x66b6('0x11')]('[%s][queues][queuecallerabandon]',_0x5835aa[_0x66b6('0x1')]),_0x1ac3d7);}};exports[_0x66b6('0x2f')]=function(_0x57b081){try{if(!_[_0x66b6('0x18')](queues[_0x57b081[_0x66b6('0x1')]])){utils[_0x66b6('0xf')](util['format'](_0x66b6('0x30'),_0x57b081[_0x66b6('0x1')]),_0x57b081);utils[_0x66b6('0x10')](util['format']('[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s',_0x57b081[_0x66b6('0x1')],queues[_0x57b081[_0x66b6('0x1')]][_0x66b6('0x1f')],_0x57b081[_0x66b6('0x31')],_0x57b081[_0x66b6('0x32')]));queues[_0x57b081[_0x66b6('0x1')]][_0x66b6('0x2f')]=!![];queues[_0x57b081[_0x66b6('0x1')]][_0x66b6('0x33')]=utils[_0x66b6('0x1c')]();queues[_0x57b081[_0x66b6('0x1')]]['holdtime']=utils[_0x66b6('0x34')](queues[_0x57b081[_0x66b6('0x1')]][_0x66b6('0x33')],queues[_0x57b081[_0x66b6('0x1')]][_0x66b6('0x35')]);queues[_0x57b081[_0x66b6('0x1')]][_0x66b6('0x13')]=_0x57b081[_0x66b6('0x13')];queues[_0x57b081[_0x66b6('0x1')]]['count']=_0x57b081[_0x66b6('0x36')];queues[_0x57b081[_0x66b6('0x1')]][_0x66b6('0x31')]=_0x57b081[_0x66b6('0x31')];queues[_0x57b081[_0x66b6('0x1')]][_0x66b6('0x32')]=_0x57b081[_0x66b6('0x32')];}}catch(_0x1030e8){utils['error'](util['format']('[%s][queues][queuecallerleave]',_0x57b081[_0x66b6('0x1')]),_0x1030e8);}};exports[_0x66b6('0x37')]=function(_0x36d440){try{if(!_[_0x66b6('0x18')](queues[_0x36d440[_0x66b6('0x1')]])){utils[_0x66b6('0xf')](util[_0x66b6('0x11')](_0x66b6('0x38'),_0x36d440[_0x66b6('0x1')]),_0x36d440);utils[_0x66b6('0x10')](util[_0x66b6('0x11')](_0x66b6('0x39'),_0x36d440[_0x66b6('0x1')],queues[_0x36d440[_0x66b6('0x1')]][_0x66b6('0x1f')],_0x36d440[_0x66b6('0x3a')],_0x36d440['destaccountcode']));queues[_0x36d440[_0x66b6('0x1')]][_0x66b6('0x1a')]=![];queues[_0x36d440['uniqueid']]['queuecallerabandon']=![];queues[_0x36d440[_0x66b6('0x1')]]['queuecallerabandonAt']=null;queues[_0x36d440[_0x66b6('0x1')]][_0x66b6('0x28')]=![];queues[_0x36d440['uniqueid']][_0x66b6('0x7')]=null;queues[_0x36d440['uniqueid']]['queuecallerexitAt']=null;queues[_0x36d440[_0x66b6('0x1')]][_0x66b6('0x3b')]=!![];queues[_0x36d440[_0x66b6('0x1')]][_0x66b6('0x6')]=_0x36d440['destaccountcode'];queues[_0x36d440[_0x66b6('0x1')]]['lastAssignedTo']=_0x36d440['membername'];}}catch(_0x5afdad){utils[_0x66b6('0x15')](util[_0x66b6('0x11')](_0x66b6('0x38'),_0x36d440[_0x66b6('0x1')]),_0x5afdad);}};exports[_0x66b6('0x3c')]=function(_0x4dfae7){try{if(!_[_0x66b6('0x18')](queues[_0x4dfae7['uniqueid']])){if(queues[_0x4dfae7[_0x66b6('0x1')]][_0x66b6('0x33')]){utils['debug'](util[_0x66b6('0x11')](_0x66b6('0x3d'),_0x4dfae7['uniqueid']),_0x4dfae7);queues[_0x4dfae7['uniqueid']][_0x66b6('0x1a')]=![];queues[_0x4dfae7[_0x66b6('0x1')]][_0x66b6('0x1a')]=![];queues[_0x4dfae7[_0x66b6('0x1')]][_0x66b6('0x27')]=null;queues[_0x4dfae7[_0x66b6('0x1')]][_0x66b6('0x28')]=![];queues[_0x4dfae7[_0x66b6('0x1')]]['queuecallerexitAt']=null;queues[_0x4dfae7['uniqueid']][_0x66b6('0x3b')]=!![];queues[_0x4dfae7[_0x66b6('0x1')]][_0x66b6('0x4')]=_0x4dfae7[_0x66b6('0x3a')];queues[_0x4dfae7[_0x66b6('0x1')]][_0x66b6('0x3e')]=!![];queues[_0x4dfae7['uniqueid']][_0x66b6('0x1b')]=utils[_0x66b6('0x1c')]();if(_0x4dfae7['reason']=='transfer'){if(!queues[_0x4dfae7['uniqueid']][_0x66b6('0x3f')]){queues[_0x4dfae7['uniqueid']]['queuecallerexitreason']=_0x66b6('0x40');}}else{queues[_0x4dfae7['uniqueid']][_0x66b6('0x7')]=_0x66b6('0x41')+_0x4dfae7['reason']['toUpperCase']();}utils['info'](util[_0x66b6('0x11')]('[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s',_0x4dfae7['uniqueid'],queues[_0x4dfae7[_0x66b6('0x1')]][_0x66b6('0x1f')],_0x4dfae7[_0x66b6('0x3a')],queues[_0x4dfae7[_0x66b6('0x1')]][_0x66b6('0x7')]));writeDB(queues[_0x4dfae7[_0x66b6('0x1')]]);}}}catch(_0x53097c){utils[_0x66b6('0x15')](util[_0x66b6('0x11')](_0x66b6('0x3d'),_0x4dfae7[_0x66b6('0x1')]),_0x53097c);}};exports[_0x66b6('0x42')]=function(_0xf77a0b){try{if(!_[_0x66b6('0x18')](queues[_0xf77a0b[_0x66b6('0x43')]])){utils[_0x66b6('0xf')](util['format'](_0x66b6('0x44'),_0xf77a0b[_0x66b6('0x1')]),_0xf77a0b);queues[_0xf77a0b[_0x66b6('0x43')]][_0x66b6('0x3f')]=!![];queues[_0xf77a0b[_0x66b6('0x43')]][_0x66b6('0x45')]=_0x66b6('0x46');queues[_0xf77a0b['transfereeuniqueid']][_0x66b6('0x47')]=_0xf77a0b[_0x66b6('0x48')];queues[_0xf77a0b[_0x66b6('0x43')]]['transferuniqueid']=_0xf77a0b[_0x66b6('0x43')];queues[_0xf77a0b['transfereeuniqueid']][_0x66b6('0x7')]=_0x66b6('0x49');utils['info'](util[_0x66b6('0x11')]('[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER',_0xf77a0b[_0x66b6('0x1')],queues[_0xf77a0b[_0x66b6('0x43')]][_0x66b6('0x1f')],_0xf77a0b['transfereeuniqueid'],_0xf77a0b[_0x66b6('0x48')]));}}catch(_0x5a16fa){utils[_0x66b6('0x15')](util['format'](_0x66b6('0x44'),_0xf77a0b[_0x66b6('0x1')]),_0x5a16fa);}};exports[_0x66b6('0x4a')]=function(_0x281ad2){try{utils[_0x66b6('0xf')](util[_0x66b6('0x11')](_0x66b6('0x4b'),_0x281ad2[_0x66b6('0x4c')]),_0x281ad2);if(_0x281ad2[_0x66b6('0x4c')]==_0x281ad2[_0x66b6('0x4d')]){if(!_['isNil'](queues[_0x281ad2[_0x66b6('0x4e')]])){utils[_0x66b6('0x10')](util[_0x66b6('0x11')](_0x66b6('0x4f'),_0x281ad2[_0x66b6('0x4c')],queues[_0x281ad2['secondtransfererlinkedid']][_0x66b6('0x1f')],_0x281ad2[_0x66b6('0x50')]));queues[_0x281ad2['secondtransfererlinkedid']]['transfer']=!![];queues[_0x281ad2['secondtransfererlinkedid']][_0x66b6('0x45')]=_0x66b6('0x51');queues[_0x281ad2[_0x66b6('0x4e')]][_0x66b6('0x47')]=_0x281ad2[_0x66b6('0x50')];queues[_0x281ad2[_0x66b6('0x4e')]]['transferuniqueid']=_0x281ad2[_0x66b6('0x4c')];queues[_0x281ad2['secondtransfererlinkedid']][_0x66b6('0x7')]=_0x66b6('0x52');}if(!_[_0x66b6('0x18')](queues[_0x281ad2[_0x66b6('0x4d')]])){if(_0x281ad2['transfereelinkedid']&&queues[_0x281ad2[_0x66b6('0x53')]]){queues[_0x281ad2['transfereelinkedid']][_0x66b6('0x54')]=0x1;queues[_0x281ad2[_0x66b6('0x43')]]=_[_0x66b6('0x55')](queues[_0x281ad2['transfereelinkedid']]);queues[_0x281ad2['transfereeuniqueid']][_0x66b6('0xd')]=_0x281ad2['transfertargetuniqueid'];queues[_0x281ad2[_0x66b6('0x43')]][_0x66b6('0x54')]=0x2;queues[_0x281ad2[_0x66b6('0x43')]][_0x66b6('0x5')]=queues[_0x281ad2[_0x66b6('0x4e')]]['calleridnum'];queues[_0x281ad2['transfereeuniqueid']]['calleridname']=queues[_0x281ad2[_0x66b6('0x4e')]][_0x66b6('0x56')];queues[_0x281ad2[_0x66b6('0x43')]][_0x66b6('0x35')]=utils[_0x66b6('0x1c')]();queues[_0x281ad2[_0x66b6('0x43')]][_0x66b6('0x33')]=utils[_0x66b6('0x1c')]();queues[_0x281ad2['transfereeuniqueid']][_0x66b6('0x57')]=0x0;queues[_0x281ad2[_0x66b6('0x43')]][_0x66b6('0x58')]=0x0;utils['info'](util[_0x66b6('0x11')](_0x66b6('0x59'),_0x281ad2[_0x66b6('0x4c')],queues[_0x281ad2[_0x66b6('0x43')]][_0x66b6('0x1f')],queues[_0x281ad2[_0x66b6('0x43')]][_0x66b6('0x5')],queues[_0x281ad2[_0x66b6('0x43')]][_0x66b6('0x56')]));}else{utils['info'](util['format']('[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s',_0x281ad2[_0x66b6('0x4c')],queues[_0x281ad2[_0x66b6('0x4d')]][_0x66b6('0x1f')],_0x281ad2['secondtransfererlinkedid']));queues[_0x281ad2['origtransfererlinkedid']][_0x66b6('0xd')]=_0x281ad2[_0x66b6('0x4e')];}}}else if(_0x281ad2[_0x66b6('0x5a')]==_0x281ad2[_0x66b6('0x4e')]){if(!_[_0x66b6('0x18')](queues[_0x281ad2[_0x66b6('0x4d')]])){utils[_0x66b6('0x10')](util[_0x66b6('0x11')](_0x66b6('0x5b'),_0x281ad2[_0x66b6('0x4c')],queues[_0x281ad2[_0x66b6('0x4d')]][_0x66b6('0x1f')],_0x281ad2[_0x66b6('0x5a')],_0x281ad2['secondtransfererexten']));queues[_0x281ad2[_0x66b6('0x4d')]][_0x66b6('0x3f')]=!![];queues[_0x281ad2[_0x66b6('0x4d')]][_0x66b6('0x45')]='ATTENDED';queues[_0x281ad2[_0x66b6('0x4d')]][_0x66b6('0x47')]=_0x281ad2[_0x66b6('0x5c')];queues[_0x281ad2[_0x66b6('0x4d')]][_0x66b6('0x5d')]=_0x281ad2[_0x66b6('0x5a')];queues[_0x281ad2[_0x66b6('0x4d')]]['queuecallerexitreason']=_0x66b6('0x52');}if(!_['isNil'](queues[_0x281ad2['secondtransfererlinkedid']])){if(_0x281ad2[_0x66b6('0x5e')]&&queues[_0x281ad2[_0x66b6('0x5e')]]){queues[_0x281ad2[_0x66b6('0x5e')]][_0x66b6('0x54')]=0x1;queues[_0x281ad2[_0x66b6('0x5f')]]=_[_0x66b6('0x55')](queues[_0x281ad2[_0x66b6('0x5e')]]);queues[_0x281ad2[_0x66b6('0x5f')]][_0x66b6('0xd')]=_0x281ad2[_0x66b6('0x5f')];queues[_0x281ad2[_0x66b6('0x5f')]][_0x66b6('0x54')]=0x2;queues[_0x281ad2['transfertargetuniqueid']][_0x66b6('0x5')]=queues[_0x281ad2['origtransfererlinkedid']]['calleridnum'];queues[_0x281ad2[_0x66b6('0x5f')]][_0x66b6('0x56')]=queues[_0x281ad2[_0x66b6('0x4d')]][_0x66b6('0x56')];queues[_0x281ad2[_0x66b6('0x5f')]]['queuecallerjoinAt']=utils[_0x66b6('0x1c')]();queues[_0x281ad2[_0x66b6('0x5f')]][_0x66b6('0x33')]=utils['now']();queues[_0x281ad2[_0x66b6('0x5f')]][_0x66b6('0x57')]=0x0;queues[_0x281ad2['transfertargetuniqueid']][_0x66b6('0x58')]=0x0;utils[_0x66b6('0x10')](util['format'](_0x66b6('0x60'),_0x281ad2['origtransfereruniqueid'],queues[_0x281ad2['transfertargetuniqueid']][_0x66b6('0x1f')],queues[_0x281ad2[_0x66b6('0x5f')]][_0x66b6('0xd')],queues[_0x281ad2[_0x66b6('0x5f')]][_0x66b6('0x5')],queues[_0x281ad2['transfertargetuniqueid']]['calleridname']));}else{utils[_0x66b6('0x10')](util[_0x66b6('0x11')](_0x66b6('0x61'),_0x281ad2[_0x66b6('0x4c')],queues[_0x281ad2[_0x66b6('0x4e')]][_0x66b6('0x1f')],_0x281ad2['origtransfererlinkedid']));queues[_0x281ad2[_0x66b6('0x4e')]][_0x66b6('0xd')]=_0x281ad2[_0x66b6('0x4d')];}}}}catch(_0x9e0e1){utils['error'](util[_0x66b6('0x11')]('[%s][queues][attendedtransfer]',_0x281ad2[_0x66b6('0x4c')]),_0x9e0e1);}};exports['musiconholdstart']=function(_0x46814e){try{if(!_[_0x66b6('0x18')](queues[_0x46814e[_0x66b6('0x1')]])){utils['debug'](util[_0x66b6('0x11')](_0x66b6('0x62'),_0x46814e['uniqueid']),_0x46814e);queues[_0x46814e[_0x66b6('0x1')]]['musiconholdstartAt']=utils['now']();utils[_0x66b6('0x10')](util[_0x66b6('0x11')]('[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s',_0x46814e['uniqueid'],queues[_0x46814e[_0x66b6('0x1')]][_0x66b6('0x1f')],queues[_0x46814e[_0x66b6('0x1')]][_0x66b6('0x63')]));}}catch(_0x35c4f6){utils[_0x66b6('0x15')](util[_0x66b6('0x11')](_0x66b6('0x62'),_0x46814e[_0x66b6('0x1')]),_0x35c4f6);}};exports[_0x66b6('0x64')]=function(_0xd0ea5b){try{if(!_['isNil'](queues[_0xd0ea5b[_0x66b6('0x1')]])){if(!_[_0x66b6('0x18')](queues[_0xd0ea5b[_0x66b6('0x1')]][_0x66b6('0x63')])){utils['debug'](util[_0x66b6('0x11')]('[%s][queues][musiconholdstop]',_0xd0ea5b[_0x66b6('0x1')]),_0xd0ea5b);queues[_0xd0ea5b[_0x66b6('0x1')]]['mohtime']+=utils[_0x66b6('0x34')](utils[_0x66b6('0x1c')](),queues[_0xd0ea5b['uniqueid']][_0x66b6('0x63')]);utils[_0x66b6('0x10')](util[_0x66b6('0x11')]('[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s',_0xd0ea5b[_0x66b6('0x1')],queues[_0xd0ea5b[_0x66b6('0x1')]]['name'],queues[_0xd0ea5b[_0x66b6('0x1')]][_0x66b6('0x58')]));delete queues[_0xd0ea5b[_0x66b6('0x1')]][_0x66b6('0x63')];}}}catch(_0x3569fd){utils[_0x66b6('0x15')](util['format'](_0x66b6('0x65'),_0xd0ea5b['uniqueid']),_0x3569fd);}}; \ No newline at end of file +var _0xd357=['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','musiconholdstart','musiconholdstartAt','[%s][queues][musiconholdstart]','musiconholdstop','[%s][queues][musiconholdstop]','[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s','lodash','./utils','[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s','uniqueid','lastAssignedTo','calleridnum','queuecallerexitreason','queue','getVoiceQueueByName','type','CreateVoiceQueueReport','request','transfereduniqueid','queuecallerjoin','format','[%s][queues][queuecallerjoin]','position','assign','now','error','hangup','[%s][queues][hangup]','queuecallerleaveAt','queuecallerabandon','queuecallerexit','queuecallercomplete','queuecallercompleteAt','COMPLETEDBYAGENT','[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s','name','queuecallerenterreason','varset','debug','[%s][queues][varset]','isNil','variable','queuestatus','value','toUpperCase','CONTINUE','queuecallerabandonAt','queuecallerexitAt','info','queueposition','EXITWITHKEY','[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s','ABANDONED','[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s','queuecallerleave','[%s][queues][queuecallerleave]','[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s','connectedlinenum','connectedlinename','holdtime','diffTime','queuecallerjoinAt','count','agentconnect','[%s][queues][agentconnect]','[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s','destaccountcode','assigned','accountcode','membername','agentcomplete','[%s][queues][agentcomplete]','reason','transfer','TRANSFER','COMPLETEDBY','blindtransfer','[%s][queues][blindtransfer]','transfereeuniqueid','transferexten','transferuniqueid','BLINDTRANSFER','[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER','extension','attendedtransfer','[%s][queues][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','secondtransfererlinkedid','transfertype','ATTENDED','ATTENDEDTRANSFER','transfereelinkedid','clone','transfertargetuniqueid','calleridname','mohtime','[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s'];(function(_0x356e3d,_0x3ca56c){var _0x102aff=function(_0x47a7e8){while(--_0x47a7e8){_0x356e3d['push'](_0x356e3d['shift']());}};_0x102aff(++_0x3ca56c);}(_0xd357,0xdd));var _0x7d35=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0xd357[_0x42cae2];return _0x5f256f;};'use strict';var _=require(_0x7d35('0x0'));var util=require('util');var utils=require(_0x7d35('0x1'));var queues={};function writeDB(_0x428d73){utils['info'](util['format'](_0x7d35('0x2'),_0x428d73[_0x7d35('0x3')],_0x428d73['channel'],_0x428d73['queue'],_0x428d73[_0x7d35('0x4')],_0x428d73[_0x7d35('0x5')],_0x428d73['accountcode'],_0x428d73[_0x7d35('0x6')]));if(_0x428d73[_0x7d35('0x7')]){utils[_0x7d35('0x8')](_0x428d73[_0x7d35('0x7')])['then'](function(_0xa0c59){if(_0xa0c59){_0x428d73[_0x7d35('0x9')]=_0xa0c59[_0x7d35('0x9')];}utils['request'](_0x7d35('0xa'),_0x428d73);});}else{utils[_0x7d35('0xb')](_0x7d35('0xa'),_0x428d73);}if(_0x428d73[_0x7d35('0xc')]){delete queues[_0x428d73['transfereduniqueid']];}else{delete queues[_0x428d73[_0x7d35('0x3')]];}}exports[_0x7d35('0xd')]=function(_0x3c2972){try{utils['debug'](util[_0x7d35('0xe')](_0x7d35('0xf'),_0x3c2972[_0x7d35('0x3')]),_0x3c2972);utils['info'](util[_0x7d35('0xe')]('[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s',_0x3c2972[_0x7d35('0x3')],_0x3c2972[_0x7d35('0x7')],_0x3c2972[_0x7d35('0x10')]));queues[_0x3c2972[_0x7d35('0x3')]]=_[_0x7d35('0x11')](_0x3c2972,{'originalposition':_0x3c2972[_0x7d35('0x10')],'queuecallerjoinAt':utils[_0x7d35('0x12')](),'mohtime':0x0});}catch(_0x1dd13d){utils[_0x7d35('0x13')](util[_0x7d35('0xe')]('[%s][queues][queuecallerjoin]',_0x3c2972[_0x7d35('0x3')]),_0x1dd13d);}};exports[_0x7d35('0x14')]=function(_0x43b0a2){try{if(!_['isNil'](queues[_0x43b0a2[_0x7d35('0x3')]])){utils['debug'](util[_0x7d35('0xe')](_0x7d35('0x15'),_0x43b0a2[_0x7d35('0x3')]),_0x43b0a2);if(queues[_0x43b0a2[_0x7d35('0x3')]][_0x7d35('0x16')]){if(!queues[_0x43b0a2[_0x7d35('0x3')]][_0x7d35('0x17')]&&!queues[_0x43b0a2[_0x7d35('0x3')]][_0x7d35('0x18')]){queues[_0x43b0a2[_0x7d35('0x3')]][_0x7d35('0x19')]=!![];queues[_0x43b0a2[_0x7d35('0x3')]][_0x7d35('0x1a')]=utils[_0x7d35('0x12')]();queues[_0x43b0a2[_0x7d35('0x3')]][_0x7d35('0x6')]=_0x7d35('0x1b');}utils['info'](util[_0x7d35('0xe')](_0x7d35('0x1c'),_0x43b0a2['uniqueid'],queues[_0x43b0a2[_0x7d35('0x3')]][_0x7d35('0x1d')],queues[_0x43b0a2['uniqueid']]['queuecallerexitreason']));writeDB(queues[_0x43b0a2[_0x7d35('0x3')]]);}else if(queues[_0x43b0a2[_0x7d35('0x3')]][_0x7d35('0xc')]){utils['info'](util[_0x7d35('0xe')]('[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s',_0x43b0a2[_0x7d35('0x3')],queues[_0x43b0a2['uniqueid']][_0x7d35('0x1d')],queues[_0x43b0a2['uniqueid']][_0x7d35('0xc')]));queues[queues[_0x43b0a2[_0x7d35('0x3')]][_0x7d35('0xc')]]=queues[_0x43b0a2[_0x7d35('0x3')]];queues[queues[_0x43b0a2[_0x7d35('0x3')]]['transfereduniqueid']][_0x7d35('0x1e')]=0x2;delete queues[_0x43b0a2[_0x7d35('0x3')]];}}}catch(_0x1ec08c){utils[_0x7d35('0x13')](util[_0x7d35('0xe')](_0x7d35('0x15'),_0x43b0a2[_0x7d35('0x3')]),_0x1ec08c);}};exports[_0x7d35('0x1f')]=function(_0x3baa74){try{utils[_0x7d35('0x20')](util[_0x7d35('0xe')](_0x7d35('0x21'),_0x3baa74[_0x7d35('0x3')]),_0x3baa74);if(!_[_0x7d35('0x22')](_0x3baa74[_0x7d35('0x23')][_0x7d35('0x24')])&&_0x3baa74[_0x7d35('0x25')][_0x7d35('0x26')]()!==_0x7d35('0x27')){if(!_[_0x7d35('0x22')](queues[_0x3baa74['uniqueid']])){queues[_0x3baa74[_0x7d35('0x3')]][_0x7d35('0x17')]=![];queues[_0x3baa74[_0x7d35('0x3')]][_0x7d35('0x28')]=null;queues[_0x3baa74[_0x7d35('0x3')]][_0x7d35('0x18')]=!![];queues[_0x3baa74['uniqueid']][_0x7d35('0x29')]=utils[_0x7d35('0x12')]();queues[_0x3baa74[_0x7d35('0x3')]][_0x7d35('0x6')]=_0x3baa74['value'][_0x7d35('0x26')]();utils[_0x7d35('0x2a')](util[_0x7d35('0xe')]('[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s',_0x3baa74[_0x7d35('0x3')],queues[_0x3baa74['uniqueid']][_0x7d35('0x1d')],_0x3baa74[_0x7d35('0x25')],queues[_0x3baa74['uniqueid']][_0x7d35('0x6')]));writeDB(queues[_0x3baa74[_0x7d35('0x3')]]);}}else if(!_[_0x7d35('0x22')](_0x3baa74[_0x7d35('0x23')][_0x7d35('0x2b')])){if(!_[_0x7d35('0x22')](queues[_0x3baa74[_0x7d35('0x3')]])&&!queues[_0x3baa74['uniqueid']]['queuecallerabandon']){queues[_0x3baa74[_0x7d35('0x3')]][_0x7d35('0x17')]=![];queues[_0x3baa74[_0x7d35('0x3')]]['queuecallerabandonAt']=null;queues[_0x3baa74[_0x7d35('0x3')]][_0x7d35('0x18')]=!![];queues[_0x3baa74['uniqueid']][_0x7d35('0x29')]=utils[_0x7d35('0x12')]();queues[_0x3baa74[_0x7d35('0x3')]][_0x7d35('0x6')]=_0x7d35('0x2c');utils['info'](util[_0x7d35('0xe')](_0x7d35('0x2d'),_0x3baa74[_0x7d35('0x3')],queues[_0x3baa74[_0x7d35('0x3')]][_0x7d35('0x1d')],_0x3baa74[_0x7d35('0x25')],queues[_0x3baa74[_0x7d35('0x3')]][_0x7d35('0x6')]));}}}catch(_0x1cc00c){utils['error'](util[_0x7d35('0xe')]('[%s][queues][varset]',_0x3baa74[_0x7d35('0x3')]),_0x1cc00c);}};exports[_0x7d35('0x17')]=function(_0x3af00a){try{if(!_[_0x7d35('0x22')](queues[_0x3af00a[_0x7d35('0x3')]])){utils[_0x7d35('0x20')](util[_0x7d35('0xe')]('[%s][queues][queuecallerabandon]',_0x3af00a[_0x7d35('0x3')]),_0x3af00a);queues[_0x3af00a[_0x7d35('0x3')]][_0x7d35('0x18')]=![];queues[_0x3af00a['uniqueid']][_0x7d35('0x29')]=null;queues[_0x3af00a['uniqueid']][_0x7d35('0x17')]=!![];queues[_0x3af00a['uniqueid']][_0x7d35('0x28')]=utils[_0x7d35('0x12')]();queues[_0x3af00a[_0x7d35('0x3')]][_0x7d35('0x6')]=_0x7d35('0x2e');utils[_0x7d35('0x2a')](util['format'](_0x7d35('0x2f'),_0x3af00a[_0x7d35('0x3')],queues[_0x3af00a[_0x7d35('0x3')]][_0x7d35('0x1d')],queues[_0x3af00a[_0x7d35('0x3')]][_0x7d35('0x6')]));}}catch(_0x20a418){utils['error'](util[_0x7d35('0xe')]('[%s][queues][queuecallerabandon]',_0x3af00a[_0x7d35('0x3')]),_0x20a418);}};exports[_0x7d35('0x30')]=function(_0x2cf6f9){try{if(!_['isNil'](queues[_0x2cf6f9[_0x7d35('0x3')]])){utils[_0x7d35('0x20')](util[_0x7d35('0xe')](_0x7d35('0x31'),_0x2cf6f9[_0x7d35('0x3')]),_0x2cf6f9);utils['info'](util[_0x7d35('0xe')](_0x7d35('0x32'),_0x2cf6f9[_0x7d35('0x3')],queues[_0x2cf6f9[_0x7d35('0x3')]]['name'],_0x2cf6f9[_0x7d35('0x33')],_0x2cf6f9[_0x7d35('0x34')]));queues[_0x2cf6f9[_0x7d35('0x3')]][_0x7d35('0x30')]=!![];queues[_0x2cf6f9[_0x7d35('0x3')]][_0x7d35('0x16')]=utils[_0x7d35('0x12')]();queues[_0x2cf6f9[_0x7d35('0x3')]][_0x7d35('0x35')]=utils[_0x7d35('0x36')](queues[_0x2cf6f9[_0x7d35('0x3')]][_0x7d35('0x16')],queues[_0x2cf6f9['uniqueid']][_0x7d35('0x37')]);queues[_0x2cf6f9[_0x7d35('0x3')]][_0x7d35('0x10')]=_0x2cf6f9[_0x7d35('0x10')];queues[_0x2cf6f9['uniqueid']][_0x7d35('0x38')]=_0x2cf6f9[_0x7d35('0x38')];queues[_0x2cf6f9[_0x7d35('0x3')]][_0x7d35('0x33')]=_0x2cf6f9[_0x7d35('0x33')];queues[_0x2cf6f9[_0x7d35('0x3')]][_0x7d35('0x34')]=_0x2cf6f9[_0x7d35('0x34')];}}catch(_0xd35b1c){utils['error'](util['format'](_0x7d35('0x31'),_0x2cf6f9['uniqueid']),_0xd35b1c);}};exports[_0x7d35('0x39')]=function(_0x314fec){try{if(!_['isNil'](queues[_0x314fec[_0x7d35('0x3')]])){utils[_0x7d35('0x20')](util[_0x7d35('0xe')](_0x7d35('0x3a'),_0x314fec['uniqueid']),_0x314fec);utils[_0x7d35('0x2a')](util[_0x7d35('0xe')](_0x7d35('0x3b'),_0x314fec[_0x7d35('0x3')],queues[_0x314fec[_0x7d35('0x3')]][_0x7d35('0x1d')],_0x314fec['membername'],_0x314fec[_0x7d35('0x3c')]));queues[_0x314fec[_0x7d35('0x3')]][_0x7d35('0x17')]=![];queues[_0x314fec[_0x7d35('0x3')]]['queuecallerabandon']=![];queues[_0x314fec[_0x7d35('0x3')]][_0x7d35('0x28')]=null;queues[_0x314fec['uniqueid']][_0x7d35('0x18')]=![];queues[_0x314fec[_0x7d35('0x3')]][_0x7d35('0x6')]=null;queues[_0x314fec[_0x7d35('0x3')]][_0x7d35('0x29')]=null;queues[_0x314fec[_0x7d35('0x3')]][_0x7d35('0x3d')]=!![];queues[_0x314fec[_0x7d35('0x3')]][_0x7d35('0x3e')]=_0x314fec[_0x7d35('0x3c')];queues[_0x314fec[_0x7d35('0x3')]][_0x7d35('0x4')]=_0x314fec[_0x7d35('0x3f')];}}catch(_0x2ba91a){utils['error'](util[_0x7d35('0xe')]('[%s][queues][agentconnect]',_0x314fec['uniqueid']),_0x2ba91a);}};exports[_0x7d35('0x40')]=function(_0x169b0f){try{if(!_[_0x7d35('0x22')](queues[_0x169b0f['uniqueid']])){if(queues[_0x169b0f['uniqueid']]['queuecallerleaveAt']){utils[_0x7d35('0x20')](util[_0x7d35('0xe')](_0x7d35('0x41'),_0x169b0f['uniqueid']),_0x169b0f);queues[_0x169b0f[_0x7d35('0x3')]]['queuecallerabandon']=![];queues[_0x169b0f[_0x7d35('0x3')]][_0x7d35('0x17')]=![];queues[_0x169b0f[_0x7d35('0x3')]][_0x7d35('0x28')]=null;queues[_0x169b0f[_0x7d35('0x3')]][_0x7d35('0x18')]=![];queues[_0x169b0f[_0x7d35('0x3')]]['queuecallerexitAt']=null;queues[_0x169b0f[_0x7d35('0x3')]]['assigned']=!![];queues[_0x169b0f[_0x7d35('0x3')]][_0x7d35('0x4')]=_0x169b0f[_0x7d35('0x3f')];queues[_0x169b0f[_0x7d35('0x3')]]['queuecallercomplete']=!![];queues[_0x169b0f[_0x7d35('0x3')]][_0x7d35('0x1a')]=utils[_0x7d35('0x12')]();if(_0x169b0f[_0x7d35('0x42')]==_0x7d35('0x43')){if(!queues[_0x169b0f[_0x7d35('0x3')]]['transfer']){queues[_0x169b0f[_0x7d35('0x3')]]['queuecallerexitreason']=_0x7d35('0x44');}}else{queues[_0x169b0f[_0x7d35('0x3')]][_0x7d35('0x6')]=_0x7d35('0x45')+_0x169b0f[_0x7d35('0x42')]['toUpperCase']();}utils[_0x7d35('0x2a')](util[_0x7d35('0xe')]('[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s',_0x169b0f[_0x7d35('0x3')],queues[_0x169b0f[_0x7d35('0x3')]][_0x7d35('0x1d')],_0x169b0f['membername'],queues[_0x169b0f[_0x7d35('0x3')]][_0x7d35('0x6')]));writeDB(queues[_0x169b0f['uniqueid']]);}}}catch(_0xdceb9b){utils[_0x7d35('0x13')](util[_0x7d35('0xe')](_0x7d35('0x41'),_0x169b0f[_0x7d35('0x3')]),_0xdceb9b);}};exports[_0x7d35('0x46')]=function(_0x2038a3){try{if(!_[_0x7d35('0x22')](queues[_0x2038a3['transfereeuniqueid']])){utils[_0x7d35('0x20')](util['format'](_0x7d35('0x47'),_0x2038a3[_0x7d35('0x3')]),_0x2038a3);queues[_0x2038a3[_0x7d35('0x48')]][_0x7d35('0x43')]=!![];queues[_0x2038a3[_0x7d35('0x48')]]['transfertype']='BLIND';queues[_0x2038a3[_0x7d35('0x48')]][_0x7d35('0x49')]=_0x2038a3['extension'];queues[_0x2038a3[_0x7d35('0x48')]][_0x7d35('0x4a')]=_0x2038a3['transfereeuniqueid'];queues[_0x2038a3[_0x7d35('0x48')]][_0x7d35('0x6')]=_0x7d35('0x4b');utils[_0x7d35('0x2a')](util['format'](_0x7d35('0x4c'),_0x2038a3[_0x7d35('0x3')],queues[_0x2038a3[_0x7d35('0x48')]][_0x7d35('0x1d')],_0x2038a3[_0x7d35('0x48')],_0x2038a3[_0x7d35('0x4d')]));}}catch(_0x604813){utils[_0x7d35('0x13')](util['format'](_0x7d35('0x47'),_0x2038a3[_0x7d35('0x3')]),_0x604813);}};exports[_0x7d35('0x4e')]=function(_0x18108d){try{utils[_0x7d35('0x20')](util[_0x7d35('0xe')](_0x7d35('0x4f'),_0x18108d[_0x7d35('0x50')]),_0x18108d);if(_0x18108d[_0x7d35('0x50')]==_0x18108d[_0x7d35('0x51')]){if(!_[_0x7d35('0x22')](queues[_0x18108d['secondtransfererlinkedid']])){utils[_0x7d35('0x2a')](util[_0x7d35('0xe')](_0x7d35('0x52'),_0x18108d['origtransfereruniqueid'],queues[_0x18108d[_0x7d35('0x53')]][_0x7d35('0x1d')],_0x18108d['origtransfererexten']));queues[_0x18108d[_0x7d35('0x53')]][_0x7d35('0x43')]=!![];queues[_0x18108d[_0x7d35('0x53')]][_0x7d35('0x54')]=_0x7d35('0x55');queues[_0x18108d[_0x7d35('0x53')]][_0x7d35('0x49')]=_0x18108d['origtransfererexten'];queues[_0x18108d['secondtransfererlinkedid']][_0x7d35('0x4a')]=_0x18108d[_0x7d35('0x50')];queues[_0x18108d[_0x7d35('0x53')]][_0x7d35('0x6')]=_0x7d35('0x56');}if(!_[_0x7d35('0x22')](queues[_0x18108d[_0x7d35('0x51')]])){if(_0x18108d[_0x7d35('0x57')]&&queues[_0x18108d[_0x7d35('0x57')]]){queues[_0x18108d['transfereelinkedid']][_0x7d35('0x1e')]=0x1;queues[_0x18108d[_0x7d35('0x48')]]=_[_0x7d35('0x58')](queues[_0x18108d['transfereelinkedid']]);queues[_0x18108d[_0x7d35('0x48')]]['transfereduniqueid']=_0x18108d[_0x7d35('0x59')];queues[_0x18108d[_0x7d35('0x48')]]['queuecallerenterreason']=0x2;queues[_0x18108d[_0x7d35('0x48')]][_0x7d35('0x5')]=queues[_0x18108d[_0x7d35('0x53')]][_0x7d35('0x5')];queues[_0x18108d[_0x7d35('0x48')]]['calleridname']=queues[_0x18108d['secondtransfererlinkedid']][_0x7d35('0x5a')];queues[_0x18108d[_0x7d35('0x48')]]['queuecallerjoinAt']=utils[_0x7d35('0x12')]();queues[_0x18108d['transfereeuniqueid']][_0x7d35('0x16')]=utils['now']();queues[_0x18108d[_0x7d35('0x48')]][_0x7d35('0x35')]=0x0;queues[_0x18108d[_0x7d35('0x48')]][_0x7d35('0x5b')]=0x0;utils[_0x7d35('0x2a')](util['format'](_0x7d35('0x5c'),_0x18108d[_0x7d35('0x50')],queues[_0x18108d[_0x7d35('0x48')]][_0x7d35('0x1d')],queues[_0x18108d[_0x7d35('0x48')]][_0x7d35('0x5')],queues[_0x18108d[_0x7d35('0x48')]]['calleridname']));}else{utils[_0x7d35('0x2a')](util[_0x7d35('0xe')](_0x7d35('0x5d'),_0x18108d[_0x7d35('0x50')],queues[_0x18108d[_0x7d35('0x51')]][_0x7d35('0x1d')],_0x18108d[_0x7d35('0x53')]));queues[_0x18108d['origtransfererlinkedid']]['transfereduniqueid']=_0x18108d['secondtransfererlinkedid'];}}}else if(_0x18108d[_0x7d35('0x5e')]==_0x18108d[_0x7d35('0x53')]){if(!_[_0x7d35('0x22')](queues[_0x18108d[_0x7d35('0x51')]])){utils[_0x7d35('0x2a')](util[_0x7d35('0xe')](_0x7d35('0x5f'),_0x18108d['origtransfereruniqueid'],queues[_0x18108d[_0x7d35('0x51')]][_0x7d35('0x1d')],_0x18108d[_0x7d35('0x5e')],_0x18108d[_0x7d35('0x60')]));queues[_0x18108d[_0x7d35('0x51')]][_0x7d35('0x43')]=!![];queues[_0x18108d[_0x7d35('0x51')]][_0x7d35('0x54')]=_0x7d35('0x55');queues[_0x18108d[_0x7d35('0x51')]]['transferexten']=_0x18108d[_0x7d35('0x60')];queues[_0x18108d[_0x7d35('0x51')]][_0x7d35('0x4a')]=_0x18108d[_0x7d35('0x5e')];queues[_0x18108d[_0x7d35('0x51')]][_0x7d35('0x6')]=_0x7d35('0x56');}if(!_[_0x7d35('0x22')](queues[_0x18108d[_0x7d35('0x53')]])){if(_0x18108d[_0x7d35('0x61')]&&queues[_0x18108d['transfertargetlinkedid']]){queues[_0x18108d['transfertargetlinkedid']][_0x7d35('0x1e')]=0x1;queues[_0x18108d['transfertargetuniqueid']]=_[_0x7d35('0x58')](queues[_0x18108d[_0x7d35('0x61')]]);queues[_0x18108d['transfertargetuniqueid']][_0x7d35('0xc')]=_0x18108d[_0x7d35('0x59')];queues[_0x18108d[_0x7d35('0x59')]]['queuecallerenterreason']=0x2;queues[_0x18108d[_0x7d35('0x59')]]['calleridnum']=queues[_0x18108d[_0x7d35('0x51')]][_0x7d35('0x5')];queues[_0x18108d[_0x7d35('0x59')]][_0x7d35('0x5a')]=queues[_0x18108d[_0x7d35('0x51')]]['calleridname'];queues[_0x18108d[_0x7d35('0x59')]][_0x7d35('0x37')]=utils[_0x7d35('0x12')]();queues[_0x18108d[_0x7d35('0x59')]][_0x7d35('0x16')]=utils[_0x7d35('0x12')]();queues[_0x18108d[_0x7d35('0x59')]][_0x7d35('0x35')]=0x0;queues[_0x18108d['transfertargetuniqueid']][_0x7d35('0x5b')]=0x0;utils[_0x7d35('0x2a')](util[_0x7d35('0xe')](_0x7d35('0x62'),_0x18108d[_0x7d35('0x50')],queues[_0x18108d[_0x7d35('0x59')]][_0x7d35('0x1d')],queues[_0x18108d['transfertargetuniqueid']]['transfereduniqueid'],queues[_0x18108d[_0x7d35('0x59')]]['calleridnum'],queues[_0x18108d[_0x7d35('0x59')]][_0x7d35('0x5a')]));}else{utils[_0x7d35('0x2a')](util['format'](_0x7d35('0x5d'),_0x18108d[_0x7d35('0x50')],queues[_0x18108d[_0x7d35('0x53')]][_0x7d35('0x1d')],_0x18108d[_0x7d35('0x51')]));queues[_0x18108d[_0x7d35('0x53')]][_0x7d35('0xc')]=_0x18108d['origtransfererlinkedid'];}}}}catch(_0xbbda3){utils['error'](util[_0x7d35('0xe')]('[%s][queues][attendedtransfer]',_0x18108d[_0x7d35('0x50')]),_0xbbda3);}};exports[_0x7d35('0x63')]=function(_0x29cc2b){try{if(!_['isNil'](queues[_0x29cc2b['uniqueid']])){utils['debug'](util['format']('[%s][queues][musiconholdstart]',_0x29cc2b[_0x7d35('0x3')]),_0x29cc2b);queues[_0x29cc2b[_0x7d35('0x3')]][_0x7d35('0x64')]=utils[_0x7d35('0x12')]();utils[_0x7d35('0x2a')](util[_0x7d35('0xe')]('[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s',_0x29cc2b[_0x7d35('0x3')],queues[_0x29cc2b[_0x7d35('0x3')]]['name'],queues[_0x29cc2b['uniqueid']][_0x7d35('0x64')]));}}catch(_0x108fce){utils[_0x7d35('0x13')](util[_0x7d35('0xe')](_0x7d35('0x65'),_0x29cc2b[_0x7d35('0x3')]),_0x108fce);}};exports[_0x7d35('0x66')]=function(_0x4d5d22){try{if(!_['isNil'](queues[_0x4d5d22['uniqueid']])){if(!_[_0x7d35('0x22')](queues[_0x4d5d22[_0x7d35('0x3')]][_0x7d35('0x64')])){utils[_0x7d35('0x20')](util[_0x7d35('0xe')](_0x7d35('0x67'),_0x4d5d22[_0x7d35('0x3')]),_0x4d5d22);queues[_0x4d5d22['uniqueid']][_0x7d35('0x5b')]+=utils[_0x7d35('0x36')](utils[_0x7d35('0x12')](),queues[_0x4d5d22[_0x7d35('0x3')]][_0x7d35('0x64')]);utils[_0x7d35('0x2a')](util[_0x7d35('0xe')](_0x7d35('0x68'),_0x4d5d22[_0x7d35('0x3')],queues[_0x4d5d22[_0x7d35('0x3')]][_0x7d35('0x1d')],queues[_0x4d5d22['uniqueid']][_0x7d35('0x5b')]));delete queues[_0x4d5d22[_0x7d35('0x3')]][_0x7d35('0x64')];}}}catch(_0x531d8c){utils['error'](util[_0x7d35('0xe')](_0x7d35('0x67'),_0x4d5d22[_0x7d35('0x3')]),_0x531d8c);}}; \ No newline at end of file diff --git a/server/services/xdr/recordings.controller.js b/server/services/xdr/recordings.controller.js index cda2d76..d00cb5e 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 _0x3419=['[%s][recordings][hangup]','cause-txt','calleridnum','connectedlinenum','connectedlinename','outbound','newexten','[%s][recordings][newexten]','[%s][recordings][newexten]\x20application:%s\x20appdata:%s','application','toLowerCase','startsWith','appdata','split','lastIndexOf','queuecallerjoin','queue','lodash','util','./utils','info','uniqueid','accountcode','getUserByInternal','then','membername','name','UserId','request','CreateVoiceRecording','debug','format','[%s][recordings][newchannel]','linkedid','context','exten','channel','[%s][recordings][newstate]','isNil','[%s][recordings][newstate]\x20context:%s\x20channel:%s','transfer','[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','error','varset','variable','mixmonitor_filename','[%s][recordings][varset]\x20variable:%s\x20value:%s','endsWith','value','.wav49','replace','.WAV','find','monitors','[%s][recordings][varset]'];(function(_0x536919,_0x2d0c68){var _0x3694d9=function(_0xf21223){while(--_0xf21223){_0x536919['push'](_0x536919['shift']());}};_0x3694d9(++_0x2d0c68);}(_0x3419,0x7f));var _0x9341=function(_0x1c4951,_0x2038ee){_0x1c4951=_0x1c4951-0x0;var _0x345e1b=_0x3419[_0x1c4951];return _0x345e1b;};'use strict';var _=require(_0x9341('0x0'));var util=require(_0x9341('0x1'));var utils=require(_0x9341('0x2'));var recordings={};function writeDB(_0x20ab91){utils[_0x9341('0x3')](util['format']('[%s][recordings][writeDB]',_0x20ab91[_0x9341('0x4')]));if(_0x20ab91[_0x9341('0x5')]){utils[_0x9341('0x6')](_0x20ab91[_0x9341('0x5')])[_0x9341('0x7')](function(_0xe4be74){if(_0xe4be74){_0x20ab91[_0x9341('0x8')]=_0xe4be74[_0x9341('0x9')];_0x20ab91[_0x9341('0xa')]=_0xe4be74['id'];}utils[_0x9341('0xb')](_0x9341('0xc'),_0x20ab91);});}else{utils[_0x9341('0xb')](_0x9341('0xc'),_0x20ab91);}}exports['newchannel']=function(_0x4d28d4){try{utils[_0x9341('0xd')](util[_0x9341('0xe')](_0x9341('0xf'),_0x4d28d4[_0x9341('0x4')]),_0x4d28d4);if(_0x4d28d4[_0x9341('0x4')]==_0x4d28d4[_0x9341('0x10')]){utils['info'](util[_0x9341('0xe')]('[%s][recordings][newchannel]\x20context:%s\x20exten:%s',_0x4d28d4[_0x9341('0x4')],_0x4d28d4[_0x9341('0x11')],_0x4d28d4['exten']));recordings[_0x4d28d4[_0x9341('0x4')]]={'uniqueid':_0x4d28d4[_0x9341('0x4')],'accountcode':_0x4d28d4[_0x9341('0x5')],'exten':_0x4d28d4[_0x9341('0x12')],'context':_0x4d28d4['context'],'channel':_0x4d28d4[_0x9341('0x13')],'monitors':[]};}}catch(_0x7bea29){utils['error'](util['format'](_0x9341('0xf'),_0x4d28d4[_0x9341('0x4')]),_0x7bea29);}};exports['newstate']=function(_0x58b65e){try{utils[_0x9341('0xd')](util[_0x9341('0xe')](_0x9341('0x14'),_0x58b65e[_0x9341('0x4')]),_0x58b65e);if(!_[_0x9341('0x15')](recordings[_0x58b65e[_0x9341('0x4')]])&&_0x58b65e['channelstate']==0x6){utils[_0x9341('0x3')](util[_0x9341('0xe')](_0x9341('0x16'),_0x58b65e[_0x9341('0x4')],_0x58b65e['context'],_0x58b65e[_0x9341('0x13')]));}else if(!_['isNil'](recordings[_0x58b65e['linkedid']])&&_0x58b65e['channelstate']==0x6&&_0x58b65e[_0x9341('0x11')]!=_0x9341('0x17')){utils[_0x9341('0x3')](util[_0x9341('0xe')](_0x9341('0x18'),_0x58b65e['uniqueid'],_0x58b65e[_0x9341('0x10')],_0x58b65e[_0x9341('0x11')],_0x58b65e[_0x9341('0x13')]));recordings[_0x58b65e[_0x9341('0x10')]][_0x9341('0x5')]=_0x58b65e[_0x9341('0x5')];}}catch(_0x2c8f38){utils[_0x9341('0x19')](util[_0x9341('0xe')](_0x9341('0x14'),_0x58b65e[_0x9341('0x4')]),_0x2c8f38);}};exports[_0x9341('0x1a')]=function(_0x1d6d27){try{if(!_[_0x9341('0x15')](_0x1d6d27[_0x9341('0x1b')])&&!_[_0x9341('0x15')](_0x1d6d27[_0x9341('0x1b')][_0x9341('0x1c')])){utils[_0x9341('0xd')](util[_0x9341('0xe')]('[%s][recordings][varset]',_0x1d6d27[_0x9341('0x4')]),_0x1d6d27);utils[_0x9341('0x3')](util['format'](_0x9341('0x1d'),_0x1d6d27[_0x9341('0x4')],_0x1d6d27[_0x9341('0x1b')],_0x1d6d27['value']));if(_[_0x9341('0x1e')](_0x1d6d27[_0x9341('0x1f')],_0x9341('0x20'))){_0x1d6d27[_0x9341('0x1f')]=_0x1d6d27[_0x9341('0x1f')][_0x9341('0x21')](_0x9341('0x20'),_0x9341('0x22'));}if(recordings[_0x1d6d27[_0x9341('0x10')]]){var _0x540b29=_[_0x9341('0x23')](recordings[_0x1d6d27['linkedid']]['monitors'],{'value':_0x1d6d27[_0x9341('0x1f')]});if(_[_0x9341('0x15')](_0x540b29)){recordings[_0x1d6d27['linkedid']][_0x9341('0x24')]['push']({'value':_0x1d6d27[_0x9341('0x1f')]});}}}}catch(_0x3ba8cf){utils[_0x9341('0x19')](util[_0x9341('0xe')](_0x9341('0x25'),_0x1d6d27['uniqueid']),_0x3ba8cf);}};exports['hangup']=function(_0x5a2999){try{if(!_[_0x9341('0x15')](recordings[_0x5a2999[_0x9341('0x4')]])){utils['debug'](util[_0x9341('0xe')](_0x9341('0x26'),_0x5a2999['uniqueid']),_0x5a2999);utils[_0x9341('0x3')](util[_0x9341('0xe')]('[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s',_0x5a2999[_0x9341('0x4')],_0x5a2999['calleridnum'],_0x5a2999['calleridname'],_0x5a2999[_0x9341('0x27')]));recordings[_0x5a2999['uniqueid']][_0x9341('0x28')]=_0x5a2999[_0x9341('0x28')];recordings[_0x5a2999[_0x9341('0x4')]]['calleridname']=_0x5a2999['calleridname'];recordings[_0x5a2999['uniqueid']][_0x9341('0x29')]=_0x5a2999[_0x9341('0x29')];recordings[_0x5a2999[_0x9341('0x4')]]['connectedlinename']=_0x5a2999[_0x9341('0x2a')];if(recordings[_0x5a2999[_0x9341('0x4')]]['type']==_0x9341('0x2b')&&recordings[_0x5a2999['uniqueid']]['accountcode']){recordings[_0x5a2999[_0x9341('0x4')]][_0x9341('0x29')]=recordings[_0x5a2999['uniqueid']][_0x9341('0x5')];recordings[_0x5a2999[_0x9341('0x4')]][_0x9341('0x2a')]='';}recordings[_0x5a2999[_0x9341('0x4')]][_0x9341('0x24')]['forEach'](function(_0x3c06a5){var _0x2edfa2=_['clone'](recordings[_0x5a2999['uniqueid']]);_0x2edfa2[_0x9341('0x1f')]=_0x3c06a5[_0x9341('0x1f')];writeDB(_0x2edfa2);});delete recordings[_0x5a2999[_0x9341('0x4')]];}}catch(_0x2b086d){utils[_0x9341('0x19')](util['format'](_0x9341('0x26'),_0x5a2999[_0x9341('0x4')]),_0x2b086d);}};exports[_0x9341('0x2c')]=function(_0x8dfd2b){try{if(!_[_0x9341('0x15')](recordings[_0x8dfd2b['uniqueid']])){utils[_0x9341('0xd')](util['format'](_0x9341('0x2d'),_0x8dfd2b['uniqueid']),_0x8dfd2b);utils[_0x9341('0x3')](util[_0x9341('0xe')](_0x9341('0x2e'),_0x8dfd2b['uniqueid'],_0x8dfd2b[_0x9341('0x2f')],_0x8dfd2b['appdata']));if(_0x8dfd2b[_0x9341('0x2f')][_0x9341('0x30')]()=='set'&&_[_0x9341('0x31')](_0x8dfd2b[_0x9341('0x32')]['toLowerCase'](),'cdr')){var _0x115bb4=_0x8dfd2b[_0x9341('0x32')][_0x9341('0x33')]('=');var _0x425f13=_0x115bb4[0x0]['substring'](_0x115bb4[0x0][_0x9341('0x34')]('(')+0x1,_0x115bb4[0x0][_0x9341('0x34')](')'));var _0x131357=_0x115bb4[0x1];recordings[_0x8dfd2b[_0x9341('0x4')]][_0x425f13]=_0x131357;}}}catch(_0x1f53a7){utils['error'](util['format'](_0x9341('0x2d'),_0x8dfd2b[_0x9341('0x4')]),_0x1f53a7);}};exports[_0x9341('0x35')]=function(_0x45744d){try{if(!_[_0x9341('0x15')](recordings[_0x45744d['uniqueid']])){utils[_0x9341('0xd')](util['format']('[%s][recordings][queuecallerjoin]',_0x45744d['uniqueid']),_0x45744d);utils[_0x9341('0x3')](util[_0x9341('0xe')]('[%s][recordings][queuecallerjoin]\x20queue:%s',_0x45744d[_0x9341('0x4')],_0x45744d[_0x9341('0x36')]));recordings[_0x45744d[_0x9341('0x4')]][_0x9341('0x36')]=_0x45744d[_0x9341('0x36')];}}catch(_0x318ea1){utils[_0x9341('0x19')](util['format']('[%s][recordings][queuecallerjoin]',_0x45744d['uniqueid']),_0x318ea1);}}; \ No newline at end of file +var _0x6bb7=['[%s][recordings][newexten]','[%s][recordings][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','set','cdr','lastIndexOf','queuecallerjoin','[%s][recordings][queuecallerjoin]','[%s][recordings][queuecallerjoin]\x20queue:%s','queue','lodash','util','./utils','info','[%s][recordings][writeDB]','accountcode','getUserByInternal','then','membername','name','UserId','request','CreateVoiceRecording','newchannel','debug','format','[%s][recordings][newchannel]','uniqueid','linkedid','[%s][recordings][newchannel]\x20context:%s\x20exten:%s','context','exten','channel','error','newstate','[%s][recordings][newstate]','isNil','channelstate','[%s][recordings][newstate]\x20context:%s\x20channel:%s','varset','variable','mixmonitor_filename','[%s][recordings][varset]','[%s][recordings][varset]\x20variable:%s\x20value:%s','value','endsWith','.wav49','replace','.WAV','find','monitors','[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s','calleridnum','calleridname','cause-txt','connectedlinenum','connectedlinename','type','clone','[%s][recordings][hangup]','newexten'];(function(_0x246a25,_0x2c0c46){var _0x5996f4=function(_0x5ae4bb){while(--_0x5ae4bb){_0x246a25['push'](_0x246a25['shift']());}};_0x5996f4(++_0x2c0c46);}(_0x6bb7,0x147));var _0x76bb=function(_0x4a822e,_0x71bd8d){_0x4a822e=_0x4a822e-0x0;var _0x55348c=_0x6bb7[_0x4a822e];return _0x55348c;};'use strict';var _=require(_0x76bb('0x0'));var util=require(_0x76bb('0x1'));var utils=require(_0x76bb('0x2'));var recordings={};function writeDB(_0x558fc0){utils[_0x76bb('0x3')](util['format'](_0x76bb('0x4'),_0x558fc0['uniqueid']));if(_0x558fc0[_0x76bb('0x5')]){utils[_0x76bb('0x6')](_0x558fc0['accountcode'])[_0x76bb('0x7')](function(_0x3fb3ff){if(_0x3fb3ff){_0x558fc0[_0x76bb('0x8')]=_0x3fb3ff[_0x76bb('0x9')];_0x558fc0[_0x76bb('0xa')]=_0x3fb3ff['id'];}utils['request']('CreateVoiceRecording',_0x558fc0);});}else{utils[_0x76bb('0xb')](_0x76bb('0xc'),_0x558fc0);}}exports[_0x76bb('0xd')]=function(_0x5ef15f){try{utils[_0x76bb('0xe')](util[_0x76bb('0xf')](_0x76bb('0x10'),_0x5ef15f[_0x76bb('0x11')]),_0x5ef15f);if(_0x5ef15f['uniqueid']==_0x5ef15f[_0x76bb('0x12')]){utils['info'](util['format'](_0x76bb('0x13'),_0x5ef15f[_0x76bb('0x11')],_0x5ef15f[_0x76bb('0x14')],_0x5ef15f[_0x76bb('0x15')]));recordings[_0x5ef15f['uniqueid']]={'uniqueid':_0x5ef15f['uniqueid'],'accountcode':_0x5ef15f[_0x76bb('0x5')],'exten':_0x5ef15f['exten'],'context':_0x5ef15f[_0x76bb('0x14')],'channel':_0x5ef15f[_0x76bb('0x16')],'monitors':[]};}}catch(_0x16fb7b){utils[_0x76bb('0x17')](util[_0x76bb('0xf')](_0x76bb('0x10'),_0x5ef15f[_0x76bb('0x11')]),_0x16fb7b);}};exports[_0x76bb('0x18')]=function(_0xf8cedf){try{utils['debug'](util[_0x76bb('0xf')](_0x76bb('0x19'),_0xf8cedf[_0x76bb('0x11')]),_0xf8cedf);if(!_[_0x76bb('0x1a')](recordings[_0xf8cedf[_0x76bb('0x11')]])&&_0xf8cedf[_0x76bb('0x1b')]==0x6){utils[_0x76bb('0x3')](util[_0x76bb('0xf')](_0x76bb('0x1c'),_0xf8cedf[_0x76bb('0x11')],_0xf8cedf[_0x76bb('0x14')],_0xf8cedf['channel']));}else if(!_[_0x76bb('0x1a')](recordings[_0xf8cedf[_0x76bb('0x12')]])&&_0xf8cedf[_0x76bb('0x1b')]==0x6&&_0xf8cedf[_0x76bb('0x14')]!='transfer'){utils[_0x76bb('0x3')](util[_0x76bb('0xf')]('[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s',_0xf8cedf[_0x76bb('0x11')],_0xf8cedf['linkedid'],_0xf8cedf[_0x76bb('0x14')],_0xf8cedf[_0x76bb('0x16')]));recordings[_0xf8cedf[_0x76bb('0x12')]][_0x76bb('0x5')]=_0xf8cedf[_0x76bb('0x5')];}}catch(_0x11c395){utils[_0x76bb('0x17')](util[_0x76bb('0xf')]('[%s][recordings][newstate]',_0xf8cedf[_0x76bb('0x11')]),_0x11c395);}};exports[_0x76bb('0x1d')]=function(_0x4993f4){try{if(!_[_0x76bb('0x1a')](_0x4993f4[_0x76bb('0x1e')])&&!_[_0x76bb('0x1a')](_0x4993f4[_0x76bb('0x1e')][_0x76bb('0x1f')])){utils[_0x76bb('0xe')](util[_0x76bb('0xf')](_0x76bb('0x20'),_0x4993f4[_0x76bb('0x11')]),_0x4993f4);utils[_0x76bb('0x3')](util[_0x76bb('0xf')](_0x76bb('0x21'),_0x4993f4[_0x76bb('0x11')],_0x4993f4[_0x76bb('0x1e')],_0x4993f4[_0x76bb('0x22')]));if(_[_0x76bb('0x23')](_0x4993f4[_0x76bb('0x22')],_0x76bb('0x24'))){_0x4993f4['value']=_0x4993f4[_0x76bb('0x22')][_0x76bb('0x25')](_0x76bb('0x24'),_0x76bb('0x26'));}if(recordings[_0x4993f4[_0x76bb('0x12')]]){var _0x47a942=_[_0x76bb('0x27')](recordings[_0x4993f4[_0x76bb('0x12')]][_0x76bb('0x28')],{'value':_0x4993f4['value']});if(_[_0x76bb('0x1a')](_0x47a942)){recordings[_0x4993f4['linkedid']]['monitors']['push']({'value':_0x4993f4['value']});}}}}catch(_0x1b84c0){utils[_0x76bb('0x17')](util['format']('[%s][recordings][varset]',_0x4993f4[_0x76bb('0x11')]),_0x1b84c0);}};exports['hangup']=function(_0xa0ca81){try{if(!_['isNil'](recordings[_0xa0ca81[_0x76bb('0x11')]])){utils[_0x76bb('0xe')](util[_0x76bb('0xf')]('[%s][recordings][hangup]',_0xa0ca81['uniqueid']),_0xa0ca81);utils['info'](util['format'](_0x76bb('0x29'),_0xa0ca81[_0x76bb('0x11')],_0xa0ca81[_0x76bb('0x2a')],_0xa0ca81[_0x76bb('0x2b')],_0xa0ca81[_0x76bb('0x2c')]));recordings[_0xa0ca81[_0x76bb('0x11')]][_0x76bb('0x2a')]=_0xa0ca81[_0x76bb('0x2a')];recordings[_0xa0ca81[_0x76bb('0x11')]][_0x76bb('0x2b')]=_0xa0ca81[_0x76bb('0x2b')];recordings[_0xa0ca81[_0x76bb('0x11')]][_0x76bb('0x2d')]=_0xa0ca81[_0x76bb('0x2d')];recordings[_0xa0ca81[_0x76bb('0x11')]]['connectedlinename']=_0xa0ca81[_0x76bb('0x2e')];if(recordings[_0xa0ca81[_0x76bb('0x11')]][_0x76bb('0x2f')]=='outbound'&&recordings[_0xa0ca81[_0x76bb('0x11')]]['accountcode']){recordings[_0xa0ca81[_0x76bb('0x11')]][_0x76bb('0x2d')]=recordings[_0xa0ca81['uniqueid']]['accountcode'];recordings[_0xa0ca81[_0x76bb('0x11')]]['connectedlinename']='';}recordings[_0xa0ca81[_0x76bb('0x11')]][_0x76bb('0x28')]['forEach'](function(_0x4e5f4d){var _0x203379=_[_0x76bb('0x30')](recordings[_0xa0ca81[_0x76bb('0x11')]]);_0x203379[_0x76bb('0x22')]=_0x4e5f4d['value'];writeDB(_0x203379);});delete recordings[_0xa0ca81[_0x76bb('0x11')]];}}catch(_0x24b7be){utils['error'](util[_0x76bb('0xf')](_0x76bb('0x31'),_0xa0ca81[_0x76bb('0x11')]),_0x24b7be);}};exports[_0x76bb('0x32')]=function(_0x581260){try{if(!_[_0x76bb('0x1a')](recordings[_0x581260[_0x76bb('0x11')]])){utils[_0x76bb('0xe')](util[_0x76bb('0xf')](_0x76bb('0x33'),_0x581260[_0x76bb('0x11')]),_0x581260);utils['info'](util[_0x76bb('0xf')](_0x76bb('0x34'),_0x581260[_0x76bb('0x11')],_0x581260[_0x76bb('0x35')],_0x581260[_0x76bb('0x36')]));if(_0x581260[_0x76bb('0x35')][_0x76bb('0x37')]()==_0x76bb('0x38')&&_['startsWith'](_0x581260[_0x76bb('0x36')][_0x76bb('0x37')](),_0x76bb('0x39'))){var _0x9e4ecd=_0x581260[_0x76bb('0x36')]['split']('=');var _0x33cce2=_0x9e4ecd[0x0]['substring'](_0x9e4ecd[0x0][_0x76bb('0x3a')]('(')+0x1,_0x9e4ecd[0x0]['lastIndexOf'](')'));var _0x327ad5=_0x9e4ecd[0x1];recordings[_0x581260[_0x76bb('0x11')]][_0x33cce2]=_0x327ad5;}}}catch(_0x551a17){utils[_0x76bb('0x17')](util[_0x76bb('0xf')](_0x76bb('0x33'),_0x581260[_0x76bb('0x11')]),_0x551a17);}};exports[_0x76bb('0x3b')]=function(_0x4ffb91){try{if(!_[_0x76bb('0x1a')](recordings[_0x4ffb91[_0x76bb('0x11')]])){utils['debug'](util[_0x76bb('0xf')](_0x76bb('0x3c'),_0x4ffb91[_0x76bb('0x11')]),_0x4ffb91);utils['info'](util[_0x76bb('0xf')](_0x76bb('0x3d'),_0x4ffb91['uniqueid'],_0x4ffb91['queue']));recordings[_0x4ffb91['uniqueid']][_0x76bb('0x3e')]=_0x4ffb91[_0x76bb('0x3e')];}}catch(_0x1c40f7){utils[_0x76bb('0x17')](util['format'](_0x76bb('0x3c'),_0x4ffb91[_0x76bb('0x11')]),_0x1c40f7);}}; \ No newline at end of file diff --git a/server/services/xdr/transfers.controller.js b/server/services/xdr/transfers.controller.js index a28085e..8639b37 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 _0x07fd=['secondtransfererexten','origtransferercontext','origtransfererexten','isNil','transfertargetchannel','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','transfertargetexten','transfertargetlinkedid','lodash','util','format','[%s][transfers][writeDB]\x20type:%s','type','attended','origtransfereruniqueid','uniqueid','request','CreateVoiceTransferReport','blindtransfer','debug','[%s][transfers][blindtransfer]','[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridnum','transfereecalleridnum','transfereecalleridname','error','attendedtransfer','[%s][transfers][attendedtransfer]','info','[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','origtransferercalleridnum','origtransferercalleridname','transfertargetcalleridnum','transfertargetcalleridname','assign','origtransfererchannel','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','secondtransferercontext'];(function(_0x4c795b,_0x138e87){var _0x4ba4d8=function(_0x542d51){while(--_0x542d51){_0x4c795b['push'](_0x4c795b['shift']());}};_0x4ba4d8(++_0x138e87);}(_0x07fd,0x1d9));var _0xd07f=function(_0x4aaaaf,_0x64301b){_0x4aaaaf=_0x4aaaaf-0x0;var _0x4dc2a6=_0x07fd[_0x4aaaaf];return _0x4dc2a6;};'use strict';var _=require(_0xd07f('0x0'));var util=require(_0xd07f('0x1'));var utils=require('./utils');function writeDB(_0x1df16f){utils['info'](util[_0xd07f('0x2')](_0xd07f('0x3'),_0x1df16f[_0xd07f('0x4')]===_0xd07f('0x5')?_0x1df16f[_0xd07f('0x6')]:_0x1df16f[_0xd07f('0x7')],_0x1df16f[_0xd07f('0x4')]));utils[_0xd07f('0x8')](_0xd07f('0x9'),_0x1df16f);}exports[_0xd07f('0xa')]=function(_0x9c4d42){try{utils[_0xd07f('0xb')](util[_0xd07f('0x2')](_0xd07f('0xc'),_0x9c4d42['uniqueid']),_0x9c4d42);utils['info'](util['format'](_0xd07f('0xd'),_0x9c4d42[_0xd07f('0x7')],_0x9c4d42[_0xd07f('0xe')],_0x9c4d42['transferercalleridname'],_0x9c4d42[_0xd07f('0xf')],_0x9c4d42[_0xd07f('0x10')]));_0x9c4d42['type']='blind';writeDB(_0x9c4d42);}catch(_0x5a9a67){utils[_0xd07f('0x11')](util[_0xd07f('0x2')](_0xd07f('0xc'),_0x9c4d42['uniqueid']),_0x5a9a67);}};exports[_0xd07f('0x12')]=function(_0x30a429){try{utils['debug'](util[_0xd07f('0x2')](_0xd07f('0x13'),_0x30a429[_0xd07f('0x6')]),_0x30a429);utils[_0xd07f('0x14')](util[_0xd07f('0x2')](_0xd07f('0x15'),_0x30a429[_0xd07f('0x6')],_0x30a429[_0xd07f('0x16')],_0x30a429[_0xd07f('0x17')],_0x30a429[_0xd07f('0x18')],_0x30a429[_0xd07f('0x19')]));_0x30a429=_[_0xd07f('0x1a')](_0x30a429,{'transfererchannel':_0x30a429[_0xd07f('0x1b')],'transferercalleridnum':_0x30a429[_0xd07f('0x16')],'transferercalleridname':_0x30a429['origtransferercalleridname'],'transfererconnectedlinenum':_0x30a429[_0xd07f('0x1c')],'transfererconnectedlinename':_0x30a429[_0xd07f('0x1d')],'transfereraccountcode':_0x30a429['origtransfereraccountcode'],'transferercontext':_0x30a429[_0xd07f('0x1e')],'transfererexten':_0x30a429[_0xd07f('0x1f')],'transfererlinkedid':_0x30a429['origtransfererlinkedid'],'context':_0x30a429[_0xd07f('0x20')],'extension':_0x30a429[_0xd07f('0x21')],'type':_0xd07f('0x5')});if(_[_0xd07f('0x22')](_0x30a429['transfereechannel'])){_0x30a429=_[_0xd07f('0x1a')](_0x30a429,{'transfereechannel':_0x30a429[_0xd07f('0x23')],'transfereecalleridnum':_0x30a429[_0xd07f('0x18')],'transfereecalleridname':_0x30a429[_0xd07f('0x19')],'transfereeconnectedlinenum':_0x30a429[_0xd07f('0x24')],'transfereeconnectedlinename':_0x30a429[_0xd07f('0x25')],'transfereeaccountcode':_0x30a429[_0xd07f('0x26')],'transfereecontext':_0x30a429[_0xd07f('0x27')],'transfereeexten':_0x30a429[_0xd07f('0x28')],'transfereelinkedid':_0x30a429[_0xd07f('0x29')]});}writeDB(_0x30a429);}catch(_0x385ab8){utils['error'](util[_0xd07f('0x2')](_0xd07f('0x13'),_0x30a429[_0xd07f('0x6')]),_0x385ab8);}}; \ No newline at end of file +var _0xda5b=['secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','secondtransfererexten','origtransfererlinkedid','origtransferercontext','origtransfererexten','isNil','transfertargetchannel','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetexten','lodash','format','attended','origtransfereruniqueid','uniqueid','type','CreateVoiceTransferReport','debug','info','[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridname','transfereecalleridnum','transfereecalleridname','error','[%s][transfers][blindtransfer]','attendedtransfer','[%s][transfers][attendedtransfer]','[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','origtransferercalleridnum','transfertargetcalleridnum','transfertargetcalleridname','assign','origtransfererchannel'];(function(_0x12faa3,_0x488e93){var _0x5947d0=function(_0x448306){while(--_0x448306){_0x12faa3['push'](_0x12faa3['shift']());}};_0x5947d0(++_0x488e93);}(_0xda5b,0x1ef));var _0xbda5=function(_0x4f1c6c,_0x1e8f52){_0x4f1c6c=_0x4f1c6c-0x0;var _0x1d9e2a=_0xda5b[_0x4f1c6c];return _0x1d9e2a;};'use strict';var _=require(_0xbda5('0x0'));var util=require('util');var utils=require('./utils');function writeDB(_0x4142dd){utils['info'](util[_0xbda5('0x1')]('[%s][transfers][writeDB]\x20type:%s',_0x4142dd['type']===_0xbda5('0x2')?_0x4142dd[_0xbda5('0x3')]:_0x4142dd[_0xbda5('0x4')],_0x4142dd[_0xbda5('0x5')]));utils['request'](_0xbda5('0x6'),_0x4142dd);}exports['blindtransfer']=function(_0x3566f4){try{utils[_0xbda5('0x7')](util[_0xbda5('0x1')]('[%s][transfers][blindtransfer]',_0x3566f4['uniqueid']),_0x3566f4);utils[_0xbda5('0x8')](util[_0xbda5('0x1')](_0xbda5('0x9'),_0x3566f4['uniqueid'],_0x3566f4['transferercalleridnum'],_0x3566f4[_0xbda5('0xa')],_0x3566f4[_0xbda5('0xb')],_0x3566f4[_0xbda5('0xc')]));_0x3566f4[_0xbda5('0x5')]='blind';writeDB(_0x3566f4);}catch(_0x3c871a){utils[_0xbda5('0xd')](util[_0xbda5('0x1')](_0xbda5('0xe'),_0x3566f4[_0xbda5('0x4')]),_0x3c871a);}};exports[_0xbda5('0xf')]=function(_0x40621f){try{utils['debug'](util[_0xbda5('0x1')](_0xbda5('0x10'),_0x40621f[_0xbda5('0x3')]),_0x40621f);utils['info'](util['format'](_0xbda5('0x11'),_0x40621f[_0xbda5('0x3')],_0x40621f[_0xbda5('0x12')],_0x40621f['origtransferercalleridname'],_0x40621f[_0xbda5('0x13')],_0x40621f[_0xbda5('0x14')]));_0x40621f=_[_0xbda5('0x15')](_0x40621f,{'transfererchannel':_0x40621f[_0xbda5('0x16')],'transferercalleridnum':_0x40621f['origtransferercalleridnum'],'transferercalleridname':_0x40621f['origtransferercalleridname'],'transfererconnectedlinenum':_0x40621f[_0xbda5('0x17')],'transfererconnectedlinename':_0x40621f[_0xbda5('0x18')],'transfereraccountcode':_0x40621f[_0xbda5('0x19')],'transferercontext':_0x40621f[_0xbda5('0x1a')],'transfererexten':_0x40621f[_0xbda5('0x1b')],'transfererlinkedid':_0x40621f[_0xbda5('0x1c')],'context':_0x40621f[_0xbda5('0x1d')],'extension':_0x40621f[_0xbda5('0x1e')],'type':_0xbda5('0x2')});if(_[_0xbda5('0x1f')](_0x40621f['transfereechannel'])){_0x40621f=_['assign'](_0x40621f,{'transfereechannel':_0x40621f[_0xbda5('0x20')],'transfereecalleridnum':_0x40621f['transfertargetcalleridnum'],'transfereecalleridname':_0x40621f[_0xbda5('0x14')],'transfereeconnectedlinenum':_0x40621f[_0xbda5('0x21')],'transfereeconnectedlinename':_0x40621f[_0xbda5('0x22')],'transfereeaccountcode':_0x40621f[_0xbda5('0x23')],'transfereecontext':_0x40621f['transfertargetcontext'],'transfereeexten':_0x40621f[_0xbda5('0x24')],'transfereelinkedid':_0x40621f['transfertargetlinkedid']});}writeDB(_0x40621f);}catch(_0x1abe54){utils[_0xbda5('0xd')](util[_0xbda5('0x1')](_0xbda5('0x10'),_0x40621f[_0xbda5('0x3')]),_0x1abe54);}}; \ No newline at end of file diff --git a/server/services/xdr/utils.js b/server/services/xdr/utils.js index 85f72be..34765d1 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 _0x6c0f=['diff','sumTime','now','YYYY-MM-DD\x20HH:mm:ss','isAfter','isBefore','bluebird','jayson/promise','client','http','../../config/logger','xdr','info','inspect','error','request','then','debug','[utils][request]\x20name:%s','catch','GetUser','internal','name','interface','result','length','getUserByInternal','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','acwTimeout','[utils][getVoiceQueueByName]\x20name:%s','[utils][getVoiceQueueByName]\x20name:%s\x20%s','[utils][getVoiceQueueByName]','seconds','format','subtractTime','subtract','diffTime'];(function(_0x164af1,_0x3cf772){var _0x5d81a2=function(_0xa57547){while(--_0xa57547){_0x164af1['push'](_0x164af1['shift']());}};_0x5d81a2(++_0x3cf772);}(_0x6c0f,0x186));var _0xf6c0=function(_0x1cd565,_0x2b2d3a){_0x1cd565=_0x1cd565-0x0;var _0x5d5715=_0x6c0f[_0x1cd565];return _0x5d5715;};'use strict';var BPromise=require(_0xf6c0('0x0'));var jayson=require(_0xf6c0('0x1'));var moment=require('moment');var util=require('util');var client=jayson[_0xf6c0('0x2')][_0xf6c0('0x3')]({'port':0x2329});var logger=require(_0xf6c0('0x4'))(_0xf6c0('0x5'));exports[_0xf6c0('0x6')]=function(_0x3cb93b,_0x78554d){logger[_0xf6c0('0x6')](_0x3cb93b,_0x78554d?util[_0xf6c0('0x7')](_0x78554d,{'showHidden':![],'depth':null}):'');};exports['debug']=function(_0x1b928d,_0x4d55e6){logger['debug'](_0x1b928d,_0x4d55e6?util[_0xf6c0('0x7')](_0x4d55e6,{'showHidden':![],'depth':null}):'');};exports[_0xf6c0('0x8')]=function(_0x27d781,_0x1df0d1){logger['error'](_0x27d781,_0x1df0d1?util[_0xf6c0('0x7')](_0x1df0d1,{'showHidden':![],'depth':null}):'');};exports[_0xf6c0('0x9')]=function(_0x445e9b,_0x68d9e9){return client[_0xf6c0('0x9')](_0x445e9b,{'body':_0x68d9e9})[_0xf6c0('0xa')](function(_0x4753fa){logger[_0xf6c0('0xb')](_0xf6c0('0xc'),_0x445e9b,_0x4753fa?util['inspect'](_0x4753fa,{'showHidden':![],'depth':null}):'');})[_0xf6c0('0xd')](function(_0x31132d){logger[_0xf6c0('0x8')](_0xf6c0('0xc'),_0x445e9b,_0x31132d?util['inspect'](_0x31132d,{'showHidden':![],'depth':null}):'');});};function getUser(_0x242bba){return client[_0xf6c0('0x9')](_0xf6c0('0xe'),{'options':{'raw':!![],'attributes':['id',_0xf6c0('0xf'),_0xf6c0('0x10'),_0xf6c0('0x11')],'where':_0x242bba,'limit':0x1}})[_0xf6c0('0xa')](function(_0x2a4adc){logger[_0xf6c0('0xb')]('[utils][getUser]\x20where:%s',JSON['stringify'](_0x242bba),_0x2a4adc?util[_0xf6c0('0x7')](_0x2a4adc,{'showHidden':![],'depth':null}):'');return _0x2a4adc[_0xf6c0('0x12')][_0xf6c0('0x13')]?_0x2a4adc[_0xf6c0('0x12')][0x0]:null;});}exports[_0xf6c0('0x14')]=function(_0x1e15ef){return new BPromise(function(_0x1d8089,_0x46b9c7){if(_0x1e15ef){return getUser({'internal':_0x1e15ef})[_0xf6c0('0xa')](function(_0x3f221c){logger[_0xf6c0('0x6')]('[utils][getUserByInternal]\x20internal:%s\x20%s',_0x1e15ef,_0x3f221c?_0xf6c0('0x15'):_0xf6c0('0x16'));return _0x1d8089(_0x3f221c);})['catch'](function(_0x550f55){logger[_0xf6c0('0x8')](_0xf6c0('0x17'),_0x550f55?util[_0xf6c0('0x7')](_0x550f55,{'showHidden':![],'depth':null}):'');return _0x1d8089(null);});}return _0x1d8089(null);});};exports[_0xf6c0('0x18')]=function(_0x1910e5){return new BPromise(function(_0x5e7e6c,_0x803166){if(_0x1910e5){return getUser({'interface':_0x1910e5})[_0xf6c0('0xa')](function(_0x59b4a2){logger[_0xf6c0('0x6')](_0xf6c0('0x19'),_0x1910e5,_0x59b4a2?_0xf6c0('0x15'):_0xf6c0('0x16'));return _0x5e7e6c(_0x59b4a2);})[_0xf6c0('0xd')](function(_0x27d145){logger[_0xf6c0('0x8')](_0xf6c0('0x1a'),_0x27d145?util[_0xf6c0('0x7')](_0x27d145,{'showHidden':![],'depth':null}):'');return _0x5e7e6c(null);});}return _0x5e7e6c(null);});};exports[_0xf6c0('0x1b')]=function(_0x5f14f4){return new BPromise(function(_0x39d65c,_0x1ca2bc){if(_0x5f14f4){return getUser({'name':_0x5f14f4})['then'](function(_0x1eaf69){logger[_0xf6c0('0x6')](_0xf6c0('0x1c'),_0x5f14f4,_0x1eaf69?_0xf6c0('0x15'):_0xf6c0('0x16'));return _0x39d65c(_0x1eaf69);})[_0xf6c0('0xd')](function(_0x17dc9e){logger[_0xf6c0('0x8')](_0xf6c0('0x1d'),_0x17dc9e?util[_0xf6c0('0x7')](_0x17dc9e,{'showHidden':![],'depth':null}):'');return _0x39d65c(null);});}return _0x39d65c(null);});};exports[_0xf6c0('0x1e')]=function(_0x194d23){return new BPromise(function(_0x5121f3,_0x331686){if(_0x194d23){return client[_0xf6c0('0x9')]('GetVoiceQueue',{'options':{'raw':!![],'attributes':['id',_0xf6c0('0x10'),_0xf6c0('0x1f'),_0xf6c0('0x20'),_0xf6c0('0x21')],'where':{'name':_0x194d23},'limit':0x1}})[_0xf6c0('0xa')](function(_0x52c019){logger[_0xf6c0('0xb')](_0xf6c0('0x22'),_0x194d23,_0x52c019?util['inspect'](_0x52c019,{'showHidden':![],'depth':null}):'');logger[_0xf6c0('0x6')](_0xf6c0('0x23'),_0x194d23,_0x52c019?'found':_0xf6c0('0x16'));return _0x5121f3(_0x52c019[_0xf6c0('0x12')]['length']?_0x52c019['result'][0x0]:null);})[_0xf6c0('0xd')](function(_0x2a8613){logger['error'](_0xf6c0('0x24'),_0x2a8613?util['inspect'](_0x2a8613,{'showHidden':![],'depth':null}):'');return _0x5121f3(null);});}return _0x5121f3(null);});};exports['addTime']=function(_0x1535e1,_0x1031b9){return moment(_0x1535e1)['add'](_0x1031b9,_0xf6c0('0x25'))[_0xf6c0('0x26')]('YYYY-MM-DD\x20HH:mm:ss');};exports[_0xf6c0('0x27')]=function(_0x1b6aa7,_0x7a4174){return moment(_0x1b6aa7)[_0xf6c0('0x28')](_0x7a4174,_0xf6c0('0x25'))['format']('YYYY-MM-DD\x20HH:mm:ss');};exports[_0xf6c0('0x29')]=function(_0x2b8160,_0xb16ea1){return moment(_0x2b8160)[_0xf6c0('0x2a')](moment(_0xb16ea1),_0xf6c0('0x25'));};exports[_0xf6c0('0x2b')]=function(_0x2909f1,_0x49721d){return parseInt(_0x2909f1,0xa)+parseInt(_0x49721d,0xa);};exports[_0xf6c0('0x2c')]=function(){return moment()[_0xf6c0('0x26')](_0xf6c0('0x2d'));};exports[_0xf6c0('0x2e')]=function(_0x26fa60,_0x312dea){if(_0x312dea){return moment(_0x26fa60)[_0xf6c0('0x2e')](_0x312dea);}return!![];};exports[_0xf6c0('0x2f')]=function(_0x4cd444,_0x48c0a2){if(_0x48c0a2){return moment(_0x4cd444)[_0xf6c0('0x2f')](_0x48c0a2);}else if(_0x4cd444){return!![];}return![];}; \ No newline at end of file +var _0x85a7=['getUserByName','GetVoiceQueue','type','acw','acwTimeout','[utils][getVoiceQueueByName]\x20name:%s','[utils][getVoiceQueueByName]\x20name:%s\x20%s','[utils][getVoiceQueueByName]','addTime','add','seconds','format','YYYY-MM-DD\x20HH:mm:ss','subtract','diffTime','diff','sumTime','now','isAfter','isBefore','bluebird','jayson/promise','moment','util','http','../../config/logger','info','inspect','debug','error','request','then','catch','[utils][request]\x20name:%s','GetUser','internal','name','interface','[utils][getUser]\x20where:%s','stringify','length','result','getUserByInternal','[utils][getUserByInternal]\x20internal:%s\x20%s','found','notfound','[utils][getUserByInternal]','getUserByInterface','[utils][getUserByInterface]'];(function(_0x28d1ca,_0x1fa182){var _0x34e25d=function(_0x242827){while(--_0x242827){_0x28d1ca['push'](_0x28d1ca['shift']());}};_0x34e25d(++_0x1fa182);}(_0x85a7,0xa7));var _0x785a=function(_0x13ead4,_0x4e6d86){_0x13ead4=_0x13ead4-0x0;var _0x202ca9=_0x85a7[_0x13ead4];return _0x202ca9;};'use strict';var BPromise=require(_0x785a('0x0'));var jayson=require(_0x785a('0x1'));var moment=require(_0x785a('0x2'));var util=require(_0x785a('0x3'));var client=jayson['client'][_0x785a('0x4')]({'port':0x2329});var logger=require(_0x785a('0x5'))('xdr');exports[_0x785a('0x6')]=function(_0x6f673c,_0x189d71){logger['info'](_0x6f673c,_0x189d71?util[_0x785a('0x7')](_0x189d71,{'showHidden':![],'depth':null}):'');};exports[_0x785a('0x8')]=function(_0xcf33a6,_0x30e579){logger['debug'](_0xcf33a6,_0x30e579?util[_0x785a('0x7')](_0x30e579,{'showHidden':![],'depth':null}):'');};exports[_0x785a('0x9')]=function(_0x499863,_0xe28d82){logger[_0x785a('0x9')](_0x499863,_0xe28d82?util[_0x785a('0x7')](_0xe28d82,{'showHidden':![],'depth':null}):'');};exports['request']=function(_0x3c6111,_0x1d9350){return client[_0x785a('0xa')](_0x3c6111,{'body':_0x1d9350})[_0x785a('0xb')](function(_0x5a0a6f){logger[_0x785a('0x8')]('[utils][request]\x20name:%s',_0x3c6111,_0x5a0a6f?util[_0x785a('0x7')](_0x5a0a6f,{'showHidden':![],'depth':null}):'');})[_0x785a('0xc')](function(_0x4b5229){logger[_0x785a('0x9')](_0x785a('0xd'),_0x3c6111,_0x4b5229?util[_0x785a('0x7')](_0x4b5229,{'showHidden':![],'depth':null}):'');});};function getUser(_0x40ba25){return client[_0x785a('0xa')](_0x785a('0xe'),{'options':{'raw':!![],'attributes':['id',_0x785a('0xf'),_0x785a('0x10'),_0x785a('0x11')],'where':_0x40ba25,'limit':0x1}})[_0x785a('0xb')](function(_0x3fdf8f){logger[_0x785a('0x8')](_0x785a('0x12'),JSON[_0x785a('0x13')](_0x40ba25),_0x3fdf8f?util[_0x785a('0x7')](_0x3fdf8f,{'showHidden':![],'depth':null}):'');return _0x3fdf8f['result'][_0x785a('0x14')]?_0x3fdf8f[_0x785a('0x15')][0x0]:null;});}exports[_0x785a('0x16')]=function(_0x1b745b){return new BPromise(function(_0x1ac834,_0x3fda5e){if(_0x1b745b){return getUser({'internal':_0x1b745b})[_0x785a('0xb')](function(_0x441ef0){logger['info'](_0x785a('0x17'),_0x1b745b,_0x441ef0?_0x785a('0x18'):_0x785a('0x19'));return _0x1ac834(_0x441ef0);})[_0x785a('0xc')](function(_0x324b1b){logger['error'](_0x785a('0x1a'),_0x324b1b?util[_0x785a('0x7')](_0x324b1b,{'showHidden':![],'depth':null}):'');return _0x1ac834(null);});}return _0x1ac834(null);});};exports[_0x785a('0x1b')]=function(_0x269860){return new BPromise(function(_0x4cbcd4,_0x4beca9){if(_0x269860){return getUser({'interface':_0x269860})[_0x785a('0xb')](function(_0x3161f7){logger[_0x785a('0x6')]('[utils][getUserByInterface]\x20interface:%s\x20%s',_0x269860,_0x3161f7?'found':_0x785a('0x19'));return _0x4cbcd4(_0x3161f7);})['catch'](function(_0x4b7876){logger[_0x785a('0x9')](_0x785a('0x1c'),_0x4b7876?util['inspect'](_0x4b7876,{'showHidden':![],'depth':null}):'');return _0x4cbcd4(null);});}return _0x4cbcd4(null);});};exports[_0x785a('0x1d')]=function(_0x4718e2){return new BPromise(function(_0x3b05cc,_0x3554cc){if(_0x4718e2){return getUser({'name':_0x4718e2})[_0x785a('0xb')](function(_0x9a2dea){logger[_0x785a('0x6')]('[utils][getUserByName]\x20name:%s\x20%s',_0x4718e2,_0x9a2dea?'found':_0x785a('0x19'));return _0x3b05cc(_0x9a2dea);})[_0x785a('0xc')](function(_0x128853){logger[_0x785a('0x9')]('[utils][getUserByName]',_0x128853?util[_0x785a('0x7')](_0x128853,{'showHidden':![],'depth':null}):'');return _0x3b05cc(null);});}return _0x3b05cc(null);});};exports['getVoiceQueueByName']=function(_0x452ca9){return new BPromise(function(_0x3361df,_0x29284c){if(_0x452ca9){return client['request'](_0x785a('0x1e'),{'options':{'raw':!![],'attributes':['id','name',_0x785a('0x1f'),_0x785a('0x20'),_0x785a('0x21')],'where':{'name':_0x452ca9},'limit':0x1}})['then'](function(_0x333df1){logger[_0x785a('0x8')](_0x785a('0x22'),_0x452ca9,_0x333df1?util[_0x785a('0x7')](_0x333df1,{'showHidden':![],'depth':null}):'');logger[_0x785a('0x6')](_0x785a('0x23'),_0x452ca9,_0x333df1?_0x785a('0x18'):_0x785a('0x19'));return _0x3361df(_0x333df1[_0x785a('0x15')]['length']?_0x333df1['result'][0x0]:null);})[_0x785a('0xc')](function(_0x5b5376){logger['error'](_0x785a('0x24'),_0x5b5376?util[_0x785a('0x7')](_0x5b5376,{'showHidden':![],'depth':null}):'');return _0x3361df(null);});}return _0x3361df(null);});};exports[_0x785a('0x25')]=function(_0x3d68a2,_0x331ba7){return moment(_0x3d68a2)[_0x785a('0x26')](_0x331ba7,_0x785a('0x27'))[_0x785a('0x28')](_0x785a('0x29'));};exports['subtractTime']=function(_0x47d37d,_0x2830d3){return moment(_0x47d37d)[_0x785a('0x2a')](_0x2830d3,_0x785a('0x27'))['format']('YYYY-MM-DD\x20HH:mm:ss');};exports[_0x785a('0x2b')]=function(_0x50d682,_0x9b8677){return moment(_0x50d682)[_0x785a('0x2c')](moment(_0x9b8677),_0x785a('0x27'));};exports[_0x785a('0x2d')]=function(_0x892565,_0x539ee2){return parseInt(_0x892565,0xa)+parseInt(_0x539ee2,0xa);};exports[_0x785a('0x2e')]=function(){return moment()[_0x785a('0x28')](_0x785a('0x29'));};exports[_0x785a('0x2f')]=function(_0x5778e2,_0x5cb2d9){if(_0x5cb2d9){return moment(_0x5778e2)[_0x785a('0x2f')](_0x5cb2d9);}return!![];};exports['isBefore']=function(_0x736c87,_0x3af1f7){if(_0x3af1f7){return moment(_0x736c87)[_0x785a('0x30')](_0x3af1f7);}else if(_0x736c87){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 b319f5d..aa0325c 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 _0x7f13=['headers','x-forwarded-for','connection','remoteAddress','url','statusCode','responseTime','inspect','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)','format','method','device','other','agent_id','agent_name','test','setupLoggers','fs-extra','express-winston','path','fileLogger','./safe-template','safeTemplate','./mask-sensitive-data','join','log','xcally','client','role','name','then','catch','user','no-user','timestamp','error','api','auth','set','use','logger','isEmpty','body','\x20body=%s'];(function(_0x337cd8,_0x5d486e){var _0xacc17b=function(_0x81063a){while(--_0x81063a){_0x337cd8['push'](_0x337cd8['shift']());}};_0xacc17b(++_0x5d486e);}(_0x7f13,0x14d));var _0x37f1=function(_0x2c039a,_0x217a31){_0x2c039a=_0x2c039a-0x0;var _0x3f398f=_0x7f13[_0x2c039a];return _0x3f398f;};var fs=require(_0x37f1('0x0'));var _=require('lodash');var ewinston=require(_0x37f1('0x1'));var path=require(_0x37f1('0x2'));var util=require('util');var fileLogger=require('./loggers')[_0x37f1('0x3')];var safeTemplate=require(_0x37f1('0x4'))[_0x37f1('0x5')];var maskSensitiveData=require(_0x37f1('0x6'))['maskSensitiveData'];function ClientSideLogger(){function _0x45fe77(_0x55622c){var _0x1a9437=path[_0x37f1('0x7')]('/var',_0x37f1('0x8'),_0x37f1('0x9'));var _0xd339e0=path['join'](_0x37f1('0xa'),_0x55622c[_0x37f1('0xb')]+'-'+_0x55622c[_0x37f1('0xc')]);return fs['ensureDir'](path['join'](_0x1a9437,_0xd339e0))[_0x37f1('0xd')](function(){var _0x4a92d0=fileLogger('client',path[_0x37f1('0x7')](_0x1a9437,_0xd339e0));return _0x4a92d0;})[_0x37f1('0xe')](function(_0xb31d6f){throw _0xb31d6f;});}this[_0x37f1('0x8')]=function(_0x35af27,_0x1dfabd,_0xd6e97a,_0x20c13e){return _0x45fe77(_0x35af27[_0x37f1('0xf')])[_0x37f1('0xd')](function(_0x157799){var _0x37da21=_0x157799[_0x1dfabd];return _0x37da21;})[_0x37f1('0xd')](function(_0x36268c){var _0x595749=_0x35af27[_0x37f1('0xf')]?_0x35af27[_0x37f1('0xf')]['id']:_0x37f1('0x10');var _0x5768f2=_0x20c13e['data'];var _0x282f08=_0x20c13e[_0x37f1('0x11')];var _0x55bf02=new Date(Number(_0x282f08));return _0x36268c(_0x595749,_0x55bf02,_0xd6e97a,_0x5768f2);})[_0x37f1('0xe')](function(_0x3dfdf3){fileLogger(_0x37f1('0xa'))[_0x37f1('0x12')](_0x3dfdf3);});};}function setupLoggers(_0xa37a6a){return new Promise(function(_0x5df09b){var _0x471a24=new ClientSideLogger();var _0xe89773=fileLogger(_0x37f1('0x13'));var _0x1c3d68=fileLogger(_0x37f1('0x14'));_0xa37a6a[_0x37f1('0x15')]('client-side-logger',_0x471a24);_0xa37a6a[_0x37f1('0x16')](ewinston[_0x37f1('0x17')]({'winstonInstance':_0xe89773,'meta':![],'statusLevels':!![],'msg':function(_0x1e13a2,_0x154614){var _0x324e69='%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s';if(!_[_0x37f1('0x18')](_0x1e13a2[_0x37f1('0x19')])){_0x324e69+=_0x37f1('0x1a');var _0x2d0420=_0x1e13a2[_0x37f1('0x19')];maskSensitiveData(_0x2d0420);}return safeTemplate(util['format'](_0x324e69,_0x1e13a2['method'],_0x1e13a2[_0x37f1('0x1b')]['x-forwarded-for']?_0x1e13a2['headers'][_0x37f1('0x1c')]:_0x1e13a2[_0x37f1('0x1d')][_0x37f1('0x1e')]||_0x1e13a2['ip'],_0x1e13a2[_0x37f1('0x1f')],_0x154614[_0x37f1('0x20')],_0x154614[_0x37f1('0x21')],_0x1e13a2[_0x37f1('0xf')]?_0x1e13a2['user']['id']:null,_0x1e13a2[_0x37f1('0xf')]?_0x1e13a2['user'][_0x37f1('0xc')]:null,_0x1e13a2[_0x37f1('0xf')]?_0x1e13a2[_0x37f1('0xf')][_0x37f1('0xb')]:null,_0x2d0420?util[_0x37f1('0x22')](_0x2d0420,![],null):''));}}));_0xa37a6a[_0x37f1('0x16')](ewinston[_0x37f1('0x17')]({'winstonInstance':_0x1c3d68,'meta':![],'statusLevels':!![],'msg':function(_0x1909d9,_0x573916){var _0x3077ee=_0x37f1('0x23');if(_0x1909d9['body']&&_0x1909d9[_0x37f1('0x19')]['device']&&_0x1909d9[_0x37f1('0x19')]['agent_id']){_0x3077ee=_0x37f1('0x24');}return util[_0x37f1('0x25')](_0x3077ee,_0x1909d9[_0x37f1('0x26')],_0x1909d9[_0x37f1('0x1b')]['x-forwarded-for']?_0x1909d9[_0x37f1('0x1b')][_0x37f1('0x1c')]:_0x1909d9[_0x37f1('0x1d')][_0x37f1('0x1e')]||_0x1909d9['ip'],_0x1909d9['url'],_0x573916[_0x37f1('0x20')],_0x573916['responseTime'],_0x1909d9[_0x37f1('0xf')]?_0x1909d9[_0x37f1('0xf')]['id']:null,_0x1909d9[_0x37f1('0xf')]?_0x1909d9[_0x37f1('0xf')][_0x37f1('0xc')]:null,_0x1909d9[_0x37f1('0xf')]?_0x1909d9['user'][_0x37f1('0xb')]:null,_0x1909d9[_0x37f1('0x19')]&&_0x1909d9[_0x37f1('0x19')]['device']?_0x1909d9[_0x37f1('0x19')][_0x37f1('0x27')]:_0x37f1('0x28'),_0x1909d9[_0x37f1('0x19')]&&_0x1909d9[_0x37f1('0x19')][_0x37f1('0x29')]?_0x1909d9[_0x37f1('0x19')][_0x37f1('0x29')]:'',_0x1909d9[_0x37f1('0x19')]&&_0x1909d9[_0x37f1('0x19')][_0x37f1('0x2a')]?_0x1909d9['body']['agent_name']:'');},'ignoreRoute':function(_0x36eb42){var _0x46b84c=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x46b84c[_0x37f1('0x2b')](_0x36eb42[_0x37f1('0x1f')]);}}));return _0x5df09b();});}exports[_0x37f1('0x2c')]=setupLoggers; \ No newline at end of file +var _0x9a46=['data','timestamp','auth','set','logger','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s','isEmpty','body','format','method','headers','x-forwarded-for','statusCode','responseTime','inspect','use','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s','device','agent_id','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)','connection','remoteAddress','url','other','agent_name','test','setupLoggers','fs-extra','express-winston','path','util','./loggers','fileLogger','./safe-template','safeTemplate','./mask-sensitive-data','maskSensitiveData','join','/var','log','xcally','client','role','name','ensureDir','then','catch','user','no-user'];(function(_0xfa634c,_0x414e0e){var _0x73e478=function(_0xac2a51){while(--_0xac2a51){_0xfa634c['push'](_0xfa634c['shift']());}};_0x73e478(++_0x414e0e);}(_0x9a46,0x172));var _0x69a4=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x9a46[_0x20a584];return _0x4b41a8;};var fs=require(_0x69a4('0x0'));var _=require('lodash');var ewinston=require(_0x69a4('0x1'));var path=require(_0x69a4('0x2'));var util=require(_0x69a4('0x3'));var fileLogger=require(_0x69a4('0x4'))[_0x69a4('0x5')];var safeTemplate=require(_0x69a4('0x6'))[_0x69a4('0x7')];var maskSensitiveData=require(_0x69a4('0x8'))[_0x69a4('0x9')];function ClientSideLogger(){function _0x4d5d9(_0x48da8b){var _0x32c2aa=path[_0x69a4('0xa')](_0x69a4('0xb'),_0x69a4('0xc'),_0x69a4('0xd'));var _0x2e423d=path[_0x69a4('0xa')](_0x69a4('0xe'),_0x48da8b[_0x69a4('0xf')]+'-'+_0x48da8b[_0x69a4('0x10')]);return fs[_0x69a4('0x11')](path[_0x69a4('0xa')](_0x32c2aa,_0x2e423d))[_0x69a4('0x12')](function(){var _0x384dab=fileLogger(_0x69a4('0xe'),path[_0x69a4('0xa')](_0x32c2aa,_0x2e423d));return _0x384dab;})[_0x69a4('0x13')](function(_0x1a91b6){throw _0x1a91b6;});}this[_0x69a4('0xc')]=function(_0x4eb13d,_0x483dcf,_0x44207e,_0x1ca875){return _0x4d5d9(_0x4eb13d[_0x69a4('0x14')])[_0x69a4('0x12')](function(_0x4f73f3){var _0x21018f=_0x4f73f3[_0x483dcf];return _0x21018f;})[_0x69a4('0x12')](function(_0xb88ba0){var _0x20334b=_0x4eb13d[_0x69a4('0x14')]?_0x4eb13d[_0x69a4('0x14')]['id']:_0x69a4('0x15');var _0x34f255=_0x1ca875[_0x69a4('0x16')];var _0x57df06=_0x1ca875[_0x69a4('0x17')];var _0x3721f9=new Date(Number(_0x57df06));return _0xb88ba0(_0x20334b,_0x3721f9,_0x44207e,_0x34f255);})['catch'](function(_0x755252){fileLogger(_0x69a4('0xe'))['error'](_0x755252);});};}function setupLoggers(_0x1018a8){return new Promise(function(_0x56f872){var _0x3d1991=new ClientSideLogger();var _0x3b6886=fileLogger('api');var _0x5390a3=fileLogger(_0x69a4('0x18'));_0x1018a8[_0x69a4('0x19')]('client-side-logger',_0x3d1991);_0x1018a8['use'](ewinston[_0x69a4('0x1a')]({'winstonInstance':_0x3b6886,'meta':![],'statusLevels':!![],'msg':function(_0x42870a,_0x224d06){var _0x3c0dc4=_0x69a4('0x1b');if(!_[_0x69a4('0x1c')](_0x42870a[_0x69a4('0x1d')])){_0x3c0dc4+='\x20body=%s';var _0x50ab94=_0x42870a[_0x69a4('0x1d')];maskSensitiveData(_0x50ab94);}return safeTemplate(util[_0x69a4('0x1e')](_0x3c0dc4,_0x42870a[_0x69a4('0x1f')],_0x42870a[_0x69a4('0x20')][_0x69a4('0x21')]?_0x42870a[_0x69a4('0x20')][_0x69a4('0x21')]:_0x42870a['connection']['remoteAddress']||_0x42870a['ip'],_0x42870a['url'],_0x224d06[_0x69a4('0x22')],_0x224d06[_0x69a4('0x23')],_0x42870a['user']?_0x42870a['user']['id']:null,_0x42870a[_0x69a4('0x14')]?_0x42870a['user'][_0x69a4('0x10')]:null,_0x42870a[_0x69a4('0x14')]?_0x42870a[_0x69a4('0x14')][_0x69a4('0xf')]:null,_0x50ab94?util[_0x69a4('0x24')](_0x50ab94,![],null):''));}}));_0x1018a8[_0x69a4('0x25')](ewinston[_0x69a4('0x1a')]({'winstonInstance':_0x5390a3,'meta':![],'statusLevels':!![],'msg':function(_0x39174b,_0x50ba8e){var _0x2f3dd3=_0x69a4('0x26');if(_0x39174b[_0x69a4('0x1d')]&&_0x39174b[_0x69a4('0x1d')][_0x69a4('0x27')]&&_0x39174b[_0x69a4('0x1d')][_0x69a4('0x28')]){_0x2f3dd3=_0x69a4('0x29');}return util[_0x69a4('0x1e')](_0x2f3dd3,_0x39174b[_0x69a4('0x1f')],_0x39174b[_0x69a4('0x20')]['x-forwarded-for']?_0x39174b[_0x69a4('0x20')][_0x69a4('0x21')]:_0x39174b[_0x69a4('0x2a')][_0x69a4('0x2b')]||_0x39174b['ip'],_0x39174b[_0x69a4('0x2c')],_0x50ba8e[_0x69a4('0x22')],_0x50ba8e[_0x69a4('0x23')],_0x39174b[_0x69a4('0x14')]?_0x39174b[_0x69a4('0x14')]['id']:null,_0x39174b[_0x69a4('0x14')]?_0x39174b[_0x69a4('0x14')][_0x69a4('0x10')]:null,_0x39174b[_0x69a4('0x14')]?_0x39174b[_0x69a4('0x14')]['role']:null,_0x39174b[_0x69a4('0x1d')]&&_0x39174b[_0x69a4('0x1d')]['device']?_0x39174b[_0x69a4('0x1d')][_0x69a4('0x27')]:_0x69a4('0x2d'),_0x39174b[_0x69a4('0x1d')]&&_0x39174b['body'][_0x69a4('0x28')]?_0x39174b[_0x69a4('0x1d')][_0x69a4('0x28')]:'',_0x39174b['body']&&_0x39174b['body'][_0x69a4('0x2e')]?_0x39174b[_0x69a4('0x1d')][_0x69a4('0x2e')]:'');},'ignoreRoute':function(_0x7f4794){var _0x27b508=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x27b508[_0x69a4('0x2f')](_0x7f4794['url']);}}));return _0x56f872();});}exports[_0x69a4('0x30')]=setupLoggers; \ No newline at end of file diff --git a/server/utils/iftime.js b/server/utils/iftime.js index 1dd081c..8d2c171 100644 --- a/server/utils/iftime.js +++ b/server/utils/iftime.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0f7a=['daysInMonth','min','max','domCompare','MMM','includes','guess','isMoment','padStart','length','lodash','moment-timezone','map','source','join','Interval\x20string\x20not\x20valid','Date\x20not\x20valid','isValid','split','locale','weekdaysShort','toLowerCase','indexOf','slice','concat','exports','circularDoWInterval','circularMonthInterval','clone','hours','minutes','startOf','day','endOf','isBetween','timeCompare','format','ddd'];(function(_0x19911e,_0x4ee7ce){var _0x24cfeb=function(_0x30bebc){while(--_0x30bebc){_0x19911e['push'](_0x19911e['shift']());}};_0x24cfeb(++_0x4ee7ce);}(_0x0f7a,0x114));var _0xa0f7=function(_0x3a71c7,_0x48599b){_0x3a71c7=_0x3a71c7-0x0;var _0xc8ff43=_0x0f7a[_0x3a71c7];return _0xc8ff43;};var _=require(_0xa0f7('0x0'));var moment=require(_0xa0f7('0x1'));var timeRx=/(\*|(\d{1,2}:\d{1,2})(-(\d{1,2}:\d{1,2}))?)/;var dowRx=/(\*|((sun|mon|tue|wed|thu|fri|sat)(-(sun|mon|tue|wed|thu|fri|sat))?))/;var domRx=/(\*|(\d{1,2})(-(\d{1,2}))?)/;var moyRx=/(\*|(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)(-(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec))?)/;var globalRx=[timeRx,dowRx,domRx,moyRx][_0xa0f7('0x2')](function(_0x812203){return _0x812203[_0xa0f7('0x3')];})[_0xa0f7('0x4')](',');var validateRx=new RegExp('^'+globalRx+'$');var EINVALID_STRING=_0xa0f7('0x5');var EINVALID_DATE=_0xa0f7('0x6');function throwIfDateNotValid(_0x527207){if(!_0x527207[_0xa0f7('0x7')]()){throw new Error(EINVALID_DATE);}}function extractTime(_0x4f9eea){var _0x23015b=_0x4f9eea[_0xa0f7('0x8')](':')[_0xa0f7('0x2')](function(_0x5d0fa6){return parseInt(_0x5d0fa6,0xa);});var _0x2ee747=_0x23015b[0x0];var _0x44a236=_0x23015b[0x1];if(_0x2ee747<0x0||_0x2ee747>0x17||_0x44a236<0x0||_0x44a236>0x3b){throw new Error(EINVALID_DATE);}return[_0x2ee747,_0x44a236];}function circularDoWInterval(_0x98edd3,_0x151fa4){if(_0x98edd3===_0x151fa4){return[_0x98edd3];}else{var _0x1eb710=moment['locale']();moment[_0xa0f7('0x9')]('en');var _0x4874d4=moment[_0xa0f7('0xa')]()[_0xa0f7('0x2')](function(_0x5cdb15){return _0x5cdb15[_0xa0f7('0xb')]();});moment[_0xa0f7('0x9')](_0x1eb710);var _0x427c9b=_0x4874d4[_0xa0f7('0xc')](_0x98edd3);var _0x385a2d=_0x4874d4['indexOf'](_0x151fa4);if(_0x385a2d>_0x427c9b){return _0x4874d4[_0xa0f7('0xd')](_0x427c9b,_0x385a2d+0x1);}else{var _0x5ba9ac=_0x4874d4[_0xa0f7('0xd')](0x0,_0x385a2d+0x1);var _0x4ecc3d=_0x4874d4[_0xa0f7('0xd')](_0x427c9b);return _0x4ecc3d[_0xa0f7('0xe')](_0x5ba9ac);}}}module[_0xa0f7('0xf')][_0xa0f7('0x10')]=circularDoWInterval;function circularMonthInterval(_0x4fea3f,_0x23587e){if(_0x4fea3f===_0x23587e){return[_0x4fea3f];}else{var _0x23d286=moment[_0xa0f7('0x9')]();moment[_0xa0f7('0x9')]('en');var _0x494c94=moment['monthsShort']()[_0xa0f7('0x2')](function(_0x251bbd){return _0x251bbd[_0xa0f7('0xb')]();});moment['locale'](_0x23d286);var _0x36621e=_0x494c94[_0xa0f7('0xc')](_0x4fea3f);var _0x2f0c92=_0x494c94[_0xa0f7('0xc')](_0x23587e);if(_0x2f0c92>_0x36621e){return _0x494c94['slice'](_0x36621e,_0x2f0c92+0x1);}else{var _0x1dac8b=_0x494c94['slice'](0x0,_0x2f0c92+0x1);var _0x545e35=_0x494c94['slice'](_0x36621e);return _0x545e35[_0xa0f7('0xe')](_0x1dac8b);}}}module[_0xa0f7('0xf')][_0xa0f7('0x11')]=circularMonthInterval;function parseDom(_0x207709){var _0x3fda73=parseInt(_0x207709,0xa);if(_0x3fda73<0x1||_0x3fda73>0x1f){throw new Error(EINVALID_DATE);}return _0x3fda73;}function timeCompare(_0x42318c,_0x155cad,_0x455573){var _0x5dc19f=_0x42318c[_0xa0f7('0x12')]();var _0x1f1618=extractTime(_0x155cad);var _0x4ea4db=_0x1f1618[0x0];var _0x3a7d6f=_0x1f1618[0x1];var _0x1a3c9a=_0x42318c[_0xa0f7('0x12')]()[_0xa0f7('0x13')](_0x4ea4db)[_0xa0f7('0x14')](_0x3a7d6f);throwIfDateNotValid(_0x1a3c9a);var _0x52cd15=extractTime(_0x455573);var _0x31b7d8=_0x52cd15[0x0];var _0x11f52f=_0x52cd15[0x1];var _0x12413a=_0x42318c[_0xa0f7('0x12')]()['hours'](_0x31b7d8)[_0xa0f7('0x14')](_0x11f52f);throwIfDateNotValid(_0x12413a);if(_0x12413a['isBefore'](_0x1a3c9a)){var _0x14a10e=_0x5dc19f[_0xa0f7('0x12')]()[_0xa0f7('0x15')](_0xa0f7('0x16'));var _0x1cb782=_0x5dc19f[_0xa0f7('0x12')]()[_0xa0f7('0x17')]('day');return _0x5dc19f[_0xa0f7('0x18')](_0x1a3c9a,_0x1cb782,undefined,'[]')||_0x5dc19f[_0xa0f7('0x18')](_0x14a10e,_0x12413a,undefined,'[]');}else{return _0x5dc19f['isBetween'](_0x1a3c9a,_0x12413a,undefined,'[]');}}module[_0xa0f7('0xf')][_0xa0f7('0x19')]=timeCompare;function dowCompare(_0x30fb16,_0x2d4b2b,_0x5e5bd3){var _0x1196ac=_0x30fb16['locale']('en')[_0xa0f7('0x1a')](_0xa0f7('0x1b'))[_0xa0f7('0xb')]();return circularDoWInterval(_0x2d4b2b,_0x5e5bd3)['includes'](_0x1196ac);}module[_0xa0f7('0xf')]['dowCompare']=dowCompare;function domCompare(_0x48eb7a,_0x2465c2,_0x10c28f){var _0x269a35=_0x48eb7a['date']();if(_0x2465c2===_0x10c28f){return _0x269a35===_0x2465c2;}else{var _0x1704c1=_0x48eb7a[_0xa0f7('0x1c')]();var _0x2fb14a=_0x2465c2<_0x10c28f;let _0x577207=![];var _0x129145=0x0;var _0x59b251=0x0;if(_0x2fb14a){_0x129145=Math['max'](0x1,_0x2465c2);_0x59b251=Math[_0xa0f7('0x1d')](_0x10c28f,_0x1704c1);_0x577207=_0x269a35>=_0x129145&&_0x269a35<=_0x59b251;}else{_0x129145=Math['min'](_0x2465c2,_0x1704c1);_0x59b251=Math[_0xa0f7('0x1e')](0x1,_0x10c28f);_0x577207=_0x269a35>=_0x129145||_0x269a35<=_0x59b251;}return _0x577207;}}module[_0xa0f7('0xf')][_0xa0f7('0x1f')]=domCompare;function monthCompare(_0x160334,_0x352be8,_0x254d14){var _0x30a3d6=_0x160334['locale']('en')[_0xa0f7('0x1a')](_0xa0f7('0x20'))[_0xa0f7('0xb')]();return circularMonthInterval(_0x352be8,_0x254d14)[_0xa0f7('0x21')](_0x30a3d6);}module[_0xa0f7('0xf')]['monthCompare']=monthCompare;function iftime(_0x1b2526,_0x38f54a=moment['tz'][_0xa0f7('0x22')](),_0x107612=moment()){if(!validateRx['test'](_0x1b2526)){throw new Error(EINVALID_STRING);}else{var _0x2a08e3=(moment[_0xa0f7('0x23')](_0x107612)?_0x107612['clone']():moment(_0x107612))['tz'](_0x38f54a)[_0xa0f7('0x9')]('en');throwIfDateNotValid(_0x2a08e3);var _0x4804f5=_0x1b2526[_0xa0f7('0x8')](',');var _0x2f905e=_0x4804f5[0x0];var _0x2580ee=_0x4804f5[0x1];var _0x379cbc=_0x4804f5[0x2];var _0x5a4f6c=_0x4804f5[0x3];let _0x415a36=!![];if(_0x2f905e!=='*'){var _0x29dbb0=_0x2f905e[_0xa0f7('0x8')]('-');var _0x3d9dfa=_[_0xa0f7('0x24')](_0x29dbb0[0x0],0x5,'0');var _0xda4888=_0x29dbb0[_0xa0f7('0x25')]===0x2?_['padStart'](_0x29dbb0[0x1],0x5,'0'):_0x3d9dfa;_0x415a36=timeCompare(_0x2a08e3,_0x3d9dfa,_0xda4888);}let _0x4baf94=!![];if(_0x2580ee!=='*'){var _0x4662d9=_0x2580ee[_0xa0f7('0x8')]('-');var _0x1f02ff=_0x4662d9[0x0];var _0x4eeb79=_0x4662d9[_0xa0f7('0x25')]===0x2?_0x4662d9[0x1]:_0x1f02ff;_0x4baf94=dowCompare(_0x2a08e3,_0x1f02ff,_0x4eeb79);}let _0x224400=!![];if(_0x379cbc!=='*'){var _0x4c8a19=_0x379cbc[_0xa0f7('0x8')]('-');var _0x3cb740=parseDom(_0x4c8a19[0x0]);var _0x3ef89b=_0x4c8a19[_0xa0f7('0x25')]===0x2?parseDom(_0x4c8a19[0x1]):_0x3cb740;_0x224400=domCompare(_0x2a08e3,_0x3cb740,_0x3ef89b);}let _0x41e222=!![];if(_0x5a4f6c!=='*'){var _0x233f19=_0x5a4f6c['split']('-');var _0x598792=_0x233f19[0x0];var _0x5e8b5d=_0x233f19[_0xa0f7('0x25')]===0x2?_0x233f19[0x1]:_0x233f19[0x0];_0x41e222=monthCompare(_0x2a08e3,_0x598792,_0x5e8b5d);}return _0x415a36&&_0x4baf94&&_0x224400&&_0x41e222;}}module['exports']['iftime']=iftime; \ No newline at end of file +var _0xfa32=['length','iftime','lodash','map','source','join','Date\x20not\x20valid','isValid','split','locale','weekdaysShort','toLowerCase','indexOf','slice','exports','circularDoWInterval','concat','circularMonthInterval','clone','hours','minutes','startOf','isBetween','timeCompare','format','date','daysInMonth','max','min','domCompare','MMM','includes','monthCompare','guess','test','isMoment','padStart'];(function(_0x622035,_0x1a4b91){var _0x326cf2=function(_0x5c3002){while(--_0x5c3002){_0x622035['push'](_0x622035['shift']());}};_0x326cf2(++_0x1a4b91);}(_0xfa32,0x1e3));var _0x2fa3=function(_0x464167,_0x2133cd){_0x464167=_0x464167-0x0;var _0x3442b7=_0xfa32[_0x464167];return _0x3442b7;};var _=require(_0x2fa3('0x0'));var moment=require('moment-timezone');var timeRx=/(\*|(\d{1,2}:\d{1,2})(-(\d{1,2}:\d{1,2}))?)/;var dowRx=/(\*|((sun|mon|tue|wed|thu|fri|sat)(-(sun|mon|tue|wed|thu|fri|sat))?))/;var domRx=/(\*|(\d{1,2})(-(\d{1,2}))?)/;var moyRx=/(\*|(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)(-(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec))?)/;var globalRx=[timeRx,dowRx,domRx,moyRx][_0x2fa3('0x1')](function(_0x55f628){return _0x55f628[_0x2fa3('0x2')];})[_0x2fa3('0x3')](',');var validateRx=new RegExp('^'+globalRx+'$');var EINVALID_STRING='Interval\x20string\x20not\x20valid';var EINVALID_DATE=_0x2fa3('0x4');function throwIfDateNotValid(_0x42fffb){if(!_0x42fffb[_0x2fa3('0x5')]()){throw new Error(EINVALID_DATE);}}function extractTime(_0x191ef4){var _0x1f5109=_0x191ef4[_0x2fa3('0x6')](':')['map'](function(_0x39e633){return parseInt(_0x39e633,0xa);});var _0x3e11b6=_0x1f5109[0x0];var _0xb38aa9=_0x1f5109[0x1];if(_0x3e11b6<0x0||_0x3e11b6>0x17||_0xb38aa9<0x0||_0xb38aa9>0x3b){throw new Error(EINVALID_DATE);}return[_0x3e11b6,_0xb38aa9];}function circularDoWInterval(_0x49f7b8,_0x23426d){if(_0x49f7b8===_0x23426d){return[_0x49f7b8];}else{var _0x399c98=moment[_0x2fa3('0x7')]();moment[_0x2fa3('0x7')]('en');var _0x97564b=moment[_0x2fa3('0x8')]()[_0x2fa3('0x1')](function(_0x34581c){return _0x34581c[_0x2fa3('0x9')]();});moment[_0x2fa3('0x7')](_0x399c98);var _0x5c9e09=_0x97564b[_0x2fa3('0xa')](_0x49f7b8);var _0x523ea3=_0x97564b[_0x2fa3('0xa')](_0x23426d);if(_0x523ea3>_0x5c9e09){return _0x97564b[_0x2fa3('0xb')](_0x5c9e09,_0x523ea3+0x1);}else{var _0x134363=_0x97564b[_0x2fa3('0xb')](0x0,_0x523ea3+0x1);var _0x3c8754=_0x97564b[_0x2fa3('0xb')](_0x5c9e09);return _0x3c8754['concat'](_0x134363);}}}module[_0x2fa3('0xc')][_0x2fa3('0xd')]=circularDoWInterval;function circularMonthInterval(_0x36e3f2,_0x478814){if(_0x36e3f2===_0x478814){return[_0x36e3f2];}else{var _0x406811=moment[_0x2fa3('0x7')]();moment[_0x2fa3('0x7')]('en');var _0x1ea7c4=moment['monthsShort']()[_0x2fa3('0x1')](function(_0x52ab51){return _0x52ab51[_0x2fa3('0x9')]();});moment[_0x2fa3('0x7')](_0x406811);var _0x49ec41=_0x1ea7c4[_0x2fa3('0xa')](_0x36e3f2);var _0x31ae19=_0x1ea7c4[_0x2fa3('0xa')](_0x478814);if(_0x31ae19>_0x49ec41){return _0x1ea7c4[_0x2fa3('0xb')](_0x49ec41,_0x31ae19+0x1);}else{var _0x4d1d0e=_0x1ea7c4['slice'](0x0,_0x31ae19+0x1);var _0x1ad5f9=_0x1ea7c4[_0x2fa3('0xb')](_0x49ec41);return _0x1ad5f9[_0x2fa3('0xe')](_0x4d1d0e);}}}module[_0x2fa3('0xc')][_0x2fa3('0xf')]=circularMonthInterval;function parseDom(_0x4e9811){var _0x9a1037=parseInt(_0x4e9811,0xa);if(_0x9a1037<0x1||_0x9a1037>0x1f){throw new Error(EINVALID_DATE);}return _0x9a1037;}function timeCompare(_0x42b2d3,_0x5be0d2,_0xbb78f4){var _0x19ffab=_0x42b2d3['clone']();var _0x21815b=extractTime(_0x5be0d2);var _0x26dc96=_0x21815b[0x0];var _0x5a3245=_0x21815b[0x1];var _0x288b17=_0x42b2d3[_0x2fa3('0x10')]()[_0x2fa3('0x11')](_0x26dc96)['minutes'](_0x5a3245);throwIfDateNotValid(_0x288b17);var _0x339fa7=extractTime(_0xbb78f4);var _0x17c31a=_0x339fa7[0x0];var _0x506f5d=_0x339fa7[0x1];var _0x32ed0e=_0x42b2d3['clone']()['hours'](_0x17c31a)[_0x2fa3('0x12')](_0x506f5d);throwIfDateNotValid(_0x32ed0e);if(_0x32ed0e['isBefore'](_0x288b17)){var _0x3fd4b6=_0x19ffab[_0x2fa3('0x10')]()[_0x2fa3('0x13')]('day');var _0x5659df=_0x19ffab[_0x2fa3('0x10')]()['endOf']('day');return _0x19ffab['isBetween'](_0x288b17,_0x5659df,undefined,'[]')||_0x19ffab[_0x2fa3('0x14')](_0x3fd4b6,_0x32ed0e,undefined,'[]');}else{return _0x19ffab[_0x2fa3('0x14')](_0x288b17,_0x32ed0e,undefined,'[]');}}module['exports'][_0x2fa3('0x15')]=timeCompare;function dowCompare(_0x50f570,_0xeb51fe,_0x1652d2){var _0x3adab7=_0x50f570[_0x2fa3('0x7')]('en')[_0x2fa3('0x16')]('ddd')[_0x2fa3('0x9')]();return circularDoWInterval(_0xeb51fe,_0x1652d2)['includes'](_0x3adab7);}module[_0x2fa3('0xc')]['dowCompare']=dowCompare;function domCompare(_0x2c8950,_0x15559d,_0xa55a9e){var _0x111c1c=_0x2c8950[_0x2fa3('0x17')]();if(_0x15559d===_0xa55a9e){return _0x111c1c===_0x15559d;}else{var _0x2cf99f=_0x2c8950[_0x2fa3('0x18')]();var _0x3be7eb=_0x15559d<_0xa55a9e;let _0x1eeddc=![];var _0x57943c=0x0;var _0x31b04f=0x0;if(_0x3be7eb){_0x57943c=Math[_0x2fa3('0x19')](0x1,_0x15559d);_0x31b04f=Math[_0x2fa3('0x1a')](_0xa55a9e,_0x2cf99f);_0x1eeddc=_0x111c1c>=_0x57943c&&_0x111c1c<=_0x31b04f;}else{_0x57943c=Math[_0x2fa3('0x1a')](_0x15559d,_0x2cf99f);_0x31b04f=Math[_0x2fa3('0x19')](0x1,_0xa55a9e);_0x1eeddc=_0x111c1c>=_0x57943c||_0x111c1c<=_0x31b04f;}return _0x1eeddc;}}module[_0x2fa3('0xc')][_0x2fa3('0x1b')]=domCompare;function monthCompare(_0x5f1961,_0x14fdcf,_0x51bf98){var _0x1bbb23=_0x5f1961[_0x2fa3('0x7')]('en')[_0x2fa3('0x16')](_0x2fa3('0x1c'))[_0x2fa3('0x9')]();return circularMonthInterval(_0x14fdcf,_0x51bf98)[_0x2fa3('0x1d')](_0x1bbb23);}module[_0x2fa3('0xc')][_0x2fa3('0x1e')]=monthCompare;function iftime(_0x44121c,_0x5eee98=moment['tz'][_0x2fa3('0x1f')](),_0x37e251=moment()){if(!validateRx[_0x2fa3('0x20')](_0x44121c)){throw new Error(EINVALID_STRING);}else{var _0x15d9d6=(moment[_0x2fa3('0x21')](_0x37e251)?_0x37e251[_0x2fa3('0x10')]():moment(_0x37e251))['tz'](_0x5eee98)[_0x2fa3('0x7')]('en');throwIfDateNotValid(_0x15d9d6);var _0x450fb7=_0x44121c[_0x2fa3('0x6')](',');var _0xd221ef=_0x450fb7[0x0];var _0x5d8dd2=_0x450fb7[0x1];var _0x5bfadb=_0x450fb7[0x2];var _0x5e5f2e=_0x450fb7[0x3];let _0x273084=!![];if(_0xd221ef!=='*'){var _0x51b43f=_0xd221ef[_0x2fa3('0x6')]('-');var _0x545d67=_[_0x2fa3('0x22')](_0x51b43f[0x0],0x5,'0');var _0xe26463=_0x51b43f[_0x2fa3('0x23')]===0x2?_[_0x2fa3('0x22')](_0x51b43f[0x1],0x5,'0'):_0x545d67;_0x273084=timeCompare(_0x15d9d6,_0x545d67,_0xe26463);}let _0x2a2f33=!![];if(_0x5d8dd2!=='*'){var _0x3bb84a=_0x5d8dd2['split']('-');var _0x2fca9a=_0x3bb84a[0x0];var _0x6b5138=_0x3bb84a[_0x2fa3('0x23')]===0x2?_0x3bb84a[0x1]:_0x2fca9a;_0x2a2f33=dowCompare(_0x15d9d6,_0x2fca9a,_0x6b5138);}let _0x36f549=!![];if(_0x5bfadb!=='*'){var _0x5b8437=_0x5bfadb[_0x2fa3('0x6')]('-');var _0x5ecac6=parseDom(_0x5b8437[0x0]);var _0xbea82d=_0x5b8437[_0x2fa3('0x23')]===0x2?parseDom(_0x5b8437[0x1]):_0x5ecac6;_0x36f549=domCompare(_0x15d9d6,_0x5ecac6,_0xbea82d);}let _0x24ae0e=!![];if(_0x5e5f2e!=='*'){var _0x596da5=_0x5e5f2e[_0x2fa3('0x6')]('-');var _0x12ebdf=_0x596da5[0x0];var _0x4fd4c0=_0x596da5[_0x2fa3('0x23')]===0x2?_0x596da5[0x1]:_0x596da5[0x0];_0x24ae0e=monthCompare(_0x15d9d6,_0x12ebdf,_0x4fd4c0);}return _0x273084&&_0x2a2f33&&_0x36f549&&_0x24ae0e;}}module[_0x2fa3('0xc')][_0x2fa3('0x24')]=iftime; \ No newline at end of file diff --git a/server/utils/loggers.js b/server/utils/loggers.js index f1959c6..b2e33e0 100644 --- a/server/utils/loggers.js +++ b/server/utils/loggers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa5cd=['}}}','meta','keys','length','transports','Console','File','%s-%s','error','consoleLogger','path','moment','../config/environment','debugLevel','toLowerCase','info','redBG\x20white','red','bold\x20white','bold\x20green','gray','bold\x20blue','addColors','/var/log/xcally','message','{{{','replace','format','[%s]\x20[%s]\x20%s\x20-\x20%s','YYYY-MM-DD\x20HH:mm:ss','level','toUpperCase'];(function(_0x5e1b91,_0x236f17){var _0x59b52f=function(_0x5c05ed){while(--_0x5c05ed){_0x5e1b91['push'](_0x5e1b91['shift']());}};_0x59b52f(++_0x236f17);}(_0xa5cd,0xea));var _0xda5c=function(_0x5d4607,_0x6b5e7b){_0x5d4607=_0x5d4607-0x0;var _0x5e4a86=_0xa5cd[_0x5d4607];return _0x5e4a86;};'use strict';var path=require(_0xda5c('0x0'));var util=require('util');var moment=require(_0xda5c('0x1'));var winston=require('winston');var config=require(_0xda5c('0x2'));var debugLevel=config[_0xda5c('0x3')]?config[_0xda5c('0x3')][_0xda5c('0x4')]():_0xda5c('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':_0xda5c('0x6'),'error':_0xda5c('0x7'),'warn':'bold\x20yellow','info':'white','print':_0xda5c('0x8'),'success':_0xda5c('0x9'),'http':_0xda5c('0xa'),'verbose':'bold\x20magenta','debug':_0xda5c('0xb'),'silly':'bold\x20cyan'};winston[_0xda5c('0xc')](XC_LOG_COLORS);function getLogFileName(_0x11d403,_0x680302,_0x1da22e){var _0x5c1c55=_0x11d403||_0xda5c('0xd');return path['join'](_0x5c1c55,util['format']('%s-%s.log',_0x680302,_0x1da22e));}function formatter(_0x5ec0e9,_0x515974){_0x515974['message']=_0x515974[_0xda5c('0xe')]['replace'](/@@{/g,_0xda5c('0xf'))[_0xda5c('0x10')](/}@@/g,'}}}')[_0xda5c('0x10')](/@{/g,'{{')[_0xda5c('0x10')](/}@/g,'}}');return util[_0xda5c('0x11')](_0xda5c('0x12'),moment()[_0xda5c('0x11')](_0xda5c('0x13')),_0x515974[_0xda5c('0x14')][_0xda5c('0x15')](),_0x5ec0e9,_0x515974[_0xda5c('0xe')]);}function fileFormat(_0x207efc,_0x54da72){_0x54da72[_0xda5c('0xe')]=_0x54da72['message'][_0xda5c('0x10')](/@@{/g,_0xda5c('0xf'))['replace'](/}@@/g,_0xda5c('0x16'))[_0xda5c('0x10')](/@{/g,'{{')['replace'](/}@/g,'}}');var _0xb7794c=_0x54da72[_0xda5c('0x17')]&&Object[_0xda5c('0x18')](_0x54da72[_0xda5c('0x17')])[_0xda5c('0x19')]?'\x0a\x09'+JSON['stringify'](_0x54da72[_0xda5c('0x17')]):'';return util[_0xda5c('0x11')]('[%s]\x20[%s]\x20%s\x20-\x20%s\x20%s',moment()[_0xda5c('0x11')](_0xda5c('0x13')),_0x54da72[_0xda5c('0x14')][_0xda5c('0x15')](),_0x207efc,_0x54da72['message'],_0xb7794c);}function consoleLogger(){var _0x40c05c=new winston['Logger']({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0xda5c('0x1a'))][(_0xda5c('0x1b'))]({'level':'warn','json':![],'formatter':function(_0x16208b){return formatter('',_0x16208b);}})]});return _0x40c05c;}function fileLogger(_0x4d847b,_0x343d49){var _0x2df507=new winston['Logger']({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0xda5c('0x1a'))][(_0xda5c('0x1c'))]({'name':util[_0xda5c('0x11')](_0xda5c('0x1d'),_0x4d847b,_0xda5c('0x1e')),'filename':getLogFileName(_0x343d49,_0x4d847b,_0xda5c('0x1e')),'level':_0xda5c('0x1e'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x56c2fd){return fileFormat(_0x4d847b,_0x56c2fd);}}),new winston['transports'][(_0xda5c('0x1c'))]({'name':util[_0xda5c('0x11')]('%s-%s',_0x4d847b,debugLevel),'filename':getLogFileName(_0x343d49,_0x4d847b,debugLevel),'level':debugLevel,'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x4e4ebf){return fileFormat(_0x4d847b,_0x4e4ebf);}}),new winston['transports'][(_0xda5c('0x1b'))]({'level':'warn','json':![],'formatter':function(_0x2aa63c){return fileFormat(_0x4d847b,_0x2aa63c);}})]});return _0x2df507;}exports[_0xda5c('0x1f')]=consoleLogger;exports['fileLogger']=fileLogger; \ No newline at end of file +var _0x8422=['level','toUpperCase','keys','meta','length','stringify','YYYY-MM-DD\x20HH:mm:ss','Console','warn','Logger','transports','error','File','%s-%s','consoleLogger','fileLogger','path','util','moment','winston','../config/environment','debugLevel','toLowerCase','red','bold\x20yellow','bold\x20green','bold\x20magenta','bold\x20blue','addColors','/var/log/xcally','join','format','message','replace','{{{','}}}','[%s]\x20[%s]\x20%s\x20-\x20%s'];(function(_0x1ffc57,_0x4524b1){var _0x5401f4=function(_0x50a4d2){while(--_0x50a4d2){_0x1ffc57['push'](_0x1ffc57['shift']());}};_0x5401f4(++_0x4524b1);}(_0x8422,0x1cc));var _0x2842=function(_0x4b174a,_0x33a017){_0x4b174a=_0x4b174a-0x0;var _0x3cd7bf=_0x8422[_0x4b174a];return _0x3cd7bf;};'use strict';var path=require(_0x2842('0x0'));var util=require(_0x2842('0x1'));var moment=require(_0x2842('0x2'));var winston=require(_0x2842('0x3'));var config=require(_0x2842('0x4'));var debugLevel=config['debugLevel']?config[_0x2842('0x5')][_0x2842('0x6')]():'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':_0x2842('0x7'),'warn':_0x2842('0x8'),'info':'white','print':'bold\x20white','success':_0x2842('0x9'),'http':'gray','verbose':_0x2842('0xa'),'debug':_0x2842('0xb'),'silly':'bold\x20cyan'};winston[_0x2842('0xc')](XC_LOG_COLORS);function getLogFileName(_0x13ea03,_0x9183fe,_0x10dff7){var _0x45dfb1=_0x13ea03||_0x2842('0xd');return path[_0x2842('0xe')](_0x45dfb1,util[_0x2842('0xf')]('%s-%s.log',_0x9183fe,_0x10dff7));}function formatter(_0x4d5865,_0x1f8c5d){_0x1f8c5d[_0x2842('0x10')]=_0x1f8c5d[_0x2842('0x10')][_0x2842('0x11')](/@@{/g,_0x2842('0x12'))[_0x2842('0x11')](/}@@/g,_0x2842('0x13'))[_0x2842('0x11')](/@{/g,'{{')[_0x2842('0x11')](/}@/g,'}}');return util[_0x2842('0xf')](_0x2842('0x14'),moment()[_0x2842('0xf')]('YYYY-MM-DD\x20HH:mm:ss'),_0x1f8c5d[_0x2842('0x15')][_0x2842('0x16')](),_0x4d5865,_0x1f8c5d['message']);}function fileFormat(_0x4ed831,_0x50028b){_0x50028b['message']=_0x50028b[_0x2842('0x10')][_0x2842('0x11')](/@@{/g,_0x2842('0x12'))[_0x2842('0x11')](/}@@/g,_0x2842('0x13'))[_0x2842('0x11')](/@{/g,'{{')[_0x2842('0x11')](/}@/g,'}}');var _0x478cc4=_0x50028b['meta']&&Object[_0x2842('0x17')](_0x50028b[_0x2842('0x18')])[_0x2842('0x19')]?'\x0a\x09'+JSON[_0x2842('0x1a')](_0x50028b[_0x2842('0x18')]):'';return util[_0x2842('0xf')]('[%s]\x20[%s]\x20%s\x20-\x20%s\x20%s',moment()[_0x2842('0xf')](_0x2842('0x1b')),_0x50028b['level'][_0x2842('0x16')](),_0x4ed831,_0x50028b[_0x2842('0x10')],_0x478cc4);}function consoleLogger(){var _0x102043=new winston['Logger']({'levels':XC_LOG_LEVELS,'transports':[new winston['transports'][(_0x2842('0x1c'))]({'level':_0x2842('0x1d'),'json':![],'formatter':function(_0x125609){return formatter('',_0x125609);}})]});return _0x102043;}function fileLogger(_0x37fe6d,_0x819ab9){var _0x3f6c62=new winston[(_0x2842('0x1e'))]({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0x2842('0x1f'))]['File']({'name':util[_0x2842('0xf')]('%s-%s',_0x37fe6d,_0x2842('0x20')),'filename':getLogFileName(_0x819ab9,_0x37fe6d,_0x2842('0x20')),'level':_0x2842('0x20'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x4ab4ce){return fileFormat(_0x37fe6d,_0x4ab4ce);}}),new winston[(_0x2842('0x1f'))][(_0x2842('0x21'))]({'name':util[_0x2842('0xf')](_0x2842('0x22'),_0x37fe6d,debugLevel),'filename':getLogFileName(_0x819ab9,_0x37fe6d,debugLevel),'level':debugLevel,'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x175759){return fileFormat(_0x37fe6d,_0x175759);}}),new winston['transports'][(_0x2842('0x1c'))]({'level':_0x2842('0x1d'),'json':![],'formatter':function(_0x2a65ee){return fileFormat(_0x37fe6d,_0x2a65ee);}})]});return _0x3f6c62;}exports[_0x2842('0x23')]=consoleLogger;exports[_0x2842('0x24')]=fileLogger; \ No newline at end of file diff --git a/server/utils/mask-sensitive-data.js b/server/utils/mask-sensitive-data.js index 7a424c2..07ae7bd 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 _0x0295=['length','isString','replace','}@@','includes','exports','lodash','newPassword','lastName','street','phone','mobile','fax','email','clientId','clientSecret','securityToken','token','accessToken','authToken','consumerSecret','membername','calleridname','exten','vidaooApiKey','clientEmail','accesskeyid','secretaccesskey','localstationid','dsn','secret','registry','oldPassword','isPlainObject','isArray'];(function(_0x4179e2,_0xf2dbb){var _0x24cb50=function(_0x3b7899){while(--_0x3b7899){_0x4179e2['push'](_0x4179e2['shift']());}};_0x24cb50(++_0xf2dbb);}(_0x0295,0x1f0));var _0x5029=function(_0x3ed0ec,_0x44ece7){_0x3ed0ec=_0x3ed0ec-0x0;var _0x4b32f4=_0x0295[_0x3ed0ec];return _0x4b32f4;};var _=require(_0x5029('0x0'));var sensitiveFields=['username','password',_0x5029('0x1'),'apiKey','firstName',_0x5029('0x2'),_0x5029('0x3'),_0x5029('0x4'),_0x5029('0x5'),_0x5029('0x6'),_0x5029('0x7'),_0x5029('0x8'),_0x5029('0x9'),_0x5029('0xa'),'code','accessKey','tenantId',_0x5029('0xb'),'channelSecret',_0x5029('0xc'),'accessTokenSecret',_0x5029('0xd'),'consumerKey',_0x5029('0xe'),_0x5029('0xf'),_0x5029('0x10'),'calleridnum',_0x5029('0x11'),_0x5029('0x12'),_0x5029('0x13'),'privateKey',_0x5029('0x14'),_0x5029('0x15'),'key','user','pass','accountSid',_0x5029('0x16'),_0x5029('0x17'),_0x5029('0x18'),_0x5029('0x19'),_0x5029('0x1a')];function maskSensitiveData(_0x11c24b){const _0xe278b7=/(?!^)[\s\S](?!$)/g;if(_[_0x5029('0x1b')](_0x11c24b)){for(const _0x10bf55 in _0x11c24b){if(_[_0x5029('0x1c')](_0x11c24b[_0x10bf55])){for(let _0x457c73=0x0;_0x457c73<_0x11c24b[_0x10bf55][_0x5029('0x1d')];_0x457c73++){maskSensitiveData(_0x11c24b[_0x10bf55][_0x457c73]);}}else if(_[_0x5029('0x1b')](_0x11c24b[_0x10bf55])){maskSensitiveData(_0x11c24b[_0x10bf55]);}else if(_[_0x5029('0x1e')](_0x11c24b[_0x10bf55])){_0x11c24b[_0x10bf55]=_0x11c24b[_0x10bf55][_0x5029('0x1f')](/{{{/g,'@@{')[_0x5029('0x1f')](/}}}/g,_0x5029('0x20'))[_0x5029('0x1f')](/{{/g,'@{')[_0x5029('0x1f')](/}}/g,'}@');if(_[_0x5029('0x21')](sensitiveFields,_0x10bf55)){_0x11c24b[_0x10bf55]=_0x11c24b[_0x10bf55][_0x5029('0x1f')](_0xe278b7,'*');}}}}}module[_0x5029('0x22')]['maskSensitiveData']=maskSensitiveData; \ No newline at end of file +var _0x0b0e=['}@@','lodash','password','apiKey','firstName','lastName','street','phone','mobile','fax','email','clientId','clientSecret','securityToken','tenantId','token','channelSecret','accessToken','authToken','consumerKey','membername','calleridname','exten','vidaooApiKey','clientEmail','accesskeyid','secretaccesskey','key','user','pass','localstationid','dsn','secret','registry','oldPassword','isArray','length','isString','replace'];(function(_0x299478,_0x5afe3b){var _0x5c7533=function(_0x3f10e0){while(--_0x3f10e0){_0x299478['push'](_0x299478['shift']());}};_0x5c7533(++_0x5afe3b);}(_0x0b0e,0x187));var _0xe0b0=function(_0x3dc089,_0x5ccb0d){_0x3dc089=_0x3dc089-0x0;var _0x34d9d3=_0x0b0e[_0x3dc089];return _0x34d9d3;};var _=require(_0xe0b0('0x0'));var sensitiveFields=['username',_0xe0b0('0x1'),'newPassword',_0xe0b0('0x2'),_0xe0b0('0x3'),_0xe0b0('0x4'),_0xe0b0('0x5'),_0xe0b0('0x6'),_0xe0b0('0x7'),_0xe0b0('0x8'),_0xe0b0('0x9'),_0xe0b0('0xa'),_0xe0b0('0xb'),_0xe0b0('0xc'),'code','accessKey',_0xe0b0('0xd'),_0xe0b0('0xe'),_0xe0b0('0xf'),_0xe0b0('0x10'),'accessTokenSecret',_0xe0b0('0x11'),_0xe0b0('0x12'),'consumerSecret',_0xe0b0('0x13'),_0xe0b0('0x14'),'calleridnum',_0xe0b0('0x15'),_0xe0b0('0x16'),_0xe0b0('0x17'),'privateKey',_0xe0b0('0x18'),_0xe0b0('0x19'),_0xe0b0('0x1a'),_0xe0b0('0x1b'),_0xe0b0('0x1c'),'accountSid',_0xe0b0('0x1d'),_0xe0b0('0x1e'),_0xe0b0('0x1f'),_0xe0b0('0x20'),_0xe0b0('0x21')];function maskSensitiveData(_0x55d884){const _0x41a7e2=/(?!^)[\s\S](?!$)/g;if(_['isPlainObject'](_0x55d884)){for(const _0x35cb40 in _0x55d884){if(_[_0xe0b0('0x22')](_0x55d884[_0x35cb40])){for(let _0x519ae8=0x0;_0x519ae8<_0x55d884[_0x35cb40][_0xe0b0('0x23')];_0x519ae8++){maskSensitiveData(_0x55d884[_0x35cb40][_0x519ae8]);}}else if(_['isPlainObject'](_0x55d884[_0x35cb40])){maskSensitiveData(_0x55d884[_0x35cb40]);}else if(_[_0xe0b0('0x24')](_0x55d884[_0x35cb40])){_0x55d884[_0x35cb40]=_0x55d884[_0x35cb40][_0xe0b0('0x25')](/{{{/g,'@@{')['replace'](/}}}/g,_0xe0b0('0x26'))['replace'](/{{/g,'@{')['replace'](/}}/g,'}@');if(_['includes'](sensitiveFields,_0x35cb40)){_0x55d884[_0x35cb40]=_0x55d884[_0x35cb40][_0xe0b0('0x25')](_0x41a7e2,'*');}}}}}module['exports']['maskSensitiveData']=maskSensitiveData; \ No newline at end of file diff --git a/server/utils/safe-template.js b/server/utils/safe-template.js index 8a751dc..8797e30 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 _0x4cf8=['safeTemplate','lodash','{\x20{\x20','\x20}\x20}','string','replace','isArray','map','isPlainObject','exports'];(function(_0x468552,_0x2043cb){var _0x3d4d46=function(_0x34467e){while(--_0x34467e){_0x468552['push'](_0x468552['shift']());}};_0x3d4d46(++_0x2043cb);}(_0x4cf8,0x1e1));var _0x84cf=function(_0x456b57,_0x58691a){_0x456b57=_0x456b57-0x0;var _0x18f49f=_0x4cf8[_0x456b57];return _0x18f49f;};var _=require(_0x84cf('0x0'));var mustacheLikeBracketsRx=/(\{|\}){2}/gm;function bracketsReplacer(_0x2d03b6){return _0x2d03b6==='{{'?_0x84cf('0x1'):_0x84cf('0x2');}function safeTemplate(_0xae953){var _0x28455b=_0xae953;if(typeof _0xae953===_0x84cf('0x3')){_0x28455b=_0xae953[_0x84cf('0x4')](mustacheLikeBracketsRx,bracketsReplacer);}else if(Array[_0x84cf('0x5')](_0xae953)){_0x28455b=_0xae953[_0x84cf('0x6')](function(_0x5844d7){return safeTemplate(_0x5844d7);});}else if(_[_0x84cf('0x7')](_0xae953)){_0x28455b=Object['keys'](_0xae953)['reduce'](function(_0x455345,_0x56c5cc){_0x455345[_0x56c5cc]=safeTemplate(_0xae953[_0x56c5cc]);return _0x455345;},{});}return _0x28455b;}module[_0x84cf('0x8')][_0x84cf('0x9')]=safeTemplate; \ No newline at end of file +var _0x7708=['lodash','\x20}\x20}','isArray','map','isPlainObject','reduce','exports','safeTemplate'];(function(_0x2aebb8,_0x36a913){var _0xcb804f=function(_0x5357c3){while(--_0x5357c3){_0x2aebb8['push'](_0x2aebb8['shift']());}};_0xcb804f(++_0x36a913);}(_0x7708,0x188));var _0x8770=function(_0x23c6f2,_0x4e033c){_0x23c6f2=_0x23c6f2-0x0;var _0x4c270b=_0x7708[_0x23c6f2];return _0x4c270b;};var _=require(_0x8770('0x0'));var mustacheLikeBracketsRx=/(\{|\}){2}/gm;function bracketsReplacer(_0x24909b){return _0x24909b==='{{'?'{\x20{\x20':_0x8770('0x1');}function safeTemplate(_0x5a8b5b){var _0x5ca46f=_0x5a8b5b;if(typeof _0x5a8b5b==='string'){_0x5ca46f=_0x5a8b5b['replace'](mustacheLikeBracketsRx,bracketsReplacer);}else if(Array[_0x8770('0x2')](_0x5a8b5b)){_0x5ca46f=_0x5a8b5b[_0x8770('0x3')](function(_0x577b13){return safeTemplate(_0x577b13);});}else if(_[_0x8770('0x4')](_0x5a8b5b)){_0x5ca46f=Object['keys'](_0x5a8b5b)[_0x8770('0x5')](function(_0x42d305,_0x2b0295){_0x42d305[_0x2b0295]=safeTemplate(_0x5a8b5b[_0x2b0295]);return _0x42d305;},{});}return _0x5ca46f;}module[_0x8770('0x6')][_0x8770('0x7')]=safeTemplate; \ No newline at end of file diff --git a/server/utils/update-app-config.js b/server/utils/update-app-config.js index 26fb6c5..316d95a 100644 --- a/server/utils/update-app-config.js +++ b/server/utils/update-app-config.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x98cb=['Updating\x20app.json','writeJSON','exports','fs-extra','path','../config/environment','root','resolve','server/app.json','legacy-libs','isArray','apps','findIndex','name','env','NODE_PATH','string','readJSON','then','updated','info'];(function(_0xf168fd,_0x33b8d4){var _0x105630=function(_0x5e29d7){while(--_0x5e29d7){_0xf168fd['push'](_0xf168fd['shift']());}};_0x105630(++_0x33b8d4);}(_0x98cb,0x13e));var _0xb98c=function(_0x4c0d77,_0x3b0b5d){_0x4c0d77=_0x4c0d77-0x0;var _0x5560f1=_0x98cb[_0x4c0d77];return _0x5560f1;};var fs=require(_0xb98c('0x0'));var path=require(_0xb98c('0x1'));var config=require(_0xb98c('0x2'));var root=config[_0xb98c('0x3')];var APP_JSON_PATH=path[_0xb98c('0x4')](root,_0xb98c('0x5'));var NODEPATH=path[_0xb98c('0x4')](root,_0xb98c('0x6'));function setLegacyLibsNodeEnvPath(_0x1dbca6){let _0x45d7e0=![];if(Array[_0xb98c('0x7')](_0x1dbca6[_0xb98c('0x8')])){var _0x43d8c6=_0x1dbca6['apps'][_0xb98c('0x9')](function(_0x4c8895){return _0x4c8895[_0xb98c('0xa')]==='motion2';});if(_0x43d8c6>-0x1){var _0x1a96d8=_0x1dbca6[_0xb98c('0x8')][_0x43d8c6];if(typeof _0x1a96d8[_0xb98c('0xb')][_0xb98c('0xc')]!==_0xb98c('0xd')){_0x1a96d8[_0xb98c('0xb')][_0xb98c('0xc')]=NODEPATH;_0x45d7e0=!![];}}return{'appConfig':_0x1dbca6,'updated':_0x45d7e0};}}function updateAppConfig(_0x4af353){return fs['pathExists'](APP_JSON_PATH)['then'](function(_0x1ddd3b){if(_0x1ddd3b){return fs[_0xb98c('0xe')](APP_JSON_PATH)[_0xb98c('0xf')](function(_0x2f943a){var _0x366611=setLegacyLibsNodeEnvPath(_0x2f943a);if(_0x366611[_0xb98c('0x10')]){_0x4af353[_0xb98c('0x11')](_0xb98c('0x12'));return fs[_0xb98c('0x13')](APP_JSON_PATH,_0x2f943a,{'spaces':0x2});}else{return Promise[_0xb98c('0x4')]();}});}else{return Promise['resolve']();}});}module[_0xb98c('0x14')]=updateAppConfig; \ No newline at end of file +var _0x00ab=['info','writeJSON','exports','path','../config/environment','resolve','server/app.json','apps','findIndex','name','motion2','string','env','NODE_PATH','pathExists','then','updated'];(function(_0x1d1b87,_0x4d8e8c){var _0x2a0c19=function(_0x6cb6cd){while(--_0x6cb6cd){_0x1d1b87['push'](_0x1d1b87['shift']());}};_0x2a0c19(++_0x4d8e8c);}(_0x00ab,0x135));var _0xb00a=function(_0x528ecb,_0x5d9fb9){_0x528ecb=_0x528ecb-0x0;var _0x33c465=_0x00ab[_0x528ecb];return _0x33c465;};var fs=require('fs-extra');var path=require(_0xb00a('0x0'));var config=require(_0xb00a('0x1'));var root=config['root'];var APP_JSON_PATH=path[_0xb00a('0x2')](root,_0xb00a('0x3'));var NODEPATH=path[_0xb00a('0x2')](root,'legacy-libs');function setLegacyLibsNodeEnvPath(_0x4b624b){let _0x463e9d=![];if(Array['isArray'](_0x4b624b[_0xb00a('0x4')])){var _0x1cfb10=_0x4b624b[_0xb00a('0x4')][_0xb00a('0x5')](function(_0x463b95){return _0x463b95[_0xb00a('0x6')]===_0xb00a('0x7');});if(_0x1cfb10>-0x1){var _0x15278e=_0x4b624b[_0xb00a('0x4')][_0x1cfb10];if(typeof _0x15278e['env']['NODE_PATH']!==_0xb00a('0x8')){_0x15278e[_0xb00a('0x9')][_0xb00a('0xa')]=NODEPATH;_0x463e9d=!![];}}return{'appConfig':_0x4b624b,'updated':_0x463e9d};}}function updateAppConfig(_0x57eb53){return fs[_0xb00a('0xb')](APP_JSON_PATH)['then'](function(_0x5d54bc){if(_0x5d54bc){return fs['readJSON'](APP_JSON_PATH)[_0xb00a('0xc')](function(_0x4a62d6){var _0x4fb213=setLegacyLibsNodeEnvPath(_0x4a62d6);if(_0x4fb213[_0xb00a('0xd')]){_0x57eb53[_0xb00a('0xe')]('Updating\x20app.json');return fs[_0xb00a('0xf')](APP_JSON_PATH,_0x4a62d6,{'spaces':0x2});}else{return Promise[_0xb00a('0x2')]();}});}else{return Promise[_0xb00a('0x2')]();}});}module[_0xb00a('0x10')]=updateAppConfig; \ No newline at end of file diff --git a/snippet/3.5.0/index.html b/snippet/3.5.0/index.html index 6ef5076..c06e349 100644 --- a/snippet/3.5.0/index.html +++ b/snippet/3.5.0/index.html @@ -26,4 +26,4 @@ status != 'online' && status != 'offline' && status != 'unmanaged' - " ng-click="vm.close(); $event.stopPropagation();">
\ No newline at end of file + " ng-click="vm.close(); $event.stopPropagation();">